From: support Date: Wed, 6 Apr 2022 17:21:58 +0000 (+0000) Subject: Built motion from commit 167bccf5.|2.6.7 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=2c64ba2f47dd587a14e7b9bb502ce006017f85a9;p=motion2.git Built motion from commit 167bccf5.|2.6.7 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9637fd0..a461b75 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T15:27:39.084Z", + "time": "2022-04-06T17:14:53.092Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 19176dc..064f523 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-04-06T15:27:39.084Z", + "time": "2022-04-06T17:14:53.092Z", "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 f5a511d..8389daf 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 _0xa1f7=['jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0xa1f7,0xda));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7a1f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a1f('0x1')],'get':function(_0x3ab9f1){return this[_0x7a1f('0x2')]('action');}},'action':{'type':Sequelize[_0x7a1f('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x7a1f('0x4'),_0x7a1f('0x5'),_0x7a1f('0x6'),_0x7a1f('0x7'),_0x7a1f('0x8'),_0x7a1f('0x9'),_0x7a1f('0xa'),_0x7a1f('0xb')]],'msg':_0x7a1f('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xd')},'data2':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xe')},'data3':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comment':_0x7a1f('0xf')},'data4':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comments':_0x7a1f('0x10')},'data5':{'type':Sequelize[_0x7a1f('0x3')](0x1000),'comments':_0x7a1f('0x11')},'data6':{'type':Sequelize[_0x7a1f('0x3')],'comments':_0x7a1f('0x12')},'data7':{'type':Sequelize[_0x7a1f('0x13')],'comments':_0x7a1f('0x14')}}; \ No newline at end of file +var _0x04b1=['sequelize','exports','VIRTUAL','STRING','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x342348,_0x4bab5e){var _0x1410de=function(_0x4adac4){while(--_0x4adac4){_0x342348['push'](_0x342348['shift']());}};_0x1410de(++_0x4bab5e);}(_0x04b1,0x98));var _0x104b=function(_0xfc406a,_0x4479e1){_0xfc406a=_0xfc406a-0x0;var _0x395473=_0x04b1[_0xfc406a];return _0x395473;};'use strict';var Sequelize=require(_0x104b('0x0'));module[_0x104b('0x1')]={'name':{'type':Sequelize[_0x104b('0x2')],'get':function(_0x3f4c3c){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x104b('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x104b('0x4'),_0x104b('0x5'),_0x104b('0x6'),_0x104b('0x7'),_0x104b('0x8'),_0x104b('0x9'),_0x104b('0xa')]],'msg':_0x104b('0xb')}},'comment':_0x104b('0xb')},'data1':{'type':Sequelize[_0x104b('0x3')](0x1000),'comment':_0x104b('0xc')},'data2':{'type':Sequelize[_0x104b('0x3')](0x1000),'comment':_0x104b('0xd')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x104b('0xe')},'data4':{'type':Sequelize[_0x104b('0x3')](0x1000),'comments':_0x104b('0xf')},'data5':{'type':Sequelize[_0x104b('0x3')](0x1000),'comments':_0x104b('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x104b('0x11')},'data7':{'type':Sequelize[_0x104b('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 86f0d2e..6e3151e 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 _0xec73=['count','set','apply','save','destroy','then','name','send','update','body','Action','find','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','offset','undefined','limit'];(function(_0x1e1cde,_0xb27095){var _0x2f5aa8=function(_0x26a804){while(--_0x26a804){_0x1e1cde['push'](_0x1e1cde['shift']());}};_0x2f5aa8(++_0xb27095);}(_0xec73,0x11f));var _0x3ec7=function(_0x1b2fad,_0x1e85ec){_0x1b2fad=_0x1b2fad-0x0;var _0x325176=_0xec73[_0x1b2fad];return _0x325176;};'use strict';var emlformat=require(_0x3ec7('0x0'));var rimraf=require(_0x3ec7('0x1'));var zipdir=require(_0x3ec7('0x2'));var jsonpatch=require(_0x3ec7('0x3'));var rp=require('request-promise');var moment=require(_0x3ec7('0x4'));var BPromise=require(_0x3ec7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3ec7('0x6'));var csv=require(_0x3ec7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3ec7('0x8'));var _=require(_0x3ec7('0x9'));var squel=require(_0x3ec7('0xa'));var crypto=require(_0x3ec7('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3ec7('0x7'));var querystring=require(_0x3ec7('0xc'));var Papa=require(_0x3ec7('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3ec7('0xe'));var as=require(_0x3ec7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ec7('0x10'))(_0x3ec7('0x11'));var utils=require(_0x3ec7('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x3ec7('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f2c5b,_0x2f23ae){_0x2f23ae=_0x2f23ae||0xcc;return function(_0x9c173d){if(_0x9c173d){return _0x4f2c5b[_0x3ec7('0x14')](_0x2f23ae);}return _0x4f2c5b[_0x3ec7('0x15')](_0x2f23ae)['end']();};}function respondWithResult(_0x2d4895,_0x710943){_0x710943=_0x710943||0xc8;return function(_0x3fc3d8){if(_0x3fc3d8){return _0x2d4895['status'](_0x710943)['json'](_0x3fc3d8);}};}function respondWithFilteredResult(_0x1190c8,_0x6688ca){return function(_0x13f5e4){if(_0x13f5e4){var _0x1564e8=typeof _0x6688ca[_0x3ec7('0x16')]===_0x3ec7('0x17')&&typeof _0x6688ca[_0x3ec7('0x18')]===_0x3ec7('0x17');var _0x2ba19c=_0x13f5e4[_0x3ec7('0x19')];var _0x49433c=_0x1564e8?0x0:_0x6688ca[_0x3ec7('0x16')];var _0x20518a=_0x1564e8?_0x13f5e4[_0x3ec7('0x19')]:_0x6688ca[_0x3ec7('0x16')]+_0x6688ca[_0x3ec7('0x18')];var _0x3cea7e;if(_0x20518a>=_0x2ba19c){_0x20518a=_0x2ba19c;_0x3cea7e=0xc8;}else{_0x3cea7e=0xce;}_0x1190c8[_0x3ec7('0x15')](_0x3cea7e);return _0x1190c8[_0x3ec7('0x1a')]('Content-Range',_0x49433c+'-'+_0x20518a+'/'+_0x2ba19c)['json'](_0x13f5e4);}return null;};}function patchUpdates(_0x3a0319){return function(_0x4852f8){try{jsonpatch[_0x3ec7('0x1b')](_0x4852f8,_0x3a0319,!![]);}catch(_0x3cbcf1){return BPromise['reject'](_0x3cbcf1);}return _0x4852f8[_0x3ec7('0x1c')]();};}function saveUpdates(_0x3b11e9,_0x3597fd){return function(_0x24dcb5){if(_0x24dcb5){return _0x24dcb5['update'](_0x3b11e9)['then'](function(_0x862de8){return _0x862de8;});}return null;};}function removeEntity(_0x16ecb6,_0x31b103){return function(_0xeb658a){if(_0xeb658a){return _0xeb658a[_0x3ec7('0x1d')]()[_0x3ec7('0x1e')](function(){_0x16ecb6[_0x3ec7('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18d66a,_0x4738c3){return function(_0x338f52){if(!_0x338f52){_0x18d66a['sendStatus'](0x194);}return _0x338f52;};}function handleError(_0x35bf8e,_0x434322){_0x434322=_0x434322||0x1f4;return function(_0x163cb6){logger['error'](_0x163cb6['stack']);if(_0x163cb6[_0x3ec7('0x1f')]){delete _0x163cb6[_0x3ec7('0x1f')];}_0x35bf8e[_0x3ec7('0x15')](_0x434322)[_0x3ec7('0x20')](_0x163cb6);};}exports[_0x3ec7('0x21')]=function(_0x46745f,_0x2c19ff){if(_0x46745f[_0x3ec7('0x22')]['id']){delete _0x46745f['body']['id'];}return db[_0x3ec7('0x23')][_0x3ec7('0x24')]({'where':{'id':_0x46745f[_0x3ec7('0x25')]['id']}})[_0x3ec7('0x1e')](handleEntityNotFound(_0x2c19ff,null))['then'](saveUpdates(_0x46745f['body'],null))['then'](respondWithResult(_0x2c19ff,null))[_0x3ec7('0x26')](handleError(_0x2c19ff,null));};exports['destroy']=function(_0x5b6bb9,_0x3f38fd){return db[_0x3ec7('0x23')][_0x3ec7('0x24')]({'where':{'id':_0x5b6bb9[_0x3ec7('0x25')]['id']}})[_0x3ec7('0x1e')](handleEntityNotFound(_0x3f38fd,null))[_0x3ec7('0x1e')](removeEntity(_0x3f38fd,null))[_0x3ec7('0x26')](handleError(_0x3f38fd,null));}; \ No newline at end of file +var _0x6504=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','json','apply','reject','save','update','destroy','then','error','stack','name','send','body','Action','find','params','catch','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x8fb155,_0x4068b4){var _0x5edaed=function(_0x41ec5d){while(--_0x41ec5d){_0x8fb155['push'](_0x8fb155['shift']());}};_0x5edaed(++_0x4068b4);}(_0x6504,0x9e));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4650('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4650('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4650('0x2'));var util=require(_0x4650('0x3'));var path=require(_0x4650('0x4'));var sox=require(_0x4650('0x5'));var csv=require(_0x4650('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4650('0x7'));var _=require('lodash');var squel=require(_0x4650('0x8'));var crypto=require('crypto');var jsforce=require(_0x4650('0x9'));var deskjs=require(_0x4650('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4650('0xb'));var Papa=require(_0x4650('0xc'));var Redis=require(_0x4650('0xd'));var authService=require(_0x4650('0xe'));var qs=require(_0x4650('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4650('0x10'));var logger=require(_0x4650('0x11'))(_0x4650('0x12'));var utils=require(_0x4650('0x13'));var config=require(_0x4650('0x14'));var licenseUtil=require(_0x4650('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfd5c72,_0x14f32b){_0x14f32b=_0x14f32b||0xcc;return function(_0x13508d){if(_0x13508d){return _0xfd5c72[_0x4650('0x16')](_0x14f32b);}return _0xfd5c72[_0x4650('0x17')](_0x14f32b)[_0x4650('0x18')]();};}function respondWithResult(_0x11e131,_0x399c0b){_0x399c0b=_0x399c0b||0xc8;return function(_0x5f12b5){if(_0x5f12b5){return _0x11e131['status'](_0x399c0b)['json'](_0x5f12b5);}};}function respondWithFilteredResult(_0x49b41b,_0x3b630c){return function(_0xc7cefd){if(_0xc7cefd){var _0xbcf39d=typeof _0x3b630c['offset']===_0x4650('0x19')&&typeof _0x3b630c['limit']===_0x4650('0x19');var _0x111d05=_0xc7cefd[_0x4650('0x1a')];var _0x27da65=_0xbcf39d?0x0:_0x3b630c['offset'];var _0x3e4e81=_0xbcf39d?_0xc7cefd[_0x4650('0x1a')]:_0x3b630c[_0x4650('0x1b')]+_0x3b630c['limit'];var _0x73cb;if(_0x3e4e81>=_0x111d05){_0x3e4e81=_0x111d05;_0x73cb=0xc8;}else{_0x73cb=0xce;}_0x49b41b[_0x4650('0x17')](_0x73cb);return _0x49b41b['set']('Content-Range',_0x27da65+'-'+_0x3e4e81+'/'+_0x111d05)[_0x4650('0x1c')](_0xc7cefd);}return null;};}function patchUpdates(_0xc92bad){return function(_0x5021e1){try{jsonpatch[_0x4650('0x1d')](_0x5021e1,_0xc92bad,!![]);}catch(_0x374a74){return BPromise[_0x4650('0x1e')](_0x374a74);}return _0x5021e1[_0x4650('0x1f')]();};}function saveUpdates(_0xaf7fa6,_0x2ffd36){return function(_0x50b63c){if(_0x50b63c){return _0x50b63c[_0x4650('0x20')](_0xaf7fa6)['then'](function(_0x473a82){return _0x473a82;});}return null;};}function removeEntity(_0x9d1a5d,_0x1c5a07){return function(_0x5e3b78){if(_0x5e3b78){return _0x5e3b78[_0x4650('0x21')]()[_0x4650('0x22')](function(){_0x9d1a5d[_0x4650('0x17')](0xcc)[_0x4650('0x18')]();});}};}function handleEntityNotFound(_0x567471,_0x4740fb){return function(_0x419e83){if(!_0x419e83){_0x567471[_0x4650('0x16')](0x194);}return _0x419e83;};}function handleError(_0x1a0828,_0xa9577a){_0xa9577a=_0xa9577a||0x1f4;return function(_0xa8c495){logger[_0x4650('0x23')](_0xa8c495[_0x4650('0x24')]);if(_0xa8c495[_0x4650('0x25')]){delete _0xa8c495['name'];}_0x1a0828[_0x4650('0x17')](_0xa9577a)[_0x4650('0x26')](_0xa8c495);};}exports[_0x4650('0x20')]=function(_0x5cfe13,_0x6f5f5){if(_0x5cfe13['body']['id']){delete _0x5cfe13[_0x4650('0x27')]['id'];}return db[_0x4650('0x28')][_0x4650('0x29')]({'where':{'id':_0x5cfe13['params']['id']}})[_0x4650('0x22')](handleEntityNotFound(_0x6f5f5,null))['then'](saveUpdates(_0x5cfe13[_0x4650('0x27')],null))[_0x4650('0x22')](respondWithResult(_0x6f5f5,null))['catch'](handleError(_0x6f5f5,null));};exports['destroy']=function(_0x250211,_0x4549a5){return db[_0x4650('0x28')][_0x4650('0x29')]({'where':{'id':_0x250211[_0x4650('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4549a5,null))[_0x4650('0x22')](removeEntity(_0x4549a5,null))[_0x4650('0x2b')](handleError(_0x4549a5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 9379ee1..f21b639 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 _0xff24=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x3c7784,_0x19115b){var _0x332e8e=function(_0x32b782){while(--_0x32b782){_0x3c7784['push'](_0x3c7784['shift']());}};_0x332e8e(++_0x19115b);}(_0xff24,0x82));var _0x4ff2=function(_0x3a1452,_0x5ba3a4){_0x3a1452=_0x3a1452-0x0;var _0x2a8fc5=_0xff24[_0x3a1452];return _0x2a8fc5;};'use strict';var _=require(_0x4ff2('0x0'));var util=require('util');var logger=require(_0x4ff2('0x1'))(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require(_0x4ff2('0x6'));var rimraf=require('rimraf');var config=require(_0x4ff2('0x7'));var attributes=require(_0x4ff2('0x8'));module[_0x4ff2('0x9')]=function(_0x5d7fcc,_0x36a23a){return _0x5d7fcc[_0x4ff2('0xa')](_0x4ff2('0xb'),attributes,{'tableName':_0x4ff2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x915f=['define','Action','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./action.attributes'];(function(_0x217f22,_0x139c6d){var _0x5936c1=function(_0xc0ec4){while(--_0xc0ec4){_0x217f22['push'](_0x217f22['shift']());}};_0x5936c1(++_0x139c6d);}(_0x915f,0xf4));var _0xf915=function(_0x201aa2,_0x1c3f52){_0x201aa2=_0x201aa2-0x0;var _0x2cc044=_0x915f[_0x201aa2];return _0x2cc044;};'use strict';var _=require(_0xf915('0x0'));var util=require(_0xf915('0x1'));var logger=require(_0xf915('0x2'))(_0xf915('0x3'));var moment=require(_0xf915('0x4'));var BPromise=require('bluebird');var rp=require(_0xf915('0x5'));var fs=require('fs');var path=require(_0xf915('0x6'));var rimraf=require(_0xf915('0x7'));var config=require('../../config/environment');var attributes=require(_0xf915('0x8'));module['exports']=function(_0x2ad065,_0x4ad361){return _0x2ad065[_0xf915('0x9')](_0xf915('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 3be11ae..2f48599 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2817ca,_0x168a1a){_0x2817ca=_0x2817ca-0x0;var _0x343ee3=_0x1cb9[_0x2817ca];return _0x343ee3;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x814b=['info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x814b,0x1a2));var _0xb814=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x814b[_0x22bdd3];return _0x44d9d9;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Action,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index ef5f101..6510002 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 _0xa6b7=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','/:id','isAuthenticated'];(function(_0x135365,_0x5ce7bf){var _0x3cdc77=function(_0x589ebe){while(--_0x589ebe){_0x135365['push'](_0x135365['shift']());}};_0x3cdc77(++_0x5ce7bf);}(_0xa6b7,0x184));var _0x7a6b=function(_0xabfec4,_0x35076e){_0xabfec4=_0xabfec4-0x0;var _0x7bafa2=_0xa6b7[_0xabfec4];return _0x7bafa2;};'use strict';var multer=require(_0x7a6b('0x0'));var util=require(_0x7a6b('0x1'));var path=require(_0x7a6b('0x2'));var timeout=require(_0x7a6b('0x3'));var express=require('express');var router=express[_0x7a6b('0x4')]();var fs_extra=require(_0x7a6b('0x5'));var auth=require(_0x7a6b('0x6'));var interaction=require(_0x7a6b('0x7'));var config=require('../../config/environment');var controller=require(_0x7a6b('0x8'));router[_0x7a6b('0x9')](_0x7a6b('0xa'),auth[_0x7a6b('0xb')](),controller[_0x7a6b('0xc')]);router[_0x7a6b('0xd')](_0x7a6b('0xa'),auth['isAuthenticated'](),controller[_0x7a6b('0xe')]);module[_0x7a6b('0xf')]=router; \ No newline at end of file +var _0x107d=['../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x52780c,_0xf6b20d){var _0x45a2ce=function(_0x13d432){while(--_0x13d432){_0x52780c['push'](_0x52780c['shift']());}};_0x45a2ce(++_0xf6b20d);}(_0x107d,0x104));var _0xd107=function(_0x4571d7,_0x474cb3){_0x4571d7=_0x4571d7-0x0;var _0x59d07e=_0x107d[_0x4571d7];return _0x59d07e;};'use strict';var multer=require(_0xd107('0x0'));var util=require('util');var path=require(_0xd107('0x1'));var timeout=require(_0xd107('0x2'));var express=require(_0xd107('0x3'));var router=express['Router']();var fs_extra=require(_0xd107('0x4'));var auth=require(_0xd107('0x5'));var interaction=require(_0xd107('0x6'));var config=require(_0xd107('0x7'));var controller=require(_0xd107('0x8'));router[_0xd107('0x9')](_0xd107('0xa'),auth[_0xd107('0xb')](),controller[_0xd107('0xc')]);router[_0xd107('0xd')](_0xd107('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index c4a65c2..afc1075 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 _0x46ed=['sequelize','exports','STRING','TEXT'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0xd46e('0x0'));module[_0xd46e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd46e('0x2')]},'parent':{'type':Sequelize[_0xd46e('0x2')]},'table':{'type':Sequelize[_0xd46e('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xd46e('0x3')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x4e21ba,_0x18097f){var _0x55b94b=function(_0x3b9add){while(--_0x3b9add){_0x4e21ba['push'](_0x4e21ba['shift']());}};_0x55b94b(++_0x18097f);}(_0x5fd1,0x155));var _0x15fd=function(_0x34ad4c,_0x3bdf9a){_0x34ad4c=_0x34ad4c-0x0;var _0x400bb8=_0x5fd1[_0x34ad4c];return _0x400bb8;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 97fff75..cdfba30 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 _0xabfc=['save','then','get','CustomReports','UserProfileResource','destroy','stack','name','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','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)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','length','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','MetricId','function','replace','format','groupBy','group','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','operator','value','AnalyticMetric','from','table','order','DESC','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','ValidationErrorItem','metric','%s.%s\x20=\x20%s.%s','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x186a10,_0x2c1d47){var _0x45c11d=function(_0xf460ea){while(--_0xf460ea){_0x186a10['push'](_0x186a10['shift']());}};_0x45c11d(++_0x2c1d47);}(_0xabfc,0x137));var _0xcabf=function(_0x4f4c2a,_0x5f5a28){_0x4f4c2a=_0x4f4c2a-0x0;var _0xd15be6=_0xabfc[_0x4f4c2a];return _0xd15be6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcabf('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcabf('0x1'));var moment=require(_0xcabf('0x2'));var BPromise=require(_0xcabf('0x3'));var Mustache=require(_0xcabf('0x4'));var util=require(_0xcabf('0x5'));var path=require(_0xcabf('0x6'));var sox=require(_0xcabf('0x7'));var csv=require('to-csv');var ejs=require(_0xcabf('0x8'));var fs=require('fs');var fs_extra=require(_0xcabf('0x9'));var _=require('lodash');var squel=require(_0xcabf('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcabf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcabf('0xc'));var Papa=require(_0xcabf('0xd'));var Redis=require(_0xcabf('0xe'));var authService=require(_0xcabf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcabf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcabf('0x11'))(_0xcabf('0x12'));var utils=require(_0xcabf('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcabf('0x14'))['db'];var dbH=require(_0xcabf('0x14'))['dbH'];function respondWithStatusCode(_0x204535,_0x458ba2){_0x458ba2=_0x458ba2||0xcc;return function(_0x17ba45){if(_0x17ba45){return _0x204535[_0xcabf('0x15')](_0x458ba2);}return _0x204535[_0xcabf('0x16')](_0x458ba2)[_0xcabf('0x17')]();};}function respondWithResult(_0xb5aa46,_0x23feec){_0x23feec=_0x23feec||0xc8;return function(_0x17dbe2){if(_0x17dbe2){return _0xb5aa46[_0xcabf('0x16')](_0x23feec)[_0xcabf('0x18')](_0x17dbe2);}};}function respondWithFilteredResult(_0x21edf3,_0x4893a){return function(_0x4f9850){if(_0x4f9850){var _0x5d18c7=typeof _0x4893a[_0xcabf('0x19')]===_0xcabf('0x1a')&&typeof _0x4893a['limit']===_0xcabf('0x1a');var _0x299413=_0x4f9850[_0xcabf('0x1b')];var _0x3bd3a4=_0x5d18c7?0x0:_0x4893a['offset'];var _0x1992cc=_0x5d18c7?_0x4f9850[_0xcabf('0x1b')]:_0x4893a['offset']+_0x4893a[_0xcabf('0x1c')];var _0x35b4a2;if(_0x1992cc>=_0x299413){_0x1992cc=_0x299413;_0x35b4a2=0xc8;}else{_0x35b4a2=0xce;}_0x21edf3[_0xcabf('0x16')](_0x35b4a2);return _0x21edf3[_0xcabf('0x1d')](_0xcabf('0x1e'),_0x3bd3a4+'-'+_0x1992cc+'/'+_0x299413)['json'](_0x4f9850);}return null;};}function patchUpdates(_0xb929df){return function(_0x509d7e){try{jsonpatch[_0xcabf('0x1f')](_0x509d7e,_0xb929df,!![]);}catch(_0x3d575f){return BPromise[_0xcabf('0x20')](_0x3d575f);}return _0x509d7e[_0xcabf('0x21')]();};}function saveUpdates(_0x51b709,_0x2ca57c){return function(_0x395d99){if(_0x395d99){return _0x395d99['update'](_0x51b709)[_0xcabf('0x22')](function(_0x4ba4d4){return _0x4ba4d4;});}return null;};}function removeEntity(_0x21236e,_0x53f3a6){return function(_0x2963cb){if(_0x2963cb){return _0x2963cb['destroy']()[_0xcabf('0x22')](function(){var _0x5cd137=_0x2963cb[_0xcabf('0x23')]({'plain':!![]});var _0x249170=_0xcabf('0x24');return db[_0xcabf('0x25')][_0xcabf('0x26')]({'where':{'type':_0x249170,'resourceId':_0x5cd137['id']}})[_0xcabf('0x22')](function(){return _0x2963cb;});})[_0xcabf('0x22')](function(){_0x21236e[_0xcabf('0x16')](0xcc)[_0xcabf('0x17')]();});}};}function handleEntityNotFound(_0x48b210,_0x70a714){return function(_0x318cf8){if(!_0x318cf8){_0x48b210[_0xcabf('0x15')](0x194);}return _0x318cf8;};}function handleError(_0x5475f4,_0x5eed16){_0x5eed16=_0x5eed16||0x1f4;return function(_0x20be5c){logger['error'](_0x20be5c[_0xcabf('0x27')]);if(_0x20be5c[_0xcabf('0x28')]){delete _0x20be5c[_0xcabf('0x28')];}_0x5475f4['status'](_0x5eed16)['send'](_0x20be5c);};}exports[_0xcabf('0x29')]=function(_0x24952e,_0x3df62b){var _0xa72dbd={},_0x30a040={},_0x2f1795={'count':0x0,'rows':[]};var _0xbfac51=_['map'](db[_0xcabf('0x2a')][_0xcabf('0x2b')],function(_0x3a09d5){return{'name':_0x3a09d5[_0xcabf('0x2c')],'type':_0x3a09d5[_0xcabf('0x2d')][_0xcabf('0x2e')]};});_0x30a040[_0xcabf('0x2f')]=_[_0xcabf('0x30')](_0xbfac51,_0xcabf('0x28'));_0x30a040[_0xcabf('0x31')]=_['keys'](_0x24952e['query']);_0x30a040['filters']=_[_0xcabf('0x32')](_0x30a040[_0xcabf('0x2f')],_0x30a040[_0xcabf('0x31')]);_0xa72dbd[_0xcabf('0x33')]=_[_0xcabf('0x32')](_0x30a040[_0xcabf('0x2f')],qs['fields'](_0x24952e[_0xcabf('0x31')][_0xcabf('0x34')]));_0xa72dbd['attributes']=_0xa72dbd[_0xcabf('0x33')]['length']?_0xa72dbd[_0xcabf('0x33')]:_0x30a040[_0xcabf('0x2f')];if(!_0x24952e['query'][_0xcabf('0x35')](_0xcabf('0x36'))){_0xa72dbd[_0xcabf('0x1c')]=qs[_0xcabf('0x1c')](_0x24952e['query'][_0xcabf('0x1c')]);_0xa72dbd['offset']=qs[_0xcabf('0x19')](_0x24952e[_0xcabf('0x31')][_0xcabf('0x19')]);}_0xa72dbd['order']=qs[_0xcabf('0x37')](_0x24952e[_0xcabf('0x31')][_0xcabf('0x37')]);_0xa72dbd[_0xcabf('0x38')]=qs[_0xcabf('0x39')](_[_0xcabf('0x3a')](_0x24952e[_0xcabf('0x31')],_0x30a040['filters']),_0xbfac51);if(_0x24952e['query'][_0xcabf('0x3b')]){_0xa72dbd[_0xcabf('0x38')]=_[_0xcabf('0x3c')](_0xa72dbd['where'],{'$or':_[_0xcabf('0x30')](_0xbfac51,function(_0x499894){if(_0x499894[_0xcabf('0x2d')]!==_0xcabf('0x3d')){var _0x2ac5aa={};_0x2ac5aa[_0x499894['name']]={'$like':'%'+_0x24952e[_0xcabf('0x31')]['filter']+'%'};return _0x2ac5aa;}})});}_0xa72dbd=_['merge']({},_0xa72dbd,_0x24952e[_0xcabf('0x3e')]);var _0x216574={'where':_0xa72dbd[_0xcabf('0x38')]};return db[_0xcabf('0x2a')][_0xcabf('0x1b')](_0x216574)[_0xcabf('0x22')](function(_0x1c1e6d){_0x2f1795[_0xcabf('0x1b')]=_0x1c1e6d;if(_0x24952e['query']['includeAll']){_0xa72dbd[_0xcabf('0x3f')]=[{'all':!![]}];}return db[_0xcabf('0x2a')][_0xcabf('0x40')](_0xa72dbd);})['then'](function(_0xa252d1){_0x2f1795[_0xcabf('0x41')]=_0xa252d1;return _0x2f1795;})['then'](respondWithFilteredResult(_0x3df62b,_0xa72dbd))[_0xcabf('0x42')](handleError(_0x3df62b,null));};exports[_0xcabf('0x43')]=function(_0x22a096,_0x19b7fe){var _0x440014={'raw':![],'where':{'id':_0x22a096[_0xcabf('0x44')]['id']}},_0x1cc215={};_0x1cc215['model']=_[_0xcabf('0x45')](db[_0xcabf('0x2a')][_0xcabf('0x2b')]);_0x1cc215[_0xcabf('0x31')]=_['keys'](_0x22a096[_0xcabf('0x31')]);_0x1cc215[_0xcabf('0x39')]=_[_0xcabf('0x32')](_0x1cc215[_0xcabf('0x2f')],_0x1cc215[_0xcabf('0x31')]);_0x440014[_0xcabf('0x33')]=_['intersection'](_0x1cc215[_0xcabf('0x2f')],qs[_0xcabf('0x34')](_0x22a096['query'][_0xcabf('0x34')]));_0x440014[_0xcabf('0x33')]=_0x440014[_0xcabf('0x33')]['length']?_0x440014[_0xcabf('0x33')]:_0x1cc215[_0xcabf('0x2f')];if(_0x22a096[_0xcabf('0x31')][_0xcabf('0x46')]){_0x440014[_0xcabf('0x3f')]=[{'all':!![]}];}_0x440014=_[_0xcabf('0x3c')]({},_0x440014,_0x22a096['options']);return db[_0xcabf('0x2a')][_0xcabf('0x47')](_0x440014)['then'](handleEntityNotFound(_0x19b7fe,null))[_0xcabf('0x22')](respondWithResult(_0x19b7fe,null))[_0xcabf('0x42')](handleError(_0x19b7fe,null));};exports[_0xcabf('0x48')]=function(_0x26189c,_0x20cc97){return db[_0xcabf('0x2a')][_0xcabf('0x48')](_0x26189c[_0xcabf('0x49')],{})[_0xcabf('0x22')](function(_0x1cc411){var _0x295345=_0x26189c[_0xcabf('0x4a')][_0xcabf('0x23')]({'plain':!![]});if(!_0x295345)throw new Error(_0xcabf('0x4b'));if(_0x295345[_0xcabf('0x4c')]==='user'){var _0x400e5a=_0x1cc411[_0xcabf('0x23')]({'plain':!![]});var _0x16c3fb=_0xcabf('0x4d');return db[_0xcabf('0x4e')][_0xcabf('0x47')]({'where':{'name':_0x16c3fb,'userProfileId':_0x295345[_0xcabf('0x4f')]},'raw':!![]})['then'](function(_0x561937){if(_0x561937&&_0x561937[_0xcabf('0x50')]===0x0){return db[_0xcabf('0x25')]['create']({'name':_0x400e5a[_0xcabf('0x28')],'resourceId':_0x400e5a['id'],'type':_0xcabf('0x24'),'sectionId':_0x561937['id']},{})[_0xcabf('0x22')](function(){return _0x1cc411;});}else{return _0x1cc411;}})['catch'](function(_0x3bba7d){logger[_0xcabf('0x51')](_0xcabf('0x52'),_0x3bba7d);throw _0x3bba7d;});}return _0x1cc411;})[_0xcabf('0x22')](respondWithResult(_0x20cc97,0xc9))[_0xcabf('0x42')](handleError(_0x20cc97,null));};exports['update']=function(_0x4a0135,_0x54e2d9){if(_0x4a0135['body']['id']){delete _0x4a0135[_0xcabf('0x49')]['id'];}return db[_0xcabf('0x2a')][_0xcabf('0x47')]({'where':{'id':_0x4a0135[_0xcabf('0x44')]['id']}})[_0xcabf('0x22')](handleEntityNotFound(_0x54e2d9,null))[_0xcabf('0x22')](saveUpdates(_0x4a0135[_0xcabf('0x49')],null))['then'](respondWithResult(_0x54e2d9,null))[_0xcabf('0x42')](handleError(_0x54e2d9,null));};exports[_0xcabf('0x26')]=function(_0x215538,_0x2d5875){return db['AnalyticCustomReport'][_0xcabf('0x47')]({'where':{'id':_0x215538[_0xcabf('0x44')]['id']}})[_0xcabf('0x22')](handleEntityNotFound(_0x2d5875,null))[_0xcabf('0x22')](removeEntity(_0x2d5875,null))[_0xcabf('0x42')](handleError(_0x2d5875,null));};exports[_0xcabf('0x53')]=function(_0x3d4fb6,_0x1a1666){var _0x5d8a16=0xa;var _0x1d97c8=[_0xcabf('0x54'),_0xcabf('0x55'),_0xcabf('0x56'),_0xcabf('0x57')];var _0x5e7a8a={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':_0xcabf('0x5e'),'GROUP_CONCAT ASC':_0xcabf('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37051c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcabf('0x60'),'HOUR':_0xcabf('0x61'),'ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x23759d=function(_0x43880d){return!_[_0xcabf('0x63')]([_0xcabf('0x64'),_0xcabf('0x65'),'IS\x20EMPTY',_0xcabf('0x66')],_0x43880d);};var _0x2cfce1=function(_0x1bfa8c){if(!_0x1bfa8c||!_0x1bfa8c[_0xcabf('0x67')][_0xcabf('0x68')]){return'';}for(var _0x3d6de0='(',_0x1eb7aa=0x0;_0x1eb7aa<_0x1bfa8c['rules'][_0xcabf('0x68')];_0x1eb7aa+=0x1){_0x1eb7aa>0x0&&(_0x3d6de0+='\x20'+_0x1bfa8c['operator']+'\x20');_0x3d6de0+=_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['group']?_0x2cfce1(_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['group']):_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x69')]+'\x20'+_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x6a')]+(_0x23759d(_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa][_0xcabf('0x6a')])?'\x20'+_0x1bfa8c[_0xcabf('0x67')][_0x1eb7aa]['value']:'');}return _0x3d6de0+')';};var _0x2373e6={'where':{'id':_0x3d4fb6['params']['id']}},_0x58c321,_0x6287ef,_0x47d9f3,_0x524604,_0x1fe5f9;_0x2373e6=_['merge']({},_0x2373e6,_0x3d4fb6[_0xcabf('0x3e')]);return db['AnalyticCustomReport'][_0xcabf('0x47')](_0x2373e6)[_0xcabf('0x22')](function(_0x50bd8a){if(_0x50bd8a){_0x58c321=_0x50bd8a;return _0x50bd8a[_0xcabf('0x6b')]();}return null;})['then'](function(_0x5e5005){if(_0x5e5005){if(!_0x5e5005[_0xcabf('0x68')]){throw new db[(_0xcabf('0x6c'))]['ValidationErrorItem'](_0xcabf('0x6d'),0x193);}_0x6287ef=_0x5e5005;return db['AnalyticMetric'][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x292b05){if(_0x292b05){_0x47d9f3=_[_0xcabf('0x6e')](_0x292b05,'id');var _0x24e29e;var _0x1bfe4c=squel[_0xcabf('0x6f')]();_0x1bfe4c['from'](_0x58c321['table']);for(var _0x5e0119=0x0;_0x5e0119<_0x6287ef[_0xcabf('0x68')];_0x5e0119+=0x1){_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x70')]?_0x47d9f3[_0x6287ef[_0x5e0119][_0xcabf('0x70')]]['metric']:_0x6287ef[_0x5e0119][_0xcabf('0x69')];_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x71')]?_[_0xcabf('0x72')](_0x5e7a8a[_0x6287ef[_0x5e0119][_0xcabf('0x71')]],'%s',_0x24e29e):_0x24e29e;_0x24e29e=_0x6287ef[_0x5e0119][_0xcabf('0x73')]?_[_0xcabf('0x72')](_0x37051c[_0x6287ef[_0x5e0119]['format']],'%s',_0x24e29e):_0x24e29e;if(_0x6287ef[_0x5e0119][_0xcabf('0x74')]){_0x1bfe4c[_0xcabf('0x75')](_0x24e29e);}_0x6287ef[_0x5e0119][_0xcabf('0x76')]&&_0x1bfe4c['order'](_0x24e29e,_0x6287ef[_0x5e0119][_0xcabf('0x76')]==='DESC'?![]:!![]);_0x1bfe4c[_0xcabf('0x69')](_0x24e29e,_0x6287ef[_0x5e0119][_0xcabf('0x77')]||_0x24e29e);}if(_0x58c321[_0xcabf('0x78')]){_0x58c321[_0xcabf('0x78')]=JSON[_0xcabf('0x79')](_0x58c321[_0xcabf('0x78')]);for(var _0x4aca70=0x0;_0x4aca70<_0x58c321[_0xcabf('0x78')][_0xcabf('0x68')];_0x4aca70+=0x1){if(_0x58c321[_0xcabf('0x78')][_0x4aca70]['type']&&_[_0xcabf('0x63')](_0x1d97c8,_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x2d')])&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7a')]&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')]&&_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7c')]){_0x1bfe4c[_0x58c321[_0xcabf('0x78')][_0x4aca70]['type']](_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')],null,util[_0xcabf('0x73')]('%s.%s\x20=\x20%s.%s',_0x58c321['table'],_0x58c321['joins'][_0x4aca70][_0xcabf('0x7a')],_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7b')],_0x58c321[_0xcabf('0x78')][_0x4aca70][_0xcabf('0x7c')]));}}}if(_0x58c321[_0xcabf('0x7d')]){_0x58c321[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x58c321[_0xcabf('0x7d')]);_0x1bfe4c[_0xcabf('0x38')](_0x2cfce1(_0x58c321[_0xcabf('0x7d')][_0xcabf('0x75')]));}_0x1fe5f9=_0x1bfe4c[_0xcabf('0x7e')]();_0x1bfe4c[_0xcabf('0x1c')](_0x5d8a16);_0x1bfe4c[_0xcabf('0x19')](0x0);logger[_0xcabf('0x7f')](_0xcabf('0x80'),_0x1bfe4c['toString']());return dbH[_0xcabf('0x81')]['query'](_0x1bfe4c[_0xcabf('0x82')](),{'type':dbH['sequelize']['QueryTypes'][_0xcabf('0x83')]});}})[_0xcabf('0x22')](respondWithResult(_0x1a1666,null))[_0xcabf('0x42')](handleError(_0x1a1666,null));};function runReport(_0x3442fc,_0x2e5f6b,_0x139398){var _0x2151b8=_0x2e5f6b[_0xcabf('0x28')];var _0x13069d=0xa;var _0x19837d=[_0xcabf('0x54'),_0xcabf('0x55'),_0xcabf('0x56'),_0xcabf('0x57')];var _0x392df1={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':_0xcabf('0x5e'),'GROUP_CONCAT ASC':_0xcabf('0x5f'),'GROUP_CONCAT DESC':_0xcabf('0x84')};var _0x40ee9a={'SEC_TO_TIME':_0xcabf('0x85'),'DATE':_0xcabf('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':_0xcabf('0x86')};var _0x126d1e=function(_0x3c3d2b){return!_[_0xcabf('0x63')]([_0xcabf('0x64'),_0xcabf('0x65'),_0xcabf('0x87'),_0xcabf('0x66')],_0x3c3d2b);};var _0x5ae70b=function(_0x11c387){if(!_0x11c387||!_0x11c387['rules'][_0xcabf('0x68')]){return'';}for(var _0x4cfcac='(',_0x645ec7=0x0;_0x645ec7<_0x11c387[_0xcabf('0x67')]['length'];_0x645ec7+=0x1){_0x645ec7>0x0&&(_0x4cfcac+='\x20'+_0x11c387[_0xcabf('0x88')]+'\x20');_0x4cfcac+=_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x75')]?_0x5ae70b(_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x75')]):_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x69')]+'\x20'+_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x6a')]+(_0x126d1e(_0x11c387[_0xcabf('0x67')][_0x645ec7][_0xcabf('0x6a')])?'\x20'+_0x11c387['rules'][_0x645ec7][_0xcabf('0x89')]:'');}return _0x4cfcac+')';};var _0x47bc57={'where':{'id':_0x3442fc['id']}},_0x1b308d,_0xa5d7d6,_0xb59cad,_0x4ee2c6,_0x10fb2d;_0x47bc57=_[_0xcabf('0x3c')]({},_0x47bc57,_0x139398);return db[_0xcabf('0x2a')]['find'](_0x47bc57)[_0xcabf('0x22')](function(_0x3b285c){if(_0x3b285c){_0x1b308d=_0x3b285c;return _0x3b285c[_0xcabf('0x6b')]();}return null;})[_0xcabf('0x22')](function(_0x127ba0){if(_0x127ba0){if(!_0x127ba0[_0xcabf('0x68')]){throw new db[(_0xcabf('0x6c'))]['ValidationErrorItem'](_0xcabf('0x6d'),0x193);}_0xa5d7d6=_0x127ba0;return db[_0xcabf('0x8a')][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x3a0bae){if(_0x3a0bae){_0xb59cad=_['keyBy'](_0x3a0bae,'id');var _0x119e6f;var _0x2a5902=squel[_0xcabf('0x6f')]();_0x2a5902[_0xcabf('0x8b')](_0x1b308d[_0xcabf('0x8c')]);for(var _0x490fe8=0x0;_0x490fe8<_0xa5d7d6[_0xcabf('0x68')];_0x490fe8+=0x1){_0x119e6f=_0xa5d7d6[_0x490fe8]['MetricId']?_0xb59cad[_0xa5d7d6[_0x490fe8][_0xcabf('0x70')]]['metric']:_0xa5d7d6[_0x490fe8][_0xcabf('0x69')];_0x119e6f=_0xa5d7d6[_0x490fe8][_0xcabf('0x71')]?_[_0xcabf('0x72')](_0x392df1[_0xa5d7d6[_0x490fe8][_0xcabf('0x71')]],'%s',_0x119e6f):_0x119e6f;_0x119e6f=_0xa5d7d6[_0x490fe8]['format']?_[_0xcabf('0x72')](_0x40ee9a[_0xa5d7d6[_0x490fe8][_0xcabf('0x73')]],'%s',_0x119e6f):_0x119e6f;if(_0xa5d7d6[_0x490fe8][_0xcabf('0x74')]){_0x2a5902[_0xcabf('0x75')](_0x119e6f);}_0xa5d7d6[_0x490fe8][_0xcabf('0x76')]&&_0x2a5902[_0xcabf('0x8d')](_0x119e6f,_0xa5d7d6[_0x490fe8][_0xcabf('0x76')]===_0xcabf('0x8e')?![]:!![]);_0x2a5902['field'](_0x119e6f,_0xa5d7d6[_0x490fe8][_0xcabf('0x77')]||_0x119e6f);}if(_0x1b308d[_0xcabf('0x78')]){_0x1b308d[_0xcabf('0x78')]=JSON[_0xcabf('0x79')](_0x1b308d[_0xcabf('0x78')]);for(var _0x25bf93=0x0;_0x25bf93<_0x1b308d[_0xcabf('0x78')]['length'];_0x25bf93+=0x1){if(_0x1b308d[_0xcabf('0x78')][_0x25bf93]['type']&&_[_0xcabf('0x63')](_0x19837d,_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x2d')])&&_0x1b308d['joins'][_0x25bf93][_0xcabf('0x7a')]&&_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7b')]&&_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7c')]){_0x2a5902[_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x2d')]](_0x1b308d[_0xcabf('0x78')][_0x25bf93]['foreignTable'],null,util[_0xcabf('0x73')]('%s.%s\x20=\x20%s.%s',_0x1b308d['table'],_0x1b308d['joins'][_0x25bf93][_0xcabf('0x7a')],_0x1b308d[_0xcabf('0x78')][_0x25bf93]['foreignTable'],_0x1b308d[_0xcabf('0x78')][_0x25bf93][_0xcabf('0x7c')]));}}}if(_0x1b308d[_0xcabf('0x7d')]){_0x1b308d[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x1b308d[_0xcabf('0x7d')]);_0x2a5902['where'](_0x5ae70b(_0x1b308d[_0xcabf('0x7d')][_0xcabf('0x75')]));}_0x10fb2d=_0x2a5902[_0xcabf('0x7e')]();_0x2a5902[_0xcabf('0x1c')](_0x13069d);_0x2a5902[_0xcabf('0x19')](0x0);return;}})[_0xcabf('0x22')](function(){if(_0x2e5f6b[_0xcabf('0x8f')]===_0xcabf('0x90')){return null;}var _0x5190cf=_['merge'](_0x2e5f6b,{'name':_0x2e5f6b[_0xcabf('0x91')]||_0x2e5f6b[_0xcabf('0x28')]||_0x1b308d[_0xcabf('0x28')],'basename':_0x2151b8,'savename':util[_0xcabf('0x73')](_0xcabf('0x92'),_0x2e5f6b['name']||_0x1b308d[_0xcabf('0x28')],require(_0xcabf('0x93'))[_0xcabf('0x94')](0x4),_0x2e5f6b[_0xcabf('0x8f')]||_0xcabf('0x95')),'reportId':_0x1b308d['id'],'reportType':_0xcabf('0x96')});return db[_0xcabf('0x97')][_0xcabf('0x48')](_0x5190cf,{'raw':!![]});})[_0xcabf('0x22')](function(_0x18a628){if(_0x1b308d[_0xcabf('0x8c')]===_0xcabf('0x98')){_0x10fb2d[_0xcabf('0x38')](_0x1b308d['table']+_0xcabf('0x99'),_0x2e5f6b[_0xcabf('0x9a')],_0x2e5f6b[_0xcabf('0x9b')]);}else{_0x10fb2d[_0xcabf('0x38')](_0x1b308d[_0xcabf('0x8c')]+_0xcabf('0x9c'),_0x2e5f6b[_0xcabf('0x9a')],_0x2e5f6b[_0xcabf('0x9b')]);}if(_0x18a628){logger[_0xcabf('0x9d')](_0xcabf('0x9e'),_0x10fb2d[_0xcabf('0x82')]());require(_0xcabf('0x9f'))[_0xcabf('0xa0')](path[_0xcabf('0x54')](__dirname,_0xcabf('0xa1'),_0x18a628['output']),[_0x18a628['id'],_0x10fb2d[_0xcabf('0x82')](),path[_0xcabf('0x54')](__dirname,_0xcabf('0xa2'),_0x18a628[_0xcabf('0xa3')]),_0x2151b8]);return _0x18a628;}else{var _0x10e180=squel[_0xcabf('0x6f')]();_0x10e180[_0xcabf('0x8b')]('('+_0x10fb2d['toString']()+')',_0xcabf('0xa4'));_0x10e180['field'](_0xcabf('0xa5'),'count');_0x10fb2d[_0xcabf('0x1c')](_0x2e5f6b[_0xcabf('0x1c')]||_0x13069d);_0x10fb2d[_0xcabf('0x19')](_0x2e5f6b[_0xcabf('0x19')]||0x0);return dbH[_0xcabf('0x81')]['query'](_0x10e180['toString'](),{'type':dbH[_0xcabf('0x81')][_0xcabf('0xa6')][_0xcabf('0x83')]})['then'](function(_0x24ebf9){if(!_0x24ebf9[_0xcabf('0x68')]){_0x4ee2c6=0x0;}else{_0x4ee2c6=_0x24ebf9[0x0][_0xcabf('0x1b')]||0x0;}return dbH[_0xcabf('0x81')][_0xcabf('0x31')](_0x10fb2d[_0xcabf('0x82')](),{'type':dbH['sequelize'][_0xcabf('0xa6')][_0xcabf('0x83')]});})[_0xcabf('0x22')](function(_0x31e874){return{'rows':_0x31e874||[],'count':_0x4ee2c6};});}});}exports[_0xcabf('0xa7')]=function(_0x1df9f0,_0x5b7783){return runReport(_0x1df9f0[_0xcabf('0x44')],_0x1df9f0['query'],_0x1df9f0['options'])[_0xcabf('0x22')](respondWithResult(_0x5b7783,null))[_0xcabf('0x42')](handleError(_0x5b7783,null));};exports[_0xcabf('0xa8')]=runReport;exports[_0xcabf('0x31')]=function(_0x56911c,_0x33fb5d){var _0x30e95b=0xa;var _0x42ac19=['join',_0xcabf('0x55'),_0xcabf('0x56'),'cross_join'];var _0x32ae69={'SUM':_0xcabf('0x58'),'COUNT':_0xcabf('0x59'),'COUNT DISTINCT':_0xcabf('0x5a'),'MAX':_0xcabf('0x5b'),'MIN':_0xcabf('0x5c'),'AVG':_0xcabf('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcabf('0x84')};var _0x49694c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xcabf('0x60'),'HOUR':_0xcabf('0x61'),'ROUND':_0xcabf('0x62'),'UNIX_TIMESTAMP':_0xcabf('0x86')};var _0x21b713=function(_0x2ad9de){return!_['includes']([_0xcabf('0x64'),_0xcabf('0x65'),_0xcabf('0x87'),_0xcabf('0x66')],_0x2ad9de);};var _0x1e8c51=function(_0x5ca84e){if(!_0x5ca84e||!_0x5ca84e[_0xcabf('0x67')][_0xcabf('0x68')]){return'';}for(var _0x5a4f36='(',_0x4f8524=0x0;_0x4f8524<_0x5ca84e[_0xcabf('0x67')]['length'];_0x4f8524+=0x1){_0x4f8524>0x0&&(_0x5a4f36+='\x20'+_0x5ca84e['operator']+'\x20');_0x5a4f36+=_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x75')]?_0x1e8c51(_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x75')]):_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x69')]+'\x20'+_0x5ca84e[_0xcabf('0x67')][_0x4f8524]['condition']+(_0x21b713(_0x5ca84e[_0xcabf('0x67')][_0x4f8524][_0xcabf('0x6a')])?'\x20'+_0x5ca84e['rules'][_0x4f8524][_0xcabf('0x89')]:'');}return _0x5a4f36+')';};var _0x52beeb={'where':{'id':_0x56911c[_0xcabf('0x44')]['id']}},_0x279897,_0xccd11f,_0x152eac,_0x2dfee6,_0x314b3a;_0x52beeb=_[_0xcabf('0x3c')]({},_0x52beeb,_0x56911c[_0xcabf('0x3e')]);return db[_0xcabf('0x2a')][_0xcabf('0x47')](_0x52beeb)['then'](function(_0x538a6e){if(_0x538a6e){_0x279897=_0x538a6e;return _0x538a6e[_0xcabf('0x6b')]();}return null;})['then'](function(_0x2ba6e9){if(_0x2ba6e9){if(!_0x2ba6e9['length']){throw new db[(_0xcabf('0x6c'))][(_0xcabf('0xa9'))](_0xcabf('0x6d'),0x193);}_0xccd11f=_0x2ba6e9;return db[_0xcabf('0x8a')][_0xcabf('0x40')]({'raw':!![]});}return null;})[_0xcabf('0x22')](function(_0x5a2ec1){if(_0x5a2ec1){_0x152eac=_[_0xcabf('0x6e')](_0x5a2ec1,'id');var _0x3bc9e6;var _0x252f72=squel[_0xcabf('0x6f')]();_0x252f72[_0xcabf('0x8b')](_0x279897[_0xcabf('0x8c')]);for(var _0x2204ce=0x0;_0x2204ce<_0xccd11f[_0xcabf('0x68')];_0x2204ce+=0x1){_0x3bc9e6=_0xccd11f[_0x2204ce][_0xcabf('0x70')]?_0x152eac[_0xccd11f[_0x2204ce][_0xcabf('0x70')]][_0xcabf('0xaa')]:_0xccd11f[_0x2204ce]['field'];_0x3bc9e6=_0xccd11f[_0x2204ce]['function']?_[_0xcabf('0x72')](_0x32ae69[_0xccd11f[_0x2204ce]['function']],'%s',_0x3bc9e6):_0x3bc9e6;_0x3bc9e6=_0xccd11f[_0x2204ce]['format']?_['replace'](_0x49694c[_0xccd11f[_0x2204ce]['format']],'%s',_0x3bc9e6):_0x3bc9e6;if(_0xccd11f[_0x2204ce][_0xcabf('0x74')]){_0x252f72[_0xcabf('0x75')](_0x3bc9e6);}_0xccd11f[_0x2204ce][_0xcabf('0x76')]&&_0x252f72[_0xcabf('0x8d')](_0x3bc9e6,_0xccd11f[_0x2204ce]['orderBy']==='DESC'?![]:!![]);_0x252f72['field'](_0x3bc9e6,_0xccd11f[_0x2204ce][_0xcabf('0x77')]||_0x3bc9e6);}if(_0x279897[_0xcabf('0x78')]){_0x279897['joins']=JSON[_0xcabf('0x79')](_0x279897['joins']);for(var _0x42e298=0x0;_0x42e298<_0x279897['joins'][_0xcabf('0x68')];_0x42e298+=0x1){if(_0x279897['joins'][_0x42e298][_0xcabf('0x2d')]&&_[_0xcabf('0x63')](_0x42ac19,_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x2d')])&&_0x279897['joins'][_0x42e298][_0xcabf('0x7a')]&&_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7b')]&&_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7c')]){_0x252f72[_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x2d')]](_0x279897['joins'][_0x42e298][_0xcabf('0x7b')],null,util[_0xcabf('0x73')](_0xcabf('0xab'),_0x279897[_0xcabf('0x8c')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7a')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7b')],_0x279897[_0xcabf('0x78')][_0x42e298][_0xcabf('0x7c')]));}}}if(_0x279897['conditions']){_0x279897[_0xcabf('0x7d')]=JSON[_0xcabf('0x79')](_0x279897[_0xcabf('0x7d')]);_0x252f72[_0xcabf('0x38')](_0x1e8c51(_0x279897[_0xcabf('0x7d')]['group']));}_0x314b3a=_0x252f72['clone']();_0x252f72[_0xcabf('0x1c')](_0x30e95b);_0x252f72[_0xcabf('0x19')](0x0);logger[_0xcabf('0x7f')](_0xcabf('0x80'),_0x252f72[_0xcabf('0x82')]());return dbH[_0xcabf('0x81')]['query'](_0x252f72[_0xcabf('0x82')](),{'type':dbH[_0xcabf('0x81')]['QueryTypes']['SELECT']});}})[_0xcabf('0x22')](function(){return{'sql':_0x314b3a[_0xcabf('0x82')]()};})['then'](respondWithResult(_0x33fb5d,null))['catch'](handleError(_0x33fb5d,null));}; \ No newline at end of file +var _0xe2cc=['function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','right_join','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','field','AnalyticMetric','keyBy','groupBy','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','toString','child_process','fork','../../components/export/','../../files/reports','from','countTable','COUNT(*)','run','runReport','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','model','keys','intersection','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','show','params','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','catch','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','select','table','MetricId','metric'];(function(_0x42183a,_0x384941){var _0x300fef=function(_0x49e7b5){while(--_0x49e7b5){_0x42183a['push'](_0x42183a['shift']());}};_0x300fef(++_0x384941);}(_0xe2cc,0x189));var _0xce2c=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xe2cc[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce2c('0x0'));var zipdir=require(_0xce2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce2c('0x2'));var moment=require(_0xce2c('0x3'));var BPromise=require(_0xce2c('0x4'));var Mustache=require(_0xce2c('0x5'));var util=require(_0xce2c('0x6'));var path=require(_0xce2c('0x7'));var sox=require(_0xce2c('0x8'));var csv=require(_0xce2c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xce2c('0xa'));var _=require(_0xce2c('0xb'));var squel=require(_0xce2c('0xc'));var crypto=require(_0xce2c('0xd'));var jsforce=require(_0xce2c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce2c('0xf'));var Papa=require(_0xce2c('0x10'));var Redis=require(_0xce2c('0x11'));var authService=require(_0xce2c('0x12'));var qs=require(_0xce2c('0x13'));var as=require(_0xce2c('0x14'));var hardwareService=require(_0xce2c('0x15'));var logger=require('../../config/logger')(_0xce2c('0x16'));var utils=require(_0xce2c('0x17'));var config=require(_0xce2c('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xce2c('0x19'))['db'];var dbH=require(_0xce2c('0x19'))['dbH'];function respondWithStatusCode(_0x5f232b,_0x54d2ae){_0x54d2ae=_0x54d2ae||0xcc;return function(_0x536c86){if(_0x536c86){return _0x5f232b[_0xce2c('0x1a')](_0x54d2ae);}return _0x5f232b[_0xce2c('0x1b')](_0x54d2ae)[_0xce2c('0x1c')]();};}function respondWithResult(_0x15c627,_0x2403fe){_0x2403fe=_0x2403fe||0xc8;return function(_0x44dbcc){if(_0x44dbcc){return _0x15c627['status'](_0x2403fe)[_0xce2c('0x1d')](_0x44dbcc);}};}function respondWithFilteredResult(_0x3bf0de,_0x3e3a59){return function(_0x1ea4ba){if(_0x1ea4ba){var _0x2266a6=typeof _0x3e3a59['offset']==='undefined'&&typeof _0x3e3a59[_0xce2c('0x1e')]===_0xce2c('0x1f');var _0x29a223=_0x1ea4ba[_0xce2c('0x20')];var _0x3131dc=_0x2266a6?0x0:_0x3e3a59['offset'];var _0x26c2ca=_0x2266a6?_0x1ea4ba[_0xce2c('0x20')]:_0x3e3a59[_0xce2c('0x21')]+_0x3e3a59[_0xce2c('0x1e')];var _0x4886d8;if(_0x26c2ca>=_0x29a223){_0x26c2ca=_0x29a223;_0x4886d8=0xc8;}else{_0x4886d8=0xce;}_0x3bf0de[_0xce2c('0x1b')](_0x4886d8);return _0x3bf0de[_0xce2c('0x22')](_0xce2c('0x23'),_0x3131dc+'-'+_0x26c2ca+'/'+_0x29a223)[_0xce2c('0x1d')](_0x1ea4ba);}return null;};}function patchUpdates(_0x563ea5){return function(_0x4a6a74){try{jsonpatch[_0xce2c('0x24')](_0x4a6a74,_0x563ea5,!![]);}catch(_0x7bb3c1){return BPromise[_0xce2c('0x25')](_0x7bb3c1);}return _0x4a6a74[_0xce2c('0x26')]();};}function saveUpdates(_0x4a5d5c,_0x52fe0a){return function(_0x56b61d){if(_0x56b61d){return _0x56b61d[_0xce2c('0x27')](_0x4a5d5c)[_0xce2c('0x28')](function(_0x3836b0){return _0x3836b0;});}return null;};}function removeEntity(_0x1631da,_0x2dace6){return function(_0x33f2a4){if(_0x33f2a4){return _0x33f2a4[_0xce2c('0x29')]()[_0xce2c('0x28')](function(){var _0x23042c=_0x33f2a4[_0xce2c('0x2a')]({'plain':!![]});var _0xf35d7b=_0xce2c('0x2b');return db[_0xce2c('0x2c')][_0xce2c('0x29')]({'where':{'type':_0xf35d7b,'resourceId':_0x23042c['id']}})[_0xce2c('0x28')](function(){return _0x33f2a4;});})[_0xce2c('0x28')](function(){_0x1631da[_0xce2c('0x1b')](0xcc)[_0xce2c('0x1c')]();});}};}function handleEntityNotFound(_0x49b226,_0x503085){return function(_0x480f6f){if(!_0x480f6f){_0x49b226[_0xce2c('0x1a')](0x194);}return _0x480f6f;};}function handleError(_0x17953b,_0x3a9040){_0x3a9040=_0x3a9040||0x1f4;return function(_0x2ea260){logger[_0xce2c('0x2d')](_0x2ea260['stack']);if(_0x2ea260[_0xce2c('0x2e')]){delete _0x2ea260['name'];}_0x17953b[_0xce2c('0x1b')](_0x3a9040)[_0xce2c('0x2f')](_0x2ea260);};}exports[_0xce2c('0x30')]=function(_0x3143c4,_0x37e1c2){var _0xdad661={},_0x1b8fd7={},_0x543af1={'count':0x0,'rows':[]};var _0x1371ed=_[_0xce2c('0x31')](db[_0xce2c('0x32')][_0xce2c('0x33')],function(_0x529428){return{'name':_0x529428[_0xce2c('0x34')],'type':_0x529428[_0xce2c('0x35')]['key']};});_0x1b8fd7[_0xce2c('0x36')]=_[_0xce2c('0x31')](_0x1371ed,_0xce2c('0x2e'));_0x1b8fd7['query']=_[_0xce2c('0x37')](_0x3143c4['query']);_0x1b8fd7['filters']=_[_0xce2c('0x38')](_0x1b8fd7[_0xce2c('0x36')],_0x1b8fd7[_0xce2c('0x39')]);_0xdad661[_0xce2c('0x3a')]=_[_0xce2c('0x38')](_0x1b8fd7[_0xce2c('0x36')],qs['fields'](_0x3143c4[_0xce2c('0x39')]['fields']));_0xdad661[_0xce2c('0x3a')]=_0xdad661[_0xce2c('0x3a')][_0xce2c('0x3b')]?_0xdad661[_0xce2c('0x3a')]:_0x1b8fd7[_0xce2c('0x36')];if(!_0x3143c4[_0xce2c('0x39')][_0xce2c('0x3c')](_0xce2c('0x3d'))){_0xdad661['limit']=qs[_0xce2c('0x1e')](_0x3143c4[_0xce2c('0x39')][_0xce2c('0x1e')]);_0xdad661[_0xce2c('0x21')]=qs[_0xce2c('0x21')](_0x3143c4['query']['offset']);}_0xdad661[_0xce2c('0x3e')]=qs[_0xce2c('0x3f')](_0x3143c4[_0xce2c('0x39')][_0xce2c('0x3f')]);_0xdad661[_0xce2c('0x40')]=qs[_0xce2c('0x41')](_['pick'](_0x3143c4[_0xce2c('0x39')],_0x1b8fd7['filters']),_0x1371ed);if(_0x3143c4[_0xce2c('0x39')][_0xce2c('0x42')]){_0xdad661[_0xce2c('0x40')]=_[_0xce2c('0x43')](_0xdad661[_0xce2c('0x40')],{'$or':_[_0xce2c('0x31')](_0x1371ed,function(_0x20b106){if(_0x20b106[_0xce2c('0x35')]!==_0xce2c('0x44')){var _0x89f77b={};_0x89f77b[_0x20b106[_0xce2c('0x2e')]]={'$like':'%'+_0x3143c4[_0xce2c('0x39')][_0xce2c('0x42')]+'%'};return _0x89f77b;}})});}_0xdad661=_['merge']({},_0xdad661,_0x3143c4['options']);var _0x27d60d={'where':_0xdad661[_0xce2c('0x40')]};return db[_0xce2c('0x32')][_0xce2c('0x20')](_0x27d60d)[_0xce2c('0x28')](function(_0x564e40){_0x543af1[_0xce2c('0x20')]=_0x564e40;if(_0x3143c4['query'][_0xce2c('0x45')]){_0xdad661[_0xce2c('0x46')]=[{'all':!![]}];}return db[_0xce2c('0x32')]['findAll'](_0xdad661);})[_0xce2c('0x28')](function(_0x2d0c92){_0x543af1['rows']=_0x2d0c92;return _0x543af1;})[_0xce2c('0x28')](respondWithFilteredResult(_0x37e1c2,_0xdad661))['catch'](handleError(_0x37e1c2,null));};exports[_0xce2c('0x47')]=function(_0xcb678c,_0x5a3d85){var _0x5b3c23={'raw':![],'where':{'id':_0xcb678c[_0xce2c('0x48')]['id']}},_0x31a18b={};_0x31a18b[_0xce2c('0x36')]=_[_0xce2c('0x37')](db[_0xce2c('0x32')]['rawAttributes']);_0x31a18b[_0xce2c('0x39')]=_['keys'](_0xcb678c[_0xce2c('0x39')]);_0x31a18b[_0xce2c('0x41')]=_[_0xce2c('0x38')](_0x31a18b[_0xce2c('0x36')],_0x31a18b[_0xce2c('0x39')]);_0x5b3c23[_0xce2c('0x3a')]=_[_0xce2c('0x38')](_0x31a18b[_0xce2c('0x36')],qs[_0xce2c('0x49')](_0xcb678c[_0xce2c('0x39')][_0xce2c('0x49')]));_0x5b3c23[_0xce2c('0x3a')]=_0x5b3c23[_0xce2c('0x3a')][_0xce2c('0x3b')]?_0x5b3c23[_0xce2c('0x3a')]:_0x31a18b[_0xce2c('0x36')];if(_0xcb678c[_0xce2c('0x39')][_0xce2c('0x45')]){_0x5b3c23[_0xce2c('0x46')]=[{'all':!![]}];}_0x5b3c23=_[_0xce2c('0x43')]({},_0x5b3c23,_0xcb678c[_0xce2c('0x4a')]);return db[_0xce2c('0x32')][_0xce2c('0x4b')](_0x5b3c23)[_0xce2c('0x28')](handleEntityNotFound(_0x5a3d85,null))[_0xce2c('0x28')](respondWithResult(_0x5a3d85,null))['catch'](handleError(_0x5a3d85,null));};exports[_0xce2c('0x4c')]=function(_0x186544,_0x8ab213){return db[_0xce2c('0x32')][_0xce2c('0x4c')](_0x186544['body'],{})[_0xce2c('0x28')](function(_0x11b795){var _0x4d1881=_0x186544[_0xce2c('0x4d')][_0xce2c('0x2a')]({'plain':!![]});if(!_0x4d1881)throw new Error(_0xce2c('0x4e'));if(_0x4d1881['role']===_0xce2c('0x4d')){var _0x3c46d2=_0x11b795[_0xce2c('0x2a')]({'plain':!![]});var _0x270873=_0xce2c('0x4f');return db[_0xce2c('0x50')][_0xce2c('0x4b')]({'where':{'name':_0x270873,'userProfileId':_0x4d1881['userProfileId']},'raw':!![]})[_0xce2c('0x28')](function(_0x3977dd){if(_0x3977dd&&_0x3977dd[_0xce2c('0x51')]===0x0){return db[_0xce2c('0x2c')][_0xce2c('0x4c')]({'name':_0x3c46d2['name'],'resourceId':_0x3c46d2['id'],'type':_0xce2c('0x2b'),'sectionId':_0x3977dd['id']},{})[_0xce2c('0x28')](function(){return _0x11b795;});}else{return _0x11b795;}})['catch'](function(_0x4d7c48){logger[_0xce2c('0x2d')](_0xce2c('0x52'),_0x4d7c48);throw _0x4d7c48;});}return _0x11b795;})[_0xce2c('0x28')](respondWithResult(_0x8ab213,0xc9))['catch'](handleError(_0x8ab213,null));};exports[_0xce2c('0x27')]=function(_0x5973d8,_0x4ff111){if(_0x5973d8[_0xce2c('0x53')]['id']){delete _0x5973d8[_0xce2c('0x53')]['id'];}return db[_0xce2c('0x32')][_0xce2c('0x4b')]({'where':{'id':_0x5973d8[_0xce2c('0x48')]['id']}})[_0xce2c('0x28')](handleEntityNotFound(_0x4ff111,null))[_0xce2c('0x28')](saveUpdates(_0x5973d8[_0xce2c('0x53')],null))[_0xce2c('0x28')](respondWithResult(_0x4ff111,null))[_0xce2c('0x54')](handleError(_0x4ff111,null));};exports[_0xce2c('0x29')]=function(_0x4e6417,_0x2a6c4c){return db[_0xce2c('0x32')][_0xce2c('0x4b')]({'where':{'id':_0x4e6417[_0xce2c('0x48')]['id']}})[_0xce2c('0x28')](handleEntityNotFound(_0x2a6c4c,null))['then'](removeEntity(_0x2a6c4c,null))['catch'](handleError(_0x2a6c4c,null));};exports[_0xce2c('0x55')]=function(_0x1761b7,_0x4d444e){var _0x259678=0xa;var _0x2c6e9d=[_0xce2c('0x56'),_0xce2c('0x57'),'right_join',_0xce2c('0x58')];var _0x2ec89c={'SUM':_0xce2c('0x59'),'COUNT':_0xce2c('0x5a'),'COUNT DISTINCT':_0xce2c('0x5b'),'MAX':_0xce2c('0x5c'),'MIN':'MIN(%s)','AVG':_0xce2c('0x5d'),'GROUP_CONCAT':_0xce2c('0x5e'),'GROUP_CONCAT ASC':_0xce2c('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x269e1f={'SEC_TO_TIME':_0xce2c('0x60'),'DATE':_0xce2c('0x61'),'HOUR':_0xce2c('0x62'),'ROUND':_0xce2c('0x63'),'UNIX_TIMESTAMP':_0xce2c('0x64')};var _0x15ed6d=function(_0x3bd328){return!_[_0xce2c('0x65')]([_0xce2c('0x66'),_0xce2c('0x67'),_0xce2c('0x68'),_0xce2c('0x69')],_0x3bd328);};var _0x1e892c=function(_0x27c815){if(!_0x27c815||!_0x27c815[_0xce2c('0x6a')][_0xce2c('0x3b')]){return'';}for(var _0x151c14='(',_0x5b7c81=0x0;_0x5b7c81<_0x27c815['rules'][_0xce2c('0x3b')];_0x5b7c81+=0x1){_0x5b7c81>0x0&&(_0x151c14+='\x20'+_0x27c815[_0xce2c('0x6b')]+'\x20');_0x151c14+=_0x27c815[_0xce2c('0x6a')][_0x5b7c81][_0xce2c('0x6c')]?_0x1e892c(_0x27c815[_0xce2c('0x6a')][_0x5b7c81][_0xce2c('0x6c')]):_0x27c815[_0xce2c('0x6a')][_0x5b7c81]['field']+'\x20'+_0x27c815['rules'][_0x5b7c81][_0xce2c('0x6d')]+(_0x15ed6d(_0x27c815[_0xce2c('0x6a')][_0x5b7c81]['condition'])?'\x20'+_0x27c815[_0xce2c('0x6a')][_0x5b7c81][_0xce2c('0x6e')]:'');}return _0x151c14+')';};var _0x4dbd47={'where':{'id':_0x1761b7[_0xce2c('0x48')]['id']}},_0x4591dd,_0x2340f8,_0x5711ef,_0x30f214,_0x1c45e6;_0x4dbd47=_[_0xce2c('0x43')]({},_0x4dbd47,_0x1761b7[_0xce2c('0x4a')]);return db[_0xce2c('0x32')][_0xce2c('0x4b')](_0x4dbd47)[_0xce2c('0x28')](function(_0xa82864){if(_0xa82864){_0x4591dd=_0xa82864;return _0xa82864[_0xce2c('0x6f')]();}return null;})['then'](function(_0x361987){if(_0x361987){if(!_0x361987['length']){throw new db[(_0xce2c('0x70'))][(_0xce2c('0x71'))](_0xce2c('0x72'),0x193);}_0x2340f8=_0x361987;return db['AnalyticMetric'][_0xce2c('0x73')]({'raw':!![]});}return null;})[_0xce2c('0x28')](function(_0x546351){if(_0x546351){_0x5711ef=_['keyBy'](_0x546351,'id');var _0x24a2cb;var _0x43e138=squel[_0xce2c('0x74')]();_0x43e138['from'](_0x4591dd[_0xce2c('0x75')]);for(var _0x26f588=0x0;_0x26f588<_0x2340f8[_0xce2c('0x3b')];_0x26f588+=0x1){_0x24a2cb=_0x2340f8[_0x26f588][_0xce2c('0x76')]?_0x5711ef[_0x2340f8[_0x26f588][_0xce2c('0x76')]][_0xce2c('0x77')]:_0x2340f8[_0x26f588]['field'];_0x24a2cb=_0x2340f8[_0x26f588][_0xce2c('0x78')]?_['replace'](_0x2ec89c[_0x2340f8[_0x26f588][_0xce2c('0x78')]],'%s',_0x24a2cb):_0x24a2cb;_0x24a2cb=_0x2340f8[_0x26f588][_0xce2c('0x79')]?_[_0xce2c('0x7a')](_0x269e1f[_0x2340f8[_0x26f588]['format']],'%s',_0x24a2cb):_0x24a2cb;if(_0x2340f8[_0x26f588]['groupBy']){_0x43e138[_0xce2c('0x6c')](_0x24a2cb);}_0x2340f8[_0x26f588][_0xce2c('0x7b')]&&_0x43e138[_0xce2c('0x3e')](_0x24a2cb,_0x2340f8[_0x26f588]['orderBy']===_0xce2c('0x7c')?![]:!![]);_0x43e138['field'](_0x24a2cb,_0x2340f8[_0x26f588][_0xce2c('0x7d')]||_0x24a2cb);}if(_0x4591dd[_0xce2c('0x7e')]){_0x4591dd['joins']=JSON['parse'](_0x4591dd[_0xce2c('0x7e')]);for(var _0x2c0924=0x0;_0x2c0924<_0x4591dd['joins'][_0xce2c('0x3b')];_0x2c0924+=0x1){if(_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x35')]&&_['includes'](_0x2c6e9d,_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x35')])&&_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x7f')]&&_0x4591dd[_0xce2c('0x7e')][_0x2c0924]['foreignTable']&&_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x80')]){_0x43e138[_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x35')]](_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x81')],null,util[_0xce2c('0x79')](_0xce2c('0x82'),_0x4591dd[_0xce2c('0x75')],_0x4591dd[_0xce2c('0x7e')][_0x2c0924][_0xce2c('0x7f')],_0x4591dd[_0xce2c('0x7e')][_0x2c0924]['foreignTable'],_0x4591dd['joins'][_0x2c0924][_0xce2c('0x80')]));}}}if(_0x4591dd[_0xce2c('0x83')]){_0x4591dd[_0xce2c('0x83')]=JSON[_0xce2c('0x84')](_0x4591dd[_0xce2c('0x83')]);_0x43e138[_0xce2c('0x40')](_0x1e892c(_0x4591dd[_0xce2c('0x83')][_0xce2c('0x6c')]));}_0x1c45e6=_0x43e138['clone']();_0x43e138[_0xce2c('0x1e')](_0x259678);_0x43e138['offset'](0x0);logger[_0xce2c('0x85')](_0xce2c('0x86'),_0x43e138['toString']());return dbH[_0xce2c('0x87')][_0xce2c('0x39')](_0x43e138['toString'](),{'type':dbH[_0xce2c('0x87')][_0xce2c('0x88')][_0xce2c('0x89')]});}})['then'](respondWithResult(_0x4d444e,null))['catch'](handleError(_0x4d444e,null));};function runReport(_0x991094,_0x4900b3,_0x257e65){var _0x224b9b=_0x4900b3[_0xce2c('0x2e')];var _0x20f2df=0xa;var _0x435eee=[_0xce2c('0x56'),_0xce2c('0x57'),_0xce2c('0x8a'),_0xce2c('0x58')];var _0x1755c1={'SUM':_0xce2c('0x59'),'COUNT':_0xce2c('0x5a'),'COUNT DISTINCT':_0xce2c('0x5b'),'MAX':_0xce2c('0x5c'),'MIN':_0xce2c('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xce2c('0x5e'),'GROUP_CONCAT ASC':_0xce2c('0x5f'),'GROUP_CONCAT DESC':_0xce2c('0x8c')};var _0xbe5a9d={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xce2c('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xce2c('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x3e52e1=function(_0x319bb2){return!_['includes']([_0xce2c('0x66'),_0xce2c('0x67'),_0xce2c('0x68'),_0xce2c('0x69')],_0x319bb2);};var _0x2ee0e0=function(_0x326e2d){if(!_0x326e2d||!_0x326e2d[_0xce2c('0x6a')][_0xce2c('0x3b')]){return'';}for(var _0x34cab0='(',_0x35f4bd=0x0;_0x35f4bd<_0x326e2d[_0xce2c('0x6a')][_0xce2c('0x3b')];_0x35f4bd+=0x1){_0x35f4bd>0x0&&(_0x34cab0+='\x20'+_0x326e2d['operator']+'\x20');_0x34cab0+=_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x6c')]?_0x2ee0e0(_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x6c')]):_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x8d')]+'\x20'+_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x6d')]+(_0x3e52e1(_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x6d')])?'\x20'+_0x326e2d[_0xce2c('0x6a')][_0x35f4bd][_0xce2c('0x6e')]:'');}return _0x34cab0+')';};var _0x267dbe={'where':{'id':_0x991094['id']}},_0x29a530,_0x499ee5,_0x4d217b,_0x2d741c,_0x190562;_0x267dbe=_[_0xce2c('0x43')]({},_0x267dbe,_0x257e65);return db['AnalyticCustomReport'][_0xce2c('0x4b')](_0x267dbe)[_0xce2c('0x28')](function(_0x207902){if(_0x207902){_0x29a530=_0x207902;return _0x207902['getFields']();}return null;})[_0xce2c('0x28')](function(_0x306a66){if(_0x306a66){if(!_0x306a66[_0xce2c('0x3b')]){throw new db[(_0xce2c('0x70'))][(_0xce2c('0x71'))](_0xce2c('0x72'),0x193);}_0x499ee5=_0x306a66;return db[_0xce2c('0x8e')]['findAll']({'raw':!![]});}return null;})[_0xce2c('0x28')](function(_0x578ec3){if(_0x578ec3){_0x4d217b=_[_0xce2c('0x8f')](_0x578ec3,'id');var _0x4ad429;var _0x4c36f1=squel[_0xce2c('0x74')]();_0x4c36f1['from'](_0x29a530[_0xce2c('0x75')]);for(var _0x3ba7a3=0x0;_0x3ba7a3<_0x499ee5[_0xce2c('0x3b')];_0x3ba7a3+=0x1){_0x4ad429=_0x499ee5[_0x3ba7a3]['MetricId']?_0x4d217b[_0x499ee5[_0x3ba7a3][_0xce2c('0x76')]][_0xce2c('0x77')]:_0x499ee5[_0x3ba7a3][_0xce2c('0x8d')];_0x4ad429=_0x499ee5[_0x3ba7a3][_0xce2c('0x78')]?_[_0xce2c('0x7a')](_0x1755c1[_0x499ee5[_0x3ba7a3][_0xce2c('0x78')]],'%s',_0x4ad429):_0x4ad429;_0x4ad429=_0x499ee5[_0x3ba7a3][_0xce2c('0x79')]?_[_0xce2c('0x7a')](_0xbe5a9d[_0x499ee5[_0x3ba7a3][_0xce2c('0x79')]],'%s',_0x4ad429):_0x4ad429;if(_0x499ee5[_0x3ba7a3][_0xce2c('0x90')]){_0x4c36f1[_0xce2c('0x6c')](_0x4ad429);}_0x499ee5[_0x3ba7a3][_0xce2c('0x7b')]&&_0x4c36f1[_0xce2c('0x3e')](_0x4ad429,_0x499ee5[_0x3ba7a3][_0xce2c('0x7b')]===_0xce2c('0x7c')?![]:!![]);_0x4c36f1[_0xce2c('0x8d')](_0x4ad429,_0x499ee5[_0x3ba7a3]['alias']||_0x4ad429);}if(_0x29a530[_0xce2c('0x7e')]){_0x29a530[_0xce2c('0x7e')]=JSON[_0xce2c('0x84')](_0x29a530[_0xce2c('0x7e')]);for(var _0x4ca628=0x0;_0x4ca628<_0x29a530[_0xce2c('0x7e')][_0xce2c('0x3b')];_0x4ca628+=0x1){if(_0x29a530['joins'][_0x4ca628][_0xce2c('0x35')]&&_[_0xce2c('0x65')](_0x435eee,_0x29a530[_0xce2c('0x7e')][_0x4ca628][_0xce2c('0x35')])&&_0x29a530[_0xce2c('0x7e')][_0x4ca628][_0xce2c('0x7f')]&&_0x29a530['joins'][_0x4ca628][_0xce2c('0x81')]&&_0x29a530[_0xce2c('0x7e')][_0x4ca628][_0xce2c('0x80')]){_0x4c36f1[_0x29a530['joins'][_0x4ca628][_0xce2c('0x35')]](_0x29a530[_0xce2c('0x7e')][_0x4ca628]['foreignTable'],null,util[_0xce2c('0x79')](_0xce2c('0x82'),_0x29a530[_0xce2c('0x75')],_0x29a530[_0xce2c('0x7e')][_0x4ca628][_0xce2c('0x7f')],_0x29a530['joins'][_0x4ca628][_0xce2c('0x81')],_0x29a530['joins'][_0x4ca628]['foreignKey']));}}}if(_0x29a530[_0xce2c('0x83')]){_0x29a530[_0xce2c('0x83')]=JSON[_0xce2c('0x84')](_0x29a530[_0xce2c('0x83')]);_0x4c36f1[_0xce2c('0x40')](_0x2ee0e0(_0x29a530['conditions'][_0xce2c('0x6c')]));}_0x190562=_0x4c36f1[_0xce2c('0x91')]();_0x4c36f1[_0xce2c('0x1e')](_0x20f2df);_0x4c36f1[_0xce2c('0x21')](0x0);return;}})[_0xce2c('0x28')](function(){if(_0x4900b3[_0xce2c('0x92')]===_0xce2c('0x93')){return null;}var _0x5a6c75=_[_0xce2c('0x43')](_0x4900b3,{'name':_0x4900b3[_0xce2c('0x94')]||_0x4900b3[_0xce2c('0x2e')]||_0x29a530[_0xce2c('0x2e')],'basename':_0x224b9b,'savename':util['format'](_0xce2c('0x95'),_0x4900b3[_0xce2c('0x2e')]||_0x29a530[_0xce2c('0x2e')],require(_0xce2c('0x96'))[_0xce2c('0x97')](0x4),_0x4900b3[_0xce2c('0x92')]||_0xce2c('0x98')),'reportId':_0x29a530['id'],'reportType':_0xce2c('0x99')});return db[_0xce2c('0x9a')]['create'](_0x5a6c75,{'raw':!![]});})[_0xce2c('0x28')](function(_0x18c3e9){if(_0x29a530[_0xce2c('0x75')]===_0xce2c('0x9b')){_0x190562[_0xce2c('0x40')](_0x29a530[_0xce2c('0x75')]+_0xce2c('0x9c'),_0x4900b3['startDate'],_0x4900b3[_0xce2c('0x9d')]);}else{_0x190562[_0xce2c('0x40')](_0x29a530[_0xce2c('0x75')]+_0xce2c('0x9e'),_0x4900b3[_0xce2c('0x9f')],_0x4900b3[_0xce2c('0x9d')]);}if(_0x18c3e9){logger[_0xce2c('0xa0')]('Run\x20Query:',_0x190562[_0xce2c('0xa1')]());require(_0xce2c('0xa2'))[_0xce2c('0xa3')](path[_0xce2c('0x56')](__dirname,_0xce2c('0xa4'),_0x18c3e9[_0xce2c('0x92')]),[_0x18c3e9['id'],_0x190562[_0xce2c('0xa1')](),path['join'](__dirname,_0xce2c('0xa5'),_0x18c3e9['savename']),_0x224b9b]);return _0x18c3e9;}else{var _0xe9f1b5=squel[_0xce2c('0x74')]();_0xe9f1b5[_0xce2c('0xa6')]('('+_0x190562['toString']()+')',_0xce2c('0xa7'));_0xe9f1b5[_0xce2c('0x8d')](_0xce2c('0xa8'),_0xce2c('0x20'));_0x190562['limit'](_0x4900b3[_0xce2c('0x1e')]||_0x20f2df);_0x190562[_0xce2c('0x21')](_0x4900b3[_0xce2c('0x21')]||0x0);return dbH[_0xce2c('0x87')]['query'](_0xe9f1b5[_0xce2c('0xa1')](),{'type':dbH[_0xce2c('0x87')][_0xce2c('0x88')][_0xce2c('0x89')]})[_0xce2c('0x28')](function(_0x42d621){if(!_0x42d621[_0xce2c('0x3b')]){_0x2d741c=0x0;}else{_0x2d741c=_0x42d621[0x0]['count']||0x0;}return dbH['sequelize'][_0xce2c('0x39')](_0x190562['toString'](),{'type':dbH[_0xce2c('0x87')][_0xce2c('0x88')][_0xce2c('0x89')]});})[_0xce2c('0x28')](function(_0x59738a){return{'rows':_0x59738a||[],'count':_0x2d741c};});}});}exports[_0xce2c('0xa9')]=function(_0x511d35,_0x416285){return runReport(_0x511d35[_0xce2c('0x48')],_0x511d35[_0xce2c('0x39')],_0x511d35['options'])[_0xce2c('0x28')](respondWithResult(_0x416285,null))[_0xce2c('0x54')](handleError(_0x416285,null));};exports[_0xce2c('0xaa')]=runReport;exports[_0xce2c('0x39')]=function(_0x102dfd,_0x20c085){var _0x56a97c=0xa;var _0x2c71d1=[_0xce2c('0x56'),'left_join',_0xce2c('0x8a'),_0xce2c('0x58')];var _0x547350={'SUM':_0xce2c('0x59'),'COUNT':_0xce2c('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce2c('0x5c'),'MIN':_0xce2c('0x8b'),'AVG':_0xce2c('0x5d'),'GROUP_CONCAT':_0xce2c('0x5e'),'GROUP_CONCAT ASC':_0xce2c('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x55a6bf={'SEC_TO_TIME':_0xce2c('0x60'),'DATE':_0xce2c('0x61'),'HOUR':_0xce2c('0x62'),'ROUND':_0xce2c('0x63'),'UNIX_TIMESTAMP':_0xce2c('0x64')};var _0x40d8b5=function(_0xb3d780){return!_[_0xce2c('0x65')]([_0xce2c('0x66'),'IS\x20NOT\x20NULL',_0xce2c('0x68'),_0xce2c('0x69')],_0xb3d780);};var _0x2f67c8=function(_0xe04e04){if(!_0xe04e04||!_0xe04e04[_0xce2c('0x6a')][_0xce2c('0x3b')]){return'';}for(var _0x48ae36='(',_0x504b9c=0x0;_0x504b9c<_0xe04e04[_0xce2c('0x6a')][_0xce2c('0x3b')];_0x504b9c+=0x1){_0x504b9c>0x0&&(_0x48ae36+='\x20'+_0xe04e04[_0xce2c('0x6b')]+'\x20');_0x48ae36+=_0xe04e04[_0xce2c('0x6a')][_0x504b9c][_0xce2c('0x6c')]?_0x2f67c8(_0xe04e04[_0xce2c('0x6a')][_0x504b9c][_0xce2c('0x6c')]):_0xe04e04[_0xce2c('0x6a')][_0x504b9c][_0xce2c('0x8d')]+'\x20'+_0xe04e04['rules'][_0x504b9c][_0xce2c('0x6d')]+(_0x40d8b5(_0xe04e04[_0xce2c('0x6a')][_0x504b9c][_0xce2c('0x6d')])?'\x20'+_0xe04e04['rules'][_0x504b9c]['value']:'');}return _0x48ae36+')';};var _0x31d002={'where':{'id':_0x102dfd[_0xce2c('0x48')]['id']}},_0x12d89d,_0x257b49,_0x5c34ea,_0x31d18f,_0x3114c0;_0x31d002=_[_0xce2c('0x43')]({},_0x31d002,_0x102dfd[_0xce2c('0x4a')]);return db['AnalyticCustomReport'][_0xce2c('0x4b')](_0x31d002)[_0xce2c('0x28')](function(_0x21f757){if(_0x21f757){_0x12d89d=_0x21f757;return _0x21f757['getFields']();}return null;})[_0xce2c('0x28')](function(_0x1440af){if(_0x1440af){if(!_0x1440af[_0xce2c('0x3b')]){throw new db[(_0xce2c('0x70'))][(_0xce2c('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x257b49=_0x1440af;return db[_0xce2c('0x8e')][_0xce2c('0x73')]({'raw':!![]});}return null;})[_0xce2c('0x28')](function(_0x2b1ad4){if(_0x2b1ad4){_0x5c34ea=_['keyBy'](_0x2b1ad4,'id');var _0x26f52a;var _0x9670d9=squel[_0xce2c('0x74')]();_0x9670d9['from'](_0x12d89d[_0xce2c('0x75')]);for(var _0x10966a=0x0;_0x10966a<_0x257b49[_0xce2c('0x3b')];_0x10966a+=0x1){_0x26f52a=_0x257b49[_0x10966a]['MetricId']?_0x5c34ea[_0x257b49[_0x10966a]['MetricId']][_0xce2c('0x77')]:_0x257b49[_0x10966a]['field'];_0x26f52a=_0x257b49[_0x10966a][_0xce2c('0x78')]?_[_0xce2c('0x7a')](_0x547350[_0x257b49[_0x10966a]['function']],'%s',_0x26f52a):_0x26f52a;_0x26f52a=_0x257b49[_0x10966a][_0xce2c('0x79')]?_['replace'](_0x55a6bf[_0x257b49[_0x10966a][_0xce2c('0x79')]],'%s',_0x26f52a):_0x26f52a;if(_0x257b49[_0x10966a][_0xce2c('0x90')]){_0x9670d9[_0xce2c('0x6c')](_0x26f52a);}_0x257b49[_0x10966a][_0xce2c('0x7b')]&&_0x9670d9[_0xce2c('0x3e')](_0x26f52a,_0x257b49[_0x10966a][_0xce2c('0x7b')]===_0xce2c('0x7c')?![]:!![]);_0x9670d9['field'](_0x26f52a,_0x257b49[_0x10966a][_0xce2c('0x7d')]||_0x26f52a);}if(_0x12d89d['joins']){_0x12d89d['joins']=JSON[_0xce2c('0x84')](_0x12d89d[_0xce2c('0x7e')]);for(var _0x2cddc5=0x0;_0x2cddc5<_0x12d89d[_0xce2c('0x7e')][_0xce2c('0x3b')];_0x2cddc5+=0x1){if(_0x12d89d[_0xce2c('0x7e')][_0x2cddc5][_0xce2c('0x35')]&&_[_0xce2c('0x65')](_0x2c71d1,_0x12d89d[_0xce2c('0x7e')][_0x2cddc5]['type'])&&_0x12d89d['joins'][_0x2cddc5][_0xce2c('0x7f')]&&_0x12d89d[_0xce2c('0x7e')][_0x2cddc5][_0xce2c('0x81')]&&_0x12d89d[_0xce2c('0x7e')][_0x2cddc5]['foreignKey']){_0x9670d9[_0x12d89d[_0xce2c('0x7e')][_0x2cddc5]['type']](_0x12d89d['joins'][_0x2cddc5][_0xce2c('0x81')],null,util[_0xce2c('0x79')](_0xce2c('0x82'),_0x12d89d['table'],_0x12d89d['joins'][_0x2cddc5][_0xce2c('0x7f')],_0x12d89d['joins'][_0x2cddc5][_0xce2c('0x81')],_0x12d89d[_0xce2c('0x7e')][_0x2cddc5][_0xce2c('0x80')]));}}}if(_0x12d89d['conditions']){_0x12d89d['conditions']=JSON['parse'](_0x12d89d[_0xce2c('0x83')]);_0x9670d9[_0xce2c('0x40')](_0x2f67c8(_0x12d89d[_0xce2c('0x83')][_0xce2c('0x6c')]));}_0x3114c0=_0x9670d9[_0xce2c('0x91')]();_0x9670d9[_0xce2c('0x1e')](_0x56a97c);_0x9670d9[_0xce2c('0x21')](0x0);logger[_0xce2c('0x85')](_0xce2c('0x86'),_0x9670d9['toString']());return dbH[_0xce2c('0x87')][_0xce2c('0x39')](_0x9670d9[_0xce2c('0xa1')](),{'type':dbH[_0xce2c('0x87')][_0xce2c('0x88')]['SELECT']});}})[_0xce2c('0x28')](function(){return{'sql':_0x3114c0[_0xce2c('0xa1')]()};})[_0xce2c('0x28')](respondWithResult(_0x20c085,null))['catch'](handleError(_0x20c085,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index cdfeb80..beab44d 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 _0xe7a1=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0x22b4c6,_0x18e2d8){var _0x917d72=function(_0xb62759){while(--_0xb62759){_0x22b4c6['push'](_0x22b4c6['shift']());}};_0x917d72(++_0x18e2d8);}(_0xe7a1,0x110));var _0x1e7a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe7a1[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x1e7a('0x0'));var util=require('util');var logger=require(_0x1e7a('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1e7a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1e7a('0x3'));var config=require(_0x1e7a('0x4'));var attributes=require(_0x1e7a('0x5'));module[_0x1e7a('0x6')]=function(_0x2a37b9,_0x2c76ef){return _0x2a37b9[_0x1e7a('0x7')](_0x1e7a('0x8'),attributes,{'tableName':_0x1e7a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5ea=['bluebird','path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','../../config/logger','moment'];(function(_0x16fa8d,_0x3a1ca5){var _0x1948d8=function(_0x48957b){while(--_0x48957b){_0x16fa8d['push'](_0x16fa8d['shift']());}};_0x1948d8(++_0x3a1ca5);}(_0xd5ea,0xdf));var _0xad5e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd5ea[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad5e('0x0'))('api');var moment=require(_0xad5e('0x1'));var BPromise=require(_0xad5e('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad5e('0x3'));var rimraf=require('rimraf');var config=require(_0xad5e('0x4'));var attributes=require(_0xad5e('0x5'));module['exports']=function(_0x215b4f,_0x3fbac5){return _0x215b4f[_0xad5e('0x6')](_0xad5e('0x7'),attributes,{'tableName':_0xad5e('0x8'),'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 7ad4855..b34ab6f 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 _0xf2e4=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x598408,_0x5e6f74){var _0x560720=function(_0x56a96d){while(--_0x56a96d){_0x598408['push'](_0x598408['shift']());}};_0x560720(++_0x5e6f74);}(_0xf2e4,0x119));var _0x4f2e=function(_0x37f8cf,_0x4dbb0a){_0x37f8cf=_0x37f8cf-0x0;var _0x595b52=_0xf2e4[_0x37f8cf];return _0x595b52;};'use strict';var _=require(_0x4f2e('0x0'));var util=require(_0x4f2e('0x1'));var moment=require(_0x4f2e('0x2'));var BPromise=require(_0x4f2e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f2e('0x4'));var db=require(_0x4f2e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f2e('0x6'))(_0x4f2e('0x7'));var config=require(_0x4f2e('0x8'));var jayson=require(_0x4f2e('0x9'));var client=jayson[_0x4f2e('0xa')][_0x4f2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x554696,_0xa08672,_0x55c7c2){return new BPromise(function(_0x51f264,_0x1693c5){return client[_0x4f2e('0xc')](_0x554696,_0x55c7c2)['then'](function(_0xe81e3f){logger[_0x4f2e('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa08672,'request\x20sent');logger[_0x4f2e('0xe')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xa08672,'request\x20sent',JSON[_0x4f2e('0xf')](_0xe81e3f));if(_0xe81e3f[_0x4f2e('0x10')]){if(_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x11')]===0x1f4){logger['error'](_0x4f2e('0x12'),_0xa08672,_0xe81e3f['error'][_0x4f2e('0x13')]);return _0x1693c5(_0xe81e3f[_0x4f2e('0x10')]['message']);}logger[_0x4f2e('0x10')](_0x4f2e('0x12'),_0xa08672,_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x13')]);return _0x51f264(_0xe81e3f[_0x4f2e('0x10')][_0x4f2e('0x13')]);}else{logger[_0x4f2e('0xd')](_0x4f2e('0x12'),_0xa08672,_0x4f2e('0x14'));_0x51f264(_0xe81e3f['result'][_0x4f2e('0x13')]);}})[_0x4f2e('0x15')](function(_0x123330){logger[_0x4f2e('0x10')](_0x4f2e('0x12'),_0xa08672,_0x123330);_0x1693c5(_0x123330);});});} \ No newline at end of file +var _0x445a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0xfc4648,_0x7e8703){var _0x2fc96c=function(_0xd3c10a){while(--_0xd3c10a){_0xfc4648['push'](_0xfc4648['shift']());}};_0x2fc96c(++_0x7e8703);}(_0x445a,0x1f3));var _0xa445=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x445a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa445('0x0'));var util=require(_0xa445('0x1'));var moment=require(_0xa445('0x2'));var BPromise=require(_0xa445('0x3'));var rs=require(_0xa445('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa445('0x5'));var logger=require(_0xa445('0x6'))(_0xa445('0x7'));var config=require(_0xa445('0x8'));var jayson=require(_0xa445('0x9'));var client=jayson[_0xa445('0xa')][_0xa445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5776d0,_0x182420,_0x4cb002){return new BPromise(function(_0x37e94f,_0x55a634){return client[_0xa445('0xc')](_0x5776d0,_0x4cb002)[_0xa445('0xd')](function(_0x911584){logger[_0xa445('0xe')](_0xa445('0xf'),_0x182420,_0xa445('0x10'));logger[_0xa445('0x11')](_0xa445('0x12'),_0x182420,'request\x20sent',JSON['stringify'](_0x911584));if(_0x911584['error']){if(_0x911584[_0xa445('0x13')][_0xa445('0x14')]===0x1f4){logger[_0xa445('0x13')](_0xa445('0xf'),_0x182420,_0x911584[_0xa445('0x13')][_0xa445('0x15')]);return _0x55a634(_0x911584[_0xa445('0x13')][_0xa445('0x15')]);}logger[_0xa445('0x13')]('AnalyticCustomReport,\x20%s,\x20%s',_0x182420,_0x911584['error'][_0xa445('0x15')]);return _0x37e94f(_0x911584['error']['message']);}else{logger[_0xa445('0xe')](_0xa445('0xf'),_0x182420,'request\x20sent');_0x37e94f(_0x911584[_0xa445('0x16')][_0xa445('0x15')]);}})[_0xa445('0x17')](function(_0x13534b){logger['error'](_0xa445('0xf'),_0x182420,_0x13534b);_0x55a634(_0x13534b);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 13f61e6..e6b6781 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 _0x88be=['show','preview','/:id/run','run','/:id/query','query','post','put','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index'];(function(_0x15a60a,_0x2657a7){var _0x4193f9=function(_0x47e05d){while(--_0x47e05d){_0x15a60a['push'](_0x15a60a['shift']());}};_0x4193f9(++_0x2657a7);}(_0x88be,0xb4));var _0xe88b=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x88be[_0x2576d7];return _0x16a08c;};'use strict';var multer=require(_0xe88b('0x0'));var util=require(_0xe88b('0x1'));var path=require('path');var timeout=require(_0xe88b('0x2'));var express=require(_0xe88b('0x3'));var router=express[_0xe88b('0x4')]();var fs_extra=require(_0xe88b('0x5'));var auth=require(_0xe88b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe88b('0x7'));var controller=require(_0xe88b('0x8'));router[_0xe88b('0x9')]('/',auth[_0xe88b('0xa')](),controller[_0xe88b('0xb')]);router[_0xe88b('0x9')]('/:id',auth[_0xe88b('0xa')](),controller[_0xe88b('0xc')]);router['get']('/:id/preview',auth[_0xe88b('0xa')](),controller[_0xe88b('0xd')]);router[_0xe88b('0x9')](_0xe88b('0xe'),auth['isAuthenticated'](),controller[_0xe88b('0xf')]);router[_0xe88b('0x9')](_0xe88b('0x10'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x11')]);router[_0xe88b('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe88b('0x13')](_0xe88b('0x14'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x15')]);router[_0xe88b('0x16')](_0xe88b('0x14'),auth[_0xe88b('0xa')](),controller[_0xe88b('0x17')]);module['exports']=router; \ No newline at end of file +var _0xf2db=['/:id/query','query','put','/:id','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','show','/:id/run','run'];(function(_0x1fc2a9,_0x1e0b7c){var _0x5b5bf3=function(_0x1570c3){while(--_0x1570c3){_0x1fc2a9['push'](_0x1fc2a9['shift']());}};_0x5b5bf3(++_0x1e0b7c);}(_0xf2db,0x123));var _0xbf2d=function(_0x536c7e,_0x598222){_0x536c7e=_0x536c7e-0x0;var _0x23de02=_0xf2db[_0x536c7e];return _0x23de02;};'use strict';var multer=require('multer');var util=require(_0xbf2d('0x0'));var path=require(_0xbf2d('0x1'));var timeout=require(_0xbf2d('0x2'));var express=require('express');var router=express[_0xbf2d('0x3')]();var fs_extra=require(_0xbf2d('0x4'));var auth=require(_0xbf2d('0x5'));var interaction=require(_0xbf2d('0x6'));var config=require('../../config/environment');var controller=require(_0xbf2d('0x7'));router[_0xbf2d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbf2d('0x8')]('/:id',auth[_0xbf2d('0x9')](),controller[_0xbf2d('0xa')]);router[_0xbf2d('0x8')]('/:id/preview',auth[_0xbf2d('0x9')](),controller['preview']);router[_0xbf2d('0x8')](_0xbf2d('0xb'),auth[_0xbf2d('0x9')](),controller[_0xbf2d('0xc')]);router[_0xbf2d('0x8')](_0xbf2d('0xd'),auth[_0xbf2d('0x9')](),controller[_0xbf2d('0xe')]);router['post']('/',auth[_0xbf2d('0x9')](),controller['create']);router[_0xbf2d('0xf')](_0xbf2d('0x10'),auth[_0xbf2d('0x9')](),controller[_0xbf2d('0x11')]);router['delete'](_0xbf2d('0x10'),auth['isAuthenticated'](),controller[_0xbf2d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 98c0bcc..0f1ad75 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 _0x3eea=['STRING','TEXT','sequelize'];(function(_0x2caaaf,_0x34fdb4){var _0x489b29=function(_0x2aa146){while(--_0x2aa146){_0x2caaaf['push'](_0x2caaaf['shift']());}};_0x489b29(++_0x34fdb4);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x2240c1,_0x2657bd){_0x2240c1=_0x2240c1-0x0;var _0x1f0369=_0x3eea[_0x2240c1];return _0x1f0369;};'use strict';var Sequelize=require(_0xa3ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3ee('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa3ee('0x1')]},'parent':{'type':Sequelize[_0xa3ee('0x1')]},'table':{'type':Sequelize[_0xa3ee('0x1')]},'conditions':{'type':Sequelize[_0xa3ee('0x2')]},'joins':{'type':Sequelize[_0xa3ee('0x2')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x16a63a,_0x536357){var _0x701d82=function(_0x5468a7){while(--_0x5468a7){_0x16a63a['push'](_0x16a63a['shift']());}};_0x701d82(++_0x536357);}(_0x5fc3,0xa8));var _0x35fc=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x5fc3[_0x53abe5];return _0xc1c37e;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 53a0faa..84ea06d 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 _0xc6ac=['keyBy','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','stack','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','name','query','keys','filters','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','intersection','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','SUM(%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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','field','condition','value','Sequelize','AnalyticMetric','select','from','table','MetricId','replace','format','group','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','IS\x20NOT\x20EMPTY','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','metric','function','groupBy','orderBy','output','web','fullPath','%s-%s.%s','randomstring','generate','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','getFields'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x28ca8a,_0xc92ce8){_0x28ca8a=_0x28ca8a-0x0;var _0x14b711=_0xc6ac[_0x28ca8a];return _0x14b711;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xcc6a('0x1b')];function respondWithStatusCode(_0x211444,_0x4300c0){_0x4300c0=_0x4300c0||0xcc;return function(_0x559a0a){if(_0x559a0a){return _0x211444['sendStatus'](_0x4300c0);}return _0x211444[_0xcc6a('0x1c')](_0x4300c0)[_0xcc6a('0x1d')]();};}function respondWithResult(_0x43710d,_0x348af7){_0x348af7=_0x348af7||0xc8;return function(_0x96f9de){if(_0x96f9de){return _0x43710d[_0xcc6a('0x1c')](_0x348af7)[_0xcc6a('0x1e')](_0x96f9de);}};}function respondWithFilteredResult(_0x403b18,_0x56ffb0){return function(_0x4e628f){if(_0x4e628f){var _0x4d021a=typeof _0x56ffb0[_0xcc6a('0x1f')]===_0xcc6a('0x20')&&typeof _0x56ffb0[_0xcc6a('0x21')]===_0xcc6a('0x20');var _0x33079c=_0x4e628f[_0xcc6a('0x22')];var _0x2d9585=_0x4d021a?0x0:_0x56ffb0[_0xcc6a('0x1f')];var _0x374e51=_0x4d021a?_0x4e628f[_0xcc6a('0x22')]:_0x56ffb0[_0xcc6a('0x1f')]+_0x56ffb0['limit'];var _0xfec60f;if(_0x374e51>=_0x33079c){_0x374e51=_0x33079c;_0xfec60f=0xc8;}else{_0xfec60f=0xce;}_0x403b18[_0xcc6a('0x1c')](_0xfec60f);return _0x403b18[_0xcc6a('0x23')](_0xcc6a('0x24'),_0x2d9585+'-'+_0x374e51+'/'+_0x33079c)[_0xcc6a('0x1e')](_0x4e628f);}return null;};}function patchUpdates(_0x30b8ed){return function(_0x36c80f){try{jsonpatch[_0xcc6a('0x25')](_0x36c80f,_0x30b8ed,!![]);}catch(_0x2254a8){return BPromise[_0xcc6a('0x26')](_0x2254a8);}return _0x36c80f[_0xcc6a('0x27')]();};}function saveUpdates(_0x845088,_0x51be9a){return function(_0x41c4c8){if(_0x41c4c8){return _0x41c4c8[_0xcc6a('0x28')](_0x845088)[_0xcc6a('0x29')](function(_0x581aae){return _0x581aae;});}return null;};}function removeEntity(_0x10016a,_0x294486){return function(_0x3a00e5){if(_0x3a00e5){return _0x3a00e5[_0xcc6a('0x2a')]()[_0xcc6a('0x29')](function(){var _0x5fc697=_0x3a00e5['get']({'plain':!![]});var _0x26def8=_0xcc6a('0x2b');return db[_0xcc6a('0x2c')]['destroy']({'where':{'type':_0x26def8,'resourceId':_0x5fc697['id']}})[_0xcc6a('0x29')](function(){return _0x3a00e5;});})[_0xcc6a('0x29')](function(){_0x10016a['status'](0xcc)[_0xcc6a('0x1d')]();});}};}function handleEntityNotFound(_0x8b1b2b,_0x3233d1){return function(_0x473f88){if(!_0x473f88){_0x8b1b2b['sendStatus'](0x194);}return _0x473f88;};}function handleError(_0x194aab,_0x3cf14c){_0x3cf14c=_0x3cf14c||0x1f4;return function(_0x2c6d88){logger['error'](_0x2c6d88[_0xcc6a('0x2d')]);if(_0x2c6d88['name']){delete _0x2c6d88['name'];}_0x194aab[_0xcc6a('0x1c')](_0x3cf14c)[_0xcc6a('0x2e')](_0x2c6d88);};}exports[_0xcc6a('0x2f')]=function(_0x11b481,_0x2b575d){var _0x131138={},_0x4e2de4={},_0x7b2b54={'count':0x0,'rows':[]};var _0x28e3c3=_[_0xcc6a('0x30')](db[_0xcc6a('0x31')][_0xcc6a('0x32')],function(_0x152ebd){return{'name':_0x152ebd[_0xcc6a('0x33')],'type':_0x152ebd[_0xcc6a('0x34')]['key']};});_0x4e2de4[_0xcc6a('0x35')]=_[_0xcc6a('0x30')](_0x28e3c3,_0xcc6a('0x36'));_0x4e2de4[_0xcc6a('0x37')]=_[_0xcc6a('0x38')](_0x11b481[_0xcc6a('0x37')]);_0x4e2de4[_0xcc6a('0x39')]=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],_0x4e2de4['query']);_0x131138['attributes']=_['intersection'](_0x4e2de4[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3a')]));_0x131138[_0xcc6a('0x3b')]=_0x131138['attributes']['length']?_0x131138[_0xcc6a('0x3b')]:_0x4e2de4[_0xcc6a('0x35')];if(!_0x11b481[_0xcc6a('0x37')]['hasOwnProperty'](_0xcc6a('0x3c'))){_0x131138[_0xcc6a('0x21')]=qs[_0xcc6a('0x21')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x21')]);_0x131138[_0xcc6a('0x1f')]=qs[_0xcc6a('0x1f')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x1f')]);}_0x131138[_0xcc6a('0x3d')]=qs[_0xcc6a('0x3e')](_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x3e')]);_0x131138[_0xcc6a('0x3f')]=qs[_0xcc6a('0x39')](_[_0xcc6a('0x40')](_0x11b481[_0xcc6a('0x37')],_0x4e2de4[_0xcc6a('0x39')]),_0x28e3c3);if(_0x11b481['query']['filter']){_0x131138[_0xcc6a('0x3f')]=_[_0xcc6a('0x41')](_0x131138[_0xcc6a('0x3f')],{'$or':_[_0xcc6a('0x30')](_0x28e3c3,function(_0x1e628b){if(_0x1e628b[_0xcc6a('0x34')]!==_0xcc6a('0x42')){var _0x1199f1={};_0x1199f1[_0x1e628b['name']]={'$like':'%'+_0x11b481['query'][_0xcc6a('0x43')]+'%'};return _0x1199f1;}})});}_0x131138=_['merge']({},_0x131138,_0x11b481['options']);var _0x5cf1ba={'where':_0x131138[_0xcc6a('0x3f')]};return db[_0xcc6a('0x31')][_0xcc6a('0x22')](_0x5cf1ba)[_0xcc6a('0x29')](function(_0xe8056f){_0x7b2b54['count']=_0xe8056f;if(_0x11b481[_0xcc6a('0x37')][_0xcc6a('0x44')]){_0x131138[_0xcc6a('0x45')]=[{'all':!![]}];}return db[_0xcc6a('0x31')][_0xcc6a('0x46')](_0x131138);})[_0xcc6a('0x29')](function(_0x54f862){_0x7b2b54[_0xcc6a('0x47')]=_0x54f862;return _0x7b2b54;})[_0xcc6a('0x29')](respondWithFilteredResult(_0x2b575d,_0x131138))[_0xcc6a('0x48')](handleError(_0x2b575d,null));};exports[_0xcc6a('0x49')]=function(_0x494904,_0x1fe723){var _0x4a9cea={'raw':!![],'where':{'id':_0x494904[_0xcc6a('0x4a')]['id']}},_0x351529={};_0x351529[_0xcc6a('0x35')]=_['keys'](db[_0xcc6a('0x31')][_0xcc6a('0x32')]);_0x351529[_0xcc6a('0x37')]=_['keys'](_0x494904['query']);_0x351529[_0xcc6a('0x39')]=_[_0xcc6a('0x4b')](_0x351529[_0xcc6a('0x35')],_0x351529[_0xcc6a('0x37')]);_0x4a9cea[_0xcc6a('0x3b')]=_['intersection'](_0x351529[_0xcc6a('0x35')],qs[_0xcc6a('0x3a')](_0x494904['query'][_0xcc6a('0x3a')]));_0x4a9cea[_0xcc6a('0x3b')]=_0x4a9cea[_0xcc6a('0x3b')][_0xcc6a('0x4c')]?_0x4a9cea[_0xcc6a('0x3b')]:_0x351529[_0xcc6a('0x35')];if(_0x494904['query']['includeAll']){_0x4a9cea['include']=[{'all':!![]}];}_0x4a9cea=_[_0xcc6a('0x41')]({},_0x4a9cea,_0x494904[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4a9cea)['then'](handleEntityNotFound(_0x1fe723,null))[_0xcc6a('0x29')](respondWithResult(_0x1fe723,null))['catch'](handleError(_0x1fe723,null));};exports[_0xcc6a('0x4f')]=function(_0x4299ca,_0xcfc540){return db[_0xcc6a('0x31')][_0xcc6a('0x4f')](_0x4299ca[_0xcc6a('0x50')],{})['then'](function(_0x1a3b82){var _0x7288b2=_0x4299ca[_0xcc6a('0x51')][_0xcc6a('0x52')]({'plain':!![]});if(!_0x7288b2)throw new Error(_0xcc6a('0x53'));if(_0x7288b2[_0xcc6a('0x54')]===_0xcc6a('0x51')){var _0x392805=_0x1a3b82[_0xcc6a('0x52')]({'plain':!![]});var _0x30d0ef='Reports';return db[_0xcc6a('0x55')][_0xcc6a('0x4e')]({'where':{'name':_0x30d0ef,'userProfileId':_0x7288b2[_0xcc6a('0x56')]},'raw':!![]})[_0xcc6a('0x29')](function(_0x14f5e5){if(_0x14f5e5&&_0x14f5e5[_0xcc6a('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x392805[_0xcc6a('0x36')],'resourceId':_0x392805['id'],'type':'DefaultReports','sectionId':_0x14f5e5['id']},{})[_0xcc6a('0x29')](function(){return _0x1a3b82;});}else{return _0x1a3b82;}})[_0xcc6a('0x48')](function(_0x2b5782){logger[_0xcc6a('0x58')](_0xcc6a('0x59'),_0x2b5782);throw _0x2b5782;});}return _0x1a3b82;})[_0xcc6a('0x29')](respondWithResult(_0xcfc540,0xc9))[_0xcc6a('0x48')](handleError(_0xcfc540,null));};exports[_0xcc6a('0x28')]=function(_0x68b823,_0x27b074){if(_0x68b823[_0xcc6a('0x50')]['id']){delete _0x68b823['body']['id'];}return db[_0xcc6a('0x31')]['find']({'where':{'id':_0x68b823[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x27b074,null))[_0xcc6a('0x29')](saveUpdates(_0x68b823['body'],null))[_0xcc6a('0x29')](respondWithResult(_0x27b074,null))['catch'](handleError(_0x27b074,null));};exports[_0xcc6a('0x2a')]=function(_0x5db3b5,_0x3c0b1c){return db[_0xcc6a('0x31')][_0xcc6a('0x4e')]({'where':{'id':_0x5db3b5[_0xcc6a('0x4a')]['id']}})[_0xcc6a('0x29')](handleEntityNotFound(_0x3c0b1c,null))[_0xcc6a('0x29')](removeEntity(_0x3c0b1c,null))[_0xcc6a('0x48')](handleError(_0x3c0b1c,null));};exports[_0xcc6a('0x5a')]=function(_0x506311,_0x14d3ff){var _0x56d512=0xa;var _0x3a6b7e=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x586789={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x389e5f={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2cc561=function(_0x483aa4){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x483aa4);};var _0x46d93b=function(_0x4ed702){if(!_0x4ed702||!_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x20a16b='(',_0x19a578=0x0;_0x19a578<_0x4ed702[_0xcc6a('0x6e')][_0xcc6a('0x4c')];_0x19a578+=0x1){_0x19a578>0x0&&(_0x20a16b+='\x20'+_0x4ed702[_0xcc6a('0x6f')]+'\x20');_0x20a16b+=_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['group']?_0x46d93b(_0x4ed702['rules'][_0x19a578]['group']):_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x70')]+'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578]['condition']+(_0x2cc561(_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x71')])?'\x20'+_0x4ed702[_0xcc6a('0x6e')][_0x19a578][_0xcc6a('0x72')]:'');}return _0x20a16b+')';};var _0x5e1c69={'where':{'id':_0x506311['params']['id']}},_0x481d25,_0xaec5e8,_0x41527b,_0x4403d3,_0x386a74;_0x5e1c69=_[_0xcc6a('0x41')]({},_0x5e1c69,_0x506311[_0xcc6a('0x4d')]);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x5e1c69)[_0xcc6a('0x29')](function(_0x55d129){if(_0x55d129){_0x481d25=_0x55d129;return _0x55d129['getFields']();}return null;})[_0xcc6a('0x29')](function(_0xd1a27b){if(_0xd1a27b){if(!_0xd1a27b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xaec5e8=_0xd1a27b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x421d0b){if(_0x421d0b){_0x41527b=_['keyBy'](_0x421d0b,'id');var _0x4a8863;var _0x58e6b4=squel[_0xcc6a('0x75')]();_0x58e6b4[_0xcc6a('0x76')](_0x481d25[_0xcc6a('0x77')]);for(var _0x729b2=0x0;_0x729b2<_0xaec5e8['length'];_0x729b2+=0x1){_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x78')]?_0x41527b[_0xaec5e8[_0x729b2][_0xcc6a('0x78')]]['metric']:_0xaec5e8[_0x729b2][_0xcc6a('0x70')];_0x4a8863=_0xaec5e8[_0x729b2]['function']?_[_0xcc6a('0x79')](_0x586789[_0xaec5e8[_0x729b2]['function']],'%s',_0x4a8863):_0x4a8863;_0x4a8863=_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x389e5f[_0xaec5e8[_0x729b2][_0xcc6a('0x7a')]],'%s',_0x4a8863):_0x4a8863;if(_0xaec5e8[_0x729b2]['groupBy']){_0x58e6b4[_0xcc6a('0x7b')](_0x4a8863);}_0xaec5e8[_0x729b2]['orderBy']&&_0x58e6b4[_0xcc6a('0x3d')](_0x4a8863,_0xaec5e8[_0x729b2]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x58e6b4[_0xcc6a('0x70')](_0x4a8863,_0xaec5e8[_0x729b2][_0xcc6a('0x7d')]||_0x4a8863);}if(_0x481d25[_0xcc6a('0x7e')]){_0x481d25[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x481d25['joins']);for(var _0x18f5dc=0x0;_0x18f5dc<_0x481d25[_0xcc6a('0x7e')][_0xcc6a('0x4c')];_0x18f5dc+=0x1){if(_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]&&_['includes'](_0x3a6b7e,_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')])&&_0x481d25['joins'][_0x18f5dc]['parentKey']&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x80')]&&_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]){_0x58e6b4[_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x34')]](_0x481d25['joins'][_0x18f5dc][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x481d25[_0xcc6a('0x77')],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x83')],_0x481d25['joins'][_0x18f5dc]['foreignTable'],_0x481d25[_0xcc6a('0x7e')][_0x18f5dc][_0xcc6a('0x81')]));}}}if(_0x481d25[_0xcc6a('0x84')]){_0x481d25[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x481d25[_0xcc6a('0x84')]);_0x58e6b4[_0xcc6a('0x3f')](_0x46d93b(_0x481d25['conditions'][_0xcc6a('0x7b')]));}_0x386a74=_0x58e6b4[_0xcc6a('0x85')]();_0x58e6b4[_0xcc6a('0x21')](_0x56d512);_0x58e6b4[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x58e6b4['toString']());return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x58e6b4[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')][_0xcc6a('0x8b')]});}})[_0xcc6a('0x29')](respondWithResult(_0x14d3ff,null))[_0xcc6a('0x48')](handleError(_0x14d3ff,null));};function runReport(_0x2a25df,_0x1f1ff7,_0x565bcd){var _0x45c45f=_0x1f1ff7[_0xcc6a('0x36')];var _0x58cd56=0xa;var _0x1848dd=[_0xcc6a('0x8c'),_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x5abd5c={'SUM':_0xcc6a('0x5e'),'COUNT':_0xcc6a('0x8d'),'COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':_0xcc6a('0x5f'),'MIN':_0xcc6a('0x60'),'AVG':_0xcc6a('0x61'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x5be65b={'SEC_TO_TIME':_0xcc6a('0x65'),'DATE':_0xcc6a('0x66'),'HOUR':_0xcc6a('0x67'),'ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x2b5c15=function(_0x3207b2){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),_0xcc6a('0x6c'),_0xcc6a('0x6d'),_0xcc6a('0x8f')],_0x3207b2);};var _0x58fdb3=function(_0xb4b2b4){if(!_0xb4b2b4||!_0xb4b2b4[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x275e15='(',_0x53b419=0x0;_0x53b419<_0xb4b2b4[_0xcc6a('0x6e')]['length'];_0x53b419+=0x1){_0x53b419>0x0&&(_0x275e15+='\x20'+_0xb4b2b4[_0xcc6a('0x6f')]+'\x20');_0x275e15+=_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]?_0x58fdb3(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x7b')]):_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x70')]+'\x20'+_0xb4b2b4['rules'][_0x53b419][_0xcc6a('0x71')]+(_0x2b5c15(_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x71')])?'\x20'+_0xb4b2b4[_0xcc6a('0x6e')][_0x53b419][_0xcc6a('0x72')]:'');}return _0x275e15+')';};var _0x4473ab={'where':{'id':_0x2a25df['id']}},_0x558e2f,_0x14a957,_0x350766,_0x589bff,_0x5661b5;_0x4473ab=_[_0xcc6a('0x41')]({},_0x4473ab,_0x565bcd);return db[_0xcc6a('0x31')][_0xcc6a('0x4e')](_0x4473ab)[_0xcc6a('0x29')](function(_0x2f0b79){if(_0x2f0b79){_0x558e2f=_0x2f0b79;return _0x2f0b79['getFields']();}return null;})[_0xcc6a('0x29')](function(_0x4a268b){if(_0x4a268b){if(!_0x4a268b[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x14a957=_0x4a268b;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x1f4c4e){if(_0x1f4c4e){_0x350766=_['keyBy'](_0x1f4c4e,'id');var _0x312431;var _0x2a850c=squel[_0xcc6a('0x75')]();_0x2a850c['from'](_0x558e2f[_0xcc6a('0x77')]);for(var _0xd5b9f3=0x0;_0xd5b9f3<_0x14a957[_0xcc6a('0x4c')];_0xd5b9f3+=0x1){_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]?_0x350766[_0x14a957[_0xd5b9f3][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x14a957[_0xd5b9f3][_0xcc6a('0x70')];_0x312431=_0x14a957[_0xd5b9f3]['function']?_[_0xcc6a('0x79')](_0x5abd5c[_0x14a957[_0xd5b9f3][_0xcc6a('0x93')]],'%s',_0x312431):_0x312431;_0x312431=_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]?_[_0xcc6a('0x79')](_0x5be65b[_0x14a957[_0xd5b9f3][_0xcc6a('0x7a')]],'%s',_0x312431):_0x312431;if(_0x14a957[_0xd5b9f3][_0xcc6a('0x94')]){_0x2a850c[_0xcc6a('0x7b')](_0x312431);}_0x14a957[_0xd5b9f3][_0xcc6a('0x95')]&&_0x2a850c['order'](_0x312431,_0x14a957[_0xd5b9f3]['orderBy']===_0xcc6a('0x7c')?![]:!![]);_0x2a850c['field'](_0x312431,_0x14a957[_0xd5b9f3][_0xcc6a('0x7d')]||_0x312431);}if(_0x558e2f[_0xcc6a('0x7e')]){_0x558e2f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x7e')]);for(var _0x1f7ee5=0x0;_0x1f7ee5<_0x558e2f[_0xcc6a('0x7e')]['length'];_0x1f7ee5+=0x1){if(_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type']&&_['includes'](_0x1848dd,_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['type'])&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')]&&_0x558e2f['joins'][_0x1f7ee5]['foreignTable']&&_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5]['foreignKey']){_0x2a850c[_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x34')]](_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x558e2f['table'],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x83')],_0x558e2f[_0xcc6a('0x7e')][_0x1f7ee5][_0xcc6a('0x80')],_0x558e2f['joins'][_0x1f7ee5][_0xcc6a('0x81')]));}}}if(_0x558e2f[_0xcc6a('0x84')]){_0x558e2f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x558e2f[_0xcc6a('0x84')]);_0x2a850c[_0xcc6a('0x3f')](_0x58fdb3(_0x558e2f[_0xcc6a('0x84')]['group']));}_0x5661b5=_0x2a850c[_0xcc6a('0x85')]();_0x2a850c[_0xcc6a('0x21')](_0x58cd56);_0x2a850c['offset'](0x0);return;}})[_0xcc6a('0x29')](function(){if(_0x1f1ff7[_0xcc6a('0x96')]===_0xcc6a('0x97')){return null;}var _0x2297ea=_[_0xcc6a('0x41')](_0x1f1ff7,{'name':_0x1f1ff7[_0xcc6a('0x98')]||_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],'basename':_0x45c45f,'savename':util[_0xcc6a('0x7a')](_0xcc6a('0x99'),_0x1f1ff7[_0xcc6a('0x36')]||_0x558e2f[_0xcc6a('0x36')],require(_0xcc6a('0x9a'))[_0xcc6a('0x9b')](0x4),_0x1f1ff7['output']||'csv'),'reportId':_0x558e2f['id'],'reportType':_0xcc6a('0x9c')});return db[_0xcc6a('0x9d')]['create'](_0x2297ea,{'raw':!![]});})[_0xcc6a('0x29')](function(_0x1e74a4){if(_0x558e2f[_0xcc6a('0x77')]==='cdr'){_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0x9e'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7['endDate']);}else{_0x5661b5[_0xcc6a('0x3f')](_0x558e2f['table']+_0xcc6a('0xa0'),_0x1f1ff7[_0xcc6a('0x9f')],_0x1f1ff7[_0xcc6a('0xa1')]);}if(_0x1e74a4){logger[_0xcc6a('0xa2')](_0xcc6a('0xa3'),_0x5661b5[_0xcc6a('0x89')]());require('child_process')['fork'](path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa4'),_0x1e74a4[_0xcc6a('0x96')]),[_0x1e74a4['id'],_0x5661b5['toString'](),path[_0xcc6a('0x8c')](__dirname,_0xcc6a('0xa5'),_0x1e74a4[_0xcc6a('0xa6')]),_0x45c45f]);return _0x1e74a4;}else{var _0x3b7b43=squel['select']();_0x3b7b43[_0xcc6a('0x76')]('('+_0x5661b5[_0xcc6a('0x89')]()+')',_0xcc6a('0xa7'));_0x3b7b43['field'](_0xcc6a('0xa8'),'count');_0x5661b5[_0xcc6a('0x21')](_0x1f1ff7[_0xcc6a('0x21')]||_0x58cd56);_0x5661b5['offset'](_0x1f1ff7[_0xcc6a('0x1f')]||0x0);return dbH[_0xcc6a('0x88')][_0xcc6a('0x37')](_0x3b7b43[_0xcc6a('0x89')](),{'type':dbH[_0xcc6a('0x88')][_0xcc6a('0x8a')][_0xcc6a('0x8b')]})[_0xcc6a('0x29')](function(_0x25ba57){if(!_0x25ba57[_0xcc6a('0x4c')]){_0x589bff=0x0;}else{_0x589bff=_0x25ba57[0x0][_0xcc6a('0x22')]||0x0;}return dbH['sequelize']['query'](_0x5661b5[_0xcc6a('0x89')](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});})['then'](function(_0x32ced0){return{'rows':_0x32ced0||[],'count':_0x589bff};});}});}exports[_0xcc6a('0xa9')]=function(_0xc638ae,_0x3367e8){return runReport(_0xc638ae['params'],_0xc638ae[_0xcc6a('0x37')],_0xc638ae['options'])['then'](respondWithResult(_0x3367e8,null))[_0xcc6a('0x48')](handleError(_0x3367e8,null));};exports[_0xcc6a('0xaa')]=runReport;exports[_0xcc6a('0x37')]=function(_0x38d805,_0x3f5f97){var _0x399eb6=0xa;var _0x2ae391=['join',_0xcc6a('0x5b'),_0xcc6a('0x5c'),_0xcc6a('0x5d')];var _0x50b948={'SUM':_0xcc6a('0x5e'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcc6a('0x8e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xcc6a('0x61'),'GROUP_CONCAT':_0xcc6a('0x62'),'GROUP_CONCAT ASC':_0xcc6a('0x63'),'GROUP_CONCAT DESC':_0xcc6a('0x64')};var _0x1d2ae0={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xcc6a('0x68'),'UNIX_TIMESTAMP':_0xcc6a('0x69')};var _0x41d17b=function(_0x1827e6){return!_[_0xcc6a('0x6a')]([_0xcc6a('0x6b'),'IS\x20NOT\x20NULL',_0xcc6a('0x6d'),'IS\x20NOT\x20EMPTY'],_0x1827e6);};var _0xa70fa=function(_0x33ec76){if(!_0x33ec76||!_0x33ec76[_0xcc6a('0x6e')][_0xcc6a('0x4c')]){return'';}for(var _0x30162c='(',_0x48746a=0x0;_0x48746a<_0x33ec76['rules'][_0xcc6a('0x4c')];_0x48746a+=0x1){_0x48746a>0x0&&(_0x30162c+='\x20'+_0x33ec76[_0xcc6a('0x6f')]+'\x20');_0x30162c+=_0x33ec76['rules'][_0x48746a][_0xcc6a('0x7b')]?_0xa70fa(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x7b')]):_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x70')]+'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['condition']+(_0x41d17b(_0x33ec76[_0xcc6a('0x6e')][_0x48746a][_0xcc6a('0x71')])?'\x20'+_0x33ec76[_0xcc6a('0x6e')][_0x48746a]['value']:'');}return _0x30162c+')';};var _0x54f0e4={'where':{'id':_0x38d805[_0xcc6a('0x4a')]['id']}},_0x559f4f,_0x545b15,_0x17a4e1,_0x5a7da7,_0x434c8b;_0x54f0e4=_['merge']({},_0x54f0e4,_0x38d805[_0xcc6a('0x4d')]);return db['AnalyticDefaultReport'][_0xcc6a('0x4e')](_0x54f0e4)[_0xcc6a('0x29')](function(_0xe9231f){if(_0xe9231f){_0x559f4f=_0xe9231f;return _0xe9231f[_0xcc6a('0xab')]();}return null;})[_0xcc6a('0x29')](function(_0x197961){if(_0x197961){if(!_0x197961[_0xcc6a('0x4c')]){throw new db[(_0xcc6a('0x73'))][(_0xcc6a('0x90'))](_0xcc6a('0x91'),0x193);}_0x545b15=_0x197961;return db[_0xcc6a('0x74')][_0xcc6a('0x46')]({'raw':!![]});}return null;})[_0xcc6a('0x29')](function(_0x171a2a){if(_0x171a2a){_0x17a4e1=_[_0xcc6a('0xac')](_0x171a2a,'id');var _0x13860b;var _0x3b52f7=squel[_0xcc6a('0x75')]();_0x3b52f7[_0xcc6a('0x76')](_0x559f4f[_0xcc6a('0x77')]);for(var _0x319f4a=0x0;_0x319f4a<_0x545b15[_0xcc6a('0x4c')];_0x319f4a+=0x1){_0x13860b=_0x545b15[_0x319f4a]['MetricId']?_0x17a4e1[_0x545b15[_0x319f4a][_0xcc6a('0x78')]][_0xcc6a('0x92')]:_0x545b15[_0x319f4a][_0xcc6a('0x70')];_0x13860b=_0x545b15[_0x319f4a]['function']?_[_0xcc6a('0x79')](_0x50b948[_0x545b15[_0x319f4a][_0xcc6a('0x93')]],'%s',_0x13860b):_0x13860b;_0x13860b=_0x545b15[_0x319f4a]['format']?_[_0xcc6a('0x79')](_0x1d2ae0[_0x545b15[_0x319f4a][_0xcc6a('0x7a')]],'%s',_0x13860b):_0x13860b;if(_0x545b15[_0x319f4a]['groupBy']){_0x3b52f7[_0xcc6a('0x7b')](_0x13860b);}_0x545b15[_0x319f4a][_0xcc6a('0x95')]&&_0x3b52f7[_0xcc6a('0x3d')](_0x13860b,_0x545b15[_0x319f4a][_0xcc6a('0x95')]===_0xcc6a('0x7c')?![]:!![]);_0x3b52f7[_0xcc6a('0x70')](_0x13860b,_0x545b15[_0x319f4a]['alias']||_0x13860b);}if(_0x559f4f['joins']){_0x559f4f[_0xcc6a('0x7e')]=JSON[_0xcc6a('0x7f')](_0x559f4f['joins']);for(var _0x154885=0x0;_0x154885<_0x559f4f['joins'][_0xcc6a('0x4c')];_0x154885+=0x1){if(_0x559f4f['joins'][_0x154885][_0xcc6a('0x34')]&&_[_0xcc6a('0x6a')](_0x2ae391,_0x559f4f[_0xcc6a('0x7e')][_0x154885]['type'])&&_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')]&&_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignTable']&&_0x559f4f['joins'][_0x154885]['foreignKey']){_0x3b52f7[_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x34')]](_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],null,util[_0xcc6a('0x7a')](_0xcc6a('0x82'),_0x559f4f[_0xcc6a('0x77')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x83')],_0x559f4f[_0xcc6a('0x7e')][_0x154885][_0xcc6a('0x80')],_0x559f4f[_0xcc6a('0x7e')][_0x154885]['foreignKey']));}}}if(_0x559f4f[_0xcc6a('0x84')]){_0x559f4f[_0xcc6a('0x84')]=JSON[_0xcc6a('0x7f')](_0x559f4f['conditions']);_0x3b52f7[_0xcc6a('0x3f')](_0xa70fa(_0x559f4f[_0xcc6a('0x84')][_0xcc6a('0x7b')]));}_0x434c8b=_0x3b52f7['clone']();_0x3b52f7[_0xcc6a('0x21')](_0x399eb6);_0x3b52f7[_0xcc6a('0x1f')](0x0);logger[_0xcc6a('0x86')](_0xcc6a('0x87'),_0x3b52f7['toString']());return dbH[_0xcc6a('0x88')]['query'](_0x3b52f7['toString'](),{'type':dbH['sequelize'][_0xcc6a('0x8a')]['SELECT']});}})['then'](function(){return{'sql':_0x434c8b[_0xcc6a('0x89')]()};})[_0xcc6a('0x29')](respondWithResult(_0x3f5f97,null))[_0xcc6a('0x48')](handleError(_0x3f5f97,null));}; \ No newline at end of file +var _0x5fab=['debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','from','function','order','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','params','runReport','AVG(%s)','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','limit','undefined','count','offset','Content-Range','apply','save','update','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','query','where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone'];(function(_0xe97e71,_0x525664){var _0x27fc5f=function(_0x17dc64){while(--_0x17dc64){_0xe97e71['push'](_0xe97e71['shift']());}};_0x27fc5f(++_0x525664);}(_0x5fab,0x177));var _0xb5fa=function(_0x4b736c,_0x18d185){_0x4b736c=_0x4b736c-0x0;var _0x236b90=_0x5fab[_0x4b736c];return _0x236b90;};'use strict';var emlformat=require(_0xb5fa('0x0'));var rimraf=require(_0xb5fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5fa('0x2'));var rp=require(_0xb5fa('0x3'));var moment=require(_0xb5fa('0x4'));var BPromise=require(_0xb5fa('0x5'));var Mustache=require(_0xb5fa('0x6'));var util=require(_0xb5fa('0x7'));var path=require(_0xb5fa('0x8'));var sox=require(_0xb5fa('0x9'));var csv=require(_0xb5fa('0xa'));var ejs=require(_0xb5fa('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xa'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var licenseUtil=require(_0xb5fa('0x18'));var db=require(_0xb5fa('0x19'))['db'];var dbH=require('../../mysqldb')[_0xb5fa('0x1a')];function respondWithStatusCode(_0x3dad4d,_0x56e8b0){_0x56e8b0=_0x56e8b0||0xcc;return function(_0x116849){if(_0x116849){return _0x3dad4d['sendStatus'](_0x56e8b0);}return _0x3dad4d[_0xb5fa('0x1b')](_0x56e8b0)[_0xb5fa('0x1c')]();};}function respondWithResult(_0x40c914,_0xca8d82){_0xca8d82=_0xca8d82||0xc8;return function(_0x8e9d1c){if(_0x8e9d1c){return _0x40c914['status'](_0xca8d82)['json'](_0x8e9d1c);}};}function respondWithFilteredResult(_0x38e964,_0x587043){return function(_0x31f252){if(_0x31f252){var _0x27c8f7=typeof _0x587043['offset']==='undefined'&&typeof _0x587043[_0xb5fa('0x1d')]===_0xb5fa('0x1e');var _0x32e9e5=_0x31f252[_0xb5fa('0x1f')];var _0x324ba5=_0x27c8f7?0x0:_0x587043[_0xb5fa('0x20')];var _0x3b0f69=_0x27c8f7?_0x31f252[_0xb5fa('0x1f')]:_0x587043[_0xb5fa('0x20')]+_0x587043[_0xb5fa('0x1d')];var _0x3c8d53;if(_0x3b0f69>=_0x32e9e5){_0x3b0f69=_0x32e9e5;_0x3c8d53=0xc8;}else{_0x3c8d53=0xce;}_0x38e964[_0xb5fa('0x1b')](_0x3c8d53);return _0x38e964['set'](_0xb5fa('0x21'),_0x324ba5+'-'+_0x3b0f69+'/'+_0x32e9e5)['json'](_0x31f252);}return null;};}function patchUpdates(_0x37ae06){return function(_0x4a6c04){try{jsonpatch[_0xb5fa('0x22')](_0x4a6c04,_0x37ae06,!![]);}catch(_0x43c09f){return BPromise['reject'](_0x43c09f);}return _0x4a6c04[_0xb5fa('0x23')]();};}function saveUpdates(_0x3a2ab9,_0x283a56){return function(_0x47f71a){if(_0x47f71a){return _0x47f71a[_0xb5fa('0x24')](_0x3a2ab9)[_0xb5fa('0x25')](function(_0x444237){return _0x444237;});}return null;};}function removeEntity(_0x542348,_0x224ec8){return function(_0x5d55f7){if(_0x5d55f7){return _0x5d55f7[_0xb5fa('0x26')]()[_0xb5fa('0x25')](function(){var _0x11053a=_0x5d55f7[_0xb5fa('0x27')]({'plain':!![]});var _0x2dbd22=_0xb5fa('0x28');return db[_0xb5fa('0x29')][_0xb5fa('0x26')]({'where':{'type':_0x2dbd22,'resourceId':_0x11053a['id']}})['then'](function(){return _0x5d55f7;});})['then'](function(){_0x542348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28a350,_0x460b54){return function(_0x12c0d4){if(!_0x12c0d4){_0x28a350[_0xb5fa('0x2a')](0x194);}return _0x12c0d4;};}function handleError(_0x534884,_0x3506a4){_0x3506a4=_0x3506a4||0x1f4;return function(_0x358549){logger[_0xb5fa('0x2b')](_0x358549[_0xb5fa('0x2c')]);if(_0x358549[_0xb5fa('0x2d')]){delete _0x358549[_0xb5fa('0x2d')];}_0x534884[_0xb5fa('0x1b')](_0x3506a4)[_0xb5fa('0x2e')](_0x358549);};}exports[_0xb5fa('0x2f')]=function(_0xed02e,_0x116773){var _0x5a0152={},_0x3fd1fb={},_0x21fc7e={'count':0x0,'rows':[]};var _0x319c48=_[_0xb5fa('0x30')](db[_0xb5fa('0x31')][_0xb5fa('0x32')],function(_0x25fc7c){return{'name':_0x25fc7c['fieldName'],'type':_0x25fc7c[_0xb5fa('0x33')]['key']};});_0x3fd1fb['model']=_['map'](_0x319c48,_0xb5fa('0x2d'));_0x3fd1fb['query']=_[_0xb5fa('0x34')](_0xed02e['query']);_0x3fd1fb['filters']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],_0x3fd1fb['query']);_0x5a0152['attributes']=_[_0xb5fa('0x35')](_0x3fd1fb[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0xed02e['query'][_0xb5fa('0x37')]));_0x5a0152[_0xb5fa('0x38')]=_0x5a0152['attributes'][_0xb5fa('0x39')]?_0x5a0152[_0xb5fa('0x38')]:_0x3fd1fb[_0xb5fa('0x36')];if(!_0xed02e['query'][_0xb5fa('0x3a')](_0xb5fa('0x3b'))){_0x5a0152[_0xb5fa('0x1d')]=qs['limit'](_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x1d')]);_0x5a0152[_0xb5fa('0x20')]=qs[_0xb5fa('0x20')](_0xed02e['query']['offset']);}_0x5a0152['order']=qs['sort'](_0xed02e['query']['sort']);_0x5a0152[_0xb5fa('0x3d')]=qs['filters'](_[_0xb5fa('0x3e')](_0xed02e[_0xb5fa('0x3c')],_0x3fd1fb[_0xb5fa('0x3f')]),_0x319c48);if(_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]){_0x5a0152[_0xb5fa('0x3d')]=_['merge'](_0x5a0152['where'],{'$or':_['map'](_0x319c48,function(_0x534b38){if(_0x534b38['type']!==_0xb5fa('0x41')){var _0x5addd5={};_0x5addd5[_0x534b38['name']]={'$like':'%'+_0xed02e[_0xb5fa('0x3c')][_0xb5fa('0x40')]+'%'};return _0x5addd5;}})});}_0x5a0152=_[_0xb5fa('0x42')]({},_0x5a0152,_0xed02e[_0xb5fa('0x43')]);var _0x5bc93f={'where':_0x5a0152[_0xb5fa('0x3d')]};return db[_0xb5fa('0x31')][_0xb5fa('0x1f')](_0x5bc93f)[_0xb5fa('0x25')](function(_0x402a68){_0x21fc7e['count']=_0x402a68;if(_0xed02e[_0xb5fa('0x3c')]['includeAll']){_0x5a0152[_0xb5fa('0x44')]=[{'all':!![]}];}return db[_0xb5fa('0x31')][_0xb5fa('0x45')](_0x5a0152);})[_0xb5fa('0x25')](function(_0x1c706b){_0x21fc7e[_0xb5fa('0x46')]=_0x1c706b;return _0x21fc7e;})[_0xb5fa('0x25')](respondWithFilteredResult(_0x116773,_0x5a0152))[_0xb5fa('0x47')](handleError(_0x116773,null));};exports['show']=function(_0x1c3c2c,_0xc03e44){var _0x59ae64={'raw':!![],'where':{'id':_0x1c3c2c['params']['id']}},_0x293c19={};_0x293c19[_0xb5fa('0x36')]=_[_0xb5fa('0x34')](db['AnalyticDefaultReport']['rawAttributes']);_0x293c19[_0xb5fa('0x3c')]=_[_0xb5fa('0x34')](_0x1c3c2c[_0xb5fa('0x3c')]);_0x293c19[_0xb5fa('0x3f')]=_[_0xb5fa('0x35')](_0x293c19[_0xb5fa('0x36')],_0x293c19[_0xb5fa('0x3c')]);_0x59ae64[_0xb5fa('0x38')]=_['intersection'](_0x293c19[_0xb5fa('0x36')],qs[_0xb5fa('0x37')](_0x1c3c2c['query'][_0xb5fa('0x37')]));_0x59ae64[_0xb5fa('0x38')]=_0x59ae64[_0xb5fa('0x38')][_0xb5fa('0x39')]?_0x59ae64[_0xb5fa('0x38')]:_0x293c19[_0xb5fa('0x36')];if(_0x1c3c2c[_0xb5fa('0x3c')][_0xb5fa('0x48')]){_0x59ae64[_0xb5fa('0x44')]=[{'all':!![]}];}_0x59ae64=_[_0xb5fa('0x42')]({},_0x59ae64,_0x1c3c2c[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x59ae64)[_0xb5fa('0x25')](handleEntityNotFound(_0xc03e44,null))[_0xb5fa('0x25')](respondWithResult(_0xc03e44,null))[_0xb5fa('0x47')](handleError(_0xc03e44,null));};exports['create']=function(_0x56dceb,_0x46194d){return db['AnalyticDefaultReport'][_0xb5fa('0x4a')](_0x56dceb[_0xb5fa('0x4b')],{})['then'](function(_0x4ef1d0){var _0x2931a7=_0x56dceb[_0xb5fa('0x4c')][_0xb5fa('0x27')]({'plain':!![]});if(!_0x2931a7)throw new Error(_0xb5fa('0x4d'));if(_0x2931a7[_0xb5fa('0x4e')]==='user'){var _0x27a651=_0x4ef1d0['get']({'plain':!![]});var _0x251d36=_0xb5fa('0x4f');return db[_0xb5fa('0x50')]['find']({'where':{'name':_0x251d36,'userProfileId':_0x2931a7[_0xb5fa('0x51')]},'raw':!![]})[_0xb5fa('0x25')](function(_0x4dea87){if(_0x4dea87&&_0x4dea87['autoAssociation']===0x0){return db[_0xb5fa('0x29')][_0xb5fa('0x4a')]({'name':_0x27a651[_0xb5fa('0x2d')],'resourceId':_0x27a651['id'],'type':_0xb5fa('0x28'),'sectionId':_0x4dea87['id']},{})[_0xb5fa('0x25')](function(){return _0x4ef1d0;});}else{return _0x4ef1d0;}})[_0xb5fa('0x47')](function(_0x31c91f){logger[_0xb5fa('0x2b')](_0xb5fa('0x52'),_0x31c91f);throw _0x31c91f;});}return _0x4ef1d0;})[_0xb5fa('0x25')](respondWithResult(_0x46194d,0xc9))[_0xb5fa('0x47')](handleError(_0x46194d,null));};exports[_0xb5fa('0x24')]=function(_0x3ccfd1,_0x2799e7){if(_0x3ccfd1[_0xb5fa('0x4b')]['id']){delete _0x3ccfd1[_0xb5fa('0x4b')]['id'];}return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x3ccfd1['params']['id']}})[_0xb5fa('0x25')](handleEntityNotFound(_0x2799e7,null))[_0xb5fa('0x25')](saveUpdates(_0x3ccfd1[_0xb5fa('0x4b')],null))[_0xb5fa('0x25')](respondWithResult(_0x2799e7,null))[_0xb5fa('0x47')](handleError(_0x2799e7,null));};exports[_0xb5fa('0x26')]=function(_0x4224cf,_0x24117e){return db[_0xb5fa('0x31')][_0xb5fa('0x49')]({'where':{'id':_0x4224cf['params']['id']}})['then'](handleEntityNotFound(_0x24117e,null))[_0xb5fa('0x25')](removeEntity(_0x24117e,null))[_0xb5fa('0x47')](handleError(_0x24117e,null));};exports[_0xb5fa('0x53')]=function(_0x5caf84,_0x441c41){var _0x367f7a=0xa;var _0x1572fb=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x4f82f0={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x2b9a45={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0x1c24e3=function(_0xfb88cc){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0xfb88cc);};var _0x41cce9=function(_0x23fb01){if(!_0x23fb01||!_0x23fb01[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x421a93='(',_0x36fc0f=0x0;_0x36fc0f<_0x23fb01['rules'][_0xb5fa('0x39')];_0x36fc0f+=0x1){_0x36fc0f>0x0&&(_0x421a93+='\x20'+_0x23fb01[_0xb5fa('0x6a')]+'\x20');_0x421a93+=_0x23fb01[_0xb5fa('0x69')][_0x36fc0f]['group']?_0x41cce9(_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6b')]):_0x23fb01['rules'][_0x36fc0f][_0xb5fa('0x6c')]+'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6d')]+(_0x1c24e3(_0x23fb01['rules'][_0x36fc0f]['condition'])?'\x20'+_0x23fb01[_0xb5fa('0x69')][_0x36fc0f][_0xb5fa('0x6e')]:'');}return _0x421a93+')';};var _0x432f04={'where':{'id':_0x5caf84['params']['id']}},_0x57d8b7,_0x597206,_0x30d53b,_0x199555,_0x12b0a2;_0x432f04=_['merge']({},_0x432f04,_0x5caf84['options']);return db[_0xb5fa('0x31')][_0xb5fa('0x49')](_0x432f04)[_0xb5fa('0x25')](function(_0x4ce1bd){if(_0x4ce1bd){_0x57d8b7=_0x4ce1bd;return _0x4ce1bd[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x13ef3a){if(_0x13ef3a){if(!_0x13ef3a[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x597206=_0x13ef3a;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x3a1db9){if(_0x3a1db9){_0x30d53b=_[_0xb5fa('0x74')](_0x3a1db9,'id');var _0xecdff3;var _0x38faa6=squel[_0xb5fa('0x75')]();_0x38faa6['from'](_0x57d8b7[_0xb5fa('0x76')]);for(var _0x5a6f74=0x0;_0x5a6f74<_0x597206[_0xb5fa('0x39')];_0x5a6f74+=0x1){_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x77')]?_0x30d53b[_0x597206[_0x5a6f74][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x597206[_0x5a6f74][_0xb5fa('0x6c')];_0xecdff3=_0x597206[_0x5a6f74]['function']?_[_0xb5fa('0x79')](_0x4f82f0[_0x597206[_0x5a6f74]['function']],'%s',_0xecdff3):_0xecdff3;_0xecdff3=_0x597206[_0x5a6f74][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x2b9a45[_0x597206[_0x5a6f74][_0xb5fa('0x7a')]],'%s',_0xecdff3):_0xecdff3;if(_0x597206[_0x5a6f74][_0xb5fa('0x7b')]){_0x38faa6['group'](_0xecdff3);}_0x597206[_0x5a6f74]['orderBy']&&_0x38faa6['order'](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x38faa6[_0xb5fa('0x6c')](_0xecdff3,_0x597206[_0x5a6f74][_0xb5fa('0x7e')]||_0xecdff3);}if(_0x57d8b7[_0xb5fa('0x7f')]){_0x57d8b7[_0xb5fa('0x7f')]=JSON['parse'](_0x57d8b7[_0xb5fa('0x7f')]);for(var _0x5c08e1=0x0;_0x5c08e1<_0x57d8b7['joins'][_0xb5fa('0x39')];_0x5c08e1+=0x1){if(_0x57d8b7['joins'][_0x5c08e1]['type']&&_['includes'](_0x1572fb,_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type'])&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')]&&_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['foreignTable']&&_0x57d8b7['joins'][_0x5c08e1][_0xb5fa('0x81')]){_0x38faa6[_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1]['type']](_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x57d8b7['table'],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x80')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x82')],_0x57d8b7[_0xb5fa('0x7f')][_0x5c08e1][_0xb5fa('0x81')]));}}}if(_0x57d8b7[_0xb5fa('0x84')]){_0x57d8b7['conditions']=JSON[_0xb5fa('0x85')](_0x57d8b7['conditions']);_0x38faa6[_0xb5fa('0x3d')](_0x41cce9(_0x57d8b7[_0xb5fa('0x84')]['group']));}_0x12b0a2=_0x38faa6[_0xb5fa('0x86')]();_0x38faa6[_0xb5fa('0x1d')](_0x367f7a);_0x38faa6[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x38faa6[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x38faa6['toString'](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](respondWithResult(_0x441c41,null))['catch'](handleError(_0x441c41,null));};function runReport(_0x593386,_0x47d72b,_0x5557a3){var _0x1c60bd=_0x47d72b[_0xb5fa('0x2d')];var _0xff504d=0xa;var _0x188e66=['join','left_join',_0xb5fa('0x56'),'cross_join'];var _0x32eebd={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':'MAX(%s)','MIN':_0xb5fa('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5e6852={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':_0xb5fa('0x60'),'HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':_0xb5fa('0x63')};var _0xa7fd3b=function(_0x42e210){return!_[_0xb5fa('0x64')]([_0xb5fa('0x65'),_0xb5fa('0x66'),_0xb5fa('0x67'),_0xb5fa('0x68')],_0x42e210);};var _0x86dfe9=function(_0x53c7b5){if(!_0x53c7b5||!_0x53c7b5['rules'][_0xb5fa('0x39')]){return'';}for(var _0x52384b='(',_0x1cb113=0x0;_0x1cb113<_0x53c7b5[_0xb5fa('0x69')]['length'];_0x1cb113+=0x1){_0x1cb113>0x0&&(_0x52384b+='\x20'+_0x53c7b5[_0xb5fa('0x6a')]+'\x20');_0x52384b+=_0x53c7b5[_0xb5fa('0x69')][_0x1cb113]['group']?_0x86dfe9(_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6b')]):_0x53c7b5['rules'][_0x1cb113][_0xb5fa('0x6c')]+'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6d')]+(_0xa7fd3b(_0x53c7b5['rules'][_0x1cb113]['condition'])?'\x20'+_0x53c7b5[_0xb5fa('0x69')][_0x1cb113][_0xb5fa('0x6e')]:'');}return _0x52384b+')';};var _0x3b5e1d={'where':{'id':_0x593386['id']}},_0x3d18a9,_0x397830,_0x234d9d,_0x10222c,_0x1eec65;_0x3b5e1d=_[_0xb5fa('0x42')]({},_0x3b5e1d,_0x5557a3);return db[_0xb5fa('0x31')]['find'](_0x3b5e1d)['then'](function(_0x3c5563){if(_0x3c5563){_0x3d18a9=_0x3c5563;return _0x3c5563[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x18498d){if(_0x18498d){if(!_0x18498d['length']){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x397830=_0x18498d;return db['AnalyticMetric'][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x109dd9){if(_0x109dd9){_0x234d9d=_[_0xb5fa('0x74')](_0x109dd9,'id');var _0x5ba2e7;var _0x1175da=squel[_0xb5fa('0x75')]();_0x1175da[_0xb5fa('0x8e')](_0x3d18a9[_0xb5fa('0x76')]);for(var _0x19717a=0x0;_0x19717a<_0x397830[_0xb5fa('0x39')];_0x19717a+=0x1){_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x77')]?_0x234d9d[_0x397830[_0x19717a][_0xb5fa('0x77')]][_0xb5fa('0x78')]:_0x397830[_0x19717a][_0xb5fa('0x6c')];_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x32eebd[_0x397830[_0x19717a][_0xb5fa('0x8f')]],'%s',_0x5ba2e7):_0x5ba2e7;_0x5ba2e7=_0x397830[_0x19717a][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x5e6852[_0x397830[_0x19717a]['format']],'%s',_0x5ba2e7):_0x5ba2e7;if(_0x397830[_0x19717a][_0xb5fa('0x7b')]){_0x1175da[_0xb5fa('0x6b')](_0x5ba2e7);}_0x397830[_0x19717a][_0xb5fa('0x7c')]&&_0x1175da[_0xb5fa('0x90')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7c')]===_0xb5fa('0x7d')?![]:!![]);_0x1175da[_0xb5fa('0x6c')](_0x5ba2e7,_0x397830[_0x19717a][_0xb5fa('0x7e')]||_0x5ba2e7);}if(_0x3d18a9['joins']){_0x3d18a9['joins']=JSON[_0xb5fa('0x85')](_0x3d18a9['joins']);for(var _0x5d0ca8=0x0;_0x5d0ca8<_0x3d18a9[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x5d0ca8+=0x1){if(_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['type']&&_[_0xb5fa('0x64')](_0x188e66,_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')])&&_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x80')]&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable']&&_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x81')]){_0x1175da[_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x33')]](_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')]('%s.%s\x20=\x20%s.%s',_0x3d18a9[_0xb5fa('0x76')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8][_0xb5fa('0x80')],_0x3d18a9[_0xb5fa('0x7f')][_0x5d0ca8]['foreignTable'],_0x3d18a9['joins'][_0x5d0ca8][_0xb5fa('0x81')]));}}}if(_0x3d18a9[_0xb5fa('0x84')]){_0x3d18a9[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3d18a9['conditions']);_0x1175da['where'](_0x86dfe9(_0x3d18a9['conditions']['group']));}_0x1eec65=_0x1175da[_0xb5fa('0x86')]();_0x1175da[_0xb5fa('0x1d')](_0xff504d);_0x1175da[_0xb5fa('0x20')](0x0);return;}})[_0xb5fa('0x25')](function(){if(_0x47d72b[_0xb5fa('0x91')]===_0xb5fa('0x92')){return null;}var _0x3c36a8=_[_0xb5fa('0x42')](_0x47d72b,{'name':_0x47d72b[_0xb5fa('0x93')]||_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9[_0xb5fa('0x2d')],'basename':_0x1c60bd,'savename':util['format'](_0xb5fa('0x94'),_0x47d72b[_0xb5fa('0x2d')]||_0x3d18a9['name'],require(_0xb5fa('0x95'))[_0xb5fa('0x96')](0x4),_0x47d72b['output']||_0xb5fa('0x97')),'reportId':_0x3d18a9['id'],'reportType':_0xb5fa('0x98')});return db[_0xb5fa('0x99')][_0xb5fa('0x4a')](_0x3c36a8,{'raw':!![]});})[_0xb5fa('0x25')](function(_0x2b449a){if(_0x3d18a9[_0xb5fa('0x76')]===_0xb5fa('0x9a')){_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9['table']+_0xb5fa('0x9b'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}else{_0x1eec65[_0xb5fa('0x3d')](_0x3d18a9[_0xb5fa('0x76')]+_0xb5fa('0x9e'),_0x47d72b[_0xb5fa('0x9c')],_0x47d72b[_0xb5fa('0x9d')]);}if(_0x2b449a){logger['info'](_0xb5fa('0x9f'),_0x1eec65['toString']());require(_0xb5fa('0xa0'))[_0xb5fa('0xa1')](path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa2'),_0x2b449a[_0xb5fa('0x91')]),[_0x2b449a['id'],_0x1eec65[_0xb5fa('0x89')](),path[_0xb5fa('0x54')](__dirname,_0xb5fa('0xa3'),_0x2b449a[_0xb5fa('0xa4')]),_0x1c60bd]);return _0x2b449a;}else{var _0x4bb9b4=squel['select']();_0x4bb9b4[_0xb5fa('0x8e')]('('+_0x1eec65[_0xb5fa('0x89')]()+')',_0xb5fa('0xa5'));_0x4bb9b4[_0xb5fa('0x6c')]('COUNT(*)',_0xb5fa('0x1f'));_0x1eec65['limit'](_0x47d72b[_0xb5fa('0x1d')]||_0xff504d);_0x1eec65[_0xb5fa('0x20')](_0x47d72b['offset']||0x0);return dbH[_0xb5fa('0x8a')]['query'](_0x4bb9b4[_0xb5fa('0x89')](),{'type':dbH['sequelize'][_0xb5fa('0x8b')][_0xb5fa('0x8c')]})[_0xb5fa('0x25')](function(_0x70e4ae){if(!_0x70e4ae[_0xb5fa('0x39')]){_0x10222c=0x0;}else{_0x10222c=_0x70e4ae[0x0][_0xb5fa('0x1f')]||0x0;}return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x1eec65[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')][_0xb5fa('0x8b')]['SELECT']});})[_0xb5fa('0x25')](function(_0x284b34){return{'rows':_0x284b34||[],'count':_0x10222c};});}});}exports[_0xb5fa('0xa6')]=function(_0x497931,_0x2145d8){return runReport(_0x497931[_0xb5fa('0xa7')],_0x497931[_0xb5fa('0x3c')],_0x497931[_0xb5fa('0x43')])[_0xb5fa('0x25')](respondWithResult(_0x2145d8,null))[_0xb5fa('0x47')](handleError(_0x2145d8,null));};exports[_0xb5fa('0xa8')]=runReport;exports[_0xb5fa('0x3c')]=function(_0x59fd75,_0x245ee1){var _0x5c1e1f=0xa;var _0x3ba723=[_0xb5fa('0x54'),_0xb5fa('0x55'),_0xb5fa('0x56'),_0xb5fa('0x57')];var _0x105c0f={'SUM':_0xb5fa('0x58'),'COUNT':_0xb5fa('0x59'),'COUNT DISTINCT':_0xb5fa('0x8d'),'MAX':_0xb5fa('0x5a'),'MIN':_0xb5fa('0x5b'),'AVG':_0xb5fa('0xa9'),'GROUP_CONCAT':_0xb5fa('0x5c'),'GROUP_CONCAT ASC':_0xb5fa('0x5d'),'GROUP_CONCAT DESC':_0xb5fa('0x5e')};var _0x41e086={'SEC_TO_TIME':_0xb5fa('0x5f'),'DATE':'DATE(%s)','HOUR':_0xb5fa('0x61'),'ROUND':_0xb5fa('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd34c31=function(_0x2e614e){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xb5fa('0x67'),_0xb5fa('0x68')],_0x2e614e);};var _0x1aae82=function(_0x474bb){if(!_0x474bb||!_0x474bb[_0xb5fa('0x69')][_0xb5fa('0x39')]){return'';}for(var _0x17ae50='(',_0x51c9ba=0x0;_0x51c9ba<_0x474bb['rules']['length'];_0x51c9ba+=0x1){_0x51c9ba>0x0&&(_0x17ae50+='\x20'+_0x474bb[_0xb5fa('0x6a')]+'\x20');_0x17ae50+=_0x474bb['rules'][_0x51c9ba]['group']?_0x1aae82(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['group']):_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6c')]+'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6d')]+(_0xd34c31(_0x474bb[_0xb5fa('0x69')][_0x51c9ba]['condition'])?'\x20'+_0x474bb[_0xb5fa('0x69')][_0x51c9ba][_0xb5fa('0x6e')]:'');}return _0x17ae50+')';};var _0x2fe715={'where':{'id':_0x59fd75[_0xb5fa('0xa7')]['id']}},_0x3c5ac4,_0x23b70f,_0x488818,_0x15b228,_0x42fd84;_0x2fe715=_[_0xb5fa('0x42')]({},_0x2fe715,_0x59fd75[_0xb5fa('0x43')]);return db[_0xb5fa('0x31')]['find'](_0x2fe715)[_0xb5fa('0x25')](function(_0x390043){if(_0x390043){_0x3c5ac4=_0x390043;return _0x390043[_0xb5fa('0x6f')]();}return null;})[_0xb5fa('0x25')](function(_0x32c191){if(_0x32c191){if(!_0x32c191[_0xb5fa('0x39')]){throw new db[(_0xb5fa('0x70'))][(_0xb5fa('0x71'))](_0xb5fa('0x72'),0x193);}_0x23b70f=_0x32c191;return db[_0xb5fa('0x73')][_0xb5fa('0x45')]({'raw':!![]});}return null;})[_0xb5fa('0x25')](function(_0x1d307c){if(_0x1d307c){_0x488818=_[_0xb5fa('0x74')](_0x1d307c,'id');var _0x3347eb;var _0x349e0b=squel[_0xb5fa('0x75')]();_0x349e0b[_0xb5fa('0x8e')](_0x3c5ac4[_0xb5fa('0x76')]);for(var _0x2b1c3f=0x0;_0x2b1c3f<_0x23b70f[_0xb5fa('0x39')];_0x2b1c3f+=0x1){_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x77')]?_0x488818[_0x23b70f[_0x2b1c3f]['MetricId']]['metric']:_0x23b70f[_0x2b1c3f][_0xb5fa('0x6c')];_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]?_[_0xb5fa('0x79')](_0x105c0f[_0x23b70f[_0x2b1c3f][_0xb5fa('0x8f')]],'%s',_0x3347eb):_0x3347eb;_0x3347eb=_0x23b70f[_0x2b1c3f][_0xb5fa('0x7a')]?_[_0xb5fa('0x79')](_0x41e086[_0x23b70f[_0x2b1c3f]['format']],'%s',_0x3347eb):_0x3347eb;if(_0x23b70f[_0x2b1c3f]['groupBy']){_0x349e0b['group'](_0x3347eb);}_0x23b70f[_0x2b1c3f][_0xb5fa('0x7c')]&&_0x349e0b[_0xb5fa('0x90')](_0x3347eb,_0x23b70f[_0x2b1c3f]['orderBy']===_0xb5fa('0x7d')?![]:!![]);_0x349e0b[_0xb5fa('0x6c')](_0x3347eb,_0x23b70f[_0x2b1c3f]['alias']||_0x3347eb);}if(_0x3c5ac4[_0xb5fa('0x7f')]){_0x3c5ac4[_0xb5fa('0x7f')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x7f')]);for(var _0x10dbdf=0x0;_0x10dbdf<_0x3c5ac4[_0xb5fa('0x7f')][_0xb5fa('0x39')];_0x10dbdf+=0x1){if(_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['type']&&_[_0xb5fa('0x64')](_0x3ba723,_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x33')])&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')]&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable']&&_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x81')]){_0x349e0b[_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x33')]](_0x3c5ac4['joins'][_0x10dbdf][_0xb5fa('0x82')],null,util[_0xb5fa('0x7a')](_0xb5fa('0x83'),_0x3c5ac4[_0xb5fa('0x76')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf][_0xb5fa('0x80')],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignTable'],_0x3c5ac4[_0xb5fa('0x7f')][_0x10dbdf]['foreignKey']));}}}if(_0x3c5ac4[_0xb5fa('0x84')]){_0x3c5ac4[_0xb5fa('0x84')]=JSON[_0xb5fa('0x85')](_0x3c5ac4[_0xb5fa('0x84')]);_0x349e0b[_0xb5fa('0x3d')](_0x1aae82(_0x3c5ac4[_0xb5fa('0x84')][_0xb5fa('0x6b')]));}_0x42fd84=_0x349e0b['clone']();_0x349e0b['limit'](_0x5c1e1f);_0x349e0b[_0xb5fa('0x20')](0x0);logger[_0xb5fa('0x87')](_0xb5fa('0x88'),_0x349e0b[_0xb5fa('0x89')]());return dbH[_0xb5fa('0x8a')][_0xb5fa('0x3c')](_0x349e0b[_0xb5fa('0x89')](),{'type':dbH[_0xb5fa('0x8a')]['QueryTypes'][_0xb5fa('0x8c')]});}})[_0xb5fa('0x25')](function(){return{'sql':_0x42fd84[_0xb5fa('0x89')]()};})[_0xb5fa('0x25')](respondWithResult(_0x245ee1,null))[_0xb5fa('0x47')](handleError(_0x245ee1,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 5853dd1..a2b486e 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 _0x3dc1=['../../config/logger','api','bluebird','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0xf86904,_0x229152){var _0x589de0=function(_0x1656d9){while(--_0x1656d9){_0xf86904['push'](_0xf86904['shift']());}};_0x589de0(++_0x229152);}(_0x3dc1,0xa4));var _0x13dc=function(_0x98bcc,_0x269ed3){_0x98bcc=_0x98bcc-0x0;var _0x2c32bd=_0x3dc1[_0x98bcc];return _0x2c32bd;};'use strict';var _=require('lodash');var util=require(_0x13dc('0x0'));var logger=require(_0x13dc('0x1'))(_0x13dc('0x2'));var moment=require('moment');var BPromise=require(_0x13dc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13dc('0x4'));var rimraf=require(_0x13dc('0x5'));var config=require('../../config/environment');var attributes=require(_0x13dc('0x6'));module[_0x13dc('0x7')]=function(_0x1d0714,_0x170e2f){return _0x1d0714[_0x13dc('0x8')](_0x13dc('0x9'),attributes,{'tableName':_0x13dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe32b=['../../config/logger','api','bluebird','request-promise','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x3731f1,_0x1233ed){var _0x3db01c=function(_0x232ad4){while(--_0x232ad4){_0x3731f1['push'](_0x3731f1['shift']());}};_0x3db01c(++_0x1233ed);}(_0xe32b,0x97));var _0xbe32=function(_0x3f72e4,_0x2fe021){_0x3f72e4=_0x3f72e4-0x0;var _0x199d0c=_0xe32b[_0x3f72e4];return _0x199d0c;};'use strict';var _=require(_0xbe32('0x0'));var util=require(_0xbe32('0x1'));var logger=require(_0xbe32('0x2'))(_0xbe32('0x3'));var moment=require('moment');var BPromise=require(_0xbe32('0x4'));var rp=require(_0xbe32('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe32('0x6'));module['exports']=function(_0x320f24,_0x5476d5){return _0x320f24['define'](_0xbe32('0x7'),attributes,{'tableName':_0xbe32('0x8'),'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 529888f..e9e88dd 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 _0x39ee=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x3f39e5,_0x2bb924){var _0x65dc38=function(_0x1447d4){while(--_0x1447d4){_0x3f39e5['push'](_0x3f39e5['shift']());}};_0x65dc38(++_0x2bb924);}(_0x39ee,0x15d));var _0xe39e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39ee[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe39e('0x0'));var util=require(_0xe39e('0x1'));var moment=require(_0xe39e('0x2'));var BPromise=require(_0xe39e('0x3'));var rs=require(_0xe39e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe39e('0x5'))['db'];var utils=require(_0xe39e('0x6'));var logger=require('../../config/logger')(_0xe39e('0x7'));var config=require(_0xe39e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe39e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb2964c,_0x3e549f,_0x4bdc6c){return new BPromise(function(_0x5abce7,_0x2ec224){return client[_0xe39e('0xa')](_0xb2964c,_0x4bdc6c)[_0xe39e('0xb')](function(_0x58cb80){logger[_0xe39e('0xc')](_0xe39e('0xd'),_0x3e549f,_0xe39e('0xe'));logger['debug'](_0xe39e('0xf'),_0x3e549f,_0xe39e('0xe'),JSON[_0xe39e('0x10')](_0x58cb80));if(_0x58cb80[_0xe39e('0x11')]){if(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x12')]===0x1f4){logger['error'](_0xe39e('0xd'),_0x3e549f,_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);return _0x2ec224(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);}logger[_0xe39e('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e549f,_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);return _0x5abce7(_0x58cb80[_0xe39e('0x11')][_0xe39e('0x13')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3e549f,_0xe39e('0xe'));_0x5abce7(_0x58cb80[_0xe39e('0x14')]['message']);}})[_0xe39e('0x15')](function(_0xff199c){logger[_0xe39e('0x11')](_0xe39e('0xd'),_0x3e549f,_0xff199c);_0x2ec224(_0xff199c);});});} \ No newline at end of file +var _0x8d56=['error','code','message','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x32935c,_0x3c8e5b){var _0x121281=function(_0x51989f){while(--_0x51989f){_0x32935c['push'](_0x32935c['shift']());}};_0x121281(++_0x3c8e5b);}(_0x8d56,0x68));var _0x68d5=function(_0x48999d,_0x1e02cb){_0x48999d=_0x48999d-0x0;var _0x1ad0d1=_0x8d56[_0x48999d];return _0x1ad0d1;};'use strict';var _=require(_0x68d5('0x0'));var util=require(_0x68d5('0x1'));var moment=require(_0x68d5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x68d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x68d5('0x4'));var logger=require('../../config/logger')(_0x68d5('0x5'));var config=require(_0x68d5('0x6'));var jayson=require(_0x68d5('0x7'));var client=jayson[_0x68d5('0x8')][_0x68d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x445a59,_0x317c3e,_0x46da9d){return new BPromise(function(_0x9077c8,_0x1e2901){return client[_0x68d5('0xa')](_0x445a59,_0x46da9d)['then'](function(_0x492c20){logger[_0x68d5('0xb')](_0x68d5('0xc'),_0x317c3e,_0x68d5('0xd'));logger[_0x68d5('0xe')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x317c3e,_0x68d5('0xd'),JSON[_0x68d5('0xf')](_0x492c20));if(_0x492c20[_0x68d5('0x10')]){if(_0x492c20[_0x68d5('0x10')][_0x68d5('0x11')]===0x1f4){logger[_0x68d5('0x10')](_0x68d5('0xc'),_0x317c3e,_0x492c20[_0x68d5('0x10')]['message']);return _0x1e2901(_0x492c20[_0x68d5('0x10')][_0x68d5('0x12')]);}logger[_0x68d5('0x10')](_0x68d5('0xc'),_0x317c3e,_0x492c20[_0x68d5('0x10')][_0x68d5('0x12')]);return _0x9077c8(_0x492c20[_0x68d5('0x10')][_0x68d5('0x12')]);}else{logger[_0x68d5('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x317c3e,'request\x20sent');_0x9077c8(_0x492c20[_0x68d5('0x13')][_0x68d5('0x12')]);}})['catch'](function(_0x3d65a4){logger[_0x68d5('0x10')](_0x68d5('0xc'),_0x317c3e,_0x3d65a4);_0x1e2901(_0x3d65a4);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 3bdc654..2c0981d 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 _0x3d4b=['isAuthenticated','index','/:id','show','preview','/:id/run','/:id/query','query','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get'];(function(_0x54d7dc,_0x31b183){var _0xf4ef3b=function(_0x20a740){while(--_0x20a740){_0x54d7dc['push'](_0x54d7dc['shift']());}};_0xf4ef3b(++_0x31b183);}(_0x3d4b,0xf3));var _0xb3d4=function(_0x10e2e6,_0x17f93d){_0x10e2e6=_0x10e2e6-0x0;var _0x4931c6=_0x3d4b[_0x10e2e6];return _0x4931c6;};'use strict';var multer=require(_0xb3d4('0x0'));var util=require(_0xb3d4('0x1'));var path=require('path');var timeout=require(_0xb3d4('0x2'));var express=require(_0xb3d4('0x3'));var router=express[_0xb3d4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb3d4('0x5'));var interaction=require(_0xb3d4('0x6'));var config=require(_0xb3d4('0x7'));var controller=require(_0xb3d4('0x8'));router[_0xb3d4('0x9')]('/',auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xb')]);router[_0xb3d4('0x9')](_0xb3d4('0xc'),auth[_0xb3d4('0xa')](),controller[_0xb3d4('0xd')]);router[_0xb3d4('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xb3d4('0xe')]);router[_0xb3d4('0x9')](_0xb3d4('0xf'),auth[_0xb3d4('0xa')](),controller['run']);router[_0xb3d4('0x9')](_0xb3d4('0x10'),auth[_0xb3d4('0xa')](),controller[_0xb3d4('0x11')]);router[_0xb3d4('0x12')]('/',auth[_0xb3d4('0xa')](),controller[_0xb3d4('0x13')]);router[_0xb3d4('0x14')](_0xb3d4('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb3d4('0x15')](_0xb3d4('0xc'),auth[_0xb3d4('0xa')](),controller['destroy']);module[_0xb3d4('0x16')]=router; \ No newline at end of file +var _0x6f16=['../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x443dcc,_0x3fe520){var _0x27b4f3=function(_0x30f3dd){while(--_0x30f3dd){_0x443dcc['push'](_0x443dcc['shift']());}};_0x27b4f3(++_0x3fe520);}(_0x6f16,0x151));var _0x66f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f16[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x66f1('0x0'));var util=require(_0x66f1('0x1'));var path=require(_0x66f1('0x2'));var timeout=require(_0x66f1('0x3'));var express=require(_0x66f1('0x4'));var router=express[_0x66f1('0x5')]();var fs_extra=require(_0x66f1('0x6'));var auth=require(_0x66f1('0x7'));var interaction=require(_0x66f1('0x8'));var config=require('../../config/environment');var controller=require(_0x66f1('0x9'));router[_0x66f1('0xa')]('/',auth[_0x66f1('0xb')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x66f1('0xc')]);router[_0x66f1('0xa')](_0x66f1('0xd'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x66f1('0xe'),auth[_0x66f1('0xb')](),controller[_0x66f1('0xf')]);router[_0x66f1('0xa')](_0x66f1('0x10'),auth[_0x66f1('0xb')](),controller[_0x66f1('0x11')]);router[_0x66f1('0x12')]('/',auth[_0x66f1('0xb')](),controller[_0x66f1('0x13')]);router[_0x66f1('0x14')](_0x66f1('0x15'),auth[_0x66f1('0xb')](),controller['update']);router['delete'](_0x66f1('0x15'),auth[_0x66f1('0xb')](),controller['destroy']);module[_0x66f1('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e9739d8..34e31b8 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 _0xa5d8=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','scheduled'];(function(_0x515283,_0x813dea){var _0x38f836=function(_0x40c8f4){while(--_0x40c8f4){_0x515283['push'](_0x515283['shift']());}};_0x38f836(++_0x813dea);}(_0xa5d8,0x1af));var _0x8a5d=function(_0x46c80e,_0x204394){_0x46c80e=_0x46c80e-0x0;var _0x36be59=_0xa5d8[_0x46c80e];return _0x36be59;};'use strict';var Sequelize=require(_0x8a5d('0x0'));var moment=require(_0x8a5d('0x1'));module[_0x8a5d('0x2')]={'name':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8a5d('0x4')](_0x8a5d('0x5'),_0x8a5d('0x6'),_0x8a5d('0x7')),'allowNull':![],'defaultValue':_0x8a5d('0x5')},'savename':{'type':Sequelize[_0x8a5d('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8a5d('0x8')]},'endDate':{'type':Sequelize[_0x8a5d('0x8')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x8a5d('0x9')},'type':{'type':Sequelize[_0x8a5d('0x4')]('manual',_0x8a5d('0xa')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x8a5d('0xb')](0xb)[_0x8a5d('0xc')]},'reportType':{'type':Sequelize[_0x8a5d('0x3')]}}; \ No newline at end of file +var _0xf61d=['xlsx','DATE','Loading','manual','scheduled','UNSIGNED','sequelize','STRING','ENUM','csv'];(function(_0x1e2fb4,_0x3fb567){var _0x150974=function(_0x3656bb){while(--_0x3656bb){_0x1e2fb4['push'](_0x1e2fb4['shift']());}};_0x150974(++_0x3fb567);}(_0xf61d,0x146));var _0xdf61=function(_0xd3348b,_0x288d47){_0xd3348b=_0xd3348b-0x0;var _0x583cdc=_0xf61d[_0xd3348b];return _0x583cdc;};'use strict';var Sequelize=require(_0xdf61('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0xdf61('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xdf61('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0xdf61('0x2')](_0xdf61('0x3'),'pdf',_0xdf61('0x4')),'allowNull':![],'defaultValue':_0xdf61('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xdf61('0x5')]},'endDate':{'type':Sequelize[_0xdf61('0x5')]},'status':{'type':Sequelize[_0xdf61('0x1')],'defaultValue':_0xdf61('0x6')},'type':{'type':Sequelize[_0xdf61('0x2')](_0xdf61('0x7'),_0xdf61('0x8')),'allowNull':![],'defaultValue':_0xdf61('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xdf61('0x9')]},'reportType':{'type':Sequelize[_0xdf61('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8459b8b..47b2f83 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 _0xab41=['Report\x20not\x20found\x20or\x20empty','exists','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','then','get','ExtractedReports','UserProfileResource','destroy','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError'];(function(_0x48a5ac,_0x1a9d81){var _0x1f0644=function(_0x26b220){while(--_0x26b220){_0x48a5ac['push'](_0x48a5ac['shift']());}};_0x1f0644(++_0x1a9d81);}(_0xab41,0x1df));var _0x1ab4=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xab41[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0x1ab4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1ab4('0x1'));var jsonpatch=require(_0x1ab4('0x2'));var rp=require('request-promise');var moment=require(_0x1ab4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1ab4('0x4'));var util=require(_0x1ab4('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1ab4('0x6'));var ejs=require(_0x1ab4('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1ab4('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1ab4('0x9'));var deskjs=require(_0x1ab4('0xa'));var toCsv=require(_0x1ab4('0x6'));var querystring=require(_0x1ab4('0xb'));var Papa=require(_0x1ab4('0xc'));var Redis=require(_0x1ab4('0xd'));var authService=require(_0x1ab4('0xe'));var qs=require(_0x1ab4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ab4('0x10'));var logger=require(_0x1ab4('0x11'))(_0x1ab4('0x12'));var utils=require(_0x1ab4('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1ab4('0x14'));var db=require(_0x1ab4('0x15'))['db'];function respondWithStatusCode(_0x3b100e,_0x47dc5e){_0x47dc5e=_0x47dc5e||0xcc;return function(_0x453a43){if(_0x453a43){return _0x3b100e[_0x1ab4('0x16')](_0x47dc5e);}return _0x3b100e['status'](_0x47dc5e)[_0x1ab4('0x17')]();};}function respondWithResult(_0x12933b,_0x3af44c){_0x3af44c=_0x3af44c||0xc8;return function(_0x512aa6){if(_0x512aa6){return _0x12933b[_0x1ab4('0x18')](_0x3af44c)['json'](_0x512aa6);}};}function respondWithFilteredResult(_0x52fbae,_0x327966){return function(_0x241670){if(_0x241670){var _0x316f55=typeof _0x327966['offset']===_0x1ab4('0x19')&&typeof _0x327966[_0x1ab4('0x1a')]===_0x1ab4('0x19');var _0x2eabeb=_0x241670[_0x1ab4('0x1b')];var _0x598efb=_0x316f55?0x0:_0x327966[_0x1ab4('0x1c')];var _0x484ae1=_0x316f55?_0x241670[_0x1ab4('0x1b')]:_0x327966[_0x1ab4('0x1c')]+_0x327966[_0x1ab4('0x1a')];var _0x23e597;if(_0x484ae1>=_0x2eabeb){_0x484ae1=_0x2eabeb;_0x23e597=0xc8;}else{_0x23e597=0xce;}_0x52fbae[_0x1ab4('0x18')](_0x23e597);return _0x52fbae[_0x1ab4('0x1d')](_0x1ab4('0x1e'),_0x598efb+'-'+_0x484ae1+'/'+_0x2eabeb)[_0x1ab4('0x1f')](_0x241670);}return null;};}function patchUpdates(_0x341df7){return function(_0x4be880){try{jsonpatch[_0x1ab4('0x20')](_0x4be880,_0x341df7,!![]);}catch(_0x133ceb){return BPromise['reject'](_0x133ceb);}return _0x4be880['save']();};}function saveUpdates(_0xd23721,_0x11cfad){return function(_0x2be570){if(_0x2be570){return _0x2be570[_0x1ab4('0x21')](_0xd23721)[_0x1ab4('0x22')](function(_0x5d0f85){return _0x5d0f85;});}return null;};}function removeEntity(_0x4f9492,_0x1e13c4){return function(_0x2bc925){if(_0x2bc925){return _0x2bc925['destroy']()[_0x1ab4('0x22')](function(){var _0x39b76b=_0x2bc925[_0x1ab4('0x23')]({'plain':!![]});var _0x4b6252=_0x1ab4('0x24');return db[_0x1ab4('0x25')][_0x1ab4('0x26')]({'where':{'type':_0x4b6252,'resourceId':_0x39b76b['id']}})[_0x1ab4('0x22')](function(){return _0x2bc925;});})[_0x1ab4('0x22')](function(){_0x4f9492['status'](0xcc)[_0x1ab4('0x17')]();});}};}function handleEntityNotFound(_0x1669b7,_0x1d9b6b){return function(_0x3f947d){if(!_0x3f947d){_0x1669b7[_0x1ab4('0x16')](0x194);}return _0x3f947d;};}function handleError(_0x968e87,_0x2ce82e){_0x2ce82e=_0x2ce82e||0x1f4;return function(_0x1a8e7e){logger['error'](_0x1a8e7e['stack']);if(_0x1a8e7e[_0x1ab4('0x27')]){delete _0x1a8e7e[_0x1ab4('0x27')];}_0x968e87['status'](_0x2ce82e)[_0x1ab4('0x28')](_0x1a8e7e);};}exports[_0x1ab4('0x29')]=function(_0x312d33,_0x3ad687){var _0x4c589b={},_0x3f0394={},_0x53db4b={'count':0x0,'rows':[]};var _0x7299f1=_[_0x1ab4('0x2a')](db[_0x1ab4('0x2b')][_0x1ab4('0x2c')],function(_0x206957){return{'name':_0x206957[_0x1ab4('0x2d')],'type':_0x206957[_0x1ab4('0x2e')][_0x1ab4('0x2f')]};});_0x3f0394['model']=_[_0x1ab4('0x2a')](_0x7299f1,_0x1ab4('0x27'));_0x3f0394[_0x1ab4('0x30')]=_[_0x1ab4('0x31')](_0x312d33['query']);_0x3f0394['filters']=_[_0x1ab4('0x32')](_0x3f0394['model'],_0x3f0394['query']);_0x4c589b['attributes']=_[_0x1ab4('0x32')](_0x3f0394[_0x1ab4('0x33')],qs[_0x1ab4('0x34')](_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x34')]));_0x4c589b[_0x1ab4('0x35')]=_0x4c589b[_0x1ab4('0x35')][_0x1ab4('0x36')]?_0x4c589b[_0x1ab4('0x35')]:_0x3f0394['model'];if(!_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x37')](_0x1ab4('0x38'))){_0x4c589b[_0x1ab4('0x1a')]=qs[_0x1ab4('0x1a')](_0x312d33['query'][_0x1ab4('0x1a')]);_0x4c589b[_0x1ab4('0x1c')]=qs[_0x1ab4('0x1c')](_0x312d33['query'][_0x1ab4('0x1c')]);}_0x4c589b['order']=qs['sort'](_0x312d33[_0x1ab4('0x30')]['sort']);_0x4c589b[_0x1ab4('0x39')]=qs[_0x1ab4('0x3a')](_[_0x1ab4('0x3b')](_0x312d33['query'],_0x3f0394['filters']),_0x7299f1);if(_0x312d33['query'][_0x1ab4('0x3c')]){_0x4c589b[_0x1ab4('0x39')]=_[_0x1ab4('0x3d')](_0x4c589b[_0x1ab4('0x39')],{'$or':_[_0x1ab4('0x2a')](_0x7299f1,function(_0x3cbc71){if(_0x3cbc71[_0x1ab4('0x2e')]!==_0x1ab4('0x3e')){var _0x22d00f={};_0x22d00f[_0x3cbc71[_0x1ab4('0x27')]]={'$like':'%'+_0x312d33[_0x1ab4('0x30')][_0x1ab4('0x3c')]+'%'};return _0x22d00f;}})});}_0x4c589b=_[_0x1ab4('0x3d')]({},_0x4c589b,_0x312d33[_0x1ab4('0x3f')]);var _0x518f75={'where':_0x4c589b[_0x1ab4('0x39')]};return db[_0x1ab4('0x2b')][_0x1ab4('0x1b')](_0x518f75)[_0x1ab4('0x22')](function(_0x3f164a){_0x53db4b['count']=_0x3f164a;if(_0x312d33[_0x1ab4('0x30')]['includeAll']){_0x4c589b[_0x1ab4('0x40')]=[{'all':!![]}];}return db[_0x1ab4('0x2b')][_0x1ab4('0x41')](_0x4c589b);})[_0x1ab4('0x22')](function(_0x3c05b7){_0x53db4b[_0x1ab4('0x42')]=_0x3c05b7;return _0x53db4b;})[_0x1ab4('0x22')](respondWithFilteredResult(_0x3ad687,_0x4c589b))[_0x1ab4('0x43')](handleError(_0x3ad687,null));};exports[_0x1ab4('0x44')]=function(_0x4fe011,_0xbb2c37){var _0x388176={'raw':!![],'where':{'id':_0x4fe011[_0x1ab4('0x45')]['id']}},_0x611050={};_0x611050[_0x1ab4('0x33')]=_[_0x1ab4('0x31')](db[_0x1ab4('0x2b')][_0x1ab4('0x2c')]);_0x611050[_0x1ab4('0x30')]=_['keys'](_0x4fe011['query']);_0x611050[_0x1ab4('0x3a')]=_['intersection'](_0x611050['model'],_0x611050[_0x1ab4('0x30')]);_0x388176['attributes']=_['intersection'](_0x611050[_0x1ab4('0x33')],qs[_0x1ab4('0x34')](_0x4fe011['query'][_0x1ab4('0x34')]));_0x388176[_0x1ab4('0x35')]=_0x388176[_0x1ab4('0x35')][_0x1ab4('0x36')]?_0x388176[_0x1ab4('0x35')]:_0x611050['model'];if(_0x4fe011[_0x1ab4('0x30')][_0x1ab4('0x46')]){_0x388176['include']=[{'all':!![]}];}_0x388176=_[_0x1ab4('0x3d')]({},_0x388176,_0x4fe011[_0x1ab4('0x3f')]);return db[_0x1ab4('0x2b')]['find'](_0x388176)['then'](handleEntityNotFound(_0xbb2c37,null))['then'](respondWithResult(_0xbb2c37,null))[_0x1ab4('0x43')](handleError(_0xbb2c37,null));};exports['create']=function(_0xc7b4b5,_0x5f92d8){return db[_0x1ab4('0x2b')][_0x1ab4('0x47')](_0xc7b4b5[_0x1ab4('0x48')],{})[_0x1ab4('0x22')](function(_0x18e705){var _0xa94be5=_0xc7b4b5[_0x1ab4('0x49')][_0x1ab4('0x23')]({'plain':!![]});if(!_0xa94be5)throw new Error(_0x1ab4('0x4a'));if(_0xa94be5['role']===_0x1ab4('0x49')){var _0x5b6680=_0x18e705['get']({'plain':!![]});var _0x3f7c79=_0x1ab4('0x24');return db[_0x1ab4('0x4b')][_0x1ab4('0x4c')]({'where':{'name':_0x3f7c79,'userProfileId':_0xa94be5[_0x1ab4('0x4d')]},'raw':!![]})['then'](function(_0x38e384){if(_0x38e384&&_0x38e384[_0x1ab4('0x4e')]===0x0){return db[_0x1ab4('0x25')][_0x1ab4('0x47')]({'name':_0x5b6680[_0x1ab4('0x27')],'resourceId':_0x5b6680['id'],'type':_0x38e384[_0x1ab4('0x27')],'sectionId':_0x38e384['id']},{})['then'](function(){return _0x18e705;});}else{return _0x18e705;}})[_0x1ab4('0x43')](function(_0x1bb795){logger[_0x1ab4('0x4f')](_0x1ab4('0x50'),_0x1bb795);throw _0x1bb795;});}return _0x18e705;})[_0x1ab4('0x22')](respondWithResult(_0x5f92d8,0xc9))['catch'](handleError(_0x5f92d8,null));};exports['update']=function(_0x298bf3,_0x540777){if(_0x298bf3['body']['id']){delete _0x298bf3[_0x1ab4('0x48')]['id'];}return db['AnalyticExtractedReport'][_0x1ab4('0x4c')]({'where':{'id':_0x298bf3['params']['id']}})[_0x1ab4('0x22')](handleEntityNotFound(_0x540777,null))[_0x1ab4('0x22')](saveUpdates(_0x298bf3[_0x1ab4('0x48')],null))[_0x1ab4('0x22')](respondWithResult(_0x540777,null))['catch'](handleError(_0x540777,null));};exports['destroy']=function(_0x4caa74,_0x1eac21){return db['AnalyticExtractedReport'][_0x1ab4('0x4c')]({'where':{'id':_0x4caa74[_0x1ab4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1eac21,null))['then'](removeEntity(_0x1eac21,null))['catch'](handleError(_0x1eac21,null));};exports[_0x1ab4('0x51')]=function(_0x9626f6,_0x15c204,_0x52a929){return db[_0x1ab4('0x2b')][_0x1ab4('0x4c')]({'where':{'id':_0x9626f6[_0x1ab4('0x45')]['id']},'attributes':['name',_0x1ab4('0x52'),_0x1ab4('0x53'),_0x1ab4('0x54')],'raw':!![]})['then'](handleEntityNotFound(_0x15c204,null))[_0x1ab4('0x22')](function(_0x5507fe){if(_0x5507fe){if(!fs[_0x1ab4('0x55')](path[_0x1ab4('0x56')](config[_0x1ab4('0x57')],_0x1ab4('0x58'),_0x5507fe['savename']))){throw new db[(_0x1ab4('0x59'))][(_0x1ab4('0x5a'))](_0x1ab4('0x5b'));}if(_0x9626f6[_0x1ab4('0x30')][_0x1ab4('0x5c')]){return _0x15c204[_0x1ab4('0x16')](0xc8);}return _0x15c204[_0x1ab4('0x51')](path[_0x1ab4('0x56')](config['root'],'server/files/reports',_0x5507fe[_0x1ab4('0x53')]),util['format'](_0x1ab4('0x5d'),_0x5507fe[_0x1ab4('0x52')]||_0x5507fe['name'],_0x5507fe[_0x1ab4('0x54')][_0x1ab4('0x5e')]()));}})['catch'](handleError(_0x15c204,null));}; \ No newline at end of file +var _0x132f=['mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','order','sort','filter','where','type','VIRTUAL','merge','includeAll','include','rows','catch','show','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','%s.%s','basename','toLowerCase','eml-format','request-promise','moment','bluebird'];(function(_0x4e3e39,_0x27f8da){var _0x5cddac=function(_0x58a2fe){while(--_0x58a2fe){_0x4e3e39['push'](_0x4e3e39['shift']());}};_0x5cddac(++_0x27f8da);}(_0x132f,0x1f0));var _0xf132=function(_0x37ded3,_0x371ebb){_0x37ded3=_0x37ded3-0x0;var _0x51e49e=_0x132f[_0x37ded3];return _0x51e49e;};'use strict';var emlformat=require(_0xf132('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf132('0x1'));var moment=require(_0xf132('0x2'));var BPromise=require(_0xf132('0x3'));var Mustache=require(_0xf132('0x4'));var util=require(_0xf132('0x5'));var path=require(_0xf132('0x6'));var sox=require(_0xf132('0x7'));var csv=require(_0xf132('0x8'));var ejs=require(_0xf132('0x9'));var fs=require('fs');var fs_extra=require(_0xf132('0xa'));var _=require('lodash');var squel=require(_0xf132('0xb'));var crypto=require(_0xf132('0xc'));var jsforce=require(_0xf132('0xd'));var deskjs=require(_0xf132('0xe'));var toCsv=require(_0xf132('0x8'));var querystring=require(_0xf132('0xf'));var Papa=require(_0xf132('0x10'));var Redis=require(_0xf132('0x11'));var authService=require(_0xf132('0x12'));var qs=require(_0xf132('0x13'));var as=require(_0xf132('0x14'));var hardwareService=require(_0xf132('0x15'));var logger=require(_0xf132('0x16'))(_0xf132('0x17'));var utils=require(_0xf132('0x18'));var config=require(_0xf132('0x19'));var licenseUtil=require(_0xf132('0x1a'));var db=require(_0xf132('0x1b'))['db'];function respondWithStatusCode(_0x3a7169,_0x56f4f5){_0x56f4f5=_0x56f4f5||0xcc;return function(_0x23100c){if(_0x23100c){return _0x3a7169[_0xf132('0x1c')](_0x56f4f5);}return _0x3a7169['status'](_0x56f4f5)[_0xf132('0x1d')]();};}function respondWithResult(_0x370fa3,_0x4fee25){_0x4fee25=_0x4fee25||0xc8;return function(_0x18000d){if(_0x18000d){return _0x370fa3[_0xf132('0x1e')](_0x4fee25)['json'](_0x18000d);}};}function respondWithFilteredResult(_0x563eb8,_0x374f5f){return function(_0x2e4529){if(_0x2e4529){var _0x5e9902=typeof _0x374f5f['offset']===_0xf132('0x1f')&&typeof _0x374f5f[_0xf132('0x20')]===_0xf132('0x1f');var _0x20cda5=_0x2e4529[_0xf132('0x21')];var _0x24c7ff=_0x5e9902?0x0:_0x374f5f[_0xf132('0x22')];var _0x308298=_0x5e9902?_0x2e4529['count']:_0x374f5f['offset']+_0x374f5f[_0xf132('0x20')];var _0x50120b;if(_0x308298>=_0x20cda5){_0x308298=_0x20cda5;_0x50120b=0xc8;}else{_0x50120b=0xce;}_0x563eb8[_0xf132('0x1e')](_0x50120b);return _0x563eb8[_0xf132('0x23')](_0xf132('0x24'),_0x24c7ff+'-'+_0x308298+'/'+_0x20cda5)[_0xf132('0x25')](_0x2e4529);}return null;};}function patchUpdates(_0x148370){return function(_0x50c97b){try{jsonpatch['apply'](_0x50c97b,_0x148370,!![]);}catch(_0x57ea3e){return BPromise[_0xf132('0x26')](_0x57ea3e);}return _0x50c97b['save']();};}function saveUpdates(_0x464a28,_0x29be83){return function(_0x245ac7){if(_0x245ac7){return _0x245ac7[_0xf132('0x27')](_0x464a28)[_0xf132('0x28')](function(_0x2a13fa){return _0x2a13fa;});}return null;};}function removeEntity(_0x22d65f,_0x146f9a){return function(_0x2a84fa){if(_0x2a84fa){return _0x2a84fa[_0xf132('0x29')]()[_0xf132('0x28')](function(){var _0x5161ec=_0x2a84fa['get']({'plain':!![]});var _0x18234f='ExtractedReports';return db[_0xf132('0x2a')][_0xf132('0x29')]({'where':{'type':_0x18234f,'resourceId':_0x5161ec['id']}})['then'](function(){return _0x2a84fa;});})['then'](function(){_0x22d65f[_0xf132('0x1e')](0xcc)[_0xf132('0x1d')]();});}};}function handleEntityNotFound(_0x479d7e,_0x5ea7ad){return function(_0x3ebf64){if(!_0x3ebf64){_0x479d7e[_0xf132('0x1c')](0x194);}return _0x3ebf64;};}function handleError(_0x48610a,_0x1d6945){_0x1d6945=_0x1d6945||0x1f4;return function(_0xaa521c){logger['error'](_0xaa521c[_0xf132('0x2b')]);if(_0xaa521c['name']){delete _0xaa521c[_0xf132('0x2c')];}_0x48610a[_0xf132('0x1e')](_0x1d6945)[_0xf132('0x2d')](_0xaa521c);};}exports[_0xf132('0x2e')]=function(_0x1b609c,_0xcbd5b4){var _0x2c4752={},_0x3d86cc={},_0x18064e={'count':0x0,'rows':[]};var _0x33f2f2=_[_0xf132('0x2f')](db[_0xf132('0x30')][_0xf132('0x31')],function(_0x28b0f6){return{'name':_0x28b0f6[_0xf132('0x32')],'type':_0x28b0f6['type'][_0xf132('0x33')]};});_0x3d86cc[_0xf132('0x34')]=_[_0xf132('0x2f')](_0x33f2f2,_0xf132('0x2c'));_0x3d86cc[_0xf132('0x35')]=_['keys'](_0x1b609c['query']);_0x3d86cc[_0xf132('0x36')]=_[_0xf132('0x37')](_0x3d86cc['model'],_0x3d86cc[_0xf132('0x35')]);_0x2c4752[_0xf132('0x38')]=_[_0xf132('0x37')](_0x3d86cc[_0xf132('0x34')],qs[_0xf132('0x39')](_0x1b609c[_0xf132('0x35')][_0xf132('0x39')]));_0x2c4752[_0xf132('0x38')]=_0x2c4752[_0xf132('0x38')][_0xf132('0x3a')]?_0x2c4752['attributes']:_0x3d86cc[_0xf132('0x34')];if(!_0x1b609c[_0xf132('0x35')]['hasOwnProperty']('nolimit')){_0x2c4752[_0xf132('0x20')]=qs[_0xf132('0x20')](_0x1b609c[_0xf132('0x35')][_0xf132('0x20')]);_0x2c4752['offset']=qs[_0xf132('0x22')](_0x1b609c['query'][_0xf132('0x22')]);}_0x2c4752[_0xf132('0x3b')]=qs['sort'](_0x1b609c[_0xf132('0x35')][_0xf132('0x3c')]);_0x2c4752['where']=qs[_0xf132('0x36')](_['pick'](_0x1b609c[_0xf132('0x35')],_0x3d86cc[_0xf132('0x36')]),_0x33f2f2);if(_0x1b609c[_0xf132('0x35')][_0xf132('0x3d')]){_0x2c4752['where']=_['merge'](_0x2c4752[_0xf132('0x3e')],{'$or':_['map'](_0x33f2f2,function(_0x32b7bf){if(_0x32b7bf[_0xf132('0x3f')]!==_0xf132('0x40')){var _0x46aff0={};_0x46aff0[_0x32b7bf['name']]={'$like':'%'+_0x1b609c['query'][_0xf132('0x3d')]+'%'};return _0x46aff0;}})});}_0x2c4752=_[_0xf132('0x41')]({},_0x2c4752,_0x1b609c['options']);var _0x1e563a={'where':_0x2c4752[_0xf132('0x3e')]};return db[_0xf132('0x30')][_0xf132('0x21')](_0x1e563a)[_0xf132('0x28')](function(_0x2b06c7){_0x18064e[_0xf132('0x21')]=_0x2b06c7;if(_0x1b609c[_0xf132('0x35')][_0xf132('0x42')]){_0x2c4752[_0xf132('0x43')]=[{'all':!![]}];}return db[_0xf132('0x30')]['findAll'](_0x2c4752);})[_0xf132('0x28')](function(_0x5af3b){_0x18064e[_0xf132('0x44')]=_0x5af3b;return _0x18064e;})[_0xf132('0x28')](respondWithFilteredResult(_0xcbd5b4,_0x2c4752))[_0xf132('0x45')](handleError(_0xcbd5b4,null));};exports[_0xf132('0x46')]=function(_0x4b1b6d,_0x5a7824){var _0x8a7160={'raw':!![],'where':{'id':_0x4b1b6d['params']['id']}},_0x1b9845={};_0x1b9845['model']=_[_0xf132('0x47')](db['AnalyticExtractedReport'][_0xf132('0x31')]);_0x1b9845[_0xf132('0x35')]=_[_0xf132('0x47')](_0x4b1b6d[_0xf132('0x35')]);_0x1b9845[_0xf132('0x36')]=_[_0xf132('0x37')](_0x1b9845[_0xf132('0x34')],_0x1b9845['query']);_0x8a7160[_0xf132('0x38')]=_[_0xf132('0x37')](_0x1b9845[_0xf132('0x34')],qs[_0xf132('0x39')](_0x4b1b6d['query']['fields']));_0x8a7160[_0xf132('0x38')]=_0x8a7160[_0xf132('0x38')][_0xf132('0x3a')]?_0x8a7160[_0xf132('0x38')]:_0x1b9845[_0xf132('0x34')];if(_0x4b1b6d[_0xf132('0x35')]['includeAll']){_0x8a7160[_0xf132('0x43')]=[{'all':!![]}];}_0x8a7160=_[_0xf132('0x41')]({},_0x8a7160,_0x4b1b6d[_0xf132('0x48')]);return db[_0xf132('0x30')][_0xf132('0x49')](_0x8a7160)[_0xf132('0x28')](handleEntityNotFound(_0x5a7824,null))[_0xf132('0x28')](respondWithResult(_0x5a7824,null))[_0xf132('0x45')](handleError(_0x5a7824,null));};exports[_0xf132('0x4a')]=function(_0x40c1c6,_0x2cf492){return db[_0xf132('0x30')][_0xf132('0x4a')](_0x40c1c6[_0xf132('0x4b')],{})[_0xf132('0x28')](function(_0x5b20ad){var _0x239a89=_0x40c1c6[_0xf132('0x4c')][_0xf132('0x4d')]({'plain':!![]});if(!_0x239a89)throw new Error(_0xf132('0x4e'));if(_0x239a89['role']===_0xf132('0x4c')){var _0x105297=_0x5b20ad[_0xf132('0x4d')]({'plain':!![]});var _0x32d9bb=_0xf132('0x4f');return db[_0xf132('0x50')][_0xf132('0x49')]({'where':{'name':_0x32d9bb,'userProfileId':_0x239a89[_0xf132('0x51')]},'raw':!![]})['then'](function(_0x1823e6){if(_0x1823e6&&_0x1823e6[_0xf132('0x52')]===0x0){return db[_0xf132('0x2a')][_0xf132('0x4a')]({'name':_0x105297[_0xf132('0x2c')],'resourceId':_0x105297['id'],'type':_0x1823e6[_0xf132('0x2c')],'sectionId':_0x1823e6['id']},{})[_0xf132('0x28')](function(){return _0x5b20ad;});}else{return _0x5b20ad;}})['catch'](function(_0x39f110){logger[_0xf132('0x53')](_0xf132('0x54'),_0x39f110);throw _0x39f110;});}return _0x5b20ad;})['then'](respondWithResult(_0x2cf492,0xc9))[_0xf132('0x45')](handleError(_0x2cf492,null));};exports[_0xf132('0x27')]=function(_0x1d5129,_0x495f29){if(_0x1d5129[_0xf132('0x4b')]['id']){delete _0x1d5129[_0xf132('0x4b')]['id'];}return db[_0xf132('0x30')][_0xf132('0x49')]({'where':{'id':_0x1d5129[_0xf132('0x55')]['id']}})[_0xf132('0x28')](handleEntityNotFound(_0x495f29,null))[_0xf132('0x28')](saveUpdates(_0x1d5129[_0xf132('0x4b')],null))['then'](respondWithResult(_0x495f29,null))[_0xf132('0x45')](handleError(_0x495f29,null));};exports[_0xf132('0x29')]=function(_0x6ce61,_0x3bf5ab){return db[_0xf132('0x30')]['find']({'where':{'id':_0x6ce61[_0xf132('0x55')]['id']}})['then'](handleEntityNotFound(_0x3bf5ab,null))[_0xf132('0x28')](removeEntity(_0x3bf5ab,null))[_0xf132('0x45')](handleError(_0x3bf5ab,null));};exports[_0xf132('0x56')]=function(_0xbc0aab,_0x51c1b2,_0x1284d7){return db[_0xf132('0x30')][_0xf132('0x49')]({'where':{'id':_0xbc0aab[_0xf132('0x55')]['id']},'attributes':['name','basename',_0xf132('0x57'),_0xf132('0x58')],'raw':!![]})['then'](handleEntityNotFound(_0x51c1b2,null))[_0xf132('0x28')](function(_0x5704cf){if(_0x5704cf){if(!fs[_0xf132('0x59')](path[_0xf132('0x5a')](config[_0xf132('0x5b')],_0xf132('0x5c'),_0x5704cf[_0xf132('0x57')]))){throw new db[(_0xf132('0x5d'))][(_0xf132('0x5e'))](_0xf132('0x5f'));}if(_0xbc0aab[_0xf132('0x35')][_0xf132('0x60')]){return _0x51c1b2[_0xf132('0x1c')](0xc8);}return _0x51c1b2[_0xf132('0x56')](path[_0xf132('0x5a')](config[_0xf132('0x5b')],_0xf132('0x5c'),_0x5704cf['savename']),util['format'](_0xf132('0x61'),_0x5704cf[_0xf132('0x62')]||_0x5704cf[_0xf132('0x2c')],_0x5704cf[_0xf132('0x58')][_0xf132('0x63')]()));}})[_0xf132('0x45')](handleError(_0x51c1b2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 58d0fb9..37c434c 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 _0xcabd=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x9f1286,_0x4b66e0){var _0x40b2ac=function(_0x3512ae){while(--_0x3512ae){_0x9f1286['push'](_0x9f1286['shift']());}};_0x40b2ac(++_0x4b66e0);}(_0xcabd,0xb4));var _0xdcab=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xcabd[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0xdcab('0x0'));var util=require(_0xdcab('0x1'));var logger=require(_0xdcab('0x2'))('api');var moment=require(_0xdcab('0x3'));var BPromise=require(_0xdcab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcab('0x5'));var rimraf=require(_0xdcab('0x6'));var config=require(_0xdcab('0x7'));var attributes=require(_0xdcab('0x8'));module[_0xdcab('0x9')]=function(_0x1fdf7c,_0x2c0bdb){return _0x1fdf7c[_0xdcab('0xa')](_0xdcab('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca18=['request-promise','path','rimraf','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','../../config/logger','moment','bluebird'];(function(_0x273770,_0x497b94){var _0x48073a=function(_0x2a9cff){while(--_0x2a9cff){_0x273770['push'](_0x273770['shift']());}};_0x48073a(++_0x497b94);}(_0xca18,0x10f));var _0x8ca1=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0xca18[_0x4080dd];return _0x4ecf85;};'use strict';var _=require(_0x8ca1('0x0'));var util=require('util');var logger=require(_0x8ca1('0x1'))('api');var moment=require(_0x8ca1('0x2'));var BPromise=require(_0x8ca1('0x3'));var rp=require(_0x8ca1('0x4'));var fs=require('fs');var path=require(_0x8ca1('0x5'));var rimraf=require(_0x8ca1('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ca1('0x7'));module['exports']=function(_0x437e85,_0x19776d){return _0x437e85[_0x8ca1('0x8')](_0x8ca1('0x9'),attributes,{'tableName':_0x8ca1('0xa'),'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 2ef048f..806fde1 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 _0x077e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x58220a,_0x3545b5){var _0x30e125=function(_0x4aafd){while(--_0x4aafd){_0x58220a['push'](_0x58220a['shift']());}};_0x30e125(++_0x3545b5);}(_0x077e,0x1f4));var _0xe077=function(_0x5e2dd4,_0x2f2dc0){_0x5e2dd4=_0x5e2dd4-0x0;var _0x396f12=_0x077e[_0x5e2dd4];return _0x396f12;};'use strict';var _=require(_0xe077('0x0'));var util=require(_0xe077('0x1'));var moment=require(_0xe077('0x2'));var BPromise=require('bluebird');var rs=require(_0xe077('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe077('0x4'))['db'];var utils=require(_0xe077('0x5'));var logger=require(_0xe077('0x6'))(_0xe077('0x7'));var config=require(_0xe077('0x8'));var jayson=require(_0xe077('0x9'));var client=jayson[_0xe077('0xa')][_0xe077('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c9194,_0x427b23,_0x52e717){return new BPromise(function(_0x49306d,_0x387597){return client[_0xe077('0xc')](_0x1c9194,_0x52e717)[_0xe077('0xd')](function(_0x5ac7e8){logger[_0xe077('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'),JSON[_0xe077('0x10')](_0x5ac7e8));if(_0x5ac7e8[_0xe077('0x11')]){if(_0x5ac7e8[_0xe077('0x11')]['code']===0x1f4){logger[_0xe077('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);return _0x387597(_0x5ac7e8[_0xe077('0x11')]['message']);}logger['error'](_0xe077('0x13'),_0x427b23,_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);return _0x49306d(_0x5ac7e8[_0xe077('0x11')][_0xe077('0x12')]);}else{logger[_0xe077('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x427b23,_0xe077('0xf'));_0x49306d(_0x5ac7e8[_0xe077('0x14')][_0xe077('0x12')]);}})[_0xe077('0x15')](function(_0x3e57e4){logger[_0xe077('0x11')](_0xe077('0x13'),_0x427b23,_0x3e57e4);_0x387597(_0x3e57e4);});});} \ No newline at end of file +var _0xcc59=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x507f1e,_0x1a5406){var _0x56ef46=function(_0x477153){while(--_0x477153){_0x507f1e['push'](_0x507f1e['shift']());}};_0x56ef46(++_0x1a5406);}(_0xcc59,0x1ba));var _0x9cc5=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xcc59[_0x35d4e9];return _0x5c2770;};'use strict';var _=require(_0x9cc5('0x0'));var util=require(_0x9cc5('0x1'));var moment=require(_0x9cc5('0x2'));var BPromise=require(_0x9cc5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9cc5('0x4'));var db=require(_0x9cc5('0x5'))['db'];var utils=require(_0x9cc5('0x6'));var logger=require(_0x9cc5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9cc5('0x8'));var client=jayson['client'][_0x9cc5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17b5cf,_0x12381e,_0x6f60d8){return new BPromise(function(_0x166104,_0x35812f){return client[_0x9cc5('0xa')](_0x17b5cf,_0x6f60d8)['then'](function(_0x2d5540){logger[_0x9cc5('0xb')](_0x9cc5('0xc'),_0x12381e,_0x9cc5('0xd'));logger['debug'](_0x9cc5('0xe'),_0x12381e,'request\x20sent',JSON[_0x9cc5('0xf')](_0x2d5540));if(_0x2d5540['error']){if(_0x2d5540[_0x9cc5('0x10')]['code']===0x1f4){logger[_0x9cc5('0x10')](_0x9cc5('0xc'),_0x12381e,_0x2d5540[_0x9cc5('0x10')][_0x9cc5('0x11')]);return _0x35812f(_0x2d5540[_0x9cc5('0x10')][_0x9cc5('0x11')]);}logger['error'](_0x9cc5('0xc'),_0x12381e,_0x2d5540[_0x9cc5('0x10')][_0x9cc5('0x11')]);return _0x166104(_0x2d5540[_0x9cc5('0x10')][_0x9cc5('0x11')]);}else{logger['info'](_0x9cc5('0xc'),_0x12381e,_0x9cc5('0xd'));_0x166104(_0x2d5540[_0x9cc5('0x12')][_0x9cc5('0x11')]);}})[_0x9cc5('0x13')](function(_0xe268b2){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x12381e,_0xe268b2);_0x35812f(_0xe268b2);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index aa49fd5..083d902 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 _0xc881=['delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','/:id/download','download','post','create','put','update'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xc881,0x16b));var _0x1c88=function(_0x5744b2,_0x1d7aad){_0x5744b2=_0x5744b2-0x0;var _0x2f3a26=_0xc881[_0x5744b2];return _0x2f3a26;};'use strict';var multer=require(_0x1c88('0x0'));var util=require(_0x1c88('0x1'));var path=require(_0x1c88('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c88('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1c88('0x4'));var config=require(_0x1c88('0x5'));var controller=require(_0x1c88('0x6'));router[_0x1c88('0x7')]('/',auth[_0x1c88('0x8')](),controller[_0x1c88('0x9')]);router['get'](_0x1c88('0xa'),auth[_0x1c88('0x8')](),controller['show']);router[_0x1c88('0x7')](_0x1c88('0xb'),auth[_0x1c88('0x8')](),controller[_0x1c88('0xc')]);router[_0x1c88('0xd')]('/',auth[_0x1c88('0x8')](),controller[_0x1c88('0xe')]);router[_0x1c88('0xf')](_0x1c88('0xa'),auth[_0x1c88('0x8')](),controller[_0x1c88('0x10')]);router[_0x1c88('0x11')]('/:id',auth[_0x1c88('0x8')](),controller[_0x1c88('0x12')]);module[_0x1c88('0x13')]=router; \ No newline at end of file +var _0xbb4d=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','show','/:id/download','download','post','create'];(function(_0x2b4c19,_0x33ecf3){var _0x1ba8f6=function(_0x2a9e41){while(--_0x2a9e41){_0x2b4c19['push'](_0x2b4c19['shift']());}};_0x1ba8f6(++_0x33ecf3);}(_0xbb4d,0x1d3));var _0xdbb4=function(_0x44068d,_0x32310a){_0x44068d=_0x44068d-0x0;var _0x208dd7=_0xbb4d[_0x44068d];return _0x208dd7;};'use strict';var multer=require(_0xdbb4('0x0'));var util=require(_0xdbb4('0x1'));var path=require(_0xdbb4('0x2'));var timeout=require(_0xdbb4('0x3'));var express=require(_0xdbb4('0x4'));var router=express[_0xdbb4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbb4('0x6'));var config=require(_0xdbb4('0x7'));var controller=require(_0xdbb4('0x8'));router[_0xdbb4('0x9')]('/',auth[_0xdbb4('0xa')](),controller['index']);router[_0xdbb4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdbb4('0xb')]);router['get'](_0xdbb4('0xc'),auth[_0xdbb4('0xa')](),controller[_0xdbb4('0xd')]);router[_0xdbb4('0xe')]('/',auth[_0xdbb4('0xa')](),controller[_0xdbb4('0xf')]);router[_0xdbb4('0x10')](_0xdbb4('0x11'),auth[_0xdbb4('0xa')](),controller[_0xdbb4('0x12')]);router['delete']('/:id',auth[_0xdbb4('0xa')](),controller[_0xdbb4('0x13')]);module[_0xdbb4('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index fe2424e..a23948f 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 _0xbc26=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x100208,_0x4fa4a2){var _0x2d83f4=function(_0x261665){while(--_0x261665){_0x100208['push'](_0x100208['shift']());}};_0x2d83f4(++_0x4fa4a2);}(_0xbc26,0x10a));var _0x6bc2=function(_0x40aa69,_0x30b4d8){_0x40aa69=_0x40aa69-0x0;var _0x129414=_0xbc26[_0x40aa69];return _0x129414;};'use strict';var Sequelize=require(_0x6bc2('0x0'));module[_0x6bc2('0x1')]={'field':{'type':Sequelize[_0x6bc2('0x2')]},'alias':{'type':Sequelize[_0x6bc2('0x3')]},'function':{'type':Sequelize[_0x6bc2('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x6bc2('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x6bc2('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x90ec=['TEXT','STRING','BOOLEAN','exports'];(function(_0x1e4649,_0x514265){var _0x38763d=function(_0x1edb2a){while(--_0x1edb2a){_0x1e4649['push'](_0x1e4649['shift']());}};_0x38763d(++_0x514265);}(_0x90ec,0x12f));var _0xc90e=function(_0x50042f,_0xa479e1){_0x50042f=_0x50042f-0x0;var _0x3f1892=_0x90ec[_0x50042f];return _0x3f1892;};'use strict';var Sequelize=require('sequelize');module[_0xc90e('0x0')]={'field':{'type':Sequelize[_0xc90e('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xc90e('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xc90e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xc90e('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index b89243c..9f4bf73 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 _0xa71f=['AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','bulkCreate','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','stack','name','send'];(function(_0x4113a5,_0x483da9){var _0x3e50ee=function(_0x47c5e7){while(--_0x47c5e7){_0x4113a5['push'](_0x4113a5['shift']());}};_0x3e50ee(++_0x483da9);}(_0xa71f,0xd4));var _0xfa71=function(_0x556341,_0x5e232b){_0x556341=_0x556341-0x0;var _0x1f7251=_0xa71f[_0x556341];return _0x1f7251;};'use strict';var emlformat=require(_0xfa71('0x0'));var rimraf=require(_0xfa71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfa71('0x2'));var rp=require(_0xfa71('0x3'));var moment=require(_0xfa71('0x4'));var BPromise=require(_0xfa71('0x5'));var Mustache=require(_0xfa71('0x6'));var util=require(_0xfa71('0x7'));var path=require(_0xfa71('0x8'));var sox=require(_0xfa71('0x9'));var csv=require('to-csv');var ejs=require(_0xfa71('0xa'));var fs=require('fs');var fs_extra=require(_0xfa71('0xb'));var _=require(_0xfa71('0xc'));var squel=require(_0xfa71('0xd'));var crypto=require(_0xfa71('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfa71('0xf'));var querystring=require(_0xfa71('0x10'));var Papa=require('papaparse');var Redis=require(_0xfa71('0x11'));var authService=require(_0xfa71('0x12'));var qs=require(_0xfa71('0x13'));var as=require(_0xfa71('0x14'));var hardwareService=require(_0xfa71('0x15'));var logger=require(_0xfa71('0x16'))(_0xfa71('0x17'));var utils=require(_0xfa71('0x18'));var config=require(_0xfa71('0x19'));var licenseUtil=require(_0xfa71('0x1a'));var db=require(_0xfa71('0x1b'))['db'];function respondWithStatusCode(_0x192c95,_0x45ee0d){_0x45ee0d=_0x45ee0d||0xcc;return function(_0x45e1f4){if(_0x45e1f4){return _0x192c95[_0xfa71('0x1c')](_0x45ee0d);}return _0x192c95[_0xfa71('0x1d')](_0x45ee0d)[_0xfa71('0x1e')]();};}function respondWithResult(_0x3930ab,_0x118bc1){_0x118bc1=_0x118bc1||0xc8;return function(_0x529fb4){if(_0x529fb4){return _0x3930ab[_0xfa71('0x1d')](_0x118bc1)[_0xfa71('0x1f')](_0x529fb4);}};}function respondWithFilteredResult(_0x14c782,_0x26c652){return function(_0xf9881d){if(_0xf9881d){var _0x2bf2d5=typeof _0x26c652[_0xfa71('0x20')]===_0xfa71('0x21')&&typeof _0x26c652[_0xfa71('0x22')]===_0xfa71('0x21');var _0x39bae1=_0xf9881d[_0xfa71('0x23')];var _0x2091b6=_0x2bf2d5?0x0:_0x26c652['offset'];var _0x1b2f95=_0x2bf2d5?_0xf9881d['count']:_0x26c652[_0xfa71('0x20')]+_0x26c652[_0xfa71('0x22')];var _0x5dea69;if(_0x1b2f95>=_0x39bae1){_0x1b2f95=_0x39bae1;_0x5dea69=0xc8;}else{_0x5dea69=0xce;}_0x14c782['status'](_0x5dea69);return _0x14c782[_0xfa71('0x24')](_0xfa71('0x25'),_0x2091b6+'-'+_0x1b2f95+'/'+_0x39bae1)[_0xfa71('0x1f')](_0xf9881d);}return null;};}function patchUpdates(_0x4c75d){return function(_0x383c70){try{jsonpatch[_0xfa71('0x26')](_0x383c70,_0x4c75d,!![]);}catch(_0x583b91){return BPromise['reject'](_0x583b91);}return _0x383c70['save']();};}function saveUpdates(_0x27aa74,_0x4a4067){return function(_0x29f2d1){if(_0x29f2d1){return _0x29f2d1[_0xfa71('0x27')](_0x27aa74)['then'](function(_0x3aa8fc){return _0x3aa8fc;});}return null;};}function removeEntity(_0x4f62df,_0x2c6545){return function(_0xeae367){if(_0xeae367){return _0xeae367[_0xfa71('0x28')]()[_0xfa71('0x29')](function(){_0x4f62df[_0xfa71('0x1d')](0xcc)[_0xfa71('0x1e')]();});}};}function handleEntityNotFound(_0x23904f,_0xb1be17){return function(_0x21e554){if(!_0x21e554){_0x23904f['sendStatus'](0x194);}return _0x21e554;};}function handleError(_0x4b7689,_0x11bf8b){_0x11bf8b=_0x11bf8b||0x1f4;return function(_0x59b374){logger[_0xfa71('0x2a')](_0x59b374[_0xfa71('0x2b')]);if(_0x59b374[_0xfa71('0x2c')]){delete _0x59b374[_0xfa71('0x2c')];}_0x4b7689[_0xfa71('0x1d')](_0x11bf8b)[_0xfa71('0x2d')](_0x59b374);};}exports['index']=function(_0x1772f1,_0xe0b9b8){var _0x2923bb={},_0x28c534={},_0x5d7be6={'count':0x0,'rows':[]};var _0x40721c=_['map'](db[_0xfa71('0x2e')][_0xfa71('0x2f')],function(_0x2c3999){return{'name':_0x2c3999[_0xfa71('0x30')],'type':_0x2c3999['type'][_0xfa71('0x31')]};});_0x28c534[_0xfa71('0x32')]=_['map'](_0x40721c,_0xfa71('0x2c'));_0x28c534[_0xfa71('0x33')]=_['keys'](_0x1772f1[_0xfa71('0x33')]);_0x28c534[_0xfa71('0x34')]=_['intersection'](_0x28c534[_0xfa71('0x32')],_0x28c534['query']);_0x2923bb[_0xfa71('0x35')]=_[_0xfa71('0x36')](_0x28c534[_0xfa71('0x32')],qs[_0xfa71('0x37')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x37')]));_0x2923bb[_0xfa71('0x35')]=_0x2923bb[_0xfa71('0x35')][_0xfa71('0x38')]?_0x2923bb['attributes']:_0x28c534[_0xfa71('0x32')];if(!_0x1772f1[_0xfa71('0x33')][_0xfa71('0x39')](_0xfa71('0x3a'))){_0x2923bb[_0xfa71('0x22')]=qs[_0xfa71('0x22')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x22')]);_0x2923bb['offset']=qs[_0xfa71('0x20')](_0x1772f1['query']['offset']);}_0x2923bb[_0xfa71('0x3b')]=qs[_0xfa71('0x3c')](_0x1772f1[_0xfa71('0x33')][_0xfa71('0x3c')]);_0x2923bb[_0xfa71('0x3d')]=qs[_0xfa71('0x34')](_[_0xfa71('0x3e')](_0x1772f1[_0xfa71('0x33')],_0x28c534[_0xfa71('0x34')]),_0x40721c);if(_0x1772f1[_0xfa71('0x33')][_0xfa71('0x3f')]){_0x2923bb[_0xfa71('0x3d')]=_[_0xfa71('0x40')](_0x2923bb[_0xfa71('0x3d')],{'$or':_['map'](_0x40721c,function(_0x41732e){if(_0x41732e[_0xfa71('0x41')]!=='VIRTUAL'){var _0x29e8dc={};_0x29e8dc[_0x41732e[_0xfa71('0x2c')]]={'$like':'%'+_0x1772f1[_0xfa71('0x33')]['filter']+'%'};return _0x29e8dc;}})});}_0x2923bb=_[_0xfa71('0x40')]({},_0x2923bb,_0x1772f1[_0xfa71('0x42')]);var _0xb4bce4={'where':_0x2923bb[_0xfa71('0x3d')]};return db['AnalyticFieldReport']['count'](_0xb4bce4)['then'](function(_0x240304){_0x5d7be6[_0xfa71('0x23')]=_0x240304;if(_0x1772f1['query'][_0xfa71('0x43')]){_0x2923bb['include']=[{'all':!![]}];}return db['AnalyticFieldReport'][_0xfa71('0x44')](_0x2923bb);})[_0xfa71('0x29')](function(_0x45364e){_0x5d7be6[_0xfa71('0x45')]=_0x45364e;return _0x5d7be6;})[_0xfa71('0x29')](respondWithFilteredResult(_0xe0b9b8,_0x2923bb))[_0xfa71('0x46')](handleError(_0xe0b9b8,null));};exports[_0xfa71('0x47')]=function(_0x17e563,_0x72876){var _0x86b755={'raw':![],'where':{'id':_0x17e563[_0xfa71('0x48')]['id']}},_0x4f6dd0={};_0x4f6dd0[_0xfa71('0x32')]=_['keys'](db[_0xfa71('0x2e')][_0xfa71('0x2f')]);_0x4f6dd0[_0xfa71('0x33')]=_[_0xfa71('0x49')](_0x17e563[_0xfa71('0x33')]);_0x4f6dd0['filters']=_['intersection'](_0x4f6dd0['model'],_0x4f6dd0['query']);_0x86b755[_0xfa71('0x35')]=_[_0xfa71('0x36')](_0x4f6dd0[_0xfa71('0x32')],qs[_0xfa71('0x37')](_0x17e563['query'][_0xfa71('0x37')]));_0x86b755[_0xfa71('0x35')]=_0x86b755[_0xfa71('0x35')][_0xfa71('0x38')]?_0x86b755[_0xfa71('0x35')]:_0x4f6dd0[_0xfa71('0x32')];if(_0x17e563['query'][_0xfa71('0x43')]){_0x86b755[_0xfa71('0x4a')]=[{'all':!![]}];}_0x86b755=_[_0xfa71('0x40')]({},_0x86b755,_0x17e563['options']);return db[_0xfa71('0x2e')]['find'](_0x86b755)[_0xfa71('0x29')](handleEntityNotFound(_0x72876,null))['then'](respondWithResult(_0x72876,null))[_0xfa71('0x46')](handleError(_0x72876,null));};exports[_0xfa71('0x4b')]=function(_0x1714e0,_0x4e9ef3){return db[_0xfa71('0x2e')][_0xfa71('0x4b')](_0x1714e0[_0xfa71('0x4c')],{})['then'](respondWithResult(_0x4e9ef3,0xc9))[_0xfa71('0x46')](handleError(_0x4e9ef3,null));};exports[_0xfa71('0x4d')]=function(_0x502499,_0x29e733){return db[_0xfa71('0x2e')]['bulkCreate'](_0x502499['body'],{'raw':![],'individualHooks':!![]})[_0xfa71('0x29')](respondWithResult(_0x29e733,0xc9))['catch'](handleError(_0x29e733,null));};exports['update']=function(_0x3fd22f,_0x1a9e94){if(_0x3fd22f[_0xfa71('0x4c')]['id']){delete _0x3fd22f['body']['id'];}return db['AnalyticFieldReport'][_0xfa71('0x4e')]({'where':{'id':_0x3fd22f[_0xfa71('0x48')]['id']}})[_0xfa71('0x29')](handleEntityNotFound(_0x1a9e94,null))[_0xfa71('0x29')](saveUpdates(_0x3fd22f[_0xfa71('0x4c')],null))[_0xfa71('0x29')](respondWithResult(_0x1a9e94,null))[_0xfa71('0x46')](handleError(_0x1a9e94,null));};exports[_0xfa71('0x28')]=function(_0x1ba32b,_0x30b6e6){return db[_0xfa71('0x2e')][_0xfa71('0x4e')]({'where':{'id':_0x1ba32b[_0xfa71('0x48')]['id']}})['then'](handleEntityNotFound(_0x30b6e6,null))[_0xfa71('0x29')](removeEntity(_0x30b6e6,null))[_0xfa71('0x46')](handleError(_0x30b6e6,null));};exports[_0xfa71('0x4f')]=function(_0x1c7af4,_0x1e6d4c){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x1c7af4[_0xfa71('0x33')][_0xfa71('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xfa71('0x29')](respondWithResult(_0x1e6d4c,0xcc))['catch'](handleError(_0x1e6d4c,null));};exports[_0xfa71('0x51')]=function(_0x3144b0,_0x40f68d,_0x3d0e72){return db[_0xfa71('0x52')][_0xfa71('0x53')]({'where':{'id':_0x3144b0['params']['id']}})[_0xfa71('0x29')](handleEntityNotFound(_0x40f68d,null))['then'](function(_0x47062b){if(_0x47062b){return db['sequelize'][_0xfa71('0x54')](function(_0x1361ef){return db[_0xfa71('0x2e')][_0xfa71('0x28')]({'where':{'CustomReportId':_0x3144b0[_0xfa71('0x48')]['id']},'transaction':_0x1361ef})[_0xfa71('0x29')](function(_0x1f4f0b){var _0x2a6077=_['map'](_0x3144b0['body'],function(_0x37c235){delete _0x37c235['id'];_0x37c235[_0xfa71('0x55')]=_0x3144b0['params']['id'];return _0x37c235;});return db[_0xfa71('0x2e')]['bulkCreate'](_0x2a6077,{'transaction':_0x1361ef});});})['then'](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x3144b0['params']['id']}});});}})[_0xfa71('0x29')](respondWithResult(_0x40f68d,null))[_0xfa71('0x46')](handleError(_0x40f68d,null));}; \ No newline at end of file +var _0xf4dc=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','sendStatus','error','stack','name','send','map','AnalyticFieldReport','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x35f1b8,_0x508288){var _0xf083d1=function(_0x3c7fda){while(--_0x3c7fda){_0x35f1b8['push'](_0x35f1b8['shift']());}};_0xf083d1(++_0x508288);}(_0xf4dc,0xfc));var _0xcf4d=function(_0x1f83ec,_0x228d7e){_0x1f83ec=_0x1f83ec-0x0;var _0x30619a=_0xf4dc[_0x1f83ec];return _0x30619a;};'use strict';var emlformat=require(_0xcf4d('0x0'));var rimraf=require(_0xcf4d('0x1'));var zipdir=require(_0xcf4d('0x2'));var jsonpatch=require(_0xcf4d('0x3'));var rp=require(_0xcf4d('0x4'));var moment=require(_0xcf4d('0x5'));var BPromise=require(_0xcf4d('0x6'));var Mustache=require(_0xcf4d('0x7'));var util=require(_0xcf4d('0x8'));var path=require(_0xcf4d('0x9'));var sox=require(_0xcf4d('0xa'));var csv=require('to-csv');var ejs=require(_0xcf4d('0xb'));var fs=require('fs');var fs_extra=require(_0xcf4d('0xc'));var _=require(_0xcf4d('0xd'));var squel=require(_0xcf4d('0xe'));var crypto=require(_0xcf4d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xcf4d('0x10'));var toCsv=require(_0xcf4d('0x11'));var querystring=require(_0xcf4d('0x12'));var Papa=require(_0xcf4d('0x13'));var Redis=require(_0xcf4d('0x14'));var authService=require(_0xcf4d('0x15'));var qs=require(_0xcf4d('0x16'));var as=require(_0xcf4d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf4d('0x18'));var utils=require(_0xcf4d('0x19'));var config=require(_0xcf4d('0x1a'));var licenseUtil=require(_0xcf4d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23ef57,_0x46908f){_0x46908f=_0x46908f||0xcc;return function(_0xe79f4b){if(_0xe79f4b){return _0x23ef57['sendStatus'](_0x46908f);}return _0x23ef57[_0xcf4d('0x1c')](_0x46908f)[_0xcf4d('0x1d')]();};}function respondWithResult(_0x398e1d,_0x347bc3){_0x347bc3=_0x347bc3||0xc8;return function(_0x165480){if(_0x165480){return _0x398e1d[_0xcf4d('0x1c')](_0x347bc3)[_0xcf4d('0x1e')](_0x165480);}};}function respondWithFilteredResult(_0x543782,_0x311b6f){return function(_0x5d6971){if(_0x5d6971){var _0x1a5389=typeof _0x311b6f[_0xcf4d('0x1f')]===_0xcf4d('0x20')&&typeof _0x311b6f[_0xcf4d('0x21')]===_0xcf4d('0x20');var _0x332fc4=_0x5d6971[_0xcf4d('0x22')];var _0xcaf4d3=_0x1a5389?0x0:_0x311b6f[_0xcf4d('0x1f')];var _0x4291c0=_0x1a5389?_0x5d6971['count']:_0x311b6f['offset']+_0x311b6f[_0xcf4d('0x21')];var _0x4ec889;if(_0x4291c0>=_0x332fc4){_0x4291c0=_0x332fc4;_0x4ec889=0xc8;}else{_0x4ec889=0xce;}_0x543782['status'](_0x4ec889);return _0x543782[_0xcf4d('0x23')]('Content-Range',_0xcaf4d3+'-'+_0x4291c0+'/'+_0x332fc4)[_0xcf4d('0x1e')](_0x5d6971);}return null;};}function patchUpdates(_0x286d90){return function(_0x1d5e77){try{jsonpatch['apply'](_0x1d5e77,_0x286d90,!![]);}catch(_0x18e713){return BPromise[_0xcf4d('0x24')](_0x18e713);}return _0x1d5e77[_0xcf4d('0x25')]();};}function saveUpdates(_0x506205,_0x19f0b6){return function(_0x1af40b){if(_0x1af40b){return _0x1af40b[_0xcf4d('0x26')](_0x506205)['then'](function(_0x2e244c){return _0x2e244c;});}return null;};}function removeEntity(_0x2b8cca,_0x53faea){return function(_0xb105aa){if(_0xb105aa){return _0xb105aa['destroy']()[_0xcf4d('0x27')](function(){_0x2b8cca[_0xcf4d('0x1c')](0xcc)[_0xcf4d('0x1d')]();});}};}function handleEntityNotFound(_0x2f6556,_0x409472){return function(_0x168a06){if(!_0x168a06){_0x2f6556[_0xcf4d('0x28')](0x194);}return _0x168a06;};}function handleError(_0x39164e,_0x292b95){_0x292b95=_0x292b95||0x1f4;return function(_0x348ffb){logger[_0xcf4d('0x29')](_0x348ffb[_0xcf4d('0x2a')]);if(_0x348ffb[_0xcf4d('0x2b')]){delete _0x348ffb[_0xcf4d('0x2b')];}_0x39164e[_0xcf4d('0x1c')](_0x292b95)[_0xcf4d('0x2c')](_0x348ffb);};}exports['index']=function(_0x55de4a,_0x14a7ca){var _0x44a166={},_0xde3298={},_0x36cb9c={'count':0x0,'rows':[]};var _0x55edfa=_[_0xcf4d('0x2d')](db[_0xcf4d('0x2e')][_0xcf4d('0x2f')],function(_0x3ded61){return{'name':_0x3ded61['fieldName'],'type':_0x3ded61[_0xcf4d('0x30')][_0xcf4d('0x31')]};});_0xde3298[_0xcf4d('0x32')]=_[_0xcf4d('0x2d')](_0x55edfa,_0xcf4d('0x2b'));_0xde3298['query']=_[_0xcf4d('0x33')](_0x55de4a['query']);_0xde3298[_0xcf4d('0x34')]=_[_0xcf4d('0x35')](_0xde3298[_0xcf4d('0x32')],_0xde3298[_0xcf4d('0x36')]);_0x44a166['attributes']=_[_0xcf4d('0x35')](_0xde3298['model'],qs[_0xcf4d('0x37')](_0x55de4a['query'][_0xcf4d('0x37')]));_0x44a166['attributes']=_0x44a166['attributes']['length']?_0x44a166[_0xcf4d('0x38')]:_0xde3298['model'];if(!_0x55de4a[_0xcf4d('0x36')][_0xcf4d('0x39')](_0xcf4d('0x3a'))){_0x44a166['limit']=qs[_0xcf4d('0x21')](_0x55de4a[_0xcf4d('0x36')]['limit']);_0x44a166[_0xcf4d('0x1f')]=qs['offset'](_0x55de4a['query'][_0xcf4d('0x1f')]);}_0x44a166[_0xcf4d('0x3b')]=qs['sort'](_0x55de4a[_0xcf4d('0x36')]['sort']);_0x44a166[_0xcf4d('0x3c')]=qs[_0xcf4d('0x34')](_['pick'](_0x55de4a['query'],_0xde3298[_0xcf4d('0x34')]),_0x55edfa);if(_0x55de4a['query'][_0xcf4d('0x3d')]){_0x44a166[_0xcf4d('0x3c')]=_['merge'](_0x44a166['where'],{'$or':_['map'](_0x55edfa,function(_0x146969){if(_0x146969[_0xcf4d('0x30')]!==_0xcf4d('0x3e')){var _0x11f054={};_0x11f054[_0x146969['name']]={'$like':'%'+_0x55de4a[_0xcf4d('0x36')]['filter']+'%'};return _0x11f054;}})});}_0x44a166=_[_0xcf4d('0x3f')]({},_0x44a166,_0x55de4a[_0xcf4d('0x40')]);var _0x51a7a7={'where':_0x44a166[_0xcf4d('0x3c')]};return db['AnalyticFieldReport']['count'](_0x51a7a7)[_0xcf4d('0x27')](function(_0x46ce99){_0x36cb9c[_0xcf4d('0x22')]=_0x46ce99;if(_0x55de4a[_0xcf4d('0x36')]['includeAll']){_0x44a166[_0xcf4d('0x41')]=[{'all':!![]}];}return db[_0xcf4d('0x2e')][_0xcf4d('0x42')](_0x44a166);})[_0xcf4d('0x27')](function(_0x49f548){_0x36cb9c[_0xcf4d('0x43')]=_0x49f548;return _0x36cb9c;})[_0xcf4d('0x27')](respondWithFilteredResult(_0x14a7ca,_0x44a166))[_0xcf4d('0x44')](handleError(_0x14a7ca,null));};exports[_0xcf4d('0x45')]=function(_0x567b81,_0x319615){var _0x53dc51={'raw':![],'where':{'id':_0x567b81[_0xcf4d('0x46')]['id']}},_0x32cc83={};_0x32cc83[_0xcf4d('0x32')]=_[_0xcf4d('0x33')](db[_0xcf4d('0x2e')][_0xcf4d('0x2f')]);_0x32cc83['query']=_['keys'](_0x567b81[_0xcf4d('0x36')]);_0x32cc83[_0xcf4d('0x34')]=_[_0xcf4d('0x35')](_0x32cc83[_0xcf4d('0x32')],_0x32cc83['query']);_0x53dc51['attributes']=_[_0xcf4d('0x35')](_0x32cc83[_0xcf4d('0x32')],qs[_0xcf4d('0x37')](_0x567b81[_0xcf4d('0x36')][_0xcf4d('0x37')]));_0x53dc51['attributes']=_0x53dc51[_0xcf4d('0x38')][_0xcf4d('0x47')]?_0x53dc51[_0xcf4d('0x38')]:_0x32cc83['model'];if(_0x567b81['query'][_0xcf4d('0x48')]){_0x53dc51['include']=[{'all':!![]}];}_0x53dc51=_['merge']({},_0x53dc51,_0x567b81['options']);return db[_0xcf4d('0x2e')][_0xcf4d('0x49')](_0x53dc51)[_0xcf4d('0x27')](handleEntityNotFound(_0x319615,null))['then'](respondWithResult(_0x319615,null))[_0xcf4d('0x44')](handleError(_0x319615,null));};exports[_0xcf4d('0x4a')]=function(_0x83870b,_0x4ea62b){return db[_0xcf4d('0x2e')]['create'](_0x83870b[_0xcf4d('0x4b')],{})[_0xcf4d('0x27')](respondWithResult(_0x4ea62b,0xc9))['catch'](handleError(_0x4ea62b,null));};exports[_0xcf4d('0x4c')]=function(_0x387f60,_0x537bf7){return db[_0xcf4d('0x2e')][_0xcf4d('0x4c')](_0x387f60[_0xcf4d('0x4b')],{'raw':![],'individualHooks':!![]})[_0xcf4d('0x27')](respondWithResult(_0x537bf7,0xc9))[_0xcf4d('0x44')](handleError(_0x537bf7,null));};exports[_0xcf4d('0x26')]=function(_0xaa36e9,_0x1d8d9a){if(_0xaa36e9['body']['id']){delete _0xaa36e9[_0xcf4d('0x4b')]['id'];}return db[_0xcf4d('0x2e')][_0xcf4d('0x49')]({'where':{'id':_0xaa36e9[_0xcf4d('0x46')]['id']}})[_0xcf4d('0x27')](handleEntityNotFound(_0x1d8d9a,null))[_0xcf4d('0x27')](saveUpdates(_0xaa36e9[_0xcf4d('0x4b')],null))[_0xcf4d('0x27')](respondWithResult(_0x1d8d9a,null))[_0xcf4d('0x44')](handleError(_0x1d8d9a,null));};exports[_0xcf4d('0x4d')]=function(_0x2bfc8b,_0x34845d){return db[_0xcf4d('0x2e')][_0xcf4d('0x49')]({'where':{'id':_0x2bfc8b[_0xcf4d('0x46')]['id']}})[_0xcf4d('0x27')](handleEntityNotFound(_0x34845d,null))[_0xcf4d('0x27')](removeEntity(_0x34845d,null))[_0xcf4d('0x44')](handleError(_0x34845d,null));};exports[_0xcf4d('0x4e')]=function(_0xb9e4ef,_0x223608){return db['AnalyticFieldReport'][_0xcf4d('0x4d')]({'where':{'id':_0xb9e4ef[_0xcf4d('0x36')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xcf4d('0x27')](respondWithResult(_0x223608,0xcc))[_0xcf4d('0x44')](handleError(_0x223608,null));};exports[_0xcf4d('0x4f')]=function(_0x50ec99,_0x2002cd,_0x4fb46a){return db[_0xcf4d('0x50')][_0xcf4d('0x51')]({'where':{'id':_0x50ec99[_0xcf4d('0x46')]['id']}})[_0xcf4d('0x27')](handleEntityNotFound(_0x2002cd,null))[_0xcf4d('0x27')](function(_0x2d9639){if(_0x2d9639){return db[_0xcf4d('0x52')][_0xcf4d('0x53')](function(_0xa4f07b){return db['AnalyticFieldReport'][_0xcf4d('0x4d')]({'where':{'CustomReportId':_0x50ec99[_0xcf4d('0x46')]['id']},'transaction':_0xa4f07b})['then'](function(_0x16bba6){var _0x4dde92=_[_0xcf4d('0x2d')](_0x50ec99[_0xcf4d('0x4b')],function(_0x614051){delete _0x614051['id'];_0x614051[_0xcf4d('0x54')]=_0x50ec99[_0xcf4d('0x46')]['id'];return _0x614051;});return db[_0xcf4d('0x2e')][_0xcf4d('0x4c')](_0x4dde92,{'transaction':_0xa4f07b});});})[_0xcf4d('0x27')](function(){return db[_0xcf4d('0x2e')][_0xcf4d('0x42')]({'where':{'CustomReportId':_0x50ec99[_0xcf4d('0x46')]['id']}});});}})[_0xcf4d('0x27')](respondWithResult(_0x2002cd,null))['catch'](handleError(_0x2002cd,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index a90554e..69b5909 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 _0x9284=['lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x2b9e39,_0xca0c84){var _0x239e79=function(_0x583f7d){while(--_0x583f7d){_0x2b9e39['push'](_0x2b9e39['shift']());}};_0x239e79(++_0xca0c84);}(_0x9284,0x1a4));var _0x4928=function(_0x17789d,_0x5d0c27){_0x17789d=_0x17789d-0x0;var _0x2c1d3a=_0x9284[_0x17789d];return _0x2c1d3a;};'use strict';var _=require(_0x4928('0x0'));var util=require('util');var logger=require(_0x4928('0x1'))(_0x4928('0x2'));var moment=require('moment');var BPromise=require(_0x4928('0x3'));var rp=require(_0x4928('0x4'));var fs=require('fs');var path=require(_0x4928('0x5'));var rimraf=require('rimraf');var config=require(_0x4928('0x6'));var attributes=require(_0x4928('0x7'));module[_0x4928('0x8')]=function(_0x400af1,_0x166e88){return _0x400af1[_0x4928('0x9')](_0x4928('0xa'),attributes,{'tableName':_0x4928('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1994=['api','path','rimraf','../../config/environment','exports','define','analytics_report_fields','util'];(function(_0x217cb0,_0x5562b3){var _0x4e906b=function(_0x55f315){while(--_0x55f315){_0x217cb0['push'](_0x217cb0['shift']());}};_0x4e906b(++_0x5562b3);}(_0x1994,0x12f));var _0x4199=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1994[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x4199('0x0'));var logger=require('../../config/logger')(_0x4199('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4199('0x2'));var rimraf=require(_0x4199('0x3'));var config=require(_0x4199('0x4'));var attributes=require('./analyticFieldReport.attributes');module[_0x4199('0x5')]=function(_0x58be8e,_0x58e93b){return _0x58be8e[_0x4199('0x6')]('AnalyticFieldReport',attributes,{'tableName':_0x4199('0x7'),'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 715c98a..98d23c3 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 _0xb81a=['then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x5f519b,_0x5b606f){var _0x2461e2=function(_0x510241){while(--_0x510241){_0x5f519b['push'](_0x5f519b['shift']());}};_0x2461e2(++_0x5b606f);}(_0xb81a,0x16a));var _0xab81=function(_0x34a78f,_0x103dd1){_0x34a78f=_0x34a78f-0x0;var _0x4ea069=_0xb81a[_0x34a78f];return _0x4ea069;};'use strict';var _=require(_0xab81('0x0'));var util=require(_0xab81('0x1'));var moment=require(_0xab81('0x2'));var BPromise=require(_0xab81('0x3'));var rs=require(_0xab81('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab81('0x5'))['db'];var utils=require(_0xab81('0x6'));var logger=require(_0xab81('0x7'))(_0xab81('0x8'));var config=require('../../config/environment');var jayson=require(_0xab81('0x9'));var client=jayson[_0xab81('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ca5f2,_0x5542eb,_0x5ba916){return new BPromise(function(_0x10ee09,_0x54fdc1){return client[_0xab81('0xb')](_0x3ca5f2,_0x5ba916)[_0xab81('0xc')](function(_0x534178){logger[_0xab81('0xd')](_0xab81('0xe'),_0x5542eb,'request\x20sent');logger['debug'](_0xab81('0xf'),_0x5542eb,'request\x20sent',JSON['stringify'](_0x534178));if(_0x534178['error']){if(_0x534178[_0xab81('0x10')][_0xab81('0x11')]===0x1f4){logger[_0xab81('0x10')](_0xab81('0xe'),_0x5542eb,_0x534178[_0xab81('0x10')][_0xab81('0x12')]);return _0x54fdc1(_0x534178[_0xab81('0x10')]['message']);}logger[_0xab81('0x10')](_0xab81('0xe'),_0x5542eb,_0x534178['error'][_0xab81('0x12')]);return _0x10ee09(_0x534178[_0xab81('0x10')][_0xab81('0x12')]);}else{logger['info'](_0xab81('0xe'),_0x5542eb,_0xab81('0x13'));_0x10ee09(_0x534178[_0xab81('0x14')][_0xab81('0x12')]);}})[_0xab81('0x15')](function(_0x53b159){logger[_0xab81('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5542eb,_0x53b159);_0x54fdc1(_0x53b159);});});} \ No newline at end of file +var _0x7ead=['error','code','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc29d9f,_0x373cbd){var _0x56f261=function(_0x53c8b0){while(--_0x53c8b0){_0xc29d9f['push'](_0xc29d9f['shift']());}};_0x56f261(++_0x373cbd);}(_0x7ead,0x91));var _0xd7ea=function(_0xd5b714,_0x170a07){_0xd5b714=_0xd5b714-0x0;var _0x2be30d=_0x7ead[_0xd5b714];return _0x2be30d;};'use strict';var _=require(_0xd7ea('0x0'));var util=require('util');var moment=require(_0xd7ea('0x1'));var BPromise=require(_0xd7ea('0x2'));var rs=require(_0xd7ea('0x3'));var fs=require('fs');var Redis=require(_0xd7ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7ea('0x5'));var config=require(_0xd7ea('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd7ea('0x7')][_0xd7ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x176ffc,_0x1aa17e,_0x128c09){return new BPromise(function(_0x173a0a,_0x26800f){return client[_0xd7ea('0x9')](_0x176ffc,_0x128c09)[_0xd7ea('0xa')](function(_0xe5f2e5){logger[_0xd7ea('0xb')](_0xd7ea('0xc'),_0x1aa17e,'request\x20sent');logger['debug'](_0xd7ea('0xd'),_0x1aa17e,'request\x20sent',JSON[_0xd7ea('0xe')](_0xe5f2e5));if(_0xe5f2e5[_0xd7ea('0xf')]){if(_0xe5f2e5[_0xd7ea('0xf')][_0xd7ea('0x10')]===0x1f4){logger[_0xd7ea('0xf')](_0xd7ea('0xc'),_0x1aa17e,_0xe5f2e5['error'][_0xd7ea('0x11')]);return _0x26800f(_0xe5f2e5[_0xd7ea('0xf')]['message']);}logger[_0xd7ea('0xf')](_0xd7ea('0xc'),_0x1aa17e,_0xe5f2e5[_0xd7ea('0xf')][_0xd7ea('0x11')]);return _0x173a0a(_0xe5f2e5[_0xd7ea('0xf')]['message']);}else{logger[_0xd7ea('0xb')](_0xd7ea('0xc'),_0x1aa17e,_0xd7ea('0x12'));_0x173a0a(_0xe5f2e5['result'][_0xd7ea('0x11')]);}})[_0xd7ea('0x13')](function(_0xc7b26a){logger[_0xd7ea('0xf')](_0xd7ea('0xc'),_0x1aa17e,_0xc7b26a);_0x26800f(_0xc7b26a);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ddcf74a..6366922 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(_0x3f8a34,_0x4571a0){var _0x34f031=function(_0x2ae3b8){while(--_0x2ae3b8){_0x3f8a34['push'](_0x3f8a34['shift']());}};_0x34f031(++_0x4571a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x4e46ce,_0x443bf8){var _0x5d415c=function(_0x54cb24){while(--_0x54cb24){_0x4e46ce['push'](_0x4e46ce['shift']());}};_0x5d415c(++_0x443bf8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 58d2ece..99500cd 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 _0x2ca5=['exports','STRING','name','TEXT'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x2ca5,0x108));var _0x52ca=function(_0x45d56b,_0x3b99e4){_0x45d56b=_0x45d56b-0x0;var _0xd62e37=_0x2ca5[_0x45d56b];return _0xd62e37;};'use strict';var Sequelize=require('sequelize');module[_0x52ca('0x0')]={'name':{'type':Sequelize[_0x52ca('0x1')],'allowNull':![],'unique':_0x52ca('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x52ca('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x682e=['name','TEXT','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x682e,0x1ce));var _0xe682=function(_0x406206,_0x14479b){_0x406206=_0x406206-0x0;var _0x1db534=_0x682e[_0x406206];return _0x1db534;};'use strict';var Sequelize=require(_0xe682('0x0'));module[_0xe682('0x1')]={'name':{'type':Sequelize[_0xe682('0x2')],'allowNull':![],'unique':_0xe682('0x3')},'table':{'type':Sequelize[_0xe682('0x2')]},'metric':{'type':Sequelize[_0xe682('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 326d5df..ee2d4e5 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x491c56,_0x3f8a3a){var _0x2a5f36=function(_0x1e0b94){while(--_0x1e0b94){_0x491c56['push'](_0x491c56['shift']());}};_0x2a5f36(++_0x3f8a3a);}(_0x8ef6,0xf2));var _0x68ef=function(_0x43be9d,_0x451fae){_0x43be9d=_0x43be9d-0x0;var _0x1ddb18=_0x8ef6[_0x43be9d];return _0x1ddb18;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file +var _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x2abafe,_0x20d684){var _0x5913f3=function(_0x165aeb){while(--_0x165aeb){_0x2abafe['push'](_0x2abafe['shift']());}};_0x5913f3(++_0x20d684);}(_0xa41a,0x6b));var _0xaa41=function(_0x857beb,_0x15da63){_0x857beb=_0x857beb-0x0;var _0x420865=_0xa41a[_0x857beb];return _0x420865;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index eccfdd0..7351c09 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 _0x3c6c=['rimraf','../../config/environment','exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x2acf48,_0x176934){_0x2acf48=_0x2acf48-0x0;var _0x4a5b1e=_0x3c6c[_0x2acf48];return _0x4a5b1e;};'use strict';var _=require(_0xc3c6('0x0'));var util=require('util');var logger=require(_0xc3c6('0x1'))(_0xc3c6('0x2'));var moment=require(_0xc3c6('0x3'));var BPromise=require(_0xc3c6('0x4'));var rp=require(_0xc3c6('0x5'));var fs=require('fs');var path=require(_0xc3c6('0x6'));var rimraf=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var attributes=require('./analyticMetric.attributes');module[_0xc3c6('0x9')]=function(_0x4a2ca1,_0xe7731e){return _0x4a2ca1['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdedd=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x1c8bf7,_0x2e298b){var _0x210bb0=function(_0x586261){while(--_0x586261){_0x1c8bf7['push'](_0x1c8bf7['shift']());}};_0x210bb0(++_0x2e298b);}(_0xdedd,0x197));var _0xdded=function(_0x3b8adb,_0x4ec2d1){_0x3b8adb=_0x3b8adb-0x0;var _0x1fcc95=_0xdedd[_0x3b8adb];return _0x1fcc95;};'use strict';var _=require(_0xdded('0x0'));var util=require(_0xdded('0x1'));var logger=require(_0xdded('0x2'))(_0xdded('0x3'));var moment=require(_0xdded('0x4'));var BPromise=require('bluebird');var rp=require(_0xdded('0x5'));var fs=require('fs');var path=require(_0xdded('0x6'));var rimraf=require(_0xdded('0x7'));var config=require(_0xdded('0x8'));var attributes=require(_0xdded('0x9'));module[_0xdded('0xa')]=function(_0x2e327c,_0x277fab){return _0x2e327c['define']('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 20d63ed..9222558 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 _0xf603=['http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x410787,_0x53f6d5){var _0xc635d8=function(_0x264cd9){while(--_0x264cd9){_0x410787['push'](_0x410787['shift']());}};_0xc635d8(++_0x53f6d5);}(_0xf603,0x1c3));var _0x3f60=function(_0x1b9207,_0x4ae729){_0x1b9207=_0x1b9207-0x0;var _0x54630b=_0xf603[_0x1b9207];return _0x54630b;};'use strict';var _=require(_0x3f60('0x0'));var util=require('util');var moment=require(_0x3f60('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f60('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f60('0x3'));var logger=require(_0x3f60('0x4'))(_0x3f60('0x5'));var config=require(_0x3f60('0x6'));var jayson=require(_0x3f60('0x7'));var client=jayson[_0x3f60('0x8')][_0x3f60('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2feec7,_0x3d0899,_0x2a7bf0){return new BPromise(function(_0x35352f,_0x2abd9e){return client[_0x3f60('0xa')](_0x2feec7,_0x2a7bf0)[_0x3f60('0xb')](function(_0x3331fd){logger[_0x3f60('0xc')](_0x3f60('0xd'),_0x3d0899,_0x3f60('0xe'));logger[_0x3f60('0xf')](_0x3f60('0x10'),_0x3d0899,_0x3f60('0xe'),JSON[_0x3f60('0x11')](_0x3331fd));if(_0x3331fd[_0x3f60('0x12')]){if(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x13')]===0x1f4){logger[_0x3f60('0x12')](_0x3f60('0xd'),_0x3d0899,_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);return _0x2abd9e(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);}logger['error'](_0x3f60('0xd'),_0x3d0899,_0x3331fd['error']['message']);return _0x35352f(_0x3331fd[_0x3f60('0x12')][_0x3f60('0x14')]);}else{logger[_0x3f60('0xc')](_0x3f60('0xd'),_0x3d0899,_0x3f60('0xe'));_0x35352f(_0x3331fd[_0x3f60('0x15')]['message']);}})[_0x3f60('0x16')](function(_0x37efde){logger[_0x3f60('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x3d0899,_0x37efde);_0x2abd9e(_0x37efde);});});} \ No newline at end of file +var _0x9e8f=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x38751b,_0x3b64ee){var _0xb6339d=function(_0x114a9d){while(--_0x114a9d){_0x38751b['push'](_0x38751b['shift']());}};_0xb6339d(++_0x3b64ee);}(_0x9e8f,0x121));var _0xf9e8=function(_0xba3720,_0x311343){_0xba3720=_0xba3720-0x0;var _0x5a9ac2=_0x9e8f[_0xba3720];return _0x5a9ac2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf9e8('0x0'));var rs=require(_0xf9e8('0x1'));var fs=require('fs');var Redis=require(_0xf9e8('0x2'));var db=require(_0xf9e8('0x3'))['db'];var utils=require(_0xf9e8('0x4'));var logger=require(_0xf9e8('0x5'))('rpc');var config=require(_0xf9e8('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf9e8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2e481f,_0x433ce4,_0x2af637){return new BPromise(function(_0x4d324e,_0x213fc4){return client[_0xf9e8('0x8')](_0x2e481f,_0x2af637)[_0xf9e8('0x9')](function(_0x1e50c7){logger[_0xf9e8('0xa')](_0xf9e8('0xb'),_0x433ce4,_0xf9e8('0xc'));logger[_0xf9e8('0xd')](_0xf9e8('0xe'),_0x433ce4,_0xf9e8('0xc'),JSON[_0xf9e8('0xf')](_0x1e50c7));if(_0x1e50c7[_0xf9e8('0x10')]){if(_0x1e50c7[_0xf9e8('0x10')]['code']===0x1f4){logger[_0xf9e8('0x10')](_0xf9e8('0xb'),_0x433ce4,_0x1e50c7[_0xf9e8('0x10')][_0xf9e8('0x11')]);return _0x213fc4(_0x1e50c7[_0xf9e8('0x10')][_0xf9e8('0x11')]);}logger['error'](_0xf9e8('0xb'),_0x433ce4,_0x1e50c7['error']['message']);return _0x4d324e(_0x1e50c7[_0xf9e8('0x10')]['message']);}else{logger[_0xf9e8('0xa')](_0xf9e8('0xb'),_0x433ce4,_0xf9e8('0xc'));_0x4d324e(_0x1e50c7[_0xf9e8('0x12')]['message']);}})[_0xf9e8('0x13')](function(_0x55fe3f){logger[_0xf9e8('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x433ce4,_0x55fe3f);_0x213fc4(_0x55fe3f);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index f073527..40cbf64 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 _0x6208=['put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x2ef265,_0x3c6a95){var _0x2299af=function(_0x3f18e2){while(--_0x3f18e2){_0x2ef265['push'](_0x2ef265['shift']());}};_0x2299af(++_0x3c6a95);}(_0x6208,0x17d));var _0x8620=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x6208[_0x2d4065];return _0xef6016;};'use strict';var multer=require(_0x8620('0x0'));var util=require('util');var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require('express');var router=express[_0x8620('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8620('0x4'));var interaction=require(_0x8620('0x5'));var config=require(_0x8620('0x6'));var controller=require(_0x8620('0x7'));router[_0x8620('0x8')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xa')]);router['get'](_0x8620('0xb'),auth[_0x8620('0x9')](),controller[_0x8620('0xc')]);router[_0x8620('0xd')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xe')]);router[_0x8620('0xf')](_0x8620('0xb'),auth[_0x8620('0x9')](),controller['update']);router[_0x8620('0x10')](_0x8620('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8620('0x11')]=router; \ No newline at end of file +var _0x4873=['update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','show','post','create','/:id'];(function(_0x1b855a,_0x462bde){var _0x37cc87=function(_0x14ef89){while(--_0x14ef89){_0x1b855a['push'](_0x1b855a['shift']());}};_0x37cc87(++_0x462bde);}(_0x4873,0x1df));var _0x3487=function(_0x3bf569,_0x5e8edb){_0x3bf569=_0x3bf569-0x0;var _0x1041f3=_0x4873[_0x3bf569];return _0x1041f3;};'use strict';var multer=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var path=require(_0x3487('0x2'));var timeout=require('connect-timeout');var express=require(_0x3487('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3487('0x4'));var interaction=require(_0x3487('0x5'));var config=require(_0x3487('0x6'));var controller=require(_0x3487('0x7'));router[_0x3487('0x8')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xa')]);router[_0x3487('0x8')]('/:id',auth[_0x3487('0x9')](),controller[_0x3487('0xb')]);router[_0x3487('0xc')]('/',auth[_0x3487('0x9')](),controller[_0x3487('0xd')]);router['put'](_0x3487('0xe'),auth['isAuthenticated'](),controller[_0x3487('0xf')]);router[_0x3487('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3487('0x11')]);module[_0x3487('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index acad3cd..664f60e 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 _0x2a56=['exports','TEXT','sequelize'];(function(_0x5496ff,_0x104d17){var _0x36881c=function(_0x395a82){while(--_0x395a82){_0x5496ff['push'](_0x5496ff['shift']());}};_0x36881c(++_0x104d17);}(_0x2a56,0x1c7));var _0x62a5=function(_0x29b38c,_0x87560d){_0x29b38c=_0x29b38c-0x0;var _0x36bfd5=_0x2a56[_0x29b38c];return _0x36bfd5;};'use strict';var Sequelize=require(_0x62a5('0x0'));module[_0x62a5('0x1')]={'tree':{'type':Sequelize[_0x62a5('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf33f=['exports','TEXT','sequelize'];(function(_0x3dd848,_0x1016f6){var _0x4aadad=function(_0x353a80){while(--_0x353a80){_0x3dd848['push'](_0x3dd848['shift']());}};_0x4aadad(++_0x1016f6);}(_0xf33f,0x13d));var _0xff33=function(_0x49106d,_0x502043){_0x49106d=_0x49106d-0x0;var _0x16231a=_0xf33f[_0x49106d];return _0x16231a;};'use strict';var Sequelize=require(_0xff33('0x0'));module[_0xff33('0x1')]={'tree':{'type':Sequelize[_0xff33('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index de162c2..cdcbe04 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 _0xf411=['type','VIRTUAL','options','includeAll','catch','show','params','keys','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','hasOwnProperty','limit','where','filter','merge'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xf411,0x98));var _0x1f41=function(_0x2ee712,_0x5a2179){_0x2ee712=_0x2ee712-0x0;var _0x2e8783=_0xf411[_0x2ee712];return _0x2e8783;};'use strict';var emlformat=require(_0x1f41('0x0'));var rimraf=require(_0x1f41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f41('0x2'));var rp=require(_0x1f41('0x3'));var moment=require(_0x1f41('0x4'));var BPromise=require(_0x1f41('0x5'));var Mustache=require(_0x1f41('0x6'));var util=require(_0x1f41('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x1f41('0x8'));var ejs=require(_0x1f41('0x9'));var fs=require('fs');var fs_extra=require(_0x1f41('0xa'));var _=require(_0x1f41('0xb'));var squel=require(_0x1f41('0xc'));var crypto=require('crypto');var jsforce=require(_0x1f41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1f41('0x8'));var querystring=require(_0x1f41('0xe'));var Papa=require(_0x1f41('0xf'));var Redis=require('ioredis');var authService=require(_0x1f41('0x10'));var qs=require(_0x1f41('0x11'));var as=require(_0x1f41('0x12'));var hardwareService=require(_0x1f41('0x13'));var logger=require(_0x1f41('0x14'))(_0x1f41('0x15'));var utils=require(_0x1f41('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f41('0x17'))['db'];function respondWithStatusCode(_0x148b9a,_0x2ffc46){_0x2ffc46=_0x2ffc46||0xcc;return function(_0x11c3c5){if(_0x11c3c5){return _0x148b9a['sendStatus'](_0x2ffc46);}return _0x148b9a[_0x1f41('0x18')](_0x2ffc46)['end']();};}function respondWithResult(_0x2dac4c,_0x557ff8){_0x557ff8=_0x557ff8||0xc8;return function(_0x8de505){if(_0x8de505){return _0x2dac4c[_0x1f41('0x18')](_0x557ff8)[_0x1f41('0x19')](_0x8de505);}};}function respondWithFilteredResult(_0x507652,_0x541a3c){return function(_0x196acd){if(_0x196acd){var _0x9a7fbc=typeof _0x541a3c[_0x1f41('0x1a')]===_0x1f41('0x1b')&&typeof _0x541a3c['limit']===_0x1f41('0x1b');var _0x768646=_0x196acd[_0x1f41('0x1c')];var _0x3ea6ff=_0x9a7fbc?0x0:_0x541a3c[_0x1f41('0x1a')];var _0x5e8dfc=_0x9a7fbc?_0x196acd[_0x1f41('0x1c')]:_0x541a3c[_0x1f41('0x1a')]+_0x541a3c['limit'];var _0x1d44ef;if(_0x5e8dfc>=_0x768646){_0x5e8dfc=_0x768646;_0x1d44ef=0xc8;}else{_0x1d44ef=0xce;}_0x507652['status'](_0x1d44ef);return _0x507652[_0x1f41('0x1d')](_0x1f41('0x1e'),_0x3ea6ff+'-'+_0x5e8dfc+'/'+_0x768646)[_0x1f41('0x19')](_0x196acd);}return null;};}function patchUpdates(_0x3d8008){return function(_0x26e2fc){try{jsonpatch[_0x1f41('0x1f')](_0x26e2fc,_0x3d8008,!![]);}catch(_0x55f746){return BPromise['reject'](_0x55f746);}return _0x26e2fc[_0x1f41('0x20')]();};}function saveUpdates(_0x2c6624,_0x2abceb){return function(_0x26c159){if(_0x26c159){return _0x26c159[_0x1f41('0x21')](_0x2c6624)[_0x1f41('0x22')](function(_0x2641fa){return _0x2641fa;});}return null;};}function removeEntity(_0x59ea4d,_0x19977f){return function(_0x224fbd){if(_0x224fbd){return _0x224fbd[_0x1f41('0x23')]()[_0x1f41('0x22')](function(){_0x59ea4d[_0x1f41('0x18')](0xcc)[_0x1f41('0x24')]();});}};}function handleEntityNotFound(_0x168197,_0x3bce12){return function(_0x59269b){if(!_0x59269b){_0x168197[_0x1f41('0x25')](0x194);}return _0x59269b;};}function handleError(_0xf9a529,_0x5a5f38){_0x5a5f38=_0x5a5f38||0x1f4;return function(_0x23780){logger[_0x1f41('0x26')](_0x23780[_0x1f41('0x27')]);if(_0x23780[_0x1f41('0x28')]){delete _0x23780['name'];}_0xf9a529[_0x1f41('0x18')](_0x5a5f38)[_0x1f41('0x29')](_0x23780);};}exports['index']=function(_0x415d30,_0x2aab27){var _0x45e687={},_0x1f0c9c={},_0x2710ef={'count':0x0,'rows':[]};var _0x273e66=_[_0x1f41('0x2a')](db[_0x1f41('0x2b')][_0x1f41('0x2c')],function(_0x51a323){return{'name':_0x51a323[_0x1f41('0x2d')],'type':_0x51a323['type'][_0x1f41('0x2e')]};});_0x1f0c9c['model']=_[_0x1f41('0x2a')](_0x273e66,_0x1f41('0x28'));_0x1f0c9c[_0x1f41('0x2f')]=_['keys'](_0x415d30['query']);_0x1f0c9c[_0x1f41('0x30')]=_[_0x1f41('0x31')](_0x1f0c9c['model'],_0x1f0c9c[_0x1f41('0x2f')]);_0x45e687[_0x1f41('0x32')]=_['intersection'](_0x1f0c9c[_0x1f41('0x33')],qs[_0x1f41('0x34')](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x34')]));_0x45e687[_0x1f41('0x32')]=_0x45e687[_0x1f41('0x32')]['length']?_0x45e687[_0x1f41('0x32')]:_0x1f0c9c[_0x1f41('0x33')];if(!_0x415d30[_0x1f41('0x2f')][_0x1f41('0x35')]('nolimit')){_0x45e687[_0x1f41('0x36')]=qs['limit'](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x36')]);_0x45e687[_0x1f41('0x1a')]=qs[_0x1f41('0x1a')](_0x415d30[_0x1f41('0x2f')][_0x1f41('0x1a')]);}_0x45e687['order']=qs['sort'](_0x415d30[_0x1f41('0x2f')]['sort']);_0x45e687[_0x1f41('0x37')]=qs[_0x1f41('0x30')](_['pick'](_0x415d30[_0x1f41('0x2f')],_0x1f0c9c[_0x1f41('0x30')]),_0x273e66);if(_0x415d30[_0x1f41('0x2f')][_0x1f41('0x38')]){_0x45e687[_0x1f41('0x37')]=_[_0x1f41('0x39')](_0x45e687['where'],{'$or':_['map'](_0x273e66,function(_0x1050bc){if(_0x1050bc[_0x1f41('0x3a')]!==_0x1f41('0x3b')){var _0x71aa17={};_0x71aa17[_0x1050bc[_0x1f41('0x28')]]={'$like':'%'+_0x415d30[_0x1f41('0x2f')][_0x1f41('0x38')]+'%'};return _0x71aa17;}})});}_0x45e687=_[_0x1f41('0x39')]({},_0x45e687,_0x415d30[_0x1f41('0x3c')]);var _0x3d91ae={'where':_0x45e687[_0x1f41('0x37')]};return db[_0x1f41('0x2b')][_0x1f41('0x1c')](_0x3d91ae)[_0x1f41('0x22')](function(_0xef90c8){_0x2710ef['count']=_0xef90c8;if(_0x415d30[_0x1f41('0x2f')][_0x1f41('0x3d')]){_0x45e687['include']=[{'all':!![]}];}return db[_0x1f41('0x2b')]['findAll'](_0x45e687);})['then'](function(_0x1a3aba){_0x2710ef['rows']=_0x1a3aba;return _0x2710ef;})['then'](respondWithFilteredResult(_0x2aab27,_0x45e687))[_0x1f41('0x3e')](handleError(_0x2aab27,null));};exports[_0x1f41('0x3f')]=function(_0x5c4081,_0x1bedc6){var _0x3fab24={'raw':!![],'where':{'id':_0x5c4081[_0x1f41('0x40')]['id']}},_0x5f4fb5={};_0x5f4fb5['model']=_[_0x1f41('0x41')](db[_0x1f41('0x2b')][_0x1f41('0x2c')]);_0x5f4fb5[_0x1f41('0x2f')]=_[_0x1f41('0x41')](_0x5c4081[_0x1f41('0x2f')]);_0x5f4fb5[_0x1f41('0x30')]=_['intersection'](_0x5f4fb5['model'],_0x5f4fb5[_0x1f41('0x2f')]);_0x3fab24['attributes']=_[_0x1f41('0x31')](_0x5f4fb5['model'],qs['fields'](_0x5c4081[_0x1f41('0x2f')][_0x1f41('0x34')]));_0x3fab24['attributes']=_0x3fab24[_0x1f41('0x32')]['length']?_0x3fab24['attributes']:_0x5f4fb5[_0x1f41('0x33')];if(_0x5c4081[_0x1f41('0x2f')]['includeAll']){_0x3fab24[_0x1f41('0x42')]=[{'all':!![]}];}_0x3fab24=_[_0x1f41('0x39')]({},_0x3fab24,_0x5c4081[_0x1f41('0x3c')]);return db[_0x1f41('0x2b')]['find'](_0x3fab24)['then'](handleEntityNotFound(_0x1bedc6,null))[_0x1f41('0x22')](respondWithResult(_0x1bedc6,null))[_0x1f41('0x3e')](handleError(_0x1bedc6,null));};exports[_0x1f41('0x43')]=function(_0x4dd502,_0x37848f){return db[_0x1f41('0x2b')]['create'](_0x4dd502[_0x1f41('0x44')],{})['then'](respondWithResult(_0x37848f,0xc9))['catch'](handleError(_0x37848f,null));};exports[_0x1f41('0x21')]=function(_0x972597,_0x4764e6){if(_0x972597['body']['id']){delete _0x972597[_0x1f41('0x44')]['id'];}return db[_0x1f41('0x2b')][_0x1f41('0x45')]({'where':{'id':_0x972597[_0x1f41('0x40')]['id']}})[_0x1f41('0x22')](handleEntityNotFound(_0x4764e6,null))[_0x1f41('0x22')](saveUpdates(_0x972597['body'],null))['then'](respondWithResult(_0x4764e6,null))[_0x1f41('0x3e')](handleError(_0x4764e6,null));};exports['destroy']=function(_0x4d015a,_0x45eacb){return db[_0x1f41('0x2b')][_0x1f41('0x45')]({'where':{'id':_0x4d015a[_0x1f41('0x40')]['id']}})[_0x1f41('0x22')](handleEntityNotFound(_0x45eacb,null))['then'](removeEntity(_0x45eacb,null))['catch'](handleError(_0x45eacb,null));}; \ No newline at end of file +var _0x925a=['merge','VIRTUAL','options','include','AnalyticTreeReport','findAll','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x38925f,_0x22bfb4){var _0x2cfb07=function(_0x19cea4){while(--_0x19cea4){_0x38925f['push'](_0x38925f['shift']());}};_0x2cfb07(++_0x22bfb4);}(_0x925a,0x183));var _0xa925=function(_0x2d721e,_0x24c917){_0x2d721e=_0x2d721e-0x0;var _0x961030=_0x925a[_0x2d721e];return _0x961030;};'use strict';var emlformat=require(_0xa925('0x0'));var rimraf=require(_0xa925('0x1'));var zipdir=require(_0xa925('0x2'));var jsonpatch=require(_0xa925('0x3'));var rp=require(_0xa925('0x4'));var moment=require(_0xa925('0x5'));var BPromise=require(_0xa925('0x6'));var Mustache=require(_0xa925('0x7'));var util=require(_0xa925('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa925('0x9'));var fs=require('fs');var fs_extra=require(_0xa925('0xa'));var _=require(_0xa925('0xb'));var squel=require(_0xa925('0xc'));var crypto=require(_0xa925('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa925('0xe'));var toCsv=require(_0xa925('0xf'));var querystring=require('querystring');var Papa=require(_0xa925('0x10'));var Redis=require(_0xa925('0x11'));var authService=require(_0xa925('0x12'));var qs=require(_0xa925('0x13'));var as=require(_0xa925('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa925('0x15'))(_0xa925('0x16'));var utils=require(_0xa925('0x17'));var config=require(_0xa925('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xa925('0x19'))['db'];function respondWithStatusCode(_0x17ff3c,_0x3bee2c){_0x3bee2c=_0x3bee2c||0xcc;return function(_0x3f42ab){if(_0x3f42ab){return _0x17ff3c[_0xa925('0x1a')](_0x3bee2c);}return _0x17ff3c['status'](_0x3bee2c)[_0xa925('0x1b')]();};}function respondWithResult(_0x1b3725,_0x453e94){_0x453e94=_0x453e94||0xc8;return function(_0x1846a4){if(_0x1846a4){return _0x1b3725[_0xa925('0x1c')](_0x453e94)[_0xa925('0x1d')](_0x1846a4);}};}function respondWithFilteredResult(_0x3efa83,_0x4c5009){return function(_0x133b19){if(_0x133b19){var _0x182db1=typeof _0x4c5009[_0xa925('0x1e')]===_0xa925('0x1f')&&typeof _0x4c5009[_0xa925('0x20')]===_0xa925('0x1f');var _0x57a275=_0x133b19['count'];var _0x21ef44=_0x182db1?0x0:_0x4c5009['offset'];var _0x73dedb=_0x182db1?_0x133b19[_0xa925('0x21')]:_0x4c5009['offset']+_0x4c5009[_0xa925('0x20')];var _0x3e4af3;if(_0x73dedb>=_0x57a275){_0x73dedb=_0x57a275;_0x3e4af3=0xc8;}else{_0x3e4af3=0xce;}_0x3efa83['status'](_0x3e4af3);return _0x3efa83[_0xa925('0x22')](_0xa925('0x23'),_0x21ef44+'-'+_0x73dedb+'/'+_0x57a275)[_0xa925('0x1d')](_0x133b19);}return null;};}function patchUpdates(_0x314113){return function(_0x4ce633){try{jsonpatch[_0xa925('0x24')](_0x4ce633,_0x314113,!![]);}catch(_0x75799b){return BPromise[_0xa925('0x25')](_0x75799b);}return _0x4ce633[_0xa925('0x26')]();};}function saveUpdates(_0x1a97c3,_0x2c4ef6){return function(_0x33dd85){if(_0x33dd85){return _0x33dd85[_0xa925('0x27')](_0x1a97c3)[_0xa925('0x28')](function(_0x3dc77f){return _0x3dc77f;});}return null;};}function removeEntity(_0x7353d8,_0x51f3b5){return function(_0x11d28){if(_0x11d28){return _0x11d28['destroy']()[_0xa925('0x28')](function(){_0x7353d8[_0xa925('0x1c')](0xcc)[_0xa925('0x1b')]();});}};}function handleEntityNotFound(_0x2cbd2d,_0x532959){return function(_0x4bd22e){if(!_0x4bd22e){_0x2cbd2d[_0xa925('0x1a')](0x194);}return _0x4bd22e;};}function handleError(_0x15d851,_0x53a1bd){_0x53a1bd=_0x53a1bd||0x1f4;return function(_0x5299dc){logger['error'](_0x5299dc[_0xa925('0x29')]);if(_0x5299dc[_0xa925('0x2a')]){delete _0x5299dc['name'];}_0x15d851['status'](_0x53a1bd)[_0xa925('0x2b')](_0x5299dc);};}exports[_0xa925('0x2c')]=function(_0x43eccc,_0xbdde63){var _0x7bc1e9={},_0x33eb64={},_0x2e0134={'count':0x0,'rows':[]};var _0x3eabba=_[_0xa925('0x2d')](db['AnalyticTreeReport'][_0xa925('0x2e')],function(_0x22b54d){return{'name':_0x22b54d['fieldName'],'type':_0x22b54d[_0xa925('0x2f')][_0xa925('0x30')]};});_0x33eb64[_0xa925('0x31')]=_[_0xa925('0x2d')](_0x3eabba,_0xa925('0x2a'));_0x33eb64[_0xa925('0x32')]=_[_0xa925('0x33')](_0x43eccc['query']);_0x33eb64[_0xa925('0x34')]=_[_0xa925('0x35')](_0x33eb64[_0xa925('0x31')],_0x33eb64[_0xa925('0x32')]);_0x7bc1e9[_0xa925('0x36')]=_['intersection'](_0x33eb64[_0xa925('0x31')],qs[_0xa925('0x37')](_0x43eccc[_0xa925('0x32')][_0xa925('0x37')]));_0x7bc1e9[_0xa925('0x36')]=_0x7bc1e9[_0xa925('0x36')][_0xa925('0x38')]?_0x7bc1e9[_0xa925('0x36')]:_0x33eb64[_0xa925('0x31')];if(!_0x43eccc[_0xa925('0x32')][_0xa925('0x39')]('nolimit')){_0x7bc1e9[_0xa925('0x20')]=qs[_0xa925('0x20')](_0x43eccc[_0xa925('0x32')][_0xa925('0x20')]);_0x7bc1e9[_0xa925('0x1e')]=qs['offset'](_0x43eccc[_0xa925('0x32')][_0xa925('0x1e')]);}_0x7bc1e9[_0xa925('0x3a')]=qs[_0xa925('0x3b')](_0x43eccc[_0xa925('0x32')][_0xa925('0x3b')]);_0x7bc1e9[_0xa925('0x3c')]=qs[_0xa925('0x34')](_[_0xa925('0x3d')](_0x43eccc[_0xa925('0x32')],_0x33eb64[_0xa925('0x34')]),_0x3eabba);if(_0x43eccc[_0xa925('0x32')][_0xa925('0x3e')]){_0x7bc1e9[_0xa925('0x3c')]=_[_0xa925('0x3f')](_0x7bc1e9['where'],{'$or':_[_0xa925('0x2d')](_0x3eabba,function(_0x42a0d2){if(_0x42a0d2['type']!==_0xa925('0x40')){var _0x20423c={};_0x20423c[_0x42a0d2[_0xa925('0x2a')]]={'$like':'%'+_0x43eccc[_0xa925('0x32')][_0xa925('0x3e')]+'%'};return _0x20423c;}})});}_0x7bc1e9=_[_0xa925('0x3f')]({},_0x7bc1e9,_0x43eccc[_0xa925('0x41')]);var _0x3cf267={'where':_0x7bc1e9[_0xa925('0x3c')]};return db['AnalyticTreeReport'][_0xa925('0x21')](_0x3cf267)[_0xa925('0x28')](function(_0xac18fb){_0x2e0134['count']=_0xac18fb;if(_0x43eccc[_0xa925('0x32')]['includeAll']){_0x7bc1e9[_0xa925('0x42')]=[{'all':!![]}];}return db[_0xa925('0x43')][_0xa925('0x44')](_0x7bc1e9);})[_0xa925('0x28')](function(_0x5ab254){_0x2e0134['rows']=_0x5ab254;return _0x2e0134;})[_0xa925('0x28')](respondWithFilteredResult(_0xbdde63,_0x7bc1e9))[_0xa925('0x45')](handleError(_0xbdde63,null));};exports['show']=function(_0x494b68,_0xe3706c){var _0x256569={'raw':!![],'where':{'id':_0x494b68[_0xa925('0x46')]['id']}},_0x39903d={};_0x39903d['model']=_['keys'](db[_0xa925('0x43')][_0xa925('0x2e')]);_0x39903d[_0xa925('0x32')]=_['keys'](_0x494b68[_0xa925('0x32')]);_0x39903d['filters']=_[_0xa925('0x35')](_0x39903d[_0xa925('0x31')],_0x39903d[_0xa925('0x32')]);_0x256569[_0xa925('0x36')]=_[_0xa925('0x35')](_0x39903d[_0xa925('0x31')],qs[_0xa925('0x37')](_0x494b68[_0xa925('0x32')]['fields']));_0x256569[_0xa925('0x36')]=_0x256569[_0xa925('0x36')][_0xa925('0x38')]?_0x256569['attributes']:_0x39903d[_0xa925('0x31')];if(_0x494b68['query'][_0xa925('0x47')]){_0x256569['include']=[{'all':!![]}];}_0x256569=_['merge']({},_0x256569,_0x494b68['options']);return db['AnalyticTreeReport'][_0xa925('0x48')](_0x256569)['then'](handleEntityNotFound(_0xe3706c,null))[_0xa925('0x28')](respondWithResult(_0xe3706c,null))[_0xa925('0x45')](handleError(_0xe3706c,null));};exports[_0xa925('0x49')]=function(_0x550f51,_0x126d0c){return db[_0xa925('0x43')][_0xa925('0x49')](_0x550f51[_0xa925('0x4a')],{})[_0xa925('0x28')](respondWithResult(_0x126d0c,0xc9))[_0xa925('0x45')](handleError(_0x126d0c,null));};exports[_0xa925('0x27')]=function(_0x1c88a8,_0xba056f){if(_0x1c88a8[_0xa925('0x4a')]['id']){delete _0x1c88a8[_0xa925('0x4a')]['id'];}return db['AnalyticTreeReport'][_0xa925('0x48')]({'where':{'id':_0x1c88a8[_0xa925('0x46')]['id']}})[_0xa925('0x28')](handleEntityNotFound(_0xba056f,null))[_0xa925('0x28')](saveUpdates(_0x1c88a8[_0xa925('0x4a')],null))[_0xa925('0x28')](respondWithResult(_0xba056f,null))[_0xa925('0x45')](handleError(_0xba056f,null));};exports['destroy']=function(_0x2b3b76,_0x230410){return db[_0xa925('0x43')][_0xa925('0x48')]({'where':{'id':_0x2b3b76[_0xa925('0x46')]['id']}})[_0xa925('0x28')](handleEntityNotFound(_0x230410,null))[_0xa925('0x28')](removeEntity(_0x230410,null))[_0xa925('0x45')](handleError(_0x230410,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a8421e0..6a0639f 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 _0x4eaf=['request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','bluebird'];(function(_0x4b9caa,_0x19a10d){var _0x19e42a=function(_0x4ddc69){while(--_0x4ddc69){_0x4b9caa['push'](_0x4b9caa['shift']());}};_0x19e42a(++_0x19a10d);}(_0x4eaf,0xce));var _0xf4ea=function(_0x3e0449,_0x12096d){_0x3e0449=_0x3e0449-0x0;var _0x26c9cc=_0x4eaf[_0x3e0449];return _0x26c9cc;};'use strict';var _=require(_0xf4ea('0x0'));var util=require('util');var logger=require(_0xf4ea('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf4ea('0x2'));var rp=require(_0xf4ea('0x3'));var fs=require('fs');var path=require(_0xf4ea('0x4'));var rimraf=require(_0xf4ea('0x5'));var config=require(_0xf4ea('0x6'));var attributes=require(_0xf4ea('0x7'));module[_0xf4ea('0x8')]=function(_0x48fc72,_0x1a928e){return _0x48fc72['define'](_0xf4ea('0x9'),attributes,{'tableName':_0xf4ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb300=['request-promise','path','rimraf','../../config/environment','exports','define','analytics_report_trees','lodash','../../config/logger','api','moment'];(function(_0x51674a,_0x77ccff){var _0x13fca6=function(_0x3d6c27){while(--_0x3d6c27){_0x51674a['push'](_0x51674a['shift']());}};_0x13fca6(++_0x77ccff);}(_0xb300,0x1a9));var _0x0b30=function(_0x4a266c,_0x39417e){_0x4a266c=_0x4a266c-0x0;var _0x47e774=_0xb300[_0x4a266c];return _0x47e774;};'use strict';var _=require(_0x0b30('0x0'));var util=require('util');var logger=require(_0x0b30('0x1'))(_0x0b30('0x2'));var moment=require(_0x0b30('0x3'));var BPromise=require('bluebird');var rp=require(_0x0b30('0x4'));var fs=require('fs');var path=require(_0x0b30('0x5'));var rimraf=require(_0x0b30('0x6'));var config=require(_0x0b30('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0x0b30('0x8')]=function(_0x3ce65a,_0x1a6057){return _0x3ce65a[_0x0b30('0x9')]('AnalyticTreeReport',attributes,{'tableName':_0x0b30('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index e49a0fc..e6ce159 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 _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x4f8fdd,_0x888dc4){_0x4f8fdd=_0x4f8fdd-0x0;var _0x1d058d=_0x7a54[_0x4f8fdd];return _0x1d058d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0xaa614c,_0x456cb7){var _0x2a2902=function(_0x24c7fd){while(--_0x24c7fd){_0xaa614c['push'](_0xaa614c['shift']());}};_0x2a2902(++_0x456cb7);}(_0xdb28,0x106));var _0x8db2=function(_0x3d9444,_0x5e316f){_0x3d9444=_0x3d9444-0x0;var _0x152ed1=_0xdb28[_0x3d9444];return _0x152ed1;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b48d967..4452f10 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 _0x195f=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','destroy'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x195f,0xd1));var _0xf195=function(_0x47041d,_0x42153f){_0x47041d=_0x47041d-0x0;var _0x5022bd=_0x195f[_0x47041d];return _0x5022bd;};'use strict';var multer=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var path=require('path');var timeout=require(_0xf195('0x2'));var express=require('express');var router=express[_0xf195('0x3')]();var fs_extra=require(_0xf195('0x4'));var auth=require(_0xf195('0x5'));var interaction=require(_0xf195('0x6'));var config=require(_0xf195('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xf195('0x8')]('/',auth[_0xf195('0x9')](),controller['index']);router[_0xf195('0x8')](_0xf195('0xa'),auth[_0xf195('0x9')](),controller['show']);router[_0xf195('0xb')]('/',auth[_0xf195('0x9')](),controller[_0xf195('0xc')]);router[_0xf195('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf195('0xa'),auth[_0xf195('0x9')](),controller[_0xf195('0xe')]);module[_0xf195('0xf')]=router; \ No newline at end of file +var _0xd3a9=['/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xd3a9,0x1ef));var _0x9d3a=function(_0x34a02c,_0x387382){_0x34a02c=_0x34a02c-0x0;var _0x292656=_0xd3a9[_0x34a02c];return _0x292656;};'use strict';var multer=require(_0x9d3a('0x0'));var util=require(_0x9d3a('0x1'));var path=require('path');var timeout=require(_0x9d3a('0x2'));var express=require(_0x9d3a('0x3'));var router=express[_0x9d3a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9d3a('0x5'));var interaction=require(_0x9d3a('0x6'));var config=require('../../config/environment');var controller=require(_0x9d3a('0x7'));router[_0x9d3a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9d3a('0x8')](_0x9d3a('0x9'),auth[_0x9d3a('0xa')](),controller['show']);router[_0x9d3a('0xb')]('/',auth[_0x9d3a('0xa')](),controller[_0x9d3a('0xc')]);router[_0x9d3a('0xd')]('/:id',auth[_0x9d3a('0xa')](),controller[_0x9d3a('0xe')]);router[_0x9d3a('0xf')](_0x9d3a('0x9'),auth[_0x9d3a('0xa')](),controller[_0x9d3a('0x10')]);module[_0x9d3a('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 f431857..036fcd5 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 _0x8ff9=['exports','STRING','sequelize'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x8ff9,0x188));var _0x98ff=function(_0x38b991,_0xa42a39){_0x38b991=_0x38b991-0x0;var _0x833c5e=_0x8ff9[_0x38b991];return _0x833c5e;};'use strict';var Sequelize=require(_0x98ff('0x0'));module[_0x98ff('0x1')]={'name':{'type':Sequelize[_0x98ff('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x98ff('0x2')]}}; \ No newline at end of file +var _0x38c3=['exports','STRING','sequelize'];(function(_0x3cf9a7,_0x49c35e){var _0x1ff6a1=function(_0x416f21){while(--_0x416f21){_0x3cf9a7['push'](_0x3cf9a7['shift']());}};_0x1ff6a1(++_0x49c35e);}(_0x38c3,0x13d));var _0x338c=function(_0x1cf7e8,_0x3cea71){_0x1cf7e8=_0x1cf7e8-0x0;var _0x3a9a74=_0x38c3[_0x1cf7e8];return _0x3a9a74;};'use strict';var Sequelize=require(_0x338c('0x0'));module[_0x338c('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x338c('0x2')]},'type':{'type':Sequelize[_0x338c('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 93811c3..ff9e48b 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 _0x5a36=['include','findAll','rows','catch','params','clone','find','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x19d6a1,_0x3ad861){var _0x5c69f4=function(_0x49fa5e){while(--_0x49fa5e){_0x19d6a1['push'](_0x19d6a1['shift']());}};_0x5c69f4(++_0x3ad861);}(_0x5a36,0x190));var _0x65a3=function(_0x5cccde,_0x4c6505){_0x5cccde=_0x5cccde-0x0;var _0x40a5b1=_0x5a36[_0x5cccde];return _0x40a5b1;};'use strict';var emlformat=require(_0x65a3('0x0'));var rimraf=require(_0x65a3('0x1'));var zipdir=require(_0x65a3('0x2'));var jsonpatch=require(_0x65a3('0x3'));var rp=require(_0x65a3('0x4'));var moment=require(_0x65a3('0x5'));var BPromise=require(_0x65a3('0x6'));var Mustache=require('mustache');var util=require(_0x65a3('0x7'));var path=require(_0x65a3('0x8'));var sox=require(_0x65a3('0x9'));var csv=require('to-csv');var ejs=require(_0x65a3('0xa'));var fs=require('fs');var fs_extra=require(_0x65a3('0xb'));var _=require(_0x65a3('0xc'));var squel=require(_0x65a3('0xd'));var crypto=require(_0x65a3('0xe'));var jsforce=require(_0x65a3('0xf'));var deskjs=require(_0x65a3('0x10'));var toCsv=require(_0x65a3('0x11'));var querystring=require(_0x65a3('0x12'));var Papa=require('papaparse');var Redis=require(_0x65a3('0x13'));var authService=require(_0x65a3('0x14'));var qs=require(_0x65a3('0x15'));var as=require(_0x65a3('0x16'));var hardwareService=require(_0x65a3('0x17'));var logger=require('../../config/logger')(_0x65a3('0x18'));var utils=require(_0x65a3('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x65a3('0x1a'));var db=require(_0x65a3('0x1b'))['db'];function respondWithStatusCode(_0x37db5e,_0x29abcb){_0x29abcb=_0x29abcb||0xcc;return function(_0x42da5a){if(_0x42da5a){return _0x37db5e[_0x65a3('0x1c')](_0x29abcb);}return _0x37db5e[_0x65a3('0x1d')](_0x29abcb)['end']();};}function respondWithResult(_0x298810,_0x2c053c){_0x2c053c=_0x2c053c||0xc8;return function(_0x175018){if(_0x175018){return _0x298810[_0x65a3('0x1d')](_0x2c053c)[_0x65a3('0x1e')](_0x175018);}};}function respondWithFilteredResult(_0x5270e5,_0x14fed2){return function(_0x181248){if(_0x181248){var _0x1e6003=typeof _0x14fed2[_0x65a3('0x1f')]===_0x65a3('0x20')&&typeof _0x14fed2[_0x65a3('0x21')]===_0x65a3('0x20');var _0x134d48=_0x181248[_0x65a3('0x22')];var _0x19a5f5=_0x1e6003?0x0:_0x14fed2[_0x65a3('0x1f')];var _0xc2426b=_0x1e6003?_0x181248['count']:_0x14fed2['offset']+_0x14fed2['limit'];var _0x4f22c5;if(_0xc2426b>=_0x134d48){_0xc2426b=_0x134d48;_0x4f22c5=0xc8;}else{_0x4f22c5=0xce;}_0x5270e5[_0x65a3('0x1d')](_0x4f22c5);return _0x5270e5[_0x65a3('0x23')](_0x65a3('0x24'),_0x19a5f5+'-'+_0xc2426b+'/'+_0x134d48)['json'](_0x181248);}return null;};}function patchUpdates(_0x43aaff){return function(_0x3f13ae){try{jsonpatch[_0x65a3('0x25')](_0x3f13ae,_0x43aaff,!![]);}catch(_0x30033a){return BPromise[_0x65a3('0x26')](_0x30033a);}return _0x3f13ae['save']();};}function saveUpdates(_0x44bb27,_0x18e22f){return function(_0x4fba41){if(_0x4fba41){return _0x4fba41[_0x65a3('0x27')](_0x44bb27)['then'](function(_0x5ebb0d){return _0x5ebb0d;});}return null;};}function removeEntity(_0x1fb302,_0x514b9c){return function(_0x53a129){if(_0x53a129){return _0x53a129[_0x65a3('0x28')]()[_0x65a3('0x29')](function(){_0x1fb302['status'](0xcc)[_0x65a3('0x2a')]();});}};}function handleEntityNotFound(_0x27a1cd,_0x52e5a8){return function(_0x350cf5){if(!_0x350cf5){_0x27a1cd[_0x65a3('0x1c')](0x194);}return _0x350cf5;};}function handleError(_0x3ecd82,_0x1c888b){_0x1c888b=_0x1c888b||0x1f4;return function(_0x534c8f){logger[_0x65a3('0x2b')](_0x534c8f['stack']);if(_0x534c8f[_0x65a3('0x2c')]){delete _0x534c8f[_0x65a3('0x2c')];}_0x3ecd82[_0x65a3('0x1d')](_0x1c888b)[_0x65a3('0x2d')](_0x534c8f);};}exports[_0x65a3('0x2e')]=function(_0x4034df,_0x4e9333){var _0x304f15={},_0x392c4a={},_0x443b2f={'count':0x0,'rows':[]};var _0x1e0e72=_[_0x65a3('0x2f')](db[_0x65a3('0x30')][_0x65a3('0x31')],function(_0xa344c2){return{'name':_0xa344c2[_0x65a3('0x32')],'type':_0xa344c2[_0x65a3('0x33')]['key']};});_0x392c4a[_0x65a3('0x34')]=_[_0x65a3('0x2f')](_0x1e0e72,'name');_0x392c4a[_0x65a3('0x35')]=_[_0x65a3('0x36')](_0x4034df['query']);_0x392c4a[_0x65a3('0x37')]=_[_0x65a3('0x38')](_0x392c4a[_0x65a3('0x34')],_0x392c4a['query']);_0x304f15[_0x65a3('0x39')]=_['intersection'](_0x392c4a['model'],qs[_0x65a3('0x3a')](_0x4034df['query'][_0x65a3('0x3a')]));_0x304f15['attributes']=_0x304f15[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x304f15[_0x65a3('0x39')]:_0x392c4a[_0x65a3('0x34')];if(!_0x4034df[_0x65a3('0x35')]['hasOwnProperty'](_0x65a3('0x3c'))){_0x304f15['limit']=qs[_0x65a3('0x21')](_0x4034df[_0x65a3('0x35')][_0x65a3('0x21')]);_0x304f15[_0x65a3('0x1f')]=qs[_0x65a3('0x1f')](_0x4034df['query'][_0x65a3('0x1f')]);}_0x304f15[_0x65a3('0x3d')]=qs[_0x65a3('0x3e')](_0x4034df[_0x65a3('0x35')][_0x65a3('0x3e')]);_0x304f15['where']=qs[_0x65a3('0x37')](_[_0x65a3('0x3f')](_0x4034df[_0x65a3('0x35')],_0x392c4a['filters']),_0x1e0e72);if(_0x4034df[_0x65a3('0x35')][_0x65a3('0x40')]){_0x304f15[_0x65a3('0x41')]=_[_0x65a3('0x42')](_0x304f15[_0x65a3('0x41')],{'$or':_['map'](_0x1e0e72,function(_0x367853){if(_0x367853[_0x65a3('0x33')]!==_0x65a3('0x43')){var _0x47f94d={};_0x47f94d[_0x367853[_0x65a3('0x2c')]]={'$like':'%'+_0x4034df[_0x65a3('0x35')][_0x65a3('0x40')]+'%'};return _0x47f94d;}})});}_0x304f15=_[_0x65a3('0x42')]({},_0x304f15,_0x4034df[_0x65a3('0x44')]);var _0x5a4e3c={'where':_0x304f15[_0x65a3('0x41')]};return db[_0x65a3('0x30')][_0x65a3('0x22')](_0x5a4e3c)[_0x65a3('0x29')](function(_0x4984a3){_0x443b2f[_0x65a3('0x22')]=_0x4984a3;if(_0x4034df['query'][_0x65a3('0x45')]){_0x304f15[_0x65a3('0x46')]=[{'all':!![]}];}return db[_0x65a3('0x30')][_0x65a3('0x47')](_0x304f15);})['then'](function(_0xd7fd45){_0x443b2f[_0x65a3('0x48')]=_0xd7fd45;return _0x443b2f;})[_0x65a3('0x29')](respondWithFilteredResult(_0x4e9333,_0x304f15))[_0x65a3('0x49')](handleError(_0x4e9333,null));};exports['show']=function(_0xc43a18,_0x1f581f){var _0x17ee29={'raw':!![],'where':{'id':_0xc43a18[_0x65a3('0x4a')]['id']}},_0x4b9848={};_0x4b9848[_0x65a3('0x34')]=_[_0x65a3('0x36')](db[_0x65a3('0x30')][_0x65a3('0x31')]);_0x4b9848[_0x65a3('0x35')]=_[_0x65a3('0x36')](_0xc43a18[_0x65a3('0x35')]);_0x4b9848['filters']=_['intersection'](_0x4b9848[_0x65a3('0x34')],_0x4b9848[_0x65a3('0x35')]);_0x17ee29['attributes']=_[_0x65a3('0x38')](_0x4b9848[_0x65a3('0x34')],qs[_0x65a3('0x3a')](_0xc43a18[_0x65a3('0x35')]['fields']));_0x17ee29[_0x65a3('0x39')]=_0x17ee29[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x17ee29[_0x65a3('0x39')]:_0x4b9848[_0x65a3('0x34')];if(_0xc43a18[_0x65a3('0x35')][_0x65a3('0x45')]){_0x17ee29[_0x65a3('0x46')]=[{'all':!![]}];}_0x17ee29=_['merge']({},_0x17ee29,_0xc43a18['options']);return db[_0x65a3('0x30')]['find'](_0x17ee29)['then'](handleEntityNotFound(_0x1f581f,null))[_0x65a3('0x29')](respondWithResult(_0x1f581f,null))[_0x65a3('0x49')](handleError(_0x1f581f,null));};exports[_0x65a3('0x4b')]=function(_0x33df7c,_0x2c3519){var _0x516d12={'where':{'id':_0x33df7c['params']['id']}},_0x572ad7={};_0x572ad7[_0x65a3('0x34')]=_[_0x65a3('0x36')](db[_0x65a3('0x30')]['rawAttributes']);_0x516d12[_0x65a3('0x39')]=_['intersection'](_0x572ad7[_0x65a3('0x34')],qs[_0x65a3('0x3a')](_0x33df7c[_0x65a3('0x35')][_0x65a3('0x3a')]));_0x516d12[_0x65a3('0x39')]=_0x516d12[_0x65a3('0x39')][_0x65a3('0x3b')]?_0x516d12[_0x65a3('0x39')]:_0x572ad7[_0x65a3('0x34')];if(_0x33df7c['query']['includeAll']){_0x516d12[_0x65a3('0x46')]=[{'all':!![]}];}_0x516d12=_[_0x65a3('0x42')]({},_0x516d12,_0x33df7c[_0x65a3('0x44')]);return db[_0x65a3('0x30')][_0x65a3('0x4c')](_0x516d12)[_0x65a3('0x29')](handleEntityNotFound(_0x2c3519,null))[_0x65a3('0x29')](function(_0x2fba1e){if(_0x2fba1e){var _0x32683f=_0x2fba1e['get']({'plain':!![]});_0x32683f=qs[_0x65a3('0x4d')](_0x32683f,['id',_0x65a3('0x4e'),_0x65a3('0x4f')]);_0x33df7c[_0x65a3('0x50')]=_[_0x65a3('0x4d')](_0x33df7c[_0x65a3('0x50')],['id',_0x65a3('0x4e'),_0x65a3('0x4f')]);return db[_0x65a3('0x30')]['create'](_[_0x65a3('0x42')](_0x32683f,_0x33df7c[_0x65a3('0x50')]),{'include':_0x33df7c[_0x65a3('0x35')][_0x65a3('0x45')]?[{'all':!![]}]:undefined});}})[_0x65a3('0x29')](respondWithResult(_0x2c3519,0xc9))[_0x65a3('0x49')](handleError(_0x2c3519,null));};exports[_0x65a3('0x27')]=function(_0x155827,_0xde8879){if(_0x155827['body']['id']){delete _0x155827[_0x65a3('0x50')]['id'];}return db['Attachment'][_0x65a3('0x4c')]({'where':{'id':_0x155827[_0x65a3('0x4a')]['id']}})[_0x65a3('0x29')](handleEntityNotFound(_0xde8879,null))[_0x65a3('0x29')](saveUpdates(_0x155827[_0x65a3('0x50')],null))['then'](respondWithResult(_0xde8879,null))[_0x65a3('0x49')](handleError(_0xde8879,null));};exports['destroy']=function(_0x4f583d,_0x39983f){return db[_0x65a3('0x30')][_0x65a3('0x4c')]({'where':{'id':_0x4f583d[_0x65a3('0x4a')]['id']}})[_0x65a3('0x29')](handleEntityNotFound(_0x39983f,null))[_0x65a3('0x29')](removeEntity(_0x39983f,null))[_0x65a3('0x49')](handleError(_0x39983f,null));};exports[_0x65a3('0x51')]=function(_0x293cfd,_0x37304d,_0x22e6d1){_0x293cfd[_0x65a3('0x50')][_0x65a3('0x2c')]=_0x293cfd[_0x65a3('0x52')][_0x65a3('0x53')];_0x293cfd[_0x65a3('0x50')][_0x65a3('0x54')]=_0x293cfd['file'][_0x65a3('0x55')];_0x293cfd[_0x65a3('0x50')][_0x65a3('0x33')]=_0x293cfd[_0x65a3('0x52')][_0x65a3('0x56')];return db[_0x65a3('0x30')][_0x65a3('0x51')](_0x293cfd[_0x65a3('0x50')])[_0x65a3('0x29')](respondWithResult(_0x37304d,0xc9))[_0x65a3('0x49')](handleError(_0x37304d,null));};exports[_0x65a3('0x57')]=function(_0x504082,_0x881531,_0x5c8404){return db['Attachment'][_0x65a3('0x58')]({'where':{'id':_0x504082[_0x65a3('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x881531,null))['then'](function(_0x4c6bb5){if(_0x4c6bb5){var _0x4d1781=_0x4c6bb5[_0x65a3('0x59')]!==null;var _0x3c1f56=path['join'](config[_0x65a3('0x5a')],_0x65a3('0x5b'));if(_0x4d1781){_0x3c1f56=path[_0x65a3('0x5c')](_0x3c1f56,_0x65a3('0x5d'));}var _0x23eb4e=path[_0x65a3('0x5c')](_0x3c1f56,_0x4c6bb5[_0x65a3('0x54')]);return _0x881531[_0x65a3('0x57')](_0x23eb4e);}})[_0x65a3('0x49')](handleError(_0x881531,null));}; \ No newline at end of file +var _0xcd7c=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','clone','params','get','omit','createdAt','updatedAt','body','file','basename','filename','download','findOne','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','limit','count','Content-Range'];(function(_0x21af3a,_0x27ad01){var _0x471c30=function(_0x453780){while(--_0x453780){_0x21af3a['push'](_0x21af3a['shift']());}};_0x471c30(++_0x27ad01);}(_0xcd7c,0x192));var _0xccd7=function(_0x1b4038,_0x5afe0e){_0x1b4038=_0x1b4038-0x0;var _0x102b79=_0xcd7c[_0x1b4038];return _0x102b79;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccd7('0x0'));var zipdir=require(_0xccd7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xccd7('0x2'));var moment=require(_0xccd7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xccd7('0x4'));var util=require(_0xccd7('0x5'));var path=require('path');var sox=require(_0xccd7('0x6'));var csv=require(_0xccd7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xccd7('0x8'));var _=require(_0xccd7('0x9'));var squel=require(_0xccd7('0xa'));var crypto=require(_0xccd7('0xb'));var jsforce=require(_0xccd7('0xc'));var deskjs=require(_0xccd7('0xd'));var toCsv=require(_0xccd7('0x7'));var querystring=require('querystring');var Papa=require(_0xccd7('0xe'));var Redis=require('ioredis');var authService=require(_0xccd7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xccd7('0x10'));var hardwareService=require(_0xccd7('0x11'));var logger=require(_0xccd7('0x12'))(_0xccd7('0x13'));var utils=require(_0xccd7('0x14'));var config=require(_0xccd7('0x15'));var licenseUtil=require(_0xccd7('0x16'));var db=require(_0xccd7('0x17'))['db'];function respondWithStatusCode(_0x595dc1,_0x4f2260){_0x4f2260=_0x4f2260||0xcc;return function(_0x520eee){if(_0x520eee){return _0x595dc1[_0xccd7('0x18')](_0x4f2260);}return _0x595dc1[_0xccd7('0x19')](_0x4f2260)[_0xccd7('0x1a')]();};}function respondWithResult(_0x313893,_0x13b8dc){_0x13b8dc=_0x13b8dc||0xc8;return function(_0x36589c){if(_0x36589c){return _0x313893['status'](_0x13b8dc)[_0xccd7('0x1b')](_0x36589c);}};}function respondWithFilteredResult(_0x31d9dc,_0x3f1945){return function(_0x129d9a){if(_0x129d9a){var _0xde1c51=typeof _0x3f1945[_0xccd7('0x1c')]===_0xccd7('0x1d')&&typeof _0x3f1945[_0xccd7('0x1e')]===_0xccd7('0x1d');var _0x20b464=_0x129d9a[_0xccd7('0x1f')];var _0x3d9c22=_0xde1c51?0x0:_0x3f1945[_0xccd7('0x1c')];var _0xfb24b0=_0xde1c51?_0x129d9a[_0xccd7('0x1f')]:_0x3f1945[_0xccd7('0x1c')]+_0x3f1945[_0xccd7('0x1e')];var _0x30e60f;if(_0xfb24b0>=_0x20b464){_0xfb24b0=_0x20b464;_0x30e60f=0xc8;}else{_0x30e60f=0xce;}_0x31d9dc['status'](_0x30e60f);return _0x31d9dc['set'](_0xccd7('0x20'),_0x3d9c22+'-'+_0xfb24b0+'/'+_0x20b464)['json'](_0x129d9a);}return null;};}function patchUpdates(_0x1bde96){return function(_0x2170dc){try{jsonpatch[_0xccd7('0x21')](_0x2170dc,_0x1bde96,!![]);}catch(_0x41a471){return BPromise[_0xccd7('0x22')](_0x41a471);}return _0x2170dc[_0xccd7('0x23')]();};}function saveUpdates(_0x1f2799,_0x37572f){return function(_0x12bb6e){if(_0x12bb6e){return _0x12bb6e[_0xccd7('0x24')](_0x1f2799)[_0xccd7('0x25')](function(_0x476d69){return _0x476d69;});}return null;};}function removeEntity(_0x3c1a08,_0xe9cdc1){return function(_0x3a903c){if(_0x3a903c){return _0x3a903c[_0xccd7('0x26')]()['then'](function(){_0x3c1a08[_0xccd7('0x19')](0xcc)[_0xccd7('0x1a')]();});}};}function handleEntityNotFound(_0x1815ad,_0x1935c1){return function(_0x1b6b53){if(!_0x1b6b53){_0x1815ad[_0xccd7('0x18')](0x194);}return _0x1b6b53;};}function handleError(_0x101995,_0x189aa1){_0x189aa1=_0x189aa1||0x1f4;return function(_0x211af9){logger[_0xccd7('0x27')](_0x211af9[_0xccd7('0x28')]);if(_0x211af9[_0xccd7('0x29')]){delete _0x211af9[_0xccd7('0x29')];}_0x101995[_0xccd7('0x19')](_0x189aa1)[_0xccd7('0x2a')](_0x211af9);};}exports[_0xccd7('0x2b')]=function(_0x58669b,_0x44ae5e){var _0x239d10={},_0x561c9e={},_0x1095c4={'count':0x0,'rows':[]};var _0x25fca3=_[_0xccd7('0x2c')](db[_0xccd7('0x2d')][_0xccd7('0x2e')],function(_0x1f91fe){return{'name':_0x1f91fe['fieldName'],'type':_0x1f91fe[_0xccd7('0x2f')][_0xccd7('0x30')]};});_0x561c9e['model']=_[_0xccd7('0x2c')](_0x25fca3,'name');_0x561c9e['query']=_[_0xccd7('0x31')](_0x58669b['query']);_0x561c9e[_0xccd7('0x32')]=_[_0xccd7('0x33')](_0x561c9e[_0xccd7('0x34')],_0x561c9e['query']);_0x239d10[_0xccd7('0x35')]=_[_0xccd7('0x33')](_0x561c9e['model'],qs[_0xccd7('0x36')](_0x58669b[_0xccd7('0x37')]['fields']));_0x239d10[_0xccd7('0x35')]=_0x239d10['attributes'][_0xccd7('0x38')]?_0x239d10[_0xccd7('0x35')]:_0x561c9e[_0xccd7('0x34')];if(!_0x58669b[_0xccd7('0x37')][_0xccd7('0x39')]('nolimit')){_0x239d10[_0xccd7('0x1e')]=qs[_0xccd7('0x1e')](_0x58669b['query'][_0xccd7('0x1e')]);_0x239d10['offset']=qs[_0xccd7('0x1c')](_0x58669b[_0xccd7('0x37')][_0xccd7('0x1c')]);}_0x239d10[_0xccd7('0x3a')]=qs['sort'](_0x58669b[_0xccd7('0x37')]['sort']);_0x239d10[_0xccd7('0x3b')]=qs[_0xccd7('0x32')](_[_0xccd7('0x3c')](_0x58669b['query'],_0x561c9e[_0xccd7('0x32')]),_0x25fca3);if(_0x58669b['query'][_0xccd7('0x3d')]){_0x239d10['where']=_[_0xccd7('0x3e')](_0x239d10['where'],{'$or':_[_0xccd7('0x2c')](_0x25fca3,function(_0x4f553c){if(_0x4f553c[_0xccd7('0x2f')]!==_0xccd7('0x3f')){var _0x76cd63={};_0x76cd63[_0x4f553c[_0xccd7('0x29')]]={'$like':'%'+_0x58669b[_0xccd7('0x37')][_0xccd7('0x3d')]+'%'};return _0x76cd63;}})});}_0x239d10=_[_0xccd7('0x3e')]({},_0x239d10,_0x58669b[_0xccd7('0x40')]);var _0x142e44={'where':_0x239d10[_0xccd7('0x3b')]};return db[_0xccd7('0x2d')]['count'](_0x142e44)['then'](function(_0x4c86a2){_0x1095c4['count']=_0x4c86a2;if(_0x58669b[_0xccd7('0x37')][_0xccd7('0x41')]){_0x239d10[_0xccd7('0x42')]=[{'all':!![]}];}return db[_0xccd7('0x2d')][_0xccd7('0x43')](_0x239d10);})[_0xccd7('0x25')](function(_0x1ac476){_0x1095c4[_0xccd7('0x44')]=_0x1ac476;return _0x1095c4;})[_0xccd7('0x25')](respondWithFilteredResult(_0x44ae5e,_0x239d10))['catch'](handleError(_0x44ae5e,null));};exports['show']=function(_0x2e48c8,_0x228ea4){var _0x553f8d={'raw':!![],'where':{'id':_0x2e48c8['params']['id']}},_0x4911d5={};_0x4911d5[_0xccd7('0x34')]=_[_0xccd7('0x31')](db[_0xccd7('0x2d')]['rawAttributes']);_0x4911d5[_0xccd7('0x37')]=_[_0xccd7('0x31')](_0x2e48c8[_0xccd7('0x37')]);_0x4911d5['filters']=_[_0xccd7('0x33')](_0x4911d5[_0xccd7('0x34')],_0x4911d5[_0xccd7('0x37')]);_0x553f8d[_0xccd7('0x35')]=_[_0xccd7('0x33')](_0x4911d5[_0xccd7('0x34')],qs[_0xccd7('0x36')](_0x2e48c8[_0xccd7('0x37')][_0xccd7('0x36')]));_0x553f8d['attributes']=_0x553f8d[_0xccd7('0x35')][_0xccd7('0x38')]?_0x553f8d['attributes']:_0x4911d5['model'];if(_0x2e48c8['query']['includeAll']){_0x553f8d[_0xccd7('0x42')]=[{'all':!![]}];}_0x553f8d=_[_0xccd7('0x3e')]({},_0x553f8d,_0x2e48c8[_0xccd7('0x40')]);return db[_0xccd7('0x2d')][_0xccd7('0x45')](_0x553f8d)[_0xccd7('0x25')](handleEntityNotFound(_0x228ea4,null))[_0xccd7('0x25')](respondWithResult(_0x228ea4,null))[_0xccd7('0x46')](handleError(_0x228ea4,null));};exports[_0xccd7('0x47')]=function(_0x1cde50,_0x58c72a){var _0xed5c9e={'where':{'id':_0x1cde50[_0xccd7('0x48')]['id']}},_0x55e566={};_0x55e566[_0xccd7('0x34')]=_[_0xccd7('0x31')](db[_0xccd7('0x2d')][_0xccd7('0x2e')]);_0xed5c9e['attributes']=_[_0xccd7('0x33')](_0x55e566[_0xccd7('0x34')],qs[_0xccd7('0x36')](_0x1cde50[_0xccd7('0x37')]['fields']));_0xed5c9e[_0xccd7('0x35')]=_0xed5c9e[_0xccd7('0x35')][_0xccd7('0x38')]?_0xed5c9e[_0xccd7('0x35')]:_0x55e566[_0xccd7('0x34')];if(_0x1cde50[_0xccd7('0x37')]['includeAll']){_0xed5c9e[_0xccd7('0x42')]=[{'all':!![]}];}_0xed5c9e=_[_0xccd7('0x3e')]({},_0xed5c9e,_0x1cde50[_0xccd7('0x40')]);return db[_0xccd7('0x2d')][_0xccd7('0x45')](_0xed5c9e)[_0xccd7('0x25')](handleEntityNotFound(_0x58c72a,null))[_0xccd7('0x25')](function(_0x5e2c13){if(_0x5e2c13){var _0x2684b7=_0x5e2c13[_0xccd7('0x49')]({'plain':!![]});_0x2684b7=qs[_0xccd7('0x4a')](_0x2684b7,['id',_0xccd7('0x4b'),_0xccd7('0x4c')]);_0x1cde50['body']=_[_0xccd7('0x4a')](_0x1cde50[_0xccd7('0x4d')],['id',_0xccd7('0x4b'),_0xccd7('0x4c')]);return db[_0xccd7('0x2d')]['create'](_[_0xccd7('0x3e')](_0x2684b7,_0x1cde50[_0xccd7('0x4d')]),{'include':_0x1cde50[_0xccd7('0x37')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xccd7('0x25')](respondWithResult(_0x58c72a,0xc9))[_0xccd7('0x46')](handleError(_0x58c72a,null));};exports['update']=function(_0x2af0af,_0x2529b5){if(_0x2af0af['body']['id']){delete _0x2af0af[_0xccd7('0x4d')]['id'];}return db[_0xccd7('0x2d')][_0xccd7('0x45')]({'where':{'id':_0x2af0af['params']['id']}})[_0xccd7('0x25')](handleEntityNotFound(_0x2529b5,null))['then'](saveUpdates(_0x2af0af[_0xccd7('0x4d')],null))[_0xccd7('0x25')](respondWithResult(_0x2529b5,null))[_0xccd7('0x46')](handleError(_0x2529b5,null));};exports[_0xccd7('0x26')]=function(_0x4962ac,_0x287578){return db['Attachment'][_0xccd7('0x45')]({'where':{'id':_0x4962ac['params']['id']}})['then'](handleEntityNotFound(_0x287578,null))['then'](removeEntity(_0x287578,null))[_0xccd7('0x46')](handleError(_0x287578,null));};exports['create']=function(_0x2d38d2,_0x2fbbf7,_0x3a3fa0){_0x2d38d2[_0xccd7('0x4d')]['name']=_0x2d38d2[_0xccd7('0x4e')]['originalname'];_0x2d38d2[_0xccd7('0x4d')][_0xccd7('0x4f')]=_0x2d38d2[_0xccd7('0x4e')][_0xccd7('0x50')];_0x2d38d2[_0xccd7('0x4d')][_0xccd7('0x2f')]=_0x2d38d2[_0xccd7('0x4e')]['mimetype'];return db[_0xccd7('0x2d')]['create'](_0x2d38d2['body'])[_0xccd7('0x25')](respondWithResult(_0x2fbbf7,0xc9))[_0xccd7('0x46')](handleError(_0x2fbbf7,null));};exports[_0xccd7('0x51')]=function(_0x475bb3,_0x32439c,_0x2291c4){return db[_0xccd7('0x2d')][_0xccd7('0x52')]({'where':{'id':_0x475bb3[_0xccd7('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x32439c,null))['then'](function(_0x194224){if(_0x194224){var _0x346acc=_0x194224[_0xccd7('0x53')]!==null;var _0x74a326=path['join'](config['root'],_0xccd7('0x54'));if(_0x346acc){_0x74a326=path[_0xccd7('0x55')](_0x74a326,_0xccd7('0x56'));}var _0xd2be3c=path['join'](_0x74a326,_0x194224[_0xccd7('0x4f')]);return _0x32439c['download'](_0xd2be3c);}})[_0xccd7('0x46')](handleError(_0x32439c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 006ef89..b7ed5d4 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 _0x32e8=['define','Attachment','attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x32e8,0xb9));var _0x832e=function(_0x555655,_0x2e5494){_0x555655=_0x555655-0x0;var _0x11bd8b=_0x32e8[_0x555655];return _0x11bd8b;};'use strict';var _=require(_0x832e('0x0'));var util=require(_0x832e('0x1'));var logger=require('../../config/logger')(_0x832e('0x2'));var moment=require(_0x832e('0x3'));var BPromise=require(_0x832e('0x4'));var rp=require(_0x832e('0x5'));var fs=require('fs');var path=require(_0x832e('0x6'));var rimraf=require(_0x832e('0x7'));var config=require(_0x832e('0x8'));var attributes=require(_0x832e('0x9'));module[_0x832e('0xa')]=function(_0x52d185,_0x1ddbd4){return _0x52d185[_0x832e('0xb')](_0x832e('0xc'),attributes,{'tableName':_0x832e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea3=['exports','define','Attachment','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./attachment.attributes'];(function(_0x20c4e5,_0x373262){var _0x25a447=function(_0x163ec1){while(--_0x163ec1){_0x20c4e5['push'](_0x20c4e5['shift']());}};_0x25a447(++_0x373262);}(_0xcea3,0x1e7));var _0x3cea=function(_0x55e37f,_0x3ab746){_0x55e37f=_0x55e37f-0x0;var _0x2241b6=_0xcea3[_0x55e37f];return _0x2241b6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3cea('0x0'))(_0x3cea('0x1'));var moment=require(_0x3cea('0x2'));var BPromise=require(_0x3cea('0x3'));var rp=require(_0x3cea('0x4'));var fs=require('fs');var path=require(_0x3cea('0x5'));var rimraf=require('rimraf');var config=require(_0x3cea('0x6'));var attributes=require(_0x3cea('0x7'));module[_0x3cea('0x8')]=function(_0x149879,_0x18f45b){return _0x149879[_0x3cea('0x9')](_0x3cea('0xa'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 6e27d09..2f685d1 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 _0x1be1=['Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Attachment,\x20%s,\x20%s','debug'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1be1,0x192));var _0x11be=function(_0x417465,_0xd9f07e){_0x417465=_0x417465-0x0;var _0x2ef918=_0x1be1[_0x417465];return _0x2ef918;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['Attachment']['create'](_0x56ab61[_0x11be('0x17')],{'raw':_0x56ab61[_0x11be('0x18')]?_0x56ab61[_0x11be('0x18')][_0x11be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x12a5bd){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x12a5bd));_0xc3263c(_0x12a5bd);})[_0x11be('0x15')](function(_0x17678d){logger[_0x11be('0x11')](_0x11be('0x16'),_0x17678d['message'],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x17678d[_0x11be('0x13')]));});});}; \ No newline at end of file +var _0x66fa=['../../mysqldb','../../config/utils','../../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','message','result','catch','Attachment','body','options','raw','CreateAttachment','lodash','util','moment','ioredis'];(function(_0x3af4a2,_0x1c9ce1){var _0x3fe846=function(_0x28b9d9){while(--_0x28b9d9){_0x3af4a2['push'](_0x3af4a2['shift']());}};_0x3fe846(++_0x1c9ce1);}(_0x66fa,0x168));var _0xa66f=function(_0x4e2def,_0x5ad724){_0x4e2def=_0x4e2def-0x0;var _0x22589f=_0x66fa[_0x4e2def];return _0x22589f;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require(_0xa66f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa66f('0x3'));var db=require(_0xa66f('0x4'))['db'];var utils=require(_0xa66f('0x5'));var logger=require(_0xa66f('0x6'))(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var jayson=require(_0xa66f('0x9'));var client=jayson[_0xa66f('0xa')][_0xa66f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33bd0d,_0x150f73,_0x5b7cf7){return new BPromise(function(_0x1cf624,_0x5ec156){return client[_0xa66f('0xc')](_0x33bd0d,_0x5b7cf7)[_0xa66f('0xd')](function(_0x5ad336){logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,_0xa66f('0x10'));logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x150f73,_0xa66f('0x10'),JSON['stringify'](_0x5ad336));if(_0x5ad336['error']){if(_0x5ad336[_0xa66f('0x13')]['code']===0x1f4){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')]['message']);return _0x5ec156(_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);}logger['error'](_0xa66f('0xf'),_0x150f73,_0x5ad336[_0xa66f('0x13')][_0xa66f('0x14')]);return _0x1cf624(_0x5ad336[_0xa66f('0x13')]['message']);}else{logger[_0xa66f('0xe')](_0xa66f('0xf'),_0x150f73,'request\x20sent');_0x1cf624(_0x5ad336[_0xa66f('0x15')][_0xa66f('0x14')]);}})[_0xa66f('0x16')](function(_0x76af81){logger[_0xa66f('0x13')](_0xa66f('0xf'),_0x150f73,_0x76af81);_0x5ec156(_0x76af81);});});}exports['CreateAttachment']=function(_0x4d5e31){var _0x162a28=this;return new Promise(function(_0x16648b,_0x1b4ab0){return db[_0xa66f('0x17')]['create'](_0x4d5e31[_0xa66f('0x18')],{'raw':_0x4d5e31[_0xa66f('0x19')]?_0x4d5e31['options'][_0xa66f('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3f4977){logger[_0xa66f('0xe')]('CreateAttachment',_0x4d5e31);logger['debug'](_0xa66f('0x1b'),_0x4d5e31,JSON['stringify'](_0x3f4977));_0x16648b(_0x3f4977);})['catch'](function(_0x59f7aa){logger['error'](_0xa66f('0x1b'),_0x59f7aa[_0xa66f('0x14')],_0x4d5e31);_0x1b4ab0(_0x162a28[_0xa66f('0x13')](0x1f4,_0x59f7aa['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index d1d6a88..eb537dc 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 _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x12dd11,_0x52b882){_0x12dd11=_0x12dd11-0x0;var _0x3a502b=_0x0b0e[_0x12dd11];return _0x3a502b;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x23f26b,_0x31b1d7){var _0x5254d2=function(_0x337122){while(--_0x337122){_0x23f26b['push'](_0x23f26b['shift']());}};_0x5254d2(++_0x31b1d7);}(_0x2032,0xd9));var _0x2203=function(_0x374588,_0x464779){_0x374588=_0x374588-0x0;var _0x3338c8=_0x2032[_0x374588];return _0x3338c8;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 7d64d22..d135891 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 _0x580b=['agent','blockDuration','add','minutes','clearBlockUser','getLicense','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','use','password','User','passport','Strategy','activedirectory2','bluebird','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','undefined','activedirectory','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','then','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','salt','role','disabled','blocked','blockedAt','admin','user'];(function(_0x5517d1,_0x14be6f){var _0x18f2f1=function(_0x511994){while(--_0x511994){_0x5517d1['push'](_0x5517d1['shift']());}};_0x18f2f1(++_0x14be6f);}(_0x580b,0xf0));var _0xb580=function(_0x562d4c,_0x2812c2){_0x562d4c=_0x562d4c-0x0;var _0x276edd=_0x580b[_0x562d4c];return _0x276edd;};'use strict';var passport=require(_0xb580('0x0'));var LocalStrategy=require('passport-local')[_0xb580('0x1')];var moment=require('moment');var ActiveDirectory=require(_0xb580('0x2'));var BPromise=require(_0xb580('0x3'));var util=require('util');var db=require(_0xb580('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xb580('0x5'));var config=require(_0xb580('0x6'));var logger=require(_0xb580('0x7'))('api');function isActiveDirectoryConfigured(_0x7683b8){var _0x1cfbda=![];if(typeof _0x7683b8['activedirectory']!==_0xb580('0x8')){_0x1cfbda=_0x7683b8[_0xb580('0x9')][_0xb580('0xa')]&&_0x7683b8[_0xb580('0x9')][_0xb580('0xb')]&&_0x7683b8['activedirectory']['domain'];}return _0x1cfbda;}function adAuthenticate(_0x569f15,_0x5dec2b,_0x4b8acf){return new BPromise(function(_0x453772,_0x11f9b0){try{var _0x3636e2=new ActiveDirectory(_0x569f15);_0x3636e2[_0xb580('0xc')](_0x5dec2b,_0x4b8acf,function(_0x628222,_0x44534f){if(_0x628222){logger[_0xb580('0xd')](_0xb580('0xe'),_0x5dec2b,util['inspect'](_0x628222,{'showHidden':![],'depth':null}));_0x11f9b0(_0xb580('0xf'));}else if(!_0x44534f){logger[_0xb580('0xd')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5dec2b);_0x11f9b0(_0xb580('0xf'));}else{_0x453772(_0x44534f);}});}catch(_0x30a791){_0x11f9b0(_0x30a791);}});}function ActiveDirectoryAuthenticate(_0x2c2a0b,_0x524c14,_0x1351af,_0x591e30){var _0x11a268,_0x2f50f3;if(!isActiveDirectoryConfigured(config)){logger[_0xb580('0xd')](_0xb580('0x10'),_0x524c14);return _0x591e30(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0xb580('0x11')][_0xb580('0x12')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})[_0xb580('0x13')](function(_0x695b00){_0x11a268=_0x695b00;if(!_0x11a268[_0xb580('0x14')]){logger[_0xb580('0xd')](_0xb580('0x15'),_0x524c14);throw new Error(_0xb580('0xf'));}return _0x2c2a0b[_0xb580('0x12')]({'attributes':['id',_0xb580('0x16'),'password',_0xb580('0x17'),_0xb580('0x18'),_0xb580('0x19'),_0xb580('0x1a'),_0xb580('0x1b'),'online'],'where':{'name':_0x524c14,'role':{'$or':[_0xb580('0x1c'),_0xb580('0x1d'),_0xb580('0x1e')]},'adSsoEnabled':!![]}});})[_0xb580('0x13')](function(_0x2f5bba){if(!_0x2f5bba||_0x2f5bba&&_0x2f5bba[_0xb580('0x16')]!==_0x524c14){throw new Error(_0xb580('0xf'));}_0x2f50f3=_0x2f5bba;var _0x2b13fb=_0x2f50f3['name']+'@'+config[_0xb580('0x9')]['domain'];return adAuthenticate(config[_0xb580('0x9')],_0x2b13fb,_0x1351af);})['then'](function(_0xda310){if(_0x2f50f3[_0xb580('0x19')]){throw new Error(_0xb580('0xf'));}if(_0x11a268[_0xb580('0x1f')]>0x0){if(_0x2f50f3['blocked']){if(moment(_0x2f50f3['blockedAt'])[_0xb580('0x20')](_0x11a268[_0xb580('0x1f')],_0xb580('0x21'))>moment()){throw new Error(_0xb580('0xf'));}return utils[_0xb580('0x22')](_0x2f50f3,0x0,![],null)[_0xb580('0x13')](function(){return utils[_0xb580('0x23')](_0x2f50f3);})[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}else{return utils[_0xb580('0x23')](_0x2f50f3)[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}}else{return utils[_0xb580('0x23')](_0x2f50f3)[_0xb580('0x13')](function(){return _0x591e30(null,_0x2f50f3);});}})['catch'](function(_0x171dc0){return _0x591e30(null,![],_0x171dc0);});}function handleError(_0x1cf42e,_0x2dfedc,_0x5041c0){return _0x1cf42e[_0xb580('0x24')](_0x2dfedc||0x1f4)[_0xb580('0x25')]({'message':_0x5041c0?_0x5041c0['message']||_0x5041c0:''});}exports[_0xb580('0x26')]=function(_0x271175,_0x3ff049,_0x38ad63){passport[_0xb580('0xc')](_0xb580('0x27'),function(_0x288c1f,_0x545bc4,_0xfbabd9){var _0x21ca1d=_0x288c1f||_0xfbabd9;if(_0x21ca1d){return handleError(_0x3ff049,0x191,_0x21ca1d);}if(!_0x545bc4){return handleError(_0x3ff049,0x194,{'message':_0xb580('0x28')});}else{var _0x1b5746={'payload':{'id':_0x545bc4['id'],'role':_0x545bc4[_0xb580('0x18')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b5746)[_0xb580('0x13')](function(_0x3a3e57){_0x3ff049['json']({'id':_0x545bc4['id'],'token':_0x3a3e57,'statusCall':'','isAlreadyLogged':_0x545bc4[_0xb580('0x29')]});});}})(_0x271175,_0x3ff049,_0x38ad63);};passport[_0xb580('0x2a')](_0xb580('0x27'),new LocalStrategy({'usernameField':_0xb580('0x16'),'passwordField':_0xb580('0x2b')},function(_0x2f7a19,_0x5c4fdf,_0x24d8b3){return ActiveDirectoryAuthenticate(db[_0xb580('0x2c')],_0x2f7a19,_0x5c4fdf,_0x24d8b3);})); \ No newline at end of file +var _0x66d0=['disabled','blocked','blockedAt','online','admin','user','blockDuration','add','minutes','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/logger','activedirectory','baseDN','url','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role'];(function(_0x31cbbd,_0x7c723e){var _0x206e04=function(_0x231b3d){while(--_0x231b3d){_0x31cbbd['push'](_0x31cbbd['shift']());}};_0x206e04(++_0x7c723e);}(_0x66d0,0x135));var _0x066d=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x66d0[_0x58efa6];return _0x5d643c;};'use strict';var passport=require(_0x066d('0x0'));var LocalStrategy=require(_0x066d('0x1'))[_0x066d('0x2')];var moment=require(_0x066d('0x3'));var ActiveDirectory=require(_0x066d('0x4'));var BPromise=require('bluebird');var util=require(_0x066d('0x5'));var db=require(_0x066d('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x066d('0x7'));var config=require('../../config/environment');var logger=require(_0x066d('0x8'))('api');function isActiveDirectoryConfigured(_0x1ccae9){var _0x2bdf47=![];if(typeof _0x1ccae9[_0x066d('0x9')]!=='undefined'){_0x2bdf47=_0x1ccae9[_0x066d('0x9')][_0x066d('0xa')]&&_0x1ccae9['activedirectory'][_0x066d('0xb')]&&_0x1ccae9['activedirectory']['domain'];}return _0x2bdf47;}function adAuthenticate(_0x3b8627,_0x480101,_0xe34723){return new BPromise(function(_0x3e8450,_0x2463c1){try{var _0x24f389=new ActiveDirectory(_0x3b8627);_0x24f389[_0x066d('0xc')](_0x480101,_0xe34723,function(_0x3c2ba3,_0x1e7a37){if(_0x3c2ba3){logger['error'](_0x066d('0xd'),_0x480101,util[_0x066d('0xe')](_0x3c2ba3,{'showHidden':![],'depth':null}));_0x2463c1(_0x066d('0xf'));}else if(!_0x1e7a37){logger[_0x066d('0x10')](_0x066d('0x11'),_0x480101);_0x2463c1(_0x066d('0xf'));}else{_0x3e8450(_0x1e7a37);}});}catch(_0x303f4c){_0x2463c1(_0x303f4c);}});}function ActiveDirectoryAuthenticate(_0x3271b0,_0x14da0c,_0x251d05,_0x1acb54){var _0x3e9e3b,_0x168a3b;if(!isActiveDirectoryConfigured(config)){logger[_0x066d('0x10')](_0x066d('0x12'),_0x14da0c);return _0x1acb54(null,![],{'message':_0x066d('0xf')});}return db['Setting'][_0x066d('0x13')]({'where':{'id':0x1},'attributes':[_0x066d('0x14'),'blockDuration'],'raw':!![]})[_0x066d('0x15')](function(_0x438716){_0x3e9e3b=_0x438716;if(!_0x3e9e3b[_0x066d('0x14')]){logger[_0x066d('0x10')](_0x066d('0x16'),_0x14da0c);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x3271b0[_0x066d('0x13')]({'attributes':['id',_0x066d('0x17'),_0x066d('0x18'),_0x066d('0x19'),_0x066d('0x1a'),_0x066d('0x1b'),_0x066d('0x1c'),_0x066d('0x1d'),_0x066d('0x1e')],'where':{'name':_0x14da0c,'role':{'$or':[_0x066d('0x1f'),_0x066d('0x20'),'agent']},'adSsoEnabled':!![]}});})[_0x066d('0x15')](function(_0x35fab2){if(!_0x35fab2||_0x35fab2&&_0x35fab2[_0x066d('0x17')]!==_0x14da0c){throw new Error(_0x066d('0xf'));}_0x168a3b=_0x35fab2;var _0x4253c5=_0x168a3b[_0x066d('0x17')]+'@'+config[_0x066d('0x9')]['domain'];return adAuthenticate(config[_0x066d('0x9')],_0x4253c5,_0x251d05);})['then'](function(_0xb7b2fd){if(_0x168a3b[_0x066d('0x1b')]){throw new Error(_0x066d('0xf'));}if(_0x3e9e3b[_0x066d('0x21')]>0x0){if(_0x168a3b[_0x066d('0x1c')]){if(moment(_0x168a3b[_0x066d('0x1d')])[_0x066d('0x22')](_0x3e9e3b[_0x066d('0x21')],_0x066d('0x23'))>moment()){throw new Error(_0x066d('0xf'));}return utils['clearBlockUser'](_0x168a3b,0x0,![],null)[_0x066d('0x15')](function(){return utils[_0x066d('0x24')](_0x168a3b);})[_0x066d('0x15')](function(){return _0x1acb54(null,_0x168a3b);});}else{return utils['getLicense'](_0x168a3b)[_0x066d('0x15')](function(){return _0x1acb54(null,_0x168a3b);});}}else{return utils['getLicense'](_0x168a3b)['then'](function(){return _0x1acb54(null,_0x168a3b);});}})[_0x066d('0x25')](function(_0x32b7b8){return _0x1acb54(null,![],_0x32b7b8);});}function handleError(_0x373efe,_0x5f03e5,_0x260c25){return _0x373efe[_0x066d('0x26')](_0x5f03e5||0x1f4)[_0x066d('0x27')]({'message':_0x260c25?_0x260c25[_0x066d('0x28')]||_0x260c25:''});}exports[_0x066d('0x29')]=function(_0x148574,_0x343ecf,_0x59c631){passport[_0x066d('0xc')](_0x066d('0x2a'),function(_0x1bb9cd,_0x4fe99b,_0x37d998){var _0x503367=_0x1bb9cd||_0x37d998;if(_0x503367){return handleError(_0x343ecf,0x191,_0x503367);}if(!_0x4fe99b){return handleError(_0x343ecf,0x194,{'message':_0x066d('0x2b')});}else{var _0x24099c={'payload':{'id':_0x4fe99b['id'],'role':_0x4fe99b['role']},'options':{'expiresIn':0x15180}};return authService[_0x066d('0x2c')](_0x24099c)[_0x066d('0x15')](function(_0x4243c6){_0x343ecf[_0x066d('0x2d')]({'id':_0x4fe99b['id'],'token':_0x4243c6,'statusCall':'','isAlreadyLogged':_0x4fe99b[_0x066d('0x1e')]});});}})(_0x148574,_0x343ecf,_0x59c631);};passport[_0x066d('0x2e')](_0x066d('0x2a'),new LocalStrategy({'usernameField':_0x066d('0x17'),'passwordField':'password'},function(_0xf773b2,_0x29ee1f,_0x151bb6){return ActiveDirectoryAuthenticate(db[_0x066d('0x2f')],_0xf773b2,_0x29ee1f,_0x151bb6);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index af2cd3f..4548e33 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 _0xd175=['Router','./authActiveDirectory.controller','post','login','express'];(function(_0x1579be,_0x4f5834){var _0x4f4837=function(_0x286b0){while(--_0x286b0){_0x1579be['push'](_0x1579be['shift']());}};_0x4f4837(++_0x4f5834);}(_0xd175,0x1cb));var _0x5d17=function(_0x45dc19,_0x22271a){_0x45dc19=_0x45dc19-0x0;var _0x520888=_0xd175[_0x45dc19];return _0x520888;};'use strict';var express=require(_0x5d17('0x0'));var router=express[_0x5d17('0x1')]();var controller=require(_0x5d17('0x2'));router[_0x5d17('0x3')]('/',controller[_0x5d17('0x4')]);module['exports']=router; \ No newline at end of file +var _0xe0ff=['express','./authActiveDirectory.controller','exports'];(function(_0x30d3b6,_0x24aef4){var _0x472495=function(_0xb6c1aa){while(--_0xb6c1aa){_0x30d3b6['push'](_0x30d3b6['shift']());}};_0x472495(++_0x24aef4);}(_0xe0ff,0x1d7));var _0xfe0f=function(_0x29c8fb,_0x4a797b){_0x29c8fb=_0x29c8fb-0x0;var _0x1839a0=_0xe0ff[_0x29c8fb];return _0x1839a0;};'use strict';var express=require(_0xfe0f('0x0'));var router=express['Router']();var controller=require(_0xfe0f('0x1'));router['post']('/',controller['login']);module[_0xfe0f('0x2')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index e139df9..a74f2d2 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(_0x305779,_0x57891f){var _0x41c696=function(_0x53f33c){while(--_0x53f33c){_0x305779['push'](_0x305779['shift']());}};_0x41c696(++_0x57891f);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +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(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7a54,0x106));var _0x47a5=function(_0x363c38,_0x933939){_0x363c38=_0x363c38-0x0;var _0x32a309=_0x7a54[_0x363c38];return _0x32a309;};'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 4b2fbaf..c4db126 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 _0xb55e=['exports','express','passport','Router','./authGoogle.controller','get','login','/callback','setTokenCookie'];(function(_0x438f7c,_0x60ba0e){var _0x4c6e38=function(_0xdf6070){while(--_0xdf6070){_0x438f7c['push'](_0x438f7c['shift']());}};_0x4c6e38(++_0x60ba0e);}(_0xb55e,0x106));var _0xeb55=function(_0x58c9d2,_0xc9c90b){_0x58c9d2=_0x58c9d2-0x0;var _0x65481a=_0xb55e[_0x58c9d2];return _0x65481a;};'use strict';var express=require(_0xeb55('0x0'));var passport=require(_0xeb55('0x1'));var router=express[_0xeb55('0x2')]();var controller=require(_0xeb55('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router[_0xeb55('0x4')]('/',controller[_0xeb55('0x5')]);router['get'](_0xeb55('0x6'),controller['callback'],authService['isMiddleware'],userController['login'],authService[_0xeb55('0x7')]);module[_0xeb55('0x8')]=router; \ No newline at end of file +var _0xa5e4=['Router','./authGoogle.controller','login','get','/callback','callback','isMiddleware','setTokenCookie','express','passport'];(function(_0x28c939,_0x110e29){var _0x527fe9=function(_0x1df2a6){while(--_0x1df2a6){_0x28c939['push'](_0x28c939['shift']());}};_0x527fe9(++_0x110e29);}(_0xa5e4,0xee));var _0x4a5e=function(_0x3e885c,_0x4f295b){_0x3e885c=_0x3e885c-0x0;var _0x29278c=_0xa5e4[_0x3e885c];return _0x29278c;};'use strict';var express=require(_0x4a5e('0x0'));var passport=require(_0x4a5e('0x1'));var router=express[_0x4a5e('0x2')]();var controller=require(_0x4a5e('0x3'));var userController=require('../user/user.controller.js');var authService=require('../../components/auth/service');router['get']('/',controller[_0x4a5e('0x4')]);router[_0x4a5e('0x5')](_0x4a5e('0x6'),controller[_0x4a5e('0x7')],authService[_0x4a5e('0x8')],userController[_0x4a5e('0x4')],authService[_0x4a5e('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index ce71e02..c4cf1c5 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 _0x9e31=['message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\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/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','passwordHistoryLimit','Password\x20reset!','use','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','name','password','role','disabled','blocked','blockedAt','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','loginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0x9e31,0x7c));var _0x19e3=function(_0x5e2603,_0x28b846){_0x5e2603=_0x5e2603-0x0;var _0x19bb24=_0x9e31[_0x5e2603];return _0x19bb24;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0x19e3('0x0'));var _=require(_0x19e3('0x1'));var rs=require(_0x19e3('0x2'));var moment=require(_0x19e3('0x3'));var db=require(_0x19e3('0x4'))['db'];var authService=require(_0x19e3('0x5'));var utils=require(_0x19e3('0x6'));var client=jayson[_0x19e3('0x7')][_0x19e3('0x8')]({'port':0x232b});function localAuthenticate(_0x478e14,_0x204f09,_0x20de12,_0x28ca80){var _0x73abdf,_0x4d867d;return db[_0x19e3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x19e3('0xa'),_0x19e3('0xb')],'raw':!![]})['then'](function(_0x4344cc){_0x73abdf=_0x4344cc;return _0x478e14['findOne']({'attributes':['id',_0x19e3('0xc'),_0x19e3('0xd'),'salt',_0x19e3('0xe'),_0x19e3('0xf'),_0x19e3('0x10'),_0x19e3('0x11'),'loginAttempts'],'where':{'name':_0x204f09,'role':{'$or':[_0x19e3('0x12'),_0x19e3('0x13'),_0x19e3('0x14')]}}});})[_0x19e3('0x15')](function(_0x29e082){if(!_0x29e082||_0x29e082&&_0x29e082[_0x19e3('0xc')]!==_0x204f09){throw new Error(_0x19e3('0x16'));}else{_0x4d867d=_0x29e082;return _0x4d867d;}})[_0x19e3('0x15')](function(){_0x4d867d['authenticate'](_0x20de12,function(_0x2349e2,_0x5ecb13){var _0x31bc6c=_0x4d867d[_0x19e3('0x17')]+0x1;if(_0x2349e2){return _0x28ca80(_0x2349e2);}else if(!_0x5ecb13){if(_0x4d867d[_0x19e3('0xf')]){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else if(_0x73abdf[_0x19e3('0xa')]>0x0){if(_0x4d867d['blocked']){if(_0x73abdf['blockDuration']>0x0){if(moment(_0x4d867d[_0x19e3('0x11')])[_0x19e3('0x18')](_0x73abdf[_0x19e3('0xb')],_0x19e3('0x19'))>moment()){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else{return utils[_0x19e3('0x1a')](_0x4d867d,_0x31bc6c,![],null)[_0x19e3('0x15')](function(){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{if(_0x31bc6c>=_0x73abdf['allowedLoginAttempts']){return utils[_0x19e3('0x1a')](_0x4d867d,0x0,!![],moment())[_0x19e3('0x15')](function(){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x19e3('0x1a')](_0x4d867d,_0x31bc6c,![],null)['then'](function(){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});});}}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{if(_0x4d867d[_0x19e3('0xf')]){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else if(_0x73abdf['allowedLoginAttempts']>0x0){if(_0x4d867d[_0x19e3('0x10')]){if(_0x73abdf[_0x19e3('0xb')]>0x0){if(moment(_0x4d867d[_0x19e3('0x11')])[_0x19e3('0x18')](_0x73abdf['blockDuration'],_0x19e3('0x19'))>moment()){return _0x28ca80(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x19e3('0x1a')](_0x4d867d,0x0,![],null)[_0x19e3('0x15')](function(){return utils[_0x19e3('0x1b')](_0x4d867d);})[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);});}}else{return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}}else{return utils[_0x19e3('0x1a')](_0x4d867d,0x0,![],null)[_0x19e3('0x15')](function(){return utils['getLicense'](_0x4d867d);})[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);})[_0x19e3('0x1c')](function(_0x44f66f){return _0x28ca80(null,![],_0x44f66f);});}}else{if(_0x4d867d['blocked']){return _0x28ca80(null,![],{'message':_0x19e3('0x16')});}else{return utils[_0x19e3('0x1b')](_0x4d867d)[_0x19e3('0x15')](function(){return _0x28ca80(null,_0x4d867d);});}}}});})['catch'](function(_0x10209b){return _0x28ca80(null,![],_0x10209b);});}function sendServiceMail(_0x408806){return db[_0x19e3('0x1d')][_0x19e3('0x1e')]({'where':{'service':!![]},'attributes':['id','name',_0x19e3('0x1f')],'include':[{'model':db['MailServerOut'],'as':_0x19e3('0x20'),'include':[{'model':db[_0x19e3('0x21')],'as':_0x19e3('0x21')}]}]})['then'](function(_0x4809dd){if(!_0x4809dd){throw new Error(_0x19e3('0x22'));}var _0x421d4e=_0x4809dd[_0x19e3('0x23')]();var _0x87015a={'account':_0x421d4e,'message':_[_0x19e3('0x24')]({'from':util[_0x19e3('0x25')](_0x19e3('0x26'),_0x4809dd[_0x19e3('0xc')],_0x4809dd[_0x19e3('0x1f')]||_0x4809dd[_0x19e3('0x20')]['user'])},_0x408806)};return client[_0x19e3('0x27')](_0x19e3('0x28'),_0x87015a);})[_0x19e3('0x15')](function(_0x38ebf0){if(_0x38ebf0['error']){throw new Error(util[_0x19e3('0x25')](_0x19e3('0x29'),_0x38ebf0['error'][_0x19e3('0x2a')]||JSON['stringify'](_0x38ebf0[_0x19e3('0x2b')])));}return!![];});}function handleError(_0x19b550,_0x3b84d3,_0x18e997){return _0x19b550[_0x19e3('0x2c')](_0x3b84d3||0x1f4)[_0x19e3('0x2d')]({'message':_0x18e997?_0x18e997['message']||_0x18e997:''});}exports[_0x19e3('0x2e')]=function(_0x26668e,_0x2f6246,_0xfaf850){passport['authenticate'](_0x19e3('0x2f'),function(_0xee1ed8,_0x32bb76,_0x56c668){var _0x28d195=_0xee1ed8||_0x56c668;if(_0x28d195){return handleError(_0x2f6246,0x191,_0x28d195);}if(!_0x32bb76){return handleError(_0x2f6246,0x194,{'message':_0x19e3('0x30')});}else{var _0x1d9891={'payload':{'id':_0x32bb76['id'],'role':_0x32bb76[_0x19e3('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x19e3('0x31')](_0x1d9891)[_0x19e3('0x15')](function(_0x22f92c){_0x2f6246[_0x19e3('0x32')]({'id':_0x32bb76['id'],'token':_0x22f92c,'statusCall':'','isAlreadyLogged':_0x32bb76[_0x19e3('0x33')]});});}})(_0x26668e,_0x2f6246,_0xfaf850);};exports['forgot']=function(_0x56f05f,_0x164225){if(!_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')]){return handleError(_0x164225,0x1f4,{'message':_0x19e3('0x35')});}var _0x393372=rs[_0x19e3('0x36')]();_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')]=_0x56f05f[_0x19e3('0x34')][_0x19e3('0x1f')][_0x19e3('0x37')]()[_0x19e3('0x38')]();var _0x3919b0;return db[_0x19e3('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x19e3('0xa'),_0x19e3('0xb')],'raw':!![]})['then'](function(_0x48219b){_0x3919b0=_0x48219b;return db[_0x19e3('0x39')][_0x19e3('0x1e')]({'where':{'email':_0x56f05f['body'][_0x19e3('0x1f')]}});})[_0x19e3('0x15')](function(_0x204617){if(!_0x204617){throw new Error(_0x19e3('0x3a'));}if(_0x204617[_0x19e3('0xf')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x204617['blocked']){if(moment(_0x204617[_0x19e3('0x11')])[_0x19e3('0x18')](_0x3919b0[_0x19e3('0xb')],_0x19e3('0x19'))>moment()){throw new Error(_0x19e3('0x3b'));}else{_0x204617[_0x19e3('0x10')]=![];_0x204617[_0x19e3('0x11')]=null;}}_0x204617[_0x19e3('0x3c')]=_0x393372;_0x204617[_0x19e3('0x3d')]=Date[_0x19e3('0x3e')]()+0x36ee80;return _0x204617[_0x19e3('0x3f')]();})[_0x19e3('0x15')](function(){return sendServiceMail({'to':_0x56f05f[_0x19e3('0x34')]['email'],'subject':_0x19e3('0x40'),'text':_0x19e3('0x41')+_0x19e3('0x42')+_0x19e3('0x43')+_0x56f05f[_0x19e3('0x44')]['host']+_0x19e3('0x45')+_0x393372+'\x0a\x0a'+_0x19e3('0x46')});})[_0x19e3('0x15')](function(){_0x164225[_0x19e3('0x2c')](0xc8)[_0x19e3('0x2d')]({'message':_0x19e3('0x47')});})[_0x19e3('0x1c')](function(_0x536563){return handleError(_0x164225,0x1f4,_0x536563);});};exports[_0x19e3('0x48')]=function(_0x5c251a,_0x413c2a){return db['User'][_0x19e3('0x1e')]({'where':{'resetPasswordToken':_0x5c251a[_0x19e3('0x49')]['token'],'resetPasswordExpires':{'$gt':Date[_0x19e3('0x3e')]()}}})['then'](function(_0x1ae9a6){if(!_0x1ae9a6){throw new Error(_0x19e3('0x4a'));}return db[_0x19e3('0x9')]['findOne']({'attributes':['id','securePassword','enforcePasswordHistory','passwordHistoryLimit']})['then'](function(_0x5da8d5){if(_0x5da8d5[_0x19e3('0x4b')])authService[_0x19e3('0x4c')](_0x5c251a[_0x19e3('0x34')]['password']);if(!_0x5da8d5[_0x19e3('0x4d')]||!_0x1ae9a6['previousPasswords'])return _0x1ae9a6;authService[_0x19e3('0x4e')](_0x5c251a[_0x19e3('0x34')]['password'],_0x1ae9a6[_0x19e3('0x4f')],_0x5da8d5[_0x19e3('0x50')]);return _0x1ae9a6;})[_0x19e3('0x15')](function(){_0x1ae9a6[_0x19e3('0xd')]=_0x5c251a[_0x19e3('0x34')][_0x19e3('0xd')];_0x1ae9a6['resetPasswordToken']=null;_0x1ae9a6[_0x19e3('0x3d')]=null;return _0x1ae9a6['save']();});})[_0x19e3('0x15')](function(){_0x413c2a[_0x19e3('0x2c')](0xc8)['send']({'message':_0x19e3('0x51')});})[_0x19e3('0x1c')](function(_0x4c019b){return handleError(_0x413c2a,0x1f4,_0x4c019b);});};passport[_0x19e3('0x52')](_0x19e3('0x2f'),new LocalStrategy({'usernameField':_0x19e3('0xc'),'passwordField':_0x19e3('0xd')},function(_0x13e20b,_0x44c9f8,_0x5669ea){return localAuthenticate(db[_0x19e3('0x39')],_0x13e20b,_0x44c9f8,_0x5669ea);})); \ No newline at end of file +var _0xd24b=['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/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','resetPasswordToken','passport','Strategy','lodash','randomstring','moment','../../mysqldb','../../config/utils','http','Setting','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','minutes','clearBlockUser','add','getLicense','catch','find','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','status','send','local-login','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xd24b,0xba));var _0xbd24=function(_0x3c3864,_0x463067){_0x3c3864=_0x3c3864-0x0;var _0x3bc205=_0xd24b[_0x3c3864];return _0x3bc205;};'use strict';var util=require('util');var passport=require(_0xbd24('0x0'));var LocalStrategy=require('passport-local')[_0xbd24('0x1')];var jayson=require('jayson/promise');var _=require(_0xbd24('0x2'));var rs=require(_0xbd24('0x3'));var moment=require(_0xbd24('0x4'));var db=require(_0xbd24('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xbd24('0x6'));var client=jayson['client'][_0xbd24('0x7')]({'port':0x232b});function localAuthenticate(_0x432308,_0x1db127,_0x355650,_0x3c9e59){var _0x5ba263,_0x57bcdc;return db[_0xbd24('0x8')][_0xbd24('0x9')]({'where':{'id':0x1},'attributes':[_0xbd24('0xa'),_0xbd24('0xb')],'raw':!![]})[_0xbd24('0xc')](function(_0x30311f){_0x5ba263=_0x30311f;return _0x432308[_0xbd24('0x9')]({'attributes':['id',_0xbd24('0xd'),_0xbd24('0xe'),_0xbd24('0xf'),_0xbd24('0x10'),_0xbd24('0x11'),_0xbd24('0x12'),_0xbd24('0x13'),_0xbd24('0x14')],'where':{'name':_0x1db127,'role':{'$or':[_0xbd24('0x15'),_0xbd24('0x16'),_0xbd24('0x17')]}}});})[_0xbd24('0xc')](function(_0x143ba9){if(!_0x143ba9||_0x143ba9&&_0x143ba9[_0xbd24('0xd')]!==_0x1db127){throw new Error(_0xbd24('0x18'));}else{_0x57bcdc=_0x143ba9;return _0x57bcdc;}})['then'](function(){_0x57bcdc[_0xbd24('0x19')](_0x355650,function(_0x4eb29e,_0x59ff38){var _0x110ddb=_0x57bcdc['loginAttempts']+0x1;if(_0x4eb29e){return _0x3c9e59(_0x4eb29e);}else if(!_0x59ff38){if(_0x57bcdc[_0xbd24('0x11')]){return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}else if(_0x5ba263[_0xbd24('0xa')]>0x0){if(_0x57bcdc['blocked']){if(_0x5ba263[_0xbd24('0xb')]>0x0){if(moment(_0x57bcdc[_0xbd24('0x13')])['add'](_0x5ba263[_0xbd24('0xb')],_0xbd24('0x1a'))>moment()){return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}else{return utils[_0xbd24('0x1b')](_0x57bcdc,_0x110ddb,![],null)[_0xbd24('0xc')](function(){return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});});}}else{return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}}else{if(_0x110ddb>=_0x5ba263[_0xbd24('0xa')]){return utils['clearBlockUser'](_0x57bcdc,0x0,!![],moment())['then'](function(){return _0x3c9e59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xbd24('0x1b')](_0x57bcdc,_0x110ddb,![],null)[_0xbd24('0xc')](function(){return _0x3c9e59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}}else{if(_0x57bcdc['disabled']){return _0x3c9e59(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x5ba263['allowedLoginAttempts']>0x0){if(_0x57bcdc[_0xbd24('0x12')]){if(_0x5ba263[_0xbd24('0xb')]>0x0){if(moment(_0x57bcdc[_0xbd24('0x13')])[_0xbd24('0x1c')](_0x5ba263[_0xbd24('0xb')],'minutes')>moment()){return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}else{return utils[_0xbd24('0x1b')](_0x57bcdc,0x0,![],null)[_0xbd24('0xc')](function(){return utils[_0xbd24('0x1d')](_0x57bcdc);})[_0xbd24('0xc')](function(){return _0x3c9e59(null,_0x57bcdc);});}}else{return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}}else{return utils[_0xbd24('0x1b')](_0x57bcdc,0x0,![],null)[_0xbd24('0xc')](function(){return utils[_0xbd24('0x1d')](_0x57bcdc);})[_0xbd24('0xc')](function(){return _0x3c9e59(null,_0x57bcdc);})[_0xbd24('0x1e')](function(_0x61662b){return _0x3c9e59(null,![],_0x61662b);});}}else{if(_0x57bcdc['blocked']){return _0x3c9e59(null,![],{'message':_0xbd24('0x18')});}else{return utils['getLicense'](_0x57bcdc)[_0xbd24('0xc')](function(){return _0x3c9e59(null,_0x57bcdc);});}}}});})['catch'](function(_0x5c1df3){return _0x3c9e59(null,![],_0x5c1df3);});}function sendServiceMail(_0x450202){return db['MailAccount'][_0xbd24('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xbd24('0xd'),'email'],'include':[{'model':db[_0xbd24('0x20')],'as':_0xbd24('0x21'),'include':[{'model':db[_0xbd24('0x22')],'as':_0xbd24('0x22')}]}]})[_0xbd24('0xc')](function(_0x420db0){if(!_0x420db0){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x4eaecc=_0x420db0[_0xbd24('0x23')]();var _0x1d35e1={'account':_0x4eaecc,'message':_[_0xbd24('0x24')]({'from':util[_0xbd24('0x25')](_0xbd24('0x26'),_0x420db0[_0xbd24('0xd')],_0x420db0[_0xbd24('0x27')]||_0x420db0['Smtp'][_0xbd24('0x16')])},_0x450202)};return client['request'](_0xbd24('0x28'),_0x1d35e1);})[_0xbd24('0xc')](function(_0x57d572){if(_0x57d572[_0xbd24('0x29')]){throw new Error(util[_0xbd24('0x25')](_0xbd24('0x2a'),_0x57d572['error']['message']||JSON[_0xbd24('0x2b')](_0x57d572[_0xbd24('0x29')])));}return!![];});}function handleError(_0x33552f,_0x28bad5,_0x54d268){return _0x33552f[_0xbd24('0x2c')](_0x28bad5||0x1f4)[_0xbd24('0x2d')]({'message':_0x54d268?_0x54d268['message']||_0x54d268:''});}exports['login']=function(_0x4b170a,_0x24f27b,_0x4eb312){passport['authenticate'](_0xbd24('0x2e'),function(_0x175a74,_0xa9aede,_0x533bdf){var _0x217920=_0x175a74||_0x533bdf;if(_0x217920){return handleError(_0x24f27b,0x191,_0x217920);}if(!_0xa9aede){return handleError(_0x24f27b,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x5d75bc={'payload':{'id':_0xa9aede['id'],'role':_0xa9aede[_0xbd24('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0xbd24('0x2f')](_0x5d75bc)[_0xbd24('0xc')](function(_0x26c151){_0x24f27b[_0xbd24('0x30')]({'id':_0xa9aede['id'],'token':_0x26c151,'statusCall':'','isAlreadyLogged':_0xa9aede[_0xbd24('0x31')]});});}})(_0x4b170a,_0x24f27b,_0x4eb312);};exports[_0xbd24('0x32')]=function(_0x33623f,_0x2f073f){if(!_0x33623f[_0xbd24('0x33')][_0xbd24('0x27')]){return handleError(_0x2f073f,0x1f4,{'message':_0xbd24('0x34')});}var _0x4a7451=rs[_0xbd24('0x35')]();_0x33623f['body'][_0xbd24('0x27')]=_0x33623f['body'][_0xbd24('0x27')][_0xbd24('0x36')]()[_0xbd24('0x37')]();var _0x4d49a0;return db[_0xbd24('0x8')][_0xbd24('0x9')]({'where':{'id':0x1},'attributes':[_0xbd24('0xa'),'blockDuration'],'raw':!![]})[_0xbd24('0xc')](function(_0x4e75e8){_0x4d49a0=_0x4e75e8;return db['User'][_0xbd24('0x1f')]({'where':{'email':_0x33623f['body'][_0xbd24('0x27')]}});})['then'](function(_0x35c791){if(!_0x35c791){throw new Error(_0xbd24('0x38'));}if(_0x35c791[_0xbd24('0x11')]){throw new Error(_0xbd24('0x39'));}if(_0x35c791[_0xbd24('0x12')]){if(moment(_0x35c791[_0xbd24('0x13')])[_0xbd24('0x1c')](_0x4d49a0[_0xbd24('0xb')],_0xbd24('0x1a'))>moment()){throw new Error(_0xbd24('0x3a'));}else{_0x35c791[_0xbd24('0x12')]=![];_0x35c791[_0xbd24('0x13')]=null;}}_0x35c791['resetPasswordToken']=_0x4a7451;_0x35c791[_0xbd24('0x3b')]=Date[_0xbd24('0x3c')]()+0x36ee80;return _0x35c791[_0xbd24('0x3d')]();})[_0xbd24('0xc')](function(){return sendServiceMail({'to':_0x33623f[_0xbd24('0x33')]['email'],'subject':_0xbd24('0x3e'),'text':_0xbd24('0x3f')+_0xbd24('0x40')+_0xbd24('0x41')+_0x33623f[_0xbd24('0x42')]['host']+_0xbd24('0x43')+_0x4a7451+'\x0a\x0a'+_0xbd24('0x44')});})[_0xbd24('0xc')](function(){_0x2f073f[_0xbd24('0x2c')](0xc8)[_0xbd24('0x2d')]({'message':_0xbd24('0x45')});})[_0xbd24('0x1e')](function(_0x94b50b){return handleError(_0x2f073f,0x1f4,_0x94b50b);});};exports[_0xbd24('0x46')]=function(_0x16c7d8,_0x1ef226){return db[_0xbd24('0x47')][_0xbd24('0x1f')]({'where':{'resetPasswordToken':_0x16c7d8[_0xbd24('0x48')][_0xbd24('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xbd24('0xc')](function(_0x3e3dc3){if(!_0x3e3dc3){throw new Error(_0xbd24('0x4a'));}return db[_0xbd24('0x8')][_0xbd24('0x9')]({'attributes':['id',_0xbd24('0x4b'),_0xbd24('0x4c'),_0xbd24('0x4d')]})[_0xbd24('0xc')](function(_0x147871){if(_0x147871[_0xbd24('0x4b')])authService[_0xbd24('0x4e')](_0x16c7d8['body'][_0xbd24('0xe')]);if(!_0x147871[_0xbd24('0x4c')]||!_0x3e3dc3[_0xbd24('0x4f')])return _0x3e3dc3;authService[_0xbd24('0x50')](_0x16c7d8[_0xbd24('0x33')][_0xbd24('0xe')],_0x3e3dc3[_0xbd24('0x4f')],_0x147871[_0xbd24('0x4d')]);return _0x3e3dc3;})[_0xbd24('0xc')](function(){_0x3e3dc3['password']=_0x16c7d8[_0xbd24('0x33')]['password'];_0x3e3dc3[_0xbd24('0x51')]=null;_0x3e3dc3['resetPasswordExpires']=null;return _0x3e3dc3['save']();});})[_0xbd24('0xc')](function(){_0x1ef226['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xbd24('0x1e')](function(_0x4b31f8){return handleError(_0x1ef226,0x1f4,_0x4b31f8);});};passport['use'](_0xbd24('0x2e'),new LocalStrategy({'usernameField':_0xbd24('0xd'),'passwordField':'password'},function(_0x555ca7,_0x2d5898,_0xf8c50){return localAuthenticate(db[_0xbd24('0x47')],_0x555ca7,_0x2d5898,_0xf8c50);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index a461bd0..ff3da79 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 _0xffd5=['login','/forgot','post','/reset/:token','express','Router','./authLocal.controller'];(function(_0xe1c7d7,_0x102465){var _0x272c22=function(_0x56b75e){while(--_0x56b75e){_0xe1c7d7['push'](_0xe1c7d7['shift']());}};_0x272c22(++_0x102465);}(_0xffd5,0x107));var _0x5ffd=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0xffd5[_0x3005d5];return _0x547c7e;};'use strict';var express=require(_0x5ffd('0x0'));var router=express[_0x5ffd('0x1')]();var controller=require(_0x5ffd('0x2'));router['post']('/',controller[_0x5ffd('0x3')]);router['post'](_0x5ffd('0x4'),controller['forgot']);router[_0x5ffd('0x5')](_0x5ffd('0x6'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0xba1a=['Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','express'];(function(_0x2f18c4,_0x428aa5){var _0x457ee9=function(_0x3a033b){while(--_0x3a033b){_0x2f18c4['push'](_0x2f18c4['shift']());}};_0x457ee9(++_0x428aa5);}(_0xba1a,0x1d7));var _0xaba1=function(_0x110272,_0x1162d9){_0x110272=_0x110272-0x0;var _0x30d41b=_0xba1a[_0x110272];return _0x30d41b;};'use strict';var express=require(_0xaba1('0x0'));var router=express[_0xaba1('0x1')]();var controller=require(_0xaba1('0x2'));router[_0xaba1('0x3')]('/',controller[_0xaba1('0x4')]);router[_0xaba1('0x3')](_0xaba1('0x5'),controller[_0xaba1('0x6')]);router['post'](_0xaba1('0x7'),controller['reset']);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6b1942b..cb1f538 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 _0x6f90=['exports','INTEGER'];(function(_0x582a70,_0x488f81){var _0xac9f16=function(_0x3b320b){while(--_0x3b320b){_0x582a70['push'](_0x582a70['shift']());}};_0xac9f16(++_0x488f81);}(_0x6f90,0xc6));var _0x06f9=function(_0x2a96eb,_0x23105a){_0x2a96eb=_0x2a96eb-0x0;var _0x2e86f8=_0x6f90[_0x2a96eb];return _0x2e86f8;};'use strict';var Sequelize=require('sequelize');module[_0x06f9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x06f9('0x1')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdf68=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0xdf68,0xb5));var _0x8df6=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0xdf68[_0x33c9f8];return _0x2d7004;};'use strict';var Sequelize=require(_0x8df6('0x0'));module[_0x8df6('0x1')]={'name':{'type':Sequelize[_0x8df6('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x8df6('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x8df6('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8df6('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 3e108df..c624fd3 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 _0x8654=['destroy','end','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','include','rows','catch','params','find','body','addConditions','ids','Condition','options','getConditions','hasOwnProperty','addActions','Action','omit','getActions','findOne','pick','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x8654,0xcf));var _0x4865=function(_0x4def94,_0x53665e){_0x4def94=_0x4def94-0x0;var _0x4b68c7=_0x8654[_0x4def94];return _0x4b68c7;};'use strict';var emlformat=require(_0x4865('0x0'));var rimraf=require(_0x4865('0x1'));var zipdir=require(_0x4865('0x2'));var jsonpatch=require(_0x4865('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4865('0x4'));var Mustache=require(_0x4865('0x5'));var util=require(_0x4865('0x6'));var path=require(_0x4865('0x7'));var sox=require(_0x4865('0x8'));var csv=require(_0x4865('0x9'));var ejs=require(_0x4865('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4865('0xb'));var squel=require('squel');var crypto=require(_0x4865('0xc'));var jsforce=require(_0x4865('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4865('0x9'));var querystring=require(_0x4865('0xe'));var Papa=require(_0x4865('0xf'));var Redis=require(_0x4865('0x10'));var authService=require(_0x4865('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4865('0x12'));var hardwareService=require(_0x4865('0x13'));var logger=require(_0x4865('0x14'))(_0x4865('0x15'));var utils=require(_0x4865('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4865('0x17'))['db'];function respondWithStatusCode(_0x744fb9,_0x1070dd){_0x1070dd=_0x1070dd||0xcc;return function(_0x5b9bf3){if(_0x5b9bf3){return _0x744fb9[_0x4865('0x18')](_0x1070dd);}return _0x744fb9['status'](_0x1070dd)['end']();};}function respondWithResult(_0x21de99,_0x5b3814){_0x5b3814=_0x5b3814||0xc8;return function(_0x5b056f){if(_0x5b056f){return _0x21de99[_0x4865('0x19')](_0x5b3814)[_0x4865('0x1a')](_0x5b056f);}};}function respondWithFilteredResult(_0x5680f7,_0x47419b){return function(_0x232b43){if(_0x232b43){var _0x32bd31=typeof _0x47419b[_0x4865('0x1b')]===_0x4865('0x1c')&&typeof _0x47419b[_0x4865('0x1d')]===_0x4865('0x1c');var _0x4b5a8f=_0x232b43[_0x4865('0x1e')];var _0x583f74=_0x32bd31?0x0:_0x47419b['offset'];var _0x4dfc65=_0x32bd31?_0x232b43[_0x4865('0x1e')]:_0x47419b[_0x4865('0x1b')]+_0x47419b[_0x4865('0x1d')];var _0x25b0de;if(_0x4dfc65>=_0x4b5a8f){_0x4dfc65=_0x4b5a8f;_0x25b0de=0xc8;}else{_0x25b0de=0xce;}_0x5680f7[_0x4865('0x19')](_0x25b0de);return _0x5680f7[_0x4865('0x1f')]('Content-Range',_0x583f74+'-'+_0x4dfc65+'/'+_0x4b5a8f)[_0x4865('0x1a')](_0x232b43);}return null;};}function patchUpdates(_0x3835ec){return function(_0x2608d5){try{jsonpatch['apply'](_0x2608d5,_0x3835ec,!![]);}catch(_0x4ad6a5){return BPromise[_0x4865('0x20')](_0x4ad6a5);}return _0x2608d5[_0x4865('0x21')]();};}function saveUpdates(_0x33c9fd,_0x14680e){return function(_0x1ac1b2){if(_0x1ac1b2){return _0x1ac1b2[_0x4865('0x22')](_0x33c9fd)[_0x4865('0x23')](function(_0x1c67e1){return _0x1c67e1;});}return null;};}function removeEntity(_0x2d80bf,_0x82e04e){return function(_0x1c8543){if(_0x1c8543){return _0x1c8543[_0x4865('0x24')]()['then'](function(){_0x2d80bf[_0x4865('0x19')](0xcc)[_0x4865('0x25')]();});}};}function handleEntityNotFound(_0x2b97f5,_0x460f6c){return function(_0x3269d5){if(!_0x3269d5){_0x2b97f5[_0x4865('0x18')](0x194);}return _0x3269d5;};}function handleError(_0x8571eb,_0x2d65e1){_0x2d65e1=_0x2d65e1||0x1f4;return function(_0x162b9b){logger[_0x4865('0x26')](_0x162b9b[_0x4865('0x27')]);if(_0x162b9b[_0x4865('0x28')]){delete _0x162b9b['name'];}_0x8571eb[_0x4865('0x19')](_0x2d65e1)[_0x4865('0x29')](_0x162b9b);};}exports[_0x4865('0x2a')]=function(_0x525813,_0x35147c){var _0x4975ad={},_0x24741a={},_0x1a2f84={'count':0x0,'rows':[]};var _0x510fef=_[_0x4865('0x2b')](db[_0x4865('0x2c')][_0x4865('0x2d')],function(_0x2c0864){return{'name':_0x2c0864[_0x4865('0x2e')],'type':_0x2c0864[_0x4865('0x2f')][_0x4865('0x30')]};});_0x24741a['model']=_['map'](_0x510fef,_0x4865('0x28'));_0x24741a['query']=_[_0x4865('0x31')](_0x525813[_0x4865('0x32')]);_0x24741a[_0x4865('0x33')]=_[_0x4865('0x34')](_0x24741a[_0x4865('0x35')],_0x24741a[_0x4865('0x32')]);_0x4975ad['attributes']=_[_0x4865('0x34')](_0x24741a['model'],qs[_0x4865('0x36')](_0x525813[_0x4865('0x32')][_0x4865('0x36')]));_0x4975ad[_0x4865('0x37')]=_0x4975ad[_0x4865('0x37')][_0x4865('0x38')]?_0x4975ad[_0x4865('0x37')]:_0x24741a['model'];if(!_0x525813[_0x4865('0x32')]['hasOwnProperty'](_0x4865('0x39'))){_0x4975ad[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x525813['query'][_0x4865('0x1d')]);_0x4975ad[_0x4865('0x1b')]=qs[_0x4865('0x1b')](_0x525813['query'][_0x4865('0x1b')]);}_0x4975ad[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x525813[_0x4865('0x32')][_0x4865('0x3b')]);_0x4975ad[_0x4865('0x3c')]=qs['filters'](_['pick'](_0x525813[_0x4865('0x32')],_0x24741a[_0x4865('0x33')]),_0x510fef);if(_0x525813[_0x4865('0x32')][_0x4865('0x3d')]){_0x4975ad['where']=_[_0x4865('0x3e')](_0x4975ad[_0x4865('0x3c')],{'$or':_[_0x4865('0x2b')](_0x510fef,function(_0x1d1df3){if(_0x1d1df3[_0x4865('0x2f')]!=='VIRTUAL'){var _0x538f11={};_0x538f11[_0x1d1df3[_0x4865('0x28')]]={'$like':'%'+_0x525813[_0x4865('0x32')][_0x4865('0x3d')]+'%'};return _0x538f11;}})});}_0x4975ad=_[_0x4865('0x3e')]({},_0x4975ad,_0x525813['options']);var _0xe7560c={'where':_0x4975ad[_0x4865('0x3c')]};return db[_0x4865('0x2c')][_0x4865('0x1e')](_0xe7560c)[_0x4865('0x23')](function(_0x346fc9){_0x1a2f84[_0x4865('0x1e')]=_0x346fc9;if(_0x525813[_0x4865('0x32')]['includeAll']){_0x4975ad[_0x4865('0x3f')]=[{'all':!![]}];}return db[_0x4865('0x2c')]['findAll'](_0x4975ad);})['then'](function(_0x17b91b){_0x1a2f84[_0x4865('0x40')]=_0x17b91b;return _0x1a2f84;})['then'](respondWithFilteredResult(_0x35147c,_0x4975ad))[_0x4865('0x41')](handleError(_0x35147c,null));};exports['show']=function(_0x663d0f,_0xdafd52){var _0x12fe77={'raw':![],'where':{'id':_0x663d0f[_0x4865('0x42')]['id']}},_0x69ceb1={};_0x69ceb1[_0x4865('0x35')]=_[_0x4865('0x31')](db[_0x4865('0x2c')]['rawAttributes']);_0x69ceb1[_0x4865('0x32')]=_['keys'](_0x663d0f[_0x4865('0x32')]);_0x69ceb1[_0x4865('0x33')]=_[_0x4865('0x34')](_0x69ceb1[_0x4865('0x35')],_0x69ceb1['query']);_0x12fe77[_0x4865('0x37')]=_[_0x4865('0x34')](_0x69ceb1['model'],qs[_0x4865('0x36')](_0x663d0f['query'][_0x4865('0x36')]));_0x12fe77[_0x4865('0x37')]=_0x12fe77[_0x4865('0x37')][_0x4865('0x38')]?_0x12fe77[_0x4865('0x37')]:_0x69ceb1['model'];if(_0x663d0f[_0x4865('0x32')]['includeAll']){_0x12fe77[_0x4865('0x3f')]=[{'all':!![]}];}_0x12fe77=_[_0x4865('0x3e')]({},_0x12fe77,_0x663d0f['options']);return db[_0x4865('0x2c')][_0x4865('0x43')](_0x12fe77)[_0x4865('0x23')](handleEntityNotFound(_0xdafd52,null))[_0x4865('0x23')](respondWithResult(_0xdafd52,null))[_0x4865('0x41')](handleError(_0xdafd52,null));};exports['create']=function(_0x515eac,_0x470e29){return db['Automation']['create'](_0x515eac['body'],{})[_0x4865('0x23')](respondWithResult(_0x470e29,0xc9))[_0x4865('0x41')](handleError(_0x470e29,null));};exports['update']=function(_0x30ccb5,_0x2b1b31){if(_0x30ccb5[_0x4865('0x44')]['id']){delete _0x30ccb5[_0x4865('0x44')]['id'];}return db['Automation'][_0x4865('0x43')]({'where':{'id':_0x30ccb5[_0x4865('0x42')]['id']}})['then'](handleEntityNotFound(_0x2b1b31,null))[_0x4865('0x23')](saveUpdates(_0x30ccb5[_0x4865('0x44')],null))[_0x4865('0x23')](respondWithResult(_0x2b1b31,null))[_0x4865('0x41')](handleError(_0x2b1b31,null));};exports[_0x4865('0x24')]=function(_0x43d23a,_0x2e2efb){return db[_0x4865('0x2c')]['find']({'where':{'id':_0x43d23a[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x2e2efb,null))['then'](removeEntity(_0x2e2efb,null))[_0x4865('0x41')](handleError(_0x2e2efb,null));};exports[_0x4865('0x45')]=function(_0x19436b,_0x1cf5ed,_0x536114){return db['Condition'][_0x4865('0x43')]({'where':{'id':_0x19436b[_0x4865('0x42')]['id']}})['then'](handleEntityNotFound(_0x1cf5ed,null))[_0x4865('0x23')](function(_0x23a6d9){if(_0x23a6d9){return _0x23a6d9[_0x4865('0x45')](_0x19436b[_0x4865('0x44')][_0x4865('0x46')],_['omit'](_0x19436b[_0x4865('0x44')],[_0x4865('0x46'),'id'])||{});}})[_0x4865('0x23')](respondWithResult(_0x1cf5ed,null))[_0x4865('0x41')](handleError(_0x1cf5ed,null));};exports['getConditions']=function(_0x1f88b1,_0x1d0f93,_0xead82d){var _0x521c23={};var _0x1c6285={};var _0x505eb4;var _0x2f29f9;return db[_0x4865('0x2c')]['findOne']({'where':{'id':_0x1f88b1[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x1d0f93,null))[_0x4865('0x23')](function(_0x1bc33e){if(_0x1bc33e){_0x505eb4=_0x1bc33e;_0x1c6285['model']=_[_0x4865('0x31')](db[_0x4865('0x47')][_0x4865('0x2d')]);_0x1c6285[_0x4865('0x32')]=_['keys'](_0x1f88b1[_0x4865('0x32')]);_0x1c6285[_0x4865('0x33')]=_[_0x4865('0x34')](_0x1c6285[_0x4865('0x35')],_0x1c6285[_0x4865('0x32')]);_0x521c23[_0x4865('0x37')]=_[_0x4865('0x34')](_0x1c6285[_0x4865('0x35')],qs[_0x4865('0x36')](_0x1f88b1[_0x4865('0x32')]['fields']));_0x521c23[_0x4865('0x37')]=_0x521c23[_0x4865('0x37')]['length']?_0x521c23[_0x4865('0x37')]:_0x1c6285[_0x4865('0x35')];_0x521c23[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x1f88b1[_0x4865('0x32')][_0x4865('0x3b')]);_0x521c23['where']=qs[_0x4865('0x33')](_['pick'](_0x1f88b1[_0x4865('0x32')],_0x1c6285[_0x4865('0x33')]));if(_0x1f88b1[_0x4865('0x32')][_0x4865('0x3d')]){_0x521c23[_0x4865('0x3c')]=_[_0x4865('0x3e')](_0x521c23['where'],{'$or':_[_0x4865('0x2b')](_0x521c23[_0x4865('0x37')],function(_0x80e740){var _0x1fd0b7={};_0x1fd0b7[_0x80e740]={'$like':'%'+_0x1f88b1[_0x4865('0x32')]['filter']+'%'};return _0x1fd0b7;})});}_0x521c23=_['merge']({},_0x521c23,_0x1f88b1[_0x4865('0x48')]);return _0x505eb4[_0x4865('0x49')](_0x521c23);}})['then'](function(_0x4fd0a3){if(_0x4fd0a3){_0x2f29f9=_0x4fd0a3['length'];if(!_0x1f88b1['query'][_0x4865('0x4a')]('nolimit')){_0x521c23[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x1f88b1[_0x4865('0x32')][_0x4865('0x1d')]);_0x521c23[_0x4865('0x1b')]=qs['offset'](_0x1f88b1[_0x4865('0x32')][_0x4865('0x1b')]);}return _0x505eb4[_0x4865('0x49')](_0x521c23);}})[_0x4865('0x23')](function(_0x10b045){if(_0x10b045){return _0x10b045?{'count':_0x2f29f9,'rows':_0x10b045}:null;}})[_0x4865('0x23')](respondWithResult(_0x1d0f93,null))[_0x4865('0x41')](handleError(_0x1d0f93,null));};exports[_0x4865('0x4b')]=function(_0x4984bf,_0x585dd,_0x44275f){return db[_0x4865('0x4c')][_0x4865('0x43')]({'where':{'id':_0x4984bf['params']['id']}})['then'](handleEntityNotFound(_0x585dd,null))['then'](function(_0x4b99a9){if(_0x4b99a9){return _0x4b99a9['addActions'](_0x4984bf[_0x4865('0x44')]['ids'],_[_0x4865('0x4d')](_0x4984bf['body'],[_0x4865('0x46'),'id'])||{});}})[_0x4865('0x23')](respondWithResult(_0x585dd,null))['catch'](handleError(_0x585dd,null));};exports[_0x4865('0x4e')]=function(_0x50d78,_0x2830bb,_0x2b670c){var _0x26fac8={};var _0x20011f={};var _0x5f2b4a;var _0x2347bd;return db[_0x4865('0x2c')][_0x4865('0x4f')]({'where':{'id':_0x50d78[_0x4865('0x42')]['id']}})[_0x4865('0x23')](handleEntityNotFound(_0x2830bb,null))[_0x4865('0x23')](function(_0xdb514b){if(_0xdb514b){_0x5f2b4a=_0xdb514b;_0x20011f[_0x4865('0x35')]=_[_0x4865('0x31')](db[_0x4865('0x4c')][_0x4865('0x2d')]);_0x20011f['query']=_[_0x4865('0x31')](_0x50d78[_0x4865('0x32')]);_0x20011f[_0x4865('0x33')]=_[_0x4865('0x34')](_0x20011f['model'],_0x20011f[_0x4865('0x32')]);_0x26fac8['attributes']=_[_0x4865('0x34')](_0x20011f[_0x4865('0x35')],qs[_0x4865('0x36')](_0x50d78[_0x4865('0x32')][_0x4865('0x36')]));_0x26fac8[_0x4865('0x37')]=_0x26fac8['attributes'][_0x4865('0x38')]?_0x26fac8[_0x4865('0x37')]:_0x20011f['model'];_0x26fac8[_0x4865('0x3a')]=qs[_0x4865('0x3b')](_0x50d78[_0x4865('0x32')]['sort']);_0x26fac8[_0x4865('0x3c')]=qs[_0x4865('0x33')](_[_0x4865('0x50')](_0x50d78[_0x4865('0x32')],_0x20011f[_0x4865('0x33')]));if(_0x50d78[_0x4865('0x32')][_0x4865('0x3d')]){_0x26fac8[_0x4865('0x3c')]=_['merge'](_0x26fac8[_0x4865('0x3c')],{'$or':_['map'](_0x26fac8[_0x4865('0x37')],function(_0x4ecf86){var _0xf42094={};_0xf42094[_0x4ecf86]={'$like':'%'+_0x50d78[_0x4865('0x32')][_0x4865('0x3d')]+'%'};return _0xf42094;})});}_0x26fac8=_[_0x4865('0x3e')]({},_0x26fac8,_0x50d78[_0x4865('0x48')]);return _0x5f2b4a[_0x4865('0x4e')](_0x26fac8);}})[_0x4865('0x23')](function(_0x16fc7d){if(_0x16fc7d){_0x2347bd=_0x16fc7d[_0x4865('0x38')];if(!_0x50d78['query'][_0x4865('0x4a')](_0x4865('0x39'))){_0x26fac8[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x50d78[_0x4865('0x32')][_0x4865('0x1d')]);_0x26fac8['offset']=qs[_0x4865('0x1b')](_0x50d78[_0x4865('0x32')][_0x4865('0x1b')]);}return _0x5f2b4a[_0x4865('0x4e')](_0x26fac8);}})['then'](function(_0x411d93){if(_0x411d93){return _0x411d93?{'count':_0x2347bd,'rows':_0x411d93}:null;}})[_0x4865('0x23')](respondWithResult(_0x2830bb,null))['catch'](handleError(_0x2830bb,null));}; \ No newline at end of file +var _0x3577=['apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','options','Automation','includeAll','include','findAll','catch','show','params','length','find','create','body','addConditions','Condition','ids','getConditions','findOne','order','nolimit','addActions','Action','omit','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x1c2a52,_0x4bfd87){var _0x71fd1a=function(_0x13bb38){while(--_0x13bb38){_0x1c2a52['push'](_0x1c2a52['shift']());}};_0x71fd1a(++_0x4bfd87);}(_0x3577,0x193));var _0x7357=function(_0x123c8b,_0x671f61){_0x123c8b=_0x123c8b-0x0;var _0x290ed2=_0x3577[_0x123c8b];return _0x290ed2;};'use strict';var emlformat=require(_0x7357('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7357('0x1'));var jsonpatch=require(_0x7357('0x2'));var rp=require(_0x7357('0x3'));var moment=require(_0x7357('0x4'));var BPromise=require(_0x7357('0x5'));var Mustache=require(_0x7357('0x6'));var util=require(_0x7357('0x7'));var path=require('path');var sox=require(_0x7357('0x8'));var csv=require('to-csv');var ejs=require(_0x7357('0x9'));var fs=require('fs');var fs_extra=require(_0x7357('0xa'));var _=require(_0x7357('0xb'));var squel=require(_0x7357('0xc'));var crypto=require(_0x7357('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7357('0xe'));var toCsv=require(_0x7357('0xf'));var querystring=require(_0x7357('0x10'));var Papa=require(_0x7357('0x11'));var Redis=require(_0x7357('0x12'));var authService=require(_0x7357('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7357('0x14'));var hardwareService=require(_0x7357('0x15'));var logger=require('../../config/logger')(_0x7357('0x16'));var utils=require(_0x7357('0x17'));var config=require(_0x7357('0x18'));var licenseUtil=require(_0x7357('0x19'));var db=require(_0x7357('0x1a'))['db'];function respondWithStatusCode(_0x13d261,_0x57e625){_0x57e625=_0x57e625||0xcc;return function(_0x137d6c){if(_0x137d6c){return _0x13d261[_0x7357('0x1b')](_0x57e625);}return _0x13d261[_0x7357('0x1c')](_0x57e625)[_0x7357('0x1d')]();};}function respondWithResult(_0x296b74,_0xf92139){_0xf92139=_0xf92139||0xc8;return function(_0x1e2a51){if(_0x1e2a51){return _0x296b74['status'](_0xf92139)[_0x7357('0x1e')](_0x1e2a51);}};}function respondWithFilteredResult(_0x4848d1,_0x4898bc){return function(_0x282ca6){if(_0x282ca6){var _0x33e0ab=typeof _0x4898bc[_0x7357('0x1f')]==='undefined'&&typeof _0x4898bc[_0x7357('0x20')]===_0x7357('0x21');var _0x50b9c2=_0x282ca6[_0x7357('0x22')];var _0x511c25=_0x33e0ab?0x0:_0x4898bc[_0x7357('0x1f')];var _0x385dc7=_0x33e0ab?_0x282ca6[_0x7357('0x22')]:_0x4898bc[_0x7357('0x1f')]+_0x4898bc[_0x7357('0x20')];var _0x125f0b;if(_0x385dc7>=_0x50b9c2){_0x385dc7=_0x50b9c2;_0x125f0b=0xc8;}else{_0x125f0b=0xce;}_0x4848d1[_0x7357('0x1c')](_0x125f0b);return _0x4848d1[_0x7357('0x23')](_0x7357('0x24'),_0x511c25+'-'+_0x385dc7+'/'+_0x50b9c2)[_0x7357('0x1e')](_0x282ca6);}return null;};}function patchUpdates(_0x4d8309){return function(_0xd607c6){try{jsonpatch[_0x7357('0x25')](_0xd607c6,_0x4d8309,!![]);}catch(_0x35d848){return BPromise[_0x7357('0x26')](_0x35d848);}return _0xd607c6[_0x7357('0x27')]();};}function saveUpdates(_0x1b4868,_0x1fcd78){return function(_0x2cafe3){if(_0x2cafe3){return _0x2cafe3[_0x7357('0x28')](_0x1b4868)[_0x7357('0x29')](function(_0x289928){return _0x289928;});}return null;};}function removeEntity(_0x4ccb53,_0x395ae5){return function(_0x3f7132){if(_0x3f7132){return _0x3f7132[_0x7357('0x2a')]()[_0x7357('0x29')](function(){_0x4ccb53['status'](0xcc)[_0x7357('0x1d')]();});}};}function handleEntityNotFound(_0x2ba9ed,_0x24944b){return function(_0x400732){if(!_0x400732){_0x2ba9ed[_0x7357('0x1b')](0x194);}return _0x400732;};}function handleError(_0x420ad2,_0x1861fd){_0x1861fd=_0x1861fd||0x1f4;return function(_0x131d6e){logger[_0x7357('0x2b')](_0x131d6e[_0x7357('0x2c')]);if(_0x131d6e[_0x7357('0x2d')]){delete _0x131d6e[_0x7357('0x2d')];}_0x420ad2[_0x7357('0x1c')](_0x1861fd)[_0x7357('0x2e')](_0x131d6e);};}exports[_0x7357('0x2f')]=function(_0xf3fce4,_0x34302f){var _0x5f5b89={},_0x59aa6e={},_0x143fec={'count':0x0,'rows':[]};var _0x34b6f4=_['map'](db['Automation'][_0x7357('0x30')],function(_0x17ab57){return{'name':_0x17ab57[_0x7357('0x31')],'type':_0x17ab57['type'][_0x7357('0x32')]};});_0x59aa6e[_0x7357('0x33')]=_[_0x7357('0x34')](_0x34b6f4,'name');_0x59aa6e['query']=_[_0x7357('0x35')](_0xf3fce4[_0x7357('0x36')]);_0x59aa6e[_0x7357('0x37')]=_[_0x7357('0x38')](_0x59aa6e[_0x7357('0x33')],_0x59aa6e[_0x7357('0x36')]);_0x5f5b89[_0x7357('0x39')]=_[_0x7357('0x38')](_0x59aa6e['model'],qs[_0x7357('0x3a')](_0xf3fce4[_0x7357('0x36')][_0x7357('0x3a')]));_0x5f5b89[_0x7357('0x39')]=_0x5f5b89[_0x7357('0x39')]['length']?_0x5f5b89[_0x7357('0x39')]:_0x59aa6e[_0x7357('0x33')];if(!_0xf3fce4['query'][_0x7357('0x3b')]('nolimit')){_0x5f5b89[_0x7357('0x20')]=qs['limit'](_0xf3fce4[_0x7357('0x36')]['limit']);_0x5f5b89[_0x7357('0x1f')]=qs[_0x7357('0x1f')](_0xf3fce4[_0x7357('0x36')][_0x7357('0x1f')]);}_0x5f5b89['order']=qs[_0x7357('0x3c')](_0xf3fce4[_0x7357('0x36')]['sort']);_0x5f5b89[_0x7357('0x3d')]=qs[_0x7357('0x37')](_[_0x7357('0x3e')](_0xf3fce4['query'],_0x59aa6e[_0x7357('0x37')]),_0x34b6f4);if(_0xf3fce4[_0x7357('0x36')][_0x7357('0x3f')]){_0x5f5b89[_0x7357('0x3d')]=_[_0x7357('0x40')](_0x5f5b89[_0x7357('0x3d')],{'$or':_[_0x7357('0x34')](_0x34b6f4,function(_0x363c24){if(_0x363c24['type']!=='VIRTUAL'){var _0x110fd2={};_0x110fd2[_0x363c24[_0x7357('0x2d')]]={'$like':'%'+_0xf3fce4['query'][_0x7357('0x3f')]+'%'};return _0x110fd2;}})});}_0x5f5b89=_[_0x7357('0x40')]({},_0x5f5b89,_0xf3fce4[_0x7357('0x41')]);var _0x2820a2={'where':_0x5f5b89[_0x7357('0x3d')]};return db[_0x7357('0x42')][_0x7357('0x22')](_0x2820a2)[_0x7357('0x29')](function(_0x4f345a){_0x143fec['count']=_0x4f345a;if(_0xf3fce4[_0x7357('0x36')][_0x7357('0x43')]){_0x5f5b89[_0x7357('0x44')]=[{'all':!![]}];}return db[_0x7357('0x42')][_0x7357('0x45')](_0x5f5b89);})['then'](function(_0x423c86){_0x143fec['rows']=_0x423c86;return _0x143fec;})[_0x7357('0x29')](respondWithFilteredResult(_0x34302f,_0x5f5b89))[_0x7357('0x46')](handleError(_0x34302f,null));};exports[_0x7357('0x47')]=function(_0x1afc77,_0x10981c){var _0x353b2d={'raw':![],'where':{'id':_0x1afc77[_0x7357('0x48')]['id']}},_0x1bec34={};_0x1bec34[_0x7357('0x33')]=_[_0x7357('0x35')](db['Automation'][_0x7357('0x30')]);_0x1bec34[_0x7357('0x36')]=_[_0x7357('0x35')](_0x1afc77['query']);_0x1bec34[_0x7357('0x37')]=_[_0x7357('0x38')](_0x1bec34['model'],_0x1bec34[_0x7357('0x36')]);_0x353b2d[_0x7357('0x39')]=_[_0x7357('0x38')](_0x1bec34['model'],qs[_0x7357('0x3a')](_0x1afc77[_0x7357('0x36')][_0x7357('0x3a')]));_0x353b2d[_0x7357('0x39')]=_0x353b2d[_0x7357('0x39')][_0x7357('0x49')]?_0x353b2d[_0x7357('0x39')]:_0x1bec34['model'];if(_0x1afc77[_0x7357('0x36')][_0x7357('0x43')]){_0x353b2d[_0x7357('0x44')]=[{'all':!![]}];}_0x353b2d=_['merge']({},_0x353b2d,_0x1afc77[_0x7357('0x41')]);return db[_0x7357('0x42')][_0x7357('0x4a')](_0x353b2d)[_0x7357('0x29')](handleEntityNotFound(_0x10981c,null))[_0x7357('0x29')](respondWithResult(_0x10981c,null))[_0x7357('0x46')](handleError(_0x10981c,null));};exports[_0x7357('0x4b')]=function(_0x2003e9,_0x115e98){return db['Automation'][_0x7357('0x4b')](_0x2003e9['body'],{})['then'](respondWithResult(_0x115e98,0xc9))['catch'](handleError(_0x115e98,null));};exports['update']=function(_0x1e5e7d,_0x427b1a){if(_0x1e5e7d[_0x7357('0x4c')]['id']){delete _0x1e5e7d['body']['id'];}return db['Automation'][_0x7357('0x4a')]({'where':{'id':_0x1e5e7d[_0x7357('0x48')]['id']}})['then'](handleEntityNotFound(_0x427b1a,null))[_0x7357('0x29')](saveUpdates(_0x1e5e7d[_0x7357('0x4c')],null))[_0x7357('0x29')](respondWithResult(_0x427b1a,null))[_0x7357('0x46')](handleError(_0x427b1a,null));};exports['destroy']=function(_0xc0b042,_0x3c1b1a){return db['Automation'][_0x7357('0x4a')]({'where':{'id':_0xc0b042['params']['id']}})['then'](handleEntityNotFound(_0x3c1b1a,null))[_0x7357('0x29')](removeEntity(_0x3c1b1a,null))[_0x7357('0x46')](handleError(_0x3c1b1a,null));};exports[_0x7357('0x4d')]=function(_0x53da2b,_0xe7b808,_0x357d3b){return db[_0x7357('0x4e')][_0x7357('0x4a')]({'where':{'id':_0x53da2b['params']['id']}})[_0x7357('0x29')](handleEntityNotFound(_0xe7b808,null))[_0x7357('0x29')](function(_0x5c7175){if(_0x5c7175){return _0x5c7175['addConditions'](_0x53da2b[_0x7357('0x4c')][_0x7357('0x4f')],_['omit'](_0x53da2b[_0x7357('0x4c')],['ids','id'])||{});}})['then'](respondWithResult(_0xe7b808,null))[_0x7357('0x46')](handleError(_0xe7b808,null));};exports[_0x7357('0x50')]=function(_0x268644,_0x532599,_0x15d3f0){var _0x2bfef5={};var _0x5186a1={};var _0x57c731;var _0x246432;return db['Automation'][_0x7357('0x51')]({'where':{'id':_0x268644[_0x7357('0x48')]['id']}})[_0x7357('0x29')](handleEntityNotFound(_0x532599,null))[_0x7357('0x29')](function(_0x42f518){if(_0x42f518){_0x57c731=_0x42f518;_0x5186a1[_0x7357('0x33')]=_['keys'](db[_0x7357('0x4e')][_0x7357('0x30')]);_0x5186a1[_0x7357('0x36')]=_[_0x7357('0x35')](_0x268644[_0x7357('0x36')]);_0x5186a1['filters']=_[_0x7357('0x38')](_0x5186a1[_0x7357('0x33')],_0x5186a1[_0x7357('0x36')]);_0x2bfef5[_0x7357('0x39')]=_['intersection'](_0x5186a1[_0x7357('0x33')],qs[_0x7357('0x3a')](_0x268644[_0x7357('0x36')][_0x7357('0x3a')]));_0x2bfef5[_0x7357('0x39')]=_0x2bfef5[_0x7357('0x39')][_0x7357('0x49')]?_0x2bfef5[_0x7357('0x39')]:_0x5186a1[_0x7357('0x33')];_0x2bfef5[_0x7357('0x52')]=qs[_0x7357('0x3c')](_0x268644[_0x7357('0x36')][_0x7357('0x3c')]);_0x2bfef5[_0x7357('0x3d')]=qs['filters'](_['pick'](_0x268644[_0x7357('0x36')],_0x5186a1[_0x7357('0x37')]));if(_0x268644[_0x7357('0x36')][_0x7357('0x3f')]){_0x2bfef5[_0x7357('0x3d')]=_[_0x7357('0x40')](_0x2bfef5[_0x7357('0x3d')],{'$or':_[_0x7357('0x34')](_0x2bfef5[_0x7357('0x39')],function(_0x220f8f){var _0x3cb11f={};_0x3cb11f[_0x220f8f]={'$like':'%'+_0x268644[_0x7357('0x36')]['filter']+'%'};return _0x3cb11f;})});}_0x2bfef5=_[_0x7357('0x40')]({},_0x2bfef5,_0x268644[_0x7357('0x41')]);return _0x57c731[_0x7357('0x50')](_0x2bfef5);}})[_0x7357('0x29')](function(_0x13d5ed){if(_0x13d5ed){_0x246432=_0x13d5ed[_0x7357('0x49')];if(!_0x268644['query'][_0x7357('0x3b')](_0x7357('0x53'))){_0x2bfef5['limit']=qs[_0x7357('0x20')](_0x268644[_0x7357('0x36')][_0x7357('0x20')]);_0x2bfef5[_0x7357('0x1f')]=qs[_0x7357('0x1f')](_0x268644['query']['offset']);}return _0x57c731[_0x7357('0x50')](_0x2bfef5);}})[_0x7357('0x29')](function(_0x569044){if(_0x569044){return _0x569044?{'count':_0x246432,'rows':_0x569044}:null;}})[_0x7357('0x29')](respondWithResult(_0x532599,null))[_0x7357('0x46')](handleError(_0x532599,null));};exports[_0x7357('0x54')]=function(_0x10431f,_0x22b496,_0x497a32){return db[_0x7357('0x55')][_0x7357('0x4a')]({'where':{'id':_0x10431f['params']['id']}})[_0x7357('0x29')](handleEntityNotFound(_0x22b496,null))[_0x7357('0x29')](function(_0x5e9063){if(_0x5e9063){return _0x5e9063[_0x7357('0x54')](_0x10431f['body']['ids'],_[_0x7357('0x56')](_0x10431f[_0x7357('0x4c')],[_0x7357('0x4f'),'id'])||{});}})[_0x7357('0x29')](respondWithResult(_0x22b496,null))[_0x7357('0x46')](handleError(_0x22b496,null));};exports['getActions']=function(_0x403b72,_0x5e9009,_0x1b33da){var _0x56946d={};var _0x501e0e={};var _0x30bcee;var _0x45fc5f;return db[_0x7357('0x42')]['findOne']({'where':{'id':_0x403b72['params']['id']}})[_0x7357('0x29')](handleEntityNotFound(_0x5e9009,null))['then'](function(_0x50c175){if(_0x50c175){_0x30bcee=_0x50c175;_0x501e0e[_0x7357('0x33')]=_[_0x7357('0x35')](db['Action'][_0x7357('0x30')]);_0x501e0e[_0x7357('0x36')]=_[_0x7357('0x35')](_0x403b72[_0x7357('0x36')]);_0x501e0e['filters']=_[_0x7357('0x38')](_0x501e0e[_0x7357('0x33')],_0x501e0e['query']);_0x56946d['attributes']=_['intersection'](_0x501e0e[_0x7357('0x33')],qs[_0x7357('0x3a')](_0x403b72[_0x7357('0x36')]['fields']));_0x56946d['attributes']=_0x56946d[_0x7357('0x39')][_0x7357('0x49')]?_0x56946d[_0x7357('0x39')]:_0x501e0e[_0x7357('0x33')];_0x56946d[_0x7357('0x52')]=qs[_0x7357('0x3c')](_0x403b72['query'][_0x7357('0x3c')]);_0x56946d[_0x7357('0x3d')]=qs[_0x7357('0x37')](_[_0x7357('0x3e')](_0x403b72[_0x7357('0x36')],_0x501e0e[_0x7357('0x37')]));if(_0x403b72[_0x7357('0x36')][_0x7357('0x3f')]){_0x56946d[_0x7357('0x3d')]=_[_0x7357('0x40')](_0x56946d[_0x7357('0x3d')],{'$or':_['map'](_0x56946d[_0x7357('0x39')],function(_0x31f223){var _0x31d7d2={};_0x31d7d2[_0x31f223]={'$like':'%'+_0x403b72[_0x7357('0x36')]['filter']+'%'};return _0x31d7d2;})});}_0x56946d=_[_0x7357('0x40')]({},_0x56946d,_0x403b72[_0x7357('0x41')]);return _0x30bcee[_0x7357('0x57')](_0x56946d);}})[_0x7357('0x29')](function(_0x3ed7aa){if(_0x3ed7aa){_0x45fc5f=_0x3ed7aa[_0x7357('0x49')];if(!_0x403b72[_0x7357('0x36')][_0x7357('0x3b')](_0x7357('0x53'))){_0x56946d[_0x7357('0x20')]=qs[_0x7357('0x20')](_0x403b72[_0x7357('0x36')][_0x7357('0x20')]);_0x56946d[_0x7357('0x1f')]=qs[_0x7357('0x1f')](_0x403b72['query']['offset']);}return _0x30bcee[_0x7357('0x57')](_0x56946d);}})['then'](function(_0x58f57a){if(_0x58f57a){return _0x58f57a?{'count':_0x45fc5f,'rows':_0x58f57a}:null;}})[_0x7357('0x29')](respondWithResult(_0x5e9009,null))[_0x7357('0x46')](handleError(_0x5e9009,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 9782bf6..9fb1035 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 _0xf4ab=['../../config/environment','./automation.attributes','exports','define','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x54a4b4,_0x596ffa){var _0x2dd6ba=function(_0x3cc84c){while(--_0x3cc84c){_0x54a4b4['push'](_0x54a4b4['shift']());}};_0x2dd6ba(++_0x596ffa);}(_0xf4ab,0x17f));var _0xbf4a=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xf4ab[_0x59c301];return _0x3866b9;};'use strict';var _=require(_0xbf4a('0x0'));var util=require(_0xbf4a('0x1'));var logger=require(_0xbf4a('0x2'))(_0xbf4a('0x3'));var moment=require(_0xbf4a('0x4'));var BPromise=require(_0xbf4a('0x5'));var rp=require(_0xbf4a('0x6'));var fs=require('fs');var path=require(_0xbf4a('0x7'));var rimraf=require(_0xbf4a('0x8'));var config=require(_0xbf4a('0x9'));var attributes=require(_0xbf4a('0xa'));module[_0xbf4a('0xb')]=function(_0x35fb88,_0x45778f){return _0x35fb88[_0xbf4a('0xc')]('Automation',attributes,{'tableName':_0xbf4a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdca=['tools_automations','lodash','util','../../config/logger','api','path','./automation.attributes','exports','define','Automation'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0xfdca,0x15f));var _0xafdc=function(_0x7e7ce2,_0x540184){_0x7e7ce2=_0x7e7ce2-0x0;var _0x19169a=_0xfdca[_0x7e7ce2];return _0x19169a;};'use strict';var _=require(_0xafdc('0x0'));var util=require(_0xafdc('0x1'));var logger=require(_0xafdc('0x2'))(_0xafdc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafdc('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xafdc('0x5'));module[_0xafdc('0x6')]=function(_0x11c4c0,_0x439a3e){return _0x11c4c0[_0xafdc('0x7')](_0xafdc('0x8'),attributes,{'tableName':_0xafdc('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 453117f..f14d451 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 _0xc5df=['message','result','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x58dbe8,_0x3567dc){var _0x568dd1=function(_0x2c73c7){while(--_0x2c73c7){_0x58dbe8['push'](_0x58dbe8['shift']());}};_0x568dd1(++_0x3567dc);}(_0xc5df,0x80));var _0xfc5d=function(_0x25fe3e,_0x19b2a4){_0x25fe3e=_0x25fe3e-0x0;var _0xe9ba2a=_0xc5df[_0x25fe3e];return _0xe9ba2a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc5d('0x0'));var BPromise=require(_0xfc5d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc5d('0x2'))['db'];var utils=require(_0xfc5d('0x3'));var logger=require(_0xfc5d('0x4'))(_0xfc5d('0x5'));var config=require(_0xfc5d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc5d('0x7')][_0xfc5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b8b10,_0x535aa7,_0x2a38ce){return new BPromise(function(_0x240ba0,_0x522712){return client[_0xfc5d('0x9')](_0x1b8b10,_0x2a38ce)[_0xfc5d('0xa')](function(_0x4f9a05){logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');logger[_0xfc5d('0xd')](_0xfc5d('0xe'),_0x535aa7,_0xfc5d('0xf'),JSON[_0xfc5d('0x10')](_0x4f9a05));if(_0x4f9a05['error']){if(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x12')]===0x1f4){logger[_0xfc5d('0x11')]('Automation,\x20%s,\x20%s',_0x535aa7,_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);return _0x522712(_0x4f9a05['error'][_0xfc5d('0x13')]);}logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x4f9a05['error'][_0xfc5d('0x13')]);return _0x240ba0(_0x4f9a05[_0xfc5d('0x11')][_0xfc5d('0x13')]);}else{logger[_0xfc5d('0xb')](_0xfc5d('0xc'),_0x535aa7,'request\x20sent');_0x240ba0(_0x4f9a05[_0xfc5d('0x14')][_0xfc5d('0x13')]);}})['catch'](function(_0x26f84a){logger['error'](_0xfc5d('0xc'),_0x535aa7,_0x26f84a);_0x522712(_0x26f84a);});});} \ No newline at end of file +var _0x794b=['Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x32066a,_0x236eec){var _0x566431=function(_0x40f9e5){while(--_0x40f9e5){_0x32066a['push'](_0x32066a['shift']());}};_0x566431(++_0x236eec);}(_0x794b,0x1c2));var _0xb794=function(_0x9e5fc6,_0x406f25){_0x9e5fc6=_0x9e5fc6-0x0;var _0x3e9c4a=_0x794b[_0x9e5fc6];return _0x3e9c4a;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e4d4,_0x231206,_0x340863){return new BPromise(function(_0x5d099b,_0x30f03f){return client[_0xb794('0x9')](_0x20e4d4,_0x340863)[_0xb794('0xa')](function(_0xc3dde7){logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,_0xb794('0xd'));logger[_0xb794('0xe')](_0xb794('0xf'),_0x231206,_0xb794('0xd'),JSON[_0xb794('0x10')](_0xc3dde7));if(_0xc3dde7[_0xb794('0x11')]){if(_0xc3dde7[_0xb794('0x11')][_0xb794('0x12')]===0x1f4){logger[_0xb794('0x11')](_0xb794('0xc'),_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x30f03f(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}logger[_0xb794('0x11')]('Automation,\x20%s,\x20%s',_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x5d099b(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}else{logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,'request\x20sent');_0x5d099b(_0xc3dde7[_0xb794('0x14')][_0xb794('0x13')]);}})['catch'](function(_0x408766){logger[_0xb794('0x11')]('Automation,\x20%s,\x20%s',_0x231206,_0x408766);_0x30f03f(_0x408766);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index edcf57e..619d795 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 _0xcb18=['path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','index','isAuthenticated','/:id/conditions','getConditions','/:id/actions','getActions','create','post','addConditions','addActions','/:id','update','delete','destroy','exports'];(function(_0x387061,_0x1117e0){var _0x12eb30=function(_0x3932e7){while(--_0x3932e7){_0x387061['push'](_0x387061['shift']());}};_0x12eb30(++_0x1117e0);}(_0xcb18,0x159));var _0x8cb1=function(_0x1e96bb,_0x181481){_0x1e96bb=_0x1e96bb-0x0;var _0x4e03da=_0xcb18[_0x1e96bb];return _0x4e03da;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var fs_extra=require(_0x8cb1('0x2'));var auth=require(_0x8cb1('0x3'));var interaction=require(_0x8cb1('0x4'));var config=require(_0x8cb1('0x5'));var controller=require(_0x8cb1('0x6'));router[_0x8cb1('0x7')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x8')]);router[_0x8cb1('0x7')]('/:id',auth[_0x8cb1('0x9')](),controller['show']);router[_0x8cb1('0x7')](_0x8cb1('0xa'),auth['isAuthenticated'](),controller[_0x8cb1('0xb')]);router[_0x8cb1('0x7')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xd')]);router['post']('/',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xe')]);router[_0x8cb1('0xf')]('/:id/conditions',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x10')]);router[_0x8cb1('0xf')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x11')]);router['put'](_0x8cb1('0x12'),auth['isAuthenticated'](),controller[_0x8cb1('0x13')]);router[_0x8cb1('0x14')](_0x8cb1('0x12'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0x15')]);module[_0x8cb1('0x16')]=router; \ No newline at end of file +var _0xfc9f=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./automation.controller','isAuthenticated','index','/:id','show','get','/:id/actions','getActions','post','create','/:id/conditions','addConditions','addActions','put','update'];(function(_0x3e3299,_0x176428){var _0x3c47a8=function(_0x489fd6){while(--_0x489fd6){_0x3e3299['push'](_0x3e3299['shift']());}};_0x3c47a8(++_0x176428);}(_0xfc9f,0x7a));var _0xffc9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfc9f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xffc9('0x0'));var util=require('util');var path=require(_0xffc9('0x1'));var timeout=require(_0xffc9('0x2'));var express=require(_0xffc9('0x3'));var router=express[_0xffc9('0x4')]();var fs_extra=require(_0xffc9('0x5'));var auth=require(_0xffc9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffc9('0x7'));router['get']('/',auth[_0xffc9('0x8')](),controller[_0xffc9('0x9')]);router['get'](_0xffc9('0xa'),auth[_0xffc9('0x8')](),controller[_0xffc9('0xb')]);router['get']('/:id/conditions',auth['isAuthenticated'](),controller['getConditions']);router[_0xffc9('0xc')](_0xffc9('0xd'),auth['isAuthenticated'](),controller[_0xffc9('0xe')]);router[_0xffc9('0xf')]('/',auth[_0xffc9('0x8')](),controller[_0xffc9('0x10')]);router[_0xffc9('0xf')](_0xffc9('0x11'),auth[_0xffc9('0x8')](),controller[_0xffc9('0x12')]);router[_0xffc9('0xf')](_0xffc9('0xd'),auth[_0xffc9('0x8')](),controller[_0xffc9('0x13')]);router[_0xffc9('0x14')]('/:id',auth[_0xffc9('0x8')](),controller[_0xffc9('0x15')]);router['delete'](_0xffc9('0xa'),auth['isAuthenticated'](),controller[_0xffc9('0x16')]);module[_0xffc9('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index de45cb3..f3a79bc 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 _0x9f9d=['#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','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','ENUM','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','#AMD\x20Greeting'];(function(_0x2d7ec9,_0x52833e){var _0x199c90=function(_0x584caa){while(--_0x584caa){_0x2d7ec9['push'](_0x2d7ec9['shift']());}};_0x199c90(++_0x52833e);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x2282a8,_0x3cea15){_0x2282a8=_0x2282a8-0x0;var _0xa9acf2=_0x9f9d[_0x2282a8];return _0xa9acf2;};'use strict';var Sequelize=require(_0xd9f9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd9f9('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xd9f9('0x2')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xd9f9('0x1')]},'active':{'type':Sequelize[_0xd9f9('0x3')],'defaultValue':0x0,'comment':_0xd9f9('0x4')},'limitCalls':{'type':Sequelize[_0xd9f9('0x5')](0x4)[_0xd9f9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xd9f9('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xd9f9('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xd9f9('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x8')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xd9f9('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xd9f9('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xd9f9('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xd9f9('0x2')](_0xd9f9('0xf'),_0xd9f9('0x10'),'onlyIfOpen'),'defaultValue':_0xd9f9('0xf')},'dialAMDActive':{'type':Sequelize[_0xd9f9('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xd9f9('0x11')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)[_0xd9f9('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xd9f9('0x12')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9f9('0x13')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xd9f9('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xd9f9('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xd9f9('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xd9f9('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xd9f9('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xd9f9('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xd9f9('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xd9f9('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0xd9f9('0x2')]('DESC',_0xd9f9('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xd9f9('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd9f9('0x1a')},'dialCutDigit':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xd9f9('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xd9f9('0x5')](0x3)[_0xd9f9('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xd9f9('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xd9f9('0x5')](0x5)[_0xd9f9('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xd9f9('0x23')}}; \ No newline at end of file +var _0xa8b1=['STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','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','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports'];(function(_0x1a9892,_0x358c7a){var _0x54270f=function(_0xf3a2fd){while(--_0xf3a2fd){_0x1a9892['push'](_0x1a9892['shift']());}};_0x54270f(++_0x358c7a);}(_0xa8b1,0xd7));var _0x1a8b=function(_0x368d06,_0x122f3a){_0x368d06=_0x368d06-0x0;var _0x204ba5=_0xa8b1[_0x368d06];return _0x204ba5;};'use strict';var Sequelize=require('sequelize');module[_0x1a8b('0x0')]={'name':{'type':Sequelize[_0x1a8b('0x1')],'unique':_0x1a8b('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1a8b('0x3')](_0x1a8b('0x4')),'allowNull':![],'defaultValue':_0x1a8b('0x4')},'description':{'type':Sequelize[_0x1a8b('0x1')]},'active':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':0x0,'comment':_0x1a8b('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x1a8b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1a8b('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x1a8b('0x9')](0x3)[_0x1a8b('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1a8b('0x9')](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8b('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)[_0x1a8b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8b('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8b('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x1a8b('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1a8b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1a8b('0x1')],'defaultValue':_0x1a8b('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1a8b('0x3')](_0x1a8b('0xf'),_0x1a8b('0x10'),_0x1a8b('0x11')),'defaultValue':_0x1a8b('0xf')},'dialAMDActive':{'type':Sequelize[_0x1a8b('0x5')],'defaultValue':0x0,'comment':_0x1a8b('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1a8b('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1a8b('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a8b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x1a8b('0x9')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1a8b('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1a8b('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1a8b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1a8b('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1a8b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1a8b('0x9')](0x9)[_0x1a8b('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a8b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1a8b('0x1b'),_0x1a8b('0x1c')),'defaultValue':_0x1a8b('0x1b')},'dialPrefix':{'type':Sequelize[_0x1a8b('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1a8b('0x9')](0x3)[_0x1a8b('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a8b('0x1d')},'dialCutDigit':{'type':Sequelize[_0x1a8b('0x9')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a8b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)[_0x1a8b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8b('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x1a8b('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8b('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8b('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1a8b('0x9')](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1a8b('0x9')](0x3)[_0x1a8b('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8b('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1a8b('0x9')](0x5)[_0x1a8b('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8b('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2c06374..994be23 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 _0xe511=['VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','UserProfileResource','create','catch','clone','updatedAt','body','omit','createdAt','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','nolimit','CmHopper','findOne','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','ids','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','ListId\x20=\x20?','cmHopperId','OrderBy','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','destroy','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','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','status','end','json','offset','limit','count','set','Content-Range','save','update','then','get','IvrCampaigns','error','name','send','map','Campaign','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','filters','pick','filter','where','merge'];(function(_0x1e896c,_0x3f9948){var _0xd149d9=function(_0x3281e5){while(--_0x3281e5){_0x1e896c['push'](_0x1e896c['shift']());}};_0xd149d9(++_0x3f9948);}(_0xe511,0x16f));var _0x1e51=function(_0x563582,_0x1c23c5){_0x563582=_0x563582-0x0;var _0x3b6a0f=_0xe511[_0x563582];return _0x3b6a0f;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){var _0x43f5c5=_0x461d3d[_0x1e51('0x24')]({'plain':!![]});var _0x2e42b1=_0x1e51('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x2e42b1,'resourceId':_0x43f5c5['id']}})['then'](function(){return _0x461d3d;});})[_0x1e51('0x23')](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x5412bc,_0x1e7a96){return function(_0x49c507){if(!_0x49c507){_0x5412bc['sendStatus'](0x194);}return _0x49c507;};}function handleError(_0x3349f0,_0x5c5bbd){_0x5c5bbd=_0x5c5bbd||0x1f4;return function(_0x170ec6){logger[_0x1e51('0x26')](_0x170ec6['stack']);if(_0x170ec6[_0x1e51('0x27')]){delete _0x170ec6[_0x1e51('0x27')];}_0x3349f0[_0x1e51('0x19')](_0x5c5bbd)[_0x1e51('0x28')](_0x170ec6);};}exports['index']=function(_0x4cf046,_0x4f67d3){var _0x20eb9b={},_0x288b50={},_0x1ba84a={'count':0x0,'rows':[]};var _0x36dabe=_[_0x1e51('0x29')](db[_0x1e51('0x2a')][_0x1e51('0x2b')],function(_0x34701c){return{'name':_0x34701c[_0x1e51('0x2c')],'type':_0x34701c[_0x1e51('0x2d')][_0x1e51('0x2e')]};});_0x288b50['model']=_[_0x1e51('0x29')](_0x36dabe,_0x1e51('0x27'));_0x288b50[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4cf046[_0x1e51('0x2f')]);_0x288b50['filters']=_[_0x1e51('0x31')](_0x288b50['model'],_0x288b50[_0x1e51('0x2f')]);_0x20eb9b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x288b50['model'],qs[_0x1e51('0x33')](_0x4cf046['query'][_0x1e51('0x33')]));_0x20eb9b['attributes']=_0x20eb9b['attributes'][_0x1e51('0x34')]?_0x20eb9b[_0x1e51('0x32')]:_0x288b50[_0x1e51('0x35')];if(!_0x4cf046['query'][_0x1e51('0x36')]('nolimit')){_0x20eb9b[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4cf046['query'][_0x1e51('0x1d')]);_0x20eb9b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x20eb9b[_0x1e51('0x37')]=qs['sort'](_0x4cf046['query'][_0x1e51('0x38')]);_0x20eb9b['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x4cf046[_0x1e51('0x2f')],_0x288b50[_0x1e51('0x39')]),_0x36dabe);if(_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x20eb9b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x20eb9b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x36dabe,function(_0x45d5fe){if(_0x45d5fe['type']!==_0x1e51('0x3e')){var _0x5818be={};_0x5818be[_0x45d5fe[_0x1e51('0x27')]]={'$like':'%'+_0x4cf046[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x5818be;}})});}_0x20eb9b=_[_0x1e51('0x3d')]({},_0x20eb9b,_0x4cf046[_0x1e51('0x3f')]);var _0x2f8fd9={'where':_0x20eb9b[_0x1e51('0x3c')]};return db[_0x1e51('0x2a')][_0x1e51('0x1e')](_0x2f8fd9)[_0x1e51('0x23')](function(_0xc40fce){_0x1ba84a['count']=_0xc40fce;if(_0x4cf046['query'][_0x1e51('0x40')]){_0x20eb9b[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x2a')][_0x1e51('0x42')](_0x20eb9b);})[_0x1e51('0x23')](function(_0x1a9e0d){_0x1ba84a[_0x1e51('0x43')]=_0x1a9e0d;return _0x1ba84a;})[_0x1e51('0x23')](respondWithFilteredResult(_0x4f67d3,_0x20eb9b))['catch'](handleError(_0x4f67d3,null));};exports[_0x1e51('0x44')]=function(_0x30eba9,_0x1750b3){var _0x41ca21={'raw':![],'where':{'id':_0x30eba9[_0x1e51('0x45')]['id']}},_0xfd96a0={};_0xfd96a0[_0x1e51('0x35')]=_['keys'](db[_0x1e51('0x2a')][_0x1e51('0x2b')]);_0xfd96a0['query']=_[_0x1e51('0x30')](_0x30eba9[_0x1e51('0x2f')]);_0xfd96a0[_0x1e51('0x39')]=_['intersection'](_0xfd96a0[_0x1e51('0x35')],_0xfd96a0[_0x1e51('0x2f')]);_0x41ca21[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0xfd96a0[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x41ca21[_0x1e51('0x32')]=_0x41ca21['attributes'][_0x1e51('0x34')]?_0x41ca21[_0x1e51('0x32')]:_0xfd96a0['model'];if(_0x30eba9[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x41ca21[_0x1e51('0x41')]=[{'all':!![]}];}_0x41ca21=_['merge']({},_0x41ca21,_0x30eba9[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x41ca21)['then'](handleEntityNotFound(_0x1750b3,null))[_0x1e51('0x23')](respondWithResult(_0x1750b3,null))['catch'](handleError(_0x1750b3,null));};exports['create']=function(_0x54688b,_0x169e6c){return db[_0x1e51('0x2a')]['create'](_0x54688b['body'],{})[_0x1e51('0x23')](function(_0x7ffc42){var _0x2a43dd=_0x54688b[_0x1e51('0x47')][_0x1e51('0x24')]({'plain':!![]});if(!_0x2a43dd)throw new Error(_0x1e51('0x48'));if(_0x2a43dd['role']===_0x1e51('0x47')){var _0x48a2d0=_0x7ffc42[_0x1e51('0x24')]({'plain':!![]});var _0x43589a='IvrCampaigns';return db['UserProfileSection']['find']({'where':{'name':_0x43589a,'userProfileId':_0x2a43dd[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x31a37a){if(_0x31a37a&&_0x31a37a['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x48a2d0[_0x1e51('0x27')],'resourceId':_0x48a2d0['id'],'type':_0x31a37a[_0x1e51('0x27')],'sectionId':_0x31a37a['id']},{})[_0x1e51('0x23')](function(){return _0x7ffc42;});}else{return _0x7ffc42;}})[_0x1e51('0x4c')](function(_0x32fe1f){logger[_0x1e51('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32fe1f);throw _0x32fe1f;});}return _0x7ffc42;})[_0x1e51('0x23')](respondWithResult(_0x169e6c,0xc9))[_0x1e51('0x4c')](handleError(_0x169e6c,null));};exports[_0x1e51('0x4d')]=function(_0x213edb,_0x177b63){var _0x2a88db={'where':{'id':_0x213edb[_0x1e51('0x45')]['id']}},_0x5ba6c2={};_0x5ba6c2['model']=_['keys'](db['Campaign'][_0x1e51('0x2b')]);_0x2a88db[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x5ba6c2['model'],qs[_0x1e51('0x33')](_0x213edb[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x2a88db['attributes']=_0x2a88db[_0x1e51('0x32')][_0x1e51('0x34')]?_0x2a88db[_0x1e51('0x32')]:_0x5ba6c2['model'];if(_0x213edb[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x2a88db[_0x1e51('0x41')]=[{'all':!![]}];}_0x2a88db=_[_0x1e51('0x3d')]({},_0x2a88db,_0x213edb[_0x1e51('0x3f')]);return db[_0x1e51('0x2a')][_0x1e51('0x46')](_0x2a88db)[_0x1e51('0x23')](handleEntityNotFound(_0x177b63,null))['then'](function(_0xd21d08){if(_0xd21d08){var _0x2e78e7=_0xd21d08['get']({'plain':!![]});_0x2e78e7=qs['omit'](_0x2e78e7,['id','createdAt',_0x1e51('0x4e')]);_0x213edb[_0x1e51('0x4f')]=_[_0x1e51('0x50')](_0x213edb[_0x1e51('0x4f')],['id',_0x1e51('0x51'),_0x1e51('0x4e')]);return db[_0x1e51('0x2a')][_0x1e51('0x4b')](_[_0x1e51('0x3d')](_0x2e78e7,_0x213edb['body']),{'include':_0x213edb['query']['includeAll']?[{'all':!![]}]:undefined})[_0x1e51('0x23')](function(_0x4048a4){var _0x50c202=_0x213edb['user'][_0x1e51('0x24')]({'plain':!![]});if(!_0x50c202)throw new Error(_0x1e51('0x48'));if(_0x50c202['role']===_0x1e51('0x47')){var _0x1fc8a9=_0x4048a4[_0x1e51('0x24')]({'plain':!![]});var _0x3e4073=_0x1e51('0x25');return db[_0x1e51('0x52')][_0x1e51('0x46')]({'where':{'name':_0x3e4073,'userProfileId':_0x50c202[_0x1e51('0x49')]},'raw':!![]})[_0x1e51('0x23')](function(_0x32863f){if(_0x32863f&&_0x32863f['autoAssociation']===0x0){return db[_0x1e51('0x4a')][_0x1e51('0x4b')]({'name':_0x1fc8a9[_0x1e51('0x27')],'resourceId':_0x1fc8a9['id'],'type':_0x32863f[_0x1e51('0x27')],'sectionId':_0x32863f['id']},{})[_0x1e51('0x23')](function(){return _0x4048a4;});}else{return _0x4048a4;}})[_0x1e51('0x4c')](function(_0x47cc50){logger['error'](_0x1e51('0x53'),_0x47cc50);throw _0x47cc50;});}return _0x4048a4;});}})[_0x1e51('0x23')](respondWithResult(_0x177b63,0xc9))[_0x1e51('0x4c')](handleError(_0x177b63,null));};exports[_0x1e51('0x22')]=function(_0x52a439,_0x4bbe62){if(_0x52a439['body']['id']){delete _0x52a439[_0x1e51('0x4f')]['id'];}return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x52a439[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x4bbe62,null))['then'](saveUpdates(_0x52a439[_0x1e51('0x4f')],null))[_0x1e51('0x23')](respondWithResult(_0x4bbe62,null))[_0x1e51('0x4c')](handleError(_0x4bbe62,null));};exports['destroy']=function(_0x2d0ff0,_0x77f0c1){return db[_0x1e51('0x2a')]['find']({'where':{'id':_0x2d0ff0[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x77f0c1,null))['then'](removeEntity(_0x77f0c1,null))['catch'](handleError(_0x77f0c1,null));};exports[_0x1e51('0x54')]=function(_0x4d6d41,_0x4464bf,_0x4cd38b){var _0x17a9fd={'raw':!![],'where':{}};var _0xe1cfa0={};var _0x35f12e={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')]['findOne']({'where':{'id':_0x4d6d41[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x4464bf,null))['then'](function(_0xa31c12){if(_0xa31c12){_0xe1cfa0[_0x1e51('0x35')]=_[_0x1e51('0x30')](db['CmHopper'][_0x1e51('0x2b')]);_0xe1cfa0[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x4d6d41[_0x1e51('0x2f')]);_0xe1cfa0['filters']=_[_0x1e51('0x31')](_0xe1cfa0['model'],_0xe1cfa0['query']);_0x17a9fd[_0x1e51('0x32')]=_['intersection'](_0xe1cfa0[_0x1e51('0x35')],qs['fields'](_0x4d6d41[_0x1e51('0x2f')]['fields']));_0x17a9fd[_0x1e51('0x32')]=_0x17a9fd[_0x1e51('0x32')]['length']?_0x17a9fd[_0x1e51('0x32')]:_0xe1cfa0['model'];if(!_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x17a9fd[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0x4d6d41[_0x1e51('0x2f')]['limit']);_0x17a9fd[_0x1e51('0x1c')]=qs['offset'](_0x4d6d41['query'][_0x1e51('0x1c')]);}_0x17a9fd[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x17a9fd[_0x1e51('0x3c')]=qs[_0x1e51('0x39')](_['pick'](_0x4d6d41[_0x1e51('0x2f')],_0xe1cfa0[_0x1e51('0x39')]));_0x17a9fd[_0x1e51('0x3c')]['CampaignId']=_0xa31c12['id'];if(_0x4d6d41['query'][_0x1e51('0x3b')]){_0x17a9fd[_0x1e51('0x3c')]=_['merge'](_0x17a9fd[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x17a9fd['attributes'],function(_0x5eb939){var _0xe96651={};_0xe96651[_0x5eb939]={'$like':'%'+_0x4d6d41[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0xe96651;})});}_0x17a9fd=_[_0x1e51('0x3d')]({},_0x17a9fd,_0x4d6d41[_0x1e51('0x3f')]);return db[_0x1e51('0x56')][_0x1e51('0x1e')]({'where':_0x17a9fd['where']})['then'](function(_0x117a81){_0x35f12e[_0x1e51('0x1e')]=_0x117a81;if(_0x4d6d41['query'][_0x1e51('0x40')]){_0x17a9fd[_0x1e51('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x1e51('0x42')](_0x17a9fd);})['then'](function(_0x34b98f){_0x35f12e['rows']=_0x34b98f;return _0x35f12e;});}})['then'](respondWithFilteredResult(_0x4464bf,_0x17a9fd))['catch'](handleError(_0x4464bf,null));};exports['getHopperHistories']=function(_0x51ada3,_0x5a7201,_0x27d0ea){var _0x5aa741={'raw':!![],'where':{}};var _0xd05f32={};var _0x5682a6={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x51ada3[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x5a7201,null))[_0x1e51('0x23')](function(_0x3ed4b1){if(_0x3ed4b1){_0xd05f32['model']=_[_0x1e51('0x30')](db['CmHopperHistory'][_0x1e51('0x2b')]);_0xd05f32['query']=_[_0x1e51('0x30')](_0x51ada3[_0x1e51('0x2f')]);_0xd05f32[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0xd05f32[_0x1e51('0x35')],_0xd05f32[_0x1e51('0x2f')]);_0x5aa741['attributes']=_[_0x1e51('0x31')](_0xd05f32['model'],qs[_0x1e51('0x33')](_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x5aa741[_0x1e51('0x32')]=_0x5aa741['attributes']['length']?_0x5aa741['attributes']:_0xd05f32[_0x1e51('0x35')];if(!_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x5aa741['limit']=qs[_0x1e51('0x1d')](_0x51ada3['query'][_0x1e51('0x1d')]);_0x5aa741['offset']=qs['offset'](_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x5aa741['order']=qs[_0x1e51('0x38')](_0x51ada3['query'][_0x1e51('0x38')]);_0x5aa741['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x51ada3['query'],_0xd05f32[_0x1e51('0x39')]));_0x5aa741['where'][_0x1e51('0x58')]=_0x3ed4b1['id'];if(_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x5aa741[_0x1e51('0x3c')]=_['merge'](_0x5aa741[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x5aa741[_0x1e51('0x32')],function(_0x4ff0ff){var _0x4b62a4={};_0x4b62a4[_0x4ff0ff]={'$like':'%'+_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x4b62a4;})});}_0x5aa741=_[_0x1e51('0x3d')]({},_0x5aa741,_0x51ada3['options']);return db['CmHopperHistory']['count']({'where':_0x5aa741[_0x1e51('0x3c')]})[_0x1e51('0x23')](function(_0x31788a){_0x5682a6['count']=_0x31788a;if(_0x51ada3[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x5aa741['include']=[{'all':!![]}];}return db[_0x1e51('0x59')][_0x1e51('0x42')](_0x5aa741);})[_0x1e51('0x23')](function(_0x4af474){_0x5682a6[_0x1e51('0x43')]=_0x4af474;return _0x5682a6;});}})['then'](respondWithFilteredResult(_0x5a7201,_0x5aa741))[_0x1e51('0x4c')](handleError(_0x5a7201,null));};exports[_0x1e51('0x5a')]=function(_0x3525dc,_0x471b01,_0xd71adc){var _0x37a7ef={'raw':!![],'where':{}};var _0x37f26c={};var _0xa3225a={'count':0x0,'rows':[]};return db[_0x1e51('0x2a')]['findOne']({'where':{'id':_0x3525dc[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x471b01,null))[_0x1e51('0x23')](function(_0x4c7eb9){if(_0x4c7eb9){_0x37f26c[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x5b')][_0x1e51('0x2b')]);_0x37f26c[_0x1e51('0x2f')]=_[_0x1e51('0x30')](_0x3525dc[_0x1e51('0x2f')]);_0x37f26c[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x37f26c['model'],_0x37f26c[_0x1e51('0x2f')]);_0x37a7ef[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x37f26c['model'],qs[_0x1e51('0x33')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x33')]));_0x37a7ef['attributes']=_0x37a7ef[_0x1e51('0x32')][_0x1e51('0x34')]?_0x37a7ef[_0x1e51('0x32')]:_0x37f26c[_0x1e51('0x35')];if(!_0x3525dc[_0x1e51('0x2f')]['hasOwnProperty']('nolimit')){_0x37a7ef[_0x1e51('0x1d')]=qs['limit'](_0x3525dc['query'][_0x1e51('0x1d')]);_0x37a7ef[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x1c')]);}_0x37a7ef[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x37a7ef['where']=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0x3525dc[_0x1e51('0x2f')],_0x37f26c['filters']));_0x37a7ef['where'][_0x1e51('0x58')]=_0x4c7eb9['id'];if(_0x3525dc[_0x1e51('0x2f')]['filter']){_0x37a7ef[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x37a7ef['where'],{'$or':_[_0x1e51('0x29')](_0x37a7ef[_0x1e51('0x32')],function(_0x4367ba){var _0x570c75={};_0x570c75[_0x4367ba]={'$like':'%'+_0x3525dc[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x570c75;})});}_0x37a7ef=_[_0x1e51('0x3d')]({},_0x37a7ef,_0x3525dc[_0x1e51('0x3f')]);return db[_0x1e51('0x5b')][_0x1e51('0x1e')]({'where':_0x37a7ef[_0x1e51('0x3c')]})[_0x1e51('0x23')](function(_0x1a8903){_0xa3225a[_0x1e51('0x1e')]=_0x1a8903;if(_0x3525dc['query']['includeAll']){_0x37a7ef[_0x1e51('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x37a7ef);})['then'](function(_0x251595){_0xa3225a['rows']=_0x251595;return _0xa3225a;});}})[_0x1e51('0x23')](respondWithFilteredResult(_0x471b01,_0x37a7ef))['catch'](handleError(_0x471b01,null));};exports[_0x1e51('0x5c')]=function(_0xb79285,_0x4859cd,_0x14d40c){var _0x5c4fe6={'raw':!![],'where':{}};var _0x7ebccd={};var _0x3f0cb2={'count':0x0,'rows':[]};return db['Campaign'][_0x1e51('0x57')]({'where':{'id':_0xb79285[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x4859cd,null))['then'](function(_0x4e99dd){if(_0x4e99dd){_0x7ebccd[_0x1e51('0x35')]=_[_0x1e51('0x30')](db[_0x1e51('0x5d')]['rawAttributes']);_0x7ebccd['query']=_[_0x1e51('0x30')](_0xb79285[_0x1e51('0x2f')]);_0x7ebccd[_0x1e51('0x39')]=_['intersection'](_0x7ebccd[_0x1e51('0x35')],_0x7ebccd[_0x1e51('0x2f')]);_0x5c4fe6[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x7ebccd[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0xb79285['query'][_0x1e51('0x33')]));_0x5c4fe6[_0x1e51('0x32')]=_0x5c4fe6[_0x1e51('0x32')]['length']?_0x5c4fe6['attributes']:_0x7ebccd[_0x1e51('0x35')];if(!_0xb79285['query']['hasOwnProperty']('nolimit')){_0x5c4fe6[_0x1e51('0x1d')]=qs[_0x1e51('0x1d')](_0xb79285[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x5c4fe6['offset']=qs['offset'](_0xb79285['query'][_0x1e51('0x1c')]);}_0x5c4fe6['order']=qs[_0x1e51('0x38')](_0xb79285[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x5c4fe6[_0x1e51('0x3c')]=qs[_0x1e51('0x39')](_[_0x1e51('0x3a')](_0xb79285[_0x1e51('0x2f')],_0x7ebccd['filters']));_0x5c4fe6[_0x1e51('0x3c')][_0x1e51('0x58')]=_0x4e99dd['id'];if(_0xb79285[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x5c4fe6['where']=_[_0x1e51('0x3d')](_0x5c4fe6[_0x1e51('0x3c')],{'$or':_['map'](_0x5c4fe6[_0x1e51('0x32')],function(_0x2ab009){var _0x42ae53={};_0x42ae53[_0x2ab009]={'$like':'%'+_0xb79285[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x42ae53;})});}_0x5c4fe6=_[_0x1e51('0x3d')]({},_0x5c4fe6,_0xb79285[_0x1e51('0x3f')]);return db[_0x1e51('0x5d')][_0x1e51('0x1e')]({'where':_0x5c4fe6[_0x1e51('0x3c')]})['then'](function(_0x210df0){_0x3f0cb2[_0x1e51('0x1e')]=_0x210df0;if(_0xb79285[_0x1e51('0x2f')][_0x1e51('0x40')]){_0x5c4fe6[_0x1e51('0x41')]=[{'all':!![]}];}return db[_0x1e51('0x5d')][_0x1e51('0x42')](_0x5c4fe6);})[_0x1e51('0x23')](function(_0x1e1c48){_0x3f0cb2[_0x1e51('0x43')]=_0x1e1c48;return _0x3f0cb2;});}})[_0x1e51('0x23')](respondWithFilteredResult(_0x4859cd,_0x5c4fe6))['catch'](handleError(_0x4859cd,null));};exports[_0x1e51('0x5e')]=function(_0x3fa83a,_0x4c0f22,_0x5ae595){var _0x4595d6={};var _0x3ac432={};var _0x9aa50a;var _0x8cf4bc;return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x3fa83a['params']['id']}})['then'](handleEntityNotFound(_0x4c0f22,null))[_0x1e51('0x23')](function(_0x324a68){if(_0x324a68){_0x9aa50a=_0x324a68;_0x3ac432['model']=_[_0x1e51('0x30')](db[_0x1e51('0x5f')][_0x1e51('0x2b')]);_0x3ac432['query']=_[_0x1e51('0x30')](_0x3fa83a[_0x1e51('0x2f')]);_0x3ac432[_0x1e51('0x39')]=_['intersection'](_0x3ac432[_0x1e51('0x35')],_0x3ac432[_0x1e51('0x2f')]);_0x4595d6[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x3ac432['model'],qs[_0x1e51('0x33')](_0x3fa83a[_0x1e51('0x2f')]['fields']));_0x4595d6[_0x1e51('0x32')]=_0x4595d6[_0x1e51('0x32')][_0x1e51('0x34')]?_0x4595d6[_0x1e51('0x32')]:_0x3ac432['model'];_0x4595d6[_0x1e51('0x37')]=qs[_0x1e51('0x38')](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x4595d6[_0x1e51('0x3c')]=qs['filters'](_[_0x1e51('0x3a')](_0x3fa83a[_0x1e51('0x2f')],_0x3ac432[_0x1e51('0x39')]));if(_0x3fa83a[_0x1e51('0x2f')]['filter']){_0x4595d6['where']=_[_0x1e51('0x3d')](_0x4595d6['where'],{'$or':_['map'](_0x4595d6[_0x1e51('0x32')],function(_0x2db20f){var _0x1425f4={};_0x1425f4[_0x2db20f]={'$like':'%'+_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x3b')]+'%'};return _0x1425f4;})});}_0x4595d6=_[_0x1e51('0x3d')]({},_0x4595d6,_0x3fa83a['options']);return _0x9aa50a[_0x1e51('0x5e')](_0x4595d6);}})[_0x1e51('0x23')](function(_0x5bfd77){if(_0x5bfd77){_0x8cf4bc=_0x5bfd77['length'];if(!_0x3fa83a['query']['hasOwnProperty'](_0x1e51('0x55'))){_0x4595d6[_0x1e51('0x1d')]=qs['limit'](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x4595d6[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x3fa83a[_0x1e51('0x2f')][_0x1e51('0x1c')]);}return _0x9aa50a[_0x1e51('0x5e')](_0x4595d6);}})[_0x1e51('0x23')](function(_0x236554){if(_0x236554){return _0x236554?{'count':_0x8cf4bc,'rows':_0x236554}:null;}})[_0x1e51('0x23')](respondWithResult(_0x4c0f22,null))[_0x1e51('0x4c')](handleError(_0x4c0f22,null));};exports['addLists']=function(_0x1d3b1d,_0x26eaa8,_0x41f919){var _0xafac74,_0x4ac5bd;var _0x4fbf59=[];var _0x358507=moment()[_0x1e51('0x60')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x1d3b1d['params']['id']}})['then'](handleEntityNotFound(_0x26eaa8,null))[_0x1e51('0x23')](function(_0xc10372){if(_0xc10372){_0x4ac5bd=_0xc10372;return _0xc10372['addLists'](_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x61')],_[_0x1e51('0x50')](_0x1d3b1d['body'],[_0x1e51('0x61'),'id'])||{});}return null;})['spread'](function(_0x5b6915){var _0x54ed06;var _0x46277a;_0xafac74=_0x5b6915||[];var _0x563d4b=[];if(_0x5b6915){for(var _0x5b959d=0x0;_0x5b959d<_0x5b6915[_0x1e51('0x34')];_0x5b959d+=0x1){var _0x30d666=_0x5b6915[_0x5b959d][_0x1e51('0x24')]({'plain':!![]});_0x4ac5bd[_0x1e51('0x62')]=_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x62')]?_0x1d3b1d[_0x1e51('0x4f')][_0x1e51('0x62')]:_0x4ac5bd[_0x1e51('0x62')];switch(_0x4ac5bd[_0x1e51('0x62')]){case _0x1e51('0x63'):_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')]('cm_hopper')[_0x1e51('0x66')]([_0x1e51('0x67'),_0x1e51('0x68'),'ContactId',_0x1e51('0x69'),_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x67'),_0x1e51('0x67'))[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x68'))[_0x1e51('0x6b')]('id',_0x1e51('0x6d'))[_0x1e51('0x6b')](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))[_0x1e51('0x6b')](_0x1d3b1d[_0x1e51('0x45')]['id']['toString'](),_0x1e51('0x58'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x51'))['field']('\x27'+_0x358507+'\x27','updatedAt')[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')]('ListId\x20=\x20?',_0x30d666['CmListId'][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x73'))[_0x1e51('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x74'))[_0x1e51('0x70')](_0x1e51('0x75'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]()))['where'](_0x1e51('0x77'),squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x78'))[_0x1e51('0x70')](_0x1e51('0x79'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d['params']['id'][_0x1e51('0x6f')]())))[_0x1e51('0x6f')]();break;case _0x1e51('0x7a'):_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x79'))[_0x1e51('0x66')](['phone','scheduledAt',_0x1e51('0x6d'),'ListId',_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x67'),'phone')[_0x1e51('0x6b')]('NOW()',_0x1e51('0x68'))['field']('id',_0x1e51('0x6d'))['field'](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))[_0x1e51('0x6b')](_0x1d3b1d[_0x1e51('0x45')]['id']['toString'](),_0x1e51('0x58'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27','createdAt')[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27','updatedAt')[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))['where'](_0x1e51('0x7b'),_0x30d666[_0x1e51('0x6e')]['toString']())[_0x1e51('0x3c')](_0x1e51('0x73'))[_0x1e51('0x3c')](_0x1e51('0x77'),squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')](_0x1e51('0x78'))[_0x1e51('0x70')](_0x1e51('0x79'))[_0x1e51('0x3c')](_0x1e51('0x76'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]())))[_0x1e51('0x6f')]();break;default:_0x54ed06=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x79'))[_0x1e51('0x66')]([_0x1e51('0x67'),_0x1e51('0x68'),_0x1e51('0x6d'),_0x1e51('0x69'),_0x1e51('0x58'),'createdAt',_0x1e51('0x4e')],squel['select']()[_0x1e51('0x6b')]('phone','phone')[_0x1e51('0x6b')]('NOW()',_0x1e51('0x68'))[_0x1e51('0x6b')]('id','ContactId')[_0x1e51('0x6b')](_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')](),_0x1e51('0x69'))['field'](_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')](),'CampaignId')['field']('\x27'+_0x358507+'\x27',_0x1e51('0x51'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x4e'))[_0x1e51('0x70')](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')](_0x1e51('0x7b'),_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x46277a=squel[_0x1e51('0x64')]()[_0x1e51('0x65')]('cm_hopper_additional_phones')['fromQuery']([_0x1e51('0x7c'),'scheduledAt',_0x1e51('0x67'),_0x1e51('0x7d'),_0x1e51('0x51'),_0x1e51('0x4e')],squel[_0x1e51('0x6a')]()['field']('h.id','id')[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x68'))['field'](_0x1e51('0x7e'),_0x1e51('0x67'))[_0x1e51('0x6b')](_0x1e51('0x7f'),_0x1e51('0x7d'))['field']('\x27'+_0x358507+'\x27',_0x1e51('0x51'))[_0x1e51('0x6b')]('\x27'+_0x358507+'\x27',_0x1e51('0x4e'))['from']('cm_contact_has_items','ci')[_0x1e51('0x80')](_0x1e51('0x79'),'h',_0x1e51('0x81'))[_0x1e51('0x3c')]('h.ListId\x20=\x20?',_0x30d666[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x82'),_0x1d3b1d[_0x1e51('0x45')]['id'][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x83'),_0x358507))[_0x1e51('0x6f')]();_0x563d4b[_0x1e51('0x84')](db[_0x1e51('0x85')][_0x1e51('0x2f')](_0x54ed06));_0x4fbf59[_0x1e51('0x84')](db[_0x1e51('0x85')]['query'](_0x46277a));}return BPromise[_0x1e51('0x86')](_0x563d4b);}})['then'](function(){return BPromise['all'](_0x4fbf59);})[_0x1e51('0x23')](function(){return _0xafac74;})[_0x1e51('0x23')](respondWithResult(_0x26eaa8,null))[_0x1e51('0x4c')](handleError(_0x26eaa8,null));};exports[_0x1e51('0x87')]=function(_0x29668d,_0x584ea6,_0xd3a3c6){return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x29668d[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x584ea6,null))[_0x1e51('0x23')](function(_0x272bbd){if(_0x272bbd){return _0x272bbd[_0x1e51('0x87')](_0x29668d[_0x1e51('0x2f')]['ids']);}})['then'](function(_0x4f5c91){if(_0x4f5c91){return db['CmHopper'][_0x1e51('0x88')]({'where':{'ListId':_0x29668d[_0x1e51('0x2f')][_0x1e51('0x61')],'CampaignId':_0x29668d['params']['id']}})[_0x1e51('0x23')](function(){return _0x4f5c91;});}})[_0x1e51('0x23')](respondWithStatusCode(_0x584ea6,null))['catch'](handleError(_0x584ea6,null));};exports[_0x1e51('0x89')]=function(_0x2fb27e,_0x469630,_0x6e245b){var _0x40a50b={};var _0x403cdc={};var _0x991c72;var _0x5076d9;return db[_0x1e51('0x2a')][_0x1e51('0x57')]({'where':{'id':_0x2fb27e[_0x1e51('0x45')]['id']}})['then'](handleEntityNotFound(_0x469630,null))[_0x1e51('0x23')](function(_0x4e9221){if(_0x4e9221){_0x991c72=_0x4e9221;_0x403cdc[_0x1e51('0x35')]=_[_0x1e51('0x30')](db['CmList'][_0x1e51('0x2b')]);_0x403cdc[_0x1e51('0x2f')]=_['keys'](_0x2fb27e[_0x1e51('0x2f')]);_0x403cdc[_0x1e51('0x39')]=_[_0x1e51('0x31')](_0x403cdc[_0x1e51('0x35')],_0x403cdc[_0x1e51('0x2f')]);_0x40a50b[_0x1e51('0x32')]=_[_0x1e51('0x31')](_0x403cdc[_0x1e51('0x35')],qs[_0x1e51('0x33')](_0x2fb27e[_0x1e51('0x2f')]['fields']));_0x40a50b['attributes']=_0x40a50b[_0x1e51('0x32')][_0x1e51('0x34')]?_0x40a50b[_0x1e51('0x32')]:_0x403cdc[_0x1e51('0x35')];_0x40a50b[_0x1e51('0x37')]=qs['sort'](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x38')]);_0x40a50b[_0x1e51('0x3c')]=qs['filters'](_['pick'](_0x2fb27e[_0x1e51('0x2f')],_0x403cdc[_0x1e51('0x39')]));if(_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x3b')]){_0x40a50b[_0x1e51('0x3c')]=_[_0x1e51('0x3d')](_0x40a50b[_0x1e51('0x3c')],{'$or':_[_0x1e51('0x29')](_0x40a50b[_0x1e51('0x32')],function(_0x36f888){var _0x4a9dc2={};_0x4a9dc2[_0x36f888]={'$like':'%'+_0x2fb27e['query'][_0x1e51('0x3b')]+'%'};return _0x4a9dc2;})});}_0x40a50b=_['merge']({},_0x40a50b,_0x2fb27e[_0x1e51('0x3f')]);return _0x991c72[_0x1e51('0x89')](_0x40a50b);}})[_0x1e51('0x23')](function(_0x34c7d5){if(_0x34c7d5){_0x5076d9=_0x34c7d5[_0x1e51('0x34')];if(!_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x36')](_0x1e51('0x55'))){_0x40a50b['limit']=qs[_0x1e51('0x1d')](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x1d')]);_0x40a50b[_0x1e51('0x1c')]=qs[_0x1e51('0x1c')](_0x2fb27e[_0x1e51('0x2f')][_0x1e51('0x1c')]);}return _0x991c72[_0x1e51('0x89')](_0x40a50b);}})[_0x1e51('0x23')](function(_0x38b2ab){if(_0x38b2ab){return _0x38b2ab?{'count':_0x5076d9,'rows':_0x38b2ab}:null;}})[_0x1e51('0x23')](respondWithResult(_0x469630,null))[_0x1e51('0x4c')](handleError(_0x469630,null));};exports['addBlackLists']=function(_0x11a8b6,_0x7eab7a,_0x4002cf){var _0x2bcf63,_0x409830;var _0x169d6f=[];var _0x453835=moment()[_0x1e51('0x60')](_0x1e51('0x8a'));return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x11a8b6['params']['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x7eab7a,null))['then'](function(_0x4f9569){if(_0x4f9569){_0x409830=_0x4f9569;return _0x4f9569[_0x1e51('0x8b')](_0x11a8b6[_0x1e51('0x4f')][_0x1e51('0x61')],_[_0x1e51('0x50')](_0x11a8b6['body'],[_0x1e51('0x61'),'id'])||{});}return null;})[_0x1e51('0x8c')](function(_0x19157e){var _0x5ea4c8;var _0xe52966;_0x2bcf63=_0x19157e||[];var _0x532591=[];if(_0x19157e){for(var _0x487e5f=0x0;_0x487e5f<_0x19157e['length'];_0x487e5f+=0x1){var _0x211923=_0x19157e[_0x487e5f][_0x1e51('0x24')]({'plain':!![]});_0x5ea4c8=squel[_0x1e51('0x64')]()[_0x1e51('0x65')](_0x1e51('0x8d'))[_0x1e51('0x66')](['phone',_0x1e51('0x6d'),'ListId','CampaignId','createdAt','updatedAt'],squel[_0x1e51('0x6a')]()[_0x1e51('0x6b')]('phone','phone')[_0x1e51('0x6b')]('id',_0x1e51('0x6d'))['field'](_0x211923[_0x1e51('0x6e')][_0x1e51('0x6f')](),'ListId')[_0x1e51('0x6b')](_0x11a8b6[_0x1e51('0x45')]['id']['toString'](),'CampaignId')[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x51'))[_0x1e51('0x6b')](_0x1e51('0x6c'),_0x1e51('0x4e'))['from'](_0x1e51('0x71'))[_0x1e51('0x3c')](_0x1e51('0x72'))[_0x1e51('0x3c')](_0x1e51('0x7b'),_0x211923[_0x1e51('0x6e')][_0x1e51('0x6f')]())[_0x1e51('0x3c')](_0x1e51('0x73')))[_0x1e51('0x6f')]();_0x532591[_0x1e51('0x84')](db[_0x1e51('0x85')][_0x1e51('0x2f')](_0x5ea4c8));}return BPromise[_0x1e51('0x86')](_0x532591);}})[_0x1e51('0x23')](function(){return _0x2bcf63;})[_0x1e51('0x23')](respondWithResult(_0x7eab7a,null))['catch'](handleError(_0x7eab7a,null));};exports[_0x1e51('0x8e')]=function(_0x5e8072,_0x52091b,_0x2b758){return db[_0x1e51('0x2a')][_0x1e51('0x46')]({'where':{'id':_0x5e8072[_0x1e51('0x45')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x52091b,null))['then'](function(_0x5c135a){if(_0x5c135a){return _0x5c135a[_0x1e51('0x8e')](_0x5e8072['query'][_0x1e51('0x61')]);}})[_0x1e51('0x23')](function(_0x3a70a0){if(_0x3a70a0){return db['CmHopperBlack'][_0x1e51('0x88')]({'where':{'ListId':_0x5e8072[_0x1e51('0x2f')][_0x1e51('0x61')],'CampaignId':_0x5e8072[_0x1e51('0x45')]['id']}})['then'](function(){return _0x3a70a0;});}})[_0x1e51('0x23')](respondWithStatusCode(_0x52091b,null))['catch'](handleError(_0x52091b,null));}; \ No newline at end of file +var _0x573e=['cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','into','fromQuery','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','count','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','body','UserProfileSection','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','from'];(function(_0x4448be,_0x4c2ef4){var _0x5edfda=function(_0x3aef0f){while(--_0x3aef0f){_0x4448be['push'](_0x4448be['shift']());}};_0x5edfda(++_0x4c2ef4);}(_0x573e,0x134));var _0xe573=function(_0x5c254e,_0x245ac3){_0x5c254e=_0x5c254e-0x0;var _0x448331=_0x573e[_0x5c254e];return _0x448331;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe573('0x0'));var zipdir=require(_0xe573('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe573('0x2'));var Mustache=require(_0xe573('0x3'));var util=require(_0xe573('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xe573('0x5'));var ejs=require(_0xe573('0x6'));var fs=require('fs');var fs_extra=require(_0xe573('0x7'));var _=require(_0xe573('0x8'));var squel=require('squel');var crypto=require(_0xe573('0x9'));var jsforce=require(_0xe573('0xa'));var deskjs=require(_0xe573('0xb'));var toCsv=require(_0xe573('0x5'));var querystring=require(_0xe573('0xc'));var Papa=require(_0xe573('0xd'));var Redis=require(_0xe573('0xe'));var authService=require(_0xe573('0xf'));var qs=require(_0xe573('0x10'));var as=require(_0xe573('0x11'));var hardwareService=require(_0xe573('0x12'));var logger=require(_0xe573('0x13'))(_0xe573('0x14'));var utils=require(_0xe573('0x15'));var config=require(_0xe573('0x16'));var licenseUtil=require(_0xe573('0x17'));var db=require(_0xe573('0x18'))['db'];function respondWithStatusCode(_0x2298f8,_0x25cef4){_0x25cef4=_0x25cef4||0xcc;return function(_0x46d246){if(_0x46d246){return _0x2298f8[_0xe573('0x19')](_0x25cef4);}return _0x2298f8[_0xe573('0x1a')](_0x25cef4)[_0xe573('0x1b')]();};}function respondWithResult(_0xfc33c6,_0x26122c){_0x26122c=_0x26122c||0xc8;return function(_0x389563){if(_0x389563){return _0xfc33c6[_0xe573('0x1a')](_0x26122c)[_0xe573('0x1c')](_0x389563);}};}function respondWithFilteredResult(_0xb9bc69,_0x20a06f){return function(_0x5cbe28){if(_0x5cbe28){var _0x2bdcb7=typeof _0x20a06f['offset']===_0xe573('0x1d')&&typeof _0x20a06f[_0xe573('0x1e')]===_0xe573('0x1d');var _0x398709=_0x5cbe28['count'];var _0x3009e9=_0x2bdcb7?0x0:_0x20a06f[_0xe573('0x1f')];var _0x3a602d=_0x2bdcb7?_0x5cbe28['count']:_0x20a06f[_0xe573('0x1f')]+_0x20a06f[_0xe573('0x1e')];var _0x12465a;if(_0x3a602d>=_0x398709){_0x3a602d=_0x398709;_0x12465a=0xc8;}else{_0x12465a=0xce;}_0xb9bc69['status'](_0x12465a);return _0xb9bc69[_0xe573('0x20')](_0xe573('0x21'),_0x3009e9+'-'+_0x3a602d+'/'+_0x398709)['json'](_0x5cbe28);}return null;};}function patchUpdates(_0x491c86){return function(_0x5806a0){try{jsonpatch['apply'](_0x5806a0,_0x491c86,!![]);}catch(_0x57f70e){return BPromise[_0xe573('0x22')](_0x57f70e);}return _0x5806a0[_0xe573('0x23')]();};}function saveUpdates(_0x464886,_0x59b91b){return function(_0x2f42e6){if(_0x2f42e6){return _0x2f42e6[_0xe573('0x24')](_0x464886)[_0xe573('0x25')](function(_0x5b2783){return _0x5b2783;});}return null;};}function removeEntity(_0x17424d,_0x47d4b9){return function(_0x33de94){if(_0x33de94){return _0x33de94[_0xe573('0x26')]()[_0xe573('0x25')](function(){var _0x1d7d6b=_0x33de94[_0xe573('0x27')]({'plain':!![]});var _0x366e5c=_0xe573('0x28');return db[_0xe573('0x29')][_0xe573('0x26')]({'where':{'type':_0x366e5c,'resourceId':_0x1d7d6b['id']}})[_0xe573('0x25')](function(){return _0x33de94;});})[_0xe573('0x25')](function(){_0x17424d[_0xe573('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x213d56,_0x2817cc){return function(_0x10dfe7){if(!_0x10dfe7){_0x213d56[_0xe573('0x19')](0x194);}return _0x10dfe7;};}function handleError(_0x5390e5,_0x12b1f6){_0x12b1f6=_0x12b1f6||0x1f4;return function(_0xb19b9b){logger[_0xe573('0x2a')](_0xb19b9b[_0xe573('0x2b')]);if(_0xb19b9b['name']){delete _0xb19b9b[_0xe573('0x2c')];}_0x5390e5[_0xe573('0x1a')](_0x12b1f6)['send'](_0xb19b9b);};}exports[_0xe573('0x2d')]=function(_0x1c2da7,_0x32d895){var _0x34ecc4={},_0x27718e={},_0x27c3dd={'count':0x0,'rows':[]};var _0x38b1d8=_['map'](db[_0xe573('0x2e')][_0xe573('0x2f')],function(_0x2aae7d){return{'name':_0x2aae7d[_0xe573('0x30')],'type':_0x2aae7d[_0xe573('0x31')][_0xe573('0x32')]};});_0x27718e[_0xe573('0x33')]=_[_0xe573('0x34')](_0x38b1d8,'name');_0x27718e[_0xe573('0x35')]=_[_0xe573('0x36')](_0x1c2da7[_0xe573('0x35')]);_0x27718e[_0xe573('0x37')]=_[_0xe573('0x38')](_0x27718e[_0xe573('0x33')],_0x27718e[_0xe573('0x35')]);_0x34ecc4[_0xe573('0x39')]=_[_0xe573('0x38')](_0x27718e[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x1c2da7[_0xe573('0x35')][_0xe573('0x3a')]));_0x34ecc4['attributes']=_0x34ecc4['attributes']['length']?_0x34ecc4[_0xe573('0x39')]:_0x27718e[_0xe573('0x33')];if(!_0x1c2da7[_0xe573('0x35')][_0xe573('0x3b')](_0xe573('0x3c'))){_0x34ecc4[_0xe573('0x1e')]=qs[_0xe573('0x1e')](_0x1c2da7[_0xe573('0x35')]['limit']);_0x34ecc4[_0xe573('0x1f')]=qs['offset'](_0x1c2da7[_0xe573('0x35')][_0xe573('0x1f')]);}_0x34ecc4[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x1c2da7[_0xe573('0x35')][_0xe573('0x3e')]);_0x34ecc4['where']=qs[_0xe573('0x37')](_[_0xe573('0x3f')](_0x1c2da7[_0xe573('0x35')],_0x27718e[_0xe573('0x37')]),_0x38b1d8);if(_0x1c2da7[_0xe573('0x35')][_0xe573('0x40')]){_0x34ecc4['where']=_[_0xe573('0x41')](_0x34ecc4[_0xe573('0x42')],{'$or':_[_0xe573('0x34')](_0x38b1d8,function(_0x529eea){if(_0x529eea[_0xe573('0x31')]!=='VIRTUAL'){var _0x26902f={};_0x26902f[_0x529eea[_0xe573('0x2c')]]={'$like':'%'+_0x1c2da7['query'][_0xe573('0x40')]+'%'};return _0x26902f;}})});}_0x34ecc4=_['merge']({},_0x34ecc4,_0x1c2da7['options']);var _0x30b26f={'where':_0x34ecc4['where']};return db[_0xe573('0x2e')][_0xe573('0x43')](_0x30b26f)[_0xe573('0x25')](function(_0x3b15c1){_0x27c3dd['count']=_0x3b15c1;if(_0x1c2da7[_0xe573('0x35')][_0xe573('0x44')]){_0x34ecc4[_0xe573('0x45')]=[{'all':!![]}];}return db[_0xe573('0x2e')][_0xe573('0x46')](_0x34ecc4);})[_0xe573('0x25')](function(_0x9faeda){_0x27c3dd[_0xe573('0x47')]=_0x9faeda;return _0x27c3dd;})[_0xe573('0x25')](respondWithFilteredResult(_0x32d895,_0x34ecc4))[_0xe573('0x48')](handleError(_0x32d895,null));};exports[_0xe573('0x49')]=function(_0x492454,_0x1a9a37){var _0x4fd3a7={'raw':![],'where':{'id':_0x492454[_0xe573('0x4a')]['id']}},_0x49f3eb={};_0x49f3eb[_0xe573('0x33')]=_[_0xe573('0x36')](db['Campaign'][_0xe573('0x2f')]);_0x49f3eb[_0xe573('0x35')]=_[_0xe573('0x36')](_0x492454['query']);_0x49f3eb['filters']=_[_0xe573('0x38')](_0x49f3eb['model'],_0x49f3eb['query']);_0x4fd3a7['attributes']=_[_0xe573('0x38')](_0x49f3eb[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x492454[_0xe573('0x35')]['fields']));_0x4fd3a7[_0xe573('0x39')]=_0x4fd3a7[_0xe573('0x39')]['length']?_0x4fd3a7[_0xe573('0x39')]:_0x49f3eb['model'];if(_0x492454[_0xe573('0x35')][_0xe573('0x44')]){_0x4fd3a7['include']=[{'all':!![]}];}_0x4fd3a7=_['merge']({},_0x4fd3a7,_0x492454[_0xe573('0x4b')]);return db[_0xe573('0x2e')][_0xe573('0x4c')](_0x4fd3a7)[_0xe573('0x25')](handleEntityNotFound(_0x1a9a37,null))[_0xe573('0x25')](respondWithResult(_0x1a9a37,null))[_0xe573('0x48')](handleError(_0x1a9a37,null));};exports[_0xe573('0x4d')]=function(_0x36471f,_0x429690){return db[_0xe573('0x2e')][_0xe573('0x4d')](_0x36471f['body'],{})[_0xe573('0x25')](function(_0x3fd53a){var _0x3b76a5=_0x36471f[_0xe573('0x4e')]['get']({'plain':!![]});if(!_0x3b76a5)throw new Error(_0xe573('0x4f'));if(_0x3b76a5[_0xe573('0x50')]===_0xe573('0x4e')){var _0x533f3d=_0x3fd53a['get']({'plain':!![]});var _0x2affed='IvrCampaigns';return db['UserProfileSection'][_0xe573('0x4c')]({'where':{'name':_0x2affed,'userProfileId':_0x3b76a5[_0xe573('0x51')]},'raw':!![]})[_0xe573('0x25')](function(_0x21605f){if(_0x21605f&&_0x21605f[_0xe573('0x52')]===0x0){return db[_0xe573('0x29')][_0xe573('0x4d')]({'name':_0x533f3d[_0xe573('0x2c')],'resourceId':_0x533f3d['id'],'type':_0x21605f[_0xe573('0x2c')],'sectionId':_0x21605f['id']},{})[_0xe573('0x25')](function(){return _0x3fd53a;});}else{return _0x3fd53a;}})[_0xe573('0x48')](function(_0x19315a){logger[_0xe573('0x2a')](_0xe573('0x53'),_0x19315a);throw _0x19315a;});}return _0x3fd53a;})[_0xe573('0x25')](respondWithResult(_0x429690,0xc9))['catch'](handleError(_0x429690,null));};exports[_0xe573('0x54')]=function(_0x54ecb6,_0x15c8c3){var _0x4e0631={'where':{'id':_0x54ecb6['params']['id']}},_0x2a2d04={};_0x2a2d04[_0xe573('0x33')]=_['keys'](db[_0xe573('0x2e')][_0xe573('0x2f')]);_0x4e0631[_0xe573('0x39')]=_['intersection'](_0x2a2d04[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x54ecb6['query'][_0xe573('0x3a')]));_0x4e0631['attributes']=_0x4e0631[_0xe573('0x39')][_0xe573('0x55')]?_0x4e0631[_0xe573('0x39')]:_0x2a2d04[_0xe573('0x33')];if(_0x54ecb6[_0xe573('0x35')]['includeAll']){_0x4e0631[_0xe573('0x45')]=[{'all':!![]}];}_0x4e0631=_['merge']({},_0x4e0631,_0x54ecb6['options']);return db[_0xe573('0x2e')][_0xe573('0x4c')](_0x4e0631)[_0xe573('0x25')](handleEntityNotFound(_0x15c8c3,null))[_0xe573('0x25')](function(_0xa31c74){if(_0xa31c74){var _0x152ff9=_0xa31c74[_0xe573('0x27')]({'plain':!![]});_0x152ff9=qs[_0xe573('0x56')](_0x152ff9,['id',_0xe573('0x57'),_0xe573('0x58')]);_0x54ecb6[_0xe573('0x59')]=_['omit'](_0x54ecb6['body'],['id','createdAt',_0xe573('0x58')]);return db[_0xe573('0x2e')]['create'](_[_0xe573('0x41')](_0x152ff9,_0x54ecb6[_0xe573('0x59')]),{'include':_0x54ecb6['query'][_0xe573('0x44')]?[{'all':!![]}]:undefined})[_0xe573('0x25')](function(_0xb7a62){var _0x27b656=_0x54ecb6[_0xe573('0x4e')][_0xe573('0x27')]({'plain':!![]});if(!_0x27b656)throw new Error(_0xe573('0x4f'));if(_0x27b656[_0xe573('0x50')]===_0xe573('0x4e')){var _0x182b73=_0xb7a62['get']({'plain':!![]});var _0x2779c1=_0xe573('0x28');return db[_0xe573('0x5a')]['find']({'where':{'name':_0x2779c1,'userProfileId':_0x27b656[_0xe573('0x51')]},'raw':!![]})[_0xe573('0x25')](function(_0x2ab4d9){if(_0x2ab4d9&&_0x2ab4d9[_0xe573('0x52')]===0x0){return db[_0xe573('0x29')][_0xe573('0x4d')]({'name':_0x182b73[_0xe573('0x2c')],'resourceId':_0x182b73['id'],'type':_0x2ab4d9[_0xe573('0x2c')],'sectionId':_0x2ab4d9['id']},{})[_0xe573('0x25')](function(){return _0xb7a62;});}else{return _0xb7a62;}})[_0xe573('0x48')](function(_0x37cca4){logger[_0xe573('0x2a')](_0xe573('0x53'),_0x37cca4);throw _0x37cca4;});}return _0xb7a62;});}})[_0xe573('0x25')](respondWithResult(_0x15c8c3,0xc9))[_0xe573('0x48')](handleError(_0x15c8c3,null));};exports[_0xe573('0x24')]=function(_0x4e64a5,_0xeab348){if(_0x4e64a5[_0xe573('0x59')]['id']){delete _0x4e64a5['body']['id'];}return db[_0xe573('0x2e')]['find']({'where':{'id':_0x4e64a5[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0xeab348,null))[_0xe573('0x25')](saveUpdates(_0x4e64a5[_0xe573('0x59')],null))[_0xe573('0x25')](respondWithResult(_0xeab348,null))[_0xe573('0x48')](handleError(_0xeab348,null));};exports[_0xe573('0x26')]=function(_0x4c2c97,_0x3753ef){return db[_0xe573('0x2e')]['find']({'where':{'id':_0x4c2c97[_0xe573('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3753ef,null))['then'](removeEntity(_0x3753ef,null))['catch'](handleError(_0x3753ef,null));};exports[_0xe573('0x5b')]=function(_0x2315a7,_0x589d89,_0x408e22){var _0xab87d7={'raw':!![],'where':{}};var _0x40d2ea={};var _0x1a650f={'count':0x0,'rows':[]};return db[_0xe573('0x2e')][_0xe573('0x5c')]({'where':{'id':_0x2315a7[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x589d89,null))[_0xe573('0x25')](function(_0x2a165e){if(_0x2a165e){_0x40d2ea[_0xe573('0x33')]=_[_0xe573('0x36')](db[_0xe573('0x5d')]['rawAttributes']);_0x40d2ea[_0xe573('0x35')]=_[_0xe573('0x36')](_0x2315a7[_0xe573('0x35')]);_0x40d2ea[_0xe573('0x37')]=_['intersection'](_0x40d2ea[_0xe573('0x33')],_0x40d2ea[_0xe573('0x35')]);_0xab87d7[_0xe573('0x39')]=_['intersection'](_0x40d2ea[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x2315a7[_0xe573('0x35')][_0xe573('0x3a')]));_0xab87d7[_0xe573('0x39')]=_0xab87d7[_0xe573('0x39')]['length']?_0xab87d7[_0xe573('0x39')]:_0x40d2ea[_0xe573('0x33')];if(!_0x2315a7[_0xe573('0x35')][_0xe573('0x3b')](_0xe573('0x3c'))){_0xab87d7[_0xe573('0x1e')]=qs[_0xe573('0x1e')](_0x2315a7[_0xe573('0x35')][_0xe573('0x1e')]);_0xab87d7['offset']=qs[_0xe573('0x1f')](_0x2315a7[_0xe573('0x35')][_0xe573('0x1f')]);}_0xab87d7[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x2315a7['query'][_0xe573('0x3e')]);_0xab87d7[_0xe573('0x42')]=qs[_0xe573('0x37')](_[_0xe573('0x3f')](_0x2315a7[_0xe573('0x35')],_0x40d2ea['filters']));_0xab87d7[_0xe573('0x42')][_0xe573('0x5e')]=_0x2a165e['id'];if(_0x2315a7[_0xe573('0x35')][_0xe573('0x40')]){_0xab87d7[_0xe573('0x42')]=_[_0xe573('0x41')](_0xab87d7[_0xe573('0x42')],{'$or':_[_0xe573('0x34')](_0xab87d7[_0xe573('0x39')],function(_0x38c087){var _0x2a57c1={};_0x2a57c1[_0x38c087]={'$like':'%'+_0x2315a7[_0xe573('0x35')][_0xe573('0x40')]+'%'};return _0x2a57c1;})});}_0xab87d7=_['merge']({},_0xab87d7,_0x2315a7[_0xe573('0x4b')]);return db[_0xe573('0x5d')][_0xe573('0x43')]({'where':_0xab87d7[_0xe573('0x42')]})[_0xe573('0x25')](function(_0x565b59){_0x1a650f['count']=_0x565b59;if(_0x2315a7[_0xe573('0x35')][_0xe573('0x44')]){_0xab87d7['include']=[{'all':!![]}];}return db[_0xe573('0x5d')]['findAll'](_0xab87d7);})[_0xe573('0x25')](function(_0x9be6b6){_0x1a650f[_0xe573('0x47')]=_0x9be6b6;return _0x1a650f;});}})[_0xe573('0x25')](respondWithFilteredResult(_0x589d89,_0xab87d7))[_0xe573('0x48')](handleError(_0x589d89,null));};exports[_0xe573('0x5f')]=function(_0x21acf8,_0x8bee05,_0x78b47d){var _0x302c22={'raw':!![],'where':{}};var _0x1a4a63={};var _0x6c69f5={'count':0x0,'rows':[]};return db[_0xe573('0x2e')]['findOne']({'where':{'id':_0x21acf8['params']['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x8bee05,null))[_0xe573('0x25')](function(_0x5c417a){if(_0x5c417a){_0x1a4a63[_0xe573('0x33')]=_[_0xe573('0x36')](db[_0xe573('0x60')][_0xe573('0x2f')]);_0x1a4a63[_0xe573('0x35')]=_[_0xe573('0x36')](_0x21acf8[_0xe573('0x35')]);_0x1a4a63['filters']=_['intersection'](_0x1a4a63['model'],_0x1a4a63[_0xe573('0x35')]);_0x302c22[_0xe573('0x39')]=_[_0xe573('0x38')](_0x1a4a63[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x21acf8['query'][_0xe573('0x3a')]));_0x302c22[_0xe573('0x39')]=_0x302c22[_0xe573('0x39')][_0xe573('0x55')]?_0x302c22[_0xe573('0x39')]:_0x1a4a63['model'];if(!_0x21acf8['query']['hasOwnProperty'](_0xe573('0x3c'))){_0x302c22[_0xe573('0x1e')]=qs[_0xe573('0x1e')](_0x21acf8[_0xe573('0x35')]['limit']);_0x302c22[_0xe573('0x1f')]=qs['offset'](_0x21acf8['query']['offset']);}_0x302c22[_0xe573('0x3d')]=qs['sort'](_0x21acf8[_0xe573('0x35')][_0xe573('0x3e')]);_0x302c22[_0xe573('0x42')]=qs['filters'](_[_0xe573('0x3f')](_0x21acf8[_0xe573('0x35')],_0x1a4a63[_0xe573('0x37')]));_0x302c22[_0xe573('0x42')][_0xe573('0x5e')]=_0x5c417a['id'];if(_0x21acf8[_0xe573('0x35')][_0xe573('0x40')]){_0x302c22[_0xe573('0x42')]=_['merge'](_0x302c22[_0xe573('0x42')],{'$or':_[_0xe573('0x34')](_0x302c22[_0xe573('0x39')],function(_0xed3f9f){var _0x417440={};_0x417440[_0xed3f9f]={'$like':'%'+_0x21acf8[_0xe573('0x35')][_0xe573('0x40')]+'%'};return _0x417440;})});}_0x302c22=_[_0xe573('0x41')]({},_0x302c22,_0x21acf8['options']);return db[_0xe573('0x60')]['count']({'where':_0x302c22['where']})['then'](function(_0x3c75ca){_0x6c69f5[_0xe573('0x43')]=_0x3c75ca;if(_0x21acf8['query'][_0xe573('0x44')]){_0x302c22[_0xe573('0x45')]=[{'all':!![]}];}return db[_0xe573('0x60')][_0xe573('0x46')](_0x302c22);})[_0xe573('0x25')](function(_0x55d045){_0x6c69f5['rows']=_0x55d045;return _0x6c69f5;});}})['then'](respondWithFilteredResult(_0x8bee05,_0x302c22))[_0xe573('0x48')](handleError(_0x8bee05,null));};exports[_0xe573('0x61')]=function(_0x15bd80,_0x46f9b3,_0x37c26d){var _0x3c096e={'raw':!![],'where':{}};var _0x5f0ba5={};var _0x6c4cbc={'count':0x0,'rows':[]};return db[_0xe573('0x2e')][_0xe573('0x5c')]({'where':{'id':_0x15bd80[_0xe573('0x4a')]['id']}})['then'](handleEntityNotFound(_0x46f9b3,null))[_0xe573('0x25')](function(_0x710a05){if(_0x710a05){_0x5f0ba5[_0xe573('0x33')]=_[_0xe573('0x36')](db[_0xe573('0x62')][_0xe573('0x2f')]);_0x5f0ba5[_0xe573('0x35')]=_[_0xe573('0x36')](_0x15bd80[_0xe573('0x35')]);_0x5f0ba5[_0xe573('0x37')]=_[_0xe573('0x38')](_0x5f0ba5['model'],_0x5f0ba5[_0xe573('0x35')]);_0x3c096e['attributes']=_[_0xe573('0x38')](_0x5f0ba5[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x15bd80[_0xe573('0x35')][_0xe573('0x3a')]));_0x3c096e[_0xe573('0x39')]=_0x3c096e[_0xe573('0x39')][_0xe573('0x55')]?_0x3c096e[_0xe573('0x39')]:_0x5f0ba5[_0xe573('0x33')];if(!_0x15bd80['query'][_0xe573('0x3b')](_0xe573('0x3c'))){_0x3c096e[_0xe573('0x1e')]=qs['limit'](_0x15bd80[_0xe573('0x35')][_0xe573('0x1e')]);_0x3c096e[_0xe573('0x1f')]=qs[_0xe573('0x1f')](_0x15bd80[_0xe573('0x35')][_0xe573('0x1f')]);}_0x3c096e[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x15bd80[_0xe573('0x35')]['sort']);_0x3c096e[_0xe573('0x42')]=qs[_0xe573('0x37')](_[_0xe573('0x3f')](_0x15bd80['query'],_0x5f0ba5[_0xe573('0x37')]));_0x3c096e[_0xe573('0x42')]['CampaignId']=_0x710a05['id'];if(_0x15bd80[_0xe573('0x35')][_0xe573('0x40')]){_0x3c096e[_0xe573('0x42')]=_[_0xe573('0x41')](_0x3c096e[_0xe573('0x42')],{'$or':_[_0xe573('0x34')](_0x3c096e[_0xe573('0x39')],function(_0x30f04d){var _0x595cc5={};_0x595cc5[_0x30f04d]={'$like':'%'+_0x15bd80['query'][_0xe573('0x40')]+'%'};return _0x595cc5;})});}_0x3c096e=_['merge']({},_0x3c096e,_0x15bd80[_0xe573('0x4b')]);return db[_0xe573('0x62')]['count']({'where':_0x3c096e[_0xe573('0x42')]})['then'](function(_0x2b9137){_0x6c4cbc[_0xe573('0x43')]=_0x2b9137;if(_0x15bd80[_0xe573('0x35')][_0xe573('0x44')]){_0x3c096e[_0xe573('0x45')]=[{'all':!![]}];}return db[_0xe573('0x62')][_0xe573('0x46')](_0x3c096e);})[_0xe573('0x25')](function(_0x1c253b){_0x6c4cbc[_0xe573('0x47')]=_0x1c253b;return _0x6c4cbc;});}})['then'](respondWithFilteredResult(_0x46f9b3,_0x3c096e))[_0xe573('0x48')](handleError(_0x46f9b3,null));};exports[_0xe573('0x63')]=function(_0x4e9b15,_0x3bb6c1,_0x1d712e){var _0x4e00ba={'raw':!![],'where':{}};var _0xeff5c5={};var _0x241d9c={'count':0x0,'rows':[]};return db[_0xe573('0x2e')][_0xe573('0x5c')]({'where':{'id':_0x4e9b15[_0xe573('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3bb6c1,null))[_0xe573('0x25')](function(_0x3154b2){if(_0x3154b2){_0xeff5c5['model']=_[_0xe573('0x36')](db[_0xe573('0x64')]['rawAttributes']);_0xeff5c5['query']=_[_0xe573('0x36')](_0x4e9b15[_0xe573('0x35')]);_0xeff5c5[_0xe573('0x37')]=_[_0xe573('0x38')](_0xeff5c5[_0xe573('0x33')],_0xeff5c5[_0xe573('0x35')]);_0x4e00ba[_0xe573('0x39')]=_[_0xe573('0x38')](_0xeff5c5['model'],qs[_0xe573('0x3a')](_0x4e9b15[_0xe573('0x35')][_0xe573('0x3a')]));_0x4e00ba[_0xe573('0x39')]=_0x4e00ba[_0xe573('0x39')][_0xe573('0x55')]?_0x4e00ba[_0xe573('0x39')]:_0xeff5c5[_0xe573('0x33')];if(!_0x4e9b15[_0xe573('0x35')][_0xe573('0x3b')](_0xe573('0x3c'))){_0x4e00ba['limit']=qs['limit'](_0x4e9b15[_0xe573('0x35')][_0xe573('0x1e')]);_0x4e00ba[_0xe573('0x1f')]=qs['offset'](_0x4e9b15[_0xe573('0x35')][_0xe573('0x1f')]);}_0x4e00ba[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x4e9b15['query'][_0xe573('0x3e')]);_0x4e00ba[_0xe573('0x42')]=qs['filters'](_['pick'](_0x4e9b15[_0xe573('0x35')],_0xeff5c5[_0xe573('0x37')]));_0x4e00ba[_0xe573('0x42')][_0xe573('0x5e')]=_0x3154b2['id'];if(_0x4e9b15[_0xe573('0x35')]['filter']){_0x4e00ba[_0xe573('0x42')]=_[_0xe573('0x41')](_0x4e00ba['where'],{'$or':_[_0xe573('0x34')](_0x4e00ba['attributes'],function(_0x13bddd){var _0x5b6ac7={};_0x5b6ac7[_0x13bddd]={'$like':'%'+_0x4e9b15['query'][_0xe573('0x40')]+'%'};return _0x5b6ac7;})});}_0x4e00ba=_[_0xe573('0x41')]({},_0x4e00ba,_0x4e9b15[_0xe573('0x4b')]);return db[_0xe573('0x64')][_0xe573('0x43')]({'where':_0x4e00ba[_0xe573('0x42')]})['then'](function(_0x4c4c4e){_0x241d9c[_0xe573('0x43')]=_0x4c4c4e;if(_0x4e9b15['query'][_0xe573('0x44')]){_0x4e00ba[_0xe573('0x45')]=[{'all':!![]}];}return db[_0xe573('0x64')][_0xe573('0x46')](_0x4e00ba);})['then'](function(_0x17bb64){_0x241d9c[_0xe573('0x47')]=_0x17bb64;return _0x241d9c;});}})[_0xe573('0x25')](respondWithFilteredResult(_0x3bb6c1,_0x4e00ba))[_0xe573('0x48')](handleError(_0x3bb6c1,null));};exports[_0xe573('0x65')]=function(_0x26fe31,_0x8265e,_0x1cfb0a){var _0x5f1f05={};var _0x37f25b={};var _0x1a77e8;var _0x536b67;return db[_0xe573('0x2e')][_0xe573('0x5c')]({'where':{'id':_0x26fe31[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x8265e,null))[_0xe573('0x25')](function(_0x207e56){if(_0x207e56){_0x1a77e8=_0x207e56;_0x37f25b[_0xe573('0x33')]=_['keys'](db[_0xe573('0x66')][_0xe573('0x2f')]);_0x37f25b[_0xe573('0x35')]=_[_0xe573('0x36')](_0x26fe31['query']);_0x37f25b[_0xe573('0x37')]=_[_0xe573('0x38')](_0x37f25b[_0xe573('0x33')],_0x37f25b[_0xe573('0x35')]);_0x5f1f05[_0xe573('0x39')]=_[_0xe573('0x38')](_0x37f25b[_0xe573('0x33')],qs[_0xe573('0x3a')](_0x26fe31[_0xe573('0x35')][_0xe573('0x3a')]));_0x5f1f05[_0xe573('0x39')]=_0x5f1f05[_0xe573('0x39')][_0xe573('0x55')]?_0x5f1f05['attributes']:_0x37f25b['model'];_0x5f1f05[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x26fe31[_0xe573('0x35')][_0xe573('0x3e')]);_0x5f1f05[_0xe573('0x42')]=qs[_0xe573('0x37')](_[_0xe573('0x3f')](_0x26fe31[_0xe573('0x35')],_0x37f25b[_0xe573('0x37')]));if(_0x26fe31['query'][_0xe573('0x40')]){_0x5f1f05['where']=_[_0xe573('0x41')](_0x5f1f05['where'],{'$or':_[_0xe573('0x34')](_0x5f1f05['attributes'],function(_0x254566){var _0x1d74c9={};_0x1d74c9[_0x254566]={'$like':'%'+_0x26fe31[_0xe573('0x35')][_0xe573('0x40')]+'%'};return _0x1d74c9;})});}_0x5f1f05=_['merge']({},_0x5f1f05,_0x26fe31[_0xe573('0x4b')]);return _0x1a77e8[_0xe573('0x65')](_0x5f1f05);}})[_0xe573('0x25')](function(_0x516390){if(_0x516390){_0x536b67=_0x516390[_0xe573('0x55')];if(!_0x26fe31[_0xe573('0x35')][_0xe573('0x3b')](_0xe573('0x3c'))){_0x5f1f05[_0xe573('0x1e')]=qs[_0xe573('0x1e')](_0x26fe31['query'][_0xe573('0x1e')]);_0x5f1f05[_0xe573('0x1f')]=qs['offset'](_0x26fe31[_0xe573('0x35')][_0xe573('0x1f')]);}return _0x1a77e8['getLists'](_0x5f1f05);}})['then'](function(_0xc5bc9a){if(_0xc5bc9a){return _0xc5bc9a?{'count':_0x536b67,'rows':_0xc5bc9a}:null;}})[_0xe573('0x25')](respondWithResult(_0x8265e,null))[_0xe573('0x48')](handleError(_0x8265e,null));};exports[_0xe573('0x67')]=function(_0x5a71a5,_0x5d9c7e,_0x21fa38){var _0x783751,_0x7eb0c8;var _0x28925f=[];var _0x1e7bd2=moment()[_0xe573('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xe573('0x2e')]['find']({'where':{'id':_0x5a71a5[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x5d9c7e,null))[_0xe573('0x25')](function(_0x175cd3){if(_0x175cd3){_0x7eb0c8=_0x175cd3;return _0x175cd3['addLists'](_0x5a71a5[_0xe573('0x59')][_0xe573('0x69')],_['omit'](_0x5a71a5[_0xe573('0x59')],[_0xe573('0x69'),'id'])||{});}return null;})[_0xe573('0x6a')](function(_0x2718fd){var _0x520cf4;var _0xa3b4db;_0x783751=_0x2718fd||[];var _0x45384c=[];if(_0x2718fd){for(var _0x10a259=0x0;_0x10a259<_0x2718fd[_0xe573('0x55')];_0x10a259+=0x1){var _0x232dc0=_0x2718fd[_0x10a259][_0xe573('0x27')]({'plain':!![]});_0x7eb0c8['dialCheckDuplicateType']=_0x5a71a5['body'][_0xe573('0x6b')]?_0x5a71a5['body']['dialCheckDuplicateType']:_0x7eb0c8[_0xe573('0x6b')];switch(_0x7eb0c8[_0xe573('0x6b')]){case _0xe573('0x6c'):_0x520cf4=squel[_0xe573('0x6d')]()['into']('cm_hopper')['fromQuery']([_0xe573('0x6e'),_0xe573('0x6f'),_0xe573('0x70'),_0xe573('0x71'),_0xe573('0x5e'),'createdAt',_0xe573('0x58')],squel[_0xe573('0x72')]()[_0xe573('0x73')](_0xe573('0x6e'),_0xe573('0x6e'))[_0xe573('0x73')](_0xe573('0x74'),_0xe573('0x6f'))['field']('id',_0xe573('0x70'))['field'](_0x232dc0[_0xe573('0x75')][_0xe573('0x76')](),'ListId')[_0xe573('0x73')](_0x5a71a5['params']['id'][_0xe573('0x76')](),_0xe573('0x5e'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x57'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x58'))['from'](_0xe573('0x77'))[_0xe573('0x42')](_0xe573('0x78'))['where'](_0xe573('0x79'),_0x232dc0[_0xe573('0x75')][_0xe573('0x76')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe573('0x42')](_0xe573('0x7a'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')[_0xe573('0x7b')](_0xe573('0x7c'))['where'](_0xe573('0x7d'),_0x5a71a5[_0xe573('0x4a')]['id'][_0xe573('0x76')]()))[_0xe573('0x42')](_0xe573('0x7a'),squel['select']()[_0xe573('0x73')](_0xe573('0x7e'))[_0xe573('0x7b')](_0xe573('0x7f'))[_0xe573('0x42')]('CampaignId\x20=\x20?',_0x5a71a5[_0xe573('0x4a')]['id'][_0xe573('0x76')]())))[_0xe573('0x76')]();break;case'onlyIfOpen':_0x520cf4=squel[_0xe573('0x6d')]()[_0xe573('0x80')](_0xe573('0x7f'))[_0xe573('0x81')](['phone','scheduledAt',_0xe573('0x70'),_0xe573('0x71'),_0xe573('0x5e'),_0xe573('0x57'),_0xe573('0x58')],squel[_0xe573('0x72')]()[_0xe573('0x73')](_0xe573('0x6e'),_0xe573('0x6e'))[_0xe573('0x73')](_0xe573('0x74'),_0xe573('0x6f'))[_0xe573('0x73')]('id',_0xe573('0x70'))[_0xe573('0x73')](_0x232dc0[_0xe573('0x75')][_0xe573('0x76')](),_0xe573('0x71'))[_0xe573('0x73')](_0x5a71a5[_0xe573('0x4a')]['id'][_0xe573('0x76')](),_0xe573('0x5e'))['field']('\x27'+_0x1e7bd2+'\x27','createdAt')[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x58'))['from'](_0xe573('0x77'))[_0xe573('0x42')](_0xe573('0x78'))[_0xe573('0x42')](_0xe573('0x79'),_0x232dc0['CmListId'][_0xe573('0x76')]())[_0xe573('0x42')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe573('0x7a'),squel['select']()[_0xe573('0x73')](_0xe573('0x7e'))[_0xe573('0x7b')](_0xe573('0x7f'))[_0xe573('0x42')]('CampaignId\x20=\x20?',_0x5a71a5[_0xe573('0x4a')]['id'][_0xe573('0x76')]())))[_0xe573('0x76')]();break;default:_0x520cf4=squel[_0xe573('0x6d')]()['into'](_0xe573('0x7f'))[_0xe573('0x81')]([_0xe573('0x6e'),'scheduledAt',_0xe573('0x70'),_0xe573('0x71'),_0xe573('0x5e'),_0xe573('0x57'),_0xe573('0x58')],squel[_0xe573('0x72')]()[_0xe573('0x73')](_0xe573('0x6e'),_0xe573('0x6e'))[_0xe573('0x73')](_0xe573('0x74'),_0xe573('0x6f'))[_0xe573('0x73')]('id','ContactId')[_0xe573('0x73')](_0x232dc0[_0xe573('0x75')][_0xe573('0x76')](),_0xe573('0x71'))[_0xe573('0x73')](_0x5a71a5['params']['id']['toString'](),_0xe573('0x5e'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x57'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x58'))[_0xe573('0x7b')](_0xe573('0x77'))[_0xe573('0x42')](_0xe573('0x78'))[_0xe573('0x42')](_0xe573('0x79'),_0x232dc0[_0xe573('0x75')][_0xe573('0x76')]())[_0xe573('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xe573('0x76')]();}_0xa3b4db=squel['insert']()[_0xe573('0x80')](_0xe573('0x82'))['fromQuery'](['cmHopperId',_0xe573('0x6f'),_0xe573('0x6e'),_0xe573('0x83'),'createdAt',_0xe573('0x58')],squel['select']()[_0xe573('0x73')](_0xe573('0x84'),'id')['field'](_0xe573('0x74'),_0xe573('0x6f'))[_0xe573('0x73')](_0xe573('0x85'),_0xe573('0x6e'))[_0xe573('0x73')](_0xe573('0x86'),_0xe573('0x83'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x57'))[_0xe573('0x73')]('\x27'+_0x1e7bd2+'\x27',_0xe573('0x58'))['from'](_0xe573('0x87'),'ci')['join'](_0xe573('0x7f'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0xe573('0x42')]('h.ListId\x20=\x20?',_0x232dc0[_0xe573('0x75')][_0xe573('0x76')]())['where']('h.CampaignId=?',_0x5a71a5['params']['id'][_0xe573('0x76')]())[_0xe573('0x42')]('h.createdAt\x20=\x20?',_0x1e7bd2))[_0xe573('0x76')]();_0x45384c[_0xe573('0x88')](db[_0xe573('0x89')][_0xe573('0x35')](_0x520cf4));_0x28925f[_0xe573('0x88')](db[_0xe573('0x89')][_0xe573('0x35')](_0xa3b4db));}return BPromise[_0xe573('0x8a')](_0x45384c);}})[_0xe573('0x25')](function(){return BPromise[_0xe573('0x8a')](_0x28925f);})[_0xe573('0x25')](function(){return _0x783751;})['then'](respondWithResult(_0x5d9c7e,null))[_0xe573('0x48')](handleError(_0x5d9c7e,null));};exports[_0xe573('0x8b')]=function(_0x57a464,_0x3eddbb,_0x11ff22){return db['Campaign'][_0xe573('0x4c')]({'where':{'id':_0x57a464[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x3eddbb,null))[_0xe573('0x25')](function(_0x5189c0){if(_0x5189c0){return _0x5189c0[_0xe573('0x8b')](_0x57a464['query'][_0xe573('0x69')]);}})[_0xe573('0x25')](function(_0x5bb4e1){if(_0x5bb4e1){return db[_0xe573('0x5d')]['destroy']({'where':{'ListId':_0x57a464['query'][_0xe573('0x69')],'CampaignId':_0x57a464[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](function(){return _0x5bb4e1;});}})[_0xe573('0x25')](respondWithStatusCode(_0x3eddbb,null))['catch'](handleError(_0x3eddbb,null));};exports['getBlackLists']=function(_0x30ae96,_0x12996f,_0x46ec3b){var _0x5513f0={};var _0x3f4b93={};var _0x4184d0;var _0x43caf0;return db[_0xe573('0x2e')][_0xe573('0x5c')]({'where':{'id':_0x30ae96[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x12996f,null))[_0xe573('0x25')](function(_0x24d8dd){if(_0x24d8dd){_0x4184d0=_0x24d8dd;_0x3f4b93[_0xe573('0x33')]=_[_0xe573('0x36')](db['CmList']['rawAttributes']);_0x3f4b93[_0xe573('0x35')]=_[_0xe573('0x36')](_0x30ae96['query']);_0x3f4b93[_0xe573('0x37')]=_[_0xe573('0x38')](_0x3f4b93['model'],_0x3f4b93[_0xe573('0x35')]);_0x5513f0['attributes']=_[_0xe573('0x38')](_0x3f4b93[_0xe573('0x33')],qs['fields'](_0x30ae96['query'][_0xe573('0x3a')]));_0x5513f0[_0xe573('0x39')]=_0x5513f0[_0xe573('0x39')]['length']?_0x5513f0['attributes']:_0x3f4b93[_0xe573('0x33')];_0x5513f0[_0xe573('0x3d')]=qs[_0xe573('0x3e')](_0x30ae96[_0xe573('0x35')]['sort']);_0x5513f0[_0xe573('0x42')]=qs['filters'](_['pick'](_0x30ae96[_0xe573('0x35')],_0x3f4b93['filters']));if(_0x30ae96[_0xe573('0x35')][_0xe573('0x40')]){_0x5513f0[_0xe573('0x42')]=_[_0xe573('0x41')](_0x5513f0[_0xe573('0x42')],{'$or':_['map'](_0x5513f0[_0xe573('0x39')],function(_0x3b419d){var _0x197c43={};_0x197c43[_0x3b419d]={'$like':'%'+_0x30ae96['query'][_0xe573('0x40')]+'%'};return _0x197c43;})});}_0x5513f0=_[_0xe573('0x41')]({},_0x5513f0,_0x30ae96[_0xe573('0x4b')]);return _0x4184d0[_0xe573('0x8c')](_0x5513f0);}})[_0xe573('0x25')](function(_0x115eb6){if(_0x115eb6){_0x43caf0=_0x115eb6[_0xe573('0x55')];if(!_0x30ae96[_0xe573('0x35')][_0xe573('0x3b')](_0xe573('0x3c'))){_0x5513f0[_0xe573('0x1e')]=qs[_0xe573('0x1e')](_0x30ae96[_0xe573('0x35')][_0xe573('0x1e')]);_0x5513f0[_0xe573('0x1f')]=qs[_0xe573('0x1f')](_0x30ae96[_0xe573('0x35')][_0xe573('0x1f')]);}return _0x4184d0[_0xe573('0x8c')](_0x5513f0);}})[_0xe573('0x25')](function(_0x3f189f){if(_0x3f189f){return _0x3f189f?{'count':_0x43caf0,'rows':_0x3f189f}:null;}})['then'](respondWithResult(_0x12996f,null))[_0xe573('0x48')](handleError(_0x12996f,null));};exports[_0xe573('0x8d')]=function(_0x5ce7d8,_0x1f4beb,_0x4d30f3){var _0x30627d,_0x27adbc;var _0x143894=[];var _0x38fd18=moment()[_0xe573('0x68')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign']['find']({'where':{'id':_0x5ce7d8[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x1f4beb,null))['then'](function(_0x5627b3){if(_0x5627b3){_0x27adbc=_0x5627b3;return _0x5627b3['addBlackLists'](_0x5ce7d8[_0xe573('0x59')][_0xe573('0x69')],_[_0xe573('0x56')](_0x5ce7d8['body'],[_0xe573('0x69'),'id'])||{});}return null;})[_0xe573('0x6a')](function(_0xc8cba0){var _0x3ca927;var _0x586fac;_0x30627d=_0xc8cba0||[];var _0xf40032=[];if(_0xc8cba0){for(var _0x5d0afe=0x0;_0x5d0afe<_0xc8cba0[_0xe573('0x55')];_0x5d0afe+=0x1){var _0x44fee0=_0xc8cba0[_0x5d0afe][_0xe573('0x27')]({'plain':!![]});_0x3ca927=squel['insert']()[_0xe573('0x80')](_0xe573('0x8e'))['fromQuery']([_0xe573('0x6e'),_0xe573('0x70'),_0xe573('0x71'),_0xe573('0x5e'),_0xe573('0x57'),_0xe573('0x58')],squel[_0xe573('0x72')]()[_0xe573('0x73')]('phone',_0xe573('0x6e'))['field']('id',_0xe573('0x70'))[_0xe573('0x73')](_0x44fee0[_0xe573('0x75')][_0xe573('0x76')](),_0xe573('0x71'))['field'](_0x5ce7d8['params']['id'][_0xe573('0x76')](),_0xe573('0x5e'))[_0xe573('0x73')]('NOW()',_0xe573('0x57'))[_0xe573('0x73')](_0xe573('0x74'),_0xe573('0x58'))[_0xe573('0x7b')]('cm_contacts')[_0xe573('0x42')](_0xe573('0x78'))[_0xe573('0x42')](_0xe573('0x79'),_0x44fee0[_0xe573('0x75')][_0xe573('0x76')]())[_0xe573('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0xe573('0x76')]();_0xf40032[_0xe573('0x88')](db[_0xe573('0x89')][_0xe573('0x35')](_0x3ca927));}return BPromise[_0xe573('0x8a')](_0xf40032);}})[_0xe573('0x25')](function(){return _0x30627d;})[_0xe573('0x25')](respondWithResult(_0x1f4beb,null))[_0xe573('0x48')](handleError(_0x1f4beb,null));};exports['removeBlackLists']=function(_0x503b10,_0x1b8ec5,_0x4e3436){return db[_0xe573('0x2e')][_0xe573('0x4c')]({'where':{'id':_0x503b10[_0xe573('0x4a')]['id']}})[_0xe573('0x25')](handleEntityNotFound(_0x1b8ec5,null))[_0xe573('0x25')](function(_0x348a82){if(_0x348a82){return _0x348a82[_0xe573('0x8f')](_0x503b10[_0xe573('0x35')]['ids']);}})[_0xe573('0x25')](function(_0x1ad94b){if(_0x1ad94b){return db[_0xe573('0x64')][_0xe573('0x26')]({'where':{'ListId':_0x503b10['query'][_0xe573('0x69')],'CampaignId':_0x503b10[_0xe573('0x4a')]['id']}})['then'](function(){return _0x1ad94b;});}})[_0xe573('0x25')](respondWithStatusCode(_0x1b8ec5,null))['catch'](handleError(_0x1b8ec5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a565498..a86677f 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(_0x2703cf,_0x526b31){var _0x28f18a=function(_0x10e33b){while(--_0x10e33b){_0x2703cf['push'](_0x2703cf['shift']());}};_0x28f18a(++_0x526b31);}(_0x7a54,0x106));var _0x47a5=function(_0x1ed99a,_0x4d4005){_0x1ed99a=_0x1ed99a-0x0;var _0x15ba4e=_0x7a54[_0x1ed99a];return _0x15ba4e;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x7a54,0x106));var _0x47a5=function(_0x3a7854,_0x5d3cff){_0x3a7854=_0x3a7854-0x0;var _0x46e7f4=_0x7a54[_0x3a7854];return _0x46e7f4;};'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 diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index ace6b93..1b3b142 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 _0xcffe=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetCampaign','Campaign','options','raw','where','attributes','map','include','model'];(function(_0x57fa5c,_0x22d1e7){var _0x270ebe=function(_0xf97a43){while(--_0xf97a43){_0x57fa5c['push'](_0x57fa5c['shift']());}};_0x270ebe(++_0x22d1e7);}(_0xcffe,0x1a1));var _0xecff=function(_0x1e2372,_0x2ea876){_0x1e2372=_0x1e2372-0x0;var _0x4cd59b=_0xcffe[_0x1e2372];return _0x4cd59b;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var rs=require(_0xecff('0x4'));var fs=require('fs');var Redis=require(_0xecff('0x5'));var db=require(_0xecff('0x6'))['db'];var utils=require(_0xecff('0x7'));var logger=require(_0xecff('0x8'))(_0xecff('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xecff('0xa')][_0xecff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e2fa9,_0x38a8f6,_0x50c98b){return new BPromise(function(_0x298c19,_0x1f7386){return client['request'](_0x2e2fa9,_0x50c98b)[_0xecff('0xc')](function(_0x3eefb9){logger[_0xecff('0xd')](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));logger['debug'](_0xecff('0x10'),_0x38a8f6,_0xecff('0xf'),JSON[_0xecff('0x11')](_0x3eefb9));if(_0x3eefb9[_0xecff('0x12')]){if(_0x3eefb9[_0xecff('0x12')][_0xecff('0x13')]===0x1f4){logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);return _0x1f7386(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}logger[_0xecff('0x12')](_0xecff('0xe'),_0x38a8f6,_0x3eefb9['error']['message']);return _0x298c19(_0x3eefb9[_0xecff('0x12')][_0xecff('0x14')]);}else{logger['info'](_0xecff('0xe'),_0x38a8f6,_0xecff('0xf'));_0x298c19(_0x3eefb9[_0xecff('0x15')]['message']);}})['catch'](function(_0x24abef){logger[_0xecff('0x12')]('Campaign,\x20%s,\x20%s',_0x38a8f6,_0x24abef);_0x1f7386(_0x24abef);});});}exports[_0xecff('0x16')]=function(_0x3adc81){var _0x319ba5=this;return new Promise(function(_0x2393db,_0x2fc1f9){return db[_0xecff('0x17')]['findAll']({'raw':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')][_0xecff('0x19')]===undefined?!![]:![]:!![],'where':_0x3adc81[_0xecff('0x18')]?_0x3adc81['options'][_0xecff('0x1a')]||null:null,'attributes':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')][_0xecff('0x1b')]||null:null,'limit':_0x3adc81[_0xecff('0x18')]?_0x3adc81[_0xecff('0x18')]['limit']||null:null,'include':_0x3adc81[_0xecff('0x18')]?_0x3adc81['options']['include']?_[_0xecff('0x1c')](_0x3adc81['options'][_0xecff('0x1d')],function(_0x49c0cd){return{'model':db[_0x49c0cd[_0xecff('0x1e')]],'as':_0x49c0cd['as'],'attributes':_0x49c0cd['attributes'],'include':_0x49c0cd[_0xecff('0x1d')]?_[_0xecff('0x1c')](_0x49c0cd['include'],function(_0x9f173d){return{'model':db[_0x9f173d[_0xecff('0x1e')]],'as':_0x9f173d['as'],'attributes':_0x9f173d[_0xecff('0x1b')],'include':_0x9f173d[_0xecff('0x1d')]?_[_0xecff('0x1c')](_0x9f173d['include'],function(_0x4f987b){return{'model':db[_0x4f987b[_0xecff('0x1e')]],'as':_0x4f987b['as'],'attributes':_0x4f987b['attributes']};}):[]};}):[]};}):[]:[]})[_0xecff('0xc')](function(_0x3ef198){logger[_0xecff('0xd')](_0xecff('0x16'),_0x3adc81);logger['debug']('GetCampaign',_0x3adc81,JSON['stringify'](_0x3ef198));_0x2393db(_0x3ef198);})[_0xecff('0x1f')](function(_0xabe5da){logger[_0xecff('0x12')](_0xecff('0x16'),_0xabe5da['message'],_0x3adc81);_0x2fc1f9(_0x319ba5[_0xecff('0x12')](0x1f4,_0xabe5da[_0xecff('0x14')]));});});}; \ No newline at end of file +var _0xbd3b=['include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','GetCampaign','Campaign','options','raw','where','attributes'];(function(_0x48cfe4,_0x2301f0){var _0x47b7b7=function(_0x1755eb){while(--_0x1755eb){_0x48cfe4['push'](_0x48cfe4['shift']());}};_0x47b7b7(++_0x2301f0);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x37be36,_0x18fe03){_0x37be36=_0x37be36-0x0;var _0x47108e=_0xbd3b[_0x37be36];return _0x47108e;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var moment=require(_0xbbd3('0x2'));var BPromise=require('bluebird');var rs=require(_0xbbd3('0x3'));var fs=require('fs');var Redis=require(_0xbbd3('0x4'));var db=require(_0xbbd3('0x5'))['db'];var utils=require(_0xbbd3('0x6'));var logger=require('../../config/logger')(_0xbbd3('0x7'));var config=require(_0xbbd3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbbd3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cc5d9,_0x232ede,_0x44f331){return new BPromise(function(_0x4b8667,_0x3d3f9f){return client[_0xbbd3('0xa')](_0x3cc5d9,_0x44f331)[_0xbbd3('0xb')](function(_0x229f59){logger['info'](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));logger[_0xbbd3('0xe')](_0xbbd3('0xf'),_0x232ede,'request\x20sent',JSON[_0xbbd3('0x10')](_0x229f59));if(_0x229f59['error']){if(_0x229f59['error'][_0xbbd3('0x11')]===0x1f4){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);return _0x3d3f9f(_0x229f59[_0xbbd3('0x12')][_0xbbd3('0x13')]);}logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x229f59[_0xbbd3('0x12')]['message']);return _0x4b8667(_0x229f59['error'][_0xbbd3('0x13')]);}else{logger[_0xbbd3('0x14')](_0xbbd3('0xc'),_0x232ede,_0xbbd3('0xd'));_0x4b8667(_0x229f59[_0xbbd3('0x15')]['message']);}})[_0xbbd3('0x16')](function(_0x49d6b9){logger[_0xbbd3('0x12')](_0xbbd3('0xc'),_0x232ede,_0x49d6b9);_0x3d3f9f(_0x49d6b9);});});}exports[_0xbbd3('0x17')]=function(_0x240a46){var _0x5f3952=this;return new Promise(function(_0x50b6e4,_0x12954a){return db[_0xbbd3('0x18')]['findAll']({'raw':_0x240a46[_0xbbd3('0x19')]?_0x240a46['options'][_0xbbd3('0x1a')]===undefined?!![]:![]:!![],'where':_0x240a46[_0xbbd3('0x19')]?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1b')]||null:null,'attributes':_0x240a46[_0xbbd3('0x19')]?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1c')]||null:null,'limit':_0x240a46['options']?_0x240a46[_0xbbd3('0x19')]['limit']||null:null,'include':_0x240a46['options']?_0x240a46[_0xbbd3('0x19')][_0xbbd3('0x1d')]?_[_0xbbd3('0x1e')](_0x240a46[_0xbbd3('0x19')]['include'],function(_0x79e118){return{'model':db[_0x79e118['model']],'as':_0x79e118['as'],'attributes':_0x79e118[_0xbbd3('0x1c')],'include':_0x79e118['include']?_['map'](_0x79e118['include'],function(_0x51e13a){return{'model':db[_0x51e13a[_0xbbd3('0x1f')]],'as':_0x51e13a['as'],'attributes':_0x51e13a[_0xbbd3('0x1c')],'include':_0x51e13a['include']?_[_0xbbd3('0x1e')](_0x51e13a[_0xbbd3('0x1d')],function(_0x276f43){return{'model':db[_0x276f43[_0xbbd3('0x1f')]],'as':_0x276f43['as'],'attributes':_0x276f43['attributes']};}):[]};}):[]};}):[]:[]})[_0xbbd3('0xb')](function(_0x4b8dfa){logger[_0xbbd3('0x14')](_0xbbd3('0x17'),_0x240a46);logger['debug'](_0xbbd3('0x17'),_0x240a46,JSON[_0xbbd3('0x10')](_0x4b8dfa));_0x50b6e4(_0x4b8dfa);})[_0xbbd3('0x16')](function(_0x1c241f){logger[_0xbbd3('0x12')](_0xbbd3('0x17'),_0x1c241f[_0xbbd3('0x13')],_0x240a46);_0x12954a(_0x5f3952[_0xbbd3('0x12')](0x1f4,_0x1c241f[_0xbbd3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 66a2f03..1cd5a6d 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 _0xab09=['post','create','/:id/clone','clone','update','delete','/:id','destroy','removeLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','getHoppers','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x54c1db,_0x54ec32){var _0x1fa4c0=function(_0x2e1966){while(--_0x2e1966){_0x54c1db['push'](_0x54c1db['shift']());}};_0x1fa4c0(++_0x54ec32);}(_0xab09,0x6a));var _0x9ab0=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0xab09[_0x41010e];return _0x59e342;};'use strict';var multer=require('multer');var util=require(_0x9ab0('0x0'));var path=require(_0x9ab0('0x1'));var timeout=require(_0x9ab0('0x2'));var express=require(_0x9ab0('0x3'));var router=express[_0x9ab0('0x4')]();var fs_extra=require(_0x9ab0('0x5'));var auth=require(_0x9ab0('0x6'));var interaction=require(_0x9ab0('0x7'));var config=require(_0x9ab0('0x8'));var controller=require(_0x9ab0('0x9'));router[_0x9ab0('0xa')]('/',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xc')]);router[_0x9ab0('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9ab0('0xa')]('/:id/hoppers',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xd')]);router[_0x9ab0('0xa')]('/:id/hopper_histories',auth[_0x9ab0('0xb')](),controller[_0x9ab0('0xe')]);router[_0x9ab0('0xa')](_0x9ab0('0xf'),auth[_0x9ab0('0xb')](),controller['getHopperFinals']);router[_0x9ab0('0xa')](_0x9ab0('0x10'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x11')]);router[_0x9ab0('0xa')](_0x9ab0('0x12'),auth['isAuthenticated'](),controller[_0x9ab0('0x13')]);router[_0x9ab0('0xa')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x15')]);router[_0x9ab0('0x16')]('/',auth['isAuthenticated'](),controller[_0x9ab0('0x17')]);router['post'](_0x9ab0('0x18'),auth['isAuthenticated'](),controller[_0x9ab0('0x19')]);router[_0x9ab0('0x16')](_0x9ab0('0x12'),auth[_0x9ab0('0xb')](),controller['addLists']);router[_0x9ab0('0x16')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller['addBlackLists']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9ab0('0x1a')]);router[_0x9ab0('0x1b')](_0x9ab0('0x1c'),auth['isAuthenticated'](),controller[_0x9ab0('0x1d')]);router[_0x9ab0('0x1b')](_0x9ab0('0x12'),auth[_0x9ab0('0xb')](),controller[_0x9ab0('0x1e')]);router[_0x9ab0('0x1b')](_0x9ab0('0x14'),auth[_0x9ab0('0xb')](),controller['removeBlackLists']);module[_0x9ab0('0x1f')]=router; \ No newline at end of file +var _0x5a38=['/:id/clone','clone','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeBlackLists','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/lists','getLists','getBlackLists','post','create'];(function(_0x1a17c2,_0x20ba8a){var _0x796831=function(_0xb28284){while(--_0xb28284){_0x1a17c2['push'](_0x1a17c2['shift']());}};_0x796831(++_0x20ba8a);}(_0x5a38,0x16a));var _0x85a3=function(_0x2f5297,_0x2b93fc){_0x2f5297=_0x2f5297-0x0;var _0x446f62=_0x5a38[_0x2f5297];return _0x446f62;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85a3('0x0'));var timeout=require(_0x85a3('0x1'));var express=require(_0x85a3('0x2'));var router=express[_0x85a3('0x3')]();var fs_extra=require(_0x85a3('0x4'));var auth=require(_0x85a3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x85a3('0x6'));var controller=require(_0x85a3('0x7'));router[_0x85a3('0x8')]('/',auth[_0x85a3('0x9')](),controller['index']);router[_0x85a3('0x8')](_0x85a3('0xa'),auth[_0x85a3('0x9')](),controller[_0x85a3('0xb')]);router['get']('/:id/hoppers',auth[_0x85a3('0x9')](),controller[_0x85a3('0xc')]);router[_0x85a3('0x8')](_0x85a3('0xd'),auth[_0x85a3('0x9')](),controller[_0x85a3('0xe')]);router['get'](_0x85a3('0xf'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x85a3('0x8')](_0x85a3('0x10'),auth[_0x85a3('0x9')](),controller['getHopperBlacks']);router[_0x85a3('0x8')](_0x85a3('0x11'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x12')]);router[_0x85a3('0x8')]('/:id/blacklists',auth[_0x85a3('0x9')](),controller[_0x85a3('0x13')]);router[_0x85a3('0x14')]('/',auth[_0x85a3('0x9')](),controller[_0x85a3('0x15')]);router[_0x85a3('0x14')](_0x85a3('0x16'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x17')]);router[_0x85a3('0x14')](_0x85a3('0x11'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x18')]);router['post'](_0x85a3('0x19'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x1a')]);router[_0x85a3('0x1b')](_0x85a3('0xa'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x1c')]);router[_0x85a3('0x1d')](_0x85a3('0xa'),auth[_0x85a3('0x9')](),controller[_0x85a3('0x1e')]);router[_0x85a3('0x1d')](_0x85a3('0x11'),auth[_0x85a3('0x9')](),controller['removeLists']);router[_0x85a3('0x1d')]('/:id/blacklists',auth[_0x85a3('0x9')](),controller[_0x85a3('0x1f')]);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 47a89d6..6a21b61 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 _0x779b=['key','sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x779b,0x1e4));var _0xb779=function(_0x1901f3,_0x49a7da){_0x1901f3=_0x1901f3-0x0;var _0x1d720d=_0x779b[_0x1901f3];return _0x1d720d;};'use strict';var Sequelize=require(_0xb779('0x0'));module[_0xb779('0x1')]={'key':{'type':Sequelize[_0xb779('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xb779('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0xb779('0x2')]},'name':{'type':Sequelize[_0xb779('0x4')],'get':function(){return this[_0xb779('0x5')](_0xb779('0x6'));}}}; \ No newline at end of file +var _0x1f96=['VIRTUAL','getDataValue','exports','STRING','TEXT'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x1f96,0x1f1));var _0x61f9=function(_0x41ddb1,_0x10991f){_0x41ddb1=_0x41ddb1-0x0;var _0x5d7363=_0x1f96[_0x41ddb1];return _0x5d7363;};'use strict';var Sequelize=require('sequelize');module[_0x61f9('0x0')]={'key':{'type':Sequelize[_0x61f9('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x61f9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x61f9('0x1')]},'name':{'type':Sequelize[_0x61f9('0x3')],'get':function(){return this[_0x61f9('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f356006..c6c945f 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 _0xed76=['fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','include','catch','params','rawAttributes','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','name','send','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x3152dc,_0x2a4311){var _0x5c5d91=function(_0x254e00){while(--_0x254e00){_0x3152dc['push'](_0x3152dc['shift']());}};_0x5c5d91(++_0x2a4311);}(_0xed76,0x1d0));var _0x6ed7=function(_0x407a30,_0x30acd6){_0x407a30=_0x407a30-0x0;var _0x2ceed1=_0xed76[_0x407a30];return _0x2ceed1;};'use strict';var emlformat=require(_0x6ed7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6ed7('0x1'));var jsonpatch=require(_0x6ed7('0x2'));var rp=require(_0x6ed7('0x3'));var moment=require('moment');var BPromise=require(_0x6ed7('0x4'));var Mustache=require(_0x6ed7('0x5'));var util=require(_0x6ed7('0x6'));var path=require(_0x6ed7('0x7'));var sox=require(_0x6ed7('0x8'));var csv=require(_0x6ed7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6ed7('0xa'));var _=require(_0x6ed7('0xb'));var squel=require('squel');var crypto=require(_0x6ed7('0xc'));var jsforce=require(_0x6ed7('0xd'));var deskjs=require(_0x6ed7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ed7('0xf'));var Papa=require(_0x6ed7('0x10'));var Redis=require(_0x6ed7('0x11'));var authService=require(_0x6ed7('0x12'));var qs=require(_0x6ed7('0x13'));var as=require(_0x6ed7('0x14'));var hardwareService=require(_0x6ed7('0x15'));var logger=require(_0x6ed7('0x16'))(_0x6ed7('0x17'));var utils=require(_0x6ed7('0x18'));var config=require(_0x6ed7('0x19'));var licenseUtil=require(_0x6ed7('0x1a'));var db=require(_0x6ed7('0x1b'))['db'];function respondWithStatusCode(_0x438216,_0x573c25){_0x573c25=_0x573c25||0xcc;return function(_0x26de76){if(_0x26de76){return _0x438216[_0x6ed7('0x1c')](_0x573c25);}return _0x438216[_0x6ed7('0x1d')](_0x573c25)[_0x6ed7('0x1e')]();};}function respondWithResult(_0x7e4558,_0x37e68b){_0x37e68b=_0x37e68b||0xc8;return function(_0x5e385c){if(_0x5e385c){return _0x7e4558[_0x6ed7('0x1d')](_0x37e68b)[_0x6ed7('0x1f')](_0x5e385c);}};}function respondWithFilteredResult(_0x3649a5,_0x80d721){return function(_0x2c5a1d){if(_0x2c5a1d){var _0x33babb=typeof _0x80d721[_0x6ed7('0x20')]===_0x6ed7('0x21')&&typeof _0x80d721[_0x6ed7('0x22')]===_0x6ed7('0x21');var _0x341ef1=_0x2c5a1d[_0x6ed7('0x23')];var _0x51966f=_0x33babb?0x0:_0x80d721['offset'];var _0x4b4b19=_0x33babb?_0x2c5a1d[_0x6ed7('0x23')]:_0x80d721[_0x6ed7('0x20')]+_0x80d721[_0x6ed7('0x22')];var _0x41dfde;if(_0x4b4b19>=_0x341ef1){_0x4b4b19=_0x341ef1;_0x41dfde=0xc8;}else{_0x41dfde=0xce;}_0x3649a5[_0x6ed7('0x1d')](_0x41dfde);return _0x3649a5[_0x6ed7('0x24')](_0x6ed7('0x25'),_0x51966f+'-'+_0x4b4b19+'/'+_0x341ef1)[_0x6ed7('0x1f')](_0x2c5a1d);}return null;};}function patchUpdates(_0x510ec3){return function(_0x5df341){try{jsonpatch[_0x6ed7('0x26')](_0x5df341,_0x510ec3,!![]);}catch(_0x36f421){return BPromise['reject'](_0x36f421);}return _0x5df341[_0x6ed7('0x27')]();};}function saveUpdates(_0x20623b,_0x214187){return function(_0x21ef5d){if(_0x21ef5d){return _0x21ef5d[_0x6ed7('0x28')](_0x20623b)[_0x6ed7('0x29')](function(_0x32d19b){return _0x32d19b;});}return null;};}function removeEntity(_0x3e5e00,_0x50e132){return function(_0x56cf33){if(_0x56cf33){return _0x56cf33[_0x6ed7('0x2a')]()[_0x6ed7('0x29')](function(){var _0x1de297=_0x56cf33[_0x6ed7('0x2b')]({'plain':!![]});var _0x4633e0=_0x6ed7('0x2c');return db[_0x6ed7('0x2d')][_0x6ed7('0x2a')]({'where':{'type':_0x4633e0,'resourceId':_0x1de297['id']}})[_0x6ed7('0x29')](function(){return _0x56cf33;});})[_0x6ed7('0x29')](function(){_0x3e5e00['status'](0xcc)[_0x6ed7('0x1e')]();});}};}function handleEntityNotFound(_0x475d3d,_0xae005){return function(_0x58c024){if(!_0x58c024){_0x475d3d[_0x6ed7('0x1c')](0x194);}return _0x58c024;};}function handleError(_0x4a014a,_0xda18ba){_0xda18ba=_0xda18ba||0x1f4;return function(_0x4f766f){logger['error'](_0x4f766f['stack']);if(_0x4f766f[_0x6ed7('0x2e')]){delete _0x4f766f['name'];}_0x4a014a['status'](_0xda18ba)[_0x6ed7('0x2f')](_0x4f766f);};}exports['index']=function(_0x1abece,_0x1e3dd8){var _0x3d2616={},_0x24c5fc={},_0x2f4380={'count':0x0,'rows':[]};var _0x43230b=_[_0x6ed7('0x30')](db[_0x6ed7('0x31')]['rawAttributes'],function(_0x210c9d){return{'name':_0x210c9d[_0x6ed7('0x32')],'type':_0x210c9d[_0x6ed7('0x33')]['key']};});_0x24c5fc[_0x6ed7('0x34')]=_['map'](_0x43230b,_0x6ed7('0x2e'));_0x24c5fc[_0x6ed7('0x35')]=_[_0x6ed7('0x36')](_0x1abece['query']);_0x24c5fc[_0x6ed7('0x37')]=_[_0x6ed7('0x38')](_0x24c5fc['model'],_0x24c5fc[_0x6ed7('0x35')]);_0x3d2616[_0x6ed7('0x39')]=_[_0x6ed7('0x38')](_0x24c5fc[_0x6ed7('0x34')],qs[_0x6ed7('0x3a')](_0x1abece[_0x6ed7('0x35')]['fields']));_0x3d2616[_0x6ed7('0x39')]=_0x3d2616['attributes'][_0x6ed7('0x3b')]?_0x3d2616[_0x6ed7('0x39')]:_0x24c5fc[_0x6ed7('0x34')];if(!_0x1abece['query'][_0x6ed7('0x3c')](_0x6ed7('0x3d'))){_0x3d2616[_0x6ed7('0x22')]=qs['limit'](_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x22')]);_0x3d2616[_0x6ed7('0x20')]=qs[_0x6ed7('0x20')](_0x1abece['query'][_0x6ed7('0x20')]);}_0x3d2616[_0x6ed7('0x3e')]=qs[_0x6ed7('0x3f')](_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x3f')]);_0x3d2616['where']=qs['filters'](_[_0x6ed7('0x40')](_0x1abece[_0x6ed7('0x35')],_0x24c5fc[_0x6ed7('0x37')]),_0x43230b);if(_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]){_0x3d2616['where']=_[_0x6ed7('0x42')](_0x3d2616[_0x6ed7('0x43')],{'$or':[{'key':{'$like':'%'+_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]+'%'}},{'value':{'$like':'%'+_0x1abece[_0x6ed7('0x35')][_0x6ed7('0x41')]+'%'}}]});}_0x3d2616=_[_0x6ed7('0x42')]({},_0x3d2616,_0x1abece[_0x6ed7('0x44')]);var _0x54fd42={'where':_0x3d2616[_0x6ed7('0x43')]};return db[_0x6ed7('0x31')][_0x6ed7('0x23')](_0x54fd42)[_0x6ed7('0x29')](function(_0x3c0af5){_0x2f4380[_0x6ed7('0x23')]=_0x3c0af5;if(_0x1abece[_0x6ed7('0x35')]['includeAll']){_0x3d2616[_0x6ed7('0x45')]=[{'all':!![]}];}return db[_0x6ed7('0x31')]['findAll'](_0x3d2616);})['then'](function(_0x3b7e79){_0x2f4380['rows']=_0x3b7e79;return _0x2f4380;})['then'](respondWithFilteredResult(_0x1e3dd8,_0x3d2616))[_0x6ed7('0x46')](handleError(_0x1e3dd8,null));};exports['show']=function(_0x5bf4ad,_0x2d8002){var _0x3520b0={'raw':!![],'where':{'id':_0x5bf4ad[_0x6ed7('0x47')]['id']}},_0x558323={};_0x558323[_0x6ed7('0x34')]=_[_0x6ed7('0x36')](db['CannedAnswer'][_0x6ed7('0x48')]);_0x558323[_0x6ed7('0x35')]=_[_0x6ed7('0x36')](_0x5bf4ad[_0x6ed7('0x35')]);_0x558323['filters']=_[_0x6ed7('0x38')](_0x558323['model'],_0x558323['query']);_0x3520b0[_0x6ed7('0x39')]=_[_0x6ed7('0x38')](_0x558323[_0x6ed7('0x34')],qs[_0x6ed7('0x3a')](_0x5bf4ad[_0x6ed7('0x35')][_0x6ed7('0x3a')]));_0x3520b0[_0x6ed7('0x39')]=_0x3520b0[_0x6ed7('0x39')][_0x6ed7('0x3b')]?_0x3520b0['attributes']:_0x558323['model'];if(_0x5bf4ad['query'][_0x6ed7('0x49')]){_0x3520b0[_0x6ed7('0x45')]=[{'all':!![]}];}_0x3520b0=_[_0x6ed7('0x42')]({},_0x3520b0,_0x5bf4ad[_0x6ed7('0x44')]);return db[_0x6ed7('0x31')]['find'](_0x3520b0)['then'](handleEntityNotFound(_0x2d8002,null))[_0x6ed7('0x29')](respondWithResult(_0x2d8002,null))['catch'](handleError(_0x2d8002,null));};exports['update']=function(_0x3caba9,_0x5920b4){if(_0x3caba9['body']['id']){delete _0x3caba9[_0x6ed7('0x4a')]['id'];}return db[_0x6ed7('0x31')]['find']({'where':{'id':_0x3caba9[_0x6ed7('0x47')]['id']}})[_0x6ed7('0x29')](handleEntityNotFound(_0x5920b4,null))[_0x6ed7('0x29')](saveUpdates(_0x3caba9[_0x6ed7('0x4a')],null))[_0x6ed7('0x29')](respondWithResult(_0x5920b4,null))[_0x6ed7('0x46')](handleError(_0x5920b4,null));};exports['destroy']=function(_0x970a0a,_0x51f4e8){return db[_0x6ed7('0x31')][_0x6ed7('0x4b')]({'where':{'id':_0x970a0a[_0x6ed7('0x47')]['id']}})[_0x6ed7('0x29')](handleEntityNotFound(_0x51f4e8,null))[_0x6ed7('0x29')](removeEntity(_0x51f4e8,null))[_0x6ed7('0x46')](handleError(_0x51f4e8,null));};exports[_0x6ed7('0x4c')]=function(_0x334b15,_0x202a14){var _0x7a5e5b={'key':_0x334b15['body']['key']};if(_0x334b15['body'][_0x6ed7('0x4d')]){_0x7a5e5b[_0x6ed7('0x4d')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4d')];}else if(_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4e')]){_0x7a5e5b[_0x6ed7('0x4e')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4e')];}else if(_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4f')]){_0x7a5e5b[_0x6ed7('0x4f')]=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x4f')];}else if(_0x334b15['body']['ChatWebsiteId']){_0x7a5e5b['ChatWebsiteId']=_0x334b15[_0x6ed7('0x4a')][_0x6ed7('0x50')];}return db[_0x6ed7('0x31')][_0x6ed7('0x4b')]({'where':_0x7a5e5b})[_0x6ed7('0x29')](function(_0x1cd0ce){if(_0x1cd0ce){throw new db[(_0x6ed7('0x51'))]['ValidationError'](_0x6ed7('0x52'));}return db[_0x6ed7('0x31')]['create'](_0x334b15[_0x6ed7('0x4a')]);})[_0x6ed7('0x29')](function(_0x1375fc){var _0x560f1b=_0x334b15['user']['get']({'plain':!![]});if(!_0x560f1b)throw new Error(_0x6ed7('0x53'));if(_0x560f1b['role']===_0x6ed7('0x54')){var _0x31e3bc=_0x1375fc['get']({'plain':!![]});return db[_0x6ed7('0x55')][_0x6ed7('0x4b')]({'where':{'name':'CannedAnswers','userProfileId':_0x560f1b['userProfileId']},'raw':!![]})[_0x6ed7('0x29')](function(_0xbf2d46){if(_0xbf2d46&&_0xbf2d46['autoAssociation']===0x0){return db[_0x6ed7('0x2d')][_0x6ed7('0x4c')]({'name':_0x31e3bc['name'],'resourceId':_0x31e3bc['id'],'type':_0xbf2d46[_0x6ed7('0x2e')],'sectionId':_0xbf2d46['id']},{})[_0x6ed7('0x29')](function(){return _0x1375fc;});}else{return _0x1375fc;}})[_0x6ed7('0x46')](function(_0x5993aa){logger['error'](_0x6ed7('0x56'),_0x5993aa);throw _0x5993aa;});}return _0x1375fc;})['then'](respondWithResult(_0x202a14,0xc9))[_0x6ed7('0x46')](handleError(_0x202a14,null));}; \ No newline at end of file +var _0xdf64=['limit','status','set','Content-Range','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','CannedAnswer','include','findAll','rows','catch','show','params','length','includeAll','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../mysqldb','sendStatus','end','json','offset','undefined','count'];(function(_0x22a415,_0x5eeb7b){var _0x4ab998=function(_0x27926f){while(--_0x27926f){_0x22a415['push'](_0x22a415['shift']());}};_0x4ab998(++_0x5eeb7b);}(_0xdf64,0x15f));var _0x4df6=function(_0x38728a,_0x3079d9){_0x38728a=_0x38728a-0x0;var _0x23118a=_0xdf64[_0x38728a];return _0x23118a;};'use strict';var emlformat=require(_0x4df6('0x0'));var rimraf=require(_0x4df6('0x1'));var zipdir=require(_0x4df6('0x2'));var jsonpatch=require(_0x4df6('0x3'));var rp=require(_0x4df6('0x4'));var moment=require(_0x4df6('0x5'));var BPromise=require(_0x4df6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4df6('0x7'));var sox=require(_0x4df6('0x8'));var csv=require(_0x4df6('0x9'));var ejs=require(_0x4df6('0xa'));var fs=require('fs');var fs_extra=require(_0x4df6('0xb'));var _=require(_0x4df6('0xc'));var squel=require(_0x4df6('0xd'));var crypto=require(_0x4df6('0xe'));var jsforce=require(_0x4df6('0xf'));var deskjs=require(_0x4df6('0x10'));var toCsv=require(_0x4df6('0x9'));var querystring=require('querystring');var Papa=require(_0x4df6('0x11'));var Redis=require(_0x4df6('0x12'));var authService=require(_0x4df6('0x13'));var qs=require(_0x4df6('0x14'));var as=require(_0x4df6('0x15'));var hardwareService=require(_0x4df6('0x16'));var logger=require(_0x4df6('0x17'))(_0x4df6('0x18'));var utils=require(_0x4df6('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4df6('0x1a'))['db'];function respondWithStatusCode(_0x525c69,_0x150d3a){_0x150d3a=_0x150d3a||0xcc;return function(_0x472a66){if(_0x472a66){return _0x525c69[_0x4df6('0x1b')](_0x150d3a);}return _0x525c69['status'](_0x150d3a)[_0x4df6('0x1c')]();};}function respondWithResult(_0x4b00a7,_0x229f09){_0x229f09=_0x229f09||0xc8;return function(_0x29395d){if(_0x29395d){return _0x4b00a7['status'](_0x229f09)[_0x4df6('0x1d')](_0x29395d);}};}function respondWithFilteredResult(_0x1a5e8c,_0x25e5ab){return function(_0x117b01){if(_0x117b01){var _0x3557bc=typeof _0x25e5ab[_0x4df6('0x1e')]==='undefined'&&typeof _0x25e5ab['limit']===_0x4df6('0x1f');var _0x30f228=_0x117b01[_0x4df6('0x20')];var _0x5ec6c3=_0x3557bc?0x0:_0x25e5ab[_0x4df6('0x1e')];var _0x3442ce=_0x3557bc?_0x117b01[_0x4df6('0x20')]:_0x25e5ab[_0x4df6('0x1e')]+_0x25e5ab[_0x4df6('0x21')];var _0x19b935;if(_0x3442ce>=_0x30f228){_0x3442ce=_0x30f228;_0x19b935=0xc8;}else{_0x19b935=0xce;}_0x1a5e8c[_0x4df6('0x22')](_0x19b935);return _0x1a5e8c[_0x4df6('0x23')](_0x4df6('0x24'),_0x5ec6c3+'-'+_0x3442ce+'/'+_0x30f228)['json'](_0x117b01);}return null;};}function patchUpdates(_0x114119){return function(_0x3990e6){try{jsonpatch[_0x4df6('0x25')](_0x3990e6,_0x114119,!![]);}catch(_0x3611b9){return BPromise[_0x4df6('0x26')](_0x3611b9);}return _0x3990e6[_0x4df6('0x27')]();};}function saveUpdates(_0x54e83c,_0x3552e8){return function(_0x57d0d1){if(_0x57d0d1){return _0x57d0d1[_0x4df6('0x28')](_0x54e83c)[_0x4df6('0x29')](function(_0x5914e6){return _0x5914e6;});}return null;};}function removeEntity(_0x2f6225,_0x4821f7){return function(_0x39ff59){if(_0x39ff59){return _0x39ff59[_0x4df6('0x2a')]()['then'](function(){var _0x1f35bc=_0x39ff59[_0x4df6('0x2b')]({'plain':!![]});var _0x1462b8=_0x4df6('0x2c');return db[_0x4df6('0x2d')][_0x4df6('0x2a')]({'where':{'type':_0x1462b8,'resourceId':_0x1f35bc['id']}})['then'](function(){return _0x39ff59;});})[_0x4df6('0x29')](function(){_0x2f6225[_0x4df6('0x22')](0xcc)[_0x4df6('0x1c')]();});}};}function handleEntityNotFound(_0x1b2ceb,_0x396119){return function(_0x47984a){if(!_0x47984a){_0x1b2ceb[_0x4df6('0x1b')](0x194);}return _0x47984a;};}function handleError(_0xb0ae06,_0x5a4ca7){_0x5a4ca7=_0x5a4ca7||0x1f4;return function(_0x320c14){logger['error'](_0x320c14[_0x4df6('0x2e')]);if(_0x320c14[_0x4df6('0x2f')]){delete _0x320c14[_0x4df6('0x2f')];}_0xb0ae06[_0x4df6('0x22')](_0x5a4ca7)['send'](_0x320c14);};}exports[_0x4df6('0x30')]=function(_0x5ef808,_0x2e1143){var _0x1c8dc8={},_0x57bf4b={},_0x2cef07={'count':0x0,'rows':[]};var _0x4f548d=_[_0x4df6('0x31')](db['CannedAnswer'][_0x4df6('0x32')],function(_0x95fbc){return{'name':_0x95fbc[_0x4df6('0x33')],'type':_0x95fbc[_0x4df6('0x34')][_0x4df6('0x35')]};});_0x57bf4b[_0x4df6('0x36')]=_[_0x4df6('0x31')](_0x4f548d,'name');_0x57bf4b[_0x4df6('0x37')]=_[_0x4df6('0x38')](_0x5ef808['query']);_0x57bf4b['filters']=_[_0x4df6('0x39')](_0x57bf4b[_0x4df6('0x36')],_0x57bf4b[_0x4df6('0x37')]);_0x1c8dc8['attributes']=_[_0x4df6('0x39')](_0x57bf4b[_0x4df6('0x36')],qs[_0x4df6('0x3a')](_0x5ef808[_0x4df6('0x37')][_0x4df6('0x3a')]));_0x1c8dc8['attributes']=_0x1c8dc8[_0x4df6('0x3b')]['length']?_0x1c8dc8['attributes']:_0x57bf4b[_0x4df6('0x36')];if(!_0x5ef808[_0x4df6('0x37')][_0x4df6('0x3c')](_0x4df6('0x3d'))){_0x1c8dc8[_0x4df6('0x21')]=qs[_0x4df6('0x21')](_0x5ef808[_0x4df6('0x37')][_0x4df6('0x21')]);_0x1c8dc8[_0x4df6('0x1e')]=qs[_0x4df6('0x1e')](_0x5ef808[_0x4df6('0x37')]['offset']);}_0x1c8dc8[_0x4df6('0x3e')]=qs['sort'](_0x5ef808['query'][_0x4df6('0x3f')]);_0x1c8dc8[_0x4df6('0x40')]=qs[_0x4df6('0x41')](_[_0x4df6('0x42')](_0x5ef808[_0x4df6('0x37')],_0x57bf4b[_0x4df6('0x41')]),_0x4f548d);if(_0x5ef808['query'][_0x4df6('0x43')]){_0x1c8dc8[_0x4df6('0x40')]=_[_0x4df6('0x44')](_0x1c8dc8[_0x4df6('0x40')],{'$or':[{'key':{'$like':'%'+_0x5ef808[_0x4df6('0x37')][_0x4df6('0x43')]+'%'}},{'value':{'$like':'%'+_0x5ef808['query'][_0x4df6('0x43')]+'%'}}]});}_0x1c8dc8=_[_0x4df6('0x44')]({},_0x1c8dc8,_0x5ef808[_0x4df6('0x45')]);var _0x3ae64a={'where':_0x1c8dc8['where']};return db[_0x4df6('0x46')][_0x4df6('0x20')](_0x3ae64a)[_0x4df6('0x29')](function(_0x2d9baf){_0x2cef07[_0x4df6('0x20')]=_0x2d9baf;if(_0x5ef808[_0x4df6('0x37')]['includeAll']){_0x1c8dc8[_0x4df6('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4df6('0x48')](_0x1c8dc8);})['then'](function(_0x1b595b){_0x2cef07[_0x4df6('0x49')]=_0x1b595b;return _0x2cef07;})[_0x4df6('0x29')](respondWithFilteredResult(_0x2e1143,_0x1c8dc8))[_0x4df6('0x4a')](handleError(_0x2e1143,null));};exports[_0x4df6('0x4b')]=function(_0x410747,_0x4264e8){var _0x49c6f3={'raw':!![],'where':{'id':_0x410747[_0x4df6('0x4c')]['id']}},_0x2cde3d={};_0x2cde3d[_0x4df6('0x36')]=_[_0x4df6('0x38')](db[_0x4df6('0x46')][_0x4df6('0x32')]);_0x2cde3d[_0x4df6('0x37')]=_[_0x4df6('0x38')](_0x410747[_0x4df6('0x37')]);_0x2cde3d[_0x4df6('0x41')]=_[_0x4df6('0x39')](_0x2cde3d[_0x4df6('0x36')],_0x2cde3d[_0x4df6('0x37')]);_0x49c6f3['attributes']=_[_0x4df6('0x39')](_0x2cde3d[_0x4df6('0x36')],qs[_0x4df6('0x3a')](_0x410747[_0x4df6('0x37')]['fields']));_0x49c6f3[_0x4df6('0x3b')]=_0x49c6f3[_0x4df6('0x3b')][_0x4df6('0x4d')]?_0x49c6f3[_0x4df6('0x3b')]:_0x2cde3d[_0x4df6('0x36')];if(_0x410747['query'][_0x4df6('0x4e')]){_0x49c6f3[_0x4df6('0x47')]=[{'all':!![]}];}_0x49c6f3=_[_0x4df6('0x44')]({},_0x49c6f3,_0x410747[_0x4df6('0x45')]);return db['CannedAnswer'][_0x4df6('0x4f')](_0x49c6f3)[_0x4df6('0x29')](handleEntityNotFound(_0x4264e8,null))[_0x4df6('0x29')](respondWithResult(_0x4264e8,null))[_0x4df6('0x4a')](handleError(_0x4264e8,null));};exports[_0x4df6('0x28')]=function(_0x36298e,_0x47c7ca){if(_0x36298e[_0x4df6('0x50')]['id']){delete _0x36298e[_0x4df6('0x50')]['id'];}return db[_0x4df6('0x46')][_0x4df6('0x4f')]({'where':{'id':_0x36298e[_0x4df6('0x4c')]['id']}})[_0x4df6('0x29')](handleEntityNotFound(_0x47c7ca,null))[_0x4df6('0x29')](saveUpdates(_0x36298e[_0x4df6('0x50')],null))[_0x4df6('0x29')](respondWithResult(_0x47c7ca,null))[_0x4df6('0x4a')](handleError(_0x47c7ca,null));};exports[_0x4df6('0x2a')]=function(_0x902d33,_0xc338aa){return db[_0x4df6('0x46')][_0x4df6('0x4f')]({'where':{'id':_0x902d33['params']['id']}})[_0x4df6('0x29')](handleEntityNotFound(_0xc338aa,null))[_0x4df6('0x29')](removeEntity(_0xc338aa,null))[_0x4df6('0x4a')](handleError(_0xc338aa,null));};exports['create']=function(_0x2b27a5,_0x14f4dc){var _0x2c689f={'key':_0x2b27a5[_0x4df6('0x50')]['key']};if(_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x51')]){_0x2c689f[_0x4df6('0x51')]=_0x2b27a5['body'][_0x4df6('0x51')];}else if(_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x52')]){_0x2c689f['SmsAccountId']=_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x52')];}else if(_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x53')]){_0x2c689f[_0x4df6('0x53')]=_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x53')];}else if(_0x2b27a5['body']['ChatWebsiteId']){_0x2c689f[_0x4df6('0x54')]=_0x2b27a5[_0x4df6('0x50')][_0x4df6('0x54')];}return db[_0x4df6('0x46')][_0x4df6('0x4f')]({'where':_0x2c689f})[_0x4df6('0x29')](function(_0x4ff5be){if(_0x4ff5be){throw new db[(_0x4df6('0x55'))][(_0x4df6('0x56'))](_0x4df6('0x57'));}return db['CannedAnswer'][_0x4df6('0x58')](_0x2b27a5['body']);})['then'](function(_0x471341){var _0x3daea9=_0x2b27a5[_0x4df6('0x59')][_0x4df6('0x2b')]({'plain':!![]});if(!_0x3daea9)throw new Error(_0x4df6('0x5a'));if(_0x3daea9[_0x4df6('0x5b')]===_0x4df6('0x59')){var _0x5ddb14=_0x471341[_0x4df6('0x2b')]({'plain':!![]});return db[_0x4df6('0x5c')][_0x4df6('0x4f')]({'where':{'name':'CannedAnswers','userProfileId':_0x3daea9[_0x4df6('0x5d')]},'raw':!![]})['then'](function(_0x29de75){if(_0x29de75&&_0x29de75[_0x4df6('0x5e')]===0x0){return db['UserProfileResource'][_0x4df6('0x58')]({'name':_0x5ddb14['name'],'resourceId':_0x5ddb14['id'],'type':_0x29de75[_0x4df6('0x2f')],'sectionId':_0x29de75['id']},{})[_0x4df6('0x29')](function(){return _0x471341;});}else{return _0x471341;}})[_0x4df6('0x4a')](function(_0x12de0d){logger[_0x4df6('0x5f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12de0d);throw _0x12de0d;});}return _0x471341;})[_0x4df6('0x29')](respondWithResult(_0x14f4dc,0xc9))[_0x4df6('0x4a')](handleError(_0x14f4dc,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 922bd82..f08c75a 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 _0xa786=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1f8e5d,_0x28d764){var _0x1627c9=function(_0x2dcd38){while(--_0x2dcd38){_0x1f8e5d['push'](_0x1f8e5d['shift']());}};_0x1627c9(++_0x28d764);}(_0xa786,0x1f1));var _0x6a78=function(_0x19d637,_0x94577c){_0x19d637=_0x19d637-0x0;var _0x33b625=_0xa786[_0x19d637];return _0x33b625;};'use strict';var _=require(_0x6a78('0x0'));var util=require(_0x6a78('0x1'));var logger=require(_0x6a78('0x2'))(_0x6a78('0x3'));var moment=require(_0x6a78('0x4'));var BPromise=require(_0x6a78('0x5'));var rp=require(_0x6a78('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a78('0x7'));var config=require(_0x6a78('0x8'));var attributes=require(_0x6a78('0x9'));module[_0x6a78('0xa')]=function(_0x5624df,_0x152b20){return _0x5624df[_0x6a78('0xb')](_0x6a78('0xc'),attributes,{'tableName':_0x6a78('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0195=['lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports','CannedAnswer','tools_canned_answers'];(function(_0x1a0092,_0x2267e0){var _0x3ae0d9=function(_0x509864){while(--_0x509864){_0x1a0092['push'](_0x1a0092['shift']());}};_0x3ae0d9(++_0x2267e0);}(_0x0195,0x168));var _0x5019=function(_0x4b76ae,_0x2dafab){_0x4b76ae=_0x4b76ae-0x0;var _0x3b723d=_0x0195[_0x4b76ae];return _0x3b723d;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var logger=require(_0x5019('0x2'))(_0x5019('0x3'));var moment=require(_0x5019('0x4'));var BPromise=require(_0x5019('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5019('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x5019('0x7')]=function(_0x318924,_0x4c0466){return _0x318924['define'](_0x5019('0x8'),attributes,{'tableName':_0x5019('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 d20d1cb..bf13615 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(_0x2b0547,_0x2251b6){var _0x3d13fd=function(_0x573072){while(--_0x573072){_0x2b0547['push'](_0x2b0547['shift']());}};_0x3d13fd(++_0x2251b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x1c0c42,_0x5c1ce9){var _0x155ca4=function(_0x34577a){while(--_0x34577a){_0x1c0c42['push'](_0x1c0c42['shift']());}};_0x155ca4(++_0x5c1ce9);}(_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 38f3a52..18440df 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 _0x4816=['delete','/:id','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','post','put','update'];(function(_0x1b3564,_0x16c919){var _0x504069=function(_0x9322b6){while(--_0x9322b6){_0x1b3564['push'](_0x1b3564['shift']());}};_0x504069(++_0x16c919);}(_0x4816,0xa5));var _0x6481=function(_0x1580f7,_0xf2b31c){_0x1580f7=_0x1580f7-0x0;var _0x2a5b4f=_0x4816[_0x1580f7];return _0x2a5b4f;};'use strict';var multer=require(_0x6481('0x0'));var util=require('util');var path=require(_0x6481('0x1'));var timeout=require(_0x6481('0x2'));var express=require(_0x6481('0x3'));var router=express[_0x6481('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6481('0x5'));var interaction=require(_0x6481('0x6'));var config=require(_0x6481('0x7'));var controller=require(_0x6481('0x8'));router['get']('/',auth[_0x6481('0x9')](),controller['index']);router[_0x6481('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6481('0xb')]);router[_0x6481('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6481('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x6481('0xe')]);router[_0x6481('0xf')](_0x6481('0x10'),auth[_0x6481('0x9')](),controller['destroy']);module[_0x6481('0x11')]=router; \ No newline at end of file +var _0x6b83=['express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x4d4245,_0x49f546){var _0x57278e=function(_0x1d5973){while(--_0x1d5973){_0x4d4245['push'](_0x4d4245['shift']());}};_0x57278e(++_0x49f546);}(_0x6b83,0xc3));var _0x36b8=function(_0x12d573,_0x20ae28){_0x12d573=_0x12d573-0x0;var _0x5c7071=_0x6b83[_0x12d573];return _0x5c7071;};'use strict';var multer=require(_0x36b8('0x0'));var util=require(_0x36b8('0x1'));var path=require(_0x36b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x36b8('0x3'));var router=express[_0x36b8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x36b8('0x5'));var config=require(_0x36b8('0x6'));var controller=require(_0x36b8('0x7'));router[_0x36b8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x36b8('0x9')]);router[_0x36b8('0xa')]('/',auth[_0x36b8('0xb')](),controller['create']);router[_0x36b8('0xc')](_0x36b8('0xd'),auth[_0x36b8('0xb')](),controller[_0x36b8('0xe')]);router[_0x36b8('0xf')](_0x36b8('0xd'),auth[_0x36b8('0xb')](),controller[_0x36b8('0x10')]);module[_0x36b8('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d750cfd..bf48008 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 _0x7d13=['exports','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x6f996a,_0x14cf09){var _0x43a5af=function(_0x1c766f){while(--_0x1c766f){_0x6f996a['push'](_0x6f996a['shift']());}};_0x43a5af(++_0x14cf09);}(_0x7d13,0x6c));var _0x37d1=function(_0x3ee8b1,_0x375088){_0x3ee8b1=_0x3ee8b1-0x0;var _0x53aa77=_0x7d13[_0x3ee8b1];return _0x53aa77;};'use strict';var Sequelize=require('sequelize');module[_0x37d1('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x37d1('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x37d1('0x2')]},'dst':{'type':Sequelize[_0x37d1('0x2')]},'dcontext':{'type':Sequelize[_0x37d1('0x2')]},'channel':{'type':Sequelize[_0x37d1('0x2')]},'dstchannel':{'type':Sequelize[_0x37d1('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x37d1('0x2')]},'duration':{'type':Sequelize[_0x37d1('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x37d1('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x37d1('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x37d1('0x2')]},'userfield':{'type':Sequelize[_0x37d1('0x2')]},'uniqueid':{'type':Sequelize[_0x37d1('0x2')]},'linkedid':{'type':Sequelize[_0x37d1('0x2')]},'sequence':{'type':Sequelize[_0x37d1('0x2')]},'peeraccount':{'type':Sequelize[_0x37d1('0x2')]},'type':{'type':Sequelize[_0x37d1('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe1fe=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x345e37,_0x27f1dd){var _0x163a18=function(_0x1cbf77){while(--_0x1cbf77){_0x345e37['push'](_0x345e37['shift']());}};_0x163a18(++_0x27f1dd);}(_0xe1fe,0x1c3));var _0xee1f=function(_0x2ba4fd,_0xef6328){_0x2ba4fd=_0x2ba4fd-0x0;var _0x1f6427=_0xe1fe[_0x2ba4fd];return _0x1f6427;};'use strict';var Sequelize=require(_0xee1f('0x0'));module[_0xee1f('0x1')]={'calldate':{'type':Sequelize[_0xee1f('0x2')],'allowNull':![],'defaultValue':_0xee1f('0x3')},'clid':{'type':Sequelize[_0xee1f('0x4')]},'src':{'type':Sequelize[_0xee1f('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xee1f('0x4')]},'dstchannel':{'type':Sequelize[_0xee1f('0x4')]},'lastapp':{'type':Sequelize[_0xee1f('0x4')]},'lastdata':{'type':Sequelize[_0xee1f('0x4')]},'duration':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xee1f('0x4')]},'amaflags':{'type':Sequelize[_0xee1f('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xee1f('0x4')]},'userfield':{'type':Sequelize[_0xee1f('0x4')]},'uniqueid':{'type':Sequelize[_0xee1f('0x4')]},'linkedid':{'type':Sequelize[_0xee1f('0x4')]},'sequence':{'type':Sequelize[_0xee1f('0x4')]},'peeraccount':{'type':Sequelize[_0xee1f('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 221004b..9b2c148 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 _0xf9d5=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','error','stack','name','index','map','Cdr','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x1156ce,_0x50f233){var _0x2b6d72=function(_0x36a033){while(--_0x36a033){_0x1156ce['push'](_0x1156ce['shift']());}};_0x2b6d72(++_0x50f233);}(_0xf9d5,0x122));var _0x5f9d=function(_0x3f80d3,_0x1df024){_0x3f80d3=_0x3f80d3-0x0;var _0x1d13b1=_0xf9d5[_0x3f80d3];return _0x1d13b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5f9d('0x0'));var zipdir=require(_0x5f9d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f9d('0x2'));var moment=require(_0x5f9d('0x3'));var BPromise=require(_0x5f9d('0x4'));var Mustache=require(_0x5f9d('0x5'));var util=require(_0x5f9d('0x6'));var path=require(_0x5f9d('0x7'));var sox=require(_0x5f9d('0x8'));var csv=require('to-csv');var ejs=require(_0x5f9d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f9d('0xa'));var squel=require(_0x5f9d('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f9d('0xc'));var deskjs=require(_0x5f9d('0xd'));var toCsv=require(_0x5f9d('0xe'));var querystring=require(_0x5f9d('0xf'));var Papa=require(_0x5f9d('0x10'));var Redis=require(_0x5f9d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5f9d('0x12'));var as=require(_0x5f9d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f9d('0x14'));var utils=require(_0x5f9d('0x15'));var config=require(_0x5f9d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5f9d('0x17'))['db'];function respondWithStatusCode(_0x10f5b1,_0x257910){_0x257910=_0x257910||0xcc;return function(_0x23a39f){if(_0x23a39f){return _0x10f5b1['sendStatus'](_0x257910);}return _0x10f5b1[_0x5f9d('0x18')](_0x257910)[_0x5f9d('0x19')]();};}function respondWithResult(_0x234902,_0x5aacdc){_0x5aacdc=_0x5aacdc||0xc8;return function(_0x8e2381){if(_0x8e2381){return _0x234902[_0x5f9d('0x18')](_0x5aacdc)['json'](_0x8e2381);}};}function respondWithFilteredResult(_0x4fd1cb,_0x2f0154){return function(_0x334cea){if(_0x334cea){var _0x3d4a1c=typeof _0x2f0154[_0x5f9d('0x1a')]===_0x5f9d('0x1b')&&typeof _0x2f0154['limit']==='undefined';var _0x54bd00=_0x334cea[_0x5f9d('0x1c')];var _0x4fb9a5=_0x3d4a1c?0x0:_0x2f0154[_0x5f9d('0x1a')];var _0x48448e=_0x3d4a1c?_0x334cea[_0x5f9d('0x1c')]:_0x2f0154[_0x5f9d('0x1a')]+_0x2f0154[_0x5f9d('0x1d')];var _0x55a31c;if(_0x48448e>=_0x54bd00){_0x48448e=_0x54bd00;_0x55a31c=0xc8;}else{_0x55a31c=0xce;}_0x4fd1cb[_0x5f9d('0x18')](_0x55a31c);return _0x4fd1cb[_0x5f9d('0x1e')](_0x5f9d('0x1f'),_0x4fb9a5+'-'+_0x48448e+'/'+_0x54bd00)[_0x5f9d('0x20')](_0x334cea);}return null;};}function patchUpdates(_0x320182){return function(_0xa62826){try{jsonpatch[_0x5f9d('0x21')](_0xa62826,_0x320182,!![]);}catch(_0x2563d5){return BPromise[_0x5f9d('0x22')](_0x2563d5);}return _0xa62826['save']();};}function saveUpdates(_0x4a2eeb,_0x5465b1){return function(_0x1bc76b){if(_0x1bc76b){return _0x1bc76b['update'](_0x4a2eeb)[_0x5f9d('0x23')](function(_0x5a3472){return _0x5a3472;});}return null;};}function removeEntity(_0x9d86ce,_0x564886){return function(_0x4875c5){if(_0x4875c5){return _0x4875c5['destroy']()[_0x5f9d('0x23')](function(){_0x9d86ce[_0x5f9d('0x18')](0xcc)[_0x5f9d('0x19')]();});}};}function handleEntityNotFound(_0x234511,_0x542bbc){return function(_0x379d2d){if(!_0x379d2d){_0x234511[_0x5f9d('0x24')](0x194);}return _0x379d2d;};}function handleError(_0x190402,_0x74f212){_0x74f212=_0x74f212||0x1f4;return function(_0x2d097f){logger[_0x5f9d('0x25')](_0x2d097f[_0x5f9d('0x26')]);if(_0x2d097f[_0x5f9d('0x27')]){delete _0x2d097f[_0x5f9d('0x27')];}_0x190402[_0x5f9d('0x18')](_0x74f212)['send'](_0x2d097f);};}exports[_0x5f9d('0x28')]=function(_0x1b9054,_0x1496c0){var _0x13cc7c={},_0x10e542={},_0x24233e={'count':0x0,'rows':[]};var _0x38b10d=_[_0x5f9d('0x29')](db[_0x5f9d('0x2a')]['rawAttributes'],function(_0x4ed27d){return{'name':_0x4ed27d['fieldName'],'type':_0x4ed27d[_0x5f9d('0x2b')]['key']};});_0x10e542[_0x5f9d('0x2c')]=_['map'](_0x38b10d,_0x5f9d('0x27'));_0x10e542['query']=_[_0x5f9d('0x2d')](_0x1b9054[_0x5f9d('0x2e')]);_0x10e542[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x10e542[_0x5f9d('0x2c')],_0x10e542['query']);_0x13cc7c[_0x5f9d('0x31')]=_['intersection'](_0x10e542[_0x5f9d('0x2c')],qs['fields'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0x13cc7c['attributes']=_0x13cc7c[_0x5f9d('0x31')][_0x5f9d('0x33')]?_0x13cc7c[_0x5f9d('0x31')]:_0x10e542['model'];if(!_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x34')](_0x5f9d('0x35'))){_0x13cc7c[_0x5f9d('0x1d')]=qs[_0x5f9d('0x1d')](_0x1b9054['query'][_0x5f9d('0x1d')]);_0x13cc7c[_0x5f9d('0x1a')]=qs[_0x5f9d('0x1a')](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x1a')]);}_0x13cc7c[_0x5f9d('0x36')]=qs['sort'](_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x37')]);_0x13cc7c[_0x5f9d('0x38')]=qs['filters'](_['pick'](_0x1b9054[_0x5f9d('0x2e')],_0x10e542[_0x5f9d('0x2f')]),_0x38b10d);if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x39')]){_0x13cc7c[_0x5f9d('0x38')]=_['merge'](_0x13cc7c['where'],{'$or':_[_0x5f9d('0x29')](_0x38b10d,function(_0x3c5737){if(_0x3c5737['type']!==_0x5f9d('0x3a')){var _0x4e15be={};_0x4e15be[_0x3c5737[_0x5f9d('0x27')]]={'$like':'%'+_0x1b9054[_0x5f9d('0x2e')]['filter']+'%'};return _0x4e15be;}})});}_0x13cc7c=_[_0x5f9d('0x3b')]({},_0x13cc7c,_0x1b9054[_0x5f9d('0x3c')]);var _0x4d3288={'where':_0x13cc7c['where']};return db[_0x5f9d('0x2a')][_0x5f9d('0x1c')](_0x4d3288)[_0x5f9d('0x23')](function(_0x3c43f6){_0x24233e[_0x5f9d('0x1c')]=_0x3c43f6;if(_0x1b9054[_0x5f9d('0x2e')][_0x5f9d('0x3d')]){_0x13cc7c[_0x5f9d('0x3e')]=[{'all':!![]}];}return db[_0x5f9d('0x2a')][_0x5f9d('0x3f')](_0x13cc7c);})[_0x5f9d('0x23')](function(_0x227ef6){_0x24233e[_0x5f9d('0x40')]=_0x227ef6;return _0x24233e;})[_0x5f9d('0x23')](respondWithFilteredResult(_0x1496c0,_0x13cc7c))[_0x5f9d('0x41')](handleError(_0x1496c0,null));};exports[_0x5f9d('0x42')]=function(_0x45ba15,_0x1590b5){var _0xf02211={'raw':!![],'where':{'id':_0x45ba15[_0x5f9d('0x43')]['id']}},_0x21b5d1={};_0x21b5d1[_0x5f9d('0x2c')]=_[_0x5f9d('0x2d')](db[_0x5f9d('0x2a')][_0x5f9d('0x44')]);_0x21b5d1[_0x5f9d('0x2e')]=_[_0x5f9d('0x2d')](_0x45ba15[_0x5f9d('0x2e')]);_0x21b5d1[_0x5f9d('0x2f')]=_[_0x5f9d('0x30')](_0x21b5d1['model'],_0x21b5d1[_0x5f9d('0x2e')]);_0xf02211['attributes']=_[_0x5f9d('0x30')](_0x21b5d1[_0x5f9d('0x2c')],qs[_0x5f9d('0x32')](_0x45ba15[_0x5f9d('0x2e')][_0x5f9d('0x32')]));_0xf02211[_0x5f9d('0x31')]=_0xf02211[_0x5f9d('0x31')]['length']?_0xf02211[_0x5f9d('0x31')]:_0x21b5d1[_0x5f9d('0x2c')];if(_0x45ba15[_0x5f9d('0x2e')]['includeAll']){_0xf02211[_0x5f9d('0x3e')]=[{'all':!![]}];}_0xf02211=_['merge']({},_0xf02211,_0x45ba15[_0x5f9d('0x3c')]);return db[_0x5f9d('0x2a')][_0x5f9d('0x45')](_0xf02211)['then'](handleEntityNotFound(_0x1590b5,null))['then'](respondWithResult(_0x1590b5,null))[_0x5f9d('0x41')](handleError(_0x1590b5,null));};exports[_0x5f9d('0x46')]=function(_0x4c9645,_0x2a43a3){return db['Cdr'][_0x5f9d('0x46')](_0x4c9645[_0x5f9d('0x47')],{})[_0x5f9d('0x23')](respondWithResult(_0x2a43a3,0xc9))[_0x5f9d('0x41')](handleError(_0x2a43a3,null));};exports[_0x5f9d('0x48')]=function(_0x16a9fa,_0x3aa63c){if(_0x16a9fa[_0x5f9d('0x47')]['id']){delete _0x16a9fa[_0x5f9d('0x47')]['id'];}return db[_0x5f9d('0x2a')]['find']({'where':{'id':_0x16a9fa[_0x5f9d('0x43')]['id']}})[_0x5f9d('0x23')](handleEntityNotFound(_0x3aa63c,null))['then'](saveUpdates(_0x16a9fa[_0x5f9d('0x47')],null))[_0x5f9d('0x23')](respondWithResult(_0x3aa63c,null))[_0x5f9d('0x41')](handleError(_0x3aa63c,null));};exports[_0x5f9d('0x49')]=function(_0xc9a152,_0x414868){return db[_0x5f9d('0x2a')][_0x5f9d('0x45')]({'where':{'id':_0xc9a152['params']['id']}})['then'](handleEntityNotFound(_0x414868,null))[_0x5f9d('0x23')](removeEntity(_0x414868,null))[_0x5f9d('0x41')](handleError(_0x414868,null));};exports[_0x5f9d('0x4a')]=function(_0x101616,_0x97aac2){return db[_0x5f9d('0x2a')][_0x5f9d('0x4a')]()[_0x5f9d('0x23')](respondWithResult(_0x97aac2,null))[_0x5f9d('0x41')](handleError(_0x97aac2,null));}; \ No newline at end of file +var _0xa7e6=['json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','Cdr','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end'];(function(_0x1ff2ab,_0x408753){var _0x5eb193=function(_0x27d931){while(--_0x27d931){_0x1ff2ab['push'](_0x1ff2ab['shift']());}};_0x5eb193(++_0x408753);}(_0xa7e6,0x74));var _0x6a7e=function(_0x50e864,_0x4f9d5e){_0x50e864=_0x50e864-0x0;var _0x2b02c6=_0xa7e6[_0x50e864];return _0x2b02c6;};'use strict';var emlformat=require(_0x6a7e('0x0'));var rimraf=require(_0x6a7e('0x1'));var zipdir=require(_0x6a7e('0x2'));var jsonpatch=require(_0x6a7e('0x3'));var rp=require(_0x6a7e('0x4'));var moment=require(_0x6a7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6a7e('0x6'));var util=require(_0x6a7e('0x7'));var path=require(_0x6a7e('0x8'));var sox=require(_0x6a7e('0x9'));var csv=require(_0x6a7e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a7e('0xb'));var _=require(_0x6a7e('0xc'));var squel=require(_0x6a7e('0xd'));var crypto=require(_0x6a7e('0xe'));var jsforce=require(_0x6a7e('0xf'));var deskjs=require(_0x6a7e('0x10'));var toCsv=require(_0x6a7e('0xa'));var querystring=require(_0x6a7e('0x11'));var Papa=require(_0x6a7e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a7e('0x13'));var logger=require(_0x6a7e('0x14'))(_0x6a7e('0x15'));var utils=require(_0x6a7e('0x16'));var config=require(_0x6a7e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a7e('0x18'))['db'];function respondWithStatusCode(_0x4754ef,_0x5c0c74){_0x5c0c74=_0x5c0c74||0xcc;return function(_0x50dcc1){if(_0x50dcc1){return _0x4754ef[_0x6a7e('0x19')](_0x5c0c74);}return _0x4754ef[_0x6a7e('0x1a')](_0x5c0c74)[_0x6a7e('0x1b')]();};}function respondWithResult(_0x374763,_0x4faca9){_0x4faca9=_0x4faca9||0xc8;return function(_0x3137bc){if(_0x3137bc){return _0x374763[_0x6a7e('0x1a')](_0x4faca9)[_0x6a7e('0x1c')](_0x3137bc);}};}function respondWithFilteredResult(_0x4576fe,_0x465566){return function(_0x4b0893){if(_0x4b0893){var _0x16c9a5=typeof _0x465566['offset']==='undefined'&&typeof _0x465566[_0x6a7e('0x1d')]==='undefined';var _0x1d2abb=_0x4b0893[_0x6a7e('0x1e')];var _0x470197=_0x16c9a5?0x0:_0x465566[_0x6a7e('0x1f')];var _0x20e90a=_0x16c9a5?_0x4b0893['count']:_0x465566['offset']+_0x465566['limit'];var _0x102e83;if(_0x20e90a>=_0x1d2abb){_0x20e90a=_0x1d2abb;_0x102e83=0xc8;}else{_0x102e83=0xce;}_0x4576fe[_0x6a7e('0x1a')](_0x102e83);return _0x4576fe[_0x6a7e('0x20')](_0x6a7e('0x21'),_0x470197+'-'+_0x20e90a+'/'+_0x1d2abb)[_0x6a7e('0x1c')](_0x4b0893);}return null;};}function patchUpdates(_0x35b0ff){return function(_0x42eccc){try{jsonpatch[_0x6a7e('0x22')](_0x42eccc,_0x35b0ff,!![]);}catch(_0x5d5cbf){return BPromise[_0x6a7e('0x23')](_0x5d5cbf);}return _0x42eccc[_0x6a7e('0x24')]();};}function saveUpdates(_0x4f53c5,_0x3e1e64){return function(_0x3d0971){if(_0x3d0971){return _0x3d0971[_0x6a7e('0x25')](_0x4f53c5)['then'](function(_0x40c7f6){return _0x40c7f6;});}return null;};}function removeEntity(_0xd045ca,_0x4ee914){return function(_0x18f5e2){if(_0x18f5e2){return _0x18f5e2['destroy']()[_0x6a7e('0x26')](function(){_0xd045ca[_0x6a7e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29db13,_0x956eb6){return function(_0x46a15f){if(!_0x46a15f){_0x29db13[_0x6a7e('0x19')](0x194);}return _0x46a15f;};}function handleError(_0x3498c5,_0x380f2f){_0x380f2f=_0x380f2f||0x1f4;return function(_0x573bdc){logger[_0x6a7e('0x27')](_0x573bdc[_0x6a7e('0x28')]);if(_0x573bdc[_0x6a7e('0x29')]){delete _0x573bdc[_0x6a7e('0x29')];}_0x3498c5[_0x6a7e('0x1a')](_0x380f2f)['send'](_0x573bdc);};}exports['index']=function(_0x8b0439,_0x2e86f8){var _0x2723d0={},_0x525376={},_0xa324d0={'count':0x0,'rows':[]};var _0x57e642=_[_0x6a7e('0x2a')](db['Cdr']['rawAttributes'],function(_0x15c2b8){return{'name':_0x15c2b8['fieldName'],'type':_0x15c2b8[_0x6a7e('0x2b')]['key']};});_0x525376['model']=_[_0x6a7e('0x2a')](_0x57e642,_0x6a7e('0x29'));_0x525376[_0x6a7e('0x2c')]=_[_0x6a7e('0x2d')](_0x8b0439[_0x6a7e('0x2c')]);_0x525376[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],_0x525376[_0x6a7e('0x2c')]);_0x2723d0[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x525376[_0x6a7e('0x30')],qs['fields'](_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x32')]));_0x2723d0[_0x6a7e('0x31')]=_0x2723d0['attributes'][_0x6a7e('0x33')]?_0x2723d0[_0x6a7e('0x31')]:_0x525376[_0x6a7e('0x30')];if(!_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x34')](_0x6a7e('0x35'))){_0x2723d0['limit']=qs['limit'](_0x8b0439[_0x6a7e('0x2c')]['limit']);_0x2723d0[_0x6a7e('0x1f')]=qs[_0x6a7e('0x1f')](_0x8b0439['query']['offset']);}_0x2723d0['order']=qs[_0x6a7e('0x36')](_0x8b0439['query']['sort']);_0x2723d0['where']=qs['filters'](_[_0x6a7e('0x37')](_0x8b0439['query'],_0x525376[_0x6a7e('0x2e')]),_0x57e642);if(_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]){_0x2723d0[_0x6a7e('0x39')]=_[_0x6a7e('0x3a')](_0x2723d0['where'],{'$or':_[_0x6a7e('0x2a')](_0x57e642,function(_0x1db4e3){if(_0x1db4e3['type']!==_0x6a7e('0x3b')){var _0x2f58ac={};_0x2f58ac[_0x1db4e3['name']]={'$like':'%'+_0x8b0439[_0x6a7e('0x2c')][_0x6a7e('0x38')]+'%'};return _0x2f58ac;}})});}_0x2723d0=_[_0x6a7e('0x3a')]({},_0x2723d0,_0x8b0439[_0x6a7e('0x3c')]);var _0x2827f7={'where':_0x2723d0[_0x6a7e('0x39')]};return db[_0x6a7e('0x3d')][_0x6a7e('0x1e')](_0x2827f7)[_0x6a7e('0x26')](function(_0x27434a){_0xa324d0[_0x6a7e('0x1e')]=_0x27434a;if(_0x8b0439['query']['includeAll']){_0x2723d0[_0x6a7e('0x3e')]=[{'all':!![]}];}return db[_0x6a7e('0x3d')]['findAll'](_0x2723d0);})[_0x6a7e('0x26')](function(_0x46799d){_0xa324d0[_0x6a7e('0x3f')]=_0x46799d;return _0xa324d0;})[_0x6a7e('0x26')](respondWithFilteredResult(_0x2e86f8,_0x2723d0))[_0x6a7e('0x40')](handleError(_0x2e86f8,null));};exports[_0x6a7e('0x41')]=function(_0x3d7266,_0x14cae5){var _0x2a3d31={'raw':!![],'where':{'id':_0x3d7266[_0x6a7e('0x42')]['id']}},_0x247efb={};_0x247efb[_0x6a7e('0x30')]=_[_0x6a7e('0x2d')](db[_0x6a7e('0x3d')]['rawAttributes']);_0x247efb['query']=_[_0x6a7e('0x2d')](_0x3d7266[_0x6a7e('0x2c')]);_0x247efb[_0x6a7e('0x2e')]=_[_0x6a7e('0x2f')](_0x247efb[_0x6a7e('0x30')],_0x247efb[_0x6a7e('0x2c')]);_0x2a3d31[_0x6a7e('0x31')]=_[_0x6a7e('0x2f')](_0x247efb['model'],qs[_0x6a7e('0x32')](_0x3d7266['query'][_0x6a7e('0x32')]));_0x2a3d31[_0x6a7e('0x31')]=_0x2a3d31[_0x6a7e('0x31')][_0x6a7e('0x33')]?_0x2a3d31['attributes']:_0x247efb[_0x6a7e('0x30')];if(_0x3d7266[_0x6a7e('0x2c')][_0x6a7e('0x43')]){_0x2a3d31['include']=[{'all':!![]}];}_0x2a3d31=_[_0x6a7e('0x3a')]({},_0x2a3d31,_0x3d7266['options']);return db[_0x6a7e('0x3d')][_0x6a7e('0x44')](_0x2a3d31)[_0x6a7e('0x26')](handleEntityNotFound(_0x14cae5,null))[_0x6a7e('0x26')](respondWithResult(_0x14cae5,null))['catch'](handleError(_0x14cae5,null));};exports[_0x6a7e('0x45')]=function(_0x47369f,_0x188ab5){return db[_0x6a7e('0x3d')]['create'](_0x47369f[_0x6a7e('0x46')],{})['then'](respondWithResult(_0x188ab5,0xc9))[_0x6a7e('0x40')](handleError(_0x188ab5,null));};exports[_0x6a7e('0x25')]=function(_0x25c2bb,_0x4a7465){if(_0x25c2bb[_0x6a7e('0x46')]['id']){delete _0x25c2bb['body']['id'];}return db[_0x6a7e('0x3d')]['find']({'where':{'id':_0x25c2bb[_0x6a7e('0x42')]['id']}})[_0x6a7e('0x26')](handleEntityNotFound(_0x4a7465,null))[_0x6a7e('0x26')](saveUpdates(_0x25c2bb[_0x6a7e('0x46')],null))[_0x6a7e('0x26')](respondWithResult(_0x4a7465,null))[_0x6a7e('0x40')](handleError(_0x4a7465,null));};exports['destroy']=function(_0x3d4395,_0x54f72b){return db[_0x6a7e('0x3d')][_0x6a7e('0x44')]({'where':{'id':_0x3d4395['params']['id']}})['then'](handleEntityNotFound(_0x54f72b,null))[_0x6a7e('0x26')](removeEntity(_0x54f72b,null))[_0x6a7e('0x40')](handleError(_0x54f72b,null));};exports[_0x6a7e('0x47')]=function(_0x251076,_0x43f5ac){return db['Cdr'][_0x6a7e('0x47')]()[_0x6a7e('0x26')](respondWithResult(_0x43f5ac,null))[_0x6a7e('0x40')](handleError(_0x43f5ac,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 24ec8b6..df797a9 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x4566b8,_0x40a546){var _0xf73e97=function(_0x5d12ab){while(--_0x5d12ab){_0x4566b8['push'](_0x4566b8['shift']());}};_0xf73e97(++_0x40a546);}(_0x7a54,0x106));var _0x47a5=function(_0x245580,_0x102345){_0x245580=_0x245580-0x0;var _0x17c79a=_0x7a54[_0x245580];return _0x17c79a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2d89f2,_0x38564b){var _0x3ddad7=function(_0x16cf68){while(--_0x16cf68){_0x2d89f2['push'](_0x2d89f2['shift']());}};_0x3ddad7(++_0x38564b);}(_0x7a54,0x106));var _0x47a5=function(_0x57822c,_0x11e016){_0x57822c=_0x57822c-0x0;var _0x1e23f0=_0x7a54[_0x57822c];return _0x1e23f0;};'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 41eb0eb..2b9effa 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 _0xcad4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x542bd0,_0x56b265){var _0xaced4=function(_0x5db5c2){while(--_0x5db5c2){_0x542bd0['push'](_0x542bd0['shift']());}};_0xaced4(++_0x56b265);}(_0xcad4,0x1e9));var _0x4cad=function(_0x4878ad,_0xf2e815){_0x4878ad=_0x4878ad-0x0;var _0x12272f=_0xcad4[_0x4878ad];return _0x12272f;};'use strict';var _=require(_0x4cad('0x0'));var util=require(_0x4cad('0x1'));var moment=require(_0x4cad('0x2'));var BPromise=require(_0x4cad('0x3'));var rs=require(_0x4cad('0x4'));var fs=require('fs');var Redis=require(_0x4cad('0x5'));var db=require(_0x4cad('0x6'))['db'];var utils=require(_0x4cad('0x7'));var logger=require(_0x4cad('0x8'))(_0x4cad('0x9'));var config=require(_0x4cad('0xa'));var jayson=require(_0x4cad('0xb'));var client=jayson[_0x4cad('0xc')][_0x4cad('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x45206a,_0x11d320,_0x21e409){return new BPromise(function(_0x31e992,_0x1b2b76){return client[_0x4cad('0xe')](_0x45206a,_0x21e409)['then'](function(_0x2afcea){logger['info'](_0x4cad('0xf'),_0x11d320,'request\x20sent');logger[_0x4cad('0x10')](_0x4cad('0x11'),_0x11d320,_0x4cad('0x12'),JSON[_0x4cad('0x13')](_0x2afcea));if(_0x2afcea['error']){if(_0x2afcea[_0x4cad('0x14')][_0x4cad('0x15')]===0x1f4){logger[_0x4cad('0x14')]('Cdr,\x20%s,\x20%s',_0x11d320,_0x2afcea['error'][_0x4cad('0x16')]);return _0x1b2b76(_0x2afcea['error'][_0x4cad('0x16')]);}logger['error'](_0x4cad('0xf'),_0x11d320,_0x2afcea[_0x4cad('0x14')][_0x4cad('0x16')]);return _0x31e992(_0x2afcea[_0x4cad('0x14')][_0x4cad('0x16')]);}else{logger[_0x4cad('0x17')](_0x4cad('0xf'),_0x11d320,_0x4cad('0x12'));_0x31e992(_0x2afcea[_0x4cad('0x18')][_0x4cad('0x16')]);}})[_0x4cad('0x19')](function(_0x4e9208){logger[_0x4cad('0x14')](_0x4cad('0xf'),_0x11d320,_0x4e9208);_0x1b2b76(_0x4e9208);});});} \ No newline at end of file +var _0xc155=['util','moment','randomstring','ioredis','../../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','code','Cdr,\x20%s,\x20%s','message','result','catch'];(function(_0x3e1efb,_0x4967f3){var _0x2d6dea=function(_0x488769){while(--_0x488769){_0x3e1efb['push'](_0x3e1efb['shift']());}};_0x2d6dea(++_0x4967f3);}(_0xc155,0x96));var _0x5c15=function(_0xf7c58,_0x239e24){_0xf7c58=_0xf7c58-0x0;var _0x517c8c=_0xc155[_0xf7c58];return _0x517c8c;};'use strict';var _=require('lodash');var util=require(_0x5c15('0x0'));var moment=require(_0x5c15('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c15('0x2'));var fs=require('fs');var Redis=require(_0x5c15('0x3'));var db=require(_0x5c15('0x4'))['db'];var utils=require(_0x5c15('0x5'));var logger=require(_0x5c15('0x6'))(_0x5c15('0x7'));var config=require(_0x5c15('0x8'));var jayson=require(_0x5c15('0x9'));var client=jayson[_0x5c15('0xa')][_0x5c15('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x179949,_0x40ead9,_0x177ed3){return new BPromise(function(_0x3a5bb0,_0x439ae5){return client[_0x5c15('0xc')](_0x179949,_0x177ed3)[_0x5c15('0xd')](function(_0x363358){logger[_0x5c15('0xe')]('Cdr,\x20%s,\x20%s',_0x40ead9,_0x5c15('0xf'));logger[_0x5c15('0x10')](_0x5c15('0x11'),_0x40ead9,'request\x20sent',JSON[_0x5c15('0x12')](_0x363358));if(_0x363358[_0x5c15('0x13')]){if(_0x363358[_0x5c15('0x13')][_0x5c15('0x14')]===0x1f4){logger[_0x5c15('0x13')](_0x5c15('0x15'),_0x40ead9,_0x363358['error'][_0x5c15('0x16')]);return _0x439ae5(_0x363358[_0x5c15('0x13')][_0x5c15('0x16')]);}logger[_0x5c15('0x13')](_0x5c15('0x15'),_0x40ead9,_0x363358[_0x5c15('0x13')][_0x5c15('0x16')]);return _0x3a5bb0(_0x363358['error']['message']);}else{logger[_0x5c15('0xe')](_0x5c15('0x15'),_0x40ead9,_0x5c15('0xf'));_0x3a5bb0(_0x363358[_0x5c15('0x17')][_0x5c15('0x16')]);}})[_0x5c15('0x18')](function(_0x6c628f){logger[_0x5c15('0x13')](_0x5c15('0x15'),_0x40ead9,_0x6c628f);_0x439ae5(_0x6c628f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2dd6d6f..314213a 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x59482b,_0x17618d){var _0x1a55ef=function(_0x3ed593){while(--_0x3ed593){_0x59482b['push'](_0x59482b['shift']());}};_0x1a55ef(++_0x17618d);}(_0xb10b,0x12a));var _0xbb10=function(_0x39b352,_0x5db49d){_0x39b352=_0x39b352-0x0;var _0x4a39d3=_0xb10b[_0x39b352];return _0x4a39d3;};'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 29a064b..cf65674 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 _0x2804=['exports','TEXT','STRING','*,*,*,*'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x2804,0xe0));var _0x4280=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2804[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x4280('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4280('0x1')]()},'description':{'type':Sequelize[_0x4280('0x2')]},'interval':{'type':Sequelize[_0x4280('0x2')],'defaultValue':_0x4280('0x3')}}; \ No newline at end of file +var _0x744e=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0xa48618,_0x5afc11){var _0xf6f6a5=function(_0x26ae60){while(--_0x26ae60){_0xa48618['push'](_0xa48618['shift']());}};_0xf6f6a5(++_0x5afc11);}(_0x744e,0xe9));var _0xe744=function(_0x62de42,_0x5dd44f){_0x62de42=_0x62de42-0x0;var _0x5cf584=_0x744e[_0x62de42];return _0x5cf584;};'use strict';var Sequelize=require(_0xe744('0x0'));module[_0xe744('0x1')]={'priority':{'type':Sequelize[_0xe744('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe744('0x3')],'allowNull':![],'defaultValue':_0xe744('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xe744('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 63f7fa9..e393d94 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 _0xc2da=['includeAll','include','options','find','catch','body','params','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','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','limit','undefined','count','set','apply','reject','save','update','then','destroy','name','send','show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','model'];(function(_0x3d6d15,_0x32ac32){var _0x22e018=function(_0x291394){while(--_0x291394){_0x3d6d15['push'](_0x3d6d15['shift']());}};_0x22e018(++_0x32ac32);}(_0xc2da,0x124));var _0xac2d=function(_0x36176e,_0x3719b7){_0x36176e=_0x36176e-0x0;var _0xbe79bc=_0xc2da[_0x36176e];return _0xbe79bc;};'use strict';var emlformat=require(_0xac2d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac2d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac2d('0x2'));var moment=require('moment');var BPromise=require(_0xac2d('0x3'));var Mustache=require(_0xac2d('0x4'));var util=require(_0xac2d('0x5'));var path=require(_0xac2d('0x6'));var sox=require(_0xac2d('0x7'));var csv=require(_0xac2d('0x8'));var ejs=require(_0xac2d('0x9'));var fs=require('fs');var fs_extra=require(_0xac2d('0xa'));var _=require(_0xac2d('0xb'));var squel=require(_0xac2d('0xc'));var crypto=require(_0xac2d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac2d('0x8'));var querystring=require('querystring');var Papa=require(_0xac2d('0xe'));var Redis=require(_0xac2d('0xf'));var authService=require(_0xac2d('0x10'));var qs=require(_0xac2d('0x11'));var as=require(_0xac2d('0x12'));var hardwareService=require(_0xac2d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xac2d('0x14'));var config=require(_0xac2d('0x15'));var licenseUtil=require(_0xac2d('0x16'));var db=require(_0xac2d('0x17'))['db'];function respondWithStatusCode(_0x4b9e88,_0x21aa1b){_0x21aa1b=_0x21aa1b||0xcc;return function(_0x20fa0d){if(_0x20fa0d){return _0x4b9e88[_0xac2d('0x18')](_0x21aa1b);}return _0x4b9e88[_0xac2d('0x19')](_0x21aa1b)[_0xac2d('0x1a')]();};}function respondWithResult(_0x2bed84,_0x284984){_0x284984=_0x284984||0xc8;return function(_0x897641){if(_0x897641){return _0x2bed84[_0xac2d('0x19')](_0x284984)[_0xac2d('0x1b')](_0x897641);}};}function respondWithFilteredResult(_0x11a3aa,_0x33d014){return function(_0x74853a){if(_0x74853a){var _0x2d92b5=typeof _0x33d014[_0xac2d('0x1c')]==='undefined'&&typeof _0x33d014[_0xac2d('0x1d')]===_0xac2d('0x1e');var _0x50ac65=_0x74853a[_0xac2d('0x1f')];var _0xed956b=_0x2d92b5?0x0:_0x33d014[_0xac2d('0x1c')];var _0x4d34fa=_0x2d92b5?_0x74853a[_0xac2d('0x1f')]:_0x33d014['offset']+_0x33d014[_0xac2d('0x1d')];var _0x3651e6;if(_0x4d34fa>=_0x50ac65){_0x4d34fa=_0x50ac65;_0x3651e6=0xc8;}else{_0x3651e6=0xce;}_0x11a3aa['status'](_0x3651e6);return _0x11a3aa[_0xac2d('0x20')]('Content-Range',_0xed956b+'-'+_0x4d34fa+'/'+_0x50ac65)['json'](_0x74853a);}return null;};}function patchUpdates(_0x510e85){return function(_0x5eaaef){try{jsonpatch[_0xac2d('0x21')](_0x5eaaef,_0x510e85,!![]);}catch(_0x21c407){return BPromise[_0xac2d('0x22')](_0x21c407);}return _0x5eaaef[_0xac2d('0x23')]();};}function saveUpdates(_0x211d26,_0x391911){return function(_0x3454ea){if(_0x3454ea){return _0x3454ea[_0xac2d('0x24')](_0x211d26)[_0xac2d('0x25')](function(_0x3f1212){return _0x3f1212;});}return null;};}function removeEntity(_0xafa502,_0x226b6b){return function(_0x1df55b){if(_0x1df55b){return _0x1df55b[_0xac2d('0x26')]()[_0xac2d('0x25')](function(){_0xafa502[_0xac2d('0x19')](0xcc)[_0xac2d('0x1a')]();});}};}function handleEntityNotFound(_0x10da1d,_0x271e47){return function(_0x5f00a0){if(!_0x5f00a0){_0x10da1d[_0xac2d('0x18')](0x194);}return _0x5f00a0;};}function handleError(_0x38cad3,_0x337228){_0x337228=_0x337228||0x1f4;return function(_0x2323c8){logger['error'](_0x2323c8['stack']);if(_0x2323c8[_0xac2d('0x27')]){delete _0x2323c8[_0xac2d('0x27')];}_0x38cad3[_0xac2d('0x19')](_0x337228)[_0xac2d('0x28')](_0x2323c8);};}exports[_0xac2d('0x29')]=function(_0x2906ac,_0x104af8){var _0x42aa82={'raw':!![],'where':{'id':_0x2906ac['params']['id']}},_0x2ac875={};_0x2ac875['model']=_[_0xac2d('0x2a')](db[_0xac2d('0x2b')][_0xac2d('0x2c')]);_0x2ac875[_0xac2d('0x2d')]=_[_0xac2d('0x2a')](_0x2906ac['query']);_0x2ac875[_0xac2d('0x2e')]=_[_0xac2d('0x2f')](_0x2ac875['model'],_0x2ac875[_0xac2d('0x2d')]);_0x42aa82[_0xac2d('0x30')]=_[_0xac2d('0x2f')](_0x2ac875[_0xac2d('0x31')],qs['fields'](_0x2906ac[_0xac2d('0x2d')]['fields']));_0x42aa82[_0xac2d('0x30')]=_0x42aa82[_0xac2d('0x30')]['length']?_0x42aa82[_0xac2d('0x30')]:_0x2ac875[_0xac2d('0x31')];if(_0x2906ac[_0xac2d('0x2d')][_0xac2d('0x32')]){_0x42aa82[_0xac2d('0x33')]=[{'all':!![]}];}_0x42aa82=_['merge']({},_0x42aa82,_0x2906ac[_0xac2d('0x34')]);return db['ChatApplication'][_0xac2d('0x35')](_0x42aa82)['then'](handleEntityNotFound(_0x104af8,null))[_0xac2d('0x25')](respondWithResult(_0x104af8,null))[_0xac2d('0x36')](handleError(_0x104af8,null));};exports['update']=function(_0x5bd1e3,_0x3cf4d5){if(_0x5bd1e3[_0xac2d('0x37')]['id']){delete _0x5bd1e3[_0xac2d('0x37')]['id'];}return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x5bd1e3[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x3cf4d5,null))['then'](saveUpdates(_0x5bd1e3[_0xac2d('0x37')],null))[_0xac2d('0x25')](respondWithResult(_0x3cf4d5,null))[_0xac2d('0x36')](handleError(_0x3cf4d5,null));};exports[_0xac2d('0x26')]=function(_0x2d90c2,_0x4eb307){return db[_0xac2d('0x2b')][_0xac2d('0x35')]({'where':{'id':_0x2d90c2[_0xac2d('0x38')]['id']}})[_0xac2d('0x25')](handleEntityNotFound(_0x4eb307,null))[_0xac2d('0x25')](removeEntity(_0x4eb307,null))[_0xac2d('0x36')](handleError(_0x4eb307,null));}; \ No newline at end of file +var _0x4058=['include','options','find','catch','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','sendStatus','error','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x4058,0x129));var _0x8405=function(_0x33a61e,_0x159e28){_0x33a61e=_0x33a61e-0x0;var _0xc6a2e3=_0x4058[_0x33a61e];return _0xc6a2e3;};'use strict';var emlformat=require(_0x8405('0x0'));var rimraf=require(_0x8405('0x1'));var zipdir=require(_0x8405('0x2'));var jsonpatch=require(_0x8405('0x3'));var rp=require(_0x8405('0x4'));var moment=require(_0x8405('0x5'));var BPromise=require(_0x8405('0x6'));var Mustache=require(_0x8405('0x7'));var util=require(_0x8405('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8405('0x9'));var fs=require('fs');var fs_extra=require(_0x8405('0xa'));var _=require(_0x8405('0xb'));var squel=require(_0x8405('0xc'));var crypto=require(_0x8405('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8405('0xe'));var toCsv=require(_0x8405('0xf'));var querystring=require(_0x8405('0x10'));var Papa=require('papaparse');var Redis=require(_0x8405('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8405('0x12'));var as=require(_0x8405('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8405('0x14'))(_0x8405('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x262d32,_0x575fcb){_0x575fcb=_0x575fcb||0xcc;return function(_0x495190){if(_0x495190){return _0x262d32['sendStatus'](_0x575fcb);}return _0x262d32['status'](_0x575fcb)['end']();};}function respondWithResult(_0x1321d3,_0x238633){_0x238633=_0x238633||0xc8;return function(_0x5a3776){if(_0x5a3776){return _0x1321d3[_0x8405('0x16')](_0x238633)[_0x8405('0x17')](_0x5a3776);}};}function respondWithFilteredResult(_0x221cf8,_0x422822){return function(_0x58eb66){if(_0x58eb66){var _0x218fe7=typeof _0x422822[_0x8405('0x18')]===_0x8405('0x19')&&typeof _0x422822[_0x8405('0x1a')]===_0x8405('0x19');var _0x15a189=_0x58eb66[_0x8405('0x1b')];var _0x358633=_0x218fe7?0x0:_0x422822[_0x8405('0x18')];var _0x1e608f=_0x218fe7?_0x58eb66[_0x8405('0x1b')]:_0x422822[_0x8405('0x18')]+_0x422822[_0x8405('0x1a')];var _0x241000;if(_0x1e608f>=_0x15a189){_0x1e608f=_0x15a189;_0x241000=0xc8;}else{_0x241000=0xce;}_0x221cf8[_0x8405('0x16')](_0x241000);return _0x221cf8[_0x8405('0x1c')](_0x8405('0x1d'),_0x358633+'-'+_0x1e608f+'/'+_0x15a189)[_0x8405('0x17')](_0x58eb66);}return null;};}function patchUpdates(_0x2483ab){return function(_0x1f42e5){try{jsonpatch[_0x8405('0x1e')](_0x1f42e5,_0x2483ab,!![]);}catch(_0x3d5271){return BPromise[_0x8405('0x1f')](_0x3d5271);}return _0x1f42e5[_0x8405('0x20')]();};}function saveUpdates(_0x1ceff7,_0x1e8d08){return function(_0x57130a){if(_0x57130a){return _0x57130a['update'](_0x1ceff7)[_0x8405('0x21')](function(_0x2e021a){return _0x2e021a;});}return null;};}function removeEntity(_0x14436a,_0x4b1c6b){return function(_0x5e3849){if(_0x5e3849){return _0x5e3849['destroy']()[_0x8405('0x21')](function(){_0x14436a['status'](0xcc)[_0x8405('0x22')]();});}};}function handleEntityNotFound(_0x162c03,_0x2a6c7b){return function(_0x4450eb){if(!_0x4450eb){_0x162c03[_0x8405('0x23')](0x194);}return _0x4450eb;};}function handleError(_0x3e5b4c,_0x102b85){_0x102b85=_0x102b85||0x1f4;return function(_0x178ef6){logger[_0x8405('0x24')](_0x178ef6[_0x8405('0x25')]);if(_0x178ef6[_0x8405('0x26')]){delete _0x178ef6[_0x8405('0x26')];}_0x3e5b4c['status'](_0x102b85)[_0x8405('0x27')](_0x178ef6);};}exports['show']=function(_0x48a425,_0xc7df7){var _0x41f06a={'raw':!![],'where':{'id':_0x48a425[_0x8405('0x28')]['id']}},_0x3022cc={};_0x3022cc[_0x8405('0x29')]=_[_0x8405('0x2a')](db[_0x8405('0x2b')][_0x8405('0x2c')]);_0x3022cc[_0x8405('0x2d')]=_[_0x8405('0x2a')](_0x48a425[_0x8405('0x2d')]);_0x3022cc[_0x8405('0x2e')]=_[_0x8405('0x2f')](_0x3022cc['model'],_0x3022cc[_0x8405('0x2d')]);_0x41f06a[_0x8405('0x30')]=_['intersection'](_0x3022cc[_0x8405('0x29')],qs[_0x8405('0x31')](_0x48a425[_0x8405('0x2d')]['fields']));_0x41f06a[_0x8405('0x30')]=_0x41f06a[_0x8405('0x30')][_0x8405('0x32')]?_0x41f06a['attributes']:_0x3022cc[_0x8405('0x29')];if(_0x48a425[_0x8405('0x2d')]['includeAll']){_0x41f06a[_0x8405('0x33')]=[{'all':!![]}];}_0x41f06a=_['merge']({},_0x41f06a,_0x48a425[_0x8405('0x34')]);return db[_0x8405('0x2b')][_0x8405('0x35')](_0x41f06a)[_0x8405('0x21')](handleEntityNotFound(_0xc7df7,null))[_0x8405('0x21')](respondWithResult(_0xc7df7,null))[_0x8405('0x36')](handleError(_0xc7df7,null));};exports[_0x8405('0x37')]=function(_0xf11ce,_0x1ae1c4){if(_0xf11ce[_0x8405('0x38')]['id']){delete _0xf11ce[_0x8405('0x38')]['id'];}return db[_0x8405('0x2b')]['find']({'where':{'id':_0xf11ce[_0x8405('0x28')]['id']}})['then'](handleEntityNotFound(_0x1ae1c4,null))['then'](saveUpdates(_0xf11ce[_0x8405('0x38')],null))[_0x8405('0x21')](respondWithResult(_0x1ae1c4,null))['catch'](handleError(_0x1ae1c4,null));};exports[_0x8405('0x39')]=function(_0x4349d2,_0x13ad1e){return db[_0x8405('0x2b')][_0x8405('0x35')]({'where':{'id':_0x4349d2['params']['id']}})[_0x8405('0x21')](handleEntityNotFound(_0x13ad1e,null))[_0x8405('0x21')](removeEntity(_0x13ad1e,null))[_0x8405('0x36')](handleError(_0x13ad1e,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 19fc499..8c3e986 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 _0x271d=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci'];(function(_0x143e19,_0x184769){var _0xa7b25d=function(_0x2a7711){while(--_0x2a7711){_0x143e19['push'](_0x143e19['shift']());}};_0xa7b25d(++_0x184769);}(_0x271d,0xc4));var _0xd271=function(_0x4b7e2a,_0x27893d){_0x4b7e2a=_0x4b7e2a-0x0;var _0x5d49a3=_0x271d[_0x4b7e2a];return _0x5d49a3;};'use strict';var _=require(_0xd271('0x0'));var util=require(_0xd271('0x1'));var logger=require('../../config/logger')(_0xd271('0x2'));var moment=require('moment');var BPromise=require(_0xd271('0x3'));var rp=require(_0xd271('0x4'));var fs=require('fs');var path=require(_0xd271('0x5'));var rimraf=require(_0xd271('0x6'));var config=require(_0xd271('0x7'));var attributes=require(_0xd271('0x8'));module[_0xd271('0x9')]=function(_0x3a1c19,_0xdcd18c){return _0x3a1c19[_0xd271('0xa')](_0xd271('0xb'),attributes,{'tableName':_0xd271('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd271('0xd')});}; \ No newline at end of file +var _0xd382=['define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd382,0x1b6));var _0x2d38=function(_0x40d492,_0x14daf5){_0x40d492=_0x40d492-0x0;var _0x11c1af=_0xd382[_0x40d492];return _0x11c1af;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var logger=require(_0x2d38('0x2'))(_0x2d38('0x3'));var moment=require(_0x2d38('0x4'));var BPromise=require(_0x2d38('0x5'));var rp=require(_0x2d38('0x6'));var fs=require('fs');var path=require(_0x2d38('0x7'));var rimraf=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x5a8219,_0x30106c){return _0x5a8219[_0x2d38('0xa')]('ChatApplication',attributes,{'tableName':_0x2d38('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2d38('0xc'),'collate':_0x2d38('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 5d8ec6a..d4eda03 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 _0x412c=['error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x22608c,_0x20fac7){var _0xf01d6d=function(_0x31ffbc){while(--_0x31ffbc){_0x22608c['push'](_0x22608c['shift']());}};_0xf01d6d(++_0x20fac7);}(_0x412c,0x155));var _0xc412=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x412c[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xc412('0x0'));var util=require(_0xc412('0x1'));var moment=require(_0xc412('0x2'));var BPromise=require(_0xc412('0x3'));var rs=require(_0xc412('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc412('0x5'))(_0xc412('0x6'));var config=require(_0xc412('0x7'));var jayson=require(_0xc412('0x8'));var client=jayson[_0xc412('0x9')][_0xc412('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5699d9,_0x1f1249,_0x1841fc){return new BPromise(function(_0x347598,_0x32cf6a){return client['request'](_0x5699d9,_0x1841fc)['then'](function(_0x41071c){logger['info'](_0xc412('0xb'),_0x1f1249,_0xc412('0xc'));logger[_0xc412('0xd')](_0xc412('0xe'),_0x1f1249,_0xc412('0xc'),JSON[_0xc412('0xf')](_0x41071c));if(_0x41071c[_0xc412('0x10')]){if(_0x41071c[_0xc412('0x10')][_0xc412('0x11')]===0x1f4){logger[_0xc412('0x10')]('ChatApplication,\x20%s,\x20%s',_0x1f1249,_0x41071c['error']['message']);return _0x32cf6a(_0x41071c['error']['message']);}logger[_0xc412('0x10')](_0xc412('0xb'),_0x1f1249,_0x41071c[_0xc412('0x10')][_0xc412('0x12')]);return _0x347598(_0x41071c['error'][_0xc412('0x12')]);}else{logger[_0xc412('0x13')]('ChatApplication,\x20%s,\x20%s',_0x1f1249,_0xc412('0xc'));_0x347598(_0x41071c['result'][_0xc412('0x12')]);}})[_0xc412('0x14')](function(_0x577fed){logger[_0xc412('0x10')](_0xc412('0xb'),_0x1f1249,_0x577fed);_0x32cf6a(_0x577fed);});});} \ No newline at end of file +var _0xf04d=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','catch','lodash'];(function(_0x3687b2,_0x3f6dbb){var _0x566378=function(_0x1326ff){while(--_0x1326ff){_0x3687b2['push'](_0x3687b2['shift']());}};_0x566378(++_0x3f6dbb);}(_0xf04d,0x1af));var _0xdf04=function(_0x1265ed,_0x4b85e8){_0x1265ed=_0x1265ed-0x0;var _0x5ac459=_0xf04d[_0x1265ed];return _0x5ac459;};'use strict';var _=require(_0xdf04('0x0'));var util=require(_0xdf04('0x1'));var moment=require(_0xdf04('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf04('0x3'));var fs=require('fs');var Redis=require(_0xdf04('0x4'));var db=require(_0xdf04('0x5'))['db'];var utils=require(_0xdf04('0x6'));var logger=require(_0xdf04('0x7'))(_0xdf04('0x8'));var config=require(_0xdf04('0x9'));var jayson=require(_0xdf04('0xa'));var client=jayson[_0xdf04('0xb')][_0xdf04('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2734c5,_0x48f271,_0x344057){return new BPromise(function(_0xde2a8d,_0xcf6cb1){return client['request'](_0x2734c5,_0x344057)[_0xdf04('0xd')](function(_0x30afd8){logger['info']('ChatApplication,\x20%s,\x20%s',_0x48f271,_0xdf04('0xe'));logger[_0xdf04('0xf')](_0xdf04('0x10'),_0x48f271,_0xdf04('0xe'),JSON[_0xdf04('0x11')](_0x30afd8));if(_0x30afd8[_0xdf04('0x12')]){if(_0x30afd8[_0xdf04('0x12')][_0xdf04('0x13')]===0x1f4){logger['error'](_0xdf04('0x14'),_0x48f271,_0x30afd8['error'][_0xdf04('0x15')]);return _0xcf6cb1(_0x30afd8['error'][_0xdf04('0x15')]);}logger[_0xdf04('0x12')](_0xdf04('0x14'),_0x48f271,_0x30afd8[_0xdf04('0x12')][_0xdf04('0x15')]);return _0xde2a8d(_0x30afd8[_0xdf04('0x12')][_0xdf04('0x15')]);}else{logger[_0xdf04('0x16')](_0xdf04('0x14'),_0x48f271,_0xdf04('0xe'));_0xde2a8d(_0x30afd8['result']['message']);}})[_0xdf04('0x17')](function(_0x4c1ab0){logger[_0xdf04('0x12')](_0xdf04('0x14'),_0x48f271,_0x4c1ab0);_0xcf6cb1(_0x4c1ab0);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a8acb3a..5ed3b42 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 _0x1dd3=['update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show'];(function(_0x370597,_0x39eaf2){var _0x3e5ca2=function(_0x1e1d7b){while(--_0x1e1d7b){_0x370597['push'](_0x370597['shift']());}};_0x3e5ca2(++_0x39eaf2);}(_0x1dd3,0x1be));var _0x31dd=function(_0x19103c,_0x4c6c0d){_0x19103c=_0x19103c-0x0;var _0x371d15=_0x1dd3[_0x19103c];return _0x371d15;};'use strict';var multer=require('multer');var util=require(_0x31dd('0x0'));var path=require(_0x31dd('0x1'));var timeout=require('connect-timeout');var express=require(_0x31dd('0x2'));var router=express['Router']();var fs_extra=require(_0x31dd('0x3'));var auth=require(_0x31dd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0x31dd('0x5')](_0x31dd('0x6'),auth[_0x31dd('0x7')](),controller[_0x31dd('0x8')]);router['put'](_0x31dd('0x6'),auth[_0x31dd('0x7')](),controller[_0x31dd('0x9')]);router[_0x31dd('0xa')]('/:id',auth[_0x31dd('0x7')](),controller[_0x31dd('0xb')]);module[_0x31dd('0xc')]=router; \ No newline at end of file +var _0x6f18=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','put','isAuthenticated','delete','/:id','exports'];(function(_0x505778,_0x2d8471){var _0x1ab8d9=function(_0xed05ea){while(--_0xed05ea){_0x505778['push'](_0x505778['shift']());}};_0x1ab8d9(++_0x2d8471);}(_0x6f18,0x16c));var _0x86f1=function(_0x189548,_0x30ada7){_0x189548=_0x189548-0x0;var _0x261850=_0x6f18[_0x189548];return _0x261850;};'use strict';var multer=require('multer');var util=require(_0x86f1('0x0'));var path=require(_0x86f1('0x1'));var timeout=require('connect-timeout');var express=require(_0x86f1('0x2'));var router=express[_0x86f1('0x3')]();var fs_extra=require(_0x86f1('0x4'));var auth=require(_0x86f1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86f1('0x6'));var controller=require(_0x86f1('0x7'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x86f1('0x8')]('/:id',auth[_0x86f1('0x9')](),controller['update']);router[_0x86f1('0xa')](_0x86f1('0xb'),auth[_0x86f1('0x9')](),controller['destroy']);module[_0x86f1('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 551d07f..ad7dff9 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 _0x4e09=['BOOLEAN','exports','STRING'];(function(_0x13a35a,_0x325d54){var _0x316fac=function(_0x5aa93f){while(--_0x5aa93f){_0x13a35a['push'](_0x13a35a['shift']());}};_0x316fac(++_0x325d54);}(_0x4e09,0x166));var _0x94e0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4e09[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require('sequelize');module[_0x94e0('0x0')]={'name':{'type':Sequelize[_0x94e0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x94e0('0x1')]},'write':{'type':Sequelize[_0x94e0('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x40b7=['STRING','BOOLEAN','sequelize','exports'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x40b7,0x1e2));var _0x740b=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x40b7[_0x1cb18a];return _0x22442e;};'use strict';var Sequelize=require(_0x740b('0x0'));module[_0x740b('0x1')]={'name':{'type':Sequelize[_0x740b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x740b('0x2')]},'write':{'type':Sequelize[_0x740b('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index db6c6ce..eef2076 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 _0xca0a=['desk.js','to-csv','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','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','reject','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','attributes','intersection','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','getUnread','user','toInteger','addMembers','ids','findOne','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','ChatInternalMessage','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x16c301,_0x3c7c43){var _0x1a2c5a=function(_0xb8f3b9){while(--_0xb8f3b9){_0x16c301['push'](_0x16c301['shift']());}};_0x1a2c5a(++_0x3c7c43);}(_0xca0a,0xb8));var _0xaca0=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0xca0a[_0x2f1762];return _0x8ab21;};'use strict';var emlformat=require(_0xaca0('0x0'));var rimraf=require(_0xaca0('0x1'));var zipdir=require(_0xaca0('0x2'));var jsonpatch=require(_0xaca0('0x3'));var rp=require(_0xaca0('0x4'));var moment=require('moment');var BPromise=require(_0xaca0('0x5'));var Mustache=require('mustache');var util=require(_0xaca0('0x6'));var path=require(_0xaca0('0x7'));var sox=require(_0xaca0('0x8'));var csv=require('to-csv');var ejs=require(_0xaca0('0x9'));var fs=require('fs');var fs_extra=require(_0xaca0('0xa'));var _=require(_0xaca0('0xb'));var squel=require('squel');var crypto=require(_0xaca0('0xc'));var jsforce=require(_0xaca0('0xd'));var deskjs=require(_0xaca0('0xe'));var toCsv=require(_0xaca0('0xf'));var querystring=require('querystring');var Papa=require(_0xaca0('0x10'));var Redis=require(_0xaca0('0x11'));var authService=require(_0xaca0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaca0('0x13'));var hardwareService=require(_0xaca0('0x14'));var logger=require(_0xaca0('0x15'))(_0xaca0('0x16'));var utils=require(_0xaca0('0x17'));var config=require(_0xaca0('0x18'));var licenseUtil=require(_0xaca0('0x19'));var db=require(_0xaca0('0x1a'))['db'];config[_0xaca0('0x1b')]=_[_0xaca0('0x1c')](config['redis'],{'host':_0xaca0('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xaca0('0x1e'))[_0xaca0('0x1f')](socket);function respondWithStatusCode(_0x59fb58,_0x34eca9){_0x34eca9=_0x34eca9||0xcc;return function(_0x24a38c){if(_0x24a38c){return _0x59fb58[_0xaca0('0x20')](_0x34eca9);}return _0x59fb58[_0xaca0('0x21')](_0x34eca9)[_0xaca0('0x22')]();};}function respondWithResult(_0xe0a568,_0x3bd12f){_0x3bd12f=_0x3bd12f||0xc8;return function(_0x377ed9){if(_0x377ed9){return _0xe0a568[_0xaca0('0x21')](_0x3bd12f)[_0xaca0('0x23')](_0x377ed9);}};}function respondWithFilteredResult(_0x8735de,_0x3750e0){return function(_0x33f19a){if(_0x33f19a){var _0x4bde98=typeof _0x3750e0[_0xaca0('0x24')]==='undefined'&&typeof _0x3750e0[_0xaca0('0x25')]===_0xaca0('0x26');var _0xa2a4a3=_0x33f19a[_0xaca0('0x27')];var _0x31b7c5=_0x4bde98?0x0:_0x3750e0[_0xaca0('0x24')];var _0x29e9fd=_0x4bde98?_0x33f19a[_0xaca0('0x27')]:_0x3750e0[_0xaca0('0x24')]+_0x3750e0[_0xaca0('0x25')];var _0x3b6276;if(_0x29e9fd>=_0xa2a4a3){_0x29e9fd=_0xa2a4a3;_0x3b6276=0xc8;}else{_0x3b6276=0xce;}_0x8735de[_0xaca0('0x21')](_0x3b6276);return _0x8735de['set']('Content-Range',_0x31b7c5+'-'+_0x29e9fd+'/'+_0xa2a4a3)[_0xaca0('0x23')](_0x33f19a);}return null;};}function patchUpdates(_0x53c475){return function(_0x3190ec){try{jsonpatch['apply'](_0x3190ec,_0x53c475,!![]);}catch(_0x7caaa2){return BPromise[_0xaca0('0x28')](_0x7caaa2);}return _0x3190ec['save']();};}function saveUpdates(_0x4ade65,_0xd12241){return function(_0x256f6f){if(_0x256f6f){return _0x256f6f['update'](_0x4ade65)[_0xaca0('0x29')](function(_0x5ec0e7){return _0x5ec0e7;});}return null;};}function removeEntity(_0x311b48,_0x3abf00){return function(_0x4b35ba){if(_0x4b35ba){return _0x4b35ba[_0xaca0('0x2a')]()[_0xaca0('0x29')](function(){_0x311b48[_0xaca0('0x21')](0xcc)[_0xaca0('0x22')]();});}};}function handleEntityNotFound(_0x399202,_0x36c0ed){return function(_0x17b49b){if(!_0x17b49b){_0x399202['sendStatus'](0x194);}return _0x17b49b;};}function handleError(_0x5370c5,_0x450362){_0x450362=_0x450362||0x1f4;return function(_0x11d27b){logger[_0xaca0('0x2b')](_0x11d27b[_0xaca0('0x2c')]);if(_0x11d27b['name']){delete _0x11d27b[_0xaca0('0x2d')];}_0x5370c5[_0xaca0('0x21')](_0x450362)[_0xaca0('0x2e')](_0x11d27b);};}exports[_0xaca0('0x2f')]=function(_0x5b1ecc,_0x250432){var _0xf815e3={},_0x2f68cb={},_0x5d2183={'count':0x0,'rows':[]};var _0x1cdff3=_[_0xaca0('0x30')](db[_0xaca0('0x31')][_0xaca0('0x32')],function(_0x3e07c8){return{'name':_0x3e07c8[_0xaca0('0x33')],'type':_0x3e07c8[_0xaca0('0x34')][_0xaca0('0x35')]};});_0x2f68cb['model']=_[_0xaca0('0x30')](_0x1cdff3,_0xaca0('0x2d'));_0x2f68cb[_0xaca0('0x36')]=_[_0xaca0('0x37')](_0x5b1ecc[_0xaca0('0x36')]);_0x2f68cb['filters']=_['intersection'](_0x2f68cb['model'],_0x2f68cb[_0xaca0('0x36')]);_0xf815e3[_0xaca0('0x38')]=_[_0xaca0('0x39')](_0x2f68cb[_0xaca0('0x3a')],qs[_0xaca0('0x3b')](_0x5b1ecc['query'][_0xaca0('0x3b')]));_0xf815e3[_0xaca0('0x38')]=_0xf815e3[_0xaca0('0x38')][_0xaca0('0x3c')]?_0xf815e3['attributes']:_0x2f68cb[_0xaca0('0x3a')];if(!_0x5b1ecc['query']['hasOwnProperty'](_0xaca0('0x3d'))){_0xf815e3[_0xaca0('0x25')]=qs[_0xaca0('0x25')](_0x5b1ecc['query']['limit']);_0xf815e3[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x5b1ecc[_0xaca0('0x36')][_0xaca0('0x24')]);}_0xf815e3[_0xaca0('0x3e')]=qs['sort'](_0x5b1ecc[_0xaca0('0x36')][_0xaca0('0x3f')]);_0xf815e3[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x5b1ecc['query'],_0x2f68cb[_0xaca0('0x41')]),_0x1cdff3);if(_0x5b1ecc['query'][_0xaca0('0x43')]){_0xf815e3[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0xf815e3[_0xaca0('0x40')],{'$or':_[_0xaca0('0x30')](_0x1cdff3,function(_0x14c79e){if(_0x14c79e[_0xaca0('0x34')]!==_0xaca0('0x45')){var _0x222a49={};_0x222a49[_0x14c79e['name']]={'$like':'%'+_0x5b1ecc['query']['filter']+'%'};return _0x222a49;}})});}_0xf815e3=_[_0xaca0('0x44')]({},_0xf815e3,_0x5b1ecc[_0xaca0('0x46')]);var _0x370872={'where':_0xf815e3['where']};return db[_0xaca0('0x31')]['count'](_0x370872)[_0xaca0('0x29')](function(_0x56db2b){_0x5d2183[_0xaca0('0x27')]=_0x56db2b;if(_0x5b1ecc['query']['includeAll']){_0xf815e3[_0xaca0('0x47')]=[{'all':!![]}];}return db[_0xaca0('0x31')][_0xaca0('0x48')](_0xf815e3);})[_0xaca0('0x29')](function(_0x392c38){_0x5d2183[_0xaca0('0x49')]=_0x392c38;return _0x5d2183;})[_0xaca0('0x29')](respondWithFilteredResult(_0x250432,_0xf815e3))['catch'](handleError(_0x250432,null));};exports[_0xaca0('0x4a')]=function(_0x4dd086,_0xa4b07){var _0x2a6bc6={'raw':!![],'where':{'id':_0x4dd086[_0xaca0('0x4b')]['id']}},_0x593fc5={};_0x593fc5[_0xaca0('0x3a')]=_['keys'](db[_0xaca0('0x31')][_0xaca0('0x32')]);_0x593fc5[_0xaca0('0x36')]=_[_0xaca0('0x37')](_0x4dd086[_0xaca0('0x36')]);_0x593fc5[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x593fc5[_0xaca0('0x3a')],_0x593fc5[_0xaca0('0x36')]);_0x2a6bc6['attributes']=_[_0xaca0('0x39')](_0x593fc5['model'],qs[_0xaca0('0x3b')](_0x4dd086['query']['fields']));_0x2a6bc6[_0xaca0('0x38')]=_0x2a6bc6[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x2a6bc6[_0xaca0('0x38')]:_0x593fc5[_0xaca0('0x3a')];if(_0x4dd086['query'][_0xaca0('0x4c')]){_0x2a6bc6[_0xaca0('0x47')]=[{'all':!![]}];}_0x2a6bc6=_[_0xaca0('0x44')]({},_0x2a6bc6,_0x4dd086['options']);return db['ChatGroup'][_0xaca0('0x4d')](_0x2a6bc6)[_0xaca0('0x29')](handleEntityNotFound(_0xa4b07,null))['then'](respondWithResult(_0xa4b07,null))[_0xaca0('0x4e')](handleError(_0xa4b07,null));};exports[_0xaca0('0x4f')]=function(_0x2e3885,_0x16f012){return db[_0xaca0('0x31')][_0xaca0('0x4f')](_0x2e3885['body'],{})[_0xaca0('0x29')](respondWithResult(_0x16f012,0xc9))[_0xaca0('0x4e')](handleError(_0x16f012,null));};exports['update']=function(_0x5856aa,_0x57637){if(_0x5856aa[_0xaca0('0x50')]['id']){delete _0x5856aa[_0xaca0('0x50')]['id'];}return db[_0xaca0('0x31')][_0xaca0('0x4d')]({'where':{'id':_0x5856aa[_0xaca0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57637,null))[_0xaca0('0x29')](saveUpdates(_0x5856aa[_0xaca0('0x50')],null))[_0xaca0('0x29')](respondWithResult(_0x57637,null))['catch'](handleError(_0x57637,null));};exports[_0xaca0('0x2a')]=function(_0x666f06,_0x191a69){return db['ChatGroup'][_0xaca0('0x4d')]({'where':{'id':_0x666f06['params']['id']}})['then'](handleEntityNotFound(_0x191a69,null))[_0xaca0('0x29')](removeEntity(_0x191a69,null))[_0xaca0('0x4e')](handleError(_0x191a69,null));};exports[_0xaca0('0x51')]=function(_0x1d4708,_0x5791f8){return db[_0xaca0('0x31')][_0xaca0('0x51')]()[_0xaca0('0x29')](respondWithResult(_0x5791f8,null))['catch'](handleError(_0x5791f8,null));};exports[_0xaca0('0x52')]=function(_0x1faa66,_0x8e3436,_0x23da9e){return db['ChatInternalMessage'][_0xaca0('0x27')]({'where':{'ChatGroupId':_0x1faa66['params']['id'],'ToId':_0x1faa66[_0xaca0('0x53')]['id'],'read':![]}})[_0xaca0('0x29')](function(_0x37a7b1){return{'id':_[_0xaca0('0x54')](_0x1faa66[_0xaca0('0x4b')]['id']),'count':_0x37a7b1};})[_0xaca0('0x29')](respondWithResult(_0x8e3436,null))['catch'](handleError(_0x8e3436,null));};exports[_0xaca0('0x55')]=function(_0x4955b2,_0x26ab99,_0x493e95){return db[_0xaca0('0x31')]['find']({'where':{'id':_0x4955b2[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x26ab99,null))['then'](function(_0x4a7d6f){if(_0x4a7d6f){return _0x4a7d6f['addMembers'](_0x4955b2[_0xaca0('0x50')][_0xaca0('0x56')],_['omit'](_0x4955b2[_0xaca0('0x50')],['ids','id'])||{});}})[_0xaca0('0x29')](respondWithResult(_0x26ab99,null))[_0xaca0('0x4e')](handleError(_0x26ab99,null));};exports['getMembers']=function(_0x41289c,_0x5ca491,_0x1d1180){var _0x41971e={};var _0x69269c={};var _0x40e6ad;var _0x2cfb04;return db['ChatGroup'][_0xaca0('0x57')]({'where':{'id':_0x41289c[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x5ca491,null))[_0xaca0('0x29')](function(_0x23727a){if(_0x23727a){_0x40e6ad=_0x23727a;_0x69269c[_0xaca0('0x3a')]=_[_0xaca0('0x37')](db[_0xaca0('0x58')][_0xaca0('0x32')]);_0x69269c[_0xaca0('0x36')]=_['keys'](_0x41289c[_0xaca0('0x36')]);_0x69269c[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x69269c[_0xaca0('0x3a')],_0x69269c['query']);_0x41971e['attributes']=_[_0xaca0('0x39')](_0x69269c['model'],qs[_0xaca0('0x3b')](_0x41289c['query']['fields']));_0x41971e['attributes']=_0x41971e[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x41971e[_0xaca0('0x38')]:_0x69269c[_0xaca0('0x3a')];_0x41971e[_0xaca0('0x3e')]=qs[_0xaca0('0x3f')](_0x41289c['query'][_0xaca0('0x3f')]);_0x41971e[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x41289c['query'],_0x69269c[_0xaca0('0x41')]));if(_0x41289c[_0xaca0('0x36')][_0xaca0('0x43')]){_0x41971e[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0x41971e[_0xaca0('0x40')],{'$or':_[_0xaca0('0x30')](_0x41971e[_0xaca0('0x38')],function(_0x2a0ece){var _0x5d5d10={};_0x5d5d10[_0x2a0ece]={'$like':'%'+_0x41289c['query'][_0xaca0('0x43')]+'%'};return _0x5d5d10;})});}_0x41971e=_[_0xaca0('0x44')]({},_0x41971e,_0x41289c[_0xaca0('0x46')]);return _0x40e6ad[_0xaca0('0x59')](_0x41971e);}})[_0xaca0('0x29')](function(_0x52da5e){if(_0x52da5e){_0x2cfb04=_0x52da5e[_0xaca0('0x3c')];if(!_0x41289c[_0xaca0('0x36')][_0xaca0('0x5a')]('nolimit')){_0x41971e['limit']=qs[_0xaca0('0x25')](_0x41289c[_0xaca0('0x36')][_0xaca0('0x25')]);_0x41971e[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x41289c[_0xaca0('0x36')][_0xaca0('0x24')]);}return _0x40e6ad[_0xaca0('0x59')](_0x41971e);}})[_0xaca0('0x29')](function(_0x586346){if(_0x586346){return _0x586346?{'count':_0x2cfb04,'rows':_0x586346}:null;}})['then'](respondWithResult(_0x5ca491,null))[_0xaca0('0x4e')](handleError(_0x5ca491,null));};exports['removeMembers']=function(_0x1480ed,_0x10272f,_0x295139){return db['ChatGroup'][_0xaca0('0x4d')]({'where':{'id':_0x1480ed['params']['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x10272f,null))[_0xaca0('0x29')](function(_0x393a44){if(_0x393a44){return _0x393a44[_0xaca0('0x5b')](_0x1480ed[_0xaca0('0x36')][_0xaca0('0x56')]);}})[_0xaca0('0x29')](respondWithStatusCode(_0x10272f,null))[_0xaca0('0x4e')](handleError(_0x10272f,null));};exports[_0xaca0('0x5c')]=function(_0x3b59b3,_0x19e9d5,_0x1679e7){if(_0x3b59b3[_0xaca0('0x50')]['id']){delete _0x3b59b3[_0xaca0('0x50')]['id'];}return db[_0xaca0('0x31')][_0xaca0('0x4d')]({'where':{'id':_0x3b59b3[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x19e9d5,null))[_0xaca0('0x29')](function(_0x5664b7){if(_0x5664b7){_0x3b59b3[_0xaca0('0x50')][_0xaca0('0x5d')]=_0x5664b7['id'];return db[_0xaca0('0x5e')][_0xaca0('0x4f')](_0x3b59b3[_0xaca0('0x50')]);}})[_0xaca0('0x29')](respondWithResult(_0x19e9d5,null))['catch'](handleError(_0x19e9d5,null));};exports[_0xaca0('0x5f')]=function(_0x42de55,_0x50cffb,_0x9365d5){var _0x354ece={};var _0x495a81={};var _0x3c96c9;var _0x59d26c;return db[_0xaca0('0x31')]['findOne']({'where':{'id':_0x42de55[_0xaca0('0x4b')]['id']}})[_0xaca0('0x29')](handleEntityNotFound(_0x50cffb,null))[_0xaca0('0x29')](function(_0x37c384){if(_0x37c384){_0x3c96c9=_0x37c384;_0x495a81[_0xaca0('0x3a')]=_['keys'](db[_0xaca0('0x5e')][_0xaca0('0x32')]);_0x495a81[_0xaca0('0x36')]=_['keys'](_0x42de55[_0xaca0('0x36')]);_0x495a81[_0xaca0('0x41')]=_[_0xaca0('0x39')](_0x495a81['model'],_0x495a81[_0xaca0('0x36')]);_0x354ece[_0xaca0('0x38')]=_[_0xaca0('0x39')](_0x495a81[_0xaca0('0x3a')],qs['fields'](_0x42de55[_0xaca0('0x36')]['fields']));_0x354ece[_0xaca0('0x38')]=_0x354ece[_0xaca0('0x38')][_0xaca0('0x3c')]?_0x354ece[_0xaca0('0x38')]:_0x495a81[_0xaca0('0x3a')];_0x354ece[_0xaca0('0x3e')]=qs[_0xaca0('0x3f')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x3f')]);_0x354ece[_0xaca0('0x40')]=qs[_0xaca0('0x41')](_[_0xaca0('0x42')](_0x42de55['query'],_0x495a81[_0xaca0('0x41')]));if(_0x42de55[_0xaca0('0x36')][_0xaca0('0x43')]){_0x354ece[_0xaca0('0x40')]=_[_0xaca0('0x44')](_0x354ece[_0xaca0('0x40')],{'$or':_['map'](_0x354ece[_0xaca0('0x38')],function(_0x6a6bb1){var _0x4d18e3={};_0x4d18e3[_0x6a6bb1]={'$like':'%'+_0x42de55[_0xaca0('0x36')][_0xaca0('0x43')]+'%'};return _0x4d18e3;})});}if(_0x42de55[_0xaca0('0x36')][_0xaca0('0x60')]){var _0x4d8e11=_0x42de55[_0xaca0('0x36')]['$gte'][_0xaca0('0x61')](',');var _0x287f43={};_0x287f43[_0x4d8e11[0x0]]={'$gte':moment(_0x4d8e11[0x1])['format'](_0xaca0('0x62'))};_0x354ece['where']=_[_0xaca0('0x44')](_0x354ece['where'],_0x287f43);}_0x354ece=_[_0xaca0('0x44')]({},_0x354ece,_0x42de55[_0xaca0('0x46')]);return _0x3c96c9[_0xaca0('0x5f')](_0x354ece);}})[_0xaca0('0x29')](function(_0x178683){if(_0x178683){_0x59d26c=_0x178683[_0xaca0('0x3c')];if(!_0x42de55[_0xaca0('0x36')][_0xaca0('0x5a')](_0xaca0('0x3d'))){_0x354ece['limit']=qs[_0xaca0('0x25')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x25')]);_0x354ece[_0xaca0('0x24')]=qs[_0xaca0('0x24')](_0x42de55[_0xaca0('0x36')][_0xaca0('0x24')]);}return _0x3c96c9['getMessages'](_0x354ece);}})[_0xaca0('0x29')](function(_0x1a73bc){if(_0x1a73bc){return _0x1a73bc?{'count':_0x59d26c,'rows':_0x1a73bc}:null;}})[_0xaca0('0x29')](respondWithResult(_0x50cffb,null))[_0xaca0('0x4e')](handleError(_0x50cffb,null));}; \ No newline at end of file +var _0x5072=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','removeMembers','addMessage','ChatGroupId','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','key','query'];(function(_0x59523c,_0x432c65){var _0x5cefd0=function(_0x30af8d){while(--_0x30af8d){_0x59523c['push'](_0x59523c['shift']());}};_0x5cefd0(++_0x432c65);}(_0x5072,0x14d));var _0x2507=function(_0x2a507d,_0x1d89d3){_0x2a507d=_0x2a507d-0x0;var _0x3581a9=_0x5072[_0x2a507d];return _0x3581a9;};'use strict';var emlformat=require(_0x2507('0x0'));var rimraf=require(_0x2507('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2507('0x2'));var rp=require(_0x2507('0x3'));var moment=require(_0x2507('0x4'));var BPromise=require(_0x2507('0x5'));var Mustache=require('mustache');var util=require(_0x2507('0x6'));var path=require('path');var sox=require(_0x2507('0x7'));var csv=require(_0x2507('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2507('0x9'));var _=require('lodash');var squel=require(_0x2507('0xa'));var crypto=require(_0x2507('0xb'));var jsforce=require(_0x2507('0xc'));var deskjs=require(_0x2507('0xd'));var toCsv=require(_0x2507('0x8'));var querystring=require('querystring');var Papa=require(_0x2507('0xe'));var Redis=require(_0x2507('0xf'));var authService=require(_0x2507('0x10'));var qs=require(_0x2507('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2507('0x12'));var logger=require('../../config/logger')(_0x2507('0x13'));var utils=require('../../config/utils');var config=require(_0x2507('0x14'));var licenseUtil=require(_0x2507('0x15'));var db=require(_0x2507('0x16'))['db'];config['redis']=_[_0x2507('0x17')](config[_0x2507('0x18')],{'host':_0x2507('0x19'),'port':0x18eb});var socket=require(_0x2507('0x1a'))(new Redis(config[_0x2507('0x18')]));require(_0x2507('0x1b'))[_0x2507('0x1c')](socket);function respondWithStatusCode(_0x23ba6a,_0x134334){_0x134334=_0x134334||0xcc;return function(_0x3ef24d){if(_0x3ef24d){return _0x23ba6a[_0x2507('0x1d')](_0x134334);}return _0x23ba6a[_0x2507('0x1e')](_0x134334)['end']();};}function respondWithResult(_0x5b3b73,_0x35ce93){_0x35ce93=_0x35ce93||0xc8;return function(_0x1ba4fa){if(_0x1ba4fa){return _0x5b3b73[_0x2507('0x1e')](_0x35ce93)[_0x2507('0x1f')](_0x1ba4fa);}};}function respondWithFilteredResult(_0x2ae4ef,_0x11b36a){return function(_0xd6caa1){if(_0xd6caa1){var _0x1ba7fa=typeof _0x11b36a[_0x2507('0x20')]===_0x2507('0x21')&&typeof _0x11b36a[_0x2507('0x22')]===_0x2507('0x21');var _0x2cea5c=_0xd6caa1[_0x2507('0x23')];var _0x48ebe5=_0x1ba7fa?0x0:_0x11b36a[_0x2507('0x20')];var _0x139bd8=_0x1ba7fa?_0xd6caa1[_0x2507('0x23')]:_0x11b36a[_0x2507('0x20')]+_0x11b36a[_0x2507('0x22')];var _0x1922d3;if(_0x139bd8>=_0x2cea5c){_0x139bd8=_0x2cea5c;_0x1922d3=0xc8;}else{_0x1922d3=0xce;}_0x2ae4ef[_0x2507('0x1e')](_0x1922d3);return _0x2ae4ef[_0x2507('0x24')]('Content-Range',_0x48ebe5+'-'+_0x139bd8+'/'+_0x2cea5c)['json'](_0xd6caa1);}return null;};}function patchUpdates(_0x362ae2){return function(_0x295ea9){try{jsonpatch[_0x2507('0x25')](_0x295ea9,_0x362ae2,!![]);}catch(_0x38ef13){return BPromise[_0x2507('0x26')](_0x38ef13);}return _0x295ea9[_0x2507('0x27')]();};}function saveUpdates(_0x556dd8,_0x1d3abf){return function(_0x5e6ed8){if(_0x5e6ed8){return _0x5e6ed8['update'](_0x556dd8)[_0x2507('0x28')](function(_0x547d9e){return _0x547d9e;});}return null;};}function removeEntity(_0x5bb208,_0x369be8){return function(_0x3a3e9f){if(_0x3a3e9f){return _0x3a3e9f['destroy']()[_0x2507('0x28')](function(){_0x5bb208[_0x2507('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x298202,_0x4122be){return function(_0x3aadb7){if(!_0x3aadb7){_0x298202[_0x2507('0x1d')](0x194);}return _0x3aadb7;};}function handleError(_0x30328e,_0x5381a9){_0x5381a9=_0x5381a9||0x1f4;return function(_0x456480){logger[_0x2507('0x29')](_0x456480[_0x2507('0x2a')]);if(_0x456480[_0x2507('0x2b')]){delete _0x456480[_0x2507('0x2b')];}_0x30328e['status'](_0x5381a9)[_0x2507('0x2c')](_0x456480);};}exports[_0x2507('0x2d')]=function(_0x163c89,_0x19ccfc){var _0x346992={},_0x150261={},_0x58e95d={'count':0x0,'rows':[]};var _0x3e8e4b=_[_0x2507('0x2e')](db[_0x2507('0x2f')][_0x2507('0x30')],function(_0x43fa36){return{'name':_0x43fa36['fieldName'],'type':_0x43fa36['type'][_0x2507('0x31')]};});_0x150261['model']=_[_0x2507('0x2e')](_0x3e8e4b,_0x2507('0x2b'));_0x150261[_0x2507('0x32')]=_[_0x2507('0x33')](_0x163c89['query']);_0x150261[_0x2507('0x34')]=_[_0x2507('0x35')](_0x150261[_0x2507('0x36')],_0x150261['query']);_0x346992[_0x2507('0x37')]=_['intersection'](_0x150261['model'],qs[_0x2507('0x38')](_0x163c89[_0x2507('0x32')]['fields']));_0x346992[_0x2507('0x37')]=_0x346992[_0x2507('0x37')]['length']?_0x346992[_0x2507('0x37')]:_0x150261[_0x2507('0x36')];if(!_0x163c89[_0x2507('0x32')][_0x2507('0x39')](_0x2507('0x3a'))){_0x346992[_0x2507('0x22')]=qs[_0x2507('0x22')](_0x163c89[_0x2507('0x32')][_0x2507('0x22')]);_0x346992[_0x2507('0x20')]=qs[_0x2507('0x20')](_0x163c89[_0x2507('0x32')][_0x2507('0x20')]);}_0x346992[_0x2507('0x3b')]=qs['sort'](_0x163c89[_0x2507('0x32')][_0x2507('0x3c')]);_0x346992[_0x2507('0x3d')]=qs[_0x2507('0x34')](_[_0x2507('0x3e')](_0x163c89[_0x2507('0x32')],_0x150261['filters']),_0x3e8e4b);if(_0x163c89['query'][_0x2507('0x3f')]){_0x346992['where']=_[_0x2507('0x40')](_0x346992[_0x2507('0x3d')],{'$or':_[_0x2507('0x2e')](_0x3e8e4b,function(_0x2f785d){if(_0x2f785d[_0x2507('0x41')]!==_0x2507('0x42')){var _0x5c4cb9={};_0x5c4cb9[_0x2f785d[_0x2507('0x2b')]]={'$like':'%'+_0x163c89[_0x2507('0x32')][_0x2507('0x3f')]+'%'};return _0x5c4cb9;}})});}_0x346992=_[_0x2507('0x40')]({},_0x346992,_0x163c89['options']);var _0x112f86={'where':_0x346992[_0x2507('0x3d')]};return db[_0x2507('0x2f')][_0x2507('0x23')](_0x112f86)[_0x2507('0x28')](function(_0x5e249b){_0x58e95d[_0x2507('0x23')]=_0x5e249b;if(_0x163c89[_0x2507('0x32')][_0x2507('0x43')]){_0x346992[_0x2507('0x44')]=[{'all':!![]}];}return db[_0x2507('0x2f')][_0x2507('0x45')](_0x346992);})['then'](function(_0x10dcd5){_0x58e95d[_0x2507('0x46')]=_0x10dcd5;return _0x58e95d;})[_0x2507('0x28')](respondWithFilteredResult(_0x19ccfc,_0x346992))[_0x2507('0x47')](handleError(_0x19ccfc,null));};exports[_0x2507('0x48')]=function(_0x82d4aa,_0x348b0d){var _0xae96dc={'raw':!![],'where':{'id':_0x82d4aa[_0x2507('0x49')]['id']}},_0x3d1425={};_0x3d1425[_0x2507('0x36')]=_[_0x2507('0x33')](db[_0x2507('0x2f')][_0x2507('0x30')]);_0x3d1425['query']=_[_0x2507('0x33')](_0x82d4aa[_0x2507('0x32')]);_0x3d1425[_0x2507('0x34')]=_[_0x2507('0x35')](_0x3d1425['model'],_0x3d1425['query']);_0xae96dc[_0x2507('0x37')]=_[_0x2507('0x35')](_0x3d1425[_0x2507('0x36')],qs[_0x2507('0x38')](_0x82d4aa[_0x2507('0x32')][_0x2507('0x38')]));_0xae96dc[_0x2507('0x37')]=_0xae96dc[_0x2507('0x37')][_0x2507('0x4a')]?_0xae96dc['attributes']:_0x3d1425['model'];if(_0x82d4aa[_0x2507('0x32')]['includeAll']){_0xae96dc['include']=[{'all':!![]}];}_0xae96dc=_[_0x2507('0x40')]({},_0xae96dc,_0x82d4aa[_0x2507('0x4b')]);return db[_0x2507('0x2f')][_0x2507('0x4c')](_0xae96dc)[_0x2507('0x28')](handleEntityNotFound(_0x348b0d,null))[_0x2507('0x28')](respondWithResult(_0x348b0d,null))['catch'](handleError(_0x348b0d,null));};exports[_0x2507('0x4d')]=function(_0x5197f3,_0x47594e){return db[_0x2507('0x2f')]['create'](_0x5197f3[_0x2507('0x4e')],{})[_0x2507('0x28')](respondWithResult(_0x47594e,0xc9))[_0x2507('0x47')](handleError(_0x47594e,null));};exports['update']=function(_0x5f463a,_0x4bb588){if(_0x5f463a[_0x2507('0x4e')]['id']){delete _0x5f463a['body']['id'];}return db[_0x2507('0x2f')][_0x2507('0x4c')]({'where':{'id':_0x5f463a[_0x2507('0x49')]['id']}})[_0x2507('0x28')](handleEntityNotFound(_0x4bb588,null))[_0x2507('0x28')](saveUpdates(_0x5f463a[_0x2507('0x4e')],null))[_0x2507('0x28')](respondWithResult(_0x4bb588,null))['catch'](handleError(_0x4bb588,null));};exports[_0x2507('0x4f')]=function(_0x49e219,_0x256f94){return db[_0x2507('0x2f')]['find']({'where':{'id':_0x49e219['params']['id']}})[_0x2507('0x28')](handleEntityNotFound(_0x256f94,null))['then'](removeEntity(_0x256f94,null))[_0x2507('0x47')](handleError(_0x256f94,null));};exports[_0x2507('0x50')]=function(_0x43a762,_0x445c56){return db[_0x2507('0x2f')][_0x2507('0x50')]()[_0x2507('0x28')](respondWithResult(_0x445c56,null))['catch'](handleError(_0x445c56,null));};exports[_0x2507('0x51')]=function(_0x404c9e,_0x1f74bb,_0x5ee334){return db[_0x2507('0x52')][_0x2507('0x23')]({'where':{'ChatGroupId':_0x404c9e[_0x2507('0x49')]['id'],'ToId':_0x404c9e[_0x2507('0x53')]['id'],'read':![]}})[_0x2507('0x28')](function(_0x4be8f9){return{'id':_[_0x2507('0x54')](_0x404c9e[_0x2507('0x49')]['id']),'count':_0x4be8f9};})['then'](respondWithResult(_0x1f74bb,null))['catch'](handleError(_0x1f74bb,null));};exports[_0x2507('0x55')]=function(_0x556282,_0x1930eb,_0x150bca){return db[_0x2507('0x2f')][_0x2507('0x4c')]({'where':{'id':_0x556282[_0x2507('0x49')]['id']}})['then'](handleEntityNotFound(_0x1930eb,null))[_0x2507('0x28')](function(_0x293db4){if(_0x293db4){return _0x293db4['addMembers'](_0x556282[_0x2507('0x4e')][_0x2507('0x56')],_[_0x2507('0x57')](_0x556282[_0x2507('0x4e')],[_0x2507('0x56'),'id'])||{});}})[_0x2507('0x28')](respondWithResult(_0x1930eb,null))[_0x2507('0x47')](handleError(_0x1930eb,null));};exports[_0x2507('0x58')]=function(_0x56e99b,_0xe9e2fc,_0x42a3de){var _0x178bf8={};var _0xbe88ef={};var _0x2dc494;var _0x3e6ed2;return db[_0x2507('0x2f')]['findOne']({'where':{'id':_0x56e99b[_0x2507('0x49')]['id']}})['then'](handleEntityNotFound(_0xe9e2fc,null))[_0x2507('0x28')](function(_0x27c36f){if(_0x27c36f){_0x2dc494=_0x27c36f;_0xbe88ef['model']=_['keys'](db['User'][_0x2507('0x30')]);_0xbe88ef['query']=_[_0x2507('0x33')](_0x56e99b[_0x2507('0x32')]);_0xbe88ef[_0x2507('0x34')]=_['intersection'](_0xbe88ef[_0x2507('0x36')],_0xbe88ef['query']);_0x178bf8[_0x2507('0x37')]=_['intersection'](_0xbe88ef['model'],qs[_0x2507('0x38')](_0x56e99b['query'][_0x2507('0x38')]));_0x178bf8[_0x2507('0x37')]=_0x178bf8[_0x2507('0x37')]['length']?_0x178bf8[_0x2507('0x37')]:_0xbe88ef[_0x2507('0x36')];_0x178bf8[_0x2507('0x3b')]=qs['sort'](_0x56e99b['query']['sort']);_0x178bf8['where']=qs[_0x2507('0x34')](_[_0x2507('0x3e')](_0x56e99b['query'],_0xbe88ef[_0x2507('0x34')]));if(_0x56e99b[_0x2507('0x32')][_0x2507('0x3f')]){_0x178bf8[_0x2507('0x3d')]=_['merge'](_0x178bf8['where'],{'$or':_['map'](_0x178bf8['attributes'],function(_0x5633f9){var _0x42c555={};_0x42c555[_0x5633f9]={'$like':'%'+_0x56e99b[_0x2507('0x32')][_0x2507('0x3f')]+'%'};return _0x42c555;})});}_0x178bf8=_[_0x2507('0x40')]({},_0x178bf8,_0x56e99b[_0x2507('0x4b')]);return _0x2dc494[_0x2507('0x58')](_0x178bf8);}})[_0x2507('0x28')](function(_0x2dfa2e){if(_0x2dfa2e){_0x3e6ed2=_0x2dfa2e[_0x2507('0x4a')];if(!_0x56e99b['query'][_0x2507('0x39')](_0x2507('0x3a'))){_0x178bf8['limit']=qs[_0x2507('0x22')](_0x56e99b[_0x2507('0x32')][_0x2507('0x22')]);_0x178bf8[_0x2507('0x20')]=qs[_0x2507('0x20')](_0x56e99b[_0x2507('0x32')][_0x2507('0x20')]);}return _0x2dc494[_0x2507('0x58')](_0x178bf8);}})['then'](function(_0x44e00f){if(_0x44e00f){return _0x44e00f?{'count':_0x3e6ed2,'rows':_0x44e00f}:null;}})['then'](respondWithResult(_0xe9e2fc,null))['catch'](handleError(_0xe9e2fc,null));};exports[_0x2507('0x59')]=function(_0x99f8b8,_0x13b10e,_0x36b4bd){return db['ChatGroup']['find']({'where':{'id':_0x99f8b8[_0x2507('0x49')]['id']}})[_0x2507('0x28')](handleEntityNotFound(_0x13b10e,null))[_0x2507('0x28')](function(_0x566303){if(_0x566303){return _0x566303[_0x2507('0x59')](_0x99f8b8[_0x2507('0x32')][_0x2507('0x56')]);}})[_0x2507('0x28')](respondWithStatusCode(_0x13b10e,null))[_0x2507('0x47')](handleError(_0x13b10e,null));};exports[_0x2507('0x5a')]=function(_0x4b0474,_0x4ebe28,_0x1561ee){if(_0x4b0474['body']['id']){delete _0x4b0474[_0x2507('0x4e')]['id'];}return db['ChatGroup'][_0x2507('0x4c')]({'where':{'id':_0x4b0474[_0x2507('0x49')]['id']}})[_0x2507('0x28')](handleEntityNotFound(_0x4ebe28,null))[_0x2507('0x28')](function(_0x58cbde){if(_0x58cbde){_0x4b0474[_0x2507('0x4e')][_0x2507('0x5b')]=_0x58cbde['id'];return db[_0x2507('0x52')][_0x2507('0x4d')](_0x4b0474[_0x2507('0x4e')]);}})[_0x2507('0x28')](respondWithResult(_0x4ebe28,null))[_0x2507('0x47')](handleError(_0x4ebe28,null));};exports['getMessages']=function(_0x19c41f,_0x39c51e,_0x4cbf9d){var _0x66026b={};var _0x52b8ae={};var _0x64450b;var _0x738b7b;return db[_0x2507('0x2f')][_0x2507('0x5c')]({'where':{'id':_0x19c41f[_0x2507('0x49')]['id']}})['then'](handleEntityNotFound(_0x39c51e,null))[_0x2507('0x28')](function(_0x20e501){if(_0x20e501){_0x64450b=_0x20e501;_0x52b8ae[_0x2507('0x36')]=_[_0x2507('0x33')](db['ChatInternalMessage'][_0x2507('0x30')]);_0x52b8ae[_0x2507('0x32')]=_['keys'](_0x19c41f[_0x2507('0x32')]);_0x52b8ae[_0x2507('0x34')]=_[_0x2507('0x35')](_0x52b8ae[_0x2507('0x36')],_0x52b8ae[_0x2507('0x32')]);_0x66026b[_0x2507('0x37')]=_[_0x2507('0x35')](_0x52b8ae[_0x2507('0x36')],qs[_0x2507('0x38')](_0x19c41f[_0x2507('0x32')]['fields']));_0x66026b['attributes']=_0x66026b[_0x2507('0x37')][_0x2507('0x4a')]?_0x66026b[_0x2507('0x37')]:_0x52b8ae[_0x2507('0x36')];_0x66026b['order']=qs['sort'](_0x19c41f[_0x2507('0x32')][_0x2507('0x3c')]);_0x66026b[_0x2507('0x3d')]=qs[_0x2507('0x34')](_[_0x2507('0x3e')](_0x19c41f[_0x2507('0x32')],_0x52b8ae[_0x2507('0x34')]));if(_0x19c41f[_0x2507('0x32')][_0x2507('0x3f')]){_0x66026b[_0x2507('0x3d')]=_['merge'](_0x66026b[_0x2507('0x3d')],{'$or':_[_0x2507('0x2e')](_0x66026b[_0x2507('0x37')],function(_0x3ac187){var _0x1fb039={};_0x1fb039[_0x3ac187]={'$like':'%'+_0x19c41f[_0x2507('0x32')][_0x2507('0x3f')]+'%'};return _0x1fb039;})});}if(_0x19c41f[_0x2507('0x32')]['$gte']){var _0x1c26ae=_0x19c41f[_0x2507('0x32')][_0x2507('0x5d')]['split'](',');var _0x4f27c7={};_0x4f27c7[_0x1c26ae[0x0]]={'$gte':moment(_0x1c26ae[0x1])['format'](_0x2507('0x5e'))};_0x66026b[_0x2507('0x3d')]=_[_0x2507('0x40')](_0x66026b[_0x2507('0x3d')],_0x4f27c7);}_0x66026b=_[_0x2507('0x40')]({},_0x66026b,_0x19c41f[_0x2507('0x4b')]);return _0x64450b[_0x2507('0x5f')](_0x66026b);}})[_0x2507('0x28')](function(_0x1b0830){if(_0x1b0830){_0x738b7b=_0x1b0830[_0x2507('0x4a')];if(!_0x19c41f[_0x2507('0x32')][_0x2507('0x39')](_0x2507('0x3a'))){_0x66026b[_0x2507('0x22')]=qs[_0x2507('0x22')](_0x19c41f['query'][_0x2507('0x22')]);_0x66026b[_0x2507('0x20')]=qs[_0x2507('0x20')](_0x19c41f[_0x2507('0x32')][_0x2507('0x20')]);}return _0x64450b[_0x2507('0x5f')](_0x66026b);}})[_0x2507('0x28')](function(_0x1a6c57){if(_0x1a6c57){return _0x1a6c57?{'count':_0x738b7b,'rows':_0x1a6c57}:null;}})[_0x2507('0x28')](respondWithResult(_0x39c51e,null))[_0x2507('0x47')](handleError(_0x39c51e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 054717a..ecbc764 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 _0xef0f=['events','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xef0f,0x168));var _0xfef0=function(_0x5b4b18,_0x1003ab){_0x5b4b18=_0x5b4b18-0x0;var _0x326467=_0xef0f[_0x5b4b18];return _0x326467;};'use strict';var EventEmitter=require(_0xfef0('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xfef0('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfef0('0x2')](0x0);var events={'afterCreate':_0xfef0('0x3'),'afterUpdate':'update','afterDestroy':_0xfef0('0x4')};function emitEvent(_0x11ab77){return function(_0x4618fb,_0x4e1af6,_0x2a6fcf){ChatGroupEvents[_0xfef0('0x5')](_0x11ab77+':'+_0x4618fb['id'],_0x4618fb);ChatGroupEvents[_0xfef0('0x5')](_0x11ab77,_0x4618fb);_0x2a6fcf(null);};}for(var e in events){if(events[_0xfef0('0x6')](e)){var event=events[e];ChatGroup[_0xfef0('0x7')](e,emitEvent(event));}}module[_0xfef0('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x22ea=['emit','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x22ea,0xb3));var _0xa22e=function(_0x86a411,_0x459440){_0x86a411=_0x86a411-0x0;var _0x6e98e4=_0x22ea[_0x86a411];return _0x6e98e4;};'use strict';var EventEmitter=require(_0xa22e('0x0'));var ChatGroup=require(_0xa22e('0x1'))['db'][_0xa22e('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xa22e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa22e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x267cf2){return function(_0x3daa37,_0x21e118,_0x1c0837){ChatGroupEvents[_0xa22e('0x5')](_0x267cf2+':'+_0x3daa37['id'],_0x3daa37);ChatGroupEvents['emit'](_0x267cf2,_0x3daa37);_0x1c0837(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xa22e('0x6')](e,emitEvent(event));}}module[_0xa22e('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 2c16929..abb667e 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 _0x277e=['api','moment','bluebird','request-promise','exports','define','chat_groups','lodash','util','../../config/logger'];(function(_0x20c0e7,_0x4e172a){var _0x405098=function(_0x45853d){while(--_0x45853d){_0x20c0e7['push'](_0x20c0e7['shift']());}};_0x405098(++_0x4e172a);}(_0x277e,0x18d));var _0xe277=function(_0x22de53,_0x489cfe){_0x22de53=_0x22de53-0x0;var _0x492b77=_0x277e[_0x22de53];return _0x492b77;};'use strict';var _=require(_0xe277('0x0'));var util=require(_0xe277('0x1'));var logger=require(_0xe277('0x2'))(_0xe277('0x3'));var moment=require(_0xe277('0x4'));var BPromise=require(_0xe277('0x5'));var rp=require(_0xe277('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xe277('0x7')]=function(_0x2d4d52,_0x2fecda){return _0x2d4d52[_0xe277('0x8')]('ChatGroup',attributes,{'tableName':_0xe277('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe306=['exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x41507c,_0x133c9e){var _0x219fdf=function(_0x236d9d){while(--_0x236d9d){_0x41507c['push'](_0x41507c['shift']());}};_0x219fdf(++_0x133c9e);}(_0xe306,0xc8));var _0x6e30=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xe306[_0x35a274];return _0x40d905;};'use strict';var _=require(_0x6e30('0x0'));var util=require(_0x6e30('0x1'));var logger=require(_0x6e30('0x2'))('api');var moment=require(_0x6e30('0x3'));var BPromise=require(_0x6e30('0x4'));var rp=require(_0x6e30('0x5'));var fs=require('fs');var path=require(_0x6e30('0x6'));var rimraf=require(_0x6e30('0x7'));var config=require(_0x6e30('0x8'));var attributes=require(_0x6e30('0x9'));module[_0x6e30('0xa')]=function(_0x59f83e,_0x2066b3){return _0x59f83e[_0x6e30('0xb')](_0x6e30('0xc'),attributes,{'tableName':_0x6e30('0xd'),'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 64835d9..0f45604 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 _0x858e=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird'];(function(_0x41b29e,_0x34b288){var _0xacd517=function(_0x3318df){while(--_0x3318df){_0x41b29e['push'](_0x41b29e['shift']());}};_0xacd517(++_0x34b288);}(_0x858e,0x178));var _0xe858=function(_0x5cd51d,_0x20d4fa){_0x5cd51d=_0x5cd51d-0x0;var _0x444608=_0x858e[_0x5cd51d];return _0x444608;};'use strict';var _=require(_0xe858('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe858('0x1'));var rs=require(_0xe858('0x2'));var fs=require('fs');var Redis=require(_0xe858('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe858('0x4'));var logger=require(_0xe858('0x5'))(_0xe858('0x6'));var config=require(_0xe858('0x7'));var jayson=require(_0xe858('0x8'));var client=jayson['client'][_0xe858('0x9')]({'port':0x232a});config[_0xe858('0xa')]=_['defaults'](config[_0xe858('0xa')],{'host':_0xe858('0xb'),'port':0x18eb});var socket=require(_0xe858('0xc'))(new Redis(config[_0xe858('0xa')]));require(_0xe858('0xd'))[_0xe858('0xe')](socket);function respondWithRpcPromise(_0x571ad6,_0x3ed125,_0x2dea6c){return new BPromise(function(_0x3677de,_0x128479){return client[_0xe858('0xf')](_0x571ad6,_0x2dea6c)[_0xe858('0x10')](function(_0x3014af){logger['info'](_0xe858('0x11'),_0x3ed125,'request\x20sent');logger[_0xe858('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x3ed125,_0xe858('0x13'),JSON[_0xe858('0x14')](_0x3014af));if(_0x3014af[_0xe858('0x15')]){if(_0x3014af['error'][_0xe858('0x16')]===0x1f4){logger[_0xe858('0x15')](_0xe858('0x11'),_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x128479(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}logger[_0xe858('0x15')]('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x3014af[_0xe858('0x15')]['message']);return _0x3677de(_0x3014af[_0xe858('0x15')][_0xe858('0x17')]);}else{logger[_0xe858('0x18')](_0xe858('0x11'),_0x3ed125,_0xe858('0x13'));_0x3677de(_0x3014af[_0xe858('0x19')][_0xe858('0x17')]);}})[_0xe858('0x1a')](function(_0x313401){logger['error']('ChatGroup,\x20%s,\x20%s',_0x3ed125,_0x313401);_0x128479(_0x313401);});});} \ No newline at end of file +var _0xd217=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','request\x20sent','debug','error','code','ChatGroup,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0xd217,0x141));var _0x7d21=function(_0x2cfc4e,_0x1f6187){_0x2cfc4e=_0x2cfc4e-0x0;var _0x108e78=_0xd217[_0x2cfc4e];return _0x108e78;};'use strict';var _=require('lodash');var util=require(_0x7d21('0x0'));var moment=require(_0x7d21('0x1'));var BPromise=require('bluebird');var rs=require(_0x7d21('0x2'));var fs=require('fs');var Redis=require(_0x7d21('0x3'));var db=require(_0x7d21('0x4'))['db'];var utils=require(_0x7d21('0x5'));var logger=require(_0x7d21('0x6'))(_0x7d21('0x7'));var config=require(_0x7d21('0x8'));var jayson=require(_0x7d21('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d21('0xa')]=_[_0x7d21('0xb')](config[_0x7d21('0xa')],{'host':_0x7d21('0xc'),'port':0x18eb});var socket=require(_0x7d21('0xd'))(new Redis(config[_0x7d21('0xa')]));require(_0x7d21('0xe'))[_0x7d21('0xf')](socket);function respondWithRpcPromise(_0xbb576e,_0x2ea67b,_0x296723){return new BPromise(function(_0x4bb915,_0x5e348a){return client[_0x7d21('0x10')](_0xbb576e,_0x296723)['then'](function(_0xede162){logger[_0x7d21('0x11')]('ChatGroup,\x20%s,\x20%s',_0x2ea67b,_0x7d21('0x12'));logger[_0x7d21('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2ea67b,'request\x20sent',JSON['stringify'](_0xede162));if(_0xede162[_0x7d21('0x14')]){if(_0xede162['error'][_0x7d21('0x15')]===0x1f4){logger[_0x7d21('0x14')](_0x7d21('0x16'),_0x2ea67b,_0xede162[_0x7d21('0x14')][_0x7d21('0x17')]);return _0x5e348a(_0xede162['error'][_0x7d21('0x17')]);}logger[_0x7d21('0x14')](_0x7d21('0x16'),_0x2ea67b,_0xede162['error'][_0x7d21('0x17')]);return _0x4bb915(_0xede162[_0x7d21('0x14')][_0x7d21('0x17')]);}else{logger['info'](_0x7d21('0x16'),_0x2ea67b,_0x7d21('0x12'));_0x4bb915(_0xede162[_0x7d21('0x18')]['message']);}})['catch'](function(_0x2120f6){logger[_0x7d21('0x14')](_0x7d21('0x16'),_0x2ea67b,_0x2120f6);_0x5e348a(_0x2120f6);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 60d4025..7961b88 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 _0x5260=['update','emit','removeListener','register','remove'];(function(_0x4e6fc7,_0x6b9a5d){var _0x3c2ef6=function(_0x3907ed){while(--_0x3907ed){_0x4e6fc7['push'](_0x4e6fc7['shift']());}};_0x3c2ef6(++_0x6b9a5d);}(_0x5260,0xbd));var _0x0526=function(_0x5c7eb7,_0x3fbe3b){_0x5c7eb7=_0x5c7eb7-0x0;var _0x2cbfa8=_0x5260[_0x5c7eb7];return _0x2cbfa8;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x0526('0x0'),_0x0526('0x1')];function createListener(_0x295ca9,_0x5e67e4){return function(_0x13914c){_0x5e67e4[_0x0526('0x2')](_0x295ca9,_0x13914c);};}function removeListener(_0x1b5f24,_0x9a652d){return function(){ChatGroupEvents[_0x0526('0x3')](_0x1b5f24,_0x9a652d);};}exports[_0x0526('0x4')]=function(_0xb55cec){for(var _0x1b13c8=0x0,_0x160294=events['length'];_0x1b13c8<_0x160294;_0x1b13c8++){var _0x4e1c16=events[_0x1b13c8];var _0x39aa15=createListener('chatGroup:'+_0x4e1c16,_0xb55cec);ChatGroupEvents['on'](_0x4e1c16,_0x39aa15);}}; \ No newline at end of file +var _0x7709=['save','remove','update','emit','removeListener','length'];(function(_0x229a9d,_0x4d3229){var _0x5bd600=function(_0x5f5af9){while(--_0x5f5af9){_0x229a9d['push'](_0x229a9d['shift']());}};_0x5bd600(++_0x4d3229);}(_0x7709,0xa8));var _0x9770=function(_0xbaaa00,_0x31f500){_0xbaaa00=_0xbaaa00-0x0;var _0x3b47b9=_0x7709[_0xbaaa00];return _0x3b47b9;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x9770('0x0'),_0x9770('0x1'),_0x9770('0x2')];function createListener(_0x399bdf,_0x2b9619){return function(_0xad2a7){_0x2b9619[_0x9770('0x3')](_0x399bdf,_0xad2a7);};}function removeListener(_0x3c6318,_0x3bb0f9){return function(){ChatGroupEvents[_0x9770('0x4')](_0x3c6318,_0x3bb0f9);};}exports['register']=function(_0x2b2ff6){for(var _0x4bfc8b=0x0,_0x3dd87d=events[_0x9770('0x5')];_0x4bfc8b<_0x3dd87d;_0x4bfc8b++){var _0x27fb7d=events[_0x4bfc8b];var _0xd843b=createListener('chatGroup:'+_0x27fb7d,_0x2b2ff6);ChatGroupEvents['on'](_0x27fb7d,_0xd843b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index a49a59e..a61d77f 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 _0x620b=['/:id/unread','getUnread','/:id/members','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x620b,0x157));var _0xb620=function(_0x15c420,_0x3c6b3c){_0x15c420=_0x15c420-0x0;var _0x5592d1=_0x620b[_0x15c420];return _0x5592d1;};'use strict';var multer=require(_0xb620('0x0'));var util=require(_0xb620('0x1'));var path=require(_0xb620('0x2'));var timeout=require(_0xb620('0x3'));var express=require(_0xb620('0x4'));var router=express[_0xb620('0x5')]();var fs_extra=require(_0xb620('0x6'));var auth=require(_0xb620('0x7'));var interaction=require(_0xb620('0x8'));var config=require(_0xb620('0x9'));var controller=require(_0xb620('0xa'));router['get']('/',auth[_0xb620('0xb')](),controller[_0xb620('0xc')]);router[_0xb620('0xd')](_0xb620('0xe'),auth[_0xb620('0xb')](),controller['describe']);router[_0xb620('0xd')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x10')]);router[_0xb620('0xd')](_0xb620('0x11'),auth[_0xb620('0xb')](),controller[_0xb620('0x12')]);router[_0xb620('0xd')](_0xb620('0x13'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb620('0xd')]('/:id/messages',auth[_0xb620('0xb')](),controller[_0xb620('0x14')]);router[_0xb620('0x15')]('/',auth[_0xb620('0xb')](),controller[_0xb620('0x16')]);router['post']('/:id/members',auth[_0xb620('0xb')](),controller[_0xb620('0x17')]);router[_0xb620('0x15')]('/:id/messages',auth[_0xb620('0xb')](),controller['addMessage']);router[_0xb620('0x18')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x19')]);router[_0xb620('0x1a')](_0xb620('0xf'),auth[_0xb620('0xb')](),controller[_0xb620('0x1b')]);router[_0xb620('0x1a')](_0xb620('0x13'),auth['isAuthenticated'](),controller[_0xb620('0x1c')]);module[_0xb620('0x1d')]=router; \ No newline at end of file +var _0x526e=['get','describe','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','post','addMembers','addMessage','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index'];(function(_0x4827a3,_0xffcef2){var _0x2c41c9=function(_0x1747a4){while(--_0x1747a4){_0x4827a3['push'](_0x4827a3['shift']());}};_0x2c41c9(++_0xffcef2);}(_0x526e,0x1a5));var _0xe526=function(_0x508313,_0xe60d09){_0x508313=_0x508313-0x0;var _0x1800f2=_0x526e[_0x508313];return _0x1800f2;};'use strict';var multer=require(_0xe526('0x0'));var util=require(_0xe526('0x1'));var path=require(_0xe526('0x2'));var timeout=require(_0xe526('0x3'));var express=require(_0xe526('0x4'));var router=express[_0xe526('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe526('0x6'));var interaction=require(_0xe526('0x7'));var config=require('../../config/environment');var controller=require(_0xe526('0x8'));router['get']('/',auth[_0xe526('0x9')](),controller[_0xe526('0xa')]);router[_0xe526('0xb')]('/describe',auth[_0xe526('0x9')](),controller[_0xe526('0xc')]);router[_0xe526('0xb')](_0xe526('0xd'),auth[_0xe526('0x9')](),controller[_0xe526('0xe')]);router['get'](_0xe526('0xf'),auth[_0xe526('0x9')](),controller['getUnread']);router[_0xe526('0xb')](_0xe526('0x10'),auth[_0xe526('0x9')](),controller[_0xe526('0x11')]);router['get'](_0xe526('0x12'),auth[_0xe526('0x9')](),controller[_0xe526('0x13')]);router[_0xe526('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe526('0x14')](_0xe526('0x10'),auth['isAuthenticated'](),controller[_0xe526('0x15')]);router['post'](_0xe526('0x12'),auth[_0xe526('0x9')](),controller[_0xe526('0x16')]);router['put'](_0xe526('0xd'),auth['isAuthenticated'](),controller[_0xe526('0x17')]);router[_0xe526('0x18')]('/:id',auth[_0xe526('0x9')](),controller[_0xe526('0x19')]);router[_0xe526('0x18')](_0xe526('0x10'),auth[_0xe526('0x9')](),controller['removeMembers']);module[_0xe526('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 8a45b7c..24720e1 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 _0xdf92=['ENUM','star','thumb','TEXT','STRING','DATE','long','BOOLEAN','sequelize','INTEGER'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xdf92,0x10c));var _0x2df9=function(_0x284142,_0x3b65a8){_0x284142=_0x284142-0x0;var _0x3e8e47=_0xdf92[_0x284142];return _0x3e8e47;};'use strict';var Sequelize=require(_0x2df9('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2df9('0x1')]},'ratingType':{'type':Sequelize[_0x2df9('0x2')](_0x2df9('0x3'),_0x2df9('0x4')),'defaultValue':_0x2df9('0x3')},'ratingMessage':{'type':Sequelize[_0x2df9('0x5')]},'pathTranscript':{'type':Sequelize[_0x2df9('0x5')]},'mailTranscript':{'type':Sequelize[_0x2df9('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2df9('0x7')]},'disposition':{'type':Sequelize[_0x2df9('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2df9('0x6')]},'note':{'type':Sequelize[_0x2df9('0x6')]},'browserName':{'type':Sequelize[_0x2df9('0x6')]},'browserVersion':{'type':Sequelize[_0x2df9('0x6')]},'osName':{'type':Sequelize[_0x2df9('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x2df9('0x6')]},'deviceVendor':{'type':Sequelize[_0x2df9('0x6')]},'deviceType':{'type':Sequelize[_0x2df9('0x6')]},'referer':{'type':Sequelize[_0x2df9('0x5')]},'customerIp':{'type':Sequelize[_0x2df9('0x6')]},'formData':{'type':Sequelize[_0x2df9('0x5')](_0x2df9('0x8'))},'read1stAt':{'type':Sequelize[_0x2df9('0x7')]},'lastMsgAt':{'type':Sequelize[_0x2df9('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x2df9('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x2df9('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x2df9('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x5423=['thumb','star','TEXT','DATE','STRING','out','BOOLEAN','sequelize','exports','INTEGER','ENUM'];(function(_0x284eb6,_0x323253){var _0xee57cc=function(_0x506e51){while(--_0x506e51){_0x284eb6['push'](_0x284eb6['shift']());}};_0xee57cc(++_0x323253);}(_0x5423,0xe3));var _0x3542=function(_0x2511b6,_0x315ba8){_0x2511b6=_0x2511b6-0x0;var _0x301456=_0x5423[_0x2511b6];return _0x301456;};'use strict';var Sequelize=require(_0x3542('0x0'));module[_0x3542('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3542('0x2')]},'ratingType':{'type':Sequelize[_0x3542('0x3')]('star',_0x3542('0x4')),'defaultValue':_0x3542('0x5')},'ratingMessage':{'type':Sequelize[_0x3542('0x6')]},'pathTranscript':{'type':Sequelize[_0x3542('0x6')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3542('0x7')]},'disposition':{'type':Sequelize[_0x3542('0x8')]},'secondDisposition':{'type':Sequelize[_0x3542('0x8')]},'thirdDisposition':{'type':Sequelize[_0x3542('0x8')]},'note':{'type':Sequelize[_0x3542('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x3542('0x8')]},'osVersion':{'type':Sequelize[_0x3542('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x3542('0x8')]},'deviceType':{'type':Sequelize[_0x3542('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x3542('0x8')]},'formData':{'type':Sequelize[_0x3542('0x6')]('long')},'read1stAt':{'type':Sequelize[_0x3542('0x7')]},'lastMsgAt':{'type':Sequelize[_0x3542('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x3542('0x3')]('in',_0x3542('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3542('0x8')]},'customerPort':{'type':Sequelize[_0x3542('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x3542('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3542('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3560e08..dc9bffd 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 _0x98d1=['message','info','result','catch','sendStatus','status','json','offset','limit','count','set','update','end','stack','name','render','merge','body','agent','index','map','ChatInteraction','rawAttributes','fieldName','chat','query','user','params','model','keys','intersection','fields','attributes','length','includeAll','include','options','find','create','destroy','describe','ChatWebsite','findOne','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','fullname','email','contact','account','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','file','originalname','basename','filename','type','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','root','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','Messages','User','ChatWebsiteId','ContactId','format','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','addMessage','omit','ids','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','ChatInteractionId','filter','$gte','split','rows','getMyMessages','pick','findAll','addTags','setTags','spread','color','chatInteractionTags:save','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','push','firstName','lastName','direction','read','Account','get','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','closedAt','toString','browserName','osName','referer','customerPort','N.A.','tail','existsSync','pipe','Contact','value','renderFile','views','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x34149c,_0x2601d1){var _0x50dd97=function(_0x5848a8){while(--_0x5848a8){_0x34149c['push'](_0x34149c['shift']());}};_0x50dd97(++_0x2601d1);}(_0x98d1,0x17e));var _0x198d=function(_0xd304de,_0x4fb962){_0xd304de=_0xd304de-0x0;var _0x2f6f06=_0x98d1[_0xd304de];return _0x2f6f06;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x198d('0x0'));var rp=require(_0x198d('0x1'));var moment=require(_0x198d('0x2'));var BPromise=require(_0x198d('0x3'));var Mustache=require(_0x198d('0x4'));var util=require(_0x198d('0x5'));var path=require(_0x198d('0x6'));var ejs=require(_0x198d('0x7'));var fs=require('fs');var _=require(_0x198d('0x8'));var Redis=require(_0x198d('0x9'));var interaction=require(_0x198d('0xa'));var qs=require(_0x198d('0xb'));var pdf=require(_0x198d('0xc'));var logger=require(_0x198d('0xd'))(_0x198d('0xe'));var config=require('../../config/environment');var db=require(_0x198d('0xf'))['db'];config[_0x198d('0x10')]=_[_0x198d('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x198d('0x12'))(new Redis(config['redis']));require(_0x198d('0x13'))['register'](socket);var jayson=require(_0x198d('0x14'));var client=jayson[_0x198d('0x15')][_0x198d('0x16')]({'port':0x232b});var client9004=jayson[_0x198d('0x15')][_0x198d('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x2c42df,_0x2b1a44,_0x34979a,_0x6a104d){return new BPromise(function(_0x1594a0,_0x3e2931){var _0x308d93=_0x6a104d||client;return _0x308d93[_0x198d('0x17')](_0x2c42df,_0x34979a)[_0x198d('0x18')](function(_0x5912e8){logger['info'](_0x198d('0x19'),_0x2b1a44,'request\x20sent');logger[_0x198d('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2b1a44,_0x198d('0x1b'),JSON[_0x198d('0x1c')](_0x5912e8));if(_0x5912e8['error']){if(_0x5912e8['error']['code']===0x1f4){logger['error'](_0x198d('0x19'),_0x2b1a44,_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);return _0x3e2931(_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);}logger[_0x198d('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x2b1a44,_0x5912e8[_0x198d('0x1d')][_0x198d('0x1e')]);return _0x1594a0(_0x5912e8['error']['message']);}else{logger[_0x198d('0x1f')](_0x198d('0x19'),_0x2b1a44,_0x198d('0x1b'));_0x1594a0(_0x5912e8[_0x198d('0x20')][_0x198d('0x1e')]);}})[_0x198d('0x21')](function(_0x519d05){logger[_0x198d('0x1d')](_0x198d('0x19'),_0x2b1a44,_0x519d05);_0x3e2931(_0x519d05);});});}function respondWithStatusCode(_0x2677e5,_0x5cbfe2){_0x5cbfe2=_0x5cbfe2||0xcc;return function(_0x41ff8a){if(_0x41ff8a){return _0x2677e5[_0x198d('0x22')](_0x5cbfe2);}return _0x2677e5[_0x198d('0x23')](_0x5cbfe2)['end']();};}function respondWithResult(_0x1f0bb4,_0x179101){_0x179101=_0x179101||0xc8;return function(_0xe7718c){if(_0xe7718c){return _0x1f0bb4['status'](_0x179101)[_0x198d('0x24')](_0xe7718c);}};}function respondWithFilteredResult(_0xdd1a55,_0xdecb09){return function(_0x57ae30){if(_0x57ae30){var _0x1ba39a=typeof _0xdecb09[_0x198d('0x25')]==='undefined'&&typeof _0xdecb09[_0x198d('0x26')]==='undefined';var _0x1e9f12=_0x57ae30[_0x198d('0x27')];var _0x4bfd7d=_0x1ba39a?0x0:_0xdecb09[_0x198d('0x25')];var _0x8359ed=_0x1ba39a?_0x57ae30[_0x198d('0x27')]:_0xdecb09[_0x198d('0x25')]+_0xdecb09[_0x198d('0x26')];var _0x25aeca;if(_0x8359ed>=_0x1e9f12){_0x8359ed=_0x1e9f12;_0x25aeca=0xc8;}else{_0x25aeca=0xce;}_0xdd1a55['status'](_0x25aeca);return _0xdd1a55[_0x198d('0x28')]('Content-Range',_0x4bfd7d+'-'+_0x8359ed+'/'+_0x1e9f12)['json'](_0x57ae30);}return null;};}function saveUpdates(_0x40a016){return function(_0x3f4b94){if(_0x3f4b94){return _0x3f4b94[_0x198d('0x29')](_0x40a016)[_0x198d('0x18')](function(_0x3dbe3e){return _0x3dbe3e;});}return null;};}function removeEntity(_0x5c2323){return function(_0x35a65c){if(_0x35a65c){return _0x35a65c['destroy']()[_0x198d('0x18')](function(){_0x5c2323['status'](0xcc)[_0x198d('0x2a')]();});}};}function handleEntityNotFound(_0x7487f0){return function(_0x413434){if(!_0x413434){_0x7487f0['sendStatus'](0x194);}return _0x413434;};}function handleError(_0x3c22f8,_0x6f1268){_0x6f1268=_0x6f1268||0x1f4;return function(_0x209033){logger[_0x198d('0x1d')](_0x209033[_0x198d('0x2b')]);if(_0x209033['name']){delete _0x209033[_0x198d('0x2c')];}_0x3c22f8['status'](_0x6f1268)['send'](_0x209033);};}function getMustacheRender(_0x2536f3,_0x3a82ea){return Mustache[_0x198d('0x2d')](_0x2536f3,_[_0x198d('0x2e')](_0x3a82ea[_0x198d('0x2f')],{'contact':_0x3a82ea['contact'],'message':_0x3a82ea[_0x198d('0x1e')],'agent':_0x3a82ea[_0x198d('0x30')],'interaction':_0x3a82ea['interaction'],'account':_0x3a82ea['account']}))||'';}exports[_0x198d('0x31')]=function(_0xe06925,_0xfef050){var _0x5b9607={};var _0x27e86f=_[_0x198d('0x32')](db[_0x198d('0x33')][_0x198d('0x34')],function(_0x24eb8b){return{'name':_0x24eb8b[_0x198d('0x35')],'type':_0x24eb8b['type']['key']};});_0x5b9607=qs['getOptions'](_0x27e86f,_0xe06925);return interaction['findAll'](_0x198d('0x36'),_0xe06925[_0x198d('0x37')],_0xe06925[_0x198d('0x38')],_0x5b9607,_0x27e86f)[_0x198d('0x18')](respondWithFilteredResult(_0xfef050,_0x5b9607))[_0x198d('0x21')](handleError(_0xfef050,null));};exports['show']=function(_0x18f3a9,_0x485b56){var _0x132fd8={'raw':![],'where':{'id':_0x18f3a9[_0x198d('0x39')]['id']}},_0x295c15={};_0x295c15[_0x198d('0x3a')]=_[_0x198d('0x3b')](db['ChatInteraction'][_0x198d('0x34')]);_0x295c15[_0x198d('0x37')]=_[_0x198d('0x3b')](_0x18f3a9['query']);_0x295c15['filters']=_[_0x198d('0x3c')](_0x295c15['model'],_0x295c15['query']);_0x132fd8['attributes']=_['intersection'](_0x295c15[_0x198d('0x3a')],qs[_0x198d('0x3d')](_0x18f3a9[_0x198d('0x37')][_0x198d('0x3d')]));_0x132fd8[_0x198d('0x3e')]=_0x132fd8[_0x198d('0x3e')][_0x198d('0x3f')]?_0x132fd8[_0x198d('0x3e')]:_0x295c15[_0x198d('0x3a')];if(_0x18f3a9[_0x198d('0x37')][_0x198d('0x40')]){_0x132fd8[_0x198d('0x41')]=[{'all':!![]}];}_0x132fd8=_[_0x198d('0x2e')]({},_0x132fd8,_0x18f3a9[_0x198d('0x42')]);return db[_0x198d('0x33')][_0x198d('0x43')](_0x132fd8)[_0x198d('0x18')](handleEntityNotFound(_0x485b56,null))[_0x198d('0x18')](respondWithResult(_0x485b56,null))['catch'](handleError(_0x485b56,null));};exports[_0x198d('0x44')]=function(_0x27bca8,_0xf99b6){return db['ChatInteraction'][_0x198d('0x44')](_0x27bca8[_0x198d('0x2f')],{})['then'](respondWithResult(_0xf99b6,0xc9))[_0x198d('0x21')](handleError(_0xf99b6,null));};exports[_0x198d('0x29')]=function(_0x4f8e69,_0x5b56fd){if(_0x4f8e69[_0x198d('0x2f')]['id']){delete _0x4f8e69['body']['id'];}return db['ChatInteraction'][_0x198d('0x43')]({'where':{'id':_0x4f8e69[_0x198d('0x39')]['id']}})['then'](handleEntityNotFound(_0x5b56fd,null))[_0x198d('0x18')](saveUpdates(_0x4f8e69['body'],null))[_0x198d('0x18')](respondWithResult(_0x5b56fd,null))[_0x198d('0x21')](handleError(_0x5b56fd,null));};exports[_0x198d('0x45')]=function(_0x19c4df,_0x5edbc4){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x19c4df[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x5edbc4,null))[_0x198d('0x18')](removeEntity(_0x5edbc4,null))[_0x198d('0x21')](handleError(_0x5edbc4,null));};exports[_0x198d('0x46')]=function(_0x21c82c,_0x5b2cd6){return db[_0x198d('0x33')]['describe']()['then'](respondWithResult(_0x5b2cd6,null))[_0x198d('0x21')](handleError(_0x5b2cd6,null));};exports['createVidaooSession']=function(_0x427347,_0x33fe7f){var _0x48e9dc=_0x427347[_0x198d('0x39')]['id'];var _0x1d2a7a;var _0xfdc0ae;var _0x3ef57a;return db[_0x198d('0x33')]['findOne']({'where':{'id':_0x48e9dc}})[_0x198d('0x18')](function(_0x4bfce0){_0x1d2a7a=_0x4bfce0;return db[_0x198d('0x47')][_0x198d('0x48')]({'where':{'id':_0x4bfce0['ChatWebsiteId']},'attributes':['id',_0x198d('0x49'),'vidaooEscalation',_0x198d('0x4a'),'vidaooNote',_0x198d('0x4b')],'raw':!![]});})[_0x198d('0x18')](function(_0x59784f){if(_0x59784f&&_0x59784f['vidaooApiKey']&&_0x59784f[_0x198d('0x4c')]){_0xfdc0ae=_0x59784f;var _0x5b1ad5={'interaction':{'id':_0x48e9dc},'agent':{'id':_0x427347[_0x198d('0x38')]['id'],'name':_0x427347['user'][_0x198d('0x2c')],'fullname':_0x427347[_0x198d('0x38')][_0x198d('0x4d')],'email':_0x427347[_0x198d('0x38')][_0x198d('0x4e')]},'contact':_0x427347['body'][_0x198d('0x4f')],'account':_0x427347[_0x198d('0x2f')][_0x198d('0x50')]};var _0x81c310={'rejectUnauthorized':![],'method':_0x198d('0x51'),'url':_0x198d('0x52'),'headers':{'X-APIKEY':_0x59784f[_0x198d('0x49')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x427347[_0x198d('0x38')][_0x198d('0x4e')]],'buttons':null,'topic':_0xfdc0ae[_0x198d('0x4a')],'note':_[_0x198d('0x53')](_0xfdc0ae[_0x198d('0x54')])?null:getMustacheRender(_0xfdc0ae['vidaooNote'],_0x5b1ad5),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x198d('0x53')](_0xfdc0ae['vidaooMetadata'])){var _0x2be653=getMustacheRender(_0xfdc0ae['vidaooMetadata'],_0x5b1ad5);var _0x2b140d=JSON[_0x198d('0x55')](_0x2be653);_0x81c310['body'][_0x198d('0x56')]=_0x2b140d;}}catch(_0x5ac897){throw new db[(_0x198d('0x57'))]['ValidationError'](_0x198d('0x58'));}return rp(_0x81c310);}else{throw new db['Sequelize'][(_0x198d('0x59'))](_0x198d('0x5a'));}})[_0x198d('0x18')](function(_0x3c2c24){_0x3ef57a=_0x3c2c24;if(_0x3ef57a['id']){var _0x2aa6f5={'body':_0x3ef57a['join_url'],'ChatWebsiteId':_0xfdc0ae['id'],'ChatInteractionId':_0x1d2a7a['id'],'direction':_0x198d('0x5b'),'UserId':_0x427347[_0x198d('0x38')]['id']};return db[_0x198d('0x5c')][_0x198d('0x44')](_0x2aa6f5,{});}else{throw new db[(_0x198d('0x57'))][(_0x198d('0x59'))](_0x198d('0x5d'));}})[_0x198d('0x18')](function(){return _0x1d2a7a[_0x198d('0x5e')]({'vidaooSessionId':_0x3ef57a['id']});})[_0x198d('0x18')](respondWithResult(_0x33fe7f,null))['catch'](handleError(_0x33fe7f,null));};exports[_0x198d('0x5f')]=function(_0x5c7d3f,_0x271a90){if(_0x5c7d3f[_0x198d('0x2f')]['id']){delete _0x5c7d3f[_0x198d('0x2f')]['id'];}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x5c7d3f[_0x198d('0x39')]['id']},'include':[{'model':db[_0x198d('0x60')],'as':'Contact'}]})[_0x198d('0x18')](handleEntityNotFound(_0x271a90,null))[_0x198d('0x18')](saveUpdates(_0x5c7d3f[_0x198d('0x2f')],null))[_0x198d('0x18')](respondWithResult(_0x271a90,null))[_0x198d('0x21')](handleError(_0x271a90,null));};exports[_0x198d('0x61')]=function(_0x1f54ea,_0x120a1a){if(_0x1f54ea['body']['id']){delete _0x1f54ea[_0x198d('0x2f')]['id'];}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x1f54ea[_0x198d('0x39')]['id']}})[_0x198d('0x18')](function(_0x34fff4){if(!_0x34fff4){logger[_0x198d('0x1d')](_0x198d('0x62'),'abandon',0x194,_0x198d('0x63'));_0x120a1a[_0x198d('0x22')](0x194);}else{if(_0x34fff4[_0x198d('0x64')]){throw new db[(_0x198d('0x57'))]['ValidationError'](_0x198d('0x65'));}}return _0x34fff4;})['then'](function(_0x80f4f4){if(_0x80f4f4){return _0x80f4f4['update']({'closed':_0x1f54ea[_0x198d('0x2f')][_0x198d('0x66')],'disposition':_0x1f54ea[_0x198d('0x2f')][_0x198d('0x67')]})[_0x198d('0x18')](function(_0x556b26){return _0x556b26;});}})[_0x198d('0x18')](function(){return respondWithRpcPromise(_0x198d('0x68'),_0x198d('0x61'),_0x1f54ea[_0x198d('0x2f')],client9004);})[_0x198d('0x18')](respondWithResult(_0x120a1a,null))[_0x198d('0x21')](handleError(_0x120a1a,null));};exports['attachmentUpload']=function(_0x1b6542,_0x3e0808){_0x1b6542[_0x198d('0x2f')][_0x198d('0x2c')]=_0x1b6542[_0x198d('0x69')][_0x198d('0x6a')];_0x1b6542[_0x198d('0x2f')][_0x198d('0x6b')]=_0x1b6542['file'][_0x198d('0x6c')];_0x1b6542['body'][_0x198d('0x6d')]=_0x1b6542['file'][_0x198d('0x6e')];return db[_0x198d('0x6f')]['create'](_0x1b6542['body'])[_0x198d('0x18')](respondWithResult(_0x3e0808,0xc9))[_0x198d('0x21')](handleError(_0x3e0808,null));};exports[_0x198d('0x70')]=function(_0xc3e7ad,_0xab5513){return db[_0x198d('0x33')][_0x198d('0x48')]({'where':{'id':_0xc3e7ad[_0x198d('0x39')]['id']},'raw':!![]})[_0x198d('0x18')](handleEntityNotFound(_0xab5513,null))[_0x198d('0x18')](function(_0x5bae7b){if(_0x5bae7b){if(_0x5bae7b[_0x198d('0x66')]){return _0xab5513[_0x198d('0x23')](0x193)[_0x198d('0x24')]({'status':0x193,'message':_0x198d('0x71')});}return db[_0x198d('0x6f')][_0x198d('0x48')]({'where':{'id':_0xc3e7ad[_0x198d('0x37')]['attachId']},'raw':!![]})[_0x198d('0x18')](handleEntityNotFound(_0xab5513,null));}})[_0x198d('0x18')](function(_0x5e1504){if(_0x5e1504){var _0x4a4462=_0x5e1504[_0x198d('0x72')]!==null;var _0x209c46=path[_0x198d('0x73')](config[_0x198d('0x74')],'server/files/attachments/');if(_0x4a4462){_0x209c46=path[_0x198d('0x73')](_0x209c46,'offline-chat/');}var _0x44479c=path[_0x198d('0x73')](_0x209c46,_0x5e1504[_0x198d('0x6b')]);return _0xab5513[_0x198d('0x75')](_0x44479c);}})[_0x198d('0x21')](handleError(_0xab5513,null));};exports[_0x198d('0x76')]=function(_0x400bc2,_0x5f2435){var _0x166ae1=null;var _0x495fa0=null;var _0x5cb25a=null;if(_0x400bc2[_0x198d('0x2f')]['id']){delete _0x400bc2[_0x198d('0x2f')]['id'];}if(_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')]){_0x5cb25a=path[_0x198d('0x73')](config[_0x198d('0x74')],_0x198d('0x78'),util['format']('transcript-%s.txt',Date[_0x198d('0x79')]()));_0x400bc2[_0x198d('0x2f')][_0x198d('0x7a')]=_0x5cb25a;}return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x400bc2[_0x198d('0x39')]['id']},'include':[{'model':db[_0x198d('0x5c')],'as':_0x198d('0x7b'),'include':[{'model':db[_0x198d('0x7c')],'as':_0x198d('0x7c')}]}]})[_0x198d('0x18')](handleEntityNotFound(_0x5f2435,null))[_0x198d('0x18')](saveUpdates(_0x400bc2[_0x198d('0x2f')],null))[_0x198d('0x18')](function(_0x4abba4){if(_0x4abba4){_0x166ae1=_0x4abba4;return db[_0x198d('0x47')][_0x198d('0x43')]({'where':{'id':_0x166ae1[_0x198d('0x7d')]}});}})[_0x198d('0x18')](function(_0x5a037a){if(_0x5a037a){_0x495fa0=_0x5a037a;return db['CmContact']['find']({'where':{'id':_0x166ae1[_0x198d('0x7e')]}});}})[_0x198d('0x18')](function(_0x457bb3){if(_0x457bb3){if(_0x5cb25a){var _0x2c20d3=null;for(var _0x574418=0x1;_0x574418<_0x166ae1[_0x198d('0x7b')][_0x198d('0x3f')];++_0x574418){_0x2c20d3=_0x166ae1[_0x198d('0x7b')][_0x574418];var _0x1d37f0=_0x2c20d3[_0x198d('0x64')]?util[_0x198d('0x7f')](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):_0x198d('0x82');var _0xa9d871=_0x400bc2[_0x198d('0x2f')][_0x198d('0x83')]||util[_0x198d('0x7f')](_0x198d('0x80'),_0x198d('0x84'),_0x2c20d3[_0x198d('0x7e')]);switch(_0x495fa0[_0x198d('0x85')]){case _0x198d('0x86'):_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?util['format'](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):'System';break;case _0x198d('0x87'):_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?_0x2c20d3[_0x198d('0x7c')][_0x198d('0x88')]||_0x2c20d3[_0x198d('0x7c')][_0x198d('0x4d')]:_0x198d('0x82');break;case'agent_fullname':_0x1d37f0=_0x2c20d3[_0x198d('0x64')]?_0x2c20d3[_0x198d('0x7c')][_0x198d('0x4d')]:_0x198d('0x82');break;default:_0x1d37f0=_0x2c20d3['UserId']?util[_0x198d('0x7f')](_0x198d('0x80'),_0x495fa0[_0x198d('0x81')],_0x2c20d3[_0x198d('0x64')]):'System';}var _0x592ef3=util[_0x198d('0x7f')](_0x198d('0x89'),moment(_0x2c20d3[_0x198d('0x8a')])[_0x198d('0x7f')](_0x198d('0x8b')),_0x2c20d3['direction']==='in'?_0xa9d871:_0x1d37f0,_0x2c20d3[_0x198d('0x2f')]);if(!_0x2c20d3[_0x198d('0x8c')]){fs['appendFileSync'](_0x5cb25a,_0x592ef3);}}return db['MailAccount'][_0x198d('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0x198d('0x8d')],'as':_0x198d('0x8e'),'raw':!![],'include':[{'model':db[_0x198d('0x8f')],'as':_0x198d('0x8f'),'raw':!![]}]}]});}}})[_0x198d('0x18')](function(_0x110c93){if(!_0x110c93||!_0x110c93[_0x198d('0x8e')]||!_0x400bc2[_0x198d('0x2f')])return _0x166ae1;var _0x3b8a87=_0x110c93[_0x198d('0x90')]();return respondWithRpcPromise(_0x198d('0x91'),_0x198d('0x92'),{'account':_0x3b8a87,'message':{'from':util[_0x198d('0x7f')]('\x22%s\x22\x20<%s>',_0x110c93[_0x198d('0x2c')],_0x110c93[_0x198d('0x4e')]||_0x110c93[_0x198d('0x8e')][_0x198d('0x38')]),'to':_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')],'subject':_0x198d('0x93'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x400bc2[_0x198d('0x2f')][_0x198d('0x77')]),'attachments':[{'path':_0x5cb25a}]}})['then'](function(){return _0x166ae1;})[_0x198d('0x21')](function(_0x4a9a68){logger['error'](_0x4a9a68);});})[_0x198d('0x18')](respondWithStatusCode(_0x5f2435,0xc8))[_0x198d('0x21')](handleError(_0x5f2435,null));};exports[_0x198d('0x94')]=function(_0x10dfc6,_0x1d127a){return db[_0x198d('0x5c')]['find']({'where':{'id':_0x10dfc6[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x1d127a,null))[_0x198d('0x18')](function(_0x46dfb4){if(_0x46dfb4){return _0x46dfb4[_0x198d('0x94')](_0x10dfc6[_0x198d('0x2f')]['ids'],_[_0x198d('0x95')](_0x10dfc6[_0x198d('0x2f')],[_0x198d('0x96'),'id'])||{});}})[_0x198d('0x18')](respondWithResult(_0x1d127a,null))[_0x198d('0x21')](handleError(_0x1d127a,null));};exports[_0x198d('0x97')]=function(_0x3d6d0a,_0x59e554){var _0x3dacf8={'raw':![],'where':{}};var _0x14745d={};var _0x39533e={'count':0x0,'rows':[]};return db[_0x198d('0x33')][_0x198d('0x48')]({'where':{'id':_0x3d6d0a[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x59e554,null))[_0x198d('0x18')](function(_0x412eee){if(_0x412eee){_0x14745d[_0x198d('0x3a')]=_[_0x198d('0x3b')](db['ChatMessage'][_0x198d('0x34')]);_0x14745d[_0x198d('0x37')]=_['keys'](_0x3d6d0a[_0x198d('0x37')]);_0x14745d[_0x198d('0x98')]=_[_0x198d('0x3c')](_0x14745d[_0x198d('0x3a')],_0x14745d[_0x198d('0x37')]);_0x3dacf8['attributes']=_[_0x198d('0x3c')](_0x14745d['model'],qs[_0x198d('0x3d')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x3d')]));_0x3dacf8[_0x198d('0x3e')]=_0x3dacf8[_0x198d('0x3e')][_0x198d('0x3f')]?_0x3dacf8[_0x198d('0x3e')]:_0x14745d[_0x198d('0x3a')];if(!_0x3d6d0a['query'][_0x198d('0x99')](_0x198d('0x9a'))){_0x3dacf8[_0x198d('0x26')]=qs[_0x198d('0x26')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x26')]);_0x3dacf8[_0x198d('0x25')]=qs[_0x198d('0x25')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x25')]);}_0x3dacf8[_0x198d('0x9b')]=qs[_0x198d('0x9c')](_0x3d6d0a[_0x198d('0x37')][_0x198d('0x9c')]);_0x3dacf8['where']=qs[_0x198d('0x98')](_['pick'](_0x3d6d0a[_0x198d('0x37')],_0x14745d['filters']));_0x3dacf8[_0x198d('0x9d')][_0x198d('0x9e')]=_0x412eee['id'];if(_0x3d6d0a[_0x198d('0x37')][_0x198d('0x9f')]){_0x3dacf8[_0x198d('0x9d')]=_['merge'](_0x3dacf8[_0x198d('0x9d')],{'$or':_['map'](_0x3dacf8[_0x198d('0x3e')],function(_0x4bf194){var _0x360538={};_0x360538[_0x4bf194]={'$like':'%'+_0x3d6d0a[_0x198d('0x37')]['filter']+'%'};return _0x360538;})});}if(_0x3d6d0a[_0x198d('0x37')]['$gte']){var _0x2e75f6=_0x3d6d0a[_0x198d('0x37')][_0x198d('0xa0')][_0x198d('0xa1')](',');var _0x378d87={};_0x378d87[_0x2e75f6[0x0]]={'$gte':moment(_0x2e75f6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3dacf8[_0x198d('0x9d')]=_[_0x198d('0x2e')](_0x3dacf8[_0x198d('0x9d')],_0x378d87);}_0x3dacf8=_[_0x198d('0x2e')]({},_0x3dacf8,_0x3d6d0a[_0x198d('0x42')]);return db[_0x198d('0x5c')][_0x198d('0x27')]({'where':_0x3dacf8['where']})[_0x198d('0x18')](function(_0xe2468d){_0x39533e['count']=_0xe2468d;if(_0x3d6d0a['query']['includeAll']){_0x3dacf8[_0x198d('0x41')]=[{'all':!![]}];}return db[_0x198d('0x5c')]['findAll'](_0x3dacf8);})[_0x198d('0x18')](function(_0xa6f0ca){_0x39533e[_0x198d('0xa2')]=_0xa6f0ca;return _0x39533e;});}})[_0x198d('0x18')](respondWithFilteredResult(_0x59e554,_0x3dacf8))['catch'](handleError(_0x59e554,null));};exports[_0x198d('0xa3')]=function(_0x13ced1,_0x4613bc){var _0x5bd0b5={'where':{}},_0x47d1db={},_0x656c0={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x198d('0x48')]({'where':{'id':_0x13ced1[_0x198d('0x39')]['id']}})['then'](handleEntityNotFound(_0x4613bc,null))['then'](function(_0x3ae2be){if(_0x3ae2be){_0x47d1db[_0x198d('0x3a')]=_[_0x198d('0x3b')](db[_0x198d('0x5c')][_0x198d('0x34')]);_0x47d1db[_0x198d('0x37')]=_[_0x198d('0x3b')](_0x13ced1[_0x198d('0x37')]);_0x47d1db[_0x198d('0x98')]=_['intersection'](_0x47d1db[_0x198d('0x3a')],_0x47d1db[_0x198d('0x37')]);_0x5bd0b5[_0x198d('0x3e')]=_['intersection'](_0x47d1db[_0x198d('0x3a')],qs[_0x198d('0x3d')](_0x13ced1[_0x198d('0x37')][_0x198d('0x3d')]));_0x5bd0b5[_0x198d('0x3e')]=_0x5bd0b5[_0x198d('0x3e')]['length']?_0x5bd0b5[_0x198d('0x3e')]:_0x47d1db[_0x198d('0x3a')];if(!_0x13ced1[_0x198d('0x37')][_0x198d('0x99')]('nolimit')){_0x5bd0b5['limit']=qs[_0x198d('0x26')](_0x13ced1[_0x198d('0x37')]['limit']);_0x5bd0b5[_0x198d('0x25')]=qs[_0x198d('0x25')](_0x13ced1[_0x198d('0x37')][_0x198d('0x25')]);}_0x5bd0b5[_0x198d('0x9b')]=qs[_0x198d('0x9c')](_0x13ced1[_0x198d('0x37')]['sort']);_0x5bd0b5['where']=qs[_0x198d('0x98')](_[_0x198d('0xa4')](_0x13ced1[_0x198d('0x37')],_0x47d1db[_0x198d('0x98')]));_0x5bd0b5['where'][_0x198d('0x9e')]=_0x3ae2be['id'];if(_0x13ced1[_0x198d('0x37')][_0x198d('0x9f')]){_0x5bd0b5[_0x198d('0x9d')]=_['merge'](_0x5bd0b5[_0x198d('0x9d')],{'$or':_[_0x198d('0x32')](_0x5bd0b5['attributes'],function(_0x26b400){var _0x52d28e={};_0x52d28e[_0x26b400]={'$like':'%'+_0x13ced1[_0x198d('0x37')][_0x198d('0x9f')]+'%'};return _0x52d28e;})});}_0x5bd0b5['where']['secret']=![];if(_0x13ced1[_0x198d('0x37')]['id']){_0x5bd0b5[_0x198d('0x9d')]['id']={'$gt':_0x13ced1[_0x198d('0x37')]['id']};}_0x5bd0b5=_[_0x198d('0x2e')]({},_0x5bd0b5,_0x13ced1['options']);return db[_0x198d('0x5c')][_0x198d('0x27')]({'where':_0x5bd0b5[_0x198d('0x9d')]})[_0x198d('0x18')](function(_0x4cdbf7){_0x656c0[_0x198d('0x27')]=_0x4cdbf7;_0x5bd0b5[_0x198d('0x41')]=[];if(_0x13ced1['query']['includeAgent']){_0x5bd0b5[_0x198d('0x41')]['push']({'model':db[_0x198d('0x7c')],'as':'User','attributes':['id',_0x198d('0x4d'),_0x198d('0x88')]});}if(_0x13ced1[_0x198d('0x37')][_0x198d('0x40')]){_0x5bd0b5[_0x198d('0x41')]=[{'all':!![]}];}return db[_0x198d('0x5c')][_0x198d('0xa5')](_0x5bd0b5);})['then'](function(_0x554b4f){_0x656c0['rows']=_0x554b4f;return _0x656c0;});}})['then'](respondWithFilteredResult(_0x4613bc,_0x5bd0b5))[_0x198d('0x21')](handleError(_0x4613bc,null));};exports[_0x198d('0xa6')]=function(_0x527958,_0x2d04a8){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x527958[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x2d04a8,null))[_0x198d('0x18')](function(_0x1b8e2d){if(_0x1b8e2d){return _0x1b8e2d[_0x198d('0xa7')](_0x527958[_0x198d('0x2f')]['ids'],_[_0x198d('0x95')](_0x527958[_0x198d('0x2f')],[_0x198d('0x96'),'id'])||{})[_0x198d('0xa8')](function(){return db['Tag'][_0x198d('0xa5')]({'attributes':['id',_0x198d('0x2c'),_0x198d('0xa9')],'where':{'id':_0x527958[_0x198d('0x2f')][_0x198d('0x96')]}});})[_0x198d('0x18')](function(_0x341795){socket['emit'](_0x198d('0xaa'),{'id':Number(_0x527958[_0x198d('0x39')]['id']),'tags':_0x341795||[]});return{'id':Number(_0x527958[_0x198d('0x39')]['id']),'tags':_0x341795||[]};});}})[_0x198d('0x18')](respondWithResult(_0x2d04a8,null))[_0x198d('0x21')](handleError(_0x2d04a8,null));};exports[_0x198d('0xab')]=function(_0x573d03,_0x29500b){return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x573d03[_0x198d('0x39')]['id']}})[_0x198d('0x18')](handleEntityNotFound(_0x29500b,null))['then'](function(_0x4e8a4e){if(_0x4e8a4e){return _0x4e8a4e['removeTags'](_0x573d03['query'][_0x198d('0x96')]);}})[_0x198d('0x18')](respondWithStatusCode(_0x29500b,null))[_0x198d('0x21')](handleError(_0x29500b,null));};exports[_0x198d('0x75')]=function(_0x42f0a5,_0x32e65d){var _0x34a02b=moment()['unix']()['toString']();var _0x5a944e=path[_0x198d('0x73')](config['root'],_0x198d('0xac'),_0x198d('0xad'),_0x198d('0xae'));var _0x4855f2=path[_0x198d('0x73')](config[_0x198d('0x74')],_0x198d('0xac'),_0x198d('0xad'),_0x198d('0xaf'));var _0x26b92f=path[_0x198d('0x73')](_0x5a944e,_0x34a02b);var _0x2e8bf9=util[_0x198d('0x7f')](_0x198d('0xb0'),_0x42f0a5['params']['id'],_0x34a02b);var _0x5c6f1b=path[_0x198d('0x73')](_0x5a944e,_0x2e8bf9);var _0xe61a3f=[];_0xe61a3f[_0x198d('0xb1')]({'model':db[_0x198d('0x7c')],'as':_0x198d('0x7c'),'attributes':['id',_0x198d('0x4d')],'raw':!![]});_0xe61a3f[_0x198d('0xb1')]({'model':db[_0x198d('0x60')],'as':'Contact','attributes':['id',_0x198d('0xb2'),_0x198d('0xb3')],'raw':!![]});if(_0x42f0a5[_0x198d('0x37')][_0x198d('0xaf')]){_0xe61a3f[_0x198d('0xb1')]({'model':db['Attachment'],'as':_0x198d('0x6f'),'raw':!![]});}var _0x40811d=[{'model':db[_0x198d('0x5c')],'as':_0x198d('0x7b'),'attributes':['id','body','createdAt',_0x198d('0xb4'),_0x198d('0x8c'),_0x198d('0xb5')],'include':_0xe61a3f}];_0x40811d[_0x198d('0xb1')]({'model':db[_0x198d('0x47')],'as':_0x198d('0xb6'),'attributes':['id','name']});_0x40811d[_0x198d('0xb1')]({'model':db[_0x198d('0x7c')],'as':'Owner','attributes':['id',_0x198d('0x4d')]});return db[_0x198d('0x33')][_0x198d('0x43')]({'where':{'id':_0x42f0a5[_0x198d('0x39')]['id']},'include':_0x40811d})[_0x198d('0x18')](handleEntityNotFound(_0x32e65d,null))[_0x198d('0x18')](function(_0x254348){if(_0x254348){var _0x1687cb=_0x254348[_0x198d('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x26b92f);var _0x1fdc74={'channel':_0x198d('0xb8'),'account':_0x1687cb[_0x198d('0xb6')][_0x198d('0x2c')],'agent':_0x1687cb['Owner']?_0x1687cb[_0x198d('0xb9')][_0x198d('0x4d')]:'N.A.','createdAt':moment(_0x1687cb['createdAt'])[_0x198d('0x7f')](_0x198d('0xba'))['toString'](),'closedAt':_0x1687cb[_0x198d('0x66')]?moment(_0x1687cb[_0x198d('0xbb')])[_0x198d('0x7f')](_0x198d('0xba'))[_0x198d('0xbc')]():'','disposition':_0x1687cb[_0x198d('0x67')],'chatInfo':{'browser':_0x1687cb[_0x198d('0xbd')],'os':_0x1687cb[_0x198d('0xbe')],'referer':_0x1687cb[_0x198d('0xbf')],'customerIp':_0x1687cb['customerIp'],'customerPort':_0x1687cb[_0x198d('0xc0')]?_0x1687cb[_0x198d('0xc0')]:_0x198d('0xc1')},'messages':_(_0x1687cb[_0x198d('0x7b')])[_0x198d('0xc2')]()[_0x198d('0x9f')]({'secret':![]})['map'](function(_0x81526f){if(_0x81526f['Attachment']){var _0x5c3728=path['join'](_0x4855f2,_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')]);if(fs[_0x198d('0xc3')](_0x5c3728)){fs['createReadStream'](_0x5c3728)[_0x198d('0xc4')](fs['createWriteStream'](path[_0x198d('0x73')](_0x26b92f,_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')])));}}return{'date':moment(_0x81526f[_0x198d('0x8a')])[_0x198d('0x7f')](_0x198d('0xba'))[_0x198d('0xbc')](),'sender':_0x81526f[_0x198d('0xb4')]===_0x198d('0x5b')?_0x81526f['User']?_0x81526f[_0x198d('0x7c')][_0x198d('0x4d')]:'System':_0x81526f['Contact']['firstName']+(_0x81526f[_0x198d('0xc5')]['lastName']?'\x20'+_0x81526f[_0x198d('0xc5')]['lastName']:''),'body':_0x81526f[_0x198d('0x6f')]?_0x81526f[_0x198d('0x6f')][_0x198d('0x6b')]:_0x81526f[_0x198d('0x2f')],'direction':_0x81526f[_0x198d('0xb4')]===_0x198d('0x5b')?'A':'C','secret':_0x81526f[_0x198d('0x8c')],'read':_0x81526f['read'],'attachment':_0x81526f[_0x198d('0x6f')]};})[_0x198d('0xc6')]()};return ejs[_0x198d('0xc7')](path['join'](config[_0x198d('0x74')],_0x198d('0xac'),_0x198d('0xc8'),'downloadInteraction.ejs'),{'interaction':_0x1fdc74})['then'](function(_0x20a048){var _0xadbc0b=path[_0x198d('0x73')](_0x26b92f,_0x198d('0xc9')+_0x1687cb['id']+'-'+_0x34a02b+_0x198d('0xca'));var _0x262a47={'path':_0xadbc0b,'channel':_0x198d('0xb8'),'interactionId':_0x1687cb['id']};return pdf[_0x198d('0xcb')](_0x20a048,_0x262a47);})[_0x198d('0x18')](function(){return new Promise(function(_0x2f1a97,_0x4ab7cc){zipdir(_0x26b92f,{'saveTo':_0x5c6f1b},function(_0x2cd0ab,_0x1ff145){if(_0x2cd0ab)return _0x4ab7cc(_0x2cd0ab);return _0x2f1a97(_0x1ff145);});})['then'](function(){return new BPromise(function(_0x1d573b,_0x5de48f){rimraf(_0x26b92f,function(_0x24cbe8){if(_0x24cbe8)_0x5de48f(_0x24cbe8);return _0x1d573b();});});})[_0x198d('0x18')](function(){return _0x32e65d[_0x198d('0x75')](_0x5c6f1b,_0x2e8bf9,function(_0x15dec3){if(_0x15dec3){logger[_0x198d('0x1d')](_0x198d('0xcc'),_0x15dec3);}else{fs[_0x198d('0xcd')](_0x5c6f1b);}});});});}else{return _0x32e65d[_0x198d('0x22')](0xc8);}})['catch'](handleError(_0x32e65d,null));}; \ No newline at end of file +var _0x12bb=['ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','update','sendStatus','stack','name','send','merge','body','agent','account','ChatInteraction','rawAttributes','fieldName','getOptions','findAll','query','user','params','model','keys','filters','intersection','attributes','fields','include','options','find','create','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','contact','vidaooApiKey','isNull','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','AbandonInteraction','abandon','file','basename','filename','type','mimetype','Attachment','attachmentDownload','closed','join','root','server/files/attachments/','offline-chat/','close','mailTranscript','transcript-%s.txt','now','Messages','User','CmContact','ContactId','length','format','%s%d','agentAlias','System','agentIdentifier','website_alias','agent_alias','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','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','order','sort','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','pick','map','includeAgent','alias','addTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','download','unix','files','tmp','server','attachments','transcript-%d-%s.zip','push','firstName','lastName','Account','Owner','get','mkdirSync','Chat','N.A.','toString','closedAt','disposition','browserName','osName','referer','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','read','value','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','moment','bluebird','util'];(function(_0x460513,_0x47eb27){var _0x1c0e0f=function(_0x4f00b6){while(--_0x4f00b6){_0x460513['push'](_0x460513['shift']());}};_0x1c0e0f(++_0x47eb27);}(_0x12bb,0x190));var _0xb12b=function(_0x201ce1,_0x3875fc){_0x201ce1=_0x201ce1-0x0;var _0x5737e2=_0x12bb[_0x201ce1];return _0x5737e2;};'use strict';var rimraf=require(_0xb12b('0x0'));var zipdir=require('zip-dir');var rp=require('request-promise');var moment=require(_0xb12b('0x1'));var BPromise=require(_0xb12b('0x2'));var Mustache=require('mustache');var util=require(_0xb12b('0x3'));var path=require('path');var ejs=require(_0xb12b('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb12b('0x5'));var interaction=require(_0xb12b('0x6'));var qs=require(_0xb12b('0x7'));var pdf=require(_0xb12b('0x8'));var logger=require(_0xb12b('0x9'))('api');var config=require('../../config/environment');var db=require(_0xb12b('0xa'))['db'];config[_0xb12b('0xb')]=_[_0xb12b('0xc')](config[_0xb12b('0xb')],{'host':_0xb12b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb12b('0xb')]));require('./chatInteraction.socket')[_0xb12b('0xe')](socket);var jayson=require(_0xb12b('0xf'));var client=jayson[_0xb12b('0x10')][_0xb12b('0x11')]({'port':0x232b});var client9004=jayson[_0xb12b('0x10')][_0xb12b('0x11')]({'port':0x232c});function respondWithRpcPromise(_0x141342,_0x3cd4da,_0x514f1a,_0x1a7142){return new BPromise(function(_0x2e5b75,_0xf17d4d){var _0x487add=_0x1a7142||client;return _0x487add[_0xb12b('0x12')](_0x141342,_0x514f1a)[_0xb12b('0x13')](function(_0x287696){logger[_0xb12b('0x14')](_0xb12b('0x15'),_0x3cd4da,'request\x20sent');logger[_0xb12b('0x16')](_0xb12b('0x17'),_0x3cd4da,_0xb12b('0x18'),JSON[_0xb12b('0x19')](_0x287696));if(_0x287696[_0xb12b('0x1a')]){if(_0x287696[_0xb12b('0x1a')][_0xb12b('0x1b')]===0x1f4){logger[_0xb12b('0x1a')](_0xb12b('0x15'),_0x3cd4da,_0x287696[_0xb12b('0x1a')][_0xb12b('0x1c')]);return _0xf17d4d(_0x287696[_0xb12b('0x1a')][_0xb12b('0x1c')]);}logger[_0xb12b('0x1a')](_0xb12b('0x15'),_0x3cd4da,_0x287696['error'][_0xb12b('0x1c')]);return _0x2e5b75(_0x287696[_0xb12b('0x1a')][_0xb12b('0x1c')]);}else{logger['info'](_0xb12b('0x15'),_0x3cd4da,_0xb12b('0x18'));_0x2e5b75(_0x287696[_0xb12b('0x1d')][_0xb12b('0x1c')]);}})[_0xb12b('0x1e')](function(_0x3b50dc){logger['error'](_0xb12b('0x15'),_0x3cd4da,_0x3b50dc);_0xf17d4d(_0x3b50dc);});});}function respondWithStatusCode(_0x2099d7,_0x131808){_0x131808=_0x131808||0xcc;return function(_0x14418a){if(_0x14418a){return _0x2099d7['sendStatus'](_0x131808);}return _0x2099d7['status'](_0x131808)[_0xb12b('0x1f')]();};}function respondWithResult(_0x39a229,_0x1962ab){_0x1962ab=_0x1962ab||0xc8;return function(_0x10a20c){if(_0x10a20c){return _0x39a229[_0xb12b('0x20')](_0x1962ab)[_0xb12b('0x21')](_0x10a20c);}};}function respondWithFilteredResult(_0x17a06f,_0x42a2aa){return function(_0x255b2d){if(_0x255b2d){var _0x29693f=typeof _0x42a2aa[_0xb12b('0x22')]===_0xb12b('0x23')&&typeof _0x42a2aa[_0xb12b('0x24')]==='undefined';var _0x204aa0=_0x255b2d['count'];var _0xde981f=_0x29693f?0x0:_0x42a2aa[_0xb12b('0x22')];var _0x123d5e=_0x29693f?_0x255b2d[_0xb12b('0x25')]:_0x42a2aa[_0xb12b('0x22')]+_0x42a2aa[_0xb12b('0x24')];var _0x10163d;if(_0x123d5e>=_0x204aa0){_0x123d5e=_0x204aa0;_0x10163d=0xc8;}else{_0x10163d=0xce;}_0x17a06f['status'](_0x10163d);return _0x17a06f[_0xb12b('0x26')](_0xb12b('0x27'),_0xde981f+'-'+_0x123d5e+'/'+_0x204aa0)[_0xb12b('0x21')](_0x255b2d);}return null;};}function saveUpdates(_0x385f64){return function(_0x2cba21){if(_0x2cba21){return _0x2cba21[_0xb12b('0x28')](_0x385f64)[_0xb12b('0x13')](function(_0x21c8a7){return _0x21c8a7;});}return null;};}function removeEntity(_0x9968da){return function(_0x3fde2a){if(_0x3fde2a){return _0x3fde2a['destroy']()['then'](function(){_0x9968da[_0xb12b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc60770){return function(_0x11cd6e){if(!_0x11cd6e){_0xc60770[_0xb12b('0x29')](0x194);}return _0x11cd6e;};}function handleError(_0x4cdc5d,_0x1a2081){_0x1a2081=_0x1a2081||0x1f4;return function(_0x196db1){logger['error'](_0x196db1[_0xb12b('0x2a')]);if(_0x196db1['name']){delete _0x196db1[_0xb12b('0x2b')];}_0x4cdc5d[_0xb12b('0x20')](_0x1a2081)[_0xb12b('0x2c')](_0x196db1);};}function getMustacheRender(_0x3a0ebb,_0x480ba0){return Mustache['render'](_0x3a0ebb,_[_0xb12b('0x2d')](_0x480ba0[_0xb12b('0x2e')],{'contact':_0x480ba0['contact'],'message':_0x480ba0['message'],'agent':_0x480ba0[_0xb12b('0x2f')],'interaction':_0x480ba0['interaction'],'account':_0x480ba0[_0xb12b('0x30')]}))||'';}exports['index']=function(_0x3333b0,_0x2704b4){var _0x13880b={};var _0x2d7d18=_['map'](db[_0xb12b('0x31')][_0xb12b('0x32')],function(_0x4c1fc9){return{'name':_0x4c1fc9[_0xb12b('0x33')],'type':_0x4c1fc9['type']['key']};});_0x13880b=qs[_0xb12b('0x34')](_0x2d7d18,_0x3333b0);return interaction[_0xb12b('0x35')]('chat',_0x3333b0[_0xb12b('0x36')],_0x3333b0[_0xb12b('0x37')],_0x13880b,_0x2d7d18)[_0xb12b('0x13')](respondWithFilteredResult(_0x2704b4,_0x13880b))[_0xb12b('0x1e')](handleError(_0x2704b4,null));};exports['show']=function(_0x1ee1fe,_0x121f71){var _0x3a2f51={'raw':![],'where':{'id':_0x1ee1fe[_0xb12b('0x38')]['id']}},_0x5dd3e7={};_0x5dd3e7[_0xb12b('0x39')]=_[_0xb12b('0x3a')](db[_0xb12b('0x31')][_0xb12b('0x32')]);_0x5dd3e7[_0xb12b('0x36')]=_[_0xb12b('0x3a')](_0x1ee1fe[_0xb12b('0x36')]);_0x5dd3e7[_0xb12b('0x3b')]=_[_0xb12b('0x3c')](_0x5dd3e7[_0xb12b('0x39')],_0x5dd3e7[_0xb12b('0x36')]);_0x3a2f51[_0xb12b('0x3d')]=_[_0xb12b('0x3c')](_0x5dd3e7[_0xb12b('0x39')],qs[_0xb12b('0x3e')](_0x1ee1fe[_0xb12b('0x36')][_0xb12b('0x3e')]));_0x3a2f51[_0xb12b('0x3d')]=_0x3a2f51[_0xb12b('0x3d')]['length']?_0x3a2f51['attributes']:_0x5dd3e7[_0xb12b('0x39')];if(_0x1ee1fe[_0xb12b('0x36')]['includeAll']){_0x3a2f51[_0xb12b('0x3f')]=[{'all':!![]}];}_0x3a2f51=_[_0xb12b('0x2d')]({},_0x3a2f51,_0x1ee1fe[_0xb12b('0x40')]);return db[_0xb12b('0x31')][_0xb12b('0x41')](_0x3a2f51)[_0xb12b('0x13')](handleEntityNotFound(_0x121f71,null))[_0xb12b('0x13')](respondWithResult(_0x121f71,null))[_0xb12b('0x1e')](handleError(_0x121f71,null));};exports[_0xb12b('0x42')]=function(_0x52b261,_0x5c0a0f){return db[_0xb12b('0x31')][_0xb12b('0x42')](_0x52b261[_0xb12b('0x2e')],{})[_0xb12b('0x13')](respondWithResult(_0x5c0a0f,0xc9))[_0xb12b('0x1e')](handleError(_0x5c0a0f,null));};exports['update']=function(_0xfbd81f,_0x13c979){if(_0xfbd81f[_0xb12b('0x2e')]['id']){delete _0xfbd81f['body']['id'];}return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0xfbd81f['params']['id']}})[_0xb12b('0x13')](handleEntityNotFound(_0x13c979,null))[_0xb12b('0x13')](saveUpdates(_0xfbd81f[_0xb12b('0x2e')],null))['then'](respondWithResult(_0x13c979,null))['catch'](handleError(_0x13c979,null));};exports[_0xb12b('0x43')]=function(_0x5656ce,_0x108f05){return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0x5656ce[_0xb12b('0x38')]['id']}})[_0xb12b('0x13')](handleEntityNotFound(_0x108f05,null))[_0xb12b('0x13')](removeEntity(_0x108f05,null))[_0xb12b('0x1e')](handleError(_0x108f05,null));};exports[_0xb12b('0x44')]=function(_0x16a5a4,_0x22a66d){return db['ChatInteraction']['describe']()[_0xb12b('0x13')](respondWithResult(_0x22a66d,null))[_0xb12b('0x1e')](handleError(_0x22a66d,null));};exports['createVidaooSession']=function(_0x57f178,_0x120db2){var _0x1f21e8=_0x57f178['params']['id'];var _0x4658b1;var _0x459a49;var _0x377a36;return db[_0xb12b('0x31')][_0xb12b('0x45')]({'where':{'id':_0x1f21e8}})[_0xb12b('0x13')](function(_0x3b218c){_0x4658b1=_0x3b218c;return db[_0xb12b('0x46')]['findOne']({'where':{'id':_0x3b218c[_0xb12b('0x47')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xb12b('0x48'),_0xb12b('0x49'),_0xb12b('0x4a')],'raw':!![]});})[_0xb12b('0x13')](function(_0x31b107){if(_0x31b107&&_0x31b107['vidaooApiKey']&&_0x31b107['vidaooEscalation']){_0x459a49=_0x31b107;var _0x5d3f68={'interaction':{'id':_0x1f21e8},'agent':{'id':_0x57f178['user']['id'],'name':_0x57f178[_0xb12b('0x37')]['name'],'fullname':_0x57f178[_0xb12b('0x37')][_0xb12b('0x4b')],'email':_0x57f178[_0xb12b('0x37')][_0xb12b('0x4c')]},'contact':_0x57f178[_0xb12b('0x2e')][_0xb12b('0x4d')],'account':_0x57f178[_0xb12b('0x2e')]['account']};var _0x414c7a={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x31b107[_0xb12b('0x4e')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x57f178['user'][_0xb12b('0x4c')]],'buttons':null,'topic':_0x459a49[_0xb12b('0x48')],'note':_[_0xb12b('0x4f')](_0x459a49[_0xb12b('0x49')])?null:getMustacheRender(_0x459a49[_0xb12b('0x49')],_0x5d3f68),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xb12b('0x4f')](_0x459a49[_0xb12b('0x4a')])){var _0x334899=getMustacheRender(_0x459a49['vidaooMetadata'],_0x5d3f68);var _0xc97dbd=JSON['parse'](_0x334899);_0x414c7a[_0xb12b('0x2e')][_0xb12b('0x50')]=_0xc97dbd;}}catch(_0x596406){throw new db[(_0xb12b('0x51'))][(_0xb12b('0x52'))](_0xb12b('0x53'));}return rp(_0x414c7a);}else{throw new db[(_0xb12b('0x51'))][(_0xb12b('0x52'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xb12b('0x13')](function(_0x260292){_0x377a36=_0x260292;if(_0x377a36['id']){var _0x3b8969={'body':_0x377a36[_0xb12b('0x54')],'ChatWebsiteId':_0x459a49['id'],'ChatInteractionId':_0x4658b1['id'],'direction':_0xb12b('0x55'),'UserId':_0x57f178[_0xb12b('0x37')]['id']};return db[_0xb12b('0x56')][_0xb12b('0x42')](_0x3b8969,{});}else{throw new db[(_0xb12b('0x51'))][(_0xb12b('0x52'))](_0xb12b('0x57'));}})['then'](function(){return _0x4658b1[_0xb12b('0x58')]({'vidaooSessionId':_0x377a36['id']});})['then'](respondWithResult(_0x120db2,null))[_0xb12b('0x1e')](handleError(_0x120db2,null));};exports[_0xb12b('0x59')]=function(_0x46220b,_0x30f8cc){if(_0x46220b[_0xb12b('0x2e')]['id']){delete _0x46220b[_0xb12b('0x2e')]['id'];}return db['ChatInteraction'][_0xb12b('0x41')]({'where':{'id':_0x46220b[_0xb12b('0x38')]['id']},'include':[{'model':db['CmContact'],'as':_0xb12b('0x5a')}]})[_0xb12b('0x13')](handleEntityNotFound(_0x30f8cc,null))[_0xb12b('0x13')](saveUpdates(_0x46220b[_0xb12b('0x2e')],null))[_0xb12b('0x13')](respondWithResult(_0x30f8cc,null))[_0xb12b('0x1e')](handleError(_0x30f8cc,null));};exports['abandon']=function(_0x282f85,_0x5e50ef){if(_0x282f85['body']['id']){delete _0x282f85['body']['id'];}return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0x282f85[_0xb12b('0x38')]['id']}})[_0xb12b('0x13')](function(_0x328290){if(!_0x328290){logger[_0xb12b('0x1a')](_0xb12b('0x5b'),'abandon',0x194,_0xb12b('0x5c'));_0x5e50ef[_0xb12b('0x29')](0x194);}else{if(_0x328290[_0xb12b('0x5d')]){throw new db[(_0xb12b('0x51'))][(_0xb12b('0x52'))]('Interaction\x20already\x20assigned');}}return _0x328290;})[_0xb12b('0x13')](function(_0x4ce6d3){if(_0x4ce6d3){return _0x4ce6d3[_0xb12b('0x28')]({'closed':_0x282f85['body']['closed'],'disposition':_0x282f85[_0xb12b('0x2e')]['disposition']})[_0xb12b('0x13')](function(_0x4a774a){return _0x4a774a;});}})['then'](function(){return respondWithRpcPromise(_0xb12b('0x5e'),_0xb12b('0x5f'),_0x282f85[_0xb12b('0x2e')],client9004);})['then'](respondWithResult(_0x5e50ef,null))[_0xb12b('0x1e')](handleError(_0x5e50ef,null));};exports['attachmentUpload']=function(_0x4aba56,_0x1d15d3){_0x4aba56[_0xb12b('0x2e')][_0xb12b('0x2b')]=_0x4aba56[_0xb12b('0x60')]['originalname'];_0x4aba56['body'][_0xb12b('0x61')]=_0x4aba56['file'][_0xb12b('0x62')];_0x4aba56[_0xb12b('0x2e')][_0xb12b('0x63')]=_0x4aba56[_0xb12b('0x60')][_0xb12b('0x64')];return db[_0xb12b('0x65')][_0xb12b('0x42')](_0x4aba56['body'])[_0xb12b('0x13')](respondWithResult(_0x1d15d3,0xc9))[_0xb12b('0x1e')](handleError(_0x1d15d3,null));};exports[_0xb12b('0x66')]=function(_0x5739f5,_0x506f77){return db[_0xb12b('0x31')][_0xb12b('0x45')]({'where':{'id':_0x5739f5['params']['id']},'raw':!![]})[_0xb12b('0x13')](handleEntityNotFound(_0x506f77,null))[_0xb12b('0x13')](function(_0x3aa44e){if(_0x3aa44e){if(_0x3aa44e[_0xb12b('0x67')]){return _0x506f77[_0xb12b('0x20')](0x193)[_0xb12b('0x21')]({'status':0x193,'message':'Unauthorized'});}return db[_0xb12b('0x65')][_0xb12b('0x45')]({'where':{'id':_0x5739f5[_0xb12b('0x36')]['attachId']},'raw':!![]})[_0xb12b('0x13')](handleEntityNotFound(_0x506f77,null));}})[_0xb12b('0x13')](function(_0xafb90d){if(_0xafb90d){var _0x59daab=_0xafb90d['ChatOfflineMessageId']!==null;var _0x2128c9=path[_0xb12b('0x68')](config[_0xb12b('0x69')],_0xb12b('0x6a'));if(_0x59daab){_0x2128c9=path[_0xb12b('0x68')](_0x2128c9,_0xb12b('0x6b'));}var _0x2812a9=path[_0xb12b('0x68')](_0x2128c9,_0xafb90d[_0xb12b('0x61')]);return _0x506f77['download'](_0x2812a9);}})[_0xb12b('0x1e')](handleError(_0x506f77,null));};exports[_0xb12b('0x6c')]=function(_0x55e66a,_0x2cdd83){var _0x20aaa2=null;var _0x105a0c=null;var _0x78a3bf=null;if(_0x55e66a[_0xb12b('0x2e')]['id']){delete _0x55e66a['body']['id'];}if(_0x55e66a['body'][_0xb12b('0x6d')]){_0x78a3bf=path['join'](config[_0xb12b('0x69')],'server/files/chat/upload/',util['format'](_0xb12b('0x6e'),Date[_0xb12b('0x6f')]()));_0x55e66a[_0xb12b('0x2e')]['pathTranscript']=_0x78a3bf;}return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0x55e66a[_0xb12b('0x38')]['id']},'include':[{'model':db[_0xb12b('0x56')],'as':_0xb12b('0x70'),'include':[{'model':db[_0xb12b('0x71')],'as':_0xb12b('0x71')}]}]})[_0xb12b('0x13')](handleEntityNotFound(_0x2cdd83,null))[_0xb12b('0x13')](saveUpdates(_0x55e66a['body'],null))[_0xb12b('0x13')](function(_0x4a2660){if(_0x4a2660){_0x20aaa2=_0x4a2660;return db[_0xb12b('0x46')][_0xb12b('0x41')]({'where':{'id':_0x20aaa2[_0xb12b('0x47')]}});}})[_0xb12b('0x13')](function(_0x1d84fe){if(_0x1d84fe){_0x105a0c=_0x1d84fe;return db[_0xb12b('0x72')][_0xb12b('0x41')]({'where':{'id':_0x20aaa2[_0xb12b('0x73')]}});}})['then'](function(_0x5e0f01){if(_0x5e0f01){if(_0x78a3bf){var _0x4d1b30=null;for(var _0x5d0d85=0x1;_0x5d0d85<_0x20aaa2[_0xb12b('0x70')][_0xb12b('0x74')];++_0x5d0d85){_0x4d1b30=_0x20aaa2[_0xb12b('0x70')][_0x5d0d85];var _0x317b9a=_0x4d1b30[_0xb12b('0x5d')]?util[_0xb12b('0x75')](_0xb12b('0x76'),_0x105a0c[_0xb12b('0x77')],_0x4d1b30[_0xb12b('0x5d')]):_0xb12b('0x78');var _0x4e7154=_0x55e66a[_0xb12b('0x2e')]['customer']||util['format'](_0xb12b('0x76'),'Visitor',_0x4d1b30[_0xb12b('0x73')]);switch(_0x105a0c[_0xb12b('0x79')]){case _0xb12b('0x7a'):_0x317b9a=_0x4d1b30[_0xb12b('0x5d')]?util['format'](_0xb12b('0x76'),_0x105a0c[_0xb12b('0x77')],_0x4d1b30[_0xb12b('0x5d')]):_0xb12b('0x78');break;case _0xb12b('0x7b'):_0x317b9a=_0x4d1b30[_0xb12b('0x5d')]?_0x4d1b30[_0xb12b('0x71')]['alias']||_0x4d1b30[_0xb12b('0x71')][_0xb12b('0x4b')]:_0xb12b('0x78');break;case'agent_fullname':_0x317b9a=_0x4d1b30[_0xb12b('0x5d')]?_0x4d1b30[_0xb12b('0x71')]['fullname']:'System';break;default:_0x317b9a=_0x4d1b30[_0xb12b('0x5d')]?util['format'](_0xb12b('0x76'),_0x105a0c[_0xb12b('0x77')],_0x4d1b30[_0xb12b('0x5d')]):_0xb12b('0x78');}var _0x106393=util[_0xb12b('0x75')](_0xb12b('0x7c'),moment(_0x4d1b30[_0xb12b('0x7d')])[_0xb12b('0x75')](_0xb12b('0x7e')),_0x4d1b30[_0xb12b('0x7f')]==='in'?_0x4e7154:_0x317b9a,_0x4d1b30[_0xb12b('0x2e')]);if(!_0x4d1b30[_0xb12b('0x80')]){fs[_0xb12b('0x81')](_0x78a3bf,_0x106393);}}return db[_0xb12b('0x82')][_0xb12b('0x45')]({'where':{'service':!![]},'include':[{'model':db[_0xb12b('0x83')],'as':_0xb12b('0x84'),'raw':!![],'include':[{'model':db[_0xb12b('0x85')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xb12b('0x13')](function(_0x2c9f70){if(!_0x2c9f70||!_0x2c9f70[_0xb12b('0x84')]||!_0x55e66a[_0xb12b('0x2e')])return _0x20aaa2;var _0x25dc75=_0x2c9f70[_0xb12b('0x86')]();return respondWithRpcPromise('SendMail',_0xb12b('0x87'),{'account':_0x25dc75,'message':{'from':util[_0xb12b('0x75')](_0xb12b('0x88'),_0x2c9f70[_0xb12b('0x2b')],_0x2c9f70[_0xb12b('0x4c')]||_0x2c9f70[_0xb12b('0x84')][_0xb12b('0x37')]),'to':_0x55e66a[_0xb12b('0x2e')][_0xb12b('0x6d')],'subject':_0xb12b('0x89'),'text':util['format'](_0xb12b('0x8a'),_0x55e66a[_0xb12b('0x2e')][_0xb12b('0x6d')]),'attachments':[{'path':_0x78a3bf}]}})[_0xb12b('0x13')](function(){return _0x20aaa2;})[_0xb12b('0x1e')](function(_0x1f4d81){logger[_0xb12b('0x1a')](_0x1f4d81);});})[_0xb12b('0x13')](respondWithStatusCode(_0x2cdd83,0xc8))[_0xb12b('0x1e')](handleError(_0x2cdd83,null));};exports[_0xb12b('0x8b')]=function(_0x5efe69,_0xb26b61){return db['ChatMessage'][_0xb12b('0x41')]({'where':{'id':_0x5efe69[_0xb12b('0x38')]['id']}})['then'](handleEntityNotFound(_0xb26b61,null))[_0xb12b('0x13')](function(_0x3aad89){if(_0x3aad89){return _0x3aad89[_0xb12b('0x8b')](_0x5efe69[_0xb12b('0x2e')][_0xb12b('0x8c')],_[_0xb12b('0x8d')](_0x5efe69[_0xb12b('0x2e')],[_0xb12b('0x8c'),'id'])||{});}})['then'](respondWithResult(_0xb26b61,null))['catch'](handleError(_0xb26b61,null));};exports[_0xb12b('0x8e')]=function(_0x1d3628,_0x1b290c){var _0x4d9bc1={'raw':![],'where':{}};var _0x3c8df0={};var _0x1a7bff={'count':0x0,'rows':[]};return db[_0xb12b('0x31')][_0xb12b('0x45')]({'where':{'id':_0x1d3628[_0xb12b('0x38')]['id']}})[_0xb12b('0x13')](handleEntityNotFound(_0x1b290c,null))[_0xb12b('0x13')](function(_0x452aff){if(_0x452aff){_0x3c8df0['model']=_['keys'](db[_0xb12b('0x56')][_0xb12b('0x32')]);_0x3c8df0[_0xb12b('0x36')]=_[_0xb12b('0x3a')](_0x1d3628['query']);_0x3c8df0['filters']=_[_0xb12b('0x3c')](_0x3c8df0[_0xb12b('0x39')],_0x3c8df0[_0xb12b('0x36')]);_0x4d9bc1[_0xb12b('0x3d')]=_[_0xb12b('0x3c')](_0x3c8df0['model'],qs['fields'](_0x1d3628['query']['fields']));_0x4d9bc1[_0xb12b('0x3d')]=_0x4d9bc1[_0xb12b('0x3d')][_0xb12b('0x74')]?_0x4d9bc1[_0xb12b('0x3d')]:_0x3c8df0['model'];if(!_0x1d3628[_0xb12b('0x36')][_0xb12b('0x8f')]('nolimit')){_0x4d9bc1['limit']=qs[_0xb12b('0x24')](_0x1d3628[_0xb12b('0x36')]['limit']);_0x4d9bc1['offset']=qs[_0xb12b('0x22')](_0x1d3628['query'][_0xb12b('0x22')]);}_0x4d9bc1[_0xb12b('0x90')]=qs['sort'](_0x1d3628['query'][_0xb12b('0x91')]);_0x4d9bc1['where']=qs[_0xb12b('0x3b')](_['pick'](_0x1d3628[_0xb12b('0x36')],_0x3c8df0[_0xb12b('0x3b')]));_0x4d9bc1[_0xb12b('0x92')][_0xb12b('0x93')]=_0x452aff['id'];if(_0x1d3628[_0xb12b('0x36')][_0xb12b('0x94')]){_0x4d9bc1['where']=_['merge'](_0x4d9bc1[_0xb12b('0x92')],{'$or':_['map'](_0x4d9bc1[_0xb12b('0x3d')],function(_0x56940d){var _0x47329e={};_0x47329e[_0x56940d]={'$like':'%'+_0x1d3628[_0xb12b('0x36')][_0xb12b('0x94')]+'%'};return _0x47329e;})});}if(_0x1d3628['query'][_0xb12b('0x95')]){var _0x22fc16=_0x1d3628[_0xb12b('0x36')]['$gte'][_0xb12b('0x96')](',');var _0x585b84={};_0x585b84[_0x22fc16[0x0]]={'$gte':moment(_0x22fc16[0x1])[_0xb12b('0x75')](_0xb12b('0x97'))};_0x4d9bc1[_0xb12b('0x92')]=_[_0xb12b('0x2d')](_0x4d9bc1[_0xb12b('0x92')],_0x585b84);}_0x4d9bc1=_['merge']({},_0x4d9bc1,_0x1d3628[_0xb12b('0x40')]);return db[_0xb12b('0x56')][_0xb12b('0x25')]({'where':_0x4d9bc1[_0xb12b('0x92')]})[_0xb12b('0x13')](function(_0x1afb5c){_0x1a7bff['count']=_0x1afb5c;if(_0x1d3628[_0xb12b('0x36')][_0xb12b('0x98')]){_0x4d9bc1[_0xb12b('0x3f')]=[{'all':!![]}];}return db[_0xb12b('0x56')][_0xb12b('0x35')](_0x4d9bc1);})[_0xb12b('0x13')](function(_0x5c3b15){_0x1a7bff[_0xb12b('0x99')]=_0x5c3b15;return _0x1a7bff;});}})[_0xb12b('0x13')](respondWithFilteredResult(_0x1b290c,_0x4d9bc1))['catch'](handleError(_0x1b290c,null));};exports[_0xb12b('0x9a')]=function(_0x39b405,_0x3be443){var _0x1e567e={'where':{}},_0x567f60={},_0x298f4f={'count':0x0,'rows':[]};return db[_0xb12b('0x31')][_0xb12b('0x45')]({'where':{'id':_0x39b405['params']['id']}})[_0xb12b('0x13')](handleEntityNotFound(_0x3be443,null))[_0xb12b('0x13')](function(_0x52069c){if(_0x52069c){_0x567f60[_0xb12b('0x39')]=_[_0xb12b('0x3a')](db[_0xb12b('0x56')]['rawAttributes']);_0x567f60[_0xb12b('0x36')]=_[_0xb12b('0x3a')](_0x39b405['query']);_0x567f60[_0xb12b('0x3b')]=_[_0xb12b('0x3c')](_0x567f60[_0xb12b('0x39')],_0x567f60['query']);_0x1e567e[_0xb12b('0x3d')]=_[_0xb12b('0x3c')](_0x567f60[_0xb12b('0x39')],qs[_0xb12b('0x3e')](_0x39b405[_0xb12b('0x36')][_0xb12b('0x3e')]));_0x1e567e[_0xb12b('0x3d')]=_0x1e567e[_0xb12b('0x3d')][_0xb12b('0x74')]?_0x1e567e['attributes']:_0x567f60[_0xb12b('0x39')];if(!_0x39b405[_0xb12b('0x36')][_0xb12b('0x8f')]('nolimit')){_0x1e567e[_0xb12b('0x24')]=qs[_0xb12b('0x24')](_0x39b405['query']['limit']);_0x1e567e[_0xb12b('0x22')]=qs[_0xb12b('0x22')](_0x39b405['query']['offset']);}_0x1e567e[_0xb12b('0x90')]=qs[_0xb12b('0x91')](_0x39b405['query'][_0xb12b('0x91')]);_0x1e567e[_0xb12b('0x92')]=qs[_0xb12b('0x3b')](_[_0xb12b('0x9b')](_0x39b405['query'],_0x567f60[_0xb12b('0x3b')]));_0x1e567e[_0xb12b('0x92')][_0xb12b('0x93')]=_0x52069c['id'];if(_0x39b405[_0xb12b('0x36')][_0xb12b('0x94')]){_0x1e567e['where']=_[_0xb12b('0x2d')](_0x1e567e[_0xb12b('0x92')],{'$or':_[_0xb12b('0x9c')](_0x1e567e[_0xb12b('0x3d')],function(_0x2d6995){var _0x3d40e5={};_0x3d40e5[_0x2d6995]={'$like':'%'+_0x39b405[_0xb12b('0x36')][_0xb12b('0x94')]+'%'};return _0x3d40e5;})});}_0x1e567e[_0xb12b('0x92')][_0xb12b('0x80')]=![];if(_0x39b405[_0xb12b('0x36')]['id']){_0x1e567e[_0xb12b('0x92')]['id']={'$gt':_0x39b405[_0xb12b('0x36')]['id']};}_0x1e567e=_[_0xb12b('0x2d')]({},_0x1e567e,_0x39b405[_0xb12b('0x40')]);return db[_0xb12b('0x56')][_0xb12b('0x25')]({'where':_0x1e567e[_0xb12b('0x92')]})['then'](function(_0x1c233c){_0x298f4f[_0xb12b('0x25')]=_0x1c233c;_0x1e567e[_0xb12b('0x3f')]=[];if(_0x39b405[_0xb12b('0x36')][_0xb12b('0x9d')]){_0x1e567e[_0xb12b('0x3f')]['push']({'model':db[_0xb12b('0x71')],'as':'User','attributes':['id',_0xb12b('0x4b'),_0xb12b('0x9e')]});}if(_0x39b405[_0xb12b('0x36')][_0xb12b('0x98')]){_0x1e567e[_0xb12b('0x3f')]=[{'all':!![]}];}return db[_0xb12b('0x56')]['findAll'](_0x1e567e);})['then'](function(_0x1ced48){_0x298f4f[_0xb12b('0x99')]=_0x1ced48;return _0x298f4f;});}})[_0xb12b('0x13')](respondWithFilteredResult(_0x3be443,_0x1e567e))[_0xb12b('0x1e')](handleError(_0x3be443,null));};exports[_0xb12b('0x9f')]=function(_0x43a7cd,_0x165ce5){return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0x43a7cd['params']['id']}})['then'](handleEntityNotFound(_0x165ce5,null))[_0xb12b('0x13')](function(_0x20577c){if(_0x20577c){return _0x20577c['setTags'](_0x43a7cd[_0xb12b('0x2e')][_0xb12b('0x8c')],_[_0xb12b('0x8d')](_0x43a7cd[_0xb12b('0x2e')],[_0xb12b('0x8c'),'id'])||{})[_0xb12b('0xa0')](function(){return db[_0xb12b('0xa1')][_0xb12b('0x35')]({'attributes':['id',_0xb12b('0x2b'),_0xb12b('0xa2')],'where':{'id':_0x43a7cd[_0xb12b('0x2e')][_0xb12b('0x8c')]}});})[_0xb12b('0x13')](function(_0x106a9b){socket[_0xb12b('0xa3')](_0xb12b('0xa4'),{'id':Number(_0x43a7cd['params']['id']),'tags':_0x106a9b||[]});return{'id':Number(_0x43a7cd[_0xb12b('0x38')]['id']),'tags':_0x106a9b||[]};});}})[_0xb12b('0x13')](respondWithResult(_0x165ce5,null))[_0xb12b('0x1e')](handleError(_0x165ce5,null));};exports[_0xb12b('0xa5')]=function(_0x57c7ed,_0x557ebe){return db['ChatInteraction']['find']({'where':{'id':_0x57c7ed[_0xb12b('0x38')]['id']}})['then'](handleEntityNotFound(_0x557ebe,null))[_0xb12b('0x13')](function(_0x1b5765){if(_0x1b5765){return _0x1b5765[_0xb12b('0xa5')](_0x57c7ed[_0xb12b('0x36')]['ids']);}})[_0xb12b('0x13')](respondWithStatusCode(_0x557ebe,null))['catch'](handleError(_0x557ebe,null));};exports[_0xb12b('0xa6')]=function(_0x4ca7bd,_0x49bf00){var _0x51269d=moment()[_0xb12b('0xa7')]()['toString']();var _0xf8a828=path[_0xb12b('0x68')](config['root'],'server',_0xb12b('0xa8'),_0xb12b('0xa9'));var _0x3407fe=path[_0xb12b('0x68')](config['root'],_0xb12b('0xaa'),_0xb12b('0xa8'),_0xb12b('0xab'));var _0x33bf22=path[_0xb12b('0x68')](_0xf8a828,_0x51269d);var _0x1deafc=util[_0xb12b('0x75')](_0xb12b('0xac'),_0x4ca7bd[_0xb12b('0x38')]['id'],_0x51269d);var _0x35cd7a=path[_0xb12b('0x68')](_0xf8a828,_0x1deafc);var _0x3d9c10=[];_0x3d9c10[_0xb12b('0xad')]({'model':db[_0xb12b('0x71')],'as':_0xb12b('0x71'),'attributes':['id',_0xb12b('0x4b')],'raw':!![]});_0x3d9c10[_0xb12b('0xad')]({'model':db[_0xb12b('0x72')],'as':'Contact','attributes':['id',_0xb12b('0xae'),_0xb12b('0xaf')],'raw':!![]});if(_0x4ca7bd[_0xb12b('0x36')][_0xb12b('0xab')]){_0x3d9c10['push']({'model':db[_0xb12b('0x65')],'as':_0xb12b('0x65'),'raw':!![]});}var _0x853c39=[{'model':db['ChatMessage'],'as':_0xb12b('0x70'),'attributes':['id',_0xb12b('0x2e'),_0xb12b('0x7d'),_0xb12b('0x7f'),_0xb12b('0x80'),'read'],'include':_0x3d9c10}];_0x853c39['push']({'model':db[_0xb12b('0x46')],'as':_0xb12b('0xb0'),'attributes':['id',_0xb12b('0x2b')]});_0x853c39[_0xb12b('0xad')]({'model':db['User'],'as':_0xb12b('0xb1'),'attributes':['id',_0xb12b('0x4b')]});return db[_0xb12b('0x31')][_0xb12b('0x41')]({'where':{'id':_0x4ca7bd[_0xb12b('0x38')]['id']},'include':_0x853c39})[_0xb12b('0x13')](handleEntityNotFound(_0x49bf00,null))['then'](function(_0x26cbeb){if(_0x26cbeb){var _0x5d7d00=_0x26cbeb[_0xb12b('0xb2')]({'plain':!![]});fs[_0xb12b('0xb3')](_0x33bf22);var _0x18cd04={'channel':_0xb12b('0xb4'),'account':_0x5d7d00[_0xb12b('0xb0')][_0xb12b('0x2b')],'agent':_0x5d7d00[_0xb12b('0xb1')]?_0x5d7d00[_0xb12b('0xb1')][_0xb12b('0x4b')]:_0xb12b('0xb5'),'createdAt':moment(_0x5d7d00['createdAt'])[_0xb12b('0x75')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb12b('0xb6')](),'closedAt':_0x5d7d00['closed']?moment(_0x5d7d00[_0xb12b('0xb7')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xb12b('0xb6')]():'','disposition':_0x5d7d00[_0xb12b('0xb8')],'chatInfo':{'browser':_0x5d7d00[_0xb12b('0xb9')],'os':_0x5d7d00[_0xb12b('0xba')],'referer':_0x5d7d00[_0xb12b('0xbb')],'customerIp':_0x5d7d00['customerIp'],'customerPort':_0x5d7d00[_0xb12b('0xbc')]?_0x5d7d00[_0xb12b('0xbc')]:_0xb12b('0xb5')},'messages':_(_0x5d7d00[_0xb12b('0x70')])[_0xb12b('0xbd')]()['filter']({'secret':![]})[_0xb12b('0x9c')](function(_0x191f4b){if(_0x191f4b['Attachment']){var _0x12855e=path[_0xb12b('0x68')](_0x3407fe,_0x191f4b['Attachment'][_0xb12b('0x61')]);if(fs[_0xb12b('0xbe')](_0x12855e)){fs[_0xb12b('0xbf')](_0x12855e)[_0xb12b('0xc0')](fs[_0xb12b('0xc1')](path[_0xb12b('0x68')](_0x33bf22,_0x191f4b['Attachment'][_0xb12b('0x61')])));}}return{'date':moment(_0x191f4b['createdAt'])[_0xb12b('0x75')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb12b('0xb6')](),'sender':_0x191f4b[_0xb12b('0x7f')]===_0xb12b('0x55')?_0x191f4b['User']?_0x191f4b[_0xb12b('0x71')][_0xb12b('0x4b')]:_0xb12b('0x78'):_0x191f4b['Contact'][_0xb12b('0xae')]+(_0x191f4b[_0xb12b('0x5a')]['lastName']?'\x20'+_0x191f4b[_0xb12b('0x5a')][_0xb12b('0xaf')]:''),'body':_0x191f4b[_0xb12b('0x65')]?_0x191f4b['Attachment'][_0xb12b('0x61')]:_0x191f4b[_0xb12b('0x2e')],'direction':_0x191f4b['direction']===_0xb12b('0x55')?'A':'C','secret':_0x191f4b['secret'],'read':_0x191f4b[_0xb12b('0xc2')],'attachment':_0x191f4b['Attachment']};})[_0xb12b('0xc3')]()};return ejs[_0xb12b('0xc4')](path['join'](config[_0xb12b('0x69')],_0xb12b('0xaa'),_0xb12b('0xc5'),'downloadInteraction.ejs'),{'interaction':_0x18cd04})[_0xb12b('0x13')](function(_0x8bcf73){var _0x134850=path[_0xb12b('0x68')](_0x33bf22,'transcript-'+_0x5d7d00['id']+'-'+_0x51269d+_0xb12b('0xc6'));var _0x24ec13={'path':_0x134850,'channel':_0xb12b('0xb4'),'interactionId':_0x5d7d00['id']};return pdf[_0xb12b('0xc7')](_0x8bcf73,_0x24ec13);})[_0xb12b('0x13')](function(){return new Promise(function(_0x3ddd32,_0x1e208d){zipdir(_0x33bf22,{'saveTo':_0x35cd7a},function(_0x561c11,_0x332195){if(_0x561c11)return _0x1e208d(_0x561c11);return _0x3ddd32(_0x332195);});})[_0xb12b('0x13')](function(){return new BPromise(function(_0x219ff8,_0x45f98a){rimraf(_0x33bf22,function(_0x240b02){if(_0x240b02)_0x45f98a(_0x240b02);return _0x219ff8();});});})[_0xb12b('0x13')](function(){return _0x49bf00[_0xb12b('0xa6')](_0x35cd7a,_0x1deafc,function(_0x1d8111){if(_0x1d8111){logger['error'](_0xb12b('0xc8'),_0x1d8111);}else{fs[_0xb12b('0xc9')](_0x35cd7a);}});});});}else{return _0x49bf00['sendStatus'](0xc8);}})[_0xb12b('0x1e')](handleError(_0x49bf00,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fba575d..d8104f6 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 _0xb21e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','update','remove','getUsers','setDataValue','Users','map','findAll','then'];(function(_0x1bdc63,_0x24b3b0){var _0x4d15a5=function(_0x342013){while(--_0x342013){_0x1bdc63['push'](_0x1bdc63['shift']());}};_0x4d15a5(++_0x24b3b0);}(_0xb21e,0xd3));var _0xeb21=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xb21e[_0x4b7b62];return _0x2280df;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xeb21('0x0'))['db'][_0xeb21('0x1')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xeb21('0x2'),'afterDestroy':_0xeb21('0x3')};function emitEvent(_0x5c75b7){return function(_0x4af675,_0x551f23,_0x3caab0){_0x4af675[_0xeb21('0x4')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2f5795){_0x4af675[_0xeb21('0x5')](_0xeb21('0x6'),_0x2f5795[_0xeb21('0x7')](function(_0x36983f){return{'id':_0x36983f['id']};}));return ChatMessage[_0xeb21('0x8')]({'where':{'ChatInteractionId':_0x4af675['id'],'direction':'in','read':![]},'raw':!![]});})[_0xeb21('0x9')](function(_0x1b9be7){_0x4af675['setDataValue'](_0xeb21('0xa'),_0x1b9be7[_0xeb21('0xb')]);ChatInteractionEvents[_0xeb21('0xc')](_0x5c75b7+':'+_0x4af675['id'],_0x4af675);ChatInteractionEvents[_0xeb21('0xc')](_0x5c75b7,_0x4af675);_0x3caab0(null);})[_0xeb21('0xd')](_0x3caab0(null));};}for(var e in events){if(events[_0xeb21('0xe')](e)){var event=events[e];ChatInteraction[_0xeb21('0xf')](e,emitEvent(event));}}module[_0xeb21('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0x8820=['hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','catch'];(function(_0x9d1b60,_0x326e0e){var _0x46304b=function(_0x179b6b){while(--_0x179b6b){_0x9d1b60['push'](_0x9d1b60['shift']());}};_0x46304b(++_0x326e0e);}(_0x8820,0x192));var _0x0882=function(_0x20481b,_0x27e535){_0x20481b=_0x20481b-0x0;var _0x59ffae=_0x8820[_0x20481b];return _0x59ffae;};'use strict';var EventEmitter=require(_0x0882('0x0'));var ChatInteraction=require(_0x0882('0x1'))['db'][_0x0882('0x2')];var ChatMessage=require(_0x0882('0x1'))['db'][_0x0882('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0882('0x4'),'afterDestroy':_0x0882('0x5')};function emitEvent(_0xc34224){return function(_0x24396f,_0xf43c51,_0x223593){_0x24396f[_0x0882('0x6')]({'attributes':['id'],'raw':!![]})[_0x0882('0x7')](function(_0x5eab77){_0x24396f[_0x0882('0x8')](_0x0882('0x9'),_0x5eab77[_0x0882('0xa')](function(_0x465d8d){return{'id':_0x465d8d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x24396f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x276572){_0x24396f[_0x0882('0x8')](_0x0882('0xb'),_0x276572['length']);ChatInteractionEvents[_0x0882('0xc')](_0xc34224+':'+_0x24396f['id'],_0x24396f);ChatInteractionEvents[_0x0882('0xc')](_0xc34224,_0x24396f);_0x223593(null);})[_0x0882('0xd')](_0x223593(null));};}for(var e in events){if(events[_0x0882('0xe')](e)){var event=events[e];ChatInteraction[_0x0882('0xf')](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 2a48293..765e372 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 _0x893b=['api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x42dbaa,_0x5e4227){var _0x1fd2ec=function(_0x56a8d7){while(--_0x56a8d7){_0x42dbaa['push'](_0x42dbaa['shift']());}};_0x1fd2ec(++_0x5e4227);}(_0x893b,0x76));var _0xb893=function(_0x2b55bb,_0x508372){_0x2b55bb=_0x2b55bb-0x0;var _0x1e3223=_0x893b[_0x2b55bb];return _0x1e3223;};'use strict';var _=require('lodash');var util=require(_0xb893('0x0'));var logger=require('../../config/logger')(_0xb893('0x1'));var moment=require('moment');var BPromise=require(_0xb893('0x2'));var rp=require(_0xb893('0x3'));var fs=require('fs');var path=require(_0xb893('0x4'));var rimraf=require('rimraf');var config=require(_0xb893('0x5'));var attributes=require(_0xb893('0x6'));module[_0xb893('0x7')]=function(_0x1a220d,_0x4ff286){return _0x1a220d['define'](_0xb893('0x8'),attributes,{'tableName':_0xb893('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x892e36,_0x73f59c,_0x48a13a){if(_0x892e36[_0xb893('0xa')](_0xb893('0xb'))){_0x892e36[_0xb893('0xc')]=moment()[_0xb893('0xd')](_0xb893('0xe'));}_0x48a13a(null,_0x892e36);}},'charset':_0xb893('0xf'),'collate':_0xb893('0x10')});}; \ No newline at end of file +var _0xa082=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatInteraction','chat_interactions','changed','closedAt'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xa082,0x1ef));var _0x2a08=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa082[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x2a08('0x0'));var util=require(_0x2a08('0x1'));var logger=require(_0x2a08('0x2'))(_0x2a08('0x3'));var moment=require(_0x2a08('0x4'));var BPromise=require(_0x2a08('0x5'));var rp=require(_0x2a08('0x6'));var fs=require('fs');var path=require(_0x2a08('0x7'));var rimraf=require(_0x2a08('0x8'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0x2a08('0x9')]=function(_0x170165,_0x5d562f){return _0x170165[_0x2a08('0xa')](_0x2a08('0xb'),attributes,{'tableName':_0x2a08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf4eb80,_0x334088,_0x18b695){if(_0xf4eb80[_0x2a08('0xd')]('closed')){_0xf4eb80[_0x2a08('0xe')]=moment()['format'](_0x2a08('0xf'));}_0x18b695(null,_0xf4eb80);}},'charset':_0x2a08('0x10'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3f5975a..81a69eb 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 _0x5e8c=['then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ChatInteraction','body','options','where','limit','UpdateChatInteraction','stringify','find','addTags','omit','ids','spread','AddTags','debug','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register'];(function(_0x5f0738,_0x2f431a){var _0x35737f=function(_0x42129f){while(--_0x42129f){_0x5f0738['push'](_0x5f0738['shift']());}};_0x35737f(++_0x2f431a);}(_0x5e8c,0xe0));var _0xc5e8=function(_0xe032f8,_0x30c69e){_0xe032f8=_0xe032f8-0x0;var _0x412b79=_0x5e8c[_0xe032f8];return _0x412b79;};'use strict';var _=require(_0xc5e8('0x0'));var util=require(_0xc5e8('0x1'));var moment=require(_0xc5e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5e8('0x3'));var db=require(_0xc5e8('0x4'))['db'];var utils=require(_0xc5e8('0x5'));var logger=require(_0xc5e8('0x6'))('rpc');var config=require(_0xc5e8('0x7'));var jayson=require(_0xc5e8('0x8'));var client=jayson[_0xc5e8('0x9')][_0xc5e8('0xa')]({'port':0x232a});config[_0xc5e8('0xb')]=_[_0xc5e8('0xc')](config[_0xc5e8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5e8('0xd'))(new Redis(config[_0xc5e8('0xb')]));require(_0xc5e8('0xe'))[_0xc5e8('0xf')](socket);function respondWithRpcPromise(_0x432dc1,_0x334eaa,_0x2b0c03){return new BPromise(function(_0x27c2b7,_0x330983){return client['request'](_0x432dc1,_0x2b0c03)[_0xc5e8('0x10')](function(_0x560f91){logger[_0xc5e8('0x11')](_0xc5e8('0x12'),_0x334eaa,'request\x20sent');logger['debug'](_0xc5e8('0x13'),_0x334eaa,_0xc5e8('0x14'),JSON['stringify'](_0x560f91));if(_0x560f91[_0xc5e8('0x15')]){if(_0x560f91[_0xc5e8('0x15')][_0xc5e8('0x16')]===0x1f4){logger['error'](_0xc5e8('0x12'),_0x334eaa,_0x560f91['error'][_0xc5e8('0x17')]);return _0x330983(_0x560f91['error']['message']);}logger[_0xc5e8('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x334eaa,_0x560f91['error'][_0xc5e8('0x17')]);return _0x27c2b7(_0x560f91['error'][_0xc5e8('0x17')]);}else{logger[_0xc5e8('0x11')](_0xc5e8('0x12'),_0x334eaa,'request\x20sent');_0x27c2b7(_0x560f91[_0xc5e8('0x18')][_0xc5e8('0x17')]);}})[_0xc5e8('0x19')](function(_0x5b1f7c){logger[_0xc5e8('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x334eaa,_0x5b1f7c);_0x330983(_0x5b1f7c);});});}exports['UpdateChatInteraction']=function(_0x3cb3c6){var _0x5a6791=this;return new Promise(function(_0x48d7c1,_0x142e6a){return db[_0xc5e8('0x1a')]['update'](_0x3cb3c6[_0xc5e8('0x1b')],{'raw':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')][_0xc5e8('0x1d')]||null:null,'attributes':_0x3cb3c6['options']?_0x3cb3c6[_0xc5e8('0x1c')]['attributes']||null:null,'limit':_0x3cb3c6[_0xc5e8('0x1c')]?_0x3cb3c6[_0xc5e8('0x1c')][_0xc5e8('0x1e')]||null:null})[_0xc5e8('0x10')](function(_0x593c60){logger[_0xc5e8('0x11')](_0xc5e8('0x1f'),_0x3cb3c6);logger['debug']('UpdateChatInteraction',_0x3cb3c6,JSON[_0xc5e8('0x20')](_0x593c60));_0x48d7c1(_0x593c60);})[_0xc5e8('0x19')](function(_0x34907f){logger[_0xc5e8('0x15')]('UpdateChatInteraction',_0x34907f['message'],_0x3cb3c6);_0x142e6a(_0x5a6791[_0xc5e8('0x15')](0x1f4,_0x34907f['message']));});});};exports['AddTagsToChatInteraction']=function(_0x532013){return new Promise(function(_0x7801c3,_0x2d9af6){return db[_0xc5e8('0x1a')][_0xc5e8('0x21')]({'where':_0x532013['options']?_0x532013['options'][_0xc5e8('0x1d')]||null:null})['then'](function(_0xd1e0c7){if(_0xd1e0c7){return _0xd1e0c7[_0xc5e8('0x22')](_0x532013[_0xc5e8('0x1b')]['ids'],_[_0xc5e8('0x23')](_0x532013[_0xc5e8('0x1b')],[_0xc5e8('0x24'),'id'])||{});}})[_0xc5e8('0x25')](function(_0x5b1e8b){logger['info'](_0xc5e8('0x26'),_0x532013);logger[_0xc5e8('0x27')](_0xc5e8('0x26'),_0x532013,JSON[_0xc5e8('0x20')](_0x5b1e8b));_0x7801c3(_0x5b1e8b);})[_0xc5e8('0x19')](function(_0x2cb393){logger[_0xc5e8('0x15')](_0xc5e8('0x26'),_0x2cb393[_0xc5e8('0x17')],_0x532013);_0x2d9af6(_this[_0xc5e8('0x15')](0x1f4,_0x2cb393[_0xc5e8('0x17')]));});});}; \ No newline at end of file +var _0x89e8=['result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','addTags','ids','omit','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','localhost','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','info'];(function(_0x599c44,_0x2fb16e){var _0x1d6cf6=function(_0x43f375){while(--_0x43f375){_0x599c44['push'](_0x599c44['shift']());}};_0x1d6cf6(++_0x2fb16e);}(_0x89e8,0x16e));var _0x889e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x89e8[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x889e('0x0'));var util=require(_0x889e('0x1'));var moment=require('moment');var BPromise=require(_0x889e('0x2'));var rs=require(_0x889e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x889e('0x4'))['db'];var utils=require(_0x889e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x889e('0x6'));var jayson=require(_0x889e('0x7'));var client=jayson[_0x889e('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x889e('0x9')],{'host':_0x889e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x889e('0xb'))[_0x889e('0xc')](socket);function respondWithRpcPromise(_0x3258b4,_0x1a9ef6,_0x3d7ed8){return new BPromise(function(_0x1fa815,_0x38f9d1){return client[_0x889e('0xd')](_0x3258b4,_0x3d7ed8)[_0x889e('0xe')](function(_0x421a39){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x1a9ef6,_0x889e('0xf'));logger[_0x889e('0x10')](_0x889e('0x11'),_0x1a9ef6,'request\x20sent',JSON[_0x889e('0x12')](_0x421a39));if(_0x421a39[_0x889e('0x13')]){if(_0x421a39[_0x889e('0x13')][_0x889e('0x14')]===0x1f4){logger[_0x889e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1a9ef6,_0x421a39['error'][_0x889e('0x15')]);return _0x38f9d1(_0x421a39[_0x889e('0x13')][_0x889e('0x15')]);}logger['error'](_0x889e('0x16'),_0x1a9ef6,_0x421a39['error'][_0x889e('0x15')]);return _0x1fa815(_0x421a39[_0x889e('0x13')][_0x889e('0x15')]);}else{logger[_0x889e('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x1a9ef6,_0x889e('0xf'));_0x1fa815(_0x421a39[_0x889e('0x18')]['message']);}})['catch'](function(_0x455ed2){logger[_0x889e('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x1a9ef6,_0x455ed2);_0x38f9d1(_0x455ed2);});});}exports[_0x889e('0x19')]=function(_0xf53e32){var _0x41eeb5=this;return new Promise(function(_0xfd7d74,_0x3766b6){return db[_0x889e('0x1a')]['update'](_0xf53e32[_0x889e('0x1b')],{'raw':_0xf53e32[_0x889e('0x1c')]?_0xf53e32[_0x889e('0x1c')][_0x889e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf53e32['options']?_0xf53e32[_0x889e('0x1c')][_0x889e('0x1e')]||null:null,'attributes':_0xf53e32[_0x889e('0x1c')]?_0xf53e32[_0x889e('0x1c')][_0x889e('0x1f')]||null:null,'limit':_0xf53e32[_0x889e('0x1c')]?_0xf53e32[_0x889e('0x1c')][_0x889e('0x20')]||null:null})[_0x889e('0xe')](function(_0x31b1b2){logger[_0x889e('0x17')](_0x889e('0x19'),_0xf53e32);logger['debug'](_0x889e('0x19'),_0xf53e32,JSON[_0x889e('0x12')](_0x31b1b2));_0xfd7d74(_0x31b1b2);})[_0x889e('0x21')](function(_0x4da8de){logger[_0x889e('0x13')](_0x889e('0x19'),_0x4da8de[_0x889e('0x15')],_0xf53e32);_0x3766b6(_0x41eeb5[_0x889e('0x13')](0x1f4,_0x4da8de['message']));});});};exports[_0x889e('0x22')]=function(_0x12ff58){return new Promise(function(_0x28c79c,_0xb5979e){return db[_0x889e('0x1a')]['find']({'where':_0x12ff58[_0x889e('0x1c')]?_0x12ff58[_0x889e('0x1c')][_0x889e('0x1e')]||null:null})[_0x889e('0xe')](function(_0x199732){if(_0x199732){return _0x199732[_0x889e('0x23')](_0x12ff58[_0x889e('0x1b')][_0x889e('0x24')],_[_0x889e('0x25')](_0x12ff58['body'],[_0x889e('0x24'),'id'])||{});}})['spread'](function(_0x1457f8){logger[_0x889e('0x17')](_0x889e('0x26'),_0x12ff58);logger[_0x889e('0x10')](_0x889e('0x26'),_0x12ff58,JSON[_0x889e('0x12')](_0x1457f8));_0x28c79c(_0x1457f8);})[_0x889e('0x21')](function(_0x420a52){logger[_0x889e('0x13')](_0x889e('0x26'),_0x420a52[_0x889e('0x15')],_0x12ff58);_0xb5979e(_this[_0x889e('0x13')](0x1f4,_0x420a52['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4fe0af8..5f7b3eb 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 _0x9acd=['save','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x441d10,_0x50971e){var _0x23680a=function(_0x3d6ba3){while(--_0x3d6ba3){_0x441d10['push'](_0x441d10['shift']());}};_0x23680a(++_0x50971e);}(_0x9acd,0x76));var _0xd9ac=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x9acd[_0xc6be3a];return _0x56a310;};'use strict';var ChatInteractionEvents=require(_0xd9ac('0x0'));var events=[_0xd9ac('0x1'),'remove','update'];function createListener(_0x1ddf3f,_0x5c9e84){return function(_0x566442){_0x5c9e84[_0xd9ac('0x2')](_0x1ddf3f,_0x566442);};}function removeListener(_0x1c0cd3,_0x4c9b08){return function(){ChatInteractionEvents[_0xd9ac('0x3')](_0x1c0cd3,_0x4c9b08);};}exports[_0xd9ac('0x4')]=function(_0x340104){for(var _0x3fec24=0x0,_0x295a7c=events[_0xd9ac('0x5')];_0x3fec24<_0x295a7c;_0x3fec24++){var _0x346a54=events[_0x3fec24];var _0x2f4d8b=createListener(_0xd9ac('0x6')+_0x346a54,_0x340104);ChatInteractionEvents['on'](_0x346a54,_0x2f4d8b);}}; \ No newline at end of file +var _0x3aca=['./chatInteraction.events','save','remove','update','removeListener','register'];(function(_0x5292e4,_0x388873){var _0x109411=function(_0x19d1dc){while(--_0x19d1dc){_0x5292e4['push'](_0x5292e4['shift']());}};_0x109411(++_0x388873);}(_0x3aca,0xea));var _0xa3ac=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0x3aca[_0x1314d4];return _0x584ba5;};'use strict';var ChatInteractionEvents=require(_0xa3ac('0x0'));var events=[_0xa3ac('0x1'),_0xa3ac('0x2'),_0xa3ac('0x3')];function createListener(_0x1073b7,_0x24078b){return function(_0x48e230){_0x24078b['emit'](_0x1073b7,_0x48e230);};}function removeListener(_0x119c9b,_0x260c82){return function(){ChatInteractionEvents[_0xa3ac('0x4')](_0x119c9b,_0x260c82);};}exports[_0xa3ac('0x5')]=function(_0x309e5c){for(var _0x2808ff=0x0,_0x397b84=events['length'];_0x2808ff<_0x397b84;_0x2808ff++){var _0x2eb8fb=events[_0x2808ff];var _0x1891d6=createListener('chatInteraction:'+_0x2eb8fb,_0x309e5c);ChatInteractionEvents['on'](_0x2eb8fb,_0x1891d6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 1f0f78a..cb7057b 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 _0x6fc7=['/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','root','server/files/attachments/','now','originalname','single','file','attachmentUpload','addMessage','/:id/tags','chat','addTags','update','customUpdate','put','/:id/abandon','abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x21ed88,_0x574daa){var _0x133e35=function(_0x407dc4){while(--_0x407dc4){_0x21ed88['push'](_0x21ed88['shift']());}};_0x133e35(++_0x574daa);}(_0x6fc7,0x8d));var _0x76fc=function(_0x451e42,_0x2d71ea){_0x451e42=_0x451e42-0x0;var _0x484342=_0x6fc7[_0x451e42];return _0x484342;};'use strict';var multer=require('multer');var util=require(_0x76fc('0x0'));var path=require(_0x76fc('0x1'));var timeout=require(_0x76fc('0x2'));var express=require('express');var router=express[_0x76fc('0x3')]();var fs_extra=require(_0x76fc('0x4'));var auth=require(_0x76fc('0x5'));var interaction=require(_0x76fc('0x6'));var config=require(_0x76fc('0x7'));var controller=require(_0x76fc('0x8'));router[_0x76fc('0x9')]('/',auth[_0x76fc('0xa')](),controller['index']);router[_0x76fc('0x9')](_0x76fc('0xb'),auth[_0x76fc('0xa')](),controller['describe']);router[_0x76fc('0x9')](_0x76fc('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x76fc('0xd')]);router[_0x76fc('0x9')](_0x76fc('0xe'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x10')]);router['get'](_0x76fc('0x11'),auth[_0x76fc('0xa')](),controller[_0x76fc('0x12')]);router[_0x76fc('0x9')](_0x76fc('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x76fc('0x14')]);router[_0x76fc('0x9')](_0x76fc('0x15'),auth['isAuthenticated'](),controller[_0x76fc('0x16')]);router[_0x76fc('0x17')]('/',auth[_0x76fc('0xa')](),controller[_0x76fc('0x18')]);router[_0x76fc('0x17')](_0x76fc('0x19'),auth[_0x76fc('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x76fc('0x1a')]({'destination':function(_0x23f7e4,_0x421dfc,_0x35f4d3){_0x35f4d3(null,path['join'](config[_0x76fc('0x1b')],_0x76fc('0x1c')));},'filename':function(_0x333e25,_0x2b467e,_0x43f743){_0x43f743(null,util['format']('%s-%s',Date[_0x76fc('0x1d')](),_0x2b467e[_0x76fc('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x76fc('0x17')]('/:id/attachment_upload',upload[_0x76fc('0x1f')](_0x76fc('0x20')),controller[_0x76fc('0x21')]);router[_0x76fc('0x17')](_0x76fc('0x11'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x22')]);router[_0x76fc('0x17')](_0x76fc('0x23'),auth[_0x76fc('0xa')](),interaction['tracked'](_0x76fc('0x24'),'chatinteraction:addtags'),controller[_0x76fc('0x25')]);router['put'](_0x76fc('0xc'),auth['isAuthenticated'](),interaction['tracked'](_0x76fc('0x24'),'chatinteraction:update'),controller[_0x76fc('0x26')]);router['put']('/:id/custom_update',controller[_0x76fc('0x27')]);router[_0x76fc('0x28')](_0x76fc('0x29'),auth[_0x76fc('0xf')](),controller[_0x76fc('0x2a')]);router['put'](_0x76fc('0x2b'),controller[_0x76fc('0x2c')]);router[_0x76fc('0x2d')](_0x76fc('0xc'),auth[_0x76fc('0xa')](),interaction[_0x76fc('0x2e')](_0x76fc('0x24'),_0x76fc('0x2f')),controller[_0x76fc('0x30')]);router[_0x76fc('0x2d')]('/:id/tags',auth[_0x76fc('0xa')](),controller[_0x76fc('0x31')]);module[_0x76fc('0x32')]=router; \ No newline at end of file +var _0x0bfc=['./chatInteraction.controller','isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','attachmentDownload','get','/:id/messages','getMessages','getMyMessages','/:id/download','download','create','post','diskStorage','join','server/files/attachments/','format','%s-%s','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','tracked','chat','/:id','update','put','customUpdate','/:id/abandon','/:id/close','delete','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b47c9,_0x138a23){var _0x569c3b=function(_0x53a9c9){while(--_0x53a9c9){_0x4b47c9['push'](_0x4b47c9['shift']());}};_0x569c3b(++_0x138a23);}(_0x0bfc,0x85));var _0xc0bf=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0bfc[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc0bf('0x0'));var util=require('util');var path=require(_0xc0bf('0x1'));var timeout=require(_0xc0bf('0x2'));var express=require(_0xc0bf('0x3'));var router=express['Router']();var fs_extra=require(_0xc0bf('0x4'));var auth=require(_0xc0bf('0x5'));var interaction=require(_0xc0bf('0x6'));var config=require(_0xc0bf('0x7'));var controller=require(_0xc0bf('0x8'));router['get']('/',auth[_0xc0bf('0x9')](),controller['index']);router['get'](_0xc0bf('0xa'),auth[_0xc0bf('0x9')](),controller[_0xc0bf('0xb')]);router['get']('/:id',auth[_0xc0bf('0xc')](),controller[_0xc0bf('0xd')]);router['get']('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xc0bf('0xe')]);router[_0xc0bf('0xf')](_0xc0bf('0x10'),auth[_0xc0bf('0x9')](),controller[_0xc0bf('0x11')]);router['get']('/:id/my_messages',auth[_0xc0bf('0xc')](),controller[_0xc0bf('0x12')]);router['get'](_0xc0bf('0x13'),auth[_0xc0bf('0x9')](),controller[_0xc0bf('0x14')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc0bf('0x15')]);router[_0xc0bf('0x16')]('/:id/vidaoo',auth[_0xc0bf('0x9')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xc0bf('0x17')]({'destination':function(_0x49b8c7,_0x1c95c2,_0xddcff0){_0xddcff0(null,path[_0xc0bf('0x18')](config['root'],_0xc0bf('0x19')));},'filename':function(_0xda4fdc,_0x423887,_0x3e2356){_0x3e2356(null,util[_0xc0bf('0x1a')](_0xc0bf('0x1b'),Date['now'](),_0x423887[_0xc0bf('0x1c')][_0xc0bf('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xc0bf('0x1e'),upload['single'](_0xc0bf('0x1f')),controller[_0xc0bf('0x20')]);router[_0xc0bf('0x16')]('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0xc0bf('0x21')]);router[_0xc0bf('0x16')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xc0bf('0x22')](_0xc0bf('0x23'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0xc0bf('0x24'),auth[_0xc0bf('0x9')](),interaction[_0xc0bf('0x22')]('chat','chatinteraction:update'),controller[_0xc0bf('0x25')]);router[_0xc0bf('0x26')]('/:id/custom_update',controller[_0xc0bf('0x27')]);router[_0xc0bf('0x26')](_0xc0bf('0x28'),auth[_0xc0bf('0xc')](),controller['abandon']);router[_0xc0bf('0x26')](_0xc0bf('0x29'),controller['close']);router[_0xc0bf('0x2a')]('/:id',auth[_0xc0bf('0x9')](),interaction['tracked'](_0xc0bf('0x23'),'chatinteraction:destroy'),controller[_0xc0bf('0x2b')]);router[_0xc0bf('0x2a')](_0xc0bf('0x2c'),auth['isAuthenticated'](),controller[_0xc0bf('0x2d')]);module[_0xc0bf('0x2e')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 2ccfa07..3b57950 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 _0x5453=['medium','BOOLEAN','INTEGER','exports','TEXT'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5453,0x1a2));var _0x3545=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5453[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x3545('0x0')]={'body':{'type':Sequelize[_0x3545('0x1')](_0x3545('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x3545('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x3545('0x4')]}}; \ No newline at end of file +var _0x72d0=['exports','medium'];(function(_0x23307e,_0x2e7f4a){var _0x101ab5=function(_0x10580f){while(--_0x10580f){_0x23307e['push'](_0x23307e['shift']());}};_0x101ab5(++_0x2e7f4a);}(_0x72d0,0x112));var _0x072d=function(_0x4a08f5,_0x29f8b0){_0x4a08f5=_0x4a08f5-0x0;var _0x4f2cd6=_0x72d0[_0x4a08f5];return _0x4f2cd6;};'use strict';var Sequelize=require('sequelize');module[_0x072d('0x0')]={'body':{'type':Sequelize['TEXT'](_0x072d('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 237e934..d2f5f32 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 _0x636a=['allowmessenger','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','autoAssociation','UserProfileResource','findAll','isEmpty','length','resourceId','push','FromId','ToId','read','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/environment','redis','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','agent','admin','user','fullname','userpic','internal','online','lastLoginAt'];(function(_0x45738b,_0x1d7363){var _0x3a91c5=function(_0x1a54e7){while(--_0x1a54e7){_0x45738b['push'](_0x45738b['shift']());}};_0x3a91c5(++_0x1d7363);}(_0x636a,0x15b));var _0xa636=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0x636a[_0xf1f37e];return _0x2e3a6d;};'use strict';var emlformat=require(_0xa636('0x0'));var rimraf=require(_0xa636('0x1'));var zipdir=require(_0xa636('0x2'));var jsonpatch=require(_0xa636('0x3'));var rp=require(_0xa636('0x4'));var moment=require(_0xa636('0x5'));var BPromise=require(_0xa636('0x6'));var Mustache=require(_0xa636('0x7'));var util=require(_0xa636('0x8'));var path=require(_0xa636('0x9'));var sox=require(_0xa636('0xa'));var csv=require(_0xa636('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa636('0xc'));var _=require('lodash');var squel=require(_0xa636('0xd'));var crypto=require(_0xa636('0xe'));var jsforce=require(_0xa636('0xf'));var deskjs=require(_0xa636('0x10'));var toCsv=require(_0xa636('0xb'));var querystring=require(_0xa636('0x11'));var Papa=require(_0xa636('0x12'));var Redis=require(_0xa636('0x13'));var authService=require(_0xa636('0x14'));var qs=require(_0xa636('0x15'));var as=require(_0xa636('0x16'));var hardwareService=require(_0xa636('0x17'));var logger=require(_0xa636('0x18'))(_0xa636('0x19'));var utils=require('../../config/utils');var config=require(_0xa636('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xa636('0x1b')]=_['defaults'](config[_0xa636('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xa636('0x1c'))(new Redis(config[_0xa636('0x1b')]));require(_0xa636('0x1d'))[_0xa636('0x1e')](socket);function respondWithStatusCode(_0x408377,_0x1643dc){_0x1643dc=_0x1643dc||0xcc;return function(_0x1f271b){if(_0x1f271b){return _0x408377[_0xa636('0x1f')](_0x1643dc);}return _0x408377[_0xa636('0x20')](_0x1643dc)['end']();};}function respondWithResult(_0x2a049a,_0x178d3d){_0x178d3d=_0x178d3d||0xc8;return function(_0x568433){if(_0x568433){return _0x2a049a[_0xa636('0x20')](_0x178d3d)[_0xa636('0x21')](_0x568433);}};}function respondWithFilteredResult(_0x5182e7,_0xe9c546){return function(_0x1b6cdc){if(_0x1b6cdc){var _0x1efa7f=typeof _0xe9c546[_0xa636('0x22')]===_0xa636('0x23')&&typeof _0xe9c546['limit']===_0xa636('0x23');var _0x2a7fcc=_0x1b6cdc[_0xa636('0x24')];var _0x8f0787=_0x1efa7f?0x0:_0xe9c546['offset'];var _0x2f398d=_0x1efa7f?_0x1b6cdc['count']:_0xe9c546[_0xa636('0x22')]+_0xe9c546[_0xa636('0x25')];var _0x3f0172;if(_0x2f398d>=_0x2a7fcc){_0x2f398d=_0x2a7fcc;_0x3f0172=0xc8;}else{_0x3f0172=0xce;}_0x5182e7[_0xa636('0x20')](_0x3f0172);return _0x5182e7['set'](_0xa636('0x26'),_0x8f0787+'-'+_0x2f398d+'/'+_0x2a7fcc)[_0xa636('0x21')](_0x1b6cdc);}return null;};}function patchUpdates(_0x4660b7){return function(_0x4150ba){try{jsonpatch[_0xa636('0x27')](_0x4150ba,_0x4660b7,!![]);}catch(_0x67b903){return BPromise[_0xa636('0x28')](_0x67b903);}return _0x4150ba['save']();};}function saveUpdates(_0x3d2294,_0x7c9884){return function(_0x41f97b){if(_0x41f97b){return _0x41f97b[_0xa636('0x29')](_0x3d2294)[_0xa636('0x2a')](function(_0xf9ecd5){return _0xf9ecd5;});}return null;};}function removeEntity(_0x4fd857,_0x5d0894){return function(_0x300112){if(_0x300112){return _0x300112[_0xa636('0x2b')]()[_0xa636('0x2a')](function(){_0x4fd857[_0xa636('0x20')](0xcc)[_0xa636('0x2c')]();});}};}function handleEntityNotFound(_0xfb7ec4,_0x5dab3d){return function(_0x5d0021){if(!_0x5d0021){_0xfb7ec4[_0xa636('0x1f')](0x194);}return _0x5d0021;};}function handleError(_0x101ef3,_0x5420c9){_0x5420c9=_0x5420c9||0x1f4;return function(_0x454530){logger['error'](_0x454530[_0xa636('0x2d')]);if(_0x454530[_0xa636('0x2e')]){delete _0x454530[_0xa636('0x2e')];}_0x101ef3[_0xa636('0x20')](_0x5420c9)[_0xa636('0x2f')](_0x454530);};}exports['index']=function(_0x2af7f0,_0x8c1510){var _0x4c85d5={},_0x265d1a={},_0x1ebda0={'count':0x0,'rows':[]};var _0x3a41c9=_[_0xa636('0x30')](db[_0xa636('0x31')]['rawAttributes'],function(_0x16aa13){return{'name':_0x16aa13[_0xa636('0x32')],'type':_0x16aa13[_0xa636('0x33')][_0xa636('0x34')]};});_0x265d1a[_0xa636('0x35')]=_['map'](_0x3a41c9,_0xa636('0x2e'));_0x265d1a[_0xa636('0x36')]=_['keys'](_0x2af7f0[_0xa636('0x36')]);_0x265d1a['filters']=_[_0xa636('0x37')](_0x265d1a[_0xa636('0x35')],_0x265d1a[_0xa636('0x36')]);_0x4c85d5[_0xa636('0x38')]=_[_0xa636('0x37')](_0x265d1a[_0xa636('0x35')],qs['fields'](_0x2af7f0[_0xa636('0x36')][_0xa636('0x39')]));_0x4c85d5['attributes']=_0x4c85d5[_0xa636('0x38')]['length']?_0x4c85d5[_0xa636('0x38')]:_0x265d1a[_0xa636('0x35')];if(!_0x2af7f0['query'][_0xa636('0x3a')]('nolimit')){_0x4c85d5[_0xa636('0x25')]=qs[_0xa636('0x25')](_0x2af7f0[_0xa636('0x36')]['limit']);_0x4c85d5[_0xa636('0x22')]=qs[_0xa636('0x22')](_0x2af7f0[_0xa636('0x36')][_0xa636('0x22')]);}_0x4c85d5['order']=qs[_0xa636('0x3b')](_0x2af7f0[_0xa636('0x36')][_0xa636('0x3b')]);_0x4c85d5[_0xa636('0x3c')]=qs[_0xa636('0x3d')](_[_0xa636('0x3e')](_0x2af7f0[_0xa636('0x36')],_0x265d1a[_0xa636('0x3d')]),_0x3a41c9);if(_0x2af7f0[_0xa636('0x36')][_0xa636('0x3f')]){_0x4c85d5['where']=_[_0xa636('0x40')](_0x4c85d5[_0xa636('0x3c')],{'$or':_[_0xa636('0x30')](_0x3a41c9,function(_0x2102e2){if(_0x2102e2[_0xa636('0x33')]!==_0xa636('0x41')){var _0x495bbd={};_0x495bbd[_0x2102e2[_0xa636('0x2e')]]={'$like':'%'+_0x2af7f0[_0xa636('0x36')][_0xa636('0x3f')]+'%'};return _0x495bbd;}})});}_0x4c85d5=_[_0xa636('0x40')]({},_0x4c85d5,_0x2af7f0[_0xa636('0x42')]);var _0x2fad65={'where':_0x4c85d5[_0xa636('0x3c')]};return db[_0xa636('0x31')]['count'](_0x2fad65)[_0xa636('0x2a')](function(_0x3b8d27){_0x1ebda0[_0xa636('0x24')]=_0x3b8d27;if(_0x2af7f0[_0xa636('0x36')][_0xa636('0x43')]){_0x4c85d5[_0xa636('0x44')]=[{'all':!![]}];}return db[_0xa636('0x31')]['findAll'](_0x4c85d5);})[_0xa636('0x2a')](function(_0x517c1d){_0x1ebda0[_0xa636('0x45')]=_0x517c1d;return _0x1ebda0;})[_0xa636('0x2a')](respondWithFilteredResult(_0x8c1510,_0x4c85d5))[_0xa636('0x46')](handleError(_0x8c1510,null));};exports[_0xa636('0x47')]=function(_0xaac959,_0x26b659){var _0x55f1a8={'raw':!![],'where':{'id':_0xaac959[_0xa636('0x48')]['id']}},_0x1ef7e0={};_0x1ef7e0[_0xa636('0x35')]=_['keys'](db[_0xa636('0x31')][_0xa636('0x49')]);_0x1ef7e0[_0xa636('0x36')]=_['keys'](_0xaac959[_0xa636('0x36')]);_0x1ef7e0[_0xa636('0x3d')]=_[_0xa636('0x37')](_0x1ef7e0['model'],_0x1ef7e0[_0xa636('0x36')]);_0x55f1a8[_0xa636('0x38')]=_[_0xa636('0x37')](_0x1ef7e0[_0xa636('0x35')],qs[_0xa636('0x39')](_0xaac959[_0xa636('0x36')]['fields']));_0x55f1a8[_0xa636('0x38')]=_0x55f1a8[_0xa636('0x38')]['length']?_0x55f1a8[_0xa636('0x38')]:_0x1ef7e0[_0xa636('0x35')];if(_0xaac959[_0xa636('0x36')][_0xa636('0x43')]){_0x55f1a8['include']=[{'all':!![]}];}_0x55f1a8=_[_0xa636('0x40')]({},_0x55f1a8,_0xaac959[_0xa636('0x42')]);return db['ChatInternalMessage'][_0xa636('0x4a')](_0x55f1a8)[_0xa636('0x2a')](handleEntityNotFound(_0x26b659,null))[_0xa636('0x2a')](respondWithResult(_0x26b659,null))['catch'](handleError(_0x26b659,null));};exports[_0xa636('0x4b')]=function(_0xf6c38b,_0x2db202){return db[_0xa636('0x31')][_0xa636('0x4b')](_0xf6c38b[_0xa636('0x4c')],{})[_0xa636('0x2a')](respondWithResult(_0x2db202,0xc9))[_0xa636('0x46')](handleError(_0x2db202,null));};exports[_0xa636('0x29')]=function(_0xa70622,_0x355fbd){if(_0xa70622[_0xa636('0x4c')]['id']){delete _0xa70622[_0xa636('0x4c')]['id'];}return db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'id':_0xa70622[_0xa636('0x48')]['id']}})['then'](handleEntityNotFound(_0x355fbd,null))[_0xa636('0x2a')](saveUpdates(_0xa70622[_0xa636('0x4c')],null))[_0xa636('0x2a')](respondWithResult(_0x355fbd,null))[_0xa636('0x46')](handleError(_0x355fbd,null));};exports[_0xa636('0x2b')]=function(_0x16f5c8,_0x17c5d0){return db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'id':_0x16f5c8['params']['id']}})['then'](handleEntityNotFound(_0x17c5d0,null))[_0xa636('0x2a')](removeEntity(_0x17c5d0,null))['catch'](handleError(_0x17c5d0,null));};exports[_0xa636('0x4d')]=function(_0x96a429,_0x282414){return db[_0xa636('0x31')][_0xa636('0x4d')]()[_0xa636('0x2a')](respondWithResult(_0x282414,null))[_0xa636('0x46')](handleError(_0x282414,null));};function wrapUser(_0x491fa0){return function(_0x25c3ef){var _0x598fd6=_0x491fa0[_0xa636('0x4e')]({'plain':!![]});_0x598fd6[_0xa636('0x4f')]=[];if(_0x25c3ef){_0x598fd6[_0xa636('0x50')]=_0x25c3ef[_0xa636('0x51')];_0x598fd6[_0xa636('0x52')]=_0x25c3ef;}else{_0x598fd6[_0xa636('0x50')]=moment(0x0)[_0xa636('0x53')](_0xa636('0x54'));_0x598fd6[_0xa636('0x52')]={};}return _0x598fd6;};}exports['getUsers']=function(_0x1f88b1,_0x33012b,_0x541f12){var _0x2b1177=[];return db['User']['findAll']({'where':{'role':[_0xa636('0x55'),_0xa636('0x56'),_0xa636('0x57')]},'attributes':['id',_0xa636('0x58'),_0xa636('0x2e'),'role',_0xa636('0x59'),_0xa636('0x5a'),_0xa636('0x5b'),_0xa636('0x5c'),_0xa636('0x5d'),'showWebBar'],'order':qs[_0xa636('0x3b')](_0xa636('0x5e')),'include':[{'model':db[_0xa636('0x5f')],'as':_0xa636('0x60'),'attributes':['id','name',_0xa636('0x33')],'through':{'attributes':[]}}]})[_0xa636('0x2a')](function(_0xacac1a){if(_0xacac1a){var _0x3a0577=_0x1f88b1[_0xa636('0x57')][_0xa636('0x4e')]({'plain':!![]});if(!_0x3a0577)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a0577[_0xa636('0x61')]===_0xa636('0x57')){return db[_0xa636('0x62')][_0xa636('0x4a')]({'where':{'name':'Agents','userProfileId':_0x3a0577['userProfileId']},'raw':!![]})[_0xa636('0x2a')](function(_0x711f73){if(_0x711f73){if(_0x711f73[_0xa636('0x63')]===0x0){return db[_0xa636('0x64')][_0xa636('0x65')]({'where':{'sectionId':_0x711f73['id']},'raw':!![]})[_0xa636('0x2a')](function(_0x55fb0b){var _0x2a9bec=[];if(_[_0xa636('0x66')](_0x55fb0b)){_0x2a9bec=_['filter'](_0xacac1a,function(_0x3d5a71){if(_0x3d5a71[_0xa636('0x61')]!==_0xa636('0x55')){return _0x3d5a71;}});return _0x2a9bec;}else{for(var _0x38fa75=0x0;_0x38fa75<_0xacac1a[_0xa636('0x67')];_0x38fa75++){var _0xb83328=_0xacac1a[_0x38fa75];if(_0xb83328['role']===_0xa636('0x55')){var _0x4e851d=_['find'](_0x55fb0b,function(_0x1232d1){return _0x1232d1[_0xa636('0x68')]===_0xb83328['id'];});if(_0x4e851d)_0x2a9bec[_0xa636('0x69')](_0xb83328);}else{_0x2a9bec[_0xa636('0x69')](_0xb83328);}}return _0x2a9bec;}});}else{return _0xacac1a;}}else{var _0x22cffc=_[_0xa636('0x3f')](_0xacac1a,function(_0x28b730){if(_0x28b730['role']!=='agent'){return _0x28b730;}});return _0x22cffc;}});}else{return _0xacac1a;}}})['then'](function(_0xb9d50d){var _0x10ebce=[];if(_0xb9d50d){_0x2b1177=_0xb9d50d;for(var _0xd4a4d0=0x0;_0xd4a4d0<_0xb9d50d[_0xa636('0x67')];_0xd4a4d0+=0x1){_0x2b1177[_0xd4a4d0]['messages']=[];_0x10ebce[_0xa636('0x69')](db[_0xa636('0x31')][_0xa636('0x4a')]({'where':{'FromId':[_0x1f88b1[_0xa636('0x57')]['id'],_0xb9d50d[_0xd4a4d0]['id']],'ToId':[_0x1f88b1[_0xa636('0x57')]['id'],_0xb9d50d[_0xd4a4d0]['id']],'ChatGroupId':null},'attributes':['id',_0xa636('0x51'),_0xa636('0x6a'),_0xa636('0x6b'),_0xa636('0x6c'),_0xa636('0x4c')],'order':qs[_0xa636('0x3b')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa636('0x2a')](wrapUser(_0xb9d50d[_0xd4a4d0])));}return BPromise[_0xa636('0x6d')](_0x10ebce);}return[];})[_0xa636('0x2a')](function(_0x3ec371){return{'rows':_0x3ec371,'count':_0x3ec371['length']};})[_0xa636('0x2a')](respondWithResult(_0x33012b,null))['catch'](handleError(_0x33012b,null));}; \ No newline at end of file +var _0x65dd=['rawAttributes','create','body','find','describe','messages','lastMessageAt','createdAt','format','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','push','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','ChatInternalMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0xcb4d8f,_0x486ba4){var _0x26000c=function(_0x44ac3d){while(--_0x44ac3d){_0xcb4d8f['push'](_0xcb4d8f['shift']());}};_0x26000c(++_0x486ba4);}(_0x65dd,0x101));var _0xd65d=function(_0x1f4319,_0x588e65){_0x1f4319=_0x1f4319-0x0;var _0x50b66f=_0x65dd[_0x1f4319];return _0x50b66f;};'use strict';var emlformat=require(_0xd65d('0x0'));var rimraf=require(_0xd65d('0x1'));var zipdir=require(_0xd65d('0x2'));var jsonpatch=require(_0xd65d('0x3'));var rp=require(_0xd65d('0x4'));var moment=require(_0xd65d('0x5'));var BPromise=require(_0xd65d('0x6'));var Mustache=require('mustache');var util=require(_0xd65d('0x7'));var path=require(_0xd65d('0x8'));var sox=require(_0xd65d('0x9'));var csv=require(_0xd65d('0xa'));var ejs=require(_0xd65d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd65d('0xc'));var squel=require('squel');var crypto=require(_0xd65d('0xd'));var jsforce=require(_0xd65d('0xe'));var deskjs=require(_0xd65d('0xf'));var toCsv=require(_0xd65d('0xa'));var querystring=require('querystring');var Papa=require(_0xd65d('0x10'));var Redis=require('ioredis');var authService=require(_0xd65d('0x11'));var qs=require(_0xd65d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd65d('0x13'));var utils=require(_0xd65d('0x14'));var config=require(_0xd65d('0x15'));var licenseUtil=require(_0xd65d('0x16'));var db=require(_0xd65d('0x17'))['db'];config[_0xd65d('0x18')]=_['defaults'](config['redis'],{'host':_0xd65d('0x19'),'port':0x18eb});var socket=require(_0xd65d('0x1a'))(new Redis(config[_0xd65d('0x18')]));require(_0xd65d('0x1b'))[_0xd65d('0x1c')](socket);function respondWithStatusCode(_0x53c1e6,_0x603afd){_0x603afd=_0x603afd||0xcc;return function(_0x2bf4c0){if(_0x2bf4c0){return _0x53c1e6[_0xd65d('0x1d')](_0x603afd);}return _0x53c1e6['status'](_0x603afd)[_0xd65d('0x1e')]();};}function respondWithResult(_0x5c58db,_0x55b8d5){_0x55b8d5=_0x55b8d5||0xc8;return function(_0xe346c){if(_0xe346c){return _0x5c58db[_0xd65d('0x1f')](_0x55b8d5)['json'](_0xe346c);}};}function respondWithFilteredResult(_0xdec6b7,_0x171dc3){return function(_0x1a0673){if(_0x1a0673){var _0x5e891a=typeof _0x171dc3[_0xd65d('0x20')]===_0xd65d('0x21')&&typeof _0x171dc3[_0xd65d('0x22')]===_0xd65d('0x21');var _0x296c7b=_0x1a0673[_0xd65d('0x23')];var _0x41bbd1=_0x5e891a?0x0:_0x171dc3['offset'];var _0x17ee8c=_0x5e891a?_0x1a0673[_0xd65d('0x23')]:_0x171dc3[_0xd65d('0x20')]+_0x171dc3[_0xd65d('0x22')];var _0x1dda14;if(_0x17ee8c>=_0x296c7b){_0x17ee8c=_0x296c7b;_0x1dda14=0xc8;}else{_0x1dda14=0xce;}_0xdec6b7[_0xd65d('0x1f')](_0x1dda14);return _0xdec6b7[_0xd65d('0x24')](_0xd65d('0x25'),_0x41bbd1+'-'+_0x17ee8c+'/'+_0x296c7b)['json'](_0x1a0673);}return null;};}function patchUpdates(_0x490cfa){return function(_0x177df0){try{jsonpatch[_0xd65d('0x26')](_0x177df0,_0x490cfa,!![]);}catch(_0x51eecb){return BPromise[_0xd65d('0x27')](_0x51eecb);}return _0x177df0['save']();};}function saveUpdates(_0x35b895,_0x2105ba){return function(_0x341830){if(_0x341830){return _0x341830[_0xd65d('0x28')](_0x35b895)[_0xd65d('0x29')](function(_0x141292){return _0x141292;});}return null;};}function removeEntity(_0x4e209b,_0x235220){return function(_0x2427af){if(_0x2427af){return _0x2427af[_0xd65d('0x2a')]()[_0xd65d('0x29')](function(){_0x4e209b[_0xd65d('0x1f')](0xcc)[_0xd65d('0x1e')]();});}};}function handleEntityNotFound(_0x2768ab,_0x4ed194){return function(_0x526fed){if(!_0x526fed){_0x2768ab[_0xd65d('0x1d')](0x194);}return _0x526fed;};}function handleError(_0x5d415b,_0x16f08f){_0x16f08f=_0x16f08f||0x1f4;return function(_0x44776e){logger['error'](_0x44776e[_0xd65d('0x2b')]);if(_0x44776e[_0xd65d('0x2c')]){delete _0x44776e['name'];}_0x5d415b[_0xd65d('0x1f')](_0x16f08f)[_0xd65d('0x2d')](_0x44776e);};}exports['index']=function(_0x282214,_0x2f499a){var _0x71b740={},_0x235ec6={},_0x185817={'count':0x0,'rows':[]};var _0x47aa81=_[_0xd65d('0x2e')](db[_0xd65d('0x2f')]['rawAttributes'],function(_0x4c1c03){return{'name':_0x4c1c03[_0xd65d('0x30')],'type':_0x4c1c03[_0xd65d('0x31')][_0xd65d('0x32')]};});_0x235ec6[_0xd65d('0x33')]=_[_0xd65d('0x2e')](_0x47aa81,'name');_0x235ec6[_0xd65d('0x34')]=_[_0xd65d('0x35')](_0x282214['query']);_0x235ec6[_0xd65d('0x36')]=_[_0xd65d('0x37')](_0x235ec6[_0xd65d('0x33')],_0x235ec6[_0xd65d('0x34')]);_0x71b740[_0xd65d('0x38')]=_[_0xd65d('0x37')](_0x235ec6[_0xd65d('0x33')],qs[_0xd65d('0x39')](_0x282214[_0xd65d('0x34')][_0xd65d('0x39')]));_0x71b740[_0xd65d('0x38')]=_0x71b740['attributes'][_0xd65d('0x3a')]?_0x71b740[_0xd65d('0x38')]:_0x235ec6[_0xd65d('0x33')];if(!_0x282214[_0xd65d('0x34')][_0xd65d('0x3b')](_0xd65d('0x3c'))){_0x71b740[_0xd65d('0x22')]=qs[_0xd65d('0x22')](_0x282214['query']['limit']);_0x71b740[_0xd65d('0x20')]=qs[_0xd65d('0x20')](_0x282214[_0xd65d('0x34')][_0xd65d('0x20')]);}_0x71b740[_0xd65d('0x3d')]=qs[_0xd65d('0x3e')](_0x282214[_0xd65d('0x34')][_0xd65d('0x3e')]);_0x71b740[_0xd65d('0x3f')]=qs[_0xd65d('0x36')](_[_0xd65d('0x40')](_0x282214[_0xd65d('0x34')],_0x235ec6['filters']),_0x47aa81);if(_0x282214[_0xd65d('0x34')][_0xd65d('0x41')]){_0x71b740['where']=_[_0xd65d('0x42')](_0x71b740[_0xd65d('0x3f')],{'$or':_[_0xd65d('0x2e')](_0x47aa81,function(_0xa1957b){if(_0xa1957b[_0xd65d('0x31')]!==_0xd65d('0x43')){var _0x32534d={};_0x32534d[_0xa1957b[_0xd65d('0x2c')]]={'$like':'%'+_0x282214[_0xd65d('0x34')][_0xd65d('0x41')]+'%'};return _0x32534d;}})});}_0x71b740=_[_0xd65d('0x42')]({},_0x71b740,_0x282214[_0xd65d('0x44')]);var _0x58a506={'where':_0x71b740[_0xd65d('0x3f')]};return db['ChatInternalMessage']['count'](_0x58a506)['then'](function(_0x4f3f1d){_0x185817[_0xd65d('0x23')]=_0x4f3f1d;if(_0x282214['query'][_0xd65d('0x45')]){_0x71b740[_0xd65d('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0xd65d('0x47')](_0x71b740);})[_0xd65d('0x29')](function(_0x26aa0b){_0x185817[_0xd65d('0x48')]=_0x26aa0b;return _0x185817;})[_0xd65d('0x29')](respondWithFilteredResult(_0x2f499a,_0x71b740))[_0xd65d('0x49')](handleError(_0x2f499a,null));};exports[_0xd65d('0x4a')]=function(_0x132f16,_0x263055){var _0x55e2ae={'raw':!![],'where':{'id':_0x132f16[_0xd65d('0x4b')]['id']}},_0xf43bf={};_0xf43bf[_0xd65d('0x33')]=_[_0xd65d('0x35')](db[_0xd65d('0x2f')][_0xd65d('0x4c')]);_0xf43bf[_0xd65d('0x34')]=_[_0xd65d('0x35')](_0x132f16['query']);_0xf43bf[_0xd65d('0x36')]=_[_0xd65d('0x37')](_0xf43bf['model'],_0xf43bf[_0xd65d('0x34')]);_0x55e2ae[_0xd65d('0x38')]=_[_0xd65d('0x37')](_0xf43bf[_0xd65d('0x33')],qs[_0xd65d('0x39')](_0x132f16[_0xd65d('0x34')][_0xd65d('0x39')]));_0x55e2ae[_0xd65d('0x38')]=_0x55e2ae[_0xd65d('0x38')]['length']?_0x55e2ae[_0xd65d('0x38')]:_0xf43bf[_0xd65d('0x33')];if(_0x132f16[_0xd65d('0x34')][_0xd65d('0x45')]){_0x55e2ae['include']=[{'all':!![]}];}_0x55e2ae=_['merge']({},_0x55e2ae,_0x132f16[_0xd65d('0x44')]);return db[_0xd65d('0x2f')]['find'](_0x55e2ae)[_0xd65d('0x29')](handleEntityNotFound(_0x263055,null))[_0xd65d('0x29')](respondWithResult(_0x263055,null))[_0xd65d('0x49')](handleError(_0x263055,null));};exports[_0xd65d('0x4d')]=function(_0x1e9daa,_0x25c5b1){return db[_0xd65d('0x2f')][_0xd65d('0x4d')](_0x1e9daa[_0xd65d('0x4e')],{})[_0xd65d('0x29')](respondWithResult(_0x25c5b1,0xc9))['catch'](handleError(_0x25c5b1,null));};exports[_0xd65d('0x28')]=function(_0x1ce101,_0x304a13){if(_0x1ce101[_0xd65d('0x4e')]['id']){delete _0x1ce101[_0xd65d('0x4e')]['id'];}return db[_0xd65d('0x2f')][_0xd65d('0x4f')]({'where':{'id':_0x1ce101[_0xd65d('0x4b')]['id']}})[_0xd65d('0x29')](handleEntityNotFound(_0x304a13,null))['then'](saveUpdates(_0x1ce101[_0xd65d('0x4e')],null))[_0xd65d('0x29')](respondWithResult(_0x304a13,null))[_0xd65d('0x49')](handleError(_0x304a13,null));};exports[_0xd65d('0x2a')]=function(_0x568d21,_0x2caedc){return db['ChatInternalMessage'][_0xd65d('0x4f')]({'where':{'id':_0x568d21[_0xd65d('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2caedc,null))[_0xd65d('0x29')](removeEntity(_0x2caedc,null))['catch'](handleError(_0x2caedc,null));};exports[_0xd65d('0x50')]=function(_0x2929d3,_0x64106b){return db[_0xd65d('0x2f')][_0xd65d('0x50')]()[_0xd65d('0x29')](respondWithResult(_0x64106b,null))[_0xd65d('0x49')](handleError(_0x64106b,null));};function wrapUser(_0x1d2d31){return function(_0x6acdb6){var _0x2b9bc8=_0x1d2d31['get']({'plain':!![]});_0x2b9bc8[_0xd65d('0x51')]=[];if(_0x6acdb6){_0x2b9bc8[_0xd65d('0x52')]=_0x6acdb6[_0xd65d('0x53')];_0x2b9bc8['lastMessage']=_0x6acdb6;}else{_0x2b9bc8['lastMessageAt']=moment(0x0)[_0xd65d('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b9bc8['lastMessage']={};}return _0x2b9bc8;};}exports[_0xd65d('0x55')]=function(_0x391d17,_0x19e4ff,_0x526ed1){var _0xcc6e7c=[];return db[_0xd65d('0x56')][_0xd65d('0x47')]({'where':{'role':[_0xd65d('0x57'),_0xd65d('0x58'),_0xd65d('0x59')]},'attributes':['id',_0xd65d('0x5a'),'name',_0xd65d('0x5b'),_0xd65d('0x5c'),_0xd65d('0x5d'),_0xd65d('0x5e'),_0xd65d('0x5f'),_0xd65d('0x60'),_0xd65d('0x61')],'order':qs[_0xd65d('0x3e')]('-online'),'include':[{'model':db[_0xd65d('0x62')],'as':_0xd65d('0x63'),'attributes':['id',_0xd65d('0x2c'),'type'],'through':{'attributes':[]}}]})[_0xd65d('0x29')](function(_0x3d1c3d){if(_0x3d1c3d){var _0x442bdf=_0x391d17[_0xd65d('0x59')][_0xd65d('0x64')]({'plain':!![]});if(!_0x442bdf)throw new Error(_0xd65d('0x65'));if(_0x442bdf['role']==='user'){return db[_0xd65d('0x66')][_0xd65d('0x4f')]({'where':{'name':_0xd65d('0x67'),'userProfileId':_0x442bdf[_0xd65d('0x68')]},'raw':!![]})[_0xd65d('0x29')](function(_0x45c40c){if(_0x45c40c){if(_0x45c40c['autoAssociation']===0x0){return db[_0xd65d('0x69')]['findAll']({'where':{'sectionId':_0x45c40c['id']},'raw':!![]})[_0xd65d('0x29')](function(_0x18f92a){var _0x429929=[];if(_[_0xd65d('0x6a')](_0x18f92a)){_0x429929=_[_0xd65d('0x41')](_0x3d1c3d,function(_0x44d25a){if(_0x44d25a['role']!==_0xd65d('0x57')){return _0x44d25a;}});return _0x429929;}else{for(var _0x2cd631=0x0;_0x2cd631<_0x3d1c3d[_0xd65d('0x3a')];_0x2cd631++){var _0x3c3950=_0x3d1c3d[_0x2cd631];if(_0x3c3950[_0xd65d('0x5b')]===_0xd65d('0x57')){var _0x4eea3e=_['find'](_0x18f92a,function(_0x5adae1){return _0x5adae1['resourceId']===_0x3c3950['id'];});if(_0x4eea3e)_0x429929['push'](_0x3c3950);}else{_0x429929[_0xd65d('0x6b')](_0x3c3950);}}return _0x429929;}});}else{return _0x3d1c3d;}}else{var _0x3e4fad=_[_0xd65d('0x41')](_0x3d1c3d,function(_0x579da8){if(_0x579da8[_0xd65d('0x5b')]!=='agent'){return _0x579da8;}});return _0x3e4fad;}});}else{return _0x3d1c3d;}}})['then'](function(_0x19ada3){var _0x2c1631=[];if(_0x19ada3){_0xcc6e7c=_0x19ada3;for(var _0x3b7433=0x0;_0x3b7433<_0x19ada3[_0xd65d('0x3a')];_0x3b7433+=0x1){_0xcc6e7c[_0x3b7433]['messages']=[];_0x2c1631[_0xd65d('0x6b')](db['ChatInternalMessage'][_0xd65d('0x4f')]({'where':{'FromId':[_0x391d17[_0xd65d('0x59')]['id'],_0x19ada3[_0x3b7433]['id']],'ToId':[_0x391d17[_0xd65d('0x59')]['id'],_0x19ada3[_0x3b7433]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0xd65d('0x6c'),_0xd65d('0x6d'),'body'],'order':qs[_0xd65d('0x3e')](_0xd65d('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xd65d('0x29')](wrapUser(_0x19ada3[_0x3b7433])));}return BPromise['all'](_0x2c1631);}return[];})[_0xd65d('0x29')](function(_0x350d20){return{'rows':_0x350d20,'count':_0x350d20[_0xd65d('0x3a')]};})[_0xd65d('0x29')](respondWithResult(_0x19e4ff,null))[_0xd65d('0x49')](handleError(_0x19e4ff,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index a630031..0a656b9 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 _0x8e65=['update','remove','emit','hasOwnProperty','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x24e473,_0x3fdd50){var _0x3a3b78=function(_0x5d1f54){while(--_0x5d1f54){_0x24e473['push'](_0x24e473['shift']());}};_0x3a3b78(++_0x3fdd50);}(_0x8e65,0x1ac));var _0x58e6=function(_0x3df4aa,_0x1d5dcf){_0x3df4aa=_0x3df4aa-0x0;var _0x30ca47=_0x8e65[_0x3df4aa];return _0x30ca47;};'use strict';var EventEmitter=require(_0x58e6('0x0'));var ChatInternalMessage=require(_0x58e6('0x1'))['db'][_0x58e6('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x58e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x58e6('0x4'),'afterDestroy':_0x58e6('0x5')};function emitEvent(_0x3efd67){return function(_0x2f73be,_0x6475f2,_0x536be3){ChatInternalMessageEvents[_0x58e6('0x6')](_0x3efd67+':'+_0x2f73be['id'],_0x2f73be);ChatInternalMessageEvents[_0x58e6('0x6')](_0x3efd67,_0x2f73be);_0x536be3(null);};}for(var e in events){if(events[_0x58e6('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0xd96c=['remove','emit','hasOwnProperty','exports','events','ChatInternalMessage','setMaxListeners','save','update'];(function(_0x31d8ec,_0x1e1859){var _0x184782=function(_0x547c9d){while(--_0x547c9d){_0x31d8ec['push'](_0x31d8ec['shift']());}};_0x184782(++_0x1e1859);}(_0xd96c,0xaf));var _0xcd96=function(_0x4f1d8f,_0x2c2d01){_0x4f1d8f=_0x4f1d8f-0x0;var _0x101bcb=_0xd96c[_0x4f1d8f];return _0x101bcb;};'use strict';var EventEmitter=require(_0xcd96('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xcd96('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcd96('0x2')](0x0);var events={'afterCreate':_0xcd96('0x3'),'afterUpdate':_0xcd96('0x4'),'afterDestroy':_0xcd96('0x5')};function emitEvent(_0x593195){return function(_0x36e2c6,_0x28036e,_0x3157e8){ChatInternalMessageEvents[_0xcd96('0x6')](_0x593195+':'+_0x36e2c6['id'],_0x36e2c6);ChatInternalMessageEvents[_0xcd96('0x6')](_0x593195,_0x36e2c6);_0x3157e8(null);};}for(var e in events){if(events[_0xcd96('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xcd96('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index b030528..5a725c8 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 _0xf1a2=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x576119,_0x282fbe){var _0x540253=function(_0x24b26a){while(--_0x24b26a){_0x576119['push'](_0x576119['shift']());}};_0x540253(++_0x282fbe);}(_0xf1a2,0xc2));var _0x2f1a=function(_0x605fb9,_0x45062c){_0x605fb9=_0x605fb9-0x0;var _0x21040e=_0xf1a2[_0x605fb9];return _0x21040e;};'use strict';var _=require(_0x2f1a('0x0'));var util=require(_0x2f1a('0x1'));var logger=require('../../config/logger')(_0x2f1a('0x2'));var moment=require(_0x2f1a('0x3'));var BPromise=require(_0x2f1a('0x4'));var rp=require(_0x2f1a('0x5'));var fs=require('fs');var path=require(_0x2f1a('0x6'));var rimraf=require(_0x2f1a('0x7'));var config=require(_0x2f1a('0x8'));var attributes=require(_0x2f1a('0x9'));module[_0x2f1a('0xa')]=function(_0x148018,_0x3970cb){return _0x148018['define'](_0x2f1a('0xb'),attributes,{'tableName':_0x2f1a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2f1a('0xd'),'collate':_0x2f1a('0xe')});}; \ No newline at end of file +var _0x8497=['path','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x278de2,_0xe1ade6){var _0x4365b8=function(_0x462e72){while(--_0x462e72){_0x278de2['push'](_0x278de2['shift']());}};_0x4365b8(++_0xe1ade6);}(_0x8497,0x1ca));var _0x7849=function(_0x188496,_0x567bb4){_0x188496=_0x188496-0x0;var _0x286be3=_0x8497[_0x188496];return _0x286be3;};'use strict';var _=require(_0x7849('0x0'));var util=require(_0x7849('0x1'));var logger=require(_0x7849('0x2'))(_0x7849('0x3'));var moment=require(_0x7849('0x4'));var BPromise=require(_0x7849('0x5'));var rp=require(_0x7849('0x6'));var fs=require('fs');var path=require(_0x7849('0x7'));var rimraf=require('rimraf');var config=require(_0x7849('0x8'));var attributes=require(_0x7849('0x9'));module[_0x7849('0xa')]=function(_0x22e484,_0x1ff75f){return _0x22e484[_0x7849('0xb')](_0x7849('0xc'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7849('0xd'),'collate':_0x7849('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1f91730..9497628 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 _0x407c=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch'];(function(_0x542da8,_0x509c26){var _0x533d7e=function(_0x2a3d04){while(--_0x2a3d04){_0x542da8['push'](_0x542da8['shift']());}};_0x533d7e(++_0x509c26);}(_0x407c,0x68));var _0xc407=function(_0x342940,_0x5cbb91){_0x342940=_0x342940-0x0;var _0x5d5fe8=_0x407c[_0x342940];return _0x5d5fe8;};'use strict';var _=require(_0xc407('0x0'));var util=require('util');var moment=require(_0xc407('0x1'));var BPromise=require(_0xc407('0x2'));var rs=require(_0xc407('0x3'));var fs=require('fs');var Redis=require(_0xc407('0x4'));var db=require(_0xc407('0x5'))['db'];var utils=require(_0xc407('0x6'));var logger=require('../../config/logger')(_0xc407('0x7'));var config=require(_0xc407('0x8'));var jayson=require(_0xc407('0x9'));var client=jayson['client'][_0xc407('0xa')]({'port':0x232a});config['redis']=_[_0xc407('0xb')](config[_0xc407('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc407('0xd'))(new Redis(config[_0xc407('0xc')]));require(_0xc407('0xe'))[_0xc407('0xf')](socket);function respondWithRpcPromise(_0x370cc4,_0x7acab5,_0x2bcfa7){return new BPromise(function(_0x1abaf9,_0x1e0245){return client[_0xc407('0x10')](_0x370cc4,_0x2bcfa7)['then'](function(_0x1d94be){logger[_0xc407('0x11')](_0xc407('0x12'),_0x7acab5,'request\x20sent');logger[_0xc407('0x13')](_0xc407('0x14'),_0x7acab5,'request\x20sent',JSON['stringify'](_0x1d94be));if(_0x1d94be['error']){if(_0x1d94be[_0xc407('0x15')]['code']===0x1f4){logger[_0xc407('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x7acab5,_0x1d94be[_0xc407('0x15')]['message']);return _0x1e0245(_0x1d94be[_0xc407('0x15')][_0xc407('0x16')]);}logger[_0xc407('0x15')](_0xc407('0x12'),_0x7acab5,_0x1d94be[_0xc407('0x15')][_0xc407('0x16')]);return _0x1abaf9(_0x1d94be['error'][_0xc407('0x16')]);}else{logger['info'](_0xc407('0x12'),_0x7acab5,_0xc407('0x17'));_0x1abaf9(_0x1d94be[_0xc407('0x18')][_0xc407('0x16')]);}})[_0xc407('0x19')](function(_0x55b4d1){logger['error'](_0xc407('0x12'),_0x7acab5,_0x55b4d1);_0x1e0245(_0x55b4d1);});});} \ No newline at end of file +var _0x5d77=['bluebird','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x1428d9,_0xded63c){var _0x438019=function(_0x31c37d){while(--_0x31c37d){_0x1428d9['push'](_0x1428d9['shift']());}};_0x438019(++_0xded63c);}(_0x5d77,0xee));var _0x75d7=function(_0x3fd98d,_0x13c5c5){_0x3fd98d=_0x3fd98d-0x0;var _0xb70633=_0x5d77[_0x3fd98d];return _0xb70633;};'use strict';var _=require(_0x75d7('0x0'));var util=require(_0x75d7('0x1'));var moment=require('moment');var BPromise=require(_0x75d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x75d7('0x3'))(_0x75d7('0x4'));var config=require('../../config/environment');var jayson=require(_0x75d7('0x5'));var client=jayson[_0x75d7('0x6')][_0x75d7('0x7')]({'port':0x232a});config[_0x75d7('0x8')]=_[_0x75d7('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x75d7('0xa'))(new Redis(config[_0x75d7('0x8')]));require(_0x75d7('0xb'))['register'](socket);function respondWithRpcPromise(_0x30ea0e,_0x254ac3,_0x2cf730){return new BPromise(function(_0x1d8fd6,_0x533571){return client[_0x75d7('0xc')](_0x30ea0e,_0x2cf730)[_0x75d7('0xd')](function(_0x1f2c88){logger[_0x75d7('0xe')](_0x75d7('0xf'),_0x254ac3,_0x75d7('0x10'));logger[_0x75d7('0x11')](_0x75d7('0x12'),_0x254ac3,_0x75d7('0x10'),JSON[_0x75d7('0x13')](_0x1f2c88));if(_0x1f2c88['error']){if(_0x1f2c88['error']['code']===0x1f4){logger[_0x75d7('0x14')](_0x75d7('0xf'),_0x254ac3,_0x1f2c88[_0x75d7('0x14')][_0x75d7('0x15')]);return _0x533571(_0x1f2c88[_0x75d7('0x14')][_0x75d7('0x15')]);}logger[_0x75d7('0x14')](_0x75d7('0xf'),_0x254ac3,_0x1f2c88[_0x75d7('0x14')][_0x75d7('0x15')]);return _0x1d8fd6(_0x1f2c88['error']['message']);}else{logger['info'](_0x75d7('0xf'),_0x254ac3,_0x75d7('0x10'));_0x1d8fd6(_0x1f2c88[_0x75d7('0x16')][_0x75d7('0x15')]);}})[_0x75d7('0x17')](function(_0x1ea672){logger[_0x75d7('0x14')](_0x75d7('0xf'),_0x254ac3,_0x1ea672);_0x533571(_0x1ea672);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index fac6260..cce33f4 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 _0x47cc=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','removeListener','register'];(function(_0x3a0dad,_0x4bbf9e){var _0x380070=function(_0x533fe3){while(--_0x533fe3){_0x3a0dad['push'](_0x3a0dad['shift']());}};_0x380070(++_0x4bbf9e);}(_0x47cc,0x132));var _0xc47c=function(_0x15a269,_0x142a09){_0x15a269=_0x15a269-0x0;var _0x2befa6=_0x47cc[_0x15a269];return _0x2befa6;};'use strict';var ChatInternalMessageEvents=require(_0xc47c('0x0'));var events=[_0xc47c('0x1'),_0xc47c('0x2'),_0xc47c('0x3')];function createListener(_0x4b0792,_0x4de7eb){return function(_0x2a04dc){_0x4de7eb['emit'](_0x4b0792,_0x2a04dc);};}function removeListener(_0x526327,_0x5dd443){return function(){ChatInternalMessageEvents[_0xc47c('0x4')](_0x526327,_0x5dd443);};}exports[_0xc47c('0x5')]=function(_0x3a9139){for(var _0x2d118b=0x0,_0x5232d4=events[_0xc47c('0x6')];_0x2d118b<_0x5232d4;_0x2d118b++){var _0x2e5441=events[_0x2d118b];var _0x1ab432=createListener(_0xc47c('0x7')+_0x2e5441,_0x3a9139);ChatInternalMessageEvents['on'](_0x2e5441,_0x1ab432);}}; \ No newline at end of file +var _0x712f=['emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x1e8ce2,_0x46aee1){var _0x41681b=function(_0x5d78f3){while(--_0x5d78f3){_0x1e8ce2['push'](_0x1e8ce2['shift']());}};_0x41681b(++_0x46aee1);}(_0x712f,0x1f4));var _0xf712=function(_0x5b9fe0,_0x3aea14){_0x5b9fe0=_0x5b9fe0-0x0;var _0x57a762=_0x712f[_0x5b9fe0];return _0x57a762;};'use strict';var ChatInternalMessageEvents=require(_0xf712('0x0'));var events=[_0xf712('0x1'),_0xf712('0x2'),_0xf712('0x3')];function createListener(_0x3e534c,_0x1b7698){return function(_0x2decef){_0x1b7698[_0xf712('0x4')](_0x3e534c,_0x2decef);};}function removeListener(_0x546388,_0x2180b6){return function(){ChatInternalMessageEvents[_0xf712('0x5')](_0x546388,_0x2180b6);};}exports[_0xf712('0x6')]=function(_0xc72bfe){for(var _0x5bf2ef=0x0,_0x10f9e9=events[_0xf712('0x7')];_0x5bf2ef<_0x10f9e9;_0x5bf2ef++){var _0x1906e1=events[_0x5bf2ef];var _0x597798=createListener(_0xf712('0x8')+_0x1906e1,_0xc72bfe);ChatInternalMessageEvents['on'](_0x1906e1,_0x597798);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 483ef83..0a77633 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 _0x73ed=['multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','get','isAuthenticated','index','/users','getUsers','/:id','show','post','create','put','delete','exports'];(function(_0x3f3f40,_0x4c71f4){var _0x403b7a=function(_0x509014){while(--_0x509014){_0x3f3f40['push'](_0x3f3f40['shift']());}};_0x403b7a(++_0x4c71f4);}(_0x73ed,0x1a4));var _0xd73e=function(_0x2f57fe,_0x329ba4){_0x2f57fe=_0x2f57fe-0x0;var _0x297fc8=_0x73ed[_0x2f57fe];return _0x297fc8;};'use strict';var multer=require(_0xd73e('0x0'));var util=require(_0xd73e('0x1'));var path=require('path');var timeout=require(_0xd73e('0x2'));var express=require(_0xd73e('0x3'));var router=express[_0xd73e('0x4')]();var fs_extra=require(_0xd73e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd73e('0x6'));var config=require('../../config/environment');var controller=require(_0xd73e('0x7'));router[_0xd73e('0x8')]('/',auth[_0xd73e('0x9')](),controller[_0xd73e('0xa')]);router[_0xd73e('0x8')]('/describe',auth[_0xd73e('0x9')](),controller['describe']);router['get'](_0xd73e('0xb'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xc')]);router[_0xd73e('0x8')](_0xd73e('0xd'),auth[_0xd73e('0x9')](),controller[_0xd73e('0xe')]);router[_0xd73e('0xf')]('/',auth['isAuthenticated'](),controller[_0xd73e('0x10')]);router[_0xd73e('0x11')]('/:id',controller['update']);router[_0xd73e('0x12')](_0xd73e('0xd'),auth[_0xd73e('0x9')](),controller['destroy']);module[_0xd73e('0x13')]=router; \ No newline at end of file +var _0x740e=['show','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/users','getUsers','/:id'];(function(_0x35a47d,_0x56cc32){var _0x37f6d9=function(_0x48421d){while(--_0x48421d){_0x35a47d['push'](_0x35a47d['shift']());}};_0x37f6d9(++_0x56cc32);}(_0x740e,0x16e));var _0xe740=function(_0x1631eb,_0x339ad6){_0x1631eb=_0x1631eb-0x0;var _0xf5de37=_0x740e[_0x1631eb];return _0xf5de37;};'use strict';var multer=require('multer');var util=require(_0xe740('0x0'));var path=require('path');var timeout=require(_0xe740('0x1'));var express=require(_0xe740('0x2'));var router=express[_0xe740('0x3')]();var fs_extra=require(_0xe740('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe740('0x5'));var config=require(_0xe740('0x6'));var controller=require('./chatInternalMessage.controller');router[_0xe740('0x7')]('/',auth[_0xe740('0x8')](),controller['index']);router[_0xe740('0x7')](_0xe740('0x9'),auth[_0xe740('0x8')](),controller[_0xe740('0xa')]);router['get'](_0xe740('0xb'),auth[_0xe740('0x8')](),controller[_0xe740('0xc')]);router['get'](_0xe740('0xd'),auth[_0xe740('0x8')](),controller[_0xe740('0xe')]);router['post']('/',auth[_0xe740('0x8')](),controller['create']);router[_0xe740('0xf')](_0xe740('0xd'),controller['update']);router[_0xe740('0x10')](_0xe740('0xd'),auth[_0xe740('0x8')](),controller[_0xe740('0x11')]);module[_0xe740('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index ffa66c6..6bbbc5b 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 _0x337f=['BOOLEAN','ENUM','out','DATE','sequelize','exports','TEXT'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x337f,0x11c));var _0xf337=function(_0x393a82,_0x49f72a){_0x393a82=_0x393a82-0x0;var _0x2d9d99=_0x337f[_0x393a82];return _0x2d9d99;};'use strict';var Sequelize=require(_0xf337('0x0'));module[_0xf337('0x1')]={'body':{'type':Sequelize[_0xf337('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf337('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf337('0x4')]('in','out'),'defaultValue':_0xf337('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf337('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xf337('0x2')]}}; \ No newline at end of file +var _0x6599=['out','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6599,0xb0));var _0x9659=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x6599[_0x36d703];return _0x12c909;};'use strict';var Sequelize=require('sequelize');module[_0x9659('0x0')]={'body':{'type':Sequelize[_0x9659('0x1')](_0x9659('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9659('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x9659('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9659('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x9659('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9659('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 35ee221..5263c69 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 _0x1ae4=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','end','name','send','index','map','ChatMessage','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','include','find','create','body','params','describe','chat-interactions','readAt','UserId','user','agent','get','ChatInteractionId','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','channel','accept','EventManager','parse','formData','chat','ChatInteraction','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','SIP/%s','motionChannel','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv'];(function(_0xef5a26,_0x338881){var _0x42e1f3=function(_0x333ea8){while(--_0x333ea8){_0xef5a26['push'](_0xef5a26['shift']());}};_0x42e1f3(++_0x338881);}(_0x1ae4,0xf2));var _0x41ae=function(_0x4e2967,_0x55201b){_0x4e2967=_0x4e2967-0x0;var _0x39d360=_0x1ae4[_0x4e2967];return _0x39d360;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x41ae('0x0'));var jsonpatch=require(_0x41ae('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x41ae('0x2'));var util=require(_0x41ae('0x3'));var path=require(_0x41ae('0x4'));var sox=require(_0x41ae('0x5'));var csv=require('to-csv');var ejs=require(_0x41ae('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41ae('0x7'));var squel=require(_0x41ae('0x8'));var crypto=require(_0x41ae('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x41ae('0xa'));var toCsv=require(_0x41ae('0xb'));var querystring=require(_0x41ae('0xc'));var Papa=require(_0x41ae('0xd'));var Redis=require('ioredis');var authService=require(_0x41ae('0xe'));var qs=require(_0x41ae('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41ae('0x10'))(_0x41ae('0x11'));var utils=require(_0x41ae('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x41ae('0x13'));var db=require(_0x41ae('0x14'))['db'];config[_0x41ae('0x15')]=_[_0x41ae('0x16')](config[_0x41ae('0x15')],{'host':_0x41ae('0x17'),'port':0x18eb});var socket=require(_0x41ae('0x18'))(new Redis(config[_0x41ae('0x15')]));require(_0x41ae('0x19'))['register'](socket);var jayson=require(_0x41ae('0x1a'));var client=jayson[_0x41ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1eba43,_0x35216d,_0x22c9a4,_0x31eb85){return new BPromise(function(_0xbf22ca,_0x2a5596){var _0x3be9dd=_0x31eb85||client;return _0x3be9dd[_0x41ae('0x1c')](_0x1eba43,_0x22c9a4)[_0x41ae('0x1d')](function(_0x5c8011){logger[_0x41ae('0x1e')](_0x41ae('0x1f'),_0x35216d,_0x41ae('0x20'));logger[_0x41ae('0x21')](_0x41ae('0x22'),_0x35216d,_0x41ae('0x20'),JSON[_0x41ae('0x23')](_0x5c8011));if(_0x5c8011['error']){if(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x25')]===0x1f4){logger[_0x41ae('0x24')](_0x41ae('0x1f'),_0x35216d,_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);return _0x2a5596(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);}logger[_0x41ae('0x24')]('ChatMessage,\x20%s,\x20%s',_0x35216d,_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);return _0xbf22ca(_0x5c8011[_0x41ae('0x24')][_0x41ae('0x26')]);}else{logger[_0x41ae('0x1e')](_0x41ae('0x1f'),_0x35216d,_0x41ae('0x20'));_0xbf22ca(_0x5c8011[_0x41ae('0x27')]['message']);}})[_0x41ae('0x28')](function(_0xf58ff3){logger[_0x41ae('0x24')](_0x41ae('0x1f'),_0x35216d,_0xf58ff3);_0x2a5596(_0xf58ff3);});});}function respondWithStatusCode(_0x5f26a2,_0x1f585d){_0x1f585d=_0x1f585d||0xcc;return function(_0x59c22a){if(_0x59c22a){return _0x5f26a2[_0x41ae('0x29')](_0x1f585d);}return _0x5f26a2[_0x41ae('0x2a')](_0x1f585d)['end']();};}function respondWithResult(_0x3e83e7,_0xb8f169){_0xb8f169=_0xb8f169||0xc8;return function(_0x4aab85){if(_0x4aab85){return _0x3e83e7[_0x41ae('0x2a')](_0xb8f169)['json'](_0x4aab85);}};}function respondWithFilteredResult(_0x438218,_0x31aeac){return function(_0x2f83c5){if(_0x2f83c5){var _0x5b7ded=typeof _0x31aeac['offset']===_0x41ae('0x2b')&&typeof _0x31aeac[_0x41ae('0x2c')]===_0x41ae('0x2b');var _0x48373a=_0x2f83c5[_0x41ae('0x2d')];var _0x3049a9=_0x5b7ded?0x0:_0x31aeac[_0x41ae('0x2e')];var _0x4a312b=_0x5b7ded?_0x2f83c5[_0x41ae('0x2d')]:_0x31aeac['offset']+_0x31aeac['limit'];var _0x10e2d9;if(_0x4a312b>=_0x48373a){_0x4a312b=_0x48373a;_0x10e2d9=0xc8;}else{_0x10e2d9=0xce;}_0x438218[_0x41ae('0x2a')](_0x10e2d9);return _0x438218[_0x41ae('0x2f')](_0x41ae('0x30'),_0x3049a9+'-'+_0x4a312b+'/'+_0x48373a)[_0x41ae('0x31')](_0x2f83c5);}return null;};}function patchUpdates(_0x406a00){return function(_0xe3109){try{jsonpatch[_0x41ae('0x32')](_0xe3109,_0x406a00,!![]);}catch(_0x4111e6){return BPromise[_0x41ae('0x33')](_0x4111e6);}return _0xe3109[_0x41ae('0x34')]();};}function saveUpdates(_0x2c2215,_0x3284fd){return function(_0x13db8e){if(_0x13db8e){return _0x13db8e[_0x41ae('0x35')](_0x2c2215)[_0x41ae('0x1d')](function(_0x394ca7){return _0x394ca7;});}return null;};}function removeEntity(_0x2e173a,_0x163407){return function(_0x56a28b){if(_0x56a28b){return _0x56a28b[_0x41ae('0x36')]()[_0x41ae('0x1d')](function(){_0x2e173a[_0x41ae('0x2a')](0xcc)[_0x41ae('0x37')]();});}};}function handleEntityNotFound(_0x2c6ac3,_0x3d53e5){return function(_0xc7edfc){if(!_0xc7edfc){_0x2c6ac3[_0x41ae('0x29')](0x194);}return _0xc7edfc;};}function handleError(_0x16ee14,_0x55b764){_0x55b764=_0x55b764||0x1f4;return function(_0x10ae30){logger[_0x41ae('0x24')](_0x10ae30['stack']);if(_0x10ae30[_0x41ae('0x38')]){delete _0x10ae30['name'];}_0x16ee14[_0x41ae('0x2a')](_0x55b764)[_0x41ae('0x39')](_0x10ae30);};}exports[_0x41ae('0x3a')]=function(_0x171696,_0x21bc7c){var _0x2ee975={},_0xe5a277={},_0x465c47={'count':0x0,'rows':[]};var _0x13aaf4=_[_0x41ae('0x3b')](db[_0x41ae('0x3c')]['rawAttributes'],function(_0x20c840){return{'name':_0x20c840[_0x41ae('0x3d')],'type':_0x20c840[_0x41ae('0x3e')][_0x41ae('0x3f')]};});_0xe5a277['model']=_[_0x41ae('0x3b')](_0x13aaf4,_0x41ae('0x38'));_0xe5a277['query']=_['keys'](_0x171696[_0x41ae('0x40')]);_0xe5a277[_0x41ae('0x41')]=_[_0x41ae('0x42')](_0xe5a277['model'],_0xe5a277[_0x41ae('0x40')]);_0x2ee975[_0x41ae('0x43')]=_[_0x41ae('0x42')](_0xe5a277[_0x41ae('0x44')],qs[_0x41ae('0x45')](_0x171696[_0x41ae('0x40')][_0x41ae('0x45')]));_0x2ee975['attributes']=_0x2ee975[_0x41ae('0x43')][_0x41ae('0x46')]?_0x2ee975[_0x41ae('0x43')]:_0xe5a277[_0x41ae('0x44')];if(!_0x171696['query']['hasOwnProperty'](_0x41ae('0x47'))){_0x2ee975[_0x41ae('0x2c')]=qs['limit'](_0x171696[_0x41ae('0x40')]['limit']);_0x2ee975[_0x41ae('0x2e')]=qs[_0x41ae('0x2e')](_0x171696[_0x41ae('0x40')]['offset']);}_0x2ee975['order']=qs['sort'](_0x171696[_0x41ae('0x40')][_0x41ae('0x48')]);_0x2ee975[_0x41ae('0x49')]=qs['filters'](_['pick'](_0x171696[_0x41ae('0x40')],_0xe5a277[_0x41ae('0x41')]),_0x13aaf4);if(_0x171696['query'][_0x41ae('0x4a')]){_0x2ee975[_0x41ae('0x49')]=_[_0x41ae('0x4b')](_0x2ee975[_0x41ae('0x49')],{'$or':_['map'](_0x13aaf4,function(_0x4e7c47){if(_0x4e7c47[_0x41ae('0x3e')]!==_0x41ae('0x4c')){var _0x215527={};_0x215527[_0x4e7c47[_0x41ae('0x38')]]={'$like':'%'+_0x171696[_0x41ae('0x40')]['filter']+'%'};return _0x215527;}})});}_0x2ee975=_[_0x41ae('0x4b')]({},_0x2ee975,_0x171696[_0x41ae('0x4d')]);var _0x243334={'where':_0x2ee975[_0x41ae('0x49')]};return db[_0x41ae('0x3c')][_0x41ae('0x2d')](_0x243334)[_0x41ae('0x1d')](function(_0xf38094){_0x465c47[_0x41ae('0x2d')]=_0xf38094;if(_0x171696[_0x41ae('0x40')]['includeAll']){_0x2ee975['include']=[{'all':!![]}];}return db[_0x41ae('0x3c')][_0x41ae('0x4e')](_0x2ee975);})['then'](function(_0x37faa9){_0x465c47[_0x41ae('0x4f')]=_0x37faa9;return _0x465c47;})[_0x41ae('0x1d')](respondWithFilteredResult(_0x21bc7c,_0x2ee975))['catch'](handleError(_0x21bc7c,null));};exports[_0x41ae('0x50')]=function(_0x1034dd,_0x12a31e){var _0x302593={'raw':!![],'where':{'id':_0x1034dd['params']['id']}},_0x16b1ac={};_0x16b1ac[_0x41ae('0x44')]=_[_0x41ae('0x51')](db['ChatMessage']['rawAttributes']);_0x16b1ac[_0x41ae('0x40')]=_[_0x41ae('0x51')](_0x1034dd[_0x41ae('0x40')]);_0x16b1ac[_0x41ae('0x41')]=_[_0x41ae('0x42')](_0x16b1ac[_0x41ae('0x44')],_0x16b1ac['query']);_0x302593[_0x41ae('0x43')]=_['intersection'](_0x16b1ac['model'],qs[_0x41ae('0x45')](_0x1034dd['query']['fields']));_0x302593[_0x41ae('0x43')]=_0x302593['attributes']['length']?_0x302593[_0x41ae('0x43')]:_0x16b1ac[_0x41ae('0x44')];if(_0x1034dd[_0x41ae('0x40')][_0x41ae('0x52')]){_0x302593[_0x41ae('0x53')]=[{'all':!![]}];}_0x302593=_[_0x41ae('0x4b')]({},_0x302593,_0x1034dd[_0x41ae('0x4d')]);return db['ChatMessage'][_0x41ae('0x54')](_0x302593)[_0x41ae('0x1d')](handleEntityNotFound(_0x12a31e,null))[_0x41ae('0x1d')](respondWithResult(_0x12a31e,null))[_0x41ae('0x28')](handleError(_0x12a31e,null));};exports[_0x41ae('0x55')]=function(_0x20a597,_0x4e0970){return db[_0x41ae('0x3c')][_0x41ae('0x55')](_0x20a597['body'],{})[_0x41ae('0x1d')](respondWithResult(_0x4e0970,0xc9))['catch'](handleError(_0x4e0970,null));};exports['update']=function(_0x1bf312,_0x2310fe){if(_0x1bf312[_0x41ae('0x56')]['id']){delete _0x1bf312[_0x41ae('0x56')]['id'];}return db[_0x41ae('0x3c')]['find']({'where':{'id':_0x1bf312[_0x41ae('0x57')]['id']}})[_0x41ae('0x1d')](handleEntityNotFound(_0x2310fe,null))['then'](saveUpdates(_0x1bf312[_0x41ae('0x56')],null))[_0x41ae('0x1d')](respondWithResult(_0x2310fe,null))['catch'](handleError(_0x2310fe,null));};exports[_0x41ae('0x36')]=function(_0x1fbbff,_0x38723b){return db['ChatMessage'][_0x41ae('0x54')]({'where':{'id':_0x1fbbff[_0x41ae('0x57')]['id']}})[_0x41ae('0x1d')](handleEntityNotFound(_0x38723b,null))[_0x41ae('0x1d')](removeEntity(_0x38723b,null))[_0x41ae('0x28')](handleError(_0x38723b,null));};exports[_0x41ae('0x58')]=function(_0x34dfc8,_0x7894){return db[_0x41ae('0x3c')]['describe']()['then'](respondWithResult(_0x7894,null))['catch'](handleError(_0x7894,null));};var interaction_log=require(_0x41ae('0x10'))(_0x41ae('0x59'));exports['accept']=function(_0x18a872,_0x202f45,_0x4374d2){var _0x389e28={'agent':{},'channel':'chat'};if(_0x18a872[_0x41ae('0x56')]['id']){delete _0x18a872[_0x41ae('0x56')]['id'];}_0x18a872[_0x41ae('0x56')]['read']=!![];_0x18a872[_0x41ae('0x56')][_0x41ae('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')]=_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')]||_0x18a872[_0x41ae('0x5c')]['id'];_0x389e28[_0x41ae('0x5d')]['id']=_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')];return db[_0x41ae('0x3c')][_0x41ae('0x54')]({'where':{'id':_0x18a872[_0x41ae('0x57')]['id'],'UserId':null}})[_0x41ae('0x1d')](handleEntityNotFound(_0x202f45,null))['then'](saveUpdates(_0x18a872['body'],null))['then'](function(_0x5d3893){if(_0x5d3893){_0x389e28[_0x41ae('0x26')]=_0x5d3893[_0x41ae('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x41ae('0x54')]({'where':{'id':_0x5d3893[_0x41ae('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x202f45,null))[_0x41ae('0x1d')](function(_0x326dd0){if(_0x326dd0){return _0x326dd0['update']({'UserId':_0x18a872[_0x41ae('0x56')][_0x41ae('0x5b')],'read1stAt':_['isNil'](_0x326dd0[_0x41ae('0x60')])?moment()[_0x41ae('0x61')](_0x41ae('0x62')):undefined});}return null;})[_0x41ae('0x1d')](function(_0x4a1a22){if(_0x4a1a22){_0x389e28[_0x41ae('0x63')]=_0x4a1a22['get']({'plain':!![]});interaction_log[_0x41ae('0x1e')](_0x41ae('0x64'),_0x18a872[_0x41ae('0x5c')]['id'],_0x18a872['user'][_0x41ae('0x38')],_0x18a872[_0x41ae('0x5c')][_0x41ae('0x65')],_0x389e28['interaction']['id'],_0x18a872[_0x41ae('0x56')]?JSON[_0x41ae('0x23')](_0x18a872[_0x41ae('0x56')]):'null');return respondWithRpcPromise('AcceptMessage',_0x41ae('0x66'),_0x389e28);}return null;})[_0x41ae('0x1d')](function(_0xa03fe0){var _0x1ff61a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xa03fe0[_0x41ae('0x26')][_0x41ae('0x67')];return db[_0x41ae('0x68')][_0x41ae('0x40')](_0x1ff61a,{'type':db['Sequelize'][_0x41ae('0x69')][_0x41ae('0x6a')],'raw':!![]})[_0x41ae('0x1d')](function(_0x248a5a){return _0x248a5a;});})['then'](function(_0x5556fa){if(_0x5556fa){_0x389e28[_0x41ae('0x26')][_0x41ae('0x6b')]=_0x5556fa[0x0];if(!_0x18a872['body'][_0x41ae('0x5b')])return;return db[_0x41ae('0x6c')]['find']({'where':{'id':_0x18a872['body']['UserId'],'role':_0x41ae('0x5d')},'attributes':['id',_0x41ae('0x38'),'fullname',_0x41ae('0x6d'),_0x41ae('0x6e')],'raw':!![]});}return null;})[_0x41ae('0x1d')](function(_0x110820){if(!_0x110820)return null;_0x389e28[_0x41ae('0x26')][_0x41ae('0x5d')]=_0x110820;return _0x389e28;})['then'](function(_0x40f96c){if(_0x40f96c){if(_0x18a872[_0x41ae('0x56')][_0x41ae('0x6f')]){_0x389e28['message'][_0x41ae('0x70')]=util[_0x41ae('0x61')]('SIP/%s',_0x18a872[_0x41ae('0x5c')][_0x41ae('0x38')]);_0x389e28[_0x41ae('0x26')][_0x41ae('0x71')]=_0x389e28[_0x41ae('0x71')];_0x389e28[_0x41ae('0x26')]['motionChannel']=_0x389e28[_0x41ae('0x71')];_0x389e28[_0x41ae('0x26')]['event']=_0x41ae('0x72');return respondWithRpcPromise(_0x41ae('0x73'),'EventManager',{'event':'acceptmessage','message':_[_0x41ae('0x4b')](_0x389e28[_0x41ae('0x26')],JSON[_0x41ae('0x74')](_0x389e28['interaction'][_0x41ae('0x75')]))},client9002)[_0x41ae('0x1d')](function(){return _0x389e28;});}return _0x389e28;}return null;})[_0x41ae('0x1d')](respondWithResult(_0x202f45,null))[_0x41ae('0x28')](handleError(_0x202f45,null));};var interaction_log=require(_0x41ae('0x10'))(_0x41ae('0x59'));exports[_0x41ae('0x33')]=function(_0x2f9089,_0x203d85,_0x9a045c){var _0x3cbda1={'agent':{},'channel':_0x41ae('0x76')};if(_0x2f9089[_0x41ae('0x56')]['id']){delete _0x2f9089[_0x41ae('0x56')]['id'];}_0x2f9089['body'][_0x41ae('0x5b')]=_0x2f9089[_0x41ae('0x56')][_0x41ae('0x5b')]||_0x2f9089[_0x41ae('0x5c')]['id'];_0x3cbda1[_0x41ae('0x5d')]['id']=_0x2f9089[_0x41ae('0x56')][_0x41ae('0x5b')];return db['ChatMessage'][_0x41ae('0x54')]({'where':{'id':_0x2f9089[_0x41ae('0x57')]['id'],'UserId':null}})[_0x41ae('0x1d')](handleEntityNotFound(_0x203d85,null))[_0x41ae('0x1d')](function(_0x5e37f2){if(_0x5e37f2){_0x3cbda1[_0x41ae('0x26')]=_0x5e37f2[_0x41ae('0x5e')]({'plain':!![]});return db[_0x41ae('0x77')][_0x41ae('0x54')]({'where':{'id':_0x5e37f2['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x203d85,null))[_0x41ae('0x1d')](function(_0x3ea78e){if(_0x3ea78e){_0x3cbda1[_0x41ae('0x63')]=_0x3ea78e[_0x41ae('0x5e')]({'plain':!![]});interaction_log[_0x41ae('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2f9089[_0x41ae('0x5c')]['id'],_0x2f9089['user'][_0x41ae('0x38')],_0x2f9089['user'][_0x41ae('0x65')],_0x3cbda1[_0x41ae('0x63')]['id'],_0x2f9089[_0x41ae('0x56')]?JSON[_0x41ae('0x23')](_0x2f9089[_0x41ae('0x56')]):_0x41ae('0x78'));return respondWithRpcPromise('RejectMessage',_0x41ae('0x79'),_0x3cbda1);}return null;})['then'](function(_0xb76f6){var _0x315e2a=_0x41ae('0x7a')+_0xb76f6[_0x41ae('0x26')]['ContactId'];return db[_0x41ae('0x68')][_0x41ae('0x40')](_0x315e2a,{'type':db[_0x41ae('0x7b')][_0x41ae('0x69')][_0x41ae('0x6a')],'raw':!![]})[_0x41ae('0x1d')](function(_0x49d415){return _0x49d415;});})[_0x41ae('0x1d')](function(_0x11c3c0){if(_0x11c3c0){_0x3cbda1[_0x41ae('0x26')][_0x41ae('0x6b')]=_0x11c3c0[0x0];if(!_0x2f9089[_0x41ae('0x56')]['UserId'])return;return db['User'][_0x41ae('0x54')]({'where':{'id':_0x2f9089['body'][_0x41ae('0x5b')],'role':_0x41ae('0x5d')},'attributes':['id',_0x41ae('0x38'),_0x41ae('0x7c'),_0x41ae('0x6d'),'internal'],'raw':!![]});}return null;})[_0x41ae('0x1d')](function(_0x117480){if(!_0x117480)return null;_0x3cbda1[_0x41ae('0x26')][_0x41ae('0x5d')]=_0x117480;return _0x3cbda1;})[_0x41ae('0x1d')](function(_0x5994be){if(_0x5994be){_0x5994be[_0x41ae('0x26')]['interface']=util['format'](_0x41ae('0x7d'),_0x2f9089[_0x41ae('0x5c')][_0x41ae('0x38')]);_0x5994be['message'][_0x41ae('0x71')]=_0x3cbda1[_0x41ae('0x71')];_0x5994be['message'][_0x41ae('0x7e')]=_0x3cbda1[_0x41ae('0x71')];_0x5994be[_0x41ae('0x26')]['event']=_0x41ae('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':'rejectmessage','message':_['merge'](_0x3cbda1[_0x41ae('0x26')],JSON[_0x41ae('0x74')](_0x3cbda1[_0x41ae('0x63')][_0x41ae('0x75')]))},client9002);return _0x3cbda1;}return null;})['then'](respondWithResult(_0x203d85,null))[_0x41ae('0x28')](handleError(_0x203d85,null));}; \ No newline at end of file +var _0xaefa=['rawAttributes','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','find','describe','../../config/logger','chat-interactions','accept','chat','read','format','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','user','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','rejectMessage','ContactId','sequelize','rejectmessage','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','ChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaefa,0x1ce));var _0xaaef=function(_0x2863d3,_0xe378bc){_0x2863d3=_0x2863d3-0x0;var _0x5f4b85=_0xaefa[_0x2863d3];return _0x5f4b85;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaaef('0x0'));var Mustache=require(_0xaaef('0x1'));var util=require(_0xaaef('0x2'));var path=require(_0xaaef('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaaef('0x4'));var fs=require('fs');var fs_extra=require(_0xaaef('0x5'));var _=require(_0xaaef('0x6'));var squel=require(_0xaaef('0x7'));var crypto=require(_0xaaef('0x8'));var jsforce=require(_0xaaef('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaaef('0xa'));var Papa=require(_0xaaef('0xb'));var Redis=require(_0xaaef('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaaef('0xd'));var logger=require('../../config/logger')(_0xaaef('0xe'));var utils=require(_0xaaef('0xf'));var config=require(_0xaaef('0x10'));var licenseUtil=require(_0xaaef('0x11'));var db=require(_0xaaef('0x12'))['db'];config[_0xaaef('0x13')]=_[_0xaaef('0x14')](config[_0xaaef('0x13')],{'host':_0xaaef('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaef('0x13')]));require('./chatMessage.socket')[_0xaaef('0x16')](socket);var jayson=require(_0xaaef('0x17'));var client=jayson[_0xaaef('0x18')][_0xaaef('0x19')]({'port':0x232c});var client9002=jayson['client'][_0xaaef('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x20c276,_0x51bb5e,_0x1af971,_0x2878bb){return new BPromise(function(_0x8f5743,_0x2fc0dd){var _0x100a16=_0x2878bb||client;return _0x100a16['request'](_0x20c276,_0x1af971)[_0xaaef('0x1a')](function(_0x53e0a2){logger[_0xaaef('0x1b')](_0xaaef('0x1c'),_0x51bb5e,_0xaaef('0x1d'));logger[_0xaaef('0x1e')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x51bb5e,'request\x20sent',JSON['stringify'](_0x53e0a2));if(_0x53e0a2[_0xaaef('0x1f')]){if(_0x53e0a2['error'][_0xaaef('0x20')]===0x1f4){logger[_0xaaef('0x1f')](_0xaaef('0x1c'),_0x51bb5e,_0x53e0a2[_0xaaef('0x1f')][_0xaaef('0x21')]);return _0x2fc0dd(_0x53e0a2[_0xaaef('0x1f')]['message']);}logger[_0xaaef('0x1f')](_0xaaef('0x1c'),_0x51bb5e,_0x53e0a2[_0xaaef('0x1f')]['message']);return _0x8f5743(_0x53e0a2[_0xaaef('0x1f')][_0xaaef('0x21')]);}else{logger[_0xaaef('0x1b')](_0xaaef('0x1c'),_0x51bb5e,_0xaaef('0x1d'));_0x8f5743(_0x53e0a2['result'][_0xaaef('0x21')]);}})[_0xaaef('0x22')](function(_0x23c8cc){logger[_0xaaef('0x1f')](_0xaaef('0x1c'),_0x51bb5e,_0x23c8cc);_0x2fc0dd(_0x23c8cc);});});}function respondWithStatusCode(_0x2b538f,_0xbee03e){_0xbee03e=_0xbee03e||0xcc;return function(_0x4d5dfe){if(_0x4d5dfe){return _0x2b538f[_0xaaef('0x23')](_0xbee03e);}return _0x2b538f[_0xaaef('0x24')](_0xbee03e)[_0xaaef('0x25')]();};}function respondWithResult(_0x444153,_0x168574){_0x168574=_0x168574||0xc8;return function(_0x21e98d){if(_0x21e98d){return _0x444153['status'](_0x168574)[_0xaaef('0x26')](_0x21e98d);}};}function respondWithFilteredResult(_0xb44091,_0x16e9c7){return function(_0x495211){if(_0x495211){var _0x55f543=typeof _0x16e9c7[_0xaaef('0x27')]===_0xaaef('0x28')&&typeof _0x16e9c7[_0xaaef('0x29')]===_0xaaef('0x28');var _0x382c4c=_0x495211[_0xaaef('0x2a')];var _0x2f338d=_0x55f543?0x0:_0x16e9c7[_0xaaef('0x27')];var _0x1fc8d2=_0x55f543?_0x495211[_0xaaef('0x2a')]:_0x16e9c7['offset']+_0x16e9c7['limit'];var _0x54f6b1;if(_0x1fc8d2>=_0x382c4c){_0x1fc8d2=_0x382c4c;_0x54f6b1=0xc8;}else{_0x54f6b1=0xce;}_0xb44091[_0xaaef('0x24')](_0x54f6b1);return _0xb44091[_0xaaef('0x2b')](_0xaaef('0x2c'),_0x2f338d+'-'+_0x1fc8d2+'/'+_0x382c4c)[_0xaaef('0x26')](_0x495211);}return null;};}function patchUpdates(_0x41beb0){return function(_0x55b257){try{jsonpatch[_0xaaef('0x2d')](_0x55b257,_0x41beb0,!![]);}catch(_0x26adbb){return BPromise[_0xaaef('0x2e')](_0x26adbb);}return _0x55b257[_0xaaef('0x2f')]();};}function saveUpdates(_0x273a21,_0x12c7a4){return function(_0x3b0cd0){if(_0x3b0cd0){return _0x3b0cd0[_0xaaef('0x30')](_0x273a21)[_0xaaef('0x1a')](function(_0x26f978){return _0x26f978;});}return null;};}function removeEntity(_0x13bfe4,_0x501db7){return function(_0x50aa01){if(_0x50aa01){return _0x50aa01[_0xaaef('0x31')]()[_0xaaef('0x1a')](function(){_0x13bfe4[_0xaaef('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x807c6a,_0x4cf1c1){return function(_0x3d1fee){if(!_0x3d1fee){_0x807c6a[_0xaaef('0x23')](0x194);}return _0x3d1fee;};}function handleError(_0x2a63f6,_0x37ff2e){_0x37ff2e=_0x37ff2e||0x1f4;return function(_0x1fcb38){logger[_0xaaef('0x1f')](_0x1fcb38[_0xaaef('0x32')]);if(_0x1fcb38['name']){delete _0x1fcb38[_0xaaef('0x33')];}_0x2a63f6[_0xaaef('0x24')](_0x37ff2e)['send'](_0x1fcb38);};}exports[_0xaaef('0x34')]=function(_0x379b96,_0x4deaf0){var _0x5d2fea={},_0x306a3a={},_0x90427f={'count':0x0,'rows':[]};var _0x396e9d=_['map'](db[_0xaaef('0x35')][_0xaaef('0x36')],function(_0xaa5c68){return{'name':_0xaa5c68[_0xaaef('0x37')],'type':_0xaa5c68['type'][_0xaaef('0x38')]};});_0x306a3a[_0xaaef('0x39')]=_[_0xaaef('0x3a')](_0x396e9d,_0xaaef('0x33'));_0x306a3a['query']=_[_0xaaef('0x3b')](_0x379b96['query']);_0x306a3a[_0xaaef('0x3c')]=_[_0xaaef('0x3d')](_0x306a3a[_0xaaef('0x39')],_0x306a3a[_0xaaef('0x3e')]);_0x5d2fea[_0xaaef('0x3f')]=_[_0xaaef('0x3d')](_0x306a3a[_0xaaef('0x39')],qs[_0xaaef('0x40')](_0x379b96[_0xaaef('0x3e')][_0xaaef('0x40')]));_0x5d2fea['attributes']=_0x5d2fea[_0xaaef('0x3f')][_0xaaef('0x41')]?_0x5d2fea[_0xaaef('0x3f')]:_0x306a3a[_0xaaef('0x39')];if(!_0x379b96[_0xaaef('0x3e')]['hasOwnProperty'](_0xaaef('0x42'))){_0x5d2fea[_0xaaef('0x29')]=qs[_0xaaef('0x29')](_0x379b96['query'][_0xaaef('0x29')]);_0x5d2fea[_0xaaef('0x27')]=qs[_0xaaef('0x27')](_0x379b96['query']['offset']);}_0x5d2fea['order']=qs[_0xaaef('0x43')](_0x379b96[_0xaaef('0x3e')]['sort']);_0x5d2fea['where']=qs[_0xaaef('0x3c')](_[_0xaaef('0x44')](_0x379b96[_0xaaef('0x3e')],_0x306a3a[_0xaaef('0x3c')]),_0x396e9d);if(_0x379b96[_0xaaef('0x3e')][_0xaaef('0x45')]){_0x5d2fea[_0xaaef('0x46')]=_[_0xaaef('0x47')](_0x5d2fea[_0xaaef('0x46')],{'$or':_[_0xaaef('0x3a')](_0x396e9d,function(_0x20a07b){if(_0x20a07b[_0xaaef('0x48')]!==_0xaaef('0x49')){var _0x5ebd54={};_0x5ebd54[_0x20a07b[_0xaaef('0x33')]]={'$like':'%'+_0x379b96[_0xaaef('0x3e')][_0xaaef('0x45')]+'%'};return _0x5ebd54;}})});}_0x5d2fea=_['merge']({},_0x5d2fea,_0x379b96[_0xaaef('0x4a')]);var _0x5ed115={'where':_0x5d2fea['where']};return db[_0xaaef('0x35')][_0xaaef('0x2a')](_0x5ed115)['then'](function(_0x252dc8){_0x90427f[_0xaaef('0x2a')]=_0x252dc8;if(_0x379b96['query'][_0xaaef('0x4b')]){_0x5d2fea[_0xaaef('0x4c')]=[{'all':!![]}];}return db[_0xaaef('0x35')][_0xaaef('0x4d')](_0x5d2fea);})[_0xaaef('0x1a')](function(_0x120214){_0x90427f[_0xaaef('0x4e')]=_0x120214;return _0x90427f;})[_0xaaef('0x1a')](respondWithFilteredResult(_0x4deaf0,_0x5d2fea))['catch'](handleError(_0x4deaf0,null));};exports[_0xaaef('0x4f')]=function(_0xfc22ea,_0x187548){var _0x2c4fdb={'raw':!![],'where':{'id':_0xfc22ea[_0xaaef('0x50')]['id']}},_0x39bec9={};_0x39bec9['model']=_[_0xaaef('0x3b')](db['ChatMessage']['rawAttributes']);_0x39bec9['query']=_[_0xaaef('0x3b')](_0xfc22ea[_0xaaef('0x3e')]);_0x39bec9['filters']=_[_0xaaef('0x3d')](_0x39bec9[_0xaaef('0x39')],_0x39bec9[_0xaaef('0x3e')]);_0x2c4fdb[_0xaaef('0x3f')]=_[_0xaaef('0x3d')](_0x39bec9[_0xaaef('0x39')],qs[_0xaaef('0x40')](_0xfc22ea['query'][_0xaaef('0x40')]));_0x2c4fdb[_0xaaef('0x3f')]=_0x2c4fdb[_0xaaef('0x3f')][_0xaaef('0x41')]?_0x2c4fdb[_0xaaef('0x3f')]:_0x39bec9[_0xaaef('0x39')];if(_0xfc22ea[_0xaaef('0x3e')]['includeAll']){_0x2c4fdb['include']=[{'all':!![]}];}_0x2c4fdb=_[_0xaaef('0x47')]({},_0x2c4fdb,_0xfc22ea[_0xaaef('0x4a')]);return db['ChatMessage']['find'](_0x2c4fdb)['then'](handleEntityNotFound(_0x187548,null))[_0xaaef('0x1a')](respondWithResult(_0x187548,null))[_0xaaef('0x22')](handleError(_0x187548,null));};exports['create']=function(_0x3d6203,_0x335887){return db['ChatMessage'][_0xaaef('0x51')](_0x3d6203[_0xaaef('0x52')],{})['then'](respondWithResult(_0x335887,0xc9))[_0xaaef('0x22')](handleError(_0x335887,null));};exports[_0xaaef('0x30')]=function(_0x5c23db,_0x455c5d){if(_0x5c23db[_0xaaef('0x52')]['id']){delete _0x5c23db[_0xaaef('0x52')]['id'];}return db[_0xaaef('0x35')][_0xaaef('0x53')]({'where':{'id':_0x5c23db[_0xaaef('0x50')]['id']}})['then'](handleEntityNotFound(_0x455c5d,null))['then'](saveUpdates(_0x5c23db[_0xaaef('0x52')],null))[_0xaaef('0x1a')](respondWithResult(_0x455c5d,null))[_0xaaef('0x22')](handleError(_0x455c5d,null));};exports[_0xaaef('0x31')]=function(_0x14dd5a,_0x9888fa){return db[_0xaaef('0x35')][_0xaaef('0x53')]({'where':{'id':_0x14dd5a['params']['id']}})[_0xaaef('0x1a')](handleEntityNotFound(_0x9888fa,null))[_0xaaef('0x1a')](removeEntity(_0x9888fa,null))[_0xaaef('0x22')](handleError(_0x9888fa,null));};exports[_0xaaef('0x54')]=function(_0x44cdd5,_0x20f3bd){return db[_0xaaef('0x35')][_0xaaef('0x54')]()['then'](respondWithResult(_0x20f3bd,null))[_0xaaef('0x22')](handleError(_0x20f3bd,null));};var interaction_log=require(_0xaaef('0x55'))(_0xaaef('0x56'));exports[_0xaaef('0x57')]=function(_0x3419df,_0xa6492a,_0x3c2abc){var _0x507e58={'agent':{},'channel':_0xaaef('0x58')};if(_0x3419df[_0xaaef('0x52')]['id']){delete _0x3419df['body']['id'];}_0x3419df[_0xaaef('0x52')][_0xaaef('0x59')]=!![];_0x3419df[_0xaaef('0x52')]['readAt']=moment()[_0xaaef('0x5a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3419df[_0xaaef('0x52')][_0xaaef('0x5b')]=_0x3419df[_0xaaef('0x52')]['UserId']||_0x3419df['user']['id'];_0x507e58[_0xaaef('0x5c')]['id']=_0x3419df['body'][_0xaaef('0x5b')];return db[_0xaaef('0x35')][_0xaaef('0x53')]({'where':{'id':_0x3419df[_0xaaef('0x50')]['id'],'UserId':null}})[_0xaaef('0x1a')](handleEntityNotFound(_0xa6492a,null))[_0xaaef('0x1a')](saveUpdates(_0x3419df[_0xaaef('0x52')],null))['then'](function(_0x401a8b){if(_0x401a8b){_0x507e58[_0xaaef('0x21')]=_0x401a8b[_0xaaef('0x5d')]({'plain':!![]});return db[_0xaaef('0x5e')][_0xaaef('0x53')]({'where':{'id':_0x401a8b[_0xaaef('0x5f')]}});}return null;})[_0xaaef('0x1a')](handleEntityNotFound(_0xa6492a,null))['then'](function(_0x2444ed){if(_0x2444ed){return _0x2444ed['update']({'UserId':_0x3419df['body'][_0xaaef('0x5b')],'read1stAt':_[_0xaaef('0x60')](_0x2444ed['read1stAt'])?moment()[_0xaaef('0x5a')](_0xaaef('0x61')):undefined});}return null;})[_0xaaef('0x1a')](function(_0x112ef4){if(_0x112ef4){_0x507e58[_0xaaef('0x62')]=_0x112ef4['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3419df['user']['id'],_0x3419df[_0xaaef('0x63')][_0xaaef('0x33')],_0x3419df[_0xaaef('0x63')]['role'],_0x507e58[_0xaaef('0x62')]['id'],_0x3419df[_0xaaef('0x52')]?JSON[_0xaaef('0x64')](_0x3419df[_0xaaef('0x52')]):'null');return respondWithRpcPromise('AcceptMessage',_0xaaef('0x65'),_0x507e58);}return null;})[_0xaaef('0x1a')](function(_0xb2627e){var _0x155d78=_0xaaef('0x66')+_0xb2627e[_0xaaef('0x21')]['ContactId'];return db['sequelize'][_0xaaef('0x3e')](_0x155d78,{'type':db[_0xaaef('0x67')][_0xaaef('0x68')][_0xaaef('0x69')],'raw':!![]})[_0xaaef('0x1a')](function(_0x2cbe13){return _0x2cbe13;});})[_0xaaef('0x1a')](function(_0x46c272){if(_0x46c272){_0x507e58[_0xaaef('0x21')][_0xaaef('0x6a')]=_0x46c272[0x0];if(!_0x3419df[_0xaaef('0x52')][_0xaaef('0x5b')])return;return db[_0xaaef('0x6b')][_0xaaef('0x53')]({'where':{'id':_0x3419df[_0xaaef('0x52')][_0xaaef('0x5b')],'role':_0xaaef('0x5c')},'attributes':['id',_0xaaef('0x33'),_0xaaef('0x6c'),_0xaaef('0x6d'),_0xaaef('0x6e')],'raw':!![]});}return null;})[_0xaaef('0x1a')](function(_0x5bc0de){if(!_0x5bc0de)return null;_0x507e58['message'][_0xaaef('0x5c')]=_0x5bc0de;return _0x507e58;})['then'](function(_0x8386ab){if(_0x8386ab){if(_0x3419df[_0xaaef('0x52')][_0xaaef('0x6f')]){_0x507e58[_0xaaef('0x21')][_0xaaef('0x70')]=util[_0xaaef('0x5a')](_0xaaef('0x71'),_0x3419df[_0xaaef('0x63')][_0xaaef('0x33')]);_0x507e58[_0xaaef('0x21')][_0xaaef('0x72')]=_0x507e58[_0xaaef('0x72')];_0x507e58[_0xaaef('0x21')][_0xaaef('0x73')]=_0x507e58[_0xaaef('0x72')];_0x507e58[_0xaaef('0x21')][_0xaaef('0x74')]='accept';return respondWithRpcPromise('EventManager',_0xaaef('0x75'),{'event':_0xaaef('0x76'),'message':_[_0xaaef('0x47')](_0x507e58[_0xaaef('0x21')],JSON[_0xaaef('0x77')](_0x507e58[_0xaaef('0x62')][_0xaaef('0x78')]))},client9002)[_0xaaef('0x1a')](function(){return _0x507e58;});}return _0x507e58;}return null;})[_0xaaef('0x1a')](respondWithResult(_0xa6492a,null))['catch'](handleError(_0xa6492a,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xaaef('0x2e')]=function(_0x5c94fe,_0x5598eb,_0x4ddccf){var _0x340406={'agent':{},'channel':_0xaaef('0x58')};if(_0x5c94fe[_0xaaef('0x52')]['id']){delete _0x5c94fe[_0xaaef('0x52')]['id'];}_0x5c94fe[_0xaaef('0x52')][_0xaaef('0x5b')]=_0x5c94fe['body']['UserId']||_0x5c94fe['user']['id'];_0x340406[_0xaaef('0x5c')]['id']=_0x5c94fe[_0xaaef('0x52')][_0xaaef('0x5b')];return db[_0xaaef('0x35')]['find']({'where':{'id':_0x5c94fe[_0xaaef('0x50')]['id'],'UserId':null}})[_0xaaef('0x1a')](handleEntityNotFound(_0x5598eb,null))[_0xaaef('0x1a')](function(_0x3738ae){if(_0x3738ae){_0x340406[_0xaaef('0x21')]=_0x3738ae[_0xaaef('0x5d')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x3738ae['ChatInteractionId']}});}return null;})[_0xaaef('0x1a')](handleEntityNotFound(_0x5598eb,null))[_0xaaef('0x1a')](function(_0x230cbb){if(_0x230cbb){_0x340406[_0xaaef('0x62')]=_0x230cbb[_0xaaef('0x5d')]({'plain':!![]});interaction_log[_0xaaef('0x1b')](_0xaaef('0x79'),_0x5c94fe[_0xaaef('0x63')]['id'],_0x5c94fe[_0xaaef('0x63')][_0xaaef('0x33')],_0x5c94fe['user'][_0xaaef('0x7a')],_0x340406[_0xaaef('0x62')]['id'],_0x5c94fe[_0xaaef('0x52')]?JSON[_0xaaef('0x64')](_0x5c94fe[_0xaaef('0x52')]):_0xaaef('0x7b'));return respondWithRpcPromise(_0xaaef('0x7c'),_0xaaef('0x7d'),_0x340406);}return null;})['then'](function(_0x3f030d){var _0x590d90=_0xaaef('0x66')+_0x3f030d['message'][_0xaaef('0x7e')];return db[_0xaaef('0x7f')][_0xaaef('0x3e')](_0x590d90,{'type':db['Sequelize']['QueryTypes'][_0xaaef('0x69')],'raw':!![]})[_0xaaef('0x1a')](function(_0x537f1d){return _0x537f1d;});})['then'](function(_0x364f0b){if(_0x364f0b){_0x340406['message'][_0xaaef('0x6a')]=_0x364f0b[0x0];if(!_0x5c94fe[_0xaaef('0x52')][_0xaaef('0x5b')])return;return db[_0xaaef('0x6b')][_0xaaef('0x53')]({'where':{'id':_0x5c94fe[_0xaaef('0x52')][_0xaaef('0x5b')],'role':_0xaaef('0x5c')},'attributes':['id',_0xaaef('0x33'),_0xaaef('0x6c'),'email',_0xaaef('0x6e')],'raw':!![]});}return null;})['then'](function(_0x4c8175){if(!_0x4c8175)return null;_0x340406[_0xaaef('0x21')][_0xaaef('0x5c')]=_0x4c8175;return _0x340406;})['then'](function(_0x577eb1){if(_0x577eb1){_0x577eb1['message'][_0xaaef('0x70')]=util[_0xaaef('0x5a')](_0xaaef('0x71'),_0x5c94fe[_0xaaef('0x63')]['name']);_0x577eb1[_0xaaef('0x21')][_0xaaef('0x72')]=_0x340406['channel'];_0x577eb1[_0xaaef('0x21')]['motionChannel']=_0x340406[_0xaaef('0x72')];_0x577eb1[_0xaaef('0x21')][_0xaaef('0x74')]=_0xaaef('0x2e');respondWithRpcPromise('EventManager','EventManager',{'event':_0xaaef('0x80'),'message':_[_0xaaef('0x47')](_0x340406[_0xaaef('0x21')],JSON['parse'](_0x340406[_0xaaef('0x62')]['formData']))},client9002);return _0x340406;}return null;})[_0xaaef('0x1a')](respondWithResult(_0x5598eb,null))[_0xaaef('0x22')](handleError(_0x5598eb,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index dbd612f..4725be6 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 _0x4afb=['../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4afb,0x103));var _0xb4af=function(_0xe91559,_0x5ead1f){_0xe91559=_0xe91559-0x0;var _0x3bb7bc=_0x4afb[_0xe91559];return _0x3bb7bc;};'use strict';var EventEmitter=require(_0xb4af('0x0'));var ChatMessage=require(_0xb4af('0x1'))['db'][_0xb4af('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb4af('0x3')](0x0);var events={'afterCreate':_0xb4af('0x4'),'afterUpdate':_0xb4af('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f5df1){return function(_0x142ffd,_0x4a8c6e,_0x1a2087){ChatMessageEvents[_0xb4af('0x6')](_0x1f5df1+':'+_0x142ffd['id'],_0x142ffd);ChatMessageEvents[_0xb4af('0x6')](_0x1f5df1,_0x142ffd);_0x1a2087(null);};}for(var e in events){if(events[_0xb4af('0x7')](e)){var event=events[e];ChatMessage[_0xb4af('0x8')](e,emitEvent(event));}}module[_0xb4af('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0xb8b8=['../../mysqldb','ChatMessage','setMaxListeners','update','emit','hook','exports','events'];(function(_0x3874ab,_0x1e2dec){var _0x3b90e8=function(_0x7ab124){while(--_0x7ab124){_0x3874ab['push'](_0x3874ab['shift']());}};_0x3b90e8(++_0x1e2dec);}(_0xb8b8,0x197));var _0x8b8b=function(_0x568af3,_0x323cd3){_0x568af3=_0x568af3-0x0;var _0x365a4c=_0xb8b8[_0x568af3];return _0x365a4c;};'use strict';var EventEmitter=require(_0x8b8b('0x0'));var ChatMessage=require(_0x8b8b('0x1'))['db'][_0x8b8b('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8b8b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8b8b('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1dd89f){return function(_0x4fe96c,_0x68182,_0x5801a8){ChatMessageEvents[_0x8b8b('0x5')](_0x1dd89f+':'+_0x4fe96c['id'],_0x4fe96c);ChatMessageEvents[_0x8b8b('0x5')](_0x1dd89f,_0x4fe96c);_0x5801a8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x8b8b('0x6')](e,emitEvent(event));}}module[_0x8b8b('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f67c4ff..7175078 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 _0x211a=['body','FULLTEXT','get','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','update','createdAt','toLowerCase','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x211a,0x64));var _0xa211=function(_0x39277f,_0x460842){_0x39277f=_0x39277f-0x0;var _0xfcf21e=_0x211a[_0x39277f];return _0xfcf21e;};'use strict';var _=require(_0xa211('0x0'));var util=require(_0xa211('0x1'));var logger=require(_0xa211('0x2'))('api');var moment=require(_0xa211('0x3'));var BPromise=require('bluebird');var rp=require(_0xa211('0x4'));var fs=require('fs');var path=require(_0xa211('0x5'));var rimraf=require(_0xa211('0x6'));var config=require(_0xa211('0x7'));var attributes=require(_0xa211('0x8'));module['exports']=function(_0x515097,_0x39913a){return _0x515097[_0xa211('0x9')]('ChatMessage',attributes,{'tableName':_0xa211('0xa'),'paranoid':![],'indexes':[{'name':_0xa211('0xb'),'fields':[_0xa211('0xc')],'type':_0xa211('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cb5b7,_0x34e093,_0x26b5c6){var _0x3d043b=_0x515097['models'];var _0x2c09fd=_0x5cb5b7[_0xa211('0xe')]({'plain':!![]});if(_0x2c09fd[_0xa211('0xf')]['toLowerCase']()==='in'||_0x2c09fd['direction']['toLowerCase']()===_0xa211('0x10')&&!_0x2c09fd[_0xa211('0x11')]&&!_[_0xa211('0x12')](_0x2c09fd[_0xa211('0x13')])){_0x3d043b[_0xa211('0x14')]['findOne']({'where':{'id':_0x2c09fd[_0xa211('0x15')]}})['then'](function(_0x1d1af6){if(_0x1d1af6){_0x1d1af6[_0xa211('0x16')]({'lastMsgAt':_0x2c09fd[_0xa211('0x17')],'lastMsgDirection':_0x2c09fd[_0xa211('0xf')][_0xa211('0x18')]()});}})[_0xa211('0x19')](function(_0x22c8b9){console[_0xa211('0x1a')](_0x22c8b9);});}_0x26b5c6();}},'charset':'utf8mb4','collate':_0xa211('0x1b')});}; \ No newline at end of file +var _0x776b=['exports','define','ChatMessage','body','FULLTEXT','get','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./chatMessage.attributes'];(function(_0x3e0692,_0x535d79){var _0x5c254f=function(_0x544ae0){while(--_0x544ae0){_0x3e0692['push'](_0x3e0692['shift']());}};_0x5c254f(++_0x535d79);}(_0x776b,0x12b));var _0xb776=function(_0x5ccf8e,_0x3c1f49){_0x5ccf8e=_0x5ccf8e-0x0;var _0x2bc4f0=_0x776b[_0x5ccf8e];return _0x2bc4f0;};'use strict';var _=require(_0xb776('0x0'));var util=require(_0xb776('0x1'));var logger=require(_0xb776('0x2'))(_0xb776('0x3'));var moment=require(_0xb776('0x4'));var BPromise=require('bluebird');var rp=require(_0xb776('0x5'));var fs=require('fs');var path=require(_0xb776('0x6'));var rimraf=require(_0xb776('0x7'));var config=require('../../config/environment');var attributes=require(_0xb776('0x8'));module[_0xb776('0x9')]=function(_0x384a96,_0x4ec98a){return _0x384a96[_0xb776('0xa')](_0xb776('0xb'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xb776('0xc')],'type':_0xb776('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x50258e,_0x3c387d,_0x55ddb7){var _0x48db71=_0x384a96['models'];var _0x3711e6=_0x50258e[_0xb776('0xe')]({'plain':!![]});if(_0x3711e6['direction']['toLowerCase']()==='in'||_0x3711e6['direction'][_0xb776('0xf')]()==='out'&&!_0x3711e6[_0xb776('0x10')]&&!_[_0xb776('0x11')](_0x3711e6[_0xb776('0x12')])){_0x48db71[_0xb776('0x13')][_0xb776('0x14')]({'where':{'id':_0x3711e6['ChatInteractionId']}})['then'](function(_0x5b0b7c){if(_0x5b0b7c){_0x5b0b7c[_0xb776('0x15')]({'lastMsgAt':_0x3711e6[_0xb776('0x16')],'lastMsgDirection':_0x3711e6[_0xb776('0x17')]['toLowerCase']()});}})[_0xb776('0x18')](function(_0x4d2a06){console[_0xb776('0x19')](_0x4d2a06);});}_0x55ddb7();}},'charset':_0xb776('0x1a'),'collate':_0xb776('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 6d6dced..a2acbe8 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 _0x544f=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xbfa7ab,_0x95acc9){var _0x5d4e5c=function(_0xa25730){while(--_0xa25730){_0xbfa7ab['push'](_0xbfa7ab['shift']());}};_0x5d4e5c(++_0x95acc9);}(_0x544f,0x104));var _0xf544=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x544f[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require(_0xf544('0x0'));var moment=require('moment');var BPromise=require(_0xf544('0x1'));var rs=require(_0xf544('0x2'));var fs=require('fs');var Redis=require(_0xf544('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf544('0x4'));var logger=require(_0xf544('0x5'))(_0xf544('0x6'));var config=require('../../config/environment');var jayson=require(_0xf544('0x7'));var client=jayson[_0xf544('0x8')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf544('0x9')],{'host':_0xf544('0xa'),'port':0x18eb});var socket=require(_0xf544('0xb'))(new Redis(config['redis']));require(_0xf544('0xc'))[_0xf544('0xd')](socket);function respondWithRpcPromise(_0x281ebe,_0x2c59f0,_0x1b3881){return new BPromise(function(_0x18c671,_0x31e29a){return client[_0xf544('0xe')](_0x281ebe,_0x1b3881)[_0xf544('0xf')](function(_0x283476){logger[_0xf544('0x10')](_0xf544('0x11'),_0x2c59f0,_0xf544('0x12'));logger[_0xf544('0x13')](_0xf544('0x14'),_0x2c59f0,_0xf544('0x12'),JSON[_0xf544('0x15')](_0x283476));if(_0x283476[_0xf544('0x16')]){if(_0x283476[_0xf544('0x16')][_0xf544('0x17')]===0x1f4){logger[_0xf544('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2c59f0,_0x283476['error'][_0xf544('0x18')]);return _0x31e29a(_0x283476['error']['message']);}logger[_0xf544('0x16')](_0xf544('0x11'),_0x2c59f0,_0x283476['error'][_0xf544('0x18')]);return _0x18c671(_0x283476[_0xf544('0x16')][_0xf544('0x18')]);}else{logger[_0xf544('0x10')](_0xf544('0x11'),_0x2c59f0,_0xf544('0x12'));_0x18c671(_0x283476[_0xf544('0x19')][_0xf544('0x18')]);}})[_0xf544('0x1a')](function(_0x30b605){logger[_0xf544('0x16')]('ChatMessage,\x20%s,\x20%s',_0x2c59f0,_0x30b605);_0x31e29a(_0x30b605);});});}exports[_0xf544('0x1b')]=function(_0x57cfb7){var _0x5493c3=this;return new Promise(function(_0x29bc70,_0x4cd4c9){return db[_0xf544('0x1c')]['create'](_0x57cfb7[_0xf544('0x1d')],{'raw':_0x57cfb7['options']?_0x57cfb7[_0xf544('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xf544('0xf')](function(_0x1f4235){logger[_0xf544('0x10')](_0xf544('0x1b'),_0x57cfb7);logger['debug'](_0xf544('0x1b'),_0x57cfb7,JSON[_0xf544('0x15')](_0x1f4235));_0x29bc70(_0x1f4235);})[_0xf544('0x1a')](function(_0x54faee){logger['error'](_0xf544('0x1b'),_0x54faee[_0xf544('0x18')],_0x57cfb7);_0x4cd4c9(_0x5493c3['error'](0x1f4,_0x54faee[_0xf544('0x18')]));});});}; \ No newline at end of file +var _0x7f81=['info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then'];(function(_0x5454c1,_0x27f5d1){var _0x43dc40=function(_0x3f5434){while(--_0x3f5434){_0x5454c1['push'](_0x5454c1['shift']());}};_0x43dc40(++_0x27f5d1);}(_0x7f81,0x185));var _0x17f8=function(_0xc0c915,_0x11367b){_0xc0c915=_0xc0c915-0x0;var _0x362287=_0x7f81[_0xc0c915];return _0x362287;};'use strict';var _=require(_0x17f8('0x0'));var util=require(_0x17f8('0x1'));var moment=require(_0x17f8('0x2'));var BPromise=require(_0x17f8('0x3'));var rs=require(_0x17f8('0x4'));var fs=require('fs');var Redis=require(_0x17f8('0x5'));var db=require(_0x17f8('0x6'))['db'];var utils=require(_0x17f8('0x7'));var logger=require('../../config/logger')(_0x17f8('0x8'));var config=require(_0x17f8('0x9'));var jayson=require(_0x17f8('0xa'));var client=jayson[_0x17f8('0xb')][_0x17f8('0xc')]({'port':0x232a});config[_0x17f8('0xd')]=_['defaults'](config[_0x17f8('0xd')],{'host':_0x17f8('0xe'),'port':0x18eb});var socket=require(_0x17f8('0xf'))(new Redis(config[_0x17f8('0xd')]));require(_0x17f8('0x10'))[_0x17f8('0x11')](socket);function respondWithRpcPromise(_0x4e3beb,_0x1e690f,_0x24507b){return new BPromise(function(_0x58c13f,_0x11a6d1){return client['request'](_0x4e3beb,_0x24507b)[_0x17f8('0x12')](function(_0x5a4719){logger[_0x17f8('0x13')](_0x17f8('0x14'),_0x1e690f,'request\x20sent');logger[_0x17f8('0x15')](_0x17f8('0x16'),_0x1e690f,_0x17f8('0x17'),JSON['stringify'](_0x5a4719));if(_0x5a4719[_0x17f8('0x18')]){if(_0x5a4719[_0x17f8('0x18')][_0x17f8('0x19')]===0x1f4){logger[_0x17f8('0x18')]('ChatMessage,\x20%s,\x20%s',_0x1e690f,_0x5a4719[_0x17f8('0x18')][_0x17f8('0x1a')]);return _0x11a6d1(_0x5a4719[_0x17f8('0x18')][_0x17f8('0x1a')]);}logger['error'](_0x17f8('0x14'),_0x1e690f,_0x5a4719['error']['message']);return _0x58c13f(_0x5a4719[_0x17f8('0x18')]['message']);}else{logger[_0x17f8('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1e690f,_0x17f8('0x17'));_0x58c13f(_0x5a4719['result'][_0x17f8('0x1a')]);}})['catch'](function(_0x40fd55){logger[_0x17f8('0x18')](_0x17f8('0x14'),_0x1e690f,_0x40fd55);_0x11a6d1(_0x40fd55);});});}exports[_0x17f8('0x1b')]=function(_0x13b2b9){var _0x197dd4=this;return new Promise(function(_0x34a7ad,_0x38b4e8){return db[_0x17f8('0x1c')][_0x17f8('0x1d')](_0x13b2b9[_0x17f8('0x1e')],{'raw':_0x13b2b9[_0x17f8('0x1f')]?_0x13b2b9['options'][_0x17f8('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x195552){logger[_0x17f8('0x13')](_0x17f8('0x1b'),_0x13b2b9);logger[_0x17f8('0x15')](_0x17f8('0x1b'),_0x13b2b9,JSON[_0x17f8('0x21')](_0x195552));_0x34a7ad(_0x195552);})['catch'](function(_0x41451c){logger['error'](_0x17f8('0x1b'),_0x41451c['message'],_0x13b2b9);_0x38b4e8(_0x197dd4['error'](0x1f4,_0x41451c[_0x17f8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 70ee429..e38ec22 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 _0xf2cf=['save','remove','update','emit','removeListener','length','chatMessage:'];(function(_0x3041c6,_0x4dee4e){var _0x268ad8=function(_0x44ddee){while(--_0x44ddee){_0x3041c6['push'](_0x3041c6['shift']());}};_0x268ad8(++_0x4dee4e);}(_0xf2cf,0xf5));var _0xff2c=function(_0x534084,_0x4ea0f6){_0x534084=_0x534084-0x0;var _0x333cbf=_0xf2cf[_0x534084];return _0x333cbf;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0xff2c('0x0'),_0xff2c('0x1'),_0xff2c('0x2')];function createListener(_0x5ef2da,_0x8c6724){return function(_0x3d98a5){_0x8c6724[_0xff2c('0x3')](_0x5ef2da,_0x3d98a5);};}function removeListener(_0x2ff0e4,_0x189ac6){return function(){ChatMessageEvents[_0xff2c('0x4')](_0x2ff0e4,_0x189ac6);};}exports['register']=function(_0x8f0f4){for(var _0x68b356=0x0,_0x57ba3d=events[_0xff2c('0x5')];_0x68b356<_0x57ba3d;_0x68b356++){var _0x223a86=events[_0x68b356];var _0x105f4d=createListener(_0xff2c('0x6')+_0x223a86,_0x8f0f4);ChatMessageEvents['on'](_0x223a86,_0x105f4d);}}; \ No newline at end of file +var _0x9576=['save','remove','update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0xf972e3,_0x2ba693){var _0x3099d1=function(_0x33df7e){while(--_0x33df7e){_0xf972e3['push'](_0xf972e3['shift']());}};_0x3099d1(++_0x2ba693);}(_0x9576,0x182));var _0x6957=function(_0x4291c3,_0x57f351){_0x4291c3=_0x4291c3-0x0;var _0x4e6063=_0x9576[_0x4291c3];return _0x4e6063;};'use strict';var ChatMessageEvents=require(_0x6957('0x0'));var events=[_0x6957('0x1'),_0x6957('0x2'),_0x6957('0x3')];function createListener(_0x47fd53,_0x4ee0d8){return function(_0xf9d8fc){_0x4ee0d8[_0x6957('0x4')](_0x47fd53,_0xf9d8fc);};}function removeListener(_0x9e834,_0x10ed80){return function(){ChatMessageEvents[_0x6957('0x5')](_0x9e834,_0x10ed80);};}exports[_0x6957('0x6')]=function(_0x2eb79e){for(var _0x49e08a=0x0,_0x6d8af8=events[_0x6957('0x7')];_0x49e08a<_0x6d8af8;_0x49e08a++){var _0x70b8c4=events[_0x49e08a];var _0x2e5727=createListener(_0x6957('0x8')+_0x70b8c4,_0x2eb79e);ChatMessageEvents['on'](_0x70b8c4,_0x2e5727);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f812377..8d0432d 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 _0x4b7b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x4b7b,0xc8));var _0xb4b7=function(_0x586f76,_0x4f534c){_0x586f76=_0x586f76-0x0;var _0x298810=_0x4b7b[_0x586f76];return _0x298810;};'use strict';var multer=require('multer');var util=require(_0xb4b7('0x0'));var path=require(_0xb4b7('0x1'));var timeout=require(_0xb4b7('0x2'));var express=require(_0xb4b7('0x3'));var router=express[_0xb4b7('0x4')]();var fs_extra=require(_0xb4b7('0x5'));var auth=require(_0xb4b7('0x6'));var interaction=require(_0xb4b7('0x7'));var config=require(_0xb4b7('0x8'));var controller=require(_0xb4b7('0x9'));router[_0xb4b7('0xa')]('/',auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xc')]);router[_0xb4b7('0xa')](_0xb4b7('0xd'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xe')]);router['get']('/:id',auth[_0xb4b7('0xb')](),controller[_0xb4b7('0xf')]);router[_0xb4b7('0x10')]('/',auth[_0xb4b7('0xb')](),interaction[_0xb4b7('0x11')](_0xb4b7('0x12'),_0xb4b7('0x13')),controller[_0xb4b7('0x14')]);router[_0xb4b7('0x15')]('/:id',controller[_0xb4b7('0x16')]);router[_0xb4b7('0x15')](_0xb4b7('0x17'),auth[_0xb4b7('0xb')](),controller['accept']);router[_0xb4b7('0x15')](_0xb4b7('0x18'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0x19')]);router[_0xb4b7('0x1a')](_0xb4b7('0x1b'),auth[_0xb4b7('0xb')](),controller[_0xb4b7('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xf62e=['chat','chatmessage:create','create','update','put','/:id/accept','reject','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','post'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xf62e,0x135));var _0xef62=function(_0x18efd3,_0x24f99e){_0x18efd3=_0x18efd3-0x0;var _0x36834b=_0xf62e[_0x18efd3];return _0x36834b;};'use strict';var multer=require(_0xef62('0x0'));var util=require(_0xef62('0x1'));var path=require(_0xef62('0x2'));var timeout=require(_0xef62('0x3'));var express=require(_0xef62('0x4'));var router=express[_0xef62('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xef62('0x6'));var interaction=require(_0xef62('0x7'));var config=require(_0xef62('0x8'));var controller=require(_0xef62('0x9'));router['get']('/',auth[_0xef62('0xa')](),controller[_0xef62('0xb')]);router[_0xef62('0xc')](_0xef62('0xd'),auth[_0xef62('0xa')](),controller['describe']);router[_0xef62('0xc')](_0xef62('0xe'),auth[_0xef62('0xa')](),controller['show']);router[_0xef62('0xf')]('/',auth[_0xef62('0xa')](),interaction['tracked'](_0xef62('0x10'),_0xef62('0x11')),controller[_0xef62('0x12')]);router['put'](_0xef62('0xe'),controller[_0xef62('0x13')]);router[_0xef62('0x14')](_0xef62('0x15'),auth[_0xef62('0xa')](),controller['accept']);router[_0xef62('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xef62('0x16')]);router[_0xef62('0x17')]('/:id',auth[_0xef62('0xa')](),controller[_0xef62('0x18')]);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 25720e1..67d19e1 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 _0x5f66=['medium','TEXT','exports'];(function(_0x116ffd,_0x3b1b3b){var _0x3850a8=function(_0x2db10f){while(--_0x2db10f){_0x116ffd['push'](_0x116ffd['shift']());}};_0x3850a8(++_0x3b1b3b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x5f66[_0x4c12ec];return _0x3ae42c;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0x340948,_0x4c2a6c){var _0x4149dc=function(_0x170287){while(--_0x170287){_0x340948['push'](_0x340948['shift']());}};_0x4149dc(++_0x4c2a6c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 630ad83..2ccb198 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x7a54,0x106));var _0x47a5=function(_0x17a0ec,_0x28edb8){_0x17a0ec=_0x17a0ec-0x0;var _0x30137d=_0x7a54[_0x17a0ec];return _0x30137d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x34439e,_0x536081){var _0x3da8a9=function(_0x1fdcd8){while(--_0x1fdcd8){_0x34439e['push'](_0x34439e['shift']());}};_0x3da8a9(++_0x536081);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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 621d153..c5ce4e3 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 _0xa490=['hook','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x8d0828,_0x1e830b){var _0x402fc4=function(_0x48e474){while(--_0x48e474){_0x8d0828['push'](_0x8d0828['shift']());}};_0x402fc4(++_0x1e830b);}(_0xa490,0x14e));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x0a49('0x0'));var ChatOfflineMessage=require(_0x0a49('0x1'))['db'][_0x0a49('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0a49('0x3')](0x0);var events={'afterCreate':_0x0a49('0x4'),'afterUpdate':'update','afterDestroy':_0x0a49('0x5')};function emitEvent(_0x39bccc){return function(_0x12660d,_0x5a58f0,_0x414d45){ChatOfflineMessageEvents[_0x0a49('0x6')](_0x39bccc+':'+_0x12660d['id'],_0x12660d);ChatOfflineMessageEvents[_0x0a49('0x6')](_0x39bccc,_0x12660d);_0x414d45(null);};}for(var e in events){if(events[_0x0a49('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x0a49('0x8')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x5e61=['setMaxListeners','update','remove','emit','hook','exports','events','ChatOfflineMessage'];(function(_0x308c5c,_0x334e28){var _0x36488e=function(_0x1a32c5){while(--_0x1a32c5){_0x308c5c['push'](_0x308c5c['shift']());}};_0x36488e(++_0x334e28);}(_0x5e61,0x126));var _0x15e6=function(_0x4233c3,_0x437bc8){_0x4233c3=_0x4233c3-0x0;var _0x2f5f13=_0x5e61[_0x4233c3];return _0x2f5f13;};'use strict';var EventEmitter=require(_0x15e6('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x15e6('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x15e6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x15e6('0x3'),'afterDestroy':_0x15e6('0x4')};function emitEvent(_0x1d8fda){return function(_0x1d6dcc,_0x4a6aa1,_0x2fdf8c){ChatOfflineMessageEvents[_0x15e6('0x5')](_0x1d8fda+':'+_0x1d6dcc['id'],_0x1d6dcc);ChatOfflineMessageEvents[_0x15e6('0x5')](_0x1d8fda,_0x1d6dcc);_0x2fdf8c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x15e6('0x6')](e,emitEvent(event));}}module[_0x15e6('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7985e27..acf97d5 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 _0xb6f8=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb6f8,0xcd));var _0x8b6f=function(_0x4dfd70,_0x35e8d2){_0x4dfd70=_0x4dfd70-0x0;var _0x48d818=_0xb6f8[_0x4dfd70];return _0x48d818;};'use strict';var attributes=require(_0x8b6f('0x0'));module[_0x8b6f('0x1')]=function(_0x1fc116){return _0x1fc116[_0x8b6f('0x2')](_0x8b6f('0x3'),attributes,{'tableName':_0x8b6f('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8b6f('0x5')});}; \ No newline at end of file +var _0x3168=['define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x9e72c8,_0x5ac1a9){var _0x1468b2=function(_0x2cac69){while(--_0x2cac69){_0x9e72c8['push'](_0x9e72c8['shift']());}};_0x1468b2(++_0x5ac1a9);}(_0x3168,0x18a));var _0x8316=function(_0x4cbf9e,_0x11d26f){_0x4cbf9e=_0x4cbf9e-0x0;var _0x2ba922=_0x3168[_0x4cbf9e];return _0x2ba922;};'use strict';var attributes=require(_0x8316('0x0'));module[_0x8316('0x1')]=function(_0x5f1c32){return _0x5f1c32[_0x8316('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x8316('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8316('0x4'),'collate':_0x8316('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0ce9bfc..685d36a 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 _0xe5e7=['message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0xe5e7,0x10d));var _0x7e5e=function(_0x154746,_0x58b3e8){_0x154746=_0x154746-0x0;var _0x1b9722=_0xe5e7[_0x154746];return _0x1b9722;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7e5e('0x0'));var BPromise=require(_0x7e5e('0x1'));var rs=require(_0x7e5e('0x2'));var fs=require('fs');var Redis=require(_0x7e5e('0x3'));var db=require(_0x7e5e('0x4'))['db'];var utils=require(_0x7e5e('0x5'));var logger=require(_0x7e5e('0x6'))(_0x7e5e('0x7'));var config=require(_0x7e5e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x555fae,_0x33ca4a,_0x3c72af){return new BPromise(function(_0x16823b,_0x2b9a0f){return client[_0x7e5e('0xa')](_0x555fae,_0x3c72af)['then'](function(_0x568bc6){logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));logger['debug'](_0x7e5e('0xe'),_0x33ca4a,_0x7e5e('0xd'),JSON['stringify'](_0x568bc6));if(_0x568bc6['error']){if(_0x568bc6['error']['code']===0x1f4){logger[_0x7e5e('0xf')](_0x7e5e('0xc'),_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x2b9a0f(_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);}logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x568bc6[_0x7e5e('0xf')][_0x7e5e('0x10')]);return _0x16823b(_0x568bc6['error']['message']);}else{logger[_0x7e5e('0xb')](_0x7e5e('0xc'),_0x33ca4a,_0x7e5e('0xd'));_0x16823b(_0x568bc6[_0x7e5e('0x11')]['message']);}})[_0x7e5e('0x12')](function(_0x1f26b6){logger[_0x7e5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x33ca4a,_0x1f26b6);_0x2b9a0f(_0x1f26b6);});});} \ No newline at end of file +var _0xf78b=['info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x170fb8,_0x4f3c29){var _0x4e21fc=function(_0x3176e3){while(--_0x3176e3){_0x170fb8['push'](_0x170fb8['shift']());}};_0x4e21fc(++_0x4f3c29);}(_0xf78b,0x78));var _0xbf78=function(_0xf5174d,_0x2c1460){_0xf5174d=_0xf5174d-0x0;var _0x3bada1=_0xf78b[_0xf5174d];return _0x3bada1;};'use strict';var _=require(_0xbf78('0x0'));var util=require('util');var moment=require(_0xbf78('0x1'));var BPromise=require(_0xbf78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf78('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf78('0x4'))(_0xbf78('0x5'));var config=require(_0xbf78('0x6'));var jayson=require(_0xbf78('0x7'));var client=jayson[_0xbf78('0x8')][_0xbf78('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491d82,_0x2eedf2,_0x1c503d){return new BPromise(function(_0x382b7c,_0x33ef00){return client[_0xbf78('0xa')](_0x491d82,_0x1c503d)[_0xbf78('0xb')](function(_0x36002b){logger[_0xbf78('0xc')](_0xbf78('0xd'),_0x2eedf2,_0xbf78('0xe'));logger[_0xbf78('0xf')](_0xbf78('0x10'),_0x2eedf2,'request\x20sent',JSON[_0xbf78('0x11')](_0x36002b));if(_0x36002b[_0xbf78('0x12')]){if(_0x36002b[_0xbf78('0x12')]['code']===0x1f4){logger[_0xbf78('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2eedf2,_0x36002b['error'][_0xbf78('0x13')]);return _0x33ef00(_0x36002b['error'][_0xbf78('0x13')]);}logger[_0xbf78('0x12')](_0xbf78('0xd'),_0x2eedf2,_0x36002b[_0xbf78('0x12')][_0xbf78('0x13')]);return _0x382b7c(_0x36002b[_0xbf78('0x12')]['message']);}else{logger[_0xbf78('0xc')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2eedf2,_0xbf78('0xe'));_0x382b7c(_0x36002b[_0xbf78('0x14')][_0xbf78('0x13')]);}})[_0xbf78('0x15')](function(_0x50c4be){logger['error'](_0xbf78('0xd'),_0x2eedf2,_0x50c4be);_0x33ef00(_0x50c4be);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c30c8ca..73ef3c9 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 _0x4b2a=['../../config/environment','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3e35e8,_0x17fd7e){var _0xbb61e7=function(_0x3d03fb){while(--_0x3d03fb){_0x3e35e8['push'](_0x3e35e8['shift']());}};_0xbb61e7(++_0x17fd7e);}(_0x4b2a,0x7d));var _0xa4b2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4b2a[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xa4b2('0x0'));var util=require(_0xa4b2('0x1'));var path=require(_0xa4b2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa4b2('0x3')]();var fs_extra=require(_0xa4b2('0x4'));var auth=require(_0xa4b2('0x5'));var interaction=require(_0xa4b2('0x6'));var config=require(_0xa4b2('0x7'));var controller=require(_0xa4b2('0x8'));router[_0xa4b2('0x9')]('/',auth['isAuthenticated'](),controller[_0xa4b2('0xa')]);router[_0xa4b2('0x9')](_0xa4b2('0xb'),auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xd')]);router[_0xa4b2('0x9')]('/:id',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xe')]);router['post']('/',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0xf')]);router[_0xa4b2('0x10')]('/:id',auth[_0xa4b2('0xc')](),controller[_0xa4b2('0x11')]);router[_0xa4b2('0x12')](_0xa4b2('0x13'),auth[_0xa4b2('0xc')](),controller[_0xa4b2('0x14')]);module[_0xa4b2('0x15')]=router; \ No newline at end of file +var _0x56a7=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x110230,_0x9327b4){var _0xef860f=function(_0x146037){while(--_0x146037){_0x110230['push'](_0x110230['shift']());}};_0xef860f(++_0x9327b4);}(_0x56a7,0x127));var _0x756a=function(_0x5e8c98,_0xf42c9c){_0x5e8c98=_0x5e8c98-0x0;var _0x487a2a=_0x56a7[_0x5e8c98];return _0x487a2a;};'use strict';var multer=require(_0x756a('0x0'));var util=require('util');var path=require(_0x756a('0x1'));var timeout=require(_0x756a('0x2'));var express=require(_0x756a('0x3'));var router=express[_0x756a('0x4')]();var fs_extra=require(_0x756a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x756a('0x6'));var config=require(_0x756a('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x756a('0x8')]('/',auth[_0x756a('0x9')](),controller[_0x756a('0xa')]);router['get']('/describe',auth[_0x756a('0x9')](),controller[_0x756a('0xb')]);router['get'](_0x756a('0xc'),auth[_0x756a('0x9')](),controller['show']);router[_0x756a('0xd')]('/',auth['isAuthenticated'](),controller[_0x756a('0xe')]);router[_0x756a('0xf')](_0x756a('0xc'),auth[_0x756a('0x9')](),controller[_0x756a('0x10')]);router[_0x756a('0x11')](_0x756a('0xc'),auth[_0x756a('0x9')](),controller[_0x756a('0x12')]);module[_0x756a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 7106bcb..701f8f8 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 _0x547c=['mouseOver','timeout','STRING','INTEGER','ENUM'];(function(_0x499968,_0x4540c7){var _0x559f0b=function(_0x391904){while(--_0x391904){_0x499968['push'](_0x499968['shift']());}};_0x559f0b(++_0x4540c7);}(_0x547c,0xa4));var _0xc547=function(_0x2f6136,_0x274ed2){_0x2f6136=_0x2f6136-0x0;var _0x5ac67b=_0x547c[_0x2f6136];return _0x5ac67b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc547('0x0')](_0xc547('0x1'),_0xc547('0x2')),'defaultValue':_0xc547('0x1')},'selector':{'type':Sequelize[_0xc547('0x3')]},'timeout':{'type':Sequelize[_0xc547('0x4')]}}; \ No newline at end of file +var _0x4ee0=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x428706,_0x53c9a1){var _0x5dfe05=function(_0x5d9e21){while(--_0x5d9e21){_0x428706['push'](_0x428706['shift']());}};_0x5dfe05(++_0x53c9a1);}(_0x4ee0,0x104));var _0x04ee=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x4ee0[_0x28aea5];return _0x6a55f9;};'use strict';var Sequelize=require(_0x04ee('0x0'));module[_0x04ee('0x1')]={'name':{'type':Sequelize[_0x04ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x04ee('0x3')](_0x04ee('0x4'),_0x04ee('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x04ee('0x2')]},'timeout':{'type':Sequelize[_0x04ee('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a98967e..439e31a 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 _0x8098=['end','error','stack','name','send','params','keys','rawAttributes','query','intersection','model','attributes','fields','length','merge','ChatProactiveAction','catch','create','body','update','find','destroy','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','then'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x8098,0x1ba));var _0x8809=function(_0x346178,_0xc7c30b){_0x346178=_0x346178-0x0;var _0x201712=_0x8098[_0x346178];return _0x201712;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8809('0x0'));var jsonpatch=require(_0x8809('0x1'));var rp=require(_0x8809('0x2'));var moment=require(_0x8809('0x3'));var BPromise=require(_0x8809('0x4'));var Mustache=require('mustache');var util=require(_0x8809('0x5'));var path=require(_0x8809('0x6'));var sox=require(_0x8809('0x7'));var csv=require(_0x8809('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8809('0x9'));var _=require(_0x8809('0xa'));var squel=require('squel');var crypto=require(_0x8809('0xb'));var jsforce=require(_0x8809('0xc'));var deskjs=require(_0x8809('0xd'));var toCsv=require(_0x8809('0x8'));var querystring=require(_0x8809('0xe'));var Papa=require(_0x8809('0xf'));var Redis=require(_0x8809('0x10'));var authService=require(_0x8809('0x11'));var qs=require(_0x8809('0x12'));var as=require(_0x8809('0x13'));var hardwareService=require(_0x8809('0x14'));var logger=require(_0x8809('0x15'))(_0x8809('0x16'));var utils=require(_0x8809('0x17'));var config=require(_0x8809('0x18'));var licenseUtil=require(_0x8809('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388b99,_0x455989){_0x455989=_0x455989||0xcc;return function(_0x4d3b4c){if(_0x4d3b4c){return _0x388b99[_0x8809('0x1a')](_0x455989);}return _0x388b99[_0x8809('0x1b')](_0x455989)['end']();};}function respondWithResult(_0x5d87df,_0x316f2c){_0x316f2c=_0x316f2c||0xc8;return function(_0x2e4279){if(_0x2e4279){return _0x5d87df[_0x8809('0x1b')](_0x316f2c)[_0x8809('0x1c')](_0x2e4279);}};}function respondWithFilteredResult(_0x131716,_0x3d4d7e){return function(_0x105bec){if(_0x105bec){var _0x5624b5=typeof _0x3d4d7e[_0x8809('0x1d')]===_0x8809('0x1e')&&typeof _0x3d4d7e['limit']===_0x8809('0x1e');var _0x369d58=_0x105bec['count'];var _0x3b0562=_0x5624b5?0x0:_0x3d4d7e[_0x8809('0x1d')];var _0x7ec1a6=_0x5624b5?_0x105bec[_0x8809('0x1f')]:_0x3d4d7e[_0x8809('0x1d')]+_0x3d4d7e['limit'];var _0x4826e2;if(_0x7ec1a6>=_0x369d58){_0x7ec1a6=_0x369d58;_0x4826e2=0xc8;}else{_0x4826e2=0xce;}_0x131716[_0x8809('0x1b')](_0x4826e2);return _0x131716[_0x8809('0x20')](_0x8809('0x21'),_0x3b0562+'-'+_0x7ec1a6+'/'+_0x369d58)[_0x8809('0x1c')](_0x105bec);}return null;};}function patchUpdates(_0x2ff4a1){return function(_0x91de1e){try{jsonpatch[_0x8809('0x22')](_0x91de1e,_0x2ff4a1,!![]);}catch(_0x404be9){return BPromise[_0x8809('0x23')](_0x404be9);}return _0x91de1e[_0x8809('0x24')]();};}function saveUpdates(_0x16893a,_0x1440aa){return function(_0x26b43e){if(_0x26b43e){return _0x26b43e['update'](_0x16893a)['then'](function(_0x34d2df){return _0x34d2df;});}return null;};}function removeEntity(_0x5984c6,_0x521840){return function(_0x54ddd8){if(_0x54ddd8){return _0x54ddd8['destroy']()[_0x8809('0x25')](function(){_0x5984c6[_0x8809('0x1b')](0xcc)[_0x8809('0x26')]();});}};}function handleEntityNotFound(_0x2bbf26,_0x2947f7){return function(_0x3d21fd){if(!_0x3d21fd){_0x2bbf26[_0x8809('0x1a')](0x194);}return _0x3d21fd;};}function handleError(_0x14f545,_0x125776){_0x125776=_0x125776||0x1f4;return function(_0x6e5dc8){logger[_0x8809('0x27')](_0x6e5dc8[_0x8809('0x28')]);if(_0x6e5dc8['name']){delete _0x6e5dc8[_0x8809('0x29')];}_0x14f545[_0x8809('0x1b')](_0x125776)[_0x8809('0x2a')](_0x6e5dc8);};}exports['show']=function(_0x13d74b,_0x443741){var _0xbba52b={'raw':!![],'where':{'id':_0x13d74b[_0x8809('0x2b')]['id']}},_0x296187={};_0x296187['model']=_[_0x8809('0x2c')](db['ChatProactiveAction'][_0x8809('0x2d')]);_0x296187[_0x8809('0x2e')]=_['keys'](_0x13d74b[_0x8809('0x2e')]);_0x296187['filters']=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],_0x296187[_0x8809('0x2e')]);_0xbba52b[_0x8809('0x31')]=_[_0x8809('0x2f')](_0x296187[_0x8809('0x30')],qs['fields'](_0x13d74b['query'][_0x8809('0x32')]));_0xbba52b[_0x8809('0x31')]=_0xbba52b[_0x8809('0x31')][_0x8809('0x33')]?_0xbba52b[_0x8809('0x31')]:_0x296187['model'];if(_0x13d74b[_0x8809('0x2e')]['includeAll']){_0xbba52b['include']=[{'all':!![]}];}_0xbba52b=_[_0x8809('0x34')]({},_0xbba52b,_0x13d74b['options']);return db[_0x8809('0x35')]['find'](_0xbba52b)[_0x8809('0x25')](handleEntityNotFound(_0x443741,null))[_0x8809('0x25')](respondWithResult(_0x443741,null))[_0x8809('0x36')](handleError(_0x443741,null));};exports[_0x8809('0x37')]=function(_0x27565c,_0x29c522){return db['ChatProactiveAction'][_0x8809('0x37')](_0x27565c[_0x8809('0x38')],{})['then'](respondWithResult(_0x29c522,0xc9))[_0x8809('0x36')](handleError(_0x29c522,null));};exports[_0x8809('0x39')]=function(_0x4a09a,_0x2f584f){if(_0x4a09a[_0x8809('0x38')]['id']){delete _0x4a09a[_0x8809('0x38')]['id'];}return db['ChatProactiveAction'][_0x8809('0x3a')]({'where':{'id':_0x4a09a[_0x8809('0x2b')]['id']}})[_0x8809('0x25')](handleEntityNotFound(_0x2f584f,null))[_0x8809('0x25')](saveUpdates(_0x4a09a[_0x8809('0x38')],null))[_0x8809('0x25')](respondWithResult(_0x2f584f,null))[_0x8809('0x36')](handleError(_0x2f584f,null));};exports[_0x8809('0x3b')]=function(_0x4e73ff,_0x13b530){return db[_0x8809('0x35')][_0x8809('0x3a')]({'where':{'id':_0x4e73ff[_0x8809('0x2b')]['id']}})['then'](handleEntityNotFound(_0x13b530,null))[_0x8809('0x25')](removeEntity(_0x13b530,null))[_0x8809('0x36')](handleError(_0x13b530,null));}; \ No newline at end of file +var _0xf185=['keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','find','create','body','catch','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','show'];(function(_0x446f3b,_0x46da6e){var _0x1b0f32=function(_0x46bece){while(--_0x46bece){_0x446f3b['push'](_0x446f3b['shift']());}};_0x1b0f32(++_0x46da6e);}(_0xf185,0x1be));var _0x5f18=function(_0x401048,_0x4436f6){_0x401048=_0x401048-0x0;var _0x3ee107=_0xf185[_0x401048];return _0x3ee107;};'use strict';var emlformat=require(_0x5f18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5f18('0x1'));var jsonpatch=require(_0x5f18('0x2'));var rp=require(_0x5f18('0x3'));var moment=require(_0x5f18('0x4'));var BPromise=require(_0x5f18('0x5'));var Mustache=require(_0x5f18('0x6'));var util=require('util');var path=require(_0x5f18('0x7'));var sox=require(_0x5f18('0x8'));var csv=require(_0x5f18('0x9'));var ejs=require(_0x5f18('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f18('0xb'));var squel=require(_0x5f18('0xc'));var crypto=require('crypto');var jsforce=require(_0x5f18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5f18('0x9'));var querystring=require(_0x5f18('0xe'));var Papa=require('papaparse');var Redis=require(_0x5f18('0xf'));var authService=require(_0x5f18('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5f18('0x11'));var hardwareService=require(_0x5f18('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x5f18('0x13'));var config=require(_0x5f18('0x14'));var licenseUtil=require(_0x5f18('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19b244,_0x2cc94e){_0x2cc94e=_0x2cc94e||0xcc;return function(_0x332959){if(_0x332959){return _0x19b244[_0x5f18('0x16')](_0x2cc94e);}return _0x19b244[_0x5f18('0x17')](_0x2cc94e)[_0x5f18('0x18')]();};}function respondWithResult(_0x1d0977,_0x31c731){_0x31c731=_0x31c731||0xc8;return function(_0x2533ab){if(_0x2533ab){return _0x1d0977['status'](_0x31c731)[_0x5f18('0x19')](_0x2533ab);}};}function respondWithFilteredResult(_0x51dbc3,_0x4b2d3e){return function(_0x203f1c){if(_0x203f1c){var _0x262531=typeof _0x4b2d3e[_0x5f18('0x1a')]===_0x5f18('0x1b')&&typeof _0x4b2d3e[_0x5f18('0x1c')]==='undefined';var _0x3d61bf=_0x203f1c[_0x5f18('0x1d')];var _0x110916=_0x262531?0x0:_0x4b2d3e[_0x5f18('0x1a')];var _0x1d3aac=_0x262531?_0x203f1c['count']:_0x4b2d3e[_0x5f18('0x1a')]+_0x4b2d3e[_0x5f18('0x1c')];var _0x45d684;if(_0x1d3aac>=_0x3d61bf){_0x1d3aac=_0x3d61bf;_0x45d684=0xc8;}else{_0x45d684=0xce;}_0x51dbc3['status'](_0x45d684);return _0x51dbc3[_0x5f18('0x1e')](_0x5f18('0x1f'),_0x110916+'-'+_0x1d3aac+'/'+_0x3d61bf)['json'](_0x203f1c);}return null;};}function patchUpdates(_0x5f1562){return function(_0x3f493c){try{jsonpatch[_0x5f18('0x20')](_0x3f493c,_0x5f1562,!![]);}catch(_0x1ccd42){return BPromise[_0x5f18('0x21')](_0x1ccd42);}return _0x3f493c[_0x5f18('0x22')]();};}function saveUpdates(_0xd2c89a,_0x569a5b){return function(_0x4c2396){if(_0x4c2396){return _0x4c2396[_0x5f18('0x23')](_0xd2c89a)[_0x5f18('0x24')](function(_0x5e356e){return _0x5e356e;});}return null;};}function removeEntity(_0x29552c,_0x5c37c2){return function(_0x239af2){if(_0x239af2){return _0x239af2['destroy']()['then'](function(){_0x29552c[_0x5f18('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x983e1e,_0x4a2357){return function(_0x394161){if(!_0x394161){_0x983e1e[_0x5f18('0x16')](0x194);}return _0x394161;};}function handleError(_0x34b180,_0x298352){_0x298352=_0x298352||0x1f4;return function(_0x541e70){logger[_0x5f18('0x25')](_0x541e70[_0x5f18('0x26')]);if(_0x541e70[_0x5f18('0x27')]){delete _0x541e70[_0x5f18('0x27')];}_0x34b180[_0x5f18('0x17')](_0x298352)[_0x5f18('0x28')](_0x541e70);};}exports[_0x5f18('0x29')]=function(_0x15f5d8,_0x37e766){var _0x554fac={'raw':!![],'where':{'id':_0x15f5d8['params']['id']}},_0x14a6cc={};_0x14a6cc['model']=_[_0x5f18('0x2a')](db[_0x5f18('0x2b')][_0x5f18('0x2c')]);_0x14a6cc['query']=_['keys'](_0x15f5d8[_0x5f18('0x2d')]);_0x14a6cc[_0x5f18('0x2e')]=_[_0x5f18('0x2f')](_0x14a6cc['model'],_0x14a6cc[_0x5f18('0x2d')]);_0x554fac[_0x5f18('0x30')]=_[_0x5f18('0x2f')](_0x14a6cc['model'],qs[_0x5f18('0x31')](_0x15f5d8[_0x5f18('0x2d')][_0x5f18('0x31')]));_0x554fac[_0x5f18('0x30')]=_0x554fac['attributes'][_0x5f18('0x32')]?_0x554fac['attributes']:_0x14a6cc[_0x5f18('0x33')];if(_0x15f5d8[_0x5f18('0x2d')][_0x5f18('0x34')]){_0x554fac[_0x5f18('0x35')]=[{'all':!![]}];}_0x554fac=_[_0x5f18('0x36')]({},_0x554fac,_0x15f5d8[_0x5f18('0x37')]);return db[_0x5f18('0x2b')][_0x5f18('0x38')](_0x554fac)['then'](handleEntityNotFound(_0x37e766,null))[_0x5f18('0x24')](respondWithResult(_0x37e766,null))['catch'](handleError(_0x37e766,null));};exports[_0x5f18('0x39')]=function(_0x28cfe2,_0x224b45){return db['ChatProactiveAction']['create'](_0x28cfe2[_0x5f18('0x3a')],{})[_0x5f18('0x24')](respondWithResult(_0x224b45,0xc9))[_0x5f18('0x3b')](handleError(_0x224b45,null));};exports[_0x5f18('0x23')]=function(_0xece6e8,_0x2fd94a){if(_0xece6e8['body']['id']){delete _0xece6e8[_0x5f18('0x3a')]['id'];}return db[_0x5f18('0x2b')][_0x5f18('0x38')]({'where':{'id':_0xece6e8['params']['id']}})[_0x5f18('0x24')](handleEntityNotFound(_0x2fd94a,null))['then'](saveUpdates(_0xece6e8['body'],null))[_0x5f18('0x24')](respondWithResult(_0x2fd94a,null))[_0x5f18('0x3b')](handleError(_0x2fd94a,null));};exports['destroy']=function(_0x1bbb69,_0x584a4d){return db[_0x5f18('0x2b')][_0x5f18('0x38')]({'where':{'id':_0x1bbb69[_0x5f18('0x3c')]['id']}})[_0x5f18('0x24')](handleEntityNotFound(_0x584a4d,null))['then'](removeEntity(_0x584a4d,null))[_0x5f18('0x3b')](handleError(_0x584a4d,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index fa0b040..fc6d6eb 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 _0x8bc0=['ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','define'];(function(_0x3ad459,_0x2fb428){var _0x11d0d3=function(_0xb0c9f0){while(--_0xb0c9f0){_0x3ad459['push'](_0x3ad459['shift']());}};_0x11d0d3(++_0x2fb428);}(_0x8bc0,0x12d));var _0x08bc=function(_0x508c0e,_0x511e38){_0x508c0e=_0x508c0e-0x0;var _0x5532a2=_0x8bc0[_0x508c0e];return _0x5532a2;};'use strict';var _=require(_0x08bc('0x0'));var util=require(_0x08bc('0x1'));var logger=require(_0x08bc('0x2'))(_0x08bc('0x3'));var moment=require('moment');var BPromise=require(_0x08bc('0x4'));var rp=require(_0x08bc('0x5'));var fs=require('fs');var path=require(_0x08bc('0x6'));var rimraf=require(_0x08bc('0x7'));var config=require(_0x08bc('0x8'));var attributes=require(_0x08bc('0x9'));module['exports']=function(_0x3b9298,_0x1a9cab){return _0x3b9298[_0x08bc('0xa')](_0x08bc('0xb'),attributes,{'tableName':_0x08bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3d1=['api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','../../config/logger'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xb3d1,0x174));var _0x1b3d=function(_0x3eebec,_0x33de1d){_0x3eebec=_0x3eebec-0x0;var _0x422046=_0xb3d1[_0x3eebec];return _0x422046;};'use strict';var _=require(_0x1b3d('0x0'));var util=require('util');var logger=require(_0x1b3d('0x1'))(_0x1b3d('0x2'));var moment=require(_0x1b3d('0x3'));var BPromise=require(_0x1b3d('0x4'));var rp=require(_0x1b3d('0x5'));var fs=require('fs');var path=require(_0x1b3d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b3d('0x7'));module[_0x1b3d('0x8')]=function(_0x583433,_0x359c08){return _0x583433[_0x1b3d('0x9')](_0x1b3d('0xa'),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 a94e270..10e65a3 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 _0xeee6=['jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xeee6,0x1af));var _0x6eee=function(_0x4487d8,_0x3627d7){_0x4487d8=_0x4487d8-0x0;var _0x5646bd=_0xeee6[_0x4487d8];return _0x5646bd;};'use strict';var _=require('lodash');var util=require(_0x6eee('0x0'));var moment=require(_0x6eee('0x1'));var BPromise=require('bluebird');var rs=require(_0x6eee('0x2'));var fs=require('fs');var Redis=require(_0x6eee('0x3'));var db=require(_0x6eee('0x4'))['db'];var utils=require(_0x6eee('0x5'));var logger=require(_0x6eee('0x6'))(_0x6eee('0x7'));var config=require(_0x6eee('0x8'));var jayson=require(_0x6eee('0x9'));var client=jayson[_0x6eee('0xa')][_0x6eee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x281ed8,_0x3cdc2f,_0x137c2e){return new BPromise(function(_0x4ff82b,_0x437f35){return client['request'](_0x281ed8,_0x137c2e)[_0x6eee('0xc')](function(_0x512465){logger[_0x6eee('0xd')](_0x6eee('0xe'),_0x3cdc2f,_0x6eee('0xf'));logger['debug'](_0x6eee('0x10'),_0x3cdc2f,_0x6eee('0xf'),JSON[_0x6eee('0x11')](_0x512465));if(_0x512465[_0x6eee('0x12')]){if(_0x512465[_0x6eee('0x12')][_0x6eee('0x13')]===0x1f4){logger[_0x6eee('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x3cdc2f,_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);return _0x437f35(_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);}logger['error'](_0x6eee('0xe'),_0x3cdc2f,_0x512465['error'][_0x6eee('0x14')]);return _0x4ff82b(_0x512465[_0x6eee('0x12')][_0x6eee('0x14')]);}else{logger[_0x6eee('0xd')](_0x6eee('0xe'),_0x3cdc2f,_0x6eee('0xf'));_0x4ff82b(_0x512465['result']['message']);}})[_0x6eee('0x15')](function(_0x52b986){logger[_0x6eee('0x12')](_0x6eee('0xe'),_0x3cdc2f,_0x52b986);_0x437f35(_0x52b986);});});} \ No newline at end of file +var _0xf5bf=['http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x3cff3a,_0x2dcc6b){var _0x31d709=function(_0x4471f1){while(--_0x4471f1){_0x3cff3a['push'](_0x3cff3a['shift']());}};_0x31d709(++_0x2dcc6b);}(_0xf5bf,0x1db));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff5b('0x0'));var BPromise=require(_0xff5b('0x1'));var rs=require(_0xff5b('0x2'));var fs=require('fs');var Redis=require(_0xff5b('0x3'));var db=require(_0xff5b('0x4'))['db'];var utils=require(_0xff5b('0x5'));var logger=require('../../config/logger')(_0xff5b('0x6'));var config=require(_0xff5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xff5b('0x8')][_0xff5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x162077,_0x1ff16f,_0x48fce3){return new BPromise(function(_0x13adf4,_0x3529ca){return client[_0xff5b('0xa')](_0x162077,_0x48fce3)[_0xff5b('0xb')](function(_0x5d3d4b){logger[_0xff5b('0xc')](_0xff5b('0xd'),_0x1ff16f,_0xff5b('0xe'));logger[_0xff5b('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x1ff16f,_0xff5b('0xe'),JSON[_0xff5b('0x10')](_0x5d3d4b));if(_0x5d3d4b[_0xff5b('0x11')]){if(_0x5d3d4b[_0xff5b('0x11')][_0xff5b('0x12')]===0x1f4){logger[_0xff5b('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x1ff16f,_0x5d3d4b[_0xff5b('0x11')][_0xff5b('0x13')]);return _0x3529ca(_0x5d3d4b[_0xff5b('0x11')]['message']);}logger[_0xff5b('0x11')](_0xff5b('0xd'),_0x1ff16f,_0x5d3d4b['error'][_0xff5b('0x13')]);return _0x13adf4(_0x5d3d4b['error'][_0xff5b('0x13')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x1ff16f,_0xff5b('0xe'));_0x13adf4(_0x5d3d4b[_0xff5b('0x14')][_0xff5b('0x13')]);}})[_0xff5b('0x15')](function(_0x182272){logger[_0xff5b('0x11')](_0xff5b('0xd'),_0x1ff16f,_0x182272);_0x3529ca(_0x182272);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a367b6f..da67f57 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xa8fb3f,_0x4dd5e3){var _0x556f1f=function(_0x3b530d){while(--_0x3b530d){_0xa8fb3f['push'](_0xa8fb3f['shift']());}};_0x556f1f(++_0x4dd5e3);}(_0x6aa7,0x178));var _0x76aa=function(_0x1c9704,_0x4605aa){_0x1c9704=_0x1c9704-0x0;var _0x4c98d8=_0x6aa7[_0x1c9704];return _0x4c98d8;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x39f76b,_0x562454){var _0x3f2021=function(_0x52901e){while(--_0x52901e){_0x39f76b['push'](_0x39f76b['shift']());}};_0x3f2021(++_0x562454);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x34db21,_0x4256bb){_0x34db21=_0x34db21-0x0;var _0x5e7d82=_0x7fbe[_0x34db21];return _0x5e7d82;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 8b3160d..c104f4e 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 _0xcd4c=['roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0x50f3fd,_0x14930d){var _0x2da233=function(_0x14a594){while(--_0x14a594){_0x50f3fd['push'](_0x50f3fd['shift']());}};_0x2da233(++_0x14930d);}(_0xcd4c,0x141));var _0xccd4=function(_0x20e1f7,_0x59a3ba){_0x20e1f7=_0x20e1f7-0x0;var _0x54f752=_0xcd4c[_0x20e1f7];return _0x54f752;};'use strict';var Sequelize=require(_0xccd4('0x0'));module[_0xccd4('0x1')]={'name':{'type':Sequelize[_0xccd4('0x2')],'unique':_0xccd4('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xccd4('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xccd4('0x4')](_0xccd4('0x5'),_0xccd4('0x6'),_0xccd4('0x7'))}}; \ No newline at end of file +var _0xe01f=['sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x569489,_0x557dda){var _0x94238d=function(_0x161677){while(--_0x161677){_0x569489['push'](_0x569489['shift']());}};_0x94238d(++_0x557dda);}(_0xe01f,0xe0));var _0xfe01=function(_0x5e4545,_0x3c6f51){_0x5e4545=_0x5e4545-0x0;var _0x246665=_0xe01f[_0x5e4545];return _0x246665;};'use strict';var Sequelize=require(_0xfe01('0x0'));module[_0xfe01('0x1')]={'name':{'type':Sequelize[_0xfe01('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfe01('0x2')]},'timeout':{'type':Sequelize[_0xfe01('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfe01('0x4')](_0xfe01('0x5'),_0xfe01('0x6'),_0xfe01('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 87234f1..a47e12c 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 _0xc9f3=['UserChatQueue','hasOwnProperty','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','ids','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','localhost','./chatQueue.socket','register','jayson/promise','client','http','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','update','destroy','get','ChatQueues','UserProfileResource','end','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','keys','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','getMembers','findOne'];(function(_0x39ff33,_0x5eb1fc){var _0x3dc71e=function(_0x5ef5f6){while(--_0x5ef5f6){_0x39ff33['push'](_0x39ff33['shift']());}};_0x3dc71e(++_0x5eb1fc);}(_0xc9f3,0x158));var _0x3c9f=function(_0x8c87c0,_0x240ba0){_0x8c87c0=_0x8c87c0-0x0;var _0xef647=_0xc9f3[_0x8c87c0];return _0xef647;};'use strict';var emlformat=require(_0x3c9f('0x0'));var rimraf=require(_0x3c9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c9f('0x2'));var rp=require(_0x3c9f('0x3'));var moment=require('moment');var BPromise=require(_0x3c9f('0x4'));var Mustache=require(_0x3c9f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x3c9f('0x6'));var csv=require(_0x3c9f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c9f('0x8'));var _=require(_0x3c9f('0x9'));var squel=require(_0x3c9f('0xa'));var crypto=require(_0x3c9f('0xb'));var jsforce=require(_0x3c9f('0xc'));var deskjs=require(_0x3c9f('0xd'));var toCsv=require(_0x3c9f('0x7'));var querystring=require('querystring');var Papa=require(_0x3c9f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c9f('0xf'));var hardwareService=require(_0x3c9f('0x10'));var logger=require(_0x3c9f('0x11'))(_0x3c9f('0x12'));var utils=require(_0x3c9f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x3c9f('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x3c9f('0x15')],{'host':_0x3c9f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c9f('0x15')]));require(_0x3c9f('0x17'))[_0x3c9f('0x18')](socket);var jayson=require(_0x3c9f('0x19'));var client=jayson[_0x3c9f('0x1a')][_0x3c9f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x23eb5c,_0x39f6b6,_0x2c94e2,_0x2ef845){return new BPromise(function(_0x28f1cc,_0x17e0c8){var _0x3596ba=_0x2ef845||client;return _0x3596ba[_0x3c9f('0x1c')](_0x23eb5c,_0x2c94e2)[_0x3c9f('0x1d')](function(_0x44de3c){logger['info'](_0x3c9f('0x1e'),_0x39f6b6,_0x3c9f('0x1f'));logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x39f6b6,_0x3c9f('0x1f'),JSON['stringify'](_0x44de3c));if(_0x44de3c[_0x3c9f('0x20')]){if(_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x21')]===0x1f4){logger[_0x3c9f('0x20')](_0x3c9f('0x1e'),_0x39f6b6,_0x44de3c['error']['message']);return _0x17e0c8(_0x44de3c['error']['message']);}logger[_0x3c9f('0x20')]('ChatQueue,\x20%s,\x20%s',_0x39f6b6,_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x22')]);return _0x28f1cc(_0x44de3c[_0x3c9f('0x20')][_0x3c9f('0x22')]);}else{logger[_0x3c9f('0x23')](_0x3c9f('0x1e'),_0x39f6b6,_0x3c9f('0x1f'));_0x28f1cc(_0x44de3c[_0x3c9f('0x24')][_0x3c9f('0x22')]);}})[_0x3c9f('0x25')](function(_0x17f1b8){logger[_0x3c9f('0x20')](_0x3c9f('0x1e'),_0x39f6b6,_0x17f1b8);_0x17e0c8(_0x17f1b8);});});}function respondWithStatusCode(_0x18b556,_0x246420){_0x246420=_0x246420||0xcc;return function(_0x2a0982){if(_0x2a0982){return _0x18b556[_0x3c9f('0x26')](_0x246420);}return _0x18b556[_0x3c9f('0x27')](_0x246420)['end']();};}function respondWithResult(_0x3d6aba,_0x3ce0c9){_0x3ce0c9=_0x3ce0c9||0xc8;return function(_0x4b856e){if(_0x4b856e){return _0x3d6aba[_0x3c9f('0x27')](_0x3ce0c9)[_0x3c9f('0x28')](_0x4b856e);}};}function respondWithFilteredResult(_0x4a855e,_0x108f22){return function(_0x12ba6c){if(_0x12ba6c){var _0x47bf76=typeof _0x108f22['offset']===_0x3c9f('0x29')&&typeof _0x108f22[_0x3c9f('0x2a')]==='undefined';var _0x5352c1=_0x12ba6c[_0x3c9f('0x2b')];var _0x1ce147=_0x47bf76?0x0:_0x108f22[_0x3c9f('0x2c')];var _0x4b8902=_0x47bf76?_0x12ba6c['count']:_0x108f22[_0x3c9f('0x2c')]+_0x108f22[_0x3c9f('0x2a')];var _0x321465;if(_0x4b8902>=_0x5352c1){_0x4b8902=_0x5352c1;_0x321465=0xc8;}else{_0x321465=0xce;}_0x4a855e['status'](_0x321465);return _0x4a855e['set'](_0x3c9f('0x2d'),_0x1ce147+'-'+_0x4b8902+'/'+_0x5352c1)[_0x3c9f('0x28')](_0x12ba6c);}return null;};}function patchUpdates(_0x42b1be){return function(_0xfa5621){try{jsonpatch['apply'](_0xfa5621,_0x42b1be,!![]);}catch(_0x494d9b){return BPromise[_0x3c9f('0x2e')](_0x494d9b);}return _0xfa5621[_0x3c9f('0x2f')]();};}function saveUpdates(_0x88e9d8,_0x1837e7){return function(_0x59f93f){if(_0x59f93f){return _0x59f93f[_0x3c9f('0x30')](_0x88e9d8)[_0x3c9f('0x1d')](function(_0x36cbcc){return _0x36cbcc;});}return null;};}function removeEntity(_0x27b72c,_0x223cad){return function(_0x442d03){if(_0x442d03){return _0x442d03[_0x3c9f('0x31')]()[_0x3c9f('0x1d')](function(){var _0x386f2d=_0x442d03[_0x3c9f('0x32')]({'plain':!![]});var _0x5e67ef=_0x3c9f('0x33');return db[_0x3c9f('0x34')]['destroy']({'where':{'type':_0x5e67ef,'resourceId':_0x386f2d['id']}})[_0x3c9f('0x1d')](function(){return _0x442d03;});})[_0x3c9f('0x1d')](function(){_0x27b72c[_0x3c9f('0x27')](0xcc)[_0x3c9f('0x35')]();});}};}function handleEntityNotFound(_0x5c870b,_0x481b0c){return function(_0x53a27a){if(!_0x53a27a){_0x5c870b[_0x3c9f('0x26')](0x194);}return _0x53a27a;};}function handleError(_0x407d70,_0x1160d0){_0x1160d0=_0x1160d0||0x1f4;return function(_0x405401){logger[_0x3c9f('0x20')](_0x405401[_0x3c9f('0x36')]);if(_0x405401[_0x3c9f('0x37')]){delete _0x405401['name'];}_0x407d70[_0x3c9f('0x27')](_0x1160d0)[_0x3c9f('0x38')](_0x405401);};}exports[_0x3c9f('0x39')]=function(_0x31d1ff,_0xae639f){var _0x103759={},_0x215caa={},_0x5c0fc1={'count':0x0,'rows':[]};var _0x3c7bb5=_['map'](db[_0x3c9f('0x3a')][_0x3c9f('0x3b')],function(_0x1b033e){return{'name':_0x1b033e[_0x3c9f('0x3c')],'type':_0x1b033e[_0x3c9f('0x3d')]['key']};});_0x215caa['model']=_[_0x3c9f('0x3e')](_0x3c7bb5,'name');_0x215caa[_0x3c9f('0x3f')]=_['keys'](_0x31d1ff[_0x3c9f('0x3f')]);_0x215caa[_0x3c9f('0x40')]=_[_0x3c9f('0x41')](_0x215caa['model'],_0x215caa[_0x3c9f('0x3f')]);_0x103759['attributes']=_['intersection'](_0x215caa[_0x3c9f('0x42')],qs['fields'](_0x31d1ff['query'][_0x3c9f('0x43')]));_0x103759[_0x3c9f('0x44')]=_0x103759['attributes'][_0x3c9f('0x45')]?_0x103759[_0x3c9f('0x44')]:_0x215caa[_0x3c9f('0x42')];if(!_0x31d1ff[_0x3c9f('0x3f')]['hasOwnProperty'](_0x3c9f('0x46'))){_0x103759[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x31d1ff[_0x3c9f('0x3f')]['limit']);_0x103759[_0x3c9f('0x2c')]=qs[_0x3c9f('0x2c')](_0x31d1ff['query'][_0x3c9f('0x2c')]);}_0x103759[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x31d1ff[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x103759[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x31d1ff[_0x3c9f('0x3f')],_0x215caa[_0x3c9f('0x40')]),_0x3c7bb5);if(_0x31d1ff['query']['filter']){_0x103759[_0x3c9f('0x49')]=_[_0x3c9f('0x4b')](_0x103759[_0x3c9f('0x49')],{'$or':_['map'](_0x3c7bb5,function(_0x4b3c8e){if(_0x4b3c8e[_0x3c9f('0x3d')]!==_0x3c9f('0x4c')){var _0x391aaf={};_0x391aaf[_0x4b3c8e[_0x3c9f('0x37')]]={'$like':'%'+_0x31d1ff['query'][_0x3c9f('0x4d')]+'%'};return _0x391aaf;}})});}_0x103759=_[_0x3c9f('0x4b')]({},_0x103759,_0x31d1ff[_0x3c9f('0x4e')]);var _0x9ef9bb={'where':_0x103759[_0x3c9f('0x49')]};return db[_0x3c9f('0x3a')][_0x3c9f('0x2b')](_0x9ef9bb)[_0x3c9f('0x1d')](function(_0x597b56){_0x5c0fc1[_0x3c9f('0x2b')]=_0x597b56;if(_0x31d1ff[_0x3c9f('0x3f')][_0x3c9f('0x4f')]){_0x103759[_0x3c9f('0x50')]=[{'all':!![]}];}return db[_0x3c9f('0x3a')][_0x3c9f('0x51')](_0x103759);})['then'](function(_0x1f2091){_0x5c0fc1['rows']=_0x1f2091;return _0x5c0fc1;})[_0x3c9f('0x1d')](respondWithFilteredResult(_0xae639f,_0x103759))[_0x3c9f('0x25')](handleError(_0xae639f,null));};exports[_0x3c9f('0x52')]=function(_0x1efc68,_0x1eb8e2){var _0xf8c421={'raw':!![],'where':{'id':_0x1efc68[_0x3c9f('0x53')]['id']}},_0x37a96f={};_0x37a96f[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db['ChatQueue']['rawAttributes']);_0x37a96f[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x1efc68[_0x3c9f('0x3f')]);_0x37a96f[_0x3c9f('0x40')]=_[_0x3c9f('0x41')](_0x37a96f[_0x3c9f('0x42')],_0x37a96f[_0x3c9f('0x3f')]);_0xf8c421[_0x3c9f('0x44')]=_[_0x3c9f('0x41')](_0x37a96f[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x1efc68['query']['fields']));_0xf8c421[_0x3c9f('0x44')]=_0xf8c421['attributes'][_0x3c9f('0x45')]?_0xf8c421[_0x3c9f('0x44')]:_0x37a96f['model'];if(_0x1efc68['query'][_0x3c9f('0x4f')]){_0xf8c421[_0x3c9f('0x50')]=[{'all':!![]}];}_0xf8c421=_[_0x3c9f('0x4b')]({},_0xf8c421,_0x1efc68[_0x3c9f('0x4e')]);return db[_0x3c9f('0x3a')][_0x3c9f('0x55')](_0xf8c421)[_0x3c9f('0x1d')](handleEntityNotFound(_0x1eb8e2,null))[_0x3c9f('0x1d')](respondWithResult(_0x1eb8e2,null))['catch'](handleError(_0x1eb8e2,null));};exports[_0x3c9f('0x56')]=function(_0x41918,_0x219c26){return db[_0x3c9f('0x3a')][_0x3c9f('0x56')](_0x41918[_0x3c9f('0x57')],{})[_0x3c9f('0x1d')](function(_0x4c8ddc){var _0x41adae=_0x41918[_0x3c9f('0x58')][_0x3c9f('0x32')]({'plain':!![]});if(!_0x41adae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41adae['role']===_0x3c9f('0x58')){var _0x5c2604=_0x4c8ddc[_0x3c9f('0x32')]({'plain':!![]});var _0x590977=_0x3c9f('0x33');return db[_0x3c9f('0x59')]['find']({'where':{'name':_0x590977,'userProfileId':_0x41adae[_0x3c9f('0x5a')]},'raw':!![]})[_0x3c9f('0x1d')](function(_0x68eb0c){if(_0x68eb0c&&_0x68eb0c[_0x3c9f('0x5b')]===0x0){return db[_0x3c9f('0x34')][_0x3c9f('0x56')]({'name':_0x5c2604['name'],'resourceId':_0x5c2604['id'],'type':_0x68eb0c[_0x3c9f('0x37')],'sectionId':_0x68eb0c['id']},{})['then'](function(){return _0x4c8ddc;});}else{return _0x4c8ddc;}})[_0x3c9f('0x25')](function(_0x1b3038){logger[_0x3c9f('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b3038);throw _0x1b3038;});}return _0x4c8ddc;})[_0x3c9f('0x1d')](respondWithResult(_0x219c26,0xc9))[_0x3c9f('0x25')](handleError(_0x219c26,null));};exports[_0x3c9f('0x30')]=function(_0x50f09e,_0x201345){if(_0x50f09e[_0x3c9f('0x57')]['id']){delete _0x50f09e['body']['id'];}return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x50f09e[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x201345,null))['then'](saveUpdates(_0x50f09e['body'],null))[_0x3c9f('0x1d')](respondWithResult(_0x201345,null))[_0x3c9f('0x25')](handleError(_0x201345,null));};exports[_0x3c9f('0x31')]=function(_0x4588e4,_0x39dfe1){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x4588e4['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x39dfe1,null))[_0x3c9f('0x1d')](removeEntity(_0x39dfe1,null))[_0x3c9f('0x25')](handleError(_0x39dfe1,null));};exports['describe']=function(_0x47225b,_0x21f79c){return db[_0x3c9f('0x3a')]['describe']()[_0x3c9f('0x1d')](respondWithResult(_0x21f79c,null))['catch'](handleError(_0x21f79c,null));};exports[_0x3c9f('0x5c')]=function(_0x5ef576,_0x3960aa,_0x329509){var _0x582c38={'raw':!![],'where':{}},_0x28a87f={},_0x21827e;return db[_0x3c9f('0x3a')][_0x3c9f('0x5d')]({'where':{'id':_0x5ef576[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x3960aa,null))['then'](function(_0x4b5ff0){if(_0x4b5ff0){_0x21827e=_0x4b5ff0['get']({'plain':!![]});_0x28a87f[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db[_0x3c9f('0x5e')][_0x3c9f('0x3b')]);_0x28a87f[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x5ef576[_0x3c9f('0x3f')]);_0x28a87f['filters']=_[_0x3c9f('0x41')](_0x28a87f[_0x3c9f('0x42')],_0x28a87f[_0x3c9f('0x3f')]);_0x582c38[_0x3c9f('0x44')]=_[_0x3c9f('0x41')](_0x28a87f[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x5ef576['query'][_0x3c9f('0x43')]));_0x582c38['attributes']=_0x582c38[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x582c38[_0x3c9f('0x44')]:_0x28a87f[_0x3c9f('0x42')];if(!_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x5f')]('nolimit')){_0x582c38[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x5ef576[_0x3c9f('0x3f')]['limit']);_0x582c38[_0x3c9f('0x2c')]=qs[_0x3c9f('0x2c')](_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x2c')]);}_0x582c38[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x582c38['where']=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x5ef576['query'],_0x28a87f[_0x3c9f('0x40')]));_0x582c38[_0x3c9f('0x49')][_0x3c9f('0x60')]=_0x4b5ff0['id'];if(_0x5ef576[_0x3c9f('0x3f')][_0x3c9f('0x4d')]){_0x582c38[_0x3c9f('0x49')]=_['merge'](_0x582c38[_0x3c9f('0x49')],{'$or':_['map'](_0x582c38[_0x3c9f('0x44')],function(_0x3a6dd7){var _0x3cf780={};_0x3cf780[_0x3a6dd7]={'$like':'%'+_0x5ef576[_0x3c9f('0x3f')]['filter']+'%'};return _0x3cf780;})});}_0x582c38=_[_0x3c9f('0x4b')]({},_0x582c38,_0x5ef576[_0x3c9f('0x4e')]);return db[_0x3c9f('0x5e')][_0x3c9f('0x51')](_0x582c38);}})[_0x3c9f('0x1d')](function(_0xfdd54c){if(_0xfdd54c){return db[_0x3c9f('0x61')][_0x3c9f('0x62')]({'where':{'id':_[_0x3c9f('0x3e')](_0xfdd54c,_0x3c9f('0x63')),'role':_0x3c9f('0x64')},'attributes':['id','name',_0x3c9f('0x65'),_0x3c9f('0x66'),_0x3c9f('0x67')]});}})[_0x3c9f('0x1d')](function(_0x577942){if(_0x577942){return{'count':_0x577942[_0x3c9f('0x2b')],'rows':_[_0x3c9f('0x3e')](_0x577942['rows'],function(_0x2903cd){return{'membername':_0x2903cd[_0x3c9f('0x37')],'UserId':_0x2903cd['id'],'queue_name':_0x21827e['name'],'ChatQueueId':_0x21827e['id'],'interface':util[_0x3c9f('0x68')](_0x3c9f('0x69'),_0x3c9f('0x6a'),_0x2903cd[_0x3c9f('0x37')]),'penalty':0x0,'paused':_0x2903cd['chatPause'],'createdAt':_0x2903cd[_0x3c9f('0x67')],'updatedAt':_0x2903cd['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3c9f('0x1d')](respondWithFilteredResult(_0x3960aa,_0x582c38))[_0x3c9f('0x25')](handleError(_0x3960aa,null));};exports['getTeams']=function(_0x2124ed,_0x5dce3a,_0x44e233){var _0x341e0a={};var _0xe9cb96={};var _0x1451c6;var _0x30840b;return db[_0x3c9f('0x3a')]['findOne']({'where':{'id':_0x2124ed['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x5dce3a,null))[_0x3c9f('0x1d')](function(_0x149259){if(_0x149259){_0x1451c6=_0x149259;_0xe9cb96[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db[_0x3c9f('0x6b')]['rawAttributes']);_0xe9cb96['query']=_['keys'](_0x2124ed[_0x3c9f('0x3f')]);_0xe9cb96[_0x3c9f('0x40')]=_['intersection'](_0xe9cb96[_0x3c9f('0x42')],_0xe9cb96[_0x3c9f('0x3f')]);_0x341e0a[_0x3c9f('0x44')]=_['intersection'](_0xe9cb96['model'],qs[_0x3c9f('0x43')](_0x2124ed[_0x3c9f('0x3f')]['fields']));_0x341e0a[_0x3c9f('0x44')]=_0x341e0a[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x341e0a[_0x3c9f('0x44')]:_0xe9cb96[_0x3c9f('0x42')];_0x341e0a[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x2124ed['query']['sort']);_0x341e0a[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x2124ed[_0x3c9f('0x3f')],_0xe9cb96['filters']));if(_0x2124ed['query'][_0x3c9f('0x4d')]){_0x341e0a['where']=_['merge'](_0x341e0a[_0x3c9f('0x49')],{'$or':_[_0x3c9f('0x3e')](_0x341e0a[_0x3c9f('0x44')],function(_0x16372d){var _0xe22b4={};_0xe22b4[_0x16372d]={'$like':'%'+_0x2124ed[_0x3c9f('0x3f')][_0x3c9f('0x4d')]+'%'};return _0xe22b4;})});}_0x341e0a=_[_0x3c9f('0x4b')]({},_0x341e0a,_0x2124ed[_0x3c9f('0x4e')]);return _0x1451c6[_0x3c9f('0x6c')](_0x341e0a);}})[_0x3c9f('0x1d')](function(_0x31333e){if(_0x31333e){_0x30840b=_0x31333e[_0x3c9f('0x45')];if(!_0x2124ed['query'][_0x3c9f('0x5f')]('nolimit')){_0x341e0a[_0x3c9f('0x2a')]=qs['limit'](_0x2124ed['query'][_0x3c9f('0x2a')]);_0x341e0a[_0x3c9f('0x2c')]=qs['offset'](_0x2124ed[_0x3c9f('0x3f')][_0x3c9f('0x2c')]);}return _0x1451c6['getTeams'](_0x341e0a);}})[_0x3c9f('0x1d')](function(_0x1fa163){if(_0x1fa163){return _0x1fa163?{'count':_0x30840b,'rows':_0x1fa163}:null;}})[_0x3c9f('0x1d')](respondWithResult(_0x5dce3a,null))[_0x3c9f('0x25')](handleError(_0x5dce3a,null));};exports['addTeams']=function(_0x467d41,_0x4d1a1c,_0x4c3f66){var _0x3389f4=_0x467d41[_0x3c9f('0x57')][_0x3c9f('0x6d')];return db[_0x3c9f('0x6b')][_0x3c9f('0x51')]({'where':{'id':_0x3389f4},'attributes':['id'],'include':[{'model':db[_0x3c9f('0x61')],'as':_0x3c9f('0x6e'),'attributes':['id',_0x3c9f('0x37'),'online',_0x3c9f('0x6f'),'interface'],'raw':!![]}]})[_0x3c9f('0x1d')](function(_0x13a1b9){if(_0x13a1b9){var _0x5d5371=_[_0x3c9f('0x70')](_0x13a1b9,function(_0x2c2d7e){var _0x5d756b=_0x2c2d7e[_0x3c9f('0x32')]({'plain':!![]});return _0x5d756b[_0x3c9f('0x6e')];});return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x467d41[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](function(_0x47b96e){return db[_0x3c9f('0x71')][_0x3c9f('0x72')](function(_0x3a2d53){return _0x47b96e[_0x3c9f('0x73')](_0x3389f4,{'transaction':_0x3a2d53})[_0x3c9f('0x1d')](function(){return BPromise[_0x3c9f('0x74')](_0x5d5371,function(_0x16fb75){return db[_0x3c9f('0x5e')]['findOrCreate']({'where':{'UserId':_0x16fb75['id'],'ChatQueueId':_0x467d41['params']['id']},'transaction':_0x3a2d53});});})[_0x3c9f('0x1d')](function(){_0x5d5371[_0x3c9f('0x75')](function(_0xebbd4d){socket[_0x3c9f('0x76')]('userChatQueue:save',{'UserId':_0xebbd4d['id'],'ChatQueueId':_0x47b96e['id']});});});});});}})['then'](respondWithStatusCode(_0x4d1a1c,null))[_0x3c9f('0x25')](handleError(_0x4d1a1c,null));};exports[_0x3c9f('0x77')]=function(_0x567388,_0x4bd5ae,_0x5f42aa){return db['Team'][_0x3c9f('0x51')]({'where':{'id':_0x567388[_0x3c9f('0x3f')][_0x3c9f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x3c9f('0x61')],'as':_0x3c9f('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x3c9f('0x1d')](handleEntityNotFound(_0x4bd5ae,null))['then'](function(_0x7ab62b){var _0x226fed=_[_0x3c9f('0x3e')](_0x7ab62b,'id');var _0x3611f7=[];var _0x14c8dd=[];var _0x298673=squel[_0x3c9f('0x78')]();_0x298673[_0x3c9f('0x79')](_0x3c9f('0x7a'))[_0x3c9f('0x7b')](_0x3c9f('0x7c'),'tq')[_0x3c9f('0x7d')](_0x3c9f('0x7e'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3c9f('0x49')](_0x3c9f('0x7f'),_0x567388[_0x3c9f('0x53')]['id']);for(var _0x2ddb3d=0x0;_0x2ddb3d<_0x7ab62b[_0x3c9f('0x45')];_0x2ddb3d+=0x1){let _0x1b739a=_0x7ab62b[_0x2ddb3d];for(var _0x12a73a=0x0;_0x12a73a<_0x1b739a[_0x3c9f('0x6e')][_0x3c9f('0x45')];_0x12a73a+=0x1){let _0x8c0d90=_0x1b739a['Agents'][_0x12a73a];var _0x49a10d=_0x298673[_0x3c9f('0x80')]();_0x49a10d[_0x3c9f('0x49')]('ut.UserId\x20=\x20?',_0x8c0d90['id']);_0x14c8dd[_0x3c9f('0x81')](db[_0x3c9f('0x71')][_0x3c9f('0x3f')](_0x49a10d[_0x3c9f('0x82')](),{'type':db[_0x3c9f('0x71')][_0x3c9f('0x83')][_0x3c9f('0x84')]})['then'](function(_0x32ff6e){if(_0x32ff6e[_0x3c9f('0x45')]===0x1){return _0x8c0d90['id'];}else{var _0x3535de=_['every'](_['map'](_0x32ff6e,_0x3c9f('0x85')),function(_0x575c8e){return _[_0x3c9f('0x86')](_0x226fed,_0x575c8e);});if(_0x3535de){return _0x8c0d90['id'];}}}));}}return BPromise[_0x3c9f('0x87')](_0x14c8dd)[_0x3c9f('0x1d')](function(_0x30bb93){_0x3611f7=_(_0x3611f7)[_0x3c9f('0x88')](_0x30bb93)[_0x3c9f('0x89')]()[_0x3c9f('0x8a')]();return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x567388[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](function(_0x448451){return db[_0x3c9f('0x71')]['transaction'](function(_0x29b059){return _0x448451[_0x3c9f('0x77')](_0x567388[_0x3c9f('0x3f')][_0x3c9f('0x6d')],{'transaction':_0x29b059})[_0x3c9f('0x1d')](function(){if(!_[_0x3c9f('0x8b')](_0x3611f7)){return _0x448451[_0x3c9f('0x8c')](_0x3611f7,{'transaction':_0x29b059});}})['then'](function(){_0x3611f7['forEach'](function(_0x567c62){socket['emit'](_0x3c9f('0x8d'),{'UserId':_0x567c62,'ChatQueueId':_0x448451['id']});});});});});});})['then'](respondWithStatusCode(_0x4bd5ae,null))[_0x3c9f('0x25')](handleError(_0x4bd5ae,null));};exports[_0x3c9f('0x8e')]=function(_0x394448,_0x3e23a2,_0x57bd0b){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x394448['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x3e23a2,null))[_0x3c9f('0x1d')](function(_0x50944a){if(_0x50944a){return _0x50944a[_0x3c9f('0x8e')](_0x394448['body'][_0x3c9f('0x6d')],_['omit'](_0x394448[_0x3c9f('0x57')],['ids','id'])||{})['spread'](function(_0x5e6780){for(var _0x57453a=0x0;_0x57453a<_0x394448[_0x3c9f('0x57')][_0x3c9f('0x6d')][_0x3c9f('0x45')];_0x57453a+=0x1){socket[_0x3c9f('0x76')](_0x3c9f('0x8f'),{'UserId':Number(_0x394448[_0x3c9f('0x57')][_0x3c9f('0x6d')][_0x57453a]),'ChatQueueId':Number(_0x394448[_0x3c9f('0x53')]['id'])});}return _0x5e6780;});}})['then'](respondWithResult(_0x3e23a2,null))[_0x3c9f('0x25')](handleError(_0x3e23a2,null));};exports[_0x3c9f('0x8c')]=function(_0x13702d,_0x36265f,_0x38ed89){return db[_0x3c9f('0x3a')][_0x3c9f('0x55')]({'where':{'id':_0x13702d['params']['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x36265f,null))[_0x3c9f('0x1d')](function(_0x1135e9){if(_0x1135e9){return _0x1135e9[_0x3c9f('0x8c')](_0x13702d[_0x3c9f('0x3f')][_0x3c9f('0x6d')])[_0x3c9f('0x1d')](function(){if(_[_0x3c9f('0x90')](_0x13702d['query'][_0x3c9f('0x6d')])){for(var _0xec3480=0x0;_0xec3480<_0x13702d[_0x3c9f('0x3f')]['ids'][_0x3c9f('0x45')];_0xec3480+=0x1){socket[_0x3c9f('0x76')](_0x3c9f('0x8d'),{'UserId':Number(_0x13702d['query'][_0x3c9f('0x6d')][_0xec3480]),'ChatQueueId':Number(_0x13702d[_0x3c9f('0x53')]['id'])});}}else{socket[_0x3c9f('0x76')]('userChatQueue:remove',{'UserId':Number(_0x13702d[_0x3c9f('0x3f')]['ids']),'ChatQueueId':Number(_0x13702d[_0x3c9f('0x53')]['id'])});}});}})[_0x3c9f('0x1d')](respondWithStatusCode(_0x36265f,null))[_0x3c9f('0x25')](handleError(_0x36265f,null));};exports[_0x3c9f('0x91')]=function(_0x4bb12e,_0x312197,_0x1c01ec){var _0x54a22e={};var _0x216a8b={};var _0x333447;var _0x3a934c;return db['ChatQueue'][_0x3c9f('0x5d')]({'where':{'id':_0x4bb12e[_0x3c9f('0x53')]['id']}})[_0x3c9f('0x1d')](handleEntityNotFound(_0x312197,null))[_0x3c9f('0x1d')](function(_0x542390){if(_0x542390){_0x333447=_0x542390;_0x216a8b[_0x3c9f('0x42')]=_[_0x3c9f('0x54')](db['User'][_0x3c9f('0x3b')]);_0x216a8b[_0x3c9f('0x3f')]=_[_0x3c9f('0x54')](_0x4bb12e[_0x3c9f('0x3f')]);_0x216a8b[_0x3c9f('0x40')]=_['intersection'](_0x216a8b['model'],_0x216a8b[_0x3c9f('0x3f')]);_0x54a22e[_0x3c9f('0x44')]=_['intersection'](_0x216a8b[_0x3c9f('0x42')],qs[_0x3c9f('0x43')](_0x4bb12e['query'][_0x3c9f('0x43')]));_0x54a22e[_0x3c9f('0x44')]=_0x54a22e[_0x3c9f('0x44')][_0x3c9f('0x45')]?_0x54a22e[_0x3c9f('0x44')]:_0x216a8b[_0x3c9f('0x42')];_0x54a22e[_0x3c9f('0x47')]=qs[_0x3c9f('0x48')](_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x48')]);_0x54a22e[_0x3c9f('0x49')]=qs[_0x3c9f('0x40')](_[_0x3c9f('0x4a')](_0x4bb12e[_0x3c9f('0x3f')],_0x216a8b[_0x3c9f('0x40')]));if(_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x4d')]){_0x54a22e[_0x3c9f('0x49')]=_['merge'](_0x54a22e[_0x3c9f('0x49')],{'$or':_[_0x3c9f('0x3e')](_0x54a22e['attributes'],function(_0xfa853b){var _0x20df35={};_0x20df35[_0xfa853b]={'$like':'%'+_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x4d')]+'%'};return _0x20df35;})});}_0x54a22e=_['merge']({},_0x54a22e,_0x4bb12e[_0x3c9f('0x4e')]);return _0x333447[_0x3c9f('0x91')](_0x54a22e);}})[_0x3c9f('0x1d')](function(_0x4e3e20){if(_0x4e3e20){_0x3a934c=_0x4e3e20['length'];if(!_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x5f')]('nolimit')){_0x54a22e[_0x3c9f('0x2a')]=qs[_0x3c9f('0x2a')](_0x4bb12e[_0x3c9f('0x3f')][_0x3c9f('0x2a')]);_0x54a22e[_0x3c9f('0x2c')]=qs['offset'](_0x4bb12e[_0x3c9f('0x3f')]['offset']);}return _0x333447[_0x3c9f('0x91')](_0x54a22e);}})[_0x3c9f('0x1d')](function(_0x4b7475){if(_0x4b7475){return _0x4b7475?{'count':_0x3a934c,'rows':_0x4b7475}:null;}})[_0x3c9f('0x1d')](respondWithResult(_0x312197,null))[_0x3c9f('0x25')](handleError(_0x312197,null));}; \ No newline at end of file +var _0x737f=['mustache','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','destroy','get','UserProfileResource','end','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','find','autoAssociation','update','params','describe','getMembers','UserChatQueue','order','pick','ChatQueueId','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','ids','online','voicePause','interface','Agents','sequelize','transaction','addTeams','each','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','omit','userChatQueue:save','getAgents','zip-dir','fast-json-patch','request-promise'];(function(_0x2bf835,_0x1f8013){var _0x3f3568=function(_0x36018c){while(--_0x36018c){_0x2bf835['push'](_0x2bf835['shift']());}};_0x3f3568(++_0x1f8013);}(_0x737f,0x90));var _0xf737=function(_0x4a0995,_0x7f28e2){_0x4a0995=_0x4a0995-0x0;var _0x2e7d17=_0x737f[_0x4a0995];return _0x2e7d17;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf737('0x0'));var jsonpatch=require(_0xf737('0x1'));var rp=require(_0xf737('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf737('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf737('0x4'));var csv=require(_0xf737('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf737('0x6'));var _=require(_0xf737('0x7'));var squel=require('squel');var crypto=require(_0xf737('0x8'));var jsforce=require(_0xf737('0x9'));var deskjs=require(_0xf737('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf737('0xb'));var Papa=require(_0xf737('0xc'));var Redis=require(_0xf737('0xd'));var authService=require(_0xf737('0xe'));var qs=require(_0xf737('0xf'));var as=require(_0xf737('0x10'));var hardwareService=require(_0xf737('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf737('0x12'));var config=require(_0xf737('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf737('0x14'))['db'];config[_0xf737('0x15')]=_[_0xf737('0x16')](config[_0xf737('0x15')],{'host':_0xf737('0x17'),'port':0x18eb});var socket=require(_0xf737('0x18'))(new Redis(config[_0xf737('0x15')]));require(_0xf737('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xf737('0x1a')][_0xf737('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x48fe98,_0x145b29,_0x2e0f62,_0x2e1b2d){return new BPromise(function(_0x4b8829,_0xc98dfb){var _0x2cb566=_0x2e1b2d||client;return _0x2cb566[_0xf737('0x1c')](_0x48fe98,_0x2e0f62)[_0xf737('0x1d')](function(_0x305e03){logger[_0xf737('0x1e')](_0xf737('0x1f'),_0x145b29,_0xf737('0x20'));logger[_0xf737('0x21')](_0xf737('0x22'),_0x145b29,_0xf737('0x20'),JSON['stringify'](_0x305e03));if(_0x305e03['error']){if(_0x305e03[_0xf737('0x23')][_0xf737('0x24')]===0x1f4){logger[_0xf737('0x23')](_0xf737('0x1f'),_0x145b29,_0x305e03[_0xf737('0x23')][_0xf737('0x25')]);return _0xc98dfb(_0x305e03['error'][_0xf737('0x25')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x145b29,_0x305e03[_0xf737('0x23')][_0xf737('0x25')]);return _0x4b8829(_0x305e03[_0xf737('0x23')][_0xf737('0x25')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x145b29,_0xf737('0x20'));_0x4b8829(_0x305e03[_0xf737('0x26')]['message']);}})[_0xf737('0x27')](function(_0xf12b6e){logger[_0xf737('0x23')](_0xf737('0x1f'),_0x145b29,_0xf12b6e);_0xc98dfb(_0xf12b6e);});});}function respondWithStatusCode(_0x1d8af6,_0x5ecf46){_0x5ecf46=_0x5ecf46||0xcc;return function(_0x2b1779){if(_0x2b1779){return _0x1d8af6[_0xf737('0x28')](_0x5ecf46);}return _0x1d8af6[_0xf737('0x29')](_0x5ecf46)['end']();};}function respondWithResult(_0x30c7d7,_0x1aca34){_0x1aca34=_0x1aca34||0xc8;return function(_0x29b054){if(_0x29b054){return _0x30c7d7[_0xf737('0x29')](_0x1aca34)[_0xf737('0x2a')](_0x29b054);}};}function respondWithFilteredResult(_0xcbe06d,_0x3b4dee){return function(_0x2880b8){if(_0x2880b8){var _0x13d619=typeof _0x3b4dee[_0xf737('0x2b')]===_0xf737('0x2c')&&typeof _0x3b4dee['limit']===_0xf737('0x2c');var _0xf5cc9e=_0x2880b8['count'];var _0x58e212=_0x13d619?0x0:_0x3b4dee[_0xf737('0x2b')];var _0xe36a19=_0x13d619?_0x2880b8[_0xf737('0x2d')]:_0x3b4dee[_0xf737('0x2b')]+_0x3b4dee['limit'];var _0x3a5d5c;if(_0xe36a19>=_0xf5cc9e){_0xe36a19=_0xf5cc9e;_0x3a5d5c=0xc8;}else{_0x3a5d5c=0xce;}_0xcbe06d[_0xf737('0x29')](_0x3a5d5c);return _0xcbe06d[_0xf737('0x2e')](_0xf737('0x2f'),_0x58e212+'-'+_0xe36a19+'/'+_0xf5cc9e)[_0xf737('0x2a')](_0x2880b8);}return null;};}function patchUpdates(_0x2052f0){return function(_0x23e2f0){try{jsonpatch['apply'](_0x23e2f0,_0x2052f0,!![]);}catch(_0x195ca4){return BPromise[_0xf737('0x30')](_0x195ca4);}return _0x23e2f0[_0xf737('0x31')]();};}function saveUpdates(_0x143bb6,_0xe69f54){return function(_0x29fb2c){if(_0x29fb2c){return _0x29fb2c['update'](_0x143bb6)[_0xf737('0x1d')](function(_0x14b266){return _0x14b266;});}return null;};}function removeEntity(_0x3f6410,_0x4f40a2){return function(_0x30b1bb){if(_0x30b1bb){return _0x30b1bb[_0xf737('0x32')]()[_0xf737('0x1d')](function(){var _0xdf66aa=_0x30b1bb[_0xf737('0x33')]({'plain':!![]});var _0xc47522='ChatQueues';return db[_0xf737('0x34')][_0xf737('0x32')]({'where':{'type':_0xc47522,'resourceId':_0xdf66aa['id']}})[_0xf737('0x1d')](function(){return _0x30b1bb;});})[_0xf737('0x1d')](function(){_0x3f6410[_0xf737('0x29')](0xcc)[_0xf737('0x35')]();});}};}function handleEntityNotFound(_0x1d76d7,_0x461e44){return function(_0x57e733){if(!_0x57e733){_0x1d76d7['sendStatus'](0x194);}return _0x57e733;};}function handleError(_0x12c81c,_0xf2a3cc){_0xf2a3cc=_0xf2a3cc||0x1f4;return function(_0x1066c9){logger[_0xf737('0x23')](_0x1066c9[_0xf737('0x36')]);if(_0x1066c9[_0xf737('0x37')]){delete _0x1066c9[_0xf737('0x37')];}_0x12c81c['status'](_0xf2a3cc)['send'](_0x1066c9);};}exports[_0xf737('0x38')]=function(_0x1a6373,_0x167176){var _0x1d2b1e={},_0x1a4edf={},_0x3ccc46={'count':0x0,'rows':[]};var _0xdb850d=_[_0xf737('0x39')](db[_0xf737('0x3a')][_0xf737('0x3b')],function(_0x481fd1){return{'name':_0x481fd1[_0xf737('0x3c')],'type':_0x481fd1[_0xf737('0x3d')][_0xf737('0x3e')]};});_0x1a4edf['model']=_['map'](_0xdb850d,_0xf737('0x37'));_0x1a4edf[_0xf737('0x3f')]=_[_0xf737('0x40')](_0x1a6373[_0xf737('0x3f')]);_0x1a4edf[_0xf737('0x41')]=_[_0xf737('0x42')](_0x1a4edf[_0xf737('0x43')],_0x1a4edf[_0xf737('0x3f')]);_0x1d2b1e['attributes']=_[_0xf737('0x42')](_0x1a4edf['model'],qs[_0xf737('0x44')](_0x1a6373[_0xf737('0x3f')][_0xf737('0x44')]));_0x1d2b1e[_0xf737('0x45')]=_0x1d2b1e[_0xf737('0x45')][_0xf737('0x46')]?_0x1d2b1e[_0xf737('0x45')]:_0x1a4edf['model'];if(!_0x1a6373['query'][_0xf737('0x47')](_0xf737('0x48'))){_0x1d2b1e[_0xf737('0x49')]=qs['limit'](_0x1a6373[_0xf737('0x3f')][_0xf737('0x49')]);_0x1d2b1e[_0xf737('0x2b')]=qs[_0xf737('0x2b')](_0x1a6373[_0xf737('0x3f')][_0xf737('0x2b')]);}_0x1d2b1e['order']=qs[_0xf737('0x4a')](_0x1a6373['query']['sort']);_0x1d2b1e[_0xf737('0x4b')]=qs[_0xf737('0x41')](_['pick'](_0x1a6373[_0xf737('0x3f')],_0x1a4edf['filters']),_0xdb850d);if(_0x1a6373[_0xf737('0x3f')]['filter']){_0x1d2b1e[_0xf737('0x4b')]=_[_0xf737('0x4c')](_0x1d2b1e[_0xf737('0x4b')],{'$or':_[_0xf737('0x39')](_0xdb850d,function(_0x11af80){if(_0x11af80['type']!==_0xf737('0x4d')){var _0x1a25ee={};_0x1a25ee[_0x11af80[_0xf737('0x37')]]={'$like':'%'+_0x1a6373[_0xf737('0x3f')][_0xf737('0x4e')]+'%'};return _0x1a25ee;}})});}_0x1d2b1e=_[_0xf737('0x4c')]({},_0x1d2b1e,_0x1a6373[_0xf737('0x4f')]);var _0x229c5c={'where':_0x1d2b1e[_0xf737('0x4b')]};return db[_0xf737('0x3a')][_0xf737('0x2d')](_0x229c5c)[_0xf737('0x1d')](function(_0x4f2128){_0x3ccc46[_0xf737('0x2d')]=_0x4f2128;if(_0x1a6373[_0xf737('0x3f')][_0xf737('0x50')]){_0x1d2b1e[_0xf737('0x51')]=[{'all':!![]}];}return db['ChatQueue'][_0xf737('0x52')](_0x1d2b1e);})['then'](function(_0x53dc24){_0x3ccc46[_0xf737('0x53')]=_0x53dc24;return _0x3ccc46;})['then'](respondWithFilteredResult(_0x167176,_0x1d2b1e))['catch'](handleError(_0x167176,null));};exports['show']=function(_0x8d6338,_0x32552c){var _0x130543={'raw':!![],'where':{'id':_0x8d6338['params']['id']}},_0x782cd8={};_0x782cd8[_0xf737('0x43')]=_[_0xf737('0x40')](db[_0xf737('0x3a')]['rawAttributes']);_0x782cd8['query']=_[_0xf737('0x40')](_0x8d6338[_0xf737('0x3f')]);_0x782cd8['filters']=_[_0xf737('0x42')](_0x782cd8['model'],_0x782cd8[_0xf737('0x3f')]);_0x130543[_0xf737('0x45')]=_[_0xf737('0x42')](_0x782cd8[_0xf737('0x43')],qs['fields'](_0x8d6338[_0xf737('0x3f')][_0xf737('0x44')]));_0x130543[_0xf737('0x45')]=_0x130543[_0xf737('0x45')][_0xf737('0x46')]?_0x130543[_0xf737('0x45')]:_0x782cd8[_0xf737('0x43')];if(_0x8d6338[_0xf737('0x3f')][_0xf737('0x50')]){_0x130543[_0xf737('0x51')]=[{'all':!![]}];}_0x130543=_[_0xf737('0x4c')]({},_0x130543,_0x8d6338[_0xf737('0x4f')]);return db['ChatQueue']['find'](_0x130543)[_0xf737('0x1d')](handleEntityNotFound(_0x32552c,null))['then'](respondWithResult(_0x32552c,null))['catch'](handleError(_0x32552c,null));};exports[_0xf737('0x54')]=function(_0x457763,_0x300e92){return db[_0xf737('0x3a')][_0xf737('0x54')](_0x457763[_0xf737('0x55')],{})[_0xf737('0x1d')](function(_0x22f2d5){var _0x2aea67=_0x457763[_0xf737('0x56')]['get']({'plain':!![]});if(!_0x2aea67)throw new Error(_0xf737('0x57'));if(_0x2aea67[_0xf737('0x58')]===_0xf737('0x56')){var _0x291339=_0x22f2d5[_0xf737('0x33')]({'plain':!![]});var _0x542ad0=_0xf737('0x59');return db[_0xf737('0x5a')][_0xf737('0x5b')]({'where':{'name':_0x542ad0,'userProfileId':_0x2aea67['userProfileId']},'raw':!![]})['then'](function(_0x290b3a){if(_0x290b3a&&_0x290b3a[_0xf737('0x5c')]===0x0){return db[_0xf737('0x34')][_0xf737('0x54')]({'name':_0x291339[_0xf737('0x37')],'resourceId':_0x291339['id'],'type':_0x290b3a[_0xf737('0x37')],'sectionId':_0x290b3a['id']},{})['then'](function(){return _0x22f2d5;});}else{return _0x22f2d5;}})[_0xf737('0x27')](function(_0x2c283c){logger[_0xf737('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c283c);throw _0x2c283c;});}return _0x22f2d5;})['then'](respondWithResult(_0x300e92,0xc9))[_0xf737('0x27')](handleError(_0x300e92,null));};exports[_0xf737('0x5d')]=function(_0x54580a,_0x37d125){if(_0x54580a['body']['id']){delete _0x54580a[_0xf737('0x55')]['id'];}return db[_0xf737('0x3a')][_0xf737('0x5b')]({'where':{'id':_0x54580a[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](handleEntityNotFound(_0x37d125,null))[_0xf737('0x1d')](saveUpdates(_0x54580a[_0xf737('0x55')],null))[_0xf737('0x1d')](respondWithResult(_0x37d125,null))[_0xf737('0x27')](handleError(_0x37d125,null));};exports[_0xf737('0x32')]=function(_0x2732c5,_0x2e225c){return db[_0xf737('0x3a')][_0xf737('0x5b')]({'where':{'id':_0x2732c5['params']['id']}})['then'](handleEntityNotFound(_0x2e225c,null))[_0xf737('0x1d')](removeEntity(_0x2e225c,null))[_0xf737('0x27')](handleError(_0x2e225c,null));};exports['describe']=function(_0x1554a2,_0x297041){return db[_0xf737('0x3a')][_0xf737('0x5f')]()[_0xf737('0x1d')](respondWithResult(_0x297041,null))['catch'](handleError(_0x297041,null));};exports[_0xf737('0x60')]=function(_0x26be48,_0x631ebd,_0xea822e){var _0x278f10={'raw':!![],'where':{}},_0x531ba6={},_0x2db37f;return db[_0xf737('0x3a')]['findOne']({'where':{'id':_0x26be48['params']['id']}})[_0xf737('0x1d')](handleEntityNotFound(_0x631ebd,null))[_0xf737('0x1d')](function(_0x59da70){if(_0x59da70){_0x2db37f=_0x59da70['get']({'plain':!![]});_0x531ba6[_0xf737('0x43')]=_[_0xf737('0x40')](db[_0xf737('0x61')][_0xf737('0x3b')]);_0x531ba6['query']=_[_0xf737('0x40')](_0x26be48[_0xf737('0x3f')]);_0x531ba6[_0xf737('0x41')]=_[_0xf737('0x42')](_0x531ba6[_0xf737('0x43')],_0x531ba6[_0xf737('0x3f')]);_0x278f10[_0xf737('0x45')]=_['intersection'](_0x531ba6[_0xf737('0x43')],qs[_0xf737('0x44')](_0x26be48[_0xf737('0x3f')][_0xf737('0x44')]));_0x278f10[_0xf737('0x45')]=_0x278f10['attributes'][_0xf737('0x46')]?_0x278f10[_0xf737('0x45')]:_0x531ba6[_0xf737('0x43')];if(!_0x26be48['query']['hasOwnProperty']('nolimit')){_0x278f10[_0xf737('0x49')]=qs[_0xf737('0x49')](_0x26be48[_0xf737('0x3f')][_0xf737('0x49')]);_0x278f10[_0xf737('0x2b')]=qs[_0xf737('0x2b')](_0x26be48['query'][_0xf737('0x2b')]);}_0x278f10[_0xf737('0x62')]=qs[_0xf737('0x4a')](_0x26be48[_0xf737('0x3f')][_0xf737('0x4a')]);_0x278f10['where']=qs[_0xf737('0x41')](_[_0xf737('0x63')](_0x26be48[_0xf737('0x3f')],_0x531ba6['filters']));_0x278f10[_0xf737('0x4b')][_0xf737('0x64')]=_0x59da70['id'];if(_0x26be48['query'][_0xf737('0x4e')]){_0x278f10[_0xf737('0x4b')]=_[_0xf737('0x4c')](_0x278f10[_0xf737('0x4b')],{'$or':_['map'](_0x278f10['attributes'],function(_0x50ab5){var _0xbc4c94={};_0xbc4c94[_0x50ab5]={'$like':'%'+_0x26be48[_0xf737('0x3f')][_0xf737('0x4e')]+'%'};return _0xbc4c94;})});}_0x278f10=_[_0xf737('0x4c')]({},_0x278f10,_0x26be48[_0xf737('0x4f')]);return db[_0xf737('0x61')]['findAll'](_0x278f10);}})[_0xf737('0x1d')](function(_0x480d61){if(_0x480d61){return db[_0xf737('0x65')][_0xf737('0x66')]({'where':{'id':_[_0xf737('0x39')](_0x480d61,_0xf737('0x67')),'role':_0xf737('0x68')},'attributes':['id',_0xf737('0x37'),_0xf737('0x69'),_0xf737('0x6a'),_0xf737('0x6b')]});}})[_0xf737('0x1d')](function(_0xc491b4){if(_0xc491b4){return{'count':_0xc491b4['count'],'rows':_[_0xf737('0x39')](_0xc491b4['rows'],function(_0x258c30){return{'membername':_0x258c30['name'],'UserId':_0x258c30['id'],'queue_name':_0x2db37f[_0xf737('0x37')],'ChatQueueId':_0x2db37f['id'],'interface':util[_0xf737('0x6c')](_0xf737('0x6d'),_0xf737('0x6e'),_0x258c30[_0xf737('0x37')]),'penalty':0x0,'paused':_0x258c30[_0xf737('0x69')],'createdAt':_0x258c30[_0xf737('0x6b')],'updatedAt':_0x258c30[_0xf737('0x6a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf737('0x1d')](respondWithFilteredResult(_0x631ebd,_0x278f10))[_0xf737('0x27')](handleError(_0x631ebd,null));};exports[_0xf737('0x6f')]=function(_0x599904,_0x412305,_0x1c92eb){var _0x4b6289={};var _0x50f137={};var _0x1b2572;var _0x2a3396;return db[_0xf737('0x3a')][_0xf737('0x70')]({'where':{'id':_0x599904[_0xf737('0x5e')]['id']}})['then'](handleEntityNotFound(_0x412305,null))[_0xf737('0x1d')](function(_0x5ceac5){if(_0x5ceac5){_0x1b2572=_0x5ceac5;_0x50f137[_0xf737('0x43')]=_[_0xf737('0x40')](db[_0xf737('0x71')][_0xf737('0x3b')]);_0x50f137['query']=_['keys'](_0x599904[_0xf737('0x3f')]);_0x50f137[_0xf737('0x41')]=_[_0xf737('0x42')](_0x50f137[_0xf737('0x43')],_0x50f137[_0xf737('0x3f')]);_0x4b6289[_0xf737('0x45')]=_[_0xf737('0x42')](_0x50f137[_0xf737('0x43')],qs['fields'](_0x599904[_0xf737('0x3f')]['fields']));_0x4b6289[_0xf737('0x45')]=_0x4b6289[_0xf737('0x45')][_0xf737('0x46')]?_0x4b6289[_0xf737('0x45')]:_0x50f137[_0xf737('0x43')];_0x4b6289[_0xf737('0x62')]=qs[_0xf737('0x4a')](_0x599904[_0xf737('0x3f')]['sort']);_0x4b6289[_0xf737('0x4b')]=qs[_0xf737('0x41')](_['pick'](_0x599904[_0xf737('0x3f')],_0x50f137[_0xf737('0x41')]));if(_0x599904['query']['filter']){_0x4b6289[_0xf737('0x4b')]=_[_0xf737('0x4c')](_0x4b6289[_0xf737('0x4b')],{'$or':_[_0xf737('0x39')](_0x4b6289[_0xf737('0x45')],function(_0x450064){var _0x23cbfd={};_0x23cbfd[_0x450064]={'$like':'%'+_0x599904[_0xf737('0x3f')][_0xf737('0x4e')]+'%'};return _0x23cbfd;})});}_0x4b6289=_[_0xf737('0x4c')]({},_0x4b6289,_0x599904[_0xf737('0x4f')]);return _0x1b2572[_0xf737('0x6f')](_0x4b6289);}})['then'](function(_0x45b304){if(_0x45b304){_0x2a3396=_0x45b304[_0xf737('0x46')];if(!_0x599904[_0xf737('0x3f')][_0xf737('0x47')]('nolimit')){_0x4b6289[_0xf737('0x49')]=qs[_0xf737('0x49')](_0x599904['query'][_0xf737('0x49')]);_0x4b6289['offset']=qs[_0xf737('0x2b')](_0x599904['query'][_0xf737('0x2b')]);}return _0x1b2572[_0xf737('0x6f')](_0x4b6289);}})[_0xf737('0x1d')](function(_0x46b52d){if(_0x46b52d){return _0x46b52d?{'count':_0x2a3396,'rows':_0x46b52d}:null;}})[_0xf737('0x1d')](respondWithResult(_0x412305,null))['catch'](handleError(_0x412305,null));};exports['addTeams']=function(_0x22b7da,_0x2c3e45,_0x544fda){var _0x5472b2=_0x22b7da[_0xf737('0x55')][_0xf737('0x72')];return db[_0xf737('0x71')][_0xf737('0x52')]({'where':{'id':_0x5472b2},'attributes':['id'],'include':[{'model':db[_0xf737('0x65')],'as':'Agents','attributes':['id','name',_0xf737('0x73'),_0xf737('0x74'),_0xf737('0x75')],'raw':!![]}]})[_0xf737('0x1d')](function(_0x2a585b){if(_0x2a585b){var _0x5e4608=_['flatMap'](_0x2a585b,function(_0x162444){var _0x3bafdd=_0x162444[_0xf737('0x33')]({'plain':!![]});return _0x3bafdd[_0xf737('0x76')];});return db['ChatQueue'][_0xf737('0x5b')]({'where':{'id':_0x22b7da[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](function(_0x3702d8){return db[_0xf737('0x77')][_0xf737('0x78')](function(_0x2ff5aa){return _0x3702d8[_0xf737('0x79')](_0x5472b2,{'transaction':_0x2ff5aa})[_0xf737('0x1d')](function(){return BPromise[_0xf737('0x7a')](_0x5e4608,function(_0xfe3b98){return db[_0xf737('0x61')]['findOrCreate']({'where':{'UserId':_0xfe3b98['id'],'ChatQueueId':_0x22b7da[_0xf737('0x5e')]['id']},'transaction':_0x2ff5aa});});})['then'](function(){_0x5e4608['forEach'](function(_0x4f0a9f){socket[_0xf737('0x7b')]('userChatQueue:save',{'UserId':_0x4f0a9f['id'],'ChatQueueId':_0x3702d8['id']});});});});});}})[_0xf737('0x1d')](respondWithStatusCode(_0x2c3e45,null))['catch'](handleError(_0x2c3e45,null));};exports[_0xf737('0x7c')]=function(_0x387009,_0x56c192,_0x3092c8){return db['Team'][_0xf737('0x52')]({'where':{'id':_0x387009['query'][_0xf737('0x72')]},'attributes':['id'],'include':[{'model':db[_0xf737('0x65')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf737('0x1d')](handleEntityNotFound(_0x56c192,null))[_0xf737('0x1d')](function(_0x38a741){var _0x3c1351=_[_0xf737('0x39')](_0x38a741,'id');var _0x5b2d25=[];var _0x567809=[];var _0xd174d1=squel['select']();_0xd174d1[_0xf737('0x7d')](_0xf737('0x7e'))[_0xf737('0x7f')](_0xf737('0x80'),'tq')[_0xf737('0x81')](_0xf737('0x82'),'ut',_0xf737('0x83'))['where'](_0xf737('0x84'),_0x387009[_0xf737('0x5e')]['id']);for(var _0x490345=0x0;_0x490345<_0x38a741['length'];_0x490345+=0x1){let _0x28c596=_0x38a741[_0x490345];for(var _0xedaf02=0x0;_0xedaf02<_0x28c596[_0xf737('0x76')][_0xf737('0x46')];_0xedaf02+=0x1){let _0x2e5095=_0x28c596[_0xf737('0x76')][_0xedaf02];var _0x177c49=_0xd174d1['clone']();_0x177c49[_0xf737('0x4b')](_0xf737('0x85'),_0x2e5095['id']);_0x567809['push'](db[_0xf737('0x77')]['query'](_0x177c49['toString'](),{'type':db['sequelize'][_0xf737('0x86')][_0xf737('0x87')]})['then'](function(_0x3f50a5){if(_0x3f50a5['length']===0x1){return _0x2e5095['id'];}else{var _0x4248b7=_[_0xf737('0x88')](_[_0xf737('0x39')](_0x3f50a5,'TeamId'),function(_0xea68fa){return _[_0xf737('0x89')](_0x3c1351,_0xea68fa);});if(_0x4248b7){return _0x2e5095['id'];}}}));}}return BPromise['all'](_0x567809)[_0xf737('0x1d')](function(_0x56a647){_0x5b2d25=_(_0x5b2d25)['union'](_0x56a647)['compact']()[_0xf737('0x8a')]();return db['ChatQueue'][_0xf737('0x5b')]({'where':{'id':_0x387009[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](function(_0x570c8a){return db[_0xf737('0x77')][_0xf737('0x78')](function(_0x1a17c2){return _0x570c8a[_0xf737('0x7c')](_0x387009[_0xf737('0x3f')][_0xf737('0x72')],{'transaction':_0x1a17c2})[_0xf737('0x1d')](function(){if(!_[_0xf737('0x8b')](_0x5b2d25)){return _0x570c8a[_0xf737('0x8c')](_0x5b2d25,{'transaction':_0x1a17c2});}})['then'](function(){_0x5b2d25[_0xf737('0x8d')](function(_0x2179e1){socket[_0xf737('0x7b')](_0xf737('0x8e'),{'UserId':_0x2179e1,'ChatQueueId':_0x570c8a['id']});});});});});});})['then'](respondWithStatusCode(_0x56c192,null))['catch'](handleError(_0x56c192,null));};exports[_0xf737('0x8f')]=function(_0xc30ab,_0x268327,_0x1b3902){return db[_0xf737('0x3a')][_0xf737('0x5b')]({'where':{'id':_0xc30ab[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](handleEntityNotFound(_0x268327,null))[_0xf737('0x1d')](function(_0x476780){if(_0x476780){return _0x476780[_0xf737('0x8f')](_0xc30ab[_0xf737('0x55')]['ids'],_[_0xf737('0x90')](_0xc30ab[_0xf737('0x55')],[_0xf737('0x72'),'id'])||{})['spread'](function(_0x3973b7){for(var _0x1c766d=0x0;_0x1c766d<_0xc30ab[_0xf737('0x55')][_0xf737('0x72')][_0xf737('0x46')];_0x1c766d+=0x1){socket['emit'](_0xf737('0x91'),{'UserId':Number(_0xc30ab[_0xf737('0x55')][_0xf737('0x72')][_0x1c766d]),'ChatQueueId':Number(_0xc30ab[_0xf737('0x5e')]['id'])});}return _0x3973b7;});}})[_0xf737('0x1d')](respondWithResult(_0x268327,null))[_0xf737('0x27')](handleError(_0x268327,null));};exports[_0xf737('0x8c')]=function(_0x2302cc,_0x246b1c,_0x3c7660){return db[_0xf737('0x3a')]['find']({'where':{'id':_0x2302cc[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](handleEntityNotFound(_0x246b1c,null))[_0xf737('0x1d')](function(_0x80bf44){if(_0x80bf44){return _0x80bf44[_0xf737('0x8c')](_0x2302cc[_0xf737('0x3f')][_0xf737('0x72')])['then'](function(){if(_['isArray'](_0x2302cc[_0xf737('0x3f')][_0xf737('0x72')])){for(var _0x3450a5=0x0;_0x3450a5<_0x2302cc[_0xf737('0x3f')]['ids'][_0xf737('0x46')];_0x3450a5+=0x1){socket[_0xf737('0x7b')]('userChatQueue:remove',{'UserId':Number(_0x2302cc[_0xf737('0x3f')][_0xf737('0x72')][_0x3450a5]),'ChatQueueId':Number(_0x2302cc['params']['id'])});}}else{socket[_0xf737('0x7b')](_0xf737('0x8e'),{'UserId':Number(_0x2302cc[_0xf737('0x3f')][_0xf737('0x72')]),'ChatQueueId':Number(_0x2302cc[_0xf737('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x246b1c,null))[_0xf737('0x27')](handleError(_0x246b1c,null));};exports[_0xf737('0x92')]=function(_0x244f1c,_0xb7136a,_0x7f550b){var _0x391996={};var _0x227d15={};var _0x4c62c5;var _0x416b82;return db[_0xf737('0x3a')][_0xf737('0x70')]({'where':{'id':_0x244f1c[_0xf737('0x5e')]['id']}})[_0xf737('0x1d')](handleEntityNotFound(_0xb7136a,null))['then'](function(_0x476441){if(_0x476441){_0x4c62c5=_0x476441;_0x227d15[_0xf737('0x43')]=_[_0xf737('0x40')](db[_0xf737('0x65')][_0xf737('0x3b')]);_0x227d15[_0xf737('0x3f')]=_[_0xf737('0x40')](_0x244f1c['query']);_0x227d15[_0xf737('0x41')]=_[_0xf737('0x42')](_0x227d15[_0xf737('0x43')],_0x227d15['query']);_0x391996[_0xf737('0x45')]=_['intersection'](_0x227d15[_0xf737('0x43')],qs[_0xf737('0x44')](_0x244f1c['query'][_0xf737('0x44')]));_0x391996[_0xf737('0x45')]=_0x391996[_0xf737('0x45')][_0xf737('0x46')]?_0x391996[_0xf737('0x45')]:_0x227d15[_0xf737('0x43')];_0x391996['order']=qs[_0xf737('0x4a')](_0x244f1c[_0xf737('0x3f')][_0xf737('0x4a')]);_0x391996[_0xf737('0x4b')]=qs[_0xf737('0x41')](_[_0xf737('0x63')](_0x244f1c[_0xf737('0x3f')],_0x227d15['filters']));if(_0x244f1c[_0xf737('0x3f')]['filter']){_0x391996[_0xf737('0x4b')]=_[_0xf737('0x4c')](_0x391996[_0xf737('0x4b')],{'$or':_['map'](_0x391996[_0xf737('0x45')],function(_0x16b470){var _0x3976a9={};_0x3976a9[_0x16b470]={'$like':'%'+_0x244f1c[_0xf737('0x3f')][_0xf737('0x4e')]+'%'};return _0x3976a9;})});}_0x391996=_[_0xf737('0x4c')]({},_0x391996,_0x244f1c['options']);return _0x4c62c5[_0xf737('0x92')](_0x391996);}})[_0xf737('0x1d')](function(_0x57ee7b){if(_0x57ee7b){_0x416b82=_0x57ee7b['length'];if(!_0x244f1c[_0xf737('0x3f')][_0xf737('0x47')](_0xf737('0x48'))){_0x391996[_0xf737('0x49')]=qs[_0xf737('0x49')](_0x244f1c[_0xf737('0x3f')][_0xf737('0x49')]);_0x391996[_0xf737('0x2b')]=qs[_0xf737('0x2b')](_0x244f1c[_0xf737('0x3f')][_0xf737('0x2b')]);}return _0x4c62c5[_0xf737('0x92')](_0x391996);}})['then'](function(_0x477f22){if(_0x477f22){return _0x477f22?{'count':_0x416b82,'rows':_0x477f22}:null;}})[_0xf737('0x1d')](respondWithResult(_0xb7136a,null))['catch'](handleError(_0xb7136a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index a11b009..ea1fd3b 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 _0x5395=['events','ChatQueue','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3ce0f3,_0x3974c7){var _0x23e65e=function(_0x2238b4){while(--_0x2238b4){_0x3ce0f3['push'](_0x3ce0f3['shift']());}};_0x23e65e(++_0x3974c7);}(_0x5395,0x150));var _0x5539=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5395[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require(_0x5539('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x5539('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5539('0x2'),'afterDestroy':_0x5539('0x3')};function emitEvent(_0x2d24c7){return function(_0x4cd571,_0x2b6f8b,_0x453ad5){ChatQueueEvents[_0x5539('0x4')](_0x2d24c7+':'+_0x4cd571['id'],_0x4cd571);ChatQueueEvents[_0x5539('0x4')](_0x2d24c7,_0x4cd571);_0x453ad5(null);};}for(var e in events){if(events[_0x5539('0x5')](e)){var event=events[e];ChatQueue[_0x5539('0x6')](e,emitEvent(event));}}module[_0x5539('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xad2c=['exports','../../mysqldb','ChatQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4b6847,_0x50c4d6){var _0x562863=function(_0x51fb51){while(--_0x51fb51){_0x4b6847['push'](_0x4b6847['shift']());}};_0x562863(++_0x50c4d6);}(_0xad2c,0x1c3));var _0xcad2=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xad2c[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xcad2('0x0'))['db'][_0xcad2('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcad2('0x2'),'afterUpdate':_0xcad2('0x3'),'afterDestroy':_0xcad2('0x4')};function emitEvent(_0x48269e){return function(_0x4cdb54,_0x1d63d9,_0x15a54f){ChatQueueEvents[_0xcad2('0x5')](_0x48269e+':'+_0x4cdb54['id'],_0x4cdb54);ChatQueueEvents[_0xcad2('0x5')](_0x48269e,_0x4cdb54);_0x15a54f(null);};}for(var e in events){if(events[_0xcad2('0x6')](e)){var event=events[e];ChatQueue[_0xcad2('0x7')](e,emitEvent(event));}}module[_0xcad2('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 3af8996..baec2e9 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 _0x35ba=['ChatQueue','chat_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x4d3475,_0x1cea7d){var _0xb8eab=function(_0x2fc76c){while(--_0x2fc76c){_0x4d3475['push'](_0x4d3475['shift']());}};_0xb8eab(++_0x1cea7d);}(_0x35ba,0x1c9));var _0xa35b=function(_0x3126b6,_0x450061){_0x3126b6=_0x3126b6-0x0;var _0x116531=_0x35ba[_0x3126b6];return _0x116531;};'use strict';var _=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var logger=require(_0xa35b('0x2'))(_0xa35b('0x3'));var moment=require(_0xa35b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa35b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa35b('0x6'));var config=require(_0xa35b('0x7'));var attributes=require(_0xa35b('0x8'));module[_0xa35b('0x9')]=function(_0x16584e,_0x3ce36b){return _0x16584e[_0xa35b('0xa')](_0xa35b('0xb'),attributes,{'tableName':_0xa35b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ad0=['rimraf','./chatQueue.attributes','exports','ChatQueue','chat_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x45ea9e,_0x260383){var _0x2ad573=function(_0x4bb2ba){while(--_0x4bb2ba){_0x45ea9e['push'](_0x45ea9e['shift']());}};_0x2ad573(++_0x260383);}(_0x8ad0,0xd7));var _0x08ad=function(_0x2de597,_0x24cc77){_0x2de597=_0x2de597-0x0;var _0x5ec891=_0x8ad0[_0x2de597];return _0x5ec891;};'use strict';var _=require('lodash');var util=require(_0x08ad('0x0'));var logger=require(_0x08ad('0x1'))(_0x08ad('0x2'));var moment=require(_0x08ad('0x3'));var BPromise=require(_0x08ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08ad('0x5'));var config=require('../../config/environment');var attributes=require(_0x08ad('0x6'));module[_0x08ad('0x7')]=function(_0x1c8a40,_0x1757fa){return _0x1c8a40['define'](_0x08ad('0x8'),attributes,{'tableName':_0x08ad('0x9'),'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 1d6d548..499c70d 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 _0xa149=['model','then','stringify','ShowChatQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','request\x20sent','debug','error','ChatQueue,\x20%s,\x20%s','message','info','result','GetChatQueue','findAll','options','raw','where','attributes','include','map'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xa149,0x18c));var _0x9a14=function(_0x5da35a,_0x1e2cdf){_0x5da35a=_0x5da35a-0x0;var _0x4ec963=_0xa149[_0x5da35a];return _0x4ec963;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var moment=require(_0x9a14('0x2'));var BPromise=require(_0x9a14('0x3'));var rs=require(_0x9a14('0x4'));var fs=require('fs');var Redis=require(_0x9a14('0x5'));var db=require(_0x9a14('0x6'))['db'];var utils=require(_0x9a14('0x7'));var logger=require(_0x9a14('0x8'))('rpc');var config=require(_0x9a14('0x9'));var jayson=require(_0x9a14('0xa'));var client=jayson['client'][_0x9a14('0xb')]({'port':0x232a});config[_0x9a14('0xc')]=_[_0x9a14('0xd')](config[_0x9a14('0xc')],{'host':_0x9a14('0xe'),'port':0x18eb});var socket=require(_0x9a14('0xf'))(new Redis(config['redis']));require(_0x9a14('0x10'))['register'](socket);function respondWithRpcPromise(_0x3d0481,_0x25afa7,_0x36c9ed){return new BPromise(function(_0x33bb89,_0x4155e5){return client[_0x9a14('0x11')](_0x3d0481,_0x36c9ed)['then'](function(_0x5d4ed8){logger['info']('ChatQueue,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'));logger[_0x9a14('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x25afa7,_0x9a14('0x12'),JSON['stringify'](_0x5d4ed8));if(_0x5d4ed8[_0x9a14('0x14')]){if(_0x5d4ed8['error']['code']===0x1f4){logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x4155e5(_0x5d4ed8['error'][_0x9a14('0x16')]);}logger[_0x9a14('0x14')](_0x9a14('0x15'),_0x25afa7,_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);return _0x33bb89(_0x5d4ed8[_0x9a14('0x14')][_0x9a14('0x16')]);}else{logger[_0x9a14('0x17')](_0x9a14('0x15'),_0x25afa7,_0x9a14('0x12'));_0x33bb89(_0x5d4ed8[_0x9a14('0x18')]['message']);}})['catch'](function(_0x589822){logger[_0x9a14('0x14')]('ChatQueue,\x20%s,\x20%s',_0x25afa7,_0x589822);_0x4155e5(_0x589822);});});}exports[_0x9a14('0x19')]=function(_0x40ac4c){var _0x4e0c5f=this;return new Promise(function(_0x5bb00c,_0x53e151){return db['ChatQueue'][_0x9a14('0x1a')]({'raw':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1c')]===undefined?!![]:![]:!![],'where':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1d')]||null:null,'attributes':_0x40ac4c['options']?_0x40ac4c['options'][_0x9a14('0x1e')]||null:null,'limit':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')]['limit']||null:null,'include':_0x40ac4c[_0x9a14('0x1b')]?_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x40ac4c[_0x9a14('0x1b')][_0x9a14('0x1f')],function(_0x1ba34f){return{'model':db[_0x1ba34f[_0x9a14('0x21')]],'as':_0x1ba34f['as'],'attributes':_0x1ba34f['attributes'],'include':_0x1ba34f['include']?_[_0x9a14('0x20')](_0x1ba34f[_0x9a14('0x1f')],function(_0x3e20b5){return{'model':db[_0x3e20b5['model']],'as':_0x3e20b5['as'],'attributes':_0x3e20b5['attributes'],'include':_0x3e20b5[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x3e20b5[_0x9a14('0x1f')],function(_0x44a589){return{'model':db[_0x44a589[_0x9a14('0x21')]],'as':_0x44a589['as'],'attributes':_0x44a589['attributes']};}):[]};}):[]};}):[]:[]})[_0x9a14('0x22')](function(_0x4e171b){logger['info'](_0x9a14('0x19'),_0x40ac4c);logger[_0x9a14('0x13')]('GetChatQueue',_0x40ac4c,JSON[_0x9a14('0x23')](_0x4e171b));_0x5bb00c(_0x4e171b);})['catch'](function(_0x3930af){logger[_0x9a14('0x14')](_0x9a14('0x19'),_0x3930af[_0x9a14('0x16')],_0x40ac4c);_0x53e151(_0x4e0c5f[_0x9a14('0x14')](0x1f4,_0x3930af[_0x9a14('0x16')]));});});};exports[_0x9a14('0x24')]=function(_0x1d7a59){var _0x303758=this;return new Promise(function(_0x51dc13,_0x485251){return db['ChatQueue'][_0x9a14('0x25')]({'raw':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1c')]===undefined?!![]:![]:!![],'where':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1d')]||null:null,'attributes':_0x1d7a59['options']?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1e')]||null:null,'include':_0x1d7a59[_0x9a14('0x1b')]?_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1f')]?_['map'](_0x1d7a59[_0x9a14('0x1b')][_0x9a14('0x1f')],function(_0x4eb8a0){return{'model':db[_0x4eb8a0[_0x9a14('0x21')]],'as':_0x4eb8a0['as'],'attributes':_0x4eb8a0['attributes'],'include':_0x4eb8a0[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x4eb8a0[_0x9a14('0x1f')],function(_0x2901c1){return{'model':db[_0x2901c1[_0x9a14('0x21')]],'as':_0x2901c1['as'],'attributes':_0x2901c1[_0x9a14('0x1e')],'include':_0x2901c1[_0x9a14('0x1f')]?_[_0x9a14('0x20')](_0x2901c1[_0x9a14('0x1f')],function(_0x527c5c){return{'model':db[_0x527c5c['model']],'as':_0x527c5c['as'],'attributes':_0x527c5c[_0x9a14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9a14('0x22')](function(_0x4c611a){logger[_0x9a14('0x17')](_0x9a14('0x24'),_0x1d7a59);logger['debug'](_0x9a14('0x24'),_0x1d7a59,JSON['stringify'](_0x4c611a));_0x51dc13(_0x4c611a);})[_0x9a14('0x26')](function(_0x1b3ff6){logger['error'](_0x9a14('0x24'),_0x1b3ff6[_0x9a14('0x16')],_0x1d7a59);_0x485251(_0x303758[_0x9a14('0x14')](0x1f4,_0x1b3ff6[_0x9a14('0x16')]));});});}; \ No newline at end of file +var _0x4f7a=['ShowChatQueue','debug','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','info','catch'];(function(_0x3f4dd9,_0xe0b819){var _0x31c54a=function(_0x25e6c6){while(--_0x25e6c6){_0x3f4dd9['push'](_0x3f4dd9['shift']());}};_0x31c54a(++_0xe0b819);}(_0x4f7a,0x105));var _0xa4f7=function(_0x30be9f,_0x4766e6){_0x30be9f=_0x30be9f-0x0;var _0x32f086=_0x4f7a[_0x30be9f];return _0x32f086;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa4f7('0x0'));var BPromise=require(_0xa4f7('0x1'));var rs=require(_0xa4f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa4f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4f7('0x4'))(_0xa4f7('0x5'));var config=require(_0xa4f7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa4f7('0x7')][_0xa4f7('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa4f7('0x9')],{'host':_0xa4f7('0xa'),'port':0x18eb});var socket=require(_0xa4f7('0xb'))(new Redis(config[_0xa4f7('0x9')]));require(_0xa4f7('0xc'))['register'](socket);function respondWithRpcPromise(_0x390174,_0x2f1c78,_0x39ba56){return new BPromise(function(_0x404403,_0x1f23b9){return client[_0xa4f7('0xd')](_0x390174,_0x39ba56)[_0xa4f7('0xe')](function(_0x5ed421){logger['info'](_0xa4f7('0xf'),_0x2f1c78,_0xa4f7('0x10'));logger['debug'](_0xa4f7('0x11'),_0x2f1c78,_0xa4f7('0x10'),JSON[_0xa4f7('0x12')](_0x5ed421));if(_0x5ed421['error']){if(_0x5ed421[_0xa4f7('0x13')][_0xa4f7('0x14')]===0x1f4){logger[_0xa4f7('0x13')]('ChatQueue,\x20%s,\x20%s',_0x2f1c78,_0x5ed421[_0xa4f7('0x13')][_0xa4f7('0x15')]);return _0x1f23b9(_0x5ed421[_0xa4f7('0x13')][_0xa4f7('0x15')]);}logger['error'](_0xa4f7('0xf'),_0x2f1c78,_0x5ed421[_0xa4f7('0x13')]['message']);return _0x404403(_0x5ed421['error'][_0xa4f7('0x15')]);}else{logger['info'](_0xa4f7('0xf'),_0x2f1c78,_0xa4f7('0x10'));_0x404403(_0x5ed421['result'][_0xa4f7('0x15')]);}})['catch'](function(_0x143dac){logger[_0xa4f7('0x13')](_0xa4f7('0xf'),_0x2f1c78,_0x143dac);_0x1f23b9(_0x143dac);});});}exports[_0xa4f7('0x16')]=function(_0x181911){var _0x44a54c=this;return new Promise(function(_0x48ec43,_0x18bb7a){return db[_0xa4f7('0x17')][_0xa4f7('0x18')]({'raw':_0x181911[_0xa4f7('0x19')]?_0x181911['options'][_0xa4f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x181911[_0xa4f7('0x19')]?_0x181911[_0xa4f7('0x19')][_0xa4f7('0x1b')]||null:null,'attributes':_0x181911[_0xa4f7('0x19')]?_0x181911[_0xa4f7('0x19')][_0xa4f7('0x1c')]||null:null,'limit':_0x181911[_0xa4f7('0x19')]?_0x181911[_0xa4f7('0x19')][_0xa4f7('0x1d')]||null:null,'include':_0x181911[_0xa4f7('0x19')]?_0x181911[_0xa4f7('0x19')]['include']?_[_0xa4f7('0x1e')](_0x181911[_0xa4f7('0x19')][_0xa4f7('0x1f')],function(_0x2b56fe){return{'model':db[_0x2b56fe[_0xa4f7('0x20')]],'as':_0x2b56fe['as'],'attributes':_0x2b56fe['attributes'],'include':_0x2b56fe['include']?_['map'](_0x2b56fe[_0xa4f7('0x1f')],function(_0x4e6c36){return{'model':db[_0x4e6c36[_0xa4f7('0x20')]],'as':_0x4e6c36['as'],'attributes':_0x4e6c36[_0xa4f7('0x1c')],'include':_0x4e6c36[_0xa4f7('0x1f')]?_['map'](_0x4e6c36[_0xa4f7('0x1f')],function(_0x5366dc){return{'model':db[_0x5366dc[_0xa4f7('0x20')]],'as':_0x5366dc['as'],'attributes':_0x5366dc['attributes']};}):[]};}):[]};}):[]:[]})[_0xa4f7('0xe')](function(_0x1009d2){logger[_0xa4f7('0x21')](_0xa4f7('0x16'),_0x181911);logger['debug'](_0xa4f7('0x16'),_0x181911,JSON[_0xa4f7('0x12')](_0x1009d2));_0x48ec43(_0x1009d2);})[_0xa4f7('0x22')](function(_0x3e4d19){logger[_0xa4f7('0x13')]('GetChatQueue',_0x3e4d19[_0xa4f7('0x15')],_0x181911);_0x18bb7a(_0x44a54c[_0xa4f7('0x13')](0x1f4,_0x3e4d19['message']));});});};exports[_0xa4f7('0x23')]=function(_0x106c07){var _0x195943=this;return new Promise(function(_0x52f8d2,_0xe955a6){return db[_0xa4f7('0x17')]['find']({'raw':_0x106c07['options']?_0x106c07[_0xa4f7('0x19')][_0xa4f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x106c07[_0xa4f7('0x19')]?_0x106c07['options'][_0xa4f7('0x1b')]||null:null,'attributes':_0x106c07[_0xa4f7('0x19')]?_0x106c07[_0xa4f7('0x19')][_0xa4f7('0x1c')]||null:null,'include':_0x106c07[_0xa4f7('0x19')]?_0x106c07[_0xa4f7('0x19')][_0xa4f7('0x1f')]?_[_0xa4f7('0x1e')](_0x106c07[_0xa4f7('0x19')]['include'],function(_0x2cdb5d){return{'model':db[_0x2cdb5d[_0xa4f7('0x20')]],'as':_0x2cdb5d['as'],'attributes':_0x2cdb5d[_0xa4f7('0x1c')],'include':_0x2cdb5d[_0xa4f7('0x1f')]?_[_0xa4f7('0x1e')](_0x2cdb5d[_0xa4f7('0x1f')],function(_0x3f01fa){return{'model':db[_0x3f01fa[_0xa4f7('0x20')]],'as':_0x3f01fa['as'],'attributes':_0x3f01fa['attributes'],'include':_0x3f01fa[_0xa4f7('0x1f')]?_[_0xa4f7('0x1e')](_0x3f01fa['include'],function(_0x5ee074){return{'model':db[_0x5ee074[_0xa4f7('0x20')]],'as':_0x5ee074['as'],'attributes':_0x5ee074[_0xa4f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa4f7('0xe')](function(_0x57db76){logger[_0xa4f7('0x21')](_0xa4f7('0x23'),_0x106c07);logger[_0xa4f7('0x24')](_0xa4f7('0x23'),_0x106c07,JSON['stringify'](_0x57db76));_0x52f8d2(_0x57db76);})[_0xa4f7('0x22')](function(_0x32a25a){logger[_0xa4f7('0x13')](_0xa4f7('0x23'),_0x32a25a[_0xa4f7('0x15')],_0x106c07);_0xe955a6(_0x195943[_0xa4f7('0x13')](0x1f4,_0x32a25a[_0xa4f7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 29e7396..45ca5c3 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 _0xd0bb=['chatQueue:','./chatQueue.events','save','remove','emit','register','length'];(function(_0x17b239,_0x50aa45){var _0x57eee2=function(_0x155fd4){while(--_0x155fd4){_0x17b239['push'](_0x17b239['shift']());}};_0x57eee2(++_0x50aa45);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0xb4411,_0x5d04ac){_0xb4411=_0xb4411-0x0;var _0x481db4=_0xd0bb[_0xb4411];return _0x481db4;};'use strict';var ChatQueueEvents=require(_0xbd0b('0x0'));var events=[_0xbd0b('0x1'),_0xbd0b('0x2'),'update'];function createListener(_0x68ea36,_0x4ab08f){return function(_0x39b03a){_0x4ab08f[_0xbd0b('0x3')](_0x68ea36,_0x39b03a);};}function removeListener(_0x53e6ce,_0x432acf){return function(){ChatQueueEvents['removeListener'](_0x53e6ce,_0x432acf);};}exports[_0xbd0b('0x4')]=function(_0x1b2499){for(var _0x158b5c=0x0,_0x37c205=events[_0xbd0b('0x5')];_0x158b5c<_0x37c205;_0x158b5c++){var _0x5eb975=events[_0x158b5c];var _0x2a4075=createListener(_0xbd0b('0x6')+_0x5eb975,_0x1b2499);ChatQueueEvents['on'](_0x5eb975,_0x2a4075);}}; \ No newline at end of file +var _0x826a=['update','emit','removeListener','register','length','chatQueue:','save'];(function(_0x2c3038,_0x265d12){var _0x2ea5a5=function(_0xc34019){while(--_0xc34019){_0x2c3038['push'](_0x2c3038['shift']());}};_0x2ea5a5(++_0x265d12);}(_0x826a,0x1aa));var _0xa826=function(_0x9cfba3,_0x5e8c9a){_0x9cfba3=_0x9cfba3-0x0;var _0x2779c6=_0x826a[_0x9cfba3];return _0x2779c6;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xa826('0x0'),'remove',_0xa826('0x1')];function createListener(_0x50c70e,_0x376d53){return function(_0x19ba11){_0x376d53[_0xa826('0x2')](_0x50c70e,_0x19ba11);};}function removeListener(_0x34e1ad,_0x5372ab){return function(){ChatQueueEvents[_0xa826('0x3')](_0x34e1ad,_0x5372ab);};}exports[_0xa826('0x4')]=function(_0x3929d4){for(var _0x34327b=0x0,_0x45154f=events[_0xa826('0x5')];_0x34327b<_0x45154f;_0x34327b++){var _0x4339f9=events[_0x34327b];var _0x14c2ba=createListener(_0xa826('0x6')+_0x4339f9,_0x3929d4);ChatQueueEvents['on'](_0x4339f9,_0x14c2ba);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 82371d9..574d033 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(_0x1b9f3b,_0x416c12){var _0x5c73b9=function(_0x591ea4){while(--_0x591ea4){_0x1b9f3b['push'](_0x1b9f3b['shift']());}};_0x5c73b9(++_0x416c12);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/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 _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3881ed,_0x28a04c){var _0x417a98=function(_0x5a3eb7){while(--_0x5a3eb7){_0x3881ed['push'](_0x3881ed['shift']());}};_0x417a98(++_0x28a04c);}(_0x008c,0x188));var _0xc008=function(_0x5dbaa7,_0x1f6d4a){_0x5dbaa7=_0x5dbaa7-0x0;var _0x481319=_0x008c[_0x5dbaa7];return _0x481319;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d0fd80b..36855c1 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 _0x94b9=['DATE','moment','exports','STRING'];(function(_0x25d18c,_0xab06b9){var _0x471e3e=function(_0xaf7502){while(--_0xaf7502){_0x25d18c['push'](_0x25d18c['shift']());}};_0x471e3e(++_0xab06b9);}(_0x94b9,0x1ad));var _0x994b=function(_0x20cdc3,_0x4055a7){_0x20cdc3=_0x20cdc3-0x0;var _0x47d456=_0x94b9[_0x20cdc3];return _0x47d456;};'use strict';var moment=require(_0x994b('0x0'));var Sequelize=require('sequelize');module[_0x994b('0x1')]={'uniqueid':{'type':Sequelize[_0x994b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x994b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x994b('0x3')]},'acceptAt':{'type':Sequelize[_0x994b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x994b('0x2')]}}; \ No newline at end of file +var _0x3fea=['moment','sequelize','STRING','DATE'];(function(_0x1767f5,_0x7108f9){var _0x3ba9fa=function(_0x39bd91){while(--_0x39bd91){_0x1767f5['push'](_0x1767f5['shift']());}};_0x3ba9fa(++_0x7108f9);}(_0x3fea,0x1bc));var _0xa3fe=function(_0x1b9b0f,_0x6ad045){_0x1b9b0f=_0x1b9b0f-0x0;var _0x158075=_0x3fea[_0x1b9b0f];return _0x158075;};'use strict';var moment=require(_0xa3fe('0x0'));var Sequelize=require(_0xa3fe('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa3fe('0x2')]},'joinAt':{'type':Sequelize[_0xa3fe('0x3')]},'leaveAt':{'type':Sequelize[_0xa3fe('0x3')]},'acceptAt':{'type':Sequelize[_0xa3fe('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 8302824..8bed3de 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 _0xfc9b=['undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0xfc9b,0x74));var _0xbfc9=function(_0x34e160,_0x387076){_0x34e160=_0x34e160-0x0;var _0x2eb767=_0xfc9b[_0x34e160];return _0x2eb767;};'use strict';var emlformat=require(_0xbfc9('0x0'));var rimraf=require(_0xbfc9('0x1'));var zipdir=require(_0xbfc9('0x2'));var jsonpatch=require(_0xbfc9('0x3'));var rp=require(_0xbfc9('0x4'));var moment=require(_0xbfc9('0x5'));var BPromise=require(_0xbfc9('0x6'));var Mustache=require('mustache');var util=require(_0xbfc9('0x7'));var path=require('path');var sox=require(_0xbfc9('0x8'));var csv=require(_0xbfc9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbfc9('0xa'));var _=require(_0xbfc9('0xb'));var squel=require(_0xbfc9('0xc'));var crypto=require(_0xbfc9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xbfc9('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfc9('0xf'));var Papa=require('papaparse');var Redis=require(_0xbfc9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbfc9('0x11'));var as=require(_0xbfc9('0x12'));var hardwareService=require(_0xbfc9('0x13'));var logger=require(_0xbfc9('0x14'))(_0xbfc9('0x15'));var utils=require(_0xbfc9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbfc9('0x17'));var db=require(_0xbfc9('0x18'))['db'];function respondWithStatusCode(_0x57f46c,_0x364b14){_0x364b14=_0x364b14||0xcc;return function(_0x51783e){if(_0x51783e){return _0x57f46c[_0xbfc9('0x19')](_0x364b14);}return _0x57f46c[_0xbfc9('0x1a')](_0x364b14)[_0xbfc9('0x1b')]();};}function respondWithResult(_0x2a5c78,_0x59b8b8){_0x59b8b8=_0x59b8b8||0xc8;return function(_0x3fbad7){if(_0x3fbad7){return _0x2a5c78[_0xbfc9('0x1a')](_0x59b8b8)[_0xbfc9('0x1c')](_0x3fbad7);}};}function respondWithFilteredResult(_0x30c34e,_0x44d984){return function(_0x16a0fc){if(_0x16a0fc){var _0x2bc807=typeof _0x44d984[_0xbfc9('0x1d')]===_0xbfc9('0x1e')&&typeof _0x44d984[_0xbfc9('0x1f')]===_0xbfc9('0x1e');var _0x1b6218=_0x16a0fc[_0xbfc9('0x20')];var _0x21e216=_0x2bc807?0x0:_0x44d984[_0xbfc9('0x1d')];var _0x345e7a=_0x2bc807?_0x16a0fc[_0xbfc9('0x20')]:_0x44d984[_0xbfc9('0x1d')]+_0x44d984[_0xbfc9('0x1f')];var _0x130eba;if(_0x345e7a>=_0x1b6218){_0x345e7a=_0x1b6218;_0x130eba=0xc8;}else{_0x130eba=0xce;}_0x30c34e[_0xbfc9('0x1a')](_0x130eba);return _0x30c34e[_0xbfc9('0x21')]('Content-Range',_0x21e216+'-'+_0x345e7a+'/'+_0x1b6218)[_0xbfc9('0x1c')](_0x16a0fc);}return null;};}function patchUpdates(_0x1217f4){return function(_0x237897){try{jsonpatch[_0xbfc9('0x22')](_0x237897,_0x1217f4,!![]);}catch(_0x2df6b9){return BPromise[_0xbfc9('0x23')](_0x2df6b9);}return _0x237897[_0xbfc9('0x24')]();};}function saveUpdates(_0x3f1603,_0x2e6e5b){return function(_0x3f6c00){if(_0x3f6c00){return _0x3f6c00[_0xbfc9('0x25')](_0x3f1603)[_0xbfc9('0x26')](function(_0x39bc58){return _0x39bc58;});}return null;};}function removeEntity(_0x7012e0,_0x5a3420){return function(_0x1f365f){if(_0x1f365f){return _0x1f365f[_0xbfc9('0x27')]()[_0xbfc9('0x26')](function(){_0x7012e0[_0xbfc9('0x1a')](0xcc)[_0xbfc9('0x1b')]();});}};}function handleEntityNotFound(_0x4ab0ec,_0x4498ed){return function(_0xa64699){if(!_0xa64699){_0x4ab0ec[_0xbfc9('0x19')](0x194);}return _0xa64699;};}function handleError(_0x278d07,_0x1fb58c){_0x1fb58c=_0x1fb58c||0x1f4;return function(_0xfa504){logger[_0xbfc9('0x28')](_0xfa504[_0xbfc9('0x29')]);if(_0xfa504[_0xbfc9('0x2a')]){delete _0xfa504['name'];}_0x278d07['status'](_0x1fb58c)['send'](_0xfa504);};}exports[_0xbfc9('0x2b')]=function(_0x4dd2da,_0x58401b){var _0x123261={},_0x2aa754={},_0xfa1abc={'count':0x0,'rows':[]};var _0x14e1ac=_[_0xbfc9('0x2c')](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')],function(_0x224645){return{'name':_0x224645[_0xbfc9('0x2f')],'type':_0x224645['type'][_0xbfc9('0x30')]};});_0x2aa754[_0xbfc9('0x31')]=_[_0xbfc9('0x2c')](_0x14e1ac,'name');_0x2aa754[_0xbfc9('0x32')]=_[_0xbfc9('0x33')](_0x4dd2da[_0xbfc9('0x32')]);_0x2aa754[_0xbfc9('0x34')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],_0x2aa754[_0xbfc9('0x32')]);_0x123261[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x2aa754[_0xbfc9('0x31')],qs['fields'](_0x4dd2da['query'][_0xbfc9('0x37')]));_0x123261[_0xbfc9('0x36')]=_0x123261[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x123261[_0xbfc9('0x36')]:_0x2aa754[_0xbfc9('0x31')];if(!_0x4dd2da['query'][_0xbfc9('0x39')]('nolimit')){_0x123261['limit']=qs[_0xbfc9('0x1f')](_0x4dd2da['query'][_0xbfc9('0x1f')]);_0x123261[_0xbfc9('0x1d')]=qs[_0xbfc9('0x1d')](_0x4dd2da['query'][_0xbfc9('0x1d')]);}_0x123261['order']=qs['sort'](_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3a')]);_0x123261['where']=qs[_0xbfc9('0x34')](_['pick'](_0x4dd2da['query'],_0x2aa754[_0xbfc9('0x34')]),_0x14e1ac);if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3b')]){_0x123261[_0xbfc9('0x3c')]=_[_0xbfc9('0x3d')](_0x123261[_0xbfc9('0x3c')],{'$or':_[_0xbfc9('0x2c')](_0x14e1ac,function(_0x32d787){if(_0x32d787['type']!==_0xbfc9('0x3e')){var _0x3756d9={};_0x3756d9[_0x32d787['name']]={'$like':'%'+_0x4dd2da['query'][_0xbfc9('0x3b')]+'%'};return _0x3756d9;}})});}_0x123261=_[_0xbfc9('0x3d')]({},_0x123261,_0x4dd2da['options']);var _0xbecdeb={'where':_0x123261[_0xbfc9('0x3c')]};return db[_0xbfc9('0x2d')][_0xbfc9('0x20')](_0xbecdeb)[_0xbfc9('0x26')](function(_0x3d473c){_0xfa1abc[_0xbfc9('0x20')]=_0x3d473c;if(_0x4dd2da[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x123261[_0xbfc9('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xbfc9('0x41')](_0x123261);})['then'](function(_0x5c8479){_0xfa1abc[_0xbfc9('0x42')]=_0x5c8479;return _0xfa1abc;})[_0xbfc9('0x26')](respondWithFilteredResult(_0x58401b,_0x123261))['catch'](handleError(_0x58401b,null));};exports[_0xbfc9('0x43')]=function(_0x19a1c0,_0x557795){var _0x18b75d={'raw':!![],'where':{'id':_0x19a1c0[_0xbfc9('0x44')]['id']}},_0x36a0cc={};_0x36a0cc['model']=_['keys'](db[_0xbfc9('0x2d')][_0xbfc9('0x2e')]);_0x36a0cc['query']=_['keys'](_0x19a1c0['query']);_0x36a0cc['filters']=_[_0xbfc9('0x35')](_0x36a0cc[_0xbfc9('0x31')],_0x36a0cc['query']);_0x18b75d[_0xbfc9('0x36')]=_[_0xbfc9('0x35')](_0x36a0cc['model'],qs['fields'](_0x19a1c0['query'][_0xbfc9('0x37')]));_0x18b75d[_0xbfc9('0x36')]=_0x18b75d[_0xbfc9('0x36')][_0xbfc9('0x38')]?_0x18b75d[_0xbfc9('0x36')]:_0x36a0cc[_0xbfc9('0x31')];if(_0x19a1c0[_0xbfc9('0x32')][_0xbfc9('0x3f')]){_0x18b75d[_0xbfc9('0x40')]=[{'all':!![]}];}_0x18b75d=_[_0xbfc9('0x3d')]({},_0x18b75d,_0x19a1c0['options']);return db[_0xbfc9('0x2d')]['find'](_0x18b75d)[_0xbfc9('0x26')](handleEntityNotFound(_0x557795,null))[_0xbfc9('0x26')](respondWithResult(_0x557795,null))[_0xbfc9('0x45')](handleError(_0x557795,null));};exports['create']=function(_0x5e971d,_0x201281){return db[_0xbfc9('0x2d')][_0xbfc9('0x46')](_0x5e971d['body'],{})[_0xbfc9('0x26')](respondWithResult(_0x201281,0xc9))[_0xbfc9('0x45')](handleError(_0x201281,null));};exports['update']=function(_0x192d07,_0x307e72){if(_0x192d07['body']['id']){delete _0x192d07[_0xbfc9('0x47')]['id'];}return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x192d07[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x307e72,null))['then'](saveUpdates(_0x192d07[_0xbfc9('0x47')],null))[_0xbfc9('0x26')](respondWithResult(_0x307e72,null))['catch'](handleError(_0x307e72,null));};exports['destroy']=function(_0x340520,_0x33a8d7){return db[_0xbfc9('0x2d')]['find']({'where':{'id':_0x340520[_0xbfc9('0x44')]['id']}})[_0xbfc9('0x26')](handleEntityNotFound(_0x33a8d7,null))[_0xbfc9('0x26')](removeEntity(_0x33a8d7,null))['catch'](handleError(_0x33a8d7,null));};exports[_0xbfc9('0x48')]=function(_0x3abd7d,_0x4f8ca9){return db[_0xbfc9('0x2d')][_0xbfc9('0x48')]()[_0xbfc9('0x26')](respondWithResult(_0x4f8ca9,null))[_0xbfc9('0x45')](handleError(_0x4f8ca9,null));}; \ No newline at end of file +var _0xbbbd=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','ChatQueueReport','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api'];(function(_0x181b17,_0x1e358a){var _0x516289=function(_0x1438af){while(--_0x1438af){_0x181b17['push'](_0x181b17['shift']());}};_0x516289(++_0x1e358a);}(_0xbbbd,0x86));var _0xdbbb=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xbbbd[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0xdbbb('0x0'));var rimraf=require(_0xdbbb('0x1'));var zipdir=require(_0xdbbb('0x2'));var jsonpatch=require(_0xdbbb('0x3'));var rp=require(_0xdbbb('0x4'));var moment=require(_0xdbbb('0x5'));var BPromise=require(_0xdbbb('0x6'));var Mustache=require(_0xdbbb('0x7'));var util=require(_0xdbbb('0x8'));var path=require(_0xdbbb('0x9'));var sox=require(_0xdbbb('0xa'));var csv=require(_0xdbbb('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbbb('0xc'));var _=require(_0xdbbb('0xd'));var squel=require(_0xdbbb('0xe'));var crypto=require(_0xdbbb('0xf'));var jsforce=require(_0xdbbb('0x10'));var deskjs=require(_0xdbbb('0x11'));var toCsv=require(_0xdbbb('0xb'));var querystring=require(_0xdbbb('0x12'));var Papa=require(_0xdbbb('0x13'));var Redis=require(_0xdbbb('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdbbb('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbbb('0x16'));var logger=require('../../config/logger')(_0xdbbb('0x17'));var utils=require(_0xdbbb('0x18'));var config=require(_0xdbbb('0x19'));var licenseUtil=require(_0xdbbb('0x1a'));var db=require(_0xdbbb('0x1b'))['db'];function respondWithStatusCode(_0x2b1cfb,_0x4469dd){_0x4469dd=_0x4469dd||0xcc;return function(_0x63128d){if(_0x63128d){return _0x2b1cfb[_0xdbbb('0x1c')](_0x4469dd);}return _0x2b1cfb['status'](_0x4469dd)[_0xdbbb('0x1d')]();};}function respondWithResult(_0x5a2c64,_0x21706f){_0x21706f=_0x21706f||0xc8;return function(_0x22713c){if(_0x22713c){return _0x5a2c64[_0xdbbb('0x1e')](_0x21706f)[_0xdbbb('0x1f')](_0x22713c);}};}function respondWithFilteredResult(_0x433ffb,_0x14eb3a){return function(_0x2f0f91){if(_0x2f0f91){var _0xf4af5=typeof _0x14eb3a[_0xdbbb('0x20')]===_0xdbbb('0x21')&&typeof _0x14eb3a[_0xdbbb('0x22')]===_0xdbbb('0x21');var _0x4a18d9=_0x2f0f91[_0xdbbb('0x23')];var _0xbbf0b4=_0xf4af5?0x0:_0x14eb3a['offset'];var _0x5c4b3d=_0xf4af5?_0x2f0f91[_0xdbbb('0x23')]:_0x14eb3a[_0xdbbb('0x20')]+_0x14eb3a[_0xdbbb('0x22')];var _0x48284b;if(_0x5c4b3d>=_0x4a18d9){_0x5c4b3d=_0x4a18d9;_0x48284b=0xc8;}else{_0x48284b=0xce;}_0x433ffb[_0xdbbb('0x1e')](_0x48284b);return _0x433ffb[_0xdbbb('0x24')]('Content-Range',_0xbbf0b4+'-'+_0x5c4b3d+'/'+_0x4a18d9)[_0xdbbb('0x1f')](_0x2f0f91);}return null;};}function patchUpdates(_0x1c2e3f){return function(_0x128f93){try{jsonpatch[_0xdbbb('0x25')](_0x128f93,_0x1c2e3f,!![]);}catch(_0x4b0984){return BPromise[_0xdbbb('0x26')](_0x4b0984);}return _0x128f93[_0xdbbb('0x27')]();};}function saveUpdates(_0x6c7610,_0xe98d9e){return function(_0x29c9c6){if(_0x29c9c6){return _0x29c9c6[_0xdbbb('0x28')](_0x6c7610)['then'](function(_0xf998f2){return _0xf998f2;});}return null;};}function removeEntity(_0x2de604,_0x537086){return function(_0x47df58){if(_0x47df58){return _0x47df58[_0xdbbb('0x29')]()[_0xdbbb('0x2a')](function(){_0x2de604[_0xdbbb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x371c0b,_0x487880){return function(_0x28d527){if(!_0x28d527){_0x371c0b[_0xdbbb('0x1c')](0x194);}return _0x28d527;};}function handleError(_0x49df51,_0x4934be){_0x4934be=_0x4934be||0x1f4;return function(_0x180f55){logger['error'](_0x180f55['stack']);if(_0x180f55[_0xdbbb('0x2b')]){delete _0x180f55[_0xdbbb('0x2b')];}_0x49df51[_0xdbbb('0x1e')](_0x4934be)[_0xdbbb('0x2c')](_0x180f55);};}exports[_0xdbbb('0x2d')]=function(_0x3234d6,_0x452bea){var _0x41819a={},_0x4ee8f9={},_0x370725={'count':0x0,'rows':[]};var _0x5fcf32=_[_0xdbbb('0x2e')](db['ChatQueueReport'][_0xdbbb('0x2f')],function(_0x30ab26){return{'name':_0x30ab26[_0xdbbb('0x30')],'type':_0x30ab26[_0xdbbb('0x31')]['key']};});_0x4ee8f9[_0xdbbb('0x32')]=_['map'](_0x5fcf32,_0xdbbb('0x2b'));_0x4ee8f9['query']=_[_0xdbbb('0x33')](_0x3234d6[_0xdbbb('0x34')]);_0x4ee8f9[_0xdbbb('0x35')]=_[_0xdbbb('0x36')](_0x4ee8f9[_0xdbbb('0x32')],_0x4ee8f9[_0xdbbb('0x34')]);_0x41819a[_0xdbbb('0x37')]=_[_0xdbbb('0x36')](_0x4ee8f9[_0xdbbb('0x32')],qs[_0xdbbb('0x38')](_0x3234d6[_0xdbbb('0x34')][_0xdbbb('0x38')]));_0x41819a[_0xdbbb('0x37')]=_0x41819a[_0xdbbb('0x37')][_0xdbbb('0x39')]?_0x41819a[_0xdbbb('0x37')]:_0x4ee8f9[_0xdbbb('0x32')];if(!_0x3234d6[_0xdbbb('0x34')]['hasOwnProperty'](_0xdbbb('0x3a'))){_0x41819a['limit']=qs[_0xdbbb('0x22')](_0x3234d6[_0xdbbb('0x34')]['limit']);_0x41819a[_0xdbbb('0x20')]=qs[_0xdbbb('0x20')](_0x3234d6[_0xdbbb('0x34')][_0xdbbb('0x20')]);}_0x41819a[_0xdbbb('0x3b')]=qs['sort'](_0x3234d6[_0xdbbb('0x34')][_0xdbbb('0x3c')]);_0x41819a['where']=qs[_0xdbbb('0x35')](_[_0xdbbb('0x3d')](_0x3234d6[_0xdbbb('0x34')],_0x4ee8f9[_0xdbbb('0x35')]),_0x5fcf32);if(_0x3234d6[_0xdbbb('0x34')][_0xdbbb('0x3e')]){_0x41819a['where']=_[_0xdbbb('0x3f')](_0x41819a[_0xdbbb('0x40')],{'$or':_[_0xdbbb('0x2e')](_0x5fcf32,function(_0x2ddd25){if(_0x2ddd25[_0xdbbb('0x31')]!==_0xdbbb('0x41')){var _0x529f83={};_0x529f83[_0x2ddd25[_0xdbbb('0x2b')]]={'$like':'%'+_0x3234d6[_0xdbbb('0x34')][_0xdbbb('0x3e')]+'%'};return _0x529f83;}})});}_0x41819a=_[_0xdbbb('0x3f')]({},_0x41819a,_0x3234d6[_0xdbbb('0x42')]);var _0x1b0418={'where':_0x41819a[_0xdbbb('0x40')]};return db['ChatQueueReport']['count'](_0x1b0418)['then'](function(_0x2bc5e1){_0x370725[_0xdbbb('0x23')]=_0x2bc5e1;if(_0x3234d6['query'][_0xdbbb('0x43')]){_0x41819a[_0xdbbb('0x44')]=[{'all':!![]}];}return db[_0xdbbb('0x45')][_0xdbbb('0x46')](_0x41819a);})[_0xdbbb('0x2a')](function(_0x189f99){_0x370725[_0xdbbb('0x47')]=_0x189f99;return _0x370725;})[_0xdbbb('0x2a')](respondWithFilteredResult(_0x452bea,_0x41819a))[_0xdbbb('0x48')](handleError(_0x452bea,null));};exports[_0xdbbb('0x49')]=function(_0x1a31ee,_0x49c59b){var _0x467978={'raw':!![],'where':{'id':_0x1a31ee[_0xdbbb('0x4a')]['id']}},_0x4a1cd6={};_0x4a1cd6['model']=_[_0xdbbb('0x33')](db[_0xdbbb('0x45')][_0xdbbb('0x2f')]);_0x4a1cd6[_0xdbbb('0x34')]=_[_0xdbbb('0x33')](_0x1a31ee['query']);_0x4a1cd6[_0xdbbb('0x35')]=_[_0xdbbb('0x36')](_0x4a1cd6['model'],_0x4a1cd6['query']);_0x467978['attributes']=_[_0xdbbb('0x36')](_0x4a1cd6['model'],qs[_0xdbbb('0x38')](_0x1a31ee[_0xdbbb('0x34')][_0xdbbb('0x38')]));_0x467978[_0xdbbb('0x37')]=_0x467978[_0xdbbb('0x37')]['length']?_0x467978[_0xdbbb('0x37')]:_0x4a1cd6['model'];if(_0x1a31ee[_0xdbbb('0x34')]['includeAll']){_0x467978['include']=[{'all':!![]}];}_0x467978=_[_0xdbbb('0x3f')]({},_0x467978,_0x1a31ee[_0xdbbb('0x42')]);return db[_0xdbbb('0x45')][_0xdbbb('0x4b')](_0x467978)[_0xdbbb('0x2a')](handleEntityNotFound(_0x49c59b,null))[_0xdbbb('0x2a')](respondWithResult(_0x49c59b,null))[_0xdbbb('0x48')](handleError(_0x49c59b,null));};exports[_0xdbbb('0x4c')]=function(_0x954c98,_0x1a96fa){return db[_0xdbbb('0x45')][_0xdbbb('0x4c')](_0x954c98[_0xdbbb('0x4d')],{})['then'](respondWithResult(_0x1a96fa,0xc9))['catch'](handleError(_0x1a96fa,null));};exports[_0xdbbb('0x28')]=function(_0x4302a8,_0x318bca){if(_0x4302a8[_0xdbbb('0x4d')]['id']){delete _0x4302a8[_0xdbbb('0x4d')]['id'];}return db[_0xdbbb('0x45')]['find']({'where':{'id':_0x4302a8['params']['id']}})['then'](handleEntityNotFound(_0x318bca,null))['then'](saveUpdates(_0x4302a8[_0xdbbb('0x4d')],null))['then'](respondWithResult(_0x318bca,null))[_0xdbbb('0x48')](handleError(_0x318bca,null));};exports[_0xdbbb('0x29')]=function(_0x1b8ab1,_0x39621e){return db[_0xdbbb('0x45')][_0xdbbb('0x4b')]({'where':{'id':_0x1b8ab1[_0xdbbb('0x4a')]['id']}})[_0xdbbb('0x2a')](handleEntityNotFound(_0x39621e,null))[_0xdbbb('0x2a')](removeEntity(_0x39621e,null))[_0xdbbb('0x48')](handleError(_0x39621e,null));};exports[_0xdbbb('0x4e')]=function(_0x387ae2,_0x527bc7){return db['ChatQueueReport'][_0xdbbb('0x4e')]()[_0xdbbb('0x2a')](respondWithResult(_0x527bc7,null))[_0xdbbb('0x48')](handleError(_0x527bc7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index f286551..1fbe1c0 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(_0x4037cd,_0x1be60b){var _0x4dec28=function(_0x899142){while(--_0x899142){_0x4037cd['push'](_0x4037cd['shift']());}};_0x4dec28(++_0x1be60b);}(_0x757a,0xde));var _0xa757=function(_0x345ac6,_0x240795){_0x345ac6=_0x345ac6-0x0;var _0x585cd9=_0x757a[_0x345ac6];return _0x585cd9;};'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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_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/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 4fe73f1..8e2c097 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 _0x6bcf=['code','message','result','CreateChatQueueReport','ChatQueueReport','options','raw','UpdateChatQueueReport','update','body','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x43ffad,_0x6800b3){var _0x3c2a91=function(_0x406dac){while(--_0x406dac){_0x43ffad['push'](_0x43ffad['shift']());}};_0x3c2a91(++_0x6800b3);}(_0x6bcf,0x181));var _0xf6bc=function(_0x3cc8c0,_0x57150a){_0x3cc8c0=_0x3cc8c0-0x0;var _0x497477=_0x6bcf[_0x3cc8c0];return _0x497477;};'use strict';var _=require(_0xf6bc('0x0'));var util=require('util');var moment=require(_0xf6bc('0x1'));var BPromise=require(_0xf6bc('0x2'));var rs=require(_0xf6bc('0x3'));var fs=require('fs');var Redis=require(_0xf6bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf6bc('0x5'))(_0xf6bc('0x6'));var config=require(_0xf6bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6bc('0x8')][_0xf6bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3f2f,_0x484663,_0x21a9e1){return new BPromise(function(_0x3dee61,_0xb51752){return client['request'](_0x3c3f2f,_0x21a9e1)[_0xf6bc('0xa')](function(_0x414700){logger[_0xf6bc('0xb')](_0xf6bc('0xc'),_0x484663,_0xf6bc('0xd'));logger[_0xf6bc('0xe')](_0xf6bc('0xf'),_0x484663,_0xf6bc('0xd'),JSON[_0xf6bc('0x10')](_0x414700));if(_0x414700[_0xf6bc('0x11')]){if(_0x414700[_0xf6bc('0x11')][_0xf6bc('0x12')]===0x1f4){logger[_0xf6bc('0x11')](_0xf6bc('0xc'),_0x484663,_0x414700['error'][_0xf6bc('0x13')]);return _0xb51752(_0x414700['error'][_0xf6bc('0x13')]);}logger[_0xf6bc('0x11')](_0xf6bc('0xc'),_0x484663,_0x414700['error'][_0xf6bc('0x13')]);return _0x3dee61(_0x414700[_0xf6bc('0x11')][_0xf6bc('0x13')]);}else{logger['info'](_0xf6bc('0xc'),_0x484663,_0xf6bc('0xd'));_0x3dee61(_0x414700[_0xf6bc('0x14')][_0xf6bc('0x13')]);}})['catch'](function(_0x84a679){logger['error'](_0xf6bc('0xc'),_0x484663,_0x84a679);_0xb51752(_0x84a679);});});}exports[_0xf6bc('0x15')]=function(_0x5e2e7e){var _0x340f59=this;return new Promise(function(_0xebf22,_0x2b52a6){return db[_0xf6bc('0x16')]['create'](_0x5e2e7e['body'],{'raw':_0x5e2e7e[_0xf6bc('0x17')]?_0x5e2e7e['options'][_0xf6bc('0x18')]===undefined?!![]:![]:!![]})[_0xf6bc('0xa')](function(_0x5e0a40){logger['info'](_0xf6bc('0x15'),_0x5e2e7e);logger['debug'](_0xf6bc('0x15'),_0x5e2e7e,JSON[_0xf6bc('0x10')](_0x5e0a40));_0xebf22(_0x5e0a40);})['catch'](function(_0x41fa25){logger[_0xf6bc('0x11')](_0xf6bc('0x15'),_0x41fa25[_0xf6bc('0x13')],_0x5e2e7e);_0x2b52a6(_0x340f59[_0xf6bc('0x11')](0x1f4,_0x41fa25['message']));});});};exports[_0xf6bc('0x19')]=function(_0x5db815){var _0x332668=this;return new Promise(function(_0x251094,_0x44a42e){return db[_0xf6bc('0x16')][_0xf6bc('0x1a')](_0x5db815[_0xf6bc('0x1b')],{'raw':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5db815[_0xf6bc('0x17')]?_0x5db815['options']['where']||null:null,'attributes':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')][_0xf6bc('0x1c')]||null:null,'limit':_0x5db815[_0xf6bc('0x17')]?_0x5db815[_0xf6bc('0x17')][_0xf6bc('0x1d')]||null:null})['then'](function(_0x4b8e6d){logger[_0xf6bc('0xb')](_0xf6bc('0x19'),_0x5db815);logger[_0xf6bc('0xe')](_0xf6bc('0x19'),_0x5db815,JSON[_0xf6bc('0x10')](_0x4b8e6d));_0x251094(_0x4b8e6d);})[_0xf6bc('0x1e')](function(_0x3267c0){logger[_0xf6bc('0x11')](_0xf6bc('0x19'),_0x3267c0[_0xf6bc('0x13')],_0x5db815);_0x44a42e(_0x332668[_0xf6bc('0x11')](0x1f4,_0x3267c0[_0xf6bc('0x13')]));});});}; \ No newline at end of file +var _0xdfaa=['ChatQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','UpdateChatQueueReport'];(function(_0x219729,_0x19f07d){var _0x35c464=function(_0x3c412c){while(--_0x3c412c){_0x219729['push'](_0x219729['shift']());}};_0x35c464(++_0x19f07d);}(_0xdfaa,0xa5));var _0xadfa=function(_0x35d80c,_0x469f1c){_0x35d80c=_0x35d80c-0x0;var _0x47a2d6=_0xdfaa[_0x35d80c];return _0x47a2d6;};'use strict';var _=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var moment=require(_0xadfa('0x2'));var BPromise=require(_0xadfa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xadfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xadfa('0x5'));var config=require('../../config/environment');var jayson=require(_0xadfa('0x6'));var client=jayson[_0xadfa('0x7')][_0xadfa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x512702,_0x168806,_0x2da7eb){return new BPromise(function(_0x47904b,_0x396c91){return client[_0xadfa('0x9')](_0x512702,_0x2da7eb)[_0xadfa('0xa')](function(_0x3d4b6f){logger[_0xadfa('0xb')](_0xadfa('0xc'),_0x168806,_0xadfa('0xd'));logger[_0xadfa('0xe')](_0xadfa('0xf'),_0x168806,_0xadfa('0xd'),JSON[_0xadfa('0x10')](_0x3d4b6f));if(_0x3d4b6f['error']){if(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x12')]===0x1f4){logger[_0xadfa('0x11')](_0xadfa('0xc'),_0x168806,_0x3d4b6f['error']['message']);return _0x396c91(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x13')]);}logger[_0xadfa('0x11')](_0xadfa('0xc'),_0x168806,_0x3d4b6f['error'][_0xadfa('0x13')]);return _0x47904b(_0x3d4b6f[_0xadfa('0x11')][_0xadfa('0x13')]);}else{logger[_0xadfa('0xb')](_0xadfa('0xc'),_0x168806,'request\x20sent');_0x47904b(_0x3d4b6f[_0xadfa('0x14')][_0xadfa('0x13')]);}})[_0xadfa('0x15')](function(_0x4188c9){logger[_0xadfa('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x168806,_0x4188c9);_0x396c91(_0x4188c9);});});}exports[_0xadfa('0x16')]=function(_0x14c620){var _0x5b15c8=this;return new Promise(function(_0x54dd90,_0x4dd196){return db['ChatQueueReport']['create'](_0x14c620[_0xadfa('0x17')],{'raw':_0x14c620[_0xadfa('0x18')]?_0x14c620['options'][_0xadfa('0x19')]===undefined?!![]:![]:!![]})[_0xadfa('0xa')](function(_0x261ac5){logger[_0xadfa('0xb')](_0xadfa('0x16'),_0x14c620);logger['debug'](_0xadfa('0x16'),_0x14c620,JSON[_0xadfa('0x10')](_0x261ac5));_0x54dd90(_0x261ac5);})[_0xadfa('0x15')](function(_0xf4e2e6){logger[_0xadfa('0x11')](_0xadfa('0x16'),_0xf4e2e6[_0xadfa('0x13')],_0x14c620);_0x4dd196(_0x5b15c8[_0xadfa('0x11')](0x1f4,_0xf4e2e6[_0xadfa('0x13')]));});});};exports[_0xadfa('0x1a')]=function(_0xe63eb0){var _0x485aec=this;return new Promise(function(_0x501d43,_0x325035){return db[_0xadfa('0x1b')][_0xadfa('0x1c')](_0xe63eb0[_0xadfa('0x17')],{'raw':_0xe63eb0['options']?_0xe63eb0[_0xadfa('0x18')][_0xadfa('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe63eb0[_0xadfa('0x18')]?_0xe63eb0['options'][_0xadfa('0x1d')]||null:null,'attributes':_0xe63eb0[_0xadfa('0x18')]?_0xe63eb0['options'][_0xadfa('0x1e')]||null:null,'limit':_0xe63eb0['options']?_0xe63eb0[_0xadfa('0x18')][_0xadfa('0x1f')]||null:null})[_0xadfa('0xa')](function(_0x70c79){logger[_0xadfa('0xb')](_0xadfa('0x1a'),_0xe63eb0);logger['debug'](_0xadfa('0x1a'),_0xe63eb0,JSON[_0xadfa('0x10')](_0x70c79));_0x501d43(_0x70c79);})[_0xadfa('0x15')](function(_0xc1c3f6){logger[_0xadfa('0x11')](_0xadfa('0x1a'),_0xc1c3f6[_0xadfa('0x13')],_0xe63eb0);_0x325035(_0x485aec[_0xadfa('0x11')](0x1f4,_0xc1c3f6[_0xadfa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5cc12be..4fd64c7 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 _0xe087=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create','put'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xe087,0x1cf));var _0x7e08=function(_0x3781fe,_0x39211a){_0x3781fe=_0x3781fe-0x0;var _0x109f3e=_0xe087[_0x3781fe];return _0x109f3e;};'use strict';var multer=require(_0x7e08('0x0'));var util=require(_0x7e08('0x1'));var path=require(_0x7e08('0x2'));var timeout=require('connect-timeout');var express=require(_0x7e08('0x3'));var router=express[_0x7e08('0x4')]();var fs_extra=require(_0x7e08('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7e08('0x6'));var config=require(_0x7e08('0x7'));var controller=require('./chatQueueReport.controller');router[_0x7e08('0x8')]('/',auth[_0x7e08('0x9')](),controller[_0x7e08('0xa')]);router[_0x7e08('0x8')](_0x7e08('0xb'),auth[_0x7e08('0x9')](),controller[_0x7e08('0xc')]);router[_0x7e08('0x8')](_0x7e08('0xd'),auth[_0x7e08('0x9')](),controller[_0x7e08('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7e08('0xf')]);router[_0x7e08('0x10')](_0x7e08('0xd'),auth[_0x7e08('0x9')](),controller[_0x7e08('0x11')]);router[_0x7e08('0x12')]('/:id',auth[_0x7e08('0x9')](),controller['destroy']);module[_0x7e08('0x13')]=router; \ No newline at end of file +var _0x1d79=['create','put','/:id','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','describe','show','post'];(function(_0x49bf9e,_0x2cce36){var _0x222a9e=function(_0x465be0){while(--_0x465be0){_0x49bf9e['push'](_0x49bf9e['shift']());}};_0x222a9e(++_0x2cce36);}(_0x1d79,0x101));var _0x91d7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1d79[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x91d7('0x0'));var util=require(_0x91d7('0x1'));var path=require('path');var timeout=require(_0x91d7('0x2'));var express=require(_0x91d7('0x3'));var router=express[_0x91d7('0x4')]();var fs_extra=require(_0x91d7('0x5'));var auth=require(_0x91d7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x91d7('0x7'));router[_0x91d7('0x8')]('/',auth[_0x91d7('0x9')](),controller['index']);router['get']('/describe',auth[_0x91d7('0x9')](),controller[_0x91d7('0xa')]);router[_0x91d7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x91d7('0xb')]);router[_0x91d7('0xc')]('/',auth[_0x91d7('0x9')](),controller[_0x91d7('0xd')]);router[_0x91d7('0xe')](_0x91d7('0xf'),auth[_0x91d7('0x9')](),controller[_0x91d7('0x10')]);router[_0x91d7('0x11')](_0x91d7('0xf'),auth[_0x91d7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0dbdd3a..79a122b 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4fdaa5,_0x212ef3){var _0x48e67f=function(_0x524ef4){while(--_0x524ef4){_0x4fdaa5['push'](_0x4fdaa5['shift']());}};_0x48e67f(++_0x212ef3);}(_0xaa88,0x137));var _0x8aa8=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xaa88[_0x9df060];return _0x338dfe;};'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 +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x211717,_0x5cf366){var _0x5e9af=function(_0x270525){while(--_0x270525){_0x211717['push'](_0x211717['shift']());}};_0x5e9af(++_0x5cf366);}(_0x70e0,0x17b));var _0x070e=function(_0x5b4a3b,_0x5d5e4c){_0x5b4a3b=_0x5b4a3b-0x0;var _0x4405c4=_0x70e0[_0x5b4a3b];return _0x4405c4;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 44bedc1..eaf62aa 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 _0xd0e2=['body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','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','../../mysqldb','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','ChatTransferReport','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','length','includeAll','create'];(function(_0x37d03f,_0x3859d1){var _0x566781=function(_0x546437){while(--_0x546437){_0x37d03f['push'](_0x37d03f['shift']());}};_0x566781(++_0x3859d1);}(_0xd0e2,0xed));var _0x2d0e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0e2[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d0e('0x0'));var zipdir=require(_0x2d0e('0x1'));var jsonpatch=require(_0x2d0e('0x2'));var rp=require(_0x2d0e('0x3'));var moment=require('moment');var BPromise=require(_0x2d0e('0x4'));var Mustache=require(_0x2d0e('0x5'));var util=require(_0x2d0e('0x6'));var path=require(_0x2d0e('0x7'));var sox=require(_0x2d0e('0x8'));var csv=require(_0x2d0e('0x9'));var ejs=require(_0x2d0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d0e('0xb'));var squel=require(_0x2d0e('0xc'));var crypto=require(_0x2d0e('0xd'));var jsforce=require(_0x2d0e('0xe'));var deskjs=require(_0x2d0e('0xf'));var toCsv=require(_0x2d0e('0x9'));var querystring=require(_0x2d0e('0x10'));var Papa=require(_0x2d0e('0x11'));var Redis=require(_0x2d0e('0x12'));var authService=require(_0x2d0e('0x13'));var qs=require(_0x2d0e('0x14'));var as=require(_0x2d0e('0x15'));var hardwareService=require(_0x2d0e('0x16'));var logger=require(_0x2d0e('0x17'))(_0x2d0e('0x18'));var utils=require(_0x2d0e('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d0e('0x1a'))['db'];function respondWithStatusCode(_0x41b2a8,_0x37a637){_0x37a637=_0x37a637||0xcc;return function(_0x575f5b){if(_0x575f5b){return _0x41b2a8['sendStatus'](_0x37a637);}return _0x41b2a8[_0x2d0e('0x1b')](_0x37a637)[_0x2d0e('0x1c')]();};}function respondWithResult(_0x4dfe78,_0x24093a){_0x24093a=_0x24093a||0xc8;return function(_0x83265){if(_0x83265){return _0x4dfe78['status'](_0x24093a)['json'](_0x83265);}};}function respondWithFilteredResult(_0x451c49,_0x59f113){return function(_0x13a5e4){if(_0x13a5e4){var _0x35fdae=typeof _0x59f113['offset']===_0x2d0e('0x1d')&&typeof _0x59f113[_0x2d0e('0x1e')]===_0x2d0e('0x1d');var _0x3e46f1=_0x13a5e4[_0x2d0e('0x1f')];var _0x55e810=_0x35fdae?0x0:_0x59f113[_0x2d0e('0x20')];var _0x5ce2f3=_0x35fdae?_0x13a5e4[_0x2d0e('0x1f')]:_0x59f113[_0x2d0e('0x20')]+_0x59f113[_0x2d0e('0x1e')];var _0x54c572;if(_0x5ce2f3>=_0x3e46f1){_0x5ce2f3=_0x3e46f1;_0x54c572=0xc8;}else{_0x54c572=0xce;}_0x451c49[_0x2d0e('0x1b')](_0x54c572);return _0x451c49['set'](_0x2d0e('0x21'),_0x55e810+'-'+_0x5ce2f3+'/'+_0x3e46f1)[_0x2d0e('0x22')](_0x13a5e4);}return null;};}function patchUpdates(_0xd6f6e8){return function(_0x3003b5){try{jsonpatch[_0x2d0e('0x23')](_0x3003b5,_0xd6f6e8,!![]);}catch(_0x3f8277){return BPromise[_0x2d0e('0x24')](_0x3f8277);}return _0x3003b5[_0x2d0e('0x25')]();};}function saveUpdates(_0x33c2c0,_0x3da617){return function(_0x516472){if(_0x516472){return _0x516472[_0x2d0e('0x26')](_0x33c2c0)[_0x2d0e('0x27')](function(_0x250fea){return _0x250fea;});}return null;};}function removeEntity(_0x18ff50,_0x3ccd11){return function(_0x12c1c1){if(_0x12c1c1){return _0x12c1c1[_0x2d0e('0x28')]()['then'](function(){_0x18ff50['status'](0xcc)[_0x2d0e('0x1c')]();});}};}function handleEntityNotFound(_0x2f930c,_0x4f6c0e){return function(_0x5cbf80){if(!_0x5cbf80){_0x2f930c[_0x2d0e('0x29')](0x194);}return _0x5cbf80;};}function handleError(_0x926fcb,_0x4bceeb){_0x4bceeb=_0x4bceeb||0x1f4;return function(_0xcaed90){logger[_0x2d0e('0x2a')](_0xcaed90[_0x2d0e('0x2b')]);if(_0xcaed90['name']){delete _0xcaed90[_0x2d0e('0x2c')];}_0x926fcb[_0x2d0e('0x1b')](_0x4bceeb)['send'](_0xcaed90);};}exports[_0x2d0e('0x2d')]=function(_0x594bcf,_0x25d27b){var _0x607231={},_0x457bbb={},_0x34039c={'count':0x0,'rows':[]};var _0x290841=_[_0x2d0e('0x2e')](db[_0x2d0e('0x2f')][_0x2d0e('0x30')],function(_0x3ee5bd){return{'name':_0x3ee5bd['fieldName'],'type':_0x3ee5bd[_0x2d0e('0x31')][_0x2d0e('0x32')]};});_0x457bbb[_0x2d0e('0x33')]=_[_0x2d0e('0x2e')](_0x290841,_0x2d0e('0x2c'));_0x457bbb['query']=_[_0x2d0e('0x34')](_0x594bcf['query']);_0x457bbb[_0x2d0e('0x35')]=_['intersection'](_0x457bbb[_0x2d0e('0x33')],_0x457bbb['query']);_0x607231[_0x2d0e('0x36')]=_[_0x2d0e('0x37')](_0x457bbb[_0x2d0e('0x33')],qs[_0x2d0e('0x38')](_0x594bcf[_0x2d0e('0x39')]['fields']));_0x607231[_0x2d0e('0x36')]=_0x607231[_0x2d0e('0x36')]['length']?_0x607231[_0x2d0e('0x36')]:_0x457bbb[_0x2d0e('0x33')];if(!_0x594bcf['query'][_0x2d0e('0x3a')]('nolimit')){_0x607231[_0x2d0e('0x1e')]=qs[_0x2d0e('0x1e')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x1e')]);_0x607231['offset']=qs[_0x2d0e('0x20')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x20')]);}_0x607231[_0x2d0e('0x3b')]=qs[_0x2d0e('0x3c')](_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x3c')]);_0x607231[_0x2d0e('0x3d')]=qs['filters'](_[_0x2d0e('0x3e')](_0x594bcf[_0x2d0e('0x39')],_0x457bbb['filters']),_0x290841);if(_0x594bcf[_0x2d0e('0x39')][_0x2d0e('0x3f')]){_0x607231[_0x2d0e('0x3d')]=_[_0x2d0e('0x40')](_0x607231[_0x2d0e('0x3d')],{'$or':_[_0x2d0e('0x2e')](_0x290841,function(_0x1e0adf){if(_0x1e0adf[_0x2d0e('0x31')]!=='VIRTUAL'){var _0x14077d={};_0x14077d[_0x1e0adf['name']]={'$like':'%'+_0x594bcf[_0x2d0e('0x39')]['filter']+'%'};return _0x14077d;}})});}_0x607231=_[_0x2d0e('0x40')]({},_0x607231,_0x594bcf[_0x2d0e('0x41')]);var _0x57e8ce={'where':_0x607231[_0x2d0e('0x3d')]};return db[_0x2d0e('0x2f')][_0x2d0e('0x1f')](_0x57e8ce)['then'](function(_0x39f5f9){_0x34039c['count']=_0x39f5f9;if(_0x594bcf[_0x2d0e('0x39')]['includeAll']){_0x607231[_0x2d0e('0x42')]=[{'all':!![]}];}return db[_0x2d0e('0x2f')][_0x2d0e('0x43')](_0x607231);})[_0x2d0e('0x27')](function(_0x385a0c){_0x34039c[_0x2d0e('0x44')]=_0x385a0c;return _0x34039c;})['then'](respondWithFilteredResult(_0x25d27b,_0x607231))[_0x2d0e('0x45')](handleError(_0x25d27b,null));};exports[_0x2d0e('0x46')]=function(_0x3352e8,_0x2a52a5){var _0x2b7585={'raw':!![],'where':{'id':_0x3352e8[_0x2d0e('0x47')]['id']}},_0x3e2aeb={};_0x3e2aeb[_0x2d0e('0x33')]=_[_0x2d0e('0x34')](db[_0x2d0e('0x2f')][_0x2d0e('0x30')]);_0x3e2aeb[_0x2d0e('0x39')]=_[_0x2d0e('0x34')](_0x3352e8[_0x2d0e('0x39')]);_0x3e2aeb[_0x2d0e('0x35')]=_[_0x2d0e('0x37')](_0x3e2aeb[_0x2d0e('0x33')],_0x3e2aeb[_0x2d0e('0x39')]);_0x2b7585['attributes']=_['intersection'](_0x3e2aeb[_0x2d0e('0x33')],qs[_0x2d0e('0x38')](_0x3352e8[_0x2d0e('0x39')][_0x2d0e('0x38')]));_0x2b7585['attributes']=_0x2b7585[_0x2d0e('0x36')][_0x2d0e('0x48')]?_0x2b7585[_0x2d0e('0x36')]:_0x3e2aeb['model'];if(_0x3352e8[_0x2d0e('0x39')][_0x2d0e('0x49')]){_0x2b7585[_0x2d0e('0x42')]=[{'all':!![]}];}_0x2b7585=_[_0x2d0e('0x40')]({},_0x2b7585,_0x3352e8[_0x2d0e('0x41')]);return db[_0x2d0e('0x2f')]['find'](_0x2b7585)[_0x2d0e('0x27')](handleEntityNotFound(_0x2a52a5,null))[_0x2d0e('0x27')](respondWithResult(_0x2a52a5,null))[_0x2d0e('0x45')](handleError(_0x2a52a5,null));};exports['create']=function(_0x570f2e,_0xfa28d4){return db[_0x2d0e('0x2f')][_0x2d0e('0x4a')](_0x570f2e['body'],{})['then'](respondWithResult(_0xfa28d4,0xc9))[_0x2d0e('0x45')](handleError(_0xfa28d4,null));};exports[_0x2d0e('0x26')]=function(_0x2f7ecf,_0x7a870e){if(_0x2f7ecf[_0x2d0e('0x4b')]['id']){delete _0x2f7ecf[_0x2d0e('0x4b')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x2f7ecf[_0x2d0e('0x47')]['id']}})[_0x2d0e('0x27')](handleEntityNotFound(_0x7a870e,null))['then'](saveUpdates(_0x2f7ecf[_0x2d0e('0x4b')],null))['then'](respondWithResult(_0x7a870e,null))[_0x2d0e('0x45')](handleError(_0x7a870e,null));};exports[_0x2d0e('0x28')]=function(_0x1f7b9e,_0x45d2bd){return db[_0x2d0e('0x2f')][_0x2d0e('0x4c')]({'where':{'id':_0x1f7b9e[_0x2d0e('0x47')]['id']}})[_0x2d0e('0x27')](handleEntityNotFound(_0x45d2bd,null))[_0x2d0e('0x27')](removeEntity(_0x45d2bd,null))[_0x2d0e('0x45')](handleError(_0x45d2bd,null));};exports[_0x2d0e('0x4d')]=function(_0x5d6efa,_0x3e481c){return db[_0x2d0e('0x2f')][_0x2d0e('0x4d')]()[_0x2d0e('0x27')](respondWithResult(_0x3e481c,null))[_0x2d0e('0x45')](handleError(_0x3e481c,null));}; \ No newline at end of file +var _0x85f2=['undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','end','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','ChatTransferReport','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0x85f2,0x1d4));var _0x285f=function(_0x51652a,_0x5144fc){_0x51652a=_0x51652a-0x0;var _0xae7099=_0x85f2[_0x51652a];return _0xae7099;};'use strict';var emlformat=require(_0x285f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x285f('0x1'));var jsonpatch=require(_0x285f('0x2'));var rp=require('request-promise');var moment=require(_0x285f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x285f('0x4'));var csv=require('to-csv');var ejs=require(_0x285f('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x285f('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x285f('0x7'));var deskjs=require(_0x285f('0x8'));var toCsv=require(_0x285f('0x9'));var querystring=require(_0x285f('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x285f('0xb'));var qs=require(_0x285f('0xc'));var as=require(_0x285f('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x285f('0xe'))('api');var utils=require(_0x285f('0xf'));var config=require(_0x285f('0x10'));var licenseUtil=require(_0x285f('0x11'));var db=require(_0x285f('0x12'))['db'];function respondWithStatusCode(_0x1419e1,_0x2f6344){_0x2f6344=_0x2f6344||0xcc;return function(_0x59427f){if(_0x59427f){return _0x1419e1[_0x285f('0x13')](_0x2f6344);}return _0x1419e1['status'](_0x2f6344)['end']();};}function respondWithResult(_0x20ba09,_0x145e0b){_0x145e0b=_0x145e0b||0xc8;return function(_0x129d5c){if(_0x129d5c){return _0x20ba09[_0x285f('0x14')](_0x145e0b)['json'](_0x129d5c);}};}function respondWithFilteredResult(_0x41a591,_0x50c14d){return function(_0x56a0ae){if(_0x56a0ae){var _0x5a010c=typeof _0x50c14d[_0x285f('0x15')]===_0x285f('0x16')&&typeof _0x50c14d['limit']===_0x285f('0x16');var _0xb36457=_0x56a0ae[_0x285f('0x17')];var _0x45404e=_0x5a010c?0x0:_0x50c14d[_0x285f('0x15')];var _0x23a8ec=_0x5a010c?_0x56a0ae[_0x285f('0x17')]:_0x50c14d[_0x285f('0x15')]+_0x50c14d[_0x285f('0x18')];var _0x21a927;if(_0x23a8ec>=_0xb36457){_0x23a8ec=_0xb36457;_0x21a927=0xc8;}else{_0x21a927=0xce;}_0x41a591[_0x285f('0x14')](_0x21a927);return _0x41a591[_0x285f('0x19')](_0x285f('0x1a'),_0x45404e+'-'+_0x23a8ec+'/'+_0xb36457)[_0x285f('0x1b')](_0x56a0ae);}return null;};}function patchUpdates(_0x2a3ec2){return function(_0x3a763b){try{jsonpatch[_0x285f('0x1c')](_0x3a763b,_0x2a3ec2,!![]);}catch(_0x29130e){return BPromise['reject'](_0x29130e);}return _0x3a763b['save']();};}function saveUpdates(_0x259380,_0x19cb75){return function(_0xfb1c89){if(_0xfb1c89){return _0xfb1c89[_0x285f('0x1d')](_0x259380)[_0x285f('0x1e')](function(_0x55dd84){return _0x55dd84;});}return null;};}function removeEntity(_0x1e7d03,_0x4c0e58){return function(_0x99372c){if(_0x99372c){return _0x99372c[_0x285f('0x1f')]()[_0x285f('0x1e')](function(){_0x1e7d03[_0x285f('0x14')](0xcc)[_0x285f('0x20')]();});}};}function handleEntityNotFound(_0x4756d4,_0x1713ed){return function(_0x155be3){if(!_0x155be3){_0x4756d4[_0x285f('0x13')](0x194);}return _0x155be3;};}function handleError(_0xc17911,_0xd9e871){_0xd9e871=_0xd9e871||0x1f4;return function(_0xd0e510){logger[_0x285f('0x21')](_0xd0e510[_0x285f('0x22')]);if(_0xd0e510[_0x285f('0x23')]){delete _0xd0e510[_0x285f('0x23')];}_0xc17911[_0x285f('0x14')](_0xd9e871)[_0x285f('0x24')](_0xd0e510);};}exports['index']=function(_0x8da9de,_0x597983){var _0x4a5e76={},_0x56a1de={},_0x4f6433={'count':0x0,'rows':[]};var _0x585a27=_[_0x285f('0x25')](db['ChatTransferReport'][_0x285f('0x26')],function(_0x379956){return{'name':_0x379956[_0x285f('0x27')],'type':_0x379956[_0x285f('0x28')][_0x285f('0x29')]};});_0x56a1de['model']=_['map'](_0x585a27,_0x285f('0x23'));_0x56a1de[_0x285f('0x2a')]=_[_0x285f('0x2b')](_0x8da9de['query']);_0x56a1de[_0x285f('0x2c')]=_['intersection'](_0x56a1de[_0x285f('0x2d')],_0x56a1de[_0x285f('0x2a')]);_0x4a5e76[_0x285f('0x2e')]=_[_0x285f('0x2f')](_0x56a1de[_0x285f('0x2d')],qs[_0x285f('0x30')](_0x8da9de[_0x285f('0x2a')]['fields']));_0x4a5e76['attributes']=_0x4a5e76[_0x285f('0x2e')][_0x285f('0x31')]?_0x4a5e76[_0x285f('0x2e')]:_0x56a1de['model'];if(!_0x8da9de[_0x285f('0x2a')]['hasOwnProperty'](_0x285f('0x32'))){_0x4a5e76['limit']=qs[_0x285f('0x18')](_0x8da9de['query']['limit']);_0x4a5e76['offset']=qs['offset'](_0x8da9de[_0x285f('0x2a')][_0x285f('0x15')]);}_0x4a5e76[_0x285f('0x33')]=qs[_0x285f('0x34')](_0x8da9de[_0x285f('0x2a')][_0x285f('0x34')]);_0x4a5e76[_0x285f('0x35')]=qs[_0x285f('0x2c')](_[_0x285f('0x36')](_0x8da9de[_0x285f('0x2a')],_0x56a1de[_0x285f('0x2c')]),_0x585a27);if(_0x8da9de['query'][_0x285f('0x37')]){_0x4a5e76[_0x285f('0x35')]=_[_0x285f('0x38')](_0x4a5e76['where'],{'$or':_[_0x285f('0x25')](_0x585a27,function(_0x243127){if(_0x243127[_0x285f('0x28')]!==_0x285f('0x39')){var _0x4bde04={};_0x4bde04[_0x243127[_0x285f('0x23')]]={'$like':'%'+_0x8da9de[_0x285f('0x2a')][_0x285f('0x37')]+'%'};return _0x4bde04;}})});}_0x4a5e76=_['merge']({},_0x4a5e76,_0x8da9de[_0x285f('0x3a')]);var _0x3796d1={'where':_0x4a5e76[_0x285f('0x35')]};return db['ChatTransferReport'][_0x285f('0x17')](_0x3796d1)[_0x285f('0x1e')](function(_0x2ede91){_0x4f6433['count']=_0x2ede91;if(_0x8da9de['query']['includeAll']){_0x4a5e76[_0x285f('0x3b')]=[{'all':!![]}];}return db[_0x285f('0x3c')][_0x285f('0x3d')](_0x4a5e76);})[_0x285f('0x1e')](function(_0x575692){_0x4f6433['rows']=_0x575692;return _0x4f6433;})['then'](respondWithFilteredResult(_0x597983,_0x4a5e76))[_0x285f('0x3e')](handleError(_0x597983,null));};exports[_0x285f('0x3f')]=function(_0x599ecc,_0x30178e){var _0x1bdcd1={'raw':!![],'where':{'id':_0x599ecc[_0x285f('0x40')]['id']}},_0xd37b70={};_0xd37b70[_0x285f('0x2d')]=_[_0x285f('0x2b')](db['ChatTransferReport']['rawAttributes']);_0xd37b70['query']=_[_0x285f('0x2b')](_0x599ecc[_0x285f('0x2a')]);_0xd37b70[_0x285f('0x2c')]=_[_0x285f('0x2f')](_0xd37b70['model'],_0xd37b70[_0x285f('0x2a')]);_0x1bdcd1[_0x285f('0x2e')]=_['intersection'](_0xd37b70[_0x285f('0x2d')],qs[_0x285f('0x30')](_0x599ecc[_0x285f('0x2a')]['fields']));_0x1bdcd1[_0x285f('0x2e')]=_0x1bdcd1[_0x285f('0x2e')][_0x285f('0x31')]?_0x1bdcd1[_0x285f('0x2e')]:_0xd37b70[_0x285f('0x2d')];if(_0x599ecc['query'][_0x285f('0x41')]){_0x1bdcd1[_0x285f('0x3b')]=[{'all':!![]}];}_0x1bdcd1=_[_0x285f('0x38')]({},_0x1bdcd1,_0x599ecc['options']);return db[_0x285f('0x3c')][_0x285f('0x42')](_0x1bdcd1)[_0x285f('0x1e')](handleEntityNotFound(_0x30178e,null))['then'](respondWithResult(_0x30178e,null))[_0x285f('0x3e')](handleError(_0x30178e,null));};exports['create']=function(_0x1fe4fd,_0x452e14){return db[_0x285f('0x3c')][_0x285f('0x43')](_0x1fe4fd[_0x285f('0x44')],{})[_0x285f('0x1e')](respondWithResult(_0x452e14,0xc9))[_0x285f('0x3e')](handleError(_0x452e14,null));};exports['update']=function(_0x23615d,_0x2703da){if(_0x23615d[_0x285f('0x44')]['id']){delete _0x23615d[_0x285f('0x44')]['id'];}return db['ChatTransferReport'][_0x285f('0x42')]({'where':{'id':_0x23615d[_0x285f('0x40')]['id']}})[_0x285f('0x1e')](handleEntityNotFound(_0x2703da,null))[_0x285f('0x1e')](saveUpdates(_0x23615d['body'],null))[_0x285f('0x1e')](respondWithResult(_0x2703da,null))['catch'](handleError(_0x2703da,null));};exports[_0x285f('0x1f')]=function(_0x5ef6cf,_0x39a84d){return db[_0x285f('0x3c')][_0x285f('0x42')]({'where':{'id':_0x5ef6cf[_0x285f('0x40')]['id']}})[_0x285f('0x1e')](handleEntityNotFound(_0x39a84d,null))[_0x285f('0x1e')](removeEntity(_0x39a84d,null))[_0x285f('0x3e')](handleError(_0x39a84d,null));};exports[_0x285f('0x45')]=function(_0x2dee5a,_0x2131d0){return db[_0x285f('0x3c')]['describe']()[_0x285f('0x1e')](respondWithResult(_0x2131d0,null))['catch'](handleError(_0x2131d0,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 75eddad..5705a2f 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 _0x470b=['report_chat_transfer','uniqueid','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatTransferReport'];(function(_0x32bc66,_0x2166ca){var _0xf18755=function(_0x5b7493){while(--_0x5b7493){_0x32bc66['push'](_0x32bc66['shift']());}};_0xf18755(++_0x2166ca);}(_0x470b,0x91));var _0xb470=function(_0x2f5b90,_0x4a6f40){_0x2f5b90=_0x2f5b90-0x0;var _0x53e3d4=_0x470b[_0x2f5b90];return _0x53e3d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb470('0x0'));var moment=require(_0xb470('0x1'));var BPromise=require(_0xb470('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb470('0x3'));var rimraf=require(_0xb470('0x4'));var config=require(_0xb470('0x5'));var attributes=require('./chatTransferReport.attributes');module[_0xb470('0x6')]=function(_0x220a76,_0x1f616a){return _0x220a76[_0xb470('0x7')](_0xb470('0x8'),attributes,{'tableName':_0xb470('0x9'),'paranoid':![],'indexes':[{'name':_0xb470('0xa'),'fields':[_0xb470('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd85a=['uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define','ChatTransferReport'];(function(_0x5bb6ff,_0x5066a0){var _0x57cf27=function(_0x1fc6c3){while(--_0x1fc6c3){_0x5bb6ff['push'](_0x5bb6ff['shift']());}};_0x57cf27(++_0x5066a0);}(_0xd85a,0x1a3));var _0xad85=function(_0x1830f6,_0x537aa1){_0x1830f6=_0x1830f6-0x0;var _0x51f13e=_0xd85a[_0x1830f6];return _0x51f13e;};'use strict';var _=require(_0xad85('0x0'));var util=require(_0xad85('0x1'));var logger=require(_0xad85('0x2'))(_0xad85('0x3'));var moment=require('moment');var BPromise=require(_0xad85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad85('0x5'));var rimraf=require(_0xad85('0x6'));var config=require('../../config/environment');var attributes=require('./chatTransferReport.attributes');module[_0xad85('0x7')]=function(_0x190bae,_0x12fc95){return _0x190bae[_0xad85('0x8')](_0xad85('0x9'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xad85('0xa'),'fields':[_0xad85('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c1c3012..82065fa 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 _0x9a7e=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util'];(function(_0x23a079,_0xb8c9aa){var _0x53f2a5=function(_0x1b3dc5){while(--_0x1b3dc5){_0x23a079['push'](_0x23a079['shift']());}};_0x53f2a5(++_0xb8c9aa);}(_0x9a7e,0xda));var _0xe9a7=function(_0x4994cc,_0x1c5245){_0x4994cc=_0x4994cc-0x0;var _0x4d99cf=_0x9a7e[_0x4994cc];return _0x4d99cf;};'use strict';var _=require(_0xe9a7('0x0'));var util=require(_0xe9a7('0x1'));var moment=require('moment');var BPromise=require(_0xe9a7('0x2'));var rs=require(_0xe9a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9a7('0x4'))['db'];var utils=require(_0xe9a7('0x5'));var logger=require(_0xe9a7('0x6'))(_0xe9a7('0x7'));var config=require(_0xe9a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe9a7('0x9')][_0xe9a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48a279,_0xfd9ef3,_0x34d353){return new BPromise(function(_0xcf000b,_0x2e0709){return client[_0xe9a7('0xb')](_0x48a279,_0x34d353)[_0xe9a7('0xc')](function(_0x52452e){logger['info'](_0xe9a7('0xd'),_0xfd9ef3,'request\x20sent');logger['debug'](_0xe9a7('0xe'),_0xfd9ef3,_0xe9a7('0xf'),JSON[_0xe9a7('0x10')](_0x52452e));if(_0x52452e[_0xe9a7('0x11')]){if(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x12')]===0x1f4){logger[_0xe9a7('0x11')](_0xe9a7('0xd'),_0xfd9ef3,_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);return _0x2e0709(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);}logger['error'](_0xe9a7('0xd'),_0xfd9ef3,_0x52452e[_0xe9a7('0x11')]['message']);return _0xcf000b(_0x52452e[_0xe9a7('0x11')][_0xe9a7('0x13')]);}else{logger[_0xe9a7('0x14')](_0xe9a7('0xd'),_0xfd9ef3,'request\x20sent');_0xcf000b(_0x52452e['result'][_0xe9a7('0x13')]);}})[_0xe9a7('0x15')](function(_0x40590f){logger[_0xe9a7('0x11')](_0xe9a7('0xd'),_0xfd9ef3,_0x40590f);_0x2e0709(_0x40590f);});});} \ No newline at end of file +var _0xc87d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatTransferReport,\x20%s,\x20%s','catch','lodash','bluebird','randomstring','../../config/utils'];(function(_0x30ff67,_0x1f08be){var _0x3d9381=function(_0x4b0bb8){while(--_0x4b0bb8){_0x30ff67['push'](_0x30ff67['shift']());}};_0x3d9381(++_0x1f08be);}(_0xc87d,0x1f4));var _0xdc87=function(_0x1d4aa8,_0x177c03){_0x1d4aa8=_0x1d4aa8-0x0;var _0x1d9b0f=_0xc87d[_0x1d4aa8];return _0x1d9b0f;};'use strict';var _=require(_0xdc87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdc87('0x1'));var rs=require(_0xdc87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc87('0x3'));var logger=require(_0xdc87('0x4'))(_0xdc87('0x5'));var config=require(_0xdc87('0x6'));var jayson=require(_0xdc87('0x7'));var client=jayson['client'][_0xdc87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc21b2f,_0x19da05,_0x24765d){return new BPromise(function(_0xcdd056,_0x325ec8){return client[_0xdc87('0x9')](_0xc21b2f,_0x24765d)[_0xdc87('0xa')](function(_0x2170b8){logger[_0xdc87('0xb')]('ChatTransferReport,\x20%s,\x20%s',_0x19da05,_0xdc87('0xc'));logger[_0xdc87('0xd')](_0xdc87('0xe'),_0x19da05,'request\x20sent',JSON[_0xdc87('0xf')](_0x2170b8));if(_0x2170b8['error']){if(_0x2170b8[_0xdc87('0x10')][_0xdc87('0x11')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x19da05,_0x2170b8[_0xdc87('0x10')][_0xdc87('0x12')]);return _0x325ec8(_0x2170b8['error'][_0xdc87('0x12')]);}logger[_0xdc87('0x10')](_0xdc87('0x13'),_0x19da05,_0x2170b8[_0xdc87('0x10')][_0xdc87('0x12')]);return _0xcdd056(_0x2170b8['error'][_0xdc87('0x12')]);}else{logger[_0xdc87('0xb')](_0xdc87('0x13'),_0x19da05,_0xdc87('0xc'));_0xcdd056(_0x2170b8['result']['message']);}})[_0xdc87('0x14')](function(_0x3a467f){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x19da05,_0x3a467f);_0x325ec8(_0x3a467f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 121e52d..b53a617 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 _0x1f3e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x43a1ef,_0x480444){var _0x46c412=function(_0x3661f8){while(--_0x3661f8){_0x43a1ef['push'](_0x43a1ef['shift']());}};_0x46c412(++_0x480444);}(_0x1f3e,0x1a2));var _0xe1f3=function(_0x347c8b,_0x5c4781){_0x347c8b=_0x347c8b-0x0;var _0x596949=_0x1f3e[_0x347c8b];return _0x596949;};'use strict';var multer=require('multer');var util=require(_0xe1f3('0x0'));var path=require('path');var timeout=require(_0xe1f3('0x1'));var express=require(_0xe1f3('0x2'));var router=express[_0xe1f3('0x3')]();var fs_extra=require(_0xe1f3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe1f3('0x5'));var config=require(_0xe1f3('0x6'));var controller=require(_0xe1f3('0x7'));router[_0xe1f3('0x8')]('/',auth[_0xe1f3('0x9')](),controller[_0xe1f3('0xa')]);router[_0xe1f3('0x8')](_0xe1f3('0xb'),auth[_0xe1f3('0x9')](),controller[_0xe1f3('0xc')]);router[_0xe1f3('0x8')](_0xe1f3('0xd'),auth['isAuthenticated'](),controller[_0xe1f3('0xe')]);router[_0xe1f3('0xf')]('/',auth['isAuthenticated'](),controller[_0xe1f3('0x10')]);router[_0xe1f3('0x11')]('/:id',auth[_0xe1f3('0x9')](),controller[_0xe1f3('0x12')]);router['delete'](_0xe1f3('0xd'),auth[_0xe1f3('0x9')](),controller[_0xe1f3('0x13')]);module[_0xe1f3('0x14')]=router; \ No newline at end of file +var _0x6e82=['../../config/environment','get','isAuthenticated','/describe','describe','put','/:id','update','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x6e82,0xa3));var _0x26e8=function(_0x36a017,_0x2b889c){_0x36a017=_0x36a017-0x0;var _0x226857=_0x6e82[_0x36a017];return _0x226857;};'use strict';var multer=require('multer');var util=require(_0x26e8('0x0'));var path=require(_0x26e8('0x1'));var timeout=require(_0x26e8('0x2'));var express=require(_0x26e8('0x3'));var router=express['Router']();var fs_extra=require(_0x26e8('0x4'));var auth=require(_0x26e8('0x5'));var interaction=require(_0x26e8('0x6'));var config=require(_0x26e8('0x7'));var controller=require('./chatTransferReport.controller');router[_0x26e8('0x8')]('/',auth[_0x26e8('0x9')](),controller['index']);router[_0x26e8('0x8')](_0x26e8('0xa'),auth[_0x26e8('0x9')](),controller[_0x26e8('0xb')]);router[_0x26e8('0x8')]('/:id',auth[_0x26e8('0x9')](),controller['show']);router['post']('/',auth[_0x26e8('0x9')](),controller['create']);router[_0x26e8('0xc')](_0x26e8('0xd'),auth[_0x26e8('0x9')](),controller[_0x26e8('0xe')]);router['delete'](_0x26e8('0xd'),auth[_0x26e8('0x9')](),controller[_0x26e8('0xf')]);module[_0x26e8('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 9d4c43b..8cfbe41 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 _0xe706=['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','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','name','text','onlineForm','parse','textarea','Comments','Leave\x20your\x20comments','getDataValue','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x4be327,_0x180e84){var _0x43b2c8=function(_0x4d1d91){while(--_0x4d1d91){_0x4be327['push'](_0x4be327['shift']());}};_0x43b2c8(++_0x180e84);}(_0xe706,0xa3));var _0x6e70=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0xe706[_0x1be9ce];return _0x164439;};'use strict';var Sequelize=require(_0x6e70('0x0'));var rs=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'unique':_0x6e70('0x4')},'description':{'type':Sequelize[_0x6e70('0x3')]},'mapKey':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'mapKeyOffline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x5')},'key':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x6')},'customerAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6e70('0x3')]},'animation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0xc'),'squared'),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xd')},'start_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xe')},'offline_chat_button':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'header_offline':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x10')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x11')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x14')},'noteTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x16')},'closingMessageButton':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x17')},'conditionAgreement':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x18')},'ratingType':{'type':Sequelize[_0x6e70('0xb')](_0x6e70('0x19'),_0x6e70('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON[_0x6e70('0x1c')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x6e70('0x1d'),'type':_0x6e70('0x1e'),'required':!![]},'props':{'title':_0x6e70('0x1d'),'helpText':''}},{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x6e70('0x1f'))?JSON[_0x6e70('0x20')](this['getDataValue'](_0x6e70('0x1f'))):{};},'set':function(_0x1196ed){return this['setDataValue'](_0x6e70('0x1f'),JSON[_0x6e70('0x1c')](_0x1196ed));}},'offlineForm':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0x6e70('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x6e70('0x5'),'type':_0x6e70('0x5')},'variable':null},{'type':_0x6e70('0x21'),'config':{'placeholder':_0x6e70('0x22')},'props':{'title':'Comments','helpText':_0x6e70('0x23')}}],'fromKey':0x0});},'get':function(){return this[_0x6e70('0x24')](_0x6e70('0x25'))?JSON[_0x6e70('0x20')](this[_0x6e70('0x24')](_0x6e70('0x25'))):{};},'set':function(_0x3f78d2){return this[_0x6e70('0x26')](_0x6e70('0x25'),JSON[_0x6e70('0x1c')](_0x3f78d2));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6e70('0x27')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6e70('0x3')]},'forwardOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6e70('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x28')},'waitingMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x29')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2b')},'skipUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x17')},'sendUnmanaged':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':function(){return _0x6e70('0x2c');}},'notificationSound':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2e')},'verticalAlignment':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x2f')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x6e70('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6e70('0x3')],'allowNull':![],'defaultValue':_0x6e70('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6e70('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x6e70('0x3')],'defaultValue':_0x6e70('0x31')},'systemAvatar':{'type':Sequelize[_0x6e70('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6e70('0x9')],'comment':_0x6e70('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2c0bd1){if(!_0x2c0bd1)this[_0x6e70('0x26')](_0x6e70('0x33'),null);this[_0x6e70('0x26')](_0x6e70('0x34'),_0x2c0bd1);}},'vidaooEscalation':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6e70('0x3')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x6e70('0x35');}},'vidaooMetadata':{'type':Sequelize[_0x6e70('0x1b')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6e70('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6e70('0x1b')]}}; \ No newline at end of file +var _0xcb91=['INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Note','Type\x20a\x20message','Send','Skip','thumb','star','stringify','input','name','text','onlineForm','parse','getDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING','address','email','Agent','#011F6A','#ffffff'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0xcb91[_0x519c88];return _0x4668d7;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1cb9('0x0')]={'name':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'unique':_0x1cb9('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x3')},'key':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x4')},'customerAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1cb9('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x1cb9('0x1')]},'animation':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x1cb9('0x9')]('rounded',_0x1cb9('0xa')),'defaultValue':_0x1cb9('0xb')},'header_online':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xc')},'start_chat_button':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0xd')},'download_transcript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x1cb9('0xf')]},'closingQuestion':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x10')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x11')},'noteTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x12')},'placeholderMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x13')},'closingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x1cb9('0x14')},'skipMessageButton':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'conditionAgreement':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x1cb9('0x9')]('star',_0x1cb9('0x16')),'defaultValue':_0x1cb9('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'variable':null,'config':{'placeholder':_0x1cb9('0x1a'),'type':_0x1cb9('0x1b'),'required':!![]},'props':{'title':_0x1cb9('0x1a'),'helpText':''}},{'type':_0x1cb9('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x1cb9('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x1cb9('0x1c'))?JSON[_0x1cb9('0x1d')](this[_0x1cb9('0x1e')](_0x1cb9('0x1c'))):{};},'set':function(_0x43a100){return this['setDataValue'](_0x1cb9('0x1c'),JSON[_0x1cb9('0x18')](_0x43a100));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x1cb9('0x18')]({'items':[{'type':_0x1cb9('0x19'),'props':{'title':_0x1cb9('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x1cb9('0x3'),'type':_0x1cb9('0x3')},'variable':null},{'type':_0x1cb9('0x1f'),'config':{'placeholder':_0x1cb9('0x20')},'props':{'title':_0x1cb9('0x20'),'helpText':_0x1cb9('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x1cb9('0x1e')]('offlineForm')?JSON[_0x1cb9('0x1d')](this['getDataValue'](_0x1cb9('0x22'))):{};},'set':function(_0x4efebc){return this[_0x1cb9('0x23')](_0x1cb9('0x22'),JSON[_0x1cb9('0x18')](_0x4efebc));}},'token':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x1cb9('0x1')]},'forwardOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x24')},'offlineMessageBody':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x25')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x26')},'skipUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x15')},'sendUnmanaged':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x14')},'enableCustomerAttachment':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x1cb9('0x1')]},'notificationTemplate':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':function(){return _0x1cb9('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x29')},'verticalAlignment':{'type':Sequelize[_0x1cb9('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2a')},'defaultTitle':{'type':Sequelize[_0x1cb9('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':_0x1cb9('0x2b')},'systemAvatar':{'type':Sequelize[_0x1cb9('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'comment':_0x1cb9('0x2c'),'set':function(_0x7a0d8b){if(!_0x7a0d8b)this[_0x1cb9('0x23')](_0x1cb9('0x2d'),null);this[_0x1cb9('0x23')](_0x1cb9('0x2e'),_0x7a0d8b);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x1cb9('0x1')]},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x1cb9('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x1cb9('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x1cb9('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 8c1930a..ae17b04 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 _0xcad0=['Chat','NotifyMailAccount','notifyMail','files','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tags','tag','Command','timezone','iftime\x20%s,%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','getSnippet','Interval','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','Intervals','all','some','server/files/chat/iframe.ejs','remote','connection','remoteAddress','virtual','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','findAndCountAll','priority','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','items','fromKey','getOfflineMessages','Attachment','addAgents','emit','userChatWebsite:save','isArray','userChatWebsite:remove','getAgents','bluebird','mustache','util','path','fs-extra','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','limit','count','set','get','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatWebsite','includeAll','include','findAll','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','CannedAnswer','getAnswers','removeAnswers','ids','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','../../config/license/util','custom','isNil','server/files/images/logos/','download','getAvatar','root','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','chat','CmContact','Sequelize','createdAt','updatedAt','CompanyId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','List','account','Applications','applications','orderBy','ListId','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','interaction','spread','messageId','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','difference','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','attachments','offline-chat','openNewInteraction','transaction','bulkCreate','MailServerOut','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','email','Smtp','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','lastName','offlineMessageSubject'];(function(_0x355d94,_0x534a11){var _0x530338=function(_0x30bd00){while(--_0x30bd00){_0x355d94['push'](_0x355d94['shift']());}};_0x530338(++_0x534a11);}(_0xcad0,0x168));var _0x0cad=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xcad0[_0x36909d];return _0x1fd29d;};'use strict';var BPromise=require(_0x0cad('0x0'));var Mustache=require(_0x0cad('0x1'));var util=require(_0x0cad('0x2'));var path=require(_0x0cad('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cad('0x4'));var _=require('lodash');var querystring=require('querystring');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x0cad('0x5'))(_0x0cad('0x6'));var config=require(_0x0cad('0x7'));var db=require(_0x0cad('0x8'))['db'];config[_0x0cad('0x9')]=_[_0x0cad('0xa')](config[_0x0cad('0x9')],{'host':_0x0cad('0xb'),'port':0x18eb});var socket=require(_0x0cad('0xc'))(new Redis(config['redis']));require(_0x0cad('0xd'))[_0x0cad('0xe')](socket);var htmlToText=require(_0x0cad('0xf'));var jayson=require('jayson/promise');var client=jayson[_0x0cad('0x10')][_0x0cad('0x11')]({'port':0x232c});var client9002=jayson['client'][_0x0cad('0x11')]({'port':0x232a});var client9003=jayson[_0x0cad('0x10')]['http']({'port':0x232b});var client9001=jayson[_0x0cad('0x10')]['http']({'port':0x2329});function respondWithRpcPromise(_0x5ed3c4,_0x182fef,_0x245d53,_0x84ccb2){return new BPromise(function(_0x3d499d,_0x1ea2e2){var _0x281549=_0x84ccb2||client;return _0x281549[_0x0cad('0x12')](_0x5ed3c4,_0x245d53)[_0x0cad('0x13')](function(_0x574be4){logger[_0x0cad('0x14')](_0x0cad('0x15'),_0x182fef,_0x0cad('0x16'));logger[_0x0cad('0x17')](_0x0cad('0x18'),_0x182fef,_0x0cad('0x16'),JSON[_0x0cad('0x19')](_0x574be4));if(_0x574be4[_0x0cad('0x1a')]){if(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1b')]===0x1f4){logger[_0x0cad('0x1a')](_0x0cad('0x15'),_0x182fef,_0x574be4[_0x0cad('0x1a')]['message']);return _0x1ea2e2(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);}logger[_0x0cad('0x1a')](_0x0cad('0x15'),_0x182fef,_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);return _0x3d499d(_0x574be4[_0x0cad('0x1a')][_0x0cad('0x1c')]);}else{logger[_0x0cad('0x14')](_0x0cad('0x15'),_0x182fef,'request\x20sent');_0x3d499d(_0x574be4[_0x0cad('0x1d')][_0x0cad('0x1c')]);}})[_0x0cad('0x1e')](function(_0x345349){logger['error'](_0x0cad('0x15'),_0x182fef,_0x345349);_0x1ea2e2(_0x345349);});});}function respondWithStatusCode(_0x2ee3f1,_0x1383d8){_0x1383d8=_0x1383d8||0xcc;return function(_0x1687ac){if(_0x1687ac){return _0x2ee3f1['sendStatus'](_0x1383d8);}return _0x2ee3f1['status'](_0x1383d8)[_0x0cad('0x1f')]();};}function respondWithResult(_0x289546,_0x34e421){_0x34e421=_0x34e421||0xc8;return function(_0x1eb8c6){if(_0x1eb8c6){return _0x289546[_0x0cad('0x20')](_0x34e421)[_0x0cad('0x21')](_0x1eb8c6);}};}function respondWithFilteredResult(_0x5a32c8,_0x1ab6a6){return function(_0x1ab3ba){if(_0x1ab3ba){var _0xa86d0=typeof _0x1ab6a6[_0x0cad('0x22')]===_0x0cad('0x23')&&typeof _0x1ab6a6[_0x0cad('0x24')]===_0x0cad('0x23');var _0x6e089d=_0x1ab3ba[_0x0cad('0x25')];var _0x5a2996=_0xa86d0?0x0:_0x1ab6a6[_0x0cad('0x22')];var _0x5eaeb1=_0xa86d0?_0x1ab3ba['count']:_0x1ab6a6['offset']+_0x1ab6a6[_0x0cad('0x24')];var _0x1de71e;if(_0x5eaeb1>=_0x6e089d){_0x5eaeb1=_0x6e089d;_0x1de71e=0xc8;}else{_0x1de71e=0xce;}_0x5a32c8[_0x0cad('0x20')](_0x1de71e);return _0x5a32c8[_0x0cad('0x26')]('Content-Range',_0x5a2996+'-'+_0x5eaeb1+'/'+_0x6e089d)[_0x0cad('0x21')](_0x1ab3ba);}return null;};}function saveUpdates(_0x347c32){return function(_0x3f23c7){if(_0x3f23c7){return _0x3f23c7['update'](_0x347c32)[_0x0cad('0x13')](function(_0x276bec){return _0x276bec;});}return null;};}function removeEntity(_0x4fb425){return function(_0x36ac01){if(_0x36ac01){return _0x36ac01['destroy']()['then'](function(){var _0x3a3b0f=_0x36ac01[_0x0cad('0x27')]({'plain':!![]});var _0x1c978f=_0x0cad('0x28');return db[_0x0cad('0x29')][_0x0cad('0x2a')]({'where':{'type':_0x1c978f,'resourceId':_0x3a3b0f['id']}})[_0x0cad('0x13')](function(){return _0x36ac01;});})[_0x0cad('0x13')](function(){_0x4fb425['status'](0xcc)[_0x0cad('0x1f')]();});}};}function handleEntityNotFound(_0xefcc89){return function(_0x5eb2f4){if(!_0x5eb2f4){_0xefcc89[_0x0cad('0x2b')](0x194);}return _0x5eb2f4;};}function handleError(_0x55cbde,_0x2ccf28){_0x2ccf28=_0x2ccf28||0x1f4;return function(_0x22899f){logger[_0x0cad('0x1a')](_0x22899f[_0x0cad('0x2c')]);if(_0x22899f[_0x0cad('0x2d')]){delete _0x22899f['name'];}_0x55cbde[_0x0cad('0x20')](_0x2ccf28)[_0x0cad('0x2e')](_0x22899f);};}exports[_0x0cad('0x2f')]=function(_0xcd6b7f,_0x43c4a9){var _0x463a3f={'include':[{'model':db[_0x0cad('0x30')],'as':_0x0cad('0x31')}]},_0x3b13c8={},_0x7e7a75={'count':0x0,'rows':[]};var _0x478170=_[_0x0cad('0x32')](db['ChatWebsite'][_0x0cad('0x33')],function(_0x4a1a9d){return{'name':_0x4a1a9d['fieldName'],'type':_0x4a1a9d[_0x0cad('0x34')]['key']};});_0x3b13c8[_0x0cad('0x35')]=_[_0x0cad('0x32')](_0x478170,_0x0cad('0x2d'));_0x3b13c8[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0xcd6b7f[_0x0cad('0x36')]);_0x3b13c8[_0x0cad('0x38')]=_['intersection'](_0x3b13c8[_0x0cad('0x35')],_0x3b13c8[_0x0cad('0x36')]);_0x463a3f[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x3b13c8[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x463a3f[_0x0cad('0x39')]=_0x463a3f[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x463a3f[_0x0cad('0x39')]:_0x3b13c8[_0x0cad('0x35')];if(!_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x463a3f[_0x0cad('0x24')]=qs['limit'](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x24')]);_0x463a3f['offset']=qs[_0x0cad('0x22')](_0xcd6b7f['query'][_0x0cad('0x22')]);}_0x463a3f[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x40')]);_0x463a3f['where']=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0xcd6b7f[_0x0cad('0x36')],_0x3b13c8[_0x0cad('0x38')]),_0x478170);if(_0xcd6b7f['query'][_0x0cad('0x42')]){_0x463a3f[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x463a3f[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x478170,function(_0x535765){if(_0x535765[_0x0cad('0x34')]!=='VIRTUAL'){var _0x3f2082={};_0x3f2082[_0x535765[_0x0cad('0x2d')]]={'$like':'%'+_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x3f2082;}})});}_0x463a3f=_[_0x0cad('0x44')]({},_0x463a3f,_0xcd6b7f[_0x0cad('0x45')]);var _0x338345={'where':_0x463a3f[_0x0cad('0x43')]};return db[_0x0cad('0x46')][_0x0cad('0x25')](_0x338345)[_0x0cad('0x13')](function(_0xbd44bb){_0x7e7a75[_0x0cad('0x25')]=_0xbd44bb;if(_0xcd6b7f[_0x0cad('0x36')][_0x0cad('0x47')]){_0x463a3f[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x46')][_0x0cad('0x49')](_0x463a3f);})['then'](function(_0x32aaa3){_0x7e7a75[_0x0cad('0x4a')]=_0x32aaa3;return _0x7e7a75;})[_0x0cad('0x13')](respondWithFilteredResult(_0x43c4a9,_0x463a3f))[_0x0cad('0x1e')](handleError(_0x43c4a9,null));};exports['show']=function(_0x540e33,_0x3788d2){var _0x140dd1={'raw':![],'where':{'id':_0x540e33[_0x0cad('0x4b')]['id']},'include':[{'model':db['Pause'],'as':_0x0cad('0x31')}]},_0x41dd03={};_0x41dd03[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x46')]['rawAttributes']);_0x41dd03['query']=_[_0x0cad('0x37')](_0x540e33[_0x0cad('0x36')]);_0x41dd03[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x41dd03[_0x0cad('0x35')],_0x41dd03[_0x0cad('0x36')]);_0x140dd1[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x41dd03[_0x0cad('0x35')],qs['fields'](_0x540e33[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x140dd1[_0x0cad('0x39')]=_0x140dd1[_0x0cad('0x39')]['length']?_0x140dd1[_0x0cad('0x39')]:_0x41dd03[_0x0cad('0x35')];if(_0x540e33[_0x0cad('0x36')][_0x0cad('0x47')]){_0x140dd1[_0x0cad('0x48')]=[{'all':!![]}];}_0x140dd1=_[_0x0cad('0x44')]({},_0x140dd1,_0x540e33[_0x0cad('0x45')]);return db[_0x0cad('0x46')]['find'](_0x140dd1)[_0x0cad('0x13')](handleEntityNotFound(_0x3788d2,null))[_0x0cad('0x13')](respondWithResult(_0x3788d2,null))[_0x0cad('0x1e')](handleError(_0x3788d2,null));};exports[_0x0cad('0x4c')]=function(_0x4e21ef,_0x14e0ec){return db[_0x0cad('0x46')][_0x0cad('0x4c')](_0x4e21ef[_0x0cad('0x4d')],{})[_0x0cad('0x13')](function(_0x5eab62){var _0x5149b5=_0x4e21ef[_0x0cad('0x4e')][_0x0cad('0x27')]({'plain':!![]});if(!_0x5149b5)throw new Error(_0x0cad('0x4f'));if(_0x5149b5[_0x0cad('0x50')]===_0x0cad('0x4e')){var _0x151cf6=_0x5eab62[_0x0cad('0x27')]({'plain':!![]});var _0x20f700='ChatWebsites';return db[_0x0cad('0x51')][_0x0cad('0x52')]({'where':{'name':_0x20f700,'userProfileId':_0x5149b5[_0x0cad('0x53')]},'raw':!![]})[_0x0cad('0x13')](function(_0x1e800b){if(_0x1e800b&&_0x1e800b[_0x0cad('0x54')]===0x0){return db[_0x0cad('0x29')][_0x0cad('0x4c')]({'name':_0x151cf6[_0x0cad('0x2d')],'resourceId':_0x151cf6['id'],'type':_0x1e800b[_0x0cad('0x2d')],'sectionId':_0x1e800b['id']},{})[_0x0cad('0x13')](function(){return _0x5eab62;});}else{return _0x5eab62;}})[_0x0cad('0x1e')](function(_0x51d462){logger[_0x0cad('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x51d462);throw _0x51d462;});}return _0x5eab62;})[_0x0cad('0x13')](respondWithResult(_0x14e0ec,0xc9))[_0x0cad('0x1e')](handleError(_0x14e0ec,null));};exports['update']=function(_0x56cb03,_0xfbe0b9){if(_0x56cb03[_0x0cad('0x4d')]['id']){delete _0x56cb03[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x56cb03[_0x0cad('0x4b')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x0cad('0x13')](handleEntityNotFound(_0xfbe0b9,null))[_0x0cad('0x13')](saveUpdates(_0x56cb03[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0xfbe0b9,null))['catch'](handleError(_0xfbe0b9,null));};exports[_0x0cad('0x2a')]=function(_0x49d2de,_0x16e96b){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x49d2de[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x16e96b,null))[_0x0cad('0x13')](removeEntity(_0x16e96b,null))[_0x0cad('0x1e')](handleError(_0x16e96b,null));};exports[_0x0cad('0x55')]=function(_0x198fb7,_0x4d55a3){return db['ChatWebsite'][_0x0cad('0x55')]()[_0x0cad('0x13')](respondWithResult(_0x4d55a3,null))[_0x0cad('0x1e')](handleError(_0x4d55a3,null));};exports[_0x0cad('0x56')]=function(_0x264950,_0x2deb57){if(_0x264950[_0x0cad('0x4d')]['id']){delete _0x264950[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x264950[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x2deb57,null))[_0x0cad('0x13')](function(_0x3dc0d8){if(_0x3dc0d8){_0x264950[_0x0cad('0x4d')][_0x0cad('0x57')]=_0x3dc0d8['id'];return db[_0x0cad('0x58')][_0x0cad('0x4c')](_0x264950[_0x0cad('0x4d')]);}})[_0x0cad('0x13')](respondWithResult(_0x2deb57,null))[_0x0cad('0x1e')](handleError(_0x2deb57,null));};exports[_0x0cad('0x59')]=function(_0x241a34,_0x390553){var _0x4f71af={'raw':![],'where':{}};var _0x56e434={};var _0x5ca327={'count':0x0,'rows':[]};return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x241a34[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x390553,null))[_0x0cad('0x13')](function(_0x598867){if(_0x598867){_0x56e434[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x58')]['rawAttributes']);_0x56e434[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x241a34[_0x0cad('0x36')]);_0x56e434['filters']=_['intersection'](_0x56e434[_0x0cad('0x35')],_0x56e434[_0x0cad('0x36')]);_0x4f71af['attributes']=_[_0x0cad('0x3a')](_0x56e434[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x241a34[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x4f71af[_0x0cad('0x39')]=_0x4f71af[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x4f71af[_0x0cad('0x39')]:_0x56e434['model'];if(!_0x241a34[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x4f71af[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x241a34['query'][_0x0cad('0x24')]);_0x4f71af[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x241a34['query']['offset']);}_0x4f71af[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x241a34[_0x0cad('0x36')][_0x0cad('0x40')]);_0x4f71af[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x241a34[_0x0cad('0x36')],_0x56e434[_0x0cad('0x38')]));_0x4f71af['where'][_0x0cad('0x57')]=_0x598867['id'];if(_0x241a34[_0x0cad('0x36')][_0x0cad('0x42')]){_0x4f71af[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x4f71af[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x4f71af[_0x0cad('0x39')],function(_0x5bbbe0){var _0x2fb5c8={};_0x2fb5c8[_0x5bbbe0]={'$like':'%'+_0x241a34[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x2fb5c8;})});}_0x4f71af=_['merge']({},_0x4f71af,_0x241a34[_0x0cad('0x45')]);return db[_0x0cad('0x58')][_0x0cad('0x25')]({'where':_0x4f71af['where']})[_0x0cad('0x13')](function(_0x3cd1ef){_0x5ca327[_0x0cad('0x25')]=_0x3cd1ef;if(_0x241a34[_0x0cad('0x36')][_0x0cad('0x47')]){_0x4f71af[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x58')][_0x0cad('0x49')](_0x4f71af);})['then'](function(_0x2f2470){_0x5ca327[_0x0cad('0x4a')]=_0x2f2470;return _0x5ca327;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x390553,_0x4f71af))['catch'](handleError(_0x390553,null));};exports[_0x0cad('0x5b')]=function(_0x397e4f,_0xc8f8ad){return db[_0x0cad('0x46')]['find']({'where':{'id':_0x397e4f['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0xc8f8ad,null))[_0x0cad('0x13')](function(_0x707b69){if(_0x707b69){return _0x707b69[_0x0cad('0x5b')](_0x397e4f[_0x0cad('0x36')]['ids']);}})['then'](respondWithStatusCode(_0xc8f8ad,null))['catch'](handleError(_0xc8f8ad,null));};exports['addAnswer']=function(_0x39c28f,_0x1d4f23){if(_0x39c28f[_0x0cad('0x4d')]['id']){delete _0x39c28f[_0x0cad('0x4d')]['id'];}return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x39c28f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x1d4f23,null))[_0x0cad('0x13')](function(_0x598af6){if(_0x598af6){_0x39c28f[_0x0cad('0x4d')][_0x0cad('0x57')]=_0x598af6['id'];return db[_0x0cad('0x5c')]['create'](_0x39c28f[_0x0cad('0x4d')]);}})[_0x0cad('0x13')](respondWithResult(_0x1d4f23,null))[_0x0cad('0x1e')](handleError(_0x1d4f23,null));};exports[_0x0cad('0x5d')]=function(_0x41c8e3,_0x1e4cc0){var _0x437571={'raw':![],'where':{}};var _0x46b705={};var _0x44401d={'count':0x0,'rows':[]};return db[_0x0cad('0x46')]['findOne']({'where':{'id':_0x41c8e3['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x1e4cc0,null))[_0x0cad('0x13')](function(_0x4a06ca){if(_0x4a06ca){_0x46b705[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x5c')]['rawAttributes']);_0x46b705[_0x0cad('0x36')]=_['keys'](_0x41c8e3[_0x0cad('0x36')]);_0x46b705[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x46b705[_0x0cad('0x35')],_0x46b705[_0x0cad('0x36')]);_0x437571[_0x0cad('0x39')]=_['intersection'](_0x46b705['model'],qs['fields'](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x437571['attributes']=_0x437571[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x437571[_0x0cad('0x39')]:_0x46b705[_0x0cad('0x35')];if(!_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x437571[_0x0cad('0x24')]=qs['limit'](_0x41c8e3['query'][_0x0cad('0x24')]);_0x437571[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x22')]);}_0x437571[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x40')]);_0x437571[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x41c8e3[_0x0cad('0x36')],_0x46b705[_0x0cad('0x38')]));_0x437571[_0x0cad('0x43')][_0x0cad('0x57')]=_0x4a06ca['id'];if(_0x41c8e3[_0x0cad('0x36')]['filter']){_0x437571[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x437571[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x437571[_0x0cad('0x39')],function(_0x28f9ca){var _0x128815={};_0x128815[_0x28f9ca]={'$like':'%'+_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x128815;})});}_0x437571=_['merge']({},_0x437571,_0x41c8e3[_0x0cad('0x45')]);return db['CannedAnswer']['count']({'where':_0x437571['where']})[_0x0cad('0x13')](function(_0x24790d){_0x44401d[_0x0cad('0x25')]=_0x24790d;if(_0x41c8e3[_0x0cad('0x36')][_0x0cad('0x47')]){_0x437571[_0x0cad('0x48')]=[{'all':!![]}];}return db[_0x0cad('0x5c')][_0x0cad('0x49')](_0x437571);})[_0x0cad('0x13')](function(_0x291b92){_0x44401d[_0x0cad('0x4a')]=_0x291b92;return _0x44401d;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x1e4cc0,_0x437571))[_0x0cad('0x1e')](handleError(_0x1e4cc0,null));};exports[_0x0cad('0x5e')]=function(_0x4cd210,_0x37bc7d){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x4cd210['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x37bc7d,null))[_0x0cad('0x13')](function(_0x1a393f){if(_0x1a393f){return _0x1a393f['removeAnswers'](_0x4cd210[_0x0cad('0x36')][_0x0cad('0x5f')]);}})[_0x0cad('0x13')](respondWithStatusCode(_0x37bc7d,null))[_0x0cad('0x1e')](handleError(_0x37bc7d,null));};exports['addLogo']=function(_0x446f84,_0x4d87ce){_0x446f84[_0x0cad('0x4d')][_0x0cad('0x60')]=_0x446f84[_0x0cad('0x61')][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x446f84[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x4d87ce,null))[_0x0cad('0x13')](saveUpdates(_0x446f84[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x4d87ce,null))[_0x0cad('0x1e')](handleError(_0x4d87ce,null));};exports['addAvatar']=function(_0x159428,_0x51b772){_0x159428['body'][_0x0cad('0x63')]=_0x159428[_0x0cad('0x61')][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x159428['params']['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x51b772,null))['then'](saveUpdates(_0x159428[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x51b772,null))['catch'](handleError(_0x51b772,null));};exports[_0x0cad('0x64')]=function(_0x4dbbf0,_0x1115dd){_0x4dbbf0['body'][_0x0cad('0x65')]=_0x4dbbf0['file'][_0x0cad('0x62')];return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x4dbbf0[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1115dd,null))[_0x0cad('0x13')](saveUpdates(_0x4dbbf0['body'],null))[_0x0cad('0x13')](respondWithResult(_0x1115dd,null))[_0x0cad('0x1e')](handleError(_0x1115dd,null));};exports[_0x0cad('0x66')]=function(_0xd16af6,_0x434c99){_0xd16af6[_0x0cad('0x4d')][_0x0cad('0x67')]=_0xd16af6['file'][_0x0cad('0x62')];return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0xd16af6[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x434c99,null))[_0x0cad('0x13')](saveUpdates(_0xd16af6[_0x0cad('0x4d')],null))[_0x0cad('0x13')](respondWithResult(_0x434c99,null))[_0x0cad('0x1e')](handleError(_0x434c99,null));};exports[_0x0cad('0x68')]=function(_0x210fd9,_0x4a86b0){var _0x2913b1=path[_0x0cad('0x69')](config['root'],'server/files/images/logos/default_logo.svg');var _0x203f91={'where':{'id':_0x210fd9[_0x0cad('0x4b')]['id']},'attributes':['id',_0x0cad('0x60')],'raw':!![]};var _0x48a2c6=![];return require(_0x0cad('0x6a'))['getLicense']()[_0x0cad('0x13')](function(_0x10d072){if(_0x10d072){_0x48a2c6=_0x10d072[_0x0cad('0x6b')];}})[_0x0cad('0x13')](function(){return db[_0x0cad('0x46')]['find'](_0x203f91);})[_0x0cad('0x13')](handleEntityNotFound(_0x4a86b0,null))[_0x0cad('0x13')](function(_0x6e4b92){if(_0x6e4b92){if(!_[_0x0cad('0x6c')](_0x6e4b92[_0x0cad('0x60')])){if(fs['existsSync'](path[_0x0cad('0x69')](config['root'],_0x0cad('0x6d'),_0x6e4b92[_0x0cad('0x60')]))&&_0x48a2c6){_0x2913b1=path['join'](config['root'],_0x0cad('0x6d'),_0x6e4b92[_0x0cad('0x60')]);}}return _0x4a86b0[_0x0cad('0x6e')](_0x2913b1);}})['catch'](handleError(_0x4a86b0,null));};exports[_0x0cad('0x6f')]=function(_0x35091d,_0x4df3f2){var _0x55248d=path['join'](config[_0x0cad('0x70')],_0x0cad('0x71'));var _0x5adb68={'where':{'id':_0x35091d[_0x0cad('0x4b')]['id']},'attributes':['id',_0x0cad('0x63')],'raw':!![]};return db['ChatWebsite'][_0x0cad('0x52')](_0x5adb68)[_0x0cad('0x13')](handleEntityNotFound(_0x4df3f2,null))[_0x0cad('0x13')](function(_0xcc40c){if(_0xcc40c){if(!_[_0x0cad('0x6c')](_0xcc40c[_0x0cad('0x63')])){if(fs[_0x0cad('0x72')](path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0xcc40c[_0x0cad('0x63')]))){_0x55248d=path['join'](config[_0x0cad('0x70')],_0x0cad('0x73'),_0xcc40c[_0x0cad('0x63')]);}}return _0x4df3f2[_0x0cad('0x6e')](_0x55248d);}})['catch'](handleError(_0x4df3f2,null));};exports[_0x0cad('0x74')]=function(_0x4e150b,_0x2e2d73){var _0x35712d=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x75'));var _0x58a80a={'where':{'id':_0x4e150b['params']['id']},'attributes':['id',_0x0cad('0x65'),'showCustomerAvatar'],'raw':!![]};return db[_0x0cad('0x46')][_0x0cad('0x52')](_0x58a80a)[_0x0cad('0x13')](handleEntityNotFound(_0x2e2d73,null))[_0x0cad('0x13')](function(_0x16145d){if(_0x16145d){if(!_[_0x0cad('0x6c')](_0x16145d['customerAvatar'])){if(fs['existsSync'](path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x16145d[_0x0cad('0x65')]))&&_0x16145d[_0x0cad('0x76')]){_0x35712d=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x16145d[_0x0cad('0x65')]);}}return _0x2e2d73['download'](_0x35712d);}})[_0x0cad('0x1e')](handleError(_0x2e2d73,null));};exports[_0x0cad('0x77')]=function(_0x1f31a6,_0x58f518){var _0x18a26f=path['join'](config['root'],_0x0cad('0x78'));var _0xba7351={'where':{'id':_0x1f31a6['params']['id']},'attributes':['id',_0x0cad('0x67')],'raw':!![]};return db[_0x0cad('0x46')][_0x0cad('0x52')](_0xba7351)[_0x0cad('0x13')](handleEntityNotFound(_0x58f518,null))['then'](function(_0x3f4271){if(_0x3f4271){if(!_[_0x0cad('0x6c')](_0x3f4271['systemAvatar'])){if(fs[_0x0cad('0x72')](path[_0x0cad('0x69')](config['root'],'server/files/images/avatars/',_0x3f4271[_0x0cad('0x67')]))){_0x18a26f=path[_0x0cad('0x69')](config[_0x0cad('0x70')],_0x0cad('0x73'),_0x3f4271[_0x0cad('0x67')]);}}return _0x58f518[_0x0cad('0x6e')](_0x18a26f);}})[_0x0cad('0x1e')](handleError(_0x58f518,null));};exports[_0x0cad('0x79')]=function(_0x41b54a,_0x3a2df2){var _0x149aac=require(_0x0cad('0x7a'));var _0x5f0a7c=new _0x149aac();var _0x3bf079=_0x5f0a7c[_0x0cad('0x7b')](_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x7d')])['getResult']();var _0x3029e7={'body':_0x41b54a[_0x0cad('0x4d')],'channel':_0x0cad('0x7e')};var _0x58070f=[];var _0x29ceda=[];var _0x5d619f={};var _0x2726c4=![];return db[_0x0cad('0x7f')]['describe']()['then'](function(_0x1b1181){if(!_0x1b1181){throw new db[(_0x0cad('0x80'))]['ValidationError']('no\x20available\x20attributes');}_0x58070f=_['difference'](_['keys'](_0x1b1181),[_0x0cad('0x81'),_0x0cad('0x82')]);_0x29ceda=_['difference'](_[_0x0cad('0x37')](_0x1b1181),[_0x0cad('0x81'),'updatedAt',_0x0cad('0x83'),'ListId']);if(_0x41b54a[_0x0cad('0x4d')]['id']){delete _0x41b54a['body']['id'];}if(_['isNil'](_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')])){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))](_0x0cad('0x86'));}if(_[_0x0cad('0x6c')](_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x4d')])||_0x41b54a['body']['body']===''){throw new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x87'));}if(_[_0x0cad('0x6c')](_0x41b54a['body'][_0x0cad('0x88')])){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))](_0x0cad('0x89')+_0x29ceda);}if(!_[_0x0cad('0x8a')](_0x29ceda,_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x88')])){throw new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x8b')+_0x29ceda);}_0x5d619f[_0x41b54a['body'][_0x0cad('0x88')]]=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')];})[_0x0cad('0x13')](function(){return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x41b54a[_0x0cad('0x4b')]['id']},'include':[{'model':db[_0x0cad('0x8c')],'as':'List','include':[{'model':db[_0x0cad('0x7f')],'as':_0x0cad('0x8d'),'where':_0x5d619f,'limit':0x1,'order':[[_0x0cad('0x82'),_0x0cad('0x8e')]]}]},{'model':db[_0x0cad('0x8f')],'as':'Applications'}]});})[_0x0cad('0x13')](handleEntityNotFound(_0x3a2df2,null))[_0x0cad('0x13')](function(_0x44410d){if(_0x44410d&&_0x44410d[_0x0cad('0x90')]){_0x3029e7[_0x0cad('0x91')]=_0x44410d;_0x3029e7['applications']=_0x44410d[_0x0cad('0x92')];_0x3029e7['list']=_0x44410d[_0x0cad('0x90')];_0x3029e7[_0x0cad('0x93')]=_[_0x0cad('0x94')](_0x3029e7[_0x0cad('0x93')],['priority'],['asc']);if(_0x3029e7['account']['Applications']){delete _0x3029e7['account'][_0x0cad('0x92')];}if(_0x3029e7[_0x0cad('0x91')]['List']&&_0x3029e7['account'][_0x0cad('0x90')][_0x0cad('0x8d')][_0x0cad('0x3c')]){return _0x3029e7['account'][_0x0cad('0x90')]['Contacts'][0x0];}var _0x1cd958=_['defaults'](_0x41b54a[_0x0cad('0x4d')],{'firstName':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')],'ListId':_0x44410d[_0x0cad('0x95')]});_0x1cd958[_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x88')]]=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x84')];return db[_0x0cad('0x7f')][_0x0cad('0x4c')](_0x1cd958,{'fields':_0x58070f,'raw':!![]});}})[_0x0cad('0x13')](handleEntityNotFound(_0x3a2df2,null))['then'](function(_0x178522){_0x3029e7[_0x0cad('0x96')]=_0x178522;var _0x3b45be=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x97')];if(_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x98')]){_0x3b45be=_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x98')];}else if(_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x99')]){_0x3b45be=_[_0x0cad('0x9a')](_0x41b54a[_0x0cad('0x7c')][_0x0cad('0x99')][_0x0cad('0x9b')](','));}if(_0x178522){var _0x52f1c0={'ContactId':_0x178522['id'],'ChatWebsiteId':_0x41b54a['params']['id'],'from':(_0x178522[_0x0cad('0x9c')]||'')+'\x20'+(_0x178522['lastName']||''),'customerIp':_0x3b45be,'customerPort':_0x41b54a['headers'][_0x0cad('0x9d')]?_0x41b54a['headers'][_0x0cad('0x9d')]:null,'referer':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0x9e')],'browserName':_0x3bf079['browser']['name']&&_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]?util[_0x0cad('0xa1')](_0x0cad('0xa2'),_0x3bf079[_0x0cad('0x9f')][_0x0cad('0x2d')],_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]):_0x0cad('0xa3'),'browserVersion':_0x3bf079[_0x0cad('0x9f')][_0x0cad('0xa0')]||'unknown','osName':util[_0x0cad('0xa1')](_0x0cad('0xa2'),_0x3bf079['os']['name'],_0x3bf079['os'][_0x0cad('0xa0')]),'osVersion':_0x3bf079['os'][_0x0cad('0xa0')],'deviceModel':_0x3bf079[_0x0cad('0xa4')]['model']&&_0x3bf079[_0x0cad('0xa4')][_0x0cad('0xa5')]?util[_0x0cad('0xa1')](_0x0cad('0xa6'),_0x3bf079[_0x0cad('0xa4')]['model'],_0x3bf079['device'][_0x0cad('0xa5')],_0x3bf079[_0x0cad('0xa4')]['type']):null,'deviceVendor':_0x3bf079[_0x0cad('0xa4')][_0x0cad('0xa5')],'deviceType':_0x3bf079['device'][_0x0cad('0x34')],'formData':JSON[_0x0cad('0x19')](_0x41b54a['body'])};var _0x3c3894={'ChatWebsiteId':_0x41b54a[_0x0cad('0x4b')]['id'],'closed':![]};if(_0x41b54a['body']['threadId']){_0x3c3894[_0x0cad('0xa7')]=_0x41b54a[_0x0cad('0x4d')]['threadId'];return db[_0x0cad('0xa8')][_0x0cad('0x52')]({'where':_0x3c3894})[_0x0cad('0x13')](function(_0x53454d){if(_0x53454d){return[_0x53454d,![]];}_0x52f1c0['threadId']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa7')];_0x52f1c0['externalUrl']=_0x41b54a[_0x0cad('0x4d')]['externalUrl'];return db[_0x0cad('0xa8')][_0x0cad('0x4c')](_0x52f1c0)[_0x0cad('0x13')](function(_0x108614){return[_0x108614,!![]];});});}_0x3c3894['ContactId']=_0x178522['id'];if(_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa9')]&&_0x41b54a['body'][_0x0cad('0xa9')]['id']){_0x3c3894['id']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xa9')]['id'];return db[_0x0cad('0xa8')][_0x0cad('0x52')]({'where':_0x3c3894})['then'](function(_0x198a68){if(_0x198a68){return[_0x198a68,![]];}return db[_0x0cad('0xa8')]['create'](_0x52f1c0)[_0x0cad('0x13')](function(_0x3d66b5){return[_0x3d66b5,!![]];});});}return db[_0x0cad('0xa8')][_0x0cad('0x4c')](_0x52f1c0)[_0x0cad('0x13')](function(_0x51a707){return[_0x51a707,!![]];});}})[_0x0cad('0xaa')](function(_0x2f2b2d,_0xcb0b04){if(_0x2f2b2d){_0x2726c4=_0xcb0b04;if(!_0xcb0b04){var _0x4fb183={'from':(_0x3029e7[_0x0cad('0x96')][_0x0cad('0x9c')]||'')+'\x20'+(_0x3029e7['contact']['lastName']||'')};if(_0x41b54a['body'][_0x0cad('0xa7')]&&_0x41b54a[_0x0cad('0x4d')]['messageId']&&_0x41b54a[_0x0cad('0x4d')]['threadId']!=_0x41b54a[_0x0cad('0x4d')]['messageId']){_0x4fb183['threadId']=_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xab')];}return _0x2f2b2d['update'](_0x4fb183);}else{return _0x2f2b2d;}}})[_0x0cad('0x13')](function(_0x6ab081){_0x3029e7[_0x0cad('0xa9')]=_0x6ab081['get']({'plain':!![]});_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xac')]=_0x2726c4;if(_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xac')]){if(_0x3029e7[_0x0cad('0x91')][_0x0cad('0xad')]){_0x3029e7[_0x0cad('0x93')][_0x0cad('0xae')]({'id':0x0,'priority':_0x3029e7[_0x0cad('0x93')][_0x0cad('0x3c')]+0x1,'app':_0x0cad('0xaf'),'appdata':'unmanaged','interval':_0x0cad('0xb0')});}}return db['ChatMessage'][_0x0cad('0x4c')]({'body':_0x41b54a[_0x0cad('0x4d')]['body'],'ChatWebsiteId':_0x41b54a[_0x0cad('0x4b')]['id'],'ChatInteractionId':_0x6ab081['id'],'direction':'in','ContactId':_0x3029e7[_0x0cad('0x96')]['id'],'AttachmentId':_0x41b54a[_0x0cad('0x4d')][_0x0cad('0xb1')]});})[_0x0cad('0x13')](function(_0xe0bc58){_0x3029e7[_0x0cad('0x1c')]=_0xe0bc58;if(_0x3029e7['interaction'][_0x0cad('0xb2')]){return db[_0x0cad('0xb3')]['find']({'attributes':['id','name'],'where':{'id':_0x3029e7[_0x0cad('0xa9')][_0x0cad('0xb2')]}})[_0x0cad('0x13')](function(_0x4b5488){if(_0x4b5488){_0x3029e7['applications'][_0x0cad('0xb4')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b5488['name']+','+(_0x3029e7[_0x0cad('0x91')][_0x0cad('0xb5')]||0xa),'interval':_0x0cad('0xb0')});_0x3029e7['forcedOwnership']=!![];}return respondWithRpcPromise(_0x0cad('0xb6'),_0x0cad('0xb7'),_0x3029e7);});}return respondWithRpcPromise('Start',_0x0cad('0xb7'),_0x3029e7);})[_0x0cad('0x13')](function(_0x5272ea){respondWithRpcPromise(_0x0cad('0xb8'),_0x0cad('0xb8'),{'event':'notify','message':_0x5272ea},client9002);return _0x5272ea;})['then'](respondWithResult(_0x3a2df2,null))[_0x0cad('0x1e')](handleError(_0x3a2df2,null));};exports[_0x0cad('0xb9')]=function(_0x3aca67,_0x2980a7){var _0x7bd5f2,_0x579989,_0x1511ec;var _0x67e894=[];var _0x26b668={};var _0x30e050=_0x3aca67['files']||[];var _0x595fe8=[];var _0x5b1bb3;return db[_0x0cad('0x7f')][_0x0cad('0x55')]()['then'](function(_0x545854){if(!_0x545854){throw new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))]('no\x20available\x20attributes');}_0x67e894=_[_0x0cad('0xba')](_[_0x0cad('0x37')](_0x545854),[_0x0cad('0x81'),_0x0cad('0x82'),_0x0cad('0x83'),_0x0cad('0x95')]);if(_0x3aca67[_0x0cad('0x4d')]['id']){delete _0x3aca67['body']['id'];}if(_['isNil'](_0x3aca67[_0x0cad('0x4d')]['from'])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)['send'](new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0x86')));}if(_[_0x0cad('0x6c')](_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x4d')])||_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x4d')]===''){throw _0x2980a7['status'](0x1f4)['send'](new db[(_0x0cad('0x80'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x0cad('0x6c')](_0x3aca67[_0x0cad('0x4d')][_0x0cad('0xbb')])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)[_0x0cad('0x2e')](new db['Sequelize'][(_0x0cad('0x85'))](_0x0cad('0xbc')+_0x67e894));}if(!_[_0x0cad('0x8a')](_0x67e894,_0x3aca67[_0x0cad('0x4d')]['mapKeyOffline'])){throw _0x2980a7[_0x0cad('0x20')](0x1f4)['send'](new db[(_0x0cad('0x80'))][(_0x0cad('0x85'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x67e894));}_0x26b668[_0x3aca67[_0x0cad('0x4d')][_0x0cad('0xbb')]]=_0x3aca67[_0x0cad('0x4d')]['from'];})[_0x0cad('0x13')](function(){return db['ChatWebsite'][_0x0cad('0x52')]({'where':{'id':_0x3aca67[_0x0cad('0x4b')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x0cad('0xbd')],'as':_0x0cad('0xbd')}]});})['then'](handleEntityNotFound(_0x2980a7,null))[_0x0cad('0x13')](function(_0x3aeaff){if(_0x3aeaff&&_0x3aeaff[_0x0cad('0x90')]){_0x579989=_0x3aeaff;var _0x3a53b2=_[_0x0cad('0xa')](_0x3aca67[_0x0cad('0x4d')],{'firstName':_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x84')],'phone':_0x3aca67[_0x0cad('0x4d')][_0x0cad('0x84')],'ListId':_0x3aeaff[_0x0cad('0x95')]});_0x3a53b2[_0x3aca67[_0x0cad('0x4d')]['mapKeyOffline']]=_0x3aca67['body'][_0x0cad('0x84')];return db['CmContact'][_0x0cad('0xbe')]({'where':_0x26b668,'defaults':_0x3a53b2});}})[_0x0cad('0xaa')](function(_0x361754){if(_0x361754){_0x1511ec=_0x361754;var _0x2446a2=fs[_0x0cad('0xbf')](path[_0x0cad('0x69')](config['root'],_0x0cad('0xc0')),_0x0cad('0xc1'));var _0x271321=ejs['render'](_0x2446a2,{'body':_[_0x0cad('0xc2')](_0x3aca67['body'][_0x0cad('0x4d')]),'bodyTitle':_0x579989[_0x0cad('0xc3')]});return db[_0x0cad('0xc4')][_0x0cad('0x4c')]({'body':_0x271321,'plainBody':htmlToText[_0x0cad('0xc5')](_0x271321),'ContactId':_0x361754['id'],'ChatWebsiteId':_0x579989['id']});}})[_0x0cad('0x13')](function(_0x1964dc){_0x5b1bb3=_0x1964dc;if(_0x30e050[_0x0cad('0x3c')]){var _0xabb682=_0x30e050['map'](function(_0x235a1e){return{'name':_0x235a1e[_0x0cad('0xc6')],'basename':_0x235a1e[_0x0cad('0x62')],'type':_0x235a1e['mimetype'],'ChatOfflineMessageId':_0x1964dc['id']};});_0x595fe8=_0xabb682[_0x0cad('0x32')](_0x595079=>{var _0x546917={'filename':_0x595079[_0x0cad('0x2d')],'path':path[_0x0cad('0x69')](config['root'],'server','files',_0x0cad('0xc7'),_0x0cad('0xc8'),_0x595079['basename'])};return _0x546917;});if(!_0x579989[_0x0cad('0xc9')]){return db['sequelize'][_0x0cad('0xca')](function(_0x5dc2c2){return db['Attachment'][_0x0cad('0xcb')](_0xabb682,{'transaction':_0x5dc2c2});});}}})[_0x0cad('0x13')](function(){if(_0x5b1bb3){_0x7bd5f2=_0x5b1bb3;return db[_0x0cad('0xbd')][_0x0cad('0x5a')]({'where':{'service':!![]},'include':[{'model':db[_0x0cad('0xcc')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0cad('0xcd'),'raw':!![]}]}]});}})[_0x0cad('0x13')](function(_0x983ee4){if(_0x983ee4&&_0x983ee4['Smtp']&&_0x579989[_0x0cad('0xce')]&&_0x579989[_0x0cad('0xcf')]){var _0x25bc76=_0x983ee4[_0x0cad('0xd0')]();return respondWithRpcPromise(_0x0cad('0xd1'),_0x0cad('0xd2'),{'account':_0x25bc76,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x983ee4[_0x0cad('0x2d')],_0x983ee4[_0x0cad('0xd3')]||_0x983ee4[_0x0cad('0xd4')][_0x0cad('0x4e')]),'to':_0x579989[_0x0cad('0xcf')],'subject':_0x579989['offlineMessageSubject'],'html':_0x7bd5f2[_0x0cad('0x4d')],'attachments':_0x595fe8}},client9003)['then'](function(){return _0x7bd5f2;})['catch'](function(_0x58825a){logger['error'](_0x58825a);});}})[_0x0cad('0x13')](function(){if(_0x579989&&_0x579989[_0x0cad('0xc9')]&&_0x579989[_0x0cad('0xd5')]){var _0x486aba=[];if(_0x30e050[_0x0cad('0x3c')]){_0x486aba=_0x30e050[_0x0cad('0x32')](function(_0x15eafa){return{'name':_0x15eafa['originalname'],'basename':_0x15eafa['filename'],'type':_0x15eafa[_0x0cad('0xd6')],'ChatOfflineMessageId':_0x5b1bb3['id']};});}var _0x507371;if(!_['isNil'](_0x579989[_0x0cad('0xd7')])){var _0x287ad1=_[_0x0cad('0x32')](_0x3aca67[_0x0cad('0x4d')],function(_0x15c106){return _0x15c106;});var _0x20543b=_[_0x0cad('0xd8')](_0x287ad1)[0x0];var _0x1de185=_[_0x0cad('0xd9')](_0x20543b,function(_0x47cb5d){return _0x47cb5d;});_0x507371=_0x1de185[0x1][_0x579989[_0x0cad('0xd7')]];}var _0x208d36={'from':_0x1511ec[_0x0cad('0xd3')],'firstName':_0x1511ec[_0x0cad('0x9c')],'lastName':_0x1511ec[_0x0cad('0xda')],'mapKey':_0x0cad('0xd3'),'message':{'from':_0x1511ec[_0x0cad('0xd3')],'to':_0x579989[_0x0cad('0xbd')][_0x0cad('0xd3')],'cc':'','subject':_['isNil'](_0x507371)?_0x579989[_0x0cad('0xdb')]:_0x507371,'messageId':'','sentAt':new Date(),'attach':_0x486aba[_0x0cad('0x3c')],'attachments':_0x486aba,'originChannel':_0x0cad('0xdc'),'ChatWebsiteId':_0x579989['id'],'ChatOfflineMessageId':_0x7bd5f2['id'],'originTo':_0x579989['MailAccount'][_0x0cad('0xd3')]},'body':_0x7bd5f2[_0x0cad('0x4d')]};var _0x4fb4e9={'account':{'id':_0x579989['MailAccountId']},'body':_0x208d36,'log':_0x0cad('0xdd')};return respondWithRpcPromise('NotifyMailAccount',_0x0cad('0xde'),_0x4fb4e9,client9001)[_0x0cad('0x13')](function(){return _0x7bd5f2;})[_0x0cad('0x1e')](function(_0xbf65fa){logger[_0x0cad('0x1a')](_0xbf65fa);});}return;})['then'](function(){if(_0x7bd5f2){return _0x7bd5f2;}})['then'](respondWithResult(_0x2980a7,null))[_0x0cad('0x1e')](function(_0x58ab84){logger[_0x0cad('0x1a')]('catch',_0x58ab84);for(var _0x5622cd of _0x30e050){var _0x10bfe4=path[_0x0cad('0x69')](config['root'],'server',_0x0cad('0xdf'),_0x0cad('0xc7'),_0x0cad('0xc8'),_0x5622cd[_0x0cad('0x62')]);fs_extra[_0x0cad('0xe0')](_0x10bfe4)[_0x0cad('0x1e')](function(_0x446d92){logger[_0x0cad('0x1a')](_0x0cad('0xe1'),_0x10bfe4,_0x446d92);});}});};exports[_0x0cad('0xe2')]=function(_0x35879d,_0x53b45b){return db[_0x0cad('0xa8')]['find']({'where':{'id':_0x35879d[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x53b45b,null))[_0x0cad('0x13')](function(_0x8b4cf8){if(_0x8b4cf8){return _0x8b4cf8[_0x0cad('0xe2')](_0x35879d[_0x0cad('0x4d')]['ids'],_[_0x0cad('0xe3')](_0x35879d[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x53b45b,null))['catch'](handleError(_0x53b45b,null));};exports[_0x0cad('0xe4')]=function(_0x1c35f9,_0xe7a4e8){var _0x4de2cf={'raw':![],'where':{}};var _0x594b11={};var _0x1f1ca1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x0cad('0x5a')]({'where':{'id':_0x1c35f9[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe7a4e8,null))[_0x0cad('0x13')](function(_0x30ea62){if(_0x30ea62){_0x594b11['model']=_[_0x0cad('0x37')](db[_0x0cad('0xa8')][_0x0cad('0x33')]);_0x594b11[_0x0cad('0x36')]=_['keys'](_0x1c35f9[_0x0cad('0x36')]);_0x594b11[_0x0cad('0x38')]=_['intersection'](_0x594b11[_0x0cad('0x35')],_0x594b11[_0x0cad('0x36')]);_0x4de2cf[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x594b11[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x1c35f9[_0x0cad('0x36')]['fields']));_0x4de2cf[_0x0cad('0x39')]=_0x4de2cf[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x4de2cf['attributes']:_0x594b11[_0x0cad('0x35')];if(!_0x1c35f9['query']['hasOwnProperty'](_0x0cad('0x3e'))){_0x4de2cf[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x24')]);_0x4de2cf[_0x0cad('0x22')]=qs['offset'](_0x1c35f9['query'][_0x0cad('0x22')]);}_0x4de2cf[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x40')]);_0x4de2cf[_0x0cad('0x43')]=qs['filters'](_[_0x0cad('0x41')](_0x1c35f9['query'],_0x594b11[_0x0cad('0x38')]));_0x4de2cf['where'][_0x0cad('0x57')]=_0x30ea62['id'];if(_0x1c35f9[_0x0cad('0x36')]['filter']){_0x4de2cf[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x4de2cf[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x4de2cf[_0x0cad('0x39')],function(_0x5e1e35){var _0x114d70={};_0x114d70[_0x5e1e35]={'$like':'%'+_0x1c35f9[_0x0cad('0x36')]['filter']+'%'};return _0x114d70;})});}_0x4de2cf=_[_0x0cad('0x44')]({},_0x4de2cf,_0x1c35f9['options']);return db[_0x0cad('0xa8')][_0x0cad('0x25')]({'where':_0x4de2cf[_0x0cad('0x43')]})[_0x0cad('0x13')](function(_0x47ab35){_0x1f1ca1[_0x0cad('0x25')]=_0x47ab35;if(_0x1c35f9[_0x0cad('0x36')][_0x0cad('0x47')]){_0x4de2cf[_0x0cad('0x48')]=[{'model':db[_0x0cad('0x7f')],'as':_0x0cad('0xe5'),'required':![]},{'model':db[_0x0cad('0xb3')],'as':_0x0cad('0xe6'),'attributes':[_0x0cad('0x2d'),_0x0cad('0xe7'),_0x0cad('0xe8')],'required':![]},{'model':db['Tag'],'as':_0x0cad('0xe9'),'attributes':['id',_0x0cad('0x2d'),'color'],'where':_0x1c35f9['query'][_0x0cad('0xea')]?{'id':_0x1c35f9[_0x0cad('0x36')]['tag']}:undefined,'required':_0x1c35f9['query'][_0x0cad('0xea')]?!![]:![]}];}return db[_0x0cad('0xa8')]['findAll'](_0x4de2cf);})[_0x0cad('0x13')](function(_0xb72009){_0x1f1ca1[_0x0cad('0x4a')]=_0xb72009;return _0x1f1ca1;});}})['then'](respondWithFilteredResult(_0xe7a4e8,_0x4de2cf))['catch'](handleError(_0xe7a4e8,null));};function iftimePromise(_0x2b613e,_0x46a965){return respondWithRpcPromise(_0x0cad('0xeb'),'getSnippet',{'command':_0x46a965[_0x0cad('0xec')]?util[_0x0cad('0xa1')](_0x0cad('0xed'),_0x2b613e[_0x0cad('0xee')],_0x46a965[_0x0cad('0xec')]):util[_0x0cad('0xa1')]('iftime\x20%s',_0x2b613e[_0x0cad('0xee')])},client9002)['then'](function(_0x4e3e28){var _0x214c1f=_0x4e3e28&&_0x4e3e28[_0x0cad('0xef')](_0x0cad('0xf0'))>=0x0?!![]:![];logger[_0x0cad('0x14')](_0x0cad('0xf1'),_0x46a965['id'],_0x2b613e['id'],_0x2b613e['interval'],_0x214c1f?_0x0cad('0xf2'):_0x0cad('0xf3'),_0x46a965[_0x0cad('0xec')]?_0x46a965[_0x0cad('0xec')]:_0x0cad('0xf4'));return _0x214c1f;})[_0x0cad('0x1e')](function(_0x7ff830){logger[_0x0cad('0x1a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x46a965['id'],_0x2b613e['id'],_0x2b613e[_0x0cad('0xee')],util['inspect'](_0x7ff830,{'showHidden':![],'depth':null}),_0x46a965[_0x0cad('0xec')]?_0x46a965['timezone']:_0x0cad('0xf4'));return![];});}exports[_0x0cad('0xf5')]=function(_0x25555d,_0x35c0b7){var _0x145f25=0x0;var _0x520ddb=0x0;var _0x454702=![];var _0x28a456;var _0x19bf7d;return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x25555d[_0x0cad('0x4b')]['id']},'include':[{'model':db[_0x0cad('0xf6')],'as':_0x0cad('0xf6'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x0cad('0xee')],'raw':!![]}]}]})[_0x0cad('0x13')](handleEntityNotFound(_0x35c0b7,null))[_0x0cad('0x13')](function(_0x26d535){if(_0x26d535){_0x28a456=_0x26d535;return _0x26d535[_0x0cad('0xf7')]({'raw':!![]});}})[_0x0cad('0x13')](function(_0x3948d7){if(_0x28a456){if(_0x3948d7){_0x19bf7d=_0x3948d7;}}return require(_0x0cad('0x6a'))[_0x0cad('0xf8')]();})['then'](function(_0x4af5e4){if(_0x4af5e4){_0x520ddb=_0x4af5e4['virtual'];_0x454702=_0x4af5e4[_0x0cad('0x6b')];}})[_0x0cad('0x13')](function(){return db[_0x0cad('0xa8')]['count']({'where':{'closed':![]}});})[_0x0cad('0x13')](function(_0x570428){_0x145f25=_0x570428;if(_0x520ddb&&_0x570428>_0x520ddb){return db[_0x0cad('0xf9')][_0x0cad('0x5a')]({'where':{'id':0x1}})['then'](function(_0x169bf8){if(_0x169bf8){_0x169bf8[_0x0cad('0xfa')](_0x0cad('0xfb'));}});}})[_0x0cad('0x13')](function(){if(_0x28a456[_0x0cad('0xf6')]&&_0x28a456['Interval']['Intervals']){var _0x41041e=[];for(var _0x14f9a2=0x0;_0x14f9a2<_0x28a456[_0x0cad('0xf6')][_0x0cad('0xfc')][_0x0cad('0x3c')];_0x14f9a2++){var _0x2b12f2=_0x28a456[_0x0cad('0xf6')][_0x0cad('0xfc')][_0x14f9a2]['get']({'plain':!![]});_0x41041e[_0x0cad('0xae')](iftimePromise(_0x2b12f2,_0x28a456));}return BPromise[_0x0cad('0xfd')](_0x41041e)['then'](function(_0x2a3264){return _[_0x0cad('0xfe')](_0x2a3264);});}else{return!![];}})[_0x0cad('0x13')](function(_0x1fd19b){var _0xefc4a1=fs[_0x0cad('0xbf')](path['join'](config[_0x0cad('0x70')],_0x0cad('0xff')),_0x0cad('0xc1'));var _0x1e2bb0={'remote':_0x28a456[_0x0cad('0x100')],'query':querystring[_0x0cad('0x19')](_[_0x0cad('0x44')](_0x28a456[_0x0cad('0x27')]({'plain':!![]}),{'customerIp':_0x25555d[_0x0cad('0x7c')][_0x0cad('0x99')]||_0x25555d[_0x0cad('0x7c')]['x-real-ip']||_0x25555d[_0x0cad('0x101')][_0x0cad('0x102')]||_0x25555d['ip'],'referer':_0x25555d[_0x0cad('0x7c')]['referer'],'openedInteractions':_0x145f25,'maxInteractions':_0x520ddb,'virtual':_0x454702[_0x0cad('0x103')],'online':_0x1fd19b,'custom':_0x454702}))['replace'](/'/g,'\x5c\x27')};_0x35c0b7[_0x0cad('0x2e')](ejs[_0x0cad('0x104')](Mustache[_0x0cad('0x104')](_0xefc4a1,_0x1e2bb0),{'proactiveActions':_0x19bf7d,'alignment':_0x28a456[_0x0cad('0x105')],'verticalAlignment':_0x28a456[_0x0cad('0x106')],'div_color':_0x28a456['color'],'labelText':_0x28a456[_0x0cad('0x107')],'text_color':_0x28a456[_0x0cad('0x108')],'text_button_color':_0x28a456[_0x0cad('0x109')],'button_color':_0x28a456['color_button'],'background_color':_0x28a456['backgroundColor'],'hideWhenOffline':_0x28a456['hideWhenOffline'],'interval':_0x28a456[_0x0cad('0x10a')]}));})[_0x0cad('0x1e')](handleError(_0x35c0b7,null));};exports['addApplications']=function(_0x2011ca,_0x15d91c){var _0x20f65a=_0x2011ca[_0x0cad('0x4b')]['id'];var _0x3bef9a=_0x2011ca[_0x0cad('0x4d')];var _0x4a1fb2=0xc8;var _0x5f57ed=null;return db[_0x0cad('0x10b')][_0x0cad('0xca')]({'isolationLevel':db[_0x0cad('0x10b')][_0x0cad('0x10c')][_0x0cad('0x10d')]['READ_COMMITTED']},function(_0x1552e6){return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x20f65a},'transaction':_0x1552e6})['then'](function(_0x1c7a08){if(_0x1c7a08){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x20f65a},'transaction':_0x1552e6})[_0x0cad('0x13')](function(){var _0x4f0eab=_[_0x0cad('0x32')](_0x3bef9a,function(_0x23962a){_0x23962a[_0x0cad('0x57')]=_0x20f65a;return _0x23962a;});return db['ChatApplication']['bulkCreate'](_0x4f0eab,{'transaction':_0x1552e6});});}else{_0x4a1fb2=0x194;_0x5f57ed=[];}});})['then'](function(){if(_0x4a1fb2!==0x194){return db[_0x0cad('0x8f')][_0x0cad('0x10e')]({'where':{'ChatWebsiteId':_0x20f65a},'order':_0x0cad('0x10f')})[_0x0cad('0x13')](function(_0x5e2660){_0x5f57ed=_0x5e2660;});}})[_0x0cad('0x1e')](function(_0x2911ec){_0x4a1fb2=0x1f4;logger[_0x0cad('0x1a')](_0x2911ec['stack']);if(_0x2911ec[_0x0cad('0x2d')]){delete _0x2911ec['name'];}_0x5f57ed=_0x2911ec;})[_0x0cad('0x110')](function(){if(_0x5f57ed===null){_0x15d91c['sendStatus'](_0x4a1fb2);}else{if(_0x4a1fb2===0x1f4){_0x15d91c[_0x0cad('0x20')](_0x4a1fb2)[_0x0cad('0x2e')](_0x5f57ed);}else{_0x15d91c[_0x0cad('0x20')](_0x4a1fb2)['json'](_0x5f57ed);}}});};exports['getApplications']=function(_0x8c328f,_0x482298){var _0x432299={};var _0x59400c={};var _0x3a982b;var _0x19a9e8;return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x8c328f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x482298,null))['then'](function(_0x377c41){if(_0x377c41){_0x3a982b=_0x377c41;_0x59400c[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0x8f')][_0x0cad('0x33')]);_0x59400c[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x8c328f[_0x0cad('0x36')]);_0x59400c[_0x0cad('0x38')]=_['intersection'](_0x59400c[_0x0cad('0x35')],_0x59400c[_0x0cad('0x36')]);_0x432299['attributes']=_[_0x0cad('0x3a')](_0x59400c[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x8c328f['query'][_0x0cad('0x3b')]));_0x432299[_0x0cad('0x39')]=_0x432299[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x432299['attributes']:_0x59400c[_0x0cad('0x35')];_0x432299[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x8c328f[_0x0cad('0x36')]['sort']);_0x432299[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x8c328f[_0x0cad('0x36')],_0x59400c[_0x0cad('0x38')]));if(_0x8c328f['query'][_0x0cad('0x42')]){_0x432299[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x432299[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x432299[_0x0cad('0x39')],function(_0x5d0f76){var _0x3e4277={};_0x3e4277[_0x5d0f76]={'$like':'%'+_0x8c328f[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x3e4277;})});}_0x432299=_[_0x0cad('0x44')]({},_0x432299,_0x8c328f[_0x0cad('0x45')]);return _0x3a982b[_0x0cad('0x111')](_0x432299);}})['then'](function(_0x122ab0){if(_0x122ab0){_0x19a9e8=_0x122ab0[_0x0cad('0x3c')];if(!_0x8c328f[_0x0cad('0x36')]['hasOwnProperty'](_0x0cad('0x3e'))){_0x432299[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x8c328f[_0x0cad('0x36')]['limit']);_0x432299[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x8c328f[_0x0cad('0x36')][_0x0cad('0x22')]);}return _0x3a982b['getApplications'](_0x432299);}})[_0x0cad('0x13')](function(_0x5b2aca){if(_0x5b2aca){return _0x5b2aca?{'count':_0x19a9e8,'rows':_0x5b2aca}:null;}})[_0x0cad('0x13')](respondWithResult(_0x482298,null))[_0x0cad('0x1e')](handleError(_0x482298,null));};exports[_0x0cad('0x112')]=function(_0x444c95,_0x11d893){return db['chatProactiveAction'][_0x0cad('0x52')]({'where':{'id':_0x444c95[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x11d893,null))[_0x0cad('0x13')](function(_0xbe7310){if(_0xbe7310){return _0xbe7310[_0x0cad('0x112')](_0x444c95[_0x0cad('0x4d')][_0x0cad('0x5f')],_[_0x0cad('0xe3')](_0x444c95[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{});}})[_0x0cad('0x13')](respondWithResult(_0x11d893,null))['catch'](handleError(_0x11d893,null));};exports[_0x0cad('0xf7')]=function(_0x50fa5f,_0x13f28c){var _0x2d5534={};var _0x3b55e1={};var _0x536a0d;var _0x752be6;return db[_0x0cad('0x46')]['findOne']({'where':{'id':_0x50fa5f[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x13f28c,null))['then'](function(_0x4f5ec0){if(_0x4f5ec0){_0x536a0d=_0x4f5ec0;_0x3b55e1['model']=_[_0x0cad('0x37')](db[_0x0cad('0x113')]['rawAttributes']);_0x3b55e1[_0x0cad('0x36')]=_['keys'](_0x50fa5f[_0x0cad('0x36')]);_0x3b55e1[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x3b55e1[_0x0cad('0x35')],_0x3b55e1[_0x0cad('0x36')]);_0x2d5534['attributes']=_[_0x0cad('0x3a')](_0x3b55e1[_0x0cad('0x35')],qs[_0x0cad('0x3b')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x2d5534[_0x0cad('0x39')]=_0x2d5534[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x2d5534[_0x0cad('0x39')]:_0x3b55e1[_0x0cad('0x35')];_0x2d5534[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x40')]);_0x2d5534[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_[_0x0cad('0x41')](_0x50fa5f[_0x0cad('0x36')],_0x3b55e1['filters']));if(_0x50fa5f[_0x0cad('0x36')]['filter']){_0x2d5534[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x2d5534[_0x0cad('0x43')],{'$or':_['map'](_0x2d5534[_0x0cad('0x39')],function(_0x5dbfc8){var _0x3c4bd8={};_0x3c4bd8[_0x5dbfc8]={'$like':'%'+_0x50fa5f[_0x0cad('0x36')]['filter']+'%'};return _0x3c4bd8;})});}_0x2d5534=_['merge']({},_0x2d5534,_0x50fa5f['options']);return _0x536a0d[_0x0cad('0xf7')](_0x2d5534);}})['then'](function(_0x192caf){if(_0x192caf){_0x752be6=_0x192caf['length'];if(!_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x3d')](_0x0cad('0x3e'))){_0x2d5534[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0x50fa5f[_0x0cad('0x36')][_0x0cad('0x24')]);_0x2d5534[_0x0cad('0x22')]=qs[_0x0cad('0x22')](_0x50fa5f[_0x0cad('0x36')]['offset']);}return _0x536a0d[_0x0cad('0xf7')](_0x2d5534);}})['then'](function(_0x2cf68b){if(_0x2cf68b){return _0x2cf68b?{'count':_0x752be6,'rows':_0x2cf68b}:null;}})[_0x0cad('0x13')](respondWithResult(_0x13f28c,null))[_0x0cad('0x1e')](handleError(_0x13f28c,null));};exports[_0x0cad('0x114')]=function(_0x51abf7,_0x5a80f9){var _0x561d9d=_0x51abf7[_0x0cad('0x36')][_0x0cad('0x115')]===_0x0cad('0x116')?_0x0cad('0x117'):'onlineForm';return db[_0x0cad('0x46')][_0x0cad('0x52')]({'attributes':['id',_0x561d9d],'where':{'id':_0x51abf7[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a80f9,null))[_0x0cad('0x13')](function(_0x1dde7d){if(_0x1dde7d){var _0x439fa7=_0x1dde7d[_0x561d9d];var _0x5c5f60=_0x439fa7&&_0x439fa7[_0x0cad('0x118')]?_0x439fa7['items']:[];_0x5a80f9[_0x0cad('0x2e')]({'fromKey':_[_0x0cad('0x6c')](_0x439fa7[_0x0cad('0x119')])?undefined:_0x439fa7[_0x0cad('0x119')],'count':_0x5c5f60[_0x0cad('0x3c')],'rows':_0x5c5f60});}})[_0x0cad('0x1e')](handleError(_0x5a80f9,null));};exports[_0x0cad('0x11a')]=function(_0x15b725,_0x232ac1){var _0x3eddc1={'raw':![],'where':{}};var _0x58c91d={};var _0x5de085={'count':0x0,'rows':[]};return db[_0x0cad('0x46')][_0x0cad('0x5a')]({'where':{'id':_0x15b725[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x232ac1,null))[_0x0cad('0x13')](function(_0x177524){if(_0x177524){_0x58c91d[_0x0cad('0x35')]=_[_0x0cad('0x37')](db['ChatOfflineMessage'][_0x0cad('0x33')]);_0x58c91d[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0x15b725[_0x0cad('0x36')]);_0x58c91d[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x58c91d[_0x0cad('0x35')],_0x58c91d[_0x0cad('0x36')]);_0x3eddc1[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x58c91d['model'],qs[_0x0cad('0x3b')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x3eddc1[_0x0cad('0x39')]=_0x3eddc1[_0x0cad('0x39')][_0x0cad('0x3c')]?_0x3eddc1['attributes']:_0x58c91d[_0x0cad('0x35')];if(!_0x15b725[_0x0cad('0x36')]['hasOwnProperty'](_0x0cad('0x3e'))){_0x3eddc1[_0x0cad('0x24')]=qs['limit'](_0x15b725[_0x0cad('0x36')]['limit']);_0x3eddc1['offset']=qs[_0x0cad('0x22')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x22')]);}_0x3eddc1[_0x0cad('0x3f')]=qs[_0x0cad('0x40')](_0x15b725[_0x0cad('0x36')][_0x0cad('0x40')]);_0x3eddc1[_0x0cad('0x43')]=qs['filters'](_[_0x0cad('0x41')](_0x15b725[_0x0cad('0x36')],_0x58c91d[_0x0cad('0x38')]));_0x3eddc1[_0x0cad('0x43')]['ChatWebsiteId']=_0x177524['id'];if(_0x15b725[_0x0cad('0x36')][_0x0cad('0x42')]){_0x3eddc1['where']=_[_0x0cad('0x44')](_0x3eddc1[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x3eddc1['attributes'],function(_0x3fa7a4){var _0x43b803={};_0x43b803[_0x3fa7a4]={'$like':'%'+_0x15b725[_0x0cad('0x36')][_0x0cad('0x42')]+'%'};return _0x43b803;})});}_0x3eddc1=_[_0x0cad('0x44')]({},_0x3eddc1,_0x15b725[_0x0cad('0x45')]);return db['ChatOfflineMessage'][_0x0cad('0x25')]({'where':_0x3eddc1['where']})['then'](function(_0x47a9c9){_0x5de085[_0x0cad('0x25')]=_0x47a9c9;if(_0x15b725['query'][_0x0cad('0x47')]){_0x3eddc1[_0x0cad('0x48')]=[{'all':!![]}];}else{_0x3eddc1[_0x0cad('0x48')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x0cad('0x11b')],'as':'Attachments','required':![]}];}return db[_0x0cad('0xc4')][_0x0cad('0x49')](_0x3eddc1);})['then'](function(_0x5060b7){_0x5de085[_0x0cad('0x4a')]=_0x5060b7;return _0x5de085;});}})[_0x0cad('0x13')](respondWithFilteredResult(_0x232ac1,_0x3eddc1))['catch'](handleError(_0x232ac1,null));};exports[_0x0cad('0x11c')]=function(_0x4ffdb3,_0x2fa11b){return db['ChatWebsite']['find']({'where':{'id':_0x4ffdb3['params']['id']}})['then'](handleEntityNotFound(_0x2fa11b,null))[_0x0cad('0x13')](function(_0x3244f6){if(_0x3244f6){return _0x3244f6['addAgents'](_0x4ffdb3['body'][_0x0cad('0x5f')],_[_0x0cad('0xe3')](_0x4ffdb3[_0x0cad('0x4d')],[_0x0cad('0x5f'),'id'])||{})[_0x0cad('0xaa')](function(_0x42e604){for(var _0xa32aab=0x0;_0xa32aab<_0x4ffdb3[_0x0cad('0x4d')][_0x0cad('0x5f')][_0x0cad('0x3c')];_0xa32aab+=0x1){socket[_0x0cad('0x11d')](_0x0cad('0x11e'),{'UserId':Number(_0x4ffdb3[_0x0cad('0x4d')]['ids'][_0xa32aab]),'ChatWebsiteId':Number(_0x4ffdb3[_0x0cad('0x4b')]['id'])});}return _0x42e604;});}})[_0x0cad('0x13')](respondWithResult(_0x2fa11b,null))[_0x0cad('0x1e')](handleError(_0x2fa11b,null));};exports['removeAgents']=function(_0x4dca9c,_0x17f43f){return db[_0x0cad('0x46')][_0x0cad('0x52')]({'where':{'id':_0x4dca9c[_0x0cad('0x4b')]['id']}})[_0x0cad('0x13')](handleEntityNotFound(_0x17f43f,null))[_0x0cad('0x13')](function(_0x174a48){if(_0x174a48){return _0x174a48['removeAgents'](_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')])['then'](function(){if(_[_0x0cad('0x11f')](_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')])){for(var _0xd018cf=0x0;_0xd018cf<_0x4dca9c['query'][_0x0cad('0x5f')]['length'];_0xd018cf+=0x1){socket[_0x0cad('0x11d')]('userChatWebsite:remove',{'UserId':Number(_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')][_0xd018cf]),'ChatWebsiteId':Number(_0x4dca9c[_0x0cad('0x4b')]['id'])});}}else{socket[_0x0cad('0x11d')](_0x0cad('0x120'),{'UserId':Number(_0x4dca9c[_0x0cad('0x36')][_0x0cad('0x5f')]),'ChatWebsiteId':Number(_0x4dca9c[_0x0cad('0x4b')]['id'])});}});}})[_0x0cad('0x13')](respondWithStatusCode(_0x17f43f,null))['catch'](handleError(_0x17f43f,null));};exports[_0x0cad('0x121')]=function(_0xf5840a,_0x4daf46){var _0x1c9dcb={};var _0x3074ad={};var _0x339615;var _0x4a2797;return db['ChatWebsite'][_0x0cad('0x5a')]({'where':{'id':_0xf5840a[_0x0cad('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4daf46,null))[_0x0cad('0x13')](function(_0xcf042b){if(_0xcf042b){_0x339615=_0xcf042b;_0x3074ad[_0x0cad('0x35')]=_[_0x0cad('0x37')](db[_0x0cad('0xb3')][_0x0cad('0x33')]);_0x3074ad[_0x0cad('0x36')]=_[_0x0cad('0x37')](_0xf5840a[_0x0cad('0x36')]);_0x3074ad[_0x0cad('0x38')]=_[_0x0cad('0x3a')](_0x3074ad[_0x0cad('0x35')],_0x3074ad[_0x0cad('0x36')]);_0x1c9dcb[_0x0cad('0x39')]=_[_0x0cad('0x3a')](_0x3074ad['model'],qs[_0x0cad('0x3b')](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x3b')]));_0x1c9dcb[_0x0cad('0x39')]=_0x1c9dcb[_0x0cad('0x39')]['length']?_0x1c9dcb['attributes']:_0x3074ad[_0x0cad('0x35')];_0x1c9dcb[_0x0cad('0x3f')]=qs['sort'](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x40')]);_0x1c9dcb[_0x0cad('0x43')]=qs[_0x0cad('0x38')](_['pick'](_0xf5840a[_0x0cad('0x36')],_0x3074ad[_0x0cad('0x38')]));if(_0xf5840a['query'][_0x0cad('0x42')]){_0x1c9dcb[_0x0cad('0x43')]=_[_0x0cad('0x44')](_0x1c9dcb[_0x0cad('0x43')],{'$or':_[_0x0cad('0x32')](_0x1c9dcb[_0x0cad('0x39')],function(_0x416994){var _0x31408e={};_0x31408e[_0x416994]={'$like':'%'+_0xf5840a['query'][_0x0cad('0x42')]+'%'};return _0x31408e;})});}_0x1c9dcb=_['merge']({},_0x1c9dcb,_0xf5840a['options']);return _0x339615[_0x0cad('0x121')](_0x1c9dcb);}})[_0x0cad('0x13')](function(_0x2992c3){if(_0x2992c3){_0x4a2797=_0x2992c3[_0x0cad('0x3c')];if(!_0xf5840a[_0x0cad('0x36')][_0x0cad('0x3d')]('nolimit')){_0x1c9dcb[_0x0cad('0x24')]=qs[_0x0cad('0x24')](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x24')]);_0x1c9dcb[_0x0cad('0x22')]=qs['offset'](_0xf5840a[_0x0cad('0x36')][_0x0cad('0x22')]);}return _0x339615[_0x0cad('0x121')](_0x1c9dcb);}})['then'](function(_0x464355){if(_0x464355){return _0x464355?{'count':_0x4a2797,'rows':_0x464355}:null;}})[_0x0cad('0x13')](respondWithResult(_0x4daf46,null))[_0x0cad('0x1e')](handleError(_0x4daf46,null));}; \ No newline at end of file +var _0xd271=['x-forwarded-for','first','split','firstName','lastName','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','type','vendor','threadId','ChatInteraction','externalUrl','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','MailAccountId','toPairsIn','mapValues','subjectOffline','offlineMessageSubject','NotifyMailAccount','offline-chat','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','fullname','internal','Tags','color','tag','getSnippet','timezone','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','remoteAddress','referer','replace','render','alignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','omit','ChatProactiveAction','getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','bluebird','util','ejs','fs-extra','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','then','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','query','keys','filters','intersection','fields','attributes','length','model','nolimit','order','sort','where','filter','merge','VIRTUAL','count','include','rows','show','params','includeAll','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','userProfileId','autoAssociation','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','hasOwnProperty','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','user-agent','getResult','chat','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','ChatApplication','Applications','account','applications','list','orderBy','priority','asc','contact','customerIp','headers'];(function(_0x19dfa9,_0x3811ac){var _0x31f1ec=function(_0x289651){while(--_0x289651){_0x19dfa9['push'](_0x19dfa9['shift']());}};_0x31f1ec(++_0x3811ac);}(_0xd271,0x1c0));var _0x1d27=function(_0x586fea,_0xd53d97){_0x586fea=_0x586fea-0x0;var _0x27d83a=_0xd271[_0x586fea];return _0x27d83a;};'use strict';var BPromise=require(_0x1d27('0x0'));var Mustache=require('mustache');var util=require(_0x1d27('0x1'));var path=require('path');var ejs=require(_0x1d27('0x2'));var fs=require('fs');var fs_extra=require(_0x1d27('0x3'));var _=require('lodash');var querystring=require(_0x1d27('0x4'));var Redis=require(_0x1d27('0x5'));var qs=require(_0x1d27('0x6'));var logger=require(_0x1d27('0x7'))(_0x1d27('0x8'));var config=require(_0x1d27('0x9'));var db=require(_0x1d27('0xa'))['db'];config[_0x1d27('0xb')]=_[_0x1d27('0xc')](config[_0x1d27('0xb')],{'host':_0x1d27('0xd'),'port':0x18eb});var socket=require(_0x1d27('0xe'))(new Redis(config[_0x1d27('0xb')]));require(_0x1d27('0xf'))[_0x1d27('0x10')](socket);var htmlToText=require(_0x1d27('0x11'));var jayson=require(_0x1d27('0x12'));var client=jayson[_0x1d27('0x13')][_0x1d27('0x14')]({'port':0x232c});var client9002=jayson[_0x1d27('0x13')][_0x1d27('0x14')]({'port':0x232a});var client9003=jayson[_0x1d27('0x13')][_0x1d27('0x14')]({'port':0x232b});var client9001=jayson[_0x1d27('0x13')]['http']({'port':0x2329});function respondWithRpcPromise(_0x3c094,_0x5ab354,_0x42140b,_0x4ea6fb){return new BPromise(function(_0x3ce6e6,_0x3ff9c8){var _0x1c12f6=_0x4ea6fb||client;return _0x1c12f6[_0x1d27('0x15')](_0x3c094,_0x42140b)['then'](function(_0x1f3adc){logger[_0x1d27('0x16')](_0x1d27('0x17'),_0x5ab354,_0x1d27('0x18'));logger[_0x1d27('0x19')](_0x1d27('0x1a'),_0x5ab354,'request\x20sent',JSON[_0x1d27('0x1b')](_0x1f3adc));if(_0x1f3adc[_0x1d27('0x1c')]){if(_0x1f3adc[_0x1d27('0x1c')][_0x1d27('0x1d')]===0x1f4){logger[_0x1d27('0x1c')](_0x1d27('0x17'),_0x5ab354,_0x1f3adc['error'][_0x1d27('0x1e')]);return _0x3ff9c8(_0x1f3adc[_0x1d27('0x1c')][_0x1d27('0x1e')]);}logger['error'](_0x1d27('0x17'),_0x5ab354,_0x1f3adc['error'][_0x1d27('0x1e')]);return _0x3ce6e6(_0x1f3adc['error'][_0x1d27('0x1e')]);}else{logger[_0x1d27('0x16')](_0x1d27('0x17'),_0x5ab354,_0x1d27('0x18'));_0x3ce6e6(_0x1f3adc['result'][_0x1d27('0x1e')]);}})[_0x1d27('0x1f')](function(_0x246317){logger[_0x1d27('0x1c')](_0x1d27('0x17'),_0x5ab354,_0x246317);_0x3ff9c8(_0x246317);});});}function respondWithStatusCode(_0x4c98a4,_0x52c4e4){_0x52c4e4=_0x52c4e4||0xcc;return function(_0x37c2c9){if(_0x37c2c9){return _0x4c98a4[_0x1d27('0x20')](_0x52c4e4);}return _0x4c98a4[_0x1d27('0x21')](_0x52c4e4)[_0x1d27('0x22')]();};}function respondWithResult(_0x10c16f,_0x2b942d){_0x2b942d=_0x2b942d||0xc8;return function(_0x42d8d5){if(_0x42d8d5){return _0x10c16f[_0x1d27('0x21')](_0x2b942d)[_0x1d27('0x23')](_0x42d8d5);}};}function respondWithFilteredResult(_0x458a59,_0x7bb7bc){return function(_0x2ad92c){if(_0x2ad92c){var _0x10eac3=typeof _0x7bb7bc['offset']===_0x1d27('0x24')&&typeof _0x7bb7bc[_0x1d27('0x25')]===_0x1d27('0x24');var _0x13207d=_0x2ad92c['count'];var _0x5da192=_0x10eac3?0x0:_0x7bb7bc['offset'];var _0x459d91=_0x10eac3?_0x2ad92c['count']:_0x7bb7bc[_0x1d27('0x26')]+_0x7bb7bc[_0x1d27('0x25')];var _0x4a7fc2;if(_0x459d91>=_0x13207d){_0x459d91=_0x13207d;_0x4a7fc2=0xc8;}else{_0x4a7fc2=0xce;}_0x458a59[_0x1d27('0x21')](_0x4a7fc2);return _0x458a59[_0x1d27('0x27')](_0x1d27('0x28'),_0x5da192+'-'+_0x459d91+'/'+_0x13207d)[_0x1d27('0x23')](_0x2ad92c);}return null;};}function saveUpdates(_0x58bd3f){return function(_0x11f01a){if(_0x11f01a){return _0x11f01a['update'](_0x58bd3f)[_0x1d27('0x29')](function(_0x2f3e2e){return _0x2f3e2e;});}return null;};}function removeEntity(_0x316528){return function(_0x443f4d){if(_0x443f4d){return _0x443f4d['destroy']()[_0x1d27('0x29')](function(){var _0x1178b7=_0x443f4d['get']({'plain':!![]});var _0x58a82d='ChatWebsites';return db[_0x1d27('0x2a')][_0x1d27('0x2b')]({'where':{'type':_0x58a82d,'resourceId':_0x1178b7['id']}})[_0x1d27('0x29')](function(){return _0x443f4d;});})[_0x1d27('0x29')](function(){_0x316528[_0x1d27('0x21')](0xcc)[_0x1d27('0x22')]();});}};}function handleEntityNotFound(_0x32158b){return function(_0x85d112){if(!_0x85d112){_0x32158b[_0x1d27('0x20')](0x194);}return _0x85d112;};}function handleError(_0x4d14a1,_0x2c4e4b){_0x2c4e4b=_0x2c4e4b||0x1f4;return function(_0x25b5c7){logger[_0x1d27('0x1c')](_0x25b5c7[_0x1d27('0x2c')]);if(_0x25b5c7[_0x1d27('0x2d')]){delete _0x25b5c7[_0x1d27('0x2d')];}_0x4d14a1['status'](_0x2c4e4b)['send'](_0x25b5c7);};}exports[_0x1d27('0x2e')]=function(_0x5aab7c,_0x56368c){var _0x4412d8={'include':[{'model':db[_0x1d27('0x2f')],'as':_0x1d27('0x30')}]},_0xb79695={},_0x127d07={'count':0x0,'rows':[]};var _0x35707c=_[_0x1d27('0x31')](db[_0x1d27('0x32')][_0x1d27('0x33')],function(_0x338f6c){return{'name':_0x338f6c['fieldName'],'type':_0x338f6c['type'][_0x1d27('0x34')]};});_0xb79695['model']=_[_0x1d27('0x31')](_0x35707c,_0x1d27('0x2d'));_0xb79695[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x5aab7c[_0x1d27('0x35')]);_0xb79695[_0x1d27('0x37')]=_['intersection'](_0xb79695['model'],_0xb79695[_0x1d27('0x35')]);_0x4412d8['attributes']=_[_0x1d27('0x38')](_0xb79695['model'],qs[_0x1d27('0x39')](_0x5aab7c[_0x1d27('0x35')][_0x1d27('0x39')]));_0x4412d8[_0x1d27('0x3a')]=_0x4412d8[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x4412d8[_0x1d27('0x3a')]:_0xb79695[_0x1d27('0x3c')];if(!_0x5aab7c['query']['hasOwnProperty'](_0x1d27('0x3d'))){_0x4412d8['limit']=qs[_0x1d27('0x25')](_0x5aab7c[_0x1d27('0x35')]['limit']);_0x4412d8[_0x1d27('0x26')]=qs[_0x1d27('0x26')](_0x5aab7c['query'][_0x1d27('0x26')]);}_0x4412d8[_0x1d27('0x3e')]=qs['sort'](_0x5aab7c[_0x1d27('0x35')][_0x1d27('0x3f')]);_0x4412d8[_0x1d27('0x40')]=qs[_0x1d27('0x37')](_['pick'](_0x5aab7c[_0x1d27('0x35')],_0xb79695['filters']),_0x35707c);if(_0x5aab7c[_0x1d27('0x35')][_0x1d27('0x41')]){_0x4412d8[_0x1d27('0x40')]=_[_0x1d27('0x42')](_0x4412d8[_0x1d27('0x40')],{'$or':_[_0x1d27('0x31')](_0x35707c,function(_0x47199e){if(_0x47199e['type']!==_0x1d27('0x43')){var _0x31c815={};_0x31c815[_0x47199e['name']]={'$like':'%'+_0x5aab7c[_0x1d27('0x35')][_0x1d27('0x41')]+'%'};return _0x31c815;}})});}_0x4412d8=_[_0x1d27('0x42')]({},_0x4412d8,_0x5aab7c['options']);var _0x57e26f={'where':_0x4412d8[_0x1d27('0x40')]};return db[_0x1d27('0x32')][_0x1d27('0x44')](_0x57e26f)[_0x1d27('0x29')](function(_0x397eee){_0x127d07[_0x1d27('0x44')]=_0x397eee;if(_0x5aab7c[_0x1d27('0x35')]['includeAll']){_0x4412d8[_0x1d27('0x45')]=[{'all':!![]}];}return db[_0x1d27('0x32')]['findAll'](_0x4412d8);})[_0x1d27('0x29')](function(_0x9ca2b1){_0x127d07[_0x1d27('0x46')]=_0x9ca2b1;return _0x127d07;})[_0x1d27('0x29')](respondWithFilteredResult(_0x56368c,_0x4412d8))[_0x1d27('0x1f')](handleError(_0x56368c,null));};exports[_0x1d27('0x47')]=function(_0x199ff5,_0x32e2ad){var _0x1bd988={'raw':![],'where':{'id':_0x199ff5[_0x1d27('0x48')]['id']},'include':[{'model':db[_0x1d27('0x2f')],'as':_0x1d27('0x30')}]},_0x33ce8f={};_0x33ce8f[_0x1d27('0x3c')]=_[_0x1d27('0x36')](db[_0x1d27('0x32')][_0x1d27('0x33')]);_0x33ce8f[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x199ff5[_0x1d27('0x35')]);_0x33ce8f[_0x1d27('0x37')]=_[_0x1d27('0x38')](_0x33ce8f[_0x1d27('0x3c')],_0x33ce8f['query']);_0x1bd988[_0x1d27('0x3a')]=_[_0x1d27('0x38')](_0x33ce8f['model'],qs['fields'](_0x199ff5['query']['fields']));_0x1bd988[_0x1d27('0x3a')]=_0x1bd988[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x1bd988['attributes']:_0x33ce8f[_0x1d27('0x3c')];if(_0x199ff5[_0x1d27('0x35')][_0x1d27('0x49')]){_0x1bd988[_0x1d27('0x45')]=[{'all':!![]}];}_0x1bd988=_[_0x1d27('0x42')]({},_0x1bd988,_0x199ff5[_0x1d27('0x4a')]);return db['ChatWebsite'][_0x1d27('0x4b')](_0x1bd988)['then'](handleEntityNotFound(_0x32e2ad,null))[_0x1d27('0x29')](respondWithResult(_0x32e2ad,null))[_0x1d27('0x1f')](handleError(_0x32e2ad,null));};exports[_0x1d27('0x4c')]=function(_0x933c55,_0x171ba9){return db[_0x1d27('0x32')]['create'](_0x933c55[_0x1d27('0x4d')],{})['then'](function(_0x103148){var _0x471041=_0x933c55[_0x1d27('0x4e')][_0x1d27('0x4f')]({'plain':!![]});if(!_0x471041)throw new Error(_0x1d27('0x50'));if(_0x471041[_0x1d27('0x51')]==='user'){var _0x40d43d=_0x103148['get']({'plain':!![]});var _0x58b15b=_0x1d27('0x52');return db[_0x1d27('0x53')][_0x1d27('0x4b')]({'where':{'name':_0x58b15b,'userProfileId':_0x471041[_0x1d27('0x54')]},'raw':!![]})[_0x1d27('0x29')](function(_0x19a477){if(_0x19a477&&_0x19a477[_0x1d27('0x55')]===0x0){return db[_0x1d27('0x2a')][_0x1d27('0x4c')]({'name':_0x40d43d[_0x1d27('0x2d')],'resourceId':_0x40d43d['id'],'type':_0x19a477[_0x1d27('0x2d')],'sectionId':_0x19a477['id']},{})[_0x1d27('0x29')](function(){return _0x103148;});}else{return _0x103148;}})[_0x1d27('0x1f')](function(_0x1c2d94){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2d94);throw _0x1c2d94;});}return _0x103148;})[_0x1d27('0x29')](respondWithResult(_0x171ba9,0xc9))[_0x1d27('0x1f')](handleError(_0x171ba9,null));};exports[_0x1d27('0x56')]=function(_0x1097d1,_0x2173af){if(_0x1097d1[_0x1d27('0x4d')]['id']){delete _0x1097d1[_0x1d27('0x4d')]['id'];}return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x1097d1[_0x1d27('0x48')]['id']},'include':[{'model':db[_0x1d27('0x2f')],'as':_0x1d27('0x30')}]})['then'](handleEntityNotFound(_0x2173af,null))[_0x1d27('0x29')](saveUpdates(_0x1097d1[_0x1d27('0x4d')],null))[_0x1d27('0x29')](respondWithResult(_0x2173af,null))['catch'](handleError(_0x2173af,null));};exports['destroy']=function(_0x3ad431,_0x57b136){return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x3ad431['params']['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x57b136,null))[_0x1d27('0x29')](removeEntity(_0x57b136,null))[_0x1d27('0x1f')](handleError(_0x57b136,null));};exports['describe']=function(_0x5b399f,_0x16db90){return db[_0x1d27('0x32')][_0x1d27('0x57')]()[_0x1d27('0x29')](respondWithResult(_0x16db90,null))[_0x1d27('0x1f')](handleError(_0x16db90,null));};exports[_0x1d27('0x58')]=function(_0x22c310,_0x98d4b0){if(_0x22c310[_0x1d27('0x4d')]['id']){delete _0x22c310[_0x1d27('0x4d')]['id'];}return db['ChatWebsite'][_0x1d27('0x4b')]({'where':{'id':_0x22c310[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x98d4b0,null))[_0x1d27('0x29')](function(_0x461f81){if(_0x461f81){_0x22c310[_0x1d27('0x4d')][_0x1d27('0x59')]=_0x461f81['id'];return db[_0x1d27('0x5a')][_0x1d27('0x4c')](_0x22c310[_0x1d27('0x4d')]);}})[_0x1d27('0x29')](respondWithResult(_0x98d4b0,null))[_0x1d27('0x1f')](handleError(_0x98d4b0,null));};exports[_0x1d27('0x5b')]=function(_0x1a239b,_0x672100){var _0x4ac855={'raw':![],'where':{}};var _0x5ec6d3={};var _0x57b0a5={'count':0x0,'rows':[]};return db[_0x1d27('0x32')]['findOne']({'where':{'id':_0x1a239b[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x672100,null))[_0x1d27('0x29')](function(_0x5c930a){if(_0x5c930a){_0x5ec6d3[_0x1d27('0x3c')]=_[_0x1d27('0x36')](db[_0x1d27('0x5a')]['rawAttributes']);_0x5ec6d3['query']=_[_0x1d27('0x36')](_0x1a239b[_0x1d27('0x35')]);_0x5ec6d3['filters']=_[_0x1d27('0x38')](_0x5ec6d3['model'],_0x5ec6d3[_0x1d27('0x35')]);_0x4ac855['attributes']=_[_0x1d27('0x38')](_0x5ec6d3[_0x1d27('0x3c')],qs['fields'](_0x1a239b[_0x1d27('0x35')][_0x1d27('0x39')]));_0x4ac855[_0x1d27('0x3a')]=_0x4ac855['attributes'][_0x1d27('0x3b')]?_0x4ac855['attributes']:_0x5ec6d3[_0x1d27('0x3c')];if(!_0x1a239b[_0x1d27('0x35')][_0x1d27('0x5c')]('nolimit')){_0x4ac855[_0x1d27('0x25')]=qs['limit'](_0x1a239b[_0x1d27('0x35')][_0x1d27('0x25')]);_0x4ac855[_0x1d27('0x26')]=qs['offset'](_0x1a239b['query'][_0x1d27('0x26')]);}_0x4ac855[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x1a239b['query'][_0x1d27('0x3f')]);_0x4ac855[_0x1d27('0x40')]=qs['filters'](_[_0x1d27('0x5d')](_0x1a239b['query'],_0x5ec6d3['filters']));_0x4ac855['where']['ChatWebsiteId']=_0x5c930a['id'];if(_0x1a239b[_0x1d27('0x35')]['filter']){_0x4ac855[_0x1d27('0x40')]=_['merge'](_0x4ac855['where'],{'$or':_['map'](_0x4ac855[_0x1d27('0x3a')],function(_0x242619){var _0x46c17f={};_0x46c17f[_0x242619]={'$like':'%'+_0x1a239b[_0x1d27('0x35')]['filter']+'%'};return _0x46c17f;})});}_0x4ac855=_['merge']({},_0x4ac855,_0x1a239b[_0x1d27('0x4a')]);return db[_0x1d27('0x5a')][_0x1d27('0x44')]({'where':_0x4ac855[_0x1d27('0x40')]})['then'](function(_0x641916){_0x57b0a5[_0x1d27('0x44')]=_0x641916;if(_0x1a239b['query'][_0x1d27('0x49')]){_0x4ac855[_0x1d27('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x1d27('0x5e')](_0x4ac855);})[_0x1d27('0x29')](function(_0x48bf3a){_0x57b0a5[_0x1d27('0x46')]=_0x48bf3a;return _0x57b0a5;});}})[_0x1d27('0x29')](respondWithFilteredResult(_0x672100,_0x4ac855))[_0x1d27('0x1f')](handleError(_0x672100,null));};exports[_0x1d27('0x5f')]=function(_0x4d7a2d,_0x360e61){return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x4d7a2d[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x360e61,null))[_0x1d27('0x29')](function(_0x3d6162){if(_0x3d6162){return _0x3d6162[_0x1d27('0x5f')](_0x4d7a2d[_0x1d27('0x35')][_0x1d27('0x60')]);}})[_0x1d27('0x29')](respondWithStatusCode(_0x360e61,null))[_0x1d27('0x1f')](handleError(_0x360e61,null));};exports[_0x1d27('0x61')]=function(_0x2aa589,_0x2462ce){if(_0x2aa589[_0x1d27('0x4d')]['id']){delete _0x2aa589[_0x1d27('0x4d')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2aa589[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x2462ce,null))[_0x1d27('0x29')](function(_0x188ae8){if(_0x188ae8){_0x2aa589[_0x1d27('0x4d')]['ChatWebsiteId']=_0x188ae8['id'];return db[_0x1d27('0x62')][_0x1d27('0x4c')](_0x2aa589['body']);}})[_0x1d27('0x29')](respondWithResult(_0x2462ce,null))['catch'](handleError(_0x2462ce,null));};exports[_0x1d27('0x63')]=function(_0x2e1042,_0x48edd7){var _0x4d79cf={'raw':![],'where':{}};var _0x4dd8b4={};var _0x1b2d53={'count':0x0,'rows':[]};return db[_0x1d27('0x32')][_0x1d27('0x64')]({'where':{'id':_0x2e1042['params']['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x48edd7,null))['then'](function(_0x1e689b){if(_0x1e689b){_0x4dd8b4['model']=_[_0x1d27('0x36')](db['CannedAnswer'][_0x1d27('0x33')]);_0x4dd8b4[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x2e1042['query']);_0x4dd8b4['filters']=_['intersection'](_0x4dd8b4['model'],_0x4dd8b4[_0x1d27('0x35')]);_0x4d79cf[_0x1d27('0x3a')]=_['intersection'](_0x4dd8b4[_0x1d27('0x3c')],qs[_0x1d27('0x39')](_0x2e1042['query']['fields']));_0x4d79cf[_0x1d27('0x3a')]=_0x4d79cf[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x4d79cf['attributes']:_0x4dd8b4[_0x1d27('0x3c')];if(!_0x2e1042[_0x1d27('0x35')][_0x1d27('0x5c')]('nolimit')){_0x4d79cf['limit']=qs[_0x1d27('0x25')](_0x2e1042['query']['limit']);_0x4d79cf[_0x1d27('0x26')]=qs['offset'](_0x2e1042[_0x1d27('0x35')]['offset']);}_0x4d79cf[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x2e1042['query'][_0x1d27('0x3f')]);_0x4d79cf[_0x1d27('0x40')]=qs['filters'](_[_0x1d27('0x5d')](_0x2e1042[_0x1d27('0x35')],_0x4dd8b4[_0x1d27('0x37')]));_0x4d79cf[_0x1d27('0x40')][_0x1d27('0x59')]=_0x1e689b['id'];if(_0x2e1042[_0x1d27('0x35')][_0x1d27('0x41')]){_0x4d79cf[_0x1d27('0x40')]=_[_0x1d27('0x42')](_0x4d79cf[_0x1d27('0x40')],{'$or':_['map'](_0x4d79cf[_0x1d27('0x3a')],function(_0x2b0f8f){var _0x326978={};_0x326978[_0x2b0f8f]={'$like':'%'+_0x2e1042[_0x1d27('0x35')][_0x1d27('0x41')]+'%'};return _0x326978;})});}_0x4d79cf=_[_0x1d27('0x42')]({},_0x4d79cf,_0x2e1042['options']);return db[_0x1d27('0x62')][_0x1d27('0x44')]({'where':_0x4d79cf['where']})[_0x1d27('0x29')](function(_0x14d8d8){_0x1b2d53[_0x1d27('0x44')]=_0x14d8d8;if(_0x2e1042['query'][_0x1d27('0x49')]){_0x4d79cf[_0x1d27('0x45')]=[{'all':!![]}];}return db[_0x1d27('0x62')][_0x1d27('0x5e')](_0x4d79cf);})[_0x1d27('0x29')](function(_0x453fb5){_0x1b2d53[_0x1d27('0x46')]=_0x453fb5;return _0x1b2d53;});}})[_0x1d27('0x29')](respondWithFilteredResult(_0x48edd7,_0x4d79cf))[_0x1d27('0x1f')](handleError(_0x48edd7,null));};exports[_0x1d27('0x65')]=function(_0x482fd6,_0x5e3f30){return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x482fd6[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x5e3f30,null))[_0x1d27('0x29')](function(_0x1595cc){if(_0x1595cc){return _0x1595cc[_0x1d27('0x65')](_0x482fd6[_0x1d27('0x35')]['ids']);}})[_0x1d27('0x29')](respondWithStatusCode(_0x5e3f30,null))['catch'](handleError(_0x5e3f30,null));};exports['addLogo']=function(_0x334341,_0x571ded){_0x334341[_0x1d27('0x4d')][_0x1d27('0x66')]=_0x334341[_0x1d27('0x67')]['filename'];return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x334341[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x571ded,null))[_0x1d27('0x29')](saveUpdates(_0x334341[_0x1d27('0x4d')],null))[_0x1d27('0x29')](respondWithResult(_0x571ded,null))[_0x1d27('0x1f')](handleError(_0x571ded,null));};exports[_0x1d27('0x68')]=function(_0x273f84,_0x3d7ef1){_0x273f84[_0x1d27('0x4d')][_0x1d27('0x69')]=_0x273f84[_0x1d27('0x67')][_0x1d27('0x6a')];return db['ChatWebsite'][_0x1d27('0x4b')]({'where':{'id':_0x273f84[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d7ef1,null))[_0x1d27('0x29')](saveUpdates(_0x273f84[_0x1d27('0x4d')],null))[_0x1d27('0x29')](respondWithResult(_0x3d7ef1,null))[_0x1d27('0x1f')](handleError(_0x3d7ef1,null));};exports[_0x1d27('0x6b')]=function(_0x3457f0,_0x388345){_0x3457f0[_0x1d27('0x4d')][_0x1d27('0x6c')]=_0x3457f0[_0x1d27('0x67')][_0x1d27('0x6a')];return db[_0x1d27('0x32')]['find']({'where':{'id':_0x3457f0[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x388345,null))[_0x1d27('0x29')](saveUpdates(_0x3457f0['body'],null))[_0x1d27('0x29')](respondWithResult(_0x388345,null))[_0x1d27('0x1f')](handleError(_0x388345,null));};exports[_0x1d27('0x6d')]=function(_0x36a132,_0x2b7db1){_0x36a132[_0x1d27('0x4d')][_0x1d27('0x6e')]=_0x36a132['file']['filename'];return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x36a132[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b7db1,null))[_0x1d27('0x29')](saveUpdates(_0x36a132[_0x1d27('0x4d')],null))[_0x1d27('0x29')](respondWithResult(_0x2b7db1,null))[_0x1d27('0x1f')](handleError(_0x2b7db1,null));};exports[_0x1d27('0x6f')]=function(_0x2f2f4d,_0x30a3f4){var _0xf4067f=path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x72'));var _0x3d1842={'where':{'id':_0x2f2f4d[_0x1d27('0x48')]['id']},'attributes':['id',_0x1d27('0x66')],'raw':!![]};var _0x646dc9=![];return require('../../config/license/util')[_0x1d27('0x73')]()[_0x1d27('0x29')](function(_0x25167e){if(_0x25167e){_0x646dc9=_0x25167e[_0x1d27('0x74')];}})['then'](function(){return db['ChatWebsite']['find'](_0x3d1842);})[_0x1d27('0x29')](handleEntityNotFound(_0x30a3f4,null))[_0x1d27('0x29')](function(_0x4e22e1){if(_0x4e22e1){if(!_[_0x1d27('0x75')](_0x4e22e1[_0x1d27('0x66')])){if(fs[_0x1d27('0x76')](path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x77'),_0x4e22e1[_0x1d27('0x66')]))&&_0x646dc9){_0xf4067f=path[_0x1d27('0x70')](config[_0x1d27('0x71')],'server/files/images/logos/',_0x4e22e1[_0x1d27('0x66')]);}}return _0x30a3f4[_0x1d27('0x78')](_0xf4067f);}})['catch'](handleError(_0x30a3f4,null));};exports['getAvatar']=function(_0x3e2bf6,_0x2d5b8f){var _0x5cff9e=path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x79'));var _0x53338b={'where':{'id':_0x3e2bf6[_0x1d27('0x48')]['id']},'attributes':['id',_0x1d27('0x69')],'raw':!![]};return db[_0x1d27('0x32')][_0x1d27('0x4b')](_0x53338b)[_0x1d27('0x29')](handleEntityNotFound(_0x2d5b8f,null))[_0x1d27('0x29')](function(_0xaaeced){if(_0xaaeced){if(!_[_0x1d27('0x75')](_0xaaeced[_0x1d27('0x69')])){if(fs[_0x1d27('0x76')](path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x7a'),_0xaaeced['agentAvatar']))){_0x5cff9e=path[_0x1d27('0x70')](config[_0x1d27('0x71')],'server/files/images/avatars/',_0xaaeced[_0x1d27('0x69')]);}}return _0x2d5b8f[_0x1d27('0x78')](_0x5cff9e);}})[_0x1d27('0x1f')](handleError(_0x2d5b8f,null));};exports['getCustomerAvatar']=function(_0x3647a9,_0xf17b71){var _0x8959c0=path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x7b'));var _0x465113={'where':{'id':_0x3647a9[_0x1d27('0x48')]['id']},'attributes':['id',_0x1d27('0x6c'),_0x1d27('0x7c')],'raw':!![]};return db[_0x1d27('0x32')]['find'](_0x465113)[_0x1d27('0x29')](handleEntityNotFound(_0xf17b71,null))[_0x1d27('0x29')](function(_0x4933d9){if(_0x4933d9){if(!_[_0x1d27('0x75')](_0x4933d9[_0x1d27('0x6c')])){if(fs['existsSync'](path[_0x1d27('0x70')](config['root'],_0x1d27('0x7a'),_0x4933d9[_0x1d27('0x6c')]))&&_0x4933d9[_0x1d27('0x7c')]){_0x8959c0=path['join'](config[_0x1d27('0x71')],'server/files/images/avatars/',_0x4933d9['customerAvatar']);}}return _0xf17b71[_0x1d27('0x78')](_0x8959c0);}})['catch'](handleError(_0xf17b71,null));};exports['getSystemAvatar']=function(_0x5719cc,_0x218aa7){var _0x39d2e8=path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x7d'));var _0x389dba={'where':{'id':_0x5719cc[_0x1d27('0x48')]['id']},'attributes':['id',_0x1d27('0x6e')],'raw':!![]};return db[_0x1d27('0x32')][_0x1d27('0x4b')](_0x389dba)[_0x1d27('0x29')](handleEntityNotFound(_0x218aa7,null))[_0x1d27('0x29')](function(_0x5e7ffa){if(_0x5e7ffa){if(!_[_0x1d27('0x75')](_0x5e7ffa[_0x1d27('0x6e')])){if(fs[_0x1d27('0x76')](path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x7a'),_0x5e7ffa[_0x1d27('0x6e')]))){_0x39d2e8=path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0x7a'),_0x5e7ffa[_0x1d27('0x6e')]);}}return _0x218aa7[_0x1d27('0x78')](_0x39d2e8);}})[_0x1d27('0x1f')](handleError(_0x218aa7,null));};exports[_0x1d27('0x7e')]=function(_0x2fc7eb,_0xd0eb98){var _0x41c921=require(_0x1d27('0x7f'));var _0x5b4211=new _0x41c921();var _0xc7f425=_0x5b4211['setUA'](_0x2fc7eb['headers'][_0x1d27('0x80')])[_0x1d27('0x81')]();var _0x9f871b={'body':_0x2fc7eb[_0x1d27('0x4d')],'channel':_0x1d27('0x82')};var _0x2cb824=[];var _0x160696=[];var _0x328de2={};var _0xe7e7fe=![];return db['CmContact']['describe']()[_0x1d27('0x29')](function(_0x5b076e){if(!_0x5b076e){throw new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x85'));}_0x2cb824=_[_0x1d27('0x86')](_[_0x1d27('0x36')](_0x5b076e),[_0x1d27('0x87'),'updatedAt']);_0x160696=_['difference'](_['keys'](_0x5b076e),[_0x1d27('0x87'),_0x1d27('0x88'),_0x1d27('0x89'),_0x1d27('0x8a')]);if(_0x2fc7eb[_0x1d27('0x4d')]['id']){delete _0x2fc7eb[_0x1d27('0x4d')]['id'];}if(_[_0x1d27('0x75')](_0x2fc7eb['body'][_0x1d27('0x8b')])){throw new db[(_0x1d27('0x83'))]['ValidationError'](_0x1d27('0x8c'));}if(_[_0x1d27('0x75')](_0x2fc7eb['body'][_0x1d27('0x4d')])||_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0x4d')]===''){throw new db[(_0x1d27('0x83'))]['ValidationError'](_0x1d27('0x8d'));}if(_[_0x1d27('0x75')](_0x2fc7eb['body'][_0x1d27('0x8e')])){throw new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x8f')+_0x160696);}if(!_[_0x1d27('0x90')](_0x160696,_0x2fc7eb[_0x1d27('0x4d')]['mapKey'])){throw new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x91')+_0x160696);}_0x328de2[_0x2fc7eb['body'][_0x1d27('0x8e')]]=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0x8b')];})[_0x1d27('0x29')](function(){return db['ChatWebsite'][_0x1d27('0x4b')]({'where':{'id':_0x2fc7eb[_0x1d27('0x48')]['id']},'include':[{'model':db[_0x1d27('0x92')],'as':_0x1d27('0x93'),'include':[{'model':db[_0x1d27('0x94')],'as':_0x1d27('0x95'),'where':_0x328de2,'limit':0x1,'order':[[_0x1d27('0x88'),_0x1d27('0x96')]]}]},{'model':db[_0x1d27('0x97')],'as':_0x1d27('0x98')}]});})[_0x1d27('0x29')](handleEntityNotFound(_0xd0eb98,null))[_0x1d27('0x29')](function(_0x3c047c){if(_0x3c047c&&_0x3c047c['List']){_0x9f871b[_0x1d27('0x99')]=_0x3c047c;_0x9f871b[_0x1d27('0x9a')]=_0x3c047c[_0x1d27('0x98')];_0x9f871b[_0x1d27('0x9b')]=_0x3c047c[_0x1d27('0x93')];_0x9f871b[_0x1d27('0x9a')]=_[_0x1d27('0x9c')](_0x9f871b[_0x1d27('0x9a')],[_0x1d27('0x9d')],[_0x1d27('0x9e')]);if(_0x9f871b[_0x1d27('0x99')][_0x1d27('0x98')]){delete _0x9f871b[_0x1d27('0x99')][_0x1d27('0x98')];}if(_0x9f871b['account'][_0x1d27('0x93')]&&_0x9f871b[_0x1d27('0x99')][_0x1d27('0x93')][_0x1d27('0x95')][_0x1d27('0x3b')]){return _0x9f871b[_0x1d27('0x99')][_0x1d27('0x93')][_0x1d27('0x95')][0x0];}var _0x184d41=_['defaults'](_0x2fc7eb[_0x1d27('0x4d')],{'firstName':_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0x8b')],'ListId':_0x3c047c[_0x1d27('0x8a')]});_0x184d41[_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0x8e')]]=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0x8b')];return db[_0x1d27('0x94')]['create'](_0x184d41,{'fields':_0x2cb824,'raw':!![]});}})['then'](handleEntityNotFound(_0xd0eb98,null))['then'](function(_0x42fd86){_0x9f871b[_0x1d27('0x9f')]=_0x42fd86;var _0x430c7d=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xa0')];if(_0x2fc7eb[_0x1d27('0xa1')]['cf-connecting-ip']){_0x430c7d=_0x2fc7eb[_0x1d27('0xa1')]['cf-connecting-ip'];}else if(_0x2fc7eb[_0x1d27('0xa1')][_0x1d27('0xa2')]){_0x430c7d=_[_0x1d27('0xa3')](_0x2fc7eb[_0x1d27('0xa1')][_0x1d27('0xa2')][_0x1d27('0xa4')](','));}if(_0x42fd86){var _0x50544f={'ContactId':_0x42fd86['id'],'ChatWebsiteId':_0x2fc7eb[_0x1d27('0x48')]['id'],'from':(_0x42fd86[_0x1d27('0xa5')]||'')+'\x20'+(_0x42fd86[_0x1d27('0xa6')]||''),'customerIp':_0x430c7d,'customerPort':_0x2fc7eb[_0x1d27('0xa1')]['x-real-port']?_0x2fc7eb['headers']['x-real-port']:null,'referer':_0x2fc7eb[_0x1d27('0x4d')]['referer'],'browserName':_0xc7f425[_0x1d27('0xa7')][_0x1d27('0x2d')]&&_0xc7f425[_0x1d27('0xa7')][_0x1d27('0xa8')]?util[_0x1d27('0xa9')](_0x1d27('0xaa'),_0xc7f425['browser'][_0x1d27('0x2d')],_0xc7f425[_0x1d27('0xa7')][_0x1d27('0xa8')]):'unknown','browserVersion':_0xc7f425['browser']['version']||_0x1d27('0xab'),'osName':util['format'](_0x1d27('0xaa'),_0xc7f425['os']['name'],_0xc7f425['os'][_0x1d27('0xa8')]),'osVersion':_0xc7f425['os'][_0x1d27('0xa8')],'deviceModel':_0xc7f425[_0x1d27('0xac')][_0x1d27('0x3c')]&&_0xc7f425[_0x1d27('0xac')]['vendor']?util[_0x1d27('0xa9')](_0x1d27('0xad'),_0xc7f425[_0x1d27('0xac')][_0x1d27('0x3c')],_0xc7f425[_0x1d27('0xac')]['vendor'],_0xc7f425[_0x1d27('0xac')][_0x1d27('0xae')]):null,'deviceVendor':_0xc7f425['device'][_0x1d27('0xaf')],'deviceType':_0xc7f425[_0x1d27('0xac')][_0x1d27('0xae')],'formData':JSON['stringify'](_0x2fc7eb[_0x1d27('0x4d')])};var _0x5201ce={'ChatWebsiteId':_0x2fc7eb['params']['id'],'closed':![]};if(_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb0')]){_0x5201ce[_0x1d27('0xb0')]=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb0')];return db[_0x1d27('0xb1')][_0x1d27('0x4b')]({'where':_0x5201ce})['then'](function(_0xe13c03){if(_0xe13c03){return[_0xe13c03,![]];}_0x50544f['threadId']=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb0')];_0x50544f['externalUrl']=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb2')];return db['ChatInteraction'][_0x1d27('0x4c')](_0x50544f)[_0x1d27('0x29')](function(_0x711527){return[_0x711527,!![]];});});}_0x5201ce['ContactId']=_0x42fd86['id'];if(_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb3')]&&_0x2fc7eb['body'][_0x1d27('0xb3')]['id']){_0x5201ce['id']=_0x2fc7eb[_0x1d27('0x4d')]['interaction']['id'];return db[_0x1d27('0xb1')][_0x1d27('0x4b')]({'where':_0x5201ce})[_0x1d27('0x29')](function(_0x18164c){if(_0x18164c){return[_0x18164c,![]];}return db[_0x1d27('0xb1')][_0x1d27('0x4c')](_0x50544f)['then'](function(_0x28b69f){return[_0x28b69f,!![]];});});}return db[_0x1d27('0xb1')]['create'](_0x50544f)['then'](function(_0x43e876){return[_0x43e876,!![]];});}})['spread'](function(_0x3590a7,_0x3d2abd){if(_0x3590a7){_0xe7e7fe=_0x3d2abd;if(!_0x3d2abd){var _0x3aa9b0={'from':(_0x9f871b[_0x1d27('0x9f')]['firstName']||'')+'\x20'+(_0x9f871b[_0x1d27('0x9f')][_0x1d27('0xa6')]||'')};if(_0x2fc7eb[_0x1d27('0x4d')]['threadId']&&_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb4')]&&_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb0')]!=_0x2fc7eb['body']['messageId']){_0x3aa9b0[_0x1d27('0xb0')]=_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xb4')];}return _0x3590a7[_0x1d27('0x56')](_0x3aa9b0);}else{return _0x3590a7;}}})[_0x1d27('0x29')](function(_0x270fa2){_0x9f871b[_0x1d27('0xb3')]=_0x270fa2[_0x1d27('0x4f')]({'plain':!![]});_0x9f871b[_0x1d27('0xb3')][_0x1d27('0xb5')]=_0xe7e7fe;if(_0x9f871b[_0x1d27('0xb3')][_0x1d27('0xb5')]){if(_0x9f871b[_0x1d27('0x99')][_0x1d27('0xb6')]){_0x9f871b[_0x1d27('0x9a')][_0x1d27('0xb7')]({'id':0x0,'priority':_0x9f871b[_0x1d27('0x9a')][_0x1d27('0x3b')]+0x1,'app':_0x1d27('0xb8'),'appdata':_0x1d27('0xb9'),'interval':_0x1d27('0xba')});}}return db['ChatMessage'][_0x1d27('0x4c')]({'body':_0x2fc7eb[_0x1d27('0x4d')]['body'],'ChatWebsiteId':_0x2fc7eb[_0x1d27('0x48')]['id'],'ChatInteractionId':_0x270fa2['id'],'direction':'in','ContactId':_0x9f871b[_0x1d27('0x9f')]['id'],'AttachmentId':_0x2fc7eb[_0x1d27('0x4d')][_0x1d27('0xbb')]});})[_0x1d27('0x29')](function(_0x1ca3a9){_0x9f871b[_0x1d27('0x1e')]=_0x1ca3a9;if(_0x9f871b[_0x1d27('0xb3')]['UserId']){return db[_0x1d27('0xbc')][_0x1d27('0x4b')]({'attributes':['id',_0x1d27('0x2d')],'where':{'id':_0x9f871b[_0x1d27('0xb3')][_0x1d27('0xbd')]}})[_0x1d27('0x29')](function(_0x40f40f){if(_0x40f40f){_0x9f871b[_0x1d27('0x9a')][_0x1d27('0xbe')]({'id':0x0,'priority':0x0,'app':_0x1d27('0xbf'),'appdata':_0x40f40f[_0x1d27('0x2d')]+','+(_0x9f871b[_0x1d27('0x99')][_0x1d27('0xc0')]||0xa),'interval':_0x1d27('0xba')});_0x9f871b['forcedOwnership']=!![];}return respondWithRpcPromise(_0x1d27('0xc1'),_0x1d27('0xc2'),_0x9f871b);});}return respondWithRpcPromise(_0x1d27('0xc1'),_0x1d27('0xc2'),_0x9f871b);})[_0x1d27('0x29')](function(_0x29870){respondWithRpcPromise(_0x1d27('0xc3'),_0x1d27('0xc3'),{'event':'notify','message':_0x29870},client9002);return _0x29870;})[_0x1d27('0x29')](respondWithResult(_0xd0eb98,null))['catch'](handleError(_0xd0eb98,null));};exports[_0x1d27('0xc4')]=function(_0x142a82,_0x3d10e4){var _0x2f459c,_0x54a9aa,_0x4e7ca6;var _0x45d87b=[];var _0x10abc5={};var _0x4021f4=_0x142a82[_0x1d27('0xc5')]||[];var _0x536092=[];var _0xe32a85;return db['CmContact']['describe']()['then'](function(_0x302f60){if(!_0x302f60){throw new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x85'));}_0x45d87b=_[_0x1d27('0x86')](_[_0x1d27('0x36')](_0x302f60),[_0x1d27('0x87'),_0x1d27('0x88'),'CompanyId',_0x1d27('0x8a')]);if(_0x142a82[_0x1d27('0x4d')]['id']){delete _0x142a82[_0x1d27('0x4d')]['id'];}if(_['isNil'](_0x142a82[_0x1d27('0x4d')]['from'])){throw _0x3d10e4['status'](0x1f4)[_0x1d27('0xc6')](new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x8c')));}if(_[_0x1d27('0x75')](_0x142a82[_0x1d27('0x4d')]['body'])||_0x142a82[_0x1d27('0x4d')][_0x1d27('0x4d')]===''){throw _0x3d10e4[_0x1d27('0x21')](0x1f4)[_0x1d27('0xc6')](new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0x8d')));}if(_[_0x1d27('0x75')](_0x142a82['body'][_0x1d27('0xc7')])){throw _0x3d10e4['status'](0x1f4)[_0x1d27('0xc6')](new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0xc8')+_0x45d87b));}if(!_[_0x1d27('0x90')](_0x45d87b,_0x142a82['body'][_0x1d27('0xc7')])){throw _0x3d10e4[_0x1d27('0x21')](0x1f4)[_0x1d27('0xc6')](new db[(_0x1d27('0x83'))][(_0x1d27('0x84'))](_0x1d27('0xc9')+_0x45d87b));}_0x10abc5[_0x142a82[_0x1d27('0x4d')]['mapKeyOffline']]=_0x142a82['body'][_0x1d27('0x8b')];})['then'](function(){return db[_0x1d27('0x32')]['find']({'where':{'id':_0x142a82[_0x1d27('0x48')]['id']},'include':[{'model':db[_0x1d27('0x92')],'as':'List'},{'model':db[_0x1d27('0xca')],'as':_0x1d27('0xca')}]});})[_0x1d27('0x29')](handleEntityNotFound(_0x3d10e4,null))[_0x1d27('0x29')](function(_0x5d93c5){if(_0x5d93c5&&_0x5d93c5[_0x1d27('0x93')]){_0x54a9aa=_0x5d93c5;var _0x44965a=_[_0x1d27('0xc')](_0x142a82[_0x1d27('0x4d')],{'firstName':_0x142a82['body'][_0x1d27('0x8b')],'phone':_0x142a82[_0x1d27('0x4d')][_0x1d27('0x8b')],'ListId':_0x5d93c5['ListId']});_0x44965a[_0x142a82['body'][_0x1d27('0xc7')]]=_0x142a82['body'][_0x1d27('0x8b')];return db[_0x1d27('0x94')]['findOrCreate']({'where':_0x10abc5,'defaults':_0x44965a});}})[_0x1d27('0xcb')](function(_0x278c7b){if(_0x278c7b){_0x4e7ca6=_0x278c7b;var _0x3bc874=fs[_0x1d27('0xcc')](path[_0x1d27('0x70')](config[_0x1d27('0x71')],_0x1d27('0xcd')),'utf8');var _0x7c11de=ejs['render'](_0x3bc874,{'body':_[_0x1d27('0xce')](_0x142a82[_0x1d27('0x4d')][_0x1d27('0x4d')]),'bodyTitle':_0x54a9aa[_0x1d27('0xcf')]});return db['ChatOfflineMessage']['create']({'body':_0x7c11de,'plainBody':htmlToText[_0x1d27('0xd0')](_0x7c11de),'ContactId':_0x278c7b['id'],'ChatWebsiteId':_0x54a9aa['id']});}})[_0x1d27('0x29')](function(_0x5c3716){_0xe32a85=_0x5c3716;if(_0x4021f4[_0x1d27('0x3b')]){var _0x5623d5=_0x4021f4[_0x1d27('0x31')](function(_0x54f9b5){return{'name':_0x54f9b5[_0x1d27('0xd1')],'basename':_0x54f9b5[_0x1d27('0x6a')],'type':_0x54f9b5[_0x1d27('0xd2')],'ChatOfflineMessageId':_0x5c3716['id']};});_0x536092=_0x5623d5[_0x1d27('0x31')](_0x501d57=>{var _0x40755a={'filename':_0x501d57[_0x1d27('0x2d')],'path':path[_0x1d27('0x70')](config['root'],_0x1d27('0xd3'),_0x1d27('0xc5'),_0x1d27('0xd4'),'offline-chat',_0x501d57[_0x1d27('0xd5')])};return _0x40755a;});if(!_0x54a9aa[_0x1d27('0xd6')]){return db[_0x1d27('0xd7')][_0x1d27('0xd8')](function(_0x4e8820){return db[_0x1d27('0xd9')][_0x1d27('0xda')](_0x5623d5,{'transaction':_0x4e8820});});}}})['then'](function(){if(_0xe32a85){_0x2f459c=_0xe32a85;return db[_0x1d27('0xca')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x1d27('0xdb')],'as':_0x1d27('0xdc'),'raw':!![],'include':[{'model':db[_0x1d27('0xdd')],'as':_0x1d27('0xdd'),'raw':!![]}]}]});}})[_0x1d27('0x29')](function(_0x281116){if(_0x281116&&_0x281116[_0x1d27('0xdc')]&&_0x54a9aa['forwardOffline']&&_0x54a9aa[_0x1d27('0xde')]){var _0x245488=_0x281116[_0x1d27('0xdf')]();return respondWithRpcPromise('SendMail',_0x1d27('0xe0'),{'account':_0x245488,'message':{'from':util['format'](_0x1d27('0xe1'),_0x281116['name'],_0x281116[_0x1d27('0xe2')]||_0x281116[_0x1d27('0xdc')]['user']),'to':_0x54a9aa['forwardOfflineAddress'],'subject':_0x54a9aa['offlineMessageSubject'],'html':_0x2f459c[_0x1d27('0x4d')],'attachments':_0x536092}},client9003)[_0x1d27('0x29')](function(){return _0x2f459c;})[_0x1d27('0x1f')](function(_0x3529d3){logger[_0x1d27('0x1c')](_0x3529d3);});}})[_0x1d27('0x29')](function(){if(_0x54a9aa&&_0x54a9aa[_0x1d27('0xd6')]&&_0x54a9aa[_0x1d27('0xe3')]){var _0x41a2b8=[];if(_0x4021f4[_0x1d27('0x3b')]){_0x41a2b8=_0x4021f4['map'](function(_0x288871){return{'name':_0x288871[_0x1d27('0xd1')],'basename':_0x288871['filename'],'type':_0x288871['mimetype'],'ChatOfflineMessageId':_0xe32a85['id']};});}var _0x37e98d;if(!_[_0x1d27('0x75')](_0x54a9aa['subjectOffline'])){var _0x189d5e=_[_0x1d27('0x31')](_0x142a82['body'],function(_0x34b560){return _0x34b560;});var _0x1c920e=_[_0x1d27('0xe4')](_0x189d5e)[0x0];var _0x3280bc=_[_0x1d27('0xe5')](_0x1c920e,function(_0x465970){return _0x465970;});_0x37e98d=_0x3280bc[0x1][_0x54a9aa[_0x1d27('0xe6')]];}var _0x5da943={'from':_0x4e7ca6['email'],'firstName':_0x4e7ca6[_0x1d27('0xa5')],'lastName':_0x4e7ca6[_0x1d27('0xa6')],'mapKey':_0x1d27('0xe2'),'message':{'from':_0x4e7ca6[_0x1d27('0xe2')],'to':_0x54a9aa['MailAccount'][_0x1d27('0xe2')],'cc':'','subject':_[_0x1d27('0x75')](_0x37e98d)?_0x54a9aa[_0x1d27('0xe7')]:_0x37e98d,'messageId':'','sentAt':new Date(),'attach':_0x41a2b8[_0x1d27('0x3b')],'attachments':_0x41a2b8,'originChannel':'Chat','ChatWebsiteId':_0x54a9aa['id'],'ChatOfflineMessageId':_0x2f459c['id'],'originTo':_0x54a9aa[_0x1d27('0xca')][_0x1d27('0xe2')]},'body':_0x2f459c[_0x1d27('0x4d')]};var _0x5d956a={'account':{'id':_0x54a9aa[_0x1d27('0xe3')]},'body':_0x5da943,'log':_0x1d27('0xe8')};return respondWithRpcPromise(_0x1d27('0xe8'),'notifyMail',_0x5d956a,client9001)[_0x1d27('0x29')](function(){return _0x2f459c;})[_0x1d27('0x1f')](function(_0xe434d3){logger[_0x1d27('0x1c')](_0xe434d3);});}return;})['then'](function(){if(_0x2f459c){return _0x2f459c;}})[_0x1d27('0x29')](respondWithResult(_0x3d10e4,null))['catch'](function(_0x326314){logger['error'](_0x1d27('0x1f'),_0x326314);for(var _0x24eb10 of _0x4021f4){var _0x3e0cb7=path['join'](config[_0x1d27('0x71')],_0x1d27('0xd3'),'files','attachments',_0x1d27('0xe9'),_0x24eb10[_0x1d27('0x6a')]);fs_extra[_0x1d27('0xea')](_0x3e0cb7)[_0x1d27('0x1f')](function(_0x5066c9){logger[_0x1d27('0x1c')](_0x1d27('0xeb'),_0x3e0cb7,_0x5066c9);});}});};exports[_0x1d27('0xec')]=function(_0x85ad27,_0x5be281){return db['ChatInteraction'][_0x1d27('0x4b')]({'where':{'id':_0x85ad27[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x5be281,null))[_0x1d27('0x29')](function(_0x3cba48){if(_0x3cba48){return _0x3cba48['addInteraction'](_0x85ad27['body']['ids'],_['omit'](_0x85ad27[_0x1d27('0x4d')],[_0x1d27('0x60'),'id'])||{});}})[_0x1d27('0x29')](respondWithResult(_0x5be281,null))[_0x1d27('0x1f')](handleError(_0x5be281,null));};exports[_0x1d27('0xed')]=function(_0x44f35c,_0x232a1a){var _0x78d99f={'raw':![],'where':{}};var _0x1734db={};var _0xd82b4d={'count':0x0,'rows':[]};return db[_0x1d27('0x32')][_0x1d27('0x64')]({'where':{'id':_0x44f35c[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x232a1a,null))['then'](function(_0x3b83e1){if(_0x3b83e1){_0x1734db['model']=_['keys'](db[_0x1d27('0xb1')]['rawAttributes']);_0x1734db[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x44f35c[_0x1d27('0x35')]);_0x1734db[_0x1d27('0x37')]=_['intersection'](_0x1734db['model'],_0x1734db['query']);_0x78d99f[_0x1d27('0x3a')]=_[_0x1d27('0x38')](_0x1734db[_0x1d27('0x3c')],qs[_0x1d27('0x39')](_0x44f35c[_0x1d27('0x35')][_0x1d27('0x39')]));_0x78d99f['attributes']=_0x78d99f[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x78d99f['attributes']:_0x1734db[_0x1d27('0x3c')];if(!_0x44f35c[_0x1d27('0x35')][_0x1d27('0x5c')]('nolimit')){_0x78d99f['limit']=qs[_0x1d27('0x25')](_0x44f35c['query'][_0x1d27('0x25')]);_0x78d99f[_0x1d27('0x26')]=qs[_0x1d27('0x26')](_0x44f35c[_0x1d27('0x35')][_0x1d27('0x26')]);}_0x78d99f[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x44f35c[_0x1d27('0x35')]['sort']);_0x78d99f[_0x1d27('0x40')]=qs['filters'](_[_0x1d27('0x5d')](_0x44f35c[_0x1d27('0x35')],_0x1734db[_0x1d27('0x37')]));_0x78d99f[_0x1d27('0x40')][_0x1d27('0x59')]=_0x3b83e1['id'];if(_0x44f35c[_0x1d27('0x35')]['filter']){_0x78d99f[_0x1d27('0x40')]=_[_0x1d27('0x42')](_0x78d99f[_0x1d27('0x40')],{'$or':_[_0x1d27('0x31')](_0x78d99f['attributes'],function(_0x520e15){var _0x123124={};_0x123124[_0x520e15]={'$like':'%'+_0x44f35c[_0x1d27('0x35')]['filter']+'%'};return _0x123124;})});}_0x78d99f=_[_0x1d27('0x42')]({},_0x78d99f,_0x44f35c['options']);return db[_0x1d27('0xb1')]['count']({'where':_0x78d99f['where']})['then'](function(_0xbcedc4){_0xd82b4d['count']=_0xbcedc4;if(_0x44f35c[_0x1d27('0x35')]['includeAll']){_0x78d99f[_0x1d27('0x45')]=[{'model':db[_0x1d27('0x94')],'as':_0x1d27('0xee'),'required':![]},{'model':db[_0x1d27('0xbc')],'as':'Owner','attributes':[_0x1d27('0x2d'),_0x1d27('0xef'),_0x1d27('0xf0')],'required':![]},{'model':db['Tag'],'as':_0x1d27('0xf1'),'attributes':['id','name',_0x1d27('0xf2')],'where':_0x44f35c[_0x1d27('0x35')][_0x1d27('0xf3')]?{'id':_0x44f35c[_0x1d27('0x35')][_0x1d27('0xf3')]}:undefined,'required':_0x44f35c[_0x1d27('0x35')][_0x1d27('0xf3')]?!![]:![]}];}return db[_0x1d27('0xb1')][_0x1d27('0x5e')](_0x78d99f);})[_0x1d27('0x29')](function(_0x52c853){_0xd82b4d[_0x1d27('0x46')]=_0x52c853;return _0xd82b4d;});}})[_0x1d27('0x29')](respondWithFilteredResult(_0x232a1a,_0x78d99f))[_0x1d27('0x1f')](handleError(_0x232a1a,null));};function iftimePromise(_0x297726,_0x1a3e66){return respondWithRpcPromise('Command',_0x1d27('0xf4'),{'command':_0x1a3e66[_0x1d27('0xf5')]?util[_0x1d27('0xa9')]('iftime\x20%s,%s',_0x297726[_0x1d27('0xf6')],_0x1a3e66[_0x1d27('0xf5')]):util[_0x1d27('0xa9')]('iftime\x20%s',_0x297726['interval'])},client9002)[_0x1d27('0x29')](function(_0x3e3aac){var _0x521021=_0x3e3aac&&_0x3e3aac[_0x1d27('0xf7')]('true')>=0x0?!![]:![];logger[_0x1d27('0x16')](_0x1d27('0xf8'),_0x1a3e66['id'],_0x297726['id'],_0x297726[_0x1d27('0xf6')],_0x521021?_0x1d27('0xf9'):'OFFLINE',_0x1a3e66[_0x1d27('0xf5')]?_0x1a3e66[_0x1d27('0xf5')]:_0x1d27('0xfa'));return _0x521021;})[_0x1d27('0x1f')](function(_0x49c2f1){logger[_0x1d27('0x1c')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1a3e66['id'],_0x297726['id'],_0x297726[_0x1d27('0xf6')],util[_0x1d27('0xfb')](_0x49c2f1,{'showHidden':![],'depth':null}),_0x1a3e66[_0x1d27('0xf5')]?_0x1a3e66[_0x1d27('0xf5')]:'No\x20timezone');return![];});}exports[_0x1d27('0xf4')]=function(_0x6d57f9,_0x22f100){var _0x599e6e=0x0;var _0x3d8df1=0x0;var _0x77e08a=![];var _0x489892;var _0x1de58c;return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x6d57f9[_0x1d27('0x48')]['id']},'include':[{'model':db['Interval'],'as':_0x1d27('0xfc'),'include':[{'model':db[_0x1d27('0xfc')],'as':_0x1d27('0xfd'),'attributes':['id',_0x1d27('0xf6')],'raw':!![]}]}]})[_0x1d27('0x29')](handleEntityNotFound(_0x22f100,null))[_0x1d27('0x29')](function(_0x5e4524){if(_0x5e4524){_0x489892=_0x5e4524;return _0x5e4524['getProactiveActions']({'raw':!![]});}})[_0x1d27('0x29')](function(_0x9ca8a4){if(_0x489892){if(_0x9ca8a4){_0x1de58c=_0x9ca8a4;}}return require(_0x1d27('0xfe'))[_0x1d27('0x73')]();})[_0x1d27('0x29')](function(_0x55c26c){if(_0x55c26c){_0x3d8df1=_0x55c26c[_0x1d27('0xff')];_0x77e08a=_0x55c26c[_0x1d27('0x74')];}})[_0x1d27('0x29')](function(){return db[_0x1d27('0xb1')][_0x1d27('0x44')]({'where':{'closed':![]}});})[_0x1d27('0x29')](function(_0x3c2397){_0x599e6e=_0x3c2397;if(_0x3d8df1&&_0x3c2397>_0x3d8df1){return db[_0x1d27('0x100')][_0x1d27('0x64')]({'where':{'id':0x1}})[_0x1d27('0x29')](function(_0x2e958a){if(_0x2e958a){_0x2e958a[_0x1d27('0x101')](_0x1d27('0x102'));}});}})[_0x1d27('0x29')](function(){if(_0x489892[_0x1d27('0xfc')]&&_0x489892[_0x1d27('0xfc')]['Intervals']){var _0x357dc9=[];for(var _0x4ca7c5=0x0;_0x4ca7c5<_0x489892['Interval'][_0x1d27('0xfd')]['length'];_0x4ca7c5++){var _0x536cf3=_0x489892['Interval']['Intervals'][_0x4ca7c5]['get']({'plain':!![]});_0x357dc9[_0x1d27('0xb7')](iftimePromise(_0x536cf3,_0x489892));}return BPromise['all'](_0x357dc9)[_0x1d27('0x29')](function(_0x204957){return _[_0x1d27('0x103')](_0x204957);});}else{return!![];}})[_0x1d27('0x29')](function(_0x1e502e){var _0xa3e4c2=fs[_0x1d27('0xcc')](path[_0x1d27('0x70')](config['root'],_0x1d27('0x104')),_0x1d27('0x105'));var _0x12f080={'remote':_0x489892[_0x1d27('0x106')],'query':querystring[_0x1d27('0x1b')](_[_0x1d27('0x42')](_0x489892[_0x1d27('0x4f')]({'plain':!![]}),{'customerIp':_0x6d57f9[_0x1d27('0xa1')][_0x1d27('0xa2')]||_0x6d57f9[_0x1d27('0xa1')][_0x1d27('0x107')]||_0x6d57f9[_0x1d27('0x108')][_0x1d27('0x109')]||_0x6d57f9['ip'],'referer':_0x6d57f9[_0x1d27('0xa1')][_0x1d27('0x10a')],'openedInteractions':_0x599e6e,'maxInteractions':_0x3d8df1,'virtual':_0x77e08a[_0x1d27('0xff')],'online':_0x1e502e,'custom':_0x77e08a}))[_0x1d27('0x10b')](/'/g,'\x5c\x27')};_0x22f100['send'](ejs[_0x1d27('0x10c')](Mustache['render'](_0xa3e4c2,_0x12f080),{'proactiveActions':_0x1de58c,'alignment':_0x489892[_0x1d27('0x10d')],'verticalAlignment':_0x489892['verticalAlignment'],'div_color':_0x489892[_0x1d27('0xf2')],'labelText':_0x489892[_0x1d27('0x10e')],'text_color':_0x489892[_0x1d27('0x10f')],'text_button_color':_0x489892[_0x1d27('0x110')],'button_color':_0x489892[_0x1d27('0x111')],'background_color':_0x489892[_0x1d27('0x112')],'hideWhenOffline':_0x489892[_0x1d27('0x113')],'interval':_0x489892[_0x1d27('0x114')]}));})[_0x1d27('0x1f')](handleError(_0x22f100,null));};exports[_0x1d27('0x115')]=function(_0x17efa2,_0x3d4390){var _0xd84684=_0x17efa2[_0x1d27('0x48')]['id'];var _0x103e01=_0x17efa2[_0x1d27('0x4d')];var _0x20e8d4=0xc8;var _0x3d576a=null;return db['sequelize'][_0x1d27('0xd8')]({'isolationLevel':db[_0x1d27('0xd7')][_0x1d27('0x116')][_0x1d27('0x117')][_0x1d27('0x118')]},function(_0x39618d){return db['ChatWebsite'][_0x1d27('0x64')]({'where':{'id':_0xd84684},'transaction':_0x39618d})[_0x1d27('0x29')](function(_0x527893){if(_0x527893){return db[_0x1d27('0x97')][_0x1d27('0x2b')]({'where':{'ChatWebsiteId':_0xd84684},'transaction':_0x39618d})[_0x1d27('0x29')](function(){var _0x52f761=_[_0x1d27('0x31')](_0x103e01,function(_0x57a656){_0x57a656[_0x1d27('0x59')]=_0xd84684;return _0x57a656;});return db[_0x1d27('0x97')][_0x1d27('0xda')](_0x52f761,{'transaction':_0x39618d});});}else{_0x20e8d4=0x194;_0x3d576a=[];}});})[_0x1d27('0x29')](function(){if(_0x20e8d4!==0x194){return db['ChatApplication'][_0x1d27('0x119')]({'where':{'ChatWebsiteId':_0xd84684},'order':_0x1d27('0x9d')})[_0x1d27('0x29')](function(_0x10453b){_0x3d576a=_0x10453b;});}})[_0x1d27('0x1f')](function(_0x44e436){_0x20e8d4=0x1f4;logger[_0x1d27('0x1c')](_0x44e436['stack']);if(_0x44e436[_0x1d27('0x2d')]){delete _0x44e436[_0x1d27('0x2d')];}_0x3d576a=_0x44e436;})[_0x1d27('0x11a')](function(){if(_0x3d576a===null){_0x3d4390['sendStatus'](_0x20e8d4);}else{if(_0x20e8d4===0x1f4){_0x3d4390[_0x1d27('0x21')](_0x20e8d4)['send'](_0x3d576a);}else{_0x3d4390[_0x1d27('0x21')](_0x20e8d4)[_0x1d27('0x23')](_0x3d576a);}}});};exports[_0x1d27('0x11b')]=function(_0x3e8043,_0x1b6555){var _0x5d7d72={};var _0x131ffb={};var _0x4cd256;var _0x4a8161;return db['ChatWebsite']['findOne']({'where':{'id':_0x3e8043[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x1b6555,null))[_0x1d27('0x29')](function(_0x9cc1ea){if(_0x9cc1ea){_0x4cd256=_0x9cc1ea;_0x131ffb[_0x1d27('0x3c')]=_['keys'](db[_0x1d27('0x97')][_0x1d27('0x33')]);_0x131ffb['query']=_['keys'](_0x3e8043['query']);_0x131ffb[_0x1d27('0x37')]=_['intersection'](_0x131ffb['model'],_0x131ffb[_0x1d27('0x35')]);_0x5d7d72['attributes']=_[_0x1d27('0x38')](_0x131ffb[_0x1d27('0x3c')],qs[_0x1d27('0x39')](_0x3e8043[_0x1d27('0x35')]['fields']));_0x5d7d72['attributes']=_0x5d7d72[_0x1d27('0x3a')]['length']?_0x5d7d72[_0x1d27('0x3a')]:_0x131ffb[_0x1d27('0x3c')];_0x5d7d72[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x3e8043[_0x1d27('0x35')][_0x1d27('0x3f')]);_0x5d7d72[_0x1d27('0x40')]=qs[_0x1d27('0x37')](_[_0x1d27('0x5d')](_0x3e8043[_0x1d27('0x35')],_0x131ffb['filters']));if(_0x3e8043[_0x1d27('0x35')][_0x1d27('0x41')]){_0x5d7d72['where']=_[_0x1d27('0x42')](_0x5d7d72['where'],{'$or':_[_0x1d27('0x31')](_0x5d7d72[_0x1d27('0x3a')],function(_0x245ca3){var _0x2b82fa={};_0x2b82fa[_0x245ca3]={'$like':'%'+_0x3e8043[_0x1d27('0x35')][_0x1d27('0x41')]+'%'};return _0x2b82fa;})});}_0x5d7d72=_[_0x1d27('0x42')]({},_0x5d7d72,_0x3e8043[_0x1d27('0x4a')]);return _0x4cd256[_0x1d27('0x11b')](_0x5d7d72);}})[_0x1d27('0x29')](function(_0x5bd383){if(_0x5bd383){_0x4a8161=_0x5bd383[_0x1d27('0x3b')];if(!_0x3e8043[_0x1d27('0x35')][_0x1d27('0x5c')](_0x1d27('0x3d'))){_0x5d7d72[_0x1d27('0x25')]=qs[_0x1d27('0x25')](_0x3e8043[_0x1d27('0x35')]['limit']);_0x5d7d72[_0x1d27('0x26')]=qs[_0x1d27('0x26')](_0x3e8043['query']['offset']);}return _0x4cd256[_0x1d27('0x11b')](_0x5d7d72);}})[_0x1d27('0x29')](function(_0x32dda6){if(_0x32dda6){return _0x32dda6?{'count':_0x4a8161,'rows':_0x32dda6}:null;}})[_0x1d27('0x29')](respondWithResult(_0x1b6555,null))[_0x1d27('0x1f')](handleError(_0x1b6555,null));};exports[_0x1d27('0x11c')]=function(_0x1a7aea,_0x4f77ce){return db[_0x1d27('0x11d')][_0x1d27('0x4b')]({'where':{'id':_0x1a7aea['params']['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x4f77ce,null))[_0x1d27('0x29')](function(_0x575b5f){if(_0x575b5f){return _0x575b5f[_0x1d27('0x11c')](_0x1a7aea['body'][_0x1d27('0x60')],_[_0x1d27('0x11e')](_0x1a7aea[_0x1d27('0x4d')],[_0x1d27('0x60'),'id'])||{});}})[_0x1d27('0x29')](respondWithResult(_0x4f77ce,null))[_0x1d27('0x1f')](handleError(_0x4f77ce,null));};exports['getProactiveActions']=function(_0x1fef61,_0x577e74){var _0x5da117={};var _0xaf85a7={};var _0x31dd3f;var _0x18ad6a;return db[_0x1d27('0x32')][_0x1d27('0x64')]({'where':{'id':_0x1fef61[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x577e74,null))[_0x1d27('0x29')](function(_0x38b545){if(_0x38b545){_0x31dd3f=_0x38b545;_0xaf85a7[_0x1d27('0x3c')]=_[_0x1d27('0x36')](db[_0x1d27('0x11f')]['rawAttributes']);_0xaf85a7[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x1fef61[_0x1d27('0x35')]);_0xaf85a7['filters']=_[_0x1d27('0x38')](_0xaf85a7[_0x1d27('0x3c')],_0xaf85a7[_0x1d27('0x35')]);_0x5da117[_0x1d27('0x3a')]=_['intersection'](_0xaf85a7['model'],qs['fields'](_0x1fef61[_0x1d27('0x35')][_0x1d27('0x39')]));_0x5da117[_0x1d27('0x3a')]=_0x5da117[_0x1d27('0x3a')]['length']?_0x5da117['attributes']:_0xaf85a7[_0x1d27('0x3c')];_0x5da117[_0x1d27('0x3e')]=qs['sort'](_0x1fef61[_0x1d27('0x35')][_0x1d27('0x3f')]);_0x5da117[_0x1d27('0x40')]=qs[_0x1d27('0x37')](_[_0x1d27('0x5d')](_0x1fef61[_0x1d27('0x35')],_0xaf85a7['filters']));if(_0x1fef61[_0x1d27('0x35')][_0x1d27('0x41')]){_0x5da117['where']=_[_0x1d27('0x42')](_0x5da117[_0x1d27('0x40')],{'$or':_['map'](_0x5da117[_0x1d27('0x3a')],function(_0x32bced){var _0x1344c9={};_0x1344c9[_0x32bced]={'$like':'%'+_0x1fef61[_0x1d27('0x35')][_0x1d27('0x41')]+'%'};return _0x1344c9;})});}_0x5da117=_[_0x1d27('0x42')]({},_0x5da117,_0x1fef61[_0x1d27('0x4a')]);return _0x31dd3f[_0x1d27('0x120')](_0x5da117);}})[_0x1d27('0x29')](function(_0x211397){if(_0x211397){_0x18ad6a=_0x211397[_0x1d27('0x3b')];if(!_0x1fef61['query'][_0x1d27('0x5c')]('nolimit')){_0x5da117[_0x1d27('0x25')]=qs[_0x1d27('0x25')](_0x1fef61['query'][_0x1d27('0x25')]);_0x5da117[_0x1d27('0x26')]=qs[_0x1d27('0x26')](_0x1fef61[_0x1d27('0x35')][_0x1d27('0x26')]);}return _0x31dd3f['getProactiveActions'](_0x5da117);}})[_0x1d27('0x29')](function(_0x5775ff){if(_0x5775ff){return _0x5775ff?{'count':_0x18ad6a,'rows':_0x5775ff}:null;}})['then'](respondWithResult(_0x577e74,null))[_0x1d27('0x1f')](handleError(_0x577e74,null));};exports[_0x1d27('0x121')]=function(_0x1a6743,_0x132638){var _0x56d916=_0x1a6743[_0x1d27('0x35')][_0x1d27('0x122')]===_0x1d27('0x123')?_0x1d27('0x124'):_0x1d27('0x125');return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'attributes':['id',_0x56d916],'where':{'id':_0x1a6743[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x132638,null))[_0x1d27('0x29')](function(_0x100755){if(_0x100755){var _0xad11d3=_0x100755[_0x56d916];var _0x13d745=_0xad11d3&&_0xad11d3[_0x1d27('0x126')]?_0xad11d3[_0x1d27('0x126')]:[];_0x132638[_0x1d27('0xc6')]({'fromKey':_[_0x1d27('0x75')](_0xad11d3['fromKey'])?undefined:_0xad11d3[_0x1d27('0x127')],'count':_0x13d745[_0x1d27('0x3b')],'rows':_0x13d745});}})[_0x1d27('0x1f')](handleError(_0x132638,null));};exports[_0x1d27('0x128')]=function(_0x541c87,_0x4b5384){var _0x76512a={'raw':![],'where':{}};var _0x31566e={};var _0x11a948={'count':0x0,'rows':[]};return db[_0x1d27('0x32')][_0x1d27('0x64')]({'where':{'id':_0x541c87[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x4b5384,null))['then'](function(_0xee318e){if(_0xee318e){_0x31566e[_0x1d27('0x3c')]=_['keys'](db[_0x1d27('0x129')]['rawAttributes']);_0x31566e[_0x1d27('0x35')]=_['keys'](_0x541c87[_0x1d27('0x35')]);_0x31566e[_0x1d27('0x37')]=_[_0x1d27('0x38')](_0x31566e[_0x1d27('0x3c')],_0x31566e[_0x1d27('0x35')]);_0x76512a[_0x1d27('0x3a')]=_[_0x1d27('0x38')](_0x31566e[_0x1d27('0x3c')],qs[_0x1d27('0x39')](_0x541c87[_0x1d27('0x35')][_0x1d27('0x39')]));_0x76512a['attributes']=_0x76512a[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x76512a[_0x1d27('0x3a')]:_0x31566e[_0x1d27('0x3c')];if(!_0x541c87[_0x1d27('0x35')][_0x1d27('0x5c')](_0x1d27('0x3d'))){_0x76512a[_0x1d27('0x25')]=qs[_0x1d27('0x25')](_0x541c87[_0x1d27('0x35')][_0x1d27('0x25')]);_0x76512a[_0x1d27('0x26')]=qs[_0x1d27('0x26')](_0x541c87[_0x1d27('0x35')]['offset']);}_0x76512a[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x541c87[_0x1d27('0x35')][_0x1d27('0x3f')]);_0x76512a[_0x1d27('0x40')]=qs[_0x1d27('0x37')](_['pick'](_0x541c87[_0x1d27('0x35')],_0x31566e[_0x1d27('0x37')]));_0x76512a[_0x1d27('0x40')][_0x1d27('0x59')]=_0xee318e['id'];if(_0x541c87[_0x1d27('0x35')][_0x1d27('0x41')]){_0x76512a[_0x1d27('0x40')]=_[_0x1d27('0x42')](_0x76512a[_0x1d27('0x40')],{'$or':_['map'](_0x76512a['attributes'],function(_0x4ce544){var _0x5759b3={};_0x5759b3[_0x4ce544]={'$like':'%'+_0x541c87[_0x1d27('0x35')]['filter']+'%'};return _0x5759b3;})});}_0x76512a=_[_0x1d27('0x42')]({},_0x76512a,_0x541c87['options']);return db['ChatOfflineMessage'][_0x1d27('0x44')]({'where':_0x76512a[_0x1d27('0x40')]})['then'](function(_0x2274d1){_0x11a948[_0x1d27('0x44')]=_0x2274d1;if(_0x541c87['query'][_0x1d27('0x49')]){_0x76512a[_0x1d27('0x45')]=[{'all':!![]}];}else{_0x76512a[_0x1d27('0x45')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0x1d27('0x12a'),'required':![]}];}return db[_0x1d27('0x129')][_0x1d27('0x5e')](_0x76512a);})[_0x1d27('0x29')](function(_0x4eb5c0){_0x11a948[_0x1d27('0x46')]=_0x4eb5c0;return _0x11a948;});}})[_0x1d27('0x29')](respondWithFilteredResult(_0x4b5384,_0x76512a))['catch'](handleError(_0x4b5384,null));};exports[_0x1d27('0x12b')]=function(_0x4607a2,_0x4fcc7d){return db[_0x1d27('0x32')][_0x1d27('0x4b')]({'where':{'id':_0x4607a2[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x4fcc7d,null))[_0x1d27('0x29')](function(_0x12c57e){if(_0x12c57e){return _0x12c57e[_0x1d27('0x12b')](_0x4607a2[_0x1d27('0x4d')][_0x1d27('0x60')],_['omit'](_0x4607a2[_0x1d27('0x4d')],['ids','id'])||{})['spread'](function(_0x288a52){for(var _0x5a7746=0x0;_0x5a7746<_0x4607a2[_0x1d27('0x4d')][_0x1d27('0x60')][_0x1d27('0x3b')];_0x5a7746+=0x1){socket[_0x1d27('0x12c')]('userChatWebsite:save',{'UserId':Number(_0x4607a2[_0x1d27('0x4d')][_0x1d27('0x60')][_0x5a7746]),'ChatWebsiteId':Number(_0x4607a2[_0x1d27('0x48')]['id'])});}return _0x288a52;});}})[_0x1d27('0x29')](respondWithResult(_0x4fcc7d,null))[_0x1d27('0x1f')](handleError(_0x4fcc7d,null));};exports['removeAgents']=function(_0x2fca52,_0x1a4a31){return db[_0x1d27('0x32')]['find']({'where':{'id':_0x2fca52[_0x1d27('0x48')]['id']}})[_0x1d27('0x29')](handleEntityNotFound(_0x1a4a31,null))[_0x1d27('0x29')](function(_0xd58c1){if(_0xd58c1){return _0xd58c1[_0x1d27('0x12d')](_0x2fca52[_0x1d27('0x35')][_0x1d27('0x60')])[_0x1d27('0x29')](function(){if(_[_0x1d27('0x12e')](_0x2fca52['query']['ids'])){for(var _0x3c09e7=0x0;_0x3c09e7<_0x2fca52[_0x1d27('0x35')][_0x1d27('0x60')]['length'];_0x3c09e7+=0x1){socket['emit'](_0x1d27('0x12f'),{'UserId':Number(_0x2fca52[_0x1d27('0x35')]['ids'][_0x3c09e7]),'ChatWebsiteId':Number(_0x2fca52['params']['id'])});}}else{socket[_0x1d27('0x12c')](_0x1d27('0x12f'),{'UserId':Number(_0x2fca52[_0x1d27('0x35')][_0x1d27('0x60')]),'ChatWebsiteId':Number(_0x2fca52[_0x1d27('0x48')]['id'])});}});}})[_0x1d27('0x29')](respondWithStatusCode(_0x1a4a31,null))[_0x1d27('0x1f')](handleError(_0x1a4a31,null));};exports['getAgents']=function(_0x22c201,_0x401729){var _0x5b43ef={};var _0x3b8cbf={};var _0x9651a;var _0x4c23fa;return db['ChatWebsite'][_0x1d27('0x64')]({'where':{'id':_0x22c201[_0x1d27('0x48')]['id']}})['then'](handleEntityNotFound(_0x401729,null))[_0x1d27('0x29')](function(_0x350d16){if(_0x350d16){_0x9651a=_0x350d16;_0x3b8cbf[_0x1d27('0x3c')]=_['keys'](db['User'][_0x1d27('0x33')]);_0x3b8cbf[_0x1d27('0x35')]=_[_0x1d27('0x36')](_0x22c201[_0x1d27('0x35')]);_0x3b8cbf['filters']=_['intersection'](_0x3b8cbf[_0x1d27('0x3c')],_0x3b8cbf[_0x1d27('0x35')]);_0x5b43ef[_0x1d27('0x3a')]=_['intersection'](_0x3b8cbf[_0x1d27('0x3c')],qs[_0x1d27('0x39')](_0x22c201[_0x1d27('0x35')][_0x1d27('0x39')]));_0x5b43ef[_0x1d27('0x3a')]=_0x5b43ef[_0x1d27('0x3a')][_0x1d27('0x3b')]?_0x5b43ef[_0x1d27('0x3a')]:_0x3b8cbf[_0x1d27('0x3c')];_0x5b43ef[_0x1d27('0x3e')]=qs[_0x1d27('0x3f')](_0x22c201[_0x1d27('0x35')][_0x1d27('0x3f')]);_0x5b43ef[_0x1d27('0x40')]=qs[_0x1d27('0x37')](_[_0x1d27('0x5d')](_0x22c201[_0x1d27('0x35')],_0x3b8cbf['filters']));if(_0x22c201['query'][_0x1d27('0x41')]){_0x5b43ef['where']=_[_0x1d27('0x42')](_0x5b43ef[_0x1d27('0x40')],{'$or':_[_0x1d27('0x31')](_0x5b43ef['attributes'],function(_0x41567b){var _0x573a91={};_0x573a91[_0x41567b]={'$like':'%'+_0x22c201[_0x1d27('0x35')][_0x1d27('0x41')]+'%'};return _0x573a91;})});}_0x5b43ef=_[_0x1d27('0x42')]({},_0x5b43ef,_0x22c201[_0x1d27('0x4a')]);return _0x9651a[_0x1d27('0x130')](_0x5b43ef);}})[_0x1d27('0x29')](function(_0x1a2bb1){if(_0x1a2bb1){_0x4c23fa=_0x1a2bb1[_0x1d27('0x3b')];if(!_0x22c201[_0x1d27('0x35')][_0x1d27('0x5c')]('nolimit')){_0x5b43ef['limit']=qs[_0x1d27('0x25')](_0x22c201[_0x1d27('0x35')][_0x1d27('0x25')]);_0x5b43ef['offset']=qs['offset'](_0x22c201[_0x1d27('0x35')]['offset']);}return _0x9651a[_0x1d27('0x130')](_0x5b43ef);}})[_0x1d27('0x29')](function(_0x4eeba6){if(_0x4eeba6){return _0x4eeba6?{'count':_0x4c23fa,'rows':_0x4eeba6}:null;}})[_0x1d27('0x29')](respondWithResult(_0x401729,null))[_0x1d27('0x1f')](handleError(_0x401729,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index d0b4d6c..0328c86 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 _0xf021=['emit','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','remove'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xf021,0x18f));var _0x1f02=function(_0x224ad0,_0x2482bd){_0x224ad0=_0x224ad0-0x0;var _0x2e04fc=_0xf021[_0x224ad0];return _0x2e04fc;};'use strict';var EventEmitter=require(_0x1f02('0x0'));var ChatWebsite=require(_0x1f02('0x1'))['db'][_0x1f02('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1f02('0x3')](0x0);var events={'afterCreate':_0x1f02('0x4'),'afterUpdate':'update','afterDestroy':_0x1f02('0x5')};function emitEvent(_0x54cd44){return function(_0x2e8594,_0x3164f0,_0x51eff6){ChatWebsiteEvents['emit'](_0x54cd44+':'+_0x2e8594['id'],_0x2e8594);ChatWebsiteEvents[_0x1f02('0x6')](_0x54cd44,_0x2e8594);_0x51eff6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x1f02('0x7')](e,emitEvent(event));}}module[_0x1f02('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xece0=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x420191,_0x459143){var _0x223437=function(_0x3ec963){while(--_0x3ec963){_0x420191['push'](_0x420191['shift']());}};_0x223437(++_0x459143);}(_0xece0,0xa5));var _0x0ece=function(_0x29c122,_0x3abac9){_0x29c122=_0x29c122-0x0;var _0x349f8e=_0xece0[_0x29c122];return _0x349f8e;};'use strict';var EventEmitter=require(_0x0ece('0x0'));var ChatWebsite=require(_0x0ece('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0ece('0x2')](0x0);var events={'afterCreate':_0x0ece('0x3'),'afterUpdate':'update','afterDestroy':_0x0ece('0x4')};function emitEvent(_0x186cfb){return function(_0xc9c26b,_0x5f1c86,_0x4fdae7){ChatWebsiteEvents[_0x0ece('0x5')](_0x186cfb+':'+_0xc9c26b['id'],_0xc9c26b);ChatWebsiteEvents[_0x0ece('0x5')](_0x186cfb,_0xc9c26b);_0x4fdae7(null);};}for(var e in events){if(events[_0x0ece('0x6')](e)){var event=events[e];ChatWebsite[_0x0ece('0x7')](e,emitEvent(event));}}module[_0x0ece('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index b5ffe36..1cf4d39 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 _0xf665=['lodash','util','../../config/logger','api','moment','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x5affbd,_0x594b38){var _0x5093a8=function(_0xe8b562){while(--_0xe8b562){_0x5affbd['push'](_0x5affbd['shift']());}};_0x5093a8(++_0x594b38);}(_0xf665,0x84));var _0x5f66=function(_0x47bb19,_0x17a096){_0x47bb19=_0x47bb19-0x0;var _0x4ef57a=_0xf665[_0x47bb19];return _0x4ef57a;};'use strict';var _=require(_0x5f66('0x0'));var util=require(_0x5f66('0x1'));var logger=require(_0x5f66('0x2'))(_0x5f66('0x3'));var moment=require(_0x5f66('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5f66('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f66('0x6'));module[_0x5f66('0x7')]=function(_0x5dcbc6,_0x2e3605){return _0x5dcbc6[_0x5f66('0x8')](_0x5f66('0x9'),attributes,{'tableName':_0x5f66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc88f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash'];(function(_0x389cd4,_0x3fbf77){var _0x5e1c69=function(_0x42ba7d){while(--_0x42ba7d){_0x389cd4['push'](_0x389cd4['shift']());}};_0x5e1c69(++_0x3fbf77);}(_0xc88f,0x133));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var logger=require(_0xfc88('0x2'))(_0xfc88('0x3'));var moment=require(_0xfc88('0x4'));var BPromise=require(_0xfc88('0x5'));var rp=require(_0xfc88('0x6'));var fs=require('fs');var path=require(_0xfc88('0x7'));var rimraf=require(_0xfc88('0x8'));var config=require(_0xfc88('0x9'));var attributes=require(_0xfc88('0xa'));module[_0xfc88('0xb')]=function(_0x5a73d0,_0xae248d){return _0x5a73d0[_0xfc88('0xc')](_0xfc88('0xd'),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 9c9f493..a3e7b32 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 _0x97ea=['localhost','./chatWebsite.socket','register','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x28831e,_0x57062b){var _0x57c7a0=function(_0x34c775){while(--_0x34c775){_0x28831e['push'](_0x28831e['shift']());}};_0x57c7a0(++_0x57062b);}(_0x97ea,0x1f3));var _0xa97e=function(_0x1c6289,_0x389a28){_0x1c6289=_0x1c6289-0x0;var _0x28ab7a=_0x97ea[_0x1c6289];return _0x28ab7a;};'use strict';var _=require(_0xa97e('0x0'));var util=require(_0xa97e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa97e('0x2'));var fs=require('fs');var Redis=require(_0xa97e('0x3'));var db=require(_0xa97e('0x4'))['db'];var utils=require(_0xa97e('0x5'));var logger=require(_0xa97e('0x6'))(_0xa97e('0x7'));var config=require(_0xa97e('0x8'));var jayson=require(_0xa97e('0x9'));var client=jayson[_0xa97e('0xa')][_0xa97e('0xb')]({'port':0x232a});config[_0xa97e('0xc')]=_[_0xa97e('0xd')](config[_0xa97e('0xc')],{'host':_0xa97e('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa97e('0xc')]));require(_0xa97e('0xf'))[_0xa97e('0x10')](socket);function respondWithRpcPromise(_0x484536,_0x595d7f,_0x59e7c7){return new BPromise(function(_0x56e226,_0x39c379){return client['request'](_0x484536,_0x59e7c7)[_0xa97e('0x11')](function(_0x4dd3a2){logger['info'](_0xa97e('0x12'),_0x595d7f,'request\x20sent');logger[_0xa97e('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x595d7f,_0xa97e('0x14'),JSON[_0xa97e('0x15')](_0x4dd3a2));if(_0x4dd3a2[_0xa97e('0x16')]){if(_0x4dd3a2['error']['code']===0x1f4){logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x4dd3a2[_0xa97e('0x16')][_0xa97e('0x17')]);return _0x39c379(_0x4dd3a2['error'][_0xa97e('0x17')]);}logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x4dd3a2[_0xa97e('0x16')][_0xa97e('0x17')]);return _0x56e226(_0x4dd3a2['error']['message']);}else{logger[_0xa97e('0x18')](_0xa97e('0x12'),_0x595d7f,_0xa97e('0x14'));_0x56e226(_0x4dd3a2[_0xa97e('0x19')][_0xa97e('0x17')]);}})[_0xa97e('0x1a')](function(_0x3a8a60){logger[_0xa97e('0x16')](_0xa97e('0x12'),_0x595d7f,_0x3a8a60);_0x39c379(_0x3a8a60);});});} \ No newline at end of file +var _0x57ea=['ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info'];(function(_0x323253,_0x530316){var _0x4e7b84=function(_0x52b8aa){while(--_0x52b8aa){_0x323253['push'](_0x323253['shift']());}};_0x4e7b84(++_0x530316);}(_0x57ea,0x1c2));var _0xa57e=function(_0x128239,_0x30a688){_0x128239=_0x128239-0x0;var _0x5543df=_0x57ea[_0x128239];return _0x5543df;};'use strict';var _=require(_0xa57e('0x0'));var util=require(_0xa57e('0x1'));var moment=require(_0xa57e('0x2'));var BPromise=require(_0xa57e('0x3'));var rs=require(_0xa57e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa57e('0x5'))['db'];var utils=require(_0xa57e('0x6'));var logger=require(_0xa57e('0x7'))('rpc');var config=require(_0xa57e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa57e('0x9')]({'port':0x232a});config[_0xa57e('0xa')]=_[_0xa57e('0xb')](config['redis'],{'host':_0xa57e('0xc'),'port':0x18eb});var socket=require(_0xa57e('0xd'))(new Redis(config['redis']));require(_0xa57e('0xe'))[_0xa57e('0xf')](socket);function respondWithRpcPromise(_0x55d249,_0x32745b,_0x110777){return new BPromise(function(_0x19cf0d,_0x59442c){return client['request'](_0x55d249,_0x110777)[_0xa57e('0x10')](function(_0x40aa33){logger[_0xa57e('0x11')](_0xa57e('0x12'),_0x32745b,_0xa57e('0x13'));logger[_0xa57e('0x14')](_0xa57e('0x15'),_0x32745b,_0xa57e('0x13'),JSON[_0xa57e('0x16')](_0x40aa33));if(_0x40aa33['error']){if(_0x40aa33[_0xa57e('0x17')][_0xa57e('0x18')]===0x1f4){logger['error'](_0xa57e('0x12'),_0x32745b,_0x40aa33['error']['message']);return _0x59442c(_0x40aa33[_0xa57e('0x17')]['message']);}logger[_0xa57e('0x17')](_0xa57e('0x12'),_0x32745b,_0x40aa33['error'][_0xa57e('0x19')]);return _0x19cf0d(_0x40aa33['error'][_0xa57e('0x19')]);}else{logger[_0xa57e('0x11')](_0xa57e('0x12'),_0x32745b,_0xa57e('0x13'));_0x19cf0d(_0x40aa33['result'][_0xa57e('0x19')]);}})['catch'](function(_0x501936){logger['error'](_0xa57e('0x12'),_0x32745b,_0x501936);_0x59442c(_0x501936);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4cce358..288d9a0 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 _0xf937=['length','chatWebsite:','./chatWebsite.events','save','remove','register'];(function(_0x26a686,_0x4f51d2){var _0x2bf65d=function(_0x20addc){while(--_0x20addc){_0x26a686['push'](_0x26a686['shift']());}};_0x2bf65d(++_0x4f51d2);}(_0xf937,0xda));var _0x7f93=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0xf937[_0x146a97];return _0x259d5c;};'use strict';var ChatWebsiteEvents=require(_0x7f93('0x0'));var events=[_0x7f93('0x1'),_0x7f93('0x2'),'update'];function createListener(_0x36648c,_0x42490d){return function(_0x1a41e9){_0x42490d['emit'](_0x36648c,_0x1a41e9);};}function removeListener(_0x3ec9bc,_0xd373a4){return function(){ChatWebsiteEvents['removeListener'](_0x3ec9bc,_0xd373a4);};}exports[_0x7f93('0x3')]=function(_0x2f06d2){for(var _0x23b4f2=0x0,_0x4d0b79=events[_0x7f93('0x4')];_0x23b4f2<_0x4d0b79;_0x23b4f2++){var _0x33bebb=events[_0x23b4f2];var _0x27516f=createListener(_0x7f93('0x5')+_0x33bebb,_0x2f06d2);ChatWebsiteEvents['on'](_0x33bebb,_0x27516f);}}; \ No newline at end of file +var _0x4f45=['save','update','emit','removeListener','./chatWebsite.events'];(function(_0x54f28f,_0x3008e9){var _0x4bba4b=function(_0x3294fc){while(--_0x3294fc){_0x54f28f['push'](_0x54f28f['shift']());}};_0x4bba4b(++_0x3008e9);}(_0x4f45,0x8b));var _0x54f4=function(_0x124e8e,_0xb9edb7){_0x124e8e=_0x124e8e-0x0;var _0x5a59d6=_0x4f45[_0x124e8e];return _0x5a59d6;};'use strict';var ChatWebsiteEvents=require(_0x54f4('0x0'));var events=[_0x54f4('0x1'),'remove',_0x54f4('0x2')];function createListener(_0x56a22b,_0xed51dc){return function(_0x402559){_0xed51dc[_0x54f4('0x3')](_0x56a22b,_0x402559);};}function removeListener(_0x1e02c6,_0xd8bad8){return function(){ChatWebsiteEvents[_0x54f4('0x4')](_0x1e02c6,_0xd8bad8);};}exports['register']=function(_0x57f382){for(var _0x41d784=0x0,_0x15e731=events['length'];_0x41d784<_0x15e731;_0x41d784++){var _0xedd525=events[_0x41d784];var _0x570979=createListener('chatWebsite:'+_0xedd525,_0x57f382);ChatWebsiteEvents['on'](_0xedd525,_0x570979);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 9bac966..e4ff64a 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 _0x5b05=['%s-%s','/:id/logo','single','file','root','now','originalname','/:id/avatar','addAvatar','server/files/images/avatars/','addSystemAvatar','server/files','attachments','ensureDir','replace','extname','/:id/offline','addInteraction','addApplications','addProactiveActions','put','/:id','delete','destroy','removeAnswers','removeAgents','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','join','server/files/images/logos/','format'];(function(_0x3e73f5,_0x5a53f3){var _0x8bd161=function(_0x3da42c){while(--_0x3da42c){_0x3e73f5['push'](_0x3e73f5['shift']());}};_0x8bd161(++_0x5a53f3);}(_0x5b05,0x11b));var _0x55b0=function(_0x1b1b3b,_0x20988f){_0x1b1b3b=_0x1b1b3b-0x0;var _0x195d16=_0x5b05[_0x1b1b3b];return _0x195d16;};'use strict';var multer=require(_0x55b0('0x0'));var util=require('util');var path=require(_0x55b0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x55b0('0x2'));var interaction=require(_0x55b0('0x3'));var config=require(_0x55b0('0x4'));var controller=require(_0x55b0('0x5'));router[_0x55b0('0x6')]('/',auth[_0x55b0('0x7')](),controller[_0x55b0('0x8')]);router[_0x55b0('0x6')](_0x55b0('0x9'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xa')]);router[_0x55b0('0x6')]('/:id',auth[_0x55b0('0x7')](),controller[_0x55b0('0xb')]);router[_0x55b0('0x6')](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xd')]);router[_0x55b0('0x6')](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0xf')]);router['get']('/:id/logo',controller[_0x55b0('0x10')]);router[_0x55b0('0x6')]('/:id/avatar',controller[_0x55b0('0x11')]);router[_0x55b0('0x6')](_0x55b0('0x12'),controller['getCustomerAvatar']);router[_0x55b0('0x6')](_0x55b0('0x13'),controller[_0x55b0('0x14')]);router[_0x55b0('0x6')](_0x55b0('0x15'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x16')]);router[_0x55b0('0x6')](_0x55b0('0x17'),controller[_0x55b0('0x18')]);router[_0x55b0('0x6')](_0x55b0('0x19'),auth[_0x55b0('0x7')](),controller['getApplications']);router[_0x55b0('0x6')](_0x55b0('0x1a'),auth[_0x55b0('0x7')](),controller['getProactiveActions']);router[_0x55b0('0x6')](_0x55b0('0x1b'),controller['getFields']);router[_0x55b0('0x6')]('/:id/offline_messages',auth[_0x55b0('0x7')](),controller[_0x55b0('0x1c')]);router[_0x55b0('0x6')](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x1e')]);router[_0x55b0('0x1f')]('/',auth[_0x55b0('0x7')](),controller['create']);router[_0x55b0('0x1f')](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller['addDisposition']);router[_0x55b0('0x1f')](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x20')]);var upload=multer({'storage':multer[_0x55b0('0x21')]({'destination':function(_0x1753b2,_0x4afa5d,_0x54d755){_0x54d755(null,path[_0x55b0('0x22')](config['root'],_0x55b0('0x23')));},'filename':function(_0x37b1b0,_0x32d641,_0x16b89d){_0x16b89d(null,util[_0x55b0('0x24')](_0x55b0('0x25'),Date['now'](),_0x32d641['originalname']));}})});router[_0x55b0('0x1f')](_0x55b0('0x26'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b271c,_0x4840e0,_0x88f3b8){_0x88f3b8(null,path['join'](config[_0x55b0('0x29')],'server/files/images/avatars/'));},'filename':function(_0x5ea240,_0x286bbf,_0x1d18f1){_0x1d18f1(null,util[_0x55b0('0x24')](_0x55b0('0x25'),Date[_0x55b0('0x2a')](),_0x286bbf[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x2c'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller[_0x55b0('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1ac523,_0x239d37,_0x2a7325){_0x2a7325(null,path[_0x55b0('0x22')](config[_0x55b0('0x29')],_0x55b0('0x2e')));},'filename':function(_0x3f74b2,_0x497602,_0x4d8ae1){_0x4d8ae1(null,util['format'](_0x55b0('0x25'),Date[_0x55b0('0x2a')](),_0x497602[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x12'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x15bf4e,_0x1368ad,_0x2ae5f9){_0x2ae5f9(null,path[_0x55b0('0x22')](config[_0x55b0('0x29')],'server/files/images/avatars/'));},'filename':function(_0xb86071,_0x10f28d,_0x491ba2){_0x491ba2(null,util[_0x55b0('0x24')]('%s-%s',Date[_0x55b0('0x2a')](),_0x10f28d[_0x55b0('0x2b')]));}})});router[_0x55b0('0x1f')](_0x55b0('0x13'),upload[_0x55b0('0x27')](_0x55b0('0x28')),controller[_0x55b0('0x2f')]);router[_0x55b0('0x1f')]('/:id/notify',controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x55b0('0x21')]({'destination':function(_0x1987aa,_0x20d806,_0x3111e0){const _0x430399=path[_0x55b0('0x22')](config[_0x55b0('0x29')],_0x55b0('0x30'),_0x55b0('0x31'),'offline-chat');fs_extra[_0x55b0('0x32')](_0x430399,function(){_0x3111e0(null,_0x430399);});},'filename':function(_0xe95cfc,_0x47ec80,_0x123773){const _0x329400=_0x47ec80[_0x55b0('0x2b')][_0x55b0('0x33')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x211d51=path[_0x55b0('0x34')](_0x329400);const _0x1dc59e=Date[_0x55b0('0x2a')]()+'-'+_0x329400['replace'](_0x211d51,'')+_0x211d51;_0x123773(null,_0x1dc59e);}})});router[_0x55b0('0x1f')](_0x55b0('0x35'),offlineUploadMulter['any'](),controller['offline']);router[_0x55b0('0x1f')](_0x55b0('0x15'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x36')]);router[_0x55b0('0x1f')](_0x55b0('0x19'),auth['isAuthenticated'](),controller[_0x55b0('0x37')]);router['post'](_0x55b0('0x1a'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x38')]);router['post'](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller['addAgents']);router[_0x55b0('0x39')](_0x55b0('0x3a'),auth['isAuthenticated'](),controller['update']);router[_0x55b0('0x3b')]('/:id',auth['isAuthenticated'](),controller[_0x55b0('0x3c')]);router['delete'](_0x55b0('0xc'),auth[_0x55b0('0x7')](),controller['removeDispositions']);router['delete'](_0x55b0('0xe'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x3d')]);router[_0x55b0('0x3b')](_0x55b0('0x1d'),auth[_0x55b0('0x7')](),controller[_0x55b0('0x3e')]);module[_0x55b0('0x3f')]=router; \ No newline at end of file +var _0xf239=['offline','addInteraction','addApplications','addProactiveActions','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','diskStorage','join','server/files/images/logos/','format','now','originalname','single','root','server/files/images/avatars/','%s-%s','addAvatar','file','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','/:id/offline','any'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf239,0x1ba));var _0x9f23=function(_0x217917,_0x46c4c6){_0x217917=_0x217917-0x0;var _0x57287f=_0xf239[_0x217917];return _0x57287f;};'use strict';var multer=require(_0x9f23('0x0'));var util=require(_0x9f23('0x1'));var path=require(_0x9f23('0x2'));var timeout=require(_0x9f23('0x3'));var express=require(_0x9f23('0x4'));var router=express[_0x9f23('0x5')]();var fs_extra=require(_0x9f23('0x6'));var auth=require(_0x9f23('0x7'));var interaction=require(_0x9f23('0x8'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router['get']('/',auth[_0x9f23('0x9')](),controller[_0x9f23('0xa')]);router[_0x9f23('0xb')](_0x9f23('0xc'),auth[_0x9f23('0x9')](),controller['describe']);router[_0x9f23('0xb')](_0x9f23('0xd'),auth['isAuthenticated'](),controller[_0x9f23('0xe')]);router[_0x9f23('0xb')](_0x9f23('0xf'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x10')]);router[_0x9f23('0xb')](_0x9f23('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x9f23('0xb')](_0x9f23('0x12'),controller[_0x9f23('0x13')]);router[_0x9f23('0xb')](_0x9f23('0x14'),controller[_0x9f23('0x15')]);router[_0x9f23('0xb')](_0x9f23('0x16'),controller['getCustomerAvatar']);router['get'](_0x9f23('0x17'),controller[_0x9f23('0x18')]);router[_0x9f23('0xb')](_0x9f23('0x19'),auth[_0x9f23('0x9')](),controller['getInteractions']);router[_0x9f23('0xb')]('/:id/snippet',controller[_0x9f23('0x1a')]);router[_0x9f23('0xb')](_0x9f23('0x1b'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x1c')]);router[_0x9f23('0xb')](_0x9f23('0x1d'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x1e')]);router['get'](_0x9f23('0x1f'),controller[_0x9f23('0x20')]);router[_0x9f23('0xb')](_0x9f23('0x21'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x22')]);router[_0x9f23('0xb')](_0x9f23('0x23'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x24')]);router['post']('/',auth[_0x9f23('0x9')](),controller['create']);router[_0x9f23('0x25')](_0x9f23('0xf'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x26')]);router[_0x9f23('0x25')](_0x9f23('0x11'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x27')]);var upload=multer({'storage':multer[_0x9f23('0x28')]({'destination':function(_0x3e272e,_0x759d5,_0x3848a1){_0x3848a1(null,path[_0x9f23('0x29')](config['root'],_0x9f23('0x2a')));},'filename':function(_0x568c10,_0x2e3f26,_0x237692){_0x237692(null,util[_0x9f23('0x2b')]('%s-%s',Date[_0x9f23('0x2c')](),_0x2e3f26[_0x9f23('0x2d')]));}})});router['post'](_0x9f23('0x12'),upload[_0x9f23('0x2e')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x9f23('0x28')]({'destination':function(_0x219105,_0x223e5e,_0x2e8da8){_0x2e8da8(null,path[_0x9f23('0x29')](config[_0x9f23('0x2f')],_0x9f23('0x30')));},'filename':function(_0x319e8b,_0x557c48,_0x4c44cc){_0x4c44cc(null,util[_0x9f23('0x2b')](_0x9f23('0x31'),Date[_0x9f23('0x2c')](),_0x557c48[_0x9f23('0x2d')]));}})});router[_0x9f23('0x25')](_0x9f23('0x14'),upload[_0x9f23('0x2e')]('file'),controller[_0x9f23('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e1f92,_0x1ecb3a,_0x3a0f97){_0x3a0f97(null,path['join'](config[_0x9f23('0x2f')],_0x9f23('0x30')));},'filename':function(_0x56b7ba,_0x372818,_0x185dc6){_0x185dc6(null,util[_0x9f23('0x2b')]('%s-%s',Date[_0x9f23('0x2c')](),_0x372818[_0x9f23('0x2d')]));}})});router[_0x9f23('0x25')](_0x9f23('0x16'),upload[_0x9f23('0x2e')](_0x9f23('0x33')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9f23('0x28')]({'destination':function(_0x49fd9e,_0x384166,_0x3c9c71){_0x3c9c71(null,path[_0x9f23('0x29')](config[_0x9f23('0x2f')],_0x9f23('0x30')));},'filename':function(_0x467ae6,_0x28c817,_0x3bc52a){_0x3bc52a(null,util[_0x9f23('0x2b')](_0x9f23('0x31'),Date[_0x9f23('0x2c')](),_0x28c817[_0x9f23('0x2d')]));}})});router['post'](_0x9f23('0x17'),upload[_0x9f23('0x2e')](_0x9f23('0x33')),controller[_0x9f23('0x34')]);router['post'](_0x9f23('0x35'),controller[_0x9f23('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x2e995a,_0x41cfb5,_0x2cf03f){const _0x4f49ab=path['join'](config[_0x9f23('0x2f')],_0x9f23('0x37'),_0x9f23('0x38'),_0x9f23('0x39'));fs_extra[_0x9f23('0x3a')](_0x4f49ab,function(){_0x2cf03f(null,_0x4f49ab);});},'filename':function(_0x24e8a9,_0xc8c59d,_0x135170){const _0x3a8885=_0xc8c59d['originalname'][_0x9f23('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5ce330=path['extname'](_0x3a8885);const _0x5b23f=Date[_0x9f23('0x2c')]()+'-'+_0x3a8885[_0x9f23('0x3b')](_0x5ce330,'')+_0x5ce330;_0x135170(null,_0x5b23f);}})});router[_0x9f23('0x25')](_0x9f23('0x3c'),offlineUploadMulter[_0x9f23('0x3d')](),controller[_0x9f23('0x3e')]);router['post'](_0x9f23('0x19'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x3f')]);router['post'](_0x9f23('0x1b'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x40')]);router['post'](_0x9f23('0x1d'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x41')]);router[_0x9f23('0x25')](_0x9f23('0x23'),auth[_0x9f23('0x9')](),controller['addAgents']);router[_0x9f23('0x42')]('/:id',auth['isAuthenticated'](),controller[_0x9f23('0x43')]);router[_0x9f23('0x44')](_0x9f23('0xd'),auth['isAuthenticated'](),controller[_0x9f23('0x45')]);router[_0x9f23('0x44')](_0x9f23('0xf'),auth[_0x9f23('0x9')](),controller['removeDispositions']);router[_0x9f23('0x44')](_0x9f23('0x11'),auth[_0x9f23('0x9')](),controller['removeAnswers']);router[_0x9f23('0x44')](_0x9f23('0x23'),auth[_0x9f23('0x9')](),controller[_0x9f23('0x46')]);module[_0x9f23('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index ea44076..8f2dc3e 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 _0x7a6b=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','../components/auth/service','../config/environment','Router','app'];(function(_0x27cb81,_0x756485){var _0x4f4893=function(_0x5702a4){while(--_0x5702a4){_0x27cb81['push'](_0x27cb81['shift']());}};_0x4f4893(++_0x756485);}(_0x7a6b,0x182));var _0xb7a6=function(_0x30804b,_0x2fe8ef){_0x30804b=_0x30804b-0x0;var _0x325cc0=_0x7a6b[_0x30804b];return _0x325cc0;};var beaverLogger=require('beaver-logger/server');var express=require('express');var auth=require(_0xb7a6('0x0'));var config=require(_0xb7a6('0x1'));var router=express[_0xb7a6('0x2')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x25695c,_0x69a002,_0x5dc809){var _0x159853=_0x25695c[_0xb7a6('0x3')]['get']('client-side-logger');if(!_0x159853){throw new Error(_0xb7a6('0x4'));}return beaverLogger[_0xb7a6('0x5')]({'uri':_0xb7a6('0x6'),'logger':_0x159853,'enableCors':!isProduction})(_0x25695c,_0x69a002,_0x5dc809);}router[_0xb7a6('0x7')](auth[_0xb7a6('0x8')](),clientSideLogs);module[_0xb7a6('0x9')]=router; \ No newline at end of file +var _0xc49f=['app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','beaver-logger/server','../config/environment','env'];(function(_0x1580ec,_0x9438fa){var _0x5ca286=function(_0x2d8a35){while(--_0x2d8a35){_0x1580ec['push'](_0x1580ec['shift']());}};_0x5ca286(++_0x9438fa);}(_0xc49f,0x1c0));var _0xfc49=function(_0x48200b,_0x3bc629){_0x48200b=_0x48200b-0x0;var _0xd0219a=_0xc49f[_0x48200b];return _0xd0219a;};var beaverLogger=require(_0xfc49('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0xfc49('0x1'));var router=express['Router']();var isProduction=config[_0xfc49('0x2')]==='production'||![];function clientSideLogs(_0xe757c1,_0x2b3832,_0x7601ad){var _0x423f3c=_0xe757c1[_0xfc49('0x3')][_0xfc49('0x4')](_0xfc49('0x5'));if(!_0x423f3c){throw new Error(_0xfc49('0x6'));}return beaverLogger[_0xfc49('0x7')]({'uri':_0xfc49('0x8'),'logger':_0x423f3c,'enableCors':!isProduction})(_0xe757c1,_0x2b3832,_0x7601ad);}router[_0xfc49('0x9')](auth[_0xfc49('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index dd807cb..fdd938b 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 _0x3d29=['MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','ENUM','Google','MicrosoftAzure','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT'];(function(_0x47a802,_0x424bf1){var _0xb3badc=function(_0x5f44d3){while(--_0x5f44d3){_0x47a802['push'](_0x47a802['shift']());}};_0xb3badc(++_0x424bf1);}(_0x3d29,0xda));var _0x93d2=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x3d29[_0x38537f];return _0x141e23;};'use strict';var Sequelize=require('sequelize');module[_0x93d2('0x0')]={'name':{'type':Sequelize[_0x93d2('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x93d2('0x2')]('AmazonAWS',_0x93d2('0x3'),_0x93d2('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x93d2('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0x93d2('0x1')],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x93d2('0x1')],'comment':_0x93d2('0x5')},'data3':{'type':Sequelize['STRING'],'comment':_0x93d2('0x6')},'data4':{'type':Sequelize['STRING'],'comment':_0x93d2('0x7')},'data5':{'type':Sequelize['TEXT'],'comment':_0x93d2('0x8')},'data6':{'type':Sequelize[_0x93d2('0x9')],'comment':_0x93d2('0xa')},'data7':{'type':Sequelize[_0x93d2('0x9')],'comment':_0x93d2('0xb')}}; \ No newline at end of file +var _0x3345=['Outlook365','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','STRING','ENUM','AmazonAWS','MicrosoftAzure'];(function(_0x1dfe55,_0xf9a3c0){var _0x32997b=function(_0x97eb09){while(--_0x97eb09){_0x1dfe55['push'](_0x1dfe55['shift']());}};_0x32997b(++_0xf9a3c0);}(_0x3345,0x15b));var _0x5334=function(_0x5ea0c4,_0x9e4c14){_0x5ea0c4=_0x5ea0c4-0x0;var _0x3c0968=_0x3345[_0x5ea0c4];return _0x3c0968;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5334('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5334('0x1')](_0x5334('0x2'),'Google',_0x5334('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5334('0x1')](_0x5334('0x4'),_0x5334('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0x5334('0x6')},'data2':{'type':Sequelize[_0x5334('0x0')],'comment':_0x5334('0x7')},'data3':{'type':Sequelize[_0x5334('0x0')],'comment':_0x5334('0x8')},'data4':{'type':Sequelize[_0x5334('0x0')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x5334('0x9')],'comment':_0x5334('0xa')},'data6':{'type':Sequelize[_0x5334('0x9')],'comment':_0x5334('0xb')},'data7':{'type':Sequelize['TEXT'],'comment':_0x5334('0xc')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f44b0ec..3a1addf 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 _0x224f=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','options','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','from','base64','toString','ascii','parse','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','access_token','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','./cloudProvider.oauth','defaults','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','error','stack','name','send','padEnd','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x224f,0x1da));var _0xf224=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0x224f[_0x4cee4b];return _0x4d891d;};'use strict';var _=require('lodash');var Redis=require(_0xf224('0x0'));var qs=require(_0xf224('0x1'));var encryptor=require(_0xf224('0x2'));var config=require('../../config/environment');var logger=require(_0xf224('0x3'))('api');var db=require(_0xf224('0x4'))['db'];var oauth=require(_0xf224('0x5'));config['redis']=_[_0xf224('0x6')](config[_0xf224('0x7')],{'host':_0xf224('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf224('0x7')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x26f1ed,_0x4383e){_0x4383e=_0x4383e||0xcc;return function(_0x50f9a2){if(_0x50f9a2){return _0x26f1ed[_0xf224('0x9')](_0x4383e);}return _0x26f1ed[_0xf224('0xa')](_0x4383e)[_0xf224('0xb')]();};}function respondWithResult(_0x26184b,_0x1eea4a){_0x1eea4a=_0x1eea4a||0xc8;return function(_0x334bdd){if(_0x334bdd){return _0x26184b[_0xf224('0xa')](_0x1eea4a)[_0xf224('0xc')](_0x334bdd);}};}function respondWithFilteredResult(_0x4f9c0c,_0xaa57ee){return function(_0x3a1a44){if(_0x3a1a44){var _0xb7fb8=typeof _0xaa57ee[_0xf224('0xd')]===_0xf224('0xe')&&typeof _0xaa57ee[_0xf224('0xf')]===_0xf224('0xe');var _0x11a59c=_0x3a1a44[_0xf224('0x10')];var _0x45d9c7=_0xb7fb8?0x0:_0xaa57ee[_0xf224('0xd')];var _0x351be9=_0xb7fb8?_0x3a1a44[_0xf224('0x10')]:_0xaa57ee[_0xf224('0xd')]+_0xaa57ee[_0xf224('0xf')];var _0x1a291a;if(_0x351be9>=_0x11a59c){_0x351be9=_0x11a59c;_0x1a291a=0xc8;}else{_0x1a291a=0xce;}_0x4f9c0c[_0xf224('0xa')](_0x1a291a);return _0x4f9c0c[_0xf224('0x11')]('Content-Range',_0x45d9c7+'-'+_0x351be9+'/'+_0x11a59c)[_0xf224('0xc')](_0x3a1a44);}return null;};}function saveUpdates(_0x1a1ccc){return function(_0xd0189b){if(_0xd0189b){return _0xd0189b['update'](_0x1a1ccc)['then'](function(_0x954cca){return _0x954cca;});}return null;};}function removeEntity(_0x114eb4){return function(_0x19313c){if(_0x19313c){return _0x19313c[_0xf224('0x12')]()[_0xf224('0x13')](function(){_0x114eb4[_0xf224('0xa')](0xcc)[_0xf224('0xb')]();});}};}function handleEntityNotFound(_0xb16786){return function(_0x4bda23){if(!_0x4bda23){_0xb16786[_0xf224('0x9')](0x194);}return _0x4bda23;};}function handleError(_0x18bf29,_0x472844){_0x472844=_0x472844||0x1f4;return function(_0x27c0e9){logger[_0xf224('0x14')](_0x27c0e9[_0xf224('0x15')]);if(_0x27c0e9[_0xf224('0x16')]){delete _0x27c0e9[_0xf224('0x16')];}_0x18bf29[_0xf224('0xa')](_0x472844)[_0xf224('0x17')](_0x27c0e9);};}function maskClientSecret(_0x4ff754){return _[_0xf224('0x18')](_0x4ff754[_0xf224('0x19')](0x0,0x3),0x14,'*');}exports[_0xf224('0x1a')]=function(_0x256176,_0xebb29a){var _0x18148d={},_0xf234da={},_0xe69582={'count':0x0,'rows':[]};var _0xe1b0ca=_[_0xf224('0x1b')](db[_0xf224('0x1c')][_0xf224('0x1d')],function(_0x364f31){return{'name':_0x364f31[_0xf224('0x1e')],'type':_0x364f31[_0xf224('0x1f')][_0xf224('0x20')]};});_0xf234da['model']=_[_0xf224('0x1b')](_0xe1b0ca,'name');_0xf234da[_0xf224('0x21')]=_[_0xf224('0x22')](_0x256176[_0xf224('0x21')]);_0xf234da[_0xf224('0x23')]=_[_0xf224('0x24')](_0xf234da[_0xf224('0x25')],_0xf234da['query']);_0x18148d['attributes']=_['intersection'](_0xf234da[_0xf224('0x25')],qs[_0xf224('0x26')](_0x256176[_0xf224('0x21')][_0xf224('0x26')]));_0x18148d[_0xf224('0x27')]=_0x18148d['attributes'][_0xf224('0x28')]?_0x18148d[_0xf224('0x27')]:_0xf234da['model'];if(!_0x256176[_0xf224('0x21')][_0xf224('0x29')](_0xf224('0x2a'))){_0x18148d[_0xf224('0xf')]=qs[_0xf224('0xf')](_0x256176[_0xf224('0x21')][_0xf224('0xf')]);_0x18148d[_0xf224('0xd')]=qs[_0xf224('0xd')](_0x256176[_0xf224('0x21')][_0xf224('0xd')]);}_0x18148d[_0xf224('0x2b')]=qs['sort'](_0x256176['query'][_0xf224('0x2c')]);_0x18148d[_0xf224('0x2d')]=qs[_0xf224('0x23')](_[_0xf224('0x2e')](_0x256176[_0xf224('0x21')],_0xf234da[_0xf224('0x23')]),_0xe1b0ca);if(_0x256176[_0xf224('0x21')][_0xf224('0x2f')]){_0x18148d['where']=_[_0xf224('0x30')](_0x18148d['where'],{'$or':_[_0xf224('0x1b')](_0xe1b0ca,function(_0xa9bd86){if(_0xa9bd86[_0xf224('0x1f')]!==_0xf224('0x31')){var _0x37e242={};_0x37e242[_0xa9bd86[_0xf224('0x16')]]={'$like':'%'+_0x256176[_0xf224('0x21')]['filter']+'%'};return _0x37e242;}})});}_0x18148d=_['merge']({},_0x18148d,_0x256176['options']);var _0x288e93={'where':_0x18148d[_0xf224('0x2d')]};return db[_0xf224('0x1c')][_0xf224('0x10')](_0x288e93)['then'](function(_0x1f82d4){_0xe69582[_0xf224('0x10')]=_0x1f82d4;if(_0x256176['query'][_0xf224('0x32')]){_0x18148d[_0xf224('0x33')]=[{'all':!![]}];}return db[_0xf224('0x1c')][_0xf224('0x34')](_0x18148d);})[_0xf224('0x13')](function(_0x4951d2){_0xe69582[_0xf224('0x35')]=_[_0xf224('0x1b')](_0x4951d2,function(_0x47a14a){if(_0x47a14a['service']===_0xf224('0x36')){var _0x5080cf=encryptor[_0xf224('0x37')](_0x47a14a[_0xf224('0x38')]);_0x47a14a[_0xf224('0x38')]=maskClientSecret(_0x5080cf);}return _0x47a14a;});return _0xe69582;})[_0xf224('0x13')](respondWithFilteredResult(_0xebb29a,_0x18148d))[_0xf224('0x39')](handleError(_0xebb29a,null));};exports[_0xf224('0x3a')]=function(_0x1f6506,_0x333f41){var _0x4a5808={'raw':!![],'where':{'id':_0x1f6506[_0xf224('0x3b')]['id']}},_0x3a5920={};_0x3a5920['model']=_[_0xf224('0x22')](db[_0xf224('0x1c')][_0xf224('0x1d')]);_0x3a5920[_0xf224('0x21')]=_[_0xf224('0x22')](_0x1f6506['query']);_0x3a5920[_0xf224('0x23')]=_[_0xf224('0x24')](_0x3a5920[_0xf224('0x25')],_0x3a5920[_0xf224('0x21')]);_0x4a5808[_0xf224('0x27')]=_[_0xf224('0x24')](_0x3a5920[_0xf224('0x25')],qs[_0xf224('0x26')](_0x1f6506['query']['fields']));_0x4a5808[_0xf224('0x27')]=_0x4a5808['attributes'][_0xf224('0x28')]?_0x4a5808['attributes']:_0x3a5920[_0xf224('0x25')];if(_0x1f6506[_0xf224('0x21')][_0xf224('0x32')]){_0x4a5808['include']=[{'all':!![]}];}_0x4a5808=_[_0xf224('0x30')]({},_0x4a5808,_0x1f6506[_0xf224('0x3c')]);return db[_0xf224('0x1c')][_0xf224('0x3d')](_0x4a5808)[_0xf224('0x13')](handleEntityNotFound(_0x333f41,null))[_0xf224('0x13')](function(_0xa01960){if(_0xa01960[_0xf224('0x3e')]===_0xf224('0x36')){var _0x32e995=encryptor[_0xf224('0x37')](_0xa01960['data3']);_0xa01960[_0xf224('0x38')]=maskClientSecret(_0x32e995);}return _0xa01960;})[_0xf224('0x13')](respondWithResult(_0x333f41,null))['catch'](handleError(_0x333f41,null));};exports[_0xf224('0x3f')]=function(_0x103692,_0x38d7d5){if(!_0x103692[_0xf224('0x40')][_0xf224('0x16')])throw new Error(_0xf224('0x41'));if(!_0x103692['body']['service'])throw new Error(_0xf224('0x42'));var _0x72f5bb=db[_0xf224('0x1c')]['rawAttributes'][_0xf224('0x3e')][_0xf224('0x43')];if(!_0x72f5bb[_0xf224('0x44')](_0x103692[_0xf224('0x40')][_0xf224('0x3e')]))throw new Error(_0xf224('0x45')+_0x72f5bb[_0xf224('0x46')](',\x20'));if(_0x103692['body']['service']===_0xf224('0x36')&&_0x103692['body'][_0xf224('0x38')]){_0x103692[_0xf224('0x40')][_0xf224('0x38')]=encryptor[_0xf224('0x47')](_0x103692[_0xf224('0x40')][_0xf224('0x38')]);}return db['CloudProvider']['create'](_0x103692[_0xf224('0x40')],{})[_0xf224('0x13')](respondWithResult(_0x38d7d5,0xc9))[_0xf224('0x39')](handleError(_0x38d7d5,null));};exports[_0xf224('0x48')]=function(_0x13d9f3,_0x407a73){if(_0x13d9f3['body']['id']){delete _0x13d9f3['body']['id'];}return db[_0xf224('0x1c')][_0xf224('0x3d')]({'where':{'id':_0x13d9f3[_0xf224('0x3b')]['id']}})[_0xf224('0x13')](handleEntityNotFound(_0x407a73,null))[_0xf224('0x13')](function(_0x389ba6){if(_0x389ba6[_0xf224('0x3e')]==='MicrosoftAzure'&&_0x13d9f3['body'][_0xf224('0x38')]){_0x13d9f3[_0xf224('0x40')][_0xf224('0x38')]=encryptor[_0xf224('0x47')](_0x13d9f3[_0xf224('0x40')][_0xf224('0x38')]);}return _0x389ba6;})[_0xf224('0x13')](saveUpdates(_0x13d9f3[_0xf224('0x40')],null))['then'](respondWithResult(_0x407a73,null))['catch'](handleError(_0x407a73,null));};exports[_0xf224('0x12')]=function(_0x24469a,_0x46b314){return db['CloudProvider'][_0xf224('0x3d')]({'where':{'id':_0x24469a[_0xf224('0x3b')]['id']}})[_0xf224('0x13')](handleEntityNotFound(_0x46b314,null))[_0xf224('0x13')](removeEntity(_0x46b314,null))[_0xf224('0x39')](handleError(_0x46b314,null));};exports[_0xf224('0x49')]=function(_0x169de8,_0x23d2b1){return db[_0xf224('0x1c')][_0xf224('0x4a')]({'where':{'id':_0x169de8[_0xf224('0x3b')]['id']},'raw':!![]})[_0xf224('0x13')](function(_0x36ef83){if(!_0x36ef83)return _0x23d2b1[_0xf224('0x9')](0x194);return{'url':oauth[_0xf224('0x4b')](_0x36ef83,_0x169de8[_0xf224('0x4c')]['id'])};})[_0xf224('0x13')](respondWithResult(_0x23d2b1,null))[_0xf224('0x39')](handleError(_0x23d2b1,null));};exports['oauth2MicrosoftCallback']=function(_0x22a89f,_0x425bea){var _0x302611=_0x22a89f[_0xf224('0x40')];var _0xb9ca27;var _0xcfb4f4;if(_0x302611[_0xf224('0x14')])throw _0x302611;redis[_0xf224('0x4d')](_0x302611[_0xf224('0x4e')])[_0xf224('0x13')](function(_0x5ee013){if(!_0x5ee013)throw new Error(_0xf224('0x4f'));_0xb9ca27=JSON['parse'](_0x5ee013);var _0x21767d=Buffer[_0xf224('0x50')](_0x302611[_0xf224('0x4e')],_0xf224('0x51'))[_0xf224('0x52')](_0xf224('0x53'));_0xcfb4f4=JSON[_0xf224('0x54')](_0x21767d);if(!oauth[_0xf224('0x55')](_0x302611[_0xf224('0x56')],_0xb9ca27[_0xf224('0x57')]))throw new Error(_0xf224('0x58'));redis[_0xf224('0x59')](_0x302611['state']);return oauth[_0xf224('0x5a')](_0x302611[_0xf224('0x5b')],_0xb9ca27);})[_0xf224('0x13')](function(_0x665637){_0xb9ca27[_0xf224('0x5c')]=_0x665637[_0xf224('0x5d')];_0xb9ca27['data6']=_0x665637[_0xf224('0x5e')];return db[_0xf224('0x1c')][_0xf224('0x48')]({'data5':_0xb9ca27[_0xf224('0x5c')],'data6':_0xb9ca27['data6']},{'where':{'id':_0xb9ca27['id']}});})[_0xf224('0x13')](function(){oauth[_0xf224('0x5f')](_0xb9ca27);socket[_0xf224('0x60')](_0xf224('0x61'),{'id':_0xcfb4f4['id']});return;})[_0xf224('0x13')](respondWithStatusCode(_0x425bea,null))[_0xf224('0x39')](function(_0x58a1e3){if(_0xcfb4f4){socket[_0xf224('0x60')](_0xf224('0x62'),{'id':_0xcfb4f4['id']});}if(!_0xb9ca27){logger[_0xf224('0x14')](_0xf224('0x63'),_0x58a1e3);return _0x425bea[_0xf224('0xa')](0x1f4)[_0xf224('0x17')](_0x58a1e3[_0xf224('0x64')]);}logger[_0xf224('0x14')](_0xf224('0x65'),_0xb9ca27['id'],JSON['stringify'](_0x58a1e3));});}; \ No newline at end of file +var _0x6e7b=['data6','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','send','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','service','data3','params','find','MicrosoftAzure','catch','create','body','Name\x20parameter\x20not\x20specified','values','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','error','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','access_token'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x6e7b,0x1c4));var _0xb6e7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6e7b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var Redis=require(_0xb6e7('0x0'));var qs=require(_0xb6e7('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xb6e7('0x2'));var logger=require(_0xb6e7('0x3'))(_0xb6e7('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xb6e7('0x5'));config[_0xb6e7('0x6')]=_['defaults'](config[_0xb6e7('0x6')],{'host':_0xb6e7('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb6e7('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x2ba30a,_0x1841f1){_0x1841f1=_0x1841f1||0xcc;return function(_0x3270de){if(_0x3270de){return _0x2ba30a[_0xb6e7('0x8')](_0x1841f1);}return _0x2ba30a[_0xb6e7('0x9')](_0x1841f1)[_0xb6e7('0xa')]();};}function respondWithResult(_0x2e5dd6,_0x3aa24f){_0x3aa24f=_0x3aa24f||0xc8;return function(_0x378242){if(_0x378242){return _0x2e5dd6[_0xb6e7('0x9')](_0x3aa24f)[_0xb6e7('0xb')](_0x378242);}};}function respondWithFilteredResult(_0x5e4db6,_0x4c1e43){return function(_0x1dfe6d){if(_0x1dfe6d){var _0x5674f8=typeof _0x4c1e43[_0xb6e7('0xc')]===_0xb6e7('0xd')&&typeof _0x4c1e43[_0xb6e7('0xe')]==='undefined';var _0x28ae28=_0x1dfe6d[_0xb6e7('0xf')];var _0x3d8fac=_0x5674f8?0x0:_0x4c1e43[_0xb6e7('0xc')];var _0x3f2dc4=_0x5674f8?_0x1dfe6d['count']:_0x4c1e43[_0xb6e7('0xc')]+_0x4c1e43[_0xb6e7('0xe')];var _0xa74dcf;if(_0x3f2dc4>=_0x28ae28){_0x3f2dc4=_0x28ae28;_0xa74dcf=0xc8;}else{_0xa74dcf=0xce;}_0x5e4db6['status'](_0xa74dcf);return _0x5e4db6['set'](_0xb6e7('0x10'),_0x3d8fac+'-'+_0x3f2dc4+'/'+_0x28ae28)[_0xb6e7('0xb')](_0x1dfe6d);}return null;};}function saveUpdates(_0x17ec19){return function(_0x436e7b){if(_0x436e7b){return _0x436e7b[_0xb6e7('0x11')](_0x17ec19)['then'](function(_0x318147){return _0x318147;});}return null;};}function removeEntity(_0x2bd208){return function(_0x84b7e5){if(_0x84b7e5){return _0x84b7e5['destroy']()[_0xb6e7('0x12')](function(){_0x2bd208['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a5dd6){return function(_0x585850){if(!_0x585850){_0x3a5dd6[_0xb6e7('0x8')](0x194);}return _0x585850;};}function handleError(_0x5d117f,_0x270176){_0x270176=_0x270176||0x1f4;return function(_0x2703ab){logger['error'](_0x2703ab[_0xb6e7('0x13')]);if(_0x2703ab[_0xb6e7('0x14')]){delete _0x2703ab['name'];}_0x5d117f[_0xb6e7('0x9')](_0x270176)[_0xb6e7('0x15')](_0x2703ab);};}function maskClientSecret(_0x36ba2c){return _[_0xb6e7('0x16')](_0x36ba2c[_0xb6e7('0x17')](0x0,0x3),0x14,'*');}exports[_0xb6e7('0x18')]=function(_0x3aa31e,_0x33820c){var _0x39b1c4={},_0x4f02fb={},_0x316094={'count':0x0,'rows':[]};var _0x4a31aa=_['map'](db[_0xb6e7('0x19')][_0xb6e7('0x1a')],function(_0x49c9f2){return{'name':_0x49c9f2[_0xb6e7('0x1b')],'type':_0x49c9f2[_0xb6e7('0x1c')]['key']};});_0x4f02fb['model']=_['map'](_0x4a31aa,_0xb6e7('0x14'));_0x4f02fb[_0xb6e7('0x1d')]=_[_0xb6e7('0x1e')](_0x3aa31e[_0xb6e7('0x1d')]);_0x4f02fb[_0xb6e7('0x1f')]=_[_0xb6e7('0x20')](_0x4f02fb[_0xb6e7('0x21')],_0x4f02fb[_0xb6e7('0x1d')]);_0x39b1c4[_0xb6e7('0x22')]=_['intersection'](_0x4f02fb[_0xb6e7('0x21')],qs[_0xb6e7('0x23')](_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0x23')]));_0x39b1c4[_0xb6e7('0x22')]=_0x39b1c4['attributes']['length']?_0x39b1c4[_0xb6e7('0x22')]:_0x4f02fb[_0xb6e7('0x21')];if(!_0x3aa31e[_0xb6e7('0x1d')]['hasOwnProperty']('nolimit')){_0x39b1c4[_0xb6e7('0xe')]=qs[_0xb6e7('0xe')](_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0xe')]);_0x39b1c4[_0xb6e7('0xc')]=qs[_0xb6e7('0xc')](_0x3aa31e[_0xb6e7('0x1d')]['offset']);}_0x39b1c4[_0xb6e7('0x24')]=qs[_0xb6e7('0x25')](_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0x25')]);_0x39b1c4['where']=qs[_0xb6e7('0x1f')](_[_0xb6e7('0x26')](_0x3aa31e[_0xb6e7('0x1d')],_0x4f02fb[_0xb6e7('0x1f')]),_0x4a31aa);if(_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0x27')]){_0x39b1c4[_0xb6e7('0x28')]=_[_0xb6e7('0x29')](_0x39b1c4['where'],{'$or':_[_0xb6e7('0x2a')](_0x4a31aa,function(_0x52d733){if(_0x52d733[_0xb6e7('0x1c')]!==_0xb6e7('0x2b')){var _0x5029ad={};_0x5029ad[_0x52d733[_0xb6e7('0x14')]]={'$like':'%'+_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0x27')]+'%'};return _0x5029ad;}})});}_0x39b1c4=_[_0xb6e7('0x29')]({},_0x39b1c4,_0x3aa31e[_0xb6e7('0x2c')]);var _0x1e8df2={'where':_0x39b1c4[_0xb6e7('0x28')]};return db[_0xb6e7('0x19')][_0xb6e7('0xf')](_0x1e8df2)[_0xb6e7('0x12')](function(_0x5002ab){_0x316094['count']=_0x5002ab;if(_0x3aa31e[_0xb6e7('0x1d')][_0xb6e7('0x2d')]){_0x39b1c4[_0xb6e7('0x2e')]=[{'all':!![]}];}return db[_0xb6e7('0x19')][_0xb6e7('0x2f')](_0x39b1c4);})[_0xb6e7('0x12')](function(_0x4e7c26){_0x316094[_0xb6e7('0x30')]=_['map'](_0x4e7c26,function(_0x30a1da){if(_0x30a1da[_0xb6e7('0x31')]==='MicrosoftAzure'){var _0x5a6770=encryptor['decryptString'](_0x30a1da[_0xb6e7('0x32')]);_0x30a1da[_0xb6e7('0x32')]=maskClientSecret(_0x5a6770);}return _0x30a1da;});return _0x316094;})[_0xb6e7('0x12')](respondWithFilteredResult(_0x33820c,_0x39b1c4))['catch'](handleError(_0x33820c,null));};exports['show']=function(_0x3a8160,_0x2d10b3){var _0x2dbc32={'raw':!![],'where':{'id':_0x3a8160[_0xb6e7('0x33')]['id']}},_0x558ed2={};_0x558ed2[_0xb6e7('0x21')]=_[_0xb6e7('0x1e')](db['CloudProvider'][_0xb6e7('0x1a')]);_0x558ed2[_0xb6e7('0x1d')]=_[_0xb6e7('0x1e')](_0x3a8160['query']);_0x558ed2['filters']=_['intersection'](_0x558ed2[_0xb6e7('0x21')],_0x558ed2[_0xb6e7('0x1d')]);_0x2dbc32[_0xb6e7('0x22')]=_[_0xb6e7('0x20')](_0x558ed2[_0xb6e7('0x21')],qs[_0xb6e7('0x23')](_0x3a8160[_0xb6e7('0x1d')]['fields']));_0x2dbc32[_0xb6e7('0x22')]=_0x2dbc32[_0xb6e7('0x22')]['length']?_0x2dbc32[_0xb6e7('0x22')]:_0x558ed2[_0xb6e7('0x21')];if(_0x3a8160[_0xb6e7('0x1d')][_0xb6e7('0x2d')]){_0x2dbc32[_0xb6e7('0x2e')]=[{'all':!![]}];}_0x2dbc32=_[_0xb6e7('0x29')]({},_0x2dbc32,_0x3a8160[_0xb6e7('0x2c')]);return db[_0xb6e7('0x19')][_0xb6e7('0x34')](_0x2dbc32)[_0xb6e7('0x12')](handleEntityNotFound(_0x2d10b3,null))['then'](function(_0x27a627){if(_0x27a627[_0xb6e7('0x31')]===_0xb6e7('0x35')){var _0x5b5c75=encryptor['decryptString'](_0x27a627[_0xb6e7('0x32')]);_0x27a627[_0xb6e7('0x32')]=maskClientSecret(_0x5b5c75);}return _0x27a627;})['then'](respondWithResult(_0x2d10b3,null))[_0xb6e7('0x36')](handleError(_0x2d10b3,null));};exports[_0xb6e7('0x37')]=function(_0x509359,_0x51599b){if(!_0x509359[_0xb6e7('0x38')][_0xb6e7('0x14')])throw new Error(_0xb6e7('0x39'));if(!_0x509359[_0xb6e7('0x38')][_0xb6e7('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5932f2=db[_0xb6e7('0x19')][_0xb6e7('0x1a')][_0xb6e7('0x31')][_0xb6e7('0x3a')];if(!_0x5932f2['includes'](_0x509359[_0xb6e7('0x38')][_0xb6e7('0x31')]))throw new Error(_0xb6e7('0x3b')+_0x5932f2['join'](',\x20'));if(_0x509359[_0xb6e7('0x38')][_0xb6e7('0x31')]===_0xb6e7('0x35')&&_0x509359[_0xb6e7('0x38')][_0xb6e7('0x32')]){_0x509359[_0xb6e7('0x38')][_0xb6e7('0x32')]=encryptor[_0xb6e7('0x3c')](_0x509359[_0xb6e7('0x38')][_0xb6e7('0x32')]);}return db['CloudProvider'][_0xb6e7('0x37')](_0x509359[_0xb6e7('0x38')],{})[_0xb6e7('0x12')](respondWithResult(_0x51599b,0xc9))[_0xb6e7('0x36')](handleError(_0x51599b,null));};exports['update']=function(_0x341252,_0x170f06){if(_0x341252[_0xb6e7('0x38')]['id']){delete _0x341252['body']['id'];}return db[_0xb6e7('0x19')][_0xb6e7('0x34')]({'where':{'id':_0x341252[_0xb6e7('0x33')]['id']}})['then'](handleEntityNotFound(_0x170f06,null))['then'](function(_0x5cd9df){if(_0x5cd9df['service']===_0xb6e7('0x35')&&_0x341252['body'][_0xb6e7('0x32')]){_0x341252[_0xb6e7('0x38')][_0xb6e7('0x32')]=encryptor[_0xb6e7('0x3c')](_0x341252[_0xb6e7('0x38')][_0xb6e7('0x32')]);}return _0x5cd9df;})[_0xb6e7('0x12')](saveUpdates(_0x341252[_0xb6e7('0x38')],null))[_0xb6e7('0x12')](respondWithResult(_0x170f06,null))[_0xb6e7('0x36')](handleError(_0x170f06,null));};exports[_0xb6e7('0x3d')]=function(_0x386fbf,_0x1fd15d){return db['CloudProvider'][_0xb6e7('0x34')]({'where':{'id':_0x386fbf[_0xb6e7('0x33')]['id']}})[_0xb6e7('0x12')](handleEntityNotFound(_0x1fd15d,null))[_0xb6e7('0x12')](removeEntity(_0x1fd15d,null))['catch'](handleError(_0x1fd15d,null));};exports[_0xb6e7('0x3e')]=function(_0x5d1e57,_0x2b6575){return db[_0xb6e7('0x19')][_0xb6e7('0x3f')]({'where':{'id':_0x5d1e57[_0xb6e7('0x33')]['id']},'raw':!![]})[_0xb6e7('0x12')](function(_0x301ae4){if(!_0x301ae4)return _0x2b6575[_0xb6e7('0x8')](0x194);return{'url':oauth[_0xb6e7('0x40')](_0x301ae4,_0x5d1e57[_0xb6e7('0x41')]['id'])};})[_0xb6e7('0x12')](respondWithResult(_0x2b6575,null))[_0xb6e7('0x36')](handleError(_0x2b6575,null));};exports[_0xb6e7('0x42')]=function(_0x41866a,_0x5ccd6a){var _0x2a8186=_0x41866a[_0xb6e7('0x38')];var _0x12ccbe;var _0x2967ed;if(_0x2a8186[_0xb6e7('0x43')])throw _0x2a8186;redis[_0xb6e7('0x44')](_0x2a8186[_0xb6e7('0x45')])[_0xb6e7('0x12')](function(_0x10e0ee){if(!_0x10e0ee)throw new Error(_0xb6e7('0x46'));_0x12ccbe=JSON[_0xb6e7('0x47')](_0x10e0ee);var _0x335939=Buffer[_0xb6e7('0x48')](_0x2a8186[_0xb6e7('0x45')],_0xb6e7('0x49'))[_0xb6e7('0x4a')](_0xb6e7('0x4b'));_0x2967ed=JSON[_0xb6e7('0x47')](_0x335939);if(!oauth[_0xb6e7('0x4c')](_0x2a8186[_0xb6e7('0x4d')],_0x12ccbe[_0xb6e7('0x4e')]))throw new Error(_0xb6e7('0x4f'));redis[_0xb6e7('0x50')](_0x2a8186[_0xb6e7('0x45')]);return oauth['getOauth2MicrosoftAccessToken'](_0x2a8186['code'],_0x12ccbe);})[_0xb6e7('0x12')](function(_0x4982d2){_0x12ccbe['data5']=_0x4982d2[_0xb6e7('0x51')];_0x12ccbe[_0xb6e7('0x52')]=_0x4982d2['refresh_token'];return db['CloudProvider'][_0xb6e7('0x11')]({'data5':_0x12ccbe['data5'],'data6':_0x12ccbe['data6']},{'where':{'id':_0x12ccbe['id']}});})[_0xb6e7('0x12')](function(){oauth['startRefreshInterval'](_0x12ccbe);socket[_0xb6e7('0x53')](_0xb6e7('0x54'),{'id':_0x2967ed['id']});return;})[_0xb6e7('0x12')](respondWithStatusCode(_0x5ccd6a,null))[_0xb6e7('0x36')](function(_0x49a6c5){if(_0x2967ed){socket['emit'](_0xb6e7('0x55'),{'id':_0x2967ed['id']});}if(!_0x12ccbe){logger[_0xb6e7('0x43')](_0xb6e7('0x56'),_0x49a6c5);return _0x5ccd6a[_0xb6e7('0x9')](0x1f4)['send'](_0x49a6c5['message']);}logger[_0xb6e7('0x43')](_0xb6e7('0x57'),_0x12ccbe['id'],JSON[_0xb6e7('0x58')](_0x49a6c5));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ea852af..fc630d2 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 _0xcddc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','lodash','util','../../config/logger','api'];(function(_0x50aecd,_0x3afbf1){var _0x21321d=function(_0x12b40c){while(--_0x12b40c){_0x50aecd['push'](_0x50aecd['shift']());}};_0x21321d(++_0x3afbf1);}(_0xcddc,0x130));var _0xccdd=function(_0x6b910b,_0x38ce8f){_0x6b910b=_0x6b910b-0x0;var _0x3408a7=_0xcddc[_0x6b910b];return _0x3408a7;};'use strict';var _=require(_0xccdd('0x0'));var util=require(_0xccdd('0x1'));var logger=require(_0xccdd('0x2'))(_0xccdd('0x3'));var moment=require(_0xccdd('0x4'));var BPromise=require(_0xccdd('0x5'));var rp=require(_0xccdd('0x6'));var fs=require('fs');var path=require(_0xccdd('0x7'));var rimraf=require(_0xccdd('0x8'));var config=require(_0xccdd('0x9'));var attributes=require(_0xccdd('0xa'));module['exports']=function(_0x1ff323,_0x5e5daa){return _0x1ff323['define']('CloudProvider',attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea1b=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4bfd33,_0x267afb){var _0x407a67=function(_0x25ebb6){while(--_0x25ebb6){_0x4bfd33['push'](_0x4bfd33['shift']());}};_0x407a67(++_0x267afb);}(_0xea1b,0x66));var _0xbea1=function(_0xeb34f2,_0x474ed4){_0xeb34f2=_0xeb34f2-0x0;var _0x3153a4=_0xea1b[_0xeb34f2];return _0x3153a4;};'use strict';var _=require(_0xbea1('0x0'));var util=require(_0xbea1('0x1'));var logger=require(_0xbea1('0x2'))('api');var moment=require(_0xbea1('0x3'));var BPromise=require(_0xbea1('0x4'));var rp=require(_0xbea1('0x5'));var fs=require('fs');var path=require(_0xbea1('0x6'));var rimraf=require(_0xbea1('0x7'));var config=require(_0xbea1('0x8'));var attributes=require(_0xbea1('0x9'));module[_0xbea1('0xa')]=function(_0x10b0cb,_0xcbed63){return _0x10b0cb['define']('CloudProvider',attributes,{'tableName':_0xbea1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 0fc07d9..ea55cd9 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 _0xdf68=['unix','exp','resolve','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','POST','intervals','bind','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','/.default','join','Outlook365','{TENANT_ID}','data2','code','id_token','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','prompt','login','key','value','replace','oauth2/','set','decode','iss','aud','audience','nonce','isAfter'];(function(_0x464ee2,_0x3d1a7f){var _0x2b4454=function(_0x35587b){while(--_0x35587b){_0x464ee2['push'](_0x464ee2['shift']());}};_0x2b4454(++_0x3d1a7f);}(_0xdf68,0x198));var _0x8df6=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xdf68[_0x87239];return _0x53af1e;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x8df6('0x0'));var moment=require(_0x8df6('0x1'));var Redis=require(_0x8df6('0x2'));var rp=require(_0x8df6('0x3'));var util=require(_0x8df6('0x4'));var encryptor=require(_0x8df6('0x5'));var config=require(_0x8df6('0x6'));var logger=require('../../config/logger')('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x8df6('0x7'))['db'];config[_0x8df6('0x8')]=_[_0x8df6('0x9')](config[_0x8df6('0x8')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8df6('0x8')]);var MICROSOFT_AUTH_URL=_0x8df6('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8df6('0xb'),_0x8df6('0xc'),'email',_0x8df6('0xd'),_0x8df6('0xe'),_0x8df6('0xf'),_0x8df6('0x10')],'Dynamics365':[_0x8df6('0xb'),_0x8df6('0xd')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0x8df6('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5857a2){var _0x8a2de0=_[_0x8df6('0x12')](AZURE_AUTH_SCOPES[_0x5857a2[_0x8df6('0x13')]]);if(_0x5857a2[_0x8df6('0x13')]===_0x8df6('0x14'))_0x8a2de0[_0x8df6('0x15')](_0x5857a2['data7']+_0x8df6('0x16'));return _0x8a2de0[_0x8df6('0x17')]('\x20');}function getAccessTokenScope(_0x532df2){if(_0x532df2['type']===_0x8df6('0x18'))return _0x8df6('0xe');if(_0x532df2[_0x8df6('0x13')]==='Dynamics365')return _0x532df2['data7']+_0x8df6('0x16');}function generateMicrosoftAuthorizationUrl(_0x494aa1,_0xb37cb9){var _0x345372=MICROSOFT_AUTH_URL['replace'](_0x8df6('0x19'),_0x494aa1[_0x8df6('0x1a')]);var _0x2cf03a=[_0x8df6('0x1b'),_0x8df6('0x1c')];var _0x5af783=Buffer['from'](JSON[_0x8df6('0x1d')]({'id':_0xb37cb9}))['toString'](_0x8df6('0x1e'));var _0x2b653c=crypto[_0x8df6('0x1f')](0x10)[_0x8df6('0x20')](_0x8df6('0x21'));var _0x5b456c=getAuthorizationScopes(_0x494aa1);var _0x2c9aac=[{'key':_0x8df6('0x22'),'value':_0x494aa1[_0x8df6('0x23')]},{'key':_0x8df6('0x24'),'value':encodeURIComponent(_0x2cf03a[_0x8df6('0x17')]('\x20'))},{'key':_0x8df6('0x25'),'value':_0x494aa1[_0x8df6('0x26')]},{'key':_0x8df6('0x27'),'value':_0x8df6('0x28')},{'key':'scope','value':encodeURIComponent(_0x5b456c)},{'key':'state','value':_0x5af783},{'key':'nonce','value':_0x2b653c},{'key':_0x8df6('0x29'),'value':_0x8df6('0x2a')}];var _0x5a034e=_0x345372+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8df6('0x12')](_0x2c9aac,function(_0x248df6){return _0x248df6[_0x8df6('0x2b')]+'='+_0x248df6[_0x8df6('0x2c')];})['join']('&');_0x494aa1['oauth2Claims']={'issuer':_0x345372[_0x8df6('0x2d')](_0x8df6('0x2e'),''),'audience':_0x494aa1[_0x8df6('0x23')],'state':_0x5af783,'nonce':_0x2b653c};redis[_0x8df6('0x2f')](_0x5af783,JSON['stringify'](_0x494aa1));return _0x5a034e;}function isValidIdToken(_0x16760e,_0x5a24a2){try{var _0x2a409c=jwt[_0x8df6('0x30')](_0x16760e,{'complete':!![]});var _0x1b230f=_0x2a409c['payload'];if(_0x1b230f[_0x8df6('0x31')]!==_0x5a24a2['issuer'])return![];if(_0x1b230f[_0x8df6('0x32')]!==_0x5a24a2[_0x8df6('0x33')])return![];if(_0x1b230f[_0x8df6('0x34')]!==_0x5a24a2[_0x8df6('0x34')])return![];if(moment()[_0x8df6('0x35')](moment[_0x8df6('0x36')](_0x1b230f[_0x8df6('0x37')])))return![];return!![];}catch(_0x6f434f){throw _0x6f434f;}}function refreshOauth2MicrosoftAccessToken(_0x225120){return Promise[_0x8df6('0x38')]()['then'](function(){if(_0x225120[_0x8df6('0x39')])return _0x225120;return db[_0x8df6('0x3a')][_0x8df6('0x3b')]({'where':{'id':_0x225120['id']},'raw':!![]});})[_0x8df6('0x3c')](function(_0x38e95f){var _0x13c818={'grant_type':_0x8df6('0x3d'),'refresh_token':_0x38e95f[_0x8df6('0x3e')],'scope':getAccessTokenScope(_0x38e95f),'redirect_uri':_0x38e95f['data4'],'client_id':_0x38e95f[_0x8df6('0x23')],'client_secret':encryptor[_0x8df6('0x3f')](_0x38e95f[_0x8df6('0x39')])};var _0x436590={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8df6('0x2d')](_0x8df6('0x19'),_0x38e95f[_0x8df6('0x1a')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x13c818,'json':!![]};return rp(_0x436590);})['then'](function(_0x2ccd9a){_0x225120[_0x8df6('0x40')]=_0x2ccd9a[_0x8df6('0x41')];_0x225120[_0x8df6('0x3e')]=_0x2ccd9a['refresh_token'];return db[_0x8df6('0x3a')][_0x8df6('0x42')]({'data5':_0x225120[_0x8df6('0x40')],'data6':_0x225120[_0x8df6('0x3e')]},{'where':{'id':_0x225120['id']}});})['then'](function(){return _0x225120;})['catch'](function(_0x4c76a1){logger[_0x8df6('0x43')](_0x8df6('0x44'),_0x225120['id'],_0x4c76a1);});}function getOauth2MicrosoftAccessToken(_0x49e9de,_0xed910d){var _0x9561cc={'grant_type':'authorization_code','code':_0x49e9de,'scope':getAccessTokenScope(_0xed910d),'redirect_uri':_0xed910d['data4'],'client_id':_0xed910d['data1'],'client_secret':encryptor[_0x8df6('0x3f')](_0xed910d[_0x8df6('0x39')])};var _0x4d9be9={'method':_0x8df6('0x45'),'uri':MICROSOFT_AUTH_URL['replace'](_0x8df6('0x19'),_0xed910d['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9561cc,'json':!![]};return rp(_0x4d9be9);}function startRefreshInterval(_0x5b3dde){var _0x5aa48b=schedule[_0x8df6('0x46')];if(_0x5aa48b[_0x5b3dde['id']])clearInterval(_0x5aa48b[_0x5b3dde['id']]);_0x5aa48b[_0x5b3dde['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8df6('0x47')](this,{'id':_0x5b3dde['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8df6('0x46')]=_0x5aa48b;}function startAllRefreshIntervals(){return db[_0x8df6('0x3a')][_0x8df6('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8df6('0x3c')](function(_0x42b9b5){var _0x1a4163=_0x42b9b5['map'](function(_0x498cf6){return refreshOauth2MicrosoftAccessToken(_0x498cf6)[_0x8df6('0x3c')](function(_0x6e3664){startRefreshInterval(_0x6e3664);});});return Promise[_0x8df6('0x49')](_0x1a4163);})[_0x8df6('0x4a')](function(_0x5ac586){var _0x5d1001=_0x5ac586?util['inspect'](_0x5ac586,{'showHidden':![],'depth':null}):'';logger[_0x8df6('0x43')](_0x8df6('0x4b'),_0x5d1001);});}module[_0x8df6('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa10b=['data7','/.default','Outlook365','{TENANT_ID}','code','id_token','from','stringify','toString','base64','hex','client_id','data1','response_type','join','data4','response_mode','form_post','state','nonce','prompt','key','value','oauth2Claims','replace','oauth2/','set','decode','payload','iss','audience','isAfter','then','data3','CloudProvider','decryptString','POST','data2','data5','refresh_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','map','type','Dynamics365','push'];(function(_0x68b160,_0x3664c1){var _0x4345b3=function(_0x5ad02c){while(--_0x5ad02c){_0x68b160['push'](_0x68b160['shift']());}};_0x4345b3(++_0x3664c1);}(_0xa10b,0x7f));var _0xba10=function(_0x3e70a9,_0x55bf56){_0x3e70a9=_0x3e70a9-0x0;var _0x6a1474=_0xa10b[_0x3e70a9];return _0x6a1474;};'use strict';var _=require(_0xba10('0x0'));var crypto=require(_0xba10('0x1'));var jwt=require(_0xba10('0x2'));var moment=require('moment');var Redis=require(_0xba10('0x3'));var rp=require(_0xba10('0x4'));var util=require(_0xba10('0x5'));var encryptor=require(_0xba10('0x6'));var config=require(_0xba10('0x7'));var logger=require('../../config/logger')(_0xba10('0x8'));var schedule=require(_0xba10('0x9'));var db=require(_0xba10('0xa'))['db'];config[_0xba10('0xb')]=_[_0xba10('0xc')](config[_0xba10('0xb')],{'host':_0xba10('0xd'),'port':0x18eb});var redis=new Redis(config[_0xba10('0xb')]);var MICROSOFT_AUTH_URL=_0xba10('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xba10('0xf'),_0xba10('0x10'),'email','offline_access',_0xba10('0x11'),'https://outlook.office.com/POP.AccessAsUser.All',_0xba10('0x12')],'Dynamics365':[_0xba10('0xf'),_0xba10('0x13')]};var MICROSOFT_AUTH_ENDPOINT=_0xba10('0x14');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x8b53d0){var _0x35e945=_[_0xba10('0x15')](AZURE_AUTH_SCOPES[_0x8b53d0[_0xba10('0x16')]]);if(_0x8b53d0[_0xba10('0x16')]===_0xba10('0x17'))_0x35e945[_0xba10('0x18')](_0x8b53d0[_0xba10('0x19')]+_0xba10('0x1a'));return _0x35e945['join']('\x20');}function getAccessTokenScope(_0x101ef1){if(_0x101ef1[_0xba10('0x16')]===_0xba10('0x1b'))return _0xba10('0x11');if(_0x101ef1[_0xba10('0x16')]==='Dynamics365')return _0x101ef1[_0xba10('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x287a24,_0xb6e5fe){var _0x226c9b=MICROSOFT_AUTH_URL['replace'](_0xba10('0x1c'),_0x287a24['data2']);var _0x5a248d=[_0xba10('0x1d'),_0xba10('0x1e')];var _0xbb4c6d=Buffer[_0xba10('0x1f')](JSON[_0xba10('0x20')]({'id':_0xb6e5fe}))[_0xba10('0x21')](_0xba10('0x22'));var _0x404c8c=crypto['randomBytes'](0x10)[_0xba10('0x21')](_0xba10('0x23'));var _0x2b6e11=getAuthorizationScopes(_0x287a24);var _0x1d69f5=[{'key':_0xba10('0x24'),'value':_0x287a24[_0xba10('0x25')]},{'key':_0xba10('0x26'),'value':encodeURIComponent(_0x5a248d[_0xba10('0x27')]('\x20'))},{'key':'redirect_uri','value':_0x287a24[_0xba10('0x28')]},{'key':_0xba10('0x29'),'value':_0xba10('0x2a')},{'key':'scope','value':encodeURIComponent(_0x2b6e11)},{'key':_0xba10('0x2b'),'value':_0xbb4c6d},{'key':_0xba10('0x2c'),'value':_0x404c8c},{'key':_0xba10('0x2d'),'value':'login'}];var _0xa67735=_0x226c9b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xba10('0x15')](_0x1d69f5,function(_0x2c4680){return _0x2c4680[_0xba10('0x2e')]+'='+_0x2c4680[_0xba10('0x2f')];})[_0xba10('0x27')]('&');_0x287a24[_0xba10('0x30')]={'issuer':_0x226c9b[_0xba10('0x31')](_0xba10('0x32'),''),'audience':_0x287a24['data1'],'state':_0xbb4c6d,'nonce':_0x404c8c};redis[_0xba10('0x33')](_0xbb4c6d,JSON['stringify'](_0x287a24));return _0xa67735;}function isValidIdToken(_0x57de6e,_0x1b1624){try{var _0x56bf2b=jwt[_0xba10('0x34')](_0x57de6e,{'complete':!![]});var _0x788dfe=_0x56bf2b[_0xba10('0x35')];if(_0x788dfe[_0xba10('0x36')]!==_0x1b1624['issuer'])return![];if(_0x788dfe['aud']!==_0x1b1624[_0xba10('0x37')])return![];if(_0x788dfe[_0xba10('0x2c')]!==_0x1b1624[_0xba10('0x2c')])return![];if(moment()[_0xba10('0x38')](moment['unix'](_0x788dfe['exp'])))return![];return!![];}catch(_0x310e33){throw _0x310e33;}}function refreshOauth2MicrosoftAccessToken(_0x22da3d){return Promise['resolve']()[_0xba10('0x39')](function(){if(_0x22da3d[_0xba10('0x3a')])return _0x22da3d;return db[_0xba10('0x3b')]['findOne']({'where':{'id':_0x22da3d['id']},'raw':!![]});})[_0xba10('0x39')](function(_0x380775){var _0x30c47e={'grant_type':'refresh_token','refresh_token':_0x380775['data6'],'scope':getAccessTokenScope(_0x380775),'redirect_uri':_0x380775[_0xba10('0x28')],'client_id':_0x380775[_0xba10('0x25')],'client_secret':encryptor[_0xba10('0x3c')](_0x380775[_0xba10('0x3a')])};var _0x29b65e={'method':_0xba10('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xba10('0x31')](_0xba10('0x1c'),_0x380775[_0xba10('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x30c47e,'json':!![]};return rp(_0x29b65e);})[_0xba10('0x39')](function(_0x5e7481){_0x22da3d[_0xba10('0x3f')]=_0x5e7481['access_token'];_0x22da3d['data6']=_0x5e7481[_0xba10('0x40')];return db[_0xba10('0x3b')][_0xba10('0x41')]({'data5':_0x22da3d[_0xba10('0x3f')],'data6':_0x22da3d['data6']},{'where':{'id':_0x22da3d['id']}});})[_0xba10('0x39')](function(){return _0x22da3d;})[_0xba10('0x42')](function(_0x1e80ce){logger[_0xba10('0x43')](_0xba10('0x44'),_0x22da3d['id'],_0x1e80ce);});}function getOauth2MicrosoftAccessToken(_0x435c23,_0x4f1df4){var _0x8c2eaa={'grant_type':_0xba10('0x45'),'code':_0x435c23,'scope':getAccessTokenScope(_0x4f1df4),'redirect_uri':_0x4f1df4[_0xba10('0x28')],'client_id':_0x4f1df4[_0xba10('0x25')],'client_secret':encryptor[_0xba10('0x3c')](_0x4f1df4[_0xba10('0x3a')])};var _0x1d67e3={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xba10('0x31')](_0xba10('0x1c'),_0x4f1df4[_0xba10('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x8c2eaa,'json':!![]};return rp(_0x1d67e3);}function startRefreshInterval(_0x3eb11d){var _0x24aae9=schedule[_0xba10('0x46')];if(_0x24aae9[_0x3eb11d['id']])clearInterval(_0x24aae9[_0x3eb11d['id']]);_0x24aae9[_0x3eb11d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xba10('0x47')](this,{'id':_0x3eb11d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xba10('0x46')]=_0x24aae9;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xba10('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xba10('0x39')](function(_0x33fcb1){var _0x5b3c29=_0x33fcb1['map'](function(_0x1478ae){return refreshOauth2MicrosoftAccessToken(_0x1478ae)[_0xba10('0x39')](function(_0x2d312e){startRefreshInterval(_0x2d312e);});});return Promise[_0xba10('0x49')](_0x5b3c29);})[_0xba10('0x42')](function(_0x3c655c){var _0x4e5ccc=_0x3c655c?util[_0xba10('0x4a')](_0x3c655c,{'showHidden':![],'depth':null}):'';logger['error']('[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s',_0x4e5ccc);});}module[_0xba10('0x4b')]={'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 9016e41..55b98e7 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 _0xccef=['stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x58ccd6,_0x37a2f4){var _0x368e39=function(_0x56866b){while(--_0x56866b){_0x58ccd6['push'](_0x58ccd6['shift']());}};_0x368e39(++_0x37a2f4);}(_0xccef,0x1d4));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});} \ No newline at end of file +var _0x8952=['CloudProvider,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x454c12,_0x45c282){var _0x7bb4dc=function(_0x585c87){while(--_0x585c87){_0x454c12['push'](_0x454c12['shift']());}};_0x7bb4dc(++_0x45c282);}(_0x8952,0x17e));var _0x2895=function(_0x4ec0c7,_0xbf937){_0x4ec0c7=_0x4ec0c7-0x0;var _0x1b2867=_0x8952[_0x4ec0c7];return _0x1b2867;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('CloudProvider,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 3ae5329..bd0d623 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x3e91a9,_0x53c466){var _0x25c9ad=function(_0x69ee2d){while(--_0x69ee2d){_0x3e91a9['push'](_0x3e91a9['shift']());}};_0x25c9ad(++_0x53c466);}(_0x1261,0x144));var _0x1126=function(_0x3af6d3,_0xd6ff2e){_0x3af6d3=_0x3af6d3-0x0;var _0xf0c5a8=_0x1261[_0x3af6d3];return _0xf0c5a8;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1d178c,_0x51f561){var _0x42539c=function(_0x272ed6){while(--_0x272ed6){_0x1d178c['push'](_0x1d178c['shift']());}};_0x42539c(++_0x51f561);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xc4aa[_0x5f1391];return _0x50ebe3;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 72df926..7c4d8cd 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 _0x672d=['STRING','sequelize','exports','name'];(function(_0x3bf9fe,_0x5ed880){var _0x39bfc4=function(_0xf6515f){while(--_0xf6515f){_0x3bf9fe['push'](_0x3bf9fe['shift']());}};_0x39bfc4(++_0x5ed880);}(_0x672d,0x121));var _0xd672=function(_0x4c69f4,_0x684e63){_0x4c69f4=_0x4c69f4-0x0;var _0x3636c9=_0x672d[_0x4c69f4];return _0x3636c9;};'use strict';var Sequelize=require(_0xd672('0x0'));module[_0xd672('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd672('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd672('0x3')]},'companyId':{'type':Sequelize[_0xd672('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xd672('0x3')]},'fax':{'type':Sequelize[_0xd672('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xd672('0x3')]},'postalCode':{'type':Sequelize[_0xd672('0x3')]},'city':{'type':Sequelize[_0xd672('0x3')]},'country':{'type':Sequelize[_0xd672('0x3')]},'email':{'type':Sequelize[_0xd672('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd672('0x3')]},'sPostalCode':{'type':Sequelize[_0xd672('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xd672('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa7aa=['exports','STRING','name'];(function(_0xd7141d,_0x2f08c1){var _0x4fc5c4=function(_0x33f6d5){while(--_0x33f6d5){_0xd7141d['push'](_0xd7141d['shift']());}};_0x4fc5c4(++_0x2f08c1);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x302538,_0x4e49e7){_0x302538=_0x302538-0x0;var _0x51b79a=_0xa7aa[_0x302538];return _0x51b79a;};'use strict';var Sequelize=require('sequelize');module[_0xaa7a('0x0')]={'name':{'type':Sequelize[_0xaa7a('0x1')],'unique':_0xaa7a('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xaa7a('0x1')]},'companyId':{'type':Sequelize[_0xaa7a('0x1')]},'website':{'type':Sequelize[_0xaa7a('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xaa7a('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xaa7a('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xaa7a('0x1')]},'sPostalCode':{'type':Sequelize[_0xaa7a('0x1')]},'sCity':{'type':Sequelize[_0xaa7a('0x1')]},'sCountry':{'type':Sequelize[_0xaa7a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index ee309df..f3f01e8 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 _0x6802=['name','send','index','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','rows','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','getContacts','findOne','rawAttributes','map','nolimit','eml-format','rimraf','zip-dir','request-promise','mustache','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','UserProfileResource','end','error','stack'];(function(_0x25d875,_0x45de83){var _0x4010b1=function(_0x4b8d09){while(--_0x4b8d09){_0x25d875['push'](_0x25d875['shift']());}};_0x4010b1(++_0x45de83);}(_0x6802,0x17a));var _0x2680=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x6802[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require(_0x2680('0x0'));var rimraf=require(_0x2680('0x1'));var zipdir=require(_0x2680('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2680('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2680('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2680('0x5'));var csv=require('to-csv');var ejs=require(_0x2680('0x6'));var fs=require('fs');var fs_extra=require(_0x2680('0x7'));var _=require('lodash');var squel=require(_0x2680('0x8'));var crypto=require(_0x2680('0x9'));var jsforce=require(_0x2680('0xa'));var deskjs=require(_0x2680('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2680('0xc'));var Papa=require(_0x2680('0xd'));var Redis=require(_0x2680('0xe'));var authService=require(_0x2680('0xf'));var qs=require(_0x2680('0x10'));var as=require(_0x2680('0x11'));var hardwareService=require(_0x2680('0x12'));var logger=require(_0x2680('0x13'))(_0x2680('0x14'));var utils=require(_0x2680('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2680('0x16'))['db'];function respondWithStatusCode(_0x524ba9,_0x4694b5){_0x4694b5=_0x4694b5||0xcc;return function(_0x574aae){if(_0x574aae){return _0x524ba9[_0x2680('0x17')](_0x4694b5);}return _0x524ba9[_0x2680('0x18')](_0x4694b5)['end']();};}function respondWithResult(_0xc94b63,_0x1b0a04){_0x1b0a04=_0x1b0a04||0xc8;return function(_0x226739){if(_0x226739){return _0xc94b63[_0x2680('0x18')](_0x1b0a04)['json'](_0x226739);}};}function respondWithFilteredResult(_0x589e59,_0x328f30){return function(_0x1f4f82){if(_0x1f4f82){var _0x2e11e1=typeof _0x328f30['offset']===_0x2680('0x19')&&typeof _0x328f30[_0x2680('0x1a')]===_0x2680('0x19');var _0x1116d8=_0x1f4f82[_0x2680('0x1b')];var _0x3804a8=_0x2e11e1?0x0:_0x328f30[_0x2680('0x1c')];var _0x384250=_0x2e11e1?_0x1f4f82[_0x2680('0x1b')]:_0x328f30[_0x2680('0x1c')]+_0x328f30['limit'];var _0x3db20c;if(_0x384250>=_0x1116d8){_0x384250=_0x1116d8;_0x3db20c=0xc8;}else{_0x3db20c=0xce;}_0x589e59[_0x2680('0x18')](_0x3db20c);return _0x589e59[_0x2680('0x1d')](_0x2680('0x1e'),_0x3804a8+'-'+_0x384250+'/'+_0x1116d8)[_0x2680('0x1f')](_0x1f4f82);}return null;};}function patchUpdates(_0x4302dd){return function(_0x6e714d){try{jsonpatch[_0x2680('0x20')](_0x6e714d,_0x4302dd,!![]);}catch(_0x35be6e){return BPromise[_0x2680('0x21')](_0x35be6e);}return _0x6e714d[_0x2680('0x22')]();};}function saveUpdates(_0x3015af,_0x191770){return function(_0x281f9a){if(_0x281f9a){return _0x281f9a['update'](_0x3015af)[_0x2680('0x23')](function(_0x229a45){return _0x229a45;});}return null;};}function removeEntity(_0x2ddc6b,_0x437857){return function(_0x3bd787){if(_0x3bd787){return _0x3bd787[_0x2680('0x24')]()[_0x2680('0x23')](function(){var _0x98e2c2=_0x3bd787[_0x2680('0x25')]({'plain':!![]});var _0x2f1ede='Companies';return db[_0x2680('0x26')][_0x2680('0x24')]({'where':{'type':_0x2f1ede,'resourceId':_0x98e2c2['id']}})[_0x2680('0x23')](function(){return _0x3bd787;});})[_0x2680('0x23')](function(){_0x2ddc6b[_0x2680('0x18')](0xcc)[_0x2680('0x27')]();});}};}function handleEntityNotFound(_0xea567c,_0x381f2c){return function(_0x18f523){if(!_0x18f523){_0xea567c[_0x2680('0x17')](0x194);}return _0x18f523;};}function handleError(_0x5e2b89,_0x3bdf36){_0x3bdf36=_0x3bdf36||0x1f4;return function(_0x12330f){logger[_0x2680('0x28')](_0x12330f[_0x2680('0x29')]);if(_0x12330f['name']){delete _0x12330f[_0x2680('0x2a')];}_0x5e2b89['status'](_0x3bdf36)[_0x2680('0x2b')](_0x12330f);};}exports[_0x2680('0x2c')]=function(_0x5d7f81,_0x2e61ea){var _0x560f19={},_0x1d9f7e={},_0x3add76={'count':0x0,'rows':[]};return db[_0x2680('0x2d')]['describe']()['then'](function(_0x10d593){_0x1d9f7e[_0x2680('0x2e')]=_[_0x2680('0x2f')](_0x10d593);_0x1d9f7e[_0x2680('0x30')]=_[_0x2680('0x2f')](_0x5d7f81['query']);_0x1d9f7e[_0x2680('0x31')]=_[_0x2680('0x32')](_0x1d9f7e['model'],_0x1d9f7e[_0x2680('0x30')]);_0x560f19[_0x2680('0x33')]=_[_0x2680('0x32')](_0x1d9f7e[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x5d7f81[_0x2680('0x30')]['fields']));_0x560f19[_0x2680('0x33')]=_0x560f19['attributes'][_0x2680('0x35')]?_0x560f19['attributes']:_0x1d9f7e[_0x2680('0x2e')];if(!_0x5d7f81[_0x2680('0x30')][_0x2680('0x36')]('nolimit')){_0x560f19[_0x2680('0x1a')]=qs[_0x2680('0x1a')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x1a')]);_0x560f19[_0x2680('0x1c')]=qs[_0x2680('0x1c')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x1c')]);}_0x560f19[_0x2680('0x37')]=qs[_0x2680('0x38')](_0x5d7f81[_0x2680('0x30')][_0x2680('0x38')]);_0x560f19[_0x2680('0x39')]=qs['filters'](_['pick'](_0x5d7f81[_0x2680('0x30')],_0x1d9f7e[_0x2680('0x31')]),_0x10d593);if(_0x5d7f81[_0x2680('0x30')][_0x2680('0x3a')]){_0x560f19[_0x2680('0x39')]=_[_0x2680('0x3b')](_0x560f19[_0x2680('0x39')],{'$or':_['map'](_0x560f19[_0x2680('0x33')],function(_0x3ac48f){var _0x11390b={};_0x11390b[_0x3ac48f]={'$like':'%'+_0x5d7f81[_0x2680('0x30')][_0x2680('0x3a')]+'%'};return _0x11390b;})});}_0x560f19=_[_0x2680('0x3b')]({},_0x560f19,_0x5d7f81[_0x2680('0x3c')]);var _0x397f40={'where':_0x560f19[_0x2680('0x39')]};return db[_0x2680('0x2d')][_0x2680('0x1b')](_0x397f40)[_0x2680('0x23')](function(_0x2189ac){_0x3add76['count']=_0x2189ac;if(_0x5d7f81[_0x2680('0x30')]['includeAll']){_0x560f19[_0x2680('0x3d')]=[{'all':!![]}];}return db[_0x2680('0x2d')][_0x2680('0x3e')](_0x560f19);})['then'](function(_0x4c4d00){_0x3add76[_0x2680('0x3f')]=_0x4c4d00;return _0x3add76;})[_0x2680('0x23')](respondWithFilteredResult(_0x2e61ea,_0x560f19))['catch'](handleError(_0x2e61ea,null));})['catch'](handleError(_0x2e61ea,null));};exports['show']=function(_0x3761a2,_0x24659a){var _0x5060aa={'raw':![],'where':{'id':_0x3761a2['params']['id']}},_0x46003d={};_0x46003d[_0x2680('0x2e')]=_[_0x2680('0x2f')](db[_0x2680('0x2d')]['rawAttributes']);_0x46003d[_0x2680('0x30')]=_['keys'](_0x3761a2['query']);_0x46003d[_0x2680('0x31')]=_['intersection'](_0x46003d['model'],_0x46003d[_0x2680('0x30')]);_0x5060aa[_0x2680('0x33')]=_[_0x2680('0x32')](_0x46003d[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x3761a2[_0x2680('0x30')][_0x2680('0x34')]));_0x5060aa[_0x2680('0x33')]=_0x5060aa[_0x2680('0x33')][_0x2680('0x35')]?_0x5060aa[_0x2680('0x33')]:_0x46003d[_0x2680('0x2e')];if(_0x3761a2[_0x2680('0x30')][_0x2680('0x40')]){_0x5060aa[_0x2680('0x3d')]=[{'all':!![]}];}_0x5060aa=_['merge']({},_0x5060aa,_0x3761a2['options']);return db[_0x2680('0x2d')][_0x2680('0x41')](_0x5060aa)[_0x2680('0x23')](handleEntityNotFound(_0x24659a,null))['then'](respondWithResult(_0x24659a,null))['catch'](handleError(_0x24659a,null));};exports['create']=function(_0x36a202,_0x2e6ab0){return db['CmCompany'][_0x2680('0x42')](_0x36a202[_0x2680('0x43')],{})[_0x2680('0x23')](function(_0x98762e){var _0x3bf8f2=_0x36a202['user'][_0x2680('0x25')]({'plain':!![]});if(!_0x3bf8f2)throw new Error(_0x2680('0x44'));if(_0x3bf8f2[_0x2680('0x45')]==='user'){var _0x4d3e6d=_0x98762e[_0x2680('0x25')]({'plain':!![]});var _0x4131a1=_0x2680('0x46');return db['UserProfileSection'][_0x2680('0x41')]({'where':{'name':_0x4131a1,'userProfileId':_0x3bf8f2[_0x2680('0x47')]},'raw':!![]})[_0x2680('0x23')](function(_0xb31383){if(_0xb31383&&_0xb31383['autoAssociation']===0x0){return db[_0x2680('0x26')]['create']({'name':_0x4d3e6d[_0x2680('0x2a')],'resourceId':_0x4d3e6d['id'],'type':_0xb31383['name'],'sectionId':_0xb31383['id']},{})[_0x2680('0x23')](function(){return _0x98762e;});}else{return _0x98762e;}})[_0x2680('0x48')](function(_0x292285){logger[_0x2680('0x28')](_0x2680('0x49'),_0x292285);throw _0x292285;});}return _0x98762e;})['then'](respondWithResult(_0x2e6ab0,0xc9))[_0x2680('0x48')](handleError(_0x2e6ab0,null));};exports['update']=function(_0x11c373,_0x22075d){if(_0x11c373['body']['id']){delete _0x11c373[_0x2680('0x43')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x11c373[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x22075d,null))['then'](saveUpdates(_0x11c373[_0x2680('0x43')],null))[_0x2680('0x23')](respondWithResult(_0x22075d,null))[_0x2680('0x48')](handleError(_0x22075d,null));};exports['destroy']=function(_0x3ffb97,_0x34c6df){return db[_0x2680('0x2d')]['find']({'where':{'id':_0x3ffb97[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x34c6df,null))[_0x2680('0x23')](removeEntity(_0x34c6df,null))['catch'](handleError(_0x34c6df,null));};exports['describe']=function(_0x4c0215,_0x15a27d){return db[_0x2680('0x2d')][_0x2680('0x4b')]()[_0x2680('0x23')](respondWithResult(_0x15a27d,null))[_0x2680('0x48')](handleError(_0x15a27d,null));};exports[_0x2680('0x4c')]=function(_0x3f5312,_0xe1aa6,_0x2f549f){return db[_0x2680('0x4d')][_0x2680('0x41')]({'where':{'id':_0x3f5312[_0x2680('0x4a')]['id']}})[_0x2680('0x23')](handleEntityNotFound(_0xe1aa6,null))['then'](function(_0x5d4586){if(_0x5d4586){return _0x5d4586[_0x2680('0x4c')](_0x3f5312['body']['ids'],_[_0x2680('0x4e')](_0x3f5312['body'],['ids','id'])||{});}})['then'](respondWithResult(_0xe1aa6,null))[_0x2680('0x48')](handleError(_0xe1aa6,null));};exports[_0x2680('0x4f')]=function(_0x1d20b9,_0x3dcf29,_0x40570f){var _0x5cfd7e={};var _0x426a28={};var _0x23013a;var _0x35b594;return db[_0x2680('0x2d')][_0x2680('0x50')]({'where':{'id':_0x1d20b9['params']['id']}})[_0x2680('0x23')](handleEntityNotFound(_0x3dcf29,null))[_0x2680('0x23')](function(_0x59de7d){if(_0x59de7d){_0x23013a=_0x59de7d;_0x426a28[_0x2680('0x2e')]=_[_0x2680('0x2f')](db[_0x2680('0x4d')][_0x2680('0x51')]);_0x426a28[_0x2680('0x30')]=_[_0x2680('0x2f')](_0x1d20b9[_0x2680('0x30')]);_0x426a28[_0x2680('0x31')]=_[_0x2680('0x32')](_0x426a28[_0x2680('0x2e')],_0x426a28[_0x2680('0x30')]);_0x5cfd7e[_0x2680('0x33')]=_[_0x2680('0x32')](_0x426a28[_0x2680('0x2e')],qs[_0x2680('0x34')](_0x1d20b9[_0x2680('0x30')][_0x2680('0x34')]));_0x5cfd7e[_0x2680('0x33')]=_0x5cfd7e[_0x2680('0x33')][_0x2680('0x35')]?_0x5cfd7e['attributes']:_0x426a28[_0x2680('0x2e')];_0x5cfd7e[_0x2680('0x37')]=qs[_0x2680('0x38')](_0x1d20b9[_0x2680('0x30')]['sort']);_0x5cfd7e[_0x2680('0x39')]=qs[_0x2680('0x31')](_['pick'](_0x1d20b9[_0x2680('0x30')],_0x426a28[_0x2680('0x31')]));if(_0x1d20b9[_0x2680('0x30')]['filter']){_0x5cfd7e['where']=_[_0x2680('0x3b')](_0x5cfd7e['where'],{'$or':_[_0x2680('0x52')](_0x5cfd7e[_0x2680('0x33')],function(_0x3c8fa1){var _0x3ccb64={};_0x3ccb64[_0x3c8fa1]={'$like':'%'+_0x1d20b9[_0x2680('0x30')][_0x2680('0x3a')]+'%'};return _0x3ccb64;})});}_0x5cfd7e=_['merge']({},_0x5cfd7e,_0x1d20b9[_0x2680('0x3c')]);return _0x23013a['getContacts'](_0x5cfd7e);}})[_0x2680('0x23')](function(_0x3f079a){if(_0x3f079a){_0x35b594=_0x3f079a['length'];if(!_0x1d20b9[_0x2680('0x30')][_0x2680('0x36')](_0x2680('0x53'))){_0x5cfd7e[_0x2680('0x1a')]=qs[_0x2680('0x1a')](_0x1d20b9['query']['limit']);_0x5cfd7e[_0x2680('0x1c')]=qs[_0x2680('0x1c')](_0x1d20b9[_0x2680('0x30')][_0x2680('0x1c')]);}return _0x23013a[_0x2680('0x4f')](_0x5cfd7e);}})[_0x2680('0x23')](function(_0x5c2e2c){if(_0x5c2e2c){return _0x5c2e2c?{'count':_0x35b594,'rows':_0x5c2e2c}:null;}})[_0x2680('0x23')](respondWithResult(_0x3dcf29,null))[_0x2680('0x48')](handleError(_0x3dcf29,null));}; \ No newline at end of file +var _0xbe66=['zip-dir','request-promise','moment','mustache','sox','ejs','lodash','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','Companies','UserProfileResource','error','stack','name','send','index','describe','model','query','filters','intersection','attributes','fields','length','limit','order','sort','where','pick','merge','filter','options','include','CmCompany','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','map','nolimit','getContacts','eml-format'];(function(_0x422be2,_0x1c439e){var _0x1b820e=function(_0x513cc8){while(--_0x513cc8){_0x422be2['push'](_0x422be2['shift']());}};_0x1b820e(++_0x1c439e);}(_0xbe66,0x107));var _0x6be6=function(_0x18fb16,_0x45edbc){_0x18fb16=_0x18fb16-0x0;var _0x147b0d=_0xbe66[_0x18fb16];return _0x147b0d;};'use strict';var emlformat=require(_0x6be6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6be6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6be6('0x2'));var moment=require(_0x6be6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6be6('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6be6('0x5'));var csv=require('to-csv');var ejs=require(_0x6be6('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6be6('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6be6('0x8'));var toCsv=require(_0x6be6('0x9'));var querystring=require(_0x6be6('0xa'));var Papa=require(_0x6be6('0xb'));var Redis=require(_0x6be6('0xc'));var authService=require(_0x6be6('0xd'));var qs=require(_0x6be6('0xe'));var as=require(_0x6be6('0xf'));var hardwareService=require(_0x6be6('0x10'));var logger=require(_0x6be6('0x11'))(_0x6be6('0x12'));var utils=require(_0x6be6('0x13'));var config=require(_0x6be6('0x14'));var licenseUtil=require(_0x6be6('0x15'));var db=require(_0x6be6('0x16'))['db'];function respondWithStatusCode(_0x4660ef,_0x48ebaf){_0x48ebaf=_0x48ebaf||0xcc;return function(_0x298963){if(_0x298963){return _0x4660ef[_0x6be6('0x17')](_0x48ebaf);}return _0x4660ef[_0x6be6('0x18')](_0x48ebaf)[_0x6be6('0x19')]();};}function respondWithResult(_0x1de961,_0x19a97c){_0x19a97c=_0x19a97c||0xc8;return function(_0x1e88bd){if(_0x1e88bd){return _0x1de961[_0x6be6('0x18')](_0x19a97c)[_0x6be6('0x1a')](_0x1e88bd);}};}function respondWithFilteredResult(_0x45ff47,_0x51394f){return function(_0x24610d){if(_0x24610d){var _0x539e3f=typeof _0x51394f[_0x6be6('0x1b')]===_0x6be6('0x1c')&&typeof _0x51394f['limit']===_0x6be6('0x1c');var _0x4f47f8=_0x24610d[_0x6be6('0x1d')];var _0x46e73e=_0x539e3f?0x0:_0x51394f[_0x6be6('0x1b')];var _0x9c23e=_0x539e3f?_0x24610d[_0x6be6('0x1d')]:_0x51394f['offset']+_0x51394f['limit'];var _0x1786f3;if(_0x9c23e>=_0x4f47f8){_0x9c23e=_0x4f47f8;_0x1786f3=0xc8;}else{_0x1786f3=0xce;}_0x45ff47[_0x6be6('0x18')](_0x1786f3);return _0x45ff47[_0x6be6('0x1e')](_0x6be6('0x1f'),_0x46e73e+'-'+_0x9c23e+'/'+_0x4f47f8)[_0x6be6('0x1a')](_0x24610d);}return null;};}function patchUpdates(_0xeb50e3){return function(_0x48b4eb){try{jsonpatch[_0x6be6('0x20')](_0x48b4eb,_0xeb50e3,!![]);}catch(_0x3cf52c){return BPromise[_0x6be6('0x21')](_0x3cf52c);}return _0x48b4eb[_0x6be6('0x22')]();};}function saveUpdates(_0x50a369,_0x2c5248){return function(_0x29e010){if(_0x29e010){return _0x29e010[_0x6be6('0x23')](_0x50a369)[_0x6be6('0x24')](function(_0x120b15){return _0x120b15;});}return null;};}function removeEntity(_0x4c20e5,_0x9e5a0){return function(_0x240cec){if(_0x240cec){return _0x240cec[_0x6be6('0x25')]()[_0x6be6('0x24')](function(){var _0x3788f6=_0x240cec['get']({'plain':!![]});var _0x4a6bc7=_0x6be6('0x26');return db[_0x6be6('0x27')][_0x6be6('0x25')]({'where':{'type':_0x4a6bc7,'resourceId':_0x3788f6['id']}})[_0x6be6('0x24')](function(){return _0x240cec;});})[_0x6be6('0x24')](function(){_0x4c20e5[_0x6be6('0x18')](0xcc)[_0x6be6('0x19')]();});}};}function handleEntityNotFound(_0x2323ef,_0x278a89){return function(_0x542c7c){if(!_0x542c7c){_0x2323ef[_0x6be6('0x17')](0x194);}return _0x542c7c;};}function handleError(_0x3ebd42,_0x1bd943){_0x1bd943=_0x1bd943||0x1f4;return function(_0x3e8d4d){logger[_0x6be6('0x28')](_0x3e8d4d[_0x6be6('0x29')]);if(_0x3e8d4d[_0x6be6('0x2a')]){delete _0x3e8d4d['name'];}_0x3ebd42['status'](_0x1bd943)[_0x6be6('0x2b')](_0x3e8d4d);};}exports[_0x6be6('0x2c')]=function(_0x5362d9,_0x2202bf){var _0x562fdd={},_0x3aa99c={},_0xb3223c={'count':0x0,'rows':[]};return db['CmCompany'][_0x6be6('0x2d')]()[_0x6be6('0x24')](function(_0x1a1999){_0x3aa99c[_0x6be6('0x2e')]=_['keys'](_0x1a1999);_0x3aa99c[_0x6be6('0x2f')]=_['keys'](_0x5362d9[_0x6be6('0x2f')]);_0x3aa99c[_0x6be6('0x30')]=_[_0x6be6('0x31')](_0x3aa99c['model'],_0x3aa99c[_0x6be6('0x2f')]);_0x562fdd[_0x6be6('0x32')]=_['intersection'](_0x3aa99c[_0x6be6('0x2e')],qs['fields'](_0x5362d9[_0x6be6('0x2f')][_0x6be6('0x33')]));_0x562fdd[_0x6be6('0x32')]=_0x562fdd[_0x6be6('0x32')][_0x6be6('0x34')]?_0x562fdd[_0x6be6('0x32')]:_0x3aa99c['model'];if(!_0x5362d9[_0x6be6('0x2f')]['hasOwnProperty']('nolimit')){_0x562fdd[_0x6be6('0x35')]=qs['limit'](_0x5362d9['query'][_0x6be6('0x35')]);_0x562fdd[_0x6be6('0x1b')]=qs[_0x6be6('0x1b')](_0x5362d9['query'][_0x6be6('0x1b')]);}_0x562fdd[_0x6be6('0x36')]=qs[_0x6be6('0x37')](_0x5362d9[_0x6be6('0x2f')][_0x6be6('0x37')]);_0x562fdd[_0x6be6('0x38')]=qs[_0x6be6('0x30')](_[_0x6be6('0x39')](_0x5362d9['query'],_0x3aa99c[_0x6be6('0x30')]),_0x1a1999);if(_0x5362d9[_0x6be6('0x2f')]['filter']){_0x562fdd[_0x6be6('0x38')]=_[_0x6be6('0x3a')](_0x562fdd[_0x6be6('0x38')],{'$or':_['map'](_0x562fdd[_0x6be6('0x32')],function(_0x37fbba){var _0x2cc6a8={};_0x2cc6a8[_0x37fbba]={'$like':'%'+_0x5362d9['query'][_0x6be6('0x3b')]+'%'};return _0x2cc6a8;})});}_0x562fdd=_[_0x6be6('0x3a')]({},_0x562fdd,_0x5362d9[_0x6be6('0x3c')]);var _0x1b1502={'where':_0x562fdd[_0x6be6('0x38')]};return db['CmCompany']['count'](_0x1b1502)[_0x6be6('0x24')](function(_0x1edc6f){_0xb3223c[_0x6be6('0x1d')]=_0x1edc6f;if(_0x5362d9['query']['includeAll']){_0x562fdd[_0x6be6('0x3d')]=[{'all':!![]}];}return db[_0x6be6('0x3e')][_0x6be6('0x3f')](_0x562fdd);})[_0x6be6('0x24')](function(_0x425774){_0xb3223c[_0x6be6('0x40')]=_0x425774;return _0xb3223c;})['then'](respondWithFilteredResult(_0x2202bf,_0x562fdd))[_0x6be6('0x41')](handleError(_0x2202bf,null));})[_0x6be6('0x41')](handleError(_0x2202bf,null));};exports[_0x6be6('0x42')]=function(_0x2c280f,_0x6f100f){var _0x73e7c6={'raw':![],'where':{'id':_0x2c280f[_0x6be6('0x43')]['id']}},_0x2bb477={};_0x2bb477[_0x6be6('0x2e')]=_[_0x6be6('0x44')](db[_0x6be6('0x3e')][_0x6be6('0x45')]);_0x2bb477[_0x6be6('0x2f')]=_[_0x6be6('0x44')](_0x2c280f[_0x6be6('0x2f')]);_0x2bb477['filters']=_['intersection'](_0x2bb477[_0x6be6('0x2e')],_0x2bb477[_0x6be6('0x2f')]);_0x73e7c6[_0x6be6('0x32')]=_[_0x6be6('0x31')](_0x2bb477[_0x6be6('0x2e')],qs[_0x6be6('0x33')](_0x2c280f[_0x6be6('0x2f')][_0x6be6('0x33')]));_0x73e7c6['attributes']=_0x73e7c6['attributes'][_0x6be6('0x34')]?_0x73e7c6[_0x6be6('0x32')]:_0x2bb477[_0x6be6('0x2e')];if(_0x2c280f[_0x6be6('0x2f')][_0x6be6('0x46')]){_0x73e7c6[_0x6be6('0x3d')]=[{'all':!![]}];}_0x73e7c6=_[_0x6be6('0x3a')]({},_0x73e7c6,_0x2c280f[_0x6be6('0x3c')]);return db[_0x6be6('0x3e')][_0x6be6('0x47')](_0x73e7c6)[_0x6be6('0x24')](handleEntityNotFound(_0x6f100f,null))['then'](respondWithResult(_0x6f100f,null))['catch'](handleError(_0x6f100f,null));};exports['create']=function(_0x12685b,_0x897025){return db[_0x6be6('0x3e')]['create'](_0x12685b[_0x6be6('0x48')],{})['then'](function(_0x1c3dee){var _0x1aba5c=_0x12685b[_0x6be6('0x49')][_0x6be6('0x4a')]({'plain':!![]});if(!_0x1aba5c)throw new Error(_0x6be6('0x4b'));if(_0x1aba5c[_0x6be6('0x4c')]===_0x6be6('0x49')){var _0x36d49a=_0x1c3dee[_0x6be6('0x4a')]({'plain':!![]});var _0x39a81c=_0x6be6('0x26');return db[_0x6be6('0x4d')]['find']({'where':{'name':_0x39a81c,'userProfileId':_0x1aba5c[_0x6be6('0x4e')]},'raw':!![]})[_0x6be6('0x24')](function(_0x44b633){if(_0x44b633&&_0x44b633[_0x6be6('0x4f')]===0x0){return db[_0x6be6('0x27')][_0x6be6('0x50')]({'name':_0x36d49a[_0x6be6('0x2a')],'resourceId':_0x36d49a['id'],'type':_0x44b633[_0x6be6('0x2a')],'sectionId':_0x44b633['id']},{})[_0x6be6('0x24')](function(){return _0x1c3dee;});}else{return _0x1c3dee;}})[_0x6be6('0x41')](function(_0x31d5c1){logger[_0x6be6('0x28')](_0x6be6('0x51'),_0x31d5c1);throw _0x31d5c1;});}return _0x1c3dee;})[_0x6be6('0x24')](respondWithResult(_0x897025,0xc9))[_0x6be6('0x41')](handleError(_0x897025,null));};exports[_0x6be6('0x23')]=function(_0x1d0ab9,_0x435fed){if(_0x1d0ab9[_0x6be6('0x48')]['id']){delete _0x1d0ab9[_0x6be6('0x48')]['id'];}return db[_0x6be6('0x3e')]['find']({'where':{'id':_0x1d0ab9[_0x6be6('0x43')]['id']}})[_0x6be6('0x24')](handleEntityNotFound(_0x435fed,null))[_0x6be6('0x24')](saveUpdates(_0x1d0ab9[_0x6be6('0x48')],null))[_0x6be6('0x24')](respondWithResult(_0x435fed,null))[_0x6be6('0x41')](handleError(_0x435fed,null));};exports[_0x6be6('0x25')]=function(_0x19d449,_0x4ca769){return db[_0x6be6('0x3e')][_0x6be6('0x47')]({'where':{'id':_0x19d449[_0x6be6('0x43')]['id']}})[_0x6be6('0x24')](handleEntityNotFound(_0x4ca769,null))[_0x6be6('0x24')](removeEntity(_0x4ca769,null))[_0x6be6('0x41')](handleError(_0x4ca769,null));};exports[_0x6be6('0x2d')]=function(_0x219544,_0x1c6be7){return db['CmCompany'][_0x6be6('0x2d')]()[_0x6be6('0x24')](respondWithResult(_0x1c6be7,null))[_0x6be6('0x41')](handleError(_0x1c6be7,null));};exports[_0x6be6('0x52')]=function(_0x3f8f27,_0x460aa4,_0x20a248){return db['CmContact'][_0x6be6('0x47')]({'where':{'id':_0x3f8f27[_0x6be6('0x43')]['id']}})[_0x6be6('0x24')](handleEntityNotFound(_0x460aa4,null))[_0x6be6('0x24')](function(_0x3c6f94){if(_0x3c6f94){return _0x3c6f94[_0x6be6('0x52')](_0x3f8f27[_0x6be6('0x48')][_0x6be6('0x53')],_[_0x6be6('0x54')](_0x3f8f27[_0x6be6('0x48')],[_0x6be6('0x53'),'id'])||{});}})[_0x6be6('0x24')](respondWithResult(_0x460aa4,null))[_0x6be6('0x41')](handleError(_0x460aa4,null));};exports['getContacts']=function(_0x4b7947,_0x9d8d17,_0x4b2d11){var _0x1f3635={};var _0x1c3b8c={};var _0x1eb81d;var _0x2c679b;return db['CmCompany']['findOne']({'where':{'id':_0x4b7947[_0x6be6('0x43')]['id']}})[_0x6be6('0x24')](handleEntityNotFound(_0x9d8d17,null))[_0x6be6('0x24')](function(_0x559913){if(_0x559913){_0x1eb81d=_0x559913;_0x1c3b8c[_0x6be6('0x2e')]=_[_0x6be6('0x44')](db['CmContact'][_0x6be6('0x45')]);_0x1c3b8c[_0x6be6('0x2f')]=_[_0x6be6('0x44')](_0x4b7947[_0x6be6('0x2f')]);_0x1c3b8c[_0x6be6('0x30')]=_['intersection'](_0x1c3b8c[_0x6be6('0x2e')],_0x1c3b8c[_0x6be6('0x2f')]);_0x1f3635[_0x6be6('0x32')]=_[_0x6be6('0x31')](_0x1c3b8c[_0x6be6('0x2e')],qs[_0x6be6('0x33')](_0x4b7947[_0x6be6('0x2f')][_0x6be6('0x33')]));_0x1f3635[_0x6be6('0x32')]=_0x1f3635['attributes'][_0x6be6('0x34')]?_0x1f3635[_0x6be6('0x32')]:_0x1c3b8c[_0x6be6('0x2e')];_0x1f3635['order']=qs['sort'](_0x4b7947[_0x6be6('0x2f')][_0x6be6('0x37')]);_0x1f3635[_0x6be6('0x38')]=qs[_0x6be6('0x30')](_[_0x6be6('0x39')](_0x4b7947[_0x6be6('0x2f')],_0x1c3b8c['filters']));if(_0x4b7947[_0x6be6('0x2f')]['filter']){_0x1f3635['where']=_[_0x6be6('0x3a')](_0x1f3635[_0x6be6('0x38')],{'$or':_[_0x6be6('0x55')](_0x1f3635[_0x6be6('0x32')],function(_0x43d885){var _0x590c4d={};_0x590c4d[_0x43d885]={'$like':'%'+_0x4b7947['query'][_0x6be6('0x3b')]+'%'};return _0x590c4d;})});}_0x1f3635=_['merge']({},_0x1f3635,_0x4b7947[_0x6be6('0x3c')]);return _0x1eb81d['getContacts'](_0x1f3635);}})[_0x6be6('0x24')](function(_0x48ce47){if(_0x48ce47){_0x2c679b=_0x48ce47[_0x6be6('0x34')];if(!_0x4b7947[_0x6be6('0x2f')]['hasOwnProperty'](_0x6be6('0x56'))){_0x1f3635[_0x6be6('0x35')]=qs[_0x6be6('0x35')](_0x4b7947[_0x6be6('0x2f')][_0x6be6('0x35')]);_0x1f3635[_0x6be6('0x1b')]=qs['offset'](_0x4b7947[_0x6be6('0x2f')][_0x6be6('0x1b')]);}return _0x1eb81d[_0x6be6('0x57')](_0x1f3635);}})['then'](function(_0x1393bd){if(_0x1393bd){return _0x1393bd?{'count':_0x2c679b,'rows':_0x1393bd}:null;}})[_0x6be6('0x24')](respondWithResult(_0x9d8d17,null))[_0x6be6('0x41')](handleError(_0x9d8d17,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 3d45111..c60ba72 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 _0xfb7d=['cm_companies','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0x412faa,_0x6d5ea8){var _0x204402=function(_0x1ddbe0){while(--_0x1ddbe0){_0x412faa['push'](_0x412faa['shift']());}};_0x204402(++_0x6d5ea8);}(_0xfb7d,0xc5));var _0xdfb7=function(_0x886664,_0x4d7b96){_0x886664=_0x886664-0x0;var _0x273401=_0xfb7d[_0x886664];return _0x273401;};'use strict';var _=require(_0xdfb7('0x0'));var util=require(_0xdfb7('0x1'));var logger=require(_0xdfb7('0x2'))('api');var moment=require(_0xdfb7('0x3'));var BPromise=require(_0xdfb7('0x4'));var rp=require(_0xdfb7('0x5'));var fs=require('fs');var path=require(_0xdfb7('0x6'));var rimraf=require(_0xdfb7('0x7'));var config=require(_0xdfb7('0x8'));var attributes=require(_0xdfb7('0x9'));module[_0xdfb7('0xa')]=function(_0x16da99,_0x57308a){return _0x16da99[_0xdfb7('0xb')](_0xdfb7('0xc'),attributes,{'tableName':_0xdfb7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc491=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x507828,_0x35d012){var _0x4c78d8=function(_0x41f6b5){while(--_0x41f6b5){_0x507828['push'](_0x507828['shift']());}};_0x4c78d8(++_0x35d012);}(_0xc491,0x16c));var _0x1c49=function(_0x4d1ee9,_0x394a78){_0x4d1ee9=_0x4d1ee9-0x0;var _0x9a5456=_0xc491[_0x4d1ee9];return _0x9a5456;};'use strict';var _=require(_0x1c49('0x0'));var util=require(_0x1c49('0x1'));var logger=require(_0x1c49('0x2'))(_0x1c49('0x3'));var moment=require(_0x1c49('0x4'));var BPromise=require(_0x1c49('0x5'));var rp=require(_0x1c49('0x6'));var fs=require('fs');var path=require(_0x1c49('0x7'));var rimraf=require(_0x1c49('0x8'));var config=require(_0x1c49('0x9'));var attributes=require('./cmCompany.attributes');module['exports']=function(_0x82c344,_0x45131d){return _0x82c344[_0x1c49('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 113d764..0106fa9 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 _0xc6fb=['CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xc6fb,0x83));var _0xbc6f=function(_0x1c8cc6,_0x411e5c){_0x1c8cc6=_0x1c8cc6-0x0;var _0x522936=_0xc6fb[_0x1c8cc6];return _0x522936;};'use strict';var _=require(_0xbc6f('0x0'));var util=require(_0xbc6f('0x1'));var moment=require(_0xbc6f('0x2'));var BPromise=require(_0xbc6f('0x3'));var rs=require(_0xbc6f('0x4'));var fs=require('fs');var Redis=require(_0xbc6f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc6f('0x6'));var logger=require(_0xbc6f('0x7'))('rpc');var config=require(_0xbc6f('0x8'));var jayson=require(_0xbc6f('0x9'));var client=jayson[_0xbc6f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x466a69,_0x442fb1,_0x4d0afa){return new BPromise(function(_0x565f2d,_0x284cbb){return client[_0xbc6f('0xb')](_0x466a69,_0x4d0afa)[_0xbc6f('0xc')](function(_0x3fe04e){logger[_0xbc6f('0xd')](_0xbc6f('0xe'),_0x442fb1,_0xbc6f('0xf'));logger['debug'](_0xbc6f('0x10'),_0x442fb1,_0xbc6f('0xf'),JSON[_0xbc6f('0x11')](_0x3fe04e));if(_0x3fe04e[_0xbc6f('0x12')]){if(_0x3fe04e[_0xbc6f('0x12')][_0xbc6f('0x13')]===0x1f4){logger[_0xbc6f('0x12')](_0xbc6f('0xe'),_0x442fb1,_0x3fe04e[_0xbc6f('0x12')]['message']);return _0x284cbb(_0x3fe04e['error'][_0xbc6f('0x14')]);}logger[_0xbc6f('0x12')]('CmCompany,\x20%s,\x20%s',_0x442fb1,_0x3fe04e[_0xbc6f('0x12')]['message']);return _0x565f2d(_0x3fe04e[_0xbc6f('0x12')]['message']);}else{logger[_0xbc6f('0xd')](_0xbc6f('0xe'),_0x442fb1,_0xbc6f('0xf'));_0x565f2d(_0x3fe04e['result'][_0xbc6f('0x14')]);}})['catch'](function(_0x45dbc6){logger[_0xbc6f('0x12')](_0xbc6f('0xe'),_0x442fb1,_0x45dbc6);_0x284cbb(_0x45dbc6);});});} \ No newline at end of file +var _0xcf48=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','stringify','code','error','CmCompany,\x20%s,\x20%s','message','result','catch','util','moment','ioredis'];(function(_0x1116cd,_0x5e006f){var _0x18c4f2=function(_0x501d52){while(--_0x501d52){_0x1116cd['push'](_0x1116cd['shift']());}};_0x18c4f2(++_0x5e006f);}(_0xcf48,0x129));var _0x8cf4=function(_0x5243bd,_0x41ebca){_0x5243bd=_0x5243bd-0x0;var _0x204713=_0xcf48[_0x5243bd];return _0x204713;};'use strict';var _=require('lodash');var util=require(_0x8cf4('0x0'));var moment=require(_0x8cf4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8cf4('0x2'));var db=require(_0x8cf4('0x3'))['db'];var utils=require(_0x8cf4('0x4'));var logger=require(_0x8cf4('0x5'))('rpc');var config=require(_0x8cf4('0x6'));var jayson=require(_0x8cf4('0x7'));var client=jayson['client'][_0x8cf4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b60c7,_0x5e4f47,_0x250b25){return new BPromise(function(_0xc3eafa,_0x27106d){return client[_0x8cf4('0x9')](_0x5b60c7,_0x250b25)[_0x8cf4('0xa')](function(_0x11c07a){logger[_0x8cf4('0xb')]('CmCompany,\x20%s,\x20%s',_0x5e4f47,'request\x20sent');logger[_0x8cf4('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x5e4f47,'request\x20sent',JSON[_0x8cf4('0xd')](_0x11c07a));if(_0x11c07a['error']){if(_0x11c07a['error'][_0x8cf4('0xe')]===0x1f4){logger[_0x8cf4('0xf')](_0x8cf4('0x10'),_0x5e4f47,_0x11c07a[_0x8cf4('0xf')][_0x8cf4('0x11')]);return _0x27106d(_0x11c07a['error'][_0x8cf4('0x11')]);}logger['error'](_0x8cf4('0x10'),_0x5e4f47,_0x11c07a['error'][_0x8cf4('0x11')]);return _0xc3eafa(_0x11c07a[_0x8cf4('0xf')][_0x8cf4('0x11')]);}else{logger[_0x8cf4('0xb')](_0x8cf4('0x10'),_0x5e4f47,'request\x20sent');_0xc3eafa(_0x11c07a[_0x8cf4('0x12')][_0x8cf4('0x11')]);}})[_0x8cf4('0x13')](function(_0x3a39cb){logger['error']('CmCompany,\x20%s,\x20%s',_0x5e4f47,_0x3a39cb);_0x27106d(_0x3a39cb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 72053ec..1ea440d 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 _0x698e=['get','describe','/:id','isAuthenticated','show','/:id/contacts','getContacts','post','create','put','update','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x698e,0x14f));var _0xe698=function(_0x453310,_0x4dcff6){_0x453310=_0x453310-0x0;var _0x337eb4=_0x698e[_0x453310];return _0x337eb4;};'use strict';var multer=require('multer');var util=require(_0xe698('0x0'));var path=require('path');var timeout=require(_0xe698('0x1'));var express=require(_0xe698('0x2'));var router=express['Router']();var fs_extra=require(_0xe698('0x3'));var auth=require(_0xe698('0x4'));var interaction=require(_0xe698('0x5'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xe698('0x6')]);router[_0xe698('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe698('0x8')]);router[_0xe698('0x7')](_0xe698('0x9'),auth[_0xe698('0xa')](),controller[_0xe698('0xb')]);router[_0xe698('0x7')](_0xe698('0xc'),auth[_0xe698('0xa')](),controller[_0xe698('0xd')]);router[_0xe698('0xe')]('/',auth[_0xe698('0xa')](),controller[_0xe698('0xf')]);router[_0xe698('0xe')](_0xe698('0xc'),auth[_0xe698('0xa')](),controller['addContacts']);router[_0xe698('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe698('0x11')]);router['delete'](_0xe698('0x9'),auth[_0xe698('0xa')](),controller['destroy']);module[_0xe698('0x12')]=router; \ No newline at end of file +var _0x687c=['fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0xd1f7f6,_0x5439e1){var _0x570e46=function(_0x11625a){while(--_0x11625a){_0xd1f7f6['push'](_0xd1f7f6['shift']());}};_0x570e46(++_0x5439e1);}(_0x687c,0x8b));var _0xc687=function(_0x26eba5,_0x5dd3da){_0x26eba5=_0x26eba5-0x0;var _0x289734=_0x687c[_0x26eba5];return _0x289734;};'use strict';var multer=require(_0xc687('0x0'));var util=require(_0xc687('0x1'));var path=require(_0xc687('0x2'));var timeout=require(_0xc687('0x3'));var express=require('express');var router=express[_0xc687('0x4')]();var fs_extra=require(_0xc687('0x5'));var auth=require(_0xc687('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc687('0x7'));var controller=require(_0xc687('0x8'));router[_0xc687('0x9')]('/',auth[_0xc687('0xa')](),controller[_0xc687('0xb')]);router[_0xc687('0x9')](_0xc687('0xc'),auth[_0xc687('0xa')](),controller[_0xc687('0xd')]);router['get'](_0xc687('0xe'),auth['isAuthenticated'](),controller[_0xc687('0xf')]);router[_0xc687('0x9')](_0xc687('0x10'),auth[_0xc687('0xa')](),controller[_0xc687('0x11')]);router[_0xc687('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc687('0x12')](_0xc687('0x10'),auth['isAuthenticated'](),controller[_0xc687('0x13')]);router[_0xc687('0x14')](_0xc687('0xe'),auth[_0xc687('0xa')](),controller[_0xc687('0x15')]);router[_0xc687('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xc687('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 567d6c3..7fd0e72 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 _0x5802=['STRING','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x30899c,_0x4a08a9){var _0x1aa246=function(_0x177694){while(--_0x177694){_0x30899c['push'](_0x30899c['shift']());}};_0x1aa246(++_0x4a08a9);}(_0x5802,0x12a));var _0x2580=function(_0x5ad67c,_0x144860){_0x5ad67c=_0x5ad67c-0x0;var _0xccce2e=_0x5802[_0x5ad67c];return _0xccce2e;};'use strict';var _=require(_0x2580('0x0'));var Sequelize=require(_0x2580('0x1'));module[_0x2580('0x2')]={'firstName':{'type':Sequelize[_0x2580('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x2580('0x3')]},'postalCode':{'type':Sequelize[_0x2580('0x3')]},'city':{'type':Sequelize[_0x2580('0x3')]},'country':{'type':Sequelize[_0x2580('0x3')]},'dateOfBirth':{'type':Sequelize[_0x2580('0x3')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x2580('0x3')]},'mobile':{'type':Sequelize[_0x2580('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x2580('0x3')]},'url':{'type':Sequelize[_0x2580('0x3')]},'facebook':{'type':Sequelize[_0x2580('0x3')]},'fb_data':{'type':Sequelize[_0x2580('0x3')]},'twitter':{'type':Sequelize[_0x2580('0x3')]},'skype':{'type':Sequelize[_0x2580('0x3')]},'teams':{'type':Sequelize[_0x2580('0x3')]},'viber':{'type':Sequelize[_0x2580('0x3')]},'line':{'type':Sequelize[_0x2580('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x2580('0x3')]},'UserId':{'type':Sequelize[_0x2580('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x2580('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x2580('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x2580('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xaa6c=['STRING','INTEGER','DATE','sequelize'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0xaa6c,0x15f));var _0xcaa6=function(_0x14fad0,_0x278d75){_0x14fad0=_0x14fad0-0x0;var _0x5c665f=_0xaa6c[_0x14fad0];return _0x5c665f;};'use strict';var _=require('lodash');var Sequelize=require(_0xcaa6('0x0'));module['exports']={'firstName':{'type':Sequelize[_0xcaa6('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xcaa6('0x1')]},'country':{'type':Sequelize[_0xcaa6('0x1')]},'dateOfBirth':{'type':Sequelize[_0xcaa6('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xcaa6('0x1')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcaa6('0x1')]},'url':{'type':Sequelize[_0xcaa6('0x1')]},'facebook':{'type':Sequelize[_0xcaa6('0x1')]},'fb_data':{'type':Sequelize[_0xcaa6('0x1')]},'twitter':{'type':Sequelize[_0xcaa6('0x1')]},'skype':{'type':Sequelize[_0xcaa6('0x1')]},'teams':{'type':Sequelize[_0xcaa6('0x1')]},'viber':{'type':Sequelize[_0xcaa6('0x1')]},'line':{'type':Sequelize[_0xcaa6('0x1')]},'wechat':{'type':Sequelize[_0xcaa6('0x1')]},'telegram':{'type':Sequelize[_0xcaa6('0x1')]},'UserId':{'type':Sequelize[_0xcaa6('0x2')]},'AdditionalPhones':{'type':Sequelize[_0xcaa6('0x1')]},'priority':{'type':Sequelize[_0xcaa6('0x2')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xcaa6('0x3')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0xcaa6('0x1')]},'utcOffset':{'type':Sequelize[_0xcaa6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 8bc233d..1979507 100644 --- a/server/api/cmContact/cmContact.controller.js +++ b/server/api/cmContact/cmContact.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 682231a..928c892 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f8c=['CmContact','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4dc4f8,_0x2aa78a){var _0x3d1122=function(_0x20e0ce){while(--_0x20e0ce){_0x4dc4f8['push'](_0x4dc4f8['shift']());}};_0x3d1122(++_0x2aa78a);}(_0x4f8c,0x1b7));var _0xc4f8=function(_0x559320,_0xe481a2){_0x559320=_0x559320-0x0;var _0x3dabca=_0x4f8c[_0x559320];return _0x3dabca;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xc4f8('0x0'))['db'][_0xc4f8('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc4f8('0x2')](0x0);var events={'afterCreate':_0xc4f8('0x3'),'afterUpdate':_0xc4f8('0x4'),'afterDestroy':_0xc4f8('0x5')};function emitEvent(_0x42066a){return function(_0x468232,_0x53dbb4,_0x4c1ff7){CmContactEvents[_0xc4f8('0x6')](_0x42066a+':'+_0x468232['id'],_0x468232);CmContactEvents[_0xc4f8('0x6')](_0x42066a,_0x468232);_0x4c1ff7(null);};}for(var e in events){if(events[_0xc4f8('0x7')](e)){var event=events[e];CmContact[_0xc4f8('0x8')](e,emitEvent(event));}}module[_0xc4f8('0x9')]=CmContactEvents; \ No newline at end of file +var _0x1b02=['hasOwnProperty','hook','exports','events','../../mysqldb','CmContact','save','update','remove','emit'];(function(_0x24d69c,_0x3ac65b){var _0x662cd2=function(_0x2f1483){while(--_0x2f1483){_0x24d69c['push'](_0x24d69c['shift']());}};_0x662cd2(++_0x3ac65b);}(_0x1b02,0x111));var _0x21b0=function(_0x2fda4b,_0x27f574){_0x2fda4b=_0x2fda4b-0x0;var _0x14061e=_0x1b02[_0x2fda4b];return _0x14061e;};'use strict';var EventEmitter=require(_0x21b0('0x0'));var CmContact=require(_0x21b0('0x1'))['db'][_0x21b0('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x21b0('0x3'),'afterUpdate':_0x21b0('0x4'),'afterDestroy':_0x21b0('0x5')};function emitEvent(_0x3ad1fd){return function(_0x55be0f,_0x1b84de,_0x121cbb){CmContactEvents[_0x21b0('0x6')](_0x3ad1fd+':'+_0x55be0f['id'],_0x55be0f);CmContactEvents[_0x21b0('0x6')](_0x3ad1fd,_0x55be0f);_0x121cbb(null);};}for(var e in events){if(events[_0x21b0('0x7')](e)){var event=events[e];CmContact[_0x21b0('0x8')](e,emitEvent(event));}}module[_0x21b0('0x9')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index caf5418..95998f4 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd69=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','isEmpty','ContactId','VoiceQueueId','CampaignId','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment/shared','./cmContact.attributes','exports','define','CmContact','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','cmContact','afterCreate','scheduledat','format','isNil','findOne','then','dialTimezone','timezones','utcOffset','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','error','inspect','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'];(function(_0x56f6d3,_0x4ab677){var _0x4a262b=function(_0x1cfd13){while(--_0x1cfd13){_0x56f6d3['push'](_0x56f6d3['shift']());}};_0x4a262b(++_0x4ab677);}(_0xfd69,0xf7));var _0x9fd6=function(_0x535f35,_0x2414f6){_0x535f35=_0x535f35-0x0;var _0x24d37d=_0xfd69[_0x535f35];return _0x24d37d;};'use strict';var _=require(_0x9fd6('0x0'));var util=require(_0x9fd6('0x1'));var logger=require(_0x9fd6('0x2'))(_0x9fd6('0x3'));var moment=require(_0x9fd6('0x4'));var BPromise=require(_0x9fd6('0x5'));var rp=require(_0x9fd6('0x6'));var fs=require('fs');var path=require(_0x9fd6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var shared=require(_0x9fd6('0x8'));var attributes=require(_0x9fd6('0x9'));module[_0x9fd6('0xa')]=function(_0x9d3e13,_0x292be9){return _0x9d3e13[_0x9fd6('0xb')](_0x9fd6('0xc'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x9fd6('0xd'),'fields':[_0x9fd6('0xd')]},{'name':_0x9fd6('0xe'),'fields':[_0x9fd6('0xf'),_0x9fd6('0x10'),_0x9fd6('0xd'),_0x9fd6('0x11'),_0x9fd6('0x12'),_0x9fd6('0x13')],'type':_0x9fd6('0x14')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x9fd6('0x15'),'hooks':{'afterCreate':function(_0x57c11e,_0x5e17c8,_0x438cd0){var _0x4181df=_0x9d3e13[_0x9fd6('0x16')];var _0x558b8e=_0x57c11e[_0x9fd6('0x17')]({'plain':!![]});function _0xd34820(){return function(_0x4dd127){logger['error'](_0x9fd6('0x18'),_0x9fd6('0x19'),util['inspect'](_0x4dd127,{'showHidden':![],'depth':null}));};}function _0x286480(_0x264334,_0x57b41b){var _0x57376a=_0x57b41b[_0x9fd6('0x1a')]?_0x57b41b['scheduledat']:moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x28cd35,_0x5432cc){if(_[_0x9fd6('0x1c')](_0x57b41b['dialTimezone'])){_0x28cd35({'ret':_0x57376a});}else{_0x4181df['VoiceQueue'][_0x9fd6('0x1d')]({'where':{'id':_0x264334['id']}})[_0x9fd6('0x1e')](function(_0x3fbd0b){if(!_[_0x9fd6('0x1c')](_0x3fbd0b)){var _0x2f2186=_0x3fbd0b[_0x9fd6('0x1f')];if(!_['isNil'](_0x2f2186)){var _0x2ff086=shared[_0x9fd6('0x20')];var _0x490b04=_0x2ff086[_0x2f2186];var _0x230766=_0x2ff086[_0x57b41b[_0x9fd6('0x1f')]];if(!_['isNil'](_0x490b04)&&!_[_0x9fd6('0x1c')](_0x230766)){var _0x1169d5=_0x490b04[_0x9fd6('0x21')]-_0x230766[_0x9fd6('0x21')];_0x57376a=_0x57b41b[_0x9fd6('0x1a')]?_0x57b41b[_0x9fd6('0x1a')]:moment();var _0x71abbf=moment(_0x57376a)['add'](_0x1169d5,_0x9fd6('0x22'));_0x28cd35({'ret':_0x71abbf['format'](_0x9fd6('0x23'))});}else _0x28cd35({'ret':_0x57376a});}else _0x28cd35({'ret':_0x57376a});}else{_0x28cd35({'ret':_0x57376a});}});}});return 0xa;}var _0xd7b2cd=function(_0x461195){return new BPromise(function(_0x2afaff,_0x1fe17c){_0x286480(_0x461195,_0x558b8e)[_0x9fd6('0x1e')](function(_0x391b1b){_0x558b8e[_0x9fd6('0x1a')]=_0x391b1b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')]['findOne']({'where':{'phone':_0x558b8e['phone'],'VoiceQueueId':_0x461195['id']}})['then'](function(_0x54316c){if(!_[_0x9fd6('0x1c')](_0x54316c)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x27')+_0x461195['id']);}return _0x4181df[_0x9fd6('0x25')]['create']({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e['scheduledat']:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e['callbackUniqueid']?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e['callbackUniqueid']?moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x461195['id']});})[_0x9fd6('0x2b')](function(_0x56f9f4){_0x1fe17c(_0x56f9f4);});});});};var _0x45a331=function(_0x344b66){return new BPromise(function(_0x16ccd3,_0x4306c2){_0x286480(_0x344b66,_0x558b8e)[_0x9fd6('0x1e')](function(_0x455dc0){_0x558b8e[_0x9fd6('0x1a')]=_0x455dc0['ret'];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'VoiceQueueId':_0x344b66['id']}})[_0x9fd6('0x1e')](function(_0x1ba7e8){if(!_[_0x9fd6('0x1c')](_0x1ba7e8)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x2c')+_0x344b66['id']);}return _0x4181df[_0x9fd6('0x2d')][_0x9fd6('0x1d')]({'where':{'calleridnum':_0x558b8e[_0x9fd6('0xd')],'VoiceQueueId':_0x344b66['id']}});})[_0x9fd6('0x1e')](function(_0x2c8c21){if(!_[_0x9fd6('0x1c')](_0x2c8c21)){throw new Error(_0x9fd6('0x2e')+_0x558b8e[_0x9fd6('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x344b66['id']);}return _0x4181df['CmHopper']['create']({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'VoiceQueueId':_0x344b66['id']});})[_0x9fd6('0x2b')](function(_0x1a3240){_0x4306c2(_0x1a3240);});});});};function _0x25fba5(){return function(_0x20d19f){logger[_0x9fd6('0x2f')](_0x9fd6('0x18'),'afterCreate',util[_0x9fd6('0x30')](_0x20d19f,{'showHidden':![],'depth':null}));};}function _0x54d7aa(_0x4abb11,_0x344179){var _0xd8ca4d=_0x344179[_0x9fd6('0x1a')]?_0x344179[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x4afdf8,_0x31d9af){if(_[_0x9fd6('0x1c')](_0x344179[_0x9fd6('0x1f')])){_0x4afdf8({'ret':_0xd8ca4d});}else{_0x4181df['Campaign']['findOne']({'where':{'id':_0x4abb11['id']}})['then'](function(_0x8c50ce){if(!_[_0x9fd6('0x1c')](_0x8c50ce)){var _0x39fb53=_0x8c50ce[_0x9fd6('0x1f')];if(!_['isNil'](_0x39fb53)){var _0x22abde=shared[_0x9fd6('0x20')];var _0x3a22c8=_0x22abde[_0x39fb53];var _0x587380=_0x22abde[_0x344179['dialTimezone']];if(!_[_0x9fd6('0x1c')](_0x3a22c8)&&!_[_0x9fd6('0x1c')](_0x587380)){var _0xcf4807=_0x3a22c8[_0x9fd6('0x21')]-_0x587380[_0x9fd6('0x21')];_0xd8ca4d=_0x344179[_0x9fd6('0x1a')]?_0x344179[_0x9fd6('0x1a')]:moment();var _0x57ca0f=moment(_0xd8ca4d)[_0x9fd6('0x31')](_0xcf4807,_0x9fd6('0x22'));_0x4afdf8({'ret':_0x57ca0f[_0x9fd6('0x1b')](_0x9fd6('0x23'))});}else _0x4afdf8({'ret':_0xd8ca4d});}else _0x4afdf8({'ret':_0xd8ca4d});}else{_0x4afdf8({'ret':_0xd8ca4d});}});}});return 0xa;}var _0x44eba1=function(_0x3bde63){return new BPromise(function(_0x5dba34,_0x30c913){_0x54d7aa(_0x3bde63,_0x558b8e)['then'](function(_0x56533b){_0x558b8e[_0x9fd6('0x1a')]=_0x56533b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x3bde63['id']}})[_0x9fd6('0x1e')](function(_0xa12a95){if(!_['isNil'](_0xa12a95)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x32')+_0x3bde63['id']);}return _0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e['priority']?_0x558b8e['priority']:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()['format'](_0x9fd6('0x23')):undefined,'CampaignId':_0x3bde63['id']});})[_0x9fd6('0x2b')](function(_0x19c915){_0x30c913(_0x19c915);});});});};var _0x3212ed=function(_0x54fb11){return new BPromise(function(_0x261629,_0x509bb7){_0x54d7aa(_0x54fb11,_0x558b8e)['then'](function(_0x4b810b){_0x558b8e['scheduledat']=_0x4b810b[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x1d')]({'where':{'phone':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x54fb11['id']}})[_0x9fd6('0x1e')](function(_0x144222){if(!_[_0x9fd6('0x1c')](_0x144222)){throw new Error(_0x9fd6('0x26')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x34')+_0x54fb11['id']);}return _0x4181df[_0x9fd6('0x2d')]['findOne']({'where':{'calleridnum':_0x558b8e[_0x9fd6('0xd')],'CampaignId':_0x54fb11['id']}});})[_0x9fd6('0x1e')](function(_0x372bcf){if(!_[_0x9fd6('0x1c')](_0x372bcf)){throw new Error(_0x9fd6('0x2e')+_0x558b8e[_0x9fd6('0xd')]+_0x9fd6('0x35')+_0x54fb11['id']);}return _0x4181df['CmHopper'][_0x9fd6('0x33')]({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e['priority']:0x2,'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')),'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'CampaignId':_0x54fb11['id']});})[_0x9fd6('0x2b')](function(_0x2c25eb){_0x509bb7(_0x2c25eb);});});});};if(_0x558b8e[_0x9fd6('0x28')]){_0x4181df[_0x9fd6('0x36')]['findAll']({'where':{'type':_0x9fd6('0x37')},'attributes':['id',_0x9fd6('0x38'),'dialTimezone'],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3a'),'where':{'id':_0x558b8e['ListId']}}]})[_0x9fd6('0x1e')](function(_0x4e8d11){if(_0x4e8d11){var _0x423af0=[];for(var _0x392001=0x0,_0x384be7;_0x392001<_0x4e8d11['length'];_0x392001+=0x1){_0x384be7=_0x4e8d11[_0x392001]['get']({'plain':!![]});switch(_0x384be7[_0x9fd6('0x38')]){case _0x9fd6('0x3b'):_0x45a331(_0x384be7)[_0x9fd6('0x2b')](_0xd34820());break;case _0x9fd6('0x3c'):_0xd7b2cd(_0x384be7)[_0x9fd6('0x2b')](_0xd34820());break;default:_0x54d7aa(_0x384be7,_0x558b8e)[_0x9fd6('0x1e')](function(_0x178704){_0x558b8e[_0x9fd6('0x1a')]=_0x178704[_0x9fd6('0x24')];_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e[_0x9fd6('0x29')]:0x2,'callback':_0x558b8e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e['callbackUniqueid']?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'VoiceQueueId':_0x384be7['id']})[_0x9fd6('0x2b')](_0xd34820());});}}}})[_0x9fd6('0x1e')](function(){return _0x4181df[_0x9fd6('0x36')][_0x9fd6('0x3d')]({'where':{'type':_0x9fd6('0x37')},'attributes':['id'],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3e'),'where':{'id':_0x558b8e['ListId']}}]})[_0x9fd6('0x1e')](function(_0x322082){if(_0x322082){var _0x2a8d93=[];for(var _0xc76890=0x0,_0x23424f;_0xc76890<_0x322082[_0x9fd6('0x3f')];_0xc76890+=0x1){_0x23424f=_0x322082[_0xc76890][_0x9fd6('0x17')]({'plain':!![]});_0x4181df[_0x9fd6('0x40')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e['ListId'],'VoiceQueueId':_0x23424f['id']})['catch'](function(_0x12baaf){logger[_0x9fd6('0x2f')](_0x9fd6('0x41'),'afterCreate',_0x12baaf[_0x9fd6('0x42')]);});}}});})['then'](function(){return _0x4181df[_0x9fd6('0x43')][_0x9fd6('0x3d')]({'attributes':['id',_0x9fd6('0x38'),_0x9fd6('0x1f')],'include':[{'model':_0x4181df[_0x9fd6('0x39')],'as':_0x9fd6('0x3a'),'where':{'id':_0x558b8e[_0x9fd6('0x28')]}}]})[_0x9fd6('0x1e')](function(_0x31267a){if(_0x31267a){var _0xee5675=[];for(var _0x2a2e73=0x0,_0x5c640f;_0x2a2e73<_0x31267a[_0x9fd6('0x3f')];_0x2a2e73+=0x1){_0x5c640f=_0x31267a[_0x2a2e73][_0x9fd6('0x17')]({'plain':!![]});switch(_0x5c640f[_0x9fd6('0x38')]){case _0x9fd6('0x3b'):_0x3212ed(_0x5c640f)[_0x9fd6('0x2b')](_0x25fba5());break;case _0x9fd6('0x3c'):_0x44eba1(_0x5c640f)[_0x9fd6('0x2b')](_0x25fba5());break;default:_0x4181df[_0x9fd6('0x25')][_0x9fd6('0x33')]({'phone':_0x558b8e[_0x9fd6('0xd')],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'scheduledat':_0x558b8e[_0x9fd6('0x1a')]?_0x558b8e[_0x9fd6('0x1a')]:moment()['format'](_0x9fd6('0x23')),'priority':_0x558b8e[_0x9fd6('0x29')]?_0x558b8e['priority']:0x2,'callback':_0x558b8e[_0x9fd6('0x2a')]?!![]:![],'callbackuniqueid':_0x558b8e[_0x9fd6('0x2a')]?_0x558b8e[_0x9fd6('0x2a')]:undefined,'callbackat':_0x558b8e[_0x9fd6('0x2a')]?moment()[_0x9fd6('0x1b')](_0x9fd6('0x23')):undefined,'CampaignId':_0x5c640f['id']})['catch'](_0x25fba5());}}}});})['then'](function(){return _0x4181df[_0x9fd6('0x43')][_0x9fd6('0x3d')]({'attributes':['id'],'include':[{'model':_0x4181df['CmList'],'as':_0x9fd6('0x3e'),'where':{'id':_0x558b8e[_0x9fd6('0x28')]}}]})['then'](function(_0x298271){if(_0x298271){var _0x501985=[];for(var _0x1da416=0x0,_0x2a1164;_0x1da416<_0x298271[_0x9fd6('0x3f')];_0x1da416+=0x1){_0x2a1164=_0x298271[_0x1da416]['get']({'plain':!![]});_0x4181df[_0x9fd6('0x40')]['create']({'phone':_0x558b8e['phone'],'ContactId':_0x558b8e['id'],'ListId':_0x558b8e[_0x9fd6('0x28')],'CampaignId':_0x2a1164['id']})['catch'](function(_0x4cdb94){logger['error'](_0x9fd6('0x41'),'afterCreate',_0x4cdb94[_0x9fd6('0x42')]);});}}});})[_0x9fd6('0x1e')](function(){_0x438cd0();})['catch'](function(_0x46a9e1){logger[_0x9fd6('0x2f')]('cmContact,\x20%s,\x20%s',_0x9fd6('0x19'),_0x46a9e1[_0x9fd6('0x42')]);_0x438cd0(_0x46a9e1);});}else{_0x438cd0(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x42d436,_0x2dae87,_0x263e14){var _0x1956de=_0x9d3e13['models'];var _0x5e6ddf=_0x42d436[_0x9fd6('0x17')]({'plain':!![]});return _0x1956de['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x5e6ddf['ListId'],'ContactId':_0x5e6ddf['id']}})[_0x9fd6('0x1e')](function(_0x342da3){if(!_[_0x9fd6('0x44')](_0x342da3)){var _0x4bf9a4=[];for(var _0x58dc14=0x0;_0x58dc14<_0x342da3['length'];_0x58dc14+=0x1){var _0x4582ae=_0x1956de[_0x9fd6('0x25')]['destroy']({'where':{'ListId':_0x342da3[_0x58dc14][_0x9fd6('0x28')],'ContactId':_0x342da3[_0x58dc14][_0x9fd6('0x45')],'VoiceQueueId':_0x342da3[_0x58dc14][_0x9fd6('0x46')],'CampaignId':_0x342da3[_0x58dc14][_0x9fd6('0x47')]}});_0x4bf9a4['push'](_0x4582ae);}return BPromise['all'](_0x4bf9a4);}})[_0x9fd6('0x1e')](function(_0x4dbdea){logger[_0x9fd6('0x48')](_0x9fd6('0x49'),util[_0x9fd6('0x30')](_0x4dbdea,{'showHidden':![],'depth':null}));_0x263e14();})['catch'](function(_0x1a2c80){logger[_0x9fd6('0x2f')](_0x9fd6('0x4a'),util['inspect'](_0x1a2c80,{'showHidden':![],'depth':null}));_0x263e14(_0x1a2c80);});}}});}; \ No newline at end of file +var _0x5514=['minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','create','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','length','get','always','onlyIfOpen','findAll','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','Lists','message','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','add'];(function(_0x16b994,_0x22872a){var _0xfc3e0f=function(_0x32d1d8){while(--_0x32d1d8){_0x16b994['push'](_0x16b994['shift']());}};_0xfc3e0f(++_0x22872a);}(_0x5514,0x15a));var _0x4551=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x5514[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x4551('0x0'));var util=require(_0x4551('0x1'));var logger=require(_0x4551('0x2'))(_0x4551('0x3'));var moment=require(_0x4551('0x4'));var BPromise=require(_0x4551('0x5'));var rp=require(_0x4551('0x6'));var fs=require('fs');var path=require(_0x4551('0x7'));var rimraf=require(_0x4551('0x8'));var config=require(_0x4551('0x9'));var shared=require(_0x4551('0xa'));var attributes=require(_0x4551('0xb'));module[_0x4551('0xc')]=function(_0xc43919,_0x3a93dd){return _0xc43919['define'](_0x4551('0xd'),attributes,{'tableName':_0x4551('0xe'),'paranoid':!![],'indexes':[{'name':_0x4551('0xf'),'fields':[_0x4551('0xf')]},{'name':_0x4551('0x10'),'fields':[_0x4551('0x11'),_0x4551('0x12'),_0x4551('0xf'),'mobile',_0x4551('0x13'),'email'],'type':_0x4551('0x14')}],'timestamps':!![],'charset':_0x4551('0x15'),'collate':_0x4551('0x16'),'hooks':{'afterCreate':function(_0x1d1c3e,_0x54977c,_0x3b27e1){var _0x171f45=_0xc43919[_0x4551('0x17')];var _0x219b8c=_0x1d1c3e['get']({'plain':!![]});function _0xc61646(){return function(_0x47e2b9){logger[_0x4551('0x18')](_0x4551('0x19'),_0x4551('0x1a'),util[_0x4551('0x1b')](_0x47e2b9,{'showHidden':![],'depth':null}));};}function _0x1708f9(_0x18faa6,_0x153eca){var _0x31a6d2=_0x153eca['scheduledat']?_0x153eca[_0x4551('0x1c')]:moment()[_0x4551('0x1d')](_0x4551('0x1e'));return new BPromise(function(_0x562693,_0x1be67c){if(_[_0x4551('0x1f')](_0x153eca[_0x4551('0x20')])){_0x562693({'ret':_0x31a6d2});}else{_0x171f45[_0x4551('0x21')][_0x4551('0x22')]({'where':{'id':_0x18faa6['id']}})[_0x4551('0x23')](function(_0x4e5d4f){if(!_[_0x4551('0x1f')](_0x4e5d4f)){var _0x28f4f6=_0x4e5d4f[_0x4551('0x20')];if(!_['isNil'](_0x28f4f6)){var _0x4ef850=shared[_0x4551('0x24')];var _0x519587=_0x4ef850[_0x28f4f6];var _0x3952e1=_0x4ef850[_0x153eca['dialTimezone']];if(!_[_0x4551('0x1f')](_0x519587)&&!_[_0x4551('0x1f')](_0x3952e1)){var _0x8ff58a=_0x519587[_0x4551('0x25')]-_0x3952e1['utcOffset'];_0x31a6d2=_0x153eca['scheduledat']?_0x153eca[_0x4551('0x1c')]:moment();var _0x37eca3=moment(_0x31a6d2)[_0x4551('0x26')](_0x8ff58a,_0x4551('0x27'));_0x562693({'ret':_0x37eca3[_0x4551('0x1d')](_0x4551('0x1e'))});}else _0x562693({'ret':_0x31a6d2});}else _0x562693({'ret':_0x31a6d2});}else{_0x562693({'ret':_0x31a6d2});}});}});return 0xa;}var _0xdd173c=function(_0x3a23c9){return new BPromise(function(_0x10df77,_0x168e36){_0x1708f9(_0x3a23c9,_0x219b8c)[_0x4551('0x23')](function(_0x3be05f){_0x219b8c['scheduledat']=_0x3be05f[_0x4551('0x28')];_0x171f45[_0x4551('0x29')][_0x4551('0x22')]({'where':{'phone':_0x219b8c[_0x4551('0xf')],'VoiceQueueId':_0x3a23c9['id']}})[_0x4551('0x23')](function(_0x53eaff){if(!_[_0x4551('0x1f')](_0x53eaff)){throw new Error('cmContact,\x20afterCreate\x20'+_0x219b8c[_0x4551('0xf')]+_0x4551('0x2a')+_0x3a23c9['id']);}return _0x171f45[_0x4551('0x29')]['create']({'phone':_0x219b8c[_0x4551('0xf')],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'priority':_0x219b8c[_0x4551('0x2c')]?_0x219b8c[_0x4551('0x2c')]:0x2,'scheduledat':_0x219b8c[_0x4551('0x1c')]?_0x219b8c['scheduledat']:moment()[_0x4551('0x1d')](_0x4551('0x1e')),'callback':_0x219b8c[_0x4551('0x2d')]?!![]:![],'callbackuniqueid':_0x219b8c['callbackUniqueid']?_0x219b8c[_0x4551('0x2d')]:undefined,'callbackat':_0x219b8c['callbackUniqueid']?moment()[_0x4551('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x3a23c9['id']});})[_0x4551('0x2e')](function(_0x251f64){_0x168e36(_0x251f64);});});});};var _0x4156e2=function(_0x45bc32){return new BPromise(function(_0x52c277,_0x39c53b){_0x1708f9(_0x45bc32,_0x219b8c)[_0x4551('0x23')](function(_0x9041af){_0x219b8c[_0x4551('0x1c')]=_0x9041af[_0x4551('0x28')];_0x171f45['CmHopper'][_0x4551('0x22')]({'where':{'phone':_0x219b8c[_0x4551('0xf')],'VoiceQueueId':_0x45bc32['id']}})['then'](function(_0x4827b5){if(!_[_0x4551('0x1f')](_0x4827b5)){throw new Error(_0x4551('0x2f')+_0x219b8c[_0x4551('0xf')]+_0x4551('0x30')+_0x45bc32['id']);}return _0x171f45[_0x4551('0x31')][_0x4551('0x22')]({'where':{'calleridnum':_0x219b8c[_0x4551('0xf')],'VoiceQueueId':_0x45bc32['id']}});})[_0x4551('0x23')](function(_0x21b38d){if(!_[_0x4551('0x1f')](_0x21b38d)){throw new Error(_0x4551('0x32')+_0x219b8c[_0x4551('0xf')]+_0x4551('0x33')+_0x45bc32['id']);}return _0x171f45['CmHopper'][_0x4551('0x34')]({'phone':_0x219b8c['phone'],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'priority':_0x219b8c['priority']?_0x219b8c[_0x4551('0x2c')]:0x2,'scheduledat':_0x219b8c[_0x4551('0x1c')]?_0x219b8c[_0x4551('0x1c')]:moment()['format'](_0x4551('0x1e')),'callback':_0x219b8c[_0x4551('0x2d')]?!![]:![],'callbackuniqueid':_0x219b8c[_0x4551('0x2d')]?_0x219b8c[_0x4551('0x2d')]:undefined,'callbackat':_0x219b8c[_0x4551('0x2d')]?moment()[_0x4551('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x45bc32['id']});})[_0x4551('0x2e')](function(_0x1ffc72){_0x39c53b(_0x1ffc72);});});});};function _0x4a3c27(){return function(_0x506cdc){logger['error'](_0x4551('0x19'),'afterCreate',util[_0x4551('0x1b')](_0x506cdc,{'showHidden':![],'depth':null}));};}function _0xa029d9(_0x1d3f10,_0x1d03df){var _0x1e4fee=_0x1d03df[_0x4551('0x1c')]?_0x1d03df[_0x4551('0x1c')]:moment()[_0x4551('0x1d')](_0x4551('0x1e'));return new BPromise(function(_0x370e20,_0x4612b1){if(_[_0x4551('0x1f')](_0x1d03df[_0x4551('0x20')])){_0x370e20({'ret':_0x1e4fee});}else{_0x171f45[_0x4551('0x35')]['findOne']({'where':{'id':_0x1d3f10['id']}})[_0x4551('0x23')](function(_0x304147){if(!_[_0x4551('0x1f')](_0x304147)){var _0x2def99=_0x304147['dialTimezone'];if(!_[_0x4551('0x1f')](_0x2def99)){var _0x3e9a54=shared[_0x4551('0x24')];var _0x3d2ad9=_0x3e9a54[_0x2def99];var _0x17b1d1=_0x3e9a54[_0x1d03df[_0x4551('0x20')]];if(!_[_0x4551('0x1f')](_0x3d2ad9)&&!_['isNil'](_0x17b1d1)){var _0x3c69e4=_0x3d2ad9['utcOffset']-_0x17b1d1[_0x4551('0x25')];_0x1e4fee=_0x1d03df['scheduledat']?_0x1d03df[_0x4551('0x1c')]:moment();var _0x418111=moment(_0x1e4fee)[_0x4551('0x26')](_0x3c69e4,_0x4551('0x27'));_0x370e20({'ret':_0x418111[_0x4551('0x1d')](_0x4551('0x1e'))});}else _0x370e20({'ret':_0x1e4fee});}else _0x370e20({'ret':_0x1e4fee});}else{_0x370e20({'ret':_0x1e4fee});}});}});return 0xa;}var _0xcf4768=function(_0x5b6418){return new BPromise(function(_0x181c41,_0x5a03da){_0xa029d9(_0x5b6418,_0x219b8c)[_0x4551('0x23')](function(_0xa726d2){_0x219b8c[_0x4551('0x1c')]=_0xa726d2['ret'];_0x171f45[_0x4551('0x29')][_0x4551('0x22')]({'where':{'phone':_0x219b8c[_0x4551('0xf')],'CampaignId':_0x5b6418['id']}})[_0x4551('0x23')](function(_0x33a723){if(!_[_0x4551('0x1f')](_0x33a723)){throw new Error(_0x4551('0x2f')+_0x219b8c[_0x4551('0xf')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x5b6418['id']);}return _0x171f45['CmHopper'][_0x4551('0x34')]({'phone':_0x219b8c[_0x4551('0xf')],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'priority':_0x219b8c['priority']?_0x219b8c[_0x4551('0x2c')]:0x2,'scheduledat':_0x219b8c[_0x4551('0x1c')]?_0x219b8c[_0x4551('0x1c')]:moment()[_0x4551('0x1d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x219b8c['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x219b8c['callbackUniqueid']?_0x219b8c['callbackUniqueid']:undefined,'callbackat':_0x219b8c[_0x4551('0x2d')]?moment()[_0x4551('0x1d')](_0x4551('0x1e')):undefined,'CampaignId':_0x5b6418['id']});})[_0x4551('0x2e')](function(_0x23f91b){_0x5a03da(_0x23f91b);});});});};var _0x50342c=function(_0x5ab1ca){return new BPromise(function(_0x59e592,_0x25cdc7){_0xa029d9(_0x5ab1ca,_0x219b8c)[_0x4551('0x23')](function(_0x4b57be){_0x219b8c[_0x4551('0x1c')]=_0x4b57be[_0x4551('0x28')];_0x171f45['CmHopper'][_0x4551('0x22')]({'where':{'phone':_0x219b8c[_0x4551('0xf')],'CampaignId':_0x5ab1ca['id']}})[_0x4551('0x23')](function(_0x32911d){if(!_[_0x4551('0x1f')](_0x32911d)){throw new Error(_0x4551('0x2f')+_0x219b8c['phone']+_0x4551('0x36')+_0x5ab1ca['id']);}return _0x171f45[_0x4551('0x31')][_0x4551('0x22')]({'where':{'calleridnum':_0x219b8c[_0x4551('0xf')],'CampaignId':_0x5ab1ca['id']}});})[_0x4551('0x23')](function(_0xa47776){if(!_[_0x4551('0x1f')](_0xa47776)){throw new Error(_0x4551('0x32')+_0x219b8c[_0x4551('0xf')]+_0x4551('0x37')+_0x5ab1ca['id']);}return _0x171f45[_0x4551('0x29')][_0x4551('0x34')]({'phone':_0x219b8c[_0x4551('0xf')],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'priority':_0x219b8c['priority']?_0x219b8c[_0x4551('0x2c')]:0x2,'scheduledat':_0x219b8c['scheduledat']?_0x219b8c[_0x4551('0x1c')]:moment()['format'](_0x4551('0x1e')),'callback':_0x219b8c[_0x4551('0x2d')]?!![]:![],'callbackuniqueid':_0x219b8c['callbackUniqueid']?_0x219b8c[_0x4551('0x2d')]:undefined,'callbackat':_0x219b8c[_0x4551('0x2d')]?moment()['format'](_0x4551('0x1e')):undefined,'CampaignId':_0x5ab1ca['id']});})[_0x4551('0x2e')](function(_0xd279d6){_0x25cdc7(_0xd279d6);});});});};if(_0x219b8c[_0x4551('0x2b')]){_0x171f45[_0x4551('0x21')]['findAll']({'where':{'type':_0x4551('0x38')},'attributes':['id',_0x4551('0x39'),_0x4551('0x20')],'include':[{'model':_0x171f45['CmList'],'as':'Lists','where':{'id':_0x219b8c[_0x4551('0x2b')]}}]})[_0x4551('0x23')](function(_0x458ab7){if(_0x458ab7){var _0x1d088c=[];for(var _0x36e38f=0x0,_0x230732;_0x36e38f<_0x458ab7[_0x4551('0x3a')];_0x36e38f+=0x1){_0x230732=_0x458ab7[_0x36e38f][_0x4551('0x3b')]({'plain':!![]});switch(_0x230732[_0x4551('0x39')]){case _0x4551('0x3c'):_0x4156e2(_0x230732)[_0x4551('0x2e')](_0xc61646());break;case _0x4551('0x3d'):_0xdd173c(_0x230732)[_0x4551('0x2e')](_0xc61646());break;default:_0xa029d9(_0x230732,_0x219b8c)[_0x4551('0x23')](function(_0x2b373b){_0x219b8c[_0x4551('0x1c')]=_0x2b373b['ret'];_0x171f45[_0x4551('0x29')]['create']({'phone':_0x219b8c[_0x4551('0xf')],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'scheduledat':_0x219b8c[_0x4551('0x1c')]?_0x219b8c['scheduledat']:moment()[_0x4551('0x1d')](_0x4551('0x1e')),'priority':_0x219b8c[_0x4551('0x2c')]?_0x219b8c[_0x4551('0x2c')]:0x2,'callback':_0x219b8c[_0x4551('0x2d')]?!![]:![],'callbackuniqueid':_0x219b8c[_0x4551('0x2d')]?_0x219b8c['callbackUniqueid']:undefined,'callbackat':_0x219b8c[_0x4551('0x2d')]?moment()[_0x4551('0x1d')](_0x4551('0x1e')):undefined,'VoiceQueueId':_0x230732['id']})['catch'](_0xc61646());});}}}})[_0x4551('0x23')](function(){return _0x171f45[_0x4551('0x21')][_0x4551('0x3e')]({'where':{'type':_0x4551('0x38')},'attributes':['id'],'include':[{'model':_0x171f45[_0x4551('0x3f')],'as':_0x4551('0x40'),'where':{'id':_0x219b8c['ListId']}}]})['then'](function(_0x198a04){if(_0x198a04){var _0x33e401=[];for(var _0xc114bd=0x0,_0x21bd75;_0xc114bd<_0x198a04[_0x4551('0x3a')];_0xc114bd+=0x1){_0x21bd75=_0x198a04[_0xc114bd]['get']({'plain':!![]});_0x171f45[_0x4551('0x41')][_0x4551('0x34')]({'phone':_0x219b8c[_0x4551('0xf')],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'VoiceQueueId':_0x21bd75['id']})[_0x4551('0x2e')](function(_0x3965b2){logger[_0x4551('0x18')](_0x4551('0x42'),_0x4551('0x1a'),_0x3965b2['message']);});}}});})[_0x4551('0x23')](function(){return _0x171f45['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType',_0x4551('0x20')],'include':[{'model':_0x171f45[_0x4551('0x3f')],'as':_0x4551('0x43'),'where':{'id':_0x219b8c[_0x4551('0x2b')]}}]})[_0x4551('0x23')](function(_0x266240){if(_0x266240){var _0x4022d2=[];for(var _0x479736=0x0,_0x599a75;_0x479736<_0x266240[_0x4551('0x3a')];_0x479736+=0x1){_0x599a75=_0x266240[_0x479736][_0x4551('0x3b')]({'plain':!![]});switch(_0x599a75[_0x4551('0x39')]){case'always':_0x50342c(_0x599a75)[_0x4551('0x2e')](_0x4a3c27());break;case'onlyIfOpen':_0xcf4768(_0x599a75)[_0x4551('0x2e')](_0x4a3c27());break;default:_0x171f45[_0x4551('0x29')][_0x4551('0x34')]({'phone':_0x219b8c['phone'],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'scheduledat':_0x219b8c[_0x4551('0x1c')]?_0x219b8c[_0x4551('0x1c')]:moment()['format'](_0x4551('0x1e')),'priority':_0x219b8c[_0x4551('0x2c')]?_0x219b8c[_0x4551('0x2c')]:0x2,'callback':_0x219b8c[_0x4551('0x2d')]?!![]:![],'callbackuniqueid':_0x219b8c[_0x4551('0x2d')]?_0x219b8c[_0x4551('0x2d')]:undefined,'callbackat':_0x219b8c['callbackUniqueid']?moment()[_0x4551('0x1d')](_0x4551('0x1e')):undefined,'CampaignId':_0x599a75['id']})[_0x4551('0x2e')](_0x4a3c27());}}}});})[_0x4551('0x23')](function(){return _0x171f45[_0x4551('0x35')]['findAll']({'attributes':['id'],'include':[{'model':_0x171f45[_0x4551('0x3f')],'as':_0x4551('0x40'),'where':{'id':_0x219b8c[_0x4551('0x2b')]}}]})[_0x4551('0x23')](function(_0x4eff04){if(_0x4eff04){var _0x4d307a=[];for(var _0x242361=0x0,_0x4fee6c;_0x242361<_0x4eff04[_0x4551('0x3a')];_0x242361+=0x1){_0x4fee6c=_0x4eff04[_0x242361][_0x4551('0x3b')]({'plain':!![]});_0x171f45[_0x4551('0x41')]['create']({'phone':_0x219b8c['phone'],'ContactId':_0x219b8c['id'],'ListId':_0x219b8c[_0x4551('0x2b')],'CampaignId':_0x4fee6c['id']})['catch'](function(_0x4323f0){logger['error'](_0x4551('0x42'),_0x4551('0x1a'),_0x4323f0['message']);});}}});})[_0x4551('0x23')](function(){_0x3b27e1();})['catch'](function(_0x393599){logger[_0x4551('0x18')]('cmContact,\x20%s,\x20%s',_0x4551('0x1a'),_0x393599[_0x4551('0x44')]);_0x3b27e1(_0x393599);});}else{_0x3b27e1(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x5d9fc3,_0x4d6d25,_0x33d638){var _0x5a16a0=_0xc43919['models'];var _0x3a736c=_0x5d9fc3[_0x4551('0x3b')]({'plain':!![]});return _0x5a16a0[_0x4551('0x29')][_0x4551('0x3e')]({'raw':!![],'where':{'ListId':_0x3a736c[_0x4551('0x2b')],'ContactId':_0x3a736c['id']}})['then'](function(_0x5de043){if(!_[_0x4551('0x45')](_0x5de043)){var _0x519220=[];for(var _0x4e2427=0x0;_0x4e2427<_0x5de043[_0x4551('0x3a')];_0x4e2427+=0x1){var _0x2f9175=_0x5a16a0['CmHopper'][_0x4551('0x46')]({'where':{'ListId':_0x5de043[_0x4e2427][_0x4551('0x2b')],'ContactId':_0x5de043[_0x4e2427][_0x4551('0x47')],'VoiceQueueId':_0x5de043[_0x4e2427][_0x4551('0x48')],'CampaignId':_0x5de043[_0x4e2427][_0x4551('0x49')]}});_0x519220['push'](_0x2f9175);}return BPromise[_0x4551('0x4a')](_0x519220);}})[_0x4551('0x23')](function(_0x1ede96){logger['info'](_0x4551('0x4b'),util[_0x4551('0x1b')](_0x1ede96,{'showHidden':![],'depth':null}));_0x33d638();})[_0x4551('0x2e')](function(_0xcb9d1a){logger[_0x4551('0x18')](_0x4551('0x4c'),util[_0x4551('0x1b')](_0xcb9d1a,{'showHidden':![],'depth':null}));_0x33d638(_0xcb9d1a);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 02a35ea..b18a922 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3445e4,_0x3b09e3){var _0x5d0edf=function(_0x3d674b){while(--_0x3d674b){_0x3445e4['push'](_0x3445e4['shift']());}};_0x5d0edf(++_0x3b09e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 7bc2912..bb86650 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03ce=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x1a7ba3,_0x347c46){var _0x2f69a5=function(_0x4ebd23){while(--_0x4ebd23){_0x1a7ba3['push'](_0x1a7ba3['shift']());}};_0x2f69a5(++_0x347c46);}(_0x03ce,0x1a1));var _0xe03c=function(_0x1ab95e,_0x30a6e4){_0x1ab95e=_0x1ab95e-0x0;var _0x1dfdec=_0x03ce[_0x1ab95e];return _0x1dfdec;};'use strict';var Sequelize=require(_0xe03c('0x0'));module[_0xe03c('0x1')]={'CmContactId':{'type':Sequelize[_0xe03c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xe03c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xe03c('0x3')],'defaultValue':_0xe03c('0x4')},'OrderBy':{'type':Sequelize[_0xe03c('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xc5ba=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x16e444,_0x6aece9){var _0x4393e1=function(_0x40b179){while(--_0x40b179){_0x16e444['push'](_0x16e444['shift']());}};_0x4393e1(++_0x6aece9);}(_0xc5ba,0xb9));var _0xac5b=function(_0x5534ce,_0x26ef5e){_0x5534ce=_0x5534ce-0x0;var _0x33042b=_0xc5ba[_0x5534ce];return _0x33042b;};'use strict';var Sequelize=require(_0xac5b('0x0'));module[_0xac5b('0x1')]={'CmContactId':{'type':Sequelize[_0xac5b('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xac5b('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xac5b('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xac5b('0x3')],'defaultValue':_0xac5b('0x4')},'OrderBy':{'type':Sequelize[_0xac5b('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xac5b('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 1d5cbff..a86ef3b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac00=['../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','CmContactHasItems','UserProfileResource','sendStatus','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/environment'];(function(_0x21a34a,_0x565906){var _0x1d00dd=function(_0x3ae86a){while(--_0x3ae86a){_0x21a34a['push'](_0x21a34a['shift']());}};_0x1d00dd(++_0x565906);}(_0xac00,0x93));var _0x0ac0=function(_0x2f89c0,_0x455702){_0x2f89c0=_0x2f89c0-0x0;var _0x164223=_0xac00[_0x2f89c0];return _0x164223;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ac0('0x0'));var zipdir=require(_0x0ac0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ac0('0x2'));var moment=require(_0x0ac0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0ac0('0x4'));var util=require(_0x0ac0('0x5'));var path=require(_0x0ac0('0x6'));var sox=require(_0x0ac0('0x7'));var csv=require(_0x0ac0('0x8'));var ejs=require(_0x0ac0('0x9'));var fs=require('fs');var fs_extra=require(_0x0ac0('0xa'));var _=require(_0x0ac0('0xb'));var squel=require(_0x0ac0('0xc'));var crypto=require(_0x0ac0('0xd'));var jsforce=require(_0x0ac0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0ac0('0x8'));var querystring=require(_0x0ac0('0xf'));var Papa=require(_0x0ac0('0x10'));var Redis=require('ioredis');var authService=require(_0x0ac0('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ac0('0x12'))(_0x0ac0('0x13'));var utils=require('../../config/utils');var config=require(_0x0ac0('0x14'));var licenseUtil=require(_0x0ac0('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a5310,_0x45e020){_0x45e020=_0x45e020||0xcc;return function(_0x13fc09){if(_0x13fc09){return _0x5a5310['sendStatus'](_0x45e020);}return _0x5a5310[_0x0ac0('0x16')](_0x45e020)[_0x0ac0('0x17')]();};}function respondWithResult(_0x4ab570,_0x577f6e){_0x577f6e=_0x577f6e||0xc8;return function(_0x201d55){if(_0x201d55){return _0x4ab570[_0x0ac0('0x16')](_0x577f6e)[_0x0ac0('0x18')](_0x201d55);}};}function respondWithFilteredResult(_0x313b13,_0x49ea67){return function(_0x1a158f){if(_0x1a158f){var _0x1bdbca=typeof _0x49ea67[_0x0ac0('0x19')]===_0x0ac0('0x1a')&&typeof _0x49ea67['limit']==='undefined';var _0x1d7ac4=_0x1a158f[_0x0ac0('0x1b')];var _0x702615=_0x1bdbca?0x0:_0x49ea67['offset'];var _0x17902b=_0x1bdbca?_0x1a158f[_0x0ac0('0x1b')]:_0x49ea67[_0x0ac0('0x19')]+_0x49ea67[_0x0ac0('0x1c')];var _0x4baca6;if(_0x17902b>=_0x1d7ac4){_0x17902b=_0x1d7ac4;_0x4baca6=0xc8;}else{_0x4baca6=0xce;}_0x313b13[_0x0ac0('0x16')](_0x4baca6);return _0x313b13[_0x0ac0('0x1d')](_0x0ac0('0x1e'),_0x702615+'-'+_0x17902b+'/'+_0x1d7ac4)[_0x0ac0('0x18')](_0x1a158f);}return null;};}function patchUpdates(_0xaf1aa){return function(_0x30fbab){try{jsonpatch[_0x0ac0('0x1f')](_0x30fbab,_0xaf1aa,!![]);}catch(_0x46d6ed){return BPromise[_0x0ac0('0x20')](_0x46d6ed);}return _0x30fbab[_0x0ac0('0x21')]();};}function saveUpdates(_0x413f21,_0x139423){return function(_0x3ce5e8){if(_0x3ce5e8){return _0x3ce5e8['update'](_0x413f21)['then'](function(_0x366719){return _0x366719;});}return null;};}function removeEntity(_0x5d006f,_0x42c8f2){return function(_0x694b87){if(_0x694b87){return _0x694b87[_0x0ac0('0x22')]()[_0x0ac0('0x23')](function(){var _0x170c5e=_0x694b87['get']({'plain':!![]});var _0x49e252=_0x0ac0('0x24');return db[_0x0ac0('0x25')]['destroy']({'where':{'type':_0x49e252,'resourceId':_0x170c5e['id']}})[_0x0ac0('0x23')](function(){return _0x694b87;});})['then'](function(){_0x5d006f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bdf03,_0x520acb){return function(_0x18a41a){if(!_0x18a41a){_0x1bdf03[_0x0ac0('0x26')](0x194);}return _0x18a41a;};}function handleError(_0x1472c1,_0x3427b7){_0x3427b7=_0x3427b7||0x1f4;return function(_0x5f2c6b){logger['error'](_0x5f2c6b[_0x0ac0('0x27')]);if(_0x5f2c6b[_0x0ac0('0x28')]){delete _0x5f2c6b['name'];}_0x1472c1[_0x0ac0('0x16')](_0x3427b7)[_0x0ac0('0x29')](_0x5f2c6b);};}exports[_0x0ac0('0x2a')]=function(_0x1ad823,_0x1f4659){var _0x2cbfc9={},_0x135dd6={},_0x5cee05={'count':0x0,'rows':[]};var _0x212dec=_[_0x0ac0('0x2b')](db[_0x0ac0('0x2c')][_0x0ac0('0x2d')],function(_0x5a5a07){return{'name':_0x5a5a07[_0x0ac0('0x2e')],'type':_0x5a5a07['type'][_0x0ac0('0x2f')]};});_0x135dd6[_0x0ac0('0x30')]=_['map'](_0x212dec,'name');_0x135dd6[_0x0ac0('0x31')]=_['keys'](_0x1ad823[_0x0ac0('0x31')]);_0x135dd6[_0x0ac0('0x32')]=_['intersection'](_0x135dd6[_0x0ac0('0x30')],_0x135dd6[_0x0ac0('0x31')]);_0x2cbfc9['attributes']=_[_0x0ac0('0x33')](_0x135dd6[_0x0ac0('0x30')],qs[_0x0ac0('0x34')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x34')]));_0x2cbfc9['attributes']=_0x2cbfc9[_0x0ac0('0x35')][_0x0ac0('0x36')]?_0x2cbfc9[_0x0ac0('0x35')]:_0x135dd6[_0x0ac0('0x30')];if(!_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x37')](_0x0ac0('0x38'))){_0x2cbfc9[_0x0ac0('0x1c')]=qs['limit'](_0x1ad823['query'][_0x0ac0('0x1c')]);_0x2cbfc9['offset']=qs[_0x0ac0('0x19')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x19')]);}_0x2cbfc9[_0x0ac0('0x39')]=qs[_0x0ac0('0x3a')](_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3a')]);_0x2cbfc9[_0x0ac0('0x3b')]=qs[_0x0ac0('0x32')](_[_0x0ac0('0x3c')](_0x1ad823[_0x0ac0('0x31')],_0x135dd6[_0x0ac0('0x32')]),_0x212dec);if(_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3d')]){_0x2cbfc9[_0x0ac0('0x3b')]=_[_0x0ac0('0x3e')](_0x2cbfc9[_0x0ac0('0x3b')],{'$or':_[_0x0ac0('0x2b')](_0x212dec,function(_0x37af33){if(_0x37af33[_0x0ac0('0x3f')]!=='VIRTUAL'){var _0x54267a={};_0x54267a[_0x37af33[_0x0ac0('0x28')]]={'$like':'%'+_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x3d')]+'%'};return _0x54267a;}})});}_0x2cbfc9=_[_0x0ac0('0x3e')]({},_0x2cbfc9,_0x1ad823[_0x0ac0('0x40')]);var _0x112bb9={'where':_0x2cbfc9[_0x0ac0('0x3b')]};return db[_0x0ac0('0x2c')][_0x0ac0('0x1b')](_0x112bb9)[_0x0ac0('0x23')](function(_0x2222cb){_0x5cee05['count']=_0x2222cb;if(_0x1ad823[_0x0ac0('0x31')][_0x0ac0('0x41')]){_0x2cbfc9[_0x0ac0('0x42')]=[{'all':!![]}];}return db[_0x0ac0('0x2c')][_0x0ac0('0x43')](_0x2cbfc9);})['then'](function(_0x3c98a0){_0x5cee05[_0x0ac0('0x44')]=_0x3c98a0;return _0x5cee05;})[_0x0ac0('0x23')](respondWithFilteredResult(_0x1f4659,_0x2cbfc9))[_0x0ac0('0x45')](handleError(_0x1f4659,null));};exports['show']=function(_0x2717b6,_0x53a262){var _0x4c0e7b={'raw':!![],'where':{'id':_0x2717b6[_0x0ac0('0x46')]['id']}},_0x597a3c={};_0x597a3c[_0x0ac0('0x30')]=_[_0x0ac0('0x47')](db[_0x0ac0('0x2c')][_0x0ac0('0x2d')]);_0x597a3c[_0x0ac0('0x31')]=_[_0x0ac0('0x47')](_0x2717b6[_0x0ac0('0x31')]);_0x597a3c[_0x0ac0('0x32')]=_[_0x0ac0('0x33')](_0x597a3c['model'],_0x597a3c[_0x0ac0('0x31')]);_0x4c0e7b['attributes']=_['intersection'](_0x597a3c[_0x0ac0('0x30')],qs['fields'](_0x2717b6[_0x0ac0('0x31')]['fields']));_0x4c0e7b[_0x0ac0('0x35')]=_0x4c0e7b[_0x0ac0('0x35')][_0x0ac0('0x36')]?_0x4c0e7b[_0x0ac0('0x35')]:_0x597a3c[_0x0ac0('0x30')];if(_0x2717b6[_0x0ac0('0x31')][_0x0ac0('0x41')]){_0x4c0e7b[_0x0ac0('0x42')]=[{'all':!![]}];}_0x4c0e7b=_[_0x0ac0('0x3e')]({},_0x4c0e7b,_0x2717b6[_0x0ac0('0x40')]);return db[_0x0ac0('0x2c')][_0x0ac0('0x48')](_0x4c0e7b)[_0x0ac0('0x23')](handleEntityNotFound(_0x53a262,null))[_0x0ac0('0x23')](respondWithResult(_0x53a262,null))['catch'](handleError(_0x53a262,null));};exports['create']=function(_0x3341c5,_0x1f2bda){return db[_0x0ac0('0x2c')][_0x0ac0('0x49')](_0x3341c5[_0x0ac0('0x4a')],{})[_0x0ac0('0x23')](function(_0x3b6215){var _0x1e3153=_0x3341c5[_0x0ac0('0x4b')][_0x0ac0('0x4c')]({'plain':!![]});if(!_0x1e3153)throw new Error(_0x0ac0('0x4d'));if(_0x1e3153[_0x0ac0('0x4e')]==='user'){var _0x242cc5=_0x3b6215['get']({'plain':!![]});var _0x27a262=_0x0ac0('0x24');return db[_0x0ac0('0x4f')][_0x0ac0('0x48')]({'where':{'name':_0x27a262,'userProfileId':_0x1e3153[_0x0ac0('0x50')]},'raw':!![]})[_0x0ac0('0x23')](function(_0x1ebbcc){if(_0x1ebbcc&&_0x1ebbcc[_0x0ac0('0x51')]===0x0){return db[_0x0ac0('0x25')][_0x0ac0('0x49')]({'name':_0x242cc5[_0x0ac0('0x28')],'resourceId':_0x242cc5['id'],'type':_0x1ebbcc[_0x0ac0('0x28')],'sectionId':_0x1ebbcc['id']},{})[_0x0ac0('0x23')](function(){return _0x3b6215;});}else{return _0x3b6215;}})[_0x0ac0('0x45')](function(_0x36c7b4){logger['error'](_0x0ac0('0x52'),_0x36c7b4);throw _0x36c7b4;});}return _0x3b6215;})['then'](respondWithResult(_0x1f2bda,0xc9))[_0x0ac0('0x45')](handleError(_0x1f2bda,null));};exports[_0x0ac0('0x53')]=function(_0x228b89,_0x14a379){if(_0x228b89['body']['id']){delete _0x228b89['body']['id'];}return db[_0x0ac0('0x2c')][_0x0ac0('0x48')]({'where':{'id':_0x228b89[_0x0ac0('0x46')]['id']}})[_0x0ac0('0x23')](handleEntityNotFound(_0x14a379,null))[_0x0ac0('0x23')](saveUpdates(_0x228b89['body'],null))[_0x0ac0('0x23')](respondWithResult(_0x14a379,null))['catch'](handleError(_0x14a379,null));};exports[_0x0ac0('0x22')]=function(_0x226c2c,_0x55e8ad){return db[_0x0ac0('0x2c')][_0x0ac0('0x48')]({'where':{'id':_0x226c2c[_0x0ac0('0x46')]['id']}})['then'](handleEntityNotFound(_0x55e8ad,null))[_0x0ac0('0x23')](removeEntity(_0x55e8ad,null))['catch'](handleError(_0x55e8ad,null));}; \ No newline at end of file +var _0x6b9f=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','sort','where','pick','map','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','fields','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x6b9f,0xa7));var _0xf6b9=function(_0x5dabcc,_0x25fbcc){_0x5dabcc=_0x5dabcc-0x0;var _0x1ae9bd=_0x6b9f[_0x5dabcc];return _0x1ae9bd;};'use strict';var emlformat=require(_0xf6b9('0x0'));var rimraf=require(_0xf6b9('0x1'));var zipdir=require(_0xf6b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf6b9('0x3'));var moment=require(_0xf6b9('0x4'));var BPromise=require(_0xf6b9('0x5'));var Mustache=require(_0xf6b9('0x6'));var util=require(_0xf6b9('0x7'));var path=require(_0xf6b9('0x8'));var sox=require(_0xf6b9('0x9'));var csv=require(_0xf6b9('0xa'));var ejs=require(_0xf6b9('0xb'));var fs=require('fs');var fs_extra=require(_0xf6b9('0xc'));var _=require(_0xf6b9('0xd'));var squel=require(_0xf6b9('0xe'));var crypto=require('crypto');var jsforce=require(_0xf6b9('0xf'));var deskjs=require(_0xf6b9('0x10'));var toCsv=require(_0xf6b9('0xa'));var querystring=require(_0xf6b9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf6b9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf6b9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6b9('0x14'));var logger=require(_0xf6b9('0x15'))(_0xf6b9('0x16'));var utils=require(_0xf6b9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf6b9('0x18'));var db=require(_0xf6b9('0x19'))['db'];function respondWithStatusCode(_0x5907ab,_0x1932c7){_0x1932c7=_0x1932c7||0xcc;return function(_0x3cfd7a){if(_0x3cfd7a){return _0x5907ab[_0xf6b9('0x1a')](_0x1932c7);}return _0x5907ab[_0xf6b9('0x1b')](_0x1932c7)[_0xf6b9('0x1c')]();};}function respondWithResult(_0x4ebe2b,_0x5e67fa){_0x5e67fa=_0x5e67fa||0xc8;return function(_0x5e67c0){if(_0x5e67c0){return _0x4ebe2b[_0xf6b9('0x1b')](_0x5e67fa)[_0xf6b9('0x1d')](_0x5e67c0);}};}function respondWithFilteredResult(_0x53caf2,_0x3f3c53){return function(_0x138cf6){if(_0x138cf6){var _0x445390=typeof _0x3f3c53[_0xf6b9('0x1e')]===_0xf6b9('0x1f')&&typeof _0x3f3c53[_0xf6b9('0x20')]===_0xf6b9('0x1f');var _0x4a812c=_0x138cf6[_0xf6b9('0x21')];var _0x27fe2a=_0x445390?0x0:_0x3f3c53['offset'];var _0x37cbfe=_0x445390?_0x138cf6['count']:_0x3f3c53[_0xf6b9('0x1e')]+_0x3f3c53['limit'];var _0x3575bd;if(_0x37cbfe>=_0x4a812c){_0x37cbfe=_0x4a812c;_0x3575bd=0xc8;}else{_0x3575bd=0xce;}_0x53caf2[_0xf6b9('0x1b')](_0x3575bd);return _0x53caf2[_0xf6b9('0x22')](_0xf6b9('0x23'),_0x27fe2a+'-'+_0x37cbfe+'/'+_0x4a812c)[_0xf6b9('0x1d')](_0x138cf6);}return null;};}function patchUpdates(_0x1fe63e){return function(_0x4a4979){try{jsonpatch[_0xf6b9('0x24')](_0x4a4979,_0x1fe63e,!![]);}catch(_0x45b7eb){return BPromise[_0xf6b9('0x25')](_0x45b7eb);}return _0x4a4979[_0xf6b9('0x26')]();};}function saveUpdates(_0x29db87,_0x53929c){return function(_0x512b66){if(_0x512b66){return _0x512b66[_0xf6b9('0x27')](_0x29db87)['then'](function(_0x51ef3e){return _0x51ef3e;});}return null;};}function removeEntity(_0x46da55,_0x181d91){return function(_0x396fcc){if(_0x396fcc){return _0x396fcc[_0xf6b9('0x28')]()[_0xf6b9('0x29')](function(){var _0x5f2562=_0x396fcc[_0xf6b9('0x2a')]({'plain':!![]});var _0x45486e=_0xf6b9('0x2b');return db[_0xf6b9('0x2c')][_0xf6b9('0x28')]({'where':{'type':_0x45486e,'resourceId':_0x5f2562['id']}})[_0xf6b9('0x29')](function(){return _0x396fcc;});})[_0xf6b9('0x29')](function(){_0x46da55[_0xf6b9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5a6e,_0x354fce){return function(_0x56210c){if(!_0x56210c){_0x2a5a6e['sendStatus'](0x194);}return _0x56210c;};}function handleError(_0x2d3aca,_0x4e0691){_0x4e0691=_0x4e0691||0x1f4;return function(_0x48456f){logger[_0xf6b9('0x2d')](_0x48456f[_0xf6b9('0x2e')]);if(_0x48456f[_0xf6b9('0x2f')]){delete _0x48456f[_0xf6b9('0x2f')];}_0x2d3aca['status'](_0x4e0691)[_0xf6b9('0x30')](_0x48456f);};}exports[_0xf6b9('0x31')]=function(_0x1d6025,_0x276200){var _0x123291={},_0x36d3c5={},_0x5d33fc={'count':0x0,'rows':[]};var _0x5bf382=_['map'](db[_0xf6b9('0x32')][_0xf6b9('0x33')],function(_0xf10561){return{'name':_0xf10561[_0xf6b9('0x34')],'type':_0xf10561[_0xf6b9('0x35')][_0xf6b9('0x36')]};});_0x36d3c5[_0xf6b9('0x37')]=_['map'](_0x5bf382,'name');_0x36d3c5[_0xf6b9('0x38')]=_[_0xf6b9('0x39')](_0x1d6025[_0xf6b9('0x38')]);_0x36d3c5[_0xf6b9('0x3a')]=_[_0xf6b9('0x3b')](_0x36d3c5['model'],_0x36d3c5[_0xf6b9('0x38')]);_0x123291[_0xf6b9('0x3c')]=_[_0xf6b9('0x3b')](_0x36d3c5['model'],qs['fields'](_0x1d6025[_0xf6b9('0x38')]['fields']));_0x123291['attributes']=_0x123291[_0xf6b9('0x3c')]['length']?_0x123291[_0xf6b9('0x3c')]:_0x36d3c5['model'];if(!_0x1d6025['query'][_0xf6b9('0x3d')]('nolimit')){_0x123291['limit']=qs['limit'](_0x1d6025[_0xf6b9('0x38')][_0xf6b9('0x20')]);_0x123291[_0xf6b9('0x1e')]=qs[_0xf6b9('0x1e')](_0x1d6025['query']['offset']);}_0x123291['order']=qs[_0xf6b9('0x3e')](_0x1d6025[_0xf6b9('0x38')][_0xf6b9('0x3e')]);_0x123291[_0xf6b9('0x3f')]=qs[_0xf6b9('0x3a')](_[_0xf6b9('0x40')](_0x1d6025[_0xf6b9('0x38')],_0x36d3c5[_0xf6b9('0x3a')]),_0x5bf382);if(_0x1d6025[_0xf6b9('0x38')]['filter']){_0x123291['where']=_['merge'](_0x123291[_0xf6b9('0x3f')],{'$or':_[_0xf6b9('0x41')](_0x5bf382,function(_0x1727e4){if(_0x1727e4[_0xf6b9('0x35')]!==_0xf6b9('0x42')){var _0x109ada={};_0x109ada[_0x1727e4[_0xf6b9('0x2f')]]={'$like':'%'+_0x1d6025[_0xf6b9('0x38')][_0xf6b9('0x43')]+'%'};return _0x109ada;}})});}_0x123291=_[_0xf6b9('0x44')]({},_0x123291,_0x1d6025[_0xf6b9('0x45')]);var _0x1182a0={'where':_0x123291[_0xf6b9('0x3f')]};return db[_0xf6b9('0x32')][_0xf6b9('0x21')](_0x1182a0)[_0xf6b9('0x29')](function(_0x247bbb){_0x5d33fc[_0xf6b9('0x21')]=_0x247bbb;if(_0x1d6025[_0xf6b9('0x38')]['includeAll']){_0x123291[_0xf6b9('0x46')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xf6b9('0x47')](_0x123291);})[_0xf6b9('0x29')](function(_0x5aad04){_0x5d33fc[_0xf6b9('0x48')]=_0x5aad04;return _0x5d33fc;})[_0xf6b9('0x29')](respondWithFilteredResult(_0x276200,_0x123291))[_0xf6b9('0x49')](handleError(_0x276200,null));};exports[_0xf6b9('0x4a')]=function(_0x1bac6d,_0x4565eb){var _0x1a52d5={'raw':!![],'where':{'id':_0x1bac6d[_0xf6b9('0x4b')]['id']}},_0x4f40af={};_0x4f40af[_0xf6b9('0x37')]=_[_0xf6b9('0x39')](db[_0xf6b9('0x32')][_0xf6b9('0x33')]);_0x4f40af[_0xf6b9('0x38')]=_[_0xf6b9('0x39')](_0x1bac6d[_0xf6b9('0x38')]);_0x4f40af[_0xf6b9('0x3a')]=_[_0xf6b9('0x3b')](_0x4f40af[_0xf6b9('0x37')],_0x4f40af[_0xf6b9('0x38')]);_0x1a52d5[_0xf6b9('0x3c')]=_['intersection'](_0x4f40af['model'],qs[_0xf6b9('0x4c')](_0x1bac6d[_0xf6b9('0x38')][_0xf6b9('0x4c')]));_0x1a52d5[_0xf6b9('0x3c')]=_0x1a52d5[_0xf6b9('0x3c')][_0xf6b9('0x4d')]?_0x1a52d5[_0xf6b9('0x3c')]:_0x4f40af[_0xf6b9('0x37')];if(_0x1bac6d[_0xf6b9('0x38')]['includeAll']){_0x1a52d5[_0xf6b9('0x46')]=[{'all':!![]}];}_0x1a52d5=_[_0xf6b9('0x44')]({},_0x1a52d5,_0x1bac6d[_0xf6b9('0x45')]);return db[_0xf6b9('0x32')][_0xf6b9('0x4e')](_0x1a52d5)['then'](handleEntityNotFound(_0x4565eb,null))[_0xf6b9('0x29')](respondWithResult(_0x4565eb,null))['catch'](handleError(_0x4565eb,null));};exports[_0xf6b9('0x4f')]=function(_0x3f210f,_0x4d06eb){return db[_0xf6b9('0x32')][_0xf6b9('0x4f')](_0x3f210f[_0xf6b9('0x50')],{})[_0xf6b9('0x29')](function(_0x2042a9){var _0x4e1ae4=_0x3f210f[_0xf6b9('0x51')][_0xf6b9('0x2a')]({'plain':!![]});if(!_0x4e1ae4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e1ae4[_0xf6b9('0x52')]===_0xf6b9('0x51')){var _0x115a75=_0x2042a9[_0xf6b9('0x2a')]({'plain':!![]});var _0x599194=_0xf6b9('0x2b');return db[_0xf6b9('0x53')][_0xf6b9('0x4e')]({'where':{'name':_0x599194,'userProfileId':_0x4e1ae4[_0xf6b9('0x54')]},'raw':!![]})[_0xf6b9('0x29')](function(_0x1bb15b){if(_0x1bb15b&&_0x1bb15b[_0xf6b9('0x55')]===0x0){return db[_0xf6b9('0x2c')][_0xf6b9('0x4f')]({'name':_0x115a75[_0xf6b9('0x2f')],'resourceId':_0x115a75['id'],'type':_0x1bb15b['name'],'sectionId':_0x1bb15b['id']},{})['then'](function(){return _0x2042a9;});}else{return _0x2042a9;}})[_0xf6b9('0x49')](function(_0x4c9284){logger[_0xf6b9('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c9284);throw _0x4c9284;});}return _0x2042a9;})['then'](respondWithResult(_0x4d06eb,0xc9))['catch'](handleError(_0x4d06eb,null));};exports['update']=function(_0x32c761,_0x290d4b){if(_0x32c761[_0xf6b9('0x50')]['id']){delete _0x32c761['body']['id'];}return db[_0xf6b9('0x32')][_0xf6b9('0x4e')]({'where':{'id':_0x32c761[_0xf6b9('0x4b')]['id']}})[_0xf6b9('0x29')](handleEntityNotFound(_0x290d4b,null))[_0xf6b9('0x29')](saveUpdates(_0x32c761[_0xf6b9('0x50')],null))[_0xf6b9('0x29')](respondWithResult(_0x290d4b,null))[_0xf6b9('0x49')](handleError(_0x290d4b,null));};exports[_0xf6b9('0x28')]=function(_0x2e0032,_0x3cb64f){return db[_0xf6b9('0x32')][_0xf6b9('0x4e')]({'where':{'id':_0x2e0032[_0xf6b9('0x4b')]['id']}})[_0xf6b9('0x29')](handleEntityNotFound(_0x3cb64f,null))[_0xf6b9('0x29')](removeEntity(_0x3cb64f,null))[_0xf6b9('0x49')](handleError(_0x3cb64f,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 2e1f06e..901a5c0 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6fd3=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0x6fd3,0x1ee));var _0x36fd=function(_0x5e87ec,_0x20ed69){_0x5e87ec=_0x5e87ec-0x0;var _0x3c3207=_0x6fd3[_0x5e87ec];return _0x3c3207;};'use strict';var _=require(_0x36fd('0x0'));var util=require(_0x36fd('0x1'));var logger=require(_0x36fd('0x2'))(_0x36fd('0x3'));var moment=require(_0x36fd('0x4'));var BPromise=require('bluebird');var rp=require(_0x36fd('0x5'));var fs=require('fs');var path=require(_0x36fd('0x6'));var rimraf=require('rimraf');var config=require(_0x36fd('0x7'));var attributes=require(_0x36fd('0x8'));module[_0x36fd('0x9')]=function(_0x868060,_0x235bc9){return _0x868060[_0x36fd('0xa')](_0x36fd('0xb'),attributes,{'tableName':_0x36fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76bf=['request-promise','rimraf','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x45fd6c,_0x5b5ea0){var _0x2ea1d7=function(_0x10eb62){while(--_0x10eb62){_0x45fd6c['push'](_0x45fd6c['shift']());}};_0x2ea1d7(++_0x5b5ea0);}(_0x76bf,0x96));var _0xf76b=function(_0x1d29f5,_0x4a4bc6){_0x1d29f5=_0x1d29f5-0x0;var _0x1a17c6=_0x76bf[_0x1d29f5];return _0x1a17c6;};'use strict';var _=require(_0xf76b('0x0'));var util=require(_0xf76b('0x1'));var logger=require(_0xf76b('0x2'))(_0xf76b('0x3'));var moment=require(_0xf76b('0x4'));var BPromise=require(_0xf76b('0x5'));var rp=require(_0xf76b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf76b('0x7'));var config=require('../../config/environment');var attributes=require(_0xf76b('0x8'));module[_0xf76b('0x9')]=function(_0x55e124,_0x3c9969){return _0x55e124[_0xf76b('0xa')](_0xf76b('0xb'),attributes,{'tableName':_0xf76b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 81d71db..b820528 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x348f=['ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x257c0e,_0x4631da){var _0x393c16=function(_0x5239b9){while(--_0x5239b9){_0x257c0e['push'](_0x257c0e['shift']());}};_0x393c16(++_0x4631da);}(_0x348f,0xf9));var _0xf348=function(_0x1cf9ce,_0x17ba64){_0x1cf9ce=_0x1cf9ce-0x0;var _0x66738e=_0x348f[_0x1cf9ce];return _0x66738e;};'use strict';var _=require(_0xf348('0x0'));var util=require(_0xf348('0x1'));var moment=require('moment');var BPromise=require(_0xf348('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf348('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf348('0x4'));var logger=require('../../config/logger')(_0xf348('0x5'));var config=require(_0xf348('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf348('0x7')][_0xf348('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57fbe7,_0x18451e,_0x45d938){return new BPromise(function(_0x3bab9d,_0x47f3e0){return client[_0xf348('0x9')](_0x57fbe7,_0x45d938)[_0xf348('0xa')](function(_0x3cdc9f){logger[_0xf348('0xb')](_0xf348('0xc'),_0x18451e,_0xf348('0xd'));logger[_0xf348('0xe')](_0xf348('0xf'),_0x18451e,_0xf348('0xd'),JSON[_0xf348('0x10')](_0x3cdc9f));if(_0x3cdc9f[_0xf348('0x11')]){if(_0x3cdc9f['error'][_0xf348('0x12')]===0x1f4){logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x3cdc9f[_0xf348('0x11')]['message']);return _0x47f3e0(_0x3cdc9f[_0xf348('0x11')][_0xf348('0x13')]);}logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x3cdc9f[_0xf348('0x11')][_0xf348('0x13')]);return _0x3bab9d(_0x3cdc9f['error'][_0xf348('0x13')]);}else{logger[_0xf348('0xb')](_0xf348('0xc'),_0x18451e,_0xf348('0xd'));_0x3bab9d(_0x3cdc9f['result']['message']);}})[_0xf348('0x14')](function(_0x2c64f1){logger[_0xf348('0x11')]('CmContactHasItem,\x20%s,\x20%s',_0x18451e,_0x2c64f1);_0x47f3e0(_0x2c64f1);});});} \ No newline at end of file +var _0x0b6d=['../../config/environment','jayson/promise','client','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x1d964a,_0x1373ea){var _0x30938e=function(_0x5c7549){while(--_0x5c7549){_0x1d964a['push'](_0x1d964a['shift']());}};_0x30938e(++_0x1373ea);}(_0x0b6d,0xd3));var _0xd0b6=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x0b6d[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xd0b6('0x0'));var util=require(_0xd0b6('0x1'));var moment=require('moment');var BPromise=require(_0xd0b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0b6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0b6('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0b6('0x5'));var jayson=require(_0xd0b6('0x6'));var client=jayson[_0xd0b6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2098c4,_0x162cc5,_0xaac12e){return new BPromise(function(_0x3b7bd0,_0x8958ce){return client[_0xd0b6('0x8')](_0x2098c4,_0xaac12e)['then'](function(_0x578c56){logger[_0xd0b6('0x9')](_0xd0b6('0xa'),_0x162cc5,_0xd0b6('0xb'));logger[_0xd0b6('0xc')](_0xd0b6('0xd'),_0x162cc5,_0xd0b6('0xb'),JSON['stringify'](_0x578c56));if(_0x578c56['error']){if(_0x578c56[_0xd0b6('0xe')][_0xd0b6('0xf')]===0x1f4){logger[_0xd0b6('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x162cc5,_0x578c56['error'][_0xd0b6('0x10')]);return _0x8958ce(_0x578c56['error']['message']);}logger[_0xd0b6('0xe')](_0xd0b6('0xa'),_0x162cc5,_0x578c56[_0xd0b6('0xe')][_0xd0b6('0x10')]);return _0x3b7bd0(_0x578c56[_0xd0b6('0xe')][_0xd0b6('0x10')]);}else{logger[_0xd0b6('0x9')](_0xd0b6('0xa'),_0x162cc5,'request\x20sent');_0x3b7bd0(_0x578c56['result']['message']);}})[_0xd0b6('0x11')](function(_0x1110d6){logger[_0xd0b6('0xe')](_0xd0b6('0xa'),_0x162cc5,_0x1110d6);_0x8958ce(_0x1110d6);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 9002c40..b383e5d 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d2b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x31d339,_0x53302b){var _0x348e21=function(_0x39acf6){while(--_0x39acf6){_0x31d339['push'](_0x31d339['shift']());}};_0x348e21(++_0x53302b);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x8d2b[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0xb8d2('0x0'));var util=require(_0xb8d2('0x1'));var path=require(_0xb8d2('0x2'));var timeout=require('connect-timeout');var express=require(_0xb8d2('0x3'));var router=express[_0xb8d2('0x4')]();var fs_extra=require(_0xb8d2('0x5'));var auth=require(_0xb8d2('0x6'));var interaction=require(_0xb8d2('0x7'));var config=require(_0xb8d2('0x8'));var controller=require('./cmContactHasItem.controller');router[_0xb8d2('0x9')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xb')]);router[_0xb8d2('0x9')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller['show']);router[_0xb8d2('0xd')]('/',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0xe')]);router[_0xb8d2('0xf')](_0xb8d2('0xc'),auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x10')]);router[_0xb8d2('0x11')]('/:id',auth[_0xb8d2('0xa')](),controller[_0xb8d2('0x12')]);module[_0xb8d2('0x13')]=router; \ No newline at end of file +var _0x6942=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','isAuthenticated','index','/:id','show','post','update','destroy','exports','multer'];(function(_0x448f50,_0x5587ba){var _0x2af4c3=function(_0x5f2616){while(--_0x5f2616){_0x448f50['push'](_0x448f50['shift']());}};_0x2af4c3(++_0x5587ba);}(_0x6942,0x11f));var _0x2694=function(_0x3808f8,_0x3dee89){_0x3808f8=_0x3808f8-0x0;var _0x33479c=_0x6942[_0x3808f8];return _0x33479c;};'use strict';var multer=require(_0x2694('0x0'));var util=require(_0x2694('0x1'));var path=require(_0x2694('0x2'));var timeout=require(_0x2694('0x3'));var express=require(_0x2694('0x4'));var router=express[_0x2694('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2694('0x6'));var interaction=require(_0x2694('0x7'));var config=require(_0x2694('0x8'));var controller=require(_0x2694('0x9'));router['get']('/',auth[_0x2694('0xa')](),controller[_0x2694('0xb')]);router['get'](_0x2694('0xc'),auth[_0x2694('0xa')](),controller[_0x2694('0xd')]);router[_0x2694('0xe')]('/',auth[_0x2694('0xa')](),controller['create']);router['put'](_0x2694('0xc'),auth[_0x2694('0xa')](),controller[_0x2694('0xf')]);router['delete'](_0x2694('0xc'),auth['isAuthenticated'](),controller[_0x2694('0x10')]);module[_0x2694('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 0c610e8..b509972 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 _0x0e61=['VIRTUAL','getDataValue','alias','STRING','name','long','type','select','parse','values','setDataValue','BOOLEAN','ENUM','sequelize','lodash','exports'];(function(_0x4fecf3,_0x17fdb0){var _0x50161f=function(_0x49b2ad){while(--_0x49b2ad){_0x4fecf3['push'](_0x4fecf3['shift']());}};_0x50161f(++_0x17fdb0);}(_0x0e61,0x19d));var _0x10e6=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x0e61[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require(_0x10e6('0x0'));var _=require(_0x10e6('0x1'));module[_0x10e6('0x2')]={'name':{'type':Sequelize[_0x10e6('0x3')],'get':function(_0x88f983){return this[_0x10e6('0x4')](_0x10e6('0x5'));}},'alias':{'type':Sequelize[_0x10e6('0x6')],'allowNull':![],'set':function(_0x507f38){this['setDataValue'](_0x10e6('0x5'),_0x507f38?_0x507f38:this[_0x10e6('0x4')](_0x10e6('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x10e6('0x8')),'get':function(){if(this[_0x10e6('0x4')](_0x10e6('0x9'))===_0x10e6('0xa')){return JSON[_0x10e6('0xb')](this['getDataValue'](_0x10e6('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0x132a9b){if(Array['isArray'](_0x132a9b)){this[_0x10e6('0xd')](_0x10e6('0xc'),JSON['stringify'](_0x132a9b));}else{this[_0x10e6('0xd')](_0x10e6('0xc'),_0x132a9b);}}},'required':{'type':Sequelize[_0x10e6('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x10e6('0xf')]('voice')}}; \ No newline at end of file +var _0xa5c0=['getDataValue','alias','setDataValue','STRING','TEXT','long','type','select','parse','isArray','values','BOOLEAN','ENUM','voice','sequelize','exports','VIRTUAL'];(function(_0x2d52f9,_0x201a13){var _0x3375af=function(_0x2627dc){while(--_0x2627dc){_0x2d52f9['push'](_0x2d52f9['shift']());}};_0x3375af(++_0x201a13);}(_0xa5c0,0x10d));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x0a5c('0x0'));var _=require('lodash');module[_0x0a5c('0x1')]={'name':{'type':Sequelize[_0x0a5c('0x2')],'get':function(_0xf95252){return this[_0x0a5c('0x3')](_0x0a5c('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x5598f7){this[_0x0a5c('0x5')]('alias',_0x5598f7?_0x5598f7:this[_0x0a5c('0x3')]('name'));}},'type':{'type':Sequelize[_0x0a5c('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x0a5c('0x7')](_0x0a5c('0x8')),'get':function(){if(this[_0x0a5c('0x3')](_0x0a5c('0x9'))===_0x0a5c('0xa')){return JSON[_0x0a5c('0xb')](this[_0x0a5c('0x3')]('values'));}else{return this[_0x0a5c('0x3')]('values');}},'set':function(_0x4bfcf3){if(Array[_0x0a5c('0xc')](_0x4bfcf3)){this['setDataValue'](_0x0a5c('0xd'),JSON['stringify'](_0x4bfcf3));}else{this[_0x0a5c('0x5')](_0x0a5c('0xd'),_0x4bfcf3);}}},'required':{'type':Sequelize[_0x0a5c('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x0a5c('0xf')](_0x0a5c('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 5ff1782..b39b936 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 _0x1527=['catch','show','params','include','find','body','transaction','create','Sequelize','TEXT','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','json','offset','undefined','count','status','set','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','differenceBy','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows'];(function(_0x5931e3,_0x3e6e5c){var _0x4fb81d=function(_0x43f8dd){while(--_0x43f8dd){_0x5931e3['push'](_0x5931e3['shift']());}};_0x4fb81d(++_0x3e6e5c);}(_0x1527,0xc1));var _0x7152=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x1527[_0x7e2eb0];return _0xd92de4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7152('0x0'));var zipdir=require(_0x7152('0x1'));var jsonpatch=require(_0x7152('0x2'));var rp=require(_0x7152('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7152('0x4'));var util=require(_0x7152('0x5'));var path=require('path');var sox=require(_0x7152('0x6'));var csv=require(_0x7152('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7152('0x8'));var _=require(_0x7152('0x9'));var squel=require(_0x7152('0xa'));var crypto=require('crypto');var jsforce=require(_0x7152('0xb'));var deskjs=require(_0x7152('0xc'));var toCsv=require(_0x7152('0x7'));var querystring=require(_0x7152('0xd'));var Papa=require(_0x7152('0xe'));var Redis=require(_0x7152('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x7152('0x10'));var as=require(_0x7152('0x11'));var hardwareService=require(_0x7152('0x12'));var logger=require(_0x7152('0x13'))(_0x7152('0x14'));var utils=require('../../config/utils');var config=require(_0x7152('0x15'));var licenseUtil=require(_0x7152('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d853f,_0x2928cf){_0x2928cf=_0x2928cf||0xcc;return function(_0x4b03a8){if(_0x4b03a8){return _0x5d853f['sendStatus'](_0x2928cf);}return _0x5d853f['status'](_0x2928cf)[_0x7152('0x17')]();};}function respondWithResult(_0x2df802,_0x2114cf){_0x2114cf=_0x2114cf||0xc8;return function(_0x49d976){if(_0x49d976){return _0x2df802['status'](_0x2114cf)[_0x7152('0x18')](_0x49d976);}};}function respondWithFilteredResult(_0x6ae434,_0x39c58f){return function(_0x53315e){if(_0x53315e){var _0x589716=typeof _0x39c58f[_0x7152('0x19')]==='undefined'&&typeof _0x39c58f['limit']===_0x7152('0x1a');var _0x51f0ce=_0x53315e[_0x7152('0x1b')];var _0xf2ad37=_0x589716?0x0:_0x39c58f['offset'];var _0x4a83a2=_0x589716?_0x53315e[_0x7152('0x1b')]:_0x39c58f[_0x7152('0x19')]+_0x39c58f['limit'];var _0x3027b6;if(_0x4a83a2>=_0x51f0ce){_0x4a83a2=_0x51f0ce;_0x3027b6=0xc8;}else{_0x3027b6=0xce;}_0x6ae434[_0x7152('0x1c')](_0x3027b6);return _0x6ae434[_0x7152('0x1d')]('Content-Range',_0xf2ad37+'-'+_0x4a83a2+'/'+_0x51f0ce)['json'](_0x53315e);}return null;};}function patchUpdates(_0x1720c9){return function(_0x14b63d){try{jsonpatch[_0x7152('0x1e')](_0x14b63d,_0x1720c9,!![]);}catch(_0x378acd){return BPromise[_0x7152('0x1f')](_0x378acd);}return _0x14b63d['save']();};}function saveUpdates(_0x22c805,_0x149c64){return function(_0x241c98){if(_0x241c98){return _0x241c98[_0x7152('0x20')](_0x22c805)[_0x7152('0x21')](function(_0x51051d){return _0x51051d;});}return null;};}function removeEntity(_0x3bdee5,_0x24a664){return function(_0xf019d5){if(_0xf019d5){return _0xf019d5[_0x7152('0x22')]()[_0x7152('0x21')](function(){_0x3bdee5[_0x7152('0x1c')](0xcc)[_0x7152('0x17')]();});}};}function handleEntityNotFound(_0x2427e2,_0x578576){return function(_0x4671bf){if(!_0x4671bf){_0x2427e2[_0x7152('0x23')](0x194);}return _0x4671bf;};}function handleError(_0x128239,_0x3aff43){_0x3aff43=_0x3aff43||0x1f4;return function(_0x36c73b){logger['error'](_0x36c73b[_0x7152('0x24')]);if(_0x36c73b[_0x7152('0x25')]){delete _0x36c73b[_0x7152('0x25')];}_0x128239[_0x7152('0x1c')](_0x3aff43)[_0x7152('0x26')](_0x36c73b);};}exports[_0x7152('0x27')]=function(_0x51fb5c,_0x1d71f4){var _0x37b821={},_0x2e22bf={},_0x39ae3b={'count':0x0,'rows':[]};var _0x478323=_[_0x7152('0x28')](db[_0x7152('0x29')][_0x7152('0x2a')],function(_0x2c04af){return{'name':_0x2c04af['fieldName'],'type':_0x2c04af[_0x7152('0x2b')][_0x7152('0x2c')]};});_0x2e22bf['model']=_[_0x7152('0x2d')](_[_0x7152('0x28')](_0x478323,'name'),[_0x7152('0x25')]);_0x2e22bf[_0x7152('0x2e')]=_[_0x7152('0x2f')](_0x51fb5c[_0x7152('0x2e')]);_0x2e22bf[_0x7152('0x30')]=_[_0x7152('0x31')](_0x2e22bf[_0x7152('0x32')],_0x2e22bf['query']);_0x37b821['attributes']=_[_0x7152('0x31')](_0x2e22bf[_0x7152('0x32')],qs[_0x7152('0x33')](_0x51fb5c[_0x7152('0x2e')]['fields']));_0x37b821[_0x7152('0x34')]=_0x37b821[_0x7152('0x34')][_0x7152('0x35')]?_0x37b821[_0x7152('0x34')]:_0x2e22bf[_0x7152('0x32')];if(!_0x51fb5c[_0x7152('0x2e')][_0x7152('0x36')](_0x7152('0x37'))){_0x37b821[_0x7152('0x38')]=qs[_0x7152('0x38')](_0x51fb5c['query'][_0x7152('0x38')]);_0x37b821['offset']=qs[_0x7152('0x19')](_0x51fb5c[_0x7152('0x2e')][_0x7152('0x19')]);}_0x37b821[_0x7152('0x39')]=qs[_0x7152('0x3a')](_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3a')]);_0x37b821[_0x7152('0x3b')]=qs[_0x7152('0x30')](_[_0x7152('0x3c')](_0x51fb5c[_0x7152('0x2e')],_0x2e22bf[_0x7152('0x30')]),_0x478323);if(_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3d')]){_0x37b821[_0x7152('0x3b')]=_[_0x7152('0x3e')](_0x37b821[_0x7152('0x3b')],{'$or':_[_0x7152('0x28')](_0x478323,function(_0x465101){if(_0x465101[_0x7152('0x2b')]!==_0x7152('0x3f')){var _0x23b569={};_0x23b569[_0x465101[_0x7152('0x25')]]={'$like':'%'+_0x51fb5c[_0x7152('0x2e')][_0x7152('0x3d')]+'%'};return _0x23b569;}})});}_0x37b821=_[_0x7152('0x3e')]({},_0x37b821,_0x51fb5c[_0x7152('0x40')]);var _0x2dfe06={'where':_0x37b821[_0x7152('0x3b')]};return db['CmCustomField'][_0x7152('0x1b')](_0x2dfe06)[_0x7152('0x21')](function(_0x37398a){_0x39ae3b[_0x7152('0x1b')]=_0x37398a;if(_0x51fb5c[_0x7152('0x2e')][_0x7152('0x41')]){_0x37b821['include']=[{'all':!![]}];}return db['CmCustomField'][_0x7152('0x42')](_0x37b821);})[_0x7152('0x21')](function(_0xb7ed1f){_0x39ae3b[_0x7152('0x43')]=_0xb7ed1f;return _0x39ae3b;})[_0x7152('0x21')](respondWithFilteredResult(_0x1d71f4,_0x37b821))[_0x7152('0x44')](handleError(_0x1d71f4,null));};exports[_0x7152('0x45')]=function(_0x4cc0e5,_0x5b4e8c){var _0x5d317f={'raw':!![],'where':{'id':_0x4cc0e5[_0x7152('0x46')]['id']}},_0x288bf2={};_0x288bf2[_0x7152('0x32')]=_[_0x7152('0x2f')](db[_0x7152('0x29')][_0x7152('0x2a')]);_0x288bf2[_0x7152('0x2e')]=_[_0x7152('0x2f')](_0x4cc0e5[_0x7152('0x2e')]);_0x288bf2[_0x7152('0x30')]=_[_0x7152('0x31')](_0x288bf2[_0x7152('0x32')],_0x288bf2[_0x7152('0x2e')]);_0x5d317f['attributes']=_[_0x7152('0x31')](_0x288bf2[_0x7152('0x32')],qs['fields'](_0x4cc0e5['query'][_0x7152('0x33')]));_0x5d317f[_0x7152('0x34')]=_0x5d317f[_0x7152('0x34')][_0x7152('0x35')]?_0x5d317f['attributes']:_0x288bf2[_0x7152('0x32')];if(_0x4cc0e5['query']['includeAll']){_0x5d317f[_0x7152('0x47')]=[{'all':!![]}];}_0x5d317f=_[_0x7152('0x3e')]({},_0x5d317f,_0x4cc0e5[_0x7152('0x40')]);return db['CmCustomField'][_0x7152('0x48')](_0x5d317f)['then'](handleEntityNotFound(_0x5b4e8c,null))['then'](respondWithResult(_0x5b4e8c,null))[_0x7152('0x44')](handleError(_0x5b4e8c,null));};exports[_0x7152('0x20')]=function(_0x586c95,_0x9c5216){if(_0x586c95[_0x7152('0x49')]['id']){delete _0x586c95[_0x7152('0x49')]['id'];}return db['CmCustomField'][_0x7152('0x48')]({'where':{'id':_0x586c95[_0x7152('0x46')]['id']}})['then'](handleEntityNotFound(_0x9c5216,null))['then'](saveUpdates(_0x586c95[_0x7152('0x49')],null))[_0x7152('0x21')](respondWithResult(_0x9c5216,null))[_0x7152('0x44')](handleError(_0x9c5216,null));};exports['destroy']=function(_0x58a816,_0xb4f9f1){return db['CmCustomField']['find']({'where':{'id':_0x58a816[_0x7152('0x46')]['id']}})[_0x7152('0x21')](handleEntityNotFound(_0xb4f9f1,null))[_0x7152('0x21')](removeEntity(_0xb4f9f1,null))[_0x7152('0x44')](handleError(_0xb4f9f1,null));};exports['create']=function(_0x426efd,_0x12161b){var _0x4d9d50;return db['sequelize'][_0x7152('0x4a')](function(_0x94f294){return db[_0x7152('0x29')][_0x7152('0x4b')](_0x426efd[_0x7152('0x49')],{'transaction':_0x94f294})[_0x7152('0x21')](function(_0x4995df){_0x4d9d50=_0x4995df;var _0x21a7e2={'type':db[_0x7152('0x4c')]['TEXT'],'transaction':_0x94f294};switch(_0x426efd[_0x7152('0x49')][_0x7152('0x2b')]){case'text':_0x21a7e2[_0x7152('0x2b')]=db[_0x7152('0x4c')][_0x7152('0x4d')];break;case _0x7152('0x4e'):_0x21a7e2[_0x7152('0x2b')]=db['Sequelize']['INTEGER'];break;case _0x7152('0x4f'):_0x21a7e2[_0x7152('0x2b')]=db['Sequelize'][_0x7152('0x50')];_0x21a7e2[_0x7152('0x51')]=![];break;default:}return db['sequelize'][_0x7152('0x52')][_0x7152('0x53')](_0x7152('0x54'),util[_0x7152('0x55')](_0x7152('0x56'),_0x4d9d50['id']),_0x21a7e2);})[_0x7152('0x21')](function(){return _0x4d9d50;});})['then'](respondWithResult(_0x12161b,0xc9))[_0x7152('0x44')](handleError(_0x12161b,null));}; \ No newline at end of file +var _0xa999=['offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','differenceBy','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','CmCustomField','findAll','catch','show','params','find','body','create','sequelize','Sequelize','TEXT','text','number','defaultValue','queryInterface','addColumn','cm_contacts','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json'];(function(_0x215c1b,_0x4a4c0b){var _0x3aa485=function(_0x3d4c96){while(--_0x3d4c96){_0x215c1b['push'](_0x215c1b['shift']());}};_0x3aa485(++_0x4a4c0b);}(_0xa999,0x184));var _0x9a99=function(_0x2754ff,_0x326078){_0x2754ff=_0x2754ff-0x0;var _0x4c801e=_0xa999[_0x2754ff];return _0x4c801e;};'use strict';var emlformat=require(_0x9a99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9a99('0x1'));var rp=require(_0x9a99('0x2'));var moment=require(_0x9a99('0x3'));var BPromise=require(_0x9a99('0x4'));var Mustache=require(_0x9a99('0x5'));var util=require('util');var path=require(_0x9a99('0x6'));var sox=require(_0x9a99('0x7'));var csv=require(_0x9a99('0x8'));var ejs=require(_0x9a99('0x9'));var fs=require('fs');var fs_extra=require(_0x9a99('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a99('0xb'));var jsforce=require(_0x9a99('0xc'));var deskjs=require(_0x9a99('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9a99('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a99('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a99('0x10'));var as=require(_0x9a99('0x11'));var hardwareService=require(_0x9a99('0x12'));var logger=require(_0x9a99('0x13'))(_0x9a99('0x14'));var utils=require(_0x9a99('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9a99('0x16'));var db=require(_0x9a99('0x17'))['db'];function respondWithStatusCode(_0x571504,_0x216595){_0x216595=_0x216595||0xcc;return function(_0x3180cd){if(_0x3180cd){return _0x571504['sendStatus'](_0x216595);}return _0x571504['status'](_0x216595)[_0x9a99('0x18')]();};}function respondWithResult(_0x5c6359,_0x51f0d9){_0x51f0d9=_0x51f0d9||0xc8;return function(_0x20389b){if(_0x20389b){return _0x5c6359[_0x9a99('0x19')](_0x51f0d9)[_0x9a99('0x1a')](_0x20389b);}};}function respondWithFilteredResult(_0x93c620,_0x12fdc7){return function(_0x362c3e){if(_0x362c3e){var _0x46c879=typeof _0x12fdc7[_0x9a99('0x1b')]===_0x9a99('0x1c')&&typeof _0x12fdc7[_0x9a99('0x1d')]==='undefined';var _0x4863da=_0x362c3e[_0x9a99('0x1e')];var _0x406425=_0x46c879?0x0:_0x12fdc7['offset'];var _0xab3be6=_0x46c879?_0x362c3e[_0x9a99('0x1e')]:_0x12fdc7[_0x9a99('0x1b')]+_0x12fdc7['limit'];var _0x1c889c;if(_0xab3be6>=_0x4863da){_0xab3be6=_0x4863da;_0x1c889c=0xc8;}else{_0x1c889c=0xce;}_0x93c620['status'](_0x1c889c);return _0x93c620[_0x9a99('0x1f')](_0x9a99('0x20'),_0x406425+'-'+_0xab3be6+'/'+_0x4863da)[_0x9a99('0x1a')](_0x362c3e);}return null;};}function patchUpdates(_0x242a32){return function(_0x3aa240){try{jsonpatch[_0x9a99('0x21')](_0x3aa240,_0x242a32,!![]);}catch(_0x4672c2){return BPromise['reject'](_0x4672c2);}return _0x3aa240[_0x9a99('0x22')]();};}function saveUpdates(_0x3dce4a,_0x348935){return function(_0x19125a){if(_0x19125a){return _0x19125a[_0x9a99('0x23')](_0x3dce4a)['then'](function(_0xe96a4b){return _0xe96a4b;});}return null;};}function removeEntity(_0xcbda41,_0x591e99){return function(_0x4619ca){if(_0x4619ca){return _0x4619ca[_0x9a99('0x24')]()[_0x9a99('0x25')](function(){_0xcbda41[_0x9a99('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x162fa6,_0x4fccae){return function(_0x61ea71){if(!_0x61ea71){_0x162fa6[_0x9a99('0x26')](0x194);}return _0x61ea71;};}function handleError(_0x392772,_0x1da394){_0x1da394=_0x1da394||0x1f4;return function(_0x326a12){logger['error'](_0x326a12[_0x9a99('0x27')]);if(_0x326a12[_0x9a99('0x28')]){delete _0x326a12[_0x9a99('0x28')];}_0x392772[_0x9a99('0x19')](_0x1da394)[_0x9a99('0x29')](_0x326a12);};}exports[_0x9a99('0x2a')]=function(_0x332264,_0x5abef7){var _0x123fbf={},_0x39fc8d={},_0x46c38f={'count':0x0,'rows':[]};var _0x324985=_[_0x9a99('0x2b')](db['CmCustomField'][_0x9a99('0x2c')],function(_0x4c449b){return{'name':_0x4c449b[_0x9a99('0x2d')],'type':_0x4c449b['type'][_0x9a99('0x2e')]};});_0x39fc8d[_0x9a99('0x2f')]=_[_0x9a99('0x30')](_[_0x9a99('0x2b')](_0x324985,_0x9a99('0x28')),[_0x9a99('0x28')]);_0x39fc8d['query']=_[_0x9a99('0x31')](_0x332264[_0x9a99('0x32')]);_0x39fc8d[_0x9a99('0x33')]=_[_0x9a99('0x34')](_0x39fc8d['model'],_0x39fc8d[_0x9a99('0x32')]);_0x123fbf['attributes']=_[_0x9a99('0x34')](_0x39fc8d[_0x9a99('0x2f')],qs[_0x9a99('0x35')](_0x332264[_0x9a99('0x32')][_0x9a99('0x35')]));_0x123fbf[_0x9a99('0x36')]=_0x123fbf[_0x9a99('0x36')]['length']?_0x123fbf[_0x9a99('0x36')]:_0x39fc8d[_0x9a99('0x2f')];if(!_0x332264[_0x9a99('0x32')][_0x9a99('0x37')]('nolimit')){_0x123fbf[_0x9a99('0x1d')]=qs[_0x9a99('0x1d')](_0x332264[_0x9a99('0x32')]['limit']);_0x123fbf[_0x9a99('0x1b')]=qs[_0x9a99('0x1b')](_0x332264[_0x9a99('0x32')]['offset']);}_0x123fbf['order']=qs[_0x9a99('0x38')](_0x332264[_0x9a99('0x32')][_0x9a99('0x38')]);_0x123fbf[_0x9a99('0x39')]=qs[_0x9a99('0x33')](_[_0x9a99('0x3a')](_0x332264[_0x9a99('0x32')],_0x39fc8d[_0x9a99('0x33')]),_0x324985);if(_0x332264[_0x9a99('0x32')][_0x9a99('0x3b')]){_0x123fbf[_0x9a99('0x39')]=_[_0x9a99('0x3c')](_0x123fbf[_0x9a99('0x39')],{'$or':_[_0x9a99('0x2b')](_0x324985,function(_0x25a329){if(_0x25a329[_0x9a99('0x3d')]!==_0x9a99('0x3e')){var _0x4fb1ff={};_0x4fb1ff[_0x25a329[_0x9a99('0x28')]]={'$like':'%'+_0x332264[_0x9a99('0x32')][_0x9a99('0x3b')]+'%'};return _0x4fb1ff;}})});}_0x123fbf=_[_0x9a99('0x3c')]({},_0x123fbf,_0x332264[_0x9a99('0x3f')]);var _0x36dc23={'where':_0x123fbf[_0x9a99('0x39')]};return db['CmCustomField'][_0x9a99('0x1e')](_0x36dc23)[_0x9a99('0x25')](function(_0x58d59d){_0x46c38f['count']=_0x58d59d;if(_0x332264[_0x9a99('0x32')][_0x9a99('0x40')]){_0x123fbf[_0x9a99('0x41')]=[{'all':!![]}];}return db[_0x9a99('0x42')][_0x9a99('0x43')](_0x123fbf);})[_0x9a99('0x25')](function(_0xd455a8){_0x46c38f['rows']=_0xd455a8;return _0x46c38f;})[_0x9a99('0x25')](respondWithFilteredResult(_0x5abef7,_0x123fbf))[_0x9a99('0x44')](handleError(_0x5abef7,null));};exports[_0x9a99('0x45')]=function(_0x528e14,_0xe033e1){var _0x3d58b2={'raw':!![],'where':{'id':_0x528e14[_0x9a99('0x46')]['id']}},_0x3fbf06={};_0x3fbf06[_0x9a99('0x2f')]=_[_0x9a99('0x31')](db[_0x9a99('0x42')][_0x9a99('0x2c')]);_0x3fbf06[_0x9a99('0x32')]=_['keys'](_0x528e14[_0x9a99('0x32')]);_0x3fbf06[_0x9a99('0x33')]=_[_0x9a99('0x34')](_0x3fbf06[_0x9a99('0x2f')],_0x3fbf06[_0x9a99('0x32')]);_0x3d58b2['attributes']=_[_0x9a99('0x34')](_0x3fbf06[_0x9a99('0x2f')],qs['fields'](_0x528e14[_0x9a99('0x32')]['fields']));_0x3d58b2['attributes']=_0x3d58b2['attributes']['length']?_0x3d58b2[_0x9a99('0x36')]:_0x3fbf06[_0x9a99('0x2f')];if(_0x528e14[_0x9a99('0x32')][_0x9a99('0x40')]){_0x3d58b2['include']=[{'all':!![]}];}_0x3d58b2=_[_0x9a99('0x3c')]({},_0x3d58b2,_0x528e14['options']);return db[_0x9a99('0x42')][_0x9a99('0x47')](_0x3d58b2)['then'](handleEntityNotFound(_0xe033e1,null))[_0x9a99('0x25')](respondWithResult(_0xe033e1,null))['catch'](handleError(_0xe033e1,null));};exports[_0x9a99('0x23')]=function(_0x40f22d,_0xf1b6cd){if(_0x40f22d['body']['id']){delete _0x40f22d[_0x9a99('0x48')]['id'];}return db[_0x9a99('0x42')][_0x9a99('0x47')]({'where':{'id':_0x40f22d['params']['id']}})[_0x9a99('0x25')](handleEntityNotFound(_0xf1b6cd,null))[_0x9a99('0x25')](saveUpdates(_0x40f22d['body'],null))[_0x9a99('0x25')](respondWithResult(_0xf1b6cd,null))[_0x9a99('0x44')](handleError(_0xf1b6cd,null));};exports['destroy']=function(_0x5b3844,_0x56186e){return db[_0x9a99('0x42')][_0x9a99('0x47')]({'where':{'id':_0x5b3844[_0x9a99('0x46')]['id']}})[_0x9a99('0x25')](handleEntityNotFound(_0x56186e,null))['then'](removeEntity(_0x56186e,null))[_0x9a99('0x44')](handleError(_0x56186e,null));};exports[_0x9a99('0x49')]=function(_0x4b0946,_0x513cdc){var _0x272d9c;return db[_0x9a99('0x4a')]['transaction'](function(_0xb35bde){return db[_0x9a99('0x42')]['create'](_0x4b0946[_0x9a99('0x48')],{'transaction':_0xb35bde})[_0x9a99('0x25')](function(_0x22c10f){_0x272d9c=_0x22c10f;var _0x11ef38={'type':db[_0x9a99('0x4b')][_0x9a99('0x4c')],'transaction':_0xb35bde};switch(_0x4b0946[_0x9a99('0x48')][_0x9a99('0x3d')]){case _0x9a99('0x4d'):_0x11ef38[_0x9a99('0x3d')]=db[_0x9a99('0x4b')]['TEXT'];break;case _0x9a99('0x4e'):_0x11ef38[_0x9a99('0x3d')]=db['Sequelize']['INTEGER'];break;case'switch':_0x11ef38[_0x9a99('0x3d')]=db['Sequelize']['BOOLEAN'];_0x11ef38[_0x9a99('0x4f')]=![];break;default:}return db[_0x9a99('0x4a')][_0x9a99('0x50')][_0x9a99('0x51')](_0x9a99('0x52'),util['format']('cf_%d',_0x272d9c['id']),_0x11ef38);})['then'](function(){return _0x272d9c;});})['then'](respondWithResult(_0x513cdc,0xc9))[_0x9a99('0x44')](handleError(_0x513cdc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 5f65aef..d0034b7 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 _0x154b=['../../config/environment','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0xc8f0ea,_0x3b007b){var _0x5533bf=function(_0x4de67d){while(--_0x4de67d){_0xc8f0ea['push'](_0xc8f0ea['shift']());}};_0x5533bf(++_0x3b007b);}(_0x154b,0x12e));var _0xb154=function(_0x3292cd,_0x2f56e2){_0x3292cd=_0x3292cd-0x0;var _0x39a1bc=_0x154b[_0x3292cd];return _0x39a1bc;};'use strict';var _=require(_0xb154('0x0'));var util=require('util');var logger=require(_0xb154('0x1'))(_0xb154('0x2'));var moment=require(_0xb154('0x3'));var BPromise=require('bluebird');var rp=require(_0xb154('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb154('0x5'));var config=require(_0xb154('0x6'));var attributes=require(_0xb154('0x7'));module[_0xb154('0x8')]=function(_0x1028ce,_0x17f46a){return _0x1028ce['define'](_0xb154('0x9'),attributes,{'tableName':_0xb154('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8edc=['bluebird','path','rimraf','../../config/environment','exports','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment'];(function(_0x3a4203,_0xa6ff2e){var _0x1a5661=function(_0x584f45){while(--_0x584f45){_0x3a4203['push'](_0x3a4203['shift']());}};_0x1a5661(++_0xa6ff2e);}(_0x8edc,0x172));var _0xc8ed=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x8edc[_0x3054be];return _0x3df150;};'use strict';var _=require(_0xc8ed('0x0'));var util=require(_0xc8ed('0x1'));var logger=require(_0xc8ed('0x2'))('api');var moment=require(_0xc8ed('0x3'));var BPromise=require(_0xc8ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8ed('0x5'));var rimraf=require(_0xc8ed('0x6'));var config=require(_0xc8ed('0x7'));var attributes=require('./cmCustomField.attributes');module[_0xc8ed('0x8')]=function(_0x31d04a,_0x41865b){return _0x31d04a['define'](_0xc8ed('0x9'),attributes,{'tableName':_0xc8ed('0xa'),'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 a7103ec..1f16646 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 _0x7840=['debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x7059d1,_0x220af6){var _0x398f43=function(_0x155383){while(--_0x155383){_0x7059d1['push'](_0x7059d1['shift']());}};_0x398f43(++_0x220af6);}(_0x7840,0x68));var _0x0784=function(_0x92b599,_0x31b337){_0x92b599=_0x92b599-0x0;var _0x513c4d=_0x7840[_0x92b599];return _0x513c4d;};'use strict';var _=require('lodash');var util=require(_0x0784('0x0'));var moment=require(_0x0784('0x1'));var BPromise=require(_0x0784('0x2'));var rs=require(_0x0784('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0784('0x4'))['db'];var utils=require(_0x0784('0x5'));var logger=require(_0x0784('0x6'))(_0x0784('0x7'));var config=require('../../config/environment');var jayson=require(_0x0784('0x8'));var client=jayson[_0x0784('0x9')][_0x0784('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45dc20,_0x574768,_0x1e323a){return new BPromise(function(_0x41c7ef,_0x292447){return client[_0x0784('0xb')](_0x45dc20,_0x1e323a)[_0x0784('0xc')](function(_0x3e558f){logger[_0x0784('0xd')](_0x0784('0xe'),_0x574768,_0x0784('0xf'));logger[_0x0784('0x10')](_0x0784('0x11'),_0x574768,_0x0784('0xf'),JSON[_0x0784('0x12')](_0x3e558f));if(_0x3e558f[_0x0784('0x13')]){if(_0x3e558f['error'][_0x0784('0x14')]===0x1f4){logger[_0x0784('0x13')](_0x0784('0xe'),_0x574768,_0x3e558f[_0x0784('0x13')][_0x0784('0x15')]);return _0x292447(_0x3e558f[_0x0784('0x13')]['message']);}logger['error'](_0x0784('0xe'),_0x574768,_0x3e558f[_0x0784('0x13')][_0x0784('0x15')]);return _0x41c7ef(_0x3e558f['error'][_0x0784('0x15')]);}else{logger[_0x0784('0xd')](_0x0784('0xe'),_0x574768,_0x0784('0xf'));_0x41c7ef(_0x3e558f[_0x0784('0x16')]['message']);}})[_0x0784('0x17')](function(_0x113c53){logger[_0x0784('0x13')](_0x0784('0xe'),_0x574768,_0x113c53);_0x292447(_0x113c53);});});} \ No newline at end of file +var _0xed3d=['CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','then'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xed3d,0xe6));var _0xded3=function(_0x476c6a,_0x4906db){_0x476c6a=_0x476c6a-0x0;var _0x1967df=_0xed3d[_0x476c6a];return _0x1967df;};'use strict';var _=require('lodash');var util=require(_0xded3('0x0'));var moment=require(_0xded3('0x1'));var BPromise=require(_0xded3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xded3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xded3('0x4'));var logger=require(_0xded3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xded3('0x6'));var client=jayson['client'][_0xded3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2522c1,_0x5251b5,_0x14303f){return new BPromise(function(_0x4bbde2,_0x450968){return client[_0xded3('0x8')](_0x2522c1,_0x14303f)[_0xded3('0x9')](function(_0x44e3eb){logger['info'](_0xded3('0xa'),_0x5251b5,_0xded3('0xb'));logger[_0xded3('0xc')](_0xded3('0xd'),_0x5251b5,_0xded3('0xb'),JSON[_0xded3('0xe')](_0x44e3eb));if(_0x44e3eb['error']){if(_0x44e3eb[_0xded3('0xf')][_0xded3('0x10')]===0x1f4){logger[_0xded3('0xf')](_0xded3('0xa'),_0x5251b5,_0x44e3eb['error'][_0xded3('0x11')]);return _0x450968(_0x44e3eb[_0xded3('0xf')][_0xded3('0x11')]);}logger[_0xded3('0xf')](_0xded3('0xa'),_0x5251b5,_0x44e3eb[_0xded3('0xf')][_0xded3('0x11')]);return _0x4bbde2(_0x44e3eb[_0xded3('0xf')]['message']);}else{logger[_0xded3('0x12')](_0xded3('0xa'),_0x5251b5,_0xded3('0xb'));_0x4bbde2(_0x44e3eb[_0xded3('0x13')][_0xded3('0x11')]);}})['catch'](function(_0x32f6f1){logger[_0xded3('0xf')](_0xded3('0xa'),_0x5251b5,_0x32f6f1);_0x450968(_0x32f6f1);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 7f216e7..1915dfb 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 _0xb42d=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmCustomField.controller','isAuthenticated','index','get','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x1362b8,_0x20b21e){var _0x20372d=function(_0x41da5d){while(--_0x41da5d){_0x1362b8['push'](_0x1362b8['shift']());}};_0x20372d(++_0x20b21e);}(_0xb42d,0x1ed));var _0xdb42=function(_0x5cedf2,_0x3759f6){_0x5cedf2=_0x5cedf2-0x0;var _0x25453f=_0xb42d[_0x5cedf2];return _0x25453f;};'use strict';var multer=require(_0xdb42('0x0'));var util=require(_0xdb42('0x1'));var path=require(_0xdb42('0x2'));var timeout=require(_0xdb42('0x3'));var express=require(_0xdb42('0x4'));var router=express[_0xdb42('0x5')]();var fs_extra=require(_0xdb42('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb42('0x7'));var config=require('../../config/environment');var controller=require(_0xdb42('0x8'));router['get']('/',auth[_0xdb42('0x9')](),controller[_0xdb42('0xa')]);router[_0xdb42('0xb')]('/:id',auth[_0xdb42('0x9')](),controller['show']);router[_0xdb42('0xc')]('/',auth[_0xdb42('0x9')](),controller[_0xdb42('0xd')]);router[_0xdb42('0xe')](_0xdb42('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xdb42('0x10')](_0xdb42('0xf'),auth[_0xdb42('0x9')](),controller[_0xdb42('0x11')]);module[_0xdb42('0x12')]=router; \ No newline at end of file +var _0x5502=['create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','show','post'];(function(_0x5ea75c,_0x16adca){var _0x124e29=function(_0x346836){while(--_0x346836){_0x5ea75c['push'](_0x5ea75c['shift']());}};_0x124e29(++_0x16adca);}(_0x5502,0x69));var _0x2550=function(_0x50a330,_0x2e003c){_0x50a330=_0x50a330-0x0;var _0x475636=_0x5502[_0x50a330];return _0x475636;};'use strict';var multer=require(_0x2550('0x0'));var util=require(_0x2550('0x1'));var path=require(_0x2550('0x2'));var timeout=require(_0x2550('0x3'));var express=require(_0x2550('0x4'));var router=express[_0x2550('0x5')]();var fs_extra=require(_0x2550('0x6'));var auth=require(_0x2550('0x7'));var interaction=require(_0x2550('0x8'));var config=require(_0x2550('0x9'));var controller=require(_0x2550('0xa'));router[_0x2550('0xb')]('/',auth[_0x2550('0xc')](),controller['index']);router[_0x2550('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2550('0xd')]);router[_0x2550('0xe')]('/',auth['isAuthenticated'](),controller[_0x2550('0xf')]);router['put'](_0x2550('0x10'),auth[_0x2550('0xc')](),controller[_0x2550('0x11')]);router[_0x2550('0x12')](_0x2550('0x10'),auth[_0x2550('0xc')](),controller['destroy']);module[_0x2550('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6781316..7a89193 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 _0xaf06=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0xaf06,0x14b));var _0x6af0=function(_0x30b730,_0x1616aa){_0x30b730=_0x30b730-0x0;var _0x2b9434=_0xaf06[_0x30b730];return _0x2b9434;};'use strict';var moment=require('moment');var Sequelize=require(_0x6af0('0x0'));module['exports']={'phone':{'type':Sequelize[_0x6af0('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x6af0('0x3')],'defaultValue':moment()[_0x6af0('0x4')](_0x6af0('0x5'))},'countbusyretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6af0('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x6af0('0x3')]},'priority':{'type':Sequelize[_0x6af0('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x6af0('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x6af0('0x7')},'UserId':{'type':Sequelize[_0x6af0('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x6af0('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x6af0('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6af0('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x6af0('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0x6af0('0x3')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x16b8=['BOOLEAN','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment','exports','STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x16b8,0x153));var _0x816b=function(_0x11cfca,_0x4f3bc6){_0x11cfca=_0x11cfca-0x0;var _0x2c8cd6=_0x16b8[_0x11cfca];return _0x2c8cd6;};'use strict';var moment=require(_0x816b('0x0'));var Sequelize=require('sequelize');module[_0x816b('0x1')]={'phone':{'type':Sequelize[_0x816b('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x816b('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x816b('0x4'))},'countbusyretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x816b('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x816b('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x816b('0x6')]},'priority':{'type':Sequelize[_0x816b('0x5')](0x2)[_0x816b('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x816b('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x816b('0x5')],'unique':_0x816b('0x8')},'ListId':{'type':Sequelize[_0x816b('0x5')],'unique':_0x816b('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x816b('0x5')],'unique':_0x816b('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x816b('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x816b('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x816b('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 c46c7cf..df41543 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 _0x99c9=['queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','dialActive','recallme','Queue','getOpenContacts','preview','sendStatus','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','error','stack','name','send','index','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$gt','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$like','$notLike','$notILike','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone'];(function(_0xcb6fc2,_0x3bb85a){var _0x41eb97=function(_0x3b77a0){while(--_0x3b77a0){_0xcb6fc2['push'](_0xcb6fc2['shift']());}};_0x41eb97(++_0x3bb85a);}(_0x99c9,0x13c));var _0x999c=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x99c9[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require(_0x999c('0x0'));var _=require(_0x999c('0x1'));var qs=require(_0x999c('0x2'));var logger=require(_0x999c('0x3'))(_0x999c('0x4'));var shared=require(_0x999c('0x5'));var db=require(_0x999c('0x6'))['db'];function respondWithResult(_0x52dc75,_0x2a4e06){_0x2a4e06=_0x2a4e06||0xc8;return function(_0x140cd5){if(_0x140cd5){return _0x52dc75[_0x999c('0x7')](_0x2a4e06)[_0x999c('0x8')](_0x140cd5);}};}function respondWithFilteredResult(_0x2bdd73,_0x14df32){return function(_0x34f100){if(_0x34f100){var _0x651b7e=typeof _0x14df32[_0x999c('0x9')]===_0x999c('0xa')&&typeof _0x14df32[_0x999c('0xb')]===_0x999c('0xa');var _0x32984f=_0x34f100[_0x999c('0xc')];var _0x4dd585=_0x651b7e?0x0:_0x14df32[_0x999c('0x9')];var _0x2bf133=_0x651b7e?_0x34f100['count']:_0x14df32[_0x999c('0x9')]+_0x14df32[_0x999c('0xb')];var _0x97d9fd;if(_0x2bf133>=_0x32984f){_0x2bf133=_0x32984f;_0x97d9fd=0xc8;}else{_0x97d9fd=0xce;}_0x2bdd73[_0x999c('0x7')](_0x97d9fd);return _0x2bdd73[_0x999c('0xd')](_0x999c('0xe'),_0x4dd585+'-'+_0x2bf133+'/'+_0x32984f)[_0x999c('0x8')](_0x34f100);}return null;};}function saveUpdates(_0x3d7c6d,_0x2e5f7e){return function(_0x44a5bc){if(_0x44a5bc){return _0x44a5bc[_0x999c('0xf')](_0x3d7c6d)[_0x999c('0x10')](function(_0x4c3209){return _0x4c3209;});}return null;};}function handleEntityNotFound(_0x15f812,_0xd14862){return function(_0x4f2916){if(!_0x4f2916){_0x15f812['sendStatus'](0x194);}return _0x4f2916;};}function handleError(_0x5f5a20,_0x161434){_0x161434=_0x161434||0x1f4;return function(_0xb3e981){logger[_0x999c('0x11')](_0xb3e981[_0x999c('0x12')]);if(_0xb3e981[_0x999c('0x13')]){delete _0xb3e981['name'];}_0x5f5a20[_0x999c('0x7')](_0x161434)[_0x999c('0x14')](_0xb3e981);};}exports[_0x999c('0x15')]=function(_0xc05363,_0x110486){var _0x500048={},_0x1b327f={},_0x3fb85e={'count':0x0,'rows':[]};var _0x3a8a99=_[_0x999c('0x16')](db[_0x999c('0x17')]['rawAttributes'],function(_0x3630b8){return{'name':_0x3630b8[_0x999c('0x18')],'type':_0x3630b8[_0x999c('0x19')][_0x999c('0x1a')]};});_0x1b327f[_0x999c('0x1b')]=_[_0x999c('0x16')](_0x3a8a99,'name');_0x1b327f[_0x999c('0x1c')]=_[_0x999c('0x1d')](_0xc05363[_0x999c('0x1c')]);_0x1b327f[_0x999c('0x1e')]=_[_0x999c('0x1f')](_0x1b327f[_0x999c('0x1b')],_0x1b327f[_0x999c('0x1c')]);_0x1b327f[_0x999c('0x1e')]=_[_0x999c('0x20')](_0x1b327f[_0x999c('0x1e')],[_0x999c('0x21'),'$or',_0x999c('0x22'),_0x999c('0x23'),_0x999c('0x24'),_0x999c('0x25'),_0x999c('0x26'),_0x999c('0x27'),'$not',_0x999c('0x28'),_0x999c('0x29'),_0x999c('0x2a'),'$notIn',_0x999c('0x2b'),_0x999c('0x2c'),'$iLike',_0x999c('0x2d'),'$like','$overlap',_0x999c('0x2e'),_0x999c('0x2f'),_0x999c('0x30')]);_0x500048[_0x999c('0x31')]=_[_0x999c('0x1f')](_0x1b327f[_0x999c('0x1b')],qs[_0x999c('0x32')](_0xc05363[_0x999c('0x1c')][_0x999c('0x32')]));_0x500048[_0x999c('0x31')]=_0x500048['attributes'][_0x999c('0x33')]?_0x500048[_0x999c('0x31')]:_0x1b327f[_0x999c('0x1b')];if(!_0xc05363[_0x999c('0x1c')][_0x999c('0x34')](_0x999c('0x35'))){_0x500048[_0x999c('0xb')]=qs[_0x999c('0xb')](_0xc05363['query']['limit']);_0x500048[_0x999c('0x9')]=qs[_0x999c('0x9')](_0xc05363[_0x999c('0x1c')][_0x999c('0x9')]);}_0x500048['order']=qs[_0x999c('0x36')](_0xc05363[_0x999c('0x1c')][_0x999c('0x36')]);_0x500048[_0x999c('0x37')]=qs['filters'](_['pick'](_0xc05363[_0x999c('0x1c')],_0x1b327f[_0x999c('0x1e')]),_0x3a8a99);if(_0xc05363[_0x999c('0x1c')][_0x999c('0x38')]){_0x500048[_0x999c('0x37')]=_[_0x999c('0x39')](_0x500048[_0x999c('0x37')],{'$or':_['map'](_0x3a8a99,function(_0x5ad13e){if(_0x5ad13e['type']!==_0x999c('0x3a')){var _0x574eae={};_0x574eae[_0x5ad13e['name']]={'$like':'%'+_0xc05363['query']['filter']+'%'};return _0x574eae;}})});}_0x500048=_[_0x999c('0x39')]({},_0x500048,_0xc05363[_0x999c('0x3b')]);var _0x15dc10={'where':_0x500048[_0x999c('0x37')]};return db['CmHopper'][_0x999c('0xc')](_0x15dc10)[_0x999c('0x10')](function(_0x513aa4){_0x3fb85e['count']=_0x513aa4;if(_0xc05363[_0x999c('0x1c')]['includeAll']){_0x500048[_0x999c('0x3c')]=[{'all':!![]}];}return db['CmHopper'][_0x999c('0x3d')](_0x500048);})[_0x999c('0x10')](function(_0x1763f0){_0x3fb85e[_0x999c('0x3e')]=_0x1763f0;return _0x3fb85e;})['then'](respondWithFilteredResult(_0x110486,_0x500048))['catch'](handleError(_0x110486,null));};exports[_0x999c('0x3f')]=function(_0x391c2e,_0x37c40d){var _0xf26ba3={'raw':!![],'where':{'id':_0x391c2e[_0x999c('0x40')]['id']}},_0x5e21b6={};_0x5e21b6[_0x999c('0x1b')]=_[_0x999c('0x1d')](db[_0x999c('0x17')]['rawAttributes']);_0x5e21b6[_0x999c('0x1c')]=_['keys'](_0x391c2e[_0x999c('0x1c')]);_0x5e21b6[_0x999c('0x1e')]=_['intersection'](_0x5e21b6[_0x999c('0x1b')],_0x5e21b6[_0x999c('0x1c')]);_0xf26ba3[_0x999c('0x31')]=_[_0x999c('0x1f')](_0x5e21b6[_0x999c('0x1b')],qs[_0x999c('0x32')](_0x391c2e[_0x999c('0x1c')][_0x999c('0x32')]));_0xf26ba3['attributes']=_0xf26ba3['attributes']['length']?_0xf26ba3['attributes']:_0x5e21b6[_0x999c('0x1b')];if(_0x391c2e[_0x999c('0x1c')][_0x999c('0x41')]){_0xf26ba3[_0x999c('0x3c')]=[{'all':!![]}];}_0xf26ba3=_[_0x999c('0x39')]({},_0xf26ba3,_0x391c2e['options']);return db[_0x999c('0x17')][_0x999c('0x42')](_0xf26ba3)[_0x999c('0x10')](handleEntityNotFound(_0x37c40d,null))[_0x999c('0x10')](respondWithResult(_0x37c40d,null))[_0x999c('0x43')](handleError(_0x37c40d,null));};exports['create']=function(_0x40fca1,_0x2e8dd6){return db[_0x999c('0x17')][_0x999c('0x44')](_0x40fca1[_0x999c('0x45')],{})[_0x999c('0x10')](respondWithResult(_0x2e8dd6,0xc9))[_0x999c('0x43')](handleError(_0x2e8dd6,null));};exports[_0x999c('0xf')]=function(_0x41d2b2,_0x4e82a9){if(_0x41d2b2['body']['id']){delete _0x41d2b2[_0x999c('0x45')]['id'];}return db[_0x999c('0x17')][_0x999c('0x42')]({'where':{'id':_0x41d2b2[_0x999c('0x40')]['id']}})[_0x999c('0x10')](handleEntityNotFound(_0x4e82a9,null))[_0x999c('0x10')](saveUpdates(_0x41d2b2[_0x999c('0x45')],null))[_0x999c('0x10')](respondWithResult(_0x4e82a9,null))[_0x999c('0x43')](handleError(_0x4e82a9,null));};exports[_0x999c('0x46')]=function(_0x3457d6,_0x4ca662){return db[_0x999c('0x17')][_0x999c('0x46')]()[_0x999c('0x10')](respondWithResult(_0x4ca662,null))[_0x999c('0x43')](handleError(_0x4ca662,null));};exports[_0x999c('0x47')]=function(_0x386be6,_0x11f3bf){var _0x396e2c;var _0x55eb16=_0x386be6[_0x999c('0x40')]['id'];return db[_0x999c('0x17')][_0x999c('0x42')]({'where':{'id':_0x386be6[_0x999c('0x40')]['id']}})[_0x999c('0x10')](handleEntityNotFound(_0x11f3bf,null))[_0x999c('0x10')](function(_0x12eb3d){if(_0x12eb3d){return _0x12eb3d['destroy']()['then'](function(_0x1139f6){return _0x1139f6;});}})[_0x999c('0x10')](function(_0x37fb36){_0x396e2c=_0x37fb36;if(_0x37fb36){if(_0x37fb36[_0x999c('0x48')]||_0x37fb36[_0x999c('0x49')]){return db[_0x37fb36['VoiceQueueId']?_0x999c('0x4a'):_0x999c('0x4b')][_0x999c('0x42')]({'where':{'id':_0x37fb36[_0x999c('0x48')]?_0x37fb36['VoiceQueueId']:_0x37fb36[_0x999c('0x49')]},'attributes':['id','name'],'raw':!![]});}}})[_0x999c('0x10')](function(_0x1129e9){var _0x243913={};if(_0x1129e9){_[_0x999c('0x39')](_0x243913,_[_0x999c('0x4c')](_0x396e2c[_0x999c('0x4d')],[_0x999c('0x4e'),'updatedAt','id']));_0x243913[_0x999c('0x4f')]=0x15;_0x243913[_0x999c('0x50')]=_0x999c('0x51');_0x243913['campaign']=_0x1129e9[_0x999c('0x13')];_0x243913[_0x999c('0x52')]=_0x386be6[_0x999c('0x53')]['name'];_0x243913[_0x999c('0x54')]=_0x386be6['user']['id'];_0x243913[_0x999c('0x51')]=!![];_0x243913[_0x999c('0x55')]=moment()[_0x999c('0x56')](_0x999c('0x57'));_0x243913['calleridnum']=_0x396e2c[_0x999c('0x58')];_0x243913['campaigntype']=_0x396e2c['VoiceQueueId']?_0x999c('0x59'):_0x999c('0x5a');return db['CmContact'][_0x999c('0x42')]({'where':{'id':_0x243913['ContactId']},'attributes':[_0x999c('0x5b'),_0x999c('0x5c')]})['then'](function(_0x9ca1c1){if(!_[_0x999c('0x5d')](_0x11f3bf)&&!_[_0x999c('0x5d')](_0x9ca1c1[_0x999c('0x5b')])){_0x243913[_0x999c('0x5e')]=_0x9ca1c1[_0x999c('0x5b')];if(!_[_0x999c('0x5d')](_0x9ca1c1[_0x999c('0x5c')])){_0x243913[_0x999c('0x5e')]+='\x20'+_0x9ca1c1['lastName'];}}})[_0x999c('0x5f')](function(){return db[_0x999c('0x60')][_0x999c('0x44')](_0x243913);});}})[_0x999c('0x10')](function(_0x171e60){return db[_0x999c('0x61')]['destroy']({'where':{'CmHopperId':_0x55eb16}});})['then'](function(){return _0x11f3bf['status'](0xcc)['end']();})[_0x999c('0x43')](handleError(_0x11f3bf,null));};exports[_0x999c('0x62')]=function(_0x36fd71,_0x4d4236){var _0x3569e8=[];return db['CmContact'][_0x999c('0x46')]()['then'](function(_0x27c404){_0x3569e8=_[_0x999c('0x1d')](_0x27c404);return _0x36fd71[_0x999c('0x53')][_0x999c('0x63')]({'where':{'type':_0x999c('0x64'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x999c('0x65'),_0x999c('0x66')],'raw':!![]});})[_0x999c('0x10')](function(_0x27f9af){if(_0x27f9af&&_0x27f9af[_0x999c('0x33')]){return db[_0x999c('0x67')][_0x999c('0x68')](function(_0x4d4c33){var _0x30f93c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x999c('0x56')](_0x999c('0x57'))},'VoiceQueueId':{'$in':_[_0x999c('0x16')](_0x27f9af,'id')},'$or':[{'UserId':null},{'UserId':_0x36fd71[_0x999c('0x53')]['id']}]};var _0xc6c0c3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x27f9af)[_0x999c('0x38')](['dialPreviewAutoRecallMe',0x0])[_0x999c('0x16')]('id')[_0x999c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x36fd71['user']['id']}]};var _0x569ec9={'$or':[_0x30f93c,_0xc6c0c3]};var _0x25966e=[];if(_0x36fd71[_0x999c('0x45')][_0x999c('0x6a')]&&_0x36fd71['body'][_0x999c('0x6a')]===_0x999c('0x6b')){if(!_[_0x999c('0x6c')](_0x36fd71[_0x999c('0x45')][_0x999c('0x6d')])){_0x569ec9['id']={'$in':_0x36fd71[_0x999c('0x45')]['hopperIds']};}_0x25966e=[[_0x999c('0x6e'),'ASC'],[_0x999c('0x6f'),_0x27f9af[0x0][_0x999c('0x65')]===_0x999c('0x70')?_0x999c('0x71'):_0x999c('0x70')],db[_0x999c('0x67')][_0x999c('0x72')](_0x999c('0x73')),['id',_0x999c('0x71')]];}else{if(!_[_0x999c('0x6c')](_0x36fd71[_0x999c('0x45')][_0x999c('0x6d')])){_0x569ec9['id']={'$notIn':_0x36fd71[_0x999c('0x45')]['hopperIds']};}_0x25966e=[[_0x999c('0x6e'),_0x999c('0x71')],['scheduledAt',_0x27f9af[0x0][_0x999c('0x65')]],db[_0x999c('0x67')][_0x999c('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x999c('0x70')]];}return db[_0x999c('0x17')][_0x999c('0x74')]({'attributes':['id',_0x999c('0x75'),_0x999c('0x58'),'recallme'],'where':_0x569ec9,'order':_0x25966e,'transaction':_0x4d4c33,'lock':_0x4d4c33[_0x999c('0x76')][_0x999c('0x77')],'include':[{'model':db[_0x999c('0x78')],'as':_0x999c('0x79'),'attributes':_0x3569e8,'include':[{'model':db[_0x999c('0x7a')],'as':_0x999c('0x7b'),'attributes':['id',_0x999c('0x13')]}]},{'model':db[_0x999c('0x7c')],'as':'List','attributes':['id',_0x999c('0x13')]},{'model':db[_0x999c('0x4a')],'as':'Queue','attributes':['id','name',_0x999c('0x7d')]}]})[_0x999c('0x10')](function(_0x19a8e9){if(_0x19a8e9){return _0x19a8e9[_0x999c('0xf')]({'UserId':_0x36fd71['user']['id']},{'transaction':_0x4d4c33});}});});}})[_0x999c('0x10')](handleEntityNotFound(_0x4d4236,null))[_0x999c('0x10')](respondWithResult(_0x4d4236,null))[_0x999c('0x43')](handleError(_0x4d4236,null));};exports['getPreviewRecall']=function(_0x42261c,_0x4f6544,_0x2c1b7d){var _0x90eb9a=[];var _0x5d3c9f=_0x42261c[_0x999c('0x40')]['id'];var _0x587177=_0x42261c[_0x999c('0x53')]['id'];return db[_0x999c('0x78')][_0x999c('0x46')]()[_0x999c('0x10')](function(_0x1d27fe){_0x90eb9a=_[_0x999c('0x1d')](_0x1d27fe);return db[_0x999c('0x67')][_0x999c('0x68')](function(_0x22f536){const _0x1fa726={'id':_0x5d3c9f};return db[_0x999c('0x17')]['findOne']({'attributes':['id',_0x999c('0x75'),_0x999c('0x7e')],'where':_0x1fa726,'transaction':_0x22f536,'lock':_0x22f536[_0x999c('0x76')][_0x999c('0x77')],'include':[{'model':db[_0x999c('0x78')],'as':_0x999c('0x79'),'attributes':_0x90eb9a,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x999c('0x13')]}]},{'model':db[_0x999c('0x7c')],'as':'List','attributes':['id',_0x999c('0x13')]},{'model':db[_0x999c('0x4a')],'as':_0x999c('0x7f'),'attributes':['id','name',_0x999c('0x7d')]}]})['then'](function(_0xb2bd6){if(_0xb2bd6){return _0xb2bd6[_0x999c('0xf')]({'UserId':_0x587177},{'transaction':_0x22f536});}});});})[_0x999c('0x10')](handleEntityNotFound(_0x4f6544,null))[_0x999c('0x10')](respondWithResult(_0x4f6544,null))[_0x999c('0x43')](handleError(_0x4f6544,null));};exports[_0x999c('0x80')]=function(_0x1e8931,_0x417e2f){return _0x1e8931['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x999c('0x81')},'attributes':['id'],'raw':!![]})[_0x999c('0x10')](function(_0x179493){if(_0x179493&&_0x179493[_0x999c('0x33')]){return db[_0x999c('0x17')][_0x999c('0xc')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x999c('0x56')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x999c('0x16')](_0x179493,'id')},'$or':[{'UserId':null},{'UserId':_0x1e8931[_0x999c('0x53')]['id']}]}});}return 0x0;})[_0x999c('0x10')](function(_0x103f75){if(!_[_0x999c('0x5d')](_0x103f75)&&_['isNumber'](_0x103f75)){return _0x417e2f[_0x999c('0x7')](0xc8)['json']({'contacts':_0x103f75});}else{logger[_0x999c('0x11')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,'entity\x20not\x20found');_0x417e2f[_0x999c('0x82')](0x194);}})['catch'](handleError(_0x417e2f,null));};exports[_0x999c('0x83')]=function(_0x38df92,_0xebac9f){var _0x57c1c6=shared[_0x999c('0x84')];var _0x3e2275=[];_[_0x999c('0x16')](_0x57c1c6,function(_0x2c7c28){_0x3e2275[_0x999c('0x85')]({'id':_0x2c7c28[_0x999c('0x13')],'name':_0x2c7c28[_0x999c('0x13')],'utcOffset':_0x2c7c28[_0x999c('0x86')]});});return _0xebac9f[_0x999c('0x7')](0xc8)[_0x999c('0x8')]({'tz':_0x3e2275});};exports['getTimezone']=function(_0x20888e,_0x353d2b){var _0x59d43e=shared[_0x999c('0x84')];var _0x4ddc1c={};if(!_[_0x999c('0x5d')](_0x59d43e[_0x20888e['body']['id']]))_0x4ddc1c=_0x59d43e[_0x20888e[_0x999c('0x45')]['id']];return _0x353d2b['status'](0xc8)[_0x999c('0x8')](_0x4ddc1c);}; \ No newline at end of file +var _0x89c3=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','concat','$or','$gt','$lt','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','Company','List','Queue','CmCompany','CmList','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','json','undefined','limit','count','offset','status','set','Content-Range','update','stack','name','send','map','CmHopper'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x89c3,0xff));var _0x389c=function(_0x3ea95e,_0xd17d2e){_0x3ea95e=_0x3ea95e-0x0;var _0x409b34=_0x89c3[_0x3ea95e];return _0x409b34;};'use strict';var moment=require(_0x389c('0x0'));var _=require(_0x389c('0x1'));var qs=require(_0x389c('0x2'));var logger=require(_0x389c('0x3'))(_0x389c('0x4'));var shared=require(_0x389c('0x5'));var db=require(_0x389c('0x6'))['db'];function respondWithResult(_0x3a2fa4,_0x5c6c68){_0x5c6c68=_0x5c6c68||0xc8;return function(_0x3742ad){if(_0x3742ad){return _0x3a2fa4['status'](_0x5c6c68)[_0x389c('0x7')](_0x3742ad);}};}function respondWithFilteredResult(_0x4bece6,_0x51f5f5){return function(_0x2f3e3f){if(_0x2f3e3f){var _0x4a83ab=typeof _0x51f5f5['offset']===_0x389c('0x8')&&typeof _0x51f5f5[_0x389c('0x9')]===_0x389c('0x8');var _0x2efa82=_0x2f3e3f[_0x389c('0xa')];var _0x1c574b=_0x4a83ab?0x0:_0x51f5f5[_0x389c('0xb')];var _0xd58faa=_0x4a83ab?_0x2f3e3f[_0x389c('0xa')]:_0x51f5f5['offset']+_0x51f5f5[_0x389c('0x9')];var _0xe6852f;if(_0xd58faa>=_0x2efa82){_0xd58faa=_0x2efa82;_0xe6852f=0xc8;}else{_0xe6852f=0xce;}_0x4bece6[_0x389c('0xc')](_0xe6852f);return _0x4bece6[_0x389c('0xd')](_0x389c('0xe'),_0x1c574b+'-'+_0xd58faa+'/'+_0x2efa82)['json'](_0x2f3e3f);}return null;};}function saveUpdates(_0x5d7aa7,_0x2a2d7d){return function(_0x1de33a){if(_0x1de33a){return _0x1de33a[_0x389c('0xf')](_0x5d7aa7)['then'](function(_0x3f2391){return _0x3f2391;});}return null;};}function handleEntityNotFound(_0x4bde6d,_0x36e855){return function(_0x1b1618){if(!_0x1b1618){_0x4bde6d['sendStatus'](0x194);}return _0x1b1618;};}function handleError(_0x1687f2,_0x205e4f){_0x205e4f=_0x205e4f||0x1f4;return function(_0x36c118){logger['error'](_0x36c118[_0x389c('0x10')]);if(_0x36c118[_0x389c('0x11')]){delete _0x36c118[_0x389c('0x11')];}_0x1687f2[_0x389c('0xc')](_0x205e4f)[_0x389c('0x12')](_0x36c118);};}exports['index']=function(_0x5b6ef8,_0x5a2b10){var _0x335c3e={},_0x2e23d2={},_0x55dc03={'count':0x0,'rows':[]};var _0x334f7a=_[_0x389c('0x13')](db[_0x389c('0x14')][_0x389c('0x15')],function(_0xbe8380){return{'name':_0xbe8380[_0x389c('0x16')],'type':_0xbe8380[_0x389c('0x17')][_0x389c('0x18')]};});_0x2e23d2[_0x389c('0x19')]=_['map'](_0x334f7a,_0x389c('0x11'));_0x2e23d2[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x5b6ef8[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1d')](_0x2e23d2['model'],_0x2e23d2[_0x389c('0x1a')]);_0x2e23d2[_0x389c('0x1c')]=_[_0x389c('0x1e')](_0x2e23d2[_0x389c('0x1c')],['$and',_0x389c('0x1f'),_0x389c('0x20'),'$gte',_0x389c('0x21'),'$lte',_0x389c('0x22'),_0x389c('0x23'),_0x389c('0x24'),_0x389c('0x25'),_0x389c('0x26'),'$in',_0x389c('0x27'),_0x389c('0x28'),_0x389c('0x29'),_0x389c('0x2a'),_0x389c('0x2b'),'$like',_0x389c('0x2c'),'$contains',_0x389c('0x2d'),_0x389c('0x2e')]);_0x335c3e[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x2e23d2['model'],qs[_0x389c('0x30')](_0x5b6ef8[_0x389c('0x1a')]['fields']));_0x335c3e[_0x389c('0x2f')]=_0x335c3e[_0x389c('0x2f')][_0x389c('0x31')]?_0x335c3e[_0x389c('0x2f')]:_0x2e23d2[_0x389c('0x19')];if(!_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x32')](_0x389c('0x33'))){_0x335c3e[_0x389c('0x9')]=qs[_0x389c('0x9')](_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x9')]);_0x335c3e['offset']=qs['offset'](_0x5b6ef8['query'][_0x389c('0xb')]);}_0x335c3e['order']=qs[_0x389c('0x34')](_0x5b6ef8['query'][_0x389c('0x34')]);_0x335c3e[_0x389c('0x35')]=qs[_0x389c('0x1c')](_[_0x389c('0x36')](_0x5b6ef8['query'],_0x2e23d2[_0x389c('0x1c')]),_0x334f7a);if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]){_0x335c3e[_0x389c('0x35')]=_[_0x389c('0x38')](_0x335c3e[_0x389c('0x35')],{'$or':_['map'](_0x334f7a,function(_0x5c84f9){if(_0x5c84f9[_0x389c('0x17')]!==_0x389c('0x39')){var _0x342dd9={};_0x342dd9[_0x5c84f9[_0x389c('0x11')]]={'$like':'%'+_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x37')]+'%'};return _0x342dd9;}})});}_0x335c3e=_[_0x389c('0x38')]({},_0x335c3e,_0x5b6ef8[_0x389c('0x3a')]);var _0x22341d={'where':_0x335c3e[_0x389c('0x35')]};return db[_0x389c('0x14')][_0x389c('0xa')](_0x22341d)[_0x389c('0x3b')](function(_0x55841a){_0x55dc03['count']=_0x55841a;if(_0x5b6ef8[_0x389c('0x1a')][_0x389c('0x3c')]){_0x335c3e[_0x389c('0x3d')]=[{'all':!![]}];}return db[_0x389c('0x14')][_0x389c('0x3e')](_0x335c3e);})[_0x389c('0x3b')](function(_0x58a7b1){_0x55dc03['rows']=_0x58a7b1;return _0x55dc03;})[_0x389c('0x3b')](respondWithFilteredResult(_0x5a2b10,_0x335c3e))[_0x389c('0x3f')](handleError(_0x5a2b10,null));};exports[_0x389c('0x40')]=function(_0x4d9ec4,_0x39dcd6){var _0x2884c4={'raw':!![],'where':{'id':_0x4d9ec4[_0x389c('0x41')]['id']}},_0x37f4d7={};_0x37f4d7[_0x389c('0x19')]=_[_0x389c('0x1b')](db['CmHopper'][_0x389c('0x15')]);_0x37f4d7[_0x389c('0x1a')]=_[_0x389c('0x1b')](_0x4d9ec4[_0x389c('0x1a')]);_0x37f4d7['filters']=_[_0x389c('0x1d')](_0x37f4d7['model'],_0x37f4d7[_0x389c('0x1a')]);_0x2884c4[_0x389c('0x2f')]=_[_0x389c('0x1d')](_0x37f4d7[_0x389c('0x19')],qs[_0x389c('0x30')](_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x30')]));_0x2884c4[_0x389c('0x2f')]=_0x2884c4[_0x389c('0x2f')][_0x389c('0x31')]?_0x2884c4[_0x389c('0x2f')]:_0x37f4d7['model'];if(_0x4d9ec4[_0x389c('0x1a')][_0x389c('0x3c')]){_0x2884c4['include']=[{'all':!![]}];}_0x2884c4=_[_0x389c('0x38')]({},_0x2884c4,_0x4d9ec4['options']);return db[_0x389c('0x14')][_0x389c('0x42')](_0x2884c4)[_0x389c('0x3b')](handleEntityNotFound(_0x39dcd6,null))[_0x389c('0x3b')](respondWithResult(_0x39dcd6,null))[_0x389c('0x3f')](handleError(_0x39dcd6,null));};exports[_0x389c('0x43')]=function(_0xc2ef3c,_0x15c23e){return db[_0x389c('0x14')][_0x389c('0x43')](_0xc2ef3c[_0x389c('0x44')],{})[_0x389c('0x3b')](respondWithResult(_0x15c23e,0xc9))[_0x389c('0x3f')](handleError(_0x15c23e,null));};exports['update']=function(_0x575a44,_0x1d8063){if(_0x575a44[_0x389c('0x44')]['id']){delete _0x575a44[_0x389c('0x44')]['id'];}return db['CmHopper'][_0x389c('0x42')]({'where':{'id':_0x575a44[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0x1d8063,null))[_0x389c('0x3b')](saveUpdates(_0x575a44['body'],null))['then'](respondWithResult(_0x1d8063,null))['catch'](handleError(_0x1d8063,null));};exports['describe']=function(_0x425ec4,_0x4a928c){return db['CmHopper'][_0x389c('0x45')]()[_0x389c('0x3b')](respondWithResult(_0x4a928c,null))[_0x389c('0x3f')](handleError(_0x4a928c,null));};exports[_0x389c('0x46')]=function(_0x153db2,_0xd37a48){var _0x3302b8;var _0x556928=_0x153db2[_0x389c('0x41')]['id'];return db[_0x389c('0x14')][_0x389c('0x42')]({'where':{'id':_0x153db2[_0x389c('0x41')]['id']}})[_0x389c('0x3b')](handleEntityNotFound(_0xd37a48,null))[_0x389c('0x3b')](function(_0x483eb8){if(_0x483eb8){return _0x483eb8[_0x389c('0x46')]()['then'](function(_0xf56fb2){return _0xf56fb2;});}})['then'](function(_0x26936d){_0x3302b8=_0x26936d;if(_0x26936d){if(_0x26936d[_0x389c('0x47')]||_0x26936d[_0x389c('0x48')]){return db[_0x26936d[_0x389c('0x47')]?_0x389c('0x49'):_0x389c('0x4a')]['find']({'where':{'id':_0x26936d[_0x389c('0x47')]?_0x26936d[_0x389c('0x47')]:_0x26936d['CampaignId']},'attributes':['id',_0x389c('0x11')],'raw':!![]});}}})[_0x389c('0x3b')](function(_0x8fe5fd){var _0x4a9519={};if(_0x8fe5fd){_[_0x389c('0x38')](_0x4a9519,_[_0x389c('0x4b')](_0x3302b8['dataValues'],[_0x389c('0x4c'),_0x389c('0x4d'),'id']));_0x4a9519['state']=0x15;_0x4a9519[_0x389c('0x4e')]=_0x389c('0x4f');_0x4a9519[_0x389c('0x50')]=_0x8fe5fd[_0x389c('0x11')];_0x4a9519[_0x389c('0x51')]=_0x153db2[_0x389c('0x52')][_0x389c('0x11')];_0x4a9519[_0x389c('0x53')]=_0x153db2[_0x389c('0x52')]['id'];_0x4a9519[_0x389c('0x4f')]=!![];_0x4a9519['deletedat']=moment()[_0x389c('0x54')](_0x389c('0x55'));_0x4a9519[_0x389c('0x56')]=_0x3302b8['phone'];_0x4a9519[_0x389c('0x57')]=_0x3302b8['VoiceQueueId']?'queue':_0x389c('0x58');return db[_0x389c('0x59')][_0x389c('0x42')]({'where':{'id':_0x4a9519[_0x389c('0x5a')]},'attributes':[_0x389c('0x5b'),'lastName']})[_0x389c('0x3b')](function(_0x4a203d){if(!_[_0x389c('0x5c')](_0xd37a48)&&!_['isNil'](_0x4a203d[_0x389c('0x5b')])){_0x4a9519[_0x389c('0x5d')]=_0x4a203d[_0x389c('0x5b')];if(!_[_0x389c('0x5c')](_0x4a203d['lastName'])){_0x4a9519[_0x389c('0x5d')]+='\x20'+_0x4a203d[_0x389c('0x5e')];}}})[_0x389c('0x5f')](function(){return db[_0x389c('0x60')][_0x389c('0x43')](_0x4a9519);});}})['then'](function(_0x5359f5){return db[_0x389c('0x61')]['destroy']({'where':{'CmHopperId':_0x556928}});})[_0x389c('0x3b')](function(){return _0xd37a48[_0x389c('0xc')](0xcc)[_0x389c('0x62')]();})['catch'](handleError(_0xd37a48,null));};exports[_0x389c('0x63')]=function(_0x4bfe42,_0x18d3d7){var _0x5e24a6=[];return db[_0x389c('0x59')]['describe']()[_0x389c('0x3b')](function(_0x1568d4){_0x5e24a6=_[_0x389c('0x1b')](_0x1568d4);return _0x4bfe42[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':_0x389c('0x64'),'dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id','dialOrderByScheduledAt',_0x389c('0x66')],'raw':!![]});})['then'](function(_0x4cbb3d){if(_0x4cbb3d&&_0x4cbb3d[_0x389c('0x31')]){return db[_0x389c('0x67')][_0x389c('0x68')](function(_0x4ce5fd){var _0x4648aa={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x4cbb3d,'id')},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2dcdb7={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4cbb3d)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x389c('0x13')]('id')[_0x389c('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x4bfe42['user']['id']}]};var _0x2aecff={'$or':[_0x4648aa,_0x2dcdb7]};var _0x15cc59=[];if(_0x4bfe42['body']['direction']&&_0x4bfe42[_0x389c('0x44')][_0x389c('0x6a')]===_0x389c('0x6b')){if(!_[_0x389c('0x6c')](_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')])){_0x2aecff['id']={'$in':_0x4bfe42[_0x389c('0x44')][_0x389c('0x6d')]};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x6f')],[_0x389c('0x70'),_0x4cbb3d[0x0]['dialOrderByScheduledAt']===_0x389c('0x6f')?_0x389c('0x71'):_0x389c('0x6f')],db['sequelize'][_0x389c('0x72')](_0x389c('0x73')),['id',_0x389c('0x71')]];}else{if(!_[_0x389c('0x6c')](_0x4bfe42['body'][_0x389c('0x6d')])){_0x2aecff['id']={'$notIn':_0x4bfe42[_0x389c('0x44')]['hopperIds']};}_0x15cc59=[[_0x389c('0x6e'),_0x389c('0x71')],[_0x389c('0x70'),_0x4cbb3d[0x0][_0x389c('0x74')]],db[_0x389c('0x67')][_0x389c('0x72')](_0x389c('0x75')),['id',_0x389c('0x6f')]];}return db[_0x389c('0x14')][_0x389c('0x76')]({'attributes':['id',_0x389c('0x77'),'phone',_0x389c('0x78')],'where':_0x2aecff,'order':_0x15cc59,'transaction':_0x4ce5fd,'lock':_0x4ce5fd['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0x5e24a6,'include':[{'model':db['CmCompany'],'as':_0x389c('0x7b'),'attributes':['id',_0x389c('0x11')]}]},{'model':db['CmList'],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),'dialActive']}]})['then'](function(_0x29dea4){if(_0x29dea4){return _0x29dea4[_0x389c('0xf')]({'UserId':_0x4bfe42[_0x389c('0x52')]['id']},{'transaction':_0x4ce5fd});}});});}})[_0x389c('0x3b')](handleEntityNotFound(_0x18d3d7,null))[_0x389c('0x3b')](respondWithResult(_0x18d3d7,null))[_0x389c('0x3f')](handleError(_0x18d3d7,null));};exports['getPreviewRecall']=function(_0x442696,_0x3c9a56,_0x135ebd){var _0xe3b7b2=[];var _0x58885f=_0x442696[_0x389c('0x41')]['id'];var _0x4ec383=_0x442696[_0x389c('0x52')]['id'];return db[_0x389c('0x59')][_0x389c('0x45')]()[_0x389c('0x3b')](function(_0xa82c9){_0xe3b7b2=_[_0x389c('0x1b')](_0xa82c9);return db['sequelize']['transaction'](function(_0x2ba48e){const _0xd258a5={'id':_0x58885f};return db[_0x389c('0x14')]['findOne']({'attributes':['id',_0x389c('0x77'),_0x389c('0x78')],'where':_0xd258a5,'transaction':_0x2ba48e,'lock':_0x2ba48e['LOCK'][_0x389c('0x79')],'include':[{'model':db[_0x389c('0x59')],'as':_0x389c('0x7a'),'attributes':_0xe3b7b2,'include':[{'model':db[_0x389c('0x7e')],'as':_0x389c('0x7b'),'attributes':['id','name']}]},{'model':db[_0x389c('0x7f')],'as':_0x389c('0x7c'),'attributes':['id','name']},{'model':db[_0x389c('0x49')],'as':_0x389c('0x7d'),'attributes':['id',_0x389c('0x11'),_0x389c('0x80')]}]})[_0x389c('0x3b')](function(_0x255cfd){if(_0x255cfd){return _0x255cfd[_0x389c('0xf')]({'UserId':_0x4ec383},{'transaction':_0x2ba48e});}});});})[_0x389c('0x3b')](handleEntityNotFound(_0x3c9a56,null))['then'](respondWithResult(_0x3c9a56,null))[_0x389c('0x3f')](handleError(_0x3c9a56,null));};exports[_0x389c('0x81')]=function(_0x268d7d,_0x2c21ce){return _0x268d7d[_0x389c('0x52')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x389c('0x65')},'attributes':['id'],'raw':!![]})[_0x389c('0x3b')](function(_0x63cb59){if(_0x63cb59&&_0x63cb59[_0x389c('0x31')]){return db['CmHopper'][_0x389c('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x389c('0x54')](_0x389c('0x55'))},'VoiceQueueId':{'$in':_[_0x389c('0x13')](_0x63cb59,'id')},'$or':[{'UserId':null},{'UserId':_0x268d7d[_0x389c('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x5dc5fc){if(!_[_0x389c('0x5c')](_0x5dc5fc)&&_[_0x389c('0x82')](_0x5dc5fc)){return _0x2c21ce[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'contacts':_0x5dc5fc});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s',_0x389c('0x81'),0x194,_0x389c('0x83'));_0x2c21ce[_0x389c('0x84')](0x194);}})[_0x389c('0x3f')](handleError(_0x2c21ce,null));};exports[_0x389c('0x85')]=function(_0x4158d0,_0x589598){var _0x1f8960=shared[_0x389c('0x86')];var _0x3c2a60=[];_[_0x389c('0x13')](_0x1f8960,function(_0x458c31){_0x3c2a60[_0x389c('0x87')]({'id':_0x458c31['name'],'name':_0x458c31[_0x389c('0x11')],'utcOffset':_0x458c31[_0x389c('0x88')]});});return _0x589598[_0x389c('0xc')](0xc8)[_0x389c('0x7')]({'tz':_0x3c2a60});};exports[_0x389c('0x89')]=function(_0x3d2817,_0x2ea6d8){var _0x34adf5=shared[_0x389c('0x86')];var _0x5589b3={};if(!_[_0x389c('0x5c')](_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']]))_0x5589b3=_0x34adf5[_0x3d2817[_0x389c('0x44')]['id']];return _0x2ea6d8[_0x389c('0xc')](0xc8)[_0x389c('0x7')](_0x5589b3);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 01170a3..d9fba25 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 _0xafc4=['priority','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','CmHopper','cm_hopper','scheduledat','phone'];(function(_0x41a3de,_0x5dc963){var _0x570f43=function(_0x139f9a){while(--_0x139f9a){_0x41a3de['push'](_0x41a3de['shift']());}};_0x570f43(++_0x5dc963);}(_0xafc4,0x69));var _0x4afc=function(_0x535d32,_0x5aec8b){_0x535d32=_0x535d32-0x0;var _0x6e8424=_0xafc4[_0x535d32];return _0x6e8424;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x4afc('0x6')]=function(_0x471d45,_0x16953b){return _0x471d45[_0x4afc('0x7')](_0x4afc('0x8'),attributes,{'tableName':_0x4afc('0x9'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x4afc('0xa')]},{'name':_0x4afc('0xb'),'fields':[_0x4afc('0xb')]},{'name':_0x4afc('0xc'),'fields':[_0x4afc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabce=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','define','cm_hopper','scheduledat','phone','priority','lodash'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xabce,0x103));var _0xeabc=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xabce[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var logger=require(_0xeabc('0x2'))(_0xeabc('0x3'));var moment=require(_0xeabc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeabc('0x5'));var rimraf=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x1b07a8,_0x52a4d7){return _0x1b07a8[_0xeabc('0x8')]('CmHopper',attributes,{'tableName':_0xeabc('0x9'),'paranoid':![],'indexes':[{'name':_0xeabc('0xa'),'fields':[_0xeabc('0xa')]},{'name':'phone','fields':[_0xeabc('0xb')]},{'name':_0xeabc('0xc'),'fields':[_0xeabc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a2c612b..fcbdd48 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 _0x8871=['Contact','keys','Agent','name','voicePause','length','UserId','push','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','create','sequelize','COUNT','literal','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','CmContact','GetCmHopperPreview','GetContactByPhone','findOne','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','CmList','NOW()','lodash','util','moment','bluebird','rpc','jayson/promise','client','http','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','model','map','ShowCmHopper','find','CreateCmHopper','body','update','UpdateCmHopper','active','DestroyCmHopper','destroy','GetContactDialer','describe','transaction','order','LOCK','UPDATE'];(function(_0x4953da,_0x5adaca){var _0x2d3780=function(_0x458f36){while(--_0x458f36){_0x4953da['push'](_0x4953da['shift']());}};_0x2d3780(++_0x5adaca);}(_0x8871,0x7a));var _0x1887=function(_0x133f36,_0x5047f5){_0x133f36=_0x133f36-0x0;var _0x1120b1=_0x8871[_0x133f36];return _0x1120b1;};'use strict';var _=require(_0x1887('0x0'));var util=require(_0x1887('0x1'));var moment=require(_0x1887('0x2'));var BPromise=require(_0x1887('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0x1887('0x4'));var jayson=require(_0x1887('0x5'));var client=jayson[_0x1887('0x6')][_0x1887('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3646f1,_0x5b9578,_0x36c20f){return new BPromise(function(_0x262fc3,_0x279f21){return client['request'](_0x3646f1,_0x36c20f)[_0x1887('0x8')](function(_0x220829){logger['info'](_0x1887('0x9'),_0x5b9578,'request\x20sent');logger[_0x1887('0xa')](_0x1887('0xb'),_0x5b9578,_0x1887('0xc'),JSON[_0x1887('0xd')](_0x220829));if(_0x220829[_0x1887('0xe')]){if(_0x220829[_0x1887('0xe')][_0x1887('0xf')]===0x1f4){logger['error'](_0x1887('0x9'),_0x5b9578,_0x220829[_0x1887('0xe')][_0x1887('0x10')]);return _0x279f21(_0x220829[_0x1887('0xe')]['message']);}logger[_0x1887('0xe')](_0x1887('0x9'),_0x5b9578,_0x220829['error'][_0x1887('0x10')]);return _0x262fc3(_0x220829['error'][_0x1887('0x10')]);}else{logger[_0x1887('0x11')](_0x1887('0x9'),_0x5b9578,_0x1887('0xc'));_0x262fc3(_0x220829[_0x1887('0x12')][_0x1887('0x10')]);}})[_0x1887('0x13')](function(_0x1efa1c){logger[_0x1887('0xe')]('CmHopper,\x20%s,\x20%s',_0x5b9578,_0x1efa1c);_0x279f21(_0x1efa1c);});});}exports[_0x1887('0x14')]=function(_0xa46d73){var _0x144b9f=this;return new Promise(function(_0x27402d,_0x6cbe30){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1b')]||null:null,'include':_0xa46d73[_0x1887('0x17')]?_0xa46d73[_0x1887('0x17')][_0x1887('0x1c')]?_['map'](_0xa46d73[_0x1887('0x17')]['include'],function(_0x4deda3){return{'model':db[_0x4deda3[_0x1887('0x1d')]],'as':_0x4deda3['as'],'attributes':_0x4deda3[_0x1887('0x1a')],'include':_0x4deda3[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x4deda3[_0x1887('0x1c')],function(_0x43aa75){return{'model':db[_0x43aa75[_0x1887('0x1d')]],'as':_0x43aa75['as'],'attributes':_0x43aa75['attributes'],'include':_0x43aa75[_0x1887('0x1c')]?_['map'](_0x43aa75[_0x1887('0x1c')],function(_0x200296){return{'model':db[_0x200296[_0x1887('0x1d')]],'as':_0x200296['as'],'attributes':_0x200296[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x7ac29a){logger[_0x1887('0x11')](_0x1887('0x14'),_0xa46d73);logger['debug'](_0x1887('0x14'),_0xa46d73,JSON['stringify'](_0x7ac29a));_0x27402d(_0x7ac29a);})[_0x1887('0x13')](function(_0x597845){logger[_0x1887('0xe')]('GetCmHopper',_0x597845[_0x1887('0x10')],_0xa46d73);_0x6cbe30(_0x144b9f[_0x1887('0xe')](0x1f4,_0x597845[_0x1887('0x10')]));});});};exports[_0x1887('0x1f')]=function(_0xf16fe7){var _0x23b031=this;return new Promise(function(_0x1dbcf5,_0xfffd99){return db[_0x1887('0x15')][_0x1887('0x20')]({'raw':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'include':_0xf16fe7[_0x1887('0x17')]?_0xf16fe7[_0x1887('0x17')][_0x1887('0x1c')]?_[_0x1887('0x1e')](_0xf16fe7['options'][_0x1887('0x1c')],function(_0x6760bf){return{'model':db[_0x6760bf[_0x1887('0x1d')]],'as':_0x6760bf['as'],'attributes':_0x6760bf[_0x1887('0x1a')],'include':_0x6760bf[_0x1887('0x1c')]?_['map'](_0x6760bf[_0x1887('0x1c')],function(_0x35ff50){return{'model':db[_0x35ff50['model']],'as':_0x35ff50['as'],'attributes':_0x35ff50['attributes'],'include':_0x35ff50[_0x1887('0x1c')]?_['map'](_0x35ff50[_0x1887('0x1c')],function(_0xb614d5){return{'model':db[_0xb614d5['model']],'as':_0xb614d5['as'],'attributes':_0xb614d5[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x4e4f61){logger['info'](_0x1887('0x1f'),_0xf16fe7);logger[_0x1887('0xa')]('ShowCmHopper',_0xf16fe7,JSON[_0x1887('0xd')](_0x4e4f61));_0x1dbcf5(_0x4e4f61);})[_0x1887('0x13')](function(_0x58104a){logger[_0x1887('0xe')](_0x1887('0x1f'),_0x58104a[_0x1887('0x10')],_0xf16fe7);_0xfffd99(_0x23b031[_0x1887('0xe')](0x1f4,_0x58104a[_0x1887('0x10')]));});});};exports[_0x1887('0x21')]=function(_0x29fd72){var _0x2540e1=this;return new Promise(function(_0x108540,_0x2809a1){return db[_0x1887('0x15')]['create'](_0x29fd72[_0x1887('0x22')],{'raw':_0x29fd72['options']?_0x29fd72['options'][_0x1887('0x18')]===undefined?!![]:![]:!![]})[_0x1887('0x8')](function(_0x5b575c){logger[_0x1887('0x11')]('CreateCmHopper',_0x29fd72);logger[_0x1887('0xa')]('CreateCmHopper',_0x29fd72,JSON[_0x1887('0xd')](_0x5b575c));_0x108540(_0x5b575c);})[_0x1887('0x13')](function(_0x347959){logger[_0x1887('0xe')](_0x1887('0x21'),_0x347959[_0x1887('0x10')],_0x29fd72);_0x2809a1(_0x2540e1['error'](0x1f4,_0x347959['message']));});});};exports['UpdateCmHopper']=function(_0xcbd82b){var _0x4d64b4=this;return new Promise(function(_0x25a8a1,_0x14956d){return db[_0x1887('0x15')][_0x1887('0x23')](_0xcbd82b[_0x1887('0x22')],{'raw':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcbd82b['options']?_0xcbd82b['options'][_0x1887('0x19')]||null:null,'attributes':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0xcbd82b[_0x1887('0x17')]?_0xcbd82b[_0x1887('0x17')][_0x1887('0x1b')]||null:null})['then'](function(_0x15caab){logger['info'](_0x1887('0x24'),_0xcbd82b);logger[_0x1887('0x11')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1887('0xd')](_0xcbd82b[_0x1887('0x17')][_0x1887('0x19')]),_0xcbd82b['body'][_0x1887('0x25')]);logger['debug'](_0x1887('0x24'),_0xcbd82b,JSON[_0x1887('0xd')](_0x15caab));_0x25a8a1(_0x15caab);})[_0x1887('0x13')](function(_0x53b0ee){logger[_0x1887('0xe')](_0x1887('0x24'),_0x53b0ee[_0x1887('0x10')],_0xcbd82b);_0x14956d(_0x4d64b4[_0x1887('0xe')](0x1f4,_0x53b0ee[_0x1887('0x10')]));});});};exports[_0x1887('0x26')]=function(_0x346961){var _0x5cf98e=this;return new Promise(function(_0x2365b0,_0x2ac10c){return db[_0x1887('0x15')][_0x1887('0x27')]({'where':_0x346961[_0x1887('0x17')]?_0x346961['options'][_0x1887('0x19')]||null:null})[_0x1887('0x8')](function(_0x55c96a){logger[_0x1887('0x11')](_0x1887('0x26'),_0x346961);logger[_0x1887('0xa')](_0x1887('0x26'),_0x346961,JSON[_0x1887('0xd')](_0x55c96a));_0x2365b0(_0x55c96a);})[_0x1887('0x13')](function(_0xae620d){logger[_0x1887('0xe')](_0x1887('0x26'),_0xae620d[_0x1887('0x10')],_0x346961);_0x2ac10c(_0x5cf98e['error'](0x1f4,_0xae620d[_0x1887('0x10')]));});});};exports[_0x1887('0x28')]=function(_0x2ef748){var _0x4a12f3=this;return new Promise(function(_0x8b98e9,_0x5f1272){return db['CmContact'][_0x1887('0x29')]()[_0x1887('0x8')](function(_0x4483ce){return db['sequelize'][_0x1887('0x2a')](function(_0x340fa0){return db[_0x1887('0x15')][_0x1887('0x16')]({'where':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')]['attributes']||null:null,'limit':_0x2ef748[_0x1887('0x17')]?_0x2ef748['options'][_0x1887('0x1b')]||null:null,'order':_0x2ef748[_0x1887('0x17')]?_0x2ef748[_0x1887('0x17')][_0x1887('0x2b')]||null:null,'transaction':_0x340fa0,'lock':_0x340fa0[_0x1887('0x2c')][_0x1887('0x2d')],'include':[{'model':db['CmContact'],'as':_0x1887('0x2e'),'attributes':_[_0x1887('0x2f')](_0x4483ce)},{'model':db['User'],'as':_0x1887('0x30'),'attributes':['id',_0x1887('0x31'),_0x1887('0x32')]}]})[_0x1887('0x8')](function(_0x1ff07c){var _0x23fb65=[];var _0x580cbd=[];for(var _0x9a5010=0x0;_0x9a5010<_0x1ff07c[_0x1887('0x33')];_0x9a5010+=0x1){var _0x4ec0bd=_0x1ff07c[_0x9a5010][_0x1887('0x34')];if(_0x4ec0bd===null){_0x23fb65[_0x1887('0x35')](_0x1ff07c[_0x9a5010]['update'](_0x2ef748[_0x1887('0x22')],{'transaction':_0x340fa0}));}else if(!_0x580cbd['includes'](_0x4ec0bd)){_0x580cbd[_0x1887('0x35')](_0x4ec0bd);_0x23fb65[_0x1887('0x35')](_0x1ff07c[_0x9a5010][_0x1887('0x23')](_0x2ef748[_0x1887('0x22')],{'transaction':_0x340fa0}));}}return BPromise[_0x1887('0x36')](_0x23fb65);});})[_0x1887('0x8')](function(_0x5832d6){logger[_0x1887('0x11')](_0x1887('0x28'),_0x2ef748);if(_0x5832d6['length']>0x0){logger[_0x1887('0x11')](_0x1887('0x37'),_0x5832d6[0x0][_0x1887('0x38')]['id'],_0x5832d6[0x0][_0x1887('0x38')][_0x1887('0x39')],_0x5832d6[0x0][_0x1887('0x38')][_0x1887('0x25')]);}logger[_0x1887('0xa')](_0x1887('0x28'),_0x2ef748,JSON[_0x1887('0xd')](_0x5832d6));_0x8b98e9(_0x5832d6);})[_0x1887('0x13')](function(_0x590b8a){logger[_0x1887('0xe')]('GetContactDialer',_0x590b8a[_0x1887('0x10')],_0x2ef748);_0x5f1272(_0x4a12f3['error'](0x1f4,_0x590b8a[_0x1887('0x10')]));});});});};exports[_0x1887('0x3a')]=function(_0x5c9d08){var _0x2b92f8=this;return new Promise(function(_0x4b594d,_0x4f69e9){return db['sequelize']['transaction'](function(_0x447bf3){return db['CmHopperFinal'][_0x1887('0x3b')](_0x5c9d08[_0x1887('0x22')],{'raw':_0x5c9d08[_0x1887('0x17')]?_0x5c9d08[_0x1887('0x17')]['raw']===undefined?!![]:![]:!![],'transaction':_0x447bf3})[_0x1887('0x8')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5c9d08['options'][_0x1887('0x19')]),_0x5c9d08[_0x1887('0x17')][_0x1887('0x19')][_0x1887('0x25')]);return db[_0x1887('0x15')]['destroy']({'where':_0x5c9d08[_0x1887('0x17')]?_0x5c9d08[_0x1887('0x17')][_0x1887('0x19')]||null:null,'transaction':_0x447bf3});});})['then'](function(_0x308d3e){logger[_0x1887('0x11')](_0x1887('0x3a'),_0x5c9d08);logger[_0x1887('0xa')](_0x1887('0x3a'),_0x5c9d08,JSON[_0x1887('0xd')](_0x308d3e));_0x4b594d(_0x308d3e);})[_0x1887('0x13')](function(_0x24c06d){logger['error'](_0x1887('0x3a'),_0x24c06d['message'],_0x5c9d08);_0x4f69e9(_0x2b92f8[_0x1887('0xe')](0x1f4,_0x24c06d[_0x1887('0x10')]));});});};exports['CountReScheduled']=function(_0x16bbc0){var _0x26a322=this;return new Promise(function(_0x113f8e,_0x347fe8){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0x16bbc0[_0x1887('0x17')]?_0x16bbc0[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0x16bbc0['options']?_0x16bbc0[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':[[db[_0x1887('0x3c')]['fn'](_0x1887('0x3d'),db[_0x1887('0x3c')]['fn']('IF',db[_0x1887('0x3c')][_0x1887('0x3e')]('`scheduledat`\x20>=\x20'+util[_0x1887('0x3f')](_0x1887('0x40'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x1887('0x41')))),_0x1887('0x42')]]})[_0x1887('0x8')](function(_0x346151){logger[_0x1887('0x11')](_0x1887('0x43'),_0x16bbc0);logger[_0x1887('0xa')](_0x1887('0x43'),_0x16bbc0,JSON[_0x1887('0xd')](_0x346151));_0x113f8e(_0x346151);})['catch'](function(_0x2e3565){logger[_0x1887('0xe')](_0x1887('0x43'),_0x2e3565[_0x1887('0x10')],_0x16bbc0);_0x347fe8(_0x26a322[_0x1887('0xe')](0x1f4,_0x2e3565[_0x1887('0x10')]));});});};exports[_0x1887('0x44')]=function(_0x2ed326){var _0x4715f2=this;return new Promise(function(_0x435c93,_0x2addfd){return db[_0x1887('0x45')]['describe']()[_0x1887('0x8')](function(_0x105213){return db[_0x1887('0x3c')]['transaction'](function(_0xac6eae){return db['CmHopper']['findAll']({'where':_0x2ed326[_0x1887('0x17')]?_0x2ed326[_0x1887('0x17')]['where']||null:null,'attributes':_0x2ed326['options']?_0x2ed326[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':0x1,'order':_0x2ed326[_0x1887('0x17')]?_0x2ed326[_0x1887('0x17')][_0x1887('0x2b')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xac6eae,'lock':_0xac6eae['LOCK'][_0x1887('0x2d')],'include':_0x2ed326['options']?_0x2ed326[_0x1887('0x17')][_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x2ed326[_0x1887('0x17')][_0x1887('0x1c')],function(_0x3ba05d){return{'model':db[_0x3ba05d[_0x1887('0x1d')]],'as':_0x3ba05d['as'],'attributes':_0x3ba05d[_0x1887('0x1a')],'include':_0x3ba05d[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x3ba05d[_0x1887('0x1c')],function(_0x326602){return{'model':db[_0x326602[_0x1887('0x1d')]],'as':_0x326602['as'],'attributes':_0x326602['attributes'],'include':_0x326602['include']?_[_0x1887('0x1e')](_0x326602[_0x1887('0x1c')],function(_0x51e59e){return{'model':db[_0x51e59e[_0x1887('0x1d')]],'as':_0x51e59e['as'],'attributes':_0x51e59e[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x38bea3){var _0x9f221=[];for(var _0x209756=0x0;_0x209756<_0x38bea3[_0x1887('0x33')];_0x209756+=0x1){_0x9f221[_0x1887('0x35')](_0x38bea3[_0x209756][_0x1887('0x23')](_0x2ed326[_0x1887('0x22')],{'transaction':_0xac6eae}));}return BPromise[_0x1887('0x36')](_0x9f221);});})[_0x1887('0x8')](function(_0x438c20){logger[_0x1887('0x11')]('GetContactRecallMe',_0x2ed326);logger[_0x1887('0xa')]('GetContactRecallMe',_0x2ed326,JSON['stringify'](_0x438c20));_0x435c93(_0x438c20);})['catch'](function(_0x5e3092){logger[_0x1887('0xe')](_0x1887('0x44'),_0x5e3092['message'],_0x2ed326);_0x2addfd(_0x4715f2[_0x1887('0xe')](0x1f4,_0x5e3092[_0x1887('0x10')]));});});});};exports[_0x1887('0x46')]=function(_0x21f286){var _0x3b4d8f=this;return new Promise(function(_0x10802b,_0x656f30){db[_0x1887('0x45')][_0x1887('0x29')]()[_0x1887('0x8')](function(_0x5c7de6){return db[_0x1887('0x15')][_0x1887('0x16')]({'raw':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x18')]===undefined?!![]:![]:!![],'where':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x19')]||null:null,'attributes':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x1a')]||null:null,'limit':_0x21f286[_0x1887('0x17')]?_0x21f286[_0x1887('0x17')][_0x1887('0x1b')]||null:null,'include':_0x21f286['options']?_0x21f286[_0x1887('0x17')][_0x1887('0x1c')]?_['map'](_0x21f286['options'][_0x1887('0x1c')],function(_0x2afd86){return{'model':db[_0x2afd86[_0x1887('0x1d')]],'as':_0x2afd86['as'],'attributes':_0x2afd86['as']===_0x1887('0x2e')?_['keys'](_0x5c7de6):_0x2afd86['attributes'],'include':_0x2afd86[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x2afd86[_0x1887('0x1c')],function(_0x46a6d8){return{'model':db[_0x46a6d8['model']],'as':_0x46a6d8['as'],'attributes':_0x46a6d8[_0x1887('0x1a')],'include':_0x46a6d8[_0x1887('0x1c')]?_[_0x1887('0x1e')](_0x46a6d8['include'],function(_0xbd7227){return{'model':db[_0xbd7227[_0x1887('0x1d')]],'as':_0xbd7227['as'],'attributes':_0xbd7227[_0x1887('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1887('0x8')](function(_0x3ff626){logger[_0x1887('0x11')](_0x1887('0x14'),_0x21f286);logger[_0x1887('0xa')]('GetCmHopper',_0x21f286,JSON[_0x1887('0xd')](_0x3ff626));_0x10802b(_0x3ff626);})[_0x1887('0x13')](function(_0x5aa806){logger['error']('GetCmHopper',_0x5aa806['message'],_0x21f286);_0x656f30(_0x3b4d8f['error'](0x1f4,_0x5aa806['message']));});});});};exports[_0x1887('0x47')]=function(_0x431e68){var _0x4f95a3=this;return new Promise(function(_0x56e1be,_0x29a9bf){return db[_0x1887('0x45')][_0x1887('0x48')]({'raw':!![],'where':{'phone':_0x431e68[_0x1887('0x17')][_0x1887('0x19')]['phone']},'attributes':['id',_0x1887('0x49')],'order':[['id',_0x1887('0x4a')]]})['then'](function(_0x2c1f03){logger[_0x1887('0x11')]('getContactByPhone',_0x431e68);logger[_0x1887('0xa')]('getContactByPhone',_0x431e68,JSON[_0x1887('0xd')](_0x2c1f03));_0x56e1be(_0x2c1f03);})['catch'](function(_0x2dbcfc){logger['error'](_0x1887('0x4b'),_0x2dbcfc[_0x1887('0x10')],_0x431e68);_0x29a9bf(_0x4f95a3[_0x1887('0xe')](0x1f4,_0x2dbcfc[_0x1887('0x10')]));});});};exports[_0x1887('0x4c')]=function(_0x21b94d){var _0xe6772=this;return new Promise(function(_0x337cb7,_0x2308a0){return db['sequelize'][_0x1887('0x2a')](function(_0x5e9840){return db['CmHopper'][_0x1887('0x23')](_0x21b94d[_0x1887('0x22')],{'where':{},'transaction':_0x5e9840})[_0x1887('0x8')](function(_0x31aea4){logger[_0x1887('0x11')](_0x1887('0x4c'),_0x21b94d);logger[_0x1887('0xa')](_0x1887('0x4c'),_0x21b94d,JSON[_0x1887('0xd')](_0x31aea4));_0x337cb7(_0x31aea4);})[_0x1887('0x13')](function(_0x38feee){logger[_0x1887('0xe')](_0x1887('0x4c'),_0x38feee[_0x1887('0x10')],_0x21b94d);_0x2308a0(_0xe6772[_0x1887('0xe')](0x1f4,_0x38feee[_0x1887('0x10')]));});});});};exports[_0x1887('0x4d')]=function(_0xc4c4b2){var _0x1acebf=this;var _0x5dd155=_0xc4c4b2[_0x1887('0x22')][_0x1887('0x19')][_0x1887('0x4e')];var _0x4191c3=_0xc4c4b2[_0x1887('0x22')]['where'][_0x1887('0x4f')];var _0x3ac134=_0xc4c4b2[_0x1887('0x22')][_0x1887('0x19')][_0x1887('0x50')];return new Promise(function(_0x9caa5c,_0x44c785){return db[_0x1887('0x15')]['findAll']({'where':{'voiceQueueId':{'$in':_0x5dd155},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1887('0x3c')]['literal']('NOW()\x20+\x20INTERVAL\x20'+_0x4191c3+_0x1887('0x51')),'$gt':db[_0x1887('0x3c')][_0x1887('0x3e')]('NOW()')}},'UserId':{'$in':_0x3ac134}},'include':[{'model':db[_0x1887('0x45')],'as':'Contact'},{'model':db['User'],'as':_0x1887('0x30'),'attributes':['id','name',_0x1887('0x32')]},{'model':db[_0x1887('0x52')],'as':'List'}]})['then'](function(_0x3bf6dc){if(_0x3bf6dc[_0x1887('0x33')]>0x0){return db['sequelize'][_0x1887('0x2a')](function(_0x4028da){return db[_0x1887('0x15')][_0x1887('0x23')]({'recallmeNotifiedDate':db['sequelize'][_0x1887('0x3e')](_0x1887('0x53'))},{'where':{'id':{'$in':_[_0x1887('0x1e')](_0x3bf6dc,'id')}},'transaction':_0x4028da})[_0x1887('0x8')](function(){_0x9caa5c(_0x3bf6dc);})[_0x1887('0x13')](function(_0xc83e9a){logger['error'](_0x1887('0x4d'),_0xc83e9a['message'],_0xc4c4b2);_0x44c785(_0x1acebf[_0x1887('0xe')](0x1f4,_0xc83e9a[_0x1887('0x10')]));});})[_0x1887('0x13')](function(_0x20a723){logger[_0x1887('0xe')](_0x1887('0x4d'),_0x20a723['message'],_0xc4c4b2);_0x44c785(_0x1acebf['error'](0x1f4,_0x20a723[_0x1887('0x10')]));});}else{_0x9caa5c(_0x3bf6dc);}});});}; \ No newline at end of file +var _0x29d2=['catch','ShowCmHopper','find','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','sequelize','transaction','order','UPDATE','Contact','Agent','voicePause','includes','push','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','CmContact','describe','UserId','LOCK','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetCmHopper','CmHopper','findAll','options','raw','where','limit','include','map','attributes','model'];(function(_0x2c3609,_0x412199){var _0x461da2=function(_0x5c8284){while(--_0x5c8284){_0x2c3609['push'](_0x2c3609['shift']());}};_0x461da2(++_0x412199);}(_0x29d2,0x1a7));var _0x229d=function(_0x5a1cf0,_0x5cf6ba){_0x5a1cf0=_0x5a1cf0-0x0;var _0xbf247a=_0x29d2[_0x5a1cf0];return _0xbf247a;};'use strict';var _=require(_0x229d('0x0'));var util=require('util');var moment=require(_0x229d('0x1'));var BPromise=require(_0x229d('0x2'));var db=require(_0x229d('0x3'))['db'];var logger=require(_0x229d('0x4'))(_0x229d('0x5'));var jayson=require(_0x229d('0x6'));var client=jayson[_0x229d('0x7')][_0x229d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2411b1,_0x2ba4a8,_0x517826){return new BPromise(function(_0x5286f1,_0x380873){return client[_0x229d('0x9')](_0x2411b1,_0x517826)[_0x229d('0xa')](function(_0x575bc6){logger['info'](_0x229d('0xb'),_0x2ba4a8,'request\x20sent');logger[_0x229d('0xc')](_0x229d('0xd'),_0x2ba4a8,_0x229d('0xe'),JSON[_0x229d('0xf')](_0x575bc6));if(_0x575bc6[_0x229d('0x10')]){if(_0x575bc6[_0x229d('0x10')][_0x229d('0x11')]===0x1f4){logger[_0x229d('0x10')](_0x229d('0xb'),_0x2ba4a8,_0x575bc6[_0x229d('0x10')][_0x229d('0x12')]);return _0x380873(_0x575bc6['error']['message']);}logger['error'](_0x229d('0xb'),_0x2ba4a8,_0x575bc6[_0x229d('0x10')][_0x229d('0x12')]);return _0x5286f1(_0x575bc6[_0x229d('0x10')][_0x229d('0x12')]);}else{logger[_0x229d('0x13')]('CmHopper,\x20%s,\x20%s',_0x2ba4a8,'request\x20sent');_0x5286f1(_0x575bc6[_0x229d('0x14')]['message']);}})['catch'](function(_0x692052){logger[_0x229d('0x10')](_0x229d('0xb'),_0x2ba4a8,_0x692052);_0x380873(_0x692052);});});}exports[_0x229d('0x15')]=function(_0x467f89){var _0x50f932=this;return new Promise(function(_0x22c3d5,_0x15290f){return db[_0x229d('0x16')][_0x229d('0x17')]({'raw':_0x467f89[_0x229d('0x18')]?_0x467f89['options'][_0x229d('0x19')]===undefined?!![]:![]:!![],'where':_0x467f89[_0x229d('0x18')]?_0x467f89[_0x229d('0x18')][_0x229d('0x1a')]||null:null,'attributes':_0x467f89[_0x229d('0x18')]?_0x467f89[_0x229d('0x18')]['attributes']||null:null,'limit':_0x467f89[_0x229d('0x18')]?_0x467f89['options'][_0x229d('0x1b')]||null:null,'include':_0x467f89[_0x229d('0x18')]?_0x467f89[_0x229d('0x18')][_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x467f89[_0x229d('0x18')][_0x229d('0x1c')],function(_0xaacb34){return{'model':db[_0xaacb34['model']],'as':_0xaacb34['as'],'attributes':_0xaacb34[_0x229d('0x1e')],'include':_0xaacb34[_0x229d('0x1c')]?_[_0x229d('0x1d')](_0xaacb34[_0x229d('0x1c')],function(_0x4407e4){return{'model':db[_0x4407e4[_0x229d('0x1f')]],'as':_0x4407e4['as'],'attributes':_0x4407e4[_0x229d('0x1e')],'include':_0x4407e4['include']?_[_0x229d('0x1d')](_0x4407e4[_0x229d('0x1c')],function(_0xe78aba){return{'model':db[_0xe78aba[_0x229d('0x1f')]],'as':_0xe78aba['as'],'attributes':_0xe78aba[_0x229d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x229d('0xa')](function(_0x210ea7){logger[_0x229d('0x13')]('GetCmHopper',_0x467f89);logger[_0x229d('0xc')](_0x229d('0x15'),_0x467f89,JSON[_0x229d('0xf')](_0x210ea7));_0x22c3d5(_0x210ea7);})[_0x229d('0x20')](function(_0x184136){logger['error'](_0x229d('0x15'),_0x184136[_0x229d('0x12')],_0x467f89);_0x15290f(_0x50f932[_0x229d('0x10')](0x1f4,_0x184136[_0x229d('0x12')]));});});};exports[_0x229d('0x21')]=function(_0x37199d){var _0x518f6d=this;return new Promise(function(_0x3f66a2,_0x426202){return db[_0x229d('0x16')][_0x229d('0x22')]({'raw':_0x37199d[_0x229d('0x18')]?_0x37199d[_0x229d('0x18')][_0x229d('0x19')]===undefined?!![]:![]:!![],'where':_0x37199d['options']?_0x37199d[_0x229d('0x18')][_0x229d('0x1a')]||null:null,'attributes':_0x37199d[_0x229d('0x18')]?_0x37199d[_0x229d('0x18')][_0x229d('0x1e')]||null:null,'include':_0x37199d['options']?_0x37199d[_0x229d('0x18')][_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x37199d['options'][_0x229d('0x1c')],function(_0xa53ccc){return{'model':db[_0xa53ccc[_0x229d('0x1f')]],'as':_0xa53ccc['as'],'attributes':_0xa53ccc[_0x229d('0x1e')],'include':_0xa53ccc[_0x229d('0x1c')]?_[_0x229d('0x1d')](_0xa53ccc[_0x229d('0x1c')],function(_0xbd334f){return{'model':db[_0xbd334f[_0x229d('0x1f')]],'as':_0xbd334f['as'],'attributes':_0xbd334f[_0x229d('0x1e')],'include':_0xbd334f['include']?_[_0x229d('0x1d')](_0xbd334f['include'],function(_0xf673e5){return{'model':db[_0xf673e5['model']],'as':_0xf673e5['as'],'attributes':_0xf673e5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc50d){logger[_0x229d('0x13')](_0x229d('0x21'),_0x37199d);logger['debug'](_0x229d('0x21'),_0x37199d,JSON[_0x229d('0xf')](_0x3bc50d));_0x3f66a2(_0x3bc50d);})['catch'](function(_0x5112ad){logger[_0x229d('0x10')](_0x229d('0x21'),_0x5112ad[_0x229d('0x12')],_0x37199d);_0x426202(_0x518f6d['error'](0x1f4,_0x5112ad[_0x229d('0x12')]));});});};exports[_0x229d('0x23')]=function(_0x77d21b){var _0x3f5465=this;return new Promise(function(_0x48f402,_0x5369b1){return db[_0x229d('0x16')][_0x229d('0x24')](_0x77d21b[_0x229d('0x25')],{'raw':_0x77d21b[_0x229d('0x18')]?_0x77d21b[_0x229d('0x18')][_0x229d('0x19')]===undefined?!![]:![]:!![]})[_0x229d('0xa')](function(_0x17a4dd){logger[_0x229d('0x13')](_0x229d('0x23'),_0x77d21b);logger[_0x229d('0xc')](_0x229d('0x23'),_0x77d21b,JSON[_0x229d('0xf')](_0x17a4dd));_0x48f402(_0x17a4dd);})['catch'](function(_0x13b3de){logger[_0x229d('0x10')](_0x229d('0x23'),_0x13b3de[_0x229d('0x12')],_0x77d21b);_0x5369b1(_0x3f5465[_0x229d('0x10')](0x1f4,_0x13b3de[_0x229d('0x12')]));});});};exports[_0x229d('0x26')]=function(_0x1a9d8b){var _0x4d185f=this;return new Promise(function(_0x5e26a4,_0xb71247){return db[_0x229d('0x16')][_0x229d('0x27')](_0x1a9d8b[_0x229d('0x25')],{'raw':_0x1a9d8b['options']?_0x1a9d8b[_0x229d('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a9d8b[_0x229d('0x18')]?_0x1a9d8b[_0x229d('0x18')]['where']||null:null,'attributes':_0x1a9d8b[_0x229d('0x18')]?_0x1a9d8b['options'][_0x229d('0x1e')]||null:null,'limit':_0x1a9d8b[_0x229d('0x18')]?_0x1a9d8b[_0x229d('0x18')][_0x229d('0x1b')]||null:null})[_0x229d('0xa')](function(_0x3caf3e){logger['info']('UpdateCmHopper',_0x1a9d8b);logger[_0x229d('0x13')](_0x229d('0x28'),JSON['stringify'](_0x1a9d8b[_0x229d('0x18')][_0x229d('0x1a')]),_0x1a9d8b[_0x229d('0x25')][_0x229d('0x29')]);logger[_0x229d('0xc')](_0x229d('0x26'),_0x1a9d8b,JSON[_0x229d('0xf')](_0x3caf3e));_0x5e26a4(_0x3caf3e);})[_0x229d('0x20')](function(_0x3a6b1c){logger[_0x229d('0x10')](_0x229d('0x26'),_0x3a6b1c[_0x229d('0x12')],_0x1a9d8b);_0xb71247(_0x4d185f[_0x229d('0x10')](0x1f4,_0x3a6b1c[_0x229d('0x12')]));});});};exports[_0x229d('0x2a')]=function(_0x4db17e){var _0x310d6e=this;return new Promise(function(_0x125acf,_0x181a67){return db[_0x229d('0x16')]['destroy']({'where':_0x4db17e[_0x229d('0x18')]?_0x4db17e[_0x229d('0x18')][_0x229d('0x1a')]||null:null})[_0x229d('0xa')](function(_0x178b57){logger['info'](_0x229d('0x2a'),_0x4db17e);logger[_0x229d('0xc')](_0x229d('0x2a'),_0x4db17e,JSON[_0x229d('0xf')](_0x178b57));_0x125acf(_0x178b57);})[_0x229d('0x20')](function(_0x5dcb91){logger[_0x229d('0x10')]('DestroyCmHopper',_0x5dcb91[_0x229d('0x12')],_0x4db17e);_0x181a67(_0x310d6e[_0x229d('0x10')](0x1f4,_0x5dcb91[_0x229d('0x12')]));});});};exports['GetContactDialer']=function(_0x379351){var _0x1d5257=this;return new Promise(function(_0x5d74b7,_0x17cc15){return db['CmContact']['describe']()[_0x229d('0xa')](function(_0x7ec85f){return db[_0x229d('0x2b')][_0x229d('0x2c')](function(_0x2f974e){return db[_0x229d('0x16')][_0x229d('0x17')]({'where':_0x379351[_0x229d('0x18')]?_0x379351['options'][_0x229d('0x1a')]||null:null,'attributes':_0x379351[_0x229d('0x18')]?_0x379351[_0x229d('0x18')][_0x229d('0x1e')]||null:null,'limit':_0x379351[_0x229d('0x18')]?_0x379351['options']['limit']||null:null,'order':_0x379351[_0x229d('0x18')]?_0x379351[_0x229d('0x18')][_0x229d('0x2d')]||null:null,'transaction':_0x2f974e,'lock':_0x2f974e['LOCK'][_0x229d('0x2e')],'include':[{'model':db['CmContact'],'as':_0x229d('0x2f'),'attributes':_['keys'](_0x7ec85f)},{'model':db['User'],'as':_0x229d('0x30'),'attributes':['id','name',_0x229d('0x31')]}]})['then'](function(_0x2d3fd4){var _0x26c62a=[];var _0x205f02=[];for(var _0x2bc1f8=0x0;_0x2bc1f8<_0x2d3fd4['length'];_0x2bc1f8+=0x1){var _0x40013a=_0x2d3fd4[_0x2bc1f8]['UserId'];if(_0x40013a===null){_0x26c62a['push'](_0x2d3fd4[_0x2bc1f8][_0x229d('0x27')](_0x379351['body'],{'transaction':_0x2f974e}));}else if(!_0x205f02[_0x229d('0x32')](_0x40013a)){_0x205f02[_0x229d('0x33')](_0x40013a);_0x26c62a[_0x229d('0x33')](_0x2d3fd4[_0x2bc1f8][_0x229d('0x27')](_0x379351[_0x229d('0x25')],{'transaction':_0x2f974e}));}}return BPromise[_0x229d('0x34')](_0x26c62a);});})[_0x229d('0xa')](function(_0x3715ce){logger['info'](_0x229d('0x35'),_0x379351);if(_0x3715ce[_0x229d('0x36')]>0x0){logger['info'](_0x229d('0x37'),_0x3715ce[0x0]['dataValues']['id'],_0x3715ce[0x0][_0x229d('0x38')][_0x229d('0x39')],_0x3715ce[0x0][_0x229d('0x38')][_0x229d('0x29')]);}logger[_0x229d('0xc')](_0x229d('0x35'),_0x379351,JSON[_0x229d('0xf')](_0x3715ce));_0x5d74b7(_0x3715ce);})['catch'](function(_0x4aab5e){logger[_0x229d('0x10')](_0x229d('0x35'),_0x4aab5e[_0x229d('0x12')],_0x379351);_0x17cc15(_0x1d5257['error'](0x1f4,_0x4aab5e[_0x229d('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x40fd7c){var _0x4621cf=this;return new Promise(function(_0x394f74,_0x391167){return db[_0x229d('0x2b')][_0x229d('0x2c')](function(_0x25d42c){return db[_0x229d('0x3a')]['create'](_0x40fd7c[_0x229d('0x25')],{'raw':_0x40fd7c[_0x229d('0x18')]?_0x40fd7c[_0x229d('0x18')]['raw']===undefined?!![]:![]:!![],'transaction':_0x25d42c})['then'](function(){logger[_0x229d('0x13')](_0x229d('0x3b'),JSON['stringify'](_0x40fd7c['options'][_0x229d('0x1a')]),_0x40fd7c[_0x229d('0x18')][_0x229d('0x1a')][_0x229d('0x29')]);return db['CmHopper'][_0x229d('0x3c')]({'where':_0x40fd7c[_0x229d('0x18')]?_0x40fd7c['options']['where']||null:null,'transaction':_0x25d42c});});})['then'](function(_0x742bde){logger[_0x229d('0x13')](_0x229d('0x3d'),_0x40fd7c);logger[_0x229d('0xc')](_0x229d('0x3d'),_0x40fd7c,JSON[_0x229d('0xf')](_0x742bde));_0x394f74(_0x742bde);})[_0x229d('0x20')](function(_0x26d5f4){logger[_0x229d('0x10')](_0x229d('0x3d'),_0x26d5f4[_0x229d('0x12')],_0x40fd7c);_0x391167(_0x4621cf[_0x229d('0x10')](0x1f4,_0x26d5f4[_0x229d('0x12')]));});});};exports[_0x229d('0x3e')]=function(_0x4f1406){var _0x4ede4f=this;return new Promise(function(_0x38b687,_0x233ca9){return db[_0x229d('0x16')][_0x229d('0x17')]({'raw':_0x4f1406[_0x229d('0x18')]?_0x4f1406[_0x229d('0x18')][_0x229d('0x19')]===undefined?!![]:![]:!![],'where':_0x4f1406[_0x229d('0x18')]?_0x4f1406['options'][_0x229d('0x1a')]||null:null,'attributes':[[db[_0x229d('0x2b')]['fn'](_0x229d('0x3f'),db[_0x229d('0x2b')]['fn']('IF',db['sequelize'][_0x229d('0x40')](_0x229d('0x41')+util[_0x229d('0x42')](_0x229d('0x43'),moment()['format'](_0x229d('0x44')))+'\x20,\x201,\x20null'))),_0x229d('0x45')]]})[_0x229d('0xa')](function(_0x1e13c6){logger[_0x229d('0x13')](_0x229d('0x3e'),_0x4f1406);logger[_0x229d('0xc')](_0x229d('0x3e'),_0x4f1406,JSON[_0x229d('0xf')](_0x1e13c6));_0x38b687(_0x1e13c6);})[_0x229d('0x20')](function(_0x598282){logger[_0x229d('0x10')](_0x229d('0x3e'),_0x598282[_0x229d('0x12')],_0x4f1406);_0x233ca9(_0x4ede4f[_0x229d('0x10')](0x1f4,_0x598282[_0x229d('0x12')]));});});};exports[_0x229d('0x46')]=function(_0x47bc3b){var _0x12553d=this;return new Promise(function(_0x332bb7,_0x5702e1){return db[_0x229d('0x47')][_0x229d('0x48')]()[_0x229d('0xa')](function(_0x523cb3){return db[_0x229d('0x2b')][_0x229d('0x2c')](function(_0xf0bf02){return db[_0x229d('0x16')][_0x229d('0x17')]({'where':_0x47bc3b['options']?_0x47bc3b[_0x229d('0x18')][_0x229d('0x1a')]||null:null,'attributes':_0x47bc3b['options']?_0x47bc3b[_0x229d('0x18')][_0x229d('0x1e')]||null:null,'limit':0x1,'order':_0x47bc3b[_0x229d('0x18')]?_0x47bc3b[_0x229d('0x18')][_0x229d('0x2d')]||null:null,'group':db['CmHopper'][_0x229d('0x49')],'transaction':_0xf0bf02,'lock':_0xf0bf02[_0x229d('0x4a')]['UPDATE'],'include':_0x47bc3b[_0x229d('0x18')]?_0x47bc3b[_0x229d('0x18')][_0x229d('0x1c')]?_['map'](_0x47bc3b[_0x229d('0x18')][_0x229d('0x1c')],function(_0x46d0f8){return{'model':db[_0x46d0f8['model']],'as':_0x46d0f8['as'],'attributes':_0x46d0f8[_0x229d('0x1e')],'include':_0x46d0f8[_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x46d0f8[_0x229d('0x1c')],function(_0x47d84a){return{'model':db[_0x47d84a[_0x229d('0x1f')]],'as':_0x47d84a['as'],'attributes':_0x47d84a[_0x229d('0x1e')],'include':_0x47d84a[_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x47d84a[_0x229d('0x1c')],function(_0x3d965f){return{'model':db[_0x3d965f[_0x229d('0x1f')]],'as':_0x3d965f['as'],'attributes':_0x3d965f[_0x229d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x229d('0xa')](function(_0x585dbe){var _0x3fc6de=[];for(var _0x4b1ccb=0x0;_0x4b1ccb<_0x585dbe[_0x229d('0x36')];_0x4b1ccb+=0x1){_0x3fc6de[_0x229d('0x33')](_0x585dbe[_0x4b1ccb]['update'](_0x47bc3b[_0x229d('0x25')],{'transaction':_0xf0bf02}));}return BPromise[_0x229d('0x34')](_0x3fc6de);});})[_0x229d('0xa')](function(_0x5000d1){logger[_0x229d('0x13')](_0x229d('0x46'),_0x47bc3b);logger[_0x229d('0xc')]('GetContactRecallMe',_0x47bc3b,JSON['stringify'](_0x5000d1));_0x332bb7(_0x5000d1);})[_0x229d('0x20')](function(_0x2dc38a){logger['error'](_0x229d('0x46'),_0x2dc38a[_0x229d('0x12')],_0x47bc3b);_0x5702e1(_0x12553d[_0x229d('0x10')](0x1f4,_0x2dc38a[_0x229d('0x12')]));});});});};exports['GetCmHopperPreview']=function(_0x48b1e3){var _0x389928=this;return new Promise(function(_0x220247,_0x5d3595){db[_0x229d('0x47')][_0x229d('0x48')]()[_0x229d('0xa')](function(_0x219630){return db['CmHopper'][_0x229d('0x17')]({'raw':_0x48b1e3[_0x229d('0x18')]?_0x48b1e3['options']['raw']===undefined?!![]:![]:!![],'where':_0x48b1e3[_0x229d('0x18')]?_0x48b1e3['options']['where']||null:null,'attributes':_0x48b1e3[_0x229d('0x18')]?_0x48b1e3[_0x229d('0x18')][_0x229d('0x1e')]||null:null,'limit':_0x48b1e3[_0x229d('0x18')]?_0x48b1e3[_0x229d('0x18')][_0x229d('0x1b')]||null:null,'include':_0x48b1e3['options']?_0x48b1e3[_0x229d('0x18')][_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x48b1e3[_0x229d('0x18')]['include'],function(_0x45f5bb){return{'model':db[_0x45f5bb['model']],'as':_0x45f5bb['as'],'attributes':_0x45f5bb['as']==='Contact'?_['keys'](_0x219630):_0x45f5bb[_0x229d('0x1e')],'include':_0x45f5bb[_0x229d('0x1c')]?_['map'](_0x45f5bb[_0x229d('0x1c')],function(_0x2b8989){return{'model':db[_0x2b8989['model']],'as':_0x2b8989['as'],'attributes':_0x2b8989[_0x229d('0x1e')],'include':_0x2b8989[_0x229d('0x1c')]?_[_0x229d('0x1d')](_0x2b8989['include'],function(_0x2e9afa){return{'model':db[_0x2e9afa['model']],'as':_0x2e9afa['as'],'attributes':_0x2e9afa[_0x229d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x229d('0xa')](function(_0x983109){logger[_0x229d('0x13')]('GetCmHopper',_0x48b1e3);logger[_0x229d('0xc')](_0x229d('0x15'),_0x48b1e3,JSON[_0x229d('0xf')](_0x983109));_0x220247(_0x983109);})['catch'](function(_0x44fa8f){logger[_0x229d('0x10')]('GetCmHopper',_0x44fa8f['message'],_0x48b1e3);_0x5d3595(_0x389928['error'](0x1f4,_0x44fa8f[_0x229d('0x12')]));});});});};exports[_0x229d('0x4b')]=function(_0x522033){var _0x53b39a=this;return new Promise(function(_0x2f5642,_0x39ec9c){return db['CmContact'][_0x229d('0x4c')]({'raw':!![],'where':{'phone':_0x522033[_0x229d('0x18')][_0x229d('0x1a')][_0x229d('0x4d')]},'attributes':['id',_0x229d('0x4e')],'order':[['id','DESC']]})[_0x229d('0xa')](function(_0x47c4df){logger['info']('getContactByPhone',_0x522033);logger['debug'](_0x229d('0x4f'),_0x522033,JSON[_0x229d('0xf')](_0x47c4df));_0x2f5642(_0x47c4df);})[_0x229d('0x20')](function(_0x12ca3c){logger[_0x229d('0x10')](_0x229d('0x4f'),_0x12ca3c[_0x229d('0x12')],_0x522033);_0x39ec9c(_0x53b39a[_0x229d('0x10')](0x1f4,_0x12ca3c[_0x229d('0x12')]));});});};exports[_0x229d('0x50')]=function(_0x68552f){var _0x2dd44f=this;return new Promise(function(_0xd52d9f,_0x1b1c51){return db[_0x229d('0x2b')]['transaction'](function(_0x2b0221){return db['CmHopper']['update'](_0x68552f[_0x229d('0x25')],{'where':{},'transaction':_0x2b0221})[_0x229d('0xa')](function(_0x5e0ccb){logger[_0x229d('0x13')]('ResetActiveCalls',_0x68552f);logger['debug'](_0x229d('0x50'),_0x68552f,JSON[_0x229d('0xf')](_0x5e0ccb));_0xd52d9f(_0x5e0ccb);})[_0x229d('0x20')](function(_0x3ded3a){logger[_0x229d('0x10')]('ResetActiveCalls',_0x3ded3a['message'],_0x68552f);_0x1b1c51(_0x2dd44f[_0x229d('0x10')](0x1f4,_0x3ded3a[_0x229d('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x2723e6){var _0xaceea5=this;var _0x81d8e9=_0x2723e6['body']['where'][_0x229d('0x51')];var _0x36ddb0=_0x2723e6[_0x229d('0x25')][_0x229d('0x1a')][_0x229d('0x52')];var _0x73fb32=_0x2723e6['body'][_0x229d('0x1a')]['availableAgentsIds'];return new Promise(function(_0x26f556,_0x394fcf){return db[_0x229d('0x16')]['findAll']({'where':{'voiceQueueId':{'$in':_0x81d8e9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x229d('0x2b')][_0x229d('0x40')](_0x229d('0x53')+_0x36ddb0+_0x229d('0x54')),'$gt':db[_0x229d('0x2b')][_0x229d('0x40')](_0x229d('0x55'))}},'UserId':{'$in':_0x73fb32}},'include':[{'model':db['CmContact'],'as':'Contact'},{'model':db[_0x229d('0x56')],'as':_0x229d('0x30'),'attributes':['id',_0x229d('0x57'),'voicePause']},{'model':db[_0x229d('0x58')],'as':_0x229d('0x59')}]})['then'](function(_0x5d85eb){if(_0x5d85eb[_0x229d('0x36')]>0x0){return db[_0x229d('0x2b')][_0x229d('0x2c')](function(_0x274243){return db[_0x229d('0x16')]['update']({'recallmeNotifiedDate':db[_0x229d('0x2b')][_0x229d('0x40')](_0x229d('0x55'))},{'where':{'id':{'$in':_['map'](_0x5d85eb,'id')}},'transaction':_0x274243})[_0x229d('0xa')](function(){_0x26f556(_0x5d85eb);})[_0x229d('0x20')](function(_0x3593fd){logger['error'](_0x229d('0x5a'),_0x3593fd[_0x229d('0x12')],_0x2723e6);_0x394fcf(_0xaceea5[_0x229d('0x10')](0x1f4,_0x3593fd[_0x229d('0x12')]));});})[_0x229d('0x20')](function(_0x287d1b){logger[_0x229d('0x10')](_0x229d('0x5a'),_0x287d1b[_0x229d('0x12')],_0x2723e6);_0x394fcf(_0xaceea5['error'](0x1f4,_0x287d1b['message']));});}else{_0x26f556(_0x5d85eb);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index f33806b..912aee7 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 _0x6eae=['../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','getTimezones','/:id','show','getPreviewRecall','post','create','getTimezone','put','delete','destroy','exports','express'];(function(_0x105e5c,_0x2a1c3a){var _0x4426f8=function(_0x44fa1f){while(--_0x44fa1f){_0x105e5c['push'](_0x105e5c['shift']());}};_0x4426f8(++_0x2a1c3a);}(_0x6eae,0xbc));var _0xe6ea=function(_0x723499,_0x125b6c){_0x723499=_0x723499-0x0;var _0x3d031c=_0x6eae[_0x723499];return _0x3d031c;};'use strict';var express=require(_0xe6ea('0x0'));var router=express['Router']();var auth=require(_0xe6ea('0x1'));var controller=require(_0xe6ea('0x2'));router[_0xe6ea('0x3')]('/',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x5')]);router[_0xe6ea('0x3')](_0xe6ea('0x6'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x7')]);router[_0xe6ea('0x3')](_0xe6ea('0x8'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x9')]);router[_0xe6ea('0x3')]('/timezones',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0xa')]);router['get'](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0xc')]);router['get']('/:id/previewrecall',auth['isAuthenticated'](),controller[_0xe6ea('0xd')]);router[_0xe6ea('0xe')]('/',auth['isAuthenticated'](),controller[_0xe6ea('0xf')]);router[_0xe6ea('0xe')]('/preview',auth[_0xe6ea('0x4')](),controller['getPreview']);router['post']('/timezone',auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x10')]);router[_0xe6ea('0x11')](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller['update']);router[_0xe6ea('0x12')](_0xe6ea('0xb'),auth[_0xe6ea('0x4')](),controller[_0xe6ea('0x13')]);module[_0xe6ea('0x14')]=router; \ No newline at end of file +var _0xec8c=['/timezone','getTimezone','put','delete','express','Router','../../components/auth/service','get','isAuthenticated','index','describe','/opencontacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview'];(function(_0x29165d,_0x221063){var _0x3dd8f9=function(_0x428f99){while(--_0x428f99){_0x29165d['push'](_0x29165d['shift']());}};_0x3dd8f9(++_0x221063);}(_0xec8c,0x1e8));var _0xcec8=function(_0x382a1c,_0x99b604){_0x382a1c=_0x382a1c-0x0;var _0x5f517d=_0xec8c[_0x382a1c];return _0x5f517d;};'use strict';var express=require(_0xcec8('0x0'));var router=express[_0xcec8('0x1')]();var auth=require(_0xcec8('0x2'));var controller=require('./cmHopper.controller');router[_0xcec8('0x3')]('/',auth[_0xcec8('0x4')](),controller[_0xcec8('0x5')]);router[_0xcec8('0x3')]('/describe',auth[_0xcec8('0x4')](),controller[_0xcec8('0x6')]);router[_0xcec8('0x3')](_0xcec8('0x7'),auth[_0xcec8('0x4')](),controller['getOpenContacts']);router['get'](_0xcec8('0x8'),auth[_0xcec8('0x4')](),controller[_0xcec8('0x9')]);router[_0xcec8('0x3')](_0xcec8('0xa'),auth[_0xcec8('0x4')](),controller[_0xcec8('0xb')]);router[_0xcec8('0x3')](_0xcec8('0xc'),auth['isAuthenticated'](),controller[_0xcec8('0xd')]);router[_0xcec8('0xe')]('/',auth['isAuthenticated'](),controller[_0xcec8('0xf')]);router[_0xcec8('0xe')](_0xcec8('0x10'),auth[_0xcec8('0x4')](),controller[_0xcec8('0x11')]);router[_0xcec8('0xe')](_0xcec8('0x12'),auth['isAuthenticated'](),controller[_0xcec8('0x13')]);router[_0xcec8('0x14')](_0xcec8('0xa'),auth[_0xcec8('0x4')](),controller['update']);router[_0xcec8('0x15')](_0xcec8('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index ddb1f88..f19b117 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaeeb=['STRING','INTEGER','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0xaeeb,0x15b));var _0xbaee=function(_0x3d9e80,_0x1b52ba){_0x3d9e80=_0x3d9e80-0x0;var _0x4bca00=_0xaeeb[_0x3d9e80];return _0x4bca00;};'use strict';var moment=require(_0xbaee('0x0'));var Sequelize=require(_0xbaee('0x1'));module[_0xbaee('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0xbaee('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xbaee('0x5')],'defaultValue':moment()['format'](_0xbaee('0x6'))},'countbusyretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbaee('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4629=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4629,0x142));var _0x9462=function(_0x15ecaa,_0x339795){_0x15ecaa=_0x15ecaa-0x0;var _0x21fd80=_0x4629[_0x15ecaa];return _0x21fd80;};'use strict';var moment=require(_0x9462('0x0'));var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize[_0x9462('0x1')]},'phone':{'type':Sequelize[_0x9462('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x9462('0x3')],'defaultValue':moment()[_0x9462('0x4')](_0x9462('0x5'))},'countbusyretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9462('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 5f11f5b..85283b6 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f14=['error','stack','name','send','index','CmHopperAdditionalPhone','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','destroy','get','CmHopperAdditionalPhones','end'];(function(_0x451528,_0xa7af19){var _0x5c1878=function(_0x1518c0){while(--_0x1518c0){_0x451528['push'](_0x451528['shift']());}};_0x5c1878(++_0xa7af19);}(_0x8f14,0xd1));var _0x48f1=function(_0x490735,_0x1cb9f9){_0x490735=_0x490735-0x0;var _0x4b6e2b=_0x8f14[_0x490735];return _0x4b6e2b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x48f1('0x0'));var zipdir=require(_0x48f1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x48f1('0x2'));var BPromise=require(_0x48f1('0x3'));var Mustache=require(_0x48f1('0x4'));var util=require(_0x48f1('0x5'));var path=require(_0x48f1('0x6'));var sox=require(_0x48f1('0x7'));var csv=require('to-csv');var ejs=require(_0x48f1('0x8'));var fs=require('fs');var fs_extra=require(_0x48f1('0x9'));var _=require(_0x48f1('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x48f1('0xb'));var deskjs=require(_0x48f1('0xc'));var toCsv=require(_0x48f1('0xd'));var querystring=require(_0x48f1('0xe'));var Papa=require(_0x48f1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x48f1('0x10'));var as=require(_0x48f1('0x11'));var hardwareService=require(_0x48f1('0x12'));var logger=require('../../config/logger')(_0x48f1('0x13'));var utils=require(_0x48f1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x48f1('0x15'));var db=require(_0x48f1('0x16'))['db'];function respondWithStatusCode(_0x3dcb7c,_0x5daf26){_0x5daf26=_0x5daf26||0xcc;return function(_0x3ef4e6){if(_0x3ef4e6){return _0x3dcb7c[_0x48f1('0x17')](_0x5daf26);}return _0x3dcb7c[_0x48f1('0x18')](_0x5daf26)['end']();};}function respondWithResult(_0xb2976,_0x575d56){_0x575d56=_0x575d56||0xc8;return function(_0x4aa81d){if(_0x4aa81d){return _0xb2976[_0x48f1('0x18')](_0x575d56)[_0x48f1('0x19')](_0x4aa81d);}};}function respondWithFilteredResult(_0x4e79e6,_0xe352ed){return function(_0x585b36){if(_0x585b36){var _0x896693=typeof _0xe352ed[_0x48f1('0x1a')]===_0x48f1('0x1b')&&typeof _0xe352ed[_0x48f1('0x1c')]===_0x48f1('0x1b');var _0xab8fa0=_0x585b36[_0x48f1('0x1d')];var _0x50a365=_0x896693?0x0:_0xe352ed[_0x48f1('0x1a')];var _0x5ee843=_0x896693?_0x585b36[_0x48f1('0x1d')]:_0xe352ed[_0x48f1('0x1a')]+_0xe352ed['limit'];var _0x1beb85;if(_0x5ee843>=_0xab8fa0){_0x5ee843=_0xab8fa0;_0x1beb85=0xc8;}else{_0x1beb85=0xce;}_0x4e79e6[_0x48f1('0x18')](_0x1beb85);return _0x4e79e6[_0x48f1('0x1e')]('Content-Range',_0x50a365+'-'+_0x5ee843+'/'+_0xab8fa0)['json'](_0x585b36);}return null;};}function patchUpdates(_0x1b6009){return function(_0x838b70){try{jsonpatch[_0x48f1('0x1f')](_0x838b70,_0x1b6009,!![]);}catch(_0x9fb0e0){return BPromise['reject'](_0x9fb0e0);}return _0x838b70['save']();};}function saveUpdates(_0x3030a4,_0x4ea3d5){return function(_0x28bbb6){if(_0x28bbb6){return _0x28bbb6['update'](_0x3030a4)[_0x48f1('0x20')](function(_0x208f7a){return _0x208f7a;});}return null;};}function removeEntity(_0x5259c5,_0x570330){return function(_0x51a7b7){if(_0x51a7b7){return _0x51a7b7[_0x48f1('0x21')]()['then'](function(){var _0x55f701=_0x51a7b7[_0x48f1('0x22')]({'plain':!![]});var _0x185e1c=_0x48f1('0x23');return db['UserProfileResource'][_0x48f1('0x21')]({'where':{'type':_0x185e1c,'resourceId':_0x55f701['id']}})[_0x48f1('0x20')](function(){return _0x51a7b7;});})[_0x48f1('0x20')](function(){_0x5259c5[_0x48f1('0x18')](0xcc)[_0x48f1('0x24')]();});}};}function handleEntityNotFound(_0x4689ff,_0x4de2b4){return function(_0x344cf9){if(!_0x344cf9){_0x4689ff[_0x48f1('0x17')](0x194);}return _0x344cf9;};}function handleError(_0x20e6d7,_0x35f28e){_0x35f28e=_0x35f28e||0x1f4;return function(_0x368c20){logger[_0x48f1('0x25')](_0x368c20[_0x48f1('0x26')]);if(_0x368c20[_0x48f1('0x27')]){delete _0x368c20['name'];}_0x20e6d7[_0x48f1('0x18')](_0x35f28e)[_0x48f1('0x28')](_0x368c20);};}exports[_0x48f1('0x29')]=function(_0x31f973,_0x111f3b){var _0x56a354={},_0x2ece02={},_0x471c38={'count':0x0,'rows':[]};var _0x5623ef=_['map'](db[_0x48f1('0x2a')]['rawAttributes'],function(_0x35a4a5){return{'name':_0x35a4a5[_0x48f1('0x2b')],'type':_0x35a4a5['type'][_0x48f1('0x2c')]};});_0x2ece02['model']=_['map'](_0x5623ef,_0x48f1('0x27'));_0x2ece02['query']=_[_0x48f1('0x2d')](_0x31f973[_0x48f1('0x2e')]);_0x2ece02[_0x48f1('0x2f')]=_[_0x48f1('0x30')](_0x2ece02[_0x48f1('0x31')],_0x2ece02['query']);_0x56a354[_0x48f1('0x32')]=_[_0x48f1('0x30')](_0x2ece02['model'],qs['fields'](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x33')]));_0x56a354['attributes']=_0x56a354[_0x48f1('0x32')]['length']?_0x56a354['attributes']:_0x2ece02['model'];if(!_0x31f973[_0x48f1('0x2e')][_0x48f1('0x34')](_0x48f1('0x35'))){_0x56a354[_0x48f1('0x1c')]=qs[_0x48f1('0x1c')](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x1c')]);_0x56a354['offset']=qs[_0x48f1('0x1a')](_0x31f973[_0x48f1('0x2e')][_0x48f1('0x1a')]);}_0x56a354['order']=qs[_0x48f1('0x36')](_0x31f973[_0x48f1('0x2e')]['sort']);_0x56a354['where']=qs[_0x48f1('0x2f')](_[_0x48f1('0x37')](_0x31f973[_0x48f1('0x2e')],_0x2ece02[_0x48f1('0x2f')]),_0x5623ef);if(_0x31f973[_0x48f1('0x2e')][_0x48f1('0x38')]){_0x56a354[_0x48f1('0x39')]=_[_0x48f1('0x3a')](_0x56a354[_0x48f1('0x39')],{'$or':_[_0x48f1('0x3b')](_0x5623ef,function(_0xc45712){if(_0xc45712[_0x48f1('0x3c')]!==_0x48f1('0x3d')){var _0x117155={};_0x117155[_0xc45712[_0x48f1('0x27')]]={'$like':'%'+_0x31f973['query']['filter']+'%'};return _0x117155;}})});}_0x56a354=_['merge']({},_0x56a354,_0x31f973[_0x48f1('0x3e')]);var _0x49fc3f={'where':_0x56a354[_0x48f1('0x39')]};return db[_0x48f1('0x2a')][_0x48f1('0x1d')](_0x49fc3f)[_0x48f1('0x20')](function(_0x31af5d){_0x471c38['count']=_0x31af5d;if(_0x31f973[_0x48f1('0x2e')][_0x48f1('0x3f')]){_0x56a354[_0x48f1('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x56a354);})[_0x48f1('0x20')](function(_0x174278){_0x471c38[_0x48f1('0x41')]=_0x174278;return _0x471c38;})[_0x48f1('0x20')](respondWithFilteredResult(_0x111f3b,_0x56a354))[_0x48f1('0x42')](handleError(_0x111f3b,null));};exports[_0x48f1('0x43')]=function(_0x30deff,_0x499f85){var _0x17e061={'raw':!![],'where':{'id':_0x30deff[_0x48f1('0x44')]['id']}},_0x39caa8={};_0x39caa8[_0x48f1('0x31')]=_['keys'](db[_0x48f1('0x2a')][_0x48f1('0x45')]);_0x39caa8[_0x48f1('0x2e')]=_[_0x48f1('0x2d')](_0x30deff[_0x48f1('0x2e')]);_0x39caa8[_0x48f1('0x2f')]=_[_0x48f1('0x30')](_0x39caa8['model'],_0x39caa8[_0x48f1('0x2e')]);_0x17e061[_0x48f1('0x32')]=_[_0x48f1('0x30')](_0x39caa8[_0x48f1('0x31')],qs[_0x48f1('0x33')](_0x30deff[_0x48f1('0x2e')]['fields']));_0x17e061[_0x48f1('0x32')]=_0x17e061['attributes'][_0x48f1('0x46')]?_0x17e061[_0x48f1('0x32')]:_0x39caa8[_0x48f1('0x31')];if(_0x30deff['query'][_0x48f1('0x3f')]){_0x17e061[_0x48f1('0x40')]=[{'all':!![]}];}_0x17e061=_['merge']({},_0x17e061,_0x30deff[_0x48f1('0x3e')]);return db[_0x48f1('0x2a')][_0x48f1('0x47')](_0x17e061)[_0x48f1('0x20')](handleEntityNotFound(_0x499f85,null))[_0x48f1('0x20')](respondWithResult(_0x499f85,null))[_0x48f1('0x42')](handleError(_0x499f85,null));};exports[_0x48f1('0x48')]=function(_0xd52e8d,_0x1905bd){return db['CmHopperAdditionalPhone'][_0x48f1('0x48')](_0xd52e8d['body'],{})[_0x48f1('0x20')](function(_0x3ae67a){var _0x397086=_0xd52e8d[_0x48f1('0x49')][_0x48f1('0x22')]({'plain':!![]});if(!_0x397086)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397086[_0x48f1('0x4a')]==='user'){var _0xca7d8b=_0x3ae67a[_0x48f1('0x22')]({'plain':!![]});var _0x4dd164=_0x48f1('0x23');return db[_0x48f1('0x4b')][_0x48f1('0x47')]({'where':{'name':_0x4dd164,'userProfileId':_0x397086[_0x48f1('0x4c')]},'raw':!![]})['then'](function(_0xe583f4){if(_0xe583f4&&_0xe583f4[_0x48f1('0x4d')]===0x0){return db[_0x48f1('0x4e')][_0x48f1('0x48')]({'name':_0xca7d8b['name'],'resourceId':_0xca7d8b['id'],'type':_0xe583f4['name'],'sectionId':_0xe583f4['id']},{})[_0x48f1('0x20')](function(){return _0x3ae67a;});}else{return _0x3ae67a;}})[_0x48f1('0x42')](function(_0x80f766){logger[_0x48f1('0x25')](_0x48f1('0x4f'),_0x80f766);throw _0x80f766;});}return _0x3ae67a;})['then'](respondWithResult(_0x1905bd,0xc9))[_0x48f1('0x42')](handleError(_0x1905bd,null));};exports[_0x48f1('0x50')]=function(_0x2f45c4,_0x15bf80){if(_0x2f45c4[_0x48f1('0x51')]['id']){delete _0x2f45c4[_0x48f1('0x51')]['id'];}return db[_0x48f1('0x2a')]['find']({'where':{'id':_0x2f45c4[_0x48f1('0x44')]['id']}})[_0x48f1('0x20')](handleEntityNotFound(_0x15bf80,null))[_0x48f1('0x20')](saveUpdates(_0x2f45c4[_0x48f1('0x51')],null))['then'](respondWithResult(_0x15bf80,null))[_0x48f1('0x42')](handleError(_0x15bf80,null));};exports[_0x48f1('0x21')]=function(_0x1d1871,_0x32b604){return db['CmHopperAdditionalPhone'][_0x48f1('0x47')]({'where':{'id':_0x1d1871[_0x48f1('0x44')]['id']}})['then'](handleEntityNotFound(_0x32b604,null))[_0x48f1('0x20')](removeEntity(_0x32b604,null))[_0x48f1('0x42')](handleError(_0x32b604,null));}; \ No newline at end of file +var _0x7782=['status','end','json','limit','count','offset','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x29320d,_0x26b1f1){var _0xd32419=function(_0x3f9036){while(--_0x3f9036){_0x29320d['push'](_0x29320d['shift']());}};_0xd32419(++_0x26b1f1);}(_0x7782,0xcb));var _0x2778=function(_0x444be2,_0x50f64a){_0x444be2=_0x444be2-0x0;var _0x4a4202=_0x7782[_0x444be2];return _0x4a4202;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2778('0x0'));var zipdir=require(_0x2778('0x1'));var jsonpatch=require(_0x2778('0x2'));var rp=require(_0x2778('0x3'));var moment=require(_0x2778('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2778('0x5'));var util=require(_0x2778('0x6'));var path=require('path');var sox=require(_0x2778('0x7'));var csv=require(_0x2778('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2778('0x9'));var _=require('lodash');var squel=require(_0x2778('0xa'));var crypto=require('crypto');var jsforce=require(_0x2778('0xb'));var deskjs=require(_0x2778('0xc'));var toCsv=require(_0x2778('0x8'));var querystring=require(_0x2778('0xd'));var Papa=require('papaparse');var Redis=require(_0x2778('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2778('0xf'));var as=require(_0x2778('0x10'));var hardwareService=require(_0x2778('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2778('0x12'));var config=require(_0x2778('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2778('0x14'))['db'];function respondWithStatusCode(_0x5bbfb4,_0x3ba66f){_0x3ba66f=_0x3ba66f||0xcc;return function(_0x4b7c4c){if(_0x4b7c4c){return _0x5bbfb4[_0x2778('0x15')](_0x3ba66f);}return _0x5bbfb4[_0x2778('0x16')](_0x3ba66f)[_0x2778('0x17')]();};}function respondWithResult(_0x258f9f,_0x3c1171){_0x3c1171=_0x3c1171||0xc8;return function(_0x43f3b5){if(_0x43f3b5){return _0x258f9f['status'](_0x3c1171)[_0x2778('0x18')](_0x43f3b5);}};}function respondWithFilteredResult(_0x4b90e0,_0x520210){return function(_0x2a1195){if(_0x2a1195){var _0x534321=typeof _0x520210['offset']==='undefined'&&typeof _0x520210[_0x2778('0x19')]==='undefined';var _0x73f6d2=_0x2a1195[_0x2778('0x1a')];var _0x44c79a=_0x534321?0x0:_0x520210[_0x2778('0x1b')];var _0x2cf0eb=_0x534321?_0x2a1195[_0x2778('0x1a')]:_0x520210[_0x2778('0x1b')]+_0x520210[_0x2778('0x19')];var _0x1fb5b1;if(_0x2cf0eb>=_0x73f6d2){_0x2cf0eb=_0x73f6d2;_0x1fb5b1=0xc8;}else{_0x1fb5b1=0xce;}_0x4b90e0[_0x2778('0x16')](_0x1fb5b1);return _0x4b90e0['set']('Content-Range',_0x44c79a+'-'+_0x2cf0eb+'/'+_0x73f6d2)[_0x2778('0x18')](_0x2a1195);}return null;};}function patchUpdates(_0x32a76c){return function(_0x405d01){try{jsonpatch[_0x2778('0x1c')](_0x405d01,_0x32a76c,!![]);}catch(_0x17d624){return BPromise[_0x2778('0x1d')](_0x17d624);}return _0x405d01['save']();};}function saveUpdates(_0x30ff80,_0xdf231e){return function(_0x28ff43){if(_0x28ff43){return _0x28ff43[_0x2778('0x1e')](_0x30ff80)[_0x2778('0x1f')](function(_0x4d2cc2){return _0x4d2cc2;});}return null;};}function removeEntity(_0x33adc1,_0x5b8f7e){return function(_0x19e43a){if(_0x19e43a){return _0x19e43a['destroy']()[_0x2778('0x1f')](function(){var _0x4f7dfa=_0x19e43a[_0x2778('0x20')]({'plain':!![]});var _0x2f83a9='CmHopperAdditionalPhones';return db[_0x2778('0x21')][_0x2778('0x22')]({'where':{'type':_0x2f83a9,'resourceId':_0x4f7dfa['id']}})[_0x2778('0x1f')](function(){return _0x19e43a;});})[_0x2778('0x1f')](function(){_0x33adc1[_0x2778('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29010c,_0x4361b3){return function(_0x3f42b3){if(!_0x3f42b3){_0x29010c['sendStatus'](0x194);}return _0x3f42b3;};}function handleError(_0x28e5bb,_0x2c873c){_0x2c873c=_0x2c873c||0x1f4;return function(_0x21fd32){logger[_0x2778('0x23')](_0x21fd32[_0x2778('0x24')]);if(_0x21fd32[_0x2778('0x25')]){delete _0x21fd32[_0x2778('0x25')];}_0x28e5bb[_0x2778('0x16')](_0x2c873c)[_0x2778('0x26')](_0x21fd32);};}exports[_0x2778('0x27')]=function(_0xe17bdb,_0x1c7702){var _0x4293ec={},_0x2c06d8={},_0x4698ac={'count':0x0,'rows':[]};var _0x448289=_[_0x2778('0x28')](db[_0x2778('0x29')]['rawAttributes'],function(_0x4f2eb7){return{'name':_0x4f2eb7[_0x2778('0x2a')],'type':_0x4f2eb7[_0x2778('0x2b')][_0x2778('0x2c')]};});_0x2c06d8[_0x2778('0x2d')]=_[_0x2778('0x28')](_0x448289,_0x2778('0x25'));_0x2c06d8[_0x2778('0x2e')]=_[_0x2778('0x2f')](_0xe17bdb[_0x2778('0x2e')]);_0x2c06d8['filters']=_[_0x2778('0x30')](_0x2c06d8['model'],_0x2c06d8['query']);_0x4293ec['attributes']=_['intersection'](_0x2c06d8[_0x2778('0x2d')],qs[_0x2778('0x31')](_0xe17bdb['query'][_0x2778('0x31')]));_0x4293ec[_0x2778('0x32')]=_0x4293ec[_0x2778('0x32')][_0x2778('0x33')]?_0x4293ec[_0x2778('0x32')]:_0x2c06d8[_0x2778('0x2d')];if(!_0xe17bdb[_0x2778('0x2e')]['hasOwnProperty'](_0x2778('0x34'))){_0x4293ec[_0x2778('0x19')]=qs['limit'](_0xe17bdb[_0x2778('0x2e')][_0x2778('0x19')]);_0x4293ec['offset']=qs[_0x2778('0x1b')](_0xe17bdb['query'][_0x2778('0x1b')]);}_0x4293ec[_0x2778('0x35')]=qs[_0x2778('0x36')](_0xe17bdb[_0x2778('0x2e')]['sort']);_0x4293ec['where']=qs[_0x2778('0x37')](_['pick'](_0xe17bdb[_0x2778('0x2e')],_0x2c06d8[_0x2778('0x37')]),_0x448289);if(_0xe17bdb['query'][_0x2778('0x38')]){_0x4293ec[_0x2778('0x39')]=_[_0x2778('0x3a')](_0x4293ec[_0x2778('0x39')],{'$or':_['map'](_0x448289,function(_0x1cba7f){if(_0x1cba7f[_0x2778('0x2b')]!=='VIRTUAL'){var _0x177e33={};_0x177e33[_0x1cba7f[_0x2778('0x25')]]={'$like':'%'+_0xe17bdb[_0x2778('0x2e')][_0x2778('0x38')]+'%'};return _0x177e33;}})});}_0x4293ec=_[_0x2778('0x3a')]({},_0x4293ec,_0xe17bdb[_0x2778('0x3b')]);var _0x43d1df={'where':_0x4293ec['where']};return db[_0x2778('0x29')][_0x2778('0x1a')](_0x43d1df)[_0x2778('0x1f')](function(_0x1d57dc){_0x4698ac['count']=_0x1d57dc;if(_0xe17bdb[_0x2778('0x2e')][_0x2778('0x3c')]){_0x4293ec[_0x2778('0x3d')]=[{'all':!![]}];}return db[_0x2778('0x29')][_0x2778('0x3e')](_0x4293ec);})[_0x2778('0x1f')](function(_0x2966d3){_0x4698ac[_0x2778('0x3f')]=_0x2966d3;return _0x4698ac;})[_0x2778('0x1f')](respondWithFilteredResult(_0x1c7702,_0x4293ec))['catch'](handleError(_0x1c7702,null));};exports[_0x2778('0x40')]=function(_0x4332fe,_0x12231d){var _0x1d5c52={'raw':!![],'where':{'id':_0x4332fe[_0x2778('0x41')]['id']}},_0x141ac1={};_0x141ac1[_0x2778('0x2d')]=_[_0x2778('0x2f')](db[_0x2778('0x29')]['rawAttributes']);_0x141ac1[_0x2778('0x2e')]=_['keys'](_0x4332fe[_0x2778('0x2e')]);_0x141ac1[_0x2778('0x37')]=_[_0x2778('0x30')](_0x141ac1[_0x2778('0x2d')],_0x141ac1[_0x2778('0x2e')]);_0x1d5c52[_0x2778('0x32')]=_[_0x2778('0x30')](_0x141ac1[_0x2778('0x2d')],qs[_0x2778('0x31')](_0x4332fe[_0x2778('0x2e')][_0x2778('0x31')]));_0x1d5c52[_0x2778('0x32')]=_0x1d5c52[_0x2778('0x32')][_0x2778('0x33')]?_0x1d5c52[_0x2778('0x32')]:_0x141ac1[_0x2778('0x2d')];if(_0x4332fe[_0x2778('0x2e')][_0x2778('0x3c')]){_0x1d5c52[_0x2778('0x3d')]=[{'all':!![]}];}_0x1d5c52=_[_0x2778('0x3a')]({},_0x1d5c52,_0x4332fe[_0x2778('0x3b')]);return db['CmHopperAdditionalPhone'][_0x2778('0x42')](_0x1d5c52)[_0x2778('0x1f')](handleEntityNotFound(_0x12231d,null))[_0x2778('0x1f')](respondWithResult(_0x12231d,null))[_0x2778('0x43')](handleError(_0x12231d,null));};exports[_0x2778('0x44')]=function(_0x171470,_0x510360){return db[_0x2778('0x29')][_0x2778('0x44')](_0x171470[_0x2778('0x45')],{})['then'](function(_0x217486){var _0x161ef2=_0x171470[_0x2778('0x46')][_0x2778('0x20')]({'plain':!![]});if(!_0x161ef2)throw new Error(_0x2778('0x47'));if(_0x161ef2[_0x2778('0x48')]===_0x2778('0x46')){var _0x17d705=_0x217486[_0x2778('0x20')]({'plain':!![]});var _0x375f3b=_0x2778('0x49');return db[_0x2778('0x4a')][_0x2778('0x42')]({'where':{'name':_0x375f3b,'userProfileId':_0x161ef2['userProfileId']},'raw':!![]})[_0x2778('0x1f')](function(_0x3c99e6){if(_0x3c99e6&&_0x3c99e6['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x17d705[_0x2778('0x25')],'resourceId':_0x17d705['id'],'type':_0x3c99e6['name'],'sectionId':_0x3c99e6['id']},{})[_0x2778('0x1f')](function(){return _0x217486;});}else{return _0x217486;}})[_0x2778('0x43')](function(_0x141896){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x141896);throw _0x141896;});}return _0x217486;})[_0x2778('0x1f')](respondWithResult(_0x510360,0xc9))[_0x2778('0x43')](handleError(_0x510360,null));};exports['update']=function(_0x12406d,_0x3a95e1){if(_0x12406d['body']['id']){delete _0x12406d[_0x2778('0x45')]['id'];}return db[_0x2778('0x29')][_0x2778('0x42')]({'where':{'id':_0x12406d[_0x2778('0x41')]['id']}})[_0x2778('0x1f')](handleEntityNotFound(_0x3a95e1,null))['then'](saveUpdates(_0x12406d[_0x2778('0x45')],null))['then'](respondWithResult(_0x3a95e1,null))[_0x2778('0x43')](handleError(_0x3a95e1,null));};exports[_0x2778('0x22')]=function(_0x593d7f,_0x39e7fb){return db[_0x2778('0x29')]['find']({'where':{'id':_0x593d7f[_0x2778('0x41')]['id']}})[_0x2778('0x1f')](handleEntityNotFound(_0x39e7fb,null))['then'](removeEntity(_0x39e7fb,null))['catch'](handleError(_0x39e7fb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 329de88..cd62a33 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd734=['moment','request-promise','rimraf','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api'];(function(_0x5b6353,_0x17c692){var _0x5e940b=function(_0x1d8405){while(--_0x1d8405){_0x5b6353['push'](_0x5b6353['shift']());}};_0x5e940b(++_0x17c692);}(_0xd734,0x18c));var _0x4d73=function(_0x5ac031,_0x4007bb){_0x5ac031=_0x5ac031-0x0;var _0xd8b5e3=_0xd734[_0x5ac031];return _0xd8b5e3;};'use strict';var _=require(_0x4d73('0x0'));var util=require(_0x4d73('0x1'));var logger=require(_0x4d73('0x2'))(_0x4d73('0x3'));var moment=require(_0x4d73('0x4'));var BPromise=require('bluebird');var rp=require(_0x4d73('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4d73('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d73('0x7'));module['exports']=function(_0x361d70,_0x209d65){return _0x361d70[_0x4d73('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x4d73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf95f=['api','moment','bluebird','request-promise','path','rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x15e1e1,_0x460cf5){var _0xe6f102=function(_0x4fbb68){while(--_0x4fbb68){_0x15e1e1['push'](_0x15e1e1['shift']());}};_0xe6f102(++_0x460cf5);}(_0xf95f,0x142));var _0xff95=function(_0x3831ed,_0x5e88ce){_0x3831ed=_0x3831ed-0x0;var _0x5521ce=_0xf95f[_0x3831ed];return _0x5521ce;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var logger=require(_0xff95('0x2'))(_0xff95('0x3'));var moment=require(_0xff95('0x4'));var BPromise=require(_0xff95('0x5'));var rp=require(_0xff95('0x6'));var fs=require('fs');var path=require(_0xff95('0x7'));var rimraf=require(_0xff95('0x8'));var config=require('../../config/environment');var attributes=require(_0xff95('0x9'));module['exports']=function(_0x3f72b4,_0x4fb1ed){return _0x3f72b4[_0xff95('0xa')](_0xff95('0xb'),attributes,{'tableName':_0xff95('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 3eb5f82..6bcf556 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf87d=['countnosuchnumberretry','countabandonedretry','dialGlobalMaxRetry','countdropretry','countmachineretry','countagentrejectretry','entity','SwapAdditionalPhones','CmHopper','ContactId','then','duration','waitTime','scheduledat','add','minutes','isNil','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VerifyAdditionalPhones','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf87d,0x13c));var _0xdf87=function(_0x10b593,_0x4e497d){_0x10b593=_0x10b593-0x0;var _0x40cf20=_0xf87d[_0x10b593];return _0x40cf20;};'use strict';var _=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var moment=require(_0xdf87('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdf87('0x3'));var db=require(_0xdf87('0x4'))['db'];var utils=require(_0xdf87('0x5'));var logger=require(_0xdf87('0x6'))(_0xdf87('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdf87('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5174b3,_0x45397c,_0x16bda4){return new BPromise(function(_0x522a00,_0x58f1d1){return client[_0xdf87('0x9')](_0x5174b3,_0x16bda4)['then'](function(_0x149ae3){logger[_0xdf87('0xa')](_0xdf87('0xb'),_0x45397c,_0xdf87('0xc'));logger[_0xdf87('0xd')](_0xdf87('0xe'),_0x45397c,'request\x20sent',JSON['stringify'](_0x149ae3));if(_0x149ae3[_0xdf87('0xf')]){if(_0x149ae3[_0xdf87('0xf')][_0xdf87('0x10')]===0x1f4){logger[_0xdf87('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x45397c,_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);return _0x58f1d1(_0x149ae3[_0xdf87('0xf')]['message']);}logger[_0xdf87('0xf')](_0xdf87('0xb'),_0x45397c,_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);return _0x522a00(_0x149ae3[_0xdf87('0xf')][_0xdf87('0x11')]);}else{logger[_0xdf87('0xa')](_0xdf87('0xb'),_0x45397c,_0xdf87('0xc'));_0x522a00(_0x149ae3[_0xdf87('0x12')][_0xdf87('0x11')]);}})[_0xdf87('0x13')](function(_0x1147c5){logger[_0xdf87('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x45397c,_0x1147c5);_0x58f1d1(_0x1147c5);});});}exports[_0xdf87('0x14')]=function(_0x13b1bd){var _0x471125=this;return new Promise(function(_0x46e018,_0x34f392){return db['CmHopper'][_0xdf87('0x15')]({'raw':!![],'where':{'ContactId':_0x13b1bd['body']['ContactId'],'ListId':_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x17')],'VoiceQueueId':_0x13b1bd[_0xdf87('0x16')]['VoiceQueueId']===undefined?null:_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x18')],'CampaignId':_0x13b1bd[_0xdf87('0x16')][_0xdf87('0x19')]===undefined?null:_0x13b1bd['body'][_0xdf87('0x19')]}})['then'](function(_0x2a4109){if(_0x2a4109!=null){return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2a4109['id'],'OrderBy':{'$gt':_0x2a4109[_0xdf87('0x1b')]}},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x5d56b0){var _0x396661=0x0;if(_0x5d56b0){if(_0x5d56b0[_0xdf87('0x1d')]+_0x5d56b0[_0xdf87('0x1e')]+_0x5d56b0[_0xdf87('0x1f')]+_0x5d56b0[_0xdf87('0x20')]+_0x5d56b0['countdropretry']+_0x5d56b0[_0xdf87('0x21')]+_0x5d56b0['countmachineretry']+_0x5d56b0['countagentrejectretry']<_0x13b1bd['entity'][_0xdf87('0x22')])_0x396661=0x1;_0x46e018({'additional':_0x396661});}else{return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2a4109['id']},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x42e491){var _0x37f81c=0x0;if(_0x42e491){if(_0x42e491[_0xdf87('0x1d')]+_0x42e491[_0xdf87('0x1e')]+_0x42e491[_0xdf87('0x1f')]+_0x42e491[_0xdf87('0x20')]+_0x42e491[_0xdf87('0x23')]+_0x42e491[_0xdf87('0x21')]+_0x42e491[_0xdf87('0x24')]+_0x42e491[_0xdf87('0x25')]<_0x13b1bd[_0xdf87('0x26')][_0xdf87('0x22')])_0x37f81c=0x1;_0x46e018({'additional':_0x37f81c});}else{_0x46e018({'additional':0x0});}})[_0xdf87('0x13')](function(_0x506d79){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0x506d79[_0xdf87('0x11')]);_0x34f392(_0x471125[_0xdf87('0xf')](0x1f4,_0x506d79['message']));});}})['catch'](function(_0xed8b81){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0xed8b81[_0xdf87('0x11')]);_0x34f392(_0x471125[_0xdf87('0xf')](0x1f4,_0xed8b81[_0xdf87('0x11')]));});}else _0x46e018({'additional':0x0});});});};exports[_0xdf87('0x27')]=function(_0x21f690){var _0x330c5e=this;return new Promise(function(_0x4a1194,_0x278e6a){return db[_0xdf87('0x28')][_0xdf87('0x15')]({'raw':!![],'where':{'ContactId':_0x21f690[_0xdf87('0x16')][_0xdf87('0x29')],'ListId':_0x21f690['body'][_0xdf87('0x17')],'VoiceQueueId':_0x21f690['body'][_0xdf87('0x18')]===undefined?null:_0x21f690[_0xdf87('0x16')][_0xdf87('0x18')],'CampaignId':_0x21f690[_0xdf87('0x16')][_0xdf87('0x19')]===undefined?null:_0x21f690[_0xdf87('0x16')][_0xdf87('0x19')]}})[_0xdf87('0x2a')](function(_0x2fefc2){if(_0x2fefc2!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x2fefc2['id'],'OrderBy':{'$gte':_0x2fefc2[_0xdf87('0x1b')]}},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})[_0xdf87('0x2a')](function(_0x35186f){if(_0x35186f)return activateAdditionalPhone(_0x2fefc2,_0x21f690[_0xdf87('0x16')],_0x35186f,_0x21f690[_0xdf87('0x2b')],_0x21f690[_0xdf87('0x2c')])[_0xdf87('0x2a')](function(_0x3b2287){_0x4a1194(_0x3b2287);});else{return db[_0xdf87('0x1a')][_0xdf87('0x15')]({'raw':!![],'where':{'CmHopperId':_0x2fefc2['id']},'order':[[_0xdf87('0x1b'),_0xdf87('0x1c')]]})['then'](function(_0x5072d4){if(_0x5072d4)return activateAdditionalPhone(_0x2fefc2,_0x21f690[_0xdf87('0x16')],_0x5072d4,_0x21f690[_0xdf87('0x2b')],_0x21f690[_0xdf87('0x2c')])['then'](function(_0xf6e220){_0x4a1194(_0xf6e220);});else{_0x4a1194({'id':_0x2fefc2['id'],'phone':''});}})[_0xdf87('0x13')](function(_0x5247ef){logger['error'](_0xdf87('0x14'),_0x5247ef[_0xdf87('0x11')]);_0x278e6a(_0x330c5e['error'](0x1f4,_0x5247ef[_0xdf87('0x11')]));});}})[_0xdf87('0x13')](function(_0x5afb1e){logger[_0xdf87('0xf')]('VerifyAdditionalPhones',_0x5afb1e[_0xdf87('0x11')]);_0x278e6a(_0x330c5e[_0xdf87('0xf')](0x1f4,_0x5afb1e[_0xdf87('0x11')]));});}else _0x4a1194(0x1);});});};function activateAdditionalPhone(_0xcc7394,_0x1bb6dd,_0x365668,_0x534adc,_0x4e682a){return new Promise(function(_0x23156a,_0x2d1ada){var _0x375aeb;if(_['isNil'](_0x365668[_0xdf87('0x2d')])){_0x365668[_0xdf87('0x2d')]=moment();}if(moment()>moment(_0x365668[_0xdf87('0x2d')])){_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,'minutes');}else{if(_0x365668[_0xdf87('0x1b')]==0x0){_0x375aeb=moment(_0x365668[_0xdf87('0x2d')]);}else{_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,_0xdf87('0x2f'));}}if(_[_0xdf87('0x30')](_0x375aeb)){_0x375aeb=moment()[_0xdf87('0x2e')](_0x4e682a||0x3,_0xdf87('0x2f'));}var _0x2daa1d={'phone':_0xcc7394[_0xdf87('0x31')],'active':0x0,'OrderBy':_[_0xdf87('0x30')](_0xcc7394['OrderBy'])?0x0:_0xcc7394['OrderBy'],'scheduledat':moment()[_0xdf87('0x2e')](_0x534adc||0x1,_0xdf87('0x2f')),'countbusyretry':_0x1bb6dd[_0xdf87('0x1d')],'countcongestionretry':_0x1bb6dd['countcongestionretry'],'countnoanswerretry':_0x1bb6dd['countnoanswerretry'],'countnosuchnumberretry':_0x1bb6dd[_0xdf87('0x20')],'countdropretry':_0x1bb6dd[_0xdf87('0x23')],'countabandonedretry':_0x1bb6dd[_0xdf87('0x21')],'countmachineretry':_0x1bb6dd[_0xdf87('0x24')],'countagentrejectretry':_0x1bb6dd[_0xdf87('0x25')],'createdAt':_0x1bb6dd[_0xdf87('0x32')],'updatedAt':_0x1bb6dd[_0xdf87('0x33')]};var _0xd9997f={'CmHopperId':_0xcc7394['id'],'phone':_0x365668[_0xdf87('0x31')],'active':0x0,'OrderBy':_[_0xdf87('0x30')](_0x365668[_0xdf87('0x1b')])?0x0:_0x365668[_0xdf87('0x1b')],'scheduledat':_0x375aeb,'countbusyretry':_0x365668[_0xdf87('0x1d')],'countcongestionretry':_0x365668[_0xdf87('0x1e')],'countnoanswerretry':_0x365668['countnoanswerretry'],'countnosuchnumberretry':_0x365668[_0xdf87('0x20')],'countdropretry':_0x365668[_0xdf87('0x23')],'countabandonedretry':_0x365668[_0xdf87('0x21')],'countmachineretry':_0x365668[_0xdf87('0x24')],'countagentrejectretry':_0x365668[_0xdf87('0x25')],'createdAt':_0x365668[_0xdf87('0x32')],'updatedAt':_0x365668[_0xdf87('0x33')]};return db[_0xdf87('0x34')][_0xdf87('0x35')](function(_0x656e01){return db[_0xdf87('0x1a')]['update'](_0x2daa1d,{'where':{'id':_0x365668['id']}},{'transaction':_0x656e01})[_0xdf87('0x2a')](function(){return db['CmHopper'][_0xdf87('0x36')](_0xd9997f,{'where':{'id':_0xcc7394['id']}},{'transaction':_0x656e01});});})[_0xdf87('0x2a')](function(_0x417b05){_0x23156a({'id':_0xcc7394['id'],'phone':_0x365668[_0xdf87('0x31')]});})[_0xdf87('0x13')](function(_0x5df7c4){logger[_0xdf87('0xf')](_0xdf87('0x37'),_0x5df7c4['message']);_0x2d1ada({'error':_0x5df7c4['message']});});});}exports['IncrementPreviewCounters']=function(_0x261ecb){var _0x19e7f1=this;return new Promise(function(_0x3e641b,_0x32595f){return db[_0xdf87('0x28')][_0xdf87('0x36')](_0x261ecb[_0xdf87('0x16')][_0xdf87('0x38')],{'where':{'id':_0x261ecb[_0xdf87('0x16')]['id']}})[_0xdf87('0x2a')](function(_0x34e0f7){_0x3e641b(_0x34e0f7);})['catch'](function(_0x3f7425){logger['error'](_0xdf87('0x39'),_0x3f7425['message']);_0x32595f(_0x19e7f1[_0xdf87('0xf')](0x1f4,_0x3f7425[_0xdf87('0x11')]));});});}; \ No newline at end of file +var _0xfe46=['body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','VerifyAdditionalPhones','SwapAdditionalPhones','waitTime','duration','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','countcongestionretry','transaction','update','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','http','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','CmHopper','findOne'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0xfe46,0x8c));var _0x6fe4=function(_0x1f3ae4,_0x7aa051){_0x1f3ae4=_0x1f3ae4-0x0;var _0x42b048=_0xfe46[_0x1f3ae4];return _0x42b048;};'use strict';var _=require(_0x6fe4('0x0'));var util=require('util');var moment=require(_0x6fe4('0x1'));var BPromise=require('bluebird');var rs=require(_0x6fe4('0x2'));var fs=require('fs');var Redis=require(_0x6fe4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fe4('0x4'));var logger=require(_0x6fe4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6fe4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x231685,_0x1289d5,_0x4a6188){return new BPromise(function(_0x1068b8,_0x5de25f){return client['request'](_0x231685,_0x4a6188)[_0x6fe4('0x7')](function(_0xf9ac41){logger[_0x6fe4('0x8')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1289d5,_0x6fe4('0x9'));logger[_0x6fe4('0xa')](_0x6fe4('0xb'),_0x1289d5,'request\x20sent',JSON['stringify'](_0xf9ac41));if(_0xf9ac41[_0x6fe4('0xc')]){if(_0xf9ac41[_0x6fe4('0xc')][_0x6fe4('0xd')]===0x1f4){logger[_0x6fe4('0xc')](_0x6fe4('0xe'),_0x1289d5,_0xf9ac41[_0x6fe4('0xc')][_0x6fe4('0xf')]);return _0x5de25f(_0xf9ac41[_0x6fe4('0xc')][_0x6fe4('0xf')]);}logger['error']('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1289d5,_0xf9ac41[_0x6fe4('0xc')][_0x6fe4('0xf')]);return _0x1068b8(_0xf9ac41[_0x6fe4('0xc')][_0x6fe4('0xf')]);}else{logger[_0x6fe4('0x8')](_0x6fe4('0xe'),_0x1289d5,_0x6fe4('0x9'));_0x1068b8(_0xf9ac41[_0x6fe4('0x10')][_0x6fe4('0xf')]);}})['catch'](function(_0x5d3ba3){logger['error'](_0x6fe4('0xe'),_0x1289d5,_0x5d3ba3);_0x5de25f(_0x5d3ba3);});});}exports['VerifyAdditionalPhones']=function(_0x426f68){var _0x57095b=this;return new Promise(function(_0x3d6773,_0x13abfa){return db[_0x6fe4('0x11')][_0x6fe4('0x12')]({'raw':!![],'where':{'ContactId':_0x426f68[_0x6fe4('0x13')][_0x6fe4('0x14')],'ListId':_0x426f68['body'][_0x6fe4('0x15')],'VoiceQueueId':_0x426f68[_0x6fe4('0x13')][_0x6fe4('0x16')]===undefined?null:_0x426f68[_0x6fe4('0x13')]['VoiceQueueId'],'CampaignId':_0x426f68[_0x6fe4('0x13')][_0x6fe4('0x17')]===undefined?null:_0x426f68[_0x6fe4('0x13')][_0x6fe4('0x17')]}})[_0x6fe4('0x7')](function(_0x5b8a3f){if(_0x5b8a3f!=null){return db[_0x6fe4('0x18')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b8a3f['id'],'OrderBy':{'$gt':_0x5b8a3f['OrderBy']}},'order':[[_0x6fe4('0x19'),_0x6fe4('0x1a')]]})[_0x6fe4('0x7')](function(_0x4efed6){var _0xfa060a=0x0;if(_0x4efed6){if(_0x4efed6[_0x6fe4('0x1b')]+_0x4efed6['countcongestionretry']+_0x4efed6[_0x6fe4('0x1c')]+_0x4efed6[_0x6fe4('0x1d')]+_0x4efed6[_0x6fe4('0x1e')]+_0x4efed6[_0x6fe4('0x1f')]+_0x4efed6[_0x6fe4('0x20')]+_0x4efed6[_0x6fe4('0x21')]<_0x426f68[_0x6fe4('0x22')][_0x6fe4('0x23')])_0xfa060a=0x1;_0x3d6773({'additional':_0xfa060a});}else{return db[_0x6fe4('0x18')][_0x6fe4('0x12')]({'raw':!![],'where':{'CmHopperId':_0x5b8a3f['id']},'order':[[_0x6fe4('0x19'),_0x6fe4('0x1a')]]})[_0x6fe4('0x7')](function(_0x321ad2){var _0x17cfaa=0x0;if(_0x321ad2){if(_0x321ad2[_0x6fe4('0x1b')]+_0x321ad2['countcongestionretry']+_0x321ad2['countnoanswerretry']+_0x321ad2[_0x6fe4('0x1d')]+_0x321ad2[_0x6fe4('0x1e')]+_0x321ad2[_0x6fe4('0x1f')]+_0x321ad2[_0x6fe4('0x20')]+_0x321ad2[_0x6fe4('0x21')]<_0x426f68[_0x6fe4('0x22')][_0x6fe4('0x23')])_0x17cfaa=0x1;_0x3d6773({'additional':_0x17cfaa});}else{_0x3d6773({'additional':0x0});}})[_0x6fe4('0x24')](function(_0xce0bd4){logger['error'](_0x6fe4('0x25'),_0xce0bd4[_0x6fe4('0xf')]);_0x13abfa(_0x57095b[_0x6fe4('0xc')](0x1f4,_0xce0bd4[_0x6fe4('0xf')]));});}})[_0x6fe4('0x24')](function(_0x6322a5){logger['error']('VerifyAdditionalPhones',_0x6322a5[_0x6fe4('0xf')]);_0x13abfa(_0x57095b['error'](0x1f4,_0x6322a5[_0x6fe4('0xf')]));});}else _0x3d6773({'additional':0x0});});});};exports[_0x6fe4('0x26')]=function(_0x2510e4){var _0x6a9be8=this;return new Promise(function(_0x4bcc77,_0x5c59b2){return db[_0x6fe4('0x11')][_0x6fe4('0x12')]({'raw':!![],'where':{'ContactId':_0x2510e4[_0x6fe4('0x13')][_0x6fe4('0x14')],'ListId':_0x2510e4['body']['ListId'],'VoiceQueueId':_0x2510e4[_0x6fe4('0x13')][_0x6fe4('0x16')]===undefined?null:_0x2510e4[_0x6fe4('0x13')][_0x6fe4('0x16')],'CampaignId':_0x2510e4['body'][_0x6fe4('0x17')]===undefined?null:_0x2510e4['body'][_0x6fe4('0x17')]}})[_0x6fe4('0x7')](function(_0x5996ab){if(_0x5996ab!=null){return db[_0x6fe4('0x18')][_0x6fe4('0x12')]({'raw':!![],'where':{'CmHopperId':_0x5996ab['id'],'OrderBy':{'$gte':_0x5996ab[_0x6fe4('0x19')]}},'order':[[_0x6fe4('0x19'),'ASC']]})[_0x6fe4('0x7')](function(_0xc830d0){if(_0xc830d0)return activateAdditionalPhone(_0x5996ab,_0x2510e4['body'],_0xc830d0,_0x2510e4['duration'],_0x2510e4[_0x6fe4('0x27')])[_0x6fe4('0x7')](function(_0x18fcda){_0x4bcc77(_0x18fcda);});else{return db[_0x6fe4('0x18')][_0x6fe4('0x12')]({'raw':!![],'where':{'CmHopperId':_0x5996ab['id']},'order':[[_0x6fe4('0x19'),_0x6fe4('0x1a')]]})[_0x6fe4('0x7')](function(_0x4b8887){if(_0x4b8887)return activateAdditionalPhone(_0x5996ab,_0x2510e4[_0x6fe4('0x13')],_0x4b8887,_0x2510e4[_0x6fe4('0x28')],_0x2510e4[_0x6fe4('0x27')])['then'](function(_0x329cfa){_0x4bcc77(_0x329cfa);});else{_0x4bcc77({'id':_0x5996ab['id'],'phone':''});}})[_0x6fe4('0x24')](function(_0x4077b7){logger[_0x6fe4('0xc')]('VerifyAdditionalPhones',_0x4077b7[_0x6fe4('0xf')]);_0x5c59b2(_0x6a9be8['error'](0x1f4,_0x4077b7[_0x6fe4('0xf')]));});}})[_0x6fe4('0x24')](function(_0x552796){logger['error'](_0x6fe4('0x25'),_0x552796['message']);_0x5c59b2(_0x6a9be8[_0x6fe4('0xc')](0x1f4,_0x552796[_0x6fe4('0xf')]));});}else _0x4bcc77(0x1);});});};function activateAdditionalPhone(_0x4d85c1,_0x3b466b,_0xb0079b,_0x1d02a3,_0x51d8f4){return new Promise(function(_0x4e9952,_0x42787e){var _0x21e004;if(_[_0x6fe4('0x29')](_0xb0079b[_0x6fe4('0x2a')])){_0xb0079b['scheduledat']=moment();}if(moment()>moment(_0xb0079b[_0x6fe4('0x2a')])){_0x21e004=moment()[_0x6fe4('0x2b')](_0x51d8f4||0x3,'minutes');}else{if(_0xb0079b[_0x6fe4('0x19')]==0x0){_0x21e004=moment(_0xb0079b[_0x6fe4('0x2a')]);}else{_0x21e004=moment()[_0x6fe4('0x2b')](_0x51d8f4||0x3,_0x6fe4('0x2c'));}}if(_[_0x6fe4('0x29')](_0x21e004)){_0x21e004=moment()['add'](_0x51d8f4||0x3,_0x6fe4('0x2c'));}var _0x2298c6={'phone':_0x4d85c1[_0x6fe4('0x2d')],'active':0x0,'OrderBy':_[_0x6fe4('0x29')](_0x4d85c1[_0x6fe4('0x19')])?0x0:_0x4d85c1[_0x6fe4('0x19')],'scheduledat':moment()[_0x6fe4('0x2b')](_0x1d02a3||0x1,'minutes'),'countbusyretry':_0x3b466b[_0x6fe4('0x1b')],'countcongestionretry':_0x3b466b['countcongestionretry'],'countnoanswerretry':_0x3b466b[_0x6fe4('0x1c')],'countnosuchnumberretry':_0x3b466b[_0x6fe4('0x1d')],'countdropretry':_0x3b466b[_0x6fe4('0x1e')],'countabandonedretry':_0x3b466b['countabandonedretry'],'countmachineretry':_0x3b466b[_0x6fe4('0x20')],'countagentrejectretry':_0x3b466b[_0x6fe4('0x21')],'createdAt':_0x3b466b[_0x6fe4('0x2e')],'updatedAt':_0x3b466b[_0x6fe4('0x2f')]};var _0x1810dc={'CmHopperId':_0x4d85c1['id'],'phone':_0xb0079b[_0x6fe4('0x2d')],'active':0x0,'OrderBy':_['isNil'](_0xb0079b[_0x6fe4('0x19')])?0x0:_0xb0079b[_0x6fe4('0x19')],'scheduledat':_0x21e004,'countbusyretry':_0xb0079b[_0x6fe4('0x1b')],'countcongestionretry':_0xb0079b[_0x6fe4('0x30')],'countnoanswerretry':_0xb0079b[_0x6fe4('0x1c')],'countnosuchnumberretry':_0xb0079b[_0x6fe4('0x1d')],'countdropretry':_0xb0079b['countdropretry'],'countabandonedretry':_0xb0079b[_0x6fe4('0x1f')],'countmachineretry':_0xb0079b[_0x6fe4('0x20')],'countagentrejectretry':_0xb0079b[_0x6fe4('0x21')],'createdAt':_0xb0079b[_0x6fe4('0x2e')],'updatedAt':_0xb0079b[_0x6fe4('0x2f')]};return db['sequelize'][_0x6fe4('0x31')](function(_0xa42011){return db[_0x6fe4('0x18')][_0x6fe4('0x32')](_0x2298c6,{'where':{'id':_0xb0079b['id']}},{'transaction':_0xa42011})[_0x6fe4('0x7')](function(){return db[_0x6fe4('0x11')][_0x6fe4('0x32')](_0x1810dc,{'where':{'id':_0x4d85c1['id']}},{'transaction':_0xa42011});});})[_0x6fe4('0x7')](function(_0x233601){_0x4e9952({'id':_0x4d85c1['id'],'phone':_0xb0079b[_0x6fe4('0x2d')]});})['catch'](function(_0x54dd05){logger[_0x6fe4('0xc')]('activateAdditionalPhone',_0x54dd05['message']);_0x42787e({'error':_0x54dd05[_0x6fe4('0xf')]});});});}exports[_0x6fe4('0x33')]=function(_0x339c36){var _0x180470=this;return new Promise(function(_0x44c646,_0x2f91f9){return db[_0x6fe4('0x11')][_0x6fe4('0x32')](_0x339c36[_0x6fe4('0x13')][_0x6fe4('0x34')],{'where':{'id':_0x339c36[_0x6fe4('0x13')]['id']}})['then'](function(_0x43db59){_0x44c646(_0x43db59);})[_0x6fe4('0x24')](function(_0x3543ec){logger[_0x6fe4('0xc')](_0x6fe4('0x33'),_0x3543ec[_0x6fe4('0xf')]);_0x2f91f9(_0x180470['error'](0x1f4,_0x3543ec[_0x6fe4('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 835351e..89aeea3 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc78=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','put','update','delete','destroy'];(function(_0x1a968e,_0x3f45f4){var _0x2c7b23=function(_0xc1e5c4){while(--_0xc1e5c4){_0x1a968e['push'](_0x1a968e['shift']());}};_0x2c7b23(++_0x3f45f4);}(_0xbc78,0x191));var _0x8bc7=function(_0x5ce358,_0xa88c44){_0x5ce358=_0x5ce358-0x0;var _0x107f30=_0xbc78[_0x5ce358];return _0x107f30;};'use strict';var multer=require(_0x8bc7('0x0'));var util=require(_0x8bc7('0x1'));var path=require(_0x8bc7('0x2'));var timeout=require(_0x8bc7('0x3'));var express=require(_0x8bc7('0x4'));var router=express[_0x8bc7('0x5')]();var fs_extra=require(_0x8bc7('0x6'));var auth=require(_0x8bc7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8bc7('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8bc7('0x9')]);router[_0x8bc7('0xa')](_0x8bc7('0xb'),auth[_0x8bc7('0xc')](),controller[_0x8bc7('0xd')]);router[_0x8bc7('0xe')]('/',auth[_0x8bc7('0xc')](),controller['create']);router[_0x8bc7('0xf')](_0x8bc7('0xb'),auth['isAuthenticated'](),controller[_0x8bc7('0x10')]);router[_0x8bc7('0x11')](_0x8bc7('0xb'),auth[_0x8bc7('0xc')](),controller[_0x8bc7('0x12')]);module[_0x8bc7('0x13')]=router; \ No newline at end of file +var _0x6d1a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','path','connect-timeout'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x6d1a,0x1c0));var _0xa6d1=function(_0x3621be,_0x4ded5c){_0x3621be=_0x3621be-0x0;var _0x1121b1=_0x6d1a[_0x3621be];return _0x1121b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa6d1('0x0'));var timeout=require(_0xa6d1('0x1'));var express=require(_0xa6d1('0x2'));var router=express[_0xa6d1('0x3')]();var fs_extra=require(_0xa6d1('0x4'));var auth=require(_0xa6d1('0x5'));var interaction=require(_0xa6d1('0x6'));var config=require(_0xa6d1('0x7'));var controller=require(_0xa6d1('0x8'));router[_0xa6d1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa6d1('0xa'),auth[_0xa6d1('0xb')](),controller['show']);router[_0xa6d1('0xc')]('/',auth[_0xa6d1('0xb')](),controller[_0xa6d1('0xd')]);router[_0xa6d1('0xe')](_0xa6d1('0xa'),auth[_0xa6d1('0xb')](),controller[_0xa6d1('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa6d1('0x10')]);module[_0xa6d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 6edb708..339c265 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 _0x98a7=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x98a7,0xdf));var _0x798a=function(_0x2af837,_0x3b67ca){_0x2af837=_0x2af837-0x0;var _0x2112e1=_0x98a7[_0x2af837];return _0x2112e1;};'use strict';var moment=require(_0x798a('0x0'));var Sequelize=require(_0x798a('0x1'));module[_0x798a('0x2')]={'phone':{'type':Sequelize[_0x798a('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x798a('0x4')],'unique':_0x798a('0x5')},'ListId':{'type':Sequelize[_0x798a('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x798a('0x4')],'unique':_0x798a('0x5')}}; \ No newline at end of file +var _0xf78f=['exports','STRING','INTEGER','contactListQueue','sequelize'];(function(_0x593098,_0x3db9e4){var _0x21968b=function(_0x30cc34){while(--_0x30cc34){_0x593098['push'](_0x593098['shift']());}};_0x21968b(++_0x3db9e4);}(_0xf78f,0x72));var _0xff78=function(_0x5aaebe,_0x3cfb61){_0x5aaebe=_0x5aaebe-0x0;var _0x18a42b=_0xf78f[_0x5aaebe];return _0x18a42b;};'use strict';var moment=require('moment');var Sequelize=require(_0xff78('0x0'));module[_0xff78('0x1')]={'phone':{'type':Sequelize[_0xff78('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xff78('0x3')],'unique':_0xff78('0x4')},'ListId':{'type':Sequelize[_0xff78('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index be80255..4ec1ac1 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 _0xadee=['options','includeAll','findAll','rows','catch','show','keys','include','body','find','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xadee,0xa2));var _0xeade=function(_0x305c3c,_0x190f72){_0x305c3c=_0x305c3c-0x0;var _0x8d9fb6=_0xadee[_0x305c3c];return _0x8d9fb6;};'use strict';var emlformat=require(_0xeade('0x0'));var rimraf=require(_0xeade('0x1'));var zipdir=require(_0xeade('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeade('0x3'));var moment=require(_0xeade('0x4'));var BPromise=require(_0xeade('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeade('0x6'));var sox=require(_0xeade('0x7'));var csv=require(_0xeade('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeade('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xeade('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeade('0xb'));var Papa=require(_0xeade('0xc'));var Redis=require(_0xeade('0xd'));var authService=require(_0xeade('0xe'));var qs=require(_0xeade('0xf'));var as=require(_0xeade('0x10'));var hardwareService=require(_0xeade('0x11'));var logger=require('../../config/logger')(_0xeade('0x12'));var utils=require(_0xeade('0x13'));var config=require(_0xeade('0x14'));var licenseUtil=require(_0xeade('0x15'));var db=require(_0xeade('0x16'))['db'];function respondWithStatusCode(_0x3957a7,_0x4c1af7){_0x4c1af7=_0x4c1af7||0xcc;return function(_0x16dbe6){if(_0x16dbe6){return _0x3957a7[_0xeade('0x17')](_0x4c1af7);}return _0x3957a7[_0xeade('0x18')](_0x4c1af7)['end']();};}function respondWithResult(_0x34c9c5,_0x56ceb3){_0x56ceb3=_0x56ceb3||0xc8;return function(_0x5ac46e){if(_0x5ac46e){return _0x34c9c5[_0xeade('0x18')](_0x56ceb3)[_0xeade('0x19')](_0x5ac46e);}};}function respondWithFilteredResult(_0x240db2,_0x13e4e9){return function(_0x159a2f){if(_0x159a2f){var _0x216adb=typeof _0x13e4e9['offset']===_0xeade('0x1a')&&typeof _0x13e4e9[_0xeade('0x1b')]===_0xeade('0x1a');var _0x39de5b=_0x159a2f[_0xeade('0x1c')];var _0x3515e1=_0x216adb?0x0:_0x13e4e9[_0xeade('0x1d')];var _0x270d52=_0x216adb?_0x159a2f[_0xeade('0x1c')]:_0x13e4e9['offset']+_0x13e4e9[_0xeade('0x1b')];var _0x613a10;if(_0x270d52>=_0x39de5b){_0x270d52=_0x39de5b;_0x613a10=0xc8;}else{_0x613a10=0xce;}_0x240db2[_0xeade('0x18')](_0x613a10);return _0x240db2[_0xeade('0x1e')](_0xeade('0x1f'),_0x3515e1+'-'+_0x270d52+'/'+_0x39de5b)[_0xeade('0x19')](_0x159a2f);}return null;};}function patchUpdates(_0x4345d6){return function(_0x1afb17){try{jsonpatch['apply'](_0x1afb17,_0x4345d6,!![]);}catch(_0x4115b8){return BPromise[_0xeade('0x20')](_0x4115b8);}return _0x1afb17['save']();};}function saveUpdates(_0x47b3c4,_0x55823a){return function(_0x295f2b){if(_0x295f2b){return _0x295f2b[_0xeade('0x21')](_0x47b3c4)[_0xeade('0x22')](function(_0x1af71f){return _0x1af71f;});}return null;};}function removeEntity(_0x95200d,_0x133f97){return function(_0xc0b15){if(_0xc0b15){return _0xc0b15[_0xeade('0x23')]()[_0xeade('0x22')](function(){_0x95200d[_0xeade('0x18')](0xcc)[_0xeade('0x24')]();});}};}function handleEntityNotFound(_0x59fa3a,_0x3a60b7){return function(_0x2a9d9b){if(!_0x2a9d9b){_0x59fa3a[_0xeade('0x17')](0x194);}return _0x2a9d9b;};}function handleError(_0x5ed7fd,_0x41cf02){_0x41cf02=_0x41cf02||0x1f4;return function(_0x46145e){logger[_0xeade('0x25')](_0x46145e[_0xeade('0x26')]);if(_0x46145e[_0xeade('0x27')]){delete _0x46145e[_0xeade('0x27')];}_0x5ed7fd[_0xeade('0x18')](_0x41cf02)[_0xeade('0x28')](_0x46145e);};}exports[_0xeade('0x29')]=function(_0x3569ce,_0x1bbdeb){var _0xe55078={},_0x37a55e={},_0x3fbe05={'count':0x0,'rows':[]};var _0x445dac=_[_0xeade('0x2a')](db[_0xeade('0x2b')][_0xeade('0x2c')],function(_0x161f7c){return{'name':_0x161f7c[_0xeade('0x2d')],'type':_0x161f7c[_0xeade('0x2e')][_0xeade('0x2f')]};});_0x37a55e[_0xeade('0x30')]=_['map'](_0x445dac,_0xeade('0x27'));_0x37a55e[_0xeade('0x31')]=_['keys'](_0x3569ce[_0xeade('0x31')]);_0x37a55e[_0xeade('0x32')]=_[_0xeade('0x33')](_0x37a55e['model'],_0x37a55e[_0xeade('0x31')]);_0xe55078[_0xeade('0x34')]=_['intersection'](_0x37a55e[_0xeade('0x30')],qs[_0xeade('0x35')](_0x3569ce[_0xeade('0x31')][_0xeade('0x35')]));_0xe55078[_0xeade('0x34')]=_0xe55078[_0xeade('0x34')][_0xeade('0x36')]?_0xe55078['attributes']:_0x37a55e[_0xeade('0x30')];if(!_0x3569ce[_0xeade('0x31')][_0xeade('0x37')](_0xeade('0x38'))){_0xe55078[_0xeade('0x1b')]=qs[_0xeade('0x1b')](_0x3569ce[_0xeade('0x31')]['limit']);_0xe55078['offset']=qs[_0xeade('0x1d')](_0x3569ce[_0xeade('0x31')][_0xeade('0x1d')]);}_0xe55078[_0xeade('0x39')]=qs[_0xeade('0x3a')](_0x3569ce['query'][_0xeade('0x3a')]);_0xe55078['where']=qs[_0xeade('0x32')](_[_0xeade('0x3b')](_0x3569ce[_0xeade('0x31')],_0x37a55e['filters']),_0x445dac);if(_0x3569ce[_0xeade('0x31')]['filter']){_0xe55078[_0xeade('0x3c')]=_[_0xeade('0x3d')](_0xe55078[_0xeade('0x3c')],{'$or':_[_0xeade('0x2a')](_0x445dac,function(_0x3953bc){if(_0x3953bc['type']!==_0xeade('0x3e')){var _0x347155={};_0x347155[_0x3953bc[_0xeade('0x27')]]={'$like':'%'+_0x3569ce[_0xeade('0x31')]['filter']+'%'};return _0x347155;}})});}_0xe55078=_[_0xeade('0x3d')]({},_0xe55078,_0x3569ce[_0xeade('0x3f')]);var _0x338d06={'where':_0xe55078[_0xeade('0x3c')]};return db['CmHopperBlack'][_0xeade('0x1c')](_0x338d06)['then'](function(_0x3fcd85){_0x3fbe05[_0xeade('0x1c')]=_0x3fcd85;if(_0x3569ce[_0xeade('0x31')][_0xeade('0x40')]){_0xe55078['include']=[{'all':!![]}];}return db[_0xeade('0x2b')][_0xeade('0x41')](_0xe55078);})[_0xeade('0x22')](function(_0x355769){_0x3fbe05[_0xeade('0x42')]=_0x355769;return _0x3fbe05;})[_0xeade('0x22')](respondWithFilteredResult(_0x1bbdeb,_0xe55078))[_0xeade('0x43')](handleError(_0x1bbdeb,null));};exports[_0xeade('0x44')]=function(_0x4b60a4,_0x40c49b){var _0x4a1915={'raw':!![],'where':{'id':_0x4b60a4['params']['id']}},_0x62d4ff={};_0x62d4ff['model']=_[_0xeade('0x45')](db[_0xeade('0x2b')][_0xeade('0x2c')]);_0x62d4ff['query']=_[_0xeade('0x45')](_0x4b60a4[_0xeade('0x31')]);_0x62d4ff[_0xeade('0x32')]=_['intersection'](_0x62d4ff[_0xeade('0x30')],_0x62d4ff[_0xeade('0x31')]);_0x4a1915[_0xeade('0x34')]=_[_0xeade('0x33')](_0x62d4ff['model'],qs[_0xeade('0x35')](_0x4b60a4[_0xeade('0x31')][_0xeade('0x35')]));_0x4a1915[_0xeade('0x34')]=_0x4a1915[_0xeade('0x34')][_0xeade('0x36')]?_0x4a1915[_0xeade('0x34')]:_0x62d4ff[_0xeade('0x30')];if(_0x4b60a4[_0xeade('0x31')][_0xeade('0x40')]){_0x4a1915[_0xeade('0x46')]=[{'all':!![]}];}_0x4a1915=_[_0xeade('0x3d')]({},_0x4a1915,_0x4b60a4[_0xeade('0x3f')]);return db['CmHopperBlack']['find'](_0x4a1915)['then'](handleEntityNotFound(_0x40c49b,null))[_0xeade('0x22')](respondWithResult(_0x40c49b,null))['catch'](handleError(_0x40c49b,null));};exports['update']=function(_0x384be3,_0x14d696){if(_0x384be3['body']['id']){delete _0x384be3[_0xeade('0x47')]['id'];}return db[_0xeade('0x2b')][_0xeade('0x48')]({'where':{'id':_0x384be3[_0xeade('0x49')]['id']}})[_0xeade('0x22')](handleEntityNotFound(_0x14d696,null))[_0xeade('0x22')](saveUpdates(_0x384be3['body'],null))[_0xeade('0x22')](respondWithResult(_0x14d696,null))[_0xeade('0x43')](handleError(_0x14d696,null));};exports['destroy']=function(_0x50b683,_0x2d65b1){return db[_0xeade('0x2b')][_0xeade('0x48')]({'where':{'id':_0x50b683[_0xeade('0x49')]['id']}})[_0xeade('0x22')](handleEntityNotFound(_0x2d65b1,null))[_0xeade('0x22')](removeEntity(_0x2d65b1,null))[_0xeade('0x43')](handleError(_0x2d65b1,null));};exports[_0xeade('0x4a')]=function(_0x417505,_0x10fb71){return db[_0xeade('0x2b')][_0xeade('0x4a')]()['then'](respondWithResult(_0x10fb71,null))[_0xeade('0x43')](handleError(_0x10fb71,null));}; \ No newline at end of file +var _0x7a62=['where','filters','pick','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','include','findAll','rows','catch','show','params','find','update','body','describe','eml-format','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort'];(function(_0x45a5a3,_0x4bbd82){var _0x5ba07c=function(_0xaedf7f){while(--_0xaedf7f){_0x45a5a3['push'](_0x45a5a3['shift']());}};_0x5ba07c(++_0x4bbd82);}(_0x7a62,0x17b));var _0x27a6=function(_0x5578f9,_0x44d2fb){_0x5578f9=_0x5578f9-0x0;var _0x542c5a=_0x7a62[_0x5578f9];return _0x542c5a;};'use strict';var emlformat=require(_0x27a6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x27a6('0x1'));var BPromise=require(_0x27a6('0x2'));var Mustache=require(_0x27a6('0x3'));var util=require('util');var path=require(_0x27a6('0x4'));var sox=require(_0x27a6('0x5'));var csv=require('to-csv');var ejs=require(_0x27a6('0x6'));var fs=require('fs');var fs_extra=require(_0x27a6('0x7'));var _=require(_0x27a6('0x8'));var squel=require(_0x27a6('0x9'));var crypto=require(_0x27a6('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x27a6('0xb'));var toCsv=require(_0x27a6('0xc'));var querystring=require('querystring');var Papa=require(_0x27a6('0xd'));var Redis=require(_0x27a6('0xe'));var authService=require(_0x27a6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x27a6('0x10'));var hardwareService=require(_0x27a6('0x11'));var logger=require(_0x27a6('0x12'))(_0x27a6('0x13'));var utils=require('../../config/utils');var config=require(_0x27a6('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x27a6('0x15'))['db'];function respondWithStatusCode(_0x5c40e1,_0x20eb64){_0x20eb64=_0x20eb64||0xcc;return function(_0x43c3b5){if(_0x43c3b5){return _0x5c40e1[_0x27a6('0x16')](_0x20eb64);}return _0x5c40e1[_0x27a6('0x17')](_0x20eb64)[_0x27a6('0x18')]();};}function respondWithResult(_0xb3ff9f,_0x4e6d47){_0x4e6d47=_0x4e6d47||0xc8;return function(_0x5c770f){if(_0x5c770f){return _0xb3ff9f[_0x27a6('0x17')](_0x4e6d47)[_0x27a6('0x19')](_0x5c770f);}};}function respondWithFilteredResult(_0x3babac,_0x108e35){return function(_0x32a668){if(_0x32a668){var _0x5cc458=typeof _0x108e35[_0x27a6('0x1a')]==='undefined'&&typeof _0x108e35[_0x27a6('0x1b')]===_0x27a6('0x1c');var _0x235a35=_0x32a668[_0x27a6('0x1d')];var _0x1b0c0d=_0x5cc458?0x0:_0x108e35[_0x27a6('0x1a')];var _0xcdd9f8=_0x5cc458?_0x32a668['count']:_0x108e35[_0x27a6('0x1a')]+_0x108e35[_0x27a6('0x1b')];var _0x375f34;if(_0xcdd9f8>=_0x235a35){_0xcdd9f8=_0x235a35;_0x375f34=0xc8;}else{_0x375f34=0xce;}_0x3babac[_0x27a6('0x17')](_0x375f34);return _0x3babac['set']('Content-Range',_0x1b0c0d+'-'+_0xcdd9f8+'/'+_0x235a35)['json'](_0x32a668);}return null;};}function patchUpdates(_0x2dafa2){return function(_0xa97f89){try{jsonpatch[_0x27a6('0x1e')](_0xa97f89,_0x2dafa2,!![]);}catch(_0x47bea8){return BPromise[_0x27a6('0x1f')](_0x47bea8);}return _0xa97f89[_0x27a6('0x20')]();};}function saveUpdates(_0x5e3d1e,_0x18891c){return function(_0x1d62f3){if(_0x1d62f3){return _0x1d62f3['update'](_0x5e3d1e)[_0x27a6('0x21')](function(_0x34fc04){return _0x34fc04;});}return null;};}function removeEntity(_0x406778,_0xe2d7e){return function(_0x3f7143){if(_0x3f7143){return _0x3f7143['destroy']()[_0x27a6('0x21')](function(){_0x406778[_0x27a6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d71a0,_0x12f8fb){return function(_0x4de5ea){if(!_0x4de5ea){_0x3d71a0[_0x27a6('0x16')](0x194);}return _0x4de5ea;};}function handleError(_0x561dbc,_0x4b2c3c){_0x4b2c3c=_0x4b2c3c||0x1f4;return function(_0x440f1f){logger[_0x27a6('0x22')](_0x440f1f['stack']);if(_0x440f1f[_0x27a6('0x23')]){delete _0x440f1f[_0x27a6('0x23')];}_0x561dbc[_0x27a6('0x17')](_0x4b2c3c)[_0x27a6('0x24')](_0x440f1f);};}exports[_0x27a6('0x25')]=function(_0x1a970f,_0x4d39e4){var _0x35f4da={},_0x318b1c={},_0x11edc6={'count':0x0,'rows':[]};var _0x3511b6=_[_0x27a6('0x26')](db['CmHopperBlack'][_0x27a6('0x27')],function(_0x579989){return{'name':_0x579989[_0x27a6('0x28')],'type':_0x579989[_0x27a6('0x29')][_0x27a6('0x2a')]};});_0x318b1c['model']=_[_0x27a6('0x26')](_0x3511b6,_0x27a6('0x23'));_0x318b1c[_0x27a6('0x2b')]=_[_0x27a6('0x2c')](_0x1a970f[_0x27a6('0x2b')]);_0x318b1c['filters']=_['intersection'](_0x318b1c[_0x27a6('0x2d')],_0x318b1c[_0x27a6('0x2b')]);_0x35f4da[_0x27a6('0x2e')]=_[_0x27a6('0x2f')](_0x318b1c[_0x27a6('0x2d')],qs['fields'](_0x1a970f[_0x27a6('0x2b')][_0x27a6('0x30')]));_0x35f4da[_0x27a6('0x2e')]=_0x35f4da[_0x27a6('0x2e')][_0x27a6('0x31')]?_0x35f4da[_0x27a6('0x2e')]:_0x318b1c[_0x27a6('0x2d')];if(!_0x1a970f['query'][_0x27a6('0x32')]('nolimit')){_0x35f4da[_0x27a6('0x1b')]=qs['limit'](_0x1a970f['query']['limit']);_0x35f4da[_0x27a6('0x1a')]=qs[_0x27a6('0x1a')](_0x1a970f[_0x27a6('0x2b')]['offset']);}_0x35f4da[_0x27a6('0x33')]=qs[_0x27a6('0x34')](_0x1a970f[_0x27a6('0x2b')][_0x27a6('0x34')]);_0x35f4da[_0x27a6('0x35')]=qs[_0x27a6('0x36')](_[_0x27a6('0x37')](_0x1a970f[_0x27a6('0x2b')],_0x318b1c[_0x27a6('0x36')]),_0x3511b6);if(_0x1a970f[_0x27a6('0x2b')][_0x27a6('0x38')]){_0x35f4da[_0x27a6('0x35')]=_[_0x27a6('0x39')](_0x35f4da[_0x27a6('0x35')],{'$or':_[_0x27a6('0x26')](_0x3511b6,function(_0x51943e){if(_0x51943e[_0x27a6('0x29')]!==_0x27a6('0x3a')){var _0x6e9eb0={};_0x6e9eb0[_0x51943e[_0x27a6('0x23')]]={'$like':'%'+_0x1a970f[_0x27a6('0x2b')][_0x27a6('0x38')]+'%'};return _0x6e9eb0;}})});}_0x35f4da=_[_0x27a6('0x39')]({},_0x35f4da,_0x1a970f[_0x27a6('0x3b')]);var _0x1c79e1={'where':_0x35f4da[_0x27a6('0x35')]};return db[_0x27a6('0x3c')]['count'](_0x1c79e1)['then'](function(_0x138dfc){_0x11edc6[_0x27a6('0x1d')]=_0x138dfc;if(_0x1a970f[_0x27a6('0x2b')][_0x27a6('0x3d')]){_0x35f4da[_0x27a6('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x27a6('0x3f')](_0x35f4da);})[_0x27a6('0x21')](function(_0x318092){_0x11edc6[_0x27a6('0x40')]=_0x318092;return _0x11edc6;})[_0x27a6('0x21')](respondWithFilteredResult(_0x4d39e4,_0x35f4da))[_0x27a6('0x41')](handleError(_0x4d39e4,null));};exports[_0x27a6('0x42')]=function(_0x26a38f,_0x357158){var _0x28c07d={'raw':!![],'where':{'id':_0x26a38f[_0x27a6('0x43')]['id']}},_0xfdb3cc={};_0xfdb3cc[_0x27a6('0x2d')]=_[_0x27a6('0x2c')](db['CmHopperBlack']['rawAttributes']);_0xfdb3cc[_0x27a6('0x2b')]=_['keys'](_0x26a38f['query']);_0xfdb3cc[_0x27a6('0x36')]=_[_0x27a6('0x2f')](_0xfdb3cc[_0x27a6('0x2d')],_0xfdb3cc['query']);_0x28c07d[_0x27a6('0x2e')]=_['intersection'](_0xfdb3cc[_0x27a6('0x2d')],qs[_0x27a6('0x30')](_0x26a38f[_0x27a6('0x2b')][_0x27a6('0x30')]));_0x28c07d[_0x27a6('0x2e')]=_0x28c07d['attributes'][_0x27a6('0x31')]?_0x28c07d[_0x27a6('0x2e')]:_0xfdb3cc[_0x27a6('0x2d')];if(_0x26a38f[_0x27a6('0x2b')][_0x27a6('0x3d')]){_0x28c07d['include']=[{'all':!![]}];}_0x28c07d=_[_0x27a6('0x39')]({},_0x28c07d,_0x26a38f[_0x27a6('0x3b')]);return db[_0x27a6('0x3c')][_0x27a6('0x44')](_0x28c07d)['then'](handleEntityNotFound(_0x357158,null))['then'](respondWithResult(_0x357158,null))[_0x27a6('0x41')](handleError(_0x357158,null));};exports[_0x27a6('0x45')]=function(_0x5837bc,_0x6feebf){if(_0x5837bc[_0x27a6('0x46')]['id']){delete _0x5837bc[_0x27a6('0x46')]['id'];}return db['CmHopperBlack'][_0x27a6('0x44')]({'where':{'id':_0x5837bc[_0x27a6('0x43')]['id']}})['then'](handleEntityNotFound(_0x6feebf,null))['then'](saveUpdates(_0x5837bc[_0x27a6('0x46')],null))['then'](respondWithResult(_0x6feebf,null))[_0x27a6('0x41')](handleError(_0x6feebf,null));};exports['destroy']=function(_0xde1b77,_0x5678a4){return db[_0x27a6('0x3c')]['find']({'where':{'id':_0xde1b77['params']['id']}})[_0x27a6('0x21')](handleEntityNotFound(_0x5678a4,null))[_0x27a6('0x21')](removeEntity(_0x5678a4,null))[_0x27a6('0x41')](handleError(_0x5678a4,null));};exports[_0x27a6('0x47')]=function(_0x406ab7,_0x213ed2){return db[_0x27a6('0x3c')][_0x27a6('0x47')]()[_0x27a6('0x21')](respondWithResult(_0x213ed2,null))[_0x27a6('0x41')](handleError(_0x213ed2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index b3c425d..99085f3 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 _0x3a63=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x410cc5,_0x54eb36){var _0xe64a6c=function(_0x186f6d){while(--_0x186f6d){_0x410cc5['push'](_0x410cc5['shift']());}};_0xe64a6c(++_0x54eb36);}(_0x3a63,0xd0));var _0x33a6=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x3a63[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x33a6('0x0'));var util=require(_0x33a6('0x1'));var logger=require(_0x33a6('0x2'))(_0x33a6('0x3'));var moment=require('moment');var BPromise=require(_0x33a6('0x4'));var rp=require(_0x33a6('0x5'));var fs=require('fs');var path=require(_0x33a6('0x6'));var rimraf=require(_0x33a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x33a6('0x8'));module[_0x33a6('0x9')]=function(_0x960fba,_0x391681){return _0x960fba[_0x33a6('0xa')](_0x33a6('0xb'),attributes,{'tableName':_0x33a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe9a=['define','cm_hopper_black','util','../../config/logger','api','bluebird','path','./cmHopperBlack.attributes','exports'];(function(_0x195e7d,_0x33badb){var _0x501e35=function(_0x431ae9){while(--_0x431ae9){_0x195e7d['push'](_0x195e7d['shift']());}};_0x501e35(++_0x33badb);}(_0xfe9a,0x110));var _0xafe9=function(_0xac0332,_0x347be6){_0xac0332=_0xac0332-0x0;var _0x47523e=_0xfe9a[_0xac0332];return _0x47523e;};'use strict';var _=require('lodash');var util=require(_0xafe9('0x0'));var logger=require(_0xafe9('0x1'))(_0xafe9('0x2'));var moment=require('moment');var BPromise=require(_0xafe9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xafe9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xafe9('0x5'));module[_0xafe9('0x6')]=function(_0x509f29,_0x39b8ad){return _0x509f29[_0xafe9('0x7')]('CmHopperBlack',attributes,{'tableName':_0xafe9('0x8'),'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 15dca02..41b60d8 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 _0x964c=['client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CmHopperBlack','findAll','raw','options','where','attributes','include','model','then','GetCmHopperBlack','debug','UpdateCmHopperBlack','update','body','limit','destroy','DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x6dd57,_0x8ad656){var _0x2e93ca=function(_0x2dbc71){while(--_0x2dbc71){_0x6dd57['push'](_0x6dd57['shift']());}};_0x2e93ca(++_0x8ad656);}(_0x964c,0xfb));var _0xc964=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x964c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc964('0x0'));var moment=require(_0xc964('0x1'));var BPromise=require('bluebird');var rs=require(_0xc964('0x2'));var fs=require('fs');var Redis=require(_0xc964('0x3'));var db=require(_0xc964('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc964('0x5'))(_0xc964('0x6'));var config=require('../../config/environment');var jayson=require(_0xc964('0x7'));var client=jayson[_0xc964('0x8')][_0xc964('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eb3fa,_0x3534b5,_0x3ea8ac){return new BPromise(function(_0x297625,_0xf41306){return client[_0xc964('0xa')](_0x3eb3fa,_0x3ea8ac)['then'](function(_0x2e972d){logger['info'](_0xc964('0xb'),_0x3534b5,_0xc964('0xc'));logger['debug'](_0xc964('0xd'),_0x3534b5,'request\x20sent',JSON[_0xc964('0xe')](_0x2e972d));if(_0x2e972d[_0xc964('0xf')]){if(_0x2e972d['error']['code']===0x1f4){logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x2e972d['error']['message']);return _0xf41306(_0x2e972d['error'][_0xc964('0x10')]);}logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x2e972d[_0xc964('0xf')][_0xc964('0x10')]);return _0x297625(_0x2e972d[_0xc964('0xf')][_0xc964('0x10')]);}else{logger[_0xc964('0x11')](_0xc964('0xb'),_0x3534b5,'request\x20sent');_0x297625(_0x2e972d[_0xc964('0x12')][_0xc964('0x10')]);}})[_0xc964('0x13')](function(_0x4c318c){logger[_0xc964('0xf')](_0xc964('0xb'),_0x3534b5,_0x4c318c);_0xf41306(_0x4c318c);});});}exports['GetCmHopperBlack']=function(_0x3705ce){var _0x1ce70e=this;return new Promise(function(_0x305182,_0x30cd06){return db[_0xc964('0x14')][_0xc964('0x15')]({'raw':_0x3705ce['options']?_0x3705ce['options'][_0xc964('0x16')]===undefined?!![]:![]:!![],'where':_0x3705ce[_0xc964('0x17')]?_0x3705ce['options'][_0xc964('0x18')]||null:null,'attributes':_0x3705ce[_0xc964('0x17')]?_0x3705ce['options'][_0xc964('0x19')]||null:null,'limit':_0x3705ce[_0xc964('0x17')]?_0x3705ce[_0xc964('0x17')]['limit']||null:null,'include':_0x3705ce['options']?_0x3705ce[_0xc964('0x17')][_0xc964('0x1a')]?_['map'](_0x3705ce[_0xc964('0x17')][_0xc964('0x1a')],function(_0xee1dbc){return{'model':db[_0xee1dbc[_0xc964('0x1b')]],'as':_0xee1dbc['as'],'attributes':_0xee1dbc[_0xc964('0x19')],'include':_0xee1dbc['include']?_['map'](_0xee1dbc[_0xc964('0x1a')],function(_0x32a770){return{'model':db[_0x32a770['model']],'as':_0x32a770['as'],'attributes':_0x32a770[_0xc964('0x19')],'include':_0x32a770[_0xc964('0x1a')]?_['map'](_0x32a770[_0xc964('0x1a')],function(_0x55ac8c){return{'model':db[_0x55ac8c[_0xc964('0x1b')]],'as':_0x55ac8c['as'],'attributes':_0x55ac8c[_0xc964('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc964('0x1c')](function(_0x58a310){logger['info'](_0xc964('0x1d'),_0x3705ce);logger[_0xc964('0x1e')](_0xc964('0x1d'),_0x3705ce,JSON['stringify'](_0x58a310));_0x305182(_0x58a310);})[_0xc964('0x13')](function(_0x56c36d){logger[_0xc964('0xf')](_0xc964('0x1d'),_0x56c36d[_0xc964('0x10')],_0x3705ce);_0x30cd06(_0x1ce70e['error'](0x1f4,_0x56c36d[_0xc964('0x10')]));});});};exports[_0xc964('0x1f')]=function(_0x5c25df){var _0x385057=this;return new Promise(function(_0x5e7ef3,_0x15e06b){return db[_0xc964('0x14')][_0xc964('0x20')](_0x5c25df[_0xc964('0x21')],{'raw':_0x5c25df[_0xc964('0x17')]?_0x5c25df['options'][_0xc964('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c25df['options']?_0x5c25df[_0xc964('0x17')][_0xc964('0x18')]||null:null,'attributes':_0x5c25df[_0xc964('0x17')]?_0x5c25df[_0xc964('0x17')][_0xc964('0x19')]||null:null,'limit':_0x5c25df[_0xc964('0x17')]?_0x5c25df[_0xc964('0x17')][_0xc964('0x22')]||null:null})[_0xc964('0x1c')](function(_0x1409ef){logger[_0xc964('0x11')](_0xc964('0x1f'),_0x5c25df);logger[_0xc964('0x1e')](_0xc964('0x1f'),_0x5c25df,JSON[_0xc964('0xe')](_0x1409ef));_0x5e7ef3(_0x1409ef);})['catch'](function(_0xfe0c4a){logger[_0xc964('0xf')](_0xc964('0x1f'),_0xfe0c4a[_0xc964('0x10')],_0x5c25df);_0x15e06b(_0x385057['error'](0x1f4,_0xfe0c4a[_0xc964('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x3e3620){var _0x1eb5cb=this;return new Promise(function(_0x49e90a,_0x1b927f){return db[_0xc964('0x14')][_0xc964('0x23')]({'where':_0x3e3620[_0xc964('0x17')]?_0x3e3620[_0xc964('0x17')][_0xc964('0x18')]||null:null})[_0xc964('0x1c')](function(_0x3d9f1e){logger[_0xc964('0x11')](_0xc964('0x24'),_0x3e3620);logger['debug'](_0xc964('0x24'),_0x3e3620,JSON[_0xc964('0xe')](_0x3d9f1e));_0x49e90a(_0x3d9f1e);})['catch'](function(_0x22250f){logger['error'](_0xc964('0x24'),_0x22250f[_0xc964('0x10')],_0x3e3620);_0x1b927f(_0x1eb5cb[_0xc964('0xf')](0x1f4,_0x22250f['message']));});});}; \ No newline at end of file +var _0x9c0b=['attributes','then','UpdateCmHopperBlack','update','body','where','catch','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model'];(function(_0x1b24e4,_0x51977b){var _0x1573fe=function(_0x3eb377){while(--_0x3eb377){_0x1b24e4['push'](_0x1b24e4['shift']());}};_0x1573fe(++_0x51977b);}(_0x9c0b,0x1dd));var _0xb9c0=function(_0x34cf44,_0x31d9bf){_0x34cf44=_0x34cf44-0x0;var _0x2884f7=_0x9c0b[_0x34cf44];return _0x2884f7;};'use strict';var _=require(_0xb9c0('0x0'));var util=require('util');var moment=require(_0xb9c0('0x1'));var BPromise=require(_0xb9c0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb9c0('0x3'));var db=require(_0xb9c0('0x4'))['db'];var utils=require(_0xb9c0('0x5'));var logger=require(_0xb9c0('0x6'))(_0xb9c0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb9c0('0x8')][_0xb9c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x580a5f,_0x4b945b,_0x126d86){return new BPromise(function(_0x582e6e,_0x552257){return client[_0xb9c0('0xa')](_0x580a5f,_0x126d86)['then'](function(_0x4f0d83){logger['info'](_0xb9c0('0xb'),_0x4b945b,_0xb9c0('0xc'));logger[_0xb9c0('0xd')](_0xb9c0('0xe'),_0x4b945b,_0xb9c0('0xc'),JSON[_0xb9c0('0xf')](_0x4f0d83));if(_0x4f0d83['error']){if(_0x4f0d83['error'][_0xb9c0('0x10')]===0x1f4){logger['error'](_0xb9c0('0xb'),_0x4b945b,_0x4f0d83['error']['message']);return _0x552257(_0x4f0d83[_0xb9c0('0x11')][_0xb9c0('0x12')]);}logger[_0xb9c0('0x11')](_0xb9c0('0xb'),_0x4b945b,_0x4f0d83[_0xb9c0('0x11')][_0xb9c0('0x12')]);return _0x582e6e(_0x4f0d83[_0xb9c0('0x11')]['message']);}else{logger[_0xb9c0('0x13')](_0xb9c0('0xb'),_0x4b945b,'request\x20sent');_0x582e6e(_0x4f0d83[_0xb9c0('0x14')][_0xb9c0('0x12')]);}})['catch'](function(_0x408cff){logger[_0xb9c0('0x11')](_0xb9c0('0xb'),_0x4b945b,_0x408cff);_0x552257(_0x408cff);});});}exports[_0xb9c0('0x15')]=function(_0x5284ed){var _0x415bb3=this;return new Promise(function(_0x3a77a9,_0x3318e3){return db[_0xb9c0('0x16')][_0xb9c0('0x17')]({'raw':_0x5284ed[_0xb9c0('0x18')]?_0x5284ed['options'][_0xb9c0('0x19')]===undefined?!![]:![]:!![],'where':_0x5284ed[_0xb9c0('0x18')]?_0x5284ed[_0xb9c0('0x18')]['where']||null:null,'attributes':_0x5284ed[_0xb9c0('0x18')]?_0x5284ed['options']['attributes']||null:null,'limit':_0x5284ed['options']?_0x5284ed[_0xb9c0('0x18')][_0xb9c0('0x1a')]||null:null,'include':_0x5284ed[_0xb9c0('0x18')]?_0x5284ed[_0xb9c0('0x18')][_0xb9c0('0x1b')]?_[_0xb9c0('0x1c')](_0x5284ed[_0xb9c0('0x18')]['include'],function(_0x466508){return{'model':db[_0x466508[_0xb9c0('0x1d')]],'as':_0x466508['as'],'attributes':_0x466508[_0xb9c0('0x1e')],'include':_0x466508[_0xb9c0('0x1b')]?_[_0xb9c0('0x1c')](_0x466508[_0xb9c0('0x1b')],function(_0xf62dd2){return{'model':db[_0xf62dd2['model']],'as':_0xf62dd2['as'],'attributes':_0xf62dd2[_0xb9c0('0x1e')],'include':_0xf62dd2['include']?_[_0xb9c0('0x1c')](_0xf62dd2[_0xb9c0('0x1b')],function(_0x8a5c09){return{'model':db[_0x8a5c09[_0xb9c0('0x1d')]],'as':_0x8a5c09['as'],'attributes':_0x8a5c09['attributes']};}):[]};}):[]};}):[]:[]})[_0xb9c0('0x1f')](function(_0x42803d){logger[_0xb9c0('0x13')](_0xb9c0('0x15'),_0x5284ed);logger[_0xb9c0('0xd')](_0xb9c0('0x15'),_0x5284ed,JSON[_0xb9c0('0xf')](_0x42803d));_0x3a77a9(_0x42803d);})['catch'](function(_0x53056e){logger['error'](_0xb9c0('0x15'),_0x53056e[_0xb9c0('0x12')],_0x5284ed);_0x3318e3(_0x415bb3[_0xb9c0('0x11')](0x1f4,_0x53056e[_0xb9c0('0x12')]));});});};exports[_0xb9c0('0x20')]=function(_0x50b3ba){var _0x208af0=this;return new Promise(function(_0x2ad79a,_0x401086){return db[_0xb9c0('0x16')][_0xb9c0('0x21')](_0x50b3ba[_0xb9c0('0x22')],{'raw':_0x50b3ba[_0xb9c0('0x18')]?_0x50b3ba['options'][_0xb9c0('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50b3ba[_0xb9c0('0x18')]?_0x50b3ba[_0xb9c0('0x18')][_0xb9c0('0x23')]||null:null,'attributes':_0x50b3ba['options']?_0x50b3ba['options']['attributes']||null:null,'limit':_0x50b3ba[_0xb9c0('0x18')]?_0x50b3ba['options'][_0xb9c0('0x1a')]||null:null})[_0xb9c0('0x1f')](function(_0x11a6dd){logger[_0xb9c0('0x13')](_0xb9c0('0x20'),_0x50b3ba);logger[_0xb9c0('0xd')]('UpdateCmHopperBlack',_0x50b3ba,JSON[_0xb9c0('0xf')](_0x11a6dd));_0x2ad79a(_0x11a6dd);})[_0xb9c0('0x24')](function(_0x3b4ad3){logger[_0xb9c0('0x11')](_0xb9c0('0x20'),_0x3b4ad3[_0xb9c0('0x12')],_0x50b3ba);_0x401086(_0x208af0['error'](0x1f4,_0x3b4ad3[_0xb9c0('0x12')]));});});};exports[_0xb9c0('0x25')]=function(_0x2dd21f){var _0x3f9ff5=this;return new Promise(function(_0x259ac2,_0x5c7814){return db[_0xb9c0('0x16')][_0xb9c0('0x26')]({'where':_0x2dd21f[_0xb9c0('0x18')]?_0x2dd21f['options'][_0xb9c0('0x23')]||null:null})[_0xb9c0('0x1f')](function(_0x3e28cf){logger[_0xb9c0('0x13')](_0xb9c0('0x25'),_0x2dd21f);logger[_0xb9c0('0xd')](_0xb9c0('0x25'),_0x2dd21f,JSON[_0xb9c0('0xf')](_0x3e28cf));_0x259ac2(_0x3e28cf);})['catch'](function(_0x31edf7){logger[_0xb9c0('0x11')](_0xb9c0('0x25'),_0x31edf7[_0xb9c0('0x12')],_0x2dd21f);_0x5c7814(_0x3f9ff5[_0xb9c0('0x11')](0x1f4,_0x31edf7[_0xb9c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05a930e..776bcf5 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 _0x1261=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','index','get','isAuthenticated','describe','/:id','put','delete','destroy'];(function(_0x49ac70,_0x3af65c){var _0x44802e=function(_0x20b60b){while(--_0x20b60b){_0x49ac70['push'](_0x49ac70['shift']());}};_0x44802e(++_0x3af65c);}(_0x1261,0x144));var _0x1126=function(_0x28ef4e,_0x202aa3){_0x28ef4e=_0x28ef4e-0x0;var _0x1aa097=_0x1261[_0x28ef4e];return _0x1aa097;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/describe',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['show']);router[_0x1126('0xf')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['update']);router[_0x1126('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x1126('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9536=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x1d0cbc,_0x1d3cb0){var _0xce6506=function(_0x2f5a2c){while(--_0x2f5a2c){_0x1d0cbc['push'](_0x1d0cbc['shift']());}};_0xce6506(++_0x1d3cb0);}(_0x9536,0x179));var _0x6953=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0x9536[_0x43d16c];return _0x208cce;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['put'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x10')]);router[_0x6953('0x11')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x12')]);module[_0x6953('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d19396a..0c4068a 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 _0x9b07=['setDataValue','BOOLEAN','sequelize','moment','exports','DATE','INTEGER','STRING','endtime'];(function(_0x36544f,_0x143f97){var _0x3bf8a4=function(_0x19c537){while(--_0x19c537){_0x36544f['push'](_0x36544f['shift']());}};_0x3bf8a4(++_0x143f97);}(_0x9b07,0x9b));var _0x79b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9b07[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x79b0('0x0'));var moment=require(_0x79b0('0x1'));module[_0x79b0('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x79b0('0x3')]},'countbusyretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x79b0('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x79b0('0x5')]},'originatecalleridname':{'type':Sequelize[_0x79b0('0x5')]},'calleridnum':{'type':Sequelize[_0x79b0('0x5')]},'calleridname':{'type':Sequelize[_0x79b0('0x5')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x79b0('0x3')]},'answertime':{'type':Sequelize[_0x79b0('0x3')]},'droptime':{'type':Sequelize[_0x79b0('0x3')]},'endtime':{'type':Sequelize[_0x79b0('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x79b0('0x5')]},'campaign':{'type':Sequelize[_0x79b0('0x5')]},'campaigntype':{'type':Sequelize[_0x79b0('0x5')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x79b0('0x5')]},'disposition':{'type':Sequelize[_0x79b0('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x79b0('0x5')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x54d06c){var _0x287e72=this['getDataValue'](_0x79b0('0x6'));if(_0x287e72&&_0x54d06c){this[_0x79b0('0x7')]('followuptime',moment(_0x54d06c)['diff'](moment(_0x287e72),'seconds'));}}},'amd':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x79b0('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x79b0('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x79b0('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x79b0('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x79b0('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x79b0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd167=['followuptime','diff','seconds','BOOLEAN','moment','exports','DATE','INTEGER','STRING','endtime','setDataValue'];(function(_0x52660e,_0x4bae6b){var _0x2fd1a3=function(_0x2caaaf){while(--_0x2caaaf){_0x52660e['push'](_0x52660e['shift']());}};_0x2fd1a3(++_0x4bae6b);}(_0xd167,0x7d));var _0x7d16=function(_0x378a09,_0x116a85){_0x378a09=_0x378a09-0x0;var _0x217efe=_0xd167[_0x378a09];return _0x217efe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x7d16('0x0'));module[_0x7d16('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7d16('0x2')]},'countbusyretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7d16('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x7d16('0x4')]},'originatecalleridname':{'type':Sequelize[_0x7d16('0x4')]},'calleridnum':{'type':Sequelize[_0x7d16('0x4')]},'calleridname':{'type':Sequelize[_0x7d16('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7d16('0x2')]},'answertime':{'type':Sequelize[_0x7d16('0x2')]},'droptime':{'type':Sequelize[_0x7d16('0x2')]},'endtime':{'type':Sequelize[_0x7d16('0x2')]},'ringtime':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7d16('0x4')]},'campaign':{'type':Sequelize[_0x7d16('0x4')]},'campaigntype':{'type':Sequelize[_0x7d16('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7d16('0x4')]},'secondDisposition':{'type':Sequelize[_0x7d16('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7d16('0x4')]},'dispositionat':{'type':Sequelize[_0x7d16('0x2')],'set':function(_0x3e4996){var _0x375811=this['getDataValue'](_0x7d16('0x5'));if(_0x375811&&_0x3e4996){this[_0x7d16('0x6')](_0x7d16('0x7'),moment(_0x3e4996)[_0x7d16('0x8')](moment(_0x375811),_0x7d16('0x9')));}}},'amd':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x7d16('0x2')]},'callback':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7d16('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x7d16('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7d16('0x2')]},'recallme':{'type':Sequelize[_0x7d16('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7d16('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 49eea05..69cbb90 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 _0xc2c7=['`state`\x20=\x205,\x201,\x20null','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ListId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','checkContactHopper','CmHopper','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','uniqueid','params','body','countContactsQueueCampaignHopperFinal','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal'];(function(_0x31d403,_0xb1ae5f){var _0x1f06ab=function(_0x2a9a5d){while(--_0x2a9a5d){_0x31d403['push'](_0x31d403['shift']());}};_0x1f06ab(++_0xb1ae5f);}(_0xc2c7,0x134));var _0x7c2c=function(_0x21c23b,_0x23cb46){_0x21c23b=_0x21c23b-0x0;var _0x508df0=_0xc2c7[_0x21c23b];return _0x508df0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['CmHopperFinal'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['describe']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['describe']()['then'](respondWithResult(_0x3091bd,null))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x39d5af,_0x2b79d5){if(_0x39d5af['body']['uniqueid']){delete _0x39d5af['body'][_0x7c2c('0x48')];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'uniqueid':_0x39d5af[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x2b79d5,null))['then'](saveUpdates(_0x39d5af[_0x7c2c('0x4a')],null))[_0x7c2c('0x26')](respondWithResult(_0x2b79d5,null))['catch'](handleError(_0x2b79d5,null));};exports[_0x7c2c('0x4b')]=function(_0x56e09d,_0xfba6a7,_0x3806f4){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x56e09d['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x4d')))),_0x7c2c('0x4e')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x7c2c('0x53')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x54')))),'congestionContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x58')))),_0x7c2c('0x59')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x7c2c('0x26')](handleEntityNotFound(_0xfba6a7,null))[_0x7c2c('0x26')](respondWithResult(_0xfba6a7,null))[_0x7c2c('0x45')](handleError(_0xfba6a7,null));};exports[_0x7c2c('0x5a')]=function(_0x44602a,_0x1ad537,_0x2d04da){return db[_0x7c2c('0x2c')]['findAll']({'raw':![],'where':{'CampaignId':_0x44602a['params']['id']},'attributes':[[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal']('`state`\x20=\x200,\x201,\x20null'))),_0x7c2c('0x4e')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x51')))),_0x7c2c('0x52')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')][_0x7c2c('0x50')](_0x7c2c('0x5b')))),'busyContacts'],[db[_0x7c2c('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x7c2c('0x54')))),_0x7c2c('0x5c')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x55')))),_0x7c2c('0x56')],[db[_0x7c2c('0x4c')]['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5d')))),_0x7c2c('0x57')],[db['sequelize']['fn'](_0x7c2c('0x4f'),db[_0x7c2c('0x4c')]['fn']('IF',db['sequelize'][_0x7c2c('0x50')](_0x7c2c('0x58')))),'reCallContacts'],[db['sequelize']['fn'](_0x7c2c('0x4f'),db['sequelize']['fn']('IF',db[_0x7c2c('0x4c')]['literal'](_0x7c2c('0x5e')))),_0x7c2c('0x5f')]]})['then'](handleEntityNotFound(_0x1ad537,null))[_0x7c2c('0x26')](respondWithResult(_0x1ad537,null))['catch'](handleError(_0x1ad537,null));};exports[_0x7c2c('0x60')]=function(_0x2b597d,_0x20eb63,_0x56f737){return db[_0x7c2c('0x61')][_0x7c2c('0x47')]({'where':{'id':_0x2b597d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x20eb63,null))['then'](function(_0x158352){var _0x1e711e;if(_0x158352){_0x1e711e=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')](_0x7c2c('0x64'))[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),'ListId',_0x7c2c('0x69'),_0x7c2c('0x6a'),'updatedAt'],squel[_0x7c2c('0x6b')]()['field']('ANY_VALUE(calleridnum)',_0x7c2c('0x66'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),'scheduledAt')[_0x7c2c('0x6c')](_0x7c2c('0x6e'),_0x7c2c('0x68'))['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')](_0x7c2c('0x71'),'VoiceQueueId')[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),_0x7c2c('0x72'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2b597d[_0x7c2c('0x4a')][_0x7c2c('0x77')][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x66'))[_0x7c2c('0x73')](_0x7c2c('0x64'))['where'](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id']['toString']()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel['select']()[_0x7c2c('0x6c')]('calleridnum')[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')](_0x7c2c('0x75'),_0x2b597d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')]('state\x20=\x204'))[_0x7c2c('0x7b')](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x1e711e);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x20eb63,null))[_0x7c2c('0x45')](handleError(_0x20eb63,null));};exports[_0x7c2c('0x7c')]=function(_0x2f249d,_0x136226,_0x354236){return db[_0x7c2c('0x7d')][_0x7c2c('0x47')]({'where':{'id':_0x2f249d[_0x7c2c('0x49')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x136226,null))[_0x7c2c('0x26')](function(_0xb47bf0){var _0x4d0922;if(_0xb47bf0){_0x4d0922=squel[_0x7c2c('0x62')]()[_0x7c2c('0x63')]('cm_hopper')[_0x7c2c('0x65')]([_0x7c2c('0x66'),_0x7c2c('0x67'),_0x7c2c('0x68'),_0x7c2c('0x70'),'CampaignId',_0x7c2c('0x6a'),_0x7c2c('0x72')],squel[_0x7c2c('0x6b')]()['field'](_0x7c2c('0x7e'),_0x7c2c('0x66'))[_0x7c2c('0x6c')]('NOW()',_0x7c2c('0x67'))['field'](_0x7c2c('0x6e'),'ContactId')['field'](_0x7c2c('0x6f'),_0x7c2c('0x70'))[_0x7c2c('0x6c')]('ANY_VALUE(CampaignId)',_0x7c2c('0x7f'))[_0x7c2c('0x6c')](_0x7c2c('0x6d'),_0x7c2c('0x6a'))['field'](_0x7c2c('0x6d'),'updatedAt')['from']('cm_hopper_final')['where']('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x76'),_0x2f249d[_0x7c2c('0x4a')]['state'][_0x7c2c('0x78')]())[_0x7c2c('0x3d')](_0x7c2c('0x79'))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()['field']('phone')[_0x7c2c('0x73')](_0x7c2c('0x64'))[_0x7c2c('0x3d')](_0x7c2c('0x80'),_0x2f249d['params']['id'][_0x7c2c('0x78')]()))[_0x7c2c('0x3d')](_0x7c2c('0x7a'),squel[_0x7c2c('0x6b')]()[_0x7c2c('0x6c')](_0x7c2c('0x81'))[_0x7c2c('0x73')](_0x7c2c('0x74'))[_0x7c2c('0x3d')]('CampaignId\x20=\x20?',_0x2f249d[_0x7c2c('0x49')]['id'][_0x7c2c('0x78')]())['where'](_0x7c2c('0x82')))['group'](_0x7c2c('0x68')))['toString']();return db[_0x7c2c('0x4c')][_0x7c2c('0x32')](_0x4d0922);}return[];})[_0x7c2c('0x26')](respondWithResult(_0x136226,null))[_0x7c2c('0x45')](handleError(_0x136226,null));};exports[_0x7c2c('0x83')]=function(_0x309051,_0x3f8683,_0x1eeb00){return db[_0x7c2c('0x84')]['findOne']({'where':{'VoiceQueueId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x69')],'CampaignId':_0x309051[_0x7c2c('0x4a')]['CampaignId'],'ContactId':_0x309051[_0x7c2c('0x4a')][_0x7c2c('0x68')]}})['then'](handleEntityNotFound(_0x3f8683,null))[_0x7c2c('0x26')](function(_0x511158){if(_0x511158){return _0x511158;}return null;})[_0x7c2c('0x26')](respondWithResult(_0x3f8683,null))['catch'](handleError(_0x3f8683,null));}; \ No newline at end of file +var _0x5496=['set','Content-Range','apply','reject','save','update','then','error','stack','name','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','rows','catch','show','params','keys','fields','include','options','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','dropContacts','abandonedContacts','reCallContacts','answeringMachine','into','cm_hopper','fromQuery','ListId','VoiceQueueId','createdAt','field','phone','NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','updatedAt','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','select','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(calleridnum)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count'];(function(_0x9713d4,_0x191452){var _0x1bfaa4=function(_0x2cc983){while(--_0x2cc983){_0x9713d4['push'](_0x9713d4['shift']());}};_0x1bfaa4(++_0x191452);}(_0x5496,0x175));var _0x6549=function(_0x11a8f8,_0x25e5c6){_0x11a8f8=_0x11a8f8-0x0;var _0x648e18=_0x5496[_0x11a8f8];return _0x648e18;};'use strict';var emlformat=require(_0x6549('0x0'));var rimraf=require(_0x6549('0x1'));var zipdir=require(_0x6549('0x2'));var jsonpatch=require(_0x6549('0x3'));var rp=require(_0x6549('0x4'));var moment=require('moment');var BPromise=require(_0x6549('0x5'));var Mustache=require('mustache');var util=require(_0x6549('0x6'));var path=require(_0x6549('0x7'));var sox=require(_0x6549('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6549('0x9'));var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];function respondWithStatusCode(_0x5bc018,_0x4dfb06){_0x4dfb06=_0x4dfb06||0xcc;return function(_0x3f844f){if(_0x3f844f){return _0x5bc018[_0x6549('0x19')](_0x4dfb06);}return _0x5bc018['status'](_0x4dfb06)[_0x6549('0x1a')]();};}function respondWithResult(_0x150fc8,_0x195d25){_0x195d25=_0x195d25||0xc8;return function(_0x12b068){if(_0x12b068){return _0x150fc8[_0x6549('0x1b')](_0x195d25)[_0x6549('0x1c')](_0x12b068);}};}function respondWithFilteredResult(_0x55c112,_0x5db86d){return function(_0x384f75){if(_0x384f75){var _0x25da29=typeof _0x5db86d['offset']===_0x6549('0x1d')&&typeof _0x5db86d[_0x6549('0x1e')]===_0x6549('0x1d');var _0x387e60=_0x384f75[_0x6549('0x1f')];var _0x53b12b=_0x25da29?0x0:_0x5db86d['offset'];var _0x26a212=_0x25da29?_0x384f75['count']:_0x5db86d['offset']+_0x5db86d[_0x6549('0x1e')];var _0x1e5079;if(_0x26a212>=_0x387e60){_0x26a212=_0x387e60;_0x1e5079=0xc8;}else{_0x1e5079=0xce;}_0x55c112[_0x6549('0x1b')](_0x1e5079);return _0x55c112[_0x6549('0x20')](_0x6549('0x21'),_0x53b12b+'-'+_0x26a212+'/'+_0x387e60)['json'](_0x384f75);}return null;};}function patchUpdates(_0x228117){return function(_0x4b40c1){try{jsonpatch[_0x6549('0x22')](_0x4b40c1,_0x228117,!![]);}catch(_0x72322b){return BPromise[_0x6549('0x23')](_0x72322b);}return _0x4b40c1[_0x6549('0x24')]();};}function saveUpdates(_0x22bcf8,_0x12d547){return function(_0x427b47){if(_0x427b47){return _0x427b47[_0x6549('0x25')](_0x22bcf8)[_0x6549('0x26')](function(_0x6ae00c){return _0x6ae00c;});}return null;};}function removeEntity(_0x40d3f9,_0x1fbfa4){return function(_0x23c0ba){if(_0x23c0ba){return _0x23c0ba['destroy']()[_0x6549('0x26')](function(){_0x40d3f9[_0x6549('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126967,_0x29f89e){return function(_0x3768cb){if(!_0x3768cb){_0x126967['sendStatus'](0x194);}return _0x3768cb;};}function handleError(_0x31a95,_0xfb51a1){_0xfb51a1=_0xfb51a1||0x1f4;return function(_0x14de1f){logger[_0x6549('0x27')](_0x14de1f[_0x6549('0x28')]);if(_0x14de1f[_0x6549('0x29')]){delete _0x14de1f[_0x6549('0x29')];}_0x31a95[_0x6549('0x1b')](_0xfb51a1)['send'](_0x14de1f);};}exports[_0x6549('0x2a')]=function(_0x136518,_0x17fdfb){var _0x4c605c={},_0x3f1502={},_0x4acaf5={'count':0x0,'rows':[]};var _0x4f0ad1=_['map'](db[_0x6549('0x2b')][_0x6549('0x2c')],function(_0x4f3069){return{'name':_0x4f3069[_0x6549('0x2d')],'type':_0x4f3069[_0x6549('0x2e')][_0x6549('0x2f')]};});_0x3f1502[_0x6549('0x30')]=_[_0x6549('0x31')](_0x4f0ad1,_0x6549('0x29'));_0x3f1502[_0x6549('0x32')]=_['keys'](_0x136518[_0x6549('0x32')]);_0x3f1502[_0x6549('0x33')]=_[_0x6549('0x34')](_0x3f1502[_0x6549('0x30')],_0x3f1502[_0x6549('0x32')]);_0x4c605c[_0x6549('0x35')]=_['intersection'](_0x3f1502[_0x6549('0x30')],qs['fields'](_0x136518[_0x6549('0x32')]['fields']));_0x4c605c[_0x6549('0x35')]=_0x4c605c[_0x6549('0x35')][_0x6549('0x36')]?_0x4c605c['attributes']:_0x3f1502[_0x6549('0x30')];if(!_0x136518[_0x6549('0x32')][_0x6549('0x37')](_0x6549('0x38'))){_0x4c605c['limit']=qs['limit'](_0x136518['query'][_0x6549('0x1e')]);_0x4c605c[_0x6549('0x39')]=qs['offset'](_0x136518[_0x6549('0x32')][_0x6549('0x39')]);}_0x4c605c[_0x6549('0x3a')]=qs[_0x6549('0x3b')](_0x136518[_0x6549('0x32')]['sort']);_0x4c605c['where']=qs[_0x6549('0x33')](_[_0x6549('0x3c')](_0x136518[_0x6549('0x32')],_0x3f1502[_0x6549('0x33')]),_0x4f0ad1);if(_0x136518[_0x6549('0x32')][_0x6549('0x3d')]){_0x4c605c[_0x6549('0x3e')]=_[_0x6549('0x3f')](_0x4c605c[_0x6549('0x3e')],{'$or':_[_0x6549('0x31')](_0x4f0ad1,function(_0x525f82){if(_0x525f82[_0x6549('0x2e')]!==_0x6549('0x40')){var _0x2ea977={};_0x2ea977[_0x525f82[_0x6549('0x29')]]={'$like':'%'+_0x136518[_0x6549('0x32')]['filter']+'%'};return _0x2ea977;}})});}_0x4c605c=_['merge']({},_0x4c605c,_0x136518['options']);var _0x22b919={'where':_0x4c605c[_0x6549('0x3e')]};return db[_0x6549('0x2b')][_0x6549('0x1f')](_0x22b919)['then'](function(_0x56ce9f){_0x4acaf5[_0x6549('0x1f')]=_0x56ce9f;if(_0x136518[_0x6549('0x32')][_0x6549('0x41')]){_0x4c605c['include']=[{'all':!![]}];}return db[_0x6549('0x2b')]['findAll'](_0x4c605c);})[_0x6549('0x26')](function(_0x2ec614){_0x4acaf5[_0x6549('0x42')]=_0x2ec614;return _0x4acaf5;})[_0x6549('0x26')](respondWithFilteredResult(_0x17fdfb,_0x4c605c))[_0x6549('0x43')](handleError(_0x17fdfb,null));};exports[_0x6549('0x44')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':!![],'where':{'id':_0xbbfdc9[_0x6549('0x45')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x30')]=_[_0x6549('0x46')](db[_0x6549('0x2b')][_0x6549('0x2c')]);_0x309f45[_0x6549('0x32')]=_[_0x6549('0x46')](_0xbbfdc9[_0x6549('0x32')]);_0x309f45[_0x6549('0x33')]=_[_0x6549('0x34')](_0x309f45[_0x6549('0x30')],_0x309f45[_0x6549('0x32')]);_0x132625[_0x6549('0x35')]=_[_0x6549('0x34')](_0x309f45['model'],qs[_0x6549('0x47')](_0xbbfdc9[_0x6549('0x32')][_0x6549('0x47')]));_0x132625[_0x6549('0x35')]=_0x132625['attributes'][_0x6549('0x36')]?_0x132625['attributes']:_0x309f45[_0x6549('0x30')];if(_0xbbfdc9[_0x6549('0x32')]['includeAll']){_0x132625[_0x6549('0x48')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x3f')]({},_0x132625,_0xbbfdc9[_0x6549('0x49')]);return db[_0x6549('0x2b')][_0x6549('0x4a')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x43')](handleError(_0x4deaab,null));};exports[_0x6549('0x4b')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x2b')]['describe']()[_0x6549('0x26')](respondWithResult(_0x1712f3,null))[_0x6549('0x43')](handleError(_0x1712f3,null));};exports[_0x6549('0x25')]=function(_0x6121af,_0xa4c650){if(_0x6121af[_0x6549('0x4c')][_0x6549('0x4d')]){delete _0x6121af[_0x6549('0x4c')]['uniqueid'];}return db[_0x6549('0x2b')]['find']({'where':{'uniqueid':_0x6121af[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0xa4c650,null))[_0x6549('0x26')](saveUpdates(_0x6121af['body'],null))[_0x6549('0x26')](respondWithResult(_0xa4c650,null))[_0x6549('0x43')](handleError(_0xa4c650,null));};exports[_0x6549('0x4e')]=function(_0x5300c8,_0x19ac50,_0x17d7ce){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x5300c8[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn']('COUNT',db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x52')))),_0x6549('0x53')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x55')))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x57')))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),'dropContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5c')))),'abandonedContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5d')))),'reCallContacts'],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x5e')))),'answeringMachine']]})[_0x6549('0x26')](handleEntityNotFound(_0x19ac50,null))[_0x6549('0x26')](respondWithResult(_0x19ac50,null))[_0x6549('0x43')](handleError(_0x19ac50,null));};exports[_0x6549('0x5f')]=function(_0x2da535,_0x45eb28,_0x3b01d9){return db[_0x6549('0x2b')][_0x6549('0x4f')]({'raw':![],'where':{'CampaignId':_0x2da535[_0x6549('0x45')]['id']},'attributes':[[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')]['literal'](_0x6549('0x52')))),_0x6549('0x53')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x203,\x201,\x20null'))),_0x6549('0x56')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')]('`state`\x20=\x205,\x201,\x20null'))),_0x6549('0x58')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x59')))),_0x6549('0x5a')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')](_0x6549('0x5b')))),_0x6549('0x60')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db['sequelize']['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5c')))),_0x6549('0x61')],[db['sequelize']['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db['sequelize'][_0x6549('0x51')](_0x6549('0x5d')))),_0x6549('0x62')],[db[_0x6549('0x50')]['fn'](_0x6549('0x54'),db[_0x6549('0x50')]['fn']('IF',db[_0x6549('0x50')][_0x6549('0x51')]('`state`\x20=\x2019,\x201,\x20null'))),_0x6549('0x63')]]})['then'](handleEntityNotFound(_0x45eb28,null))[_0x6549('0x26')](respondWithResult(_0x45eb28,null))[_0x6549('0x43')](handleError(_0x45eb28,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x372b67,_0x2c00a1,_0x2e6b4b){return db['VoiceQueue'][_0x6549('0x4a')]({'where':{'id':_0x372b67[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x2c00a1,null))[_0x6549('0x26')](function(_0x15b906){var _0x34c5f9;if(_0x15b906){_0x34c5f9=squel['insert']()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone','scheduledAt','ContactId',_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69'),'updatedAt'],squel['select']()[_0x6549('0x6a')]('ANY_VALUE(calleridnum)',_0x6549('0x6b'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x6d'))[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))['field'](_0x6549('0x70'),_0x6549('0x67'))[_0x6549('0x6a')]('ANY_VALUE(VoiceQueueId)',_0x6549('0x68'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x69'))[_0x6549('0x6a')](_0x6549('0x6c'),_0x6549('0x71'))['from'](_0x6549('0x72'))['where'](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x372b67[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())['where'](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67['params']['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x73'),_0x372b67[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db[_0x6549('0x50')]['query'](_0x34c5f9);}return[];})[_0x6549('0x26')](respondWithResult(_0x2c00a1,null))[_0x6549('0x43')](handleError(_0x2c00a1,null));};exports[_0x6549('0x7e')]=function(_0x35bad6,_0x371d8a,_0xfde69e){return db[_0x6549('0x7f')][_0x6549('0x4a')]({'where':{'id':_0x35bad6[_0x6549('0x45')]['id']}})[_0x6549('0x26')](handleEntityNotFound(_0x371d8a,null))[_0x6549('0x26')](function(_0x1da2d7){var _0x348d55;if(_0x1da2d7){_0x348d55=squel[_0x6549('0x80')]()[_0x6549('0x64')](_0x6549('0x65'))[_0x6549('0x66')](['phone',_0x6549('0x6d'),_0x6549('0x6f'),_0x6549('0x67'),_0x6549('0x81'),_0x6549('0x69'),_0x6549('0x71')],squel[_0x6549('0x79')]()['field'](_0x6549('0x82'),'phone')['field'](_0x6549('0x6c'),'scheduledAt')[_0x6549('0x6a')](_0x6549('0x6e'),_0x6549('0x6f'))[_0x6549('0x6a')](_0x6549('0x70'),'ListId')[_0x6549('0x6a')]('ANY_VALUE(CampaignId)',_0x6549('0x81'))[_0x6549('0x6a')](_0x6549('0x6c'),'createdAt')[_0x6549('0x6a')](_0x6549('0x6c'),'updatedAt')['from'](_0x6549('0x72'))[_0x6549('0x3e')](_0x6549('0x83'),_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x75'),_0x35bad6[_0x6549('0x4c')][_0x6549('0x76')][_0x6549('0x74')]())[_0x6549('0x3e')](_0x6549('0x77'))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x6b'))[_0x6549('0x7a')](_0x6549('0x65'))['where']('CampaignId\x20=\x20?',_0x35bad6[_0x6549('0x45')]['id'][_0x6549('0x74')]()))[_0x6549('0x3e')](_0x6549('0x78'),squel[_0x6549('0x79')]()[_0x6549('0x6a')](_0x6549('0x7b'))[_0x6549('0x7a')](_0x6549('0x72'))[_0x6549('0x3e')]('CampaignId\x20=\x20?',_0x35bad6['params']['id']['toString']())[_0x6549('0x3e')](_0x6549('0x7c')))[_0x6549('0x7d')](_0x6549('0x6f')))[_0x6549('0x74')]();return db['sequelize'][_0x6549('0x32')](_0x348d55);}return[];})[_0x6549('0x26')](respondWithResult(_0x371d8a,null))[_0x6549('0x43')](handleError(_0x371d8a,null));};exports[_0x6549('0x84')]=function(_0x230874,_0x3be369,_0xaf1a80){return db[_0x6549('0x85')][_0x6549('0x86')]({'where':{'VoiceQueueId':_0x230874[_0x6549('0x4c')][_0x6549('0x68')],'CampaignId':_0x230874['body'][_0x6549('0x81')],'ContactId':_0x230874[_0x6549('0x4c')][_0x6549('0x6f')]}})[_0x6549('0x26')](handleEntityNotFound(_0x3be369,null))['then'](function(_0x158c92){if(_0x158c92){return _0x158c92;}return null;})[_0x6549('0x26')](respondWithResult(_0x3be369,null))[_0x6549('0x43')](handleError(_0x3be369,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 9a33f22..413fe69 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 _0x36a5=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x2e4483,_0x4848ab){var _0x3c3106=function(_0x2355f5){while(--_0x2355f5){_0x2e4483['push'](_0x2e4483['shift']());}};_0x3c3106(++_0x4848ab);}(_0x36a5,0x113));var _0x536a=function(_0x301038,_0x5f5e0d){_0x301038=_0x301038-0x0;var _0x43aad3=_0x36a5[_0x301038];return _0x43aad3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x536a('0x0'))(_0x536a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x536a('0x2'));var fs=require('fs');var path=require(_0x536a('0x3'));var rimraf=require(_0x536a('0x4'));var config=require(_0x536a('0x5'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x26689e,_0x48e7ad){return _0x26689e[_0x536a('0x6')](_0x536a('0x7'),attributes,{'tableName':_0x536a('0x8'),'paranoid':![],'indexes':[{'name':_0x536a('0x9'),'fields':[_0x536a('0x9')]},{'name':_0x536a('0xa'),'fields':[_0x536a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9410=['define','CmHopperFinal','uniqueid','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x1dc90c,_0x28d6ff){var _0x548759=function(_0x14734e){while(--_0x14734e){_0x1dc90c['push'](_0x1dc90c['shift']());}};_0x548759(++_0x28d6ff);}(_0x9410,0x107));var _0x0941=function(_0x16e6b3,_0x1ed623){_0x16e6b3=_0x16e6b3-0x0;var _0x46ad29=_0x9410[_0x16e6b3];return _0x46ad29;};'use strict';var _=require('lodash');var util=require(_0x0941('0x0'));var logger=require(_0x0941('0x1'))(_0x0941('0x2'));var moment=require(_0x0941('0x3'));var BPromise=require('bluebird');var rp=require(_0x0941('0x4'));var fs=require('fs');var path=require(_0x0941('0x5'));var rimraf=require(_0x0941('0x6'));var config=require(_0x0941('0x7'));var attributes=require(_0x0941('0x8'));module[_0x0941('0x9')]=function(_0x301024,_0x550498){return _0x301024[_0x0941('0xa')](_0x0941('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':['calleridnum']},{'name':'uniqueid','fields':[_0x0941('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 3f7aec3..b578acf 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(_0x9b38e6,_0x208ca4){var _0x15fe1d=function(_0x56e294){while(--_0x56e294){_0x9b38e6['push'](_0x9b38e6['shift']());}};_0x15fe1d(++_0x208ca4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ee20d,_0x354e70){_0x2ee20d=_0x2ee20d-0x0;var _0xade530=_0xb10b[_0x2ee20d];return _0xade530;};'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(_0x151941,_0x1f0be4){var _0x552a8e=function(_0x3d8569){while(--_0x3d8569){_0x151941['push'](_0x151941['shift']());}};_0x552a8e(++_0x1f0be4);}(_0xb10b,0x12a));var _0xbb10=function(_0x109e39,_0x27f91c){_0x109e39=_0x109e39-0x0;var _0x3b142f=_0xb10b[_0x109e39];return _0x3b142f;};'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 46ea8b5..0202d08 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 _0x92f3=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post'];(function(_0xd9ff12,_0x4c6946){var _0x3e7265=function(_0xdc83e9){while(--_0xdc83e9){_0xd9ff12['push'](_0xd9ff12['shift']());}};_0x3e7265(++_0x4c6946);}(_0x92f3,0xf0));var _0x392f=function(_0x2ecd74,_0x43247c){_0x2ecd74=_0x2ecd74-0x0;var _0x2d6a1d=_0x92f3[_0x2ecd74];return _0x2d6a1d;};'use strict';var multer=require(_0x392f('0x0'));var util=require(_0x392f('0x1'));var path=require(_0x392f('0x2'));var timeout=require(_0x392f('0x3'));var express=require(_0x392f('0x4'));var router=express[_0x392f('0x5')]();var fs_extra=require(_0x392f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x392f('0x7'));var config=require(_0x392f('0x8'));var controller=require(_0x392f('0x9'));router[_0x392f('0xa')]('/',auth[_0x392f('0xb')](),controller[_0x392f('0xc')]);router[_0x392f('0xa')](_0x392f('0xd'),auth[_0x392f('0xb')](),controller[_0x392f('0xe')]);router['get'](_0x392f('0xf'),auth['isAuthenticated'](),controller[_0x392f('0x10')]);router['get']('/voice/queue/countAttributes/:id',auth[_0x392f('0xb')](),controller[_0x392f('0x11')]);router[_0x392f('0xa')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0x392f('0x12')]);router[_0x392f('0x13')]('/voice/queue/moveContacts/:id',auth[_0x392f('0xb')](),controller[_0x392f('0x14')]);router['post'](_0x392f('0x15'),auth[_0x392f('0xb')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x392f('0x13')](_0x392f('0x16'),auth[_0x392f('0xb')](),controller[_0x392f('0x17')]);router['put'](_0x392f('0xf'),auth[_0x392f('0xb')](),controller[_0x392f('0x18')]);module[_0x392f('0x19')]=router; \ No newline at end of file +var _0xc137=['isAuthenticated','index','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperFinal.controller','get'];(function(_0x5932d6,_0x4495f7){var _0x100332=function(_0x41a07b){while(--_0x41a07b){_0x5932d6['push'](_0x5932d6['shift']());}};_0x100332(++_0x4495f7);}(_0xc137,0xff));var _0x7c13=function(_0x19fc46,_0x5993f8){_0x19fc46=_0x19fc46-0x0;var _0x25aa8c=_0xc137[_0x19fc46];return _0x25aa8c;};'use strict';var multer=require(_0x7c13('0x0'));var util=require(_0x7c13('0x1'));var path=require(_0x7c13('0x2'));var timeout=require(_0x7c13('0x3'));var express=require(_0x7c13('0x4'));var router=express[_0x7c13('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7c13('0x6'));var controller=require(_0x7c13('0x7'));router[_0x7c13('0x8')]('/',auth[_0x7c13('0x9')](),controller[_0x7c13('0xa')]);router[_0x7c13('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7c13('0x8')](_0x7c13('0xb'),auth['isAuthenticated'](),controller[_0x7c13('0xc')]);router[_0x7c13('0x8')]('/voice/queue/countAttributes/:id',auth[_0x7c13('0x9')](),controller[_0x7c13('0xd')]);router[_0x7c13('0x8')](_0x7c13('0xe'),auth[_0x7c13('0x9')](),controller[_0x7c13('0xf')]);router[_0x7c13('0x10')](_0x7c13('0x11'),auth[_0x7c13('0x9')](),controller[_0x7c13('0x12')]);router[_0x7c13('0x10')](_0x7c13('0x13'),auth[_0x7c13('0x9')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x7c13('0x10')]('/checkContactHopper',auth[_0x7c13('0x9')](),controller[_0x7c13('0x14')]);router[_0x7c13('0x15')](_0x7c13('0xb'),auth[_0x7c13('0x9')](),controller[_0x7c13('0x16')]);module[_0x7c13('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 96bea36..a3e3916 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 _0x9613=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x581f55,_0x430686){var _0x1e83c4=function(_0x5538d3){while(--_0x5538d3){_0x581f55['push'](_0x581f55['shift']());}};_0x1e83c4(++_0x430686);}(_0x9613,0x1c9));var _0x3961=function(_0x2407f0,_0xd6516e){_0x2407f0=_0x2407f0-0x0;var _0x76ac38=_0x9613[_0x2407f0];return _0x76ac38;};'use strict';var Sequelize=require(_0x3961('0x0'));module[_0x3961('0x1')]={'state':{'type':Sequelize[_0x3961('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3961('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3961('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x3961('0x3')]},'starttime':{'type':Sequelize[_0x3961('0x4')]},'responsetime':{'type':Sequelize[_0x3961('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x3961('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x3961('0x3')]},'campaigntype':{'type':Sequelize[_0x3961('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3961('0x3')]},'amd':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3961('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3961('0x4')]},'recallme':{'type':Sequelize[_0x3961('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3961('0x4')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3961('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x3961('0x3')]}}; \ No newline at end of file +var _0x0007=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0007,0x1ee));var _0x7000=function(_0x4b4f05,_0x39a268){_0x4b4f05=_0x4b4f05-0x0;var _0x2dbf4f=_0x0007[_0x4b4f05];return _0x2dbf4f;};'use strict';var Sequelize=require(_0x7000('0x0'));module[_0x7000('0x1')]={'state':{'type':Sequelize[_0x7000('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x7000('0x3')]},'countbusyretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x7000('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x7000('0x4')]},'originatecalleridname':{'type':Sequelize[_0x7000('0x4')]},'calleridnum':{'type':Sequelize[_0x7000('0x4')]},'calleridname':{'type':Sequelize[_0x7000('0x4')]},'starttime':{'type':Sequelize[_0x7000('0x3')]},'responsetime':{'type':Sequelize[_0x7000('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x7000('0x3')]},'endtime':{'type':Sequelize[_0x7000('0x3')]},'ringtime':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x7000('0x4')]},'campaigntype':{'type':Sequelize[_0x7000('0x4')]},'membername':{'type':Sequelize[_0x7000('0x4')]},'reason':{'type':Sequelize[_0x7000('0x4')]},'amd':{'type':Sequelize[_0x7000('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7000('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7000('0x3')]},'recallme':{'type':Sequelize[_0x7000('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7000('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7000('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 8814f39..5d83d8d 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 _0xc2b0=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','describe','update','uniqueid','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','end','sendStatus','error','name','map','CmHopperHistory','rawAttributes','type','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x5cd5a0,_0x139767){var _0x2d11e2=function(_0x58c87a){while(--_0x58c87a){_0x5cd5a0['push'](_0x5cd5a0['shift']());}};_0x2d11e2(++_0x139767);}(_0xc2b0,0xa3));var _0x0c2b=function(_0x4e7c1c,_0x56eafd){_0x4e7c1c=_0x4e7c1c-0x0;var _0x47adb2=_0xc2b0[_0x4e7c1c];return _0x47adb2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0c2b('0x0'));var zipdir=require(_0x0c2b('0x1'));var jsonpatch=require(_0x0c2b('0x2'));var rp=require(_0x0c2b('0x3'));var moment=require('moment');var BPromise=require(_0x0c2b('0x4'));var Mustache=require(_0x0c2b('0x5'));var util=require(_0x0c2b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x0c2b('0x7'));var ejs=require(_0x0c2b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0c2b('0x9'));var squel=require(_0x0c2b('0xa'));var crypto=require('crypto');var jsforce=require(_0x0c2b('0xb'));var deskjs=require(_0x0c2b('0xc'));var toCsv=require(_0x0c2b('0x7'));var querystring=require(_0x0c2b('0xd'));var Papa=require('papaparse');var Redis=require(_0x0c2b('0xe'));var authService=require(_0x0c2b('0xf'));var qs=require(_0x0c2b('0x10'));var as=require(_0x0c2b('0x11'));var hardwareService=require(_0x0c2b('0x12'));var logger=require(_0x0c2b('0x13'))(_0x0c2b('0x14'));var utils=require('../../config/utils');var config=require(_0x0c2b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c2b('0x16'))['db'];function respondWithStatusCode(_0x27ca4d,_0x4eda89){_0x4eda89=_0x4eda89||0xcc;return function(_0x3dd23d){if(_0x3dd23d){return _0x27ca4d['sendStatus'](_0x4eda89);}return _0x27ca4d[_0x0c2b('0x17')](_0x4eda89)['end']();};}function respondWithResult(_0x4c74c2,_0xd35e70){_0xd35e70=_0xd35e70||0xc8;return function(_0x30e941){if(_0x30e941){return _0x4c74c2[_0x0c2b('0x17')](_0xd35e70)[_0x0c2b('0x18')](_0x30e941);}};}function respondWithFilteredResult(_0x103862,_0x3f7db4){return function(_0x4d6006){if(_0x4d6006){var _0x2afc23=typeof _0x3f7db4['offset']===_0x0c2b('0x19')&&typeof _0x3f7db4[_0x0c2b('0x1a')]===_0x0c2b('0x19');var _0x421ce1=_0x4d6006[_0x0c2b('0x1b')];var _0x2067e4=_0x2afc23?0x0:_0x3f7db4[_0x0c2b('0x1c')];var _0x5f0f17=_0x2afc23?_0x4d6006[_0x0c2b('0x1b')]:_0x3f7db4[_0x0c2b('0x1c')]+_0x3f7db4[_0x0c2b('0x1a')];var _0xfd2011;if(_0x5f0f17>=_0x421ce1){_0x5f0f17=_0x421ce1;_0xfd2011=0xc8;}else{_0xfd2011=0xce;}_0x103862[_0x0c2b('0x17')](_0xfd2011);return _0x103862[_0x0c2b('0x1d')](_0x0c2b('0x1e'),_0x2067e4+'-'+_0x5f0f17+'/'+_0x421ce1)[_0x0c2b('0x18')](_0x4d6006);}return null;};}function patchUpdates(_0x3923ed){return function(_0x41d4b6){try{jsonpatch['apply'](_0x41d4b6,_0x3923ed,!![]);}catch(_0x18348a){return BPromise[_0x0c2b('0x1f')](_0x18348a);}return _0x41d4b6[_0x0c2b('0x20')]();};}function saveUpdates(_0x6c1235,_0x5895c5){return function(_0x432d7e){if(_0x432d7e){return _0x432d7e['update'](_0x6c1235)[_0x0c2b('0x21')](function(_0x3caa58){return _0x3caa58;});}return null;};}function removeEntity(_0x2b51fc,_0x47d759){return function(_0x2bdad1){if(_0x2bdad1){return _0x2bdad1['destroy']()[_0x0c2b('0x21')](function(){_0x2b51fc[_0x0c2b('0x17')](0xcc)[_0x0c2b('0x22')]();});}};}function handleEntityNotFound(_0x4a853a,_0x31d34d){return function(_0x2d1709){if(!_0x2d1709){_0x4a853a[_0x0c2b('0x23')](0x194);}return _0x2d1709;};}function handleError(_0x3562d1,_0x3d2d0a){_0x3d2d0a=_0x3d2d0a||0x1f4;return function(_0x26c8b1){logger[_0x0c2b('0x24')](_0x26c8b1['stack']);if(_0x26c8b1[_0x0c2b('0x25')]){delete _0x26c8b1['name'];}_0x3562d1[_0x0c2b('0x17')](_0x3d2d0a)['send'](_0x26c8b1);};}exports['index']=function(_0x5d0367,_0x8802d9){var _0xc5c9af={},_0x30a0b7={},_0x222e2b={'count':0x0,'rows':[]};var _0x2e0417=_[_0x0c2b('0x26')](db[_0x0c2b('0x27')][_0x0c2b('0x28')],function(_0x181a5f){return{'name':_0x181a5f['fieldName'],'type':_0x181a5f[_0x0c2b('0x29')]['key']};});_0x30a0b7[_0x0c2b('0x2a')]=_[_0x0c2b('0x26')](_0x2e0417,_0x0c2b('0x25'));_0x30a0b7['query']=_[_0x0c2b('0x2b')](_0x5d0367[_0x0c2b('0x2c')]);_0x30a0b7['filters']=_[_0x0c2b('0x2d')](_0x30a0b7[_0x0c2b('0x2a')],_0x30a0b7[_0x0c2b('0x2c')]);_0xc5c9af[_0x0c2b('0x2e')]=_[_0x0c2b('0x2d')](_0x30a0b7['model'],qs['fields'](_0x5d0367[_0x0c2b('0x2c')]['fields']));_0xc5c9af['attributes']=_0xc5c9af[_0x0c2b('0x2e')][_0x0c2b('0x2f')]?_0xc5c9af[_0x0c2b('0x2e')]:_0x30a0b7['model'];if(!_0x5d0367['query'][_0x0c2b('0x30')](_0x0c2b('0x31'))){_0xc5c9af[_0x0c2b('0x1a')]=qs[_0x0c2b('0x1a')](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x1a')]);_0xc5c9af['offset']=qs['offset'](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x1c')]);}_0xc5c9af[_0x0c2b('0x32')]=qs['sort'](_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x33')]);_0xc5c9af[_0x0c2b('0x34')]=qs[_0x0c2b('0x35')](_[_0x0c2b('0x36')](_0x5d0367[_0x0c2b('0x2c')],_0x30a0b7[_0x0c2b('0x35')]),_0x2e0417);if(_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x37')]){_0xc5c9af[_0x0c2b('0x34')]=_[_0x0c2b('0x38')](_0xc5c9af['where'],{'$or':_[_0x0c2b('0x26')](_0x2e0417,function(_0x74512a){if(_0x74512a[_0x0c2b('0x29')]!==_0x0c2b('0x39')){var _0x28cbd4={};_0x28cbd4[_0x74512a[_0x0c2b('0x25')]]={'$like':'%'+_0x5d0367['query'][_0x0c2b('0x37')]+'%'};return _0x28cbd4;}})});}_0xc5c9af=_['merge']({},_0xc5c9af,_0x5d0367[_0x0c2b('0x3a')]);var _0x11b55a={'where':_0xc5c9af['where']};return db[_0x0c2b('0x27')][_0x0c2b('0x1b')](_0x11b55a)[_0x0c2b('0x21')](function(_0x21a3d4){_0x222e2b[_0x0c2b('0x1b')]=_0x21a3d4;if(_0x5d0367[_0x0c2b('0x2c')][_0x0c2b('0x3b')]){_0xc5c9af[_0x0c2b('0x3c')]=[{'all':!![]}];}return db[_0x0c2b('0x27')][_0x0c2b('0x3d')](_0xc5c9af);})[_0x0c2b('0x21')](function(_0x295db0){_0x222e2b[_0x0c2b('0x3e')]=_0x295db0;return _0x222e2b;})['then'](respondWithFilteredResult(_0x8802d9,_0xc5c9af))[_0x0c2b('0x3f')](handleError(_0x8802d9,null));};exports[_0x0c2b('0x40')]=function(_0x2261d7,_0x217a0a){var _0x407525={'raw':!![],'where':{'id':_0x2261d7[_0x0c2b('0x41')]['id']}},_0x324de5={};_0x324de5['model']=_['keys'](db[_0x0c2b('0x27')]['rawAttributes']);_0x324de5[_0x0c2b('0x2c')]=_[_0x0c2b('0x2b')](_0x2261d7[_0x0c2b('0x2c')]);_0x324de5[_0x0c2b('0x35')]=_[_0x0c2b('0x2d')](_0x324de5[_0x0c2b('0x2a')],_0x324de5['query']);_0x407525[_0x0c2b('0x2e')]=_[_0x0c2b('0x2d')](_0x324de5[_0x0c2b('0x2a')],qs[_0x0c2b('0x42')](_0x2261d7[_0x0c2b('0x2c')][_0x0c2b('0x42')]));_0x407525[_0x0c2b('0x2e')]=_0x407525[_0x0c2b('0x2e')]['length']?_0x407525[_0x0c2b('0x2e')]:_0x324de5['model'];if(_0x2261d7[_0x0c2b('0x2c')][_0x0c2b('0x3b')]){_0x407525[_0x0c2b('0x3c')]=[{'all':!![]}];}_0x407525=_[_0x0c2b('0x38')]({},_0x407525,_0x2261d7[_0x0c2b('0x3a')]);return db[_0x0c2b('0x27')][_0x0c2b('0x43')](_0x407525)[_0x0c2b('0x21')](handleEntityNotFound(_0x217a0a,null))[_0x0c2b('0x21')](respondWithResult(_0x217a0a,null))[_0x0c2b('0x3f')](handleError(_0x217a0a,null));};exports[_0x0c2b('0x44')]=function(_0x534336,_0x1f0c31){return db[_0x0c2b('0x27')]['create'](_0x534336[_0x0c2b('0x45')],{})['then'](respondWithResult(_0x1f0c31,0xc9))[_0x0c2b('0x3f')](handleError(_0x1f0c31,null));};exports[_0x0c2b('0x46')]=function(_0x174fdb,_0xb97f30){return db['CmHopperHistory'][_0x0c2b('0x46')]()[_0x0c2b('0x21')](respondWithResult(_0xb97f30,null))['catch'](handleError(_0xb97f30,null));};exports[_0x0c2b('0x47')]=function(_0x2e602b,_0x346d20){if(_0x2e602b['body']['uniqueid']){delete _0x2e602b[_0x0c2b('0x45')][_0x0c2b('0x48')];}return db[_0x0c2b('0x27')][_0x0c2b('0x43')]({'where':{'uniqueid':_0x2e602b['params']['id']}})[_0x0c2b('0x21')](handleEntityNotFound(_0x346d20,null))['then'](saveUpdates(_0x2e602b[_0x0c2b('0x45')],null))[_0x0c2b('0x21')](respondWithResult(_0x346d20,null))[_0x0c2b('0x3f')](handleError(_0x346d20,null));}; \ No newline at end of file +var _0xbc7d=['count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','show','params','length','includeAll','options','catch','create','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0xbc7d,0x11a));var _0xdbc7=function(_0x212fcc,_0x1a8867){_0x212fcc=_0x212fcc-0x0;var _0x4d8190=_0xbc7d[_0x212fcc];return _0x4d8190;};'use strict';var emlformat=require(_0xdbc7('0x0'));var rimraf=require(_0xdbc7('0x1'));var zipdir=require(_0xdbc7('0x2'));var jsonpatch=require(_0xdbc7('0x3'));var rp=require(_0xdbc7('0x4'));var moment=require(_0xdbc7('0x5'));var BPromise=require(_0xdbc7('0x6'));var Mustache=require(_0xdbc7('0x7'));var util=require('util');var path=require(_0xdbc7('0x8'));var sox=require(_0xdbc7('0x9'));var csv=require(_0xdbc7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdbc7('0xb'));var _=require(_0xdbc7('0xc'));var squel=require(_0xdbc7('0xd'));var crypto=require(_0xdbc7('0xe'));var jsforce=require(_0xdbc7('0xf'));var deskjs=require(_0xdbc7('0x10'));var toCsv=require(_0xdbc7('0xa'));var querystring=require(_0xdbc7('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdbc7('0x12'));var qs=require(_0xdbc7('0x13'));var as=require(_0xdbc7('0x14'));var hardwareService=require(_0xdbc7('0x15'));var logger=require(_0xdbc7('0x16'))('api');var utils=require(_0xdbc7('0x17'));var config=require(_0xdbc7('0x18'));var licenseUtil=require(_0xdbc7('0x19'));var db=require(_0xdbc7('0x1a'))['db'];function respondWithStatusCode(_0x2d60db,_0x47ceca){_0x47ceca=_0x47ceca||0xcc;return function(_0x3ce0c2){if(_0x3ce0c2){return _0x2d60db[_0xdbc7('0x1b')](_0x47ceca);}return _0x2d60db['status'](_0x47ceca)[_0xdbc7('0x1c')]();};}function respondWithResult(_0xeebf6d,_0x8c8fed){_0x8c8fed=_0x8c8fed||0xc8;return function(_0x36917b){if(_0x36917b){return _0xeebf6d[_0xdbc7('0x1d')](_0x8c8fed)[_0xdbc7('0x1e')](_0x36917b);}};}function respondWithFilteredResult(_0x59b0e7,_0x5e16eb){return function(_0x1669cc){if(_0x1669cc){var _0x4a0ba0=typeof _0x5e16eb[_0xdbc7('0x1f')]===_0xdbc7('0x20')&&typeof _0x5e16eb[_0xdbc7('0x21')]===_0xdbc7('0x20');var _0x27dc81=_0x1669cc[_0xdbc7('0x22')];var _0x5df797=_0x4a0ba0?0x0:_0x5e16eb[_0xdbc7('0x1f')];var _0x4606dc=_0x4a0ba0?_0x1669cc[_0xdbc7('0x22')]:_0x5e16eb[_0xdbc7('0x1f')]+_0x5e16eb[_0xdbc7('0x21')];var _0x370cbc;if(_0x4606dc>=_0x27dc81){_0x4606dc=_0x27dc81;_0x370cbc=0xc8;}else{_0x370cbc=0xce;}_0x59b0e7[_0xdbc7('0x1d')](_0x370cbc);return _0x59b0e7[_0xdbc7('0x23')](_0xdbc7('0x24'),_0x5df797+'-'+_0x4606dc+'/'+_0x27dc81)['json'](_0x1669cc);}return null;};}function patchUpdates(_0x2078fc){return function(_0x4590b0){try{jsonpatch[_0xdbc7('0x25')](_0x4590b0,_0x2078fc,!![]);}catch(_0x587e8f){return BPromise[_0xdbc7('0x26')](_0x587e8f);}return _0x4590b0['save']();};}function saveUpdates(_0x5e2fb2,_0x13448f){return function(_0x150164){if(_0x150164){return _0x150164[_0xdbc7('0x27')](_0x5e2fb2)[_0xdbc7('0x28')](function(_0x246ef4){return _0x246ef4;});}return null;};}function removeEntity(_0x57454c,_0x263bd7){return function(_0x32b878){if(_0x32b878){return _0x32b878[_0xdbc7('0x29')]()[_0xdbc7('0x28')](function(){_0x57454c['status'](0xcc)[_0xdbc7('0x1c')]();});}};}function handleEntityNotFound(_0x3840dd,_0x5a234d){return function(_0x39706f){if(!_0x39706f){_0x3840dd[_0xdbc7('0x1b')](0x194);}return _0x39706f;};}function handleError(_0x5b67f2,_0x25b8dc){_0x25b8dc=_0x25b8dc||0x1f4;return function(_0x4593ff){logger[_0xdbc7('0x2a')](_0x4593ff[_0xdbc7('0x2b')]);if(_0x4593ff[_0xdbc7('0x2c')]){delete _0x4593ff['name'];}_0x5b67f2[_0xdbc7('0x1d')](_0x25b8dc)[_0xdbc7('0x2d')](_0x4593ff);};}exports[_0xdbc7('0x2e')]=function(_0x7ff760,_0x4ac9b0){var _0x1528ec={},_0x3ba661={},_0x44334e={'count':0x0,'rows':[]};var _0x1cea99=_[_0xdbc7('0x2f')](db[_0xdbc7('0x30')][_0xdbc7('0x31')],function(_0x15a395){return{'name':_0x15a395[_0xdbc7('0x32')],'type':_0x15a395[_0xdbc7('0x33')][_0xdbc7('0x34')]};});_0x3ba661[_0xdbc7('0x35')]=_[_0xdbc7('0x2f')](_0x1cea99,_0xdbc7('0x2c'));_0x3ba661[_0xdbc7('0x36')]=_[_0xdbc7('0x37')](_0x7ff760['query']);_0x3ba661[_0xdbc7('0x38')]=_[_0xdbc7('0x39')](_0x3ba661[_0xdbc7('0x35')],_0x3ba661[_0xdbc7('0x36')]);_0x1528ec['attributes']=_['intersection'](_0x3ba661['model'],qs['fields'](_0x7ff760[_0xdbc7('0x36')][_0xdbc7('0x3a')]));_0x1528ec['attributes']=_0x1528ec[_0xdbc7('0x3b')]['length']?_0x1528ec[_0xdbc7('0x3b')]:_0x3ba661[_0xdbc7('0x35')];if(!_0x7ff760[_0xdbc7('0x36')][_0xdbc7('0x3c')](_0xdbc7('0x3d'))){_0x1528ec[_0xdbc7('0x21')]=qs[_0xdbc7('0x21')](_0x7ff760[_0xdbc7('0x36')][_0xdbc7('0x21')]);_0x1528ec[_0xdbc7('0x1f')]=qs[_0xdbc7('0x1f')](_0x7ff760['query']['offset']);}_0x1528ec[_0xdbc7('0x3e')]=qs[_0xdbc7('0x3f')](_0x7ff760[_0xdbc7('0x36')][_0xdbc7('0x3f')]);_0x1528ec[_0xdbc7('0x40')]=qs[_0xdbc7('0x38')](_[_0xdbc7('0x41')](_0x7ff760[_0xdbc7('0x36')],_0x3ba661[_0xdbc7('0x38')]),_0x1cea99);if(_0x7ff760[_0xdbc7('0x36')]['filter']){_0x1528ec[_0xdbc7('0x40')]=_[_0xdbc7('0x42')](_0x1528ec[_0xdbc7('0x40')],{'$or':_['map'](_0x1cea99,function(_0x234c39){if(_0x234c39['type']!==_0xdbc7('0x43')){var _0x3740c1={};_0x3740c1[_0x234c39[_0xdbc7('0x2c')]]={'$like':'%'+_0x7ff760['query'][_0xdbc7('0x44')]+'%'};return _0x3740c1;}})});}_0x1528ec=_[_0xdbc7('0x42')]({},_0x1528ec,_0x7ff760['options']);var _0x31ef47={'where':_0x1528ec[_0xdbc7('0x40')]};return db[_0xdbc7('0x30')][_0xdbc7('0x22')](_0x31ef47)['then'](function(_0x7d342a){_0x44334e[_0xdbc7('0x22')]=_0x7d342a;if(_0x7ff760[_0xdbc7('0x36')]['includeAll']){_0x1528ec[_0xdbc7('0x45')]=[{'all':!![]}];}return db[_0xdbc7('0x30')]['findAll'](_0x1528ec);})['then'](function(_0x555a19){_0x44334e['rows']=_0x555a19;return _0x44334e;})[_0xdbc7('0x28')](respondWithFilteredResult(_0x4ac9b0,_0x1528ec))['catch'](handleError(_0x4ac9b0,null));};exports[_0xdbc7('0x46')]=function(_0x546948,_0x2c4c99){var _0x208bb8={'raw':!![],'where':{'id':_0x546948[_0xdbc7('0x47')]['id']}},_0xe19280={};_0xe19280['model']=_[_0xdbc7('0x37')](db[_0xdbc7('0x30')]['rawAttributes']);_0xe19280[_0xdbc7('0x36')]=_[_0xdbc7('0x37')](_0x546948[_0xdbc7('0x36')]);_0xe19280[_0xdbc7('0x38')]=_[_0xdbc7('0x39')](_0xe19280['model'],_0xe19280[_0xdbc7('0x36')]);_0x208bb8[_0xdbc7('0x3b')]=_[_0xdbc7('0x39')](_0xe19280['model'],qs[_0xdbc7('0x3a')](_0x546948[_0xdbc7('0x36')][_0xdbc7('0x3a')]));_0x208bb8[_0xdbc7('0x3b')]=_0x208bb8[_0xdbc7('0x3b')][_0xdbc7('0x48')]?_0x208bb8[_0xdbc7('0x3b')]:_0xe19280[_0xdbc7('0x35')];if(_0x546948[_0xdbc7('0x36')][_0xdbc7('0x49')]){_0x208bb8[_0xdbc7('0x45')]=[{'all':!![]}];}_0x208bb8=_[_0xdbc7('0x42')]({},_0x208bb8,_0x546948[_0xdbc7('0x4a')]);return db[_0xdbc7('0x30')]['find'](_0x208bb8)[_0xdbc7('0x28')](handleEntityNotFound(_0x2c4c99,null))[_0xdbc7('0x28')](respondWithResult(_0x2c4c99,null))[_0xdbc7('0x4b')](handleError(_0x2c4c99,null));};exports[_0xdbc7('0x4c')]=function(_0x1ac8d3,_0x65baef){return db['CmHopperHistory'][_0xdbc7('0x4c')](_0x1ac8d3['body'],{})[_0xdbc7('0x28')](respondWithResult(_0x65baef,0xc9))[_0xdbc7('0x4b')](handleError(_0x65baef,null));};exports[_0xdbc7('0x4d')]=function(_0x4389ba,_0x2b41d5){return db[_0xdbc7('0x30')][_0xdbc7('0x4d')]()[_0xdbc7('0x28')](respondWithResult(_0x2b41d5,null))['catch'](handleError(_0x2b41d5,null));};exports[_0xdbc7('0x27')]=function(_0x5879bb,_0x2dd533){if(_0x5879bb['body'][_0xdbc7('0x4e')]){delete _0x5879bb['body']['uniqueid'];}return db['CmHopperHistory']['find']({'where':{'uniqueid':_0x5879bb[_0xdbc7('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dd533,null))[_0xdbc7('0x28')](saveUpdates(_0x5879bb['body'],null))[_0xdbc7('0x28')](respondWithResult(_0x2dd533,null))[_0xdbc7('0x4b')](handleError(_0x2dd533,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 5a628c8..11d211e 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 _0x8710=['lodash','util','api','moment','bluebird','path','rimraf','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8710,0x68));var _0x0871=function(_0x4415dc,_0x2a61bb){_0x4415dc=_0x4415dc-0x0;var _0x74e72c=_0x8710[_0x4415dc];return _0x74e72c;};'use strict';var _=require(_0x0871('0x0'));var util=require(_0x0871('0x1'));var logger=require('../../config/logger')(_0x0871('0x2'));var moment=require(_0x0871('0x3'));var BPromise=require(_0x0871('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0871('0x5'));var rimraf=require(_0x0871('0x6'));var config=require('../../config/environment');var attributes=require(_0x0871('0x7'));module['exports']=function(_0x32d76a,_0x42539c){return _0x32d76a[_0x0871('0x8')](_0x0871('0x9'),attributes,{'tableName':_0x0871('0xa'),'paranoid':![],'indexes':[{'name':_0x0871('0xb'),'fields':['endtime']},{'name':_0x0871('0xc'),'fields':[_0x0871('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7db=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','request-promise'];(function(_0xbbfe59,_0x46067f){var _0x28a2a4=function(_0xfe230){while(--_0xfe230){_0xbbfe59['push'](_0xbbfe59['shift']());}};_0x28a2a4(++_0x46067f);}(_0xa7db,0xbf));var _0xba7d=function(_0x180259,_0x424cab){_0x180259=_0x180259-0x0;var _0x36a03a=_0xa7db[_0x180259];return _0x36a03a;};'use strict';var _=require(_0xba7d('0x0'));var util=require(_0xba7d('0x1'));var logger=require(_0xba7d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xba7d('0x3'));var fs=require('fs');var path=require(_0xba7d('0x4'));var rimraf=require(_0xba7d('0x5'));var config=require(_0xba7d('0x6'));var attributes=require(_0xba7d('0x7'));module['exports']=function(_0x2f6d8d,_0x257384){return _0x2f6d8d[_0xba7d('0x8')](_0xba7d('0x9'),attributes,{'tableName':_0xba7d('0xa'),'paranoid':![],'indexes':[{'name':_0xba7d('0xb'),'fields':['endtime']},{'name':_0xba7d('0xc'),'fields':[_0xba7d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index e70be80..30f82cb 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 _0xf150=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','then','stringify','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','findAll','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3b23a7,_0x511488){var _0xab9705=function(_0x415fe6){while(--_0x415fe6){_0x3b23a7['push'](_0x3b23a7['shift']());}};_0xab9705(++_0x511488);}(_0xf150,0x106));var _0x0f15=function(_0x2f59da,_0x482473){_0x2f59da=_0x2f59da-0x0;var _0x243099=_0xf150[_0x2f59da];return _0x243099;};'use strict';var _=require(_0x0f15('0x0'));var util=require(_0x0f15('0x1'));var moment=require(_0x0f15('0x2'));var BPromise=require('bluebird');var rs=require(_0x0f15('0x3'));var fs=require('fs');var Redis=require(_0x0f15('0x4'));var db=require(_0x0f15('0x5'))['db'];var utils=require(_0x0f15('0x6'));var logger=require(_0x0f15('0x7'))(_0x0f15('0x8'));var config=require(_0x0f15('0x9'));var jayson=require(_0x0f15('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8a90,_0xb3af27,_0x2c603d){return new BPromise(function(_0x3928e2,_0x57bcde){return client[_0x0f15('0xb')](_0x1d8a90,_0x2c603d)['then'](function(_0x43a831){logger[_0x0f15('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb3af27,'request\x20sent');logger[_0x0f15('0xd')](_0x0f15('0xe'),_0xb3af27,_0x0f15('0xf'),JSON['stringify'](_0x43a831));if(_0x43a831[_0x0f15('0x10')]){if(_0x43a831['error']['code']===0x1f4){logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0x43a831[_0x0f15('0x10')][_0x0f15('0x12')]);return _0x57bcde(_0x43a831['error'][_0x0f15('0x12')]);}logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0x43a831['error'][_0x0f15('0x12')]);return _0x3928e2(_0x43a831['error'][_0x0f15('0x12')]);}else{logger[_0x0f15('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0xb3af27,'request\x20sent');_0x3928e2(_0x43a831[_0x0f15('0x13')][_0x0f15('0x12')]);}})[_0x0f15('0x14')](function(_0xafd98){logger[_0x0f15('0x10')](_0x0f15('0x11'),_0xb3af27,_0xafd98);_0x57bcde(_0xafd98);});});}exports[_0x0f15('0x15')]=function(_0x47fb13){var _0x134bca=this;return new Promise(function(_0xae2a06,_0x4ff30b){return db[_0x0f15('0x16')]['create'](_0x47fb13[_0x0f15('0x17')],{'raw':_0x47fb13['options']?_0x47fb13[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x45b7ed){logger[_0x0f15('0xc')]('CreateCmHopperHistory',_0x47fb13);logger[_0x0f15('0xd')]('CreateCmHopperHistory',_0x47fb13,JSON['stringify'](_0x45b7ed));_0xae2a06(_0x45b7ed);})[_0x0f15('0x14')](function(_0x5d5adf){logger['error']('CreateCmHopperHistory',_0x5d5adf[_0x0f15('0x12')],_0x47fb13);_0x4ff30b(_0x134bca[_0x0f15('0x10')](0x1f4,_0x5d5adf[_0x0f15('0x12')]));});});};exports[_0x0f15('0x1a')]=function(_0x159ba6){var _0xc1287b=this;return new Promise(function(_0x399044,_0x26008e){return db[_0x0f15('0x16')]['findAll']({'raw':_0x159ba6[_0x0f15('0x18')]?_0x159ba6[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x159ba6['options']?_0x159ba6[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')][_0x0f15('0x1e')]('id')),_0x0f15('0x1f')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x20')))),_0x0f15('0x21')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x24'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x24'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x0f15('0x26')]]})[_0x0f15('0x27')](function(_0xf2a036){logger[_0x0f15('0xc')](_0x0f15('0x1a'),_0x159ba6);logger[_0x0f15('0xd')](_0x0f15('0x1a'),_0x159ba6,JSON[_0x0f15('0x28')](_0xf2a036));_0x399044(_0xf2a036);})[_0x0f15('0x14')](function(_0x434f2c){logger[_0x0f15('0x10')](_0x0f15('0x1a'),_0x434f2c[_0x0f15('0x12')],_0x159ba6);_0x26008e(_0xc1287b['error'](0x1f4,_0x434f2c[_0x0f15('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x50b319){var _0x437b81=this;return new Promise(function(_0x1240bb,_0x4d4903){return db[_0x0f15('0x16')]['findAll']({'raw':_0x50b319['options']?_0x50b319['options'][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x50b319[_0x0f15('0x18')]?_0x50b319[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[_0x0f15('0x29'),_0x0f15('0x2a')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x0f15('0x2c')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x20')))),_0x0f15('0x2d')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x2e')))),_0x0f15('0x2f')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x30')))),_0x0f15('0x31')],[db[_0x0f15('0x1c')]['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal'](_0x0f15('0x32')))),_0x0f15('0x33')],[db['sequelize']['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x34')))),_0x0f15('0x35')],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x0f15('0x36')],[db['sequelize']['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x37')))),_0x0f15('0x38')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x39')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x0f15('0x1c')]['fn']('IF',db[_0x0f15('0x1c')][_0x0f15('0x22')](_0x0f15('0x3a')))),_0x0f15('0x3b')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db['sequelize'][_0x0f15('0x22')]('`state`\x20=\x2020,\x201,\x20null'))),_0x0f15('0x3c')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db['sequelize']['fn']('IF',db['sequelize'][_0x0f15('0x22')](_0x0f15('0x3d')))),_0x0f15('0x3e')]],'group':[_0x0f15('0x29')]})['then'](function(_0x5156d0){logger[_0x0f15('0xc')](_0x0f15('0x3f'),_0x50b319);logger[_0x0f15('0xd')](_0x0f15('0x3f'),_0x50b319,JSON[_0x0f15('0x28')](_0x5156d0));_0x1240bb(_0x5156d0);})[_0x0f15('0x14')](function(_0x3d4eb0){logger[_0x0f15('0x10')](_0x0f15('0x3f'),_0x3d4eb0[_0x0f15('0x12')],_0x50b319);_0x4d4903(_0x437b81['error'](0x1f4,_0x3d4eb0[_0x0f15('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1a187e){var _0x5bbd43=this;return new Promise(function(_0x19f9e9,_0x48f376){return db[_0x0f15('0x16')][_0x0f15('0x40')]({'raw':_0x1a187e[_0x0f15('0x18')]?_0x1a187e[_0x0f15('0x18')][_0x0f15('0x19')]===undefined?!![]:![]:!![],'where':_0x1a187e[_0x0f15('0x18')]?_0x1a187e[_0x0f15('0x18')][_0x0f15('0x1b')]||null:null,'attributes':[[_0x0f15('0x29'),_0x0f15('0x2a')],[db[_0x0f15('0x1c')]['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')][_0x0f15('0x1e')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x0f15('0x1d'),db[_0x0f15('0x1c')]['fn']('IF',db['sequelize'][_0x0f15('0x22')](_0x0f15('0x20')))),_0x0f15('0x41')]],'group':[_0x0f15('0x29')]})[_0x0f15('0x27')](function(_0x6d780b){logger[_0x0f15('0xc')](_0x0f15('0x42'),_0x1a187e);logger[_0x0f15('0xd')](_0x0f15('0x42'),_0x1a187e,JSON[_0x0f15('0x28')](_0x6d780b));_0x19f9e9(_0x6d780b);})['catch'](function(_0x378ab4){logger[_0x0f15('0x10')](_0x0f15('0x42'),_0x378ab4[_0x0f15('0x12')],_0x1a187e);_0x48f376(_0x5bbd43[_0x0f15('0x10')](0x1f4,_0x378ab4[_0x0f15('0x12')]));});});}; \ No newline at end of file +var _0x4a65=['predictiveIntervalAvgTalktime','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundReCallsDay','GetCampaignHopperHistory','raw','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateCmHopperHistory','CmHopperHistory','options','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a65,0x16f));var _0x54a6=function(_0x50606a,_0x207bb0){_0x50606a=_0x50606a-0x0;var _0x4020ea=_0x4a65[_0x50606a];return _0x4020ea;};'use strict';var _=require('lodash');var util=require(_0x54a6('0x0'));var moment=require(_0x54a6('0x1'));var BPromise=require(_0x54a6('0x2'));var rs=require(_0x54a6('0x3'));var fs=require('fs');var Redis=require(_0x54a6('0x4'));var db=require(_0x54a6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x54a6('0x6'))(_0x54a6('0x7'));var config=require(_0x54a6('0x8'));var jayson=require(_0x54a6('0x9'));var client=jayson[_0x54a6('0xa')][_0x54a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6544,_0x27e9d3,_0x40e769){return new BPromise(function(_0xb61d06,_0x360d48){return client['request'](_0x2b6544,_0x40e769)[_0x54a6('0xc')](function(_0x40a069){logger['info'](_0x54a6('0xd'),_0x27e9d3,_0x54a6('0xe'));logger[_0x54a6('0xf')](_0x54a6('0x10'),_0x27e9d3,_0x54a6('0xe'),JSON[_0x54a6('0x11')](_0x40a069));if(_0x40a069[_0x54a6('0x12')]){if(_0x40a069[_0x54a6('0x12')][_0x54a6('0x13')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x27e9d3,_0x40a069['error'][_0x54a6('0x14')]);return _0x360d48(_0x40a069['error']['message']);}logger[_0x54a6('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x27e9d3,_0x40a069[_0x54a6('0x12')]['message']);return _0xb61d06(_0x40a069[_0x54a6('0x12')]['message']);}else{logger[_0x54a6('0x15')](_0x54a6('0xd'),_0x27e9d3,_0x54a6('0xe'));_0xb61d06(_0x40a069['result'][_0x54a6('0x14')]);}})['catch'](function(_0x1e18f6){logger['error'](_0x54a6('0xd'),_0x27e9d3,_0x1e18f6);_0x360d48(_0x1e18f6);});});}exports[_0x54a6('0x16')]=function(_0x1d0ad5){var _0x554f2f=this;return new Promise(function(_0x34ef9c,_0x3c3027){return db[_0x54a6('0x17')]['create'](_0x1d0ad5['body'],{'raw':_0x1d0ad5[_0x54a6('0x18')]?_0x1d0ad5[_0x54a6('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x430292){logger[_0x54a6('0x15')](_0x54a6('0x16'),_0x1d0ad5);logger[_0x54a6('0xf')](_0x54a6('0x16'),_0x1d0ad5,JSON['stringify'](_0x430292));_0x34ef9c(_0x430292);})['catch'](function(_0x4d1067){logger['error'](_0x54a6('0x16'),_0x4d1067[_0x54a6('0x14')],_0x1d0ad5);_0x3c3027(_0x554f2f['error'](0x1f4,_0x4d1067[_0x54a6('0x14')]));});});};exports[_0x54a6('0x19')]=function(_0x56e907){var _0x511bd3=this;return new Promise(function(_0x4b2ed0,_0x10ca94){return db['CmHopperHistory'][_0x54a6('0x1a')]({'raw':_0x56e907['options']?_0x56e907['options']['raw']===undefined?!![]:![]:!![],'where':_0x56e907[_0x54a6('0x18')]?_0x56e907['options'][_0x54a6('0x1b')]||null:null,'attributes':[[db['sequelize']['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')][_0x54a6('0x1e')]('id')),_0x54a6('0x1f')],[db['sequelize']['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x21')))),_0x54a6('0x22')],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x24')))),_0x54a6('0x25')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x26')))),_0x54a6('0x27')],[db[_0x54a6('0x1d')]['fn']('AVG',db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x28')))),_0x54a6('0x29')]]})[_0x54a6('0xc')](function(_0x21cf97){logger[_0x54a6('0x15')](_0x54a6('0x19'),_0x56e907);logger['debug'](_0x54a6('0x19'),_0x56e907,JSON[_0x54a6('0x11')](_0x21cf97));_0x4b2ed0(_0x21cf97);})[_0x54a6('0x2a')](function(_0x41ac41){logger[_0x54a6('0x12')]('AvgHandleTime',_0x41ac41[_0x54a6('0x14')],_0x56e907);_0x10ca94(_0x511bd3[_0x54a6('0x12')](0x1f4,_0x41ac41[_0x54a6('0x14')]));});});};exports[_0x54a6('0x2b')]=function(_0x4b7495){var _0x18b8a4=this;return new Promise(function(_0x52ed36,_0x32d286){return db[_0x54a6('0x17')][_0x54a6('0x1a')]({'raw':_0x4b7495[_0x54a6('0x18')]?_0x4b7495[_0x54a6('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4b7495[_0x54a6('0x18')]?_0x4b7495['options'][_0x54a6('0x1b')]||null:null,'attributes':[[_0x54a6('0x2c'),_0x54a6('0x2d')],[db['sequelize']['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x2f')))),_0x54a6('0x30')],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x54a6('0x31')],[db[_0x54a6('0x1d')]['fn']('COUNT',db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x32')))),'outboundBusyCallsDay'],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x33')))),_0x54a6('0x34')],[db['sequelize']['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x54a6('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x54a6('0x35')],[db['sequelize']['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x36')))),_0x54a6('0x37')],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x38')))),_0x54a6('0x39')],[db['sequelize']['fn']('COUNT',db[_0x54a6('0x1d')]['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x54a6('0x3a')],[db['sequelize']['fn']('COUNT',db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x3b')))),_0x54a6('0x3c')],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db[_0x54a6('0x1d')][_0x54a6('0x20')](_0x54a6('0x3d')))),_0x54a6('0x3e')],[db['sequelize']['fn']('COUNT',db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x54a6('0x3f')],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db[_0x54a6('0x1d')]['fn']('IF',db['sequelize'][_0x54a6('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x54a6('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x54a6('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x54a6('0x40')]],'group':['campaign']})[_0x54a6('0xc')](function(_0x587e3c){logger[_0x54a6('0x15')]('GetVoiceQueueHopperHistory',_0x4b7495);logger[_0x54a6('0xf')]('GetVoiceQueueHopperHistory',_0x4b7495,JSON[_0x54a6('0x11')](_0x587e3c));_0x52ed36(_0x587e3c);})[_0x54a6('0x2a')](function(_0x29e0e1){logger[_0x54a6('0x12')]('GetVoiceQueueHopperHistory',_0x29e0e1[_0x54a6('0x14')],_0x4b7495);_0x32d286(_0x18b8a4[_0x54a6('0x12')](0x1f4,_0x29e0e1[_0x54a6('0x14')]));});});};exports[_0x54a6('0x41')]=function(_0x104832){var _0x58cbf0=this;return new Promise(function(_0x395c07,_0x121120){return db[_0x54a6('0x17')][_0x54a6('0x1a')]({'raw':_0x104832[_0x54a6('0x18')]?_0x104832[_0x54a6('0x18')][_0x54a6('0x42')]===undefined?!![]:![]:!![],'where':_0x104832[_0x54a6('0x18')]?_0x104832[_0x54a6('0x18')]['where']||null:null,'attributes':[[_0x54a6('0x2c'),'name'],[db[_0x54a6('0x1d')]['fn'](_0x54a6('0x1c'),db['sequelize'][_0x54a6('0x1e')]('id')),'ivrTotalCallsDays'],[db[_0x54a6('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x54a6('0x20')](_0x54a6('0x21')))),_0x54a6('0x43')]],'group':[_0x54a6('0x2c')]})['then'](function(_0x310703){logger[_0x54a6('0x15')]('GetCampaignHopperHistory',_0x104832);logger[_0x54a6('0xf')](_0x54a6('0x41'),_0x104832,JSON[_0x54a6('0x11')](_0x310703));_0x395c07(_0x310703);})[_0x54a6('0x2a')](function(_0x37e4f4){logger[_0x54a6('0x12')](_0x54a6('0x41'),_0x37e4f4[_0x54a6('0x14')],_0x104832);_0x121120(_0x58cbf0[_0x54a6('0x12')](0x1f4,_0x37e4f4['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index e81856d..49a2ff1 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 _0x363f=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/:id','show','post','put','update','exports','multer','util','path','connect-timeout'];(function(_0x3079c0,_0x44a3d0){var _0x36aa04=function(_0x2be58b){while(--_0x2be58b){_0x3079c0['push'](_0x3079c0['shift']());}};_0x36aa04(++_0x44a3d0);}(_0x363f,0x128));var _0xf363=function(_0x3c4844,_0x5ae4cf){_0x3c4844=_0x3c4844-0x0;var _0x1c8eef=_0x363f[_0x3c4844];return _0x1c8eef;};'use strict';var multer=require(_0xf363('0x0'));var util=require(_0xf363('0x1'));var path=require(_0xf363('0x2'));var timeout=require(_0xf363('0x3'));var express=require(_0xf363('0x4'));var router=express[_0xf363('0x5')]();var fs_extra=require(_0xf363('0x6'));var auth=require(_0xf363('0x7'));var interaction=require(_0xf363('0x8'));var config=require(_0xf363('0x9'));var controller=require(_0xf363('0xa'));router[_0xf363('0xb')]('/',auth[_0xf363('0xc')](),controller[_0xf363('0xd')]);router['get']('/describe',auth[_0xf363('0xc')](),controller['describe']);router['get'](_0xf363('0xe'),auth[_0xf363('0xc')](),controller[_0xf363('0xf')]);router[_0xf363('0x10')]('/',auth[_0xf363('0xc')](),controller['create']);router[_0xf363('0x11')](_0xf363('0xe'),auth['isAuthenticated'](),controller[_0xf363('0x12')]);module[_0xf363('0x13')]=router; \ No newline at end of file +var _0x737c=['./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','exports','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x737c,0xca));var _0xc737=function(_0x455580,_0x5cd4dd){_0x455580=_0x455580-0x0;var _0x7aabc2=_0x737c[_0x455580];return _0x7aabc2;};'use strict';var multer=require(_0xc737('0x0'));var util=require('util');var path=require(_0xc737('0x1'));var timeout=require('connect-timeout');var express=require(_0xc737('0x2'));var router=express['Router']();var fs_extra=require(_0xc737('0x3'));var auth=require(_0xc737('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc737('0x5'));var controller=require(_0xc737('0x6'));router[_0xc737('0x7')]('/',auth[_0xc737('0x8')](),controller[_0xc737('0x9')]);router['get'](_0xc737('0xa'),auth[_0xc737('0x8')](),controller['describe']);router['get'](_0xc737('0xb'),auth[_0xc737('0x8')](),controller[_0xc737('0xc')]);router[_0xc737('0xd')]('/',auth[_0xc737('0x8')](),controller[_0xc737('0xe')]);router['put'](_0xc737('0xb'),auth[_0xc737('0x8')](),controller['update']);module[_0xc737('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index adba8ae..3f2b9be 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 _0xdcf6=['exports','STRING','name'];(function(_0x161e4d,_0x4a70e0){var _0x40e2d6=function(_0x35f800){while(--_0x35f800){_0x161e4d['push'](_0x161e4d['shift']());}};_0x40e2d6(++_0x4a70e0);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x4b3da3,_0x7e6f6a){_0x4b3da3=_0x4b3da3-0x0;var _0x373c4f=_0xdcf6[_0x4b3da3];return _0x373c4f;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'name':{'type':Sequelize[_0x6dcf('0x1')],'unique':_0x6dcf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6dcf('0x1')]},'dialPrefix':{'type':Sequelize[_0x6dcf('0x1')]}}; \ No newline at end of file +var _0x27a8=['STRING','name'];(function(_0x2a2bf9,_0x41745c){var _0x38a75c=function(_0x5eaf36){while(--_0x5eaf36){_0x2a2bf9['push'](_0x2a2bf9['shift']());}};_0x38a75c(++_0x41745c);}(_0x27a8,0x170));var _0x827a=function(_0x12b43b,_0xaf6d11){_0x12b43b=_0x12b43b-0x0;var _0x4b2608=_0x27a8[_0x12b43b];return _0x4b2608;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x827a('0x0')],'unique':_0x827a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x827a('0x0')]},'dialPrefix':{'type':Sequelize[_0x827a('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 54a9c22..c2841d2 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 _0x4762=['reject','save','update','destroy','then','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','include','rows','show','params','length','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','ListId','merge','findAll','removeDispositions','ids','addContacts','CmContact','isArray','tags','each','omit','success','push','dataValues','Malformed\x20request\x20syntax','CustomFields','format','cf_%d','getContacts','OrderBy','CmCustomField','alias','select','from','cm_contacts','c.ListId\x20=\x20?','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findOne','findAndCountAll','getGlobalCustomFields','addAgents','userCmList:save','userCmList:remove','emit','getAgents','info','spread','message','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x4762,0x7a));var _0x2476=function(_0x356628,_0x534c29){_0x356628=_0x356628-0x0;var _0x2d8f2d=_0x4762[_0x356628];return _0x2d8f2d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2476('0x0'));var jsonpatch=require(_0x2476('0x1'));var rp=require(_0x2476('0x2'));var moment=require(_0x2476('0x3'));var BPromise=require(_0x2476('0x4'));var Mustache=require('mustache');var util=require(_0x2476('0x5'));var path=require(_0x2476('0x6'));var sox=require(_0x2476('0x7'));var csv=require(_0x2476('0x8'));var ejs=require(_0x2476('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2476('0xa'));var squel=require(_0x2476('0xb'));var crypto=require(_0x2476('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2476('0x8'));var querystring=require('querystring');var Papa=require(_0x2476('0xd'));var Redis=require(_0x2476('0xe'));var authService=require(_0x2476('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2476('0x10'));var hardwareService=require(_0x2476('0x11'));var logger=require(_0x2476('0x12'))(_0x2476('0x13'));var utils=require('../../config/utils');var config=require(_0x2476('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2476('0x15'))['db'];var csv_results;config[_0x2476('0x16')]=_[_0x2476('0x17')](config[_0x2476('0x16')],{'host':_0x2476('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2476('0x16')]));require(_0x2476('0x19'))[_0x2476('0x1a')](socket);function respondWithStatusCode(_0x5cd367,_0x213c27){_0x213c27=_0x213c27||0xcc;return function(_0x561e55){if(_0x561e55){return _0x5cd367[_0x2476('0x1b')](_0x213c27);}return _0x5cd367[_0x2476('0x1c')](_0x213c27)[_0x2476('0x1d')]();};}function respondWithResult(_0x2fcc83,_0x1d78eb){_0x1d78eb=_0x1d78eb||0xc8;return function(_0x26460e){if(_0x26460e){return _0x2fcc83[_0x2476('0x1c')](_0x1d78eb)['json'](_0x26460e);}};}function respondWithFilteredResult(_0x32d57e,_0xf3276){return function(_0x5c1cb8){if(_0x5c1cb8){var _0x25e207=typeof _0xf3276[_0x2476('0x1e')]===_0x2476('0x1f')&&typeof _0xf3276[_0x2476('0x20')]===_0x2476('0x1f');var _0x10581f=_0x5c1cb8[_0x2476('0x21')];var _0x312285=_0x25e207?0x0:_0xf3276[_0x2476('0x1e')];var _0x4cd230=_0x25e207?_0x5c1cb8[_0x2476('0x21')]:_0xf3276[_0x2476('0x1e')]+_0xf3276['limit'];var _0x580bb6;if(_0x4cd230>=_0x10581f){_0x4cd230=_0x10581f;_0x580bb6=0xc8;}else{_0x580bb6=0xce;}_0x32d57e[_0x2476('0x1c')](_0x580bb6);return _0x32d57e[_0x2476('0x22')]('Content-Range',_0x312285+'-'+_0x4cd230+'/'+_0x10581f)[_0x2476('0x23')](_0x5c1cb8);}return null;};}function patchUpdates(_0x39535e){return function(_0x194f25){try{jsonpatch[_0x2476('0x24')](_0x194f25,_0x39535e,!![]);}catch(_0x4b21c3){return BPromise[_0x2476('0x25')](_0x4b21c3);}return _0x194f25[_0x2476('0x26')]();};}function saveUpdates(_0x39e2aa,_0x3d2138){return function(_0x597c62){if(_0x597c62){return _0x597c62[_0x2476('0x27')](_0x39e2aa)['then'](function(_0x1ac050){return _0x1ac050;});}return null;};}function removeEntity(_0x2f9843,_0x3b7c8d){return function(_0x1f0ee5){if(_0x1f0ee5){return _0x1f0ee5[_0x2476('0x28')]()[_0x2476('0x29')](function(){var _0x5e0002=_0x1f0ee5[_0x2476('0x2a')]({'plain':!![]});var _0x18a33d=_0x2476('0x2b');return db[_0x2476('0x2c')][_0x2476('0x28')]({'where':{'type':_0x18a33d,'resourceId':_0x5e0002['id']}})[_0x2476('0x29')](function(){return _0x1f0ee5;});})[_0x2476('0x29')](function(){_0x2f9843['status'](0xcc)[_0x2476('0x1d')]();});}};}function handleEntityNotFound(_0x56bade,_0x5d2f4a){return function(_0x291e42){if(!_0x291e42){_0x56bade[_0x2476('0x1b')](0x194);}return _0x291e42;};}function handleError(_0x5d2512,_0x2902ad){_0x2902ad=_0x2902ad||0x1f4;return function(_0x453ef2){logger[_0x2476('0x2d')](_0x453ef2[_0x2476('0x2e')]);if(_0x453ef2[_0x2476('0x2f')]){delete _0x453ef2[_0x2476('0x2f')];}_0x5d2512[_0x2476('0x1c')](_0x2902ad)[_0x2476('0x30')](_0x453ef2);};}exports['index']=function(_0x1e494f,_0x830693){var _0x3ad2a3={},_0xb22c34={},_0x3bb73b={'count':0x0,'rows':[]};var _0x584310=_[_0x2476('0x31')](db[_0x2476('0x32')][_0x2476('0x33')],function(_0x544fe7){return{'name':_0x544fe7[_0x2476('0x34')],'type':_0x544fe7[_0x2476('0x35')][_0x2476('0x36')]};});_0xb22c34[_0x2476('0x37')]=_[_0x2476('0x31')](_0x584310,_0x2476('0x2f'));_0xb22c34[_0x2476('0x38')]=_[_0x2476('0x39')](_0x1e494f[_0x2476('0x38')]);_0xb22c34[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0xb22c34[_0x2476('0x37')],_0xb22c34['query']);_0x3ad2a3[_0x2476('0x3c')]=_['intersection'](_0xb22c34[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x1e494f[_0x2476('0x38')]['fields']));_0x3ad2a3[_0x2476('0x3c')]=_0x3ad2a3[_0x2476('0x3c')]['length']?_0x3ad2a3[_0x2476('0x3c')]:_0xb22c34[_0x2476('0x37')];if(!_0x1e494f[_0x2476('0x38')][_0x2476('0x3e')](_0x2476('0x3f'))){_0x3ad2a3[_0x2476('0x20')]=qs[_0x2476('0x20')](_0x1e494f['query'][_0x2476('0x20')]);_0x3ad2a3['offset']=qs[_0x2476('0x1e')](_0x1e494f[_0x2476('0x38')][_0x2476('0x1e')]);}_0x3ad2a3[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x1e494f[_0x2476('0x38')][_0x2476('0x41')]);_0x3ad2a3[_0x2476('0x42')]=qs[_0x2476('0x3a')](_[_0x2476('0x43')](_0x1e494f[_0x2476('0x38')],_0xb22c34[_0x2476('0x3a')]),_0x584310);if(_0x1e494f['query'][_0x2476('0x44')]){_0x3ad2a3[_0x2476('0x42')]=_['merge'](_0x3ad2a3[_0x2476('0x42')],{'$or':_['map'](_0x584310,function(_0x213f53){if(_0x213f53['type']!=='VIRTUAL'){var _0x4b3261={};_0x4b3261[_0x213f53[_0x2476('0x2f')]]={'$like':'%'+_0x1e494f[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x4b3261;}})});}_0x3ad2a3=_['merge']({},_0x3ad2a3,_0x1e494f[_0x2476('0x45')]);var _0x509f7a={'where':_0x3ad2a3[_0x2476('0x42')]};return db[_0x2476('0x32')][_0x2476('0x21')](_0x509f7a)['then'](function(_0x260da7){_0x3bb73b[_0x2476('0x21')]=_0x260da7;if(_0x1e494f[_0x2476('0x38')]['includeAll']){_0x3ad2a3[_0x2476('0x46')]=[{'all':!![]}];}return db[_0x2476('0x32')]['findAll'](_0x3ad2a3);})[_0x2476('0x29')](function(_0x38709c){_0x3bb73b[_0x2476('0x47')]=_0x38709c;return _0x3bb73b;})[_0x2476('0x29')](respondWithFilteredResult(_0x830693,_0x3ad2a3))['catch'](handleError(_0x830693,null));};exports[_0x2476('0x48')]=function(_0x4d8038,_0x3358bc){var _0x18bd29={'raw':![],'where':{'id':_0x4d8038[_0x2476('0x49')]['id']}},_0x45d4d3={};_0x45d4d3[_0x2476('0x37')]=_['keys'](db[_0x2476('0x32')][_0x2476('0x33')]);_0x45d4d3[_0x2476('0x38')]=_[_0x2476('0x39')](_0x4d8038['query']);_0x45d4d3['filters']=_['intersection'](_0x45d4d3[_0x2476('0x37')],_0x45d4d3['query']);_0x18bd29[_0x2476('0x3c')]=_['intersection'](_0x45d4d3[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x4d8038[_0x2476('0x38')]['fields']));_0x18bd29['attributes']=_0x18bd29[_0x2476('0x3c')][_0x2476('0x4a')]?_0x18bd29['attributes']:_0x45d4d3[_0x2476('0x37')];if(_0x4d8038['query'][_0x2476('0x4b')]){_0x18bd29[_0x2476('0x46')]=[{'all':!![]}];}_0x18bd29=_['merge']({},_0x18bd29,_0x4d8038['options']);return db[_0x2476('0x32')]['find'](_0x18bd29)[_0x2476('0x29')](handleEntityNotFound(_0x3358bc,null))[_0x2476('0x29')](respondWithResult(_0x3358bc,null))['catch'](handleError(_0x3358bc,null));};exports[_0x2476('0x4c')]=function(_0x54c0a5,_0x49c838){return db[_0x2476('0x32')]['create'](_0x54c0a5[_0x2476('0x4d')],{})['then'](function(_0x206333){var _0x5baae4=_0x54c0a5['user'][_0x2476('0x2a')]({'plain':!![]});if(!_0x5baae4)throw new Error(_0x2476('0x4e'));if(_0x5baae4[_0x2476('0x4f')]===_0x2476('0x50')){var _0x3107ad=_0x206333['get']({'plain':!![]});var _0x5a8a7c=_0x2476('0x2b');return db['UserProfileSection'][_0x2476('0x51')]({'where':{'name':_0x5a8a7c,'userProfileId':_0x5baae4[_0x2476('0x52')]},'raw':!![]})[_0x2476('0x29')](function(_0x2f9f5a){if(_0x2f9f5a&&_0x2f9f5a[_0x2476('0x53')]===0x0){return db[_0x2476('0x2c')][_0x2476('0x4c')]({'name':_0x3107ad[_0x2476('0x2f')],'resourceId':_0x3107ad['id'],'type':_0x2f9f5a[_0x2476('0x2f')],'sectionId':_0x2f9f5a['id']},{})[_0x2476('0x29')](function(){return _0x206333;});}else{return _0x206333;}})[_0x2476('0x54')](function(_0x2bc470){logger[_0x2476('0x2d')](_0x2476('0x55'),_0x2bc470);throw _0x2bc470;});}return _0x206333;})[_0x2476('0x29')](respondWithResult(_0x49c838,0xc9))[_0x2476('0x54')](handleError(_0x49c838,null));};exports[_0x2476('0x27')]=function(_0x5a9d12,_0x5398b1){if(_0x5a9d12[_0x2476('0x4d')]['id']){delete _0x5a9d12[_0x2476('0x4d')]['id'];}return db[_0x2476('0x32')][_0x2476('0x51')]({'where':{'id':_0x5a9d12['params']['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5398b1,null))[_0x2476('0x29')](saveUpdates(_0x5a9d12[_0x2476('0x4d')],null))['then'](respondWithResult(_0x5398b1,null))[_0x2476('0x54')](handleError(_0x5398b1,null));};exports['destroy']=function(_0xd24487,_0x2312e6){return db['CmList']['find']({'where':{'id':_0xd24487[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x2312e6,null))['then'](removeEntity(_0x2312e6,null))['catch'](handleError(_0x2312e6,null));};exports[_0x2476('0x56')]=function(_0x21287e,_0x268d6c){return db[_0x2476('0x32')][_0x2476('0x56')]()[_0x2476('0x29')](respondWithResult(_0x268d6c,null))['catch'](handleError(_0x268d6c,null));};exports[_0x2476('0x57')]=function(_0x52c40d,_0x2f2877,_0x3b2976){if(_0x52c40d[_0x2476('0x4d')]['id']){delete _0x52c40d['body']['id'];}return db[_0x2476('0x32')]['find']({'where':{'id':_0x52c40d[_0x2476('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f2877,null))['then'](function(_0x331bae){if(_0x331bae){_0x52c40d[_0x2476('0x4d')]['ListId']=_0x331bae['id'];return db[_0x2476('0x58')][_0x2476('0x4c')](_0x52c40d[_0x2476('0x4d')]);}})[_0x2476('0x29')](respondWithResult(_0x2f2877,null))[_0x2476('0x54')](handleError(_0x2f2877,null));};exports[_0x2476('0x59')]=function(_0x1d0cdf,_0x56285a,_0x5ae958){var _0x4b523d={'raw':![],'where':{}};var _0x5c348e={};var _0x4774ba={'count':0x0,'rows':[]};return db[_0x2476('0x32')]['findOne']({'where':{'id':_0x1d0cdf['params']['id']}})['then'](handleEntityNotFound(_0x56285a,null))[_0x2476('0x29')](function(_0x55ee78){if(_0x55ee78){_0x5c348e[_0x2476('0x37')]=_[_0x2476('0x39')](db['Disposition'][_0x2476('0x33')]);_0x5c348e['query']=_[_0x2476('0x39')](_0x1d0cdf[_0x2476('0x38')]);_0x5c348e[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x5c348e['model'],_0x5c348e['query']);_0x4b523d[_0x2476('0x3c')]=_['intersection'](_0x5c348e[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x1d0cdf['query'][_0x2476('0x3d')]));_0x4b523d[_0x2476('0x3c')]=_0x4b523d[_0x2476('0x3c')][_0x2476('0x4a')]?_0x4b523d[_0x2476('0x3c')]:_0x5c348e[_0x2476('0x37')];if(!_0x1d0cdf['query'][_0x2476('0x3e')]('nolimit')){_0x4b523d[_0x2476('0x20')]=qs[_0x2476('0x20')](_0x1d0cdf[_0x2476('0x38')]['limit']);_0x4b523d['offset']=qs[_0x2476('0x1e')](_0x1d0cdf[_0x2476('0x38')]['offset']);}_0x4b523d[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x1d0cdf[_0x2476('0x38')][_0x2476('0x41')]);_0x4b523d[_0x2476('0x42')]=qs[_0x2476('0x3a')](_[_0x2476('0x43')](_0x1d0cdf[_0x2476('0x38')],_0x5c348e[_0x2476('0x3a')]));_0x4b523d[_0x2476('0x42')][_0x2476('0x5a')]=_0x55ee78['id'];if(_0x1d0cdf[_0x2476('0x38')][_0x2476('0x44')]){_0x4b523d[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x4b523d[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x4b523d[_0x2476('0x3c')],function(_0x2a1633){var _0x191262={};_0x191262[_0x2a1633]={'$like':'%'+_0x1d0cdf[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x191262;})});}_0x4b523d=_[_0x2476('0x5b')]({},_0x4b523d,_0x1d0cdf[_0x2476('0x45')]);return db[_0x2476('0x58')][_0x2476('0x21')]({'where':_0x4b523d['where']})[_0x2476('0x29')](function(_0x337415){_0x4774ba[_0x2476('0x21')]=_0x337415;if(_0x1d0cdf['query'][_0x2476('0x4b')]){_0x4b523d['include']=[{'all':!![]}];}return db[_0x2476('0x58')][_0x2476('0x5c')](_0x4b523d);})[_0x2476('0x29')](function(_0x2d0262){_0x4774ba[_0x2476('0x47')]=_0x2d0262;return _0x4774ba;});}})[_0x2476('0x29')](respondWithFilteredResult(_0x56285a,_0x4b523d))[_0x2476('0x54')](handleError(_0x56285a,null));};exports[_0x2476('0x5d')]=function(_0x10ce09,_0x1be24d,_0x32ea52){return db['CmList']['find']({'where':{'id':_0x10ce09[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x1be24d,null))[_0x2476('0x29')](function(_0x36f394){if(_0x36f394){return _0x36f394[_0x2476('0x5d')](_0x10ce09[_0x2476('0x38')][_0x2476('0x5e')]);}})[_0x2476('0x29')](respondWithStatusCode(_0x1be24d,null))[_0x2476('0x54')](handleError(_0x1be24d,null));};exports[_0x2476('0x5f')]=function(_0x479a4f,_0x16c602,_0x4d5a2b){return db['CmList'][_0x2476('0x51')]({'where':{'id':_0x479a4f[_0x2476('0x49')]['id']}})['then'](handleEntityNotFound(_0x16c602,null))[_0x2476('0x29')](function(_0x5674b8){if(_0x5674b8){var _0x9767ee=[];var _0x4be2e9={'success':[],'errors':[]};return db[_0x2476('0x60')][_0x2476('0x56')]()[_0x2476('0x29')](function(_0x165120){if(_0x479a4f[_0x2476('0x4d')]['tags']&&_[_0x2476('0x61')](_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')])){if(_0x479a4f[_0x2476('0x4d')]['tags']['length']){_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]=_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]['join'](';')+';';}else{_0x479a4f[_0x2476('0x4d')][_0x2476('0x62')]=null;}}else{_0x479a4f['body'][_0x2476('0x62')]=null;}if(_0x479a4f[_0x2476('0x4d')]&&_['isArray'](_0x479a4f[_0x2476('0x4d')])){for(var _0x3442a8=0x0;_0x3442a8<_0x479a4f['body'][_0x2476('0x4a')];_0x3442a8+=0x1){_0x479a4f[_0x2476('0x4d')][_0x3442a8][_0x2476('0x5a')]=_0x479a4f['params']['id'];_0x9767ee['push'](_0x479a4f['body'][_0x3442a8]);}return BPromise[_0x2476('0x63')](_0x9767ee,function(_0x1a193e){return db[_0x2476('0x60')][_0x2476('0x4c')](_[_0x2476('0x64')](_0x1a193e,[_0x2476('0x5e'),'id'])||{},{'fields':_[_0x2476('0x39')](_0x165120),'raw':!![]})[_0x2476('0x29')](function(_0x1b82e3){_0x4be2e9[_0x2476('0x65')][_0x2476('0x66')](_0x1b82e3[_0x2476('0x67')]);})['catch'](function(_0x59df7f){_0x4be2e9['errors'][_0x2476('0x66')]({'data':_0x1a193e,'error':_0x59df7f['message']});});})[_0x2476('0x29')](function(_0x3b4907){return _0x4be2e9;})[_0x2476('0x54')](function(_0x469260){return _0x469260;});}else{_0x16c602[_0x2476('0x1c')](0x190)[_0x2476('0x23')]({'message':_0x2476('0x68')});}});}})[_0x2476('0x29')](respondWithResult(_0x16c602,null))[_0x2476('0x54')](handleError(_0x16c602,null));};exports['getContacts']=function(_0xdcb52d,_0x25b9cb,_0x5205b5){var _0x93f488;return db['CmList']['find']({'where':{'id':_0xdcb52d[_0x2476('0x49')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x2476('0x69')}]})[_0x2476('0x29')](handleEntityNotFound(_0x25b9cb,null))[_0x2476('0x29')](function(_0x509bf0){if(_0x509bf0){_0x93f488=_0x509bf0;return db[_0x2476('0x60')][_0x2476('0x33')];}})[_0x2476('0x29')](function(_0x5af904){if(_0x5af904){var _0x56d90d={};var _0x1a0ef1={};_0x1a0ef1['model']=_['concat'](_[_0x2476('0x39')](_0x5af904),_[_0x2476('0x31')](_0x93f488[_0x2476('0x69')],function(_0x364bd5){return util[_0x2476('0x6a')](_0x2476('0x6b'),_0x364bd5['id']);}));_0x1a0ef1[_0x2476('0x38')]=_[_0x2476('0x39')](_0xdcb52d[_0x2476('0x38')]);_0x1a0ef1[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x1a0ef1[_0x2476('0x37')],_0x1a0ef1['query']);_0x56d90d[_0x2476('0x3c')]=_[_0x2476('0x3b')](_0x1a0ef1[_0x2476('0x37')],qs[_0x2476('0x3d')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x3d')]));_0x56d90d['attributes']=_0x56d90d[_0x2476('0x3c')][_0x2476('0x4a')]?_0x56d90d[_0x2476('0x3c')]:_0x1a0ef1[_0x2476('0x37')];if(!_0xdcb52d[_0x2476('0x38')]['hasOwnProperty']('nolimit')){_0x56d90d[_0x2476('0x20')]=qs[_0x2476('0x20')](_0xdcb52d['query'][_0x2476('0x20')]);_0x56d90d[_0x2476('0x1e')]=qs[_0x2476('0x1e')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x1e')]);}_0x56d90d[_0x2476('0x40')]=qs[_0x2476('0x41')](_0xdcb52d[_0x2476('0x38')][_0x2476('0x41')]);_0x56d90d[_0x2476('0x42')]=qs[_0x2476('0x3a')](_['pick'](_0xdcb52d[_0x2476('0x38')],_0x1a0ef1['filters']));_0x56d90d['raw']=!![];if(_0xdcb52d['query'][_0x2476('0x44')]){_0x56d90d[_0x2476('0x42')]=_['merge'](_0x56d90d[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x56d90d[_0x2476('0x3c')],function(_0x46d8ef){var _0x36d6b6={};_0x36d6b6[_0x46d8ef]={'$like':'%'+_0xdcb52d[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x36d6b6;})});}_0x56d90d=_[_0x2476('0x5b')]({},_0x56d90d,_0xdcb52d[_0x2476('0x45')]);return _0x93f488[_0x2476('0x6c')](_0x56d90d);}})[_0x2476('0x29')](respondWithResult(_0x25b9cb,null))[_0x2476('0x54')](handleError(_0x25b9cb,null));};exports['getContactsCsv']=function(_0x2c3cd5,_0x1362fe,_0x11bd6e){var _0x49b795;var _0x3f2059;var _0x1563e4;var _0x2be232=_0x2c3cd5[_0x2476('0x49')]['id'];csv_results=[];return db['ContactItemType'][_0x2476('0x5c')]({'attributes':['id',_0x2476('0x2f')],'raw':!![],'order':[_0x2476('0x6d')]})[_0x2476('0x29')](function(_0x37467b){_0x49b795=_0x37467b;var _0x5d335c=_[_0x2476('0x39')](db[_0x2476('0x60')][_0x2476('0x33')]);return db[_0x2476('0x6e')][_0x2476('0x5c')]({'raw':!![],'attributes':['id',_0x2476('0x6f')]})[_0x2476('0x29')](function(_0x29893a){_0x3f2059=_0x29893a;var _0x54a9f3=squel[_0x2476('0x70')]()['fields'](_0x5d335c)[_0x2476('0x71')](_0x2476('0x72'),'c')[_0x2476('0x42')](_0x2476('0x73'),_0x2be232)['where']('c.deletedAt\x20is\x20null')[_0x2476('0x74')]();for(var _0x2e80f3=0x0;_0x2e80f3<_0x3f2059[_0x2476('0x4a')];_0x2e80f3++){_0x54a9f3[_0x2476('0x75')](_0x2476('0x76')+_0x3f2059[_0x2e80f3]['id'],_0x2476('0x77')+_0x3f2059[_0x2e80f3][_0x2476('0x6f')]);}for(var _0x2e80f3=0x0;_0x2e80f3<_0x49b795[_0x2476('0x4a')];_0x2e80f3++){_0x54a9f3[_0x2476('0x75')](squel['select']()[_0x2476('0x75')](_0x2476('0x78'))[_0x2476('0x71')](_0x2476('0x79'))[_0x2476('0x42')](_0x2476('0x7a'),_0x49b795[_0x2e80f3]['id'])[_0x2476('0x42')](_0x2476('0x7b')),_0x2476('0x7c')+_0x49b795[_0x2e80f3][_0x2476('0x2f')]);_0x54a9f3[_0x2476('0x75')](squel[_0x2476('0x70')]()[_0x2476('0x75')](_0x2476('0x7d'))['from'](_0x2476('0x79'))['where'](_0x2476('0x7a'),_0x49b795[_0x2e80f3]['id'])[_0x2476('0x42')](_0x2476('0x7b')),_0x2476('0x7e')+_0x49b795[_0x2e80f3][_0x2476('0x2f')]);}var _0x419155=[];_0x419155[_0x2476('0x66')](_0x54a9f3[_0x2476('0x7f')]());BPromise[_0x2476('0x63')](_0x419155,handleQuery)[_0x2476('0x29')](function(_0x4cef20){handleQuery(_0x54a9f3['toString']());var _0x8ebf23=csv_results[0x0];if(!_['isEmpty'](_0x8ebf23)){var _0xc05b6c=toCsv(_0x8ebf23);var _0x5bc745=Date[_0x2476('0x80')]();fs['writeFileSync'](util[_0x2476('0x6a')](_0x2476('0x81'),_0x2be232,_0x5bc745),_0xc05b6c);_0x1362fe[_0x2476('0x82')](_0x2476('0x83'),'attachment;\x20filename='+util[_0x2476('0x6a')](_0x2476('0x84'),_0x2be232,_0x5bc745));_0x1362fe[_0x2476('0x82')](_0x2476('0x85'),_0x2476('0x86'));return _0x1362fe['download'](util[_0x2476('0x6a')](_0x2476('0x81'),_0x2be232,_0x5bc745));}else{return _0x1362fe[_0x2476('0x1b')](0xcc);}});});});};exports[_0x2476('0x87')]=function(_0x47c13b,_0x38aa13,_0x5796bf){var _0x1ef69b;delete _0x47c13b[_0x2476('0x4d')]['id'];return db[_0x2476('0x32')]['findOne']({'where':{'id':_0x47c13b[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x38aa13,null))[_0x2476('0x29')](function(_0x98525f){if(_0x98525f){return db[_0x2476('0x88')][_0x2476('0x89')](function(_0x3565bd){return db[_0x2476('0x6e')][_0x2476('0x4c')](_0x47c13b[_0x2476('0x4d')],{'transaction':_0x3565bd})[_0x2476('0x29')](function(_0x2c04b1){_0x1ef69b=_0x2c04b1;return _0x98525f[_0x2476('0x8a')](_0x2c04b1,{'transaction':_0x3565bd});})[_0x2476('0x29')](function(){var _0x1fde1e={'type':db[_0x2476('0x8b')][_0x2476('0x8c')],'transaction':_0x3565bd};switch(_0x47c13b[_0x2476('0x4d')][_0x2476('0x35')]){case'text':_0x1fde1e['type']=db[_0x2476('0x8b')][_0x2476('0x8c')];break;case'number':_0x1fde1e[_0x2476('0x35')]=db[_0x2476('0x8b')][_0x2476('0x8d')];break;case _0x2476('0x8e'):_0x1fde1e[_0x2476('0x35')]=db['Sequelize'][_0x2476('0x8f')];_0x1fde1e[_0x2476('0x90')]=![];break;default:}return db[_0x2476('0x88')][_0x2476('0x91')]['addColumn']('cm_contacts',util[_0x2476('0x6a')](_0x2476('0x92'),_0x1ef69b['id']),_0x1fde1e);})[_0x2476('0x29')](function(){return _0x1ef69b;});});}})[_0x2476('0x29')](respondWithResult(_0x38aa13,null))[_0x2476('0x54')](handleError(_0x38aa13,null));};exports[_0x2476('0x93')]=function(_0x4226a9,_0xca2b6f,_0x50242c){var _0x49acda={};var _0x28d3c6={};var _0x19c390;var _0x4441f2;return db[_0x2476('0x32')][_0x2476('0x94')]({'where':{'id':_0x4226a9[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0xca2b6f,null))['then'](function(_0x8b8847){if(_0x8b8847){_0x19c390=_0x8b8847;_0x28d3c6[_0x2476('0x37')]=_[_0x2476('0x39')](db[_0x2476('0x6e')][_0x2476('0x33')]);_0x28d3c6['query']=_['keys'](_0x4226a9[_0x2476('0x38')]);_0x28d3c6['filters']=_[_0x2476('0x3b')](_0x28d3c6[_0x2476('0x37')],_0x28d3c6[_0x2476('0x38')]);_0x49acda['attributes']=_[_0x2476('0x3b')](_0x28d3c6['model'],qs[_0x2476('0x3d')](_0x4226a9[_0x2476('0x38')]['fields']));_0x49acda[_0x2476('0x3c')]=_0x49acda['attributes'][_0x2476('0x4a')]?_0x49acda[_0x2476('0x3c')]:_0x28d3c6[_0x2476('0x37')];_0x49acda[_0x2476('0x40')]=qs[_0x2476('0x41')](_0x4226a9[_0x2476('0x38')][_0x2476('0x41')]);_0x49acda['where']=qs['filters'](_[_0x2476('0x43')](_0x4226a9['query'],_0x28d3c6[_0x2476('0x3a')]));_0x49acda[_0x2476('0x42')]=_['merge'](_0x49acda[_0x2476('0x42')],{'$or':[{'ListId':_0x8b8847['id']},{'ListId':null}]});if(_0x4226a9[_0x2476('0x38')][_0x2476('0x44')]){_0x49acda[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x49acda[_0x2476('0x42')],{'$or':_[_0x2476('0x31')](_0x49acda[_0x2476('0x3c')],function(_0x19ef62){var _0x5c32b4={};_0x5c32b4[_0x19ef62]={'$like':'%'+_0x4226a9[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x5c32b4;})});}_0x49acda=_[_0x2476('0x5b')]({},_0x49acda,_0x4226a9[_0x2476('0x45')]);return db['CmCustomField'][_0x2476('0x95')](_0x49acda);}})[_0x2476('0x29')](respondWithResult(_0xca2b6f,null))[_0x2476('0x54')](handleError(_0xca2b6f,null));};exports[_0x2476('0x96')]=function(_0x3a47b4,_0x50469e){return db[_0x2476('0x6e')]['findAndCountAll']({'where':{'ListId':null}})[_0x2476('0x29')](handleEntityNotFound(_0x50469e,null))[_0x2476('0x29')](function(_0x5c7b25){return _0x5c7b25;})[_0x2476('0x29')](respondWithResult(_0x50469e,null))[_0x2476('0x54')](handleError(_0x50469e,null));};exports[_0x2476('0x97')]=function(_0x72e0f2,_0xac450e,_0x1ada89){return db['CmList'][_0x2476('0x51')]({'where':{'id':_0x72e0f2[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0xac450e,null))['then'](function(_0x134386){if(_0x134386){return _0x134386[_0x2476('0x97')](_0x72e0f2['body'][_0x2476('0x5e')],_['omit'](_0x72e0f2['body'],[_0x2476('0x5e'),'id'])||{})['spread'](function(_0x50fe54){for(var _0x56d3d1=0x0;_0x56d3d1<_0x72e0f2[_0x2476('0x4d')][_0x2476('0x5e')][_0x2476('0x4a')];_0x56d3d1+=0x1){socket['emit'](_0x2476('0x98'),{'UserId':Number(_0x72e0f2[_0x2476('0x4d')][_0x2476('0x5e')][_0x56d3d1]),'CmListId':Number(_0x72e0f2[_0x2476('0x49')]['id'])});}return _0x50fe54;});}})[_0x2476('0x29')](respondWithResult(_0xac450e,null))[_0x2476('0x54')](handleError(_0xac450e,null));};exports['removeAgents']=function(_0x596155,_0x5895cd,_0x590b7a){return db[_0x2476('0x32')][_0x2476('0x51')]({'where':{'id':_0x596155[_0x2476('0x49')]['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5895cd,null))[_0x2476('0x29')](function(_0x4a8989){if(_0x4a8989){return _0x4a8989['removeAgents'](_0x596155[_0x2476('0x38')]['ids'])[_0x2476('0x29')](function(){if(_[_0x2476('0x61')](_0x596155[_0x2476('0x38')][_0x2476('0x5e')])){for(var _0x180cd7=0x0;_0x180cd7<_0x596155['query'][_0x2476('0x5e')][_0x2476('0x4a')];_0x180cd7+=0x1){socket['emit'](_0x2476('0x99'),{'UserId':Number(_0x596155[_0x2476('0x38')][_0x2476('0x5e')][_0x180cd7]),'CmListId':Number(_0x596155['params']['id'])});}}else{socket[_0x2476('0x9a')]('userCmList:remove',{'UserId':Number(_0x596155['query'][_0x2476('0x5e')]),'CmListId':Number(_0x596155[_0x2476('0x49')]['id'])});}});}})[_0x2476('0x29')](respondWithStatusCode(_0x5895cd,null))['catch'](handleError(_0x5895cd,null));};exports['getAgents']=function(_0x347a34,_0x5de89d,_0x2880ba){var _0x482308={};var _0x1212b7={};var _0x45430e;var _0x4279a0;return db[_0x2476('0x32')][_0x2476('0x94')]({'where':{'id':_0x347a34['params']['id']}})[_0x2476('0x29')](handleEntityNotFound(_0x5de89d,null))[_0x2476('0x29')](function(_0x45e43d){if(_0x45e43d){_0x45430e=_0x45e43d;_0x1212b7[_0x2476('0x37')]=_[_0x2476('0x39')](db['User'][_0x2476('0x33')]);_0x1212b7['query']=_[_0x2476('0x39')](_0x347a34[_0x2476('0x38')]);_0x1212b7[_0x2476('0x3a')]=_[_0x2476('0x3b')](_0x1212b7[_0x2476('0x37')],_0x1212b7[_0x2476('0x38')]);_0x482308[_0x2476('0x3c')]=_[_0x2476('0x3b')](_0x1212b7[_0x2476('0x37')],qs[_0x2476('0x3d')](_0x347a34[_0x2476('0x38')]['fields']));_0x482308[_0x2476('0x3c')]=_0x482308[_0x2476('0x3c')][_0x2476('0x4a')]?_0x482308['attributes']:_0x1212b7[_0x2476('0x37')];_0x482308['order']=qs['sort'](_0x347a34['query'][_0x2476('0x41')]);_0x482308['where']=qs['filters'](_[_0x2476('0x43')](_0x347a34[_0x2476('0x38')],_0x1212b7['filters']));if(_0x347a34[_0x2476('0x38')][_0x2476('0x44')]){_0x482308[_0x2476('0x42')]=_[_0x2476('0x5b')](_0x482308['where'],{'$or':_[_0x2476('0x31')](_0x482308[_0x2476('0x3c')],function(_0x31248c){var _0x3fb71c={};_0x3fb71c[_0x31248c]={'$like':'%'+_0x347a34[_0x2476('0x38')][_0x2476('0x44')]+'%'};return _0x3fb71c;})});}_0x482308=_[_0x2476('0x5b')]({},_0x482308,_0x347a34[_0x2476('0x45')]);return _0x45430e[_0x2476('0x9b')](_0x482308);}})[_0x2476('0x29')](function(_0x35d261){if(_0x35d261){_0x4279a0=_0x35d261['length'];if(!_0x347a34[_0x2476('0x38')][_0x2476('0x3e')](_0x2476('0x3f'))){_0x482308[_0x2476('0x20')]=qs['limit'](_0x347a34[_0x2476('0x38')][_0x2476('0x20')]);_0x482308[_0x2476('0x1e')]=qs['offset'](_0x347a34[_0x2476('0x38')][_0x2476('0x1e')]);}return _0x45430e['getAgents'](_0x482308);}})['then'](function(_0xd8b4e7){if(_0xd8b4e7){return _0xd8b4e7?{'count':_0x4279a0,'rows':_0xd8b4e7}:null;}})[_0x2476('0x29')](respondWithResult(_0x5de89d,null))['catch'](handleError(_0x5de89d,null));};function handleQuery(_0x34a589){logger[_0x2476('0x9c')](_0x34a589);return db[_0x2476('0x88')][_0x2476('0x38')](_0x34a589)[_0x2476('0x9d')](function(_0x289b7d){csv_results[_0x2476('0x66')](_0x289b7d);})[_0x2476('0x54')](function(_0x492144){logger[_0x2476('0x2d')](_0x492144[_0x2476('0x9e')]);});} \ No newline at end of file +var _0x49fd=['map','CmList','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','keys','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','update','params','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','pick','ids','tags','isArray','push','each','CmContact','omit','errors','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContactsCsv','findAll','alias','select','cm_contacts','distinct','field','c.cf_','customField_','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','toString','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','message','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','get','Lists','UserProfileResource','error','stack','name','index'];(function(_0x534f7c,_0x3eb489){var _0x5c3e22=function(_0x5dd4a4){while(--_0x5dd4a4){_0x534f7c['push'](_0x534f7c['shift']());}};_0x5c3e22(++_0x3eb489);}(_0x49fd,0x6c));var _0xd49f=function(_0xff6c2b,_0x4a8b03){_0xff6c2b=_0xff6c2b-0x0;var _0x898cbe=_0x49fd[_0xff6c2b];return _0x898cbe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd49f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd49f('0x1'));var moment=require('moment');var BPromise=require(_0xd49f('0x2'));var Mustache=require(_0xd49f('0x3'));var util=require('util');var path=require(_0xd49f('0x4'));var sox=require('sox');var csv=require(_0xd49f('0x5'));var ejs=require(_0xd49f('0x6'));var fs=require('fs');var fs_extra=require(_0xd49f('0x7'));var _=require('lodash');var squel=require(_0xd49f('0x8'));var crypto=require('crypto');var jsforce=require(_0xd49f('0x9'));var deskjs=require(_0xd49f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xd49f('0xb'));var Papa=require(_0xd49f('0xc'));var Redis=require(_0xd49f('0xd'));var authService=require(_0xd49f('0xe'));var qs=require(_0xd49f('0xf'));var as=require(_0xd49f('0x10'));var hardwareService=require(_0xd49f('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xd49f('0x12'));var config=require(_0xd49f('0x13'));var licenseUtil=require(_0xd49f('0x14'));var db=require(_0xd49f('0x15'))['db'];var csv_results;config[_0xd49f('0x16')]=_[_0xd49f('0x17')](config[_0xd49f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xd49f('0x18'))(new Redis(config[_0xd49f('0x16')]));require(_0xd49f('0x19'))[_0xd49f('0x1a')](socket);function respondWithStatusCode(_0x901738,_0x2b6856){_0x2b6856=_0x2b6856||0xcc;return function(_0x5c0131){if(_0x5c0131){return _0x901738[_0xd49f('0x1b')](_0x2b6856);}return _0x901738[_0xd49f('0x1c')](_0x2b6856)[_0xd49f('0x1d')]();};}function respondWithResult(_0x2c88f4,_0x468c00){_0x468c00=_0x468c00||0xc8;return function(_0x1b9fff){if(_0x1b9fff){return _0x2c88f4['status'](_0x468c00)[_0xd49f('0x1e')](_0x1b9fff);}};}function respondWithFilteredResult(_0x4ae783,_0x35d898){return function(_0x5b7ad5){if(_0x5b7ad5){var _0x2dec10=typeof _0x35d898['offset']===_0xd49f('0x1f')&&typeof _0x35d898[_0xd49f('0x20')]===_0xd49f('0x1f');var _0x4e7662=_0x5b7ad5['count'];var _0x188005=_0x2dec10?0x0:_0x35d898['offset'];var _0x3a0f66=_0x2dec10?_0x5b7ad5[_0xd49f('0x21')]:_0x35d898[_0xd49f('0x22')]+_0x35d898[_0xd49f('0x20')];var _0x266a67;if(_0x3a0f66>=_0x4e7662){_0x3a0f66=_0x4e7662;_0x266a67=0xc8;}else{_0x266a67=0xce;}_0x4ae783[_0xd49f('0x1c')](_0x266a67);return _0x4ae783['set'](_0xd49f('0x23'),_0x188005+'-'+_0x3a0f66+'/'+_0x4e7662)['json'](_0x5b7ad5);}return null;};}function patchUpdates(_0x252b59){return function(_0x15b37f){try{jsonpatch[_0xd49f('0x24')](_0x15b37f,_0x252b59,!![]);}catch(_0x3d4a5f){return BPromise[_0xd49f('0x25')](_0x3d4a5f);}return _0x15b37f[_0xd49f('0x26')]();};}function saveUpdates(_0x1d331b,_0x1c138a){return function(_0x4f083b){if(_0x4f083b){return _0x4f083b['update'](_0x1d331b)['then'](function(_0x4f03e1){return _0x4f03e1;});}return null;};}function removeEntity(_0x29114,_0x21abd4){return function(_0x4d788c){if(_0x4d788c){return _0x4d788c[_0xd49f('0x27')]()[_0xd49f('0x28')](function(){var _0x1ce2cd=_0x4d788c[_0xd49f('0x29')]({'plain':!![]});var _0x40dc8e=_0xd49f('0x2a');return db[_0xd49f('0x2b')]['destroy']({'where':{'type':_0x40dc8e,'resourceId':_0x1ce2cd['id']}})[_0xd49f('0x28')](function(){return _0x4d788c;});})[_0xd49f('0x28')](function(){_0x29114[_0xd49f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516573,_0x10c188){return function(_0x382ac2){if(!_0x382ac2){_0x516573[_0xd49f('0x1b')](0x194);}return _0x382ac2;};}function handleError(_0x240251,_0x21f39d){_0x21f39d=_0x21f39d||0x1f4;return function(_0x2631b4){logger[_0xd49f('0x2c')](_0x2631b4[_0xd49f('0x2d')]);if(_0x2631b4[_0xd49f('0x2e')]){delete _0x2631b4[_0xd49f('0x2e')];}_0x240251[_0xd49f('0x1c')](_0x21f39d)['send'](_0x2631b4);};}exports[_0xd49f('0x2f')]=function(_0x406ce4,_0x2fe53){var _0x4bc9ec={},_0x448216={},_0x104997={'count':0x0,'rows':[]};var _0x4a1b6e=_[_0xd49f('0x30')](db[_0xd49f('0x31')][_0xd49f('0x32')],function(_0x44d07d){return{'name':_0x44d07d[_0xd49f('0x33')],'type':_0x44d07d[_0xd49f('0x34')][_0xd49f('0x35')]};});_0x448216['model']=_[_0xd49f('0x30')](_0x4a1b6e,_0xd49f('0x2e'));_0x448216[_0xd49f('0x36')]=_['keys'](_0x406ce4['query']);_0x448216[_0xd49f('0x37')]=_['intersection'](_0x448216[_0xd49f('0x38')],_0x448216[_0xd49f('0x36')]);_0x4bc9ec[_0xd49f('0x39')]=_[_0xd49f('0x3a')](_0x448216['model'],qs[_0xd49f('0x3b')](_0x406ce4['query'][_0xd49f('0x3b')]));_0x4bc9ec[_0xd49f('0x39')]=_0x4bc9ec[_0xd49f('0x39')]['length']?_0x4bc9ec['attributes']:_0x448216[_0xd49f('0x38')];if(!_0x406ce4[_0xd49f('0x36')][_0xd49f('0x3c')]('nolimit')){_0x4bc9ec[_0xd49f('0x20')]=qs[_0xd49f('0x20')](_0x406ce4[_0xd49f('0x36')][_0xd49f('0x20')]);_0x4bc9ec[_0xd49f('0x22')]=qs['offset'](_0x406ce4[_0xd49f('0x36')]['offset']);}_0x4bc9ec[_0xd49f('0x3d')]=qs[_0xd49f('0x3e')](_0x406ce4[_0xd49f('0x36')][_0xd49f('0x3e')]);_0x4bc9ec[_0xd49f('0x3f')]=qs[_0xd49f('0x37')](_['pick'](_0x406ce4[_0xd49f('0x36')],_0x448216['filters']),_0x4a1b6e);if(_0x406ce4[_0xd49f('0x36')][_0xd49f('0x40')]){_0x4bc9ec[_0xd49f('0x3f')]=_[_0xd49f('0x41')](_0x4bc9ec[_0xd49f('0x3f')],{'$or':_[_0xd49f('0x30')](_0x4a1b6e,function(_0x4e0b13){if(_0x4e0b13[_0xd49f('0x34')]!==_0xd49f('0x42')){var _0x3dc113={};_0x3dc113[_0x4e0b13[_0xd49f('0x2e')]]={'$like':'%'+_0x406ce4[_0xd49f('0x36')][_0xd49f('0x40')]+'%'};return _0x3dc113;}})});}_0x4bc9ec=_[_0xd49f('0x41')]({},_0x4bc9ec,_0x406ce4[_0xd49f('0x43')]);var _0xb49607={'where':_0x4bc9ec[_0xd49f('0x3f')]};return db[_0xd49f('0x31')]['count'](_0xb49607)['then'](function(_0x2cb584){_0x104997[_0xd49f('0x21')]=_0x2cb584;if(_0x406ce4['query']['includeAll']){_0x4bc9ec[_0xd49f('0x44')]=[{'all':!![]}];}return db[_0xd49f('0x31')]['findAll'](_0x4bc9ec);})['then'](function(_0x38424a){_0x104997[_0xd49f('0x45')]=_0x38424a;return _0x104997;})[_0xd49f('0x28')](respondWithFilteredResult(_0x2fe53,_0x4bc9ec))[_0xd49f('0x46')](handleError(_0x2fe53,null));};exports[_0xd49f('0x47')]=function(_0x56d4f1,_0x1d4b6){var _0x201b1a={'raw':![],'where':{'id':_0x56d4f1['params']['id']}},_0x5619f7={};_0x5619f7[_0xd49f('0x38')]=_[_0xd49f('0x48')](db['CmList'][_0xd49f('0x32')]);_0x5619f7[_0xd49f('0x36')]=_['keys'](_0x56d4f1['query']);_0x5619f7[_0xd49f('0x37')]=_[_0xd49f('0x3a')](_0x5619f7[_0xd49f('0x38')],_0x5619f7['query']);_0x201b1a[_0xd49f('0x39')]=_['intersection'](_0x5619f7[_0xd49f('0x38')],qs[_0xd49f('0x3b')](_0x56d4f1[_0xd49f('0x36')]['fields']));_0x201b1a['attributes']=_0x201b1a[_0xd49f('0x39')][_0xd49f('0x49')]?_0x201b1a[_0xd49f('0x39')]:_0x5619f7[_0xd49f('0x38')];if(_0x56d4f1[_0xd49f('0x36')]['includeAll']){_0x201b1a[_0xd49f('0x44')]=[{'all':!![]}];}_0x201b1a=_[_0xd49f('0x41')]({},_0x201b1a,_0x56d4f1[_0xd49f('0x43')]);return db[_0xd49f('0x31')][_0xd49f('0x4a')](_0x201b1a)[_0xd49f('0x28')](handleEntityNotFound(_0x1d4b6,null))[_0xd49f('0x28')](respondWithResult(_0x1d4b6,null))[_0xd49f('0x46')](handleError(_0x1d4b6,null));};exports['create']=function(_0x3ceabf,_0x129c9e){return db[_0xd49f('0x31')]['create'](_0x3ceabf[_0xd49f('0x4b')],{})['then'](function(_0x39213e){var _0x1dfe42=_0x3ceabf['user'][_0xd49f('0x29')]({'plain':!![]});if(!_0x1dfe42)throw new Error(_0xd49f('0x4c'));if(_0x1dfe42[_0xd49f('0x4d')]===_0xd49f('0x4e')){var _0x1ff3f6=_0x39213e[_0xd49f('0x29')]({'plain':!![]});var _0x321379=_0xd49f('0x2a');return db[_0xd49f('0x4f')][_0xd49f('0x4a')]({'where':{'name':_0x321379,'userProfileId':_0x1dfe42[_0xd49f('0x50')]},'raw':!![]})[_0xd49f('0x28')](function(_0x51a519){if(_0x51a519&&_0x51a519[_0xd49f('0x51')]===0x0){return db[_0xd49f('0x2b')][_0xd49f('0x52')]({'name':_0x1ff3f6[_0xd49f('0x2e')],'resourceId':_0x1ff3f6['id'],'type':_0x51a519['name'],'sectionId':_0x51a519['id']},{})[_0xd49f('0x28')](function(){return _0x39213e;});}else{return _0x39213e;}})[_0xd49f('0x46')](function(_0x9740b6){logger[_0xd49f('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9740b6);throw _0x9740b6;});}return _0x39213e;})[_0xd49f('0x28')](respondWithResult(_0x129c9e,0xc9))[_0xd49f('0x46')](handleError(_0x129c9e,null));};exports[_0xd49f('0x53')]=function(_0x52aef9,_0x4700ec){if(_0x52aef9[_0xd49f('0x4b')]['id']){delete _0x52aef9[_0xd49f('0x4b')]['id'];}return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x52aef9[_0xd49f('0x54')]['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x4700ec,null))[_0xd49f('0x28')](saveUpdates(_0x52aef9[_0xd49f('0x4b')],null))[_0xd49f('0x28')](respondWithResult(_0x4700ec,null))[_0xd49f('0x46')](handleError(_0x4700ec,null));};exports[_0xd49f('0x27')]=function(_0x18a180,_0x105c31){return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x18a180[_0xd49f('0x54')]['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x105c31,null))[_0xd49f('0x28')](removeEntity(_0x105c31,null))[_0xd49f('0x46')](handleError(_0x105c31,null));};exports[_0xd49f('0x55')]=function(_0x1d18a3,_0x4b0b83){return db[_0xd49f('0x31')][_0xd49f('0x55')]()['then'](respondWithResult(_0x4b0b83,null))[_0xd49f('0x46')](handleError(_0x4b0b83,null));};exports[_0xd49f('0x56')]=function(_0x732bf3,_0x4d6a66,_0x33834a){if(_0x732bf3[_0xd49f('0x4b')]['id']){delete _0x732bf3[_0xd49f('0x4b')]['id'];}return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x732bf3['params']['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x4d6a66,null))['then'](function(_0x590d81){if(_0x590d81){_0x732bf3['body'][_0xd49f('0x57')]=_0x590d81['id'];return db[_0xd49f('0x58')]['create'](_0x732bf3['body']);}})[_0xd49f('0x28')](respondWithResult(_0x4d6a66,null))['catch'](handleError(_0x4d6a66,null));};exports[_0xd49f('0x59')]=function(_0x2178a7,_0x2d3b57,_0x5d7d99){var _0x2a5fe1={'raw':![],'where':{}};var _0x1aa31c={};var _0x680a78={'count':0x0,'rows':[]};return db[_0xd49f('0x31')]['findOne']({'where':{'id':_0x2178a7[_0xd49f('0x54')]['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x2d3b57,null))['then'](function(_0x2b2bf2){if(_0x2b2bf2){_0x1aa31c['model']=_[_0xd49f('0x48')](db[_0xd49f('0x58')][_0xd49f('0x32')]);_0x1aa31c[_0xd49f('0x36')]=_[_0xd49f('0x48')](_0x2178a7[_0xd49f('0x36')]);_0x1aa31c['filters']=_['intersection'](_0x1aa31c[_0xd49f('0x38')],_0x1aa31c[_0xd49f('0x36')]);_0x2a5fe1['attributes']=_[_0xd49f('0x3a')](_0x1aa31c['model'],qs[_0xd49f('0x3b')](_0x2178a7[_0xd49f('0x36')][_0xd49f('0x3b')]));_0x2a5fe1[_0xd49f('0x39')]=_0x2a5fe1[_0xd49f('0x39')][_0xd49f('0x49')]?_0x2a5fe1[_0xd49f('0x39')]:_0x1aa31c['model'];if(!_0x2178a7[_0xd49f('0x36')][_0xd49f('0x3c')](_0xd49f('0x5a'))){_0x2a5fe1[_0xd49f('0x20')]=qs[_0xd49f('0x20')](_0x2178a7[_0xd49f('0x36')][_0xd49f('0x20')]);_0x2a5fe1[_0xd49f('0x22')]=qs[_0xd49f('0x22')](_0x2178a7[_0xd49f('0x36')][_0xd49f('0x22')]);}_0x2a5fe1[_0xd49f('0x3d')]=qs[_0xd49f('0x3e')](_0x2178a7['query'][_0xd49f('0x3e')]);_0x2a5fe1[_0xd49f('0x3f')]=qs[_0xd49f('0x37')](_[_0xd49f('0x5b')](_0x2178a7[_0xd49f('0x36')],_0x1aa31c['filters']));_0x2a5fe1[_0xd49f('0x3f')][_0xd49f('0x57')]=_0x2b2bf2['id'];if(_0x2178a7[_0xd49f('0x36')][_0xd49f('0x40')]){_0x2a5fe1[_0xd49f('0x3f')]=_[_0xd49f('0x41')](_0x2a5fe1['where'],{'$or':_[_0xd49f('0x30')](_0x2a5fe1['attributes'],function(_0x375733){var _0x37ff84={};_0x37ff84[_0x375733]={'$like':'%'+_0x2178a7[_0xd49f('0x36')][_0xd49f('0x40')]+'%'};return _0x37ff84;})});}_0x2a5fe1=_[_0xd49f('0x41')]({},_0x2a5fe1,_0x2178a7[_0xd49f('0x43')]);return db[_0xd49f('0x58')][_0xd49f('0x21')]({'where':_0x2a5fe1[_0xd49f('0x3f')]})[_0xd49f('0x28')](function(_0x1f748d){_0x680a78[_0xd49f('0x21')]=_0x1f748d;if(_0x2178a7[_0xd49f('0x36')]['includeAll']){_0x2a5fe1[_0xd49f('0x44')]=[{'all':!![]}];}return db[_0xd49f('0x58')]['findAll'](_0x2a5fe1);})[_0xd49f('0x28')](function(_0x24e440){_0x680a78[_0xd49f('0x45')]=_0x24e440;return _0x680a78;});}})[_0xd49f('0x28')](respondWithFilteredResult(_0x2d3b57,_0x2a5fe1))[_0xd49f('0x46')](handleError(_0x2d3b57,null));};exports['removeDispositions']=function(_0x14853f,_0x510ed5,_0x1d96e8){return db['CmList'][_0xd49f('0x4a')]({'where':{'id':_0x14853f['params']['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x510ed5,null))[_0xd49f('0x28')](function(_0x93fcf5){if(_0x93fcf5){return _0x93fcf5['removeDispositions'](_0x14853f['query'][_0xd49f('0x5c')]);}})[_0xd49f('0x28')](respondWithStatusCode(_0x510ed5,null))['catch'](handleError(_0x510ed5,null));};exports['addContacts']=function(_0x3ed6e7,_0x288199,_0x5d77b2){return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x3ed6e7['params']['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x288199,null))['then'](function(_0x129e19){if(_0x129e19){var _0x531f6a=[];var _0x69b2ea={'success':[],'errors':[]};return db['CmContact'][_0xd49f('0x55')]()[_0xd49f('0x28')](function(_0x3eb5d2){if(_0x3ed6e7[_0xd49f('0x4b')][_0xd49f('0x5d')]&&_['isArray'](_0x3ed6e7[_0xd49f('0x4b')][_0xd49f('0x5d')])){if(_0x3ed6e7['body'][_0xd49f('0x5d')][_0xd49f('0x49')]){_0x3ed6e7[_0xd49f('0x4b')][_0xd49f('0x5d')]=_0x3ed6e7['body']['tags']['join'](';')+';';}else{_0x3ed6e7['body'][_0xd49f('0x5d')]=null;}}else{_0x3ed6e7['body']['tags']=null;}if(_0x3ed6e7['body']&&_[_0xd49f('0x5e')](_0x3ed6e7[_0xd49f('0x4b')])){for(var _0x1cab47=0x0;_0x1cab47<_0x3ed6e7['body'][_0xd49f('0x49')];_0x1cab47+=0x1){_0x3ed6e7[_0xd49f('0x4b')][_0x1cab47][_0xd49f('0x57')]=_0x3ed6e7[_0xd49f('0x54')]['id'];_0x531f6a[_0xd49f('0x5f')](_0x3ed6e7[_0xd49f('0x4b')][_0x1cab47]);}return BPromise[_0xd49f('0x60')](_0x531f6a,function(_0x276028){return db[_0xd49f('0x61')][_0xd49f('0x52')](_[_0xd49f('0x62')](_0x276028,[_0xd49f('0x5c'),'id'])||{},{'fields':_['keys'](_0x3eb5d2),'raw':!![]})[_0xd49f('0x28')](function(_0x1a4c99){_0x69b2ea['success'][_0xd49f('0x5f')](_0x1a4c99['dataValues']);})[_0xd49f('0x46')](function(_0x4296e0){_0x69b2ea[_0xd49f('0x63')]['push']({'data':_0x276028,'error':_0x4296e0['message']});});})[_0xd49f('0x28')](function(_0x4a6878){return _0x69b2ea;})[_0xd49f('0x46')](function(_0x4407ab){return _0x4407ab;});}else{_0x288199[_0xd49f('0x1c')](0x190)[_0xd49f('0x1e')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0xd49f('0x28')](respondWithResult(_0x288199,null))['catch'](handleError(_0x288199,null));};exports[_0xd49f('0x64')]=function(_0x3fe080,_0x22f0b1,_0x15da68){var _0x16ecf1;return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x3fe080[_0xd49f('0x54')]['id']},'include':[{'model':db[_0xd49f('0x65')],'as':'CustomFields'}]})[_0xd49f('0x28')](handleEntityNotFound(_0x22f0b1,null))[_0xd49f('0x28')](function(_0x2bfb77){if(_0x2bfb77){_0x16ecf1=_0x2bfb77;return db[_0xd49f('0x61')][_0xd49f('0x32')];}})[_0xd49f('0x28')](function(_0x3a1ce8){if(_0x3a1ce8){var _0x41b6b={};var _0x1cece2={};_0x1cece2['model']=_[_0xd49f('0x66')](_['keys'](_0x3a1ce8),_[_0xd49f('0x30')](_0x16ecf1[_0xd49f('0x67')],function(_0x12d60a){return util[_0xd49f('0x68')](_0xd49f('0x69'),_0x12d60a['id']);}));_0x1cece2[_0xd49f('0x36')]=_[_0xd49f('0x48')](_0x3fe080[_0xd49f('0x36')]);_0x1cece2[_0xd49f('0x37')]=_['intersection'](_0x1cece2['model'],_0x1cece2[_0xd49f('0x36')]);_0x41b6b['attributes']=_['intersection'](_0x1cece2['model'],qs[_0xd49f('0x3b')](_0x3fe080[_0xd49f('0x36')][_0xd49f('0x3b')]));_0x41b6b['attributes']=_0x41b6b[_0xd49f('0x39')][_0xd49f('0x49')]?_0x41b6b[_0xd49f('0x39')]:_0x1cece2['model'];if(!_0x3fe080[_0xd49f('0x36')][_0xd49f('0x3c')](_0xd49f('0x5a'))){_0x41b6b[_0xd49f('0x20')]=qs[_0xd49f('0x20')](_0x3fe080[_0xd49f('0x36')]['limit']);_0x41b6b['offset']=qs[_0xd49f('0x22')](_0x3fe080[_0xd49f('0x36')][_0xd49f('0x22')]);}_0x41b6b[_0xd49f('0x3d')]=qs[_0xd49f('0x3e')](_0x3fe080[_0xd49f('0x36')]['sort']);_0x41b6b[_0xd49f('0x3f')]=qs[_0xd49f('0x37')](_['pick'](_0x3fe080[_0xd49f('0x36')],_0x1cece2[_0xd49f('0x37')]));_0x41b6b[_0xd49f('0x6a')]=!![];if(_0x3fe080[_0xd49f('0x36')][_0xd49f('0x40')]){_0x41b6b[_0xd49f('0x3f')]=_['merge'](_0x41b6b['where'],{'$or':_[_0xd49f('0x30')](_0x41b6b['attributes'],function(_0x3d5849){var _0x2e99c6={};_0x2e99c6[_0x3d5849]={'$like':'%'+_0x3fe080['query']['filter']+'%'};return _0x2e99c6;})});}_0x41b6b=_[_0xd49f('0x41')]({},_0x41b6b,_0x3fe080[_0xd49f('0x43')]);return _0x16ecf1[_0xd49f('0x64')](_0x41b6b);}})[_0xd49f('0x28')](respondWithResult(_0x22f0b1,null))[_0xd49f('0x46')](handleError(_0x22f0b1,null));};exports[_0xd49f('0x6b')]=function(_0x4d1c81,_0x212608,_0x353593){var _0x3d113f;var _0x2c8fe3;var _0x483567;var _0x17eb4b=_0x4d1c81['params']['id'];csv_results=[];return db['ContactItemType'][_0xd49f('0x6c')]({'attributes':['id',_0xd49f('0x2e')],'raw':!![],'order':['OrderBy']})[_0xd49f('0x28')](function(_0x2452d5){_0x3d113f=_0x2452d5;var _0x97c808=_['keys'](db[_0xd49f('0x61')][_0xd49f('0x32')]);return db[_0xd49f('0x65')]['findAll']({'raw':!![],'attributes':['id',_0xd49f('0x6d')]})[_0xd49f('0x28')](function(_0x3ccb78){_0x2c8fe3=_0x3ccb78;var _0x5efc22=squel[_0xd49f('0x6e')]()['fields'](_0x97c808)['from'](_0xd49f('0x6f'),'c')[_0xd49f('0x3f')]('c.ListId\x20=\x20?',_0x17eb4b)[_0xd49f('0x3f')]('c.deletedAt\x20is\x20null')[_0xd49f('0x70')]();for(var _0xff43ff=0x0;_0xff43ff<_0x2c8fe3['length'];_0xff43ff++){_0x5efc22[_0xd49f('0x71')](_0xd49f('0x72')+_0x2c8fe3[_0xff43ff]['id'],_0xd49f('0x73')+_0x2c8fe3[_0xff43ff]['alias']);}for(var _0xff43ff=0x0;_0xff43ff<_0x3d113f['length'];_0xff43ff++){_0x5efc22[_0xd49f('0x71')](squel[_0xd49f('0x6e')]()[_0xd49f('0x71')]('item')[_0xd49f('0x74')](_0xd49f('0x75'))[_0xd49f('0x3f')](_0xd49f('0x76'),_0x3d113f[_0xff43ff]['id'])[_0xd49f('0x3f')](_0xd49f('0x77')),_0xd49f('0x78')+_0x3d113f[_0xff43ff][_0xd49f('0x2e')]);_0x5efc22[_0xd49f('0x71')](squel['select']()[_0xd49f('0x71')](_0xd49f('0x79'))['from'](_0xd49f('0x75'))[_0xd49f('0x3f')](_0xd49f('0x76'),_0x3d113f[_0xff43ff]['id'])[_0xd49f('0x3f')](_0xd49f('0x77')),'description_additionalPhone_'+_0x3d113f[_0xff43ff][_0xd49f('0x2e')]);}var _0x4c7692=[];_0x4c7692[_0xd49f('0x5f')](_0x5efc22[_0xd49f('0x7a')]());BPromise['each'](_0x4c7692,handleQuery)['then'](function(_0x396935){handleQuery(_0x5efc22[_0xd49f('0x7a')]());var _0x3b3ee6=csv_results[0x0];if(!_['isEmpty'](_0x3b3ee6)){var _0x4e9327=toCsv(_0x3b3ee6);var _0x708432=Date['now']();fs[_0xd49f('0x7b')](util['format'](_0xd49f('0x7c'),_0x17eb4b,_0x708432),_0x4e9327);_0x212608['setHeader']('Content-disposition','attachment;\x20filename='+util[_0xd49f('0x68')]('list_%d_%s.csv',_0x17eb4b,_0x708432));_0x212608[_0xd49f('0x7d')](_0xd49f('0x7e'),_0xd49f('0x7f'));return _0x212608[_0xd49f('0x80')](util[_0xd49f('0x68')](_0xd49f('0x7c'),_0x17eb4b,_0x708432));}else{return _0x212608['sendStatus'](0xcc);}});});});};exports[_0xd49f('0x81')]=function(_0x4ad17c,_0x21a530,_0x1f1ac4){var _0x3856ae;delete _0x4ad17c['body']['id'];return db[_0xd49f('0x31')][_0xd49f('0x82')]({'where':{'id':_0x4ad17c['params']['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x21a530,null))[_0xd49f('0x28')](function(_0x5b2234){if(_0x5b2234){return db[_0xd49f('0x83')][_0xd49f('0x84')](function(_0x1e54bd){return db[_0xd49f('0x65')]['create'](_0x4ad17c[_0xd49f('0x4b')],{'transaction':_0x1e54bd})['then'](function(_0x5a570f){_0x3856ae=_0x5a570f;return _0x5b2234[_0xd49f('0x85')](_0x5a570f,{'transaction':_0x1e54bd});})[_0xd49f('0x28')](function(){var _0x45eeb0={'type':db['Sequelize']['TEXT'],'transaction':_0x1e54bd};switch(_0x4ad17c[_0xd49f('0x4b')][_0xd49f('0x34')]){case _0xd49f('0x86'):_0x45eeb0[_0xd49f('0x34')]=db[_0xd49f('0x87')][_0xd49f('0x88')];break;case _0xd49f('0x89'):_0x45eeb0[_0xd49f('0x34')]=db['Sequelize'][_0xd49f('0x8a')];break;case _0xd49f('0x8b'):_0x45eeb0[_0xd49f('0x34')]=db[_0xd49f('0x87')][_0xd49f('0x8c')];_0x45eeb0['defaultValue']=![];break;default:}return db['sequelize'][_0xd49f('0x8d')][_0xd49f('0x8e')](_0xd49f('0x6f'),util[_0xd49f('0x68')](_0xd49f('0x8f'),_0x3856ae['id']),_0x45eeb0);})[_0xd49f('0x28')](function(){return _0x3856ae;});});}})[_0xd49f('0x28')](respondWithResult(_0x21a530,null))[_0xd49f('0x46')](handleError(_0x21a530,null));};exports[_0xd49f('0x90')]=function(_0x539b1b,_0x42c2bc,_0x31dfd7){var _0x121372={};var _0x4e11e1={};var _0x499017;var _0x4b095e;return db[_0xd49f('0x31')][_0xd49f('0x82')]({'where':{'id':_0x539b1b['params']['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x42c2bc,null))[_0xd49f('0x28')](function(_0x202a58){if(_0x202a58){_0x499017=_0x202a58;_0x4e11e1[_0xd49f('0x38')]=_[_0xd49f('0x48')](db[_0xd49f('0x65')]['rawAttributes']);_0x4e11e1[_0xd49f('0x36')]=_[_0xd49f('0x48')](_0x539b1b[_0xd49f('0x36')]);_0x4e11e1[_0xd49f('0x37')]=_[_0xd49f('0x3a')](_0x4e11e1[_0xd49f('0x38')],_0x4e11e1[_0xd49f('0x36')]);_0x121372[_0xd49f('0x39')]=_[_0xd49f('0x3a')](_0x4e11e1[_0xd49f('0x38')],qs[_0xd49f('0x3b')](_0x539b1b[_0xd49f('0x36')][_0xd49f('0x3b')]));_0x121372[_0xd49f('0x39')]=_0x121372[_0xd49f('0x39')]['length']?_0x121372[_0xd49f('0x39')]:_0x4e11e1[_0xd49f('0x38')];_0x121372[_0xd49f('0x3d')]=qs[_0xd49f('0x3e')](_0x539b1b[_0xd49f('0x36')][_0xd49f('0x3e')]);_0x121372[_0xd49f('0x3f')]=qs[_0xd49f('0x37')](_[_0xd49f('0x5b')](_0x539b1b[_0xd49f('0x36')],_0x4e11e1[_0xd49f('0x37')]));_0x121372[_0xd49f('0x3f')]=_[_0xd49f('0x41')](_0x121372[_0xd49f('0x3f')],{'$or':[{'ListId':_0x202a58['id']},{'ListId':null}]});if(_0x539b1b[_0xd49f('0x36')][_0xd49f('0x40')]){_0x121372[_0xd49f('0x3f')]=_[_0xd49f('0x41')](_0x121372[_0xd49f('0x3f')],{'$or':_['map'](_0x121372[_0xd49f('0x39')],function(_0x243aca){var _0x3b8c49={};_0x3b8c49[_0x243aca]={'$like':'%'+_0x539b1b[_0xd49f('0x36')]['filter']+'%'};return _0x3b8c49;})});}_0x121372=_[_0xd49f('0x41')]({},_0x121372,_0x539b1b[_0xd49f('0x43')]);return db[_0xd49f('0x65')][_0xd49f('0x91')](_0x121372);}})[_0xd49f('0x28')](respondWithResult(_0x42c2bc,null))[_0xd49f('0x46')](handleError(_0x42c2bc,null));};exports['getGlobalCustomFields']=function(_0x2eaba9,_0x5f020){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x5f020,null))[_0xd49f('0x28')](function(_0x47d395){return _0x47d395;})['then'](respondWithResult(_0x5f020,null))[_0xd49f('0x46')](handleError(_0x5f020,null));};exports[_0xd49f('0x92')]=function(_0x46afce,_0x26f127,_0x579103){return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x46afce[_0xd49f('0x54')]['id']}})[_0xd49f('0x28')](handleEntityNotFound(_0x26f127,null))[_0xd49f('0x28')](function(_0x5512cc){if(_0x5512cc){return _0x5512cc[_0xd49f('0x92')](_0x46afce[_0xd49f('0x4b')][_0xd49f('0x5c')],_[_0xd49f('0x62')](_0x46afce[_0xd49f('0x4b')],[_0xd49f('0x5c'),'id'])||{})['spread'](function(_0x178dae){for(var _0x2e6a5d=0x0;_0x2e6a5d<_0x46afce[_0xd49f('0x4b')][_0xd49f('0x5c')][_0xd49f('0x49')];_0x2e6a5d+=0x1){socket[_0xd49f('0x93')](_0xd49f('0x94'),{'UserId':Number(_0x46afce[_0xd49f('0x4b')][_0xd49f('0x5c')][_0x2e6a5d]),'CmListId':Number(_0x46afce[_0xd49f('0x54')]['id'])});}return _0x178dae;});}})[_0xd49f('0x28')](respondWithResult(_0x26f127,null))[_0xd49f('0x46')](handleError(_0x26f127,null));};exports[_0xd49f('0x95')]=function(_0x58d7c4,_0x46c8e6,_0x2aab69){return db[_0xd49f('0x31')][_0xd49f('0x4a')]({'where':{'id':_0x58d7c4[_0xd49f('0x54')]['id']}})['then'](handleEntityNotFound(_0x46c8e6,null))['then'](function(_0xd20b79){if(_0xd20b79){return _0xd20b79[_0xd49f('0x95')](_0x58d7c4[_0xd49f('0x36')][_0xd49f('0x5c')])[_0xd49f('0x28')](function(){if(_[_0xd49f('0x5e')](_0x58d7c4[_0xd49f('0x36')][_0xd49f('0x5c')])){for(var _0x249ae3=0x0;_0x249ae3<_0x58d7c4[_0xd49f('0x36')][_0xd49f('0x5c')][_0xd49f('0x49')];_0x249ae3+=0x1){socket[_0xd49f('0x93')](_0xd49f('0x96'),{'UserId':Number(_0x58d7c4['query'][_0xd49f('0x5c')][_0x249ae3]),'CmListId':Number(_0x58d7c4[_0xd49f('0x54')]['id'])});}}else{socket[_0xd49f('0x93')](_0xd49f('0x96'),{'UserId':Number(_0x58d7c4[_0xd49f('0x36')][_0xd49f('0x5c')]),'CmListId':Number(_0x58d7c4[_0xd49f('0x54')]['id'])});}});}})[_0xd49f('0x28')](respondWithStatusCode(_0x46c8e6,null))[_0xd49f('0x46')](handleError(_0x46c8e6,null));};exports[_0xd49f('0x97')]=function(_0x246545,_0x19aaed,_0x101038){var _0x38436e={};var _0x4e6858={};var _0x4aa036;var _0x2c147a;return db[_0xd49f('0x31')][_0xd49f('0x82')]({'where':{'id':_0x246545[_0xd49f('0x54')]['id']}})['then'](handleEntityNotFound(_0x19aaed,null))[_0xd49f('0x28')](function(_0x346286){if(_0x346286){_0x4aa036=_0x346286;_0x4e6858[_0xd49f('0x38')]=_['keys'](db[_0xd49f('0x98')][_0xd49f('0x32')]);_0x4e6858[_0xd49f('0x36')]=_[_0xd49f('0x48')](_0x246545[_0xd49f('0x36')]);_0x4e6858['filters']=_[_0xd49f('0x3a')](_0x4e6858[_0xd49f('0x38')],_0x4e6858[_0xd49f('0x36')]);_0x38436e[_0xd49f('0x39')]=_['intersection'](_0x4e6858[_0xd49f('0x38')],qs[_0xd49f('0x3b')](_0x246545[_0xd49f('0x36')][_0xd49f('0x3b')]));_0x38436e['attributes']=_0x38436e[_0xd49f('0x39')][_0xd49f('0x49')]?_0x38436e[_0xd49f('0x39')]:_0x4e6858[_0xd49f('0x38')];_0x38436e['order']=qs['sort'](_0x246545[_0xd49f('0x36')][_0xd49f('0x3e')]);_0x38436e['where']=qs['filters'](_[_0xd49f('0x5b')](_0x246545[_0xd49f('0x36')],_0x4e6858[_0xd49f('0x37')]));if(_0x246545[_0xd49f('0x36')][_0xd49f('0x40')]){_0x38436e['where']=_[_0xd49f('0x41')](_0x38436e[_0xd49f('0x3f')],{'$or':_[_0xd49f('0x30')](_0x38436e['attributes'],function(_0x104069){var _0x4af4cd={};_0x4af4cd[_0x104069]={'$like':'%'+_0x246545['query'][_0xd49f('0x40')]+'%'};return _0x4af4cd;})});}_0x38436e=_['merge']({},_0x38436e,_0x246545[_0xd49f('0x43')]);return _0x4aa036[_0xd49f('0x97')](_0x38436e);}})['then'](function(_0x1abe73){if(_0x1abe73){_0x2c147a=_0x1abe73[_0xd49f('0x49')];if(!_0x246545[_0xd49f('0x36')][_0xd49f('0x3c')](_0xd49f('0x5a'))){_0x38436e['limit']=qs[_0xd49f('0x20')](_0x246545[_0xd49f('0x36')][_0xd49f('0x20')]);_0x38436e['offset']=qs['offset'](_0x246545[_0xd49f('0x36')][_0xd49f('0x22')]);}return _0x4aa036[_0xd49f('0x97')](_0x38436e);}})['then'](function(_0x47c05a){if(_0x47c05a){return _0x47c05a?{'count':_0x2c147a,'rows':_0x47c05a}:null;}})[_0xd49f('0x28')](respondWithResult(_0x19aaed,null))[_0xd49f('0x46')](handleError(_0x19aaed,null));};function handleQuery(_0xa1be87){logger[_0xd49f('0x99')](_0xa1be87);return db[_0xd49f('0x83')][_0xd49f('0x36')](_0xa1be87)[_0xd49f('0x9a')](function(_0x3a911c){csv_results[_0xd49f('0x5f')](_0x3a911c);})[_0xd49f('0x46')](function(_0x38d200){logger[_0xd49f('0x2c')](_0x38d200[_0xd49f('0x9b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index fbddcbb..8ece38e 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x27ec2b,_0x5b9e78){_0x27ec2b=_0x27ec2b-0x0;var _0x1813d1=_0xe14b[_0x27ec2b];return _0x1813d1;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x5e34fe,_0x480b18){var _0x1a23e7=function(_0xb26641){while(--_0xb26641){_0x5e34fe['push'](_0x5e34fe['shift']());}};_0x1a23e7(++_0x480b18);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cff9a01..317bc41 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 _0x1339=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','CmList','cm_lists','../../config/logger','api'];(function(_0x58f073,_0x440c14){var _0x4d3a50=function(_0x22046a){while(--_0x22046a){_0x58f073['push'](_0x58f073['shift']());}};_0x4d3a50(++_0x440c14);}(_0x1339,0x1ed));var _0x9133=function(_0x8aaf4e,_0x54c96a){_0x8aaf4e=_0x8aaf4e-0x0;var _0x38f922=_0x1339[_0x8aaf4e];return _0x38f922;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var moment=require(_0x9133('0x2'));var BPromise=require(_0x9133('0x3'));var rp=require(_0x9133('0x4'));var fs=require('fs');var path=require(_0x9133('0x5'));var rimraf=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var attributes=require('./cmList.attributes');module[_0x9133('0x8')]=function(_0x855473,_0x379915){return _0x855473['define'](_0x9133('0x9'),attributes,{'tableName':_0x9133('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91a7=['bluebird','path','./cmList.attributes','exports','CmList','cm_lists','util','../../config/logger','api'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x91a7,0xe7));var _0x791a=function(_0x38cc8f,_0x54eee3){_0x38cc8f=_0x38cc8f-0x0;var _0x54433b=_0x91a7[_0x38cc8f];return _0x54433b;};'use strict';var _=require('lodash');var util=require(_0x791a('0x0'));var logger=require(_0x791a('0x1'))(_0x791a('0x2'));var moment=require('moment');var BPromise=require(_0x791a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x791a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x791a('0x5'));module[_0x791a('0x6')]=function(_0x49a9b7,_0x361f53){return _0x49a9b7['define'](_0x791a('0x7'),attributes,{'tableName':_0x791a('0x8'),'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 01036f7..821c296 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 _0xef40=['rpc','../../config/environment','client','defaults','redis','localhost','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x38011d,_0x58ae31){var _0x2a1682=function(_0x5f1e39){while(--_0x5f1e39){_0x38011d['push'](_0x38011d['shift']());}};_0x2a1682(++_0x58ae31);}(_0xef40,0x1e9));var _0x0ef4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xef40[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0ef4('0x0'));var util=require(_0x0ef4('0x1'));var moment=require(_0x0ef4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ef4('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ef4('0x4'))(_0x0ef4('0x5'));var config=require(_0x0ef4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0ef4('0x7')]['http']({'port':0x232a});config['redis']=_[_0x0ef4('0x8')](config[_0x0ef4('0x9')],{'host':_0x0ef4('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0ef4('0xb'))[_0x0ef4('0xc')](socket);function respondWithRpcPromise(_0x128706,_0xf4d5cf,_0x381ce4){return new BPromise(function(_0x2187d4,_0x52f979){return client[_0x0ef4('0xd')](_0x128706,_0x381ce4)[_0x0ef4('0xe')](function(_0x42bed){logger['info'](_0x0ef4('0xf'),_0xf4d5cf,_0x0ef4('0x10'));logger[_0x0ef4('0x11')](_0x0ef4('0x12'),_0xf4d5cf,'request\x20sent',JSON[_0x0ef4('0x13')](_0x42bed));if(_0x42bed[_0x0ef4('0x14')]){if(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x15')]===0x1f4){logger[_0x0ef4('0x14')]('CmList,\x20%s,\x20%s',_0xf4d5cf,_0x42bed['error'][_0x0ef4('0x16')]);return _0x52f979(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);}logger[_0x0ef4('0x14')]('CmList,\x20%s,\x20%s',_0xf4d5cf,_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);return _0x2187d4(_0x42bed[_0x0ef4('0x14')][_0x0ef4('0x16')]);}else{logger[_0x0ef4('0x17')](_0x0ef4('0xf'),_0xf4d5cf,_0x0ef4('0x10'));_0x2187d4(_0x42bed[_0x0ef4('0x18')][_0x0ef4('0x16')]);}})[_0x0ef4('0x19')](function(_0x5798ea){logger[_0x0ef4('0x14')](_0x0ef4('0xf'),_0xf4d5cf,_0x5798ea);_0x52f979(_0x5798ea);});});} \ No newline at end of file +var _0x50b5=['info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then'];(function(_0x426323,_0x2ce530){var _0xa347f6=function(_0x267c9f){while(--_0x267c9f){_0x426323['push'](_0x426323['shift']());}};_0xa347f6(++_0x2ce530);}(_0x50b5,0x183));var _0x550b=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x50b5[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0x550b('0x0'));var util=require(_0x550b('0x1'));var moment=require(_0x550b('0x2'));var BPromise=require('bluebird');var rs=require(_0x550b('0x3'));var fs=require('fs');var Redis=require(_0x550b('0x4'));var db=require(_0x550b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x550b('0x6'))('rpc');var config=require(_0x550b('0x7'));var jayson=require(_0x550b('0x8'));var client=jayson['client'][_0x550b('0x9')]({'port':0x232a});config[_0x550b('0xa')]=_[_0x550b('0xb')](config[_0x550b('0xa')],{'host':_0x550b('0xc'),'port':0x18eb});var socket=require(_0x550b('0xd'))(new Redis(config[_0x550b('0xa')]));require(_0x550b('0xe'))[_0x550b('0xf')](socket);function respondWithRpcPromise(_0x57f64f,_0x2223bf,_0xcacd69){return new BPromise(function(_0x58b974,_0x486e00){return client[_0x550b('0x10')](_0x57f64f,_0xcacd69)[_0x550b('0x11')](function(_0x46b14f){logger[_0x550b('0x12')](_0x550b('0x13'),_0x2223bf,'request\x20sent');logger['debug'](_0x550b('0x14'),_0x2223bf,'request\x20sent',JSON['stringify'](_0x46b14f));if(_0x46b14f[_0x550b('0x15')]){if(_0x46b14f[_0x550b('0x15')][_0x550b('0x16')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x2223bf,_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);return _0x486e00(_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);}logger['error'](_0x550b('0x13'),_0x2223bf,_0x46b14f[_0x550b('0x15')]['message']);return _0x58b974(_0x46b14f[_0x550b('0x15')][_0x550b('0x17')]);}else{logger[_0x550b('0x12')](_0x550b('0x13'),_0x2223bf,_0x550b('0x18'));_0x58b974(_0x46b14f[_0x550b('0x19')]['message']);}})[_0x550b('0x1a')](function(_0x536d7f){logger['error']('CmList,\x20%s,\x20%s',_0x2223bf,_0x536d7f);_0x486e00(_0x536d7f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 490cf55..9c409b4 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 _0x3a5c=['removeListener','length','cmList:','./cmList.events','save','remove','update','emit'];(function(_0x4179e2,_0xf2dbb){var _0x24cb50=function(_0x3b7899){while(--_0x3b7899){_0x4179e2['push'](_0x4179e2['shift']());}};_0x24cb50(++_0xf2dbb);}(_0x3a5c,0x15b));var _0xc3a5=function(_0x537d53,_0x26d1f0){_0x537d53=_0x537d53-0x0;var _0x1b1faa=_0x3a5c[_0x537d53];return _0x1b1faa;};'use strict';var CmListEvents=require(_0xc3a5('0x0'));var events=[_0xc3a5('0x1'),_0xc3a5('0x2'),_0xc3a5('0x3')];function createListener(_0x6e7847,_0x353d48){return function(_0x36f236){_0x353d48[_0xc3a5('0x4')](_0x6e7847,_0x36f236);};}function removeListener(_0x10cb4f,_0x2371db){return function(){CmListEvents[_0xc3a5('0x5')](_0x10cb4f,_0x2371db);};}exports['register']=function(_0x3ff729){for(var _0x117d4a=0x0,_0x4d9537=events[_0xc3a5('0x6')];_0x117d4a<_0x4d9537;_0x117d4a++){var _0x3ad886=events[_0x117d4a];var _0x127208=createListener(_0xc3a5('0x7')+_0x3ad886,_0x3ff729);CmListEvents['on'](_0x3ad886,_0x127208);}}; \ No newline at end of file +var _0xfcda=['./cmList.events','save','update','removeListener','length','cmList:'];(function(_0x1b922e,_0x4d98f3){var _0xf86ca2=function(_0x4267fd){while(--_0x4267fd){_0x1b922e['push'](_0x1b922e['shift']());}};_0xf86ca2(++_0x4d98f3);}(_0xfcda,0x132));var _0xafcd=function(_0x3fec75,_0x523d63){_0x3fec75=_0x3fec75-0x0;var _0x1dc06=_0xfcda[_0x3fec75];return _0x1dc06;};'use strict';var CmListEvents=require(_0xafcd('0x0'));var events=[_0xafcd('0x1'),'remove',_0xafcd('0x2')];function createListener(_0x27acc6,_0x29784f){return function(_0x3b6e53){_0x29784f['emit'](_0x27acc6,_0x3b6e53);};}function removeListener(_0x1c8f9a,_0x42e7e8){return function(){CmListEvents[_0xafcd('0x3')](_0x1c8f9a,_0x42e7e8);};}exports['register']=function(_0x330371){for(var _0x158056=0x0,_0xe18fb2=events[_0xafcd('0x4')];_0x158056<_0xe18fb2;_0x158056++){var _0x51fe34=events[_0x158056];var _0x542f8a=createListener(_0xafcd('0x5')+_0x51fe34,_0x330371);CmListEvents['on'](_0x51fe34,_0x542f8a);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5956c63..cbc4b16 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 _0x2318=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','describe','/global_fields','get','/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','/:id/fields','/:id/users','post','addDisposition','/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout'];(function(_0x5d1594,_0x105585){var _0x5c4153=function(_0x19ea52){while(--_0x19ea52){_0x5d1594['push'](_0x5d1594['shift']());}};_0x5c4153(++_0x105585);}(_0x2318,0x115));var _0x8231=function(_0x44449d,_0x28c540){_0x44449d=_0x44449d-0x0;var _0x59e01d=_0x2318[_0x44449d];return _0x59e01d;};'use strict';var multer=require('multer');var util=require(_0x8231('0x0'));var path=require(_0x8231('0x1'));var timeout=require(_0x8231('0x2'));var express=require('express');var router=express[_0x8231('0x3')]();var fs_extra=require(_0x8231('0x4'));var auth=require(_0x8231('0x5'));var interaction=require(_0x8231('0x6'));var config=require(_0x8231('0x7'));var controller=require(_0x8231('0x8'));router['get']('/',auth[_0x8231('0x9')](),controller[_0x8231('0xa')]);router['get']('/describe',auth[_0x8231('0x9')](),controller[_0x8231('0xb')]);router['get'](_0x8231('0xc'),auth[_0x8231('0x9')](),controller['getGlobalCustomFields']);router[_0x8231('0xd')](_0x8231('0xe'),auth[_0x8231('0x9')](),controller[_0x8231('0xf')]);router['get'](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x11')]);router[_0x8231('0xd')]('/:id/contacts',auth[_0x8231('0x9')](),controller[_0x8231('0x12')]);router[_0x8231('0xd')](_0x8231('0x13'),auth[_0x8231('0x9')](),controller['getContactsCsv']);router[_0x8231('0xd')](_0x8231('0x14'),auth[_0x8231('0x9')](),controller['getCustomFields']);router[_0x8231('0xd')](_0x8231('0x15'),auth[_0x8231('0x9')](),controller['getAgents']);router[_0x8231('0x16')]('/',auth[_0x8231('0x9')](),controller['create']);router[_0x8231('0x16')](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x17')]);router[_0x8231('0x16')](_0x8231('0x18'),auth[_0x8231('0x9')](),controller[_0x8231('0x19')]);router[_0x8231('0x16')](_0x8231('0x14'),auth[_0x8231('0x9')](),controller[_0x8231('0x1a')]);router[_0x8231('0x16')](_0x8231('0x15'),auth['isAuthenticated'](),controller[_0x8231('0x1b')]);router[_0x8231('0x1c')]('/:id',auth[_0x8231('0x9')](),controller[_0x8231('0x1d')]);router[_0x8231('0x1e')](_0x8231('0xe'),auth[_0x8231('0x9')](),controller[_0x8231('0x1f')]);router['delete'](_0x8231('0x10'),auth[_0x8231('0x9')](),controller[_0x8231('0x20')]);router[_0x8231('0x1e')](_0x8231('0x15'),auth['isAuthenticated'](),controller[_0x8231('0x21')]);module[_0x8231('0x22')]=router; \ No newline at end of file +var _0x142b=['/:id/fields','addCustomField','/:id/users','addAgents','put','/:id','delete','removeDispositions','removeAgents','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','getContacts','getContactsCsv','getCustomFields','post','addDisposition','/:id/contacts','addContacts'];(function(_0x2bd1bb,_0x235734){var _0x5511e7=function(_0x2e0b7e){while(--_0x2e0b7e){_0x2bd1bb['push'](_0x2bd1bb['shift']());}};_0x5511e7(++_0x235734);}(_0x142b,0x1bb));var _0xb142=function(_0x32244f,_0x38b793){_0x32244f=_0x32244f-0x0;var _0x408c15=_0x142b[_0x32244f];return _0x408c15;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb142('0x0'));var router=express[_0xb142('0x1')]();var fs_extra=require(_0xb142('0x2'));var auth=require(_0xb142('0x3'));var interaction=require(_0xb142('0x4'));var config=require('../../config/environment');var controller=require(_0xb142('0x5'));router[_0xb142('0x6')]('/',auth[_0xb142('0x7')](),controller[_0xb142('0x8')]);router['get']('/describe',auth[_0xb142('0x7')](),controller[_0xb142('0x9')]);router['get'](_0xb142('0xa'),auth[_0xb142('0x7')](),controller[_0xb142('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb142('0xc')]);router[_0xb142('0x6')](_0xb142('0xd'),auth['isAuthenticated'](),controller[_0xb142('0xe')]);router['get']('/:id/contacts',auth['isAuthenticated'](),controller[_0xb142('0xf')]);router[_0xb142('0x6')]('/:id/contacts/csv',auth[_0xb142('0x7')](),controller[_0xb142('0x10')]);router[_0xb142('0x6')]('/:id/fields',auth[_0xb142('0x7')](),controller[_0xb142('0x11')]);router[_0xb142('0x6')]('/:id/users',auth[_0xb142('0x7')](),controller['getAgents']);router[_0xb142('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xb142('0xd'),auth[_0xb142('0x7')](),controller[_0xb142('0x13')]);router['post'](_0xb142('0x14'),auth[_0xb142('0x7')](),controller[_0xb142('0x15')]);router[_0xb142('0x12')](_0xb142('0x16'),auth[_0xb142('0x7')](),controller[_0xb142('0x17')]);router[_0xb142('0x12')](_0xb142('0x18'),auth['isAuthenticated'](),controller[_0xb142('0x19')]);router[_0xb142('0x1a')](_0xb142('0x1b'),auth[_0xb142('0x7')](),controller['update']);router['delete']('/:id',auth[_0xb142('0x7')](),controller['destroy']);router[_0xb142('0x1c')](_0xb142('0xd'),auth[_0xb142('0x7')](),controller[_0xb142('0x1d')]);router[_0xb142('0x1c')](_0xb142('0x18'),auth[_0xb142('0x7')](),controller[_0xb142('0x1e')]);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 292d9f9..fe0e093 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 _0x42b4=['field','STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x30946c,_0x17d8b0){var _0x2dfd1e=function(_0x20c099){while(--_0x20c099){_0x30946c['push'](_0x30946c['shift']());}};_0x2dfd1e(++_0x17d8b0);}(_0x42b4,0xbc));var _0x442b=function(_0x3c8e5b,_0x5e9f1b){_0x3c8e5b=_0x3c8e5b-0x0;var _0x456e2c=_0x42b4[_0x3c8e5b];return _0x456e2c;};'use strict';var Sequelize=require(_0x442b('0x0'));module[_0x442b('0x1')]={'name':{'type':Sequelize[_0x442b('0x2')],'get':function(_0x1bc869){return this[_0x442b('0x3')](_0x442b('0x4'));}},'field':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x442b('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x0ad6=['getDataValue','field','STRING','sequelize'];(function(_0x28c1ef,_0x32a5f0){var _0x2dfacf=function(_0x42b735){while(--_0x42b735){_0x28c1ef['push'](_0x28c1ef['shift']());}};_0x2dfacf(++_0x32a5f0);}(_0x0ad6,0x1b3));var _0x60ad=function(_0x49fcf2,_0x5a1e96){_0x49fcf2=_0x49fcf2-0x0;var _0xb80db3=_0x0ad6[_0x49fcf2];return _0xb80db3;};'use strict';var Sequelize=require(_0x60ad('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x4b4b15){return this[_0x60ad('0x1')](_0x60ad('0x2'));}},'field':{'type':Sequelize[_0x60ad('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x60ad('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x60ad('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 305d689..02f2c21 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(_0xe0edbe,_0x1a084e){var _0xe399f9=function(_0x3b3f80){while(--_0x3b3f80){_0xe0edbe['push'](_0xe0edbe['shift']());}};_0xe399f9(++_0x1a084e);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +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(_0x4efea0,_0x46893b){var _0x2bd7b2=function(_0x43c583){while(--_0x43c583){_0x4efea0['push'](_0x4efea0['shift']());}};_0x2bd7b2(++_0x46893b);}(_0x7a54,0x106));var _0x47a5=function(_0x4af863,_0x45a1d3){_0x4af863=_0x4af863-0x0;var _0x413d69=_0x7a54[_0x4af863];return _0x413d69;};'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 93e80bd..4c0778b 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 _0x8bdc=['tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Condition'];(function(_0x939d1f,_0x14c16c){var _0x19642c=function(_0x538397){while(--_0x538397){_0x939d1f['push'](_0x939d1f['shift']());}};_0x19642c(++_0x14c16c);}(_0x8bdc,0x189));var _0xc8bd=function(_0x585c06,_0x29d659){_0x585c06=_0x585c06-0x0;var _0x39b8e4=_0x8bdc[_0x585c06];return _0x39b8e4;};'use strict';var _=require(_0xc8bd('0x0'));var util=require(_0xc8bd('0x1'));var logger=require(_0xc8bd('0x2'))(_0xc8bd('0x3'));var moment=require(_0xc8bd('0x4'));var BPromise=require(_0xc8bd('0x5'));var rp=require(_0xc8bd('0x6'));var fs=require('fs');var path=require(_0xc8bd('0x7'));var rimraf=require(_0xc8bd('0x8'));var config=require(_0xc8bd('0x9'));var attributes=require('./condition.attributes');module[_0xc8bd('0xa')]=function(_0x4846ae,_0x4a01c0){return _0x4846ae[_0xc8bd('0xb')](_0xc8bd('0xc'),attributes,{'tableName':_0xc8bd('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71aa=['rimraf','../../config/environment','define','Condition','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2c4dc4,_0x51c6c6){var _0x118c6b=function(_0xcdb619){while(--_0xcdb619){_0x2c4dc4['push'](_0x2c4dc4['shift']());}};_0x118c6b(++_0x51c6c6);}(_0x71aa,0x162));var _0xa71a=function(_0x3c5312,_0x2470bb){_0x3c5312=_0x3c5312-0x0;var _0x36f59b=_0x71aa[_0x3c5312];return _0x36f59b;};'use strict';var _=require(_0xa71a('0x0'));var util=require(_0xa71a('0x1'));var logger=require(_0xa71a('0x2'))(_0xa71a('0x3'));var moment=require('moment');var BPromise=require(_0xa71a('0x4'));var rp=require(_0xa71a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa71a('0x6'));var config=require(_0xa71a('0x7'));var attributes=require('./condition.attributes');module['exports']=function(_0x31242b,_0xfc2a81){return _0x31242b[_0xa71a('0x8')](_0xa71a('0x9'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 1617f0a..e1ee572 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 _0x69a5=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x571c83,_0x4c97dc){var _0x2b8bd2=function(_0x1401a1){while(--_0x1401a1){_0x571c83['push'](_0x571c83['shift']());}};_0x2b8bd2(++_0x4c97dc);}(_0x69a5,0x16b));var _0x569a=function(_0x85efc8,_0x4249e7){_0x85efc8=_0x85efc8-0x0;var _0x7e529=_0x69a5[_0x85efc8];return _0x7e529;};'use strict';var _=require(_0x569a('0x0'));var util=require(_0x569a('0x1'));var moment=require('moment');var BPromise=require(_0x569a('0x2'));var rs=require(_0x569a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x569a('0x4'));var logger=require('../../config/logger')(_0x569a('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x569a('0x6')][_0x569a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e3a61,_0x32dc39,_0x2ed8d6){return new BPromise(function(_0x1a4ffb,_0x4ced83){return client[_0x569a('0x8')](_0x4e3a61,_0x2ed8d6)[_0x569a('0x9')](function(_0x465c59){logger[_0x569a('0xa')](_0x569a('0xb'),_0x32dc39,_0x569a('0xc'));logger[_0x569a('0xd')](_0x569a('0xe'),_0x32dc39,_0x569a('0xc'),JSON[_0x569a('0xf')](_0x465c59));if(_0x465c59['error']){if(_0x465c59[_0x569a('0x10')][_0x569a('0x11')]===0x1f4){logger[_0x569a('0x10')](_0x569a('0xb'),_0x32dc39,_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);return _0x4ced83(_0x465c59['error']['message']);}logger['error'](_0x569a('0xb'),_0x32dc39,_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);return _0x1a4ffb(_0x465c59[_0x569a('0x10')][_0x569a('0x12')]);}else{logger[_0x569a('0xa')](_0x569a('0xb'),_0x32dc39,'request\x20sent');_0x1a4ffb(_0x465c59[_0x569a('0x13')][_0x569a('0x12')]);}})[_0x569a('0x14')](function(_0x554d74){logger[_0x569a('0x10')](_0x569a('0xb'),_0x32dc39,_0x554d74);_0x4ced83(_0x554d74);});});} \ No newline at end of file +var _0x8708=['request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s'];(function(_0x1c34e7,_0x33f9a8){var _0x378cb1=function(_0x10b5e3){while(--_0x10b5e3){_0x1c34e7['push'](_0x1c34e7['shift']());}};_0x378cb1(++_0x33f9a8);}(_0x8708,0x104));var _0x8870=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x8708[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x8870('0x0'));var util=require(_0x8870('0x1'));var moment=require(_0x8870('0x2'));var BPromise=require(_0x8870('0x3'));var rs=require(_0x8870('0x4'));var fs=require('fs');var Redis=require(_0x8870('0x5'));var db=require(_0x8870('0x6'))['db'];var utils=require(_0x8870('0x7'));var logger=require(_0x8870('0x8'))('rpc');var config=require(_0x8870('0x9'));var jayson=require(_0x8870('0xa'));var client=jayson[_0x8870('0xb')][_0x8870('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5df7e7,_0x46cf5c,_0x2cbaa6){return new BPromise(function(_0x3c63f9,_0x3b71db){return client['request'](_0x5df7e7,_0x2cbaa6)[_0x8870('0xd')](function(_0x3a0c91){logger[_0x8870('0xe')](_0x8870('0xf'),_0x46cf5c,_0x8870('0x10'));logger[_0x8870('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x46cf5c,'request\x20sent',JSON[_0x8870('0x12')](_0x3a0c91));if(_0x3a0c91['error']){if(_0x3a0c91[_0x8870('0x13')][_0x8870('0x14')]===0x1f4){logger['error'](_0x8870('0xf'),_0x46cf5c,_0x3a0c91[_0x8870('0x13')]['message']);return _0x3b71db(_0x3a0c91['error']['message']);}logger['error'](_0x8870('0xf'),_0x46cf5c,_0x3a0c91[_0x8870('0x13')]['message']);return _0x3c63f9(_0x3a0c91['error'][_0x8870('0x15')]);}else{logger[_0x8870('0xe')](_0x8870('0xf'),_0x46cf5c,_0x8870('0x10'));_0x3c63f9(_0x3a0c91['result']['message']);}})[_0x8870('0x16')](function(_0x5c3a76){logger[_0x8870('0x13')](_0x8870('0xf'),_0x46cf5c,_0x5c3a76);_0x3b71db(_0x5c3a76);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 2504634..0de7212 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 _0xc315=['path','express','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x314a8c,_0x1c2e8d){var _0x1d4607=function(_0x3df20c){while(--_0x3df20c){_0x314a8c['push'](_0x314a8c['shift']());}};_0x1d4607(++_0x1c2e8d);}(_0xc315,0x15d));var _0x5c31=function(_0xa64f60,_0x303c02){_0xa64f60=_0xa64f60-0x0;var _0x5be127=_0xc315[_0xa64f60];return _0x5be127;};'use strict';var multer=require(_0x5c31('0x0'));var util=require('util');var path=require(_0x5c31('0x1'));var timeout=require('connect-timeout');var express=require(_0x5c31('0x2'));var router=express['Router']();var fs_extra=require(_0x5c31('0x3'));var auth=require(_0x5c31('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5c31('0x5'));var controller=require(_0x5c31('0x6'));router[_0x5c31('0x7')](_0x5c31('0x8'),auth[_0x5c31('0x9')](),controller[_0x5c31('0xa')]);router[_0x5c31('0xb')](_0x5c31('0x8'),auth[_0x5c31('0x9')](),controller[_0x5c31('0xc')]);module[_0x5c31('0xd')]=router; \ No newline at end of file +var _0x6b7b=['delete','/:id','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','put','isAuthenticated','update'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0x6b7b,0xdc));var _0xb6b7=function(_0x230532,_0x52bbe9){_0x230532=_0x230532-0x0;var _0x5b3c4b=_0x6b7b[_0x230532];return _0x5b3c4b;};'use strict';var multer=require('multer');var util=require(_0xb6b7('0x0'));var path=require(_0xb6b7('0x1'));var timeout=require(_0xb6b7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb6b7('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb6b7('0x4'));var controller=require('./condition.controller');router[_0xb6b7('0x5')]('/:id',auth[_0xb6b7('0x6')](),controller[_0xb6b7('0x7')]);router[_0xb6b7('0x8')](_0xb6b7('0x9'),auth[_0xb6b7('0x6')](),controller[_0xb6b7('0xa')]);module[_0xb6b7('0xb')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 423e35a..a49a21f 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbe39=['name','STRING'];(function(_0x2dbc98,_0x10a06f){var _0x538f04=function(_0x1d9235){while(--_0x1d9235){_0x2dbc98['push'](_0x2dbc98['shift']());}};_0x538f04(++_0x10a06f);}(_0xbe39,0x145));var _0x9be3=function(_0x473c55,_0x323b87){_0x473c55=_0x473c55-0x0;var _0x222e74=_0xbe39[_0x473c55];return _0x222e74;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9be3('0x0')],'allowNull':![],'unique':_0x9be3('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9be3('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x37b4=['exports','name','INTEGER','STRING'];(function(_0x170bb1,_0x3b6db3){var _0x22507e=function(_0x12cd2e){while(--_0x12cd2e){_0x170bb1['push'](_0x170bb1['shift']());}};_0x22507e(++_0x3b6db3);}(_0x37b4,0xec));var _0x437b=function(_0x4dbba7,_0x34d6d1){_0x4dbba7=_0x4dbba7-0x0;var _0x43ef83=_0x37b4[_0x4dbba7];return _0x43ef83;};'use strict';var Sequelize=require('sequelize');module[_0x437b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x437b('0x1')},'OrderBy':{'type':Sequelize[_0x437b('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x437b('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index acb4e2a..53c74ac 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x32f4=['Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','end','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','nolimit','limit','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','keys','length','merge','options','find','create'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x32f4,0x154));var _0x432f=function(_0x52c1b9,_0x175a00){_0x52c1b9=_0x52c1b9-0x0;var _0x2b356=_0x32f4[_0x52c1b9];return _0x2b356;};'use strict';var emlformat=require(_0x432f('0x0'));var rimraf=require(_0x432f('0x1'));var zipdir=require(_0x432f('0x2'));var jsonpatch=require(_0x432f('0x3'));var rp=require('request-promise');var moment=require(_0x432f('0x4'));var BPromise=require(_0x432f('0x5'));var Mustache=require('mustache');var util=require(_0x432f('0x6'));var path=require(_0x432f('0x7'));var sox=require(_0x432f('0x8'));var csv=require(_0x432f('0x9'));var ejs=require(_0x432f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x432f('0xb'));var crypto=require(_0x432f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x432f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x432f('0xe'));var Papa=require(_0x432f('0xf'));var Redis=require(_0x432f('0x10'));var authService=require(_0x432f('0x11'));var qs=require(_0x432f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x432f('0x13'));var logger=require('../../config/logger')(_0x432f('0x14'));var utils=require('../../config/utils');var config=require(_0x432f('0x15'));var licenseUtil=require(_0x432f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x457389,_0x29f7d2){_0x29f7d2=_0x29f7d2||0xcc;return function(_0x52e40f){if(_0x52e40f){return _0x457389[_0x432f('0x17')](_0x29f7d2);}return _0x457389[_0x432f('0x18')](_0x29f7d2)['end']();};}function respondWithResult(_0x48a4db,_0x28d9e9){_0x28d9e9=_0x28d9e9||0xc8;return function(_0x44756d){if(_0x44756d){return _0x48a4db[_0x432f('0x18')](_0x28d9e9)[_0x432f('0x19')](_0x44756d);}};}function respondWithFilteredResult(_0x419bfe,_0x4f91c5){return function(_0x175ba7){if(_0x175ba7){var _0x2f0708=typeof _0x4f91c5[_0x432f('0x1a')]===_0x432f('0x1b')&&typeof _0x4f91c5['limit']===_0x432f('0x1b');var _0x30f231=_0x175ba7[_0x432f('0x1c')];var _0x243cf=_0x2f0708?0x0:_0x4f91c5[_0x432f('0x1a')];var _0x129582=_0x2f0708?_0x175ba7['count']:_0x4f91c5[_0x432f('0x1a')]+_0x4f91c5['limit'];var _0x3d545d;if(_0x129582>=_0x30f231){_0x129582=_0x30f231;_0x3d545d=0xc8;}else{_0x3d545d=0xce;}_0x419bfe[_0x432f('0x18')](_0x3d545d);return _0x419bfe[_0x432f('0x1d')](_0x432f('0x1e'),_0x243cf+'-'+_0x129582+'/'+_0x30f231)[_0x432f('0x19')](_0x175ba7);}return null;};}function patchUpdates(_0xf1f5d){return function(_0x10f39b){try{jsonpatch[_0x432f('0x1f')](_0x10f39b,_0xf1f5d,!![]);}catch(_0x693eb3){return BPromise[_0x432f('0x20')](_0x693eb3);}return _0x10f39b[_0x432f('0x21')]();};}function saveUpdates(_0x3446fd,_0x4dd230){return function(_0x5940bd){if(_0x5940bd){return _0x5940bd[_0x432f('0x22')](_0x3446fd)['then'](function(_0x28968e){return _0x28968e;});}return null;};}function removeEntity(_0x5b9c70,_0x37f136){return function(_0x175d1b){if(_0x175d1b){return _0x175d1b[_0x432f('0x23')]()[_0x432f('0x24')](function(){var _0x2f84a7=_0x175d1b[_0x432f('0x25')]({'plain':!![]});var _0x59f352=_0x432f('0x26');return db[_0x432f('0x27')]['destroy']({'where':{'type':_0x59f352,'resourceId':_0x2f84a7['id']}})[_0x432f('0x24')](function(){return _0x175d1b;});})[_0x432f('0x24')](function(){_0x5b9c70[_0x432f('0x18')](0xcc)[_0x432f('0x28')]();});}};}function handleEntityNotFound(_0x44839,_0x781862){return function(_0x138a6a){if(!_0x138a6a){_0x44839['sendStatus'](0x194);}return _0x138a6a;};}function handleError(_0x294bfe,_0x4eeae1){_0x4eeae1=_0x4eeae1||0x1f4;return function(_0x1f1fdd){logger['error'](_0x1f1fdd[_0x432f('0x29')]);if(_0x1f1fdd['name']){delete _0x1f1fdd[_0x432f('0x2a')];}_0x294bfe['status'](_0x4eeae1)[_0x432f('0x2b')](_0x1f1fdd);};}exports[_0x432f('0x2c')]=function(_0x263cd8,_0x59c1ab){var _0x6a116e={},_0x24406a={},_0x48139b={'count':0x0,'rows':[]};var _0x5ee0fa=_[_0x432f('0x2d')](db[_0x432f('0x2e')][_0x432f('0x2f')],function(_0x3581c2){return{'name':_0x3581c2[_0x432f('0x30')],'type':_0x3581c2[_0x432f('0x31')]['key']};});_0x24406a['model']=_[_0x432f('0x2d')](_0x5ee0fa,_0x432f('0x2a'));_0x24406a[_0x432f('0x32')]=_['keys'](_0x263cd8[_0x432f('0x32')]);_0x24406a[_0x432f('0x33')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],_0x24406a[_0x432f('0x32')]);_0x6a116e[_0x432f('0x36')]=_[_0x432f('0x34')](_0x24406a[_0x432f('0x35')],qs['fields'](_0x263cd8['query'][_0x432f('0x37')]));_0x6a116e[_0x432f('0x36')]=_0x6a116e['attributes']['length']?_0x6a116e['attributes']:_0x24406a[_0x432f('0x35')];if(!_0x263cd8[_0x432f('0x32')]['hasOwnProperty'](_0x432f('0x38'))){_0x6a116e[_0x432f('0x39')]=qs[_0x432f('0x39')](_0x263cd8['query'][_0x432f('0x39')]);_0x6a116e[_0x432f('0x1a')]=qs['offset'](_0x263cd8[_0x432f('0x32')][_0x432f('0x1a')]);}_0x6a116e['order']=qs[_0x432f('0x3a')](_0x263cd8[_0x432f('0x32')][_0x432f('0x3a')]);_0x6a116e[_0x432f('0x3b')]=qs[_0x432f('0x33')](_[_0x432f('0x3c')](_0x263cd8[_0x432f('0x32')],_0x24406a[_0x432f('0x33')]),_0x5ee0fa);if(_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]){_0x6a116e[_0x432f('0x3b')]=_['merge'](_0x6a116e[_0x432f('0x3b')],{'$or':_['map'](_0x5ee0fa,function(_0x1550fc){if(_0x1550fc[_0x432f('0x31')]!=='VIRTUAL'){var _0x43d836={};_0x43d836[_0x1550fc['name']]={'$like':'%'+_0x263cd8[_0x432f('0x32')][_0x432f('0x3d')]+'%'};return _0x43d836;}})});}_0x6a116e=_['merge']({},_0x6a116e,_0x263cd8['options']);var _0xbd4240={'where':_0x6a116e[_0x432f('0x3b')]};return db[_0x432f('0x2e')][_0x432f('0x1c')](_0xbd4240)[_0x432f('0x24')](function(_0x513a57){_0x48139b['count']=_0x513a57;if(_0x263cd8['query'][_0x432f('0x3e')]){_0x6a116e[_0x432f('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x432f('0x40')](_0x6a116e);})[_0x432f('0x24')](function(_0x41c90c){_0x48139b[_0x432f('0x41')]=_0x41c90c;return _0x48139b;})[_0x432f('0x24')](respondWithFilteredResult(_0x59c1ab,_0x6a116e))[_0x432f('0x42')](handleError(_0x59c1ab,null));};exports[_0x432f('0x43')]=function(_0x1a2be2,_0x1c5f87){var _0x5c6298={'raw':!![],'where':{'id':_0x1a2be2[_0x432f('0x44')]['id']}},_0x247b63={};_0x247b63['model']=_[_0x432f('0x45')](db[_0x432f('0x2e')][_0x432f('0x2f')]);_0x247b63[_0x432f('0x32')]=_[_0x432f('0x45')](_0x1a2be2[_0x432f('0x32')]);_0x247b63[_0x432f('0x33')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],_0x247b63[_0x432f('0x32')]);_0x5c6298[_0x432f('0x36')]=_[_0x432f('0x34')](_0x247b63[_0x432f('0x35')],qs[_0x432f('0x37')](_0x1a2be2['query']['fields']));_0x5c6298[_0x432f('0x36')]=_0x5c6298[_0x432f('0x36')][_0x432f('0x46')]?_0x5c6298[_0x432f('0x36')]:_0x247b63[_0x432f('0x35')];if(_0x1a2be2['query'][_0x432f('0x3e')]){_0x5c6298[_0x432f('0x3f')]=[{'all':!![]}];}_0x5c6298=_[_0x432f('0x47')]({},_0x5c6298,_0x1a2be2[_0x432f('0x48')]);return db[_0x432f('0x2e')][_0x432f('0x49')](_0x5c6298)[_0x432f('0x24')](handleEntityNotFound(_0x1c5f87,null))['then'](respondWithResult(_0x1c5f87,null))[_0x432f('0x42')](handleError(_0x1c5f87,null));};exports[_0x432f('0x4a')]=function(_0x359853,_0x547bd0){return db[_0x432f('0x2e')][_0x432f('0x4a')](_0x359853['body'],{})['then'](function(_0x3b2021){var _0x24f244=_0x359853['user']['get']({'plain':!![]});if(!_0x24f244)throw new Error(_0x432f('0x4b'));if(_0x24f244['role']===_0x432f('0x4c')){var _0x66b80e=_0x3b2021['get']({'plain':!![]});var _0x12f2f7='ContactItemTypes';return db[_0x432f('0x4d')][_0x432f('0x49')]({'where':{'name':_0x12f2f7,'userProfileId':_0x24f244[_0x432f('0x4e')]},'raw':!![]})[_0x432f('0x24')](function(_0x3051ea){if(_0x3051ea&&_0x3051ea[_0x432f('0x4f')]===0x0){return db['UserProfileResource'][_0x432f('0x4a')]({'name':_0x66b80e['name'],'resourceId':_0x66b80e['id'],'type':_0x3051ea[_0x432f('0x2a')],'sectionId':_0x3051ea['id']},{})[_0x432f('0x24')](function(){return _0x3b2021;});}else{return _0x3b2021;}})[_0x432f('0x42')](function(_0x21ae8c){logger['error'](_0x432f('0x50'),_0x21ae8c);throw _0x21ae8c;});}return _0x3b2021;})[_0x432f('0x24')](respondWithResult(_0x547bd0,0xc9))[_0x432f('0x42')](handleError(_0x547bd0,null));};exports[_0x432f('0x22')]=function(_0x13aced,_0x2a26bd){if(_0x13aced[_0x432f('0x51')]['id']){delete _0x13aced['body']['id'];}return db['ContactItemType'][_0x432f('0x49')]({'where':{'id':_0x13aced[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x2a26bd,null))[_0x432f('0x24')](saveUpdates(_0x13aced[_0x432f('0x51')],null))[_0x432f('0x24')](respondWithResult(_0x2a26bd,null))['catch'](handleError(_0x2a26bd,null));};exports[_0x432f('0x23')]=function(_0x545035,_0x4e96d8){return db[_0x432f('0x2e')][_0x432f('0x49')]({'where':{'id':_0x545035[_0x432f('0x44')]['id']}})[_0x432f('0x24')](handleEntityNotFound(_0x4e96d8,null))[_0x432f('0x24')](db[_0x432f('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x545035[_0x432f('0x44')]['id']}}))[_0x432f('0x24')](removeEntity(_0x4e96d8,null))['catch'](handleError(_0x4e96d8,null));}; \ No newline at end of file +var _0x6a95=['get','ContactItemTypes','error','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','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','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy'];(function(_0x493a10,_0x2755cb){var _0x509fff=function(_0x2e655c){while(--_0x2e655c){_0x493a10['push'](_0x493a10['shift']());}};_0x509fff(++_0x2755cb);}(_0x6a95,0x1db));var _0x56a9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x6a95[_0x32d457];return _0x338386;};'use strict';var emlformat=require(_0x56a9('0x0'));var rimraf=require(_0x56a9('0x1'));var zipdir=require(_0x56a9('0x2'));var jsonpatch=require(_0x56a9('0x3'));var rp=require(_0x56a9('0x4'));var moment=require(_0x56a9('0x5'));var BPromise=require(_0x56a9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x56a9('0x7'));var sox=require(_0x56a9('0x8'));var csv=require(_0x56a9('0x9'));var ejs=require(_0x56a9('0xa'));var fs=require('fs');var fs_extra=require(_0x56a9('0xb'));var _=require(_0x56a9('0xc'));var squel=require(_0x56a9('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x56a9('0xe'));var toCsv=require(_0x56a9('0x9'));var querystring=require('querystring');var Papa=require(_0x56a9('0xf'));var Redis=require(_0x56a9('0x10'));var authService=require(_0x56a9('0x11'));var qs=require(_0x56a9('0x12'));var as=require(_0x56a9('0x13'));var hardwareService=require(_0x56a9('0x14'));var logger=require(_0x56a9('0x15'))(_0x56a9('0x16'));var utils=require(_0x56a9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x56a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b2c7f,_0x4552ce){_0x4552ce=_0x4552ce||0xcc;return function(_0x420667){if(_0x420667){return _0x2b2c7f[_0x56a9('0x19')](_0x4552ce);}return _0x2b2c7f[_0x56a9('0x1a')](_0x4552ce)[_0x56a9('0x1b')]();};}function respondWithResult(_0x124ab8,_0x1a2eb4){_0x1a2eb4=_0x1a2eb4||0xc8;return function(_0x40b2cb){if(_0x40b2cb){return _0x124ab8['status'](_0x1a2eb4)['json'](_0x40b2cb);}};}function respondWithFilteredResult(_0x2e0dfd,_0x2a0714){return function(_0x42007b){if(_0x42007b){var _0x46f854=typeof _0x2a0714['offset']===_0x56a9('0x1c')&&typeof _0x2a0714['limit']==='undefined';var _0x4e292f=_0x42007b[_0x56a9('0x1d')];var _0x576bdf=_0x46f854?0x0:_0x2a0714[_0x56a9('0x1e')];var _0x105fe5=_0x46f854?_0x42007b[_0x56a9('0x1d')]:_0x2a0714[_0x56a9('0x1e')]+_0x2a0714[_0x56a9('0x1f')];var _0xbfeb1a;if(_0x105fe5>=_0x4e292f){_0x105fe5=_0x4e292f;_0xbfeb1a=0xc8;}else{_0xbfeb1a=0xce;}_0x2e0dfd[_0x56a9('0x1a')](_0xbfeb1a);return _0x2e0dfd[_0x56a9('0x20')](_0x56a9('0x21'),_0x576bdf+'-'+_0x105fe5+'/'+_0x4e292f)[_0x56a9('0x22')](_0x42007b);}return null;};}function patchUpdates(_0x5f145f){return function(_0x5bc03a){try{jsonpatch[_0x56a9('0x23')](_0x5bc03a,_0x5f145f,!![]);}catch(_0x16f9de){return BPromise[_0x56a9('0x24')](_0x16f9de);}return _0x5bc03a[_0x56a9('0x25')]();};}function saveUpdates(_0x4a09e5,_0x6100fe){return function(_0x3355c4){if(_0x3355c4){return _0x3355c4[_0x56a9('0x26')](_0x4a09e5)[_0x56a9('0x27')](function(_0x5a82e0){return _0x5a82e0;});}return null;};}function removeEntity(_0x44762e,_0x32839b){return function(_0x21ab38){if(_0x21ab38){return _0x21ab38[_0x56a9('0x28')]()[_0x56a9('0x27')](function(){var _0x52016c=_0x21ab38[_0x56a9('0x29')]({'plain':!![]});var _0x217bda=_0x56a9('0x2a');return db['UserProfileResource'][_0x56a9('0x28')]({'where':{'type':_0x217bda,'resourceId':_0x52016c['id']}})['then'](function(){return _0x21ab38;});})[_0x56a9('0x27')](function(){_0x44762e[_0x56a9('0x1a')](0xcc)[_0x56a9('0x1b')]();});}};}function handleEntityNotFound(_0x20432a,_0x45f38c){return function(_0x1afe8a){if(!_0x1afe8a){_0x20432a[_0x56a9('0x19')](0x194);}return _0x1afe8a;};}function handleError(_0xff5f55,_0x51fd64){_0x51fd64=_0x51fd64||0x1f4;return function(_0x437ccf){logger[_0x56a9('0x2b')](_0x437ccf['stack']);if(_0x437ccf[_0x56a9('0x2c')]){delete _0x437ccf['name'];}_0xff5f55['status'](_0x51fd64)[_0x56a9('0x2d')](_0x437ccf);};}exports['index']=function(_0x2f933a,_0x11002a){var _0x2fbd5d={},_0x2c1c3d={},_0x5879db={'count':0x0,'rows':[]};var _0x332707=_[_0x56a9('0x2e')](db[_0x56a9('0x2f')][_0x56a9('0x30')],function(_0xbbb47d){return{'name':_0xbbb47d[_0x56a9('0x31')],'type':_0xbbb47d[_0x56a9('0x32')][_0x56a9('0x33')]};});_0x2c1c3d[_0x56a9('0x34')]=_[_0x56a9('0x2e')](_0x332707,_0x56a9('0x2c'));_0x2c1c3d[_0x56a9('0x35')]=_['keys'](_0x2f933a[_0x56a9('0x35')]);_0x2c1c3d[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x2c1c3d['model'],_0x2c1c3d[_0x56a9('0x35')]);_0x2fbd5d['attributes']=_['intersection'](_0x2c1c3d['model'],qs[_0x56a9('0x38')](_0x2f933a[_0x56a9('0x35')]['fields']));_0x2fbd5d['attributes']=_0x2fbd5d[_0x56a9('0x39')][_0x56a9('0x3a')]?_0x2fbd5d[_0x56a9('0x39')]:_0x2c1c3d[_0x56a9('0x34')];if(!_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3b')](_0x56a9('0x3c'))){_0x2fbd5d[_0x56a9('0x1f')]=qs[_0x56a9('0x1f')](_0x2f933a[_0x56a9('0x35')]['limit']);_0x2fbd5d['offset']=qs['offset'](_0x2f933a['query'][_0x56a9('0x1e')]);}_0x2fbd5d[_0x56a9('0x3d')]=qs['sort'](_0x2f933a[_0x56a9('0x35')][_0x56a9('0x3e')]);_0x2fbd5d[_0x56a9('0x3f')]=qs[_0x56a9('0x36')](_[_0x56a9('0x40')](_0x2f933a[_0x56a9('0x35')],_0x2c1c3d[_0x56a9('0x36')]),_0x332707);if(_0x2f933a['query'][_0x56a9('0x41')]){_0x2fbd5d[_0x56a9('0x3f')]=_['merge'](_0x2fbd5d['where'],{'$or':_[_0x56a9('0x2e')](_0x332707,function(_0x1180c6){if(_0x1180c6[_0x56a9('0x32')]!==_0x56a9('0x42')){var _0x158504={};_0x158504[_0x1180c6[_0x56a9('0x2c')]]={'$like':'%'+_0x2f933a[_0x56a9('0x35')][_0x56a9('0x41')]+'%'};return _0x158504;}})});}_0x2fbd5d=_[_0x56a9('0x43')]({},_0x2fbd5d,_0x2f933a[_0x56a9('0x44')]);var _0x9f24ea={'where':_0x2fbd5d[_0x56a9('0x3f')]};return db[_0x56a9('0x2f')][_0x56a9('0x1d')](_0x9f24ea)[_0x56a9('0x27')](function(_0xe57cfb){_0x5879db[_0x56a9('0x1d')]=_0xe57cfb;if(_0x2f933a[_0x56a9('0x35')]['includeAll']){_0x2fbd5d[_0x56a9('0x45')]=[{'all':!![]}];}return db[_0x56a9('0x2f')][_0x56a9('0x46')](_0x2fbd5d);})['then'](function(_0x1f8b30){_0x5879db['rows']=_0x1f8b30;return _0x5879db;})[_0x56a9('0x27')](respondWithFilteredResult(_0x11002a,_0x2fbd5d))['catch'](handleError(_0x11002a,null));};exports[_0x56a9('0x47')]=function(_0x39c445,_0x3998f1){var _0x49286b={'raw':!![],'where':{'id':_0x39c445['params']['id']}},_0x5192d8={};_0x5192d8['model']=_[_0x56a9('0x48')](db[_0x56a9('0x2f')][_0x56a9('0x30')]);_0x5192d8[_0x56a9('0x35')]=_[_0x56a9('0x48')](_0x39c445[_0x56a9('0x35')]);_0x5192d8[_0x56a9('0x36')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],_0x5192d8[_0x56a9('0x35')]);_0x49286b[_0x56a9('0x39')]=_[_0x56a9('0x37')](_0x5192d8[_0x56a9('0x34')],qs[_0x56a9('0x38')](_0x39c445['query'][_0x56a9('0x38')]));_0x49286b[_0x56a9('0x39')]=_0x49286b[_0x56a9('0x39')]['length']?_0x49286b[_0x56a9('0x39')]:_0x5192d8[_0x56a9('0x34')];if(_0x39c445['query'][_0x56a9('0x49')]){_0x49286b[_0x56a9('0x45')]=[{'all':!![]}];}_0x49286b=_[_0x56a9('0x43')]({},_0x49286b,_0x39c445[_0x56a9('0x44')]);return db['ContactItemType'][_0x56a9('0x4a')](_0x49286b)[_0x56a9('0x27')](handleEntityNotFound(_0x3998f1,null))[_0x56a9('0x27')](respondWithResult(_0x3998f1,null))[_0x56a9('0x4b')](handleError(_0x3998f1,null));};exports[_0x56a9('0x4c')]=function(_0x3942d8,_0x31aaf5){return db[_0x56a9('0x2f')][_0x56a9('0x4c')](_0x3942d8[_0x56a9('0x4d')],{})[_0x56a9('0x27')](function(_0x500656){var _0x58d370=_0x3942d8[_0x56a9('0x4e')][_0x56a9('0x29')]({'plain':!![]});if(!_0x58d370)throw new Error(_0x56a9('0x4f'));if(_0x58d370[_0x56a9('0x50')]==='user'){var _0x1986f2=_0x500656[_0x56a9('0x29')]({'plain':!![]});var _0x26ad3e=_0x56a9('0x2a');return db['UserProfileSection'][_0x56a9('0x4a')]({'where':{'name':_0x26ad3e,'userProfileId':_0x58d370[_0x56a9('0x51')]},'raw':!![]})['then'](function(_0x1ff42f){if(_0x1ff42f&&_0x1ff42f[_0x56a9('0x52')]===0x0){return db['UserProfileResource'][_0x56a9('0x4c')]({'name':_0x1986f2[_0x56a9('0x2c')],'resourceId':_0x1986f2['id'],'type':_0x1ff42f[_0x56a9('0x2c')],'sectionId':_0x1ff42f['id']},{})[_0x56a9('0x27')](function(){return _0x500656;});}else{return _0x500656;}})['catch'](function(_0x4938d6){logger[_0x56a9('0x2b')](_0x56a9('0x53'),_0x4938d6);throw _0x4938d6;});}return _0x500656;})[_0x56a9('0x27')](respondWithResult(_0x31aaf5,0xc9))[_0x56a9('0x4b')](handleError(_0x31aaf5,null));};exports[_0x56a9('0x26')]=function(_0xce9dc0,_0x798b4e){if(_0xce9dc0[_0x56a9('0x4d')]['id']){delete _0xce9dc0[_0x56a9('0x4d')]['id'];}return db[_0x56a9('0x2f')]['find']({'where':{'id':_0xce9dc0[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x798b4e,null))[_0x56a9('0x27')](saveUpdates(_0xce9dc0[_0x56a9('0x4d')],null))[_0x56a9('0x27')](respondWithResult(_0x798b4e,null))[_0x56a9('0x4b')](handleError(_0x798b4e,null));};exports[_0x56a9('0x28')]=function(_0x488577,_0x870aa5){return db[_0x56a9('0x2f')][_0x56a9('0x4a')]({'where':{'id':_0x488577[_0x56a9('0x54')]['id']}})[_0x56a9('0x27')](handleEntityNotFound(_0x870aa5,null))[_0x56a9('0x27')](db[_0x56a9('0x55')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x488577[_0x56a9('0x54')]['id']}}))['then'](removeEntity(_0x870aa5,null))['catch'](handleError(_0x870aa5,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 4b91be4..d5474b9 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0865=['bluebird','request-promise','path','../../config/environment','exports','tools_contact_item_types','util','../../config/logger'];(function(_0x40a13b,_0x134e8e){var _0x259445=function(_0x12f4d3){while(--_0x12f4d3){_0x40a13b['push'](_0x40a13b['shift']());}};_0x259445(++_0x134e8e);}(_0x0865,0x156));var _0x5086=function(_0x16867b,_0x4e2bc3){_0x16867b=_0x16867b-0x0;var _0x4d46fa=_0x0865[_0x16867b];return _0x4d46fa;};'use strict';var _=require('lodash');var util=require(_0x5086('0x0'));var logger=require(_0x5086('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5086('0x2'));var rp=require(_0x5086('0x3'));var fs=require('fs');var path=require(_0x5086('0x4'));var rimraf=require('rimraf');var config=require(_0x5086('0x5'));var attributes=require('./contactItemType.attributes');module[_0x5086('0x6')]=function(_0x421c3e,_0x33fd3f){return _0x421c3e['define']('ContactItemType',attributes,{'tableName':_0x5086('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b41=['rimraf','../../config/environment','exports','define','ContactItemType','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x59fa84,_0xdc26f2){var _0x49c4a3=function(_0x552948){while(--_0x552948){_0x59fa84['push'](_0x59fa84['shift']());}};_0x49c4a3(++_0xdc26f2);}(_0x4b41,0x101));var _0x14b4=function(_0x2755c5,_0x42f4ea){_0x2755c5=_0x2755c5-0x0;var _0x41985e=_0x4b41[_0x2755c5];return _0x41985e;};'use strict';var _=require(_0x14b4('0x0'));var util=require(_0x14b4('0x1'));var logger=require(_0x14b4('0x2'))(_0x14b4('0x3'));var moment=require('moment');var BPromise=require(_0x14b4('0x4'));var rp=require(_0x14b4('0x5'));var fs=require('fs');var path=require(_0x14b4('0x6'));var rimraf=require(_0x14b4('0x7'));var config=require(_0x14b4('0x8'));var attributes=require('./contactItemType.attributes');module[_0x14b4('0x9')]=function(_0x39ee20,_0x3a6910){return _0x39ee20[_0x14b4('0xa')](_0x14b4('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 6b76687..da1a41e 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7211=['then','info','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','ContactItemType,\x20%s,\x20%s','message','result','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x50605b,_0x529812){var _0x2627f3=function(_0x1c8f0d){while(--_0x1c8f0d){_0x50605b['push'](_0x50605b['shift']());}};_0x2627f3(++_0x529812);}(_0x7211,0x123));var _0x1721=function(_0x5b888b,_0xd9f3a4){_0x5b888b=_0x5b888b-0x0;var _0x36b905=_0x7211[_0x5b888b];return _0x36b905;};'use strict';var _=require('lodash');var util=require(_0x1721('0x0'));var moment=require(_0x1721('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1721('0x2'))['db'];var utils=require(_0x1721('0x3'));var logger=require(_0x1721('0x4'))(_0x1721('0x5'));var config=require(_0x1721('0x6'));var jayson=require(_0x1721('0x7'));var client=jayson['client'][_0x1721('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2d36,_0x4d46a9,_0x35007f){return new BPromise(function(_0x334de9,_0x2ab633){return client['request'](_0x2a2d36,_0x35007f)[_0x1721('0x9')](function(_0xb0bd1){logger[_0x1721('0xa')]('ContactItemType,\x20%s,\x20%s',_0x4d46a9,_0x1721('0xb'));logger[_0x1721('0xc')](_0x1721('0xd'),_0x4d46a9,_0x1721('0xb'),JSON[_0x1721('0xe')](_0xb0bd1));if(_0xb0bd1['error']){if(_0xb0bd1[_0x1721('0xf')][_0x1721('0x10')]===0x1f4){logger[_0x1721('0xf')](_0x1721('0x11'),_0x4d46a9,_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);return _0x2ab633(_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);}logger['error'](_0x1721('0x11'),_0x4d46a9,_0xb0bd1['error'][_0x1721('0x12')]);return _0x334de9(_0xb0bd1[_0x1721('0xf')][_0x1721('0x12')]);}else{logger[_0x1721('0xa')](_0x1721('0x11'),_0x4d46a9,'request\x20sent');_0x334de9(_0xb0bd1[_0x1721('0x13')][_0x1721('0x12')]);}})['catch'](function(_0x321eed){logger[_0x1721('0xf')]('ContactItemType,\x20%s,\x20%s',_0x4d46a9,_0x321eed);_0x2ab633(_0x321eed);});});} \ No newline at end of file +var _0x59c4=['debug','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x1728d1,_0x1994e3){var _0x3ca811=function(_0x5dd015){while(--_0x5dd015){_0x1728d1['push'](_0x1728d1['shift']());}};_0x3ca811(++_0x1994e3);}(_0x59c4,0x79));var _0x459c=function(_0x34db7c,_0x3cbcc3){_0x34db7c=_0x34db7c-0x0;var _0x4b75eb=_0x59c4[_0x34db7c];return _0x4b75eb;};'use strict';var _=require(_0x459c('0x0'));var util=require('util');var moment=require(_0x459c('0x1'));var BPromise=require(_0x459c('0x2'));var rs=require(_0x459c('0x3'));var fs=require('fs');var Redis=require(_0x459c('0x4'));var db=require(_0x459c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x459c('0x6'))(_0x459c('0x7'));var config=require(_0x459c('0x8'));var jayson=require(_0x459c('0x9'));var client=jayson[_0x459c('0xa')][_0x459c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3846e1,_0x3611ef,_0x35e1a9){return new BPromise(function(_0x4d8f0e,_0x1e4dec){return client[_0x459c('0xc')](_0x3846e1,_0x35e1a9)[_0x459c('0xd')](function(_0x16cb0f){logger[_0x459c('0xe')](_0x459c('0xf'),_0x3611ef,_0x459c('0x10'));logger[_0x459c('0x11')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3611ef,_0x459c('0x10'),JSON['stringify'](_0x16cb0f));if(_0x16cb0f[_0x459c('0x12')]){if(_0x16cb0f[_0x459c('0x12')][_0x459c('0x13')]===0x1f4){logger[_0x459c('0x12')]('ContactItemType,\x20%s,\x20%s',_0x3611ef,_0x16cb0f['error']['message']);return _0x1e4dec(_0x16cb0f[_0x459c('0x12')][_0x459c('0x14')]);}logger[_0x459c('0x12')](_0x459c('0xf'),_0x3611ef,_0x16cb0f[_0x459c('0x12')]['message']);return _0x4d8f0e(_0x16cb0f[_0x459c('0x12')][_0x459c('0x14')]);}else{logger[_0x459c('0xe')]('ContactItemType,\x20%s,\x20%s',_0x3611ef,'request\x20sent');_0x4d8f0e(_0x16cb0f[_0x459c('0x15')][_0x459c('0x14')]);}})[_0x459c('0x16')](function(_0x519eee){logger[_0x459c('0x12')](_0x459c('0xf'),_0x3611ef,_0x519eee);_0x1e4dec(_0x519eee);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 4c6b700..d324a6a 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x736c=['post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','isAuthenticated','/:id','show'];(function(_0x129d04,_0x5c0644){var _0x3cb2ff=function(_0x5274ef){while(--_0x5274ef){_0x129d04['push'](_0x129d04['shift']());}};_0x3cb2ff(++_0x5c0644);}(_0x736c,0x6b));var _0xc736=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x736c[_0x2a0738];return _0x159679;};'use strict';var multer=require(_0xc736('0x0'));var util=require(_0xc736('0x1'));var path=require(_0xc736('0x2'));var timeout=require(_0xc736('0x3'));var express=require(_0xc736('0x4'));var router=express[_0xc736('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc736('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc736('0x7'));var controller=require(_0xc736('0x8'));router['get']('/',auth[_0xc736('0x9')](),controller['index']);router['get'](_0xc736('0xa'),auth[_0xc736('0x9')](),controller[_0xc736('0xb')]);router[_0xc736('0xc')]('/',auth[_0xc736('0x9')](),controller[_0xc736('0xd')]);router[_0xc736('0xe')](_0xc736('0xa'),auth[_0xc736('0x9')](),controller[_0xc736('0xf')]);router[_0xc736('0x10')](_0xc736('0xa'),auth[_0xc736('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3a19=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3003d2,_0x5c47e4){var _0x49df45=function(_0x343f62){while(--_0x343f62){_0x3003d2['push'](_0x3003d2['shift']());}};_0x49df45(++_0x5c47e4);}(_0x3a19,0x12c));var _0x93a1=function(_0x39a1bd,_0x5c1274){_0x39a1bd=_0x39a1bd-0x0;var _0x41fc31=_0x3a19[_0x39a1bd];return _0x41fc31;};'use strict';var multer=require(_0x93a1('0x0'));var util=require(_0x93a1('0x1'));var path=require(_0x93a1('0x2'));var timeout=require(_0x93a1('0x3'));var express=require(_0x93a1('0x4'));var router=express[_0x93a1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93a1('0x6'));var interaction=require(_0x93a1('0x7'));var config=require(_0x93a1('0x8'));var controller=require('./contactItemType.controller');router['get']('/',auth[_0x93a1('0x9')](),controller[_0x93a1('0xa')]);router[_0x93a1('0xb')](_0x93a1('0xc'),auth[_0x93a1('0x9')](),controller[_0x93a1('0xd')]);router[_0x93a1('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x93a1('0xf')](_0x93a1('0xc'),auth[_0x93a1('0x9')](),controller[_0x93a1('0x10')]);router['delete'](_0x93a1('0xc'),auth[_0x93a1('0x9')](),controller[_0x93a1('0x11')]);module[_0x93a1('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 68032a8..508cc35 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 _0xb10b=['name','sequelize','STRING'];(function(_0x419ddb,_0x2ce2ea){var _0x5200b4=function(_0x286b54){while(--_0x286b54){_0x419ddb['push'](_0x419ddb['shift']());}};_0x5200b4(++_0x2ce2ea);}(_0xb10b,0x12a));var _0xbb10=function(_0x533852,_0x5e1347){_0x533852=_0x533852-0x0;var _0x3b39f2=_0xb10b[_0x533852];return _0x3b39f2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xb7e7[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index cd8b7ab..b07c700 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 _0x9ccb=['userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','findOne','DashboardItem','order','getItems','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','../../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','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','user','UserProfileSection','clone','updatedAt','body','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x36a7a3,_0x22e47e){var _0x481620=function(_0x546dbf){while(--_0x546dbf){_0x36a7a3['push'](_0x36a7a3['shift']());}};_0x481620(++_0x22e47e);}(_0x9ccb,0x127));var _0xb9cc=function(_0x13e758,_0x317d23){_0x13e758=_0x13e758-0x0;var _0x5b53c3=_0x9ccb[_0x13e758];return _0x5b53c3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9cc('0x0'));var zipdir=require(_0xb9cc('0x1'));var jsonpatch=require(_0xb9cc('0x2'));var rp=require(_0xb9cc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb9cc('0x4'));var util=require(_0xb9cc('0x5'));var path=require(_0xb9cc('0x6'));var sox=require(_0xb9cc('0x7'));var csv=require(_0xb9cc('0x8'));var ejs=require(_0xb9cc('0x9'));var fs=require('fs');var fs_extra=require(_0xb9cc('0xa'));var _=require(_0xb9cc('0xb'));var squel=require(_0xb9cc('0xc'));var crypto=require('crypto');var jsforce=require(_0xb9cc('0xd'));var deskjs=require(_0xb9cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb9cc('0xf'));var Papa=require(_0xb9cc('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9cc('0x11'));var logger=require(_0xb9cc('0x12'))('api');var utils=require(_0xb9cc('0x13'));var config=require(_0xb9cc('0x14'));var licenseUtil=require(_0xb9cc('0x15'));var db=require(_0xb9cc('0x16'))['db'];config[_0xb9cc('0x17')]=_[_0xb9cc('0x18')](config['redis'],{'host':_0xb9cc('0x19'),'port':0x18eb});var socket=require(_0xb9cc('0x1a'))(new Redis(config[_0xb9cc('0x17')]));require('./dashboard.socket')[_0xb9cc('0x1b')](socket);function respondWithStatusCode(_0x1626a9,_0x1f4675){_0x1f4675=_0x1f4675||0xcc;return function(_0x35dba4){if(_0x35dba4){return _0x1626a9[_0xb9cc('0x1c')](_0x1f4675);}return _0x1626a9[_0xb9cc('0x1d')](_0x1f4675)[_0xb9cc('0x1e')]();};}function respondWithResult(_0x23df37,_0x50dbb0){_0x50dbb0=_0x50dbb0||0xc8;return function(_0x3a22f4){if(_0x3a22f4){return _0x23df37[_0xb9cc('0x1d')](_0x50dbb0)[_0xb9cc('0x1f')](_0x3a22f4);}};}function respondWithFilteredResult(_0x5dfcb6,_0x349a63){return function(_0x232963){if(_0x232963){var _0x3ebeef=typeof _0x349a63[_0xb9cc('0x20')]===_0xb9cc('0x21')&&typeof _0x349a63[_0xb9cc('0x22')]===_0xb9cc('0x21');var _0x1fbbf9=_0x232963[_0xb9cc('0x23')];var _0x16c0e5=_0x3ebeef?0x0:_0x349a63[_0xb9cc('0x20')];var _0x1e6c3c=_0x3ebeef?_0x232963['count']:_0x349a63[_0xb9cc('0x20')]+_0x349a63['limit'];var _0x269557;if(_0x1e6c3c>=_0x1fbbf9){_0x1e6c3c=_0x1fbbf9;_0x269557=0xc8;}else{_0x269557=0xce;}_0x5dfcb6['status'](_0x269557);return _0x5dfcb6['set'](_0xb9cc('0x24'),_0x16c0e5+'-'+_0x1e6c3c+'/'+_0x1fbbf9)[_0xb9cc('0x1f')](_0x232963);}return null;};}function patchUpdates(_0x1169e7){return function(_0x3c845d){try{jsonpatch[_0xb9cc('0x25')](_0x3c845d,_0x1169e7,!![]);}catch(_0x4780ff){return BPromise[_0xb9cc('0x26')](_0x4780ff);}return _0x3c845d[_0xb9cc('0x27')]();};}function saveUpdates(_0x1bf0d9,_0x1d53a5){return function(_0x26ed0f){if(_0x26ed0f){return _0x26ed0f['update'](_0x1bf0d9)[_0xb9cc('0x28')](function(_0x3663d5){return _0x3663d5;});}return null;};}function removeEntity(_0x5b096c,_0x57871e){return function(_0x42f58c){if(_0x42f58c){return _0x42f58c[_0xb9cc('0x29')]()[_0xb9cc('0x28')](function(){var _0x5bb626=_0x42f58c[_0xb9cc('0x2a')]({'plain':!![]});var _0x29bae2=_0xb9cc('0x2b');return db[_0xb9cc('0x2c')][_0xb9cc('0x29')]({'where':{'type':_0x29bae2,'resourceId':_0x5bb626['id']}})[_0xb9cc('0x28')](function(){return _0x42f58c;});})[_0xb9cc('0x28')](function(){_0x5b096c['status'](0xcc)[_0xb9cc('0x1e')]();});}};}function handleEntityNotFound(_0x18c33b,_0x24af50){return function(_0x2b125c){if(!_0x2b125c){_0x18c33b[_0xb9cc('0x1c')](0x194);}return _0x2b125c;};}function handleError(_0x4c14f3,_0x2fe6db){_0x2fe6db=_0x2fe6db||0x1f4;return function(_0x1f73e3){logger[_0xb9cc('0x2d')](_0x1f73e3[_0xb9cc('0x2e')]);if(_0x1f73e3[_0xb9cc('0x2f')]){delete _0x1f73e3[_0xb9cc('0x2f')];}_0x4c14f3[_0xb9cc('0x1d')](_0x2fe6db)['send'](_0x1f73e3);};}exports['index']=function(_0x23edaf,_0x4ef372){var _0x26cf3b={},_0x48f5f1={},_0x329fe2={'count':0x0,'rows':[]};var _0x2172bf=_[_0xb9cc('0x30')](db[_0xb9cc('0x31')][_0xb9cc('0x32')],function(_0x459ddd){return{'name':_0x459ddd[_0xb9cc('0x33')],'type':_0x459ddd[_0xb9cc('0x34')][_0xb9cc('0x35')]};});_0x48f5f1['model']=_['map'](_0x2172bf,_0xb9cc('0x2f'));_0x48f5f1[_0xb9cc('0x36')]=_[_0xb9cc('0x37')](_0x23edaf[_0xb9cc('0x36')]);_0x48f5f1[_0xb9cc('0x38')]=_[_0xb9cc('0x39')](_0x48f5f1[_0xb9cc('0x3a')],_0x48f5f1[_0xb9cc('0x36')]);_0x26cf3b[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x48f5f1['model'],qs['fields'](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x3c')]));_0x26cf3b['attributes']=_0x26cf3b[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x26cf3b[_0xb9cc('0x3b')]:_0x48f5f1[_0xb9cc('0x3a')];if(!_0x23edaf['query'][_0xb9cc('0x3e')](_0xb9cc('0x3f'))){_0x26cf3b['limit']=qs[_0xb9cc('0x22')](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x22')]);_0x26cf3b['offset']=qs['offset'](_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x20')]);}_0x26cf3b['order']=qs[_0xb9cc('0x40')](_0x23edaf['query'][_0xb9cc('0x40')]);_0x26cf3b[_0xb9cc('0x41')]=qs[_0xb9cc('0x38')](_[_0xb9cc('0x42')](_0x23edaf[_0xb9cc('0x36')],_0x48f5f1[_0xb9cc('0x38')]),_0x2172bf);if(_0x23edaf[_0xb9cc('0x36')]['filter']){_0x26cf3b[_0xb9cc('0x41')]=_[_0xb9cc('0x43')](_0x26cf3b[_0xb9cc('0x41')],{'$or':_[_0xb9cc('0x30')](_0x2172bf,function(_0x51e33a){if(_0x51e33a[_0xb9cc('0x34')]!==_0xb9cc('0x44')){var _0x4979a2={};_0x4979a2[_0x51e33a[_0xb9cc('0x2f')]]={'$like':'%'+_0x23edaf[_0xb9cc('0x36')][_0xb9cc('0x45')]+'%'};return _0x4979a2;}})});}_0x26cf3b=_[_0xb9cc('0x43')]({},_0x26cf3b,_0x23edaf[_0xb9cc('0x46')]);var _0x2fb607={'where':_0x26cf3b[_0xb9cc('0x41')]};return db[_0xb9cc('0x31')][_0xb9cc('0x23')](_0x2fb607)['then'](function(_0x211ced){_0x329fe2[_0xb9cc('0x23')]=_0x211ced;if(_0x23edaf['query'][_0xb9cc('0x47')]){_0x26cf3b[_0xb9cc('0x48')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x26cf3b);})[_0xb9cc('0x28')](function(_0x3c7bf3){_0x329fe2[_0xb9cc('0x49')]=_0x3c7bf3;return _0x329fe2;})[_0xb9cc('0x28')](respondWithFilteredResult(_0x4ef372,_0x26cf3b))[_0xb9cc('0x4a')](handleError(_0x4ef372,null));};exports[_0xb9cc('0x4b')]=function(_0x3bfe03,_0x542d82){var _0x2fab86={'raw':![],'where':{'id':_0x3bfe03[_0xb9cc('0x4c')]['id']}},_0x2185ff={};_0x2185ff[_0xb9cc('0x3a')]=_[_0xb9cc('0x37')](db[_0xb9cc('0x31')]['rawAttributes']);_0x2185ff[_0xb9cc('0x36')]=_[_0xb9cc('0x37')](_0x3bfe03[_0xb9cc('0x36')]);_0x2185ff[_0xb9cc('0x38')]=_['intersection'](_0x2185ff['model'],_0x2185ff['query']);_0x2fab86[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x2185ff[_0xb9cc('0x3a')],qs[_0xb9cc('0x3c')](_0x3bfe03[_0xb9cc('0x36')][_0xb9cc('0x3c')]));_0x2fab86[_0xb9cc('0x3b')]=_0x2fab86[_0xb9cc('0x3b')]['length']?_0x2fab86[_0xb9cc('0x3b')]:_0x2185ff['model'];if(_0x3bfe03[_0xb9cc('0x36')]['includeAll']){_0x2fab86['include']=[{'all':!![]}];}_0x2fab86=_['merge']({},_0x2fab86,_0x3bfe03['options']);return db[_0xb9cc('0x31')][_0xb9cc('0x4d')](_0x2fab86)[_0xb9cc('0x28')](handleEntityNotFound(_0x542d82,null))[_0xb9cc('0x28')](respondWithResult(_0x542d82,null))[_0xb9cc('0x4a')](handleError(_0x542d82,null));};exports['create']=function(_0x3df236,_0x3fc528){return db['Dashboard'][_0xb9cc('0x4e')](_0x3df236['body'],{})[_0xb9cc('0x28')](function(_0x54f0ea){var _0x1d06de=_0x3df236[_0xb9cc('0x4f')][_0xb9cc('0x2a')]({'plain':!![]});if(!_0x1d06de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d06de['role']===_0xb9cc('0x4f')){var _0x5c3801=_0x54f0ea[_0xb9cc('0x2a')]({'plain':!![]});var _0x26bd97=_0xb9cc('0x2b');return db[_0xb9cc('0x50')][_0xb9cc('0x4d')]({'where':{'name':_0x26bd97,'userProfileId':_0x1d06de['userProfileId']},'raw':!![]})[_0xb9cc('0x28')](function(_0x13be3c){if(_0x13be3c&&_0x13be3c['autoAssociation']===0x0){return db[_0xb9cc('0x2c')][_0xb9cc('0x4e')]({'name':_0x5c3801[_0xb9cc('0x2f')],'resourceId':_0x5c3801['id'],'type':_0x13be3c['name'],'sectionId':_0x13be3c['id']},{})[_0xb9cc('0x28')](function(){return _0x54f0ea;});}else{return _0x54f0ea;}})[_0xb9cc('0x4a')](function(_0x3309e5){logger[_0xb9cc('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3309e5);throw _0x3309e5;});}return _0x54f0ea;})['then'](respondWithResult(_0x3fc528,0xc9))['catch'](handleError(_0x3fc528,null));};exports[_0xb9cc('0x51')]=function(_0x42c57b,_0x2d228f){var _0x23b676={'where':{'id':_0x42c57b[_0xb9cc('0x4c')]['id']}},_0x2976f1={};_0x2976f1['model']=_[_0xb9cc('0x37')](db[_0xb9cc('0x31')][_0xb9cc('0x32')]);_0x23b676[_0xb9cc('0x3b')]=_[_0xb9cc('0x39')](_0x2976f1[_0xb9cc('0x3a')],qs['fields'](_0x42c57b[_0xb9cc('0x36')]['fields']));_0x23b676['attributes']=_0x23b676[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x23b676['attributes']:_0x2976f1[_0xb9cc('0x3a')];if(_0x42c57b[_0xb9cc('0x36')]['includeAll']){_0x23b676[_0xb9cc('0x48')]=[{'all':!![]}];}_0x23b676=_[_0xb9cc('0x43')]({},_0x23b676,_0x42c57b[_0xb9cc('0x46')]);return db[_0xb9cc('0x31')][_0xb9cc('0x4d')](_0x23b676)['then'](handleEntityNotFound(_0x2d228f,null))[_0xb9cc('0x28')](function(_0x3ef944){if(_0x3ef944){var _0x51155e=_0x3ef944[_0xb9cc('0x2a')]({'plain':!![]});_0x51155e=qs['omit'](_0x51155e,['id','createdAt',_0xb9cc('0x52')]);_0x42c57b[_0xb9cc('0x53')]=_['omit'](_0x42c57b['body'],['id',_0xb9cc('0x54'),_0xb9cc('0x52')]);return db[_0xb9cc('0x31')][_0xb9cc('0x4e')](_[_0xb9cc('0x43')](_0x51155e,_0x42c57b[_0xb9cc('0x53')]),{'include':_0x42c57b['query'][_0xb9cc('0x47')]?[{'all':!![]}]:undefined})[_0xb9cc('0x28')](function(_0x35b121){var _0x4901c1=_0x42c57b[_0xb9cc('0x4f')][_0xb9cc('0x2a')]({'plain':!![]});if(!_0x4901c1)throw new Error(_0xb9cc('0x55'));if(_0x4901c1['role']===_0xb9cc('0x4f')){var _0x21d5b6=_0x35b121[_0xb9cc('0x2a')]({'plain':!![]});var _0x1978df='CustomDashboards';return db[_0xb9cc('0x50')][_0xb9cc('0x4d')]({'where':{'name':_0x1978df,'userProfileId':_0x4901c1[_0xb9cc('0x56')]},'raw':!![]})[_0xb9cc('0x28')](function(_0x47b371){if(_0x47b371&&_0x47b371['autoAssociation']===0x0){return db[_0xb9cc('0x2c')]['create']({'name':_0x21d5b6['name'],'resourceId':_0x21d5b6['id'],'type':_0x47b371['name'],'sectionId':_0x47b371['id']},{})[_0xb9cc('0x28')](function(){return _0x35b121;});}else{return _0x35b121;}})[_0xb9cc('0x4a')](function(_0x227368){logger[_0xb9cc('0x2d')](_0xb9cc('0x57'),_0x227368);throw _0x227368;});}return _0x35b121;});}})['then'](respondWithResult(_0x2d228f,0xc9))['catch'](handleError(_0x2d228f,null));};exports[_0xb9cc('0x58')]=function(_0x2344ee,_0x5eaab5){if(_0x2344ee['body']['id']){delete _0x2344ee[_0xb9cc('0x53')]['id'];}return db[_0xb9cc('0x31')]['find']({'where':{'id':_0x2344ee['params']['id']}})['then'](handleEntityNotFound(_0x5eaab5,null))[_0xb9cc('0x28')](saveUpdates(_0x2344ee[_0xb9cc('0x53')],null))['then'](respondWithResult(_0x5eaab5,null))[_0xb9cc('0x4a')](handleError(_0x5eaab5,null));};exports[_0xb9cc('0x29')]=function(_0x49330b,_0x13f3da){return db[_0xb9cc('0x31')][_0xb9cc('0x4d')]({'where':{'id':_0x49330b[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x13f3da,null))[_0xb9cc('0x28')](removeEntity(_0x13f3da,null))[_0xb9cc('0x4a')](handleError(_0x13f3da,null));};function widgetAttributes(_0x4e3979){try{switch(_0x4e3979[_0xb9cc('0x34')]){case _0xb9cc('0x59'):return[{'name':_0xb9cc('0x5a'),'value':_0x4e3979[_0xb9cc('0x5a')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||'https://'}];case'custom':return[{'name':_0xb9cc('0x5d'),'value':_0x4e3979[_0xb9cc('0x5d')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979['attrs'][0x0][_0xb9cc('0x5c')]:undefined)||''}];case _0xb9cc('0x5e'):return[{'name':_0xb9cc('0x5f'),'value':_0x4e3979[_0xb9cc('0x5f')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979['attrs'][0x0][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x60')},{'name':_0xb9cc('0x61'),'value':_0x4e3979[_0xb9cc('0x61')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x62')},{'name':_0xb9cc('0x63'),'value':_0x4e3979[_0xb9cc('0x63')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2][_0xb9cc('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0xb9cc('0x64'),'value':_0x4e3979[_0xb9cc('0x64')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0]['value']:undefined)||_0xb9cc('0x65')},{'name':_0xb9cc('0x66'),'value':_0x4e3979[_0xb9cc('0x66')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||[]},{'name':_0xb9cc('0x63'),'value':_0x4e3979['attrFontSize']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2]['value']:undefined)||0x14},{'name':_0xb9cc('0x67'),'value':_0x4e3979[_0xb9cc('0x67')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x3]?_0x4e3979[_0xb9cc('0x5b')][0x3][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x68')},{'name':'attrEmailAccounts','value':_0x4e3979[_0xb9cc('0x69')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x4]?_0x4e3979[_0xb9cc('0x5b')][0x4][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6a'),'value':_0x4e3979[_0xb9cc('0x6a')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x5]?_0x4e3979[_0xb9cc('0x5b')][0x5][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6b'),'value':_0x4e3979[_0xb9cc('0x6b')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x6]?_0x4e3979[_0xb9cc('0x5b')][0x6][_0xb9cc('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4e3979[_0xb9cc('0x6c')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x7]?_0x4e3979[_0xb9cc('0x5b')][0x7][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6d'),'value':_0x4e3979['attrWhatsappAccounts']||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x8]?_0x4e3979['attrs'][0x8]['value']:undefined)||''},{'name':_0xb9cc('0x6e'),'value':_0x4e3979[_0xb9cc('0x6e')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x9]?_0x4e3979[_0xb9cc('0x5b')][0x9]['value']:undefined)||''}];case _0xb9cc('0x6f'):case _0xb9cc('0x70'):return[{'name':_0xb9cc('0x71'),'value':_0x4e3979['attrSerie1']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x65')},{'name':_0xb9cc('0x72'),'value':_0x4e3979['attrSerie2']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x73'),'value':_0x4e3979[_0xb9cc('0x73')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x2]?_0x4e3979[_0xb9cc('0x5b')][0x2][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x66'),'value':_0x4e3979[_0xb9cc('0x66')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x3]?_0x4e3979[_0xb9cc('0x5b')][0x3][_0xb9cc('0x5c')]:undefined)||[]},{'name':_0xb9cc('0x67'),'value':_0x4e3979['attrChannel']||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x4]?_0x4e3979[_0xb9cc('0x5b')][0x4][_0xb9cc('0x5c')]:undefined)||_0xb9cc('0x68')},{'name':'attrEmailAccounts','value':_0x4e3979[_0xb9cc('0x69')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x5]?_0x4e3979[_0xb9cc('0x5b')][0x5][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6a'),'value':_0x4e3979[_0xb9cc('0x6a')]||(_0x4e3979['attrs']&&_0x4e3979['attrs'][0x6]?_0x4e3979['attrs'][0x6][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6b'),'value':_0x4e3979[_0xb9cc('0x6b')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x7]?_0x4e3979[_0xb9cc('0x5b')][0x7][_0xb9cc('0x5c')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4e3979[_0xb9cc('0x6c')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x8]?_0x4e3979[_0xb9cc('0x5b')][0x8][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6d'),'value':_0x4e3979[_0xb9cc('0x6d')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0x9]?_0x4e3979[_0xb9cc('0x5b')][0x9][_0xb9cc('0x5c')]:undefined)||''},{'name':_0xb9cc('0x6e'),'value':_0x4e3979[_0xb9cc('0x6e')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979[_0xb9cc('0x5b')][0xa]?_0x4e3979['attrs'][0xa]['value']:undefined)||''}];case _0xb9cc('0x74'):return[{'name':_0xb9cc('0x75'),'type':_0x4e3979[_0xb9cc('0x76')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x34')]:undefined)||null,'value':_0x4e3979[_0xb9cc('0x75')]||(_0x4e3979['attrs']&&_0x4e3979[_0xb9cc('0x5b')][0x0]?_0x4e3979[_0xb9cc('0x5b')][0x0][_0xb9cc('0x5c')]:undefined)||null},{'name':_0xb9cc('0x77'),'value':_0x4e3979[_0xb9cc('0x77')]||(_0x4e3979[_0xb9cc('0x5b')]&&_0x4e3979['attrs'][0x1]?_0x4e3979[_0xb9cc('0x5b')][0x1][_0xb9cc('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x3a61a5){logger[_0xb9cc('0x2d')](_0xb9cc('0x78'),JSON[_0xb9cc('0x79')](_0x3a61a5));return[];}}exports[_0xb9cc('0x7a')]=function(_0xe8139f,_0x273cf6,_0x1b9a70){if(_0xe8139f['body']['id']){delete _0xe8139f[_0xb9cc('0x53')]['id'];}return db['Dashboard'][_0xb9cc('0x4d')]({'where':{'id':_0xe8139f[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x273cf6,null))[_0xb9cc('0x28')](function(_0x14252f){if(_0x14252f){_0xe8139f['body']['DashboardId']=_0x14252f['id'];_0xe8139f['body'][_0xb9cc('0x5b')]=widgetAttributes(_0xe8139f[_0xb9cc('0x53')]);return db['DashboardItem'][_0xb9cc('0x4e')](_0xe8139f[_0xb9cc('0x53')]);}})[_0xb9cc('0x28')](respondWithResult(_0x273cf6,null))['catch'](handleError(_0x273cf6,null));};exports['getItems']=function(_0x4710f5,_0x2b2fb9,_0x24b70f){var _0x20a2bc={};var _0x378ac4={};var _0x106f26;var _0x3b8cd6;return db[_0xb9cc('0x31')][_0xb9cc('0x7b')]({'where':{'id':_0x4710f5[_0xb9cc('0x4c')]['id']}})[_0xb9cc('0x28')](handleEntityNotFound(_0x2b2fb9,null))[_0xb9cc('0x28')](function(_0x281d62){if(_0x281d62){_0x106f26=_0x281d62;_0x378ac4[_0xb9cc('0x3a')]=_[_0xb9cc('0x37')](db[_0xb9cc('0x7c')][_0xb9cc('0x32')]);_0x378ac4['query']=_[_0xb9cc('0x37')](_0x4710f5['query']);_0x378ac4[_0xb9cc('0x38')]=_['intersection'](_0x378ac4[_0xb9cc('0x3a')],_0x378ac4[_0xb9cc('0x36')]);_0x20a2bc['attributes']=_[_0xb9cc('0x39')](_0x378ac4['model'],qs[_0xb9cc('0x3c')](_0x4710f5['query'][_0xb9cc('0x3c')]));_0x20a2bc[_0xb9cc('0x3b')]=_0x20a2bc[_0xb9cc('0x3b')][_0xb9cc('0x3d')]?_0x20a2bc[_0xb9cc('0x3b')]:_0x378ac4[_0xb9cc('0x3a')];_0x20a2bc[_0xb9cc('0x7d')]=qs[_0xb9cc('0x40')](_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x40')]);_0x20a2bc[_0xb9cc('0x41')]=qs[_0xb9cc('0x38')](_['pick'](_0x4710f5[_0xb9cc('0x36')],_0x378ac4[_0xb9cc('0x38')]));if(_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x45')]){_0x20a2bc[_0xb9cc('0x41')]=_[_0xb9cc('0x43')](_0x20a2bc[_0xb9cc('0x41')],{'$or':_[_0xb9cc('0x30')](_0x20a2bc[_0xb9cc('0x3b')],function(_0x248f14){var _0x18e466={};_0x18e466[_0x248f14]={'$like':'%'+_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x45')]+'%'};return _0x18e466;})});}_0x20a2bc=_[_0xb9cc('0x43')]({},_0x20a2bc,_0x4710f5['options']);return _0x106f26[_0xb9cc('0x7e')](_0x20a2bc);}})[_0xb9cc('0x28')](function(_0x1d2cda){if(_0x1d2cda){_0x3b8cd6=_0x1d2cda[_0xb9cc('0x3d')];if(!_0x4710f5[_0xb9cc('0x36')]['hasOwnProperty'](_0xb9cc('0x3f'))){_0x20a2bc['limit']=qs[_0xb9cc('0x22')](_0x4710f5['query']['limit']);_0x20a2bc[_0xb9cc('0x20')]=qs['offset'](_0x4710f5[_0xb9cc('0x36')][_0xb9cc('0x20')]);}return _0x106f26[_0xb9cc('0x7e')](_0x20a2bc);}})[_0xb9cc('0x28')](function(_0x2edd21){if(_0x2edd21){return _0x2edd21?{'count':_0x3b8cd6,'rows':_0x2edd21}:null;}})['then'](respondWithResult(_0x2b2fb9,null))['catch'](handleError(_0x2b2fb9,null));}; \ No newline at end of file +var _0xdbf1=['counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','Dashboard','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','rows','catch','params','attributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','CustomDashboards','attrUrl','attrs','https://','custom','attrPath','clock','attrHourFormat','value','HH:mm:ss','attrTimezone','0.00','attrFontSize'];(function(_0x164d53,_0x1341cc){var _0x7efb40=function(_0x465441){while(--_0x465441){_0x164d53['push'](_0x164d53['shift']());}};_0x7efb40(++_0x1341cc);}(_0xdbf1,0x127));var _0x1dbf=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xdbf1[_0x4e6ae6];return _0x23c108;};'use strict';var emlformat=require(_0x1dbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1dbf('0x1'));var jsonpatch=require(_0x1dbf('0x2'));var rp=require(_0x1dbf('0x3'));var moment=require(_0x1dbf('0x4'));var BPromise=require(_0x1dbf('0x5'));var Mustache=require(_0x1dbf('0x6'));var util=require(_0x1dbf('0x7'));var path=require(_0x1dbf('0x8'));var sox=require(_0x1dbf('0x9'));var csv=require(_0x1dbf('0xa'));var ejs=require(_0x1dbf('0xb'));var fs=require('fs');var fs_extra=require(_0x1dbf('0xc'));var _=require(_0x1dbf('0xd'));var squel=require(_0x1dbf('0xe'));var crypto=require(_0x1dbf('0xf'));var jsforce=require(_0x1dbf('0x10'));var deskjs=require(_0x1dbf('0x11'));var toCsv=require(_0x1dbf('0xa'));var querystring=require(_0x1dbf('0x12'));var Papa=require(_0x1dbf('0x13'));var Redis=require(_0x1dbf('0x14'));var authService=require(_0x1dbf('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x1dbf('0x16'));var hardwareService=require(_0x1dbf('0x17'));var logger=require(_0x1dbf('0x18'))(_0x1dbf('0x19'));var utils=require(_0x1dbf('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1dbf('0x1b'))['db'];config[_0x1dbf('0x1c')]=_[_0x1dbf('0x1d')](config[_0x1dbf('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dbf('0x1e'))(new Redis(config[_0x1dbf('0x1c')]));require(_0x1dbf('0x1f'))[_0x1dbf('0x20')](socket);function respondWithStatusCode(_0x5ab768,_0x1e5a22){_0x1e5a22=_0x1e5a22||0xcc;return function(_0xebb66d){if(_0xebb66d){return _0x5ab768[_0x1dbf('0x21')](_0x1e5a22);}return _0x5ab768[_0x1dbf('0x22')](_0x1e5a22)['end']();};}function respondWithResult(_0x2e50c7,_0x204cf7){_0x204cf7=_0x204cf7||0xc8;return function(_0x58568a){if(_0x58568a){return _0x2e50c7[_0x1dbf('0x22')](_0x204cf7)[_0x1dbf('0x23')](_0x58568a);}};}function respondWithFilteredResult(_0x5367ce,_0x47c931){return function(_0x453540){if(_0x453540){var _0x13d800=typeof _0x47c931[_0x1dbf('0x24')]===_0x1dbf('0x25')&&typeof _0x47c931[_0x1dbf('0x26')]===_0x1dbf('0x25');var _0x1c9191=_0x453540[_0x1dbf('0x27')];var _0x2aad35=_0x13d800?0x0:_0x47c931[_0x1dbf('0x24')];var _0x2d4f0a=_0x13d800?_0x453540[_0x1dbf('0x27')]:_0x47c931[_0x1dbf('0x24')]+_0x47c931[_0x1dbf('0x26')];var _0xeba33b;if(_0x2d4f0a>=_0x1c9191){_0x2d4f0a=_0x1c9191;_0xeba33b=0xc8;}else{_0xeba33b=0xce;}_0x5367ce[_0x1dbf('0x22')](_0xeba33b);return _0x5367ce[_0x1dbf('0x28')](_0x1dbf('0x29'),_0x2aad35+'-'+_0x2d4f0a+'/'+_0x1c9191)[_0x1dbf('0x23')](_0x453540);}return null;};}function patchUpdates(_0x54f5de){return function(_0x43f767){try{jsonpatch[_0x1dbf('0x2a')](_0x43f767,_0x54f5de,!![]);}catch(_0x1311ab){return BPromise[_0x1dbf('0x2b')](_0x1311ab);}return _0x43f767[_0x1dbf('0x2c')]();};}function saveUpdates(_0x52d736,_0x4d5667){return function(_0x9c45ac){if(_0x9c45ac){return _0x9c45ac[_0x1dbf('0x2d')](_0x52d736)[_0x1dbf('0x2e')](function(_0x31a0d9){return _0x31a0d9;});}return null;};}function removeEntity(_0x58665e,_0x3db728){return function(_0x24d06c){if(_0x24d06c){return _0x24d06c[_0x1dbf('0x2f')]()[_0x1dbf('0x2e')](function(){var _0xd2f75c=_0x24d06c[_0x1dbf('0x30')]({'plain':!![]});var _0x58927f='CustomDashboards';return db[_0x1dbf('0x31')][_0x1dbf('0x2f')]({'where':{'type':_0x58927f,'resourceId':_0xd2f75c['id']}})['then'](function(){return _0x24d06c;});})[_0x1dbf('0x2e')](function(){_0x58665e['status'](0xcc)[_0x1dbf('0x32')]();});}};}function handleEntityNotFound(_0x1610d4,_0x320db3){return function(_0x447218){if(!_0x447218){_0x1610d4['sendStatus'](0x194);}return _0x447218;};}function handleError(_0x21411b,_0x193ed6){_0x193ed6=_0x193ed6||0x1f4;return function(_0x36c115){logger[_0x1dbf('0x33')](_0x36c115[_0x1dbf('0x34')]);if(_0x36c115[_0x1dbf('0x35')]){delete _0x36c115[_0x1dbf('0x35')];}_0x21411b['status'](_0x193ed6)[_0x1dbf('0x36')](_0x36c115);};}exports[_0x1dbf('0x37')]=function(_0x43e545,_0x55e96f){var _0x4d114d={},_0x1f7eb6={},_0x10d952={'count':0x0,'rows':[]};var _0x8cc6b=_['map'](db[_0x1dbf('0x38')][_0x1dbf('0x39')],function(_0x1b4439){return{'name':_0x1b4439[_0x1dbf('0x3a')],'type':_0x1b4439[_0x1dbf('0x3b')]['key']};});_0x1f7eb6[_0x1dbf('0x3c')]=_[_0x1dbf('0x3d')](_0x8cc6b,_0x1dbf('0x35'));_0x1f7eb6[_0x1dbf('0x3e')]=_[_0x1dbf('0x3f')](_0x43e545[_0x1dbf('0x3e')]);_0x1f7eb6[_0x1dbf('0x40')]=_[_0x1dbf('0x41')](_0x1f7eb6[_0x1dbf('0x3c')],_0x1f7eb6[_0x1dbf('0x3e')]);_0x4d114d['attributes']=_[_0x1dbf('0x41')](_0x1f7eb6[_0x1dbf('0x3c')],qs[_0x1dbf('0x42')](_0x43e545[_0x1dbf('0x3e')][_0x1dbf('0x42')]));_0x4d114d['attributes']=_0x4d114d['attributes'][_0x1dbf('0x43')]?_0x4d114d['attributes']:_0x1f7eb6[_0x1dbf('0x3c')];if(!_0x43e545['query'][_0x1dbf('0x44')]('nolimit')){_0x4d114d[_0x1dbf('0x26')]=qs[_0x1dbf('0x26')](_0x43e545[_0x1dbf('0x3e')][_0x1dbf('0x26')]);_0x4d114d['offset']=qs['offset'](_0x43e545[_0x1dbf('0x3e')][_0x1dbf('0x24')]);}_0x4d114d[_0x1dbf('0x45')]=qs[_0x1dbf('0x46')](_0x43e545[_0x1dbf('0x3e')][_0x1dbf('0x46')]);_0x4d114d[_0x1dbf('0x47')]=qs[_0x1dbf('0x40')](_[_0x1dbf('0x48')](_0x43e545['query'],_0x1f7eb6[_0x1dbf('0x40')]),_0x8cc6b);if(_0x43e545[_0x1dbf('0x3e')]['filter']){_0x4d114d[_0x1dbf('0x47')]=_[_0x1dbf('0x49')](_0x4d114d[_0x1dbf('0x47')],{'$or':_[_0x1dbf('0x3d')](_0x8cc6b,function(_0x34408f){if(_0x34408f[_0x1dbf('0x3b')]!==_0x1dbf('0x4a')){var _0x3ed254={};_0x3ed254[_0x34408f[_0x1dbf('0x35')]]={'$like':'%'+_0x43e545['query'][_0x1dbf('0x4b')]+'%'};return _0x3ed254;}})});}_0x4d114d=_[_0x1dbf('0x49')]({},_0x4d114d,_0x43e545['options']);var _0x1fbb5d={'where':_0x4d114d[_0x1dbf('0x47')]};return db[_0x1dbf('0x38')][_0x1dbf('0x27')](_0x1fbb5d)[_0x1dbf('0x2e')](function(_0x3abfcc){_0x10d952['count']=_0x3abfcc;if(_0x43e545[_0x1dbf('0x3e')]['includeAll']){_0x4d114d[_0x1dbf('0x4c')]=[{'all':!![]}];}return db[_0x1dbf('0x38')]['findAll'](_0x4d114d);})[_0x1dbf('0x2e')](function(_0x1dc7b2){_0x10d952[_0x1dbf('0x4d')]=_0x1dc7b2;return _0x10d952;})[_0x1dbf('0x2e')](respondWithFilteredResult(_0x55e96f,_0x4d114d))[_0x1dbf('0x4e')](handleError(_0x55e96f,null));};exports['show']=function(_0x57b86a,_0x463641){var _0x4f28fe={'raw':![],'where':{'id':_0x57b86a[_0x1dbf('0x4f')]['id']}},_0x3a89ba={};_0x3a89ba[_0x1dbf('0x3c')]=_[_0x1dbf('0x3f')](db[_0x1dbf('0x38')][_0x1dbf('0x39')]);_0x3a89ba[_0x1dbf('0x3e')]=_[_0x1dbf('0x3f')](_0x57b86a[_0x1dbf('0x3e')]);_0x3a89ba['filters']=_[_0x1dbf('0x41')](_0x3a89ba['model'],_0x3a89ba[_0x1dbf('0x3e')]);_0x4f28fe[_0x1dbf('0x50')]=_[_0x1dbf('0x41')](_0x3a89ba[_0x1dbf('0x3c')],qs['fields'](_0x57b86a[_0x1dbf('0x3e')][_0x1dbf('0x42')]));_0x4f28fe[_0x1dbf('0x50')]=_0x4f28fe[_0x1dbf('0x50')][_0x1dbf('0x43')]?_0x4f28fe[_0x1dbf('0x50')]:_0x3a89ba[_0x1dbf('0x3c')];if(_0x57b86a[_0x1dbf('0x3e')]['includeAll']){_0x4f28fe[_0x1dbf('0x4c')]=[{'all':!![]}];}_0x4f28fe=_[_0x1dbf('0x49')]({},_0x4f28fe,_0x57b86a[_0x1dbf('0x51')]);return db['Dashboard']['find'](_0x4f28fe)[_0x1dbf('0x2e')](handleEntityNotFound(_0x463641,null))[_0x1dbf('0x2e')](respondWithResult(_0x463641,null))[_0x1dbf('0x4e')](handleError(_0x463641,null));};exports['create']=function(_0x3063c3,_0xbbbc04){return db[_0x1dbf('0x38')][_0x1dbf('0x52')](_0x3063c3[_0x1dbf('0x53')],{})['then'](function(_0x47f197){var _0x120936=_0x3063c3[_0x1dbf('0x54')][_0x1dbf('0x30')]({'plain':!![]});if(!_0x120936)throw new Error(_0x1dbf('0x55'));if(_0x120936[_0x1dbf('0x56')]===_0x1dbf('0x54')){var _0x20b6fc=_0x47f197[_0x1dbf('0x30')]({'plain':!![]});var _0x4b64ae='CustomDashboards';return db[_0x1dbf('0x57')][_0x1dbf('0x58')]({'where':{'name':_0x4b64ae,'userProfileId':_0x120936[_0x1dbf('0x59')]},'raw':!![]})['then'](function(_0x3303c7){if(_0x3303c7&&_0x3303c7[_0x1dbf('0x5a')]===0x0){return db[_0x1dbf('0x31')][_0x1dbf('0x52')]({'name':_0x20b6fc['name'],'resourceId':_0x20b6fc['id'],'type':_0x3303c7[_0x1dbf('0x35')],'sectionId':_0x3303c7['id']},{})['then'](function(){return _0x47f197;});}else{return _0x47f197;}})[_0x1dbf('0x4e')](function(_0x52d5ca){logger[_0x1dbf('0x33')](_0x1dbf('0x5b'),_0x52d5ca);throw _0x52d5ca;});}return _0x47f197;})[_0x1dbf('0x2e')](respondWithResult(_0xbbbc04,0xc9))['catch'](handleError(_0xbbbc04,null));};exports[_0x1dbf('0x5c')]=function(_0xd948ee,_0x4f0708){var _0x4a35b1={'where':{'id':_0xd948ee['params']['id']}},_0x1c1da7={};_0x1c1da7[_0x1dbf('0x3c')]=_[_0x1dbf('0x3f')](db['Dashboard'][_0x1dbf('0x39')]);_0x4a35b1['attributes']=_[_0x1dbf('0x41')](_0x1c1da7['model'],qs[_0x1dbf('0x42')](_0xd948ee[_0x1dbf('0x3e')][_0x1dbf('0x42')]));_0x4a35b1[_0x1dbf('0x50')]=_0x4a35b1['attributes'][_0x1dbf('0x43')]?_0x4a35b1[_0x1dbf('0x50')]:_0x1c1da7['model'];if(_0xd948ee[_0x1dbf('0x3e')][_0x1dbf('0x5d')]){_0x4a35b1['include']=[{'all':!![]}];}_0x4a35b1=_[_0x1dbf('0x49')]({},_0x4a35b1,_0xd948ee['options']);return db['Dashboard'][_0x1dbf('0x58')](_0x4a35b1)[_0x1dbf('0x2e')](handleEntityNotFound(_0x4f0708,null))['then'](function(_0x39a546){if(_0x39a546){var _0x3347ab=_0x39a546['get']({'plain':!![]});_0x3347ab=qs[_0x1dbf('0x5e')](_0x3347ab,['id',_0x1dbf('0x5f'),'updatedAt']);_0xd948ee['body']=_['omit'](_0xd948ee['body'],['id',_0x1dbf('0x5f'),_0x1dbf('0x60')]);return db[_0x1dbf('0x38')][_0x1dbf('0x52')](_[_0x1dbf('0x49')](_0x3347ab,_0xd948ee[_0x1dbf('0x53')]),{'include':_0xd948ee[_0x1dbf('0x3e')][_0x1dbf('0x5d')]?[{'all':!![]}]:undefined})['then'](function(_0x8dcde6){var _0x4f9bef=_0xd948ee[_0x1dbf('0x54')][_0x1dbf('0x30')]({'plain':!![]});if(!_0x4f9bef)throw new Error(_0x1dbf('0x55'));if(_0x4f9bef['role']===_0x1dbf('0x54')){var _0x5922ca=_0x8dcde6['get']({'plain':!![]});var _0x241026=_0x1dbf('0x61');return db[_0x1dbf('0x57')][_0x1dbf('0x58')]({'where':{'name':_0x241026,'userProfileId':_0x4f9bef[_0x1dbf('0x59')]},'raw':!![]})['then'](function(_0xc82ffe){if(_0xc82ffe&&_0xc82ffe['autoAssociation']===0x0){return db[_0x1dbf('0x31')][_0x1dbf('0x52')]({'name':_0x5922ca['name'],'resourceId':_0x5922ca['id'],'type':_0xc82ffe[_0x1dbf('0x35')],'sectionId':_0xc82ffe['id']},{})['then'](function(){return _0x8dcde6;});}else{return _0x8dcde6;}})['catch'](function(_0x5c4627){logger[_0x1dbf('0x33')](_0x1dbf('0x5b'),_0x5c4627);throw _0x5c4627;});}return _0x8dcde6;});}})['then'](respondWithResult(_0x4f0708,0xc9))[_0x1dbf('0x4e')](handleError(_0x4f0708,null));};exports[_0x1dbf('0x2d')]=function(_0x4da993,_0x4ef49d){if(_0x4da993[_0x1dbf('0x53')]['id']){delete _0x4da993['body']['id'];}return db['Dashboard']['find']({'where':{'id':_0x4da993[_0x1dbf('0x4f')]['id']}})[_0x1dbf('0x2e')](handleEntityNotFound(_0x4ef49d,null))[_0x1dbf('0x2e')](saveUpdates(_0x4da993[_0x1dbf('0x53')],null))[_0x1dbf('0x2e')](respondWithResult(_0x4ef49d,null))[_0x1dbf('0x4e')](handleError(_0x4ef49d,null));};exports[_0x1dbf('0x2f')]=function(_0x26f976,_0x457027){return db[_0x1dbf('0x38')][_0x1dbf('0x58')]({'where':{'id':_0x26f976[_0x1dbf('0x4f')]['id']}})[_0x1dbf('0x2e')](handleEntityNotFound(_0x457027,null))['then'](removeEntity(_0x457027,null))[_0x1dbf('0x4e')](handleError(_0x457027,null));};function widgetAttributes(_0x1c9556){try{switch(_0x1c9556[_0x1dbf('0x3b')]){case'iframe':return[{'name':_0x1dbf('0x62'),'value':_0x1c9556[_0x1dbf('0x62')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556['attrs'][0x0]['value']:undefined)||_0x1dbf('0x64')}];case _0x1dbf('0x65'):return[{'name':_0x1dbf('0x66'),'value':_0x1c9556[_0x1dbf('0x66')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0]['value']:undefined)||''}];case _0x1dbf('0x67'):return[{'name':'attrHourFormat','value':_0x1c9556[_0x1dbf('0x68')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0][_0x1dbf('0x69')]:undefined)||_0x1dbf('0x6a')},{'name':_0x1dbf('0x6b'),'value':_0x1c9556[_0x1dbf('0x6b')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x1]?_0x1c9556[_0x1dbf('0x63')][0x1][_0x1dbf('0x69')]:undefined)||_0x1dbf('0x6c')},{'name':_0x1dbf('0x6d'),'value':_0x1c9556['attrFontSize']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x2]?_0x1c9556[_0x1dbf('0x63')][0x2][_0x1dbf('0x69')]:undefined)||0xc}];case _0x1dbf('0x6e'):return[{'name':_0x1dbf('0x6f'),'value':_0x1c9556['attrMetric']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0][_0x1dbf('0x69')]:undefined)||_0x1dbf('0x70')},{'name':_0x1dbf('0x71'),'value':_0x1c9556[_0x1dbf('0x71')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x1]?_0x1c9556[_0x1dbf('0x63')][0x1]['value']:undefined)||[]},{'name':_0x1dbf('0x6d'),'value':_0x1c9556[_0x1dbf('0x6d')]||(_0x1c9556['attrs']&&_0x1c9556[_0x1dbf('0x63')][0x2]?_0x1c9556['attrs'][0x2][_0x1dbf('0x69')]:undefined)||0x14},{'name':_0x1dbf('0x72'),'value':_0x1c9556['attrChannel']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x3]?_0x1c9556['attrs'][0x3][_0x1dbf('0x69')]:undefined)||_0x1dbf('0x73')},{'name':_0x1dbf('0x74'),'value':_0x1c9556['attrEmailAccounts']||(_0x1c9556['attrs']&&_0x1c9556[_0x1dbf('0x63')][0x4]?_0x1c9556[_0x1dbf('0x63')][0x4][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x75'),'value':_0x1c9556[_0x1dbf('0x75')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556['attrs'][0x5]?_0x1c9556[_0x1dbf('0x63')][0x5][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x76'),'value':_0x1c9556[_0x1dbf('0x76')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x6]?_0x1c9556['attrs'][0x6]['value']:undefined)||''},{'name':_0x1dbf('0x77'),'value':_0x1c9556['attrOpenchannelAccounts']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x7]?_0x1c9556[_0x1dbf('0x63')][0x7][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x78'),'value':_0x1c9556[_0x1dbf('0x78')]||(_0x1c9556['attrs']&&_0x1c9556['attrs'][0x8]?_0x1c9556[_0x1dbf('0x63')][0x8][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x79'),'value':_0x1c9556[_0x1dbf('0x79')]||(_0x1c9556['attrs']&&_0x1c9556[_0x1dbf('0x63')][0x9]?_0x1c9556[_0x1dbf('0x63')][0x9][_0x1dbf('0x69')]:undefined)||''}];case _0x1dbf('0x7a'):case'pie-chart':return[{'name':_0x1dbf('0x7b'),'value':_0x1c9556[_0x1dbf('0x7b')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0][_0x1dbf('0x69')]:undefined)||'total'},{'name':_0x1dbf('0x7c'),'value':_0x1c9556['attrSerie2']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x1]?_0x1c9556[_0x1dbf('0x63')][0x1]['value']:undefined)||null},{'name':_0x1dbf('0x7d'),'value':_0x1c9556[_0x1dbf('0x7d')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x2]?_0x1c9556[_0x1dbf('0x63')][0x2]['value']:undefined)||null},{'name':_0x1dbf('0x71'),'value':_0x1c9556[_0x1dbf('0x71')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x3]?_0x1c9556[_0x1dbf('0x63')][0x3][_0x1dbf('0x69')]:undefined)||[]},{'name':_0x1dbf('0x72'),'value':_0x1c9556['attrChannel']||(_0x1c9556['attrs']&&_0x1c9556[_0x1dbf('0x63')][0x4]?_0x1c9556['attrs'][0x4]['value']:undefined)||_0x1dbf('0x73')},{'name':_0x1dbf('0x74'),'value':_0x1c9556[_0x1dbf('0x74')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x5]?_0x1c9556['attrs'][0x5][_0x1dbf('0x69')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x1c9556['attrFaxAccounts']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556['attrs'][0x6]?_0x1c9556['attrs'][0x6][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x76'),'value':_0x1c9556['attrSmsAccounts']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x7]?_0x1c9556[_0x1dbf('0x63')][0x7][_0x1dbf('0x69')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1c9556[_0x1dbf('0x77')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x8]?_0x1c9556['attrs'][0x8][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x78'),'value':_0x1c9556['attrWhatsappAccounts']||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556['attrs'][0x9]?_0x1c9556[_0x1dbf('0x63')][0x9][_0x1dbf('0x69')]:undefined)||''},{'name':_0x1dbf('0x79'),'value':_0x1c9556[_0x1dbf('0x79')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0xa]?_0x1c9556[_0x1dbf('0x63')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':_0x1dbf('0x7e'),'type':_0x1c9556[_0x1dbf('0x7f')]||(_0x1c9556[_0x1dbf('0x63')]&&_0x1c9556[_0x1dbf('0x63')][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0]['type']:undefined)||null,'value':_0x1c9556[_0x1dbf('0x7e')]||(_0x1c9556['attrs']&&_0x1c9556['attrs'][0x0]?_0x1c9556[_0x1dbf('0x63')][0x0]['value']:undefined)||null},{'name':_0x1dbf('0x80'),'value':_0x1c9556[_0x1dbf('0x80')]||(_0x1c9556['attrs']&&_0x1c9556[_0x1dbf('0x63')][0x1]?_0x1c9556['attrs'][0x1][_0x1dbf('0x69')]:undefined)||0x0}];default:return[];}}catch(_0x4c0339){logger['error'](_0x1dbf('0x81'),JSON['stringify'](_0x4c0339));return[];}}exports['addItem']=function(_0x4a065d,_0x57874d,_0x12da5d){if(_0x4a065d[_0x1dbf('0x53')]['id']){delete _0x4a065d[_0x1dbf('0x53')]['id'];}return db[_0x1dbf('0x38')][_0x1dbf('0x58')]({'where':{'id':_0x4a065d[_0x1dbf('0x4f')]['id']}})['then'](handleEntityNotFound(_0x57874d,null))[_0x1dbf('0x2e')](function(_0x36fb4e){if(_0x36fb4e){_0x4a065d[_0x1dbf('0x53')][_0x1dbf('0x82')]=_0x36fb4e['id'];_0x4a065d[_0x1dbf('0x53')][_0x1dbf('0x63')]=widgetAttributes(_0x4a065d[_0x1dbf('0x53')]);return db[_0x1dbf('0x83')][_0x1dbf('0x52')](_0x4a065d[_0x1dbf('0x53')]);}})['then'](respondWithResult(_0x57874d,null))[_0x1dbf('0x4e')](handleError(_0x57874d,null));};exports[_0x1dbf('0x84')]=function(_0x154ab9,_0x557910,_0x429c0d){var _0x5cc0e3={};var _0xd79f8e={};var _0x5dbcaa;var _0xe8606e;return db['Dashboard'][_0x1dbf('0x85')]({'where':{'id':_0x154ab9['params']['id']}})[_0x1dbf('0x2e')](handleEntityNotFound(_0x557910,null))[_0x1dbf('0x2e')](function(_0xedd3fe){if(_0xedd3fe){_0x5dbcaa=_0xedd3fe;_0xd79f8e['model']=_[_0x1dbf('0x3f')](db['DashboardItem'][_0x1dbf('0x39')]);_0xd79f8e[_0x1dbf('0x3e')]=_[_0x1dbf('0x3f')](_0x154ab9[_0x1dbf('0x3e')]);_0xd79f8e[_0x1dbf('0x40')]=_['intersection'](_0xd79f8e[_0x1dbf('0x3c')],_0xd79f8e[_0x1dbf('0x3e')]);_0x5cc0e3[_0x1dbf('0x50')]=_[_0x1dbf('0x41')](_0xd79f8e['model'],qs[_0x1dbf('0x42')](_0x154ab9['query'][_0x1dbf('0x42')]));_0x5cc0e3[_0x1dbf('0x50')]=_0x5cc0e3['attributes'][_0x1dbf('0x43')]?_0x5cc0e3[_0x1dbf('0x50')]:_0xd79f8e[_0x1dbf('0x3c')];_0x5cc0e3['order']=qs['sort'](_0x154ab9[_0x1dbf('0x3e')][_0x1dbf('0x46')]);_0x5cc0e3[_0x1dbf('0x47')]=qs[_0x1dbf('0x40')](_[_0x1dbf('0x48')](_0x154ab9[_0x1dbf('0x3e')],_0xd79f8e[_0x1dbf('0x40')]));if(_0x154ab9[_0x1dbf('0x3e')][_0x1dbf('0x4b')]){_0x5cc0e3['where']=_[_0x1dbf('0x49')](_0x5cc0e3[_0x1dbf('0x47')],{'$or':_['map'](_0x5cc0e3[_0x1dbf('0x50')],function(_0x1ef033){var _0x299db5={};_0x299db5[_0x1ef033]={'$like':'%'+_0x154ab9['query'][_0x1dbf('0x4b')]+'%'};return _0x299db5;})});}_0x5cc0e3=_[_0x1dbf('0x49')]({},_0x5cc0e3,_0x154ab9[_0x1dbf('0x51')]);return _0x5dbcaa[_0x1dbf('0x84')](_0x5cc0e3);}})[_0x1dbf('0x2e')](function(_0x83f847){if(_0x83f847){_0xe8606e=_0x83f847['length'];if(!_0x154ab9['query']['hasOwnProperty'](_0x1dbf('0x86'))){_0x5cc0e3[_0x1dbf('0x26')]=qs[_0x1dbf('0x26')](_0x154ab9['query'][_0x1dbf('0x26')]);_0x5cc0e3[_0x1dbf('0x24')]=qs[_0x1dbf('0x24')](_0x154ab9[_0x1dbf('0x3e')][_0x1dbf('0x24')]);}return _0x5dbcaa[_0x1dbf('0x84')](_0x5cc0e3);}})[_0x1dbf('0x2e')](function(_0x283675){if(_0x283675){return _0x283675?{'count':_0xe8606e,'rows':_0x283675}:null;}})[_0x1dbf('0x2e')](respondWithResult(_0x557910,null))[_0x1dbf('0x4e')](handleError(_0x557910,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ad82fcf..21494ec 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 _0x01cc=['remove','emit','exports','events','../../mysqldb','Dashboard','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01cc,0xbb));var _0xc01c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x01cc[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xc01c('0x0'));var Dashboard=require(_0xc01c('0x1'))['db'][_0xc01c('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc01c('0x3')](0x0);var events={'afterCreate':_0xc01c('0x4'),'afterUpdate':'update','afterDestroy':_0xc01c('0x5')};function emitEvent(_0x19b757){return function(_0x5be2d1,_0x7cb9b8,_0x310b68){DashboardEvents[_0xc01c('0x6')](_0x19b757+':'+_0x5be2d1['id'],_0x5be2d1);DashboardEvents['emit'](_0x19b757,_0x5be2d1);_0x310b68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xc01c('0x7')]=DashboardEvents; \ No newline at end of file +var _0x0eea=['setMaxListeners','save','emit','hasOwnProperty','../../mysqldb','Dashboard'];(function(_0x459eff,_0x563145){var _0x2e9258=function(_0x504aef){while(--_0x504aef){_0x459eff['push'](_0x459eff['shift']());}};_0x2e9258(++_0x563145);}(_0x0eea,0xdc));var _0xa0ee=function(_0x2e7e0c,_0x2cf020){_0x2e7e0c=_0x2e7e0c-0x0;var _0x2cc3bb=_0x0eea[_0x2e7e0c];return _0x2cc3bb;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0xa0ee('0x0'))['db'][_0xa0ee('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa0ee('0x2')](0x0);var events={'afterCreate':_0xa0ee('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x121e6d){return function(_0xd77ec5,_0xa24ef5,_0x353920){DashboardEvents[_0xa0ee('0x4')](_0x121e6d+':'+_0xd77ec5['id'],_0xd77ec5);DashboardEvents[_0xa0ee('0x4')](_0x121e6d,_0xd77ec5);_0x353920(null);};}for(var e in events){if(events[_0xa0ee('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index baca086..3e1602e 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 _0x81b8=['define','Dashboard','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','exports'];(function(_0x504c5d,_0x27a75a){var _0x4d1821=function(_0x558ffe){while(--_0x558ffe){_0x504c5d['push'](_0x504c5d['shift']());}};_0x4d1821(++_0x27a75a);}(_0x81b8,0x1ce));var _0x881b=function(_0x385030,_0x37a17d){_0x385030=_0x385030-0x0;var _0x2607af=_0x81b8[_0x385030];return _0x2607af;};'use strict';var _=require(_0x881b('0x0'));var util=require(_0x881b('0x1'));var logger=require(_0x881b('0x2'))(_0x881b('0x3'));var moment=require(_0x881b('0x4'));var BPromise=require(_0x881b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x881b('0x6'));var attributes=require('./dashboard.attributes');module[_0x881b('0x7')]=function(_0x203c33,_0xfc215d){return _0x203c33[_0x881b('0x8')](_0x881b('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x601b=['dashboards','lodash','util','api','moment','bluebird','request-promise','rimraf','./dashboard.attributes','exports','define','Dashboard'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x601b,0x109));var _0xb601=function(_0x113f32,_0x4b7c3a){_0x113f32=_0x113f32-0x0;var _0x4a6ec5=_0x601b[_0x113f32];return _0x4a6ec5;};'use strict';var _=require(_0xb601('0x0'));var util=require(_0xb601('0x1'));var logger=require('../../config/logger')(_0xb601('0x2'));var moment=require(_0xb601('0x3'));var BPromise=require(_0xb601('0x4'));var rp=require(_0xb601('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb601('0x6'));var config=require('../../config/environment');var attributes=require(_0xb601('0x7'));module[_0xb601('0x8')]=function(_0x2f906c,_0x51592e){return _0x2f906c[_0xb601('0x9')](_0xb601('0xa'),attributes,{'tableName':_0xb601('0xb'),'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 ddef436..705d169 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 _0xd245=['./dashboard.socket','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xd245,0x14d));var _0x5d24=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xd245[_0x100682];return _0xcb6e87;};'use strict';var _=require('lodash');var util=require(_0x5d24('0x0'));var moment=require(_0x5d24('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d24('0x2'));var fs=require('fs');var Redis=require(_0x5d24('0x3'));var db=require(_0x5d24('0x4'))['db'];var utils=require(_0x5d24('0x5'));var logger=require(_0x5d24('0x6'))(_0x5d24('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d24('0x8'));var client=jayson[_0x5d24('0x9')][_0x5d24('0xa')]({'port':0x232a});config[_0x5d24('0xb')]=_[_0x5d24('0xc')](config[_0x5d24('0xb')],{'host':_0x5d24('0xd'),'port':0x18eb});var socket=require(_0x5d24('0xe'))(new Redis(config['redis']));require(_0x5d24('0xf'))['register'](socket);function respondWithRpcPromise(_0x613959,_0xdf32b7,_0x228bd5){return new BPromise(function(_0x5aaf3f,_0x33f17b){return client[_0x5d24('0x10')](_0x613959,_0x228bd5)[_0x5d24('0x11')](function(_0x3788ad){logger[_0x5d24('0x12')](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));logger[_0x5d24('0x15')](_0x5d24('0x16'),_0xdf32b7,_0x5d24('0x14'),JSON[_0x5d24('0x17')](_0x3788ad));if(_0x3788ad['error']){if(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x19')]===0x1f4){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x3788ad['error'][_0x5d24('0x1a')]);return _0x33f17b(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}logger['error'](_0x5d24('0x13'),_0xdf32b7,_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);return _0x5aaf3f(_0x3788ad[_0x5d24('0x18')][_0x5d24('0x1a')]);}else{logger['info'](_0x5d24('0x13'),_0xdf32b7,_0x5d24('0x14'));_0x5aaf3f(_0x3788ad[_0x5d24('0x1b')]['message']);}})[_0x5d24('0x1c')](function(_0x1f2f2f){logger[_0x5d24('0x18')](_0x5d24('0x13'),_0xdf32b7,_0x1f2f2f);_0x33f17b(_0x1f2f2f);});});} \ No newline at end of file +var _0xb9aa=['request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboard.socket'];(function(_0x4bbc17,_0x3ba8b4){var _0x46bf72=function(_0x17f23d){while(--_0x17f23d){_0x4bbc17['push'](_0x4bbc17['shift']());}};_0x46bf72(++_0x3ba8b4);}(_0xb9aa,0x194));var _0xab9a=function(_0x2f1345,_0x31d432){_0x2f1345=_0x2f1345-0x0;var _0x53a71c=_0xb9aa[_0x2f1345];return _0x53a71c;};'use strict';var _=require(_0xab9a('0x0'));var util=require('util');var moment=require(_0xab9a('0x1'));var BPromise=require(_0xab9a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9a('0x3'));var db=require(_0xab9a('0x4'))['db'];var utils=require(_0xab9a('0x5'));var logger=require(_0xab9a('0x6'))(_0xab9a('0x7'));var config=require(_0xab9a('0x8'));var jayson=require(_0xab9a('0x9'));var client=jayson[_0xab9a('0xa')]['http']({'port':0x232a});config[_0xab9a('0xb')]=_[_0xab9a('0xc')](config[_0xab9a('0xb')],{'host':_0xab9a('0xd'),'port':0x18eb});var socket=require(_0xab9a('0xe'))(new Redis(config[_0xab9a('0xb')]));require(_0xab9a('0xf'))['register'](socket);function respondWithRpcPromise(_0x40cb01,_0x472d45,_0x5ed120){return new BPromise(function(_0xe7d9d4,_0x5d56a2){return client[_0xab9a('0x10')](_0x40cb01,_0x5ed120)[_0xab9a('0x11')](function(_0x8f96e7){logger[_0xab9a('0x12')](_0xab9a('0x13'),_0x472d45,_0xab9a('0x14'));logger[_0xab9a('0x15')](_0xab9a('0x16'),_0x472d45,_0xab9a('0x14'),JSON[_0xab9a('0x17')](_0x8f96e7));if(_0x8f96e7[_0xab9a('0x18')]){if(_0x8f96e7[_0xab9a('0x18')][_0xab9a('0x19')]===0x1f4){logger[_0xab9a('0x18')](_0xab9a('0x13'),_0x472d45,_0x8f96e7[_0xab9a('0x18')][_0xab9a('0x1a')]);return _0x5d56a2(_0x8f96e7[_0xab9a('0x18')][_0xab9a('0x1a')]);}logger['error'](_0xab9a('0x13'),_0x472d45,_0x8f96e7[_0xab9a('0x18')]['message']);return _0xe7d9d4(_0x8f96e7['error']['message']);}else{logger[_0xab9a('0x12')](_0xab9a('0x13'),_0x472d45,_0xab9a('0x14'));_0xe7d9d4(_0x8f96e7[_0xab9a('0x1b')][_0xab9a('0x1a')]);}})['catch'](function(_0x55ba5c){logger[_0xab9a('0x18')]('Dashboard,\x20%s,\x20%s',_0x472d45,_0x55ba5c);_0x5d56a2(_0x55ba5c);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a6d9a94..2e9ba17 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 _0x11dc=['./dashboard.events','save','remove','update','emit','removeListener','dashboard:'];(function(_0x289333,_0x31cb26){var _0x3237d3=function(_0x13f6c8){while(--_0x13f6c8){_0x289333['push'](_0x289333['shift']());}};_0x3237d3(++_0x31cb26);}(_0x11dc,0x1c7));var _0xc11d=function(_0x144556,_0x5ca316){_0x144556=_0x144556-0x0;var _0x1bb692=_0x11dc[_0x144556];return _0x1bb692;};'use strict';var DashboardEvents=require(_0xc11d('0x0'));var events=[_0xc11d('0x1'),_0xc11d('0x2'),_0xc11d('0x3')];function createListener(_0x39af17,_0x45863e){return function(_0x5863ce){_0x45863e[_0xc11d('0x4')](_0x39af17,_0x5863ce);};}function removeListener(_0x5b4660,_0x2f109b){return function(){DashboardEvents[_0xc11d('0x5')](_0x5b4660,_0x2f109b);};}exports['register']=function(_0x9860a0){for(var _0x258e1f=0x0,_0x5e7264=events['length'];_0x258e1f<_0x5e7264;_0x258e1f++){var _0x325dbf=events[_0x258e1f];var _0x24c99b=createListener(_0xc11d('0x6')+_0x325dbf,_0x9860a0);DashboardEvents['on'](_0x325dbf,_0x24c99b);}}; \ No newline at end of file +var _0x11a9=['./dashboard.events','save','register','length','dashboard:'];(function(_0x1da53e,_0x2f1b03){var _0x1d9e57=function(_0xab627b){while(--_0xab627b){_0x1da53e['push'](_0x1da53e['shift']());}};_0x1d9e57(++_0x2f1b03);}(_0x11a9,0x19a));var _0x911a=function(_0x4032b8,_0x1fcfa6){_0x4032b8=_0x4032b8-0x0;var _0x5ae29f=_0x11a9[_0x4032b8];return _0x5ae29f;};'use strict';var DashboardEvents=require(_0x911a('0x0'));var events=[_0x911a('0x1'),'remove','update'];function createListener(_0x52eed8,_0x3b6dc9){return function(_0x5cde49){_0x3b6dc9['emit'](_0x52eed8,_0x5cde49);};}function removeListener(_0x410ebf,_0x5df59e){return function(){DashboardEvents['removeListener'](_0x410ebf,_0x5df59e);};}exports[_0x911a('0x2')]=function(_0x28f5e7){for(var _0x19cd75=0x0,_0x5c69b4=events[_0x911a('0x3')];_0x19cd75<_0x5c69b4;_0x19cd75++){var _0x44be19=events[_0x19cd75];var _0x31bee4=createListener(_0x911a('0x4')+_0x44be19,_0x28f5e7);DashboardEvents['on'](_0x44be19,_0x31bee4);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 37d7875..fe8e951 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 _0x8e16=['put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','/:id/clone','clone','addItem'];(function(_0x57f2cd,_0x3d117a){var _0xc1a150=function(_0x851f3d){while(--_0x851f3d){_0x57f2cd['push'](_0x57f2cd['shift']());}};_0xc1a150(++_0x3d117a);}(_0x8e16,0xa6));var _0x68e1=function(_0x2400b9,_0x104482){_0x2400b9=_0x2400b9-0x0;var _0x1c1800=_0x8e16[_0x2400b9];return _0x1c1800;};'use strict';var multer=require('multer');var util=require(_0x68e1('0x0'));var path=require(_0x68e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x68e1('0x2'));var router=express['Router']();var fs_extra=require(_0x68e1('0x3'));var auth=require(_0x68e1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x68e1('0x5'));var controller=require(_0x68e1('0x6'));router[_0x68e1('0x7')]('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0x9')]);router[_0x68e1('0x7')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller[_0x68e1('0xb')]);router[_0x68e1('0x7')](_0x68e1('0xc'),auth[_0x68e1('0x8')](),controller['getItems']);router[_0x68e1('0xd')]('/',auth[_0x68e1('0x8')](),controller[_0x68e1('0xe')]);router[_0x68e1('0xd')](_0x68e1('0xf'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x10')]);router[_0x68e1('0xd')](_0x68e1('0xc'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x11')]);router[_0x68e1('0x12')](_0x68e1('0xa'),auth[_0x68e1('0x8')](),controller[_0x68e1('0x13')]);router[_0x68e1('0x14')]('/:id',auth[_0x68e1('0x8')](),controller[_0x68e1('0x15')]);module[_0x68e1('0x16')]=router; \ No newline at end of file +var _0x6b41=['getItems','post','create','clone','addItem','put','/:id','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','/:id/items'];(function(_0x38cd34,_0x4d0c52){var _0x3d53fe=function(_0x49f9ad){while(--_0x49f9ad){_0x38cd34['push'](_0x38cd34['shift']());}};_0x3d53fe(++_0x4d0c52);}(_0x6b41,0x15b));var _0x16b4=function(_0x39b027,_0x3d182c){_0x39b027=_0x39b027-0x0;var _0xe27934=_0x6b41[_0x39b027];return _0xe27934;};'use strict';var multer=require(_0x16b4('0x0'));var util=require(_0x16b4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x16b4('0x2'));var router=express[_0x16b4('0x3')]();var fs_extra=require(_0x16b4('0x4'));var auth=require(_0x16b4('0x5'));var interaction=require(_0x16b4('0x6'));var config=require(_0x16b4('0x7'));var controller=require('./dashboard.controller');router['get']('/',auth[_0x16b4('0x8')](),controller[_0x16b4('0x9')]);router[_0x16b4('0xa')]('/:id',auth[_0x16b4('0x8')](),controller[_0x16b4('0xb')]);router['get'](_0x16b4('0xc'),auth[_0x16b4('0x8')](),controller[_0x16b4('0xd')]);router[_0x16b4('0xe')]('/',auth[_0x16b4('0x8')](),controller[_0x16b4('0xf')]);router['post']('/:id/clone',auth[_0x16b4('0x8')](),controller[_0x16b4('0x10')]);router[_0x16b4('0xe')](_0x16b4('0xc'),auth[_0x16b4('0x8')](),controller[_0x16b4('0x11')]);router[_0x16b4('0x12')](_0x16b4('0x13'),auth['isAuthenticated'](),controller[_0x16b4('0x14')]);router[_0x16b4('0x15')](_0x16b4('0x13'),auth[_0x16b4('0x8')](),controller[_0x16b4('0x16')]);module[_0x16b4('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3975f8e..3e13215 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 _0x5fc3=['squel','exports','STRING','TEXT','long','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11f0e3,_0x5170bc){_0x11f0e3=_0x11f0e3-0x0;var _0x2892e8=_0x5fc3[_0x11f0e3];return _0x2892e8;};'use strict';var Sequelize=require(_0x35fc('0x0'));var squel=require(_0x35fc('0x1'));var _=require('lodash');module[_0x35fc('0x2')]={'title':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x35fc('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x35fc('0x4')](_0x35fc('0x5')),'get':function(){try{return JSON['parse'](this[_0x35fc('0x6')](_0x35fc('0x7')));}catch(_0x186a06){return[];}},'set':function(_0x5b85ad){try{this['setDataValue'](_0x35fc('0x7'),JSON['stringify'](_0x5b85ad));}catch(_0x16e153){this[_0x35fc('0x8')](_0x35fc('0x7'),JSON[_0x35fc('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x35fc('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x35fc('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x35fc('0x3')],'allowNull':![],'defaultValue':_0x35fc('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x35fc('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x35fc('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x2bd8=['TEXT','long','parse','attrs','stringify','setDataValue','INTEGER','sequelize','lodash','exports','STRING'];(function(_0x3fbd1a,_0x48856f){var _0x2a7b57=function(_0x202871){while(--_0x202871){_0x3fbd1a['push'](_0x3fbd1a['shift']());}};_0x2a7b57(++_0x48856f);}(_0x2bd8,0x130));var _0x82bd=function(_0x3b7990,_0x4f2e7a){_0x3b7990=_0x3b7990-0x0;var _0x4e2ed4=_0x2bd8[_0x3b7990];return _0x4e2ed4;};'use strict';var Sequelize=require(_0x82bd('0x0'));var squel=require('squel');var _=require(_0x82bd('0x1'));module[_0x82bd('0x2')]={'title':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x82bd('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x82bd('0x4')](_0x82bd('0x5')),'get':function(){try{return JSON[_0x82bd('0x6')](this['getDataValue'](_0x82bd('0x7')));}catch(_0x2e1a98){return[];}},'set':function(_0x3bf810){try{this['setDataValue'](_0x82bd('0x7'),JSON[_0x82bd('0x8')](_0x3bf810));}catch(_0x226f60){this[_0x82bd('0x9')]('attrs',JSON[_0x82bd('0x8')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x82bd('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x82bd('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x82bd('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index b5ef569..dac1257 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 _0x9c63=['name','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','find','catch','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x43dbff,_0x59f501){var _0xca6537=function(_0xd46f81){while(--_0xd46f81){_0x43dbff['push'](_0x43dbff['shift']());}};_0xca6537(++_0x59f501);}(_0x9c63,0x1a7));var _0x39c6=function(_0x1ae66f,_0x3fce21){_0x1ae66f=_0x1ae66f-0x0;var _0x56a591=_0x9c63[_0x1ae66f];return _0x56a591;};'use strict';var emlformat=require(_0x39c6('0x0'));var rimraf=require(_0x39c6('0x1'));var zipdir=require(_0x39c6('0x2'));var jsonpatch=require(_0x39c6('0x3'));var rp=require(_0x39c6('0x4'));var moment=require('moment');var BPromise=require(_0x39c6('0x5'));var Mustache=require(_0x39c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x39c6('0x7'));var csv=require(_0x39c6('0x8'));var ejs=require(_0x39c6('0x9'));var fs=require('fs');var fs_extra=require(_0x39c6('0xa'));var _=require(_0x39c6('0xb'));var squel=require(_0x39c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39c6('0xd'));var deskjs=require(_0x39c6('0xe'));var toCsv=require(_0x39c6('0x8'));var querystring=require(_0x39c6('0xf'));var Papa=require(_0x39c6('0x10'));var Redis=require('ioredis');var authService=require(_0x39c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x39c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c6('0x13'))(_0x39c6('0x14'));var utils=require(_0x39c6('0x15'));var config=require(_0x39c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x39c6('0x17'))['db'];config['redis']=_['defaults'](config[_0x39c6('0x18')],{'host':_0x39c6('0x19'),'port':0x18eb});var socket=require(_0x39c6('0x1a'))(new Redis(config[_0x39c6('0x18')]));require('./dashboardItem.socket')[_0x39c6('0x1b')](socket);function respondWithStatusCode(_0x4c83dc,_0xf713c8){_0xf713c8=_0xf713c8||0xcc;return function(_0x1c25a9){if(_0x1c25a9){return _0x4c83dc[_0x39c6('0x1c')](_0xf713c8);}return _0x4c83dc['status'](_0xf713c8)['end']();};}function respondWithResult(_0x4581d7,_0x1b8bc3){_0x1b8bc3=_0x1b8bc3||0xc8;return function(_0x50a267){if(_0x50a267){return _0x4581d7[_0x39c6('0x1d')](_0x1b8bc3)[_0x39c6('0x1e')](_0x50a267);}};}function respondWithFilteredResult(_0x10ffb8,_0x28779d){return function(_0x129613){if(_0x129613){var _0x3eaac7=typeof _0x28779d['offset']==='undefined'&&typeof _0x28779d['limit']==='undefined';var _0x524702=_0x129613[_0x39c6('0x1f')];var _0x5d4eec=_0x3eaac7?0x0:_0x28779d['offset'];var _0x26d07b=_0x3eaac7?_0x129613[_0x39c6('0x1f')]:_0x28779d[_0x39c6('0x20')]+_0x28779d[_0x39c6('0x21')];var _0x5608dd;if(_0x26d07b>=_0x524702){_0x26d07b=_0x524702;_0x5608dd=0xc8;}else{_0x5608dd=0xce;}_0x10ffb8['status'](_0x5608dd);return _0x10ffb8['set'](_0x39c6('0x22'),_0x5d4eec+'-'+_0x26d07b+'/'+_0x524702)['json'](_0x129613);}return null;};}function patchUpdates(_0x5d4083){return function(_0x58d69a){try{jsonpatch[_0x39c6('0x23')](_0x58d69a,_0x5d4083,!![]);}catch(_0x358f6f){return BPromise[_0x39c6('0x24')](_0x358f6f);}return _0x58d69a[_0x39c6('0x25')]();};}function saveUpdates(_0x33132f,_0x19e54d){return function(_0x3497d3){if(_0x3497d3){return _0x3497d3[_0x39c6('0x26')](_0x33132f)[_0x39c6('0x27')](function(_0x2fd3a7){return _0x2fd3a7;});}return null;};}function removeEntity(_0x3018f6,_0x3e49ca){return function(_0xa177fc){if(_0xa177fc){return _0xa177fc[_0x39c6('0x28')]()[_0x39c6('0x27')](function(){_0x3018f6[_0x39c6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5985,_0x25d748){return function(_0x929a7b){if(!_0x929a7b){_0x3f5985['sendStatus'](0x194);}return _0x929a7b;};}function handleError(_0xf06e09,_0x348f90){_0x348f90=_0x348f90||0x1f4;return function(_0x185869){logger[_0x39c6('0x29')](_0x185869['stack']);if(_0x185869['name']){delete _0x185869[_0x39c6('0x2a')];}_0xf06e09[_0x39c6('0x1d')](_0x348f90)['send'](_0x185869);};}exports[_0x39c6('0x2b')]=function(_0x482aa9,_0x520e8a){var _0x21ca3f={'raw':![],'where':{'id':_0x482aa9[_0x39c6('0x2c')]['id']}},_0x2aeab0={};_0x2aeab0[_0x39c6('0x2d')]=_[_0x39c6('0x2e')](db[_0x39c6('0x2f')][_0x39c6('0x30')]);_0x2aeab0[_0x39c6('0x31')]=_[_0x39c6('0x2e')](_0x482aa9[_0x39c6('0x31')]);_0x2aeab0[_0x39c6('0x32')]=_[_0x39c6('0x33')](_0x2aeab0[_0x39c6('0x2d')],_0x2aeab0[_0x39c6('0x31')]);_0x21ca3f[_0x39c6('0x34')]=_[_0x39c6('0x33')](_0x2aeab0[_0x39c6('0x2d')],qs['fields'](_0x482aa9['query'][_0x39c6('0x35')]));_0x21ca3f[_0x39c6('0x34')]=_0x21ca3f[_0x39c6('0x34')][_0x39c6('0x36')]?_0x21ca3f[_0x39c6('0x34')]:_0x2aeab0[_0x39c6('0x2d')];if(_0x482aa9[_0x39c6('0x31')]['includeAll']){_0x21ca3f[_0x39c6('0x37')]=[{'all':!![]}];}_0x21ca3f=_[_0x39c6('0x38')]({},_0x21ca3f,_0x482aa9['options']);return db['DashboardItem'][_0x39c6('0x39')](_0x21ca3f)[_0x39c6('0x27')](handleEntityNotFound(_0x520e8a,null))[_0x39c6('0x27')](respondWithResult(_0x520e8a,null))[_0x39c6('0x3a')](handleError(_0x520e8a,null));};exports[_0x39c6('0x28')]=function(_0x2ec74d,_0x321f5a){return db[_0x39c6('0x2f')][_0x39c6('0x39')]({'where':{'id':_0x2ec74d[_0x39c6('0x2c')]['id']}})[_0x39c6('0x27')](handleEntityNotFound(_0x321f5a,null))[_0x39c6('0x27')](removeEntity(_0x321f5a,null))[_0x39c6('0x3a')](handleError(_0x321f5a,null));};function widgetAttributes(_0x52404e){try{switch(_0x52404e['type']){case _0x39c6('0x3b'):return[{'name':_0x39c6('0x3c'),'value':_0x52404e[_0x39c6('0x3c')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||_0x39c6('0x3f')}];case'custom':return[{'name':'attrPath','value':_0x52404e[_0x39c6('0x40')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||''}];case _0x39c6('0x41'):return[{'name':'attrHourFormat','value':_0x52404e[_0x39c6('0x42')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||_0x39c6('0x43')},{'name':_0x39c6('0x44'),'value':_0x52404e[_0x39c6('0x44')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x1]?_0x52404e['attrs'][0x1][_0x39c6('0x3e')]:undefined)||'0.00'},{'name':_0x39c6('0x45'),'value':_0x52404e['attrFontSize']||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x2]?_0x52404e[_0x39c6('0x3d')][0x2][_0x39c6('0x3e')]:undefined)||0xc}];case'counter':return[{'name':_0x39c6('0x46'),'value':_0x52404e[_0x39c6('0x46')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x52404e[_0x39c6('0x47')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||[]},{'name':'attrFontSize','value':_0x52404e[_0x39c6('0x45')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x2]?_0x52404e[_0x39c6('0x3d')][0x2][_0x39c6('0x3e')]:undefined)||0x14},{'name':_0x39c6('0x48'),'value':_0x52404e['attrChannel']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x3]?_0x52404e[_0x39c6('0x3d')][0x3][_0x39c6('0x3e')]:undefined)||_0x39c6('0x49')},{'name':'attrEmailAccounts','value':_0x52404e[_0x39c6('0x4a')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x4]?_0x52404e[_0x39c6('0x3d')][0x4][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4b'),'value':_0x52404e[_0x39c6('0x4b')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x5]?_0x52404e[_0x39c6('0x3d')][0x5]['value']:undefined)||''},{'name':_0x39c6('0x4c'),'value':_0x52404e[_0x39c6('0x4c')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x6]?_0x52404e[_0x39c6('0x3d')][0x6][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4d'),'value':_0x52404e[_0x39c6('0x4d')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x7]?_0x52404e[_0x39c6('0x3d')][0x7][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4e'),'value':_0x52404e['attrWhatsappAccounts']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x8]?_0x52404e[_0x39c6('0x3d')][0x8]['value']:undefined)||''},{'name':_0x39c6('0x4f'),'value':_0x52404e[_0x39c6('0x4f')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x9]?_0x52404e[_0x39c6('0x3d')][0x9][_0x39c6('0x3e')]:undefined)||''}];case _0x39c6('0x50'):case _0x39c6('0x51'):return[{'name':_0x39c6('0x52'),'value':_0x52404e[_0x39c6('0x52')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||'total'},{'name':_0x39c6('0x53'),'value':_0x52404e[_0x39c6('0x53')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||null},{'name':_0x39c6('0x54'),'value':_0x52404e[_0x39c6('0x54')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x2]?_0x52404e[_0x39c6('0x3d')][0x2]['value']:undefined)||null},{'name':_0x39c6('0x47'),'value':_0x52404e[_0x39c6('0x47')]||(_0x52404e['attrs']&&_0x52404e['attrs'][0x3]?_0x52404e[_0x39c6('0x3d')][0x3][_0x39c6('0x3e')]:undefined)||[]},{'name':_0x39c6('0x48'),'value':_0x52404e[_0x39c6('0x48')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x4]?_0x52404e['attrs'][0x4]['value']:undefined)||_0x39c6('0x49')},{'name':_0x39c6('0x4a'),'value':_0x52404e[_0x39c6('0x4a')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x5]?_0x52404e['attrs'][0x5][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4b'),'value':_0x52404e[_0x39c6('0x4b')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x6]?_0x52404e[_0x39c6('0x3d')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x52404e[_0x39c6('0x4c')]||(_0x52404e['attrs']&&_0x52404e[_0x39c6('0x3d')][0x7]?_0x52404e[_0x39c6('0x3d')][0x7][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4d'),'value':_0x52404e[_0x39c6('0x4d')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x8]?_0x52404e[_0x39c6('0x3d')][0x8][_0x39c6('0x3e')]:undefined)||''},{'name':_0x39c6('0x4e'),'value':_0x52404e['attrWhatsappAccounts']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e['attrs'][0x9]?_0x52404e[_0x39c6('0x3d')][0x9]['value']:undefined)||''},{'name':_0x39c6('0x4f'),'value':_0x52404e[_0x39c6('0x4f')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0xa]?_0x52404e[_0x39c6('0x3d')][0xa]['value']:undefined)||''}];case _0x39c6('0x55'):return[{'name':_0x39c6('0x56'),'type':_0x52404e['reportType']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x57')]:undefined)||null,'value':_0x52404e[_0x39c6('0x56')]||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x0]?_0x52404e[_0x39c6('0x3d')][0x0][_0x39c6('0x3e')]:undefined)||null},{'name':_0x39c6('0x58'),'value':_0x52404e['attrRefresh']||(_0x52404e[_0x39c6('0x3d')]&&_0x52404e[_0x39c6('0x3d')][0x1]?_0x52404e[_0x39c6('0x3d')][0x1][_0x39c6('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0xd43d54){logger['error'](_0x39c6('0x59'),JSON[_0x39c6('0x5a')](_0xd43d54));return[];}}exports[_0x39c6('0x5b')]=function(_0x151c13,_0x1300a){if(_0x151c13[_0x39c6('0x5c')]){_0x151c13['body']['attrs']=widgetAttributes(_0x151c13[_0x39c6('0x5c')]);}return db[_0x39c6('0x2f')]['create'](_0x151c13[_0x39c6('0x5c')],{})[_0x39c6('0x27')](respondWithResult(_0x1300a,0xc9))['catch'](handleError(_0x1300a,null));};exports[_0x39c6('0x26')]=function(_0x5bd7db,_0x14182d){if(_0x5bd7db[_0x39c6('0x5c')]['id']){delete _0x5bd7db['body']['id'];}_0x5bd7db[_0x39c6('0x5c')][_0x39c6('0x3d')]=widgetAttributes(_0x5bd7db[_0x39c6('0x5c')]);return db[_0x39c6('0x2f')]['find']({'where':{'id':_0x5bd7db[_0x39c6('0x2c')]['id']}})['then'](handleEntityNotFound(_0x14182d,null))[_0x39c6('0x27')](saveUpdates(_0x5bd7db['body'],null))[_0x39c6('0x27')](respondWithResult(_0x14182d,null))[_0x39c6('0x3a')](handleError(_0x14182d,null));}; \ No newline at end of file +var _0x539d=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','name','send','params','model','keys','DashboardItem','query','intersection','attributes','fields','length','include','merge','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','update','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x282916,_0x29c453){var _0x317b39=function(_0x52a106){while(--_0x52a106){_0x282916['push'](_0x282916['shift']());}};_0x317b39(++_0x29c453);}(_0x539d,0x17b));var _0xd539=function(_0x30fdf9,_0x89096d){_0x30fdf9=_0x30fdf9-0x0;var _0x3c43bb=_0x539d[_0x30fdf9];return _0x3c43bb;};'use strict';var emlformat=require(_0xd539('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd539('0x1'));var jsonpatch=require(_0xd539('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd539('0x3'));var Mustache=require(_0xd539('0x4'));var util=require(_0xd539('0x5'));var path=require(_0xd539('0x6'));var sox=require(_0xd539('0x7'));var csv=require('to-csv');var ejs=require(_0xd539('0x8'));var fs=require('fs');var fs_extra=require(_0xd539('0x9'));var _=require(_0xd539('0xa'));var squel=require(_0xd539('0xb'));var crypto=require(_0xd539('0xc'));var jsforce=require(_0xd539('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd539('0xe'));var querystring=require(_0xd539('0xf'));var Papa=require(_0xd539('0x10'));var Redis=require(_0xd539('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd539('0x12'));var hardwareService=require(_0xd539('0x13'));var logger=require(_0xd539('0x14'))(_0xd539('0x15'));var utils=require(_0xd539('0x16'));var config=require(_0xd539('0x17'));var licenseUtil=require(_0xd539('0x18'));var db=require(_0xd539('0x19'))['db'];config['redis']=_[_0xd539('0x1a')](config[_0xd539('0x1b')],{'host':_0xd539('0x1c'),'port':0x18eb});var socket=require(_0xd539('0x1d'))(new Redis(config[_0xd539('0x1b')]));require(_0xd539('0x1e'))['register'](socket);function respondWithStatusCode(_0x278f49,_0x6ef028){_0x6ef028=_0x6ef028||0xcc;return function(_0x1fbb31){if(_0x1fbb31){return _0x278f49[_0xd539('0x1f')](_0x6ef028);}return _0x278f49[_0xd539('0x20')](_0x6ef028)[_0xd539('0x21')]();};}function respondWithResult(_0x30aea1,_0xe32f19){_0xe32f19=_0xe32f19||0xc8;return function(_0x30414e){if(_0x30414e){return _0x30aea1[_0xd539('0x20')](_0xe32f19)[_0xd539('0x22')](_0x30414e);}};}function respondWithFilteredResult(_0x54d8ff,_0x363035){return function(_0x41fb1e){if(_0x41fb1e){var _0x6d6bbe=typeof _0x363035[_0xd539('0x23')]===_0xd539('0x24')&&typeof _0x363035[_0xd539('0x25')]===_0xd539('0x24');var _0x1714cf=_0x41fb1e['count'];var _0x4ce589=_0x6d6bbe?0x0:_0x363035[_0xd539('0x23')];var _0x360ceb=_0x6d6bbe?_0x41fb1e[_0xd539('0x26')]:_0x363035[_0xd539('0x23')]+_0x363035['limit'];var _0x91917b;if(_0x360ceb>=_0x1714cf){_0x360ceb=_0x1714cf;_0x91917b=0xc8;}else{_0x91917b=0xce;}_0x54d8ff[_0xd539('0x20')](_0x91917b);return _0x54d8ff[_0xd539('0x27')](_0xd539('0x28'),_0x4ce589+'-'+_0x360ceb+'/'+_0x1714cf)[_0xd539('0x22')](_0x41fb1e);}return null;};}function patchUpdates(_0x13445e){return function(_0x38985c){try{jsonpatch[_0xd539('0x29')](_0x38985c,_0x13445e,!![]);}catch(_0x349610){return BPromise['reject'](_0x349610);}return _0x38985c[_0xd539('0x2a')]();};}function saveUpdates(_0x57789d,_0x3563f1){return function(_0x584642){if(_0x584642){return _0x584642['update'](_0x57789d)[_0xd539('0x2b')](function(_0xfd3352){return _0xfd3352;});}return null;};}function removeEntity(_0x1280c2,_0xc1789e){return function(_0x4e6152){if(_0x4e6152){return _0x4e6152[_0xd539('0x2c')]()['then'](function(){_0x1280c2[_0xd539('0x20')](0xcc)[_0xd539('0x21')]();});}};}function handleEntityNotFound(_0x247898,_0x86c2c2){return function(_0x5a9d68){if(!_0x5a9d68){_0x247898['sendStatus'](0x194);}return _0x5a9d68;};}function handleError(_0x24f94c,_0x40720f){_0x40720f=_0x40720f||0x1f4;return function(_0x4f717b){logger['error'](_0x4f717b['stack']);if(_0x4f717b[_0xd539('0x2d')]){delete _0x4f717b[_0xd539('0x2d')];}_0x24f94c[_0xd539('0x20')](_0x40720f)[_0xd539('0x2e')](_0x4f717b);};}exports['show']=function(_0x430840,_0x2662fe){var _0x516806={'raw':![],'where':{'id':_0x430840[_0xd539('0x2f')]['id']}},_0x1b0c81={};_0x1b0c81[_0xd539('0x30')]=_[_0xd539('0x31')](db[_0xd539('0x32')]['rawAttributes']);_0x1b0c81[_0xd539('0x33')]=_['keys'](_0x430840[_0xd539('0x33')]);_0x1b0c81['filters']=_[_0xd539('0x34')](_0x1b0c81['model'],_0x1b0c81[_0xd539('0x33')]);_0x516806[_0xd539('0x35')]=_[_0xd539('0x34')](_0x1b0c81[_0xd539('0x30')],qs[_0xd539('0x36')](_0x430840[_0xd539('0x33')][_0xd539('0x36')]));_0x516806[_0xd539('0x35')]=_0x516806[_0xd539('0x35')][_0xd539('0x37')]?_0x516806[_0xd539('0x35')]:_0x1b0c81['model'];if(_0x430840[_0xd539('0x33')]['includeAll']){_0x516806[_0xd539('0x38')]=[{'all':!![]}];}_0x516806=_[_0xd539('0x39')]({},_0x516806,_0x430840['options']);return db[_0xd539('0x32')][_0xd539('0x3a')](_0x516806)['then'](handleEntityNotFound(_0x2662fe,null))['then'](respondWithResult(_0x2662fe,null))[_0xd539('0x3b')](handleError(_0x2662fe,null));};exports[_0xd539('0x2c')]=function(_0x42fbbd,_0x243b38){return db['DashboardItem'][_0xd539('0x3a')]({'where':{'id':_0x42fbbd[_0xd539('0x2f')]['id']}})[_0xd539('0x2b')](handleEntityNotFound(_0x243b38,null))[_0xd539('0x2b')](removeEntity(_0x243b38,null))['catch'](handleError(_0x243b38,null));};function widgetAttributes(_0x443832){try{switch(_0x443832[_0xd539('0x3c')]){case _0xd539('0x3d'):return[{'name':_0xd539('0x3e'),'value':_0x443832[_0xd539('0x3e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x0]?_0x443832['attrs'][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x41')}];case _0xd539('0x42'):return[{'name':_0xd539('0x43'),'value':_0x443832['attrPath']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0]['value']:undefined)||''}];case _0xd539('0x44'):return[{'name':'attrHourFormat','value':_0x443832[_0xd539('0x45')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832['attrs'][0x0]['value']:undefined)||_0xd539('0x46')},{'name':_0xd539('0x47'),'value':_0x443832[_0xd539('0x47')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832[_0xd539('0x3f')][0x1]['value']:undefined)||_0xd539('0x48')},{'name':_0xd539('0x49'),'value':_0x443832[_0xd539('0x49')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x2]?_0x443832['attrs'][0x2]['value']:undefined)||0xc}];case _0xd539('0x4a'):return[{'name':_0xd539('0x4b'),'value':_0x443832[_0xd539('0x4b')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x0]?_0x443832[_0xd539('0x3f')][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x4c')},{'name':_0xd539('0x4d'),'value':_0x443832['attrVoiceQueues']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832['attrs'][0x1][_0xd539('0x40')]:undefined)||[]},{'name':_0xd539('0x49'),'value':_0x443832[_0xd539('0x49')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x2]?_0x443832[_0xd539('0x3f')][0x2][_0xd539('0x40')]:undefined)||0x14},{'name':_0xd539('0x4e'),'value':_0x443832[_0xd539('0x4e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x3]?_0x443832[_0xd539('0x3f')][0x3][_0xd539('0x40')]:undefined)||_0xd539('0x4f')},{'name':_0xd539('0x50'),'value':_0x443832['attrEmailAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x4]?_0x443832[_0xd539('0x3f')][0x4][_0xd539('0x40')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x443832[_0xd539('0x51')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x5]?_0x443832[_0xd539('0x3f')][0x5][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x52'),'value':_0x443832[_0xd539('0x52')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x6]?_0x443832[_0xd539('0x3f')][0x6][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x53'),'value':_0x443832[_0xd539('0x53')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x7]?_0x443832[_0xd539('0x3f')][0x7][_0xd539('0x40')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x443832['attrWhatsappAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x8]?_0x443832['attrs'][0x8][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x54'),'value':_0x443832[_0xd539('0x54')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x9]?_0x443832[_0xd539('0x3f')][0x9][_0xd539('0x40')]:undefined)||''}];case _0xd539('0x55'):case _0xd539('0x56'):return[{'name':'attrSerie1','value':_0x443832[_0xd539('0x57')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832['attrs'][0x0][_0xd539('0x40')]:undefined)||_0xd539('0x4c')},{'name':_0xd539('0x58'),'value':_0x443832[_0xd539('0x58')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x1]?_0x443832[_0xd539('0x3f')][0x1][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x59'),'value':_0x443832[_0xd539('0x59')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x2]?_0x443832[_0xd539('0x3f')][0x2][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x4d'),'value':_0x443832['attrVoiceQueues']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x3]?_0x443832['attrs'][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x443832[_0xd539('0x4e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x4]?_0x443832[_0xd539('0x3f')][0x4]['value']:undefined)||_0xd539('0x4f')},{'name':_0xd539('0x50'),'value':_0x443832['attrEmailAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x5]?_0x443832[_0xd539('0x3f')][0x5]['value']:undefined)||''},{'name':_0xd539('0x51'),'value':_0x443832[_0xd539('0x51')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x6]?_0x443832[_0xd539('0x3f')][0x6][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x52'),'value':_0x443832['attrSmsAccounts']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x7]?_0x443832[_0xd539('0x3f')][0x7][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x53'),'value':_0x443832[_0xd539('0x53')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x8]?_0x443832[_0xd539('0x3f')][0x8][_0xd539('0x40')]:undefined)||''},{'name':_0xd539('0x5a'),'value':_0x443832[_0xd539('0x5a')]||(_0x443832['attrs']&&_0x443832[_0xd539('0x3f')][0x9]?_0x443832[_0xd539('0x3f')][0x9][_0xd539('0x40')]:undefined)||''},{'name':'attrChatWebsites','value':_0x443832[_0xd539('0x54')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0xa]?_0x443832[_0xd539('0x3f')][0xa][_0xd539('0x40')]:undefined)||''}];case _0xd539('0x5b'):return[{'name':_0xd539('0x5c'),'type':_0x443832[_0xd539('0x5d')]||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0]['type']:undefined)||null,'value':_0x443832['attrReport']||(_0x443832[_0xd539('0x3f')]&&_0x443832[_0xd539('0x3f')][0x0]?_0x443832[_0xd539('0x3f')][0x0][_0xd539('0x40')]:undefined)||null},{'name':_0xd539('0x5e'),'value':_0x443832[_0xd539('0x5e')]||(_0x443832[_0xd539('0x3f')]&&_0x443832['attrs'][0x1]?_0x443832[_0xd539('0x3f')][0x1][_0xd539('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x1a9d6b){logger[_0xd539('0x5f')](_0xd539('0x60'),JSON['stringify'](_0x1a9d6b));return[];}}exports[_0xd539('0x61')]=function(_0x5d2a2f,_0x558c16){if(_0x5d2a2f['body']){_0x5d2a2f[_0xd539('0x62')][_0xd539('0x3f')]=widgetAttributes(_0x5d2a2f[_0xd539('0x62')]);}return db[_0xd539('0x32')][_0xd539('0x61')](_0x5d2a2f[_0xd539('0x62')],{})['then'](respondWithResult(_0x558c16,0xc9))['catch'](handleError(_0x558c16,null));};exports[_0xd539('0x63')]=function(_0x47c90d,_0x4a66cf){if(_0x47c90d['body']['id']){delete _0x47c90d[_0xd539('0x62')]['id'];}_0x47c90d['body']['attrs']=widgetAttributes(_0x47c90d[_0xd539('0x62')]);return db[_0xd539('0x32')][_0xd539('0x3a')]({'where':{'id':_0x47c90d['params']['id']}})[_0xd539('0x2b')](handleEntityNotFound(_0x4a66cf,null))[_0xd539('0x2b')](saveUpdates(_0x47c90d[_0xd539('0x62')],null))[_0xd539('0x2b')](respondWithResult(_0x4a66cf,null))[_0xd539('0x3b')](handleError(_0x4a66cf,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index c1fc672..12f2b42 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 _0xdac0=['hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x59e184,_0x27ba2b){var _0x4b0453=function(_0xd423bb){while(--_0xd423bb){_0x59e184['push'](_0x59e184['shift']());}};_0x4b0453(++_0x27ba2b);}(_0xdac0,0x17e));var _0x0dac=function(_0x425777,_0xf8d470){_0x425777=_0x425777-0x0;var _0x52ab15=_0xdac0[_0x425777];return _0x52ab15;};'use strict';var EventEmitter=require(_0x0dac('0x0'));var DashboardItem=require(_0x0dac('0x1'))['db'][_0x0dac('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x0dac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0dac('0x4'),'afterDestroy':_0x0dac('0x5')};function emitEvent(_0x338f68){return function(_0x445760,_0x577b65,_0x4d3b25){DashboardItemEvents[_0x0dac('0x6')](_0x338f68+':'+_0x445760['id'],_0x445760);DashboardItemEvents[_0x0dac('0x6')](_0x338f68,_0x445760);_0x4d3b25(null);};}for(var e in events){if(events[_0x0dac('0x7')](e)){var event=events[e];DashboardItem[_0x0dac('0x8')](e,emitEvent(event));}}module[_0x0dac('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x8a5e=['hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x13b2cc,_0x47e94b){var _0xdf1280=function(_0x397bd9){while(--_0x397bd9){_0x13b2cc['push'](_0x13b2cc['shift']());}};_0xdf1280(++_0x47e94b);}(_0x8a5e,0xa4));var _0xe8a5=function(_0x4b20d0,_0x32372d){_0x4b20d0=_0x4b20d0-0x0;var _0x35dc03=_0x8a5e[_0x4b20d0];return _0x35dc03;};'use strict';var EventEmitter=require(_0xe8a5('0x0'));var DashboardItem=require(_0xe8a5('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe8a5('0x2')](0x0);var events={'afterCreate':_0xe8a5('0x3'),'afterUpdate':_0xe8a5('0x4'),'afterDestroy':_0xe8a5('0x5')};function emitEvent(_0x34aaf4){return function(_0x5cddd7,_0x4b726d,_0x300237){DashboardItemEvents[_0xe8a5('0x6')](_0x34aaf4+':'+_0x5cddd7['id'],_0x5cddd7);DashboardItemEvents[_0xe8a5('0x6')](_0x34aaf4,_0x5cddd7);_0x300237(null);};}for(var e in events){if(events[_0xe8a5('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xe8a5('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 399de5c..9722f36 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 _0xe78c=['define','dashboard_items','util','moment','request-promise','path'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0xe78c,0xaa));var _0xce78=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe78c[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xce78('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xce78('0x1'));var BPromise=require('bluebird');var rp=require(_0xce78('0x2'));var fs=require('fs');var path=require(_0xce78('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x1ef314,_0x967d31){return _0x1ef314[_0xce78('0x4')]('DashboardItem',attributes,{'tableName':_0xce78('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b4e=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','DashboardItem','dashboard_items'];(function(_0x5af549,_0x10be96){var _0x127e28=function(_0x5dac51){while(--_0x5dac51){_0x5af549['push'](_0x5af549['shift']());}};_0x127e28(++_0x10be96);}(_0x1b4e,0x1ad));var _0xe1b4=function(_0x312aaa,_0x502664){_0x312aaa=_0x312aaa-0x0;var _0x51d914=_0x1b4e[_0x312aaa];return _0x51d914;};'use strict';var _=require(_0xe1b4('0x0'));var util=require(_0xe1b4('0x1'));var logger=require(_0xe1b4('0x2'))(_0xe1b4('0x3'));var moment=require(_0xe1b4('0x4'));var BPromise=require('bluebird');var rp=require(_0xe1b4('0x5'));var fs=require('fs');var path=require(_0xe1b4('0x6'));var rimraf=require(_0xe1b4('0x7'));var config=require(_0xe1b4('0x8'));var attributes=require(_0xe1b4('0x9'));module[_0xe1b4('0xa')]=function(_0x46bafd,_0x2449be){return _0x46bafd['define'](_0xe1b4('0xb'),attributes,{'tableName':_0xe1b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 5ea394f..40bced7 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 _0x885e=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent'];(function(_0x414bf0,_0x1b1907){var _0xb89924=function(_0x318d9c){while(--_0x318d9c){_0x414bf0['push'](_0x414bf0['shift']());}};_0xb89924(++_0x1b1907);}(_0x885e,0x72));var _0xe885=function(_0xf8d4d3,_0x10c7e6){_0xf8d4d3=_0xf8d4d3-0x0;var _0x378ee2=_0x885e[_0xf8d4d3];return _0x378ee2;};'use strict';var _=require(_0xe885('0x0'));var util=require(_0xe885('0x1'));var moment=require(_0xe885('0x2'));var BPromise=require(_0xe885('0x3'));var rs=require(_0xe885('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe885('0x5'))['db'];var utils=require(_0xe885('0x6'));var logger=require(_0xe885('0x7'))('rpc');var config=require(_0xe885('0x8'));var jayson=require(_0xe885('0x9'));var client=jayson[_0xe885('0xa')][_0xe885('0xb')]({'port':0x232a});config['redis']=_[_0xe885('0xc')](config[_0xe885('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe885('0xd')]));require(_0xe885('0xe'))[_0xe885('0xf')](socket);function respondWithRpcPromise(_0x1a0855,_0x513bdd,_0xa72572){return new BPromise(function(_0x5087c9,_0x40e640){return client[_0xe885('0x10')](_0x1a0855,_0xa72572)[_0xe885('0x11')](function(_0x3e4daf){logger[_0xe885('0x12')](_0xe885('0x13'),_0x513bdd,_0xe885('0x14'));logger[_0xe885('0x15')](_0xe885('0x16'),_0x513bdd,_0xe885('0x14'),JSON['stringify'](_0x3e4daf));if(_0x3e4daf[_0xe885('0x17')]){if(_0x3e4daf[_0xe885('0x17')][_0xe885('0x18')]===0x1f4){logger[_0xe885('0x17')](_0xe885('0x13'),_0x513bdd,_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);return _0x40e640(_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);}logger[_0xe885('0x17')](_0xe885('0x13'),_0x513bdd,_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);return _0x5087c9(_0x3e4daf[_0xe885('0x17')][_0xe885('0x19')]);}else{logger[_0xe885('0x12')](_0xe885('0x13'),_0x513bdd,_0xe885('0x14'));_0x5087c9(_0x3e4daf['result'][_0xe885('0x19')]);}})[_0xe885('0x1a')](function(_0x3396ec){logger['error'](_0xe885('0x13'),_0x513bdd,_0x3396ec);_0x40e640(_0x3396ec);});});} \ No newline at end of file +var _0x795d=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0x795d,0x17f));var _0xd795=function(_0x52850c,_0x249dc8){_0x52850c=_0x52850c-0x0;var _0x113595=_0x795d[_0x52850c];return _0x113595;};'use strict';var _=require('lodash');var util=require(_0xd795('0x0'));var moment=require('moment');var BPromise=require(_0xd795('0x1'));var rs=require(_0xd795('0x2'));var fs=require('fs');var Redis=require(_0xd795('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd795('0x4'));var logger=require(_0xd795('0x5'))(_0xd795('0x6'));var config=require(_0xd795('0x7'));var jayson=require(_0xd795('0x8'));var client=jayson[_0xd795('0x9')]['http']({'port':0x232a});config[_0xd795('0xa')]=_[_0xd795('0xb')](config[_0xd795('0xa')],{'host':_0xd795('0xc'),'port':0x18eb});var socket=require(_0xd795('0xd'))(new Redis(config[_0xd795('0xa')]));require(_0xd795('0xe'))['register'](socket);function respondWithRpcPromise(_0x4fe9c5,_0x3e07b5,_0x5bf4cb){return new BPromise(function(_0x150dcd,_0x5052d4){return client[_0xd795('0xf')](_0x4fe9c5,_0x5bf4cb)[_0xd795('0x10')](function(_0x34d93f){logger[_0xd795('0x11')](_0xd795('0x12'),_0x3e07b5,_0xd795('0x13'));logger[_0xd795('0x14')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x3e07b5,_0xd795('0x13'),JSON[_0xd795('0x15')](_0x34d93f));if(_0x34d93f[_0xd795('0x16')]){if(_0x34d93f[_0xd795('0x16')][_0xd795('0x17')]===0x1f4){logger[_0xd795('0x16')](_0xd795('0x12'),_0x3e07b5,_0x34d93f[_0xd795('0x16')][_0xd795('0x18')]);return _0x5052d4(_0x34d93f[_0xd795('0x16')][_0xd795('0x18')]);}logger[_0xd795('0x16')](_0xd795('0x12'),_0x3e07b5,_0x34d93f[_0xd795('0x16')][_0xd795('0x18')]);return _0x150dcd(_0x34d93f[_0xd795('0x16')]['message']);}else{logger[_0xd795('0x11')]('DashboardItem,\x20%s,\x20%s',_0x3e07b5,'request\x20sent');_0x150dcd(_0x34d93f[_0xd795('0x19')][_0xd795('0x18')]);}})[_0xd795('0x1a')](function(_0x4c5529){logger[_0xd795('0x16')](_0xd795('0x12'),_0x3e07b5,_0x4c5529);_0x5052d4(_0x4c5529);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9b7b523..088c66f 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 _0x104c=['./dashboardItem.events','save','remove','update','emit','register','length','dashboardItem:'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x104c,0x1e0));var _0xc104=function(_0x470b1e,_0x469d95){_0x470b1e=_0x470b1e-0x0;var _0x58d7ff=_0x104c[_0x470b1e];return _0x58d7ff;};'use strict';var DashboardItemEvents=require(_0xc104('0x0'));var events=[_0xc104('0x1'),_0xc104('0x2'),_0xc104('0x3')];function createListener(_0x3fcf2c,_0x3de6ac){return function(_0x31c953){_0x3de6ac[_0xc104('0x4')](_0x3fcf2c,_0x31c953);};}function removeListener(_0xe1824c,_0x57330e){return function(){DashboardItemEvents['removeListener'](_0xe1824c,_0x57330e);};}exports[_0xc104('0x5')]=function(_0x7398e){for(var _0x3f4e96=0x0,_0x3eeb98=events[_0xc104('0x6')];_0x3f4e96<_0x3eeb98;_0x3f4e96++){var _0x4a4c3f=events[_0x3f4e96];var _0xb8e47f=createListener(_0xc104('0x7')+_0x4a4c3f,_0x7398e);DashboardItemEvents['on'](_0x4a4c3f,_0xb8e47f);}}; \ No newline at end of file +var _0xd06c=['./dashboardItem.events','save','remove','update','emit','removeListener','dashboardItem:'];(function(_0x529221,_0x1305bf){var _0x5f14e5=function(_0x5218d9){while(--_0x5218d9){_0x529221['push'](_0x529221['shift']());}};_0x5f14e5(++_0x1305bf);}(_0xd06c,0x70));var _0xcd06=function(_0x3222bb,_0x4d18c3){_0x3222bb=_0x3222bb-0x0;var _0x569587=_0xd06c[_0x3222bb];return _0x569587;};'use strict';var DashboardItemEvents=require(_0xcd06('0x0'));var events=[_0xcd06('0x1'),_0xcd06('0x2'),_0xcd06('0x3')];function createListener(_0x43ff29,_0x1bc83a){return function(_0x5174ac){_0x1bc83a[_0xcd06('0x4')](_0x43ff29,_0x5174ac);};}function removeListener(_0x49f4b8,_0x49fcd0){return function(){DashboardItemEvents[_0xcd06('0x5')](_0x49f4b8,_0x49fcd0);};}exports['register']=function(_0x1ab950){for(var _0x4d5d90=0x0,_0x163af6=events['length'];_0x4d5d90<_0x163af6;_0x4d5d90++){var _0x2c4404=events[_0x4d5d90];var _0x57dc8c=createListener(_0xcd06('0x6')+_0x2c4404,_0x1ab950);DashboardItemEvents['on'](_0x2c4404,_0x57dc8c);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index fc03f05..8d62b44 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 _0xf178=['isAuthenticated','put','/:id','update','delete','util','path','express','fs-extra','../../components/interaction/service','get','show','post'];(function(_0x520f7d,_0x339eb8){var _0x266fbe=function(_0x1ae42d){while(--_0x1ae42d){_0x520f7d['push'](_0x520f7d['shift']());}};_0x266fbe(++_0x339eb8);}(_0xf178,0x164));var _0x8f17=function(_0x11aef5,_0x5917a0){_0x11aef5=_0x11aef5-0x0;var _0x5f0de1=_0xf178[_0x11aef5];return _0x5f0de1;};'use strict';var multer=require('multer');var util=require(_0x8f17('0x0'));var path=require(_0x8f17('0x1'));var timeout=require('connect-timeout');var express=require(_0x8f17('0x2'));var router=express['Router']();var fs_extra=require(_0x8f17('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8f17('0x4'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x8f17('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8f17('0x6')]);router[_0x8f17('0x7')]('/',auth[_0x8f17('0x8')](),controller['create']);router[_0x8f17('0x9')](_0x8f17('0xa'),auth['isAuthenticated'](),controller[_0x8f17('0xb')]);router[_0x8f17('0xc')]('/:id',auth[_0x8f17('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2189=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show','create','put','update','exports','multer','util','path','connect-timeout'];(function(_0x329e28,_0x109c96){var _0x426be8=function(_0x24b51e){while(--_0x24b51e){_0x329e28['push'](_0x329e28['shift']());}};_0x426be8(++_0x109c96);}(_0x2189,0x14c));var _0x9218=function(_0x73c82c,_0x574fae){_0x73c82c=_0x73c82c-0x0;var _0x240050=_0x2189[_0x73c82c];return _0x240050;};'use strict';var multer=require(_0x9218('0x0'));var util=require(_0x9218('0x1'));var path=require(_0x9218('0x2'));var timeout=require(_0x9218('0x3'));var express=require(_0x9218('0x4'));var router=express[_0x9218('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9218('0x6'));var interaction=require(_0x9218('0x7'));var config=require(_0x9218('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0x9218('0x9'),auth[_0x9218('0xa')](),controller[_0x9218('0xb')]);router['post']('/',auth[_0x9218('0xa')](),controller[_0x9218('0xc')]);router[_0x9218('0xd')](_0x9218('0x9'),auth[_0x9218('0xa')](),controller[_0x9218('0xe')]);router['delete'](_0x9218('0x9'),auth[_0x9218('0xa')](),controller['destroy']);module[_0x9218('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a0002f9..b65df65 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 _0xd46e=['third','STRING','ENUM','first'];(function(_0x520e95,_0x1237a7){var _0x5a442e=function(_0x346c1f){while(--_0x346c1f){_0x520e95['push'](_0x520e95['shift']());}};_0x5a442e(++_0x1237a7);}(_0xd46e,0x142));var _0xed46=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xd46e[_0x20589d];return _0x422de9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xed46('0x0')](_0xed46('0x1'),'second',_0xed46('0x2')),'allowNull':![],'defaultValue':_0xed46('0x1')},'description':{'type':Sequelize[_0xed46('0x3')]}}; \ No newline at end of file +var _0x70b0=['sequelize','STRING','ENUM','first','second','third'];(function(_0x53c597,_0x10bd5a){var _0x528e49=function(_0xd641db){while(--_0xd641db){_0x53c597['push'](_0x53c597['shift']());}};_0x528e49(++_0x10bd5a);}(_0x70b0,0x6c));var _0x070b=function(_0x3f1076,_0x23b6c1){_0x3f1076=_0x3f1076-0x0;var _0x21d34f=_0x70b0[_0x3f1076];return _0x21d34f;};'use strict';var Sequelize=require(_0x070b('0x0'));module['exports']={'name':{'type':Sequelize[_0x070b('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x070b('0x2')](_0x070b('0x3'),_0x070b('0x4'),_0x070b('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0f18cef..aeb1c53 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 _0x2f3d=['pick','where','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','keys','length','create','body','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','apply','reject','save','update','then','destroy','Dispositions','UserProfileResource','sendStatus','stack','name','send','index','Disposition','rawAttributes','fieldName','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort'];(function(_0x1373f3,_0x423359){var _0x51e472=function(_0x1a95a1){while(--_0x1a95a1){_0x1373f3['push'](_0x1373f3['shift']());}};_0x51e472(++_0x423359);}(_0x2f3d,0x1a8));var _0xd2f3=function(_0x4c60af,_0x47f2fc){_0x4c60af=_0x4c60af-0x0;var _0x201282=_0x2f3d[_0x4c60af];return _0x201282;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd2f3('0x0'));var zipdir=require(_0xd2f3('0x1'));var jsonpatch=require(_0xd2f3('0x2'));var rp=require(_0xd2f3('0x3'));var moment=require(_0xd2f3('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2f3('0x5'));var path=require(_0xd2f3('0x6'));var sox=require(_0xd2f3('0x7'));var csv=require('to-csv');var ejs=require(_0xd2f3('0x8'));var fs=require('fs');var fs_extra=require(_0xd2f3('0x9'));var _=require(_0xd2f3('0xa'));var squel=require(_0xd2f3('0xb'));var crypto=require(_0xd2f3('0xc'));var jsforce=require(_0xd2f3('0xd'));var deskjs=require(_0xd2f3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd2f3('0xf'));var Papa=require(_0xd2f3('0x10'));var Redis=require('ioredis');var authService=require(_0xd2f3('0x11'));var qs=require(_0xd2f3('0x12'));var as=require(_0xd2f3('0x13'));var hardwareService=require(_0xd2f3('0x14'));var logger=require(_0xd2f3('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd2f3('0x16'));var db=require(_0xd2f3('0x17'))['db'];function respondWithStatusCode(_0x4d5a9e,_0xa040a7){_0xa040a7=_0xa040a7||0xcc;return function(_0x543005){if(_0x543005){return _0x4d5a9e['sendStatus'](_0xa040a7);}return _0x4d5a9e[_0xd2f3('0x18')](_0xa040a7)[_0xd2f3('0x19')]();};}function respondWithResult(_0x35bf4e,_0x1df3eb){_0x1df3eb=_0x1df3eb||0xc8;return function(_0x280957){if(_0x280957){return _0x35bf4e[_0xd2f3('0x18')](_0x1df3eb)[_0xd2f3('0x1a')](_0x280957);}};}function respondWithFilteredResult(_0xc40245,_0x1332f1){return function(_0x365a35){if(_0x365a35){var _0x228b23=typeof _0x1332f1['offset']===_0xd2f3('0x1b')&&typeof _0x1332f1[_0xd2f3('0x1c')]===_0xd2f3('0x1b');var _0x48a2f3=_0x365a35['count'];var _0x5e8f0a=_0x228b23?0x0:_0x1332f1[_0xd2f3('0x1d')];var _0x5c5dba=_0x228b23?_0x365a35['count']:_0x1332f1[_0xd2f3('0x1d')]+_0x1332f1[_0xd2f3('0x1c')];var _0x469f7a;if(_0x5c5dba>=_0x48a2f3){_0x5c5dba=_0x48a2f3;_0x469f7a=0xc8;}else{_0x469f7a=0xce;}_0xc40245[_0xd2f3('0x18')](_0x469f7a);return _0xc40245['set']('Content-Range',_0x5e8f0a+'-'+_0x5c5dba+'/'+_0x48a2f3)[_0xd2f3('0x1a')](_0x365a35);}return null;};}function patchUpdates(_0x5a2472){return function(_0x1b750b){try{jsonpatch[_0xd2f3('0x1e')](_0x1b750b,_0x5a2472,!![]);}catch(_0x1f0c0a){return BPromise[_0xd2f3('0x1f')](_0x1f0c0a);}return _0x1b750b[_0xd2f3('0x20')]();};}function saveUpdates(_0x4e9f16,_0x26aa11){return function(_0x2ecd65){if(_0x2ecd65){return _0x2ecd65[_0xd2f3('0x21')](_0x4e9f16)[_0xd2f3('0x22')](function(_0x11a657){return _0x11a657;});}return null;};}function removeEntity(_0xc8e9f4,_0x3a7fb7){return function(_0x4f6b8b){if(_0x4f6b8b){return _0x4f6b8b[_0xd2f3('0x23')]()[_0xd2f3('0x22')](function(){var _0x7c97b9=_0x4f6b8b['get']({'plain':!![]});var _0x22c443=_0xd2f3('0x24');return db[_0xd2f3('0x25')]['destroy']({'where':{'type':_0x22c443,'resourceId':_0x7c97b9['id']}})['then'](function(){return _0x4f6b8b;});})['then'](function(){_0xc8e9f4['status'](0xcc)[_0xd2f3('0x19')]();});}};}function handleEntityNotFound(_0x38d00d,_0x529d4a){return function(_0x17beea){if(!_0x17beea){_0x38d00d[_0xd2f3('0x26')](0x194);}return _0x17beea;};}function handleError(_0x12a96f,_0x26bfca){_0x26bfca=_0x26bfca||0x1f4;return function(_0x4b18b0){logger['error'](_0x4b18b0[_0xd2f3('0x27')]);if(_0x4b18b0[_0xd2f3('0x28')]){delete _0x4b18b0[_0xd2f3('0x28')];}_0x12a96f['status'](_0x26bfca)[_0xd2f3('0x29')](_0x4b18b0);};}exports[_0xd2f3('0x2a')]=function(_0x5bee3f,_0xf05788){var _0x1aa264={},_0x515f6c={},_0x2f1522={'count':0x0,'rows':[]};var _0x10ebcd=_['map'](db[_0xd2f3('0x2b')][_0xd2f3('0x2c')],function(_0x5b01d6){return{'name':_0x5b01d6[_0xd2f3('0x2d')],'type':_0x5b01d6['type']['key']};});_0x515f6c[_0xd2f3('0x2e')]=_[_0xd2f3('0x2f')](_0x10ebcd,_0xd2f3('0x28'));_0x515f6c[_0xd2f3('0x30')]=_['keys'](_0x5bee3f[_0xd2f3('0x30')]);_0x515f6c[_0xd2f3('0x31')]=_[_0xd2f3('0x32')](_0x515f6c['model'],_0x515f6c[_0xd2f3('0x30')]);_0x1aa264[_0xd2f3('0x33')]=_[_0xd2f3('0x32')](_0x515f6c['model'],qs[_0xd2f3('0x34')](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x34')]));_0x1aa264[_0xd2f3('0x33')]=_0x1aa264['attributes']['length']?_0x1aa264[_0xd2f3('0x33')]:_0x515f6c[_0xd2f3('0x2e')];if(!_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x35')]('nolimit')){_0x1aa264['limit']=qs['limit'](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x1c')]);_0x1aa264[_0xd2f3('0x1d')]=qs['offset'](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x1d')]);}_0x1aa264[_0xd2f3('0x36')]=qs[_0xd2f3('0x37')](_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x37')]);_0x1aa264['where']=qs[_0xd2f3('0x31')](_[_0xd2f3('0x38')](_0x5bee3f['query'],_0x515f6c[_0xd2f3('0x31')]),_0x10ebcd);if(_0x5bee3f[_0xd2f3('0x30')]['filter']){_0x1aa264[_0xd2f3('0x39')]=_[_0xd2f3('0x3a')](_0x1aa264[_0xd2f3('0x39')],{'$or':_[_0xd2f3('0x2f')](_0x10ebcd,function(_0x2b218c){if(_0x2b218c['type']!==_0xd2f3('0x3b')){var _0x287ee9={};_0x287ee9[_0x2b218c[_0xd2f3('0x28')]]={'$like':'%'+_0x5bee3f['query'][_0xd2f3('0x3c')]+'%'};return _0x287ee9;}})});}_0x1aa264=_[_0xd2f3('0x3a')]({},_0x1aa264,_0x5bee3f[_0xd2f3('0x3d')]);var _0x16613c={'where':_0x1aa264['where']};return db[_0xd2f3('0x2b')][_0xd2f3('0x3e')](_0x16613c)[_0xd2f3('0x22')](function(_0xf3ff63){_0x2f1522[_0xd2f3('0x3e')]=_0xf3ff63;if(_0x5bee3f[_0xd2f3('0x30')][_0xd2f3('0x3f')]){_0x1aa264[_0xd2f3('0x40')]=[{'all':!![]}];}return db[_0xd2f3('0x2b')]['findAll'](_0x1aa264);})['then'](function(_0x2f604e){_0x2f1522[_0xd2f3('0x41')]=_0x2f604e;return _0x2f1522;})[_0xd2f3('0x22')](respondWithFilteredResult(_0xf05788,_0x1aa264))[_0xd2f3('0x42')](handleError(_0xf05788,null));};exports[_0xd2f3('0x43')]=function(_0xb79756,_0x59bea7){var _0x5801b0={'raw':!![],'where':{'id':_0xb79756[_0xd2f3('0x44')]['id']}},_0x101d2c={};_0x101d2c['model']=_[_0xd2f3('0x45')](db['Disposition'][_0xd2f3('0x2c')]);_0x101d2c[_0xd2f3('0x30')]=_[_0xd2f3('0x45')](_0xb79756[_0xd2f3('0x30')]);_0x101d2c[_0xd2f3('0x31')]=_[_0xd2f3('0x32')](_0x101d2c['model'],_0x101d2c[_0xd2f3('0x30')]);_0x5801b0['attributes']=_[_0xd2f3('0x32')](_0x101d2c['model'],qs[_0xd2f3('0x34')](_0xb79756[_0xd2f3('0x30')][_0xd2f3('0x34')]));_0x5801b0[_0xd2f3('0x33')]=_0x5801b0[_0xd2f3('0x33')][_0xd2f3('0x46')]?_0x5801b0[_0xd2f3('0x33')]:_0x101d2c[_0xd2f3('0x2e')];if(_0xb79756[_0xd2f3('0x30')][_0xd2f3('0x3f')]){_0x5801b0['include']=[{'all':!![]}];}_0x5801b0=_[_0xd2f3('0x3a')]({},_0x5801b0,_0xb79756[_0xd2f3('0x3d')]);return db[_0xd2f3('0x2b')]['find'](_0x5801b0)[_0xd2f3('0x22')](handleEntityNotFound(_0x59bea7,null))['then'](respondWithResult(_0x59bea7,null))['catch'](handleError(_0x59bea7,null));};exports[_0xd2f3('0x47')]=function(_0xcfc0b5,_0x23d72f){return db[_0xd2f3('0x2b')][_0xd2f3('0x47')](_0xcfc0b5[_0xd2f3('0x48')],{})[_0xd2f3('0x22')](function(_0x12ca97){var _0x5cc0db=_0xcfc0b5['user'][_0xd2f3('0x49')]({'plain':!![]});if(!_0x5cc0db)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc0db[_0xd2f3('0x4a')]===_0xd2f3('0x4b')){var _0x3f5718=_0x12ca97['get']({'plain':!![]});var _0x99b8d='Dispositions';return db[_0xd2f3('0x4c')]['find']({'where':{'name':_0x99b8d,'userProfileId':_0x5cc0db['userProfileId']},'raw':!![]})['then'](function(_0x1c1d81){if(_0x1c1d81&&_0x1c1d81[_0xd2f3('0x4d')]===0x0){return db[_0xd2f3('0x25')][_0xd2f3('0x47')]({'name':_0x3f5718[_0xd2f3('0x28')],'resourceId':_0x3f5718['id'],'type':_0x1c1d81[_0xd2f3('0x28')],'sectionId':_0x1c1d81['id']},{})[_0xd2f3('0x22')](function(){return _0x12ca97;});}else{return _0x12ca97;}})[_0xd2f3('0x42')](function(_0x3f48e9){logger['error'](_0xd2f3('0x4e'),_0x3f48e9);throw _0x3f48e9;});}return _0x12ca97;})[_0xd2f3('0x22')](respondWithResult(_0x23d72f,0xc9))[_0xd2f3('0x42')](handleError(_0x23d72f,null));};exports[_0xd2f3('0x21')]=function(_0x54c9df,_0x5a5b82){if(_0x54c9df['body']['id']){delete _0x54c9df['body']['id'];}return db[_0xd2f3('0x2b')][_0xd2f3('0x4f')]({'where':{'id':_0x54c9df[_0xd2f3('0x44')]['id']}})[_0xd2f3('0x22')](handleEntityNotFound(_0x5a5b82,null))[_0xd2f3('0x22')](saveUpdates(_0x54c9df[_0xd2f3('0x48')],null))[_0xd2f3('0x22')](respondWithResult(_0x5a5b82,null))[_0xd2f3('0x42')](handleError(_0x5a5b82,null));};exports[_0xd2f3('0x23')]=function(_0x23dbca,_0x5cb682){return db[_0xd2f3('0x2b')][_0xd2f3('0x4f')]({'where':{'id':_0x23dbca['params']['id']}})[_0xd2f3('0x22')](handleEntityNotFound(_0x5cb682,null))[_0xd2f3('0x22')](removeEntity(_0x5cb682,null))[_0xd2f3('0x42')](handleError(_0x5cb682,null));}; \ No newline at end of file +var _0x5707=['destroy','sendStatus','stack','name','send','index','Disposition','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','then','get','Dispositions','UserProfileResource'];(function(_0x5b19cc,_0x34fb76){var _0x5a2d9f=function(_0x301f40){while(--_0x301f40){_0x5b19cc['push'](_0x5b19cc['shift']());}};_0x5a2d9f(++_0x34fb76);}(_0x5707,0x134));var _0x7570=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x5707[_0x173452];return _0xee3fd0;};'use strict';var emlformat=require(_0x7570('0x0'));var rimraf=require(_0x7570('0x1'));var zipdir=require(_0x7570('0x2'));var jsonpatch=require(_0x7570('0x3'));var rp=require(_0x7570('0x4'));var moment=require(_0x7570('0x5'));var BPromise=require(_0x7570('0x6'));var Mustache=require(_0x7570('0x7'));var util=require(_0x7570('0x8'));var path=require(_0x7570('0x9'));var sox=require(_0x7570('0xa'));var csv=require(_0x7570('0xb'));var ejs=require(_0x7570('0xc'));var fs=require('fs');var fs_extra=require(_0x7570('0xd'));var _=require(_0x7570('0xe'));var squel=require(_0x7570('0xf'));var crypto=require(_0x7570('0x10'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7570('0xb'));var querystring=require(_0x7570('0x11'));var Papa=require(_0x7570('0x12'));var Redis=require(_0x7570('0x13'));var authService=require(_0x7570('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7570('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7570('0x16'));var utils=require(_0x7570('0x17'));var config=require(_0x7570('0x18'));var licenseUtil=require(_0x7570('0x19'));var db=require(_0x7570('0x1a'))['db'];function respondWithStatusCode(_0x3b139f,_0x3dadbd){_0x3dadbd=_0x3dadbd||0xcc;return function(_0x6896c3){if(_0x6896c3){return _0x3b139f['sendStatus'](_0x3dadbd);}return _0x3b139f['status'](_0x3dadbd)[_0x7570('0x1b')]();};}function respondWithResult(_0x582545,_0x25a033){_0x25a033=_0x25a033||0xc8;return function(_0x458663){if(_0x458663){return _0x582545[_0x7570('0x1c')](_0x25a033)['json'](_0x458663);}};}function respondWithFilteredResult(_0x1c7786,_0x437c8a){return function(_0x26baa5){if(_0x26baa5){var _0x524931=typeof _0x437c8a['offset']==='undefined'&&typeof _0x437c8a[_0x7570('0x1d')]===_0x7570('0x1e');var _0x2fe207=_0x26baa5['count'];var _0x3eba90=_0x524931?0x0:_0x437c8a[_0x7570('0x1f')];var _0x5e21b6=_0x524931?_0x26baa5[_0x7570('0x20')]:_0x437c8a[_0x7570('0x1f')]+_0x437c8a[_0x7570('0x1d')];var _0x573a39;if(_0x5e21b6>=_0x2fe207){_0x5e21b6=_0x2fe207;_0x573a39=0xc8;}else{_0x573a39=0xce;}_0x1c7786[_0x7570('0x1c')](_0x573a39);return _0x1c7786[_0x7570('0x21')](_0x7570('0x22'),_0x3eba90+'-'+_0x5e21b6+'/'+_0x2fe207)[_0x7570('0x23')](_0x26baa5);}return null;};}function patchUpdates(_0x4b8e82){return function(_0x3cee9e){try{jsonpatch[_0x7570('0x24')](_0x3cee9e,_0x4b8e82,!![]);}catch(_0x2b72b4){return BPromise[_0x7570('0x25')](_0x2b72b4);}return _0x3cee9e[_0x7570('0x26')]();};}function saveUpdates(_0x398e74,_0x335efc){return function(_0x36e4cc){if(_0x36e4cc){return _0x36e4cc[_0x7570('0x27')](_0x398e74)[_0x7570('0x28')](function(_0xd3664d){return _0xd3664d;});}return null;};}function removeEntity(_0x1e71b7,_0x5f2b9c){return function(_0xde9a90){if(_0xde9a90){return _0xde9a90['destroy']()[_0x7570('0x28')](function(){var _0x91eb37=_0xde9a90[_0x7570('0x29')]({'plain':!![]});var _0x1596e0=_0x7570('0x2a');return db[_0x7570('0x2b')][_0x7570('0x2c')]({'where':{'type':_0x1596e0,'resourceId':_0x91eb37['id']}})[_0x7570('0x28')](function(){return _0xde9a90;});})[_0x7570('0x28')](function(){_0x1e71b7['status'](0xcc)[_0x7570('0x1b')]();});}};}function handleEntityNotFound(_0x531de5,_0x31ce88){return function(_0x347c0a){if(!_0x347c0a){_0x531de5[_0x7570('0x2d')](0x194);}return _0x347c0a;};}function handleError(_0x4e49a1,_0x40d420){_0x40d420=_0x40d420||0x1f4;return function(_0x592d2a){logger['error'](_0x592d2a[_0x7570('0x2e')]);if(_0x592d2a[_0x7570('0x2f')]){delete _0x592d2a[_0x7570('0x2f')];}_0x4e49a1[_0x7570('0x1c')](_0x40d420)[_0x7570('0x30')](_0x592d2a);};}exports[_0x7570('0x31')]=function(_0xe0ce4b,_0xf9040c){var _0x3dc74d={},_0x3a7870={},_0x98164e={'count':0x0,'rows':[]};var _0x12b029=_['map'](db[_0x7570('0x32')]['rawAttributes'],function(_0x54cb89){return{'name':_0x54cb89[_0x7570('0x33')],'type':_0x54cb89[_0x7570('0x34')][_0x7570('0x35')]};});_0x3a7870['model']=_[_0x7570('0x36')](_0x12b029,_0x7570('0x2f'));_0x3a7870[_0x7570('0x37')]=_[_0x7570('0x38')](_0xe0ce4b['query']);_0x3a7870['filters']=_['intersection'](_0x3a7870[_0x7570('0x39')],_0x3a7870[_0x7570('0x37')]);_0x3dc74d[_0x7570('0x3a')]=_[_0x7570('0x3b')](_0x3a7870[_0x7570('0x39')],qs[_0x7570('0x3c')](_0xe0ce4b['query'][_0x7570('0x3c')]));_0x3dc74d[_0x7570('0x3a')]=_0x3dc74d[_0x7570('0x3a')][_0x7570('0x3d')]?_0x3dc74d[_0x7570('0x3a')]:_0x3a7870[_0x7570('0x39')];if(!_0xe0ce4b[_0x7570('0x37')]['hasOwnProperty'](_0x7570('0x3e'))){_0x3dc74d['limit']=qs['limit'](_0xe0ce4b[_0x7570('0x37')][_0x7570('0x1d')]);_0x3dc74d[_0x7570('0x1f')]=qs[_0x7570('0x1f')](_0xe0ce4b['query'][_0x7570('0x1f')]);}_0x3dc74d['order']=qs[_0x7570('0x3f')](_0xe0ce4b[_0x7570('0x37')][_0x7570('0x3f')]);_0x3dc74d['where']=qs[_0x7570('0x40')](_[_0x7570('0x41')](_0xe0ce4b[_0x7570('0x37')],_0x3a7870[_0x7570('0x40')]),_0x12b029);if(_0xe0ce4b[_0x7570('0x37')][_0x7570('0x42')]){_0x3dc74d[_0x7570('0x43')]=_[_0x7570('0x44')](_0x3dc74d[_0x7570('0x43')],{'$or':_[_0x7570('0x36')](_0x12b029,function(_0x2abbd2){if(_0x2abbd2[_0x7570('0x34')]!==_0x7570('0x45')){var _0x5cbec3={};_0x5cbec3[_0x2abbd2[_0x7570('0x2f')]]={'$like':'%'+_0xe0ce4b['query'][_0x7570('0x42')]+'%'};return _0x5cbec3;}})});}_0x3dc74d=_[_0x7570('0x44')]({},_0x3dc74d,_0xe0ce4b[_0x7570('0x46')]);var _0x4f8f17={'where':_0x3dc74d[_0x7570('0x43')]};return db['Disposition'][_0x7570('0x20')](_0x4f8f17)[_0x7570('0x28')](function(_0x7655c2){_0x98164e[_0x7570('0x20')]=_0x7655c2;if(_0xe0ce4b[_0x7570('0x37')][_0x7570('0x47')]){_0x3dc74d['include']=[{'all':!![]}];}return db[_0x7570('0x32')][_0x7570('0x48')](_0x3dc74d);})[_0x7570('0x28')](function(_0x2c70ff){_0x98164e[_0x7570('0x49')]=_0x2c70ff;return _0x98164e;})[_0x7570('0x28')](respondWithFilteredResult(_0xf9040c,_0x3dc74d))[_0x7570('0x4a')](handleError(_0xf9040c,null));};exports['show']=function(_0x436212,_0x277319){var _0x985b02={'raw':!![],'where':{'id':_0x436212[_0x7570('0x4b')]['id']}},_0x5cd551={};_0x5cd551[_0x7570('0x39')]=_[_0x7570('0x38')](db['Disposition'][_0x7570('0x4c')]);_0x5cd551[_0x7570('0x37')]=_[_0x7570('0x38')](_0x436212[_0x7570('0x37')]);_0x5cd551['filters']=_['intersection'](_0x5cd551[_0x7570('0x39')],_0x5cd551[_0x7570('0x37')]);_0x985b02[_0x7570('0x3a')]=_['intersection'](_0x5cd551[_0x7570('0x39')],qs[_0x7570('0x3c')](_0x436212[_0x7570('0x37')][_0x7570('0x3c')]));_0x985b02[_0x7570('0x3a')]=_0x985b02['attributes']['length']?_0x985b02[_0x7570('0x3a')]:_0x5cd551[_0x7570('0x39')];if(_0x436212['query'][_0x7570('0x47')]){_0x985b02[_0x7570('0x4d')]=[{'all':!![]}];}_0x985b02=_['merge']({},_0x985b02,_0x436212['options']);return db[_0x7570('0x32')]['find'](_0x985b02)[_0x7570('0x28')](handleEntityNotFound(_0x277319,null))['then'](respondWithResult(_0x277319,null))[_0x7570('0x4a')](handleError(_0x277319,null));};exports[_0x7570('0x4e')]=function(_0x142a2d,_0x36e97a){return db['Disposition'][_0x7570('0x4e')](_0x142a2d[_0x7570('0x4f')],{})['then'](function(_0x36e4a7){var _0xf2a370=_0x142a2d[_0x7570('0x50')][_0x7570('0x29')]({'plain':!![]});if(!_0xf2a370)throw new Error(_0x7570('0x51'));if(_0xf2a370[_0x7570('0x52')]===_0x7570('0x50')){var _0x465a19=_0x36e4a7[_0x7570('0x29')]({'plain':!![]});var _0x3d8b22='Dispositions';return db['UserProfileSection'][_0x7570('0x53')]({'where':{'name':_0x3d8b22,'userProfileId':_0xf2a370[_0x7570('0x54')]},'raw':!![]})[_0x7570('0x28')](function(_0x7bc9ac){if(_0x7bc9ac&&_0x7bc9ac[_0x7570('0x55')]===0x0){return db[_0x7570('0x2b')]['create']({'name':_0x465a19[_0x7570('0x2f')],'resourceId':_0x465a19['id'],'type':_0x7bc9ac['name'],'sectionId':_0x7bc9ac['id']},{})[_0x7570('0x28')](function(){return _0x36e4a7;});}else{return _0x36e4a7;}})[_0x7570('0x4a')](function(_0x133931){logger[_0x7570('0x56')](_0x7570('0x57'),_0x133931);throw _0x133931;});}return _0x36e4a7;})['then'](respondWithResult(_0x36e97a,0xc9))[_0x7570('0x4a')](handleError(_0x36e97a,null));};exports['update']=function(_0xca7bf0,_0x464919){if(_0xca7bf0[_0x7570('0x4f')]['id']){delete _0xca7bf0[_0x7570('0x4f')]['id'];}return db['Disposition'][_0x7570('0x53')]({'where':{'id':_0xca7bf0[_0x7570('0x4b')]['id']}})[_0x7570('0x28')](handleEntityNotFound(_0x464919,null))[_0x7570('0x28')](saveUpdates(_0xca7bf0['body'],null))['then'](respondWithResult(_0x464919,null))[_0x7570('0x4a')](handleError(_0x464919,null));};exports[_0x7570('0x2c')]=function(_0x56ed18,_0x6ede03){return db['Disposition'][_0x7570('0x53')]({'where':{'id':_0x56ed18['params']['id']}})['then'](handleEntityNotFound(_0x6ede03,null))[_0x7570('0x28')](removeEntity(_0x6ede03,null))['catch'](handleError(_0x6ede03,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 19bc167..68dfb5d 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 _0x58b0=['tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x58b0,0x1c7));var _0x058b=function(_0x1e5a59,_0x22d345){_0x1e5a59=_0x1e5a59-0x0;var _0x4ca834=_0x58b0[_0x1e5a59];return _0x4ca834;};'use strict';var _=require(_0x058b('0x0'));var util=require(_0x058b('0x1'));var logger=require(_0x058b('0x2'))(_0x058b('0x3'));var moment=require(_0x058b('0x4'));var BPromise=require('bluebird');var rp=require(_0x058b('0x5'));var fs=require('fs');var path=require(_0x058b('0x6'));var rimraf=require(_0x058b('0x7'));var config=require(_0x058b('0x8'));var attributes=require(_0x058b('0x9'));module[_0x058b('0xa')]=function(_0x1a05bd,_0x1bd925){return _0x1a05bd[_0x058b('0xb')](_0x058b('0xc'),attributes,{'tableName':_0x058b('0xd'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x058b('0xe'),'fields':['name',_0x058b('0xf')]},{'unique':!![],'name':_0x058b('0x10'),'fields':[_0x058b('0x11'),_0x058b('0x12')]},{'unique':!![],'name':'name_mail','fields':[_0x058b('0x11'),'MailAccountId']},{'unique':!![],'name':_0x058b('0x13'),'fields':[_0x058b('0x11'),_0x058b('0x14')]},{'unique':!![],'name':_0x058b('0x15'),'fields':[_0x058b('0x11'),_0x058b('0x16')]},{'unique':!![],'name':_0x058b('0x17'),'fields':[_0x058b('0x11'),'OpenchannelAccountId']},{'unique':!![],'name':_0x058b('0x18'),'fields':[_0x058b('0x11'),_0x058b('0x19')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4aa1=['name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','name_chat','name','ChatWebsiteId','name_sms','SmsAccountId','name_fax','FaxAccountId'];(function(_0x510347,_0xdf770a){var _0x5cb84f=function(_0x4c35d7){while(--_0x4c35d7){_0x510347['push'](_0x510347['shift']());}};_0x5cb84f(++_0xdf770a);}(_0x4aa1,0xf3));var _0x14aa=function(_0x42182d,_0x125b1a){_0x42182d=_0x42182d-0x0;var _0x26459b=_0x4aa1[_0x42182d];return _0x26459b;};'use strict';var _=require(_0x14aa('0x0'));var util=require(_0x14aa('0x1'));var logger=require('../../config/logger')(_0x14aa('0x2'));var moment=require(_0x14aa('0x3'));var BPromise=require(_0x14aa('0x4'));var rp=require(_0x14aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14aa('0x6'));var config=require(_0x14aa('0x7'));var attributes=require(_0x14aa('0x8'));module[_0x14aa('0x9')]=function(_0x554216,_0x523201){return _0x554216['define']('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':['name','ListId']},{'unique':!![],'name':_0x14aa('0xa'),'fields':[_0x14aa('0xb'),_0x14aa('0xc')]},{'unique':!![],'name':'name_mail','fields':[_0x14aa('0xb'),'MailAccountId']},{'unique':!![],'name':_0x14aa('0xd'),'fields':[_0x14aa('0xb'),_0x14aa('0xe')]},{'unique':!![],'name':_0x14aa('0xf'),'fields':[_0x14aa('0xb'),_0x14aa('0x10')]},{'unique':!![],'name':_0x14aa('0x11'),'fields':[_0x14aa('0xb'),_0x14aa('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0x14aa('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e95a75b..10ff918 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(_0x445a24,_0x495d4f){var _0x384d9d=function(_0x4be351){while(--_0x4be351){_0x445a24['push'](_0x445a24['shift']());}};_0x384d9d(++_0x495d4f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0x2020d7,_0x4dc07f){var _0x4fa11a=function(_0x850ae2){while(--_0x850ae2){_0x2020d7['push'](_0x2020d7['shift']());}};_0x4fa11a(++_0x4dc07f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 8a1e5b8..22e603e 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 _0xc9c5=['post','create','put','update','delete','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','index','get','isAuthenticated','show'];(function(_0x50c8bc,_0x1d0748){var _0x393260=function(_0x3d3606){while(--_0x3d3606){_0x50c8bc['push'](_0x50c8bc['shift']());}};_0x393260(++_0x1d0748);}(_0xc9c5,0x193));var _0x5c9c=function(_0x559702,_0x2fa1a9){_0x559702=_0x559702-0x0;var _0x25a86b=_0xc9c5[_0x559702];return _0x25a86b;};'use strict';var multer=require(_0x5c9c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c9c('0x1'));var router=express[_0x5c9c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5c9c('0x3'));var interaction=require(_0x5c9c('0x4'));var config=require(_0x5c9c('0x5'));var controller=require(_0x5c9c('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x5c9c('0x7')]);router[_0x5c9c('0x8')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xa')]);router[_0x5c9c('0xb')]('/',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xc')]);router[_0x5c9c('0xd')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0xe')]);router[_0x5c9c('0xf')]('/:id',auth[_0x5c9c('0x9')](),controller[_0x5c9c('0x10')]);module[_0x5c9c('0x11')]=router; \ No newline at end of file +var _0x94a0=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','post','delete','destroy','exports','multer','path'];(function(_0x40a792,_0x146830){var _0x5e53d4=function(_0x17ddb7){while(--_0x17ddb7){_0x40a792['push'](_0x40a792['shift']());}};_0x5e53d4(++_0x146830);}(_0x94a0,0x85));var _0x094a=function(_0x3bbc10,_0x57c99a){_0x3bbc10=_0x3bbc10-0x0;var _0x2a0139=_0x94a0[_0x3bbc10];return _0x2a0139;};'use strict';var multer=require(_0x094a('0x0'));var util=require('util');var path=require(_0x094a('0x1'));var timeout=require(_0x094a('0x2'));var express=require('express');var router=express[_0x094a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x094a('0x4'));var config=require(_0x094a('0x5'));var controller=require(_0x094a('0x6'));router[_0x094a('0x7')]('/',auth[_0x094a('0x8')](),controller[_0x094a('0x9')]);router[_0x094a('0x7')](_0x094a('0xa'),auth[_0x094a('0x8')](),controller['show']);router[_0x094a('0xb')]('/',auth[_0x094a('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x094a('0xc')](_0x094a('0xa'),auth['isAuthenticated'](),controller[_0x094a('0xd')]);module[_0x094a('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index d63919c..1ef0b36 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 _0x3d44=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','KHOMP','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x41c5bf,_0x12697d){var _0x149644=function(_0x4a9ded){while(--_0x4a9ded){_0x41c5bf['push'](_0x41c5bf['shift']());}};_0x149644(++_0x12697d);}(_0x3d44,0xff));var _0x43d4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3d44[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x43d4('0x0'));module[_0x43d4('0x1')]={'name':{'type':Sequelize[_0x43d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43d4('0x2')]},'ecm':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0x4'),'no'),'defaultValue':_0x43d4('0x4')},'headerinfo':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':_0x43d4('0x5')},'localstationid':{'type':Sequelize[_0x43d4('0x2')],'unique':_0x43d4('0x6')},'minrate':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0x7'),_0x43d4('0x8'),_0x43d4('0x9'),'9600','12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x43d4('0x3')]('2400','4800',_0x43d4('0x9'),_0x43d4('0xa'),'12000',_0x43d4('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':_0x43d4('0xc')},'gateway':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x43d4('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x43d4('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x43d4('0x3')](_0x43d4('0xe'),_0x43d4('0xf'),'DADHI',_0x43d4('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x43d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43d4('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x43d4('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x43d4('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x43d4('0x11')],'defaultValue':![],'comment':_0x43d4('0x13'),'set':function(_0x50eece){if(!_0x50eece)this[_0x43d4('0x14')](_0x43d4('0x15'),null);this['setDataValue'](_0x43d4('0x16'),_0x50eece);}}}; \ No newline at end of file +var _0x854d=['yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM'];(function(_0x2fe94d,_0xe3d4c8){var _0x24bc10=function(_0x2a5f80){while(--_0x2a5f80){_0x2fe94d['push'](_0x2fe94d['shift']());}};_0x24bc10(++_0xe3d4c8);}(_0x854d,0xf8));var _0xd854=function(_0x44bd5b,_0x244945){_0x44bd5b=_0x44bd5b-0x0;var _0x5412f8=_0x854d[_0x44bd5b];return _0x5412f8;};'use strict';var Sequelize=require(_0xd854('0x0'));module[_0xd854('0x1')]={'name':{'type':Sequelize[_0xd854('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd854('0x2')]},'ecm':{'type':Sequelize[_0xd854('0x3')]('yes','no'),'defaultValue':_0xd854('0x4')},'headerinfo':{'type':Sequelize[_0xd854('0x2')],'defaultValue':_0xd854('0x5')},'localstationid':{'type':Sequelize[_0xd854('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xd854('0x3')](_0xd854('0x6'),_0xd854('0x7'),_0xd854('0x8'),_0xd854('0x9'),'12000',_0xd854('0xa')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xd854('0x3')](_0xd854('0x6'),_0xd854('0x7'),_0xd854('0x8'),'9600','12000',_0xd854('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xd854('0x2')],'defaultValue':_0xd854('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd854('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd854('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd854('0x3')](_0xd854('0xd'),_0xd854('0xe'),_0xd854('0xf'),'KHOMP'),'defaultValue':_0xd854('0xd')},'key':{'type':Sequelize[_0xd854('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd854('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd854('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd854('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd854('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd854('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd854('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd854('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd854('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0xd854('0x11')},'mandatoryDisposition':{'type':Sequelize[_0xd854('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4adf12){if(!_0x4adf12)this['setDataValue'](_0xd854('0x12'),null);this[_0xd854('0x13')](_0xd854('0x14'),_0x4adf12);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 352db3f..8c5e562 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 _0x84a6=['register','client','http','request','then','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','get','FaxAccounts','UserProfileResource','end','name','send','index','map','FaxAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','show','params','Pause','mandatoryDispositionPause','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','includeAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','include','removeAnswers','ids','addInteraction','FaxInteraction','Contact','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','findAndCountAll','stack','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','CmList','List','CmContact','updatedAt','DESC','attachments','root','server/files/attachments','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','./faxAccount.socket'];(function(_0x85e674,_0x5e0cd4){var _0x19fdcc=function(_0x1ec36a){while(--_0x1ec36a){_0x85e674['push'](_0x85e674['shift']());}};_0x19fdcc(++_0x5e0cd4);}(_0x84a6,0xaa));var _0x684a=function(_0x5582d2,_0x5a87cf){_0x5582d2=_0x5582d2-0x0;var _0x47c2fe=_0x84a6[_0x5582d2];return _0x47c2fe;};'use strict';var emlformat=require(_0x684a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x684a('0x1'));var jsonpatch=require(_0x684a('0x2'));var rp=require(_0x684a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x684a('0x4'));var sox=require(_0x684a('0x5'));var csv=require(_0x684a('0x6'));var ejs=require(_0x684a('0x7'));var fs=require('fs');var fs_extra=require(_0x684a('0x8'));var _=require(_0x684a('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x684a('0xa'));var deskjs=require(_0x684a('0xb'));var toCsv=require(_0x684a('0x6'));var querystring=require('querystring');var Papa=require(_0x684a('0xc'));var Redis=require(_0x684a('0xd'));var authService=require(_0x684a('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x684a('0xf'));var hardwareService=require(_0x684a('0x10'));var logger=require(_0x684a('0x11'))('api');var utils=require(_0x684a('0x12'));var config=require(_0x684a('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x684a('0x14'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x684a('0x15')]));require(_0x684a('0x16'))[_0x684a('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0x684a('0x18')][_0x684a('0x19')]({'port':0x232c});var client9002=jayson[_0x684a('0x18')][_0x684a('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x3994ba,_0x1020e7,_0xed0d33,_0x2b3cfc){return new BPromise(function(_0x49e81d,_0x1bb947){var _0x4eb92e=_0x2b3cfc||client;return _0x4eb92e[_0x684a('0x1a')](_0x3994ba,_0xed0d33)[_0x684a('0x1b')](function(_0x506561){logger['info']('FaxAccount,\x20%s,\x20%s',_0x1020e7,'request\x20sent');logger['debug'](_0x684a('0x1c'),_0x1020e7,_0x684a('0x1d'),JSON[_0x684a('0x1e')](_0x506561));if(_0x506561['error']){if(_0x506561[_0x684a('0x1f')][_0x684a('0x20')]===0x1f4){logger[_0x684a('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);return _0x1bb947(_0x506561['error']['message']);}logger[_0x684a('0x1f')](_0x684a('0x22'),_0x1020e7,_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);return _0x49e81d(_0x506561[_0x684a('0x1f')][_0x684a('0x21')]);}else{logger[_0x684a('0x23')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x684a('0x1d'));_0x49e81d(_0x506561[_0x684a('0x24')]['message']);}})[_0x684a('0x25')](function(_0x553edb){logger[_0x684a('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x1020e7,_0x553edb);_0x1bb947(_0x553edb);});});}function respondWithStatusCode(_0x7004be,_0x651fca){_0x651fca=_0x651fca||0xcc;return function(_0x194930){if(_0x194930){return _0x7004be[_0x684a('0x26')](_0x651fca);}return _0x7004be[_0x684a('0x27')](_0x651fca)['end']();};}function respondWithResult(_0x381a02,_0x4f6a59){_0x4f6a59=_0x4f6a59||0xc8;return function(_0x4901b9){if(_0x4901b9){return _0x381a02[_0x684a('0x27')](_0x4f6a59)[_0x684a('0x28')](_0x4901b9);}};}function respondWithFilteredResult(_0x219dd5,_0x56e4e5){return function(_0x414972){if(_0x414972){var _0x56e20c=typeof _0x56e4e5[_0x684a('0x29')]===_0x684a('0x2a')&&typeof _0x56e4e5[_0x684a('0x2b')]==='undefined';var _0x370442=_0x414972[_0x684a('0x2c')];var _0x451464=_0x56e20c?0x0:_0x56e4e5[_0x684a('0x29')];var _0x25899c=_0x56e20c?_0x414972[_0x684a('0x2c')]:_0x56e4e5[_0x684a('0x29')]+_0x56e4e5['limit'];var _0x34f63a;if(_0x25899c>=_0x370442){_0x25899c=_0x370442;_0x34f63a=0xc8;}else{_0x34f63a=0xce;}_0x219dd5[_0x684a('0x27')](_0x34f63a);return _0x219dd5[_0x684a('0x2d')](_0x684a('0x2e'),_0x451464+'-'+_0x25899c+'/'+_0x370442)[_0x684a('0x28')](_0x414972);}return null;};}function patchUpdates(_0x4b9633){return function(_0x4c1a02){try{jsonpatch['apply'](_0x4c1a02,_0x4b9633,!![]);}catch(_0x1e01db){return BPromise[_0x684a('0x2f')](_0x1e01db);}return _0x4c1a02['save']();};}function saveUpdates(_0x55a0c9,_0x1d2547){return function(_0x344b94){if(_0x344b94){return _0x344b94[_0x684a('0x30')](_0x55a0c9)[_0x684a('0x1b')](function(_0x3ca386){return _0x3ca386;});}return null;};}function removeEntity(_0x4fb3d1,_0x45fd71){return function(_0x3e48ff){if(_0x3e48ff){return _0x3e48ff[_0x684a('0x31')]()[_0x684a('0x1b')](function(){var _0x5cad2e=_0x3e48ff[_0x684a('0x32')]({'plain':!![]});var _0x592b5d=_0x684a('0x33');return db[_0x684a('0x34')][_0x684a('0x31')]({'where':{'type':_0x592b5d,'resourceId':_0x5cad2e['id']}})[_0x684a('0x1b')](function(){return _0x3e48ff;});})[_0x684a('0x1b')](function(){_0x4fb3d1[_0x684a('0x27')](0xcc)[_0x684a('0x35')]();});}};}function handleEntityNotFound(_0x37adff,_0x56f69a){return function(_0x54d667){if(!_0x54d667){_0x37adff['sendStatus'](0x194);}return _0x54d667;};}function handleError(_0x4cb237,_0x22d74b){_0x22d74b=_0x22d74b||0x1f4;return function(_0x1fadea){logger['error'](_0x1fadea['stack']);if(_0x1fadea[_0x684a('0x36')]){delete _0x1fadea[_0x684a('0x36')];}_0x4cb237[_0x684a('0x27')](_0x22d74b)[_0x684a('0x37')](_0x1fadea);};}exports[_0x684a('0x38')]=function(_0x323879,_0xe450d0){var _0x13f639={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x18c9f3={},_0xa2ace4={'count':0x0,'rows':[]};var _0x1952fb=_[_0x684a('0x39')](db[_0x684a('0x3a')][_0x684a('0x3b')],function(_0x572776){return{'name':_0x572776['fieldName'],'type':_0x572776[_0x684a('0x3c')][_0x684a('0x3d')]};});_0x18c9f3[_0x684a('0x3e')]=_['map'](_0x1952fb,_0x684a('0x36'));_0x18c9f3[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x323879[_0x684a('0x3f')]);_0x18c9f3[_0x684a('0x41')]=_[_0x684a('0x42')](_0x18c9f3[_0x684a('0x3e')],_0x18c9f3[_0x684a('0x3f')]);_0x13f639[_0x684a('0x43')]=_[_0x684a('0x42')](_0x18c9f3[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x323879[_0x684a('0x3f')][_0x684a('0x44')]));_0x13f639[_0x684a('0x43')]=_0x13f639[_0x684a('0x43')][_0x684a('0x45')]?_0x13f639[_0x684a('0x43')]:_0x18c9f3[_0x684a('0x3e')];if(!_0x323879[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x13f639[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x323879[_0x684a('0x3f')][_0x684a('0x2b')]);_0x13f639[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x323879[_0x684a('0x3f')]['offset']);}_0x13f639[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x323879[_0x684a('0x3f')][_0x684a('0x49')]);_0x13f639[_0x684a('0x4a')]=qs[_0x684a('0x41')](_['pick'](_0x323879[_0x684a('0x3f')],_0x18c9f3[_0x684a('0x41')]),_0x1952fb);if(_0x323879[_0x684a('0x3f')]['filter']){_0x13f639[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x13f639[_0x684a('0x4a')],{'$or':_[_0x684a('0x39')](_0x1952fb,function(_0x10086e){if(_0x10086e['type']!==_0x684a('0x4c')){var _0x1091c={};_0x1091c[_0x10086e[_0x684a('0x36')]]={'$like':'%'+_0x323879[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x1091c;}})});}_0x13f639=_[_0x684a('0x4b')]({},_0x13f639,_0x323879['options']);var _0x193d1a={'where':_0x13f639['where']};return db[_0x684a('0x3a')][_0x684a('0x2c')](_0x193d1a)['then'](function(_0x195d6d){_0xa2ace4[_0x684a('0x2c')]=_0x195d6d;if(_0x323879[_0x684a('0x3f')]['includeAll']){_0x13f639['include']=[{'all':!![]}];}return db[_0x684a('0x3a')][_0x684a('0x4e')](_0x13f639);})[_0x684a('0x1b')](function(_0x53b9d6){_0xa2ace4[_0x684a('0x4f')]=_0x53b9d6;return _0xa2ace4;})[_0x684a('0x1b')](respondWithFilteredResult(_0xe450d0,_0x13f639))[_0x684a('0x25')](handleError(_0xe450d0,null));};exports[_0x684a('0x50')]=function(_0x560378,_0x29ed33){var _0x195913={'raw':![],'where':{'id':_0x560378[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0x52')],'as':_0x684a('0x53')}]},_0x3bf1d0={};_0x3bf1d0[_0x684a('0x3e')]=_['keys'](db[_0x684a('0x3a')]['rawAttributes']);_0x3bf1d0[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x560378['query']);_0x3bf1d0['filters']=_[_0x684a('0x42')](_0x3bf1d0[_0x684a('0x3e')],_0x3bf1d0[_0x684a('0x3f')]);_0x195913[_0x684a('0x43')]=_[_0x684a('0x42')](_0x3bf1d0[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x560378['query'][_0x684a('0x44')]));_0x195913[_0x684a('0x43')]=_0x195913[_0x684a('0x43')][_0x684a('0x45')]?_0x195913[_0x684a('0x43')]:_0x3bf1d0[_0x684a('0x3e')];if(_0x560378[_0x684a('0x3f')]['includeAll']){_0x195913['include']=[{'all':!![]}];}_0x195913=_[_0x684a('0x4b')]({},_0x195913,_0x560378[_0x684a('0x54')]);return db[_0x684a('0x3a')]['find'](_0x195913)[_0x684a('0x1b')](handleEntityNotFound(_0x29ed33,null))[_0x684a('0x1b')](respondWithResult(_0x29ed33,null))[_0x684a('0x25')](handleError(_0x29ed33,null));};exports['create']=function(_0x3ab9cd,_0xf5706e){return db[_0x684a('0x3a')]['create'](_0x3ab9cd['body'],{})[_0x684a('0x1b')](function(_0x2e7a8d){var _0xfe15c5=_0x3ab9cd[_0x684a('0x55')][_0x684a('0x32')]({'plain':!![]});if(!_0xfe15c5)throw new Error(_0x684a('0x56'));if(_0xfe15c5[_0x684a('0x57')]===_0x684a('0x55')){var _0x23c9e3=_0x2e7a8d[_0x684a('0x32')]({'plain':!![]});var _0x3e891e='FaxAccounts';return db[_0x684a('0x58')][_0x684a('0x59')]({'where':{'name':_0x3e891e,'userProfileId':_0xfe15c5['userProfileId']},'raw':!![]})[_0x684a('0x1b')](function(_0x517081){if(_0x517081&&_0x517081['autoAssociation']===0x0){return db['UserProfileResource'][_0x684a('0x5a')]({'name':_0x23c9e3[_0x684a('0x36')],'resourceId':_0x23c9e3['id'],'type':_0x517081[_0x684a('0x36')],'sectionId':_0x517081['id']},{})[_0x684a('0x1b')](function(){return _0x2e7a8d;});}else{return _0x2e7a8d;}})[_0x684a('0x25')](function(_0x13c850){logger[_0x684a('0x1f')](_0x684a('0x5b'),_0x13c850);throw _0x13c850;});}return _0x2e7a8d;})[_0x684a('0x1b')](respondWithResult(_0xf5706e,0xc9))[_0x684a('0x25')](handleError(_0xf5706e,null));};exports[_0x684a('0x30')]=function(_0x3081dc,_0x114945){if(_0x3081dc[_0x684a('0x5c')]['id']){delete _0x3081dc['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x3081dc[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0x52')],'as':'mandatoryDispositionPause'}]})[_0x684a('0x1b')](handleEntityNotFound(_0x114945,null))[_0x684a('0x1b')](saveUpdates(_0x3081dc[_0x684a('0x5c')],null))[_0x684a('0x1b')](respondWithResult(_0x114945,null))['catch'](handleError(_0x114945,null));};exports[_0x684a('0x31')]=function(_0x291e79,_0x5d775d){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x291e79[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0x5d775d,null))[_0x684a('0x1b')](removeEntity(_0x5d775d,null))['catch'](handleError(_0x5d775d,null));};exports[_0x684a('0x5d')]=function(_0x32d060,_0x2b0e37){return db['FaxAccount'][_0x684a('0x5d')]()[_0x684a('0x1b')](respondWithResult(_0x2b0e37,null))['catch'](handleError(_0x2b0e37,null));};exports[_0x684a('0x5e')]=function(_0x2be273,_0x1fa049,_0x487e19){if(_0x2be273[_0x684a('0x5c')]['id']){delete _0x2be273['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x2be273[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0x1fa049,null))[_0x684a('0x1b')](function(_0x30e3ac){if(_0x30e3ac){_0x2be273[_0x684a('0x5c')][_0x684a('0x5f')]=_0x30e3ac['id'];return db['Disposition'][_0x684a('0x5a')](_0x2be273['body']);}})['then'](respondWithResult(_0x1fa049,null))[_0x684a('0x25')](handleError(_0x1fa049,null));};exports[_0x684a('0x60')]=function(_0x230a33,_0x8a0977,_0x111fcf){var _0x47570c={'raw':![],'where':{}};var _0x31ad4c={};var _0x400a0f={'count':0x0,'rows':[]};return db[_0x684a('0x3a')][_0x684a('0x61')]({'where':{'id':_0x230a33[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x8a0977,null))[_0x684a('0x1b')](function(_0x202be2){if(_0x202be2){_0x31ad4c['model']=_['keys'](db[_0x684a('0x62')][_0x684a('0x3b')]);_0x31ad4c['query']=_[_0x684a('0x40')](_0x230a33[_0x684a('0x3f')]);_0x31ad4c[_0x684a('0x41')]=_[_0x684a('0x42')](_0x31ad4c[_0x684a('0x3e')],_0x31ad4c[_0x684a('0x3f')]);_0x47570c[_0x684a('0x43')]=_[_0x684a('0x42')](_0x31ad4c[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x230a33['query'][_0x684a('0x44')]));_0x47570c['attributes']=_0x47570c['attributes']['length']?_0x47570c[_0x684a('0x43')]:_0x31ad4c['model'];if(!_0x230a33[_0x684a('0x3f')]['hasOwnProperty'](_0x684a('0x47'))){_0x47570c[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x230a33[_0x684a('0x3f')][_0x684a('0x2b')]);_0x47570c[_0x684a('0x29')]=qs['offset'](_0x230a33[_0x684a('0x3f')][_0x684a('0x29')]);}_0x47570c[_0x684a('0x48')]=qs['sort'](_0x230a33[_0x684a('0x3f')]['sort']);_0x47570c[_0x684a('0x4a')]=qs[_0x684a('0x41')](_['pick'](_0x230a33[_0x684a('0x3f')],_0x31ad4c['filters']));_0x47570c['where'][_0x684a('0x5f')]=_0x202be2['id'];if(_0x230a33[_0x684a('0x3f')]['filter']){_0x47570c[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x47570c[_0x684a('0x4a')],{'$or':_['map'](_0x47570c[_0x684a('0x43')],function(_0x3d27a4){var _0x597892={};_0x597892[_0x3d27a4]={'$like':'%'+_0x230a33['query']['filter']+'%'};return _0x597892;})});}_0x47570c=_['merge']({},_0x47570c,_0x230a33[_0x684a('0x54')]);return db['Disposition'][_0x684a('0x2c')]({'where':_0x47570c[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x4c99c9){_0x400a0f['count']=_0x4c99c9;if(_0x230a33[_0x684a('0x3f')][_0x684a('0x63')]){_0x47570c['include']=[{'all':!![]}];}return db[_0x684a('0x62')][_0x684a('0x4e')](_0x47570c);})[_0x684a('0x1b')](function(_0x146807){_0x400a0f[_0x684a('0x4f')]=_0x146807;return _0x400a0f;});}})[_0x684a('0x1b')](respondWithFilteredResult(_0x8a0977,_0x47570c))[_0x684a('0x25')](handleError(_0x8a0977,null));};exports[_0x684a('0x64')]=function(_0x2d8ff2,_0x5b0b12,_0x303306){return db['FaxAccount'][_0x684a('0x59')]({'where':{'id':_0x2d8ff2[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x5b0b12,null))['then'](function(_0x4e4c9a){if(_0x4e4c9a){return _0x4e4c9a[_0x684a('0x64')](_0x2d8ff2[_0x684a('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x5b0b12,null))[_0x684a('0x25')](handleError(_0x5b0b12,null));};exports[_0x684a('0x65')]=function(_0x55fa4a,_0x223141,_0x8aa0ee){if(_0x55fa4a[_0x684a('0x5c')]['id']){delete _0x55fa4a['body']['id'];}return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x55fa4a['params']['id']}})['then'](handleEntityNotFound(_0x223141,null))[_0x684a('0x1b')](function(_0x57b5b4){if(_0x57b5b4){_0x55fa4a[_0x684a('0x5c')]['FaxAccountId']=_0x57b5b4['id'];return db[_0x684a('0x66')][_0x684a('0x5a')](_0x55fa4a['body']);}})[_0x684a('0x1b')](respondWithResult(_0x223141,null))[_0x684a('0x25')](handleError(_0x223141,null));};exports[_0x684a('0x67')]=function(_0x171c4e,_0xfa6f50,_0x23280a){var _0x364849={'raw':![],'where':{}};var _0x2d3fad={};var _0x55792c={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x171c4e[_0x684a('0x51')]['id']}})['then'](handleEntityNotFound(_0xfa6f50,null))[_0x684a('0x1b')](function(_0x34198b){if(_0x34198b){_0x2d3fad['model']=_[_0x684a('0x40')](db['CannedAnswer'][_0x684a('0x3b')]);_0x2d3fad[_0x684a('0x3f')]=_['keys'](_0x171c4e[_0x684a('0x3f')]);_0x2d3fad[_0x684a('0x41')]=_[_0x684a('0x42')](_0x2d3fad[_0x684a('0x3e')],_0x2d3fad[_0x684a('0x3f')]);_0x364849[_0x684a('0x43')]=_[_0x684a('0x42')](_0x2d3fad['model'],qs[_0x684a('0x44')](_0x171c4e[_0x684a('0x3f')][_0x684a('0x44')]));_0x364849['attributes']=_0x364849[_0x684a('0x43')][_0x684a('0x45')]?_0x364849['attributes']:_0x2d3fad[_0x684a('0x3e')];if(!_0x171c4e[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x364849[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x171c4e['query'][_0x684a('0x2b')]);_0x364849[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x171c4e['query'][_0x684a('0x29')]);}_0x364849[_0x684a('0x48')]=qs['sort'](_0x171c4e[_0x684a('0x3f')][_0x684a('0x49')]);_0x364849[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0x171c4e['query'],_0x2d3fad['filters']));_0x364849['where'][_0x684a('0x5f')]=_0x34198b['id'];if(_0x171c4e[_0x684a('0x3f')][_0x684a('0x4d')]){_0x364849['where']=_['merge'](_0x364849[_0x684a('0x4a')],{'$or':_[_0x684a('0x39')](_0x364849[_0x684a('0x43')],function(_0x38e92c){var _0x2cea81={};_0x2cea81[_0x38e92c]={'$like':'%'+_0x171c4e['query'][_0x684a('0x4d')]+'%'};return _0x2cea81;})});}_0x364849=_[_0x684a('0x4b')]({},_0x364849,_0x171c4e[_0x684a('0x54')]);return db['CannedAnswer'][_0x684a('0x2c')]({'where':_0x364849[_0x684a('0x4a')]})['then'](function(_0x5e0ee8){_0x55792c[_0x684a('0x2c')]=_0x5e0ee8;if(_0x171c4e['query'][_0x684a('0x63')]){_0x364849[_0x684a('0x69')]=[{'all':!![]}];}return db[_0x684a('0x66')]['findAll'](_0x364849);})[_0x684a('0x1b')](function(_0x15a46c){_0x55792c[_0x684a('0x4f')]=_0x15a46c;return _0x55792c;});}})[_0x684a('0x1b')](respondWithFilteredResult(_0xfa6f50,_0x364849))[_0x684a('0x25')](handleError(_0xfa6f50,null));};exports[_0x684a('0x6a')]=function(_0x4b7436,_0x2fb920,_0x3b0744){return db[_0x684a('0x3a')]['find']({'where':{'id':_0x4b7436['params']['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x2fb920,null))[_0x684a('0x1b')](function(_0x1abe8b){if(_0x1abe8b){return _0x1abe8b[_0x684a('0x6a')](_0x4b7436[_0x684a('0x3f')][_0x684a('0x6b')]);}})[_0x684a('0x1b')](respondWithStatusCode(_0x2fb920,null))[_0x684a('0x25')](handleError(_0x2fb920,null));};exports[_0x684a('0x6c')]=function(_0x549995,_0x2754b8,_0x16a46d){return db['FaxInteraction'][_0x684a('0x59')]({'where':{'id':_0x549995[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x2754b8,null))[_0x684a('0x1b')](function(_0x4b4d6c){if(_0x4b4d6c){return _0x4b4d6c[_0x684a('0x6c')](_0x549995[_0x684a('0x5c')][_0x684a('0x6b')],_['omit'](_0x549995[_0x684a('0x5c')],['ids','id'])||{});}})[_0x684a('0x1b')](respondWithResult(_0x2754b8,null))[_0x684a('0x25')](handleError(_0x2754b8,null));};exports['getInteractions']=function(_0xabcbd2,_0x190a37,_0x4715cc){var _0x4f677e={'raw':![],'where':{}};var _0x9074a6={};var _0x3030ba={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0xabcbd2[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x190a37,null))['then'](function(_0x283d2e){if(_0x283d2e){_0x9074a6[_0x684a('0x3e')]=_['keys'](db[_0x684a('0x6d')]['rawAttributes']);_0x9074a6[_0x684a('0x3f')]=_[_0x684a('0x40')](_0xabcbd2['query']);_0x9074a6[_0x684a('0x41')]=_[_0x684a('0x42')](_0x9074a6[_0x684a('0x3e')],_0x9074a6['query']);_0x4f677e[_0x684a('0x43')]=_[_0x684a('0x42')](_0x9074a6[_0x684a('0x3e')],qs[_0x684a('0x44')](_0xabcbd2['query']['fields']));_0x4f677e[_0x684a('0x43')]=_0x4f677e['attributes'][_0x684a('0x45')]?_0x4f677e[_0x684a('0x43')]:_0x9074a6['model'];if(!_0xabcbd2[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x4f677e['limit']=qs['limit'](_0xabcbd2['query'][_0x684a('0x2b')]);_0x4f677e[_0x684a('0x29')]=qs[_0x684a('0x29')](_0xabcbd2['query']['offset']);}_0x4f677e[_0x684a('0x48')]=qs[_0x684a('0x49')](_0xabcbd2['query'][_0x684a('0x49')]);_0x4f677e[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0xabcbd2[_0x684a('0x3f')],_0x9074a6[_0x684a('0x41')]));_0x4f677e['where'][_0x684a('0x5f')]=_0x283d2e['id'];if(_0xabcbd2[_0x684a('0x3f')][_0x684a('0x4d')]){_0x4f677e['where']=_[_0x684a('0x4b')](_0x4f677e[_0x684a('0x4a')],{'$or':_['map'](_0x4f677e['attributes'],function(_0x39df54){var _0x42e7f5={};_0x42e7f5[_0x39df54]={'$like':'%'+_0xabcbd2[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x42e7f5;})});}_0x4f677e=_['merge']({},_0x4f677e,_0xabcbd2['options']);return db[_0x684a('0x6d')]['count']({'where':_0x4f677e[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x181bc0){_0x3030ba[_0x684a('0x2c')]=_0x181bc0;if(_0xabcbd2[_0x684a('0x3f')][_0x684a('0x63')]){_0x4f677e[_0x684a('0x69')]=[{'model':db['CmContact'],'as':_0x684a('0x6e'),'required':![]},{'model':db['User'],'as':_0x684a('0x6f'),'attributes':[_0x684a('0x36'),'fullname',_0x684a('0x70')],'required':![]},{'model':db[_0x684a('0x71')],'as':_0x684a('0x72'),'attributes':['id',_0x684a('0x36'),_0x684a('0x73')],'where':_0xabcbd2['query'][_0x684a('0x74')]?{'id':_0xabcbd2[_0x684a('0x3f')]['tag']}:undefined,'required':_0xabcbd2[_0x684a('0x3f')][_0x684a('0x74')]?!![]:![]}];}return db[_0x684a('0x6d')]['findAll'](_0x4f677e);})[_0x684a('0x1b')](function(_0xbe7caf){_0x3030ba['rows']=_0xbe7caf;return _0x3030ba;});}})['then'](respondWithFilteredResult(_0x190a37,_0x4f677e))[_0x684a('0x25')](handleError(_0x190a37,null));};exports[_0x684a('0x75')]=function(_0x21f51e,_0x16bc7c){var _0x592277=_0x21f51e[_0x684a('0x51')]['id'];var _0x46fd86=_0x21f51e[_0x684a('0x5c')];var _0x2e7346=0xc8;var _0x5ca442=null;return db[_0x684a('0x76')][_0x684a('0x77')]({'isolationLevel':db[_0x684a('0x76')][_0x684a('0x78')][_0x684a('0x79')]['READ_COMMITTED']},function(_0x9b1b44){return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x592277},'transaction':_0x9b1b44})[_0x684a('0x1b')](function(_0x50ae10){if(_0x50ae10){return db[_0x684a('0x7a')][_0x684a('0x31')]({'where':{'FaxAccountId':_0x592277},'transaction':_0x9b1b44})[_0x684a('0x1b')](function(){var _0xc6738d=_['map'](_0x46fd86,function(_0x605cea){_0x605cea[_0x684a('0x5f')]=_0x592277;return _0x605cea;});return db[_0x684a('0x7a')][_0x684a('0x7b')](_0xc6738d,{'transaction':_0x9b1b44});});}else{_0x2e7346=0x194;_0x5ca442=[];}});})[_0x684a('0x1b')](function(){if(_0x2e7346!==0x194){return db['FaxApplication'][_0x684a('0x7c')]({'where':{'FaxAccountId':_0x592277},'order':'priority'})[_0x684a('0x1b')](function(_0x1f0ef1){_0x5ca442=_0x1f0ef1;});}})[_0x684a('0x25')](function(_0xb553c9){_0x2e7346=0x1f4;logger[_0x684a('0x1f')](_0xb553c9[_0x684a('0x7d')]);if(_0xb553c9[_0x684a('0x36')]){delete _0xb553c9[_0x684a('0x36')];}_0x5ca442=_0xb553c9;})['finally'](function(){if(_0x5ca442===null){_0x16bc7c[_0x684a('0x26')](_0x2e7346);}else{if(_0x2e7346===0x1f4){_0x16bc7c[_0x684a('0x27')](_0x2e7346)[_0x684a('0x37')](_0x5ca442);}else{_0x16bc7c[_0x684a('0x27')](_0x2e7346)[_0x684a('0x28')](_0x5ca442);}}});};exports[_0x684a('0x7e')]=function(_0x2a1a12,_0xad76a4,_0x23e1a5){var _0x13fee2={};var _0x3a86f1={};var _0x1c3e6b;var _0x591467;return db[_0x684a('0x3a')][_0x684a('0x61')]({'where':{'id':_0x2a1a12[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0xad76a4,null))[_0x684a('0x1b')](function(_0x57cfc3){if(_0x57cfc3){_0x1c3e6b=_0x57cfc3;_0x3a86f1[_0x684a('0x3e')]=_[_0x684a('0x40')](db[_0x684a('0x7a')][_0x684a('0x3b')]);_0x3a86f1[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x2a1a12[_0x684a('0x3f')]);_0x3a86f1[_0x684a('0x41')]=_['intersection'](_0x3a86f1[_0x684a('0x3e')],_0x3a86f1['query']);_0x13fee2[_0x684a('0x43')]=_[_0x684a('0x42')](_0x3a86f1['model'],qs[_0x684a('0x44')](_0x2a1a12[_0x684a('0x3f')][_0x684a('0x44')]));_0x13fee2['attributes']=_0x13fee2[_0x684a('0x43')][_0x684a('0x45')]?_0x13fee2['attributes']:_0x3a86f1[_0x684a('0x3e')];_0x13fee2[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x2a1a12[_0x684a('0x3f')][_0x684a('0x49')]);_0x13fee2[_0x684a('0x4a')]=qs[_0x684a('0x41')](_[_0x684a('0x68')](_0x2a1a12['query'],_0x3a86f1[_0x684a('0x41')]));if(_0x2a1a12[_0x684a('0x3f')][_0x684a('0x4d')]){_0x13fee2[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x13fee2['where'],{'$or':_[_0x684a('0x39')](_0x13fee2['attributes'],function(_0x473d70){var _0x1a9795={};_0x1a9795[_0x473d70]={'$like':'%'+_0x2a1a12[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x1a9795;})});}_0x13fee2=_['merge']({},_0x13fee2,_0x2a1a12['options']);return _0x1c3e6b['getApplications'](_0x13fee2);}})['then'](function(_0x151325){if(_0x151325){_0x591467=_0x151325[_0x684a('0x45')];if(!_0x2a1a12[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x13fee2[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x2a1a12[_0x684a('0x3f')]['limit']);_0x13fee2['offset']=qs[_0x684a('0x29')](_0x2a1a12[_0x684a('0x3f')]['offset']);}return _0x1c3e6b[_0x684a('0x7e')](_0x13fee2);}})['then'](function(_0x31c892){if(_0x31c892){return _0x31c892?{'count':_0x591467,'rows':_0x31c892}:null;}})[_0x684a('0x1b')](respondWithResult(_0xad76a4,null))['catch'](handleError(_0xad76a4,null));};function Extension(_0xf6db71,_0x143206,_0x332075,_0x1ed60a){this[_0x684a('0x7f')]=_0x684a('0x80');this[_0x684a('0x81')]=_0xf6db71[_0x684a('0x82')];this[_0x684a('0x83')]=_0x1ed60a;this[_0x684a('0x3c')]=_0x684a('0x84');this[_0x684a('0x85')]=_0x684a('0x86');this[_0x684a('0x5f')]=_0xf6db71['id'];this['priority']=_0x143206;this['appdata']=_0x332075;}function createExtensionsReciveFax(_0x435f30){var _0x2a426e=0x1;var _0x5730b8=[];_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'',_0x684a('0x88')));_0x2a426e+=0x1;_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'CDR(type)=inbound-fax',_0x684a('0x89')));_0x2a426e+=0x1;for(var _0x1a04bc in _0x435f30){if(_0x435f30['hasOwnProperty'](_0x1a04bc)&&(_0x1a04bc===_0x684a('0x8a')||_0x1a04bc==='localstationid'||_0x1a04bc===_0x684a('0x8b')||_0x1a04bc===_0x684a('0x8c')||_0x1a04bc===_0x684a('0x8d')||_0x1a04bc===_0x684a('0x8e')||_0x1a04bc===_0x684a('0x8f')||_0x1a04bc===_0x684a('0x90')||_0x1a04bc==='t38timeout')){_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,_0x684a('0x91')+_0x1a04bc+')='+_0x435f30[_0x1a04bc],_0x684a('0x89')));_0x2a426e+=0x1;}}_0x5730b8['push'](new Extension(_0x435f30,_0x2a426e,'6',_0x684a('0x92')));_0x2a426e+=0x1;_0x5730b8[_0x684a('0x87')](new Extension(_0x435f30,_0x2a426e,'/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',_0x684a('0x93')));_0x2a426e=0x0;return _0x5730b8;}exports[_0x684a('0x94')]=function(_0x3c1885,_0x36cf74,_0x2db757){var _0x449d55;return db['sequelize'][_0x684a('0x77')](function(_0xf54216){return db[_0x684a('0x3a')][_0x684a('0x5a')](_0x3c1885[_0x684a('0x5c')],{'transaction':_0xf54216})['then'](function(_0x36d03a){_0x449d55=_0x36d03a['get']({'plain':!![]});return db[_0x684a('0x95')]['bulkCreate'](createExtensionsReciveFax(_0x449d55),{'transaction':_0xf54216});});})[_0x684a('0x1b')](function(){return _0x449d55;})[_0x684a('0x1b')](respondWithResult(_0x36cf74,null))['catch'](handleError(_0x36cf74,null));};exports[_0x684a('0x96')]=function(_0x2d39e2,_0x330cc2,_0x1a6d1e){var _0x1065ee;return db['sequelize']['transaction'](function(_0x4ae9fa){return db[_0x684a('0x3a')][_0x684a('0x30')](_0x2d39e2[_0x684a('0x5c')],{'where':{'id':_0x2d39e2[_0x684a('0x5c')]['id']},'transaction':_0x4ae9fa})[_0x684a('0x1b')](function(_0xcf3bd1){return db[_0x684a('0x95')][_0x684a('0x31')]({'where':{'FaxAccountId':_0x2d39e2[_0x684a('0x5c')]['id']},'transaction':_0x4ae9fa})[_0x684a('0x1b')](function(_0x3e526d){return db[_0x684a('0x95')][_0x684a('0x7b')](createExtensionsReciveFax(_[_0x684a('0x97')](_0x2d39e2[_0x684a('0x5c')],[_0x684a('0x98'),_0x684a('0x3d'),_0x684a('0x99'),'updatedAt',_0x684a('0x9a'),_0x684a('0x9b')])),{'transaction':_0x4ae9fa});});});})['then'](function(){return db[_0x684a('0x3a')][_0x684a('0x9c')](_0x2d39e2[_0x684a('0x5c')]['id']);})[_0x684a('0x1b')](respondWithResult(_0x330cc2,null))['catch'](handleError(_0x330cc2,null));};exports[_0x684a('0x9d')]=function(_0x2abf38,_0x4dfb2a,_0x24ba11){var _0x2dd14e={'raw':!![],'where':{}};var _0x5e823d={};var _0x44acbc={'count':0x0,'rows':[]};return db['FaxAccount'][_0x684a('0x61')]({'where':{'id':_0x2abf38[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x4dfb2a,null))['then'](function(_0x57da51){if(_0x57da51){_0x5e823d['model']=_[_0x684a('0x40')](db[_0x684a('0x9e')][_0x684a('0x3b')]);_0x5e823d['query']=_[_0x684a('0x40')](_0x2abf38['query']);_0x5e823d[_0x684a('0x41')]=_[_0x684a('0x42')](_0x5e823d[_0x684a('0x3e')],_0x5e823d[_0x684a('0x3f')]);_0x2dd14e['attributes']=_[_0x684a('0x42')](_0x5e823d[_0x684a('0x3e')],qs['fields'](_0x2abf38['query'][_0x684a('0x44')]));_0x2dd14e[_0x684a('0x43')]=_0x2dd14e[_0x684a('0x43')][_0x684a('0x45')]?_0x2dd14e['attributes']:_0x5e823d[_0x684a('0x3e')];if(!_0x2abf38[_0x684a('0x3f')][_0x684a('0x46')]('nolimit')){_0x2dd14e['limit']=qs[_0x684a('0x2b')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x2b')]);_0x2dd14e[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x29')]);}_0x2dd14e[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x2abf38[_0x684a('0x3f')][_0x684a('0x49')]);_0x2dd14e['where']=qs['filters'](_['pick'](_0x2abf38[_0x684a('0x3f')],_0x5e823d[_0x684a('0x41')]));_0x2dd14e[_0x684a('0x4a')][_0x684a('0x5f')]=_0x57da51['id'];if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x4d')]){_0x2dd14e[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x2dd14e[_0x684a('0x4a')],{'$or':_['map'](_0x2dd14e['attributes'],function(_0x1e633a){var _0x9ac49c={};_0x9ac49c[_0x1e633a]={'$like':'%'+_0x2abf38[_0x684a('0x3f')][_0x684a('0x4d')]+'%'};return _0x9ac49c;})});}if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x9f')]){var _0x2cb9ae=_0x2abf38[_0x684a('0x3f')][_0x684a('0x9f')][_0x684a('0xa0')](',');var _0x2d7890={};_0x2d7890[_0x2cb9ae[0x0]]={'$gte':moment(_0x2cb9ae[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2dd14e[_0x684a('0x4a')]=_[_0x684a('0x4b')](_0x2dd14e[_0x684a('0x4a')],_0x2d7890);}_0x2dd14e=_[_0x684a('0x4b')]({},_0x2dd14e,_0x2abf38[_0x684a('0x54')]);return db[_0x684a('0x9e')][_0x684a('0x2c')]({'where':_0x2dd14e[_0x684a('0x4a')]})[_0x684a('0x1b')](function(_0x32e017){_0x44acbc[_0x684a('0x2c')]=_0x32e017;if(_0x2abf38[_0x684a('0x3f')][_0x684a('0x63')]){_0x2dd14e['include']=[{'all':!![]}];}return db[_0x684a('0x9e')]['findAll'](_0x2dd14e);})['then'](function(_0x5c6c40){_0x44acbc['rows']=_0x5c6c40;return _0x44acbc;});}})['then'](respondWithFilteredResult(_0x4dfb2a,_0x2dd14e))[_0x684a('0x25')](handleError(_0x4dfb2a,null));};exports[_0x684a('0x37')]=function(_0x79a0a6,_0x17bac4,_0x4f55b7){var _0x5e8013,_0x263753={},_0x4d720f;if(_0x79a0a6[_0x684a('0x5c')]['to']){_0x4d720f=_0x79a0a6['body']['to'][0x0];}return db['FaxAccount'][_0x684a('0x59')]({'where':{'id':_0x79a0a6[_0x684a('0x51')]['id']},'include':[{'model':db[_0x684a('0xa1')],'as':_0x684a('0xa2'),'include':[{'model':db[_0x684a('0xa3')],'as':'Contacts','where':{'fax':_0x4d720f},'limit':0x1,'order':[[_0x684a('0xa4'),_0x684a('0xa5')]]}]}]})[_0x684a('0x1b')](handleEntityNotFound(_0x17bac4,null))[_0x684a('0x1b')](function(_0x468d18){_0x5e8013=_0x468d18;if(_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')]&&_0x79a0a6['body'][_0x684a('0xa6')][_0x684a('0x45')]){for(var _0x7614c2=0x0;_0x7614c2<_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x684a('0x45')];_0x7614c2+=0x1){_0x79a0a6[_0x684a('0x5c')]['attachments'][_0x7614c2]={'filename':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2][_0x684a('0x36')],'id':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2]['id'],'path':path['join'](config[_0x684a('0xa7')],_0x684a('0xa8'),_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][_0x7614c2]['basename'])};}}return respondWithRpcPromise(_0x684a('0xa9'),_0x684a('0xa9'),{'FaxAccountId':_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x51')]['id'])?undefined:_0x79a0a6[_0x684a('0x51')]['id'],'path':_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')])?undefined:_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')],'fax':_[_0x684a('0xaa')](_0x79a0a6['body']['to'][0x0])?undefined:_0x79a0a6['body']['to'][0x0]},client9002);})[_0x684a('0x1b')](function(){if(_0x5e8013){if(_[_0x684a('0xaa')](_0x79a0a6[_0x684a('0x5c')][_0x684a('0xab')])){_0x79a0a6[_0x684a('0x5c')]['from']=util[_0x684a('0xac')](_0x684a('0xad'),_0x5e8013[_0x684a('0x36')],_0x5e8013[_0x684a('0xae')]);}if(_0x5e8013[_0x684a('0xa2')]){if(_0x5e8013[_0x684a('0xa2')][_0x684a('0xaf')][_0x684a('0x45')]){return _0x5e8013[_0x684a('0xa2')][_0x684a('0xaf')][0x0];}else{return db[_0x684a('0xa3')][_0x684a('0x5a')](_[_0x684a('0xb0')](_0x79a0a6[_0x684a('0x5c')],{'firstName':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'phone':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'fax':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'ListId':_0x5e8013[_0x684a('0x9b')]}));}}else{throw new Error(_0x684a('0xb1'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x684a('0x1b')](function(_0xe906dc){if(_0xe906dc){return db[_0x684a('0x6d')][_0x684a('0x59')]({'where':{'ContactId':_0xe906dc['id'],'closed':![],'FaxAccountId':_0x5e8013['id']}})[_0x684a('0x1b')](function(_0x86aec9){if(_0x86aec9){return[_0x86aec9,![]];}return db[_0x684a('0x6d')][_0x684a('0x5a')]({'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe906dc['id'],'FaxAccountId':_0x5e8013['id'],'fax':_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'firstMsgDirection':_0x684a('0xb2'),'Messages':[_[_0x684a('0x4b')](_0x79a0a6[_0x684a('0x5c')],{'read':![],'body':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0xb3')],'FaxAccountId':_0x5e8013['id'],'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe906dc['id'],'AttachmentId':_0x79a0a6['body'][_0x684a('0xa6')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x684a('0x1b')](function(_0x2dec3c){return[_0x2dec3c,!![]];});});}else{throw new Error(_0x684a('0xb4'));}})[_0x684a('0xb5')](function(_0xe8e2fb,_0x4ace67){if(_0x4ace67){return _0xe8e2fb;}return db[_0x684a('0x9e')][_0x684a('0x5a')]({'direction':_0x684a('0xb2'),'read':![],'body':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0xb3')],'FaxAccountId':_0x5e8013['id'],'FaxInteractionId':_0xe8e2fb['id'],'UserId':_0x79a0a6[_0x684a('0x55')]['id'],'ContactId':_0xe8e2fb[_0x684a('0xb6')],'AttachmentId':_0x79a0a6['body']['attachments'][0x0]['id']})[_0x684a('0x1b')](function(_0x334a87){_0xe8e2fb[_0x684a('0xb7')][_0x684a('0xb8')]=[];_0xe8e2fb[_0x684a('0xb7')][_0x684a('0xb8')]['push'](_0x334a87[_0x684a('0xb7')]);return _0xe8e2fb;});})[_0x684a('0x1b')](function(_0x8fdef6){respondWithRpcPromise(_0x684a('0xb9'),_0x684a('0xb9'),{'FaxAccountId':_[_0x684a('0xaa')](_0x79a0a6['params']['id'])?undefined:_0x79a0a6[_0x684a('0x51')]['id'],'path':_[_0x684a('0xaa')](_0x79a0a6['body'][_0x684a('0xa6')][0x0][_0x684a('0x4')])?undefined:_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0][_0x684a('0x4')],'fax':_['isNil'](_0x79a0a6[_0x684a('0x5c')]['to'][0x0])?undefined:_0x79a0a6[_0x684a('0x5c')]['to'][0x0],'AttachmentId':_0x79a0a6[_0x684a('0x5c')][_0x684a('0xa6')][0x0]['id']},client9002)[_0x684a('0x1b')](function(_0x9fa64c){logger[_0x684a('0x23')](_0x684a('0xba'),_0x9fa64c);})[_0x684a('0x25')](function(_0x5a08d5){logger[_0x684a('0x23')]('SendFaxRpc,\x20%s',_0x5a08d5);});return _0x8fdef6;})['then'](respondWithResult(_0x17bac4,null))[_0x684a('0x25')](handleError(_0x17bac4,null));};exports['addAgents']=function(_0x4e57a6,_0x50a31a,_0x273147){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x4e57a6[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x50a31a,null))[_0x684a('0x1b')](function(_0x5434a8){if(_0x5434a8){return _0x5434a8['addAgents'](_0x4e57a6[_0x684a('0x5c')]['ids'],_[_0x684a('0x97')](_0x4e57a6[_0x684a('0x5c')],[_0x684a('0x6b'),'id'])||{})['spread'](function(_0x1567b7){for(var _0x3bc943=0x0;_0x3bc943<_0x4e57a6[_0x684a('0x5c')]['ids'][_0x684a('0x45')];_0x3bc943+=0x1){socket[_0x684a('0xbb')](_0x684a('0xbc'),{'UserId':Number(_0x4e57a6[_0x684a('0x5c')][_0x684a('0x6b')][_0x3bc943]),'FaxAccountId':Number(_0x4e57a6[_0x684a('0x51')]['id'])});}return _0x1567b7;});}})[_0x684a('0x1b')](respondWithResult(_0x50a31a,null))[_0x684a('0x25')](handleError(_0x50a31a,null));};exports[_0x684a('0xbd')]=function(_0x26c87e,_0x58c651,_0x7ed757){return db[_0x684a('0x3a')][_0x684a('0x59')]({'where':{'id':_0x26c87e[_0x684a('0x51')]['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x58c651,null))['then'](function(_0x2c7f79){if(_0x2c7f79){return _0x2c7f79[_0x684a('0xbd')](_0x26c87e['query']['ids'])[_0x684a('0x1b')](function(){if(_[_0x684a('0xbe')](_0x26c87e['query'][_0x684a('0x6b')])){for(var _0x556281=0x0;_0x556281<_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')][_0x684a('0x45')];_0x556281+=0x1){socket[_0x684a('0xbb')](_0x684a('0xbf'),{'UserId':Number(_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')][_0x556281]),'FaxAccountId':Number(_0x26c87e['params']['id'])});}}else{socket[_0x684a('0xbb')](_0x684a('0xbf'),{'UserId':Number(_0x26c87e[_0x684a('0x3f')][_0x684a('0x6b')]),'FaxAccountId':Number(_0x26c87e[_0x684a('0x51')]['id'])});}});}})['then'](respondWithStatusCode(_0x58c651,null))[_0x684a('0x25')](handleError(_0x58c651,null));};exports['getAgents']=function(_0x98f45c,_0x3c592e,_0x2fec86){var _0x5a9131={};var _0x4046cc={};var _0xfb4114;var _0xda4e98;return db[_0x684a('0x3a')]['findOne']({'where':{'id':_0x98f45c['params']['id']}})[_0x684a('0x1b')](handleEntityNotFound(_0x3c592e,null))[_0x684a('0x1b')](function(_0x587e5c){if(_0x587e5c){_0xfb4114=_0x587e5c;_0x4046cc['model']=_[_0x684a('0x40')](db['User'][_0x684a('0x3b')]);_0x4046cc[_0x684a('0x3f')]=_[_0x684a('0x40')](_0x98f45c[_0x684a('0x3f')]);_0x4046cc[_0x684a('0x41')]=_['intersection'](_0x4046cc['model'],_0x4046cc['query']);_0x5a9131['attributes']=_[_0x684a('0x42')](_0x4046cc[_0x684a('0x3e')],qs[_0x684a('0x44')](_0x98f45c['query']['fields']));_0x5a9131[_0x684a('0x43')]=_0x5a9131[_0x684a('0x43')]['length']?_0x5a9131[_0x684a('0x43')]:_0x4046cc[_0x684a('0x3e')];_0x5a9131[_0x684a('0x48')]=qs[_0x684a('0x49')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x49')]);_0x5a9131[_0x684a('0x4a')]=qs['filters'](_[_0x684a('0x68')](_0x98f45c['query'],_0x4046cc[_0x684a('0x41')]));if(_0x98f45c[_0x684a('0x3f')][_0x684a('0x4d')]){_0x5a9131[_0x684a('0x4a')]=_['merge'](_0x5a9131['where'],{'$or':_['map'](_0x5a9131[_0x684a('0x43')],function(_0x3b151c){var _0x4a66b4={};_0x4a66b4[_0x3b151c]={'$like':'%'+_0x98f45c['query'][_0x684a('0x4d')]+'%'};return _0x4a66b4;})});}_0x5a9131=_['merge']({},_0x5a9131,_0x98f45c[_0x684a('0x54')]);return _0xfb4114['getAgents'](_0x5a9131);}})[_0x684a('0x1b')](function(_0x5a08f0){if(_0x5a08f0){_0xda4e98=_0x5a08f0[_0x684a('0x45')];if(!_0x98f45c[_0x684a('0x3f')][_0x684a('0x46')](_0x684a('0x47'))){_0x5a9131[_0x684a('0x2b')]=qs[_0x684a('0x2b')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x2b')]);_0x5a9131[_0x684a('0x29')]=qs[_0x684a('0x29')](_0x98f45c[_0x684a('0x3f')][_0x684a('0x29')]);}return _0xfb4114[_0x684a('0xc0')](_0x5a9131);}})[_0x684a('0x1b')](function(_0x351179){if(_0x351179){return _0x351179?{'count':_0xda4e98,'rows':_0x351179}:null;}})[_0x684a('0x1b')](respondWithResult(_0x3c592e,null))[_0x684a('0x25')](handleError(_0x3c592e,null));}; \ No newline at end of file +var _0x1d0e=['findAll','rows','show','Pause','mandatoryDispositionPause','intersection','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','findOne','removeDispositions','addAnswer','FaxAccountId','CannedAnswer','getAnswers','removeAnswers','ids','addInteraction','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','finally','getApplications','context','from-voip-provider','exten','system','Fax\x20Extension','push','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','get','FaxAccounts','UserProfileResource','destroy','name','send','index','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x1d0e,0x6f));var _0xe1d0=function(_0x2c9c56,_0x289d95){_0x2c9c56=_0x2c9c56-0x0;var _0x227a12=_0x1d0e[_0x2c9c56];return _0x227a12;};'use strict';var emlformat=require(_0xe1d0('0x0'));var rimraf=require(_0xe1d0('0x1'));var zipdir=require(_0xe1d0('0x2'));var jsonpatch=require(_0xe1d0('0x3'));var rp=require(_0xe1d0('0x4'));var moment=require(_0xe1d0('0x5'));var BPromise=require(_0xe1d0('0x6'));var Mustache=require(_0xe1d0('0x7'));var util=require(_0xe1d0('0x8'));var path=require(_0xe1d0('0x9'));var sox=require(_0xe1d0('0xa'));var csv=require(_0xe1d0('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe1d0('0xc'));var _=require(_0xe1d0('0xd'));var squel=require(_0xe1d0('0xe'));var crypto=require(_0xe1d0('0xf'));var jsforce=require(_0xe1d0('0x10'));var deskjs=require(_0xe1d0('0x11'));var toCsv=require(_0xe1d0('0xb'));var querystring=require('querystring');var Papa=require(_0xe1d0('0x12'));var Redis=require(_0xe1d0('0x13'));var authService=require(_0xe1d0('0x14'));var qs=require(_0xe1d0('0x15'));var as=require(_0xe1d0('0x16'));var hardwareService=require(_0xe1d0('0x17'));var logger=require(_0xe1d0('0x18'))('api');var utils=require(_0xe1d0('0x19'));var config=require(_0xe1d0('0x1a'));var licenseUtil=require(_0xe1d0('0x1b'));var db=require(_0xe1d0('0x1c'))['db'];config[_0xe1d0('0x1d')]=_[_0xe1d0('0x1e')](config['redis'],{'host':_0xe1d0('0x1f'),'port':0x18eb});var socket=require(_0xe1d0('0x20'))(new Redis(config['redis']));require(_0xe1d0('0x21'))[_0xe1d0('0x22')](socket);var jayson=require(_0xe1d0('0x23'));var client=jayson['client'][_0xe1d0('0x24')]({'port':0x232c});var client9002=jayson[_0xe1d0('0x25')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15fc46,_0x360848,_0x406e90,_0x55d761){return new BPromise(function(_0x1ae40d,_0x49a16c){var _0x4aa106=_0x55d761||client;return _0x4aa106[_0xe1d0('0x26')](_0x15fc46,_0x406e90)[_0xe1d0('0x27')](function(_0x3908b0){logger[_0xe1d0('0x28')](_0xe1d0('0x29'),_0x360848,_0xe1d0('0x2a'));logger[_0xe1d0('0x2b')](_0xe1d0('0x2c'),_0x360848,_0xe1d0('0x2a'),JSON[_0xe1d0('0x2d')](_0x3908b0));if(_0x3908b0[_0xe1d0('0x2e')]){if(_0x3908b0[_0xe1d0('0x2e')]['code']===0x1f4){logger[_0xe1d0('0x2e')]('FaxAccount,\x20%s,\x20%s',_0x360848,_0x3908b0['error'][_0xe1d0('0x2f')]);return _0x49a16c(_0x3908b0['error'][_0xe1d0('0x2f')]);}logger[_0xe1d0('0x2e')](_0xe1d0('0x29'),_0x360848,_0x3908b0[_0xe1d0('0x2e')]['message']);return _0x1ae40d(_0x3908b0['error']['message']);}else{logger[_0xe1d0('0x28')]('FaxAccount,\x20%s,\x20%s',_0x360848,_0xe1d0('0x2a'));_0x1ae40d(_0x3908b0[_0xe1d0('0x30')]['message']);}})[_0xe1d0('0x31')](function(_0x65e1cf){logger[_0xe1d0('0x2e')]('FaxAccount,\x20%s,\x20%s',_0x360848,_0x65e1cf);_0x49a16c(_0x65e1cf);});});}function respondWithStatusCode(_0xc1e25c,_0xdf6bd3){_0xdf6bd3=_0xdf6bd3||0xcc;return function(_0x2251e3){if(_0x2251e3){return _0xc1e25c[_0xe1d0('0x32')](_0xdf6bd3);}return _0xc1e25c['status'](_0xdf6bd3)[_0xe1d0('0x33')]();};}function respondWithResult(_0x636cc6,_0x12e457){_0x12e457=_0x12e457||0xc8;return function(_0x55d52b){if(_0x55d52b){return _0x636cc6[_0xe1d0('0x34')](_0x12e457)[_0xe1d0('0x35')](_0x55d52b);}};}function respondWithFilteredResult(_0x2180f2,_0x32b73f){return function(_0x154bc7){if(_0x154bc7){var _0x472788=typeof _0x32b73f[_0xe1d0('0x36')]===_0xe1d0('0x37')&&typeof _0x32b73f[_0xe1d0('0x38')]===_0xe1d0('0x37');var _0xdf950d=_0x154bc7[_0xe1d0('0x39')];var _0x429a6c=_0x472788?0x0:_0x32b73f[_0xe1d0('0x36')];var _0x483c90=_0x472788?_0x154bc7['count']:_0x32b73f[_0xe1d0('0x36')]+_0x32b73f[_0xe1d0('0x38')];var _0x20ce3d;if(_0x483c90>=_0xdf950d){_0x483c90=_0xdf950d;_0x20ce3d=0xc8;}else{_0x20ce3d=0xce;}_0x2180f2[_0xe1d0('0x34')](_0x20ce3d);return _0x2180f2[_0xe1d0('0x3a')](_0xe1d0('0x3b'),_0x429a6c+'-'+_0x483c90+'/'+_0xdf950d)[_0xe1d0('0x35')](_0x154bc7);}return null;};}function patchUpdates(_0x579329){return function(_0x5f29ad){try{jsonpatch[_0xe1d0('0x3c')](_0x5f29ad,_0x579329,!![]);}catch(_0x4e7127){return BPromise[_0xe1d0('0x3d')](_0x4e7127);}return _0x5f29ad['save']();};}function saveUpdates(_0x488fa5,_0x53bdfc){return function(_0x2e84c9){if(_0x2e84c9){return _0x2e84c9[_0xe1d0('0x3e')](_0x488fa5)[_0xe1d0('0x27')](function(_0x36fad3){return _0x36fad3;});}return null;};}function removeEntity(_0x387aef,_0x5e3b95){return function(_0x3b61a5){if(_0x3b61a5){return _0x3b61a5['destroy']()[_0xe1d0('0x27')](function(){var _0x5a9c9e=_0x3b61a5[_0xe1d0('0x3f')]({'plain':!![]});var _0x79785c=_0xe1d0('0x40');return db[_0xe1d0('0x41')][_0xe1d0('0x42')]({'where':{'type':_0x79785c,'resourceId':_0x5a9c9e['id']}})[_0xe1d0('0x27')](function(){return _0x3b61a5;});})[_0xe1d0('0x27')](function(){_0x387aef[_0xe1d0('0x34')](0xcc)[_0xe1d0('0x33')]();});}};}function handleEntityNotFound(_0x500d0a,_0x449034){return function(_0xfb4189){if(!_0xfb4189){_0x500d0a[_0xe1d0('0x32')](0x194);}return _0xfb4189;};}function handleError(_0x688e7e,_0x2f3ec6){_0x2f3ec6=_0x2f3ec6||0x1f4;return function(_0x2db2cc){logger[_0xe1d0('0x2e')](_0x2db2cc['stack']);if(_0x2db2cc[_0xe1d0('0x43')]){delete _0x2db2cc['name'];}_0x688e7e[_0xe1d0('0x34')](_0x2f3ec6)[_0xe1d0('0x44')](_0x2db2cc);};}exports[_0xe1d0('0x45')]=function(_0x821fce,_0x1677d8){var _0x59dc07={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1c31fc={},_0x3d473a={'count':0x0,'rows':[]};var _0x293ad4=_[_0xe1d0('0x46')](db[_0xe1d0('0x47')][_0xe1d0('0x48')],function(_0x1f5201){return{'name':_0x1f5201[_0xe1d0('0x49')],'type':_0x1f5201['type'][_0xe1d0('0x4a')]};});_0x1c31fc[_0xe1d0('0x4b')]=_['map'](_0x293ad4,_0xe1d0('0x43'));_0x1c31fc[_0xe1d0('0x4c')]=_[_0xe1d0('0x4d')](_0x821fce[_0xe1d0('0x4c')]);_0x1c31fc['filters']=_['intersection'](_0x1c31fc[_0xe1d0('0x4b')],_0x1c31fc[_0xe1d0('0x4c')]);_0x59dc07[_0xe1d0('0x4e')]=_['intersection'](_0x1c31fc[_0xe1d0('0x4b')],qs[_0xe1d0('0x4f')](_0x821fce[_0xe1d0('0x4c')]['fields']));_0x59dc07['attributes']=_0x59dc07[_0xe1d0('0x4e')]['length']?_0x59dc07[_0xe1d0('0x4e')]:_0x1c31fc[_0xe1d0('0x4b')];if(!_0x821fce[_0xe1d0('0x4c')][_0xe1d0('0x50')](_0xe1d0('0x51'))){_0x59dc07[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0x821fce[_0xe1d0('0x4c')][_0xe1d0('0x38')]);_0x59dc07[_0xe1d0('0x36')]=qs[_0xe1d0('0x36')](_0x821fce[_0xe1d0('0x4c')]['offset']);}_0x59dc07[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0x821fce[_0xe1d0('0x4c')][_0xe1d0('0x53')]);_0x59dc07[_0xe1d0('0x54')]=qs[_0xe1d0('0x55')](_[_0xe1d0('0x56')](_0x821fce['query'],_0x1c31fc[_0xe1d0('0x55')]),_0x293ad4);if(_0x821fce[_0xe1d0('0x4c')][_0xe1d0('0x57')]){_0x59dc07['where']=_[_0xe1d0('0x58')](_0x59dc07['where'],{'$or':_[_0xe1d0('0x46')](_0x293ad4,function(_0x3e1237){if(_0x3e1237[_0xe1d0('0x59')]!=='VIRTUAL'){var _0x51c7de={};_0x51c7de[_0x3e1237['name']]={'$like':'%'+_0x821fce[_0xe1d0('0x4c')]['filter']+'%'};return _0x51c7de;}})});}_0x59dc07=_['merge']({},_0x59dc07,_0x821fce[_0xe1d0('0x5a')]);var _0x130bb3={'where':_0x59dc07[_0xe1d0('0x54')]};return db['FaxAccount']['count'](_0x130bb3)[_0xe1d0('0x27')](function(_0x278481){_0x3d473a[_0xe1d0('0x39')]=_0x278481;if(_0x821fce[_0xe1d0('0x4c')][_0xe1d0('0x5b')]){_0x59dc07[_0xe1d0('0x5c')]=[{'all':!![]}];}return db[_0xe1d0('0x47')][_0xe1d0('0x5d')](_0x59dc07);})['then'](function(_0x3dd64c){_0x3d473a[_0xe1d0('0x5e')]=_0x3dd64c;return _0x3d473a;})[_0xe1d0('0x27')](respondWithFilteredResult(_0x1677d8,_0x59dc07))[_0xe1d0('0x31')](handleError(_0x1677d8,null));};exports[_0xe1d0('0x5f')]=function(_0x5d6170,_0x5716d5){var _0x166c98={'raw':![],'where':{'id':_0x5d6170['params']['id']},'include':[{'model':db[_0xe1d0('0x60')],'as':_0xe1d0('0x61')}]},_0x8e5c98={};_0x8e5c98[_0xe1d0('0x4b')]=_[_0xe1d0('0x4d')](db['FaxAccount'][_0xe1d0('0x48')]);_0x8e5c98[_0xe1d0('0x4c')]=_['keys'](_0x5d6170[_0xe1d0('0x4c')]);_0x8e5c98[_0xe1d0('0x55')]=_[_0xe1d0('0x62')](_0x8e5c98[_0xe1d0('0x4b')],_0x8e5c98[_0xe1d0('0x4c')]);_0x166c98[_0xe1d0('0x4e')]=_[_0xe1d0('0x62')](_0x8e5c98[_0xe1d0('0x4b')],qs[_0xe1d0('0x4f')](_0x5d6170[_0xe1d0('0x4c')][_0xe1d0('0x4f')]));_0x166c98[_0xe1d0('0x4e')]=_0x166c98[_0xe1d0('0x4e')][_0xe1d0('0x63')]?_0x166c98[_0xe1d0('0x4e')]:_0x8e5c98[_0xe1d0('0x4b')];if(_0x5d6170[_0xe1d0('0x4c')][_0xe1d0('0x5b')]){_0x166c98[_0xe1d0('0x5c')]=[{'all':!![]}];}_0x166c98=_['merge']({},_0x166c98,_0x5d6170[_0xe1d0('0x5a')]);return db[_0xe1d0('0x47')][_0xe1d0('0x64')](_0x166c98)[_0xe1d0('0x27')](handleEntityNotFound(_0x5716d5,null))[_0xe1d0('0x27')](respondWithResult(_0x5716d5,null))[_0xe1d0('0x31')](handleError(_0x5716d5,null));};exports[_0xe1d0('0x65')]=function(_0x4d2fdf,_0x59f236){return db[_0xe1d0('0x47')]['create'](_0x4d2fdf['body'],{})['then'](function(_0x13ea56){var _0x4c0dfb=_0x4d2fdf[_0xe1d0('0x66')][_0xe1d0('0x3f')]({'plain':!![]});if(!_0x4c0dfb)throw new Error(_0xe1d0('0x67'));if(_0x4c0dfb[_0xe1d0('0x68')]===_0xe1d0('0x66')){var _0x399143=_0x13ea56[_0xe1d0('0x3f')]({'plain':!![]});var _0x27a7b0=_0xe1d0('0x40');return db[_0xe1d0('0x69')][_0xe1d0('0x64')]({'where':{'name':_0x27a7b0,'userProfileId':_0x4c0dfb[_0xe1d0('0x6a')]},'raw':!![]})['then'](function(_0x589d96){if(_0x589d96&&_0x589d96[_0xe1d0('0x6b')]===0x0){return db[_0xe1d0('0x41')][_0xe1d0('0x65')]({'name':_0x399143['name'],'resourceId':_0x399143['id'],'type':_0x589d96[_0xe1d0('0x43')],'sectionId':_0x589d96['id']},{})[_0xe1d0('0x27')](function(){return _0x13ea56;});}else{return _0x13ea56;}})[_0xe1d0('0x31')](function(_0x3835f7){logger[_0xe1d0('0x2e')](_0xe1d0('0x6c'),_0x3835f7);throw _0x3835f7;});}return _0x13ea56;})[_0xe1d0('0x27')](respondWithResult(_0x59f236,0xc9))['catch'](handleError(_0x59f236,null));};exports[_0xe1d0('0x3e')]=function(_0x54f8e5,_0x35d559){if(_0x54f8e5[_0xe1d0('0x6d')]['id']){delete _0x54f8e5[_0xe1d0('0x6d')]['id'];}return db['FaxAccount'][_0xe1d0('0x64')]({'where':{'id':_0x54f8e5[_0xe1d0('0x6e')]['id']},'include':[{'model':db[_0xe1d0('0x60')],'as':_0xe1d0('0x61')}]})['then'](handleEntityNotFound(_0x35d559,null))[_0xe1d0('0x27')](saveUpdates(_0x54f8e5[_0xe1d0('0x6d')],null))[_0xe1d0('0x27')](respondWithResult(_0x35d559,null))[_0xe1d0('0x31')](handleError(_0x35d559,null));};exports[_0xe1d0('0x42')]=function(_0x36af36,_0x1832aa){return db[_0xe1d0('0x47')][_0xe1d0('0x64')]({'where':{'id':_0x36af36['params']['id']}})['then'](handleEntityNotFound(_0x1832aa,null))[_0xe1d0('0x27')](removeEntity(_0x1832aa,null))['catch'](handleError(_0x1832aa,null));};exports[_0xe1d0('0x6f')]=function(_0x463b4e,_0x1e9591){return db['FaxAccount'][_0xe1d0('0x6f')]()['then'](respondWithResult(_0x1e9591,null))[_0xe1d0('0x31')](handleError(_0x1e9591,null));};exports[_0xe1d0('0x70')]=function(_0x2c31a7,_0x5ae80b,_0x1c15e2){if(_0x2c31a7[_0xe1d0('0x6d')]['id']){delete _0x2c31a7[_0xe1d0('0x6d')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2c31a7[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x5ae80b,null))[_0xe1d0('0x27')](function(_0x3534a4){if(_0x3534a4){_0x2c31a7[_0xe1d0('0x6d')]['FaxAccountId']=_0x3534a4['id'];return db[_0xe1d0('0x71')][_0xe1d0('0x65')](_0x2c31a7['body']);}})[_0xe1d0('0x27')](respondWithResult(_0x5ae80b,null))[_0xe1d0('0x31')](handleError(_0x5ae80b,null));};exports['getDispositions']=function(_0x2158a2,_0x42dca3,_0x1ab2f4){var _0x2339b6={'raw':![],'where':{}};var _0x5a0d07={};var _0x266c5f={'count':0x0,'rows':[]};return db[_0xe1d0('0x47')][_0xe1d0('0x72')]({'where':{'id':_0x2158a2[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x42dca3,null))['then'](function(_0x1e5acd){if(_0x1e5acd){_0x5a0d07[_0xe1d0('0x4b')]=_[_0xe1d0('0x4d')](db[_0xe1d0('0x71')][_0xe1d0('0x48')]);_0x5a0d07[_0xe1d0('0x4c')]=_[_0xe1d0('0x4d')](_0x2158a2[_0xe1d0('0x4c')]);_0x5a0d07[_0xe1d0('0x55')]=_['intersection'](_0x5a0d07[_0xe1d0('0x4b')],_0x5a0d07[_0xe1d0('0x4c')]);_0x2339b6[_0xe1d0('0x4e')]=_['intersection'](_0x5a0d07[_0xe1d0('0x4b')],qs[_0xe1d0('0x4f')](_0x2158a2[_0xe1d0('0x4c')][_0xe1d0('0x4f')]));_0x2339b6['attributes']=_0x2339b6[_0xe1d0('0x4e')]['length']?_0x2339b6[_0xe1d0('0x4e')]:_0x5a0d07[_0xe1d0('0x4b')];if(!_0x2158a2[_0xe1d0('0x4c')][_0xe1d0('0x50')](_0xe1d0('0x51'))){_0x2339b6['limit']=qs[_0xe1d0('0x38')](_0x2158a2['query'][_0xe1d0('0x38')]);_0x2339b6[_0xe1d0('0x36')]=qs[_0xe1d0('0x36')](_0x2158a2['query']['offset']);}_0x2339b6[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0x2158a2[_0xe1d0('0x4c')][_0xe1d0('0x53')]);_0x2339b6[_0xe1d0('0x54')]=qs['filters'](_[_0xe1d0('0x56')](_0x2158a2[_0xe1d0('0x4c')],_0x5a0d07[_0xe1d0('0x55')]));_0x2339b6['where']['FaxAccountId']=_0x1e5acd['id'];if(_0x2158a2['query'][_0xe1d0('0x57')]){_0x2339b6['where']=_[_0xe1d0('0x58')](_0x2339b6[_0xe1d0('0x54')],{'$or':_[_0xe1d0('0x46')](_0x2339b6[_0xe1d0('0x4e')],function(_0x14194b){var _0x1a475c={};_0x1a475c[_0x14194b]={'$like':'%'+_0x2158a2[_0xe1d0('0x4c')][_0xe1d0('0x57')]+'%'};return _0x1a475c;})});}_0x2339b6=_[_0xe1d0('0x58')]({},_0x2339b6,_0x2158a2['options']);return db[_0xe1d0('0x71')][_0xe1d0('0x39')]({'where':_0x2339b6['where']})[_0xe1d0('0x27')](function(_0x551059){_0x266c5f['count']=_0x551059;if(_0x2158a2[_0xe1d0('0x4c')][_0xe1d0('0x5b')]){_0x2339b6[_0xe1d0('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0xe1d0('0x5d')](_0x2339b6);})[_0xe1d0('0x27')](function(_0x3a6790){_0x266c5f[_0xe1d0('0x5e')]=_0x3a6790;return _0x266c5f;});}})[_0xe1d0('0x27')](respondWithFilteredResult(_0x42dca3,_0x2339b6))['catch'](handleError(_0x42dca3,null));};exports[_0xe1d0('0x73')]=function(_0x248478,_0x8eef65,_0xb4ca63){return db[_0xe1d0('0x47')][_0xe1d0('0x64')]({'where':{'id':_0x248478['params']['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x8eef65,null))['then'](function(_0x49ea4f){if(_0x49ea4f){return _0x49ea4f['removeDispositions'](_0x248478[_0xe1d0('0x4c')]['ids']);}})[_0xe1d0('0x27')](respondWithStatusCode(_0x8eef65,null))[_0xe1d0('0x31')](handleError(_0x8eef65,null));};exports[_0xe1d0('0x74')]=function(_0x1e4740,_0x87a35b,_0x3ae2ed){if(_0x1e4740[_0xe1d0('0x6d')]['id']){delete _0x1e4740['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x1e4740[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x87a35b,null))[_0xe1d0('0x27')](function(_0xaaf15d){if(_0xaaf15d){_0x1e4740[_0xe1d0('0x6d')][_0xe1d0('0x75')]=_0xaaf15d['id'];return db[_0xe1d0('0x76')][_0xe1d0('0x65')](_0x1e4740[_0xe1d0('0x6d')]);}})[_0xe1d0('0x27')](respondWithResult(_0x87a35b,null))['catch'](handleError(_0x87a35b,null));};exports[_0xe1d0('0x77')]=function(_0x57f598,_0x1cb550,_0x3fd6b1){var _0x3a93b9={'raw':![],'where':{}};var _0x30e668={};var _0x12e376={'count':0x0,'rows':[]};return db[_0xe1d0('0x47')][_0xe1d0('0x72')]({'where':{'id':_0x57f598[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x1cb550,null))['then'](function(_0x113d26){if(_0x113d26){_0x30e668[_0xe1d0('0x4b')]=_['keys'](db[_0xe1d0('0x76')][_0xe1d0('0x48')]);_0x30e668[_0xe1d0('0x4c')]=_['keys'](_0x57f598[_0xe1d0('0x4c')]);_0x30e668[_0xe1d0('0x55')]=_['intersection'](_0x30e668[_0xe1d0('0x4b')],_0x30e668[_0xe1d0('0x4c')]);_0x3a93b9['attributes']=_[_0xe1d0('0x62')](_0x30e668[_0xe1d0('0x4b')],qs[_0xe1d0('0x4f')](_0x57f598[_0xe1d0('0x4c')]['fields']));_0x3a93b9[_0xe1d0('0x4e')]=_0x3a93b9[_0xe1d0('0x4e')][_0xe1d0('0x63')]?_0x3a93b9[_0xe1d0('0x4e')]:_0x30e668['model'];if(!_0x57f598[_0xe1d0('0x4c')][_0xe1d0('0x50')](_0xe1d0('0x51'))){_0x3a93b9[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0x57f598[_0xe1d0('0x4c')]['limit']);_0x3a93b9[_0xe1d0('0x36')]=qs[_0xe1d0('0x36')](_0x57f598['query'][_0xe1d0('0x36')]);}_0x3a93b9[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0x57f598['query'][_0xe1d0('0x53')]);_0x3a93b9[_0xe1d0('0x54')]=qs[_0xe1d0('0x55')](_['pick'](_0x57f598[_0xe1d0('0x4c')],_0x30e668[_0xe1d0('0x55')]));_0x3a93b9[_0xe1d0('0x54')][_0xe1d0('0x75')]=_0x113d26['id'];if(_0x57f598['query'][_0xe1d0('0x57')]){_0x3a93b9['where']=_[_0xe1d0('0x58')](_0x3a93b9[_0xe1d0('0x54')],{'$or':_[_0xe1d0('0x46')](_0x3a93b9['attributes'],function(_0x2c8fed){var _0x1ee0a6={};_0x1ee0a6[_0x2c8fed]={'$like':'%'+_0x57f598[_0xe1d0('0x4c')]['filter']+'%'};return _0x1ee0a6;})});}_0x3a93b9=_[_0xe1d0('0x58')]({},_0x3a93b9,_0x57f598[_0xe1d0('0x5a')]);return db[_0xe1d0('0x76')][_0xe1d0('0x39')]({'where':_0x3a93b9['where']})[_0xe1d0('0x27')](function(_0x517ca4){_0x12e376[_0xe1d0('0x39')]=_0x517ca4;if(_0x57f598[_0xe1d0('0x4c')][_0xe1d0('0x5b')]){_0x3a93b9[_0xe1d0('0x5c')]=[{'all':!![]}];}return db[_0xe1d0('0x76')]['findAll'](_0x3a93b9);})[_0xe1d0('0x27')](function(_0x1d7d7e){_0x12e376['rows']=_0x1d7d7e;return _0x12e376;});}})['then'](respondWithFilteredResult(_0x1cb550,_0x3a93b9))[_0xe1d0('0x31')](handleError(_0x1cb550,null));};exports[_0xe1d0('0x78')]=function(_0xf8b983,_0x230b64,_0x335d82){return db[_0xe1d0('0x47')]['find']({'where':{'id':_0xf8b983['params']['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x230b64,null))[_0xe1d0('0x27')](function(_0x4508be){if(_0x4508be){return _0x4508be[_0xe1d0('0x78')](_0xf8b983[_0xe1d0('0x4c')][_0xe1d0('0x79')]);}})[_0xe1d0('0x27')](respondWithStatusCode(_0x230b64,null))[_0xe1d0('0x31')](handleError(_0x230b64,null));};exports[_0xe1d0('0x7a')]=function(_0x5b4b85,_0x1dbfba,_0x22ea7a){return db[_0xe1d0('0x7b')][_0xe1d0('0x64')]({'where':{'id':_0x5b4b85[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x1dbfba,null))[_0xe1d0('0x27')](function(_0x948980){if(_0x948980){return _0x948980['addInteraction'](_0x5b4b85['body'][_0xe1d0('0x79')],_['omit'](_0x5b4b85['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x1dbfba,null))[_0xe1d0('0x31')](handleError(_0x1dbfba,null));};exports['getInteractions']=function(_0x1f730c,_0x2b546e,_0x50e86b){var _0x47a409={'raw':![],'where':{}};var _0x2bd079={};var _0x53859e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xe1d0('0x72')]({'where':{'id':_0x1f730c[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x2b546e,null))[_0xe1d0('0x27')](function(_0x134c1c){if(_0x134c1c){_0x2bd079['model']=_[_0xe1d0('0x4d')](db[_0xe1d0('0x7b')][_0xe1d0('0x48')]);_0x2bd079[_0xe1d0('0x4c')]=_['keys'](_0x1f730c[_0xe1d0('0x4c')]);_0x2bd079[_0xe1d0('0x55')]=_[_0xe1d0('0x62')](_0x2bd079[_0xe1d0('0x4b')],_0x2bd079[_0xe1d0('0x4c')]);_0x47a409[_0xe1d0('0x4e')]=_['intersection'](_0x2bd079['model'],qs[_0xe1d0('0x4f')](_0x1f730c[_0xe1d0('0x4c')]['fields']));_0x47a409[_0xe1d0('0x4e')]=_0x47a409['attributes']['length']?_0x47a409[_0xe1d0('0x4e')]:_0x2bd079[_0xe1d0('0x4b')];if(!_0x1f730c[_0xe1d0('0x4c')][_0xe1d0('0x50')](_0xe1d0('0x51'))){_0x47a409[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0x1f730c[_0xe1d0('0x4c')]['limit']);_0x47a409[_0xe1d0('0x36')]=qs['offset'](_0x1f730c['query']['offset']);}_0x47a409[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0x1f730c[_0xe1d0('0x4c')][_0xe1d0('0x53')]);_0x47a409[_0xe1d0('0x54')]=qs[_0xe1d0('0x55')](_[_0xe1d0('0x56')](_0x1f730c['query'],_0x2bd079[_0xe1d0('0x55')]));_0x47a409[_0xe1d0('0x54')][_0xe1d0('0x75')]=_0x134c1c['id'];if(_0x1f730c[_0xe1d0('0x4c')][_0xe1d0('0x57')]){_0x47a409[_0xe1d0('0x54')]=_[_0xe1d0('0x58')](_0x47a409[_0xe1d0('0x54')],{'$or':_[_0xe1d0('0x46')](_0x47a409['attributes'],function(_0x247dd8){var _0x3473c1={};_0x3473c1[_0x247dd8]={'$like':'%'+_0x1f730c[_0xe1d0('0x4c')][_0xe1d0('0x57')]+'%'};return _0x3473c1;})});}_0x47a409=_[_0xe1d0('0x58')]({},_0x47a409,_0x1f730c[_0xe1d0('0x5a')]);return db[_0xe1d0('0x7b')][_0xe1d0('0x39')]({'where':_0x47a409['where']})[_0xe1d0('0x27')](function(_0x1f7b9c){_0x53859e[_0xe1d0('0x39')]=_0x1f7b9c;if(_0x1f730c['query']['includeAll']){_0x47a409['include']=[{'model':db[_0xe1d0('0x7c')],'as':_0xe1d0('0x7d'),'required':![]},{'model':db[_0xe1d0('0x7e')],'as':_0xe1d0('0x7f'),'attributes':[_0xe1d0('0x43'),_0xe1d0('0x80'),_0xe1d0('0x81')],'required':![]},{'model':db[_0xe1d0('0x82')],'as':'Tags','attributes':['id',_0xe1d0('0x43'),_0xe1d0('0x83')],'where':_0x1f730c[_0xe1d0('0x4c')][_0xe1d0('0x84')]?{'id':_0x1f730c[_0xe1d0('0x4c')]['tag']}:undefined,'required':_0x1f730c[_0xe1d0('0x4c')]['tag']?!![]:![]}];}return db[_0xe1d0('0x7b')][_0xe1d0('0x5d')](_0x47a409);})['then'](function(_0x1bf5e0){_0x53859e[_0xe1d0('0x5e')]=_0x1bf5e0;return _0x53859e;});}})[_0xe1d0('0x27')](respondWithFilteredResult(_0x2b546e,_0x47a409))['catch'](handleError(_0x2b546e,null));};exports[_0xe1d0('0x85')]=function(_0x5da7c8,_0x578a1b){var _0x2998b6=_0x5da7c8[_0xe1d0('0x6e')]['id'];var _0x1cf580=_0x5da7c8[_0xe1d0('0x6d')];var _0x4ca3ac=0xc8;var _0x6da496=null;return db['sequelize'][_0xe1d0('0x86')]({'isolationLevel':db[_0xe1d0('0x87')][_0xe1d0('0x88')][_0xe1d0('0x89')][_0xe1d0('0x8a')]},function(_0x2f70f6){return db['FaxAccount']['findOne']({'where':{'id':_0x2998b6},'transaction':_0x2f70f6})[_0xe1d0('0x27')](function(_0x39dd74){if(_0x39dd74){return db[_0xe1d0('0x8b')][_0xe1d0('0x42')]({'where':{'FaxAccountId':_0x2998b6},'transaction':_0x2f70f6})[_0xe1d0('0x27')](function(){var _0xd5a261=_['map'](_0x1cf580,function(_0x2d1344){_0x2d1344[_0xe1d0('0x75')]=_0x2998b6;return _0x2d1344;});return db[_0xe1d0('0x8b')][_0xe1d0('0x8c')](_0xd5a261,{'transaction':_0x2f70f6});});}else{_0x4ca3ac=0x194;_0x6da496=[];}});})[_0xe1d0('0x27')](function(){if(_0x4ca3ac!==0x194){return db[_0xe1d0('0x8b')]['findAndCountAll']({'where':{'FaxAccountId':_0x2998b6},'order':_0xe1d0('0x8d')})['then'](function(_0x321918){_0x6da496=_0x321918;});}})[_0xe1d0('0x31')](function(_0x1e0fd8){_0x4ca3ac=0x1f4;logger['error'](_0x1e0fd8[_0xe1d0('0x8e')]);if(_0x1e0fd8[_0xe1d0('0x43')]){delete _0x1e0fd8[_0xe1d0('0x43')];}_0x6da496=_0x1e0fd8;})[_0xe1d0('0x8f')](function(){if(_0x6da496===null){_0x578a1b[_0xe1d0('0x32')](_0x4ca3ac);}else{if(_0x4ca3ac===0x1f4){_0x578a1b['status'](_0x4ca3ac)[_0xe1d0('0x44')](_0x6da496);}else{_0x578a1b['status'](_0x4ca3ac)[_0xe1d0('0x35')](_0x6da496);}}});};exports[_0xe1d0('0x90')]=function(_0xe58220,_0x2c5392,_0x5c001c){var _0x3a48e4={};var _0x11a823={};var _0x17dbb3;var _0x259cf0;return db[_0xe1d0('0x47')][_0xe1d0('0x72')]({'where':{'id':_0xe58220[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x2c5392,null))[_0xe1d0('0x27')](function(_0x31bbe4){if(_0x31bbe4){_0x17dbb3=_0x31bbe4;_0x11a823[_0xe1d0('0x4b')]=_[_0xe1d0('0x4d')](db[_0xe1d0('0x8b')][_0xe1d0('0x48')]);_0x11a823['query']=_[_0xe1d0('0x4d')](_0xe58220['query']);_0x11a823[_0xe1d0('0x55')]=_[_0xe1d0('0x62')](_0x11a823[_0xe1d0('0x4b')],_0x11a823[_0xe1d0('0x4c')]);_0x3a48e4[_0xe1d0('0x4e')]=_[_0xe1d0('0x62')](_0x11a823[_0xe1d0('0x4b')],qs['fields'](_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x4f')]));_0x3a48e4['attributes']=_0x3a48e4[_0xe1d0('0x4e')][_0xe1d0('0x63')]?_0x3a48e4[_0xe1d0('0x4e')]:_0x11a823[_0xe1d0('0x4b')];_0x3a48e4[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x53')]);_0x3a48e4[_0xe1d0('0x54')]=qs[_0xe1d0('0x55')](_[_0xe1d0('0x56')](_0xe58220['query'],_0x11a823['filters']));if(_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x57')]){_0x3a48e4[_0xe1d0('0x54')]=_[_0xe1d0('0x58')](_0x3a48e4['where'],{'$or':_[_0xe1d0('0x46')](_0x3a48e4[_0xe1d0('0x4e')],function(_0x59ae50){var _0x12359d={};_0x12359d[_0x59ae50]={'$like':'%'+_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x57')]+'%'};return _0x12359d;})});}_0x3a48e4=_[_0xe1d0('0x58')]({},_0x3a48e4,_0xe58220[_0xe1d0('0x5a')]);return _0x17dbb3[_0xe1d0('0x90')](_0x3a48e4);}})[_0xe1d0('0x27')](function(_0x35a77f){if(_0x35a77f){_0x259cf0=_0x35a77f[_0xe1d0('0x63')];if(!_0xe58220[_0xe1d0('0x4c')]['hasOwnProperty'](_0xe1d0('0x51'))){_0x3a48e4[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x38')]);_0x3a48e4['offset']=qs[_0xe1d0('0x36')](_0xe58220[_0xe1d0('0x4c')][_0xe1d0('0x36')]);}return _0x17dbb3['getApplications'](_0x3a48e4);}})['then'](function(_0x5d551e){if(_0x5d551e){return _0x5d551e?{'count':_0x259cf0,'rows':_0x5d551e}:null;}})[_0xe1d0('0x27')](respondWithResult(_0x2c5392,null))[_0xe1d0('0x31')](handleError(_0x2c5392,null));};function Extension(_0x30cca8,_0x3e36e2,_0x320243,_0x578de0){this[_0xe1d0('0x91')]=_0xe1d0('0x92');this[_0xe1d0('0x93')]=_0x30cca8['localstationid'];this['app']=_0x578de0;this[_0xe1d0('0x59')]=_0xe1d0('0x94');this['description']=_0xe1d0('0x95');this[_0xe1d0('0x75')]=_0x30cca8['id'];this[_0xe1d0('0x8d')]=_0x3e36e2;this['appdata']=_0x320243;}function createExtensionsReciveFax(_0x5002d3){var _0x164464=0x1;var _0x5b0d55=[];_0x5b0d55[_0xe1d0('0x96')](new Extension(_0x5002d3,_0x164464,'','Answer'));_0x164464+=0x1;_0x5b0d55[_0xe1d0('0x96')](new Extension(_0x5002d3,_0x164464,_0xe1d0('0x97'),'Set'));_0x164464+=0x1;for(var _0x30f0cd in _0x5002d3){if(_0x5002d3['hasOwnProperty'](_0x30f0cd)&&(_0x30f0cd===_0xe1d0('0x98')||_0x30f0cd===_0xe1d0('0x99')||_0x30f0cd===_0xe1d0('0x9a')||_0x30f0cd===_0xe1d0('0x9b')||_0x30f0cd===_0xe1d0('0x9c')||_0x30f0cd===_0xe1d0('0x9d')||_0x30f0cd===_0xe1d0('0x9e')||_0x30f0cd===_0xe1d0('0x9f')||_0x30f0cd===_0xe1d0('0xa0'))){_0x5b0d55[_0xe1d0('0x96')](new Extension(_0x5002d3,_0x164464,'FAXOPT('+_0x30f0cd+')='+_0x5002d3[_0x30f0cd],_0xe1d0('0xa1')));_0x164464+=0x1;}}_0x5b0d55['push'](new Extension(_0x5002d3,_0x164464,'6',_0xe1d0('0xa2')));_0x164464+=0x1;_0x5b0d55['push'](new Extension(_0x5002d3,_0x164464,_0xe1d0('0xa3'),_0xe1d0('0xa4')));_0x164464=0x0;return _0x5b0d55;}exports['addAccountApplications']=function(_0x1a1eb6,_0x53dac8,_0x32f99a){var _0x22cd8d;return db[_0xe1d0('0x87')][_0xe1d0('0x86')](function(_0x1b72c2){return db[_0xe1d0('0x47')][_0xe1d0('0x65')](_0x1a1eb6[_0xe1d0('0x6d')],{'transaction':_0x1b72c2})[_0xe1d0('0x27')](function(_0x44fdfb){_0x22cd8d=_0x44fdfb[_0xe1d0('0x3f')]({'plain':!![]});return db[_0xe1d0('0xa5')][_0xe1d0('0x8c')](createExtensionsReciveFax(_0x22cd8d),{'transaction':_0x1b72c2});});})[_0xe1d0('0x27')](function(){return _0x22cd8d;})[_0xe1d0('0x27')](respondWithResult(_0x53dac8,null))[_0xe1d0('0x31')](handleError(_0x53dac8,null));};exports[_0xe1d0('0xa6')]=function(_0x4bc757,_0x5d55c2,_0x1b3fb1){var _0x322440;return db[_0xe1d0('0x87')][_0xe1d0('0x86')](function(_0x3ce0ab){return db[_0xe1d0('0x47')][_0xe1d0('0x3e')](_0x4bc757['body'],{'where':{'id':_0x4bc757[_0xe1d0('0x6d')]['id']},'transaction':_0x3ce0ab})[_0xe1d0('0x27')](function(_0x2298a7){return db[_0xe1d0('0xa5')][_0xe1d0('0x42')]({'where':{'FaxAccountId':_0x4bc757[_0xe1d0('0x6d')]['id']},'transaction':_0x3ce0ab})[_0xe1d0('0x27')](function(_0x2cb768){return db[_0xe1d0('0xa5')][_0xe1d0('0x8c')](createExtensionsReciveFax(_[_0xe1d0('0xa7')](_0x4bc757[_0xe1d0('0x6d')],[_0xe1d0('0xa8'),_0xe1d0('0x4a'),_0xe1d0('0xa9'),_0xe1d0('0xaa'),_0xe1d0('0xab'),'ListId'])),{'transaction':_0x3ce0ab});});});})[_0xe1d0('0x27')](function(){return db[_0xe1d0('0x47')]['findById'](_0x4bc757[_0xe1d0('0x6d')]['id']);})[_0xe1d0('0x27')](respondWithResult(_0x5d55c2,null))[_0xe1d0('0x31')](handleError(_0x5d55c2,null));};exports[_0xe1d0('0xac')]=function(_0x30d582,_0x5a403b,_0xeb8497){var _0x1b190c={'raw':!![],'where':{}};var _0xfdb249={};var _0x3f8e2d={'count':0x0,'rows':[]};return db[_0xe1d0('0x47')][_0xe1d0('0x72')]({'where':{'id':_0x30d582[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x5a403b,null))[_0xe1d0('0x27')](function(_0x267aca){if(_0x267aca){_0xfdb249[_0xe1d0('0x4b')]=_[_0xe1d0('0x4d')](db[_0xe1d0('0xad')]['rawAttributes']);_0xfdb249[_0xe1d0('0x4c')]=_['keys'](_0x30d582[_0xe1d0('0x4c')]);_0xfdb249[_0xe1d0('0x55')]=_['intersection'](_0xfdb249[_0xe1d0('0x4b')],_0xfdb249[_0xe1d0('0x4c')]);_0x1b190c['attributes']=_[_0xe1d0('0x62')](_0xfdb249[_0xe1d0('0x4b')],qs['fields'](_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x4f')]));_0x1b190c[_0xe1d0('0x4e')]=_0x1b190c[_0xe1d0('0x4e')][_0xe1d0('0x63')]?_0x1b190c['attributes']:_0xfdb249[_0xe1d0('0x4b')];if(!_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x50')]('nolimit')){_0x1b190c[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x38')]);_0x1b190c[_0xe1d0('0x36')]=qs[_0xe1d0('0x36')](_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x36')]);}_0x1b190c[_0xe1d0('0x52')]=qs[_0xe1d0('0x53')](_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x53')]);_0x1b190c['where']=qs[_0xe1d0('0x55')](_[_0xe1d0('0x56')](_0x30d582[_0xe1d0('0x4c')],_0xfdb249[_0xe1d0('0x55')]));_0x1b190c[_0xe1d0('0x54')]['FaxAccountId']=_0x267aca['id'];if(_0x30d582['query'][_0xe1d0('0x57')]){_0x1b190c[_0xe1d0('0x54')]=_['merge'](_0x1b190c[_0xe1d0('0x54')],{'$or':_['map'](_0x1b190c[_0xe1d0('0x4e')],function(_0x163d77){var _0x4e11bc={};_0x4e11bc[_0x163d77]={'$like':'%'+_0x30d582[_0xe1d0('0x4c')]['filter']+'%'};return _0x4e11bc;})});}if(_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0xae')]){var _0x1af3bc=_0x30d582[_0xe1d0('0x4c')]['$gte'][_0xe1d0('0xaf')](',');var _0xb51ce8={};_0xb51ce8[_0x1af3bc[0x0]]={'$gte':moment(_0x1af3bc[0x1])[_0xe1d0('0xb0')](_0xe1d0('0xb1'))};_0x1b190c[_0xe1d0('0x54')]=_[_0xe1d0('0x58')](_0x1b190c['where'],_0xb51ce8);}_0x1b190c=_[_0xe1d0('0x58')]({},_0x1b190c,_0x30d582['options']);return db[_0xe1d0('0xad')][_0xe1d0('0x39')]({'where':_0x1b190c['where']})[_0xe1d0('0x27')](function(_0x11faf4){_0x3f8e2d[_0xe1d0('0x39')]=_0x11faf4;if(_0x30d582[_0xe1d0('0x4c')][_0xe1d0('0x5b')]){_0x1b190c[_0xe1d0('0x5c')]=[{'all':!![]}];}return db['FaxMessage'][_0xe1d0('0x5d')](_0x1b190c);})[_0xe1d0('0x27')](function(_0x4c2ef0){_0x3f8e2d[_0xe1d0('0x5e')]=_0x4c2ef0;return _0x3f8e2d;});}})[_0xe1d0('0x27')](respondWithFilteredResult(_0x5a403b,_0x1b190c))[_0xe1d0('0x31')](handleError(_0x5a403b,null));};exports[_0xe1d0('0x44')]=function(_0x391355,_0x316e22,_0x53f08d){var _0x367334,_0x3ee74f={},_0x265747;if(_0x391355[_0xe1d0('0x6d')]['to']){_0x265747=_0x391355[_0xe1d0('0x6d')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x391355[_0xe1d0('0x6e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xe1d0('0x7c')],'as':_0xe1d0('0xb2'),'where':{'fax':_0x265747},'limit':0x1,'order':[[_0xe1d0('0xaa'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x316e22,null))[_0xe1d0('0x27')](function(_0x5b67a1){_0x367334=_0x5b67a1;if(_0x391355[_0xe1d0('0x6d')]['attachments']&&_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][_0xe1d0('0x63')]){for(var _0x529899=0x0;_0x529899<_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')]['length'];_0x529899+=0x1){_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][_0x529899]={'filename':_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][_0x529899][_0xe1d0('0x43')],'id':_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][_0x529899]['id'],'path':path['join'](config[_0xe1d0('0xb4')],_0xe1d0('0xb5'),_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][_0x529899][_0xe1d0('0xb6')])};}}return respondWithRpcPromise(_0xe1d0('0xb7'),_0xe1d0('0xb7'),{'FaxAccountId':_['isNil'](_0x391355[_0xe1d0('0x6e')]['id'])?undefined:_0x391355[_0xe1d0('0x6e')]['id'],'path':_['isNil'](_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0][_0xe1d0('0x9')])?undefined:_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0]['path'],'fax':_['isNil'](_0x391355[_0xe1d0('0x6d')]['to'][0x0])?undefined:_0x391355[_0xe1d0('0x6d')]['to'][0x0]},client9002);})[_0xe1d0('0x27')](function(){if(_0x367334){if(_[_0xe1d0('0xb8')](_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb9')])){_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb9')]=util[_0xe1d0('0xb0')](_0xe1d0('0xba'),_0x367334[_0xe1d0('0x43')],_0x367334[_0xe1d0('0xbb')]);}if(_0x367334['List']){if(_0x367334[_0xe1d0('0xbc')]['Contacts'][_0xe1d0('0x63')]){return _0x367334[_0xe1d0('0xbc')][_0xe1d0('0xb2')][0x0];}else{return db[_0xe1d0('0x7c')][_0xe1d0('0x65')](_['defaults'](_0x391355[_0xe1d0('0x6d')],{'firstName':_0x391355[_0xe1d0('0x6d')]['to'][0x0],'phone':_0x391355[_0xe1d0('0x6d')]['to'][0x0],'fax':_0x391355[_0xe1d0('0x6d')]['to'][0x0],'ListId':_0x367334[_0xe1d0('0xbd')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x185295){if(_0x185295){return db[_0xe1d0('0x7b')]['find']({'where':{'ContactId':_0x185295['id'],'closed':![],'FaxAccountId':_0x367334['id']}})[_0xe1d0('0x27')](function(_0x3b3d19){if(_0x3b3d19){return[_0x3b3d19,![]];}return db[_0xe1d0('0x7b')][_0xe1d0('0x65')]({'UserId':_0x391355[_0xe1d0('0x66')]['id'],'ContactId':_0x185295['id'],'FaxAccountId':_0x367334['id'],'fax':_0x391355[_0xe1d0('0x6d')]['to'][0x0],'firstMsgDirection':_0xe1d0('0xbe'),'Messages':[_[_0xe1d0('0x58')](_0x391355[_0xe1d0('0x6d')],{'read':![],'body':_0x391355['body'][_0xe1d0('0xb3')][0x0][_0xe1d0('0xbf')],'FaxAccountId':_0x367334['id'],'UserId':_0x391355[_0xe1d0('0x66')]['id'],'ContactId':_0x185295['id'],'AttachmentId':_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0]['id']})]},{'include':[{'model':db[_0xe1d0('0xad')],'as':_0xe1d0('0xc0')}]})[_0xe1d0('0x27')](function(_0x11132f){return[_0x11132f,!![]];});});}else{throw new Error(_0xe1d0('0xc1'));}})['spread'](function(_0x58c97a,_0x1966c9){if(_0x1966c9){return _0x58c97a;}return db[_0xe1d0('0xad')][_0xe1d0('0x65')]({'direction':_0xe1d0('0xbe'),'read':![],'body':_0x391355['body']['attachments'][0x0][_0xe1d0('0xbf')],'FaxAccountId':_0x367334['id'],'FaxInteractionId':_0x58c97a['id'],'UserId':_0x391355[_0xe1d0('0x66')]['id'],'ContactId':_0x58c97a[_0xe1d0('0xc2')],'AttachmentId':_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0]['id']})[_0xe1d0('0x27')](function(_0x57d644){_0x58c97a[_0xe1d0('0xc3')][_0xe1d0('0xc0')]=[];_0x58c97a['dataValues'][_0xe1d0('0xc0')]['push'](_0x57d644[_0xe1d0('0xc3')]);return _0x58c97a;});})[_0xe1d0('0x27')](function(_0x1ec58f){respondWithRpcPromise(_0xe1d0('0xc4'),'SendFax',{'FaxAccountId':_['isNil'](_0x391355['params']['id'])?undefined:_0x391355['params']['id'],'path':_[_0xe1d0('0xb8')](_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0]['path'])?undefined:_0x391355[_0xe1d0('0x6d')][_0xe1d0('0xb3')][0x0][_0xe1d0('0x9')],'fax':_['isNil'](_0x391355[_0xe1d0('0x6d')]['to'][0x0])?undefined:_0x391355['body']['to'][0x0],'AttachmentId':_0x391355[_0xe1d0('0x6d')]['attachments'][0x0]['id']},client9002)[_0xe1d0('0x27')](function(_0x4790e4){logger[_0xe1d0('0x28')](_0xe1d0('0xc5'),_0x4790e4);})[_0xe1d0('0x31')](function(_0x1761e4){logger[_0xe1d0('0x28')](_0xe1d0('0xc5'),_0x1761e4);});return _0x1ec58f;})[_0xe1d0('0x27')](respondWithResult(_0x316e22,null))[_0xe1d0('0x31')](handleError(_0x316e22,null));};exports[_0xe1d0('0xc6')]=function(_0x4ff2a9,_0x290c4f,_0x1ac013){return db[_0xe1d0('0x47')][_0xe1d0('0x64')]({'where':{'id':_0x4ff2a9[_0xe1d0('0x6e')]['id']}})['then'](handleEntityNotFound(_0x290c4f,null))['then'](function(_0x60280d){if(_0x60280d){return _0x60280d['addAgents'](_0x4ff2a9[_0xe1d0('0x6d')][_0xe1d0('0x79')],_[_0xe1d0('0xa7')](_0x4ff2a9[_0xe1d0('0x6d')],[_0xe1d0('0x79'),'id'])||{})[_0xe1d0('0xc7')](function(_0x1af566){for(var _0x56c8d7=0x0;_0x56c8d7<_0x4ff2a9[_0xe1d0('0x6d')][_0xe1d0('0x79')][_0xe1d0('0x63')];_0x56c8d7+=0x1){socket[_0xe1d0('0xc8')]('userFaxAccount:save',{'UserId':Number(_0x4ff2a9['body'][_0xe1d0('0x79')][_0x56c8d7]),'FaxAccountId':Number(_0x4ff2a9[_0xe1d0('0x6e')]['id'])});}return _0x1af566;});}})['then'](respondWithResult(_0x290c4f,null))['catch'](handleError(_0x290c4f,null));};exports[_0xe1d0('0xc9')]=function(_0x4bbc8e,_0x55765e,_0x5fc790){return db[_0xe1d0('0x47')]['find']({'where':{'id':_0x4bbc8e[_0xe1d0('0x6e')]['id']}})[_0xe1d0('0x27')](handleEntityNotFound(_0x55765e,null))[_0xe1d0('0x27')](function(_0x1b5777){if(_0x1b5777){return _0x1b5777[_0xe1d0('0xc9')](_0x4bbc8e[_0xe1d0('0x4c')][_0xe1d0('0x79')])[_0xe1d0('0x27')](function(){if(_['isArray'](_0x4bbc8e['query'][_0xe1d0('0x79')])){for(var _0x22645c=0x0;_0x22645c<_0x4bbc8e[_0xe1d0('0x4c')]['ids'][_0xe1d0('0x63')];_0x22645c+=0x1){socket[_0xe1d0('0xc8')](_0xe1d0('0xca'),{'UserId':Number(_0x4bbc8e[_0xe1d0('0x4c')][_0xe1d0('0x79')][_0x22645c]),'FaxAccountId':Number(_0x4bbc8e[_0xe1d0('0x6e')]['id'])});}}else{socket[_0xe1d0('0xc8')]('userFaxAccount:remove',{'UserId':Number(_0x4bbc8e[_0xe1d0('0x4c')]['ids']),'FaxAccountId':Number(_0x4bbc8e[_0xe1d0('0x6e')]['id'])});}});}})[_0xe1d0('0x27')](respondWithStatusCode(_0x55765e,null))[_0xe1d0('0x31')](handleError(_0x55765e,null));};exports[_0xe1d0('0xcb')]=function(_0x2c8819,_0x5b46f5,_0x3a5ae9){var _0x26c7c6={};var _0xfd2e48={};var _0x1501f0;var _0x170b50;return db[_0xe1d0('0x47')][_0xe1d0('0x72')]({'where':{'id':_0x2c8819['params']['id']}})['then'](handleEntityNotFound(_0x5b46f5,null))[_0xe1d0('0x27')](function(_0xa39532){if(_0xa39532){_0x1501f0=_0xa39532;_0xfd2e48[_0xe1d0('0x4b')]=_['keys'](db[_0xe1d0('0x7e')][_0xe1d0('0x48')]);_0xfd2e48['query']=_[_0xe1d0('0x4d')](_0x2c8819[_0xe1d0('0x4c')]);_0xfd2e48[_0xe1d0('0x55')]=_[_0xe1d0('0x62')](_0xfd2e48['model'],_0xfd2e48[_0xe1d0('0x4c')]);_0x26c7c6[_0xe1d0('0x4e')]=_['intersection'](_0xfd2e48[_0xe1d0('0x4b')],qs[_0xe1d0('0x4f')](_0x2c8819[_0xe1d0('0x4c')][_0xe1d0('0x4f')]));_0x26c7c6['attributes']=_0x26c7c6[_0xe1d0('0x4e')][_0xe1d0('0x63')]?_0x26c7c6[_0xe1d0('0x4e')]:_0xfd2e48['model'];_0x26c7c6[_0xe1d0('0x52')]=qs['sort'](_0x2c8819['query'][_0xe1d0('0x53')]);_0x26c7c6[_0xe1d0('0x54')]=qs['filters'](_[_0xe1d0('0x56')](_0x2c8819[_0xe1d0('0x4c')],_0xfd2e48[_0xe1d0('0x55')]));if(_0x2c8819[_0xe1d0('0x4c')][_0xe1d0('0x57')]){_0x26c7c6['where']=_[_0xe1d0('0x58')](_0x26c7c6[_0xe1d0('0x54')],{'$or':_[_0xe1d0('0x46')](_0x26c7c6['attributes'],function(_0x304f21){var _0x1483d2={};_0x1483d2[_0x304f21]={'$like':'%'+_0x2c8819[_0xe1d0('0x4c')][_0xe1d0('0x57')]+'%'};return _0x1483d2;})});}_0x26c7c6=_[_0xe1d0('0x58')]({},_0x26c7c6,_0x2c8819['options']);return _0x1501f0[_0xe1d0('0xcb')](_0x26c7c6);}})[_0xe1d0('0x27')](function(_0x1cc87d){if(_0x1cc87d){_0x170b50=_0x1cc87d[_0xe1d0('0x63')];if(!_0x2c8819[_0xe1d0('0x4c')]['hasOwnProperty'](_0xe1d0('0x51'))){_0x26c7c6[_0xe1d0('0x38')]=qs[_0xe1d0('0x38')](_0x2c8819['query'][_0xe1d0('0x38')]);_0x26c7c6['offset']=qs[_0xe1d0('0x36')](_0x2c8819[_0xe1d0('0x4c')][_0xe1d0('0x36')]);}return _0x1501f0[_0xe1d0('0xcb')](_0x26c7c6);}})[_0xe1d0('0x27')](function(_0x5c930e){if(_0x5c930e){return _0x5c930e?{'count':_0x170b50,'rows':_0x5c930e}:null;}})[_0xe1d0('0x27')](respondWithResult(_0x5b46f5,null))['catch'](handleError(_0x5b46f5,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 881d2b8..b11c61c 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 _0xbfe2=['../../mysqldb','FaxAccount','setMaxListeners','hook','exports','events'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xbfe2,0x16d));var _0x2bfe=function(_0x5adce5,_0x3938fb){_0x5adce5=_0x5adce5-0x0;var _0x2666ac=_0xbfe2[_0x5adce5];return _0x2666ac;};'use strict';var EventEmitter=require(_0x2bfe('0x0'));var FaxAccount=require(_0x2bfe('0x1'))['db'][_0x2bfe('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2bfe('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xdd77c8){return function(_0x35f3ca,_0x1deaf7,_0x3a48fc){FaxAccountEvents['emit'](_0xdd77c8+':'+_0x35f3ca['id'],_0x35f3ca);FaxAccountEvents['emit'](_0xdd77c8,_0x35f3ca);_0x3a48fc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x2bfe('0x4')](e,emitEvent(event));}}module[_0x2bfe('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x7ce3=['events','../../mysqldb','setMaxListeners','update','hasOwnProperty','hook','exports'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x7ce3,0x7e));var _0x37ce=function(_0x40eada,_0x58cb7f){_0x40eada=_0x40eada-0x0;var _0x1e48f8=_0x7ce3[_0x40eada];return _0x1e48f8;};'use strict';var EventEmitter=require(_0x37ce('0x0'));var FaxAccount=require(_0x37ce('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x37ce('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x37ce('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2a3676){return function(_0x2c9658,_0x5edffb,_0x1bd1ce){FaxAccountEvents['emit'](_0x2a3676+':'+_0x2c9658['id'],_0x2c9658);FaxAccountEvents['emit'](_0x2a3676,_0x2c9658);_0x1bd1ce(null);};}for(var e in events){if(events[_0x37ce('0x4')](e)){var event=events[e];FaxAccount[_0x37ce('0x5')](e,emitEvent(event));}}module[_0x37ce('0x6')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 059bfd0..c8d4483 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 _0xd894=['rimraf','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x279d53,_0x27bfd9){var _0x52d883=function(_0x26d810){while(--_0x26d810){_0x279d53['push'](_0x279d53['shift']());}};_0x52d883(++_0x27bfd9);}(_0xd894,0xb9));var _0x4d89=function(_0x33c126,_0x36f522){_0x33c126=_0x33c126-0x0;var _0x4414f9=_0xd894[_0x33c126];return _0x4414f9;};'use strict';var _=require(_0x4d89('0x0'));var util=require(_0x4d89('0x1'));var logger=require('../../config/logger')(_0x4d89('0x2'));var moment=require(_0x4d89('0x3'));var BPromise=require(_0x4d89('0x4'));var rp=require(_0x4d89('0x5'));var fs=require('fs');var path=require(_0x4d89('0x6'));var rimraf=require(_0x4d89('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d89('0x8'));module['exports']=function(_0x168277,_0x3fabc9){return _0x168277[_0x4d89('0x9')](_0x4d89('0xa'),attributes,{'tableName':_0x4d89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8b93=['fax_accounts','util','api','moment','path','../../config/environment','exports','define','FaxAccount'];(function(_0x20e6f3,_0x3c5704){var _0x360c5d=function(_0x506e3b){while(--_0x506e3b){_0x20e6f3['push'](_0x20e6f3['shift']());}};_0x360c5d(++_0x3c5704);}(_0x8b93,0xc7));var _0x38b9=function(_0x562e08,_0x5729bf){_0x562e08=_0x562e08-0x0;var _0x45afaa=_0x8b93[_0x562e08];return _0x45afaa;};'use strict';var _=require('lodash');var util=require(_0x38b9('0x0'));var logger=require('../../config/logger')(_0x38b9('0x1'));var moment=require(_0x38b9('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x38b9('0x3'));var rimraf=require('rimraf');var config=require(_0x38b9('0x4'));var attributes=require('./faxAccount.attributes');module[_0x38b9('0x5')]=function(_0x21371f,_0x19d5ac){return _0x21371f[_0x38b9('0x6')](_0x38b9('0x7'),attributes,{'tableName':_0x38b9('0x8'),'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 d938bae..d9e94d7 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 _0x81c0=['findAll','options','raw','where','include','model','attributes','map','then','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','difference','keys','createdAt','CompanyId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account','Contacts','updatedAt','FaxApplication','Applications','List','applications','list','orderBy','priority','asc','length','from','ListId','create','FaxInteraction','spread','autoclose','push','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetFaxAccount','FaxAccount'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x81c0,0xee));var _0x081c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x81c0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x081c('0x0'));var util=require(_0x081c('0x1'));var moment=require(_0x081c('0x2'));var BPromise=require('bluebird');var rs=require(_0x081c('0x3'));var fs=require('fs');var Redis=require(_0x081c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x081c('0x5'));var logger=require(_0x081c('0x6'))(_0x081c('0x7'));var config=require(_0x081c('0x8'));var jayson=require(_0x081c('0x9'));var client=jayson['client'][_0x081c('0xa')]({'port':0x232c});config[_0x081c('0xb')]=_[_0x081c('0xc')](config['redis'],{'host':_0x081c('0xd'),'port':0x18eb});var socket=require(_0x081c('0xe'))(new Redis(config[_0x081c('0xb')]));require(_0x081c('0xf'))[_0x081c('0x10')](socket);function respondWithRpcPromise(_0x227b9b,_0x2d87ae,_0x2ff990){return new BPromise(function(_0x2bd955,_0x1c317e){return client[_0x081c('0x11')](_0x227b9b,_0x2ff990)['then'](function(_0xcdce31){logger[_0x081c('0x12')](_0x081c('0x13'),_0x2d87ae,_0x081c('0x14'));logger[_0x081c('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2d87ae,_0x081c('0x14'),JSON[_0x081c('0x16')](_0xcdce31));if(_0xcdce31['error']){if(_0xcdce31['error'][_0x081c('0x17')]===0x1f4){logger['error'](_0x081c('0x13'),_0x2d87ae,_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);return _0x1c317e(_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);}logger[_0x081c('0x18')](_0x081c('0x13'),_0x2d87ae,_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);return _0x2bd955(_0xcdce31[_0x081c('0x18')][_0x081c('0x19')]);}else{logger[_0x081c('0x12')]('FaxAccount,\x20%s,\x20%s',_0x2d87ae,'request\x20sent');_0x2bd955(_0xcdce31[_0x081c('0x1a')][_0x081c('0x19')]);}})['catch'](function(_0x154f69){logger['error'](_0x081c('0x13'),_0x2d87ae,_0x154f69);_0x1c317e(_0x154f69);});});}exports[_0x081c('0x1b')]=function(_0x32f4d2){var _0x4233da=this;return new Promise(function(_0x386501,_0x33f862){return db[_0x081c('0x1c')][_0x081c('0x1d')]({'raw':_0x32f4d2['options']?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x1f')]===undefined?!![]:![]:!![],'where':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x20')]||null:null,'attributes':_0x32f4d2['options']?_0x32f4d2['options']['attributes']||null:null,'limit':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')]['limit']||null:null,'include':_0x32f4d2[_0x081c('0x1e')]?_0x32f4d2[_0x081c('0x1e')][_0x081c('0x21')]?_['map'](_0x32f4d2[_0x081c('0x1e')][_0x081c('0x21')],function(_0x22fd31){return{'model':db[_0x22fd31[_0x081c('0x22')]],'as':_0x22fd31['as'],'attributes':_0x22fd31[_0x081c('0x23')],'include':_0x22fd31[_0x081c('0x21')]?_[_0x081c('0x24')](_0x22fd31['include'],function(_0x5dd8e1){return{'model':db[_0x5dd8e1[_0x081c('0x22')]],'as':_0x5dd8e1['as'],'attributes':_0x5dd8e1[_0x081c('0x23')],'include':_0x5dd8e1['include']?_[_0x081c('0x24')](_0x5dd8e1[_0x081c('0x21')],function(_0x165b9e){return{'model':db[_0x165b9e[_0x081c('0x22')]],'as':_0x165b9e['as'],'attributes':_0x165b9e[_0x081c('0x23')]};}):[]};}):[]};}):[]:[]})[_0x081c('0x25')](function(_0x5a50c3){logger[_0x081c('0x12')]('GetFaxAccount',_0x32f4d2);logger[_0x081c('0x15')](_0x081c('0x1b'),_0x32f4d2,JSON[_0x081c('0x16')](_0x5a50c3));_0x386501(_0x5a50c3);})['catch'](function(_0x460083){logger['error'](_0x081c('0x1b'),_0x460083[_0x081c('0x19')],_0x32f4d2);_0x33f862(_0x4233da[_0x081c('0x18')](0x1f4,_0x460083[_0x081c('0x19')]));});});};exports[_0x081c('0x26')]=function(_0x410d91,_0x422078,_0x3a3337){var _0x3cded1=this;return new Promise(function(_0x32170a,_0x2c3b7a){var _0x18a970={'body':_0x410d91[_0x081c('0x27')],'channel':_0x081c('0x28')};var _0x4802f6=[];var _0x25bdd5=[];var _0x3e98eb={};return db[_0x081c('0x29')][_0x081c('0x2a')]()['then'](function(_0x504622){if(!_0x504622){throw new db[(_0x081c('0x2b'))]['ValidationError']('no\x20available\x20attributes');}_0x4802f6=_[_0x081c('0x2c')](_[_0x081c('0x2d')](_0x504622),[_0x081c('0x2e'),'updatedAt']);_0x25bdd5=_[_0x081c('0x2c')](_[_0x081c('0x2d')](_0x504622),[_0x081c('0x2e'),'updatedAt',_0x081c('0x2f'),'ListId']);if(_0x410d91[_0x081c('0x27')]['id']){delete _0x410d91['body']['id'];}if(_['isNil'](_0x410d91['body']['from'])){throw new db['Sequelize'][(_0x081c('0x30'))](_0x081c('0x31'));}if(_['isNil'](_0x410d91[_0x081c('0x27')]['body'])||_0x410d91['body'][_0x081c('0x27')]===''){throw new db[(_0x081c('0x2b'))][(_0x081c('0x30'))](_0x081c('0x32'));}if(_[_0x081c('0x33')](_0x410d91[_0x081c('0x27')][_0x081c('0x34')])){throw new db['Sequelize']['ValidationError'](_0x081c('0x35')+_0x25bdd5);}if(!_[_0x081c('0x36')](_0x25bdd5,_0x410d91[_0x081c('0x27')]['mapKey'])){throw new db[(_0x081c('0x2b'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25bdd5);}_0x3e98eb[_0x410d91[_0x081c('0x27')][_0x081c('0x34')]]=_0x410d91['body']['from'];})[_0x081c('0x25')](function(){return db[_0x081c('0x1c')][_0x081c('0x37')]({'where':{'id':_0x410d91[_0x081c('0x38')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x081c('0x29')],'as':_0x081c('0x39'),'where':_0x3e98eb,'limit':0x1,'order':[[_0x081c('0x3a'),'DESC']]}]},{'model':db[_0x081c('0x3b')],'as':_0x081c('0x3c')}]});})['then'](function(_0x12f423){if(_0x12f423&&_0x12f423[_0x081c('0x3d')]){var _0x468cf0=_0x12f423['get']({'plain':!![]});_0x18a970[_0x081c('0x38')]=_0x468cf0;_0x18a970[_0x081c('0x3e')]=_0x468cf0[_0x081c('0x3c')];_0x18a970[_0x081c('0x3f')]=_0x468cf0['List'];_0x18a970['applications']=_[_0x081c('0x40')](_0x18a970[_0x081c('0x3e')],[_0x081c('0x41')],[_0x081c('0x42')]);if(_0x18a970['account']['Applications']){delete _0x18a970[_0x081c('0x38')][_0x081c('0x3c')];}if(_0x18a970[_0x081c('0x38')][_0x081c('0x3d')]&&_0x18a970['account'][_0x081c('0x3d')][_0x081c('0x39')][_0x081c('0x43')]){return _0x18a970[_0x081c('0x38')][_0x081c('0x3d')][_0x081c('0x39')][0x0];}var _0x320271=_[_0x081c('0xc')](_0x410d91[_0x081c('0x27')],{'firstName':_0x410d91[_0x081c('0x27')][_0x081c('0x44')],'ListId':_0x468cf0[_0x081c('0x45')]});_0x320271[_0x410d91[_0x081c('0x27')][_0x081c('0x34')]]=_0x410d91[_0x081c('0x27')]['from'];return db[_0x081c('0x29')][_0x081c('0x46')](_0x320271,{'fields':_0x4802f6,'raw':!![]});}})[_0x081c('0x25')](function(_0x3f5b8e){_0x18a970['contact']=_0x3f5b8e;if(_0x3f5b8e){var _0x3a746c={'ContactId':_0x3f5b8e['id'],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id'],'fax':_0x3f5b8e[_0x081c('0x28')]};return db[_0x081c('0x47')][_0x081c('0x37')]({'where':{'ContactId':_0x3f5b8e['id'],'closed':![],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id']}})['then'](function(_0x21f464){if(_0x21f464){return[_0x21f464,![]];}return db[_0x081c('0x47')][_0x081c('0x46')](_0x3a746c)[_0x081c('0x25')](function(_0x16ed48){return[_0x16ed48,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x081c('0x48')](function(_0x4dc7f8,_0x453f6f){var _0x10a1f1=_0x4dc7f8['get']({'plain':!![]});if(_0x453f6f){if(_0x18a970[_0x081c('0x38')][_0x081c('0x49')]){_0x18a970[_0x081c('0x3e')][_0x081c('0x4a')]({'id':0x0,'priority':_0x18a970[_0x081c('0x3e')][_0x081c('0x43')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x081c('0x4b')});}_0x10a1f1[_0x081c('0x4c')]=!![];}else{_0x10a1f1['created']=![];}_0x18a970['interaction']=_0x10a1f1;return db[_0x081c('0x4d')][_0x081c('0x46')]({'body':_0x410d91[_0x081c('0x27')][_0x081c('0x27')],'FaxAccountId':_0x410d91[_0x081c('0x38')]['id'],'FaxInteractionId':_0x4dc7f8['id'],'direction':'in','ContactId':_0x4dc7f8[_0x081c('0x4e')],'AttachmentId':_0x410d91[_0x081c('0x27')][_0x081c('0x4f')]});})[_0x081c('0x25')](function(_0x436974){_0x18a970[_0x081c('0x19')]=_0x436974;if(_0x18a970[_0x081c('0x50')][_0x081c('0x51')]){return db[_0x081c('0x52')][_0x081c('0x37')]({'attributes':['id','name'],'where':{'id':_0x18a970[_0x081c('0x50')][_0x081c('0x51')]}})['then'](function(_0x2865a8){if(_0x2865a8){_0x18a970[_0x081c('0x3e')][_0x081c('0x53')]({'id':0x0,'priority':0x0,'app':_0x081c('0x54'),'appdata':_0x2865a8[_0x081c('0x55')]+','+(_0x18a970[_0x081c('0x38')][_0x081c('0x56')]||0xa),'interval':_0x081c('0x4b')});}return respondWithRpcPromise(_0x081c('0x57'),_0x081c('0x58'),_0x18a970);});}return respondWithRpcPromise(_0x081c('0x57'),_0x081c('0x58'),_0x18a970);})[_0x081c('0x25')](function(_0x29b92b){_0x32170a(_0x29b92b);})['catch'](function(_0xa5b3bb){_0x2c3b7a(_0x3cded1[_0x081c('0x18')](0x1f4,_0xa5b3bb['message']));});});}; \ No newline at end of file +var _0xa35f=['created','FaxMessage','create','interaction','User','name','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetFaxAccount','debug','NotifyFaxAccount','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','keys','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','FaxApplication','Applications','applications','list','priority','asc','length','fax','FaxInteraction','find','Contact\x20not\x20found','autoclose','push','close'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa35f,0x1c0));var _0xfa35=function(_0x4b2b03,_0xbf34ee){_0x4b2b03=_0x4b2b03-0x0;var _0x1bf0ed=_0xa35f[_0x4b2b03];return _0x1bf0ed;};'use strict';var _=require(_0xfa35('0x0'));var util=require('util');var moment=require(_0xfa35('0x1'));var BPromise=require(_0xfa35('0x2'));var rs=require(_0xfa35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa35('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfa35('0x5'));var jayson=require(_0xfa35('0x6'));var client=jayson['client'][_0xfa35('0x7')]({'port':0x232c});config[_0xfa35('0x8')]=_[_0xfa35('0x9')](config['redis'],{'host':_0xfa35('0xa'),'port':0x18eb});var socket=require(_0xfa35('0xb'))(new Redis(config[_0xfa35('0x8')]));require('./faxAccount.socket')[_0xfa35('0xc')](socket);function respondWithRpcPromise(_0x1a9809,_0x233492,_0x266e06){return new BPromise(function(_0x5244c2,_0x4a800e){return client[_0xfa35('0xd')](_0x1a9809,_0x266e06)[_0xfa35('0xe')](function(_0x3051c3){logger[_0xfa35('0xf')](_0xfa35('0x10'),_0x233492,_0xfa35('0x11'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x233492,_0xfa35('0x11'),JSON[_0xfa35('0x12')](_0x3051c3));if(_0x3051c3['error']){if(_0x3051c3[_0xfa35('0x13')][_0xfa35('0x14')]===0x1f4){logger['error'](_0xfa35('0x10'),_0x233492,_0x3051c3[_0xfa35('0x13')]['message']);return _0x4a800e(_0x3051c3[_0xfa35('0x13')][_0xfa35('0x15')]);}logger[_0xfa35('0x13')](_0xfa35('0x10'),_0x233492,_0x3051c3[_0xfa35('0x13')]['message']);return _0x5244c2(_0x3051c3[_0xfa35('0x13')][_0xfa35('0x15')]);}else{logger['info'](_0xfa35('0x10'),_0x233492,_0xfa35('0x11'));_0x5244c2(_0x3051c3[_0xfa35('0x16')][_0xfa35('0x15')]);}})[_0xfa35('0x17')](function(_0x58fda1){logger[_0xfa35('0x13')](_0xfa35('0x10'),_0x233492,_0x58fda1);_0x4a800e(_0x58fda1);});});}exports['GetFaxAccount']=function(_0x307494){var _0x361f5a=this;return new Promise(function(_0x35482d,_0x2b451c){return db[_0xfa35('0x18')][_0xfa35('0x19')]({'raw':_0x307494[_0xfa35('0x1a')]?_0x307494[_0xfa35('0x1a')][_0xfa35('0x1b')]===undefined?!![]:![]:!![],'where':_0x307494[_0xfa35('0x1a')]?_0x307494[_0xfa35('0x1a')][_0xfa35('0x1c')]||null:null,'attributes':_0x307494['options']?_0x307494[_0xfa35('0x1a')][_0xfa35('0x1d')]||null:null,'limit':_0x307494[_0xfa35('0x1a')]?_0x307494[_0xfa35('0x1a')][_0xfa35('0x1e')]||null:null,'include':_0x307494[_0xfa35('0x1a')]?_0x307494[_0xfa35('0x1a')][_0xfa35('0x1f')]?_['map'](_0x307494[_0xfa35('0x1a')]['include'],function(_0x1418a9){return{'model':db[_0x1418a9[_0xfa35('0x20')]],'as':_0x1418a9['as'],'attributes':_0x1418a9[_0xfa35('0x1d')],'include':_0x1418a9[_0xfa35('0x1f')]?_[_0xfa35('0x21')](_0x1418a9[_0xfa35('0x1f')],function(_0x24aecc){return{'model':db[_0x24aecc[_0xfa35('0x20')]],'as':_0x24aecc['as'],'attributes':_0x24aecc[_0xfa35('0x1d')],'include':_0x24aecc[_0xfa35('0x1f')]?_[_0xfa35('0x21')](_0x24aecc[_0xfa35('0x1f')],function(_0x4a03b0){return{'model':db[_0x4a03b0[_0xfa35('0x20')]],'as':_0x4a03b0['as'],'attributes':_0x4a03b0[_0xfa35('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a5b75){logger['info'](_0xfa35('0x22'),_0x307494);logger[_0xfa35('0x23')](_0xfa35('0x22'),_0x307494,JSON[_0xfa35('0x12')](_0x4a5b75));_0x35482d(_0x4a5b75);})['catch'](function(_0x2a6d8f){logger[_0xfa35('0x13')](_0xfa35('0x22'),_0x2a6d8f[_0xfa35('0x15')],_0x307494);_0x2b451c(_0x361f5a[_0xfa35('0x13')](0x1f4,_0x2a6d8f[_0xfa35('0x15')]));});});};exports[_0xfa35('0x24')]=function(_0x1b48e2,_0x28d74e,_0x23dea4){var _0x51dbe5=this;return new Promise(function(_0x637207,_0x33b397){var _0x415da5={'body':_0x1b48e2['body'],'channel':'fax'};var _0x47a49c=[];var _0x3c3117=[];var _0x30478d={};return db[_0xfa35('0x25')][_0xfa35('0x26')]()[_0xfa35('0xe')](function(_0x204a49){if(!_0x204a49){throw new db[(_0xfa35('0x27'))][(_0xfa35('0x28'))](_0xfa35('0x29'));}_0x47a49c=_[_0xfa35('0x2a')](_['keys'](_0x204a49),[_0xfa35('0x2b'),'updatedAt']);_0x3c3117=_[_0xfa35('0x2a')](_[_0xfa35('0x2c')](_0x204a49),[_0xfa35('0x2b'),_0xfa35('0x2d'),'CompanyId',_0xfa35('0x2e')]);if(_0x1b48e2['body']['id']){delete _0x1b48e2[_0xfa35('0x2f')]['id'];}if(_[_0xfa35('0x30')](_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x31')])){throw new db[(_0xfa35('0x27'))][(_0xfa35('0x28'))](_0xfa35('0x32'));}if(_[_0xfa35('0x30')](_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x2f')])||_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x2f')]===''){throw new db[(_0xfa35('0x27'))][(_0xfa35('0x28'))](_0xfa35('0x33'));}if(_[_0xfa35('0x30')](_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x34')])){throw new db[(_0xfa35('0x27'))]['ValidationError'](_0xfa35('0x35')+_0x3c3117);}if(!_[_0xfa35('0x36')](_0x3c3117,_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x34')])){throw new db[(_0xfa35('0x27'))]['ValidationError'](_0xfa35('0x37')+_0x3c3117);}_0x30478d[_0x1b48e2['body'][_0xfa35('0x34')]]=_0x1b48e2['body'][_0xfa35('0x31')];})['then'](function(){return db[_0xfa35('0x18')]['find']({'where':{'id':_0x1b48e2[_0xfa35('0x38')]['id']},'include':[{'model':db[_0xfa35('0x39')],'as':_0xfa35('0x3a'),'include':[{'model':db[_0xfa35('0x25')],'as':_0xfa35('0x3b'),'where':_0x30478d,'limit':0x1,'order':[[_0xfa35('0x2d'),'DESC']]}]},{'model':db[_0xfa35('0x3c')],'as':_0xfa35('0x3d')}]});})['then'](function(_0x2f8698){if(_0x2f8698&&_0x2f8698[_0xfa35('0x3a')]){var _0x2b56f4=_0x2f8698['get']({'plain':!![]});_0x415da5['account']=_0x2b56f4;_0x415da5[_0xfa35('0x3e')]=_0x2b56f4[_0xfa35('0x3d')];_0x415da5[_0xfa35('0x3f')]=_0x2b56f4[_0xfa35('0x3a')];_0x415da5[_0xfa35('0x3e')]=_['orderBy'](_0x415da5[_0xfa35('0x3e')],[_0xfa35('0x40')],[_0xfa35('0x41')]);if(_0x415da5[_0xfa35('0x38')][_0xfa35('0x3d')]){delete _0x415da5[_0xfa35('0x38')][_0xfa35('0x3d')];}if(_0x415da5['account'][_0xfa35('0x3a')]&&_0x415da5['account'][_0xfa35('0x3a')]['Contacts'][_0xfa35('0x42')]){return _0x415da5[_0xfa35('0x38')][_0xfa35('0x3a')]['Contacts'][0x0];}var _0x6b0a19=_[_0xfa35('0x9')](_0x1b48e2[_0xfa35('0x2f')],{'firstName':_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x31')],'ListId':_0x2b56f4[_0xfa35('0x2e')]});_0x6b0a19[_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x34')]]=_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x31')];return db[_0xfa35('0x25')]['create'](_0x6b0a19,{'fields':_0x47a49c,'raw':!![]});}})['then'](function(_0x4cc082){_0x415da5['contact']=_0x4cc082;if(_0x4cc082){var _0x6a7014={'ContactId':_0x4cc082['id'],'FaxAccountId':_0x1b48e2[_0xfa35('0x38')]['id'],'fax':_0x4cc082[_0xfa35('0x43')]};return db[_0xfa35('0x44')][_0xfa35('0x45')]({'where':{'ContactId':_0x4cc082['id'],'closed':![],'FaxAccountId':_0x1b48e2[_0xfa35('0x38')]['id']}})[_0xfa35('0xe')](function(_0x489d57){if(_0x489d57){return[_0x489d57,![]];}return db[_0xfa35('0x44')]['create'](_0x6a7014)[_0xfa35('0xe')](function(_0x15b007){return[_0x15b007,!![]];});});}else{throw new Error(_0xfa35('0x46'));}})['spread'](function(_0x4174ff,_0x1c6286){var _0x27d246=_0x4174ff['get']({'plain':!![]});if(_0x1c6286){if(_0x415da5['account'][_0xfa35('0x47')]){_0x415da5[_0xfa35('0x3e')][_0xfa35('0x48')]({'id':0x0,'priority':_0x415da5[_0xfa35('0x3e')][_0xfa35('0x42')]+0x1,'app':_0xfa35('0x49'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x27d246[_0xfa35('0x4a')]=!![];}else{_0x27d246['created']=![];}_0x415da5['interaction']=_0x27d246;return db[_0xfa35('0x4b')][_0xfa35('0x4c')]({'body':_0x1b48e2[_0xfa35('0x2f')][_0xfa35('0x2f')],'FaxAccountId':_0x1b48e2[_0xfa35('0x38')]['id'],'FaxInteractionId':_0x4174ff['id'],'direction':'in','ContactId':_0x4174ff['ContactId'],'AttachmentId':_0x1b48e2[_0xfa35('0x2f')]['AttachmentId']});})[_0xfa35('0xe')](function(_0x3de096){_0x415da5[_0xfa35('0x15')]=_0x3de096;if(_0x415da5[_0xfa35('0x4d')]['UserId']){return db[_0xfa35('0x4e')][_0xfa35('0x45')]({'attributes':['id',_0xfa35('0x4f')],'where':{'id':_0x415da5['interaction'][_0xfa35('0x50')]}})[_0xfa35('0xe')](function(_0x44c3a5){if(_0x44c3a5){_0x415da5['applications'][_0xfa35('0x51')]({'id':0x0,'priority':0x0,'app':_0xfa35('0x52'),'appdata':_0x44c3a5['name']+','+(_0x415da5[_0xfa35('0x38')][_0xfa35('0x53')]||0xa),'interval':_0xfa35('0x54')});}return respondWithRpcPromise(_0xfa35('0x55'),'startRouting',_0x415da5);});}return respondWithRpcPromise('Start',_0xfa35('0x56'),_0x415da5);})[_0xfa35('0xe')](function(_0x5dfb6c){_0x637207(_0x5dfb6c);})['catch'](function(_0x45c936){_0x33b397(_0x51dbe5['error'](0x1f4,_0x45c936[_0xfa35('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 2c80616..a16c02c 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 _0xfc05=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save'];(function(_0x544ed3,_0x5efe4e){var _0x413f3a=function(_0x47e77e){while(--_0x47e77e){_0x544ed3['push'](_0x544ed3['shift']());}};_0x413f3a(++_0x5efe4e);}(_0xfc05,0xbe));var _0x5fc0=function(_0x47ae27,_0xa2b532){_0x47ae27=_0x47ae27-0x0;var _0x456356=_0xfc05[_0x47ae27];return _0x456356;};'use strict';var FaxAccountEvents=require(_0x5fc0('0x0'));var events=[_0x5fc0('0x1'),'remove',_0x5fc0('0x2')];function createListener(_0x53feed,_0x4b3680){return function(_0xc2b721){_0x4b3680[_0x5fc0('0x3')](_0x53feed,_0xc2b721);};}function removeListener(_0x45789f,_0x564ed9){return function(){FaxAccountEvents[_0x5fc0('0x4')](_0x45789f,_0x564ed9);};}exports[_0x5fc0('0x5')]=function(_0x1bb16d){for(var _0x53ca47=0x0,_0xef5d=events[_0x5fc0('0x6')];_0x53ca47<_0xef5d;_0x53ca47++){var _0x1eb09a=events[_0x53ca47];var _0x1900a0=createListener(_0x5fc0('0x7')+_0x1eb09a,_0x1bb16d);FaxAccountEvents['on'](_0x1eb09a,_0x1900a0);}}; \ No newline at end of file +var _0x1ebf=['faxAccount:','./faxAccount.events','save','update','removeListener','length'];(function(_0x30b29c,_0x10b4ba){var _0x1a169=function(_0x15b219){while(--_0x15b219){_0x30b29c['push'](_0x30b29c['shift']());}};_0x1a169(++_0x10b4ba);}(_0x1ebf,0x91));var _0xf1eb=function(_0x2f0930,_0x38c263){_0x2f0930=_0x2f0930-0x0;var _0x3b0719=_0x1ebf[_0x2f0930];return _0x3b0719;};'use strict';var FaxAccountEvents=require(_0xf1eb('0x0'));var events=[_0xf1eb('0x1'),'remove',_0xf1eb('0x2')];function createListener(_0x206195,_0x2bcc4a){return function(_0x5a62f0){_0x2bcc4a['emit'](_0x206195,_0x5a62f0);};}function removeListener(_0x24ca89,_0x35ab89){return function(){FaxAccountEvents[_0xf1eb('0x3')](_0x24ca89,_0x35ab89);};}exports['register']=function(_0xc62a70){for(var _0x3f582f=0x0,_0x22562b=events[_0xf1eb('0x4')];_0x3f582f<_0x22562b;_0x3f582f++){var _0x4adf69=events[_0x3f582f];var _0x5d6a62=createListener(_0xf1eb('0x5')+_0x4adf69,_0xc62a70);FaxAccountEvents['on'](_0x4adf69,_0x5d6a62);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9138dae..2332787 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(_0x452fed,_0x2873b2){var _0x32e65f=function(_0x19bb38){while(--_0x19bb38){_0x452fed['push'](_0x452fed['shift']());}};_0x32e65f(++_0x2873b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x14d5d5,_0x4e1fe6){var _0x45dd85=function(_0x2d71cc){while(--_0x2d71cc){_0x14d5d5['push'](_0x14d5d5['shift']());}};_0x45dd85(++_0x4e1fe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 3b12bf9..9220ccc 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 _0xe8bc=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0xe8bc,0xd5));var _0xce8b=function(_0x578e60,_0x126343){_0x578e60=_0x578e60-0x0;var _0x585d4a=_0xe8bc[_0x578e60];return _0x585d4a;};'use strict';var Sequelize=require(_0xce8b('0x0'));module['exports']={'priority':{'type':Sequelize[_0xce8b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xce8b('0x2')],'allowNull':![],'defaultValue':_0xce8b('0x3')},'appdata':{'type':Sequelize[_0xce8b('0x4')]()},'description':{'type':Sequelize[_0xce8b('0x2')]},'interval':{'type':Sequelize[_0xce8b('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x23b7=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x23b7,0x1b6));var _0x723b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x23b7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x723b('0x0')]={'priority':{'type':Sequelize[_0x723b('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x723b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x723b('0x2')]},'interval':{'type':Sequelize[_0x723b('0x2')],'defaultValue':_0x723b('0x3')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e1873e2..d8ac576 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 _0x26a7=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','map','FaxApplication','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x2cb8ad,_0x235475){var _0x414f6b=function(_0xc3a742){while(--_0xc3a742){_0x2cb8ad['push'](_0x2cb8ad['shift']());}};_0x414f6b(++_0x235475);}(_0x26a7,0x153));var _0x726a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x26a7[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x726a('0x0'));var rimraf=require(_0x726a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x726a('0x2'));var rp=require(_0x726a('0x3'));var moment=require(_0x726a('0x4'));var BPromise=require(_0x726a('0x5'));var Mustache=require(_0x726a('0x6'));var util=require(_0x726a('0x7'));var path=require(_0x726a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x726a('0x9'));var fs=require('fs');var fs_extra=require(_0x726a('0xa'));var _=require(_0x726a('0xb'));var squel=require(_0x726a('0xc'));var crypto=require('crypto');var jsforce=require(_0x726a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x726a('0xe'));var Papa=require(_0x726a('0xf'));var Redis=require(_0x726a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x726a('0x11'));var as=require(_0x726a('0x12'));var hardwareService=require(_0x726a('0x13'));var logger=require('../../config/logger')(_0x726a('0x14'));var utils=require(_0x726a('0x15'));var config=require(_0x726a('0x16'));var licenseUtil=require(_0x726a('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8bed,_0x4ef7a8){_0x4ef7a8=_0x4ef7a8||0xcc;return function(_0x3b3f29){if(_0x3b3f29){return _0x3a8bed[_0x726a('0x18')](_0x4ef7a8);}return _0x3a8bed[_0x726a('0x19')](_0x4ef7a8)[_0x726a('0x1a')]();};}function respondWithResult(_0x2eacd0,_0xecfa3){_0xecfa3=_0xecfa3||0xc8;return function(_0x105939){if(_0x105939){return _0x2eacd0[_0x726a('0x19')](_0xecfa3)[_0x726a('0x1b')](_0x105939);}};}function respondWithFilteredResult(_0x2cb32b,_0x291b25){return function(_0x51ad69){if(_0x51ad69){var _0x1d384b=typeof _0x291b25[_0x726a('0x1c')]==='undefined'&&typeof _0x291b25[_0x726a('0x1d')]==='undefined';var _0x1794fa=_0x51ad69[_0x726a('0x1e')];var _0x2bfe5a=_0x1d384b?0x0:_0x291b25[_0x726a('0x1c')];var _0x2506b8=_0x1d384b?_0x51ad69['count']:_0x291b25[_0x726a('0x1c')]+_0x291b25[_0x726a('0x1d')];var _0x3b19b2;if(_0x2506b8>=_0x1794fa){_0x2506b8=_0x1794fa;_0x3b19b2=0xc8;}else{_0x3b19b2=0xce;}_0x2cb32b['status'](_0x3b19b2);return _0x2cb32b[_0x726a('0x1f')](_0x726a('0x20'),_0x2bfe5a+'-'+_0x2506b8+'/'+_0x1794fa)[_0x726a('0x1b')](_0x51ad69);}return null;};}function patchUpdates(_0x327bf1){return function(_0x51e2a8){try{jsonpatch[_0x726a('0x21')](_0x51e2a8,_0x327bf1,!![]);}catch(_0x5b55d8){return BPromise['reject'](_0x5b55d8);}return _0x51e2a8[_0x726a('0x22')]();};}function saveUpdates(_0x11c9be,_0x518f3c){return function(_0x419bec){if(_0x419bec){return _0x419bec[_0x726a('0x23')](_0x11c9be)[_0x726a('0x24')](function(_0xde26a6){return _0xde26a6;});}return null;};}function removeEntity(_0x5cee19,_0x31083a){return function(_0x2b826c){if(_0x2b826c){return _0x2b826c['destroy']()[_0x726a('0x24')](function(){_0x5cee19[_0x726a('0x19')](0xcc)[_0x726a('0x1a')]();});}};}function handleEntityNotFound(_0x374509,_0x673604){return function(_0x349ab9){if(!_0x349ab9){_0x374509[_0x726a('0x18')](0x194);}return _0x349ab9;};}function handleError(_0x246344,_0xb79f80){_0xb79f80=_0xb79f80||0x1f4;return function(_0x480a7b){logger[_0x726a('0x25')](_0x480a7b[_0x726a('0x26')]);if(_0x480a7b[_0x726a('0x27')]){delete _0x480a7b['name'];}_0x246344[_0x726a('0x19')](_0xb79f80)['send'](_0x480a7b);};}exports['index']=function(_0x31bc73,_0x4e87e6){var _0x32ba68={},_0x4c8fc3={},_0x5de056={'count':0x0,'rows':[]};var _0x27cf54=_[_0x726a('0x28')](db[_0x726a('0x29')][_0x726a('0x2a')],function(_0x53220d){return{'name':_0x53220d['fieldName'],'type':_0x53220d[_0x726a('0x2b')][_0x726a('0x2c')]};});_0x4c8fc3[_0x726a('0x2d')]=_[_0x726a('0x28')](_0x27cf54,_0x726a('0x27'));_0x4c8fc3[_0x726a('0x2e')]=_[_0x726a('0x2f')](_0x31bc73['query']);_0x4c8fc3['filters']=_[_0x726a('0x30')](_0x4c8fc3['model'],_0x4c8fc3[_0x726a('0x2e')]);_0x32ba68[_0x726a('0x31')]=_[_0x726a('0x30')](_0x4c8fc3[_0x726a('0x2d')],qs[_0x726a('0x32')](_0x31bc73[_0x726a('0x2e')]['fields']));_0x32ba68[_0x726a('0x31')]=_0x32ba68[_0x726a('0x31')][_0x726a('0x33')]?_0x32ba68['attributes']:_0x4c8fc3[_0x726a('0x2d')];if(!_0x31bc73['query'][_0x726a('0x34')](_0x726a('0x35'))){_0x32ba68['limit']=qs[_0x726a('0x1d')](_0x31bc73['query'][_0x726a('0x1d')]);_0x32ba68[_0x726a('0x1c')]=qs[_0x726a('0x1c')](_0x31bc73[_0x726a('0x2e')][_0x726a('0x1c')]);}_0x32ba68[_0x726a('0x36')]=qs[_0x726a('0x37')](_0x31bc73[_0x726a('0x2e')][_0x726a('0x37')]);_0x32ba68[_0x726a('0x38')]=qs[_0x726a('0x39')](_[_0x726a('0x3a')](_0x31bc73[_0x726a('0x2e')],_0x4c8fc3[_0x726a('0x39')]),_0x27cf54);if(_0x31bc73[_0x726a('0x2e')][_0x726a('0x3b')]){_0x32ba68['where']=_[_0x726a('0x3c')](_0x32ba68[_0x726a('0x38')],{'$or':_[_0x726a('0x28')](_0x27cf54,function(_0x19cff3){if(_0x19cff3[_0x726a('0x2b')]!==_0x726a('0x3d')){var _0x12c91f={};_0x12c91f[_0x19cff3[_0x726a('0x27')]]={'$like':'%'+_0x31bc73[_0x726a('0x2e')]['filter']+'%'};return _0x12c91f;}})});}_0x32ba68=_['merge']({},_0x32ba68,_0x31bc73[_0x726a('0x3e')]);var _0x1948c5={'where':_0x32ba68[_0x726a('0x38')]};return db[_0x726a('0x29')][_0x726a('0x1e')](_0x1948c5)['then'](function(_0x4450cc){_0x5de056[_0x726a('0x1e')]=_0x4450cc;if(_0x31bc73[_0x726a('0x2e')][_0x726a('0x3f')]){_0x32ba68[_0x726a('0x40')]=[{'all':!![]}];}return db[_0x726a('0x29')]['findAll'](_0x32ba68);})['then'](function(_0xbc524f){_0x5de056[_0x726a('0x41')]=_0xbc524f;return _0x5de056;})[_0x726a('0x24')](respondWithFilteredResult(_0x4e87e6,_0x32ba68))[_0x726a('0x42')](handleError(_0x4e87e6,null));};exports['show']=function(_0x29b588,_0x179ded){var _0x19a8ab={'raw':!![],'where':{'id':_0x29b588[_0x726a('0x43')]['id']}},_0x4dd6b7={};_0x4dd6b7[_0x726a('0x2d')]=_['keys'](db[_0x726a('0x29')][_0x726a('0x2a')]);_0x4dd6b7[_0x726a('0x2e')]=_[_0x726a('0x2f')](_0x29b588[_0x726a('0x2e')]);_0x4dd6b7[_0x726a('0x39')]=_[_0x726a('0x30')](_0x4dd6b7[_0x726a('0x2d')],_0x4dd6b7['query']);_0x19a8ab[_0x726a('0x31')]=_[_0x726a('0x30')](_0x4dd6b7[_0x726a('0x2d')],qs[_0x726a('0x32')](_0x29b588['query'][_0x726a('0x32')]));_0x19a8ab['attributes']=_0x19a8ab['attributes'][_0x726a('0x33')]?_0x19a8ab[_0x726a('0x31')]:_0x4dd6b7[_0x726a('0x2d')];if(_0x29b588[_0x726a('0x2e')][_0x726a('0x3f')]){_0x19a8ab['include']=[{'all':!![]}];}_0x19a8ab=_[_0x726a('0x3c')]({},_0x19a8ab,_0x29b588['options']);return db[_0x726a('0x29')][_0x726a('0x44')](_0x19a8ab)[_0x726a('0x24')](handleEntityNotFound(_0x179ded,null))[_0x726a('0x24')](respondWithResult(_0x179ded,null))['catch'](handleError(_0x179ded,null));};exports[_0x726a('0x45')]=function(_0x4ce45f,_0x3255a6){return db[_0x726a('0x29')]['create'](_0x4ce45f[_0x726a('0x46')],{})['then'](respondWithResult(_0x3255a6,0xc9))['catch'](handleError(_0x3255a6,null));};exports[_0x726a('0x23')]=function(_0x1dfac0,_0x582c55){if(_0x1dfac0[_0x726a('0x46')]['id']){delete _0x1dfac0[_0x726a('0x46')]['id'];}return db['FaxApplication'][_0x726a('0x44')]({'where':{'id':_0x1dfac0[_0x726a('0x43')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x582c55,null))[_0x726a('0x24')](saveUpdates(_0x1dfac0[_0x726a('0x46')],null))[_0x726a('0x24')](respondWithResult(_0x582c55,null))[_0x726a('0x42')](handleError(_0x582c55,null));};exports[_0x726a('0x47')]=function(_0x28110a,_0x33765a){return db[_0x726a('0x29')][_0x726a('0x44')]({'where':{'id':_0x28110a[_0x726a('0x43')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x33765a,null))['then'](removeEntity(_0x33765a,null))[_0x726a('0x42')](handleError(_0x33765a,null));}; \ No newline at end of file +var _0x6333=['where','pick','filters','filter','VIRTUAL','merge','options','include','findAll','catch','params','rawAttributes','intersection','length','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','FaxApplication','type','key','model','map','query','keys','fields','attributes','order','sort'];(function(_0x4e058c,_0x4d2bf7){var _0x4f19c8=function(_0x58b4c7){while(--_0x58b4c7){_0x4e058c['push'](_0x4e058c['shift']());}};_0x4f19c8(++_0x4d2bf7);}(_0x6333,0x1a4));var _0x3633=function(_0x8cfc5e,_0x1f6ce1){_0x8cfc5e=_0x8cfc5e-0x0;var _0x223e00=_0x6333[_0x8cfc5e];return _0x223e00;};'use strict';var emlformat=require(_0x3633('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3633('0x1'));var jsonpatch=require(_0x3633('0x2'));var rp=require(_0x3633('0x3'));var moment=require(_0x3633('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3633('0x5'));var path=require(_0x3633('0x6'));var sox=require(_0x3633('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3633('0x8'));var _=require('lodash');var squel=require(_0x3633('0x9'));var crypto=require(_0x3633('0xa'));var jsforce=require(_0x3633('0xb'));var deskjs=require(_0x3633('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3633('0xd'));var Papa=require(_0x3633('0xe'));var Redis=require(_0x3633('0xf'));var authService=require(_0x3633('0x10'));var qs=require(_0x3633('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3633('0x12'));var config=require(_0x3633('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x265946,_0x29b73a){_0x29b73a=_0x29b73a||0xcc;return function(_0x47fc07){if(_0x47fc07){return _0x265946['sendStatus'](_0x29b73a);}return _0x265946[_0x3633('0x14')](_0x29b73a)[_0x3633('0x15')]();};}function respondWithResult(_0x5aef37,_0x459856){_0x459856=_0x459856||0xc8;return function(_0x1b2b00){if(_0x1b2b00){return _0x5aef37['status'](_0x459856)[_0x3633('0x16')](_0x1b2b00);}};}function respondWithFilteredResult(_0x208e0f,_0x259670){return function(_0x450c51){if(_0x450c51){var _0x3087f6=typeof _0x259670['offset']===_0x3633('0x17')&&typeof _0x259670[_0x3633('0x18')]===_0x3633('0x17');var _0x93f528=_0x450c51[_0x3633('0x19')];var _0x5c8e8d=_0x3087f6?0x0:_0x259670[_0x3633('0x1a')];var _0x530a90=_0x3087f6?_0x450c51[_0x3633('0x19')]:_0x259670[_0x3633('0x1a')]+_0x259670[_0x3633('0x18')];var _0x4c758e;if(_0x530a90>=_0x93f528){_0x530a90=_0x93f528;_0x4c758e=0xc8;}else{_0x4c758e=0xce;}_0x208e0f['status'](_0x4c758e);return _0x208e0f[_0x3633('0x1b')](_0x3633('0x1c'),_0x5c8e8d+'-'+_0x530a90+'/'+_0x93f528)[_0x3633('0x16')](_0x450c51);}return null;};}function patchUpdates(_0x44caa4){return function(_0x1b7dff){try{jsonpatch['apply'](_0x1b7dff,_0x44caa4,!![]);}catch(_0x502791){return BPromise['reject'](_0x502791);}return _0x1b7dff[_0x3633('0x1d')]();};}function saveUpdates(_0x4b8707,_0x305d93){return function(_0x3db5f8){if(_0x3db5f8){return _0x3db5f8[_0x3633('0x1e')](_0x4b8707)[_0x3633('0x1f')](function(_0x561910){return _0x561910;});}return null;};}function removeEntity(_0x198b1f,_0x235828){return function(_0x497d6e){if(_0x497d6e){return _0x497d6e[_0x3633('0x20')]()['then'](function(){_0x198b1f[_0x3633('0x14')](0xcc)[_0x3633('0x15')]();});}};}function handleEntityNotFound(_0x7b1691,_0xa2dd1a){return function(_0x2fbfeb){if(!_0x2fbfeb){_0x7b1691[_0x3633('0x21')](0x194);}return _0x2fbfeb;};}function handleError(_0x2c9338,_0x51fa48){_0x51fa48=_0x51fa48||0x1f4;return function(_0x142b24){logger[_0x3633('0x22')](_0x142b24[_0x3633('0x23')]);if(_0x142b24[_0x3633('0x24')]){delete _0x142b24[_0x3633('0x24')];}_0x2c9338['status'](_0x51fa48)[_0x3633('0x25')](_0x142b24);};}exports['index']=function(_0xd01718,_0x2c29fb){var _0xf3a15c={},_0xa9150f={},_0x58016b={'count':0x0,'rows':[]};var _0x258ee6=_['map'](db[_0x3633('0x26')]['rawAttributes'],function(_0x205eb8){return{'name':_0x205eb8['fieldName'],'type':_0x205eb8[_0x3633('0x27')][_0x3633('0x28')]};});_0xa9150f[_0x3633('0x29')]=_[_0x3633('0x2a')](_0x258ee6,_0x3633('0x24'));_0xa9150f[_0x3633('0x2b')]=_[_0x3633('0x2c')](_0xd01718[_0x3633('0x2b')]);_0xa9150f['filters']=_['intersection'](_0xa9150f[_0x3633('0x29')],_0xa9150f[_0x3633('0x2b')]);_0xf3a15c['attributes']=_['intersection'](_0xa9150f[_0x3633('0x29')],qs[_0x3633('0x2d')](_0xd01718[_0x3633('0x2b')][_0x3633('0x2d')]));_0xf3a15c[_0x3633('0x2e')]=_0xf3a15c[_0x3633('0x2e')]['length']?_0xf3a15c[_0x3633('0x2e')]:_0xa9150f[_0x3633('0x29')];if(!_0xd01718['query']['hasOwnProperty']('nolimit')){_0xf3a15c[_0x3633('0x18')]=qs[_0x3633('0x18')](_0xd01718['query'][_0x3633('0x18')]);_0xf3a15c[_0x3633('0x1a')]=qs[_0x3633('0x1a')](_0xd01718[_0x3633('0x2b')][_0x3633('0x1a')]);}_0xf3a15c[_0x3633('0x2f')]=qs['sort'](_0xd01718[_0x3633('0x2b')][_0x3633('0x30')]);_0xf3a15c[_0x3633('0x31')]=qs['filters'](_[_0x3633('0x32')](_0xd01718[_0x3633('0x2b')],_0xa9150f[_0x3633('0x33')]),_0x258ee6);if(_0xd01718[_0x3633('0x2b')][_0x3633('0x34')]){_0xf3a15c[_0x3633('0x31')]=_['merge'](_0xf3a15c[_0x3633('0x31')],{'$or':_[_0x3633('0x2a')](_0x258ee6,function(_0x396c62){if(_0x396c62[_0x3633('0x27')]!==_0x3633('0x35')){var _0x5c316f={};_0x5c316f[_0x396c62[_0x3633('0x24')]]={'$like':'%'+_0xd01718['query'][_0x3633('0x34')]+'%'};return _0x5c316f;}})});}_0xf3a15c=_[_0x3633('0x36')]({},_0xf3a15c,_0xd01718[_0x3633('0x37')]);var _0x431af5={'where':_0xf3a15c['where']};return db['FaxApplication'][_0x3633('0x19')](_0x431af5)[_0x3633('0x1f')](function(_0x4443c9){_0x58016b['count']=_0x4443c9;if(_0xd01718[_0x3633('0x2b')]['includeAll']){_0xf3a15c[_0x3633('0x38')]=[{'all':!![]}];}return db[_0x3633('0x26')][_0x3633('0x39')](_0xf3a15c);})[_0x3633('0x1f')](function(_0x3485cd){_0x58016b['rows']=_0x3485cd;return _0x58016b;})[_0x3633('0x1f')](respondWithFilteredResult(_0x2c29fb,_0xf3a15c))[_0x3633('0x3a')](handleError(_0x2c29fb,null));};exports['show']=function(_0x50ed2a,_0x1068fc){var _0x16d217={'raw':!![],'where':{'id':_0x50ed2a[_0x3633('0x3b')]['id']}},_0x232114={};_0x232114[_0x3633('0x29')]=_[_0x3633('0x2c')](db['FaxApplication'][_0x3633('0x3c')]);_0x232114[_0x3633('0x2b')]=_[_0x3633('0x2c')](_0x50ed2a[_0x3633('0x2b')]);_0x232114[_0x3633('0x33')]=_[_0x3633('0x3d')](_0x232114[_0x3633('0x29')],_0x232114['query']);_0x16d217[_0x3633('0x2e')]=_[_0x3633('0x3d')](_0x232114[_0x3633('0x29')],qs['fields'](_0x50ed2a['query']['fields']));_0x16d217['attributes']=_0x16d217[_0x3633('0x2e')][_0x3633('0x3e')]?_0x16d217['attributes']:_0x232114['model'];if(_0x50ed2a[_0x3633('0x2b')][_0x3633('0x3f')]){_0x16d217[_0x3633('0x38')]=[{'all':!![]}];}_0x16d217=_[_0x3633('0x36')]({},_0x16d217,_0x50ed2a[_0x3633('0x37')]);return db[_0x3633('0x26')]['find'](_0x16d217)['then'](handleEntityNotFound(_0x1068fc,null))[_0x3633('0x1f')](respondWithResult(_0x1068fc,null))[_0x3633('0x3a')](handleError(_0x1068fc,null));};exports[_0x3633('0x40')]=function(_0x548a76,_0x3cefac){return db[_0x3633('0x26')][_0x3633('0x40')](_0x548a76[_0x3633('0x41')],{})[_0x3633('0x1f')](respondWithResult(_0x3cefac,0xc9))[_0x3633('0x3a')](handleError(_0x3cefac,null));};exports[_0x3633('0x1e')]=function(_0x309dd1,_0x502d2d){if(_0x309dd1[_0x3633('0x41')]['id']){delete _0x309dd1[_0x3633('0x41')]['id'];}return db['FaxApplication'][_0x3633('0x42')]({'where':{'id':_0x309dd1['params']['id']}})[_0x3633('0x1f')](handleEntityNotFound(_0x502d2d,null))[_0x3633('0x1f')](saveUpdates(_0x309dd1[_0x3633('0x41')],null))[_0x3633('0x1f')](respondWithResult(_0x502d2d,null))[_0x3633('0x3a')](handleError(_0x502d2d,null));};exports[_0x3633('0x20')]=function(_0x10f405,_0x269f85){return db[_0x3633('0x26')][_0x3633('0x42')]({'where':{'id':_0x10f405[_0x3633('0x3b')]['id']}})['then'](handleEntityNotFound(_0x269f85,null))[_0x3633('0x1f')](removeEntity(_0x269f85,null))['catch'](handleError(_0x269f85,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f3bd6dd..056efc8 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 _0xea68=['rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2dd8e8,_0x40e2ac){var _0x5a0c20=function(_0x572fce){while(--_0x572fce){_0x2dd8e8['push'](_0x2dd8e8['shift']());}};_0x5a0c20(++_0x40e2ac);}(_0xea68,0x78));var _0x8ea6=function(_0x3e3cdb,_0x556cd1){_0x3e3cdb=_0x3e3cdb-0x0;var _0x3a31b1=_0xea68[_0x3e3cdb];return _0x3a31b1;};'use strict';var _=require(_0x8ea6('0x0'));var util=require(_0x8ea6('0x1'));var logger=require(_0x8ea6('0x2'))('api');var moment=require(_0x8ea6('0x3'));var BPromise=require(_0x8ea6('0x4'));var rp=require(_0x8ea6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ea6('0x6'));var config=require('../../config/environment');var attributes=require(_0x8ea6('0x7'));module[_0x8ea6('0x8')]=function(_0x23ee7b,_0x4871cf){return _0x23ee7b[_0x8ea6('0x9')](_0x8ea6('0xa'),attributes,{'tableName':_0x8ea6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ea6('0xc'),'collate':_0x8ea6('0xd')});}; \ No newline at end of file +var _0x9d6a=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./faxApplication.attributes','define','fax_applications'];(function(_0xf7688b,_0x19c612){var _0x206d86=function(_0x2d34aa){while(--_0x2d34aa){_0xf7688b['push'](_0xf7688b['shift']());}};_0x206d86(++_0x19c612);}(_0x9d6a,0x13a));var _0xa9d6=function(_0x19eab7,_0xe62e9b){_0x19eab7=_0x19eab7-0x0;var _0x493daf=_0x9d6a[_0x19eab7];return _0x493daf;};'use strict';var _=require(_0xa9d6('0x0'));var util=require(_0xa9d6('0x1'));var logger=require(_0xa9d6('0x2'))(_0xa9d6('0x3'));var moment=require(_0xa9d6('0x4'));var BPromise=require(_0xa9d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9d6('0x6'));var rimraf=require(_0xa9d6('0x7'));var config=require('../../config/environment');var attributes=require(_0xa9d6('0x8'));module['exports']=function(_0xf9e980,_0x2b6b07){return _0xf9e980[_0xa9d6('0x9')]('FaxApplication',attributes,{'tableName':_0xa9d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa9d6('0xb'),'collate':_0xa9d6('0xc')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 78406b0..067e20b 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 _0x97f7=['jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','FaxApplication','update','body','options','raw','where','attributes','limit','UpdateFaxApplication','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x453e53,_0x330fd8){var _0x147e21=function(_0x5dfacf){while(--_0x5dfacf){_0x453e53['push'](_0x453e53['shift']());}};_0x147e21(++_0x330fd8);}(_0x97f7,0x10f));var _0x797f=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x97f7[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x797f('0x0'));var util=require(_0x797f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x797f('0x2'));var db=require(_0x797f('0x3'))['db'];var utils=require(_0x797f('0x4'));var logger=require(_0x797f('0x5'))(_0x797f('0x6'));var config=require(_0x797f('0x7'));var jayson=require(_0x797f('0x8'));var client=jayson[_0x797f('0x9')][_0x797f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x24742a,_0x2c05d1,_0x41caee){return new BPromise(function(_0x1dbb36,_0x32e1f3){return client[_0x797f('0xb')](_0x24742a,_0x41caee)[_0x797f('0xc')](function(_0x23f2d1){logger['info'](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));logger[_0x797f('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2c05d1,_0x797f('0xe'),JSON['stringify'](_0x23f2d1));if(_0x23f2d1[_0x797f('0x10')]){if(_0x23f2d1[_0x797f('0x10')][_0x797f('0x11')]===0x1f4){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')]['message']);return _0x32e1f3(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}logger['error'](_0x797f('0xd'),_0x2c05d1,_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);return _0x1dbb36(_0x23f2d1[_0x797f('0x10')][_0x797f('0x12')]);}else{logger[_0x797f('0x13')](_0x797f('0xd'),_0x2c05d1,_0x797f('0xe'));_0x1dbb36(_0x23f2d1[_0x797f('0x14')][_0x797f('0x12')]);}})[_0x797f('0x15')](function(_0x3a48d2){logger[_0x797f('0x10')](_0x797f('0xd'),_0x2c05d1,_0x3a48d2);_0x32e1f3(_0x3a48d2);});});}exports['UpdateFaxApplication']=function(_0x164fe7){var _0x1c04f5=this;return new Promise(function(_0x430819,_0x578cac){return db[_0x797f('0x16')][_0x797f('0x17')](_0x164fe7[_0x797f('0x18')],{'raw':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1b')]||null:null,'attributes':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1c')]||null:null,'limit':_0x164fe7[_0x797f('0x19')]?_0x164fe7[_0x797f('0x19')][_0x797f('0x1d')]||null:null})['then'](function(_0x2f462b){logger[_0x797f('0x13')](_0x797f('0x1e'),_0x164fe7);logger['debug'](_0x797f('0x1e'),_0x164fe7,JSON['stringify'](_0x2f462b));_0x430819(_0x2f462b);})[_0x797f('0x15')](function(_0x35b37f){logger[_0x797f('0x10')]('UpdateFaxApplication',_0x35b37f[_0x797f('0x12')],_0x164fe7);_0x578cac(_0x1c04f5[_0x797f('0x10')](0x1f4,_0x35b37f[_0x797f('0x12')]));});});}; \ No newline at end of file +var _0x7e17=['jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FaxApplication','update','body','options','attributes','UpdateFaxApplication','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x37b32b,_0x4e2e24){var _0x4c1bd3=function(_0x5e7643){while(--_0x5e7643){_0x37b32b['push'](_0x37b32b['shift']());}};_0x4c1bd3(++_0x4e2e24);}(_0x7e17,0x89));var _0x77e1=function(_0x51bdda,_0x5666ca){_0x51bdda=_0x51bdda-0x0;var _0x998aab=_0x7e17[_0x51bdda];return _0x998aab;};'use strict';var _=require('lodash');var util=require(_0x77e1('0x0'));var moment=require(_0x77e1('0x1'));var BPromise=require(_0x77e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77e1('0x3'));var db=require(_0x77e1('0x4'))['db'];var utils=require(_0x77e1('0x5'));var logger=require(_0x77e1('0x6'))(_0x77e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x77e1('0x8'));var client=jayson[_0x77e1('0x9')][_0x77e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ac40,_0x1e015c,_0x517836){return new BPromise(function(_0x695c74,_0x1261ee){return client[_0x77e1('0xb')](_0x13ac40,_0x517836)[_0x77e1('0xc')](function(_0x5c6f66){logger[_0x77e1('0xd')](_0x77e1('0xe'),_0x1e015c,_0x77e1('0xf'));logger[_0x77e1('0x10')](_0x77e1('0x11'),_0x1e015c,_0x77e1('0xf'),JSON[_0x77e1('0x12')](_0x5c6f66));if(_0x5c6f66['error']){if(_0x5c6f66[_0x77e1('0x13')]['code']===0x1f4){logger[_0x77e1('0x13')]('FaxApplication,\x20%s,\x20%s',_0x1e015c,_0x5c6f66['error'][_0x77e1('0x14')]);return _0x1261ee(_0x5c6f66[_0x77e1('0x13')][_0x77e1('0x14')]);}logger['error'](_0x77e1('0xe'),_0x1e015c,_0x5c6f66[_0x77e1('0x13')][_0x77e1('0x14')]);return _0x695c74(_0x5c6f66[_0x77e1('0x13')][_0x77e1('0x14')]);}else{logger['info'](_0x77e1('0xe'),_0x1e015c,_0x77e1('0xf'));_0x695c74(_0x5c6f66[_0x77e1('0x15')][_0x77e1('0x14')]);}})[_0x77e1('0x16')](function(_0x37af1e){logger[_0x77e1('0x13')](_0x77e1('0xe'),_0x1e015c,_0x37af1e);_0x1261ee(_0x37af1e);});});}exports['UpdateFaxApplication']=function(_0x59b306){var _0x2c50cf=this;return new Promise(function(_0x1ca9a6,_0x1181f3){return db[_0x77e1('0x17')][_0x77e1('0x18')](_0x59b306[_0x77e1('0x19')],{'raw':_0x59b306[_0x77e1('0x1a')]?_0x59b306[_0x77e1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59b306[_0x77e1('0x1a')]?_0x59b306[_0x77e1('0x1a')]['where']||null:null,'attributes':_0x59b306[_0x77e1('0x1a')]?_0x59b306[_0x77e1('0x1a')][_0x77e1('0x1b')]||null:null,'limit':_0x59b306[_0x77e1('0x1a')]?_0x59b306['options']['limit']||null:null})['then'](function(_0x340288){logger[_0x77e1('0xd')](_0x77e1('0x1c'),_0x59b306);logger['debug'](_0x77e1('0x1c'),_0x59b306,JSON[_0x77e1('0x12')](_0x340288));_0x1ca9a6(_0x340288);})['catch'](function(_0x321ad3){logger['error'](_0x77e1('0x1c'),_0x321ad3[_0x77e1('0x14')],_0x59b306);_0x1181f3(_0x2c50cf[_0x77e1('0x13')](0x1f4,_0x321ad3[_0x77e1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 3a8d291..0c16f7c 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 _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x1b10d0,_0x48b73b){var _0x3c1a27=function(_0x198678){while(--_0x198678){_0x1b10d0['push'](_0x1b10d0['shift']());}};_0x3c1a27(++_0x48b73b);}(_0x9c00,0x1a0));var _0x09c0=function(_0x30a2b4,_0x2fe7b3){_0x30a2b4=_0x30a2b4-0x0;var _0x1b2bef=_0x9c00[_0x30a2b4];return _0x1b2bef;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x21db0d,_0x1a199e){var _0x5a940f=function(_0x44ec0a){while(--_0x44ec0a){_0x21db0d['push'](_0x21db0d['shift']());}};_0x5a940f(++_0x1a199e);}(_0xac4a,0x13f));var _0xaac4=function(_0x33459c,_0x8a4d2b){_0x33459c=_0x33459c-0x0;var _0x28624c=_0xac4a[_0x33459c];return _0x28624c;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 7ad7bfa..3d2421c 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 _0x025a=['STRING','DATE','ENUM','out','exports','BOOLEAN'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0x025a,0x16c));var _0xa025=function(_0xe1269d,_0x57b7c3){_0xe1269d=_0xe1269d-0x0;var _0x261ca1=_0x025a[_0xe1269d];return _0x261ca1;};'use strict';var Sequelize=require('sequelize');module[_0xa025('0x0')]={'closed':{'type':Sequelize[_0xa025('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa025('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa025('0x2')]},'read1stAt':{'type':Sequelize[_0xa025('0x3')]},'fax':{'type':Sequelize[_0xa025('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xa025('0x4')]('in',_0xa025('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa025('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa025('0x4')]('in',_0xa025('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x9e8a=['BOOLEAN','DATE','STRING','ENUM','out','exports'];(function(_0x154ff2,_0x439ff5){var _0x29a3b8=function(_0xeeb38c){while(--_0xeeb38c){_0x154ff2['push'](_0x154ff2['shift']());}};_0x29a3b8(++_0x439ff5);}(_0x9e8a,0x1cd));var _0xa9e8=function(_0x2c4c3e,_0x380a36){_0x2c4c3e=_0x2c4c3e-0x0;var _0x4a652b=_0x9e8a[_0x2c4c3e];return _0x4a652b;};'use strict';var Sequelize=require('sequelize');module[_0xa9e8('0x0')]={'closed':{'type':Sequelize[_0xa9e8('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa9e8('0x2')]},'disposition':{'type':Sequelize[_0xa9e8('0x3')]},'secondDisposition':{'type':Sequelize[_0xa9e8('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa9e8('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa9e8('0x2')]},'fax':{'type':Sequelize[_0xa9e8('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa9e8('0x4')]('in',_0xa9e8('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xa9e8('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 15b2b01..3bcbc39 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 _0x3a72=['name','send','index','map','FaxInteraction','findAll','fax','query','user','catch','show','params','rawAttributes','filters','intersection','model','fields','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','FaxMessage','ids','omit','getMessages','keys','order','sort','where','pick','FaxInteractionId','filter','$gte','split','format','options','rows','setTags','spread','Tag','emit','faxInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','Attachment','createdAt','Messages','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','basename','resolve','download','unlinkSync','zip-dir','moment','bluebird','path','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x3a72,0x10f));var _0x23a7=function(_0x5d6200,_0x184f0f){_0x5d6200=_0x5d6200-0x0;var _0x3a5b83=_0x3a72[_0x5d6200];return _0x3a5b83;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x23a7('0x0'));var moment=require(_0x23a7('0x1'));var BPromise=require(_0x23a7('0x2'));var util=require('util');var path=require(_0x23a7('0x3'));var fs=require('fs');var _=require(_0x23a7('0x4'));var Redis=require('ioredis');var interaction=require(_0x23a7('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x23a7('0x6'))(_0x23a7('0x7'));var config=require(_0x23a7('0x8'));var db=require(_0x23a7('0x9'))['db'];config[_0x23a7('0xa')]=_[_0x23a7('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x23a7('0xc'))(new Redis(config[_0x23a7('0xa')]));require(_0x23a7('0xd'))[_0x23a7('0xe')](socket);function respondWithStatusCode(_0x37d194,_0x3326fb){_0x3326fb=_0x3326fb||0xcc;return function(_0x2ea2fe){if(_0x2ea2fe){return _0x37d194[_0x23a7('0xf')](_0x3326fb);}return _0x37d194['status'](_0x3326fb)['end']();};}function respondWithResult(_0x6cd93c,_0x1aa719){_0x1aa719=_0x1aa719||0xc8;return function(_0x52fdca){if(_0x52fdca){return _0x6cd93c[_0x23a7('0x10')](_0x1aa719)[_0x23a7('0x11')](_0x52fdca);}};}function respondWithFilteredResult(_0x46b279,_0xf92d15){return function(_0x482563){if(_0x482563){var _0x389a2f=typeof _0xf92d15[_0x23a7('0x12')]===_0x23a7('0x13')&&typeof _0xf92d15['limit']===_0x23a7('0x13');var _0x4ac350=_0x482563[_0x23a7('0x14')];var _0x9318ac=_0x389a2f?0x0:_0xf92d15['offset'];var _0x418fbf=_0x389a2f?_0x482563[_0x23a7('0x14')]:_0xf92d15[_0x23a7('0x12')]+_0xf92d15[_0x23a7('0x15')];var _0x19dd3f;if(_0x418fbf>=_0x4ac350){_0x418fbf=_0x4ac350;_0x19dd3f=0xc8;}else{_0x19dd3f=0xce;}_0x46b279[_0x23a7('0x10')](_0x19dd3f);return _0x46b279[_0x23a7('0x16')](_0x23a7('0x17'),_0x9318ac+'-'+_0x418fbf+'/'+_0x4ac350)[_0x23a7('0x11')](_0x482563);}return null;};}function saveUpdates(_0x363f5a){return function(_0x51b414){if(_0x51b414){return _0x51b414[_0x23a7('0x18')](_0x363f5a)[_0x23a7('0x19')](function(_0x3ad77c){return _0x3ad77c;});}return null;};}function removeEntity(_0x3ff3ff){return function(_0x186f96){if(_0x186f96){return _0x186f96[_0x23a7('0x1a')]()[_0x23a7('0x19')](function(){_0x3ff3ff[_0x23a7('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d60d9){return function(_0x2e1546){if(!_0x2e1546){_0x4d60d9[_0x23a7('0xf')](0x194);}return _0x2e1546;};}function handleError(_0x12c5b4,_0x791bbd){_0x791bbd=_0x791bbd||0x1f4;return function(_0x8b976b){logger[_0x23a7('0x1b')](_0x8b976b[_0x23a7('0x1c')]);if(_0x8b976b[_0x23a7('0x1d')]){delete _0x8b976b[_0x23a7('0x1d')];}_0x12c5b4['status'](_0x791bbd)[_0x23a7('0x1e')](_0x8b976b);};}exports[_0x23a7('0x1f')]=function(_0x4e5e89,_0x49307d){var _0x364ea7={};var _0x1c0a12=_[_0x23a7('0x20')](db[_0x23a7('0x21')]['rawAttributes'],function(_0x25b5fc){return{'name':_0x25b5fc['fieldName'],'type':_0x25b5fc['type']['key']};});_0x364ea7=qs['getOptions'](_0x1c0a12,_0x4e5e89);return interaction[_0x23a7('0x22')](_0x23a7('0x23'),_0x4e5e89[_0x23a7('0x24')],_0x4e5e89[_0x23a7('0x25')],_0x364ea7,_0x1c0a12)['then'](respondWithFilteredResult(_0x49307d,_0x364ea7))[_0x23a7('0x26')](handleError(_0x49307d,null));};exports[_0x23a7('0x27')]=function(_0x273fb1,_0x227a74){var _0x44e88c={'raw':![],'where':{'id':_0x273fb1[_0x23a7('0x28')]['id']}},_0x1ece13={};_0x1ece13['model']=_['keys'](db['FaxInteraction'][_0x23a7('0x29')]);_0x1ece13[_0x23a7('0x24')]=_['keys'](_0x273fb1[_0x23a7('0x24')]);_0x1ece13[_0x23a7('0x2a')]=_[_0x23a7('0x2b')](_0x1ece13[_0x23a7('0x2c')],_0x1ece13[_0x23a7('0x24')]);_0x44e88c['attributes']=_['intersection'](_0x1ece13[_0x23a7('0x2c')],qs['fields'](_0x273fb1[_0x23a7('0x24')][_0x23a7('0x2d')]));_0x44e88c['attributes']=_0x44e88c[_0x23a7('0x2e')][_0x23a7('0x2f')]?_0x44e88c[_0x23a7('0x2e')]:_0x1ece13['model'];if(_0x273fb1[_0x23a7('0x24')][_0x23a7('0x30')]){_0x44e88c[_0x23a7('0x31')]=[{'all':!![]}];}_0x44e88c=_[_0x23a7('0x32')]({},_0x44e88c,_0x273fb1['options']);return db[_0x23a7('0x21')][_0x23a7('0x33')](_0x44e88c)[_0x23a7('0x19')](handleEntityNotFound(_0x227a74,null))['then'](respondWithResult(_0x227a74,null))[_0x23a7('0x26')](handleError(_0x227a74,null));};exports[_0x23a7('0x34')]=function(_0x343ffa,_0x5cb29b){return db['FaxInteraction'][_0x23a7('0x34')](_0x343ffa[_0x23a7('0x35')],{})[_0x23a7('0x19')](respondWithResult(_0x5cb29b,0xc9))[_0x23a7('0x26')](handleError(_0x5cb29b,null));};exports['update']=function(_0x4598ec,_0x289387){if(_0x4598ec['body']['id']){delete _0x4598ec['body']['id'];}return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x4598ec[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x289387,null))['then'](saveUpdates(_0x4598ec[_0x23a7('0x35')],null))[_0x23a7('0x19')](respondWithResult(_0x289387,null))[_0x23a7('0x26')](handleError(_0x289387,null));};exports[_0x23a7('0x1a')]=function(_0x458249,_0x114042){return db['FaxInteraction']['find']({'where':{'id':_0x458249[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x114042,null))['then'](removeEntity(_0x114042,null))['catch'](handleError(_0x114042,null));};exports[_0x23a7('0x36')]=function(_0x244241,_0x28edb4){return db['FaxInteraction'][_0x23a7('0x36')]()[_0x23a7('0x19')](respondWithResult(_0x28edb4,null))[_0x23a7('0x26')](handleError(_0x28edb4,null));};exports[_0x23a7('0x37')]=function(_0x113c58,_0x5e5148){return db[_0x23a7('0x38')][_0x23a7('0x33')]({'where':{'id':_0x113c58[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x5e5148,null))[_0x23a7('0x19')](function(_0x214954){if(_0x214954){return _0x214954[_0x23a7('0x37')](_0x113c58[_0x23a7('0x35')][_0x23a7('0x39')],_[_0x23a7('0x3a')](_0x113c58[_0x23a7('0x35')],[_0x23a7('0x39'),'id'])||{});}})['then'](respondWithResult(_0x5e5148,null))['catch'](handleError(_0x5e5148,null));};exports[_0x23a7('0x3b')]=function(_0x1af2cc,_0x5d5e47){var _0x18cbad={'raw':![],'where':{}};var _0x202907={};var _0x31de2a={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x1af2cc[_0x23a7('0x28')]['id']}})[_0x23a7('0x19')](handleEntityNotFound(_0x5d5e47,null))[_0x23a7('0x19')](function(_0x33261f){if(_0x33261f){_0x202907[_0x23a7('0x2c')]=_[_0x23a7('0x3c')](db[_0x23a7('0x38')]['rawAttributes']);_0x202907['query']=_[_0x23a7('0x3c')](_0x1af2cc[_0x23a7('0x24')]);_0x202907[_0x23a7('0x2a')]=_[_0x23a7('0x2b')](_0x202907[_0x23a7('0x2c')],_0x202907[_0x23a7('0x24')]);_0x18cbad[_0x23a7('0x2e')]=_['intersection'](_0x202907[_0x23a7('0x2c')],qs[_0x23a7('0x2d')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x2d')]));_0x18cbad[_0x23a7('0x2e')]=_0x18cbad[_0x23a7('0x2e')]['length']?_0x18cbad[_0x23a7('0x2e')]:_0x202907['model'];if(!_0x1af2cc['query']['hasOwnProperty']('nolimit')){_0x18cbad['limit']=qs[_0x23a7('0x15')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x15')]);_0x18cbad['offset']=qs[_0x23a7('0x12')](_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x12')]);}_0x18cbad[_0x23a7('0x3d')]=qs['sort'](_0x1af2cc['query'][_0x23a7('0x3e')]);_0x18cbad[_0x23a7('0x3f')]=qs[_0x23a7('0x2a')](_[_0x23a7('0x40')](_0x1af2cc[_0x23a7('0x24')],_0x202907[_0x23a7('0x2a')]));_0x18cbad[_0x23a7('0x3f')][_0x23a7('0x41')]=_0x33261f['id'];if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x42')]){_0x18cbad['where']=_[_0x23a7('0x32')](_0x18cbad[_0x23a7('0x3f')],{'$or':_['map'](_0x18cbad[_0x23a7('0x2e')],function(_0x1a30e7){var _0x144325={};_0x144325[_0x1a30e7]={'$like':'%'+_0x1af2cc['query'][_0x23a7('0x42')]+'%'};return _0x144325;})});}if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x43')]){var _0x547a91=_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x43')][_0x23a7('0x44')](',');var _0x23433d={};_0x23433d[_0x547a91[0x0]]={'$gte':moment(_0x547a91[0x1])[_0x23a7('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x18cbad[_0x23a7('0x3f')]=_['merge'](_0x18cbad[_0x23a7('0x3f')],_0x23433d);}_0x18cbad=_[_0x23a7('0x32')]({},_0x18cbad,_0x1af2cc[_0x23a7('0x46')]);return db[_0x23a7('0x38')][_0x23a7('0x14')]({'where':_0x18cbad[_0x23a7('0x3f')]})[_0x23a7('0x19')](function(_0x2f6c44){_0x31de2a[_0x23a7('0x14')]=_0x2f6c44;if(_0x1af2cc[_0x23a7('0x24')][_0x23a7('0x30')]){_0x18cbad[_0x23a7('0x31')]=[{'all':!![]}];}return db[_0x23a7('0x38')][_0x23a7('0x22')](_0x18cbad);})[_0x23a7('0x19')](function(_0x1ca872){_0x31de2a[_0x23a7('0x47')]=_0x1ca872;return _0x31de2a;});}})['then'](respondWithFilteredResult(_0x5d5e47,_0x18cbad))[_0x23a7('0x26')](handleError(_0x5d5e47,null));};exports['addTags']=function(_0x32a974,_0x3c5009){return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x32a974[_0x23a7('0x28')]['id']}})['then'](handleEntityNotFound(_0x3c5009,null))[_0x23a7('0x19')](function(_0x54e8d7){if(_0x54e8d7){return _0x54e8d7[_0x23a7('0x48')](_0x32a974[_0x23a7('0x35')][_0x23a7('0x39')],_[_0x23a7('0x3a')](_0x32a974[_0x23a7('0x35')],[_0x23a7('0x39'),'id'])||{})[_0x23a7('0x49')](function(){return db[_0x23a7('0x4a')][_0x23a7('0x22')]({'attributes':['id',_0x23a7('0x1d'),'color'],'where':{'id':_0x32a974[_0x23a7('0x35')][_0x23a7('0x39')]}});})[_0x23a7('0x19')](function(_0x3e5046){socket[_0x23a7('0x4b')](_0x23a7('0x4c'),{'id':Number(_0x32a974[_0x23a7('0x28')]['id']),'tags':_0x3e5046||[]});return{'id':Number(_0x32a974['params']['id']),'tags':_0x3e5046||[]};});}})['then'](respondWithResult(_0x3c5009,null))[_0x23a7('0x26')](handleError(_0x3c5009,null));};exports[_0x23a7('0x4d')]=function(_0x57c097,_0x48d8b3){return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0x57c097['params']['id']}})[_0x23a7('0x19')](handleEntityNotFound(_0x48d8b3,null))[_0x23a7('0x19')](function(_0x4be083){if(_0x4be083){return _0x4be083[_0x23a7('0x4d')](_0x57c097[_0x23a7('0x24')]['ids']);}})[_0x23a7('0x19')](respondWithStatusCode(_0x48d8b3,null))[_0x23a7('0x26')](handleError(_0x48d8b3,null));};exports['download']=function(_0xd3d458,_0x397c18){var _0x2ed7e5=moment()[_0x23a7('0x4e')]()[_0x23a7('0x4f')]();var _0x227222=path['join'](config[_0x23a7('0x50')],_0x23a7('0x51'),_0x23a7('0x52'),_0x23a7('0x53'));var _0x51eb2e=path[_0x23a7('0x54')](config[_0x23a7('0x50')],_0x23a7('0x51'),_0x23a7('0x52'),'attachments');var _0x50cd08=path[_0x23a7('0x54')](_0x227222,_0x2ed7e5);var _0x5a8c00=util[_0x23a7('0x45')](_0x23a7('0x55'),_0xd3d458['params']['id'],_0x2ed7e5);var _0x25c46a=path['join'](_0x227222,_0x5a8c00);var _0x6b3091=[];_0x6b3091[_0x23a7('0x56')]({'model':db[_0x23a7('0x57')],'as':'Attachment','raw':!![]});var _0x5c7807=[{'model':db[_0x23a7('0x38')],'as':'Messages','attributes':['id','body',_0x23a7('0x58')],'include':_0x6b3091}];return db[_0x23a7('0x21')][_0x23a7('0x33')]({'where':{'id':_0xd3d458[_0x23a7('0x28')]['id']},'include':_0x5c7807})['then'](handleEntityNotFound(_0x397c18,null))[_0x23a7('0x19')](function(_0x867b75){if(_0x867b75&&_0x867b75[_0x23a7('0x59')]){var _0x2bb3e0=_0x867b75[_0x23a7('0x5a')]({'plain':!![]});fs[_0x23a7('0x5b')](_0x50cd08);for(var _0x36d924=0x0;_0x36d924<_0x2bb3e0[_0x23a7('0x59')][_0x23a7('0x2f')];_0x36d924++){var _0x4dd068=_0x2bb3e0[_0x23a7('0x59')][_0x36d924][_0x23a7('0x57')];if(_0x4dd068){var _0x17e3cf=path[_0x23a7('0x54')](_0x51eb2e,_0x4dd068['basename']);if(fs[_0x23a7('0x5c')](_0x17e3cf)){fs[_0x23a7('0x5d')](_0x17e3cf)[_0x23a7('0x5e')](fs[_0x23a7('0x5f')](path[_0x23a7('0x54')](_0x50cd08,_0x4dd068[_0x23a7('0x60')])));}}}return BPromise[_0x23a7('0x61')]()[_0x23a7('0x19')](function(){return new BPromise(function(_0x4c2a2a,_0x5204aa){zipdir(_0x50cd08,{'saveTo':_0x25c46a},function(_0x38ef29,_0x9173b3){if(_0x38ef29)return _0x5204aa(_0x38ef29);return _0x4c2a2a(_0x9173b3);});})[_0x23a7('0x19')](function(){return new BPromise(function(_0x19c225,_0x513c77){rimraf(_0x50cd08,function(_0x5343d7){if(_0x5343d7)_0x513c77(_0x5343d7);return _0x19c225();});});})['then'](function(){return _0x397c18[_0x23a7('0x62')](_0x25c46a,_0x5a8c00,function(_0x502595){if(_0x502595){console['log']('err',_0x502595);}else{fs[_0x23a7('0x63')](_0x25c46a);}});});});}else{return _0x397c18['sendStatus'](0xc8);}})[_0x23a7('0x26')](handleError(_0x397c18,null));}; \ No newline at end of file +var _0x4000=['params','describe','addMessage','FaxMessage','ids','getMessages','hasOwnProperty','order','sort','where','pick','FaxInteractionId','merge','map','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','omit','spread','Tag','color','emit','faxInteractionTags:save','download','unix','join','root','files','tmp','attachments','push','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','pipe','log','err','rimraf','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','then','error','name','send','index','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','model','keys','FaxInteraction','filters','attributes','fields','length','include','options','create','body','update','find'];(function(_0x3e76e9,_0x4671be){var _0x15255c=function(_0x2b5e88){while(--_0x2b5e88){_0x3e76e9['push'](_0x3e76e9['shift']());}};_0x15255c(++_0x4671be);}(_0x4000,0x1b9));var _0x0400=function(_0x54db84,_0x1ff895){_0x54db84=_0x54db84-0x0;var _0x338913=_0x4000[_0x54db84];return _0x338913;};'use strict';var rimraf=require(_0x0400('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x0400('0x1'));var util=require(_0x0400('0x2'));var path=require(_0x0400('0x3'));var fs=require('fs');var _=require(_0x0400('0x4'));var Redis=require(_0x0400('0x5'));var interaction=require(_0x0400('0x6'));var qs=require(_0x0400('0x7'));var logger=require('../../config/logger')(_0x0400('0x8'));var config=require(_0x0400('0x9'));var db=require('../../mysqldb')['db'];config[_0x0400('0xa')]=_[_0x0400('0xb')](config['redis'],{'host':_0x0400('0xc'),'port':0x18eb});var socket=require(_0x0400('0xd'))(new Redis(config['redis']));require(_0x0400('0xe'))[_0x0400('0xf')](socket);function respondWithStatusCode(_0x34df3a,_0x1d5a8b){_0x1d5a8b=_0x1d5a8b||0xcc;return function(_0xcfa1f2){if(_0xcfa1f2){return _0x34df3a[_0x0400('0x10')](_0x1d5a8b);}return _0x34df3a[_0x0400('0x11')](_0x1d5a8b)[_0x0400('0x12')]();};}function respondWithResult(_0x394535,_0x53be72){_0x53be72=_0x53be72||0xc8;return function(_0x1ced73){if(_0x1ced73){return _0x394535[_0x0400('0x11')](_0x53be72)[_0x0400('0x13')](_0x1ced73);}};}function respondWithFilteredResult(_0x5401a8,_0x2a2d5e){return function(_0x532cb5){if(_0x532cb5){var _0x39b670=typeof _0x2a2d5e[_0x0400('0x14')]===_0x0400('0x15')&&typeof _0x2a2d5e[_0x0400('0x16')]===_0x0400('0x15');var _0x530c5b=_0x532cb5[_0x0400('0x17')];var _0x13c635=_0x39b670?0x0:_0x2a2d5e[_0x0400('0x14')];var _0x544d6c=_0x39b670?_0x532cb5[_0x0400('0x17')]:_0x2a2d5e['offset']+_0x2a2d5e[_0x0400('0x16')];var _0x369198;if(_0x544d6c>=_0x530c5b){_0x544d6c=_0x530c5b;_0x369198=0xc8;}else{_0x369198=0xce;}_0x5401a8[_0x0400('0x11')](_0x369198);return _0x5401a8['set'](_0x0400('0x18'),_0x13c635+'-'+_0x544d6c+'/'+_0x530c5b)['json'](_0x532cb5);}return null;};}function saveUpdates(_0x46dec9){return function(_0x3d41be){if(_0x3d41be){return _0x3d41be['update'](_0x46dec9)['then'](function(_0xd3bb68){return _0xd3bb68;});}return null;};}function removeEntity(_0x3f5a9d){return function(_0x369624){if(_0x369624){return _0x369624[_0x0400('0x19')]()[_0x0400('0x1a')](function(){_0x3f5a9d[_0x0400('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x148559){return function(_0x4a4009){if(!_0x4a4009){_0x148559['sendStatus'](0x194);}return _0x4a4009;};}function handleError(_0x4f86c7,_0x182d03){_0x182d03=_0x182d03||0x1f4;return function(_0x380194){logger[_0x0400('0x1b')](_0x380194['stack']);if(_0x380194[_0x0400('0x1c')]){delete _0x380194[_0x0400('0x1c')];}_0x4f86c7[_0x0400('0x11')](_0x182d03)[_0x0400('0x1d')](_0x380194);};}exports[_0x0400('0x1e')]=function(_0x5ba5c6,_0x129f81){var _0x2cc803={};var _0x33eea9=_['map'](db['FaxInteraction'][_0x0400('0x1f')],function(_0x4faaeb){return{'name':_0x4faaeb[_0x0400('0x20')],'type':_0x4faaeb[_0x0400('0x21')]['key']};});_0x2cc803=qs[_0x0400('0x22')](_0x33eea9,_0x5ba5c6);return interaction[_0x0400('0x23')](_0x0400('0x24'),_0x5ba5c6[_0x0400('0x25')],_0x5ba5c6[_0x0400('0x26')],_0x2cc803,_0x33eea9)[_0x0400('0x1a')](respondWithFilteredResult(_0x129f81,_0x2cc803))[_0x0400('0x27')](handleError(_0x129f81,null));};exports[_0x0400('0x28')]=function(_0x340046,_0x317904){var _0x41b8b3={'raw':![],'where':{'id':_0x340046['params']['id']}},_0x382eb1={};_0x382eb1[_0x0400('0x29')]=_[_0x0400('0x2a')](db[_0x0400('0x2b')]['rawAttributes']);_0x382eb1[_0x0400('0x25')]=_[_0x0400('0x2a')](_0x340046[_0x0400('0x25')]);_0x382eb1[_0x0400('0x2c')]=_['intersection'](_0x382eb1['model'],_0x382eb1['query']);_0x41b8b3[_0x0400('0x2d')]=_['intersection'](_0x382eb1[_0x0400('0x29')],qs[_0x0400('0x2e')](_0x340046['query'][_0x0400('0x2e')]));_0x41b8b3[_0x0400('0x2d')]=_0x41b8b3[_0x0400('0x2d')][_0x0400('0x2f')]?_0x41b8b3[_0x0400('0x2d')]:_0x382eb1['model'];if(_0x340046[_0x0400('0x25')]['includeAll']){_0x41b8b3[_0x0400('0x30')]=[{'all':!![]}];}_0x41b8b3=_['merge']({},_0x41b8b3,_0x340046[_0x0400('0x31')]);return db[_0x0400('0x2b')]['find'](_0x41b8b3)[_0x0400('0x1a')](handleEntityNotFound(_0x317904,null))[_0x0400('0x1a')](respondWithResult(_0x317904,null))[_0x0400('0x27')](handleError(_0x317904,null));};exports[_0x0400('0x32')]=function(_0x27583a,_0x45acde){return db[_0x0400('0x2b')]['create'](_0x27583a[_0x0400('0x33')],{})[_0x0400('0x1a')](respondWithResult(_0x45acde,0xc9))['catch'](handleError(_0x45acde,null));};exports[_0x0400('0x34')]=function(_0x307dbc,_0x196e7a){if(_0x307dbc['body']['id']){delete _0x307dbc['body']['id'];}return db[_0x0400('0x2b')][_0x0400('0x35')]({'where':{'id':_0x307dbc[_0x0400('0x36')]['id']}})[_0x0400('0x1a')](handleEntityNotFound(_0x196e7a,null))['then'](saveUpdates(_0x307dbc['body'],null))[_0x0400('0x1a')](respondWithResult(_0x196e7a,null))[_0x0400('0x27')](handleError(_0x196e7a,null));};exports['destroy']=function(_0x13c559,_0x26d626){return db['FaxInteraction'][_0x0400('0x35')]({'where':{'id':_0x13c559['params']['id']}})[_0x0400('0x1a')](handleEntityNotFound(_0x26d626,null))[_0x0400('0x1a')](removeEntity(_0x26d626,null))[_0x0400('0x27')](handleError(_0x26d626,null));};exports[_0x0400('0x37')]=function(_0x3a67e7,_0x4d7077){return db[_0x0400('0x2b')][_0x0400('0x37')]()[_0x0400('0x1a')](respondWithResult(_0x4d7077,null))[_0x0400('0x27')](handleError(_0x4d7077,null));};exports[_0x0400('0x38')]=function(_0x139091,_0x1006bd){return db[_0x0400('0x39')][_0x0400('0x35')]({'where':{'id':_0x139091['params']['id']}})['then'](handleEntityNotFound(_0x1006bd,null))[_0x0400('0x1a')](function(_0x44cf84){if(_0x44cf84){return _0x44cf84['addMessage'](_0x139091[_0x0400('0x33')][_0x0400('0x3a')],_['omit'](_0x139091[_0x0400('0x33')],[_0x0400('0x3a'),'id'])||{});}})[_0x0400('0x1a')](respondWithResult(_0x1006bd,null))[_0x0400('0x27')](handleError(_0x1006bd,null));};exports[_0x0400('0x3b')]=function(_0x1d1172,_0x1baa01){var _0x3f4593={'raw':![],'where':{}};var _0x17e61e={};var _0x10687b={'count':0x0,'rows':[]};return db[_0x0400('0x2b')]['findOne']({'where':{'id':_0x1d1172[_0x0400('0x36')]['id']}})[_0x0400('0x1a')](handleEntityNotFound(_0x1baa01,null))['then'](function(_0x49ead3){if(_0x49ead3){_0x17e61e[_0x0400('0x29')]=_[_0x0400('0x2a')](db[_0x0400('0x39')][_0x0400('0x1f')]);_0x17e61e[_0x0400('0x25')]=_[_0x0400('0x2a')](_0x1d1172[_0x0400('0x25')]);_0x17e61e['filters']=_['intersection'](_0x17e61e[_0x0400('0x29')],_0x17e61e[_0x0400('0x25')]);_0x3f4593[_0x0400('0x2d')]=_['intersection'](_0x17e61e[_0x0400('0x29')],qs[_0x0400('0x2e')](_0x1d1172[_0x0400('0x25')][_0x0400('0x2e')]));_0x3f4593[_0x0400('0x2d')]=_0x3f4593[_0x0400('0x2d')][_0x0400('0x2f')]?_0x3f4593[_0x0400('0x2d')]:_0x17e61e[_0x0400('0x29')];if(!_0x1d1172[_0x0400('0x25')][_0x0400('0x3c')]('nolimit')){_0x3f4593[_0x0400('0x16')]=qs[_0x0400('0x16')](_0x1d1172[_0x0400('0x25')]['limit']);_0x3f4593[_0x0400('0x14')]=qs[_0x0400('0x14')](_0x1d1172['query'][_0x0400('0x14')]);}_0x3f4593[_0x0400('0x3d')]=qs['sort'](_0x1d1172['query'][_0x0400('0x3e')]);_0x3f4593[_0x0400('0x3f')]=qs['filters'](_[_0x0400('0x40')](_0x1d1172['query'],_0x17e61e[_0x0400('0x2c')]));_0x3f4593['where'][_0x0400('0x41')]=_0x49ead3['id'];if(_0x1d1172[_0x0400('0x25')]['filter']){_0x3f4593[_0x0400('0x3f')]=_[_0x0400('0x42')](_0x3f4593[_0x0400('0x3f')],{'$or':_[_0x0400('0x43')](_0x3f4593[_0x0400('0x2d')],function(_0x4264e7){var _0x35d504={};_0x35d504[_0x4264e7]={'$like':'%'+_0x1d1172['query'][_0x0400('0x44')]+'%'};return _0x35d504;})});}if(_0x1d1172['query'][_0x0400('0x45')]){var _0x204c97=_0x1d1172[_0x0400('0x25')]['$gte'][_0x0400('0x46')](',');var _0x51045d={};_0x51045d[_0x204c97[0x0]]={'$gte':moment(_0x204c97[0x1])[_0x0400('0x47')](_0x0400('0x48'))};_0x3f4593['where']=_[_0x0400('0x42')](_0x3f4593[_0x0400('0x3f')],_0x51045d);}_0x3f4593=_[_0x0400('0x42')]({},_0x3f4593,_0x1d1172[_0x0400('0x31')]);return db[_0x0400('0x39')][_0x0400('0x17')]({'where':_0x3f4593[_0x0400('0x3f')]})[_0x0400('0x1a')](function(_0x537e47){_0x10687b['count']=_0x537e47;if(_0x1d1172['query']['includeAll']){_0x3f4593[_0x0400('0x30')]=[{'all':!![]}];}return db[_0x0400('0x39')]['findAll'](_0x3f4593);})['then'](function(_0xfce16b){_0x10687b['rows']=_0xfce16b;return _0x10687b;});}})['then'](respondWithFilteredResult(_0x1baa01,_0x3f4593))[_0x0400('0x27')](handleError(_0x1baa01,null));};exports[_0x0400('0x49')]=function(_0x279c85,_0x5ef6f0){return db['FaxInteraction'][_0x0400('0x35')]({'where':{'id':_0x279c85[_0x0400('0x36')]['id']}})[_0x0400('0x1a')](handleEntityNotFound(_0x5ef6f0,null))[_0x0400('0x1a')](function(_0x4d578a){if(_0x4d578a){return _0x4d578a['setTags'](_0x279c85[_0x0400('0x33')][_0x0400('0x3a')],_[_0x0400('0x4a')](_0x279c85[_0x0400('0x33')],[_0x0400('0x3a'),'id'])||{})[_0x0400('0x4b')](function(){return db[_0x0400('0x4c')][_0x0400('0x23')]({'attributes':['id',_0x0400('0x1c'),_0x0400('0x4d')],'where':{'id':_0x279c85[_0x0400('0x33')][_0x0400('0x3a')]}});})[_0x0400('0x1a')](function(_0x347278){socket[_0x0400('0x4e')](_0x0400('0x4f'),{'id':Number(_0x279c85[_0x0400('0x36')]['id']),'tags':_0x347278||[]});return{'id':Number(_0x279c85[_0x0400('0x36')]['id']),'tags':_0x347278||[]};});}})[_0x0400('0x1a')](respondWithResult(_0x5ef6f0,null))[_0x0400('0x27')](handleError(_0x5ef6f0,null));};exports['removeTags']=function(_0x1a0ba6,_0x2bd7ef){return db[_0x0400('0x2b')]['find']({'where':{'id':_0x1a0ba6[_0x0400('0x36')]['id']}})[_0x0400('0x1a')](handleEntityNotFound(_0x2bd7ef,null))['then'](function(_0x1200d2){if(_0x1200d2){return _0x1200d2['removeTags'](_0x1a0ba6['query'][_0x0400('0x3a')]);}})[_0x0400('0x1a')](respondWithStatusCode(_0x2bd7ef,null))[_0x0400('0x27')](handleError(_0x2bd7ef,null));};exports[_0x0400('0x50')]=function(_0x533e07,_0x18dba0){var _0x15d58c=moment()[_0x0400('0x51')]()['toString']();var _0xf63323=path[_0x0400('0x52')](config[_0x0400('0x53')],'server',_0x0400('0x54'),_0x0400('0x55'));var _0x3d6542=path[_0x0400('0x52')](config['root'],'server',_0x0400('0x54'),_0x0400('0x56'));var _0x2ac4ff=path[_0x0400('0x52')](_0xf63323,_0x15d58c);var _0x2400e9=util[_0x0400('0x47')]('transcript-%d-%s.zip',_0x533e07[_0x0400('0x36')]['id'],_0x15d58c);var _0x545997=path[_0x0400('0x52')](_0xf63323,_0x2400e9);var _0x38ce2c=[];_0x38ce2c[_0x0400('0x57')]({'model':db[_0x0400('0x58')],'as':'Attachment','raw':!![]});var _0x191896=[{'model':db[_0x0400('0x39')],'as':_0x0400('0x59'),'attributes':['id',_0x0400('0x33'),_0x0400('0x5a')],'include':_0x38ce2c}];return db[_0x0400('0x2b')][_0x0400('0x35')]({'where':{'id':_0x533e07['params']['id']},'include':_0x191896})[_0x0400('0x1a')](handleEntityNotFound(_0x18dba0,null))[_0x0400('0x1a')](function(_0x5420b6){if(_0x5420b6&&_0x5420b6[_0x0400('0x59')]){var _0x30eb8e=_0x5420b6[_0x0400('0x5b')]({'plain':!![]});fs[_0x0400('0x5c')](_0x2ac4ff);for(var _0x5801a3=0x0;_0x5801a3<_0x30eb8e[_0x0400('0x59')][_0x0400('0x2f')];_0x5801a3++){var _0x524e4a=_0x30eb8e[_0x0400('0x59')][_0x5801a3][_0x0400('0x58')];if(_0x524e4a){var _0x39d271=path[_0x0400('0x52')](_0x3d6542,_0x524e4a[_0x0400('0x5d')]);if(fs[_0x0400('0x5e')](_0x39d271)){fs[_0x0400('0x5f')](_0x39d271)[_0x0400('0x60')](fs['createWriteStream'](path[_0x0400('0x52')](_0x2ac4ff,_0x524e4a['basename'])));}}}return BPromise['resolve']()[_0x0400('0x1a')](function(){return new BPromise(function(_0x9ecaf6,_0x39d731){zipdir(_0x2ac4ff,{'saveTo':_0x545997},function(_0x337e5b,_0x4bb896){if(_0x337e5b)return _0x39d731(_0x337e5b);return _0x9ecaf6(_0x4bb896);});})[_0x0400('0x1a')](function(){return new BPromise(function(_0x4beae1,_0x493e14){rimraf(_0x2ac4ff,function(_0x347e28){if(_0x347e28)_0x493e14(_0x347e28);return _0x4beae1();});});})['then'](function(){return _0x18dba0[_0x0400('0x50')](_0x545997,_0x2400e9,function(_0x2b4a22){if(_0x2b4a22){console[_0x0400('0x61')](_0x0400('0x62'),_0x2b4a22);}else{fs['unlinkSync'](_0x545997);}});});});}else{return _0x18dba0[_0x0400('0x10')](0xc8);}})[_0x0400('0x27')](handleError(_0x18dba0,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 694f3cb..cfcbf34 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 _0xd956=['FaxInteraction','setMaxListeners','save','update','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb'];(function(_0x5828fd,_0x1fbb9c){var _0x50a269=function(_0x32f1b1){while(--_0x32f1b1){_0x5828fd['push'](_0x5828fd['shift']());}};_0x50a269(++_0x1fbb9c);}(_0xd956,0xce));var _0x6d95=function(_0x4a9379,_0x20cbd8){_0x4a9379=_0x4a9379-0x0;var _0x4976ed=_0xd956[_0x4a9379];return _0x4976ed;};'use strict';var EventEmitter=require(_0x6d95('0x0'));var FaxInteraction=require(_0x6d95('0x1'))['db'][_0x6d95('0x2')];var FaxMessage=require(_0x6d95('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x6d95('0x3')](0x0);var events={'afterCreate':_0x6d95('0x4'),'afterUpdate':_0x6d95('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3919d5){return function(_0x499797,_0x19a7bc,_0x4d4fe3){_0x499797['getUsers']({'attributes':['id'],'raw':!![]})[_0x6d95('0x6')](function(_0x1521cb){_0x499797[_0x6d95('0x7')](_0x6d95('0x8'),_0x1521cb[_0x6d95('0x9')](function(_0x597d1e){return{'id':_0x597d1e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x499797['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6d95('0x6')](function(_0x3e97c5){_0x499797['setDataValue'](_0x6d95('0xa'),_0x3e97c5[_0x6d95('0xb')]);FaxInteractionEvents[_0x6d95('0xc')](_0x3919d5+':'+_0x499797['id'],_0x499797);FaxInteractionEvents[_0x6d95('0xc')](_0x3919d5,_0x499797);_0x4d4fe3(null);})[_0x6d95('0xd')](_0x4d4fe3(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x6d95('0xe')](e,emitEvent(event));}}module[_0x6d95('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0xdb24=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove','getUsers','Users','map','findAll','then'];(function(_0x31e491,_0x196a04){var _0x488415=function(_0x7d715f){while(--_0x7d715f){_0x31e491['push'](_0x31e491['shift']());}};_0x488415(++_0x196a04);}(_0xdb24,0x14a));var _0x4db2=function(_0x358810,_0x552345){_0x358810=_0x358810-0x0;var _0x19b25e=_0xdb24[_0x358810];return _0x19b25e;};'use strict';var EventEmitter=require(_0x4db2('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x4db2('0x1')];var FaxMessage=require(_0x4db2('0x2'))['db'][_0x4db2('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4db2('0x4')](0x0);var events={'afterCreate':_0x4db2('0x5'),'afterUpdate':'update','afterDestroy':_0x4db2('0x6')};function emitEvent(_0x443132){return function(_0x206e12,_0x20d1c1,_0x4e32d7){_0x206e12[_0x4db2('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5abb47){_0x206e12['setDataValue'](_0x4db2('0x8'),_0x5abb47[_0x4db2('0x9')](function(_0x58942e){return{'id':_0x58942e['id']};}));return FaxMessage[_0x4db2('0xa')]({'where':{'FaxInteractionId':_0x206e12['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4db2('0xb')](function(_0x3e0ed0){_0x206e12['setDataValue'](_0x4db2('0xc'),_0x3e0ed0[_0x4db2('0xd')]);FaxInteractionEvents['emit'](_0x443132+':'+_0x206e12['id'],_0x206e12);FaxInteractionEvents[_0x4db2('0xe')](_0x443132,_0x206e12);_0x4e32d7(null);})[_0x4db2('0xf')](_0x4e32d7(null));};}for(var e in events){if(events[_0x4db2('0x10')](e)){var event=events[e];FaxInteraction[_0x4db2('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 1bd129d..df779ac 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 _0x1c77=['fax_interactions','closed','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x1c77,0xed));var _0x71c7=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x1c77[_0x466bc5];return _0x138952;};'use strict';var _=require('lodash');var util=require(_0x71c7('0x0'));var logger=require(_0x71c7('0x1'))(_0x71c7('0x2'));var moment=require(_0x71c7('0x3'));var BPromise=require(_0x71c7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71c7('0x5'));var rimraf=require(_0x71c7('0x6'));var config=require(_0x71c7('0x7'));var attributes=require(_0x71c7('0x8'));module[_0x71c7('0x9')]=function(_0x1ee344,_0x2fb422){return _0x1ee344['define']('FaxInteraction',attributes,{'tableName':_0x71c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x244867,_0x229b00,_0x471bc6){if(_0x244867['changed'](_0x71c7('0xb'))){_0x244867['closedAt']=moment()['format'](_0x71c7('0xc'));}_0x471bc6(null,_0x244867);}}});}; \ No newline at end of file +var _0xe9ea=['./faxInteraction.attributes','define','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird'];(function(_0x3ac346,_0x3cc2ce){var _0x5cd185=function(_0x58bf16){while(--_0x58bf16){_0x3ac346['push'](_0x3ac346['shift']());}};_0x5cd185(++_0x3cc2ce);}(_0xe9ea,0x128));var _0xae9e=function(_0x25c7b3,_0x1b14ff){_0x25c7b3=_0x25c7b3-0x0;var _0x334238=_0xe9ea[_0x25c7b3];return _0x334238;};'use strict';var _=require(_0xae9e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xae9e('0x1'));var moment=require(_0xae9e('0x2'));var BPromise=require(_0xae9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae9e('0x4'));module['exports']=function(_0x18698f,_0x590b09){return _0x18698f[_0xae9e('0x5')]('FaxInteraction',attributes,{'tableName':_0xae9e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58be23,_0x51e9,_0x209d53){if(_0x58be23[_0xae9e('0x7')]('closed')){_0x58be23[_0xae9e('0x8')]=moment()['format'](_0xae9e('0x9'));}_0x209d53(null,_0x58be23);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e912c42..bd498cd 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 _0xb91e=['find','where','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','socket.io-emitter','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','message','error','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','limit','info','AddTagsToFaxInteraction'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb91e,0x1ca));var _0xeb91=function(_0x103a39,_0x5b9859){_0x103a39=_0x103a39-0x0;var _0x259893=_0xb91e[_0x103a39];return _0x259893;};'use strict';var _=require(_0xeb91('0x0'));var util=require(_0xeb91('0x1'));var moment=require('moment');var BPromise=require(_0xeb91('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb91('0x3'));var db=require(_0xeb91('0x4'))['db'];var utils=require(_0xeb91('0x5'));var logger=require(_0xeb91('0x6'))(_0xeb91('0x7'));var config=require('../../config/environment');var jayson=require(_0xeb91('0x8'));var client=jayson[_0xeb91('0x9')][_0xeb91('0xa')]({'port':0x232a});config['redis']=_[_0xeb91('0xb')](config[_0xeb91('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb91('0xd'))(new Redis(config[_0xeb91('0xc')]));require(_0xeb91('0xe'))['register'](socket);function respondWithRpcPromise(_0xfcc033,_0x17cd3b,_0x1d51c1){return new BPromise(function(_0x2d5a5a,_0x16088b){return client[_0xeb91('0xf')](_0xfcc033,_0x1d51c1)[_0xeb91('0x10')](function(_0x3a0fb7){logger['info'](_0xeb91('0x11'),_0x17cd3b,_0xeb91('0x12'));logger[_0xeb91('0x13')](_0xeb91('0x14'),_0x17cd3b,_0xeb91('0x12'),JSON[_0xeb91('0x15')](_0x3a0fb7));if(_0x3a0fb7['error']){if(_0x3a0fb7['error']['code']===0x1f4){logger['error'](_0xeb91('0x11'),_0x17cd3b,_0x3a0fb7['error'][_0xeb91('0x16')]);return _0x16088b(_0x3a0fb7[_0xeb91('0x17')]['message']);}logger[_0xeb91('0x17')](_0xeb91('0x11'),_0x17cd3b,_0x3a0fb7[_0xeb91('0x17')]['message']);return _0x2d5a5a(_0x3a0fb7[_0xeb91('0x17')][_0xeb91('0x16')]);}else{logger['info'](_0xeb91('0x11'),_0x17cd3b,'request\x20sent');_0x2d5a5a(_0x3a0fb7[_0xeb91('0x18')][_0xeb91('0x16')]);}})[_0xeb91('0x19')](function(_0x1073af){logger[_0xeb91('0x17')](_0xeb91('0x11'),_0x17cd3b,_0x1073af);_0x16088b(_0x1073af);});});}exports[_0xeb91('0x1a')]=function(_0x5d522f){var _0x40037c=this;return new Promise(function(_0x171d33,_0x23f484){return db[_0xeb91('0x1b')]['update'](_0x5d522f[_0xeb91('0x1c')],{'raw':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')][_0xeb91('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')]['where']||null:null,'attributes':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f['options']['attributes']||null:null,'limit':_0x5d522f[_0xeb91('0x1d')]?_0x5d522f[_0xeb91('0x1d')][_0xeb91('0x1f')]||null:null})[_0xeb91('0x10')](function(_0x41f791){logger[_0xeb91('0x20')]('UpdateFaxInteraction',_0x5d522f);logger[_0xeb91('0x13')](_0xeb91('0x1a'),_0x5d522f,JSON[_0xeb91('0x15')](_0x41f791));_0x171d33(_0x41f791);})[_0xeb91('0x19')](function(_0x3c4ae6){logger['error'](_0xeb91('0x1a'),_0x3c4ae6[_0xeb91('0x16')],_0x5d522f);_0x23f484(_0x40037c['error'](0x1f4,_0x3c4ae6[_0xeb91('0x16')]));});});};exports[_0xeb91('0x21')]=function(_0x54a817){return new Promise(function(_0x3f58d9,_0x41724c){return db['FaxInteraction'][_0xeb91('0x22')]({'where':_0x54a817[_0xeb91('0x1d')]?_0x54a817[_0xeb91('0x1d')][_0xeb91('0x23')]||null:null})['then'](function(_0x289913){if(_0x289913){return _0x289913[_0xeb91('0x24')](_0x54a817[_0xeb91('0x1c')]['ids'],_[_0xeb91('0x25')](_0x54a817[_0xeb91('0x1c')],[_0xeb91('0x26'),'id'])||{});}})[_0xeb91('0x27')](function(_0x457619){logger['info'](_0xeb91('0x28'),_0x54a817);logger[_0xeb91('0x13')](_0xeb91('0x28'),_0x54a817,JSON['stringify'](_0x457619));_0x3f58d9(_0x457619);})[_0xeb91('0x19')](function(_0x1aa82b){logger[_0xeb91('0x17')](_0xeb91('0x28'),_0x1aa82b[_0xeb91('0x16')],_0x54a817);_0x41724c(_this[_0xeb91('0x17')](0x1f4,_0x1aa82b[_0xeb91('0x16')]));});});}; \ No newline at end of file +var _0xe36a=['message','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','limit','stringify','AddTagsToFaxInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x2fee22,_0x2d2143){var _0x3d6baa=function(_0x85d6f1){while(--_0x85d6f1){_0x2fee22['push'](_0x2fee22['shift']());}};_0x3d6baa(++_0x2d2143);}(_0xe36a,0xbd));var _0xae36=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0xe36a[_0x4b4d43];return _0x5706ba;};'use strict';var _=require(_0xae36('0x0'));var util=require(_0xae36('0x1'));var moment=require(_0xae36('0x2'));var BPromise=require(_0xae36('0x3'));var rs=require(_0xae36('0x4'));var fs=require('fs');var Redis=require(_0xae36('0x5'));var db=require(_0xae36('0x6'))['db'];var utils=require(_0xae36('0x7'));var logger=require(_0xae36('0x8'))(_0xae36('0x9'));var config=require('../../config/environment');var jayson=require(_0xae36('0xa'));var client=jayson['client'][_0xae36('0xb')]({'port':0x232a});config[_0xae36('0xc')]=_[_0xae36('0xd')](config[_0xae36('0xc')],{'host':_0xae36('0xe'),'port':0x18eb});var socket=require(_0xae36('0xf'))(new Redis(config['redis']));require(_0xae36('0x10'))[_0xae36('0x11')](socket);function respondWithRpcPromise(_0xbf600c,_0x28e19e,_0x46300d){return new BPromise(function(_0x573af3,_0x312683){return client[_0xae36('0x12')](_0xbf600c,_0x46300d)[_0xae36('0x13')](function(_0x3f159b){logger[_0xae36('0x14')](_0xae36('0x15'),_0x28e19e,_0xae36('0x16'));logger[_0xae36('0x17')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x28e19e,_0xae36('0x16'),JSON['stringify'](_0x3f159b));if(_0x3f159b['error']){if(_0x3f159b[_0xae36('0x18')][_0xae36('0x19')]===0x1f4){logger[_0xae36('0x18')](_0xae36('0x15'),_0x28e19e,_0x3f159b[_0xae36('0x18')]['message']);return _0x312683(_0x3f159b['error']['message']);}logger[_0xae36('0x18')](_0xae36('0x15'),_0x28e19e,_0x3f159b[_0xae36('0x18')][_0xae36('0x1a')]);return _0x573af3(_0x3f159b[_0xae36('0x18')][_0xae36('0x1a')]);}else{logger[_0xae36('0x14')](_0xae36('0x15'),_0x28e19e,'request\x20sent');_0x573af3(_0x3f159b['result'][_0xae36('0x1a')]);}})[_0xae36('0x1b')](function(_0x2314dc){logger[_0xae36('0x18')](_0xae36('0x15'),_0x28e19e,_0x2314dc);_0x312683(_0x2314dc);});});}exports[_0xae36('0x1c')]=function(_0x164d7a){var _0x41bb22=this;return new Promise(function(_0x53bd28,_0x1ae0f0){return db[_0xae36('0x1d')][_0xae36('0x1e')](_0x164d7a[_0xae36('0x1f')],{'raw':_0x164d7a[_0xae36('0x20')]?_0x164d7a[_0xae36('0x20')][_0xae36('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164d7a[_0xae36('0x20')]?_0x164d7a[_0xae36('0x20')]['where']||null:null,'attributes':_0x164d7a[_0xae36('0x20')]?_0x164d7a[_0xae36('0x20')]['attributes']||null:null,'limit':_0x164d7a[_0xae36('0x20')]?_0x164d7a['options'][_0xae36('0x22')]||null:null})[_0xae36('0x13')](function(_0x596e6f){logger[_0xae36('0x14')]('UpdateFaxInteraction',_0x164d7a);logger[_0xae36('0x17')]('UpdateFaxInteraction',_0x164d7a,JSON[_0xae36('0x23')](_0x596e6f));_0x53bd28(_0x596e6f);})[_0xae36('0x1b')](function(_0xf74216){logger[_0xae36('0x18')](_0xae36('0x1c'),_0xf74216[_0xae36('0x1a')],_0x164d7a);_0x1ae0f0(_0x41bb22['error'](0x1f4,_0xf74216[_0xae36('0x1a')]));});});};exports[_0xae36('0x24')]=function(_0x53c12d){return new Promise(function(_0x4dc01e,_0x2e8284){return db[_0xae36('0x1d')]['find']({'where':_0x53c12d['options']?_0x53c12d[_0xae36('0x20')][_0xae36('0x25')]||null:null})['then'](function(_0x1cf428){if(_0x1cf428){return _0x1cf428[_0xae36('0x26')](_0x53c12d[_0xae36('0x1f')][_0xae36('0x27')],_[_0xae36('0x28')](_0x53c12d[_0xae36('0x1f')],[_0xae36('0x27'),'id'])||{});}})[_0xae36('0x29')](function(_0x5ef3e0){logger[_0xae36('0x14')]('AddTags',_0x53c12d);logger['debug'](_0xae36('0x2a'),_0x53c12d,JSON[_0xae36('0x23')](_0x5ef3e0));_0x4dc01e(_0x5ef3e0);})[_0xae36('0x1b')](function(_0x588a10){logger[_0xae36('0x18')](_0xae36('0x2a'),_0x588a10[_0xae36('0x1a')],_0x53c12d);_0x2e8284(_this['error'](0x1f4,_0x588a10['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 6b0286e..4d25b49 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 _0xb952=['removeListener','register','length','faxInteraction:','./faxInteraction.events','save','update','emit'];(function(_0x486f67,_0x31a5ba){var _0x51e075=function(_0x5aec97){while(--_0x5aec97){_0x486f67['push'](_0x486f67['shift']());}};_0x51e075(++_0x31a5ba);}(_0xb952,0xe4));var _0x2b95=function(_0x290368,_0x30bae2){_0x290368=_0x290368-0x0;var _0x17aa96=_0xb952[_0x290368];return _0x17aa96;};'use strict';var FaxInteractionEvents=require(_0x2b95('0x0'));var events=[_0x2b95('0x1'),'remove',_0x2b95('0x2')];function createListener(_0x4b6c32,_0x1f14e1){return function(_0x21e51f){_0x1f14e1[_0x2b95('0x3')](_0x4b6c32,_0x21e51f);};}function removeListener(_0x45a174,_0x539ee2){return function(){FaxInteractionEvents[_0x2b95('0x4')](_0x45a174,_0x539ee2);};}exports[_0x2b95('0x5')]=function(_0x2b7c33){for(var _0x52d39f=0x0,_0x22a2d0=events[_0x2b95('0x6')];_0x52d39f<_0x22a2d0;_0x52d39f++){var _0x6aea62=events[_0x52d39f];var _0x17e357=createListener(_0x2b95('0x7')+_0x6aea62,_0x2b7c33);FaxInteractionEvents['on'](_0x6aea62,_0x17e357);}}; \ No newline at end of file +var _0x99d8=['./faxInteraction.events','save','remove','emit','removeListener','register','length'];(function(_0x1ff18a,_0x14abd6){var _0x123733=function(_0x14a2f7){while(--_0x14a2f7){_0x1ff18a['push'](_0x1ff18a['shift']());}};_0x123733(++_0x14abd6);}(_0x99d8,0x157));var _0x899d=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x99d8[_0x74892f];return _0x10ee61;};'use strict';var FaxInteractionEvents=require(_0x899d('0x0'));var events=[_0x899d('0x1'),_0x899d('0x2'),'update'];function createListener(_0x591da9,_0x429cff){return function(_0x5e0edf){_0x429cff[_0x899d('0x3')](_0x591da9,_0x5e0edf);};}function removeListener(_0x585fd8,_0x387660){return function(){FaxInteractionEvents[_0x899d('0x4')](_0x585fd8,_0x387660);};}exports[_0x899d('0x5')]=function(_0x1a1cc9){for(var _0x14f804=0x0,_0x59a236=events[_0x899d('0x6')];_0x14f804<_0x59a236;_0x14f804++){var _0x4f1537=events[_0x14f804];var _0x2e8c9f=createListener('faxInteraction:'+_0x4f1537,_0x1a1cc9);FaxInteractionEvents['on'](_0x4f1537,_0x2e8c9f);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b893a9d..9a7ed95 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 _0xa812=['faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','faxinteraction:addtags','tracked','fax','faxinteraction:update','update','delete'];(function(_0xe66c57,_0x245188){var _0x4956b0=function(_0x460694){while(--_0x460694){_0xe66c57['push'](_0xe66c57['shift']());}};_0x4956b0(++_0x245188);}(_0xa812,0x19c));var _0x2a81=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa812[_0x321bb2];return _0x9c12ed;};'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(_0x2a81('0x4'));var router=express[_0x2a81('0x5')]();var fs_extra=require(_0x2a81('0x6'));var auth=require(_0x2a81('0x7'));var interaction=require(_0x2a81('0x8'));var config=require(_0x2a81('0x9'));var controller=require(_0x2a81('0xa'));router[_0x2a81('0xb')]('/',auth[_0x2a81('0xc')](),controller['index']);router['get'](_0x2a81('0xd'),auth[_0x2a81('0xc')](),controller[_0x2a81('0xe')]);router['get'](_0x2a81('0xf'),auth['isAuthenticated'](),controller[_0x2a81('0x10')]);router['get'](_0x2a81('0x11'),auth[_0x2a81('0xc')](),controller[_0x2a81('0x12')]);router[_0x2a81('0xb')]('/:id/download',auth[_0x2a81('0xc')](),controller[_0x2a81('0x13')]);router['post']('/',auth[_0x2a81('0xc')](),controller[_0x2a81('0x14')]);router[_0x2a81('0x15')](_0x2a81('0x11'),auth[_0x2a81('0xc')](),controller[_0x2a81('0x16')]);router[_0x2a81('0x15')](_0x2a81('0x17'),auth[_0x2a81('0xc')](),interaction['tracked']('fax',_0x2a81('0x18')),controller['addTags']);router['put'](_0x2a81('0xf'),auth[_0x2a81('0xc')](),interaction[_0x2a81('0x19')](_0x2a81('0x1a'),_0x2a81('0x1b')),controller[_0x2a81('0x1c')]);router[_0x2a81('0x1d')](_0x2a81('0xf'),auth[_0x2a81('0xc')](),interaction[_0x2a81('0x19')]('fax',_0x2a81('0x1e')),controller[_0x2a81('0x1f')]);router[_0x2a81('0x1d')](_0x2a81('0x17'),auth['isAuthenticated'](),controller[_0x2a81('0x20')]);module[_0x2a81('0x21')]=router; \ No newline at end of file +var _0x4645=['getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','fax','addTags','put','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','describe','/:id','show','/:id/messages'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4645,0x1cf));var _0x5464=function(_0x303530,_0x19ff70){_0x303530=_0x303530-0x0;var _0x3e81dc=_0x4645[_0x303530];return _0x3e81dc;};'use strict';var multer=require(_0x5464('0x0'));var util=require(_0x5464('0x1'));var path=require('path');var timeout=require(_0x5464('0x2'));var express=require(_0x5464('0x3'));var router=express[_0x5464('0x4')]();var fs_extra=require(_0x5464('0x5'));var auth=require(_0x5464('0x6'));var interaction=require(_0x5464('0x7'));var config=require(_0x5464('0x8'));var controller=require(_0x5464('0x9'));router['get']('/',auth[_0x5464('0xa')](),controller[_0x5464('0xb')]);router[_0x5464('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x5464('0xd')]);router['get'](_0x5464('0xe'),auth['isAuthenticated'](),controller[_0x5464('0xf')]);router[_0x5464('0xc')](_0x5464('0x10'),auth[_0x5464('0xa')](),controller[_0x5464('0x11')]);router[_0x5464('0xc')](_0x5464('0x12'),auth[_0x5464('0xa')](),controller[_0x5464('0x13')]);router[_0x5464('0x14')]('/',auth[_0x5464('0xa')](),controller['create']);router['post'](_0x5464('0x10'),auth[_0x5464('0xa')](),controller[_0x5464('0x15')]);router[_0x5464('0x14')](_0x5464('0x16'),auth['isAuthenticated'](),interaction[_0x5464('0x17')](_0x5464('0x18'),'faxinteraction:addtags'),controller[_0x5464('0x19')]);router[_0x5464('0x1a')]('/:id',auth[_0x5464('0xa')](),interaction[_0x5464('0x17')](_0x5464('0x18'),'faxinteraction:update'),controller['update']);router[_0x5464('0x1b')](_0x5464('0xe'),auth[_0x5464('0xa')](),interaction[_0x5464('0x17')]('fax',_0x5464('0x1c')),controller[_0x5464('0x1d')]);router[_0x5464('0x1b')](_0x5464('0x16'),auth[_0x5464('0xa')](),controller[_0x5464('0x1e')]);module[_0x5464('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index a12a9e3..4a2d80c 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 _0xfa2b=['exports','TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x43e2e4,_0x4ad3b4){var _0x1b71d0=function(_0x45812a){while(--_0x45812a){_0x43e2e4['push'](_0x43e2e4['shift']());}};_0x1b71d0(++_0x4ad3b4);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x1c40db,_0x25fb29){_0x1c40db=_0x1c40db-0x0;var _0x283a4f=_0xfa2b[_0x1c40db];return _0x283a4f;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'body':{'type':Sequelize[_0xbfa2('0x2')](_0xbfa2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xbfa2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':_0xbfa2('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbfa2('0x7')]}}; \ No newline at end of file +var _0x202c=['BOOLEAN','ENUM','out','TEXT','DATE','sequelize','medium'];(function(_0x1f24f1,_0x3e1a96){var _0x5cdaa4=function(_0x5ae8d5){while(--_0x5ae8d5){_0x1f24f1['push'](_0x1f24f1['shift']());}};_0x5cdaa4(++_0x3e1a96);}(_0x202c,0x178));var _0xc202=function(_0x7a3f4,_0x1926c7){_0x7a3f4=_0x7a3f4-0x0;var _0x377f7b=_0x202c[_0x7a3f4];return _0x377f7b;};'use strict';var Sequelize=require(_0xc202('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xc202('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc202('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc202('0x3')]('in','out'),'defaultValue':_0xc202('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xc202('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xc202('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c79d071..4323e62 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 _0xd783=['ContactId','sequelize','SELECT','SIP/%s','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','catch','body','describe','accept','fax','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','isNil','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','fax-interactions','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xd783,0xa6));var _0x3d78=function(_0x513f27,_0x1cbc87){_0x513f27=_0x513f27-0x0;var _0xa316b7=_0xd783[_0x513f27];return _0xa316b7;};'use strict';var emlformat=require(_0x3d78('0x0'));var rimraf=require(_0x3d78('0x1'));var zipdir=require(_0x3d78('0x2'));var jsonpatch=require(_0x3d78('0x3'));var rp=require('request-promise');var moment=require(_0x3d78('0x4'));var BPromise=require(_0x3d78('0x5'));var Mustache=require('mustache');var util=require(_0x3d78('0x6'));var path=require(_0x3d78('0x7'));var sox=require(_0x3d78('0x8'));var csv=require(_0x3d78('0x9'));var ejs=require(_0x3d78('0xa'));var fs=require('fs');var fs_extra=require(_0x3d78('0xb'));var _=require(_0x3d78('0xc'));var squel=require(_0x3d78('0xd'));var crypto=require('crypto');var jsforce=require(_0x3d78('0xe'));var deskjs=require(_0x3d78('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3d78('0x10'));var Papa=require(_0x3d78('0x11'));var Redis=require(_0x3d78('0x12'));var authService=require(_0x3d78('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3d78('0x14'));var hardwareService=require(_0x3d78('0x15'));var logger=require(_0x3d78('0x16'))(_0x3d78('0x17'));var utils=require(_0x3d78('0x18'));var config=require(_0x3d78('0x19'));var licenseUtil=require(_0x3d78('0x1a'));var db=require(_0x3d78('0x1b'))['db'];config[_0x3d78('0x1c')]=_[_0x3d78('0x1d')](config[_0x3d78('0x1c')],{'host':_0x3d78('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d78('0x1c')]));require(_0x3d78('0x1f'))[_0x3d78('0x20')](socket);var jayson=require(_0x3d78('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0x3d78('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x350d52,_0x3a46ae,_0x4e2626,_0x386d29){return new BPromise(function(_0x427dd2,_0x30f383){var _0x587f35=_0x386d29||client;return _0x587f35['request'](_0x350d52,_0x4e2626)['then'](function(_0x125923){logger[_0x3d78('0x23')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x3d78('0x24'));logger[_0x3d78('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x3a46ae,_0x3d78('0x24'),JSON[_0x3d78('0x26')](_0x125923));if(_0x125923[_0x3d78('0x27')]){if(_0x125923[_0x3d78('0x27')][_0x3d78('0x28')]===0x1f4){logger[_0x3d78('0x27')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);return _0x30f383(_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);}logger['error'](_0x3d78('0x2a'),_0x3a46ae,_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);return _0x427dd2(_0x125923[_0x3d78('0x27')][_0x3d78('0x29')]);}else{logger[_0x3d78('0x23')](_0x3d78('0x2a'),_0x3a46ae,_0x3d78('0x24'));_0x427dd2(_0x125923[_0x3d78('0x2b')][_0x3d78('0x29')]);}})['catch'](function(_0x47f93b){logger[_0x3d78('0x27')]('FaxMessage,\x20%s,\x20%s',_0x3a46ae,_0x47f93b);_0x30f383(_0x47f93b);});});}function respondWithStatusCode(_0x194550,_0x2f5ecd){_0x2f5ecd=_0x2f5ecd||0xcc;return function(_0x189d50){if(_0x189d50){return _0x194550[_0x3d78('0x2c')](_0x2f5ecd);}return _0x194550['status'](_0x2f5ecd)[_0x3d78('0x2d')]();};}function respondWithResult(_0x3b7c93,_0x530471){_0x530471=_0x530471||0xc8;return function(_0x39d1ba){if(_0x39d1ba){return _0x3b7c93[_0x3d78('0x2e')](_0x530471)['json'](_0x39d1ba);}};}function respondWithFilteredResult(_0xbbec29,_0xc6e2b8){return function(_0x3f8c13){if(_0x3f8c13){var _0x38ae90=typeof _0xc6e2b8[_0x3d78('0x2f')]===_0x3d78('0x30')&&typeof _0xc6e2b8[_0x3d78('0x31')]===_0x3d78('0x30');var _0x18f979=_0x3f8c13[_0x3d78('0x32')];var _0x3b4491=_0x38ae90?0x0:_0xc6e2b8[_0x3d78('0x2f')];var _0x4da4e3=_0x38ae90?_0x3f8c13[_0x3d78('0x32')]:_0xc6e2b8[_0x3d78('0x2f')]+_0xc6e2b8[_0x3d78('0x31')];var _0x5f1d91;if(_0x4da4e3>=_0x18f979){_0x4da4e3=_0x18f979;_0x5f1d91=0xc8;}else{_0x5f1d91=0xce;}_0xbbec29['status'](_0x5f1d91);return _0xbbec29[_0x3d78('0x33')](_0x3d78('0x34'),_0x3b4491+'-'+_0x4da4e3+'/'+_0x18f979)[_0x3d78('0x35')](_0x3f8c13);}return null;};}function patchUpdates(_0x576ebe){return function(_0x19023d){try{jsonpatch[_0x3d78('0x36')](_0x19023d,_0x576ebe,!![]);}catch(_0x14683f){return BPromise[_0x3d78('0x37')](_0x14683f);}return _0x19023d['save']();};}function saveUpdates(_0x2c1a35,_0x3a05f1){return function(_0x5e0978){if(_0x5e0978){return _0x5e0978[_0x3d78('0x38')](_0x2c1a35)[_0x3d78('0x39')](function(_0x1638c6){return _0x1638c6;});}return null;};}function removeEntity(_0x24b924,_0x1c7a1f){return function(_0x432cbf){if(_0x432cbf){return _0x432cbf[_0x3d78('0x3a')]()['then'](function(){_0x24b924[_0x3d78('0x2e')](0xcc)[_0x3d78('0x2d')]();});}};}function handleEntityNotFound(_0x244e6c,_0x51d88d){return function(_0x2f0eea){if(!_0x2f0eea){_0x244e6c[_0x3d78('0x2c')](0x194);}return _0x2f0eea;};}function handleError(_0x182b1a,_0x104a90){_0x104a90=_0x104a90||0x1f4;return function(_0x2fa879){logger[_0x3d78('0x27')](_0x2fa879[_0x3d78('0x3b')]);if(_0x2fa879[_0x3d78('0x3c')]){delete _0x2fa879[_0x3d78('0x3c')];}_0x182b1a[_0x3d78('0x2e')](_0x104a90)[_0x3d78('0x3d')](_0x2fa879);};}exports[_0x3d78('0x3e')]=function(_0x1f695e,_0x40a3df){var _0x9f2778={},_0x1cd191={},_0x3c7468={'count':0x0,'rows':[]};var _0x4a4b86=_[_0x3d78('0x3f')](db[_0x3d78('0x40')][_0x3d78('0x41')],function(_0xbb97e6){return{'name':_0xbb97e6['fieldName'],'type':_0xbb97e6[_0x3d78('0x42')]['key']};});_0x1cd191['model']=_[_0x3d78('0x3f')](_0x4a4b86,'name');_0x1cd191[_0x3d78('0x43')]=_[_0x3d78('0x44')](_0x1f695e[_0x3d78('0x43')]);_0x1cd191['filters']=_[_0x3d78('0x45')](_0x1cd191[_0x3d78('0x46')],_0x1cd191[_0x3d78('0x43')]);_0x9f2778[_0x3d78('0x47')]=_[_0x3d78('0x45')](_0x1cd191[_0x3d78('0x46')],qs[_0x3d78('0x48')](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x48')]));_0x9f2778[_0x3d78('0x47')]=_0x9f2778['attributes']['length']?_0x9f2778[_0x3d78('0x47')]:_0x1cd191[_0x3d78('0x46')];if(!_0x1f695e['query'][_0x3d78('0x49')]('nolimit')){_0x9f2778['limit']=qs['limit'](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x31')]);_0x9f2778[_0x3d78('0x2f')]=qs['offset'](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x2f')]);}_0x9f2778[_0x3d78('0x4a')]=qs[_0x3d78('0x4b')](_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4b')]);_0x9f2778['where']=qs[_0x3d78('0x4c')](_[_0x3d78('0x4d')](_0x1f695e['query'],_0x1cd191[_0x3d78('0x4c')]),_0x4a4b86);if(_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4e')]){_0x9f2778[_0x3d78('0x4f')]=_[_0x3d78('0x50')](_0x9f2778['where'],{'$or':_['map'](_0x4a4b86,function(_0x491446){if(_0x491446[_0x3d78('0x42')]!==_0x3d78('0x51')){var _0x22dcf7={};_0x22dcf7[_0x491446['name']]={'$like':'%'+_0x1f695e[_0x3d78('0x43')][_0x3d78('0x4e')]+'%'};return _0x22dcf7;}})});}_0x9f2778=_['merge']({},_0x9f2778,_0x1f695e[_0x3d78('0x52')]);var _0x224f1b={'where':_0x9f2778['where']};return db[_0x3d78('0x40')][_0x3d78('0x32')](_0x224f1b)['then'](function(_0x1f340b){_0x3c7468[_0x3d78('0x32')]=_0x1f340b;if(_0x1f695e[_0x3d78('0x43')][_0x3d78('0x53')]){_0x9f2778['include']=[{'all':!![]}];}return db[_0x3d78('0x40')][_0x3d78('0x54')](_0x9f2778);})['then'](function(_0x2e61de){_0x3c7468[_0x3d78('0x55')]=_0x2e61de;return _0x3c7468;})[_0x3d78('0x39')](respondWithFilteredResult(_0x40a3df,_0x9f2778))['catch'](handleError(_0x40a3df,null));};exports[_0x3d78('0x56')]=function(_0x85e5c2,_0x48400d){var _0x35bdbe={'raw':!![],'where':{'id':_0x85e5c2[_0x3d78('0x57')]['id']}},_0x4edd11={};_0x4edd11['model']=_['keys'](db[_0x3d78('0x40')][_0x3d78('0x41')]);_0x4edd11[_0x3d78('0x43')]=_[_0x3d78('0x44')](_0x85e5c2[_0x3d78('0x43')]);_0x4edd11[_0x3d78('0x4c')]=_['intersection'](_0x4edd11[_0x3d78('0x46')],_0x4edd11[_0x3d78('0x43')]);_0x35bdbe['attributes']=_[_0x3d78('0x45')](_0x4edd11['model'],qs[_0x3d78('0x48')](_0x85e5c2[_0x3d78('0x43')]['fields']));_0x35bdbe[_0x3d78('0x47')]=_0x35bdbe[_0x3d78('0x47')][_0x3d78('0x58')]?_0x35bdbe['attributes']:_0x4edd11[_0x3d78('0x46')];if(_0x85e5c2[_0x3d78('0x43')][_0x3d78('0x53')]){_0x35bdbe[_0x3d78('0x59')]=[{'all':!![]}];}_0x35bdbe=_[_0x3d78('0x50')]({},_0x35bdbe,_0x85e5c2[_0x3d78('0x52')]);return db[_0x3d78('0x40')][_0x3d78('0x5a')](_0x35bdbe)[_0x3d78('0x39')](handleEntityNotFound(_0x48400d,null))[_0x3d78('0x39')](respondWithResult(_0x48400d,null))[_0x3d78('0x5b')](handleError(_0x48400d,null));};exports[_0x3d78('0x38')]=function(_0x266d45,_0x495775){if(_0x266d45[_0x3d78('0x5c')]['id']){delete _0x266d45[_0x3d78('0x5c')]['id'];}return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x266d45[_0x3d78('0x57')]['id']}})[_0x3d78('0x39')](handleEntityNotFound(_0x495775,null))['then'](saveUpdates(_0x266d45['body'],null))[_0x3d78('0x39')](respondWithResult(_0x495775,null))[_0x3d78('0x5b')](handleError(_0x495775,null));};exports[_0x3d78('0x3a')]=function(_0x2825f8,_0x1928a2){return db['FaxMessage'][_0x3d78('0x5a')]({'where':{'id':_0x2825f8[_0x3d78('0x57')]['id']}})[_0x3d78('0x39')](handleEntityNotFound(_0x1928a2,null))['then'](removeEntity(_0x1928a2,null))[_0x3d78('0x5b')](handleError(_0x1928a2,null));};exports[_0x3d78('0x5d')]=function(_0x41ebc5,_0x5f31c8){return db[_0x3d78('0x40')]['describe']()[_0x3d78('0x39')](respondWithResult(_0x5f31c8,null))['catch'](handleError(_0x5f31c8,null));};var interaction_log=require(_0x3d78('0x16'))('fax-interactions');exports[_0x3d78('0x5e')]=function(_0x45e803,_0xf8531e,_0x5552ce){var _0xb030d7={'agent':{},'channel':_0x3d78('0x5f')};if(_0x45e803[_0x3d78('0x5c')]['id']){delete _0x45e803[_0x3d78('0x5c')]['id'];}_0x45e803[_0x3d78('0x5c')]['read']=!![];_0x45e803[_0x3d78('0x5c')]['readAt']=moment()[_0x3d78('0x60')](_0x3d78('0x61'));_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')]=_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')]||_0x45e803[_0x3d78('0x63')]['id'];_0xb030d7[_0x3d78('0x64')]['id']=_0x45e803['body']['UserId'];return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x45e803['params']['id'],'UserId':null}})[_0x3d78('0x39')](handleEntityNotFound(_0xf8531e,null))['then'](saveUpdates(_0x45e803[_0x3d78('0x5c')],null))['then'](function(_0x437ee3){if(_0x437ee3){_0xb030d7[_0x3d78('0x29')]=_0x437ee3[_0x3d78('0x65')]({'plain':!![]});return db[_0x3d78('0x66')][_0x3d78('0x5a')]({'where':{'id':_0x437ee3['FaxInteractionId']}});}return null;})[_0x3d78('0x39')](handleEntityNotFound(_0xf8531e,null))[_0x3d78('0x39')](function(_0x1aa6c4){if(_0x1aa6c4){return _0x1aa6c4[_0x3d78('0x38')]({'UserId':_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')],'read1stAt':_[_0x3d78('0x67')](_0x1aa6c4[_0x3d78('0x68')])?moment()[_0x3d78('0x60')](_0x3d78('0x61')):undefined});}return null;})['then'](function(_0x50eea0){if(_0x50eea0){_0xb030d7[_0x3d78('0x69')]=_0x50eea0[_0x3d78('0x65')]({'plain':!![]});interaction_log[_0x3d78('0x23')](_0x3d78('0x6a'),_0x45e803[_0x3d78('0x63')]['id'],_0x45e803[_0x3d78('0x63')][_0x3d78('0x3c')],_0x45e803['user'][_0x3d78('0x6b')],_0xb030d7['interaction']['id'],_0x45e803['body']?JSON[_0x3d78('0x26')](_0x45e803['body']):_0x3d78('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x3d78('0x6d'),_0xb030d7);}return null;})[_0x3d78('0x39')](function(_0xd614e3){var _0x2ff266=_0x3d78('0x6e')+_0xd614e3[_0x3d78('0x29')]['ContactId'];return db['sequelize'][_0x3d78('0x43')](_0x2ff266,{'type':db['Sequelize'][_0x3d78('0x6f')]['SELECT'],'raw':!![]})[_0x3d78('0x39')](function(_0x5d5996){return _0x5d5996;});})[_0x3d78('0x39')](function(_0x1aa8e6){if(_0x1aa8e6){_0xb030d7[_0x3d78('0x29')][_0x3d78('0x70')]=_0x1aa8e6[0x0];if(!_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')])return;return db[_0x3d78('0x71')][_0x3d78('0x5a')]({'where':{'id':_0x45e803[_0x3d78('0x5c')][_0x3d78('0x62')],'role':'agent'},'attributes':['id',_0x3d78('0x3c'),_0x3d78('0x72'),_0x3d78('0x73'),_0x3d78('0x74')],'raw':!![]});}return null;})[_0x3d78('0x39')](function(_0x2c6b48){if(!_0x2c6b48)return null;_0xb030d7['message'][_0x3d78('0x64')]=_0x2c6b48;return _0xb030d7;})[_0x3d78('0x39')](function(_0x21e322){if(_0x21e322){if(_0x45e803[_0x3d78('0x5c')][_0x3d78('0x75')]){_0xb030d7[_0x3d78('0x29')][_0x3d78('0x76')]=util[_0x3d78('0x60')]('SIP/%s',_0x45e803[_0x3d78('0x63')][_0x3d78('0x3c')]);_0xb030d7['message'][_0x3d78('0x77')]=_0xb030d7[_0x3d78('0x77')];_0xb030d7['message'][_0x3d78('0x78')]=_0xb030d7[_0x3d78('0x77')];_0xb030d7['message'][_0x3d78('0x79')]=_0x3d78('0x5e');return respondWithRpcPromise(_0x3d78('0x7a'),_0x3d78('0x7a'),{'event':_0x3d78('0x7b'),'message':_0xb030d7[_0x3d78('0x29')]},client9002)[_0x3d78('0x39')](function(){return _0xb030d7;});}return _0xb030d7;}return null;})[_0x3d78('0x39')](respondWithResult(_0xf8531e,null))[_0x3d78('0x5b')](handleError(_0xf8531e,null));};var interaction_log=require(_0x3d78('0x16'))(_0x3d78('0x7c'));exports[_0x3d78('0x37')]=function(_0x112789,_0x381378,_0x14c0c9){var _0x175f7d={'agent':{},'channel':_0x3d78('0x5f')};if(_0x112789[_0x3d78('0x5c')]['id']){delete _0x112789['body']['id'];}_0x112789['body'][_0x3d78('0x62')]=_0x112789['body'][_0x3d78('0x62')]||_0x112789[_0x3d78('0x63')]['id'];_0x175f7d['agent']['id']=_0x112789[_0x3d78('0x5c')][_0x3d78('0x62')];return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x112789[_0x3d78('0x57')]['id'],'UserId':null}})[_0x3d78('0x39')](handleEntityNotFound(_0x381378,null))['then'](function(_0x43d374){if(_0x43d374){_0x175f7d[_0x3d78('0x29')]=_0x43d374[_0x3d78('0x65')]({'plain':!![]});return db[_0x3d78('0x66')][_0x3d78('0x5a')]({'where':{'id':_0x43d374[_0x3d78('0x7d')]}});}return null;})[_0x3d78('0x39')](handleEntityNotFound(_0x381378,null))[_0x3d78('0x39')](function(_0x10672f){if(_0x10672f){_0x175f7d[_0x3d78('0x69')]=_0x10672f['get']({'plain':!![]});interaction_log[_0x3d78('0x23')](_0x3d78('0x7e'),_0x112789[_0x3d78('0x63')]['id'],_0x112789[_0x3d78('0x63')][_0x3d78('0x3c')],_0x112789['user']['role'],_0x175f7d[_0x3d78('0x69')]['id'],_0x112789[_0x3d78('0x5c')]?JSON[_0x3d78('0x26')](_0x112789[_0x3d78('0x5c')]):_0x3d78('0x6c'));return respondWithRpcPromise('RejectMessage',_0x3d78('0x7f'),_0x175f7d);}return null;})[_0x3d78('0x39')](function(_0x29df89){var _0x58d6bb=_0x3d78('0x6e')+_0x29df89[_0x3d78('0x29')][_0x3d78('0x80')];return db[_0x3d78('0x81')][_0x3d78('0x43')](_0x58d6bb,{'type':db['Sequelize']['QueryTypes'][_0x3d78('0x82')],'raw':!![]})[_0x3d78('0x39')](function(_0x221cab){return _0x221cab;});})['then'](function(_0x1bce35){if(_0x1bce35){_0x175f7d[_0x3d78('0x29')][_0x3d78('0x70')]=_0x1bce35[0x0];if(!_0x112789[_0x3d78('0x5c')][_0x3d78('0x62')])return;return db[_0x3d78('0x71')]['find']({'where':{'id':_0x112789['body'][_0x3d78('0x62')],'role':_0x3d78('0x64')},'attributes':['id',_0x3d78('0x3c'),_0x3d78('0x72'),_0x3d78('0x73'),'internal'],'raw':!![]});}return null;})[_0x3d78('0x39')](function(_0x16f52f){if(!_0x16f52f)return null;_0x175f7d[_0x3d78('0x29')][_0x3d78('0x64')]=_0x16f52f;return _0x175f7d;})[_0x3d78('0x39')](function(_0xde69b8){if(_0xde69b8){_0xde69b8[_0x3d78('0x29')][_0x3d78('0x76')]=util[_0x3d78('0x60')](_0x3d78('0x83'),_0x112789[_0x3d78('0x63')][_0x3d78('0x3c')]);_0xde69b8[_0x3d78('0x29')]['channel']=_0x175f7d['channel'];_0xde69b8['message'][_0x3d78('0x78')]=_0x175f7d[_0x3d78('0x77')];_0xde69b8[_0x3d78('0x29')]['event']=_0x3d78('0x37');respondWithRpcPromise('EventManager','EventManager',{'event':_0x3d78('0x84'),'message':_0xde69b8['message']},client9002);return _0x175f7d;}return null;})[_0x3d78('0x39')](respondWithResult(_0x381378,null))[_0x3d78('0x5b')](handleError(_0x381378,null));};exports[_0x3d78('0x85')]=function(_0x29e200,_0x395ec2){var _0x8a6368;return db[_0x3d78('0x40')][_0x3d78('0x85')](_0x29e200['body'],{})[_0x3d78('0x39')](function(_0x12e45a){_0x8a6368=_0x12e45a;return db[_0x3d78('0x86')][_0x3d78('0x87')]({'where':{'id':_0x8a6368[_0x3d78('0x80')]}});})[_0x3d78('0x39')](function(_0xa41dca){if(_[_0x3d78('0x67')](_0xa41dca)){return;}else{_0x8a6368[_0x3d78('0x5f')]=_0xa41dca[_0x3d78('0x5f')];return db['Attachment']['findOne']({'where':{'id':_0x8a6368[_0x3d78('0x88')]}});}})[_0x3d78('0x39')](function(_0x10a6ea){return respondWithRpcPromise(_0x3d78('0x89'),_0x3d78('0x89'),{'FaxAccountId':_[_0x3d78('0x67')](_0x29e200[_0x3d78('0x5c')])?undefined:_0x29e200[_0x3d78('0x5c')][_0x3d78('0x8a')],'path':_[_0x3d78('0x67')](_0x10a6ea)?undefined:util[_0x3d78('0x60')](_0x3d78('0x8b'),_0x10a6ea[_0x3d78('0x8c')]),'fax':_[_0x3d78('0x67')](_0x8a6368[_0x3d78('0x5f')])?undefined:_0x8a6368[_0x3d78('0x5f')],'AttachmentId':_0x8a6368[_0x3d78('0x88')]},client9002);})[_0x3d78('0x39')](respondWithResult(_0x395ec2,0xc9))['catch'](handleError(_0x395ec2,null));};exports[_0x3d78('0x8d')]=function(_0x32cd87,_0x1e95ab){var _0x3ab6a2=path[_0x3d78('0x8e')](config['root'],_0x3d78('0x8f'),_0x3d78('0x90'),_0x3d78('0x91'));return db[_0x3d78('0x40')][_0x3d78('0x5a')]({'where':{'id':_0x32cd87['params']['id']},'include':[{'model':db['Attachment'],'as':_0x3d78('0x92')}]})[_0x3d78('0x39')](handleEntityNotFound(_0x1e95ab,null))['then'](function(_0x5644e3){if(_0x5644e3){return _0x1e95ab[_0x3d78('0x8d')](path[_0x3d78('0x8e')](_0x3ab6a2,_0x5644e3['Attachment'][_0x3d78('0x8c')]));}})[_0x3d78('0x5b')](handleError(_0x1e95ab,null));}; \ No newline at end of file +var _0x05f2=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','FaxMessage','includeAll','include','findAll','rows','catch','show','params','find','body','describe','fax-interactions','read','readAt','UserId','user','get','FaxInteractionId','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','download','root','server','files','attachments','join','basename'];(function(_0x22acac,_0x4f5d96){var _0x2ed42a=function(_0x2683ce){while(--_0x2683ce){_0x22acac['push'](_0x22acac['shift']());}};_0x2ed42a(++_0x4f5d96);}(_0x05f2,0x11a));var _0x205f=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x05f2[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x205f('0x0'));var rimraf=require(_0x205f('0x1'));var zipdir=require(_0x205f('0x2'));var jsonpatch=require(_0x205f('0x3'));var rp=require(_0x205f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x205f('0x5'));var util=require(_0x205f('0x6'));var path=require(_0x205f('0x7'));var sox=require(_0x205f('0x8'));var csv=require(_0x205f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x205f('0xa'));var squel=require(_0x205f('0xb'));var crypto=require(_0x205f('0xc'));var jsforce=require(_0x205f('0xd'));var deskjs=require(_0x205f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x205f('0xf'));var Papa=require(_0x205f('0x10'));var Redis=require('ioredis');var authService=require(_0x205f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x205f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x205f('0x13'))(_0x205f('0x14'));var utils=require('../../config/utils');var config=require(_0x205f('0x15'));var licenseUtil=require(_0x205f('0x16'));var db=require(_0x205f('0x17'))['db'];config[_0x205f('0x18')]=_[_0x205f('0x19')](config[_0x205f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x205f('0x1a'))(new Redis(config['redis']));require(_0x205f('0x1b'))[_0x205f('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x205f('0x1d')][_0x205f('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x205f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x306a5e,_0x31334b,_0x1c201b,_0x222bbc){return new BPromise(function(_0xe7258e,_0x4682aa){var _0xcec84b=_0x222bbc||client;return _0xcec84b[_0x205f('0x1f')](_0x306a5e,_0x1c201b)[_0x205f('0x20')](function(_0x5e9d31){logger[_0x205f('0x21')](_0x205f('0x22'),_0x31334b,_0x205f('0x23'));logger[_0x205f('0x24')](_0x205f('0x25'),_0x31334b,_0x205f('0x23'),JSON[_0x205f('0x26')](_0x5e9d31));if(_0x5e9d31[_0x205f('0x27')]){if(_0x5e9d31[_0x205f('0x27')][_0x205f('0x28')]===0x1f4){logger[_0x205f('0x27')](_0x205f('0x22'),_0x31334b,_0x5e9d31['error'][_0x205f('0x29')]);return _0x4682aa(_0x5e9d31[_0x205f('0x27')][_0x205f('0x29')]);}logger[_0x205f('0x27')]('FaxMessage,\x20%s,\x20%s',_0x31334b,_0x5e9d31[_0x205f('0x27')][_0x205f('0x29')]);return _0xe7258e(_0x5e9d31['error'][_0x205f('0x29')]);}else{logger[_0x205f('0x21')](_0x205f('0x22'),_0x31334b,_0x205f('0x23'));_0xe7258e(_0x5e9d31['result']['message']);}})['catch'](function(_0x6b4081){logger['error'](_0x205f('0x22'),_0x31334b,_0x6b4081);_0x4682aa(_0x6b4081);});});}function respondWithStatusCode(_0x30c6b8,_0x320226){_0x320226=_0x320226||0xcc;return function(_0xbd6606){if(_0xbd6606){return _0x30c6b8[_0x205f('0x2a')](_0x320226);}return _0x30c6b8[_0x205f('0x2b')](_0x320226)[_0x205f('0x2c')]();};}function respondWithResult(_0x485a93,_0x51c52f){_0x51c52f=_0x51c52f||0xc8;return function(_0x1c2a12){if(_0x1c2a12){return _0x485a93[_0x205f('0x2b')](_0x51c52f)[_0x205f('0x2d')](_0x1c2a12);}};}function respondWithFilteredResult(_0x234172,_0xc4d41){return function(_0x1401b8){if(_0x1401b8){var _0x4ee251=typeof _0xc4d41[_0x205f('0x2e')]===_0x205f('0x2f')&&typeof _0xc4d41[_0x205f('0x30')]==='undefined';var _0x36f0d4=_0x1401b8[_0x205f('0x31')];var _0x56c21c=_0x4ee251?0x0:_0xc4d41[_0x205f('0x2e')];var _0x9303cc=_0x4ee251?_0x1401b8['count']:_0xc4d41['offset']+_0xc4d41[_0x205f('0x30')];var _0x3ca1d8;if(_0x9303cc>=_0x36f0d4){_0x9303cc=_0x36f0d4;_0x3ca1d8=0xc8;}else{_0x3ca1d8=0xce;}_0x234172[_0x205f('0x2b')](_0x3ca1d8);return _0x234172['set']('Content-Range',_0x56c21c+'-'+_0x9303cc+'/'+_0x36f0d4)[_0x205f('0x2d')](_0x1401b8);}return null;};}function patchUpdates(_0xe4a96e){return function(_0x35d187){try{jsonpatch['apply'](_0x35d187,_0xe4a96e,!![]);}catch(_0x179e62){return BPromise[_0x205f('0x32')](_0x179e62);}return _0x35d187[_0x205f('0x33')]();};}function saveUpdates(_0x412ceb,_0x48902d){return function(_0x371d83){if(_0x371d83){return _0x371d83[_0x205f('0x34')](_0x412ceb)[_0x205f('0x20')](function(_0x2f4a58){return _0x2f4a58;});}return null;};}function removeEntity(_0x165131,_0x48e99d){return function(_0x5113a3){if(_0x5113a3){return _0x5113a3[_0x205f('0x35')]()[_0x205f('0x20')](function(){_0x165131[_0x205f('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35290b,_0x46aa96){return function(_0x207381){if(!_0x207381){_0x35290b['sendStatus'](0x194);}return _0x207381;};}function handleError(_0xda83b4,_0x4bec7c){_0x4bec7c=_0x4bec7c||0x1f4;return function(_0x462a2c){logger[_0x205f('0x27')](_0x462a2c[_0x205f('0x36')]);if(_0x462a2c[_0x205f('0x37')]){delete _0x462a2c['name'];}_0xda83b4['status'](_0x4bec7c)['send'](_0x462a2c);};}exports['index']=function(_0x4cd2f5,_0x4a3a03){var _0x5e6f35={},_0x2acfe6={},_0x23c72e={'count':0x0,'rows':[]};var _0x54289a=_[_0x205f('0x38')](db['FaxMessage'][_0x205f('0x39')],function(_0xed7c04){return{'name':_0xed7c04[_0x205f('0x3a')],'type':_0xed7c04[_0x205f('0x3b')][_0x205f('0x3c')]};});_0x2acfe6['model']=_[_0x205f('0x38')](_0x54289a,'name');_0x2acfe6[_0x205f('0x3d')]=_[_0x205f('0x3e')](_0x4cd2f5[_0x205f('0x3d')]);_0x2acfe6[_0x205f('0x3f')]=_[_0x205f('0x40')](_0x2acfe6[_0x205f('0x41')],_0x2acfe6[_0x205f('0x3d')]);_0x5e6f35[_0x205f('0x42')]=_['intersection'](_0x2acfe6[_0x205f('0x41')],qs[_0x205f('0x43')](_0x4cd2f5[_0x205f('0x3d')][_0x205f('0x43')]));_0x5e6f35[_0x205f('0x42')]=_0x5e6f35[_0x205f('0x42')][_0x205f('0x44')]?_0x5e6f35[_0x205f('0x42')]:_0x2acfe6[_0x205f('0x41')];if(!_0x4cd2f5[_0x205f('0x3d')][_0x205f('0x45')]('nolimit')){_0x5e6f35[_0x205f('0x30')]=qs['limit'](_0x4cd2f5[_0x205f('0x3d')][_0x205f('0x30')]);_0x5e6f35[_0x205f('0x2e')]=qs['offset'](_0x4cd2f5['query']['offset']);}_0x5e6f35[_0x205f('0x46')]=qs[_0x205f('0x47')](_0x4cd2f5['query'][_0x205f('0x47')]);_0x5e6f35[_0x205f('0x48')]=qs[_0x205f('0x3f')](_[_0x205f('0x49')](_0x4cd2f5[_0x205f('0x3d')],_0x2acfe6[_0x205f('0x3f')]),_0x54289a);if(_0x4cd2f5['query'][_0x205f('0x4a')]){_0x5e6f35[_0x205f('0x48')]=_[_0x205f('0x4b')](_0x5e6f35[_0x205f('0x48')],{'$or':_['map'](_0x54289a,function(_0x31bf9b){if(_0x31bf9b[_0x205f('0x3b')]!=='VIRTUAL'){var _0x2944cd={};_0x2944cd[_0x31bf9b[_0x205f('0x37')]]={'$like':'%'+_0x4cd2f5['query'][_0x205f('0x4a')]+'%'};return _0x2944cd;}})});}_0x5e6f35=_[_0x205f('0x4b')]({},_0x5e6f35,_0x4cd2f5[_0x205f('0x4c')]);var _0x37a7b6={'where':_0x5e6f35[_0x205f('0x48')]};return db[_0x205f('0x4d')]['count'](_0x37a7b6)['then'](function(_0x46b558){_0x23c72e[_0x205f('0x31')]=_0x46b558;if(_0x4cd2f5[_0x205f('0x3d')][_0x205f('0x4e')]){_0x5e6f35[_0x205f('0x4f')]=[{'all':!![]}];}return db[_0x205f('0x4d')][_0x205f('0x50')](_0x5e6f35);})[_0x205f('0x20')](function(_0x3576db){_0x23c72e[_0x205f('0x51')]=_0x3576db;return _0x23c72e;})['then'](respondWithFilteredResult(_0x4a3a03,_0x5e6f35))[_0x205f('0x52')](handleError(_0x4a3a03,null));};exports[_0x205f('0x53')]=function(_0x173653,_0x4b0dc7){var _0x2bb488={'raw':!![],'where':{'id':_0x173653[_0x205f('0x54')]['id']}},_0x2e966e={};_0x2e966e[_0x205f('0x41')]=_[_0x205f('0x3e')](db['FaxMessage']['rawAttributes']);_0x2e966e[_0x205f('0x3d')]=_[_0x205f('0x3e')](_0x173653['query']);_0x2e966e['filters']=_[_0x205f('0x40')](_0x2e966e['model'],_0x2e966e[_0x205f('0x3d')]);_0x2bb488[_0x205f('0x42')]=_[_0x205f('0x40')](_0x2e966e[_0x205f('0x41')],qs['fields'](_0x173653['query'][_0x205f('0x43')]));_0x2bb488[_0x205f('0x42')]=_0x2bb488['attributes'][_0x205f('0x44')]?_0x2bb488[_0x205f('0x42')]:_0x2e966e[_0x205f('0x41')];if(_0x173653['query'][_0x205f('0x4e')]){_0x2bb488[_0x205f('0x4f')]=[{'all':!![]}];}_0x2bb488=_['merge']({},_0x2bb488,_0x173653[_0x205f('0x4c')]);return db[_0x205f('0x4d')][_0x205f('0x55')](_0x2bb488)['then'](handleEntityNotFound(_0x4b0dc7,null))[_0x205f('0x20')](respondWithResult(_0x4b0dc7,null))[_0x205f('0x52')](handleError(_0x4b0dc7,null));};exports[_0x205f('0x34')]=function(_0x4c000c,_0x52a79c){if(_0x4c000c[_0x205f('0x56')]['id']){delete _0x4c000c[_0x205f('0x56')]['id'];}return db[_0x205f('0x4d')]['find']({'where':{'id':_0x4c000c[_0x205f('0x54')]['id']}})[_0x205f('0x20')](handleEntityNotFound(_0x52a79c,null))[_0x205f('0x20')](saveUpdates(_0x4c000c[_0x205f('0x56')],null))[_0x205f('0x20')](respondWithResult(_0x52a79c,null))[_0x205f('0x52')](handleError(_0x52a79c,null));};exports[_0x205f('0x35')]=function(_0x39d499,_0x33ad4d){return db[_0x205f('0x4d')][_0x205f('0x55')]({'where':{'id':_0x39d499['params']['id']}})[_0x205f('0x20')](handleEntityNotFound(_0x33ad4d,null))[_0x205f('0x20')](removeEntity(_0x33ad4d,null))[_0x205f('0x52')](handleError(_0x33ad4d,null));};exports[_0x205f('0x57')]=function(_0x275824,_0x3f13f1){return db['FaxMessage'][_0x205f('0x57')]()[_0x205f('0x20')](respondWithResult(_0x3f13f1,null))[_0x205f('0x52')](handleError(_0x3f13f1,null));};var interaction_log=require(_0x205f('0x13'))(_0x205f('0x58'));exports['accept']=function(_0x1bd0bf,_0x32835d,_0x49529d){var _0x23e9cb={'agent':{},'channel':'fax'};if(_0x1bd0bf[_0x205f('0x56')]['id']){delete _0x1bd0bf[_0x205f('0x56')]['id'];}_0x1bd0bf[_0x205f('0x56')][_0x205f('0x59')]=!![];_0x1bd0bf[_0x205f('0x56')][_0x205f('0x5a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1bd0bf[_0x205f('0x56')][_0x205f('0x5b')]=_0x1bd0bf[_0x205f('0x56')][_0x205f('0x5b')]||_0x1bd0bf[_0x205f('0x5c')]['id'];_0x23e9cb['agent']['id']=_0x1bd0bf['body'][_0x205f('0x5b')];return db['FaxMessage'][_0x205f('0x55')]({'where':{'id':_0x1bd0bf['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x32835d,null))['then'](saveUpdates(_0x1bd0bf[_0x205f('0x56')],null))[_0x205f('0x20')](function(_0x30bd57){if(_0x30bd57){_0x23e9cb[_0x205f('0x29')]=_0x30bd57[_0x205f('0x5d')]({'plain':!![]});return db['FaxInteraction'][_0x205f('0x55')]({'where':{'id':_0x30bd57[_0x205f('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x32835d,null))[_0x205f('0x20')](function(_0x460454){if(_0x460454){return _0x460454[_0x205f('0x34')]({'UserId':_0x1bd0bf[_0x205f('0x56')][_0x205f('0x5b')],'read1stAt':_[_0x205f('0x5f')](_0x460454[_0x205f('0x60')])?moment()[_0x205f('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x125894){if(_0x125894){_0x23e9cb[_0x205f('0x62')]=_0x125894[_0x205f('0x5d')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1bd0bf[_0x205f('0x5c')]['id'],_0x1bd0bf[_0x205f('0x5c')][_0x205f('0x37')],_0x1bd0bf[_0x205f('0x5c')][_0x205f('0x63')],_0x23e9cb[_0x205f('0x62')]['id'],_0x1bd0bf[_0x205f('0x56')]?JSON['stringify'](_0x1bd0bf[_0x205f('0x56')]):_0x205f('0x64'));return respondWithRpcPromise(_0x205f('0x65'),_0x205f('0x66'),_0x23e9cb);}return null;})[_0x205f('0x20')](function(_0x200d7d){var _0x7ac615=_0x205f('0x67')+_0x200d7d[_0x205f('0x29')][_0x205f('0x68')];return db[_0x205f('0x69')][_0x205f('0x3d')](_0x7ac615,{'type':db[_0x205f('0x6a')][_0x205f('0x6b')][_0x205f('0x6c')],'raw':!![]})[_0x205f('0x20')](function(_0x456452){return _0x456452;});})[_0x205f('0x20')](function(_0x3f671a){if(_0x3f671a){_0x23e9cb[_0x205f('0x29')][_0x205f('0x6d')]=_0x3f671a[0x0];if(!_0x1bd0bf[_0x205f('0x56')]['UserId'])return;return db[_0x205f('0x6e')][_0x205f('0x55')]({'where':{'id':_0x1bd0bf['body'][_0x205f('0x5b')],'role':_0x205f('0x6f')},'attributes':['id',_0x205f('0x37'),_0x205f('0x70'),_0x205f('0x71'),_0x205f('0x72')],'raw':!![]});}return null;})[_0x205f('0x20')](function(_0x566451){if(!_0x566451)return null;_0x23e9cb[_0x205f('0x29')]['agent']=_0x566451;return _0x23e9cb;})[_0x205f('0x20')](function(_0x518eb4){if(_0x518eb4){if(_0x1bd0bf['body'][_0x205f('0x73')]){_0x23e9cb[_0x205f('0x29')][_0x205f('0x74')]=util[_0x205f('0x61')](_0x205f('0x75'),_0x1bd0bf[_0x205f('0x5c')]['name']);_0x23e9cb['message'][_0x205f('0x76')]=_0x23e9cb[_0x205f('0x76')];_0x23e9cb[_0x205f('0x29')][_0x205f('0x77')]=_0x23e9cb[_0x205f('0x76')];_0x23e9cb['message'][_0x205f('0x78')]=_0x205f('0x79');return respondWithRpcPromise(_0x205f('0x7a'),_0x205f('0x7a'),{'event':_0x205f('0x7b'),'message':_0x23e9cb[_0x205f('0x29')]},client9002)[_0x205f('0x20')](function(){return _0x23e9cb;});}return _0x23e9cb;}return null;})[_0x205f('0x20')](respondWithResult(_0x32835d,null))[_0x205f('0x52')](handleError(_0x32835d,null));};var interaction_log=require(_0x205f('0x13'))(_0x205f('0x58'));exports[_0x205f('0x32')]=function(_0x448a2,_0x330e4a,_0x1bc93c){var _0x2fcff9={'agent':{},'channel':_0x205f('0x7c')};if(_0x448a2[_0x205f('0x56')]['id']){delete _0x448a2[_0x205f('0x56')]['id'];}_0x448a2[_0x205f('0x56')]['UserId']=_0x448a2[_0x205f('0x56')][_0x205f('0x5b')]||_0x448a2[_0x205f('0x5c')]['id'];_0x2fcff9[_0x205f('0x6f')]['id']=_0x448a2[_0x205f('0x56')][_0x205f('0x5b')];return db[_0x205f('0x4d')][_0x205f('0x55')]({'where':{'id':_0x448a2['params']['id'],'UserId':null}})[_0x205f('0x20')](handleEntityNotFound(_0x330e4a,null))[_0x205f('0x20')](function(_0x2e9e51){if(_0x2e9e51){_0x2fcff9['message']=_0x2e9e51['get']({'plain':!![]});return db[_0x205f('0x7d')]['find']({'where':{'id':_0x2e9e51[_0x205f('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x330e4a,null))[_0x205f('0x20')](function(_0x396e23){if(_0x396e23){_0x2fcff9['interaction']=_0x396e23['get']({'plain':!![]});interaction_log[_0x205f('0x21')](_0x205f('0x7e'),_0x448a2['user']['id'],_0x448a2[_0x205f('0x5c')][_0x205f('0x37')],_0x448a2[_0x205f('0x5c')][_0x205f('0x63')],_0x2fcff9[_0x205f('0x62')]['id'],_0x448a2[_0x205f('0x56')]?JSON[_0x205f('0x26')](_0x448a2[_0x205f('0x56')]):'null');return respondWithRpcPromise(_0x205f('0x7f'),'rejectMessage',_0x2fcff9);}return null;})['then'](function(_0x8c31){var _0x52d636=_0x205f('0x67')+_0x8c31[_0x205f('0x29')][_0x205f('0x68')];return db[_0x205f('0x69')][_0x205f('0x3d')](_0x52d636,{'type':db[_0x205f('0x6a')][_0x205f('0x6b')][_0x205f('0x6c')],'raw':!![]})[_0x205f('0x20')](function(_0x3e1723){return _0x3e1723;});})[_0x205f('0x20')](function(_0x2ce0be){if(_0x2ce0be){_0x2fcff9[_0x205f('0x29')][_0x205f('0x6d')]=_0x2ce0be[0x0];if(!_0x448a2['body'][_0x205f('0x5b')])return;return db[_0x205f('0x6e')][_0x205f('0x55')]({'where':{'id':_0x448a2[_0x205f('0x56')][_0x205f('0x5b')],'role':_0x205f('0x6f')},'attributes':['id',_0x205f('0x37'),'fullname',_0x205f('0x71'),'internal'],'raw':!![]});}return null;})[_0x205f('0x20')](function(_0x1be8fe){if(!_0x1be8fe)return null;_0x2fcff9[_0x205f('0x29')][_0x205f('0x6f')]=_0x1be8fe;return _0x2fcff9;})['then'](function(_0x351c3f){if(_0x351c3f){_0x351c3f[_0x205f('0x29')][_0x205f('0x74')]=util['format'](_0x205f('0x75'),_0x448a2[_0x205f('0x5c')][_0x205f('0x37')]);_0x351c3f[_0x205f('0x29')][_0x205f('0x76')]=_0x2fcff9[_0x205f('0x76')];_0x351c3f[_0x205f('0x29')][_0x205f('0x77')]=_0x2fcff9['channel'];_0x351c3f[_0x205f('0x29')][_0x205f('0x78')]='reject';respondWithRpcPromise(_0x205f('0x7a'),_0x205f('0x7a'),{'event':'rejectmessage','message':_0x351c3f[_0x205f('0x29')]},client9002);return _0x2fcff9;}return null;})[_0x205f('0x20')](respondWithResult(_0x330e4a,null))['catch'](handleError(_0x330e4a,null));};exports[_0x205f('0x80')]=function(_0x4815e9,_0x55ecb5){var _0x513f1a;return db['FaxMessage'][_0x205f('0x80')](_0x4815e9[_0x205f('0x56')],{})['then'](function(_0xc2db3d){_0x513f1a=_0xc2db3d;return db[_0x205f('0x81')][_0x205f('0x82')]({'where':{'id':_0x513f1a[_0x205f('0x68')]}});})[_0x205f('0x20')](function(_0x12d186){if(_[_0x205f('0x5f')](_0x12d186)){return;}else{_0x513f1a[_0x205f('0x7c')]=_0x12d186['fax'];return db[_0x205f('0x83')][_0x205f('0x82')]({'where':{'id':_0x513f1a[_0x205f('0x84')]}});}})['then'](function(_0x530535){return respondWithRpcPromise(_0x205f('0x85'),_0x205f('0x85'),{'FaxAccountId':_[_0x205f('0x5f')](_0x4815e9[_0x205f('0x56')])?undefined:_0x4815e9[_0x205f('0x56')]['FaxAccountId'],'path':_[_0x205f('0x5f')](_0x530535)?undefined:util[_0x205f('0x61')]('/var/opt/motion2/server/files/attachments/%s',_0x530535['basename']),'fax':_[_0x205f('0x5f')](_0x513f1a['fax'])?undefined:_0x513f1a[_0x205f('0x7c')],'AttachmentId':_0x513f1a['AttachmentId']},client9002);})[_0x205f('0x20')](respondWithResult(_0x55ecb5,0xc9))['catch'](handleError(_0x55ecb5,null));};exports[_0x205f('0x86')]=function(_0x5b8f98,_0x5ee30a){var _0x123c11=path['join'](config[_0x205f('0x87')],_0x205f('0x88'),_0x205f('0x89'),_0x205f('0x8a'));return db['FaxMessage'][_0x205f('0x55')]({'where':{'id':_0x5b8f98[_0x205f('0x54')]['id']},'include':[{'model':db[_0x205f('0x83')],'as':_0x205f('0x83')}]})[_0x205f('0x20')](handleEntityNotFound(_0x5ee30a,null))[_0x205f('0x20')](function(_0x1d6e11){if(_0x1d6e11){return _0x5ee30a[_0x205f('0x86')](path[_0x205f('0x8b')](_0x123c11,_0x1d6e11[_0x205f('0x83')][_0x205f('0x8c')]));}})[_0x205f('0x52')](handleError(_0x5ee30a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 50cdaf2..7937a94 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 _0x8110=['update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x2f3ed6,_0x4913ea){var _0x3ba5c8=function(_0x485b44){while(--_0x485b44){_0x2f3ed6['push'](_0x2f3ed6['shift']());}};_0x3ba5c8(++_0x4913ea);}(_0x8110,0x185));var _0x0811=function(_0x23377a,_0x4c7e0a){_0x23377a=_0x23377a-0x0;var _0x421693=_0x8110[_0x23377a];return _0x421693;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x0811('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0811('0x1'),'afterDestroy':'remove'};function emitEvent(_0x16057f){return function(_0x266310,_0x424170,_0x419fd7){FaxMessageEvents[_0x0811('0x2')](_0x16057f+':'+_0x266310['id'],_0x266310);FaxMessageEvents['emit'](_0x16057f,_0x266310);_0x419fd7(null);};}for(var e in events){if(events[_0x0811('0x3')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x0811('0x4')]=FaxMessageEvents; \ No newline at end of file +var _0xb073=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3c6a0e,_0x37245a){var _0x1ec0d1=function(_0x560a38){while(--_0x560a38){_0x3c6a0e['push'](_0x3c6a0e['shift']());}};_0x1ec0d1(++_0x37245a);}(_0xb073,0x187));var _0x3b07=function(_0x169536,_0x13a779){_0x169536=_0x169536-0x0;var _0x484af7=_0xb073[_0x169536];return _0x484af7;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x3b07('0x0'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x3b07('0x1')](0x0);var events={'afterCreate':_0x3b07('0x2'),'afterUpdate':_0x3b07('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3d1733){return function(_0x3112da,_0x31e382,_0x48cf22){FaxMessageEvents[_0x3b07('0x4')](_0x3d1733+':'+_0x3112da['id'],_0x3112da);FaxMessageEvents[_0x3b07('0x4')](_0x3d1733,_0x3112da);_0x48cf22(null);};}for(var e in events){if(events[_0x3b07('0x5')](e)){var event=events[e];FaxMessage[_0x3b07('0x6')](e,emitEvent(event));}}module[_0x3b07('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 8b62953..62301ab 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 _0xa643=['path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','body','FULLTEXT','get','toLowerCase','direction','secret','isNil','then','update','createdAt','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1d02e4,_0x70ad69){var _0x1fecbe=function(_0x14f637){while(--_0x14f637){_0x1d02e4['push'](_0x1d02e4['shift']());}};_0x1fecbe(++_0x70ad69);}(_0xa643,0xa9));var _0x3a64=function(_0x1062c2,_0x2bd58a){_0x1062c2=_0x1062c2-0x0;var _0x271448=_0xa643[_0x1062c2];return _0x271448;};'use strict';var _=require(_0x3a64('0x0'));var util=require(_0x3a64('0x1'));var logger=require('../../config/logger')(_0x3a64('0x2'));var moment=require(_0x3a64('0x3'));var BPromise=require(_0x3a64('0x4'));var rp=require(_0x3a64('0x5'));var fs=require('fs');var path=require(_0x3a64('0x6'));var rimraf=require(_0x3a64('0x7'));var config=require(_0x3a64('0x8'));var attributes=require(_0x3a64('0x9'));module[_0x3a64('0xa')]=function(_0xdb084c,_0x5045a0){return _0xdb084c['define']('FaxMessage',attributes,{'tableName':_0x3a64('0xb'),'paranoid':![],'indexes':[{'name':_0x3a64('0xc'),'fields':[_0x3a64('0xd')],'type':_0x3a64('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x445f09,_0x288f3f,_0xc30326){var _0x337dca=_0xdb084c['models'];var _0x991676=_0x445f09[_0x3a64('0xf')]({'plain':!![]});if(_0x991676['direction'][_0x3a64('0x10')]()==='in'||_0x991676[_0x3a64('0x11')]['toLowerCase']()==='out'&&!_0x991676[_0x3a64('0x12')]&&!_[_0x3a64('0x13')](_0x991676['UserId'])){_0x337dca['FaxInteraction']['findOne']({'where':{'id':_0x991676['FaxInteractionId']}})[_0x3a64('0x14')](function(_0x1e56c9){if(_0x1e56c9){_0x1e56c9[_0x3a64('0x15')]({'lastMsgAt':_0x991676[_0x3a64('0x16')],'lastMsgDirection':_0x991676[_0x3a64('0x11')][_0x3a64('0x10')]()});}})['catch'](function(_0x222f1c){console[_0x3a64('0x17')](_0x222f1c);});}_0xc30326();}},'charset':_0x3a64('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb88b=['FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','models','get','direction','toLowerCase','out','isNil','UserId'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0xb88b,0x175));var _0xbb88=function(_0x3684c5,_0x4b468c){_0x3684c5=_0x3684c5-0x0;var _0x268f1d=_0xb88b[_0x3684c5];return _0x268f1d;};'use strict';var _=require(_0xbb88('0x0'));var util=require(_0xbb88('0x1'));var logger=require('../../config/logger')(_0xbb88('0x2'));var moment=require('moment');var BPromise=require(_0xbb88('0x3'));var rp=require(_0xbb88('0x4'));var fs=require('fs');var path=require(_0xbb88('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbb88('0x6'));module[_0xbb88('0x7')]=function(_0x47e206,_0x518777){return _0x47e206[_0xbb88('0x8')](_0xbb88('0x9'),attributes,{'tableName':_0xbb88('0xa'),'paranoid':![],'indexes':[{'name':_0xbb88('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x530a80,_0x53e25b,_0x5adbc7){var _0x45fa67=_0x47e206[_0xbb88('0xc')];var _0x513353=_0x530a80[_0xbb88('0xd')]({'plain':!![]});if(_0x513353[_0xbb88('0xe')][_0xbb88('0xf')]()==='in'||_0x513353[_0xbb88('0xe')][_0xbb88('0xf')]()===_0xbb88('0x10')&&!_0x513353['secret']&&!_[_0xbb88('0x11')](_0x513353[_0xbb88('0x12')])){_0x45fa67[_0xbb88('0x13')][_0xbb88('0x14')]({'where':{'id':_0x513353[_0xbb88('0x15')]}})[_0xbb88('0x16')](function(_0x58adc4){if(_0x58adc4){_0x58adc4['update']({'lastMsgAt':_0x513353[_0xbb88('0x17')],'lastMsgDirection':_0x513353[_0xbb88('0xe')][_0xbb88('0xf')]()});}})[_0xbb88('0x18')](function(_0x34c116){console[_0xbb88('0x19')](_0x34c116);});}_0x5adbc7();}},'charset':_0xbb88('0x1a'),'collate':_0xbb88('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c195576..6ad3a78 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 _0x2dae=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxMessage,\x20%s,\x20%s','result','catch','CreateFaxMessage','FaxMessage','create','body','options','debug','UpdateFaxMessage','update','raw','attributes'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x2dae,0xc3));var _0xe2da=function(_0x2bf466,_0x4929a5){_0x2bf466=_0x2bf466-0x0;var _0x856885=_0x2dae[_0x2bf466];return _0x856885;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var moment=require(_0xe2da('0x1'));var BPromise=require(_0xe2da('0x2'));var rs=require(_0xe2da('0x3'));var fs=require('fs');var Redis=require(_0xe2da('0x4'));var db=require(_0xe2da('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe2da('0x6'))(_0xe2da('0x7'));var config=require(_0xe2da('0x8'));var jayson=require(_0xe2da('0x9'));var client=jayson['client'][_0xe2da('0xa')]({'port':0x232a});config[_0xe2da('0xb')]=_[_0xe2da('0xc')](config[_0xe2da('0xb')],{'host':_0xe2da('0xd'),'port':0x18eb});var socket=require(_0xe2da('0xe'))(new Redis(config[_0xe2da('0xb')]));require(_0xe2da('0xf'))[_0xe2da('0x10')](socket);function respondWithRpcPromise(_0x5a2fc5,_0x52e650,_0x3baaa8){return new BPromise(function(_0x104fb3,_0x17086c){return client[_0xe2da('0x11')](_0x5a2fc5,_0x3baaa8)[_0xe2da('0x12')](function(_0x1a29b9){logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));logger['debug'](_0xe2da('0x15'),_0x52e650,_0xe2da('0x14'),JSON[_0xe2da('0x16')](_0x1a29b9));if(_0x1a29b9[_0xe2da('0x17')]){if(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x18')]===0x1f4){logger[_0xe2da('0x17')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0x1a29b9[_0xe2da('0x17')]['message']);return _0x17086c(_0x1a29b9['error'][_0xe2da('0x19')]);}logger[_0xe2da('0x17')](_0xe2da('0x1a'),_0x52e650,_0x1a29b9['error'][_0xe2da('0x19')]);return _0x104fb3(_0x1a29b9[_0xe2da('0x17')][_0xe2da('0x19')]);}else{logger[_0xe2da('0x13')]('FaxMessage,\x20%s,\x20%s',_0x52e650,_0xe2da('0x14'));_0x104fb3(_0x1a29b9[_0xe2da('0x1b')][_0xe2da('0x19')]);}})[_0xe2da('0x1c')](function(_0x329ffe){logger['error'](_0xe2da('0x1a'),_0x52e650,_0x329ffe);_0x17086c(_0x329ffe);});});}exports[_0xe2da('0x1d')]=function(_0x538d96){var _0x1a9324=this;return new Promise(function(_0x254b37,_0x332193){return db[_0xe2da('0x1e')][_0xe2da('0x1f')](_0x538d96[_0xe2da('0x20')],{'raw':_0x538d96['options']?_0x538d96[_0xe2da('0x21')]['raw']===undefined?!![]:![]:!![]})[_0xe2da('0x12')](function(_0x191d38){logger[_0xe2da('0x13')](_0xe2da('0x1d'),_0x538d96);logger[_0xe2da('0x22')](_0xe2da('0x1d'),_0x538d96,JSON[_0xe2da('0x16')](_0x191d38));_0x254b37(_0x191d38);})[_0xe2da('0x1c')](function(_0x5a08d6){logger[_0xe2da('0x17')](_0xe2da('0x1d'),_0x5a08d6[_0xe2da('0x19')],_0x538d96);_0x332193(_0x1a9324[_0xe2da('0x17')](0x1f4,_0x5a08d6[_0xe2da('0x19')]));});});};exports[_0xe2da('0x23')]=function(_0x124d93){var _0x56c37e=this;return new Promise(function(_0x2adc49,_0x3e23d7){return db[_0xe2da('0x1e')][_0xe2da('0x24')](_0x124d93[_0xe2da('0x20')],{'raw':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x124d93['options']?_0x124d93['options']['where']||null:null,'attributes':_0x124d93[_0xe2da('0x21')]?_0x124d93[_0xe2da('0x21')][_0xe2da('0x26')]||null:null,'limit':_0x124d93[_0xe2da('0x21')]?_0x124d93['options']['limit']||null:null})[_0xe2da('0x12')](function(_0x1ec8ca){logger[_0xe2da('0x13')](_0xe2da('0x23'),_0x124d93);logger[_0xe2da('0x22')](_0xe2da('0x23'),_0x124d93,JSON[_0xe2da('0x16')](_0x1ec8ca));_0x2adc49(_0x1ec8ca);})[_0xe2da('0x1c')](function(_0x461610){logger['error']('UpdateFaxMessage',_0x461610[_0xe2da('0x19')],_0x124d93);_0x3e23d7(_0x56c37e[_0xe2da('0x17')](0x1f4,_0x461610[_0xe2da('0x19')]));});});}; \ No newline at end of file +var _0xdace=['FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./faxMessage.socket','register','then','FaxMessage,\x20%s,\x20%s','debug'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xdace,0xc5));var _0xedac=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0xdace[_0x34232c];return _0x4d4f4e;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});config['redis']=_[_0xedac('0xb')](config[_0xedac('0xc')],{'host':_0xedac('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedac('0xc')]));require(_0xedac('0xe'))[_0xedac('0xf')](socket);function respondWithRpcPromise(_0x4af030,_0x5e188c,_0x144368){return new BPromise(function(_0x2ea11d,_0x57e1bf){return client['request'](_0x4af030,_0x144368)[_0xedac('0x10')](function(_0x25395d){logger['info'](_0xedac('0x11'),_0x5e188c,'request\x20sent');logger[_0xedac('0x12')](_0xedac('0x13'),_0x5e188c,_0xedac('0x14'),JSON[_0xedac('0x15')](_0x25395d));if(_0x25395d[_0xedac('0x16')]){if(_0x25395d[_0xedac('0x16')][_0xedac('0x17')]===0x1f4){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);return _0x57e1bf(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25395d[_0xedac('0x16')]['message']);return _0x2ea11d(_0x25395d[_0xedac('0x16')][_0xedac('0x18')]);}else{logger[_0xedac('0x19')](_0xedac('0x11'),_0x5e188c,'request\x20sent');_0x2ea11d(_0x25395d['result'][_0xedac('0x18')]);}})[_0xedac('0x1a')](function(_0x25fe64){logger[_0xedac('0x16')]('FaxMessage,\x20%s,\x20%s',_0x5e188c,_0x25fe64);_0x57e1bf(_0x25fe64);});});}exports['CreateFaxMessage']=function(_0x2b2ae9){var _0x17766c=this;return new Promise(function(_0x23c609,_0xcc1605){return db[_0xedac('0x1b')][_0xedac('0x1c')](_0x2b2ae9[_0xedac('0x1d')],{'raw':_0x2b2ae9[_0xedac('0x1e')]?_0x2b2ae9['options'][_0xedac('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x29cd40){logger[_0xedac('0x19')]('CreateFaxMessage',_0x2b2ae9);logger[_0xedac('0x12')](_0xedac('0x20'),_0x2b2ae9,JSON[_0xedac('0x15')](_0x29cd40));_0x23c609(_0x29cd40);})[_0xedac('0x1a')](function(_0x6b13ca){logger[_0xedac('0x16')]('CreateFaxMessage',_0x6b13ca[_0xedac('0x18')],_0x2b2ae9);_0xcc1605(_0x17766c[_0xedac('0x16')](0x1f4,_0x6b13ca[_0xedac('0x18')]));});});};exports[_0xedac('0x21')]=function(_0x1ff33e){var _0x453a3c=this;return new Promise(function(_0x40ba53,_0x26c6f7){return db[_0xedac('0x1b')][_0xedac('0x22')](_0x1ff33e['body'],{'raw':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')]['where']||null:null,'attributes':_0x1ff33e['options']?_0x1ff33e[_0xedac('0x1e')][_0xedac('0x23')]||null:null,'limit':_0x1ff33e[_0xedac('0x1e')]?_0x1ff33e[_0xedac('0x1e')]['limit']||null:null})['then'](function(_0xe813e6){logger[_0xedac('0x19')](_0xedac('0x21'),_0x1ff33e);logger[_0xedac('0x12')](_0xedac('0x21'),_0x1ff33e,JSON[_0xedac('0x15')](_0xe813e6));_0x40ba53(_0xe813e6);})[_0xedac('0x1a')](function(_0x483233){logger[_0xedac('0x16')](_0xedac('0x21'),_0x483233[_0xedac('0x18')],_0x1ff33e);_0x26c6f7(_0x453a3c['error'](0x1f4,_0x483233[_0xedac('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index cbe192c..3ed708d 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 _0xf137=['faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2c0bb5,_0x568a0b){var _0x1c2434=function(_0x2961e3){while(--_0x2961e3){_0x2c0bb5['push'](_0x2c0bb5['shift']());}};_0x1c2434(++_0x568a0b);}(_0xf137,0x15f));var _0x7f13=function(_0x4d2329,_0x5c505a){_0x4d2329=_0x4d2329-0x0;var _0x37233b=_0xf137[_0x4d2329];return _0x37233b;};'use strict';var FaxMessageEvents=require(_0x7f13('0x0'));var events=[_0x7f13('0x1'),_0x7f13('0x2'),_0x7f13('0x3')];function createListener(_0xef2223,_0xffa17b){return function(_0x3f106){_0xffa17b[_0x7f13('0x4')](_0xef2223,_0x3f106);};}function removeListener(_0x188729,_0x5eadbe){return function(){FaxMessageEvents[_0x7f13('0x5')](_0x188729,_0x5eadbe);};}exports['register']=function(_0x2c2aaf){for(var _0x569eef=0x0,_0x2f805f=events['length'];_0x569eef<_0x2f805f;_0x569eef++){var _0x1a065d=events[_0x569eef];var _0xa0fdc3=createListener(_0x7f13('0x6')+_0x1a065d,_0x2c2aaf);FaxMessageEvents['on'](_0x1a065d,_0xa0fdc3);}}; \ No newline at end of file +var _0xd5a1=['length','faxMessage:','save','remove','emit','removeListener'];(function(_0x579243,_0x570725){var _0x2fc270=function(_0x5e7e1d){while(--_0x5e7e1d){_0x579243['push'](_0x579243['shift']());}};_0x2fc270(++_0x570725);}(_0xd5a1,0x146));var _0x1d5a=function(_0x48b230,_0x239969){_0x48b230=_0x48b230-0x0;var _0x37a6cd=_0xd5a1[_0x48b230];return _0x37a6cd;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x1d5a('0x0'),_0x1d5a('0x1'),'update'];function createListener(_0x413f56,_0xff657a){return function(_0x3ab0d1){_0xff657a[_0x1d5a('0x2')](_0x413f56,_0x3ab0d1);};}function removeListener(_0x4ff4b3,_0x5770c1){return function(){FaxMessageEvents[_0x1d5a('0x3')](_0x4ff4b3,_0x5770c1);};}exports['register']=function(_0x41afdc){for(var _0xc993d7=0x0,_0x510f9b=events[_0x1d5a('0x4')];_0xc993d7<_0x510f9b;_0xc993d7++){var _0x4fdc0b=events[_0xc993d7];var _0x5b3a8b=createListener(_0x1d5a('0x5')+_0x4fdc0b,_0x41afdc);FaxMessageEvents['on'](_0x4fdc0b,_0x5b3a8b);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 53f8bd2..feaae96 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 _0x702d=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x428dbd,_0x2726b9){var _0x2509f2=function(_0x53a53f){while(--_0x53a53f){_0x428dbd['push'](_0x428dbd['shift']());}};_0x2509f2(++_0x2726b9);}(_0x702d,0x147));var _0xd702=function(_0xa76946,_0x18d2da){_0xa76946=_0xa76946-0x0;var _0x5ce549=_0x702d[_0xa76946];return _0x5ce549;};'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('./faxMessage.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('0x9')](_0xd702('0x10'),auth[_0xd702('0xe')](),controller[_0xd702('0x11')]);router[_0xd702('0x12')]('/',auth[_0xd702('0xe')](),interaction[_0xd702('0x13')]('fax','faxmessage:create'),controller[_0xd702('0x14')]);router[_0xd702('0x15')](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x16')]);router[_0xd702('0x15')](_0xd702('0x17'),auth[_0xd702('0xe')](),controller[_0xd702('0x18')]);router[_0xd702('0x15')]('/:id/reject',auth[_0xd702('0xe')](),controller[_0xd702('0x19')]);router['delete'](_0xd702('0xd'),auth['isAuthenticated'](),controller[_0xd702('0x1a')]);module[_0xd702('0x1b')]=router; \ No newline at end of file +var _0x222f=['/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','create','put','update','/:id/accept'];(function(_0x5474b4,_0x5027aa){var _0x33a0b5=function(_0x41fd6b){while(--_0x41fd6b){_0x5474b4['push'](_0x5474b4['shift']());}};_0x33a0b5(++_0x5027aa);}(_0x222f,0x1a4));var _0xf222=function(_0x4a423e,_0x59ba7b){_0x4a423e=_0x4a423e-0x0;var _0x4ad91f=_0x222f[_0x4a423e];return _0x4ad91f;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./faxMessage.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/describe',auth[_0xf222('0xa')](),controller[_0xf222('0xb')]);router['get'](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0xd')]);router[_0xf222('0x8')](_0xf222('0xe'),auth[_0xf222('0xa')](),controller['download']);router[_0xf222('0xf')]('/',auth[_0xf222('0xa')](),interaction[_0xf222('0x10')](_0xf222('0x11'),'faxmessage:create'),controller[_0xf222('0x12')]);router[_0xf222('0x13')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x14')]);router[_0xf222('0x13')](_0xf222('0x15'),auth[_0xf222('0xa')](),controller['accept']);router['put'](_0xf222('0x16'),auth[_0xf222('0xa')](),controller['reject']);router[_0xf222('0x17')](_0xf222('0xc'),auth[_0xf222('0xa')](),controller[_0xf222('0x18')]);module[_0xf222('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f21457c..b8ad364 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 _0x5946=['name','STRING','INTEGER','ENUM','rrmemory','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5946,0x8f));var _0x6594=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0x5946[_0x49e584];return _0x58b1be;};'use strict';var Sequelize=require('sequelize');module[_0x6594('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x6594('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6594('0x2')]},'timeout':{'type':Sequelize[_0x6594('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6594('0x4')](_0x6594('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x6594('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x762e=['sequelize','name','ENUM','rrmemory','beepall','INTEGER'];(function(_0x4a506c,_0xbcc709){var _0x2cd8dd=function(_0x563f48){while(--_0x563f48){_0x4a506c['push'](_0x4a506c['shift']());}};_0x2cd8dd(++_0xbcc709);}(_0x762e,0xea));var _0xe762=function(_0x2e56bc,_0x1a7e2c){_0x2e56bc=_0x2e56bc-0x0;var _0x1e34b7=_0x762e[_0x2e56bc];return _0x1e34b7;};'use strict';var Sequelize=require(_0xe762('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xe762('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe762('0x2')](_0xe762('0x3'),_0xe762('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xe762('0x5')],'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 3afe092..3c416ac 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 _0x12e9=['role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserFaxQueue','pick','User','findAndCountAll','UserId','agent','faxPause','createdAt','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','ids','Agents','voicePause','interface','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','userFaxQueue:remove','addAgents','spread','userFaxQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','FaxQueues','UserProfileResource','error','stack','index','map','FaxQueue','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd2d0d6,_0x35eea1){var _0x298487=function(_0x53f570){while(--_0x53f570){_0xd2d0d6['push'](_0xd2d0d6['shift']());}};_0x298487(++_0x35eea1);}(_0x12e9,0x1f0));var _0x912e=function(_0x1ab07d,_0x3e6db4){_0x1ab07d=_0x1ab07d-0x0;var _0x27780b=_0x12e9[_0x1ab07d];return _0x27780b;};'use strict';var emlformat=require(_0x912e('0x0'));var rimraf=require(_0x912e('0x1'));var zipdir=require(_0x912e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x912e('0x3'));var moment=require(_0x912e('0x4'));var BPromise=require(_0x912e('0x5'));var Mustache=require(_0x912e('0x6'));var util=require(_0x912e('0x7'));var path=require(_0x912e('0x8'));var sox=require(_0x912e('0x9'));var csv=require(_0x912e('0xa'));var ejs=require(_0x912e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x912e('0xc'));var squel=require(_0x912e('0xd'));var crypto=require(_0x912e('0xe'));var jsforce=require(_0x912e('0xf'));var deskjs=require(_0x912e('0x10'));var toCsv=require(_0x912e('0xa'));var querystring=require('querystring');var Papa=require(_0x912e('0x11'));var Redis=require('ioredis');var authService=require(_0x912e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x912e('0x13'));var hardwareService=require(_0x912e('0x14'));var logger=require(_0x912e('0x15'))(_0x912e('0x16'));var utils=require('../../config/utils');var config=require(_0x912e('0x17'));var licenseUtil=require(_0x912e('0x18'));var db=require(_0x912e('0x19'))['db'];config[_0x912e('0x1a')]=_[_0x912e('0x1b')](config[_0x912e('0x1a')],{'host':_0x912e('0x1c'),'port':0x18eb});var socket=require(_0x912e('0x1d'))(new Redis(config[_0x912e('0x1a')]));require(_0x912e('0x1e'))[_0x912e('0x1f')](socket);function respondWithStatusCode(_0x20eb84,_0x5a2745){_0x5a2745=_0x5a2745||0xcc;return function(_0x4b244d){if(_0x4b244d){return _0x20eb84[_0x912e('0x20')](_0x5a2745);}return _0x20eb84[_0x912e('0x21')](_0x5a2745)[_0x912e('0x22')]();};}function respondWithResult(_0x5f098d,_0x34fb89){_0x34fb89=_0x34fb89||0xc8;return function(_0xd22a28){if(_0xd22a28){return _0x5f098d['status'](_0x34fb89)[_0x912e('0x23')](_0xd22a28);}};}function respondWithFilteredResult(_0x43800d,_0x5f2201){return function(_0x3ed483){if(_0x3ed483){var _0x272702=typeof _0x5f2201[_0x912e('0x24')]==='undefined'&&typeof _0x5f2201['limit']===_0x912e('0x25');var _0x32b10c=_0x3ed483[_0x912e('0x26')];var _0x3a5e3e=_0x272702?0x0:_0x5f2201[_0x912e('0x24')];var _0x5edcab=_0x272702?_0x3ed483[_0x912e('0x26')]:_0x5f2201[_0x912e('0x24')]+_0x5f2201[_0x912e('0x27')];var _0x3b9c65;if(_0x5edcab>=_0x32b10c){_0x5edcab=_0x32b10c;_0x3b9c65=0xc8;}else{_0x3b9c65=0xce;}_0x43800d[_0x912e('0x21')](_0x3b9c65);return _0x43800d[_0x912e('0x28')](_0x912e('0x29'),_0x3a5e3e+'-'+_0x5edcab+'/'+_0x32b10c)[_0x912e('0x23')](_0x3ed483);}return null;};}function patchUpdates(_0x3967c8){return function(_0x5b6584){try{jsonpatch[_0x912e('0x2a')](_0x5b6584,_0x3967c8,!![]);}catch(_0x27ab19){return BPromise[_0x912e('0x2b')](_0x27ab19);}return _0x5b6584[_0x912e('0x2c')]();};}function saveUpdates(_0x3eddef,_0x11dcea){return function(_0x504c80){if(_0x504c80){return _0x504c80['update'](_0x3eddef)[_0x912e('0x2d')](function(_0x18a656){return _0x18a656;});}return null;};}function removeEntity(_0x2f4dda,_0x35b1ea){return function(_0x26933c){if(_0x26933c){return _0x26933c[_0x912e('0x2e')]()[_0x912e('0x2d')](function(){var _0x5d542a=_0x26933c['get']({'plain':!![]});var _0x29d410=_0x912e('0x2f');return db[_0x912e('0x30')][_0x912e('0x2e')]({'where':{'type':_0x29d410,'resourceId':_0x5d542a['id']}})[_0x912e('0x2d')](function(){return _0x26933c;});})['then'](function(){_0x2f4dda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x150ec1,_0x5d0a1d){return function(_0x2c6c52){if(!_0x2c6c52){_0x150ec1[_0x912e('0x20')](0x194);}return _0x2c6c52;};}function handleError(_0x1809f3,_0x51e99e){_0x51e99e=_0x51e99e||0x1f4;return function(_0x22448a){logger[_0x912e('0x31')](_0x22448a[_0x912e('0x32')]);if(_0x22448a['name']){delete _0x22448a['name'];}_0x1809f3[_0x912e('0x21')](_0x51e99e)['send'](_0x22448a);};}exports[_0x912e('0x33')]=function(_0x2406b7,_0x5e48c8){var _0xb4814c={},_0x5ae94d={},_0x560dc1={'count':0x0,'rows':[]};var _0x54ce0a=_[_0x912e('0x34')](db[_0x912e('0x35')]['rawAttributes'],function(_0x3a8433){return{'name':_0x3a8433[_0x912e('0x36')],'type':_0x3a8433[_0x912e('0x37')]['key']};});_0x5ae94d[_0x912e('0x38')]=_['map'](_0x54ce0a,'name');_0x5ae94d['query']=_['keys'](_0x2406b7['query']);_0x5ae94d[_0x912e('0x39')]=_[_0x912e('0x3a')](_0x5ae94d[_0x912e('0x38')],_0x5ae94d[_0x912e('0x3b')]);_0xb4814c[_0x912e('0x3c')]=_['intersection'](_0x5ae94d[_0x912e('0x38')],qs[_0x912e('0x3d')](_0x2406b7['query'][_0x912e('0x3d')]));_0xb4814c[_0x912e('0x3c')]=_0xb4814c[_0x912e('0x3c')][_0x912e('0x3e')]?_0xb4814c['attributes']:_0x5ae94d[_0x912e('0x38')];if(!_0x2406b7[_0x912e('0x3b')][_0x912e('0x3f')]('nolimit')){_0xb4814c[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x2406b7[_0x912e('0x3b')][_0x912e('0x27')]);_0xb4814c[_0x912e('0x24')]=qs[_0x912e('0x24')](_0x2406b7['query'][_0x912e('0x24')]);}_0xb4814c[_0x912e('0x40')]=qs[_0x912e('0x41')](_0x2406b7[_0x912e('0x3b')][_0x912e('0x41')]);_0xb4814c['where']=qs['filters'](_['pick'](_0x2406b7['query'],_0x5ae94d[_0x912e('0x39')]),_0x54ce0a);if(_0x2406b7[_0x912e('0x3b')][_0x912e('0x42')]){_0xb4814c[_0x912e('0x43')]=_[_0x912e('0x44')](_0xb4814c[_0x912e('0x43')],{'$or':_['map'](_0x54ce0a,function(_0x19c79f){if(_0x19c79f[_0x912e('0x37')]!==_0x912e('0x45')){var _0x45b3f1={};_0x45b3f1[_0x19c79f[_0x912e('0x46')]]={'$like':'%'+_0x2406b7[_0x912e('0x3b')][_0x912e('0x42')]+'%'};return _0x45b3f1;}})});}_0xb4814c=_[_0x912e('0x44')]({},_0xb4814c,_0x2406b7[_0x912e('0x47')]);var _0x209e2c={'where':_0xb4814c[_0x912e('0x43')]};return db[_0x912e('0x35')][_0x912e('0x26')](_0x209e2c)[_0x912e('0x2d')](function(_0x4c8b88){_0x560dc1['count']=_0x4c8b88;if(_0x2406b7['query'][_0x912e('0x48')]){_0xb4814c[_0x912e('0x49')]=[{'all':!![]}];}return db[_0x912e('0x35')][_0x912e('0x4a')](_0xb4814c);})[_0x912e('0x2d')](function(_0x568b7f){_0x560dc1[_0x912e('0x4b')]=_0x568b7f;return _0x560dc1;})[_0x912e('0x2d')](respondWithFilteredResult(_0x5e48c8,_0xb4814c))[_0x912e('0x4c')](handleError(_0x5e48c8,null));};exports['show']=function(_0x2b5dd6,_0x1249c9){var _0x61e54a={'raw':!![],'where':{'id':_0x2b5dd6[_0x912e('0x4d')]['id']}},_0x9d0a80={};_0x9d0a80[_0x912e('0x38')]=_[_0x912e('0x4e')](db['FaxQueue'][_0x912e('0x4f')]);_0x9d0a80[_0x912e('0x3b')]=_[_0x912e('0x4e')](_0x2b5dd6[_0x912e('0x3b')]);_0x9d0a80[_0x912e('0x39')]=_[_0x912e('0x3a')](_0x9d0a80[_0x912e('0x38')],_0x9d0a80[_0x912e('0x3b')]);_0x61e54a['attributes']=_[_0x912e('0x3a')](_0x9d0a80['model'],qs[_0x912e('0x3d')](_0x2b5dd6['query'][_0x912e('0x3d')]));_0x61e54a[_0x912e('0x3c')]=_0x61e54a[_0x912e('0x3c')][_0x912e('0x3e')]?_0x61e54a[_0x912e('0x3c')]:_0x9d0a80[_0x912e('0x38')];if(_0x2b5dd6[_0x912e('0x3b')][_0x912e('0x48')]){_0x61e54a[_0x912e('0x49')]=[{'all':!![]}];}_0x61e54a=_[_0x912e('0x44')]({},_0x61e54a,_0x2b5dd6['options']);return db['FaxQueue'][_0x912e('0x50')](_0x61e54a)[_0x912e('0x2d')](handleEntityNotFound(_0x1249c9,null))[_0x912e('0x2d')](respondWithResult(_0x1249c9,null))[_0x912e('0x4c')](handleError(_0x1249c9,null));};exports[_0x912e('0x51')]=function(_0x5077a9,_0x38c048){return db[_0x912e('0x35')]['create'](_0x5077a9['body'],{})[_0x912e('0x2d')](function(_0x5bc5cf){var _0x5c5920=_0x5077a9[_0x912e('0x52')]['get']({'plain':!![]});if(!_0x5c5920)throw new Error(_0x912e('0x53'));if(_0x5c5920[_0x912e('0x54')]===_0x912e('0x52')){var _0x33714b=_0x5bc5cf[_0x912e('0x55')]({'plain':!![]});var _0x18c04c=_0x912e('0x2f');return db[_0x912e('0x56')][_0x912e('0x50')]({'where':{'name':_0x18c04c,'userProfileId':_0x5c5920[_0x912e('0x57')]},'raw':!![]})[_0x912e('0x2d')](function(_0x4a6df8){if(_0x4a6df8&&_0x4a6df8['autoAssociation']===0x0){return db[_0x912e('0x30')]['create']({'name':_0x33714b[_0x912e('0x46')],'resourceId':_0x33714b['id'],'type':_0x4a6df8[_0x912e('0x46')],'sectionId':_0x4a6df8['id']},{})['then'](function(){return _0x5bc5cf;});}else{return _0x5bc5cf;}})['catch'](function(_0x59533d){logger['error'](_0x912e('0x58'),_0x59533d);throw _0x59533d;});}return _0x5bc5cf;})['then'](respondWithResult(_0x38c048,0xc9))['catch'](handleError(_0x38c048,null));};exports['update']=function(_0x110b38,_0x4cd50f){if(_0x110b38[_0x912e('0x59')]['id']){delete _0x110b38[_0x912e('0x59')]['id'];}return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x110b38[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x4cd50f,null))['then'](saveUpdates(_0x110b38['body'],null))['then'](respondWithResult(_0x4cd50f,null))[_0x912e('0x4c')](handleError(_0x4cd50f,null));};exports['destroy']=function(_0x17f698,_0x5c17de){return db['FaxQueue'][_0x912e('0x50')]({'where':{'id':_0x17f698['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x5c17de,null))[_0x912e('0x2d')](removeEntity(_0x5c17de,null))[_0x912e('0x4c')](handleError(_0x5c17de,null));};exports[_0x912e('0x5a')]=function(_0x337e93,_0x18f208){return db[_0x912e('0x35')][_0x912e('0x5a')]()[_0x912e('0x2d')](respondWithResult(_0x18f208,null))[_0x912e('0x4c')](handleError(_0x18f208,null));};exports['getMembers']=function(_0x453567,_0xbe7d78,_0x540118){var _0x115812={'raw':!![],'where':{}},_0x5022a7={},_0x2727ad;return db['FaxQueue'][_0x912e('0x5b')]({'where':{'id':_0x453567[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0xbe7d78,null))[_0x912e('0x2d')](function(_0x56657b){if(_0x56657b){_0x2727ad=_0x56657b['get']({'plain':!![]});_0x5022a7[_0x912e('0x38')]=_[_0x912e('0x4e')](db[_0x912e('0x5c')][_0x912e('0x4f')]);_0x5022a7[_0x912e('0x3b')]=_['keys'](_0x453567[_0x912e('0x3b')]);_0x5022a7['filters']=_[_0x912e('0x3a')](_0x5022a7[_0x912e('0x38')],_0x5022a7['query']);_0x115812[_0x912e('0x3c')]=_['intersection'](_0x5022a7[_0x912e('0x38')],qs[_0x912e('0x3d')](_0x453567[_0x912e('0x3b')]['fields']));_0x115812[_0x912e('0x3c')]=_0x115812[_0x912e('0x3c')][_0x912e('0x3e')]?_0x115812[_0x912e('0x3c')]:_0x5022a7[_0x912e('0x38')];if(!_0x453567[_0x912e('0x3b')]['hasOwnProperty']('nolimit')){_0x115812['limit']=qs['limit'](_0x453567[_0x912e('0x3b')][_0x912e('0x27')]);_0x115812['offset']=qs[_0x912e('0x24')](_0x453567[_0x912e('0x3b')][_0x912e('0x24')]);}_0x115812['order']=qs[_0x912e('0x41')](_0x453567[_0x912e('0x3b')][_0x912e('0x41')]);_0x115812[_0x912e('0x43')]=qs[_0x912e('0x39')](_[_0x912e('0x5d')](_0x453567[_0x912e('0x3b')],_0x5022a7[_0x912e('0x39')]));_0x115812['where']['FaxQueueId']=_0x56657b['id'];if(_0x453567[_0x912e('0x3b')][_0x912e('0x42')]){_0x115812[_0x912e('0x43')]=_[_0x912e('0x44')](_0x115812[_0x912e('0x43')],{'$or':_[_0x912e('0x34')](_0x115812['attributes'],function(_0x39e048){var _0x575c2c={};_0x575c2c[_0x39e048]={'$like':'%'+_0x453567['query']['filter']+'%'};return _0x575c2c;})});}_0x115812=_[_0x912e('0x44')]({},_0x115812,_0x453567['options']);return db[_0x912e('0x5c')]['findAll'](_0x115812);}})[_0x912e('0x2d')](function(_0x571fcf){if(_0x571fcf){return db[_0x912e('0x5e')][_0x912e('0x5f')]({'where':{'id':_['map'](_0x571fcf,_0x912e('0x60')),'role':_0x912e('0x61')},'attributes':['id',_0x912e('0x46'),_0x912e('0x62'),'updatedAt',_0x912e('0x63')]});}})['then'](function(_0x39b4b5){if(_0x39b4b5){return{'count':_0x39b4b5[_0x912e('0x26')],'rows':_[_0x912e('0x34')](_0x39b4b5[_0x912e('0x4b')],function(_0x1567d1){return{'membername':_0x1567d1[_0x912e('0x46')],'UserId':_0x1567d1['id'],'queue_name':_0x2727ad[_0x912e('0x46')],'FaxQueueId':_0x2727ad['id'],'interface':util['format'](_0x912e('0x64'),_0x912e('0x65'),_0x1567d1[_0x912e('0x46')]),'penalty':0x0,'paused':_0x1567d1[_0x912e('0x62')],'createdAt':_0x1567d1['createdAt'],'updatedAt':_0x1567d1[_0x912e('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x912e('0x2d')](respondWithFilteredResult(_0xbe7d78,_0x115812))[_0x912e('0x4c')](handleError(_0xbe7d78,null));};exports[_0x912e('0x67')]=function(_0x1fac3f,_0x295ec2,_0x3da342){var _0x12549d={};var _0x2ea683={};var _0x53ae95;var _0x307e30;return db[_0x912e('0x35')][_0x912e('0x5b')]({'where':{'id':_0x1fac3f['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x295ec2,null))[_0x912e('0x2d')](function(_0x4a221a){if(_0x4a221a){_0x53ae95=_0x4a221a;_0x2ea683['model']=_[_0x912e('0x4e')](db[_0x912e('0x68')][_0x912e('0x4f')]);_0x2ea683[_0x912e('0x3b')]=_['keys'](_0x1fac3f[_0x912e('0x3b')]);_0x2ea683['filters']=_['intersection'](_0x2ea683[_0x912e('0x38')],_0x2ea683[_0x912e('0x3b')]);_0x12549d[_0x912e('0x3c')]=_[_0x912e('0x3a')](_0x2ea683['model'],qs[_0x912e('0x3d')](_0x1fac3f['query'][_0x912e('0x3d')]));_0x12549d[_0x912e('0x3c')]=_0x12549d['attributes']['length']?_0x12549d[_0x912e('0x3c')]:_0x2ea683[_0x912e('0x38')];_0x12549d[_0x912e('0x40')]=qs[_0x912e('0x41')](_0x1fac3f[_0x912e('0x3b')]['sort']);_0x12549d[_0x912e('0x43')]=qs[_0x912e('0x39')](_[_0x912e('0x5d')](_0x1fac3f[_0x912e('0x3b')],_0x2ea683[_0x912e('0x39')]));if(_0x1fac3f['query']['filter']){_0x12549d[_0x912e('0x43')]=_['merge'](_0x12549d[_0x912e('0x43')],{'$or':_['map'](_0x12549d[_0x912e('0x3c')],function(_0x31beb7){var _0x2a725c={};_0x2a725c[_0x31beb7]={'$like':'%'+_0x1fac3f['query'][_0x912e('0x42')]+'%'};return _0x2a725c;})});}_0x12549d=_[_0x912e('0x44')]({},_0x12549d,_0x1fac3f[_0x912e('0x47')]);return _0x53ae95[_0x912e('0x67')](_0x12549d);}})[_0x912e('0x2d')](function(_0x312ec2){if(_0x312ec2){_0x307e30=_0x312ec2[_0x912e('0x3e')];if(!_0x1fac3f['query']['hasOwnProperty'](_0x912e('0x69'))){_0x12549d[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x1fac3f[_0x912e('0x3b')][_0x912e('0x27')]);_0x12549d[_0x912e('0x24')]=qs['offset'](_0x1fac3f[_0x912e('0x3b')][_0x912e('0x24')]);}return _0x53ae95[_0x912e('0x67')](_0x12549d);}})['then'](function(_0x4d3074){if(_0x4d3074){return _0x4d3074?{'count':_0x307e30,'rows':_0x4d3074}:null;}})[_0x912e('0x2d')](respondWithResult(_0x295ec2,null))[_0x912e('0x4c')](handleError(_0x295ec2,null));};exports['addTeams']=function(_0x22f791,_0x415b8b,_0x58bb7b){var _0x1a3eaf=_0x22f791[_0x912e('0x59')][_0x912e('0x6a')];return db[_0x912e('0x68')][_0x912e('0x4a')]({'where':{'id':_0x1a3eaf},'attributes':['id'],'include':[{'model':db['User'],'as':_0x912e('0x6b'),'attributes':['id','name','online',_0x912e('0x6c'),_0x912e('0x6d')],'raw':!![]}]})['then'](function(_0x32a6e9){if(_0x32a6e9){var _0xd73036=_['flatMap'](_0x32a6e9,function(_0x19d764){var _0x35b8c5=_0x19d764[_0x912e('0x55')]({'plain':!![]});return _0x35b8c5[_0x912e('0x6b')];});return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x22f791[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](function(_0x310230){return db[_0x912e('0x6e')][_0x912e('0x6f')](function(_0x1540cf){return _0x310230[_0x912e('0x70')](_0x1a3eaf,{'transaction':_0x1540cf})[_0x912e('0x2d')](function(){return BPromise[_0x912e('0x71')](_0xd73036,function(_0x31fba2){return db['UserFaxQueue'][_0x912e('0x72')]({'where':{'UserId':_0x31fba2['id'],'FaxQueueId':_0x22f791[_0x912e('0x4d')]['id']},'transaction':_0x1540cf});});})[_0x912e('0x2d')](function(){_0xd73036[_0x912e('0x73')](function(_0xe1528e){socket[_0x912e('0x74')]('userFaxQueue:save',{'UserId':_0xe1528e['id'],'FaxQueueId':_0x310230['id']});});});});});}})[_0x912e('0x2d')](respondWithStatusCode(_0x415b8b,null))[_0x912e('0x4c')](handleError(_0x415b8b,null));};exports['removeTeams']=function(_0x3de9a0,_0x3dfbe5,_0x5862f6){return db[_0x912e('0x68')][_0x912e('0x4a')]({'where':{'id':_0x3de9a0['query'][_0x912e('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x912e('0x5e')],'as':_0x912e('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3dfbe5,null))['then'](function(_0x271bdb){var _0xae9d68=_[_0x912e('0x34')](_0x271bdb,'id');var _0x31bb63=[];var _0x1b36ed=[];var _0x5a5899=squel['select']();_0x5a5899[_0x912e('0x75')](_0x912e('0x76'))[_0x912e('0x77')](_0x912e('0x78'),'tq')[_0x912e('0x79')](_0x912e('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x912e('0x43')](_0x912e('0x7b'),_0x3de9a0[_0x912e('0x4d')]['id']);for(var _0x27f8d4=0x0;_0x27f8d4<_0x271bdb[_0x912e('0x3e')];_0x27f8d4+=0x1){let _0x5a5b78=_0x271bdb[_0x27f8d4];for(var _0x510abd=0x0;_0x510abd<_0x5a5b78[_0x912e('0x6b')][_0x912e('0x3e')];_0x510abd+=0x1){let _0x2416a4=_0x5a5b78['Agents'][_0x510abd];var _0x2954c0=_0x5a5899[_0x912e('0x7c')]();_0x2954c0[_0x912e('0x43')](_0x912e('0x7d'),_0x2416a4['id']);_0x1b36ed[_0x912e('0x7e')](db[_0x912e('0x6e')][_0x912e('0x3b')](_0x2954c0[_0x912e('0x7f')](),{'type':db[_0x912e('0x6e')]['QueryTypes'][_0x912e('0x80')]})[_0x912e('0x2d')](function(_0x23cc5d){if(_0x23cc5d['length']===0x1){return _0x2416a4['id'];}else{var _0x320e55=_[_0x912e('0x81')](_[_0x912e('0x34')](_0x23cc5d,_0x912e('0x82')),function(_0x59012f){return _[_0x912e('0x83')](_0xae9d68,_0x59012f);});if(_0x320e55){return _0x2416a4['id'];}}}));}}return BPromise[_0x912e('0x84')](_0x1b36ed)[_0x912e('0x2d')](function(_0x25c38d){_0x31bb63=_(_0x31bb63)[_0x912e('0x85')](_0x25c38d)[_0x912e('0x86')]()[_0x912e('0x87')]();return db['FaxQueue'][_0x912e('0x50')]({'where':{'id':_0x3de9a0[_0x912e('0x4d')]['id']}})[_0x912e('0x2d')](function(_0xe18604){return db['sequelize'][_0x912e('0x6f')](function(_0xb911aa){return _0xe18604[_0x912e('0x88')](_0x3de9a0[_0x912e('0x3b')][_0x912e('0x6a')],{'transaction':_0xb911aa})[_0x912e('0x2d')](function(){if(!_[_0x912e('0x89')](_0x31bb63)){return _0xe18604['removeAgents'](_0x31bb63,{'transaction':_0xb911aa});}})[_0x912e('0x2d')](function(){_0x31bb63['forEach'](function(_0x1f8cce){socket['emit'](_0x912e('0x8a'),{'UserId':_0x1f8cce,'FaxQueueId':_0xe18604['id']});});});});});});})[_0x912e('0x2d')](respondWithStatusCode(_0x3dfbe5,null))[_0x912e('0x4c')](handleError(_0x3dfbe5,null));};exports['addAgents']=function(_0x546255,_0x118c3b,_0x5db559){return db[_0x912e('0x35')][_0x912e('0x50')]({'where':{'id':_0x546255['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x118c3b,null))[_0x912e('0x2d')](function(_0x33ae4e){if(_0x33ae4e){return _0x33ae4e[_0x912e('0x8b')](_0x546255[_0x912e('0x59')][_0x912e('0x6a')],_['omit'](_0x546255[_0x912e('0x59')],[_0x912e('0x6a'),'id'])||{})[_0x912e('0x8c')](function(_0x2a7189){for(var _0xefdaed=0x0;_0xefdaed<_0x546255[_0x912e('0x59')]['ids'][_0x912e('0x3e')];_0xefdaed+=0x1){socket[_0x912e('0x74')](_0x912e('0x8d'),{'UserId':Number(_0x546255[_0x912e('0x59')][_0x912e('0x6a')][_0xefdaed]),'FaxQueueId':Number(_0x546255[_0x912e('0x4d')]['id'])});}return _0x2a7189;});}})['then'](respondWithResult(_0x118c3b,null))['catch'](handleError(_0x118c3b,null));};exports[_0x912e('0x8e')]=function(_0x206310,_0x12c525,_0x48a509){return db['FaxQueue']['find']({'where':{'id':_0x206310['params']['id']}})[_0x912e('0x2d')](handleEntityNotFound(_0x12c525,null))['then'](function(_0x2b0ef1){if(_0x2b0ef1){return _0x2b0ef1[_0x912e('0x8e')](_0x206310[_0x912e('0x3b')]['ids'])[_0x912e('0x2d')](function(){if(_[_0x912e('0x8f')](_0x206310[_0x912e('0x3b')][_0x912e('0x6a')])){for(var _0x5839a2=0x0;_0x5839a2<_0x206310[_0x912e('0x3b')]['ids']['length'];_0x5839a2+=0x1){socket[_0x912e('0x74')](_0x912e('0x8a'),{'UserId':Number(_0x206310[_0x912e('0x3b')][_0x912e('0x6a')][_0x5839a2]),'FaxQueueId':Number(_0x206310[_0x912e('0x4d')]['id'])});}}else{socket['emit'](_0x912e('0x8a'),{'UserId':Number(_0x206310[_0x912e('0x3b')][_0x912e('0x6a')]),'FaxQueueId':Number(_0x206310[_0x912e('0x4d')]['id'])});}});}})[_0x912e('0x2d')](respondWithStatusCode(_0x12c525,null))[_0x912e('0x4c')](handleError(_0x12c525,null));};exports[_0x912e('0x90')]=function(_0x26d493,_0x29f9d0,_0x2db177){var _0x1bc255={};var _0x4b2d0d={};var _0x1c2bb8;var _0x2db5e8;return db['FaxQueue'][_0x912e('0x5b')]({'where':{'id':_0x26d493[_0x912e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29f9d0,null))[_0x912e('0x2d')](function(_0x46e5d3){if(_0x46e5d3){_0x1c2bb8=_0x46e5d3;_0x4b2d0d[_0x912e('0x38')]=_[_0x912e('0x4e')](db[_0x912e('0x5e')]['rawAttributes']);_0x4b2d0d[_0x912e('0x3b')]=_[_0x912e('0x4e')](_0x26d493[_0x912e('0x3b')]);_0x4b2d0d['filters']=_[_0x912e('0x3a')](_0x4b2d0d[_0x912e('0x38')],_0x4b2d0d[_0x912e('0x3b')]);_0x1bc255['attributes']=_['intersection'](_0x4b2d0d[_0x912e('0x38')],qs['fields'](_0x26d493['query']['fields']));_0x1bc255['attributes']=_0x1bc255[_0x912e('0x3c')][_0x912e('0x3e')]?_0x1bc255[_0x912e('0x3c')]:_0x4b2d0d['model'];_0x1bc255['order']=qs['sort'](_0x26d493[_0x912e('0x3b')][_0x912e('0x41')]);_0x1bc255['where']=qs['filters'](_[_0x912e('0x5d')](_0x26d493[_0x912e('0x3b')],_0x4b2d0d[_0x912e('0x39')]));if(_0x26d493['query']['filter']){_0x1bc255[_0x912e('0x43')]=_[_0x912e('0x44')](_0x1bc255['where'],{'$or':_['map'](_0x1bc255[_0x912e('0x3c')],function(_0x46d673){var _0x1b6d4c={};_0x1b6d4c[_0x46d673]={'$like':'%'+_0x26d493['query'][_0x912e('0x42')]+'%'};return _0x1b6d4c;})});}_0x1bc255=_[_0x912e('0x44')]({},_0x1bc255,_0x26d493[_0x912e('0x47')]);return _0x1c2bb8[_0x912e('0x90')](_0x1bc255);}})[_0x912e('0x2d')](function(_0x5dcc92){if(_0x5dcc92){_0x2db5e8=_0x5dcc92[_0x912e('0x3e')];if(!_0x26d493[_0x912e('0x3b')][_0x912e('0x3f')](_0x912e('0x69'))){_0x1bc255[_0x912e('0x27')]=qs[_0x912e('0x27')](_0x26d493[_0x912e('0x3b')][_0x912e('0x27')]);_0x1bc255[_0x912e('0x24')]=qs['offset'](_0x26d493[_0x912e('0x3b')]['offset']);}return _0x1c2bb8[_0x912e('0x90')](_0x1bc255);}})[_0x912e('0x2d')](function(_0x1d0ece){if(_0x1d0ece){return _0x1d0ece?{'count':_0x2db5e8,'rows':_0x1d0ece}:null;}})[_0x912e('0x2d')](respondWithResult(_0x29f9d0,null))['catch'](handleError(_0x29f9d0,null));}; \ No newline at end of file +var _0xf590=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','pick','FaxQueueId','options','UserFaxQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','join','FaxQueueId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userFaxQueue:remove','getAgents','rimraf','zip-dir','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./faxQueue.socket','register','status','end','json','offset','undefined','set','Content-Range','reject','update','then','destroy','get','FaxQueues','error','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','fields','length','create'];(function(_0x5231f9,_0x14bbe9){var _0x3eae55=function(_0x9424b3){while(--_0x9424b3){_0x5231f9['push'](_0x5231f9['shift']());}};_0x3eae55(++_0x14bbe9);}(_0xf590,0x1d5));var _0x0f59=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0xf590[_0x5d4db8];return _0x415548;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f59('0x0'));var zipdir=require(_0x0f59('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0f59('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0f59('0x3'));var util=require(_0x0f59('0x4'));var path=require('path');var sox=require(_0x0f59('0x5'));var csv=require(_0x0f59('0x6'));var ejs=require(_0x0f59('0x7'));var fs=require('fs');var fs_extra=require(_0x0f59('0x8'));var _=require(_0x0f59('0x9'));var squel=require('squel');var crypto=require(_0x0f59('0xa'));var jsforce=require(_0x0f59('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0f59('0x6'));var querystring=require('querystring');var Papa=require(_0x0f59('0xc'));var Redis=require('ioredis');var authService=require(_0x0f59('0xd'));var qs=require(_0x0f59('0xe'));var as=require(_0x0f59('0xf'));var hardwareService=require(_0x0f59('0x10'));var logger=require(_0x0f59('0x11'))(_0x0f59('0x12'));var utils=require(_0x0f59('0x13'));var config=require(_0x0f59('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x0f59('0x15'))['db'];config[_0x0f59('0x16')]=_[_0x0f59('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f59('0x16')]));require(_0x0f59('0x18'))[_0x0f59('0x19')](socket);function respondWithStatusCode(_0x2d0864,_0x2345e5){_0x2345e5=_0x2345e5||0xcc;return function(_0x7dee14){if(_0x7dee14){return _0x2d0864['sendStatus'](_0x2345e5);}return _0x2d0864[_0x0f59('0x1a')](_0x2345e5)[_0x0f59('0x1b')]();};}function respondWithResult(_0x4cbeed,_0x30efde){_0x30efde=_0x30efde||0xc8;return function(_0x3afb39){if(_0x3afb39){return _0x4cbeed[_0x0f59('0x1a')](_0x30efde)[_0x0f59('0x1c')](_0x3afb39);}};}function respondWithFilteredResult(_0x20cf84,_0x338936){return function(_0x28ed98){if(_0x28ed98){var _0x31c87b=typeof _0x338936[_0x0f59('0x1d')]===_0x0f59('0x1e')&&typeof _0x338936['limit']===_0x0f59('0x1e');var _0x32dae7=_0x28ed98['count'];var _0x5a196a=_0x31c87b?0x0:_0x338936['offset'];var _0x50e534=_0x31c87b?_0x28ed98['count']:_0x338936[_0x0f59('0x1d')]+_0x338936['limit'];var _0x279042;if(_0x50e534>=_0x32dae7){_0x50e534=_0x32dae7;_0x279042=0xc8;}else{_0x279042=0xce;}_0x20cf84[_0x0f59('0x1a')](_0x279042);return _0x20cf84[_0x0f59('0x1f')](_0x0f59('0x20'),_0x5a196a+'-'+_0x50e534+'/'+_0x32dae7)[_0x0f59('0x1c')](_0x28ed98);}return null;};}function patchUpdates(_0x2a55d1){return function(_0x490d58){try{jsonpatch['apply'](_0x490d58,_0x2a55d1,!![]);}catch(_0x4febd1){return BPromise[_0x0f59('0x21')](_0x4febd1);}return _0x490d58['save']();};}function saveUpdates(_0x4cb74a,_0x39b7fb){return function(_0x570d18){if(_0x570d18){return _0x570d18[_0x0f59('0x22')](_0x4cb74a)[_0x0f59('0x23')](function(_0x370403){return _0x370403;});}return null;};}function removeEntity(_0x36ca7f,_0x5ec31b){return function(_0x3e1ef1){if(_0x3e1ef1){return _0x3e1ef1[_0x0f59('0x24')]()[_0x0f59('0x23')](function(){var _0x4e9e05=_0x3e1ef1[_0x0f59('0x25')]({'plain':!![]});var _0x1d386f=_0x0f59('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x1d386f,'resourceId':_0x4e9e05['id']}})[_0x0f59('0x23')](function(){return _0x3e1ef1;});})[_0x0f59('0x23')](function(){_0x36ca7f['status'](0xcc)[_0x0f59('0x1b')]();});}};}function handleEntityNotFound(_0x3bfecc,_0x47f90f){return function(_0x2facfc){if(!_0x2facfc){_0x3bfecc['sendStatus'](0x194);}return _0x2facfc;};}function handleError(_0x32597f,_0x17e710){_0x17e710=_0x17e710||0x1f4;return function(_0x226f3d){logger[_0x0f59('0x27')](_0x226f3d[_0x0f59('0x28')]);if(_0x226f3d[_0x0f59('0x29')]){delete _0x226f3d[_0x0f59('0x29')];}_0x32597f[_0x0f59('0x1a')](_0x17e710)[_0x0f59('0x2a')](_0x226f3d);};}exports[_0x0f59('0x2b')]=function(_0x225d5e,_0x5a5fff){var _0x354d30={},_0x380687={},_0x1987b1={'count':0x0,'rows':[]};var _0x637c7b=_[_0x0f59('0x2c')](db[_0x0f59('0x2d')]['rawAttributes'],function(_0x349073){return{'name':_0x349073[_0x0f59('0x2e')],'type':_0x349073[_0x0f59('0x2f')][_0x0f59('0x30')]};});_0x380687[_0x0f59('0x31')]=_[_0x0f59('0x2c')](_0x637c7b,_0x0f59('0x29'));_0x380687[_0x0f59('0x32')]=_['keys'](_0x225d5e[_0x0f59('0x32')]);_0x380687[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x380687[_0x0f59('0x31')],_0x380687['query']);_0x354d30[_0x0f59('0x35')]=_[_0x0f59('0x34')](_0x380687[_0x0f59('0x31')],qs['fields'](_0x225d5e['query']['fields']));_0x354d30[_0x0f59('0x35')]=_0x354d30['attributes']['length']?_0x354d30[_0x0f59('0x35')]:_0x380687['model'];if(!_0x225d5e[_0x0f59('0x32')][_0x0f59('0x36')](_0x0f59('0x37'))){_0x354d30['limit']=qs['limit'](_0x225d5e[_0x0f59('0x32')][_0x0f59('0x38')]);_0x354d30[_0x0f59('0x1d')]=qs[_0x0f59('0x1d')](_0x225d5e[_0x0f59('0x32')][_0x0f59('0x1d')]);}_0x354d30[_0x0f59('0x39')]=qs[_0x0f59('0x3a')](_0x225d5e[_0x0f59('0x32')][_0x0f59('0x3a')]);_0x354d30['where']=qs[_0x0f59('0x33')](_['pick'](_0x225d5e['query'],_0x380687['filters']),_0x637c7b);if(_0x225d5e[_0x0f59('0x32')][_0x0f59('0x3b')]){_0x354d30['where']=_[_0x0f59('0x3c')](_0x354d30[_0x0f59('0x3d')],{'$or':_[_0x0f59('0x2c')](_0x637c7b,function(_0x4624c5){if(_0x4624c5['type']!==_0x0f59('0x3e')){var _0xc4c686={};_0xc4c686[_0x4624c5[_0x0f59('0x29')]]={'$like':'%'+_0x225d5e[_0x0f59('0x32')][_0x0f59('0x3b')]+'%'};return _0xc4c686;}})});}_0x354d30=_[_0x0f59('0x3c')]({},_0x354d30,_0x225d5e['options']);var _0x5a5c57={'where':_0x354d30['where']};return db[_0x0f59('0x2d')][_0x0f59('0x3f')](_0x5a5c57)[_0x0f59('0x23')](function(_0x2d5d72){_0x1987b1[_0x0f59('0x3f')]=_0x2d5d72;if(_0x225d5e[_0x0f59('0x32')][_0x0f59('0x40')]){_0x354d30['include']=[{'all':!![]}];}return db[_0x0f59('0x2d')][_0x0f59('0x41')](_0x354d30);})[_0x0f59('0x23')](function(_0x3a6b0f){_0x1987b1[_0x0f59('0x42')]=_0x3a6b0f;return _0x1987b1;})[_0x0f59('0x23')](respondWithFilteredResult(_0x5a5fff,_0x354d30))[_0x0f59('0x43')](handleError(_0x5a5fff,null));};exports[_0x0f59('0x44')]=function(_0x14b63d,_0x13d333){var _0x55ce77={'raw':!![],'where':{'id':_0x14b63d[_0x0f59('0x45')]['id']}},_0x1bcf03={};_0x1bcf03[_0x0f59('0x31')]=_[_0x0f59('0x46')](db[_0x0f59('0x2d')][_0x0f59('0x47')]);_0x1bcf03[_0x0f59('0x32')]=_[_0x0f59('0x46')](_0x14b63d[_0x0f59('0x32')]);_0x1bcf03[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x1bcf03[_0x0f59('0x31')],_0x1bcf03[_0x0f59('0x32')]);_0x55ce77[_0x0f59('0x35')]=_[_0x0f59('0x34')](_0x1bcf03[_0x0f59('0x31')],qs[_0x0f59('0x48')](_0x14b63d['query'][_0x0f59('0x48')]));_0x55ce77['attributes']=_0x55ce77[_0x0f59('0x35')][_0x0f59('0x49')]?_0x55ce77[_0x0f59('0x35')]:_0x1bcf03[_0x0f59('0x31')];if(_0x14b63d[_0x0f59('0x32')]['includeAll']){_0x55ce77['include']=[{'all':!![]}];}_0x55ce77=_[_0x0f59('0x3c')]({},_0x55ce77,_0x14b63d['options']);return db['FaxQueue']['find'](_0x55ce77)[_0x0f59('0x23')](handleEntityNotFound(_0x13d333,null))[_0x0f59('0x23')](respondWithResult(_0x13d333,null))[_0x0f59('0x43')](handleError(_0x13d333,null));};exports['create']=function(_0x22bddc,_0x4246e3){return db[_0x0f59('0x2d')][_0x0f59('0x4a')](_0x22bddc[_0x0f59('0x4b')],{})[_0x0f59('0x23')](function(_0x3514b4){var _0x531d7a=_0x22bddc[_0x0f59('0x4c')][_0x0f59('0x25')]({'plain':!![]});if(!_0x531d7a)throw new Error(_0x0f59('0x4d'));if(_0x531d7a[_0x0f59('0x4e')]===_0x0f59('0x4c')){var _0x1e5885=_0x3514b4[_0x0f59('0x25')]({'plain':!![]});var _0x1ccc62=_0x0f59('0x26');return db[_0x0f59('0x4f')][_0x0f59('0x50')]({'where':{'name':_0x1ccc62,'userProfileId':_0x531d7a[_0x0f59('0x51')]},'raw':!![]})[_0x0f59('0x23')](function(_0x311782){if(_0x311782&&_0x311782[_0x0f59('0x52')]===0x0){return db[_0x0f59('0x53')][_0x0f59('0x4a')]({'name':_0x1e5885['name'],'resourceId':_0x1e5885['id'],'type':_0x311782[_0x0f59('0x29')],'sectionId':_0x311782['id']},{})[_0x0f59('0x23')](function(){return _0x3514b4;});}else{return _0x3514b4;}})[_0x0f59('0x43')](function(_0x49e906){logger[_0x0f59('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49e906);throw _0x49e906;});}return _0x3514b4;})[_0x0f59('0x23')](respondWithResult(_0x4246e3,0xc9))['catch'](handleError(_0x4246e3,null));};exports['update']=function(_0x310e8f,_0x170718){if(_0x310e8f[_0x0f59('0x4b')]['id']){delete _0x310e8f[_0x0f59('0x4b')]['id'];}return db[_0x0f59('0x2d')][_0x0f59('0x50')]({'where':{'id':_0x310e8f['params']['id']}})['then'](handleEntityNotFound(_0x170718,null))[_0x0f59('0x23')](saveUpdates(_0x310e8f[_0x0f59('0x4b')],null))[_0x0f59('0x23')](respondWithResult(_0x170718,null))[_0x0f59('0x43')](handleError(_0x170718,null));};exports[_0x0f59('0x24')]=function(_0x218789,_0x4cc68c){return db[_0x0f59('0x2d')][_0x0f59('0x50')]({'where':{'id':_0x218789[_0x0f59('0x45')]['id']}})[_0x0f59('0x23')](handleEntityNotFound(_0x4cc68c,null))[_0x0f59('0x23')](removeEntity(_0x4cc68c,null))[_0x0f59('0x43')](handleError(_0x4cc68c,null));};exports[_0x0f59('0x54')]=function(_0x24f6c9,_0x40cc94){return db[_0x0f59('0x2d')][_0x0f59('0x54')]()['then'](respondWithResult(_0x40cc94,null))[_0x0f59('0x43')](handleError(_0x40cc94,null));};exports[_0x0f59('0x55')]=function(_0x14a475,_0x2e13ef,_0x475796){var _0x54bf12={'raw':!![],'where':{}},_0x34ed56={},_0x5a8ff4;return db[_0x0f59('0x2d')][_0x0f59('0x56')]({'where':{'id':_0x14a475[_0x0f59('0x45')]['id']}})[_0x0f59('0x23')](handleEntityNotFound(_0x2e13ef,null))[_0x0f59('0x23')](function(_0x171bf7){if(_0x171bf7){_0x5a8ff4=_0x171bf7[_0x0f59('0x25')]({'plain':!![]});_0x34ed56[_0x0f59('0x31')]=_[_0x0f59('0x46')](db['UserFaxQueue'][_0x0f59('0x47')]);_0x34ed56[_0x0f59('0x32')]=_[_0x0f59('0x46')](_0x14a475['query']);_0x34ed56['filters']=_[_0x0f59('0x34')](_0x34ed56[_0x0f59('0x31')],_0x34ed56[_0x0f59('0x32')]);_0x54bf12['attributes']=_[_0x0f59('0x34')](_0x34ed56[_0x0f59('0x31')],qs['fields'](_0x14a475['query'][_0x0f59('0x48')]));_0x54bf12[_0x0f59('0x35')]=_0x54bf12[_0x0f59('0x35')][_0x0f59('0x49')]?_0x54bf12[_0x0f59('0x35')]:_0x34ed56['model'];if(!_0x14a475[_0x0f59('0x32')][_0x0f59('0x36')](_0x0f59('0x37'))){_0x54bf12[_0x0f59('0x38')]=qs[_0x0f59('0x38')](_0x14a475['query']['limit']);_0x54bf12[_0x0f59('0x1d')]=qs[_0x0f59('0x1d')](_0x14a475[_0x0f59('0x32')][_0x0f59('0x1d')]);}_0x54bf12[_0x0f59('0x39')]=qs['sort'](_0x14a475[_0x0f59('0x32')][_0x0f59('0x3a')]);_0x54bf12[_0x0f59('0x3d')]=qs[_0x0f59('0x33')](_[_0x0f59('0x57')](_0x14a475[_0x0f59('0x32')],_0x34ed56['filters']));_0x54bf12[_0x0f59('0x3d')][_0x0f59('0x58')]=_0x171bf7['id'];if(_0x14a475[_0x0f59('0x32')][_0x0f59('0x3b')]){_0x54bf12[_0x0f59('0x3d')]=_[_0x0f59('0x3c')](_0x54bf12[_0x0f59('0x3d')],{'$or':_[_0x0f59('0x2c')](_0x54bf12[_0x0f59('0x35')],function(_0x3c71b9){var _0x13a708={};_0x13a708[_0x3c71b9]={'$like':'%'+_0x14a475[_0x0f59('0x32')]['filter']+'%'};return _0x13a708;})});}_0x54bf12=_[_0x0f59('0x3c')]({},_0x54bf12,_0x14a475[_0x0f59('0x59')]);return db[_0x0f59('0x5a')][_0x0f59('0x41')](_0x54bf12);}})[_0x0f59('0x23')](function(_0x35cbbd){if(_0x35cbbd){return db[_0x0f59('0x5b')][_0x0f59('0x5c')]({'where':{'id':_[_0x0f59('0x2c')](_0x35cbbd,_0x0f59('0x5d')),'role':_0x0f59('0x5e')},'attributes':['id','name','faxPause',_0x0f59('0x5f'),_0x0f59('0x60')]});}})[_0x0f59('0x23')](function(_0x3b4a50){if(_0x3b4a50){return{'count':_0x3b4a50[_0x0f59('0x3f')],'rows':_[_0x0f59('0x2c')](_0x3b4a50['rows'],function(_0x52541b){return{'membername':_0x52541b[_0x0f59('0x29')],'UserId':_0x52541b['id'],'queue_name':_0x5a8ff4['name'],'FaxQueueId':_0x5a8ff4['id'],'interface':util[_0x0f59('0x61')](_0x0f59('0x62'),'SIP',_0x52541b[_0x0f59('0x29')]),'penalty':0x0,'paused':_0x52541b['faxPause'],'createdAt':_0x52541b['createdAt'],'updatedAt':_0x52541b['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f59('0x23')](respondWithFilteredResult(_0x2e13ef,_0x54bf12))[_0x0f59('0x43')](handleError(_0x2e13ef,null));};exports['getTeams']=function(_0x3f5b5f,_0x40c063,_0x35071d){var _0x1a53ff={};var _0x236926={};var _0x54b009;var _0x2bae6c;return db['FaxQueue'][_0x0f59('0x56')]({'where':{'id':_0x3f5b5f[_0x0f59('0x45')]['id']}})['then'](handleEntityNotFound(_0x40c063,null))[_0x0f59('0x23')](function(_0x300c35){if(_0x300c35){_0x54b009=_0x300c35;_0x236926[_0x0f59('0x31')]=_['keys'](db[_0x0f59('0x63')][_0x0f59('0x47')]);_0x236926[_0x0f59('0x32')]=_['keys'](_0x3f5b5f[_0x0f59('0x32')]);_0x236926[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x236926['model'],_0x236926[_0x0f59('0x32')]);_0x1a53ff[_0x0f59('0x35')]=_[_0x0f59('0x34')](_0x236926[_0x0f59('0x31')],qs['fields'](_0x3f5b5f[_0x0f59('0x32')][_0x0f59('0x48')]));_0x1a53ff[_0x0f59('0x35')]=_0x1a53ff[_0x0f59('0x35')][_0x0f59('0x49')]?_0x1a53ff[_0x0f59('0x35')]:_0x236926[_0x0f59('0x31')];_0x1a53ff[_0x0f59('0x39')]=qs[_0x0f59('0x3a')](_0x3f5b5f[_0x0f59('0x32')]['sort']);_0x1a53ff[_0x0f59('0x3d')]=qs['filters'](_[_0x0f59('0x57')](_0x3f5b5f['query'],_0x236926['filters']));if(_0x3f5b5f['query'][_0x0f59('0x3b')]){_0x1a53ff[_0x0f59('0x3d')]=_[_0x0f59('0x3c')](_0x1a53ff[_0x0f59('0x3d')],{'$or':_['map'](_0x1a53ff[_0x0f59('0x35')],function(_0x45f3a2){var _0x5c40a0={};_0x5c40a0[_0x45f3a2]={'$like':'%'+_0x3f5b5f['query']['filter']+'%'};return _0x5c40a0;})});}_0x1a53ff=_[_0x0f59('0x3c')]({},_0x1a53ff,_0x3f5b5f[_0x0f59('0x59')]);return _0x54b009[_0x0f59('0x64')](_0x1a53ff);}})[_0x0f59('0x23')](function(_0x1d1937){if(_0x1d1937){_0x2bae6c=_0x1d1937[_0x0f59('0x49')];if(!_0x3f5b5f[_0x0f59('0x32')][_0x0f59('0x36')](_0x0f59('0x37'))){_0x1a53ff[_0x0f59('0x38')]=qs['limit'](_0x3f5b5f['query'][_0x0f59('0x38')]);_0x1a53ff['offset']=qs['offset'](_0x3f5b5f[_0x0f59('0x32')][_0x0f59('0x1d')]);}return _0x54b009[_0x0f59('0x64')](_0x1a53ff);}})['then'](function(_0x3cc7b8){if(_0x3cc7b8){return _0x3cc7b8?{'count':_0x2bae6c,'rows':_0x3cc7b8}:null;}})[_0x0f59('0x23')](respondWithResult(_0x40c063,null))[_0x0f59('0x43')](handleError(_0x40c063,null));};exports[_0x0f59('0x65')]=function(_0x2a7599,_0x2822fb,_0x46b19a){var _0x2688a2=_0x2a7599[_0x0f59('0x4b')][_0x0f59('0x66')];return db[_0x0f59('0x63')][_0x0f59('0x41')]({'where':{'id':_0x2688a2},'attributes':['id'],'include':[{'model':db[_0x0f59('0x5b')],'as':_0x0f59('0x67'),'attributes':['id',_0x0f59('0x29'),_0x0f59('0x68'),'voicePause',_0x0f59('0x69')],'raw':!![]}]})[_0x0f59('0x23')](function(_0x21764b){if(_0x21764b){var _0x48cf12=_[_0x0f59('0x6a')](_0x21764b,function(_0x54ed10){var _0x5d897d=_0x54ed10['get']({'plain':!![]});return _0x5d897d[_0x0f59('0x67')];});return db['FaxQueue'][_0x0f59('0x50')]({'where':{'id':_0x2a7599[_0x0f59('0x45')]['id']}})[_0x0f59('0x23')](function(_0x74ac76){return db[_0x0f59('0x6b')][_0x0f59('0x6c')](function(_0x8a5893){return _0x74ac76[_0x0f59('0x65')](_0x2688a2,{'transaction':_0x8a5893})[_0x0f59('0x23')](function(){return BPromise['each'](_0x48cf12,function(_0x3b8abf){return db[_0x0f59('0x5a')][_0x0f59('0x6d')]({'where':{'UserId':_0x3b8abf['id'],'FaxQueueId':_0x2a7599[_0x0f59('0x45')]['id']},'transaction':_0x8a5893});});})[_0x0f59('0x23')](function(){_0x48cf12[_0x0f59('0x6e')](function(_0x3fa860){socket[_0x0f59('0x6f')](_0x0f59('0x70'),{'UserId':_0x3fa860['id'],'FaxQueueId':_0x74ac76['id']});});});});});}})[_0x0f59('0x23')](respondWithStatusCode(_0x2822fb,null))['catch'](handleError(_0x2822fb,null));};exports[_0x0f59('0x71')]=function(_0x39bad7,_0x703f78,_0x350469){return db[_0x0f59('0x63')]['findAll']({'where':{'id':_0x39bad7[_0x0f59('0x32')][_0x0f59('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x0f59('0x23')](handleEntityNotFound(_0x703f78,null))['then'](function(_0x83d460){var _0x34d4b9=_[_0x0f59('0x2c')](_0x83d460,'id');var _0x2bade6=[];var _0x4fd017=[];var _0x554353=squel[_0x0f59('0x72')]();_0x554353[_0x0f59('0x73')](_0x0f59('0x74'))['from']('team_has_fax_queues','tq')[_0x0f59('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0f59('0x3d')](_0x0f59('0x76'),_0x39bad7[_0x0f59('0x45')]['id']);for(var _0x2a60f0=0x0;_0x2a60f0<_0x83d460[_0x0f59('0x49')];_0x2a60f0+=0x1){let _0x5615e8=_0x83d460[_0x2a60f0];for(var _0x1e936a=0x0;_0x1e936a<_0x5615e8[_0x0f59('0x67')][_0x0f59('0x49')];_0x1e936a+=0x1){let _0x9494ea=_0x5615e8['Agents'][_0x1e936a];var _0x53c4b0=_0x554353['clone']();_0x53c4b0['where']('ut.UserId\x20=\x20?',_0x9494ea['id']);_0x4fd017[_0x0f59('0x77')](db['sequelize'][_0x0f59('0x32')](_0x53c4b0[_0x0f59('0x78')](),{'type':db['sequelize'][_0x0f59('0x79')]['SELECT']})['then'](function(_0xa57ac7){if(_0xa57ac7[_0x0f59('0x49')]===0x1){return _0x9494ea['id'];}else{var _0x364724=_[_0x0f59('0x7a')](_[_0x0f59('0x2c')](_0xa57ac7,_0x0f59('0x7b')),function(_0x593315){return _[_0x0f59('0x7c')](_0x34d4b9,_0x593315);});if(_0x364724){return _0x9494ea['id'];}}}));}}return BPromise['all'](_0x4fd017)[_0x0f59('0x23')](function(_0x32fd6b){_0x2bade6=_(_0x2bade6)[_0x0f59('0x7d')](_0x32fd6b)[_0x0f59('0x7e')]()[_0x0f59('0x7f')]();return db[_0x0f59('0x2d')][_0x0f59('0x50')]({'where':{'id':_0x39bad7['params']['id']}})[_0x0f59('0x23')](function(_0x563732){return db[_0x0f59('0x6b')][_0x0f59('0x6c')](function(_0x1c346f){return _0x563732[_0x0f59('0x71')](_0x39bad7['query'][_0x0f59('0x66')],{'transaction':_0x1c346f})[_0x0f59('0x23')](function(){if(!_[_0x0f59('0x80')](_0x2bade6)){return _0x563732[_0x0f59('0x81')](_0x2bade6,{'transaction':_0x1c346f});}})[_0x0f59('0x23')](function(){_0x2bade6[_0x0f59('0x6e')](function(_0x43e060){socket['emit']('userFaxQueue:remove',{'UserId':_0x43e060,'FaxQueueId':_0x563732['id']});});});});});});})[_0x0f59('0x23')](respondWithStatusCode(_0x703f78,null))[_0x0f59('0x43')](handleError(_0x703f78,null));};exports['addAgents']=function(_0x1dcf3a,_0x9fb2ae,_0xf1f0c3){return db[_0x0f59('0x2d')]['find']({'where':{'id':_0x1dcf3a[_0x0f59('0x45')]['id']}})['then'](handleEntityNotFound(_0x9fb2ae,null))[_0x0f59('0x23')](function(_0x2c3748){if(_0x2c3748){return _0x2c3748[_0x0f59('0x82')](_0x1dcf3a[_0x0f59('0x4b')][_0x0f59('0x66')],_[_0x0f59('0x83')](_0x1dcf3a['body'],[_0x0f59('0x66'),'id'])||{})[_0x0f59('0x84')](function(_0x1662b2){for(var _0x26c60c=0x0;_0x26c60c<_0x1dcf3a['body'][_0x0f59('0x66')][_0x0f59('0x49')];_0x26c60c+=0x1){socket[_0x0f59('0x6f')]('userFaxQueue:save',{'UserId':Number(_0x1dcf3a[_0x0f59('0x4b')][_0x0f59('0x66')][_0x26c60c]),'FaxQueueId':Number(_0x1dcf3a[_0x0f59('0x45')]['id'])});}return _0x1662b2;});}})[_0x0f59('0x23')](respondWithResult(_0x9fb2ae,null))[_0x0f59('0x43')](handleError(_0x9fb2ae,null));};exports['removeAgents']=function(_0x20e77f,_0x3bd161,_0x67e8fc){return db[_0x0f59('0x2d')][_0x0f59('0x50')]({'where':{'id':_0x20e77f[_0x0f59('0x45')]['id']}})[_0x0f59('0x23')](handleEntityNotFound(_0x3bd161,null))[_0x0f59('0x23')](function(_0x1a7f44){if(_0x1a7f44){return _0x1a7f44['removeAgents'](_0x20e77f[_0x0f59('0x32')]['ids'])[_0x0f59('0x23')](function(){if(_[_0x0f59('0x85')](_0x20e77f[_0x0f59('0x32')][_0x0f59('0x66')])){for(var _0x1e53e2=0x0;_0x1e53e2<_0x20e77f[_0x0f59('0x32')][_0x0f59('0x66')][_0x0f59('0x49')];_0x1e53e2+=0x1){socket[_0x0f59('0x6f')](_0x0f59('0x86'),{'UserId':Number(_0x20e77f[_0x0f59('0x32')][_0x0f59('0x66')][_0x1e53e2]),'FaxQueueId':Number(_0x20e77f[_0x0f59('0x45')]['id'])});}}else{socket[_0x0f59('0x6f')]('userFaxQueue:remove',{'UserId':Number(_0x20e77f['query'][_0x0f59('0x66')]),'FaxQueueId':Number(_0x20e77f['params']['id'])});}});}})[_0x0f59('0x23')](respondWithStatusCode(_0x3bd161,null))[_0x0f59('0x43')](handleError(_0x3bd161,null));};exports['getAgents']=function(_0x56ff31,_0xa7ca89,_0x57b94b){var _0x5a6da3={};var _0x266b2c={};var _0x11a562;var _0x505984;return db[_0x0f59('0x2d')]['findOne']({'where':{'id':_0x56ff31[_0x0f59('0x45')]['id']}})['then'](handleEntityNotFound(_0xa7ca89,null))['then'](function(_0x2d5032){if(_0x2d5032){_0x11a562=_0x2d5032;_0x266b2c['model']=_[_0x0f59('0x46')](db[_0x0f59('0x5b')][_0x0f59('0x47')]);_0x266b2c[_0x0f59('0x32')]=_[_0x0f59('0x46')](_0x56ff31[_0x0f59('0x32')]);_0x266b2c[_0x0f59('0x33')]=_[_0x0f59('0x34')](_0x266b2c['model'],_0x266b2c[_0x0f59('0x32')]);_0x5a6da3[_0x0f59('0x35')]=_['intersection'](_0x266b2c[_0x0f59('0x31')],qs[_0x0f59('0x48')](_0x56ff31[_0x0f59('0x32')]['fields']));_0x5a6da3[_0x0f59('0x35')]=_0x5a6da3[_0x0f59('0x35')][_0x0f59('0x49')]?_0x5a6da3['attributes']:_0x266b2c[_0x0f59('0x31')];_0x5a6da3[_0x0f59('0x39')]=qs[_0x0f59('0x3a')](_0x56ff31['query']['sort']);_0x5a6da3[_0x0f59('0x3d')]=qs[_0x0f59('0x33')](_[_0x0f59('0x57')](_0x56ff31['query'],_0x266b2c[_0x0f59('0x33')]));if(_0x56ff31['query'][_0x0f59('0x3b')]){_0x5a6da3[_0x0f59('0x3d')]=_[_0x0f59('0x3c')](_0x5a6da3['where'],{'$or':_['map'](_0x5a6da3[_0x0f59('0x35')],function(_0x3573b5){var _0x2ab087={};_0x2ab087[_0x3573b5]={'$like':'%'+_0x56ff31[_0x0f59('0x32')][_0x0f59('0x3b')]+'%'};return _0x2ab087;})});}_0x5a6da3=_[_0x0f59('0x3c')]({},_0x5a6da3,_0x56ff31[_0x0f59('0x59')]);return _0x11a562['getAgents'](_0x5a6da3);}})['then'](function(_0x34c880){if(_0x34c880){_0x505984=_0x34c880[_0x0f59('0x49')];if(!_0x56ff31[_0x0f59('0x32')]['hasOwnProperty'](_0x0f59('0x37'))){_0x5a6da3[_0x0f59('0x38')]=qs[_0x0f59('0x38')](_0x56ff31[_0x0f59('0x32')]['limit']);_0x5a6da3['offset']=qs['offset'](_0x56ff31[_0x0f59('0x32')][_0x0f59('0x1d')]);}return _0x11a562[_0x0f59('0x87')](_0x5a6da3);}})[_0x0f59('0x23')](function(_0x1e5122){if(_0x1e5122){return _0x1e5122?{'count':_0x505984,'rows':_0x1e5122}:null;}})[_0x0f59('0x23')](respondWithResult(_0xa7ca89,null))[_0x0f59('0x43')](handleError(_0xa7ca89,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index fadd1ca..5bba42c 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 _0xb632=['emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','update','remove'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0xb632,0xdc));var _0x2b63=function(_0x504ef8,_0x535706){_0x504ef8=_0x504ef8-0x0;var _0x597345=_0xb632[_0x504ef8];return _0x597345;};'use strict';var EventEmitter=require(_0x2b63('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x2b63('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2b63('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2b63('0x3'),'afterDestroy':_0x2b63('0x4')};function emitEvent(_0x196d30){return function(_0x4d8290,_0x1b16fe,_0xb4e00c){FaxQueueEvents[_0x2b63('0x5')](_0x196d30+':'+_0x4d8290['id'],_0x4d8290);FaxQueueEvents['emit'](_0x196d30,_0x4d8290);_0xb4e00c(null);};}for(var e in events){if(events[_0x2b63('0x6')](e)){var event=events[e];FaxQueue[_0x2b63('0x7')](e,emitEvent(event));}}module[_0x2b63('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x2017=['update','emit','hook','exports','events','../../mysqldb','save'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x2017,0x162));var _0x7201=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0x2017[_0x5c1cdc];return _0x2e8317;};'use strict';var EventEmitter=require(_0x7201('0x0'));var FaxQueue=require(_0x7201('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7201('0x2'),'afterUpdate':_0x7201('0x3'),'afterDestroy':'remove'};function emitEvent(_0xef6799){return function(_0xcadd9b,_0x21affc,_0x57de27){FaxQueueEvents[_0x7201('0x4')](_0xef6799+':'+_0xcadd9b['id'],_0xcadd9b);FaxQueueEvents[_0x7201('0x4')](_0xef6799,_0xcadd9b);_0x57de27(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x7201('0x5')](e,emitEvent(event));}}module[_0x7201('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index ef5ba0e..278e96b 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 _0x6550=['../../config/environment','./faxQueue.attributes','FaxQueue','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x584823,_0x20e0da){var _0x4df891=function(_0x4234e4){while(--_0x4234e4){_0x584823['push'](_0x584823['shift']());}};_0x4df891(++_0x20e0da);}(_0x6550,0x1cf));var _0x0655=function(_0x459be5,_0x2da5c5){_0x459be5=_0x459be5-0x0;var _0x239342=_0x6550[_0x459be5];return _0x239342;};'use strict';var _=require('lodash');var util=require(_0x0655('0x0'));var logger=require(_0x0655('0x1'))(_0x0655('0x2'));var moment=require(_0x0655('0x3'));var BPromise=require('bluebird');var rp=require(_0x0655('0x4'));var fs=require('fs');var path=require(_0x0655('0x5'));var rimraf=require(_0x0655('0x6'));var config=require(_0x0655('0x7'));var attributes=require(_0x0655('0x8'));module['exports']=function(_0x3e12f2,_0x45c3a5){return _0x3e12f2['define'](_0x0655('0x9'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91ca=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','fax_queues','util'];(function(_0x5aaf54,_0x116458){var _0xfad324=function(_0x4392e0){while(--_0x4392e0){_0x5aaf54['push'](_0x5aaf54['shift']());}};_0xfad324(++_0x116458);}(_0x91ca,0x1ad));var _0xa91c=function(_0x4d7707,_0x9784ca){_0x4d7707=_0x4d7707-0x0;var _0x5d3421=_0x91ca[_0x4d7707];return _0x5d3421;};'use strict';var _=require('lodash');var util=require(_0xa91c('0x0'));var logger=require(_0xa91c('0x1'))(_0xa91c('0x2'));var moment=require(_0xa91c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa91c('0x4'));var fs=require('fs');var path=require(_0xa91c('0x5'));var rimraf=require(_0xa91c('0x6'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xa91c('0x7')]=function(_0x2f8fd3,_0x502409){return _0x2f8fd3[_0xa91c('0x8')]('FaxQueue',attributes,{'tableName':_0xa91c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 5f8a93e..49a5641 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 _0x2af2=['request\x20sent','stringify','error','message','info','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowFaxQueue','find','debug','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s'];(function(_0x1fd842,_0x44c9db){var _0x16f894=function(_0x4e33fb){while(--_0x4e33fb){_0x1fd842['push'](_0x1fd842['shift']());}};_0x16f894(++_0x44c9db);}(_0x2af2,0xdc));var _0x22af=function(_0x5b7838,_0x25e81d){_0x5b7838=_0x5b7838-0x0;var _0x2817a3=_0x2af2[_0x5b7838];return _0x2817a3;};'use strict';var _=require(_0x22af('0x0'));var util=require(_0x22af('0x1'));var moment=require(_0x22af('0x2'));var BPromise=require(_0x22af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22af('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x22af('0x5'));var logger=require('../../config/logger')(_0x22af('0x6'));var config=require(_0x22af('0x7'));var jayson=require(_0x22af('0x8'));var client=jayson[_0x22af('0x9')][_0x22af('0xa')]({'port':0x232a});config['redis']=_[_0x22af('0xb')](config[_0x22af('0xc')],{'host':_0x22af('0xd'),'port':0x18eb});var socket=require(_0x22af('0xe'))(new Redis(config[_0x22af('0xc')]));require(_0x22af('0xf'))[_0x22af('0x10')](socket);function respondWithRpcPromise(_0x264d74,_0x1aea58,_0x56008c){return new BPromise(function(_0x318d6b,_0x4ef3f8){return client[_0x22af('0x11')](_0x264d74,_0x56008c)[_0x22af('0x12')](function(_0x1864b3){logger['info'](_0x22af('0x13'),_0x1aea58,_0x22af('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1aea58,_0x22af('0x14'),JSON[_0x22af('0x15')](_0x1864b3));if(_0x1864b3[_0x22af('0x16')]){if(_0x1864b3[_0x22af('0x16')]['code']===0x1f4){logger[_0x22af('0x16')](_0x22af('0x13'),_0x1aea58,_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);return _0x4ef3f8(_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);}logger['error'](_0x22af('0x13'),_0x1aea58,_0x1864b3[_0x22af('0x16')]['message']);return _0x318d6b(_0x1864b3[_0x22af('0x16')][_0x22af('0x17')]);}else{logger[_0x22af('0x18')](_0x22af('0x13'),_0x1aea58,'request\x20sent');_0x318d6b(_0x1864b3['result'][_0x22af('0x17')]);}})[_0x22af('0x19')](function(_0x12b49e){logger['error'](_0x22af('0x13'),_0x1aea58,_0x12b49e);_0x4ef3f8(_0x12b49e);});});}exports[_0x22af('0x1a')]=function(_0x4d8e62){var _0x18fe37=this;return new Promise(function(_0x3e9b4c,_0x1b54fb){return db[_0x22af('0x1b')][_0x22af('0x1c')]({'raw':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x1e')]===undefined?!![]:![]:!![],'where':_0x4d8e62['options']?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x1f')]||null:null,'attributes':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')]['attributes']||null:null,'limit':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62['options'][_0x22af('0x20')]||null:null,'include':_0x4d8e62[_0x22af('0x1d')]?_0x4d8e62[_0x22af('0x1d')][_0x22af('0x21')]?_['map'](_0x4d8e62['options']['include'],function(_0x51ff80){return{'model':db[_0x51ff80['model']],'as':_0x51ff80['as'],'attributes':_0x51ff80['attributes'],'include':_0x51ff80[_0x22af('0x21')]?_[_0x22af('0x22')](_0x51ff80[_0x22af('0x21')],function(_0x128de4){return{'model':db[_0x128de4[_0x22af('0x23')]],'as':_0x128de4['as'],'attributes':_0x128de4[_0x22af('0x24')],'include':_0x128de4['include']?_[_0x22af('0x22')](_0x128de4['include'],function(_0x443190){return{'model':db[_0x443190[_0x22af('0x23')]],'as':_0x443190['as'],'attributes':_0x443190[_0x22af('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b60ae){logger[_0x22af('0x18')](_0x22af('0x1a'),_0x4d8e62);logger['debug'](_0x22af('0x1a'),_0x4d8e62,JSON[_0x22af('0x15')](_0x1b60ae));_0x3e9b4c(_0x1b60ae);})[_0x22af('0x19')](function(_0x2b0bde){logger[_0x22af('0x16')]('GetFaxQueue',_0x2b0bde[_0x22af('0x17')],_0x4d8e62);_0x1b54fb(_0x18fe37[_0x22af('0x16')](0x1f4,_0x2b0bde['message']));});});};exports[_0x22af('0x25')]=function(_0x17af5d){var _0x1e1c9b=this;return new Promise(function(_0x25f2e3,_0x48372c){return db[_0x22af('0x1b')][_0x22af('0x26')]({'raw':_0x17af5d['options']?_0x17af5d[_0x22af('0x1d')][_0x22af('0x1e')]===undefined?!![]:![]:!![],'where':_0x17af5d[_0x22af('0x1d')]?_0x17af5d[_0x22af('0x1d')][_0x22af('0x1f')]||null:null,'attributes':_0x17af5d[_0x22af('0x1d')]?_0x17af5d[_0x22af('0x1d')][_0x22af('0x24')]||null:null,'include':_0x17af5d[_0x22af('0x1d')]?_0x17af5d['options'][_0x22af('0x21')]?_['map'](_0x17af5d['options'][_0x22af('0x21')],function(_0x8ef9b3){return{'model':db[_0x8ef9b3[_0x22af('0x23')]],'as':_0x8ef9b3['as'],'attributes':_0x8ef9b3[_0x22af('0x24')],'include':_0x8ef9b3[_0x22af('0x21')]?_['map'](_0x8ef9b3['include'],function(_0x32f525){return{'model':db[_0x32f525[_0x22af('0x23')]],'as':_0x32f525['as'],'attributes':_0x32f525[_0x22af('0x24')],'include':_0x32f525[_0x22af('0x21')]?_[_0x22af('0x22')](_0x32f525[_0x22af('0x21')],function(_0x310901){return{'model':db[_0x310901['model']],'as':_0x310901['as'],'attributes':_0x310901[_0x22af('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43e4e7){logger[_0x22af('0x18')]('ShowFaxQueue',_0x17af5d);logger[_0x22af('0x27')]('ShowFaxQueue',_0x17af5d,JSON[_0x22af('0x15')](_0x43e4e7));_0x25f2e3(_0x43e4e7);})[_0x22af('0x19')](function(_0x3245d8){logger[_0x22af('0x16')](_0x22af('0x25'),_0x3245d8[_0x22af('0x17')],_0x17af5d);_0x48372c(_0x1e1c9b[_0x22af('0x16')](0x1f4,_0x3245d8[_0x22af('0x17')]));});});}; \ No newline at end of file +var _0xf918=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','raw','options','where','limit','include','model','attributes','map','GetFaxQueue','ShowFaxQueue','FaxQueue','find','lodash','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf918,0x18d));var _0x8f91=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xf918[_0x6f1a87];return _0x2495c7;};'use strict';var _=require(_0x8f91('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8f91('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f91('0x2'));var db=require(_0x8f91('0x3'))['db'];var utils=require(_0x8f91('0x4'));var logger=require(_0x8f91('0x5'))(_0x8f91('0x6'));var config=require(_0x8f91('0x7'));var jayson=require(_0x8f91('0x8'));var client=jayson['client'][_0x8f91('0x9')]({'port':0x232a});config[_0x8f91('0xa')]=_[_0x8f91('0xb')](config[_0x8f91('0xa')],{'host':_0x8f91('0xc'),'port':0x18eb});var socket=require(_0x8f91('0xd'))(new Redis(config['redis']));require(_0x8f91('0xe'))[_0x8f91('0xf')](socket);function respondWithRpcPromise(_0xa9f067,_0x3928ef,_0x278bbb){return new BPromise(function(_0x798c4,_0x510ea9){return client[_0x8f91('0x10')](_0xa9f067,_0x278bbb)[_0x8f91('0x11')](function(_0x143117){logger[_0x8f91('0x12')](_0x8f91('0x13'),_0x3928ef,_0x8f91('0x14'));logger[_0x8f91('0x15')](_0x8f91('0x16'),_0x3928ef,_0x8f91('0x14'),JSON[_0x8f91('0x17')](_0x143117));if(_0x143117[_0x8f91('0x18')]){if(_0x143117[_0x8f91('0x18')]['code']===0x1f4){logger['error'](_0x8f91('0x13'),_0x3928ef,_0x143117['error'][_0x8f91('0x19')]);return _0x510ea9(_0x143117['error']['message']);}logger[_0x8f91('0x18')](_0x8f91('0x13'),_0x3928ef,_0x143117[_0x8f91('0x18')]['message']);return _0x798c4(_0x143117[_0x8f91('0x18')][_0x8f91('0x19')]);}else{logger['info'](_0x8f91('0x13'),_0x3928ef,_0x8f91('0x14'));_0x798c4(_0x143117[_0x8f91('0x1a')][_0x8f91('0x19')]);}})[_0x8f91('0x1b')](function(_0x2fd828){logger['error'](_0x8f91('0x13'),_0x3928ef,_0x2fd828);_0x510ea9(_0x2fd828);});});}exports['GetFaxQueue']=function(_0x3e62e5){var _0x20e5dc=this;return new Promise(function(_0xdceb4b,_0x36eed4){return db['FaxQueue']['findAll']({'raw':_0x3e62e5['options']?_0x3e62e5['options'][_0x8f91('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e62e5[_0x8f91('0x1d')]?_0x3e62e5[_0x8f91('0x1d')][_0x8f91('0x1e')]||null:null,'attributes':_0x3e62e5[_0x8f91('0x1d')]?_0x3e62e5[_0x8f91('0x1d')]['attributes']||null:null,'limit':_0x3e62e5[_0x8f91('0x1d')]?_0x3e62e5[_0x8f91('0x1d')][_0x8f91('0x1f')]||null:null,'include':_0x3e62e5[_0x8f91('0x1d')]?_0x3e62e5[_0x8f91('0x1d')][_0x8f91('0x20')]?_['map'](_0x3e62e5[_0x8f91('0x1d')]['include'],function(_0x4fb447){return{'model':db[_0x4fb447[_0x8f91('0x21')]],'as':_0x4fb447['as'],'attributes':_0x4fb447[_0x8f91('0x22')],'include':_0x4fb447['include']?_['map'](_0x4fb447[_0x8f91('0x20')],function(_0x5fff54){return{'model':db[_0x5fff54['model']],'as':_0x5fff54['as'],'attributes':_0x5fff54[_0x8f91('0x22')],'include':_0x5fff54[_0x8f91('0x20')]?_[_0x8f91('0x23')](_0x5fff54['include'],function(_0x44d23b){return{'model':db[_0x44d23b['model']],'as':_0x44d23b['as'],'attributes':_0x44d23b[_0x8f91('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8f91('0x11')](function(_0x2ffecb){logger[_0x8f91('0x12')](_0x8f91('0x24'),_0x3e62e5);logger[_0x8f91('0x15')](_0x8f91('0x24'),_0x3e62e5,JSON['stringify'](_0x2ffecb));_0xdceb4b(_0x2ffecb);})[_0x8f91('0x1b')](function(_0x345e95){logger[_0x8f91('0x18')](_0x8f91('0x24'),_0x345e95[_0x8f91('0x19')],_0x3e62e5);_0x36eed4(_0x20e5dc[_0x8f91('0x18')](0x1f4,_0x345e95['message']));});});};exports[_0x8f91('0x25')]=function(_0x190c75){var _0xf7fd41=this;return new Promise(function(_0x4da045,_0x480449){return db[_0x8f91('0x26')][_0x8f91('0x27')]({'raw':_0x190c75['options']?_0x190c75[_0x8f91('0x1d')][_0x8f91('0x1c')]===undefined?!![]:![]:!![],'where':_0x190c75['options']?_0x190c75[_0x8f91('0x1d')][_0x8f91('0x1e')]||null:null,'attributes':_0x190c75[_0x8f91('0x1d')]?_0x190c75[_0x8f91('0x1d')][_0x8f91('0x22')]||null:null,'include':_0x190c75[_0x8f91('0x1d')]?_0x190c75['options'][_0x8f91('0x20')]?_[_0x8f91('0x23')](_0x190c75[_0x8f91('0x1d')][_0x8f91('0x20')],function(_0x278507){return{'model':db[_0x278507['model']],'as':_0x278507['as'],'attributes':_0x278507[_0x8f91('0x22')],'include':_0x278507['include']?_[_0x8f91('0x23')](_0x278507['include'],function(_0x1f4b17){return{'model':db[_0x1f4b17[_0x8f91('0x21')]],'as':_0x1f4b17['as'],'attributes':_0x1f4b17[_0x8f91('0x22')],'include':_0x1f4b17[_0x8f91('0x20')]?_[_0x8f91('0x23')](_0x1f4b17[_0x8f91('0x20')],function(_0x5a7f86){return{'model':db[_0x5a7f86[_0x8f91('0x21')]],'as':_0x5a7f86['as'],'attributes':_0x5a7f86[_0x8f91('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8f91('0x11')](function(_0x4b4ebd){logger[_0x8f91('0x12')](_0x8f91('0x25'),_0x190c75);logger[_0x8f91('0x15')](_0x8f91('0x25'),_0x190c75,JSON['stringify'](_0x4b4ebd));_0x4da045(_0x4b4ebd);})['catch'](function(_0x2de2b8){logger[_0x8f91('0x18')](_0x8f91('0x25'),_0x2de2b8[_0x8f91('0x19')],_0x190c75);_0x480449(_0xf7fd41[_0x8f91('0x18')](0x1f4,_0x2de2b8[_0x8f91('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f3399dd..b2a8412 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 _0xd6d7=['./faxQueue.events','save','remove','update','emit','removeListener','register','length'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xd6d7,0x70));var _0x7d6d=function(_0x5c490c,_0x17cc06){_0x5c490c=_0x5c490c-0x0;var _0x344996=_0xd6d7[_0x5c490c];return _0x344996;};'use strict';var FaxQueueEvents=require(_0x7d6d('0x0'));var events=[_0x7d6d('0x1'),_0x7d6d('0x2'),_0x7d6d('0x3')];function createListener(_0x1b080e,_0x2804c9){return function(_0x3aab4a){_0x2804c9[_0x7d6d('0x4')](_0x1b080e,_0x3aab4a);};}function removeListener(_0x194fb9,_0x393ef0){return function(){FaxQueueEvents[_0x7d6d('0x5')](_0x194fb9,_0x393ef0);};}exports[_0x7d6d('0x6')]=function(_0x11b276){for(var _0x3c4a85=0x0,_0xda917e=events[_0x7d6d('0x7')];_0x3c4a85<_0xda917e;_0x3c4a85++){var _0x4ef787=events[_0x3c4a85];var _0x255d96=createListener('faxQueue:'+_0x4ef787,_0x11b276);FaxQueueEvents['on'](_0x4ef787,_0x255d96);}}; \ No newline at end of file +var _0xeff8=['update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x2aa870,_0x58351e){var _0x42202e=function(_0x213ea4){while(--_0x213ea4){_0x2aa870['push'](_0x2aa870['shift']());}};_0x42202e(++_0x58351e);}(_0xeff8,0x186));var _0x8eff=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xeff8[_0x50007c];return _0x5c1ec7;};'use strict';var FaxQueueEvents=require(_0x8eff('0x0'));var events=[_0x8eff('0x1'),'remove',_0x8eff('0x2')];function createListener(_0x354ff4,_0x1e55a0){return function(_0x55e437){_0x1e55a0[_0x8eff('0x3')](_0x354ff4,_0x55e437);};}function removeListener(_0x2a6581,_0x4ba2bf){return function(){FaxQueueEvents[_0x8eff('0x4')](_0x2a6581,_0x4ba2bf);};}exports['register']=function(_0x469641){for(var _0xb54063=0x0,_0x3409bc=events[_0x8eff('0x5')];_0xb54063<_0x3409bc;_0xb54063++){var _0x491f01=events[_0xb54063];var _0x3fb9ee=createListener(_0x8eff('0x6')+_0x491f01,_0x469641);FaxQueueEvents['on'](_0x491f01,_0x3fb9ee);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 8ebafb8..6686214 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 _0xed1c=['/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/teams','getTeams'];(function(_0x19e128,_0x54764d){var _0x2c27a7=function(_0x59f66c){while(--_0x59f66c){_0x19e128['push'](_0x19e128['shift']());}};_0x2c27a7(++_0x54764d);}(_0xed1c,0xe4));var _0xced1=function(_0x4808ee,_0x5e1d72){_0x4808ee=_0x4808ee-0x0;var _0x23ed56=_0xed1c[_0x4808ee];return _0x23ed56;};'use strict';var multer=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xced1('0x2'));var auth=require(_0xced1('0x3'));var interaction=require(_0xced1('0x4'));var config=require('../../config/environment');var controller=require(_0xced1('0x5'));router[_0xced1('0x6')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x8')]);router['get'](_0xced1('0x9'),auth[_0xced1('0x7')](),controller[_0xced1('0xa')]);router[_0xced1('0x6')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0xc')]);router[_0xced1('0x6')]('/:id/members',auth[_0xced1('0x7')](),controller['getMembers']);router[_0xced1('0x6')](_0xced1('0xd'),auth[_0xced1('0x7')](),controller[_0xced1('0xe')]);router[_0xced1('0x6')](_0xced1('0xf'),auth[_0xced1('0x7')](),controller['getAgents']);router[_0xced1('0x10')]('/',auth[_0xced1('0x7')](),controller[_0xced1('0x11')]);router[_0xced1('0x10')]('/:id/teams',auth[_0xced1('0x7')](),controller[_0xced1('0x12')]);router['post'](_0xced1('0xf'),auth[_0xced1('0x7')](),controller[_0xced1('0x13')]);router[_0xced1('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xced1('0x15')]);router[_0xced1('0x16')](_0xced1('0xb'),auth[_0xced1('0x7')](),controller[_0xced1('0x17')]);router[_0xced1('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0xced1('0x18')]);router[_0xced1('0x16')](_0xced1('0xf'),auth['isAuthenticated'](),controller[_0xced1('0x19')]);module[_0xced1('0x1a')]=router; \ No newline at end of file +var _0x6d11=['destroy','removeTeams','multer','util','path','express','fs-extra','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','update','delete'];(function(_0x511a39,_0xe1365){var _0x5a81ef=function(_0x4d503d){while(--_0x4d503d){_0x511a39['push'](_0x511a39['shift']());}};_0x5a81ef(++_0xe1365);}(_0x6d11,0xbf));var _0x16d1=function(_0xc228ee,_0x2dff92){_0xc228ee=_0xc228ee-0x0;var _0x305b2b=_0x6d11[_0xc228ee];return _0x305b2b;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['describe']);router['get']('/:id',auth[_0x16d1('0x8')](),controller[_0x16d1('0xb')]);router[_0x16d1('0x7')](_0x16d1('0xc'),auth['isAuthenticated'](),controller[_0x16d1('0xd')]);router[_0x16d1('0x7')](_0x16d1('0xe'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xf')]);router[_0x16d1('0x7')](_0x16d1('0x10'),auth[_0x16d1('0x8')](),controller['getAgents']);router[_0x16d1('0x11')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x12')]);router[_0x16d1('0x11')](_0x16d1('0xe'),auth['isAuthenticated'](),controller[_0x16d1('0x13')]);router[_0x16d1('0x11')](_0x16d1('0x10'),auth[_0x16d1('0x8')](),controller[_0x16d1('0x14')]);router[_0x16d1('0x15')](_0x16d1('0x16'),auth['isAuthenticated'](),controller[_0x16d1('0x17')]);router[_0x16d1('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x16d1('0x19')]);router['delete'](_0x16d1('0xe'),auth['isAuthenticated'](),controller[_0x16d1('0x1a')]);router['delete'](_0x16d1('0x10'),auth[_0x16d1('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 3ab2fbd..466a235 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 _0x4139=['sequelize','exports','STRING','DATE'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x4139,0x140));var _0x9413=function(_0x74aabb,_0x1e8757){_0x74aabb=_0x74aabb-0x0;var _0x48fd8e=_0x4139[_0x74aabb];return _0x48fd8e;};'use strict';var moment=require('moment');var Sequelize=require(_0x9413('0x0'));module[_0x9413('0x1')]={'uniqueid':{'type':Sequelize[_0x9413('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9413('0x2')]},'joinAt':{'type':Sequelize[_0x9413('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x9413('0x3')]},'exitAt':{'type':Sequelize[_0x9413('0x3')]},'reason':{'type':Sequelize[_0x9413('0x2')]}}; \ No newline at end of file +var _0x5993=['exports','STRING','DATE','moment','sequelize'];(function(_0x191cc4,_0x51026f){var _0x9be594=function(_0x2988d5){while(--_0x2988d5){_0x191cc4['push'](_0x191cc4['shift']());}};_0x9be594(++_0x51026f);}(_0x5993,0x71));var _0x3599=function(_0xbc346f,_0x3db5c0){_0xbc346f=_0xbc346f-0x0;var _0x9f9260=_0x5993[_0xbc346f];return _0x9f9260;};'use strict';var moment=require(_0x3599('0x0'));var Sequelize=require(_0x3599('0x1'));module[_0x3599('0x2')]={'uniqueid':{'type':Sequelize[_0x3599('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3599('0x4')]},'leaveAt':{'type':Sequelize[_0x3599('0x4')]},'acceptAt':{'type':Sequelize[_0x3599('0x4')]},'exitAt':{'type':Sequelize[_0x3599('0x4')]},'reason':{'type':Sequelize[_0x3599('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 4e68cfa..85f58b6 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 _0x4584=['params','includeAll','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x4584,0x1cf));var _0x4458=function(_0x10d52b,_0xc6a4f1){_0x10d52b=_0x10d52b-0x0;var _0x2bf44a=_0x4584[_0x10d52b];return _0x2bf44a;};'use strict';var emlformat=require(_0x4458('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4458('0x1'));var jsonpatch=require(_0x4458('0x2'));var rp=require(_0x4458('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4458('0x4'));var util=require(_0x4458('0x5'));var path=require(_0x4458('0x6'));var sox=require(_0x4458('0x7'));var csv=require(_0x4458('0x8'));var ejs=require(_0x4458('0x9'));var fs=require('fs');var fs_extra=require(_0x4458('0xa'));var _=require(_0x4458('0xb'));var squel=require(_0x4458('0xc'));var crypto=require('crypto');var jsforce=require(_0x4458('0xd'));var deskjs=require(_0x4458('0xe'));var toCsv=require(_0x4458('0x8'));var querystring=require(_0x4458('0xf'));var Papa=require(_0x4458('0x10'));var Redis=require(_0x4458('0x11'));var authService=require(_0x4458('0x12'));var qs=require(_0x4458('0x13'));var as=require(_0x4458('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4458('0x15'))(_0x4458('0x16'));var utils=require(_0x4458('0x17'));var config=require(_0x4458('0x18'));var licenseUtil=require(_0x4458('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302552,_0x527809){_0x527809=_0x527809||0xcc;return function(_0x1f13ab){if(_0x1f13ab){return _0x302552['sendStatus'](_0x527809);}return _0x302552[_0x4458('0x1a')](_0x527809)[_0x4458('0x1b')]();};}function respondWithResult(_0x4abaf9,_0x5e2f05){_0x5e2f05=_0x5e2f05||0xc8;return function(_0x42771e){if(_0x42771e){return _0x4abaf9[_0x4458('0x1a')](_0x5e2f05)[_0x4458('0x1c')](_0x42771e);}};}function respondWithFilteredResult(_0x2619ed,_0x30d440){return function(_0x21ff11){if(_0x21ff11){var _0x225679=typeof _0x30d440[_0x4458('0x1d')]==='undefined'&&typeof _0x30d440[_0x4458('0x1e')]==='undefined';var _0x3bb7f4=_0x21ff11[_0x4458('0x1f')];var _0x130d39=_0x225679?0x0:_0x30d440['offset'];var _0x319247=_0x225679?_0x21ff11[_0x4458('0x1f')]:_0x30d440[_0x4458('0x1d')]+_0x30d440[_0x4458('0x1e')];var _0x463809;if(_0x319247>=_0x3bb7f4){_0x319247=_0x3bb7f4;_0x463809=0xc8;}else{_0x463809=0xce;}_0x2619ed[_0x4458('0x1a')](_0x463809);return _0x2619ed[_0x4458('0x20')](_0x4458('0x21'),_0x130d39+'-'+_0x319247+'/'+_0x3bb7f4)[_0x4458('0x1c')](_0x21ff11);}return null;};}function patchUpdates(_0x2dfcf1){return function(_0x531ab6){try{jsonpatch[_0x4458('0x22')](_0x531ab6,_0x2dfcf1,!![]);}catch(_0x24ecd1){return BPromise[_0x4458('0x23')](_0x24ecd1);}return _0x531ab6['save']();};}function saveUpdates(_0xe09a2b,_0x1688f2){return function(_0x58aeca){if(_0x58aeca){return _0x58aeca[_0x4458('0x24')](_0xe09a2b)[_0x4458('0x25')](function(_0x5d3df2){return _0x5d3df2;});}return null;};}function removeEntity(_0xcf668c,_0x17e482){return function(_0x3e7945){if(_0x3e7945){return _0x3e7945['destroy']()[_0x4458('0x25')](function(){_0xcf668c['status'](0xcc)[_0x4458('0x1b')]();});}};}function handleEntityNotFound(_0x504a86,_0x543e21){return function(_0x277b1c){if(!_0x277b1c){_0x504a86[_0x4458('0x26')](0x194);}return _0x277b1c;};}function handleError(_0x1631d3,_0x25ade9){_0x25ade9=_0x25ade9||0x1f4;return function(_0x153a98){logger[_0x4458('0x27')](_0x153a98[_0x4458('0x28')]);if(_0x153a98[_0x4458('0x29')]){delete _0x153a98[_0x4458('0x29')];}_0x1631d3[_0x4458('0x1a')](_0x25ade9)[_0x4458('0x2a')](_0x153a98);};}exports['index']=function(_0x179be7,_0x4e076a){var _0x4579d9={},_0x5f22be={},_0x19dc1f={'count':0x0,'rows':[]};var _0x6bdb4c=_[_0x4458('0x2b')](db[_0x4458('0x2c')][_0x4458('0x2d')],function(_0x235832){return{'name':_0x235832[_0x4458('0x2e')],'type':_0x235832[_0x4458('0x2f')][_0x4458('0x30')]};});_0x5f22be[_0x4458('0x31')]=_[_0x4458('0x2b')](_0x6bdb4c,_0x4458('0x29'));_0x5f22be[_0x4458('0x32')]=_[_0x4458('0x33')](_0x179be7['query']);_0x5f22be[_0x4458('0x34')]=_[_0x4458('0x35')](_0x5f22be[_0x4458('0x31')],_0x5f22be[_0x4458('0x32')]);_0x4579d9[_0x4458('0x36')]=_[_0x4458('0x35')](_0x5f22be[_0x4458('0x31')],qs[_0x4458('0x37')](_0x179be7['query']['fields']));_0x4579d9['attributes']=_0x4579d9[_0x4458('0x36')][_0x4458('0x38')]?_0x4579d9[_0x4458('0x36')]:_0x5f22be[_0x4458('0x31')];if(!_0x179be7[_0x4458('0x32')][_0x4458('0x39')](_0x4458('0x3a'))){_0x4579d9[_0x4458('0x1e')]=qs[_0x4458('0x1e')](_0x179be7[_0x4458('0x32')][_0x4458('0x1e')]);_0x4579d9[_0x4458('0x1d')]=qs[_0x4458('0x1d')](_0x179be7['query'][_0x4458('0x1d')]);}_0x4579d9['order']=qs[_0x4458('0x3b')](_0x179be7[_0x4458('0x32')][_0x4458('0x3b')]);_0x4579d9[_0x4458('0x3c')]=qs['filters'](_['pick'](_0x179be7[_0x4458('0x32')],_0x5f22be[_0x4458('0x34')]),_0x6bdb4c);if(_0x179be7[_0x4458('0x32')]['filter']){_0x4579d9[_0x4458('0x3c')]=_[_0x4458('0x3d')](_0x4579d9[_0x4458('0x3c')],{'$or':_[_0x4458('0x2b')](_0x6bdb4c,function(_0x2751f6){if(_0x2751f6[_0x4458('0x2f')]!==_0x4458('0x3e')){var _0x39d151={};_0x39d151[_0x2751f6[_0x4458('0x29')]]={'$like':'%'+_0x179be7[_0x4458('0x32')]['filter']+'%'};return _0x39d151;}})});}_0x4579d9=_['merge']({},_0x4579d9,_0x179be7[_0x4458('0x3f')]);var _0x17fe5a={'where':_0x4579d9[_0x4458('0x3c')]};return db[_0x4458('0x2c')][_0x4458('0x1f')](_0x17fe5a)[_0x4458('0x25')](function(_0x2a66e9){_0x19dc1f[_0x4458('0x1f')]=_0x2a66e9;if(_0x179be7[_0x4458('0x32')]['includeAll']){_0x4579d9[_0x4458('0x40')]=[{'all':!![]}];}return db[_0x4458('0x2c')][_0x4458('0x41')](_0x4579d9);})[_0x4458('0x25')](function(_0x2e98ce){_0x19dc1f[_0x4458('0x42')]=_0x2e98ce;return _0x19dc1f;})[_0x4458('0x25')](respondWithFilteredResult(_0x4e076a,_0x4579d9))[_0x4458('0x43')](handleError(_0x4e076a,null));};exports[_0x4458('0x44')]=function(_0xb7e263,_0x56f900){var _0x35b56f={'raw':!![],'where':{'id':_0xb7e263[_0x4458('0x45')]['id']}},_0x474735={};_0x474735[_0x4458('0x31')]=_[_0x4458('0x33')](db['FaxQueueReport']['rawAttributes']);_0x474735['query']=_[_0x4458('0x33')](_0xb7e263[_0x4458('0x32')]);_0x474735[_0x4458('0x34')]=_['intersection'](_0x474735[_0x4458('0x31')],_0x474735['query']);_0x35b56f['attributes']=_['intersection'](_0x474735[_0x4458('0x31')],qs[_0x4458('0x37')](_0xb7e263['query'][_0x4458('0x37')]));_0x35b56f[_0x4458('0x36')]=_0x35b56f['attributes']['length']?_0x35b56f[_0x4458('0x36')]:_0x474735[_0x4458('0x31')];if(_0xb7e263[_0x4458('0x32')][_0x4458('0x46')]){_0x35b56f[_0x4458('0x40')]=[{'all':!![]}];}_0x35b56f=_['merge']({},_0x35b56f,_0xb7e263[_0x4458('0x3f')]);return db['FaxQueueReport']['find'](_0x35b56f)['then'](handleEntityNotFound(_0x56f900,null))['then'](respondWithResult(_0x56f900,null))[_0x4458('0x43')](handleError(_0x56f900,null));};exports[_0x4458('0x47')]=function(_0x5b7221,_0x2b6946){return db['FaxQueueReport'][_0x4458('0x47')](_0x5b7221[_0x4458('0x48')],{})[_0x4458('0x25')](respondWithResult(_0x2b6946,0xc9))[_0x4458('0x43')](handleError(_0x2b6946,null));};exports[_0x4458('0x24')]=function(_0x455931,_0x3dd938){if(_0x455931[_0x4458('0x48')]['id']){delete _0x455931[_0x4458('0x48')]['id'];}return db[_0x4458('0x2c')][_0x4458('0x49')]({'where':{'id':_0x455931[_0x4458('0x45')]['id']}})[_0x4458('0x25')](handleEntityNotFound(_0x3dd938,null))[_0x4458('0x25')](saveUpdates(_0x455931[_0x4458('0x48')],null))[_0x4458('0x25')](respondWithResult(_0x3dd938,null))['catch'](handleError(_0x3dd938,null));};exports[_0x4458('0x4a')]=function(_0x5251e1,_0x3e57e0){return db[_0x4458('0x2c')][_0x4458('0x49')]({'where':{'id':_0x5251e1['params']['id']}})[_0x4458('0x25')](handleEntityNotFound(_0x3e57e0,null))[_0x4458('0x25')](removeEntity(_0x3e57e0,null))['catch'](handleError(_0x3e57e0,null));};exports[_0x4458('0x4b')]=function(_0x39d159,_0x4297b5){return db[_0x4458('0x2c')][_0x4458('0x4b')]()[_0x4458('0x25')](respondWithResult(_0x4297b5,null))['catch'](handleError(_0x4297b5,null));}; \ No newline at end of file +var _0x4d46=['sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','map','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','type','VIRTUAL','filter','merge','options','FaxQueueReport','include','rows','catch','show','params','keys','includeAll','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x95ea0d,_0x9e52c3){var _0x3ea17d=function(_0x103ff0){while(--_0x103ff0){_0x95ea0d['push'](_0x95ea0d['shift']());}};_0x3ea17d(++_0x9e52c3);}(_0x4d46,0x197));var _0x64d4=function(_0x2defb5,_0x1cda14){_0x2defb5=_0x2defb5-0x0;var _0x229c53=_0x4d46[_0x2defb5];return _0x229c53;};'use strict';var emlformat=require(_0x64d4('0x0'));var rimraf=require(_0x64d4('0x1'));var zipdir=require(_0x64d4('0x2'));var jsonpatch=require(_0x64d4('0x3'));var rp=require(_0x64d4('0x4'));var moment=require(_0x64d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x64d4('0x6'));var util=require(_0x64d4('0x7'));var path=require(_0x64d4('0x8'));var sox=require(_0x64d4('0x9'));var csv=require(_0x64d4('0xa'));var ejs=require(_0x64d4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64d4('0xc'));var squel=require(_0x64d4('0xd'));var crypto=require('crypto');var jsforce=require(_0x64d4('0xe'));var deskjs=require(_0x64d4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x64d4('0x10'));var as=require(_0x64d4('0x11'));var hardwareService=require(_0x64d4('0x12'));var logger=require(_0x64d4('0x13'))(_0x64d4('0x14'));var utils=require(_0x64d4('0x15'));var config=require(_0x64d4('0x16'));var licenseUtil=require(_0x64d4('0x17'));var db=require(_0x64d4('0x18'))['db'];function respondWithStatusCode(_0x4a4cbe,_0x3d3b97){_0x3d3b97=_0x3d3b97||0xcc;return function(_0x553f90){if(_0x553f90){return _0x4a4cbe[_0x64d4('0x19')](_0x3d3b97);}return _0x4a4cbe[_0x64d4('0x1a')](_0x3d3b97)[_0x64d4('0x1b')]();};}function respondWithResult(_0x4762a9,_0x13b111){_0x13b111=_0x13b111||0xc8;return function(_0x2b0c39){if(_0x2b0c39){return _0x4762a9['status'](_0x13b111)[_0x64d4('0x1c')](_0x2b0c39);}};}function respondWithFilteredResult(_0x433af8,_0x4574c2){return function(_0x3a25a3){if(_0x3a25a3){var _0x1b005a=typeof _0x4574c2[_0x64d4('0x1d')]===_0x64d4('0x1e')&&typeof _0x4574c2['limit']===_0x64d4('0x1e');var _0x260561=_0x3a25a3['count'];var _0x1bbaf0=_0x1b005a?0x0:_0x4574c2[_0x64d4('0x1d')];var _0x13900e=_0x1b005a?_0x3a25a3[_0x64d4('0x1f')]:_0x4574c2[_0x64d4('0x1d')]+_0x4574c2[_0x64d4('0x20')];var _0x1b2516;if(_0x13900e>=_0x260561){_0x13900e=_0x260561;_0x1b2516=0xc8;}else{_0x1b2516=0xce;}_0x433af8[_0x64d4('0x1a')](_0x1b2516);return _0x433af8['set'](_0x64d4('0x21'),_0x1bbaf0+'-'+_0x13900e+'/'+_0x260561)[_0x64d4('0x1c')](_0x3a25a3);}return null;};}function patchUpdates(_0x35ee04){return function(_0xf6e129){try{jsonpatch['apply'](_0xf6e129,_0x35ee04,!![]);}catch(_0x4d9f29){return BPromise[_0x64d4('0x22')](_0x4d9f29);}return _0xf6e129[_0x64d4('0x23')]();};}function saveUpdates(_0x374119,_0x4c0b0b){return function(_0x3c7a8c){if(_0x3c7a8c){return _0x3c7a8c[_0x64d4('0x24')](_0x374119)[_0x64d4('0x25')](function(_0x3259a0){return _0x3259a0;});}return null;};}function removeEntity(_0x157639,_0x2fec7d){return function(_0x4b8b72){if(_0x4b8b72){return _0x4b8b72[_0x64d4('0x26')]()[_0x64d4('0x25')](function(){_0x157639[_0x64d4('0x1a')](0xcc)[_0x64d4('0x1b')]();});}};}function handleEntityNotFound(_0x4ee0b9,_0x494640){return function(_0x598457){if(!_0x598457){_0x4ee0b9[_0x64d4('0x19')](0x194);}return _0x598457;};}function handleError(_0x58d1e8,_0x24c45e){_0x24c45e=_0x24c45e||0x1f4;return function(_0x512d67){logger[_0x64d4('0x27')](_0x512d67[_0x64d4('0x28')]);if(_0x512d67[_0x64d4('0x29')]){delete _0x512d67[_0x64d4('0x29')];}_0x58d1e8[_0x64d4('0x1a')](_0x24c45e)['send'](_0x512d67);};}exports['index']=function(_0x3865ef,_0x2a38b4){var _0x236691={},_0x18e1b1={},_0x77912e={'count':0x0,'rows':[]};var _0x1c3347=_[_0x64d4('0x2a')](db['FaxQueueReport']['rawAttributes'],function(_0x184813){return{'name':_0x184813[_0x64d4('0x2b')],'type':_0x184813['type'][_0x64d4('0x2c')]};});_0x18e1b1[_0x64d4('0x2d')]=_[_0x64d4('0x2a')](_0x1c3347,_0x64d4('0x29'));_0x18e1b1[_0x64d4('0x2e')]=_['keys'](_0x3865ef[_0x64d4('0x2e')]);_0x18e1b1['filters']=_['intersection'](_0x18e1b1[_0x64d4('0x2d')],_0x18e1b1[_0x64d4('0x2e')]);_0x236691['attributes']=_[_0x64d4('0x2f')](_0x18e1b1['model'],qs[_0x64d4('0x30')](_0x3865ef[_0x64d4('0x2e')]['fields']));_0x236691['attributes']=_0x236691[_0x64d4('0x31')][_0x64d4('0x32')]?_0x236691[_0x64d4('0x31')]:_0x18e1b1[_0x64d4('0x2d')];if(!_0x3865ef[_0x64d4('0x2e')]['hasOwnProperty'](_0x64d4('0x33'))){_0x236691[_0x64d4('0x20')]=qs[_0x64d4('0x20')](_0x3865ef['query']['limit']);_0x236691[_0x64d4('0x1d')]=qs[_0x64d4('0x1d')](_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x1d')]);}_0x236691[_0x64d4('0x34')]=qs[_0x64d4('0x35')](_0x3865ef['query']['sort']);_0x236691[_0x64d4('0x36')]=qs[_0x64d4('0x37')](_['pick'](_0x3865ef['query'],_0x18e1b1[_0x64d4('0x37')]),_0x1c3347);if(_0x3865ef['query']['filter']){_0x236691['where']=_['merge'](_0x236691[_0x64d4('0x36')],{'$or':_[_0x64d4('0x2a')](_0x1c3347,function(_0xa9f459){if(_0xa9f459[_0x64d4('0x38')]!==_0x64d4('0x39')){var _0x130dba={};_0x130dba[_0xa9f459['name']]={'$like':'%'+_0x3865ef[_0x64d4('0x2e')][_0x64d4('0x3a')]+'%'};return _0x130dba;}})});}_0x236691=_[_0x64d4('0x3b')]({},_0x236691,_0x3865ef[_0x64d4('0x3c')]);var _0x2fd846={'where':_0x236691[_0x64d4('0x36')]};return db[_0x64d4('0x3d')][_0x64d4('0x1f')](_0x2fd846)['then'](function(_0x107871){_0x77912e['count']=_0x107871;if(_0x3865ef[_0x64d4('0x2e')]['includeAll']){_0x236691[_0x64d4('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0x236691);})[_0x64d4('0x25')](function(_0x463bf0){_0x77912e[_0x64d4('0x3f')]=_0x463bf0;return _0x77912e;})[_0x64d4('0x25')](respondWithFilteredResult(_0x2a38b4,_0x236691))[_0x64d4('0x40')](handleError(_0x2a38b4,null));};exports[_0x64d4('0x41')]=function(_0x11577b,_0xd99afd){var _0x2ccb14={'raw':!![],'where':{'id':_0x11577b[_0x64d4('0x42')]['id']}},_0x5f0213={};_0x5f0213[_0x64d4('0x2d')]=_[_0x64d4('0x43')](db[_0x64d4('0x3d')]['rawAttributes']);_0x5f0213[_0x64d4('0x2e')]=_[_0x64d4('0x43')](_0x11577b['query']);_0x5f0213['filters']=_[_0x64d4('0x2f')](_0x5f0213['model'],_0x5f0213[_0x64d4('0x2e')]);_0x2ccb14['attributes']=_[_0x64d4('0x2f')](_0x5f0213[_0x64d4('0x2d')],qs[_0x64d4('0x30')](_0x11577b['query'][_0x64d4('0x30')]));_0x2ccb14[_0x64d4('0x31')]=_0x2ccb14[_0x64d4('0x31')][_0x64d4('0x32')]?_0x2ccb14[_0x64d4('0x31')]:_0x5f0213[_0x64d4('0x2d')];if(_0x11577b['query'][_0x64d4('0x44')]){_0x2ccb14[_0x64d4('0x3e')]=[{'all':!![]}];}_0x2ccb14=_[_0x64d4('0x3b')]({},_0x2ccb14,_0x11577b[_0x64d4('0x3c')]);return db['FaxQueueReport'][_0x64d4('0x45')](_0x2ccb14)[_0x64d4('0x25')](handleEntityNotFound(_0xd99afd,null))[_0x64d4('0x25')](respondWithResult(_0xd99afd,null))[_0x64d4('0x40')](handleError(_0xd99afd,null));};exports['create']=function(_0x49930e,_0x38d59f){return db[_0x64d4('0x3d')]['create'](_0x49930e[_0x64d4('0x46')],{})[_0x64d4('0x25')](respondWithResult(_0x38d59f,0xc9))[_0x64d4('0x40')](handleError(_0x38d59f,null));};exports[_0x64d4('0x24')]=function(_0x4b3c17,_0x46bd77){if(_0x4b3c17[_0x64d4('0x46')]['id']){delete _0x4b3c17[_0x64d4('0x46')]['id'];}return db[_0x64d4('0x3d')][_0x64d4('0x45')]({'where':{'id':_0x4b3c17['params']['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x46bd77,null))[_0x64d4('0x25')](saveUpdates(_0x4b3c17['body'],null))[_0x64d4('0x25')](respondWithResult(_0x46bd77,null))[_0x64d4('0x40')](handleError(_0x46bd77,null));};exports[_0x64d4('0x26')]=function(_0x5829e6,_0x11ed80){return db['FaxQueueReport'][_0x64d4('0x45')]({'where':{'id':_0x5829e6[_0x64d4('0x42')]['id']}})[_0x64d4('0x25')](handleEntityNotFound(_0x11ed80,null))[_0x64d4('0x25')](removeEntity(_0x11ed80,null))[_0x64d4('0x40')](handleError(_0x11ed80,null));};exports[_0x64d4('0x47')]=function(_0x3f228a,_0x5a7677){return db['FaxQueueReport']['describe']()[_0x64d4('0x25')](respondWithResult(_0x5a7677,null))[_0x64d4('0x40')](handleError(_0x5a7677,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 261af31..6b253b4 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x444519,_0x3f1f10){var _0x66ac02=function(_0x47913b){while(--_0x47913b){_0x444519['push'](_0x444519['shift']());}};_0x66ac02(++_0x3f1f10);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5cceb8,_0xa8e57a){_0x5cceb8=_0x5cceb8-0x0;var _0xeaf4be=_0x7fbe[_0x5cceb8];return _0xeaf4be;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x4cb47d,_0x5ae48d){var _0x5c3f39=function(_0x695665){while(--_0x695665){_0x4cb47d['push'](_0x4cb47d['shift']());}};_0x5c3f39(++_0x5ae48d);}(_0xf494,0x1c6));var _0x4f49=function(_0x526302,_0x450200){_0x526302=_0x526302-0x0;var _0xd505be=_0xf494[_0x526302];return _0xd505be;};'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')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 1e8aa1a..0b1230f 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 _0x8409=['util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateFaxQueueReport','create','options','raw','then','UpdateFaxQueueReport','FaxQueueReport','where','attributes','limit','lodash'];(function(_0x431807,_0x187385){var _0x51d062=function(_0x2bd6a6){while(--_0x2bd6a6){_0x431807['push'](_0x431807['shift']());}};_0x51d062(++_0x187385);}(_0x8409,0x104));var _0x9840=function(_0x171fb6,_0x1116d6){_0x171fb6=_0x171fb6-0x0;var _0x2dda01=_0x8409[_0x171fb6];return _0x2dda01;};'use strict';var _=require(_0x9840('0x0'));var util=require(_0x9840('0x1'));var moment=require(_0x9840('0x2'));var BPromise=require(_0x9840('0x3'));var rs=require(_0x9840('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9840('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9840('0x6'));var config=require('../../config/environment');var jayson=require(_0x9840('0x7'));var client=jayson[_0x9840('0x8')][_0x9840('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55ea66,_0x42287e,_0x52995c){return new BPromise(function(_0x4400f4,_0x25de71){return client['request'](_0x55ea66,_0x52995c)['then'](function(_0x38b68d){logger[_0x9840('0xa')](_0x9840('0xb'),_0x42287e,_0x9840('0xc'));logger[_0x9840('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x42287e,_0x9840('0xc'),JSON[_0x9840('0xe')](_0x38b68d));if(_0x38b68d[_0x9840('0xf')]){if(_0x38b68d['error']['code']===0x1f4){logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x38b68d[_0x9840('0xf')][_0x9840('0x10')]);return _0x25de71(_0x38b68d[_0x9840('0xf')]['message']);}logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x38b68d['error'][_0x9840('0x10')]);return _0x4400f4(_0x38b68d[_0x9840('0xf')][_0x9840('0x10')]);}else{logger[_0x9840('0xa')]('FaxQueueReport,\x20%s,\x20%s',_0x42287e,_0x9840('0xc'));_0x4400f4(_0x38b68d[_0x9840('0x11')][_0x9840('0x10')]);}})[_0x9840('0x12')](function(_0x7337b5){logger[_0x9840('0xf')](_0x9840('0xb'),_0x42287e,_0x7337b5);_0x25de71(_0x7337b5);});});}exports[_0x9840('0x13')]=function(_0x5b852a){var _0x4a48ce=this;return new Promise(function(_0x35c91a,_0x4f0302){return db['FaxQueueReport'][_0x9840('0x14')](_0x5b852a['body'],{'raw':_0x5b852a[_0x9840('0x15')]?_0x5b852a[_0x9840('0x15')][_0x9840('0x16')]===undefined?!![]:![]:!![]})[_0x9840('0x17')](function(_0x1ac37c){logger[_0x9840('0xa')](_0x9840('0x13'),_0x5b852a);logger[_0x9840('0xd')](_0x9840('0x13'),_0x5b852a,JSON[_0x9840('0xe')](_0x1ac37c));_0x35c91a(_0x1ac37c);})[_0x9840('0x12')](function(_0x41d609){logger['error'](_0x9840('0x13'),_0x41d609[_0x9840('0x10')],_0x5b852a);_0x4f0302(_0x4a48ce['error'](0x1f4,_0x41d609[_0x9840('0x10')]));});});};exports[_0x9840('0x18')]=function(_0x314657){var _0x4996b7=this;return new Promise(function(_0x57937c,_0x10d47a){return db[_0x9840('0x19')]['update'](_0x314657['body'],{'raw':_0x314657['options']?_0x314657[_0x9840('0x15')][_0x9840('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314657[_0x9840('0x15')]?_0x314657[_0x9840('0x15')][_0x9840('0x1a')]||null:null,'attributes':_0x314657[_0x9840('0x15')]?_0x314657['options'][_0x9840('0x1b')]||null:null,'limit':_0x314657['options']?_0x314657['options'][_0x9840('0x1c')]||null:null})['then'](function(_0x24c21a){logger[_0x9840('0xa')]('UpdateFaxQueueReport',_0x314657);logger[_0x9840('0xd')](_0x9840('0x18'),_0x314657,JSON[_0x9840('0xe')](_0x24c21a));_0x57937c(_0x24c21a);})[_0x9840('0x12')](function(_0x5c3420){logger[_0x9840('0xf')](_0x9840('0x18'),_0x5c3420['message'],_0x314657);_0x10d47a(_0x4996b7[_0x9840('0xf')](0x1f4,_0x5c3420[_0x9840('0x10')]));});});}; \ No newline at end of file +var _0xac26=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','UpdateFaxQueueReport'];(function(_0x19a5d8,_0x347207){var _0x30104a=function(_0x292695){while(--_0x292695){_0x19a5d8['push'](_0x19a5d8['shift']());}};_0x30104a(++_0x347207);}(_0xac26,0xa1));var _0x6ac2=function(_0x1e22f7,_0x7fd032){_0x1e22f7=_0x1e22f7-0x0;var _0x18bb55=_0xac26[_0x1e22f7];return _0x18bb55;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var moment=require(_0x6ac2('0x2'));var BPromise=require(_0x6ac2('0x3'));var rs=require(_0x6ac2('0x4'));var fs=require('fs');var Redis=require(_0x6ac2('0x5'));var db=require(_0x6ac2('0x6'))['db'];var utils=require(_0x6ac2('0x7'));var logger=require(_0x6ac2('0x8'))(_0x6ac2('0x9'));var config=require(_0x6ac2('0xa'));var jayson=require(_0x6ac2('0xb'));var client=jayson[_0x6ac2('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27b7e6,_0x38de2b,_0x3286df){return new BPromise(function(_0x5a5eae,_0x1b1ad4){return client[_0x6ac2('0xd')](_0x27b7e6,_0x3286df)['then'](function(_0x2e7183){logger[_0x6ac2('0xe')](_0x6ac2('0xf'),_0x38de2b,'request\x20sent');logger[_0x6ac2('0x10')](_0x6ac2('0x11'),_0x38de2b,'request\x20sent',JSON[_0x6ac2('0x12')](_0x2e7183));if(_0x2e7183[_0x6ac2('0x13')]){if(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x14')]===0x1f4){logger[_0x6ac2('0x13')](_0x6ac2('0xf'),_0x38de2b,_0x2e7183['error'][_0x6ac2('0x15')]);return _0x1b1ad4(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x15')]);}logger['error'](_0x6ac2('0xf'),_0x38de2b,_0x2e7183['error'][_0x6ac2('0x15')]);return _0x5a5eae(_0x2e7183[_0x6ac2('0x13')][_0x6ac2('0x15')]);}else{logger[_0x6ac2('0xe')](_0x6ac2('0xf'),_0x38de2b,_0x6ac2('0x16'));_0x5a5eae(_0x2e7183['result'][_0x6ac2('0x15')]);}})[_0x6ac2('0x17')](function(_0x1936cf){logger[_0x6ac2('0x13')](_0x6ac2('0xf'),_0x38de2b,_0x1936cf);_0x1b1ad4(_0x1936cf);});});}exports[_0x6ac2('0x18')]=function(_0x5b159e){var _0x2c1292=this;return new Promise(function(_0x101a2e,_0x98fca7){return db[_0x6ac2('0x19')][_0x6ac2('0x1a')](_0x5b159e['body'],{'raw':_0x5b159e[_0x6ac2('0x1b')]?_0x5b159e[_0x6ac2('0x1b')][_0x6ac2('0x1c')]===undefined?!![]:![]:!![]})[_0x6ac2('0x1d')](function(_0x235786){logger[_0x6ac2('0xe')](_0x6ac2('0x18'),_0x5b159e);logger[_0x6ac2('0x10')](_0x6ac2('0x18'),_0x5b159e,JSON[_0x6ac2('0x12')](_0x235786));_0x101a2e(_0x235786);})[_0x6ac2('0x17')](function(_0x9ec9b8){logger[_0x6ac2('0x13')](_0x6ac2('0x18'),_0x9ec9b8[_0x6ac2('0x15')],_0x5b159e);_0x98fca7(_0x2c1292['error'](0x1f4,_0x9ec9b8[_0x6ac2('0x15')]));});});};exports[_0x6ac2('0x1e')]=function(_0x3d352b){var _0x12c395=this;return new Promise(function(_0x22afbc,_0x5972d9){return db['FaxQueueReport']['update'](_0x3d352b['body'],{'raw':_0x3d352b['options']?_0x3d352b[_0x6ac2('0x1b')][_0x6ac2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d352b[_0x6ac2('0x1b')]?_0x3d352b[_0x6ac2('0x1b')]['where']||null:null,'attributes':_0x3d352b['options']?_0x3d352b[_0x6ac2('0x1b')]['attributes']||null:null,'limit':_0x3d352b[_0x6ac2('0x1b')]?_0x3d352b[_0x6ac2('0x1b')][_0x6ac2('0x1f')]||null:null})[_0x6ac2('0x1d')](function(_0x17cf5e){logger[_0x6ac2('0xe')](_0x6ac2('0x1e'),_0x3d352b);logger[_0x6ac2('0x10')](_0x6ac2('0x1e'),_0x3d352b,JSON[_0x6ac2('0x12')](_0x17cf5e));_0x22afbc(_0x17cf5e);})['catch'](function(_0x5952af){logger['error'](_0x6ac2('0x1e'),_0x5952af['message'],_0x3d352b);_0x5972d9(_0x12c395['error'](0x1f4,_0x5952af[_0x6ac2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c18307b..f3b7a87 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 _0xc4de=['post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x2cea86,_0xf336){var _0xe4dc97=function(_0x594d1d){while(--_0x594d1d){_0x2cea86['push'](_0x2cea86['shift']());}};_0xe4dc97(++_0xf336);}(_0xc4de,0x73));var _0xec4d=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc4de[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0xec4d('0x0'));var util=require(_0xec4d('0x1'));var path=require(_0xec4d('0x2'));var timeout=require(_0xec4d('0x3'));var express=require(_0xec4d('0x4'));var router=express[_0xec4d('0x5')]();var fs_extra=require(_0xec4d('0x6'));var auth=require(_0xec4d('0x7'));var interaction=require(_0xec4d('0x8'));var config=require('../../config/environment');var controller=require(_0xec4d('0x9'));router[_0xec4d('0xa')]('/',auth[_0xec4d('0xb')](),controller[_0xec4d('0xc')]);router[_0xec4d('0xa')](_0xec4d('0xd'),auth[_0xec4d('0xb')](),controller[_0xec4d('0xe')]);router[_0xec4d('0xa')](_0xec4d('0xf'),auth[_0xec4d('0xb')](),controller[_0xec4d('0x10')]);router[_0xec4d('0x11')]('/',auth['isAuthenticated'](),controller[_0xec4d('0x12')]);router['put']('/:id',auth[_0xec4d('0xb')](),controller[_0xec4d('0x13')]);router['delete'](_0xec4d('0xf'),auth[_0xec4d('0xb')](),controller[_0xec4d('0x14')]);module[_0xec4d('0x15')]=router; \ No newline at end of file +var _0x1da1=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','isAuthenticated','describe','show','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x30c712,_0x2f5e94){var _0x2c6e97=function(_0xfcb3ed){while(--_0xfcb3ed){_0x30c712['push'](_0x30c712['shift']());}};_0x2c6e97(++_0x2f5e94);}(_0x1da1,0xfa));var _0x11da=function(_0x4416dc,_0x5390b2){_0x4416dc=_0x4416dc-0x0;var _0x4bbdf1=_0x1da1[_0x4416dc];return _0x4bbdf1;};'use strict';var multer=require(_0x11da('0x0'));var util=require(_0x11da('0x1'));var path=require(_0x11da('0x2'));var timeout=require('connect-timeout');var express=require(_0x11da('0x3'));var router=express[_0x11da('0x4')]();var fs_extra=require(_0x11da('0x5'));var auth=require(_0x11da('0x6'));var interaction=require(_0x11da('0x7'));var config=require(_0x11da('0x8'));var controller=require(_0x11da('0x9'));router[_0x11da('0xa')]('/',auth['isAuthenticated'](),controller[_0x11da('0xb')]);router[_0x11da('0xa')]('/describe',auth[_0x11da('0xc')](),controller[_0x11da('0xd')]);router[_0x11da('0xa')]('/:id',auth[_0x11da('0xc')](),controller[_0x11da('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x11da('0xf')](_0x11da('0x10'),auth[_0x11da('0xc')](),controller[_0x11da('0x11')]);router[_0x11da('0x12')](_0x11da('0x10'),auth[_0x11da('0xc')](),controller[_0x11da('0x13')]);module[_0x11da('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d145c8f..25f6e1f 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x26930f,_0x2d582e){var _0x22ec6e=function(_0x128073){while(--_0x128073){_0x26930f['push'](_0x26930f['shift']());}};_0x22ec6e(++_0x2d582e);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x18400d,_0x2a89d0){var _0x5578c0=function(_0x42d280){while(--_0x42d280){_0x18400d['push'](_0x18400d['shift']());}};_0x5578c0(++_0x2a89d0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x364471,_0x302e8a){_0x364471=_0x364471-0x0;var _0x59236f=_0xf3cd[_0x364471];return _0x59236f;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5fe6df6..a403586 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 _0x0863=['end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x0863,0x15c));var _0x3086=function(_0x2fe5b9,_0x127e48){_0x2fe5b9=_0x2fe5b9-0x0;var _0x6f874=_0x0863[_0x2fe5b9];return _0x6f874;};'use strict';var emlformat=require(_0x3086('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3086('0x1'));var jsonpatch=require(_0x3086('0x2'));var rp=require('request-promise');var moment=require(_0x3086('0x3'));var BPromise=require(_0x3086('0x4'));var Mustache=require(_0x3086('0x5'));var util=require('util');var path=require(_0x3086('0x6'));var sox=require(_0x3086('0x7'));var csv=require(_0x3086('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3086('0x9'));var _=require(_0x3086('0xa'));var squel=require(_0x3086('0xb'));var crypto=require(_0x3086('0xc'));var jsforce=require(_0x3086('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3086('0x8'));var querystring=require(_0x3086('0xe'));var Papa=require(_0x3086('0xf'));var Redis=require(_0x3086('0x10'));var authService=require(_0x3086('0x11'));var qs=require(_0x3086('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3086('0x13'));var logger=require('../../config/logger')(_0x3086('0x14'));var utils=require(_0x3086('0x15'));var config=require(_0x3086('0x16'));var licenseUtil=require(_0x3086('0x17'));var db=require(_0x3086('0x18'))['db'];function respondWithStatusCode(_0x1a2938,_0x207977){_0x207977=_0x207977||0xcc;return function(_0x6dbfe){if(_0x6dbfe){return _0x1a2938[_0x3086('0x19')](_0x207977);}return _0x1a2938[_0x3086('0x1a')](_0x207977)[_0x3086('0x1b')]();};}function respondWithResult(_0xc7ed82,_0x13d140){_0x13d140=_0x13d140||0xc8;return function(_0x248bfa){if(_0x248bfa){return _0xc7ed82[_0x3086('0x1a')](_0x13d140)[_0x3086('0x1c')](_0x248bfa);}};}function respondWithFilteredResult(_0x4e72cc,_0x921db9){return function(_0x1b1601){if(_0x1b1601){var _0x8c1bae=typeof _0x921db9['offset']===_0x3086('0x1d')&&typeof _0x921db9['limit']==='undefined';var _0x53c69d=_0x1b1601[_0x3086('0x1e')];var _0x11dcf8=_0x8c1bae?0x0:_0x921db9[_0x3086('0x1f')];var _0x10425d=_0x8c1bae?_0x1b1601[_0x3086('0x1e')]:_0x921db9['offset']+_0x921db9[_0x3086('0x20')];var _0x219da8;if(_0x10425d>=_0x53c69d){_0x10425d=_0x53c69d;_0x219da8=0xc8;}else{_0x219da8=0xce;}_0x4e72cc[_0x3086('0x1a')](_0x219da8);return _0x4e72cc['set'](_0x3086('0x21'),_0x11dcf8+'-'+_0x10425d+'/'+_0x53c69d)['json'](_0x1b1601);}return null;};}function patchUpdates(_0x2f9705){return function(_0x5f4af0){try{jsonpatch[_0x3086('0x22')](_0x5f4af0,_0x2f9705,!![]);}catch(_0x42d797){return BPromise[_0x3086('0x23')](_0x42d797);}return _0x5f4af0[_0x3086('0x24')]();};}function saveUpdates(_0x2e141c,_0xdfc067){return function(_0x3d97be){if(_0x3d97be){return _0x3d97be[_0x3086('0x25')](_0x2e141c)[_0x3086('0x26')](function(_0x3c730f){return _0x3c730f;});}return null;};}function removeEntity(_0xdeef07,_0x108db0){return function(_0x5e3cb4){if(_0x5e3cb4){return _0x5e3cb4[_0x3086('0x27')]()[_0x3086('0x26')](function(){_0xdeef07['status'](0xcc)[_0x3086('0x1b')]();});}};}function handleEntityNotFound(_0x21c86a,_0x308242){return function(_0x1256d6){if(!_0x1256d6){_0x21c86a[_0x3086('0x19')](0x194);}return _0x1256d6;};}function handleError(_0x25d3ea,_0x5b0c6d){_0x5b0c6d=_0x5b0c6d||0x1f4;return function(_0x4fbca2){logger['error'](_0x4fbca2[_0x3086('0x28')]);if(_0x4fbca2[_0x3086('0x29')]){delete _0x4fbca2[_0x3086('0x29')];}_0x25d3ea[_0x3086('0x1a')](_0x5b0c6d)['send'](_0x4fbca2);};}exports[_0x3086('0x2a')]=function(_0x31c37b,_0xd7765d){var _0x5669a4={},_0x6d02ec={},_0x5b67a7={'count':0x0,'rows':[]};var _0x32fc50=_['map'](db[_0x3086('0x2b')][_0x3086('0x2c')],function(_0x47e130){return{'name':_0x47e130[_0x3086('0x2d')],'type':_0x47e130[_0x3086('0x2e')][_0x3086('0x2f')]};});_0x6d02ec[_0x3086('0x30')]=_[_0x3086('0x31')](_0x32fc50,_0x3086('0x29'));_0x6d02ec[_0x3086('0x32')]=_[_0x3086('0x33')](_0x31c37b[_0x3086('0x32')]);_0x6d02ec[_0x3086('0x34')]=_[_0x3086('0x35')](_0x6d02ec[_0x3086('0x30')],_0x6d02ec['query']);_0x5669a4[_0x3086('0x36')]=_[_0x3086('0x35')](_0x6d02ec[_0x3086('0x30')],qs[_0x3086('0x37')](_0x31c37b[_0x3086('0x32')][_0x3086('0x37')]));_0x5669a4['attributes']=_0x5669a4[_0x3086('0x36')][_0x3086('0x38')]?_0x5669a4[_0x3086('0x36')]:_0x6d02ec[_0x3086('0x30')];if(!_0x31c37b[_0x3086('0x32')]['hasOwnProperty']('nolimit')){_0x5669a4[_0x3086('0x20')]=qs[_0x3086('0x20')](_0x31c37b['query']['limit']);_0x5669a4['offset']=qs[_0x3086('0x1f')](_0x31c37b[_0x3086('0x32')][_0x3086('0x1f')]);}_0x5669a4[_0x3086('0x39')]=qs[_0x3086('0x3a')](_0x31c37b[_0x3086('0x32')][_0x3086('0x3a')]);_0x5669a4[_0x3086('0x3b')]=qs[_0x3086('0x34')](_[_0x3086('0x3c')](_0x31c37b[_0x3086('0x32')],_0x6d02ec[_0x3086('0x34')]),_0x32fc50);if(_0x31c37b['query']['filter']){_0x5669a4[_0x3086('0x3b')]=_[_0x3086('0x3d')](_0x5669a4[_0x3086('0x3b')],{'$or':_[_0x3086('0x31')](_0x32fc50,function(_0x7fafbd){if(_0x7fafbd[_0x3086('0x2e')]!==_0x3086('0x3e')){var _0x29a57d={};_0x29a57d[_0x7fafbd[_0x3086('0x29')]]={'$like':'%'+_0x31c37b[_0x3086('0x32')]['filter']+'%'};return _0x29a57d;}})});}_0x5669a4=_['merge']({},_0x5669a4,_0x31c37b[_0x3086('0x3f')]);var _0x4dfffe={'where':_0x5669a4[_0x3086('0x3b')]};return db['FaxTransferReport']['count'](_0x4dfffe)['then'](function(_0x3f9908){_0x5b67a7['count']=_0x3f9908;if(_0x31c37b[_0x3086('0x32')][_0x3086('0x40')]){_0x5669a4[_0x3086('0x41')]=[{'all':!![]}];}return db[_0x3086('0x2b')][_0x3086('0x42')](_0x5669a4);})[_0x3086('0x26')](function(_0x5ed83c){_0x5b67a7[_0x3086('0x43')]=_0x5ed83c;return _0x5b67a7;})[_0x3086('0x26')](respondWithFilteredResult(_0xd7765d,_0x5669a4))[_0x3086('0x44')](handleError(_0xd7765d,null));};exports[_0x3086('0x45')]=function(_0x3c8807,_0x5256b0){var _0x231881={'raw':!![],'where':{'id':_0x3c8807[_0x3086('0x46')]['id']}},_0x4affa9={};_0x4affa9[_0x3086('0x30')]=_[_0x3086('0x33')](db[_0x3086('0x2b')]['rawAttributes']);_0x4affa9['query']=_[_0x3086('0x33')](_0x3c8807['query']);_0x4affa9[_0x3086('0x34')]=_[_0x3086('0x35')](_0x4affa9[_0x3086('0x30')],_0x4affa9[_0x3086('0x32')]);_0x231881[_0x3086('0x36')]=_['intersection'](_0x4affa9[_0x3086('0x30')],qs['fields'](_0x3c8807[_0x3086('0x32')][_0x3086('0x37')]));_0x231881['attributes']=_0x231881[_0x3086('0x36')][_0x3086('0x38')]?_0x231881[_0x3086('0x36')]:_0x4affa9['model'];if(_0x3c8807[_0x3086('0x32')][_0x3086('0x40')]){_0x231881[_0x3086('0x41')]=[{'all':!![]}];}_0x231881=_['merge']({},_0x231881,_0x3c8807['options']);return db['FaxTransferReport']['find'](_0x231881)['then'](handleEntityNotFound(_0x5256b0,null))['then'](respondWithResult(_0x5256b0,null))['catch'](handleError(_0x5256b0,null));};exports[_0x3086('0x47')]=function(_0x18f3ae,_0x460534){return db['FaxTransferReport'][_0x3086('0x47')](_0x18f3ae[_0x3086('0x48')],{})[_0x3086('0x26')](respondWithResult(_0x460534,0xc9))[_0x3086('0x44')](handleError(_0x460534,null));};exports[_0x3086('0x25')]=function(_0x24bd29,_0x4fe84d){if(_0x24bd29[_0x3086('0x48')]['id']){delete _0x24bd29['body']['id'];}return db[_0x3086('0x2b')][_0x3086('0x49')]({'where':{'id':_0x24bd29[_0x3086('0x46')]['id']}})[_0x3086('0x26')](handleEntityNotFound(_0x4fe84d,null))[_0x3086('0x26')](saveUpdates(_0x24bd29[_0x3086('0x48')],null))[_0x3086('0x26')](respondWithResult(_0x4fe84d,null))[_0x3086('0x44')](handleError(_0x4fe84d,null));};exports[_0x3086('0x27')]=function(_0x15e83a,_0x4005f9){return db[_0x3086('0x2b')][_0x3086('0x49')]({'where':{'id':_0x15e83a[_0x3086('0x46')]['id']}})[_0x3086('0x26')](handleEntityNotFound(_0x4005f9,null))['then'](removeEntity(_0x4005f9,null))[_0x3086('0x44')](handleError(_0x4005f9,null));};exports[_0x3086('0x4a')]=function(_0x152f50,_0x26f9c6){return db[_0x3086('0x2b')][_0x3086('0x4a')]()['then'](respondWithResult(_0x26f9c6,null))['catch'](handleError(_0x26f9c6,null));}; \ No newline at end of file +var _0x13b9=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','keys','intersection','attributes','fields','nolimit','query','order','sort','where','pick','filters','filter','type','count','includeAll','findAll','rows','catch','show','params','length','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','ejs','fs-extra'];(function(_0xc9d383,_0x546e2d){var _0x326d3c=function(_0x159149){while(--_0x159149){_0xc9d383['push'](_0xc9d383['shift']());}};_0x326d3c(++_0x546e2d);}(_0x13b9,0xd5));var _0x913b=function(_0x2d2703,_0x5030c6){_0x2d2703=_0x2d2703-0x0;var _0x243a42=_0x13b9[_0x2d2703];return _0x243a42;};'use strict';var emlformat=require(_0x913b('0x0'));var rimraf=require(_0x913b('0x1'));var zipdir=require(_0x913b('0x2'));var jsonpatch=require(_0x913b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x913b('0x4'));var Mustache=require(_0x913b('0x5'));var util=require(_0x913b('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x913b('0x7'));var fs=require('fs');var fs_extra=require(_0x913b('0x8'));var _=require(_0x913b('0x9'));var squel=require(_0x913b('0xa'));var crypto=require('crypto');var jsforce=require(_0x913b('0xb'));var deskjs=require(_0x913b('0xc'));var toCsv=require(_0x913b('0xd'));var querystring=require(_0x913b('0xe'));var Papa=require(_0x913b('0xf'));var Redis=require(_0x913b('0x10'));var authService=require(_0x913b('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x913b('0x12'))('api');var utils=require(_0x913b('0x13'));var config=require(_0x913b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x913b('0x15'))['db'];function respondWithStatusCode(_0x1b1318,_0xe2baae){_0xe2baae=_0xe2baae||0xcc;return function(_0x4c2644){if(_0x4c2644){return _0x1b1318['sendStatus'](_0xe2baae);}return _0x1b1318[_0x913b('0x16')](_0xe2baae)[_0x913b('0x17')]();};}function respondWithResult(_0x2a0e59,_0xb9bd2c){_0xb9bd2c=_0xb9bd2c||0xc8;return function(_0x67fbbd){if(_0x67fbbd){return _0x2a0e59[_0x913b('0x16')](_0xb9bd2c)[_0x913b('0x18')](_0x67fbbd);}};}function respondWithFilteredResult(_0x54e9cd,_0x27f3e8){return function(_0x232629){if(_0x232629){var _0x51ff93=typeof _0x27f3e8['offset']===_0x913b('0x19')&&typeof _0x27f3e8['limit']===_0x913b('0x19');var _0x1aa0d1=_0x232629['count'];var _0x174fff=_0x51ff93?0x0:_0x27f3e8[_0x913b('0x1a')];var _0x4d91c8=_0x51ff93?_0x232629['count']:_0x27f3e8[_0x913b('0x1a')]+_0x27f3e8[_0x913b('0x1b')];var _0x81137b;if(_0x4d91c8>=_0x1aa0d1){_0x4d91c8=_0x1aa0d1;_0x81137b=0xc8;}else{_0x81137b=0xce;}_0x54e9cd[_0x913b('0x16')](_0x81137b);return _0x54e9cd[_0x913b('0x1c')](_0x913b('0x1d'),_0x174fff+'-'+_0x4d91c8+'/'+_0x1aa0d1)[_0x913b('0x18')](_0x232629);}return null;};}function patchUpdates(_0x37fa59){return function(_0x5a0afd){try{jsonpatch[_0x913b('0x1e')](_0x5a0afd,_0x37fa59,!![]);}catch(_0x29d846){return BPromise['reject'](_0x29d846);}return _0x5a0afd[_0x913b('0x1f')]();};}function saveUpdates(_0x19dc39,_0x25cdd0){return function(_0x26e1e3){if(_0x26e1e3){return _0x26e1e3[_0x913b('0x20')](_0x19dc39)[_0x913b('0x21')](function(_0x55e2cb){return _0x55e2cb;});}return null;};}function removeEntity(_0x2cca71,_0x1f9638){return function(_0x1c6f37){if(_0x1c6f37){return _0x1c6f37[_0x913b('0x22')]()[_0x913b('0x21')](function(){_0x2cca71[_0x913b('0x16')](0xcc)[_0x913b('0x17')]();});}};}function handleEntityNotFound(_0x57a732,_0x46e7f6){return function(_0x49fb36){if(!_0x49fb36){_0x57a732[_0x913b('0x23')](0x194);}return _0x49fb36;};}function handleError(_0x1dac95,_0x453114){_0x453114=_0x453114||0x1f4;return function(_0x5a9b78){logger[_0x913b('0x24')](_0x5a9b78[_0x913b('0x25')]);if(_0x5a9b78[_0x913b('0x26')]){delete _0x5a9b78['name'];}_0x1dac95[_0x913b('0x16')](_0x453114)[_0x913b('0x27')](_0x5a9b78);};}exports[_0x913b('0x28')]=function(_0x59fccb,_0x539e7f){var _0xa71885={},_0x15c90d={},_0x4adedf={'count':0x0,'rows':[]};var _0x27f314=_[_0x913b('0x29')](db[_0x913b('0x2a')][_0x913b('0x2b')],function(_0x28daa2){return{'name':_0x28daa2[_0x913b('0x2c')],'type':_0x28daa2['type'][_0x913b('0x2d')]};});_0x15c90d[_0x913b('0x2e')]=_[_0x913b('0x29')](_0x27f314,_0x913b('0x26'));_0x15c90d['query']=_[_0x913b('0x2f')](_0x59fccb['query']);_0x15c90d['filters']=_[_0x913b('0x30')](_0x15c90d['model'],_0x15c90d['query']);_0xa71885[_0x913b('0x31')]=_[_0x913b('0x30')](_0x15c90d[_0x913b('0x2e')],qs[_0x913b('0x32')](_0x59fccb['query'][_0x913b('0x32')]));_0xa71885[_0x913b('0x31')]=_0xa71885[_0x913b('0x31')]['length']?_0xa71885[_0x913b('0x31')]:_0x15c90d[_0x913b('0x2e')];if(!_0x59fccb['query']['hasOwnProperty'](_0x913b('0x33'))){_0xa71885[_0x913b('0x1b')]=qs[_0x913b('0x1b')](_0x59fccb[_0x913b('0x34')]['limit']);_0xa71885[_0x913b('0x1a')]=qs[_0x913b('0x1a')](_0x59fccb[_0x913b('0x34')][_0x913b('0x1a')]);}_0xa71885[_0x913b('0x35')]=qs[_0x913b('0x36')](_0x59fccb[_0x913b('0x34')][_0x913b('0x36')]);_0xa71885[_0x913b('0x37')]=qs['filters'](_[_0x913b('0x38')](_0x59fccb['query'],_0x15c90d[_0x913b('0x39')]),_0x27f314);if(_0x59fccb[_0x913b('0x34')][_0x913b('0x3a')]){_0xa71885[_0x913b('0x37')]=_['merge'](_0xa71885['where'],{'$or':_[_0x913b('0x29')](_0x27f314,function(_0xb87ce9){if(_0xb87ce9[_0x913b('0x3b')]!=='VIRTUAL'){var _0x325f00={};_0x325f00[_0xb87ce9[_0x913b('0x26')]]={'$like':'%'+_0x59fccb[_0x913b('0x34')][_0x913b('0x3a')]+'%'};return _0x325f00;}})});}_0xa71885=_['merge']({},_0xa71885,_0x59fccb['options']);var _0x213800={'where':_0xa71885[_0x913b('0x37')]};return db[_0x913b('0x2a')][_0x913b('0x3c')](_0x213800)[_0x913b('0x21')](function(_0x5953de){_0x4adedf[_0x913b('0x3c')]=_0x5953de;if(_0x59fccb['query'][_0x913b('0x3d')]){_0xa71885['include']=[{'all':!![]}];}return db[_0x913b('0x2a')][_0x913b('0x3e')](_0xa71885);})[_0x913b('0x21')](function(_0x528e22){_0x4adedf[_0x913b('0x3f')]=_0x528e22;return _0x4adedf;})[_0x913b('0x21')](respondWithFilteredResult(_0x539e7f,_0xa71885))[_0x913b('0x40')](handleError(_0x539e7f,null));};exports[_0x913b('0x41')]=function(_0x4035e0,_0x494b0e){var _0xf2c423={'raw':!![],'where':{'id':_0x4035e0[_0x913b('0x42')]['id']}},_0x14e9fe={};_0x14e9fe[_0x913b('0x2e')]=_[_0x913b('0x2f')](db[_0x913b('0x2a')][_0x913b('0x2b')]);_0x14e9fe[_0x913b('0x34')]=_[_0x913b('0x2f')](_0x4035e0[_0x913b('0x34')]);_0x14e9fe[_0x913b('0x39')]=_['intersection'](_0x14e9fe[_0x913b('0x2e')],_0x14e9fe['query']);_0xf2c423[_0x913b('0x31')]=_[_0x913b('0x30')](_0x14e9fe[_0x913b('0x2e')],qs[_0x913b('0x32')](_0x4035e0[_0x913b('0x34')][_0x913b('0x32')]));_0xf2c423['attributes']=_0xf2c423['attributes'][_0x913b('0x43')]?_0xf2c423['attributes']:_0x14e9fe['model'];if(_0x4035e0[_0x913b('0x34')][_0x913b('0x3d')]){_0xf2c423['include']=[{'all':!![]}];}_0xf2c423=_[_0x913b('0x44')]({},_0xf2c423,_0x4035e0[_0x913b('0x45')]);return db[_0x913b('0x2a')][_0x913b('0x46')](_0xf2c423)[_0x913b('0x21')](handleEntityNotFound(_0x494b0e,null))[_0x913b('0x21')](respondWithResult(_0x494b0e,null))[_0x913b('0x40')](handleError(_0x494b0e,null));};exports[_0x913b('0x47')]=function(_0xa04523,_0x56743f){return db[_0x913b('0x2a')][_0x913b('0x47')](_0xa04523['body'],{})[_0x913b('0x21')](respondWithResult(_0x56743f,0xc9))['catch'](handleError(_0x56743f,null));};exports['update']=function(_0x1cb291,_0x4100dd){if(_0x1cb291[_0x913b('0x48')]['id']){delete _0x1cb291[_0x913b('0x48')]['id'];}return db[_0x913b('0x2a')][_0x913b('0x46')]({'where':{'id':_0x1cb291[_0x913b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4100dd,null))[_0x913b('0x21')](saveUpdates(_0x1cb291['body'],null))[_0x913b('0x21')](respondWithResult(_0x4100dd,null))['catch'](handleError(_0x4100dd,null));};exports[_0x913b('0x22')]=function(_0x550052,_0x232805){return db[_0x913b('0x2a')][_0x913b('0x46')]({'where':{'id':_0x550052['params']['id']}})[_0x913b('0x21')](handleEntityNotFound(_0x232805,null))[_0x913b('0x21')](removeEntity(_0x232805,null))['catch'](handleError(_0x232805,null));};exports[_0x913b('0x49')]=function(_0x42135e,_0x257008){return db[_0x913b('0x2a')][_0x913b('0x49')]()[_0x913b('0x21')](respondWithResult(_0x257008,null))[_0x913b('0x40')](handleError(_0x257008,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a956276..808780c 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 _0x700c=['report_fax_transfer','uniqueid','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x110924,_0x1374bb){var _0x12905b=function(_0x47d32c){while(--_0x47d32c){_0x110924['push'](_0x110924['shift']());}};_0x12905b(++_0x1374bb);}(_0x700c,0x1b2));var _0xc700=function(_0x23f313,_0x1e7157){_0x23f313=_0x23f313-0x0;var _0x4f9063=_0x700c[_0x23f313];return _0x4f9063;};'use strict';var _=require(_0xc700('0x0'));var util=require(_0xc700('0x1'));var logger=require('../../config/logger')(_0xc700('0x2'));var moment=require(_0xc700('0x3'));var BPromise=require(_0xc700('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc700('0x5'));var rimraf=require(_0xc700('0x6'));var config=require(_0xc700('0x7'));var attributes=require(_0xc700('0x8'));module[_0xc700('0x9')]=function(_0x449db1,_0x5c5b18){return _0x449db1['define']('FaxTransferReport',attributes,{'tableName':_0xc700('0xa'),'paranoid':![],'indexes':[{'name':_0xc700('0xb'),'fields':[_0xc700('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x17ae=['exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes'];(function(_0x5d93a2,_0x8fae18){var _0x4b17a9=function(_0x59f0e3){while(--_0x59f0e3){_0x5d93a2['push'](_0x5d93a2['shift']());}};_0x4b17a9(++_0x8fae18);}(_0x17ae,0x1c5));var _0xe17a=function(_0x2d28ad,_0x533999){_0x2d28ad=_0x2d28ad-0x0;var _0x3941ea=_0x17ae[_0x2d28ad];return _0x3941ea;};'use strict';var _=require(_0xe17a('0x0'));var util=require('util');var logger=require(_0xe17a('0x1'))(_0xe17a('0x2'));var moment=require(_0xe17a('0x3'));var BPromise=require(_0xe17a('0x4'));var rp=require(_0xe17a('0x5'));var fs=require('fs');var path=require(_0xe17a('0x6'));var rimraf=require('rimraf');var config=require(_0xe17a('0x7'));var attributes=require(_0xe17a('0x8'));module[_0xe17a('0x9')]=function(_0x16cdee,_0x20d4e6){return _0x16cdee[_0xe17a('0xa')](_0xe17a('0xb'),attributes,{'tableName':_0xe17a('0xc'),'paranoid':![],'indexes':[{'name':_0xe17a('0xd'),'fields':[_0xe17a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index aac808b..cc977f7 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 _0x4c32=['FaxTransferReport,\x20%s,\x20%s','message','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1cbb10,_0x3e6dfa){var _0x4b4d86=function(_0x393c1c){while(--_0x393c1c){_0x1cbb10['push'](_0x1cbb10['shift']());}};_0x4b4d86(++_0x3e6dfa);}(_0x4c32,0x1a2));var _0x24c3=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0x4c32[_0xcd0918];return _0x250704;};'use strict';var _=require('lodash');var util=require(_0x24c3('0x0'));var moment=require('moment');var BPromise=require(_0x24c3('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24c3('0x2'));var db=require(_0x24c3('0x3'))['db'];var utils=require(_0x24c3('0x4'));var logger=require(_0x24c3('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x24c3('0x6'));var client=jayson[_0x24c3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50721a,_0x31b6f9,_0x47f843){return new BPromise(function(_0x3df78b,_0x25dce1){return client['request'](_0x50721a,_0x47f843)[_0x24c3('0x8')](function(_0x3cf093){logger[_0x24c3('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x24c3('0xa'));logger['debug'](_0x24c3('0xb'),_0x31b6f9,_0x24c3('0xa'),JSON['stringify'](_0x3cf093));if(_0x3cf093[_0x24c3('0xc')]){if(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xd')]===0x1f4){logger['error'](_0x24c3('0xe'),_0x31b6f9,_0x3cf093['error'][_0x24c3('0xf')]);return _0x25dce1(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xf')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x3cf093['error'][_0x24c3('0xf')]);return _0x3df78b(_0x3cf093[_0x24c3('0xc')][_0x24c3('0xf')]);}else{logger[_0x24c3('0x9')](_0x24c3('0xe'),_0x31b6f9,_0x24c3('0xa'));_0x3df78b(_0x3cf093['result'][_0x24c3('0xf')]);}})['catch'](function(_0x26eb52){logger[_0x24c3('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x31b6f9,_0x26eb52);_0x25dce1(_0x26eb52);});});} \ No newline at end of file +var _0x44c0=['FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3169fa,_0xd37366){var _0x2dc365=function(_0x33a800){while(--_0x33a800){_0x3169fa['push'](_0x3169fa['shift']());}};_0x2dc365(++_0xd37366);}(_0x44c0,0x6d));var _0x044c=function(_0x2f724b,_0x12e88f){_0x2f724b=_0x2f724b-0x0;var _0x177f02=_0x44c0[_0x2f724b];return _0x177f02;};'use strict';var _=require(_0x044c('0x0'));var util=require(_0x044c('0x1'));var moment=require(_0x044c('0x2'));var BPromise=require(_0x044c('0x3'));var rs=require(_0x044c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x044c('0x5'))['db'];var utils=require(_0x044c('0x6'));var logger=require(_0x044c('0x7'))(_0x044c('0x8'));var config=require(_0x044c('0x9'));var jayson=require(_0x044c('0xa'));var client=jayson[_0x044c('0xb')][_0x044c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x51af89,_0xd5d2d1,_0x12f859){return new BPromise(function(_0x309f50,_0x1080f6){return client[_0x044c('0xd')](_0x51af89,_0x12f859)[_0x044c('0xe')](function(_0x206d95){logger[_0x044c('0xf')](_0x044c('0x10'),_0xd5d2d1,'request\x20sent');logger[_0x044c('0x11')](_0x044c('0x12'),_0xd5d2d1,_0x044c('0x13'),JSON[_0x044c('0x14')](_0x206d95));if(_0x206d95['error']){if(_0x206d95['error'][_0x044c('0x15')]===0x1f4){logger[_0x044c('0x16')](_0x044c('0x10'),_0xd5d2d1,_0x206d95[_0x044c('0x16')][_0x044c('0x17')]);return _0x1080f6(_0x206d95[_0x044c('0x16')][_0x044c('0x17')]);}logger[_0x044c('0x16')]('FaxTransferReport,\x20%s,\x20%s',_0xd5d2d1,_0x206d95['error']['message']);return _0x309f50(_0x206d95[_0x044c('0x16')][_0x044c('0x17')]);}else{logger[_0x044c('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0xd5d2d1,_0x044c('0x13'));_0x309f50(_0x206d95[_0x044c('0x18')][_0x044c('0x17')]);}})['catch'](function(_0x4355c7){logger[_0x044c('0x16')](_0x044c('0x10'),_0xd5d2d1,_0x4355c7);_0x1080f6(_0x4355c7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a2b72af..258c3c7 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 _0xa80e=['get','isAuthenticated','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller'];(function(_0x912fb7,_0x5b401f){var _0x5f55c8=function(_0x4d487b){while(--_0x4d487b){_0x912fb7['push'](_0x912fb7['shift']());}};_0x5f55c8(++_0x5b401f);}(_0xa80e,0x1aa));var _0xea80=function(_0x1a340f,_0x4b9893){_0x1a340f=_0x1a340f-0x0;var _0xbcb1c0=_0xa80e[_0x1a340f];return _0xbcb1c0;};'use strict';var multer=require(_0xea80('0x0'));var util=require(_0xea80('0x1'));var path=require(_0xea80('0x2'));var timeout=require(_0xea80('0x3'));var express=require(_0xea80('0x4'));var router=express[_0xea80('0x5')]();var fs_extra=require(_0xea80('0x6'));var auth=require(_0xea80('0x7'));var interaction=require(_0xea80('0x8'));var config=require(_0xea80('0x9'));var controller=require(_0xea80('0xa'));router[_0xea80('0xb')]('/',auth[_0xea80('0xc')](),controller['index']);router['get']('/describe',auth[_0xea80('0xc')](),controller['describe']);router[_0xea80('0xb')](_0xea80('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xea80('0xc')](),controller[_0xea80('0xe')]);router[_0xea80('0xf')]('/:id',auth[_0xea80('0xc')](),controller[_0xea80('0x10')]);router[_0xea80('0x11')]('/:id',auth[_0xea80('0xc')](),controller['destroy']);module[_0xea80('0x12')]=router; \ No newline at end of file +var _0x6bba=['get','/:id','show','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','index','isAuthenticated','describe'];(function(_0xf3efc0,_0x71fe4b){var _0xd2f80b=function(_0x4edcfe){while(--_0x4edcfe){_0xf3efc0['push'](_0xf3efc0['shift']());}};_0xd2f80b(++_0x71fe4b);}(_0x6bba,0x1cf));var _0xa6bb=function(_0x307904,_0x2b2649){_0x307904=_0x307904-0x0;var _0x4921de=_0x6bba[_0x307904];return _0x4921de;};'use strict';var multer=require(_0xa6bb('0x0'));var util=require(_0xa6bb('0x1'));var path=require(_0xa6bb('0x2'));var timeout=require(_0xa6bb('0x3'));var express=require('express');var router=express[_0xa6bb('0x4')]();var fs_extra=require(_0xa6bb('0x5'));var auth=require(_0xa6bb('0x6'));var interaction=require(_0xa6bb('0x7'));var config=require('../../config/environment');var controller=require(_0xa6bb('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa6bb('0x9')]);router['get']('/describe',auth[_0xa6bb('0xa')](),controller[_0xa6bb('0xb')]);router[_0xa6bb('0xc')](_0xa6bb('0xd'),auth[_0xa6bb('0xa')](),controller[_0xa6bb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa6bb('0xf')]);router['put'](_0xa6bb('0xd'),auth[_0xa6bb('0xa')](),controller[_0xa6bb('0x10')]);router[_0xa6bb('0x11')](_0xa6bb('0xd'),auth['isAuthenticated'](),controller[_0xa6bb('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 052fdbf..2dfba75 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 _0xe7fe=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','multer'];(function(_0x69ea92,_0x14506b){var _0x45b8ea=function(_0x2a33c0){while(--_0x2a33c0){_0x69ea92['push'](_0x69ea92['shift']());}};_0x45b8ea(++_0x14506b);}(_0xe7fe,0x17f));var _0xee7f=function(_0x24f6fb,_0xc144a7){_0x24f6fb=_0x24f6fb-0x0;var _0x94b1e4=_0xe7fe[_0x24f6fb];return _0x94b1e4;};'use strict';var multer=require(_0xee7f('0x0'));var util=require(_0xee7f('0x1'));var path=require(_0xee7f('0x2'));var timeout=require(_0xee7f('0x3'));var express=require(_0xee7f('0x4'));var router=express[_0xee7f('0x5')]();var fs_extra=require(_0xee7f('0x6'));var auth=require(_0xee7f('0x7'));var interaction=require(_0xee7f('0x8'));var config=require('../../config/environment');var controller=require(_0xee7f('0x9'));router['get']('/',auth[_0xee7f('0xa')](),controller['index']);router['get'](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0xc')]);router[_0xee7f('0xd')](_0xee7f('0xe'),auth['isAuthenticated'](),controller[_0xee7f('0xf')]);router['get'](_0xee7f('0x10'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x11')]);router[_0xee7f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xee7f('0x12')](_0xee7f('0xe'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x13')]);router[_0xee7f('0x14')](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x15')]);router['delete'](_0xee7f('0xb'),auth[_0xee7f('0xa')](),controller[_0xee7f('0x16')]);module[_0xee7f('0x17')]=router; \ No newline at end of file +var _0xb03b=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb03b,0x16d));var _0xbb03=function(_0x46a1e6,_0x53cabc){_0x46a1e6=_0x46a1e6-0x0;var _0x4d17ed=_0xb03b[_0x46a1e6];return _0x4d17ed;};'use strict';var multer=require(_0xbb03('0x0'));var util=require(_0xbb03('0x1'));var path=require(_0xbb03('0x2'));var timeout=require(_0xbb03('0x3'));var express=require('express');var router=express[_0xbb03('0x4')]();var fs_extra=require(_0xbb03('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbb03('0x6'));var config=require(_0xbb03('0x7'));var controller=require(_0xbb03('0x8'));router[_0xbb03('0x9')]('/',auth[_0xbb03('0xa')](),controller['index']);router['get']('/:id',auth[_0xbb03('0xa')](),controller[_0xbb03('0xb')]);router[_0xbb03('0x9')](_0xbb03('0xc'),auth[_0xbb03('0xa')](),controller[_0xbb03('0xd')]);router[_0xbb03('0x9')](_0xbb03('0xe'),auth[_0xbb03('0xa')](),controller['getFields']);router[_0xbb03('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xbb03('0xc'),auth[_0xbb03('0xa')](),controller[_0xbb03('0x10')]);router[_0xbb03('0x11')]('/:id',auth[_0xbb03('0xa')](),controller[_0xbb03('0x12')]);router[_0xbb03('0x13')](_0xbb03('0x14'),auth[_0xbb03('0xa')](),controller[_0xbb03('0x15')]);module[_0xbb03('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index c1e7502..08cb140 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 _0x85a8=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x4509dd,_0x2ab3ec){var _0x37b0de=function(_0x17a76b){while(--_0x17a76b){_0x4509dd['push'](_0x4509dd['shift']());}};_0x37b0de(++_0x2ab3ec);}(_0x85a8,0x180));var _0x885a=function(_0x42887e,_0x501467){_0x42887e=_0x42887e-0x0;var _0x4c9bdb=_0x85a8[_0x42887e];return _0x4c9bdb;};'use strict';var Sequelize=require(_0x885a('0x0'));module[_0x885a('0x1')]={'name':{'type':Sequelize[_0x885a('0x2')]},'description':{'type':Sequelize[_0x885a('0x2')]},'username':{'type':Sequelize[_0x885a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x885a('0x3')]('basic'),'defaultValue':_0x885a('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x885a('0x2')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x885a('0x2')]},'serverUrl':{'type':Sequelize[_0x885a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x885a('0x3')](_0x885a('0x5'),_0x885a('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x636a=['basic','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x3463ab,_0x4d57da){var _0x946c4b=function(_0x2654ba){while(--_0x2654ba){_0x3463ab['push'](_0x3463ab['shift']());}};_0x946c4b(++_0x4d57da);}(_0x636a,0x93));var _0xa636=function(_0x29e314,_0x19d592){_0x29e314=_0x29e314-0x0;var _0x4c9fcb=_0x636a[_0x29e314];return _0x4c9fcb;};'use strict';var Sequelize=require(_0xa636('0x0'));module[_0xa636('0x1')]={'name':{'type':Sequelize[_0xa636('0x2')]},'description':{'type':Sequelize[_0xa636('0x2')]},'username':{'type':Sequelize[_0xa636('0x2')]},'remoteUri':{'type':Sequelize[_0xa636('0x2')]},'authType':{'type':Sequelize['ENUM'](_0xa636('0x3')),'defaultValue':_0xa636('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xa636('0x2')]},'consumerSecret':{'type':Sequelize[_0xa636('0x2')]},'token':{'type':Sequelize[_0xa636('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa636('0x4')](_0xa636('0x5'),'newTab'),'defaultValue':_0xa636('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 52dd94e..eba3803 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 _0x9a15=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','DeskAccount','find','create','body','getConfigurations','findOne','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0xcb62,_0x1da81b){var _0x3b56b4=function(_0x3ebbc7){while(--_0x3ebbc7){_0xcb62['push'](_0xcb62['shift']());}};_0x3b56b4(++_0x1da81b);}(_0x9a15,0x14c));var _0x59a1=function(_0x356518,_0x1c5e99){_0x356518=_0x356518-0x0;var _0xf45484=_0x9a15[_0x356518];return _0xf45484;};'use strict';var emlformat=require(_0x59a1('0x0'));var rimraf=require(_0x59a1('0x1'));var zipdir=require(_0x59a1('0x2'));var jsonpatch=require(_0x59a1('0x3'));var rp=require(_0x59a1('0x4'));var moment=require(_0x59a1('0x5'));var BPromise=require(_0x59a1('0x6'));var Mustache=require(_0x59a1('0x7'));var util=require(_0x59a1('0x8'));var path=require('path');var sox=require(_0x59a1('0x9'));var csv=require(_0x59a1('0xa'));var ejs=require(_0x59a1('0xb'));var fs=require('fs');var fs_extra=require(_0x59a1('0xc'));var _=require(_0x59a1('0xd'));var squel=require(_0x59a1('0xe'));var crypto=require(_0x59a1('0xf'));var jsforce=require(_0x59a1('0x10'));var deskjs=require(_0x59a1('0x11'));var toCsv=require(_0x59a1('0xa'));var querystring=require(_0x59a1('0x12'));var Papa=require(_0x59a1('0x13'));var Redis=require('ioredis');var authService=require(_0x59a1('0x14'));var qs=require(_0x59a1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x59a1('0x16'));var logger=require('../../config/logger')(_0x59a1('0x17'));var utils=require('../../config/utils');var config=require(_0x59a1('0x18'));var licenseUtil=require(_0x59a1('0x19'));var db=require(_0x59a1('0x1a'))['db'];var integrations=require(_0x59a1('0x1b'));function respondWithStatusCode(_0xf7c26c,_0x13b7a5){_0x13b7a5=_0x13b7a5||0xcc;return function(_0x1708e1){if(_0x1708e1){return _0xf7c26c['sendStatus'](_0x13b7a5);}return _0xf7c26c[_0x59a1('0x1c')](_0x13b7a5)['end']();};}function respondWithResult(_0x2e5323,_0x35eb27){_0x35eb27=_0x35eb27||0xc8;return function(_0x368898){if(_0x368898){return _0x2e5323[_0x59a1('0x1c')](_0x35eb27)[_0x59a1('0x1d')](_0x368898);}};}function respondWithFilteredResult(_0x10864c,_0x16a29a){return function(_0xd07ca4){if(_0xd07ca4){var _0x375954=typeof _0x16a29a['offset']===_0x59a1('0x1e')&&typeof _0x16a29a[_0x59a1('0x1f')]==='undefined';var _0x54452b=_0xd07ca4['count'];var _0x53e505=_0x375954?0x0:_0x16a29a[_0x59a1('0x20')];var _0x44de7e=_0x375954?_0xd07ca4['count']:_0x16a29a[_0x59a1('0x20')]+_0x16a29a[_0x59a1('0x1f')];var _0x4b81e9;if(_0x44de7e>=_0x54452b){_0x44de7e=_0x54452b;_0x4b81e9=0xc8;}else{_0x4b81e9=0xce;}_0x10864c[_0x59a1('0x1c')](_0x4b81e9);return _0x10864c[_0x59a1('0x21')](_0x59a1('0x22'),_0x53e505+'-'+_0x44de7e+'/'+_0x54452b)[_0x59a1('0x1d')](_0xd07ca4);}return null;};}function patchUpdates(_0x20a637){return function(_0x4e910c){try{jsonpatch[_0x59a1('0x23')](_0x4e910c,_0x20a637,!![]);}catch(_0xc87985){return BPromise['reject'](_0xc87985);}return _0x4e910c[_0x59a1('0x24')]();};}function saveUpdates(_0x2213a7,_0x38c899){return function(_0x59584a){if(_0x59584a){return _0x59584a[_0x59a1('0x25')](_0x2213a7)[_0x59a1('0x26')](function(_0xe4be34){return _0xe4be34;});}return null;};}function removeEntity(_0xf25e5f,_0x3338b3){return function(_0x427d22){if(_0x427d22){return _0x427d22[_0x59a1('0x27')]()[_0x59a1('0x26')](function(){_0xf25e5f[_0x59a1('0x1c')](0xcc)[_0x59a1('0x28')]();});}};}function handleEntityNotFound(_0x4003ba,_0x4302b9){return function(_0x33a920){if(!_0x33a920){_0x4003ba['sendStatus'](0x194);}return _0x33a920;};}function handleError(_0x2ddc83,_0x49c331){_0x49c331=_0x49c331||0x1f4;return function(_0x12c719){logger[_0x59a1('0x29')](_0x12c719[_0x59a1('0x2a')]);if(_0x12c719['name']){delete _0x12c719[_0x59a1('0x2b')];}_0x2ddc83[_0x59a1('0x1c')](_0x49c331)[_0x59a1('0x2c')](_0x12c719);};}exports[_0x59a1('0x2d')]=function(_0x392f5f,_0x4be059){var _0x49eec7={},_0x3069a1={},_0x36c9b6={'count':0x0,'rows':[]};var _0x3d1941=_['map'](db['DeskAccount']['rawAttributes'],function(_0x4cbd5c){return{'name':_0x4cbd5c[_0x59a1('0x2e')],'type':_0x4cbd5c[_0x59a1('0x2f')][_0x59a1('0x30')]};});_0x3069a1[_0x59a1('0x31')]=_[_0x59a1('0x32')](_0x3d1941,_0x59a1('0x2b'));_0x3069a1[_0x59a1('0x33')]=_[_0x59a1('0x34')](_0x392f5f[_0x59a1('0x33')]);_0x3069a1[_0x59a1('0x35')]=_[_0x59a1('0x36')](_0x3069a1['model'],_0x3069a1[_0x59a1('0x33')]);_0x49eec7['attributes']=_[_0x59a1('0x36')](_0x3069a1[_0x59a1('0x31')],qs[_0x59a1('0x37')](_0x392f5f['query'][_0x59a1('0x37')]));_0x49eec7[_0x59a1('0x38')]=_0x49eec7[_0x59a1('0x38')][_0x59a1('0x39')]?_0x49eec7[_0x59a1('0x38')]:_0x3069a1[_0x59a1('0x31')];if(!_0x392f5f[_0x59a1('0x33')][_0x59a1('0x3a')](_0x59a1('0x3b'))){_0x49eec7['limit']=qs[_0x59a1('0x1f')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x1f')]);_0x49eec7[_0x59a1('0x20')]=qs[_0x59a1('0x20')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x20')]);}_0x49eec7[_0x59a1('0x3c')]=qs[_0x59a1('0x3d')](_0x392f5f[_0x59a1('0x33')][_0x59a1('0x3d')]);_0x49eec7[_0x59a1('0x3e')]=qs[_0x59a1('0x35')](_[_0x59a1('0x3f')](_0x392f5f[_0x59a1('0x33')],_0x3069a1[_0x59a1('0x35')]),_0x3d1941);if(_0x392f5f[_0x59a1('0x33')]['filter']){_0x49eec7[_0x59a1('0x3e')]=_[_0x59a1('0x40')](_0x49eec7['where'],{'$or':_['map'](_0x3d1941,function(_0x4067f6){if(_0x4067f6[_0x59a1('0x2f')]!==_0x59a1('0x41')){var _0x402fd3={};_0x402fd3[_0x4067f6[_0x59a1('0x2b')]]={'$like':'%'+_0x392f5f['query'][_0x59a1('0x42')]+'%'};return _0x402fd3;}})});}_0x49eec7=_[_0x59a1('0x40')]({},_0x49eec7,_0x392f5f[_0x59a1('0x43')]);var _0x1f4ba9={'where':_0x49eec7['where']};return db['DeskAccount'][_0x59a1('0x44')](_0x1f4ba9)[_0x59a1('0x26')](function(_0x314d8c){_0x36c9b6['count']=_0x314d8c;if(_0x392f5f['query'][_0x59a1('0x45')]){_0x49eec7[_0x59a1('0x46')]=[{'all':!![]}];}return db['DeskAccount'][_0x59a1('0x47')](_0x49eec7);})[_0x59a1('0x26')](function(_0x40c09a){_0x36c9b6['rows']=_0x40c09a;return _0x36c9b6;})['then'](respondWithFilteredResult(_0x4be059,_0x49eec7))[_0x59a1('0x48')](handleError(_0x4be059,null));};exports[_0x59a1('0x49')]=function(_0x59dda6,_0x3d6acb){var _0x7d4c52={'raw':![],'where':{'id':_0x59dda6[_0x59a1('0x4a')]['id']}},_0x4ecff1={};_0x4ecff1[_0x59a1('0x31')]=_['keys'](db[_0x59a1('0x4b')]['rawAttributes']);_0x4ecff1[_0x59a1('0x33')]=_['keys'](_0x59dda6[_0x59a1('0x33')]);_0x4ecff1['filters']=_[_0x59a1('0x36')](_0x4ecff1[_0x59a1('0x31')],_0x4ecff1[_0x59a1('0x33')]);_0x7d4c52['attributes']=_[_0x59a1('0x36')](_0x4ecff1[_0x59a1('0x31')],qs[_0x59a1('0x37')](_0x59dda6[_0x59a1('0x33')]['fields']));_0x7d4c52[_0x59a1('0x38')]=_0x7d4c52[_0x59a1('0x38')][_0x59a1('0x39')]?_0x7d4c52[_0x59a1('0x38')]:_0x4ecff1[_0x59a1('0x31')];if(_0x59dda6['query'][_0x59a1('0x45')]){_0x7d4c52['include']=[{'all':!![]}];}_0x7d4c52=_[_0x59a1('0x40')]({},_0x7d4c52,_0x59dda6['options']);return db[_0x59a1('0x4b')][_0x59a1('0x4c')](_0x7d4c52)[_0x59a1('0x26')](handleEntityNotFound(_0x3d6acb,null))['then'](respondWithResult(_0x3d6acb,null))[_0x59a1('0x48')](handleError(_0x3d6acb,null));};exports[_0x59a1('0x4d')]=function(_0x79ae17,_0x26f89d){return db[_0x59a1('0x4b')][_0x59a1('0x4d')](_0x79ae17[_0x59a1('0x4e')],{})[_0x59a1('0x26')](respondWithResult(_0x26f89d,0xc9))[_0x59a1('0x48')](handleError(_0x26f89d,null));};exports[_0x59a1('0x25')]=function(_0x5e39bd,_0x58cbce){if(_0x5e39bd[_0x59a1('0x4e')]['id']){delete _0x5e39bd[_0x59a1('0x4e')]['id'];}return db[_0x59a1('0x4b')][_0x59a1('0x4c')]({'where':{'id':_0x5e39bd['params']['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x58cbce,null))[_0x59a1('0x26')](saveUpdates(_0x5e39bd[_0x59a1('0x4e')],null))[_0x59a1('0x26')](respondWithResult(_0x58cbce,null))['catch'](handleError(_0x58cbce,null));};exports['destroy']=function(_0x24b508,_0x293244){return db[_0x59a1('0x4b')][_0x59a1('0x4c')]({'where':{'id':_0x24b508[_0x59a1('0x4a')]['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x293244,null))[_0x59a1('0x26')](removeEntity(_0x293244,null))[_0x59a1('0x48')](handleError(_0x293244,null));};exports[_0x59a1('0x4f')]=function(_0x20211b,_0x2d2e29,_0x128060){var _0x9068f8={};var _0x2eacc8={};var _0x1940b3;var _0x233d11;return db['DeskAccount'][_0x59a1('0x50')]({'where':{'id':_0x20211b['params']['id']}})[_0x59a1('0x26')](handleEntityNotFound(_0x2d2e29,null))['then'](function(_0x2a3c72){if(_0x2a3c72){_0x1940b3=_0x2a3c72;_0x2eacc8['model']=_[_0x59a1('0x34')](db['DeskConfiguration'][_0x59a1('0x51')]);_0x2eacc8['query']=_[_0x59a1('0x34')](_0x20211b[_0x59a1('0x33')]);_0x2eacc8[_0x59a1('0x35')]=_[_0x59a1('0x36')](_0x2eacc8[_0x59a1('0x31')],_0x2eacc8['query']);_0x9068f8[_0x59a1('0x38')]=_[_0x59a1('0x36')](_0x2eacc8['model'],qs[_0x59a1('0x37')](_0x20211b['query'][_0x59a1('0x37')]));_0x9068f8[_0x59a1('0x38')]=_0x9068f8[_0x59a1('0x38')][_0x59a1('0x39')]?_0x9068f8['attributes']:_0x2eacc8[_0x59a1('0x31')];_0x9068f8[_0x59a1('0x3c')]=qs['sort'](_0x20211b['query']['sort']);_0x9068f8[_0x59a1('0x3e')]=qs[_0x59a1('0x35')](_['pick'](_0x20211b['query'],_0x2eacc8[_0x59a1('0x35')]));if(_0x20211b[_0x59a1('0x33')]['filter']){_0x9068f8[_0x59a1('0x3e')]=_[_0x59a1('0x40')](_0x9068f8[_0x59a1('0x3e')],{'$or':_['map'](_0x9068f8['attributes'],function(_0x3b6932){var _0x322b19={};_0x322b19[_0x3b6932]={'$like':'%'+_0x20211b[_0x59a1('0x33')][_0x59a1('0x42')]+'%'};return _0x322b19;})});}_0x9068f8=_[_0x59a1('0x40')]({},_0x9068f8,_0x20211b['options']);return _0x1940b3[_0x59a1('0x4f')](_0x9068f8);}})[_0x59a1('0x26')](function(_0x3652fe){if(_0x3652fe){_0x233d11=_0x3652fe[_0x59a1('0x39')];if(!_0x20211b[_0x59a1('0x33')][_0x59a1('0x3a')](_0x59a1('0x3b'))){_0x9068f8['limit']=qs[_0x59a1('0x1f')](_0x20211b[_0x59a1('0x33')][_0x59a1('0x1f')]);_0x9068f8[_0x59a1('0x20')]=qs[_0x59a1('0x20')](_0x20211b['query'][_0x59a1('0x20')]);}return _0x1940b3[_0x59a1('0x4f')](_0x9068f8);}})[_0x59a1('0x26')](function(_0x3901fb){if(_0x3901fb){return _0x3901fb?{'count':_0x233d11,'rows':_0x3901fb}:null;}})[_0x59a1('0x26')](respondWithResult(_0x2d2e29,null))[_0x59a1('0x48')](handleError(_0x2d2e29,null));};exports[_0x59a1('0x52')]=function(_0x378e5e,_0x1cdf1b,_0x31aa87){if(_0x378e5e['body']['id']){delete _0x378e5e[_0x59a1('0x4e')]['id'];}return db[_0x59a1('0x4b')][_0x59a1('0x50')]({'where':{'id':_0x378e5e[_0x59a1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cdf1b,null))['then'](function(_0x21f5fb){if(_0x21f5fb){_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x53')]=_0x21f5fb['id'];_0x378e5e['body'][_0x59a1('0x54')]=integrations[_0x59a1('0x55')](_0x378e5e[_0x59a1('0x4e')]['channel'],_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x2f')]);_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x56')]=integrations['getDescriptions'](_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x57')],_0x378e5e[_0x59a1('0x4e')][_0x59a1('0x2f')]);return db[_0x59a1('0x58')][_0x59a1('0x4d')](_0x378e5e[_0x59a1('0x4e')],{'include':[{'model':db[_0x59a1('0x59')],'as':_0x59a1('0x54')},{'model':db[_0x59a1('0x59')],'as':_0x59a1('0x56')}]});}return null;})[_0x59a1('0x26')](respondWithResult(_0x1cdf1b,null))['catch'](handleError(_0x1cdf1b,null));};exports[_0x59a1('0x5a')]=function(_0x3bb07c,_0x1314a7,_0x3b544b){var _0x30359d=[{'name':_0x59a1('0x5b'),'label':_0x59a1('0x5b'),'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 _0x22ffde='';return db['DeskAccount'][_0x59a1('0x50')]({'where':{'id':_0x3bb07c[_0x59a1('0x4a')]['id']},'attributes':['id',_0x59a1('0x5c'),_0x59a1('0x5d'),_0x59a1('0x5e'),_0x59a1('0x5f'),_0x59a1('0x60'),_0x59a1('0x61'),'token',_0x59a1('0x62')]})[_0x59a1('0x26')](handleEntityNotFound(_0x1314a7,null))[_0x59a1('0x26')](function(_0x4ec7b3){if(_0x4ec7b3){_0x22ffde=_0x4ec7b3[_0x59a1('0x5c')];var _0x276ffc=_0x22ffde[_0x59a1('0x63')](-0x1);if(_0x276ffc==='/'){_0x22ffde=_0x22ffde[_0x59a1('0x64')](0x0,_0x22ffde[_0x59a1('0x65')](_0x276ffc));}var _0x3cb7f8={'method':'GET','uri':util[_0x59a1('0x66')](_0x59a1('0x67'),_0x22ffde),'headers':{'Content-Type':_0x59a1('0x68'),'Accept':'application/json'},'json':!![]};if(_0x4ec7b3[_0x59a1('0x5d')]===_0x59a1('0x69')){_0x3cb7f8[_0x59a1('0x6a')]['Authorization']=util[_0x59a1('0x66')](_0x59a1('0x6b'),new Buffer(util[_0x59a1('0x66')](_0x59a1('0x6c'),_0x4ec7b3[_0x59a1('0x5e')],_0x4ec7b3[_0x59a1('0x5f')]))[_0x59a1('0x6d')](_0x59a1('0x6e')));}return rp(_0x3cb7f8)[_0x59a1('0x26')](function(_0x360d96){return _0x30359d['concat'](_[_0x59a1('0x32')](_0x360d96[_0x59a1('0x6f')][_0x59a1('0x70')],function(_0x5de850){return{'id':_0x5de850[_0x59a1('0x2b')],'name':_0x5de850['name'],'type':_0x5de850[_0x59a1('0x2f')],'active':_0x5de850[_0x59a1('0x71')],'label':_0x5de850[_0x59a1('0x72')],'custom':!![]};}));});}})[_0x59a1('0x26')](function(_0x4e7b8c){return{'count':_0x4e7b8c[_0x59a1('0x39')],'rows':_0x4e7b8c};})[_0x59a1('0x26')](respondWithResult(_0x1314a7,null))[_0x59a1('0x48')](function(_0x37ecce){var _0x74b792=_0x3bb07c['query'][_0x59a1('0x73')]?0x1f4:_0x37ecce[_0x59a1('0x74')]||0x1f4;logger[_0x59a1('0x29')](_0x59a1('0x75'),'getFields',_0x74b792,JSON['stringify'](_0x37ecce));delete _0x37ecce[_0x59a1('0x2b')];if(_0x74b792===0x191){_0x74b792=0x190;}_0x1314a7[_0x59a1('0x1c')](_0x74b792)[_0x59a1('0x2c')](_0x3bb07c['query'][_0x59a1('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x37ecce[_0x59a1('0x74')]}:_0x37ecce);});}; \ No newline at end of file +var _0xc51f=['findAll','rows','catch','show','intersection','includeAll','merge','find','create','body','params','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','Descriptions','DeskConfiguration','getFields','priority','remoteUri','username','password','consumerKey','token','tokenSecret','slice','lastIndexOf','%s/custom_fields','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','toString','concat','_embedded','entries','active','label','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','fields','attributes','length','limit','order','sort','where','pick','filter','VIRTUAL','options','include'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc51f,0x9c));var _0xfc51=function(_0x6287b6,_0x5682e7){_0x6287b6=_0x6287b6-0x0;var _0x5d6be4=_0xc51f[_0x6287b6];return _0x5d6be4;};'use strict';var emlformat=require(_0xfc51('0x0'));var rimraf=require(_0xfc51('0x1'));var zipdir=require(_0xfc51('0x2'));var jsonpatch=require(_0xfc51('0x3'));var rp=require('request-promise');var moment=require(_0xfc51('0x4'));var BPromise=require(_0xfc51('0x5'));var Mustache=require(_0xfc51('0x6'));var util=require(_0xfc51('0x7'));var path=require(_0xfc51('0x8'));var sox=require('sox');var csv=require(_0xfc51('0x9'));var ejs=require(_0xfc51('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfc51('0xb'));var squel=require('squel');var crypto=require(_0xfc51('0xc'));var jsforce=require(_0xfc51('0xd'));var deskjs=require(_0xfc51('0xe'));var toCsv=require(_0xfc51('0x9'));var querystring=require(_0xfc51('0xf'));var Papa=require(_0xfc51('0x10'));var Redis=require(_0xfc51('0x11'));var authService=require(_0xfc51('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfc51('0x13'));var hardwareService=require(_0xfc51('0x14'));var logger=require('../../config/logger')(_0xfc51('0x15'));var utils=require(_0xfc51('0x16'));var config=require(_0xfc51('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfc51('0x18'))['db'];var integrations=require(_0xfc51('0x19'));function respondWithStatusCode(_0x91551b,_0x381533){_0x381533=_0x381533||0xcc;return function(_0x3b329c){if(_0x3b329c){return _0x91551b['sendStatus'](_0x381533);}return _0x91551b[_0xfc51('0x1a')](_0x381533)[_0xfc51('0x1b')]();};}function respondWithResult(_0x5095b4,_0x4d8839){_0x4d8839=_0x4d8839||0xc8;return function(_0x5ee697){if(_0x5ee697){return _0x5095b4[_0xfc51('0x1a')](_0x4d8839)[_0xfc51('0x1c')](_0x5ee697);}};}function respondWithFilteredResult(_0x414674,_0x16e6ba){return function(_0x1a7e87){if(_0x1a7e87){var _0x547834=typeof _0x16e6ba['offset']===_0xfc51('0x1d')&&typeof _0x16e6ba['limit']===_0xfc51('0x1d');var _0x4a5af5=_0x1a7e87['count'];var _0x64bcb1=_0x547834?0x0:_0x16e6ba['offset'];var _0x130496=_0x547834?_0x1a7e87[_0xfc51('0x1e')]:_0x16e6ba[_0xfc51('0x1f')]+_0x16e6ba['limit'];var _0x403422;if(_0x130496>=_0x4a5af5){_0x130496=_0x4a5af5;_0x403422=0xc8;}else{_0x403422=0xce;}_0x414674['status'](_0x403422);return _0x414674['set'](_0xfc51('0x20'),_0x64bcb1+'-'+_0x130496+'/'+_0x4a5af5)[_0xfc51('0x1c')](_0x1a7e87);}return null;};}function patchUpdates(_0x33ae5a){return function(_0x48e3b7){try{jsonpatch[_0xfc51('0x21')](_0x48e3b7,_0x33ae5a,!![]);}catch(_0x38c5f0){return BPromise['reject'](_0x38c5f0);}return _0x48e3b7[_0xfc51('0x22')]();};}function saveUpdates(_0x3d476c,_0x56b55a){return function(_0x1519fd){if(_0x1519fd){return _0x1519fd[_0xfc51('0x23')](_0x3d476c)[_0xfc51('0x24')](function(_0x2a6faf){return _0x2a6faf;});}return null;};}function removeEntity(_0x1cecb8,_0x161361){return function(_0x335b40){if(_0x335b40){return _0x335b40[_0xfc51('0x25')]()[_0xfc51('0x24')](function(){_0x1cecb8[_0xfc51('0x1a')](0xcc)[_0xfc51('0x1b')]();});}};}function handleEntityNotFound(_0x2e5c45,_0x46ba56){return function(_0x52fe4d){if(!_0x52fe4d){_0x2e5c45[_0xfc51('0x26')](0x194);}return _0x52fe4d;};}function handleError(_0x10f28a,_0x201de6){_0x201de6=_0x201de6||0x1f4;return function(_0x2e3362){logger[_0xfc51('0x27')](_0x2e3362[_0xfc51('0x28')]);if(_0x2e3362[_0xfc51('0x29')]){delete _0x2e3362['name'];}_0x10f28a[_0xfc51('0x1a')](_0x201de6)[_0xfc51('0x2a')](_0x2e3362);};}exports['index']=function(_0x700f59,_0x161d9b){var _0x45f32c={},_0x3aff33={},_0x30f872={'count':0x0,'rows':[]};var _0x62127f=_[_0xfc51('0x2b')](db[_0xfc51('0x2c')][_0xfc51('0x2d')],function(_0x34c592){return{'name':_0x34c592[_0xfc51('0x2e')],'type':_0x34c592[_0xfc51('0x2f')]['key']};});_0x3aff33[_0xfc51('0x30')]=_['map'](_0x62127f,'name');_0x3aff33[_0xfc51('0x31')]=_[_0xfc51('0x32')](_0x700f59[_0xfc51('0x31')]);_0x3aff33[_0xfc51('0x33')]=_['intersection'](_0x3aff33[_0xfc51('0x30')],_0x3aff33[_0xfc51('0x31')]);_0x45f32c['attributes']=_['intersection'](_0x3aff33[_0xfc51('0x30')],qs[_0xfc51('0x34')](_0x700f59[_0xfc51('0x31')][_0xfc51('0x34')]));_0x45f32c[_0xfc51('0x35')]=_0x45f32c[_0xfc51('0x35')][_0xfc51('0x36')]?_0x45f32c[_0xfc51('0x35')]:_0x3aff33['model'];if(!_0x700f59[_0xfc51('0x31')]['hasOwnProperty']('nolimit')){_0x45f32c['limit']=qs[_0xfc51('0x37')](_0x700f59[_0xfc51('0x31')][_0xfc51('0x37')]);_0x45f32c['offset']=qs[_0xfc51('0x1f')](_0x700f59[_0xfc51('0x31')]['offset']);}_0x45f32c[_0xfc51('0x38')]=qs[_0xfc51('0x39')](_0x700f59[_0xfc51('0x31')][_0xfc51('0x39')]);_0x45f32c[_0xfc51('0x3a')]=qs[_0xfc51('0x33')](_[_0xfc51('0x3b')](_0x700f59[_0xfc51('0x31')],_0x3aff33[_0xfc51('0x33')]),_0x62127f);if(_0x700f59['query'][_0xfc51('0x3c')]){_0x45f32c[_0xfc51('0x3a')]=_['merge'](_0x45f32c[_0xfc51('0x3a')],{'$or':_[_0xfc51('0x2b')](_0x62127f,function(_0xbef26a){if(_0xbef26a[_0xfc51('0x2f')]!==_0xfc51('0x3d')){var _0x5c1f6d={};_0x5c1f6d[_0xbef26a[_0xfc51('0x29')]]={'$like':'%'+_0x700f59[_0xfc51('0x31')][_0xfc51('0x3c')]+'%'};return _0x5c1f6d;}})});}_0x45f32c=_['merge']({},_0x45f32c,_0x700f59[_0xfc51('0x3e')]);var _0x57814e={'where':_0x45f32c[_0xfc51('0x3a')]};return db[_0xfc51('0x2c')][_0xfc51('0x1e')](_0x57814e)['then'](function(_0x4afe6d){_0x30f872['count']=_0x4afe6d;if(_0x700f59[_0xfc51('0x31')]['includeAll']){_0x45f32c[_0xfc51('0x3f')]=[{'all':!![]}];}return db[_0xfc51('0x2c')][_0xfc51('0x40')](_0x45f32c);})[_0xfc51('0x24')](function(_0xd3aba9){_0x30f872[_0xfc51('0x41')]=_0xd3aba9;return _0x30f872;})[_0xfc51('0x24')](respondWithFilteredResult(_0x161d9b,_0x45f32c))[_0xfc51('0x42')](handleError(_0x161d9b,null));};exports[_0xfc51('0x43')]=function(_0x1d3592,_0x2cf3b1){var _0x53ea11={'raw':![],'where':{'id':_0x1d3592['params']['id']}},_0x33a8c7={};_0x33a8c7[_0xfc51('0x30')]=_[_0xfc51('0x32')](db[_0xfc51('0x2c')][_0xfc51('0x2d')]);_0x33a8c7[_0xfc51('0x31')]=_[_0xfc51('0x32')](_0x1d3592[_0xfc51('0x31')]);_0x33a8c7[_0xfc51('0x33')]=_[_0xfc51('0x44')](_0x33a8c7[_0xfc51('0x30')],_0x33a8c7[_0xfc51('0x31')]);_0x53ea11[_0xfc51('0x35')]=_[_0xfc51('0x44')](_0x33a8c7[_0xfc51('0x30')],qs[_0xfc51('0x34')](_0x1d3592[_0xfc51('0x31')]['fields']));_0x53ea11[_0xfc51('0x35')]=_0x53ea11['attributes'][_0xfc51('0x36')]?_0x53ea11[_0xfc51('0x35')]:_0x33a8c7['model'];if(_0x1d3592[_0xfc51('0x31')][_0xfc51('0x45')]){_0x53ea11[_0xfc51('0x3f')]=[{'all':!![]}];}_0x53ea11=_[_0xfc51('0x46')]({},_0x53ea11,_0x1d3592[_0xfc51('0x3e')]);return db[_0xfc51('0x2c')][_0xfc51('0x47')](_0x53ea11)[_0xfc51('0x24')](handleEntityNotFound(_0x2cf3b1,null))[_0xfc51('0x24')](respondWithResult(_0x2cf3b1,null))[_0xfc51('0x42')](handleError(_0x2cf3b1,null));};exports[_0xfc51('0x48')]=function(_0x534c0d,_0x1315e6){return db['DeskAccount'][_0xfc51('0x48')](_0x534c0d[_0xfc51('0x49')],{})[_0xfc51('0x24')](respondWithResult(_0x1315e6,0xc9))[_0xfc51('0x42')](handleError(_0x1315e6,null));};exports[_0xfc51('0x23')]=function(_0x317376,_0x51c243){if(_0x317376[_0xfc51('0x49')]['id']){delete _0x317376['body']['id'];}return db['DeskAccount'][_0xfc51('0x47')]({'where':{'id':_0x317376[_0xfc51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51c243,null))[_0xfc51('0x24')](saveUpdates(_0x317376[_0xfc51('0x49')],null))[_0xfc51('0x24')](respondWithResult(_0x51c243,null))[_0xfc51('0x42')](handleError(_0x51c243,null));};exports[_0xfc51('0x25')]=function(_0x32b301,_0x21fe96){return db[_0xfc51('0x2c')][_0xfc51('0x47')]({'where':{'id':_0x32b301[_0xfc51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x21fe96,null))[_0xfc51('0x24')](removeEntity(_0x21fe96,null))['catch'](handleError(_0x21fe96,null));};exports[_0xfc51('0x4b')]=function(_0x5061ef,_0x48612c,_0x1ecd52){var _0x21d98e={};var _0x21953e={};var _0x1c46c1;var _0x42a128;return db[_0xfc51('0x2c')][_0xfc51('0x4c')]({'where':{'id':_0x5061ef[_0xfc51('0x4a')]['id']}})['then'](handleEntityNotFound(_0x48612c,null))['then'](function(_0x4fe957){if(_0x4fe957){_0x1c46c1=_0x4fe957;_0x21953e[_0xfc51('0x30')]=_['keys'](db['DeskConfiguration'][_0xfc51('0x2d')]);_0x21953e['query']=_[_0xfc51('0x32')](_0x5061ef[_0xfc51('0x31')]);_0x21953e['filters']=_[_0xfc51('0x44')](_0x21953e[_0xfc51('0x30')],_0x21953e[_0xfc51('0x31')]);_0x21d98e[_0xfc51('0x35')]=_[_0xfc51('0x44')](_0x21953e[_0xfc51('0x30')],qs[_0xfc51('0x34')](_0x5061ef[_0xfc51('0x31')]['fields']));_0x21d98e[_0xfc51('0x35')]=_0x21d98e[_0xfc51('0x35')][_0xfc51('0x36')]?_0x21d98e[_0xfc51('0x35')]:_0x21953e['model'];_0x21d98e[_0xfc51('0x38')]=qs[_0xfc51('0x39')](_0x5061ef['query']['sort']);_0x21d98e[_0xfc51('0x3a')]=qs[_0xfc51('0x33')](_['pick'](_0x5061ef[_0xfc51('0x31')],_0x21953e['filters']));if(_0x5061ef['query'][_0xfc51('0x3c')]){_0x21d98e[_0xfc51('0x3a')]=_['merge'](_0x21d98e['where'],{'$or':_['map'](_0x21d98e[_0xfc51('0x35')],function(_0x57c7bb){var _0x550f6d={};_0x550f6d[_0x57c7bb]={'$like':'%'+_0x5061ef[_0xfc51('0x31')][_0xfc51('0x3c')]+'%'};return _0x550f6d;})});}_0x21d98e=_[_0xfc51('0x46')]({},_0x21d98e,_0x5061ef[_0xfc51('0x3e')]);return _0x1c46c1[_0xfc51('0x4b')](_0x21d98e);}})[_0xfc51('0x24')](function(_0x261cd7){if(_0x261cd7){_0x42a128=_0x261cd7[_0xfc51('0x36')];if(!_0x5061ef[_0xfc51('0x31')]['hasOwnProperty']('nolimit')){_0x21d98e[_0xfc51('0x37')]=qs['limit'](_0x5061ef[_0xfc51('0x31')][_0xfc51('0x37')]);_0x21d98e[_0xfc51('0x1f')]=qs[_0xfc51('0x1f')](_0x5061ef[_0xfc51('0x31')][_0xfc51('0x1f')]);}return _0x1c46c1['getConfigurations'](_0x21d98e);}})['then'](function(_0x3ab911){if(_0x3ab911){return _0x3ab911?{'count':_0x42a128,'rows':_0x3ab911}:null;}})['then'](respondWithResult(_0x48612c,null))['catch'](handleError(_0x48612c,null));};exports[_0xfc51('0x4d')]=function(_0x4952b9,_0x5d06fe,_0x541569){if(_0x4952b9[_0xfc51('0x49')]['id']){delete _0x4952b9[_0xfc51('0x49')]['id'];}return db[_0xfc51('0x2c')][_0xfc51('0x4c')]({'where':{'id':_0x4952b9['params']['id']}})[_0xfc51('0x24')](handleEntityNotFound(_0x5d06fe,null))['then'](function(_0x55a9d9){if(_0x55a9d9){_0x4952b9[_0xfc51('0x49')][_0xfc51('0x4e')]=_0x55a9d9['id'];_0x4952b9[_0xfc51('0x49')][_0xfc51('0x4f')]=integrations['getSubjects'](_0x4952b9[_0xfc51('0x49')][_0xfc51('0x50')],_0x4952b9[_0xfc51('0x49')]['type']);_0x4952b9[_0xfc51('0x49')][_0xfc51('0x51')]=integrations['getDescriptions'](_0x4952b9[_0xfc51('0x49')][_0xfc51('0x50')],_0x4952b9['body'][_0xfc51('0x2f')]);return db[_0xfc51('0x52')][_0xfc51('0x48')](_0x4952b9[_0xfc51('0x49')],{'include':[{'model':db['DeskField'],'as':_0xfc51('0x4f')},{'model':db['DeskField'],'as':_0xfc51('0x51')}]});}return null;})['then'](respondWithResult(_0x5d06fe,null))['catch'](handleError(_0x5d06fe,null));};exports[_0xfc51('0x53')]=function(_0x20df89,_0x4961c3,_0x15ad8d){var _0x31b076=[{'name':_0xfc51('0x54'),'label':_0xfc51('0x54'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x474a2d='';return db[_0xfc51('0x2c')]['findOne']({'where':{'id':_0x20df89[_0xfc51('0x4a')]['id']},'attributes':['id',_0xfc51('0x55'),'authType',_0xfc51('0x56'),_0xfc51('0x57'),_0xfc51('0x58'),'consumerSecret',_0xfc51('0x59'),_0xfc51('0x5a')]})['then'](handleEntityNotFound(_0x4961c3,null))[_0xfc51('0x24')](function(_0x345708){if(_0x345708){_0x474a2d=_0x345708['remoteUri'];var _0x166053=_0x474a2d[_0xfc51('0x5b')](-0x1);if(_0x166053==='/'){_0x474a2d=_0x474a2d['substring'](0x0,_0x474a2d[_0xfc51('0x5c')](_0x166053));}var _0x4ef3f8={'method':'GET','uri':util['format'](_0xfc51('0x5d'),_0x474a2d),'headers':{'Content-Type':_0xfc51('0x5e'),'Accept':_0xfc51('0x5e')},'json':!![]};if(_0x345708['authType']==='basic'){_0x4ef3f8[_0xfc51('0x5f')][_0xfc51('0x60')]=util[_0xfc51('0x61')](_0xfc51('0x62'),new Buffer(util[_0xfc51('0x61')](_0xfc51('0x63'),_0x345708[_0xfc51('0x56')],_0x345708['password']))[_0xfc51('0x64')]('base64'));}return rp(_0x4ef3f8)[_0xfc51('0x24')](function(_0xee4e8){return _0x31b076[_0xfc51('0x65')](_[_0xfc51('0x2b')](_0xee4e8[_0xfc51('0x66')][_0xfc51('0x67')],function(_0x2732be){return{'id':_0x2732be[_0xfc51('0x29')],'name':_0x2732be[_0xfc51('0x29')],'type':_0x2732be[_0xfc51('0x2f')],'active':_0x2732be[_0xfc51('0x68')],'label':_0x2732be[_0xfc51('0x69')],'custom':!![]};}));});}})[_0xfc51('0x24')](function(_0x2d6dc5){return{'count':_0x2d6dc5[_0xfc51('0x36')],'rows':_0x2d6dc5};})[_0xfc51('0x24')](respondWithResult(_0x4961c3,null))[_0xfc51('0x42')](function(_0xa4c58d){var _0x2bb96e=_0x20df89[_0xfc51('0x31')][_0xfc51('0x6a')]?0x1f4:_0xa4c58d['statusCode']||0x1f4;logger['error'](_0xfc51('0x6b'),'getFields',_0x2bb96e,JSON[_0xfc51('0x6c')](_0xa4c58d));delete _0xa4c58d['name'];if(_0x2bb96e===0x191){_0x2bb96e=0x190;}_0x4961c3[_0xfc51('0x1a')](_0x2bb96e)['send'](_0x20df89[_0xfc51('0x31')]['test']?{'message':_0xfc51('0x6d'),'statusCode':_0xa4c58d['statusCode']}:_0xa4c58d);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 3e7206b..da4bfe3 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 _0xcad8=['util','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash'];(function(_0x5a7372,_0x26ed53){var _0x2f359d=function(_0x500018){while(--_0x500018){_0x5a7372['push'](_0x5a7372['shift']());}};_0x2f359d(++_0x26ed53);}(_0xcad8,0xdb));var _0x8cad=function(_0x3885f5,_0x19ac74){_0x3885f5=_0x3885f5-0x0;var _0x263902=_0xcad8[_0x3885f5];return _0x263902;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8cad('0x2'));var BPromise=require('bluebird');var rp=require(_0x8cad('0x3'));var fs=require('fs');var path=require(_0x8cad('0x4'));var rimraf=require(_0x8cad('0x5'));var config=require(_0x8cad('0x6'));var attributes=require(_0x8cad('0x7'));var integrations=require(_0x8cad('0x8'));module['exports']=function(_0x4e8d98,_0x179e0c){return _0x4e8d98['define'](_0x8cad('0x9'),attributes,{'tableName':_0x8cad('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f0e=['int_desk_accounts','util','../../config/logger','api','moment','request-promise','path','rimraf','./intDeskAccount.attributes','exports','define','DeskAccount'];(function(_0x10015a,_0x34f9e8){var _0x479049=function(_0x1356e3){while(--_0x1356e3){_0x10015a['push'](_0x10015a['shift']());}};_0x479049(++_0x34f9e8);}(_0x3f0e,0x1c9));var _0xe3f0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3f0e[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xe3f0('0x0'));var logger=require(_0xe3f0('0x1'))(_0xe3f0('0x2'));var moment=require(_0xe3f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xe3f0('0x4'));var fs=require('fs');var path=require(_0xe3f0('0x5'));var rimraf=require(_0xe3f0('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3f0('0x7'));var integrations=require('../../components/integrations/configuration');module[_0xe3f0('0x8')]=function(_0x30defe,_0x41c983){return _0x30defe[_0xe3f0('0x9')](_0xe3f0('0xa'),attributes,{'tableName':_0xe3f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 1129052..76b6502 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 _0xfe8f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','GetDeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowDeskAccount','DeskAccount','find','lodash','moment','ioredis'];(function(_0x240ed0,_0x342564){var _0x21beec=function(_0x113f74){while(--_0x113f74){_0x240ed0['push'](_0x240ed0['shift']());}};_0x21beec(++_0x342564);}(_0xfe8f,0x69));var _0xffe8=function(_0x285d70,_0x551b70){_0x285d70=_0x285d70-0x0;var _0x15ad2d=_0xfe8f[_0x285d70];return _0x15ad2d;};'use strict';var _=require(_0xffe8('0x0'));var util=require('util');var moment=require(_0xffe8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffe8('0x2'));var db=require(_0xffe8('0x3'))['db'];var utils=require(_0xffe8('0x4'));var logger=require(_0xffe8('0x5'))(_0xffe8('0x6'));var config=require(_0xffe8('0x7'));var jayson=require(_0xffe8('0x8'));var client=jayson[_0xffe8('0x9')][_0xffe8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385ab9,_0x5492e0,_0x31e030){return new BPromise(function(_0x367333,_0x467751){return client[_0xffe8('0xb')](_0x385ab9,_0x31e030)[_0xffe8('0xc')](function(_0x489a1e){logger['info'](_0xffe8('0xd'),_0x5492e0,_0xffe8('0xe'));logger['debug'](_0xffe8('0xf'),_0x5492e0,_0xffe8('0xe'),JSON[_0xffe8('0x10')](_0x489a1e));if(_0x489a1e[_0xffe8('0x11')]){if(_0x489a1e[_0xffe8('0x11')]['code']===0x1f4){logger[_0xffe8('0x11')](_0xffe8('0xd'),_0x5492e0,_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);return _0x467751(_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);}logger['error'](_0xffe8('0xd'),_0x5492e0,_0x489a1e[_0xffe8('0x11')][_0xffe8('0x12')]);return _0x367333(_0x489a1e['error'][_0xffe8('0x12')]);}else{logger[_0xffe8('0x13')](_0xffe8('0xd'),_0x5492e0,'request\x20sent');_0x367333(_0x489a1e[_0xffe8('0x14')][_0xffe8('0x12')]);}})['catch'](function(_0xa8558b){logger[_0xffe8('0x11')](_0xffe8('0xd'),_0x5492e0,_0xa8558b);_0x467751(_0xa8558b);});});}exports[_0xffe8('0x15')]=function(_0xf8e7ca){var _0x3c1e97=this;return new Promise(function(_0x4592fe,_0xb72b7c){return db['DeskAccount'][_0xffe8('0x16')]({'raw':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x18')]===undefined?!![]:![]:!![],'where':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca['options'][_0xffe8('0x19')]||null:null,'attributes':_0xf8e7ca[_0xffe8('0x17')]?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1a')]||null:null,'limit':_0xf8e7ca['options']?_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1b')]||null:null,'include':_0xf8e7ca['options']?_0xf8e7ca[_0xffe8('0x17')]['include']?_['map'](_0xf8e7ca[_0xffe8('0x17')][_0xffe8('0x1c')],function(_0x3488f3){return{'model':db[_0x3488f3['model']],'as':_0x3488f3['as'],'attributes':_0x3488f3[_0xffe8('0x1a')],'include':_0x3488f3[_0xffe8('0x1c')]?_['map'](_0x3488f3[_0xffe8('0x1c')],function(_0x26beb4){return{'model':db[_0x26beb4[_0xffe8('0x1d')]],'as':_0x26beb4['as'],'attributes':_0x26beb4[_0xffe8('0x1a')],'include':_0x26beb4[_0xffe8('0x1c')]?_[_0xffe8('0x1e')](_0x26beb4['include'],function(_0xcd047c){return{'model':db[_0xcd047c[_0xffe8('0x1d')]],'as':_0xcd047c['as'],'attributes':_0xcd047c[_0xffe8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xffe8('0xc')](function(_0x432057){logger[_0xffe8('0x13')]('GetDeskAccount',_0xf8e7ca);logger[_0xffe8('0x1f')](_0xffe8('0x15'),_0xf8e7ca,JSON[_0xffe8('0x10')](_0x432057));_0x4592fe(_0x432057);})[_0xffe8('0x20')](function(_0x87686b){logger[_0xffe8('0x11')](_0xffe8('0x15'),_0x87686b[_0xffe8('0x12')],_0xf8e7ca);_0xb72b7c(_0x3c1e97[_0xffe8('0x11')](0x1f4,_0x87686b[_0xffe8('0x12')]));});});};exports[_0xffe8('0x21')]=function(_0x4d4c23){var _0x301d87=this;return new Promise(function(_0x2789f3,_0x55eb9c){return db[_0xffe8('0x22')][_0xffe8('0x23')]({'raw':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x18')]===undefined?!![]:![]:!![],'where':_0x4d4c23[_0xffe8('0x17')]?_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x19')]||null:null,'attributes':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')]['attributes']||null:null,'include':_0x4d4c23['options']?_0x4d4c23[_0xffe8('0x17')]['include']?_['map'](_0x4d4c23[_0xffe8('0x17')][_0xffe8('0x1c')],function(_0xfd81b2){return{'model':db[_0xfd81b2[_0xffe8('0x1d')]],'as':_0xfd81b2['as'],'attributes':_0xfd81b2[_0xffe8('0x1a')],'include':_0xfd81b2[_0xffe8('0x1c')]?_['map'](_0xfd81b2[_0xffe8('0x1c')],function(_0x4e4259){return{'model':db[_0x4e4259[_0xffe8('0x1d')]],'as':_0x4e4259['as'],'attributes':_0x4e4259[_0xffe8('0x1a')],'include':_0x4e4259['include']?_[_0xffe8('0x1e')](_0x4e4259['include'],function(_0x14c027){return{'model':db[_0x14c027[_0xffe8('0x1d')]],'as':_0x14c027['as'],'attributes':_0x14c027[_0xffe8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x276d69){logger[_0xffe8('0x13')](_0xffe8('0x21'),_0x4d4c23);logger[_0xffe8('0x1f')](_0xffe8('0x21'),_0x4d4c23,JSON['stringify'](_0x276d69));_0x2789f3(_0x276d69);})[_0xffe8('0x20')](function(_0x205279){logger[_0xffe8('0x11')](_0xffe8('0x21'),_0x205279[_0xffe8('0x12')],_0x4d4c23);_0x55eb9c(_0x301d87['error'](0x1f4,_0x205279['message']));});});}; \ No newline at end of file +var _0x3c89=['info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetDeskAccount','DeskAccount','options','raw','attributes','include','map','model','ShowDeskAccount','find','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x5b2c05,_0xf20fef){var _0x22f040=function(_0xfe8a3){while(--_0xfe8a3){_0x5b2c05['push'](_0x5b2c05['shift']());}};_0x22f040(++_0xf20fef);}(_0x3c89,0xd4));var _0x93c8=function(_0x4a0000,_0x1c8eb5){_0x4a0000=_0x4a0000-0x0;var _0x8bae47=_0x3c89[_0x4a0000];return _0x8bae47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x93c8('0x0'));var BPromise=require(_0x93c8('0x1'));var rs=require(_0x93c8('0x2'));var fs=require('fs');var Redis=require(_0x93c8('0x3'));var db=require(_0x93c8('0x4'))['db'];var utils=require(_0x93c8('0x5'));var logger=require(_0x93c8('0x6'))(_0x93c8('0x7'));var config=require('../../config/environment');var jayson=require(_0x93c8('0x8'));var client=jayson[_0x93c8('0x9')][_0x93c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb8e0fa,_0x2bb647,_0x142a78){return new BPromise(function(_0x23f66a,_0x5969d9){return client['request'](_0xb8e0fa,_0x142a78)[_0x93c8('0xb')](function(_0x587d63){logger[_0x93c8('0xc')](_0x93c8('0xd'),_0x2bb647,_0x93c8('0xe'));logger[_0x93c8('0xf')](_0x93c8('0x10'),_0x2bb647,_0x93c8('0xe'),JSON[_0x93c8('0x11')](_0x587d63));if(_0x587d63[_0x93c8('0x12')]){if(_0x587d63[_0x93c8('0x12')]['code']===0x1f4){logger[_0x93c8('0x12')](_0x93c8('0xd'),_0x2bb647,_0x587d63[_0x93c8('0x12')]['message']);return _0x5969d9(_0x587d63[_0x93c8('0x12')][_0x93c8('0x13')]);}logger[_0x93c8('0x12')](_0x93c8('0xd'),_0x2bb647,_0x587d63['error'][_0x93c8('0x13')]);return _0x23f66a(_0x587d63['error'][_0x93c8('0x13')]);}else{logger['info'](_0x93c8('0xd'),_0x2bb647,_0x93c8('0xe'));_0x23f66a(_0x587d63['result'][_0x93c8('0x13')]);}})[_0x93c8('0x14')](function(_0x6ac2fc){logger[_0x93c8('0x12')](_0x93c8('0xd'),_0x2bb647,_0x6ac2fc);_0x5969d9(_0x6ac2fc);});});}exports[_0x93c8('0x15')]=function(_0x5d6aa9){var _0x36162a=this;return new Promise(function(_0x41efc0,_0x1edfdf){return db[_0x93c8('0x16')]['findAll']({'raw':_0x5d6aa9[_0x93c8('0x17')]?_0x5d6aa9[_0x93c8('0x17')][_0x93c8('0x18')]===undefined?!![]:![]:!![],'where':_0x5d6aa9[_0x93c8('0x17')]?_0x5d6aa9['options']['where']||null:null,'attributes':_0x5d6aa9[_0x93c8('0x17')]?_0x5d6aa9[_0x93c8('0x17')][_0x93c8('0x19')]||null:null,'limit':_0x5d6aa9[_0x93c8('0x17')]?_0x5d6aa9[_0x93c8('0x17')]['limit']||null:null,'include':_0x5d6aa9[_0x93c8('0x17')]?_0x5d6aa9[_0x93c8('0x17')][_0x93c8('0x1a')]?_[_0x93c8('0x1b')](_0x5d6aa9[_0x93c8('0x17')][_0x93c8('0x1a')],function(_0x3adec9){return{'model':db[_0x3adec9[_0x93c8('0x1c')]],'as':_0x3adec9['as'],'attributes':_0x3adec9['attributes'],'include':_0x3adec9['include']?_[_0x93c8('0x1b')](_0x3adec9[_0x93c8('0x1a')],function(_0xa514c9){return{'model':db[_0xa514c9[_0x93c8('0x1c')]],'as':_0xa514c9['as'],'attributes':_0xa514c9[_0x93c8('0x19')],'include':_0xa514c9[_0x93c8('0x1a')]?_[_0x93c8('0x1b')](_0xa514c9[_0x93c8('0x1a')],function(_0x3c5a58){return{'model':db[_0x3c5a58[_0x93c8('0x1c')]],'as':_0x3c5a58['as'],'attributes':_0x3c5a58['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18f7d3){logger[_0x93c8('0xc')](_0x93c8('0x15'),_0x5d6aa9);logger[_0x93c8('0xf')](_0x93c8('0x15'),_0x5d6aa9,JSON[_0x93c8('0x11')](_0x18f7d3));_0x41efc0(_0x18f7d3);})[_0x93c8('0x14')](function(_0x359c74){logger[_0x93c8('0x12')](_0x93c8('0x15'),_0x359c74[_0x93c8('0x13')],_0x5d6aa9);_0x1edfdf(_0x36162a['error'](0x1f4,_0x359c74[_0x93c8('0x13')]));});});};exports[_0x93c8('0x1d')]=function(_0x4bbfcd){var _0x41a8ac=this;return new Promise(function(_0x2afb2a,_0x1377e0){return db['DeskAccount'][_0x93c8('0x1e')]({'raw':_0x4bbfcd['options']?_0x4bbfcd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4bbfcd[_0x93c8('0x17')]?_0x4bbfcd[_0x93c8('0x17')][_0x93c8('0x1f')]||null:null,'attributes':_0x4bbfcd[_0x93c8('0x17')]?_0x4bbfcd[_0x93c8('0x17')][_0x93c8('0x19')]||null:null,'include':_0x4bbfcd[_0x93c8('0x17')]?_0x4bbfcd[_0x93c8('0x17')][_0x93c8('0x1a')]?_['map'](_0x4bbfcd[_0x93c8('0x17')]['include'],function(_0x5a6af4){return{'model':db[_0x5a6af4['model']],'as':_0x5a6af4['as'],'attributes':_0x5a6af4[_0x93c8('0x19')],'include':_0x5a6af4[_0x93c8('0x1a')]?_[_0x93c8('0x1b')](_0x5a6af4[_0x93c8('0x1a')],function(_0x41ec76){return{'model':db[_0x41ec76['model']],'as':_0x41ec76['as'],'attributes':_0x41ec76['attributes'],'include':_0x41ec76['include']?_[_0x93c8('0x1b')](_0x41ec76[_0x93c8('0x1a')],function(_0x38f938){return{'model':db[_0x38f938[_0x93c8('0x1c')]],'as':_0x38f938['as'],'attributes':_0x38f938[_0x93c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x93c8('0xb')](function(_0x3b0414){logger['info'](_0x93c8('0x1d'),_0x4bbfcd);logger['debug'](_0x93c8('0x1d'),_0x4bbfcd,JSON['stringify'](_0x3b0414));_0x2afb2a(_0x3b0414);})[_0x93c8('0x14')](function(_0x561e7a){logger[_0x93c8('0x12')](_0x93c8('0x1d'),_0x561e7a['message'],_0x4bbfcd);_0x1377e0(_0x41a8ac['error'](0x1f4,_0x561e7a[_0x93c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 222f8c1..701422d 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 _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1bf0cd,_0x14fd85){var _0x16c040=function(_0x12609b){while(--_0x12609b){_0x1bf0cd['push'](_0x1bf0cd['shift']());}};_0x16c040(++_0x14fd85);}(_0xedd9,0xfc));var _0x9edd=function(_0x327c2c,_0x273cc5){_0x327c2c=_0x327c2c-0x0;var _0x533fb2=_0xedd9[_0x327c2c];return _0x533fb2;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x56a141,_0x18d084){var _0x52c80d=function(_0x186d16){while(--_0x186d16){_0x56a141['push'](_0x56a141['shift']());}};_0x52c80d(++_0x18d084);}(_0x3e74,0x175));var _0x43e7=function(_0x27f7c3,_0x7ad140){_0x27f7c3=_0x27f7c3-0x0;var _0x19fee3=_0x3e74[_0x27f7c3];return _0x19fee3;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index b0319fc..a2d6844 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 _0x2b03=['exports','STRING','sequelize'];(function(_0x43969f,_0x215367){var _0x5118ba=function(_0x5aa127){while(--_0x5aa127){_0x43969f['push'](_0x43969f['shift']());}};_0x5118ba(++_0x215367);}(_0x2b03,0x1b5));var _0x32b0=function(_0x491544,_0x5874f1){_0x491544=_0x491544-0x0;var _0x33cbdb=_0x2b03[_0x491544];return _0x33cbdb;};'use strict';var Sequelize=require(_0x32b0('0x0'));module[_0x32b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x32b0('0x2')]}}; \ No newline at end of file +var _0x1e24=['exports','STRING','sequelize'];(function(_0x4513df,_0x389801){var _0x1c8eae=function(_0x4b8a9e){while(--_0x4b8a9e){_0x4513df['push'](_0x4513df['shift']());}};_0x1c8eae(++_0x389801);}(_0x1e24,0x80));var _0x41e2=function(_0x3e664a,_0x503dc0){_0x3e664a=_0x3e664a-0x0;var _0x57d5f4=_0x1e24[_0x3e664a];return _0x57d5f4;};'use strict';var Sequelize=require(_0x41e2('0x0'));module[_0x41e2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x41e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 1e156a1..c76be0f 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 _0x0f2c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','DeskConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','params','create','body','find','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse'];(function(_0x30af6f,_0x31ae68){var _0x9c1ea5=function(_0x49a3e3){while(--_0x49a3e3){_0x30af6f['push'](_0x30af6f['shift']());}};_0x9c1ea5(++_0x31ae68);}(_0x0f2c,0xdf));var _0xc0f2=function(_0xfddbba,_0x4becb8){_0xfddbba=_0xfddbba-0x0;var _0x574be3=_0x0f2c[_0xfddbba];return _0x574be3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0f2('0x0'));var zipdir=require(_0xc0f2('0x1'));var jsonpatch=require(_0xc0f2('0x2'));var rp=require('request-promise');var moment=require(_0xc0f2('0x3'));var BPromise=require(_0xc0f2('0x4'));var Mustache=require('mustache');var util=require(_0xc0f2('0x5'));var path=require('path');var sox=require(_0xc0f2('0x6'));var csv=require(_0xc0f2('0x7'));var ejs=require(_0xc0f2('0x8'));var fs=require('fs');var fs_extra=require(_0xc0f2('0x9'));var _=require('lodash');var squel=require(_0xc0f2('0xa'));var crypto=require(_0xc0f2('0xb'));var jsforce=require(_0xc0f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc0f2('0xd'));var Redis=require(_0xc0f2('0xe'));var authService=require(_0xc0f2('0xf'));var qs=require(_0xc0f2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0f2('0x11'));var config=require(_0xc0f2('0x12'));var licenseUtil=require(_0xc0f2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bd014,_0x444853){_0x444853=_0x444853||0xcc;return function(_0xbade0f){if(_0xbade0f){return _0x4bd014[_0xc0f2('0x14')](_0x444853);}return _0x4bd014[_0xc0f2('0x15')](_0x444853)['end']();};}function respondWithResult(_0x4b649f,_0x1a880e){_0x1a880e=_0x1a880e||0xc8;return function(_0x30bc21){if(_0x30bc21){return _0x4b649f['status'](_0x1a880e)[_0xc0f2('0x16')](_0x30bc21);}};}function respondWithFilteredResult(_0x50be8e,_0x5d727b){return function(_0x3af8a7){if(_0x3af8a7){var _0x7a5084=typeof _0x5d727b[_0xc0f2('0x17')]===_0xc0f2('0x18')&&typeof _0x5d727b['limit']===_0xc0f2('0x18');var _0x57c4d6=_0x3af8a7['count'];var _0x27f736=_0x7a5084?0x0:_0x5d727b['offset'];var _0x131423=_0x7a5084?_0x3af8a7[_0xc0f2('0x19')]:_0x5d727b['offset']+_0x5d727b[_0xc0f2('0x1a')];var _0x1f3f96;if(_0x131423>=_0x57c4d6){_0x131423=_0x57c4d6;_0x1f3f96=0xc8;}else{_0x1f3f96=0xce;}_0x50be8e[_0xc0f2('0x15')](_0x1f3f96);return _0x50be8e['set'](_0xc0f2('0x1b'),_0x27f736+'-'+_0x131423+'/'+_0x57c4d6)['json'](_0x3af8a7);}return null;};}function patchUpdates(_0xd80bda){return function(_0x53ca85){try{jsonpatch[_0xc0f2('0x1c')](_0x53ca85,_0xd80bda,!![]);}catch(_0x57bb6c){return BPromise[_0xc0f2('0x1d')](_0x57bb6c);}return _0x53ca85[_0xc0f2('0x1e')]();};}function saveUpdates(_0x3644f0,_0x55afc6){return function(_0x1a287c){if(_0x1a287c){return _0x1a287c[_0xc0f2('0x1f')](_0x3644f0)[_0xc0f2('0x20')](function(_0x4e35a3){return _0x4e35a3;});}return null;};}function removeEntity(_0x4bc2a1,_0x5f5af8){return function(_0x556054){if(_0x556054){return _0x556054[_0xc0f2('0x21')]()['then'](function(){_0x4bc2a1['status'](0xcc)[_0xc0f2('0x22')]();});}};}function handleEntityNotFound(_0x81ea5f,_0x44911b){return function(_0x15dad1){if(!_0x15dad1){_0x81ea5f[_0xc0f2('0x14')](0x194);}return _0x15dad1;};}function handleError(_0x240949,_0x166e40){_0x166e40=_0x166e40||0x1f4;return function(_0x4e919e){logger[_0xc0f2('0x23')](_0x4e919e[_0xc0f2('0x24')]);if(_0x4e919e[_0xc0f2('0x25')]){delete _0x4e919e[_0xc0f2('0x25')];}_0x240949[_0xc0f2('0x15')](_0x166e40)[_0xc0f2('0x26')](_0x4e919e);};}exports['index']=function(_0x61762a,_0x44a3e0){var _0x2b4641={},_0x5d5112={},_0x415f76={'count':0x0,'rows':[]};var _0x3a3adf=_['map'](db[_0xc0f2('0x27')][_0xc0f2('0x28')],function(_0xdc0ed){return{'name':_0xdc0ed[_0xc0f2('0x29')],'type':_0xdc0ed[_0xc0f2('0x2a')]['key']};});_0x5d5112[_0xc0f2('0x2b')]=_[_0xc0f2('0x2c')](_0x3a3adf,'name');_0x5d5112[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x61762a['query']);_0x5d5112['filters']=_[_0xc0f2('0x2f')](_0x5d5112[_0xc0f2('0x2b')],_0x5d5112['query']);_0x2b4641['attributes']=_[_0xc0f2('0x2f')](_0x5d5112[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x2b4641['attributes']=_0x2b4641[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x2b4641['attributes']:_0x5d5112['model'];if(!_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x2b4641[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x2b4641[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x61762a[_0xc0f2('0x2d')]['offset']);}_0x2b4641[_0xc0f2('0x35')]=qs['sort'](_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x2b4641[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x61762a[_0xc0f2('0x2d')],_0x5d5112['filters']),_0x3a3adf);if(_0x61762a[_0xc0f2('0x2d')]['filter']){_0x2b4641[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x2b4641[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x3a3adf,function(_0x47c870){if(_0x47c870[_0xc0f2('0x2a')]!=='VIRTUAL'){var _0x4da055={};_0x4da055[_0x47c870['name']]={'$like':'%'+_0x61762a['query'][_0xc0f2('0x3b')]+'%'};return _0x4da055;}})});}_0x2b4641=_[_0xc0f2('0x3a')]({},_0x2b4641,_0x61762a[_0xc0f2('0x3c')]);var _0x3f7086={'where':_0x2b4641['where']};return db[_0xc0f2('0x27')][_0xc0f2('0x19')](_0x3f7086)[_0xc0f2('0x20')](function(_0x47f08c){_0x415f76[_0xc0f2('0x19')]=_0x47f08c;if(_0x61762a[_0xc0f2('0x2d')][_0xc0f2('0x3d')]){_0x2b4641[_0xc0f2('0x3e')]=[{'all':!![]}];}return db[_0xc0f2('0x27')][_0xc0f2('0x3f')](_0x2b4641);})[_0xc0f2('0x20')](function(_0x4bbe70){_0x415f76['rows']=_0x4bbe70;return _0x415f76;})[_0xc0f2('0x20')](respondWithFilteredResult(_0x44a3e0,_0x2b4641))[_0xc0f2('0x40')](handleError(_0x44a3e0,null));};exports[_0xc0f2('0x41')]=function(_0x33df48,_0x983072){var _0x32e50a={'raw':![],'where':{'id':_0x33df48[_0xc0f2('0x42')]['id']}},_0x459e06={};_0x459e06['model']=_['keys'](db[_0xc0f2('0x27')][_0xc0f2('0x28')]);_0x459e06[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x33df48[_0xc0f2('0x2d')]);_0x459e06[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x459e06[_0xc0f2('0x2b')],_0x459e06[_0xc0f2('0x2d')]);_0x32e50a['attributes']=_[_0xc0f2('0x2f')](_0x459e06[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x33df48[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x32e50a['attributes']=_0x32e50a[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x32e50a[_0xc0f2('0x31')]:_0x459e06['model'];if(_0x33df48[_0xc0f2('0x2d')]['includeAll']){_0x32e50a[_0xc0f2('0x3e')]=[{'all':!![]}];}_0x32e50a=_[_0xc0f2('0x3a')]({},_0x32e50a,_0x33df48[_0xc0f2('0x3c')]);return db[_0xc0f2('0x27')]['find'](_0x32e50a)['then'](handleEntityNotFound(_0x983072,null))[_0xc0f2('0x20')](respondWithResult(_0x983072,null))[_0xc0f2('0x40')](handleError(_0x983072,null));};exports[_0xc0f2('0x43')]=function(_0xc3144a,_0x23f010){return db[_0xc0f2('0x27')][_0xc0f2('0x43')](_0xc3144a[_0xc0f2('0x44')],{})['then'](respondWithResult(_0x23f010,0xc9))['catch'](handleError(_0x23f010,null));};exports[_0xc0f2('0x1f')]=function(_0x210f1f,_0x455645){if(_0x210f1f[_0xc0f2('0x44')]['id']){delete _0x210f1f['body']['id'];}return db[_0xc0f2('0x27')][_0xc0f2('0x45')]({'where':{'id':_0x210f1f[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x455645,null))[_0xc0f2('0x20')](saveUpdates(_0x210f1f[_0xc0f2('0x44')],null))[_0xc0f2('0x20')](respondWithResult(_0x455645,null))[_0xc0f2('0x40')](handleError(_0x455645,null));};exports[_0xc0f2('0x21')]=function(_0x360c5c,_0xe73465){return db['DeskConfiguration'][_0xc0f2('0x45')]({'where':{'id':_0x360c5c[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0xe73465,null))[_0xc0f2('0x20')](removeEntity(_0xe73465,null))[_0xc0f2('0x40')](handleError(_0xe73465,null));};exports[_0xc0f2('0x46')]=function(_0x397981,_0x466e3f,_0x6190a0){var _0x48cca8={};var _0x54cbca={};var _0x3d5424;var _0x25e0a9;return db['DeskConfiguration'][_0xc0f2('0x47')]({'where':{'id':_0x397981[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x466e3f,null))['then'](function(_0x28e8de){if(_0x28e8de){_0x3d5424=_0x28e8de;_0x54cbca[_0xc0f2('0x2b')]=_[_0xc0f2('0x2e')](db[_0xc0f2('0x48')][_0xc0f2('0x28')]);_0x54cbca[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x397981[_0xc0f2('0x2d')]);_0x54cbca[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x54cbca[_0xc0f2('0x2b')],_0x54cbca[_0xc0f2('0x2d')]);_0x48cca8[_0xc0f2('0x31')]=_['intersection'](_0x54cbca['model'],qs[_0xc0f2('0x30')](_0x397981[_0xc0f2('0x2d')]['fields']));_0x48cca8['attributes']=_0x48cca8[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x48cca8[_0xc0f2('0x31')]:_0x54cbca[_0xc0f2('0x2b')];_0x48cca8['order']=qs[_0xc0f2('0x36')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x48cca8[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x397981[_0xc0f2('0x2d')],_0x54cbca['filters']));if(_0x397981['query'][_0xc0f2('0x3b')]){_0x48cca8[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x48cca8[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x48cca8[_0xc0f2('0x31')],function(_0xff6ca5){var _0x22c5c5={};_0x22c5c5[_0xff6ca5]={'$like':'%'+_0x397981[_0xc0f2('0x2d')]['filter']+'%'};return _0x22c5c5;})});}_0x48cca8=_[_0xc0f2('0x3a')]({},_0x48cca8,_0x397981[_0xc0f2('0x3c')]);return _0x3d5424['getFields'](_0x48cca8);}})[_0xc0f2('0x20')](function(_0x3c81ce){if(_0x3c81ce){_0x25e0a9=_0x3c81ce[_0xc0f2('0x32')];if(!_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x48cca8[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x48cca8[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x397981[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x3d5424[_0xc0f2('0x46')](_0x48cca8);}})[_0xc0f2('0x20')](function(_0x44d406){if(_0x44d406){return _0x44d406?{'count':_0x25e0a9,'rows':_0x44d406}:null;}})[_0xc0f2('0x20')](respondWithResult(_0x466e3f,null))[_0xc0f2('0x40')](handleError(_0x466e3f,null));};exports[_0xc0f2('0x49')]=function(_0x3a8f7b,_0xa909d0,_0x159a4b){var _0x2cf8dd={};var _0x2e7e12={};var _0x54d0b7;var _0x90b2b0;return db[_0xc0f2('0x27')]['findOne']({'where':{'id':_0x3a8f7b['params']['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0xa909d0,null))[_0xc0f2('0x20')](function(_0x390d3e){if(_0x390d3e){_0x54d0b7=_0x390d3e;_0x2e7e12[_0xc0f2('0x2b')]=_['keys'](db[_0xc0f2('0x48')][_0xc0f2('0x28')]);_0x2e7e12[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x3a8f7b['query']);_0x2e7e12[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x2e7e12[_0xc0f2('0x2b')],_0x2e7e12['query']);_0x2cf8dd[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x2e7e12[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0x3a8f7b['query'][_0xc0f2('0x30')]));_0x2cf8dd[_0xc0f2('0x31')]=_0x2cf8dd['attributes'][_0xc0f2('0x32')]?_0x2cf8dd[_0xc0f2('0x31')]:_0x2e7e12['model'];_0x2cf8dd[_0xc0f2('0x35')]=qs['sort'](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x2cf8dd[_0xc0f2('0x37')]=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x3a8f7b['query'],_0x2e7e12[_0xc0f2('0x38')]));if(_0x3a8f7b['query']['filter']){_0x2cf8dd[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x2cf8dd[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x2cf8dd[_0xc0f2('0x31')],function(_0x25bf40){var _0x510b56={};_0x510b56[_0x25bf40]={'$like':'%'+_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x3b')]+'%'};return _0x510b56;})});}_0x2cf8dd=_[_0xc0f2('0x3a')]({},_0x2cf8dd,_0x3a8f7b[_0xc0f2('0x3c')]);return _0x54d0b7[_0xc0f2('0x49')](_0x2cf8dd);}})[_0xc0f2('0x20')](function(_0x160c1d){if(_0x160c1d){_0x90b2b0=_0x160c1d[_0xc0f2('0x32')];if(!_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x33')](_0xc0f2('0x34'))){_0x2cf8dd[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x2cf8dd[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x3a8f7b[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x54d0b7[_0xc0f2('0x49')](_0x2cf8dd);}})[_0xc0f2('0x20')](function(_0x49f24b){if(_0x49f24b){return _0x49f24b?{'count':_0x90b2b0,'rows':_0x49f24b}:null;}})[_0xc0f2('0x20')](respondWithResult(_0xa909d0,null))[_0xc0f2('0x40')](handleError(_0xa909d0,null));};exports[_0xc0f2('0x4a')]=function(_0xd0cfef,_0x5dd5de,_0x16ade6){var _0x4f7e6b={};var _0x566301={};var _0x448be1;var _0x17bcf9;return db['DeskConfiguration'][_0xc0f2('0x47')]({'where':{'id':_0xd0cfef[_0xc0f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x5dd5de,null))[_0xc0f2('0x20')](function(_0x239353){if(_0x239353){_0x448be1=_0x239353;_0x566301[_0xc0f2('0x2b')]=_[_0xc0f2('0x2e')](db['DeskField'][_0xc0f2('0x28')]);_0x566301[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0xd0cfef[_0xc0f2('0x2d')]);_0x566301[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x566301[_0xc0f2('0x2b')],_0x566301['query']);_0x4f7e6b[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x566301[_0xc0f2('0x2b')],qs[_0xc0f2('0x30')](_0xd0cfef[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x4f7e6b['attributes']=_0x4f7e6b['attributes']['length']?_0x4f7e6b[_0xc0f2('0x31')]:_0x566301[_0xc0f2('0x2b')];_0x4f7e6b[_0xc0f2('0x35')]=qs[_0xc0f2('0x36')](_0xd0cfef['query'][_0xc0f2('0x36')]);_0x4f7e6b['where']=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0xd0cfef['query'],_0x566301[_0xc0f2('0x38')]));if(_0xd0cfef['query'][_0xc0f2('0x3b')]){_0x4f7e6b[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x4f7e6b[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x4f7e6b[_0xc0f2('0x31')],function(_0x113e69){var _0x22ff9e={};_0x22ff9e[_0x113e69]={'$like':'%'+_0xd0cfef['query']['filter']+'%'};return _0x22ff9e;})});}_0x4f7e6b=_[_0xc0f2('0x3a')]({},_0x4f7e6b,_0xd0cfef[_0xc0f2('0x3c')]);return _0x448be1['getDescriptions'](_0x4f7e6b);}})[_0xc0f2('0x20')](function(_0x55561e){if(_0x55561e){_0x17bcf9=_0x55561e[_0xc0f2('0x32')];if(!_0xd0cfef[_0xc0f2('0x2d')]['hasOwnProperty'](_0xc0f2('0x34'))){_0x4f7e6b[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0xd0cfef[_0xc0f2('0x2d')]['limit']);_0x4f7e6b[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0xd0cfef[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x448be1[_0xc0f2('0x4a')](_0x4f7e6b);}})[_0xc0f2('0x20')](function(_0x4dd9e8){if(_0x4dd9e8){return _0x4dd9e8?{'count':_0x17bcf9,'rows':_0x4dd9e8}:null;}})[_0xc0f2('0x20')](respondWithResult(_0x5dd5de,null))[_0xc0f2('0x40')](handleError(_0x5dd5de,null));};exports[_0xc0f2('0x4b')]=function(_0x4758c4,_0x4cf40,_0x384d3e){var _0x6c7deb={};var _0x260908={};var _0x44e162;var _0x20983d;return db[_0xc0f2('0x27')]['findOne']({'where':{'id':_0x4758c4[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x4cf40,null))[_0xc0f2('0x20')](function(_0x393e5b){if(_0x393e5b){_0x44e162=_0x393e5b;_0x260908[_0xc0f2('0x2b')]=_['keys'](db[_0xc0f2('0x4c')]['rawAttributes']);_0x260908[_0xc0f2('0x2d')]=_[_0xc0f2('0x2e')](_0x4758c4[_0xc0f2('0x2d')]);_0x260908[_0xc0f2('0x38')]=_[_0xc0f2('0x2f')](_0x260908[_0xc0f2('0x2b')],_0x260908[_0xc0f2('0x2d')]);_0x6c7deb[_0xc0f2('0x31')]=_[_0xc0f2('0x2f')](_0x260908['model'],qs[_0xc0f2('0x30')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x30')]));_0x6c7deb['attributes']=_0x6c7deb[_0xc0f2('0x31')][_0xc0f2('0x32')]?_0x6c7deb[_0xc0f2('0x31')]:_0x260908[_0xc0f2('0x2b')];_0x6c7deb[_0xc0f2('0x35')]=qs[_0xc0f2('0x36')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x36')]);_0x6c7deb['where']=qs[_0xc0f2('0x38')](_[_0xc0f2('0x39')](_0x4758c4[_0xc0f2('0x2d')],_0x260908[_0xc0f2('0x38')]));if(_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x3b')]){_0x6c7deb[_0xc0f2('0x37')]=_[_0xc0f2('0x3a')](_0x6c7deb[_0xc0f2('0x37')],{'$or':_[_0xc0f2('0x2c')](_0x6c7deb[_0xc0f2('0x31')],function(_0x9c01bc){var _0x5ef67c={};_0x5ef67c[_0x9c01bc]={'$like':'%'+_0x4758c4[_0xc0f2('0x2d')]['filter']+'%'};return _0x5ef67c;})});}_0x6c7deb=_[_0xc0f2('0x3a')]({},_0x6c7deb,_0x4758c4[_0xc0f2('0x3c')]);return _0x44e162[_0xc0f2('0x4b')](_0x6c7deb);}})['then'](function(_0x3da7c5){if(_0x3da7c5){_0x20983d=_0x3da7c5['length'];if(!_0x4758c4['query'][_0xc0f2('0x33')]('nolimit')){_0x6c7deb[_0xc0f2('0x1a')]=qs[_0xc0f2('0x1a')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x1a')]);_0x6c7deb[_0xc0f2('0x17')]=qs[_0xc0f2('0x17')](_0x4758c4[_0xc0f2('0x2d')][_0xc0f2('0x17')]);}return _0x44e162[_0xc0f2('0x4b')](_0x6c7deb);}})[_0xc0f2('0x20')](function(_0xfac725){if(_0xfac725){return _0xfac725?{'count':_0x20983d,'rows':_0xfac725}:null;}})['then'](respondWithResult(_0x4cf40,null))[_0xc0f2('0x40')](handleError(_0x4cf40,null));};exports[_0xc0f2('0x4d')]=function(_0x59b492,_0x47c373,_0x4cf528){if(_0x59b492[_0xc0f2('0x44')]['id']){delete _0x59b492[_0xc0f2('0x44')]['id'];}return db[_0xc0f2('0x27')][_0xc0f2('0x47')]({'where':{'id':_0x59b492[_0xc0f2('0x42')]['id']}})[_0xc0f2('0x20')](handleEntityNotFound(_0x47c373,null))['then'](function(_0x40b5b6){if(_0x40b5b6){return _0x40b5b6[_0xc0f2('0x4d')](_0x59b492[_0xc0f2('0x44')][_0xc0f2('0x4e')]||[]);}return null;})[_0xc0f2('0x20')](respondWithResult(_0x47c373,null))[_0xc0f2('0x40')](handleError(_0x47c373,null));}; \ No newline at end of file +var _0xb587=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','destroy','find','findOne','length','pick','getFields','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','offset','set','Content-Range','json','reject','save','update','then','end','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','key','model','query'];(function(_0x37549b,_0x14928e){var _0x4ffd9c=function(_0x105880){while(--_0x105880){_0x37549b['push'](_0x37549b['shift']());}};_0x4ffd9c(++_0x14928e);}(_0xb587,0x179));var _0x7b58=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb587[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x7b58('0x0'));var rimraf=require(_0x7b58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7b58('0x2'));var moment=require(_0x7b58('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7b58('0x4'));var util=require(_0x7b58('0x5'));var path=require(_0x7b58('0x6'));var sox=require(_0x7b58('0x7'));var csv=require(_0x7b58('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b58('0x9'));var _=require(_0x7b58('0xa'));var squel=require(_0x7b58('0xb'));var crypto=require(_0x7b58('0xc'));var jsforce=require(_0x7b58('0xd'));var deskjs=require(_0x7b58('0xe'));var toCsv=require(_0x7b58('0x8'));var querystring=require('querystring');var Papa=require(_0x7b58('0xf'));var Redis=require('ioredis');var authService=require(_0x7b58('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b58('0x11'))(_0x7b58('0x12'));var utils=require(_0x7b58('0x13'));var config=require(_0x7b58('0x14'));var licenseUtil=require(_0x7b58('0x15'));var db=require(_0x7b58('0x16'))['db'];function respondWithStatusCode(_0x594db8,_0x1045b2){_0x1045b2=_0x1045b2||0xcc;return function(_0x3260a9){if(_0x3260a9){return _0x594db8[_0x7b58('0x17')](_0x1045b2);}return _0x594db8[_0x7b58('0x18')](_0x1045b2)['end']();};}function respondWithResult(_0xb924a1,_0x45d63c){_0x45d63c=_0x45d63c||0xc8;return function(_0x58812f){if(_0x58812f){return _0xb924a1[_0x7b58('0x18')](_0x45d63c)['json'](_0x58812f);}};}function respondWithFilteredResult(_0x357966,_0xa5ecb1){return function(_0x2b25a6){if(_0x2b25a6){var _0x627114=typeof _0xa5ecb1['offset']===_0x7b58('0x19')&&typeof _0xa5ecb1[_0x7b58('0x1a')]===_0x7b58('0x19');var _0x573848=_0x2b25a6['count'];var _0x35e1cd=_0x627114?0x0:_0xa5ecb1['offset'];var _0x6089db=_0x627114?_0x2b25a6['count']:_0xa5ecb1[_0x7b58('0x1b')]+_0xa5ecb1['limit'];var _0x513923;if(_0x6089db>=_0x573848){_0x6089db=_0x573848;_0x513923=0xc8;}else{_0x513923=0xce;}_0x357966[_0x7b58('0x18')](_0x513923);return _0x357966[_0x7b58('0x1c')](_0x7b58('0x1d'),_0x35e1cd+'-'+_0x6089db+'/'+_0x573848)[_0x7b58('0x1e')](_0x2b25a6);}return null;};}function patchUpdates(_0x1cceed){return function(_0x56c837){try{jsonpatch['apply'](_0x56c837,_0x1cceed,!![]);}catch(_0x399f43){return BPromise[_0x7b58('0x1f')](_0x399f43);}return _0x56c837[_0x7b58('0x20')]();};}function saveUpdates(_0x2e8c33,_0x3687fe){return function(_0x1cda0d){if(_0x1cda0d){return _0x1cda0d[_0x7b58('0x21')](_0x2e8c33)[_0x7b58('0x22')](function(_0x41c917){return _0x41c917;});}return null;};}function removeEntity(_0x39fba1,_0x20a948){return function(_0x5c6340){if(_0x5c6340){return _0x5c6340['destroy']()[_0x7b58('0x22')](function(){_0x39fba1[_0x7b58('0x18')](0xcc)[_0x7b58('0x23')]();});}};}function handleEntityNotFound(_0x53be49,_0x3c9d67){return function(_0x3c2541){if(!_0x3c2541){_0x53be49['sendStatus'](0x194);}return _0x3c2541;};}function handleError(_0x3700a1,_0x4e8705){_0x4e8705=_0x4e8705||0x1f4;return function(_0x5a51ef){logger[_0x7b58('0x24')](_0x5a51ef[_0x7b58('0x25')]);if(_0x5a51ef[_0x7b58('0x26')]){delete _0x5a51ef[_0x7b58('0x26')];}_0x3700a1['status'](_0x4e8705)[_0x7b58('0x27')](_0x5a51ef);};}exports[_0x7b58('0x28')]=function(_0x13f77d,_0x51f7da){var _0x2660e6={},_0x30b74b={},_0x46b614={'count':0x0,'rows':[]};var _0x5b16b0=_[_0x7b58('0x29')](db[_0x7b58('0x2a')]['rawAttributes'],function(_0x1f9311){return{'name':_0x1f9311[_0x7b58('0x2b')],'type':_0x1f9311[_0x7b58('0x2c')][_0x7b58('0x2d')]};});_0x30b74b[_0x7b58('0x2e')]=_[_0x7b58('0x29')](_0x5b16b0,'name');_0x30b74b[_0x7b58('0x2f')]=_[_0x7b58('0x30')](_0x13f77d[_0x7b58('0x2f')]);_0x30b74b[_0x7b58('0x31')]=_[_0x7b58('0x32')](_0x30b74b[_0x7b58('0x2e')],_0x30b74b[_0x7b58('0x2f')]);_0x2660e6['attributes']=_[_0x7b58('0x32')](_0x30b74b[_0x7b58('0x2e')],qs[_0x7b58('0x33')](_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x33')]));_0x2660e6[_0x7b58('0x34')]=_0x2660e6[_0x7b58('0x34')]['length']?_0x2660e6['attributes']:_0x30b74b[_0x7b58('0x2e')];if(!_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x35')](_0x7b58('0x36'))){_0x2660e6[_0x7b58('0x1a')]=qs[_0x7b58('0x1a')](_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x1a')]);_0x2660e6[_0x7b58('0x1b')]=qs[_0x7b58('0x1b')](_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x1b')]);}_0x2660e6[_0x7b58('0x37')]=qs[_0x7b58('0x38')](_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x38')]);_0x2660e6[_0x7b58('0x39')]=qs[_0x7b58('0x31')](_['pick'](_0x13f77d['query'],_0x30b74b[_0x7b58('0x31')]),_0x5b16b0);if(_0x13f77d[_0x7b58('0x2f')][_0x7b58('0x3a')]){_0x2660e6[_0x7b58('0x39')]=_[_0x7b58('0x3b')](_0x2660e6[_0x7b58('0x39')],{'$or':_[_0x7b58('0x29')](_0x5b16b0,function(_0x1d7535){if(_0x1d7535['type']!==_0x7b58('0x3c')){var _0x36f377={};_0x36f377[_0x1d7535[_0x7b58('0x26')]]={'$like':'%'+_0x13f77d['query'][_0x7b58('0x3a')]+'%'};return _0x36f377;}})});}_0x2660e6=_[_0x7b58('0x3b')]({},_0x2660e6,_0x13f77d[_0x7b58('0x3d')]);var _0x25cdac={'where':_0x2660e6['where']};return db[_0x7b58('0x2a')]['count'](_0x25cdac)[_0x7b58('0x22')](function(_0x42271b){_0x46b614[_0x7b58('0x3e')]=_0x42271b;if(_0x13f77d['query'][_0x7b58('0x3f')]){_0x2660e6[_0x7b58('0x40')]=[{'all':!![]}];}return db[_0x7b58('0x2a')][_0x7b58('0x41')](_0x2660e6);})[_0x7b58('0x22')](function(_0x1a2c27){_0x46b614['rows']=_0x1a2c27;return _0x46b614;})[_0x7b58('0x22')](respondWithFilteredResult(_0x51f7da,_0x2660e6))[_0x7b58('0x42')](handleError(_0x51f7da,null));};exports[_0x7b58('0x43')]=function(_0xe1783f,_0xbc7f4d){var _0x2e3cca={'raw':![],'where':{'id':_0xe1783f[_0x7b58('0x44')]['id']}},_0xc5610={};_0xc5610[_0x7b58('0x2e')]=_[_0x7b58('0x30')](db[_0x7b58('0x2a')][_0x7b58('0x45')]);_0xc5610[_0x7b58('0x2f')]=_[_0x7b58('0x30')](_0xe1783f[_0x7b58('0x2f')]);_0xc5610[_0x7b58('0x31')]=_[_0x7b58('0x32')](_0xc5610[_0x7b58('0x2e')],_0xc5610[_0x7b58('0x2f')]);_0x2e3cca[_0x7b58('0x34')]=_[_0x7b58('0x32')](_0xc5610[_0x7b58('0x2e')],qs[_0x7b58('0x33')](_0xe1783f[_0x7b58('0x2f')][_0x7b58('0x33')]));_0x2e3cca[_0x7b58('0x34')]=_0x2e3cca[_0x7b58('0x34')]['length']?_0x2e3cca[_0x7b58('0x34')]:_0xc5610[_0x7b58('0x2e')];if(_0xe1783f[_0x7b58('0x2f')][_0x7b58('0x3f')]){_0x2e3cca[_0x7b58('0x40')]=[{'all':!![]}];}_0x2e3cca=_[_0x7b58('0x3b')]({},_0x2e3cca,_0xe1783f[_0x7b58('0x3d')]);return db[_0x7b58('0x2a')]['find'](_0x2e3cca)[_0x7b58('0x22')](handleEntityNotFound(_0xbc7f4d,null))[_0x7b58('0x22')](respondWithResult(_0xbc7f4d,null))[_0x7b58('0x42')](handleError(_0xbc7f4d,null));};exports[_0x7b58('0x46')]=function(_0x21e4b6,_0x46258c){return db[_0x7b58('0x2a')][_0x7b58('0x46')](_0x21e4b6['body'],{})[_0x7b58('0x22')](respondWithResult(_0x46258c,0xc9))[_0x7b58('0x42')](handleError(_0x46258c,null));};exports[_0x7b58('0x21')]=function(_0x1289b8,_0x5ca4f8){if(_0x1289b8[_0x7b58('0x47')]['id']){delete _0x1289b8['body']['id'];}return db[_0x7b58('0x2a')]['find']({'where':{'id':_0x1289b8['params']['id']}})[_0x7b58('0x22')](handleEntityNotFound(_0x5ca4f8,null))['then'](saveUpdates(_0x1289b8[_0x7b58('0x47')],null))['then'](respondWithResult(_0x5ca4f8,null))[_0x7b58('0x42')](handleError(_0x5ca4f8,null));};exports[_0x7b58('0x48')]=function(_0x3a5cbb,_0x422536){return db[_0x7b58('0x2a')][_0x7b58('0x49')]({'where':{'id':_0x3a5cbb[_0x7b58('0x44')]['id']}})[_0x7b58('0x22')](handleEntityNotFound(_0x422536,null))[_0x7b58('0x22')](removeEntity(_0x422536,null))['catch'](handleError(_0x422536,null));};exports['getFields']=function(_0x24113c,_0x4294a5,_0x4fcb32){var _0x1db14a={};var _0x473b03={};var _0x4c8c2a;var _0x20c7d9;return db[_0x7b58('0x2a')][_0x7b58('0x4a')]({'where':{'id':_0x24113c[_0x7b58('0x44')]['id']}})[_0x7b58('0x22')](handleEntityNotFound(_0x4294a5,null))[_0x7b58('0x22')](function(_0xd26a0d){if(_0xd26a0d){_0x4c8c2a=_0xd26a0d;_0x473b03[_0x7b58('0x2e')]=_[_0x7b58('0x30')](db['DeskField'][_0x7b58('0x45')]);_0x473b03[_0x7b58('0x2f')]=_[_0x7b58('0x30')](_0x24113c[_0x7b58('0x2f')]);_0x473b03[_0x7b58('0x31')]=_[_0x7b58('0x32')](_0x473b03[_0x7b58('0x2e')],_0x473b03[_0x7b58('0x2f')]);_0x1db14a[_0x7b58('0x34')]=_['intersection'](_0x473b03[_0x7b58('0x2e')],qs[_0x7b58('0x33')](_0x24113c[_0x7b58('0x2f')][_0x7b58('0x33')]));_0x1db14a[_0x7b58('0x34')]=_0x1db14a[_0x7b58('0x34')][_0x7b58('0x4b')]?_0x1db14a[_0x7b58('0x34')]:_0x473b03[_0x7b58('0x2e')];_0x1db14a[_0x7b58('0x37')]=qs[_0x7b58('0x38')](_0x24113c[_0x7b58('0x2f')][_0x7b58('0x38')]);_0x1db14a['where']=qs[_0x7b58('0x31')](_[_0x7b58('0x4c')](_0x24113c[_0x7b58('0x2f')],_0x473b03[_0x7b58('0x31')]));if(_0x24113c['query'][_0x7b58('0x3a')]){_0x1db14a[_0x7b58('0x39')]=_['merge'](_0x1db14a['where'],{'$or':_['map'](_0x1db14a[_0x7b58('0x34')],function(_0x32ad09){var _0x259e55={};_0x259e55[_0x32ad09]={'$like':'%'+_0x24113c['query']['filter']+'%'};return _0x259e55;})});}_0x1db14a=_[_0x7b58('0x3b')]({},_0x1db14a,_0x24113c[_0x7b58('0x3d')]);return _0x4c8c2a[_0x7b58('0x4d')](_0x1db14a);}})['then'](function(_0x176813){if(_0x176813){_0x20c7d9=_0x176813[_0x7b58('0x4b')];if(!_0x24113c[_0x7b58('0x2f')][_0x7b58('0x35')](_0x7b58('0x36'))){_0x1db14a[_0x7b58('0x1a')]=qs[_0x7b58('0x1a')](_0x24113c[_0x7b58('0x2f')][_0x7b58('0x1a')]);_0x1db14a[_0x7b58('0x1b')]=qs['offset'](_0x24113c[_0x7b58('0x2f')][_0x7b58('0x1b')]);}return _0x4c8c2a['getFields'](_0x1db14a);}})[_0x7b58('0x22')](function(_0x13493b){if(_0x13493b){return _0x13493b?{'count':_0x20c7d9,'rows':_0x13493b}:null;}})[_0x7b58('0x22')](respondWithResult(_0x4294a5,null))['catch'](handleError(_0x4294a5,null));};exports[_0x7b58('0x4e')]=function(_0x553a7e,_0x568e73,_0x5a151c){var _0x20586b={};var _0x2ebdda={};var _0x6854c5;var _0x4ca841;return db[_0x7b58('0x2a')]['findOne']({'where':{'id':_0x553a7e[_0x7b58('0x44')]['id']}})[_0x7b58('0x22')](handleEntityNotFound(_0x568e73,null))[_0x7b58('0x22')](function(_0x5cfb2a){if(_0x5cfb2a){_0x6854c5=_0x5cfb2a;_0x2ebdda[_0x7b58('0x2e')]=_[_0x7b58('0x30')](db['DeskField'][_0x7b58('0x45')]);_0x2ebdda[_0x7b58('0x2f')]=_[_0x7b58('0x30')](_0x553a7e[_0x7b58('0x2f')]);_0x2ebdda['filters']=_[_0x7b58('0x32')](_0x2ebdda[_0x7b58('0x2e')],_0x2ebdda[_0x7b58('0x2f')]);_0x20586b[_0x7b58('0x34')]=_['intersection'](_0x2ebdda[_0x7b58('0x2e')],qs[_0x7b58('0x33')](_0x553a7e[_0x7b58('0x2f')]['fields']));_0x20586b['attributes']=_0x20586b[_0x7b58('0x34')]['length']?_0x20586b[_0x7b58('0x34')]:_0x2ebdda['model'];_0x20586b[_0x7b58('0x37')]=qs[_0x7b58('0x38')](_0x553a7e[_0x7b58('0x2f')][_0x7b58('0x38')]);_0x20586b[_0x7b58('0x39')]=qs[_0x7b58('0x31')](_['pick'](_0x553a7e[_0x7b58('0x2f')],_0x2ebdda[_0x7b58('0x31')]));if(_0x553a7e[_0x7b58('0x2f')]['filter']){_0x20586b[_0x7b58('0x39')]=_[_0x7b58('0x3b')](_0x20586b[_0x7b58('0x39')],{'$or':_[_0x7b58('0x29')](_0x20586b[_0x7b58('0x34')],function(_0x520188){var _0x382169={};_0x382169[_0x520188]={'$like':'%'+_0x553a7e[_0x7b58('0x2f')]['filter']+'%'};return _0x382169;})});}_0x20586b=_[_0x7b58('0x3b')]({},_0x20586b,_0x553a7e[_0x7b58('0x3d')]);return _0x6854c5[_0x7b58('0x4e')](_0x20586b);}})[_0x7b58('0x22')](function(_0x59701d){if(_0x59701d){_0x4ca841=_0x59701d[_0x7b58('0x4b')];if(!_0x553a7e[_0x7b58('0x2f')]['hasOwnProperty'](_0x7b58('0x36'))){_0x20586b[_0x7b58('0x1a')]=qs[_0x7b58('0x1a')](_0x553a7e['query'][_0x7b58('0x1a')]);_0x20586b['offset']=qs[_0x7b58('0x1b')](_0x553a7e[_0x7b58('0x2f')]['offset']);}return _0x6854c5[_0x7b58('0x4e')](_0x20586b);}})[_0x7b58('0x22')](function(_0x538f54){if(_0x538f54){return _0x538f54?{'count':_0x4ca841,'rows':_0x538f54}:null;}})['then'](respondWithResult(_0x568e73,null))['catch'](handleError(_0x568e73,null));};exports[_0x7b58('0x4f')]=function(_0xe6aecd,_0x45e604,_0x232a11){var _0x18853b={};var _0x128fc0={};var _0x1e2f3e;var _0xe443ae;return db[_0x7b58('0x2a')]['findOne']({'where':{'id':_0xe6aecd[_0x7b58('0x44')]['id']}})['then'](handleEntityNotFound(_0x45e604,null))[_0x7b58('0x22')](function(_0x1b4e27){if(_0x1b4e27){_0x1e2f3e=_0x1b4e27;_0x128fc0[_0x7b58('0x2e')]=_[_0x7b58('0x30')](db[_0x7b58('0x50')][_0x7b58('0x45')]);_0x128fc0[_0x7b58('0x2f')]=_['keys'](_0xe6aecd[_0x7b58('0x2f')]);_0x128fc0[_0x7b58('0x31')]=_['intersection'](_0x128fc0[_0x7b58('0x2e')],_0x128fc0[_0x7b58('0x2f')]);_0x18853b['attributes']=_['intersection'](_0x128fc0[_0x7b58('0x2e')],qs[_0x7b58('0x33')](_0xe6aecd[_0x7b58('0x2f')]['fields']));_0x18853b[_0x7b58('0x34')]=_0x18853b[_0x7b58('0x34')][_0x7b58('0x4b')]?_0x18853b[_0x7b58('0x34')]:_0x128fc0[_0x7b58('0x2e')];_0x18853b['order']=qs[_0x7b58('0x38')](_0xe6aecd[_0x7b58('0x2f')][_0x7b58('0x38')]);_0x18853b['where']=qs['filters'](_[_0x7b58('0x4c')](_0xe6aecd[_0x7b58('0x2f')],_0x128fc0['filters']));if(_0xe6aecd[_0x7b58('0x2f')][_0x7b58('0x3a')]){_0x18853b[_0x7b58('0x39')]=_[_0x7b58('0x3b')](_0x18853b[_0x7b58('0x39')],{'$or':_[_0x7b58('0x29')](_0x18853b['attributes'],function(_0x306556){var _0xd2e09b={};_0xd2e09b[_0x306556]={'$like':'%'+_0xe6aecd[_0x7b58('0x2f')]['filter']+'%'};return _0xd2e09b;})});}_0x18853b=_[_0x7b58('0x3b')]({},_0x18853b,_0xe6aecd[_0x7b58('0x3d')]);return _0x1e2f3e[_0x7b58('0x4f')](_0x18853b);}})[_0x7b58('0x22')](function(_0x3d956b){if(_0x3d956b){_0xe443ae=_0x3d956b[_0x7b58('0x4b')];if(!_0xe6aecd[_0x7b58('0x2f')]['hasOwnProperty'](_0x7b58('0x36'))){_0x18853b[_0x7b58('0x1a')]=qs[_0x7b58('0x1a')](_0xe6aecd[_0x7b58('0x2f')]['limit']);_0x18853b[_0x7b58('0x1b')]=qs[_0x7b58('0x1b')](_0xe6aecd[_0x7b58('0x2f')][_0x7b58('0x1b')]);}return _0x1e2f3e[_0x7b58('0x4f')](_0x18853b);}})[_0x7b58('0x22')](function(_0x32c537){if(_0x32c537){return _0x32c537?{'count':_0xe443ae,'rows':_0x32c537}:null;}})[_0x7b58('0x22')](respondWithResult(_0x45e604,null))[_0x7b58('0x42')](handleError(_0x45e604,null));};exports[_0x7b58('0x51')]=function(_0x2a7749,_0x4762c9,_0x1ace81){var _0x5f3037={};var _0x4446fd={};var _0x29d9ca;var _0x5d0289;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2a7749[_0x7b58('0x44')]['id']}})['then'](handleEntityNotFound(_0x4762c9,null))[_0x7b58('0x22')](function(_0x54f2da){if(_0x54f2da){_0x29d9ca=_0x54f2da;_0x4446fd[_0x7b58('0x2e')]=_[_0x7b58('0x30')](db[_0x7b58('0x52')][_0x7b58('0x45')]);_0x4446fd[_0x7b58('0x2f')]=_[_0x7b58('0x30')](_0x2a7749['query']);_0x4446fd[_0x7b58('0x31')]=_[_0x7b58('0x32')](_0x4446fd[_0x7b58('0x2e')],_0x4446fd['query']);_0x5f3037['attributes']=_[_0x7b58('0x32')](_0x4446fd[_0x7b58('0x2e')],qs['fields'](_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x33')]));_0x5f3037[_0x7b58('0x34')]=_0x5f3037[_0x7b58('0x34')][_0x7b58('0x4b')]?_0x5f3037[_0x7b58('0x34')]:_0x4446fd[_0x7b58('0x2e')];_0x5f3037[_0x7b58('0x37')]=qs[_0x7b58('0x38')](_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x38')]);_0x5f3037['where']=qs[_0x7b58('0x31')](_['pick'](_0x2a7749[_0x7b58('0x2f')],_0x4446fd['filters']));if(_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x3a')]){_0x5f3037[_0x7b58('0x39')]=_[_0x7b58('0x3b')](_0x5f3037[_0x7b58('0x39')],{'$or':_[_0x7b58('0x29')](_0x5f3037[_0x7b58('0x34')],function(_0x18b97b){var _0x4064b3={};_0x4064b3[_0x18b97b]={'$like':'%'+_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x3a')]+'%'};return _0x4064b3;})});}_0x5f3037=_[_0x7b58('0x3b')]({},_0x5f3037,_0x2a7749[_0x7b58('0x3d')]);return _0x29d9ca['getTags'](_0x5f3037);}})[_0x7b58('0x22')](function(_0x14c3fb){if(_0x14c3fb){_0x5d0289=_0x14c3fb[_0x7b58('0x4b')];if(!_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x35')](_0x7b58('0x36'))){_0x5f3037[_0x7b58('0x1a')]=qs[_0x7b58('0x1a')](_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x1a')]);_0x5f3037[_0x7b58('0x1b')]=qs[_0x7b58('0x1b')](_0x2a7749[_0x7b58('0x2f')][_0x7b58('0x1b')]);}return _0x29d9ca[_0x7b58('0x51')](_0x5f3037);}})[_0x7b58('0x22')](function(_0x390c59){if(_0x390c59){return _0x390c59?{'count':_0x5d0289,'rows':_0x390c59}:null;}})['then'](respondWithResult(_0x4762c9,null))[_0x7b58('0x42')](handleError(_0x4762c9,null));};exports[_0x7b58('0x53')]=function(_0x5d48ed,_0x56e594,_0xd7b006){if(_0x5d48ed[_0x7b58('0x47')]['id']){delete _0x5d48ed[_0x7b58('0x47')]['id'];}return db[_0x7b58('0x2a')][_0x7b58('0x4a')]({'where':{'id':_0x5d48ed['params']['id']}})[_0x7b58('0x22')](handleEntityNotFound(_0x56e594,null))['then'](function(_0x49f2bc){if(_0x49f2bc){return _0x49f2bc[_0x7b58('0x53')](_0x5d48ed[_0x7b58('0x47')][_0x7b58('0x54')]||[]);}return null;})[_0x7b58('0x22')](respondWithResult(_0x56e594,null))[_0x7b58('0x42')](handleError(_0x56e594,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0db9c30..5de4a41 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 _0xb88c=['path','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird','request-promise'];(function(_0xf2034a,_0x35868a){var _0x502d2e=function(_0x27e095){while(--_0x27e095){_0xf2034a['push'](_0xf2034a['shift']());}};_0x502d2e(++_0x35868a);}(_0xb88c,0xcd));var _0xcb88=function(_0x363063,_0x863a4c){_0x363063=_0x363063-0x0;var _0x27f875=_0xb88c[_0x363063];return _0x27f875;};'use strict';var _=require('lodash');var util=require(_0xcb88('0x0'));var logger=require('../../config/logger')(_0xcb88('0x1'));var moment=require(_0xcb88('0x2'));var BPromise=require(_0xcb88('0x3'));var rp=require(_0xcb88('0x4'));var fs=require('fs');var path=require(_0xcb88('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcb88('0x6'));module[_0xcb88('0x7')]=function(_0x2f3b43,_0x3a6562){return _0x2f3b43['define'](_0xcb88('0x8'),attributes,{'tableName':_0xcb88('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4c2=['../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x13a443,_0x46b5ed){var _0x50f606=function(_0xba8a5d){while(--_0xba8a5d){_0x13a443['push'](_0x13a443['shift']());}};_0x50f606(++_0x46b5ed);}(_0xb4c2,0x19c));var _0x2b4c=function(_0x8ae03f,_0x251261){_0x8ae03f=_0x8ae03f-0x0;var _0x4f01d2=_0xb4c2[_0x8ae03f];return _0x4f01d2;};'use strict';var _=require('lodash');var util=require(_0x2b4c('0x0'));var logger=require(_0x2b4c('0x1'))(_0x2b4c('0x2'));var moment=require(_0x2b4c('0x3'));var BPromise=require(_0x2b4c('0x4'));var rp=require(_0x2b4c('0x5'));var fs=require('fs');var path=require(_0x2b4c('0x6'));var rimraf=require(_0x2b4c('0x7'));var config=require(_0x2b4c('0x8'));var attributes=require(_0x2b4c('0x9'));module[_0x2b4c('0xa')]=function(_0x537f4c,_0x178ca5){return _0x537f4c['define'](_0x2b4c('0xb'),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 9500a48..e4997d2 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 _0x6a47=['http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2a5156,_0x5244e9){var _0x4d3841=function(_0x5eb505){while(--_0x5eb505){_0x2a5156['push'](_0x2a5156['shift']());}};_0x4d3841(++_0x5244e9);}(_0x6a47,0x84));var _0x76a4=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6a47[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require(_0x76a4('0x5'));var db=require(_0x76a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76a4('0x7'))(_0x76a4('0x8'));var config=require(_0x76a4('0x9'));var jayson=require(_0x76a4('0xa'));var client=jayson[_0x76a4('0xb')][_0x76a4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x481862,_0x1b5cf6,_0x46c86b){return new BPromise(function(_0x5a7cda,_0x3ced93){return client['request'](_0x481862,_0x46c86b)[_0x76a4('0xd')](function(_0x2475c5){logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));logger['debug'](_0x76a4('0x11'),_0x1b5cf6,_0x76a4('0x10'),JSON[_0x76a4('0x12')](_0x2475c5));if(_0x2475c5[_0x76a4('0x13')]){if(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x14')]===0x1f4){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5[_0x76a4('0x13')]['message']);return _0x3ced93(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5['error'][_0x76a4('0x15')]);return _0x5a7cda(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}else{logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));_0x5a7cda(_0x2475c5[_0x76a4('0x16')][_0x76a4('0x15')]);}})[_0x76a4('0x17')](function(_0xa964aa){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0xa964aa);_0x3ced93(_0xa964aa);});});} \ No newline at end of file +var _0x3e82=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x325b8d,_0x327c32){var _0x3cb4d=function(_0x50585a){while(--_0x50585a){_0x325b8d['push'](_0x325b8d['shift']());}};_0x3cb4d(++_0x327c32);}(_0x3e82,0x18a));var _0x23e8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3e82[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x23e8('0x0'));var util=require(_0x23e8('0x1'));var moment=require(_0x23e8('0x2'));var BPromise=require(_0x23e8('0x3'));var rs=require(_0x23e8('0x4'));var fs=require('fs');var Redis=require(_0x23e8('0x5'));var db=require(_0x23e8('0x6'))['db'];var utils=require(_0x23e8('0x7'));var logger=require(_0x23e8('0x8'))(_0x23e8('0x9'));var config=require(_0x23e8('0xa'));var jayson=require(_0x23e8('0xb'));var client=jayson[_0x23e8('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29effc,_0x1d1a55,_0x16a3bb){return new BPromise(function(_0x164c59,_0x1afc29){return client['request'](_0x29effc,_0x16a3bb)[_0x23e8('0xd')](function(_0x4f01b5){logger[_0x23e8('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x1d1a55,_0x23e8('0xf'));logger[_0x23e8('0x10')](_0x23e8('0x11'),_0x1d1a55,'request\x20sent',JSON[_0x23e8('0x12')](_0x4f01b5));if(_0x4f01b5[_0x23e8('0x13')]){if(_0x4f01b5[_0x23e8('0x13')][_0x23e8('0x14')]===0x1f4){logger[_0x23e8('0x13')](_0x23e8('0x15'),_0x1d1a55,_0x4f01b5[_0x23e8('0x13')][_0x23e8('0x16')]);return _0x1afc29(_0x4f01b5[_0x23e8('0x13')][_0x23e8('0x16')]);}logger[_0x23e8('0x13')](_0x23e8('0x15'),_0x1d1a55,_0x4f01b5[_0x23e8('0x13')]['message']);return _0x164c59(_0x4f01b5[_0x23e8('0x13')][_0x23e8('0x16')]);}else{logger[_0x23e8('0xe')](_0x23e8('0x15'),_0x1d1a55,'request\x20sent');_0x164c59(_0x4f01b5[_0x23e8('0x17')][_0x23e8('0x16')]);}})[_0x23e8('0x18')](function(_0x96768d){logger[_0x23e8('0x13')](_0x23e8('0x15'),_0x1d1a55,_0x96768d);_0x1afc29(_0x96768d);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index d6e7d59..8e25488 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 _0x3134=['update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','get','index','isAuthenticated','show','post','create','put','/:id'];(function(_0x19e291,_0x5052bc){var _0x5c816f=function(_0x4a9cdf){while(--_0x4a9cdf){_0x19e291['push'](_0x19e291['shift']());}};_0x5c816f(++_0x5052bc);}(_0x3134,0xdf));var _0x4313=function(_0x1422a9,_0x4d21a6){_0x1422a9=_0x1422a9-0x0;var _0x3baa66=_0x3134[_0x1422a9];return _0x3baa66;};'use strict';var multer=require(_0x4313('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4313('0x1'));var express=require(_0x4313('0x2'));var router=express[_0x4313('0x3')]();var fs_extra=require(_0x4313('0x4'));var auth=require(_0x4313('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4313('0x6'));router[_0x4313('0x7')]('/',auth['isAuthenticated'](),controller[_0x4313('0x8')]);router['get']('/:id',auth[_0x4313('0x9')](),controller[_0x4313('0xa')]);router[_0x4313('0xb')]('/',auth[_0x4313('0x9')](),controller[_0x4313('0xc')]);router[_0x4313('0xd')](_0x4313('0xe'),auth[_0x4313('0x9')](),controller[_0x4313('0xf')]);router['delete'](_0x4313('0xe'),auth[_0x4313('0x9')](),controller[_0x4313('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe0f9=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0xe0f9,0x16c));var _0x9e0f=function(_0x55631b,_0x30e72c){_0x55631b=_0x55631b-0x0;var _0x570924=_0xe0f9[_0x55631b];return _0x570924;};'use strict';var multer=require(_0x9e0f('0x0'));var util=require(_0x9e0f('0x1'));var path=require(_0x9e0f('0x2'));var timeout=require(_0x9e0f('0x3'));var express=require(_0x9e0f('0x4'));var router=express[_0x9e0f('0x5')]();var fs_extra=require(_0x9e0f('0x6'));var auth=require(_0x9e0f('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9e0f('0x8'));router['get']('/',auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xa')]);router[_0x9e0f('0xb')](_0x9e0f('0xc'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xd')]);router['post']('/',auth[_0x9e0f('0x9')](),controller[_0x9e0f('0xe')]);router[_0x9e0f('0xf')](_0x9e0f('0xc'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0x10')]);router['delete'](_0x9e0f('0xc'),auth[_0x9e0f('0x9')](),controller[_0x9e0f('0x11')]);module[_0x9e0f('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 5c75c9b..fa901a9 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 _0x9483=['keyValue','picklist','string','STRING','BOOLEAN','exports','ENUM','customVariable'];(function(_0x7fe85c,_0x10b2eb){var _0x10b90f=function(_0x2400d9){while(--_0x2400d9){_0x7fe85c['push'](_0x7fe85c['shift']());}};_0x10b90f(++_0x10b2eb);}(_0x9483,0xc5));var _0x3948=function(_0x4d4fe1,_0x5f4f35){_0x4d4fe1=_0x4d4fe1-0x0;var _0x32ab47=_0x9483[_0x4d4fe1];return _0x32ab47;};'use strict';var Sequelize=require('sequelize');module[_0x3948('0x0')]={'type':{'type':Sequelize[_0x3948('0x1')]('string','variable',_0x3948('0x2'),_0x3948('0x3'),_0x3948('0x4')),'defaultValue':_0x3948('0x5')},'content':{'type':Sequelize[_0x3948('0x6')]},'key':{'type':Sequelize[_0x3948('0x6')]},'keyType':{'type':Sequelize[_0x3948('0x1')](_0x3948('0x5'),'variable',_0x3948('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3948('0x6')]},'customField':{'type':Sequelize[_0x3948('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3948('0x6')]}}; \ No newline at end of file +var _0x07cf=['variable','STRING','BOOLEAN','exports','ENUM','string'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x07cf,0xa5));var _0xf07c=function(_0x2675da,_0x5a250e){_0x2675da=_0x2675da-0x0;var _0x5e6153=_0x07cf[_0x2675da];return _0x5e6153;};'use strict';var Sequelize=require('sequelize');module[_0xf07c('0x0')]={'type':{'type':Sequelize[_0xf07c('0x1')](_0xf07c('0x2'),_0xf07c('0x3'),'customVariable','keyValue','picklist'),'defaultValue':_0xf07c('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf07c('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xf07c('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf07c('0x4')]},'idField':{'type':Sequelize[_0xf07c('0x4')]},'nameField':{'type':Sequelize[_0xf07c('0x4')]},'customField':{'type':Sequelize[_0xf07c('0x5')],'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 69d15eb..dd5ba2f 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 _0x4745=['rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','DeskField','includeAll','include','findAll','rows','show','params','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','name','index','map'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x4745,0x1e7));var _0x5474=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4745[_0x40ac5e];return _0x2839d6;};'use strict';var emlformat=require(_0x5474('0x0'));var rimraf=require(_0x5474('0x1'));var zipdir=require(_0x5474('0x2'));var jsonpatch=require(_0x5474('0x3'));var rp=require(_0x5474('0x4'));var moment=require(_0x5474('0x5'));var BPromise=require(_0x5474('0x6'));var Mustache=require(_0x5474('0x7'));var util=require(_0x5474('0x8'));var path=require(_0x5474('0x9'));var sox=require(_0x5474('0xa'));var csv=require(_0x5474('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5474('0xc'));var _=require(_0x5474('0xd'));var squel=require('squel');var crypto=require(_0x5474('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5474('0xf'));var toCsv=require(_0x5474('0xb'));var querystring=require('querystring');var Papa=require(_0x5474('0x10'));var Redis=require(_0x5474('0x11'));var authService=require(_0x5474('0x12'));var qs=require(_0x5474('0x13'));var as=require(_0x5474('0x14'));var hardwareService=require(_0x5474('0x15'));var logger=require(_0x5474('0x16'))(_0x5474('0x17'));var utils=require('../../config/utils');var config=require(_0x5474('0x18'));var licenseUtil=require(_0x5474('0x19'));var db=require(_0x5474('0x1a'))['db'];function respondWithStatusCode(_0x12cd7f,_0x10eac7){_0x10eac7=_0x10eac7||0xcc;return function(_0x261c64){if(_0x261c64){return _0x12cd7f[_0x5474('0x1b')](_0x10eac7);}return _0x12cd7f[_0x5474('0x1c')](_0x10eac7)[_0x5474('0x1d')]();};}function respondWithResult(_0x4a8db0,_0xb828fe){_0xb828fe=_0xb828fe||0xc8;return function(_0x17e424){if(_0x17e424){return _0x4a8db0[_0x5474('0x1c')](_0xb828fe)[_0x5474('0x1e')](_0x17e424);}};}function respondWithFilteredResult(_0x5a6353,_0x540e31){return function(_0x50b949){if(_0x50b949){var _0x50eb42=typeof _0x540e31[_0x5474('0x1f')]===_0x5474('0x20')&&typeof _0x540e31[_0x5474('0x21')]==='undefined';var _0x3da004=_0x50b949[_0x5474('0x22')];var _0x56dbfa=_0x50eb42?0x0:_0x540e31[_0x5474('0x1f')];var _0x198fc8=_0x50eb42?_0x50b949[_0x5474('0x22')]:_0x540e31[_0x5474('0x1f')]+_0x540e31[_0x5474('0x21')];var _0x4ab269;if(_0x198fc8>=_0x3da004){_0x198fc8=_0x3da004;_0x4ab269=0xc8;}else{_0x4ab269=0xce;}_0x5a6353[_0x5474('0x1c')](_0x4ab269);return _0x5a6353['set'](_0x5474('0x23'),_0x56dbfa+'-'+_0x198fc8+'/'+_0x3da004)[_0x5474('0x1e')](_0x50b949);}return null;};}function patchUpdates(_0x50d3a1){return function(_0x504826){try{jsonpatch['apply'](_0x504826,_0x50d3a1,!![]);}catch(_0x1f81d6){return BPromise[_0x5474('0x24')](_0x1f81d6);}return _0x504826[_0x5474('0x25')]();};}function saveUpdates(_0x401dd8,_0x36b389){return function(_0x24db35){if(_0x24db35){return _0x24db35[_0x5474('0x26')](_0x401dd8)[_0x5474('0x27')](function(_0x219be1){return _0x219be1;});}return null;};}function removeEntity(_0x9c80cc,_0x542d1f){return function(_0x5f065d){if(_0x5f065d){return _0x5f065d[_0x5474('0x28')]()[_0x5474('0x27')](function(){_0x9c80cc[_0x5474('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24997a,_0x49f691){return function(_0xa95a2){if(!_0xa95a2){_0x24997a[_0x5474('0x1b')](0x194);}return _0xa95a2;};}function handleError(_0x4b8985,_0x2a5f03){_0x2a5f03=_0x2a5f03||0x1f4;return function(_0x5d4cd7){logger[_0x5474('0x29')](_0x5d4cd7['stack']);if(_0x5d4cd7[_0x5474('0x2a')]){delete _0x5d4cd7[_0x5474('0x2a')];}_0x4b8985[_0x5474('0x1c')](_0x2a5f03)['send'](_0x5d4cd7);};}exports[_0x5474('0x2b')]=function(_0x42b99a,_0x479e44){var _0x57731b={},_0x5d2381={},_0x492a31={'count':0x0,'rows':[]};var _0x168dee=_[_0x5474('0x2c')](db['DeskField'][_0x5474('0x2d')],function(_0x4a657e){return{'name':_0x4a657e[_0x5474('0x2e')],'type':_0x4a657e['type'][_0x5474('0x2f')]};});_0x5d2381['model']=_[_0x5474('0x2c')](_0x168dee,'name');_0x5d2381[_0x5474('0x30')]=_[_0x5474('0x31')](_0x42b99a[_0x5474('0x30')]);_0x5d2381[_0x5474('0x32')]=_['intersection'](_0x5d2381['model'],_0x5d2381[_0x5474('0x30')]);_0x57731b[_0x5474('0x33')]=_[_0x5474('0x34')](_0x5d2381[_0x5474('0x35')],qs['fields'](_0x42b99a['query'][_0x5474('0x36')]));_0x57731b[_0x5474('0x33')]=_0x57731b['attributes'][_0x5474('0x37')]?_0x57731b[_0x5474('0x33')]:_0x5d2381[_0x5474('0x35')];if(!_0x42b99a[_0x5474('0x30')]['hasOwnProperty'](_0x5474('0x38'))){_0x57731b[_0x5474('0x21')]=qs[_0x5474('0x21')](_0x42b99a['query'][_0x5474('0x21')]);_0x57731b[_0x5474('0x1f')]=qs[_0x5474('0x1f')](_0x42b99a[_0x5474('0x30')]['offset']);}_0x57731b['order']=qs[_0x5474('0x39')](_0x42b99a[_0x5474('0x30')][_0x5474('0x39')]);_0x57731b[_0x5474('0x3a')]=qs['filters'](_[_0x5474('0x3b')](_0x42b99a[_0x5474('0x30')],_0x5d2381[_0x5474('0x32')]),_0x168dee);if(_0x42b99a[_0x5474('0x30')]['filter']){_0x57731b['where']=_['merge'](_0x57731b[_0x5474('0x3a')],{'$or':_['map'](_0x168dee,function(_0x28660f){if(_0x28660f[_0x5474('0x3c')]!==_0x5474('0x3d')){var _0x214ab2={};_0x214ab2[_0x28660f[_0x5474('0x2a')]]={'$like':'%'+_0x42b99a[_0x5474('0x30')][_0x5474('0x3e')]+'%'};return _0x214ab2;}})});}_0x57731b=_[_0x5474('0x3f')]({},_0x57731b,_0x42b99a[_0x5474('0x40')]);var _0x58f76d={'where':_0x57731b[_0x5474('0x3a')]};return db[_0x5474('0x41')][_0x5474('0x22')](_0x58f76d)[_0x5474('0x27')](function(_0x5e1901){_0x492a31[_0x5474('0x22')]=_0x5e1901;if(_0x42b99a['query'][_0x5474('0x42')]){_0x57731b[_0x5474('0x43')]=[{'all':!![]}];}return db['DeskField'][_0x5474('0x44')](_0x57731b);})[_0x5474('0x27')](function(_0x5690a0){_0x492a31[_0x5474('0x45')]=_0x5690a0;return _0x492a31;})[_0x5474('0x27')](respondWithFilteredResult(_0x479e44,_0x57731b))['catch'](handleError(_0x479e44,null));};exports[_0x5474('0x46')]=function(_0x547c72,_0x206733){var _0x291999={'raw':!![],'where':{'id':_0x547c72[_0x5474('0x47')]['id']}},_0x5c93d0={};_0x5c93d0[_0x5474('0x35')]=_[_0x5474('0x31')](db['DeskField'][_0x5474('0x2d')]);_0x5c93d0[_0x5474('0x30')]=_[_0x5474('0x31')](_0x547c72[_0x5474('0x30')]);_0x5c93d0['filters']=_['intersection'](_0x5c93d0[_0x5474('0x35')],_0x5c93d0['query']);_0x291999[_0x5474('0x33')]=_[_0x5474('0x34')](_0x5c93d0['model'],qs[_0x5474('0x36')](_0x547c72[_0x5474('0x30')]['fields']));_0x291999[_0x5474('0x33')]=_0x291999[_0x5474('0x33')]['length']?_0x291999['attributes']:_0x5c93d0[_0x5474('0x35')];if(_0x547c72[_0x5474('0x30')]['includeAll']){_0x291999[_0x5474('0x43')]=[{'all':!![]}];}_0x291999=_[_0x5474('0x3f')]({},_0x291999,_0x547c72[_0x5474('0x40')]);return db[_0x5474('0x41')]['find'](_0x291999)[_0x5474('0x27')](handleEntityNotFound(_0x206733,null))[_0x5474('0x27')](respondWithResult(_0x206733,null))['catch'](handleError(_0x206733,null));};exports[_0x5474('0x48')]=function(_0x137a76,_0x3c59bb){return db[_0x5474('0x41')][_0x5474('0x48')](_0x137a76[_0x5474('0x49')],{})[_0x5474('0x27')](respondWithResult(_0x3c59bb,0xc9))[_0x5474('0x4a')](handleError(_0x3c59bb,null));};exports[_0x5474('0x26')]=function(_0x21d29f,_0x3c9cb2){if(_0x21d29f[_0x5474('0x49')]['id']){delete _0x21d29f['body']['id'];}return db[_0x5474('0x41')][_0x5474('0x4b')]({'where':{'id':_0x21d29f[_0x5474('0x47')]['id']}})[_0x5474('0x27')](handleEntityNotFound(_0x3c9cb2,null))['then'](saveUpdates(_0x21d29f[_0x5474('0x49')],null))[_0x5474('0x27')](respondWithResult(_0x3c9cb2,null))[_0x5474('0x4a')](handleError(_0x3c9cb2,null));};exports[_0x5474('0x28')]=function(_0x771aad,_0x119398){return db[_0x5474('0x41')][_0x5474('0x4b')]({'where':{'id':_0x771aad[_0x5474('0x47')]['id']}})[_0x5474('0x27')](handleEntityNotFound(_0x119398,null))[_0x5474('0x27')](removeEntity(_0x119398,null))[_0x5474('0x4a')](handleError(_0x119398,null));}; \ No newline at end of file +var _0x0a01=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','DeskField','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x55334a,_0x140452){var _0x2945bd=function(_0x2e3617){while(--_0x2e3617){_0x55334a['push'](_0x55334a['shift']());}};_0x2945bd(++_0x140452);}(_0x0a01,0x10b));var _0x10a0=function(_0x543b25,_0x2b2d6f){_0x543b25=_0x543b25-0x0;var _0xece852=_0x0a01[_0x543b25];return _0xece852;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x10a0('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x10a0('0x1'));var Mustache=require('mustache');var util=require(_0x10a0('0x2'));var path=require(_0x10a0('0x3'));var sox=require(_0x10a0('0x4'));var csv=require(_0x10a0('0x5'));var ejs=require(_0x10a0('0x6'));var fs=require('fs');var fs_extra=require(_0x10a0('0x7'));var _=require('lodash');var squel=require(_0x10a0('0x8'));var crypto=require(_0x10a0('0x9'));var jsforce=require(_0x10a0('0xa'));var deskjs=require(_0x10a0('0xb'));var toCsv=require(_0x10a0('0x5'));var querystring=require(_0x10a0('0xc'));var Papa=require('papaparse');var Redis=require(_0x10a0('0xd'));var authService=require(_0x10a0('0xe'));var qs=require(_0x10a0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x10a0('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x10a0('0x11'));var licenseUtil=require(_0x10a0('0x12'));var db=require(_0x10a0('0x13'))['db'];function respondWithStatusCode(_0x357800,_0x59eb39){_0x59eb39=_0x59eb39||0xcc;return function(_0x4fba55){if(_0x4fba55){return _0x357800[_0x10a0('0x14')](_0x59eb39);}return _0x357800[_0x10a0('0x15')](_0x59eb39)[_0x10a0('0x16')]();};}function respondWithResult(_0x53d0a8,_0x4b1c94){_0x4b1c94=_0x4b1c94||0xc8;return function(_0x176697){if(_0x176697){return _0x53d0a8[_0x10a0('0x15')](_0x4b1c94)[_0x10a0('0x17')](_0x176697);}};}function respondWithFilteredResult(_0x52948b,_0x2ddd25){return function(_0x2b778b){if(_0x2b778b){var _0x52a754=typeof _0x2ddd25['offset']===_0x10a0('0x18')&&typeof _0x2ddd25[_0x10a0('0x19')]===_0x10a0('0x18');var _0x4665ca=_0x2b778b[_0x10a0('0x1a')];var _0xe57eae=_0x52a754?0x0:_0x2ddd25[_0x10a0('0x1b')];var _0x55463b=_0x52a754?_0x2b778b['count']:_0x2ddd25[_0x10a0('0x1b')]+_0x2ddd25[_0x10a0('0x19')];var _0x27c929;if(_0x55463b>=_0x4665ca){_0x55463b=_0x4665ca;_0x27c929=0xc8;}else{_0x27c929=0xce;}_0x52948b[_0x10a0('0x15')](_0x27c929);return _0x52948b['set']('Content-Range',_0xe57eae+'-'+_0x55463b+'/'+_0x4665ca)[_0x10a0('0x17')](_0x2b778b);}return null;};}function patchUpdates(_0x100794){return function(_0x4b0e4b){try{jsonpatch[_0x10a0('0x1c')](_0x4b0e4b,_0x100794,!![]);}catch(_0x5b9829){return BPromise[_0x10a0('0x1d')](_0x5b9829);}return _0x4b0e4b[_0x10a0('0x1e')]();};}function saveUpdates(_0x108486,_0x17401e){return function(_0x3bbe64){if(_0x3bbe64){return _0x3bbe64[_0x10a0('0x1f')](_0x108486)[_0x10a0('0x20')](function(_0xee103a){return _0xee103a;});}return null;};}function removeEntity(_0x396df6,_0x508e3c){return function(_0xe6b8fd){if(_0xe6b8fd){return _0xe6b8fd[_0x10a0('0x21')]()[_0x10a0('0x20')](function(){_0x396df6[_0x10a0('0x15')](0xcc)[_0x10a0('0x16')]();});}};}function handleEntityNotFound(_0x5a1c95,_0x2a7f98){return function(_0x4da678){if(!_0x4da678){_0x5a1c95[_0x10a0('0x14')](0x194);}return _0x4da678;};}function handleError(_0x5f00f1,_0x1b0650){_0x1b0650=_0x1b0650||0x1f4;return function(_0x50f56f){logger[_0x10a0('0x22')](_0x50f56f[_0x10a0('0x23')]);if(_0x50f56f[_0x10a0('0x24')]){delete _0x50f56f[_0x10a0('0x24')];}_0x5f00f1[_0x10a0('0x15')](_0x1b0650)[_0x10a0('0x25')](_0x50f56f);};}exports['index']=function(_0x3bce8d,_0x5c1ec7){var _0x4f7b93={},_0x27cb88={},_0x446c29={'count':0x0,'rows':[]};var _0x58081d=_[_0x10a0('0x26')](db['DeskField'][_0x10a0('0x27')],function(_0x1bc73f){return{'name':_0x1bc73f[_0x10a0('0x28')],'type':_0x1bc73f[_0x10a0('0x29')][_0x10a0('0x2a')]};});_0x27cb88['model']=_[_0x10a0('0x26')](_0x58081d,_0x10a0('0x24'));_0x27cb88[_0x10a0('0x2b')]=_[_0x10a0('0x2c')](_0x3bce8d['query']);_0x27cb88['filters']=_[_0x10a0('0x2d')](_0x27cb88['model'],_0x27cb88[_0x10a0('0x2b')]);_0x4f7b93['attributes']=_[_0x10a0('0x2d')](_0x27cb88[_0x10a0('0x2e')],qs[_0x10a0('0x2f')](_0x3bce8d['query'][_0x10a0('0x2f')]));_0x4f7b93[_0x10a0('0x30')]=_0x4f7b93[_0x10a0('0x30')][_0x10a0('0x31')]?_0x4f7b93[_0x10a0('0x30')]:_0x27cb88['model'];if(!_0x3bce8d[_0x10a0('0x2b')][_0x10a0('0x32')](_0x10a0('0x33'))){_0x4f7b93[_0x10a0('0x19')]=qs[_0x10a0('0x19')](_0x3bce8d[_0x10a0('0x2b')]['limit']);_0x4f7b93[_0x10a0('0x1b')]=qs[_0x10a0('0x1b')](_0x3bce8d[_0x10a0('0x2b')]['offset']);}_0x4f7b93['order']=qs[_0x10a0('0x34')](_0x3bce8d['query'][_0x10a0('0x34')]);_0x4f7b93['where']=qs[_0x10a0('0x35')](_[_0x10a0('0x36')](_0x3bce8d[_0x10a0('0x2b')],_0x27cb88['filters']),_0x58081d);if(_0x3bce8d['query'][_0x10a0('0x37')]){_0x4f7b93[_0x10a0('0x38')]=_['merge'](_0x4f7b93['where'],{'$or':_[_0x10a0('0x26')](_0x58081d,function(_0x50c5ad){if(_0x50c5ad['type']!==_0x10a0('0x39')){var _0x3f7abb={};_0x3f7abb[_0x50c5ad['name']]={'$like':'%'+_0x3bce8d[_0x10a0('0x2b')][_0x10a0('0x37')]+'%'};return _0x3f7abb;}})});}_0x4f7b93=_[_0x10a0('0x3a')]({},_0x4f7b93,_0x3bce8d['options']);var _0x59fe00={'where':_0x4f7b93['where']};return db[_0x10a0('0x3b')][_0x10a0('0x1a')](_0x59fe00)['then'](function(_0x19661e){_0x446c29[_0x10a0('0x1a')]=_0x19661e;if(_0x3bce8d[_0x10a0('0x2b')][_0x10a0('0x3c')]){_0x4f7b93[_0x10a0('0x3d')]=[{'all':!![]}];}return db[_0x10a0('0x3b')][_0x10a0('0x3e')](_0x4f7b93);})['then'](function(_0x383556){_0x446c29[_0x10a0('0x3f')]=_0x383556;return _0x446c29;})[_0x10a0('0x20')](respondWithFilteredResult(_0x5c1ec7,_0x4f7b93))[_0x10a0('0x40')](handleError(_0x5c1ec7,null));};exports[_0x10a0('0x41')]=function(_0x133442,_0x7d2d9f){var _0x5a0b2d={'raw':!![],'where':{'id':_0x133442['params']['id']}},_0x5adbea={};_0x5adbea[_0x10a0('0x2e')]=_[_0x10a0('0x2c')](db['DeskField'][_0x10a0('0x27')]);_0x5adbea[_0x10a0('0x2b')]=_[_0x10a0('0x2c')](_0x133442['query']);_0x5adbea[_0x10a0('0x35')]=_[_0x10a0('0x2d')](_0x5adbea[_0x10a0('0x2e')],_0x5adbea[_0x10a0('0x2b')]);_0x5a0b2d['attributes']=_[_0x10a0('0x2d')](_0x5adbea['model'],qs['fields'](_0x133442['query'][_0x10a0('0x2f')]));_0x5a0b2d['attributes']=_0x5a0b2d['attributes'][_0x10a0('0x31')]?_0x5a0b2d['attributes']:_0x5adbea[_0x10a0('0x2e')];if(_0x133442['query'][_0x10a0('0x3c')]){_0x5a0b2d[_0x10a0('0x3d')]=[{'all':!![]}];}_0x5a0b2d=_[_0x10a0('0x3a')]({},_0x5a0b2d,_0x133442[_0x10a0('0x42')]);return db[_0x10a0('0x3b')]['find'](_0x5a0b2d)[_0x10a0('0x20')](handleEntityNotFound(_0x7d2d9f,null))[_0x10a0('0x20')](respondWithResult(_0x7d2d9f,null))['catch'](handleError(_0x7d2d9f,null));};exports[_0x10a0('0x43')]=function(_0x579fdd,_0x1367f5){return db[_0x10a0('0x3b')][_0x10a0('0x43')](_0x579fdd[_0x10a0('0x44')],{})[_0x10a0('0x20')](respondWithResult(_0x1367f5,0xc9))['catch'](handleError(_0x1367f5,null));};exports[_0x10a0('0x1f')]=function(_0x4ad10e,_0x14f1a1){if(_0x4ad10e[_0x10a0('0x44')]['id']){delete _0x4ad10e[_0x10a0('0x44')]['id'];}return db[_0x10a0('0x3b')][_0x10a0('0x45')]({'where':{'id':_0x4ad10e['params']['id']}})[_0x10a0('0x20')](handleEntityNotFound(_0x14f1a1,null))[_0x10a0('0x20')](saveUpdates(_0x4ad10e[_0x10a0('0x44')],null))[_0x10a0('0x20')](respondWithResult(_0x14f1a1,null))[_0x10a0('0x40')](handleError(_0x14f1a1,null));};exports[_0x10a0('0x21')]=function(_0x5d5f89,_0x3dc3f7){return db[_0x10a0('0x3b')][_0x10a0('0x45')]({'where':{'id':_0x5d5f89[_0x10a0('0x46')]['id']}})[_0x10a0('0x20')](handleEntityNotFound(_0x3dc3f7,null))['then'](removeEntity(_0x3dc3f7,null))[_0x10a0('0x40')](handleError(_0x3dc3f7,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 736febe..2ecdc44 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 _0x7146=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','desk_unique_index','idField','lodash'];(function(_0x48fb10,_0xa50a89){var _0x534251=function(_0xcdc19e){while(--_0xcdc19e){_0x48fb10['push'](_0x48fb10['shift']());}};_0x534251(++_0xa50a89);}(_0x7146,0x99));var _0x6714=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x7146[_0xec034];return _0x2c5a19;};'use strict';var _=require(_0x6714('0x0'));var util=require(_0x6714('0x1'));var logger=require(_0x6714('0x2'))(_0x6714('0x3'));var moment=require(_0x6714('0x4'));var BPromise=require(_0x6714('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6714('0x6'));var rimraf=require(_0x6714('0x7'));var config=require(_0x6714('0x8'));var attributes=require(_0x6714('0x9'));module['exports']=function(_0x4ce0c4,_0x16f4b0){return _0x4ce0c4[_0x6714('0xa')](_0x6714('0xb'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6714('0xc'),'fields':[_0x6714('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2521=['request-promise','path','../../config/environment','./intDeskField.attributes','exports','DeskField','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x5c1d92,_0x307ecb){var _0x2bb737=function(_0x2623db){while(--_0x2623db){_0x5c1d92['push'](_0x5c1d92['shift']());}};_0x2bb737(++_0x307ecb);}(_0x2521,0xbe));var _0x1252=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x2521[_0x47e309];return _0x2e1900;};'use strict';var _=require('lodash');var util=require(_0x1252('0x0'));var logger=require(_0x1252('0x1'))(_0x1252('0x2'));var moment=require(_0x1252('0x3'));var BPromise=require(_0x1252('0x4'));var rp=require(_0x1252('0x5'));var fs=require('fs');var path=require(_0x1252('0x6'));var rimraf=require('rimraf');var config=require(_0x1252('0x7'));var attributes=require(_0x1252('0x8'));module[_0x1252('0x9')]=function(_0x12c9cf,_0x5148b8){return _0x12c9cf['define'](_0x1252('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x1252('0xb'),_0x1252('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 63418e2..cc13365 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 _0xdf83=['request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x10fd98,_0x5209db){var _0x5347d5=function(_0x570103){while(--_0x570103){_0x10fd98['push'](_0x10fd98['shift']());}};_0x5347d5(++_0x5209db);}(_0xdf83,0x79));var _0x3df8=function(_0x2d959a,_0x4d8b26){_0x2d959a=_0x2d959a-0x0;var _0x2fa8d6=_0xdf83[_0x2d959a];return _0x2fa8d6;};'use strict';var _=require(_0x3df8('0x0'));var util=require(_0x3df8('0x1'));var moment=require(_0x3df8('0x2'));var BPromise=require(_0x3df8('0x3'));var rs=require(_0x3df8('0x4'));var fs=require('fs');var Redis=require(_0x3df8('0x5'));var db=require(_0x3df8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3df8('0x7'))('rpc');var config=require(_0x3df8('0x8'));var jayson=require(_0x3df8('0x9'));var client=jayson['client'][_0x3df8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20391d,_0x1ef1cf,_0x2648d5){return new BPromise(function(_0x4a856b,_0x56f404){return client[_0x3df8('0xb')](_0x20391d,_0x2648d5)[_0x3df8('0xc')](function(_0x19c809){logger[_0x3df8('0xd')](_0x3df8('0xe'),_0x1ef1cf,_0x3df8('0xf'));logger[_0x3df8('0x10')](_0x3df8('0x11'),_0x1ef1cf,_0x3df8('0xf'),JSON[_0x3df8('0x12')](_0x19c809));if(_0x19c809[_0x3df8('0x13')]){if(_0x19c809['error'][_0x3df8('0x14')]===0x1f4){logger[_0x3df8('0x13')](_0x3df8('0xe'),_0x1ef1cf,_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);return _0x56f404(_0x19c809[_0x3df8('0x13')]['message']);}logger[_0x3df8('0x13')]('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);return _0x4a856b(_0x19c809[_0x3df8('0x13')][_0x3df8('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x3df8('0xf'));_0x4a856b(_0x19c809['result'][_0x3df8('0x15')]);}})['catch'](function(_0x4c2613){logger[_0x3df8('0x13')]('DeskField,\x20%s,\x20%s',_0x1ef1cf,_0x4c2613);_0x56f404(_0x4c2613);});});} \ No newline at end of file +var _0x3ee6=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3eee56,_0x176daf){var _0x506bcd=function(_0x3cfe8b){while(--_0x3cfe8b){_0x3eee56['push'](_0x3eee56['shift']());}};_0x506bcd(++_0x176daf);}(_0x3ee6,0x18e));var _0x63ee=function(_0x494619,_0xfb7409){_0x494619=_0x494619-0x0;var _0x521a34=_0x3ee6[_0x494619];return _0x521a34;};'use strict';var _=require(_0x63ee('0x0'));var util=require(_0x63ee('0x1'));var moment=require('moment');var BPromise=require(_0x63ee('0x2'));var rs=require(_0x63ee('0x3'));var fs=require('fs');var Redis=require(_0x63ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63ee('0x5'));var logger=require(_0x63ee('0x6'))(_0x63ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x63ee('0x8'));var client=jayson[_0x63ee('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bd6b,_0x56c804,_0x191a88){return new BPromise(function(_0x315933,_0xde1976){return client['request'](_0x18bd6b,_0x191a88)[_0x63ee('0xa')](function(_0x4480e6){logger[_0x63ee('0xb')](_0x63ee('0xc'),_0x56c804,_0x63ee('0xd'));logger[_0x63ee('0xe')](_0x63ee('0xf'),_0x56c804,_0x63ee('0xd'),JSON[_0x63ee('0x10')](_0x4480e6));if(_0x4480e6['error']){if(_0x4480e6[_0x63ee('0x11')][_0x63ee('0x12')]===0x1f4){logger[_0x63ee('0x11')](_0x63ee('0xc'),_0x56c804,_0x4480e6[_0x63ee('0x11')][_0x63ee('0x13')]);return _0xde1976(_0x4480e6[_0x63ee('0x11')][_0x63ee('0x13')]);}logger[_0x63ee('0x11')]('DeskField,\x20%s,\x20%s',_0x56c804,_0x4480e6[_0x63ee('0x11')][_0x63ee('0x13')]);return _0x315933(_0x4480e6[_0x63ee('0x11')][_0x63ee('0x13')]);}else{logger[_0x63ee('0xb')]('DeskField,\x20%s,\x20%s',_0x56c804,_0x63ee('0xd'));_0x315933(_0x4480e6[_0x63ee('0x14')]['message']);}})[_0x63ee('0x15')](function(_0x1e220a){logger['error'](_0x63ee('0xc'),_0x56c804,_0x1e220a);_0xde1976(_0x1e220a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d73d709..6334a81 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 _0xab48=['../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a3473,_0x49e97e){var _0x32122f=function(_0x2a714c){while(--_0x2a714c){_0x3a3473['push'](_0x3a3473['shift']());}};_0x32122f(++_0x49e97e);}(_0xab48,0x173));var _0x8ab4=function(_0x37fead,_0x178c7d){_0x37fead=_0x37fead-0x0;var _0x211a4c=_0xab48[_0x37fead];return _0x211a4c;};'use strict';var multer=require(_0x8ab4('0x0'));var util=require(_0x8ab4('0x1'));var path=require(_0x8ab4('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ab4('0x3'));var router=express['Router']();var fs_extra=require(_0x8ab4('0x4'));var auth=require(_0x8ab4('0x5'));var interaction=require(_0x8ab4('0x6'));var config=require(_0x8ab4('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x8ab4('0x8')]('/',auth[_0x8ab4('0x9')](),controller[_0x8ab4('0xa')]);router[_0x8ab4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x8ab4('0xb')]);router[_0x8ab4('0x8')](_0x8ab4('0xc'),auth[_0x8ab4('0x9')](),controller[_0x8ab4('0xd')]);router[_0x8ab4('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8ab4('0xe')]);router[_0x8ab4('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8ab4('0xf')]('/:id/configurations',auth[_0x8ab4('0x9')](),controller[_0x8ab4('0x10')]);router['put'](_0x8ab4('0x11'),auth[_0x8ab4('0x9')](),controller['update']);router[_0x8ab4('0x12')](_0x8ab4('0x11'),auth[_0x8ab4('0x9')](),controller[_0x8ab4('0x13')]);module[_0x8ab4('0x14')]=router; \ No newline at end of file +var _0x5918=['Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3597d6,_0x3b11bc){var _0x379ac2=function(_0xc3cbbf){while(--_0xc3cbbf){_0x3597d6['push'](_0x3597d6['shift']());}};_0x379ac2(++_0x3b11bc);}(_0x5918,0x154));var _0x8591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5918[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8591('0x0'));var util=require(_0x8591('0x1'));var path=require(_0x8591('0x2'));var timeout=require(_0x8591('0x3'));var express=require(_0x8591('0x4'));var router=express[_0x8591('0x5')]();var fs_extra=require(_0x8591('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x8591('0x7'));var config=require(_0x8591('0x8'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0x8591('0x9')](),controller[_0x8591('0xa')]);router[_0x8591('0xb')](_0x8591('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8591('0xb')]('/:id/configurations',auth[_0x8591('0x9')](),controller[_0x8591('0xd')]);router['get'](_0x8591('0xe'),auth[_0x8591('0x9')](),controller[_0x8591('0xf')]);router[_0x8591('0x10')]('/',auth['isAuthenticated'](),controller[_0x8591('0x11')]);router[_0x8591('0x10')]('/:id/configurations',auth[_0x8591('0x9')](),controller[_0x8591('0x12')]);router[_0x8591('0x13')](_0x8591('0xc'),auth[_0x8591('0x9')](),controller['update']);router[_0x8591('0x14')](_0x8591('0xc'),auth[_0x8591('0x9')](),controller[_0x8591('0x15')]);module[_0x8591('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 1c0e223..e6910a3 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 _0x0618=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5114ce,_0x539ecc){var _0x196363=function(_0x179f08){while(--_0x179f08){_0x5114ce['push'](_0x5114ce['shift']());}};_0x196363(++_0x539ecc);}(_0x0618,0x1c6));var _0x8061=function(_0x339702,_0x465d98){_0x339702=_0x339702-0x0;var _0x55cc03=_0x0618[_0x339702];return _0x55cc03;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8061('0x2')]},'password':{'type':Sequelize[_0x8061('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x8061('0x2')]},'clientSecret':{'type':Sequelize[_0x8061('0x2')]},'serverUrl':{'type':Sequelize[_0x8061('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8061('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8061('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf69d=['exports','STRING','BOOLEAN','sequelize'];(function(_0x2d90da,_0x4cf47d){var _0x4f99cc=function(_0x1f6b49){while(--_0x1f6b49){_0x2d90da['push'](_0x2d90da['shift']());}};_0x4f99cc(++_0x4cf47d);}(_0xf69d,0xd3));var _0xdf69=function(_0xbc9ddb,_0x1ff31c){_0xbc9ddb=_0xbc9ddb-0x0;var _0x569638=_0xf69d[_0xbc9ddb];return _0x569638;};'use strict';var Sequelize=require(_0xdf69('0x0'));module[_0xdf69('0x1')]={'name':{'type':Sequelize[_0xdf69('0x2')]},'username':{'type':Sequelize[_0xdf69('0x2')]},'password':{'type':Sequelize[_0xdf69('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xdf69('0x2')]},'clientId':{'type':Sequelize[_0xdf69('0x2')]},'clientSecret':{'type':Sequelize[_0xdf69('0x2')]},'serverUrl':{'type':Sequelize[_0xdf69('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdf69('0x2')]},'modernAuthentication':{'type':Sequelize[_0xdf69('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index a7e2b5c..9c0642e 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 _0xe5db=['catch','find','create','body','params','getConfigurations','findOne','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Configuration','Dynamics365Field','substring','lastIndexOf','format','ticketType','incident','PhoneCall','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','Bearer\x20','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../components/integrations/configuration','status','json','undefined','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Dynamics365Account','includeAll','include','rows'];(function(_0x23cce2,_0x5ca66d){var _0xd7efa2=function(_0x2b1ad9){while(--_0x2b1ad9){_0x23cce2['push'](_0x23cce2['shift']());}};_0xd7efa2(++_0x5ca66d);}(_0xe5db,0x1f3));var _0xbe5d=function(_0x5cc0f5,_0x241d4e){_0x5cc0f5=_0x5cc0f5-0x0;var _0x231110=_0xe5db[_0x5cc0f5];return _0x231110;};'use strict';var rp=require('request-promise');var util=require(_0xbe5d('0x0'));var _=require('lodash');var qs=require(_0xbe5d('0x1'));var logger=require(_0xbe5d('0x2'))(_0xbe5d('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0xbe5d('0x4'));function respondWithResult(_0x53d3c9,_0x24f699){_0x24f699=_0x24f699||0xc8;return function(_0x5f9625){if(_0x5f9625){return _0x53d3c9[_0xbe5d('0x5')](_0x24f699)[_0xbe5d('0x6')](_0x5f9625);}};}function respondWithFilteredResult(_0x5e7aab,_0x4d37b5){return function(_0x5511da){if(_0x5511da){var _0x4ba77c=typeof _0x4d37b5['offset']===_0xbe5d('0x7')&&typeof _0x4d37b5['limit']===_0xbe5d('0x7');var _0x4c6dfb=_0x5511da[_0xbe5d('0x8')];var _0x2ef62b=_0x4ba77c?0x0:_0x4d37b5[_0xbe5d('0x9')];var _0x3853f5=_0x4ba77c?_0x5511da[_0xbe5d('0x8')]:_0x4d37b5['offset']+_0x4d37b5['limit'];var _0x34154b;if(_0x3853f5>=_0x4c6dfb){_0x3853f5=_0x4c6dfb;_0x34154b=0xc8;}else{_0x34154b=0xce;}_0x5e7aab['status'](_0x34154b);return _0x5e7aab[_0xbe5d('0xa')](_0xbe5d('0xb'),_0x2ef62b+'-'+_0x3853f5+'/'+_0x4c6dfb)[_0xbe5d('0x6')](_0x5511da);}return null;};}function saveUpdates(_0x48410f){return function(_0x379148){if(_0x379148){return _0x379148[_0xbe5d('0xc')](_0x48410f)[_0xbe5d('0xd')](function(_0x39bb74){return _0x39bb74;});}return null;};}function removeEntity(_0x5270fd){return function(_0x28471b){if(_0x28471b){return _0x28471b[_0xbe5d('0xe')]()[_0xbe5d('0xd')](function(){_0x5270fd[_0xbe5d('0x5')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c12dd){return function(_0x4e5961){if(!_0x4e5961){_0x4c12dd[_0xbe5d('0xf')](0x194);}return _0x4e5961;};}function handleError(_0x1f3620,_0x209aff){_0x209aff=_0x209aff||0x1f4;return function(_0x4da39e){logger[_0xbe5d('0x10')](_0x4da39e[_0xbe5d('0x11')]);if(_0x4da39e['name']){delete _0x4da39e[_0xbe5d('0x12')];}_0x1f3620[_0xbe5d('0x5')](_0x209aff)[_0xbe5d('0x13')](_0x4da39e);};}exports[_0xbe5d('0x14')]=function(_0x7b95a6,_0x5f0594){var _0x85b7e={},_0x30ee8f={},_0x840b3={'count':0x0,'rows':[]};var _0x4f624b=_[_0xbe5d('0x15')](db['Dynamics365Account'][_0xbe5d('0x16')],function(_0x261b60){return{'name':_0x261b60['fieldName'],'type':_0x261b60['type'][_0xbe5d('0x17')]};});_0x30ee8f[_0xbe5d('0x18')]=_[_0xbe5d('0x15')](_0x4f624b,_0xbe5d('0x12'));_0x30ee8f['query']=_[_0xbe5d('0x19')](_0x7b95a6[_0xbe5d('0x1a')]);_0x30ee8f[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0x30ee8f[_0xbe5d('0x18')],_0x30ee8f['query']);_0x85b7e[_0xbe5d('0x1d')]=_[_0xbe5d('0x1c')](_0x30ee8f[_0xbe5d('0x18')],qs[_0xbe5d('0x1e')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x85b7e[_0xbe5d('0x1d')]=_0x85b7e[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x85b7e[_0xbe5d('0x1d')]:_0x30ee8f[_0xbe5d('0x18')];if(!_0x7b95a6[_0xbe5d('0x1a')]['hasOwnProperty'](_0xbe5d('0x20'))){_0x85b7e['limit']=qs[_0xbe5d('0x21')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x21')]);_0x85b7e[_0xbe5d('0x9')]=qs[_0xbe5d('0x9')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x9')]);}_0x85b7e[_0xbe5d('0x22')]=qs[_0xbe5d('0x23')](_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x23')]);_0x85b7e[_0xbe5d('0x24')]=qs[_0xbe5d('0x1b')](_[_0xbe5d('0x25')](_0x7b95a6[_0xbe5d('0x1a')],_0x30ee8f[_0xbe5d('0x1b')]),_0x4f624b);if(_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x26')]){_0x85b7e['where']=_[_0xbe5d('0x27')](_0x85b7e[_0xbe5d('0x24')],{'$or':_[_0xbe5d('0x15')](_0x4f624b,function(_0x47b88e){if(_0x47b88e[_0xbe5d('0x28')]!==_0xbe5d('0x29')){var _0x17a4ca={};_0x17a4ca[_0x47b88e[_0xbe5d('0x12')]]={'$like':'%'+_0x7b95a6[_0xbe5d('0x1a')][_0xbe5d('0x26')]+'%'};return _0x17a4ca;}})});}_0x85b7e=_[_0xbe5d('0x27')]({},_0x85b7e,_0x7b95a6[_0xbe5d('0x2a')]);var _0x19f01f={'where':_0x85b7e[_0xbe5d('0x24')]};return db[_0xbe5d('0x2b')][_0xbe5d('0x8')](_0x19f01f)[_0xbe5d('0xd')](function(_0x4c7078){_0x840b3[_0xbe5d('0x8')]=_0x4c7078;if(_0x7b95a6['query'][_0xbe5d('0x2c')]){_0x85b7e[_0xbe5d('0x2d')]=[{'all':!![]}];}return db[_0xbe5d('0x2b')]['findAll'](_0x85b7e);})[_0xbe5d('0xd')](function(_0x35043b){_0x840b3[_0xbe5d('0x2e')]=_0x35043b;return _0x840b3;})[_0xbe5d('0xd')](respondWithFilteredResult(_0x5f0594,_0x85b7e))[_0xbe5d('0x2f')](handleError(_0x5f0594,null));};exports['show']=function(_0x1e12c6,_0x4d0175){var _0x570db5={'raw':![],'where':{'id':_0x1e12c6['params']['id']}},_0xab5ad6={};_0xab5ad6['model']=_['keys'](db[_0xbe5d('0x2b')][_0xbe5d('0x16')]);_0xab5ad6['query']=_[_0xbe5d('0x19')](_0x1e12c6[_0xbe5d('0x1a')]);_0xab5ad6[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0xab5ad6['model'],_0xab5ad6[_0xbe5d('0x1a')]);_0x570db5[_0xbe5d('0x1d')]=_['intersection'](_0xab5ad6['model'],qs[_0xbe5d('0x1e')](_0x1e12c6[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x570db5[_0xbe5d('0x1d')]=_0x570db5[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x570db5['attributes']:_0xab5ad6[_0xbe5d('0x18')];if(_0x1e12c6[_0xbe5d('0x1a')]['includeAll']){_0x570db5[_0xbe5d('0x2d')]=[{'all':!![]}];}_0x570db5=_[_0xbe5d('0x27')]({},_0x570db5,_0x1e12c6[_0xbe5d('0x2a')]);return db[_0xbe5d('0x2b')][_0xbe5d('0x30')](_0x570db5)[_0xbe5d('0xd')](handleEntityNotFound(_0x4d0175,null))[_0xbe5d('0xd')](respondWithResult(_0x4d0175,null))[_0xbe5d('0x2f')](handleError(_0x4d0175,null));};exports[_0xbe5d('0x31')]=function(_0x3ec0c7,_0x1b3ab5){return db['Dynamics365Account'][_0xbe5d('0x31')](_0x3ec0c7[_0xbe5d('0x32')],{})['then'](respondWithResult(_0x1b3ab5,0xc9))[_0xbe5d('0x2f')](handleError(_0x1b3ab5,null));};exports[_0xbe5d('0xc')]=function(_0xdf2aef,_0x3a483e){if(_0xdf2aef[_0xbe5d('0x32')]['id']){delete _0xdf2aef[_0xbe5d('0x32')]['id'];}return db[_0xbe5d('0x2b')][_0xbe5d('0x30')]({'where':{'id':_0xdf2aef[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x3a483e,null))['then'](saveUpdates(_0xdf2aef[_0xbe5d('0x32')],null))['then'](respondWithResult(_0x3a483e,null))['catch'](handleError(_0x3a483e,null));};exports['destroy']=function(_0x224e4e,_0x1fb251){return db[_0xbe5d('0x2b')][_0xbe5d('0x30')]({'where':{'id':_0x224e4e[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x1fb251,null))[_0xbe5d('0xd')](removeEntity(_0x1fb251,null))[_0xbe5d('0x2f')](handleError(_0x1fb251,null));};exports[_0xbe5d('0x34')]=function(_0x3e7a3b,_0x1b24b4){var _0x3508db={};var _0x172a0f={};var _0x1c4d3c;var _0x3d91c8;return db['Dynamics365Account'][_0xbe5d('0x35')]({'where':{'id':_0x3e7a3b['params']['id']}})['then'](handleEntityNotFound(_0x1b24b4,null))[_0xbe5d('0xd')](function(_0x34f448){if(_0x34f448){_0x1c4d3c=_0x34f448;_0x172a0f[_0xbe5d('0x18')]=_[_0xbe5d('0x19')](db['Dynamics365Configuration'][_0xbe5d('0x16')]);_0x172a0f['query']=_['keys'](_0x3e7a3b['query']);_0x172a0f[_0xbe5d('0x1b')]=_[_0xbe5d('0x1c')](_0x172a0f[_0xbe5d('0x18')],_0x172a0f['query']);_0x3508db[_0xbe5d('0x1d')]=_[_0xbe5d('0x1c')](_0x172a0f['model'],qs[_0xbe5d('0x1e')](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x1e')]));_0x3508db['attributes']=_0x3508db[_0xbe5d('0x1d')][_0xbe5d('0x1f')]?_0x3508db[_0xbe5d('0x1d')]:_0x172a0f[_0xbe5d('0x18')];_0x3508db['order']=qs['sort'](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x23')]);_0x3508db[_0xbe5d('0x24')]=qs[_0xbe5d('0x1b')](_['pick'](_0x3e7a3b[_0xbe5d('0x1a')],_0x172a0f[_0xbe5d('0x1b')]));if(_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x26')]){_0x3508db['where']=_['merge'](_0x3508db[_0xbe5d('0x24')],{'$or':_[_0xbe5d('0x15')](_0x3508db[_0xbe5d('0x1d')],function(_0x48d95b){var _0xcbabe9={};_0xcbabe9[_0x48d95b]={'$like':'%'+_0x3e7a3b['query'][_0xbe5d('0x26')]+'%'};return _0xcbabe9;})});}_0x3508db=_[_0xbe5d('0x27')]({},_0x3508db,_0x3e7a3b[_0xbe5d('0x2a')]);return _0x1c4d3c[_0xbe5d('0x34')](_0x3508db);}})[_0xbe5d('0xd')](function(_0x404078){if(_0x404078){_0x3d91c8=_0x404078[_0xbe5d('0x1f')];if(!_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x36')]('nolimit')){_0x3508db[_0xbe5d('0x21')]=qs['limit'](_0x3e7a3b[_0xbe5d('0x1a')][_0xbe5d('0x21')]);_0x3508db[_0xbe5d('0x9')]=qs['offset'](_0x3e7a3b['query'][_0xbe5d('0x9')]);}return _0x1c4d3c[_0xbe5d('0x34')](_0x3508db);}})[_0xbe5d('0xd')](function(_0x12d3cb){if(_0x12d3cb){return _0x12d3cb?{'count':_0x3d91c8,'rows':_0x12d3cb}:null;}})['then'](respondWithResult(_0x1b24b4,null))[_0xbe5d('0x2f')](handleError(_0x1b24b4,null));};exports[_0xbe5d('0x37')]=function(_0x18a0d0,_0x17ff43){if(_0x18a0d0['body']['id']){delete _0x18a0d0[_0xbe5d('0x32')]['id'];}return db[_0xbe5d('0x2b')][_0xbe5d('0x35')]({'where':{'id':_0x18a0d0[_0xbe5d('0x33')]['id']}})[_0xbe5d('0xd')](handleEntityNotFound(_0x17ff43,null))[_0xbe5d('0xd')](function(_0x4ef3bb){if(_0x4ef3bb){_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x38')]=_0x4ef3bb['id'];_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x39')]=integrations[_0xbe5d('0x3a')](_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x3b')],_0x18a0d0[_0xbe5d('0x32')]['type']);_0x18a0d0[_0xbe5d('0x32')]['Descriptions']=integrations[_0xbe5d('0x3c')](_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x3b')],_0x18a0d0[_0xbe5d('0x32')][_0xbe5d('0x28')]);return db[_0xbe5d('0x3d')][_0xbe5d('0x31')](_0x18a0d0[_0xbe5d('0x32')],{'include':[{'model':db[_0xbe5d('0x3e')],'as':_0xbe5d('0x39')},{'model':db[_0xbe5d('0x3e')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x17ff43,null))[_0xbe5d('0x2f')](handleError(_0x17ff43,null));};function sanitizeRemoteUri(_0x3c0719){var _0x9fc580=_0x3c0719['slice'](-0x1);if(_0x9fc580==='/')return _0x3c0719[_0xbe5d('0x3f')](0x0,_0x3c0719[_0xbe5d('0x40')](_0x9fc580));return _0x3c0719;}function getWebApiUrl(_0x2ba57d){return util[_0xbe5d('0x41')]('%s/api/data/v9.0/',_0x2ba57d);}exports['getFields']=function(_0x1a5840,_0x250667){var _0x19967c=_0x1a5840[_0xbe5d('0x1a')][_0xbe5d('0x42')];var _0x3d6da3=_0x19967c===_0xbe5d('0x43')?'Incident':_0xbe5d('0x44');var _0x435eb2='';var _0x32bd8b='';var _0x59b269='';var _0x297796='';var _0x4a47a7='';var _0x2cc0fb='';var _0x2682b0='';var _0xb87cd2='';var _0x389c53=[_0xbe5d('0x45'),'description',_0xbe5d('0x46'),_0xbe5d('0x47'),_0xbe5d('0x48'),_0xbe5d('0x49'),_0xbe5d('0x4a'),_0xbe5d('0x4b'),'directioncode',_0xbe5d('0x4c')];var _0x2ed641=[_0xbe5d('0x4d'),_0xbe5d('0x4e'),_0xbe5d('0x4f'),_0xbe5d('0x50'),_0xbe5d('0x51'),_0xbe5d('0x52'),_0xbe5d('0x53'),'contractidname',_0xbe5d('0x54'),'createdbyexternalpartyyominame',_0xbe5d('0x55'),_0xbe5d('0x56'),_0xbe5d('0x57'),_0xbe5d('0x58'),'createdonbehalfbyyominame',_0xbe5d('0x59'),_0xbe5d('0x5a'),_0xbe5d('0x5b'),'emailaddress',_0xbe5d('0x5c'),_0xbe5d('0x5d'),_0xbe5d('0x5e'),_0xbe5d('0x5f'),_0xbe5d('0x60'),_0xbe5d('0x61'),_0xbe5d('0x62'),_0xbe5d('0x63'),'influencescore',_0xbe5d('0x64'),_0xbe5d('0x65'),_0xbe5d('0x66'),_0xbe5d('0x67'),_0xbe5d('0x68'),_0xbe5d('0x69'),_0xbe5d('0x6a'),_0xbe5d('0x6b'),_0xbe5d('0x6c'),_0xbe5d('0x6d'),'msdyn_incidenttypename',_0xbe5d('0x6e'),_0xbe5d('0x6f'),_0xbe5d('0x70'),'overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname',_0xbe5d('0x71'),_0xbe5d('0x72'),_0xbe5d('0x73'),'productidname',_0xbe5d('0x74'),_0xbe5d('0x75'),'resolvebykpiidname','responseby','responsiblecontactidname',_0xbe5d('0x76'),_0xbe5d('0x77'),_0xbe5d('0x78'),'slaname','socialprofileidname','statecode','statuscode',_0xbe5d('0x79'),_0xbe5d('0x7a'),_0xbe5d('0x7b'),'transactioncurrencyidname',_0xbe5d('0x7c'),_0xbe5d('0x7d'),_0xbe5d('0x7e')];var _0x107650=_0x389c53[_0xbe5d('0x7f')](_0x2ed641);return db['Dynamics365Account']['findOne']({'where':{'id':_0x1a5840['params']['id']},'attributes':['id',_0xbe5d('0x80'),'password',_0xbe5d('0x81'),'tenantId',_0xbe5d('0x82'),_0xbe5d('0x83'),_0xbe5d('0x84')],'include':[{'model':db[_0xbe5d('0x85')],'as':_0xbe5d('0x85'),'attributes':['id',_0xbe5d('0x86'),_0xbe5d('0x87')]}]})[_0xbe5d('0xd')](handleEntityNotFound(_0x250667,null))[_0xbe5d('0xd')](function(_0x4d4e25){if(_0x4d4e25){if(_0x4d4e25[_0xbe5d('0x84')]){_0x4d4e25['access_token']=_0x4d4e25[_0xbe5d('0x85')][_0xbe5d('0x86')];_0xb87cd2=sanitizeRemoteUri(_0x4d4e25[_0xbe5d('0x85')][_0xbe5d('0x87')]);_0x2682b0=getWebApiUrl(_0xb87cd2);return _0x4d4e25;}_0xb87cd2=sanitizeRemoteUri(_0x4d4e25[_0xbe5d('0x81')]);_0x2682b0=getWebApiUrl(_0xb87cd2);var _0x670b5a={'method':'POST','uri':_0xbe5d('0x88')+_0x4d4e25[_0xbe5d('0x89')]+_0xbe5d('0x8a'),'form':{'client_id':_0x4d4e25[_0xbe5d('0x82')],'resource':_0xb87cd2,'username':_0x4d4e25['username'],'password':_0x4d4e25['password'],'grant_type':'password','client_secret':_0x4d4e25[_0xbe5d('0x83')]},'json':!![]};return rp(_0x670b5a);}})[_0xbe5d('0xd')](function(_0x4e60dd){_0x2cc0fb=_0x4e60dd[_0xbe5d('0x8b')];var _0x1e79bc={'method':_0xbe5d('0x8c'),'uri':encodeURI(_0x2682b0+_0xbe5d('0x8d')+_0x3d6da3+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x2cc0fb,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x1e79bc);})[_0xbe5d('0xd')](function(_0xf3f72b){var _0x10c58b=_0xf3f72b[_0xbe5d('0x8f')][0x0];var _0x49d052=_0x10c58b[_0xbe5d('0x90')];var _0x275ce4={'method':_0xbe5d('0x8c'),'uri':_0x2682b0+_0xbe5d('0x91')+_0x49d052+_0xbe5d('0x92'),'headers':{'Authorization':'Bearer\x20'+_0x2cc0fb,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x275ce4);})[_0xbe5d('0xd')](function(_0x5920a5){_0x435eb2=_0x5920a5;_0x32bd8b=_0x435eb2['Attributes'];_0x32bd8b=_[_0xbe5d('0x93')](_0x32bd8b,function(_0x9ad49d){return!_0x107650['includes'](_0x9ad49d[_0xbe5d('0x94')]);});var _0x2f963d=[];var _0x2f95cb=[];_0x32bd8b[_0xbe5d('0x95')](function(_0x27f54c){if(_0x27f54c[_0xbe5d('0x96')]){var _0x2a5f2b=_0x27f54c[_0xbe5d('0x96')][_0xbe5d('0x3f')](_0x27f54c[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x2a5f2b===_0xbe5d('0x97')){_0x2f963d[_0xbe5d('0x98')](getSelectList(_0x2682b0,_0x19967c,_0x2f95cb,_0x435eb2[_0xbe5d('0x90')],_0x27f54c['MetadataId'],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0x2f963d);})[_0xbe5d('0xd')](function(_0x13b86d){_0x59b269=_0x13b86d[0x0];var _0x2fd9c9=[];var _0x1d5be7=[];_0x32bd8b[_0xbe5d('0x95')](function(_0x20a66d){if(!_[_0xbe5d('0x9a')](_0x20a66d[_0xbe5d('0x96')])){var _0x3feb35=_0x20a66d['@odata.type'][_0xbe5d('0x3f')](_0x20a66d[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x3feb35===_0xbe5d('0x9b')){_0x2fd9c9[_0xbe5d('0x98')](getBooleanList(_0x2682b0,_0x19967c,_0x1d5be7,_0x435eb2[_0xbe5d('0x90')],_0x20a66d[_0xbe5d('0x90')],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0x2fd9c9);})[_0xbe5d('0xd')](function(_0x36407c){_0x297796=_0x36407c[0x0];var _0xb80f03=[];var _0x582c00=[];_0x32bd8b['forEach'](function(_0x39782b){if(_0x39782b[_0xbe5d('0x96')]){var _0x35cc4d=_0x39782b['@odata.type']['substring'](_0x39782b[_0xbe5d('0x96')][_0xbe5d('0x40')]('.')+0x1);if(_0x35cc4d===_0xbe5d('0x9c')||_0x35cc4d==='DoubleAttributeMetadata'||_0x35cc4d===_0xbe5d('0x9d')||_0x35cc4d===_0xbe5d('0x9e')||_0x35cc4d===_0xbe5d('0x9f')||_0x35cc4d==='DateTimeAttributeMetadata'||_0x35cc4d==='StatusAttributeMetadata'||_0x35cc4d===_0xbe5d('0xa0')||_0x35cc4d===_0xbe5d('0xa1')||_0x35cc4d===_0xbe5d('0xa2')){_0xb80f03[_0xbe5d('0x98')](getInputList(_0x2682b0,_0x19967c,_0x35cc4d,_0x582c00,_0x435eb2['MetadataId'],_0x39782b[_0xbe5d('0x90')],_0x2cc0fb));}}});return Promise[_0xbe5d('0x99')](_0xb80f03);})[_0xbe5d('0xd')](function(_0x8b1d2c){_0x4a47a7=_0x8b1d2c[0x0];var _0x5f53a5=_0x59b269[_0xbe5d('0x7f')](_0x297796)[_0xbe5d('0x7f')](_0x4a47a7);var _0x1c1b15={'count':_0x5f53a5[_0xbe5d('0x1f')],'rows':_0x5f53a5};return _0x1c1b15;})[_0xbe5d('0xd')](respondWithResult(_0x250667,null))['catch'](function(_0x246e88){var _0x280b50=_0x1a5840[_0xbe5d('0x1a')]['test']?0x1f4:_0x246e88[_0xbe5d('0xa3')]||0x1f4;logger['error'](_0x246e88['stack']);delete _0x246e88[_0xbe5d('0x12')];if(_0x280b50===0x191){_0x280b50=0x190;}_0x250667[_0xbe5d('0x5')](_0x280b50)[_0xbe5d('0x13')](_0x1a5840[_0xbe5d('0x1a')][_0xbe5d('0xa4')]?{'message':_0xbe5d('0xa5'),'statusCode':_0x246e88[_0xbe5d('0xa3')]}:_0x246e88);});};function getSelectList(_0x1c4b3a,_0x245176,_0x2936f5,_0x212c9c,_0x28d739,_0x5e4a8f){var _0x1e788e={'method':_0xbe5d('0x8c'),'uri':_0x1c4b3a+_0xbe5d('0x91')+_0x212c9c+_0xbe5d('0xa6')+_0x28d739+_0xbe5d('0xa7')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x5e4a8f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1e788e)[_0xbe5d('0xd')](function(_0x1868e4){var _0x5d9d7a=[];var _0x41a771=_0x1868e4[_0xbe5d('0xa8')][_0xbe5d('0xa9')];_0x41a771[_0xbe5d('0x95')](function(_0x545aeb){_0x5d9d7a[_0xbe5d('0x98')]({'name':_0x545aeb[_0xbe5d('0xaa')][_0xbe5d('0xab')][_0xbe5d('0xaa')],'value':String(_0x545aeb[_0xbe5d('0xac')])});});var _0x35bf2d={'id':_0x245176+'_'+_0x1868e4[_0xbe5d('0x94')],'name':_0x1868e4[_0xbe5d('0xad')][_0xbe5d('0xab')][_0xbe5d('0xaa')],'custom':![],'options':_0x5d9d7a};_0x2936f5['push'](_0x35bf2d);return _0x2936f5;});}function getBooleanList(_0x3a6f6f,_0x54470b,_0xa808d2,_0x254995,_0xb2f433,_0x69017){var _0x2d6a12={'method':_0xbe5d('0x8c'),'uri':_0x3a6f6f+_0xbe5d('0x91')+_0x254995+_0xbe5d('0xa6')+_0xb2f433+_0xbe5d('0xae'),'headers':{'Authorization':_0xbe5d('0xaf')+_0x69017,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x2d6a12)['then'](function(_0x228d65){var _0x15b812=[];_0x15b812[_0xbe5d('0x98')]({'name':_0x228d65['OptionSet'][_0xbe5d('0xb0')][_0xbe5d('0xaa')]['UserLocalizedLabel']['Label'],'value':_0xbe5d('0xb1')},{'name':_0x228d65[_0xbe5d('0xa8')][_0xbe5d('0xb2')][_0xbe5d('0xaa')][_0xbe5d('0xab')]['Label'],'value':_0xbe5d('0xb3')});var _0x3eabb1={'id':_0x54470b+'_'+_0x228d65[_0xbe5d('0x94')],'name':_0x228d65[_0xbe5d('0xad')][_0xbe5d('0xab')]['Label'],'custom':![],'options':_0x15b812};_0xa808d2[_0xbe5d('0x98')](_0x3eabb1);return _0xa808d2;});}function getInputList(_0x467c87,_0x2efc6a,_0x1c85f1,_0x2caf0f,_0x47eda7,_0x35ca2b,_0x419964){var _0x2b58d6={'method':_0xbe5d('0x8c'),'uri':_0x467c87+_0xbe5d('0x91')+_0x47eda7+_0xbe5d('0xa6')+_0x35ca2b+_0xbe5d('0xb4')+_0x1c85f1+_0xbe5d('0xb5'),'headers':{'Authorization':_0xbe5d('0xaf')+_0x419964,'If-None-Match':null,'OData-Version':_0xbe5d('0x8e')},'json':!![]};return rp(_0x2b58d6)[_0xbe5d('0xd')](function(_0x42ab61){var _0x2af1f8={'id':_0x2efc6a+'_'+_0x42ab61[_0xbe5d('0x94')],'name':_0x42ab61['DisplayName'][_0xbe5d('0xab')]?_0x42ab61[_0xbe5d('0xad')][_0xbe5d('0xab')]['Label']:_0x42ab61[_0xbe5d('0x94')],'custom':![],'options':[]};_0x2caf0f[_0xbe5d('0x98')](_0x2af1f8);return _0x2caf0f;});} \ No newline at end of file +var _0x49f5=['LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','push','test','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','Options','Label','Value'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x49f5,0x18c));var _0x549f=function(_0x5446a1,_0x512ddd){_0x5446a1=_0x5446a1-0x0;var _0x388d39=_0x49f5[_0x5446a1];return _0x388d39;};'use strict';var rp=require(_0x549f('0x0'));var util=require(_0x549f('0x1'));var _=require('lodash');var qs=require(_0x549f('0x2'));var logger=require(_0x549f('0x3'))(_0x549f('0x4'));var db=require(_0x549f('0x5'))['db'];var integrations=require(_0x549f('0x6'));function respondWithResult(_0x5a0a9a,_0x5cf98e){_0x5cf98e=_0x5cf98e||0xc8;return function(_0x14acd0){if(_0x14acd0){return _0x5a0a9a[_0x549f('0x7')](_0x5cf98e)[_0x549f('0x8')](_0x14acd0);}};}function respondWithFilteredResult(_0x231e26,_0x2480a3){return function(_0x586cd7){if(_0x586cd7){var _0x4e5c3e=typeof _0x2480a3['offset']===_0x549f('0x9')&&typeof _0x2480a3[_0x549f('0xa')]===_0x549f('0x9');var _0x341726=_0x586cd7[_0x549f('0xb')];var _0x13188d=_0x4e5c3e?0x0:_0x2480a3[_0x549f('0xc')];var _0x1813d7=_0x4e5c3e?_0x586cd7[_0x549f('0xb')]:_0x2480a3[_0x549f('0xc')]+_0x2480a3[_0x549f('0xa')];var _0xcc61e2;if(_0x1813d7>=_0x341726){_0x1813d7=_0x341726;_0xcc61e2=0xc8;}else{_0xcc61e2=0xce;}_0x231e26[_0x549f('0x7')](_0xcc61e2);return _0x231e26['set']('Content-Range',_0x13188d+'-'+_0x1813d7+'/'+_0x341726)['json'](_0x586cd7);}return null;};}function saveUpdates(_0x21f56c){return function(_0x2a893c){if(_0x2a893c){return _0x2a893c['update'](_0x21f56c)[_0x549f('0xd')](function(_0x330a8f){return _0x330a8f;});}return null;};}function removeEntity(_0x1ab562){return function(_0x39098a){if(_0x39098a){return _0x39098a['destroy']()[_0x549f('0xd')](function(){_0x1ab562[_0x549f('0x7')](0xcc)[_0x549f('0xe')]();});}};}function handleEntityNotFound(_0x1cbfbb){return function(_0x8870d7){if(!_0x8870d7){_0x1cbfbb[_0x549f('0xf')](0x194);}return _0x8870d7;};}function handleError(_0x13472d,_0x3853ac){_0x3853ac=_0x3853ac||0x1f4;return function(_0x48ece9){logger[_0x549f('0x10')](_0x48ece9[_0x549f('0x11')]);if(_0x48ece9[_0x549f('0x12')]){delete _0x48ece9[_0x549f('0x12')];}_0x13472d[_0x549f('0x7')](_0x3853ac)[_0x549f('0x13')](_0x48ece9);};}exports[_0x549f('0x14')]=function(_0x62a388,_0x46d3db){var _0xee22fa={},_0x406163={},_0x26338f={'count':0x0,'rows':[]};var _0x4c5c36=_[_0x549f('0x15')](db[_0x549f('0x16')]['rawAttributes'],function(_0x3906e5){return{'name':_0x3906e5[_0x549f('0x17')],'type':_0x3906e5['type'][_0x549f('0x18')]};});_0x406163['model']=_['map'](_0x4c5c36,'name');_0x406163['query']=_[_0x549f('0x19')](_0x62a388[_0x549f('0x1a')]);_0x406163[_0x549f('0x1b')]=_[_0x549f('0x1c')](_0x406163[_0x549f('0x1d')],_0x406163[_0x549f('0x1a')]);_0xee22fa[_0x549f('0x1e')]=_[_0x549f('0x1c')](_0x406163[_0x549f('0x1d')],qs['fields'](_0x62a388[_0x549f('0x1a')][_0x549f('0x1f')]));_0xee22fa[_0x549f('0x1e')]=_0xee22fa[_0x549f('0x1e')]['length']?_0xee22fa[_0x549f('0x1e')]:_0x406163[_0x549f('0x1d')];if(!_0x62a388[_0x549f('0x1a')][_0x549f('0x20')](_0x549f('0x21'))){_0xee22fa[_0x549f('0xa')]=qs[_0x549f('0xa')](_0x62a388[_0x549f('0x1a')][_0x549f('0xa')]);_0xee22fa[_0x549f('0xc')]=qs[_0x549f('0xc')](_0x62a388[_0x549f('0x1a')][_0x549f('0xc')]);}_0xee22fa['order']=qs[_0x549f('0x22')](_0x62a388[_0x549f('0x1a')][_0x549f('0x22')]);_0xee22fa[_0x549f('0x23')]=qs[_0x549f('0x1b')](_[_0x549f('0x24')](_0x62a388[_0x549f('0x1a')],_0x406163[_0x549f('0x1b')]),_0x4c5c36);if(_0x62a388[_0x549f('0x1a')][_0x549f('0x25')]){_0xee22fa[_0x549f('0x23')]=_[_0x549f('0x26')](_0xee22fa[_0x549f('0x23')],{'$or':_[_0x549f('0x15')](_0x4c5c36,function(_0x54ac8f){if(_0x54ac8f[_0x549f('0x27')]!==_0x549f('0x28')){var _0x4f17cc={};_0x4f17cc[_0x54ac8f[_0x549f('0x12')]]={'$like':'%'+_0x62a388['query'][_0x549f('0x25')]+'%'};return _0x4f17cc;}})});}_0xee22fa=_[_0x549f('0x26')]({},_0xee22fa,_0x62a388[_0x549f('0x29')]);var _0x4a2ac3={'where':_0xee22fa['where']};return db[_0x549f('0x16')][_0x549f('0xb')](_0x4a2ac3)[_0x549f('0xd')](function(_0x31847d){_0x26338f[_0x549f('0xb')]=_0x31847d;if(_0x62a388[_0x549f('0x1a')][_0x549f('0x2a')]){_0xee22fa[_0x549f('0x2b')]=[{'all':!![]}];}return db[_0x549f('0x16')][_0x549f('0x2c')](_0xee22fa);})[_0x549f('0xd')](function(_0x48b969){_0x26338f[_0x549f('0x2d')]=_0x48b969;return _0x26338f;})[_0x549f('0xd')](respondWithFilteredResult(_0x46d3db,_0xee22fa))[_0x549f('0x2e')](handleError(_0x46d3db,null));};exports[_0x549f('0x2f')]=function(_0x4ee4c0,_0x4087fb){var _0x783c36={'raw':![],'where':{'id':_0x4ee4c0[_0x549f('0x30')]['id']}},_0xad3c4e={};_0xad3c4e[_0x549f('0x1d')]=_[_0x549f('0x19')](db['Dynamics365Account'][_0x549f('0x31')]);_0xad3c4e[_0x549f('0x1a')]=_[_0x549f('0x19')](_0x4ee4c0[_0x549f('0x1a')]);_0xad3c4e[_0x549f('0x1b')]=_[_0x549f('0x1c')](_0xad3c4e[_0x549f('0x1d')],_0xad3c4e[_0x549f('0x1a')]);_0x783c36[_0x549f('0x1e')]=_[_0x549f('0x1c')](_0xad3c4e[_0x549f('0x1d')],qs[_0x549f('0x1f')](_0x4ee4c0[_0x549f('0x1a')][_0x549f('0x1f')]));_0x783c36[_0x549f('0x1e')]=_0x783c36[_0x549f('0x1e')][_0x549f('0x32')]?_0x783c36[_0x549f('0x1e')]:_0xad3c4e[_0x549f('0x1d')];if(_0x4ee4c0[_0x549f('0x1a')][_0x549f('0x2a')]){_0x783c36[_0x549f('0x2b')]=[{'all':!![]}];}_0x783c36=_[_0x549f('0x26')]({},_0x783c36,_0x4ee4c0[_0x549f('0x29')]);return db[_0x549f('0x16')][_0x549f('0x33')](_0x783c36)[_0x549f('0xd')](handleEntityNotFound(_0x4087fb,null))[_0x549f('0xd')](respondWithResult(_0x4087fb,null))[_0x549f('0x2e')](handleError(_0x4087fb,null));};exports[_0x549f('0x34')]=function(_0x47fb96,_0x38dc85){return db[_0x549f('0x16')][_0x549f('0x34')](_0x47fb96[_0x549f('0x35')],{})[_0x549f('0xd')](respondWithResult(_0x38dc85,0xc9))[_0x549f('0x2e')](handleError(_0x38dc85,null));};exports[_0x549f('0x36')]=function(_0x447490,_0x45942a){if(_0x447490['body']['id']){delete _0x447490['body']['id'];}return db[_0x549f('0x16')][_0x549f('0x33')]({'where':{'id':_0x447490[_0x549f('0x30')]['id']}})[_0x549f('0xd')](handleEntityNotFound(_0x45942a,null))[_0x549f('0xd')](saveUpdates(_0x447490[_0x549f('0x35')],null))[_0x549f('0xd')](respondWithResult(_0x45942a,null))['catch'](handleError(_0x45942a,null));};exports[_0x549f('0x37')]=function(_0x258504,_0x58aad7){return db[_0x549f('0x16')]['find']({'where':{'id':_0x258504['params']['id']}})['then'](handleEntityNotFound(_0x58aad7,null))[_0x549f('0xd')](removeEntity(_0x58aad7,null))[_0x549f('0x2e')](handleError(_0x58aad7,null));};exports[_0x549f('0x38')]=function(_0x3e1f02,_0x5b0ece){var _0x2f4689={};var _0x5a2f6e={};var _0x2a2ba0;var _0x3aea78;return db[_0x549f('0x16')]['findOne']({'where':{'id':_0x3e1f02[_0x549f('0x30')]['id']}})[_0x549f('0xd')](handleEntityNotFound(_0x5b0ece,null))[_0x549f('0xd')](function(_0x4997e7){if(_0x4997e7){_0x2a2ba0=_0x4997e7;_0x5a2f6e[_0x549f('0x1d')]=_[_0x549f('0x19')](db[_0x549f('0x39')][_0x549f('0x31')]);_0x5a2f6e[_0x549f('0x1a')]=_['keys'](_0x3e1f02['query']);_0x5a2f6e[_0x549f('0x1b')]=_['intersection'](_0x5a2f6e['model'],_0x5a2f6e['query']);_0x2f4689[_0x549f('0x1e')]=_['intersection'](_0x5a2f6e[_0x549f('0x1d')],qs[_0x549f('0x1f')](_0x3e1f02[_0x549f('0x1a')][_0x549f('0x1f')]));_0x2f4689['attributes']=_0x2f4689[_0x549f('0x1e')][_0x549f('0x32')]?_0x2f4689[_0x549f('0x1e')]:_0x5a2f6e['model'];_0x2f4689[_0x549f('0x3a')]=qs['sort'](_0x3e1f02[_0x549f('0x1a')]['sort']);_0x2f4689[_0x549f('0x23')]=qs[_0x549f('0x1b')](_[_0x549f('0x24')](_0x3e1f02[_0x549f('0x1a')],_0x5a2f6e[_0x549f('0x1b')]));if(_0x3e1f02[_0x549f('0x1a')][_0x549f('0x25')]){_0x2f4689[_0x549f('0x23')]=_[_0x549f('0x26')](_0x2f4689['where'],{'$or':_['map'](_0x2f4689['attributes'],function(_0xa86ca5){var _0x597c4c={};_0x597c4c[_0xa86ca5]={'$like':'%'+_0x3e1f02[_0x549f('0x1a')]['filter']+'%'};return _0x597c4c;})});}_0x2f4689=_[_0x549f('0x26')]({},_0x2f4689,_0x3e1f02[_0x549f('0x29')]);return _0x2a2ba0[_0x549f('0x38')](_0x2f4689);}})[_0x549f('0xd')](function(_0x3c00af){if(_0x3c00af){_0x3aea78=_0x3c00af['length'];if(!_0x3e1f02[_0x549f('0x1a')][_0x549f('0x20')]('nolimit')){_0x2f4689[_0x549f('0xa')]=qs[_0x549f('0xa')](_0x3e1f02[_0x549f('0x1a')][_0x549f('0xa')]);_0x2f4689[_0x549f('0xc')]=qs['offset'](_0x3e1f02['query'][_0x549f('0xc')]);}return _0x2a2ba0[_0x549f('0x38')](_0x2f4689);}})[_0x549f('0xd')](function(_0x1912bc){if(_0x1912bc){return _0x1912bc?{'count':_0x3aea78,'rows':_0x1912bc}:null;}})[_0x549f('0xd')](respondWithResult(_0x5b0ece,null))['catch'](handleError(_0x5b0ece,null));};exports[_0x549f('0x3b')]=function(_0x4855db,_0x46ab58){if(_0x4855db[_0x549f('0x35')]['id']){delete _0x4855db[_0x549f('0x35')]['id'];}return db['Dynamics365Account'][_0x549f('0x3c')]({'where':{'id':_0x4855db[_0x549f('0x30')]['id']}})[_0x549f('0xd')](handleEntityNotFound(_0x46ab58,null))['then'](function(_0x288880){if(_0x288880){_0x4855db['body'][_0x549f('0x3d')]=_0x288880['id'];_0x4855db[_0x549f('0x35')][_0x549f('0x3e')]=integrations[_0x549f('0x3f')](_0x4855db[_0x549f('0x35')][_0x549f('0x40')],_0x4855db[_0x549f('0x35')][_0x549f('0x27')]);_0x4855db['body'][_0x549f('0x41')]=integrations[_0x549f('0x42')](_0x4855db[_0x549f('0x35')]['channel'],_0x4855db['body'][_0x549f('0x27')]);return db[_0x549f('0x39')][_0x549f('0x34')](_0x4855db['body'],{'include':[{'model':db[_0x549f('0x43')],'as':'Subjects'},{'model':db[_0x549f('0x43')],'as':_0x549f('0x41')}]});}return null;})[_0x549f('0xd')](respondWithResult(_0x46ab58,null))[_0x549f('0x2e')](handleError(_0x46ab58,null));};function sanitizeRemoteUri(_0x55961b){var _0x351eaa=_0x55961b[_0x549f('0x44')](-0x1);if(_0x351eaa==='/')return _0x55961b[_0x549f('0x45')](0x0,_0x55961b[_0x549f('0x46')](_0x351eaa));return _0x55961b;}function getWebApiUrl(_0x178743){return util[_0x549f('0x47')](_0x549f('0x48'),_0x178743);}exports[_0x549f('0x49')]=function(_0x4d25b0,_0x3bca44){var _0x52d351=_0x4d25b0['query'][_0x549f('0x4a')];var _0x5a9c7f=_0x52d351==='incident'?'Incident':_0x549f('0x4b');var _0x2911bc='';var _0x4b52f6='';var _0x1ea18a='';var _0x220826='';var _0x11a8a6='';var _0xadf8dd='';var _0xee2ee8='';var _0xc12f99='';var _0x2dcaec=[_0x549f('0x4c'),_0x549f('0x4d'),_0x549f('0x4e'),_0x549f('0x4f'),_0x549f('0x50'),_0x549f('0x51'),_0x549f('0x52'),'regardingobjectid','directioncode',_0x549f('0x53')];var _0x590ff1=[_0x549f('0x54'),_0x549f('0x55'),_0x549f('0x56'),_0x549f('0x57'),'contactidname',_0x549f('0x58'),_0x549f('0x59'),_0x549f('0x5a'),'createdbyexternalpartyname','createdbyexternalpartyyominame',_0x549f('0x5b'),'createdbyyominame',_0x549f('0x5c'),_0x549f('0x5d'),_0x549f('0x5e'),'customeridname','customeridtype',_0x549f('0x5f'),_0x549f('0x60'),_0x549f('0x61'),_0x549f('0x62'),_0x549f('0x63'),'escalatedon',_0x549f('0x64'),_0x549f('0x65'),'followupby',_0x549f('0x66'),'influencescore',_0x549f('0x67'),_0x549f('0x68'),_0x549f('0x69'),_0x549f('0x6a'),_0x549f('0x6b'),_0x549f('0x6c'),_0x549f('0x6d'),_0x549f('0x6e'),_0x549f('0x6f'),_0x549f('0x70'),'msdyn_incidenttypename',_0x549f('0x71'),_0x549f('0x72'),'onholdtime',_0x549f('0x73'),'owneridname','owneridtype',_0x549f('0x74'),_0x549f('0x75'),_0x549f('0x76'),_0x549f('0x77'),_0x549f('0x78'),_0x549f('0x79'),'productserialnumber',_0x549f('0x7a'),'resolvebykpiidname',_0x549f('0x7b'),_0x549f('0x7c'),'responsiblecontactidyominame',_0x549f('0x7d'),'slainvokedidname',_0x549f('0x7e'),_0x549f('0x7f'),_0x549f('0x80'),_0x549f('0x81'),'subjectidname',_0x549f('0x82'),_0x549f('0x83'),_0x549f('0x84'),'traversedpath',_0x549f('0x85'),_0x549f('0x86')];var _0x2c7172=_0x2dcaec[_0x549f('0x87')](_0x590ff1);return db[_0x549f('0x16')][_0x549f('0x3c')]({'where':{'id':_0x4d25b0[_0x549f('0x30')]['id']},'attributes':['id',_0x549f('0x88'),_0x549f('0x89'),_0x549f('0x8a'),_0x549f('0x8b'),_0x549f('0x8c'),_0x549f('0x8d'),_0x549f('0x8e')],'include':[{'model':db['CloudProvider'],'as':_0x549f('0x8f'),'attributes':['id',_0x549f('0x90'),_0x549f('0x91')]}]})['then'](handleEntityNotFound(_0x3bca44,null))[_0x549f('0xd')](function(_0xdf0ab9){if(_0xdf0ab9){if(_0xdf0ab9[_0x549f('0x8e')]){_0xdf0ab9[_0x549f('0x92')]=_0xdf0ab9[_0x549f('0x8f')][_0x549f('0x90')];_0xc12f99=sanitizeRemoteUri(_0xdf0ab9['CloudProvider'][_0x549f('0x91')]);_0xee2ee8=getWebApiUrl(_0xc12f99);return _0xdf0ab9;}_0xc12f99=sanitizeRemoteUri(_0xdf0ab9['remoteUri']);_0xee2ee8=getWebApiUrl(_0xc12f99);var _0x20ac47={'method':_0x549f('0x93'),'uri':_0x549f('0x94')+_0xdf0ab9[_0x549f('0x8b')]+_0x549f('0x95'),'form':{'client_id':_0xdf0ab9['clientId'],'resource':_0xc12f99,'username':_0xdf0ab9[_0x549f('0x88')],'password':_0xdf0ab9['password'],'grant_type':_0x549f('0x89'),'client_secret':_0xdf0ab9['clientSecret']},'json':!![]};return rp(_0x20ac47);}})[_0x549f('0xd')](function(_0x16c2a0){_0xadf8dd=_0x16c2a0[_0x549f('0x92')];var _0x222d8d={'method':_0x549f('0x96'),'uri':encodeURI(_0xee2ee8+_0x549f('0x97')+_0x5a9c7f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0xadf8dd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x222d8d);})[_0x549f('0xd')](function(_0x26930d){var _0x36047f=_0x26930d[_0x549f('0x98')][0x0];var _0xeff34a=_0x36047f['MetadataId'];var _0x33b450={'method':_0x549f('0x96'),'uri':_0xee2ee8+'EntityDefinitions('+_0xeff34a+_0x549f('0x99'),'headers':{'Authorization':_0x549f('0x9a')+_0xadf8dd,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x33b450);})[_0x549f('0xd')](function(_0x51dded){_0x2911bc=_0x51dded;_0x4b52f6=_0x2911bc[_0x549f('0x9b')];_0x4b52f6=_[_0x549f('0x9c')](_0x4b52f6,function(_0x2a7bc9){return!_0x2c7172[_0x549f('0x9d')](_0x2a7bc9['LogicalName']);});var _0x5a27f5=[];var _0x30ee03=[];_0x4b52f6[_0x549f('0x9e')](function(_0x2d2e92){if(_0x2d2e92['@odata.type']){var _0x5a8eb1=_0x2d2e92[_0x549f('0x9f')][_0x549f('0x45')](_0x2d2e92[_0x549f('0x9f')][_0x549f('0x46')]('.')+0x1);if(_0x5a8eb1===_0x549f('0xa0')){_0x5a27f5['push'](getSelectList(_0xee2ee8,_0x52d351,_0x30ee03,_0x2911bc[_0x549f('0xa1')],_0x2d2e92['MetadataId'],_0xadf8dd));}}});return Promise['all'](_0x5a27f5);})['then'](function(_0x4671a7){_0x1ea18a=_0x4671a7[0x0];var _0x524ca7=[];var _0x44f72f=[];_0x4b52f6[_0x549f('0x9e')](function(_0x312d36){if(!_[_0x549f('0xa2')](_0x312d36[_0x549f('0x9f')])){var _0x38ecc5=_0x312d36[_0x549f('0x9f')][_0x549f('0x45')](_0x312d36[_0x549f('0x9f')][_0x549f('0x46')]('.')+0x1);if(_0x38ecc5===_0x549f('0xa3')){_0x524ca7['push'](getBooleanList(_0xee2ee8,_0x52d351,_0x44f72f,_0x2911bc['MetadataId'],_0x312d36[_0x549f('0xa1')],_0xadf8dd));}}});return Promise[_0x549f('0xa4')](_0x524ca7);})['then'](function(_0x3b9d15){_0x220826=_0x3b9d15[0x0];var _0x1ff3af=[];var _0x56914c=[];_0x4b52f6[_0x549f('0x9e')](function(_0x514fac){if(_0x514fac[_0x549f('0x9f')]){var _0x4c6bfe=_0x514fac[_0x549f('0x9f')][_0x549f('0x45')](_0x514fac[_0x549f('0x9f')][_0x549f('0x46')]('.')+0x1);if(_0x4c6bfe===_0x549f('0xa5')||_0x4c6bfe===_0x549f('0xa6')||_0x4c6bfe==='BigIntAttributeMetadata'||_0x4c6bfe==='IntegerAttributeMetadata'||_0x4c6bfe===_0x549f('0xa7')||_0x4c6bfe===_0x549f('0xa8')||_0x4c6bfe===_0x549f('0xa9')||_0x4c6bfe===_0x549f('0xaa')||_0x4c6bfe===_0x549f('0xab')||_0x4c6bfe==='DecimalAttributeMetadata'){_0x1ff3af[_0x549f('0xac')](getInputList(_0xee2ee8,_0x52d351,_0x4c6bfe,_0x56914c,_0x2911bc['MetadataId'],_0x514fac[_0x549f('0xa1')],_0xadf8dd));}}});return Promise[_0x549f('0xa4')](_0x1ff3af);})[_0x549f('0xd')](function(_0x903246){_0x11a8a6=_0x903246[0x0];var _0x3c45a3=_0x1ea18a[_0x549f('0x87')](_0x220826)[_0x549f('0x87')](_0x11a8a6);var _0xe129cb={'count':_0x3c45a3['length'],'rows':_0x3c45a3};return _0xe129cb;})[_0x549f('0xd')](respondWithResult(_0x3bca44,null))[_0x549f('0x2e')](function(_0xf91bb3){var _0x559a5d=_0x4d25b0[_0x549f('0x1a')][_0x549f('0xad')]?0x1f4:_0xf91bb3['statusCode']||0x1f4;logger[_0x549f('0x10')](_0xf91bb3[_0x549f('0x11')]);delete _0xf91bb3[_0x549f('0x12')];if(_0x559a5d===0x191){_0x559a5d=0x190;}_0x3bca44[_0x549f('0x7')](_0x559a5d)[_0x549f('0x13')](_0x4d25b0[_0x549f('0x1a')][_0x549f('0xad')]?{'message':'Wrong\x20credentials','statusCode':_0xf91bb3[_0x549f('0xae')]}:_0xf91bb3);});};function getSelectList(_0x1f0c56,_0x1e8321,_0xf5a430,_0x2de353,_0x4d5225,_0x33226f){var _0x2e6c63={'method':_0x549f('0x96'),'uri':_0x1f0c56+_0x549f('0xaf')+_0x2de353+_0x549f('0xb0')+_0x4d5225+_0x549f('0xb1')+_0x549f('0xb2'),'headers':{'Authorization':_0x549f('0x9a')+_0x33226f,'If-None-Match':null,'OData-Version':_0x549f('0xb3')},'json':!![]};return rp(_0x2e6c63)[_0x549f('0xd')](function(_0x312000){var _0xcc8214=[];var _0x2ebb61=_0x312000['OptionSet'][_0x549f('0xb4')];_0x2ebb61[_0x549f('0x9e')](function(_0x5e6550){_0xcc8214[_0x549f('0xac')]({'name':_0x5e6550['Label']['UserLocalizedLabel'][_0x549f('0xb5')],'value':String(_0x5e6550[_0x549f('0xb6')])});});var _0xbb0cb0={'id':_0x1e8321+'_'+_0x312000[_0x549f('0xb7')],'name':_0x312000[_0x549f('0xb8')][_0x549f('0xb9')]['Label'],'custom':![],'options':_0xcc8214};_0xf5a430[_0x549f('0xac')](_0xbb0cb0);return _0xf5a430;});}function getBooleanList(_0x483ff1,_0x3130e4,_0x38054a,_0xcb42dd,_0x4fb634,_0x1681ff){var _0x1fac07={'method':_0x549f('0x96'),'uri':_0x483ff1+'EntityDefinitions('+_0xcb42dd+_0x549f('0xb0')+_0x4fb634+_0x549f('0xba'),'headers':{'Authorization':'Bearer\x20'+_0x1681ff,'If-None-Match':null,'OData-Version':_0x549f('0xb3')},'json':!![]};return rp(_0x1fac07)[_0x549f('0xd')](function(_0x10caef){var _0x4bd9b4=[];_0x4bd9b4['push']({'name':_0x10caef[_0x549f('0xbb')][_0x549f('0xbc')]['Label'][_0x549f('0xb9')][_0x549f('0xb5')],'value':_0x549f('0xbd')},{'name':_0x10caef[_0x549f('0xbb')][_0x549f('0xbe')][_0x549f('0xb5')][_0x549f('0xb9')][_0x549f('0xb5')],'value':'false'});var _0x48e511={'id':_0x3130e4+'_'+_0x10caef[_0x549f('0xb7')],'name':_0x10caef[_0x549f('0xb8')][_0x549f('0xb9')][_0x549f('0xb5')],'custom':![],'options':_0x4bd9b4};_0x38054a[_0x549f('0xac')](_0x48e511);return _0x38054a;});}function getInputList(_0x58d18c,_0x42e877,_0x3c8547,_0x396e80,_0x3a240c,_0x31e699,_0x810bed){var _0x557c9b={'method':'GET','uri':_0x58d18c+_0x549f('0xaf')+_0x3a240c+_0x549f('0xb0')+_0x31e699+_0x549f('0xbf')+_0x3c8547+_0x549f('0xc0'),'headers':{'Authorization':_0x549f('0x9a')+_0x810bed,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x557c9b)[_0x549f('0xd')](function(_0x5496c4){var _0x40c90f={'id':_0x42e877+'_'+_0x5496c4[_0x549f('0xb7')],'name':_0x5496c4[_0x549f('0xb8')][_0x549f('0xb9')]?_0x5496c4[_0x549f('0xb8')][_0x549f('0xb9')]['Label']:_0x5496c4[_0x549f('0xb7')],'custom':![],'options':[]};_0x396e80[_0x549f('0xac')](_0x40c90f);return _0x396e80;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 470cf6e..abf3d43 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x7276e9,_0x44642c){var _0x8bb8fc=function(_0x8bde73){while(--_0x8bde73){_0x7276e9['push'](_0x7276e9['shift']());}};_0x8bb8fc(++_0x44642c);}(_0x757a,0xde));var _0xa757=function(_0x4f11ca,_0x5c8418){_0x4f11ca=_0x4f11ca-0x0;var _0x480c73=_0x757a[_0x4f11ca];return _0x480c73;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x37b6a7,_0x538ebf){var _0x4b4b5c=function(_0x2914ec){while(--_0x2914ec){_0x37b6a7['push'](_0x37b6a7['shift']());}};_0x4b4b5c(++_0x538ebf);}(_0xe706,0xa3));var _0x6e70=function(_0x33501f,_0x2cae5){_0x33501f=_0x33501f-0x0;var _0x3e3713=_0xe706[_0x33501f];return _0x3e3713;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index a1c4699..8979ccd 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 _0x0eac=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','GetDynamics365Account','ShowDynamics365Account','find','catch'];(function(_0x167c28,_0x4b86e2){var _0x11dd22=function(_0x441497){while(--_0x441497){_0x167c28['push'](_0x167c28['shift']());}};_0x11dd22(++_0x4b86e2);}(_0x0eac,0x1e1));var _0xc0ea=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x0eac[_0x38ce4c];return _0x5d4544;};'use strict';var _=require(_0xc0ea('0x0'));var util=require(_0xc0ea('0x1'));var moment=require(_0xc0ea('0x2'));var BPromise=require(_0xc0ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0ea('0x4'));var db=require(_0xc0ea('0x5'))['db'];var utils=require(_0xc0ea('0x6'));var logger=require(_0xc0ea('0x7'))(_0xc0ea('0x8'));var config=require(_0xc0ea('0x9'));var jayson=require(_0xc0ea('0xa'));var client=jayson[_0xc0ea('0xb')][_0xc0ea('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x397f9f,_0x16d41c,_0x2499c5){return new BPromise(function(_0x25f321,_0x44746f){return client['request'](_0x397f9f,_0x2499c5)['then'](function(_0xc2a5dc){logger[_0xc0ea('0xd')](_0xc0ea('0xe'),_0x16d41c,'request\x20sent');logger[_0xc0ea('0xf')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x16d41c,_0xc0ea('0x10'),JSON[_0xc0ea('0x11')](_0xc2a5dc));if(_0xc2a5dc[_0xc0ea('0x12')]){if(_0xc2a5dc[_0xc0ea('0x12')][_0xc0ea('0x13')]===0x1f4){logger[_0xc0ea('0x12')](_0xc0ea('0xe'),_0x16d41c,_0xc2a5dc[_0xc0ea('0x12')]['message']);return _0x44746f(_0xc2a5dc['error'][_0xc0ea('0x14')]);}logger[_0xc0ea('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x16d41c,_0xc2a5dc[_0xc0ea('0x12')][_0xc0ea('0x14')]);return _0x25f321(_0xc2a5dc[_0xc0ea('0x12')]['message']);}else{logger[_0xc0ea('0xd')](_0xc0ea('0xe'),_0x16d41c,_0xc0ea('0x10'));_0x25f321(_0xc2a5dc[_0xc0ea('0x15')][_0xc0ea('0x14')]);}})['catch'](function(_0x3b4e50){logger[_0xc0ea('0x12')](_0xc0ea('0xe'),_0x16d41c,_0x3b4e50);_0x44746f(_0x3b4e50);});});}exports['GetDynamics365Account']=function(_0x51d295){var _0x5007dc=this;return new Promise(function(_0x5e8d39,_0x2f58fc){return db[_0xc0ea('0x16')][_0xc0ea('0x17')]({'raw':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x19')]===undefined?!![]:![]:!![],'where':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1a')]||null:null,'attributes':_0x51d295['options']?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1b')]||null:null,'limit':_0x51d295[_0xc0ea('0x18')]?_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1c')]||null:null,'include':_0x51d295['options']?_0x51d295[_0xc0ea('0x18')]['include']?_[_0xc0ea('0x1d')](_0x51d295[_0xc0ea('0x18')][_0xc0ea('0x1e')],function(_0x2d3ccc){return{'model':db[_0x2d3ccc[_0xc0ea('0x1f')]],'as':_0x2d3ccc['as'],'attributes':_0x2d3ccc[_0xc0ea('0x1b')],'include':_0x2d3ccc[_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x2d3ccc[_0xc0ea('0x1e')],function(_0x1bf6bf){return{'model':db[_0x1bf6bf[_0xc0ea('0x1f')]],'as':_0x1bf6bf['as'],'attributes':_0x1bf6bf[_0xc0ea('0x1b')],'include':_0x1bf6bf['include']?_[_0xc0ea('0x1d')](_0x1bf6bf[_0xc0ea('0x1e')],function(_0x1fa258){return{'model':db[_0x1fa258['model']],'as':_0x1fa258['as'],'attributes':_0x1fa258[_0xc0ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0ea('0x20')](function(_0x2593cb){logger[_0xc0ea('0xd')](_0xc0ea('0x21'),_0x51d295);logger[_0xc0ea('0xf')](_0xc0ea('0x21'),_0x51d295,JSON[_0xc0ea('0x11')](_0x2593cb));_0x5e8d39(_0x2593cb);})['catch'](function(_0x414756){logger[_0xc0ea('0x12')](_0xc0ea('0x21'),_0x414756[_0xc0ea('0x14')],_0x51d295);_0x2f58fc(_0x5007dc[_0xc0ea('0x12')](0x1f4,_0x414756[_0xc0ea('0x14')]));});});};exports[_0xc0ea('0x22')]=function(_0x13c47c){var _0x2028db=this;return new Promise(function(_0x101114,_0x321137){return db[_0xc0ea('0x16')][_0xc0ea('0x23')]({'raw':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c['options'][_0xc0ea('0x19')]===undefined?!![]:![]:!![],'where':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c['options'][_0xc0ea('0x1a')]||null:null,'attributes':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c[_0xc0ea('0x18')][_0xc0ea('0x1b')]||null:null,'include':_0x13c47c[_0xc0ea('0x18')]?_0x13c47c[_0xc0ea('0x18')][_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x13c47c['options'][_0xc0ea('0x1e')],function(_0x5b7fcc){return{'model':db[_0x5b7fcc[_0xc0ea('0x1f')]],'as':_0x5b7fcc['as'],'attributes':_0x5b7fcc[_0xc0ea('0x1b')],'include':_0x5b7fcc['include']?_['map'](_0x5b7fcc[_0xc0ea('0x1e')],function(_0x54fc70){return{'model':db[_0x54fc70[_0xc0ea('0x1f')]],'as':_0x54fc70['as'],'attributes':_0x54fc70['attributes'],'include':_0x54fc70[_0xc0ea('0x1e')]?_[_0xc0ea('0x1d')](_0x54fc70[_0xc0ea('0x1e')],function(_0x41fdef){return{'model':db[_0x41fdef[_0xc0ea('0x1f')]],'as':_0x41fdef['as'],'attributes':_0x41fdef[_0xc0ea('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc0ea('0x20')](function(_0x160994){logger['info'](_0xc0ea('0x22'),_0x13c47c);logger['debug']('ShowDynamics365Account',_0x13c47c,JSON[_0xc0ea('0x11')](_0x160994));_0x101114(_0x160994);})[_0xc0ea('0x24')](function(_0x65fa19){logger[_0xc0ea('0x12')](_0xc0ea('0x22'),_0x65fa19[_0xc0ea('0x14')],_0x13c47c);_0x321137(_0x2028db['error'](0x1f4,_0x65fa19['message']));});});}; \ No newline at end of file +var _0x02d3=['Dynamics365Account','findAll','options','raw','where','attributes','include','model','map','find','ShowDynamics365Account','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x02d3,0xe3));var _0x302d=function(_0x15ad35,_0x15d3bd){_0x15ad35=_0x15ad35-0x0;var _0x45ccc4=_0x02d3[_0x15ad35];return _0x45ccc4;};'use strict';var _=require('lodash');var util=require(_0x302d('0x0'));var moment=require(_0x302d('0x1'));var BPromise=require(_0x302d('0x2'));var rs=require(_0x302d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x302d('0x4'))['db'];var utils=require(_0x302d('0x5'));var logger=require(_0x302d('0x6'))(_0x302d('0x7'));var config=require(_0x302d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x302d('0x9')][_0x302d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x595915,_0x37a169,_0x41c704){return new BPromise(function(_0x20ad9a,_0x27565e){return client[_0x302d('0xb')](_0x595915,_0x41c704)[_0x302d('0xc')](function(_0x5b664e){logger[_0x302d('0xd')](_0x302d('0xe'),_0x37a169,_0x302d('0xf'));logger[_0x302d('0x10')](_0x302d('0x11'),_0x37a169,_0x302d('0xf'),JSON[_0x302d('0x12')](_0x5b664e));if(_0x5b664e[_0x302d('0x13')]){if(_0x5b664e['error'][_0x302d('0x14')]===0x1f4){logger[_0x302d('0x13')](_0x302d('0xe'),_0x37a169,_0x5b664e[_0x302d('0x13')][_0x302d('0x15')]);return _0x27565e(_0x5b664e[_0x302d('0x13')][_0x302d('0x15')]);}logger[_0x302d('0x13')](_0x302d('0xe'),_0x37a169,_0x5b664e[_0x302d('0x13')]['message']);return _0x20ad9a(_0x5b664e[_0x302d('0x13')]['message']);}else{logger[_0x302d('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x37a169,_0x302d('0xf'));_0x20ad9a(_0x5b664e[_0x302d('0x16')][_0x302d('0x15')]);}})[_0x302d('0x17')](function(_0x34e9ac){logger[_0x302d('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x37a169,_0x34e9ac);_0x27565e(_0x34e9ac);});});}exports[_0x302d('0x18')]=function(_0x157bb0){var _0x44c65f=this;return new Promise(function(_0x3dbfa5,_0x2c0015){return db[_0x302d('0x19')][_0x302d('0x1a')]({'raw':_0x157bb0[_0x302d('0x1b')]?_0x157bb0[_0x302d('0x1b')][_0x302d('0x1c')]===undefined?!![]:![]:!![],'where':_0x157bb0[_0x302d('0x1b')]?_0x157bb0[_0x302d('0x1b')][_0x302d('0x1d')]||null:null,'attributes':_0x157bb0[_0x302d('0x1b')]?_0x157bb0[_0x302d('0x1b')][_0x302d('0x1e')]||null:null,'limit':_0x157bb0[_0x302d('0x1b')]?_0x157bb0['options']['limit']||null:null,'include':_0x157bb0[_0x302d('0x1b')]?_0x157bb0[_0x302d('0x1b')][_0x302d('0x1f')]?_['map'](_0x157bb0[_0x302d('0x1b')][_0x302d('0x1f')],function(_0x706342){return{'model':db[_0x706342[_0x302d('0x20')]],'as':_0x706342['as'],'attributes':_0x706342[_0x302d('0x1e')],'include':_0x706342['include']?_[_0x302d('0x21')](_0x706342[_0x302d('0x1f')],function(_0x3cb3fa){return{'model':db[_0x3cb3fa[_0x302d('0x20')]],'as':_0x3cb3fa['as'],'attributes':_0x3cb3fa[_0x302d('0x1e')],'include':_0x3cb3fa[_0x302d('0x1f')]?_[_0x302d('0x21')](_0x3cb3fa[_0x302d('0x1f')],function(_0x4044ee){return{'model':db[_0x4044ee[_0x302d('0x20')]],'as':_0x4044ee['as'],'attributes':_0x4044ee[_0x302d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x302d('0xc')](function(_0x9c7ce7){logger[_0x302d('0xd')](_0x302d('0x18'),_0x157bb0);logger['debug'](_0x302d('0x18'),_0x157bb0,JSON[_0x302d('0x12')](_0x9c7ce7));_0x3dbfa5(_0x9c7ce7);})[_0x302d('0x17')](function(_0x16f683){logger[_0x302d('0x13')]('GetDynamics365Account',_0x16f683[_0x302d('0x15')],_0x157bb0);_0x2c0015(_0x44c65f[_0x302d('0x13')](0x1f4,_0x16f683[_0x302d('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x5d3f93){var _0x222e94=this;return new Promise(function(_0x35cee5,_0x2802a9){return db[_0x302d('0x19')][_0x302d('0x22')]({'raw':_0x5d3f93[_0x302d('0x1b')]?_0x5d3f93[_0x302d('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5d3f93[_0x302d('0x1b')]?_0x5d3f93[_0x302d('0x1b')][_0x302d('0x1d')]||null:null,'attributes':_0x5d3f93['options']?_0x5d3f93['options']['attributes']||null:null,'include':_0x5d3f93[_0x302d('0x1b')]?_0x5d3f93[_0x302d('0x1b')]['include']?_[_0x302d('0x21')](_0x5d3f93[_0x302d('0x1b')][_0x302d('0x1f')],function(_0x5d1060){return{'model':db[_0x5d1060[_0x302d('0x20')]],'as':_0x5d1060['as'],'attributes':_0x5d1060['attributes'],'include':_0x5d1060[_0x302d('0x1f')]?_['map'](_0x5d1060[_0x302d('0x1f')],function(_0xb24b0a){return{'model':db[_0xb24b0a[_0x302d('0x20')]],'as':_0xb24b0a['as'],'attributes':_0xb24b0a[_0x302d('0x1e')],'include':_0xb24b0a[_0x302d('0x1f')]?_[_0x302d('0x21')](_0xb24b0a['include'],function(_0x1a1e70){return{'model':db[_0x1a1e70[_0x302d('0x20')]],'as':_0x1a1e70['as'],'attributes':_0x1a1e70[_0x302d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x302d('0xc')](function(_0x318d5c){logger[_0x302d('0xd')](_0x302d('0x23'),_0x5d3f93);logger[_0x302d('0x10')](_0x302d('0x23'),_0x5d3f93,JSON['stringify'](_0x318d5c));_0x35cee5(_0x318d5c);})[_0x302d('0x17')](function(_0x282e47){logger[_0x302d('0x13')](_0x302d('0x23'),_0x282e47[_0x302d('0x15')],_0x5d3f93);_0x2802a9(_0x222e94[_0x302d('0x13')](0x1f4,_0x282e47[_0x302d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 642b3e2..36b9545 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 _0x7f3b=['post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0x7f3b,0x13e));var _0xb7f3=function(_0x3ce708,_0x493726){_0x3ce708=_0x3ce708-0x0;var _0x58f926=_0x7f3b[_0x3ce708];return _0x58f926;};'use strict';var multer=require(_0xb7f3('0x0'));var util=require('util');var path=require(_0xb7f3('0x1'));var timeout=require(_0xb7f3('0x2'));var express=require(_0xb7f3('0x3'));var router=express[_0xb7f3('0x4')]();var fs_extra=require(_0xb7f3('0x5'));var auth=require(_0xb7f3('0x6'));var interaction=require(_0xb7f3('0x7'));var config=require(_0xb7f3('0x8'));var controller=require(_0xb7f3('0x9'));router[_0xb7f3('0xa')]('/',auth['isAuthenticated'](),controller[_0xb7f3('0xb')]);router['get']('/:id',auth[_0xb7f3('0xc')](),controller['show']);router[_0xb7f3('0xa')](_0xb7f3('0xd'),auth[_0xb7f3('0xc')](),controller[_0xb7f3('0xe')]);router['get'](_0xb7f3('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xb7f3('0xa')](_0xb7f3('0x10'),auth['isAuthenticated'](),controller[_0xb7f3('0x11')]);router[_0xb7f3('0x12')]('/',auth[_0xb7f3('0xc')](),controller['create']);router['put'](_0xb7f3('0x13'),auth[_0xb7f3('0xc')](),controller[_0xb7f3('0x14')]);router[_0xb7f3('0x15')]('/:id',auth[_0xb7f3('0xc')](),controller[_0xb7f3('0x16')]);module[_0xb7f3('0x17')]=router; \ No newline at end of file +var _0xd81e=['express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','get','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','path','connect-timeout'];(function(_0x4fc158,_0x2f4b18){var _0xb7745=function(_0x5103c2){while(--_0x5103c2){_0x4fc158['push'](_0x4fc158['shift']());}};_0xb7745(++_0x2f4b18);}(_0xd81e,0x7b));var _0xed81=function(_0x4020ba,_0x15df6d){_0x4020ba=_0x4020ba-0x0;var _0x4d2d95=_0xd81e[_0x4020ba];return _0x4d2d95;};'use strict';var multer=require(_0xed81('0x0'));var util=require('util');var path=require(_0xed81('0x1'));var timeout=require(_0xed81('0x2'));var express=require(_0xed81('0x3'));var router=express[_0xed81('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xed81('0x5'));var config=require(_0xed81('0x6'));var controller=require(_0xed81('0x7'));router['get']('/',auth[_0xed81('0x8')](),controller['index']);router[_0xed81('0x9')]('/:id',auth[_0xed81('0x8')](),controller[_0xed81('0xa')]);router[_0xed81('0x9')]('/:id/fields',auth[_0xed81('0x8')](),controller[_0xed81('0xb')]);router['get']('/:id/subjects',auth[_0xed81('0x8')](),controller[_0xed81('0xc')]);router[_0xed81('0x9')](_0xed81('0xd'),auth[_0xed81('0x8')](),controller[_0xed81('0xe')]);router[_0xed81('0xf')]('/',auth[_0xed81('0x8')](),controller[_0xed81('0x10')]);router[_0xed81('0x11')](_0xed81('0x12'),auth[_0xed81('0x8')](),controller[_0xed81('0x13')]);router['delete'](_0xed81('0x12'),auth[_0xed81('0x8')](),controller[_0xed81('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 d18fbab..d64c27d 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 _0xe43c=['phonecall','contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','incident'];(function(_0xb9ad6d,_0x2bb216){var _0x219d35=function(_0x32fda4){while(--_0x32fda4){_0xb9ad6d['push'](_0xb9ad6d['shift']());}};_0x219d35(++_0x2bb216);}(_0xe43c,0x13f));var _0xce43=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe43c[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0xce43('0x0'));module[_0xce43('0x1')]={'name':{'type':Sequelize[_0xce43('0x2')]},'description':{'type':Sequelize[_0xce43('0x2')]},'ticketType':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x4'),_0xce43('0x5')),'defaultValue':_0xce43('0x4')},'moduleCreate':{'type':Sequelize[_0xce43('0x3')](_0xce43('0x6'),_0xce43('0x7')),'defaultValue':_0xce43('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xce43('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5ecb=['incident','nothing','contact','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x4c8ca5,_0xf42acd){var _0xb7bd53=function(_0x58c9f2){while(--_0x58c9f2){_0x4c8ca5['push'](_0x4c8ca5['shift']());}};_0xb7bd53(++_0xf42acd);}(_0x5ecb,0x6c));var _0xb5ec=function(_0x55ff3e,_0x41077f){_0x55ff3e=_0x55ff3e-0x0;var _0x2709eb=_0x5ecb[_0x55ff3e];return _0x2709eb;};'use strict';var Sequelize=require(_0xb5ec('0x0'));module[_0xb5ec('0x1')]={'name':{'type':Sequelize[_0xb5ec('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xb5ec('0x3')](_0xb5ec('0x4'),'phonecall'),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xb5ec('0x3')]('contact',_0xb5ec('0x5')),'defaultValue':_0xb5ec('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xb5ec('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xb5ec('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 7ab93c7..cefe8fa 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 _0x8477=['options','Dynamics365Configuration','include','rows','catch','params','includeAll','find','create','body','findOne','getFields','Dynamics365Field','getSubjects','getDescriptions','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x95bc1,_0x5d1bf){var _0x3d450f=function(_0x3926e5){while(--_0x3926e5){_0x95bc1['push'](_0x95bc1['shift']());}};_0x3d450f(++_0x5d1bf);}(_0x8477,0x181));var _0x7847=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x8477[_0x49c653];return _0x31e169;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7847('0x0'));var BPromise=require(_0x7847('0x1'));var Mustache=require(_0x7847('0x2'));var util=require(_0x7847('0x3'));var path=require(_0x7847('0x4'));var sox=require(_0x7847('0x5'));var csv=require(_0x7847('0x6'));var ejs=require(_0x7847('0x7'));var fs=require('fs');var fs_extra=require(_0x7847('0x8'));var _=require(_0x7847('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7847('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7847('0x6'));var querystring=require('querystring');var Papa=require(_0x7847('0xb'));var Redis=require('ioredis');var authService=require(_0x7847('0xc'));var qs=require(_0x7847('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7847('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x7847('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7847('0x10'))['db'];function respondWithStatusCode(_0x5ca247,_0x35db3e){_0x35db3e=_0x35db3e||0xcc;return function(_0x558704){if(_0x558704){return _0x5ca247[_0x7847('0x11')](_0x35db3e);}return _0x5ca247[_0x7847('0x12')](_0x35db3e)[_0x7847('0x13')]();};}function respondWithResult(_0x537028,_0x10635c){_0x10635c=_0x10635c||0xc8;return function(_0xbcac92){if(_0xbcac92){return _0x537028[_0x7847('0x12')](_0x10635c)[_0x7847('0x14')](_0xbcac92);}};}function respondWithFilteredResult(_0x4e16b9,_0x191924){return function(_0x2c15cb){if(_0x2c15cb){var _0x61f2cb=typeof _0x191924['offset']===_0x7847('0x15')&&typeof _0x191924[_0x7847('0x16')]===_0x7847('0x15');var _0x9f6477=_0x2c15cb[_0x7847('0x17')];var _0x950994=_0x61f2cb?0x0:_0x191924[_0x7847('0x18')];var _0x31dfbb=_0x61f2cb?_0x2c15cb[_0x7847('0x17')]:_0x191924[_0x7847('0x18')]+_0x191924[_0x7847('0x16')];var _0x3ea48f;if(_0x31dfbb>=_0x9f6477){_0x31dfbb=_0x9f6477;_0x3ea48f=0xc8;}else{_0x3ea48f=0xce;}_0x4e16b9[_0x7847('0x12')](_0x3ea48f);return _0x4e16b9[_0x7847('0x19')](_0x7847('0x1a'),_0x950994+'-'+_0x31dfbb+'/'+_0x9f6477)[_0x7847('0x14')](_0x2c15cb);}return null;};}function patchUpdates(_0x9bc00){return function(_0xadde70){try{jsonpatch['apply'](_0xadde70,_0x9bc00,!![]);}catch(_0x403937){return BPromise[_0x7847('0x1b')](_0x403937);}return _0xadde70[_0x7847('0x1c')]();};}function saveUpdates(_0x39a56d,_0x5d0628){return function(_0x546098){if(_0x546098){return _0x546098[_0x7847('0x1d')](_0x39a56d)[_0x7847('0x1e')](function(_0x5d89d){return _0x5d89d;});}return null;};}function removeEntity(_0x21cfa9,_0x4d1b3f){return function(_0x120baa){if(_0x120baa){return _0x120baa[_0x7847('0x1f')]()['then'](function(){_0x21cfa9['status'](0xcc)[_0x7847('0x13')]();});}};}function handleEntityNotFound(_0x1bb129,_0x5b3fb2){return function(_0x3fff23){if(!_0x3fff23){_0x1bb129[_0x7847('0x11')](0x194);}return _0x3fff23;};}function handleError(_0x4e6181,_0x445d01){_0x445d01=_0x445d01||0x1f4;return function(_0x538e36){logger[_0x7847('0x20')](_0x538e36[_0x7847('0x21')]);if(_0x538e36[_0x7847('0x22')]){delete _0x538e36['name'];}_0x4e6181[_0x7847('0x12')](_0x445d01)[_0x7847('0x23')](_0x538e36);};}exports[_0x7847('0x24')]=function(_0x16c87d,_0xdf60dd){var _0x294104={},_0x9e8f7e={},_0x38a692={'count':0x0,'rows':[]};var _0x4ece56=_[_0x7847('0x25')](db['Dynamics365Configuration'][_0x7847('0x26')],function(_0x406844){return{'name':_0x406844[_0x7847('0x27')],'type':_0x406844[_0x7847('0x28')][_0x7847('0x29')]};});_0x9e8f7e[_0x7847('0x2a')]=_[_0x7847('0x25')](_0x4ece56,_0x7847('0x22'));_0x9e8f7e[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x16c87d['query']);_0x9e8f7e[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x9e8f7e[_0x7847('0x2a')],_0x9e8f7e['query']);_0x294104[_0x7847('0x2f')]=_['intersection'](_0x9e8f7e[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x16c87d[_0x7847('0x2b')][_0x7847('0x30')]));_0x294104[_0x7847('0x2f')]=_0x294104[_0x7847('0x2f')][_0x7847('0x31')]?_0x294104[_0x7847('0x2f')]:_0x9e8f7e[_0x7847('0x2a')];if(!_0x16c87d[_0x7847('0x2b')][_0x7847('0x32')](_0x7847('0x33'))){_0x294104[_0x7847('0x16')]=qs['limit'](_0x16c87d[_0x7847('0x2b')][_0x7847('0x16')]);_0x294104[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x16c87d['query'][_0x7847('0x18')]);}_0x294104[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x16c87d[_0x7847('0x2b')][_0x7847('0x35')]);_0x294104['where']=qs[_0x7847('0x2d')](_[_0x7847('0x36')](_0x16c87d[_0x7847('0x2b')],_0x9e8f7e[_0x7847('0x2d')]),_0x4ece56);if(_0x16c87d[_0x7847('0x2b')][_0x7847('0x37')]){_0x294104[_0x7847('0x38')]=_[_0x7847('0x39')](_0x294104[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x4ece56,function(_0x17c151){if(_0x17c151[_0x7847('0x28')]!==_0x7847('0x3a')){var _0x28a9ba={};_0x28a9ba[_0x17c151[_0x7847('0x22')]]={'$like':'%'+_0x16c87d[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x28a9ba;}})});}_0x294104=_[_0x7847('0x39')]({},_0x294104,_0x16c87d[_0x7847('0x3b')]);var _0x5bb14b={'where':_0x294104[_0x7847('0x38')]};return db[_0x7847('0x3c')][_0x7847('0x17')](_0x5bb14b)[_0x7847('0x1e')](function(_0xa06308){_0x38a692[_0x7847('0x17')]=_0xa06308;if(_0x16c87d[_0x7847('0x2b')]['includeAll']){_0x294104[_0x7847('0x3d')]=[{'all':!![]}];}return db[_0x7847('0x3c')]['findAll'](_0x294104);})[_0x7847('0x1e')](function(_0x4a0b57){_0x38a692[_0x7847('0x3e')]=_0x4a0b57;return _0x38a692;})[_0x7847('0x1e')](respondWithFilteredResult(_0xdf60dd,_0x294104))[_0x7847('0x3f')](handleError(_0xdf60dd,null));};exports['show']=function(_0x579a3d,_0x55f3bb){var _0x4e50f8={'raw':![],'where':{'id':_0x579a3d[_0x7847('0x40')]['id']}},_0x5973ae={};_0x5973ae['model']=_[_0x7847('0x2c')](db['Dynamics365Configuration']['rawAttributes']);_0x5973ae['query']=_['keys'](_0x579a3d[_0x7847('0x2b')]);_0x5973ae[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x5973ae[_0x7847('0x2a')],_0x5973ae['query']);_0x4e50f8[_0x7847('0x2f')]=_[_0x7847('0x2e')](_0x5973ae[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x579a3d[_0x7847('0x2b')][_0x7847('0x30')]));_0x4e50f8['attributes']=_0x4e50f8[_0x7847('0x2f')][_0x7847('0x31')]?_0x4e50f8[_0x7847('0x2f')]:_0x5973ae[_0x7847('0x2a')];if(_0x579a3d[_0x7847('0x2b')][_0x7847('0x41')]){_0x4e50f8[_0x7847('0x3d')]=[{'all':!![]}];}_0x4e50f8=_['merge']({},_0x4e50f8,_0x579a3d[_0x7847('0x3b')]);return db[_0x7847('0x3c')][_0x7847('0x42')](_0x4e50f8)[_0x7847('0x1e')](handleEntityNotFound(_0x55f3bb,null))[_0x7847('0x1e')](respondWithResult(_0x55f3bb,null))[_0x7847('0x3f')](handleError(_0x55f3bb,null));};exports[_0x7847('0x43')]=function(_0x52eb3c,_0x49cf33){return db[_0x7847('0x3c')]['create'](_0x52eb3c['body'],{})[_0x7847('0x1e')](respondWithResult(_0x49cf33,0xc9))[_0x7847('0x3f')](handleError(_0x49cf33,null));};exports[_0x7847('0x1d')]=function(_0x52b2de,_0x46a27d){if(_0x52b2de[_0x7847('0x44')]['id']){delete _0x52b2de[_0x7847('0x44')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x52b2de[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x46a27d,null))[_0x7847('0x1e')](saveUpdates(_0x52b2de[_0x7847('0x44')],null))[_0x7847('0x1e')](respondWithResult(_0x46a27d,null))[_0x7847('0x3f')](handleError(_0x46a27d,null));};exports[_0x7847('0x1f')]=function(_0x4028bc,_0x170fb0){return db[_0x7847('0x3c')][_0x7847('0x42')]({'where':{'id':_0x4028bc['params']['id']}})['then'](handleEntityNotFound(_0x170fb0,null))[_0x7847('0x1e')](removeEntity(_0x170fb0,null))[_0x7847('0x3f')](handleError(_0x170fb0,null));};exports['getFields']=function(_0x1a5ca8,_0x2487af,_0x3c690c){var _0x96f032={};var _0xe26b20={};var _0xf049bd;var _0x36ee66;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x1a5ca8[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x2487af,null))[_0x7847('0x1e')](function(_0x1d555d){if(_0x1d555d){_0xf049bd=_0x1d555d;_0xe26b20[_0x7847('0x2a')]=_[_0x7847('0x2c')](db['Dynamics365Field'][_0x7847('0x26')]);_0xe26b20[_0x7847('0x2b')]=_['keys'](_0x1a5ca8[_0x7847('0x2b')]);_0xe26b20['filters']=_['intersection'](_0xe26b20[_0x7847('0x2a')],_0xe26b20['query']);_0x96f032[_0x7847('0x2f')]=_[_0x7847('0x2e')](_0xe26b20['model'],qs[_0x7847('0x30')](_0x1a5ca8['query'][_0x7847('0x30')]));_0x96f032[_0x7847('0x2f')]=_0x96f032[_0x7847('0x2f')][_0x7847('0x31')]?_0x96f032[_0x7847('0x2f')]:_0xe26b20['model'];_0x96f032[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x35')]);_0x96f032[_0x7847('0x38')]=qs['filters'](_[_0x7847('0x36')](_0x1a5ca8[_0x7847('0x2b')],_0xe26b20[_0x7847('0x2d')]));if(_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x37')]){_0x96f032[_0x7847('0x38')]=_[_0x7847('0x39')](_0x96f032[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x96f032['attributes'],function(_0x41d42c){var _0x54590d={};_0x54590d[_0x41d42c]={'$like':'%'+_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x54590d;})});}_0x96f032=_[_0x7847('0x39')]({},_0x96f032,_0x1a5ca8[_0x7847('0x3b')]);return _0xf049bd['getFields'](_0x96f032);}})[_0x7847('0x1e')](function(_0xb303d1){if(_0xb303d1){_0x36ee66=_0xb303d1[_0x7847('0x31')];if(!_0x1a5ca8[_0x7847('0x2b')][_0x7847('0x32')](_0x7847('0x33'))){_0x96f032[_0x7847('0x16')]=qs[_0x7847('0x16')](_0x1a5ca8['query']['limit']);_0x96f032[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x1a5ca8[_0x7847('0x2b')]['offset']);}return _0xf049bd[_0x7847('0x46')](_0x96f032);}})[_0x7847('0x1e')](function(_0x5c672a){if(_0x5c672a){return _0x5c672a?{'count':_0x36ee66,'rows':_0x5c672a}:null;}})[_0x7847('0x1e')](respondWithResult(_0x2487af,null))[_0x7847('0x3f')](handleError(_0x2487af,null));};exports['getSubjects']=function(_0x402ef5,_0x1a8669,_0x62d91c){var _0x470c6b={};var _0x4e9283={};var _0x1ea60b;var _0x40b057;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x402ef5[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x1a8669,null))[_0x7847('0x1e')](function(_0xaf430c){if(_0xaf430c){_0x1ea60b=_0xaf430c;_0x4e9283[_0x7847('0x2a')]=_[_0x7847('0x2c')](db[_0x7847('0x47')][_0x7847('0x26')]);_0x4e9283[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x402ef5[_0x7847('0x2b')]);_0x4e9283['filters']=_[_0x7847('0x2e')](_0x4e9283['model'],_0x4e9283[_0x7847('0x2b')]);_0x470c6b['attributes']=_[_0x7847('0x2e')](_0x4e9283[_0x7847('0x2a')],qs[_0x7847('0x30')](_0x402ef5[_0x7847('0x2b')][_0x7847('0x30')]));_0x470c6b[_0x7847('0x2f')]=_0x470c6b['attributes'][_0x7847('0x31')]?_0x470c6b[_0x7847('0x2f')]:_0x4e9283[_0x7847('0x2a')];_0x470c6b[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x402ef5['query'][_0x7847('0x35')]);_0x470c6b['where']=qs[_0x7847('0x2d')](_[_0x7847('0x36')](_0x402ef5[_0x7847('0x2b')],_0x4e9283[_0x7847('0x2d')]));if(_0x402ef5['query'][_0x7847('0x37')]){_0x470c6b[_0x7847('0x38')]=_[_0x7847('0x39')](_0x470c6b[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x470c6b[_0x7847('0x2f')],function(_0x50aa39){var _0x19dacc={};_0x19dacc[_0x50aa39]={'$like':'%'+_0x402ef5[_0x7847('0x2b')]['filter']+'%'};return _0x19dacc;})});}_0x470c6b=_[_0x7847('0x39')]({},_0x470c6b,_0x402ef5[_0x7847('0x3b')]);return _0x1ea60b[_0x7847('0x48')](_0x470c6b);}})['then'](function(_0x619578){if(_0x619578){_0x40b057=_0x619578[_0x7847('0x31')];if(!_0x402ef5[_0x7847('0x2b')]['hasOwnProperty'](_0x7847('0x33'))){_0x470c6b['limit']=qs['limit'](_0x402ef5['query'][_0x7847('0x16')]);_0x470c6b[_0x7847('0x18')]=qs[_0x7847('0x18')](_0x402ef5['query'][_0x7847('0x18')]);}return _0x1ea60b[_0x7847('0x48')](_0x470c6b);}})[_0x7847('0x1e')](function(_0x4033b8){if(_0x4033b8){return _0x4033b8?{'count':_0x40b057,'rows':_0x4033b8}:null;}})[_0x7847('0x1e')](respondWithResult(_0x1a8669,null))[_0x7847('0x3f')](handleError(_0x1a8669,null));};exports[_0x7847('0x49')]=function(_0x3c3ab1,_0x4c5755,_0x1d0f99){var _0x1d28e5={};var _0x27c1b7={};var _0x2a5a3f;var _0x4d9977;return db[_0x7847('0x3c')][_0x7847('0x45')]({'where':{'id':_0x3c3ab1[_0x7847('0x40')]['id']}})[_0x7847('0x1e')](handleEntityNotFound(_0x4c5755,null))[_0x7847('0x1e')](function(_0x4a688d){if(_0x4a688d){_0x2a5a3f=_0x4a688d;_0x27c1b7['model']=_[_0x7847('0x2c')](db[_0x7847('0x47')][_0x7847('0x26')]);_0x27c1b7[_0x7847('0x2b')]=_[_0x7847('0x2c')](_0x3c3ab1[_0x7847('0x2b')]);_0x27c1b7[_0x7847('0x2d')]=_[_0x7847('0x2e')](_0x27c1b7[_0x7847('0x2a')],_0x27c1b7[_0x7847('0x2b')]);_0x1d28e5[_0x7847('0x2f')]=_['intersection'](_0x27c1b7['model'],qs[_0x7847('0x30')](_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x30')]));_0x1d28e5['attributes']=_0x1d28e5[_0x7847('0x2f')][_0x7847('0x31')]?_0x1d28e5[_0x7847('0x2f')]:_0x27c1b7['model'];_0x1d28e5[_0x7847('0x34')]=qs[_0x7847('0x35')](_0x3c3ab1['query'][_0x7847('0x35')]);_0x1d28e5['where']=qs['filters'](_[_0x7847('0x36')](_0x3c3ab1[_0x7847('0x2b')],_0x27c1b7['filters']));if(_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x37')]){_0x1d28e5[_0x7847('0x38')]=_[_0x7847('0x39')](_0x1d28e5[_0x7847('0x38')],{'$or':_[_0x7847('0x25')](_0x1d28e5[_0x7847('0x2f')],function(_0x5b730a){var _0x51a0e7={};_0x51a0e7[_0x5b730a]={'$like':'%'+_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x37')]+'%'};return _0x51a0e7;})});}_0x1d28e5=_[_0x7847('0x39')]({},_0x1d28e5,_0x3c3ab1[_0x7847('0x3b')]);return _0x2a5a3f[_0x7847('0x49')](_0x1d28e5);}})[_0x7847('0x1e')](function(_0x26c632){if(_0x26c632){_0x4d9977=_0x26c632[_0x7847('0x31')];if(!_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x32')]('nolimit')){_0x1d28e5[_0x7847('0x16')]=qs[_0x7847('0x16')](_0x3c3ab1[_0x7847('0x2b')][_0x7847('0x16')]);_0x1d28e5['offset']=qs['offset'](_0x3c3ab1[_0x7847('0x2b')]['offset']);}return _0x2a5a3f[_0x7847('0x49')](_0x1d28e5);}})[_0x7847('0x1e')](function(_0xd911c4){if(_0xd911c4){return _0xd911c4?{'count':_0x4d9977,'rows':_0xd911c4}:null;}})[_0x7847('0x1e')](respondWithResult(_0x4c5755,null))[_0x7847('0x3f')](handleError(_0x4c5755,null));}; \ No newline at end of file +var _0xa84e=['params','find','create','update','body','getFields','findOne','Dynamics365Field','filter','options','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','type','VIRTUAL','includeAll','findAll','rows','catch','show'];(function(_0x308156,_0x3e3030){var _0x2c9b8e=function(_0x25383a){while(--_0x25383a){_0x308156['push'](_0x308156['shift']());}};_0x2c9b8e(++_0x3e3030);}(_0xa84e,0x102));var _0xea84=function(_0x178d95,_0x5880c1){_0x178d95=_0x178d95-0x0;var _0x55688c=_0xa84e[_0x178d95];return _0x55688c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xea84('0x0'));var zipdir=require(_0xea84('0x1'));var jsonpatch=require(_0xea84('0x2'));var rp=require(_0xea84('0x3'));var moment=require(_0xea84('0x4'));var BPromise=require(_0xea84('0x5'));var Mustache=require(_0xea84('0x6'));var util=require(_0xea84('0x7'));var path=require(_0xea84('0x8'));var sox=require(_0xea84('0x9'));var csv=require(_0xea84('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xea84('0xb'));var _=require(_0xea84('0xc'));var squel=require(_0xea84('0xd'));var crypto=require(_0xea84('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xea84('0xf'));var toCsv=require(_0xea84('0xa'));var querystring=require(_0xea84('0x10'));var Papa=require(_0xea84('0x11'));var Redis=require(_0xea84('0x12'));var authService=require(_0xea84('0x13'));var qs=require(_0xea84('0x14'));var as=require(_0xea84('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea84('0x16'))('api');var utils=require(_0xea84('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xea84('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10f06d,_0x5a599e){_0x5a599e=_0x5a599e||0xcc;return function(_0x3a50cc){if(_0x3a50cc){return _0x10f06d[_0xea84('0x19')](_0x5a599e);}return _0x10f06d[_0xea84('0x1a')](_0x5a599e)[_0xea84('0x1b')]();};}function respondWithResult(_0x411e82,_0x293c3d){_0x293c3d=_0x293c3d||0xc8;return function(_0x415ed2){if(_0x415ed2){return _0x411e82[_0xea84('0x1a')](_0x293c3d)[_0xea84('0x1c')](_0x415ed2);}};}function respondWithFilteredResult(_0xeab838,_0x2d149a){return function(_0x4516f1){if(_0x4516f1){var _0x229c33=typeof _0x2d149a[_0xea84('0x1d')]==='undefined'&&typeof _0x2d149a[_0xea84('0x1e')]===_0xea84('0x1f');var _0xbba8b1=_0x4516f1[_0xea84('0x20')];var _0x5bd1ef=_0x229c33?0x0:_0x2d149a[_0xea84('0x1d')];var _0x49f0df=_0x229c33?_0x4516f1[_0xea84('0x20')]:_0x2d149a[_0xea84('0x1d')]+_0x2d149a[_0xea84('0x1e')];var _0x410419;if(_0x49f0df>=_0xbba8b1){_0x49f0df=_0xbba8b1;_0x410419=0xc8;}else{_0x410419=0xce;}_0xeab838[_0xea84('0x1a')](_0x410419);return _0xeab838['set'](_0xea84('0x21'),_0x5bd1ef+'-'+_0x49f0df+'/'+_0xbba8b1)['json'](_0x4516f1);}return null;};}function patchUpdates(_0x5c3931){return function(_0x3db159){try{jsonpatch[_0xea84('0x22')](_0x3db159,_0x5c3931,!![]);}catch(_0x37b81f){return BPromise[_0xea84('0x23')](_0x37b81f);}return _0x3db159['save']();};}function saveUpdates(_0x5e69cb,_0x5ac270){return function(_0x567651){if(_0x567651){return _0x567651['update'](_0x5e69cb)['then'](function(_0x219c9c){return _0x219c9c;});}return null;};}function removeEntity(_0x5b9aa0,_0x2a19aa){return function(_0xa4b1b){if(_0xa4b1b){return _0xa4b1b[_0xea84('0x24')]()[_0xea84('0x25')](function(){_0x5b9aa0[_0xea84('0x1a')](0xcc)[_0xea84('0x1b')]();});}};}function handleEntityNotFound(_0x3ab932,_0x2edc01){return function(_0x2bbaa8){if(!_0x2bbaa8){_0x3ab932[_0xea84('0x19')](0x194);}return _0x2bbaa8;};}function handleError(_0xf45a0d,_0x345396){_0x345396=_0x345396||0x1f4;return function(_0x21b917){logger[_0xea84('0x26')](_0x21b917[_0xea84('0x27')]);if(_0x21b917[_0xea84('0x28')]){delete _0x21b917['name'];}_0xf45a0d['status'](_0x345396)[_0xea84('0x29')](_0x21b917);};}exports[_0xea84('0x2a')]=function(_0x589d1e,_0x46ed00){var _0x295e8f={},_0x3c61cb={},_0x197793={'count':0x0,'rows':[]};var _0x352d79=_[_0xea84('0x2b')](db[_0xea84('0x2c')][_0xea84('0x2d')],function(_0x325ef2){return{'name':_0x325ef2[_0xea84('0x2e')],'type':_0x325ef2['type'][_0xea84('0x2f')]};});_0x3c61cb[_0xea84('0x30')]=_[_0xea84('0x2b')](_0x352d79,_0xea84('0x28'));_0x3c61cb[_0xea84('0x31')]=_[_0xea84('0x32')](_0x589d1e[_0xea84('0x31')]);_0x3c61cb[_0xea84('0x33')]=_[_0xea84('0x34')](_0x3c61cb['model'],_0x3c61cb[_0xea84('0x31')]);_0x295e8f[_0xea84('0x35')]=_['intersection'](_0x3c61cb[_0xea84('0x30')],qs[_0xea84('0x36')](_0x589d1e[_0xea84('0x31')][_0xea84('0x36')]));_0x295e8f[_0xea84('0x35')]=_0x295e8f[_0xea84('0x35')][_0xea84('0x37')]?_0x295e8f[_0xea84('0x35')]:_0x3c61cb[_0xea84('0x30')];if(!_0x589d1e[_0xea84('0x31')][_0xea84('0x38')](_0xea84('0x39'))){_0x295e8f[_0xea84('0x1e')]=qs['limit'](_0x589d1e['query'][_0xea84('0x1e')]);_0x295e8f[_0xea84('0x1d')]=qs['offset'](_0x589d1e[_0xea84('0x31')][_0xea84('0x1d')]);}_0x295e8f[_0xea84('0x3a')]=qs[_0xea84('0x3b')](_0x589d1e[_0xea84('0x31')][_0xea84('0x3b')]);_0x295e8f['where']=qs[_0xea84('0x33')](_[_0xea84('0x3c')](_0x589d1e['query'],_0x3c61cb[_0xea84('0x33')]),_0x352d79);if(_0x589d1e['query']['filter']){_0x295e8f['where']=_[_0xea84('0x3d')](_0x295e8f[_0xea84('0x3e')],{'$or':_[_0xea84('0x2b')](_0x352d79,function(_0x3c9b31){if(_0x3c9b31[_0xea84('0x3f')]!==_0xea84('0x40')){var _0x347566={};_0x347566[_0x3c9b31[_0xea84('0x28')]]={'$like':'%'+_0x589d1e[_0xea84('0x31')]['filter']+'%'};return _0x347566;}})});}_0x295e8f=_[_0xea84('0x3d')]({},_0x295e8f,_0x589d1e['options']);var _0x4e86cf={'where':_0x295e8f[_0xea84('0x3e')]};return db[_0xea84('0x2c')][_0xea84('0x20')](_0x4e86cf)[_0xea84('0x25')](function(_0x2e7d84){_0x197793[_0xea84('0x20')]=_0x2e7d84;if(_0x589d1e[_0xea84('0x31')][_0xea84('0x41')]){_0x295e8f['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xea84('0x42')](_0x295e8f);})[_0xea84('0x25')](function(_0x3cba5c){_0x197793[_0xea84('0x43')]=_0x3cba5c;return _0x197793;})['then'](respondWithFilteredResult(_0x46ed00,_0x295e8f))[_0xea84('0x44')](handleError(_0x46ed00,null));};exports[_0xea84('0x45')]=function(_0x192ce3,_0x2dae96){var _0x4fe93a={'raw':![],'where':{'id':_0x192ce3[_0xea84('0x46')]['id']}},_0x32d7c0={};_0x32d7c0[_0xea84('0x30')]=_[_0xea84('0x32')](db[_0xea84('0x2c')][_0xea84('0x2d')]);_0x32d7c0[_0xea84('0x31')]=_[_0xea84('0x32')](_0x192ce3['query']);_0x32d7c0[_0xea84('0x33')]=_['intersection'](_0x32d7c0['model'],_0x32d7c0[_0xea84('0x31')]);_0x4fe93a['attributes']=_[_0xea84('0x34')](_0x32d7c0[_0xea84('0x30')],qs['fields'](_0x192ce3[_0xea84('0x31')][_0xea84('0x36')]));_0x4fe93a[_0xea84('0x35')]=_0x4fe93a[_0xea84('0x35')][_0xea84('0x37')]?_0x4fe93a[_0xea84('0x35')]:_0x32d7c0[_0xea84('0x30')];if(_0x192ce3[_0xea84('0x31')][_0xea84('0x41')]){_0x4fe93a['include']=[{'all':!![]}];}_0x4fe93a=_['merge']({},_0x4fe93a,_0x192ce3['options']);return db['Dynamics365Configuration'][_0xea84('0x47')](_0x4fe93a)['then'](handleEntityNotFound(_0x2dae96,null))[_0xea84('0x25')](respondWithResult(_0x2dae96,null))[_0xea84('0x44')](handleError(_0x2dae96,null));};exports['create']=function(_0x395d6c,_0x33d4c0){return db[_0xea84('0x2c')][_0xea84('0x48')](_0x395d6c['body'],{})['then'](respondWithResult(_0x33d4c0,0xc9))[_0xea84('0x44')](handleError(_0x33d4c0,null));};exports[_0xea84('0x49')]=function(_0x1f8dd0,_0x3aeb51){if(_0x1f8dd0[_0xea84('0x4a')]['id']){delete _0x1f8dd0[_0xea84('0x4a')]['id'];}return db[_0xea84('0x2c')][_0xea84('0x47')]({'where':{'id':_0x1f8dd0[_0xea84('0x46')]['id']}})[_0xea84('0x25')](handleEntityNotFound(_0x3aeb51,null))['then'](saveUpdates(_0x1f8dd0[_0xea84('0x4a')],null))[_0xea84('0x25')](respondWithResult(_0x3aeb51,null))['catch'](handleError(_0x3aeb51,null));};exports[_0xea84('0x24')]=function(_0x162277,_0x1bb64e){return db[_0xea84('0x2c')][_0xea84('0x47')]({'where':{'id':_0x162277[_0xea84('0x46')]['id']}})[_0xea84('0x25')](handleEntityNotFound(_0x1bb64e,null))[_0xea84('0x25')](removeEntity(_0x1bb64e,null))[_0xea84('0x44')](handleError(_0x1bb64e,null));};exports[_0xea84('0x4b')]=function(_0x54c5ed,_0x12587d,_0x5951f6){var _0x302e79={};var _0x1afc20={};var _0x1be811;var _0x5cfe00;return db[_0xea84('0x2c')][_0xea84('0x4c')]({'where':{'id':_0x54c5ed['params']['id']}})['then'](handleEntityNotFound(_0x12587d,null))[_0xea84('0x25')](function(_0x15d28a){if(_0x15d28a){_0x1be811=_0x15d28a;_0x1afc20[_0xea84('0x30')]=_['keys'](db[_0xea84('0x4d')][_0xea84('0x2d')]);_0x1afc20[_0xea84('0x31')]=_[_0xea84('0x32')](_0x54c5ed['query']);_0x1afc20[_0xea84('0x33')]=_['intersection'](_0x1afc20['model'],_0x1afc20['query']);_0x302e79[_0xea84('0x35')]=_[_0xea84('0x34')](_0x1afc20['model'],qs[_0xea84('0x36')](_0x54c5ed[_0xea84('0x31')][_0xea84('0x36')]));_0x302e79[_0xea84('0x35')]=_0x302e79[_0xea84('0x35')]['length']?_0x302e79[_0xea84('0x35')]:_0x1afc20[_0xea84('0x30')];_0x302e79[_0xea84('0x3a')]=qs[_0xea84('0x3b')](_0x54c5ed[_0xea84('0x31')][_0xea84('0x3b')]);_0x302e79['where']=qs[_0xea84('0x33')](_[_0xea84('0x3c')](_0x54c5ed[_0xea84('0x31')],_0x1afc20[_0xea84('0x33')]));if(_0x54c5ed[_0xea84('0x31')][_0xea84('0x4e')]){_0x302e79[_0xea84('0x3e')]=_[_0xea84('0x3d')](_0x302e79[_0xea84('0x3e')],{'$or':_['map'](_0x302e79[_0xea84('0x35')],function(_0x2832f7){var _0x37cc55={};_0x37cc55[_0x2832f7]={'$like':'%'+_0x54c5ed[_0xea84('0x31')][_0xea84('0x4e')]+'%'};return _0x37cc55;})});}_0x302e79=_[_0xea84('0x3d')]({},_0x302e79,_0x54c5ed['options']);return _0x1be811[_0xea84('0x4b')](_0x302e79);}})[_0xea84('0x25')](function(_0x3f30aa){if(_0x3f30aa){_0x5cfe00=_0x3f30aa[_0xea84('0x37')];if(!_0x54c5ed[_0xea84('0x31')][_0xea84('0x38')](_0xea84('0x39'))){_0x302e79[_0xea84('0x1e')]=qs[_0xea84('0x1e')](_0x54c5ed[_0xea84('0x31')]['limit']);_0x302e79['offset']=qs[_0xea84('0x1d')](_0x54c5ed[_0xea84('0x31')][_0xea84('0x1d')]);}return _0x1be811[_0xea84('0x4b')](_0x302e79);}})[_0xea84('0x25')](function(_0x4b2810){if(_0x4b2810){return _0x4b2810?{'count':_0x5cfe00,'rows':_0x4b2810}:null;}})['then'](respondWithResult(_0x12587d,null))[_0xea84('0x44')](handleError(_0x12587d,null));};exports['getSubjects']=function(_0x50aaa5,_0x337988,_0x22fe97){var _0x1ea2bc={};var _0x3b7dff={};var _0x661ea5;var _0x4b4463;return db[_0xea84('0x2c')][_0xea84('0x4c')]({'where':{'id':_0x50aaa5[_0xea84('0x46')]['id']}})['then'](handleEntityNotFound(_0x337988,null))[_0xea84('0x25')](function(_0x506388){if(_0x506388){_0x661ea5=_0x506388;_0x3b7dff[_0xea84('0x30')]=_[_0xea84('0x32')](db[_0xea84('0x4d')][_0xea84('0x2d')]);_0x3b7dff[_0xea84('0x31')]=_['keys'](_0x50aaa5['query']);_0x3b7dff[_0xea84('0x33')]=_[_0xea84('0x34')](_0x3b7dff[_0xea84('0x30')],_0x3b7dff[_0xea84('0x31')]);_0x1ea2bc[_0xea84('0x35')]=_[_0xea84('0x34')](_0x3b7dff['model'],qs[_0xea84('0x36')](_0x50aaa5[_0xea84('0x31')][_0xea84('0x36')]));_0x1ea2bc['attributes']=_0x1ea2bc['attributes'][_0xea84('0x37')]?_0x1ea2bc[_0xea84('0x35')]:_0x3b7dff[_0xea84('0x30')];_0x1ea2bc[_0xea84('0x3a')]=qs[_0xea84('0x3b')](_0x50aaa5[_0xea84('0x31')][_0xea84('0x3b')]);_0x1ea2bc[_0xea84('0x3e')]=qs[_0xea84('0x33')](_['pick'](_0x50aaa5['query'],_0x3b7dff[_0xea84('0x33')]));if(_0x50aaa5[_0xea84('0x31')][_0xea84('0x4e')]){_0x1ea2bc[_0xea84('0x3e')]=_[_0xea84('0x3d')](_0x1ea2bc[_0xea84('0x3e')],{'$or':_[_0xea84('0x2b')](_0x1ea2bc[_0xea84('0x35')],function(_0x5a2c7d){var _0x55f8ed={};_0x55f8ed[_0x5a2c7d]={'$like':'%'+_0x50aaa5[_0xea84('0x31')][_0xea84('0x4e')]+'%'};return _0x55f8ed;})});}_0x1ea2bc=_[_0xea84('0x3d')]({},_0x1ea2bc,_0x50aaa5[_0xea84('0x4f')]);return _0x661ea5[_0xea84('0x50')](_0x1ea2bc);}})[_0xea84('0x25')](function(_0x99bee){if(_0x99bee){_0x4b4463=_0x99bee[_0xea84('0x37')];if(!_0x50aaa5['query'][_0xea84('0x38')]('nolimit')){_0x1ea2bc[_0xea84('0x1e')]=qs[_0xea84('0x1e')](_0x50aaa5[_0xea84('0x31')]['limit']);_0x1ea2bc[_0xea84('0x1d')]=qs['offset'](_0x50aaa5[_0xea84('0x31')][_0xea84('0x1d')]);}return _0x661ea5[_0xea84('0x50')](_0x1ea2bc);}})[_0xea84('0x25')](function(_0x26a740){if(_0x26a740){return _0x26a740?{'count':_0x4b4463,'rows':_0x26a740}:null;}})[_0xea84('0x25')](respondWithResult(_0x337988,null))[_0xea84('0x44')](handleError(_0x337988,null));};exports[_0xea84('0x51')]=function(_0x73a047,_0x3f2712,_0x1c386e){var _0xca5dc0={};var _0xa1ad89={};var _0x33af83;var _0x129db0;return db[_0xea84('0x2c')][_0xea84('0x4c')]({'where':{'id':_0x73a047[_0xea84('0x46')]['id']}})[_0xea84('0x25')](handleEntityNotFound(_0x3f2712,null))['then'](function(_0xada5b7){if(_0xada5b7){_0x33af83=_0xada5b7;_0xa1ad89[_0xea84('0x30')]=_[_0xea84('0x32')](db[_0xea84('0x4d')][_0xea84('0x2d')]);_0xa1ad89['query']=_[_0xea84('0x32')](_0x73a047[_0xea84('0x31')]);_0xa1ad89[_0xea84('0x33')]=_[_0xea84('0x34')](_0xa1ad89['model'],_0xa1ad89['query']);_0xca5dc0[_0xea84('0x35')]=_[_0xea84('0x34')](_0xa1ad89['model'],qs[_0xea84('0x36')](_0x73a047[_0xea84('0x31')][_0xea84('0x36')]));_0xca5dc0[_0xea84('0x35')]=_0xca5dc0[_0xea84('0x35')][_0xea84('0x37')]?_0xca5dc0['attributes']:_0xa1ad89[_0xea84('0x30')];_0xca5dc0[_0xea84('0x3a')]=qs[_0xea84('0x3b')](_0x73a047[_0xea84('0x31')][_0xea84('0x3b')]);_0xca5dc0[_0xea84('0x3e')]=qs[_0xea84('0x33')](_[_0xea84('0x3c')](_0x73a047[_0xea84('0x31')],_0xa1ad89[_0xea84('0x33')]));if(_0x73a047[_0xea84('0x31')][_0xea84('0x4e')]){_0xca5dc0['where']=_[_0xea84('0x3d')](_0xca5dc0[_0xea84('0x3e')],{'$or':_[_0xea84('0x2b')](_0xca5dc0[_0xea84('0x35')],function(_0x46b09b){var _0x1e80b1={};_0x1e80b1[_0x46b09b]={'$like':'%'+_0x73a047[_0xea84('0x31')][_0xea84('0x4e')]+'%'};return _0x1e80b1;})});}_0xca5dc0=_[_0xea84('0x3d')]({},_0xca5dc0,_0x73a047[_0xea84('0x4f')]);return _0x33af83[_0xea84('0x51')](_0xca5dc0);}})[_0xea84('0x25')](function(_0x52f558){if(_0x52f558){_0x129db0=_0x52f558[_0xea84('0x37')];if(!_0x73a047[_0xea84('0x31')][_0xea84('0x38')]('nolimit')){_0xca5dc0[_0xea84('0x1e')]=qs[_0xea84('0x1e')](_0x73a047[_0xea84('0x31')][_0xea84('0x1e')]);_0xca5dc0['offset']=qs['offset'](_0x73a047[_0xea84('0x31')][_0xea84('0x1d')]);}return _0x33af83['getDescriptions'](_0xca5dc0);}})[_0xea84('0x25')](function(_0x41b48b){if(_0x41b48b){return _0x41b48b?{'count':_0x129db0,'rows':_0x41b48b}:null;}})[_0xea84('0x25')](respondWithResult(_0x3f2712,null))[_0xea84('0x44')](handleError(_0x3f2712,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ff2a141..365c308 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5813c4,_0x477e60){var _0x3948c1=function(_0x25a410){while(--_0x25a410){_0x5813c4['push'](_0x5813c4['shift']());}};_0x3948c1(++_0x477e60);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x5b8a70,_0x5179b8){_0x5b8a70=_0x5b8a70-0x0;var _0x455a66=_0xd6d6[_0x5b8a70];return _0x455a66;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa41a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','int_dynamics365_configurations','lodash','util','api'];(function(_0x527011,_0x56489b){var _0x2f8e1c=function(_0x585fbd){while(--_0x585fbd){_0x527011['push'](_0x527011['shift']());}};_0x2f8e1c(++_0x56489b);}(_0xa41a,0x6b));var _0xaa41=function(_0xb7a2d8,_0x10d328){_0xb7a2d8=_0xb7a2d8-0x0;var _0x526e3b=_0xa41a[_0xb7a2d8];return _0x526e3b;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var logger=require('../../config/logger')(_0xaa41('0x2'));var moment=require(_0xaa41('0x3'));var BPromise=require(_0xaa41('0x4'));var rp=require(_0xaa41('0x5'));var fs=require('fs');var path=require(_0xaa41('0x6'));var rimraf=require(_0xaa41('0x7'));var config=require(_0xaa41('0x8'));var attributes=require(_0xaa41('0x9'));module['exports']=function(_0x2122a0,_0x1ec9d4){return _0x2122a0['define']('Dynamics365Configuration',attributes,{'tableName':_0xaa41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 763f6e8..b654768 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 _0xabec=['lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0xde66a8,_0x43d684){var _0x5c97ba=function(_0x3a2c7e){while(--_0x3a2c7e){_0xde66a8['push'](_0xde66a8['shift']());}};_0x5c97ba(++_0x43d684);}(_0xabec,0x8c));var _0xcabe=function(_0x30eb36,_0x4f7dab){_0x30eb36=_0x30eb36-0x0;var _0x1b33d1=_0xabec[_0x30eb36];return _0x1b33d1;};'use strict';var _=require(_0xcabe('0x0'));var util=require(_0xcabe('0x1'));var moment=require('moment');var BPromise=require(_0xcabe('0x2'));var rs=require(_0xcabe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcabe('0x4'))(_0xcabe('0x5'));var config=require(_0xcabe('0x6'));var jayson=require(_0xcabe('0x7'));var client=jayson['client'][_0xcabe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35ee60,_0x458dbc,_0x48dbcf){return new BPromise(function(_0x5e58a8,_0x2eb459){return client[_0xcabe('0x9')](_0x35ee60,_0x48dbcf)[_0xcabe('0xa')](function(_0x5025c2){logger[_0xcabe('0xb')](_0xcabe('0xc'),_0x458dbc,_0xcabe('0xd'));logger[_0xcabe('0xe')](_0xcabe('0xf'),_0x458dbc,_0xcabe('0xd'),JSON[_0xcabe('0x10')](_0x5025c2));if(_0x5025c2['error']){if(_0x5025c2[_0xcabe('0x11')][_0xcabe('0x12')]===0x1f4){logger[_0xcabe('0x11')](_0xcabe('0xc'),_0x458dbc,_0x5025c2[_0xcabe('0x11')][_0xcabe('0x13')]);return _0x2eb459(_0x5025c2['error'][_0xcabe('0x13')]);}logger[_0xcabe('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,_0x5025c2[_0xcabe('0x11')][_0xcabe('0x13')]);return _0x5e58a8(_0x5025c2['error'][_0xcabe('0x13')]);}else{logger[_0xcabe('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,'request\x20sent');_0x5e58a8(_0x5025c2['result'][_0xcabe('0x13')]);}})['catch'](function(_0x28cfbd){logger[_0xcabe('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x458dbc,_0x28cfbd);_0x2eb459(_0x28cfbd);});});} \ No newline at end of file +var _0xca88=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x14301d,_0x223fd4){var _0x46ddcb=function(_0x3f5783){while(--_0x3f5783){_0x14301d['push'](_0x14301d['shift']());}};_0x46ddcb(++_0x223fd4);}(_0xca88,0x14f));var _0x8ca8=function(_0x2fb3dc,_0x4863e3){_0x2fb3dc=_0x2fb3dc-0x0;var _0x293666=_0xca88[_0x2fb3dc];return _0x293666;};'use strict';var _=require(_0x8ca8('0x0'));var util=require(_0x8ca8('0x1'));var moment=require('moment');var BPromise=require(_0x8ca8('0x2'));var rs=require(_0x8ca8('0x3'));var fs=require('fs');var Redis=require(_0x8ca8('0x4'));var db=require(_0x8ca8('0x5'))['db'];var utils=require(_0x8ca8('0x6'));var logger=require(_0x8ca8('0x7'))(_0x8ca8('0x8'));var config=require(_0x8ca8('0x9'));var jayson=require(_0x8ca8('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x44a96a,_0x9d72bd,_0x43452c){return new BPromise(function(_0x35ebed,_0x14bfeb){return client[_0x8ca8('0xb')](_0x44a96a,_0x43452c)['then'](function(_0x4ee904){logger[_0x8ca8('0xc')](_0x8ca8('0xd'),_0x9d72bd,_0x8ca8('0xe'));logger['debug'](_0x8ca8('0xf'),_0x9d72bd,_0x8ca8('0xe'),JSON['stringify'](_0x4ee904));if(_0x4ee904[_0x8ca8('0x10')]){if(_0x4ee904[_0x8ca8('0x10')][_0x8ca8('0x11')]===0x1f4){logger[_0x8ca8('0x10')](_0x8ca8('0xd'),_0x9d72bd,_0x4ee904[_0x8ca8('0x10')][_0x8ca8('0x12')]);return _0x14bfeb(_0x4ee904[_0x8ca8('0x10')][_0x8ca8('0x12')]);}logger[_0x8ca8('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x9d72bd,_0x4ee904[_0x8ca8('0x10')][_0x8ca8('0x12')]);return _0x35ebed(_0x4ee904[_0x8ca8('0x10')][_0x8ca8('0x12')]);}else{logger[_0x8ca8('0xc')](_0x8ca8('0xd'),_0x9d72bd,_0x8ca8('0xe'));_0x35ebed(_0x4ee904[_0x8ca8('0x13')][_0x8ca8('0x12')]);}})[_0x8ca8('0x14')](function(_0x474e4a){logger[_0x8ca8('0x10')](_0x8ca8('0xd'),_0x9d72bd,_0x474e4a);_0x14bfeb(_0x474e4a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 39b4415..c273d9a 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 _0x4c81=['get','isAuthenticated','index','/:id','post','create','put','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','./intDynamics365Field.controller'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4c81,0x1bc));var _0x14c8=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4c81[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x14c8('0x0'));var path=require(_0x14c8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x14c8('0x2')]();var fs_extra=require(_0x14c8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x14c8('0x4'));var config=require('../../config/environment');var controller=require(_0x14c8('0x5'));router[_0x14c8('0x6')]('/',auth[_0x14c8('0x7')](),controller[_0x14c8('0x8')]);router[_0x14c8('0x6')](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller['show']);router[_0x14c8('0xa')]('/',auth['isAuthenticated'](),controller[_0x14c8('0xb')]);router[_0x14c8('0xc')](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller['update']);router['delete'](_0x14c8('0x9'),auth[_0x14c8('0x7')](),controller[_0x14c8('0xd')]);module[_0x14c8('0xe')]=router; \ No newline at end of file +var _0x5259=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','update','delete'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5259,0x1e1));var _0x9525=function(_0x1fc277,_0x4051f4){_0x1fc277=_0x1fc277-0x0;var _0x3ca716=_0x5259[_0x1fc277];return _0x3ca716;};'use strict';var multer=require(_0x9525('0x0'));var util=require(_0x9525('0x1'));var path=require(_0x9525('0x2'));var timeout=require(_0x9525('0x3'));var express=require(_0x9525('0x4'));var router=express['Router']();var fs_extra=require(_0x9525('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9525('0x6'));var config=require(_0x9525('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x9525('0x8')]('/',auth[_0x9525('0x9')](),controller[_0x9525('0xa')]);router['get'](_0x9525('0xb'),auth[_0x9525('0x9')](),controller['show']);router[_0x9525('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9525('0x9')](),controller[_0x9525('0xd')]);router[_0x9525('0xe')]('/:id',auth[_0x9525('0x9')](),controller['destroy']);module[_0x9525('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 67d825e..168ada8 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 _0xe6b2=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','string','customVariable'];(function(_0x3f8ce5,_0x37cc98){var _0x4f43ae=function(_0x5a85d2){while(--_0x5a85d2){_0x3f8ce5['push'](_0x3f8ce5['shift']());}};_0x4f43ae(++_0x37cc98);}(_0xe6b2,0x7a));var _0x2e6b=function(_0x473ac3,_0xf8066a){_0x473ac3=_0x473ac3-0x0;var _0x563cfd=_0xe6b2[_0x473ac3];return _0x563cfd;};'use strict';var Sequelize=require(_0x2e6b('0x0'));module[_0x2e6b('0x1')]={'type':{'type':Sequelize[_0x2e6b('0x2')]('string',_0x2e6b('0x3'),'customVariable',_0x2e6b('0x4'),_0x2e6b('0x5')),'defaultValue':_0x2e6b('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2e6b('0x2')]('string',_0x2e6b('0x3'),_0x2e6b('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2e6b('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2e6b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2e6b('0x8')]}}; \ No newline at end of file +var _0x02a1=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable'];(function(_0x38ff6c,_0x3b8e2b){var _0x1ee0c1=function(_0x10533d){while(--_0x10533d){_0x38ff6c['push'](_0x38ff6c['shift']());}};_0x1ee0c1(++_0x3b8e2b);}(_0x02a1,0x95));var _0x102a=function(_0x3f4177,_0x1f025e){_0x3f4177=_0x3f4177-0x0;var _0x4c86ac=_0x02a1[_0x3f4177];return _0x4c86ac;};'use strict';var Sequelize=require(_0x102a('0x0'));module['exports']={'type':{'type':Sequelize[_0x102a('0x1')](_0x102a('0x2'),_0x102a('0x3'),_0x102a('0x4'),_0x102a('0x5'),_0x102a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x102a('0x1')]('string','variable',_0x102a('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x102a('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x102a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x102a('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 342c8c1..b91f69c 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 _0x7882=['length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','params','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','update','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7882,0x142));var _0x2788=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x7882[_0x2714ec];return _0x2608e5;};'use strict';var emlformat=require(_0x2788('0x0'));var rimraf=require(_0x2788('0x1'));var zipdir=require(_0x2788('0x2'));var jsonpatch=require(_0x2788('0x3'));var rp=require(_0x2788('0x4'));var moment=require(_0x2788('0x5'));var BPromise=require(_0x2788('0x6'));var Mustache=require(_0x2788('0x7'));var util=require('util');var path=require(_0x2788('0x8'));var sox=require(_0x2788('0x9'));var csv=require('to-csv');var ejs=require(_0x2788('0xa'));var fs=require('fs');var fs_extra=require(_0x2788('0xb'));var _=require('lodash');var squel=require(_0x2788('0xc'));var crypto=require(_0x2788('0xd'));var jsforce=require(_0x2788('0xe'));var deskjs=require(_0x2788('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2788('0x10'));var Papa=require(_0x2788('0x11'));var Redis=require(_0x2788('0x12'));var authService=require(_0x2788('0x13'));var qs=require(_0x2788('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2788('0x15'));var logger=require(_0x2788('0x16'))(_0x2788('0x17'));var utils=require(_0x2788('0x18'));var config=require(_0x2788('0x19'));var licenseUtil=require(_0x2788('0x1a'));var db=require(_0x2788('0x1b'))['db'];function respondWithStatusCode(_0x423340,_0x4cf420){_0x4cf420=_0x4cf420||0xcc;return function(_0x117789){if(_0x117789){return _0x423340[_0x2788('0x1c')](_0x4cf420);}return _0x423340[_0x2788('0x1d')](_0x4cf420)[_0x2788('0x1e')]();};}function respondWithResult(_0x68adb6,_0xf55166){_0xf55166=_0xf55166||0xc8;return function(_0x84a5dc){if(_0x84a5dc){return _0x68adb6[_0x2788('0x1d')](_0xf55166)['json'](_0x84a5dc);}};}function respondWithFilteredResult(_0x277384,_0x58dad5){return function(_0x3d8f54){if(_0x3d8f54){var _0x9b19e3=typeof _0x58dad5['offset']===_0x2788('0x1f')&&typeof _0x58dad5[_0x2788('0x20')]==='undefined';var _0x24649a=_0x3d8f54[_0x2788('0x21')];var _0x34c2f0=_0x9b19e3?0x0:_0x58dad5[_0x2788('0x22')];var _0x364606=_0x9b19e3?_0x3d8f54[_0x2788('0x21')]:_0x58dad5[_0x2788('0x22')]+_0x58dad5[_0x2788('0x20')];var _0x47709c;if(_0x364606>=_0x24649a){_0x364606=_0x24649a;_0x47709c=0xc8;}else{_0x47709c=0xce;}_0x277384['status'](_0x47709c);return _0x277384[_0x2788('0x23')](_0x2788('0x24'),_0x34c2f0+'-'+_0x364606+'/'+_0x24649a)['json'](_0x3d8f54);}return null;};}function patchUpdates(_0x2b86dc){return function(_0x462d37){try{jsonpatch[_0x2788('0x25')](_0x462d37,_0x2b86dc,!![]);}catch(_0x41c8cc){return BPromise['reject'](_0x41c8cc);}return _0x462d37['save']();};}function saveUpdates(_0x5ccdb7,_0x4104c8){return function(_0x3be876){if(_0x3be876){return _0x3be876[_0x2788('0x26')](_0x5ccdb7)[_0x2788('0x27')](function(_0x32298e){return _0x32298e;});}return null;};}function removeEntity(_0x16ad5a,_0x324eaf){return function(_0x39790a){if(_0x39790a){return _0x39790a['destroy']()[_0x2788('0x27')](function(){_0x16ad5a[_0x2788('0x1d')](0xcc)[_0x2788('0x1e')]();});}};}function handleEntityNotFound(_0x7f07a,_0x3ce906){return function(_0x172f2d){if(!_0x172f2d){_0x7f07a[_0x2788('0x1c')](0x194);}return _0x172f2d;};}function handleError(_0x4506a9,_0x4883e7){_0x4883e7=_0x4883e7||0x1f4;return function(_0x2982bb){logger[_0x2788('0x28')](_0x2982bb[_0x2788('0x29')]);if(_0x2982bb['name']){delete _0x2982bb[_0x2788('0x2a')];}_0x4506a9[_0x2788('0x1d')](_0x4883e7)[_0x2788('0x2b')](_0x2982bb);};}exports[_0x2788('0x2c')]=function(_0x3b5053,_0x33e60c){var _0x2753c6={},_0x307f0d={},_0xda38f3={'count':0x0,'rows':[]};var _0x520cb9=_[_0x2788('0x2d')](db[_0x2788('0x2e')][_0x2788('0x2f')],function(_0x19a4d1){return{'name':_0x19a4d1[_0x2788('0x30')],'type':_0x19a4d1[_0x2788('0x31')][_0x2788('0x32')]};});_0x307f0d['model']=_[_0x2788('0x2d')](_0x520cb9,_0x2788('0x2a'));_0x307f0d[_0x2788('0x33')]=_[_0x2788('0x34')](_0x3b5053[_0x2788('0x33')]);_0x307f0d[_0x2788('0x35')]=_[_0x2788('0x36')](_0x307f0d[_0x2788('0x37')],_0x307f0d[_0x2788('0x33')]);_0x2753c6[_0x2788('0x38')]=_[_0x2788('0x36')](_0x307f0d[_0x2788('0x37')],qs['fields'](_0x3b5053[_0x2788('0x33')][_0x2788('0x39')]));_0x2753c6[_0x2788('0x38')]=_0x2753c6['attributes'][_0x2788('0x3a')]?_0x2753c6['attributes']:_0x307f0d[_0x2788('0x37')];if(!_0x3b5053[_0x2788('0x33')]['hasOwnProperty'](_0x2788('0x3b'))){_0x2753c6[_0x2788('0x20')]=qs[_0x2788('0x20')](_0x3b5053[_0x2788('0x33')][_0x2788('0x20')]);_0x2753c6[_0x2788('0x22')]=qs[_0x2788('0x22')](_0x3b5053[_0x2788('0x33')]['offset']);}_0x2753c6[_0x2788('0x3c')]=qs['sort'](_0x3b5053[_0x2788('0x33')][_0x2788('0x3d')]);_0x2753c6[_0x2788('0x3e')]=qs[_0x2788('0x35')](_[_0x2788('0x3f')](_0x3b5053['query'],_0x307f0d[_0x2788('0x35')]),_0x520cb9);if(_0x3b5053[_0x2788('0x33')][_0x2788('0x40')]){_0x2753c6[_0x2788('0x3e')]=_[_0x2788('0x41')](_0x2753c6[_0x2788('0x3e')],{'$or':_[_0x2788('0x2d')](_0x520cb9,function(_0x3bd7d8){if(_0x3bd7d8['type']!=='VIRTUAL'){var _0x5a52b5={};_0x5a52b5[_0x3bd7d8[_0x2788('0x2a')]]={'$like':'%'+_0x3b5053[_0x2788('0x33')]['filter']+'%'};return _0x5a52b5;}})});}_0x2753c6=_[_0x2788('0x41')]({},_0x2753c6,_0x3b5053[_0x2788('0x42')]);var _0x5b03f1={'where':_0x2753c6['where']};return db[_0x2788('0x2e')][_0x2788('0x21')](_0x5b03f1)[_0x2788('0x27')](function(_0x2eebaa){_0xda38f3['count']=_0x2eebaa;if(_0x3b5053['query'][_0x2788('0x43')]){_0x2753c6['include']=[{'all':!![]}];}return db[_0x2788('0x2e')][_0x2788('0x44')](_0x2753c6);})['then'](function(_0x3c2c18){_0xda38f3[_0x2788('0x45')]=_0x3c2c18;return _0xda38f3;})[_0x2788('0x27')](respondWithFilteredResult(_0x33e60c,_0x2753c6))['catch'](handleError(_0x33e60c,null));};exports['show']=function(_0x216778,_0x3205ad){var _0x3e7283={'raw':!![],'where':{'id':_0x216778[_0x2788('0x46')]['id']}},_0x4a81ef={};_0x4a81ef[_0x2788('0x37')]=_[_0x2788('0x34')](db['Dynamics365Field'][_0x2788('0x2f')]);_0x4a81ef[_0x2788('0x33')]=_[_0x2788('0x34')](_0x216778[_0x2788('0x33')]);_0x4a81ef[_0x2788('0x35')]=_[_0x2788('0x36')](_0x4a81ef[_0x2788('0x37')],_0x4a81ef['query']);_0x3e7283[_0x2788('0x38')]=_[_0x2788('0x36')](_0x4a81ef[_0x2788('0x37')],qs[_0x2788('0x39')](_0x216778['query'][_0x2788('0x39')]));_0x3e7283[_0x2788('0x38')]=_0x3e7283[_0x2788('0x38')][_0x2788('0x3a')]?_0x3e7283['attributes']:_0x4a81ef[_0x2788('0x37')];if(_0x216778[_0x2788('0x33')][_0x2788('0x43')]){_0x3e7283['include']=[{'all':!![]}];}_0x3e7283=_[_0x2788('0x41')]({},_0x3e7283,_0x216778['options']);return db['Dynamics365Field'][_0x2788('0x47')](_0x3e7283)['then'](handleEntityNotFound(_0x3205ad,null))[_0x2788('0x27')](respondWithResult(_0x3205ad,null))[_0x2788('0x48')](handleError(_0x3205ad,null));};exports[_0x2788('0x49')]=function(_0x2cb263,_0x3dd39b){return db[_0x2788('0x2e')][_0x2788('0x49')](_0x2cb263['body'],{})[_0x2788('0x27')](respondWithResult(_0x3dd39b,0xc9))[_0x2788('0x48')](handleError(_0x3dd39b,null));};exports[_0x2788('0x26')]=function(_0x4e0d6c,_0x7c7cb6){if(_0x4e0d6c['body']['id']){delete _0x4e0d6c[_0x2788('0x4a')]['id'];}return db[_0x2788('0x2e')][_0x2788('0x47')]({'where':{'id':_0x4e0d6c[_0x2788('0x46')]['id']}})[_0x2788('0x27')](handleEntityNotFound(_0x7c7cb6,null))['then'](saveUpdates(_0x4e0d6c['body'],null))[_0x2788('0x27')](respondWithResult(_0x7c7cb6,null))['catch'](handleError(_0x7c7cb6,null));};exports[_0x2788('0x4b')]=function(_0xab6df1,_0x4ac962){return db['Dynamics365Field'][_0x2788('0x47')]({'where':{'id':_0xab6df1[_0x2788('0x46')]['id']}})[_0x2788('0x27')](handleEntityNotFound(_0x4ac962,null))[_0x2788('0x27')](removeEntity(_0x4ac962,null))[_0x2788('0x48')](handleError(_0x4ac962,null));}; \ No newline at end of file +var _0x833d=['path','sox','to-csv','ejs','fs-extra','crypto','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','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','VIRTUAL','where','includeAll','include','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util'];(function(_0x5ef14c,_0x4b8ce1){var _0x3ed7a1=function(_0x4262e1){while(--_0x4262e1){_0x5ef14c['push'](_0x5ef14c['shift']());}};_0x3ed7a1(++_0x4b8ce1);}(_0x833d,0x8b));var _0xd833=function(_0x5a8ef0,_0x310bd4){_0x5a8ef0=_0x5a8ef0-0x0;var _0x4fc6dd=_0x833d[_0x5a8ef0];return _0x4fc6dd;};'use strict';var emlformat=require(_0xd833('0x0'));var rimraf=require(_0xd833('0x1'));var zipdir=require(_0xd833('0x2'));var jsonpatch=require(_0xd833('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd833('0x4'));var Mustache=require(_0xd833('0x5'));var util=require(_0xd833('0x6'));var path=require(_0xd833('0x7'));var sox=require(_0xd833('0x8'));var csv=require(_0xd833('0x9'));var ejs=require(_0xd833('0xa'));var fs=require('fs');var fs_extra=require(_0xd833('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd833('0xc'));var jsforce=require(_0xd833('0xd'));var deskjs=require(_0xd833('0xe'));var toCsv=require(_0xd833('0x9'));var querystring=require(_0xd833('0xf'));var Papa=require(_0xd833('0x10'));var Redis=require(_0xd833('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd833('0x12'));var logger=require(_0xd833('0x13'))(_0xd833('0x14'));var utils=require(_0xd833('0x15'));var config=require(_0xd833('0x16'));var licenseUtil=require(_0xd833('0x17'));var db=require(_0xd833('0x18'))['db'];function respondWithStatusCode(_0x38c5e5,_0xb92593){_0xb92593=_0xb92593||0xcc;return function(_0x105d18){if(_0x105d18){return _0x38c5e5[_0xd833('0x19')](_0xb92593);}return _0x38c5e5[_0xd833('0x1a')](_0xb92593)[_0xd833('0x1b')]();};}function respondWithResult(_0x23a220,_0x50101d){_0x50101d=_0x50101d||0xc8;return function(_0x51c1fd){if(_0x51c1fd){return _0x23a220['status'](_0x50101d)[_0xd833('0x1c')](_0x51c1fd);}};}function respondWithFilteredResult(_0x466c32,_0x21b4c6){return function(_0x3a9feb){if(_0x3a9feb){var _0x331f26=typeof _0x21b4c6[_0xd833('0x1d')]===_0xd833('0x1e')&&typeof _0x21b4c6[_0xd833('0x1f')]===_0xd833('0x1e');var _0x30c64c=_0x3a9feb[_0xd833('0x20')];var _0xc27f16=_0x331f26?0x0:_0x21b4c6[_0xd833('0x1d')];var _0x32f6f7=_0x331f26?_0x3a9feb[_0xd833('0x20')]:_0x21b4c6[_0xd833('0x1d')]+_0x21b4c6[_0xd833('0x1f')];var _0x384f2c;if(_0x32f6f7>=_0x30c64c){_0x32f6f7=_0x30c64c;_0x384f2c=0xc8;}else{_0x384f2c=0xce;}_0x466c32[_0xd833('0x1a')](_0x384f2c);return _0x466c32[_0xd833('0x21')]('Content-Range',_0xc27f16+'-'+_0x32f6f7+'/'+_0x30c64c)[_0xd833('0x1c')](_0x3a9feb);}return null;};}function patchUpdates(_0x175b0b){return function(_0x8588f4){try{jsonpatch['apply'](_0x8588f4,_0x175b0b,!![]);}catch(_0x5eb336){return BPromise[_0xd833('0x22')](_0x5eb336);}return _0x8588f4[_0xd833('0x23')]();};}function saveUpdates(_0x20c63d,_0x338b9b){return function(_0x537b28){if(_0x537b28){return _0x537b28[_0xd833('0x24')](_0x20c63d)[_0xd833('0x25')](function(_0x4b0dab){return _0x4b0dab;});}return null;};}function removeEntity(_0x558da8,_0xf6e7fb){return function(_0x394e81){if(_0x394e81){return _0x394e81[_0xd833('0x26')]()[_0xd833('0x25')](function(){_0x558da8[_0xd833('0x1a')](0xcc)[_0xd833('0x1b')]();});}};}function handleEntityNotFound(_0x50fff3,_0x13f516){return function(_0x4e1abf){if(!_0x4e1abf){_0x50fff3[_0xd833('0x19')](0x194);}return _0x4e1abf;};}function handleError(_0xe27292,_0xf1d8f2){_0xf1d8f2=_0xf1d8f2||0x1f4;return function(_0x57f220){logger[_0xd833('0x27')](_0x57f220[_0xd833('0x28')]);if(_0x57f220[_0xd833('0x29')]){delete _0x57f220['name'];}_0xe27292[_0xd833('0x1a')](_0xf1d8f2)[_0xd833('0x2a')](_0x57f220);};}exports[_0xd833('0x2b')]=function(_0x3241a9,_0x5ed020){var _0x538886={},_0x4f9bea={},_0xb5d0e8={'count':0x0,'rows':[]};var _0x3a5dd3=_[_0xd833('0x2c')](db[_0xd833('0x2d')][_0xd833('0x2e')],function(_0x396a21){return{'name':_0x396a21['fieldName'],'type':_0x396a21[_0xd833('0x2f')][_0xd833('0x30')]};});_0x4f9bea[_0xd833('0x31')]=_[_0xd833('0x2c')](_0x3a5dd3,_0xd833('0x29'));_0x4f9bea[_0xd833('0x32')]=_['keys'](_0x3241a9[_0xd833('0x32')]);_0x4f9bea[_0xd833('0x33')]=_[_0xd833('0x34')](_0x4f9bea[_0xd833('0x31')],_0x4f9bea[_0xd833('0x32')]);_0x538886[_0xd833('0x35')]=_[_0xd833('0x34')](_0x4f9bea['model'],qs[_0xd833('0x36')](_0x3241a9[_0xd833('0x32')][_0xd833('0x36')]));_0x538886[_0xd833('0x35')]=_0x538886[_0xd833('0x35')][_0xd833('0x37')]?_0x538886[_0xd833('0x35')]:_0x4f9bea['model'];if(!_0x3241a9[_0xd833('0x32')][_0xd833('0x38')](_0xd833('0x39'))){_0x538886['limit']=qs[_0xd833('0x1f')](_0x3241a9[_0xd833('0x32')]['limit']);_0x538886['offset']=qs[_0xd833('0x1d')](_0x3241a9[_0xd833('0x32')]['offset']);}_0x538886[_0xd833('0x3a')]=qs[_0xd833('0x3b')](_0x3241a9[_0xd833('0x32')]['sort']);_0x538886['where']=qs[_0xd833('0x33')](_[_0xd833('0x3c')](_0x3241a9[_0xd833('0x32')],_0x4f9bea[_0xd833('0x33')]),_0x3a5dd3);if(_0x3241a9['query'][_0xd833('0x3d')]){_0x538886['where']=_[_0xd833('0x3e')](_0x538886['where'],{'$or':_[_0xd833('0x2c')](_0x3a5dd3,function(_0x24f495){if(_0x24f495[_0xd833('0x2f')]!==_0xd833('0x3f')){var _0xe766bc={};_0xe766bc[_0x24f495['name']]={'$like':'%'+_0x3241a9[_0xd833('0x32')][_0xd833('0x3d')]+'%'};return _0xe766bc;}})});}_0x538886=_[_0xd833('0x3e')]({},_0x538886,_0x3241a9['options']);var _0x49c958={'where':_0x538886[_0xd833('0x40')]};return db[_0xd833('0x2d')][_0xd833('0x20')](_0x49c958)[_0xd833('0x25')](function(_0x274b4c){_0xb5d0e8[_0xd833('0x20')]=_0x274b4c;if(_0x3241a9[_0xd833('0x32')][_0xd833('0x41')]){_0x538886[_0xd833('0x42')]=[{'all':!![]}];}return db[_0xd833('0x2d')]['findAll'](_0x538886);})[_0xd833('0x25')](function(_0x372c3a){_0xb5d0e8[_0xd833('0x43')]=_0x372c3a;return _0xb5d0e8;})[_0xd833('0x25')](respondWithFilteredResult(_0x5ed020,_0x538886))[_0xd833('0x44')](handleError(_0x5ed020,null));};exports['show']=function(_0x235d58,_0x2696c0){var _0x3a8fc0={'raw':!![],'where':{'id':_0x235d58[_0xd833('0x45')]['id']}},_0x2b2914={};_0x2b2914[_0xd833('0x31')]=_['keys'](db[_0xd833('0x2d')][_0xd833('0x2e')]);_0x2b2914[_0xd833('0x32')]=_['keys'](_0x235d58[_0xd833('0x32')]);_0x2b2914[_0xd833('0x33')]=_['intersection'](_0x2b2914[_0xd833('0x31')],_0x2b2914[_0xd833('0x32')]);_0x3a8fc0[_0xd833('0x35')]=_[_0xd833('0x34')](_0x2b2914[_0xd833('0x31')],qs[_0xd833('0x36')](_0x235d58[_0xd833('0x32')][_0xd833('0x36')]));_0x3a8fc0[_0xd833('0x35')]=_0x3a8fc0[_0xd833('0x35')][_0xd833('0x37')]?_0x3a8fc0[_0xd833('0x35')]:_0x2b2914['model'];if(_0x235d58[_0xd833('0x32')]['includeAll']){_0x3a8fc0['include']=[{'all':!![]}];}_0x3a8fc0=_[_0xd833('0x3e')]({},_0x3a8fc0,_0x235d58['options']);return db[_0xd833('0x2d')]['find'](_0x3a8fc0)[_0xd833('0x25')](handleEntityNotFound(_0x2696c0,null))[_0xd833('0x25')](respondWithResult(_0x2696c0,null))[_0xd833('0x44')](handleError(_0x2696c0,null));};exports['create']=function(_0x1fbf5b,_0x1ae445){return db[_0xd833('0x2d')][_0xd833('0x46')](_0x1fbf5b[_0xd833('0x47')],{})[_0xd833('0x25')](respondWithResult(_0x1ae445,0xc9))[_0xd833('0x44')](handleError(_0x1ae445,null));};exports[_0xd833('0x24')]=function(_0x5c3064,_0x420b8f){if(_0x5c3064[_0xd833('0x47')]['id']){delete _0x5c3064[_0xd833('0x47')]['id'];}return db[_0xd833('0x2d')][_0xd833('0x48')]({'where':{'id':_0x5c3064[_0xd833('0x45')]['id']}})[_0xd833('0x25')](handleEntityNotFound(_0x420b8f,null))[_0xd833('0x25')](saveUpdates(_0x5c3064['body'],null))[_0xd833('0x25')](respondWithResult(_0x420b8f,null))['catch'](handleError(_0x420b8f,null));};exports[_0xd833('0x26')]=function(_0xd9b40e,_0x3ea19d){return db[_0xd833('0x2d')][_0xd833('0x48')]({'where':{'id':_0xd9b40e['params']['id']}})[_0xd833('0x25')](handleEntityNotFound(_0x3ea19d,null))[_0xd833('0x25')](removeEntity(_0x3ea19d,null))[_0xd833('0x44')](handleError(_0x3ea19d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 01b5a6c..e46e85e 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 _0x298a=['exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Field.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x298a,0x14a));var _0xa298=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x298a[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xa298('0x0'));var util=require(_0xa298('0x1'));var logger=require(_0xa298('0x2'))(_0xa298('0x3'));var moment=require(_0xa298('0x4'));var BPromise=require(_0xa298('0x5'));var rp=require(_0xa298('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa298('0x7'));var config=require(_0xa298('0x8'));var attributes=require(_0xa298('0x9'));module[_0xa298('0xa')]=function(_0xb05593,_0x1ffbb5){return _0xb05593[_0xa298('0xb')](_0xa298('0xc'),attributes,{'tableName':_0xa298('0xd'),'paranoid':![],'indexes':[{'name':_0xa298('0xe'),'fields':[_0xa298('0xf'),_0xa298('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xde62=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','int_dynamics365_fields','FieldId','lodash','util'];(function(_0x4c0b76,_0x21ac4c){var _0x3b31c3=function(_0x3d572b){while(--_0x3d572b){_0x4c0b76['push'](_0x4c0b76['shift']());}};_0x3b31c3(++_0x21ac4c);}(_0xde62,0x150));var _0x2de6=function(_0x460afc,_0x3d28be){_0x460afc=_0x460afc-0x0;var _0x1807b1=_0xde62[_0x460afc];return _0x1807b1;};'use strict';var _=require(_0x2de6('0x0'));var util=require(_0x2de6('0x1'));var logger=require(_0x2de6('0x2'))(_0x2de6('0x3'));var moment=require(_0x2de6('0x4'));var BPromise=require(_0x2de6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2de6('0x6'));var rimraf=require(_0x2de6('0x7'));var config=require(_0x2de6('0x8'));var attributes=require(_0x2de6('0x9'));module[_0x2de6('0xa')]=function(_0x51f8e9,_0x1b7c62){return _0x51f8e9['define']('Dynamics365Field',attributes,{'tableName':_0x2de6('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x2de6('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 0a457a1..0ef1b82 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 _0x5795=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3a57a3,_0x5673df){var _0x292eda=function(_0x1a321f){while(--_0x1a321f){_0x3a57a3['push'](_0x3a57a3['shift']());}};_0x292eda(++_0x5673df);}(_0x5795,0xd1));var _0x5579=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x5795[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5579('0x0'));var util=require(_0x5579('0x1'));var moment=require(_0x5579('0x2'));var BPromise=require(_0x5579('0x3'));var rs=require(_0x5579('0x4'));var fs=require('fs');var Redis=require(_0x5579('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5579('0x6'));var config=require(_0x5579('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5579('0x8')][_0x5579('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3eee07,_0x93bedd,_0x16b184){return new BPromise(function(_0x47984b,_0x51c579){return client[_0x5579('0xa')](_0x3eee07,_0x16b184)[_0x5579('0xb')](function(_0x502e86){logger['info'](_0x5579('0xc'),_0x93bedd,_0x5579('0xd'));logger[_0x5579('0xe')](_0x5579('0xf'),_0x93bedd,'request\x20sent',JSON[_0x5579('0x10')](_0x502e86));if(_0x502e86['error']){if(_0x502e86[_0x5579('0x11')][_0x5579('0x12')]===0x1f4){logger[_0x5579('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x93bedd,_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);return _0x51c579(_0x502e86['error']['message']);}logger[_0x5579('0x11')](_0x5579('0xc'),_0x93bedd,_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);return _0x47984b(_0x502e86[_0x5579('0x11')][_0x5579('0x13')]);}else{logger[_0x5579('0x14')](_0x5579('0xc'),_0x93bedd,_0x5579('0xd'));_0x47984b(_0x502e86[_0x5579('0x15')][_0x5579('0x13')]);}})[_0x5579('0x16')](function(_0x45f200){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x93bedd,_0x45f200);_0x51c579(_0x45f200);});});} \ No newline at end of file +var _0xccfd=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x4c8cb1,_0x190e3b){var _0x10ab50=function(_0x12c2d9){while(--_0x12c2d9){_0x4c8cb1['push'](_0x4c8cb1['shift']());}};_0x10ab50(++_0x190e3b);}(_0xccfd,0x66));var _0xdccf=function(_0x2813a0,_0x4ff5d7){_0x2813a0=_0x2813a0-0x0;var _0x50b24d=_0xccfd[_0x2813a0];return _0x50b24d;};'use strict';var _=require(_0xdccf('0x0'));var util=require(_0xdccf('0x1'));var moment=require(_0xdccf('0x2'));var BPromise=require(_0xdccf('0x3'));var rs=require(_0xdccf('0x4'));var fs=require('fs');var Redis=require(_0xdccf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdccf('0x6'));var logger=require('../../config/logger')(_0xdccf('0x7'));var config=require(_0xdccf('0x8'));var jayson=require(_0xdccf('0x9'));var client=jayson['client'][_0xdccf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f766d,_0x269a03,_0x36418a){return new BPromise(function(_0x1c201f,_0x4111fd){return client['request'](_0x3f766d,_0x36418a)[_0xdccf('0xb')](function(_0x5feb8e){logger[_0xdccf('0xc')](_0xdccf('0xd'),_0x269a03,_0xdccf('0xe'));logger[_0xdccf('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x269a03,_0xdccf('0xe'),JSON['stringify'](_0x5feb8e));if(_0x5feb8e[_0xdccf('0x10')]){if(_0x5feb8e[_0xdccf('0x10')][_0xdccf('0x11')]===0x1f4){logger[_0xdccf('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x269a03,_0x5feb8e['error']['message']);return _0x4111fd(_0x5feb8e[_0xdccf('0x10')][_0xdccf('0x12')]);}logger[_0xdccf('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0x269a03,_0x5feb8e[_0xdccf('0x10')][_0xdccf('0x12')]);return _0x1c201f(_0x5feb8e[_0xdccf('0x10')][_0xdccf('0x12')]);}else{logger[_0xdccf('0xc')](_0xdccf('0xd'),_0x269a03,_0xdccf('0xe'));_0x1c201f(_0x5feb8e[_0xdccf('0x13')]['message']);}})['catch'](function(_0x6cfab1){logger['error'](_0xdccf('0xd'),_0x269a03,_0x6cfab1);_0x4111fd(_0x6cfab1);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 65bd9d4..5cba844 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 _0x15e1=['post','create','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields'];(function(_0x42a010,_0x20ae1a){var _0x351067=function(_0x1e8439){while(--_0x1e8439){_0x42a010['push'](_0x42a010['shift']());}};_0x351067(++_0x20ae1a);}(_0x15e1,0x13a));var _0x115e=function(_0x444024,_0x44b7d9){_0x444024=_0x444024-0x0;var _0x2eb8dc=_0x15e1[_0x444024];return _0x2eb8dc;};'use strict';var multer=require(_0x115e('0x0'));var util=require(_0x115e('0x1'));var path=require(_0x115e('0x2'));var timeout=require(_0x115e('0x3'));var express=require(_0x115e('0x4'));var router=express['Router']();var fs_extra=require(_0x115e('0x5'));var auth=require(_0x115e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x115e('0x7'));var controller=require(_0x115e('0x8'));router[_0x115e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x115e('0x9')](_0x115e('0xa'),auth[_0x115e('0xb')](),controller[_0x115e('0xc')]);router[_0x115e('0x9')](_0x115e('0xd'),auth[_0x115e('0xb')](),controller['getConfigurations']);router['get'](_0x115e('0xe'),auth[_0x115e('0xb')](),controller[_0x115e('0xf')]);router[_0x115e('0x10')]('/',auth['isAuthenticated'](),controller[_0x115e('0x11')]);router[_0x115e('0x10')]('/:id/configurations',auth[_0x115e('0xb')](),controller[_0x115e('0x12')]);router['put'](_0x115e('0xa'),auth[_0x115e('0xb')](),controller[_0x115e('0x13')]);router[_0x115e('0x14')](_0x115e('0xa'),auth[_0x115e('0xb')](),controller['destroy']);module[_0x115e('0x15')]=router; \ No newline at end of file +var _0x44ce=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','exports','path','express','fs-extra','../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x44ce,0x161));var _0xe44c=function(_0x2433ce,_0xb32257){_0x2433ce=_0x2433ce-0x0;var _0x7cfeb9=_0x44ce[_0x2433ce];return _0x7cfeb9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe44c('0x0'));var timeout=require('connect-timeout');var express=require(_0xe44c('0x1'));var router=express['Router']();var fs_extra=require(_0xe44c('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe44c('0x3'));var config=require('../../config/environment');var controller=require(_0xe44c('0x4'));router[_0xe44c('0x5')]('/',auth[_0xe44c('0x6')](),controller['index']);router['get'](_0xe44c('0x7'),auth['isAuthenticated'](),controller[_0xe44c('0x8')]);router[_0xe44c('0x5')](_0xe44c('0x9'),auth[_0xe44c('0x6')](),controller[_0xe44c('0xa')]);router[_0xe44c('0x5')](_0xe44c('0xb'),auth['isAuthenticated'](),controller[_0xe44c('0xc')]);router[_0xe44c('0xd')]('/',auth[_0xe44c('0x6')](),controller['create']);router['post'](_0xe44c('0x9'),auth['isAuthenticated'](),controller[_0xe44c('0xe')]);router[_0xe44c('0xf')](_0xe44c('0x7'),auth[_0xe44c('0x6')](),controller[_0xe44c('0x10')]);router['delete']('/:id',auth[_0xe44c('0x6')](),controller[_0xe44c('0x11')]);module[_0xe44c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e74778b..8184c2f 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 _0x4bd3=['sequelize','STRING','remoteUri'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0x4bd3,0x174));var _0x34bd=function(_0x4437ee,_0x5dd6ab){_0x4437ee=_0x4437ee-0x0;var _0xd7fac8=_0x4bd3[_0x4437ee];return _0xd7fac8;};'use strict';var Sequelize=require(_0x34bd('0x0'));module['exports']={'name':{'type':Sequelize[_0x34bd('0x1')]},'description':{'type':Sequelize[_0x34bd('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x34bd('0x1')],'unique':_0x34bd('0x2')},'serverUrl':{'type':Sequelize[_0x34bd('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x1e5c27,_0x57cffe){var _0x1f2b2b=function(_0x3a594a){while(--_0x3a594a){_0x1e5c27['push'](_0x1e5c27['shift']());}};_0x1f2b2b(++_0x57cffe);}(_0x02ce,0x1ac));var _0xe02c=function(_0x3dd027,_0x3e1684){_0x3dd027=_0x3dd027-0x0;var _0xe63dba=_0x02ce[_0x3dd027];return _0xe63dba;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('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 3319ed5..1d9eeaa 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 _0x559a=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','base64','requester','agent','description','priority','source','ticket_type','group','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields'];(function(_0x8ce9e0,_0x3aea7c){var _0x332c52=function(_0x5518e9){while(--_0x5518e9){_0x8ce9e0['push'](_0x8ce9e0['shift']());}};_0x332c52(++_0x3aea7c);}(_0x559a,0xb3));var _0xa559=function(_0x5c65d7,_0x286eae){_0x5c65d7=_0x5c65d7-0x0;var _0x8b79b7=_0x559a[_0x5c65d7];return _0x8b79b7;};'use strict';var emlformat=require(_0xa559('0x0'));var rimraf=require(_0xa559('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa559('0x2'));var rp=require(_0xa559('0x3'));var moment=require(_0xa559('0x4'));var BPromise=require(_0xa559('0x5'));var Mustache=require(_0xa559('0x6'));var util=require(_0xa559('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xa559('0x8'));var ejs=require(_0xa559('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa559('0xa'));var squel=require(_0xa559('0xb'));var crypto=require('crypto');var jsforce=require(_0xa559('0xc'));var deskjs=require(_0xa559('0xd'));var toCsv=require(_0xa559('0x8'));var querystring=require(_0xa559('0xe'));var Papa=require('papaparse');var Redis=require(_0xa559('0xf'));var authService=require(_0xa559('0x10'));var qs=require(_0xa559('0x11'));var as=require(_0xa559('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa559('0x13'));var utils=require(_0xa559('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa559('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa559('0x16'));function respondWithStatusCode(_0x5f0463,_0x2a646e){_0x2a646e=_0x2a646e||0xcc;return function(_0x3a82f7){if(_0x3a82f7){return _0x5f0463[_0xa559('0x17')](_0x2a646e);}return _0x5f0463['status'](_0x2a646e)[_0xa559('0x18')]();};}function respondWithResult(_0x3853fd,_0x5ed915){_0x5ed915=_0x5ed915||0xc8;return function(_0x32b782){if(_0x32b782){return _0x3853fd[_0xa559('0x19')](_0x5ed915)[_0xa559('0x1a')](_0x32b782);}};}function respondWithFilteredResult(_0x1e48b3,_0x539a4b){return function(_0x309c27){if(_0x309c27){var _0x495b96=typeof _0x539a4b[_0xa559('0x1b')]===_0xa559('0x1c')&&typeof _0x539a4b['limit']===_0xa559('0x1c');var _0x174740=_0x309c27[_0xa559('0x1d')];var _0xd21ebf=_0x495b96?0x0:_0x539a4b[_0xa559('0x1b')];var _0x16f090=_0x495b96?_0x309c27[_0xa559('0x1d')]:_0x539a4b[_0xa559('0x1b')]+_0x539a4b[_0xa559('0x1e')];var _0x9ae158;if(_0x16f090>=_0x174740){_0x16f090=_0x174740;_0x9ae158=0xc8;}else{_0x9ae158=0xce;}_0x1e48b3['status'](_0x9ae158);return _0x1e48b3['set'](_0xa559('0x1f'),_0xd21ebf+'-'+_0x16f090+'/'+_0x174740)[_0xa559('0x1a')](_0x309c27);}return null;};}function patchUpdates(_0x47cb65){return function(_0x3496c3){try{jsonpatch[_0xa559('0x20')](_0x3496c3,_0x47cb65,!![]);}catch(_0x185781){return BPromise[_0xa559('0x21')](_0x185781);}return _0x3496c3[_0xa559('0x22')]();};}function saveUpdates(_0x2dd8cf,_0x572046){return function(_0x36aa43){if(_0x36aa43){return _0x36aa43['update'](_0x2dd8cf)[_0xa559('0x23')](function(_0x396fe9){return _0x396fe9;});}return null;};}function removeEntity(_0x314fef,_0x487a60){return function(_0xc37c82){if(_0xc37c82){return _0xc37c82['destroy']()[_0xa559('0x23')](function(){_0x314fef[_0xa559('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5181,_0x552c2c){return function(_0x4d41cf){if(!_0x4d41cf){_0x2a5181[_0xa559('0x17')](0x194);}return _0x4d41cf;};}function handleError(_0x1914e7,_0x3fcf7f){_0x3fcf7f=_0x3fcf7f||0x1f4;return function(_0x24229d){logger[_0xa559('0x24')](_0x24229d[_0xa559('0x25')]);if(_0x24229d[_0xa559('0x26')]){delete _0x24229d[_0xa559('0x26')];}_0x1914e7['status'](_0x3fcf7f)[_0xa559('0x27')](_0x24229d);};}exports[_0xa559('0x28')]=function(_0x21c8a0,_0x1c92b9){var _0x5f3fbb={},_0x1fb70f={},_0x32db9d={'count':0x0,'rows':[]};var _0x195ec4=_['map'](db[_0xa559('0x29')][_0xa559('0x2a')],function(_0xd0481e){return{'name':_0xd0481e[_0xa559('0x2b')],'type':_0xd0481e[_0xa559('0x2c')][_0xa559('0x2d')]};});_0x1fb70f[_0xa559('0x2e')]=_[_0xa559('0x2f')](_0x195ec4,_0xa559('0x26'));_0x1fb70f['query']=_[_0xa559('0x30')](_0x21c8a0[_0xa559('0x31')]);_0x1fb70f[_0xa559('0x32')]=_[_0xa559('0x33')](_0x1fb70f['model'],_0x1fb70f[_0xa559('0x31')]);_0x5f3fbb['attributes']=_[_0xa559('0x33')](_0x1fb70f[_0xa559('0x2e')],qs[_0xa559('0x34')](_0x21c8a0[_0xa559('0x31')][_0xa559('0x34')]));_0x5f3fbb[_0xa559('0x35')]=_0x5f3fbb['attributes'][_0xa559('0x36')]?_0x5f3fbb[_0xa559('0x35')]:_0x1fb70f[_0xa559('0x2e')];if(!_0x21c8a0[_0xa559('0x31')][_0xa559('0x37')](_0xa559('0x38'))){_0x5f3fbb[_0xa559('0x1e')]=qs[_0xa559('0x1e')](_0x21c8a0['query'][_0xa559('0x1e')]);_0x5f3fbb[_0xa559('0x1b')]=qs[_0xa559('0x1b')](_0x21c8a0[_0xa559('0x31')][_0xa559('0x1b')]);}_0x5f3fbb[_0xa559('0x39')]=qs[_0xa559('0x3a')](_0x21c8a0['query'][_0xa559('0x3a')]);_0x5f3fbb[_0xa559('0x3b')]=qs[_0xa559('0x32')](_[_0xa559('0x3c')](_0x21c8a0[_0xa559('0x31')],_0x1fb70f[_0xa559('0x32')]),_0x195ec4);if(_0x21c8a0[_0xa559('0x31')][_0xa559('0x3d')]){_0x5f3fbb[_0xa559('0x3b')]=_[_0xa559('0x3e')](_0x5f3fbb[_0xa559('0x3b')],{'$or':_[_0xa559('0x2f')](_0x195ec4,function(_0xe9dc78){if(_0xe9dc78['type']!==_0xa559('0x3f')){var _0x49adbd={};_0x49adbd[_0xe9dc78[_0xa559('0x26')]]={'$like':'%'+_0x21c8a0['query'][_0xa559('0x3d')]+'%'};return _0x49adbd;}})});}_0x5f3fbb=_['merge']({},_0x5f3fbb,_0x21c8a0[_0xa559('0x40')]);var _0x1ef87b={'where':_0x5f3fbb[_0xa559('0x3b')]};return db[_0xa559('0x29')][_0xa559('0x1d')](_0x1ef87b)[_0xa559('0x23')](function(_0x1e22fe){_0x32db9d['count']=_0x1e22fe;if(_0x21c8a0[_0xa559('0x31')][_0xa559('0x41')]){_0x5f3fbb[_0xa559('0x42')]=[{'all':!![]}];}return db[_0xa559('0x29')][_0xa559('0x43')](_0x5f3fbb);})[_0xa559('0x23')](function(_0x5e7a22){_0x32db9d[_0xa559('0x44')]=_0x5e7a22;return _0x32db9d;})[_0xa559('0x23')](respondWithFilteredResult(_0x1c92b9,_0x5f3fbb))[_0xa559('0x45')](handleError(_0x1c92b9,null));};exports[_0xa559('0x46')]=function(_0x5d6325,_0x6340d3){var _0x2af622={'raw':![],'where':{'id':_0x5d6325[_0xa559('0x47')]['id']}},_0x16e21d={};_0x16e21d[_0xa559('0x2e')]=_['keys'](db[_0xa559('0x29')][_0xa559('0x2a')]);_0x16e21d[_0xa559('0x31')]=_[_0xa559('0x30')](_0x5d6325[_0xa559('0x31')]);_0x16e21d[_0xa559('0x32')]=_[_0xa559('0x33')](_0x16e21d['model'],_0x16e21d[_0xa559('0x31')]);_0x2af622[_0xa559('0x35')]=_[_0xa559('0x33')](_0x16e21d[_0xa559('0x2e')],qs[_0xa559('0x34')](_0x5d6325[_0xa559('0x31')][_0xa559('0x34')]));_0x2af622[_0xa559('0x35')]=_0x2af622[_0xa559('0x35')]['length']?_0x2af622[_0xa559('0x35')]:_0x16e21d[_0xa559('0x2e')];if(_0x5d6325[_0xa559('0x31')][_0xa559('0x41')]){_0x2af622[_0xa559('0x42')]=[{'all':!![]}];}_0x2af622=_[_0xa559('0x3e')]({},_0x2af622,_0x5d6325[_0xa559('0x40')]);return db['FreshdeskAccount'][_0xa559('0x48')](_0x2af622)[_0xa559('0x23')](handleEntityNotFound(_0x6340d3,null))[_0xa559('0x23')](respondWithResult(_0x6340d3,null))[_0xa559('0x45')](handleError(_0x6340d3,null));};exports[_0xa559('0x49')]=function(_0x482e46,_0x3e917c){return db[_0xa559('0x29')]['create'](_0x482e46[_0xa559('0x4a')],{})[_0xa559('0x23')](respondWithResult(_0x3e917c,0xc9))['catch'](handleError(_0x3e917c,null));};exports['update']=function(_0x140490,_0x27cd4f){if(_0x140490[_0xa559('0x4a')]['id']){delete _0x140490[_0xa559('0x4a')]['id'];}return db[_0xa559('0x29')][_0xa559('0x48')]({'where':{'id':_0x140490['params']['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x27cd4f,null))['then'](saveUpdates(_0x140490['body'],null))['then'](respondWithResult(_0x27cd4f,null))[_0xa559('0x45')](handleError(_0x27cd4f,null));};exports[_0xa559('0x4b')]=function(_0x17453f,_0xad03d0){return db[_0xa559('0x29')][_0xa559('0x48')]({'where':{'id':_0x17453f[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0xad03d0,null))[_0xa559('0x23')](removeEntity(_0xad03d0,null))[_0xa559('0x45')](handleError(_0xad03d0,null));};exports[_0xa559('0x4c')]=function(_0x4abc17,_0x284005,_0x2be007){var _0x163e43={};var _0x580259={};var _0x38fb71;var _0x5da1aa;return db[_0xa559('0x29')][_0xa559('0x4d')]({'where':{'id':_0x4abc17[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x284005,null))[_0xa559('0x23')](function(_0x3b0fdb){if(_0x3b0fdb){_0x38fb71=_0x3b0fdb;_0x580259[_0xa559('0x2e')]=_[_0xa559('0x30')](db['FreshdeskConfiguration'][_0xa559('0x2a')]);_0x580259[_0xa559('0x31')]=_[_0xa559('0x30')](_0x4abc17['query']);_0x580259['filters']=_[_0xa559('0x33')](_0x580259[_0xa559('0x2e')],_0x580259['query']);_0x163e43[_0xa559('0x35')]=_[_0xa559('0x33')](_0x580259[_0xa559('0x2e')],qs['fields'](_0x4abc17[_0xa559('0x31')][_0xa559('0x34')]));_0x163e43['attributes']=_0x163e43['attributes']['length']?_0x163e43[_0xa559('0x35')]:_0x580259[_0xa559('0x2e')];_0x163e43[_0xa559('0x39')]=qs[_0xa559('0x3a')](_0x4abc17[_0xa559('0x31')][_0xa559('0x3a')]);_0x163e43[_0xa559('0x3b')]=qs[_0xa559('0x32')](_['pick'](_0x4abc17['query'],_0x580259[_0xa559('0x32')]));if(_0x4abc17[_0xa559('0x31')][_0xa559('0x3d')]){_0x163e43['where']=_[_0xa559('0x3e')](_0x163e43[_0xa559('0x3b')],{'$or':_['map'](_0x163e43[_0xa559('0x35')],function(_0x1997dd){var _0x114dcd={};_0x114dcd[_0x1997dd]={'$like':'%'+_0x4abc17[_0xa559('0x31')][_0xa559('0x3d')]+'%'};return _0x114dcd;})});}_0x163e43=_[_0xa559('0x3e')]({},_0x163e43,_0x4abc17[_0xa559('0x40')]);return _0x38fb71[_0xa559('0x4c')](_0x163e43);}})['then'](function(_0x3c488a){if(_0x3c488a){_0x5da1aa=_0x3c488a[_0xa559('0x36')];if(!_0x4abc17['query'][_0xa559('0x37')](_0xa559('0x38'))){_0x163e43[_0xa559('0x1e')]=qs[_0xa559('0x1e')](_0x4abc17[_0xa559('0x31')][_0xa559('0x1e')]);_0x163e43[_0xa559('0x1b')]=qs[_0xa559('0x1b')](_0x4abc17['query'][_0xa559('0x1b')]);}return _0x38fb71[_0xa559('0x4c')](_0x163e43);}})[_0xa559('0x23')](function(_0xf75eae){if(_0xf75eae){return _0xf75eae?{'count':_0x5da1aa,'rows':_0xf75eae}:null;}})[_0xa559('0x23')](respondWithResult(_0x284005,null))[_0xa559('0x45')](handleError(_0x284005,null));};exports[_0xa559('0x4e')]=function(_0x536019,_0x2f0ea1,_0x41329f){if(_0x536019[_0xa559('0x4a')]['id']){delete _0x536019['body']['id'];}return db[_0xa559('0x29')][_0xa559('0x4d')]({'where':{'id':_0x536019[_0xa559('0x47')]['id']}})[_0xa559('0x23')](handleEntityNotFound(_0x2f0ea1,null))[_0xa559('0x23')](function(_0x2c3c6d){if(_0x2c3c6d){_0x536019[_0xa559('0x4a')][_0xa559('0x4f')]=_0x2c3c6d['id'];_0x536019['body'][_0xa559('0x50')]=integrations[_0xa559('0x51')](_0x536019[_0xa559('0x4a')][_0xa559('0x52')],_0x536019['body'][_0xa559('0x2c')]);_0x536019[_0xa559('0x4a')]['Descriptions']=integrations[_0xa559('0x53')](_0x536019[_0xa559('0x4a')][_0xa559('0x52')],_0x536019[_0xa559('0x4a')][_0xa559('0x2c')]);return db['FreshdeskConfiguration'][_0xa559('0x49')](_0x536019[_0xa559('0x4a')],{'include':[{'model':db['FreshdeskField'],'as':_0xa559('0x50')},{'model':db['FreshdeskField'],'as':_0xa559('0x54')}]});}return null;})[_0xa559('0x23')](respondWithResult(_0x2f0ea1,null))[_0xa559('0x45')](handleError(_0x2f0ea1,null));};exports[_0xa559('0x55')]=function(_0xc26ee3,_0x9f5d26,_0x1e9300){var _0x52a304='';return db['FreshdeskAccount'][_0xa559('0x4d')]({'where':{'id':_0xc26ee3[_0xa559('0x47')]['id']},'attributes':['id',_0xa559('0x56'),'apiKey']})[_0xa559('0x23')](handleEntityNotFound(_0x9f5d26,null))[_0xa559('0x23')](function(_0x222dbb){if(_0x222dbb){_0x52a304=_0x222dbb[_0xa559('0x56')];var _0x428c9f=_0x52a304[_0xa559('0x57')](-0x1);if(_0x428c9f==='/'){_0x52a304=_0x52a304[_0xa559('0x58')](0x0,_0x52a304[_0xa559('0x59')](_0x428c9f));}return rp({'method':_0xa559('0x5a'),'uri':util[_0xa559('0x5b')](_0xa559('0x5c'),_0x52a304,_0xa559('0x5d')),'headers':{'Authorization':util[_0xa559('0x5b')](_0xa559('0x5e'),new Buffer(util['format']('%s:X',_0x222dbb['apiKey']))['toString'](_0xa559('0x5f')))},'json':!![]});}})[_0xa559('0x23')](function(_0x2d69ee){if(_0x2d69ee){var _0xbf574=[_0xa559('0x60'),'subject',_0xa559('0x61'),_0xa559('0x62'),_0xa559('0x19'),_0xa559('0x63'),'group',_0xa559('0x64'),_0xa559('0x65'),_0xa559('0x66'),'company'];_[_0xa559('0x67')](_0x2d69ee,function(_0x4a2d47){return _0xbf574[_0xa559('0x68')](_0x4a2d47['name'])||!_0x4a2d47[_0xa559('0x69')]&&_0x4a2d47[_0xa559('0x2c')]!==_0xa559('0x6a')&&_0x4a2d47[_0xa559('0x2c')]!==_0xa559('0x6b');});return{'count':_0x2d69ee[_0xa559('0x36')],'rows':_[_0xa559('0x2f')](_0x2d69ee,function(_0x17d876){return{'id':_0x17d876[_0xa559('0x26')],'name':_0x17d876[_0xa559('0x6c')],'custom':!_0x17d876[_0xa559('0x69')],'options':_0x17d876['choices']?_[_0xa559('0x2f')](_0x17d876[_0xa559('0x6d')],function(_0x132deb){return{'name':_[_0xa559('0x6e')](_0x132deb),'value':_0x132deb};}):[]};})};}})['then'](respondWithResult(_0x9f5d26,null))[_0xa559('0x45')](function(_0x14408d){var _0x405e9d=_0xc26ee3[_0xa559('0x31')][_0xa559('0x6f')]?0x1f4:_0x14408d[_0xa559('0x70')]||0x1f4;logger[_0xa559('0x24')](_0xa559('0x71'),_0xa559('0x55'),_0x405e9d,JSON[_0xa559('0x72')](_0x14408d));delete _0x14408d['name'];if(_0x405e9d===0x191){_0x405e9d=0x190;}_0x9f5d26[_0xa559('0x19')](_0x405e9d)[_0xa559('0x27')](_0xc26ee3['query']['test']?{'message':_0xa559('0x73'),'statusCode':_0x14408d[_0xa559('0x70')]}:_0x14408d);});}; \ No newline at end of file +var _0xb634=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','find','destroy','findOne','FreshdeskConfiguration','order','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','channel','FreshdeskField','Descriptions','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','remove','custom_text','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json'];(function(_0x1f8931,_0x23f7a7){var _0x591a06=function(_0x33f249){while(--_0x33f249){_0x1f8931['push'](_0x1f8931['shift']());}};_0x591a06(++_0x23f7a7);}(_0xb634,0x1c0));var _0x4b63=function(_0x232688,_0x46a248){_0x232688=_0x232688-0x0;var _0x17a1b2=_0xb634[_0x232688];return _0x17a1b2;};'use strict';var emlformat=require(_0x4b63('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b63('0x1'));var jsonpatch=require(_0x4b63('0x2'));var rp=require(_0x4b63('0x3'));var moment=require('moment');var BPromise=require(_0x4b63('0x4'));var Mustache=require(_0x4b63('0x5'));var util=require(_0x4b63('0x6'));var path=require(_0x4b63('0x7'));var sox=require(_0x4b63('0x8'));var csv=require(_0x4b63('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b63('0xa'));var squel=require('squel');var crypto=require(_0x4b63('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b63('0xc'));var toCsv=require(_0x4b63('0x9'));var querystring=require('querystring');var Papa=require(_0x4b63('0xd'));var Redis=require(_0x4b63('0xe'));var authService=require(_0x4b63('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4b63('0x10'));var hardwareService=require(_0x4b63('0x11'));var logger=require(_0x4b63('0x12'))(_0x4b63('0x13'));var utils=require(_0x4b63('0x14'));var config=require(_0x4b63('0x15'));var licenseUtil=require(_0x4b63('0x16'));var db=require(_0x4b63('0x17'))['db'];var integrations=require(_0x4b63('0x18'));function respondWithStatusCode(_0x2d4985,_0x121bfd){_0x121bfd=_0x121bfd||0xcc;return function(_0x1419f1){if(_0x1419f1){return _0x2d4985['sendStatus'](_0x121bfd);}return _0x2d4985[_0x4b63('0x19')](_0x121bfd)[_0x4b63('0x1a')]();};}function respondWithResult(_0x35a5fb,_0x1d0374){_0x1d0374=_0x1d0374||0xc8;return function(_0x2a1ac4){if(_0x2a1ac4){return _0x35a5fb[_0x4b63('0x19')](_0x1d0374)[_0x4b63('0x1b')](_0x2a1ac4);}};}function respondWithFilteredResult(_0x5c94c6,_0x975c4b){return function(_0x49709e){if(_0x49709e){var _0xc64de5=typeof _0x975c4b[_0x4b63('0x1c')]===_0x4b63('0x1d')&&typeof _0x975c4b[_0x4b63('0x1e')]===_0x4b63('0x1d');var _0x225a14=_0x49709e[_0x4b63('0x1f')];var _0x499224=_0xc64de5?0x0:_0x975c4b['offset'];var _0x710564=_0xc64de5?_0x49709e['count']:_0x975c4b[_0x4b63('0x1c')]+_0x975c4b[_0x4b63('0x1e')];var _0x432827;if(_0x710564>=_0x225a14){_0x710564=_0x225a14;_0x432827=0xc8;}else{_0x432827=0xce;}_0x5c94c6['status'](_0x432827);return _0x5c94c6[_0x4b63('0x20')](_0x4b63('0x21'),_0x499224+'-'+_0x710564+'/'+_0x225a14)['json'](_0x49709e);}return null;};}function patchUpdates(_0x59a3d2){return function(_0x1765b5){try{jsonpatch[_0x4b63('0x22')](_0x1765b5,_0x59a3d2,!![]);}catch(_0xc7c856){return BPromise[_0x4b63('0x23')](_0xc7c856);}return _0x1765b5[_0x4b63('0x24')]();};}function saveUpdates(_0x167337,_0x2350dc){return function(_0x22dd9a){if(_0x22dd9a){return _0x22dd9a[_0x4b63('0x25')](_0x167337)[_0x4b63('0x26')](function(_0xacb37a){return _0xacb37a;});}return null;};}function removeEntity(_0x269faf,_0x8940d6){return function(_0x3d7d75){if(_0x3d7d75){return _0x3d7d75['destroy']()[_0x4b63('0x26')](function(){_0x269faf[_0x4b63('0x19')](0xcc)[_0x4b63('0x1a')]();});}};}function handleEntityNotFound(_0x26b6f9,_0x11326d){return function(_0x50473a){if(!_0x50473a){_0x26b6f9[_0x4b63('0x27')](0x194);}return _0x50473a;};}function handleError(_0x495478,_0x417d92){_0x417d92=_0x417d92||0x1f4;return function(_0x2d8e52){logger['error'](_0x2d8e52['stack']);if(_0x2d8e52[_0x4b63('0x28')]){delete _0x2d8e52[_0x4b63('0x28')];}_0x495478[_0x4b63('0x19')](_0x417d92)[_0x4b63('0x29')](_0x2d8e52);};}exports[_0x4b63('0x2a')]=function(_0x208af0,_0x1e7ed0){var _0x5a9648={},_0x310ab0={},_0x56497c={'count':0x0,'rows':[]};var _0x5679d5=_['map'](db['FreshdeskAccount'][_0x4b63('0x2b')],function(_0x5741c4){return{'name':_0x5741c4[_0x4b63('0x2c')],'type':_0x5741c4[_0x4b63('0x2d')][_0x4b63('0x2e')]};});_0x310ab0[_0x4b63('0x2f')]=_[_0x4b63('0x30')](_0x5679d5,'name');_0x310ab0[_0x4b63('0x31')]=_['keys'](_0x208af0[_0x4b63('0x31')]);_0x310ab0[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0x310ab0[_0x4b63('0x2f')],_0x310ab0[_0x4b63('0x31')]);_0x5a9648[_0x4b63('0x34')]=_['intersection'](_0x310ab0[_0x4b63('0x2f')],qs['fields'](_0x208af0['query'][_0x4b63('0x35')]));_0x5a9648[_0x4b63('0x34')]=_0x5a9648[_0x4b63('0x34')]['length']?_0x5a9648[_0x4b63('0x34')]:_0x310ab0['model'];if(!_0x208af0[_0x4b63('0x31')][_0x4b63('0x36')]('nolimit')){_0x5a9648[_0x4b63('0x1e')]=qs['limit'](_0x208af0[_0x4b63('0x31')]['limit']);_0x5a9648[_0x4b63('0x1c')]=qs[_0x4b63('0x1c')](_0x208af0[_0x4b63('0x31')]['offset']);}_0x5a9648['order']=qs[_0x4b63('0x37')](_0x208af0['query']['sort']);_0x5a9648[_0x4b63('0x38')]=qs['filters'](_[_0x4b63('0x39')](_0x208af0[_0x4b63('0x31')],_0x310ab0[_0x4b63('0x32')]),_0x5679d5);if(_0x208af0[_0x4b63('0x31')][_0x4b63('0x3a')]){_0x5a9648['where']=_[_0x4b63('0x3b')](_0x5a9648['where'],{'$or':_[_0x4b63('0x30')](_0x5679d5,function(_0x232c12){if(_0x232c12[_0x4b63('0x2d')]!==_0x4b63('0x3c')){var _0x2888c0={};_0x2888c0[_0x232c12[_0x4b63('0x28')]]={'$like':'%'+_0x208af0[_0x4b63('0x31')][_0x4b63('0x3a')]+'%'};return _0x2888c0;}})});}_0x5a9648=_[_0x4b63('0x3b')]({},_0x5a9648,_0x208af0[_0x4b63('0x3d')]);var _0x1b2eb5={'where':_0x5a9648[_0x4b63('0x38')]};return db[_0x4b63('0x3e')][_0x4b63('0x1f')](_0x1b2eb5)[_0x4b63('0x26')](function(_0x58c94d){_0x56497c['count']=_0x58c94d;if(_0x208af0[_0x4b63('0x31')][_0x4b63('0x3f')]){_0x5a9648['include']=[{'all':!![]}];}return db[_0x4b63('0x3e')][_0x4b63('0x40')](_0x5a9648);})[_0x4b63('0x26')](function(_0xbc542e){_0x56497c[_0x4b63('0x41')]=_0xbc542e;return _0x56497c;})[_0x4b63('0x26')](respondWithFilteredResult(_0x1e7ed0,_0x5a9648))[_0x4b63('0x42')](handleError(_0x1e7ed0,null));};exports[_0x4b63('0x43')]=function(_0x26a22c,_0x5ebe9c){var _0x45cc94={'raw':![],'where':{'id':_0x26a22c[_0x4b63('0x44')]['id']}},_0x522b1c={};_0x522b1c['model']=_[_0x4b63('0x45')](db[_0x4b63('0x3e')][_0x4b63('0x2b')]);_0x522b1c[_0x4b63('0x31')]=_[_0x4b63('0x45')](_0x26a22c[_0x4b63('0x31')]);_0x522b1c[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0x522b1c['model'],_0x522b1c[_0x4b63('0x31')]);_0x45cc94[_0x4b63('0x34')]=_[_0x4b63('0x33')](_0x522b1c[_0x4b63('0x2f')],qs[_0x4b63('0x35')](_0x26a22c[_0x4b63('0x31')][_0x4b63('0x35')]));_0x45cc94[_0x4b63('0x34')]=_0x45cc94[_0x4b63('0x34')][_0x4b63('0x46')]?_0x45cc94[_0x4b63('0x34')]:_0x522b1c[_0x4b63('0x2f')];if(_0x26a22c[_0x4b63('0x31')]['includeAll']){_0x45cc94[_0x4b63('0x47')]=[{'all':!![]}];}_0x45cc94=_[_0x4b63('0x3b')]({},_0x45cc94,_0x26a22c['options']);return db[_0x4b63('0x3e')]['find'](_0x45cc94)[_0x4b63('0x26')](handleEntityNotFound(_0x5ebe9c,null))[_0x4b63('0x26')](respondWithResult(_0x5ebe9c,null))[_0x4b63('0x42')](handleError(_0x5ebe9c,null));};exports[_0x4b63('0x48')]=function(_0x403f46,_0x362138){return db[_0x4b63('0x3e')][_0x4b63('0x48')](_0x403f46[_0x4b63('0x49')],{})[_0x4b63('0x26')](respondWithResult(_0x362138,0xc9))[_0x4b63('0x42')](handleError(_0x362138,null));};exports[_0x4b63('0x25')]=function(_0x35f4cf,_0x503afe){if(_0x35f4cf['body']['id']){delete _0x35f4cf[_0x4b63('0x49')]['id'];}return db['FreshdeskAccount'][_0x4b63('0x4a')]({'where':{'id':_0x35f4cf[_0x4b63('0x44')]['id']}})[_0x4b63('0x26')](handleEntityNotFound(_0x503afe,null))[_0x4b63('0x26')](saveUpdates(_0x35f4cf['body'],null))[_0x4b63('0x26')](respondWithResult(_0x503afe,null))[_0x4b63('0x42')](handleError(_0x503afe,null));};exports[_0x4b63('0x4b')]=function(_0xf07322,_0x4bae0a){return db[_0x4b63('0x3e')][_0x4b63('0x4a')]({'where':{'id':_0xf07322[_0x4b63('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bae0a,null))[_0x4b63('0x26')](removeEntity(_0x4bae0a,null))[_0x4b63('0x42')](handleError(_0x4bae0a,null));};exports['getConfigurations']=function(_0x5dd48a,_0x227135,_0x376971){var _0x38a783={};var _0xcf3ed8={};var _0x31b050;var _0x4bd769;return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x5dd48a[_0x4b63('0x44')]['id']}})['then'](handleEntityNotFound(_0x227135,null))[_0x4b63('0x26')](function(_0x121a92){if(_0x121a92){_0x31b050=_0x121a92;_0xcf3ed8[_0x4b63('0x2f')]=_['keys'](db[_0x4b63('0x4d')]['rawAttributes']);_0xcf3ed8['query']=_[_0x4b63('0x45')](_0x5dd48a[_0x4b63('0x31')]);_0xcf3ed8[_0x4b63('0x32')]=_[_0x4b63('0x33')](_0xcf3ed8[_0x4b63('0x2f')],_0xcf3ed8[_0x4b63('0x31')]);_0x38a783[_0x4b63('0x34')]=_[_0x4b63('0x33')](_0xcf3ed8[_0x4b63('0x2f')],qs['fields'](_0x5dd48a['query']['fields']));_0x38a783[_0x4b63('0x34')]=_0x38a783[_0x4b63('0x34')]['length']?_0x38a783[_0x4b63('0x34')]:_0xcf3ed8[_0x4b63('0x2f')];_0x38a783[_0x4b63('0x4e')]=qs['sort'](_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x37')]);_0x38a783['where']=qs[_0x4b63('0x32')](_[_0x4b63('0x39')](_0x5dd48a['query'],_0xcf3ed8['filters']));if(_0x5dd48a[_0x4b63('0x31')]['filter']){_0x38a783[_0x4b63('0x38')]=_[_0x4b63('0x3b')](_0x38a783[_0x4b63('0x38')],{'$or':_[_0x4b63('0x30')](_0x38a783[_0x4b63('0x34')],function(_0x2d1bea){var _0x33eb0a={};_0x33eb0a[_0x2d1bea]={'$like':'%'+_0x5dd48a['query'][_0x4b63('0x3a')]+'%'};return _0x33eb0a;})});}_0x38a783=_['merge']({},_0x38a783,_0x5dd48a[_0x4b63('0x3d')]);return _0x31b050[_0x4b63('0x4f')](_0x38a783);}})[_0x4b63('0x26')](function(_0x24bd85){if(_0x24bd85){_0x4bd769=_0x24bd85['length'];if(!_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x36')](_0x4b63('0x50'))){_0x38a783['limit']=qs['limit'](_0x5dd48a[_0x4b63('0x31')][_0x4b63('0x1e')]);_0x38a783[_0x4b63('0x1c')]=qs[_0x4b63('0x1c')](_0x5dd48a['query'][_0x4b63('0x1c')]);}return _0x31b050[_0x4b63('0x4f')](_0x38a783);}})[_0x4b63('0x26')](function(_0x18cd77){if(_0x18cd77){return _0x18cd77?{'count':_0x4bd769,'rows':_0x18cd77}:null;}})[_0x4b63('0x26')](respondWithResult(_0x227135,null))[_0x4b63('0x42')](handleError(_0x227135,null));};exports[_0x4b63('0x51')]=function(_0x349b67,_0x5c9d69,_0xc0fae3){if(_0x349b67[_0x4b63('0x49')]['id']){delete _0x349b67[_0x4b63('0x49')]['id'];}return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x349b67['params']['id']}})[_0x4b63('0x26')](handleEntityNotFound(_0x5c9d69,null))[_0x4b63('0x26')](function(_0x2ad248){if(_0x2ad248){_0x349b67['body'][_0x4b63('0x52')]=_0x2ad248['id'];_0x349b67['body'][_0x4b63('0x53')]=integrations['getSubjects'](_0x349b67[_0x4b63('0x49')][_0x4b63('0x54')],_0x349b67[_0x4b63('0x49')]['type']);_0x349b67[_0x4b63('0x49')]['Descriptions']=integrations['getDescriptions'](_0x349b67[_0x4b63('0x49')][_0x4b63('0x54')],_0x349b67[_0x4b63('0x49')][_0x4b63('0x2d')]);return db['FreshdeskConfiguration'][_0x4b63('0x48')](_0x349b67[_0x4b63('0x49')],{'include':[{'model':db['FreshdeskField'],'as':_0x4b63('0x53')},{'model':db[_0x4b63('0x55')],'as':_0x4b63('0x56')}]});}return null;})[_0x4b63('0x26')](respondWithResult(_0x5c9d69,null))[_0x4b63('0x42')](handleError(_0x5c9d69,null));};exports['getFields']=function(_0x4b5ad3,_0x189b81,_0x592257){var _0x1fc747='';return db[_0x4b63('0x3e')][_0x4b63('0x4c')]({'where':{'id':_0x4b5ad3[_0x4b63('0x44')]['id']},'attributes':['id','remoteUri',_0x4b63('0x57')]})[_0x4b63('0x26')](handleEntityNotFound(_0x189b81,null))[_0x4b63('0x26')](function(_0x9fe3b){if(_0x9fe3b){_0x1fc747=_0x9fe3b['remoteUri'];var _0x4faafc=_0x1fc747[_0x4b63('0x58')](-0x1);if(_0x4faafc==='/'){_0x1fc747=_0x1fc747[_0x4b63('0x59')](0x0,_0x1fc747[_0x4b63('0x5a')](_0x4faafc));}return rp({'method':_0x4b63('0x5b'),'uri':util[_0x4b63('0x5c')](_0x4b63('0x5d'),_0x1fc747,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x4b63('0x5c')](_0x4b63('0x5e'),new Buffer(util[_0x4b63('0x5c')](_0x4b63('0x5f'),_0x9fe3b['apiKey']))[_0x4b63('0x60')](_0x4b63('0x61')))},'json':!![]});}})[_0x4b63('0x26')](function(_0x48bf70){if(_0x48bf70){var _0x166ec6=[_0x4b63('0x62'),_0x4b63('0x63'),_0x4b63('0x64'),_0x4b63('0x65'),'status',_0x4b63('0x66'),_0x4b63('0x67'),_0x4b63('0x68'),_0x4b63('0x69'),_0x4b63('0x67'),_0x4b63('0x6a')];_[_0x4b63('0x6b')](_0x48bf70,function(_0x52fcbd){return _0x166ec6['includes'](_0x52fcbd[_0x4b63('0x28')])||!_0x52fcbd['default']&&_0x52fcbd[_0x4b63('0x2d')]!==_0x4b63('0x6c')&&_0x52fcbd[_0x4b63('0x2d')]!==_0x4b63('0x6d');});return{'count':_0x48bf70[_0x4b63('0x46')],'rows':_[_0x4b63('0x30')](_0x48bf70,function(_0x800119){return{'id':_0x800119[_0x4b63('0x28')],'name':_0x800119[_0x4b63('0x6e')],'custom':!_0x800119[_0x4b63('0x6f')],'options':_0x800119[_0x4b63('0x70')]?_['map'](_0x800119['choices'],function(_0x484b11){return{'name':_[_0x4b63('0x71')](_0x484b11),'value':_0x484b11};}):[]};})};}})[_0x4b63('0x26')](respondWithResult(_0x189b81,null))['catch'](function(_0x2e23c3){var _0x642f79=_0x4b5ad3[_0x4b63('0x31')]['test']?0x1f4:_0x2e23c3[_0x4b63('0x72')]||0x1f4;logger['error'](_0x4b63('0x73'),_0x4b63('0x74'),_0x642f79,JSON['stringify'](_0x2e23c3));delete _0x2e23c3['name'];if(_0x642f79===0x191){_0x642f79=0x190;}_0x189b81[_0x4b63('0x19')](_0x642f79)[_0x4b63('0x29')](_0x4b5ad3[_0x4b63('0x31')][_0x4b63('0x75')]?{'message':_0x4b63('0x76'),'statusCode':_0x2e23c3[_0x4b63('0x72')]}:_0x2e23c3);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e72fce8..5b50bf5 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 _0x882d=['FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x295ded,_0x2f396c){var _0xce5a40=function(_0x1dc940){while(--_0x1dc940){_0x295ded['push'](_0x295ded['shift']());}};_0xce5a40(++_0x2f396c);}(_0x882d,0x1c9));var _0xd882=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0x882d[_0x1f99a0];return _0x1e0849;};'use strict';var _=require('lodash');var util=require(_0xd882('0x0'));var logger=require(_0xd882('0x1'))(_0xd882('0x2'));var moment=require(_0xd882('0x3'));var BPromise=require(_0xd882('0x4'));var rp=require(_0xd882('0x5'));var fs=require('fs');var path=require(_0xd882('0x6'));var rimraf=require(_0xd882('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd882('0x8'));module[_0xd882('0x9')]=function(_0x140fdd,_0x33b478){return _0x140fdd[_0xd882('0xa')](_0xd882('0xb'),attributes,{'tableName':_0xd882('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6fa=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','int_freshdesk_accounts'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xa6fa,0x99));var _0xaa6f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa6fa[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa6f('0x0'))(_0xaa6f('0x1'));var moment=require('moment');var BPromise=require(_0xaa6f('0x2'));var rp=require(_0xaa6f('0x3'));var fs=require('fs');var path=require(_0xaa6f('0x4'));var rimraf=require(_0xaa6f('0x5'));var config=require('../../config/environment');var attributes=require(_0xaa6f('0x6'));var integrations=require(_0xaa6f('0x7'));module['exports']=function(_0x5d607d,_0x2addb8){return _0x5d607d['define']('FreshdeskAccount',attributes,{'tableName':_0xaa6f('0x8'),'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 40c52ee..fb86d06 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 _0x691a=['client','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','map','model','then','stringify','ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4512bf,_0xbf58be){var _0x663272=function(_0x30defe){while(--_0x30defe){_0x4512bf['push'](_0x4512bf['shift']());}};_0x663272(++_0xbf58be);}(_0x691a,0x1df));var _0xa691=function(_0x1e2764,_0x14d808){_0x1e2764=_0x1e2764-0x0;var _0xb0085d=_0x691a[_0x1e2764];return _0xb0085d;};'use strict';var _=require(_0xa691('0x0'));var util=require(_0xa691('0x1'));var moment=require(_0xa691('0x2'));var BPromise=require(_0xa691('0x3'));var rs=require(_0xa691('0x4'));var fs=require('fs');var Redis=require(_0xa691('0x5'));var db=require(_0xa691('0x6'))['db'];var utils=require(_0xa691('0x7'));var logger=require(_0xa691('0x8'))(_0xa691('0x9'));var config=require('../../config/environment');var jayson=require(_0xa691('0xa'));var client=jayson[_0xa691('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x173d1d,_0x5c53a0,_0x450b9d){return new BPromise(function(_0x91da2f,_0x1ad63c){return client[_0xa691('0xc')](_0x173d1d,_0x450b9d)['then'](function(_0xd24630){logger[_0xa691('0xd')](_0xa691('0xe'),_0x5c53a0,'request\x20sent');logger[_0xa691('0xf')](_0xa691('0x10'),_0x5c53a0,_0xa691('0x11'),JSON['stringify'](_0xd24630));if(_0xd24630[_0xa691('0x12')]){if(_0xd24630['error'][_0xa691('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x5c53a0,_0xd24630['error'][_0xa691('0x14')]);return _0x1ad63c(_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);}logger[_0xa691('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5c53a0,_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);return _0x91da2f(_0xd24630[_0xa691('0x12')][_0xa691('0x14')]);}else{logger['info'](_0xa691('0xe'),_0x5c53a0,_0xa691('0x11'));_0x91da2f(_0xd24630['result'][_0xa691('0x14')]);}})[_0xa691('0x15')](function(_0x394841){logger[_0xa691('0x12')](_0xa691('0xe'),_0x5c53a0,_0x394841);_0x1ad63c(_0x394841);});});}exports[_0xa691('0x16')]=function(_0x3b3b2d){var _0x1def30=this;return new Promise(function(_0x25da7a,_0x42dd21){return db[_0xa691('0x17')]['findAll']({'raw':_0x3b3b2d['options']?_0x3b3b2d[_0xa691('0x18')][_0xa691('0x19')]===undefined?!![]:![]:!![],'where':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d[_0xa691('0x18')][_0xa691('0x1a')]||null:null,'attributes':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options'][_0xa691('0x1b')]||null:null,'limit':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options']['limit']||null:null,'include':_0x3b3b2d[_0xa691('0x18')]?_0x3b3b2d['options'][_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x3b3b2d[_0xa691('0x18')][_0xa691('0x1c')],function(_0x1633af){return{'model':db[_0x1633af[_0xa691('0x1e')]],'as':_0x1633af['as'],'attributes':_0x1633af[_0xa691('0x1b')],'include':_0x1633af[_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x1633af[_0xa691('0x1c')],function(_0x25b92c){return{'model':db[_0x25b92c[_0xa691('0x1e')]],'as':_0x25b92c['as'],'attributes':_0x25b92c[_0xa691('0x1b')],'include':_0x25b92c['include']?_[_0xa691('0x1d')](_0x25b92c[_0xa691('0x1c')],function(_0x40569f){return{'model':db[_0x40569f['model']],'as':_0x40569f['as'],'attributes':_0x40569f[_0xa691('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa691('0x1f')](function(_0x34b819){logger[_0xa691('0xd')]('GetFreshdeskAccount',_0x3b3b2d);logger[_0xa691('0xf')](_0xa691('0x16'),_0x3b3b2d,JSON[_0xa691('0x20')](_0x34b819));_0x25da7a(_0x34b819);})[_0xa691('0x15')](function(_0x441630){logger[_0xa691('0x12')](_0xa691('0x16'),_0x441630[_0xa691('0x14')],_0x3b3b2d);_0x42dd21(_0x1def30['error'](0x1f4,_0x441630[_0xa691('0x14')]));});});};exports[_0xa691('0x21')]=function(_0x244b21){var _0x235381=this;return new Promise(function(_0x21b2cb,_0x3a453a){return db[_0xa691('0x17')][_0xa691('0x22')]({'raw':_0x244b21['options']?_0x244b21[_0xa691('0x18')][_0xa691('0x19')]===undefined?!![]:![]:!![],'where':_0x244b21[_0xa691('0x18')]?_0x244b21[_0xa691('0x18')][_0xa691('0x1a')]||null:null,'attributes':_0x244b21[_0xa691('0x18')]?_0x244b21['options'][_0xa691('0x1b')]||null:null,'include':_0x244b21[_0xa691('0x18')]?_0x244b21[_0xa691('0x18')][_0xa691('0x1c')]?_[_0xa691('0x1d')](_0x244b21['options'][_0xa691('0x1c')],function(_0x130ad9){return{'model':db[_0x130ad9[_0xa691('0x1e')]],'as':_0x130ad9['as'],'attributes':_0x130ad9[_0xa691('0x1b')],'include':_0x130ad9['include']?_[_0xa691('0x1d')](_0x130ad9[_0xa691('0x1c')],function(_0x3d2b46){return{'model':db[_0x3d2b46[_0xa691('0x1e')]],'as':_0x3d2b46['as'],'attributes':_0x3d2b46[_0xa691('0x1b')],'include':_0x3d2b46['include']?_[_0xa691('0x1d')](_0x3d2b46[_0xa691('0x1c')],function(_0x3d4e2a){return{'model':db[_0x3d4e2a[_0xa691('0x1e')]],'as':_0x3d4e2a['as'],'attributes':_0x3d4e2a[_0xa691('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa691('0x1f')](function(_0x36c6c5){logger['info']('ShowFreshdeskAccount',_0x244b21);logger['debug'](_0xa691('0x21'),_0x244b21,JSON['stringify'](_0x36c6c5));_0x21b2cb(_0x36c6c5);})[_0xa691('0x15')](function(_0x213e8a){logger['error']('ShowFreshdeskAccount',_0x213e8a[_0xa691('0x14')],_0x244b21);_0x3a453a(_0x235381[_0xa691('0x12')](0x1f4,_0x213e8a[_0xa691('0x14')]));});});}; \ No newline at end of file +var _0x6334=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','result','catch','GetFreshdeskAccount','findAll','options','where','attributes','limit','map','include','model','message','ShowFreshdeskAccount','FreshdeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x351978,_0x163d4d){var _0x1c99ff=function(_0x16c502){while(--_0x16c502){_0x351978['push'](_0x351978['shift']());}};_0x1c99ff(++_0x163d4d);}(_0x6334,0x119));var _0x4633=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x6334[_0x118139];return _0x2fece9;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var moment=require(_0x4633('0x2'));var BPromise=require(_0x4633('0x3'));var rs=require(_0x4633('0x4'));var fs=require('fs');var Redis=require(_0x4633('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4633('0x6'));var logger=require(_0x4633('0x7'))(_0x4633('0x8'));var config=require(_0x4633('0x9'));var jayson=require(_0x4633('0xa'));var client=jayson[_0x4633('0xb')][_0x4633('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a8997,_0x5647f1,_0x56891d){return new BPromise(function(_0x21af74,_0x148e72){return client['request'](_0x4a8997,_0x56891d)[_0x4633('0xd')](function(_0x31e794){logger[_0x4633('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'));logger[_0x4633('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5647f1,_0x4633('0xf'),JSON[_0x4633('0x11')](_0x31e794));if(_0x31e794[_0x4633('0x12')]){if(_0x31e794[_0x4633('0x12')]['code']===0x1f4){logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794[_0x4633('0x12')]['message']);return _0x148e72(_0x31e794['error']['message']);}logger[_0x4633('0x12')](_0x4633('0x13'),_0x5647f1,_0x31e794['error']['message']);return _0x21af74(_0x31e794[_0x4633('0x12')]['message']);}else{logger[_0x4633('0xe')](_0x4633('0x13'),_0x5647f1,_0x4633('0xf'));_0x21af74(_0x31e794[_0x4633('0x14')]['message']);}})[_0x4633('0x15')](function(_0x15bd98){logger[_0x4633('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x5647f1,_0x15bd98);_0x148e72(_0x15bd98);});});}exports[_0x4633('0x16')]=function(_0x37e536){var _0x1c7186=this;return new Promise(function(_0x2ad562,_0xbab957){return db['FreshdeskAccount'][_0x4633('0x17')]({'raw':_0x37e536[_0x4633('0x18')]?_0x37e536['options']['raw']===undefined?!![]:![]:!![],'where':_0x37e536[_0x4633('0x18')]?_0x37e536['options'][_0x4633('0x19')]||null:null,'attributes':_0x37e536['options']?_0x37e536['options'][_0x4633('0x1a')]||null:null,'limit':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')][_0x4633('0x1b')]||null:null,'include':_0x37e536[_0x4633('0x18')]?_0x37e536[_0x4633('0x18')]['include']?_[_0x4633('0x1c')](_0x37e536['options'][_0x4633('0x1d')],function(_0xcfac3f){return{'model':db[_0xcfac3f[_0x4633('0x1e')]],'as':_0xcfac3f['as'],'attributes':_0xcfac3f[_0x4633('0x1a')],'include':_0xcfac3f[_0x4633('0x1d')]?_['map'](_0xcfac3f[_0x4633('0x1d')],function(_0x399220){return{'model':db[_0x399220[_0x4633('0x1e')]],'as':_0x399220['as'],'attributes':_0x399220[_0x4633('0x1a')],'include':_0x399220[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x399220[_0x4633('0x1d')],function(_0x368582){return{'model':db[_0x368582[_0x4633('0x1e')]],'as':_0x368582['as'],'attributes':_0x368582[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x2539a2){logger[_0x4633('0xe')](_0x4633('0x16'),_0x37e536);logger[_0x4633('0x10')](_0x4633('0x16'),_0x37e536,JSON[_0x4633('0x11')](_0x2539a2));_0x2ad562(_0x2539a2);})[_0x4633('0x15')](function(_0x5de12a){logger[_0x4633('0x12')](_0x4633('0x16'),_0x5de12a[_0x4633('0x1f')],_0x37e536);_0xbab957(_0x1c7186[_0x4633('0x12')](0x1f4,_0x5de12a[_0x4633('0x1f')]));});});};exports[_0x4633('0x20')]=function(_0x559fa5){var _0x23c33c=this;return new Promise(function(_0x52fc85,_0x1d3811){return db[_0x4633('0x21')][_0x4633('0x22')]({'raw':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x23')]===undefined?!![]:![]:!![],'where':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x19')]||null:null,'attributes':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')][_0x4633('0x1a')]||null:null,'include':_0x559fa5[_0x4633('0x18')]?_0x559fa5[_0x4633('0x18')]['include']?_['map'](_0x559fa5[_0x4633('0x18')][_0x4633('0x1d')],function(_0x5177f2){return{'model':db[_0x5177f2[_0x4633('0x1e')]],'as':_0x5177f2['as'],'attributes':_0x5177f2[_0x4633('0x1a')],'include':_0x5177f2[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x5177f2['include'],function(_0x3f92ef){return{'model':db[_0x3f92ef['model']],'as':_0x3f92ef['as'],'attributes':_0x3f92ef[_0x4633('0x1a')],'include':_0x3f92ef[_0x4633('0x1d')]?_[_0x4633('0x1c')](_0x3f92ef[_0x4633('0x1d')],function(_0x213768){return{'model':db[_0x213768[_0x4633('0x1e')]],'as':_0x213768['as'],'attributes':_0x213768[_0x4633('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4633('0xd')](function(_0x546390){logger[_0x4633('0xe')](_0x4633('0x20'),_0x559fa5);logger['debug'](_0x4633('0x20'),_0x559fa5,JSON[_0x4633('0x11')](_0x546390));_0x52fc85(_0x546390);})[_0x4633('0x15')](function(_0x468648){logger['error']('ShowFreshdeskAccount',_0x468648[_0x4633('0x1f')],_0x559fa5);_0x1d3811(_0x23c33c['error'](0x1f4,_0x468648['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 02cbb21..8926c3a 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 _0xd5d2=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags','getTags','create','setTags','put','update'];(function(_0x19a57d,_0x5b1be5){var _0x4c7636=function(_0x5485b5){while(--_0x5485b5){_0x19a57d['push'](_0x19a57d['shift']());}};_0x4c7636(++_0x5b1be5);}(_0xd5d2,0x110));var _0x2d5d=function(_0x2a6a46,_0x36aa81){_0x2a6a46=_0x2a6a46-0x0;var _0xaf0836=_0xd5d2[_0x2a6a46];return _0xaf0836;};'use strict';var multer=require(_0x2d5d('0x0'));var util=require(_0x2d5d('0x1'));var path=require(_0x2d5d('0x2'));var timeout=require(_0x2d5d('0x3'));var express=require(_0x2d5d('0x4'));var router=express[_0x2d5d('0x5')]();var fs_extra=require(_0x2d5d('0x6'));var auth=require(_0x2d5d('0x7'));var interaction=require(_0x2d5d('0x8'));var config=require(_0x2d5d('0x9'));var controller=require(_0x2d5d('0xa'));router[_0x2d5d('0xb')]('/',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0xd')]);router[_0x2d5d('0xb')](_0x2d5d('0xe'),auth['isAuthenticated'](),controller[_0x2d5d('0xf')]);router[_0x2d5d('0xb')](_0x2d5d('0x10'),auth[_0x2d5d('0xc')](),controller['getFields']);router[_0x2d5d('0xb')]('/:id/subjects',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x11')]);router[_0x2d5d('0xb')](_0x2d5d('0x12'),auth[_0x2d5d('0xc')](),controller['getDescriptions']);router[_0x2d5d('0xb')](_0x2d5d('0x13'),auth['isAuthenticated'](),controller[_0x2d5d('0x14')]);router['post']('/',auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x15')]);router['post'](_0x2d5d('0x13'),auth['isAuthenticated'](),controller[_0x2d5d('0x16')]);router[_0x2d5d('0x17')](_0x2d5d('0xe'),auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x18')]);router[_0x2d5d('0x19')](_0x2d5d('0xe'),auth[_0x2d5d('0xc')](),controller[_0x2d5d('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x3407=['Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0xff2493,_0x54022a){var _0xc31457=function(_0x302ce8){while(--_0x302ce8){_0xff2493['push'](_0xff2493['shift']());}};_0xc31457(++_0x54022a);}(_0x3407,0x17b));var _0x7340=function(_0x1bb25b,_0x4640a3){_0x1bb25b=_0x1bb25b-0x0;var _0x3e3fa8=_0x3407[_0x1bb25b];return _0x3e3fa8;};'use strict';var multer=require(_0x7340('0x0'));var util=require(_0x7340('0x1'));var path=require(_0x7340('0x2'));var timeout=require(_0x7340('0x3'));var express=require(_0x7340('0x4'));var router=express[_0x7340('0x5')]();var fs_extra=require(_0x7340('0x6'));var auth=require(_0x7340('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7340('0x8'));var controller=require(_0x7340('0x9'));router[_0x7340('0xa')]('/',auth['isAuthenticated'](),controller[_0x7340('0xb')]);router[_0x7340('0xa')](_0x7340('0xc'),auth[_0x7340('0xd')](),controller['show']);router[_0x7340('0xa')](_0x7340('0xe'),auth['isAuthenticated'](),controller[_0x7340('0xf')]);router[_0x7340('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0x7340('0xa')]('/:id/descriptions',auth[_0x7340('0xd')](),controller[_0x7340('0x10')]);router[_0x7340('0xa')]('/:id/tags',auth[_0x7340('0xd')](),controller[_0x7340('0x11')]);router['post']('/',auth[_0x7340('0xd')](),controller['create']);router[_0x7340('0x12')](_0x7340('0x13'),auth[_0x7340('0xd')](),controller[_0x7340('0x14')]);router['put']('/:id',auth[_0x7340('0xd')](),controller[_0x7340('0x15')]);router[_0x7340('0x16')](_0x7340('0xc'),auth[_0x7340('0xd')](),controller[_0x7340('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 268d9e0..ce7891a 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 _0x676b=['STRING','sequelize','exports'];(function(_0x3d9377,_0x4c602a){var _0x3e6b85=function(_0x4001d2){while(--_0x4001d2){_0x3d9377['push'](_0x3d9377['shift']());}};_0x3e6b85(++_0x4c602a);}(_0x676b,0x1d2));var _0xb676=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x676b[_0x178856];return _0x3c7fe7;};'use strict';var Sequelize=require(_0xb676('0x0'));module[_0xb676('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb676('0x2')]}}; \ No newline at end of file +var _0x989b=['exports','STRING'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x989b,0x80));var _0xb989=function(_0x2c8366,_0x5d55a6){_0x2c8366=_0x2c8366-0x0;var _0x5d0738=_0x989b[_0x2c8366];return _0x5d0738;};'use strict';var Sequelize=require('sequelize');module[_0xb989('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb989('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4eb2e87..3a398da 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 _0x1272=['show','params','find','catch','create','body','getFields','order','nolimit','getSubjects','findOne','FreshdeskField','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x1272,0x1be));var _0x2127=function(_0xce58df,_0x4b6850){_0xce58df=_0xce58df-0x0;var _0x57b86a=_0x1272[_0xce58df];return _0x57b86a;};'use strict';var emlformat=require(_0x2127('0x0'));var rimraf=require(_0x2127('0x1'));var zipdir=require(_0x2127('0x2'));var jsonpatch=require(_0x2127('0x3'));var rp=require(_0x2127('0x4'));var moment=require('moment');var BPromise=require(_0x2127('0x5'));var Mustache=require('mustache');var util=require(_0x2127('0x6'));var path=require(_0x2127('0x7'));var sox=require(_0x2127('0x8'));var csv=require(_0x2127('0x9'));var ejs=require(_0x2127('0xa'));var fs=require('fs');var fs_extra=require(_0x2127('0xb'));var _=require(_0x2127('0xc'));var squel=require(_0x2127('0xd'));var crypto=require(_0x2127('0xe'));var jsforce=require(_0x2127('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2127('0x9'));var querystring=require(_0x2127('0x10'));var Papa=require(_0x2127('0x11'));var Redis=require('ioredis');var authService=require(_0x2127('0x12'));var qs=require(_0x2127('0x13'));var as=require(_0x2127('0x14'));var hardwareService=require(_0x2127('0x15'));var logger=require(_0x2127('0x16'))(_0x2127('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2127('0x18'));var db=require(_0x2127('0x19'))['db'];function respondWithStatusCode(_0x5464c5,_0x22d700){_0x22d700=_0x22d700||0xcc;return function(_0x134fa3){if(_0x134fa3){return _0x5464c5[_0x2127('0x1a')](_0x22d700);}return _0x5464c5[_0x2127('0x1b')](_0x22d700)['end']();};}function respondWithResult(_0x3422f9,_0x4c716c){_0x4c716c=_0x4c716c||0xc8;return function(_0x458fbc){if(_0x458fbc){return _0x3422f9['status'](_0x4c716c)[_0x2127('0x1c')](_0x458fbc);}};}function respondWithFilteredResult(_0x369b10,_0x18461f){return function(_0x229708){if(_0x229708){var _0x859cfa=typeof _0x18461f['offset']==='undefined'&&typeof _0x18461f[_0x2127('0x1d')]==='undefined';var _0xdf4fb2=_0x229708['count'];var _0x49e2d0=_0x859cfa?0x0:_0x18461f['offset'];var _0x562930=_0x859cfa?_0x229708[_0x2127('0x1e')]:_0x18461f[_0x2127('0x1f')]+_0x18461f['limit'];var _0xf79b41;if(_0x562930>=_0xdf4fb2){_0x562930=_0xdf4fb2;_0xf79b41=0xc8;}else{_0xf79b41=0xce;}_0x369b10[_0x2127('0x1b')](_0xf79b41);return _0x369b10[_0x2127('0x20')](_0x2127('0x21'),_0x49e2d0+'-'+_0x562930+'/'+_0xdf4fb2)[_0x2127('0x1c')](_0x229708);}return null;};}function patchUpdates(_0x52592e){return function(_0x209570){try{jsonpatch[_0x2127('0x22')](_0x209570,_0x52592e,!![]);}catch(_0x2eda25){return BPromise['reject'](_0x2eda25);}return _0x209570[_0x2127('0x23')]();};}function saveUpdates(_0x3f3030,_0x2740ba){return function(_0x2d678c){if(_0x2d678c){return _0x2d678c[_0x2127('0x24')](_0x3f3030)[_0x2127('0x25')](function(_0x311712){return _0x311712;});}return null;};}function removeEntity(_0x36e75b,_0x15fe44){return function(_0x49d6c4){if(_0x49d6c4){return _0x49d6c4[_0x2127('0x26')]()[_0x2127('0x25')](function(){_0x36e75b[_0x2127('0x1b')](0xcc)[_0x2127('0x27')]();});}};}function handleEntityNotFound(_0x5028b4,_0x2fe353){return function(_0x39210c){if(!_0x39210c){_0x5028b4[_0x2127('0x1a')](0x194);}return _0x39210c;};}function handleError(_0x49a950,_0x2258fa){_0x2258fa=_0x2258fa||0x1f4;return function(_0x477b80){logger[_0x2127('0x28')](_0x477b80[_0x2127('0x29')]);if(_0x477b80[_0x2127('0x2a')]){delete _0x477b80[_0x2127('0x2a')];}_0x49a950[_0x2127('0x1b')](_0x2258fa)[_0x2127('0x2b')](_0x477b80);};}exports[_0x2127('0x2c')]=function(_0x3175a0,_0x13b5e6){var _0x1c656f={},_0x43f59d={},_0x1fa482={'count':0x0,'rows':[]};var _0x598d58=_['map'](db[_0x2127('0x2d')][_0x2127('0x2e')],function(_0x25846e){return{'name':_0x25846e[_0x2127('0x2f')],'type':_0x25846e[_0x2127('0x30')][_0x2127('0x31')]};});_0x43f59d['model']=_[_0x2127('0x32')](_0x598d58,_0x2127('0x2a'));_0x43f59d[_0x2127('0x33')]=_[_0x2127('0x34')](_0x3175a0[_0x2127('0x33')]);_0x43f59d[_0x2127('0x35')]=_[_0x2127('0x36')](_0x43f59d[_0x2127('0x37')],_0x43f59d['query']);_0x1c656f[_0x2127('0x38')]=_[_0x2127('0x36')](_0x43f59d['model'],qs['fields'](_0x3175a0['query'][_0x2127('0x39')]));_0x1c656f[_0x2127('0x38')]=_0x1c656f[_0x2127('0x38')][_0x2127('0x3a')]?_0x1c656f['attributes']:_0x43f59d[_0x2127('0x37')];if(!_0x3175a0['query'][_0x2127('0x3b')]('nolimit')){_0x1c656f[_0x2127('0x1d')]=qs[_0x2127('0x1d')](_0x3175a0['query'][_0x2127('0x1d')]);_0x1c656f[_0x2127('0x1f')]=qs['offset'](_0x3175a0[_0x2127('0x33')][_0x2127('0x1f')]);}_0x1c656f['order']=qs['sort'](_0x3175a0[_0x2127('0x33')][_0x2127('0x3c')]);_0x1c656f[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0x3175a0[_0x2127('0x33')],_0x43f59d[_0x2127('0x35')]),_0x598d58);if(_0x3175a0[_0x2127('0x33')][_0x2127('0x3f')]){_0x1c656f[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x1c656f[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0x598d58,function(_0x242d33){if(_0x242d33[_0x2127('0x30')]!==_0x2127('0x41')){var _0x3a59b9={};_0x3a59b9[_0x242d33[_0x2127('0x2a')]]={'$like':'%'+_0x3175a0[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x3a59b9;}})});}_0x1c656f=_[_0x2127('0x40')]({},_0x1c656f,_0x3175a0[_0x2127('0x42')]);var _0x1261d8={'where':_0x1c656f[_0x2127('0x3d')]};return db['FreshdeskConfiguration']['count'](_0x1261d8)[_0x2127('0x25')](function(_0x15f345){_0x1fa482['count']=_0x15f345;if(_0x3175a0[_0x2127('0x33')][_0x2127('0x43')]){_0x1c656f[_0x2127('0x44')]=[{'all':!![]}];}return db[_0x2127('0x2d')][_0x2127('0x45')](_0x1c656f);})[_0x2127('0x25')](function(_0x3a58e7){_0x1fa482['rows']=_0x3a58e7;return _0x1fa482;})['then'](respondWithFilteredResult(_0x13b5e6,_0x1c656f))['catch'](handleError(_0x13b5e6,null));};exports[_0x2127('0x46')]=function(_0x14683c,_0x3ec23e){var _0x15dc08={'raw':![],'where':{'id':_0x14683c[_0x2127('0x47')]['id']}},_0x47aca3={};_0x47aca3[_0x2127('0x37')]=_['keys'](db['FreshdeskConfiguration'][_0x2127('0x2e')]);_0x47aca3['query']=_[_0x2127('0x34')](_0x14683c['query']);_0x47aca3[_0x2127('0x35')]=_['intersection'](_0x47aca3['model'],_0x47aca3[_0x2127('0x33')]);_0x15dc08['attributes']=_[_0x2127('0x36')](_0x47aca3[_0x2127('0x37')],qs[_0x2127('0x39')](_0x14683c['query'][_0x2127('0x39')]));_0x15dc08[_0x2127('0x38')]=_0x15dc08[_0x2127('0x38')][_0x2127('0x3a')]?_0x15dc08[_0x2127('0x38')]:_0x47aca3[_0x2127('0x37')];if(_0x14683c[_0x2127('0x33')]['includeAll']){_0x15dc08[_0x2127('0x44')]=[{'all':!![]}];}_0x15dc08=_[_0x2127('0x40')]({},_0x15dc08,_0x14683c['options']);return db[_0x2127('0x2d')][_0x2127('0x48')](_0x15dc08)[_0x2127('0x25')](handleEntityNotFound(_0x3ec23e,null))[_0x2127('0x25')](respondWithResult(_0x3ec23e,null))[_0x2127('0x49')](handleError(_0x3ec23e,null));};exports['create']=function(_0x5152dc,_0x558d42){return db[_0x2127('0x2d')][_0x2127('0x4a')](_0x5152dc['body'],{})[_0x2127('0x25')](respondWithResult(_0x558d42,0xc9))[_0x2127('0x49')](handleError(_0x558d42,null));};exports[_0x2127('0x24')]=function(_0x596d37,_0x503ab3){if(_0x596d37[_0x2127('0x4b')]['id']){delete _0x596d37[_0x2127('0x4b')]['id'];}return db[_0x2127('0x2d')][_0x2127('0x48')]({'where':{'id':_0x596d37[_0x2127('0x47')]['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x503ab3,null))['then'](saveUpdates(_0x596d37[_0x2127('0x4b')],null))[_0x2127('0x25')](respondWithResult(_0x503ab3,null))['catch'](handleError(_0x503ab3,null));};exports['destroy']=function(_0x48603d,_0x466ce1){return db['FreshdeskConfiguration'][_0x2127('0x48')]({'where':{'id':_0x48603d[_0x2127('0x47')]['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x466ce1,null))[_0x2127('0x25')](removeEntity(_0x466ce1,null))[_0x2127('0x49')](handleError(_0x466ce1,null));};exports[_0x2127('0x4c')]=function(_0x8812b6,_0x22fde5,_0x234585){var _0x9a5ad9={};var _0x5031ab={};var _0x4851e3;var _0x24233a;return db[_0x2127('0x2d')]['findOne']({'where':{'id':_0x8812b6['params']['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x22fde5,null))[_0x2127('0x25')](function(_0x3c813d){if(_0x3c813d){_0x4851e3=_0x3c813d;_0x5031ab[_0x2127('0x37')]=_[_0x2127('0x34')](db['FreshdeskField'][_0x2127('0x2e')]);_0x5031ab[_0x2127('0x33')]=_[_0x2127('0x34')](_0x8812b6[_0x2127('0x33')]);_0x5031ab[_0x2127('0x35')]=_[_0x2127('0x36')](_0x5031ab[_0x2127('0x37')],_0x5031ab[_0x2127('0x33')]);_0x9a5ad9['attributes']=_[_0x2127('0x36')](_0x5031ab['model'],qs['fields'](_0x8812b6['query'][_0x2127('0x39')]));_0x9a5ad9['attributes']=_0x9a5ad9['attributes']['length']?_0x9a5ad9[_0x2127('0x38')]:_0x5031ab[_0x2127('0x37')];_0x9a5ad9[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0x8812b6[_0x2127('0x33')]['sort']);_0x9a5ad9[_0x2127('0x3d')]=qs['filters'](_[_0x2127('0x3e')](_0x8812b6['query'],_0x5031ab[_0x2127('0x35')]));if(_0x8812b6[_0x2127('0x33')][_0x2127('0x3f')]){_0x9a5ad9[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x9a5ad9['where'],{'$or':_['map'](_0x9a5ad9[_0x2127('0x38')],function(_0x126c72){var _0x1104e0={};_0x1104e0[_0x126c72]={'$like':'%'+_0x8812b6[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x1104e0;})});}_0x9a5ad9=_['merge']({},_0x9a5ad9,_0x8812b6['options']);return _0x4851e3[_0x2127('0x4c')](_0x9a5ad9);}})['then'](function(_0x17db81){if(_0x17db81){_0x24233a=_0x17db81[_0x2127('0x3a')];if(!_0x8812b6[_0x2127('0x33')][_0x2127('0x3b')](_0x2127('0x4e'))){_0x9a5ad9[_0x2127('0x1d')]=qs[_0x2127('0x1d')](_0x8812b6[_0x2127('0x33')][_0x2127('0x1d')]);_0x9a5ad9[_0x2127('0x1f')]=qs[_0x2127('0x1f')](_0x8812b6[_0x2127('0x33')][_0x2127('0x1f')]);}return _0x4851e3['getFields'](_0x9a5ad9);}})[_0x2127('0x25')](function(_0x45edf8){if(_0x45edf8){return _0x45edf8?{'count':_0x24233a,'rows':_0x45edf8}:null;}})[_0x2127('0x25')](respondWithResult(_0x22fde5,null))['catch'](handleError(_0x22fde5,null));};exports[_0x2127('0x4f')]=function(_0x20ade9,_0x2f6dd3,_0x1141e5){var _0x2db9ab={};var _0x1c9aa1={};var _0xf0438e;var _0x2dd46b;return db[_0x2127('0x2d')][_0x2127('0x50')]({'where':{'id':_0x20ade9[_0x2127('0x47')]['id']}})['then'](handleEntityNotFound(_0x2f6dd3,null))[_0x2127('0x25')](function(_0x1be4a2){if(_0x1be4a2){_0xf0438e=_0x1be4a2;_0x1c9aa1[_0x2127('0x37')]=_[_0x2127('0x34')](db[_0x2127('0x51')][_0x2127('0x2e')]);_0x1c9aa1['query']=_[_0x2127('0x34')](_0x20ade9[_0x2127('0x33')]);_0x1c9aa1[_0x2127('0x35')]=_[_0x2127('0x36')](_0x1c9aa1[_0x2127('0x37')],_0x1c9aa1[_0x2127('0x33')]);_0x2db9ab[_0x2127('0x38')]=_[_0x2127('0x36')](_0x1c9aa1[_0x2127('0x37')],qs['fields'](_0x20ade9['query'][_0x2127('0x39')]));_0x2db9ab[_0x2127('0x38')]=_0x2db9ab['attributes'][_0x2127('0x3a')]?_0x2db9ab[_0x2127('0x38')]:_0x1c9aa1['model'];_0x2db9ab[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0x20ade9[_0x2127('0x33')]['sort']);_0x2db9ab[_0x2127('0x3d')]=qs[_0x2127('0x35')](_['pick'](_0x20ade9[_0x2127('0x33')],_0x1c9aa1['filters']));if(_0x20ade9[_0x2127('0x33')]['filter']){_0x2db9ab[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x2db9ab[_0x2127('0x3d')],{'$or':_['map'](_0x2db9ab[_0x2127('0x38')],function(_0x10a2d6){var _0x202118={};_0x202118[_0x10a2d6]={'$like':'%'+_0x20ade9[_0x2127('0x33')]['filter']+'%'};return _0x202118;})});}_0x2db9ab=_[_0x2127('0x40')]({},_0x2db9ab,_0x20ade9['options']);return _0xf0438e[_0x2127('0x4f')](_0x2db9ab);}})[_0x2127('0x25')](function(_0x3ad477){if(_0x3ad477){_0x2dd46b=_0x3ad477[_0x2127('0x3a')];if(!_0x20ade9['query'][_0x2127('0x3b')](_0x2127('0x4e'))){_0x2db9ab[_0x2127('0x1d')]=qs['limit'](_0x20ade9[_0x2127('0x33')][_0x2127('0x1d')]);_0x2db9ab[_0x2127('0x1f')]=qs[_0x2127('0x1f')](_0x20ade9[_0x2127('0x33')][_0x2127('0x1f')]);}return _0xf0438e[_0x2127('0x4f')](_0x2db9ab);}})[_0x2127('0x25')](function(_0x30d9a5){if(_0x30d9a5){return _0x30d9a5?{'count':_0x2dd46b,'rows':_0x30d9a5}:null;}})[_0x2127('0x25')](respondWithResult(_0x2f6dd3,null))[_0x2127('0x49')](handleError(_0x2f6dd3,null));};exports['getDescriptions']=function(_0x1555dd,_0x4f20fc,_0x457dbb){var _0xb1242d={};var _0x3c8a40={};var _0x1e4464;var _0x2d12cd;return db[_0x2127('0x2d')]['findOne']({'where':{'id':_0x1555dd[_0x2127('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f20fc,null))[_0x2127('0x25')](function(_0x49e248){if(_0x49e248){_0x1e4464=_0x49e248;_0x3c8a40['model']=_[_0x2127('0x34')](db['FreshdeskField'][_0x2127('0x2e')]);_0x3c8a40[_0x2127('0x33')]=_['keys'](_0x1555dd[_0x2127('0x33')]);_0x3c8a40[_0x2127('0x35')]=_[_0x2127('0x36')](_0x3c8a40[_0x2127('0x37')],_0x3c8a40[_0x2127('0x33')]);_0xb1242d[_0x2127('0x38')]=_[_0x2127('0x36')](_0x3c8a40[_0x2127('0x37')],qs[_0x2127('0x39')](_0x1555dd[_0x2127('0x33')][_0x2127('0x39')]));_0xb1242d[_0x2127('0x38')]=_0xb1242d[_0x2127('0x38')][_0x2127('0x3a')]?_0xb1242d[_0x2127('0x38')]:_0x3c8a40[_0x2127('0x37')];_0xb1242d[_0x2127('0x4d')]=qs['sort'](_0x1555dd[_0x2127('0x33')]['sort']);_0xb1242d[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0x1555dd[_0x2127('0x33')],_0x3c8a40[_0x2127('0x35')]));if(_0x1555dd['query'][_0x2127('0x3f')]){_0xb1242d[_0x2127('0x3d')]=_[_0x2127('0x40')](_0xb1242d[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0xb1242d['attributes'],function(_0x5083ce){var _0x18640f={};_0x18640f[_0x5083ce]={'$like':'%'+_0x1555dd[_0x2127('0x33')][_0x2127('0x3f')]+'%'};return _0x18640f;})});}_0xb1242d=_['merge']({},_0xb1242d,_0x1555dd[_0x2127('0x42')]);return _0x1e4464[_0x2127('0x52')](_0xb1242d);}})['then'](function(_0x2e92f0){if(_0x2e92f0){_0x2d12cd=_0x2e92f0[_0x2127('0x3a')];if(!_0x1555dd[_0x2127('0x33')][_0x2127('0x3b')]('nolimit')){_0xb1242d['limit']=qs[_0x2127('0x1d')](_0x1555dd[_0x2127('0x33')][_0x2127('0x1d')]);_0xb1242d[_0x2127('0x1f')]=qs['offset'](_0x1555dd['query'][_0x2127('0x1f')]);}return _0x1e4464[_0x2127('0x52')](_0xb1242d);}})[_0x2127('0x25')](function(_0x2c13e1){if(_0x2c13e1){return _0x2c13e1?{'count':_0x2d12cd,'rows':_0x2c13e1}:null;}})[_0x2127('0x25')](respondWithResult(_0x4f20fc,null))[_0x2127('0x49')](handleError(_0x4f20fc,null));};exports['getTags']=function(_0xf0a77d,_0x58b82f,_0x34aa10){var _0x165d68={};var _0x1a4601={};var _0x2e7b18;var _0x449177;return db[_0x2127('0x2d')][_0x2127('0x50')]({'where':{'id':_0xf0a77d['params']['id']}})[_0x2127('0x25')](handleEntityNotFound(_0x58b82f,null))[_0x2127('0x25')](function(_0x79ea9e){if(_0x79ea9e){_0x2e7b18=_0x79ea9e;_0x1a4601['model']=_[_0x2127('0x34')](db[_0x2127('0x53')][_0x2127('0x2e')]);_0x1a4601[_0x2127('0x33')]=_[_0x2127('0x34')](_0xf0a77d['query']);_0x1a4601['filters']=_['intersection'](_0x1a4601[_0x2127('0x37')],_0x1a4601[_0x2127('0x33')]);_0x165d68[_0x2127('0x38')]=_[_0x2127('0x36')](_0x1a4601[_0x2127('0x37')],qs['fields'](_0xf0a77d['query']['fields']));_0x165d68[_0x2127('0x38')]=_0x165d68[_0x2127('0x38')][_0x2127('0x3a')]?_0x165d68[_0x2127('0x38')]:_0x1a4601[_0x2127('0x37')];_0x165d68[_0x2127('0x4d')]=qs[_0x2127('0x3c')](_0xf0a77d[_0x2127('0x33')]['sort']);_0x165d68[_0x2127('0x3d')]=qs[_0x2127('0x35')](_[_0x2127('0x3e')](_0xf0a77d['query'],_0x1a4601[_0x2127('0x35')]));if(_0xf0a77d[_0x2127('0x33')]['filter']){_0x165d68[_0x2127('0x3d')]=_[_0x2127('0x40')](_0x165d68[_0x2127('0x3d')],{'$or':_[_0x2127('0x32')](_0x165d68[_0x2127('0x38')],function(_0x1d6cd9){var _0x140c0a={};_0x140c0a[_0x1d6cd9]={'$like':'%'+_0xf0a77d[_0x2127('0x33')]['filter']+'%'};return _0x140c0a;})});}_0x165d68=_[_0x2127('0x40')]({},_0x165d68,_0xf0a77d[_0x2127('0x42')]);return _0x2e7b18[_0x2127('0x54')](_0x165d68);}})[_0x2127('0x25')](function(_0x2ea3b3){if(_0x2ea3b3){_0x449177=_0x2ea3b3[_0x2127('0x3a')];if(!_0xf0a77d[_0x2127('0x33')][_0x2127('0x3b')]('nolimit')){_0x165d68['limit']=qs['limit'](_0xf0a77d[_0x2127('0x33')][_0x2127('0x1d')]);_0x165d68[_0x2127('0x1f')]=qs['offset'](_0xf0a77d[_0x2127('0x33')][_0x2127('0x1f')]);}return _0x2e7b18[_0x2127('0x54')](_0x165d68);}})[_0x2127('0x25')](function(_0x553182){if(_0x553182){return _0x553182?{'count':_0x449177,'rows':_0x553182}:null;}})['then'](respondWithResult(_0x58b82f,null))['catch'](handleError(_0x58b82f,null));};exports['setTags']=function(_0x3de9dc,_0x2f1811,_0x15689c){if(_0x3de9dc[_0x2127('0x4b')]['id']){delete _0x3de9dc[_0x2127('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x2127('0x50')]({'where':{'id':_0x3de9dc['params']['id']}})['then'](handleEntityNotFound(_0x2f1811,null))[_0x2127('0x25')](function(_0x1c5e5e){if(_0x1c5e5e){return _0x1c5e5e[_0x2127('0x55')](_0x3de9dc['body']['ids']||[]);}return null;})[_0x2127('0x25')](respondWithResult(_0x2f1811,null))['catch'](handleError(_0x2f1811,null));}; \ No newline at end of file +var _0xd30d=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','status','end','undefined','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','keys','create','body','find','getFields','findOne','params','FreshdeskField','hasOwnProperty','getSubjects','nolimit','getDescriptions','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path'];(function(_0x51b812,_0x50a62f){var _0x1b5440=function(_0x4ba193){while(--_0x4ba193){_0x51b812['push'](_0x51b812['shift']());}};_0x1b5440(++_0x50a62f);}(_0xd30d,0x1e5));var _0xdd30=function(_0x2bdb5b,_0x2fa845){_0x2bdb5b=_0x2bdb5b-0x0;var _0x23f108=_0xd30d[_0x2bdb5b];return _0x23f108;};'use strict';var emlformat=require(_0xdd30('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd30('0x1'));var jsonpatch=require(_0xdd30('0x2'));var rp=require(_0xdd30('0x3'));var moment=require('moment');var BPromise=require(_0xdd30('0x4'));var Mustache=require(_0xdd30('0x5'));var util=require('util');var path=require(_0xdd30('0x6'));var sox=require(_0xdd30('0x7'));var csv=require(_0xdd30('0x8'));var ejs=require(_0xdd30('0x9'));var fs=require('fs');var fs_extra=require(_0xdd30('0xa'));var _=require(_0xdd30('0xb'));var squel=require('squel');var crypto=require(_0xdd30('0xc'));var jsforce=require(_0xdd30('0xd'));var deskjs=require(_0xdd30('0xe'));var toCsv=require(_0xdd30('0x8'));var querystring=require(_0xdd30('0xf'));var Papa=require(_0xdd30('0x10'));var Redis=require(_0xdd30('0x11'));var authService=require(_0xdd30('0x12'));var qs=require(_0xdd30('0x13'));var as=require(_0xdd30('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd30('0x15'))(_0xdd30('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdd30('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42ad86,_0xe97afa){_0xe97afa=_0xe97afa||0xcc;return function(_0x50a093){if(_0x50a093){return _0x42ad86['sendStatus'](_0xe97afa);}return _0x42ad86[_0xdd30('0x18')](_0xe97afa)[_0xdd30('0x19')]();};}function respondWithResult(_0x2ee7f7,_0x4f0133){_0x4f0133=_0x4f0133||0xc8;return function(_0x2bcdeb){if(_0x2bcdeb){return _0x2ee7f7[_0xdd30('0x18')](_0x4f0133)['json'](_0x2bcdeb);}};}function respondWithFilteredResult(_0x57a2d3,_0x280954){return function(_0x46ddf3){if(_0x46ddf3){var _0x4f74b6=typeof _0x280954['offset']==='undefined'&&typeof _0x280954['limit']===_0xdd30('0x1a');var _0x2af391=_0x46ddf3[_0xdd30('0x1b')];var _0x20d469=_0x4f74b6?0x0:_0x280954['offset'];var _0x19f4ff=_0x4f74b6?_0x46ddf3[_0xdd30('0x1b')]:_0x280954[_0xdd30('0x1c')]+_0x280954[_0xdd30('0x1d')];var _0x321f27;if(_0x19f4ff>=_0x2af391){_0x19f4ff=_0x2af391;_0x321f27=0xc8;}else{_0x321f27=0xce;}_0x57a2d3[_0xdd30('0x18')](_0x321f27);return _0x57a2d3[_0xdd30('0x1e')](_0xdd30('0x1f'),_0x20d469+'-'+_0x19f4ff+'/'+_0x2af391)[_0xdd30('0x20')](_0x46ddf3);}return null;};}function patchUpdates(_0x35177c){return function(_0x4363d8){try{jsonpatch[_0xdd30('0x21')](_0x4363d8,_0x35177c,!![]);}catch(_0x45947c){return BPromise['reject'](_0x45947c);}return _0x4363d8[_0xdd30('0x22')]();};}function saveUpdates(_0x5ecce2,_0x3c7d5d){return function(_0x30c298){if(_0x30c298){return _0x30c298[_0xdd30('0x23')](_0x5ecce2)[_0xdd30('0x24')](function(_0xdcd6d1){return _0xdcd6d1;});}return null;};}function removeEntity(_0x51dec0,_0x1c2afd){return function(_0x374551){if(_0x374551){return _0x374551[_0xdd30('0x25')]()['then'](function(){_0x51dec0[_0xdd30('0x18')](0xcc)[_0xdd30('0x19')]();});}};}function handleEntityNotFound(_0x5d44db,_0x575b47){return function(_0x23285e){if(!_0x23285e){_0x5d44db['sendStatus'](0x194);}return _0x23285e;};}function handleError(_0x23907c,_0x18d5c9){_0x18d5c9=_0x18d5c9||0x1f4;return function(_0xfcbc2c){logger[_0xdd30('0x26')](_0xfcbc2c[_0xdd30('0x27')]);if(_0xfcbc2c[_0xdd30('0x28')]){delete _0xfcbc2c[_0xdd30('0x28')];}_0x23907c[_0xdd30('0x18')](_0x18d5c9)[_0xdd30('0x29')](_0xfcbc2c);};}exports[_0xdd30('0x2a')]=function(_0x4080f5,_0x5368e2){var _0x24def7={},_0x107e4a={},_0x16c99a={'count':0x0,'rows':[]};var _0x2492cf=_[_0xdd30('0x2b')](db[_0xdd30('0x2c')][_0xdd30('0x2d')],function(_0x339413){return{'name':_0x339413[_0xdd30('0x2e')],'type':_0x339413[_0xdd30('0x2f')]['key']};});_0x107e4a[_0xdd30('0x30')]=_[_0xdd30('0x2b')](_0x2492cf,_0xdd30('0x28'));_0x107e4a[_0xdd30('0x31')]=_['keys'](_0x4080f5[_0xdd30('0x31')]);_0x107e4a[_0xdd30('0x32')]=_[_0xdd30('0x33')](_0x107e4a[_0xdd30('0x30')],_0x107e4a['query']);_0x24def7[_0xdd30('0x34')]=_[_0xdd30('0x33')](_0x107e4a['model'],qs['fields'](_0x4080f5[_0xdd30('0x31')][_0xdd30('0x35')]));_0x24def7[_0xdd30('0x34')]=_0x24def7[_0xdd30('0x34')][_0xdd30('0x36')]?_0x24def7[_0xdd30('0x34')]:_0x107e4a['model'];if(!_0x4080f5[_0xdd30('0x31')]['hasOwnProperty']('nolimit')){_0x24def7[_0xdd30('0x1d')]=qs['limit'](_0x4080f5[_0xdd30('0x31')][_0xdd30('0x1d')]);_0x24def7[_0xdd30('0x1c')]=qs[_0xdd30('0x1c')](_0x4080f5[_0xdd30('0x31')]['offset']);}_0x24def7[_0xdd30('0x37')]=qs[_0xdd30('0x38')](_0x4080f5[_0xdd30('0x31')][_0xdd30('0x38')]);_0x24def7[_0xdd30('0x39')]=qs[_0xdd30('0x32')](_[_0xdd30('0x3a')](_0x4080f5['query'],_0x107e4a['filters']),_0x2492cf);if(_0x4080f5[_0xdd30('0x31')]['filter']){_0x24def7[_0xdd30('0x39')]=_[_0xdd30('0x3b')](_0x24def7[_0xdd30('0x39')],{'$or':_[_0xdd30('0x2b')](_0x2492cf,function(_0x433bd5){if(_0x433bd5[_0xdd30('0x2f')]!==_0xdd30('0x3c')){var _0x5827a8={};_0x5827a8[_0x433bd5['name']]={'$like':'%'+_0x4080f5['query'][_0xdd30('0x3d')]+'%'};return _0x5827a8;}})});}_0x24def7=_[_0xdd30('0x3b')]({},_0x24def7,_0x4080f5[_0xdd30('0x3e')]);var _0x50faa2={'where':_0x24def7[_0xdd30('0x39')]};return db[_0xdd30('0x2c')][_0xdd30('0x1b')](_0x50faa2)[_0xdd30('0x24')](function(_0xd7dff0){_0x16c99a[_0xdd30('0x1b')]=_0xd7dff0;if(_0x4080f5[_0xdd30('0x31')][_0xdd30('0x3f')]){_0x24def7[_0xdd30('0x40')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x24def7);})['then'](function(_0x3804ae){_0x16c99a['rows']=_0x3804ae;return _0x16c99a;})[_0xdd30('0x24')](respondWithFilteredResult(_0x5368e2,_0x24def7))[_0xdd30('0x41')](handleError(_0x5368e2,null));};exports[_0xdd30('0x42')]=function(_0x4739cf,_0x4a6636){var _0x5285eb={'raw':![],'where':{'id':_0x4739cf['params']['id']}},_0xaaf5de={};_0xaaf5de[_0xdd30('0x30')]=_[_0xdd30('0x43')](db[_0xdd30('0x2c')]['rawAttributes']);_0xaaf5de[_0xdd30('0x31')]=_[_0xdd30('0x43')](_0x4739cf['query']);_0xaaf5de[_0xdd30('0x32')]=_['intersection'](_0xaaf5de['model'],_0xaaf5de[_0xdd30('0x31')]);_0x5285eb[_0xdd30('0x34')]=_[_0xdd30('0x33')](_0xaaf5de[_0xdd30('0x30')],qs[_0xdd30('0x35')](_0x4739cf['query'][_0xdd30('0x35')]));_0x5285eb['attributes']=_0x5285eb[_0xdd30('0x34')][_0xdd30('0x36')]?_0x5285eb[_0xdd30('0x34')]:_0xaaf5de[_0xdd30('0x30')];if(_0x4739cf['query'][_0xdd30('0x3f')]){_0x5285eb[_0xdd30('0x40')]=[{'all':!![]}];}_0x5285eb=_[_0xdd30('0x3b')]({},_0x5285eb,_0x4739cf[_0xdd30('0x3e')]);return db[_0xdd30('0x2c')]['find'](_0x5285eb)['then'](handleEntityNotFound(_0x4a6636,null))[_0xdd30('0x24')](respondWithResult(_0x4a6636,null))['catch'](handleError(_0x4a6636,null));};exports[_0xdd30('0x44')]=function(_0x2ddd5c,_0x54a1d7){return db[_0xdd30('0x2c')][_0xdd30('0x44')](_0x2ddd5c[_0xdd30('0x45')],{})['then'](respondWithResult(_0x54a1d7,0xc9))[_0xdd30('0x41')](handleError(_0x54a1d7,null));};exports['update']=function(_0x3a67be,_0x509ae1){if(_0x3a67be[_0xdd30('0x45')]['id']){delete _0x3a67be[_0xdd30('0x45')]['id'];}return db['FreshdeskConfiguration'][_0xdd30('0x46')]({'where':{'id':_0x3a67be['params']['id']}})[_0xdd30('0x24')](handleEntityNotFound(_0x509ae1,null))['then'](saveUpdates(_0x3a67be[_0xdd30('0x45')],null))[_0xdd30('0x24')](respondWithResult(_0x509ae1,null))['catch'](handleError(_0x509ae1,null));};exports[_0xdd30('0x25')]=function(_0x3bca1f,_0x58d04d){return db[_0xdd30('0x2c')]['find']({'where':{'id':_0x3bca1f['params']['id']}})['then'](handleEntityNotFound(_0x58d04d,null))[_0xdd30('0x24')](removeEntity(_0x58d04d,null))['catch'](handleError(_0x58d04d,null));};exports[_0xdd30('0x47')]=function(_0x3ee3bd,_0x208169,_0x41eb14){var _0x3d5be9={};var _0xaab0a0={};var _0x377430;var _0x5c6129;return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x3ee3bd[_0xdd30('0x49')]['id']}})['then'](handleEntityNotFound(_0x208169,null))[_0xdd30('0x24')](function(_0x47deca){if(_0x47deca){_0x377430=_0x47deca;_0xaab0a0['model']=_[_0xdd30('0x43')](db[_0xdd30('0x4a')][_0xdd30('0x2d')]);_0xaab0a0[_0xdd30('0x31')]=_[_0xdd30('0x43')](_0x3ee3bd[_0xdd30('0x31')]);_0xaab0a0[_0xdd30('0x32')]=_['intersection'](_0xaab0a0[_0xdd30('0x30')],_0xaab0a0['query']);_0x3d5be9['attributes']=_['intersection'](_0xaab0a0['model'],qs[_0xdd30('0x35')](_0x3ee3bd[_0xdd30('0x31')][_0xdd30('0x35')]));_0x3d5be9[_0xdd30('0x34')]=_0x3d5be9[_0xdd30('0x34')][_0xdd30('0x36')]?_0x3d5be9['attributes']:_0xaab0a0['model'];_0x3d5be9['order']=qs[_0xdd30('0x38')](_0x3ee3bd['query'][_0xdd30('0x38')]);_0x3d5be9[_0xdd30('0x39')]=qs['filters'](_[_0xdd30('0x3a')](_0x3ee3bd['query'],_0xaab0a0[_0xdd30('0x32')]));if(_0x3ee3bd[_0xdd30('0x31')][_0xdd30('0x3d')]){_0x3d5be9[_0xdd30('0x39')]=_['merge'](_0x3d5be9['where'],{'$or':_[_0xdd30('0x2b')](_0x3d5be9[_0xdd30('0x34')],function(_0x1e6e4c){var _0x277886={};_0x277886[_0x1e6e4c]={'$like':'%'+_0x3ee3bd[_0xdd30('0x31')]['filter']+'%'};return _0x277886;})});}_0x3d5be9=_['merge']({},_0x3d5be9,_0x3ee3bd[_0xdd30('0x3e')]);return _0x377430[_0xdd30('0x47')](_0x3d5be9);}})[_0xdd30('0x24')](function(_0x2d163f){if(_0x2d163f){_0x5c6129=_0x2d163f[_0xdd30('0x36')];if(!_0x3ee3bd[_0xdd30('0x31')][_0xdd30('0x4b')]('nolimit')){_0x3d5be9['limit']=qs['limit'](_0x3ee3bd[_0xdd30('0x31')]['limit']);_0x3d5be9[_0xdd30('0x1c')]=qs[_0xdd30('0x1c')](_0x3ee3bd[_0xdd30('0x31')][_0xdd30('0x1c')]);}return _0x377430[_0xdd30('0x47')](_0x3d5be9);}})[_0xdd30('0x24')](function(_0x1b6df8){if(_0x1b6df8){return _0x1b6df8?{'count':_0x5c6129,'rows':_0x1b6df8}:null;}})[_0xdd30('0x24')](respondWithResult(_0x208169,null))[_0xdd30('0x41')](handleError(_0x208169,null));};exports[_0xdd30('0x4c')]=function(_0x397325,_0x1a6459,_0x225bad){var _0x191242={};var _0x255012={};var _0x2c1a70;var _0xdd5927;return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x397325['params']['id']}})['then'](handleEntityNotFound(_0x1a6459,null))[_0xdd30('0x24')](function(_0x4fbd37){if(_0x4fbd37){_0x2c1a70=_0x4fbd37;_0x255012[_0xdd30('0x30')]=_['keys'](db[_0xdd30('0x4a')]['rawAttributes']);_0x255012[_0xdd30('0x31')]=_[_0xdd30('0x43')](_0x397325[_0xdd30('0x31')]);_0x255012[_0xdd30('0x32')]=_['intersection'](_0x255012['model'],_0x255012['query']);_0x191242['attributes']=_['intersection'](_0x255012[_0xdd30('0x30')],qs[_0xdd30('0x35')](_0x397325['query'][_0xdd30('0x35')]));_0x191242[_0xdd30('0x34')]=_0x191242[_0xdd30('0x34')][_0xdd30('0x36')]?_0x191242[_0xdd30('0x34')]:_0x255012[_0xdd30('0x30')];_0x191242['order']=qs[_0xdd30('0x38')](_0x397325[_0xdd30('0x31')]['sort']);_0x191242['where']=qs[_0xdd30('0x32')](_[_0xdd30('0x3a')](_0x397325[_0xdd30('0x31')],_0x255012[_0xdd30('0x32')]));if(_0x397325[_0xdd30('0x31')][_0xdd30('0x3d')]){_0x191242[_0xdd30('0x39')]=_[_0xdd30('0x3b')](_0x191242['where'],{'$or':_['map'](_0x191242[_0xdd30('0x34')],function(_0x41537c){var _0x20f41={};_0x20f41[_0x41537c]={'$like':'%'+_0x397325[_0xdd30('0x31')][_0xdd30('0x3d')]+'%'};return _0x20f41;})});}_0x191242=_[_0xdd30('0x3b')]({},_0x191242,_0x397325[_0xdd30('0x3e')]);return _0x2c1a70[_0xdd30('0x4c')](_0x191242);}})[_0xdd30('0x24')](function(_0xa429ec){if(_0xa429ec){_0xdd5927=_0xa429ec[_0xdd30('0x36')];if(!_0x397325['query'][_0xdd30('0x4b')](_0xdd30('0x4d'))){_0x191242[_0xdd30('0x1d')]=qs[_0xdd30('0x1d')](_0x397325[_0xdd30('0x31')][_0xdd30('0x1d')]);_0x191242[_0xdd30('0x1c')]=qs[_0xdd30('0x1c')](_0x397325['query']['offset']);}return _0x2c1a70[_0xdd30('0x4c')](_0x191242);}})[_0xdd30('0x24')](function(_0x2e54d5){if(_0x2e54d5){return _0x2e54d5?{'count':_0xdd5927,'rows':_0x2e54d5}:null;}})[_0xdd30('0x24')](respondWithResult(_0x1a6459,null))[_0xdd30('0x41')](handleError(_0x1a6459,null));};exports['getDescriptions']=function(_0x2b05c9,_0x41eed6,_0x14f502){var _0x2dd9ce={};var _0x5a196a={};var _0xe28ef4;var _0x398ffc;return db[_0xdd30('0x2c')]['findOne']({'where':{'id':_0x2b05c9[_0xdd30('0x49')]['id']}})['then'](handleEntityNotFound(_0x41eed6,null))[_0xdd30('0x24')](function(_0x37953e){if(_0x37953e){_0xe28ef4=_0x37953e;_0x5a196a['model']=_[_0xdd30('0x43')](db[_0xdd30('0x4a')]['rawAttributes']);_0x5a196a['query']=_[_0xdd30('0x43')](_0x2b05c9[_0xdd30('0x31')]);_0x5a196a['filters']=_['intersection'](_0x5a196a[_0xdd30('0x30')],_0x5a196a[_0xdd30('0x31')]);_0x2dd9ce[_0xdd30('0x34')]=_[_0xdd30('0x33')](_0x5a196a['model'],qs['fields'](_0x2b05c9[_0xdd30('0x31')][_0xdd30('0x35')]));_0x2dd9ce[_0xdd30('0x34')]=_0x2dd9ce[_0xdd30('0x34')][_0xdd30('0x36')]?_0x2dd9ce['attributes']:_0x5a196a[_0xdd30('0x30')];_0x2dd9ce[_0xdd30('0x37')]=qs[_0xdd30('0x38')](_0x2b05c9[_0xdd30('0x31')][_0xdd30('0x38')]);_0x2dd9ce['where']=qs[_0xdd30('0x32')](_[_0xdd30('0x3a')](_0x2b05c9['query'],_0x5a196a[_0xdd30('0x32')]));if(_0x2b05c9[_0xdd30('0x31')][_0xdd30('0x3d')]){_0x2dd9ce[_0xdd30('0x39')]=_[_0xdd30('0x3b')](_0x2dd9ce[_0xdd30('0x39')],{'$or':_[_0xdd30('0x2b')](_0x2dd9ce[_0xdd30('0x34')],function(_0x4ad1d4){var _0x24b35d={};_0x24b35d[_0x4ad1d4]={'$like':'%'+_0x2b05c9['query']['filter']+'%'};return _0x24b35d;})});}_0x2dd9ce=_[_0xdd30('0x3b')]({},_0x2dd9ce,_0x2b05c9['options']);return _0xe28ef4[_0xdd30('0x4e')](_0x2dd9ce);}})[_0xdd30('0x24')](function(_0x5c44c0){if(_0x5c44c0){_0x398ffc=_0x5c44c0[_0xdd30('0x36')];if(!_0x2b05c9[_0xdd30('0x31')]['hasOwnProperty'](_0xdd30('0x4d'))){_0x2dd9ce[_0xdd30('0x1d')]=qs['limit'](_0x2b05c9['query'][_0xdd30('0x1d')]);_0x2dd9ce[_0xdd30('0x1c')]=qs['offset'](_0x2b05c9[_0xdd30('0x31')][_0xdd30('0x1c')]);}return _0xe28ef4[_0xdd30('0x4e')](_0x2dd9ce);}})[_0xdd30('0x24')](function(_0x1ad36f){if(_0x1ad36f){return _0x1ad36f?{'count':_0x398ffc,'rows':_0x1ad36f}:null;}})[_0xdd30('0x24')](respondWithResult(_0x41eed6,null))[_0xdd30('0x41')](handleError(_0x41eed6,null));};exports[_0xdd30('0x4f')]=function(_0x48578f,_0x3b1f1f,_0x2b4405){var _0x2c6ec4={};var _0x417a7d={};var _0x4dbf9;var _0x540074;return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x48578f['params']['id']}})[_0xdd30('0x24')](handleEntityNotFound(_0x3b1f1f,null))['then'](function(_0x5c79a4){if(_0x5c79a4){_0x4dbf9=_0x5c79a4;_0x417a7d[_0xdd30('0x30')]=_[_0xdd30('0x43')](db['Tag']['rawAttributes']);_0x417a7d[_0xdd30('0x31')]=_['keys'](_0x48578f[_0xdd30('0x31')]);_0x417a7d[_0xdd30('0x32')]=_[_0xdd30('0x33')](_0x417a7d[_0xdd30('0x30')],_0x417a7d['query']);_0x2c6ec4[_0xdd30('0x34')]=_['intersection'](_0x417a7d[_0xdd30('0x30')],qs[_0xdd30('0x35')](_0x48578f['query'][_0xdd30('0x35')]));_0x2c6ec4[_0xdd30('0x34')]=_0x2c6ec4[_0xdd30('0x34')][_0xdd30('0x36')]?_0x2c6ec4[_0xdd30('0x34')]:_0x417a7d['model'];_0x2c6ec4['order']=qs[_0xdd30('0x38')](_0x48578f['query'][_0xdd30('0x38')]);_0x2c6ec4['where']=qs[_0xdd30('0x32')](_['pick'](_0x48578f[_0xdd30('0x31')],_0x417a7d[_0xdd30('0x32')]));if(_0x48578f['query'][_0xdd30('0x3d')]){_0x2c6ec4[_0xdd30('0x39')]=_[_0xdd30('0x3b')](_0x2c6ec4[_0xdd30('0x39')],{'$or':_[_0xdd30('0x2b')](_0x2c6ec4[_0xdd30('0x34')],function(_0x5a5af9){var _0x135c78={};_0x135c78[_0x5a5af9]={'$like':'%'+_0x48578f[_0xdd30('0x31')][_0xdd30('0x3d')]+'%'};return _0x135c78;})});}_0x2c6ec4=_['merge']({},_0x2c6ec4,_0x48578f[_0xdd30('0x3e')]);return _0x4dbf9[_0xdd30('0x4f')](_0x2c6ec4);}})[_0xdd30('0x24')](function(_0x399245){if(_0x399245){_0x540074=_0x399245[_0xdd30('0x36')];if(!_0x48578f[_0xdd30('0x31')][_0xdd30('0x4b')](_0xdd30('0x4d'))){_0x2c6ec4['limit']=qs[_0xdd30('0x1d')](_0x48578f['query'][_0xdd30('0x1d')]);_0x2c6ec4[_0xdd30('0x1c')]=qs[_0xdd30('0x1c')](_0x48578f['query'][_0xdd30('0x1c')]);}return _0x4dbf9[_0xdd30('0x4f')](_0x2c6ec4);}})['then'](function(_0x30e195){if(_0x30e195){return _0x30e195?{'count':_0x540074,'rows':_0x30e195}:null;}})[_0xdd30('0x24')](respondWithResult(_0x3b1f1f,null))[_0xdd30('0x41')](handleError(_0x3b1f1f,null));};exports[_0xdd30('0x50')]=function(_0x26118d,_0x1329e3,_0x5409fd){if(_0x26118d[_0xdd30('0x45')]['id']){delete _0x26118d[_0xdd30('0x45')]['id'];}return db[_0xdd30('0x2c')][_0xdd30('0x48')]({'where':{'id':_0x26118d['params']['id']}})['then'](handleEntityNotFound(_0x1329e3,null))[_0xdd30('0x24')](function(_0x493b55){if(_0x493b55){return _0x493b55[_0xdd30('0x50')](_0x26118d[_0xdd30('0x45')][_0xdd30('0x51')]||[]);}return null;})[_0xdd30('0x24')](respondWithResult(_0x1329e3,null))[_0xdd30('0x41')](handleError(_0x1329e3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 5a41421..d820be0 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 _0x801a=['api','moment','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger'];(function(_0x3c2834,_0x31a38f){var _0x4aec4f=function(_0x5db3d5){while(--_0x5db3d5){_0x3c2834['push'](_0x3c2834['shift']());}};_0x4aec4f(++_0x31a38f);}(_0x801a,0x1b7));var _0xa801=function(_0x50304f,_0x50cf75){_0x50304f=_0x50304f-0x0;var _0x1f73e4=_0x801a[_0x50304f];return _0x1f73e4;};'use strict';var _=require(_0xa801('0x0'));var util=require(_0xa801('0x1'));var logger=require(_0xa801('0x2'))(_0xa801('0x3'));var moment=require(_0xa801('0x4'));var BPromise=require(_0xa801('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa801('0x6'));var config=require(_0xa801('0x7'));var attributes=require(_0xa801('0x8'));module[_0xa801('0x9')]=function(_0x41c96d,_0x1512a8){return _0x41c96d[_0xa801('0xa')](_0xa801('0xb'),attributes,{'tableName':_0xa801('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dbe=['exports','int_freshdesk_configurations','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x227f5c,_0x36ff87){var _0x1327d2=function(_0x164b0c){while(--_0x164b0c){_0x227f5c['push'](_0x227f5c['shift']());}};_0x1327d2(++_0x36ff87);}(_0x9dbe,0x185));var _0xe9db=function(_0x22e94e,_0x4f748e){_0x22e94e=_0x22e94e-0x0;var _0x5deac7=_0x9dbe[_0x22e94e];return _0x5deac7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe9db('0x0'))(_0xe9db('0x1'));var moment=require(_0xe9db('0x2'));var BPromise=require('bluebird');var rp=require(_0xe9db('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9db('0x4'));var config=require(_0xe9db('0x5'));var attributes=require(_0xe9db('0x6'));module[_0xe9db('0x7')]=function(_0x20de4d,_0x4b55c3){return _0x20de4d['define']('FreshdeskConfiguration',attributes,{'tableName':_0xe9db('0x8'),'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 d8a0606..4269d9d 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 _0x6481=['rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x6481,0xa3));var _0x1648=function(_0xa7551c,_0x5251e1){_0xa7551c=_0xa7551c-0x0;var _0x5f53af=_0x6481[_0xa7551c];return _0x5f53af;};'use strict';var _=require('lodash');var util=require(_0x1648('0x0'));var moment=require('moment');var BPromise=require(_0x1648('0x1'));var rs=require(_0x1648('0x2'));var fs=require('fs');var Redis=require(_0x1648('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1648('0x4'))(_0x1648('0x5'));var config=require(_0x1648('0x6'));var jayson=require(_0x1648('0x7'));var client=jayson['client'][_0x1648('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x407ec7,_0x430577,_0x266e25){return new BPromise(function(_0x5957f4,_0x1406aa){return client[_0x1648('0x9')](_0x407ec7,_0x266e25)[_0x1648('0xa')](function(_0x132441){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x1648('0xb'));logger[_0x1648('0xc')](_0x1648('0xd'),_0x430577,'request\x20sent',JSON[_0x1648('0xe')](_0x132441));if(_0x132441['error']){if(_0x132441[_0x1648('0xf')][_0x1648('0x10')]===0x1f4){logger[_0x1648('0xf')](_0x1648('0x11'),_0x430577,_0x132441[_0x1648('0xf')][_0x1648('0x12')]);return _0x1406aa(_0x132441[_0x1648('0xf')][_0x1648('0x12')]);}logger[_0x1648('0xf')](_0x1648('0x11'),_0x430577,_0x132441[_0x1648('0xf')][_0x1648('0x12')]);return _0x5957f4(_0x132441[_0x1648('0xf')]['message']);}else{logger[_0x1648('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x1648('0xb'));_0x5957f4(_0x132441['result'][_0x1648('0x12')]);}})[_0x1648('0x14')](function(_0x4f9833){logger[_0x1648('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x430577,_0x4f9833);_0x1406aa(_0x4f9833);});});} \ No newline at end of file +var _0x06cf=['catch','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x06cf,0x86));var _0xf06c=function(_0x5a5cb5,_0x1296bc){_0x5a5cb5=_0x5a5cb5-0x0;var _0x3dce19=_0x06cf[_0x5a5cb5];return _0x3dce19;};'use strict';var _=require('lodash');var util=require(_0xf06c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf06c('0x1'));var fs=require('fs');var Redis=require(_0xf06c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf06c('0x3'))(_0xf06c('0x4'));var config=require(_0xf06c('0x5'));var jayson=require(_0xf06c('0x6'));var client=jayson['client'][_0xf06c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5109ae,_0x32c5bf,_0x57916e){return new BPromise(function(_0x212369,_0x150048){return client[_0xf06c('0x8')](_0x5109ae,_0x57916e)['then'](function(_0x565509){logger[_0xf06c('0x9')](_0xf06c('0xa'),_0x32c5bf,_0xf06c('0xb'));logger[_0xf06c('0xc')](_0xf06c('0xd'),_0x32c5bf,_0xf06c('0xb'),JSON['stringify'](_0x565509));if(_0x565509['error']){if(_0x565509[_0xf06c('0xe')][_0xf06c('0xf')]===0x1f4){logger[_0xf06c('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x32c5bf,_0x565509['error'][_0xf06c('0x10')]);return _0x150048(_0x565509[_0xf06c('0xe')][_0xf06c('0x10')]);}logger[_0xf06c('0xe')](_0xf06c('0xa'),_0x32c5bf,_0x565509[_0xf06c('0xe')]['message']);return _0x212369(_0x565509[_0xf06c('0xe')][_0xf06c('0x10')]);}else{logger[_0xf06c('0x9')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x32c5bf,_0xf06c('0xb'));_0x212369(_0x565509[_0xf06c('0x11')]['message']);}})[_0xf06c('0x12')](function(_0x5b20a5){logger[_0xf06c('0xe')](_0xf06c('0xa'),_0x32c5bf,_0x5b20a5);_0x150048(_0x5b20a5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 0466564..1b30279 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 _0x14d1=['index','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x14d1,0x16d));var _0x114d=function(_0x20897d,_0x1c9163){_0x20897d=_0x20897d-0x0;var _0x2f6c32=_0x14d1[_0x20897d];return _0x2f6c32;};'use strict';var multer=require(_0x114d('0x0'));var util=require(_0x114d('0x1'));var path=require(_0x114d('0x2'));var timeout=require(_0x114d('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x114d('0x4'));var interaction=require(_0x114d('0x5'));var config=require(_0x114d('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x114d('0x7')]('/',auth[_0x114d('0x8')](),controller[_0x114d('0x9')]);router['get'](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x114d('0xc')]);router[_0x114d('0xd')](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xe')]);router['delete'](_0x114d('0xa'),auth[_0x114d('0x8')](),controller[_0x114d('0xf')]);module[_0x114d('0x10')]=router; \ No newline at end of file +var _0xe7b2=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe7b2,0x16c));var _0x2e7b=function(_0x12aecc,_0x443e09){_0x12aecc=_0x12aecc-0x0;var _0x1d9e13=_0xe7b2[_0x12aecc];return _0x1d9e13;};'use strict';var multer=require(_0x2e7b('0x0'));var util=require(_0x2e7b('0x1'));var path=require('path');var timeout=require(_0x2e7b('0x2'));var express=require(_0x2e7b('0x3'));var router=express[_0x2e7b('0x4')]();var fs_extra=require(_0x2e7b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e7b('0x6'));var config=require(_0x2e7b('0x7'));var controller=require(_0x2e7b('0x8'));router[_0x2e7b('0x9')]('/',auth[_0x2e7b('0xa')](),controller[_0x2e7b('0xb')]);router[_0x2e7b('0x9')](_0x2e7b('0xc'),auth[_0x2e7b('0xa')](),controller[_0x2e7b('0xd')]);router[_0x2e7b('0xe')]('/',auth[_0x2e7b('0xa')](),controller[_0x2e7b('0xf')]);router['put'](_0x2e7b('0xc'),auth[_0x2e7b('0xa')](),controller[_0x2e7b('0x10')]);router[_0x2e7b('0x11')](_0x2e7b('0xc'),auth[_0x2e7b('0xa')](),controller[_0x2e7b('0x12')]);module[_0x2e7b('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a72cef4..ffc7d21 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 _0x72f0=['STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x8d9969,_0x302b80){var _0x2338ce=function(_0x3cdf05){while(--_0x3cdf05){_0x8d9969['push'](_0x8d9969['shift']());}};_0x2338ce(++_0x302b80);}(_0x72f0,0x1ba));var _0x072f=function(_0x20d08e,_0x4cc575){_0x20d08e=_0x20d08e-0x0;var _0x2cbd12=_0x72f0[_0x20d08e];return _0x2cbd12;};'use strict';var Sequelize=require(_0x072f('0x0'));module[_0x072f('0x1')]={'type':{'type':Sequelize[_0x072f('0x2')](_0x072f('0x3'),_0x072f('0x4'),_0x072f('0x5'),'keyValue','picklist'),'defaultValue':_0x072f('0x3')},'content':{'type':Sequelize[_0x072f('0x6')]},'key':{'type':Sequelize[_0x072f('0x6')]},'keyType':{'type':Sequelize[_0x072f('0x2')]('string','variable',_0x072f('0x5'))},'keyContent':{'type':Sequelize[_0x072f('0x6')]},'idField':{'type':Sequelize[_0x072f('0x6')]},'nameField':{'type':Sequelize[_0x072f('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x072f('0x6')]}}; \ No newline at end of file +var _0x1097=['string','STRING','ENUM','BOOLEAN','sequelize','customVariable','picklist'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0x1097,0x1cb));var _0x7109=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x1097[_0x819464];return _0x49dcc0;};'use strict';var Sequelize=require(_0x7109('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x7109('0x1'),'keyValue',_0x7109('0x2')),'defaultValue':_0x7109('0x3')},'content':{'type':Sequelize[_0x7109('0x4')]},'key':{'type':Sequelize[_0x7109('0x4')]},'keyType':{'type':Sequelize[_0x7109('0x5')]('string','variable',_0x7109('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x7109('0x4')]},'customField':{'type':Sequelize[_0x7109('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7109('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 18a6e56..776f5ff 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 _0x4ea3=['count','set','Content-Range','reject','save','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','fields','query','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','FreshdeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4812e0,_0x2ccf3c){var _0x252e0f=function(_0x14cdb8){while(--_0x14cdb8){_0x4812e0['push'](_0x4812e0['shift']());}};_0x252e0f(++_0x2ccf3c);}(_0x4ea3,0x70));var _0x34ea=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4ea3[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x34ea('0x0'));var rimraf=require(_0x34ea('0x1'));var zipdir=require(_0x34ea('0x2'));var jsonpatch=require(_0x34ea('0x3'));var rp=require('request-promise');var moment=require(_0x34ea('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34ea('0x5'));var util=require('util');var path=require('path');var sox=require(_0x34ea('0x6'));var csv=require(_0x34ea('0x7'));var ejs=require(_0x34ea('0x8'));var fs=require('fs');var fs_extra=require(_0x34ea('0x9'));var _=require(_0x34ea('0xa'));var squel=require(_0x34ea('0xb'));var crypto=require(_0x34ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x34ea('0xd'));var toCsv=require(_0x34ea('0x7'));var querystring=require(_0x34ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x34ea('0xf'));var authService=require(_0x34ea('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34ea('0x11'));var logger=require(_0x34ea('0x12'))(_0x34ea('0x13'));var utils=require('../../config/utils');var config=require(_0x34ea('0x14'));var licenseUtil=require(_0x34ea('0x15'));var db=require(_0x34ea('0x16'))['db'];function respondWithStatusCode(_0x233b11,_0x60725f){_0x60725f=_0x60725f||0xcc;return function(_0xc56a7d){if(_0xc56a7d){return _0x233b11[_0x34ea('0x17')](_0x60725f);}return _0x233b11[_0x34ea('0x18')](_0x60725f)[_0x34ea('0x19')]();};}function respondWithResult(_0x2a19c6,_0x36a4c6){_0x36a4c6=_0x36a4c6||0xc8;return function(_0x5ef9ae){if(_0x5ef9ae){return _0x2a19c6[_0x34ea('0x18')](_0x36a4c6)[_0x34ea('0x1a')](_0x5ef9ae);}};}function respondWithFilteredResult(_0x14ebb9,_0x3f9ffe){return function(_0x44e44e){if(_0x44e44e){var _0x56b2d7=typeof _0x3f9ffe[_0x34ea('0x1b')]===_0x34ea('0x1c')&&typeof _0x3f9ffe[_0x34ea('0x1d')]===_0x34ea('0x1c');var _0x5f420f=_0x44e44e[_0x34ea('0x1e')];var _0x34caea=_0x56b2d7?0x0:_0x3f9ffe[_0x34ea('0x1b')];var _0x5340a4=_0x56b2d7?_0x44e44e[_0x34ea('0x1e')]:_0x3f9ffe[_0x34ea('0x1b')]+_0x3f9ffe[_0x34ea('0x1d')];var _0x127308;if(_0x5340a4>=_0x5f420f){_0x5340a4=_0x5f420f;_0x127308=0xc8;}else{_0x127308=0xce;}_0x14ebb9['status'](_0x127308);return _0x14ebb9[_0x34ea('0x1f')](_0x34ea('0x20'),_0x34caea+'-'+_0x5340a4+'/'+_0x5f420f)[_0x34ea('0x1a')](_0x44e44e);}return null;};}function patchUpdates(_0x247ee7){return function(_0x4fc1a2){try{jsonpatch['apply'](_0x4fc1a2,_0x247ee7,!![]);}catch(_0xe3b292){return BPromise[_0x34ea('0x21')](_0xe3b292);}return _0x4fc1a2[_0x34ea('0x22')]();};}function saveUpdates(_0x51022f,_0x5197a2){return function(_0x2eafc6){if(_0x2eafc6){return _0x2eafc6[_0x34ea('0x23')](_0x51022f)[_0x34ea('0x24')](function(_0x30c4b0){return _0x30c4b0;});}return null;};}function removeEntity(_0x12e7e9,_0x697475){return function(_0x5ade46){if(_0x5ade46){return _0x5ade46[_0x34ea('0x25')]()[_0x34ea('0x24')](function(){_0x12e7e9[_0x34ea('0x18')](0xcc)[_0x34ea('0x19')]();});}};}function handleEntityNotFound(_0x5b5885,_0x56f320){return function(_0x564d1b){if(!_0x564d1b){_0x5b5885[_0x34ea('0x17')](0x194);}return _0x564d1b;};}function handleError(_0x187306,_0x37c214){_0x37c214=_0x37c214||0x1f4;return function(_0x4204d7){logger['error'](_0x4204d7[_0x34ea('0x26')]);if(_0x4204d7[_0x34ea('0x27')]){delete _0x4204d7[_0x34ea('0x27')];}_0x187306['status'](_0x37c214)['send'](_0x4204d7);};}exports['index']=function(_0x4d4360,_0x2942ce){var _0x6227db={},_0x859b7e={},_0x162081={'count':0x0,'rows':[]};var _0x56c9dd=_[_0x34ea('0x28')](db['FreshdeskField'][_0x34ea('0x29')],function(_0x4f2b77){return{'name':_0x4f2b77[_0x34ea('0x2a')],'type':_0x4f2b77[_0x34ea('0x2b')][_0x34ea('0x2c')]};});_0x859b7e['model']=_[_0x34ea('0x28')](_0x56c9dd,_0x34ea('0x27'));_0x859b7e['query']=_[_0x34ea('0x2d')](_0x4d4360['query']);_0x859b7e[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x859b7e[_0x34ea('0x30')],_0x859b7e['query']);_0x6227db['attributes']=_[_0x34ea('0x2f')](_0x859b7e['model'],qs[_0x34ea('0x31')](_0x4d4360[_0x34ea('0x32')]['fields']));_0x6227db[_0x34ea('0x33')]=_0x6227db[_0x34ea('0x33')][_0x34ea('0x34')]?_0x6227db[_0x34ea('0x33')]:_0x859b7e['model'];if(!_0x4d4360['query']['hasOwnProperty'](_0x34ea('0x35'))){_0x6227db[_0x34ea('0x1d')]=qs[_0x34ea('0x1d')](_0x4d4360['query']['limit']);_0x6227db['offset']=qs[_0x34ea('0x1b')](_0x4d4360[_0x34ea('0x32')]['offset']);}_0x6227db[_0x34ea('0x36')]=qs[_0x34ea('0x37')](_0x4d4360[_0x34ea('0x32')][_0x34ea('0x37')]);_0x6227db[_0x34ea('0x38')]=qs[_0x34ea('0x2e')](_['pick'](_0x4d4360[_0x34ea('0x32')],_0x859b7e[_0x34ea('0x2e')]),_0x56c9dd);if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]){_0x6227db['where']=_['merge'](_0x6227db[_0x34ea('0x38')],{'$or':_[_0x34ea('0x28')](_0x56c9dd,function(_0xf39615){if(_0xf39615[_0x34ea('0x2b')]!==_0x34ea('0x3a')){var _0x4c696f={};_0x4c696f[_0xf39615[_0x34ea('0x27')]]={'$like':'%'+_0x4d4360[_0x34ea('0x32')][_0x34ea('0x39')]+'%'};return _0x4c696f;}})});}_0x6227db=_[_0x34ea('0x3b')]({},_0x6227db,_0x4d4360[_0x34ea('0x3c')]);var _0x4743f1={'where':_0x6227db[_0x34ea('0x38')]};return db[_0x34ea('0x3d')][_0x34ea('0x1e')](_0x4743f1)[_0x34ea('0x24')](function(_0x448bc0){_0x162081[_0x34ea('0x1e')]=_0x448bc0;if(_0x4d4360[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x6227db[_0x34ea('0x3f')]=[{'all':!![]}];}return db[_0x34ea('0x3d')]['findAll'](_0x6227db);})[_0x34ea('0x24')](function(_0x4ae353){_0x162081[_0x34ea('0x40')]=_0x4ae353;return _0x162081;})[_0x34ea('0x24')](respondWithFilteredResult(_0x2942ce,_0x6227db))[_0x34ea('0x41')](handleError(_0x2942ce,null));};exports[_0x34ea('0x42')]=function(_0x2a57b5,_0x1b785b){var _0x35d81d={'raw':!![],'where':{'id':_0x2a57b5[_0x34ea('0x43')]['id']}},_0x17ba01={};_0x17ba01['model']=_[_0x34ea('0x2d')](db['FreshdeskField'][_0x34ea('0x29')]);_0x17ba01[_0x34ea('0x32')]=_[_0x34ea('0x2d')](_0x2a57b5[_0x34ea('0x32')]);_0x17ba01[_0x34ea('0x2e')]=_[_0x34ea('0x2f')](_0x17ba01['model'],_0x17ba01[_0x34ea('0x32')]);_0x35d81d[_0x34ea('0x33')]=_['intersection'](_0x17ba01[_0x34ea('0x30')],qs[_0x34ea('0x31')](_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x31')]));_0x35d81d[_0x34ea('0x33')]=_0x35d81d['attributes'][_0x34ea('0x34')]?_0x35d81d[_0x34ea('0x33')]:_0x17ba01[_0x34ea('0x30')];if(_0x2a57b5[_0x34ea('0x32')][_0x34ea('0x3e')]){_0x35d81d[_0x34ea('0x3f')]=[{'all':!![]}];}_0x35d81d=_['merge']({},_0x35d81d,_0x2a57b5['options']);return db[_0x34ea('0x3d')][_0x34ea('0x44')](_0x35d81d)[_0x34ea('0x24')](handleEntityNotFound(_0x1b785b,null))['then'](respondWithResult(_0x1b785b,null))[_0x34ea('0x41')](handleError(_0x1b785b,null));};exports['create']=function(_0x16e9b7,_0x4cc586){return db[_0x34ea('0x3d')][_0x34ea('0x45')](_0x16e9b7[_0x34ea('0x46')],{})['then'](respondWithResult(_0x4cc586,0xc9))[_0x34ea('0x41')](handleError(_0x4cc586,null));};exports['update']=function(_0x404a59,_0x3fb739){if(_0x404a59[_0x34ea('0x46')]['id']){delete _0x404a59[_0x34ea('0x46')]['id'];}return db['FreshdeskField'][_0x34ea('0x44')]({'where':{'id':_0x404a59[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x3fb739,null))[_0x34ea('0x24')](saveUpdates(_0x404a59[_0x34ea('0x46')],null))[_0x34ea('0x24')](respondWithResult(_0x3fb739,null))[_0x34ea('0x41')](handleError(_0x3fb739,null));};exports['destroy']=function(_0x1059dc,_0x224c53){return db[_0x34ea('0x3d')][_0x34ea('0x44')]({'where':{'id':_0x1059dc[_0x34ea('0x43')]['id']}})[_0x34ea('0x24')](handleEntityNotFound(_0x224c53,null))[_0x34ea('0x24')](removeEntity(_0x224c53,null))[_0x34ea('0x41')](handleError(_0x224c53,null));}; \ No newline at end of file +var _0x8130=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','filters','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes'];(function(_0xd256a1,_0x2aae80){var _0x2a11a4=function(_0x4a74f3){while(--_0x4a74f3){_0xd256a1['push'](_0xd256a1['shift']());}};_0x2a11a4(++_0x2aae80);}(_0x8130,0x146));var _0x0813=function(_0x4062a8,_0x10a157){_0x4062a8=_0x4062a8-0x0;var _0x7b6a1a=_0x8130[_0x4062a8];return _0x7b6a1a;};'use strict';var emlformat=require(_0x0813('0x0'));var rimraf=require(_0x0813('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0813('0x2'));var rp=require(_0x0813('0x3'));var moment=require(_0x0813('0x4'));var BPromise=require(_0x0813('0x5'));var Mustache=require(_0x0813('0x6'));var util=require(_0x0813('0x7'));var path=require('path');var sox=require(_0x0813('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0813('0x9'));var _=require(_0x0813('0xa'));var squel=require(_0x0813('0xb'));var crypto=require(_0x0813('0xc'));var jsforce=require(_0x0813('0xd'));var deskjs=require(_0x0813('0xe'));var toCsv=require(_0x0813('0xf'));var querystring=require('querystring');var Papa=require(_0x0813('0x10'));var Redis=require(_0x0813('0x11'));var authService=require(_0x0813('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0813('0x13'));var logger=require('../../config/logger')(_0x0813('0x14'));var utils=require('../../config/utils');var config=require(_0x0813('0x15'));var licenseUtil=require(_0x0813('0x16'));var db=require(_0x0813('0x17'))['db'];function respondWithStatusCode(_0x230ec7,_0x5b17f2){_0x5b17f2=_0x5b17f2||0xcc;return function(_0x4dcc3a){if(_0x4dcc3a){return _0x230ec7[_0x0813('0x18')](_0x5b17f2);}return _0x230ec7[_0x0813('0x19')](_0x5b17f2)['end']();};}function respondWithResult(_0x403e40,_0x4dae33){_0x4dae33=_0x4dae33||0xc8;return function(_0x58e56c){if(_0x58e56c){return _0x403e40[_0x0813('0x19')](_0x4dae33)[_0x0813('0x1a')](_0x58e56c);}};}function respondWithFilteredResult(_0x4ffaad,_0x2cf4f1){return function(_0x5793cb){if(_0x5793cb){var _0x29537f=typeof _0x2cf4f1[_0x0813('0x1b')]===_0x0813('0x1c')&&typeof _0x2cf4f1[_0x0813('0x1d')]===_0x0813('0x1c');var _0x10e29a=_0x5793cb[_0x0813('0x1e')];var _0x3e15da=_0x29537f?0x0:_0x2cf4f1['offset'];var _0x3ec7b5=_0x29537f?_0x5793cb['count']:_0x2cf4f1[_0x0813('0x1b')]+_0x2cf4f1[_0x0813('0x1d')];var _0x518923;if(_0x3ec7b5>=_0x10e29a){_0x3ec7b5=_0x10e29a;_0x518923=0xc8;}else{_0x518923=0xce;}_0x4ffaad[_0x0813('0x19')](_0x518923);return _0x4ffaad[_0x0813('0x1f')]('Content-Range',_0x3e15da+'-'+_0x3ec7b5+'/'+_0x10e29a)[_0x0813('0x1a')](_0x5793cb);}return null;};}function patchUpdates(_0x334741){return function(_0x4d7680){try{jsonpatch[_0x0813('0x20')](_0x4d7680,_0x334741,!![]);}catch(_0x3b3662){return BPromise[_0x0813('0x21')](_0x3b3662);}return _0x4d7680[_0x0813('0x22')]();};}function saveUpdates(_0xf6ee0c,_0x5a6cdc){return function(_0x2bb694){if(_0x2bb694){return _0x2bb694[_0x0813('0x23')](_0xf6ee0c)[_0x0813('0x24')](function(_0x598cf2){return _0x598cf2;});}return null;};}function removeEntity(_0x35b3d6,_0x5eabe4){return function(_0x56f4b6){if(_0x56f4b6){return _0x56f4b6[_0x0813('0x25')]()['then'](function(){_0x35b3d6['status'](0xcc)[_0x0813('0x26')]();});}};}function handleEntityNotFound(_0x2366a3,_0x1a8d2a){return function(_0x2f8849){if(!_0x2f8849){_0x2366a3[_0x0813('0x18')](0x194);}return _0x2f8849;};}function handleError(_0x1418c7,_0x42627c){_0x42627c=_0x42627c||0x1f4;return function(_0x3ac129){logger['error'](_0x3ac129[_0x0813('0x27')]);if(_0x3ac129[_0x0813('0x28')]){delete _0x3ac129[_0x0813('0x28')];}_0x1418c7[_0x0813('0x19')](_0x42627c)[_0x0813('0x29')](_0x3ac129);};}exports[_0x0813('0x2a')]=function(_0x55e115,_0xa36d86){var _0x48294b={},_0x54ed64={},_0x54bf5d={'count':0x0,'rows':[]};var _0x3c3321=_[_0x0813('0x2b')](db[_0x0813('0x2c')][_0x0813('0x2d')],function(_0x21f388){return{'name':_0x21f388[_0x0813('0x2e')],'type':_0x21f388['type'][_0x0813('0x2f')]};});_0x54ed64[_0x0813('0x30')]=_['map'](_0x3c3321,'name');_0x54ed64[_0x0813('0x31')]=_[_0x0813('0x32')](_0x55e115[_0x0813('0x31')]);_0x54ed64['filters']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],_0x54ed64['query']);_0x48294b['attributes']=_[_0x0813('0x33')](_0x54ed64[_0x0813('0x30')],qs[_0x0813('0x34')](_0x55e115[_0x0813('0x31')]['fields']));_0x48294b[_0x0813('0x35')]=_0x48294b[_0x0813('0x35')][_0x0813('0x36')]?_0x48294b[_0x0813('0x35')]:_0x54ed64['model'];if(!_0x55e115['query'][_0x0813('0x37')](_0x0813('0x38'))){_0x48294b[_0x0813('0x1d')]=qs['limit'](_0x55e115[_0x0813('0x31')][_0x0813('0x1d')]);_0x48294b[_0x0813('0x1b')]=qs['offset'](_0x55e115['query'][_0x0813('0x1b')]);}_0x48294b[_0x0813('0x39')]=qs[_0x0813('0x3a')](_0x55e115[_0x0813('0x31')][_0x0813('0x3a')]);_0x48294b[_0x0813('0x3b')]=qs['filters'](_[_0x0813('0x3c')](_0x55e115['query'],_0x54ed64['filters']),_0x3c3321);if(_0x55e115['query'][_0x0813('0x3d')]){_0x48294b[_0x0813('0x3b')]=_['merge'](_0x48294b['where'],{'$or':_[_0x0813('0x2b')](_0x3c3321,function(_0x36ce6d){if(_0x36ce6d[_0x0813('0x3e')]!==_0x0813('0x3f')){var _0x36f4d5={};_0x36f4d5[_0x36ce6d[_0x0813('0x28')]]={'$like':'%'+_0x55e115[_0x0813('0x31')][_0x0813('0x3d')]+'%'};return _0x36f4d5;}})});}_0x48294b=_[_0x0813('0x40')]({},_0x48294b,_0x55e115[_0x0813('0x41')]);var _0x54b271={'where':_0x48294b['where']};return db['FreshdeskField'][_0x0813('0x1e')](_0x54b271)[_0x0813('0x24')](function(_0x5cb01b){_0x54bf5d[_0x0813('0x1e')]=_0x5cb01b;if(_0x55e115[_0x0813('0x31')][_0x0813('0x42')]){_0x48294b['include']=[{'all':!![]}];}return db[_0x0813('0x2c')][_0x0813('0x43')](_0x48294b);})[_0x0813('0x24')](function(_0x4e94b0){_0x54bf5d[_0x0813('0x44')]=_0x4e94b0;return _0x54bf5d;})[_0x0813('0x24')](respondWithFilteredResult(_0xa36d86,_0x48294b))[_0x0813('0x45')](handleError(_0xa36d86,null));};exports['show']=function(_0x22564d,_0x38dc22){var _0x47da3b={'raw':!![],'where':{'id':_0x22564d[_0x0813('0x46')]['id']}},_0x171a5e={};_0x171a5e['model']=_[_0x0813('0x32')](db['FreshdeskField'][_0x0813('0x2d')]);_0x171a5e[_0x0813('0x31')]=_[_0x0813('0x32')](_0x22564d['query']);_0x171a5e[_0x0813('0x47')]=_['intersection'](_0x171a5e[_0x0813('0x30')],_0x171a5e[_0x0813('0x31')]);_0x47da3b[_0x0813('0x35')]=_[_0x0813('0x33')](_0x171a5e[_0x0813('0x30')],qs[_0x0813('0x34')](_0x22564d['query'][_0x0813('0x34')]));_0x47da3b['attributes']=_0x47da3b[_0x0813('0x35')]['length']?_0x47da3b['attributes']:_0x171a5e['model'];if(_0x22564d[_0x0813('0x31')][_0x0813('0x42')]){_0x47da3b[_0x0813('0x48')]=[{'all':!![]}];}_0x47da3b=_[_0x0813('0x40')]({},_0x47da3b,_0x22564d[_0x0813('0x41')]);return db[_0x0813('0x2c')]['find'](_0x47da3b)['then'](handleEntityNotFound(_0x38dc22,null))[_0x0813('0x24')](respondWithResult(_0x38dc22,null))[_0x0813('0x45')](handleError(_0x38dc22,null));};exports[_0x0813('0x49')]=function(_0x3fd5f9,_0xadaead){return db[_0x0813('0x2c')][_0x0813('0x49')](_0x3fd5f9[_0x0813('0x4a')],{})['then'](respondWithResult(_0xadaead,0xc9))[_0x0813('0x45')](handleError(_0xadaead,null));};exports[_0x0813('0x23')]=function(_0x42e4e4,_0x1baf77){if(_0x42e4e4[_0x0813('0x4a')]['id']){delete _0x42e4e4[_0x0813('0x4a')]['id'];}return db['FreshdeskField'][_0x0813('0x4b')]({'where':{'id':_0x42e4e4['params']['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x1baf77,null))[_0x0813('0x24')](saveUpdates(_0x42e4e4[_0x0813('0x4a')],null))[_0x0813('0x24')](respondWithResult(_0x1baf77,null))['catch'](handleError(_0x1baf77,null));};exports[_0x0813('0x25')]=function(_0x3a93eb,_0x353e25){return db[_0x0813('0x2c')]['find']({'where':{'id':_0x3a93eb[_0x0813('0x46')]['id']}})[_0x0813('0x24')](handleEntityNotFound(_0x353e25,null))['then'](removeEntity(_0x353e25,null))['catch'](handleError(_0x353e25,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f8c695f..f872dcd 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 _0x4635=['rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xe4518b,_0x48523c){var _0x4b6b29=function(_0x39603c){while(--_0x39603c){_0xe4518b['push'](_0xe4518b['shift']());}};_0x4b6b29(++_0x48523c);}(_0x4635,0x80));var _0x5463=function(_0x3dad7f,_0x1f0244){_0x3dad7f=_0x3dad7f-0x0;var _0x43cea6=_0x4635[_0x3dad7f];return _0x43cea6;};'use strict';var _=require(_0x5463('0x0'));var util=require(_0x5463('0x1'));var logger=require(_0x5463('0x2'))(_0x5463('0x3'));var moment=require(_0x5463('0x4'));var BPromise=require(_0x5463('0x5'));var rp=require(_0x5463('0x6'));var fs=require('fs');var path=require(_0x5463('0x7'));var rimraf=require(_0x5463('0x8'));var config=require(_0x5463('0x9'));var attributes=require(_0x5463('0xa'));module[_0x5463('0xb')]=function(_0x545216,_0x5d28a3){return _0x545216[_0x5463('0xc')](_0x5463('0xd'),attributes,{'tableName':_0x5463('0xe'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x5463('0xf'),_0x5463('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8c1a=['lodash','api','moment','bluebird','request-promise','path','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0x4596cf,_0x29825a){var _0x5416b5=function(_0x2f3c68){while(--_0x2f3c68){_0x4596cf['push'](_0x4596cf['shift']());}};_0x5416b5(++_0x29825a);}(_0x8c1a,0x1ad));var _0xa8c1=function(_0x414810,_0x5e924d){_0x414810=_0x414810-0x0;var _0x2d4df5=_0x8c1a[_0x414810];return _0x2d4df5;};'use strict';var _=require(_0xa8c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8c1('0x1'));var moment=require(_0xa8c1('0x2'));var BPromise=require(_0xa8c1('0x3'));var rp=require(_0xa8c1('0x4'));var fs=require('fs');var path=require(_0xa8c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8c1('0x6'));module['exports']=function(_0x396c2e,_0x3d8943){return _0x396c2e['define'](_0xa8c1('0x7'),attributes,{'tableName':_0xa8c1('0x8'),'paranoid':![],'indexes':[{'name':_0xa8c1('0x9'),'fields':[_0xa8c1('0xa'),'FieldId'],'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 9342e5b..06b3aad 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 _0xaf9c=['request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xaf9c,0x87));var _0xcaf9=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xaf9c[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var moment=require(_0xcaf9('0x2'));var BPromise=require(_0xcaf9('0x3'));var rs=require(_0xcaf9('0x4'));var fs=require('fs');var Redis=require(_0xcaf9('0x5'));var db=require(_0xcaf9('0x6'))['db'];var utils=require(_0xcaf9('0x7'));var logger=require(_0xcaf9('0x8'))('rpc');var config=require(_0xcaf9('0x9'));var jayson=require(_0xcaf9('0xa'));var client=jayson['client'][_0xcaf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b1814,_0x15fdc5,_0x482a25){return new BPromise(function(_0x9c6dd6,_0x5aef08){return client[_0xcaf9('0xc')](_0x5b1814,_0x482a25)[_0xcaf9('0xd')](function(_0x510a37){logger[_0xcaf9('0xe')](_0xcaf9('0xf'),_0x15fdc5,_0xcaf9('0x10'));logger['debug'](_0xcaf9('0x11'),_0x15fdc5,_0xcaf9('0x10'),JSON['stringify'](_0x510a37));if(_0x510a37[_0xcaf9('0x12')]){if(_0x510a37[_0xcaf9('0x12')]['code']===0x1f4){logger[_0xcaf9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x15fdc5,_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);return _0x5aef08(_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);}logger[_0xcaf9('0x12')](_0xcaf9('0xf'),_0x15fdc5,_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);return _0x9c6dd6(_0x510a37[_0xcaf9('0x12')][_0xcaf9('0x13')]);}else{logger['info'](_0xcaf9('0xf'),_0x15fdc5,_0xcaf9('0x10'));_0x9c6dd6(_0x510a37[_0xcaf9('0x14')][_0xcaf9('0x13')]);}})['catch'](function(_0x5885b4){logger[_0xcaf9('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x15fdc5,_0x5885b4);_0x5aef08(_0x5885b4);});});} \ No newline at end of file +var _0xe5f4=['FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a94f4,_0x2f5b4d){var _0x46b31f=function(_0x24a9eb){while(--_0x24a9eb){_0x5a94f4['push'](_0x5a94f4['shift']());}};_0x46b31f(++_0x2f5b4d);}(_0xe5f4,0x146));var _0x4e5f=function(_0x13d577,_0x54156b){_0x13d577=_0x13d577-0x0;var _0x54304e=_0xe5f4[_0x13d577];return _0x54304e;};'use strict';var _=require(_0x4e5f('0x0'));var util=require('util');var moment=require(_0x4e5f('0x1'));var BPromise=require(_0x4e5f('0x2'));var rs=require(_0x4e5f('0x3'));var fs=require('fs');var Redis=require(_0x4e5f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e5f('0x5'));var logger=require(_0x4e5f('0x6'))(_0x4e5f('0x7'));var config=require(_0x4e5f('0x8'));var jayson=require(_0x4e5f('0x9'));var client=jayson[_0x4e5f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52e3dc,_0x521d0c,_0x1d935a){return new BPromise(function(_0x2704f0,_0xbb3067){return client[_0x4e5f('0xb')](_0x52e3dc,_0x1d935a)[_0x4e5f('0xc')](function(_0x4e0d7a){logger[_0x4e5f('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x521d0c,_0x4e5f('0xe'));logger['debug'](_0x4e5f('0xf'),_0x521d0c,_0x4e5f('0xe'),JSON[_0x4e5f('0x10')](_0x4e0d7a));if(_0x4e0d7a[_0x4e5f('0x11')]){if(_0x4e0d7a['error'][_0x4e5f('0x12')]===0x1f4){logger[_0x4e5f('0x11')](_0x4e5f('0x13'),_0x521d0c,_0x4e0d7a['error'][_0x4e5f('0x14')]);return _0xbb3067(_0x4e0d7a[_0x4e5f('0x11')][_0x4e5f('0x14')]);}logger[_0x4e5f('0x11')](_0x4e5f('0x13'),_0x521d0c,_0x4e0d7a[_0x4e5f('0x11')][_0x4e5f('0x14')]);return _0x2704f0(_0x4e0d7a[_0x4e5f('0x11')]['message']);}else{logger[_0x4e5f('0xd')](_0x4e5f('0x13'),_0x521d0c,_0x4e5f('0xe'));_0x2704f0(_0x4e0d7a[_0x4e5f('0x15')][_0x4e5f('0x14')]);}})[_0x4e5f('0x16')](function(_0xe36e3d){logger[_0x4e5f('0x11')](_0x4e5f('0x13'),_0x521d0c,_0xe36e3d);_0xbb3067(_0xe36e3d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 69491cf..cb885b5 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 _0x7af2=['getConfigurations','/:id/configurations','addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7af2,0x119));var _0x27af=function(_0x2cd1a1,_0x5830e4){_0x2cd1a1=_0x2cd1a1-0x0;var _0x15091c=_0x7af2[_0x2cd1a1];return _0x15091c;};'use strict';var multer=require('multer');var util=require(_0x27af('0x0'));var path=require(_0x27af('0x1'));var timeout=require(_0x27af('0x2'));var express=require(_0x27af('0x3'));var router=express['Router']();var fs_extra=require(_0x27af('0x4'));var auth=require(_0x27af('0x5'));var interaction=require(_0x27af('0x6'));var config=require(_0x27af('0x7'));var controller=require(_0x27af('0x8'));router[_0x27af('0x9')]('/',auth[_0x27af('0xa')](),controller[_0x27af('0xb')]);router[_0x27af('0x9')]('/:id',auth[_0x27af('0xa')](),controller[_0x27af('0xc')]);router[_0x27af('0x9')]('/:id/configurations',auth[_0x27af('0xa')](),controller[_0x27af('0xd')]);router[_0x27af('0x9')]('/:id/fields',auth[_0x27af('0xa')](),controller['getFields']);router['post']('/',auth[_0x27af('0xa')](),controller['create']);router['post'](_0x27af('0xe'),auth['isAuthenticated'](),controller[_0x27af('0xf')]);router['put'](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x11')]);router[_0x27af('0x12')](_0x27af('0x10'),auth[_0x27af('0xa')](),controller[_0x27af('0x13')]);module[_0x27af('0x14')]=router; \ No newline at end of file +var _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x14f6db,_0x4d9f26){var _0x45344d=function(_0x44cace){while(--_0x44cace){_0x14f6db['push'](_0x14f6db['shift']());}};_0x45344d(++_0x4d9f26);}(_0x0fd9,0xa3));var _0x90fd=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0x0fd9[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 589f5ed..be7256c 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 _0xcf2f=['exports','STRING','remoteUri','sequelize'];(function(_0x50460e,_0xf5caa1){var _0x31a993=function(_0x5bdfd5){while(--_0x5bdfd5){_0x50460e['push'](_0x50460e['shift']());}};_0x31a993(++_0xf5caa1);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x3f7bfb,_0x761dd7){_0x3f7bfb=_0x3f7bfb-0x0;var _0xe05ac3=_0xcf2f[_0x3f7bfb];return _0xe05ac3;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'name':{'type':Sequelize[_0xfcf2('0x2')]},'description':{'type':Sequelize[_0xfcf2('0x2')]},'username':{'type':Sequelize[_0xfcf2('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xfcf2('0x2')]},'remoteUri':{'type':Sequelize[_0xfcf2('0x2')],'unique':_0xfcf2('0x3')},'serverUrl':{'type':Sequelize[_0xfcf2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['STRING','username','exports'];(function(_0x585f82,_0x450c82){var _0x16de6a=function(_0x323e88){while(--_0x323e88){_0x585f82['push'](_0x585f82['shift']());}};_0x16de6a(++_0x450c82);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x65f6('0x1')]},'username':{'type':Sequelize[_0x65f6('0x1')],'unique':_0x65f6('0x2')},'apiKey':{'type':Sequelize[_0x65f6('0x1')]},'remoteUri':{'type':Sequelize[_0x65f6('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x65f6('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 57d6587..ed6173b 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 _0x5c15=['params','keys','find','create','body','update','getConfigurations','FreshsalesConfiguration','merge','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','findOne','username','apiKey','remoteUri','slice','GET','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','destroy','then','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','intersection','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','options','includeAll','include','findAll','rows','catch'];(function(_0x429194,_0x4ea940){var _0x66fd30=function(_0x2f6232){while(--_0x2f6232){_0x429194['push'](_0x429194['shift']());}};_0x66fd30(++_0x4ea940);}(_0x5c15,0xe3));var _0x55c1=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5c15[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x55c1('0x0'));var rimraf=require(_0x55c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x55c1('0x2'));var rp=require(_0x55c1('0x3'));var moment=require(_0x55c1('0x4'));var BPromise=require(_0x55c1('0x5'));var Mustache=require(_0x55c1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x55c1('0x7'));var csv=require(_0x55c1('0x8'));var ejs=require(_0x55c1('0x9'));var fs=require('fs');var fs_extra=require(_0x55c1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x55c1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x55c1('0x8'));var querystring=require(_0x55c1('0xc'));var Papa=require('papaparse');var Redis=require(_0x55c1('0xd'));var authService=require(_0x55c1('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x55c1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x55c1('0x10'))(_0x55c1('0x11'));var utils=require(_0x55c1('0x12'));var config=require(_0x55c1('0x13'));var licenseUtil=require(_0x55c1('0x14'));var db=require(_0x55c1('0x15'))['db'];var integrations=require(_0x55c1('0x16'));function respondWithStatusCode(_0xec8bb3,_0x41dfaa){_0x41dfaa=_0x41dfaa||0xcc;return function(_0x4e9e67){if(_0x4e9e67){return _0xec8bb3['sendStatus'](_0x41dfaa);}return _0xec8bb3[_0x55c1('0x17')](_0x41dfaa)[_0x55c1('0x18')]();};}function respondWithResult(_0x5b64cd,_0x5bea48){_0x5bea48=_0x5bea48||0xc8;return function(_0x10275d){if(_0x10275d){return _0x5b64cd['status'](_0x5bea48)[_0x55c1('0x19')](_0x10275d);}};}function respondWithFilteredResult(_0x21e6d9,_0x46774d){return function(_0x3e14db){if(_0x3e14db){var _0x4d0dae=typeof _0x46774d[_0x55c1('0x1a')]===_0x55c1('0x1b')&&typeof _0x46774d[_0x55c1('0x1c')]===_0x55c1('0x1b');var _0x248e08=_0x3e14db['count'];var _0x3f2e13=_0x4d0dae?0x0:_0x46774d[_0x55c1('0x1a')];var _0x5f0a8f=_0x4d0dae?_0x3e14db[_0x55c1('0x1d')]:_0x46774d[_0x55c1('0x1a')]+_0x46774d[_0x55c1('0x1c')];var _0x51e3ca;if(_0x5f0a8f>=_0x248e08){_0x5f0a8f=_0x248e08;_0x51e3ca=0xc8;}else{_0x51e3ca=0xce;}_0x21e6d9[_0x55c1('0x17')](_0x51e3ca);return _0x21e6d9['set'](_0x55c1('0x1e'),_0x3f2e13+'-'+_0x5f0a8f+'/'+_0x248e08)[_0x55c1('0x19')](_0x3e14db);}return null;};}function patchUpdates(_0x700ea1){return function(_0x327f78){try{jsonpatch[_0x55c1('0x1f')](_0x327f78,_0x700ea1,!![]);}catch(_0x54ff4b){return BPromise[_0x55c1('0x20')](_0x54ff4b);}return _0x327f78['save']();};}function saveUpdates(_0x5e76da,_0x309e9d){return function(_0x20b2a9){if(_0x20b2a9){return _0x20b2a9['update'](_0x5e76da)['then'](function(_0x1818a2){return _0x1818a2;});}return null;};}function removeEntity(_0x1a276a,_0x23689f){return function(_0x3b4298){if(_0x3b4298){return _0x3b4298[_0x55c1('0x21')]()[_0x55c1('0x22')](function(){_0x1a276a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38f215,_0x4ba7b5){return function(_0x31730b){if(!_0x31730b){_0x38f215[_0x55c1('0x23')](0x194);}return _0x31730b;};}function handleError(_0x394c96,_0x226c98){_0x226c98=_0x226c98||0x1f4;return function(_0x3dd904){logger['error'](_0x3dd904[_0x55c1('0x24')]);if(_0x3dd904['name']){delete _0x3dd904[_0x55c1('0x25')];}_0x394c96[_0x55c1('0x17')](_0x226c98)[_0x55c1('0x26')](_0x3dd904);};}exports[_0x55c1('0x27')]=function(_0x411707,_0x5353f9){var _0x37535f={},_0x321c0d={},_0x45b83d={'count':0x0,'rows':[]};var _0x910820=_[_0x55c1('0x28')](db[_0x55c1('0x29')][_0x55c1('0x2a')],function(_0x23a636){return{'name':_0x23a636[_0x55c1('0x2b')],'type':_0x23a636[_0x55c1('0x2c')]['key']};});_0x321c0d['model']=_[_0x55c1('0x28')](_0x910820,_0x55c1('0x25'));_0x321c0d['query']=_['keys'](_0x411707['query']);_0x321c0d['filters']=_[_0x55c1('0x2d')](_0x321c0d[_0x55c1('0x2e')],_0x321c0d[_0x55c1('0x2f')]);_0x37535f[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0x321c0d[_0x55c1('0x2e')],qs[_0x55c1('0x31')](_0x411707[_0x55c1('0x2f')][_0x55c1('0x31')]));_0x37535f[_0x55c1('0x30')]=_0x37535f[_0x55c1('0x30')][_0x55c1('0x32')]?_0x37535f[_0x55c1('0x30')]:_0x321c0d[_0x55c1('0x2e')];if(!_0x411707[_0x55c1('0x2f')][_0x55c1('0x33')]('nolimit')){_0x37535f['limit']=qs['limit'](_0x411707['query'][_0x55c1('0x1c')]);_0x37535f[_0x55c1('0x1a')]=qs['offset'](_0x411707['query'][_0x55c1('0x1a')]);}_0x37535f[_0x55c1('0x34')]=qs[_0x55c1('0x35')](_0x411707[_0x55c1('0x2f')][_0x55c1('0x35')]);_0x37535f[_0x55c1('0x36')]=qs['filters'](_[_0x55c1('0x37')](_0x411707['query'],_0x321c0d[_0x55c1('0x38')]),_0x910820);if(_0x411707[_0x55c1('0x2f')]['filter']){_0x37535f[_0x55c1('0x36')]=_['merge'](_0x37535f[_0x55c1('0x36')],{'$or':_[_0x55c1('0x28')](_0x910820,function(_0x5a6176){if(_0x5a6176[_0x55c1('0x2c')]!=='VIRTUAL'){var _0x24a92c={};_0x24a92c[_0x5a6176[_0x55c1('0x25')]]={'$like':'%'+_0x411707[_0x55c1('0x2f')][_0x55c1('0x39')]+'%'};return _0x24a92c;}})});}_0x37535f=_['merge']({},_0x37535f,_0x411707[_0x55c1('0x3a')]);var _0x5ef15f={'where':_0x37535f[_0x55c1('0x36')]};return db['FreshsalesAccount'][_0x55c1('0x1d')](_0x5ef15f)[_0x55c1('0x22')](function(_0x50ea79){_0x45b83d['count']=_0x50ea79;if(_0x411707[_0x55c1('0x2f')][_0x55c1('0x3b')]){_0x37535f[_0x55c1('0x3c')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x55c1('0x3d')](_0x37535f);})[_0x55c1('0x22')](function(_0x57127f){_0x45b83d[_0x55c1('0x3e')]=_0x57127f;return _0x45b83d;})[_0x55c1('0x22')](respondWithFilteredResult(_0x5353f9,_0x37535f))[_0x55c1('0x3f')](handleError(_0x5353f9,null));};exports['show']=function(_0x210d38,_0x49d4ce){var _0x57df23={'raw':![],'where':{'id':_0x210d38[_0x55c1('0x40')]['id']}},_0xacfbe0={};_0xacfbe0[_0x55c1('0x2e')]=_[_0x55c1('0x41')](db['FreshsalesAccount'][_0x55c1('0x2a')]);_0xacfbe0[_0x55c1('0x2f')]=_['keys'](_0x210d38['query']);_0xacfbe0[_0x55c1('0x38')]=_[_0x55c1('0x2d')](_0xacfbe0[_0x55c1('0x2e')],_0xacfbe0[_0x55c1('0x2f')]);_0x57df23[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0xacfbe0['model'],qs[_0x55c1('0x31')](_0x210d38['query']['fields']));_0x57df23[_0x55c1('0x30')]=_0x57df23[_0x55c1('0x30')][_0x55c1('0x32')]?_0x57df23[_0x55c1('0x30')]:_0xacfbe0['model'];if(_0x210d38[_0x55c1('0x2f')][_0x55c1('0x3b')]){_0x57df23[_0x55c1('0x3c')]=[{'all':!![]}];}_0x57df23=_['merge']({},_0x57df23,_0x210d38[_0x55c1('0x3a')]);return db['FreshsalesAccount'][_0x55c1('0x42')](_0x57df23)[_0x55c1('0x22')](handleEntityNotFound(_0x49d4ce,null))[_0x55c1('0x22')](respondWithResult(_0x49d4ce,null))[_0x55c1('0x3f')](handleError(_0x49d4ce,null));};exports['create']=function(_0x3d0874,_0x458cac){return db[_0x55c1('0x29')][_0x55c1('0x43')](_0x3d0874[_0x55c1('0x44')],{})[_0x55c1('0x22')](respondWithResult(_0x458cac,0xc9))[_0x55c1('0x3f')](handleError(_0x458cac,null));};exports[_0x55c1('0x45')]=function(_0x37accf,_0x2ab7f0){if(_0x37accf[_0x55c1('0x44')]['id']){delete _0x37accf['body']['id'];}return db[_0x55c1('0x29')][_0x55c1('0x42')]({'where':{'id':_0x37accf[_0x55c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ab7f0,null))[_0x55c1('0x22')](saveUpdates(_0x37accf[_0x55c1('0x44')],null))[_0x55c1('0x22')](respondWithResult(_0x2ab7f0,null))[_0x55c1('0x3f')](handleError(_0x2ab7f0,null));};exports[_0x55c1('0x21')]=function(_0x410943,_0x49fe97){return db[_0x55c1('0x29')][_0x55c1('0x42')]({'where':{'id':_0x410943[_0x55c1('0x40')]['id']}})[_0x55c1('0x22')](handleEntityNotFound(_0x49fe97,null))[_0x55c1('0x22')](removeEntity(_0x49fe97,null))[_0x55c1('0x3f')](handleError(_0x49fe97,null));};exports[_0x55c1('0x46')]=function(_0x26260e,_0x172e3b,_0x3e9882){var _0x2ff843={};var _0x4e1a77={};var _0x85f105;var _0x4a4b76;return db[_0x55c1('0x29')]['findOne']({'where':{'id':_0x26260e[_0x55c1('0x40')]['id']}})[_0x55c1('0x22')](handleEntityNotFound(_0x172e3b,null))[_0x55c1('0x22')](function(_0x1ca042){if(_0x1ca042){_0x85f105=_0x1ca042;_0x4e1a77[_0x55c1('0x2e')]=_[_0x55c1('0x41')](db[_0x55c1('0x47')][_0x55c1('0x2a')]);_0x4e1a77[_0x55c1('0x2f')]=_[_0x55c1('0x41')](_0x26260e['query']);_0x4e1a77[_0x55c1('0x38')]=_[_0x55c1('0x2d')](_0x4e1a77[_0x55c1('0x2e')],_0x4e1a77[_0x55c1('0x2f')]);_0x2ff843[_0x55c1('0x30')]=_[_0x55c1('0x2d')](_0x4e1a77[_0x55c1('0x2e')],qs[_0x55c1('0x31')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x31')]));_0x2ff843[_0x55c1('0x30')]=_0x2ff843['attributes'][_0x55c1('0x32')]?_0x2ff843[_0x55c1('0x30')]:_0x4e1a77[_0x55c1('0x2e')];_0x2ff843[_0x55c1('0x34')]=qs[_0x55c1('0x35')](_0x26260e['query']['sort']);_0x2ff843['where']=qs[_0x55c1('0x38')](_[_0x55c1('0x37')](_0x26260e[_0x55c1('0x2f')],_0x4e1a77[_0x55c1('0x38')]));if(_0x26260e[_0x55c1('0x2f')][_0x55c1('0x39')]){_0x2ff843[_0x55c1('0x36')]=_[_0x55c1('0x48')](_0x2ff843[_0x55c1('0x36')],{'$or':_[_0x55c1('0x28')](_0x2ff843[_0x55c1('0x30')],function(_0x20e522){var _0x5e94ad={};_0x5e94ad[_0x20e522]={'$like':'%'+_0x26260e[_0x55c1('0x2f')][_0x55c1('0x39')]+'%'};return _0x5e94ad;})});}_0x2ff843=_[_0x55c1('0x48')]({},_0x2ff843,_0x26260e['options']);return _0x85f105[_0x55c1('0x46')](_0x2ff843);}})[_0x55c1('0x22')](function(_0x46f50f){if(_0x46f50f){_0x4a4b76=_0x46f50f[_0x55c1('0x32')];if(!_0x26260e[_0x55c1('0x2f')]['hasOwnProperty'](_0x55c1('0x49'))){_0x2ff843[_0x55c1('0x1c')]=qs[_0x55c1('0x1c')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x1c')]);_0x2ff843[_0x55c1('0x1a')]=qs[_0x55c1('0x1a')](_0x26260e[_0x55c1('0x2f')][_0x55c1('0x1a')]);}return _0x85f105[_0x55c1('0x46')](_0x2ff843);}})[_0x55c1('0x22')](function(_0x4c8294){if(_0x4c8294){return _0x4c8294?{'count':_0x4a4b76,'rows':_0x4c8294}:null;}})[_0x55c1('0x22')](respondWithResult(_0x172e3b,null))[_0x55c1('0x3f')](handleError(_0x172e3b,null));};exports[_0x55c1('0x4a')]=function(_0x5ee839,_0x5c7ea4,_0x3f3ab4){if(_0x5ee839['body']['id']){delete _0x5ee839['body']['id'];}return db[_0x55c1('0x29')]['findOne']({'where':{'id':_0x5ee839[_0x55c1('0x40')]['id']}})['then'](handleEntityNotFound(_0x5c7ea4,null))[_0x55c1('0x22')](function(_0xcdda44){if(_0xcdda44){_0x5ee839[_0x55c1('0x44')]['AccountId']=_0xcdda44['id'];_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4b')]=integrations[_0x55c1('0x4c')](_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4d')],_0x5ee839['body']['type']);_0x5ee839['body'][_0x55c1('0x4e')]=integrations[_0x55c1('0x4f')](_0x5ee839[_0x55c1('0x44')][_0x55c1('0x4d')],_0x5ee839[_0x55c1('0x44')][_0x55c1('0x2c')]);return db[_0x55c1('0x47')]['create'](_0x5ee839[_0x55c1('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0x55c1('0x4b')},{'model':db[_0x55c1('0x50')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x5c7ea4,null))[_0x55c1('0x3f')](handleError(_0x5c7ea4,null));};exports['getFields']=function(_0x3bb1ec,_0x45bb46,_0x41262d){var _0x7577bb='';var _0x51395c='';return db['FreshsalesAccount'][_0x55c1('0x51')]({'where':{'id':_0x3bb1ec[_0x55c1('0x40')]['id']},'attributes':['id',_0x55c1('0x52'),'remoteUri',_0x55c1('0x53')]})[_0x55c1('0x22')](handleEntityNotFound(_0x45bb46,null))[_0x55c1('0x22')](function(_0xb1d7c4){if(_0xb1d7c4){_0x51395c=_0xb1d7c4['username'];_0x7577bb=_0xb1d7c4[_0x55c1('0x54')];var _0x1c0b2a=_0xb1d7c4[_0x55c1('0x54')][_0x55c1('0x55')](-0x1);if(_0x1c0b2a==='/'){_0x7577bb=_0x7577bb['substring'](0x0,_0x7577bb['lastIndexOf'](_0x1c0b2a));}return rp({'method':_0x55c1('0x56'),'uri':util['format'](_0x55c1('0x57'),_0x7577bb,_0x55c1('0x58')),'headers':{'Authorization':_0x55c1('0x59')+_0xb1d7c4[_0x55c1('0x53')]},'json':!![]});}})[_0x55c1('0x22')](function(_0x3e3719){if(_0x3e3719){var _0x180bc0=_0x3e3719[_0x55c1('0x5a')];var _0x2af963=![];var _0x4c8391=null;for(_0x4c8391=0x0;_0x4c8391<_0x180bc0['length'];_0x4c8391++){if(_0x180bc0[_0x4c8391]['email']===_0x51395c){_0x2af963=!![];}}if(_0x2af963){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x55c1('0x5b')});}}})[_0x55c1('0x22')](respondWithResult(_0x45bb46,null))[_0x55c1('0x3f')](function(_0x1dfa48){var _0xe3394e=_0x3bb1ec['query'][_0x55c1('0x5c')]?0x1f4:_0x1dfa48[_0x55c1('0x5d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x55c1('0x5e'),_0xe3394e,JSON[_0x55c1('0x5f')](_0x1dfa48));delete _0x1dfa48[_0x55c1('0x25')];if(_0xe3394e===0x191){_0xe3394e=0x190;}_0x45bb46['status'](_0xe3394e)[_0x55c1('0x26')](_0x3bb1ec[_0x55c1('0x2f')][_0x55c1('0x5c')]?{'message':_0x55c1('0x60'),'statusCode':_0x1dfa48[_0x55c1('0x5d')]}:_0x1dfa48);});}; \ No newline at end of file +var _0xdbe2=['Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','stringify','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','destroy','then','error','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','findOne','FreshsalesConfiguration','order','getConfigurations','hasOwnProperty','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','GET','format','%s%s','/api/selector/owners'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xdbe2,0xd4));var _0x2dbe=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0xdbe2[_0x53afe9];return _0x396396;};'use strict';var emlformat=require(_0x2dbe('0x0'));var rimraf=require(_0x2dbe('0x1'));var zipdir=require(_0x2dbe('0x2'));var jsonpatch=require(_0x2dbe('0x3'));var rp=require(_0x2dbe('0x4'));var moment=require(_0x2dbe('0x5'));var BPromise=require(_0x2dbe('0x6'));var Mustache=require(_0x2dbe('0x7'));var util=require(_0x2dbe('0x8'));var path=require(_0x2dbe('0x9'));var sox=require(_0x2dbe('0xa'));var csv=require(_0x2dbe('0xb'));var ejs=require(_0x2dbe('0xc'));var fs=require('fs');var fs_extra=require(_0x2dbe('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2dbe('0xe'));var jsforce=require(_0x2dbe('0xf'));var deskjs=require(_0x2dbe('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2dbe('0x11'));var Redis=require(_0x2dbe('0x12'));var authService=require(_0x2dbe('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2dbe('0x14'))(_0x2dbe('0x15'));var utils=require(_0x2dbe('0x16'));var config=require(_0x2dbe('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2dbe('0x18'))['db'];var integrations=require(_0x2dbe('0x19'));function respondWithStatusCode(_0x3935b7,_0x67df95){_0x67df95=_0x67df95||0xcc;return function(_0x309e94){if(_0x309e94){return _0x3935b7[_0x2dbe('0x1a')](_0x67df95);}return _0x3935b7[_0x2dbe('0x1b')](_0x67df95)[_0x2dbe('0x1c')]();};}function respondWithResult(_0x1de393,_0x3e444e){_0x3e444e=_0x3e444e||0xc8;return function(_0x6395c5){if(_0x6395c5){return _0x1de393['status'](_0x3e444e)['json'](_0x6395c5);}};}function respondWithFilteredResult(_0x23864c,_0x4854eb){return function(_0x3a576b){if(_0x3a576b){var _0x1b9ebc=typeof _0x4854eb[_0x2dbe('0x1d')]===_0x2dbe('0x1e')&&typeof _0x4854eb[_0x2dbe('0x1f')]===_0x2dbe('0x1e');var _0x4ede24=_0x3a576b['count'];var _0x35b784=_0x1b9ebc?0x0:_0x4854eb[_0x2dbe('0x1d')];var _0x429dd4=_0x1b9ebc?_0x3a576b['count']:_0x4854eb[_0x2dbe('0x1d')]+_0x4854eb[_0x2dbe('0x1f')];var _0x8776bb;if(_0x429dd4>=_0x4ede24){_0x429dd4=_0x4ede24;_0x8776bb=0xc8;}else{_0x8776bb=0xce;}_0x23864c[_0x2dbe('0x1b')](_0x8776bb);return _0x23864c[_0x2dbe('0x20')](_0x2dbe('0x21'),_0x35b784+'-'+_0x429dd4+'/'+_0x4ede24)[_0x2dbe('0x22')](_0x3a576b);}return null;};}function patchUpdates(_0x59113b){return function(_0x40d80c){try{jsonpatch[_0x2dbe('0x23')](_0x40d80c,_0x59113b,!![]);}catch(_0x331215){return BPromise[_0x2dbe('0x24')](_0x331215);}return _0x40d80c['save']();};}function saveUpdates(_0x5c4685,_0x4a3029){return function(_0x58b267){if(_0x58b267){return _0x58b267['update'](_0x5c4685)['then'](function(_0x5b67db){return _0x5b67db;});}return null;};}function removeEntity(_0x354cfa,_0x26517b){return function(_0x408d3e){if(_0x408d3e){return _0x408d3e[_0x2dbe('0x25')]()[_0x2dbe('0x26')](function(){_0x354cfa[_0x2dbe('0x1b')](0xcc)[_0x2dbe('0x1c')]();});}};}function handleEntityNotFound(_0x2bd080,_0x22d75c){return function(_0x2c0af5){if(!_0x2c0af5){_0x2bd080['sendStatus'](0x194);}return _0x2c0af5;};}function handleError(_0x172cd9,_0x289906){_0x289906=_0x289906||0x1f4;return function(_0x42ee48){logger[_0x2dbe('0x27')](_0x42ee48[_0x2dbe('0x28')]);if(_0x42ee48['name']){delete _0x42ee48[_0x2dbe('0x29')];}_0x172cd9[_0x2dbe('0x1b')](_0x289906)['send'](_0x42ee48);};}exports['index']=function(_0x267097,_0x41a3ac){var _0xb6e838={},_0x586e71={},_0x42ded0={'count':0x0,'rows':[]};var _0x5ce086=_[_0x2dbe('0x2a')](db[_0x2dbe('0x2b')][_0x2dbe('0x2c')],function(_0x21d933){return{'name':_0x21d933[_0x2dbe('0x2d')],'type':_0x21d933[_0x2dbe('0x2e')][_0x2dbe('0x2f')]};});_0x586e71[_0x2dbe('0x30')]=_['map'](_0x5ce086,_0x2dbe('0x29'));_0x586e71[_0x2dbe('0x31')]=_[_0x2dbe('0x32')](_0x267097[_0x2dbe('0x31')]);_0x586e71['filters']=_[_0x2dbe('0x33')](_0x586e71[_0x2dbe('0x30')],_0x586e71[_0x2dbe('0x31')]);_0xb6e838[_0x2dbe('0x34')]=_[_0x2dbe('0x33')](_0x586e71[_0x2dbe('0x30')],qs[_0x2dbe('0x35')](_0x267097['query'][_0x2dbe('0x35')]));_0xb6e838[_0x2dbe('0x34')]=_0xb6e838['attributes'][_0x2dbe('0x36')]?_0xb6e838[_0x2dbe('0x34')]:_0x586e71['model'];if(!_0x267097[_0x2dbe('0x31')]['hasOwnProperty'](_0x2dbe('0x37'))){_0xb6e838[_0x2dbe('0x1f')]=qs['limit'](_0x267097['query'][_0x2dbe('0x1f')]);_0xb6e838[_0x2dbe('0x1d')]=qs[_0x2dbe('0x1d')](_0x267097[_0x2dbe('0x31')]['offset']);}_0xb6e838['order']=qs[_0x2dbe('0x38')](_0x267097['query']['sort']);_0xb6e838[_0x2dbe('0x39')]=qs[_0x2dbe('0x3a')](_[_0x2dbe('0x3b')](_0x267097[_0x2dbe('0x31')],_0x586e71['filters']),_0x5ce086);if(_0x267097[_0x2dbe('0x31')][_0x2dbe('0x3c')]){_0xb6e838[_0x2dbe('0x39')]=_[_0x2dbe('0x3d')](_0xb6e838['where'],{'$or':_[_0x2dbe('0x2a')](_0x5ce086,function(_0x39efe6){if(_0x39efe6[_0x2dbe('0x2e')]!=='VIRTUAL'){var _0x3897c0={};_0x3897c0[_0x39efe6[_0x2dbe('0x29')]]={'$like':'%'+_0x267097[_0x2dbe('0x31')][_0x2dbe('0x3c')]+'%'};return _0x3897c0;}})});}_0xb6e838=_['merge']({},_0xb6e838,_0x267097[_0x2dbe('0x3e')]);var _0x4d1e30={'where':_0xb6e838['where']};return db['FreshsalesAccount'][_0x2dbe('0x3f')](_0x4d1e30)[_0x2dbe('0x26')](function(_0x1ca6b5){_0x42ded0['count']=_0x1ca6b5;if(_0x267097[_0x2dbe('0x31')][_0x2dbe('0x40')]){_0xb6e838[_0x2dbe('0x41')]=[{'all':!![]}];}return db[_0x2dbe('0x2b')][_0x2dbe('0x42')](_0xb6e838);})[_0x2dbe('0x26')](function(_0x16540e){_0x42ded0[_0x2dbe('0x43')]=_0x16540e;return _0x42ded0;})[_0x2dbe('0x26')](respondWithFilteredResult(_0x41a3ac,_0xb6e838))['catch'](handleError(_0x41a3ac,null));};exports[_0x2dbe('0x44')]=function(_0x7813ea,_0x26e85e){var _0x3a92b3={'raw':![],'where':{'id':_0x7813ea[_0x2dbe('0x45')]['id']}},_0xe68365={};_0xe68365[_0x2dbe('0x30')]=_[_0x2dbe('0x32')](db[_0x2dbe('0x2b')][_0x2dbe('0x2c')]);_0xe68365[_0x2dbe('0x31')]=_[_0x2dbe('0x32')](_0x7813ea[_0x2dbe('0x31')]);_0xe68365['filters']=_[_0x2dbe('0x33')](_0xe68365['model'],_0xe68365['query']);_0x3a92b3[_0x2dbe('0x34')]=_[_0x2dbe('0x33')](_0xe68365['model'],qs[_0x2dbe('0x35')](_0x7813ea[_0x2dbe('0x31')][_0x2dbe('0x35')]));_0x3a92b3['attributes']=_0x3a92b3[_0x2dbe('0x34')][_0x2dbe('0x36')]?_0x3a92b3['attributes']:_0xe68365['model'];if(_0x7813ea[_0x2dbe('0x31')][_0x2dbe('0x40')]){_0x3a92b3[_0x2dbe('0x41')]=[{'all':!![]}];}_0x3a92b3=_['merge']({},_0x3a92b3,_0x7813ea[_0x2dbe('0x3e')]);return db[_0x2dbe('0x2b')][_0x2dbe('0x46')](_0x3a92b3)[_0x2dbe('0x26')](handleEntityNotFound(_0x26e85e,null))[_0x2dbe('0x26')](respondWithResult(_0x26e85e,null))[_0x2dbe('0x47')](handleError(_0x26e85e,null));};exports[_0x2dbe('0x48')]=function(_0x154b10,_0x4c0fe6){return db[_0x2dbe('0x2b')][_0x2dbe('0x48')](_0x154b10[_0x2dbe('0x49')],{})[_0x2dbe('0x26')](respondWithResult(_0x4c0fe6,0xc9))[_0x2dbe('0x47')](handleError(_0x4c0fe6,null));};exports[_0x2dbe('0x4a')]=function(_0x437a09,_0x421903){if(_0x437a09[_0x2dbe('0x49')]['id']){delete _0x437a09[_0x2dbe('0x49')]['id'];}return db[_0x2dbe('0x2b')][_0x2dbe('0x46')]({'where':{'id':_0x437a09[_0x2dbe('0x45')]['id']}})['then'](handleEntityNotFound(_0x421903,null))[_0x2dbe('0x26')](saveUpdates(_0x437a09[_0x2dbe('0x49')],null))[_0x2dbe('0x26')](respondWithResult(_0x421903,null))[_0x2dbe('0x47')](handleError(_0x421903,null));};exports[_0x2dbe('0x25')]=function(_0xe4bcc,_0x414494){return db[_0x2dbe('0x2b')][_0x2dbe('0x46')]({'where':{'id':_0xe4bcc[_0x2dbe('0x45')]['id']}})[_0x2dbe('0x26')](handleEntityNotFound(_0x414494,null))[_0x2dbe('0x26')](removeEntity(_0x414494,null))[_0x2dbe('0x47')](handleError(_0x414494,null));};exports['getConfigurations']=function(_0x3d632a,_0x2331eb,_0x34fe0e){var _0x5800db={};var _0x38c6e7={};var _0x37e926;var _0x4e031e;return db['FreshsalesAccount'][_0x2dbe('0x4b')]({'where':{'id':_0x3d632a[_0x2dbe('0x45')]['id']}})[_0x2dbe('0x26')](handleEntityNotFound(_0x2331eb,null))['then'](function(_0x376e08){if(_0x376e08){_0x37e926=_0x376e08;_0x38c6e7['model']=_[_0x2dbe('0x32')](db[_0x2dbe('0x4c')][_0x2dbe('0x2c')]);_0x38c6e7[_0x2dbe('0x31')]=_['keys'](_0x3d632a['query']);_0x38c6e7[_0x2dbe('0x3a')]=_[_0x2dbe('0x33')](_0x38c6e7['model'],_0x38c6e7['query']);_0x5800db[_0x2dbe('0x34')]=_['intersection'](_0x38c6e7[_0x2dbe('0x30')],qs[_0x2dbe('0x35')](_0x3d632a[_0x2dbe('0x31')][_0x2dbe('0x35')]));_0x5800db[_0x2dbe('0x34')]=_0x5800db[_0x2dbe('0x34')][_0x2dbe('0x36')]?_0x5800db[_0x2dbe('0x34')]:_0x38c6e7[_0x2dbe('0x30')];_0x5800db[_0x2dbe('0x4d')]=qs[_0x2dbe('0x38')](_0x3d632a[_0x2dbe('0x31')][_0x2dbe('0x38')]);_0x5800db['where']=qs[_0x2dbe('0x3a')](_[_0x2dbe('0x3b')](_0x3d632a[_0x2dbe('0x31')],_0x38c6e7['filters']));if(_0x3d632a[_0x2dbe('0x31')][_0x2dbe('0x3c')]){_0x5800db['where']=_[_0x2dbe('0x3d')](_0x5800db['where'],{'$or':_['map'](_0x5800db[_0x2dbe('0x34')],function(_0x47c3ec){var _0x871321={};_0x871321[_0x47c3ec]={'$like':'%'+_0x3d632a['query'][_0x2dbe('0x3c')]+'%'};return _0x871321;})});}_0x5800db=_['merge']({},_0x5800db,_0x3d632a[_0x2dbe('0x3e')]);return _0x37e926[_0x2dbe('0x4e')](_0x5800db);}})[_0x2dbe('0x26')](function(_0x300571){if(_0x300571){_0x4e031e=_0x300571[_0x2dbe('0x36')];if(!_0x3d632a[_0x2dbe('0x31')][_0x2dbe('0x4f')](_0x2dbe('0x37'))){_0x5800db[_0x2dbe('0x1f')]=qs[_0x2dbe('0x1f')](_0x3d632a['query'][_0x2dbe('0x1f')]);_0x5800db[_0x2dbe('0x1d')]=qs[_0x2dbe('0x1d')](_0x3d632a[_0x2dbe('0x31')][_0x2dbe('0x1d')]);}return _0x37e926['getConfigurations'](_0x5800db);}})[_0x2dbe('0x26')](function(_0x9ce17e){if(_0x9ce17e){return _0x9ce17e?{'count':_0x4e031e,'rows':_0x9ce17e}:null;}})[_0x2dbe('0x26')](respondWithResult(_0x2331eb,null))[_0x2dbe('0x47')](handleError(_0x2331eb,null));};exports[_0x2dbe('0x50')]=function(_0x5133d0,_0x1e7c8a,_0x28cd62){if(_0x5133d0[_0x2dbe('0x49')]['id']){delete _0x5133d0[_0x2dbe('0x49')]['id'];}return db[_0x2dbe('0x2b')][_0x2dbe('0x4b')]({'where':{'id':_0x5133d0['params']['id']}})[_0x2dbe('0x26')](handleEntityNotFound(_0x1e7c8a,null))['then'](function(_0x192c22){if(_0x192c22){_0x5133d0[_0x2dbe('0x49')][_0x2dbe('0x51')]=_0x192c22['id'];_0x5133d0[_0x2dbe('0x49')][_0x2dbe('0x52')]=integrations['getSubjects'](_0x5133d0[_0x2dbe('0x49')]['channel'],_0x5133d0['body'][_0x2dbe('0x2e')]);_0x5133d0[_0x2dbe('0x49')][_0x2dbe('0x53')]=integrations[_0x2dbe('0x54')](_0x5133d0['body'][_0x2dbe('0x55')],_0x5133d0[_0x2dbe('0x49')][_0x2dbe('0x2e')]);return db[_0x2dbe('0x4c')][_0x2dbe('0x48')](_0x5133d0[_0x2dbe('0x49')],{'include':[{'model':db['FreshsalesField'],'as':_0x2dbe('0x52')},{'model':db[_0x2dbe('0x56')],'as':_0x2dbe('0x53')}]});}return null;})[_0x2dbe('0x26')](respondWithResult(_0x1e7c8a,null))[_0x2dbe('0x47')](handleError(_0x1e7c8a,null));};exports[_0x2dbe('0x57')]=function(_0x4d32f3,_0x151800,_0x413e90){var _0x3ad991='';var _0x29046f='';return db[_0x2dbe('0x2b')][_0x2dbe('0x4b')]({'where':{'id':_0x4d32f3[_0x2dbe('0x45')]['id']},'attributes':['id',_0x2dbe('0x58'),_0x2dbe('0x59'),_0x2dbe('0x5a')]})[_0x2dbe('0x26')](handleEntityNotFound(_0x151800,null))['then'](function(_0x180f40){if(_0x180f40){_0x29046f=_0x180f40[_0x2dbe('0x58')];_0x3ad991=_0x180f40[_0x2dbe('0x59')];var _0x273332=_0x180f40['remoteUri'][_0x2dbe('0x5b')](-0x1);if(_0x273332==='/'){_0x3ad991=_0x3ad991[_0x2dbe('0x5c')](0x0,_0x3ad991['lastIndexOf'](_0x273332));}return rp({'method':_0x2dbe('0x5d'),'uri':util[_0x2dbe('0x5e')](_0x2dbe('0x5f'),_0x3ad991,_0x2dbe('0x60')),'headers':{'Authorization':_0x2dbe('0x61')+_0x180f40['apiKey']},'json':!![]});}})[_0x2dbe('0x26')](function(_0x111459){if(_0x111459){var _0x31af47=_0x111459[_0x2dbe('0x62')];var _0x41cbee=![];var _0x49d1fc=null;for(_0x49d1fc=0x0;_0x49d1fc<_0x31af47[_0x2dbe('0x36')];_0x49d1fc++){if(_0x31af47[_0x49d1fc]['email']===_0x29046f){_0x41cbee=!![];}}if(_0x41cbee){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2dbe('0x63')});}}})[_0x2dbe('0x26')](respondWithResult(_0x151800,null))['catch'](function(_0x3c9361){var _0x53ed29=_0x4d32f3[_0x2dbe('0x31')][_0x2dbe('0x64')]?0x1f4:_0x3c9361['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x2dbe('0x57'),_0x53ed29,JSON[_0x2dbe('0x65')](_0x3c9361));delete _0x3c9361['name'];if(_0x53ed29===0x191){_0x53ed29=0x190;}_0x151800[_0x2dbe('0x1b')](_0x53ed29)['send'](_0x4d32f3[_0x2dbe('0x31')][_0x2dbe('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x3c9361[_0x2dbe('0x66')]}:_0x3c9361);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index e49b490..96df69a 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 _0x47c5=['rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4fd0d1,_0x52cc20){var _0x536632=function(_0x6565d8){while(--_0x6565d8){_0x4fd0d1['push'](_0x4fd0d1['shift']());}};_0x536632(++_0x52cc20);}(_0x47c5,0x165));var _0x547c=function(_0x4cefee,_0xabb91e){_0x4cefee=_0x4cefee-0x0;var _0x473af2=_0x47c5[_0x4cefee];return _0x473af2;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var logger=require(_0x547c('0x2'))(_0x547c('0x3'));var moment=require(_0x547c('0x4'));var BPromise=require(_0x547c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x547c('0x6'));var rimraf=require(_0x547c('0x7'));var config=require('../../config/environment');var attributes=require(_0x547c('0x8'));var integrations=require(_0x547c('0x9'));module['exports']=function(_0x2e5b57,_0x439f25){return _0x2e5b57[_0x547c('0xa')](_0x547c('0xb'),attributes,{'tableName':_0x547c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57ca=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x57ca,0x108));var _0xa57c=function(_0x16dc7e,_0x32c6bd){_0x16dc7e=_0x16dc7e-0x0;var _0x24d5ca=_0x57ca[_0x16dc7e];return _0x24d5ca;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));var integrations=require(_0xa57c('0x8'));module[_0xa57c('0x9')]=function(_0x19473f,_0xbdfffb){return _0x19473f[_0xa57c('0xa')](_0xa57c('0xb'),attributes,{'tableName':_0xa57c('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 9a95186..377e213 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 _0x1261=['FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','options','raw','limit','include','map','model','attributes','stringify','ShowFreshsalesAccount','FreshsalesAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x42e5a4,_0x3c2733){var _0x4f35d4=function(_0x14e09f){while(--_0x14e09f){_0x42e5a4['push'](_0x42e5a4['shift']());}};_0x4f35d4(++_0x3c2733);}(_0x1261,0x144));var _0x1126=function(_0x54514c,_0xf1c84a){_0x54514c=_0x54514c-0x0;var _0x5cd80e=_0x1261[_0x54514c];return _0x5cd80e;};'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')]('FreshsalesAccount,\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['FreshsalesAccount']['findAll']({'raw':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')]['where']||null:null,'attributes':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options']['attributes']||null:null,'limit':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49[_0x1126('0x16')][_0x1126('0x18')]||null:null,'include':_0x4a7b49[_0x1126('0x16')]?_0x4a7b49['options'][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x4a7b49['options'][_0x1126('0x19')],function(_0x59cd8e){return{'model':db[_0x59cd8e['model']],'as':_0x59cd8e['as'],'attributes':_0x59cd8e['attributes'],'include':_0x59cd8e[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x59cd8e[_0x1126('0x19')],function(_0x34bcf1){return{'model':db[_0x34bcf1[_0x1126('0x1b')]],'as':_0x34bcf1['as'],'attributes':_0x34bcf1[_0x1126('0x1c')],'include':_0x34bcf1[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x34bcf1['include'],function(_0x35eec3){return{'model':db[_0x35eec3[_0x1126('0x1b')]],'as':_0x35eec3['as'],'attributes':_0x35eec3[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541bc9){logger[_0x1126('0xd')](_0x1126('0x15'),_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x1d')](_0x541bc9));_0x22ae0b(_0x541bc9);})['catch'](function(_0x3fa694){logger['error'](_0x1126('0x15'),_0x3fa694['message'],_0x4a7b49);_0x2b2487(_0x4d2b38[_0x1126('0x11')](0x1f4,_0x3fa694['message']));});});};exports[_0x1126('0x1e')]=function(_0x5f2611){var _0x5252e0=this;return new Promise(function(_0x4a53ab,_0x17646e){return db[_0x1126('0x1f')][_0x1126('0x20')]({'raw':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x17')]===undefined?!![]:![]:!![],'where':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x21')]||null:null,'attributes':_0x5f2611[_0x1126('0x16')]?_0x5f2611[_0x1126('0x16')]['attributes']||null:null,'include':_0x5f2611['options']?_0x5f2611[_0x1126('0x16')][_0x1126('0x19')]?_[_0x1126('0x1a')](_0x5f2611[_0x1126('0x16')]['include'],function(_0x145314){return{'model':db[_0x145314[_0x1126('0x1b')]],'as':_0x145314['as'],'attributes':_0x145314[_0x1126('0x1c')],'include':_0x145314[_0x1126('0x19')]?_[_0x1126('0x1a')](_0x145314['include'],function(_0x2a0dfe){return{'model':db[_0x2a0dfe[_0x1126('0x1b')]],'as':_0x2a0dfe['as'],'attributes':_0x2a0dfe[_0x1126('0x1c')],'include':_0x2a0dfe[_0x1126('0x19')]?_['map'](_0x2a0dfe['include'],function(_0x22827a){return{'model':db[_0x22827a[_0x1126('0x1b')]],'as':_0x22827a['as'],'attributes':_0x22827a['attributes']};}):[]};}):[]};}):[]:[]})[_0x1126('0xc')](function(_0xf3c21b){logger[_0x1126('0xd')]('ShowFreshsalesAccount',_0x5f2611);logger['debug'](_0x1126('0x1e'),_0x5f2611,JSON[_0x1126('0x1d')](_0xf3c21b));_0x4a53ab(_0xf3c21b);})[_0x1126('0x14')](function(_0x156554){logger['error'](_0x1126('0x1e'),_0x156554['message'],_0x5f2611);_0x17646e(_0x5252e0[_0x1126('0x11')](0x1f4,_0x156554[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0x4c60=['ShowFreshsalesAccount','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','map','include','model','find','raw'];(function(_0x78e522,_0x37c539){var _0x4a170d=function(_0x2ef664){while(--_0x2ef664){_0x78e522['push'](_0x78e522['shift']());}};_0x4a170d(++_0x37c539);}(_0x4c60,0xc1));var _0x04c6=function(_0x240a73,_0xdac4a2){_0x240a73=_0x240a73-0x0;var _0x1acaf0=_0x4c60[_0x240a73];return _0x1acaf0;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});}exports[_0x04c6('0x14')]=function(_0x21674a){var _0x423ea9=this;return new Promise(function(_0x47f400,_0x142065){return db[_0x04c6('0x15')][_0x04c6('0x16')]({'raw':_0x21674a['options']?_0x21674a['options']['raw']===undefined?!![]:![]:!![],'where':_0x21674a[_0x04c6('0x17')]?_0x21674a[_0x04c6('0x17')]['where']||null:null,'attributes':_0x21674a['options']?_0x21674a[_0x04c6('0x17')][_0x04c6('0x18')]||null:null,'limit':_0x21674a[_0x04c6('0x17')]?_0x21674a['options'][_0x04c6('0x19')]||null:null,'include':_0x21674a[_0x04c6('0x17')]?_0x21674a[_0x04c6('0x17')]['include']?_[_0x04c6('0x1a')](_0x21674a[_0x04c6('0x17')]['include'],function(_0x54a8b0){return{'model':db[_0x54a8b0['model']],'as':_0x54a8b0['as'],'attributes':_0x54a8b0[_0x04c6('0x18')],'include':_0x54a8b0[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x54a8b0[_0x04c6('0x1b')],function(_0x3e1328){return{'model':db[_0x3e1328['model']],'as':_0x3e1328['as'],'attributes':_0x3e1328['attributes'],'include':_0x3e1328[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x3e1328[_0x04c6('0x1b')],function(_0x3233d7){return{'model':db[_0x3233d7[_0x04c6('0x1c')]],'as':_0x3233d7['as'],'attributes':_0x3233d7[_0x04c6('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d0d3f){logger[_0x04c6('0x12')]('GetFreshsalesAccount',_0x21674a);logger[_0x04c6('0xb')](_0x04c6('0x14'),_0x21674a,JSON['stringify'](_0x1d0d3f));_0x47f400(_0x1d0d3f);})['catch'](function(_0x115d84){logger[_0x04c6('0xe')](_0x04c6('0x14'),_0x115d84[_0x04c6('0x11')],_0x21674a);_0x142065(_0x423ea9[_0x04c6('0xe')](0x1f4,_0x115d84[_0x04c6('0x11')]));});});};exports['ShowFreshsalesAccount']=function(_0x5d8c88){var _0x4fd842=this;return new Promise(function(_0x375a03,_0x5241b5){return db[_0x04c6('0x15')][_0x04c6('0x1d')]({'raw':_0x5d8c88['options']?_0x5d8c88[_0x04c6('0x17')][_0x04c6('0x1e')]===undefined?!![]:![]:!![],'where':_0x5d8c88[_0x04c6('0x17')]?_0x5d8c88[_0x04c6('0x17')]['where']||null:null,'attributes':_0x5d8c88[_0x04c6('0x17')]?_0x5d8c88[_0x04c6('0x17')][_0x04c6('0x18')]||null:null,'include':_0x5d8c88[_0x04c6('0x17')]?_0x5d8c88[_0x04c6('0x17')][_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x5d8c88[_0x04c6('0x17')][_0x04c6('0x1b')],function(_0xca0b8f){return{'model':db[_0xca0b8f[_0x04c6('0x1c')]],'as':_0xca0b8f['as'],'attributes':_0xca0b8f[_0x04c6('0x18')],'include':_0xca0b8f[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0xca0b8f[_0x04c6('0x1b')],function(_0x5bb584){return{'model':db[_0x5bb584[_0x04c6('0x1c')]],'as':_0x5bb584['as'],'attributes':_0x5bb584[_0x04c6('0x18')],'include':_0x5bb584[_0x04c6('0x1b')]?_[_0x04c6('0x1a')](_0x5bb584['include'],function(_0x181736){return{'model':db[_0x181736[_0x04c6('0x1c')]],'as':_0x181736['as'],'attributes':_0x181736['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4aac49){logger[_0x04c6('0x12')](_0x04c6('0x1f'),_0x5d8c88);logger['debug'](_0x04c6('0x1f'),_0x5d8c88,JSON['stringify'](_0x4aac49));_0x375a03(_0x4aac49);})[_0x04c6('0x13')](function(_0x1373ca){logger[_0x04c6('0xe')](_0x04c6('0x1f'),_0x1373ca['message'],_0x5d8c88);_0x5241b5(_0x4fd842['error'](0x1f4,_0x1373ca[_0x04c6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 2667c1d..d1c7887 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 _0x7a56=['/:id/fields','getFields','post','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x50e21b,_0x37398e){var _0x44018e=function(_0x26f792){while(--_0x26f792){_0x50e21b['push'](_0x50e21b['shift']());}};_0x44018e(++_0x37398e);}(_0x7a56,0x187));var _0x67a5=function(_0x339fdd,_0x433dbf){_0x339fdd=_0x339fdd-0x0;var _0x1d87e2=_0x7a56[_0x339fdd];return _0x1d87e2;};'use strict';var multer=require(_0x67a5('0x0'));var util=require('util');var path=require(_0x67a5('0x1'));var timeout=require(_0x67a5('0x2'));var express=require(_0x67a5('0x3'));var router=express['Router']();var fs_extra=require(_0x67a5('0x4'));var auth=require(_0x67a5('0x5'));var interaction=require(_0x67a5('0x6'));var config=require(_0x67a5('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x67a5('0x8')](),controller[_0x67a5('0x9')]);router[_0x67a5('0xa')](_0x67a5('0xb'),auth[_0x67a5('0x8')](),controller[_0x67a5('0xc')]);router[_0x67a5('0xa')](_0x67a5('0xd'),auth[_0x67a5('0x8')](),controller[_0x67a5('0xe')]);router[_0x67a5('0xa')](_0x67a5('0xf'),auth[_0x67a5('0x8')](),controller[_0x67a5('0x10')]);router[_0x67a5('0xa')](_0x67a5('0x11'),auth[_0x67a5('0x8')](),controller[_0x67a5('0x12')]);router[_0x67a5('0x13')]('/',auth[_0x67a5('0x8')](),controller[_0x67a5('0x14')]);router[_0x67a5('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x67a5('0x16')](_0x67a5('0xb'),auth[_0x67a5('0x8')](),controller['destroy']);module[_0x67a5('0x17')]=router; \ No newline at end of file +var _0xea64=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports'];(function(_0x6e09e6,_0x3efe39){var _0x29de4b=function(_0x315c93){while(--_0x315c93){_0x6e09e6['push'](_0x6e09e6['shift']());}};_0x29de4b(++_0x3efe39);}(_0xea64,0xfd));var _0x4ea6=function(_0xe77e78,_0x36e801){_0xe77e78=_0xe77e78-0x0;var _0x230c88=_0xea64[_0xe77e78];return _0x230c88;};'use strict';var multer=require(_0x4ea6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4ea6('0x1'));var express=require(_0x4ea6('0x2'));var router=express[_0x4ea6('0x3')]();var fs_extra=require(_0x4ea6('0x4'));var auth=require(_0x4ea6('0x5'));var interaction=require(_0x4ea6('0x6'));var config=require(_0x4ea6('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x4ea6('0x8')](),controller['index']);router[_0x4ea6('0x9')](_0x4ea6('0xa'),auth['isAuthenticated'](),controller[_0x4ea6('0xb')]);router[_0x4ea6('0x9')]('/:id/subjects',auth[_0x4ea6('0x8')](),controller[_0x4ea6('0xc')]);router[_0x4ea6('0x9')](_0x4ea6('0xd'),auth[_0x4ea6('0x8')](),controller[_0x4ea6('0xe')]);router[_0x4ea6('0x9')](_0x4ea6('0xf'),auth[_0x4ea6('0x8')](),controller[_0x4ea6('0x10')]);router[_0x4ea6('0x11')]('/',auth['isAuthenticated'](),controller[_0x4ea6('0x12')]);router[_0x4ea6('0x13')](_0x4ea6('0xa'),auth[_0x4ea6('0x8')](),controller['update']);router[_0x4ea6('0x14')](_0x4ea6('0xa'),auth[_0x4ea6('0x8')](),controller[_0x4ea6('0x15')]);module[_0x4ea6('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 42ce9c0..a6fa7ca 100644 --- a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js +++ b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb477=['STRING','sequelize','exports'];(function(_0x2d4b0a,_0x5147ba){var _0xe59a7a=function(_0x18b7d0){while(--_0x18b7d0){_0x2d4b0a['push'](_0x2d4b0a['shift']());}};_0xe59a7a(++_0x5147ba);}(_0xb477,0xaf));var _0x7b47=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xb477[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x7b47('0x0'));module[_0x7b47('0x1')]={'name':{'type':Sequelize[_0x7b47('0x2')]},'description':{'type':Sequelize[_0x7b47('0x2')]}}; \ No newline at end of file +var _0x60fa=['exports','STRING','sequelize'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x60fa,0x1b8));var _0xa60f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60fa[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xa60f('0x0'));module[_0xa60f('0x1')]={'name':{'type':Sequelize[_0xa60f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0badd9f..c6e933d 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 _0x7e61=['to-csv','querystring','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','undefined','limit','count','offset','set','Content-Range','update','then','error','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','intersection','find','create','body','params','getSubjects','findOne','merge','nolimit','FreshsalesField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7e61,0xe0));var _0x17e6=function(_0xc28fbf,_0x4c7009){_0xc28fbf=_0xc28fbf-0x0;var _0x42c598=_0x7e61[_0xc28fbf];return _0x42c598;};'use strict';var emlformat=require(_0x17e6('0x0'));var rimraf=require(_0x17e6('0x1'));var zipdir=require(_0x17e6('0x2'));var jsonpatch=require(_0x17e6('0x3'));var rp=require(_0x17e6('0x4'));var moment=require(_0x17e6('0x5'));var BPromise=require(_0x17e6('0x6'));var Mustache=require(_0x17e6('0x7'));var util=require('util');var path=require(_0x17e6('0x8'));var sox=require(_0x17e6('0x9'));var csv=require('to-csv');var ejs=require(_0x17e6('0xa'));var fs=require('fs');var fs_extra=require(_0x17e6('0xb'));var _=require('lodash');var squel=require(_0x17e6('0xc'));var crypto=require(_0x17e6('0xd'));var jsforce=require(_0x17e6('0xe'));var deskjs=require(_0x17e6('0xf'));var toCsv=require(_0x17e6('0x10'));var querystring=require(_0x17e6('0x11'));var Papa=require('papaparse');var Redis=require(_0x17e6('0x12'));var authService=require(_0x17e6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x17e6('0x14'));var hardwareService=require(_0x17e6('0x15'));var logger=require(_0x17e6('0x16'))(_0x17e6('0x17'));var utils=require(_0x17e6('0x18'));var config=require(_0x17e6('0x19'));var licenseUtil=require(_0x17e6('0x1a'));var db=require(_0x17e6('0x1b'))['db'];function respondWithStatusCode(_0x536978,_0x57be86){_0x57be86=_0x57be86||0xcc;return function(_0x392b3b){if(_0x392b3b){return _0x536978[_0x17e6('0x1c')](_0x57be86);}return _0x536978['status'](_0x57be86)[_0x17e6('0x1d')]();};}function respondWithResult(_0x1bb51a,_0x406163){_0x406163=_0x406163||0xc8;return function(_0x1a7f41){if(_0x1a7f41){return _0x1bb51a[_0x17e6('0x1e')](_0x406163)[_0x17e6('0x1f')](_0x1a7f41);}};}function respondWithFilteredResult(_0x4f1b78,_0x135362){return function(_0x316046){if(_0x316046){var _0x5cc525=typeof _0x135362['offset']===_0x17e6('0x20')&&typeof _0x135362[_0x17e6('0x21')]===_0x17e6('0x20');var _0x1cd4f2=_0x316046['count'];var _0x35688f=_0x5cc525?0x0:_0x135362['offset'];var _0x21abae=_0x5cc525?_0x316046[_0x17e6('0x22')]:_0x135362[_0x17e6('0x23')]+_0x135362[_0x17e6('0x21')];var _0x51518d;if(_0x21abae>=_0x1cd4f2){_0x21abae=_0x1cd4f2;_0x51518d=0xc8;}else{_0x51518d=0xce;}_0x4f1b78[_0x17e6('0x1e')](_0x51518d);return _0x4f1b78[_0x17e6('0x24')](_0x17e6('0x25'),_0x35688f+'-'+_0x21abae+'/'+_0x1cd4f2)['json'](_0x316046);}return null;};}function patchUpdates(_0x2478e2){return function(_0x11c9fc){try{jsonpatch['apply'](_0x11c9fc,_0x2478e2,!![]);}catch(_0x220b26){return BPromise['reject'](_0x220b26);}return _0x11c9fc['save']();};}function saveUpdates(_0xdf7bae,_0x4de478){return function(_0x93a6ee){if(_0x93a6ee){return _0x93a6ee[_0x17e6('0x26')](_0xdf7bae)['then'](function(_0x16ba34){return _0x16ba34;});}return null;};}function removeEntity(_0x5844b5,_0x38ef3d){return function(_0x3ea041){if(_0x3ea041){return _0x3ea041['destroy']()[_0x17e6('0x27')](function(){_0x5844b5[_0x17e6('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8479,_0xe92287){return function(_0x147ad7){if(!_0x147ad7){_0x4b8479[_0x17e6('0x1c')](0x194);}return _0x147ad7;};}function handleError(_0x6d5383,_0x2cfef6){_0x2cfef6=_0x2cfef6||0x1f4;return function(_0x39d18f){logger[_0x17e6('0x28')](_0x39d18f['stack']);if(_0x39d18f['name']){delete _0x39d18f[_0x17e6('0x29')];}_0x6d5383[_0x17e6('0x1e')](_0x2cfef6)[_0x17e6('0x2a')](_0x39d18f);};}exports[_0x17e6('0x2b')]=function(_0x26ffde,_0x559f39){var _0x5e70ab={},_0x17929c={},_0x5ad1f6={'count':0x0,'rows':[]};var _0x5c5f8c=_['map'](db[_0x17e6('0x2c')][_0x17e6('0x2d')],function(_0x114570){return{'name':_0x114570[_0x17e6('0x2e')],'type':_0x114570[_0x17e6('0x2f')][_0x17e6('0x30')]};});_0x17929c[_0x17e6('0x31')]=_[_0x17e6('0x32')](_0x5c5f8c,_0x17e6('0x29'));_0x17929c[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x26ffde[_0x17e6('0x33')]);_0x17929c[_0x17e6('0x35')]=_['intersection'](_0x17929c['model'],_0x17929c['query']);_0x5e70ab[_0x17e6('0x36')]=_['intersection'](_0x17929c[_0x17e6('0x31')],qs['fields'](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x37')]));_0x5e70ab[_0x17e6('0x36')]=_0x5e70ab[_0x17e6('0x36')][_0x17e6('0x38')]?_0x5e70ab['attributes']:_0x17929c[_0x17e6('0x31')];if(!_0x26ffde[_0x17e6('0x33')][_0x17e6('0x39')]('nolimit')){_0x5e70ab['limit']=qs[_0x17e6('0x21')](_0x26ffde[_0x17e6('0x33')]['limit']);_0x5e70ab['offset']=qs[_0x17e6('0x23')](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x23')]);}_0x5e70ab[_0x17e6('0x3a')]=qs[_0x17e6('0x3b')](_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3b')]);_0x5e70ab[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x26ffde[_0x17e6('0x33')],_0x17929c[_0x17e6('0x35')]),_0x5c5f8c);if(_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x5e70ab['where']=_['merge'](_0x5e70ab[_0x17e6('0x3c')],{'$or':_[_0x17e6('0x32')](_0x5c5f8c,function(_0x5b7428){if(_0x5b7428[_0x17e6('0x2f')]!=='VIRTUAL'){var _0x194c72={};_0x194c72[_0x5b7428['name']]={'$like':'%'+_0x26ffde[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x194c72;}})});}_0x5e70ab=_['merge']({},_0x5e70ab,_0x26ffde[_0x17e6('0x3f')]);var _0x4bd819={'where':_0x5e70ab[_0x17e6('0x3c')]};return db[_0x17e6('0x2c')][_0x17e6('0x22')](_0x4bd819)['then'](function(_0x3c5846){_0x5ad1f6[_0x17e6('0x22')]=_0x3c5846;if(_0x26ffde[_0x17e6('0x33')][_0x17e6('0x40')]){_0x5e70ab[_0x17e6('0x41')]=[{'all':!![]}];}return db[_0x17e6('0x2c')][_0x17e6('0x42')](_0x5e70ab);})[_0x17e6('0x27')](function(_0x4d5a85){_0x5ad1f6[_0x17e6('0x43')]=_0x4d5a85;return _0x5ad1f6;})[_0x17e6('0x27')](respondWithFilteredResult(_0x559f39,_0x5e70ab))[_0x17e6('0x44')](handleError(_0x559f39,null));};exports['show']=function(_0x134db8,_0x570b8f){var _0xd27b6e={'raw':![],'where':{'id':_0x134db8['params']['id']}},_0x21d14a={};_0x21d14a['model']=_[_0x17e6('0x34')](db[_0x17e6('0x2c')][_0x17e6('0x2d')]);_0x21d14a[_0x17e6('0x33')]=_['keys'](_0x134db8['query']);_0x21d14a[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x21d14a[_0x17e6('0x31')],_0x21d14a['query']);_0xd27b6e['attributes']=_[_0x17e6('0x45')](_0x21d14a[_0x17e6('0x31')],qs[_0x17e6('0x37')](_0x134db8[_0x17e6('0x33')][_0x17e6('0x37')]));_0xd27b6e[_0x17e6('0x36')]=_0xd27b6e[_0x17e6('0x36')][_0x17e6('0x38')]?_0xd27b6e[_0x17e6('0x36')]:_0x21d14a['model'];if(_0x134db8['query'][_0x17e6('0x40')]){_0xd27b6e[_0x17e6('0x41')]=[{'all':!![]}];}_0xd27b6e=_['merge']({},_0xd27b6e,_0x134db8[_0x17e6('0x3f')]);return db[_0x17e6('0x2c')][_0x17e6('0x46')](_0xd27b6e)[_0x17e6('0x27')](handleEntityNotFound(_0x570b8f,null))[_0x17e6('0x27')](respondWithResult(_0x570b8f,null))[_0x17e6('0x44')](handleError(_0x570b8f,null));};exports[_0x17e6('0x47')]=function(_0x2a659a,_0x4582fd){return db[_0x17e6('0x2c')][_0x17e6('0x47')](_0x2a659a[_0x17e6('0x48')],{})[_0x17e6('0x27')](respondWithResult(_0x4582fd,0xc9))['catch'](handleError(_0x4582fd,null));};exports['update']=function(_0x19deba,_0x20ec4e){if(_0x19deba[_0x17e6('0x48')]['id']){delete _0x19deba['body']['id'];}return db[_0x17e6('0x2c')][_0x17e6('0x46')]({'where':{'id':_0x19deba[_0x17e6('0x49')]['id']}})['then'](handleEntityNotFound(_0x20ec4e,null))[_0x17e6('0x27')](saveUpdates(_0x19deba['body'],null))['then'](respondWithResult(_0x20ec4e,null))['catch'](handleError(_0x20ec4e,null));};exports['destroy']=function(_0x1afef7,_0x25e4ce){return db[_0x17e6('0x2c')]['find']({'where':{'id':_0x1afef7[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x25e4ce,null))[_0x17e6('0x27')](removeEntity(_0x25e4ce,null))['catch'](handleError(_0x25e4ce,null));};exports[_0x17e6('0x4a')]=function(_0x156b7f,_0x4b8837,_0x1dc7b7){var _0x2e7013={};var _0x1cc31a={};var _0x4cfcb6;var _0x41cc9d;return db['FreshsalesConfiguration'][_0x17e6('0x4b')]({'where':{'id':_0x156b7f[_0x17e6('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b8837,null))[_0x17e6('0x27')](function(_0x45a02b){if(_0x45a02b){_0x4cfcb6=_0x45a02b;_0x1cc31a[_0x17e6('0x31')]=_[_0x17e6('0x34')](db['FreshsalesField']['rawAttributes']);_0x1cc31a[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x156b7f['query']);_0x1cc31a[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x1cc31a[_0x17e6('0x31')],_0x1cc31a[_0x17e6('0x33')]);_0x2e7013['attributes']=_[_0x17e6('0x45')](_0x1cc31a['model'],qs[_0x17e6('0x37')](_0x156b7f[_0x17e6('0x33')]['fields']));_0x2e7013[_0x17e6('0x36')]=_0x2e7013[_0x17e6('0x36')][_0x17e6('0x38')]?_0x2e7013[_0x17e6('0x36')]:_0x1cc31a[_0x17e6('0x31')];_0x2e7013['order']=qs[_0x17e6('0x3b')](_0x156b7f['query']['sort']);_0x2e7013[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x156b7f[_0x17e6('0x33')],_0x1cc31a[_0x17e6('0x35')]));if(_0x156b7f[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x2e7013[_0x17e6('0x3c')]=_['merge'](_0x2e7013[_0x17e6('0x3c')],{'$or':_[_0x17e6('0x32')](_0x2e7013[_0x17e6('0x36')],function(_0x56edfd){var _0xae855e={};_0xae855e[_0x56edfd]={'$like':'%'+_0x156b7f['query']['filter']+'%'};return _0xae855e;})});}_0x2e7013=_[_0x17e6('0x4c')]({},_0x2e7013,_0x156b7f[_0x17e6('0x3f')]);return _0x4cfcb6[_0x17e6('0x4a')](_0x2e7013);}})[_0x17e6('0x27')](function(_0x566c46){if(_0x566c46){_0x41cc9d=_0x566c46['length'];if(!_0x156b7f['query']['hasOwnProperty'](_0x17e6('0x4d'))){_0x2e7013[_0x17e6('0x21')]=qs[_0x17e6('0x21')](_0x156b7f[_0x17e6('0x33')][_0x17e6('0x21')]);_0x2e7013[_0x17e6('0x23')]=qs['offset'](_0x156b7f[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0x4cfcb6[_0x17e6('0x4a')](_0x2e7013);}})[_0x17e6('0x27')](function(_0x181d4c){if(_0x181d4c){return _0x181d4c?{'count':_0x41cc9d,'rows':_0x181d4c}:null;}})['then'](respondWithResult(_0x4b8837,null))[_0x17e6('0x44')](handleError(_0x4b8837,null));};exports['getDescriptions']=function(_0x5c9033,_0x4db5ca,_0x1ed930){var _0x4c0adf={};var _0x3c139b={};var _0xad7e2;var _0x2fd61e;return db[_0x17e6('0x2c')][_0x17e6('0x4b')]({'where':{'id':_0x5c9033[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x4db5ca,null))[_0x17e6('0x27')](function(_0xd0f6d1){if(_0xd0f6d1){_0xad7e2=_0xd0f6d1;_0x3c139b[_0x17e6('0x31')]=_['keys'](db[_0x17e6('0x4e')][_0x17e6('0x2d')]);_0x3c139b[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x5c9033[_0x17e6('0x33')]);_0x3c139b[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x3c139b[_0x17e6('0x31')],_0x3c139b['query']);_0x4c0adf['attributes']=_['intersection'](_0x3c139b[_0x17e6('0x31')],qs[_0x17e6('0x37')](_0x5c9033['query']['fields']));_0x4c0adf[_0x17e6('0x36')]=_0x4c0adf[_0x17e6('0x36')]['length']?_0x4c0adf[_0x17e6('0x36')]:_0x3c139b[_0x17e6('0x31')];_0x4c0adf[_0x17e6('0x3a')]=qs[_0x17e6('0x3b')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3b')]);_0x4c0adf[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x5c9033['query'],_0x3c139b[_0x17e6('0x35')]));if(_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3e')]){_0x4c0adf[_0x17e6('0x3c')]=_[_0x17e6('0x4c')](_0x4c0adf['where'],{'$or':_[_0x17e6('0x32')](_0x4c0adf[_0x17e6('0x36')],function(_0x4381f3){var _0x4f0617={};_0x4f0617[_0x4381f3]={'$like':'%'+_0x5c9033[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x4f0617;})});}_0x4c0adf=_[_0x17e6('0x4c')]({},_0x4c0adf,_0x5c9033[_0x17e6('0x3f')]);return _0xad7e2['getDescriptions'](_0x4c0adf);}})[_0x17e6('0x27')](function(_0x1d5099){if(_0x1d5099){_0x2fd61e=_0x1d5099[_0x17e6('0x38')];if(!_0x5c9033[_0x17e6('0x33')][_0x17e6('0x39')]('nolimit')){_0x4c0adf[_0x17e6('0x21')]=qs[_0x17e6('0x21')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x21')]);_0x4c0adf[_0x17e6('0x23')]=qs[_0x17e6('0x23')](_0x5c9033[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0xad7e2[_0x17e6('0x4f')](_0x4c0adf);}})['then'](function(_0x7751ee){if(_0x7751ee){return _0x7751ee?{'count':_0x2fd61e,'rows':_0x7751ee}:null;}})[_0x17e6('0x27')](respondWithResult(_0x4db5ca,null))[_0x17e6('0x44')](handleError(_0x4db5ca,null));};exports['getFields']=function(_0x11b308,_0x24c4dc,_0x3bf041){var _0x39d1b1={};var _0x4f7f26={};var _0x44f0a1;var _0x298b36;return db[_0x17e6('0x2c')]['findOne']({'where':{'id':_0x11b308[_0x17e6('0x49')]['id']}})[_0x17e6('0x27')](handleEntityNotFound(_0x24c4dc,null))[_0x17e6('0x27')](function(_0xbbb97f){if(_0xbbb97f){_0x44f0a1=_0xbbb97f;_0x4f7f26[_0x17e6('0x31')]=_[_0x17e6('0x34')](db[_0x17e6('0x4e')][_0x17e6('0x2d')]);_0x4f7f26[_0x17e6('0x33')]=_[_0x17e6('0x34')](_0x11b308[_0x17e6('0x33')]);_0x4f7f26[_0x17e6('0x35')]=_[_0x17e6('0x45')](_0x4f7f26['model'],_0x4f7f26[_0x17e6('0x33')]);_0x39d1b1['attributes']=_['intersection'](_0x4f7f26['model'],qs[_0x17e6('0x37')](_0x11b308[_0x17e6('0x33')][_0x17e6('0x37')]));_0x39d1b1[_0x17e6('0x36')]=_0x39d1b1[_0x17e6('0x36')]['length']?_0x39d1b1[_0x17e6('0x36')]:_0x4f7f26[_0x17e6('0x31')];_0x39d1b1[_0x17e6('0x3a')]=qs['sort'](_0x11b308['query'][_0x17e6('0x3b')]);_0x39d1b1[_0x17e6('0x3c')]=qs[_0x17e6('0x35')](_[_0x17e6('0x3d')](_0x11b308[_0x17e6('0x33')],_0x4f7f26[_0x17e6('0x35')]));if(_0x11b308['query'][_0x17e6('0x3e')]){_0x39d1b1[_0x17e6('0x3c')]=_['merge'](_0x39d1b1['where'],{'$or':_[_0x17e6('0x32')](_0x39d1b1[_0x17e6('0x36')],function(_0x4f85a3){var _0x340345={};_0x340345[_0x4f85a3]={'$like':'%'+_0x11b308[_0x17e6('0x33')][_0x17e6('0x3e')]+'%'};return _0x340345;})});}_0x39d1b1=_[_0x17e6('0x4c')]({},_0x39d1b1,_0x11b308['options']);return _0x44f0a1['getFields'](_0x39d1b1);}})['then'](function(_0x370845){if(_0x370845){_0x298b36=_0x370845[_0x17e6('0x38')];if(!_0x11b308[_0x17e6('0x33')][_0x17e6('0x39')](_0x17e6('0x4d'))){_0x39d1b1['limit']=qs['limit'](_0x11b308['query'][_0x17e6('0x21')]);_0x39d1b1[_0x17e6('0x23')]=qs[_0x17e6('0x23')](_0x11b308[_0x17e6('0x33')][_0x17e6('0x23')]);}return _0x44f0a1['getFields'](_0x39d1b1);}})[_0x17e6('0x27')](function(_0x2f4253){if(_0x2f4253){return _0x2f4253?{'count':_0x298b36,'rows':_0x2f4253}:null;}})[_0x17e6('0x27')](respondWithResult(_0x24c4dc,null))[_0x17e6('0x44')](handleError(_0x24c4dc,null));}; \ No newline at end of file +var _0x490b=['destroy','error','stack','name','send','index','FreshsalesConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshsalesField','filter','getSubjects','getDescriptions','getFields','rawAttributes','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','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','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then'];(function(_0x548e77,_0x36afcb){var _0x5d2427=function(_0xb73bdf){while(--_0xb73bdf){_0x548e77['push'](_0x548e77['shift']());}};_0x5d2427(++_0x36afcb);}(_0x490b,0x1cb));var _0xb490=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x490b[_0x2f6541];return _0x4d76d8;};'use strict';var emlformat=require(_0xb490('0x0'));var rimraf=require(_0xb490('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb490('0x2'));var rp=require(_0xb490('0x3'));var moment=require(_0xb490('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb490('0x5'));var util=require(_0xb490('0x6'));var path=require(_0xb490('0x7'));var sox=require(_0xb490('0x8'));var csv=require(_0xb490('0x9'));var ejs=require(_0xb490('0xa'));var fs=require('fs');var fs_extra=require(_0xb490('0xb'));var _=require(_0xb490('0xc'));var squel=require(_0xb490('0xd'));var crypto=require(_0xb490('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb490('0xf'));var toCsv=require(_0xb490('0x9'));var querystring=require(_0xb490('0x10'));var Papa=require('papaparse');var Redis=require(_0xb490('0x11'));var authService=require(_0xb490('0x12'));var qs=require(_0xb490('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb490('0x14'));var logger=require(_0xb490('0x15'))(_0xb490('0x16'));var utils=require(_0xb490('0x17'));var config=require(_0xb490('0x18'));var licenseUtil=require(_0xb490('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2780e9,_0x85c87b){_0x85c87b=_0x85c87b||0xcc;return function(_0x116753){if(_0x116753){return _0x2780e9['sendStatus'](_0x85c87b);}return _0x2780e9['status'](_0x85c87b)[_0xb490('0x1a')]();};}function respondWithResult(_0x2937f1,_0x4d591f){_0x4d591f=_0x4d591f||0xc8;return function(_0x12c7ee){if(_0x12c7ee){return _0x2937f1[_0xb490('0x1b')](_0x4d591f)[_0xb490('0x1c')](_0x12c7ee);}};}function respondWithFilteredResult(_0x3140b3,_0x364ea7){return function(_0x3c3d68){if(_0x3c3d68){var _0x54134b=typeof _0x364ea7[_0xb490('0x1d')]===_0xb490('0x1e')&&typeof _0x364ea7[_0xb490('0x1f')]===_0xb490('0x1e');var _0x27a853=_0x3c3d68[_0xb490('0x20')];var _0x4b5830=_0x54134b?0x0:_0x364ea7[_0xb490('0x1d')];var _0x2c2d43=_0x54134b?_0x3c3d68[_0xb490('0x20')]:_0x364ea7[_0xb490('0x1d')]+_0x364ea7[_0xb490('0x1f')];var _0x55a6c8;if(_0x2c2d43>=_0x27a853){_0x2c2d43=_0x27a853;_0x55a6c8=0xc8;}else{_0x55a6c8=0xce;}_0x3140b3[_0xb490('0x1b')](_0x55a6c8);return _0x3140b3['set'](_0xb490('0x21'),_0x4b5830+'-'+_0x2c2d43+'/'+_0x27a853)['json'](_0x3c3d68);}return null;};}function patchUpdates(_0x164615){return function(_0x198fed){try{jsonpatch[_0xb490('0x22')](_0x198fed,_0x164615,!![]);}catch(_0x151c2a){return BPromise[_0xb490('0x23')](_0x151c2a);}return _0x198fed[_0xb490('0x24')]();};}function saveUpdates(_0x3f5d87,_0x1fbbc5){return function(_0x426966){if(_0x426966){return _0x426966[_0xb490('0x25')](_0x3f5d87)[_0xb490('0x26')](function(_0x2a1796){return _0x2a1796;});}return null;};}function removeEntity(_0x3d2956,_0x25548c){return function(_0x2686e0){if(_0x2686e0){return _0x2686e0[_0xb490('0x27')]()[_0xb490('0x26')](function(){_0x3d2956['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bfe56,_0x539b44){return function(_0x515d13){if(!_0x515d13){_0x3bfe56['sendStatus'](0x194);}return _0x515d13;};}function handleError(_0x5583eb,_0x14f482){_0x14f482=_0x14f482||0x1f4;return function(_0x1b1dcc){logger[_0xb490('0x28')](_0x1b1dcc[_0xb490('0x29')]);if(_0x1b1dcc[_0xb490('0x2a')]){delete _0x1b1dcc[_0xb490('0x2a')];}_0x5583eb[_0xb490('0x1b')](_0x14f482)[_0xb490('0x2b')](_0x1b1dcc);};}exports[_0xb490('0x2c')]=function(_0x453c37,_0x37328d){var _0x38bb77={},_0x4267a4={},_0x4bed52={'count':0x0,'rows':[]};var _0x39d5d4=_['map'](db[_0xb490('0x2d')]['rawAttributes'],function(_0x2ad198){return{'name':_0x2ad198['fieldName'],'type':_0x2ad198[_0xb490('0x2e')][_0xb490('0x2f')]};});_0x4267a4[_0xb490('0x30')]=_[_0xb490('0x31')](_0x39d5d4,_0xb490('0x2a'));_0x4267a4[_0xb490('0x32')]=_[_0xb490('0x33')](_0x453c37[_0xb490('0x32')]);_0x4267a4[_0xb490('0x34')]=_[_0xb490('0x35')](_0x4267a4['model'],_0x4267a4[_0xb490('0x32')]);_0x38bb77[_0xb490('0x36')]=_[_0xb490('0x35')](_0x4267a4[_0xb490('0x30')],qs[_0xb490('0x37')](_0x453c37[_0xb490('0x32')]['fields']));_0x38bb77[_0xb490('0x36')]=_0x38bb77[_0xb490('0x36')]['length']?_0x38bb77[_0xb490('0x36')]:_0x4267a4[_0xb490('0x30')];if(!_0x453c37[_0xb490('0x32')][_0xb490('0x38')](_0xb490('0x39'))){_0x38bb77['limit']=qs[_0xb490('0x1f')](_0x453c37[_0xb490('0x32')][_0xb490('0x1f')]);_0x38bb77[_0xb490('0x1d')]=qs[_0xb490('0x1d')](_0x453c37[_0xb490('0x32')]['offset']);}_0x38bb77[_0xb490('0x3a')]=qs[_0xb490('0x3b')](_0x453c37[_0xb490('0x32')][_0xb490('0x3b')]);_0x38bb77[_0xb490('0x3c')]=qs[_0xb490('0x34')](_[_0xb490('0x3d')](_0x453c37[_0xb490('0x32')],_0x4267a4[_0xb490('0x34')]),_0x39d5d4);if(_0x453c37[_0xb490('0x32')]['filter']){_0x38bb77[_0xb490('0x3c')]=_[_0xb490('0x3e')](_0x38bb77['where'],{'$or':_[_0xb490('0x31')](_0x39d5d4,function(_0x347d89){if(_0x347d89[_0xb490('0x2e')]!==_0xb490('0x3f')){var _0x140e01={};_0x140e01[_0x347d89['name']]={'$like':'%'+_0x453c37[_0xb490('0x32')]['filter']+'%'};return _0x140e01;}})});}_0x38bb77=_['merge']({},_0x38bb77,_0x453c37[_0xb490('0x40')]);var _0x3472c7={'where':_0x38bb77['where']};return db['FreshsalesConfiguration'][_0xb490('0x20')](_0x3472c7)[_0xb490('0x26')](function(_0x1b0873){_0x4bed52[_0xb490('0x20')]=_0x1b0873;if(_0x453c37[_0xb490('0x32')][_0xb490('0x41')]){_0x38bb77[_0xb490('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xb490('0x43')](_0x38bb77);})[_0xb490('0x26')](function(_0x4de361){_0x4bed52[_0xb490('0x44')]=_0x4de361;return _0x4bed52;})[_0xb490('0x26')](respondWithFilteredResult(_0x37328d,_0x38bb77))[_0xb490('0x45')](handleError(_0x37328d,null));};exports[_0xb490('0x46')]=function(_0xedbd65,_0x5e570c){var _0x581f3d={'raw':![],'where':{'id':_0xedbd65[_0xb490('0x47')]['id']}},_0x58a89f={};_0x58a89f[_0xb490('0x30')]=_[_0xb490('0x33')](db[_0xb490('0x2d')]['rawAttributes']);_0x58a89f['query']=_[_0xb490('0x33')](_0xedbd65[_0xb490('0x32')]);_0x58a89f[_0xb490('0x34')]=_['intersection'](_0x58a89f[_0xb490('0x30')],_0x58a89f[_0xb490('0x32')]);_0x581f3d[_0xb490('0x36')]=_['intersection'](_0x58a89f[_0xb490('0x30')],qs['fields'](_0xedbd65[_0xb490('0x32')][_0xb490('0x37')]));_0x581f3d[_0xb490('0x36')]=_0x581f3d[_0xb490('0x36')][_0xb490('0x48')]?_0x581f3d[_0xb490('0x36')]:_0x58a89f[_0xb490('0x30')];if(_0xedbd65[_0xb490('0x32')]['includeAll']){_0x581f3d[_0xb490('0x42')]=[{'all':!![]}];}_0x581f3d=_['merge']({},_0x581f3d,_0xedbd65['options']);return db['FreshsalesConfiguration'][_0xb490('0x49')](_0x581f3d)['then'](handleEntityNotFound(_0x5e570c,null))[_0xb490('0x26')](respondWithResult(_0x5e570c,null))['catch'](handleError(_0x5e570c,null));};exports[_0xb490('0x4a')]=function(_0x2e9a9,_0x5ca50a){return db[_0xb490('0x2d')][_0xb490('0x4a')](_0x2e9a9['body'],{})[_0xb490('0x26')](respondWithResult(_0x5ca50a,0xc9))[_0xb490('0x45')](handleError(_0x5ca50a,null));};exports[_0xb490('0x25')]=function(_0x17fa3b,_0x11db8a){if(_0x17fa3b[_0xb490('0x4b')]['id']){delete _0x17fa3b['body']['id'];}return db['FreshsalesConfiguration'][_0xb490('0x49')]({'where':{'id':_0x17fa3b['params']['id']}})[_0xb490('0x26')](handleEntityNotFound(_0x11db8a,null))['then'](saveUpdates(_0x17fa3b['body'],null))[_0xb490('0x26')](respondWithResult(_0x11db8a,null))[_0xb490('0x45')](handleError(_0x11db8a,null));};exports['destroy']=function(_0xba1151,_0x2013e5){return db[_0xb490('0x2d')][_0xb490('0x49')]({'where':{'id':_0xba1151[_0xb490('0x47')]['id']}})['then'](handleEntityNotFound(_0x2013e5,null))[_0xb490('0x26')](removeEntity(_0x2013e5,null))[_0xb490('0x45')](handleError(_0x2013e5,null));};exports['getSubjects']=function(_0x23331f,_0x52bc04,_0x81da3e){var _0x5ea918={};var _0x189c2a={};var _0x3ec657;var _0x498d2b;return db['FreshsalesConfiguration'][_0xb490('0x4c')]({'where':{'id':_0x23331f[_0xb490('0x47')]['id']}})[_0xb490('0x26')](handleEntityNotFound(_0x52bc04,null))[_0xb490('0x26')](function(_0x2a98e0){if(_0x2a98e0){_0x3ec657=_0x2a98e0;_0x189c2a[_0xb490('0x30')]=_['keys'](db[_0xb490('0x4d')]['rawAttributes']);_0x189c2a['query']=_[_0xb490('0x33')](_0x23331f['query']);_0x189c2a[_0xb490('0x34')]=_['intersection'](_0x189c2a[_0xb490('0x30')],_0x189c2a[_0xb490('0x32')]);_0x5ea918['attributes']=_['intersection'](_0x189c2a[_0xb490('0x30')],qs['fields'](_0x23331f[_0xb490('0x32')][_0xb490('0x37')]));_0x5ea918[_0xb490('0x36')]=_0x5ea918[_0xb490('0x36')][_0xb490('0x48')]?_0x5ea918[_0xb490('0x36')]:_0x189c2a[_0xb490('0x30')];_0x5ea918[_0xb490('0x3a')]=qs[_0xb490('0x3b')](_0x23331f[_0xb490('0x32')][_0xb490('0x3b')]);_0x5ea918[_0xb490('0x3c')]=qs[_0xb490('0x34')](_['pick'](_0x23331f['query'],_0x189c2a[_0xb490('0x34')]));if(_0x23331f[_0xb490('0x32')][_0xb490('0x4e')]){_0x5ea918[_0xb490('0x3c')]=_[_0xb490('0x3e')](_0x5ea918[_0xb490('0x3c')],{'$or':_[_0xb490('0x31')](_0x5ea918['attributes'],function(_0x266daf){var _0x193f31={};_0x193f31[_0x266daf]={'$like':'%'+_0x23331f[_0xb490('0x32')][_0xb490('0x4e')]+'%'};return _0x193f31;})});}_0x5ea918=_[_0xb490('0x3e')]({},_0x5ea918,_0x23331f[_0xb490('0x40')]);return _0x3ec657[_0xb490('0x4f')](_0x5ea918);}})[_0xb490('0x26')](function(_0xd8c33c){if(_0xd8c33c){_0x498d2b=_0xd8c33c[_0xb490('0x48')];if(!_0x23331f[_0xb490('0x32')]['hasOwnProperty'](_0xb490('0x39'))){_0x5ea918['limit']=qs[_0xb490('0x1f')](_0x23331f[_0xb490('0x32')]['limit']);_0x5ea918['offset']=qs[_0xb490('0x1d')](_0x23331f[_0xb490('0x32')]['offset']);}return _0x3ec657['getSubjects'](_0x5ea918);}})[_0xb490('0x26')](function(_0x226a69){if(_0x226a69){return _0x226a69?{'count':_0x498d2b,'rows':_0x226a69}:null;}})[_0xb490('0x26')](respondWithResult(_0x52bc04,null))[_0xb490('0x45')](handleError(_0x52bc04,null));};exports[_0xb490('0x50')]=function(_0x1559c3,_0x14e07b,_0x263fb1){var _0x173ef6={};var _0x43a006={};var _0xb147fb;var _0x32d81a;return db[_0xb490('0x2d')]['findOne']({'where':{'id':_0x1559c3[_0xb490('0x47')]['id']}})[_0xb490('0x26')](handleEntityNotFound(_0x14e07b,null))[_0xb490('0x26')](function(_0x4508b8){if(_0x4508b8){_0xb147fb=_0x4508b8;_0x43a006[_0xb490('0x30')]=_['keys'](db[_0xb490('0x4d')]['rawAttributes']);_0x43a006[_0xb490('0x32')]=_['keys'](_0x1559c3[_0xb490('0x32')]);_0x43a006[_0xb490('0x34')]=_[_0xb490('0x35')](_0x43a006[_0xb490('0x30')],_0x43a006['query']);_0x173ef6[_0xb490('0x36')]=_['intersection'](_0x43a006[_0xb490('0x30')],qs[_0xb490('0x37')](_0x1559c3[_0xb490('0x32')]['fields']));_0x173ef6[_0xb490('0x36')]=_0x173ef6[_0xb490('0x36')][_0xb490('0x48')]?_0x173ef6[_0xb490('0x36')]:_0x43a006['model'];_0x173ef6[_0xb490('0x3a')]=qs[_0xb490('0x3b')](_0x1559c3['query'][_0xb490('0x3b')]);_0x173ef6[_0xb490('0x3c')]=qs['filters'](_[_0xb490('0x3d')](_0x1559c3[_0xb490('0x32')],_0x43a006[_0xb490('0x34')]));if(_0x1559c3[_0xb490('0x32')][_0xb490('0x4e')]){_0x173ef6['where']=_[_0xb490('0x3e')](_0x173ef6['where'],{'$or':_[_0xb490('0x31')](_0x173ef6[_0xb490('0x36')],function(_0x4103d4){var _0x3c0fbb={};_0x3c0fbb[_0x4103d4]={'$like':'%'+_0x1559c3[_0xb490('0x32')][_0xb490('0x4e')]+'%'};return _0x3c0fbb;})});}_0x173ef6=_[_0xb490('0x3e')]({},_0x173ef6,_0x1559c3[_0xb490('0x40')]);return _0xb147fb[_0xb490('0x50')](_0x173ef6);}})['then'](function(_0x2c8c67){if(_0x2c8c67){_0x32d81a=_0x2c8c67[_0xb490('0x48')];if(!_0x1559c3[_0xb490('0x32')][_0xb490('0x38')](_0xb490('0x39'))){_0x173ef6[_0xb490('0x1f')]=qs['limit'](_0x1559c3['query'][_0xb490('0x1f')]);_0x173ef6[_0xb490('0x1d')]=qs[_0xb490('0x1d')](_0x1559c3[_0xb490('0x32')][_0xb490('0x1d')]);}return _0xb147fb['getDescriptions'](_0x173ef6);}})[_0xb490('0x26')](function(_0x31a062){if(_0x31a062){return _0x31a062?{'count':_0x32d81a,'rows':_0x31a062}:null;}})[_0xb490('0x26')](respondWithResult(_0x14e07b,null))[_0xb490('0x45')](handleError(_0x14e07b,null));};exports[_0xb490('0x51')]=function(_0x3858de,_0x242cbb,_0x382c8f){var _0x23765f={};var _0x40880c={};var _0x3bc620;var _0x4f6271;return db['FreshsalesConfiguration'][_0xb490('0x4c')]({'where':{'id':_0x3858de[_0xb490('0x47')]['id']}})[_0xb490('0x26')](handleEntityNotFound(_0x242cbb,null))[_0xb490('0x26')](function(_0x5514d0){if(_0x5514d0){_0x3bc620=_0x5514d0;_0x40880c['model']=_[_0xb490('0x33')](db[_0xb490('0x4d')][_0xb490('0x52')]);_0x40880c[_0xb490('0x32')]=_[_0xb490('0x33')](_0x3858de[_0xb490('0x32')]);_0x40880c[_0xb490('0x34')]=_['intersection'](_0x40880c['model'],_0x40880c[_0xb490('0x32')]);_0x23765f[_0xb490('0x36')]=_[_0xb490('0x35')](_0x40880c[_0xb490('0x30')],qs[_0xb490('0x37')](_0x3858de[_0xb490('0x32')]['fields']));_0x23765f['attributes']=_0x23765f[_0xb490('0x36')][_0xb490('0x48')]?_0x23765f[_0xb490('0x36')]:_0x40880c[_0xb490('0x30')];_0x23765f[_0xb490('0x3a')]=qs['sort'](_0x3858de['query'][_0xb490('0x3b')]);_0x23765f[_0xb490('0x3c')]=qs[_0xb490('0x34')](_[_0xb490('0x3d')](_0x3858de['query'],_0x40880c[_0xb490('0x34')]));if(_0x3858de['query'][_0xb490('0x4e')]){_0x23765f['where']=_['merge'](_0x23765f[_0xb490('0x3c')],{'$or':_[_0xb490('0x31')](_0x23765f[_0xb490('0x36')],function(_0x4f6c7d){var _0x1aed48={};_0x1aed48[_0x4f6c7d]={'$like':'%'+_0x3858de['query'][_0xb490('0x4e')]+'%'};return _0x1aed48;})});}_0x23765f=_[_0xb490('0x3e')]({},_0x23765f,_0x3858de[_0xb490('0x40')]);return _0x3bc620[_0xb490('0x51')](_0x23765f);}})['then'](function(_0x44e65d){if(_0x44e65d){_0x4f6271=_0x44e65d[_0xb490('0x48')];if(!_0x3858de[_0xb490('0x32')][_0xb490('0x38')](_0xb490('0x39'))){_0x23765f[_0xb490('0x1f')]=qs[_0xb490('0x1f')](_0x3858de[_0xb490('0x32')][_0xb490('0x1f')]);_0x23765f[_0xb490('0x1d')]=qs[_0xb490('0x1d')](_0x3858de[_0xb490('0x32')][_0xb490('0x1d')]);}return _0x3bc620['getFields'](_0x23765f);}})[_0xb490('0x26')](function(_0x54ecc4){if(_0x54ecc4){return _0x54ecc4?{'count':_0x4f6271,'rows':_0x54ecc4}:null;}})[_0xb490('0x26')](respondWithResult(_0x242cbb,null))['catch'](handleError(_0x242cbb,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index aae041e..6c79381 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 _0x8d1d=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','int_freshsales_configurations','lodash'];(function(_0xe495a7,_0x3b4589){var _0x1cc145=function(_0x578d41){while(--_0x578d41){_0xe495a7['push'](_0xe495a7['shift']());}};_0x1cc145(++_0x3b4589);}(_0x8d1d,0x135));var _0xd8d1=function(_0x26e8cd,_0x4b5df5){_0x26e8cd=_0x26e8cd-0x0;var _0x3b8c85=_0x8d1d[_0x26e8cd];return _0x3b8c85;};'use strict';var _=require(_0xd8d1('0x0'));var util=require(_0xd8d1('0x1'));var logger=require(_0xd8d1('0x2'))(_0xd8d1('0x3'));var moment=require(_0xd8d1('0x4'));var BPromise=require(_0xd8d1('0x5'));var rp=require(_0xd8d1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8d1('0x7'));var config=require(_0xd8d1('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x34c390,_0x54f061){return _0x34c390['define']('FreshsalesConfiguration',attributes,{'tableName':_0xd8d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59d3=['FreshsalesConfiguration','int_freshsales_configurations','lodash','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x2076fa,_0xb0dc3f){var _0x69dabb=function(_0x15a1af){while(--_0x15a1af){_0x2076fa['push'](_0x2076fa['shift']());}};_0x69dabb(++_0xb0dc3f);}(_0x59d3,0x86));var _0x359d=function(_0x2dcb4d,_0x57f8e5){_0x2dcb4d=_0x2dcb4d-0x0;var _0x22d9b7=_0x59d3[_0x2dcb4d];return _0x22d9b7;};'use strict';var _=require(_0x359d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x359d('0x1'));var moment=require(_0x359d('0x2'));var BPromise=require(_0x359d('0x3'));var rp=require(_0x359d('0x4'));var fs=require('fs');var path=require(_0x359d('0x5'));var rimraf=require(_0x359d('0x6'));var config=require('../../config/environment');var attributes=require(_0x359d('0x7'));module[_0x359d('0x8')]=function(_0x24b775,_0x390bb4){return _0x24b775[_0x359d('0x9')](_0x359d('0xa'),attributes,{'tableName':_0x359d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index c19d7a2..fd4169b 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 _0x4abd=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x29eeb3,_0x189911){var _0x34e287=function(_0xcf4a87){while(--_0xcf4a87){_0x29eeb3['push'](_0x29eeb3['shift']());}};_0x34e287(++_0x189911);}(_0x4abd,0x7a));var _0xd4ab=function(_0x2e2104,_0x11287d){_0x2e2104=_0x2e2104-0x0;var _0x1280c5=_0x4abd[_0x2e2104];return _0x1280c5;};'use strict';var _=require(_0xd4ab('0x0'));var util=require(_0xd4ab('0x1'));var moment=require(_0xd4ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4ab('0x3'));var db=require(_0xd4ab('0x4'))['db'];var utils=require(_0xd4ab('0x5'));var logger=require(_0xd4ab('0x6'))(_0xd4ab('0x7'));var config=require('../../config/environment');var jayson=require(_0xd4ab('0x8'));var client=jayson[_0xd4ab('0x9')][_0xd4ab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e3676,_0x5107ae,_0x566592){return new BPromise(function(_0x5506e0,_0x2b7212){return client[_0xd4ab('0xb')](_0x1e3676,_0x566592)['then'](function(_0x3741c9){logger['info'](_0xd4ab('0xc'),_0x5107ae,_0xd4ab('0xd'));logger[_0xd4ab('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x5107ae,_0xd4ab('0xd'),JSON[_0xd4ab('0xf')](_0x3741c9));if(_0x3741c9['error']){if(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x11')]===0x1f4){logger[_0xd4ab('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5107ae,_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);return _0x2b7212(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);}logger[_0xd4ab('0x10')](_0xd4ab('0xc'),_0x5107ae,_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);return _0x5506e0(_0x3741c9[_0xd4ab('0x10')][_0xd4ab('0x12')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x5107ae,_0xd4ab('0xd'));_0x5506e0(_0x3741c9[_0xd4ab('0x13')][_0xd4ab('0x12')]);}})[_0xd4ab('0x14')](function(_0x3e254f){logger[_0xd4ab('0x10')](_0xd4ab('0xc'),_0x5107ae,_0x3e254f);_0x2b7212(_0x3e254f);});});} \ No newline at end of file +var _0x55ce=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x55ce,0x19b));var _0xe55c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x55ce[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xe55c('0x0'));var util=require(_0xe55c('0x1'));var moment=require(_0xe55c('0x2'));var BPromise=require(_0xe55c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe55c('0x4'));var db=require(_0xe55c('0x5'))['db'];var utils=require(_0xe55c('0x6'));var logger=require(_0xe55c('0x7'))(_0xe55c('0x8'));var config=require('../../config/environment');var jayson=require(_0xe55c('0x9'));var client=jayson[_0xe55c('0xa')][_0xe55c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0632,_0x534d08,_0x292a53){return new BPromise(function(_0x1ab20a,_0x54ccb5){return client[_0xe55c('0xc')](_0x4c0632,_0x292a53)[_0xe55c('0xd')](function(_0x39e913){logger['info'](_0xe55c('0xe'),_0x534d08,'request\x20sent');logger['debug'](_0xe55c('0xf'),_0x534d08,'request\x20sent',JSON[_0xe55c('0x10')](_0x39e913));if(_0x39e913[_0xe55c('0x11')]){if(_0x39e913['error'][_0xe55c('0x12')]===0x1f4){logger['error'](_0xe55c('0xe'),_0x534d08,_0x39e913['error']['message']);return _0x54ccb5(_0x39e913[_0xe55c('0x11')][_0xe55c('0x13')]);}logger[_0xe55c('0x11')](_0xe55c('0xe'),_0x534d08,_0x39e913[_0xe55c('0x11')][_0xe55c('0x13')]);return _0x1ab20a(_0x39e913[_0xe55c('0x11')]['message']);}else{logger[_0xe55c('0x14')](_0xe55c('0xe'),_0x534d08,'request\x20sent');_0x1ab20a(_0x39e913[_0xe55c('0x15')][_0xe55c('0x13')]);}})[_0xe55c('0x16')](function(_0x199632){logger['error'](_0xe55c('0xe'),_0x534d08,_0x199632);_0x54ccb5(_0x199632);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 75b1e6e..d575b96 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 _0xa5ca=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2d194a,_0x197dbf){var _0x147d83=function(_0x4c5f4b){while(--_0x4c5f4b){_0x2d194a['push'](_0x2d194a['shift']());}};_0x147d83(++_0x197dbf);}(_0xa5ca,0xb1));var _0xaa5c=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xa5ca[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0xaa5c('0x0'));var util=require(_0xaa5c('0x1'));var path=require(_0xaa5c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaa5c('0x3')]();var fs_extra=require(_0xaa5c('0x4'));var auth=require(_0xaa5c('0x5'));var interaction=require(_0xaa5c('0x6'));var config=require(_0xaa5c('0x7'));var controller=require(_0xaa5c('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaa5c('0x9')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller['show']);router['post']('/',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xc')]);router[_0xaa5c('0xd')]('/:id',auth[_0xaa5c('0xb')](),controller[_0xaa5c('0xe')]);router[_0xaa5c('0xf')](_0xaa5c('0xa'),auth[_0xaa5c('0xb')](),controller[_0xaa5c('0x10')]);module[_0xaa5c('0x11')]=router; \ No newline at end of file +var _0xfc73=['destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','update','delete','/:id'];(function(_0x2eda74,_0x1f89b1){var _0xc67a5=function(_0x2e1efd){while(--_0x2e1efd){_0x2eda74['push'](_0x2eda74['shift']());}};_0xc67a5(++_0x1f89b1);}(_0xfc73,0x8d));var _0x3fc7=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xfc73[_0x4a53d];return _0x27410e;};'use strict';var multer=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var path=require('path');var timeout=require(_0x3fc7('0x2'));var express=require(_0x3fc7('0x3'));var router=express[_0x3fc7('0x4')]();var fs_extra=require(_0x3fc7('0x5'));var auth=require(_0x3fc7('0x6'));var interaction=require(_0x3fc7('0x7'));var config=require(_0x3fc7('0x8'));var controller=require(_0x3fc7('0x9'));router[_0x3fc7('0xa')]('/',auth[_0x3fc7('0xb')](),controller[_0x3fc7('0xc')]);router[_0x3fc7('0xa')]('/:id',auth[_0x3fc7('0xb')](),controller[_0x3fc7('0xd')]);router[_0x3fc7('0xe')]('/',auth[_0x3fc7('0xb')](),controller[_0x3fc7('0xf')]);router['put']('/:id',auth[_0x3fc7('0xb')](),controller[_0x3fc7('0x10')]);router[_0x3fc7('0x11')](_0x3fc7('0x12'),auth[_0x3fc7('0xb')](),controller[_0x3fc7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 01b6c81..0538e15 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 _0xea47=['variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x507ec6,_0x5c9a15){var _0x2f70f0=function(_0x4aa2d4){while(--_0x4aa2d4){_0x507ec6['push'](_0x507ec6['shift']());}};_0x2f70f0(++_0x5c9a15);}(_0xea47,0x1eb));var _0x7ea4=function(_0xb365df,_0x28b3b2){_0xb365df=_0xb365df-0x0;var _0x2870ba=_0xea47[_0xb365df];return _0x2870ba;};'use strict';var Sequelize=require(_0x7ea4('0x0'));module[_0x7ea4('0x1')]={'type':{'type':Sequelize[_0x7ea4('0x2')](_0x7ea4('0x3'),_0x7ea4('0x4'),'customVariable',_0x7ea4('0x5'),_0x7ea4('0x6')),'defaultValue':_0x7ea4('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7ea4('0x7')]},'keyType':{'type':Sequelize[_0x7ea4('0x2')](_0x7ea4('0x3'),_0x7ea4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x7ea4('0x7')]},'idField':{'type':Sequelize[_0x7ea4('0x7')]},'nameField':{'type':Sequelize[_0x7ea4('0x7')]},'customField':{'type':Sequelize[_0x7ea4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ea4('0x7')]}}; \ No newline at end of file +var _0x216d=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','picklist','STRING'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x216d,0x1c2));var _0xd216=function(_0x3f19e9,_0x487608){_0x3f19e9=_0x3f19e9-0x0;var _0x13f247=_0x216d[_0x3f19e9];return _0x13f247;};'use strict';var Sequelize=require(_0xd216('0x0'));module[_0xd216('0x1')]={'type':{'type':Sequelize[_0xd216('0x2')](_0xd216('0x3'),'variable','customVariable','keyValue',_0xd216('0x4')),'defaultValue':_0xd216('0x3')},'content':{'type':Sequelize[_0xd216('0x5')]},'key':{'type':Sequelize[_0xd216('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0xd216('0x6'))},'keyContent':{'type':Sequelize[_0xd216('0x5')]},'idField':{'type':Sequelize[_0xd216('0x5')]},'nameField':{'type':Sequelize[_0xd216('0x5')]},'customField':{'type':Sequelize[_0xd216('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd216('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index a8728c5..1974630 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 _0xd3c7=['map','FreshsalesField','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','keys','include','find','create','body','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/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x44af93,_0x45fa15){var _0x22eef3=function(_0x53dc6f){while(--_0x53dc6f){_0x44af93['push'](_0x44af93['shift']());}};_0x22eef3(++_0x45fa15);}(_0xd3c7,0xfe));var _0x7d3c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3c7[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7d3c('0x0'));var rp=require(_0x7d3c('0x1'));var moment=require(_0x7d3c('0x2'));var BPromise=require(_0x7d3c('0x3'));var Mustache=require(_0x7d3c('0x4'));var util=require(_0x7d3c('0x5'));var path=require('path');var sox=require(_0x7d3c('0x6'));var csv=require(_0x7d3c('0x7'));var ejs=require(_0x7d3c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7d3c('0x9'));var crypto=require(_0x7d3c('0xa'));var jsforce=require(_0x7d3c('0xb'));var deskjs=require(_0x7d3c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7d3c('0xd'));var Papa=require(_0x7d3c('0xe'));var Redis=require(_0x7d3c('0xf'));var authService=require(_0x7d3c('0x10'));var qs=require(_0x7d3c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d3c('0x12'));var logger=require(_0x7d3c('0x13'))(_0x7d3c('0x14'));var utils=require('../../config/utils');var config=require(_0x7d3c('0x15'));var licenseUtil=require(_0x7d3c('0x16'));var db=require(_0x7d3c('0x17'))['db'];function respondWithStatusCode(_0x2066a5,_0x3cdbc3){_0x3cdbc3=_0x3cdbc3||0xcc;return function(_0x15bfa7){if(_0x15bfa7){return _0x2066a5[_0x7d3c('0x18')](_0x3cdbc3);}return _0x2066a5[_0x7d3c('0x19')](_0x3cdbc3)[_0x7d3c('0x1a')]();};}function respondWithResult(_0x3d4703,_0x48c4af){_0x48c4af=_0x48c4af||0xc8;return function(_0x441e57){if(_0x441e57){return _0x3d4703[_0x7d3c('0x19')](_0x48c4af)['json'](_0x441e57);}};}function respondWithFilteredResult(_0x108c68,_0x2f57ef){return function(_0x4599ca){if(_0x4599ca){var _0xa3723e=typeof _0x2f57ef['offset']===_0x7d3c('0x1b')&&typeof _0x2f57ef[_0x7d3c('0x1c')]===_0x7d3c('0x1b');var _0x402c82=_0x4599ca[_0x7d3c('0x1d')];var _0x267788=_0xa3723e?0x0:_0x2f57ef[_0x7d3c('0x1e')];var _0x486360=_0xa3723e?_0x4599ca['count']:_0x2f57ef[_0x7d3c('0x1e')]+_0x2f57ef[_0x7d3c('0x1c')];var _0x2f19ec;if(_0x486360>=_0x402c82){_0x486360=_0x402c82;_0x2f19ec=0xc8;}else{_0x2f19ec=0xce;}_0x108c68[_0x7d3c('0x19')](_0x2f19ec);return _0x108c68[_0x7d3c('0x1f')]('Content-Range',_0x267788+'-'+_0x486360+'/'+_0x402c82)['json'](_0x4599ca);}return null;};}function patchUpdates(_0xcd07ae){return function(_0x5b8cc3){try{jsonpatch['apply'](_0x5b8cc3,_0xcd07ae,!![]);}catch(_0x34a882){return BPromise[_0x7d3c('0x20')](_0x34a882);}return _0x5b8cc3[_0x7d3c('0x21')]();};}function saveUpdates(_0x2f7a41,_0x449f80){return function(_0x5629e0){if(_0x5629e0){return _0x5629e0[_0x7d3c('0x22')](_0x2f7a41)[_0x7d3c('0x23')](function(_0x4404d2){return _0x4404d2;});}return null;};}function removeEntity(_0x2f2c3e,_0x52dd5b){return function(_0x440bcd){if(_0x440bcd){return _0x440bcd[_0x7d3c('0x24')]()[_0x7d3c('0x23')](function(){_0x2f2c3e[_0x7d3c('0x19')](0xcc)[_0x7d3c('0x1a')]();});}};}function handleEntityNotFound(_0x47d165,_0x8cde9){return function(_0x319b82){if(!_0x319b82){_0x47d165[_0x7d3c('0x18')](0x194);}return _0x319b82;};}function handleError(_0x42d417,_0x18abf6){_0x18abf6=_0x18abf6||0x1f4;return function(_0x3f3dd0){logger[_0x7d3c('0x25')](_0x3f3dd0[_0x7d3c('0x26')]);if(_0x3f3dd0[_0x7d3c('0x27')]){delete _0x3f3dd0[_0x7d3c('0x27')];}_0x42d417[_0x7d3c('0x19')](_0x18abf6)[_0x7d3c('0x28')](_0x3f3dd0);};}exports[_0x7d3c('0x29')]=function(_0x326750,_0x29c139){var _0x21f82d={},_0x5ecefa={},_0x18796f={'count':0x0,'rows':[]};var _0x3bc32e=_[_0x7d3c('0x2a')](db[_0x7d3c('0x2b')][_0x7d3c('0x2c')],function(_0xa8e5c5){return{'name':_0xa8e5c5[_0x7d3c('0x2d')],'type':_0xa8e5c5['type'][_0x7d3c('0x2e')]};});_0x5ecefa['model']=_[_0x7d3c('0x2a')](_0x3bc32e,_0x7d3c('0x27'));_0x5ecefa[_0x7d3c('0x2f')]=_['keys'](_0x326750[_0x7d3c('0x2f')]);_0x5ecefa[_0x7d3c('0x30')]=_[_0x7d3c('0x31')](_0x5ecefa['model'],_0x5ecefa[_0x7d3c('0x2f')]);_0x21f82d['attributes']=_[_0x7d3c('0x31')](_0x5ecefa['model'],qs[_0x7d3c('0x32')](_0x326750['query']['fields']));_0x21f82d[_0x7d3c('0x33')]=_0x21f82d['attributes'][_0x7d3c('0x34')]?_0x21f82d[_0x7d3c('0x33')]:_0x5ecefa[_0x7d3c('0x35')];if(!_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x36')](_0x7d3c('0x37'))){_0x21f82d[_0x7d3c('0x1c')]=qs[_0x7d3c('0x1c')](_0x326750[_0x7d3c('0x2f')]['limit']);_0x21f82d['offset']=qs[_0x7d3c('0x1e')](_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x1e')]);}_0x21f82d[_0x7d3c('0x38')]=qs['sort'](_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x39')]);_0x21f82d[_0x7d3c('0x3a')]=qs['filters'](_['pick'](_0x326750[_0x7d3c('0x2f')],_0x5ecefa['filters']),_0x3bc32e);if(_0x326750[_0x7d3c('0x2f')]['filter']){_0x21f82d[_0x7d3c('0x3a')]=_[_0x7d3c('0x3b')](_0x21f82d[_0x7d3c('0x3a')],{'$or':_[_0x7d3c('0x2a')](_0x3bc32e,function(_0x1c54d6){if(_0x1c54d6[_0x7d3c('0x3c')]!==_0x7d3c('0x3d')){var _0x4b7903={};_0x4b7903[_0x1c54d6[_0x7d3c('0x27')]]={'$like':'%'+_0x326750[_0x7d3c('0x2f')][_0x7d3c('0x3e')]+'%'};return _0x4b7903;}})});}_0x21f82d=_[_0x7d3c('0x3b')]({},_0x21f82d,_0x326750[_0x7d3c('0x3f')]);var _0x2c855c={'where':_0x21f82d[_0x7d3c('0x3a')]};return db[_0x7d3c('0x2b')]['count'](_0x2c855c)[_0x7d3c('0x23')](function(_0x44da26){_0x18796f[_0x7d3c('0x1d')]=_0x44da26;if(_0x326750[_0x7d3c('0x2f')]['includeAll']){_0x21f82d['include']=[{'all':!![]}];}return db[_0x7d3c('0x2b')][_0x7d3c('0x40')](_0x21f82d);})[_0x7d3c('0x23')](function(_0x1ff098){_0x18796f[_0x7d3c('0x41')]=_0x1ff098;return _0x18796f;})[_0x7d3c('0x23')](respondWithFilteredResult(_0x29c139,_0x21f82d))[_0x7d3c('0x42')](handleError(_0x29c139,null));};exports[_0x7d3c('0x43')]=function(_0x457df6,_0x1834c9){var _0x49ef1a={'raw':!![],'where':{'id':_0x457df6[_0x7d3c('0x44')]['id']}},_0x4da7b7={};_0x4da7b7[_0x7d3c('0x35')]=_['keys'](db[_0x7d3c('0x2b')][_0x7d3c('0x2c')]);_0x4da7b7[_0x7d3c('0x2f')]=_[_0x7d3c('0x45')](_0x457df6[_0x7d3c('0x2f')]);_0x4da7b7[_0x7d3c('0x30')]=_['intersection'](_0x4da7b7[_0x7d3c('0x35')],_0x4da7b7[_0x7d3c('0x2f')]);_0x49ef1a[_0x7d3c('0x33')]=_[_0x7d3c('0x31')](_0x4da7b7[_0x7d3c('0x35')],qs[_0x7d3c('0x32')](_0x457df6[_0x7d3c('0x2f')]['fields']));_0x49ef1a[_0x7d3c('0x33')]=_0x49ef1a[_0x7d3c('0x33')][_0x7d3c('0x34')]?_0x49ef1a[_0x7d3c('0x33')]:_0x4da7b7[_0x7d3c('0x35')];if(_0x457df6[_0x7d3c('0x2f')]['includeAll']){_0x49ef1a[_0x7d3c('0x46')]=[{'all':!![]}];}_0x49ef1a=_[_0x7d3c('0x3b')]({},_0x49ef1a,_0x457df6['options']);return db[_0x7d3c('0x2b')][_0x7d3c('0x47')](_0x49ef1a)['then'](handleEntityNotFound(_0x1834c9,null))['then'](respondWithResult(_0x1834c9,null))[_0x7d3c('0x42')](handleError(_0x1834c9,null));};exports[_0x7d3c('0x48')]=function(_0x3f3edf,_0x845061){return db['FreshsalesField'][_0x7d3c('0x48')](_0x3f3edf[_0x7d3c('0x49')],{})['then'](respondWithResult(_0x845061,0xc9))[_0x7d3c('0x42')](handleError(_0x845061,null));};exports[_0x7d3c('0x22')]=function(_0x3c0d9e,_0x910254){if(_0x3c0d9e[_0x7d3c('0x49')]['id']){delete _0x3c0d9e[_0x7d3c('0x49')]['id'];}return db['FreshsalesField'][_0x7d3c('0x47')]({'where':{'id':_0x3c0d9e['params']['id']}})['then'](handleEntityNotFound(_0x910254,null))[_0x7d3c('0x23')](saveUpdates(_0x3c0d9e[_0x7d3c('0x49')],null))[_0x7d3c('0x23')](respondWithResult(_0x910254,null))[_0x7d3c('0x42')](handleError(_0x910254,null));};exports[_0x7d3c('0x24')]=function(_0x3f2df7,_0x2c74cc){return db[_0x7d3c('0x2b')][_0x7d3c('0x47')]({'where':{'id':_0x3f2df7[_0x7d3c('0x44')]['id']}})['then'](handleEntityNotFound(_0x2c74cc,null))[_0x7d3c('0x23')](removeEntity(_0x2c74cc,null))[_0x7d3c('0x42')](handleError(_0x2c74cc,null));}; \ No newline at end of file +var _0x1fc2=['filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','FreshsalesField','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','sendStatus','stack','name','index','map','fieldName','type','model','query','keys'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x1fc2,0x175));var _0x21fc=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x1fc2[_0x29d94e];return _0x106237;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21fc('0x0'));var zipdir=require(_0x21fc('0x1'));var jsonpatch=require(_0x21fc('0x2'));var rp=require(_0x21fc('0x3'));var moment=require(_0x21fc('0x4'));var BPromise=require(_0x21fc('0x5'));var Mustache=require(_0x21fc('0x6'));var util=require(_0x21fc('0x7'));var path=require('path');var sox=require(_0x21fc('0x8'));var csv=require('to-csv');var ejs=require(_0x21fc('0x9'));var fs=require('fs');var fs_extra=require(_0x21fc('0xa'));var _=require(_0x21fc('0xb'));var squel=require(_0x21fc('0xc'));var crypto=require(_0x21fc('0xd'));var jsforce=require(_0x21fc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x21fc('0xf'));var querystring=require(_0x21fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x21fc('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x21fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x21fc('0x13'))(_0x21fc('0x14'));var utils=require(_0x21fc('0x15'));var config=require(_0x21fc('0x16'));var licenseUtil=require(_0x21fc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a6b3c,_0x55a036){_0x55a036=_0x55a036||0xcc;return function(_0x5c71c3){if(_0x5c71c3){return _0x2a6b3c['sendStatus'](_0x55a036);}return _0x2a6b3c[_0x21fc('0x18')](_0x55a036)['end']();};}function respondWithResult(_0x1d91b3,_0x1a865c){_0x1a865c=_0x1a865c||0xc8;return function(_0x220749){if(_0x220749){return _0x1d91b3['status'](_0x1a865c)[_0x21fc('0x19')](_0x220749);}};}function respondWithFilteredResult(_0x5e9170,_0x489e93){return function(_0x322073){if(_0x322073){var _0x4c8a6f=typeof _0x489e93[_0x21fc('0x1a')]===_0x21fc('0x1b')&&typeof _0x489e93[_0x21fc('0x1c')]===_0x21fc('0x1b');var _0x2d4938=_0x322073[_0x21fc('0x1d')];var _0x5d71c1=_0x4c8a6f?0x0:_0x489e93[_0x21fc('0x1a')];var _0x19bf9e=_0x4c8a6f?_0x322073[_0x21fc('0x1d')]:_0x489e93[_0x21fc('0x1a')]+_0x489e93['limit'];var _0x4915fb;if(_0x19bf9e>=_0x2d4938){_0x19bf9e=_0x2d4938;_0x4915fb=0xc8;}else{_0x4915fb=0xce;}_0x5e9170['status'](_0x4915fb);return _0x5e9170[_0x21fc('0x1e')](_0x21fc('0x1f'),_0x5d71c1+'-'+_0x19bf9e+'/'+_0x2d4938)[_0x21fc('0x19')](_0x322073);}return null;};}function patchUpdates(_0x2e9846){return function(_0x1f8b95){try{jsonpatch[_0x21fc('0x20')](_0x1f8b95,_0x2e9846,!![]);}catch(_0x4c40e1){return BPromise['reject'](_0x4c40e1);}return _0x1f8b95['save']();};}function saveUpdates(_0x5d1199,_0x8e1eb2){return function(_0x542b7f){if(_0x542b7f){return _0x542b7f[_0x21fc('0x21')](_0x5d1199)[_0x21fc('0x22')](function(_0x186b66){return _0x186b66;});}return null;};}function removeEntity(_0x478c82,_0xde9047){return function(_0x5125c8){if(_0x5125c8){return _0x5125c8[_0x21fc('0x23')]()[_0x21fc('0x22')](function(){_0x478c82[_0x21fc('0x18')](0xcc)[_0x21fc('0x24')]();});}};}function handleEntityNotFound(_0x23eb1c,_0x489020){return function(_0x7b1323){if(!_0x7b1323){_0x23eb1c[_0x21fc('0x25')](0x194);}return _0x7b1323;};}function handleError(_0x5d264e,_0x32a571){_0x32a571=_0x32a571||0x1f4;return function(_0x320694){logger['error'](_0x320694[_0x21fc('0x26')]);if(_0x320694[_0x21fc('0x27')]){delete _0x320694[_0x21fc('0x27')];}_0x5d264e[_0x21fc('0x18')](_0x32a571)['send'](_0x320694);};}exports[_0x21fc('0x28')]=function(_0x4f62af,_0x5a2b70){var _0x106017={},_0xadcf82={},_0x4e4418={'count':0x0,'rows':[]};var _0x855663=_[_0x21fc('0x29')](db['FreshsalesField']['rawAttributes'],function(_0x5f20b6){return{'name':_0x5f20b6[_0x21fc('0x2a')],'type':_0x5f20b6[_0x21fc('0x2b')]['key']};});_0xadcf82[_0x21fc('0x2c')]=_[_0x21fc('0x29')](_0x855663,'name');_0xadcf82[_0x21fc('0x2d')]=_[_0x21fc('0x2e')](_0x4f62af[_0x21fc('0x2d')]);_0xadcf82[_0x21fc('0x2f')]=_[_0x21fc('0x30')](_0xadcf82[_0x21fc('0x2c')],_0xadcf82[_0x21fc('0x2d')]);_0x106017['attributes']=_[_0x21fc('0x30')](_0xadcf82[_0x21fc('0x2c')],qs[_0x21fc('0x31')](_0x4f62af[_0x21fc('0x2d')]['fields']));_0x106017[_0x21fc('0x32')]=_0x106017[_0x21fc('0x32')][_0x21fc('0x33')]?_0x106017[_0x21fc('0x32')]:_0xadcf82[_0x21fc('0x2c')];if(!_0x4f62af[_0x21fc('0x2d')]['hasOwnProperty'](_0x21fc('0x34'))){_0x106017[_0x21fc('0x1c')]=qs[_0x21fc('0x1c')](_0x4f62af['query']['limit']);_0x106017[_0x21fc('0x1a')]=qs[_0x21fc('0x1a')](_0x4f62af[_0x21fc('0x2d')][_0x21fc('0x1a')]);}_0x106017[_0x21fc('0x35')]=qs[_0x21fc('0x36')](_0x4f62af[_0x21fc('0x2d')][_0x21fc('0x36')]);_0x106017['where']=qs[_0x21fc('0x2f')](_['pick'](_0x4f62af['query'],_0xadcf82[_0x21fc('0x2f')]),_0x855663);if(_0x4f62af[_0x21fc('0x2d')][_0x21fc('0x37')]){_0x106017['where']=_['merge'](_0x106017[_0x21fc('0x38')],{'$or':_[_0x21fc('0x29')](_0x855663,function(_0x19b3f2){if(_0x19b3f2[_0x21fc('0x2b')]!==_0x21fc('0x39')){var _0x1f8328={};_0x1f8328[_0x19b3f2['name']]={'$like':'%'+_0x4f62af['query'][_0x21fc('0x37')]+'%'};return _0x1f8328;}})});}_0x106017=_[_0x21fc('0x3a')]({},_0x106017,_0x4f62af['options']);var _0x3e8903={'where':_0x106017[_0x21fc('0x38')]};return db[_0x21fc('0x3b')][_0x21fc('0x1d')](_0x3e8903)[_0x21fc('0x22')](function(_0x37f2b7){_0x4e4418['count']=_0x37f2b7;if(_0x4f62af[_0x21fc('0x2d')]['includeAll']){_0x106017[_0x21fc('0x3c')]=[{'all':!![]}];}return db[_0x21fc('0x3b')][_0x21fc('0x3d')](_0x106017);})[_0x21fc('0x22')](function(_0x49d270){_0x4e4418['rows']=_0x49d270;return _0x4e4418;})[_0x21fc('0x22')](respondWithFilteredResult(_0x5a2b70,_0x106017))[_0x21fc('0x3e')](handleError(_0x5a2b70,null));};exports[_0x21fc('0x3f')]=function(_0x40d31b,_0x57b9a1){var _0x2b4e88={'raw':!![],'where':{'id':_0x40d31b[_0x21fc('0x40')]['id']}},_0xa795a2={};_0xa795a2[_0x21fc('0x2c')]=_['keys'](db[_0x21fc('0x3b')][_0x21fc('0x41')]);_0xa795a2[_0x21fc('0x2d')]=_[_0x21fc('0x2e')](_0x40d31b['query']);_0xa795a2[_0x21fc('0x2f')]=_['intersection'](_0xa795a2['model'],_0xa795a2['query']);_0x2b4e88[_0x21fc('0x32')]=_[_0x21fc('0x30')](_0xa795a2['model'],qs[_0x21fc('0x31')](_0x40d31b['query'][_0x21fc('0x31')]));_0x2b4e88[_0x21fc('0x32')]=_0x2b4e88[_0x21fc('0x32')][_0x21fc('0x33')]?_0x2b4e88[_0x21fc('0x32')]:_0xa795a2['model'];if(_0x40d31b['query'][_0x21fc('0x42')]){_0x2b4e88[_0x21fc('0x3c')]=[{'all':!![]}];}_0x2b4e88=_['merge']({},_0x2b4e88,_0x40d31b['options']);return db[_0x21fc('0x3b')][_0x21fc('0x43')](_0x2b4e88)[_0x21fc('0x22')](handleEntityNotFound(_0x57b9a1,null))[_0x21fc('0x22')](respondWithResult(_0x57b9a1,null))['catch'](handleError(_0x57b9a1,null));};exports[_0x21fc('0x44')]=function(_0x4d8f6b,_0x516d6f){return db[_0x21fc('0x3b')][_0x21fc('0x44')](_0x4d8f6b[_0x21fc('0x45')],{})[_0x21fc('0x22')](respondWithResult(_0x516d6f,0xc9))['catch'](handleError(_0x516d6f,null));};exports[_0x21fc('0x21')]=function(_0x982f1,_0x52bd4d){if(_0x982f1[_0x21fc('0x45')]['id']){delete _0x982f1[_0x21fc('0x45')]['id'];}return db[_0x21fc('0x3b')][_0x21fc('0x43')]({'where':{'id':_0x982f1[_0x21fc('0x40')]['id']}})[_0x21fc('0x22')](handleEntityNotFound(_0x52bd4d,null))[_0x21fc('0x22')](saveUpdates(_0x982f1['body'],null))[_0x21fc('0x22')](respondWithResult(_0x52bd4d,null))[_0x21fc('0x3e')](handleError(_0x52bd4d,null));};exports[_0x21fc('0x23')]=function(_0xbf1f7b,_0x54a3ff){return db[_0x21fc('0x3b')][_0x21fc('0x43')]({'where':{'id':_0xbf1f7b[_0x21fc('0x40')]['id']}})[_0x21fc('0x22')](handleEntityNotFound(_0x54a3ff,null))['then'](removeEntity(_0x54a3ff,null))[_0x21fc('0x3e')](handleError(_0x54a3ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 2c42fd0..af41425 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 _0x3c91=['idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','freshsales_unique_index'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x3c91,0x1af));var _0x13c9=function(_0x110bbb,_0x55d31d){_0x110bbb=_0x110bbb-0x0;var _0x531ba9=_0x3c91[_0x110bbb];return _0x531ba9;};'use strict';var _=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var logger=require(_0x13c9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x13c9('0x3'));var rp=require(_0x13c9('0x4'));var fs=require('fs');var path=require(_0x13c9('0x5'));var rimraf=require('rimraf');var config=require(_0x13c9('0x6'));var attributes=require(_0x13c9('0x7'));module[_0x13c9('0x8')]=function(_0x8eedb,_0x1c6771){return _0x8eedb['define']('FreshsalesField',attributes,{'tableName':_0x13c9('0x9'),'paranoid':![],'indexes':[{'name':_0x13c9('0xa'),'fields':[_0x13c9('0xb'),_0x13c9('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5c9=['define','int_freshsales_fields','idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','exports'];(function(_0x35f3f3,_0x2f34cc){var _0xab1111=function(_0x20328b){while(--_0x20328b){_0x35f3f3['push'](_0x35f3f3['shift']());}};_0xab1111(++_0x2f34cc);}(_0xa5c9,0x143));var _0x9a5c=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xa5c9[_0x5b7788];return _0x573871;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var logger=require(_0x9a5c('0x2'))(_0x9a5c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9a5c('0x4'));var fs=require('fs');var path=require(_0x9a5c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0x9a5c('0x6')]=function(_0x2a697c,_0x2cac2a){return _0x2a697c[_0x9a5c('0x7')]('FreshsalesField',attributes,{'tableName':_0x9a5c('0x8'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x9a5c('0x9'),_0x9a5c('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index ea43432..bb2382a 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x9d9a2e,_0x8eea54){var _0x1602fb=function(_0x55ec7f){while(--_0x55ec7f){_0x9d9a2e['push'](_0x9d9a2e['shift']());}};_0x1602fb(++_0x8eea54);}(_0x326f,0xd1));var _0xf326=function(_0x27b698,_0x306f80){_0x27b698=_0x27b698-0x0;var _0x365008=_0x326f[_0x27b698];return _0x365008;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xf494,0x1c6));var _0x4f49=function(_0x5aee77,_0x12fe71){_0x5aee77=_0x5aee77-0x0;var _0x1242e1=_0xf494[_0x5aee77];return _0x1242e1;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5204831..e7665b5 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2e88cd,_0x3e595d){var _0x5d9e0f=function(_0x37cc35){while(--_0x37cc35){_0x2e88cd['push'](_0x2e88cd['shift']());}};_0x5d9e0f(++_0x3e595d);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x1f95ba,_0x1d4a43){var _0x31ad4e=function(_0x1d0f7d){while(--_0x1d0f7d){_0x1f95ba['push'](_0x1f95ba['shift']());}};_0x31ad4e(++_0x1d4a43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 3ab8e6f..10a09ea 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 _0x235b=['integrationTab','sequelize','STRING','username','ENUM','newTab'];(function(_0x390733,_0x1e3d32){var _0x33beb9=function(_0x4491a3){while(--_0x4491a3){_0x390733['push'](_0x390733['shift']());}};_0x33beb9(++_0x1e3d32);}(_0x235b,0x1ed));var _0xb235=function(_0x3c842a,_0xc4874d){_0x3c842a=_0x3c842a-0x0;var _0x22791a=_0x235b[_0x3c842a];return _0x22791a;};'use strict';var Sequelize=require(_0xb235('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb235('0x1')]},'username':{'type':Sequelize[_0xb235('0x1')],'unique':_0xb235('0x2')},'remoteUri':{'type':Sequelize[_0xb235('0x1')]},'password':{'type':Sequelize[_0xb235('0x1')]},'clientId':{'type':Sequelize[_0xb235('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xb235('0x1')]},'serverUrl':{'type':Sequelize[_0xb235('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xb235('0x3')]('integrationTab',_0xb235('0x4')),'defaultValue':_0xb235('0x5')}}; \ No newline at end of file +var _0x87e5=['STRING','integrationTab','newTab','sequelize','exports'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x87e5,0xc1));var _0x587e=function(_0xbf1132,_0x176b34){_0xbf1132=_0xbf1132-0x0;var _0xe63ce4=_0x87e5[_0xbf1132];return _0xe63ce4;};'use strict';var Sequelize=require(_0x587e('0x0'));module[_0x587e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x587e('0x2')]},'username':{'type':Sequelize[_0x587e('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x587e('0x2')]},'password':{'type':Sequelize[_0x587e('0x2')]},'clientId':{'type':Sequelize[_0x587e('0x2')]},'clientSecret':{'type':Sequelize[_0x587e('0x2')]},'securityToken':{'type':Sequelize[_0x587e('0x2')]},'serverUrl':{'type':Sequelize[_0x587e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x587e('0x3'),_0x587e('0x4')),'defaultValue':_0x587e('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2fb6d46..e60ce2d 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 _0xa04b=['send','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','SalesforceAccount','includeAll','findAll','rows','catch','show','params','keys','length','include','create','body','findOne','SalesforceConfiguration','filter','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','slice','substring','lastIndexOf','login','password','securityToken','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','Description','int','email','textarea','remove','includes','custom','picklistValues','label','value','boolean','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','error','name'];(function(_0x1de2bd,_0x953fb){var _0x595960=function(_0xea260b){while(--_0xea260b){_0x1de2bd['push'](_0x1de2bd['shift']());}};_0x595960(++_0x953fb);}(_0xa04b,0x1b6));var _0xba04=function(_0x4b1375,_0x57b8a4){_0x4b1375=_0x4b1375-0x0;var _0x2bda3c=_0xa04b[_0x4b1375];return _0x2bda3c;};'use strict';var emlformat=require(_0xba04('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xba04('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba04('0x2'));var moment=require(_0xba04('0x3'));var BPromise=require(_0xba04('0x4'));var Mustache=require(_0xba04('0x5'));var util=require(_0xba04('0x6'));var path=require('path');var sox=require(_0xba04('0x7'));var csv=require(_0xba04('0x8'));var ejs=require(_0xba04('0x9'));var fs=require('fs');var fs_extra=require(_0xba04('0xa'));var _=require(_0xba04('0xb'));var squel=require(_0xba04('0xc'));var crypto=require('crypto');var jsforce=require(_0xba04('0xd'));var deskjs=require(_0xba04('0xe'));var toCsv=require(_0xba04('0x8'));var querystring=require(_0xba04('0xf'));var Papa=require(_0xba04('0x10'));var Redis=require(_0xba04('0x11'));var authService=require(_0xba04('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xba04('0x13'));var hardwareService=require(_0xba04('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xba04('0x15'));var config=require(_0xba04('0x16'));var licenseUtil=require(_0xba04('0x17'));var db=require(_0xba04('0x18'))['db'];var integrations=require(_0xba04('0x19'));function respondWithStatusCode(_0x13ef77,_0x212456){_0x212456=_0x212456||0xcc;return function(_0x39bbca){if(_0x39bbca){return _0x13ef77[_0xba04('0x1a')](_0x212456);}return _0x13ef77[_0xba04('0x1b')](_0x212456)[_0xba04('0x1c')]();};}function respondWithResult(_0x93cfb5,_0x16e53f){_0x16e53f=_0x16e53f||0xc8;return function(_0x2966e9){if(_0x2966e9){return _0x93cfb5[_0xba04('0x1b')](_0x16e53f)[_0xba04('0x1d')](_0x2966e9);}};}function respondWithFilteredResult(_0x1b80a9,_0x1382a2){return function(_0x254961){if(_0x254961){var _0x9370fb=typeof _0x1382a2['offset']===_0xba04('0x1e')&&typeof _0x1382a2['limit']==='undefined';var _0x492fa8=_0x254961['count'];var _0x517ca3=_0x9370fb?0x0:_0x1382a2[_0xba04('0x1f')];var _0xfd8ac0=_0x9370fb?_0x254961[_0xba04('0x20')]:_0x1382a2[_0xba04('0x1f')]+_0x1382a2[_0xba04('0x21')];var _0x5a4dd0;if(_0xfd8ac0>=_0x492fa8){_0xfd8ac0=_0x492fa8;_0x5a4dd0=0xc8;}else{_0x5a4dd0=0xce;}_0x1b80a9['status'](_0x5a4dd0);return _0x1b80a9[_0xba04('0x22')]('Content-Range',_0x517ca3+'-'+_0xfd8ac0+'/'+_0x492fa8)['json'](_0x254961);}return null;};}function patchUpdates(_0xdec040){return function(_0x19509b){try{jsonpatch[_0xba04('0x23')](_0x19509b,_0xdec040,!![]);}catch(_0x34c3eb){return BPromise[_0xba04('0x24')](_0x34c3eb);}return _0x19509b['save']();};}function saveUpdates(_0x168957,_0x14efc0){return function(_0x53ce6a){if(_0x53ce6a){return _0x53ce6a[_0xba04('0x25')](_0x168957)[_0xba04('0x26')](function(_0x3f69b6){return _0x3f69b6;});}return null;};}function removeEntity(_0x43c91a,_0x2e320f){return function(_0x193958){if(_0x193958){return _0x193958[_0xba04('0x27')]()[_0xba04('0x26')](function(){_0x43c91a[_0xba04('0x1b')](0xcc)[_0xba04('0x1c')]();});}};}function handleEntityNotFound(_0x4832d3,_0x29ea17){return function(_0x1fb95b){if(!_0x1fb95b){_0x4832d3['sendStatus'](0x194);}return _0x1fb95b;};}function handleError(_0x2bd644,_0x14e5b5){_0x14e5b5=_0x14e5b5||0x1f4;return function(_0x46e62b){logger[_0xba04('0x28')](_0x46e62b['stack']);if(_0x46e62b[_0xba04('0x29')]){delete _0x46e62b['name'];}_0x2bd644['status'](_0x14e5b5)[_0xba04('0x2a')](_0x46e62b);};}exports['index']=function(_0x4eeb2d,_0x59b75a){var _0x41bafe={},_0x2b30e5={},_0x32408e={'count':0x0,'rows':[]};var _0x4d8e6c=_['map'](db['SalesforceAccount'][_0xba04('0x2b')],function(_0x5220f6){return{'name':_0x5220f6[_0xba04('0x2c')],'type':_0x5220f6[_0xba04('0x2d')][_0xba04('0x2e')]};});_0x2b30e5[_0xba04('0x2f')]=_[_0xba04('0x30')](_0x4d8e6c,_0xba04('0x29'));_0x2b30e5[_0xba04('0x31')]=_['keys'](_0x4eeb2d[_0xba04('0x31')]);_0x2b30e5['filters']=_[_0xba04('0x32')](_0x2b30e5[_0xba04('0x2f')],_0x2b30e5['query']);_0x41bafe['attributes']=_[_0xba04('0x32')](_0x2b30e5['model'],qs[_0xba04('0x33')](_0x4eeb2d[_0xba04('0x31')]['fields']));_0x41bafe[_0xba04('0x34')]=_0x41bafe[_0xba04('0x34')]['length']?_0x41bafe[_0xba04('0x34')]:_0x2b30e5[_0xba04('0x2f')];if(!_0x4eeb2d[_0xba04('0x31')][_0xba04('0x35')](_0xba04('0x36'))){_0x41bafe[_0xba04('0x21')]=qs[_0xba04('0x21')](_0x4eeb2d['query'][_0xba04('0x21')]);_0x41bafe[_0xba04('0x1f')]=qs[_0xba04('0x1f')](_0x4eeb2d[_0xba04('0x31')][_0xba04('0x1f')]);}_0x41bafe[_0xba04('0x37')]=qs[_0xba04('0x38')](_0x4eeb2d[_0xba04('0x31')]['sort']);_0x41bafe[_0xba04('0x39')]=qs[_0xba04('0x3a')](_[_0xba04('0x3b')](_0x4eeb2d[_0xba04('0x31')],_0x2b30e5[_0xba04('0x3a')]),_0x4d8e6c);if(_0x4eeb2d['query']['filter']){_0x41bafe[_0xba04('0x39')]=_['merge'](_0x41bafe[_0xba04('0x39')],{'$or':_[_0xba04('0x30')](_0x4d8e6c,function(_0x229337){if(_0x229337['type']!==_0xba04('0x3c')){var _0x2c822a={};_0x2c822a[_0x229337[_0xba04('0x29')]]={'$like':'%'+_0x4eeb2d['query']['filter']+'%'};return _0x2c822a;}})});}_0x41bafe=_[_0xba04('0x3d')]({},_0x41bafe,_0x4eeb2d[_0xba04('0x3e')]);var _0x12f978={'where':_0x41bafe['where']};return db[_0xba04('0x3f')][_0xba04('0x20')](_0x12f978)[_0xba04('0x26')](function(_0xa23964){_0x32408e[_0xba04('0x20')]=_0xa23964;if(_0x4eeb2d[_0xba04('0x31')][_0xba04('0x40')]){_0x41bafe['include']=[{'all':!![]}];}return db['SalesforceAccount'][_0xba04('0x41')](_0x41bafe);})[_0xba04('0x26')](function(_0x46efde){_0x32408e[_0xba04('0x42')]=_0x46efde;return _0x32408e;})[_0xba04('0x26')](respondWithFilteredResult(_0x59b75a,_0x41bafe))[_0xba04('0x43')](handleError(_0x59b75a,null));};exports[_0xba04('0x44')]=function(_0x5df73c,_0x2b1fd0){var _0x4245b0={'raw':![],'where':{'id':_0x5df73c[_0xba04('0x45')]['id']}},_0x1dc904={};_0x1dc904[_0xba04('0x2f')]=_[_0xba04('0x46')](db[_0xba04('0x3f')][_0xba04('0x2b')]);_0x1dc904[_0xba04('0x31')]=_[_0xba04('0x46')](_0x5df73c[_0xba04('0x31')]);_0x1dc904[_0xba04('0x3a')]=_[_0xba04('0x32')](_0x1dc904['model'],_0x1dc904[_0xba04('0x31')]);_0x4245b0[_0xba04('0x34')]=_[_0xba04('0x32')](_0x1dc904[_0xba04('0x2f')],qs['fields'](_0x5df73c['query'][_0xba04('0x33')]));_0x4245b0[_0xba04('0x34')]=_0x4245b0[_0xba04('0x34')][_0xba04('0x47')]?_0x4245b0[_0xba04('0x34')]:_0x1dc904['model'];if(_0x5df73c[_0xba04('0x31')][_0xba04('0x40')]){_0x4245b0[_0xba04('0x48')]=[{'all':!![]}];}_0x4245b0=_['merge']({},_0x4245b0,_0x5df73c[_0xba04('0x3e')]);return db['SalesforceAccount']['find'](_0x4245b0)['then'](handleEntityNotFound(_0x2b1fd0,null))[_0xba04('0x26')](respondWithResult(_0x2b1fd0,null))['catch'](handleError(_0x2b1fd0,null));};exports[_0xba04('0x49')]=function(_0x1e2cbe,_0x3a9e26){return db[_0xba04('0x3f')]['create'](_0x1e2cbe[_0xba04('0x4a')],{})[_0xba04('0x26')](respondWithResult(_0x3a9e26,0xc9))['catch'](handleError(_0x3a9e26,null));};exports[_0xba04('0x25')]=function(_0x3d0d0b,_0x3c53c9){if(_0x3d0d0b['body']['id']){delete _0x3d0d0b[_0xba04('0x4a')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3d0d0b[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x3c53c9,null))['then'](saveUpdates(_0x3d0d0b['body'],null))[_0xba04('0x26')](respondWithResult(_0x3c53c9,null))[_0xba04('0x43')](handleError(_0x3c53c9,null));};exports[_0xba04('0x27')]=function(_0xc9c3b2,_0x73edff){return db[_0xba04('0x3f')]['find']({'where':{'id':_0xc9c3b2[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x73edff,null))['then'](removeEntity(_0x73edff,null))[_0xba04('0x43')](handleError(_0x73edff,null));};exports['getConfigurations']=function(_0xe0ea72,_0x389c7a,_0x54eb4c){var _0x1effd7={};var _0x3846e7={};var _0x1cbcab;var _0x23fe57;return db[_0xba04('0x3f')][_0xba04('0x4b')]({'where':{'id':_0xe0ea72['params']['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x389c7a,null))[_0xba04('0x26')](function(_0x1c94d8){if(_0x1c94d8){_0x1cbcab=_0x1c94d8;_0x3846e7[_0xba04('0x2f')]=_[_0xba04('0x46')](db[_0xba04('0x4c')]['rawAttributes']);_0x3846e7[_0xba04('0x31')]=_[_0xba04('0x46')](_0xe0ea72[_0xba04('0x31')]);_0x3846e7[_0xba04('0x3a')]=_[_0xba04('0x32')](_0x3846e7['model'],_0x3846e7[_0xba04('0x31')]);_0x1effd7['attributes']=_[_0xba04('0x32')](_0x3846e7['model'],qs[_0xba04('0x33')](_0xe0ea72[_0xba04('0x31')][_0xba04('0x33')]));_0x1effd7[_0xba04('0x34')]=_0x1effd7[_0xba04('0x34')]['length']?_0x1effd7[_0xba04('0x34')]:_0x3846e7[_0xba04('0x2f')];_0x1effd7['order']=qs['sort'](_0xe0ea72['query'][_0xba04('0x38')]);_0x1effd7['where']=qs[_0xba04('0x3a')](_['pick'](_0xe0ea72[_0xba04('0x31')],_0x3846e7[_0xba04('0x3a')]));if(_0xe0ea72[_0xba04('0x31')][_0xba04('0x4d')]){_0x1effd7[_0xba04('0x39')]=_[_0xba04('0x3d')](_0x1effd7[_0xba04('0x39')],{'$or':_[_0xba04('0x30')](_0x1effd7[_0xba04('0x34')],function(_0x431635){var _0x54e9d7={};_0x54e9d7[_0x431635]={'$like':'%'+_0xe0ea72['query'][_0xba04('0x4d')]+'%'};return _0x54e9d7;})});}_0x1effd7=_['merge']({},_0x1effd7,_0xe0ea72['options']);return _0x1cbcab[_0xba04('0x4e')](_0x1effd7);}})[_0xba04('0x26')](function(_0x437706){if(_0x437706){_0x23fe57=_0x437706[_0xba04('0x47')];if(!_0xe0ea72[_0xba04('0x31')][_0xba04('0x35')]('nolimit')){_0x1effd7['limit']=qs[_0xba04('0x21')](_0xe0ea72['query'][_0xba04('0x21')]);_0x1effd7['offset']=qs[_0xba04('0x1f')](_0xe0ea72[_0xba04('0x31')][_0xba04('0x1f')]);}return _0x1cbcab[_0xba04('0x4e')](_0x1effd7);}})[_0xba04('0x26')](function(_0x49901e){if(_0x49901e){return _0x49901e?{'count':_0x23fe57,'rows':_0x49901e}:null;}})[_0xba04('0x26')](respondWithResult(_0x389c7a,null))[_0xba04('0x43')](handleError(_0x389c7a,null));};exports['addConfiguration']=function(_0x3f3eb7,_0x156ddb,_0x321dc8){if(_0x3f3eb7[_0xba04('0x4a')]['id']){delete _0x3f3eb7[_0xba04('0x4a')]['id'];}return db[_0xba04('0x3f')]['findOne']({'where':{'id':_0x3f3eb7[_0xba04('0x45')]['id']}})[_0xba04('0x26')](handleEntityNotFound(_0x156ddb,null))[_0xba04('0x26')](function(_0x3f6f66){if(_0x3f6f66){_0x3f3eb7[_0xba04('0x4a')]['AccountId']=_0x3f6f66['id'];_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x4f')]=integrations[_0xba04('0x50')](_0x3f3eb7[_0xba04('0x4a')]['channel'],_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x2d')]);_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x51')]=integrations[_0xba04('0x52')](_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x53')],_0x3f3eb7[_0xba04('0x4a')][_0xba04('0x2d')]);return db[_0xba04('0x4c')][_0xba04('0x49')](_0x3f3eb7[_0xba04('0x4a')],{'include':[{'model':db[_0xba04('0x54')],'as':_0xba04('0x4f')},{'model':db[_0xba04('0x54')],'as':_0xba04('0x51')}]});}return null;})[_0xba04('0x26')](respondWithResult(_0x156ddb,null))[_0xba04('0x43')](handleError(_0x156ddb,null));};exports[_0xba04('0x55')]=function(_0x542d2f,_0x15b189,_0x47f759){var _0x544291;var _0x3f0c5e='';var _0x4c0b2d=_0xba04('0x56');return db[_0xba04('0x3f')]['findOne']({'where':{'id':_0x542d2f[_0xba04('0x45')]['id']},'attributes':['id',_0xba04('0x57'),_0xba04('0x58'),_0xba04('0x59'),_0xba04('0x5a'),'password','securityToken']})[_0xba04('0x26')](handleEntityNotFound(_0x15b189,null))['then'](function(_0x4e6229){if(_0x4e6229){_0x3f0c5e=_0x4e6229[_0xba04('0x57')];var _0x38d8e5=_0x3f0c5e[_0xba04('0x5b')](-0x1);if(_0x38d8e5==='/'){_0x3f0c5e=_0x3f0c5e[_0xba04('0x5c')](0x0,_0x3f0c5e[_0xba04('0x5d')](_0x38d8e5));}_0x544291=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3f0c5e,'clientId':_0x4e6229[_0xba04('0x58')],'clientSecret':_0x4e6229[_0xba04('0x59')]}});return _0x544291[_0xba04('0x5e')](_0x4e6229[_0xba04('0x5a')],_0x4e6229[_0xba04('0x5f')]['concat'](_0x4e6229[_0xba04('0x60')]));}})[_0xba04('0x26')](function(_0x50a14c){if(_0x50a14c){if(!_[_0xba04('0x61')](_0x542d2f['query'][_0xba04('0x62')])){_0x4c0b2d=_0x542d2f[_0xba04('0x31')][_0xba04('0x62')];}return _0x544291[_0xba04('0x63')](_0x4c0b2d)[_0xba04('0x64')]();}})[_0xba04('0x26')](function(_0x46a101){var _0x4252ce=[_0xba04('0x65'),'ActivityDate',_0xba04('0x66'),'IsRecurrence','Subject',_0xba04('0x67')];var _0x3839e0=['string',_0xba04('0x68'),'picklist','boolean',_0xba04('0x69'),_0xba04('0x6a'),'phone'];if(_0x46a101){_[_0xba04('0x6b')](_0x46a101[_0xba04('0x33')],function(_0x25b92f){return _0x4252ce[_0xba04('0x6c')](_0x25b92f[_0xba04('0x29')])||!_0x3839e0[_0xba04('0x6c')](_0x25b92f['type']);});return{'count':_0x46a101['fields'][_0xba04('0x47')],'rows':_[_0xba04('0x30')](_0x46a101[_0xba04('0x33')],function(_0x5ccdb2){return{'id':_0x5ccdb2[_0xba04('0x29')],'name':_0x5ccdb2['label'],'custom':_0x5ccdb2[_0xba04('0x6d')],'options':_0x5ccdb2['picklistValues'][_0xba04('0x47')]>0x0?_['map'](_0x5ccdb2[_0xba04('0x6e')],function(_0x143bea){return{'name':_0x143bea[_0xba04('0x6f')],'value':_0x143bea[_0xba04('0x70')]};}):_0x5ccdb2[_0xba04('0x2d')]==_0xba04('0x71')?[{'name':'True','value':_0xba04('0x72')},{'name':_0xba04('0x73'),'value':_0xba04('0x74')}]:[]};})};}})[_0xba04('0x26')](respondWithResult(_0x15b189,null))[_0xba04('0x43')](function(_0x396c14){var _0x3c8703=_0x542d2f['query']['test']?0x1f4:_0x396c14[_0xba04('0x75')]||0x1f4;logger[_0xba04('0x28')](_0xba04('0x76'),'getFields',_0x3c8703,JSON['stringify'](_0x396c14));delete _0x396c14[_0xba04('0x29')];if(_0x3c8703===0x191){_0x3c8703=0x190;}_0x15b189[_0xba04('0x1b')](_0x3c8703)[_0xba04('0x2a')](_0x542d2f[_0xba04('0x31')]['test']?{'message':_0xba04('0x77'),'statusCode':_0x396c14['statusCode']}:_0x396c14);});}; \ No newline at end of file +var _0xd506=['stringify','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','SalesforceAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','attributes','body','find','findOne','SalesforceConfiguration','sort','pick','getConfigurations','addConfiguration','Subjects','getSubjects','type','getDescriptions','channel','create','SalesforceField','Descriptions','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','slice','Connection','login','concat','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','true','False','false','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x2c005d,_0x436d24){var _0xf7c6eb=function(_0xb755af){while(--_0xb755af){_0x2c005d['push'](_0x2c005d['shift']());}};_0xf7c6eb(++_0x436d24);}(_0xd506,0x7f));var _0x6d50=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xd506[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x6d50('0x0'));var rimraf=require(_0x6d50('0x1'));var zipdir=require(_0x6d50('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6d50('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6d50('0x4'));var util=require(_0x6d50('0x5'));var path=require(_0x6d50('0x6'));var sox=require(_0x6d50('0x7'));var csv=require(_0x6d50('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d50('0x9'));var _=require(_0x6d50('0xa'));var squel=require(_0x6d50('0xb'));var crypto=require('crypto');var jsforce=require(_0x6d50('0xc'));var deskjs=require(_0x6d50('0xd'));var toCsv=require(_0x6d50('0x8'));var querystring=require(_0x6d50('0xe'));var Papa=require(_0x6d50('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d50('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d50('0x11'));var logger=require('../../config/logger')(_0x6d50('0x12'));var utils=require(_0x6d50('0x13'));var config=require(_0x6d50('0x14'));var licenseUtil=require(_0x6d50('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6d50('0x16'));function respondWithStatusCode(_0x226a53,_0x400daa){_0x400daa=_0x400daa||0xcc;return function(_0x578a42){if(_0x578a42){return _0x226a53[_0x6d50('0x17')](_0x400daa);}return _0x226a53['status'](_0x400daa)[_0x6d50('0x18')]();};}function respondWithResult(_0x424807,_0x4d1e0b){_0x4d1e0b=_0x4d1e0b||0xc8;return function(_0x22460e){if(_0x22460e){return _0x424807[_0x6d50('0x19')](_0x4d1e0b)[_0x6d50('0x1a')](_0x22460e);}};}function respondWithFilteredResult(_0xaad3f6,_0x55f94c){return function(_0x39b9b0){if(_0x39b9b0){var _0x5e17a8=typeof _0x55f94c[_0x6d50('0x1b')]===_0x6d50('0x1c')&&typeof _0x55f94c['limit']===_0x6d50('0x1c');var _0xf8cbc8=_0x39b9b0[_0x6d50('0x1d')];var _0xe374e0=_0x5e17a8?0x0:_0x55f94c['offset'];var _0x4c25a3=_0x5e17a8?_0x39b9b0[_0x6d50('0x1d')]:_0x55f94c[_0x6d50('0x1b')]+_0x55f94c['limit'];var _0x4aee98;if(_0x4c25a3>=_0xf8cbc8){_0x4c25a3=_0xf8cbc8;_0x4aee98=0xc8;}else{_0x4aee98=0xce;}_0xaad3f6[_0x6d50('0x19')](_0x4aee98);return _0xaad3f6[_0x6d50('0x1e')](_0x6d50('0x1f'),_0xe374e0+'-'+_0x4c25a3+'/'+_0xf8cbc8)['json'](_0x39b9b0);}return null;};}function patchUpdates(_0xf6723f){return function(_0xef266d){try{jsonpatch[_0x6d50('0x20')](_0xef266d,_0xf6723f,!![]);}catch(_0x4d5695){return BPromise[_0x6d50('0x21')](_0x4d5695);}return _0xef266d['save']();};}function saveUpdates(_0x44e9b6,_0x33bcf3){return function(_0x38715e){if(_0x38715e){return _0x38715e[_0x6d50('0x22')](_0x44e9b6)[_0x6d50('0x23')](function(_0x25702d){return _0x25702d;});}return null;};}function removeEntity(_0x4b6cc5,_0x1f546a){return function(_0x2ba457){if(_0x2ba457){return _0x2ba457[_0x6d50('0x24')]()[_0x6d50('0x23')](function(){_0x4b6cc5[_0x6d50('0x19')](0xcc)[_0x6d50('0x18')]();});}};}function handleEntityNotFound(_0x3f8f70,_0x3e2806){return function(_0x1e4a2f){if(!_0x1e4a2f){_0x3f8f70['sendStatus'](0x194);}return _0x1e4a2f;};}function handleError(_0x47c666,_0x320bdf){_0x320bdf=_0x320bdf||0x1f4;return function(_0xa03aed){logger[_0x6d50('0x25')](_0xa03aed['stack']);if(_0xa03aed[_0x6d50('0x26')]){delete _0xa03aed[_0x6d50('0x26')];}_0x47c666[_0x6d50('0x19')](_0x320bdf)['send'](_0xa03aed);};}exports[_0x6d50('0x27')]=function(_0x567660,_0x1a3fd0){var _0x541385={},_0x4b1fcf={},_0x5a1423={'count':0x0,'rows':[]};var _0x24dfb4=_[_0x6d50('0x28')](db[_0x6d50('0x29')][_0x6d50('0x2a')],function(_0x452010){return{'name':_0x452010[_0x6d50('0x2b')],'type':_0x452010['type']['key']};});_0x4b1fcf[_0x6d50('0x2c')]=_[_0x6d50('0x28')](_0x24dfb4,_0x6d50('0x26'));_0x4b1fcf['query']=_[_0x6d50('0x2d')](_0x567660['query']);_0x4b1fcf[_0x6d50('0x2e')]=_[_0x6d50('0x2f')](_0x4b1fcf[_0x6d50('0x2c')],_0x4b1fcf[_0x6d50('0x30')]);_0x541385['attributes']=_[_0x6d50('0x2f')](_0x4b1fcf[_0x6d50('0x2c')],qs[_0x6d50('0x31')](_0x567660['query']['fields']));_0x541385['attributes']=_0x541385['attributes'][_0x6d50('0x32')]?_0x541385['attributes']:_0x4b1fcf[_0x6d50('0x2c')];if(!_0x567660[_0x6d50('0x30')][_0x6d50('0x33')](_0x6d50('0x34'))){_0x541385[_0x6d50('0x35')]=qs[_0x6d50('0x35')](_0x567660['query'][_0x6d50('0x35')]);_0x541385['offset']=qs[_0x6d50('0x1b')](_0x567660[_0x6d50('0x30')][_0x6d50('0x1b')]);}_0x541385[_0x6d50('0x36')]=qs['sort'](_0x567660[_0x6d50('0x30')]['sort']);_0x541385[_0x6d50('0x37')]=qs[_0x6d50('0x2e')](_['pick'](_0x567660['query'],_0x4b1fcf[_0x6d50('0x2e')]),_0x24dfb4);if(_0x567660[_0x6d50('0x30')][_0x6d50('0x38')]){_0x541385[_0x6d50('0x37')]=_['merge'](_0x541385[_0x6d50('0x37')],{'$or':_[_0x6d50('0x28')](_0x24dfb4,function(_0x186951){if(_0x186951['type']!=='VIRTUAL'){var _0x5cdd77={};_0x5cdd77[_0x186951[_0x6d50('0x26')]]={'$like':'%'+_0x567660[_0x6d50('0x30')][_0x6d50('0x38')]+'%'};return _0x5cdd77;}})});}_0x541385=_[_0x6d50('0x39')]({},_0x541385,_0x567660[_0x6d50('0x3a')]);var _0x263b8b={'where':_0x541385['where']};return db[_0x6d50('0x29')][_0x6d50('0x1d')](_0x263b8b)[_0x6d50('0x23')](function(_0x4dd9db){_0x5a1423['count']=_0x4dd9db;if(_0x567660[_0x6d50('0x30')][_0x6d50('0x3b')]){_0x541385[_0x6d50('0x3c')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x6d50('0x3d')](_0x541385);})[_0x6d50('0x23')](function(_0x3741b8){_0x5a1423[_0x6d50('0x3e')]=_0x3741b8;return _0x5a1423;})[_0x6d50('0x23')](respondWithFilteredResult(_0x1a3fd0,_0x541385))[_0x6d50('0x3f')](handleError(_0x1a3fd0,null));};exports['show']=function(_0x14ac33,_0x391cbc){var _0x230d02={'raw':![],'where':{'id':_0x14ac33[_0x6d50('0x40')]['id']}},_0x21133d={};_0x21133d[_0x6d50('0x2c')]=_[_0x6d50('0x2d')](db[_0x6d50('0x29')][_0x6d50('0x2a')]);_0x21133d[_0x6d50('0x30')]=_[_0x6d50('0x2d')](_0x14ac33[_0x6d50('0x30')]);_0x21133d['filters']=_[_0x6d50('0x2f')](_0x21133d[_0x6d50('0x2c')],_0x21133d[_0x6d50('0x30')]);_0x230d02[_0x6d50('0x41')]=_[_0x6d50('0x2f')](_0x21133d[_0x6d50('0x2c')],qs[_0x6d50('0x31')](_0x14ac33[_0x6d50('0x30')]['fields']));_0x230d02[_0x6d50('0x41')]=_0x230d02[_0x6d50('0x41')][_0x6d50('0x32')]?_0x230d02[_0x6d50('0x41')]:_0x21133d[_0x6d50('0x2c')];if(_0x14ac33['query']['includeAll']){_0x230d02[_0x6d50('0x3c')]=[{'all':!![]}];}_0x230d02=_['merge']({},_0x230d02,_0x14ac33[_0x6d50('0x3a')]);return db[_0x6d50('0x29')]['find'](_0x230d02)[_0x6d50('0x23')](handleEntityNotFound(_0x391cbc,null))[_0x6d50('0x23')](respondWithResult(_0x391cbc,null))[_0x6d50('0x3f')](handleError(_0x391cbc,null));};exports['create']=function(_0x8d775a,_0x5b5d22){return db['SalesforceAccount']['create'](_0x8d775a[_0x6d50('0x42')],{})[_0x6d50('0x23')](respondWithResult(_0x5b5d22,0xc9))['catch'](handleError(_0x5b5d22,null));};exports[_0x6d50('0x22')]=function(_0x52c1a0,_0x5e2920){if(_0x52c1a0[_0x6d50('0x42')]['id']){delete _0x52c1a0[_0x6d50('0x42')]['id'];}return db[_0x6d50('0x29')]['find']({'where':{'id':_0x52c1a0[_0x6d50('0x40')]['id']}})[_0x6d50('0x23')](handleEntityNotFound(_0x5e2920,null))[_0x6d50('0x23')](saveUpdates(_0x52c1a0[_0x6d50('0x42')],null))[_0x6d50('0x23')](respondWithResult(_0x5e2920,null))[_0x6d50('0x3f')](handleError(_0x5e2920,null));};exports[_0x6d50('0x24')]=function(_0x1cfb49,_0x4181d1){return db[_0x6d50('0x29')][_0x6d50('0x43')]({'where':{'id':_0x1cfb49['params']['id']}})[_0x6d50('0x23')](handleEntityNotFound(_0x4181d1,null))['then'](removeEntity(_0x4181d1,null))['catch'](handleError(_0x4181d1,null));};exports['getConfigurations']=function(_0x4a3916,_0x3f23b8,_0x1fda57){var _0x538efe={};var _0x7ce88={};var _0x7b1d96;var _0x1a9590;return db[_0x6d50('0x29')][_0x6d50('0x44')]({'where':{'id':_0x4a3916[_0x6d50('0x40')]['id']}})[_0x6d50('0x23')](handleEntityNotFound(_0x3f23b8,null))['then'](function(_0x3216f1){if(_0x3216f1){_0x7b1d96=_0x3216f1;_0x7ce88[_0x6d50('0x2c')]=_['keys'](db[_0x6d50('0x45')]['rawAttributes']);_0x7ce88['query']=_['keys'](_0x4a3916['query']);_0x7ce88[_0x6d50('0x2e')]=_[_0x6d50('0x2f')](_0x7ce88[_0x6d50('0x2c')],_0x7ce88[_0x6d50('0x30')]);_0x538efe[_0x6d50('0x41')]=_[_0x6d50('0x2f')](_0x7ce88[_0x6d50('0x2c')],qs[_0x6d50('0x31')](_0x4a3916['query']['fields']));_0x538efe[_0x6d50('0x41')]=_0x538efe[_0x6d50('0x41')][_0x6d50('0x32')]?_0x538efe[_0x6d50('0x41')]:_0x7ce88['model'];_0x538efe[_0x6d50('0x36')]=qs[_0x6d50('0x46')](_0x4a3916['query']['sort']);_0x538efe[_0x6d50('0x37')]=qs[_0x6d50('0x2e')](_[_0x6d50('0x47')](_0x4a3916['query'],_0x7ce88[_0x6d50('0x2e')]));if(_0x4a3916[_0x6d50('0x30')][_0x6d50('0x38')]){_0x538efe[_0x6d50('0x37')]=_[_0x6d50('0x39')](_0x538efe[_0x6d50('0x37')],{'$or':_[_0x6d50('0x28')](_0x538efe[_0x6d50('0x41')],function(_0x1728d9){var _0x4d54f0={};_0x4d54f0[_0x1728d9]={'$like':'%'+_0x4a3916['query'][_0x6d50('0x38')]+'%'};return _0x4d54f0;})});}_0x538efe=_['merge']({},_0x538efe,_0x4a3916[_0x6d50('0x3a')]);return _0x7b1d96[_0x6d50('0x48')](_0x538efe);}})[_0x6d50('0x23')](function(_0x41ea48){if(_0x41ea48){_0x1a9590=_0x41ea48[_0x6d50('0x32')];if(!_0x4a3916['query'][_0x6d50('0x33')]('nolimit')){_0x538efe['limit']=qs[_0x6d50('0x35')](_0x4a3916['query'][_0x6d50('0x35')]);_0x538efe[_0x6d50('0x1b')]=qs[_0x6d50('0x1b')](_0x4a3916[_0x6d50('0x30')][_0x6d50('0x1b')]);}return _0x7b1d96[_0x6d50('0x48')](_0x538efe);}})[_0x6d50('0x23')](function(_0x3ee4cf){if(_0x3ee4cf){return _0x3ee4cf?{'count':_0x1a9590,'rows':_0x3ee4cf}:null;}})[_0x6d50('0x23')](respondWithResult(_0x3f23b8,null))[_0x6d50('0x3f')](handleError(_0x3f23b8,null));};exports[_0x6d50('0x49')]=function(_0x3cb88a,_0x1a302c,_0x401ab4){if(_0x3cb88a['body']['id']){delete _0x3cb88a['body']['id'];}return db[_0x6d50('0x29')][_0x6d50('0x44')]({'where':{'id':_0x3cb88a[_0x6d50('0x40')]['id']}})[_0x6d50('0x23')](handleEntityNotFound(_0x1a302c,null))['then'](function(_0x2f9743){if(_0x2f9743){_0x3cb88a[_0x6d50('0x42')]['AccountId']=_0x2f9743['id'];_0x3cb88a[_0x6d50('0x42')][_0x6d50('0x4a')]=integrations[_0x6d50('0x4b')](_0x3cb88a[_0x6d50('0x42')]['channel'],_0x3cb88a[_0x6d50('0x42')][_0x6d50('0x4c')]);_0x3cb88a[_0x6d50('0x42')]['Descriptions']=integrations[_0x6d50('0x4d')](_0x3cb88a['body'][_0x6d50('0x4e')],_0x3cb88a[_0x6d50('0x42')][_0x6d50('0x4c')]);return db[_0x6d50('0x45')][_0x6d50('0x4f')](_0x3cb88a[_0x6d50('0x42')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x6d50('0x50')],'as':_0x6d50('0x51')}]});}return null;})[_0x6d50('0x23')](respondWithResult(_0x1a302c,null))[_0x6d50('0x3f')](handleError(_0x1a302c,null));};exports[_0x6d50('0x52')]=function(_0x2c194e,_0xf80e1,_0xb315b){var _0x5eb585;var _0x434ce4='';var _0x3acb8=_0x6d50('0x53');return db[_0x6d50('0x29')][_0x6d50('0x44')]({'where':{'id':_0x2c194e[_0x6d50('0x40')]['id']},'attributes':['id',_0x6d50('0x54'),_0x6d50('0x55'),_0x6d50('0x56'),'username',_0x6d50('0x57'),_0x6d50('0x58')]})['then'](handleEntityNotFound(_0xf80e1,null))[_0x6d50('0x23')](function(_0x155abc){if(_0x155abc){_0x434ce4=_0x155abc[_0x6d50('0x54')];var _0x1e9d6a=_0x434ce4[_0x6d50('0x59')](-0x1);if(_0x1e9d6a==='/'){_0x434ce4=_0x434ce4['substring'](0x0,_0x434ce4['lastIndexOf'](_0x1e9d6a));}_0x5eb585=new jsforce[(_0x6d50('0x5a'))]({'oauth2':{'loginUrl':_0x434ce4,'clientId':_0x155abc['clientId'],'clientSecret':_0x155abc[_0x6d50('0x56')]}});return _0x5eb585[_0x6d50('0x5b')](_0x155abc['username'],_0x155abc[_0x6d50('0x57')][_0x6d50('0x5c')](_0x155abc['securityToken']));}})[_0x6d50('0x23')](function(_0x25cd76){if(_0x25cd76){if(!_['isNil'](_0x2c194e[_0x6d50('0x30')][_0x6d50('0x5d')])){_0x3acb8=_0x2c194e['query'][_0x6d50('0x5d')];}return _0x5eb585[_0x6d50('0x5e')](_0x3acb8)[_0x6d50('0x5f')]();}})['then'](function(_0x561e42){var _0x5f0568=[_0x6d50('0x60'),_0x6d50('0x61'),_0x6d50('0x62'),_0x6d50('0x63'),_0x6d50('0x64'),_0x6d50('0x65')];var _0x24c69e=[_0x6d50('0x66'),_0x6d50('0x67'),_0x6d50('0x68'),_0x6d50('0x69'),_0x6d50('0x6a'),_0x6d50('0x6b'),_0x6d50('0x6c')];if(_0x561e42){_[_0x6d50('0x6d')](_0x561e42[_0x6d50('0x31')],function(_0x29ffce){return _0x5f0568[_0x6d50('0x6e')](_0x29ffce['name'])||!_0x24c69e[_0x6d50('0x6e')](_0x29ffce['type']);});return{'count':_0x561e42['fields'][_0x6d50('0x32')],'rows':_[_0x6d50('0x28')](_0x561e42[_0x6d50('0x31')],function(_0x567090){return{'id':_0x567090[_0x6d50('0x26')],'name':_0x567090[_0x6d50('0x6f')],'custom':_0x567090[_0x6d50('0x70')],'options':_0x567090[_0x6d50('0x71')]['length']>0x0?_[_0x6d50('0x28')](_0x567090['picklistValues'],function(_0x59a428){return{'name':_0x59a428[_0x6d50('0x6f')],'value':_0x59a428[_0x6d50('0x72')]};}):_0x567090[_0x6d50('0x4c')]==_0x6d50('0x69')?[{'name':'True','value':_0x6d50('0x73')},{'name':_0x6d50('0x74'),'value':_0x6d50('0x75')}]:[]};})};}})['then'](respondWithResult(_0xf80e1,null))['catch'](function(_0x130156){var _0x550556=_0x2c194e[_0x6d50('0x30')]['test']?0x1f4:_0x130156['statusCode']||0x1f4;logger['error'](_0x6d50('0x76'),_0x6d50('0x52'),_0x550556,JSON[_0x6d50('0x77')](_0x130156));delete _0x130156[_0x6d50('0x26')];if(_0x550556===0x191){_0x550556=0x190;}_0xf80e1[_0x6d50('0x19')](_0x550556)[_0x6d50('0x78')](_0x2c194e[_0x6d50('0x30')]['test']?{'message':_0x6d50('0x79'),'statusCode':_0x130156[_0x6d50('0x7a')]}:_0x130156);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 9b8dbbd..c79d574 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 _0x1d1a=['api','bluebird','rimraf','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x440d4c,_0x5ea9e1){var _0x21fba9=function(_0x13d8ce){while(--_0x13d8ce){_0x440d4c['push'](_0x440d4c['shift']());}};_0x21fba9(++_0x5ea9e1);}(_0x1d1a,0x1da));var _0xa1d1=function(_0x139601,_0x401cb7){_0x139601=_0x139601-0x0;var _0x32f2b3=_0x1d1a[_0x139601];return _0x32f2b3;};'use strict';var _=require(_0xa1d1('0x0'));var util=require(_0xa1d1('0x1'));var logger=require(_0xa1d1('0x2'))(_0xa1d1('0x3'));var moment=require('moment');var BPromise=require(_0xa1d1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa1d1('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xa1d1('0x6'));module['exports']=function(_0x28b41b,_0x39b92b){return _0x28b41b[_0xa1d1('0x7')]('SalesforceAccount',attributes,{'tableName':_0xa1d1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e85=['request-promise','rimraf','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x467ed7,_0x5f3c23){var _0x4572d2=function(_0x8ccf07){while(--_0x8ccf07){_0x467ed7['push'](_0x467ed7['shift']());}};_0x4572d2(++_0x5f3c23);}(_0x2e85,0x165));var _0x52e8=function(_0x444739,_0x253f55){_0x444739=_0x444739-0x0;var _0x272d83=_0x2e85[_0x444739];return _0x272d83;};'use strict';var _=require(_0x52e8('0x0'));var util=require(_0x52e8('0x1'));var logger=require(_0x52e8('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52e8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52e8('0x4'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x52e8('0x5'));module[_0x52e8('0x6')]=function(_0x324709,_0x366d87){return _0x324709[_0x52e8('0x7')](_0x52e8('0x8'),attributes,{'tableName':_0x52e8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 83e6b71..f7db575 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 _0x7b72=['../../config/utils','../../config/logger','../../config/environment','http','request','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','where','attributes','limit','include','model','map','info','find','then','ShowSalesforceAccount','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d1d77,_0xbf807){var _0x463a5f=function(_0x2452ce){while(--_0x2452ce){_0x1d1d77['push'](_0x1d1d77['shift']());}};_0x463a5f(++_0xbf807);}(_0x7b72,0x1ea));var _0x27b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x27b7('0x0'));var BPromise=require(_0x27b7('0x1'));var rs=require(_0x27b7('0x2'));var fs=require('fs');var Redis=require(_0x27b7('0x3'));var db=require(_0x27b7('0x4'))['db'];var utils=require(_0x27b7('0x5'));var logger=require(_0x27b7('0x6'))('rpc');var config=require(_0x27b7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x27b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d6d59,_0x34e503,_0x441deb){return new BPromise(function(_0x5af4f1,_0x57b833){return client[_0x27b7('0x9')](_0x3d6d59,_0x441deb)['then'](function(_0x3dc9c8){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x34e503,_0x27b7('0xa'));logger[_0x27b7('0xb')](_0x27b7('0xc'),_0x34e503,_0x27b7('0xa'),JSON[_0x27b7('0xd')](_0x3dc9c8));if(_0x3dc9c8[_0x27b7('0xe')]){if(_0x3dc9c8[_0x27b7('0xe')][_0x27b7('0xf')]===0x1f4){logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x3dc9c8[_0x27b7('0xe')]['message']);return _0x57b833(_0x3dc9c8[_0x27b7('0xe')]['message']);}logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x3dc9c8[_0x27b7('0xe')][_0x27b7('0x11')]);return _0x5af4f1(_0x3dc9c8['error'][_0x27b7('0x11')]);}else{logger['info'](_0x27b7('0x10'),_0x34e503,'request\x20sent');_0x5af4f1(_0x3dc9c8[_0x27b7('0x12')][_0x27b7('0x11')]);}})[_0x27b7('0x13')](function(_0x2085ac){logger[_0x27b7('0xe')](_0x27b7('0x10'),_0x34e503,_0x2085ac);_0x57b833(_0x2085ac);});});}exports[_0x27b7('0x14')]=function(_0x8ba19b){var _0x39af49=this;return new Promise(function(_0x362bf6,_0x3b83d7){return db['SalesforceAccount'][_0x27b7('0x15')]({'raw':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x17')]||null:null,'attributes':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b['options'][_0x27b7('0x18')]||null:null,'limit':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x19')]||null:null,'include':_0x8ba19b[_0x27b7('0x16')]?_0x8ba19b[_0x27b7('0x16')][_0x27b7('0x1a')]?_['map'](_0x8ba19b[_0x27b7('0x16')]['include'],function(_0x114241){return{'model':db[_0x114241[_0x27b7('0x1b')]],'as':_0x114241['as'],'attributes':_0x114241[_0x27b7('0x18')],'include':_0x114241[_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0x114241[_0x27b7('0x1a')],function(_0x1ab99d){return{'model':db[_0x1ab99d[_0x27b7('0x1b')]],'as':_0x1ab99d['as'],'attributes':_0x1ab99d[_0x27b7('0x18')],'include':_0x1ab99d[_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0x1ab99d[_0x27b7('0x1a')],function(_0x524f7f){return{'model':db[_0x524f7f[_0x27b7('0x1b')]],'as':_0x524f7f['as'],'attributes':_0x524f7f[_0x27b7('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c2011){logger[_0x27b7('0x1d')](_0x27b7('0x14'),_0x8ba19b);logger['debug']('GetSalesforceAccount',_0x8ba19b,JSON['stringify'](_0x4c2011));_0x362bf6(_0x4c2011);})[_0x27b7('0x13')](function(_0x5d2120){logger[_0x27b7('0xe')](_0x27b7('0x14'),_0x5d2120[_0x27b7('0x11')],_0x8ba19b);_0x3b83d7(_0x39af49[_0x27b7('0xe')](0x1f4,_0x5d2120[_0x27b7('0x11')]));});});};exports['ShowSalesforceAccount']=function(_0xdb3fa7){var _0x10915d=this;return new Promise(function(_0x30d8cd,_0x50edcb){return db['SalesforceAccount'][_0x27b7('0x1e')]({'raw':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xdb3fa7[_0x27b7('0x16')]?_0xdb3fa7[_0x27b7('0x16')]['where']||null:null,'attributes':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')][_0x27b7('0x18')]||null:null,'include':_0xdb3fa7['options']?_0xdb3fa7[_0x27b7('0x16')][_0x27b7('0x1a')]?_[_0x27b7('0x1c')](_0xdb3fa7[_0x27b7('0x16')]['include'],function(_0x315f93){return{'model':db[_0x315f93['model']],'as':_0x315f93['as'],'attributes':_0x315f93[_0x27b7('0x18')],'include':_0x315f93[_0x27b7('0x1a')]?_['map'](_0x315f93[_0x27b7('0x1a')],function(_0x5852b3){return{'model':db[_0x5852b3[_0x27b7('0x1b')]],'as':_0x5852b3['as'],'attributes':_0x5852b3[_0x27b7('0x18')],'include':_0x5852b3['include']?_[_0x27b7('0x1c')](_0x5852b3['include'],function(_0x28e35c){return{'model':db[_0x28e35c['model']],'as':_0x28e35c['as'],'attributes':_0x28e35c[_0x27b7('0x18')]};}):[]};}):[]};}):[]:[]})[_0x27b7('0x1f')](function(_0x353592){logger['info'](_0x27b7('0x20'),_0xdb3fa7);logger[_0x27b7('0xb')](_0x27b7('0x20'),_0xdb3fa7,JSON[_0x27b7('0xd')](_0x353592));_0x30d8cd(_0x353592);})[_0x27b7('0x13')](function(_0x26b181){logger[_0x27b7('0xe')](_0x27b7('0x20'),_0x26b181[_0x27b7('0x11')],_0xdb3fa7);_0x50edcb(_0x10915d[_0x27b7('0xe')](0x1f4,_0x26b181[_0x27b7('0x11')]));});});}; \ No newline at end of file +var _0xae75=['jayson/promise','client','http','then','request\x20sent','debug','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','findAll','options','raw','where','attributes','limit','include','map','model','GetSalesforceAccount','stringify','catch','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x18e535,_0x4b96e5){var _0x39fe48=function(_0xc3c65){while(--_0xc3c65){_0x18e535['push'](_0x18e535['shift']());}};_0x39fe48(++_0x4b96e5);}(_0xae75,0xce));var _0x5ae7=function(_0x4f98f0,_0x107a88){_0x4f98f0=_0x4f98f0-0x0;var _0x3fef3c=_0xae75[_0x4f98f0];return _0x3fef3c;};'use strict';var _=require(_0x5ae7('0x0'));var util=require(_0x5ae7('0x1'));var moment=require('moment');var BPromise=require(_0x5ae7('0x2'));var rs=require(_0x5ae7('0x3'));var fs=require('fs');var Redis=require(_0x5ae7('0x4'));var db=require(_0x5ae7('0x5'))['db'];var utils=require(_0x5ae7('0x6'));var logger=require(_0x5ae7('0x7'))(_0x5ae7('0x8'));var config=require(_0x5ae7('0x9'));var jayson=require(_0x5ae7('0xa'));var client=jayson[_0x5ae7('0xb')][_0x5ae7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c8813,_0x25faef,_0x10276c){return new BPromise(function(_0x20cf0b,_0x2f013b){return client['request'](_0x3c8813,_0x10276c)[_0x5ae7('0xd')](function(_0x246246){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x25faef,_0x5ae7('0xe'));logger[_0x5ae7('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x25faef,_0x5ae7('0xe'),JSON['stringify'](_0x246246));if(_0x246246[_0x5ae7('0x10')]){if(_0x246246['error'][_0x5ae7('0x11')]===0x1f4){logger[_0x5ae7('0x10')](_0x5ae7('0x12'),_0x25faef,_0x246246[_0x5ae7('0x10')][_0x5ae7('0x13')]);return _0x2f013b(_0x246246[_0x5ae7('0x10')]['message']);}logger[_0x5ae7('0x10')](_0x5ae7('0x12'),_0x25faef,_0x246246['error'][_0x5ae7('0x13')]);return _0x20cf0b(_0x246246[_0x5ae7('0x10')][_0x5ae7('0x13')]);}else{logger[_0x5ae7('0x14')](_0x5ae7('0x12'),_0x25faef,_0x5ae7('0xe'));_0x20cf0b(_0x246246[_0x5ae7('0x15')][_0x5ae7('0x13')]);}})['catch'](function(_0x3c4568){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x25faef,_0x3c4568);_0x2f013b(_0x3c4568);});});}exports['GetSalesforceAccount']=function(_0xc45620){var _0x540d5f=this;return new Promise(function(_0x58e8ab,_0x50b42b){return db['SalesforceAccount'][_0x5ae7('0x16')]({'raw':_0xc45620[_0x5ae7('0x17')]?_0xc45620[_0x5ae7('0x17')][_0x5ae7('0x18')]===undefined?!![]:![]:!![],'where':_0xc45620['options']?_0xc45620[_0x5ae7('0x17')][_0x5ae7('0x19')]||null:null,'attributes':_0xc45620[_0x5ae7('0x17')]?_0xc45620[_0x5ae7('0x17')][_0x5ae7('0x1a')]||null:null,'limit':_0xc45620[_0x5ae7('0x17')]?_0xc45620[_0x5ae7('0x17')][_0x5ae7('0x1b')]||null:null,'include':_0xc45620[_0x5ae7('0x17')]?_0xc45620[_0x5ae7('0x17')][_0x5ae7('0x1c')]?_[_0x5ae7('0x1d')](_0xc45620[_0x5ae7('0x17')]['include'],function(_0x2a7976){return{'model':db[_0x2a7976[_0x5ae7('0x1e')]],'as':_0x2a7976['as'],'attributes':_0x2a7976[_0x5ae7('0x1a')],'include':_0x2a7976[_0x5ae7('0x1c')]?_[_0x5ae7('0x1d')](_0x2a7976['include'],function(_0x33f214){return{'model':db[_0x33f214[_0x5ae7('0x1e')]],'as':_0x33f214['as'],'attributes':_0x33f214[_0x5ae7('0x1a')],'include':_0x33f214[_0x5ae7('0x1c')]?_[_0x5ae7('0x1d')](_0x33f214['include'],function(_0x32cba7){return{'model':db[_0x32cba7[_0x5ae7('0x1e')]],'as':_0x32cba7['as'],'attributes':_0x32cba7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5ae7('0xd')](function(_0x1c0402){logger[_0x5ae7('0x14')](_0x5ae7('0x1f'),_0xc45620);logger[_0x5ae7('0xf')](_0x5ae7('0x1f'),_0xc45620,JSON[_0x5ae7('0x20')](_0x1c0402));_0x58e8ab(_0x1c0402);})[_0x5ae7('0x21')](function(_0x22ae24){logger['error'](_0x5ae7('0x1f'),_0x22ae24[_0x5ae7('0x13')],_0xc45620);_0x50b42b(_0x540d5f[_0x5ae7('0x10')](0x1f4,_0x22ae24[_0x5ae7('0x13')]));});});};exports[_0x5ae7('0x22')]=function(_0x37842c){var _0x28efdc=this;return new Promise(function(_0x4b2c12,_0x59e9f1){return db['SalesforceAccount'][_0x5ae7('0x23')]({'raw':_0x37842c[_0x5ae7('0x17')]?_0x37842c[_0x5ae7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x37842c[_0x5ae7('0x17')]?_0x37842c['options'][_0x5ae7('0x19')]||null:null,'attributes':_0x37842c[_0x5ae7('0x17')]?_0x37842c[_0x5ae7('0x17')][_0x5ae7('0x1a')]||null:null,'include':_0x37842c[_0x5ae7('0x17')]?_0x37842c[_0x5ae7('0x17')][_0x5ae7('0x1c')]?_['map'](_0x37842c[_0x5ae7('0x17')]['include'],function(_0x5a2046){return{'model':db[_0x5a2046['model']],'as':_0x5a2046['as'],'attributes':_0x5a2046[_0x5ae7('0x1a')],'include':_0x5a2046[_0x5ae7('0x1c')]?_[_0x5ae7('0x1d')](_0x5a2046[_0x5ae7('0x1c')],function(_0x51e05a){return{'model':db[_0x51e05a[_0x5ae7('0x1e')]],'as':_0x51e05a['as'],'attributes':_0x51e05a[_0x5ae7('0x1a')],'include':_0x51e05a[_0x5ae7('0x1c')]?_[_0x5ae7('0x1d')](_0x51e05a[_0x5ae7('0x1c')],function(_0x4269fe){return{'model':db[_0x4269fe[_0x5ae7('0x1e')]],'as':_0x4269fe['as'],'attributes':_0x4269fe[_0x5ae7('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ae7('0xd')](function(_0x82f210){logger[_0x5ae7('0x14')](_0x5ae7('0x22'),_0x37842c);logger[_0x5ae7('0xf')](_0x5ae7('0x22'),_0x37842c,JSON['stringify'](_0x82f210));_0x4b2c12(_0x82f210);})[_0x5ae7('0x21')](function(_0x4d4e32){logger[_0x5ae7('0x10')]('ShowSalesforceAccount',_0x4d4e32['message'],_0x37842c);_0x59e9f1(_0x28efdc[_0x5ae7('0x10')](0x1f4,_0x4d4e32[_0x5ae7('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 728397f..67eb803 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 _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(_0x3609ef,_0xb951ab){var _0x370d91=function(_0x3039c6){while(--_0x3039c6){_0x3609ef['push'](_0x3609ef['shift']());}};_0x370d91(++_0xb951ab);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f1d4d,_0x55dfd6){_0x5f1d4d=_0x5f1d4d-0x0;var _0x4c55ef=_0x2ef3[_0x5f1d4d];return _0x4c55ef;};'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 +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xdb28,0x106));var _0x8db2=function(_0x47689b,_0x3b0a64){_0x47689b=_0x47689b-0x0;var _0x395a93=_0xdb28[_0x47689b];return _0x395a93;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index a881c23..a6c4102 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 _0x2934=['Case','contact_lead','lead','account_contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x2934,0x74));var _0x4293=function(_0x515189,_0x4512f9){_0x515189=_0x515189-0x0;var _0x323b51=_0x2934[_0x515189];return _0x323b51;};'use strict';var Sequelize=require(_0x4293('0x0'));module[_0x4293('0x1')]={'name':{'type':Sequelize[_0x4293('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x4'),_0x4293('0x5')),'defaultValue':_0x4293('0x4')},'moduleSearch':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x6'),'contact',_0x4293('0x7'),_0x4293('0x8'),'account'),'defaultValue':_0x4293('0x6')},'moduleCreate':{'type':Sequelize[_0x4293('0x3')](_0x4293('0x9'),'contact',_0x4293('0x7'),_0x4293('0xa')),'defaultValue':_0x4293('0x7')},'leadId':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x4293('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7915=['Task','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','exports','STRING','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7915,0x1a9));var _0x5791=function(_0x583356,_0x50fc71){_0x583356=_0x583356-0x0;var _0x2b4ad0=_0x7915[_0x583356];return _0x2b4ad0;};'use strict';var Sequelize=require(_0x5791('0x0'));module[_0x5791('0x1')]={'name':{'type':Sequelize[_0x5791('0x2')]},'description':{'type':Sequelize[_0x5791('0x2')]},'ticketType':{'type':Sequelize[_0x5791('0x3')]('Task','Case'),'defaultValue':_0x5791('0x4')},'moduleSearch':{'type':Sequelize[_0x5791('0x3')](_0x5791('0x5'),_0x5791('0x6'),'lead',_0x5791('0x7'),_0x5791('0x8')),'defaultValue':_0x5791('0x5')},'moduleCreate':{'type':Sequelize[_0x5791('0x3')](_0x5791('0x9'),_0x5791('0x6'),'lead',_0x5791('0x8')),'defaultValue':_0x5791('0xa')},'leadId':{'type':Sequelize[_0x5791('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x5791('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5791('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 7f85a2d..841f2b2 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 _0x78d8=['show','params','rawAttributes','includeAll','catch','create','body','find','getFields','SalesforceField','order','pick','getSubjects','findOne','getDescriptions','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SalesforceConfiguration','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x15d60e,_0x4e846d){var _0x5c6452=function(_0x1ca41c){while(--_0x1ca41c){_0x15d60e['push'](_0x15d60e['shift']());}};_0x5c6452(++_0x4e846d);}(_0x78d8,0x19f));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x878d('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x878d('0x1'));var Mustache=require(_0x878d('0x2'));var util=require(_0x878d('0x3'));var path=require('path');var sox=require(_0x878d('0x4'));var csv=require(_0x878d('0x5'));var ejs=require(_0x878d('0x6'));var fs=require('fs');var fs_extra=require(_0x878d('0x7'));var _=require(_0x878d('0x8'));var squel=require('squel');var crypto=require(_0x878d('0x9'));var jsforce=require(_0x878d('0xa'));var deskjs=require(_0x878d('0xb'));var toCsv=require(_0x878d('0x5'));var querystring=require(_0x878d('0xc'));var Papa=require(_0x878d('0xd'));var Redis=require(_0x878d('0xe'));var authService=require(_0x878d('0xf'));var qs=require(_0x878d('0x10'));var as=require(_0x878d('0x11'));var hardwareService=require(_0x878d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x878d('0x13'));var config=require(_0x878d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x878d('0x15'))['db'];function respondWithStatusCode(_0x5a9cc0,_0x58f2ea){_0x58f2ea=_0x58f2ea||0xcc;return function(_0x3c3c1b){if(_0x3c3c1b){return _0x5a9cc0[_0x878d('0x16')](_0x58f2ea);}return _0x5a9cc0[_0x878d('0x17')](_0x58f2ea)['end']();};}function respondWithResult(_0x3297d8,_0x78ae1c){_0x78ae1c=_0x78ae1c||0xc8;return function(_0x4943e0){if(_0x4943e0){return _0x3297d8[_0x878d('0x17')](_0x78ae1c)[_0x878d('0x18')](_0x4943e0);}};}function respondWithFilteredResult(_0x1234d8,_0xecb6db){return function(_0x13b017){if(_0x13b017){var _0x1db8dc=typeof _0xecb6db[_0x878d('0x19')]===_0x878d('0x1a')&&typeof _0xecb6db[_0x878d('0x1b')]==='undefined';var _0x105038=_0x13b017[_0x878d('0x1c')];var _0x137f56=_0x1db8dc?0x0:_0xecb6db[_0x878d('0x19')];var _0x22e618=_0x1db8dc?_0x13b017['count']:_0xecb6db[_0x878d('0x19')]+_0xecb6db[_0x878d('0x1b')];var _0x34111f;if(_0x22e618>=_0x105038){_0x22e618=_0x105038;_0x34111f=0xc8;}else{_0x34111f=0xce;}_0x1234d8[_0x878d('0x17')](_0x34111f);return _0x1234d8['set']('Content-Range',_0x137f56+'-'+_0x22e618+'/'+_0x105038)[_0x878d('0x18')](_0x13b017);}return null;};}function patchUpdates(_0x2c260a){return function(_0x3be9e4){try{jsonpatch[_0x878d('0x1d')](_0x3be9e4,_0x2c260a,!![]);}catch(_0x405aaf){return BPromise[_0x878d('0x1e')](_0x405aaf);}return _0x3be9e4[_0x878d('0x1f')]();};}function saveUpdates(_0x5544a3,_0x44d4dc){return function(_0x851a6){if(_0x851a6){return _0x851a6[_0x878d('0x20')](_0x5544a3)[_0x878d('0x21')](function(_0x36be01){return _0x36be01;});}return null;};}function removeEntity(_0x1d2706,_0x40659b){return function(_0x51ed04){if(_0x51ed04){return _0x51ed04[_0x878d('0x22')]()['then'](function(){_0x1d2706[_0x878d('0x17')](0xcc)[_0x878d('0x23')]();});}};}function handleEntityNotFound(_0x2e5811,_0x4f4c51){return function(_0x585643){if(!_0x585643){_0x2e5811[_0x878d('0x16')](0x194);}return _0x585643;};}function handleError(_0x25cc36,_0x35863e){_0x35863e=_0x35863e||0x1f4;return function(_0x40290a){logger[_0x878d('0x24')](_0x40290a[_0x878d('0x25')]);if(_0x40290a['name']){delete _0x40290a[_0x878d('0x26')];}_0x25cc36[_0x878d('0x17')](_0x35863e)[_0x878d('0x27')](_0x40290a);};}exports[_0x878d('0x28')]=function(_0x3eaf40,_0x55f0cc){var _0x3e74cd={},_0x7e5481={},_0x1ab3f4={'count':0x0,'rows':[]};var _0x2ae7cb=_['map'](db[_0x878d('0x29')]['rawAttributes'],function(_0x212779){return{'name':_0x212779[_0x878d('0x2a')],'type':_0x212779[_0x878d('0x2b')][_0x878d('0x2c')]};});_0x7e5481[_0x878d('0x2d')]=_[_0x878d('0x2e')](_0x2ae7cb,_0x878d('0x26'));_0x7e5481[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x3eaf40[_0x878d('0x2f')]);_0x7e5481['filters']=_['intersection'](_0x7e5481['model'],_0x7e5481[_0x878d('0x2f')]);_0x3e74cd[_0x878d('0x31')]=_[_0x878d('0x32')](_0x7e5481[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x33')]));_0x3e74cd[_0x878d('0x31')]=_0x3e74cd[_0x878d('0x31')][_0x878d('0x34')]?_0x3e74cd[_0x878d('0x31')]:_0x7e5481[_0x878d('0x2d')];if(!_0x3eaf40[_0x878d('0x2f')][_0x878d('0x35')](_0x878d('0x36'))){_0x3e74cd[_0x878d('0x1b')]=qs[_0x878d('0x1b')](_0x3eaf40[_0x878d('0x2f')]['limit']);_0x3e74cd[_0x878d('0x19')]=qs[_0x878d('0x19')](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x19')]);}_0x3e74cd['order']=qs['sort'](_0x3eaf40[_0x878d('0x2f')][_0x878d('0x37')]);_0x3e74cd[_0x878d('0x38')]=qs[_0x878d('0x39')](_['pick'](_0x3eaf40['query'],_0x7e5481['filters']),_0x2ae7cb);if(_0x3eaf40[_0x878d('0x2f')][_0x878d('0x3a')]){_0x3e74cd[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x3e74cd[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x2ae7cb,function(_0x2b6535){if(_0x2b6535[_0x878d('0x2b')]!==_0x878d('0x3c')){var _0x3c1376={};_0x3c1376[_0x2b6535[_0x878d('0x26')]]={'$like':'%'+_0x3eaf40[_0x878d('0x2f')][_0x878d('0x3a')]+'%'};return _0x3c1376;}})});}_0x3e74cd=_[_0x878d('0x3b')]({},_0x3e74cd,_0x3eaf40[_0x878d('0x3d')]);var _0x136e98={'where':_0x3e74cd['where']};return db[_0x878d('0x29')][_0x878d('0x1c')](_0x136e98)['then'](function(_0x34200c){_0x1ab3f4[_0x878d('0x1c')]=_0x34200c;if(_0x3eaf40[_0x878d('0x2f')]['includeAll']){_0x3e74cd[_0x878d('0x3e')]=[{'all':!![]}];}return db[_0x878d('0x29')][_0x878d('0x3f')](_0x3e74cd);})[_0x878d('0x21')](function(_0x1c3bac){_0x1ab3f4[_0x878d('0x40')]=_0x1c3bac;return _0x1ab3f4;})[_0x878d('0x21')](respondWithFilteredResult(_0x55f0cc,_0x3e74cd))['catch'](handleError(_0x55f0cc,null));};exports[_0x878d('0x41')]=function(_0xf69272,_0x1e89c6){var _0x35748a={'raw':![],'where':{'id':_0xf69272[_0x878d('0x42')]['id']}},_0x161e0e={};_0x161e0e[_0x878d('0x2d')]=_[_0x878d('0x30')](db[_0x878d('0x29')][_0x878d('0x43')]);_0x161e0e['query']=_[_0x878d('0x30')](_0xf69272[_0x878d('0x2f')]);_0x161e0e[_0x878d('0x39')]=_[_0x878d('0x32')](_0x161e0e[_0x878d('0x2d')],_0x161e0e[_0x878d('0x2f')]);_0x35748a[_0x878d('0x31')]=_['intersection'](_0x161e0e[_0x878d('0x2d')],qs[_0x878d('0x33')](_0xf69272[_0x878d('0x2f')][_0x878d('0x33')]));_0x35748a[_0x878d('0x31')]=_0x35748a['attributes'][_0x878d('0x34')]?_0x35748a['attributes']:_0x161e0e['model'];if(_0xf69272[_0x878d('0x2f')][_0x878d('0x44')]){_0x35748a[_0x878d('0x3e')]=[{'all':!![]}];}_0x35748a=_[_0x878d('0x3b')]({},_0x35748a,_0xf69272[_0x878d('0x3d')]);return db[_0x878d('0x29')]['find'](_0x35748a)['then'](handleEntityNotFound(_0x1e89c6,null))['then'](respondWithResult(_0x1e89c6,null))[_0x878d('0x45')](handleError(_0x1e89c6,null));};exports['create']=function(_0x4e81ef,_0x10f798){return db[_0x878d('0x29')][_0x878d('0x46')](_0x4e81ef[_0x878d('0x47')],{})[_0x878d('0x21')](respondWithResult(_0x10f798,0xc9))['catch'](handleError(_0x10f798,null));};exports[_0x878d('0x20')]=function(_0x5c88f6,_0xaeaaf3){if(_0x5c88f6['body']['id']){delete _0x5c88f6[_0x878d('0x47')]['id'];}return db['SalesforceConfiguration'][_0x878d('0x48')]({'where':{'id':_0x5c88f6[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0xaeaaf3,null))[_0x878d('0x21')](saveUpdates(_0x5c88f6[_0x878d('0x47')],null))[_0x878d('0x21')](respondWithResult(_0xaeaaf3,null))[_0x878d('0x45')](handleError(_0xaeaaf3,null));};exports[_0x878d('0x22')]=function(_0x363714,_0x4142b1){return db['SalesforceConfiguration']['find']({'where':{'id':_0x363714[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x4142b1,null))[_0x878d('0x21')](removeEntity(_0x4142b1,null))[_0x878d('0x45')](handleError(_0x4142b1,null));};exports[_0x878d('0x49')]=function(_0x14d87e,_0x363299,_0x3b9107){var _0x17e2f3={};var _0x340d50={};var _0x407f35;var _0x49a912;return db[_0x878d('0x29')]['findOne']({'where':{'id':_0x14d87e['params']['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x363299,null))[_0x878d('0x21')](function(_0x3cdbba){if(_0x3cdbba){_0x407f35=_0x3cdbba;_0x340d50[_0x878d('0x2d')]=_['keys'](db[_0x878d('0x4a')][_0x878d('0x43')]);_0x340d50[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x14d87e[_0x878d('0x2f')]);_0x340d50['filters']=_[_0x878d('0x32')](_0x340d50['model'],_0x340d50['query']);_0x17e2f3[_0x878d('0x31')]=_[_0x878d('0x32')](_0x340d50[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x14d87e[_0x878d('0x2f')][_0x878d('0x33')]));_0x17e2f3[_0x878d('0x31')]=_0x17e2f3['attributes']['length']?_0x17e2f3[_0x878d('0x31')]:_0x340d50[_0x878d('0x2d')];_0x17e2f3[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x14d87e[_0x878d('0x2f')][_0x878d('0x37')]);_0x17e2f3[_0x878d('0x38')]=qs[_0x878d('0x39')](_[_0x878d('0x4c')](_0x14d87e['query'],_0x340d50[_0x878d('0x39')]));if(_0x14d87e[_0x878d('0x2f')][_0x878d('0x3a')]){_0x17e2f3[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x17e2f3[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x17e2f3['attributes'],function(_0x12073a){var _0x187e4a={};_0x187e4a[_0x12073a]={'$like':'%'+_0x14d87e[_0x878d('0x2f')][_0x878d('0x3a')]+'%'};return _0x187e4a;})});}_0x17e2f3=_[_0x878d('0x3b')]({},_0x17e2f3,_0x14d87e[_0x878d('0x3d')]);return _0x407f35[_0x878d('0x49')](_0x17e2f3);}})[_0x878d('0x21')](function(_0x17ed7e){if(_0x17ed7e){_0x49a912=_0x17ed7e[_0x878d('0x34')];if(!_0x14d87e[_0x878d('0x2f')]['hasOwnProperty'](_0x878d('0x36'))){_0x17e2f3[_0x878d('0x1b')]=qs[_0x878d('0x1b')](_0x14d87e['query'][_0x878d('0x1b')]);_0x17e2f3[_0x878d('0x19')]=qs['offset'](_0x14d87e[_0x878d('0x2f')][_0x878d('0x19')]);}return _0x407f35[_0x878d('0x49')](_0x17e2f3);}})['then'](function(_0x19c370){if(_0x19c370){return _0x19c370?{'count':_0x49a912,'rows':_0x19c370}:null;}})[_0x878d('0x21')](respondWithResult(_0x363299,null))[_0x878d('0x45')](handleError(_0x363299,null));};exports[_0x878d('0x4d')]=function(_0x22784c,_0x4cf24e,_0x3138fe){var _0x5ce922={};var _0x5b38c8={};var _0x388bfa;var _0x897dbf;return db['SalesforceConfiguration'][_0x878d('0x4e')]({'where':{'id':_0x22784c[_0x878d('0x42')]['id']}})['then'](handleEntityNotFound(_0x4cf24e,null))['then'](function(_0xaad4bc){if(_0xaad4bc){_0x388bfa=_0xaad4bc;_0x5b38c8[_0x878d('0x2d')]=_[_0x878d('0x30')](db['SalesforceField'][_0x878d('0x43')]);_0x5b38c8['query']=_['keys'](_0x22784c[_0x878d('0x2f')]);_0x5b38c8[_0x878d('0x39')]=_[_0x878d('0x32')](_0x5b38c8['model'],_0x5b38c8[_0x878d('0x2f')]);_0x5ce922[_0x878d('0x31')]=_[_0x878d('0x32')](_0x5b38c8[_0x878d('0x2d')],qs[_0x878d('0x33')](_0x22784c[_0x878d('0x2f')]['fields']));_0x5ce922[_0x878d('0x31')]=_0x5ce922[_0x878d('0x31')]['length']?_0x5ce922['attributes']:_0x5b38c8[_0x878d('0x2d')];_0x5ce922[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x22784c[_0x878d('0x2f')]['sort']);_0x5ce922[_0x878d('0x38')]=qs[_0x878d('0x39')](_[_0x878d('0x4c')](_0x22784c[_0x878d('0x2f')],_0x5b38c8['filters']));if(_0x22784c[_0x878d('0x2f')][_0x878d('0x3a')]){_0x5ce922[_0x878d('0x38')]=_[_0x878d('0x3b')](_0x5ce922[_0x878d('0x38')],{'$or':_['map'](_0x5ce922[_0x878d('0x31')],function(_0x532b54){var _0x4e3ec6={};_0x4e3ec6[_0x532b54]={'$like':'%'+_0x22784c['query'][_0x878d('0x3a')]+'%'};return _0x4e3ec6;})});}_0x5ce922=_[_0x878d('0x3b')]({},_0x5ce922,_0x22784c[_0x878d('0x3d')]);return _0x388bfa[_0x878d('0x4d')](_0x5ce922);}})[_0x878d('0x21')](function(_0x4a24d6){if(_0x4a24d6){_0x897dbf=_0x4a24d6['length'];if(!_0x22784c[_0x878d('0x2f')][_0x878d('0x35')](_0x878d('0x36'))){_0x5ce922[_0x878d('0x1b')]=qs['limit'](_0x22784c[_0x878d('0x2f')][_0x878d('0x1b')]);_0x5ce922[_0x878d('0x19')]=qs['offset'](_0x22784c['query']['offset']);}return _0x388bfa[_0x878d('0x4d')](_0x5ce922);}})[_0x878d('0x21')](function(_0x39e269){if(_0x39e269){return _0x39e269?{'count':_0x897dbf,'rows':_0x39e269}:null;}})[_0x878d('0x21')](respondWithResult(_0x4cf24e,null))[_0x878d('0x45')](handleError(_0x4cf24e,null));};exports['getDescriptions']=function(_0x43170f,_0x550c0d,_0x3552a6){var _0x2feba1={};var _0x78b75d={};var _0x173a38;var _0x2ac639;return db['SalesforceConfiguration'][_0x878d('0x4e')]({'where':{'id':_0x43170f[_0x878d('0x42')]['id']}})[_0x878d('0x21')](handleEntityNotFound(_0x550c0d,null))[_0x878d('0x21')](function(_0x7e5bee){if(_0x7e5bee){_0x173a38=_0x7e5bee;_0x78b75d[_0x878d('0x2d')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x78b75d[_0x878d('0x2f')]=_[_0x878d('0x30')](_0x43170f[_0x878d('0x2f')]);_0x78b75d[_0x878d('0x39')]=_[_0x878d('0x32')](_0x78b75d[_0x878d('0x2d')],_0x78b75d[_0x878d('0x2f')]);_0x2feba1[_0x878d('0x31')]=_[_0x878d('0x32')](_0x78b75d['model'],qs[_0x878d('0x33')](_0x43170f[_0x878d('0x2f')][_0x878d('0x33')]));_0x2feba1['attributes']=_0x2feba1['attributes'][_0x878d('0x34')]?_0x2feba1[_0x878d('0x31')]:_0x78b75d[_0x878d('0x2d')];_0x2feba1[_0x878d('0x4b')]=qs[_0x878d('0x37')](_0x43170f[_0x878d('0x2f')]['sort']);_0x2feba1[_0x878d('0x38')]=qs['filters'](_[_0x878d('0x4c')](_0x43170f[_0x878d('0x2f')],_0x78b75d[_0x878d('0x39')]));if(_0x43170f[_0x878d('0x2f')][_0x878d('0x3a')]){_0x2feba1['where']=_[_0x878d('0x3b')](_0x2feba1[_0x878d('0x38')],{'$or':_[_0x878d('0x2e')](_0x2feba1['attributes'],function(_0x464f9e){var _0x26bce4={};_0x26bce4[_0x464f9e]={'$like':'%'+_0x43170f['query'][_0x878d('0x3a')]+'%'};return _0x26bce4;})});}_0x2feba1=_['merge']({},_0x2feba1,_0x43170f[_0x878d('0x3d')]);return _0x173a38[_0x878d('0x4f')](_0x2feba1);}})['then'](function(_0x498695){if(_0x498695){_0x2ac639=_0x498695[_0x878d('0x34')];if(!_0x43170f['query']['hasOwnProperty'](_0x878d('0x36'))){_0x2feba1['limit']=qs[_0x878d('0x1b')](_0x43170f[_0x878d('0x2f')][_0x878d('0x1b')]);_0x2feba1[_0x878d('0x19')]=qs[_0x878d('0x19')](_0x43170f[_0x878d('0x2f')][_0x878d('0x19')]);}return _0x173a38['getDescriptions'](_0x2feba1);}})[_0x878d('0x21')](function(_0x16c24f){if(_0x16c24f){return _0x16c24f?{'count':_0x2ac639,'rows':_0x16c24f}:null;}})[_0x878d('0x21')](respondWithResult(_0x550c0d,null))[_0x878d('0x45')](handleError(_0x550c0d,null));}; \ No newline at end of file +var _0x3728=['offset','undefined','limit','Content-Range','apply','reject','update','then','error','stack','name','index','map','SalesforceConfiguration','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','keys','SalesforceField','rawAttributes','options','getSubjects','getDescriptions','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0x3728,0x17c));var _0x8372=function(_0x7a9008,_0x435c8a){_0x7a9008=_0x7a9008-0x0;var _0x4c84ea=_0x3728[_0x7a9008];return _0x4c84ea;};'use strict';var emlformat=require(_0x8372('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8372('0x1'));var moment=require(_0x8372('0x2'));var BPromise=require(_0x8372('0x3'));var Mustache=require(_0x8372('0x4'));var util=require(_0x8372('0x5'));var path=require(_0x8372('0x6'));var sox=require(_0x8372('0x7'));var csv=require(_0x8372('0x8'));var ejs=require(_0x8372('0x9'));var fs=require('fs');var fs_extra=require(_0x8372('0xa'));var _=require(_0x8372('0xb'));var squel=require('squel');var crypto=require(_0x8372('0xc'));var jsforce=require(_0x8372('0xd'));var deskjs=require(_0x8372('0xe'));var toCsv=require(_0x8372('0x8'));var querystring=require(_0x8372('0xf'));var Papa=require(_0x8372('0x10'));var Redis=require(_0x8372('0x11'));var authService=require(_0x8372('0x12'));var qs=require(_0x8372('0x13'));var as=require(_0x8372('0x14'));var hardwareService=require(_0x8372('0x15'));var logger=require(_0x8372('0x16'))(_0x8372('0x17'));var utils=require(_0x8372('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8372('0x19'));var db=require(_0x8372('0x1a'))['db'];function respondWithStatusCode(_0x3e4ef6,_0x224727){_0x224727=_0x224727||0xcc;return function(_0x31362d){if(_0x31362d){return _0x3e4ef6[_0x8372('0x1b')](_0x224727);}return _0x3e4ef6[_0x8372('0x1c')](_0x224727)[_0x8372('0x1d')]();};}function respondWithResult(_0x431229,_0x510077){_0x510077=_0x510077||0xc8;return function(_0x200136){if(_0x200136){return _0x431229['status'](_0x510077)['json'](_0x200136);}};}function respondWithFilteredResult(_0x121857,_0xdab2c7){return function(_0x2bb4d4){if(_0x2bb4d4){var _0x25211f=typeof _0xdab2c7[_0x8372('0x1e')]===_0x8372('0x1f')&&typeof _0xdab2c7[_0x8372('0x20')]===_0x8372('0x1f');var _0x4439ca=_0x2bb4d4['count'];var _0x22f219=_0x25211f?0x0:_0xdab2c7[_0x8372('0x1e')];var _0x10a2c0=_0x25211f?_0x2bb4d4['count']:_0xdab2c7[_0x8372('0x1e')]+_0xdab2c7[_0x8372('0x20')];var _0x20cb0c;if(_0x10a2c0>=_0x4439ca){_0x10a2c0=_0x4439ca;_0x20cb0c=0xc8;}else{_0x20cb0c=0xce;}_0x121857['status'](_0x20cb0c);return _0x121857['set'](_0x8372('0x21'),_0x22f219+'-'+_0x10a2c0+'/'+_0x4439ca)['json'](_0x2bb4d4);}return null;};}function patchUpdates(_0xaf5aef){return function(_0x2e5716){try{jsonpatch[_0x8372('0x22')](_0x2e5716,_0xaf5aef,!![]);}catch(_0x134ef1){return BPromise[_0x8372('0x23')](_0x134ef1);}return _0x2e5716['save']();};}function saveUpdates(_0x264bad,_0x1b222e){return function(_0x1ef9a0){if(_0x1ef9a0){return _0x1ef9a0[_0x8372('0x24')](_0x264bad)['then'](function(_0x503527){return _0x503527;});}return null;};}function removeEntity(_0x277808,_0x59079d){return function(_0x9e847a){if(_0x9e847a){return _0x9e847a['destroy']()[_0x8372('0x25')](function(){_0x277808[_0x8372('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a01bb,_0x2e5e0b){return function(_0x5bddfa){if(!_0x5bddfa){_0x2a01bb['sendStatus'](0x194);}return _0x5bddfa;};}function handleError(_0x52b19b,_0x4c9446){_0x4c9446=_0x4c9446||0x1f4;return function(_0xccd89a){logger[_0x8372('0x26')](_0xccd89a[_0x8372('0x27')]);if(_0xccd89a[_0x8372('0x28')]){delete _0xccd89a[_0x8372('0x28')];}_0x52b19b[_0x8372('0x1c')](_0x4c9446)['send'](_0xccd89a);};}exports[_0x8372('0x29')]=function(_0x339aa4,_0x2a6d66){var _0x347e6d={},_0x283fef={},_0x147b69={'count':0x0,'rows':[]};var _0x46e0a8=_[_0x8372('0x2a')](db[_0x8372('0x2b')]['rawAttributes'],function(_0x2c3204){return{'name':_0x2c3204[_0x8372('0x2c')],'type':_0x2c3204[_0x8372('0x2d')][_0x8372('0x2e')]};});_0x283fef[_0x8372('0x2f')]=_[_0x8372('0x2a')](_0x46e0a8,_0x8372('0x28'));_0x283fef[_0x8372('0x30')]=_['keys'](_0x339aa4['query']);_0x283fef[_0x8372('0x31')]=_[_0x8372('0x32')](_0x283fef[_0x8372('0x2f')],_0x283fef[_0x8372('0x30')]);_0x347e6d[_0x8372('0x33')]=_['intersection'](_0x283fef[_0x8372('0x2f')],qs[_0x8372('0x34')](_0x339aa4[_0x8372('0x30')][_0x8372('0x34')]));_0x347e6d[_0x8372('0x33')]=_0x347e6d[_0x8372('0x33')][_0x8372('0x35')]?_0x347e6d[_0x8372('0x33')]:_0x283fef[_0x8372('0x2f')];if(!_0x339aa4[_0x8372('0x30')][_0x8372('0x36')](_0x8372('0x37'))){_0x347e6d[_0x8372('0x20')]=qs[_0x8372('0x20')](_0x339aa4[_0x8372('0x30')]['limit']);_0x347e6d[_0x8372('0x1e')]=qs['offset'](_0x339aa4['query']['offset']);}_0x347e6d[_0x8372('0x38')]=qs[_0x8372('0x39')](_0x339aa4['query'][_0x8372('0x39')]);_0x347e6d[_0x8372('0x3a')]=qs[_0x8372('0x31')](_[_0x8372('0x3b')](_0x339aa4[_0x8372('0x30')],_0x283fef['filters']),_0x46e0a8);if(_0x339aa4[_0x8372('0x30')][_0x8372('0x3c')]){_0x347e6d[_0x8372('0x3a')]=_[_0x8372('0x3d')](_0x347e6d[_0x8372('0x3a')],{'$or':_[_0x8372('0x2a')](_0x46e0a8,function(_0x25e802){if(_0x25e802['type']!==_0x8372('0x3e')){var _0x4c2f73={};_0x4c2f73[_0x25e802['name']]={'$like':'%'+_0x339aa4[_0x8372('0x30')][_0x8372('0x3c')]+'%'};return _0x4c2f73;}})});}_0x347e6d=_[_0x8372('0x3d')]({},_0x347e6d,_0x339aa4['options']);var _0x24ff54={'where':_0x347e6d[_0x8372('0x3a')]};return db[_0x8372('0x2b')][_0x8372('0x3f')](_0x24ff54)['then'](function(_0x488839){_0x147b69['count']=_0x488839;if(_0x339aa4[_0x8372('0x30')][_0x8372('0x40')]){_0x347e6d[_0x8372('0x41')]=[{'all':!![]}];}return db[_0x8372('0x2b')][_0x8372('0x42')](_0x347e6d);})[_0x8372('0x25')](function(_0x1aad2b){_0x147b69[_0x8372('0x43')]=_0x1aad2b;return _0x147b69;})[_0x8372('0x25')](respondWithFilteredResult(_0x2a6d66,_0x347e6d))[_0x8372('0x44')](handleError(_0x2a6d66,null));};exports[_0x8372('0x45')]=function(_0x292de6,_0x32066d){var _0x365e07={'raw':![],'where':{'id':_0x292de6[_0x8372('0x46')]['id']}},_0x5d362a={};_0x5d362a['model']=_['keys'](db[_0x8372('0x2b')]['rawAttributes']);_0x5d362a[_0x8372('0x30')]=_['keys'](_0x292de6['query']);_0x5d362a[_0x8372('0x31')]=_[_0x8372('0x32')](_0x5d362a[_0x8372('0x2f')],_0x5d362a[_0x8372('0x30')]);_0x365e07[_0x8372('0x33')]=_[_0x8372('0x32')](_0x5d362a[_0x8372('0x2f')],qs[_0x8372('0x34')](_0x292de6['query'][_0x8372('0x34')]));_0x365e07[_0x8372('0x33')]=_0x365e07[_0x8372('0x33')][_0x8372('0x35')]?_0x365e07['attributes']:_0x5d362a[_0x8372('0x2f')];if(_0x292de6[_0x8372('0x30')]['includeAll']){_0x365e07['include']=[{'all':!![]}];}_0x365e07=_[_0x8372('0x3d')]({},_0x365e07,_0x292de6['options']);return db[_0x8372('0x2b')][_0x8372('0x47')](_0x365e07)['then'](handleEntityNotFound(_0x32066d,null))[_0x8372('0x25')](respondWithResult(_0x32066d,null))['catch'](handleError(_0x32066d,null));};exports[_0x8372('0x48')]=function(_0x4a3b69,_0xa7c2b2){return db[_0x8372('0x2b')]['create'](_0x4a3b69[_0x8372('0x49')],{})[_0x8372('0x25')](respondWithResult(_0xa7c2b2,0xc9))[_0x8372('0x44')](handleError(_0xa7c2b2,null));};exports['update']=function(_0x13cb8a,_0x509733){if(_0x13cb8a['body']['id']){delete _0x13cb8a[_0x8372('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x13cb8a[_0x8372('0x46')]['id']}})[_0x8372('0x25')](handleEntityNotFound(_0x509733,null))[_0x8372('0x25')](saveUpdates(_0x13cb8a['body'],null))[_0x8372('0x25')](respondWithResult(_0x509733,null))[_0x8372('0x44')](handleError(_0x509733,null));};exports['destroy']=function(_0x165923,_0x1695b3){return db[_0x8372('0x2b')][_0x8372('0x47')]({'where':{'id':_0x165923[_0x8372('0x46')]['id']}})[_0x8372('0x25')](handleEntityNotFound(_0x1695b3,null))['then'](removeEntity(_0x1695b3,null))[_0x8372('0x44')](handleError(_0x1695b3,null));};exports[_0x8372('0x4a')]=function(_0x3bd3b3,_0x4cff44,_0x514132){var _0x57524e={};var _0x1e82c9={};var _0x28f910;var _0x4bb4bc;return db[_0x8372('0x2b')][_0x8372('0x4b')]({'where':{'id':_0x3bd3b3[_0x8372('0x46')]['id']}})['then'](handleEntityNotFound(_0x4cff44,null))[_0x8372('0x25')](function(_0x24f0b5){if(_0x24f0b5){_0x28f910=_0x24f0b5;_0x1e82c9[_0x8372('0x2f')]=_[_0x8372('0x4c')](db[_0x8372('0x4d')][_0x8372('0x4e')]);_0x1e82c9[_0x8372('0x30')]=_[_0x8372('0x4c')](_0x3bd3b3[_0x8372('0x30')]);_0x1e82c9[_0x8372('0x31')]=_[_0x8372('0x32')](_0x1e82c9[_0x8372('0x2f')],_0x1e82c9[_0x8372('0x30')]);_0x57524e[_0x8372('0x33')]=_[_0x8372('0x32')](_0x1e82c9[_0x8372('0x2f')],qs[_0x8372('0x34')](_0x3bd3b3['query'][_0x8372('0x34')]));_0x57524e[_0x8372('0x33')]=_0x57524e[_0x8372('0x33')]['length']?_0x57524e['attributes']:_0x1e82c9['model'];_0x57524e[_0x8372('0x38')]=qs[_0x8372('0x39')](_0x3bd3b3[_0x8372('0x30')][_0x8372('0x39')]);_0x57524e['where']=qs[_0x8372('0x31')](_[_0x8372('0x3b')](_0x3bd3b3['query'],_0x1e82c9['filters']));if(_0x3bd3b3[_0x8372('0x30')][_0x8372('0x3c')]){_0x57524e[_0x8372('0x3a')]=_[_0x8372('0x3d')](_0x57524e[_0x8372('0x3a')],{'$or':_[_0x8372('0x2a')](_0x57524e[_0x8372('0x33')],function(_0x5ed80a){var _0x4d17aa={};_0x4d17aa[_0x5ed80a]={'$like':'%'+_0x3bd3b3['query'][_0x8372('0x3c')]+'%'};return _0x4d17aa;})});}_0x57524e=_['merge']({},_0x57524e,_0x3bd3b3[_0x8372('0x4f')]);return _0x28f910[_0x8372('0x4a')](_0x57524e);}})[_0x8372('0x25')](function(_0x1cca24){if(_0x1cca24){_0x4bb4bc=_0x1cca24['length'];if(!_0x3bd3b3[_0x8372('0x30')][_0x8372('0x36')](_0x8372('0x37'))){_0x57524e[_0x8372('0x20')]=qs[_0x8372('0x20')](_0x3bd3b3['query']['limit']);_0x57524e[_0x8372('0x1e')]=qs[_0x8372('0x1e')](_0x3bd3b3[_0x8372('0x30')][_0x8372('0x1e')]);}return _0x28f910[_0x8372('0x4a')](_0x57524e);}})[_0x8372('0x25')](function(_0x445b88){if(_0x445b88){return _0x445b88?{'count':_0x4bb4bc,'rows':_0x445b88}:null;}})[_0x8372('0x25')](respondWithResult(_0x4cff44,null))[_0x8372('0x44')](handleError(_0x4cff44,null));};exports[_0x8372('0x50')]=function(_0x54e790,_0x59f0d2,_0x578a52){var _0x175e3c={};var _0x3b4099={};var _0x45bf89;var _0xc5ae58;return db[_0x8372('0x2b')][_0x8372('0x4b')]({'where':{'id':_0x54e790[_0x8372('0x46')]['id']}})[_0x8372('0x25')](handleEntityNotFound(_0x59f0d2,null))[_0x8372('0x25')](function(_0x1aa04a){if(_0x1aa04a){_0x45bf89=_0x1aa04a;_0x3b4099[_0x8372('0x2f')]=_['keys'](db[_0x8372('0x4d')][_0x8372('0x4e')]);_0x3b4099[_0x8372('0x30')]=_['keys'](_0x54e790['query']);_0x3b4099[_0x8372('0x31')]=_[_0x8372('0x32')](_0x3b4099[_0x8372('0x2f')],_0x3b4099[_0x8372('0x30')]);_0x175e3c[_0x8372('0x33')]=_[_0x8372('0x32')](_0x3b4099[_0x8372('0x2f')],qs[_0x8372('0x34')](_0x54e790['query'][_0x8372('0x34')]));_0x175e3c[_0x8372('0x33')]=_0x175e3c[_0x8372('0x33')][_0x8372('0x35')]?_0x175e3c[_0x8372('0x33')]:_0x3b4099[_0x8372('0x2f')];_0x175e3c[_0x8372('0x38')]=qs[_0x8372('0x39')](_0x54e790[_0x8372('0x30')][_0x8372('0x39')]);_0x175e3c['where']=qs[_0x8372('0x31')](_[_0x8372('0x3b')](_0x54e790[_0x8372('0x30')],_0x3b4099[_0x8372('0x31')]));if(_0x54e790[_0x8372('0x30')][_0x8372('0x3c')]){_0x175e3c[_0x8372('0x3a')]=_[_0x8372('0x3d')](_0x175e3c[_0x8372('0x3a')],{'$or':_[_0x8372('0x2a')](_0x175e3c[_0x8372('0x33')],function(_0x8cb965){var _0x4d1c2c={};_0x4d1c2c[_0x8cb965]={'$like':'%'+_0x54e790[_0x8372('0x30')][_0x8372('0x3c')]+'%'};return _0x4d1c2c;})});}_0x175e3c=_['merge']({},_0x175e3c,_0x54e790['options']);return _0x45bf89[_0x8372('0x50')](_0x175e3c);}})[_0x8372('0x25')](function(_0x1733fa){if(_0x1733fa){_0xc5ae58=_0x1733fa[_0x8372('0x35')];if(!_0x54e790[_0x8372('0x30')][_0x8372('0x36')](_0x8372('0x37'))){_0x175e3c[_0x8372('0x20')]=qs[_0x8372('0x20')](_0x54e790[_0x8372('0x30')]['limit']);_0x175e3c[_0x8372('0x1e')]=qs[_0x8372('0x1e')](_0x54e790[_0x8372('0x30')]['offset']);}return _0x45bf89['getSubjects'](_0x175e3c);}})[_0x8372('0x25')](function(_0x1f948f){if(_0x1f948f){return _0x1f948f?{'count':_0xc5ae58,'rows':_0x1f948f}:null;}})[_0x8372('0x25')](respondWithResult(_0x59f0d2,null))[_0x8372('0x44')](handleError(_0x59f0d2,null));};exports[_0x8372('0x51')]=function(_0xa8fd2,_0x32c6b0,_0x6868f7){var _0x4bd526={};var _0x19b842={};var _0xde917a;var _0x32f898;return db[_0x8372('0x2b')][_0x8372('0x4b')]({'where':{'id':_0xa8fd2[_0x8372('0x46')]['id']}})[_0x8372('0x25')](handleEntityNotFound(_0x32c6b0,null))[_0x8372('0x25')](function(_0x203080){if(_0x203080){_0xde917a=_0x203080;_0x19b842[_0x8372('0x2f')]=_[_0x8372('0x4c')](db[_0x8372('0x4d')]['rawAttributes']);_0x19b842[_0x8372('0x30')]=_[_0x8372('0x4c')](_0xa8fd2[_0x8372('0x30')]);_0x19b842[_0x8372('0x31')]=_[_0x8372('0x32')](_0x19b842[_0x8372('0x2f')],_0x19b842['query']);_0x4bd526[_0x8372('0x33')]=_['intersection'](_0x19b842['model'],qs[_0x8372('0x34')](_0xa8fd2['query'][_0x8372('0x34')]));_0x4bd526[_0x8372('0x33')]=_0x4bd526[_0x8372('0x33')][_0x8372('0x35')]?_0x4bd526[_0x8372('0x33')]:_0x19b842['model'];_0x4bd526['order']=qs[_0x8372('0x39')](_0xa8fd2[_0x8372('0x30')]['sort']);_0x4bd526[_0x8372('0x3a')]=qs[_0x8372('0x31')](_[_0x8372('0x3b')](_0xa8fd2['query'],_0x19b842['filters']));if(_0xa8fd2['query'][_0x8372('0x3c')]){_0x4bd526['where']=_[_0x8372('0x3d')](_0x4bd526[_0x8372('0x3a')],{'$or':_[_0x8372('0x2a')](_0x4bd526[_0x8372('0x33')],function(_0x19b5fd){var _0x109955={};_0x109955[_0x19b5fd]={'$like':'%'+_0xa8fd2[_0x8372('0x30')]['filter']+'%'};return _0x109955;})});}_0x4bd526=_[_0x8372('0x3d')]({},_0x4bd526,_0xa8fd2[_0x8372('0x4f')]);return _0xde917a[_0x8372('0x51')](_0x4bd526);}})[_0x8372('0x25')](function(_0x30aae0){if(_0x30aae0){_0x32f898=_0x30aae0[_0x8372('0x35')];if(!_0xa8fd2[_0x8372('0x30')][_0x8372('0x36')](_0x8372('0x37'))){_0x4bd526[_0x8372('0x20')]=qs[_0x8372('0x20')](_0xa8fd2[_0x8372('0x30')]['limit']);_0x4bd526[_0x8372('0x1e')]=qs[_0x8372('0x1e')](_0xa8fd2[_0x8372('0x30')][_0x8372('0x1e')]);}return _0xde917a['getDescriptions'](_0x4bd526);}})[_0x8372('0x25')](function(_0x52e599){if(_0x52e599){return _0x52e599?{'count':_0x32f898,'rows':_0x52e599}:null;}})[_0x8372('0x25')](respondWithResult(_0x32c6b0,null))[_0x8372('0x44')](handleError(_0x32c6b0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 0bf8d86..34e2522 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 _0x1784=['../../config/environment','./intSalesforceConfiguration.attributes','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x212a37,_0xf35b2e){var _0x5d0bf9=function(_0x51850f){while(--_0x51850f){_0x212a37['push'](_0x212a37['shift']());}};_0x5d0bf9(++_0xf35b2e);}(_0x1784,0x1f0));var _0x4178=function(_0x596684,_0x3e7a0a){_0x596684=_0x596684-0x0;var _0x21d272=_0x1784[_0x596684];return _0x21d272;};'use strict';var _=require(_0x4178('0x0'));var util=require(_0x4178('0x1'));var logger=require(_0x4178('0x2'))('api');var moment=require(_0x4178('0x3'));var BPromise=require(_0x4178('0x4'));var rp=require(_0x4178('0x5'));var fs=require('fs');var path=require(_0x4178('0x6'));var rimraf=require(_0x4178('0x7'));var config=require(_0x4178('0x8'));var attributes=require(_0x4178('0x9'));module['exports']=function(_0x55cf04,_0x316af4){return _0x55cf04['define'](_0x4178('0xa'),attributes,{'tableName':_0x4178('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe55a=['../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','moment','request-promise','path','rimraf'];(function(_0xee1038,_0x4592e0){var _0x3c7325=function(_0x2302d9){while(--_0x2302d9){_0xee1038['push'](_0xee1038['shift']());}};_0x3c7325(++_0x4592e0);}(_0xe55a,0xa3));var _0xae55=function(_0x499abb,_0x4d572f){_0x499abb=_0x499abb-0x0;var _0x3b67ad=_0xe55a[_0x499abb];return _0x3b67ad;};'use strict';var _=require(_0xae55('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xae55('0x1'));var BPromise=require('bluebird');var rp=require(_0xae55('0x2'));var fs=require('fs');var path=require(_0xae55('0x3'));var rimraf=require(_0xae55('0x4'));var config=require(_0xae55('0x5'));var attributes=require(_0xae55('0x6'));module['exports']=function(_0x32a3fe,_0x5e77e5){return _0x32a3fe[_0xae55('0x7')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','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 95450ee..2a07a1e 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 _0xde99=['bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xde99,0x1a8));var _0x9de9=function(_0x5e96ee,_0x4a8378){_0x5e96ee=_0x5e96ee-0x0;var _0x4e1744=_0xde99[_0x5e96ee];return _0x4e1744;};'use strict';var _=require(_0x9de9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9de9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9de9('0x2'));var logger=require(_0x9de9('0x3'))(_0x9de9('0x4'));var config=require('../../config/environment');var jayson=require(_0x9de9('0x5'));var client=jayson[_0x9de9('0x6')][_0x9de9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x11643c,_0x5c31f7,_0x1e5a50){return new BPromise(function(_0x11f9a0,_0x56a444){return client[_0x9de9('0x8')](_0x11643c,_0x1e5a50)[_0x9de9('0x9')](function(_0x2240a0){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x5c31f7,'request\x20sent');logger[_0x9de9('0xa')](_0x9de9('0xb'),_0x5c31f7,'request\x20sent',JSON['stringify'](_0x2240a0));if(_0x2240a0[_0x9de9('0xc')]){if(_0x2240a0[_0x9de9('0xc')]['code']===0x1f4){logger['error'](_0x9de9('0xd'),_0x5c31f7,_0x2240a0[_0x9de9('0xc')][_0x9de9('0xe')]);return _0x56a444(_0x2240a0['error']['message']);}logger['error'](_0x9de9('0xd'),_0x5c31f7,_0x2240a0[_0x9de9('0xc')]['message']);return _0x11f9a0(_0x2240a0['error'][_0x9de9('0xe')]);}else{logger[_0x9de9('0xf')](_0x9de9('0xd'),_0x5c31f7,'request\x20sent');_0x11f9a0(_0x2240a0[_0x9de9('0x10')][_0x9de9('0xe')]);}})['catch'](function(_0x49889b){logger[_0x9de9('0xc')](_0x9de9('0xd'),_0x5c31f7,_0x49889b);_0x56a444(_0x49889b);});});} \ No newline at end of file +var _0xc93f=['then','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0xc93f,0x12f));var _0xfc93=function(_0x2b0d5e,_0x39e72c){_0x2b0d5e=_0x2b0d5e-0x0;var _0xa28e09=_0xc93f[_0x2b0d5e];return _0xa28e09;};'use strict';var _=require(_0xfc93('0x0'));var util=require('util');var moment=require(_0xfc93('0x1'));var BPromise=require(_0xfc93('0x2'));var rs=require(_0xfc93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc93('0x4'))['db'];var utils=require(_0xfc93('0x5'));var logger=require(_0xfc93('0x6'))(_0xfc93('0x7'));var config=require('../../config/environment');var jayson=require(_0xfc93('0x8'));var client=jayson[_0xfc93('0x9')][_0xfc93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4382a6,_0x31938d,_0x35c70e){return new BPromise(function(_0x447bbb,_0x1d79a3){return client[_0xfc93('0xb')](_0x4382a6,_0x35c70e)[_0xfc93('0xc')](function(_0x3ee1cc){logger['info'](_0xfc93('0xd'),_0x31938d,'request\x20sent');logger['debug'](_0xfc93('0xe'),_0x31938d,'request\x20sent',JSON[_0xfc93('0xf')](_0x3ee1cc));if(_0x3ee1cc[_0xfc93('0x10')]){if(_0x3ee1cc['error'][_0xfc93('0x11')]===0x1f4){logger[_0xfc93('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x31938d,_0x3ee1cc['error'][_0xfc93('0x12')]);return _0x1d79a3(_0x3ee1cc[_0xfc93('0x10')][_0xfc93('0x12')]);}logger[_0xfc93('0x10')](_0xfc93('0xd'),_0x31938d,_0x3ee1cc['error'][_0xfc93('0x12')]);return _0x447bbb(_0x3ee1cc['error']['message']);}else{logger['info'](_0xfc93('0xd'),_0x31938d,'request\x20sent');_0x447bbb(_0x3ee1cc[_0xfc93('0x13')]['message']);}})[_0xfc93('0x14')](function(_0x182484){logger[_0xfc93('0x10')](_0xfc93('0xd'),_0x31938d,_0x182484);_0x1d79a3(_0x182484);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a8b83cb..3fd71ec 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 _0x70b8=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','/:id','post','create','put','update'];(function(_0x1275bc,_0x2df77d){var _0x2930d0=function(_0x527a2d){while(--_0x527a2d){_0x1275bc['push'](_0x1275bc['shift']());}};_0x2930d0(++_0x2df77d);}(_0x70b8,0xb7));var _0x870b=function(_0x4feeca,_0x2bff67){_0x4feeca=_0x4feeca-0x0;var _0x1135cc=_0x70b8[_0x4feeca];return _0x1135cc;};'use strict';var multer=require(_0x870b('0x0'));var util=require(_0x870b('0x1'));var path=require('path');var timeout=require(_0x870b('0x2'));var express=require(_0x870b('0x3'));var router=express[_0x870b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x870b('0x5'));var interaction=require(_0x870b('0x6'));var config=require('../../config/environment');var controller=require(_0x870b('0x7'));router[_0x870b('0x8')]('/',auth[_0x870b('0x9')](),controller['index']);router['get'](_0x870b('0xa'),auth[_0x870b('0x9')](),controller['show']);router[_0x870b('0xb')]('/',auth['isAuthenticated'](),controller[_0x870b('0xc')]);router[_0x870b('0xd')]('/:id',auth[_0x870b('0x9')](),controller[_0x870b('0xe')]);router[_0x870b('0xf')](_0x870b('0xa'),auth[_0x870b('0x9')](),controller[_0x870b('0x10')]);module[_0x870b('0x11')]=router; \ No newline at end of file +var _0x9882=['delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x171520,_0x1cee8c){var _0x3cc729=function(_0x201c4a){while(--_0x201c4a){_0x171520['push'](_0x171520['shift']());}};_0x3cc729(++_0x1cee8c);}(_0x9882,0x10c));var _0x2988=function(_0x2b8bda,_0xab85c5){_0x2b8bda=_0x2b8bda-0x0;var _0x878abf=_0x9882[_0x2b8bda];return _0x878abf;};'use strict';var multer=require(_0x2988('0x0'));var util=require(_0x2988('0x1'));var path=require(_0x2988('0x2'));var timeout=require(_0x2988('0x3'));var express=require(_0x2988('0x4'));var router=express['Router']();var fs_extra=require(_0x2988('0x5'));var auth=require(_0x2988('0x6'));var interaction=require(_0x2988('0x7'));var config=require(_0x2988('0x8'));var controller=require(_0x2988('0x9'));router[_0x2988('0xa')]('/',auth[_0x2988('0xb')](),controller[_0x2988('0xc')]);router[_0x2988('0xa')](_0x2988('0xd'),auth[_0x2988('0xb')](),controller['show']);router[_0x2988('0xe')]('/',auth[_0x2988('0xb')](),controller[_0x2988('0xf')]);router[_0x2988('0x10')]('/:id',auth[_0x2988('0xb')](),controller['update']);router[_0x2988('0x11')](_0x2988('0xd'),auth[_0x2988('0xb')](),controller[_0x2988('0x12')]);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 6acbcf2..19ca156 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 _0xe2f7=['variable','ENUM','string','customVariable','picklist','STRING'];(function(_0x576898,_0x43ab86){var _0x3d1879=function(_0x4be137){while(--_0x4be137){_0x576898['push'](_0x576898['shift']());}};_0x3d1879(++_0x43ab86);}(_0xe2f7,0x127));var _0x7e2f=function(_0x53c3fa,_0xc75d70){_0x53c3fa=_0x53c3fa-0x0;var _0x44e670=_0xe2f7[_0x53c3fa];return _0x44e670;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x7e2f('0x0')](_0x7e2f('0x1'),'variable',_0x7e2f('0x2'),'keyValue',_0x7e2f('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0x7e2f('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x7e2f('0x5'),_0x7e2f('0x2'))},'keyContent':{'type':Sequelize[_0x7e2f('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xda1d=['STRING','sequelize','exports','string','variable','keyValue','picklist'];(function(_0x57f18a,_0x282d45){var _0x5d1d13=function(_0x51edac){while(--_0x51edac){_0x57f18a['push'](_0x57f18a['shift']());}};_0x5d1d13(++_0x282d45);}(_0xda1d,0x189));var _0xdda1=function(_0x31e0a2,_0x1b51ab){_0x31e0a2=_0x31e0a2-0x0;var _0x19d493=_0xda1d[_0x31e0a2];return _0x19d493;};'use strict';var Sequelize=require(_0xdda1('0x0'));module[_0xdda1('0x1')]={'type':{'type':Sequelize['ENUM'](_0xdda1('0x2'),_0xdda1('0x3'),'customVariable',_0xdda1('0x4'),_0xdda1('0x5')),'defaultValue':_0xdda1('0x2')},'content':{'type':Sequelize[_0xdda1('0x6')]},'key':{'type':Sequelize[_0xdda1('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xdda1('0x2'),_0xdda1('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xdda1('0x6')]},'idField':{'type':Sequelize[_0xdda1('0x6')]},'variableName':{'type':Sequelize[_0xdda1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 528b8d6..c076165 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 _0x9ae0=['error','stack','name','send','SalesforceField','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','params','keys','length','include','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy'];(function(_0x5d5f40,_0x33be4e){var _0x125e43=function(_0x5636be){while(--_0x5636be){_0x5d5f40['push'](_0x5d5f40['shift']());}};_0x125e43(++_0x33be4e);}(_0x9ae0,0xb4));var _0x09ae=function(_0xa48767,_0x1f5ae8){_0xa48767=_0xa48767-0x0;var _0x4ceb94=_0x9ae0[_0xa48767];return _0x4ceb94;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x09ae('0x0'));var zipdir=require(_0x09ae('0x1'));var jsonpatch=require(_0x09ae('0x2'));var rp=require('request-promise');var moment=require(_0x09ae('0x3'));var BPromise=require(_0x09ae('0x4'));var Mustache=require(_0x09ae('0x5'));var util=require(_0x09ae('0x6'));var path=require(_0x09ae('0x7'));var sox=require(_0x09ae('0x8'));var csv=require('to-csv');var ejs=require(_0x09ae('0x9'));var fs=require('fs');var fs_extra=require(_0x09ae('0xa'));var _=require(_0x09ae('0xb'));var squel=require(_0x09ae('0xc'));var crypto=require(_0x09ae('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x09ae('0xe'));var toCsv=require(_0x09ae('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09ae('0x10'));var authService=require(_0x09ae('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ae('0x12'));var logger=require(_0x09ae('0x13'))(_0x09ae('0x14'));var utils=require(_0x09ae('0x15'));var config=require(_0x09ae('0x16'));var licenseUtil=require(_0x09ae('0x17'));var db=require(_0x09ae('0x18'))['db'];function respondWithStatusCode(_0x1972e5,_0x21cf7a){_0x21cf7a=_0x21cf7a||0xcc;return function(_0x2aa95f){if(_0x2aa95f){return _0x1972e5[_0x09ae('0x19')](_0x21cf7a);}return _0x1972e5[_0x09ae('0x1a')](_0x21cf7a)['end']();};}function respondWithResult(_0x131bfe,_0x347342){_0x347342=_0x347342||0xc8;return function(_0x193337){if(_0x193337){return _0x131bfe[_0x09ae('0x1a')](_0x347342)[_0x09ae('0x1b')](_0x193337);}};}function respondWithFilteredResult(_0x3647da,_0x54737){return function(_0x1f801f){if(_0x1f801f){var _0x538fbf=typeof _0x54737[_0x09ae('0x1c')]===_0x09ae('0x1d')&&typeof _0x54737['limit']===_0x09ae('0x1d');var _0x4e4344=_0x1f801f[_0x09ae('0x1e')];var _0x1d5989=_0x538fbf?0x0:_0x54737[_0x09ae('0x1c')];var _0x508d3a=_0x538fbf?_0x1f801f[_0x09ae('0x1e')]:_0x54737['offset']+_0x54737[_0x09ae('0x1f')];var _0x4d8150;if(_0x508d3a>=_0x4e4344){_0x508d3a=_0x4e4344;_0x4d8150=0xc8;}else{_0x4d8150=0xce;}_0x3647da[_0x09ae('0x1a')](_0x4d8150);return _0x3647da[_0x09ae('0x20')](_0x09ae('0x21'),_0x1d5989+'-'+_0x508d3a+'/'+_0x4e4344)[_0x09ae('0x1b')](_0x1f801f);}return null;};}function patchUpdates(_0x102c11){return function(_0x4fa0ac){try{jsonpatch['apply'](_0x4fa0ac,_0x102c11,!![]);}catch(_0x41d1c1){return BPromise[_0x09ae('0x22')](_0x41d1c1);}return _0x4fa0ac[_0x09ae('0x23')]();};}function saveUpdates(_0x56f9f7,_0x592888){return function(_0x29b7bf){if(_0x29b7bf){return _0x29b7bf[_0x09ae('0x24')](_0x56f9f7)[_0x09ae('0x25')](function(_0x3c8b18){return _0x3c8b18;});}return null;};}function removeEntity(_0x34dcc9,_0x113905){return function(_0x52714f){if(_0x52714f){return _0x52714f[_0x09ae('0x26')]()[_0x09ae('0x25')](function(){_0x34dcc9[_0x09ae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59885b,_0x590048){return function(_0x25c900){if(!_0x25c900){_0x59885b[_0x09ae('0x19')](0x194);}return _0x25c900;};}function handleError(_0x525b00,_0x4631c5){_0x4631c5=_0x4631c5||0x1f4;return function(_0x38a905){logger[_0x09ae('0x27')](_0x38a905[_0x09ae('0x28')]);if(_0x38a905[_0x09ae('0x29')]){delete _0x38a905[_0x09ae('0x29')];}_0x525b00['status'](_0x4631c5)[_0x09ae('0x2a')](_0x38a905);};}exports['index']=function(_0x561242,_0x1dd75b){var _0x558f59={},_0x31dd9e={},_0x1dce27={'count':0x0,'rows':[]};var _0x15825=_['map'](db[_0x09ae('0x2b')][_0x09ae('0x2c')],function(_0x38b45d){return{'name':_0x38b45d[_0x09ae('0x2d')],'type':_0x38b45d['type']['key']};});_0x31dd9e[_0x09ae('0x2e')]=_['map'](_0x15825,_0x09ae('0x29'));_0x31dd9e[_0x09ae('0x2f')]=_['keys'](_0x561242['query']);_0x31dd9e[_0x09ae('0x30')]=_[_0x09ae('0x31')](_0x31dd9e[_0x09ae('0x2e')],_0x31dd9e[_0x09ae('0x2f')]);_0x558f59[_0x09ae('0x32')]=_[_0x09ae('0x31')](_0x31dd9e['model'],qs['fields'](_0x561242[_0x09ae('0x2f')][_0x09ae('0x33')]));_0x558f59[_0x09ae('0x32')]=_0x558f59[_0x09ae('0x32')]['length']?_0x558f59[_0x09ae('0x32')]:_0x31dd9e[_0x09ae('0x2e')];if(!_0x561242[_0x09ae('0x2f')]['hasOwnProperty'](_0x09ae('0x34'))){_0x558f59[_0x09ae('0x1f')]=qs[_0x09ae('0x1f')](_0x561242[_0x09ae('0x2f')][_0x09ae('0x1f')]);_0x558f59[_0x09ae('0x1c')]=qs['offset'](_0x561242[_0x09ae('0x2f')][_0x09ae('0x1c')]);}_0x558f59[_0x09ae('0x35')]=qs[_0x09ae('0x36')](_0x561242[_0x09ae('0x2f')][_0x09ae('0x36')]);_0x558f59[_0x09ae('0x37')]=qs[_0x09ae('0x30')](_[_0x09ae('0x38')](_0x561242[_0x09ae('0x2f')],_0x31dd9e[_0x09ae('0x30')]),_0x15825);if(_0x561242[_0x09ae('0x2f')][_0x09ae('0x39')]){_0x558f59['where']=_[_0x09ae('0x3a')](_0x558f59[_0x09ae('0x37')],{'$or':_['map'](_0x15825,function(_0x2b9eef){if(_0x2b9eef[_0x09ae('0x3b')]!==_0x09ae('0x3c')){var _0x3ec833={};_0x3ec833[_0x2b9eef['name']]={'$like':'%'+_0x561242[_0x09ae('0x2f')][_0x09ae('0x39')]+'%'};return _0x3ec833;}})});}_0x558f59=_[_0x09ae('0x3a')]({},_0x558f59,_0x561242[_0x09ae('0x3d')]);var _0x5002cf={'where':_0x558f59[_0x09ae('0x37')]};return db[_0x09ae('0x2b')]['count'](_0x5002cf)[_0x09ae('0x25')](function(_0x5bc73f){_0x1dce27[_0x09ae('0x1e')]=_0x5bc73f;if(_0x561242['query'][_0x09ae('0x3e')]){_0x558f59['include']=[{'all':!![]}];}return db['SalesforceField']['findAll'](_0x558f59);})[_0x09ae('0x25')](function(_0x34ad7e){_0x1dce27[_0x09ae('0x3f')]=_0x34ad7e;return _0x1dce27;})[_0x09ae('0x25')](respondWithFilteredResult(_0x1dd75b,_0x558f59))[_0x09ae('0x40')](handleError(_0x1dd75b,null));};exports[_0x09ae('0x41')]=function(_0x5a0ca3,_0x17890e){var _0x35c72b={'raw':!![],'where':{'id':_0x5a0ca3[_0x09ae('0x42')]['id']}},_0x1ea2e6={};_0x1ea2e6[_0x09ae('0x2e')]=_[_0x09ae('0x43')](db['SalesforceField'][_0x09ae('0x2c')]);_0x1ea2e6['query']=_['keys'](_0x5a0ca3[_0x09ae('0x2f')]);_0x1ea2e6[_0x09ae('0x30')]=_[_0x09ae('0x31')](_0x1ea2e6[_0x09ae('0x2e')],_0x1ea2e6[_0x09ae('0x2f')]);_0x35c72b[_0x09ae('0x32')]=_['intersection'](_0x1ea2e6[_0x09ae('0x2e')],qs['fields'](_0x5a0ca3[_0x09ae('0x2f')][_0x09ae('0x33')]));_0x35c72b[_0x09ae('0x32')]=_0x35c72b[_0x09ae('0x32')][_0x09ae('0x44')]?_0x35c72b[_0x09ae('0x32')]:_0x1ea2e6['model'];if(_0x5a0ca3[_0x09ae('0x2f')]['includeAll']){_0x35c72b[_0x09ae('0x45')]=[{'all':!![]}];}_0x35c72b=_[_0x09ae('0x3a')]({},_0x35c72b,_0x5a0ca3[_0x09ae('0x3d')]);return db[_0x09ae('0x2b')][_0x09ae('0x46')](_0x35c72b)[_0x09ae('0x25')](handleEntityNotFound(_0x17890e,null))[_0x09ae('0x25')](respondWithResult(_0x17890e,null))[_0x09ae('0x40')](handleError(_0x17890e,null));};exports[_0x09ae('0x47')]=function(_0x1ef66e,_0xd986fb){return db[_0x09ae('0x2b')][_0x09ae('0x47')](_0x1ef66e[_0x09ae('0x48')],{})['then'](respondWithResult(_0xd986fb,0xc9))[_0x09ae('0x40')](handleError(_0xd986fb,null));};exports[_0x09ae('0x24')]=function(_0x505579,_0x149049){if(_0x505579['body']['id']){delete _0x505579[_0x09ae('0x48')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x505579[_0x09ae('0x42')]['id']}})['then'](handleEntityNotFound(_0x149049,null))[_0x09ae('0x25')](saveUpdates(_0x505579[_0x09ae('0x48')],null))[_0x09ae('0x25')](respondWithResult(_0x149049,null))['catch'](handleError(_0x149049,null));};exports[_0x09ae('0x26')]=function(_0x4e098e,_0x57ae49){return db[_0x09ae('0x2b')]['find']({'where':{'id':_0x4e098e[_0x09ae('0x42')]['id']}})['then'](handleEntityNotFound(_0x57ae49,null))['then'](removeEntity(_0x57ae49,null))[_0x09ae('0x40')](handleError(_0x57ae49,null));}; \ No newline at end of file +var _0xae98=['desk.js','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','undefined','limit','count','offset','set','Content-Range','reject','save','destroy','then','error','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','fields','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xae98,0x8e));var _0x8ae9=function(_0x3aba97,_0x234613){_0x3aba97=_0x3aba97-0x0;var _0x3d3b8e=_0xae98[_0x3aba97];return _0x3d3b8e;};'use strict';var emlformat=require(_0x8ae9('0x0'));var rimraf=require(_0x8ae9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8ae9('0x2'));var rp=require(_0x8ae9('0x3'));var moment=require(_0x8ae9('0x4'));var BPromise=require(_0x8ae9('0x5'));var Mustache=require(_0x8ae9('0x6'));var util=require(_0x8ae9('0x7'));var path=require('path');var sox=require(_0x8ae9('0x8'));var csv=require(_0x8ae9('0x9'));var ejs=require(_0x8ae9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ae9('0xb'));var _=require(_0x8ae9('0xc'));var squel=require(_0x8ae9('0xd'));var crypto=require(_0x8ae9('0xe'));var jsforce=require(_0x8ae9('0xf'));var deskjs=require(_0x8ae9('0x10'));var toCsv=require(_0x8ae9('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8ae9('0x11'));var authService=require(_0x8ae9('0x12'));var qs=require(_0x8ae9('0x13'));var as=require(_0x8ae9('0x14'));var hardwareService=require(_0x8ae9('0x15'));var logger=require(_0x8ae9('0x16'))(_0x8ae9('0x17'));var utils=require('../../config/utils');var config=require(_0x8ae9('0x18'));var licenseUtil=require(_0x8ae9('0x19'));var db=require(_0x8ae9('0x1a'))['db'];function respondWithStatusCode(_0xd0a585,_0x5d1172){_0x5d1172=_0x5d1172||0xcc;return function(_0x428d8a){if(_0x428d8a){return _0xd0a585[_0x8ae9('0x1b')](_0x5d1172);}return _0xd0a585[_0x8ae9('0x1c')](_0x5d1172)[_0x8ae9('0x1d')]();};}function respondWithResult(_0x113987,_0xdab9cb){_0xdab9cb=_0xdab9cb||0xc8;return function(_0x2167a3){if(_0x2167a3){return _0x113987[_0x8ae9('0x1c')](_0xdab9cb)[_0x8ae9('0x1e')](_0x2167a3);}};}function respondWithFilteredResult(_0x461cf5,_0x231313){return function(_0x3e3523){if(_0x3e3523){var _0x43b63e=typeof _0x231313['offset']===_0x8ae9('0x1f')&&typeof _0x231313[_0x8ae9('0x20')]==='undefined';var _0x240a24=_0x3e3523[_0x8ae9('0x21')];var _0x553559=_0x43b63e?0x0:_0x231313[_0x8ae9('0x22')];var _0x1d6416=_0x43b63e?_0x3e3523[_0x8ae9('0x21')]:_0x231313['offset']+_0x231313[_0x8ae9('0x20')];var _0x263078;if(_0x1d6416>=_0x240a24){_0x1d6416=_0x240a24;_0x263078=0xc8;}else{_0x263078=0xce;}_0x461cf5[_0x8ae9('0x1c')](_0x263078);return _0x461cf5[_0x8ae9('0x23')](_0x8ae9('0x24'),_0x553559+'-'+_0x1d6416+'/'+_0x240a24)[_0x8ae9('0x1e')](_0x3e3523);}return null;};}function patchUpdates(_0x4a8bf4){return function(_0x191188){try{jsonpatch['apply'](_0x191188,_0x4a8bf4,!![]);}catch(_0x5d93da){return BPromise[_0x8ae9('0x25')](_0x5d93da);}return _0x191188[_0x8ae9('0x26')]();};}function saveUpdates(_0x3e87e0,_0x532353){return function(_0x19875e){if(_0x19875e){return _0x19875e['update'](_0x3e87e0)['then'](function(_0x314dea){return _0x314dea;});}return null;};}function removeEntity(_0x55ee23,_0x344db2){return function(_0x1a814c){if(_0x1a814c){return _0x1a814c[_0x8ae9('0x27')]()[_0x8ae9('0x28')](function(){_0x55ee23[_0x8ae9('0x1c')](0xcc)[_0x8ae9('0x1d')]();});}};}function handleEntityNotFound(_0x2d8ff6,_0x4ee1f){return function(_0xef5381){if(!_0xef5381){_0x2d8ff6['sendStatus'](0x194);}return _0xef5381;};}function handleError(_0xb3c75e,_0x13c0f7){_0x13c0f7=_0x13c0f7||0x1f4;return function(_0x254071){logger[_0x8ae9('0x29')](_0x254071['stack']);if(_0x254071[_0x8ae9('0x2a')]){delete _0x254071['name'];}_0xb3c75e[_0x8ae9('0x1c')](_0x13c0f7)[_0x8ae9('0x2b')](_0x254071);};}exports[_0x8ae9('0x2c')]=function(_0x216757,_0x38071e){var _0x3d4a0b={},_0x40f9c8={},_0x2db2d3={'count':0x0,'rows':[]};var _0x54cb05=_[_0x8ae9('0x2d')](db[_0x8ae9('0x2e')][_0x8ae9('0x2f')],function(_0x37a84a){return{'name':_0x37a84a[_0x8ae9('0x30')],'type':_0x37a84a[_0x8ae9('0x31')][_0x8ae9('0x32')]};});_0x40f9c8[_0x8ae9('0x33')]=_['map'](_0x54cb05,_0x8ae9('0x2a'));_0x40f9c8['query']=_[_0x8ae9('0x34')](_0x216757[_0x8ae9('0x35')]);_0x40f9c8['filters']=_[_0x8ae9('0x36')](_0x40f9c8['model'],_0x40f9c8[_0x8ae9('0x35')]);_0x3d4a0b[_0x8ae9('0x37')]=_[_0x8ae9('0x36')](_0x40f9c8[_0x8ae9('0x33')],qs['fields'](_0x216757[_0x8ae9('0x35')]['fields']));_0x3d4a0b[_0x8ae9('0x37')]=_0x3d4a0b[_0x8ae9('0x37')][_0x8ae9('0x38')]?_0x3d4a0b['attributes']:_0x40f9c8[_0x8ae9('0x33')];if(!_0x216757[_0x8ae9('0x35')][_0x8ae9('0x39')](_0x8ae9('0x3a'))){_0x3d4a0b[_0x8ae9('0x20')]=qs[_0x8ae9('0x20')](_0x216757[_0x8ae9('0x35')][_0x8ae9('0x20')]);_0x3d4a0b[_0x8ae9('0x22')]=qs[_0x8ae9('0x22')](_0x216757['query']['offset']);}_0x3d4a0b[_0x8ae9('0x3b')]=qs[_0x8ae9('0x3c')](_0x216757[_0x8ae9('0x35')][_0x8ae9('0x3c')]);_0x3d4a0b[_0x8ae9('0x3d')]=qs[_0x8ae9('0x3e')](_[_0x8ae9('0x3f')](_0x216757['query'],_0x40f9c8[_0x8ae9('0x3e')]),_0x54cb05);if(_0x216757[_0x8ae9('0x35')]['filter']){_0x3d4a0b[_0x8ae9('0x3d')]=_[_0x8ae9('0x40')](_0x3d4a0b[_0x8ae9('0x3d')],{'$or':_[_0x8ae9('0x2d')](_0x54cb05,function(_0x28b6fe){if(_0x28b6fe[_0x8ae9('0x31')]!==_0x8ae9('0x41')){var _0xf63737={};_0xf63737[_0x28b6fe[_0x8ae9('0x2a')]]={'$like':'%'+_0x216757[_0x8ae9('0x35')][_0x8ae9('0x42')]+'%'};return _0xf63737;}})});}_0x3d4a0b=_[_0x8ae9('0x40')]({},_0x3d4a0b,_0x216757[_0x8ae9('0x43')]);var _0x597381={'where':_0x3d4a0b[_0x8ae9('0x3d')]};return db[_0x8ae9('0x2e')][_0x8ae9('0x21')](_0x597381)['then'](function(_0xaae65b){_0x2db2d3['count']=_0xaae65b;if(_0x216757['query'][_0x8ae9('0x44')]){_0x3d4a0b[_0x8ae9('0x45')]=[{'all':!![]}];}return db[_0x8ae9('0x2e')][_0x8ae9('0x46')](_0x3d4a0b);})['then'](function(_0x53ecfa){_0x2db2d3[_0x8ae9('0x47')]=_0x53ecfa;return _0x2db2d3;})['then'](respondWithFilteredResult(_0x38071e,_0x3d4a0b))['catch'](handleError(_0x38071e,null));};exports[_0x8ae9('0x48')]=function(_0x14ede7,_0x172aab){var _0x1707f6={'raw':!![],'where':{'id':_0x14ede7['params']['id']}},_0x5d0df9={};_0x5d0df9[_0x8ae9('0x33')]=_['keys'](db[_0x8ae9('0x2e')][_0x8ae9('0x2f')]);_0x5d0df9[_0x8ae9('0x35')]=_[_0x8ae9('0x34')](_0x14ede7[_0x8ae9('0x35')]);_0x5d0df9['filters']=_[_0x8ae9('0x36')](_0x5d0df9[_0x8ae9('0x33')],_0x5d0df9[_0x8ae9('0x35')]);_0x1707f6[_0x8ae9('0x37')]=_[_0x8ae9('0x36')](_0x5d0df9['model'],qs['fields'](_0x14ede7[_0x8ae9('0x35')][_0x8ae9('0x49')]));_0x1707f6[_0x8ae9('0x37')]=_0x1707f6[_0x8ae9('0x37')][_0x8ae9('0x38')]?_0x1707f6[_0x8ae9('0x37')]:_0x5d0df9[_0x8ae9('0x33')];if(_0x14ede7[_0x8ae9('0x35')]['includeAll']){_0x1707f6[_0x8ae9('0x45')]=[{'all':!![]}];}_0x1707f6=_[_0x8ae9('0x40')]({},_0x1707f6,_0x14ede7[_0x8ae9('0x43')]);return db['SalesforceField']['find'](_0x1707f6)[_0x8ae9('0x28')](handleEntityNotFound(_0x172aab,null))['then'](respondWithResult(_0x172aab,null))[_0x8ae9('0x4a')](handleError(_0x172aab,null));};exports[_0x8ae9('0x4b')]=function(_0x51e4ca,_0x26f367){return db[_0x8ae9('0x2e')][_0x8ae9('0x4b')](_0x51e4ca[_0x8ae9('0x4c')],{})[_0x8ae9('0x28')](respondWithResult(_0x26f367,0xc9))['catch'](handleError(_0x26f367,null));};exports['update']=function(_0x22cbab,_0x2f5771){if(_0x22cbab[_0x8ae9('0x4c')]['id']){delete _0x22cbab[_0x8ae9('0x4c')]['id'];}return db[_0x8ae9('0x2e')][_0x8ae9('0x4d')]({'where':{'id':_0x22cbab[_0x8ae9('0x4e')]['id']}})[_0x8ae9('0x28')](handleEntityNotFound(_0x2f5771,null))[_0x8ae9('0x28')](saveUpdates(_0x22cbab[_0x8ae9('0x4c')],null))[_0x8ae9('0x28')](respondWithResult(_0x2f5771,null))[_0x8ae9('0x4a')](handleError(_0x2f5771,null));};exports[_0x8ae9('0x27')]=function(_0x3f63af,_0x25a8ba){return db['SalesforceField'][_0x8ae9('0x4d')]({'where':{'id':_0x3f63af[_0x8ae9('0x4e')]['id']}})[_0x8ae9('0x28')](handleEntityNotFound(_0x25a8ba,null))[_0x8ae9('0x28')](removeEntity(_0x25a8ba,null))[_0x8ae9('0x4a')](handleError(_0x25a8ba,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 6cf070f..1c1aea1 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 _0xc447=['moment','request-promise','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','lodash','api'];(function(_0x2931d6,_0x3eff03){var _0x288cc9=function(_0x165224){while(--_0x165224){_0x2931d6['push'](_0x2931d6['shift']());}};_0x288cc9(++_0x3eff03);}(_0xc447,0x15d));var _0x7c44=function(_0x184d27,_0x159734){_0x184d27=_0x184d27-0x0;var _0x2a7e2c=_0xc447[_0x184d27];return _0x2a7e2c;};'use strict';var _=require(_0x7c44('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7c44('0x1'));var moment=require(_0x7c44('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c44('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c44('0x4'));var config=require(_0x7c44('0x5'));var attributes=require(_0x7c44('0x6'));module[_0x7c44('0x7')]=function(_0x466488,_0x47a46c){return _0x466488[_0x7c44('0x8')](_0x7c44('0x9'),attributes,{'tableName':_0x7c44('0xa'),'paranoid':![],'indexes':[{'name':_0x7c44('0xb'),'fields':['idField',_0x7c44('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4f9f=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path'];(function(_0x440907,_0x34d330){var _0x1da00b=function(_0xa56213){while(--_0xa56213){_0x440907['push'](_0x440907['shift']());}};_0x1da00b(++_0x34d330);}(_0x4f9f,0x72));var _0xf4f9=function(_0x3ddb2,_0x386ec3){_0x3ddb2=_0x3ddb2-0x0;var _0x41cc1f=_0x4f9f[_0x3ddb2];return _0x41cc1f;};'use strict';var _=require('lodash');var util=require(_0xf4f9('0x0'));var logger=require(_0xf4f9('0x1'))(_0xf4f9('0x2'));var moment=require(_0xf4f9('0x3'));var BPromise=require(_0xf4f9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4f9('0x5'));var rimraf=require('rimraf');var config=require(_0xf4f9('0x6'));var attributes=require(_0xf4f9('0x7'));module[_0xf4f9('0x8')]=function(_0x55769d,_0x6bd248){return _0x55769d[_0xf4f9('0x9')](_0xf4f9('0xa'),attributes,{'tableName':_0xf4f9('0xb'),'paranoid':![],'indexes':[{'name':_0xf4f9('0xc'),'fields':[_0xf4f9('0xd'),_0xf4f9('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index d1ca6ff..6ece620 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 _0x5b3a=['SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5b83b1,_0x3d175a){var _0x1ddca1=function(_0x3a2de4){while(--_0x3a2de4){_0x5b83b1['push'](_0x5b83b1['shift']());}};_0x1ddca1(++_0x3d175a);}(_0x5b3a,0x1c3));var _0xa5b3=function(_0x26114b,_0x32e6d2){_0x26114b=_0x26114b-0x0;var _0x1bdf60=_0x5b3a[_0x26114b];return _0x1bdf60;};'use strict';var _=require(_0xa5b3('0x0'));var util=require(_0xa5b3('0x1'));var moment=require(_0xa5b3('0x2'));var BPromise=require(_0xa5b3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5b3('0x4'));var db=require(_0xa5b3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa5b3('0x6'))(_0xa5b3('0x7'));var config=require(_0xa5b3('0x8'));var jayson=require(_0xa5b3('0x9'));var client=jayson[_0xa5b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20cfb2,_0x3d92c5,_0x12fd1f){return new BPromise(function(_0x2b1370,_0x4d0879){return client['request'](_0x20cfb2,_0x12fd1f)['then'](function(_0x38fadc){logger['info'](_0xa5b3('0xb'),_0x3d92c5,_0xa5b3('0xc'));logger[_0xa5b3('0xd')](_0xa5b3('0xe'),_0x3d92c5,_0xa5b3('0xc'),JSON[_0xa5b3('0xf')](_0x38fadc));if(_0x38fadc[_0xa5b3('0x10')]){if(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x11')]===0x1f4){logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x38fadc[_0xa5b3('0x10')]['message']);return _0x4d0879(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x12')]);}logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x38fadc['error'][_0xa5b3('0x12')]);return _0x2b1370(_0x38fadc[_0xa5b3('0x10')][_0xa5b3('0x12')]);}else{logger[_0xa5b3('0x13')]('SalesforceField,\x20%s,\x20%s',_0x3d92c5,_0xa5b3('0xc'));_0x2b1370(_0x38fadc[_0xa5b3('0x14')][_0xa5b3('0x12')]);}})[_0xa5b3('0x15')](function(_0x4cd253){logger[_0xa5b3('0x10')](_0xa5b3('0xb'),_0x3d92c5,_0x4cd253);_0x4d0879(_0x4cd253);});});} \ No newline at end of file +var _0xcd84=['http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xcd84,0xb5));var _0x4cd8=function(_0x4f67b5,_0xc1b1cb){_0x4f67b5=_0x4f67b5-0x0;var _0x1ab1dc=_0xcd84[_0x4f67b5];return _0x1ab1dc;};'use strict';var _=require(_0x4cd8('0x0'));var util=require(_0x4cd8('0x1'));var moment=require(_0x4cd8('0x2'));var BPromise=require(_0x4cd8('0x3'));var rs=require(_0x4cd8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4cd8('0x5'));var logger=require(_0x4cd8('0x6'))(_0x4cd8('0x7'));var config=require(_0x4cd8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4cd8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aed47,_0x3a54ee,_0x22ecf3){return new BPromise(function(_0x3174f8,_0x43d3c2){return client[_0x4cd8('0xa')](_0x4aed47,_0x22ecf3)[_0x4cd8('0xb')](function(_0x1a8ee3){logger['info'](_0x4cd8('0xc'),_0x3a54ee,_0x4cd8('0xd'));logger[_0x4cd8('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x3a54ee,_0x4cd8('0xd'),JSON['stringify'](_0x1a8ee3));if(_0x1a8ee3['error']){if(_0x1a8ee3[_0x4cd8('0xf')][_0x4cd8('0x10')]===0x1f4){logger[_0x4cd8('0xf')](_0x4cd8('0xc'),_0x3a54ee,_0x1a8ee3[_0x4cd8('0xf')][_0x4cd8('0x11')]);return _0x43d3c2(_0x1a8ee3[_0x4cd8('0xf')][_0x4cd8('0x11')]);}logger[_0x4cd8('0xf')](_0x4cd8('0xc'),_0x3a54ee,_0x1a8ee3[_0x4cd8('0xf')]['message']);return _0x3174f8(_0x1a8ee3[_0x4cd8('0xf')][_0x4cd8('0x11')]);}else{logger['info'](_0x4cd8('0xc'),_0x3a54ee,'request\x20sent');_0x3174f8(_0x1a8ee3['result'][_0x4cd8('0x11')]);}})[_0x4cd8('0x12')](function(_0x39ddaa){logger[_0x4cd8('0xf')](_0x4cd8('0xc'),_0x3a54ee,_0x39ddaa);_0x43d3c2(_0x39ddaa);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a03729f..8964f28 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 _0xbb50=['addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x298597,_0x2e839d){var _0x4a92e4=function(_0x31050b){while(--_0x31050b){_0x298597['push'](_0x298597['shift']());}};_0x4a92e4(++_0x2e839d);}(_0xbb50,0x11b));var _0x0bb5=function(_0x2dae0c,_0x3b578c){_0x2dae0c=_0x2dae0c-0x0;var _0x36c35b=_0xbb50[_0x2dae0c];return _0x36c35b;};'use strict';var multer=require(_0x0bb5('0x0'));var util=require(_0x0bb5('0x1'));var path=require(_0x0bb5('0x2'));var timeout=require(_0x0bb5('0x3'));var express=require(_0x0bb5('0x4'));var router=express['Router']();var fs_extra=require(_0x0bb5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0bb5('0x6'));var config=require('../../config/environment');var controller=require(_0x0bb5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0bb5('0x8')]('/:id',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xa')]);router[_0x0bb5('0x8')]('/:id/configurations',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xb')]);router[_0x0bb5('0x8')](_0x0bb5('0xc'),auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xd')]);router[_0x0bb5('0xe')]('/',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0xf')]);router[_0x0bb5('0xe')]('/:id/configurations',auth[_0x0bb5('0x9')](),controller[_0x0bb5('0x10')]);router[_0x0bb5('0x11')](_0x0bb5('0x12'),auth[_0x0bb5('0x9')](),controller[_0x0bb5('0x13')]);router[_0x0bb5('0x14')](_0x0bb5('0x12'),auth['isAuthenticated'](),controller[_0x0bb5('0x15')]);module[_0x0bb5('0x16')]=router; \ No newline at end of file +var _0x870d=['path','connect-timeout','Router','../../components/interaction/service','./intServicenowAccount.controller','get','index','show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','exports','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x870d,0x124));var _0xd870=function(_0x26fa64,_0x96bc8c){_0x26fa64=_0x26fa64-0x0;var _0x3c1c96=_0x870d[_0x26fa64];return _0x3c1c96;};'use strict';var multer=require(_0xd870('0x0'));var util=require(_0xd870('0x1'));var path=require(_0xd870('0x2'));var timeout=require(_0xd870('0x3'));var express=require('express');var router=express[_0xd870('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd870('0x5'));var config=require('../../config/environment');var controller=require(_0xd870('0x6'));router[_0xd870('0x7')]('/',auth['isAuthenticated'](),controller[_0xd870('0x8')]);router[_0xd870('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xd870('0x9')]);router[_0xd870('0x7')](_0xd870('0xa'),auth[_0xd870('0xb')](),controller[_0xd870('0xc')]);router[_0xd870('0x7')](_0xd870('0xd'),auth['isAuthenticated'](),controller[_0xd870('0xe')]);router[_0xd870('0xf')]('/',auth[_0xd870('0xb')](),controller[_0xd870('0x10')]);router[_0xd870('0xf')](_0xd870('0xa'),auth[_0xd870('0xb')](),controller[_0xd870('0x11')]);router[_0xd870('0x12')](_0xd870('0x13'),auth[_0xd870('0xb')](),controller['update']);router['delete'](_0xd870('0x13'),auth['isAuthenticated'](),controller['destroy']);module[_0xd870('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 fe74294..16ba88d 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 _0x0329=['sequelize','exports','STRING','remoteUri'];(function(_0x566db6,_0x15baaa){var _0x56c315=function(_0x292cd6){while(--_0x292cd6){_0x566db6['push'](_0x566db6['shift']());}};_0x56c315(++_0x15baaa);}(_0x0329,0xe4));var _0x9032=function(_0x4424d7,_0x518a2c){_0x4424d7=_0x4424d7-0x0;var _0x513d98=_0x0329[_0x4424d7];return _0x513d98;};'use strict';var Sequelize=require(_0x9032('0x0'));module[_0x9032('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9032('0x2')]},'username':{'type':Sequelize[_0x9032('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9032('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x9032('0x3')},'serverUrl':{'type':Sequelize[_0x9032('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1c98=['STRING','sequelize','exports'];(function(_0x3dde1a,_0x5bacd2){var _0x1a50ad=function(_0x3c0b6f){while(--_0x3c0b6f){_0x3dde1a['push'](_0x3dde1a['shift']());}};_0x1a50ad(++_0x5bacd2);}(_0x1c98,0xc7));var _0x81c9=function(_0x3a07f1,_0x1333df){_0x3a07f1=_0x3a07f1-0x0;var _0x4f94a8=_0x1c98[_0x3a07f1];return _0x4f94a8;};'use strict';var Sequelize=require(_0x81c9('0x0'));module[_0x81c9('0x1')]={'name':{'type':Sequelize[_0x81c9('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x81c9('0x2')]},'remoteUri':{'type':Sequelize[_0x81c9('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x81c9('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 549cf68..1d56895 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 _0x3bea=['sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','ServicenowAccount','includeAll','findAll','rows','show','params','catch','create','body','find','getConfigurations','findOne','length','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','sys_class_name','close_notes','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','escalation','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','False','false'];(function(_0x1408e4,_0x77fddf){var _0x32f115=function(_0xe916b8){while(--_0xe916b8){_0x1408e4['push'](_0x1408e4['shift']());}};_0x32f115(++_0x77fddf);}(_0x3bea,0xb4));var _0xa3be=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x3bea[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3be('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3be('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa3be('0x2'));var path=require(_0xa3be('0x3'));var sox=require(_0xa3be('0x4'));var csv=require(_0xa3be('0x5'));var ejs=require(_0xa3be('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3be('0x7'));var squel=require(_0xa3be('0x8'));var crypto=require(_0xa3be('0x9'));var jsforce=require(_0xa3be('0xa'));var deskjs=require(_0xa3be('0xb'));var toCsv=require(_0xa3be('0x5'));var querystring=require(_0xa3be('0xc'));var Papa=require(_0xa3be('0xd'));var Redis=require(_0xa3be('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa3be('0xf'));var as=require(_0xa3be('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3be('0x11'))('api');var utils=require(_0xa3be('0x12'));var config=require(_0xa3be('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3be('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14bbd6,_0x42207e){_0x42207e=_0x42207e||0xcc;return function(_0x1d4988){if(_0x1d4988){return _0x14bbd6[_0xa3be('0x15')](_0x42207e);}return _0x14bbd6['status'](_0x42207e)[_0xa3be('0x16')]();};}function respondWithResult(_0xf3e6ed,_0x326a10){_0x326a10=_0x326a10||0xc8;return function(_0x22920a){if(_0x22920a){return _0xf3e6ed[_0xa3be('0x17')](_0x326a10)[_0xa3be('0x18')](_0x22920a);}};}function respondWithFilteredResult(_0x7dbc3f,_0x51267d){return function(_0x29dff4){if(_0x29dff4){var _0x141deb=typeof _0x51267d[_0xa3be('0x19')]==='undefined'&&typeof _0x51267d[_0xa3be('0x1a')]===_0xa3be('0x1b');var _0x2ac363=_0x29dff4[_0xa3be('0x1c')];var _0x370675=_0x141deb?0x0:_0x51267d[_0xa3be('0x19')];var _0x355130=_0x141deb?_0x29dff4[_0xa3be('0x1c')]:_0x51267d[_0xa3be('0x19')]+_0x51267d[_0xa3be('0x1a')];var _0x178707;if(_0x355130>=_0x2ac363){_0x355130=_0x2ac363;_0x178707=0xc8;}else{_0x178707=0xce;}_0x7dbc3f[_0xa3be('0x17')](_0x178707);return _0x7dbc3f[_0xa3be('0x1d')](_0xa3be('0x1e'),_0x370675+'-'+_0x355130+'/'+_0x2ac363)[_0xa3be('0x18')](_0x29dff4);}return null;};}function patchUpdates(_0x150d60){return function(_0x2ed791){try{jsonpatch[_0xa3be('0x1f')](_0x2ed791,_0x150d60,!![]);}catch(_0x5c9ecf){return BPromise[_0xa3be('0x20')](_0x5c9ecf);}return _0x2ed791[_0xa3be('0x21')]();};}function saveUpdates(_0x1211e2,_0x15b494){return function(_0x3c8d8a){if(_0x3c8d8a){return _0x3c8d8a['update'](_0x1211e2)[_0xa3be('0x22')](function(_0x2961f8){return _0x2961f8;});}return null;};}function removeEntity(_0x4841aa,_0x66baf5){return function(_0x242c8d){if(_0x242c8d){return _0x242c8d[_0xa3be('0x23')]()['then'](function(){_0x4841aa[_0xa3be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa2bec6,_0x1f70e3){return function(_0x544da5){if(!_0x544da5){_0xa2bec6['sendStatus'](0x194);}return _0x544da5;};}function handleError(_0x322153,_0x2c89d0){_0x2c89d0=_0x2c89d0||0x1f4;return function(_0x4c261a){logger['error'](_0x4c261a[_0xa3be('0x24')]);if(_0x4c261a['name']){delete _0x4c261a[_0xa3be('0x25')];}_0x322153['status'](_0x2c89d0)[_0xa3be('0x26')](_0x4c261a);};}exports[_0xa3be('0x27')]=function(_0x564b7b,_0x2a795f){var _0x1f8cc1={},_0x4617ac={},_0x3629ef={'count':0x0,'rows':[]};var _0x5611a6=_[_0xa3be('0x28')](db['ServicenowAccount'][_0xa3be('0x29')],function(_0x4b85ec){return{'name':_0x4b85ec[_0xa3be('0x2a')],'type':_0x4b85ec[_0xa3be('0x2b')][_0xa3be('0x2c')]};});_0x4617ac[_0xa3be('0x2d')]=_[_0xa3be('0x28')](_0x5611a6,_0xa3be('0x25'));_0x4617ac[_0xa3be('0x2e')]=_[_0xa3be('0x2f')](_0x564b7b['query']);_0x4617ac[_0xa3be('0x30')]=_['intersection'](_0x4617ac[_0xa3be('0x2d')],_0x4617ac[_0xa3be('0x2e')]);_0x1f8cc1[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x4617ac[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x564b7b['query'][_0xa3be('0x33')]));_0x1f8cc1[_0xa3be('0x31')]=_0x1f8cc1[_0xa3be('0x31')]['length']?_0x1f8cc1[_0xa3be('0x31')]:_0x4617ac['model'];if(!_0x564b7b['query'][_0xa3be('0x34')]('nolimit')){_0x1f8cc1[_0xa3be('0x1a')]=qs[_0xa3be('0x1a')](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x1a')]);_0x1f8cc1[_0xa3be('0x19')]=qs['offset'](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x19')]);}_0x1f8cc1[_0xa3be('0x35')]=qs['sort'](_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x36')]);_0x1f8cc1[_0xa3be('0x37')]=qs[_0xa3be('0x30')](_[_0xa3be('0x38')](_0x564b7b[_0xa3be('0x2e')],_0x4617ac[_0xa3be('0x30')]),_0x5611a6);if(_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x39')]){_0x1f8cc1[_0xa3be('0x37')]=_['merge'](_0x1f8cc1[_0xa3be('0x37')],{'$or':_[_0xa3be('0x28')](_0x5611a6,function(_0x192d0f){if(_0x192d0f[_0xa3be('0x2b')]!==_0xa3be('0x3a')){var _0x534ed8={};_0x534ed8[_0x192d0f[_0xa3be('0x25')]]={'$like':'%'+_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x39')]+'%'};return _0x534ed8;}})});}_0x1f8cc1=_[_0xa3be('0x3b')]({},_0x1f8cc1,_0x564b7b[_0xa3be('0x3c')]);var _0x3bd540={'where':_0x1f8cc1[_0xa3be('0x37')]};return db[_0xa3be('0x3d')][_0xa3be('0x1c')](_0x3bd540)['then'](function(_0x255a21){_0x3629ef[_0xa3be('0x1c')]=_0x255a21;if(_0x564b7b[_0xa3be('0x2e')][_0xa3be('0x3e')]){_0x1f8cc1['include']=[{'all':!![]}];}return db[_0xa3be('0x3d')][_0xa3be('0x3f')](_0x1f8cc1);})['then'](function(_0x34bb7c){_0x3629ef[_0xa3be('0x40')]=_0x34bb7c;return _0x3629ef;})[_0xa3be('0x22')](respondWithFilteredResult(_0x2a795f,_0x1f8cc1))['catch'](handleError(_0x2a795f,null));};exports[_0xa3be('0x41')]=function(_0x5a2b6e,_0x2cccbe){var _0x3635c5={'raw':![],'where':{'id':_0x5a2b6e[_0xa3be('0x42')]['id']}},_0x106ad2={};_0x106ad2['model']=_[_0xa3be('0x2f')](db['ServicenowAccount'][_0xa3be('0x29')]);_0x106ad2[_0xa3be('0x2e')]=_[_0xa3be('0x2f')](_0x5a2b6e[_0xa3be('0x2e')]);_0x106ad2[_0xa3be('0x30')]=_[_0xa3be('0x32')](_0x106ad2[_0xa3be('0x2d')],_0x106ad2[_0xa3be('0x2e')]);_0x3635c5[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x106ad2[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x5a2b6e['query'][_0xa3be('0x33')]));_0x3635c5[_0xa3be('0x31')]=_0x3635c5['attributes']['length']?_0x3635c5['attributes']:_0x106ad2[_0xa3be('0x2d')];if(_0x5a2b6e[_0xa3be('0x2e')]['includeAll']){_0x3635c5['include']=[{'all':!![]}];}_0x3635c5=_['merge']({},_0x3635c5,_0x5a2b6e[_0xa3be('0x3c')]);return db[_0xa3be('0x3d')]['find'](_0x3635c5)[_0xa3be('0x22')](handleEntityNotFound(_0x2cccbe,null))[_0xa3be('0x22')](respondWithResult(_0x2cccbe,null))[_0xa3be('0x43')](handleError(_0x2cccbe,null));};exports[_0xa3be('0x44')]=function(_0x2cc9fd,_0x541e3d){return db['ServicenowAccount'][_0xa3be('0x44')](_0x2cc9fd[_0xa3be('0x45')],{})[_0xa3be('0x22')](respondWithResult(_0x541e3d,0xc9))[_0xa3be('0x43')](handleError(_0x541e3d,null));};exports['update']=function(_0x303828,_0x23da8e){if(_0x303828['body']['id']){delete _0x303828[_0xa3be('0x45')]['id'];}return db[_0xa3be('0x3d')][_0xa3be('0x46')]({'where':{'id':_0x303828[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x23da8e,null))[_0xa3be('0x22')](saveUpdates(_0x303828[_0xa3be('0x45')],null))[_0xa3be('0x22')](respondWithResult(_0x23da8e,null))[_0xa3be('0x43')](handleError(_0x23da8e,null));};exports[_0xa3be('0x23')]=function(_0x3384b0,_0x20aa44){return db[_0xa3be('0x3d')][_0xa3be('0x46')]({'where':{'id':_0x3384b0[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x20aa44,null))[_0xa3be('0x22')](removeEntity(_0x20aa44,null))[_0xa3be('0x43')](handleError(_0x20aa44,null));};exports[_0xa3be('0x47')]=function(_0x2e9232,_0x4dfc61,_0x9d31da){var _0x4de721={};var _0x8e4a83={};var _0xb1958d;var _0x56dd32;return db['ServicenowAccount'][_0xa3be('0x48')]({'where':{'id':_0x2e9232[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x4dfc61,null))[_0xa3be('0x22')](function(_0x5d0c14){if(_0x5d0c14){_0xb1958d=_0x5d0c14;_0x8e4a83[_0xa3be('0x2d')]=_[_0xa3be('0x2f')](db['ServicenowConfiguration'][_0xa3be('0x29')]);_0x8e4a83[_0xa3be('0x2e')]=_['keys'](_0x2e9232['query']);_0x8e4a83['filters']=_[_0xa3be('0x32')](_0x8e4a83[_0xa3be('0x2d')],_0x8e4a83[_0xa3be('0x2e')]);_0x4de721[_0xa3be('0x31')]=_[_0xa3be('0x32')](_0x8e4a83[_0xa3be('0x2d')],qs[_0xa3be('0x33')](_0x2e9232[_0xa3be('0x2e')]['fields']));_0x4de721[_0xa3be('0x31')]=_0x4de721[_0xa3be('0x31')][_0xa3be('0x49')]?_0x4de721[_0xa3be('0x31')]:_0x8e4a83[_0xa3be('0x2d')];_0x4de721[_0xa3be('0x35')]=qs[_0xa3be('0x36')](_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x36')]);_0x4de721[_0xa3be('0x37')]=qs['filters'](_[_0xa3be('0x38')](_0x2e9232[_0xa3be('0x2e')],_0x8e4a83[_0xa3be('0x30')]));if(_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x39')]){_0x4de721[_0xa3be('0x37')]=_['merge'](_0x4de721[_0xa3be('0x37')],{'$or':_[_0xa3be('0x28')](_0x4de721[_0xa3be('0x31')],function(_0x53af4d){var _0x3a802a={};_0x3a802a[_0x53af4d]={'$like':'%'+_0x2e9232[_0xa3be('0x2e')][_0xa3be('0x39')]+'%'};return _0x3a802a;})});}_0x4de721=_['merge']({},_0x4de721,_0x2e9232[_0xa3be('0x3c')]);return _0xb1958d[_0xa3be('0x47')](_0x4de721);}})[_0xa3be('0x22')](function(_0x173efa){if(_0x173efa){_0x56dd32=_0x173efa[_0xa3be('0x49')];if(!_0x2e9232[_0xa3be('0x2e')]['hasOwnProperty']('nolimit')){_0x4de721['limit']=qs[_0xa3be('0x1a')](_0x2e9232['query'][_0xa3be('0x1a')]);_0x4de721[_0xa3be('0x19')]=qs['offset'](_0x2e9232['query'][_0xa3be('0x19')]);}return _0xb1958d['getConfigurations'](_0x4de721);}})['then'](function(_0x11c7b2){if(_0x11c7b2){return _0x11c7b2?{'count':_0x56dd32,'rows':_0x11c7b2}:null;}})[_0xa3be('0x22')](respondWithResult(_0x4dfc61,null))[_0xa3be('0x43')](handleError(_0x4dfc61,null));};exports[_0xa3be('0x4a')]=function(_0x4aaf36,_0x129ede,_0x2728c0){if(_0x4aaf36[_0xa3be('0x45')]['id']){delete _0x4aaf36[_0xa3be('0x45')]['id'];}return db[_0xa3be('0x3d')]['findOne']({'where':{'id':_0x4aaf36[_0xa3be('0x42')]['id']}})[_0xa3be('0x22')](handleEntityNotFound(_0x129ede,null))[_0xa3be('0x22')](function(_0x4978ae){if(_0x4978ae){_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4b')]=_0x4978ae['id'];_0x4aaf36[_0xa3be('0x45')]['Subjects']=integrations[_0xa3be('0x4c')](_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4d')],_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x2b')]);_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x4e')]=integrations[_0xa3be('0x4f')](_0x4aaf36['body'][_0xa3be('0x4d')],_0x4aaf36[_0xa3be('0x45')][_0xa3be('0x2b')]);return db['ServicenowConfiguration'][_0xa3be('0x44')](_0x4aaf36[_0xa3be('0x45')],{'include':[{'model':db[_0xa3be('0x50')],'as':_0xa3be('0x51')},{'model':db[_0xa3be('0x50')],'as':_0xa3be('0x4e')}]});}return null;})[_0xa3be('0x22')](respondWithResult(_0x129ede,null))[_0xa3be('0x43')](handleError(_0x129ede,null));};exports['getFields']=function(_0x4b5c58,_0x4666d8,_0x17d56b){var _0x1064dd=[_0xa3be('0x52'),_0xa3be('0x53'),_0xa3be('0x54'),_0xa3be('0x55'),_0xa3be('0x56'),_0xa3be('0x57'),_0xa3be('0x58'),_0xa3be('0x59'),'category'];var _0x21223f=[_0xa3be('0x5a'),_0xa3be('0x52'),_0xa3be('0x5b'),'watch_list',_0xa3be('0x5c'),_0xa3be('0x5d'),'child_incidents','hold_reason',_0xa3be('0x5e'),'number',_0xa3be('0x5f'),_0xa3be('0x60'),_0xa3be('0x61'),_0xa3be('0x62'),_0xa3be('0x63'),_0xa3be('0x64'),_0xa3be('0x65'),'sys_created_by','knowledge','order','calendar_stc',_0xa3be('0x66'),_0xa3be('0x67'),'delivery_plan',_0xa3be('0x68'),_0xa3be('0x69'),_0xa3be('0x6a'),_0xa3be('0x6b'),_0xa3be('0x6c'),_0xa3be('0x6d'),_0xa3be('0x6e'),_0xa3be('0x6f'),_0xa3be('0x70'),'opened_at',_0xa3be('0x71'),_0xa3be('0x72'),_0xa3be('0x73'),_0xa3be('0x74'),_0xa3be('0x75'),_0xa3be('0x76'),'approval_set',_0xa3be('0x55'),_0xa3be('0x77'),_0xa3be('0x78'),_0xa3be('0x56'),_0xa3be('0x79'),_0xa3be('0x7a'),'work_start',_0xa3be('0x7b'),_0xa3be('0x7c'),_0xa3be('0x7d'),'description','calendar_duration',_0xa3be('0x57'),_0xa3be('0x7e'),_0xa3be('0x7f'),'closed_by',_0xa3be('0x80'),_0xa3be('0x81'),'sys_id',_0xa3be('0x82'),_0xa3be('0x83'),_0xa3be('0x58'),_0xa3be('0x84'),_0xa3be('0x85'),'company',_0xa3be('0x86'),_0xa3be('0x87'),'assigned_to',_0xa3be('0x59'),_0xa3be('0x88'),_0xa3be('0x89'),'approval',_0xa3be('0x8a'),_0xa3be('0x8b'),_0xa3be('0x8c'),'reopen_count','sys_tags',_0xa3be('0x8d'),'upon_approval',_0xa3be('0x8e'),'location',_0xa3be('0x8f')];var _0xb391b9='';var _0xf892b2='';var _0x3a302e=[];var _0x56344d='';var _0x32de84='';var _0x5efbe9=[];var _0x3194be='';var _0x3eeca3='';var _0x30cda0={};var _0x23530e='';return db[_0xa3be('0x3d')]['findOne']({'where':{'id':_0x4b5c58[_0xa3be('0x42')]['id']},'attributes':['id',_0xa3be('0x90'),_0xa3be('0x91'),_0xa3be('0x92'),_0xa3be('0x93'),_0xa3be('0x94')]})[_0xa3be('0x22')](handleEntityNotFound(_0x4666d8,null))[_0xa3be('0x22')](function(_0x410790){if(_0x410790){_0x23530e=_0x410790[_0xa3be('0x93')];var _0x282759=_0x23530e[_0xa3be('0x95')](-0x1);if(_0x282759==='/'){_0x23530e=_0x23530e['substring'](0x0,_0x23530e['lastIndexOf'](_0x282759));}_0x3eeca3=util[_0xa3be('0x96')](_0xa3be('0x97'),_0x23530e);_0x3194be=util[_0xa3be('0x96')](_0xa3be('0x98'),_0x23530e);_0x30cda0={'user':_0x410790['username'],'pass':_0x410790[_0xa3be('0x91')]};var _0x2d610b={'method':_0xa3be('0x99'),'uri':_0x3eeca3+_0xa3be('0x9a'),'auth':_0x30cda0,'json':!![]};return rp(_0x2d610b);}})[_0xa3be('0x22')](function(_0x28b2ae){if(_0x28b2ae[_0xa3be('0x9b')]['length']>0x0){_0xb391b9=_0x28b2ae[_0xa3be('0x9b')];}console[_0xa3be('0x9c')](_0xa3be('0x9d'),_0xb391b9);_0x5efbe9=[];_0xf892b2=Object['assign']([],_0xb391b9);_[_0xa3be('0x9e')](_0xf892b2,function(_0x1a7f94){return!_0x1064dd['includes'](_0x1a7f94[_0xa3be('0x25')]);});_0xf892b2[_0xa3be('0x9f')](function(_0x2bc784){var _0x57dc94=createFieldObject(_0x3194be,_0x30cda0,_0x2bc784[_0xa3be('0xa0')],_0x2bc784[_0xa3be('0x25')],_0x2bc784[_0xa3be('0xa1')],![]);_0x5efbe9[_0xa3be('0xa2')](_0x57dc94);});return Promise[_0xa3be('0xa3')](_0x5efbe9);})[_0xa3be('0x22')](function(_0x338f98){_0x3a302e=_0x338f98;_0x56344d=Object[_0xa3be('0xa4')]([],_0xb391b9);console[_0xa3be('0x9c')](_0xa3be('0xa5'),_0xb391b9);_['remove'](_0x56344d,function(_0x63b76e){return _0x21223f['includes'](_0x63b76e['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x56344d);_0x5efbe9=[];_0x56344d[_0xa3be('0x9f')](function(_0x2af493){var _0x40c643=createFieldObject(_0x3194be,_0x30cda0,_0x2af493[_0xa3be('0xa0')],_0x2af493[_0xa3be('0x25')],_0x2af493['label'],!![]);_0x5efbe9['push'](_0x40c643);});return Promise[_0xa3be('0xa3')](_0x5efbe9);})[_0xa3be('0x22')](function(_0x216c76){_0x32de84=_0x216c76;var _0x38bf3c=_0x3a302e[_0xa3be('0xa6')](_0x32de84);return{'count':_0x38bf3c['length'],'rows':_0x38bf3c};})['then'](respondWithResult(_0x4666d8,null))[_0xa3be('0x43')](function(_0x546f43){console[_0xa3be('0x9c')](_0xa3be('0xa7')+_0x546f43);var _0x119039=_0x4b5c58[_0xa3be('0x2e')][_0xa3be('0xa8')]?0x1f4:_0x546f43['statusCode']||0x1f4;logger['error'](_0x546f43[_0xa3be('0x24')]);delete _0x546f43[_0xa3be('0x25')];if(_0x119039===0x191){_0x119039=0x190;}_0x4666d8[_0xa3be('0x17')](_0x119039)['send'](_0x4b5c58[_0xa3be('0x2e')][_0xa3be('0xa8')]?{'message':_0xa3be('0xa9'),'statusCode':_0x546f43[_0xa3be('0xaa')]}:_0x546f43);});};function createFieldObject(_0x1bcd92,_0x3fb9c1,_0x2e931c,_0x5acba1,_0x64f0a9,_0x27b4b7){return new Promise(function(_0x3ee77c,_0x531542){var _0x5aad93={'id':_0x5acba1,'name':_0x64f0a9,'custom':_0x27b4b7};if(_0x2e931c==='boolean'){_0x5aad93[_0xa3be('0x3c')]=[{'name':_0xa3be('0xab'),'value':'true'},{'name':_0xa3be('0xac'),'value':_0xa3be('0xad')}];_0x3ee77c(_0x5aad93);}else{var _0x1ca1d8={'method':_0xa3be('0x99'),'uri':_0x1bcd92+_0xa3be('0xae')+_0x5acba1,'auth':_0x3fb9c1,'json':!![]};return rp(_0x1ca1d8)[_0xa3be('0x22')](function(_0x5c61e7){var _0x25339e=[];if(_0x5c61e7[_0xa3be('0x9b')]['length']>0x0){_0x5c61e7[_0xa3be('0x9b')]['forEach'](function(_0x28a7ba){if(_0x28a7ba[_0xa3be('0xaf')]===_0xa3be('0xad')){var _0x54194f={'name':_0x28a7ba['label'],'value':_0x28a7ba[_0xa3be('0xb0')]};_0x25339e[_0xa3be('0xa2')](_0x54194f);}});}_0x5aad93[_0xa3be('0x3c')]=_0x25339e;if(_0x5aad93['options'][_0xa3be('0x49')]>0x0){_0x3ee77c(_0x5aad93);}else{if(_0x27b4b7==![]){_0x3ee77c();}else{_0x3ee77c(_0x5aad93);}}});}});} \ No newline at end of file +var _0x3df4=['show','params','keys','includeAll','create','body','find','getConfigurations','ServicenowConfiguration','rawAttributes','pick','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_created_by','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','close_code','delivery_task','work_start','additional_assignee_list','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sys_tags','escalation','correlation_id','location','category','username','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','result','log','assign','includes','internalType','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','test','statusCode','boolean','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','label','value','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch'];(function(_0x1cabf5,_0x1cca76){var _0x34e333=function(_0x5d7493){while(--_0x5d7493){_0x1cabf5['push'](_0x1cabf5['shift']());}};_0x34e333(++_0x1cca76);}(_0x3df4,0x128));var _0x43df=function(_0x24f010,_0x4bc43d){_0x24f010=_0x24f010-0x0;var _0x2a308b=_0x3df4[_0x24f010];return _0x2a308b;};'use strict';var emlformat=require(_0x43df('0x0'));var rimraf=require(_0x43df('0x1'));var zipdir=require(_0x43df('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x43df('0x3'));var moment=require(_0x43df('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x43df('0x5'));var path=require(_0x43df('0x6'));var sox=require(_0x43df('0x7'));var csv=require(_0x43df('0x8'));var ejs=require(_0x43df('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43df('0xa'));var squel=require(_0x43df('0xb'));var crypto=require(_0x43df('0xc'));var jsforce=require(_0x43df('0xd'));var deskjs=require(_0x43df('0xe'));var toCsv=require(_0x43df('0x8'));var querystring=require(_0x43df('0xf'));var Papa=require(_0x43df('0x10'));var Redis=require('ioredis');var authService=require(_0x43df('0x11'));var qs=require(_0x43df('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43df('0x13'));var logger=require(_0x43df('0x14'))(_0x43df('0x15'));var utils=require(_0x43df('0x16'));var config=require(_0x43df('0x17'));var licenseUtil=require(_0x43df('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x43df('0x19'));function respondWithStatusCode(_0x1c7b65,_0x4e68d7){_0x4e68d7=_0x4e68d7||0xcc;return function(_0x1aa3ad){if(_0x1aa3ad){return _0x1c7b65[_0x43df('0x1a')](_0x4e68d7);}return _0x1c7b65[_0x43df('0x1b')](_0x4e68d7)[_0x43df('0x1c')]();};}function respondWithResult(_0x843ffb,_0x17ea0a){_0x17ea0a=_0x17ea0a||0xc8;return function(_0x308817){if(_0x308817){return _0x843ffb[_0x43df('0x1b')](_0x17ea0a)[_0x43df('0x1d')](_0x308817);}};}function respondWithFilteredResult(_0x3d01f8,_0x3e96c9){return function(_0x3765c5){if(_0x3765c5){var _0x4d747f=typeof _0x3e96c9[_0x43df('0x1e')]===_0x43df('0x1f')&&typeof _0x3e96c9['limit']===_0x43df('0x1f');var _0x1e2324=_0x3765c5[_0x43df('0x20')];var _0x48a13b=_0x4d747f?0x0:_0x3e96c9['offset'];var _0x381f71=_0x4d747f?_0x3765c5[_0x43df('0x20')]:_0x3e96c9['offset']+_0x3e96c9[_0x43df('0x21')];var _0x521da5;if(_0x381f71>=_0x1e2324){_0x381f71=_0x1e2324;_0x521da5=0xc8;}else{_0x521da5=0xce;}_0x3d01f8['status'](_0x521da5);return _0x3d01f8[_0x43df('0x22')](_0x43df('0x23'),_0x48a13b+'-'+_0x381f71+'/'+_0x1e2324)['json'](_0x3765c5);}return null;};}function patchUpdates(_0x56a31b){return function(_0x42a01f){try{jsonpatch['apply'](_0x42a01f,_0x56a31b,!![]);}catch(_0x1436f0){return BPromise[_0x43df('0x24')](_0x1436f0);}return _0x42a01f[_0x43df('0x25')]();};}function saveUpdates(_0x114eb2,_0x405498){return function(_0x50bc9e){if(_0x50bc9e){return _0x50bc9e[_0x43df('0x26')](_0x114eb2)[_0x43df('0x27')](function(_0x52f18c){return _0x52f18c;});}return null;};}function removeEntity(_0x5ce40a,_0x1ba8d5){return function(_0x516ddc){if(_0x516ddc){return _0x516ddc[_0x43df('0x28')]()['then'](function(){_0x5ce40a[_0x43df('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5356a1,_0x3dd153){return function(_0x205c46){if(!_0x205c46){_0x5356a1['sendStatus'](0x194);}return _0x205c46;};}function handleError(_0x5d8764,_0x494c28){_0x494c28=_0x494c28||0x1f4;return function(_0x3e1671){logger[_0x43df('0x29')](_0x3e1671['stack']);if(_0x3e1671[_0x43df('0x2a')]){delete _0x3e1671[_0x43df('0x2a')];}_0x5d8764[_0x43df('0x1b')](_0x494c28)[_0x43df('0x2b')](_0x3e1671);};}exports[_0x43df('0x2c')]=function(_0x59863f,_0x3eb2af){var _0x477da1={},_0x4cca7e={},_0x30b9d0={'count':0x0,'rows':[]};var _0x360222=_[_0x43df('0x2d')](db[_0x43df('0x2e')]['rawAttributes'],function(_0x11e373){return{'name':_0x11e373[_0x43df('0x2f')],'type':_0x11e373[_0x43df('0x30')][_0x43df('0x31')]};});_0x4cca7e[_0x43df('0x32')]=_[_0x43df('0x2d')](_0x360222,_0x43df('0x2a'));_0x4cca7e['query']=_['keys'](_0x59863f[_0x43df('0x33')]);_0x4cca7e[_0x43df('0x34')]=_[_0x43df('0x35')](_0x4cca7e['model'],_0x4cca7e[_0x43df('0x33')]);_0x477da1[_0x43df('0x36')]=_[_0x43df('0x35')](_0x4cca7e[_0x43df('0x32')],qs[_0x43df('0x37')](_0x59863f[_0x43df('0x33')][_0x43df('0x37')]));_0x477da1[_0x43df('0x36')]=_0x477da1[_0x43df('0x36')][_0x43df('0x38')]?_0x477da1[_0x43df('0x36')]:_0x4cca7e['model'];if(!_0x59863f[_0x43df('0x33')][_0x43df('0x39')]('nolimit')){_0x477da1[_0x43df('0x21')]=qs[_0x43df('0x21')](_0x59863f[_0x43df('0x33')]['limit']);_0x477da1['offset']=qs[_0x43df('0x1e')](_0x59863f[_0x43df('0x33')][_0x43df('0x1e')]);}_0x477da1[_0x43df('0x3a')]=qs[_0x43df('0x3b')](_0x59863f[_0x43df('0x33')][_0x43df('0x3b')]);_0x477da1['where']=qs['filters'](_['pick'](_0x59863f[_0x43df('0x33')],_0x4cca7e['filters']),_0x360222);if(_0x59863f[_0x43df('0x33')][_0x43df('0x3c')]){_0x477da1[_0x43df('0x3d')]=_[_0x43df('0x3e')](_0x477da1[_0x43df('0x3d')],{'$or':_['map'](_0x360222,function(_0x4109e6){if(_0x4109e6[_0x43df('0x30')]!==_0x43df('0x3f')){var _0x2e42cf={};_0x2e42cf[_0x4109e6[_0x43df('0x2a')]]={'$like':'%'+_0x59863f[_0x43df('0x33')][_0x43df('0x3c')]+'%'};return _0x2e42cf;}})});}_0x477da1=_[_0x43df('0x3e')]({},_0x477da1,_0x59863f[_0x43df('0x40')]);var _0xa082ed={'where':_0x477da1[_0x43df('0x3d')]};return db[_0x43df('0x2e')][_0x43df('0x20')](_0xa082ed)[_0x43df('0x27')](function(_0x1de7ae){_0x30b9d0['count']=_0x1de7ae;if(_0x59863f[_0x43df('0x33')]['includeAll']){_0x477da1[_0x43df('0x41')]=[{'all':!![]}];}return db[_0x43df('0x2e')]['findAll'](_0x477da1);})[_0x43df('0x27')](function(_0x343a45){_0x30b9d0[_0x43df('0x42')]=_0x343a45;return _0x30b9d0;})[_0x43df('0x27')](respondWithFilteredResult(_0x3eb2af,_0x477da1))[_0x43df('0x43')](handleError(_0x3eb2af,null));};exports[_0x43df('0x44')]=function(_0x58f73c,_0x12fa59){var _0x1d2528={'raw':![],'where':{'id':_0x58f73c[_0x43df('0x45')]['id']}},_0x2174a6={};_0x2174a6[_0x43df('0x32')]=_['keys'](db[_0x43df('0x2e')]['rawAttributes']);_0x2174a6[_0x43df('0x33')]=_[_0x43df('0x46')](_0x58f73c[_0x43df('0x33')]);_0x2174a6[_0x43df('0x34')]=_[_0x43df('0x35')](_0x2174a6[_0x43df('0x32')],_0x2174a6['query']);_0x1d2528[_0x43df('0x36')]=_['intersection'](_0x2174a6[_0x43df('0x32')],qs[_0x43df('0x37')](_0x58f73c['query'][_0x43df('0x37')]));_0x1d2528[_0x43df('0x36')]=_0x1d2528[_0x43df('0x36')]['length']?_0x1d2528['attributes']:_0x2174a6[_0x43df('0x32')];if(_0x58f73c[_0x43df('0x33')][_0x43df('0x47')]){_0x1d2528[_0x43df('0x41')]=[{'all':!![]}];}_0x1d2528=_[_0x43df('0x3e')]({},_0x1d2528,_0x58f73c['options']);return db['ServicenowAccount']['find'](_0x1d2528)['then'](handleEntityNotFound(_0x12fa59,null))[_0x43df('0x27')](respondWithResult(_0x12fa59,null))[_0x43df('0x43')](handleError(_0x12fa59,null));};exports[_0x43df('0x48')]=function(_0x4d77c6,_0x5969f0){return db[_0x43df('0x2e')]['create'](_0x4d77c6['body'],{})[_0x43df('0x27')](respondWithResult(_0x5969f0,0xc9))['catch'](handleError(_0x5969f0,null));};exports['update']=function(_0x1c1a82,_0x54d8e3){if(_0x1c1a82[_0x43df('0x49')]['id']){delete _0x1c1a82[_0x43df('0x49')]['id'];}return db[_0x43df('0x2e')][_0x43df('0x4a')]({'where':{'id':_0x1c1a82[_0x43df('0x45')]['id']}})[_0x43df('0x27')](handleEntityNotFound(_0x54d8e3,null))[_0x43df('0x27')](saveUpdates(_0x1c1a82[_0x43df('0x49')],null))[_0x43df('0x27')](respondWithResult(_0x54d8e3,null))[_0x43df('0x43')](handleError(_0x54d8e3,null));};exports[_0x43df('0x28')]=function(_0x5645c1,_0x2afb7e){return db[_0x43df('0x2e')]['find']({'where':{'id':_0x5645c1[_0x43df('0x45')]['id']}})[_0x43df('0x27')](handleEntityNotFound(_0x2afb7e,null))[_0x43df('0x27')](removeEntity(_0x2afb7e,null))[_0x43df('0x43')](handleError(_0x2afb7e,null));};exports[_0x43df('0x4b')]=function(_0x4be39c,_0xe332f2,_0x1eef25){var _0x8ed3ed={};var _0x349dc4={};var _0x4fbd71;var _0x41fc78;return db[_0x43df('0x2e')]['findOne']({'where':{'id':_0x4be39c[_0x43df('0x45')]['id']}})[_0x43df('0x27')](handleEntityNotFound(_0xe332f2,null))[_0x43df('0x27')](function(_0xee27ba){if(_0xee27ba){_0x4fbd71=_0xee27ba;_0x349dc4['model']=_[_0x43df('0x46')](db[_0x43df('0x4c')][_0x43df('0x4d')]);_0x349dc4[_0x43df('0x33')]=_[_0x43df('0x46')](_0x4be39c['query']);_0x349dc4[_0x43df('0x34')]=_[_0x43df('0x35')](_0x349dc4[_0x43df('0x32')],_0x349dc4[_0x43df('0x33')]);_0x8ed3ed[_0x43df('0x36')]=_[_0x43df('0x35')](_0x349dc4[_0x43df('0x32')],qs[_0x43df('0x37')](_0x4be39c[_0x43df('0x33')][_0x43df('0x37')]));_0x8ed3ed['attributes']=_0x8ed3ed[_0x43df('0x36')]['length']?_0x8ed3ed[_0x43df('0x36')]:_0x349dc4[_0x43df('0x32')];_0x8ed3ed[_0x43df('0x3a')]=qs[_0x43df('0x3b')](_0x4be39c[_0x43df('0x33')][_0x43df('0x3b')]);_0x8ed3ed[_0x43df('0x3d')]=qs['filters'](_[_0x43df('0x4e')](_0x4be39c['query'],_0x349dc4[_0x43df('0x34')]));if(_0x4be39c[_0x43df('0x33')]['filter']){_0x8ed3ed['where']=_[_0x43df('0x3e')](_0x8ed3ed['where'],{'$or':_['map'](_0x8ed3ed[_0x43df('0x36')],function(_0x2fdc21){var _0x413eb8={};_0x413eb8[_0x2fdc21]={'$like':'%'+_0x4be39c[_0x43df('0x33')][_0x43df('0x3c')]+'%'};return _0x413eb8;})});}_0x8ed3ed=_[_0x43df('0x3e')]({},_0x8ed3ed,_0x4be39c[_0x43df('0x40')]);return _0x4fbd71[_0x43df('0x4b')](_0x8ed3ed);}})[_0x43df('0x27')](function(_0x5be5f7){if(_0x5be5f7){_0x41fc78=_0x5be5f7[_0x43df('0x38')];if(!_0x4be39c[_0x43df('0x33')]['hasOwnProperty'](_0x43df('0x4f'))){_0x8ed3ed[_0x43df('0x21')]=qs['limit'](_0x4be39c[_0x43df('0x33')]['limit']);_0x8ed3ed[_0x43df('0x1e')]=qs[_0x43df('0x1e')](_0x4be39c[_0x43df('0x33')][_0x43df('0x1e')]);}return _0x4fbd71[_0x43df('0x4b')](_0x8ed3ed);}})[_0x43df('0x27')](function(_0x26fdc9){if(_0x26fdc9){return _0x26fdc9?{'count':_0x41fc78,'rows':_0x26fdc9}:null;}})[_0x43df('0x27')](respondWithResult(_0xe332f2,null))[_0x43df('0x43')](handleError(_0xe332f2,null));};exports[_0x43df('0x50')]=function(_0x9c7d62,_0x2837f3,_0x2c4250){if(_0x9c7d62['body']['id']){delete _0x9c7d62[_0x43df('0x49')]['id'];}return db[_0x43df('0x2e')][_0x43df('0x51')]({'where':{'id':_0x9c7d62[_0x43df('0x45')]['id']}})[_0x43df('0x27')](handleEntityNotFound(_0x2837f3,null))[_0x43df('0x27')](function(_0x3aaf0d){if(_0x3aaf0d){_0x9c7d62['body'][_0x43df('0x52')]=_0x3aaf0d['id'];_0x9c7d62['body'][_0x43df('0x53')]=integrations['getSubjects'](_0x9c7d62[_0x43df('0x49')][_0x43df('0x54')],_0x9c7d62[_0x43df('0x49')][_0x43df('0x30')]);_0x9c7d62['body'][_0x43df('0x55')]=integrations['getDescriptions'](_0x9c7d62['body']['channel'],_0x9c7d62[_0x43df('0x49')][_0x43df('0x30')]);return db[_0x43df('0x4c')][_0x43df('0x48')](_0x9c7d62[_0x43df('0x49')],{'include':[{'model':db[_0x43df('0x56')],'as':_0x43df('0x53')},{'model':db[_0x43df('0x56')],'as':_0x43df('0x55')}]});}return null;})[_0x43df('0x27')](respondWithResult(_0x2837f3,null))[_0x43df('0x43')](handleError(_0x2837f3,null));};exports[_0x43df('0x57')]=function(_0x5db16f,_0x54b971,_0x4465e2){var _0x570f40=[_0x43df('0x58'),_0x43df('0x59'),_0x43df('0x5a'),_0x43df('0x5b'),'close_code','notify',_0x43df('0x5c'),_0x43df('0x5d'),'category'];var _0x5efa30=[_0x43df('0x5e'),'made_sla',_0x43df('0x5f'),_0x43df('0x60'),_0x43df('0x61'),_0x43df('0x62'),_0x43df('0x63'),_0x43df('0x59'),_0x43df('0x64'),_0x43df('0x65'),_0x43df('0x66'),'sys_updated_by',_0x43df('0x67'),_0x43df('0x68'),_0x43df('0x69'),'sys_domain','state',_0x43df('0x6a'),_0x43df('0x5a'),_0x43df('0x3a'),'calendar_stc','closed_at',_0x43df('0x6b'),_0x43df('0x6c'),_0x43df('0x6d'),_0x43df('0x6e'),_0x43df('0x6f'),_0x43df('0x70'),'priority',_0x43df('0x71'),_0x43df('0x72'),_0x43df('0x73'),_0x43df('0x74'),'opened_at',_0x43df('0x75'),_0x43df('0x76'),_0x43df('0x77'),_0x43df('0x78'),_0x43df('0x79'),_0x43df('0x7a'),_0x43df('0x7b'),_0x43df('0x5b'),'work_notes',_0x43df('0x7c'),_0x43df('0x7d'),'correlation_display',_0x43df('0x7e'),_0x43df('0x7f'),'assignment_group','business_stc',_0x43df('0x80'),'description',_0x43df('0x81'),_0x43df('0x82'),_0x43df('0x83'),_0x43df('0x84'),_0x43df('0x85'),_0x43df('0x86'),'parent_incident',_0x43df('0x87'),_0x43df('0x88'),_0x43df('0x89'),_0x43df('0x5c'),_0x43df('0x8a'),_0x43df('0x8b'),_0x43df('0x8c'),_0x43df('0x8d'),_0x43df('0x8e'),_0x43df('0x8f'),_0x43df('0x5d'),_0x43df('0x90'),'sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count',_0x43df('0x91'),_0x43df('0x92'),'upon_approval',_0x43df('0x93'),_0x43df('0x94'),_0x43df('0x95')];var _0x537e8b='';var _0x981aa7='';var _0x31fb89=[];var _0x2fd43f='';var _0x54a31e='';var _0xbbd2d3=[];var _0x2a5ba5='';var _0x2c0780='';var _0x4b95f7={};var _0x31648e='';return db['ServicenowAccount'][_0x43df('0x51')]({'where':{'id':_0x5db16f[_0x43df('0x45')]['id']},'attributes':['id',_0x43df('0x96'),'password','email',_0x43df('0x97'),_0x43df('0x98')]})[_0x43df('0x27')](handleEntityNotFound(_0x54b971,null))['then'](function(_0x9b7ca1){if(_0x9b7ca1){_0x31648e=_0x9b7ca1[_0x43df('0x97')];var _0x1cfdb7=_0x31648e[_0x43df('0x99')](-0x1);if(_0x1cfdb7==='/'){_0x31648e=_0x31648e['substring'](0x0,_0x31648e[_0x43df('0x9a')](_0x1cfdb7));}_0x2c0780=util[_0x43df('0x9b')](_0x43df('0x9c'),_0x31648e);_0x2a5ba5=util[_0x43df('0x9b')](_0x43df('0x9d'),_0x31648e);_0x4b95f7={'user':_0x9b7ca1[_0x43df('0x96')],'pass':_0x9b7ca1[_0x43df('0x9e')]};var _0x7e2aa={'method':'GET','uri':_0x2c0780+'incident?sysparm_display_value=all','auth':_0x4b95f7,'json':!![]};return rp(_0x7e2aa);}})[_0x43df('0x27')](function(_0x37250f){if(_0x37250f[_0x43df('0x9f')][_0x43df('0x38')]>0x0){_0x537e8b=_0x37250f[_0x43df('0x9f')];}console[_0x43df('0xa0')]('incident\x20table\x20objects',_0x537e8b);_0xbbd2d3=[];_0x981aa7=Object[_0x43df('0xa1')]([],_0x537e8b);_['remove'](_0x981aa7,function(_0x59b477){return!_0x570f40[_0x43df('0xa2')](_0x59b477['name']);});_0x981aa7['forEach'](function(_0x45cd2b){var _0x2b1b1a=createFieldObject(_0x2a5ba5,_0x4b95f7,_0x45cd2b[_0x43df('0xa3')],_0x45cd2b['name'],_0x45cd2b['label'],![]);_0xbbd2d3['push'](_0x2b1b1a);});return Promise[_0x43df('0xa4')](_0xbbd2d3);})[_0x43df('0x27')](function(_0x42667e){_0x31fb89=_0x42667e;_0x2fd43f=Object['assign']([],_0x537e8b);console[_0x43df('0xa0')](_0x43df('0xa5'),_0x537e8b);_[_0x43df('0xa6')](_0x2fd43f,function(_0x553f53){return _0x5efa30[_0x43df('0xa2')](_0x553f53[_0x43df('0x2a')]);});console[_0x43df('0xa0')](_0x43df('0xa7'),_0x2fd43f);_0xbbd2d3=[];_0x2fd43f[_0x43df('0xa8')](function(_0x598a71){var _0x4e2b32=createFieldObject(_0x2a5ba5,_0x4b95f7,_0x598a71[_0x43df('0xa3')],_0x598a71[_0x43df('0x2a')],_0x598a71['label'],!![]);_0xbbd2d3[_0x43df('0xa9')](_0x4e2b32);});return Promise[_0x43df('0xa4')](_0xbbd2d3);})['then'](function(_0x3aa687){_0x54a31e=_0x3aa687;var _0x56a7be=_0x31fb89['concat'](_0x54a31e);return{'count':_0x56a7be[_0x43df('0x38')],'rows':_0x56a7be};})[_0x43df('0x27')](respondWithResult(_0x54b971,null))['catch'](function(_0x2e78b4){console['log']('ServiceNow\x20error:\x20'+_0x2e78b4);var _0x21e31e=_0x5db16f[_0x43df('0x33')][_0x43df('0xaa')]?0x1f4:_0x2e78b4[_0x43df('0xab')]||0x1f4;logger[_0x43df('0x29')](_0x2e78b4['stack']);delete _0x2e78b4[_0x43df('0x2a')];if(_0x21e31e===0x191){_0x21e31e=0x190;}_0x54b971[_0x43df('0x1b')](_0x21e31e)[_0x43df('0x2b')](_0x5db16f[_0x43df('0x33')][_0x43df('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x2e78b4[_0x43df('0xab')]}:_0x2e78b4);});};function createFieldObject(_0x464ae1,_0xdc2ff2,_0x12e673,_0xed8aaa,_0xebdc93,_0x1632d2){return new Promise(function(_0x7c3bca,_0x80ab02){var _0x32e9e2={'id':_0xed8aaa,'name':_0xebdc93,'custom':_0x1632d2};if(_0x12e673===_0x43df('0xac')){_0x32e9e2['options']=[{'name':_0x43df('0xad'),'value':_0x43df('0xae')},{'name':_0x43df('0xaf'),'value':_0x43df('0xb0')}];_0x7c3bca(_0x32e9e2);}else{var _0xd3a25b={'method':_0x43df('0xb1'),'uri':_0x464ae1+_0x43df('0xb2')+_0xed8aaa,'auth':_0xdc2ff2,'json':!![]};return rp(_0xd3a25b)[_0x43df('0x27')](function(_0x5d64f9){var _0x151e1f=[];if(_0x5d64f9[_0x43df('0x9f')][_0x43df('0x38')]>0x0){_0x5d64f9[_0x43df('0x9f')]['forEach'](function(_0x6ce75b){if(_0x6ce75b[_0x43df('0xb3')]==='false'){var _0x598047={'name':_0x6ce75b[_0x43df('0xb4')],'value':_0x6ce75b[_0x43df('0xb5')]};_0x151e1f[_0x43df('0xa9')](_0x598047);}});}_0x32e9e2[_0x43df('0x40')]=_0x151e1f;if(_0x32e9e2[_0x43df('0x40')][_0x43df('0x38')]>0x0){_0x7c3bca(_0x32e9e2);}else{if(_0x1632d2==![]){_0x7c3bca();}else{_0x7c3bca(_0x32e9e2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 9563822..cf4900d 100644 --- a/server/api/intServicenowAccount/intServicenowAccount.model.js +++ b/server/api/intServicenowAccount/intServicenowAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['request-promise','rimraf','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x2e8227,_0x4b004a){var _0x12281f=function(_0x46e488){while(--_0x46e488){_0x2e8227['push'](_0x2e8227['shift']());}};_0x12281f(++_0x4b004a);}(_0x2eb2,0x19f));var _0x22eb=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x2eb2[_0xdc37a1];return _0x99b4fe;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var logger=require(_0x22eb('0x1'))(_0x22eb('0x2'));var moment=require(_0x22eb('0x3'));var BPromise=require(_0x22eb('0x4'));var rp=require(_0x22eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22eb('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x22eb('0x7'));module[_0x22eb('0x8')]=function(_0x35dd5b,_0x2a9850){return _0x35dd5b[_0x22eb('0x9')](_0x22eb('0xa'),attributes,{'tableName':_0x22eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowAccount.attributes','exports','int_servicenow_accounts'];(function(_0x2a80fd,_0x5db0dc){var _0x24dbce=function(_0x55e5ee){while(--_0x55e5ee){_0x2a80fd['push'](_0x2a80fd['shift']());}};_0x24dbce(++_0x5db0dc);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xfdbd[_0x5c8827];return _0x50ffd5;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xdfdb('0xa')]=function(_0x41bd5e,_0x489f19){return _0x41bd5e['define']('ServicenowAccount',attributes,{'tableName':_0xdfdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 7d3c6ba..4b40ce1 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 _0x21d6=['include','map','model','stringify','ShowServicenowAccount','ServicenowAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','code','error','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','findAll','options','where','attributes'];(function(_0x1331b2,_0x3df22b){var _0x10f741=function(_0x16e85e){while(--_0x16e85e){_0x1331b2['push'](_0x1331b2['shift']());}};_0x10f741(++_0x3df22b);}(_0x21d6,0x120));var _0x621d=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x21d6[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x621d('0x0'));var util=require(_0x621d('0x1'));var moment=require(_0x621d('0x2'));var BPromise=require(_0x621d('0x3'));var rs=require(_0x621d('0x4'));var fs=require('fs');var Redis=require(_0x621d('0x5'));var db=require(_0x621d('0x6'))['db'];var utils=require(_0x621d('0x7'));var logger=require('../../config/logger')(_0x621d('0x8'));var config=require('../../config/environment');var jayson=require(_0x621d('0x9'));var client=jayson[_0x621d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279b00,_0x3accca,_0x4ddb3b){return new BPromise(function(_0x400894,_0x2d8574){return client[_0x621d('0xb')](_0x279b00,_0x4ddb3b)[_0x621d('0xc')](function(_0x1396c5){logger[_0x621d('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x3accca,_0x621d('0xe'));logger[_0x621d('0xf')](_0x621d('0x10'),_0x3accca,_0x621d('0xe'),JSON['stringify'](_0x1396c5));if(_0x1396c5['error']){if(_0x1396c5['error'][_0x621d('0x11')]===0x1f4){logger[_0x621d('0x12')](_0x621d('0x13'),_0x3accca,_0x1396c5[_0x621d('0x12')]['message']);return _0x2d8574(_0x1396c5[_0x621d('0x12')][_0x621d('0x14')]);}logger[_0x621d('0x12')](_0x621d('0x13'),_0x3accca,_0x1396c5['error'][_0x621d('0x14')]);return _0x400894(_0x1396c5[_0x621d('0x12')][_0x621d('0x14')]);}else{logger[_0x621d('0xd')](_0x621d('0x13'),_0x3accca,'request\x20sent');_0x400894(_0x1396c5['result'][_0x621d('0x14')]);}})[_0x621d('0x15')](function(_0x44a619){logger[_0x621d('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3accca,_0x44a619);_0x2d8574(_0x44a619);});});}exports[_0x621d('0x16')]=function(_0x10b107){var _0xce1206=this;return new Promise(function(_0x433503,_0x174764){return db['ServicenowAccount'][_0x621d('0x17')]({'raw':_0x10b107[_0x621d('0x18')]?_0x10b107[_0x621d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10b107[_0x621d('0x18')]?_0x10b107['options'][_0x621d('0x19')]||null:null,'attributes':_0x10b107[_0x621d('0x18')]?_0x10b107['options'][_0x621d('0x1a')]||null:null,'limit':_0x10b107[_0x621d('0x18')]?_0x10b107[_0x621d('0x18')]['limit']||null:null,'include':_0x10b107['options']?_0x10b107[_0x621d('0x18')][_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x10b107[_0x621d('0x18')][_0x621d('0x1b')],function(_0x3415f7){return{'model':db[_0x3415f7[_0x621d('0x1d')]],'as':_0x3415f7['as'],'attributes':_0x3415f7['attributes'],'include':_0x3415f7['include']?_[_0x621d('0x1c')](_0x3415f7['include'],function(_0x5286c3){return{'model':db[_0x5286c3['model']],'as':_0x5286c3['as'],'attributes':_0x5286c3[_0x621d('0x1a')],'include':_0x5286c3[_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x5286c3[_0x621d('0x1b')],function(_0x4c01ce){return{'model':db[_0x4c01ce[_0x621d('0x1d')]],'as':_0x4c01ce['as'],'attributes':_0x4c01ce[_0x621d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x621d('0xc')](function(_0x330d25){logger[_0x621d('0xd')](_0x621d('0x16'),_0x10b107);logger[_0x621d('0xf')](_0x621d('0x16'),_0x10b107,JSON[_0x621d('0x1e')](_0x330d25));_0x433503(_0x330d25);})[_0x621d('0x15')](function(_0x25446f){logger[_0x621d('0x12')](_0x621d('0x16'),_0x25446f[_0x621d('0x14')],_0x10b107);_0x174764(_0xce1206['error'](0x1f4,_0x25446f[_0x621d('0x14')]));});});};exports[_0x621d('0x1f')]=function(_0x39b007){var _0x3aab7c=this;return new Promise(function(_0x179df9,_0x402956){return db[_0x621d('0x20')][_0x621d('0x21')]({'raw':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x22')]===undefined?!![]:![]:!![],'where':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x19')]||null:null,'attributes':_0x39b007[_0x621d('0x18')]?_0x39b007['options']['attributes']||null:null,'include':_0x39b007[_0x621d('0x18')]?_0x39b007[_0x621d('0x18')][_0x621d('0x1b')]?_[_0x621d('0x1c')](_0x39b007[_0x621d('0x18')]['include'],function(_0x93b5a9){return{'model':db[_0x93b5a9[_0x621d('0x1d')]],'as':_0x93b5a9['as'],'attributes':_0x93b5a9[_0x621d('0x1a')],'include':_0x93b5a9['include']?_['map'](_0x93b5a9['include'],function(_0x375b7a){return{'model':db[_0x375b7a[_0x621d('0x1d')]],'as':_0x375b7a['as'],'attributes':_0x375b7a[_0x621d('0x1a')],'include':_0x375b7a['include']?_[_0x621d('0x1c')](_0x375b7a[_0x621d('0x1b')],function(_0x35004f){return{'model':db[_0x35004f['model']],'as':_0x35004f['as'],'attributes':_0x35004f[_0x621d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb0f9d1){logger[_0x621d('0xd')](_0x621d('0x1f'),_0x39b007);logger['debug']('ShowServicenowAccount',_0x39b007,JSON[_0x621d('0x1e')](_0xb0f9d1));_0x179df9(_0xb0f9d1);})[_0x621d('0x15')](function(_0x290a02){logger['error'](_0x621d('0x1f'),_0x290a02['message'],_0x39b007);_0x402956(_0x3aab7c['error'](0x1f4,_0x290a02[_0x621d('0x14')]));});});}; \ No newline at end of file +var _0x908c=['find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount','options','raw','attributes','limit','include','map','model','GetServicenowAccount','ShowServicenowAccount'];(function(_0x82371a,_0x40ffea){var _0x2b3833=function(_0x3bbb30){while(--_0x3bbb30){_0x82371a['push'](_0x82371a['shift']());}};_0x2b3833(++_0x40ffea);}(_0x908c,0x89));var _0xc908=function(_0x2d8f8f,_0x1e8b6e){_0x2d8f8f=_0x2d8f8f-0x0;var _0x25397f=_0x908c[_0x2d8f8f];return _0x25397f;};'use strict';var _=require(_0xc908('0x0'));var util=require(_0xc908('0x1'));var moment=require(_0xc908('0x2'));var BPromise=require('bluebird');var rs=require(_0xc908('0x3'));var fs=require('fs');var Redis=require(_0xc908('0x4'));var db=require(_0xc908('0x5'))['db'];var utils=require(_0xc908('0x6'));var logger=require(_0xc908('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc908('0x8'));var client=jayson[_0xc908('0x9')][_0xc908('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1379e9,_0x3cc5af,_0x3c0056){return new BPromise(function(_0x3bedcc,_0x59850c){return client[_0xc908('0xb')](_0x1379e9,_0x3c0056)[_0xc908('0xc')](function(_0x575c6f){logger[_0xc908('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x3cc5af,_0xc908('0xe'));logger[_0xc908('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3cc5af,_0xc908('0xe'),JSON[_0xc908('0x10')](_0x575c6f));if(_0x575c6f['error']){if(_0x575c6f[_0xc908('0x11')][_0xc908('0x12')]===0x1f4){logger[_0xc908('0x11')](_0xc908('0x13'),_0x3cc5af,_0x575c6f[_0xc908('0x11')][_0xc908('0x14')]);return _0x59850c(_0x575c6f[_0xc908('0x11')]['message']);}logger[_0xc908('0x11')](_0xc908('0x13'),_0x3cc5af,_0x575c6f[_0xc908('0x11')]['message']);return _0x3bedcc(_0x575c6f[_0xc908('0x11')]['message']);}else{logger[_0xc908('0xd')](_0xc908('0x13'),_0x3cc5af,_0xc908('0xe'));_0x3bedcc(_0x575c6f[_0xc908('0x15')]['message']);}})[_0xc908('0x16')](function(_0x2274d5){logger[_0xc908('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x3cc5af,_0x2274d5);_0x59850c(_0x2274d5);});});}exports['GetServicenowAccount']=function(_0x53a170){var _0x5089f7=this;return new Promise(function(_0x45ae5f,_0x42469b){return db[_0xc908('0x17')]['findAll']({'raw':_0x53a170[_0xc908('0x18')]?_0x53a170[_0xc908('0x18')][_0xc908('0x19')]===undefined?!![]:![]:!![],'where':_0x53a170[_0xc908('0x18')]?_0x53a170[_0xc908('0x18')]['where']||null:null,'attributes':_0x53a170[_0xc908('0x18')]?_0x53a170['options'][_0xc908('0x1a')]||null:null,'limit':_0x53a170[_0xc908('0x18')]?_0x53a170['options'][_0xc908('0x1b')]||null:null,'include':_0x53a170[_0xc908('0x18')]?_0x53a170[_0xc908('0x18')][_0xc908('0x1c')]?_[_0xc908('0x1d')](_0x53a170[_0xc908('0x18')][_0xc908('0x1c')],function(_0x3a15c2){return{'model':db[_0x3a15c2[_0xc908('0x1e')]],'as':_0x3a15c2['as'],'attributes':_0x3a15c2[_0xc908('0x1a')],'include':_0x3a15c2['include']?_[_0xc908('0x1d')](_0x3a15c2[_0xc908('0x1c')],function(_0xbd4fcc){return{'model':db[_0xbd4fcc[_0xc908('0x1e')]],'as':_0xbd4fcc['as'],'attributes':_0xbd4fcc[_0xc908('0x1a')],'include':_0xbd4fcc[_0xc908('0x1c')]?_[_0xc908('0x1d')](_0xbd4fcc[_0xc908('0x1c')],function(_0x3699da){return{'model':db[_0x3699da['model']],'as':_0x3699da['as'],'attributes':_0x3699da[_0xc908('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x83e055){logger[_0xc908('0xd')](_0xc908('0x1f'),_0x53a170);logger['debug'](_0xc908('0x1f'),_0x53a170,JSON[_0xc908('0x10')](_0x83e055));_0x45ae5f(_0x83e055);})[_0xc908('0x16')](function(_0x7583a4){logger[_0xc908('0x11')](_0xc908('0x1f'),_0x7583a4[_0xc908('0x14')],_0x53a170);_0x42469b(_0x5089f7[_0xc908('0x11')](0x1f4,_0x7583a4['message']));});});};exports[_0xc908('0x20')]=function(_0x3642f9){var _0x7205c2=this;return new Promise(function(_0x261a74,_0x38fb3d){return db[_0xc908('0x17')][_0xc908('0x21')]({'raw':_0x3642f9[_0xc908('0x18')]?_0x3642f9[_0xc908('0x18')][_0xc908('0x19')]===undefined?!![]:![]:!![],'where':_0x3642f9[_0xc908('0x18')]?_0x3642f9['options']['where']||null:null,'attributes':_0x3642f9[_0xc908('0x18')]?_0x3642f9['options'][_0xc908('0x1a')]||null:null,'include':_0x3642f9['options']?_0x3642f9[_0xc908('0x18')][_0xc908('0x1c')]?_[_0xc908('0x1d')](_0x3642f9['options'][_0xc908('0x1c')],function(_0x37c931){return{'model':db[_0x37c931[_0xc908('0x1e')]],'as':_0x37c931['as'],'attributes':_0x37c931[_0xc908('0x1a')],'include':_0x37c931[_0xc908('0x1c')]?_[_0xc908('0x1d')](_0x37c931[_0xc908('0x1c')],function(_0x173f5e){return{'model':db[_0x173f5e['model']],'as':_0x173f5e['as'],'attributes':_0x173f5e[_0xc908('0x1a')],'include':_0x173f5e[_0xc908('0x1c')]?_[_0xc908('0x1d')](_0x173f5e[_0xc908('0x1c')],function(_0x59ac31){return{'model':db[_0x59ac31['model']],'as':_0x59ac31['as'],'attributes':_0x59ac31[_0xc908('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34c63e){logger[_0xc908('0xd')](_0xc908('0x20'),_0x3642f9);logger['debug'](_0xc908('0x20'),_0x3642f9,JSON['stringify'](_0x34c63e));_0x261a74(_0x34c63e);})[_0xc908('0x16')](function(_0x47c881){logger[_0xc908('0x11')](_0xc908('0x20'),_0x47c881['message'],_0x3642f9);_0x38fb3d(_0x7205c2[_0xc908('0x11')](0x1f4,_0x47c881[_0xc908('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 85cd203..a4c4b31 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 _0x38a4=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x3fe2be,_0x24cfba){var _0x16b3ca=function(_0x266d1e){while(--_0x266d1e){_0x3fe2be['push'](_0x3fe2be['shift']());}};_0x16b3ca(++_0x24cfba);}(_0x38a4,0x68));var _0x438a=function(_0x430f79,_0x2c2c62){_0x430f79=_0x430f79-0x0;var _0x3f63e0=_0x38a4[_0x430f79];return _0x3f63e0;};'use strict';var multer=require(_0x438a('0x0'));var util=require('util');var path=require(_0x438a('0x1'));var timeout=require(_0x438a('0x2'));var express=require(_0x438a('0x3'));var router=express[_0x438a('0x4')]();var fs_extra=require(_0x438a('0x5'));var auth=require(_0x438a('0x6'));var interaction=require(_0x438a('0x7'));var config=require(_0x438a('0x8'));var controller=require(_0x438a('0x9'));router[_0x438a('0xa')]('/',auth[_0x438a('0xb')](),controller[_0x438a('0xc')]);router[_0x438a('0xa')](_0x438a('0xd'),auth['isAuthenticated'](),controller[_0x438a('0xe')]);router[_0x438a('0xa')](_0x438a('0xf'),auth[_0x438a('0xb')](),controller[_0x438a('0x10')]);router['get'](_0x438a('0x11'),auth['isAuthenticated'](),controller[_0x438a('0x12')]);router[_0x438a('0xa')](_0x438a('0x13'),auth[_0x438a('0xb')](),controller[_0x438a('0x14')]);router[_0x438a('0x15')]('/',auth[_0x438a('0xb')](),controller[_0x438a('0x16')]);router[_0x438a('0x17')]('/:id',auth[_0x438a('0xb')](),controller[_0x438a('0x18')]);router[_0x438a('0x19')](_0x438a('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5fde=['fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x5bd42a,_0x559e79){var _0xa54e2b=function(_0x56684e){while(--_0x56684e){_0x5bd42a['push'](_0x5bd42a['shift']());}};_0xa54e2b(++_0x559e79);}(_0x5fde,0x1bd));var _0xe5fd=function(_0x50833d,_0x35dd3c){_0x50833d=_0x50833d-0x0;var _0x8848cc=_0x5fde[_0x50833d];return _0x8848cc;};'use strict';var multer=require(_0xe5fd('0x0'));var util=require('util');var path=require(_0xe5fd('0x1'));var timeout=require(_0xe5fd('0x2'));var express=require(_0xe5fd('0x3'));var router=express[_0xe5fd('0x4')]();var fs_extra=require(_0xe5fd('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe5fd('0x6'));var config=require(_0xe5fd('0x7'));var controller=require(_0xe5fd('0x8'));router[_0xe5fd('0x9')]('/',auth[_0xe5fd('0xa')](),controller[_0xe5fd('0xb')]);router[_0xe5fd('0x9')](_0xe5fd('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xe5fd('0x9')](_0xe5fd('0xd'),auth['isAuthenticated'](),controller[_0xe5fd('0xe')]);router[_0xe5fd('0x9')](_0xe5fd('0xf'),auth[_0xe5fd('0xa')](),controller[_0xe5fd('0x10')]);router[_0xe5fd('0x9')](_0xe5fd('0x11'),auth[_0xe5fd('0xa')](),controller[_0xe5fd('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe5fd('0x13')]);router[_0xe5fd('0x14')](_0xe5fd('0xc'),auth[_0xe5fd('0xa')](),controller[_0xe5fd('0x15')]);router[_0xe5fd('0x16')](_0xe5fd('0xc'),auth[_0xe5fd('0xa')](),controller[_0xe5fd('0x17')]);module[_0xe5fd('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 48417e0..26d51a1 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 _0xd923=['STRING','sequelize','exports'];(function(_0x578275,_0xe7ae46){var _0xf78041=function(_0x13148c){while(--_0x13148c){_0x578275['push'](_0x578275['shift']());}};_0xf78041(++_0xe7ae46);}(_0xd923,0x18a));var _0x3d92=function(_0x4a6fba,_0x44078a){_0x4a6fba=_0x4a6fba-0x0;var _0x3a3cca=_0xd923[_0x4a6fba];return _0x3a3cca;};'use strict';var Sequelize=require(_0x3d92('0x0'));module[_0x3d92('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3d92('0x2')]}}; \ No newline at end of file +var _0x0c9e=['STRING'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0x0c9e,0x1c6));var _0xe0c9=function(_0xa85156,_0x455e26){_0xa85156=_0xa85156-0x0;var _0x174509=_0x0c9e[_0xa85156];return _0x174509;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0c9('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4deb042..f8c4d8c 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 _0xe4a8=['find','then','create','body','update','findOne','ServicenowField','order','getFields','nolimit','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','set','reject','save','destroy','sendStatus','stack','name','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes'];(function(_0x141f29,_0x4acdc5){var _0x234a8f=function(_0x4a0905){while(--_0x4a0905){_0x141f29['push'](_0x141f29['shift']());}};_0x234a8f(++_0x4acdc5);}(_0xe4a8,0x1e7));var _0x8e4a=function(_0x10b757,_0x3cf7ca){_0x10b757=_0x10b757-0x0;var _0x5fffd2=_0xe4a8[_0x10b757];return _0x5fffd2;};'use strict';var emlformat=require(_0x8e4a('0x0'));var rimraf=require(_0x8e4a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8e4a('0x2'));var rp=require(_0x8e4a('0x3'));var moment=require('moment');var BPromise=require(_0x8e4a('0x4'));var Mustache=require(_0x8e4a('0x5'));var util=require(_0x8e4a('0x6'));var path=require(_0x8e4a('0x7'));var sox=require(_0x8e4a('0x8'));var csv=require('to-csv');var ejs=require(_0x8e4a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e4a('0xa'));var squel=require(_0x8e4a('0xb'));var crypto=require('crypto');var jsforce=require(_0x8e4a('0xc'));var deskjs=require(_0x8e4a('0xd'));var toCsv=require(_0x8e4a('0xe'));var querystring=require(_0x8e4a('0xf'));var Papa=require(_0x8e4a('0x10'));var Redis=require(_0x8e4a('0x11'));var authService=require(_0x8e4a('0x12'));var qs=require(_0x8e4a('0x13'));var as=require(_0x8e4a('0x14'));var hardwareService=require(_0x8e4a('0x15'));var logger=require(_0x8e4a('0x16'))('api');var utils=require(_0x8e4a('0x17'));var config=require(_0x8e4a('0x18'));var licenseUtil=require(_0x8e4a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475af3,_0x1718b6){_0x1718b6=_0x1718b6||0xcc;return function(_0x1fb6f9){if(_0x1fb6f9){return _0x475af3['sendStatus'](_0x1718b6);}return _0x475af3[_0x8e4a('0x1a')](_0x1718b6)[_0x8e4a('0x1b')]();};}function respondWithResult(_0x573b3d,_0xd975eb){_0xd975eb=_0xd975eb||0xc8;return function(_0x2720bd){if(_0x2720bd){return _0x573b3d['status'](_0xd975eb)[_0x8e4a('0x1c')](_0x2720bd);}};}function respondWithFilteredResult(_0x379be1,_0x153894){return function(_0x37af77){if(_0x37af77){var _0x4c6c95=typeof _0x153894['offset']===_0x8e4a('0x1d')&&typeof _0x153894[_0x8e4a('0x1e')]===_0x8e4a('0x1d');var _0x361ef6=_0x37af77['count'];var _0x5dec45=_0x4c6c95?0x0:_0x153894[_0x8e4a('0x1f')];var _0x196ce4=_0x4c6c95?_0x37af77[_0x8e4a('0x20')]:_0x153894[_0x8e4a('0x1f')]+_0x153894[_0x8e4a('0x1e')];var _0x34d8b4;if(_0x196ce4>=_0x361ef6){_0x196ce4=_0x361ef6;_0x34d8b4=0xc8;}else{_0x34d8b4=0xce;}_0x379be1['status'](_0x34d8b4);return _0x379be1[_0x8e4a('0x21')]('Content-Range',_0x5dec45+'-'+_0x196ce4+'/'+_0x361ef6)['json'](_0x37af77);}return null;};}function patchUpdates(_0x47a4ea){return function(_0xf504a5){try{jsonpatch['apply'](_0xf504a5,_0x47a4ea,!![]);}catch(_0x830114){return BPromise[_0x8e4a('0x22')](_0x830114);}return _0xf504a5[_0x8e4a('0x23')]();};}function saveUpdates(_0x44ce10,_0x58f329){return function(_0x1524ed){if(_0x1524ed){return _0x1524ed['update'](_0x44ce10)['then'](function(_0x210258){return _0x210258;});}return null;};}function removeEntity(_0x402862,_0x5a8d95){return function(_0x35a1a3){if(_0x35a1a3){return _0x35a1a3[_0x8e4a('0x24')]()['then'](function(){_0x402862['status'](0xcc)[_0x8e4a('0x1b')]();});}};}function handleEntityNotFound(_0x4b12a7,_0x34fea4){return function(_0xd1b7e6){if(!_0xd1b7e6){_0x4b12a7[_0x8e4a('0x25')](0x194);}return _0xd1b7e6;};}function handleError(_0x147a8f,_0x55cd17){_0x55cd17=_0x55cd17||0x1f4;return function(_0x329667){logger['error'](_0x329667[_0x8e4a('0x26')]);if(_0x329667[_0x8e4a('0x27')]){delete _0x329667['name'];}_0x147a8f[_0x8e4a('0x1a')](_0x55cd17)['send'](_0x329667);};}exports['index']=function(_0x50993c,_0xd7ecfc){var _0x2a8aef={},_0x39dece={},_0x194a55={'count':0x0,'rows':[]};var _0x4f8189=_[_0x8e4a('0x28')](db['ServicenowConfiguration']['rawAttributes'],function(_0x39947b){return{'name':_0x39947b['fieldName'],'type':_0x39947b['type']['key']};});_0x39dece['model']=_[_0x8e4a('0x28')](_0x4f8189,_0x8e4a('0x27'));_0x39dece[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x50993c[_0x8e4a('0x29')]);_0x39dece['filters']=_[_0x8e4a('0x2b')](_0x39dece[_0x8e4a('0x2c')],_0x39dece[_0x8e4a('0x29')]);_0x2a8aef[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0x39dece[_0x8e4a('0x2c')],qs[_0x8e4a('0x2e')](_0x50993c['query'][_0x8e4a('0x2e')]));_0x2a8aef[_0x8e4a('0x2d')]=_0x2a8aef[_0x8e4a('0x2d')][_0x8e4a('0x2f')]?_0x2a8aef['attributes']:_0x39dece['model'];if(!_0x50993c['query'][_0x8e4a('0x30')]('nolimit')){_0x2a8aef[_0x8e4a('0x1e')]=qs[_0x8e4a('0x1e')](_0x50993c[_0x8e4a('0x29')]['limit']);_0x2a8aef[_0x8e4a('0x1f')]=qs['offset'](_0x50993c[_0x8e4a('0x29')]['offset']);}_0x2a8aef['order']=qs[_0x8e4a('0x31')](_0x50993c[_0x8e4a('0x29')]['sort']);_0x2a8aef[_0x8e4a('0x32')]=qs['filters'](_['pick'](_0x50993c[_0x8e4a('0x29')],_0x39dece[_0x8e4a('0x33')]),_0x4f8189);if(_0x50993c[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x2a8aef['where']=_[_0x8e4a('0x35')](_0x2a8aef[_0x8e4a('0x32')],{'$or':_['map'](_0x4f8189,function(_0x47f529){if(_0x47f529[_0x8e4a('0x36')]!==_0x8e4a('0x37')){var _0x2097fe={};_0x2097fe[_0x47f529['name']]={'$like':'%'+_0x50993c['query'][_0x8e4a('0x34')]+'%'};return _0x2097fe;}})});}_0x2a8aef=_[_0x8e4a('0x35')]({},_0x2a8aef,_0x50993c[_0x8e4a('0x38')]);var _0x120bc9={'where':_0x2a8aef['where']};return db[_0x8e4a('0x39')][_0x8e4a('0x20')](_0x120bc9)['then'](function(_0xd1d840){_0x194a55['count']=_0xd1d840;if(_0x50993c[_0x8e4a('0x29')][_0x8e4a('0x3a')]){_0x2a8aef[_0x8e4a('0x3b')]=[{'all':!![]}];}return db[_0x8e4a('0x39')][_0x8e4a('0x3c')](_0x2a8aef);})['then'](function(_0x3f5a93){_0x194a55[_0x8e4a('0x3d')]=_0x3f5a93;return _0x194a55;})['then'](respondWithFilteredResult(_0xd7ecfc,_0x2a8aef))[_0x8e4a('0x3e')](handleError(_0xd7ecfc,null));};exports[_0x8e4a('0x3f')]=function(_0x50f4b8,_0x2a2c8d){var _0x24156d={'raw':![],'where':{'id':_0x50f4b8[_0x8e4a('0x40')]['id']}},_0x2913b9={};_0x2913b9['model']=_[_0x8e4a('0x2a')](db[_0x8e4a('0x39')][_0x8e4a('0x41')]);_0x2913b9['query']=_['keys'](_0x50f4b8['query']);_0x2913b9[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x2913b9['model'],_0x2913b9[_0x8e4a('0x29')]);_0x24156d[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0x2913b9['model'],qs[_0x8e4a('0x2e')](_0x50f4b8[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x24156d[_0x8e4a('0x2d')]=_0x24156d['attributes'][_0x8e4a('0x2f')]?_0x24156d[_0x8e4a('0x2d')]:_0x2913b9[_0x8e4a('0x2c')];if(_0x50f4b8[_0x8e4a('0x29')][_0x8e4a('0x3a')]){_0x24156d['include']=[{'all':!![]}];}_0x24156d=_[_0x8e4a('0x35')]({},_0x24156d,_0x50f4b8['options']);return db['ServicenowConfiguration'][_0x8e4a('0x42')](_0x24156d)[_0x8e4a('0x43')](handleEntityNotFound(_0x2a2c8d,null))['then'](respondWithResult(_0x2a2c8d,null))[_0x8e4a('0x3e')](handleError(_0x2a2c8d,null));};exports[_0x8e4a('0x44')]=function(_0x60ba0,_0x243a91){return db['ServicenowConfiguration'][_0x8e4a('0x44')](_0x60ba0[_0x8e4a('0x45')],{})[_0x8e4a('0x43')](respondWithResult(_0x243a91,0xc9))[_0x8e4a('0x3e')](handleError(_0x243a91,null));};exports[_0x8e4a('0x46')]=function(_0x3d69b3,_0x27139c){if(_0x3d69b3[_0x8e4a('0x45')]['id']){delete _0x3d69b3[_0x8e4a('0x45')]['id'];}return db['ServicenowConfiguration'][_0x8e4a('0x42')]({'where':{'id':_0x3d69b3[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x27139c,null))['then'](saveUpdates(_0x3d69b3[_0x8e4a('0x45')],null))[_0x8e4a('0x43')](respondWithResult(_0x27139c,null))[_0x8e4a('0x3e')](handleError(_0x27139c,null));};exports['destroy']=function(_0x1f239f,_0x40f7c9){return db[_0x8e4a('0x39')][_0x8e4a('0x42')]({'where':{'id':_0x1f239f[_0x8e4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x40f7c9,null))[_0x8e4a('0x43')](removeEntity(_0x40f7c9,null))[_0x8e4a('0x3e')](handleError(_0x40f7c9,null));};exports['getFields']=function(_0x55d73e,_0x4692ad,_0x276e20){var _0x28b1b1={};var _0xef7674={};var _0x4cb36e;var _0x11766f;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x55d73e[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x4692ad,null))[_0x8e4a('0x43')](function(_0x1e5f76){if(_0x1e5f76){_0x4cb36e=_0x1e5f76;_0xef7674[_0x8e4a('0x2c')]=_['keys'](db[_0x8e4a('0x48')][_0x8e4a('0x41')]);_0xef7674[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x55d73e[_0x8e4a('0x29')]);_0xef7674[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0xef7674[_0x8e4a('0x2c')],_0xef7674[_0x8e4a('0x29')]);_0x28b1b1[_0x8e4a('0x2d')]=_[_0x8e4a('0x2b')](_0xef7674[_0x8e4a('0x2c')],qs['fields'](_0x55d73e[_0x8e4a('0x29')]['fields']));_0x28b1b1[_0x8e4a('0x2d')]=_0x28b1b1['attributes'][_0x8e4a('0x2f')]?_0x28b1b1[_0x8e4a('0x2d')]:_0xef7674[_0x8e4a('0x2c')];_0x28b1b1[_0x8e4a('0x49')]=qs[_0x8e4a('0x31')](_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x31')]);_0x28b1b1[_0x8e4a('0x32')]=qs[_0x8e4a('0x33')](_['pick'](_0x55d73e[_0x8e4a('0x29')],_0xef7674[_0x8e4a('0x33')]));if(_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x28b1b1[_0x8e4a('0x32')]=_[_0x8e4a('0x35')](_0x28b1b1[_0x8e4a('0x32')],{'$or':_[_0x8e4a('0x28')](_0x28b1b1['attributes'],function(_0x373365){var _0x5da6f3={};_0x5da6f3[_0x373365]={'$like':'%'+_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x34')]+'%'};return _0x5da6f3;})});}_0x28b1b1=_[_0x8e4a('0x35')]({},_0x28b1b1,_0x55d73e[_0x8e4a('0x38')]);return _0x4cb36e[_0x8e4a('0x4a')](_0x28b1b1);}})[_0x8e4a('0x43')](function(_0x2bbb5a){if(_0x2bbb5a){_0x11766f=_0x2bbb5a[_0x8e4a('0x2f')];if(!_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x30')](_0x8e4a('0x4b'))){_0x28b1b1[_0x8e4a('0x1e')]=qs['limit'](_0x55d73e[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x28b1b1[_0x8e4a('0x1f')]=qs[_0x8e4a('0x1f')](_0x55d73e['query'][_0x8e4a('0x1f')]);}return _0x4cb36e[_0x8e4a('0x4a')](_0x28b1b1);}})[_0x8e4a('0x43')](function(_0x267ad1){if(_0x267ad1){return _0x267ad1?{'count':_0x11766f,'rows':_0x267ad1}:null;}})[_0x8e4a('0x43')](respondWithResult(_0x4692ad,null))[_0x8e4a('0x3e')](handleError(_0x4692ad,null));};exports[_0x8e4a('0x4c')]=function(_0x35267f,_0x13b7aa,_0x53c828){var _0x17b27f={};var _0x4e1de7={};var _0x191681;var _0x4fae89;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x35267f[_0x8e4a('0x40')]['id']}})['then'](handleEntityNotFound(_0x13b7aa,null))[_0x8e4a('0x43')](function(_0x25c52f){if(_0x25c52f){_0x191681=_0x25c52f;_0x4e1de7[_0x8e4a('0x2c')]=_[_0x8e4a('0x2a')](db[_0x8e4a('0x48')][_0x8e4a('0x41')]);_0x4e1de7[_0x8e4a('0x29')]=_[_0x8e4a('0x2a')](_0x35267f[_0x8e4a('0x29')]);_0x4e1de7[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x4e1de7['model'],_0x4e1de7[_0x8e4a('0x29')]);_0x17b27f['attributes']=_[_0x8e4a('0x2b')](_0x4e1de7[_0x8e4a('0x2c')],qs['fields'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x17b27f[_0x8e4a('0x2d')]=_0x17b27f[_0x8e4a('0x2d')]['length']?_0x17b27f[_0x8e4a('0x2d')]:_0x4e1de7['model'];_0x17b27f[_0x8e4a('0x49')]=qs['sort'](_0x35267f[_0x8e4a('0x29')]['sort']);_0x17b27f[_0x8e4a('0x32')]=qs['filters'](_[_0x8e4a('0x4d')](_0x35267f[_0x8e4a('0x29')],_0x4e1de7[_0x8e4a('0x33')]));if(_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x17b27f[_0x8e4a('0x32')]=_['merge'](_0x17b27f[_0x8e4a('0x32')],{'$or':_[_0x8e4a('0x28')](_0x17b27f[_0x8e4a('0x2d')],function(_0x2dadb4){var _0x455381={};_0x455381[_0x2dadb4]={'$like':'%'+_0x35267f[_0x8e4a('0x29')]['filter']+'%'};return _0x455381;})});}_0x17b27f=_[_0x8e4a('0x35')]({},_0x17b27f,_0x35267f['options']);return _0x191681[_0x8e4a('0x4c')](_0x17b27f);}})[_0x8e4a('0x43')](function(_0x54069f){if(_0x54069f){_0x4fae89=_0x54069f['length'];if(!_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x30')]('nolimit')){_0x17b27f['limit']=qs['limit'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x17b27f[_0x8e4a('0x1f')]=qs['offset'](_0x35267f[_0x8e4a('0x29')][_0x8e4a('0x1f')]);}return _0x191681[_0x8e4a('0x4c')](_0x17b27f);}})[_0x8e4a('0x43')](function(_0x5a05af){if(_0x5a05af){return _0x5a05af?{'count':_0x4fae89,'rows':_0x5a05af}:null;}})['then'](respondWithResult(_0x13b7aa,null))[_0x8e4a('0x3e')](handleError(_0x13b7aa,null));};exports[_0x8e4a('0x4e')]=function(_0x15539a,_0x552429,_0x8811ea){var _0x19354f={};var _0x1c1ae5={};var _0x490bba;var _0x15b09e;return db[_0x8e4a('0x39')][_0x8e4a('0x47')]({'where':{'id':_0x15539a[_0x8e4a('0x40')]['id']}})[_0x8e4a('0x43')](handleEntityNotFound(_0x552429,null))[_0x8e4a('0x43')](function(_0x1afb18){if(_0x1afb18){_0x490bba=_0x1afb18;_0x1c1ae5[_0x8e4a('0x2c')]=_[_0x8e4a('0x2a')](db['ServicenowField'][_0x8e4a('0x41')]);_0x1c1ae5[_0x8e4a('0x29')]=_['keys'](_0x15539a[_0x8e4a('0x29')]);_0x1c1ae5[_0x8e4a('0x33')]=_[_0x8e4a('0x2b')](_0x1c1ae5[_0x8e4a('0x2c')],_0x1c1ae5[_0x8e4a('0x29')]);_0x19354f[_0x8e4a('0x2d')]=_['intersection'](_0x1c1ae5[_0x8e4a('0x2c')],qs[_0x8e4a('0x2e')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x2e')]));_0x19354f[_0x8e4a('0x2d')]=_0x19354f[_0x8e4a('0x2d')][_0x8e4a('0x2f')]?_0x19354f[_0x8e4a('0x2d')]:_0x1c1ae5[_0x8e4a('0x2c')];_0x19354f[_0x8e4a('0x49')]=qs[_0x8e4a('0x31')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x31')]);_0x19354f[_0x8e4a('0x32')]=qs[_0x8e4a('0x33')](_['pick'](_0x15539a['query'],_0x1c1ae5['filters']));if(_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x34')]){_0x19354f[_0x8e4a('0x32')]=_[_0x8e4a('0x35')](_0x19354f['where'],{'$or':_['map'](_0x19354f[_0x8e4a('0x2d')],function(_0x2b0c0e){var _0x58f7e0={};_0x58f7e0[_0x2b0c0e]={'$like':'%'+_0x15539a[_0x8e4a('0x29')]['filter']+'%'};return _0x58f7e0;})});}_0x19354f=_[_0x8e4a('0x35')]({},_0x19354f,_0x15539a[_0x8e4a('0x38')]);return _0x490bba[_0x8e4a('0x4e')](_0x19354f);}})[_0x8e4a('0x43')](function(_0xdcb9cf){if(_0xdcb9cf){_0x15b09e=_0xdcb9cf[_0x8e4a('0x2f')];if(!_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x30')](_0x8e4a('0x4b'))){_0x19354f['limit']=qs[_0x8e4a('0x1e')](_0x15539a[_0x8e4a('0x29')][_0x8e4a('0x1e')]);_0x19354f[_0x8e4a('0x1f')]=qs[_0x8e4a('0x1f')](_0x15539a[_0x8e4a('0x29')]['offset']);}return _0x490bba[_0x8e4a('0x4e')](_0x19354f);}})['then'](function(_0x3f0849){if(_0x3f0849){return _0x3f0849?{'count':_0x15b09e,'rows':_0x3f0849}:null;}})['then'](respondWithResult(_0x552429,null))[_0x8e4a('0x3e')](handleError(_0x552429,null));}; \ No newline at end of file +var _0xb443=['name','send','index','map','ServicenowConfiguration','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','options','find','catch','create','body','params','getFields','findOne','ServicenowField','getSubjects','order','pick','getDescriptions','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','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack'];(function(_0x3ffd40,_0x4c65b8){var _0x14309d=function(_0x48886e){while(--_0x48886e){_0x3ffd40['push'](_0x3ffd40['shift']());}};_0x14309d(++_0x4c65b8);}(_0xb443,0x7e));var _0x3b44=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xb443[_0x2642cb];return _0xe6e41;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3b44('0x0'));var zipdir=require(_0x3b44('0x1'));var jsonpatch=require(_0x3b44('0x2'));var rp=require(_0x3b44('0x3'));var moment=require(_0x3b44('0x4'));var BPromise=require(_0x3b44('0x5'));var Mustache=require(_0x3b44('0x6'));var util=require(_0x3b44('0x7'));var path=require(_0x3b44('0x8'));var sox=require(_0x3b44('0x9'));var csv=require(_0x3b44('0xa'));var ejs=require(_0x3b44('0xb'));var fs=require('fs');var fs_extra=require(_0x3b44('0xc'));var _=require(_0x3b44('0xd'));var squel=require(_0x3b44('0xe'));var crypto=require(_0x3b44('0xf'));var jsforce=require(_0x3b44('0x10'));var deskjs=require(_0x3b44('0x11'));var toCsv=require(_0x3b44('0xa'));var querystring=require(_0x3b44('0x12'));var Papa=require(_0x3b44('0x13'));var Redis=require(_0x3b44('0x14'));var authService=require(_0x3b44('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3b44('0x16'));var utils=require(_0x3b44('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3b44('0x18'));var db=require(_0x3b44('0x19'))['db'];function respondWithStatusCode(_0x46443e,_0x221ee4){_0x221ee4=_0x221ee4||0xcc;return function(_0x5797f6){if(_0x5797f6){return _0x46443e['sendStatus'](_0x221ee4);}return _0x46443e['status'](_0x221ee4)['end']();};}function respondWithResult(_0x5ee23e,_0x172e86){_0x172e86=_0x172e86||0xc8;return function(_0x1b5072){if(_0x1b5072){return _0x5ee23e[_0x3b44('0x1a')](_0x172e86)[_0x3b44('0x1b')](_0x1b5072);}};}function respondWithFilteredResult(_0x169fa3,_0x3c734c){return function(_0x835bfe){if(_0x835bfe){var _0x173dce=typeof _0x3c734c[_0x3b44('0x1c')]===_0x3b44('0x1d')&&typeof _0x3c734c[_0x3b44('0x1e')]===_0x3b44('0x1d');var _0x30ed6e=_0x835bfe[_0x3b44('0x1f')];var _0x2f6a79=_0x173dce?0x0:_0x3c734c[_0x3b44('0x1c')];var _0x11fe38=_0x173dce?_0x835bfe[_0x3b44('0x1f')]:_0x3c734c[_0x3b44('0x1c')]+_0x3c734c[_0x3b44('0x1e')];var _0x527f7c;if(_0x11fe38>=_0x30ed6e){_0x11fe38=_0x30ed6e;_0x527f7c=0xc8;}else{_0x527f7c=0xce;}_0x169fa3[_0x3b44('0x1a')](_0x527f7c);return _0x169fa3[_0x3b44('0x20')](_0x3b44('0x21'),_0x2f6a79+'-'+_0x11fe38+'/'+_0x30ed6e)['json'](_0x835bfe);}return null;};}function patchUpdates(_0x4db9fb){return function(_0x361679){try{jsonpatch[_0x3b44('0x22')](_0x361679,_0x4db9fb,!![]);}catch(_0x51c52a){return BPromise[_0x3b44('0x23')](_0x51c52a);}return _0x361679[_0x3b44('0x24')]();};}function saveUpdates(_0x7cbe31,_0x4bb5ba){return function(_0xa4dbb5){if(_0xa4dbb5){return _0xa4dbb5[_0x3b44('0x25')](_0x7cbe31)[_0x3b44('0x26')](function(_0x36d83f){return _0x36d83f;});}return null;};}function removeEntity(_0x4ed93a,_0xf6729d){return function(_0x6b0654){if(_0x6b0654){return _0x6b0654[_0x3b44('0x27')]()['then'](function(){_0x4ed93a['status'](0xcc)[_0x3b44('0x28')]();});}};}function handleEntityNotFound(_0x480a67,_0x4d7707){return function(_0x361f01){if(!_0x361f01){_0x480a67[_0x3b44('0x29')](0x194);}return _0x361f01;};}function handleError(_0x3d0d7c,_0x22239d){_0x22239d=_0x22239d||0x1f4;return function(_0x45ff03){logger[_0x3b44('0x2a')](_0x45ff03[_0x3b44('0x2b')]);if(_0x45ff03[_0x3b44('0x2c')]){delete _0x45ff03[_0x3b44('0x2c')];}_0x3d0d7c[_0x3b44('0x1a')](_0x22239d)[_0x3b44('0x2d')](_0x45ff03);};}exports[_0x3b44('0x2e')]=function(_0x293260,_0x34b2c4){var _0x4f035d={},_0x2989b6={},_0x175ced={'count':0x0,'rows':[]};var _0x3bf1be=_[_0x3b44('0x2f')](db[_0x3b44('0x30')]['rawAttributes'],function(_0xb64fd5){return{'name':_0xb64fd5[_0x3b44('0x31')],'type':_0xb64fd5[_0x3b44('0x32')][_0x3b44('0x33')]};});_0x2989b6[_0x3b44('0x34')]=_[_0x3b44('0x2f')](_0x3bf1be,'name');_0x2989b6[_0x3b44('0x35')]=_[_0x3b44('0x36')](_0x293260[_0x3b44('0x35')]);_0x2989b6[_0x3b44('0x37')]=_['intersection'](_0x2989b6[_0x3b44('0x34')],_0x2989b6[_0x3b44('0x35')]);_0x4f035d[_0x3b44('0x38')]=_[_0x3b44('0x39')](_0x2989b6[_0x3b44('0x34')],qs['fields'](_0x293260[_0x3b44('0x35')][_0x3b44('0x3a')]));_0x4f035d[_0x3b44('0x38')]=_0x4f035d[_0x3b44('0x38')][_0x3b44('0x3b')]?_0x4f035d[_0x3b44('0x38')]:_0x2989b6[_0x3b44('0x34')];if(!_0x293260['query'][_0x3b44('0x3c')](_0x3b44('0x3d'))){_0x4f035d[_0x3b44('0x1e')]=qs['limit'](_0x293260[_0x3b44('0x35')][_0x3b44('0x1e')]);_0x4f035d[_0x3b44('0x1c')]=qs[_0x3b44('0x1c')](_0x293260['query']['offset']);}_0x4f035d['order']=qs[_0x3b44('0x3e')](_0x293260[_0x3b44('0x35')][_0x3b44('0x3e')]);_0x4f035d[_0x3b44('0x3f')]=qs[_0x3b44('0x37')](_['pick'](_0x293260['query'],_0x2989b6[_0x3b44('0x37')]),_0x3bf1be);if(_0x293260[_0x3b44('0x35')][_0x3b44('0x40')]){_0x4f035d[_0x3b44('0x3f')]=_[_0x3b44('0x41')](_0x4f035d[_0x3b44('0x3f')],{'$or':_[_0x3b44('0x2f')](_0x3bf1be,function(_0x3dac9a){if(_0x3dac9a[_0x3b44('0x32')]!==_0x3b44('0x42')){var _0x42ac99={};_0x42ac99[_0x3dac9a[_0x3b44('0x2c')]]={'$like':'%'+_0x293260[_0x3b44('0x35')][_0x3b44('0x40')]+'%'};return _0x42ac99;}})});}_0x4f035d=_[_0x3b44('0x41')]({},_0x4f035d,_0x293260['options']);var _0x2f21c5={'where':_0x4f035d['where']};return db[_0x3b44('0x30')][_0x3b44('0x1f')](_0x2f21c5)['then'](function(_0x1dbc13){_0x175ced[_0x3b44('0x1f')]=_0x1dbc13;if(_0x293260[_0x3b44('0x35')][_0x3b44('0x43')]){_0x4f035d['include']=[{'all':!![]}];}return db['ServicenowConfiguration'][_0x3b44('0x44')](_0x4f035d);})[_0x3b44('0x26')](function(_0xeb69be){_0x175ced[_0x3b44('0x45')]=_0xeb69be;return _0x175ced;})[_0x3b44('0x26')](respondWithFilteredResult(_0x34b2c4,_0x4f035d))['catch'](handleError(_0x34b2c4,null));};exports[_0x3b44('0x46')]=function(_0xee3009,_0x2875bc){var _0x2bacce={'raw':![],'where':{'id':_0xee3009['params']['id']}},_0x2bedc6={};_0x2bedc6[_0x3b44('0x34')]=_[_0x3b44('0x36')](db[_0x3b44('0x30')][_0x3b44('0x47')]);_0x2bedc6[_0x3b44('0x35')]=_[_0x3b44('0x36')](_0xee3009[_0x3b44('0x35')]);_0x2bedc6['filters']=_['intersection'](_0x2bedc6[_0x3b44('0x34')],_0x2bedc6[_0x3b44('0x35')]);_0x2bacce['attributes']=_[_0x3b44('0x39')](_0x2bedc6['model'],qs[_0x3b44('0x3a')](_0xee3009[_0x3b44('0x35')][_0x3b44('0x3a')]));_0x2bacce[_0x3b44('0x38')]=_0x2bacce['attributes']['length']?_0x2bacce[_0x3b44('0x38')]:_0x2bedc6[_0x3b44('0x34')];if(_0xee3009['query'][_0x3b44('0x43')]){_0x2bacce['include']=[{'all':!![]}];}_0x2bacce=_[_0x3b44('0x41')]({},_0x2bacce,_0xee3009[_0x3b44('0x48')]);return db[_0x3b44('0x30')][_0x3b44('0x49')](_0x2bacce)[_0x3b44('0x26')](handleEntityNotFound(_0x2875bc,null))['then'](respondWithResult(_0x2875bc,null))[_0x3b44('0x4a')](handleError(_0x2875bc,null));};exports[_0x3b44('0x4b')]=function(_0x35a18f,_0x56afbb){return db[_0x3b44('0x30')]['create'](_0x35a18f['body'],{})[_0x3b44('0x26')](respondWithResult(_0x56afbb,0xc9))[_0x3b44('0x4a')](handleError(_0x56afbb,null));};exports[_0x3b44('0x25')]=function(_0x6e3182,_0x4d119e){if(_0x6e3182[_0x3b44('0x4c')]['id']){delete _0x6e3182[_0x3b44('0x4c')]['id'];}return db[_0x3b44('0x30')][_0x3b44('0x49')]({'where':{'id':_0x6e3182[_0x3b44('0x4d')]['id']}})[_0x3b44('0x26')](handleEntityNotFound(_0x4d119e,null))[_0x3b44('0x26')](saveUpdates(_0x6e3182[_0x3b44('0x4c')],null))[_0x3b44('0x26')](respondWithResult(_0x4d119e,null))[_0x3b44('0x4a')](handleError(_0x4d119e,null));};exports[_0x3b44('0x27')]=function(_0x205f7b,_0x179c4a){return db[_0x3b44('0x30')]['find']({'where':{'id':_0x205f7b['params']['id']}})['then'](handleEntityNotFound(_0x179c4a,null))[_0x3b44('0x26')](removeEntity(_0x179c4a,null))[_0x3b44('0x4a')](handleError(_0x179c4a,null));};exports[_0x3b44('0x4e')]=function(_0x4e054c,_0x2126de,_0x240f17){var _0x4a5792={};var _0x69ab71={};var _0x531d53;var _0x3ed421;return db[_0x3b44('0x30')][_0x3b44('0x4f')]({'where':{'id':_0x4e054c[_0x3b44('0x4d')]['id']}})[_0x3b44('0x26')](handleEntityNotFound(_0x2126de,null))[_0x3b44('0x26')](function(_0x537510){if(_0x537510){_0x531d53=_0x537510;_0x69ab71[_0x3b44('0x34')]=_[_0x3b44('0x36')](db[_0x3b44('0x50')]['rawAttributes']);_0x69ab71[_0x3b44('0x35')]=_[_0x3b44('0x36')](_0x4e054c['query']);_0x69ab71['filters']=_[_0x3b44('0x39')](_0x69ab71['model'],_0x69ab71[_0x3b44('0x35')]);_0x4a5792[_0x3b44('0x38')]=_['intersection'](_0x69ab71[_0x3b44('0x34')],qs[_0x3b44('0x3a')](_0x4e054c['query'][_0x3b44('0x3a')]));_0x4a5792[_0x3b44('0x38')]=_0x4a5792[_0x3b44('0x38')][_0x3b44('0x3b')]?_0x4a5792[_0x3b44('0x38')]:_0x69ab71[_0x3b44('0x34')];_0x4a5792['order']=qs['sort'](_0x4e054c[_0x3b44('0x35')][_0x3b44('0x3e')]);_0x4a5792[_0x3b44('0x3f')]=qs[_0x3b44('0x37')](_['pick'](_0x4e054c[_0x3b44('0x35')],_0x69ab71[_0x3b44('0x37')]));if(_0x4e054c['query'][_0x3b44('0x40')]){_0x4a5792[_0x3b44('0x3f')]=_[_0x3b44('0x41')](_0x4a5792['where'],{'$or':_[_0x3b44('0x2f')](_0x4a5792['attributes'],function(_0x1b1e91){var _0x2d3fae={};_0x2d3fae[_0x1b1e91]={'$like':'%'+_0x4e054c['query'][_0x3b44('0x40')]+'%'};return _0x2d3fae;})});}_0x4a5792=_[_0x3b44('0x41')]({},_0x4a5792,_0x4e054c[_0x3b44('0x48')]);return _0x531d53['getFields'](_0x4a5792);}})[_0x3b44('0x26')](function(_0x303a35){if(_0x303a35){_0x3ed421=_0x303a35[_0x3b44('0x3b')];if(!_0x4e054c[_0x3b44('0x35')][_0x3b44('0x3c')]('nolimit')){_0x4a5792[_0x3b44('0x1e')]=qs[_0x3b44('0x1e')](_0x4e054c[_0x3b44('0x35')][_0x3b44('0x1e')]);_0x4a5792['offset']=qs[_0x3b44('0x1c')](_0x4e054c[_0x3b44('0x35')]['offset']);}return _0x531d53[_0x3b44('0x4e')](_0x4a5792);}})[_0x3b44('0x26')](function(_0x397df){if(_0x397df){return _0x397df?{'count':_0x3ed421,'rows':_0x397df}:null;}})[_0x3b44('0x26')](respondWithResult(_0x2126de,null))[_0x3b44('0x4a')](handleError(_0x2126de,null));};exports[_0x3b44('0x51')]=function(_0x5dca1f,_0x2d6039,_0x236365){var _0x2f6b63={};var _0x25ff0e={};var _0x301e45;var _0x1558e4;return db[_0x3b44('0x30')][_0x3b44('0x4f')]({'where':{'id':_0x5dca1f[_0x3b44('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2d6039,null))[_0x3b44('0x26')](function(_0x5e14ba){if(_0x5e14ba){_0x301e45=_0x5e14ba;_0x25ff0e['model']=_[_0x3b44('0x36')](db[_0x3b44('0x50')][_0x3b44('0x47')]);_0x25ff0e[_0x3b44('0x35')]=_[_0x3b44('0x36')](_0x5dca1f[_0x3b44('0x35')]);_0x25ff0e[_0x3b44('0x37')]=_['intersection'](_0x25ff0e[_0x3b44('0x34')],_0x25ff0e[_0x3b44('0x35')]);_0x2f6b63[_0x3b44('0x38')]=_[_0x3b44('0x39')](_0x25ff0e[_0x3b44('0x34')],qs[_0x3b44('0x3a')](_0x5dca1f[_0x3b44('0x35')][_0x3b44('0x3a')]));_0x2f6b63[_0x3b44('0x38')]=_0x2f6b63[_0x3b44('0x38')]['length']?_0x2f6b63[_0x3b44('0x38')]:_0x25ff0e[_0x3b44('0x34')];_0x2f6b63[_0x3b44('0x52')]=qs[_0x3b44('0x3e')](_0x5dca1f['query']['sort']);_0x2f6b63[_0x3b44('0x3f')]=qs[_0x3b44('0x37')](_[_0x3b44('0x53')](_0x5dca1f[_0x3b44('0x35')],_0x25ff0e['filters']));if(_0x5dca1f[_0x3b44('0x35')][_0x3b44('0x40')]){_0x2f6b63[_0x3b44('0x3f')]=_[_0x3b44('0x41')](_0x2f6b63[_0x3b44('0x3f')],{'$or':_[_0x3b44('0x2f')](_0x2f6b63[_0x3b44('0x38')],function(_0x395dfa){var _0x137942={};_0x137942[_0x395dfa]={'$like':'%'+_0x5dca1f[_0x3b44('0x35')][_0x3b44('0x40')]+'%'};return _0x137942;})});}_0x2f6b63=_['merge']({},_0x2f6b63,_0x5dca1f[_0x3b44('0x48')]);return _0x301e45[_0x3b44('0x51')](_0x2f6b63);}})[_0x3b44('0x26')](function(_0x12654a){if(_0x12654a){_0x1558e4=_0x12654a[_0x3b44('0x3b')];if(!_0x5dca1f['query']['hasOwnProperty'](_0x3b44('0x3d'))){_0x2f6b63[_0x3b44('0x1e')]=qs[_0x3b44('0x1e')](_0x5dca1f['query'][_0x3b44('0x1e')]);_0x2f6b63[_0x3b44('0x1c')]=qs['offset'](_0x5dca1f[_0x3b44('0x35')]['offset']);}return _0x301e45['getSubjects'](_0x2f6b63);}})[_0x3b44('0x26')](function(_0x3cadea){if(_0x3cadea){return _0x3cadea?{'count':_0x1558e4,'rows':_0x3cadea}:null;}})[_0x3b44('0x26')](respondWithResult(_0x2d6039,null))['catch'](handleError(_0x2d6039,null));};exports[_0x3b44('0x54')]=function(_0x2850c0,_0x551ce1,_0x3e3198){var _0x34af21={};var _0x52d453={};var _0x52ae77;var _0x14f07e;return db[_0x3b44('0x30')]['findOne']({'where':{'id':_0x2850c0[_0x3b44('0x4d')]['id']}})['then'](handleEntityNotFound(_0x551ce1,null))['then'](function(_0x349971){if(_0x349971){_0x52ae77=_0x349971;_0x52d453[_0x3b44('0x34')]=_['keys'](db[_0x3b44('0x50')][_0x3b44('0x47')]);_0x52d453[_0x3b44('0x35')]=_['keys'](_0x2850c0[_0x3b44('0x35')]);_0x52d453['filters']=_[_0x3b44('0x39')](_0x52d453[_0x3b44('0x34')],_0x52d453[_0x3b44('0x35')]);_0x34af21['attributes']=_[_0x3b44('0x39')](_0x52d453[_0x3b44('0x34')],qs[_0x3b44('0x3a')](_0x2850c0[_0x3b44('0x35')][_0x3b44('0x3a')]));_0x34af21[_0x3b44('0x38')]=_0x34af21['attributes'][_0x3b44('0x3b')]?_0x34af21[_0x3b44('0x38')]:_0x52d453[_0x3b44('0x34')];_0x34af21['order']=qs[_0x3b44('0x3e')](_0x2850c0[_0x3b44('0x35')][_0x3b44('0x3e')]);_0x34af21[_0x3b44('0x3f')]=qs[_0x3b44('0x37')](_['pick'](_0x2850c0['query'],_0x52d453[_0x3b44('0x37')]));if(_0x2850c0['query'][_0x3b44('0x40')]){_0x34af21['where']=_[_0x3b44('0x41')](_0x34af21[_0x3b44('0x3f')],{'$or':_['map'](_0x34af21['attributes'],function(_0x91a05a){var _0x2c0817={};_0x2c0817[_0x91a05a]={'$like':'%'+_0x2850c0['query']['filter']+'%'};return _0x2c0817;})});}_0x34af21=_[_0x3b44('0x41')]({},_0x34af21,_0x2850c0[_0x3b44('0x48')]);return _0x52ae77[_0x3b44('0x54')](_0x34af21);}})['then'](function(_0x2d0f74){if(_0x2d0f74){_0x14f07e=_0x2d0f74[_0x3b44('0x3b')];if(!_0x2850c0[_0x3b44('0x35')][_0x3b44('0x3c')](_0x3b44('0x3d'))){_0x34af21[_0x3b44('0x1e')]=qs[_0x3b44('0x1e')](_0x2850c0[_0x3b44('0x35')][_0x3b44('0x1e')]);_0x34af21[_0x3b44('0x1c')]=qs[_0x3b44('0x1c')](_0x2850c0['query'][_0x3b44('0x1c')]);}return _0x52ae77[_0x3b44('0x54')](_0x34af21);}})['then'](function(_0xbe2286){if(_0xbe2286){return _0xbe2286?{'count':_0x14f07e,'rows':_0xbe2286}:null;}})[_0x3b44('0x26')](respondWithResult(_0x551ce1,null))[_0x3b44('0x4a')](handleError(_0x551ce1,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e6bf2d3..ab01e31 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 _0xa0a3=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','util'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x53e93b,_0x792a08){_0x53e93b=_0x53e93b-0x0;var _0x356bad=_0xa0a3[_0x53e93b];return _0x356bad;};'use strict';var _=require('lodash');var util=require(_0x3a0a('0x0'));var logger=require(_0x3a0a('0x1'))('api');var moment=require(_0x3a0a('0x2'));var BPromise=require(_0x3a0a('0x3'));var rp=require(_0x3a0a('0x4'));var fs=require('fs');var path=require(_0x3a0a('0x5'));var rimraf=require(_0x3a0a('0x6'));var config=require(_0x3a0a('0x7'));var attributes=require(_0x3a0a('0x8'));module[_0x3a0a('0x9')]=function(_0xa047cf,_0x3d7dc7){return _0xa047cf[_0x3a0a('0xa')](_0x3a0a('0xb'),attributes,{'tableName':_0x3a0a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38d0=['int_servicenow_configurations','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ServicenowConfiguration'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x38d0,0x123));var _0x038d=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x38d0[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0x038d('0x0'));var logger=require(_0x038d('0x1'))(_0x038d('0x2'));var moment=require('moment');var BPromise=require(_0x038d('0x3'));var rp=require(_0x038d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x038d('0x5'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x038d('0x6')]=function(_0x2dd6b0,_0x5914cb){return _0x2dd6b0[_0x038d('0x7')](_0x038d('0x8'),attributes,{'tableName':_0x038d('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 5c0ecdd..1ef5d65 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 _0xf794=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','request\x20sent','result','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xf794,0x150));var _0x4f79=function(_0x3ce939,_0x2adc64){_0x3ce939=_0x3ce939-0x0;var _0x420ad2=_0xf794[_0x3ce939];return _0x420ad2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4f79('0x0'));var BPromise=require(_0x4f79('0x1'));var rs=require(_0x4f79('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f79('0x3'))['db'];var utils=require(_0x4f79('0x4'));var logger=require(_0x4f79('0x5'))(_0x4f79('0x6'));var config=require(_0x4f79('0x7'));var jayson=require(_0x4f79('0x8'));var client=jayson['client'][_0x4f79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x16bb36,_0x49d46e,_0x50a969){return new BPromise(function(_0x5ba9ea,_0x3000be){return client['request'](_0x16bb36,_0x50a969)[_0x4f79('0xa')](function(_0x3c11de){logger[_0x4f79('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,'request\x20sent');logger[_0x4f79('0xc')](_0x4f79('0xd'),_0x49d46e,'request\x20sent',JSON[_0x4f79('0xe')](_0x3c11de));if(_0x3c11de['error']){if(_0x3c11de['error']['code']===0x1f4){logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);return _0x3000be(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}logger[_0x4f79('0xf')](_0x4f79('0x10'),_0x49d46e,_0x3c11de['error'][_0x4f79('0x11')]);return _0x5ba9ea(_0x3c11de[_0x4f79('0xf')][_0x4f79('0x11')]);}else{logger[_0x4f79('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,_0x4f79('0x12'));_0x5ba9ea(_0x3c11de[_0x4f79('0x13')]['message']);}})['catch'](function(_0x1d36d1){logger[_0x4f79('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49d46e,_0x1d36d1);_0x3000be(_0x1d36d1);});});} \ No newline at end of file +var _0x94a1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','bluebird','ioredis','../../config/logger'];(function(_0x3759fa,_0x4a1baa){var _0x4e512e=function(_0x4cd625){while(--_0x4cd625){_0x3759fa['push'](_0x3759fa['shift']());}};_0x4e512e(++_0x4a1baa);}(_0x94a1,0x10d));var _0x194a=function(_0x3df949,_0x4c0a41){_0x3df949=_0x3df949-0x0;var _0x4fae3f=_0x94a1[_0x3df949];return _0x4fae3f;};'use strict';var _=require(_0x194a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x194a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x194a('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x194a('0x3'))(_0x194a('0x4'));var config=require(_0x194a('0x5'));var jayson=require(_0x194a('0x6'));var client=jayson[_0x194a('0x7')][_0x194a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c7ee7,_0x598484,_0x839d71){return new BPromise(function(_0x6be0de,_0x482fef){return client[_0x194a('0x9')](_0x5c7ee7,_0x839d71)[_0x194a('0xa')](function(_0x26361f){logger[_0x194a('0xb')](_0x194a('0xc'),_0x598484,_0x194a('0xd'));logger[_0x194a('0xe')](_0x194a('0xf'),_0x598484,'request\x20sent',JSON[_0x194a('0x10')](_0x26361f));if(_0x26361f['error']){if(_0x26361f[_0x194a('0x11')]['code']===0x1f4){logger[_0x194a('0x11')](_0x194a('0xc'),_0x598484,_0x26361f['error'][_0x194a('0x12')]);return _0x482fef(_0x26361f['error'][_0x194a('0x12')]);}logger[_0x194a('0x11')](_0x194a('0xc'),_0x598484,_0x26361f['error'][_0x194a('0x12')]);return _0x6be0de(_0x26361f['error'][_0x194a('0x12')]);}else{logger[_0x194a('0xb')](_0x194a('0xc'),_0x598484,'request\x20sent');_0x6be0de(_0x26361f[_0x194a('0x13')][_0x194a('0x12')]);}})[_0x194a('0x14')](function(_0x5e7e1a){logger[_0x194a('0x11')](_0x194a('0xc'),_0x598484,_0x5e7e1a);_0x482fef(_0x5e7e1a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 135aae9..6213b5d 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 _0x67b2=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67b2,0x66));var _0x267b=function(_0x1ed116,_0x23bc80){_0x1ed116=_0x1ed116-0x0;var _0x574066=_0x67b2[_0x1ed116];return _0x574066;};'use strict';var multer=require(_0x267b('0x0'));var util=require(_0x267b('0x1'));var path=require(_0x267b('0x2'));var timeout=require(_0x267b('0x3'));var express=require('express');var router=express[_0x267b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x267b('0x5'));var interaction=require(_0x267b('0x6'));var config=require(_0x267b('0x7'));var controller=require(_0x267b('0x8'));router[_0x267b('0x9')]('/',auth[_0x267b('0xa')](),controller['index']);router[_0x267b('0x9')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0xc')]);router[_0x267b('0xd')]('/',auth[_0x267b('0xa')](),controller[_0x267b('0xe')]);router[_0x267b('0xf')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0x10')]);router[_0x267b('0x11')](_0x267b('0xb'),auth[_0x267b('0xa')](),controller[_0x267b('0x12')]);module[_0x267b('0x13')]=router; \ No newline at end of file +var _0x9793=['fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get','index','isAuthenticated','show','post','create','put','/:id','delete','exports','path','connect-timeout','Router'];(function(_0x542d80,_0x150561){var _0x1f4492=function(_0x542215){while(--_0x542215){_0x542d80['push'](_0x542d80['shift']());}};_0x1f4492(++_0x150561);}(_0x9793,0x1ea));var _0x3979=function(_0x10a5aa,_0x5314ea){_0x10a5aa=_0x10a5aa-0x0;var _0x5e32f7=_0x9793[_0x10a5aa];return _0x5e32f7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3979('0x0'));var timeout=require(_0x3979('0x1'));var express=require('express');var router=express[_0x3979('0x2')]();var fs_extra=require(_0x3979('0x3'));var auth=require(_0x3979('0x4'));var interaction=require(_0x3979('0x5'));var config=require('../../config/environment');var controller=require(_0x3979('0x6'));router[_0x3979('0x7')]('/',auth['isAuthenticated'](),controller[_0x3979('0x8')]);router[_0x3979('0x7')]('/:id',auth[_0x3979('0x9')](),controller[_0x3979('0xa')]);router[_0x3979('0xb')]('/',auth[_0x3979('0x9')](),controller[_0x3979('0xc')]);router[_0x3979('0xd')](_0x3979('0xe'),auth[_0x3979('0x9')](),controller['update']);router[_0x3979('0xf')](_0x3979('0xe'),auth[_0x3979('0x9')](),controller['destroy']);module[_0x3979('0x10')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 65fcd8c..3312f1c 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 _0x2f79=['string','sequelize','exports','ENUM','variable','customVariable','STRING'];(function(_0x23e33d,_0x31c8c8){var _0x818fc=function(_0x19f33e){while(--_0x19f33e){_0x23e33d['push'](_0x23e33d['shift']());}};_0x818fc(++_0x31c8c8);}(_0x2f79,0x104));var _0x92f7=function(_0x5bd647,_0x8bad63){_0x5bd647=_0x5bd647-0x0;var _0x3ca6a2=_0x2f79[_0x5bd647];return _0x3ca6a2;};'use strict';var Sequelize=require(_0x92f7('0x0'));module[_0x92f7('0x1')]={'type':{'type':Sequelize[_0x92f7('0x2')]('string',_0x92f7('0x3'),_0x92f7('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x92f7('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x92f7('0x6'),_0x92f7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x92f7('0x5')]},'idField':{'type':Sequelize[_0x92f7('0x5')]},'nameField':{'type':Sequelize[_0x92f7('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x92f7('0x5')]}}; \ No newline at end of file +var _0x66de=['keyValue','picklist','STRING','ENUM','variable','BOOLEAN','exports','string','customVariable'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x66de,0xde));var _0xe66d=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0x66de[_0x44b0de];return _0x21da2a;};'use strict';var Sequelize=require('sequelize');module[_0xe66d('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe66d('0x1'),'variable',_0xe66d('0x2'),_0xe66d('0x3'),_0xe66d('0x4')),'defaultValue':_0xe66d('0x1')},'content':{'type':Sequelize[_0xe66d('0x5')]},'key':{'type':Sequelize[_0xe66d('0x5')]},'keyType':{'type':Sequelize[_0xe66d('0x6')](_0xe66d('0x1'),_0xe66d('0x7'),_0xe66d('0x2'))},'keyContent':{'type':Sequelize[_0xe66d('0x5')]},'idField':{'type':Sequelize[_0xe66d('0x5')]},'nameField':{'type':Sequelize[_0xe66d('0x5')]},'customField':{'type':Sequelize[_0xe66d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe66d('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index b394c8f..2af5452 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 _0xb0d3=['update','then','destroy','end','error','name','send','index','map','ServicenowField','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','keys','rawAttributes','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb0d3,0x108));var _0x3b0d=function(_0x3403d5,_0x3d99fc){_0x3403d5=_0x3403d5-0x0;var _0xf9df4f=_0xb0d3[_0x3403d5];return _0xf9df4f;};'use strict';var emlformat=require(_0x3b0d('0x0'));var rimraf=require(_0x3b0d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3b0d('0x2'));var moment=require(_0x3b0d('0x3'));var BPromise=require(_0x3b0d('0x4'));var Mustache=require(_0x3b0d('0x5'));var util=require(_0x3b0d('0x6'));var path=require(_0x3b0d('0x7'));var sox=require(_0x3b0d('0x8'));var csv=require(_0x3b0d('0x9'));var ejs=require(_0x3b0d('0xa'));var fs=require('fs');var fs_extra=require(_0x3b0d('0xb'));var _=require(_0x3b0d('0xc'));var squel=require(_0x3b0d('0xd'));var crypto=require(_0x3b0d('0xe'));var jsforce=require(_0x3b0d('0xf'));var deskjs=require(_0x3b0d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3b0d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3b0d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b0d('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3b0d('0x14'));var config=require(_0x3b0d('0x15'));var licenseUtil=require(_0x3b0d('0x16'));var db=require(_0x3b0d('0x17'))['db'];function respondWithStatusCode(_0x44e66e,_0xcc488){_0xcc488=_0xcc488||0xcc;return function(_0x5a0080){if(_0x5a0080){return _0x44e66e[_0x3b0d('0x18')](_0xcc488);}return _0x44e66e[_0x3b0d('0x19')](_0xcc488)['end']();};}function respondWithResult(_0x1e4300,_0x479607){_0x479607=_0x479607||0xc8;return function(_0x212f25){if(_0x212f25){return _0x1e4300[_0x3b0d('0x19')](_0x479607)[_0x3b0d('0x1a')](_0x212f25);}};}function respondWithFilteredResult(_0x2c196c,_0x17bfb0){return function(_0x542f93){if(_0x542f93){var _0x16dc67=typeof _0x17bfb0[_0x3b0d('0x1b')]===_0x3b0d('0x1c')&&typeof _0x17bfb0['limit']===_0x3b0d('0x1c');var _0x4520ca=_0x542f93[_0x3b0d('0x1d')];var _0x23b90a=_0x16dc67?0x0:_0x17bfb0[_0x3b0d('0x1b')];var _0x34bdb9=_0x16dc67?_0x542f93[_0x3b0d('0x1d')]:_0x17bfb0[_0x3b0d('0x1b')]+_0x17bfb0[_0x3b0d('0x1e')];var _0x3de670;if(_0x34bdb9>=_0x4520ca){_0x34bdb9=_0x4520ca;_0x3de670=0xc8;}else{_0x3de670=0xce;}_0x2c196c[_0x3b0d('0x19')](_0x3de670);return _0x2c196c[_0x3b0d('0x1f')](_0x3b0d('0x20'),_0x23b90a+'-'+_0x34bdb9+'/'+_0x4520ca)[_0x3b0d('0x1a')](_0x542f93);}return null;};}function patchUpdates(_0x2e89ce){return function(_0x494f8e){try{jsonpatch[_0x3b0d('0x21')](_0x494f8e,_0x2e89ce,!![]);}catch(_0x1296f3){return BPromise[_0x3b0d('0x22')](_0x1296f3);}return _0x494f8e[_0x3b0d('0x23')]();};}function saveUpdates(_0x36ccd6,_0x5daca5){return function(_0x172ded){if(_0x172ded){return _0x172ded[_0x3b0d('0x24')](_0x36ccd6)[_0x3b0d('0x25')](function(_0x2bf25e){return _0x2bf25e;});}return null;};}function removeEntity(_0x3dae31,_0x282c92){return function(_0x340b03){if(_0x340b03){return _0x340b03[_0x3b0d('0x26')]()['then'](function(){_0x3dae31[_0x3b0d('0x19')](0xcc)[_0x3b0d('0x27')]();});}};}function handleEntityNotFound(_0x2de925,_0xe2c7e2){return function(_0x5fbaa1){if(!_0x5fbaa1){_0x2de925[_0x3b0d('0x18')](0x194);}return _0x5fbaa1;};}function handleError(_0x26fd17,_0x367768){_0x367768=_0x367768||0x1f4;return function(_0x59e6d3){logger[_0x3b0d('0x28')](_0x59e6d3['stack']);if(_0x59e6d3[_0x3b0d('0x29')]){delete _0x59e6d3['name'];}_0x26fd17[_0x3b0d('0x19')](_0x367768)[_0x3b0d('0x2a')](_0x59e6d3);};}exports[_0x3b0d('0x2b')]=function(_0x460f0d,_0x9f91a6){var _0xec964={},_0x771867={},_0x2a7aeb={'count':0x0,'rows':[]};var _0x591d6f=_[_0x3b0d('0x2c')](db[_0x3b0d('0x2d')]['rawAttributes'],function(_0x5efdba){return{'name':_0x5efdba['fieldName'],'type':_0x5efdba[_0x3b0d('0x2e')][_0x3b0d('0x2f')]};});_0x771867['model']=_['map'](_0x591d6f,_0x3b0d('0x29'));_0x771867[_0x3b0d('0x30')]=_['keys'](_0x460f0d[_0x3b0d('0x30')]);_0x771867[_0x3b0d('0x31')]=_['intersection'](_0x771867[_0x3b0d('0x32')],_0x771867[_0x3b0d('0x30')]);_0xec964[_0x3b0d('0x33')]=_[_0x3b0d('0x34')](_0x771867[_0x3b0d('0x32')],qs[_0x3b0d('0x35')](_0x460f0d[_0x3b0d('0x30')]['fields']));_0xec964[_0x3b0d('0x33')]=_0xec964[_0x3b0d('0x33')][_0x3b0d('0x36')]?_0xec964[_0x3b0d('0x33')]:_0x771867[_0x3b0d('0x32')];if(!_0x460f0d['query'][_0x3b0d('0x37')](_0x3b0d('0x38'))){_0xec964[_0x3b0d('0x1e')]=qs[_0x3b0d('0x1e')](_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x1e')]);_0xec964[_0x3b0d('0x1b')]=qs[_0x3b0d('0x1b')](_0x460f0d[_0x3b0d('0x30')]['offset']);}_0xec964[_0x3b0d('0x39')]=qs[_0x3b0d('0x3a')](_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x3a')]);_0xec964[_0x3b0d('0x3b')]=qs[_0x3b0d('0x31')](_[_0x3b0d('0x3c')](_0x460f0d[_0x3b0d('0x30')],_0x771867[_0x3b0d('0x31')]),_0x591d6f);if(_0x460f0d[_0x3b0d('0x30')][_0x3b0d('0x3d')]){_0xec964['where']=_[_0x3b0d('0x3e')](_0xec964[_0x3b0d('0x3b')],{'$or':_['map'](_0x591d6f,function(_0x3508b6){if(_0x3508b6[_0x3b0d('0x2e')]!==_0x3b0d('0x3f')){var _0x9f337={};_0x9f337[_0x3508b6[_0x3b0d('0x29')]]={'$like':'%'+_0x460f0d['query'][_0x3b0d('0x3d')]+'%'};return _0x9f337;}})});}_0xec964=_[_0x3b0d('0x3e')]({},_0xec964,_0x460f0d[_0x3b0d('0x40')]);var _0x5d71d1={'where':_0xec964['where']};return db[_0x3b0d('0x2d')][_0x3b0d('0x1d')](_0x5d71d1)['then'](function(_0x39be6c){_0x2a7aeb[_0x3b0d('0x1d')]=_0x39be6c;if(_0x460f0d['query'][_0x3b0d('0x41')]){_0xec964[_0x3b0d('0x42')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0xec964);})[_0x3b0d('0x25')](function(_0x21af27){_0x2a7aeb[_0x3b0d('0x43')]=_0x21af27;return _0x2a7aeb;})[_0x3b0d('0x25')](respondWithFilteredResult(_0x9f91a6,_0xec964))[_0x3b0d('0x44')](handleError(_0x9f91a6,null));};exports[_0x3b0d('0x45')]=function(_0xb3ec1b,_0x5a37e9){var _0x2ebf9c={'raw':!![],'where':{'id':_0xb3ec1b['params']['id']}},_0x15156e={};_0x15156e[_0x3b0d('0x32')]=_[_0x3b0d('0x46')](db[_0x3b0d('0x2d')][_0x3b0d('0x47')]);_0x15156e[_0x3b0d('0x30')]=_[_0x3b0d('0x46')](_0xb3ec1b[_0x3b0d('0x30')]);_0x15156e['filters']=_[_0x3b0d('0x34')](_0x15156e[_0x3b0d('0x32')],_0x15156e[_0x3b0d('0x30')]);_0x2ebf9c['attributes']=_['intersection'](_0x15156e[_0x3b0d('0x32')],qs['fields'](_0xb3ec1b[_0x3b0d('0x30')]['fields']));_0x2ebf9c[_0x3b0d('0x33')]=_0x2ebf9c[_0x3b0d('0x33')][_0x3b0d('0x36')]?_0x2ebf9c[_0x3b0d('0x33')]:_0x15156e[_0x3b0d('0x32')];if(_0xb3ec1b['query'][_0x3b0d('0x41')]){_0x2ebf9c[_0x3b0d('0x42')]=[{'all':!![]}];}_0x2ebf9c=_['merge']({},_0x2ebf9c,_0xb3ec1b[_0x3b0d('0x40')]);return db['ServicenowField']['find'](_0x2ebf9c)[_0x3b0d('0x25')](handleEntityNotFound(_0x5a37e9,null))[_0x3b0d('0x25')](respondWithResult(_0x5a37e9,null))['catch'](handleError(_0x5a37e9,null));};exports[_0x3b0d('0x48')]=function(_0x205461,_0x56cad7){return db['ServicenowField'][_0x3b0d('0x48')](_0x205461['body'],{})[_0x3b0d('0x25')](respondWithResult(_0x56cad7,0xc9))['catch'](handleError(_0x56cad7,null));};exports[_0x3b0d('0x24')]=function(_0x19b37e,_0x2c904f){if(_0x19b37e[_0x3b0d('0x49')]['id']){delete _0x19b37e['body']['id'];}return db[_0x3b0d('0x2d')][_0x3b0d('0x4a')]({'where':{'id':_0x19b37e['params']['id']}})[_0x3b0d('0x25')](handleEntityNotFound(_0x2c904f,null))[_0x3b0d('0x25')](saveUpdates(_0x19b37e[_0x3b0d('0x49')],null))['then'](respondWithResult(_0x2c904f,null))[_0x3b0d('0x44')](handleError(_0x2c904f,null));};exports[_0x3b0d('0x26')]=function(_0x23b813,_0x4539c5){return db['ServicenowField']['find']({'where':{'id':_0x23b813['params']['id']}})[_0x3b0d('0x25')](handleEntityNotFound(_0x4539c5,null))[_0x3b0d('0x25')](removeEntity(_0x4539c5,null))[_0x3b0d('0x44')](handleError(_0x4539c5,null));}; \ No newline at end of file +var _0x1774=['fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','type','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','intersection','attributes'];(function(_0x309144,_0x5b4e07){var _0x5c8242=function(_0x55c077){while(--_0x55c077){_0x309144['push'](_0x309144['shift']());}};_0x5c8242(++_0x5b4e07);}(_0x1774,0x184));var _0x4177=function(_0x5b643b,_0x4a2d0b){_0x5b643b=_0x5b643b-0x0;var _0x23b160=_0x1774[_0x5b643b];return _0x23b160;};'use strict';var emlformat=require(_0x4177('0x0'));var rimraf=require(_0x4177('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4177('0x2'));var rp=require('request-promise');var moment=require(_0x4177('0x3'));var BPromise=require(_0x4177('0x4'));var Mustache=require(_0x4177('0x5'));var util=require(_0x4177('0x6'));var path=require(_0x4177('0x7'));var sox=require(_0x4177('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4177('0x9'));var squel=require(_0x4177('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4177('0xb'));var toCsv=require(_0x4177('0xc'));var querystring=require('querystring');var Papa=require(_0x4177('0xd'));var Redis=require(_0x4177('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x4177('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4177('0x10'))(_0x4177('0x11'));var utils=require(_0x4177('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x4177('0x13'));var db=require(_0x4177('0x14'))['db'];function respondWithStatusCode(_0x583f71,_0x462018){_0x462018=_0x462018||0xcc;return function(_0x4c06bf){if(_0x4c06bf){return _0x583f71[_0x4177('0x15')](_0x462018);}return _0x583f71[_0x4177('0x16')](_0x462018)[_0x4177('0x17')]();};}function respondWithResult(_0x5514dd,_0x3a8100){_0x3a8100=_0x3a8100||0xc8;return function(_0x5aa8e1){if(_0x5aa8e1){return _0x5514dd[_0x4177('0x16')](_0x3a8100)['json'](_0x5aa8e1);}};}function respondWithFilteredResult(_0x1f31d5,_0x3f7adf){return function(_0x568349){if(_0x568349){var _0x3e20ff=typeof _0x3f7adf['offset']===_0x4177('0x18')&&typeof _0x3f7adf['limit']==='undefined';var _0x195745=_0x568349['count'];var _0x2494c9=_0x3e20ff?0x0:_0x3f7adf[_0x4177('0x19')];var _0x14893e=_0x3e20ff?_0x568349['count']:_0x3f7adf['offset']+_0x3f7adf['limit'];var _0x40918c;if(_0x14893e>=_0x195745){_0x14893e=_0x195745;_0x40918c=0xc8;}else{_0x40918c=0xce;}_0x1f31d5[_0x4177('0x16')](_0x40918c);return _0x1f31d5[_0x4177('0x1a')](_0x4177('0x1b'),_0x2494c9+'-'+_0x14893e+'/'+_0x195745)[_0x4177('0x1c')](_0x568349);}return null;};}function patchUpdates(_0x62b146){return function(_0x3cb6e3){try{jsonpatch[_0x4177('0x1d')](_0x3cb6e3,_0x62b146,!![]);}catch(_0x3fad25){return BPromise[_0x4177('0x1e')](_0x3fad25);}return _0x3cb6e3[_0x4177('0x1f')]();};}function saveUpdates(_0x302cbe,_0x57d513){return function(_0x29e12f){if(_0x29e12f){return _0x29e12f[_0x4177('0x20')](_0x302cbe)[_0x4177('0x21')](function(_0x2b9789){return _0x2b9789;});}return null;};}function removeEntity(_0x407cef,_0x444f90){return function(_0x391379){if(_0x391379){return _0x391379[_0x4177('0x22')]()['then'](function(){_0x407cef[_0x4177('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274103,_0x5436f7){return function(_0x41495f){if(!_0x41495f){_0x274103[_0x4177('0x15')](0x194);}return _0x41495f;};}function handleError(_0x37c7df,_0x4c7301){_0x4c7301=_0x4c7301||0x1f4;return function(_0x452299){logger[_0x4177('0x23')](_0x452299[_0x4177('0x24')]);if(_0x452299[_0x4177('0x25')]){delete _0x452299[_0x4177('0x25')];}_0x37c7df[_0x4177('0x16')](_0x4c7301)[_0x4177('0x26')](_0x452299);};}exports[_0x4177('0x27')]=function(_0x50dd7e,_0x24b973){var _0x240f4d={},_0x399036={},_0x262021={'count':0x0,'rows':[]};var _0x55231a=_[_0x4177('0x28')](db[_0x4177('0x29')][_0x4177('0x2a')],function(_0x1efc23){return{'name':_0x1efc23[_0x4177('0x2b')],'type':_0x1efc23['type'][_0x4177('0x2c')]};});_0x399036[_0x4177('0x2d')]=_[_0x4177('0x28')](_0x55231a,_0x4177('0x25'));_0x399036[_0x4177('0x2e')]=_[_0x4177('0x2f')](_0x50dd7e[_0x4177('0x2e')]);_0x399036['filters']=_[_0x4177('0x30')](_0x399036[_0x4177('0x2d')],_0x399036[_0x4177('0x2e')]);_0x240f4d[_0x4177('0x31')]=_[_0x4177('0x30')](_0x399036[_0x4177('0x2d')],qs[_0x4177('0x32')](_0x50dd7e['query'][_0x4177('0x32')]));_0x240f4d[_0x4177('0x31')]=_0x240f4d[_0x4177('0x31')][_0x4177('0x33')]?_0x240f4d['attributes']:_0x399036[_0x4177('0x2d')];if(!_0x50dd7e[_0x4177('0x2e')][_0x4177('0x34')]('nolimit')){_0x240f4d['limit']=qs[_0x4177('0x35')](_0x50dd7e[_0x4177('0x2e')][_0x4177('0x35')]);_0x240f4d[_0x4177('0x19')]=qs['offset'](_0x50dd7e['query'][_0x4177('0x19')]);}_0x240f4d[_0x4177('0x36')]=qs[_0x4177('0x37')](_0x50dd7e[_0x4177('0x2e')]['sort']);_0x240f4d[_0x4177('0x38')]=qs['filters'](_['pick'](_0x50dd7e['query'],_0x399036[_0x4177('0x39')]),_0x55231a);if(_0x50dd7e[_0x4177('0x2e')][_0x4177('0x3a')]){_0x240f4d[_0x4177('0x38')]=_[_0x4177('0x3b')](_0x240f4d[_0x4177('0x38')],{'$or':_['map'](_0x55231a,function(_0x2a25ac){if(_0x2a25ac[_0x4177('0x3c')]!=='VIRTUAL'){var _0xd317bd={};_0xd317bd[_0x2a25ac[_0x4177('0x25')]]={'$like':'%'+_0x50dd7e[_0x4177('0x2e')]['filter']+'%'};return _0xd317bd;}})});}_0x240f4d=_[_0x4177('0x3b')]({},_0x240f4d,_0x50dd7e[_0x4177('0x3d')]);var _0x336162={'where':_0x240f4d[_0x4177('0x38')]};return db[_0x4177('0x29')][_0x4177('0x3e')](_0x336162)[_0x4177('0x21')](function(_0x39f47d){_0x262021[_0x4177('0x3e')]=_0x39f47d;if(_0x50dd7e[_0x4177('0x2e')][_0x4177('0x3f')]){_0x240f4d[_0x4177('0x40')]=[{'all':!![]}];}return db[_0x4177('0x29')][_0x4177('0x41')](_0x240f4d);})[_0x4177('0x21')](function(_0x3ec7d9){_0x262021[_0x4177('0x42')]=_0x3ec7d9;return _0x262021;})[_0x4177('0x21')](respondWithFilteredResult(_0x24b973,_0x240f4d))[_0x4177('0x43')](handleError(_0x24b973,null));};exports[_0x4177('0x44')]=function(_0x397dd8,_0x1cf2b5){var _0xb1a3f8={'raw':!![],'where':{'id':_0x397dd8[_0x4177('0x45')]['id']}},_0x443cd4={};_0x443cd4[_0x4177('0x2d')]=_[_0x4177('0x2f')](db['ServicenowField'][_0x4177('0x2a')]);_0x443cd4['query']=_[_0x4177('0x2f')](_0x397dd8[_0x4177('0x2e')]);_0x443cd4[_0x4177('0x39')]=_[_0x4177('0x30')](_0x443cd4[_0x4177('0x2d')],_0x443cd4[_0x4177('0x2e')]);_0xb1a3f8[_0x4177('0x31')]=_[_0x4177('0x30')](_0x443cd4[_0x4177('0x2d')],qs[_0x4177('0x32')](_0x397dd8[_0x4177('0x2e')]['fields']));_0xb1a3f8[_0x4177('0x31')]=_0xb1a3f8[_0x4177('0x31')][_0x4177('0x33')]?_0xb1a3f8['attributes']:_0x443cd4[_0x4177('0x2d')];if(_0x397dd8[_0x4177('0x2e')][_0x4177('0x3f')]){_0xb1a3f8[_0x4177('0x40')]=[{'all':!![]}];}_0xb1a3f8=_['merge']({},_0xb1a3f8,_0x397dd8[_0x4177('0x3d')]);return db['ServicenowField']['find'](_0xb1a3f8)[_0x4177('0x21')](handleEntityNotFound(_0x1cf2b5,null))[_0x4177('0x21')](respondWithResult(_0x1cf2b5,null))['catch'](handleError(_0x1cf2b5,null));};exports[_0x4177('0x46')]=function(_0x36b1c1,_0x613fd0){return db[_0x4177('0x29')][_0x4177('0x46')](_0x36b1c1[_0x4177('0x47')],{})[_0x4177('0x21')](respondWithResult(_0x613fd0,0xc9))[_0x4177('0x43')](handleError(_0x613fd0,null));};exports[_0x4177('0x20')]=function(_0x4617b9,_0x1c4559){if(_0x4617b9[_0x4177('0x47')]['id']){delete _0x4617b9[_0x4177('0x47')]['id'];}return db[_0x4177('0x29')][_0x4177('0x48')]({'where':{'id':_0x4617b9[_0x4177('0x45')]['id']}})[_0x4177('0x21')](handleEntityNotFound(_0x1c4559,null))[_0x4177('0x21')](saveUpdates(_0x4617b9['body'],null))['then'](respondWithResult(_0x1c4559,null))[_0x4177('0x43')](handleError(_0x1c4559,null));};exports[_0x4177('0x22')]=function(_0x2c84b3,_0x2f05c8){return db[_0x4177('0x29')][_0x4177('0x48')]({'where':{'id':_0x2c84b3[_0x4177('0x45')]['id']}})[_0x4177('0x21')](handleEntityNotFound(_0x2f05c8,null))[_0x4177('0x21')](removeEntity(_0x2f05c8,null))[_0x4177('0x43')](handleError(_0x2f05c8,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 6428a47..772729e 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 _0x37f8=['exports','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes'];(function(_0xe212f5,_0x304805){var _0xf15f69=function(_0x5f5092){while(--_0x5f5092){_0xe212f5['push'](_0xe212f5['shift']());}};_0xf15f69(++_0x304805);}(_0x37f8,0x18a));var _0x837f=function(_0x1a66e2,_0x52fa50){_0x1a66e2=_0x1a66e2-0x0;var _0x428903=_0x37f8[_0x1a66e2];return _0x428903;};'use strict';var _=require(_0x837f('0x0'));var util=require(_0x837f('0x1'));var logger=require(_0x837f('0x2'))(_0x837f('0x3'));var moment=require(_0x837f('0x4'));var BPromise=require(_0x837f('0x5'));var rp=require(_0x837f('0x6'));var fs=require('fs');var path=require(_0x837f('0x7'));var rimraf=require(_0x837f('0x8'));var config=require(_0x837f('0x9'));var attributes=require(_0x837f('0xa'));module[_0x837f('0xb')]=function(_0x1e0794,_0x422f34){return _0x1e0794['define']('ServicenowField',attributes,{'tableName':_0x837f('0xc'),'paranoid':![],'indexes':[{'name':_0x837f('0xd'),'fields':[_0x837f('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66c7=['./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x15ff04,_0x4cda55){var _0x361c4e=function(_0x1990e8){while(--_0x1990e8){_0x15ff04['push'](_0x15ff04['shift']());}};_0x361c4e(++_0x4cda55);}(_0x66c7,0x15e));var _0x766c=function(_0x597e55,_0x598d9e){_0x597e55=_0x597e55-0x0;var _0x55e299=_0x66c7[_0x597e55];return _0x55e299;};'use strict';var _=require(_0x766c('0x0'));var util=require(_0x766c('0x1'));var logger=require(_0x766c('0x2'))(_0x766c('0x3'));var moment=require(_0x766c('0x4'));var BPromise=require(_0x766c('0x5'));var rp=require(_0x766c('0x6'));var fs=require('fs');var path=require(_0x766c('0x7'));var rimraf=require(_0x766c('0x8'));var config=require(_0x766c('0x9'));var attributes=require(_0x766c('0xa'));module[_0x766c('0xb')]=function(_0x143cb7,_0x4c9291){return _0x143cb7[_0x766c('0xc')](_0x766c('0xd'),attributes,{'tableName':_0x766c('0xe'),'paranoid':![],'indexes':[{'name':_0x766c('0xf'),'fields':[_0x766c('0x10'),_0x766c('0x11')],'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 9a5da03..a3772f8 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 _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2981b5,_0x10d562){var _0x5606f0=function(_0xa3c347){while(--_0xa3c347){_0x2981b5['push'](_0x2981b5['shift']());}};_0x5606f0(++_0x10d562);}(_0x70e0,0x17b));var _0x070e=function(_0x5ad41e,_0x4530d2){_0x5ad41e=_0x5ad41e-0x0;var _0x294ab6=_0x70e0[_0x5ad41e];return _0x294ab6;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2fbfe9,_0xc34d85){var _0x2835f2=function(_0x4e93f9){while(--_0x4e93f9){_0x2fbfe9['push'](_0x2fbfe9['shift']());}};_0x2835f2(++_0xc34d85);}(_0xaa88,0x137));var _0x8aa8=function(_0x21b359,_0x4dc80e){_0x21b359=_0x21b359-0x0;var _0x57b8e7=_0xaa88[_0x21b359];return _0x57b8e7;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c7f9d83..25649c0 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(_0x3dbcc2,_0x9e4c3b){var _0x443068=function(_0x4dd4c3){while(--_0x4dd4c3){_0x3dbcc2['push'](_0x3dbcc2['shift']());}};_0x443068(++_0x9e4c3b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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 _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(_0x1acbf7,_0x5f0cc0){var _0x1eb8f4=function(_0x5bf5f3){while(--_0x5bf5f3){_0x1acbf7['push'](_0x1acbf7['shift']());}};_0x1eb8f4(++_0x5f0cc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 43a9ca6..994ea9c 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(_0x4cad89,_0x43294f){var _0x3ff6ac=function(_0x2e28f9){while(--_0x2e28f9){_0x4cad89['push'](_0x4cad89['shift']());}};_0x3ff6ac(++_0x43294f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x47c322,_0xf4b5df){var _0x35fa76=function(_0x38d0a9){while(--_0x38d0a9){_0x47c322['push'](_0x47c322['shift']());}};_0x35fa76(++_0xf4b5df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'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 cbf7cf8..36d76c3 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 _0xb64e=['%s%s','/service/v4_1/rest.php','login','JSON','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','get_module_fields','stringify','module_fields','remove','includes','endsWith','values','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','show','params','catch','create','body','find','findOne','SugarcrmConfiguration','pick','getConfigurations','addConfiguration','AccountId','channel','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','lastIndexOf','POST'];(function(_0x309b21,_0x5ec2d8){var _0x56b0e9=function(_0x297d8b){while(--_0x297d8b){_0x309b21['push'](_0x309b21['shift']());}};_0x56b0e9(++_0x5ec2d8);}(_0xb64e,0x89));var _0xeb64=function(_0x135f79,_0x5325b8){_0x135f79=_0x135f79-0x0;var _0x7e9953=_0xb64e[_0x135f79];return _0x7e9953;};'use strict';var emlformat=require(_0xeb64('0x0'));var rimraf=require(_0xeb64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb64('0x2'));var rp=require(_0xeb64('0x3'));var moment=require(_0xeb64('0x4'));var BPromise=require(_0xeb64('0x5'));var Mustache=require(_0xeb64('0x6'));var util=require('util');var path=require('path');var sox=require(_0xeb64('0x7'));var csv=require(_0xeb64('0x8'));var ejs=require(_0xeb64('0x9'));var fs=require('fs');var fs_extra=require(_0xeb64('0xa'));var _=require(_0xeb64('0xb'));var squel=require(_0xeb64('0xc'));var crypto=require(_0xeb64('0xd'));var jsforce=require(_0xeb64('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeb64('0x8'));var querystring=require('querystring');var Papa=require(_0xeb64('0xf'));var Redis=require('ioredis');var authService=require(_0xeb64('0x10'));var qs=require(_0xeb64('0x11'));var as=require(_0xeb64('0x12'));var hardwareService=require(_0xeb64('0x13'));var logger=require(_0xeb64('0x14'))('api');var utils=require(_0xeb64('0x15'));var config=require(_0xeb64('0x16'));var licenseUtil=require(_0xeb64('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb64('0x18'));function respondWithStatusCode(_0x4c9b97,_0xa5c3ad){_0xa5c3ad=_0xa5c3ad||0xcc;return function(_0x35a9e1){if(_0x35a9e1){return _0x4c9b97[_0xeb64('0x19')](_0xa5c3ad);}return _0x4c9b97[_0xeb64('0x1a')](_0xa5c3ad)[_0xeb64('0x1b')]();};}function respondWithResult(_0x390bc1,_0x1564ae){_0x1564ae=_0x1564ae||0xc8;return function(_0xebd47e){if(_0xebd47e){return _0x390bc1[_0xeb64('0x1a')](_0x1564ae)[_0xeb64('0x1c')](_0xebd47e);}};}function respondWithFilteredResult(_0x44677e,_0x2d48e1){return function(_0x5b5255){if(_0x5b5255){var _0x4ca119=typeof _0x2d48e1[_0xeb64('0x1d')]===_0xeb64('0x1e')&&typeof _0x2d48e1[_0xeb64('0x1f')]===_0xeb64('0x1e');var _0x24df54=_0x5b5255[_0xeb64('0x20')];var _0x39caf2=_0x4ca119?0x0:_0x2d48e1[_0xeb64('0x1d')];var _0x3a17cd=_0x4ca119?_0x5b5255[_0xeb64('0x20')]:_0x2d48e1[_0xeb64('0x1d')]+_0x2d48e1[_0xeb64('0x1f')];var _0xd05b9f;if(_0x3a17cd>=_0x24df54){_0x3a17cd=_0x24df54;_0xd05b9f=0xc8;}else{_0xd05b9f=0xce;}_0x44677e[_0xeb64('0x1a')](_0xd05b9f);return _0x44677e['set'](_0xeb64('0x21'),_0x39caf2+'-'+_0x3a17cd+'/'+_0x24df54)['json'](_0x5b5255);}return null;};}function patchUpdates(_0x4f4aaa){return function(_0xefa0f9){try{jsonpatch['apply'](_0xefa0f9,_0x4f4aaa,!![]);}catch(_0x3a0f92){return BPromise[_0xeb64('0x22')](_0x3a0f92);}return _0xefa0f9[_0xeb64('0x23')]();};}function saveUpdates(_0x55295d,_0x2e4f6f){return function(_0x598d81){if(_0x598d81){return _0x598d81[_0xeb64('0x24')](_0x55295d)[_0xeb64('0x25')](function(_0x5202a2){return _0x5202a2;});}return null;};}function removeEntity(_0x2b13ca,_0x364728){return function(_0x86b4cf){if(_0x86b4cf){return _0x86b4cf[_0xeb64('0x26')]()[_0xeb64('0x25')](function(){_0x2b13ca[_0xeb64('0x1a')](0xcc)[_0xeb64('0x1b')]();});}};}function handleEntityNotFound(_0x207c15,_0x171b11){return function(_0x17edcb){if(!_0x17edcb){_0x207c15[_0xeb64('0x19')](0x194);}return _0x17edcb;};}function handleError(_0x5922d8,_0x5433ff){_0x5433ff=_0x5433ff||0x1f4;return function(_0x161cc8){logger['error'](_0x161cc8[_0xeb64('0x27')]);if(_0x161cc8[_0xeb64('0x28')]){delete _0x161cc8[_0xeb64('0x28')];}_0x5922d8[_0xeb64('0x1a')](_0x5433ff)[_0xeb64('0x29')](_0x161cc8);};}exports[_0xeb64('0x2a')]=function(_0x344927,_0x5f5832){var _0x5906c6={},_0x3da022={},_0x5d3b45={'count':0x0,'rows':[]};var _0x35ba3a=_[_0xeb64('0x2b')](db[_0xeb64('0x2c')][_0xeb64('0x2d')],function(_0x3fbc06){return{'name':_0x3fbc06[_0xeb64('0x2e')],'type':_0x3fbc06['type'][_0xeb64('0x2f')]};});_0x3da022['model']=_[_0xeb64('0x2b')](_0x35ba3a,_0xeb64('0x28'));_0x3da022[_0xeb64('0x30')]=_[_0xeb64('0x31')](_0x344927['query']);_0x3da022['filters']=_['intersection'](_0x3da022['model'],_0x3da022[_0xeb64('0x30')]);_0x5906c6[_0xeb64('0x32')]=_[_0xeb64('0x33')](_0x3da022[_0xeb64('0x34')],qs['fields'](_0x344927[_0xeb64('0x30')][_0xeb64('0x35')]));_0x5906c6[_0xeb64('0x32')]=_0x5906c6[_0xeb64('0x32')][_0xeb64('0x36')]?_0x5906c6['attributes']:_0x3da022[_0xeb64('0x34')];if(!_0x344927[_0xeb64('0x30')][_0xeb64('0x37')](_0xeb64('0x38'))){_0x5906c6['limit']=qs['limit'](_0x344927[_0xeb64('0x30')][_0xeb64('0x1f')]);_0x5906c6[_0xeb64('0x1d')]=qs[_0xeb64('0x1d')](_0x344927['query'][_0xeb64('0x1d')]);}_0x5906c6[_0xeb64('0x39')]=qs[_0xeb64('0x3a')](_0x344927[_0xeb64('0x30')][_0xeb64('0x3a')]);_0x5906c6[_0xeb64('0x3b')]=qs['filters'](_['pick'](_0x344927[_0xeb64('0x30')],_0x3da022[_0xeb64('0x3c')]),_0x35ba3a);if(_0x344927[_0xeb64('0x30')][_0xeb64('0x3d')]){_0x5906c6[_0xeb64('0x3b')]=_[_0xeb64('0x3e')](_0x5906c6['where'],{'$or':_[_0xeb64('0x2b')](_0x35ba3a,function(_0x4c9aae){if(_0x4c9aae[_0xeb64('0x3f')]!=='VIRTUAL'){var _0x2bba74={};_0x2bba74[_0x4c9aae[_0xeb64('0x28')]]={'$like':'%'+_0x344927[_0xeb64('0x30')][_0xeb64('0x3d')]+'%'};return _0x2bba74;}})});}_0x5906c6=_['merge']({},_0x5906c6,_0x344927[_0xeb64('0x40')]);var _0x182c0c={'where':_0x5906c6[_0xeb64('0x3b')]};return db[_0xeb64('0x2c')][_0xeb64('0x20')](_0x182c0c)[_0xeb64('0x25')](function(_0xe46122){_0x5d3b45[_0xeb64('0x20')]=_0xe46122;if(_0x344927[_0xeb64('0x30')][_0xeb64('0x41')]){_0x5906c6[_0xeb64('0x42')]=[{'all':!![]}];}return db[_0xeb64('0x2c')][_0xeb64('0x43')](_0x5906c6);})[_0xeb64('0x25')](function(_0x587dbf){_0x5d3b45['rows']=_0x587dbf;return _0x5d3b45;})['then'](respondWithFilteredResult(_0x5f5832,_0x5906c6))['catch'](handleError(_0x5f5832,null));};exports[_0xeb64('0x44')]=function(_0x566995,_0x12cc13){var _0x57988e={'raw':![],'where':{'id':_0x566995[_0xeb64('0x45')]['id']}},_0x1fe06c={};_0x1fe06c['model']=_[_0xeb64('0x31')](db['SugarcrmAccount'][_0xeb64('0x2d')]);_0x1fe06c['query']=_[_0xeb64('0x31')](_0x566995[_0xeb64('0x30')]);_0x1fe06c[_0xeb64('0x3c')]=_['intersection'](_0x1fe06c['model'],_0x1fe06c[_0xeb64('0x30')]);_0x57988e[_0xeb64('0x32')]=_['intersection'](_0x1fe06c['model'],qs[_0xeb64('0x35')](_0x566995['query']['fields']));_0x57988e['attributes']=_0x57988e['attributes'][_0xeb64('0x36')]?_0x57988e['attributes']:_0x1fe06c[_0xeb64('0x34')];if(_0x566995['query'][_0xeb64('0x41')]){_0x57988e[_0xeb64('0x42')]=[{'all':!![]}];}_0x57988e=_[_0xeb64('0x3e')]({},_0x57988e,_0x566995['options']);return db[_0xeb64('0x2c')]['find'](_0x57988e)[_0xeb64('0x25')](handleEntityNotFound(_0x12cc13,null))[_0xeb64('0x25')](respondWithResult(_0x12cc13,null))[_0xeb64('0x46')](handleError(_0x12cc13,null));};exports['create']=function(_0x25ebc3,_0x509192){return db['SugarcrmAccount'][_0xeb64('0x47')](_0x25ebc3[_0xeb64('0x48')],{})['then'](respondWithResult(_0x509192,0xc9))[_0xeb64('0x46')](handleError(_0x509192,null));};exports[_0xeb64('0x24')]=function(_0x28093d,_0x4c3a0b){if(_0x28093d[_0xeb64('0x48')]['id']){delete _0x28093d['body']['id'];}return db[_0xeb64('0x2c')][_0xeb64('0x49')]({'where':{'id':_0x28093d[_0xeb64('0x45')]['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x4c3a0b,null))[_0xeb64('0x25')](saveUpdates(_0x28093d[_0xeb64('0x48')],null))[_0xeb64('0x25')](respondWithResult(_0x4c3a0b,null))[_0xeb64('0x46')](handleError(_0x4c3a0b,null));};exports[_0xeb64('0x26')]=function(_0x5dea19,_0x3a01c1){return db[_0xeb64('0x2c')]['find']({'where':{'id':_0x5dea19['params']['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x3a01c1,null))['then'](removeEntity(_0x3a01c1,null))[_0xeb64('0x46')](handleError(_0x3a01c1,null));};exports['getConfigurations']=function(_0x216bdd,_0x1187a0,_0x286b54){var _0xb08cad={};var _0x3f59e4={};var _0x282c83;var _0x468bf4;return db[_0xeb64('0x2c')][_0xeb64('0x4a')]({'where':{'id':_0x216bdd['params']['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x1187a0,null))[_0xeb64('0x25')](function(_0x50b2c8){if(_0x50b2c8){_0x282c83=_0x50b2c8;_0x3f59e4['model']=_[_0xeb64('0x31')](db[_0xeb64('0x4b')][_0xeb64('0x2d')]);_0x3f59e4[_0xeb64('0x30')]=_[_0xeb64('0x31')](_0x216bdd['query']);_0x3f59e4[_0xeb64('0x3c')]=_['intersection'](_0x3f59e4['model'],_0x3f59e4[_0xeb64('0x30')]);_0xb08cad[_0xeb64('0x32')]=_[_0xeb64('0x33')](_0x3f59e4[_0xeb64('0x34')],qs[_0xeb64('0x35')](_0x216bdd[_0xeb64('0x30')][_0xeb64('0x35')]));_0xb08cad[_0xeb64('0x32')]=_0xb08cad[_0xeb64('0x32')][_0xeb64('0x36')]?_0xb08cad['attributes']:_0x3f59e4['model'];_0xb08cad['order']=qs[_0xeb64('0x3a')](_0x216bdd[_0xeb64('0x30')][_0xeb64('0x3a')]);_0xb08cad[_0xeb64('0x3b')]=qs[_0xeb64('0x3c')](_[_0xeb64('0x4c')](_0x216bdd[_0xeb64('0x30')],_0x3f59e4[_0xeb64('0x3c')]));if(_0x216bdd[_0xeb64('0x30')][_0xeb64('0x3d')]){_0xb08cad['where']=_[_0xeb64('0x3e')](_0xb08cad[_0xeb64('0x3b')],{'$or':_['map'](_0xb08cad[_0xeb64('0x32')],function(_0x55e78d){var _0xd32cff={};_0xd32cff[_0x55e78d]={'$like':'%'+_0x216bdd[_0xeb64('0x30')]['filter']+'%'};return _0xd32cff;})});}_0xb08cad=_[_0xeb64('0x3e')]({},_0xb08cad,_0x216bdd[_0xeb64('0x40')]);return _0x282c83[_0xeb64('0x4d')](_0xb08cad);}})[_0xeb64('0x25')](function(_0x5df501){if(_0x5df501){_0x468bf4=_0x5df501[_0xeb64('0x36')];if(!_0x216bdd[_0xeb64('0x30')][_0xeb64('0x37')](_0xeb64('0x38'))){_0xb08cad[_0xeb64('0x1f')]=qs[_0xeb64('0x1f')](_0x216bdd[_0xeb64('0x30')]['limit']);_0xb08cad[_0xeb64('0x1d')]=qs['offset'](_0x216bdd['query'][_0xeb64('0x1d')]);}return _0x282c83[_0xeb64('0x4d')](_0xb08cad);}})[_0xeb64('0x25')](function(_0x2ce0b7){if(_0x2ce0b7){return _0x2ce0b7?{'count':_0x468bf4,'rows':_0x2ce0b7}:null;}})['then'](respondWithResult(_0x1187a0,null))[_0xeb64('0x46')](handleError(_0x1187a0,null));};exports[_0xeb64('0x4e')]=function(_0x758799,_0x32307f,_0x5bc778){if(_0x758799[_0xeb64('0x48')]['id']){delete _0x758799[_0xeb64('0x48')]['id'];}return db[_0xeb64('0x2c')]['findOne']({'where':{'id':_0x758799[_0xeb64('0x45')]['id']}})[_0xeb64('0x25')](handleEntityNotFound(_0x32307f,null))[_0xeb64('0x25')](function(_0x35d6b3){if(_0x35d6b3){_0x758799[_0xeb64('0x48')][_0xeb64('0x4f')]=_0x35d6b3['id'];_0x758799['body']['Subjects']=integrations['getSubjects'](_0x758799[_0xeb64('0x48')]['channel'],_0x758799[_0xeb64('0x48')][_0xeb64('0x3f')]);_0x758799[_0xeb64('0x48')]['Descriptions']=integrations['getDescriptions'](_0x758799['body'][_0xeb64('0x50')],_0x758799[_0xeb64('0x48')]['type']);return db[_0xeb64('0x4b')]['create'](_0x758799[_0xeb64('0x48')],{'include':[{'model':db[_0xeb64('0x51')],'as':'Subjects'},{'model':db['SugarcrmField'],'as':_0xeb64('0x52')}]});}return null;})[_0xeb64('0x25')](respondWithResult(_0x32307f,null))[_0xeb64('0x46')](handleError(_0x32307f,null));};exports[_0xeb64('0x53')]=function(_0x4307a0,_0x3ec849,_0x1955db){var _0x589267='';var _0x696230=['id',_0xeb64('0x28'),_0xeb64('0x54'),_0xeb64('0x55'),_0xeb64('0x56'),_0xeb64('0x57'),_0xeb64('0x58'),_0xeb64('0x59'),'parent_id',_0xeb64('0x5a'),_0xeb64('0x5b'),_0xeb64('0x5c')];return db[_0xeb64('0x2c')][_0xeb64('0x4a')]({'where':{'id':_0x4307a0[_0xeb64('0x45')]['id']},'attributes':['id',_0xeb64('0x5d'),_0xeb64('0x5e'),'remoteUri']})[_0xeb64('0x25')](handleEntityNotFound(_0x3ec849,null))[_0xeb64('0x25')](function(_0x4f7f99){if(_0x4f7f99){_0x589267=_0x4f7f99['remoteUri'];var _0x19dd8b=_0x589267['slice'](-0x1);if(_0x19dd8b==='/'){_0x589267=_0x589267['substring'](0x0,_0x589267[_0xeb64('0x5f')](_0x19dd8b));}return rp({'method':_0xeb64('0x60'),'uri':util['format'](_0xeb64('0x61'),_0x589267,_0xeb64('0x62')),'json':!![],'form':{'method':_0xeb64('0x63'),'input_type':_0xeb64('0x64'),'response_type':_0xeb64('0x64'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4f7f99[_0xeb64('0x5d')],'password':_0x4f7f99[_0xeb64('0x5e')],'encryption':'PLAIN'},'application':_0xeb64('0x65')})}});}})[_0xeb64('0x25')](function(_0x3fdd7b){if(_0x3fdd7b&&_0x3fdd7b[_0xeb64('0x28')]!==_0xeb64('0x66')&&_0x3fdd7b['name']!==_0xeb64('0x67')){return rp({'method':'POST','uri':util[_0xeb64('0x68')](_0xeb64('0x61'),_0x589267,_0xeb64('0x62')),'json':!![],'form':{'method':_0xeb64('0x69'),'input_type':'JSON','response_type':_0xeb64('0x64'),'rest_data':JSON[_0xeb64('0x6a')]({'session':_0x3fdd7b['id'],'module_name':'Calls'})}})['then'](function(_0x4454b6){if(_0x4454b6){var _0x21c624=_['values'](_0x4454b6[_0xeb64('0x6b')]);_[_0xeb64('0x6c')](_0x21c624,function(_0xa8ce58){return _0x696230[_0xeb64('0x6d')](_0xa8ce58['name']);});return{'count':_0x21c624[_0xeb64('0x36')],'rows':_[_0xeb64('0x2b')](_0x21c624,function(_0x15fc31){return{'id':_0x15fc31[_0xeb64('0x28')],'name':_0x15fc31['label'],'custom':_[_0xeb64('0x6e')](_0x15fc31[_0xeb64('0x28')],'_c')?!![]:![],'options':_0x15fc31[_0xeb64('0x40')]?_['map'](_[_0xeb64('0x6f')](_0x15fc31[_0xeb64('0x40')]),function(_0xf6df1e){return{'name':_0xf6df1e['value'],'value':_0xf6df1e[_0xeb64('0x28')]};}):[]};})};}})[_0xeb64('0x25')](respondWithResult(_0x3ec849,null))[_0xeb64('0x46')](function(_0x4c0912){var _0x2738f7=_0x4307a0[_0xeb64('0x30')][_0xeb64('0x70')]?0x1f4:_0x4c0912[_0xeb64('0x71')]||0x1f4;logger[_0xeb64('0x72')](_0xeb64('0x73'),'getFields',_0x2738f7,JSON[_0xeb64('0x6a')](_0x4c0912));delete _0x4c0912[_0xeb64('0x28')];if(_0x2738f7===0x191){_0x2738f7=0x190;}_0x3ec849[_0xeb64('0x1a')](_0x2738f7)[_0xeb64('0x29')](_0x4307a0[_0xeb64('0x30')][_0xeb64('0x70')]?{'message':_0xeb64('0x74'),'statusCode':_0x4c0912['statusCode']}:_0x4c0912);});}else{var _0x426210=0x1f4;_0x3ec849[_0xeb64('0x1a')](_0x426210)[_0xeb64('0x29')]({'message':_0xeb64('0x74'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xffb3=['where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','options','nolimit','AccountId','Subjects','type','Descriptions','SugarcrmField','getFields','assigned_user_id','created_by','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','slice','POST','format','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','get_module_fields','remove','includes','label','endsWith','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','fieldName','key','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xffb3,0xb2));var _0x3ffb=function(_0x2b3157,_0x3acef0){_0x2b3157=_0x2b3157-0x0;var _0x569b59=_0xffb3[_0x2b3157];return _0x569b59;};'use strict';var emlformat=require(_0x3ffb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3ffb('0x1'));var rp=require(_0x3ffb('0x2'));var moment=require(_0x3ffb('0x3'));var BPromise=require(_0x3ffb('0x4'));var Mustache=require(_0x3ffb('0x5'));var util=require(_0x3ffb('0x6'));var path=require('path');var sox=require(_0x3ffb('0x7'));var csv=require(_0x3ffb('0x8'));var ejs=require(_0x3ffb('0x9'));var fs=require('fs');var fs_extra=require(_0x3ffb('0xa'));var _=require(_0x3ffb('0xb'));var squel=require(_0x3ffb('0xc'));var crypto=require(_0x3ffb('0xd'));var jsforce=require(_0x3ffb('0xe'));var deskjs=require(_0x3ffb('0xf'));var toCsv=require(_0x3ffb('0x8'));var querystring=require(_0x3ffb('0x10'));var Papa=require(_0x3ffb('0x11'));var Redis=require(_0x3ffb('0x12'));var authService=require(_0x3ffb('0x13'));var qs=require(_0x3ffb('0x14'));var as=require(_0x3ffb('0x15'));var hardwareService=require(_0x3ffb('0x16'));var logger=require(_0x3ffb('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3ffb('0x18'));var db=require(_0x3ffb('0x19'))['db'];var integrations=require(_0x3ffb('0x1a'));function respondWithStatusCode(_0x854ee1,_0x412107){_0x412107=_0x412107||0xcc;return function(_0x2821f8){if(_0x2821f8){return _0x854ee1[_0x3ffb('0x1b')](_0x412107);}return _0x854ee1[_0x3ffb('0x1c')](_0x412107)['end']();};}function respondWithResult(_0x281c6a,_0x2af629){_0x2af629=_0x2af629||0xc8;return function(_0x5011ac){if(_0x5011ac){return _0x281c6a[_0x3ffb('0x1c')](_0x2af629)[_0x3ffb('0x1d')](_0x5011ac);}};}function respondWithFilteredResult(_0x2dcc66,_0x20efe9){return function(_0x416392){if(_0x416392){var _0x2a5fe2=typeof _0x20efe9[_0x3ffb('0x1e')]===_0x3ffb('0x1f')&&typeof _0x20efe9[_0x3ffb('0x20')]===_0x3ffb('0x1f');var _0x4e5dd0=_0x416392[_0x3ffb('0x21')];var _0x1ff650=_0x2a5fe2?0x0:_0x20efe9[_0x3ffb('0x1e')];var _0x3afc66=_0x2a5fe2?_0x416392['count']:_0x20efe9[_0x3ffb('0x1e')]+_0x20efe9['limit'];var _0x2bab3e;if(_0x3afc66>=_0x4e5dd0){_0x3afc66=_0x4e5dd0;_0x2bab3e=0xc8;}else{_0x2bab3e=0xce;}_0x2dcc66[_0x3ffb('0x1c')](_0x2bab3e);return _0x2dcc66[_0x3ffb('0x22')](_0x3ffb('0x23'),_0x1ff650+'-'+_0x3afc66+'/'+_0x4e5dd0)['json'](_0x416392);}return null;};}function patchUpdates(_0xbc06c6){return function(_0x56eff8){try{jsonpatch[_0x3ffb('0x24')](_0x56eff8,_0xbc06c6,!![]);}catch(_0x4c30a9){return BPromise[_0x3ffb('0x25')](_0x4c30a9);}return _0x56eff8['save']();};}function saveUpdates(_0xf99640,_0x42004a){return function(_0x181204){if(_0x181204){return _0x181204[_0x3ffb('0x26')](_0xf99640)[_0x3ffb('0x27')](function(_0x98732e){return _0x98732e;});}return null;};}function removeEntity(_0x5ca5cb,_0x7e291d){return function(_0x251b98){if(_0x251b98){return _0x251b98[_0x3ffb('0x28')]()[_0x3ffb('0x27')](function(){_0x5ca5cb[_0x3ffb('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x577ec6,_0x4f3adb){return function(_0x29d98e){if(!_0x29d98e){_0x577ec6['sendStatus'](0x194);}return _0x29d98e;};}function handleError(_0xfa8b48,_0x107f8d){_0x107f8d=_0x107f8d||0x1f4;return function(_0x1cdee8){logger['error'](_0x1cdee8[_0x3ffb('0x29')]);if(_0x1cdee8['name']){delete _0x1cdee8[_0x3ffb('0x2a')];}_0xfa8b48[_0x3ffb('0x1c')](_0x107f8d)[_0x3ffb('0x2b')](_0x1cdee8);};}exports[_0x3ffb('0x2c')]=function(_0x43c269,_0x5a4f50){var _0x4ad9bd={},_0x3020e0={},_0x1944af={'count':0x0,'rows':[]};var _0xbc4c03=_[_0x3ffb('0x2d')](db[_0x3ffb('0x2e')]['rawAttributes'],function(_0x5ad14f){return{'name':_0x5ad14f[_0x3ffb('0x2f')],'type':_0x5ad14f['type'][_0x3ffb('0x30')]};});_0x3020e0['model']=_[_0x3ffb('0x2d')](_0xbc4c03,_0x3ffb('0x2a'));_0x3020e0['query']=_[_0x3ffb('0x31')](_0x43c269[_0x3ffb('0x32')]);_0x3020e0[_0x3ffb('0x33')]=_['intersection'](_0x3020e0[_0x3ffb('0x34')],_0x3020e0[_0x3ffb('0x32')]);_0x4ad9bd['attributes']=_[_0x3ffb('0x35')](_0x3020e0[_0x3ffb('0x34')],qs[_0x3ffb('0x36')](_0x43c269[_0x3ffb('0x32')]['fields']));_0x4ad9bd[_0x3ffb('0x37')]=_0x4ad9bd[_0x3ffb('0x37')][_0x3ffb('0x38')]?_0x4ad9bd[_0x3ffb('0x37')]:_0x3020e0[_0x3ffb('0x34')];if(!_0x43c269[_0x3ffb('0x32')][_0x3ffb('0x39')]('nolimit')){_0x4ad9bd[_0x3ffb('0x20')]=qs[_0x3ffb('0x20')](_0x43c269['query']['limit']);_0x4ad9bd[_0x3ffb('0x1e')]=qs[_0x3ffb('0x1e')](_0x43c269[_0x3ffb('0x32')][_0x3ffb('0x1e')]);}_0x4ad9bd[_0x3ffb('0x3a')]=qs['sort'](_0x43c269[_0x3ffb('0x32')][_0x3ffb('0x3b')]);_0x4ad9bd[_0x3ffb('0x3c')]=qs[_0x3ffb('0x33')](_[_0x3ffb('0x3d')](_0x43c269[_0x3ffb('0x32')],_0x3020e0[_0x3ffb('0x33')]),_0xbc4c03);if(_0x43c269[_0x3ffb('0x32')][_0x3ffb('0x3e')]){_0x4ad9bd[_0x3ffb('0x3c')]=_[_0x3ffb('0x3f')](_0x4ad9bd[_0x3ffb('0x3c')],{'$or':_['map'](_0xbc4c03,function(_0xf6723f){if(_0xf6723f['type']!==_0x3ffb('0x40')){var _0x5e0acd={};_0x5e0acd[_0xf6723f[_0x3ffb('0x2a')]]={'$like':'%'+_0x43c269[_0x3ffb('0x32')]['filter']+'%'};return _0x5e0acd;}})});}_0x4ad9bd=_[_0x3ffb('0x3f')]({},_0x4ad9bd,_0x43c269['options']);var _0x1101ad={'where':_0x4ad9bd[_0x3ffb('0x3c')]};return db[_0x3ffb('0x2e')]['count'](_0x1101ad)[_0x3ffb('0x27')](function(_0xa91ac9){_0x1944af['count']=_0xa91ac9;if(_0x43c269[_0x3ffb('0x32')]['includeAll']){_0x4ad9bd[_0x3ffb('0x41')]=[{'all':!![]}];}return db[_0x3ffb('0x2e')][_0x3ffb('0x42')](_0x4ad9bd);})[_0x3ffb('0x27')](function(_0xa9ea92){_0x1944af[_0x3ffb('0x43')]=_0xa9ea92;return _0x1944af;})[_0x3ffb('0x27')](respondWithFilteredResult(_0x5a4f50,_0x4ad9bd))[_0x3ffb('0x44')](handleError(_0x5a4f50,null));};exports[_0x3ffb('0x45')]=function(_0x21361d,_0x1d4bf1){var _0x1037fb={'raw':![],'where':{'id':_0x21361d[_0x3ffb('0x46')]['id']}},_0x1d5985={};_0x1d5985[_0x3ffb('0x34')]=_[_0x3ffb('0x31')](db[_0x3ffb('0x2e')][_0x3ffb('0x47')]);_0x1d5985[_0x3ffb('0x32')]=_[_0x3ffb('0x31')](_0x21361d[_0x3ffb('0x32')]);_0x1d5985[_0x3ffb('0x33')]=_[_0x3ffb('0x35')](_0x1d5985['model'],_0x1d5985[_0x3ffb('0x32')]);_0x1037fb['attributes']=_[_0x3ffb('0x35')](_0x1d5985[_0x3ffb('0x34')],qs[_0x3ffb('0x36')](_0x21361d[_0x3ffb('0x32')][_0x3ffb('0x36')]));_0x1037fb['attributes']=_0x1037fb[_0x3ffb('0x37')]['length']?_0x1037fb[_0x3ffb('0x37')]:_0x1d5985[_0x3ffb('0x34')];if(_0x21361d[_0x3ffb('0x32')][_0x3ffb('0x48')]){_0x1037fb['include']=[{'all':!![]}];}_0x1037fb=_[_0x3ffb('0x3f')]({},_0x1037fb,_0x21361d['options']);return db[_0x3ffb('0x2e')][_0x3ffb('0x49')](_0x1037fb)[_0x3ffb('0x27')](handleEntityNotFound(_0x1d4bf1,null))[_0x3ffb('0x27')](respondWithResult(_0x1d4bf1,null))[_0x3ffb('0x44')](handleError(_0x1d4bf1,null));};exports['create']=function(_0x556ec1,_0x2e4185){return db[_0x3ffb('0x2e')][_0x3ffb('0x4a')](_0x556ec1[_0x3ffb('0x4b')],{})[_0x3ffb('0x27')](respondWithResult(_0x2e4185,0xc9))[_0x3ffb('0x44')](handleError(_0x2e4185,null));};exports[_0x3ffb('0x26')]=function(_0xa4d121,_0x13b6ec){if(_0xa4d121[_0x3ffb('0x4b')]['id']){delete _0xa4d121[_0x3ffb('0x4b')]['id'];}return db[_0x3ffb('0x2e')][_0x3ffb('0x49')]({'where':{'id':_0xa4d121[_0x3ffb('0x46')]['id']}})[_0x3ffb('0x27')](handleEntityNotFound(_0x13b6ec,null))[_0x3ffb('0x27')](saveUpdates(_0xa4d121[_0x3ffb('0x4b')],null))[_0x3ffb('0x27')](respondWithResult(_0x13b6ec,null))[_0x3ffb('0x44')](handleError(_0x13b6ec,null));};exports[_0x3ffb('0x28')]=function(_0x89ab2b,_0x5ec499){return db[_0x3ffb('0x2e')][_0x3ffb('0x49')]({'where':{'id':_0x89ab2b[_0x3ffb('0x46')]['id']}})[_0x3ffb('0x27')](handleEntityNotFound(_0x5ec499,null))[_0x3ffb('0x27')](removeEntity(_0x5ec499,null))[_0x3ffb('0x44')](handleError(_0x5ec499,null));};exports[_0x3ffb('0x4c')]=function(_0x1baa76,_0x5c0dc4,_0x30fddb){var _0x515d48={};var _0x53101e={};var _0x5dd889;var _0x4e332d;return db['SugarcrmAccount'][_0x3ffb('0x4d')]({'where':{'id':_0x1baa76[_0x3ffb('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c0dc4,null))[_0x3ffb('0x27')](function(_0x454197){if(_0x454197){_0x5dd889=_0x454197;_0x53101e[_0x3ffb('0x34')]=_[_0x3ffb('0x31')](db[_0x3ffb('0x4e')][_0x3ffb('0x47')]);_0x53101e[_0x3ffb('0x32')]=_[_0x3ffb('0x31')](_0x1baa76[_0x3ffb('0x32')]);_0x53101e['filters']=_[_0x3ffb('0x35')](_0x53101e['model'],_0x53101e[_0x3ffb('0x32')]);_0x515d48[_0x3ffb('0x37')]=_[_0x3ffb('0x35')](_0x53101e[_0x3ffb('0x34')],qs[_0x3ffb('0x36')](_0x1baa76['query'][_0x3ffb('0x36')]));_0x515d48['attributes']=_0x515d48['attributes'][_0x3ffb('0x38')]?_0x515d48[_0x3ffb('0x37')]:_0x53101e[_0x3ffb('0x34')];_0x515d48['order']=qs[_0x3ffb('0x3b')](_0x1baa76[_0x3ffb('0x32')]['sort']);_0x515d48[_0x3ffb('0x3c')]=qs[_0x3ffb('0x33')](_[_0x3ffb('0x3d')](_0x1baa76[_0x3ffb('0x32')],_0x53101e['filters']));if(_0x1baa76[_0x3ffb('0x32')][_0x3ffb('0x3e')]){_0x515d48[_0x3ffb('0x3c')]=_[_0x3ffb('0x3f')](_0x515d48['where'],{'$or':_[_0x3ffb('0x2d')](_0x515d48[_0x3ffb('0x37')],function(_0x2bcb42){var _0x519540={};_0x519540[_0x2bcb42]={'$like':'%'+_0x1baa76[_0x3ffb('0x32')]['filter']+'%'};return _0x519540;})});}_0x515d48=_['merge']({},_0x515d48,_0x1baa76[_0x3ffb('0x4f')]);return _0x5dd889[_0x3ffb('0x4c')](_0x515d48);}})[_0x3ffb('0x27')](function(_0x370eca){if(_0x370eca){_0x4e332d=_0x370eca[_0x3ffb('0x38')];if(!_0x1baa76['query'][_0x3ffb('0x39')](_0x3ffb('0x50'))){_0x515d48['limit']=qs[_0x3ffb('0x20')](_0x1baa76[_0x3ffb('0x32')][_0x3ffb('0x20')]);_0x515d48[_0x3ffb('0x1e')]=qs['offset'](_0x1baa76['query'][_0x3ffb('0x1e')]);}return _0x5dd889[_0x3ffb('0x4c')](_0x515d48);}})['then'](function(_0x3d6b21){if(_0x3d6b21){return _0x3d6b21?{'count':_0x4e332d,'rows':_0x3d6b21}:null;}})['then'](respondWithResult(_0x5c0dc4,null))[_0x3ffb('0x44')](handleError(_0x5c0dc4,null));};exports['addConfiguration']=function(_0xf5189e,_0x3bf1f7,_0x2e2f2a){if(_0xf5189e['body']['id']){delete _0xf5189e[_0x3ffb('0x4b')]['id'];}return db[_0x3ffb('0x2e')]['findOne']({'where':{'id':_0xf5189e[_0x3ffb('0x46')]['id']}})['then'](handleEntityNotFound(_0x3bf1f7,null))[_0x3ffb('0x27')](function(_0x265bad){if(_0x265bad){_0xf5189e[_0x3ffb('0x4b')][_0x3ffb('0x51')]=_0x265bad['id'];_0xf5189e[_0x3ffb('0x4b')][_0x3ffb('0x52')]=integrations['getSubjects'](_0xf5189e[_0x3ffb('0x4b')]['channel'],_0xf5189e['body'][_0x3ffb('0x53')]);_0xf5189e[_0x3ffb('0x4b')][_0x3ffb('0x54')]=integrations['getDescriptions'](_0xf5189e[_0x3ffb('0x4b')]['channel'],_0xf5189e['body'][_0x3ffb('0x53')]);return db[_0x3ffb('0x4e')]['create'](_0xf5189e[_0x3ffb('0x4b')],{'include':[{'model':db[_0x3ffb('0x55')],'as':'Subjects'},{'model':db[_0x3ffb('0x55')],'as':_0x3ffb('0x54')}]});}return null;})[_0x3ffb('0x27')](respondWithResult(_0x3bf1f7,null))[_0x3ffb('0x44')](handleError(_0x3bf1f7,null));};exports[_0x3ffb('0x56')]=function(_0x8a6137,_0x5c3f22,_0x2a537a){var _0x3d2170='';var _0x50c8c1=['id',_0x3ffb('0x2a'),_0x3ffb('0x57'),_0x3ffb('0x58'),'description',_0x3ffb('0x59'),_0x3ffb('0x5a'),_0x3ffb('0x5b'),'parent_id',_0x3ffb('0x5c'),_0x3ffb('0x5d'),_0x3ffb('0x5e')];return db[_0x3ffb('0x2e')]['findOne']({'where':{'id':_0x8a6137['params']['id']},'attributes':['id','username',_0x3ffb('0x5f'),'remoteUri']})['then'](handleEntityNotFound(_0x5c3f22,null))[_0x3ffb('0x27')](function(_0x43e51b){if(_0x43e51b){_0x3d2170=_0x43e51b[_0x3ffb('0x60')];var _0x292628=_0x3d2170[_0x3ffb('0x61')](-0x1);if(_0x292628==='/'){_0x3d2170=_0x3d2170['substring'](0x0,_0x3d2170['lastIndexOf'](_0x292628));}return rp({'method':_0x3ffb('0x62'),'uri':util[_0x3ffb('0x63')]('%s%s',_0x3d2170,_0x3ffb('0x64')),'json':!![],'form':{'method':_0x3ffb('0x65'),'input_type':_0x3ffb('0x66'),'response_type':_0x3ffb('0x66'),'rest_data':JSON[_0x3ffb('0x67')]({'user_auth':{'user_name':_0x43e51b['username'],'password':_0x43e51b[_0x3ffb('0x5f')],'encryption':'PLAIN'},'application':_0x3ffb('0x68')})}});}})[_0x3ffb('0x27')](function(_0x527bbc){if(_0x527bbc&&_0x527bbc['name']!==_0x3ffb('0x69')&&_0x527bbc['name']!==_0x3ffb('0x6a')){return rp({'method':_0x3ffb('0x62'),'uri':util[_0x3ffb('0x63')](_0x3ffb('0x6b'),_0x3d2170,_0x3ffb('0x64')),'json':!![],'form':{'method':_0x3ffb('0x6c'),'input_type':_0x3ffb('0x66'),'response_type':_0x3ffb('0x66'),'rest_data':JSON['stringify']({'session':_0x527bbc['id'],'module_name':'Calls'})}})['then'](function(_0x359669){if(_0x359669){var _0x12d1fa=_['values'](_0x359669['module_fields']);_[_0x3ffb('0x6d')](_0x12d1fa,function(_0x5011e8){return _0x50c8c1[_0x3ffb('0x6e')](_0x5011e8[_0x3ffb('0x2a')]);});return{'count':_0x12d1fa[_0x3ffb('0x38')],'rows':_[_0x3ffb('0x2d')](_0x12d1fa,function(_0x4c4ff5){return{'id':_0x4c4ff5[_0x3ffb('0x2a')],'name':_0x4c4ff5[_0x3ffb('0x6f')],'custom':_[_0x3ffb('0x70')](_0x4c4ff5[_0x3ffb('0x2a')],'_c')?!![]:![],'options':_0x4c4ff5[_0x3ffb('0x4f')]?_[_0x3ffb('0x2d')](_['values'](_0x4c4ff5['options']),function(_0x1f9c14){return{'name':_0x1f9c14[_0x3ffb('0x71')],'value':_0x1f9c14[_0x3ffb('0x2a')]};}):[]};})};}})[_0x3ffb('0x27')](respondWithResult(_0x5c3f22,null))[_0x3ffb('0x44')](function(_0x1ddae9){var _0x107678=_0x8a6137[_0x3ffb('0x32')][_0x3ffb('0x72')]?0x1f4:_0x1ddae9[_0x3ffb('0x73')]||0x1f4;logger[_0x3ffb('0x74')](_0x3ffb('0x75'),_0x3ffb('0x56'),_0x107678,JSON[_0x3ffb('0x67')](_0x1ddae9));delete _0x1ddae9['name'];if(_0x107678===0x191){_0x107678=0x190;}_0x5c3f22[_0x3ffb('0x1c')](_0x107678)[_0x3ffb('0x2b')](_0x8a6137[_0x3ffb('0x32')][_0x3ffb('0x72')]?{'message':_0x3ffb('0x76'),'statusCode':_0x1ddae9['statusCode']}:_0x1ddae9);});}else{var _0xd5bf51=0x1f4;_0x5c3f22['status'](_0xd5bf51)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 0956b23..d439775 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 _0x17b3=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts'];(function(_0x3ff9bc,_0x51778d){var _0x4017d6=function(_0x57bb0a){while(--_0x57bb0a){_0x3ff9bc['push'](_0x3ff9bc['shift']());}};_0x4017d6(++_0x51778d);}(_0x17b3,0xd1));var _0x317b=function(_0x23cf4c,_0x5bf068){_0x23cf4c=_0x23cf4c-0x0;var _0x591a89=_0x17b3[_0x23cf4c];return _0x591a89;};'use strict';var _=require('lodash');var util=require(_0x317b('0x0'));var logger=require(_0x317b('0x1'))('api');var moment=require(_0x317b('0x2'));var BPromise=require('bluebird');var rp=require(_0x317b('0x3'));var fs=require('fs');var path=require(_0x317b('0x4'));var rimraf=require(_0x317b('0x5'));var config=require(_0x317b('0x6'));var attributes=require(_0x317b('0x7'));var integrations=require(_0x317b('0x8'));module[_0x317b('0x9')]=function(_0x165d6a,_0x6f5419){return _0x165d6a['define']('SugarcrmAccount',attributes,{'tableName':_0x317b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf188=['request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','moment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf188,0x1f1));var _0x8f18=function(_0x2a38f1,_0x93f4d4){_0x2a38f1=_0x2a38f1-0x0;var _0x4268e0=_0xf188[_0x2a38f1];return _0x4268e0;};'use strict';var _=require(_0x8f18('0x0'));var util=require(_0x8f18('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f18('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f18('0x3'));var fs=require('fs');var path=require(_0x8f18('0x4'));var rimraf=require('rimraf');var config=require(_0x8f18('0x5'));var attributes=require(_0x8f18('0x6'));var integrations=require(_0x8f18('0x7'));module[_0x8f18('0x8')]=function(_0x1e447d,_0x15f458){return _0x1e447d['define'](_0x8f18('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 956533c..34a1bc4 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 _0xfe95=['request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','options','raw','where','attributes','limit','include','model','map','GetSugarcrmAccount','SugarcrmAccount','find','ShowSugarcrmAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x386160,_0x2be73b){var _0x3b1f0a=function(_0x21e718){while(--_0x21e718){_0x386160['push'](_0x386160['shift']());}};_0x3b1f0a(++_0x2be73b);}(_0xfe95,0xea));var _0x5fe9=function(_0x10e1b7,_0x28e02a){_0x10e1b7=_0x10e1b7-0x0;var _0x469e84=_0xfe95[_0x10e1b7];return _0x469e84;};'use strict';var _=require(_0x5fe9('0x0'));var util=require(_0x5fe9('0x1'));var moment=require(_0x5fe9('0x2'));var BPromise=require(_0x5fe9('0x3'));var rs=require(_0x5fe9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fe9('0x5'))['db'];var utils=require(_0x5fe9('0x6'));var logger=require(_0x5fe9('0x7'))(_0x5fe9('0x8'));var config=require(_0x5fe9('0x9'));var jayson=require(_0x5fe9('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x467e25,_0x139d94,_0x5aafaf){return new BPromise(function(_0x1f69e8,_0x307194){return client[_0x5fe9('0xb')](_0x467e25,_0x5aafaf)[_0x5fe9('0xc')](function(_0x2ce8ab){logger['info'](_0x5fe9('0xd'),_0x139d94,_0x5fe9('0xe'));logger[_0x5fe9('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x139d94,_0x5fe9('0xe'),JSON[_0x5fe9('0x10')](_0x2ce8ab));if(_0x2ce8ab[_0x5fe9('0x11')]){if(_0x2ce8ab['error'][_0x5fe9('0x12')]===0x1f4){logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x2ce8ab[_0x5fe9('0x11')][_0x5fe9('0x13')]);return _0x307194(_0x2ce8ab['error'][_0x5fe9('0x13')]);}logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x2ce8ab[_0x5fe9('0x11')]['message']);return _0x1f69e8(_0x2ce8ab['error'][_0x5fe9('0x13')]);}else{logger[_0x5fe9('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x139d94,_0x5fe9('0xe'));_0x1f69e8(_0x2ce8ab[_0x5fe9('0x15')][_0x5fe9('0x13')]);}})[_0x5fe9('0x16')](function(_0x251743){logger[_0x5fe9('0x11')](_0x5fe9('0xd'),_0x139d94,_0x251743);_0x307194(_0x251743);});});}exports['GetSugarcrmAccount']=function(_0x586b2d){var _0x51cbd4=this;return new Promise(function(_0xfab1f4,_0x5a9520){return db['SugarcrmAccount']['findAll']({'raw':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x18')]===undefined?!![]:![]:!![],'where':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x19')]||null:null,'attributes':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1a')]||null:null,'limit':_0x586b2d[_0x5fe9('0x17')]?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1b')]||null:null,'include':_0x586b2d['options']?_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1c')]?_['map'](_0x586b2d[_0x5fe9('0x17')][_0x5fe9('0x1c')],function(_0x276ecf){return{'model':db[_0x276ecf[_0x5fe9('0x1d')]],'as':_0x276ecf['as'],'attributes':_0x276ecf[_0x5fe9('0x1a')],'include':_0x276ecf[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x276ecf[_0x5fe9('0x1c')],function(_0x5e27aa){return{'model':db[_0x5e27aa['model']],'as':_0x5e27aa['as'],'attributes':_0x5e27aa[_0x5fe9('0x1a')],'include':_0x5e27aa[_0x5fe9('0x1c')]?_['map'](_0x5e27aa['include'],function(_0x44ae4c){return{'model':db[_0x44ae4c['model']],'as':_0x44ae4c['as'],'attributes':_0x44ae4c[_0x5fe9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5fe9('0xc')](function(_0x2a30b){logger[_0x5fe9('0x14')](_0x5fe9('0x1f'),_0x586b2d);logger[_0x5fe9('0xf')]('GetSugarcrmAccount',_0x586b2d,JSON[_0x5fe9('0x10')](_0x2a30b));_0xfab1f4(_0x2a30b);})[_0x5fe9('0x16')](function(_0x551bba){logger['error'](_0x5fe9('0x1f'),_0x551bba[_0x5fe9('0x13')],_0x586b2d);_0x5a9520(_0x51cbd4[_0x5fe9('0x11')](0x1f4,_0x551bba[_0x5fe9('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x1b6724){var _0x253d84=this;return new Promise(function(_0x122739,_0x24e016){return db[_0x5fe9('0x20')][_0x5fe9('0x21')]({'raw':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')][_0x5fe9('0x18')]===undefined?!![]:![]:!![],'where':_0x1b6724['options']?_0x1b6724['options'][_0x5fe9('0x19')]||null:null,'attributes':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')]['attributes']||null:null,'include':_0x1b6724[_0x5fe9('0x17')]?_0x1b6724[_0x5fe9('0x17')]['include']?_[_0x5fe9('0x1e')](_0x1b6724['options'][_0x5fe9('0x1c')],function(_0x89840e){return{'model':db[_0x89840e[_0x5fe9('0x1d')]],'as':_0x89840e['as'],'attributes':_0x89840e['attributes'],'include':_0x89840e[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x89840e['include'],function(_0x2f4331){return{'model':db[_0x2f4331[_0x5fe9('0x1d')]],'as':_0x2f4331['as'],'attributes':_0x2f4331[_0x5fe9('0x1a')],'include':_0x2f4331[_0x5fe9('0x1c')]?_[_0x5fe9('0x1e')](_0x2f4331['include'],function(_0xfb074a){return{'model':db[_0xfb074a[_0x5fe9('0x1d')]],'as':_0xfb074a['as'],'attributes':_0xfb074a[_0x5fe9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x321887){logger[_0x5fe9('0x14')](_0x5fe9('0x22'),_0x1b6724);logger[_0x5fe9('0xf')](_0x5fe9('0x22'),_0x1b6724,JSON[_0x5fe9('0x10')](_0x321887));_0x122739(_0x321887);})[_0x5fe9('0x16')](function(_0x1f816d){logger[_0x5fe9('0x11')]('ShowSugarcrmAccount',_0x1f816d[_0x5fe9('0x13')],_0x1b6724);_0x24e016(_0x253d84[_0x5fe9('0x11')](0x1f4,_0x1f816d[_0x5fe9('0x13')]));});});}; \ No newline at end of file +var _0x8714=['model','ShowSugarcrmAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','map','include','attributes'];(function(_0x4e2266,_0x3eab11){var _0x5df6ea=function(_0x3fb723){while(--_0x3fb723){_0x4e2266['push'](_0x4e2266['shift']());}};_0x5df6ea(++_0x3eab11);}(_0x8714,0xc9));var _0x4871=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8714[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x4871('0x0'));var util=require(_0x4871('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4871('0x2'));var fs=require('fs');var Redis=require(_0x4871('0x3'));var db=require(_0x4871('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4871('0x5'));var config=require(_0x4871('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4871('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e30d1,_0x3959fa,_0x52c524){return new BPromise(function(_0x97dcf1,_0xe8071e){return client[_0x4871('0x8')](_0x3e30d1,_0x52c524)[_0x4871('0x9')](function(_0x239459){logger[_0x4871('0xa')](_0x4871('0xb'),_0x3959fa,_0x4871('0xc'));logger[_0x4871('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3959fa,'request\x20sent',JSON[_0x4871('0xe')](_0x239459));if(_0x239459[_0x4871('0xf')]){if(_0x239459[_0x4871('0xf')][_0x4871('0x10')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x3959fa,_0x239459['error'][_0x4871('0x11')]);return _0xe8071e(_0x239459[_0x4871('0xf')][_0x4871('0x11')]);}logger[_0x4871('0xf')](_0x4871('0xb'),_0x3959fa,_0x239459[_0x4871('0xf')][_0x4871('0x11')]);return _0x97dcf1(_0x239459[_0x4871('0xf')][_0x4871('0x11')]);}else{logger[_0x4871('0xa')](_0x4871('0xb'),_0x3959fa,_0x4871('0xc'));_0x97dcf1(_0x239459[_0x4871('0x12')][_0x4871('0x11')]);}})[_0x4871('0x13')](function(_0x16cf07){logger[_0x4871('0xf')](_0x4871('0xb'),_0x3959fa,_0x16cf07);_0xe8071e(_0x16cf07);});});}exports[_0x4871('0x14')]=function(_0x1d60ff){var _0x2f46b5=this;return new Promise(function(_0x2ec875,_0x511413){return db[_0x4871('0x15')][_0x4871('0x16')]({'raw':_0x1d60ff[_0x4871('0x17')]?_0x1d60ff['options'][_0x4871('0x18')]===undefined?!![]:![]:!![],'where':_0x1d60ff['options']?_0x1d60ff[_0x4871('0x17')][_0x4871('0x19')]||null:null,'attributes':_0x1d60ff[_0x4871('0x17')]?_0x1d60ff['options']['attributes']||null:null,'limit':_0x1d60ff[_0x4871('0x17')]?_0x1d60ff['options'][_0x4871('0x1a')]||null:null,'include':_0x1d60ff[_0x4871('0x17')]?_0x1d60ff['options']['include']?_[_0x4871('0x1b')](_0x1d60ff[_0x4871('0x17')][_0x4871('0x1c')],function(_0x4bdd92){return{'model':db[_0x4bdd92['model']],'as':_0x4bdd92['as'],'attributes':_0x4bdd92[_0x4871('0x1d')],'include':_0x4bdd92[_0x4871('0x1c')]?_[_0x4871('0x1b')](_0x4bdd92[_0x4871('0x1c')],function(_0xf744e6){return{'model':db[_0xf744e6[_0x4871('0x1e')]],'as':_0xf744e6['as'],'attributes':_0xf744e6[_0x4871('0x1d')],'include':_0xf744e6['include']?_[_0x4871('0x1b')](_0xf744e6[_0x4871('0x1c')],function(_0x4d0599){return{'model':db[_0x4d0599[_0x4871('0x1e')]],'as':_0x4d0599['as'],'attributes':_0x4d0599[_0x4871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4871('0x9')](function(_0xb010a6){logger[_0x4871('0xa')](_0x4871('0x14'),_0x1d60ff);logger[_0x4871('0xd')]('GetSugarcrmAccount',_0x1d60ff,JSON[_0x4871('0xe')](_0xb010a6));_0x2ec875(_0xb010a6);})[_0x4871('0x13')](function(_0x4c07cd){logger['error'](_0x4871('0x14'),_0x4c07cd[_0x4871('0x11')],_0x1d60ff);_0x511413(_0x2f46b5['error'](0x1f4,_0x4c07cd[_0x4871('0x11')]));});});};exports[_0x4871('0x1f')]=function(_0x10fde0){var _0x2f401f=this;return new Promise(function(_0x2263ef,_0x10950c){return db[_0x4871('0x15')][_0x4871('0x20')]({'raw':_0x10fde0['options']?_0x10fde0[_0x4871('0x17')][_0x4871('0x18')]===undefined?!![]:![]:!![],'where':_0x10fde0[_0x4871('0x17')]?_0x10fde0['options'][_0x4871('0x19')]||null:null,'attributes':_0x10fde0[_0x4871('0x17')]?_0x10fde0['options']['attributes']||null:null,'include':_0x10fde0[_0x4871('0x17')]?_0x10fde0[_0x4871('0x17')][_0x4871('0x1c')]?_['map'](_0x10fde0[_0x4871('0x17')][_0x4871('0x1c')],function(_0x4a1073){return{'model':db[_0x4a1073[_0x4871('0x1e')]],'as':_0x4a1073['as'],'attributes':_0x4a1073['attributes'],'include':_0x4a1073[_0x4871('0x1c')]?_['map'](_0x4a1073['include'],function(_0x2efb8f){return{'model':db[_0x2efb8f[_0x4871('0x1e')]],'as':_0x2efb8f['as'],'attributes':_0x2efb8f['attributes'],'include':_0x2efb8f[_0x4871('0x1c')]?_[_0x4871('0x1b')](_0x2efb8f[_0x4871('0x1c')],function(_0x36ff7e){return{'model':db[_0x36ff7e[_0x4871('0x1e')]],'as':_0x36ff7e['as'],'attributes':_0x36ff7e[_0x4871('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4871('0x9')](function(_0x2137db){logger[_0x4871('0xa')](_0x4871('0x1f'),_0x10fde0);logger['debug'](_0x4871('0x1f'),_0x10fde0,JSON[_0x4871('0xe')](_0x2137db));_0x2263ef(_0x2137db);})['catch'](function(_0x2d4964){logger[_0x4871('0xf')](_0x4871('0x1f'),_0x2d4964[_0x4871('0x11')],_0x10fde0);_0x10950c(_0x2f401f['error'](0x1f4,_0x2d4964[_0x4871('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 06935d4..1c56713 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 _0x032d=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show'];(function(_0x18a1ed,_0x5c34cd){var _0x2178d2=function(_0xeb9f75){while(--_0xeb9f75){_0x18a1ed['push'](_0x18a1ed['shift']());}};_0x2178d2(++_0x5c34cd);}(_0x032d,0x145));var _0xd032=function(_0x348ecf,_0x5d1f68){_0x348ecf=_0x348ecf-0x0;var _0xb3f3c4=_0x032d[_0x348ecf];return _0xb3f3c4;};'use strict';var multer=require(_0xd032('0x0'));var util=require(_0xd032('0x1'));var path=require(_0xd032('0x2'));var timeout=require(_0xd032('0x3'));var express=require(_0xd032('0x4'));var router=express[_0xd032('0x5')]();var fs_extra=require(_0xd032('0x6'));var auth=require(_0xd032('0x7'));var interaction=require(_0xd032('0x8'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0xd032('0x9')]('/',auth['isAuthenticated'](),controller[_0xd032('0xa')]);router[_0xd032('0x9')]('/:id',auth[_0xd032('0xb')](),controller[_0xd032('0xc')]);router[_0xd032('0x9')](_0xd032('0xd'),auth[_0xd032('0xb')](),controller['getFields']);router['get'](_0xd032('0xe'),auth[_0xd032('0xb')](),controller[_0xd032('0xf')]);router[_0xd032('0x9')](_0xd032('0x10'),auth[_0xd032('0xb')](),controller[_0xd032('0x11')]);router[_0xd032('0x12')]('/',auth[_0xd032('0xb')](),controller[_0xd032('0x13')]);router[_0xd032('0x14')](_0xd032('0x15'),auth['isAuthenticated'](),controller[_0xd032('0x16')]);router[_0xd032('0x17')](_0xd032('0x15'),auth['isAuthenticated'](),controller[_0xd032('0x18')]);module[_0xd032('0x19')]=router; \ No newline at end of file +var _0xce9a=['isAuthenticated','index','/:id/subjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0xce9a,0x186));var _0xace9=function(_0x1384d5,_0x2034ae){_0x1384d5=_0x1384d5-0x0;var _0x342d56=_0xce9a[_0x1384d5];return _0x342d56;};'use strict';var multer=require(_0xace9('0x0'));var util=require(_0xace9('0x1'));var path=require(_0xace9('0x2'));var timeout=require('connect-timeout');var express=require(_0xace9('0x3'));var router=express[_0xace9('0x4')]();var fs_extra=require(_0xace9('0x5'));var auth=require(_0xace9('0x6'));var interaction=require(_0xace9('0x7'));var config=require(_0xace9('0x8'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xace9('0x9')]('/',auth[_0xace9('0xa')](),controller[_0xace9('0xb')]);router[_0xace9('0x9')]('/:id',auth[_0xace9('0xa')](),controller['show']);router[_0xace9('0x9')]('/:id/fields',auth[_0xace9('0xa')](),controller['getFields']);router[_0xace9('0x9')](_0xace9('0xc'),auth[_0xace9('0xa')](),controller['getSubjects']);router[_0xace9('0x9')](_0xace9('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xace9('0xe')]('/',auth[_0xace9('0xa')](),controller['create']);router[_0xace9('0xf')]('/:id',auth[_0xace9('0xa')](),controller[_0xace9('0x10')]);router[_0xace9('0x11')]('/:id',auth[_0xace9('0xa')](),controller[_0xace9('0x12')]);module[_0xace9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6594f6c..7ca1034 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 _0x0ef2=['sequelize','exports','STRING'];(function(_0x222140,_0x555896){var _0x3b3de6=function(_0x14d25b){while(--_0x14d25b){_0x222140['push'](_0x222140['shift']());}};_0x3b3de6(++_0x555896);}(_0x0ef2,0x108));var _0x20ef=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x0ef2[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x20ef('0x0'));module[_0x20ef('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x20ef('0x2')]}}; \ No newline at end of file +var _0xaf4d=['STRING','sequelize','exports'];(function(_0x3109dd,_0x243a6e){var _0x2fbf89=function(_0x433af2){while(--_0x433af2){_0x3109dd['push'](_0x3109dd['shift']());}};_0x2fbf89(++_0x243a6e);}(_0xaf4d,0x184));var _0xdaf4=function(_0x5181da,_0x4e2b9e){_0x5181da=_0x5181da-0x0;var _0x1efe8a=_0xaf4d[_0x5181da];return _0x1efe8a;};'use strict';var Sequelize=require(_0xdaf4('0x0'));module[_0xdaf4('0x1')]={'name':{'type':Sequelize[_0xdaf4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 4aa9ba5..471ac96 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 _0xa8d8=['length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','find','create','body','destroy','findOne','SugarcrmField','pick','hasOwnProperty','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query'];(function(_0x4c66f1,_0xd2975d){var _0x2c6414=function(_0x1466ac){while(--_0x1466ac){_0x4c66f1['push'](_0x4c66f1['shift']());}};_0x2c6414(++_0xd2975d);}(_0xa8d8,0x1b3));var _0x8a8d=function(_0xb260f8,_0xc008c5){_0xb260f8=_0xb260f8-0x0;var _0x63096d=_0xa8d8[_0xb260f8];return _0x63096d;};'use strict';var emlformat=require(_0x8a8d('0x0'));var rimraf=require(_0x8a8d('0x1'));var zipdir=require(_0x8a8d('0x2'));var jsonpatch=require(_0x8a8d('0x3'));var rp=require(_0x8a8d('0x4'));var moment=require(_0x8a8d('0x5'));var BPromise=require(_0x8a8d('0x6'));var Mustache=require(_0x8a8d('0x7'));var util=require(_0x8a8d('0x8'));var path=require(_0x8a8d('0x9'));var sox=require('sox');var csv=require(_0x8a8d('0xa'));var ejs=require(_0x8a8d('0xb'));var fs=require('fs');var fs_extra=require(_0x8a8d('0xc'));var _=require(_0x8a8d('0xd'));var squel=require(_0x8a8d('0xe'));var crypto=require('crypto');var jsforce=require(_0x8a8d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8a8d('0xa'));var querystring=require(_0x8a8d('0x10'));var Papa=require(_0x8a8d('0x11'));var Redis=require(_0x8a8d('0x12'));var authService=require(_0x8a8d('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8a8d('0x14'));var logger=require(_0x8a8d('0x15'))(_0x8a8d('0x16'));var utils=require(_0x8a8d('0x17'));var config=require(_0x8a8d('0x18'));var licenseUtil=require(_0x8a8d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5362c7,_0x5124c0){_0x5124c0=_0x5124c0||0xcc;return function(_0x7daefd){if(_0x7daefd){return _0x5362c7[_0x8a8d('0x1a')](_0x5124c0);}return _0x5362c7['status'](_0x5124c0)[_0x8a8d('0x1b')]();};}function respondWithResult(_0x2b0ab5,_0x9ac4be){_0x9ac4be=_0x9ac4be||0xc8;return function(_0x281625){if(_0x281625){return _0x2b0ab5['status'](_0x9ac4be)['json'](_0x281625);}};}function respondWithFilteredResult(_0x1857bf,_0x5d25a4){return function(_0x48b11a){if(_0x48b11a){var _0x585cfd=typeof _0x5d25a4[_0x8a8d('0x1c')]===_0x8a8d('0x1d')&&typeof _0x5d25a4[_0x8a8d('0x1e')]===_0x8a8d('0x1d');var _0x4221f2=_0x48b11a[_0x8a8d('0x1f')];var _0x12ccff=_0x585cfd?0x0:_0x5d25a4[_0x8a8d('0x1c')];var _0x4f2cfe=_0x585cfd?_0x48b11a[_0x8a8d('0x1f')]:_0x5d25a4[_0x8a8d('0x1c')]+_0x5d25a4['limit'];var _0x3c22f1;if(_0x4f2cfe>=_0x4221f2){_0x4f2cfe=_0x4221f2;_0x3c22f1=0xc8;}else{_0x3c22f1=0xce;}_0x1857bf[_0x8a8d('0x20')](_0x3c22f1);return _0x1857bf[_0x8a8d('0x21')](_0x8a8d('0x22'),_0x12ccff+'-'+_0x4f2cfe+'/'+_0x4221f2)['json'](_0x48b11a);}return null;};}function patchUpdates(_0x5d7ed1){return function(_0x304bdf){try{jsonpatch[_0x8a8d('0x23')](_0x304bdf,_0x5d7ed1,!![]);}catch(_0x11390f){return BPromise[_0x8a8d('0x24')](_0x11390f);}return _0x304bdf[_0x8a8d('0x25')]();};}function saveUpdates(_0x164748,_0x11ea58){return function(_0x1fd77d){if(_0x1fd77d){return _0x1fd77d[_0x8a8d('0x26')](_0x164748)[_0x8a8d('0x27')](function(_0x3fae){return _0x3fae;});}return null;};}function removeEntity(_0x1b7df7,_0x40c448){return function(_0xffb0bb){if(_0xffb0bb){return _0xffb0bb['destroy']()[_0x8a8d('0x27')](function(){_0x1b7df7[_0x8a8d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x137e99,_0x52230e){return function(_0x1d23e6){if(!_0x1d23e6){_0x137e99['sendStatus'](0x194);}return _0x1d23e6;};}function handleError(_0x2b20c4,_0xf27709){_0xf27709=_0xf27709||0x1f4;return function(_0x3d3caf){logger[_0x8a8d('0x28')](_0x3d3caf[_0x8a8d('0x29')]);if(_0x3d3caf[_0x8a8d('0x2a')]){delete _0x3d3caf[_0x8a8d('0x2a')];}_0x2b20c4['status'](_0xf27709)[_0x8a8d('0x2b')](_0x3d3caf);};}exports['index']=function(_0x33742f,_0x317a7e){var _0x1db47f={},_0x29cd0b={},_0x12265e={'count':0x0,'rows':[]};var _0x5aaee7=_[_0x8a8d('0x2c')](db[_0x8a8d('0x2d')][_0x8a8d('0x2e')],function(_0x5e3f41){return{'name':_0x5e3f41[_0x8a8d('0x2f')],'type':_0x5e3f41[_0x8a8d('0x30')][_0x8a8d('0x31')]};});_0x29cd0b[_0x8a8d('0x32')]=_[_0x8a8d('0x2c')](_0x5aaee7,_0x8a8d('0x2a'));_0x29cd0b['query']=_[_0x8a8d('0x33')](_0x33742f['query']);_0x29cd0b[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x29cd0b[_0x8a8d('0x32')],_0x29cd0b['query']);_0x1db47f[_0x8a8d('0x36')]=_[_0x8a8d('0x35')](_0x29cd0b['model'],qs[_0x8a8d('0x37')](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0x1db47f[_0x8a8d('0x36')]=_0x1db47f[_0x8a8d('0x36')][_0x8a8d('0x39')]?_0x1db47f[_0x8a8d('0x36')]:_0x29cd0b[_0x8a8d('0x32')];if(!_0x33742f[_0x8a8d('0x38')]['hasOwnProperty'](_0x8a8d('0x3a'))){_0x1db47f['limit']=qs['limit'](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x1e')]);_0x1db47f[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}_0x1db47f[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x33742f[_0x8a8d('0x38')]['sort']);_0x1db47f[_0x8a8d('0x3d')]=qs[_0x8a8d('0x34')](_['pick'](_0x33742f[_0x8a8d('0x38')],_0x29cd0b[_0x8a8d('0x34')]),_0x5aaee7);if(_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0x1db47f[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0x1db47f[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x5aaee7,function(_0xc8be8b){if(_0xc8be8b[_0x8a8d('0x30')]!==_0x8a8d('0x40')){var _0x1b9ab8={};_0x1b9ab8[_0xc8be8b[_0x8a8d('0x2a')]]={'$like':'%'+_0x33742f[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x1b9ab8;}})});}_0x1db47f=_[_0x8a8d('0x3f')]({},_0x1db47f,_0x33742f[_0x8a8d('0x41')]);var _0x4e06ca={'where':_0x1db47f['where']};return db[_0x8a8d('0x2d')][_0x8a8d('0x1f')](_0x4e06ca)['then'](function(_0x523e7a){_0x12265e[_0x8a8d('0x1f')]=_0x523e7a;if(_0x33742f[_0x8a8d('0x38')]['includeAll']){_0x1db47f['include']=[{'all':!![]}];}return db[_0x8a8d('0x2d')][_0x8a8d('0x42')](_0x1db47f);})[_0x8a8d('0x27')](function(_0x89138d){_0x12265e[_0x8a8d('0x43')]=_0x89138d;return _0x12265e;})[_0x8a8d('0x27')](respondWithFilteredResult(_0x317a7e,_0x1db47f))[_0x8a8d('0x44')](handleError(_0x317a7e,null));};exports['show']=function(_0x5f346d,_0x1567ba){var _0x1ba56e={'raw':![],'where':{'id':_0x5f346d[_0x8a8d('0x45')]['id']}},_0x5e4615={};_0x5e4615[_0x8a8d('0x32')]=_[_0x8a8d('0x33')](db[_0x8a8d('0x2d')][_0x8a8d('0x2e')]);_0x5e4615['query']=_[_0x8a8d('0x33')](_0x5f346d['query']);_0x5e4615['filters']=_[_0x8a8d('0x35')](_0x5e4615[_0x8a8d('0x32')],_0x5e4615['query']);_0x1ba56e[_0x8a8d('0x36')]=_[_0x8a8d('0x35')](_0x5e4615[_0x8a8d('0x32')],qs['fields'](_0x5f346d[_0x8a8d('0x38')]['fields']));_0x1ba56e[_0x8a8d('0x36')]=_0x1ba56e['attributes'][_0x8a8d('0x39')]?_0x1ba56e['attributes']:_0x5e4615[_0x8a8d('0x32')];if(_0x5f346d[_0x8a8d('0x38')][_0x8a8d('0x46')]){_0x1ba56e['include']=[{'all':!![]}];}_0x1ba56e=_[_0x8a8d('0x3f')]({},_0x1ba56e,_0x5f346d[_0x8a8d('0x41')]);return db[_0x8a8d('0x2d')][_0x8a8d('0x47')](_0x1ba56e)[_0x8a8d('0x27')](handleEntityNotFound(_0x1567ba,null))[_0x8a8d('0x27')](respondWithResult(_0x1567ba,null))['catch'](handleError(_0x1567ba,null));};exports['create']=function(_0xb00269,_0x5873dd){return db[_0x8a8d('0x2d')][_0x8a8d('0x48')](_0xb00269[_0x8a8d('0x49')],{})['then'](respondWithResult(_0x5873dd,0xc9))[_0x8a8d('0x44')](handleError(_0x5873dd,null));};exports[_0x8a8d('0x26')]=function(_0x498173,_0x4823b5){if(_0x498173[_0x8a8d('0x49')]['id']){delete _0x498173[_0x8a8d('0x49')]['id'];}return db[_0x8a8d('0x2d')][_0x8a8d('0x47')]({'where':{'id':_0x498173[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x4823b5,null))[_0x8a8d('0x27')](saveUpdates(_0x498173['body'],null))['then'](respondWithResult(_0x4823b5,null))['catch'](handleError(_0x4823b5,null));};exports[_0x8a8d('0x4a')]=function(_0x5d2ae7,_0x5a612e){return db[_0x8a8d('0x2d')][_0x8a8d('0x47')]({'where':{'id':_0x5d2ae7[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x5a612e,null))[_0x8a8d('0x27')](removeEntity(_0x5a612e,null))['catch'](handleError(_0x5a612e,null));};exports['getFields']=function(_0x24cf5b,_0x5e2a03,_0x1ceb91){var _0x4e76a3={};var _0x143476={};var _0x517d05;var _0x8d5846;return db[_0x8a8d('0x2d')][_0x8a8d('0x4b')]({'where':{'id':_0x24cf5b[_0x8a8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e2a03,null))[_0x8a8d('0x27')](function(_0xa19b45){if(_0xa19b45){_0x517d05=_0xa19b45;_0x143476['model']=_[_0x8a8d('0x33')](db[_0x8a8d('0x4c')][_0x8a8d('0x2e')]);_0x143476[_0x8a8d('0x38')]=_[_0x8a8d('0x33')](_0x24cf5b[_0x8a8d('0x38')]);_0x143476[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x143476[_0x8a8d('0x32')],_0x143476[_0x8a8d('0x38')]);_0x4e76a3[_0x8a8d('0x36')]=_['intersection'](_0x143476['model'],qs['fields'](_0x24cf5b['query'][_0x8a8d('0x37')]));_0x4e76a3[_0x8a8d('0x36')]=_0x4e76a3['attributes']['length']?_0x4e76a3[_0x8a8d('0x36')]:_0x143476['model'];_0x4e76a3['order']=qs[_0x8a8d('0x3c')](_0x24cf5b['query'][_0x8a8d('0x3c')]);_0x4e76a3[_0x8a8d('0x3d')]=qs[_0x8a8d('0x34')](_[_0x8a8d('0x4d')](_0x24cf5b[_0x8a8d('0x38')],_0x143476['filters']));if(_0x24cf5b['query'][_0x8a8d('0x3e')]){_0x4e76a3['where']=_[_0x8a8d('0x3f')](_0x4e76a3[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x4e76a3[_0x8a8d('0x36')],function(_0x21d954){var _0x5b75a0={};_0x5b75a0[_0x21d954]={'$like':'%'+_0x24cf5b[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x5b75a0;})});}_0x4e76a3=_[_0x8a8d('0x3f')]({},_0x4e76a3,_0x24cf5b[_0x8a8d('0x41')]);return _0x517d05['getFields'](_0x4e76a3);}})['then'](function(_0x4403a8){if(_0x4403a8){_0x8d5846=_0x4403a8[_0x8a8d('0x39')];if(!_0x24cf5b[_0x8a8d('0x38')][_0x8a8d('0x4e')]('nolimit')){_0x4e76a3[_0x8a8d('0x1e')]=qs['limit'](_0x24cf5b[_0x8a8d('0x38')]['limit']);_0x4e76a3[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x24cf5b[_0x8a8d('0x38')]['offset']);}return _0x517d05[_0x8a8d('0x4f')](_0x4e76a3);}})['then'](function(_0x5e2855){if(_0x5e2855){return _0x5e2855?{'count':_0x8d5846,'rows':_0x5e2855}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x5e2a03,null))[_0x8a8d('0x44')](handleError(_0x5e2a03,null));};exports[_0x8a8d('0x50')]=function(_0x4f95c4,_0x344929,_0x7b91e1){var _0x2f55b4={};var _0x26067e={};var _0xb65e07;var _0x15aa45;return db[_0x8a8d('0x2d')]['findOne']({'where':{'id':_0x4f95c4[_0x8a8d('0x45')]['id']}})[_0x8a8d('0x27')](handleEntityNotFound(_0x344929,null))[_0x8a8d('0x27')](function(_0x582b32){if(_0x582b32){_0xb65e07=_0x582b32;_0x26067e[_0x8a8d('0x32')]=_[_0x8a8d('0x33')](db[_0x8a8d('0x4c')]['rawAttributes']);_0x26067e[_0x8a8d('0x38')]=_['keys'](_0x4f95c4[_0x8a8d('0x38')]);_0x26067e[_0x8a8d('0x34')]=_[_0x8a8d('0x35')](_0x26067e[_0x8a8d('0x32')],_0x26067e[_0x8a8d('0x38')]);_0x2f55b4['attributes']=_[_0x8a8d('0x35')](_0x26067e[_0x8a8d('0x32')],qs[_0x8a8d('0x37')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0x2f55b4[_0x8a8d('0x36')]=_0x2f55b4['attributes'][_0x8a8d('0x39')]?_0x2f55b4[_0x8a8d('0x36')]:_0x26067e[_0x8a8d('0x32')];_0x2f55b4[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3c')]);_0x2f55b4['where']=qs['filters'](_[_0x8a8d('0x4d')](_0x4f95c4['query'],_0x26067e[_0x8a8d('0x34')]));if(_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0x2f55b4[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0x2f55b4[_0x8a8d('0x3d')],{'$or':_[_0x8a8d('0x2c')](_0x2f55b4[_0x8a8d('0x36')],function(_0x28912b){var _0x392462={};_0x392462[_0x28912b]={'$like':'%'+_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x392462;})});}_0x2f55b4=_[_0x8a8d('0x3f')]({},_0x2f55b4,_0x4f95c4[_0x8a8d('0x41')]);return _0xb65e07[_0x8a8d('0x50')](_0x2f55b4);}})['then'](function(_0x5c25e7){if(_0x5c25e7){_0x15aa45=_0x5c25e7[_0x8a8d('0x39')];if(!_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x4e')](_0x8a8d('0x3a'))){_0x2f55b4['limit']=qs[_0x8a8d('0x1e')](_0x4f95c4['query'][_0x8a8d('0x1e')]);_0x2f55b4[_0x8a8d('0x1c')]=qs[_0x8a8d('0x1c')](_0x4f95c4[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}return _0xb65e07[_0x8a8d('0x50')](_0x2f55b4);}})[_0x8a8d('0x27')](function(_0x4124f8){if(_0x4124f8){return _0x4124f8?{'count':_0x15aa45,'rows':_0x4124f8}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x344929,null))['catch'](handleError(_0x344929,null));};exports[_0x8a8d('0x51')]=function(_0x23e70c,_0x2e88ad,_0x5a5895){var _0xba4cb3={};var _0x1e57b1={};var _0x4132f8;var _0x498a23;return db[_0x8a8d('0x2d')][_0x8a8d('0x4b')]({'where':{'id':_0x23e70c[_0x8a8d('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e88ad,null))['then'](function(_0x1e543e){if(_0x1e543e){_0x4132f8=_0x1e543e;_0x1e57b1[_0x8a8d('0x32')]=_['keys'](db[_0x8a8d('0x4c')][_0x8a8d('0x2e')]);_0x1e57b1['query']=_[_0x8a8d('0x33')](_0x23e70c[_0x8a8d('0x38')]);_0x1e57b1[_0x8a8d('0x34')]=_['intersection'](_0x1e57b1[_0x8a8d('0x32')],_0x1e57b1['query']);_0xba4cb3['attributes']=_[_0x8a8d('0x35')](_0x1e57b1[_0x8a8d('0x32')],qs[_0x8a8d('0x37')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x37')]));_0xba4cb3['attributes']=_0xba4cb3['attributes'][_0x8a8d('0x39')]?_0xba4cb3['attributes']:_0x1e57b1['model'];_0xba4cb3[_0x8a8d('0x3b')]=qs[_0x8a8d('0x3c')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3c')]);_0xba4cb3[_0x8a8d('0x3d')]=qs['filters'](_[_0x8a8d('0x4d')](_0x23e70c[_0x8a8d('0x38')],_0x1e57b1['filters']));if(_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3e')]){_0xba4cb3[_0x8a8d('0x3d')]=_[_0x8a8d('0x3f')](_0xba4cb3[_0x8a8d('0x3d')],{'$or':_['map'](_0xba4cb3[_0x8a8d('0x36')],function(_0x3bc231){var _0x21ab58={};_0x21ab58[_0x3bc231]={'$like':'%'+_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x3e')]+'%'};return _0x21ab58;})});}_0xba4cb3=_[_0x8a8d('0x3f')]({},_0xba4cb3,_0x23e70c[_0x8a8d('0x41')]);return _0x4132f8[_0x8a8d('0x51')](_0xba4cb3);}})['then'](function(_0x23d5c2){if(_0x23d5c2){_0x498a23=_0x23d5c2['length'];if(!_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x4e')](_0x8a8d('0x3a'))){_0xba4cb3[_0x8a8d('0x1e')]=qs['limit'](_0x23e70c['query'][_0x8a8d('0x1e')]);_0xba4cb3['offset']=qs[_0x8a8d('0x1c')](_0x23e70c[_0x8a8d('0x38')][_0x8a8d('0x1c')]);}return _0x4132f8[_0x8a8d('0x51')](_0xba4cb3);}})[_0x8a8d('0x27')](function(_0x3b252d){if(_0x3b252d){return _0x3b252d?{'count':_0x498a23,'rows':_0x3b252d}:null;}})[_0x8a8d('0x27')](respondWithResult(_0x2e88ad,null))['catch'](handleError(_0x2e88ad,null));}; \ No newline at end of file +var _0xb468=['query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','SugarcrmConfiguration','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','getFields','SugarcrmField','getSubjects','findOne','getDescriptions','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0xb468,0x150));var _0x8b46=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xb468[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8b46('0x0'));var rp=require(_0x8b46('0x1'));var moment=require(_0x8b46('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8b46('0x3'));var util=require(_0x8b46('0x4'));var path=require(_0x8b46('0x5'));var sox=require('sox');var csv=require(_0x8b46('0x6'));var ejs=require(_0x8b46('0x7'));var fs=require('fs');var fs_extra=require(_0x8b46('0x8'));var _=require(_0x8b46('0x9'));var squel=require(_0x8b46('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8b46('0xb'));var toCsv=require(_0x8b46('0x6'));var querystring=require('querystring');var Papa=require(_0x8b46('0xc'));var Redis=require(_0x8b46('0xd'));var authService=require(_0x8b46('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8b46('0xf'));var logger=require(_0x8b46('0x10'))(_0x8b46('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8b46('0x12'));var db=require(_0x8b46('0x13'))['db'];function respondWithStatusCode(_0x5d1a56,_0x6bc55c){_0x6bc55c=_0x6bc55c||0xcc;return function(_0xe709cb){if(_0xe709cb){return _0x5d1a56['sendStatus'](_0x6bc55c);}return _0x5d1a56[_0x8b46('0x14')](_0x6bc55c)[_0x8b46('0x15')]();};}function respondWithResult(_0x2b9b2d,_0x1e6f11){_0x1e6f11=_0x1e6f11||0xc8;return function(_0x4acdb9){if(_0x4acdb9){return _0x2b9b2d[_0x8b46('0x14')](_0x1e6f11)[_0x8b46('0x16')](_0x4acdb9);}};}function respondWithFilteredResult(_0x1be21d,_0xac59a5){return function(_0x2852a4){if(_0x2852a4){var _0x4cd542=typeof _0xac59a5[_0x8b46('0x17')]==='undefined'&&typeof _0xac59a5[_0x8b46('0x18')]==='undefined';var _0x1ed465=_0x2852a4[_0x8b46('0x19')];var _0x270675=_0x4cd542?0x0:_0xac59a5['offset'];var _0x40ce80=_0x4cd542?_0x2852a4[_0x8b46('0x19')]:_0xac59a5[_0x8b46('0x17')]+_0xac59a5[_0x8b46('0x18')];var _0x31ef20;if(_0x40ce80>=_0x1ed465){_0x40ce80=_0x1ed465;_0x31ef20=0xc8;}else{_0x31ef20=0xce;}_0x1be21d[_0x8b46('0x14')](_0x31ef20);return _0x1be21d['set'](_0x8b46('0x1a'),_0x270675+'-'+_0x40ce80+'/'+_0x1ed465)[_0x8b46('0x16')](_0x2852a4);}return null;};}function patchUpdates(_0x2e43d7){return function(_0x968937){try{jsonpatch['apply'](_0x968937,_0x2e43d7,!![]);}catch(_0x934595){return BPromise[_0x8b46('0x1b')](_0x934595);}return _0x968937[_0x8b46('0x1c')]();};}function saveUpdates(_0xbe108,_0x4140f0){return function(_0x55390e){if(_0x55390e){return _0x55390e[_0x8b46('0x1d')](_0xbe108)['then'](function(_0x34b91b){return _0x34b91b;});}return null;};}function removeEntity(_0x22038e,_0x3bd530){return function(_0x16fed1){if(_0x16fed1){return _0x16fed1[_0x8b46('0x1e')]()[_0x8b46('0x1f')](function(){_0x22038e[_0x8b46('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd7dc,_0x5bea9e){return function(_0x24c344){if(!_0x24c344){_0x1bd7dc[_0x8b46('0x20')](0x194);}return _0x24c344;};}function handleError(_0x29fd05,_0x38e759){_0x38e759=_0x38e759||0x1f4;return function(_0x53ecd0){logger[_0x8b46('0x21')](_0x53ecd0[_0x8b46('0x22')]);if(_0x53ecd0['name']){delete _0x53ecd0['name'];}_0x29fd05['status'](_0x38e759)[_0x8b46('0x23')](_0x53ecd0);};}exports[_0x8b46('0x24')]=function(_0x5065f6,_0x7b608d){var _0x26e350={},_0x1604b2={},_0x55aef1={'count':0x0,'rows':[]};var _0x16dd2b=_[_0x8b46('0x25')](db['SugarcrmConfiguration'][_0x8b46('0x26')],function(_0x37e10f){return{'name':_0x37e10f[_0x8b46('0x27')],'type':_0x37e10f[_0x8b46('0x28')][_0x8b46('0x29')]};});_0x1604b2[_0x8b46('0x2a')]=_['map'](_0x16dd2b,_0x8b46('0x2b'));_0x1604b2[_0x8b46('0x2c')]=_['keys'](_0x5065f6[_0x8b46('0x2c')]);_0x1604b2['filters']=_[_0x8b46('0x2d')](_0x1604b2['model'],_0x1604b2[_0x8b46('0x2c')]);_0x26e350[_0x8b46('0x2e')]=_[_0x8b46('0x2d')](_0x1604b2['model'],qs['fields'](_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x2f')]));_0x26e350[_0x8b46('0x2e')]=_0x26e350[_0x8b46('0x2e')][_0x8b46('0x30')]?_0x26e350['attributes']:_0x1604b2[_0x8b46('0x2a')];if(!_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x31')](_0x8b46('0x32'))){_0x26e350[_0x8b46('0x18')]=qs[_0x8b46('0x18')](_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x18')]);_0x26e350[_0x8b46('0x17')]=qs[_0x8b46('0x17')](_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x17')]);}_0x26e350[_0x8b46('0x33')]=qs[_0x8b46('0x34')](_0x5065f6['query'][_0x8b46('0x34')]);_0x26e350[_0x8b46('0x35')]=qs[_0x8b46('0x36')](_[_0x8b46('0x37')](_0x5065f6[_0x8b46('0x2c')],_0x1604b2['filters']),_0x16dd2b);if(_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x38')]){_0x26e350[_0x8b46('0x35')]=_['merge'](_0x26e350[_0x8b46('0x35')],{'$or':_[_0x8b46('0x25')](_0x16dd2b,function(_0xcc2cf8){if(_0xcc2cf8[_0x8b46('0x28')]!==_0x8b46('0x39')){var _0x520b66={};_0x520b66[_0xcc2cf8['name']]={'$like':'%'+_0x5065f6[_0x8b46('0x2c')][_0x8b46('0x38')]+'%'};return _0x520b66;}})});}_0x26e350=_[_0x8b46('0x3a')]({},_0x26e350,_0x5065f6['options']);var _0x448645={'where':_0x26e350['where']};return db[_0x8b46('0x3b')]['count'](_0x448645)[_0x8b46('0x1f')](function(_0x5a9664){_0x55aef1[_0x8b46('0x19')]=_0x5a9664;if(_0x5065f6[_0x8b46('0x2c')]['includeAll']){_0x26e350[_0x8b46('0x3c')]=[{'all':!![]}];}return db[_0x8b46('0x3b')][_0x8b46('0x3d')](_0x26e350);})[_0x8b46('0x1f')](function(_0xe082d9){_0x55aef1[_0x8b46('0x3e')]=_0xe082d9;return _0x55aef1;})['then'](respondWithFilteredResult(_0x7b608d,_0x26e350))[_0x8b46('0x3f')](handleError(_0x7b608d,null));};exports['show']=function(_0x11c8a7,_0x55b2e5){var _0x50798a={'raw':![],'where':{'id':_0x11c8a7[_0x8b46('0x40')]['id']}},_0x1625f9={};_0x1625f9[_0x8b46('0x2a')]=_[_0x8b46('0x41')](db['SugarcrmConfiguration'][_0x8b46('0x26')]);_0x1625f9['query']=_[_0x8b46('0x41')](_0x11c8a7['query']);_0x1625f9['filters']=_[_0x8b46('0x2d')](_0x1625f9[_0x8b46('0x2a')],_0x1625f9[_0x8b46('0x2c')]);_0x50798a[_0x8b46('0x2e')]=_[_0x8b46('0x2d')](_0x1625f9[_0x8b46('0x2a')],qs['fields'](_0x11c8a7[_0x8b46('0x2c')][_0x8b46('0x2f')]));_0x50798a[_0x8b46('0x2e')]=_0x50798a[_0x8b46('0x2e')][_0x8b46('0x30')]?_0x50798a[_0x8b46('0x2e')]:_0x1625f9[_0x8b46('0x2a')];if(_0x11c8a7['query'][_0x8b46('0x42')]){_0x50798a[_0x8b46('0x3c')]=[{'all':!![]}];}_0x50798a=_[_0x8b46('0x3a')]({},_0x50798a,_0x11c8a7[_0x8b46('0x43')]);return db[_0x8b46('0x3b')][_0x8b46('0x44')](_0x50798a)['then'](handleEntityNotFound(_0x55b2e5,null))[_0x8b46('0x1f')](respondWithResult(_0x55b2e5,null))[_0x8b46('0x3f')](handleError(_0x55b2e5,null));};exports[_0x8b46('0x45')]=function(_0x3da09f,_0x2d539b){return db[_0x8b46('0x3b')]['create'](_0x3da09f[_0x8b46('0x46')],{})[_0x8b46('0x1f')](respondWithResult(_0x2d539b,0xc9))[_0x8b46('0x3f')](handleError(_0x2d539b,null));};exports['update']=function(_0x167ff7,_0x1dcd22){if(_0x167ff7['body']['id']){delete _0x167ff7['body']['id'];}return db[_0x8b46('0x3b')][_0x8b46('0x44')]({'where':{'id':_0x167ff7['params']['id']}})['then'](handleEntityNotFound(_0x1dcd22,null))[_0x8b46('0x1f')](saveUpdates(_0x167ff7[_0x8b46('0x46')],null))['then'](respondWithResult(_0x1dcd22,null))[_0x8b46('0x3f')](handleError(_0x1dcd22,null));};exports[_0x8b46('0x1e')]=function(_0x3dd5b5,_0x51e084){return db[_0x8b46('0x3b')][_0x8b46('0x44')]({'where':{'id':_0x3dd5b5[_0x8b46('0x40')]['id']}})[_0x8b46('0x1f')](handleEntityNotFound(_0x51e084,null))['then'](removeEntity(_0x51e084,null))[_0x8b46('0x3f')](handleError(_0x51e084,null));};exports[_0x8b46('0x47')]=function(_0x170e9f,_0x4018af,_0x189df8){var _0x27b6ef={};var _0x3aa297={};var _0x126b0b;var _0xbc760e;return db[_0x8b46('0x3b')]['findOne']({'where':{'id':_0x170e9f[_0x8b46('0x40')]['id']}})[_0x8b46('0x1f')](handleEntityNotFound(_0x4018af,null))[_0x8b46('0x1f')](function(_0x41392a){if(_0x41392a){_0x126b0b=_0x41392a;_0x3aa297[_0x8b46('0x2a')]=_[_0x8b46('0x41')](db[_0x8b46('0x48')][_0x8b46('0x26')]);_0x3aa297[_0x8b46('0x2c')]=_[_0x8b46('0x41')](_0x170e9f['query']);_0x3aa297[_0x8b46('0x36')]=_[_0x8b46('0x2d')](_0x3aa297[_0x8b46('0x2a')],_0x3aa297[_0x8b46('0x2c')]);_0x27b6ef['attributes']=_['intersection'](_0x3aa297[_0x8b46('0x2a')],qs[_0x8b46('0x2f')](_0x170e9f[_0x8b46('0x2c')]['fields']));_0x27b6ef[_0x8b46('0x2e')]=_0x27b6ef[_0x8b46('0x2e')][_0x8b46('0x30')]?_0x27b6ef['attributes']:_0x3aa297[_0x8b46('0x2a')];_0x27b6ef[_0x8b46('0x33')]=qs['sort'](_0x170e9f[_0x8b46('0x2c')][_0x8b46('0x34')]);_0x27b6ef[_0x8b46('0x35')]=qs['filters'](_[_0x8b46('0x37')](_0x170e9f[_0x8b46('0x2c')],_0x3aa297[_0x8b46('0x36')]));if(_0x170e9f[_0x8b46('0x2c')][_0x8b46('0x38')]){_0x27b6ef[_0x8b46('0x35')]=_[_0x8b46('0x3a')](_0x27b6ef[_0x8b46('0x35')],{'$or':_[_0x8b46('0x25')](_0x27b6ef[_0x8b46('0x2e')],function(_0x19b2ef){var _0x2a786b={};_0x2a786b[_0x19b2ef]={'$like':'%'+_0x170e9f[_0x8b46('0x2c')][_0x8b46('0x38')]+'%'};return _0x2a786b;})});}_0x27b6ef=_['merge']({},_0x27b6ef,_0x170e9f['options']);return _0x126b0b[_0x8b46('0x47')](_0x27b6ef);}})[_0x8b46('0x1f')](function(_0x23b32b){if(_0x23b32b){_0xbc760e=_0x23b32b[_0x8b46('0x30')];if(!_0x170e9f[_0x8b46('0x2c')][_0x8b46('0x31')](_0x8b46('0x32'))){_0x27b6ef[_0x8b46('0x18')]=qs['limit'](_0x170e9f['query'][_0x8b46('0x18')]);_0x27b6ef['offset']=qs[_0x8b46('0x17')](_0x170e9f[_0x8b46('0x2c')]['offset']);}return _0x126b0b[_0x8b46('0x47')](_0x27b6ef);}})[_0x8b46('0x1f')](function(_0x246456){if(_0x246456){return _0x246456?{'count':_0xbc760e,'rows':_0x246456}:null;}})[_0x8b46('0x1f')](respondWithResult(_0x4018af,null))[_0x8b46('0x3f')](handleError(_0x4018af,null));};exports[_0x8b46('0x49')]=function(_0x53a119,_0x3376bb,_0x8070a1){var _0x10cb63={};var _0x300a1e={};var _0x4a3e37;var _0x5a1b79;return db['SugarcrmConfiguration'][_0x8b46('0x4a')]({'where':{'id':_0x53a119[_0x8b46('0x40')]['id']}})['then'](handleEntityNotFound(_0x3376bb,null))[_0x8b46('0x1f')](function(_0x538f59){if(_0x538f59){_0x4a3e37=_0x538f59;_0x300a1e[_0x8b46('0x2a')]=_[_0x8b46('0x41')](db[_0x8b46('0x48')]['rawAttributes']);_0x300a1e[_0x8b46('0x2c')]=_[_0x8b46('0x41')](_0x53a119[_0x8b46('0x2c')]);_0x300a1e[_0x8b46('0x36')]=_[_0x8b46('0x2d')](_0x300a1e[_0x8b46('0x2a')],_0x300a1e[_0x8b46('0x2c')]);_0x10cb63[_0x8b46('0x2e')]=_['intersection'](_0x300a1e['model'],qs[_0x8b46('0x2f')](_0x53a119[_0x8b46('0x2c')][_0x8b46('0x2f')]));_0x10cb63[_0x8b46('0x2e')]=_0x10cb63[_0x8b46('0x2e')]['length']?_0x10cb63[_0x8b46('0x2e')]:_0x300a1e['model'];_0x10cb63[_0x8b46('0x33')]=qs[_0x8b46('0x34')](_0x53a119['query'][_0x8b46('0x34')]);_0x10cb63['where']=qs[_0x8b46('0x36')](_[_0x8b46('0x37')](_0x53a119[_0x8b46('0x2c')],_0x300a1e[_0x8b46('0x36')]));if(_0x53a119[_0x8b46('0x2c')]['filter']){_0x10cb63[_0x8b46('0x35')]=_[_0x8b46('0x3a')](_0x10cb63['where'],{'$or':_[_0x8b46('0x25')](_0x10cb63[_0x8b46('0x2e')],function(_0x3855a1){var _0x41f033={};_0x41f033[_0x3855a1]={'$like':'%'+_0x53a119['query']['filter']+'%'};return _0x41f033;})});}_0x10cb63=_['merge']({},_0x10cb63,_0x53a119[_0x8b46('0x43')]);return _0x4a3e37['getSubjects'](_0x10cb63);}})[_0x8b46('0x1f')](function(_0xf75d31){if(_0xf75d31){_0x5a1b79=_0xf75d31[_0x8b46('0x30')];if(!_0x53a119['query'][_0x8b46('0x31')]('nolimit')){_0x10cb63[_0x8b46('0x18')]=qs[_0x8b46('0x18')](_0x53a119[_0x8b46('0x2c')][_0x8b46('0x18')]);_0x10cb63[_0x8b46('0x17')]=qs[_0x8b46('0x17')](_0x53a119[_0x8b46('0x2c')][_0x8b46('0x17')]);}return _0x4a3e37['getSubjects'](_0x10cb63);}})['then'](function(_0x3d9d80){if(_0x3d9d80){return _0x3d9d80?{'count':_0x5a1b79,'rows':_0x3d9d80}:null;}})['then'](respondWithResult(_0x3376bb,null))[_0x8b46('0x3f')](handleError(_0x3376bb,null));};exports['getDescriptions']=function(_0x51f1b3,_0x3bb835,_0x1f5b22){var _0x380ad8={};var _0x2bbf0a={};var _0x8cb4af;var _0x5e46e7;return db[_0x8b46('0x3b')]['findOne']({'where':{'id':_0x51f1b3[_0x8b46('0x40')]['id']}})[_0x8b46('0x1f')](handleEntityNotFound(_0x3bb835,null))[_0x8b46('0x1f')](function(_0x1a9594){if(_0x1a9594){_0x8cb4af=_0x1a9594;_0x2bbf0a[_0x8b46('0x2a')]=_[_0x8b46('0x41')](db['SugarcrmField']['rawAttributes']);_0x2bbf0a[_0x8b46('0x2c')]=_[_0x8b46('0x41')](_0x51f1b3[_0x8b46('0x2c')]);_0x2bbf0a[_0x8b46('0x36')]=_[_0x8b46('0x2d')](_0x2bbf0a[_0x8b46('0x2a')],_0x2bbf0a[_0x8b46('0x2c')]);_0x380ad8['attributes']=_['intersection'](_0x2bbf0a[_0x8b46('0x2a')],qs[_0x8b46('0x2f')](_0x51f1b3[_0x8b46('0x2c')][_0x8b46('0x2f')]));_0x380ad8[_0x8b46('0x2e')]=_0x380ad8[_0x8b46('0x2e')][_0x8b46('0x30')]?_0x380ad8[_0x8b46('0x2e')]:_0x2bbf0a[_0x8b46('0x2a')];_0x380ad8['order']=qs[_0x8b46('0x34')](_0x51f1b3['query'][_0x8b46('0x34')]);_0x380ad8[_0x8b46('0x35')]=qs[_0x8b46('0x36')](_[_0x8b46('0x37')](_0x51f1b3['query'],_0x2bbf0a['filters']));if(_0x51f1b3['query'][_0x8b46('0x38')]){_0x380ad8[_0x8b46('0x35')]=_[_0x8b46('0x3a')](_0x380ad8[_0x8b46('0x35')],{'$or':_[_0x8b46('0x25')](_0x380ad8[_0x8b46('0x2e')],function(_0x284464){var _0x36fb42={};_0x36fb42[_0x284464]={'$like':'%'+_0x51f1b3['query'][_0x8b46('0x38')]+'%'};return _0x36fb42;})});}_0x380ad8=_[_0x8b46('0x3a')]({},_0x380ad8,_0x51f1b3['options']);return _0x8cb4af['getDescriptions'](_0x380ad8);}})[_0x8b46('0x1f')](function(_0x1b1ac9){if(_0x1b1ac9){_0x5e46e7=_0x1b1ac9[_0x8b46('0x30')];if(!_0x51f1b3[_0x8b46('0x2c')][_0x8b46('0x31')](_0x8b46('0x32'))){_0x380ad8['limit']=qs['limit'](_0x51f1b3['query'][_0x8b46('0x18')]);_0x380ad8[_0x8b46('0x17')]=qs[_0x8b46('0x17')](_0x51f1b3['query'][_0x8b46('0x17')]);}return _0x8cb4af[_0x8b46('0x4b')](_0x380ad8);}})[_0x8b46('0x1f')](function(_0x26093b){if(_0x26093b){return _0x26093b?{'count':_0x5e46e7,'rows':_0x26093b}:null;}})[_0x8b46('0x1f')](respondWithResult(_0x3bb835,null))['catch'](handleError(_0x3bb835,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index dcaf599..bca335e 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 _0x59d5=['request-promise','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x1476ab,_0x4bce3b){var _0x2b5fbc=function(_0x3e3103){while(--_0x3e3103){_0x1476ab['push'](_0x1476ab['shift']());}};_0x2b5fbc(++_0x4bce3b);}(_0x59d5,0x6a));var _0x559d=function(_0x57e6c8,_0xfc066e){_0x57e6c8=_0x57e6c8-0x0;var _0x592ecf=_0x59d5[_0x57e6c8];return _0x592ecf;};'use strict';var _=require(_0x559d('0x0'));var util=require(_0x559d('0x1'));var logger=require(_0x559d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x559d('0x3'));var rp=require(_0x559d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x559d('0x5'));var config=require(_0x559d('0x6'));var attributes=require(_0x559d('0x7'));module[_0x559d('0x8')]=function(_0x4314f2,_0x46ed6a){return _0x4314f2['define'](_0x559d('0x9'),attributes,{'tableName':_0x559d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9de=['define','SugarcrmConfiguration','lodash','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports'];(function(_0x2e7fcb,_0x580fbe){var _0x460d11=function(_0x5833e3){while(--_0x5833e3){_0x2e7fcb['push'](_0x2e7fcb['shift']());}};_0x460d11(++_0x580fbe);}(_0xf9de,0x91));var _0xef9d=function(_0x2198d4,_0x21a1a1){_0x2198d4=_0x2198d4-0x0;var _0x52cf70=_0xf9de[_0x2198d4];return _0x52cf70;};'use strict';var _=require(_0xef9d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef9d('0x1'));var moment=require(_0xef9d('0x2'));var BPromise=require(_0xef9d('0x3'));var rp=require(_0xef9d('0x4'));var fs=require('fs');var path=require(_0xef9d('0x5'));var rimraf=require(_0xef9d('0x6'));var config=require('../../config/environment');var attributes=require(_0xef9d('0x7'));module[_0xef9d('0x8')]=function(_0x3c0089,_0x1eb55d){return _0x3c0089[_0xef9d('0x9')](_0xef9d('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 176d378..3a2de63 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 _0xd4d2=['SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x578f6f,_0x223fbc){var _0x371f09=function(_0x5a7243){while(--_0x5a7243){_0x578f6f['push'](_0x578f6f['shift']());}};_0x371f09(++_0x223fbc);}(_0xd4d2,0x1a6));var _0x2d4d=function(_0x2762f8,_0x215f83){_0x2762f8=_0x2762f8-0x0;var _0x21ccba=_0xd4d2[_0x2762f8];return _0x21ccba;};'use strict';var _=require('lodash');var util=require(_0x2d4d('0x0'));var moment=require(_0x2d4d('0x1'));var BPromise=require(_0x2d4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2d4d('0x3'))['db'];var utils=require(_0x2d4d('0x4'));var logger=require(_0x2d4d('0x5'))(_0x2d4d('0x6'));var config=require(_0x2d4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2d4d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48b426,_0x2202c2,_0x4c8ccc){return new BPromise(function(_0x22bf87,_0x35355c){return client[_0x2d4d('0x9')](_0x48b426,_0x4c8ccc)[_0x2d4d('0xa')](function(_0x1e9f6a){logger[_0x2d4d('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2202c2,_0x2d4d('0xc'));logger[_0x2d4d('0xd')](_0x2d4d('0xe'),_0x2202c2,'request\x20sent',JSON[_0x2d4d('0xf')](_0x1e9f6a));if(_0x1e9f6a[_0x2d4d('0x10')]){if(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x11')]===0x1f4){logger['error'](_0x2d4d('0x12'),_0x2202c2,_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);return _0x35355c(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);}logger[_0x2d4d('0x10')](_0x2d4d('0x12'),_0x2202c2,_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);return _0x22bf87(_0x1e9f6a[_0x2d4d('0x10')][_0x2d4d('0x13')]);}else{logger[_0x2d4d('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2202c2,_0x2d4d('0xc'));_0x22bf87(_0x1e9f6a[_0x2d4d('0x14')]['message']);}})[_0x2d4d('0x15')](function(_0x178f25){logger[_0x2d4d('0x10')](_0x2d4d('0x12'),_0x2202c2,_0x178f25);_0x35355c(_0x178f25);});});} \ No newline at end of file +var _0x1733=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x48b765,_0x59a40c){var _0x3f746e=function(_0x3e0c70){while(--_0x3e0c70){_0x48b765['push'](_0x48b765['shift']());}};_0x3f746e(++_0x59a40c);}(_0x1733,0x12d));var _0x3173=function(_0x320f1e,_0x29424b){_0x320f1e=_0x320f1e-0x0;var _0x11e836=_0x1733[_0x320f1e];return _0x11e836;};'use strict';var _=require(_0x3173('0x0'));var util=require(_0x3173('0x1'));var moment=require(_0x3173('0x2'));var BPromise=require(_0x3173('0x3'));var rs=require(_0x3173('0x4'));var fs=require('fs');var Redis=require(_0x3173('0x5'));var db=require(_0x3173('0x6'))['db'];var utils=require(_0x3173('0x7'));var logger=require(_0x3173('0x8'))(_0x3173('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x597740,_0x14a1e9,_0x302446){return new BPromise(function(_0x578660,_0x2a0adf){return client[_0x3173('0xa')](_0x597740,_0x302446)['then'](function(_0x59bef8){logger['info'](_0x3173('0xb'),_0x14a1e9,_0x3173('0xc'));logger[_0x3173('0xd')](_0x3173('0xe'),_0x14a1e9,'request\x20sent',JSON['stringify'](_0x59bef8));if(_0x59bef8['error']){if(_0x59bef8[_0x3173('0xf')]['code']===0x1f4){logger[_0x3173('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x14a1e9,_0x59bef8[_0x3173('0xf')]['message']);return _0x2a0adf(_0x59bef8[_0x3173('0xf')]['message']);}logger[_0x3173('0xf')](_0x3173('0xb'),_0x14a1e9,_0x59bef8[_0x3173('0xf')][_0x3173('0x10')]);return _0x578660(_0x59bef8['error'][_0x3173('0x10')]);}else{logger[_0x3173('0x11')](_0x3173('0xb'),_0x14a1e9,_0x3173('0xc'));_0x578660(_0x59bef8[_0x3173('0x12')][_0x3173('0x10')]);}})[_0x3173('0x13')](function(_0x5ebfb4){logger[_0x3173('0xf')](_0x3173('0xb'),_0x14a1e9,_0x5ebfb4);_0x2a0adf(_0x5ebfb4);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2e4576b..f816de2 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 _0x4cbd=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show'];(function(_0xc55a7d,_0x2ebbe8){var _0x58bae7=function(_0x4fc8f6){while(--_0x4fc8f6){_0xc55a7d['push'](_0xc55a7d['shift']());}};_0x58bae7(++_0x2ebbe8);}(_0x4cbd,0x1b5));var _0xd4cb=function(_0x14f9d4,_0x35b621){_0x14f9d4=_0x14f9d4-0x0;var _0x2a8de3=_0x4cbd[_0x14f9d4];return _0x2a8de3;};'use strict';var multer=require(_0xd4cb('0x0'));var util=require(_0xd4cb('0x1'));var path=require('path');var timeout=require(_0xd4cb('0x2'));var express=require('express');var router=express[_0xd4cb('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd4cb('0x4'));var controller=require(_0xd4cb('0x5'));router[_0xd4cb('0x6')]('/',auth[_0xd4cb('0x7')](),controller[_0xd4cb('0x8')]);router[_0xd4cb('0x6')](_0xd4cb('0x9'),auth[_0xd4cb('0x7')](),controller[_0xd4cb('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4cb('0xb')]);router[_0xd4cb('0xc')](_0xd4cb('0x9'),auth[_0xd4cb('0x7')](),controller[_0xd4cb('0xd')]);router['delete'](_0xd4cb('0x9'),auth['isAuthenticated'](),controller[_0xd4cb('0xe')]);module[_0xd4cb('0xf')]=router; \ No newline at end of file +var _0xcd6c=['get','isAuthenticated','/:id','post','create','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x483c12,_0x9a472c){var _0x3ef25a=function(_0x49ccd7){while(--_0x49ccd7){_0x483c12['push'](_0x483c12['shift']());}};_0x3ef25a(++_0x9a472c);}(_0xcd6c,0x1a7));var _0xccd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcd6c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xccd6('0x0'));var util=require(_0xccd6('0x1'));var path=require(_0xccd6('0x2'));var timeout=require('connect-timeout');var express=require(_0xccd6('0x3'));var router=express[_0xccd6('0x4')]();var fs_extra=require(_0xccd6('0x5'));var auth=require(_0xccd6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccd6('0x7'));var controller=require(_0xccd6('0x8'));router[_0xccd6('0x9')]('/',auth[_0xccd6('0xa')](),controller['index']);router[_0xccd6('0x9')](_0xccd6('0xb'),auth[_0xccd6('0xa')](),controller['show']);router[_0xccd6('0xc')]('/',auth[_0xccd6('0xa')](),controller[_0xccd6('0xd')]);router['put'](_0xccd6('0xb'),auth[_0xccd6('0xa')](),controller[_0xccd6('0xe')]);router['delete'](_0xccd6('0xb'),auth['isAuthenticated'](),controller[_0xccd6('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9df9064..2310c93 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 _0x3503=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x2106e8,_0x260adf){var _0x4c2462=function(_0x8e1770){while(--_0x8e1770){_0x2106e8['push'](_0x2106e8['shift']());}};_0x4c2462(++_0x260adf);}(_0x3503,0x11c));var _0x3350=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x3503[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require(_0x3350('0x0'));module[_0x3350('0x1')]={'type':{'type':Sequelize[_0x3350('0x2')](_0x3350('0x3'),_0x3350('0x4'),_0x3350('0x5'),_0x3350('0x6'),'picklist'),'defaultValue':_0x3350('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3350('0x7')]},'keyType':{'type':Sequelize[_0x3350('0x2')](_0x3350('0x3'),_0x3350('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x3350('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3350('0x7')]},'customField':{'type':Sequelize[_0x3350('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60ed=['ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x1749fc,_0x2563f3){var _0x346f5c=function(_0xd1fd0){while(--_0xd1fd0){_0x1749fc['push'](_0x1749fc['shift']());}};_0x346f5c(++_0x2563f3);}(_0x60ed,0x106));var _0xd60e=function(_0x5453e2,_0x41e639){_0x5453e2=_0x5453e2-0x0;var _0x524cb6=_0x60ed[_0x5453e2];return _0x524cb6;};'use strict';var Sequelize=require(_0xd60e('0x0'));module[_0xd60e('0x1')]={'type':{'type':Sequelize[_0xd60e('0x2')](_0xd60e('0x3'),_0xd60e('0x4'),_0xd60e('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd60e('0x6')]},'key':{'type':Sequelize[_0xd60e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd60e('0x3'),_0xd60e('0x4'),_0xd60e('0x5'))},'keyContent':{'type':Sequelize[_0xd60e('0x6')]},'idField':{'type':Sequelize[_0xd60e('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd60e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 27b1aad..1396c3f 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 _0xdc7f=['path','sox','to-csv','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','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','intersection','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xdc7f,0x1d8));var _0xfdc7=function(_0x3b2d98,_0xaa0b26){_0x3b2d98=_0x3b2d98-0x0;var _0x256bf1=_0xdc7f[_0x3b2d98];return _0x256bf1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfdc7('0x0'));var zipdir=require(_0xfdc7('0x1'));var jsonpatch=require(_0xfdc7('0x2'));var rp=require(_0xfdc7('0x3'));var moment=require(_0xfdc7('0x4'));var BPromise=require(_0xfdc7('0x5'));var Mustache=require(_0xfdc7('0x6'));var util=require(_0xfdc7('0x7'));var path=require(_0xfdc7('0x8'));var sox=require(_0xfdc7('0x9'));var csv=require(_0xfdc7('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfdc7('0xb'));var _=require(_0xfdc7('0xc'));var squel=require(_0xfdc7('0xd'));var crypto=require(_0xfdc7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfdc7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfdc7('0x10'));var Papa=require(_0xfdc7('0x11'));var Redis=require(_0xfdc7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfdc7('0x13'));var as=require(_0xfdc7('0x14'));var hardwareService=require(_0xfdc7('0x15'));var logger=require(_0xfdc7('0x16'))(_0xfdc7('0x17'));var utils=require(_0xfdc7('0x18'));var config=require(_0xfdc7('0x19'));var licenseUtil=require(_0xfdc7('0x1a'));var db=require(_0xfdc7('0x1b'))['db'];function respondWithStatusCode(_0x8a5093,_0x4e8df7){_0x4e8df7=_0x4e8df7||0xcc;return function(_0x59fa59){if(_0x59fa59){return _0x8a5093[_0xfdc7('0x1c')](_0x4e8df7);}return _0x8a5093[_0xfdc7('0x1d')](_0x4e8df7)[_0xfdc7('0x1e')]();};}function respondWithResult(_0x559fba,_0x4fc1cc){_0x4fc1cc=_0x4fc1cc||0xc8;return function(_0x32fd1a){if(_0x32fd1a){return _0x559fba['status'](_0x4fc1cc)[_0xfdc7('0x1f')](_0x32fd1a);}};}function respondWithFilteredResult(_0x22e75f,_0x409dbc){return function(_0x1ac393){if(_0x1ac393){var _0xd49ba7=typeof _0x409dbc[_0xfdc7('0x20')]===_0xfdc7('0x21')&&typeof _0x409dbc[_0xfdc7('0x22')]==='undefined';var _0x526652=_0x1ac393['count'];var _0x1ef30a=_0xd49ba7?0x0:_0x409dbc[_0xfdc7('0x20')];var _0x1f7ecf=_0xd49ba7?_0x1ac393['count']:_0x409dbc[_0xfdc7('0x20')]+_0x409dbc[_0xfdc7('0x22')];var _0x538e40;if(_0x1f7ecf>=_0x526652){_0x1f7ecf=_0x526652;_0x538e40=0xc8;}else{_0x538e40=0xce;}_0x22e75f[_0xfdc7('0x1d')](_0x538e40);return _0x22e75f[_0xfdc7('0x23')](_0xfdc7('0x24'),_0x1ef30a+'-'+_0x1f7ecf+'/'+_0x526652)[_0xfdc7('0x1f')](_0x1ac393);}return null;};}function patchUpdates(_0x4b4034){return function(_0x146559){try{jsonpatch[_0xfdc7('0x25')](_0x146559,_0x4b4034,!![]);}catch(_0x3c854a){return BPromise[_0xfdc7('0x26')](_0x3c854a);}return _0x146559[_0xfdc7('0x27')]();};}function saveUpdates(_0x56f757,_0x573097){return function(_0x56cc85){if(_0x56cc85){return _0x56cc85[_0xfdc7('0x28')](_0x56f757)[_0xfdc7('0x29')](function(_0x214d2f){return _0x214d2f;});}return null;};}function removeEntity(_0x368c6c,_0x11f866){return function(_0x3892b4){if(_0x3892b4){return _0x3892b4[_0xfdc7('0x2a')]()[_0xfdc7('0x29')](function(){_0x368c6c[_0xfdc7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ecc8c,_0x33ab27){return function(_0x55b71f){if(!_0x55b71f){_0x2ecc8c[_0xfdc7('0x1c')](0x194);}return _0x55b71f;};}function handleError(_0x5a98f1,_0x2e50c2){_0x2e50c2=_0x2e50c2||0x1f4;return function(_0x20ab7e){logger[_0xfdc7('0x2b')](_0x20ab7e[_0xfdc7('0x2c')]);if(_0x20ab7e['name']){delete _0x20ab7e[_0xfdc7('0x2d')];}_0x5a98f1[_0xfdc7('0x1d')](_0x2e50c2)[_0xfdc7('0x2e')](_0x20ab7e);};}exports[_0xfdc7('0x2f')]=function(_0x378273,_0x1bbc72){var _0x4f9e88={},_0x44ebe2={},_0x4962c3={'count':0x0,'rows':[]};var _0x5dabcd=_['map'](db[_0xfdc7('0x30')][_0xfdc7('0x31')],function(_0x55b5bf){return{'name':_0x55b5bf[_0xfdc7('0x32')],'type':_0x55b5bf[_0xfdc7('0x33')][_0xfdc7('0x34')]};});_0x44ebe2[_0xfdc7('0x35')]=_[_0xfdc7('0x36')](_0x5dabcd,_0xfdc7('0x2d'));_0x44ebe2[_0xfdc7('0x37')]=_['keys'](_0x378273[_0xfdc7('0x37')]);_0x44ebe2[_0xfdc7('0x38')]=_['intersection'](_0x44ebe2[_0xfdc7('0x35')],_0x44ebe2[_0xfdc7('0x37')]);_0x4f9e88[_0xfdc7('0x39')]=_['intersection'](_0x44ebe2[_0xfdc7('0x35')],qs[_0xfdc7('0x3a')](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3a')]));_0x4f9e88[_0xfdc7('0x39')]=_0x4f9e88[_0xfdc7('0x39')][_0xfdc7('0x3b')]?_0x4f9e88[_0xfdc7('0x39')]:_0x44ebe2[_0xfdc7('0x35')];if(!_0x378273[_0xfdc7('0x37')]['hasOwnProperty']('nolimit')){_0x4f9e88['limit']=qs[_0xfdc7('0x22')](_0x378273[_0xfdc7('0x37')]['limit']);_0x4f9e88[_0xfdc7('0x20')]=qs['offset'](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x20')]);}_0x4f9e88[_0xfdc7('0x3c')]=qs[_0xfdc7('0x3d')](_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3d')]);_0x4f9e88['where']=qs['filters'](_[_0xfdc7('0x3e')](_0x378273['query'],_0x44ebe2[_0xfdc7('0x38')]),_0x5dabcd);if(_0x378273['query'][_0xfdc7('0x3f')]){_0x4f9e88[_0xfdc7('0x40')]=_[_0xfdc7('0x41')](_0x4f9e88[_0xfdc7('0x40')],{'$or':_[_0xfdc7('0x36')](_0x5dabcd,function(_0x306eb9){if(_0x306eb9[_0xfdc7('0x33')]!==_0xfdc7('0x42')){var _0x3184a9={};_0x3184a9[_0x306eb9[_0xfdc7('0x2d')]]={'$like':'%'+_0x378273[_0xfdc7('0x37')][_0xfdc7('0x3f')]+'%'};return _0x3184a9;}})});}_0x4f9e88=_[_0xfdc7('0x41')]({},_0x4f9e88,_0x378273[_0xfdc7('0x43')]);var _0x420f0c={'where':_0x4f9e88[_0xfdc7('0x40')]};return db[_0xfdc7('0x30')][_0xfdc7('0x44')](_0x420f0c)[_0xfdc7('0x29')](function(_0x1c6382){_0x4962c3[_0xfdc7('0x44')]=_0x1c6382;if(_0x378273[_0xfdc7('0x37')][_0xfdc7('0x45')]){_0x4f9e88[_0xfdc7('0x46')]=[{'all':!![]}];}return db[_0xfdc7('0x30')][_0xfdc7('0x47')](_0x4f9e88);})[_0xfdc7('0x29')](function(_0x5203f){_0x4962c3['rows']=_0x5203f;return _0x4962c3;})[_0xfdc7('0x29')](respondWithFilteredResult(_0x1bbc72,_0x4f9e88))[_0xfdc7('0x48')](handleError(_0x1bbc72,null));};exports[_0xfdc7('0x49')]=function(_0x476b2f,_0x17b34){var _0x3e2d8a={'raw':!![],'where':{'id':_0x476b2f[_0xfdc7('0x4a')]['id']}},_0x1b398d={};_0x1b398d[_0xfdc7('0x35')]=_[_0xfdc7('0x4b')](db[_0xfdc7('0x30')]['rawAttributes']);_0x1b398d['query']=_[_0xfdc7('0x4b')](_0x476b2f[_0xfdc7('0x37')]);_0x1b398d['filters']=_[_0xfdc7('0x4c')](_0x1b398d['model'],_0x1b398d[_0xfdc7('0x37')]);_0x3e2d8a['attributes']=_['intersection'](_0x1b398d[_0xfdc7('0x35')],qs[_0xfdc7('0x3a')](_0x476b2f[_0xfdc7('0x37')][_0xfdc7('0x3a')]));_0x3e2d8a[_0xfdc7('0x39')]=_0x3e2d8a[_0xfdc7('0x39')]['length']?_0x3e2d8a['attributes']:_0x1b398d[_0xfdc7('0x35')];if(_0x476b2f['query'][_0xfdc7('0x45')]){_0x3e2d8a[_0xfdc7('0x46')]=[{'all':!![]}];}_0x3e2d8a=_[_0xfdc7('0x41')]({},_0x3e2d8a,_0x476b2f[_0xfdc7('0x43')]);return db['SugarcrmField'][_0xfdc7('0x4d')](_0x3e2d8a)[_0xfdc7('0x29')](handleEntityNotFound(_0x17b34,null))['then'](respondWithResult(_0x17b34,null))[_0xfdc7('0x48')](handleError(_0x17b34,null));};exports[_0xfdc7('0x4e')]=function(_0x26b4ec,_0x17b7ee){return db[_0xfdc7('0x30')][_0xfdc7('0x4e')](_0x26b4ec[_0xfdc7('0x4f')],{})[_0xfdc7('0x29')](respondWithResult(_0x17b7ee,0xc9))['catch'](handleError(_0x17b7ee,null));};exports['update']=function(_0x4b4274,_0x3b907a){if(_0x4b4274['body']['id']){delete _0x4b4274[_0xfdc7('0x4f')]['id'];}return db[_0xfdc7('0x30')][_0xfdc7('0x4d')]({'where':{'id':_0x4b4274[_0xfdc7('0x4a')]['id']}})[_0xfdc7('0x29')](handleEntityNotFound(_0x3b907a,null))['then'](saveUpdates(_0x4b4274[_0xfdc7('0x4f')],null))[_0xfdc7('0x29')](respondWithResult(_0x3b907a,null))[_0xfdc7('0x48')](handleError(_0x3b907a,null));};exports[_0xfdc7('0x2a')]=function(_0x667119,_0x2bf55d){return db[_0xfdc7('0x30')][_0xfdc7('0x4d')]({'where':{'id':_0x667119['params']['id']}})[_0xfdc7('0x29')](handleEntityNotFound(_0x2bf55d,null))[_0xfdc7('0x29')](removeEntity(_0x2bf55d,null))[_0xfdc7('0x48')](handleError(_0x2bf55d,null));}; \ No newline at end of file +var _0x8fdd=['model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','SugarcrmField','then','includeAll','include','catch','show','filters','options','find','create','body','params','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','reject','save','error','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x3ca012,_0x4cff79){var _0x1a8b78=function(_0x320cfd){while(--_0x320cfd){_0x3ca012['push'](_0x3ca012['shift']());}};_0x1a8b78(++_0x4cff79);}(_0x8fdd,0xa6));var _0xd8fd=function(_0x323419,_0x2a6172){_0x323419=_0x323419-0x0;var _0x4c0be7=_0x8fdd[_0x323419];return _0x4c0be7;};'use strict';var emlformat=require(_0xd8fd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd8fd('0x1'));var BPromise=require(_0xd8fd('0x2'));var Mustache=require(_0xd8fd('0x3'));var util=require(_0xd8fd('0x4'));var path=require(_0xd8fd('0x5'));var sox=require(_0xd8fd('0x6'));var csv=require(_0xd8fd('0x7'));var ejs=require(_0xd8fd('0x8'));var fs=require('fs');var fs_extra=require(_0xd8fd('0x9'));var _=require(_0xd8fd('0xa'));var squel=require(_0xd8fd('0xb'));var crypto=require(_0xd8fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd8fd('0xd'));var toCsv=require(_0xd8fd('0x7'));var querystring=require(_0xd8fd('0xe'));var Papa=require('papaparse');var Redis=require(_0xd8fd('0xf'));var authService=require(_0xd8fd('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fd('0x11'));var logger=require(_0xd8fd('0x12'))(_0xd8fd('0x13'));var utils=require(_0xd8fd('0x14'));var config=require(_0xd8fd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd8fd('0x16'))['db'];function respondWithStatusCode(_0x14b303,_0x32adb4){_0x32adb4=_0x32adb4||0xcc;return function(_0x22ad42){if(_0x22ad42){return _0x14b303[_0xd8fd('0x17')](_0x32adb4);}return _0x14b303[_0xd8fd('0x18')](_0x32adb4)[_0xd8fd('0x19')]();};}function respondWithResult(_0x38bd82,_0x5252b3){_0x5252b3=_0x5252b3||0xc8;return function(_0x10e52d){if(_0x10e52d){return _0x38bd82[_0xd8fd('0x18')](_0x5252b3)['json'](_0x10e52d);}};}function respondWithFilteredResult(_0x4c715b,_0x339202){return function(_0x565deb){if(_0x565deb){var _0x2c5de7=typeof _0x339202['offset']===_0xd8fd('0x1a')&&typeof _0x339202['limit']==='undefined';var _0xbc4717=_0x565deb[_0xd8fd('0x1b')];var _0x2fb085=_0x2c5de7?0x0:_0x339202[_0xd8fd('0x1c')];var _0x5ee230=_0x2c5de7?_0x565deb[_0xd8fd('0x1b')]:_0x339202[_0xd8fd('0x1c')]+_0x339202[_0xd8fd('0x1d')];var _0x40b83;if(_0x5ee230>=_0xbc4717){_0x5ee230=_0xbc4717;_0x40b83=0xc8;}else{_0x40b83=0xce;}_0x4c715b[_0xd8fd('0x18')](_0x40b83);return _0x4c715b['set'](_0xd8fd('0x1e'),_0x2fb085+'-'+_0x5ee230+'/'+_0xbc4717)[_0xd8fd('0x1f')](_0x565deb);}return null;};}function patchUpdates(_0x204d27){return function(_0x1ba160){try{jsonpatch['apply'](_0x1ba160,_0x204d27,!![]);}catch(_0x2374bf){return BPromise[_0xd8fd('0x20')](_0x2374bf);}return _0x1ba160[_0xd8fd('0x21')]();};}function saveUpdates(_0x83440a,_0x300058){return function(_0x16370d){if(_0x16370d){return _0x16370d['update'](_0x83440a)['then'](function(_0x342a50){return _0x342a50;});}return null;};}function removeEntity(_0x4aed16,_0x9bd028){return function(_0x429fa9){if(_0x429fa9){return _0x429fa9['destroy']()['then'](function(){_0x4aed16[_0xd8fd('0x18')](0xcc)[_0xd8fd('0x19')]();});}};}function handleEntityNotFound(_0x3db31b,_0x5178a3){return function(_0x42aef1){if(!_0x42aef1){_0x3db31b[_0xd8fd('0x17')](0x194);}return _0x42aef1;};}function handleError(_0x35f692,_0x54d7a6){_0x54d7a6=_0x54d7a6||0x1f4;return function(_0x255d7b){logger[_0xd8fd('0x22')](_0x255d7b[_0xd8fd('0x23')]);if(_0x255d7b['name']){delete _0x255d7b[_0xd8fd('0x24')];}_0x35f692[_0xd8fd('0x18')](_0x54d7a6)[_0xd8fd('0x25')](_0x255d7b);};}exports[_0xd8fd('0x26')]=function(_0xd5a1da,_0x22d655){var _0x2d1e21={},_0x1041eb={},_0x26fe2c={'count':0x0,'rows':[]};var _0x2bd341=_[_0xd8fd('0x27')](db['SugarcrmField'][_0xd8fd('0x28')],function(_0x2c299b){return{'name':_0x2c299b[_0xd8fd('0x29')],'type':_0x2c299b[_0xd8fd('0x2a')][_0xd8fd('0x2b')]};});_0x1041eb[_0xd8fd('0x2c')]=_['map'](_0x2bd341,'name');_0x1041eb[_0xd8fd('0x2d')]=_[_0xd8fd('0x2e')](_0xd5a1da[_0xd8fd('0x2d')]);_0x1041eb['filters']=_[_0xd8fd('0x2f')](_0x1041eb['model'],_0x1041eb[_0xd8fd('0x2d')]);_0x2d1e21['attributes']=_[_0xd8fd('0x2f')](_0x1041eb[_0xd8fd('0x2c')],qs[_0xd8fd('0x30')](_0xd5a1da[_0xd8fd('0x2d')]['fields']));_0x2d1e21[_0xd8fd('0x31')]=_0x2d1e21[_0xd8fd('0x31')][_0xd8fd('0x32')]?_0x2d1e21[_0xd8fd('0x31')]:_0x1041eb[_0xd8fd('0x2c')];if(!_0xd5a1da['query'][_0xd8fd('0x33')](_0xd8fd('0x34'))){_0x2d1e21[_0xd8fd('0x1d')]=qs[_0xd8fd('0x1d')](_0xd5a1da[_0xd8fd('0x2d')][_0xd8fd('0x1d')]);_0x2d1e21[_0xd8fd('0x1c')]=qs['offset'](_0xd5a1da['query'][_0xd8fd('0x1c')]);}_0x2d1e21[_0xd8fd('0x35')]=qs[_0xd8fd('0x36')](_0xd5a1da['query'][_0xd8fd('0x36')]);_0x2d1e21[_0xd8fd('0x37')]=qs['filters'](_['pick'](_0xd5a1da[_0xd8fd('0x2d')],_0x1041eb['filters']),_0x2bd341);if(_0xd5a1da[_0xd8fd('0x2d')][_0xd8fd('0x38')]){_0x2d1e21[_0xd8fd('0x37')]=_['merge'](_0x2d1e21[_0xd8fd('0x37')],{'$or':_['map'](_0x2bd341,function(_0x436bfc){if(_0x436bfc['type']!=='VIRTUAL'){var _0x47d302={};_0x47d302[_0x436bfc[_0xd8fd('0x24')]]={'$like':'%'+_0xd5a1da['query'][_0xd8fd('0x38')]+'%'};return _0x47d302;}})});}_0x2d1e21=_[_0xd8fd('0x39')]({},_0x2d1e21,_0xd5a1da['options']);var _0x477d71={'where':_0x2d1e21[_0xd8fd('0x37')]};return db[_0xd8fd('0x3a')]['count'](_0x477d71)[_0xd8fd('0x3b')](function(_0x105c3e){_0x26fe2c[_0xd8fd('0x1b')]=_0x105c3e;if(_0xd5a1da['query'][_0xd8fd('0x3c')]){_0x2d1e21[_0xd8fd('0x3d')]=[{'all':!![]}];}return db[_0xd8fd('0x3a')]['findAll'](_0x2d1e21);})[_0xd8fd('0x3b')](function(_0x11b22e){_0x26fe2c['rows']=_0x11b22e;return _0x26fe2c;})['then'](respondWithFilteredResult(_0x22d655,_0x2d1e21))[_0xd8fd('0x3e')](handleError(_0x22d655,null));};exports[_0xd8fd('0x3f')]=function(_0x28d9e5,_0x45cba7){var _0x44cd53={'raw':!![],'where':{'id':_0x28d9e5['params']['id']}},_0x5dc7aa={};_0x5dc7aa[_0xd8fd('0x2c')]=_[_0xd8fd('0x2e')](db[_0xd8fd('0x3a')]['rawAttributes']);_0x5dc7aa[_0xd8fd('0x2d')]=_[_0xd8fd('0x2e')](_0x28d9e5['query']);_0x5dc7aa[_0xd8fd('0x40')]=_['intersection'](_0x5dc7aa[_0xd8fd('0x2c')],_0x5dc7aa[_0xd8fd('0x2d')]);_0x44cd53[_0xd8fd('0x31')]=_['intersection'](_0x5dc7aa[_0xd8fd('0x2c')],qs[_0xd8fd('0x30')](_0x28d9e5[_0xd8fd('0x2d')][_0xd8fd('0x30')]));_0x44cd53[_0xd8fd('0x31')]=_0x44cd53[_0xd8fd('0x31')][_0xd8fd('0x32')]?_0x44cd53[_0xd8fd('0x31')]:_0x5dc7aa['model'];if(_0x28d9e5[_0xd8fd('0x2d')][_0xd8fd('0x3c')]){_0x44cd53[_0xd8fd('0x3d')]=[{'all':!![]}];}_0x44cd53=_[_0xd8fd('0x39')]({},_0x44cd53,_0x28d9e5[_0xd8fd('0x41')]);return db[_0xd8fd('0x3a')][_0xd8fd('0x42')](_0x44cd53)[_0xd8fd('0x3b')](handleEntityNotFound(_0x45cba7,null))[_0xd8fd('0x3b')](respondWithResult(_0x45cba7,null))[_0xd8fd('0x3e')](handleError(_0x45cba7,null));};exports[_0xd8fd('0x43')]=function(_0x20b1ff,_0x55842f){return db[_0xd8fd('0x3a')]['create'](_0x20b1ff[_0xd8fd('0x44')],{})[_0xd8fd('0x3b')](respondWithResult(_0x55842f,0xc9))['catch'](handleError(_0x55842f,null));};exports['update']=function(_0x31b4d2,_0x52aefa){if(_0x31b4d2[_0xd8fd('0x44')]['id']){delete _0x31b4d2[_0xd8fd('0x44')]['id'];}return db[_0xd8fd('0x3a')][_0xd8fd('0x42')]({'where':{'id':_0x31b4d2[_0xd8fd('0x45')]['id']}})['then'](handleEntityNotFound(_0x52aefa,null))['then'](saveUpdates(_0x31b4d2[_0xd8fd('0x44')],null))[_0xd8fd('0x3b')](respondWithResult(_0x52aefa,null))[_0xd8fd('0x3e')](handleError(_0x52aefa,null));};exports['destroy']=function(_0x5d6054,_0x113193){return db[_0xd8fd('0x3a')][_0xd8fd('0x42')]({'where':{'id':_0x5d6054[_0xd8fd('0x45')]['id']}})[_0xd8fd('0x3b')](handleEntityNotFound(_0x113193,null))['then'](removeEntity(_0x113193,null))[_0xd8fd('0x3e')](handleError(_0x113193,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 6ad40c9..7197099 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 _0x1866=['exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmField.attributes'];(function(_0x160cea,_0x86307e){var _0x13382b=function(_0x163e09){while(--_0x163e09){_0x160cea['push'](_0x160cea['shift']());}};_0x13382b(++_0x86307e);}(_0x1866,0x106));var _0x6186=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1866[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x6186('0x0'));var util=require(_0x6186('0x1'));var logger=require(_0x6186('0x2'))(_0x6186('0x3'));var moment=require(_0x6186('0x4'));var BPromise=require(_0x6186('0x5'));var rp=require(_0x6186('0x6'));var fs=require('fs');var path=require(_0x6186('0x7'));var rimraf=require('rimraf');var config=require(_0x6186('0x8'));var attributes=require(_0x6186('0x9'));module[_0x6186('0xa')]=function(_0xc2b08c,_0x1cfd8d){return _0xc2b08c[_0x6186('0xb')](_0x6186('0xc'),attributes,{'tableName':_0x6186('0xd'),'paranoid':![],'indexes':[{'name':_0x6186('0xe'),'fields':[_0x6186('0xf'),_0x6186('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6fb1=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','moment','bluebird'];(function(_0x551ea7,_0x208ddc){var _0x12c3f2=function(_0x473715){while(--_0x473715){_0x551ea7['push'](_0x551ea7['shift']());}};_0x12c3f2(++_0x208ddc);}(_0x6fb1,0x10a));var _0x16fb=function(_0x19d86d,_0x25b504){_0x19d86d=_0x19d86d-0x0;var _0x1d5503=_0x6fb1[_0x19d86d];return _0x1d5503;};'use strict';var _=require(_0x16fb('0x0'));var util=require(_0x16fb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x16fb('0x2'));var BPromise=require(_0x16fb('0x3'));var rp=require(_0x16fb('0x4'));var fs=require('fs');var path=require(_0x16fb('0x5'));var rimraf=require(_0x16fb('0x6'));var config=require(_0x16fb('0x7'));var attributes=require(_0x16fb('0x8'));module[_0x16fb('0x9')]=function(_0x189595,_0xec5d9b){return _0x189595[_0x16fb('0xa')](_0x16fb('0xb'),attributes,{'tableName':_0x16fb('0xc'),'paranoid':![],'indexes':[{'name':_0x16fb('0xd'),'fields':[_0x16fb('0xe'),'FieldId'],'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 a9f2c49..0aa8aba 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 _0x4d8a=['request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x43b791,_0x1d8125){var _0x2c8f2d=function(_0x274cc4){while(--_0x274cc4){_0x43b791['push'](_0x43b791['shift']());}};_0x2c8f2d(++_0x1d8125);}(_0x4d8a,0x196));var _0xa4d8=function(_0x12e931,_0x4582c4){_0x12e931=_0x12e931-0x0;var _0xc64d2d=_0x4d8a[_0x12e931];return _0xc64d2d;};'use strict';var _=require('lodash');var util=require(_0xa4d8('0x0'));var moment=require(_0xa4d8('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d8('0x2'));var db=require(_0xa4d8('0x3'))['db'];var utils=require(_0xa4d8('0x4'));var logger=require(_0xa4d8('0x5'))(_0xa4d8('0x6'));var config=require('../../config/environment');var jayson=require(_0xa4d8('0x7'));var client=jayson[_0xa4d8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40ab64,_0x57db7b,_0x308870){return new BPromise(function(_0x5e46ed,_0x536b43){return client['request'](_0x40ab64,_0x308870)[_0xa4d8('0x9')](function(_0x33abef){logger[_0xa4d8('0xa')](_0xa4d8('0xb'),_0x57db7b,'request\x20sent');logger[_0xa4d8('0xc')](_0xa4d8('0xd'),_0x57db7b,_0xa4d8('0xe'),JSON[_0xa4d8('0xf')](_0x33abef));if(_0x33abef['error']){if(_0x33abef[_0xa4d8('0x10')][_0xa4d8('0x11')]===0x1f4){logger[_0xa4d8('0x10')](_0xa4d8('0xb'),_0x57db7b,_0x33abef['error'][_0xa4d8('0x12')]);return _0x536b43(_0x33abef['error'][_0xa4d8('0x12')]);}logger['error'](_0xa4d8('0xb'),_0x57db7b,_0x33abef[_0xa4d8('0x10')][_0xa4d8('0x12')]);return _0x5e46ed(_0x33abef['error'][_0xa4d8('0x12')]);}else{logger['info'](_0xa4d8('0xb'),_0x57db7b,_0xa4d8('0xe'));_0x5e46ed(_0x33abef[_0xa4d8('0x13')][_0xa4d8('0x12')]);}})[_0xa4d8('0x14')](function(_0x38d5f5){logger['error'](_0xa4d8('0xb'),_0x57db7b,_0x38d5f5);_0x536b43(_0x38d5f5);});});} \ No newline at end of file +var _0x526f=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x526f,0xa3));var _0xf526=function(_0x4b74e3,_0x3e4152){_0x4b74e3=_0x4b74e3-0x0;var _0x3ccd5c=_0x526f[_0x4b74e3];return _0x3ccd5c;};'use strict';var _=require(_0xf526('0x0'));var util=require(_0xf526('0x1'));var moment=require(_0xf526('0x2'));var BPromise=require(_0xf526('0x3'));var rs=require(_0xf526('0x4'));var fs=require('fs');var Redis=require(_0xf526('0x5'));var db=require(_0xf526('0x6'))['db'];var utils=require(_0xf526('0x7'));var logger=require(_0xf526('0x8'))('rpc');var config=require(_0xf526('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf526('0xa')][_0xf526('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8f322a,_0x201ee1,_0x47669c){return new BPromise(function(_0x58b92e,_0x30af47){return client[_0xf526('0xc')](_0x8f322a,_0x47669c)[_0xf526('0xd')](function(_0x4cc90f){logger[_0xf526('0xe')](_0xf526('0xf'),_0x201ee1,'request\x20sent');logger[_0xf526('0x10')](_0xf526('0x11'),_0x201ee1,_0xf526('0x12'),JSON['stringify'](_0x4cc90f));if(_0x4cc90f[_0xf526('0x13')]){if(_0x4cc90f[_0xf526('0x13')]['code']===0x1f4){logger[_0xf526('0x13')](_0xf526('0xf'),_0x201ee1,_0x4cc90f['error']['message']);return _0x30af47(_0x4cc90f['error'][_0xf526('0x14')]);}logger[_0xf526('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x201ee1,_0x4cc90f[_0xf526('0x13')][_0xf526('0x14')]);return _0x58b92e(_0x4cc90f['error'][_0xf526('0x14')]);}else{logger[_0xf526('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x201ee1,'request\x20sent');_0x58b92e(_0x4cc90f[_0xf526('0x15')][_0xf526('0x14')]);}})[_0xf526('0x16')](function(_0x4305d4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x201ee1,_0x4305d4);_0x30af47(_0x4305d4);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 10844b0..5fc09b2 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 _0x0a9a=['create','addConfiguration','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x2b343d,_0x3ac347){var _0x375b5a=function(_0x4e3a54){while(--_0x4e3a54){_0x2b343d['push'](_0x2b343d['shift']());}};_0x375b5a(++_0x3ac347);}(_0x0a9a,0x183));var _0xa0a9=function(_0x309983,_0x4b05f9){_0x309983=_0x309983-0x0;var _0x58afa3=_0x0a9a[_0x309983];return _0x58afa3;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/:id',auth[_0xa0a9('0x8')](),controller['show']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['get'](_0xa0a9('0xc'),auth[_0xa0a9('0x8')](),controller['getFields']);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['post'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);router['put'](_0xa0a9('0xf'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x10')]);router[_0xa0a9('0x11')](_0xa0a9('0xf'),auth['isAuthenticated'](),controller[_0xa0a9('0x12')]);module[_0xa0a9('0x13')]=router; \ No newline at end of file +var _0xcbdd=['create','addConfiguration','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post'];(function(_0x496452,_0x312cfb){var _0x56cdad=function(_0x2e3b76){while(--_0x2e3b76){_0x496452['push'](_0x496452['shift']());}};_0x56cdad(++_0x312cfb);}(_0xcbdd,0xec));var _0xdcbd=function(_0x2a0a73,_0x50b2c6){_0x2a0a73=_0x2a0a73-0x0;var _0x5e5069=_0xcbdd[_0x2a0a73];return _0x5e5069;};'use strict';var multer=require(_0xdcbd('0x0'));var util=require('util');var path=require(_0xdcbd('0x1'));var timeout=require(_0xdcbd('0x2'));var express=require(_0xdcbd('0x3'));var router=express['Router']();var fs_extra=require(_0xdcbd('0x4'));var auth=require(_0xdcbd('0x5'));var interaction=require(_0xdcbd('0x6'));var config=require('../../config/environment');var controller=require(_0xdcbd('0x7'));router['get']('/',auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x9')]);router[_0xdcbd('0xa')](_0xdcbd('0xb'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0xc')]);router[_0xdcbd('0xa')](_0xdcbd('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xdcbd('0xa')](_0xdcbd('0xe'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0xf')]);router[_0xdcbd('0x10')]('/',auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x11')]);router[_0xdcbd('0x10')](_0xdcbd('0xd'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x12')]);router[_0xdcbd('0x13')](_0xdcbd('0xb'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x14')]);router[_0xdcbd('0x15')](_0xdcbd('0xb'),auth[_0xdcbd('0x8')](),controller[_0xdcbd('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4f6d87e..dd4c39e 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 _0xdfff=['exports','STRING','HelpDesk','sequelize'];(function(_0x16abcb,_0xa2e27e){var _0x41ab6f=function(_0xa17a1a){while(--_0xa17a1a){_0x16abcb['push'](_0x16abcb['shift']());}};_0x41ab6f(++_0xa2e27e);}(_0xdfff,0x93));var _0xfdff=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfff[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xfdff('0x0'));module[_0xfdff('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xfdff('0x2')],'allowNull':![],'defaultValue':_0xfdff('0x3')},'remoteUri':{'type':Sequelize[_0xfdff('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xfdff('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb9a4=['sequelize','exports','STRING','HelpDesk'];(function(_0x155e9e,_0x3ebf6d){var _0xda54a5=function(_0xb0992f){while(--_0xb0992f){_0x155e9e['push'](_0x155e9e['shift']());}};_0xda54a5(++_0x3ebf6d);}(_0xb9a4,0xcc));var _0x4b9a=function(_0x447a9d,_0x1d8810){_0x447a9d=_0x447a9d-0x0;var _0x373e9b=_0xb9a4[_0x447a9d];return _0x373e9b;};'use strict';var Sequelize=require(_0x4b9a('0x0'));module[_0x4b9a('0x1')]={'name':{'type':Sequelize[_0x4b9a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4b9a('0x2')],'allowNull':![],'defaultValue':_0x4b9a('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4b9a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x4b9a('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 d8e1a6b..ff2232c 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 _0x8b9b=['channel','Descriptions','VtigerField','md5','getFields','remoteUri','accessKey','username','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','success','login','token','GET','describe','sessionName','autogenerated','reference','remove','result','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','getConfigurations','findOne','VtigerConfiguration','order','pick','Subjects','getSubjects'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x8b9b,0x184));var _0xb8b9=function(_0x507458,_0x1096bf){_0x507458=_0x507458-0x0;var _0x5f43ad=_0x8b9b[_0x507458];return _0x5f43ad;};'use strict';var emlformat=require(_0xb8b9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb8b9('0x1'));var rp=require(_0xb8b9('0x2'));var moment=require(_0xb8b9('0x3'));var BPromise=require(_0xb8b9('0x4'));var Mustache=require('mustache');var util=require(_0xb8b9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb8b9('0x6'));var ejs=require(_0xb8b9('0x7'));var fs=require('fs');var fs_extra=require(_0xb8b9('0x8'));var _=require(_0xb8b9('0x9'));var squel=require(_0xb8b9('0xa'));var crypto=require('crypto');var jsforce=require(_0xb8b9('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8b9('0xc'));var Papa=require('papaparse');var Redis=require(_0xb8b9('0xd'));var authService=require(_0xb8b9('0xe'));var qs=require(_0xb8b9('0xf'));var as=require(_0xb8b9('0x10'));var hardwareService=require(_0xb8b9('0x11'));var logger=require(_0xb8b9('0x12'))(_0xb8b9('0x13'));var utils=require(_0xb8b9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb8b9('0x15'));var db=require(_0xb8b9('0x16'))['db'];var integrations=require(_0xb8b9('0x17'));function respondWithStatusCode(_0x159421,_0x2e474d){_0x2e474d=_0x2e474d||0xcc;return function(_0x24ae21){if(_0x24ae21){return _0x159421['sendStatus'](_0x2e474d);}return _0x159421[_0xb8b9('0x18')](_0x2e474d)[_0xb8b9('0x19')]();};}function respondWithResult(_0x21bb79,_0x245114){_0x245114=_0x245114||0xc8;return function(_0x520cb1){if(_0x520cb1){return _0x21bb79[_0xb8b9('0x18')](_0x245114)['json'](_0x520cb1);}};}function respondWithFilteredResult(_0x3bd32f,_0x2cd766){return function(_0x26c8d3){if(_0x26c8d3){var _0x4aa70a=typeof _0x2cd766[_0xb8b9('0x1a')]===_0xb8b9('0x1b')&&typeof _0x2cd766[_0xb8b9('0x1c')]===_0xb8b9('0x1b');var _0x4fc10e=_0x26c8d3['count'];var _0x34fead=_0x4aa70a?0x0:_0x2cd766[_0xb8b9('0x1a')];var _0x35914a=_0x4aa70a?_0x26c8d3[_0xb8b9('0x1d')]:_0x2cd766['offset']+_0x2cd766['limit'];var _0x1cdeaa;if(_0x35914a>=_0x4fc10e){_0x35914a=_0x4fc10e;_0x1cdeaa=0xc8;}else{_0x1cdeaa=0xce;}_0x3bd32f['status'](_0x1cdeaa);return _0x3bd32f['set'](_0xb8b9('0x1e'),_0x34fead+'-'+_0x35914a+'/'+_0x4fc10e)['json'](_0x26c8d3);}return null;};}function patchUpdates(_0x362b88){return function(_0x4e8fd4){try{jsonpatch[_0xb8b9('0x1f')](_0x4e8fd4,_0x362b88,!![]);}catch(_0x55c6c7){return BPromise[_0xb8b9('0x20')](_0x55c6c7);}return _0x4e8fd4[_0xb8b9('0x21')]();};}function saveUpdates(_0x4aa9d3,_0x3cd70b){return function(_0x17ae80){if(_0x17ae80){return _0x17ae80[_0xb8b9('0x22')](_0x4aa9d3)[_0xb8b9('0x23')](function(_0x2d9ce6){return _0x2d9ce6;});}return null;};}function removeEntity(_0xb03c8f,_0x25cb08){return function(_0x59098b){if(_0x59098b){return _0x59098b[_0xb8b9('0x24')]()[_0xb8b9('0x23')](function(){_0xb03c8f[_0xb8b9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4c1c2,_0x48fada){return function(_0x263fe6){if(!_0x263fe6){_0xc4c1c2[_0xb8b9('0x25')](0x194);}return _0x263fe6;};}function handleError(_0x148339,_0x2a4314){_0x2a4314=_0x2a4314||0x1f4;return function(_0x3f1072){logger[_0xb8b9('0x26')](_0x3f1072[_0xb8b9('0x27')]);if(_0x3f1072[_0xb8b9('0x28')]){delete _0x3f1072['name'];}_0x148339['status'](_0x2a4314)[_0xb8b9('0x29')](_0x3f1072);};}exports[_0xb8b9('0x2a')]=function(_0x527afb,_0x391719){var _0x20e589={},_0x1a89f7={},_0x5c9dd3={'count':0x0,'rows':[]};var _0x5368e=_[_0xb8b9('0x2b')](db[_0xb8b9('0x2c')]['rawAttributes'],function(_0xfb6db6){return{'name':_0xfb6db6[_0xb8b9('0x2d')],'type':_0xfb6db6[_0xb8b9('0x2e')]['key']};});_0x1a89f7[_0xb8b9('0x2f')]=_[_0xb8b9('0x2b')](_0x5368e,'name');_0x1a89f7[_0xb8b9('0x30')]=_[_0xb8b9('0x31')](_0x527afb[_0xb8b9('0x30')]);_0x1a89f7[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0x1a89f7['model'],_0x1a89f7['query']);_0x20e589[_0xb8b9('0x34')]=_[_0xb8b9('0x33')](_0x1a89f7[_0xb8b9('0x2f')],qs['fields'](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x20e589[_0xb8b9('0x34')]=_0x20e589[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x20e589[_0xb8b9('0x34')]:_0x1a89f7[_0xb8b9('0x2f')];if(!_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x37')](_0xb8b9('0x38'))){_0x20e589['limit']=qs[_0xb8b9('0x1c')](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x1c')]);_0x20e589['offset']=qs['offset'](_0x527afb[_0xb8b9('0x30')]['offset']);}_0x20e589['order']=qs[_0xb8b9('0x39')](_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x39')]);_0x20e589[_0xb8b9('0x3a')]=qs[_0xb8b9('0x32')](_['pick'](_0x527afb['query'],_0x1a89f7[_0xb8b9('0x32')]),_0x5368e);if(_0x527afb[_0xb8b9('0x30')]['filter']){_0x20e589['where']=_[_0xb8b9('0x3b')](_0x20e589['where'],{'$or':_[_0xb8b9('0x2b')](_0x5368e,function(_0x10d42c){if(_0x10d42c[_0xb8b9('0x2e')]!==_0xb8b9('0x3c')){var _0x5eb57e={};_0x5eb57e[_0x10d42c[_0xb8b9('0x28')]]={'$like':'%'+_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x3d')]+'%'};return _0x5eb57e;}})});}_0x20e589=_[_0xb8b9('0x3b')]({},_0x20e589,_0x527afb['options']);var _0x32a035={'where':_0x20e589['where']};return db[_0xb8b9('0x2c')][_0xb8b9('0x1d')](_0x32a035)[_0xb8b9('0x23')](function(_0x16e7ae){_0x5c9dd3[_0xb8b9('0x1d')]=_0x16e7ae;if(_0x527afb[_0xb8b9('0x30')][_0xb8b9('0x3e')]){_0x20e589[_0xb8b9('0x3f')]=[{'all':!![]}];}return db['VtigerAccount'][_0xb8b9('0x40')](_0x20e589);})[_0xb8b9('0x23')](function(_0x5bf34e){_0x5c9dd3['rows']=_0x5bf34e;return _0x5c9dd3;})[_0xb8b9('0x23')](respondWithFilteredResult(_0x391719,_0x20e589))[_0xb8b9('0x41')](handleError(_0x391719,null));};exports[_0xb8b9('0x42')]=function(_0x510461,_0x310965){var _0x159196={'raw':![],'where':{'id':_0x510461[_0xb8b9('0x43')]['id']}},_0x493bac={};_0x493bac[_0xb8b9('0x2f')]=_['keys'](db[_0xb8b9('0x2c')][_0xb8b9('0x44')]);_0x493bac[_0xb8b9('0x30')]=_['keys'](_0x510461[_0xb8b9('0x30')]);_0x493bac[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0x493bac[_0xb8b9('0x2f')],_0x493bac[_0xb8b9('0x30')]);_0x159196[_0xb8b9('0x34')]=_[_0xb8b9('0x33')](_0x493bac[_0xb8b9('0x2f')],qs['fields'](_0x510461[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x159196[_0xb8b9('0x34')]=_0x159196[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x159196[_0xb8b9('0x34')]:_0x493bac[_0xb8b9('0x2f')];if(_0x510461[_0xb8b9('0x30')][_0xb8b9('0x3e')]){_0x159196[_0xb8b9('0x3f')]=[{'all':!![]}];}_0x159196=_[_0xb8b9('0x3b')]({},_0x159196,_0x510461[_0xb8b9('0x45')]);return db[_0xb8b9('0x2c')][_0xb8b9('0x46')](_0x159196)['then'](handleEntityNotFound(_0x310965,null))[_0xb8b9('0x23')](respondWithResult(_0x310965,null))[_0xb8b9('0x41')](handleError(_0x310965,null));};exports['create']=function(_0x509e6b,_0x1896db){return db[_0xb8b9('0x2c')][_0xb8b9('0x47')](_0x509e6b[_0xb8b9('0x48')],{})['then'](respondWithResult(_0x1896db,0xc9))['catch'](handleError(_0x1896db,null));};exports[_0xb8b9('0x22')]=function(_0x2f0903,_0x3595f9){if(_0x2f0903['body']['id']){delete _0x2f0903[_0xb8b9('0x48')]['id'];}return db['VtigerAccount'][_0xb8b9('0x46')]({'where':{'id':_0x2f0903[_0xb8b9('0x43')]['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x3595f9,null))[_0xb8b9('0x23')](saveUpdates(_0x2f0903[_0xb8b9('0x48')],null))[_0xb8b9('0x23')](respondWithResult(_0x3595f9,null))[_0xb8b9('0x41')](handleError(_0x3595f9,null));};exports[_0xb8b9('0x24')]=function(_0x6fb688,_0x2f5b68){return db[_0xb8b9('0x2c')][_0xb8b9('0x46')]({'where':{'id':_0x6fb688[_0xb8b9('0x43')]['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x2f5b68,null))[_0xb8b9('0x23')](removeEntity(_0x2f5b68,null))[_0xb8b9('0x41')](handleError(_0x2f5b68,null));};exports[_0xb8b9('0x49')]=function(_0x1e3723,_0x338d28,_0x3c721d){var _0x281563={};var _0xc61c54={};var _0x190ee9;var _0x3225bf;return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x1e3723['params']['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x338d28,null))[_0xb8b9('0x23')](function(_0xebd946){if(_0xebd946){_0x190ee9=_0xebd946;_0xc61c54['model']=_[_0xb8b9('0x31')](db[_0xb8b9('0x4b')][_0xb8b9('0x44')]);_0xc61c54[_0xb8b9('0x30')]=_['keys'](_0x1e3723[_0xb8b9('0x30')]);_0xc61c54[_0xb8b9('0x32')]=_[_0xb8b9('0x33')](_0xc61c54[_0xb8b9('0x2f')],_0xc61c54['query']);_0x281563[_0xb8b9('0x34')]=_['intersection'](_0xc61c54[_0xb8b9('0x2f')],qs[_0xb8b9('0x35')](_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x35')]));_0x281563['attributes']=_0x281563[_0xb8b9('0x34')][_0xb8b9('0x36')]?_0x281563['attributes']:_0xc61c54['model'];_0x281563[_0xb8b9('0x4c')]=qs[_0xb8b9('0x39')](_0x1e3723[_0xb8b9('0x30')]['sort']);_0x281563['where']=qs[_0xb8b9('0x32')](_[_0xb8b9('0x4d')](_0x1e3723[_0xb8b9('0x30')],_0xc61c54[_0xb8b9('0x32')]));if(_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x3d')]){_0x281563[_0xb8b9('0x3a')]=_[_0xb8b9('0x3b')](_0x281563[_0xb8b9('0x3a')],{'$or':_[_0xb8b9('0x2b')](_0x281563[_0xb8b9('0x34')],function(_0xbf577f){var _0x166a4e={};_0x166a4e[_0xbf577f]={'$like':'%'+_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x3d')]+'%'};return _0x166a4e;})});}_0x281563=_[_0xb8b9('0x3b')]({},_0x281563,_0x1e3723[_0xb8b9('0x45')]);return _0x190ee9['getConfigurations'](_0x281563);}})[_0xb8b9('0x23')](function(_0x254f3){if(_0x254f3){_0x3225bf=_0x254f3[_0xb8b9('0x36')];if(!_0x1e3723[_0xb8b9('0x30')][_0xb8b9('0x37')]('nolimit')){_0x281563['limit']=qs[_0xb8b9('0x1c')](_0x1e3723['query'][_0xb8b9('0x1c')]);_0x281563[_0xb8b9('0x1a')]=qs[_0xb8b9('0x1a')](_0x1e3723[_0xb8b9('0x30')]['offset']);}return _0x190ee9[_0xb8b9('0x49')](_0x281563);}})[_0xb8b9('0x23')](function(_0x5939d4){if(_0x5939d4){return _0x5939d4?{'count':_0x3225bf,'rows':_0x5939d4}:null;}})[_0xb8b9('0x23')](respondWithResult(_0x338d28,null))[_0xb8b9('0x41')](handleError(_0x338d28,null));};exports['addConfiguration']=function(_0x81dffc,_0x5354c9,_0x255e5c){if(_0x81dffc[_0xb8b9('0x48')]['id']){delete _0x81dffc[_0xb8b9('0x48')]['id'];}return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x81dffc['params']['id']}})[_0xb8b9('0x23')](handleEntityNotFound(_0x5354c9,null))['then'](function(_0x167f53){if(_0x167f53){_0x81dffc[_0xb8b9('0x48')]['AccountId']=_0x167f53['id'];_0x81dffc['body'][_0xb8b9('0x4e')]=integrations[_0xb8b9('0x4f')](_0x81dffc[_0xb8b9('0x48')][_0xb8b9('0x50')],_0x81dffc[_0xb8b9('0x48')]['type']);_0x81dffc['body'][_0xb8b9('0x51')]=integrations['getDescriptions'](_0x81dffc[_0xb8b9('0x48')][_0xb8b9('0x50')],_0x81dffc['body'][_0xb8b9('0x2e')]);return db['VtigerConfiguration']['create'](_0x81dffc[_0xb8b9('0x48')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xb8b9('0x52')],'as':_0xb8b9('0x51')}]});}return null;})[_0xb8b9('0x23')](respondWithResult(_0x5354c9,null))[_0xb8b9('0x41')](handleError(_0x5354c9,null));};var md5=require(_0xb8b9('0x53'));exports[_0xb8b9('0x54')]=function(_0x31a64e,_0x1852ce,_0xd22923){var _0x506e54=null;var _0xa2d8e0=null;var _0x4f9d1f=null;var _0x19f5fb=null;var _0x25ccf8='';return db[_0xb8b9('0x2c')][_0xb8b9('0x4a')]({'where':{'id':_0x31a64e[_0xb8b9('0x43')]['id']},'attributes':['id',_0xb8b9('0x28'),'username','description','moduleName',_0xb8b9('0x55'),'serverUrl',_0xb8b9('0x56')]})['then'](handleEntityNotFound(_0x1852ce,null))[_0xb8b9('0x23')](function(_0x40a209){if(_0x40a209){_0x506e54=_0x40a209[_0xb8b9('0x57')];_0xa2d8e0=_0x40a209[_0xb8b9('0x56')];_0x4f9d1f=_0x40a209['moduleName'];_0x25ccf8=_0x40a209['remoteUri'];var _0x148ebd=_0x25ccf8[_0xb8b9('0x58')](-0x1);if(_0x148ebd==='/'){_0x25ccf8=_0x25ccf8[_0xb8b9('0x59')](0x0,_0x25ccf8[_0xb8b9('0x5a')](_0x148ebd));}_0x19f5fb=util['format'](_0xb8b9('0x5b'),_0x25ccf8);var _0x4f080d={'method':'GET','uri':_0x19f5fb,'qs':{'operation':_0xb8b9('0x5c'),'username':_0x40a209[_0xb8b9('0x57')]},'json':!![]};return rp(_0x4f080d);}})[_0xb8b9('0x23')](function(_0x4ba61c){if(_0x4ba61c[_0xb8b9('0x5d')]){var _0x26ea1d={'method':'POST','uri':_0x19f5fb,'form':{'operation':_0xb8b9('0x5e'),'username':_0x506e54,'accessKey':md5(_0x4ba61c['result'][_0xb8b9('0x5f')]+_0xa2d8e0)},'json':!![]};return rp(_0x26ea1d);}})['then'](function(_0xccf7ed){if(_0xccf7ed['success']){var _0x3db9ff={'method':_0xb8b9('0x60'),'uri':_0x19f5fb,'qs':{'operation':_0xb8b9('0x61'),'username':_0x506e54,'sessionName':_0xccf7ed['result'][_0xb8b9('0x62')],'elementType':_0x4f9d1f},'json':!![]};return rp(_0x3db9ff);}})['then'](function(_0x2920e1){if(_0x2920e1[_0xb8b9('0x5d')]){var _0x51d9f4=[_0xb8b9('0x63'),_0xb8b9('0x64'),'owner'];_[_0xb8b9('0x65')](_0x2920e1[_0xb8b9('0x66')]['fields'],function(_0x216876){return _0x51d9f4[_0xb8b9('0x67')](_0x216876['type'][_0xb8b9('0x28')]);});_[_0xb8b9('0x65')](_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')],function(_0x4fc8c7){return _0x4fc8c7[_0xb8b9('0x68')]===_0xb8b9('0x69');});return{'count':_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')][_0xb8b9('0x36')],'rows':_['map'](_0x2920e1[_0xb8b9('0x66')][_0xb8b9('0x35')],function(_0x42450e){return{'id':_0x42450e[_0xb8b9('0x28')],'name':_0x42450e[_0xb8b9('0x6a')],'custom':_[_0xb8b9('0x6b')](_0x42450e['name'],_0xb8b9('0x6c'))?!![]:![],'options':_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x28')]===_0xb8b9('0x6d')&&_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x6e')][_0xb8b9('0x36')]>0x0?_['map'](_0x42450e[_0xb8b9('0x2e')][_0xb8b9('0x6e')],function(_0x566f97){return{'name':_0x566f97['label'],'value':_0x566f97['value']};}):[]};})};}})[_0xb8b9('0x23')](respondWithResult(_0x1852ce,null))['catch'](function(_0x2d2458){console['log'](_0xb8b9('0x6f')+_0x2d2458);var _0x6f02e1=_0x31a64e[_0xb8b9('0x30')]['test']?0x1f4:_0x2d2458[_0xb8b9('0x70')]||0x1f4;logger['error'](_0xb8b9('0x71'),_0xb8b9('0x54'),_0x6f02e1,JSON[_0xb8b9('0x72')](_0x2d2458));delete _0x2d2458[_0xb8b9('0x28')];if(_0x6f02e1===0x191){_0x6f02e1=0x190;}_0x1852ce[_0xb8b9('0x18')](_0x6f02e1)[_0xb8b9('0x29')](_0x31a64e[_0xb8b9('0x30')][_0xb8b9('0x73')]?{'message':_0xb8b9('0x74'),'statusCode':_0x2d2458[_0xb8b9('0x70')]}:_0x2d2458);});}; \ No newline at end of file +var _0x9269=['find','create','body','getConfigurations','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','getchallenge','login','result','token','success','GET','describe','sessionName','autogenerated','owner','remove','label','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','include'];(function(_0x3b3f4f,_0x403216){var _0x174dbe=function(_0x30e333){while(--_0x30e333){_0x3b3f4f['push'](_0x3b3f4f['shift']());}};_0x174dbe(++_0x403216);}(_0x9269,0x18f));var _0x9926=function(_0x30f87a,_0x2cce5a){_0x30f87a=_0x30f87a-0x0;var _0x3a8efc=_0x9269[_0x30f87a];return _0x3a8efc;};'use strict';var emlformat=require(_0x9926('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9926('0x1'));var jsonpatch=require(_0x9926('0x2'));var rp=require('request-promise');var moment=require(_0x9926('0x3'));var BPromise=require(_0x9926('0x4'));var Mustache=require(_0x9926('0x5'));var util=require(_0x9926('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9926('0x7'));var ejs=require(_0x9926('0x8'));var fs=require('fs');var fs_extra=require(_0x9926('0x9'));var _=require(_0x9926('0xa'));var squel=require(_0x9926('0xb'));var crypto=require(_0x9926('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9926('0xd'));var toCsv=require(_0x9926('0x7'));var querystring=require(_0x9926('0xe'));var Papa=require('papaparse');var Redis=require(_0x9926('0xf'));var authService=require(_0x9926('0x10'));var qs=require(_0x9926('0x11'));var as=require(_0x9926('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9926('0x13'))(_0x9926('0x14'));var utils=require(_0x9926('0x15'));var config=require(_0x9926('0x16'));var licenseUtil=require(_0x9926('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x9926('0x18'));function respondWithStatusCode(_0x1dcb9b,_0x28e39d){_0x28e39d=_0x28e39d||0xcc;return function(_0x519b5a){if(_0x519b5a){return _0x1dcb9b[_0x9926('0x19')](_0x28e39d);}return _0x1dcb9b[_0x9926('0x1a')](_0x28e39d)[_0x9926('0x1b')]();};}function respondWithResult(_0x32b15b,_0x2c3c67){_0x2c3c67=_0x2c3c67||0xc8;return function(_0x1bcd79){if(_0x1bcd79){return _0x32b15b[_0x9926('0x1a')](_0x2c3c67)[_0x9926('0x1c')](_0x1bcd79);}};}function respondWithFilteredResult(_0x2522bb,_0x2394df){return function(_0x1e6b4f){if(_0x1e6b4f){var _0x1ed780=typeof _0x2394df['offset']===_0x9926('0x1d')&&typeof _0x2394df['limit']===_0x9926('0x1d');var _0x344e9a=_0x1e6b4f['count'];var _0x32519c=_0x1ed780?0x0:_0x2394df[_0x9926('0x1e')];var _0x5d2fed=_0x1ed780?_0x1e6b4f[_0x9926('0x1f')]:_0x2394df[_0x9926('0x1e')]+_0x2394df[_0x9926('0x20')];var _0x218193;if(_0x5d2fed>=_0x344e9a){_0x5d2fed=_0x344e9a;_0x218193=0xc8;}else{_0x218193=0xce;}_0x2522bb[_0x9926('0x1a')](_0x218193);return _0x2522bb[_0x9926('0x21')](_0x9926('0x22'),_0x32519c+'-'+_0x5d2fed+'/'+_0x344e9a)[_0x9926('0x1c')](_0x1e6b4f);}return null;};}function patchUpdates(_0x2a7005){return function(_0x3949f0){try{jsonpatch['apply'](_0x3949f0,_0x2a7005,!![]);}catch(_0x4258b5){return BPromise[_0x9926('0x23')](_0x4258b5);}return _0x3949f0[_0x9926('0x24')]();};}function saveUpdates(_0x236ac3,_0x5a168d){return function(_0x2985e9){if(_0x2985e9){return _0x2985e9[_0x9926('0x25')](_0x236ac3)[_0x9926('0x26')](function(_0x488713){return _0x488713;});}return null;};}function removeEntity(_0x4f0f9a,_0x4309ab){return function(_0x358251){if(_0x358251){return _0x358251[_0x9926('0x27')]()[_0x9926('0x26')](function(){_0x4f0f9a[_0x9926('0x1a')](0xcc)[_0x9926('0x1b')]();});}};}function handleEntityNotFound(_0x3ddb4e,_0x54e064){return function(_0x151687){if(!_0x151687){_0x3ddb4e[_0x9926('0x19')](0x194);}return _0x151687;};}function handleError(_0x568e0a,_0xdf1412){_0xdf1412=_0xdf1412||0x1f4;return function(_0x369c0a){logger[_0x9926('0x28')](_0x369c0a['stack']);if(_0x369c0a[_0x9926('0x29')]){delete _0x369c0a['name'];}_0x568e0a['status'](_0xdf1412)[_0x9926('0x2a')](_0x369c0a);};}exports[_0x9926('0x2b')]=function(_0x550e29,_0x97a489){var _0x2c30cb={},_0x1dd0ab={},_0x233441={'count':0x0,'rows':[]};var _0x480143=_[_0x9926('0x2c')](db[_0x9926('0x2d')]['rawAttributes'],function(_0x5c302a){return{'name':_0x5c302a[_0x9926('0x2e')],'type':_0x5c302a[_0x9926('0x2f')][_0x9926('0x30')]};});_0x1dd0ab[_0x9926('0x31')]=_['map'](_0x480143,_0x9926('0x29'));_0x1dd0ab[_0x9926('0x32')]=_[_0x9926('0x33')](_0x550e29[_0x9926('0x32')]);_0x1dd0ab[_0x9926('0x34')]=_[_0x9926('0x35')](_0x1dd0ab['model'],_0x1dd0ab[_0x9926('0x32')]);_0x2c30cb[_0x9926('0x36')]=_['intersection'](_0x1dd0ab[_0x9926('0x31')],qs[_0x9926('0x37')](_0x550e29[_0x9926('0x32')][_0x9926('0x37')]));_0x2c30cb[_0x9926('0x36')]=_0x2c30cb[_0x9926('0x36')][_0x9926('0x38')]?_0x2c30cb[_0x9926('0x36')]:_0x1dd0ab[_0x9926('0x31')];if(!_0x550e29['query'][_0x9926('0x39')](_0x9926('0x3a'))){_0x2c30cb['limit']=qs[_0x9926('0x20')](_0x550e29[_0x9926('0x32')]['limit']);_0x2c30cb[_0x9926('0x1e')]=qs[_0x9926('0x1e')](_0x550e29[_0x9926('0x32')][_0x9926('0x1e')]);}_0x2c30cb[_0x9926('0x3b')]=qs[_0x9926('0x3c')](_0x550e29[_0x9926('0x32')][_0x9926('0x3c')]);_0x2c30cb[_0x9926('0x3d')]=qs[_0x9926('0x34')](_[_0x9926('0x3e')](_0x550e29[_0x9926('0x32')],_0x1dd0ab[_0x9926('0x34')]),_0x480143);if(_0x550e29['query'][_0x9926('0x3f')]){_0x2c30cb['where']=_[_0x9926('0x40')](_0x2c30cb[_0x9926('0x3d')],{'$or':_[_0x9926('0x2c')](_0x480143,function(_0x10e975){if(_0x10e975[_0x9926('0x2f')]!=='VIRTUAL'){var _0x560a8d={};_0x560a8d[_0x10e975['name']]={'$like':'%'+_0x550e29[_0x9926('0x32')][_0x9926('0x3f')]+'%'};return _0x560a8d;}})});}_0x2c30cb=_[_0x9926('0x40')]({},_0x2c30cb,_0x550e29[_0x9926('0x41')]);var _0x284604={'where':_0x2c30cb[_0x9926('0x3d')]};return db['VtigerAccount'][_0x9926('0x1f')](_0x284604)['then'](function(_0x908b46){_0x233441[_0x9926('0x1f')]=_0x908b46;if(_0x550e29[_0x9926('0x32')][_0x9926('0x42')]){_0x2c30cb['include']=[{'all':!![]}];}return db['VtigerAccount'][_0x9926('0x43')](_0x2c30cb);})[_0x9926('0x26')](function(_0x24dbf4){_0x233441['rows']=_0x24dbf4;return _0x233441;})['then'](respondWithFilteredResult(_0x97a489,_0x2c30cb))[_0x9926('0x44')](handleError(_0x97a489,null));};exports[_0x9926('0x45')]=function(_0x19f8e1,_0x56b1ed){var _0x194a13={'raw':![],'where':{'id':_0x19f8e1[_0x9926('0x46')]['id']}},_0xfc6f71={};_0xfc6f71[_0x9926('0x31')]=_[_0x9926('0x33')](db[_0x9926('0x2d')][_0x9926('0x47')]);_0xfc6f71[_0x9926('0x32')]=_[_0x9926('0x33')](_0x19f8e1[_0x9926('0x32')]);_0xfc6f71['filters']=_[_0x9926('0x35')](_0xfc6f71[_0x9926('0x31')],_0xfc6f71['query']);_0x194a13[_0x9926('0x36')]=_['intersection'](_0xfc6f71['model'],qs[_0x9926('0x37')](_0x19f8e1[_0x9926('0x32')]['fields']));_0x194a13[_0x9926('0x36')]=_0x194a13[_0x9926('0x36')][_0x9926('0x38')]?_0x194a13['attributes']:_0xfc6f71[_0x9926('0x31')];if(_0x19f8e1[_0x9926('0x32')][_0x9926('0x42')]){_0x194a13[_0x9926('0x48')]=[{'all':!![]}];}_0x194a13=_[_0x9926('0x40')]({},_0x194a13,_0x19f8e1[_0x9926('0x41')]);return db[_0x9926('0x2d')][_0x9926('0x49')](_0x194a13)[_0x9926('0x26')](handleEntityNotFound(_0x56b1ed,null))[_0x9926('0x26')](respondWithResult(_0x56b1ed,null))[_0x9926('0x44')](handleError(_0x56b1ed,null));};exports[_0x9926('0x4a')]=function(_0x5c80b2,_0x163cc1){return db['VtigerAccount']['create'](_0x5c80b2[_0x9926('0x4b')],{})[_0x9926('0x26')](respondWithResult(_0x163cc1,0xc9))[_0x9926('0x44')](handleError(_0x163cc1,null));};exports[_0x9926('0x25')]=function(_0x2e8c73,_0x174d68){if(_0x2e8c73['body']['id']){delete _0x2e8c73['body']['id'];}return db['VtigerAccount'][_0x9926('0x49')]({'where':{'id':_0x2e8c73['params']['id']}})[_0x9926('0x26')](handleEntityNotFound(_0x174d68,null))[_0x9926('0x26')](saveUpdates(_0x2e8c73[_0x9926('0x4b')],null))[_0x9926('0x26')](respondWithResult(_0x174d68,null))[_0x9926('0x44')](handleError(_0x174d68,null));};exports[_0x9926('0x27')]=function(_0x143f9e,_0x2908a4){return db[_0x9926('0x2d')]['find']({'where':{'id':_0x143f9e['params']['id']}})[_0x9926('0x26')](handleEntityNotFound(_0x2908a4,null))[_0x9926('0x26')](removeEntity(_0x2908a4,null))[_0x9926('0x44')](handleError(_0x2908a4,null));};exports[_0x9926('0x4c')]=function(_0xd5516f,_0x146318,_0x2417ce){var _0xdb2298={};var _0x1c99c5={};var _0x3b98a1;var _0xc486af;return db[_0x9926('0x2d')]['findOne']({'where':{'id':_0xd5516f[_0x9926('0x46')]['id']}})[_0x9926('0x26')](handleEntityNotFound(_0x146318,null))[_0x9926('0x26')](function(_0x10798c){if(_0x10798c){_0x3b98a1=_0x10798c;_0x1c99c5['model']=_[_0x9926('0x33')](db[_0x9926('0x4d')][_0x9926('0x47')]);_0x1c99c5['query']=_[_0x9926('0x33')](_0xd5516f[_0x9926('0x32')]);_0x1c99c5[_0x9926('0x34')]=_[_0x9926('0x35')](_0x1c99c5[_0x9926('0x31')],_0x1c99c5[_0x9926('0x32')]);_0xdb2298[_0x9926('0x36')]=_[_0x9926('0x35')](_0x1c99c5['model'],qs[_0x9926('0x37')](_0xd5516f[_0x9926('0x32')][_0x9926('0x37')]));_0xdb2298[_0x9926('0x36')]=_0xdb2298[_0x9926('0x36')][_0x9926('0x38')]?_0xdb2298[_0x9926('0x36')]:_0x1c99c5[_0x9926('0x31')];_0xdb2298[_0x9926('0x3b')]=qs['sort'](_0xd5516f[_0x9926('0x32')]['sort']);_0xdb2298['where']=qs[_0x9926('0x34')](_[_0x9926('0x3e')](_0xd5516f[_0x9926('0x32')],_0x1c99c5[_0x9926('0x34')]));if(_0xd5516f[_0x9926('0x32')][_0x9926('0x3f')]){_0xdb2298[_0x9926('0x3d')]=_[_0x9926('0x40')](_0xdb2298[_0x9926('0x3d')],{'$or':_[_0x9926('0x2c')](_0xdb2298[_0x9926('0x36')],function(_0x3dfc10){var _0x57c254={};_0x57c254[_0x3dfc10]={'$like':'%'+_0xd5516f[_0x9926('0x32')][_0x9926('0x3f')]+'%'};return _0x57c254;})});}_0xdb2298=_[_0x9926('0x40')]({},_0xdb2298,_0xd5516f[_0x9926('0x41')]);return _0x3b98a1[_0x9926('0x4c')](_0xdb2298);}})[_0x9926('0x26')](function(_0x16f6ac){if(_0x16f6ac){_0xc486af=_0x16f6ac['length'];if(!_0xd5516f[_0x9926('0x32')][_0x9926('0x39')](_0x9926('0x3a'))){_0xdb2298[_0x9926('0x20')]=qs[_0x9926('0x20')](_0xd5516f[_0x9926('0x32')][_0x9926('0x20')]);_0xdb2298[_0x9926('0x1e')]=qs['offset'](_0xd5516f['query'][_0x9926('0x1e')]);}return _0x3b98a1[_0x9926('0x4c')](_0xdb2298);}})[_0x9926('0x26')](function(_0x548528){if(_0x548528){return _0x548528?{'count':_0xc486af,'rows':_0x548528}:null;}})['then'](respondWithResult(_0x146318,null))[_0x9926('0x44')](handleError(_0x146318,null));};exports['addConfiguration']=function(_0x5e8d09,_0x1a76f6,_0x146cc6){if(_0x5e8d09['body']['id']){delete _0x5e8d09[_0x9926('0x4b')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x5e8d09[_0x9926('0x46')]['id']}})[_0x9926('0x26')](handleEntityNotFound(_0x1a76f6,null))[_0x9926('0x26')](function(_0x223858){if(_0x223858){_0x5e8d09[_0x9926('0x4b')][_0x9926('0x4e')]=_0x223858['id'];_0x5e8d09['body'][_0x9926('0x4f')]=integrations[_0x9926('0x50')](_0x5e8d09[_0x9926('0x4b')][_0x9926('0x51')],_0x5e8d09['body'][_0x9926('0x2f')]);_0x5e8d09[_0x9926('0x4b')][_0x9926('0x52')]=integrations[_0x9926('0x53')](_0x5e8d09[_0x9926('0x4b')][_0x9926('0x51')],_0x5e8d09[_0x9926('0x4b')][_0x9926('0x2f')]);return db['VtigerConfiguration'][_0x9926('0x4a')](_0x5e8d09[_0x9926('0x4b')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x9926('0x54')],'as':_0x9926('0x52')}]});}return null;})[_0x9926('0x26')](respondWithResult(_0x1a76f6,null))['catch'](handleError(_0x1a76f6,null));};var md5=require(_0x9926('0x55'));exports[_0x9926('0x56')]=function(_0x25a1ce,_0x575305,_0x235ff3){var _0x1f6a21=null;var _0x2e3c51=null;var _0x18e65b=null;var _0xe14533=null;var _0x52b4fb='';return db[_0x9926('0x2d')]['findOne']({'where':{'id':_0x25a1ce[_0x9926('0x46')]['id']},'attributes':['id',_0x9926('0x29'),_0x9926('0x57'),_0x9926('0x58'),_0x9926('0x59'),_0x9926('0x5a'),_0x9926('0x5b'),_0x9926('0x5c')]})[_0x9926('0x26')](handleEntityNotFound(_0x575305,null))['then'](function(_0x4e5bf6){if(_0x4e5bf6){_0x1f6a21=_0x4e5bf6[_0x9926('0x57')];_0x2e3c51=_0x4e5bf6['accessKey'];_0x18e65b=_0x4e5bf6[_0x9926('0x59')];_0x52b4fb=_0x4e5bf6['remoteUri'];var _0x311cd0=_0x52b4fb[_0x9926('0x5d')](-0x1);if(_0x311cd0==='/'){_0x52b4fb=_0x52b4fb[_0x9926('0x5e')](0x0,_0x52b4fb[_0x9926('0x5f')](_0x311cd0));}_0xe14533=util[_0x9926('0x60')]('%s/webservice.php',_0x52b4fb);var _0x12f11e={'method':'GET','uri':_0xe14533,'qs':{'operation':_0x9926('0x61'),'username':_0x4e5bf6[_0x9926('0x57')]},'json':!![]};return rp(_0x12f11e);}})[_0x9926('0x26')](function(_0x54787c){if(_0x54787c['success']){var _0x3e00f3={'method':'POST','uri':_0xe14533,'form':{'operation':_0x9926('0x62'),'username':_0x1f6a21,'accessKey':md5(_0x54787c[_0x9926('0x63')][_0x9926('0x64')]+_0x2e3c51)},'json':!![]};return rp(_0x3e00f3);}})[_0x9926('0x26')](function(_0x3aa9a8){if(_0x3aa9a8[_0x9926('0x65')]){var _0x47a513={'method':_0x9926('0x66'),'uri':_0xe14533,'qs':{'operation':_0x9926('0x67'),'username':_0x1f6a21,'sessionName':_0x3aa9a8[_0x9926('0x63')][_0x9926('0x68')],'elementType':_0x18e65b},'json':!![]};return rp(_0x47a513);}})['then'](function(_0x4f5213){if(_0x4f5213[_0x9926('0x65')]){var _0x552ee8=[_0x9926('0x69'),'reference',_0x9926('0x6a')];_[_0x9926('0x6b')](_0x4f5213[_0x9926('0x63')][_0x9926('0x37')],function(_0x608e40){return _0x552ee8['includes'](_0x608e40[_0x9926('0x2f')][_0x9926('0x29')]);});_[_0x9926('0x6b')](_0x4f5213[_0x9926('0x63')][_0x9926('0x37')],function(_0x83993b){return _0x83993b['editable']==='false';});return{'count':_0x4f5213[_0x9926('0x63')]['fields'][_0x9926('0x38')],'rows':_[_0x9926('0x2c')](_0x4f5213['result']['fields'],function(_0x415f38){return{'id':_0x415f38[_0x9926('0x29')],'name':_0x415f38[_0x9926('0x6c')],'custom':_['startsWith'](_0x415f38[_0x9926('0x29')],_0x9926('0x6d'))?!![]:![],'options':_0x415f38[_0x9926('0x2f')]['name']===_0x9926('0x6e')&&_0x415f38['type'][_0x9926('0x6f')][_0x9926('0x38')]>0x0?_[_0x9926('0x2c')](_0x415f38[_0x9926('0x2f')][_0x9926('0x6f')],function(_0x29e14e){return{'name':_0x29e14e[_0x9926('0x6c')],'value':_0x29e14e[_0x9926('0x70')]};}):[]};})};}})['then'](respondWithResult(_0x575305,null))[_0x9926('0x44')](function(_0x2fbe50){console['log'](_0x9926('0x71')+_0x2fbe50);var _0x2de055=_0x25a1ce[_0x9926('0x32')][_0x9926('0x72')]?0x1f4:_0x2fbe50[_0x9926('0x73')]||0x1f4;logger[_0x9926('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x9926('0x56'),_0x2de055,JSON[_0x9926('0x74')](_0x2fbe50));delete _0x2fbe50[_0x9926('0x29')];if(_0x2de055===0x191){_0x2de055=0x190;}_0x575305[_0x9926('0x1a')](_0x2de055)[_0x9926('0x2a')](_0x25a1ce[_0x9926('0x32')]['test']?{'message':_0x9926('0x75'),'statusCode':_0x2fbe50['statusCode']}:_0x2fbe50);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index ab06cd8..ce5f8c4 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 _0x0c2e=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash'];(function(_0x584bcd,_0x59c4b7){var _0x146bc7=function(_0x20b30d){while(--_0x20b30d){_0x584bcd['push'](_0x584bcd['shift']());}};_0x146bc7(++_0x59c4b7);}(_0x0c2e,0x195));var _0xe0c2=function(_0x4562ac,_0x3df938){_0x4562ac=_0x4562ac-0x0;var _0x484131=_0x0c2e[_0x4562ac];return _0x484131;};'use strict';var _=require(_0xe0c2('0x0'));var util=require(_0xe0c2('0x1'));var logger=require(_0xe0c2('0x2'))(_0xe0c2('0x3'));var moment=require(_0xe0c2('0x4'));var BPromise=require(_0xe0c2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe0c2('0x6'));var rimraf=require(_0xe0c2('0x7'));var config=require(_0xe0c2('0x8'));var attributes=require(_0xe0c2('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xe0c2('0xa')]=function(_0x42a08e,_0x1a8fc5){return _0x42a08e[_0xe0c2('0xb')](_0xe0c2('0xc'),attributes,{'tableName':_0xe0c2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa0f0=['bluebird','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','int_vtiger_accounts','lodash','util','../../config/logger','moment'];(function(_0x7b41be,_0x39c033){var _0xddef84=function(_0x570025){while(--_0x570025){_0x7b41be['push'](_0x7b41be['shift']());}};_0xddef84(++_0x39c033);}(_0xa0f0,0x1c4));var _0x0a0f=function(_0x1e6d68,_0x42f4c3){_0x1e6d68=_0x1e6d68-0x0;var _0x15fe66=_0xa0f0[_0x1e6d68];return _0x15fe66;};'use strict';var _=require(_0x0a0f('0x0'));var util=require(_0x0a0f('0x1'));var logger=require(_0x0a0f('0x2'))('api');var moment=require(_0x0a0f('0x3'));var BPromise=require(_0x0a0f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a0f('0x5'));var config=require(_0x0a0f('0x6'));var attributes=require(_0x0a0f('0x7'));var integrations=require(_0x0a0f('0x8'));module[_0x0a0f('0x9')]=function(_0xb557f4,_0x374a97){return _0xb557f4[_0x0a0f('0xa')]('VtigerAccount',attributes,{'tableName':_0x0a0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 2fff34f..5f23693 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 _0xe205=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','VtigerAccount','options','raw','where','include','map','model','attributes','ShowVtigerAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0xe205,0xa7));var _0x5e20=function(_0x41e600,_0x5b21ff){_0x41e600=_0x41e600-0x0;var _0x20be14=_0xe205[_0x41e600];return _0x20be14;};'use strict';var _=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var moment=require(_0x5e20('0x2'));var BPromise=require(_0x5e20('0x3'));var rs=require(_0x5e20('0x4'));var fs=require('fs');var Redis=require(_0x5e20('0x5'));var db=require(_0x5e20('0x6'))['db'];var utils=require(_0x5e20('0x7'));var logger=require(_0x5e20('0x8'))('rpc');var config=require(_0x5e20('0x9'));var jayson=require(_0x5e20('0xa'));var client=jayson[_0x5e20('0xb')][_0x5e20('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5eca5c,_0x4cc88d,_0x3a382f){return new BPromise(function(_0x4c9332,_0x533e18){return client[_0x5e20('0xd')](_0x5eca5c,_0x3a382f)[_0x5e20('0xe')](function(_0x5c1eee){logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));logger[_0x5e20('0x12')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x4cc88d,_0x5e20('0x11'),JSON[_0x5e20('0x13')](_0x5c1eee));if(_0x5c1eee[_0x5e20('0x14')]){if(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x15')]===0x1f4){logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);return _0x533e18(_0x5c1eee[_0x5e20('0x14')]['message']);}logger[_0x5e20('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4cc88d,_0x5c1eee[_0x5e20('0x14')]['message']);return _0x4c9332(_0x5c1eee[_0x5e20('0x14')][_0x5e20('0x16')]);}else{logger[_0x5e20('0xf')](_0x5e20('0x10'),_0x4cc88d,_0x5e20('0x11'));_0x4c9332(_0x5c1eee['result'][_0x5e20('0x16')]);}})[_0x5e20('0x17')](function(_0x166ffd){logger[_0x5e20('0x14')](_0x5e20('0x10'),_0x4cc88d,_0x166ffd);_0x533e18(_0x166ffd);});});}exports[_0x5e20('0x18')]=function(_0x1cc706){var _0xf3488f=this;return new Promise(function(_0x4d3e4a,_0x434686){return db[_0x5e20('0x19')]['findAll']({'raw':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706['options'][_0x5e20('0x1c')]||null:null,'attributes':_0x1cc706['options']?_0x1cc706['options']['attributes']||null:null,'limit':_0x1cc706['options']?_0x1cc706[_0x5e20('0x1a')]['limit']||null:null,'include':_0x1cc706[_0x5e20('0x1a')]?_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x1cc706[_0x5e20('0x1a')][_0x5e20('0x1d')],function(_0x4c5732){return{'model':db[_0x4c5732[_0x5e20('0x1f')]],'as':_0x4c5732['as'],'attributes':_0x4c5732['attributes'],'include':_0x4c5732['include']?_[_0x5e20('0x1e')](_0x4c5732[_0x5e20('0x1d')],function(_0x2bae08){return{'model':db[_0x2bae08[_0x5e20('0x1f')]],'as':_0x2bae08['as'],'attributes':_0x2bae08[_0x5e20('0x20')],'include':_0x2bae08[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2bae08['include'],function(_0x3bf4f4){return{'model':db[_0x3bf4f4[_0x5e20('0x1f')]],'as':_0x3bf4f4['as'],'attributes':_0x3bf4f4[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5e20('0xe')](function(_0x4c799d){logger[_0x5e20('0xf')](_0x5e20('0x18'),_0x1cc706);logger[_0x5e20('0x12')](_0x5e20('0x18'),_0x1cc706,JSON[_0x5e20('0x13')](_0x4c799d));_0x4d3e4a(_0x4c799d);})[_0x5e20('0x17')](function(_0x5ec45b){logger[_0x5e20('0x14')](_0x5e20('0x18'),_0x5ec45b['message'],_0x1cc706);_0x434686(_0xf3488f[_0x5e20('0x14')](0x1f4,_0x5ec45b[_0x5e20('0x16')]));});});};exports[_0x5e20('0x21')]=function(_0x4196a3){var _0x1548c8=this;return new Promise(function(_0x395a27,_0x4ff715){return db[_0x5e20('0x19')][_0x5e20('0x22')]({'raw':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1b')]===undefined?!![]:![]:!![],'where':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1c')]||null:null,'attributes':_0x4196a3[_0x5e20('0x1a')]?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x20')]||null:null,'include':_0x4196a3['options']?_0x4196a3[_0x5e20('0x1a')][_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x4196a3['options'][_0x5e20('0x1d')],function(_0x2d397b){return{'model':db[_0x2d397b[_0x5e20('0x1f')]],'as':_0x2d397b['as'],'attributes':_0x2d397b[_0x5e20('0x20')],'include':_0x2d397b[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x2d397b[_0x5e20('0x1d')],function(_0x173165){return{'model':db[_0x173165[_0x5e20('0x1f')]],'as':_0x173165['as'],'attributes':_0x173165[_0x5e20('0x20')],'include':_0x173165[_0x5e20('0x1d')]?_[_0x5e20('0x1e')](_0x173165[_0x5e20('0x1d')],function(_0x255b67){return{'model':db[_0x255b67['model']],'as':_0x255b67['as'],'attributes':_0x255b67[_0x5e20('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x549f01){logger[_0x5e20('0xf')](_0x5e20('0x21'),_0x4196a3);logger['debug'](_0x5e20('0x21'),_0x4196a3,JSON[_0x5e20('0x13')](_0x549f01));_0x395a27(_0x549f01);})['catch'](function(_0x3f3908){logger[_0x5e20('0x14')](_0x5e20('0x21'),_0x3f3908[_0x5e20('0x16')],_0x4196a3);_0x4ff715(_0x1548c8[_0x5e20('0x14')](0x1f4,_0x3f3908[_0x5e20('0x16')]));});});}; \ No newline at end of file +var _0xd4f4=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','ShowVtigerAccount','VtigerAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x3772a2,_0xd5e57d){var _0x3d1a63=function(_0x44eb28){while(--_0x44eb28){_0x3772a2['push'](_0x3772a2['shift']());}};_0x3d1a63(++_0xd5e57d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x1b81e8,_0x72c8cf){_0x1b81e8=_0x1b81e8-0x0;var _0x40c946=_0xd4f4[_0x1b81e8];return _0x40c946;};'use strict';var _=require(_0x4d4f('0x0'));var util=require(_0x4d4f('0x1'));var moment=require(_0x4d4f('0x2'));var BPromise=require(_0x4d4f('0x3'));var rs=require(_0x4d4f('0x4'));var fs=require('fs');var Redis=require(_0x4d4f('0x5'));var db=require(_0x4d4f('0x6'))['db'];var utils=require(_0x4d4f('0x7'));var logger=require(_0x4d4f('0x8'))(_0x4d4f('0x9'));var config=require(_0x4d4f('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d7aa8,_0xecc103,_0x150bd6){return new BPromise(function(_0xea29b,_0x40be66){return client[_0x4d4f('0xb')](_0x1d7aa8,_0x150bd6)[_0x4d4f('0xc')](function(_0x226837){logger[_0x4d4f('0xd')](_0x4d4f('0xe'),_0xecc103,_0x4d4f('0xf'));logger[_0x4d4f('0x10')](_0x4d4f('0x11'),_0xecc103,_0x4d4f('0xf'),JSON[_0x4d4f('0x12')](_0x226837));if(_0x226837[_0x4d4f('0x13')]){if(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x14')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x226837['error'][_0x4d4f('0x15')]);return _0x40be66(_0x226837[_0x4d4f('0x13')]['message']);}logger[_0x4d4f('0x13')](_0x4d4f('0xe'),_0xecc103,_0x226837[_0x4d4f('0x13')]['message']);return _0xea29b(_0x226837[_0x4d4f('0x13')][_0x4d4f('0x15')]);}else{logger[_0x4d4f('0xd')]('VtigerAccount,\x20%s,\x20%s',_0xecc103,_0x4d4f('0xf'));_0xea29b(_0x226837['result'][_0x4d4f('0x15')]);}})[_0x4d4f('0x16')](function(_0x4170ca){logger['error'](_0x4d4f('0xe'),_0xecc103,_0x4170ca);_0x40be66(_0x4170ca);});});}exports[_0x4d4f('0x17')]=function(_0x51dcf1){var _0x5dbbeb=this;return new Promise(function(_0x519501,_0x5a58af){return db['VtigerAccount'][_0x4d4f('0x18')]({'raw':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1b')]||null:null,'attributes':_0x51dcf1['options']?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1c')]||null:null,'limit':_0x51dcf1[_0x4d4f('0x19')]?_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1d')]||null:null,'include':_0x51dcf1['options']?_0x51dcf1['options'][_0x4d4f('0x1e')]?_['map'](_0x51dcf1[_0x4d4f('0x19')][_0x4d4f('0x1e')],function(_0x2d2fb3){return{'model':db[_0x2d2fb3[_0x4d4f('0x1f')]],'as':_0x2d2fb3['as'],'attributes':_0x2d2fb3[_0x4d4f('0x1c')],'include':_0x2d2fb3['include']?_[_0x4d4f('0x20')](_0x2d2fb3[_0x4d4f('0x1e')],function(_0x1cf365){return{'model':db[_0x1cf365[_0x4d4f('0x1f')]],'as':_0x1cf365['as'],'attributes':_0x1cf365['attributes'],'include':_0x1cf365['include']?_[_0x4d4f('0x20')](_0x1cf365[_0x4d4f('0x1e')],function(_0xa2492c){return{'model':db[_0xa2492c[_0x4d4f('0x1f')]],'as':_0xa2492c['as'],'attributes':_0xa2492c['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x380ebf){logger[_0x4d4f('0xd')](_0x4d4f('0x17'),_0x51dcf1);logger['debug'](_0x4d4f('0x17'),_0x51dcf1,JSON['stringify'](_0x380ebf));_0x519501(_0x380ebf);})[_0x4d4f('0x16')](function(_0x333a40){logger['error'](_0x4d4f('0x17'),_0x333a40[_0x4d4f('0x15')],_0x51dcf1);_0x5a58af(_0x5dbbeb[_0x4d4f('0x13')](0x1f4,_0x333a40[_0x4d4f('0x15')]));});});};exports[_0x4d4f('0x21')]=function(_0x43a704){var _0x4c69cb=this;return new Promise(function(_0x36eede,_0x4578b6){return db[_0x4d4f('0x22')][_0x4d4f('0x23')]({'raw':_0x43a704[_0x4d4f('0x19')]?_0x43a704['options'][_0x4d4f('0x1a')]===undefined?!![]:![]:!![],'where':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')]['where']||null:null,'attributes':_0x43a704['options']?_0x43a704['options'][_0x4d4f('0x1c')]||null:null,'include':_0x43a704['options']?_0x43a704[_0x4d4f('0x19')][_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x43a704['options'][_0x4d4f('0x1e')],function(_0x1ab7c4){return{'model':db[_0x1ab7c4[_0x4d4f('0x1f')]],'as':_0x1ab7c4['as'],'attributes':_0x1ab7c4['attributes'],'include':_0x1ab7c4[_0x4d4f('0x1e')]?_['map'](_0x1ab7c4[_0x4d4f('0x1e')],function(_0x2f18df){return{'model':db[_0x2f18df[_0x4d4f('0x1f')]],'as':_0x2f18df['as'],'attributes':_0x2f18df[_0x4d4f('0x1c')],'include':_0x2f18df[_0x4d4f('0x1e')]?_[_0x4d4f('0x20')](_0x2f18df[_0x4d4f('0x1e')],function(_0x461900){return{'model':db[_0x461900['model']],'as':_0x461900['as'],'attributes':_0x461900['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d4f('0xc')](function(_0x559441){logger['info'](_0x4d4f('0x21'),_0x43a704);logger[_0x4d4f('0x10')](_0x4d4f('0x21'),_0x43a704,JSON[_0x4d4f('0x12')](_0x559441));_0x36eede(_0x559441);})[_0x4d4f('0x16')](function(_0x56eed8){logger[_0x4d4f('0x13')](_0x4d4f('0x21'),_0x56eed8['message'],_0x43a704);_0x4578b6(_0x4c69cb[_0x4d4f('0x13')](0x1f4,_0x56eed8[_0x4d4f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8694f51..684c134 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 _0x74c2=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74c2,0x1e4));var _0x274c=function(_0x5c1dde,_0x314d7b){_0x5c1dde=_0x5c1dde-0x0;var _0x127b53=_0x74c2[_0x5c1dde];return _0x127b53;};'use strict';var multer=require(_0x274c('0x0'));var util=require(_0x274c('0x1'));var path=require(_0x274c('0x2'));var timeout=require(_0x274c('0x3'));var express=require('express');var router=express[_0x274c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x274c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x274c('0x6'));var controller=require(_0x274c('0x7'));router[_0x274c('0x8')]('/',auth[_0x274c('0x9')](),controller[_0x274c('0xa')]);router[_0x274c('0x8')](_0x274c('0xb'),auth[_0x274c('0x9')](),controller['show']);router[_0x274c('0x8')](_0x274c('0xc'),auth[_0x274c('0x9')](),controller[_0x274c('0xd')]);router[_0x274c('0x8')](_0x274c('0xe'),auth[_0x274c('0x9')](),controller['getSubjects']);router['get'](_0x274c('0xf'),auth[_0x274c('0x9')](),controller['getDescriptions']);router[_0x274c('0x10')]('/',auth[_0x274c('0x9')](),controller[_0x274c('0x11')]);router[_0x274c('0x12')](_0x274c('0xb'),auth[_0x274c('0x9')](),controller[_0x274c('0x13')]);router['delete'](_0x274c('0xb'),auth[_0x274c('0x9')](),controller[_0x274c('0x14')]);module[_0x274c('0x15')]=router; \ No newline at end of file +var _0x703d=['post','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x703d,0x1d1));var _0xd703=function(_0x42ec75,_0x26441e){_0x42ec75=_0x42ec75-0x0;var _0x1112f1=_0x703d[_0x42ec75];return _0x1112f1;};'use strict';var multer=require(_0xd703('0x0'));var util=require(_0xd703('0x1'));var path=require(_0xd703('0x2'));var timeout=require(_0xd703('0x3'));var express=require(_0xd703('0x4'));var router=express[_0xd703('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd703('0x6'));var interaction=require(_0xd703('0x7'));var config=require(_0xd703('0x8'));var controller=require(_0xd703('0x9'));router[_0xd703('0xa')]('/',auth[_0xd703('0xb')](),controller['index']);router[_0xd703('0xa')](_0xd703('0xc'),auth['isAuthenticated'](),controller[_0xd703('0xd')]);router[_0xd703('0xa')](_0xd703('0xe'),auth['isAuthenticated'](),controller[_0xd703('0xf')]);router['get']('/:id/subjects',auth[_0xd703('0xb')](),controller[_0xd703('0x10')]);router[_0xd703('0xa')](_0xd703('0x11'),auth[_0xd703('0xb')](),controller['getDescriptions']);router[_0xd703('0x12')]('/',auth[_0xd703('0xb')](),controller['create']);router['put'](_0xd703('0xc'),auth[_0xd703('0xb')](),controller['update']);router[_0xd703('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd703('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 0095605..3bc532f 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 _0xfcb7=['STRING','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xfcb7,0x1c6));var _0x7fcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfcb7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7fcb('0x0'));module[_0x7fcb('0x1')]={'name':{'type':Sequelize[_0x7fcb('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb9c9=['exports','STRING','sequelize'];(function(_0x2b3966,_0x11fa6a){var _0x5b1e6a=function(_0x270d9c){while(--_0x270d9c){_0x2b3966['push'](_0x2b3966['shift']());}};_0x5b1e6a(++_0x11fa6a);}(_0xb9c9,0x10d));var _0x9b9c=function(_0x11d763,_0x5edc16){_0x11d763=_0x11d763-0x0;var _0x48212a=_0xb9c9[_0x11d763];return _0x48212a;};'use strict';var Sequelize=require(_0x9b9c('0x0'));module[_0x9b9c('0x1')]={'name':{'type':Sequelize[_0x9b9c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 84da144..2e07b3c 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 _0xd517=['VIRTUAL','options','catch','includeAll','include','find','create','body','params','getFields','VtigerField','nolimit','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where'];(function(_0x179626,_0x3357b6){var _0x64bd2b=function(_0x44609a){while(--_0x44609a){_0x179626['push'](_0x179626['shift']());}};_0x64bd2b(++_0x3357b6);}(_0xd517,0x1dd));var _0x7d51=function(_0x2211ed,_0x1bca0b){_0x2211ed=_0x2211ed-0x0;var _0x4d78cc=_0xd517[_0x2211ed];return _0x4d78cc;};'use strict';var emlformat=require(_0x7d51('0x0'));var rimraf=require(_0x7d51('0x1'));var zipdir=require(_0x7d51('0x2'));var jsonpatch=require(_0x7d51('0x3'));var rp=require(_0x7d51('0x4'));var moment=require('moment');var BPromise=require(_0x7d51('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d51('0x6'));var sox=require(_0x7d51('0x7'));var csv=require(_0x7d51('0x8'));var ejs=require(_0x7d51('0x9'));var fs=require('fs');var fs_extra=require(_0x7d51('0xa'));var _=require(_0x7d51('0xb'));var squel=require(_0x7d51('0xc'));var crypto=require(_0x7d51('0xd'));var jsforce=require(_0x7d51('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d51('0xf'));var Papa=require(_0x7d51('0x10'));var Redis=require(_0x7d51('0x11'));var authService=require(_0x7d51('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d51('0x13'));var logger=require(_0x7d51('0x14'))(_0x7d51('0x15'));var utils=require('../../config/utils');var config=require(_0x7d51('0x16'));var licenseUtil=require(_0x7d51('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x862d23,_0x4d2446){_0x4d2446=_0x4d2446||0xcc;return function(_0x5df8db){if(_0x5df8db){return _0x862d23[_0x7d51('0x18')](_0x4d2446);}return _0x862d23['status'](_0x4d2446)['end']();};}function respondWithResult(_0xdffda4,_0xe77939){_0xe77939=_0xe77939||0xc8;return function(_0xad66fb){if(_0xad66fb){return _0xdffda4['status'](_0xe77939)['json'](_0xad66fb);}};}function respondWithFilteredResult(_0x305c26,_0x1ea497){return function(_0x31c95c){if(_0x31c95c){var _0x102eb7=typeof _0x1ea497['offset']===_0x7d51('0x19')&&typeof _0x1ea497[_0x7d51('0x1a')]==='undefined';var _0x55968a=_0x31c95c[_0x7d51('0x1b')];var _0x2ef330=_0x102eb7?0x0:_0x1ea497[_0x7d51('0x1c')];var _0x48a5e5=_0x102eb7?_0x31c95c[_0x7d51('0x1b')]:_0x1ea497[_0x7d51('0x1c')]+_0x1ea497[_0x7d51('0x1a')];var _0x48b55b;if(_0x48a5e5>=_0x55968a){_0x48a5e5=_0x55968a;_0x48b55b=0xc8;}else{_0x48b55b=0xce;}_0x305c26[_0x7d51('0x1d')](_0x48b55b);return _0x305c26['set'](_0x7d51('0x1e'),_0x2ef330+'-'+_0x48a5e5+'/'+_0x55968a)['json'](_0x31c95c);}return null;};}function patchUpdates(_0x3401f8){return function(_0x401c96){try{jsonpatch[_0x7d51('0x1f')](_0x401c96,_0x3401f8,!![]);}catch(_0x207f3c){return BPromise[_0x7d51('0x20')](_0x207f3c);}return _0x401c96[_0x7d51('0x21')]();};}function saveUpdates(_0x2ebce3,_0x17463e){return function(_0x1d9daf){if(_0x1d9daf){return _0x1d9daf[_0x7d51('0x22')](_0x2ebce3)[_0x7d51('0x23')](function(_0x1f940a){return _0x1f940a;});}return null;};}function removeEntity(_0x44f118,_0x1e1f8c){return function(_0x24bf87){if(_0x24bf87){return _0x24bf87[_0x7d51('0x24')]()[_0x7d51('0x23')](function(){_0x44f118['status'](0xcc)[_0x7d51('0x25')]();});}};}function handleEntityNotFound(_0x9dc472,_0x4d197a){return function(_0x20d785){if(!_0x20d785){_0x9dc472[_0x7d51('0x18')](0x194);}return _0x20d785;};}function handleError(_0xd262e6,_0x12ee8a){_0x12ee8a=_0x12ee8a||0x1f4;return function(_0xf98473){logger[_0x7d51('0x26')](_0xf98473[_0x7d51('0x27')]);if(_0xf98473[_0x7d51('0x28')]){delete _0xf98473[_0x7d51('0x28')];}_0xd262e6[_0x7d51('0x1d')](_0x12ee8a)['send'](_0xf98473);};}exports['index']=function(_0x5029eb,_0x2b5b48){var _0x3e4b64={},_0x34bb5b={},_0x5ae6c6={'count':0x0,'rows':[]};var _0x17e735=_['map'](db[_0x7d51('0x29')][_0x7d51('0x2a')],function(_0x3d8969){return{'name':_0x3d8969[_0x7d51('0x2b')],'type':_0x3d8969[_0x7d51('0x2c')][_0x7d51('0x2d')]};});_0x34bb5b[_0x7d51('0x2e')]=_[_0x7d51('0x2f')](_0x17e735,_0x7d51('0x28'));_0x34bb5b[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x5029eb[_0x7d51('0x30')]);_0x34bb5b[_0x7d51('0x32')]=_[_0x7d51('0x33')](_0x34bb5b[_0x7d51('0x2e')],_0x34bb5b['query']);_0x3e4b64['attributes']=_[_0x7d51('0x33')](_0x34bb5b['model'],qs[_0x7d51('0x34')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x34')]));_0x3e4b64['attributes']=_0x3e4b64[_0x7d51('0x35')][_0x7d51('0x36')]?_0x3e4b64[_0x7d51('0x35')]:_0x34bb5b[_0x7d51('0x2e')];if(!_0x5029eb[_0x7d51('0x30')][_0x7d51('0x37')]('nolimit')){_0x3e4b64[_0x7d51('0x1a')]=qs[_0x7d51('0x1a')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x3e4b64['offset']=qs[_0x7d51('0x1c')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1c')]);}_0x3e4b64[_0x7d51('0x38')]=qs['sort'](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x39')]);_0x3e4b64['where']=qs['filters'](_[_0x7d51('0x3a')](_0x5029eb[_0x7d51('0x30')],_0x34bb5b[_0x7d51('0x32')]),_0x17e735);if(_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x3e4b64['where']=_[_0x7d51('0x3c')](_0x3e4b64[_0x7d51('0x3d')],{'$or':_['map'](_0x17e735,function(_0x1e3734){if(_0x1e3734[_0x7d51('0x2c')]!==_0x7d51('0x3e')){var _0x323adb={};_0x323adb[_0x1e3734[_0x7d51('0x28')]]={'$like':'%'+_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x323adb;}})});}_0x3e4b64=_['merge']({},_0x3e4b64,_0x5029eb[_0x7d51('0x3f')]);var _0x27b37b={'where':_0x3e4b64['where']};return db[_0x7d51('0x29')][_0x7d51('0x1b')](_0x27b37b)['then'](function(_0x2ba385){_0x5ae6c6['count']=_0x2ba385;if(_0x5029eb[_0x7d51('0x30')]['includeAll']){_0x3e4b64['include']=[{'all':!![]}];}return db[_0x7d51('0x29')]['findAll'](_0x3e4b64);})[_0x7d51('0x23')](function(_0x3ba4a3){_0x5ae6c6['rows']=_0x3ba4a3;return _0x5ae6c6;})[_0x7d51('0x23')](respondWithFilteredResult(_0x2b5b48,_0x3e4b64))[_0x7d51('0x40')](handleError(_0x2b5b48,null));};exports['show']=function(_0x4819cc,_0x9b98d0){var _0x470859={'raw':![],'where':{'id':_0x4819cc['params']['id']}},_0x54b829={};_0x54b829[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x29')]['rawAttributes']);_0x54b829[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x4819cc[_0x7d51('0x30')]);_0x54b829['filters']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],_0x54b829[_0x7d51('0x30')]);_0x470859['attributes']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x4819cc[_0x7d51('0x30')][_0x7d51('0x34')]));_0x470859[_0x7d51('0x35')]=_0x470859[_0x7d51('0x35')][_0x7d51('0x36')]?_0x470859[_0x7d51('0x35')]:_0x54b829[_0x7d51('0x2e')];if(_0x4819cc[_0x7d51('0x30')][_0x7d51('0x41')]){_0x470859[_0x7d51('0x42')]=[{'all':!![]}];}_0x470859=_[_0x7d51('0x3c')]({},_0x470859,_0x4819cc[_0x7d51('0x3f')]);return db[_0x7d51('0x29')][_0x7d51('0x43')](_0x470859)[_0x7d51('0x23')](handleEntityNotFound(_0x9b98d0,null))[_0x7d51('0x23')](respondWithResult(_0x9b98d0,null))[_0x7d51('0x40')](handleError(_0x9b98d0,null));};exports[_0x7d51('0x44')]=function(_0x46ccb5,_0x52969d){return db[_0x7d51('0x29')][_0x7d51('0x44')](_0x46ccb5[_0x7d51('0x45')],{})[_0x7d51('0x23')](respondWithResult(_0x52969d,0xc9))[_0x7d51('0x40')](handleError(_0x52969d,null));};exports[_0x7d51('0x22')]=function(_0x595619,_0x302d4e){if(_0x595619['body']['id']){delete _0x595619['body']['id'];}return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x595619[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x302d4e,null))[_0x7d51('0x23')](saveUpdates(_0x595619[_0x7d51('0x45')],null))[_0x7d51('0x23')](respondWithResult(_0x302d4e,null))[_0x7d51('0x40')](handleError(_0x302d4e,null));};exports[_0x7d51('0x24')]=function(_0x5b7ad3,_0x31d9d4){return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x5b7ad3[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x31d9d4,null))[_0x7d51('0x23')](removeEntity(_0x31d9d4,null))['catch'](handleError(_0x31d9d4,null));};exports[_0x7d51('0x47')]=function(_0x37e52c,_0x5a4e37,_0x510ca1){var _0x465259={};var _0x152880={};var _0x2f37ea;var _0xf6e105;return db[_0x7d51('0x29')]['findOne']({'where':{'id':_0x37e52c[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x5a4e37,null))[_0x7d51('0x23')](function(_0x35d4e9){if(_0x35d4e9){_0x2f37ea=_0x35d4e9;_0x152880['model']=_[_0x7d51('0x31')](db[_0x7d51('0x48')]['rawAttributes']);_0x152880[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x37e52c[_0x7d51('0x30')]);_0x152880[_0x7d51('0x32')]=_[_0x7d51('0x33')](_0x152880[_0x7d51('0x2e')],_0x152880[_0x7d51('0x30')]);_0x465259['attributes']=_[_0x7d51('0x33')](_0x152880['model'],qs[_0x7d51('0x34')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x34')]));_0x465259[_0x7d51('0x35')]=_0x465259[_0x7d51('0x35')][_0x7d51('0x36')]?_0x465259[_0x7d51('0x35')]:_0x152880[_0x7d51('0x2e')];_0x465259[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x39')]);_0x465259[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_[_0x7d51('0x3a')](_0x37e52c['query'],_0x152880[_0x7d51('0x32')]));if(_0x37e52c[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x465259[_0x7d51('0x3d')]=_[_0x7d51('0x3c')](_0x465259[_0x7d51('0x3d')],{'$or':_[_0x7d51('0x2f')](_0x465259['attributes'],function(_0x4f5afc){var _0x5e49a8={};_0x5e49a8[_0x4f5afc]={'$like':'%'+_0x37e52c[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x5e49a8;})});}_0x465259=_[_0x7d51('0x3c')]({},_0x465259,_0x37e52c[_0x7d51('0x3f')]);return _0x2f37ea[_0x7d51('0x47')](_0x465259);}})[_0x7d51('0x23')](function(_0x11fb28){if(_0x11fb28){_0xf6e105=_0x11fb28[_0x7d51('0x36')];if(!_0x37e52c[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x465259[_0x7d51('0x1a')]=qs[_0x7d51('0x1a')](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x465259[_0x7d51('0x1c')]=qs['offset'](_0x37e52c[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x2f37ea[_0x7d51('0x47')](_0x465259);}})[_0x7d51('0x23')](function(_0x4fc9be){if(_0x4fc9be){return _0x4fc9be?{'count':_0xf6e105,'rows':_0x4fc9be}:null;}})[_0x7d51('0x23')](respondWithResult(_0x5a4e37,null))[_0x7d51('0x40')](handleError(_0x5a4e37,null));};exports[_0x7d51('0x4a')]=function(_0x58c519,_0x1f1aa8,_0x3a7743){var _0x21dfd5={};var _0x207d6e={};var _0x11f4eb;var _0x2104cd;return db[_0x7d51('0x29')]['findOne']({'where':{'id':_0x58c519['params']['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x1f1aa8,null))[_0x7d51('0x23')](function(_0x10a935){if(_0x10a935){_0x11f4eb=_0x10a935;_0x207d6e[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x48')][_0x7d51('0x2a')]);_0x207d6e['query']=_[_0x7d51('0x31')](_0x58c519[_0x7d51('0x30')]);_0x207d6e[_0x7d51('0x32')]=_['intersection'](_0x207d6e[_0x7d51('0x2e')],_0x207d6e[_0x7d51('0x30')]);_0x21dfd5[_0x7d51('0x35')]=_[_0x7d51('0x33')](_0x207d6e[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x34')]));_0x21dfd5[_0x7d51('0x35')]=_0x21dfd5[_0x7d51('0x35')]['length']?_0x21dfd5[_0x7d51('0x35')]:_0x207d6e[_0x7d51('0x2e')];_0x21dfd5[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x39')]);_0x21dfd5[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_['pick'](_0x58c519[_0x7d51('0x30')],_0x207d6e[_0x7d51('0x32')]));if(_0x58c519[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x21dfd5[_0x7d51('0x3d')]=_['merge'](_0x21dfd5[_0x7d51('0x3d')],{'$or':_[_0x7d51('0x2f')](_0x21dfd5[_0x7d51('0x35')],function(_0x34de8f){var _0x4948e1={};_0x4948e1[_0x34de8f]={'$like':'%'+_0x58c519[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x4948e1;})});}_0x21dfd5=_['merge']({},_0x21dfd5,_0x58c519[_0x7d51('0x3f')]);return _0x11f4eb[_0x7d51('0x4a')](_0x21dfd5);}})['then'](function(_0x279597){if(_0x279597){_0x2104cd=_0x279597[_0x7d51('0x36')];if(!_0x58c519[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x21dfd5[_0x7d51('0x1a')]=qs['limit'](_0x58c519[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x21dfd5['offset']=qs[_0x7d51('0x1c')](_0x58c519[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x11f4eb[_0x7d51('0x4a')](_0x21dfd5);}})['then'](function(_0x926724){if(_0x926724){return _0x926724?{'count':_0x2104cd,'rows':_0x926724}:null;}})[_0x7d51('0x23')](respondWithResult(_0x1f1aa8,null))[_0x7d51('0x40')](handleError(_0x1f1aa8,null));};exports[_0x7d51('0x4b')]=function(_0x489265,_0x3aa11f,_0x45ef17){var _0x173de3={};var _0x387f96={};var _0x1af356;var _0x5e313f;return db['VtigerConfiguration'][_0x7d51('0x4c')]({'where':{'id':_0x489265[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x3aa11f,null))[_0x7d51('0x23')](function(_0x2b422f){if(_0x2b422f){_0x1af356=_0x2b422f;_0x387f96[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x48')][_0x7d51('0x2a')]);_0x387f96[_0x7d51('0x30')]=_['keys'](_0x489265[_0x7d51('0x30')]);_0x387f96['filters']=_[_0x7d51('0x33')](_0x387f96[_0x7d51('0x2e')],_0x387f96['query']);_0x173de3[_0x7d51('0x35')]=_[_0x7d51('0x33')](_0x387f96[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x489265['query'][_0x7d51('0x34')]));_0x173de3[_0x7d51('0x35')]=_0x173de3[_0x7d51('0x35')][_0x7d51('0x36')]?_0x173de3[_0x7d51('0x35')]:_0x387f96[_0x7d51('0x2e')];_0x173de3[_0x7d51('0x38')]=qs[_0x7d51('0x39')](_0x489265[_0x7d51('0x30')][_0x7d51('0x39')]);_0x173de3[_0x7d51('0x3d')]=qs[_0x7d51('0x32')](_[_0x7d51('0x3a')](_0x489265[_0x7d51('0x30')],_0x387f96[_0x7d51('0x32')]));if(_0x489265[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x173de3[_0x7d51('0x3d')]=_[_0x7d51('0x3c')](_0x173de3[_0x7d51('0x3d')],{'$or':_['map'](_0x173de3[_0x7d51('0x35')],function(_0x252df3){var _0x4ecab2={};_0x4ecab2[_0x252df3]={'$like':'%'+_0x489265[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x4ecab2;})});}_0x173de3=_[_0x7d51('0x3c')]({},_0x173de3,_0x489265['options']);return _0x1af356[_0x7d51('0x4b')](_0x173de3);}})[_0x7d51('0x23')](function(_0x567465){if(_0x567465){_0x5e313f=_0x567465[_0x7d51('0x36')];if(!_0x489265[_0x7d51('0x30')][_0x7d51('0x37')](_0x7d51('0x49'))){_0x173de3[_0x7d51('0x1a')]=qs['limit'](_0x489265[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x173de3[_0x7d51('0x1c')]=qs['offset'](_0x489265[_0x7d51('0x30')][_0x7d51('0x1c')]);}return _0x1af356[_0x7d51('0x4b')](_0x173de3);}})[_0x7d51('0x23')](function(_0x180663){if(_0x180663){return _0x180663?{'count':_0x5e313f,'rows':_0x180663}:null;}})['then'](respondWithResult(_0x3aa11f,null))[_0x7d51('0x40')](handleError(_0x3aa11f,null));}; \ No newline at end of file +var _0x2c6a=['findOne','length','nolimit','VtigerField','rawAttributes','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','options','VtigerConfiguration','findAll','show','params','include','merge','find','catch','create','body','getFields'];(function(_0x368703,_0x1fb316){var _0xa37d5c=function(_0x2ae5e7){while(--_0x2ae5e7){_0x368703['push'](_0x368703['shift']());}};_0xa37d5c(++_0x1fb316);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa2c6('0x0'));var rimraf=require(_0xa2c6('0x1'));var zipdir=require(_0xa2c6('0x2'));var jsonpatch=require(_0xa2c6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa2c6('0x4'));var Mustache=require('mustache');var util=require(_0xa2c6('0x5'));var path=require(_0xa2c6('0x6'));var sox=require(_0xa2c6('0x7'));var csv=require(_0xa2c6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2c6('0x9'));var squel=require(_0xa2c6('0xa'));var crypto=require(_0xa2c6('0xb'));var jsforce=require(_0xa2c6('0xc'));var deskjs=require(_0xa2c6('0xd'));var toCsv=require(_0xa2c6('0x8'));var querystring=require(_0xa2c6('0xe'));var Papa=require('papaparse');var Redis=require(_0xa2c6('0xf'));var authService=require(_0xa2c6('0x10'));var qs=require(_0xa2c6('0x11'));var as=require(_0xa2c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2c6('0x13'))('api');var utils=require(_0xa2c6('0x14'));var config=require(_0xa2c6('0x15'));var licenseUtil=require(_0xa2c6('0x16'));var db=require(_0xa2c6('0x17'))['db'];function respondWithStatusCode(_0x4955be,_0x2897ee){_0x2897ee=_0x2897ee||0xcc;return function(_0x3234b6){if(_0x3234b6){return _0x4955be[_0xa2c6('0x18')](_0x2897ee);}return _0x4955be['status'](_0x2897ee)[_0xa2c6('0x19')]();};}function respondWithResult(_0x1dc749,_0x3ebb15){_0x3ebb15=_0x3ebb15||0xc8;return function(_0x1bc1dc){if(_0x1bc1dc){return _0x1dc749[_0xa2c6('0x1a')](_0x3ebb15)['json'](_0x1bc1dc);}};}function respondWithFilteredResult(_0x412229,_0x374404){return function(_0x43b97b){if(_0x43b97b){var _0x354dff=typeof _0x374404[_0xa2c6('0x1b')]===_0xa2c6('0x1c')&&typeof _0x374404['limit']===_0xa2c6('0x1c');var _0x4d49f8=_0x43b97b[_0xa2c6('0x1d')];var _0x114424=_0x354dff?0x0:_0x374404[_0xa2c6('0x1b')];var _0x2479bd=_0x354dff?_0x43b97b[_0xa2c6('0x1d')]:_0x374404[_0xa2c6('0x1b')]+_0x374404[_0xa2c6('0x1e')];var _0x2b3d6e;if(_0x2479bd>=_0x4d49f8){_0x2479bd=_0x4d49f8;_0x2b3d6e=0xc8;}else{_0x2b3d6e=0xce;}_0x412229['status'](_0x2b3d6e);return _0x412229[_0xa2c6('0x1f')](_0xa2c6('0x20'),_0x114424+'-'+_0x2479bd+'/'+_0x4d49f8)[_0xa2c6('0x21')](_0x43b97b);}return null;};}function patchUpdates(_0x21ec92){return function(_0x2a2fc9){try{jsonpatch['apply'](_0x2a2fc9,_0x21ec92,!![]);}catch(_0x35dd2a){return BPromise[_0xa2c6('0x22')](_0x35dd2a);}return _0x2a2fc9['save']();};}function saveUpdates(_0x20a86e,_0x58530d){return function(_0x8b2eea){if(_0x8b2eea){return _0x8b2eea[_0xa2c6('0x23')](_0x20a86e)['then'](function(_0x291057){return _0x291057;});}return null;};}function removeEntity(_0x5aabe2,_0x19a765){return function(_0x168de7){if(_0x168de7){return _0x168de7[_0xa2c6('0x24')]()[_0xa2c6('0x25')](function(){_0x5aabe2[_0xa2c6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed646,_0x4e9dcc){return function(_0x14c01e){if(!_0x14c01e){_0x2ed646[_0xa2c6('0x18')](0x194);}return _0x14c01e;};}function handleError(_0x5d687a,_0x2cedee){_0x2cedee=_0x2cedee||0x1f4;return function(_0x4485d4){logger[_0xa2c6('0x26')](_0x4485d4[_0xa2c6('0x27')]);if(_0x4485d4[_0xa2c6('0x28')]){delete _0x4485d4[_0xa2c6('0x28')];}_0x5d687a[_0xa2c6('0x1a')](_0x2cedee)[_0xa2c6('0x29')](_0x4485d4);};}exports[_0xa2c6('0x2a')]=function(_0x57d67a,_0x1655f8){var _0x46b082={},_0x233284={},_0x3702ec={'count':0x0,'rows':[]};var _0x598341=_['map'](db['VtigerConfiguration']['rawAttributes'],function(_0xa6df69){return{'name':_0xa6df69[_0xa2c6('0x2b')],'type':_0xa6df69[_0xa2c6('0x2c')][_0xa2c6('0x2d')]};});_0x233284['model']=_[_0xa2c6('0x2e')](_0x598341,_0xa2c6('0x28'));_0x233284[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x57d67a[_0xa2c6('0x2f')]);_0x233284[_0xa2c6('0x31')]=_[_0xa2c6('0x32')](_0x233284[_0xa2c6('0x33')],_0x233284[_0xa2c6('0x2f')]);_0x46b082['attributes']=_[_0xa2c6('0x32')](_0x233284[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x57d67a['query'][_0xa2c6('0x34')]));_0x46b082[_0xa2c6('0x35')]=_0x46b082['attributes']['length']?_0x46b082[_0xa2c6('0x35')]:_0x233284[_0xa2c6('0x33')];if(!_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x36')]('nolimit')){_0x46b082[_0xa2c6('0x1e')]=qs[_0xa2c6('0x1e')](_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x1e')]);_0x46b082[_0xa2c6('0x1b')]=qs[_0xa2c6('0x1b')](_0x57d67a[_0xa2c6('0x2f')]['offset']);}_0x46b082[_0xa2c6('0x37')]=qs[_0xa2c6('0x38')](_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x38')]);_0x46b082[_0xa2c6('0x39')]=qs[_0xa2c6('0x31')](_[_0xa2c6('0x3a')](_0x57d67a['query'],_0x233284[_0xa2c6('0x31')]),_0x598341);if(_0x57d67a[_0xa2c6('0x2f')]['filter']){_0x46b082[_0xa2c6('0x39')]=_['merge'](_0x46b082[_0xa2c6('0x39')],{'$or':_[_0xa2c6('0x2e')](_0x598341,function(_0x5d23d9){if(_0x5d23d9[_0xa2c6('0x2c')]!==_0xa2c6('0x3b')){var _0x5a7db0={};_0x5a7db0[_0x5d23d9[_0xa2c6('0x28')]]={'$like':'%'+_0x57d67a[_0xa2c6('0x2f')][_0xa2c6('0x3c')]+'%'};return _0x5a7db0;}})});}_0x46b082=_['merge']({},_0x46b082,_0x57d67a[_0xa2c6('0x3d')]);var _0x56561a={'where':_0x46b082['where']};return db[_0xa2c6('0x3e')][_0xa2c6('0x1d')](_0x56561a)[_0xa2c6('0x25')](function(_0x27ed9e){_0x3702ec[_0xa2c6('0x1d')]=_0x27ed9e;if(_0x57d67a[_0xa2c6('0x2f')]['includeAll']){_0x46b082['include']=[{'all':!![]}];}return db[_0xa2c6('0x3e')][_0xa2c6('0x3f')](_0x46b082);})['then'](function(_0x2b0267){_0x3702ec['rows']=_0x2b0267;return _0x3702ec;})['then'](respondWithFilteredResult(_0x1655f8,_0x46b082))['catch'](handleError(_0x1655f8,null));};exports[_0xa2c6('0x40')]=function(_0x219942,_0x55b0fb){var _0x2a2895={'raw':![],'where':{'id':_0x219942[_0xa2c6('0x41')]['id']}},_0x25acce={};_0x25acce[_0xa2c6('0x33')]=_['keys'](db[_0xa2c6('0x3e')]['rawAttributes']);_0x25acce[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x219942[_0xa2c6('0x2f')]);_0x25acce['filters']=_['intersection'](_0x25acce[_0xa2c6('0x33')],_0x25acce[_0xa2c6('0x2f')]);_0x2a2895[_0xa2c6('0x35')]=_[_0xa2c6('0x32')](_0x25acce[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x219942[_0xa2c6('0x2f')][_0xa2c6('0x34')]));_0x2a2895[_0xa2c6('0x35')]=_0x2a2895['attributes']['length']?_0x2a2895[_0xa2c6('0x35')]:_0x25acce['model'];if(_0x219942[_0xa2c6('0x2f')]['includeAll']){_0x2a2895[_0xa2c6('0x42')]=[{'all':!![]}];}_0x2a2895=_[_0xa2c6('0x43')]({},_0x2a2895,_0x219942[_0xa2c6('0x3d')]);return db[_0xa2c6('0x3e')][_0xa2c6('0x44')](_0x2a2895)[_0xa2c6('0x25')](handleEntityNotFound(_0x55b0fb,null))['then'](respondWithResult(_0x55b0fb,null))[_0xa2c6('0x45')](handleError(_0x55b0fb,null));};exports[_0xa2c6('0x46')]=function(_0x4a66cb,_0x4fcf2e){return db[_0xa2c6('0x3e')]['create'](_0x4a66cb[_0xa2c6('0x47')],{})[_0xa2c6('0x25')](respondWithResult(_0x4fcf2e,0xc9))[_0xa2c6('0x45')](handleError(_0x4fcf2e,null));};exports['update']=function(_0x24e819,_0x2d7341){if(_0x24e819[_0xa2c6('0x47')]['id']){delete _0x24e819[_0xa2c6('0x47')]['id'];}return db[_0xa2c6('0x3e')]['find']({'where':{'id':_0x24e819['params']['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x2d7341,null))[_0xa2c6('0x25')](saveUpdates(_0x24e819['body'],null))['then'](respondWithResult(_0x2d7341,null))['catch'](handleError(_0x2d7341,null));};exports[_0xa2c6('0x24')]=function(_0x106c29,_0x56fd27){return db[_0xa2c6('0x3e')]['find']({'where':{'id':_0x106c29[_0xa2c6('0x41')]['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x56fd27,null))[_0xa2c6('0x25')](removeEntity(_0x56fd27,null))[_0xa2c6('0x45')](handleError(_0x56fd27,null));};exports[_0xa2c6('0x48')]=function(_0x153f3d,_0x135cde,_0x59110a){var _0x442d81={};var _0x1d9c61={};var _0x428eb7;var _0x1b7d33;return db['VtigerConfiguration'][_0xa2c6('0x49')]({'where':{'id':_0x153f3d['params']['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0x135cde,null))[_0xa2c6('0x25')](function(_0x30bf20){if(_0x30bf20){_0x428eb7=_0x30bf20;_0x1d9c61[_0xa2c6('0x33')]=_[_0xa2c6('0x30')](db['VtigerField']['rawAttributes']);_0x1d9c61[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x153f3d[_0xa2c6('0x2f')]);_0x1d9c61['filters']=_[_0xa2c6('0x32')](_0x1d9c61[_0xa2c6('0x33')],_0x1d9c61[_0xa2c6('0x2f')]);_0x442d81[_0xa2c6('0x35')]=_[_0xa2c6('0x32')](_0x1d9c61[_0xa2c6('0x33')],qs['fields'](_0x153f3d['query'][_0xa2c6('0x34')]));_0x442d81[_0xa2c6('0x35')]=_0x442d81['attributes'][_0xa2c6('0x4a')]?_0x442d81['attributes']:_0x1d9c61[_0xa2c6('0x33')];_0x442d81[_0xa2c6('0x37')]=qs[_0xa2c6('0x38')](_0x153f3d[_0xa2c6('0x2f')][_0xa2c6('0x38')]);_0x442d81[_0xa2c6('0x39')]=qs[_0xa2c6('0x31')](_['pick'](_0x153f3d[_0xa2c6('0x2f')],_0x1d9c61[_0xa2c6('0x31')]));if(_0x153f3d[_0xa2c6('0x2f')][_0xa2c6('0x3c')]){_0x442d81['where']=_[_0xa2c6('0x43')](_0x442d81[_0xa2c6('0x39')],{'$or':_[_0xa2c6('0x2e')](_0x442d81['attributes'],function(_0x2b5009){var _0x1019b1={};_0x1019b1[_0x2b5009]={'$like':'%'+_0x153f3d[_0xa2c6('0x2f')]['filter']+'%'};return _0x1019b1;})});}_0x442d81=_['merge']({},_0x442d81,_0x153f3d[_0xa2c6('0x3d')]);return _0x428eb7['getFields'](_0x442d81);}})[_0xa2c6('0x25')](function(_0x52852d){if(_0x52852d){_0x1b7d33=_0x52852d[_0xa2c6('0x4a')];if(!_0x153f3d[_0xa2c6('0x2f')][_0xa2c6('0x36')](_0xa2c6('0x4b'))){_0x442d81[_0xa2c6('0x1e')]=qs[_0xa2c6('0x1e')](_0x153f3d[_0xa2c6('0x2f')][_0xa2c6('0x1e')]);_0x442d81['offset']=qs[_0xa2c6('0x1b')](_0x153f3d[_0xa2c6('0x2f')]['offset']);}return _0x428eb7[_0xa2c6('0x48')](_0x442d81);}})['then'](function(_0x43324e){if(_0x43324e){return _0x43324e?{'count':_0x1b7d33,'rows':_0x43324e}:null;}})[_0xa2c6('0x25')](respondWithResult(_0x135cde,null))[_0xa2c6('0x45')](handleError(_0x135cde,null));};exports['getSubjects']=function(_0x2a6364,_0x59fca5,_0x3d538d){var _0x1db76b={};var _0x261d9c={};var _0x117240;var _0x1ba502;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x2a6364['params']['id']}})['then'](handleEntityNotFound(_0x59fca5,null))[_0xa2c6('0x25')](function(_0x528c79){if(_0x528c79){_0x117240=_0x528c79;_0x261d9c[_0xa2c6('0x33')]=_[_0xa2c6('0x30')](db[_0xa2c6('0x4c')][_0xa2c6('0x4d')]);_0x261d9c['query']=_['keys'](_0x2a6364[_0xa2c6('0x2f')]);_0x261d9c[_0xa2c6('0x31')]=_['intersection'](_0x261d9c['model'],_0x261d9c['query']);_0x1db76b['attributes']=_[_0xa2c6('0x32')](_0x261d9c[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x2a6364['query'][_0xa2c6('0x34')]));_0x1db76b[_0xa2c6('0x35')]=_0x1db76b[_0xa2c6('0x35')][_0xa2c6('0x4a')]?_0x1db76b[_0xa2c6('0x35')]:_0x261d9c['model'];_0x1db76b[_0xa2c6('0x37')]=qs[_0xa2c6('0x38')](_0x2a6364[_0xa2c6('0x2f')][_0xa2c6('0x38')]);_0x1db76b[_0xa2c6('0x39')]=qs[_0xa2c6('0x31')](_[_0xa2c6('0x3a')](_0x2a6364[_0xa2c6('0x2f')],_0x261d9c[_0xa2c6('0x31')]));if(_0x2a6364[_0xa2c6('0x2f')][_0xa2c6('0x3c')]){_0x1db76b[_0xa2c6('0x39')]=_[_0xa2c6('0x43')](_0x1db76b[_0xa2c6('0x39')],{'$or':_[_0xa2c6('0x2e')](_0x1db76b[_0xa2c6('0x35')],function(_0xf99bd6){var _0x33839d={};_0x33839d[_0xf99bd6]={'$like':'%'+_0x2a6364[_0xa2c6('0x2f')][_0xa2c6('0x3c')]+'%'};return _0x33839d;})});}_0x1db76b=_['merge']({},_0x1db76b,_0x2a6364[_0xa2c6('0x3d')]);return _0x117240[_0xa2c6('0x4e')](_0x1db76b);}})['then'](function(_0xea5a47){if(_0xea5a47){_0x1ba502=_0xea5a47[_0xa2c6('0x4a')];if(!_0x2a6364['query']['hasOwnProperty'](_0xa2c6('0x4b'))){_0x1db76b['limit']=qs['limit'](_0x2a6364[_0xa2c6('0x2f')][_0xa2c6('0x1e')]);_0x1db76b[_0xa2c6('0x1b')]=qs[_0xa2c6('0x1b')](_0x2a6364[_0xa2c6('0x2f')][_0xa2c6('0x1b')]);}return _0x117240[_0xa2c6('0x4e')](_0x1db76b);}})[_0xa2c6('0x25')](function(_0x202083){if(_0x202083){return _0x202083?{'count':_0x1ba502,'rows':_0x202083}:null;}})[_0xa2c6('0x25')](respondWithResult(_0x59fca5,null))[_0xa2c6('0x45')](handleError(_0x59fca5,null));};exports[_0xa2c6('0x4f')]=function(_0x207836,_0xd7c00,_0x154462){var _0xa46ccf={};var _0x1e59ae={};var _0x438cfc;var _0xd58ad6;return db[_0xa2c6('0x3e')][_0xa2c6('0x49')]({'where':{'id':_0x207836[_0xa2c6('0x41')]['id']}})[_0xa2c6('0x25')](handleEntityNotFound(_0xd7c00,null))[_0xa2c6('0x25')](function(_0x807d66){if(_0x807d66){_0x438cfc=_0x807d66;_0x1e59ae[_0xa2c6('0x33')]=_[_0xa2c6('0x30')](db['VtigerField'][_0xa2c6('0x4d')]);_0x1e59ae[_0xa2c6('0x2f')]=_[_0xa2c6('0x30')](_0x207836[_0xa2c6('0x2f')]);_0x1e59ae['filters']=_[_0xa2c6('0x32')](_0x1e59ae[_0xa2c6('0x33')],_0x1e59ae[_0xa2c6('0x2f')]);_0xa46ccf[_0xa2c6('0x35')]=_[_0xa2c6('0x32')](_0x1e59ae[_0xa2c6('0x33')],qs[_0xa2c6('0x34')](_0x207836['query'][_0xa2c6('0x34')]));_0xa46ccf['attributes']=_0xa46ccf[_0xa2c6('0x35')][_0xa2c6('0x4a')]?_0xa46ccf[_0xa2c6('0x35')]:_0x1e59ae[_0xa2c6('0x33')];_0xa46ccf[_0xa2c6('0x37')]=qs[_0xa2c6('0x38')](_0x207836[_0xa2c6('0x2f')]['sort']);_0xa46ccf['where']=qs['filters'](_[_0xa2c6('0x3a')](_0x207836[_0xa2c6('0x2f')],_0x1e59ae[_0xa2c6('0x31')]));if(_0x207836[_0xa2c6('0x2f')][_0xa2c6('0x3c')]){_0xa46ccf[_0xa2c6('0x39')]=_['merge'](_0xa46ccf['where'],{'$or':_[_0xa2c6('0x2e')](_0xa46ccf[_0xa2c6('0x35')],function(_0x38a52e){var _0x4f278b={};_0x4f278b[_0x38a52e]={'$like':'%'+_0x207836[_0xa2c6('0x2f')][_0xa2c6('0x3c')]+'%'};return _0x4f278b;})});}_0xa46ccf=_[_0xa2c6('0x43')]({},_0xa46ccf,_0x207836[_0xa2c6('0x3d')]);return _0x438cfc[_0xa2c6('0x4f')](_0xa46ccf);}})[_0xa2c6('0x25')](function(_0x35ceb8){if(_0x35ceb8){_0xd58ad6=_0x35ceb8['length'];if(!_0x207836[_0xa2c6('0x2f')][_0xa2c6('0x36')](_0xa2c6('0x4b'))){_0xa46ccf[_0xa2c6('0x1e')]=qs['limit'](_0x207836[_0xa2c6('0x2f')][_0xa2c6('0x1e')]);_0xa46ccf[_0xa2c6('0x1b')]=qs['offset'](_0x207836[_0xa2c6('0x2f')]['offset']);}return _0x438cfc['getDescriptions'](_0xa46ccf);}})[_0xa2c6('0x25')](function(_0x3e06ca){if(_0x3e06ca){return _0x3e06ca?{'count':_0xd58ad6,'rows':_0x3e06ca}:null;}})[_0xa2c6('0x25')](respondWithResult(_0xd7c00,null))['catch'](handleError(_0xd7c00,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 551b642..dd0615a 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 _0xf7ac=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4431f1,_0x49a36e){var _0x3acd06=function(_0x182872){while(--_0x182872){_0x4431f1['push'](_0x4431f1['shift']());}};_0x3acd06(++_0x49a36e);}(_0xf7ac,0xbd));var _0xcf7a=function(_0x45bee0,_0x42bf09){_0x45bee0=_0x45bee0-0x0;var _0x1fcfd5=_0xf7ac[_0x45bee0];return _0x1fcfd5;};'use strict';var _=require(_0xcf7a('0x0'));var util=require(_0xcf7a('0x1'));var logger=require(_0xcf7a('0x2'))(_0xcf7a('0x3'));var moment=require('moment');var BPromise=require(_0xcf7a('0x4'));var rp=require(_0xcf7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf7a('0x6'));var config=require(_0xcf7a('0x7'));var attributes=require(_0xcf7a('0x8'));module[_0xcf7a('0x9')]=function(_0xfba968,_0x162f0b){return _0xfba968[_0xcf7a('0xa')](_0xcf7a('0xb'),attributes,{'tableName':_0xcf7a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02bf=['../../config/environment','define','VtigerConfiguration','int_vtiger_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x02bf,0x12d));var _0xf02b=function(_0x1a37e3,_0x5db8f6){_0x1a37e3=_0x1a37e3-0x0;var _0x4db78a=_0x02bf[_0x1a37e3];return _0x4db78a;};'use strict';var _=require(_0xf02b('0x0'));var util=require('util');var logger=require(_0xf02b('0x1'))(_0xf02b('0x2'));var moment=require(_0xf02b('0x3'));var BPromise=require('bluebird');var rp=require(_0xf02b('0x4'));var fs=require('fs');var path=require(_0xf02b('0x5'));var rimraf=require(_0xf02b('0x6'));var config=require(_0xf02b('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x4920fa,_0x7722eb){return _0x4920fa[_0xf02b('0x8')](_0xf02b('0x9'),attributes,{'tableName':_0xf02b('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 a8cf997..9aced27 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 _0xe890=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','catch','lodash','moment','randomstring'];(function(_0x4a158c,_0x1828d3){var _0x17d061=function(_0x7e1fd3){while(--_0x7e1fd3){_0x4a158c['push'](_0x4a158c['shift']());}};_0x17d061(++_0x1828d3);}(_0xe890,0x1b2));var _0x0e89=function(_0x25c047,_0x3c93f3){_0x25c047=_0x25c047-0x0;var _0x5f222a=_0xe890[_0x25c047];return _0x5f222a;};'use strict';var _=require(_0x0e89('0x0'));var util=require('util');var moment=require(_0x0e89('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e89('0x2'));var fs=require('fs');var Redis=require(_0x0e89('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e89('0x4'));var logger=require(_0x0e89('0x5'))(_0x0e89('0x6'));var config=require(_0x0e89('0x7'));var jayson=require(_0x0e89('0x8'));var client=jayson[_0x0e89('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3107,_0x4299d4,_0x2eb0ef){return new BPromise(function(_0x1a6d69,_0x498c79){return client[_0x0e89('0xa')](_0x5b3107,_0x2eb0ef)['then'](function(_0x192970){logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4299d4,_0x0e89('0xd'));logger['debug'](_0x0e89('0xe'),_0x4299d4,_0x0e89('0xd'),JSON['stringify'](_0x192970));if(_0x192970['error']){if(_0x192970['error'][_0x0e89('0xf')]===0x1f4){logger[_0x0e89('0x10')](_0x0e89('0xc'),_0x4299d4,_0x192970[_0x0e89('0x10')][_0x0e89('0x11')]);return _0x498c79(_0x192970[_0x0e89('0x10')]['message']);}logger[_0x0e89('0x10')](_0x0e89('0xc'),_0x4299d4,_0x192970[_0x0e89('0x10')]['message']);return _0x1a6d69(_0x192970[_0x0e89('0x10')][_0x0e89('0x11')]);}else{logger[_0x0e89('0xb')](_0x0e89('0xc'),_0x4299d4,_0x0e89('0xd'));_0x1a6d69(_0x192970['result'][_0x0e89('0x11')]);}})[_0x0e89('0x12')](function(_0x8baf2){logger[_0x0e89('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x4299d4,_0x8baf2);_0x498c79(_0x8baf2);});});} \ No newline at end of file +var _0x835b=['info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1e1608,_0xf48a6d){var _0x2bf930=function(_0x5aaa3f){while(--_0x5aaa3f){_0x1e1608['push'](_0x1e1608['shift']());}};_0x2bf930(++_0xf48a6d);}(_0x835b,0x1d6));var _0xb835=function(_0x4a4fb8,_0x1c8af){_0x4a4fb8=_0x4a4fb8-0x0;var _0x1d27c8=_0x835b[_0x4a4fb8];return _0x1d27c8;};'use strict';var _=require(_0xb835('0x0'));var util=require(_0xb835('0x1'));var moment=require(_0xb835('0x2'));var BPromise=require(_0xb835('0x3'));var rs=require(_0xb835('0x4'));var fs=require('fs');var Redis=require(_0xb835('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb835('0x6'))(_0xb835('0x7'));var config=require('../../config/environment');var jayson=require(_0xb835('0x8'));var client=jayson[_0xb835('0x9')][_0xb835('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465efe,_0x1f92fd,_0x5918e3){return new BPromise(function(_0x421844,_0x1e197f){return client[_0xb835('0xb')](_0x465efe,_0x5918e3)[_0xb835('0xc')](function(_0x2096cb){logger[_0xb835('0xd')](_0xb835('0xe'),_0x1f92fd,_0xb835('0xf'));logger[_0xb835('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x1f92fd,_0xb835('0xf'),JSON[_0xb835('0x11')](_0x2096cb));if(_0x2096cb[_0xb835('0x12')]){if(_0x2096cb[_0xb835('0x12')][_0xb835('0x13')]===0x1f4){logger[_0xb835('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f92fd,_0x2096cb[_0xb835('0x12')][_0xb835('0x14')]);return _0x1e197f(_0x2096cb[_0xb835('0x12')][_0xb835('0x14')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x1f92fd,_0x2096cb[_0xb835('0x12')][_0xb835('0x14')]);return _0x421844(_0x2096cb[_0xb835('0x12')][_0xb835('0x14')]);}else{logger[_0xb835('0xd')](_0xb835('0xe'),_0x1f92fd,_0xb835('0xf'));_0x421844(_0x2096cb['result'][_0xb835('0x14')]);}})['catch'](function(_0x439f5d){logger['error'](_0xb835('0xe'),_0x1f92fd,_0x439f5d);_0x1e197f(_0x439f5d);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 046a7b0..1718d57 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 _0x092d=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x18931a,_0x59ba22){var _0x22b35d=function(_0x28b627){while(--_0x28b627){_0x18931a['push'](_0x18931a['shift']());}};_0x22b35d(++_0x59ba22);}(_0x092d,0xe4));var _0xd092=function(_0x2053ea,_0x1ab2d4){_0x2053ea=_0x2053ea-0x0;var _0x2232c4=_0x092d[_0x2053ea];return _0x2232c4;};'use strict';var multer=require(_0xd092('0x0'));var util=require(_0xd092('0x1'));var path=require(_0xd092('0x2'));var timeout=require(_0xd092('0x3'));var express=require('express');var router=express[_0xd092('0x4')]();var fs_extra=require(_0xd092('0x5'));var auth=require(_0xd092('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd092('0x7'));var controller=require(_0xd092('0x8'));router[_0xd092('0x9')]('/',auth['isAuthenticated'](),controller[_0xd092('0xa')]);router[_0xd092('0x9')]('/:id',auth[_0xd092('0xb')](),controller[_0xd092('0xc')]);router[_0xd092('0xd')]('/',auth[_0xd092('0xb')](),controller[_0xd092('0xe')]);router[_0xd092('0xf')](_0xd092('0x10'),auth[_0xd092('0xb')](),controller[_0xd092('0x11')]);router[_0xd092('0x12')](_0xd092('0x10'),auth[_0xd092('0xb')](),controller[_0xd092('0x13')]);module[_0xd092('0x14')]=router; \ No newline at end of file +var _0xea0e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout'];(function(_0xff4b5d,_0x5b1497){var _0x28e19b=function(_0xda921d){while(--_0xda921d){_0xff4b5d['push'](_0xff4b5d['shift']());}};_0x28e19b(++_0x5b1497);}(_0xea0e,0x10d));var _0xeea0=function(_0x483652,_0x45e58d){_0x483652=_0x483652-0x0;var _0x4d6126=_0xea0e[_0x483652];return _0x4d6126;};'use strict';var multer=require('multer');var util=require(_0xeea0('0x0'));var path=require(_0xeea0('0x1'));var timeout=require(_0xeea0('0x2'));var express=require(_0xeea0('0x3'));var router=express[_0xeea0('0x4')]();var fs_extra=require(_0xeea0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeea0('0x6'));var config=require(_0xeea0('0x7'));var controller=require('./intVtigerField.controller');router[_0xeea0('0x8')]('/',auth[_0xeea0('0x9')](),controller['index']);router[_0xeea0('0x8')](_0xeea0('0xa'),auth['isAuthenticated'](),controller[_0xeea0('0xb')]);router['post']('/',auth[_0xeea0('0x9')](),controller[_0xeea0('0xc')]);router[_0xeea0('0xd')](_0xeea0('0xa'),auth[_0xeea0('0x9')](),controller[_0xeea0('0xe')]);router['delete']('/:id',auth[_0xeea0('0x9')](),controller[_0xeea0('0xf')]);module[_0xeea0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 11e18ff..a853fb0 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 _0x0c82=['sequelize','variable','keyValue','string','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x352580,_0x40db47){var _0x459385=function(_0x40b0ef){while(--_0x40b0ef){_0x352580['push'](_0x352580['shift']());}};_0x459385(++_0x40db47);}(_0x0c82,0x90));var _0x20c8=function(_0x35c86f,_0x399bc4){_0x35c86f=_0x35c86f-0x0;var _0x28c841=_0x0c82[_0x35c86f];return _0x28c841;};'use strict';var Sequelize=require(_0x20c8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x20c8('0x1'),'customVariable',_0x20c8('0x2'),'picklist'),'defaultValue':_0x20c8('0x3')},'content':{'type':Sequelize[_0x20c8('0x4')]},'key':{'type':Sequelize[_0x20c8('0x4')]},'keyType':{'type':Sequelize[_0x20c8('0x5')](_0x20c8('0x3'),_0x20c8('0x1'),_0x20c8('0x6'))},'keyContent':{'type':Sequelize[_0x20c8('0x4')]},'idField':{'type':Sequelize[_0x20c8('0x4')]},'nameField':{'type':Sequelize[_0x20c8('0x4')]},'customField':{'type':Sequelize[_0x20c8('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x20c8('0x4')]}}; \ No newline at end of file +var _0x3a8e=['STRING','variable','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x6fc37a,_0x44c1e0){var _0x50fba8=function(_0x444c94){while(--_0x444c94){_0x6fc37a['push'](_0x6fc37a['shift']());}};_0x50fba8(++_0x44c1e0);}(_0x3a8e,0x11a));var _0xe3a8=function(_0x499ea4,_0x254251){_0x499ea4=_0x499ea4-0x0;var _0x154ea3=_0x3a8e[_0x499ea4];return _0x154ea3;};'use strict';var Sequelize=require('sequelize');module[_0xe3a8('0x0')]={'type':{'type':Sequelize[_0xe3a8('0x1')](_0xe3a8('0x2'),'variable',_0xe3a8('0x3'),_0xe3a8('0x4'),_0xe3a8('0x5')),'defaultValue':_0xe3a8('0x2')},'content':{'type':Sequelize[_0xe3a8('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xe3a8('0x7'),_0xe3a8('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe3a8('0x6')]},'nameField':{'type':Sequelize[_0xe3a8('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe3a8('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index b001bfb..cd752e4 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 _0x7d54=['query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','VtigerField','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d54,0x140));var _0x47d5=function(_0x168057,_0x18fae0){_0x168057=_0x168057-0x0;var _0x470c2f=_0x7d54[_0x168057];return _0x470c2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47d5('0x0'));var zipdir=require(_0x47d5('0x1'));var jsonpatch=require(_0x47d5('0x2'));var rp=require(_0x47d5('0x3'));var moment=require(_0x47d5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47d5('0x5'));var util=require('util');var path=require(_0x47d5('0x6'));var sox=require('sox');var csv=require(_0x47d5('0x7'));var ejs=require(_0x47d5('0x8'));var fs=require('fs');var fs_extra=require(_0x47d5('0x9'));var _=require(_0x47d5('0xa'));var squel=require(_0x47d5('0xb'));var crypto=require('crypto');var jsforce=require(_0x47d5('0xc'));var deskjs=require(_0x47d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x47d5('0xe'));var Papa=require(_0x47d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x47d5('0x10'));var as=require(_0x47d5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d5('0x12'))('api');var utils=require(_0x47d5('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x47d5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35acdf,_0xd77965){_0xd77965=_0xd77965||0xcc;return function(_0x2a1488){if(_0x2a1488){return _0x35acdf['sendStatus'](_0xd77965);}return _0x35acdf[_0x47d5('0x15')](_0xd77965)[_0x47d5('0x16')]();};}function respondWithResult(_0x2fdbc4,_0x3ce3ac){_0x3ce3ac=_0x3ce3ac||0xc8;return function(_0x2baff1){if(_0x2baff1){return _0x2fdbc4[_0x47d5('0x15')](_0x3ce3ac)[_0x47d5('0x17')](_0x2baff1);}};}function respondWithFilteredResult(_0x38ccd3,_0x374f69){return function(_0xdfeaae){if(_0xdfeaae){var _0x1d8563=typeof _0x374f69[_0x47d5('0x18')]==='undefined'&&typeof _0x374f69[_0x47d5('0x19')]===_0x47d5('0x1a');var _0x52432a=_0xdfeaae['count'];var _0x553011=_0x1d8563?0x0:_0x374f69[_0x47d5('0x18')];var _0x35d070=_0x1d8563?_0xdfeaae[_0x47d5('0x1b')]:_0x374f69['offset']+_0x374f69[_0x47d5('0x19')];var _0x5df08b;if(_0x35d070>=_0x52432a){_0x35d070=_0x52432a;_0x5df08b=0xc8;}else{_0x5df08b=0xce;}_0x38ccd3[_0x47d5('0x15')](_0x5df08b);return _0x38ccd3[_0x47d5('0x1c')](_0x47d5('0x1d'),_0x553011+'-'+_0x35d070+'/'+_0x52432a)[_0x47d5('0x17')](_0xdfeaae);}return null;};}function patchUpdates(_0x3223eb){return function(_0x2b6a37){try{jsonpatch[_0x47d5('0x1e')](_0x2b6a37,_0x3223eb,!![]);}catch(_0xf54b0c){return BPromise[_0x47d5('0x1f')](_0xf54b0c);}return _0x2b6a37[_0x47d5('0x20')]();};}function saveUpdates(_0x448ce7,_0x511bcd){return function(_0x52bf22){if(_0x52bf22){return _0x52bf22[_0x47d5('0x21')](_0x448ce7)[_0x47d5('0x22')](function(_0x352100){return _0x352100;});}return null;};}function removeEntity(_0x2f6090,_0xe680cd){return function(_0xa73384){if(_0xa73384){return _0xa73384[_0x47d5('0x23')]()['then'](function(){_0x2f6090[_0x47d5('0x15')](0xcc)[_0x47d5('0x16')]();});}};}function handleEntityNotFound(_0x4165ea,_0x335769){return function(_0x8909b0){if(!_0x8909b0){_0x4165ea[_0x47d5('0x24')](0x194);}return _0x8909b0;};}function handleError(_0x25cf8e,_0x217e38){_0x217e38=_0x217e38||0x1f4;return function(_0x16beba){logger[_0x47d5('0x25')](_0x16beba[_0x47d5('0x26')]);if(_0x16beba[_0x47d5('0x27')]){delete _0x16beba[_0x47d5('0x27')];}_0x25cf8e[_0x47d5('0x15')](_0x217e38)['send'](_0x16beba);};}exports[_0x47d5('0x28')]=function(_0x17ec75,_0x3a9042){var _0x3d9747={},_0x5e1c99={},_0x431d48={'count':0x0,'rows':[]};var _0xfea35e=_[_0x47d5('0x29')](db[_0x47d5('0x2a')]['rawAttributes'],function(_0x2cc86f){return{'name':_0x2cc86f[_0x47d5('0x2b')],'type':_0x2cc86f[_0x47d5('0x2c')]['key']};});_0x5e1c99['model']=_[_0x47d5('0x29')](_0xfea35e,_0x47d5('0x27'));_0x5e1c99[_0x47d5('0x2d')]=_[_0x47d5('0x2e')](_0x17ec75[_0x47d5('0x2d')]);_0x5e1c99[_0x47d5('0x2f')]=_[_0x47d5('0x30')](_0x5e1c99['model'],_0x5e1c99[_0x47d5('0x2d')]);_0x3d9747['attributes']=_[_0x47d5('0x30')](_0x5e1c99[_0x47d5('0x31')],qs[_0x47d5('0x32')](_0x17ec75['query'][_0x47d5('0x32')]));_0x3d9747[_0x47d5('0x33')]=_0x3d9747['attributes'][_0x47d5('0x34')]?_0x3d9747[_0x47d5('0x33')]:_0x5e1c99['model'];if(!_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x35')](_0x47d5('0x36'))){_0x3d9747[_0x47d5('0x19')]=qs[_0x47d5('0x19')](_0x17ec75[_0x47d5('0x2d')]['limit']);_0x3d9747[_0x47d5('0x18')]=qs['offset'](_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x18')]);}_0x3d9747[_0x47d5('0x37')]=qs[_0x47d5('0x38')](_0x17ec75[_0x47d5('0x2d')]['sort']);_0x3d9747[_0x47d5('0x39')]=qs[_0x47d5('0x2f')](_[_0x47d5('0x3a')](_0x17ec75[_0x47d5('0x2d')],_0x5e1c99[_0x47d5('0x2f')]),_0xfea35e);if(_0x17ec75['query']['filter']){_0x3d9747[_0x47d5('0x39')]=_[_0x47d5('0x3b')](_0x3d9747[_0x47d5('0x39')],{'$or':_[_0x47d5('0x29')](_0xfea35e,function(_0x585ad7){if(_0x585ad7[_0x47d5('0x2c')]!==_0x47d5('0x3c')){var _0x252853={};_0x252853[_0x585ad7['name']]={'$like':'%'+_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x3d')]+'%'};return _0x252853;}})});}_0x3d9747=_['merge']({},_0x3d9747,_0x17ec75[_0x47d5('0x3e')]);var _0x66b1c9={'where':_0x3d9747[_0x47d5('0x39')]};return db[_0x47d5('0x2a')]['count'](_0x66b1c9)[_0x47d5('0x22')](function(_0x544e9b){_0x431d48['count']=_0x544e9b;if(_0x17ec75[_0x47d5('0x2d')][_0x47d5('0x3f')]){_0x3d9747[_0x47d5('0x40')]=[{'all':!![]}];}return db[_0x47d5('0x2a')]['findAll'](_0x3d9747);})[_0x47d5('0x22')](function(_0x1d2240){_0x431d48[_0x47d5('0x41')]=_0x1d2240;return _0x431d48;})[_0x47d5('0x22')](respondWithFilteredResult(_0x3a9042,_0x3d9747))[_0x47d5('0x42')](handleError(_0x3a9042,null));};exports[_0x47d5('0x43')]=function(_0x26596b,_0x1d162a){var _0x2455af={'raw':!![],'where':{'id':_0x26596b[_0x47d5('0x44')]['id']}},_0x28167a={};_0x28167a['model']=_[_0x47d5('0x2e')](db[_0x47d5('0x2a')][_0x47d5('0x45')]);_0x28167a['query']=_[_0x47d5('0x2e')](_0x26596b['query']);_0x28167a[_0x47d5('0x2f')]=_[_0x47d5('0x30')](_0x28167a[_0x47d5('0x31')],_0x28167a[_0x47d5('0x2d')]);_0x2455af[_0x47d5('0x33')]=_[_0x47d5('0x30')](_0x28167a['model'],qs['fields'](_0x26596b['query'][_0x47d5('0x32')]));_0x2455af[_0x47d5('0x33')]=_0x2455af[_0x47d5('0x33')][_0x47d5('0x34')]?_0x2455af[_0x47d5('0x33')]:_0x28167a[_0x47d5('0x31')];if(_0x26596b[_0x47d5('0x2d')][_0x47d5('0x3f')]){_0x2455af[_0x47d5('0x40')]=[{'all':!![]}];}_0x2455af=_[_0x47d5('0x3b')]({},_0x2455af,_0x26596b['options']);return db[_0x47d5('0x2a')][_0x47d5('0x46')](_0x2455af)[_0x47d5('0x22')](handleEntityNotFound(_0x1d162a,null))[_0x47d5('0x22')](respondWithResult(_0x1d162a,null))['catch'](handleError(_0x1d162a,null));};exports[_0x47d5('0x47')]=function(_0x5bd0d6,_0x934990){return db['VtigerField'][_0x47d5('0x47')](_0x5bd0d6[_0x47d5('0x48')],{})[_0x47d5('0x22')](respondWithResult(_0x934990,0xc9))[_0x47d5('0x42')](handleError(_0x934990,null));};exports[_0x47d5('0x21')]=function(_0x5792c7,_0x1577f5){if(_0x5792c7['body']['id']){delete _0x5792c7['body']['id'];}return db['VtigerField'][_0x47d5('0x46')]({'where':{'id':_0x5792c7[_0x47d5('0x44')]['id']}})[_0x47d5('0x22')](handleEntityNotFound(_0x1577f5,null))['then'](saveUpdates(_0x5792c7[_0x47d5('0x48')],null))[_0x47d5('0x22')](respondWithResult(_0x1577f5,null))['catch'](handleError(_0x1577f5,null));};exports[_0x47d5('0x23')]=function(_0x56ef28,_0x2288c6){return db[_0x47d5('0x2a')][_0x47d5('0x46')]({'where':{'id':_0x56ef28[_0x47d5('0x44')]['id']}})[_0x47d5('0x22')](handleEntityNotFound(_0x2288c6,null))[_0x47d5('0x22')](removeEntity(_0x2288c6,null))[_0x47d5('0x42')](handleError(_0x2288c6,null));}; \ No newline at end of file +var _0xd9a0=['create','body','catch','eml-format','request-promise','moment','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','show','params','includeAll','include','find'];(function(_0x168ecb,_0xd51f15){var _0x375aa8=function(_0x36a32f){while(--_0x36a32f){_0x168ecb['push'](_0x168ecb['shift']());}};_0x375aa8(++_0xd51f15);}(_0xd9a0,0x1df));var _0x0d9a=function(_0x470350,_0x307032){_0x470350=_0x470350-0x0;var _0x1fc5c3=_0xd9a0[_0x470350];return _0x1fc5c3;};'use strict';var emlformat=require(_0x0d9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0d9a('0x1'));var moment=require(_0x0d9a('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d9a('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x0d9a('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0d9a('0x5'));var _=require(_0x0d9a('0x6'));var squel=require(_0x0d9a('0x7'));var crypto=require(_0x0d9a('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x0d9a('0x9'));var toCsv=require(_0x0d9a('0x4'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d9a('0xa'));var authService=require(_0x0d9a('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x0d9a('0xc'));var hardwareService=require(_0x0d9a('0xd'));var logger=require(_0x0d9a('0xe'))(_0x0d9a('0xf'));var utils=require(_0x0d9a('0x10'));var config=require(_0x0d9a('0x11'));var licenseUtil=require(_0x0d9a('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3182ed,_0x330f65){_0x330f65=_0x330f65||0xcc;return function(_0x555161){if(_0x555161){return _0x3182ed['sendStatus'](_0x330f65);}return _0x3182ed[_0x0d9a('0x13')](_0x330f65)[_0x0d9a('0x14')]();};}function respondWithResult(_0x45b231,_0x344b23){_0x344b23=_0x344b23||0xc8;return function(_0x4d8053){if(_0x4d8053){return _0x45b231['status'](_0x344b23)[_0x0d9a('0x15')](_0x4d8053);}};}function respondWithFilteredResult(_0x5b52f9,_0x38a909){return function(_0x31cb0f){if(_0x31cb0f){var _0x2e1a07=typeof _0x38a909[_0x0d9a('0x16')]===_0x0d9a('0x17')&&typeof _0x38a909[_0x0d9a('0x18')]===_0x0d9a('0x17');var _0x3ad773=_0x31cb0f[_0x0d9a('0x19')];var _0xcacc07=_0x2e1a07?0x0:_0x38a909[_0x0d9a('0x16')];var _0x363d1a=_0x2e1a07?_0x31cb0f[_0x0d9a('0x19')]:_0x38a909['offset']+_0x38a909[_0x0d9a('0x18')];var _0x190909;if(_0x363d1a>=_0x3ad773){_0x363d1a=_0x3ad773;_0x190909=0xc8;}else{_0x190909=0xce;}_0x5b52f9[_0x0d9a('0x13')](_0x190909);return _0x5b52f9['set']('Content-Range',_0xcacc07+'-'+_0x363d1a+'/'+_0x3ad773)[_0x0d9a('0x15')](_0x31cb0f);}return null;};}function patchUpdates(_0x1b5197){return function(_0x400231){try{jsonpatch[_0x0d9a('0x1a')](_0x400231,_0x1b5197,!![]);}catch(_0x431443){return BPromise[_0x0d9a('0x1b')](_0x431443);}return _0x400231[_0x0d9a('0x1c')]();};}function saveUpdates(_0x5ea4af,_0x8e310b){return function(_0x1f0c18){if(_0x1f0c18){return _0x1f0c18[_0x0d9a('0x1d')](_0x5ea4af)[_0x0d9a('0x1e')](function(_0x7a7caf){return _0x7a7caf;});}return null;};}function removeEntity(_0x4ec9b2,_0x21037e){return function(_0x3a8d21){if(_0x3a8d21){return _0x3a8d21[_0x0d9a('0x1f')]()[_0x0d9a('0x1e')](function(){_0x4ec9b2['status'](0xcc)[_0x0d9a('0x14')]();});}};}function handleEntityNotFound(_0x5d27c0,_0x550d94){return function(_0x76bd9f){if(!_0x76bd9f){_0x5d27c0[_0x0d9a('0x20')](0x194);}return _0x76bd9f;};}function handleError(_0x4039db,_0x57646a){_0x57646a=_0x57646a||0x1f4;return function(_0x270fb6){logger[_0x0d9a('0x21')](_0x270fb6[_0x0d9a('0x22')]);if(_0x270fb6[_0x0d9a('0x23')]){delete _0x270fb6['name'];}_0x4039db[_0x0d9a('0x13')](_0x57646a)[_0x0d9a('0x24')](_0x270fb6);};}exports[_0x0d9a('0x25')]=function(_0x5b6a0f,_0x50aa66){var _0xcfd585={},_0x26900c={},_0x54d8dc={'count':0x0,'rows':[]};var _0x5613f7=_[_0x0d9a('0x26')](db[_0x0d9a('0x27')][_0x0d9a('0x28')],function(_0x2ff3a2){return{'name':_0x2ff3a2['fieldName'],'type':_0x2ff3a2['type'][_0x0d9a('0x29')]};});_0x26900c[_0x0d9a('0x2a')]=_[_0x0d9a('0x26')](_0x5613f7,_0x0d9a('0x23'));_0x26900c['query']=_[_0x0d9a('0x2b')](_0x5b6a0f['query']);_0x26900c[_0x0d9a('0x2c')]=_[_0x0d9a('0x2d')](_0x26900c['model'],_0x26900c[_0x0d9a('0x2e')]);_0xcfd585[_0x0d9a('0x2f')]=_[_0x0d9a('0x2d')](_0x26900c['model'],qs['fields'](_0x5b6a0f[_0x0d9a('0x2e')][_0x0d9a('0x30')]));_0xcfd585[_0x0d9a('0x2f')]=_0xcfd585['attributes'][_0x0d9a('0x31')]?_0xcfd585[_0x0d9a('0x2f')]:_0x26900c[_0x0d9a('0x2a')];if(!_0x5b6a0f[_0x0d9a('0x2e')]['hasOwnProperty'](_0x0d9a('0x32'))){_0xcfd585[_0x0d9a('0x18')]=qs[_0x0d9a('0x18')](_0x5b6a0f[_0x0d9a('0x2e')][_0x0d9a('0x18')]);_0xcfd585[_0x0d9a('0x16')]=qs[_0x0d9a('0x16')](_0x5b6a0f['query'][_0x0d9a('0x16')]);}_0xcfd585['order']=qs[_0x0d9a('0x33')](_0x5b6a0f['query'][_0x0d9a('0x33')]);_0xcfd585[_0x0d9a('0x34')]=qs[_0x0d9a('0x2c')](_[_0x0d9a('0x35')](_0x5b6a0f[_0x0d9a('0x2e')],_0x26900c[_0x0d9a('0x2c')]),_0x5613f7);if(_0x5b6a0f[_0x0d9a('0x2e')]['filter']){_0xcfd585['where']=_['merge'](_0xcfd585[_0x0d9a('0x34')],{'$or':_['map'](_0x5613f7,function(_0x4c0aa7){if(_0x4c0aa7[_0x0d9a('0x36')]!==_0x0d9a('0x37')){var _0x126e21={};_0x126e21[_0x4c0aa7[_0x0d9a('0x23')]]={'$like':'%'+_0x5b6a0f[_0x0d9a('0x2e')][_0x0d9a('0x38')]+'%'};return _0x126e21;}})});}_0xcfd585=_[_0x0d9a('0x39')]({},_0xcfd585,_0x5b6a0f[_0x0d9a('0x3a')]);var _0x1f50e4={'where':_0xcfd585[_0x0d9a('0x34')]};return db[_0x0d9a('0x27')][_0x0d9a('0x19')](_0x1f50e4)[_0x0d9a('0x1e')](function(_0x9b4a54){_0x54d8dc[_0x0d9a('0x19')]=_0x9b4a54;if(_0x5b6a0f[_0x0d9a('0x2e')]['includeAll']){_0xcfd585['include']=[{'all':!![]}];}return db[_0x0d9a('0x27')]['findAll'](_0xcfd585);})[_0x0d9a('0x1e')](function(_0x1d3913){_0x54d8dc[_0x0d9a('0x3b')]=_0x1d3913;return _0x54d8dc;})[_0x0d9a('0x1e')](respondWithFilteredResult(_0x50aa66,_0xcfd585))['catch'](handleError(_0x50aa66,null));};exports[_0x0d9a('0x3c')]=function(_0xbaeb4c,_0xaf8cce){var _0x2d688b={'raw':!![],'where':{'id':_0xbaeb4c[_0x0d9a('0x3d')]['id']}},_0x102b85={};_0x102b85[_0x0d9a('0x2a')]=_[_0x0d9a('0x2b')](db[_0x0d9a('0x27')][_0x0d9a('0x28')]);_0x102b85[_0x0d9a('0x2e')]=_['keys'](_0xbaeb4c[_0x0d9a('0x2e')]);_0x102b85[_0x0d9a('0x2c')]=_[_0x0d9a('0x2d')](_0x102b85['model'],_0x102b85[_0x0d9a('0x2e')]);_0x2d688b[_0x0d9a('0x2f')]=_[_0x0d9a('0x2d')](_0x102b85[_0x0d9a('0x2a')],qs[_0x0d9a('0x30')](_0xbaeb4c[_0x0d9a('0x2e')][_0x0d9a('0x30')]));_0x2d688b['attributes']=_0x2d688b[_0x0d9a('0x2f')][_0x0d9a('0x31')]?_0x2d688b[_0x0d9a('0x2f')]:_0x102b85[_0x0d9a('0x2a')];if(_0xbaeb4c[_0x0d9a('0x2e')][_0x0d9a('0x3e')]){_0x2d688b[_0x0d9a('0x3f')]=[{'all':!![]}];}_0x2d688b=_[_0x0d9a('0x39')]({},_0x2d688b,_0xbaeb4c[_0x0d9a('0x3a')]);return db[_0x0d9a('0x27')][_0x0d9a('0x40')](_0x2d688b)['then'](handleEntityNotFound(_0xaf8cce,null))[_0x0d9a('0x1e')](respondWithResult(_0xaf8cce,null))['catch'](handleError(_0xaf8cce,null));};exports[_0x0d9a('0x41')]=function(_0x3d4538,_0x393924){return db[_0x0d9a('0x27')]['create'](_0x3d4538[_0x0d9a('0x42')],{})[_0x0d9a('0x1e')](respondWithResult(_0x393924,0xc9))[_0x0d9a('0x43')](handleError(_0x393924,null));};exports[_0x0d9a('0x1d')]=function(_0x19fc60,_0x212328){if(_0x19fc60['body']['id']){delete _0x19fc60[_0x0d9a('0x42')]['id'];}return db['VtigerField'][_0x0d9a('0x40')]({'where':{'id':_0x19fc60[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x1e')](handleEntityNotFound(_0x212328,null))[_0x0d9a('0x1e')](saveUpdates(_0x19fc60[_0x0d9a('0x42')],null))[_0x0d9a('0x1e')](respondWithResult(_0x212328,null))[_0x0d9a('0x43')](handleError(_0x212328,null));};exports['destroy']=function(_0x2203d5,_0x5958e6){return db[_0x0d9a('0x27')][_0x0d9a('0x40')]({'where':{'id':_0x2203d5[_0x0d9a('0x3d')]['id']}})[_0x0d9a('0x1e')](handleEntityNotFound(_0x5958e6,null))[_0x0d9a('0x1e')](removeEntity(_0x5958e6,null))['catch'](handleError(_0x5958e6,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index cf32821..2ec5bc5 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 _0x7ab5=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','FieldId'];(function(_0x308f79,_0x121c42){var _0x71490e=function(_0x311a5f){while(--_0x311a5f){_0x308f79['push'](_0x308f79['shift']());}};_0x71490e(++_0x121c42);}(_0x7ab5,0x12c));var _0x57ab=function(_0x314118,_0x344b68){_0x314118=_0x314118-0x0;var _0x37c2fe=_0x7ab5[_0x314118];return _0x37c2fe;};'use strict';var _=require(_0x57ab('0x0'));var util=require(_0x57ab('0x1'));var logger=require(_0x57ab('0x2'))(_0x57ab('0x3'));var moment=require(_0x57ab('0x4'));var BPromise=require(_0x57ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57ab('0x6'));var rimraf=require('rimraf');var config=require(_0x57ab('0x7'));var attributes=require(_0x57ab('0x8'));module[_0x57ab('0x9')]=function(_0x34881c,_0x5f2e0b){return _0x34881c[_0x57ab('0xa')](_0x57ab('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x57ab('0xc'),'fields':[_0x57ab('0xd'),_0x57ab('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1bd2=['path','../../config/environment','exports','VtigerField','int_vtiger_fields','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xe8855c,_0x588a7f){var _0x24097e=function(_0x14adad){while(--_0x14adad){_0xe8855c['push'](_0xe8855c['shift']());}};_0x24097e(++_0x588a7f);}(_0x1bd2,0x13e));var _0x21bd=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1bd2[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x21bd('0x0'));var util=require('util');var logger=require(_0x21bd('0x1'))(_0x21bd('0x2'));var moment=require(_0x21bd('0x3'));var BPromise=require(_0x21bd('0x4'));var rp=require(_0x21bd('0x5'));var fs=require('fs');var path=require(_0x21bd('0x6'));var rimraf=require('rimraf');var config=require(_0x21bd('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x21bd('0x8')]=function(_0x2685c5,_0x18c64d){return _0x2685c5['define'](_0x21bd('0x9'),attributes,{'tableName':_0x21bd('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x21bd('0xb')],'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 7bb3ea5..bc94640 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 _0x3436=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x3436,0x1b6));var _0x6343=function(_0x69ec75,_0x878df4){_0x69ec75=_0x69ec75-0x0;var _0xdcec92=_0x3436[_0x69ec75];return _0xdcec92;};'use strict';var _=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var moment=require(_0x6343('0x2'));var BPromise=require(_0x6343('0x3'));var rs=require(_0x6343('0x4'));var fs=require('fs');var Redis=require(_0x6343('0x5'));var db=require(_0x6343('0x6'))['db'];var utils=require(_0x6343('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6343('0x8'));var jayson=require(_0x6343('0x9'));var client=jayson['client'][_0x6343('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d117,_0x2f658e,_0x313ee5){return new BPromise(function(_0x1832bd,_0xf57b31){return client[_0x6343('0xb')](_0x16d117,_0x313ee5)[_0x6343('0xc')](function(_0x15ef6e){logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));logger[_0x6343('0x10')](_0x6343('0x11'),_0x2f658e,_0x6343('0xf'),JSON[_0x6343('0x12')](_0x15ef6e));if(_0x15ef6e[_0x6343('0x13')]){if(_0x15ef6e[_0x6343('0x13')][_0x6343('0x14')]===0x1f4){logger[_0x6343('0x13')]('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x15ef6e['error'][_0x6343('0x15')]);return _0xf57b31(_0x15ef6e[_0x6343('0x13')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);return _0x1832bd(_0x15ef6e[_0x6343('0x13')][_0x6343('0x15')]);}else{logger[_0x6343('0xd')](_0x6343('0xe'),_0x2f658e,_0x6343('0xf'));_0x1832bd(_0x15ef6e[_0x6343('0x16')][_0x6343('0x15')]);}})[_0x6343('0x17')](function(_0x50989e){logger[_0x6343('0x13')]('VtigerField,\x20%s,\x20%s',_0x2f658e,_0x50989e);_0xf57b31(_0x50989e);});});} \ No newline at end of file +var _0x4cf5=['../../config/logger','../../config/environment','client','http','request','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VtigerField,\x20%s,\x20%s','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x9ee28,_0x20bd34){var _0x54d111=function(_0x4178c8){while(--_0x4178c8){_0x9ee28['push'](_0x9ee28['shift']());}};_0x54d111(++_0x20bd34);}(_0x4cf5,0xeb));var _0x54cf=function(_0x343ba3,_0x4d251d){_0x343ba3=_0x343ba3-0x0;var _0x24c7f4=_0x4cf5[_0x343ba3];return _0x24c7f4;};'use strict';var _=require(_0x54cf('0x0'));var util=require('util');var moment=require(_0x54cf('0x1'));var BPromise=require(_0x54cf('0x2'));var rs=require(_0x54cf('0x3'));var fs=require('fs');var Redis=require(_0x54cf('0x4'));var db=require(_0x54cf('0x5'))['db'];var utils=require(_0x54cf('0x6'));var logger=require(_0x54cf('0x7'))('rpc');var config=require(_0x54cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x54cf('0x9')][_0x54cf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xec0166,_0x4bf6a4,_0xa14c91){return new BPromise(function(_0x340a38,_0x1e82b4){return client[_0x54cf('0xb')](_0xec0166,_0xa14c91)[_0x54cf('0xc')](function(_0x37424c){logger['info']('VtigerField,\x20%s,\x20%s',_0x4bf6a4,'request\x20sent');logger[_0x54cf('0xd')](_0x54cf('0xe'),_0x4bf6a4,_0x54cf('0xf'),JSON['stringify'](_0x37424c));if(_0x37424c[_0x54cf('0x10')]){if(_0x37424c['error'][_0x54cf('0x11')]===0x1f4){logger[_0x54cf('0x10')]('VtigerField,\x20%s,\x20%s',_0x4bf6a4,_0x37424c[_0x54cf('0x10')][_0x54cf('0x12')]);return _0x1e82b4(_0x37424c[_0x54cf('0x10')][_0x54cf('0x12')]);}logger[_0x54cf('0x10')](_0x54cf('0x13'),_0x4bf6a4,_0x37424c[_0x54cf('0x10')]['message']);return _0x340a38(_0x37424c[_0x54cf('0x10')]['message']);}else{logger[_0x54cf('0x14')]('VtigerField,\x20%s,\x20%s',_0x4bf6a4,_0x54cf('0xf'));_0x340a38(_0x37424c['result'][_0x54cf('0x12')]);}})[_0x54cf('0x15')](function(_0xd4819e){logger[_0x54cf('0x10')](_0x54cf('0x13'),_0x4bf6a4,_0xd4819e);_0x1e82b4(_0xd4819e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e9e55f0..781e1c8 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 _0xe0a8=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getFields','post','create','/:id/configurations','put','update','destroy','multer','path','connect-timeout','Router','fs-extra'];(function(_0xd167bb,_0x3d1cf8){var _0x1bb4c0=function(_0x4888c2){while(--_0x4888c2){_0xd167bb['push'](_0xd167bb['shift']());}};_0x1bb4c0(++_0x3d1cf8);}(_0xe0a8,0xc3));var _0x8e0a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe0a8[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x8e0a('0x0'));var util=require('util');var path=require(_0x8e0a('0x1'));var timeout=require(_0x8e0a('0x2'));var express=require('express');var router=express[_0x8e0a('0x3')]();var fs_extra=require(_0x8e0a('0x4'));var auth=require(_0x8e0a('0x5'));var interaction=require(_0x8e0a('0x6'));var config=require(_0x8e0a('0x7'));var controller=require('./intZendeskAccount.controller');router[_0x8e0a('0x8')]('/',auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xa')]);router['get'](_0x8e0a('0xb'),auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xc')]);router['get']('/:id/configurations',auth[_0x8e0a('0x9')](),controller['getConfigurations']);router[_0x8e0a('0x8')]('/:id/fields',auth[_0x8e0a('0x9')](),controller[_0x8e0a('0xd')]);router[_0x8e0a('0xe')]('/',auth['isAuthenticated'](),controller[_0x8e0a('0xf')]);router[_0x8e0a('0xe')](_0x8e0a('0x10'),auth[_0x8e0a('0x9')](),controller['addConfiguration']);router[_0x8e0a('0x11')](_0x8e0a('0xb'),auth[_0x8e0a('0x9')](),controller[_0x8e0a('0x12')]);router['delete'](_0x8e0a('0xb'),auth['isAuthenticated'](),controller[_0x8e0a('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7772=['post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x4eb7ab,_0x4c9015){var _0x121254=function(_0x269f19){while(--_0x269f19){_0x4eb7ab['push'](_0x4eb7ab['shift']());}};_0x121254(++_0x4c9015);}(_0x7772,0x1ec));var _0x2777=function(_0x555d90,_0x4db4da){_0x555d90=_0x555d90-0x0;var _0x351923=_0x7772[_0x555d90];return _0x351923;};'use strict';var multer=require(_0x2777('0x0'));var util=require(_0x2777('0x1'));var path=require('path');var timeout=require(_0x2777('0x2'));var express=require('express');var router=express[_0x2777('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2777('0x4'));var interaction=require(_0x2777('0x5'));var config=require(_0x2777('0x6'));var controller=require('./intZendeskAccount.controller');router[_0x2777('0x7')]('/',auth['isAuthenticated'](),controller[_0x2777('0x8')]);router[_0x2777('0x7')](_0x2777('0x9'),auth[_0x2777('0xa')](),controller[_0x2777('0xb')]);router[_0x2777('0x7')]('/:id/configurations',auth[_0x2777('0xa')](),controller['getConfigurations']);router[_0x2777('0x7')](_0x2777('0xc'),auth['isAuthenticated'](),controller[_0x2777('0xd')]);router[_0x2777('0xe')]('/',auth['isAuthenticated'](),controller[_0x2777('0xf')]);router[_0x2777('0xe')](_0x2777('0x10'),auth[_0x2777('0xa')](),controller[_0x2777('0x11')]);router[_0x2777('0x12')]('/:id',auth[_0x2777('0xa')](),controller[_0x2777('0x13')]);router[_0x2777('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x2777('0x15')]);module[_0x2777('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 5d89c4e..09c32e9 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 _0x5353=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab','sequelize'];(function(_0x411386,_0x269f32){var _0x3b7534=function(_0x34c03e){while(--_0x34c03e){_0x411386['push'](_0x411386['shift']());}};_0x3b7534(++_0x269f32);}(_0x5353,0x12f));var _0x3535=function(_0x33ae17,_0x5df19c){_0x33ae17=_0x33ae17-0x0;var _0x5878ee=_0x5353[_0x33ae17];return _0x5878ee;};'use strict';var Sequelize=require(_0x3535('0x0'));module['exports']={'name':{'type':Sequelize[_0x3535('0x1')]},'description':{'type':Sequelize[_0x3535('0x1')]},'username':{'type':Sequelize[_0x3535('0x1')],'unique':_0x3535('0x2')},'password':{'type':Sequelize[_0x3535('0x1')]},'token':{'type':Sequelize[_0x3535('0x1')]},'remoteUri':{'type':Sequelize[_0x3535('0x1')],'unique':_0x3535('0x3')},'authType':{'type':Sequelize[_0x3535('0x4')](_0x3535('0x5'),'token'),'defaultValue':_0x3535('0x5')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3535('0x4')](_0x3535('0x6'),_0x3535('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xbc36=['newTab','sequelize','STRING','username','remoteUri','ENUM','token','password','integrationTab'];(function(_0x2f1ba3,_0x9c1b4f){var _0x25df19=function(_0x3ddd9f){while(--_0x3ddd9f){_0x2f1ba3['push'](_0x2f1ba3['shift']());}};_0x25df19(++_0x9c1b4f);}(_0xbc36,0x169));var _0x6bc3=function(_0x149b0d,_0x5acd67){_0x149b0d=_0x149b0d-0x0;var _0x59818b=_0xbc36[_0x149b0d];return _0x59818b;};'use strict';var Sequelize=require(_0x6bc3('0x0'));module['exports']={'name':{'type':Sequelize[_0x6bc3('0x1')]},'description':{'type':Sequelize[_0x6bc3('0x1')]},'username':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x2')},'password':{'type':Sequelize[_0x6bc3('0x1')]},'token':{'type':Sequelize[_0x6bc3('0x1')]},'remoteUri':{'type':Sequelize[_0x6bc3('0x1')],'unique':_0x6bc3('0x3')},'authType':{'type':Sequelize[_0x6bc3('0x4')]('password',_0x6bc3('0x5')),'defaultValue':_0x6bc3('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bc3('0x4')](_0x6bc3('0x7'),_0x6bc3('0x8')),'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 5cbdbef..2c025fc 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 _0x97c1=['crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ZendeskAccount','fieldName','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','rawAttributes','find','catch','create','body','findOne','params','ZendeskConfiguration','getConfigurations','addConfiguration','getSubjects','channel','getDescriptions','ZendeskField','Subjects','Descriptions','getFields','authType','remoteUri','slice','lastIndexOf','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','password','base64','token','%s/token:%s','toString','Sequelize','subject','description','group','assignee','remove','position','system_field_options','custom_field_options','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel'];(function(_0x30118d,_0x359098){var _0x3f756c=function(_0x6975b2){while(--_0x6975b2){_0x30118d['push'](_0x30118d['shift']());}};_0x3f756c(++_0x359098);}(_0x97c1,0xdf));var _0x197c=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x97c1[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x197c('0x0'));var rimraf=require(_0x197c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x197c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x197c('0x3'));var Mustache=require(_0x197c('0x4'));var util=require(_0x197c('0x5'));var path=require(_0x197c('0x6'));var sox=require(_0x197c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x197c('0x8'));var _=require(_0x197c('0x9'));var squel=require(_0x197c('0xa'));var crypto=require(_0x197c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x197c('0xc'));var querystring=require('querystring');var Papa=require(_0x197c('0xd'));var Redis=require(_0x197c('0xe'));var authService=require(_0x197c('0xf'));var qs=require(_0x197c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x197c('0x11'));var logger=require(_0x197c('0x12'))(_0x197c('0x13'));var utils=require(_0x197c('0x14'));var config=require(_0x197c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x197c('0x16'))['db'];var integrations=require(_0x197c('0x17'));function respondWithStatusCode(_0x27e46f,_0x1adcfa){_0x1adcfa=_0x1adcfa||0xcc;return function(_0x567658){if(_0x567658){return _0x27e46f[_0x197c('0x18')](_0x1adcfa);}return _0x27e46f[_0x197c('0x19')](_0x1adcfa)[_0x197c('0x1a')]();};}function respondWithResult(_0xf735ce,_0x188ff2){_0x188ff2=_0x188ff2||0xc8;return function(_0x109af2){if(_0x109af2){return _0xf735ce['status'](_0x188ff2)['json'](_0x109af2);}};}function respondWithFilteredResult(_0x422dfa,_0x2bc612){return function(_0x2083d4){if(_0x2083d4){var _0x24901f=typeof _0x2bc612[_0x197c('0x1b')]===_0x197c('0x1c')&&typeof _0x2bc612[_0x197c('0x1d')]===_0x197c('0x1c');var _0x47f43b=_0x2083d4[_0x197c('0x1e')];var _0x47aaa9=_0x24901f?0x0:_0x2bc612['offset'];var _0x1725d9=_0x24901f?_0x2083d4[_0x197c('0x1e')]:_0x2bc612[_0x197c('0x1b')]+_0x2bc612[_0x197c('0x1d')];var _0x4a4994;if(_0x1725d9>=_0x47f43b){_0x1725d9=_0x47f43b;_0x4a4994=0xc8;}else{_0x4a4994=0xce;}_0x422dfa[_0x197c('0x19')](_0x4a4994);return _0x422dfa[_0x197c('0x1f')](_0x197c('0x20'),_0x47aaa9+'-'+_0x1725d9+'/'+_0x47f43b)['json'](_0x2083d4);}return null;};}function patchUpdates(_0x1adb43){return function(_0x27b3df){try{jsonpatch[_0x197c('0x21')](_0x27b3df,_0x1adb43,!![]);}catch(_0xf3aeda){return BPromise[_0x197c('0x22')](_0xf3aeda);}return _0x27b3df[_0x197c('0x23')]();};}function saveUpdates(_0x362bbf,_0x2092a0){return function(_0x8963fd){if(_0x8963fd){return _0x8963fd[_0x197c('0x24')](_0x362bbf)[_0x197c('0x25')](function(_0x177bc9){return _0x177bc9;});}return null;};}function removeEntity(_0x174942,_0x2a1310){return function(_0x37b040){if(_0x37b040){return _0x37b040[_0x197c('0x26')]()['then'](function(){_0x174942[_0x197c('0x19')](0xcc)[_0x197c('0x1a')]();});}};}function handleEntityNotFound(_0x2b6319,_0x499051){return function(_0x2c2952){if(!_0x2c2952){_0x2b6319[_0x197c('0x18')](0x194);}return _0x2c2952;};}function handleError(_0x4c3337,_0x5e7bc9){_0x5e7bc9=_0x5e7bc9||0x1f4;return function(_0x12b37b){logger['error'](_0x12b37b[_0x197c('0x27')]);if(_0x12b37b[_0x197c('0x28')]){delete _0x12b37b[_0x197c('0x28')];}_0x4c3337[_0x197c('0x19')](_0x5e7bc9)[_0x197c('0x29')](_0x12b37b);};}exports[_0x197c('0x2a')]=function(_0x2b6154,_0x215df1){var _0x4422d1={},_0x5df39e={},_0x50dea3={'count':0x0,'rows':[]};var _0x574274=_['map'](db[_0x197c('0x2b')]['rawAttributes'],function(_0x252cde){return{'name':_0x252cde[_0x197c('0x2c')],'type':_0x252cde['type'][_0x197c('0x2d')]};});_0x5df39e['model']=_[_0x197c('0x2e')](_0x574274,_0x197c('0x28'));_0x5df39e[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x2b6154[_0x197c('0x2f')]);_0x5df39e[_0x197c('0x31')]=_[_0x197c('0x32')](_0x5df39e[_0x197c('0x33')],_0x5df39e[_0x197c('0x2f')]);_0x4422d1['attributes']=_['intersection'](_0x5df39e[_0x197c('0x33')],qs[_0x197c('0x34')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x34')]));_0x4422d1[_0x197c('0x35')]=_0x4422d1[_0x197c('0x35')][_0x197c('0x36')]?_0x4422d1['attributes']:_0x5df39e['model'];if(!_0x2b6154[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x4422d1['limit']=qs[_0x197c('0x1d')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1d')]);_0x4422d1[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x2b6154[_0x197c('0x2f')][_0x197c('0x1b')]);}_0x4422d1[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x2b6154['query'][_0x197c('0x39')]);_0x4422d1[_0x197c('0x3a')]=qs[_0x197c('0x31')](_[_0x197c('0x3b')](_0x2b6154[_0x197c('0x2f')],_0x5df39e[_0x197c('0x31')]),_0x574274);if(_0x2b6154['query'][_0x197c('0x3c')]){_0x4422d1[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x4422d1['where'],{'$or':_[_0x197c('0x2e')](_0x574274,function(_0x34dabc){if(_0x34dabc[_0x197c('0x3e')]!==_0x197c('0x3f')){var _0x2970b4={};_0x2970b4[_0x34dabc[_0x197c('0x28')]]={'$like':'%'+_0x2b6154[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2970b4;}})});}_0x4422d1=_[_0x197c('0x3d')]({},_0x4422d1,_0x2b6154[_0x197c('0x40')]);var _0x4a12fc={'where':_0x4422d1[_0x197c('0x3a')]};return db[_0x197c('0x2b')]['count'](_0x4a12fc)['then'](function(_0xa57083){_0x50dea3[_0x197c('0x1e')]=_0xa57083;if(_0x2b6154[_0x197c('0x2f')][_0x197c('0x41')]){_0x4422d1[_0x197c('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x197c('0x43')](_0x4422d1);})[_0x197c('0x25')](function(_0x7ed02b){_0x50dea3[_0x197c('0x44')]=_0x7ed02b;return _0x50dea3;})[_0x197c('0x25')](respondWithFilteredResult(_0x215df1,_0x4422d1))['catch'](handleError(_0x215df1,null));};exports[_0x197c('0x45')]=function(_0x37bb94,_0x6d7bda){var _0x197b27={'raw':![],'where':{'id':_0x37bb94['params']['id']}},_0x2f3c4b={};_0x2f3c4b[_0x197c('0x33')]=_[_0x197c('0x30')](db[_0x197c('0x2b')][_0x197c('0x46')]);_0x2f3c4b[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x37bb94[_0x197c('0x2f')]);_0x2f3c4b[_0x197c('0x31')]=_[_0x197c('0x32')](_0x2f3c4b[_0x197c('0x33')],_0x2f3c4b[_0x197c('0x2f')]);_0x197b27['attributes']=_['intersection'](_0x2f3c4b['model'],qs['fields'](_0x37bb94[_0x197c('0x2f')][_0x197c('0x34')]));_0x197b27['attributes']=_0x197b27[_0x197c('0x35')][_0x197c('0x36')]?_0x197b27['attributes']:_0x2f3c4b[_0x197c('0x33')];if(_0x37bb94[_0x197c('0x2f')]['includeAll']){_0x197b27[_0x197c('0x42')]=[{'all':!![]}];}_0x197b27=_[_0x197c('0x3d')]({},_0x197b27,_0x37bb94['options']);return db[_0x197c('0x2b')][_0x197c('0x47')](_0x197b27)[_0x197c('0x25')](handleEntityNotFound(_0x6d7bda,null))['then'](respondWithResult(_0x6d7bda,null))[_0x197c('0x48')](handleError(_0x6d7bda,null));};exports[_0x197c('0x49')]=function(_0x220909,_0x1a92d2){return db['ZendeskAccount'][_0x197c('0x49')](_0x220909[_0x197c('0x4a')],{})[_0x197c('0x25')](respondWithResult(_0x1a92d2,0xc9))['catch'](handleError(_0x1a92d2,null));};exports['update']=function(_0x3a5089,_0x332c75){if(_0x3a5089[_0x197c('0x4a')]['id']){delete _0x3a5089[_0x197c('0x4a')]['id'];}return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x3a5089['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x332c75,null))['then'](saveUpdates(_0x3a5089[_0x197c('0x4a')],null))[_0x197c('0x25')](respondWithResult(_0x332c75,null))[_0x197c('0x48')](handleError(_0x332c75,null));};exports[_0x197c('0x26')]=function(_0x34a211,_0x2ab21f){return db[_0x197c('0x2b')][_0x197c('0x47')]({'where':{'id':_0x34a211['params']['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x2ab21f,null))[_0x197c('0x25')](removeEntity(_0x2ab21f,null))[_0x197c('0x48')](handleError(_0x2ab21f,null));};exports['getConfigurations']=function(_0x114ef5,_0x495c1d,_0x204592){var _0x1d2a5f={};var _0x1ec51a={};var _0x22a106;var _0x1d7cdd;return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x114ef5[_0x197c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x495c1d,null))[_0x197c('0x25')](function(_0x3a9261){if(_0x3a9261){_0x22a106=_0x3a9261;_0x1ec51a[_0x197c('0x33')]=_['keys'](db[_0x197c('0x4d')][_0x197c('0x46')]);_0x1ec51a[_0x197c('0x2f')]=_[_0x197c('0x30')](_0x114ef5[_0x197c('0x2f')]);_0x1ec51a['filters']=_['intersection'](_0x1ec51a[_0x197c('0x33')],_0x1ec51a[_0x197c('0x2f')]);_0x1d2a5f[_0x197c('0x35')]=_[_0x197c('0x32')](_0x1ec51a[_0x197c('0x33')],qs['fields'](_0x114ef5['query'][_0x197c('0x34')]));_0x1d2a5f[_0x197c('0x35')]=_0x1d2a5f['attributes'][_0x197c('0x36')]?_0x1d2a5f[_0x197c('0x35')]:_0x1ec51a[_0x197c('0x33')];_0x1d2a5f[_0x197c('0x38')]=qs[_0x197c('0x39')](_0x114ef5[_0x197c('0x2f')]['sort']);_0x1d2a5f[_0x197c('0x3a')]=qs[_0x197c('0x31')](_['pick'](_0x114ef5['query'],_0x1ec51a[_0x197c('0x31')]));if(_0x114ef5['query'][_0x197c('0x3c')]){_0x1d2a5f[_0x197c('0x3a')]=_[_0x197c('0x3d')](_0x1d2a5f['where'],{'$or':_[_0x197c('0x2e')](_0x1d2a5f[_0x197c('0x35')],function(_0x5585de){var _0x2dcbca={};_0x2dcbca[_0x5585de]={'$like':'%'+_0x114ef5[_0x197c('0x2f')][_0x197c('0x3c')]+'%'};return _0x2dcbca;})});}_0x1d2a5f=_['merge']({},_0x1d2a5f,_0x114ef5[_0x197c('0x40')]);return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})['then'](function(_0x570d76){if(_0x570d76){_0x1d7cdd=_0x570d76[_0x197c('0x36')];if(!_0x114ef5[_0x197c('0x2f')][_0x197c('0x37')]('nolimit')){_0x1d2a5f[_0x197c('0x1d')]=qs[_0x197c('0x1d')](_0x114ef5[_0x197c('0x2f')]['limit']);_0x1d2a5f[_0x197c('0x1b')]=qs[_0x197c('0x1b')](_0x114ef5[_0x197c('0x2f')][_0x197c('0x1b')]);}return _0x22a106[_0x197c('0x4e')](_0x1d2a5f);}})[_0x197c('0x25')](function(_0x8d1f3f){if(_0x8d1f3f){return _0x8d1f3f?{'count':_0x1d7cdd,'rows':_0x8d1f3f}:null;}})[_0x197c('0x25')](respondWithResult(_0x495c1d,null))[_0x197c('0x48')](handleError(_0x495c1d,null));};exports[_0x197c('0x4f')]=function(_0x5ef485,_0x1f7ad0,_0x572649){if(_0x5ef485['body']['id']){delete _0x5ef485['body']['id'];}return db['ZendeskAccount'][_0x197c('0x4b')]({'where':{'id':_0x5ef485[_0x197c('0x4c')]['id']}})[_0x197c('0x25')](handleEntityNotFound(_0x1f7ad0,null))[_0x197c('0x25')](function(_0x55b744){if(_0x55b744){_0x5ef485[_0x197c('0x4a')]['AccountId']=_0x55b744['id'];_0x5ef485[_0x197c('0x4a')]['Subjects']=integrations[_0x197c('0x50')](_0x5ef485['body'][_0x197c('0x51')],_0x5ef485[_0x197c('0x4a')][_0x197c('0x3e')]);_0x5ef485[_0x197c('0x4a')]['Descriptions']=integrations[_0x197c('0x52')](_0x5ef485[_0x197c('0x4a')][_0x197c('0x51')],_0x5ef485['body'][_0x197c('0x3e')]);return db[_0x197c('0x4d')][_0x197c('0x49')](_0x5ef485[_0x197c('0x4a')],{'include':[{'model':db[_0x197c('0x53')],'as':_0x197c('0x54')},{'model':db[_0x197c('0x53')],'as':_0x197c('0x55')}]});}return null;})[_0x197c('0x25')](respondWithResult(_0x1f7ad0,null))[_0x197c('0x48')](handleError(_0x1f7ad0,null));};exports[_0x197c('0x56')]=function(_0x25d3c1,_0x43c0b2,_0x395fce){var _0x2b1c78='';return db[_0x197c('0x2b')][_0x197c('0x4b')]({'where':{'id':_0x25d3c1[_0x197c('0x4c')]['id']},'attributes':['id','username','password','token',_0x197c('0x57'),'remoteUri']})[_0x197c('0x25')](handleEntityNotFound(_0x43c0b2,null))['then'](function(_0x5a601c){if(_0x5a601c){_0x2b1c78=_0x5a601c[_0x197c('0x58')];var _0x2c9746=_0x2b1c78[_0x197c('0x59')](-0x1);if(_0x2c9746==='/'){_0x2b1c78=_0x2b1c78['substring'](0x0,_0x2b1c78[_0x197c('0x5a')](_0x2c9746));}var _0x238092={'method':'GET','uri':util[_0x197c('0x5b')](_0x197c('0x5c'),_0x2b1c78,_0x197c('0x5d')),'json':!![]};switch(_0x5a601c[_0x197c('0x57')]){case'password':_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util['format'](_0x197c('0x60'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x62')]))['toString'](_0x197c('0x63')))};break;case _0x197c('0x64'):_0x238092[_0x197c('0x5e')]={'Authorization':util['format'](_0x197c('0x5f'),new Buffer(util[_0x197c('0x5b')](_0x197c('0x65'),_0x5a601c[_0x197c('0x61')],_0x5a601c[_0x197c('0x64')]))[_0x197c('0x66')]('base64'))};break;default:throw new db[(_0x197c('0x67'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x238092);}})[_0x197c('0x25')](function(_0x8c0d4a){if(_0x8c0d4a){var _0x58e708=[_0x197c('0x68'),_0x197c('0x69'),_0x197c('0x6a'),_0x197c('0x6b')];_[_0x197c('0x6c')](_0x8c0d4a['ticket_fields'],function(_0x5da64e){return _0x58e708['includes'](_0x5da64e['type']);});return{'count':_0x8c0d4a[_0x197c('0x5d')][_0x197c('0x36')],'rows':_['map'](_0x8c0d4a['ticket_fields'],function(_0x213e01){return{'id':_0x213e01['id'],'name':_0x213e01['position']>0x7?_0x213e01['title']:_0x213e01[_0x197c('0x3e')],'custom':_0x213e01[_0x197c('0x6d')]>0x7?!![]:![],'options':_0x213e01[_0x197c('0x6e')]?_0x213e01[_0x197c('0x6e')]:_0x213e01[_0x197c('0x6f')]?_0x213e01[_0x197c('0x6f')]:[]};})};}})['then'](respondWithResult(_0x43c0b2,null))[_0x197c('0x48')](function(_0x2321e1){var _0x43fc99=_0x25d3c1[_0x197c('0x2f')][_0x197c('0x70')]?0x1f4:_0x2321e1[_0x197c('0x71')]||0x1f4;logger[_0x197c('0x72')]('getFields,\x20%s,\x20%s,\x20%s',_0x197c('0x56'),_0x43fc99,JSON[_0x197c('0x73')](_0x2321e1));delete _0x2321e1[_0x197c('0x28')];if(_0x43fc99===0x191){_0x43fc99=0x190;}_0x43c0b2[_0x197c('0x19')](_0x43fc99)[_0x197c('0x29')](_0x25d3c1[_0x197c('0x2f')]['test']?{'message':_0x197c('0x74'),'statusCode':_0x2321e1[_0x197c('0x71')]}:_0x2321e1);});}; \ No newline at end of file +var _0xc900=['query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','password','token','authType','remoteUri','substring','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','toString','base64','ValidationError','Unknown\x20authentication\x20type','subject','group','remove','includes','title','position','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskAccount','fieldName','type','model'];(function(_0xfb2530,_0x5130f9){var _0x3a82bc=function(_0x35fdb2){while(--_0x35fdb2){_0xfb2530['push'](_0xfb2530['shift']());}};_0x3a82bc(++_0x5130f9);}(_0xc900,0xb3));var _0x0c90=function(_0x100541,_0x2afcf4){_0x100541=_0x100541-0x0;var _0x40a7ef=_0xc900[_0x100541];return _0x40a7ef;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x459cdb,_0x26fc46){_0x26fc46=_0x26fc46||0xcc;return function(_0x4535a2){if(_0x4535a2){return _0x459cdb[_0x0c90('0x19')](_0x26fc46);}return _0x459cdb[_0x0c90('0x1a')](_0x26fc46)['end']();};}function respondWithResult(_0x467b32,_0x4451e0){_0x4451e0=_0x4451e0||0xc8;return function(_0x4f35f4){if(_0x4f35f4){return _0x467b32[_0x0c90('0x1a')](_0x4451e0)[_0x0c90('0x1b')](_0x4f35f4);}};}function respondWithFilteredResult(_0x3bd5e8,_0x5bef7d){return function(_0x5daeb7){if(_0x5daeb7){var _0x412635=typeof _0x5bef7d[_0x0c90('0x1c')]===_0x0c90('0x1d')&&typeof _0x5bef7d[_0x0c90('0x1e')]===_0x0c90('0x1d');var _0x2cab22=_0x5daeb7[_0x0c90('0x1f')];var _0x57b9a6=_0x412635?0x0:_0x5bef7d[_0x0c90('0x1c')];var _0x38becc=_0x412635?_0x5daeb7[_0x0c90('0x1f')]:_0x5bef7d[_0x0c90('0x1c')]+_0x5bef7d['limit'];var _0x10a775;if(_0x38becc>=_0x2cab22){_0x38becc=_0x2cab22;_0x10a775=0xc8;}else{_0x10a775=0xce;}_0x3bd5e8[_0x0c90('0x1a')](_0x10a775);return _0x3bd5e8[_0x0c90('0x20')](_0x0c90('0x21'),_0x57b9a6+'-'+_0x38becc+'/'+_0x2cab22)[_0x0c90('0x1b')](_0x5daeb7);}return null;};}function patchUpdates(_0xc08f54){return function(_0x4cc940){try{jsonpatch[_0x0c90('0x22')](_0x4cc940,_0xc08f54,!![]);}catch(_0x4d629f){return BPromise[_0x0c90('0x23')](_0x4d629f);}return _0x4cc940[_0x0c90('0x24')]();};}function saveUpdates(_0x47b13c,_0x2a053a){return function(_0x43ddc3){if(_0x43ddc3){return _0x43ddc3[_0x0c90('0x25')](_0x47b13c)[_0x0c90('0x26')](function(_0x212164){return _0x212164;});}return null;};}function removeEntity(_0x3b287c,_0x4dfbc3){return function(_0x26f0a3){if(_0x26f0a3){return _0x26f0a3[_0x0c90('0x27')]()['then'](function(){_0x3b287c['status'](0xcc)[_0x0c90('0x28')]();});}};}function handleEntityNotFound(_0x3ea861,_0x35c243){return function(_0x109a5f){if(!_0x109a5f){_0x3ea861['sendStatus'](0x194);}return _0x109a5f;};}function handleError(_0x2dfa14,_0x438652){_0x438652=_0x438652||0x1f4;return function(_0xeb7f58){logger[_0x0c90('0x29')](_0xeb7f58[_0x0c90('0x2a')]);if(_0xeb7f58[_0x0c90('0x2b')]){delete _0xeb7f58['name'];}_0x2dfa14[_0x0c90('0x1a')](_0x438652)[_0x0c90('0x2c')](_0xeb7f58);};}exports[_0x0c90('0x2d')]=function(_0x13b377,_0x52d28d){var _0x4c8603={},_0x1f27f1={},_0x25da6e={'count':0x0,'rows':[]};var _0x3bff04=_[_0x0c90('0x2e')](db[_0x0c90('0x2f')]['rawAttributes'],function(_0x120136){return{'name':_0x120136[_0x0c90('0x30')],'type':_0x120136[_0x0c90('0x31')]['key']};});_0x1f27f1[_0x0c90('0x32')]=_['map'](_0x3bff04,'name');_0x1f27f1[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x13b377[_0x0c90('0x33')]);_0x1f27f1[_0x0c90('0x35')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],_0x1f27f1['query']);_0x4c8603[_0x0c90('0x36')]=_['intersection'](_0x1f27f1[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x13b377['query'][_0x0c90('0x37')]));_0x4c8603[_0x0c90('0x36')]=_0x4c8603[_0x0c90('0x36')][_0x0c90('0x38')]?_0x4c8603[_0x0c90('0x36')]:_0x1f27f1[_0x0c90('0x32')];if(!_0x13b377[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0x4c8603[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1e')]);_0x4c8603['offset']=qs[_0x0c90('0x1c')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x1c')]);}_0x4c8603[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x13b377[_0x0c90('0x33')][_0x0c90('0x3b')]);_0x4c8603[_0x0c90('0x3c')]=qs['filters'](_[_0x0c90('0x3d')](_0x13b377[_0x0c90('0x33')],_0x1f27f1['filters']),_0x3bff04);if(_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]){_0x4c8603[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x4c8603[_0x0c90('0x3c')],{'$or':_['map'](_0x3bff04,function(_0x2f1d95){if(_0x2f1d95[_0x0c90('0x31')]!==_0x0c90('0x40')){var _0x2bca69={};_0x2bca69[_0x2f1d95[_0x0c90('0x2b')]]={'$like':'%'+_0x13b377[_0x0c90('0x33')][_0x0c90('0x3e')]+'%'};return _0x2bca69;}})});}_0x4c8603=_[_0x0c90('0x3f')]({},_0x4c8603,_0x13b377[_0x0c90('0x41')]);var _0x4f0227={'where':_0x4c8603[_0x0c90('0x3c')]};return db['ZendeskAccount'][_0x0c90('0x1f')](_0x4f0227)['then'](function(_0xb126ef){_0x25da6e[_0x0c90('0x1f')]=_0xb126ef;if(_0x13b377['query']['includeAll']){_0x4c8603[_0x0c90('0x42')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x0c90('0x43')](_0x4c8603);})[_0x0c90('0x26')](function(_0x373f9f){_0x25da6e['rows']=_0x373f9f;return _0x25da6e;})[_0x0c90('0x26')](respondWithFilteredResult(_0x52d28d,_0x4c8603))[_0x0c90('0x44')](handleError(_0x52d28d,null));};exports[_0x0c90('0x45')]=function(_0x3e5137,_0x2139c3){var _0x1184c4={'raw':![],'where':{'id':_0x3e5137[_0x0c90('0x46')]['id']}},_0x565b10={};_0x565b10[_0x0c90('0x32')]=_[_0x0c90('0x34')](db[_0x0c90('0x2f')][_0x0c90('0x47')]);_0x565b10[_0x0c90('0x33')]=_[_0x0c90('0x34')](_0x3e5137['query']);_0x565b10[_0x0c90('0x35')]=_['intersection'](_0x565b10[_0x0c90('0x32')],_0x565b10[_0x0c90('0x33')]);_0x1184c4[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x565b10[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x3e5137[_0x0c90('0x33')][_0x0c90('0x37')]));_0x1184c4[_0x0c90('0x36')]=_0x1184c4[_0x0c90('0x36')][_0x0c90('0x38')]?_0x1184c4[_0x0c90('0x36')]:_0x565b10[_0x0c90('0x32')];if(_0x3e5137[_0x0c90('0x33')][_0x0c90('0x49')]){_0x1184c4['include']=[{'all':!![]}];}_0x1184c4=_[_0x0c90('0x3f')]({},_0x1184c4,_0x3e5137[_0x0c90('0x41')]);return db[_0x0c90('0x2f')][_0x0c90('0x4a')](_0x1184c4)[_0x0c90('0x26')](handleEntityNotFound(_0x2139c3,null))[_0x0c90('0x26')](respondWithResult(_0x2139c3,null))[_0x0c90('0x44')](handleError(_0x2139c3,null));};exports[_0x0c90('0x4b')]=function(_0x3bb138,_0x3af64f){return db[_0x0c90('0x2f')][_0x0c90('0x4b')](_0x3bb138[_0x0c90('0x4c')],{})[_0x0c90('0x26')](respondWithResult(_0x3af64f,0xc9))['catch'](handleError(_0x3af64f,null));};exports[_0x0c90('0x25')]=function(_0x38f492,_0x553fea){if(_0x38f492['body']['id']){delete _0x38f492['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x38f492[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x553fea,null))[_0x0c90('0x26')](saveUpdates(_0x38f492['body'],null))[_0x0c90('0x26')](respondWithResult(_0x553fea,null))[_0x0c90('0x44')](handleError(_0x553fea,null));};exports[_0x0c90('0x27')]=function(_0x549c78,_0x119776){return db[_0x0c90('0x2f')][_0x0c90('0x4a')]({'where':{'id':_0x549c78[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x119776,null))[_0x0c90('0x26')](removeEntity(_0x119776,null))[_0x0c90('0x44')](handleError(_0x119776,null));};exports[_0x0c90('0x4d')]=function(_0x1daeed,_0xeeee3b,_0x5e288e){var _0xac80b2={};var _0x4ba9e7={};var _0xda4331;var _0x67539d;return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x1daeed[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0xeeee3b,null))['then'](function(_0x4930fc){if(_0x4930fc){_0xda4331=_0x4930fc;_0x4ba9e7['model']=_['keys'](db[_0x0c90('0x4f')][_0x0c90('0x47')]);_0x4ba9e7[_0x0c90('0x33')]=_['keys'](_0x1daeed[_0x0c90('0x33')]);_0x4ba9e7[_0x0c90('0x35')]=_['intersection'](_0x4ba9e7[_0x0c90('0x32')],_0x4ba9e7['query']);_0xac80b2[_0x0c90('0x36')]=_[_0x0c90('0x48')](_0x4ba9e7[_0x0c90('0x32')],qs[_0x0c90('0x37')](_0x1daeed['query'][_0x0c90('0x37')]));_0xac80b2['attributes']=_0xac80b2[_0x0c90('0x36')][_0x0c90('0x38')]?_0xac80b2['attributes']:_0x4ba9e7['model'];_0xac80b2['order']=qs[_0x0c90('0x3b')](_0x1daeed[_0x0c90('0x33')][_0x0c90('0x3b')]);_0xac80b2[_0x0c90('0x3c')]=qs[_0x0c90('0x35')](_['pick'](_0x1daeed[_0x0c90('0x33')],_0x4ba9e7[_0x0c90('0x35')]));if(_0x1daeed['query'][_0x0c90('0x3e')]){_0xac80b2['where']=_[_0x0c90('0x3f')](_0xac80b2[_0x0c90('0x3c')],{'$or':_['map'](_0xac80b2[_0x0c90('0x36')],function(_0x5baf85){var _0x4de11a={};_0x4de11a[_0x5baf85]={'$like':'%'+_0x1daeed['query'][_0x0c90('0x3e')]+'%'};return _0x4de11a;})});}_0xac80b2=_[_0x0c90('0x3f')]({},_0xac80b2,_0x1daeed[_0x0c90('0x41')]);return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})['then'](function(_0x5b385b){if(_0x5b385b){_0x67539d=_0x5b385b[_0x0c90('0x38')];if(!_0x1daeed[_0x0c90('0x33')][_0x0c90('0x39')]('nolimit')){_0xac80b2[_0x0c90('0x1e')]=qs[_0x0c90('0x1e')](_0x1daeed[_0x0c90('0x33')]['limit']);_0xac80b2[_0x0c90('0x1c')]=qs[_0x0c90('0x1c')](_0x1daeed[_0x0c90('0x33')]['offset']);}return _0xda4331[_0x0c90('0x4d')](_0xac80b2);}})[_0x0c90('0x26')](function(_0x1a198b){if(_0x1a198b){return _0x1a198b?{'count':_0x67539d,'rows':_0x1a198b}:null;}})[_0x0c90('0x26')](respondWithResult(_0xeeee3b,null))[_0x0c90('0x44')](handleError(_0xeeee3b,null));};exports[_0x0c90('0x50')]=function(_0x19f4ac,_0x143e0d,_0x181fe3){if(_0x19f4ac['body']['id']){delete _0x19f4ac['body']['id'];}return db[_0x0c90('0x2f')][_0x0c90('0x4e')]({'where':{'id':_0x19f4ac[_0x0c90('0x46')]['id']}})[_0x0c90('0x26')](handleEntityNotFound(_0x143e0d,null))[_0x0c90('0x26')](function(_0x2dad30){if(_0x2dad30){_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x51')]=_0x2dad30['id'];_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x52')]=integrations[_0x0c90('0x53')](_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x54')],_0x19f4ac[_0x0c90('0x4c')][_0x0c90('0x31')]);_0x19f4ac['body'][_0x0c90('0x55')]=integrations[_0x0c90('0x56')](_0x19f4ac[_0x0c90('0x4c')]['channel'],_0x19f4ac['body'][_0x0c90('0x31')]);return db['ZendeskConfiguration'][_0x0c90('0x4b')](_0x19f4ac[_0x0c90('0x4c')],{'include':[{'model':db['ZendeskField'],'as':_0x0c90('0x52')},{'model':db[_0x0c90('0x57')],'as':_0x0c90('0x55')}]});}return null;})[_0x0c90('0x26')](respondWithResult(_0x143e0d,null))['catch'](handleError(_0x143e0d,null));};exports['getFields']=function(_0x5f32d6,_0x16b38a,_0x2d3287){var _0x3bc90d='';return db[_0x0c90('0x2f')]['findOne']({'where':{'id':_0x5f32d6[_0x0c90('0x46')]['id']},'attributes':['id','username',_0x0c90('0x58'),_0x0c90('0x59'),_0x0c90('0x5a'),'remoteUri']})[_0x0c90('0x26')](handleEntityNotFound(_0x16b38a,null))[_0x0c90('0x26')](function(_0x2da9f9){if(_0x2da9f9){_0x3bc90d=_0x2da9f9[_0x0c90('0x5b')];var _0x57c3b3=_0x3bc90d['slice'](-0x1);if(_0x57c3b3==='/'){_0x3bc90d=_0x3bc90d[_0x0c90('0x5c')](0x0,_0x3bc90d['lastIndexOf'](_0x57c3b3));}var _0x3254c0={'method':_0x0c90('0x5d'),'uri':util[_0x0c90('0x5e')](_0x0c90('0x5f'),_0x3bc90d,_0x0c90('0x60')),'json':!![]};switch(_0x2da9f9[_0x0c90('0x5a')]){case _0x0c90('0x58'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util['format'](_0x0c90('0x63'),_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x58')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;case _0x0c90('0x59'):_0x3254c0[_0x0c90('0x61')]={'Authorization':util[_0x0c90('0x5e')](_0x0c90('0x62'),new Buffer(util[_0x0c90('0x5e')]('%s/token:%s',_0x2da9f9[_0x0c90('0x64')],_0x2da9f9[_0x0c90('0x59')]))[_0x0c90('0x65')](_0x0c90('0x66')))};break;default:throw new db['Sequelize'][(_0x0c90('0x67'))](_0x0c90('0x68'));}return rp(_0x3254c0);}})[_0x0c90('0x26')](function(_0x48a32f){if(_0x48a32f){var _0x40866c=[_0x0c90('0x69'),'description',_0x0c90('0x6a'),'assignee'];_[_0x0c90('0x6b')](_0x48a32f['ticket_fields'],function(_0x5633a4){return _0x40866c[_0x0c90('0x6c')](_0x5633a4[_0x0c90('0x31')]);});return{'count':_0x48a32f['ticket_fields']['length'],'rows':_[_0x0c90('0x2e')](_0x48a32f[_0x0c90('0x60')],function(_0x5d80b9){return{'id':_0x5d80b9['id'],'name':_0x5d80b9['position']>0x7?_0x5d80b9[_0x0c90('0x6d')]:_0x5d80b9['type'],'custom':_0x5d80b9[_0x0c90('0x6e')]>0x7?!![]:![],'options':_0x5d80b9[_0x0c90('0x6f')]?_0x5d80b9[_0x0c90('0x6f')]:_0x5d80b9[_0x0c90('0x70')]?_0x5d80b9[_0x0c90('0x70')]:[]};})};}})['then'](respondWithResult(_0x16b38a,null))[_0x0c90('0x44')](function(_0x142268){var _0x3aed3c=_0x5f32d6['query']['test']?0x1f4:_0x142268[_0x0c90('0x71')]||0x1f4;logger[_0x0c90('0x29')](_0x0c90('0x72'),'getFields',_0x3aed3c,JSON['stringify'](_0x142268));delete _0x142268['name'];if(_0x3aed3c===0x191){_0x3aed3c=0x190;}_0x16b38a[_0x0c90('0x1a')](_0x3aed3c)['send'](_0x5f32d6['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x142268[_0x0c90('0x71')]}:_0x142268);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index a6a2a78..44cdede 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 _0xd8d6=['./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xd8d6,0x13c));var _0x6d8d=function(_0x2d69bb,_0x209bc5){_0x2d69bb=_0x2d69bb-0x0;var _0x5a280d=_0xd8d6[_0x2d69bb];return _0x5a280d;};'use strict';var _=require('lodash');var util=require(_0x6d8d('0x0'));var logger=require(_0x6d8d('0x1'))('api');var moment=require(_0x6d8d('0x2'));var BPromise=require(_0x6d8d('0x3'));var rp=require(_0x6d8d('0x4'));var fs=require('fs');var path=require(_0x6d8d('0x5'));var rimraf=require(_0x6d8d('0x6'));var config=require(_0x6d8d('0x7'));var attributes=require(_0x6d8d('0x8'));var integrations=require(_0x6d8d('0x9'));module['exports']=function(_0x1f5020,_0x17c6db){return _0x1f5020[_0x6d8d('0xa')](_0x6d8d('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ef=['ZendeskAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes','exports','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd0ef,0x1ef));var _0xfd0e=function(_0x3e4bf5,_0x132f6f){_0x3e4bf5=_0x3e4bf5-0x0;var _0x450f9d=_0xd0ef[_0x3e4bf5];return _0x450f9d;};'use strict';var _=require(_0xfd0e('0x0'));var util=require(_0xfd0e('0x1'));var logger=require(_0xfd0e('0x2'))(_0xfd0e('0x3'));var moment=require(_0xfd0e('0x4'));var BPromise=require(_0xfd0e('0x5'));var rp=require(_0xfd0e('0x6'));var fs=require('fs');var path=require(_0xfd0e('0x7'));var rimraf=require(_0xfd0e('0x8'));var config=require('../../config/environment');var attributes=require(_0xfd0e('0x9'));var integrations=require('../../components/integrations/configuration');module[_0xfd0e('0xa')]=function(_0x277ab1,_0x29f0cc){return _0x277ab1[_0xfd0e('0xb')](_0xfd0e('0xc'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 4547c41..3bcfa01 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 _0x9e84=['limit','include','map','model','info','debug','stringify','catch','ShowZendeskAccount','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetZendeskAccount','ZendeskAccount','options','raw','where','attributes'];(function(_0x263545,_0xc8dfcd){var _0x50b199=function(_0x5c9e99){while(--_0x5c9e99){_0x263545['push'](_0x263545['shift']());}};_0x50b199(++_0xc8dfcd);}(_0x9e84,0x196));var _0x49e8=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x9e84[_0x544099];return _0x20ab09;};'use strict';var _=require(_0x49e8('0x0'));var util=require(_0x49e8('0x1'));var moment=require(_0x49e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49e8('0x3'));var db=require(_0x49e8('0x4'))['db'];var utils=require(_0x49e8('0x5'));var logger=require(_0x49e8('0x6'))(_0x49e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x49e8('0x8'));var client=jayson[_0x49e8('0x9')][_0x49e8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d2b9,_0x145220,_0x2cd19e){return new BPromise(function(_0x138404,_0x48ccfe){return client[_0x49e8('0xb')](_0x53d2b9,_0x2cd19e)[_0x49e8('0xc')](function(_0x3883b1){logger['info'](_0x49e8('0xd'),_0x145220,'request\x20sent');logger['debug'](_0x49e8('0xe'),_0x145220,_0x49e8('0xf'),JSON['stringify'](_0x3883b1));if(_0x3883b1['error']){if(_0x3883b1[_0x49e8('0x10')][_0x49e8('0x11')]===0x1f4){logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x3883b1[_0x49e8('0x10')][_0x49e8('0x12')]);return _0x48ccfe(_0x3883b1['error'][_0x49e8('0x12')]);}logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x3883b1[_0x49e8('0x10')]['message']);return _0x138404(_0x3883b1[_0x49e8('0x10')][_0x49e8('0x12')]);}else{logger['info'](_0x49e8('0xd'),_0x145220,_0x49e8('0xf'));_0x138404(_0x3883b1[_0x49e8('0x13')][_0x49e8('0x12')]);}})['catch'](function(_0x4741bb){logger[_0x49e8('0x10')](_0x49e8('0xd'),_0x145220,_0x4741bb);_0x48ccfe(_0x4741bb);});});}exports[_0x49e8('0x14')]=function(_0x100e2a){var _0x442371=this;return new Promise(function(_0x3ebfb6,_0x3ddfe7){return db[_0x49e8('0x15')]['findAll']({'raw':_0x100e2a['options']?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x17')]===undefined?!![]:![]:!![],'where':_0x100e2a[_0x49e8('0x16')]?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x18')]||null:null,'attributes':_0x100e2a['options']?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x19')]||null:null,'limit':_0x100e2a[_0x49e8('0x16')]?_0x100e2a[_0x49e8('0x16')][_0x49e8('0x1a')]||null:null,'include':_0x100e2a['options']?_0x100e2a['options'][_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x100e2a[_0x49e8('0x16')]['include'],function(_0x5ddd01){return{'model':db[_0x5ddd01[_0x49e8('0x1d')]],'as':_0x5ddd01['as'],'attributes':_0x5ddd01[_0x49e8('0x19')],'include':_0x5ddd01['include']?_[_0x49e8('0x1c')](_0x5ddd01[_0x49e8('0x1b')],function(_0x21149f){return{'model':db[_0x21149f['model']],'as':_0x21149f['as'],'attributes':_0x21149f[_0x49e8('0x19')],'include':_0x21149f[_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x21149f[_0x49e8('0x1b')],function(_0x1f16a1){return{'model':db[_0x1f16a1['model']],'as':_0x1f16a1['as'],'attributes':_0x1f16a1[_0x49e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x49e8('0xc')](function(_0x35a5c4){logger[_0x49e8('0x1e')]('GetZendeskAccount',_0x100e2a);logger[_0x49e8('0x1f')](_0x49e8('0x14'),_0x100e2a,JSON[_0x49e8('0x20')](_0x35a5c4));_0x3ebfb6(_0x35a5c4);})[_0x49e8('0x21')](function(_0x20e2fd){logger['error']('GetZendeskAccount',_0x20e2fd[_0x49e8('0x12')],_0x100e2a);_0x3ddfe7(_0x442371[_0x49e8('0x10')](0x1f4,_0x20e2fd[_0x49e8('0x12')]));});});};exports[_0x49e8('0x22')]=function(_0x85efec){var _0x56f672=this;return new Promise(function(_0x44e32f,_0x202287){return db[_0x49e8('0x15')][_0x49e8('0x23')]({'raw':_0x85efec[_0x49e8('0x16')]?_0x85efec['options']['raw']===undefined?!![]:![]:!![],'where':_0x85efec[_0x49e8('0x16')]?_0x85efec['options'][_0x49e8('0x18')]||null:null,'attributes':_0x85efec[_0x49e8('0x16')]?_0x85efec[_0x49e8('0x16')][_0x49e8('0x19')]||null:null,'include':_0x85efec[_0x49e8('0x16')]?_0x85efec[_0x49e8('0x16')][_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x85efec['options']['include'],function(_0x3e0d49){return{'model':db[_0x3e0d49[_0x49e8('0x1d')]],'as':_0x3e0d49['as'],'attributes':_0x3e0d49[_0x49e8('0x19')],'include':_0x3e0d49['include']?_[_0x49e8('0x1c')](_0x3e0d49[_0x49e8('0x1b')],function(_0x1c6e0f){return{'model':db[_0x1c6e0f['model']],'as':_0x1c6e0f['as'],'attributes':_0x1c6e0f[_0x49e8('0x19')],'include':_0x1c6e0f[_0x49e8('0x1b')]?_[_0x49e8('0x1c')](_0x1c6e0f[_0x49e8('0x1b')],function(_0x3cebbe){return{'model':db[_0x3cebbe['model']],'as':_0x3cebbe['as'],'attributes':_0x3cebbe[_0x49e8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x49e8('0xc')](function(_0x4af4cc){logger[_0x49e8('0x1e')](_0x49e8('0x22'),_0x85efec);logger[_0x49e8('0x1f')](_0x49e8('0x22'),_0x85efec,JSON[_0x49e8('0x20')](_0x4af4cc));_0x44e32f(_0x4af4cc);})[_0x49e8('0x21')](function(_0x450f30){logger[_0x49e8('0x10')](_0x49e8('0x22'),_0x450f30[_0x49e8('0x12')],_0x85efec);_0x202287(_0x56f672[_0x49e8('0x10')](0x1f4,_0x450f30['message']));});});}; \ No newline at end of file +var _0x0b21=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','GetZendeskAccount','ShowZendeskAccount','find','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2cf999,_0x5d5579){var _0x45cb18=function(_0x11536f){while(--_0x11536f){_0x2cf999['push'](_0x2cf999['shift']());}};_0x45cb18(++_0x5d5579);}(_0x0b21,0x132));var _0x10b2=function(_0x3c6c4c,_0x2b1809){_0x3c6c4c=_0x3c6c4c-0x0;var _0x37551d=_0x0b21[_0x3c6c4c];return _0x37551d;};'use strict';var _=require(_0x10b2('0x0'));var util=require('util');var moment=require(_0x10b2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10b2('0x2'));var db=require(_0x10b2('0x3'))['db'];var utils=require(_0x10b2('0x4'));var logger=require(_0x10b2('0x5'))(_0x10b2('0x6'));var config=require(_0x10b2('0x7'));var jayson=require(_0x10b2('0x8'));var client=jayson[_0x10b2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ee473,_0x3ee0a0,_0x4bfd8f){return new BPromise(function(_0x15fc61,_0x4229ac){return client[_0x10b2('0xa')](_0x2ee473,_0x4bfd8f)[_0x10b2('0xb')](function(_0x3d1e73){logger[_0x10b2('0xc')](_0x10b2('0xd'),_0x3ee0a0,_0x10b2('0xe'));logger[_0x10b2('0xf')](_0x10b2('0x10'),_0x3ee0a0,_0x10b2('0xe'),JSON[_0x10b2('0x11')](_0x3d1e73));if(_0x3d1e73['error']){if(_0x3d1e73['error'][_0x10b2('0x12')]===0x1f4){logger['error'](_0x10b2('0xd'),_0x3ee0a0,_0x3d1e73[_0x10b2('0x13')]['message']);return _0x4229ac(_0x3d1e73['error'][_0x10b2('0x14')]);}logger[_0x10b2('0x13')](_0x10b2('0xd'),_0x3ee0a0,_0x3d1e73['error']['message']);return _0x15fc61(_0x3d1e73[_0x10b2('0x13')][_0x10b2('0x14')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3ee0a0,_0x10b2('0xe'));_0x15fc61(_0x3d1e73[_0x10b2('0x15')][_0x10b2('0x14')]);}})[_0x10b2('0x16')](function(_0x5f0084){logger[_0x10b2('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x3ee0a0,_0x5f0084);_0x4229ac(_0x5f0084);});});}exports['GetZendeskAccount']=function(_0x5efb31){var _0x51c650=this;return new Promise(function(_0x25ac99,_0x243e27){return db[_0x10b2('0x17')][_0x10b2('0x18')]({'raw':_0x5efb31[_0x10b2('0x19')]?_0x5efb31[_0x10b2('0x19')][_0x10b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x5efb31['options']?_0x5efb31[_0x10b2('0x19')][_0x10b2('0x1b')]||null:null,'attributes':_0x5efb31[_0x10b2('0x19')]?_0x5efb31[_0x10b2('0x19')][_0x10b2('0x1c')]||null:null,'limit':_0x5efb31['options']?_0x5efb31['options'][_0x10b2('0x1d')]||null:null,'include':_0x5efb31['options']?_0x5efb31[_0x10b2('0x19')][_0x10b2('0x1e')]?_['map'](_0x5efb31[_0x10b2('0x19')][_0x10b2('0x1e')],function(_0x1bf814){return{'model':db[_0x1bf814['model']],'as':_0x1bf814['as'],'attributes':_0x1bf814['attributes'],'include':_0x1bf814[_0x10b2('0x1e')]?_['map'](_0x1bf814[_0x10b2('0x1e')],function(_0x5d070c){return{'model':db[_0x5d070c[_0x10b2('0x1f')]],'as':_0x5d070c['as'],'attributes':_0x5d070c['attributes'],'include':_0x5d070c[_0x10b2('0x1e')]?_[_0x10b2('0x20')](_0x5d070c['include'],function(_0xeea82){return{'model':db[_0xeea82[_0x10b2('0x1f')]],'as':_0xeea82['as'],'attributes':_0xeea82['attributes']};}):[]};}):[]};}):[]:[]})[_0x10b2('0xb')](function(_0x5f4168){logger[_0x10b2('0xc')]('GetZendeskAccount',_0x5efb31);logger[_0x10b2('0xf')]('GetZendeskAccount',_0x5efb31,JSON[_0x10b2('0x11')](_0x5f4168));_0x25ac99(_0x5f4168);})[_0x10b2('0x16')](function(_0x5d9cc0){logger[_0x10b2('0x13')](_0x10b2('0x21'),_0x5d9cc0[_0x10b2('0x14')],_0x5efb31);_0x243e27(_0x51c650['error'](0x1f4,_0x5d9cc0[_0x10b2('0x14')]));});});};exports[_0x10b2('0x22')]=function(_0x448651){var _0x20e43f=this;return new Promise(function(_0x911178,_0x5c17c8){return db[_0x10b2('0x17')][_0x10b2('0x23')]({'raw':_0x448651[_0x10b2('0x19')]?_0x448651['options']['raw']===undefined?!![]:![]:!![],'where':_0x448651[_0x10b2('0x19')]?_0x448651[_0x10b2('0x19')]['where']||null:null,'attributes':_0x448651[_0x10b2('0x19')]?_0x448651[_0x10b2('0x19')][_0x10b2('0x1c')]||null:null,'include':_0x448651[_0x10b2('0x19')]?_0x448651[_0x10b2('0x19')][_0x10b2('0x1e')]?_[_0x10b2('0x20')](_0x448651[_0x10b2('0x19')]['include'],function(_0x4c0f89){return{'model':db[_0x4c0f89[_0x10b2('0x1f')]],'as':_0x4c0f89['as'],'attributes':_0x4c0f89['attributes'],'include':_0x4c0f89[_0x10b2('0x1e')]?_[_0x10b2('0x20')](_0x4c0f89[_0x10b2('0x1e')],function(_0x1814d2){return{'model':db[_0x1814d2['model']],'as':_0x1814d2['as'],'attributes':_0x1814d2[_0x10b2('0x1c')],'include':_0x1814d2[_0x10b2('0x1e')]?_[_0x10b2('0x20')](_0x1814d2[_0x10b2('0x1e')],function(_0x590093){return{'model':db[_0x590093[_0x10b2('0x1f')]],'as':_0x590093['as'],'attributes':_0x590093[_0x10b2('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb9899a){logger[_0x10b2('0xc')](_0x10b2('0x22'),_0x448651);logger['debug'](_0x10b2('0x22'),_0x448651,JSON[_0x10b2('0x11')](_0xb9899a));_0x911178(_0xb9899a);})['catch'](function(_0x5b083a){logger[_0x10b2('0x13')](_0x10b2('0x22'),_0x5b083a[_0x10b2('0x14')],_0x448651);_0x5c17c8(_0x20e43f[_0x10b2('0x13')](0x1f4,_0x5b083a['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ac4b6b2..7c151be 100644 --- a/server/api/intZendeskConfiguration/index.js +++ b/server/api/intZendeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','update','delete','destroy','exports','path','express'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x36ee,0xe8));var _0xe36e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36ee[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x8')](_0xe36e('0x13'),auth[_0xe36e('0x9')](),controller['getTags']);router[_0xe36e('0x14')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x14')]('/:id/tags',auth[_0xe36e('0x9')](),controller['setTags']);router['put'](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x16')]);router[_0xe36e('0x17')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);module[_0xe36e('0x19')]=router; \ No newline at end of file +var _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x5c2fa4,_0x1de3b){var _0x42fb42=function(_0x5c0a1e){while(--_0x5c0a1e){_0x5c2fa4['push'](_0x5c2fa4['shift']());}};_0x42fb42(++_0x1de3b);}(_0x0bb5,0x148));var _0x50bb=function(_0x3d5eed,_0x22f67d){_0x3d5eed=_0x3d5eed-0x0;var _0x4aa525=_0x0bb5[_0x3d5eed];return _0x4aa525;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index deed440..d4d76dc 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 _0x8883=['exports','STRING','sequelize'];(function(_0x4f9388,_0x1cb416){var _0x24873e=function(_0x400422){while(--_0x400422){_0x4f9388['push'](_0x4f9388['shift']());}};_0x24873e(++_0x1cb416);}(_0x8883,0xf8));var _0x3888=function(_0x40eea2,_0x158886){_0x40eea2=_0x40eea2-0x0;var _0x296825=_0x8883[_0x40eea2];return _0x296825;};'use strict';var Sequelize=require(_0x3888('0x0'));module[_0x3888('0x1')]={'name':{'type':Sequelize[_0x3888('0x2')]},'description':{'type':Sequelize[_0x3888('0x2')]}}; \ No newline at end of file +var _0xbe29=['STRING','sequelize','exports'];(function(_0x499b35,_0x20a929){var _0x779003=function(_0x5a32c2){while(--_0x5a32c2){_0x499b35['push'](_0x499b35['shift']());}};_0x779003(++_0x20a929);}(_0xbe29,0xf4));var _0x9be2=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xbe29[_0x3acee8];return _0x5046cc;};'use strict';var Sequelize=require(_0x9be2('0x0'));module[_0x9be2('0x1')]={'name':{'type':Sequelize[_0x9be2('0x2')]},'description':{'type':Sequelize[_0x9be2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f067905..4c8c70e 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 _0x3d0a=['filters','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','sort','filter','where','options','rows','catch','params','fields','includeAll','include','merge','find','create','body','destroy','getFields','findOne','pick','ZendeskField','order','getSubjects','getDescriptions','getTags','Tag','ids','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','key','query','keys'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x3d0a,0x1a2));var _0xa3d0=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x3d0a[_0x58afd5];return _0x3e503b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3d0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa3d0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xa3d0('0x2'));var util=require(_0xa3d0('0x3'));var path=require(_0xa3d0('0x4'));var sox=require(_0xa3d0('0x5'));var csv=require(_0xa3d0('0x6'));var ejs=require(_0xa3d0('0x7'));var fs=require('fs');var fs_extra=require(_0xa3d0('0x8'));var _=require(_0xa3d0('0x9'));var squel=require(_0xa3d0('0xa'));var crypto=require(_0xa3d0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa3d0('0xc'));var toCsv=require(_0xa3d0('0x6'));var querystring=require(_0xa3d0('0xd'));var Papa=require(_0xa3d0('0xe'));var Redis=require(_0xa3d0('0xf'));var authService=require(_0xa3d0('0x10'));var qs=require(_0xa3d0('0x11'));var as=require(_0xa3d0('0x12'));var hardwareService=require(_0xa3d0('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa3d0('0x14'));var config=require(_0xa3d0('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3d0('0x16'))['db'];function respondWithStatusCode(_0x245cb3,_0x39e63e){_0x39e63e=_0x39e63e||0xcc;return function(_0x1a01b){if(_0x1a01b){return _0x245cb3['sendStatus'](_0x39e63e);}return _0x245cb3[_0xa3d0('0x17')](_0x39e63e)[_0xa3d0('0x18')]();};}function respondWithResult(_0x124faf,_0x551105){_0x551105=_0x551105||0xc8;return function(_0x4edb89){if(_0x4edb89){return _0x124faf[_0xa3d0('0x17')](_0x551105)[_0xa3d0('0x19')](_0x4edb89);}};}function respondWithFilteredResult(_0x391f61,_0x2572b4){return function(_0x3a738f){if(_0x3a738f){var _0x19043d=typeof _0x2572b4[_0xa3d0('0x1a')]===_0xa3d0('0x1b')&&typeof _0x2572b4['limit']===_0xa3d0('0x1b');var _0x3a083d=_0x3a738f[_0xa3d0('0x1c')];var _0x2b65ba=_0x19043d?0x0:_0x2572b4[_0xa3d0('0x1a')];var _0x4a2b25=_0x19043d?_0x3a738f[_0xa3d0('0x1c')]:_0x2572b4['offset']+_0x2572b4['limit'];var _0x1952dd;if(_0x4a2b25>=_0x3a083d){_0x4a2b25=_0x3a083d;_0x1952dd=0xc8;}else{_0x1952dd=0xce;}_0x391f61[_0xa3d0('0x17')](_0x1952dd);return _0x391f61[_0xa3d0('0x1d')](_0xa3d0('0x1e'),_0x2b65ba+'-'+_0x4a2b25+'/'+_0x3a083d)[_0xa3d0('0x19')](_0x3a738f);}return null;};}function patchUpdates(_0x163bd6){return function(_0x5a6c3a){try{jsonpatch['apply'](_0x5a6c3a,_0x163bd6,!![]);}catch(_0x2ef599){return BPromise['reject'](_0x2ef599);}return _0x5a6c3a['save']();};}function saveUpdates(_0x567faa,_0x3b37f1){return function(_0x1cbb80){if(_0x1cbb80){return _0x1cbb80[_0xa3d0('0x1f')](_0x567faa)[_0xa3d0('0x20')](function(_0x113c08){return _0x113c08;});}return null;};}function removeEntity(_0x1f6d6a,_0x1cca26){return function(_0x34b404){if(_0x34b404){return _0x34b404['destroy']()[_0xa3d0('0x20')](function(){_0x1f6d6a[_0xa3d0('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45bd0b,_0x4109a3){return function(_0x3302d0){if(!_0x3302d0){_0x45bd0b['sendStatus'](0x194);}return _0x3302d0;};}function handleError(_0x81fb2a,_0x2e6ca3){_0x2e6ca3=_0x2e6ca3||0x1f4;return function(_0x5e258b){logger[_0xa3d0('0x21')](_0x5e258b[_0xa3d0('0x22')]);if(_0x5e258b['name']){delete _0x5e258b[_0xa3d0('0x23')];}_0x81fb2a[_0xa3d0('0x17')](_0x2e6ca3)['send'](_0x5e258b);};}exports[_0xa3d0('0x24')]=function(_0x2156d0,_0x59b7b6){var _0x52b393={},_0x462e6b={},_0x1b6821={'count':0x0,'rows':[]};var _0x5b8525=_[_0xa3d0('0x25')](db[_0xa3d0('0x26')][_0xa3d0('0x27')],function(_0xf8a85c){return{'name':_0xf8a85c[_0xa3d0('0x28')],'type':_0xf8a85c['type'][_0xa3d0('0x29')]};});_0x462e6b['model']=_[_0xa3d0('0x25')](_0x5b8525,_0xa3d0('0x23'));_0x462e6b[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x2156d0[_0xa3d0('0x2a')]);_0x462e6b[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x462e6b[_0xa3d0('0x2e')],_0x462e6b[_0xa3d0('0x2a')]);_0x52b393[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x462e6b[_0xa3d0('0x2e')],qs['fields'](_0x2156d0[_0xa3d0('0x2a')]['fields']));_0x52b393[_0xa3d0('0x2f')]=_0x52b393['attributes'][_0xa3d0('0x30')]?_0x52b393[_0xa3d0('0x2f')]:_0x462e6b[_0xa3d0('0x2e')];if(!_0x2156d0[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x52b393[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x2156d0['query']['limit']);_0x52b393[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x2156d0['query']['offset']);}_0x52b393['order']=qs[_0xa3d0('0x34')](_0x2156d0[_0xa3d0('0x2a')]['sort']);_0x52b393['where']=qs[_0xa3d0('0x2c')](_['pick'](_0x2156d0[_0xa3d0('0x2a')],_0x462e6b[_0xa3d0('0x2c')]),_0x5b8525);if(_0x2156d0[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x52b393[_0xa3d0('0x36')]=_['merge'](_0x52b393[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x5b8525,function(_0x1c9f53){if(_0x1c9f53['type']!=='VIRTUAL'){var _0x17dbe5={};_0x17dbe5[_0x1c9f53[_0xa3d0('0x23')]]={'$like':'%'+_0x2156d0[_0xa3d0('0x2a')]['filter']+'%'};return _0x17dbe5;}})});}_0x52b393=_['merge']({},_0x52b393,_0x2156d0[_0xa3d0('0x37')]);var _0x5768a6={'where':_0x52b393['where']};return db[_0xa3d0('0x26')][_0xa3d0('0x1c')](_0x5768a6)[_0xa3d0('0x20')](function(_0x4cfcc3){_0x1b6821[_0xa3d0('0x1c')]=_0x4cfcc3;if(_0x2156d0[_0xa3d0('0x2a')]['includeAll']){_0x52b393['include']=[{'all':!![]}];}return db[_0xa3d0('0x26')]['findAll'](_0x52b393);})[_0xa3d0('0x20')](function(_0x436c23){_0x1b6821[_0xa3d0('0x38')]=_0x436c23;return _0x1b6821;})[_0xa3d0('0x20')](respondWithFilteredResult(_0x59b7b6,_0x52b393))[_0xa3d0('0x39')](handleError(_0x59b7b6,null));};exports['show']=function(_0x1a7b14,_0x376499){var _0xbdc979={'raw':![],'where':{'id':_0x1a7b14[_0xa3d0('0x3a')]['id']}},_0x13d7cc={};_0x13d7cc['model']=_[_0xa3d0('0x2b')](db[_0xa3d0('0x26')][_0xa3d0('0x27')]);_0x13d7cc['query']=_['keys'](_0x1a7b14[_0xa3d0('0x2a')]);_0x13d7cc[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x13d7cc[_0xa3d0('0x2e')],_0x13d7cc[_0xa3d0('0x2a')]);_0xbdc979[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x13d7cc[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x1a7b14['query'][_0xa3d0('0x3b')]));_0xbdc979[_0xa3d0('0x2f')]=_0xbdc979[_0xa3d0('0x2f')]['length']?_0xbdc979[_0xa3d0('0x2f')]:_0x13d7cc[_0xa3d0('0x2e')];if(_0x1a7b14[_0xa3d0('0x2a')][_0xa3d0('0x3c')]){_0xbdc979[_0xa3d0('0x3d')]=[{'all':!![]}];}_0xbdc979=_[_0xa3d0('0x3e')]({},_0xbdc979,_0x1a7b14[_0xa3d0('0x37')]);return db[_0xa3d0('0x26')][_0xa3d0('0x3f')](_0xbdc979)['then'](handleEntityNotFound(_0x376499,null))['then'](respondWithResult(_0x376499,null))[_0xa3d0('0x39')](handleError(_0x376499,null));};exports[_0xa3d0('0x40')]=function(_0x56dcc8,_0x4319fd){return db[_0xa3d0('0x26')]['create'](_0x56dcc8['body'],{})[_0xa3d0('0x20')](respondWithResult(_0x4319fd,0xc9))[_0xa3d0('0x39')](handleError(_0x4319fd,null));};exports[_0xa3d0('0x1f')]=function(_0xb23314,_0x5a7d42){if(_0xb23314[_0xa3d0('0x41')]['id']){delete _0xb23314[_0xa3d0('0x41')]['id'];}return db[_0xa3d0('0x26')][_0xa3d0('0x3f')]({'where':{'id':_0xb23314[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x5a7d42,null))['then'](saveUpdates(_0xb23314[_0xa3d0('0x41')],null))[_0xa3d0('0x20')](respondWithResult(_0x5a7d42,null))[_0xa3d0('0x39')](handleError(_0x5a7d42,null));};exports[_0xa3d0('0x42')]=function(_0xf526bd,_0x5a1121){return db[_0xa3d0('0x26')][_0xa3d0('0x3f')]({'where':{'id':_0xf526bd[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x5a1121,null))[_0xa3d0('0x20')](removeEntity(_0x5a1121,null))[_0xa3d0('0x39')](handleError(_0x5a1121,null));};exports[_0xa3d0('0x43')]=function(_0x4f3080,_0xff547b,_0x43316e){var _0x2a7b4f={};var _0x39f260={};var _0x3f37de;var _0x4551d3;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x4f3080[_0xa3d0('0x3a')]['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0xff547b,null))['then'](function(_0x765a0f){if(_0x765a0f){_0x3f37de=_0x765a0f;_0x39f260['model']=_[_0xa3d0('0x2b')](db['ZendeskField']['rawAttributes']);_0x39f260[_0xa3d0('0x2a')]=_['keys'](_0x4f3080[_0xa3d0('0x2a')]);_0x39f260[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x39f260[_0xa3d0('0x2e')],_0x39f260[_0xa3d0('0x2a')]);_0x2a7b4f[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x39f260[_0xa3d0('0x2e')],qs['fields'](_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x3b')]));_0x2a7b4f[_0xa3d0('0x2f')]=_0x2a7b4f[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x2a7b4f[_0xa3d0('0x2f')]:_0x39f260['model'];_0x2a7b4f['order']=qs[_0xa3d0('0x34')](_0x4f3080[_0xa3d0('0x2a')]['sort']);_0x2a7b4f[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x4f3080[_0xa3d0('0x2a')],_0x39f260['filters']));if(_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x2a7b4f[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x2a7b4f[_0xa3d0('0x36')],{'$or':_['map'](_0x2a7b4f[_0xa3d0('0x2f')],function(_0x4269d2){var _0x1b6162={};_0x1b6162[_0x4269d2]={'$like':'%'+_0x4f3080['query'][_0xa3d0('0x35')]+'%'};return _0x1b6162;})});}_0x2a7b4f=_['merge']({},_0x2a7b4f,_0x4f3080[_0xa3d0('0x37')]);return _0x3f37de[_0xa3d0('0x43')](_0x2a7b4f);}})[_0xa3d0('0x20')](function(_0x5addee){if(_0x5addee){_0x4551d3=_0x5addee['length'];if(!_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x2a7b4f[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x4f3080[_0xa3d0('0x2a')]['limit']);_0x2a7b4f[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x4f3080[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x3f37de[_0xa3d0('0x43')](_0x2a7b4f);}})[_0xa3d0('0x20')](function(_0x409f13){if(_0x409f13){return _0x409f13?{'count':_0x4551d3,'rows':_0x409f13}:null;}})[_0xa3d0('0x20')](respondWithResult(_0xff547b,null))[_0xa3d0('0x39')](handleError(_0xff547b,null));};exports['getSubjects']=function(_0x48cf29,_0x2a3c98,_0x162326){var _0x2b74c4={};var _0x1c72b1={};var _0x178648;var _0x12735e;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x48cf29[_0xa3d0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x2a3c98,null))[_0xa3d0('0x20')](function(_0x12b4f3){if(_0x12b4f3){_0x178648=_0x12b4f3;_0x1c72b1[_0xa3d0('0x2e')]=_[_0xa3d0('0x2b')](db[_0xa3d0('0x46')][_0xa3d0('0x27')]);_0x1c72b1[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x48cf29[_0xa3d0('0x2a')]);_0x1c72b1[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x1c72b1[_0xa3d0('0x2e')],_0x1c72b1[_0xa3d0('0x2a')]);_0x2b74c4[_0xa3d0('0x2f')]=_['intersection'](_0x1c72b1[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x48cf29[_0xa3d0('0x2a')]['fields']));_0x2b74c4[_0xa3d0('0x2f')]=_0x2b74c4[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x2b74c4[_0xa3d0('0x2f')]:_0x1c72b1[_0xa3d0('0x2e')];_0x2b74c4[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x2b74c4[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x48cf29[_0xa3d0('0x2a')],_0x1c72b1[_0xa3d0('0x2c')]));if(_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x2b74c4['where']=_['merge'](_0x2b74c4[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x2b74c4['attributes'],function(_0xdffecd){var _0xa57da7={};_0xa57da7[_0xdffecd]={'$like':'%'+_0x48cf29[_0xa3d0('0x2a')]['filter']+'%'};return _0xa57da7;})});}_0x2b74c4=_['merge']({},_0x2b74c4,_0x48cf29[_0xa3d0('0x37')]);return _0x178648['getSubjects'](_0x2b74c4);}})[_0xa3d0('0x20')](function(_0x11c1ca){if(_0x11c1ca){_0x12735e=_0x11c1ca['length'];if(!_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x31')](_0xa3d0('0x32'))){_0x2b74c4['limit']=qs['limit'](_0x48cf29['query']['limit']);_0x2b74c4[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x48cf29[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x178648[_0xa3d0('0x48')](_0x2b74c4);}})[_0xa3d0('0x20')](function(_0x4893e2){if(_0x4893e2){return _0x4893e2?{'count':_0x12735e,'rows':_0x4893e2}:null;}})['then'](respondWithResult(_0x2a3c98,null))[_0xa3d0('0x39')](handleError(_0x2a3c98,null));};exports[_0xa3d0('0x49')]=function(_0x8d98ea,_0x39b09b,_0x38bd29){var _0x57c705={};var _0x34277f={};var _0x3de934;var _0x3ced11;return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x8d98ea['params']['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x39b09b,null))[_0xa3d0('0x20')](function(_0x26f6c5){if(_0x26f6c5){_0x3de934=_0x26f6c5;_0x34277f[_0xa3d0('0x2e')]=_['keys'](db[_0xa3d0('0x46')]['rawAttributes']);_0x34277f[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x8d98ea[_0xa3d0('0x2a')]);_0x34277f[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x34277f[_0xa3d0('0x2e')],_0x34277f[_0xa3d0('0x2a')]);_0x57c705['attributes']=_[_0xa3d0('0x2d')](_0x34277f[_0xa3d0('0x2e')],qs['fields'](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x3b')]));_0x57c705[_0xa3d0('0x2f')]=_0x57c705[_0xa3d0('0x2f')][_0xa3d0('0x30')]?_0x57c705[_0xa3d0('0x2f')]:_0x34277f[_0xa3d0('0x2e')];_0x57c705[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x57c705['where']=qs[_0xa3d0('0x2c')](_['pick'](_0x8d98ea['query'],_0x34277f[_0xa3d0('0x2c')]));if(_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x57c705[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x57c705[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x57c705[_0xa3d0('0x2f')],function(_0x2c62bb){var _0x23e5d9={};_0x23e5d9[_0x2c62bb]={'$like':'%'+_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x35')]+'%'};return _0x23e5d9;})});}_0x57c705=_[_0xa3d0('0x3e')]({},_0x57c705,_0x8d98ea['options']);return _0x3de934[_0xa3d0('0x49')](_0x57c705);}})['then'](function(_0x4e4478){if(_0x4e4478){_0x3ced11=_0x4e4478[_0xa3d0('0x30')];if(!_0x8d98ea[_0xa3d0('0x2a')]['hasOwnProperty']('nolimit')){_0x57c705[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x33')]);_0x57c705[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x8d98ea[_0xa3d0('0x2a')][_0xa3d0('0x1a')]);}return _0x3de934[_0xa3d0('0x49')](_0x57c705);}})[_0xa3d0('0x20')](function(_0x54d6c8){if(_0x54d6c8){return _0x54d6c8?{'count':_0x3ced11,'rows':_0x54d6c8}:null;}})[_0xa3d0('0x20')](respondWithResult(_0x39b09b,null))[_0xa3d0('0x39')](handleError(_0x39b09b,null));};exports[_0xa3d0('0x4a')]=function(_0x498e0e,_0x2641bb,_0x4c78c8){var _0x48b49a={};var _0x42ba8a={};var _0x12cabc;var _0x2ca1cb;return db[_0xa3d0('0x26')]['findOne']({'where':{'id':_0x498e0e['params']['id']}})[_0xa3d0('0x20')](handleEntityNotFound(_0x2641bb,null))[_0xa3d0('0x20')](function(_0x27cac1){if(_0x27cac1){_0x12cabc=_0x27cac1;_0x42ba8a['model']=_['keys'](db[_0xa3d0('0x4b')]['rawAttributes']);_0x42ba8a[_0xa3d0('0x2a')]=_[_0xa3d0('0x2b')](_0x498e0e[_0xa3d0('0x2a')]);_0x42ba8a[_0xa3d0('0x2c')]=_[_0xa3d0('0x2d')](_0x42ba8a[_0xa3d0('0x2e')],_0x42ba8a[_0xa3d0('0x2a')]);_0x48b49a[_0xa3d0('0x2f')]=_[_0xa3d0('0x2d')](_0x42ba8a[_0xa3d0('0x2e')],qs[_0xa3d0('0x3b')](_0x498e0e[_0xa3d0('0x2a')]['fields']));_0x48b49a[_0xa3d0('0x2f')]=_0x48b49a['attributes'][_0xa3d0('0x30')]?_0x48b49a[_0xa3d0('0x2f')]:_0x42ba8a[_0xa3d0('0x2e')];_0x48b49a[_0xa3d0('0x47')]=qs[_0xa3d0('0x34')](_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x34')]);_0x48b49a[_0xa3d0('0x36')]=qs[_0xa3d0('0x2c')](_[_0xa3d0('0x45')](_0x498e0e[_0xa3d0('0x2a')],_0x42ba8a[_0xa3d0('0x2c')]));if(_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x35')]){_0x48b49a[_0xa3d0('0x36')]=_[_0xa3d0('0x3e')](_0x48b49a[_0xa3d0('0x36')],{'$or':_[_0xa3d0('0x25')](_0x48b49a[_0xa3d0('0x2f')],function(_0xe13ed5){var _0x295178={};_0x295178[_0xe13ed5]={'$like':'%'+_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x35')]+'%'};return _0x295178;})});}_0x48b49a=_['merge']({},_0x48b49a,_0x498e0e[_0xa3d0('0x37')]);return _0x12cabc[_0xa3d0('0x4a')](_0x48b49a);}})[_0xa3d0('0x20')](function(_0x3fe150){if(_0x3fe150){_0x2ca1cb=_0x3fe150[_0xa3d0('0x30')];if(!_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x31')]('nolimit')){_0x48b49a[_0xa3d0('0x33')]=qs[_0xa3d0('0x33')](_0x498e0e[_0xa3d0('0x2a')][_0xa3d0('0x33')]);_0x48b49a[_0xa3d0('0x1a')]=qs[_0xa3d0('0x1a')](_0x498e0e['query'][_0xa3d0('0x1a')]);}return _0x12cabc[_0xa3d0('0x4a')](_0x48b49a);}})[_0xa3d0('0x20')](function(_0x1c3faa){if(_0x1c3faa){return _0x1c3faa?{'count':_0x2ca1cb,'rows':_0x1c3faa}:null;}})[_0xa3d0('0x20')](respondWithResult(_0x2641bb,null))[_0xa3d0('0x39')](handleError(_0x2641bb,null));};exports['setTags']=function(_0x3f788d,_0x140883,_0xa47eda){if(_0x3f788d[_0xa3d0('0x41')]['id']){delete _0x3f788d[_0xa3d0('0x41')]['id'];}return db[_0xa3d0('0x26')][_0xa3d0('0x44')]({'where':{'id':_0x3f788d[_0xa3d0('0x3a')]['id']}})['then'](handleEntityNotFound(_0x140883,null))[_0xa3d0('0x20')](function(_0x5bd27e){if(_0x5bd27e){return _0x5bd27e['setTags'](_0x3f788d[_0xa3d0('0x41')][_0xa3d0('0x4c')]||[]);}return null;})[_0xa3d0('0x20')](respondWithResult(_0x140883,null))[_0xa3d0('0x39')](handleError(_0x140883,null));}; \ No newline at end of file +var _0x807e=['getFields','hasOwnProperty','getSubjects','findOne','rawAttributes','nolimit','getDescriptions','ZendeskField','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','index','ZendeskConfiguration','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','length','order','pick'];(function(_0x1da5e0,_0x2bc396){var _0x5d9996=function(_0x542c0d){while(--_0x542c0d){_0x1da5e0['push'](_0x1da5e0['shift']());}};_0x5d9996(++_0x2bc396);}(_0x807e,0xac));var _0xe807=function(_0x475a0e,_0x3414ed){_0x475a0e=_0x475a0e-0x0;var _0x356553=_0x807e[_0x475a0e];return _0x356553;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe807('0x0'));var jsonpatch=require(_0xe807('0x1'));var rp=require(_0xe807('0x2'));var moment=require(_0xe807('0x3'));var BPromise=require(_0xe807('0x4'));var Mustache=require(_0xe807('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe807('0x6'));var ejs=require(_0xe807('0x7'));var fs=require('fs');var fs_extra=require(_0xe807('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe807('0x9'));var jsforce=require(_0xe807('0xa'));var deskjs=require(_0xe807('0xb'));var toCsv=require(_0xe807('0x6'));var querystring=require(_0xe807('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe807('0xd'));var qs=require(_0xe807('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe807('0xf'));var logger=require(_0xe807('0x10'))(_0xe807('0x11'));var utils=require('../../config/utils');var config=require(_0xe807('0x12'));var licenseUtil=require(_0xe807('0x13'));var db=require(_0xe807('0x14'))['db'];function respondWithStatusCode(_0x1cc778,_0x25e62d){_0x25e62d=_0x25e62d||0xcc;return function(_0x2aa4c9){if(_0x2aa4c9){return _0x1cc778[_0xe807('0x15')](_0x25e62d);}return _0x1cc778[_0xe807('0x16')](_0x25e62d)[_0xe807('0x17')]();};}function respondWithResult(_0x3641f9,_0x55558a){_0x55558a=_0x55558a||0xc8;return function(_0x10c463){if(_0x10c463){return _0x3641f9['status'](_0x55558a)[_0xe807('0x18')](_0x10c463);}};}function respondWithFilteredResult(_0x591ff1,_0x2a0122){return function(_0xc0a6){if(_0xc0a6){var _0x5eb791=typeof _0x2a0122[_0xe807('0x19')]===_0xe807('0x1a')&&typeof _0x2a0122[_0xe807('0x1b')]===_0xe807('0x1a');var _0x345e20=_0xc0a6[_0xe807('0x1c')];var _0x3a1390=_0x5eb791?0x0:_0x2a0122[_0xe807('0x19')];var _0x188226=_0x5eb791?_0xc0a6['count']:_0x2a0122[_0xe807('0x19')]+_0x2a0122[_0xe807('0x1b')];var _0x353cc1;if(_0x188226>=_0x345e20){_0x188226=_0x345e20;_0x353cc1=0xc8;}else{_0x353cc1=0xce;}_0x591ff1[_0xe807('0x16')](_0x353cc1);return _0x591ff1[_0xe807('0x1d')]('Content-Range',_0x3a1390+'-'+_0x188226+'/'+_0x345e20)[_0xe807('0x18')](_0xc0a6);}return null;};}function patchUpdates(_0x8c5748){return function(_0x11bda0){try{jsonpatch['apply'](_0x11bda0,_0x8c5748,!![]);}catch(_0x2afd8){return BPromise[_0xe807('0x1e')](_0x2afd8);}return _0x11bda0[_0xe807('0x1f')]();};}function saveUpdates(_0x8eb58e,_0x36cfd6){return function(_0x5dbe3d){if(_0x5dbe3d){return _0x5dbe3d[_0xe807('0x20')](_0x8eb58e)[_0xe807('0x21')](function(_0x291506){return _0x291506;});}return null;};}function removeEntity(_0xfb728e,_0x4afa4b){return function(_0x76e842){if(_0x76e842){return _0x76e842[_0xe807('0x22')]()[_0xe807('0x21')](function(){_0xfb728e['status'](0xcc)[_0xe807('0x17')]();});}};}function handleEntityNotFound(_0x20562e,_0x10c00e){return function(_0x284eb9){if(!_0x284eb9){_0x20562e[_0xe807('0x15')](0x194);}return _0x284eb9;};}function handleError(_0x1632a1,_0x36b730){_0x36b730=_0x36b730||0x1f4;return function(_0x5ebb82){logger[_0xe807('0x23')](_0x5ebb82['stack']);if(_0x5ebb82[_0xe807('0x24')]){delete _0x5ebb82[_0xe807('0x24')];}_0x1632a1['status'](_0x36b730)['send'](_0x5ebb82);};}exports[_0xe807('0x25')]=function(_0x228059,_0x140007){var _0x6c4466={},_0x5729d5={},_0x285d53={'count':0x0,'rows':[]};var _0x14af50=_['map'](db[_0xe807('0x26')]['rawAttributes'],function(_0x4f9607){return{'name':_0x4f9607[_0xe807('0x27')],'type':_0x4f9607[_0xe807('0x28')]['key']};});_0x5729d5[_0xe807('0x29')]=_[_0xe807('0x2a')](_0x14af50,_0xe807('0x24'));_0x5729d5[_0xe807('0x2b')]=_[_0xe807('0x2c')](_0x228059[_0xe807('0x2b')]);_0x5729d5[_0xe807('0x2d')]=_[_0xe807('0x2e')](_0x5729d5[_0xe807('0x29')],_0x5729d5[_0xe807('0x2b')]);_0x6c4466[_0xe807('0x2f')]=_[_0xe807('0x2e')](_0x5729d5[_0xe807('0x29')],qs[_0xe807('0x30')](_0x228059[_0xe807('0x2b')][_0xe807('0x30')]));_0x6c4466['attributes']=_0x6c4466[_0xe807('0x2f')]['length']?_0x6c4466['attributes']:_0x5729d5['model'];if(!_0x228059[_0xe807('0x2b')]['hasOwnProperty']('nolimit')){_0x6c4466[_0xe807('0x1b')]=qs['limit'](_0x228059[_0xe807('0x2b')][_0xe807('0x1b')]);_0x6c4466['offset']=qs[_0xe807('0x19')](_0x228059['query']['offset']);}_0x6c4466['order']=qs['sort'](_0x228059[_0xe807('0x2b')][_0xe807('0x31')]);_0x6c4466[_0xe807('0x32')]=qs[_0xe807('0x2d')](_['pick'](_0x228059[_0xe807('0x2b')],_0x5729d5[_0xe807('0x2d')]),_0x14af50);if(_0x228059[_0xe807('0x2b')][_0xe807('0x33')]){_0x6c4466[_0xe807('0x32')]=_['merge'](_0x6c4466[_0xe807('0x32')],{'$or':_[_0xe807('0x2a')](_0x14af50,function(_0x485cd7){if(_0x485cd7[_0xe807('0x28')]!==_0xe807('0x34')){var _0x12bca9={};_0x12bca9[_0x485cd7[_0xe807('0x24')]]={'$like':'%'+_0x228059[_0xe807('0x2b')]['filter']+'%'};return _0x12bca9;}})});}_0x6c4466=_['merge']({},_0x6c4466,_0x228059[_0xe807('0x35')]);var _0x4618dd={'where':_0x6c4466[_0xe807('0x32')]};return db[_0xe807('0x26')][_0xe807('0x1c')](_0x4618dd)[_0xe807('0x21')](function(_0xf9ebff){_0x285d53[_0xe807('0x1c')]=_0xf9ebff;if(_0x228059[_0xe807('0x2b')][_0xe807('0x36')]){_0x6c4466[_0xe807('0x37')]=[{'all':!![]}];}return db[_0xe807('0x26')][_0xe807('0x38')](_0x6c4466);})[_0xe807('0x21')](function(_0x2fb522){_0x285d53[_0xe807('0x39')]=_0x2fb522;return _0x285d53;})[_0xe807('0x21')](respondWithFilteredResult(_0x140007,_0x6c4466))[_0xe807('0x3a')](handleError(_0x140007,null));};exports[_0xe807('0x3b')]=function(_0x534285,_0x5e6a27){var _0x210bdc={'raw':![],'where':{'id':_0x534285['params']['id']}},_0x5c7f7e={};_0x5c7f7e['model']=_[_0xe807('0x2c')](db[_0xe807('0x26')]['rawAttributes']);_0x5c7f7e[_0xe807('0x2b')]=_[_0xe807('0x2c')](_0x534285[_0xe807('0x2b')]);_0x5c7f7e[_0xe807('0x2d')]=_[_0xe807('0x2e')](_0x5c7f7e['model'],_0x5c7f7e[_0xe807('0x2b')]);_0x210bdc[_0xe807('0x2f')]=_[_0xe807('0x2e')](_0x5c7f7e[_0xe807('0x29')],qs['fields'](_0x534285[_0xe807('0x2b')][_0xe807('0x30')]));_0x210bdc[_0xe807('0x2f')]=_0x210bdc[_0xe807('0x2f')]['length']?_0x210bdc[_0xe807('0x2f')]:_0x5c7f7e['model'];if(_0x534285['query']['includeAll']){_0x210bdc[_0xe807('0x37')]=[{'all':!![]}];}_0x210bdc=_[_0xe807('0x3c')]({},_0x210bdc,_0x534285['options']);return db[_0xe807('0x26')][_0xe807('0x3d')](_0x210bdc)[_0xe807('0x21')](handleEntityNotFound(_0x5e6a27,null))[_0xe807('0x21')](respondWithResult(_0x5e6a27,null))['catch'](handleError(_0x5e6a27,null));};exports[_0xe807('0x3e')]=function(_0x56b2cd,_0x171f5d){return db[_0xe807('0x26')][_0xe807('0x3e')](_0x56b2cd[_0xe807('0x3f')],{})[_0xe807('0x21')](respondWithResult(_0x171f5d,0xc9))[_0xe807('0x3a')](handleError(_0x171f5d,null));};exports[_0xe807('0x20')]=function(_0x59d59b,_0x40185a){if(_0x59d59b[_0xe807('0x3f')]['id']){delete _0x59d59b[_0xe807('0x3f')]['id'];}return db['ZendeskConfiguration'][_0xe807('0x3d')]({'where':{'id':_0x59d59b[_0xe807('0x40')]['id']}})[_0xe807('0x21')](handleEntityNotFound(_0x40185a,null))['then'](saveUpdates(_0x59d59b[_0xe807('0x3f')],null))[_0xe807('0x21')](respondWithResult(_0x40185a,null))[_0xe807('0x3a')](handleError(_0x40185a,null));};exports[_0xe807('0x22')]=function(_0x4b7546,_0xe798cc){return db[_0xe807('0x26')][_0xe807('0x3d')]({'where':{'id':_0x4b7546[_0xe807('0x40')]['id']}})[_0xe807('0x21')](handleEntityNotFound(_0xe798cc,null))[_0xe807('0x21')](removeEntity(_0xe798cc,null))['catch'](handleError(_0xe798cc,null));};exports['getFields']=function(_0xc9f090,_0x5ee023,_0x21aeec){var _0x51b71e={};var _0x5ab0d7={};var _0x2cb824;var _0x2a8593;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xc9f090[_0xe807('0x40')]['id']}})['then'](handleEntityNotFound(_0x5ee023,null))[_0xe807('0x21')](function(_0xb6cb41){if(_0xb6cb41){_0x2cb824=_0xb6cb41;_0x5ab0d7[_0xe807('0x29')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x5ab0d7[_0xe807('0x2b')]=_[_0xe807('0x2c')](_0xc9f090[_0xe807('0x2b')]);_0x5ab0d7[_0xe807('0x2d')]=_[_0xe807('0x2e')](_0x5ab0d7[_0xe807('0x29')],_0x5ab0d7[_0xe807('0x2b')]);_0x51b71e[_0xe807('0x2f')]=_[_0xe807('0x2e')](_0x5ab0d7[_0xe807('0x29')],qs[_0xe807('0x30')](_0xc9f090[_0xe807('0x2b')][_0xe807('0x30')]));_0x51b71e['attributes']=_0x51b71e[_0xe807('0x2f')][_0xe807('0x41')]?_0x51b71e[_0xe807('0x2f')]:_0x5ab0d7[_0xe807('0x29')];_0x51b71e[_0xe807('0x42')]=qs[_0xe807('0x31')](_0xc9f090['query'][_0xe807('0x31')]);_0x51b71e[_0xe807('0x32')]=qs['filters'](_[_0xe807('0x43')](_0xc9f090[_0xe807('0x2b')],_0x5ab0d7[_0xe807('0x2d')]));if(_0xc9f090[_0xe807('0x2b')]['filter']){_0x51b71e['where']=_[_0xe807('0x3c')](_0x51b71e['where'],{'$or':_['map'](_0x51b71e[_0xe807('0x2f')],function(_0x4a40cc){var _0x4016e1={};_0x4016e1[_0x4a40cc]={'$like':'%'+_0xc9f090[_0xe807('0x2b')]['filter']+'%'};return _0x4016e1;})});}_0x51b71e=_[_0xe807('0x3c')]({},_0x51b71e,_0xc9f090[_0xe807('0x35')]);return _0x2cb824[_0xe807('0x44')](_0x51b71e);}})[_0xe807('0x21')](function(_0x420735){if(_0x420735){_0x2a8593=_0x420735['length'];if(!_0xc9f090[_0xe807('0x2b')][_0xe807('0x45')]('nolimit')){_0x51b71e['limit']=qs[_0xe807('0x1b')](_0xc9f090[_0xe807('0x2b')][_0xe807('0x1b')]);_0x51b71e[_0xe807('0x19')]=qs[_0xe807('0x19')](_0xc9f090[_0xe807('0x2b')][_0xe807('0x19')]);}return _0x2cb824[_0xe807('0x44')](_0x51b71e);}})[_0xe807('0x21')](function(_0x585094){if(_0x585094){return _0x585094?{'count':_0x2a8593,'rows':_0x585094}:null;}})[_0xe807('0x21')](respondWithResult(_0x5ee023,null))[_0xe807('0x3a')](handleError(_0x5ee023,null));};exports[_0xe807('0x46')]=function(_0x484879,_0x302b68,_0x5a3009){var _0x42ef5d={};var _0x1dce12={};var _0x2f342b;var _0x2610e7;return db['ZendeskConfiguration'][_0xe807('0x47')]({'where':{'id':_0x484879[_0xe807('0x40')]['id']}})[_0xe807('0x21')](handleEntityNotFound(_0x302b68,null))['then'](function(_0x3e2a01){if(_0x3e2a01){_0x2f342b=_0x3e2a01;_0x1dce12['model']=_[_0xe807('0x2c')](db['ZendeskField'][_0xe807('0x48')]);_0x1dce12[_0xe807('0x2b')]=_['keys'](_0x484879[_0xe807('0x2b')]);_0x1dce12[_0xe807('0x2d')]=_['intersection'](_0x1dce12['model'],_0x1dce12['query']);_0x42ef5d[_0xe807('0x2f')]=_['intersection'](_0x1dce12[_0xe807('0x29')],qs[_0xe807('0x30')](_0x484879['query'][_0xe807('0x30')]));_0x42ef5d['attributes']=_0x42ef5d['attributes']['length']?_0x42ef5d[_0xe807('0x2f')]:_0x1dce12[_0xe807('0x29')];_0x42ef5d[_0xe807('0x42')]=qs[_0xe807('0x31')](_0x484879[_0xe807('0x2b')][_0xe807('0x31')]);_0x42ef5d[_0xe807('0x32')]=qs['filters'](_[_0xe807('0x43')](_0x484879[_0xe807('0x2b')],_0x1dce12[_0xe807('0x2d')]));if(_0x484879[_0xe807('0x2b')][_0xe807('0x33')]){_0x42ef5d[_0xe807('0x32')]=_[_0xe807('0x3c')](_0x42ef5d[_0xe807('0x32')],{'$or':_[_0xe807('0x2a')](_0x42ef5d['attributes'],function(_0x347c5e){var _0x4db404={};_0x4db404[_0x347c5e]={'$like':'%'+_0x484879[_0xe807('0x2b')][_0xe807('0x33')]+'%'};return _0x4db404;})});}_0x42ef5d=_[_0xe807('0x3c')]({},_0x42ef5d,_0x484879[_0xe807('0x35')]);return _0x2f342b[_0xe807('0x46')](_0x42ef5d);}})[_0xe807('0x21')](function(_0x32d93c){if(_0x32d93c){_0x2610e7=_0x32d93c[_0xe807('0x41')];if(!_0x484879[_0xe807('0x2b')][_0xe807('0x45')](_0xe807('0x49'))){_0x42ef5d[_0xe807('0x1b')]=qs[_0xe807('0x1b')](_0x484879['query'][_0xe807('0x1b')]);_0x42ef5d[_0xe807('0x19')]=qs[_0xe807('0x19')](_0x484879['query'][_0xe807('0x19')]);}return _0x2f342b[_0xe807('0x46')](_0x42ef5d);}})[_0xe807('0x21')](function(_0x4c1bdc){if(_0x4c1bdc){return _0x4c1bdc?{'count':_0x2610e7,'rows':_0x4c1bdc}:null;}})[_0xe807('0x21')](respondWithResult(_0x302b68,null))[_0xe807('0x3a')](handleError(_0x302b68,null));};exports[_0xe807('0x4a')]=function(_0x3d0b73,_0x37a5b4,_0x8a026e){var _0x5e28cf={};var _0x2dcd55={};var _0x48bc2e;var _0x7054b5;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3d0b73[_0xe807('0x40')]['id']}})['then'](handleEntityNotFound(_0x37a5b4,null))[_0xe807('0x21')](function(_0xd6a768){if(_0xd6a768){_0x48bc2e=_0xd6a768;_0x2dcd55[_0xe807('0x29')]=_[_0xe807('0x2c')](db[_0xe807('0x4b')][_0xe807('0x48')]);_0x2dcd55[_0xe807('0x2b')]=_[_0xe807('0x2c')](_0x3d0b73['query']);_0x2dcd55['filters']=_['intersection'](_0x2dcd55[_0xe807('0x29')],_0x2dcd55['query']);_0x5e28cf[_0xe807('0x2f')]=_[_0xe807('0x2e')](_0x2dcd55[_0xe807('0x29')],qs[_0xe807('0x30')](_0x3d0b73['query'][_0xe807('0x30')]));_0x5e28cf[_0xe807('0x2f')]=_0x5e28cf['attributes'][_0xe807('0x41')]?_0x5e28cf['attributes']:_0x2dcd55[_0xe807('0x29')];_0x5e28cf[_0xe807('0x42')]=qs[_0xe807('0x31')](_0x3d0b73[_0xe807('0x2b')]['sort']);_0x5e28cf[_0xe807('0x32')]=qs[_0xe807('0x2d')](_[_0xe807('0x43')](_0x3d0b73['query'],_0x2dcd55[_0xe807('0x2d')]));if(_0x3d0b73[_0xe807('0x2b')]['filter']){_0x5e28cf[_0xe807('0x32')]=_[_0xe807('0x3c')](_0x5e28cf[_0xe807('0x32')],{'$or':_[_0xe807('0x2a')](_0x5e28cf['attributes'],function(_0x548875){var _0x3cdc47={};_0x3cdc47[_0x548875]={'$like':'%'+_0x3d0b73[_0xe807('0x2b')]['filter']+'%'};return _0x3cdc47;})});}_0x5e28cf=_['merge']({},_0x5e28cf,_0x3d0b73[_0xe807('0x35')]);return _0x48bc2e[_0xe807('0x4a')](_0x5e28cf);}})['then'](function(_0x24b508){if(_0x24b508){_0x7054b5=_0x24b508[_0xe807('0x41')];if(!_0x3d0b73[_0xe807('0x2b')][_0xe807('0x45')](_0xe807('0x49'))){_0x5e28cf['limit']=qs[_0xe807('0x1b')](_0x3d0b73[_0xe807('0x2b')][_0xe807('0x1b')]);_0x5e28cf['offset']=qs[_0xe807('0x19')](_0x3d0b73[_0xe807('0x2b')][_0xe807('0x19')]);}return _0x48bc2e[_0xe807('0x4a')](_0x5e28cf);}})[_0xe807('0x21')](function(_0x3c13b2){if(_0x3c13b2){return _0x3c13b2?{'count':_0x7054b5,'rows':_0x3c13b2}:null;}})[_0xe807('0x21')](respondWithResult(_0x37a5b4,null))['catch'](handleError(_0x37a5b4,null));};exports[_0xe807('0x4c')]=function(_0x1e5e90,_0x49f09e,_0x357691){var _0x2b6f61={};var _0x9ca579={};var _0x350321;var _0x43dfd5;return db['ZendeskConfiguration'][_0xe807('0x47')]({'where':{'id':_0x1e5e90['params']['id']}})[_0xe807('0x21')](handleEntityNotFound(_0x49f09e,null))[_0xe807('0x21')](function(_0x35a1de){if(_0x35a1de){_0x350321=_0x35a1de;_0x9ca579['model']=_[_0xe807('0x2c')](db[_0xe807('0x4d')][_0xe807('0x48')]);_0x9ca579['query']=_[_0xe807('0x2c')](_0x1e5e90[_0xe807('0x2b')]);_0x9ca579[_0xe807('0x2d')]=_[_0xe807('0x2e')](_0x9ca579[_0xe807('0x29')],_0x9ca579[_0xe807('0x2b')]);_0x2b6f61['attributes']=_[_0xe807('0x2e')](_0x9ca579[_0xe807('0x29')],qs['fields'](_0x1e5e90['query'][_0xe807('0x30')]));_0x2b6f61['attributes']=_0x2b6f61[_0xe807('0x2f')]['length']?_0x2b6f61[_0xe807('0x2f')]:_0x9ca579[_0xe807('0x29')];_0x2b6f61['order']=qs['sort'](_0x1e5e90[_0xe807('0x2b')][_0xe807('0x31')]);_0x2b6f61[_0xe807('0x32')]=qs[_0xe807('0x2d')](_[_0xe807('0x43')](_0x1e5e90[_0xe807('0x2b')],_0x9ca579[_0xe807('0x2d')]));if(_0x1e5e90['query'][_0xe807('0x33')]){_0x2b6f61[_0xe807('0x32')]=_[_0xe807('0x3c')](_0x2b6f61[_0xe807('0x32')],{'$or':_[_0xe807('0x2a')](_0x2b6f61['attributes'],function(_0x8df866){var _0x1e6e8d={};_0x1e6e8d[_0x8df866]={'$like':'%'+_0x1e5e90[_0xe807('0x2b')][_0xe807('0x33')]+'%'};return _0x1e6e8d;})});}_0x2b6f61=_[_0xe807('0x3c')]({},_0x2b6f61,_0x1e5e90['options']);return _0x350321['getTags'](_0x2b6f61);}})[_0xe807('0x21')](function(_0x51a75b){if(_0x51a75b){_0x43dfd5=_0x51a75b[_0xe807('0x41')];if(!_0x1e5e90['query'][_0xe807('0x45')](_0xe807('0x49'))){_0x2b6f61[_0xe807('0x1b')]=qs[_0xe807('0x1b')](_0x1e5e90['query']['limit']);_0x2b6f61[_0xe807('0x19')]=qs['offset'](_0x1e5e90[_0xe807('0x2b')][_0xe807('0x19')]);}return _0x350321[_0xe807('0x4c')](_0x2b6f61);}})['then'](function(_0x26d35e){if(_0x26d35e){return _0x26d35e?{'count':_0x43dfd5,'rows':_0x26d35e}:null;}})[_0xe807('0x21')](respondWithResult(_0x49f09e,null))[_0xe807('0x3a')](handleError(_0x49f09e,null));};exports[_0xe807('0x4e')]=function(_0x4c976e,_0x4505c5,_0x56ec49){if(_0x4c976e[_0xe807('0x3f')]['id']){delete _0x4c976e['body']['id'];}return db[_0xe807('0x26')]['findOne']({'where':{'id':_0x4c976e[_0xe807('0x40')]['id']}})['then'](handleEntityNotFound(_0x4505c5,null))[_0xe807('0x21')](function(_0x1443bd){if(_0x1443bd){return _0x1443bd[_0xe807('0x4e')](_0x4c976e[_0xe807('0x3f')][_0xe807('0x4f')]||[]);}return null;})[_0xe807('0x21')](respondWithResult(_0x4505c5,null))[_0xe807('0x3a')](handleError(_0x4505c5,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 040c076..c9fd704 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 _0x0598=['ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','path','exports'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x0598,0x92));var _0x8059=function(_0x307ec1,_0x50dd64){_0x307ec1=_0x307ec1-0x0;var _0x10c790=_0x0598[_0x307ec1];return _0x10c790;};'use strict';var _=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var logger=require('../../config/logger')(_0x8059('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8059('0x3'));var fs=require('fs');var path=require(_0x8059('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0x8059('0x5')]=function(_0xa7d7c1,_0x512c0f){return _0xa7d7c1['define'](_0x8059('0x6'),attributes,{'tableName':_0x8059('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b17=['int_zendesk_configurations','lodash','../../config/logger','moment','bluebird','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x3aa931,_0x845306){var _0x48214e=function(_0x3f6e1b){while(--_0x3f6e1b){_0x3aa931['push'](_0x3aa931['shift']());}};_0x48214e(++_0x845306);}(_0x4b17,0x10f));var _0x74b1=function(_0x396466,_0xe9857b){_0x396466=_0x396466-0x0;var _0x5e9ab4=_0x4b17[_0x396466];return _0x5e9ab4;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var logger=require(_0x74b1('0x1'))('api');var moment=require(_0x74b1('0x2'));var BPromise=require(_0x74b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module[_0x74b1('0x6')]=function(_0x379dcc,_0x3873a6){return _0x379dcc[_0x74b1('0x7')](_0x74b1('0x8'),attributes,{'tableName':_0x74b1('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 de3ef86..7c45950 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 _0x3387=['error','code','message','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','debug'];(function(_0x4704dc,_0x575a5f){var _0x254d81=function(_0x3b135d){while(--_0x3b135d){_0x4704dc['push'](_0x4704dc['shift']());}};_0x254d81(++_0x575a5f);}(_0x3387,0x132));var _0x7338=function(_0x409e8d,_0xe77668){_0x409e8d=_0x409e8d-0x0;var _0x23da8c=_0x3387[_0x409e8d];return _0x23da8c;};'use strict';var _=require('lodash');var util=require(_0x7338('0x0'));var moment=require(_0x7338('0x1'));var BPromise=require(_0x7338('0x2'));var rs=require(_0x7338('0x3'));var fs=require('fs');var Redis=require(_0x7338('0x4'));var db=require(_0x7338('0x5'))['db'];var utils=require(_0x7338('0x6'));var logger=require(_0x7338('0x7'))(_0x7338('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7338('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5edca8,_0x35809f,_0x564a83){return new BPromise(function(_0x23d078,_0xcd2fed){return client[_0x7338('0xa')](_0x5edca8,_0x564a83)[_0x7338('0xb')](function(_0x448091){logger[_0x7338('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x35809f,'request\x20sent');logger[_0x7338('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x35809f,'request\x20sent',JSON['stringify'](_0x448091));if(_0x448091[_0x7338('0xe')]){if(_0x448091[_0x7338('0xe')][_0x7338('0xf')]===0x1f4){logger[_0x7338('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x35809f,_0x448091[_0x7338('0xe')]['message']);return _0xcd2fed(_0x448091[_0x7338('0xe')][_0x7338('0x10')]);}logger[_0x7338('0xe')](_0x7338('0x11'),_0x35809f,_0x448091[_0x7338('0xe')][_0x7338('0x10')]);return _0x23d078(_0x448091[_0x7338('0xe')][_0x7338('0x10')]);}else{logger[_0x7338('0xc')](_0x7338('0x11'),_0x35809f,_0x7338('0x12'));_0x23d078(_0x448091[_0x7338('0x13')]['message']);}})['catch'](function(_0x2b3641){logger[_0x7338('0xe')](_0x7338('0x11'),_0x35809f,_0x2b3641);_0xcd2fed(_0x2b3641);});});} \ No newline at end of file +var _0x43af=['message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xea3a7b,_0x309c62){var _0x591e73=function(_0x62c7ce){while(--_0x62c7ce){_0xea3a7b['push'](_0xea3a7b['shift']());}};_0x591e73(++_0x309c62);}(_0x43af,0x160));var _0xf43a=function(_0x589534,_0x45d3f1){_0x589534=_0x589534-0x0;var _0x3c600f=_0x43af[_0x589534];return _0x3c600f;};'use strict';var _=require(_0xf43a('0x0'));var util=require(_0xf43a('0x1'));var moment=require(_0xf43a('0x2'));var BPromise=require(_0xf43a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf43a('0x4'));var db=require(_0xf43a('0x5'))['db'];var utils=require(_0xf43a('0x6'));var logger=require(_0xf43a('0x7'))(_0xf43a('0x8'));var config=require(_0xf43a('0x9'));var jayson=require(_0xf43a('0xa'));var client=jayson[_0xf43a('0xb')][_0xf43a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d86d6,_0x156cd4,_0xc4993e){return new BPromise(function(_0x3e7bc6,_0x7ee34c){return client[_0xf43a('0xd')](_0x1d86d6,_0xc4993e)[_0xf43a('0xe')](function(_0x39dfc9){logger[_0xf43a('0xf')](_0xf43a('0x10'),_0x156cd4,'request\x20sent');logger[_0xf43a('0x11')](_0xf43a('0x12'),_0x156cd4,_0xf43a('0x13'),JSON[_0xf43a('0x14')](_0x39dfc9));if(_0x39dfc9['error']){if(_0x39dfc9[_0xf43a('0x15')][_0xf43a('0x16')]===0x1f4){logger[_0xf43a('0x15')](_0xf43a('0x10'),_0x156cd4,_0x39dfc9[_0xf43a('0x15')][_0xf43a('0x17')]);return _0x7ee34c(_0x39dfc9[_0xf43a('0x15')][_0xf43a('0x17')]);}logger[_0xf43a('0x15')](_0xf43a('0x10'),_0x156cd4,_0x39dfc9['error'][_0xf43a('0x17')]);return _0x3e7bc6(_0x39dfc9['error']['message']);}else{logger[_0xf43a('0xf')](_0xf43a('0x10'),_0x156cd4,_0xf43a('0x13'));_0x3e7bc6(_0x39dfc9[_0xf43a('0x18')][_0xf43a('0x17')]);}})['catch'](function(_0x1d9669){logger[_0xf43a('0x15')](_0xf43a('0x10'),_0x156cd4,_0x1d9669);_0x7ee34c(_0x1d9669);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c91cd7e..a52aa98 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 _0x4bc9=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x3dacb8,_0x48eab5){var _0x16d5a0=function(_0x1397bf){while(--_0x1397bf){_0x3dacb8['push'](_0x3dacb8['shift']());}};_0x16d5a0(++_0x48eab5);}(_0x4bc9,0x135));var _0x94bc=function(_0x57a35a,_0x7eb9b1){_0x57a35a=_0x57a35a-0x0;var _0x4abe87=_0x4bc9[_0x57a35a];return _0x4abe87;};'use strict';var multer=require(_0x94bc('0x0'));var util=require(_0x94bc('0x1'));var path=require(_0x94bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x94bc('0x3'));var router=express[_0x94bc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x94bc('0x5'));var config=require(_0x94bc('0x6'));var controller=require(_0x94bc('0x7'));router[_0x94bc('0x8')]('/',auth[_0x94bc('0x9')](),controller[_0x94bc('0xa')]);router[_0x94bc('0x8')](_0x94bc('0xb'),auth['isAuthenticated'](),controller[_0x94bc('0xc')]);router['post']('/',auth[_0x94bc('0x9')](),controller[_0x94bc('0xd')]);router[_0x94bc('0xe')](_0x94bc('0xb'),auth['isAuthenticated'](),controller[_0x94bc('0xf')]);router[_0x94bc('0x10')](_0x94bc('0xb'),auth[_0x94bc('0x9')](),controller[_0x94bc('0x11')]);module[_0x94bc('0x12')]=router; \ No newline at end of file +var _0xb6eb=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f1c27,_0x15378a){var _0x5b2e49=function(_0xf12007){while(--_0xf12007){_0x1f1c27['push'](_0x1f1c27['shift']());}};_0x5b2e49(++_0x15378a);}(_0xb6eb,0x1de));var _0xbb6e=function(_0x8a0db9,_0x225e1c){_0x8a0db9=_0x8a0db9-0x0;var _0x38bae8=_0xb6eb[_0x8a0db9];return _0x38bae8;};'use strict';var multer=require(_0xbb6e('0x0'));var util=require(_0xbb6e('0x1'));var path=require(_0xbb6e('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb6e('0x3'));var router=express[_0xbb6e('0x4')]();var fs_extra=require(_0xbb6e('0x5'));var auth=require(_0xbb6e('0x6'));var interaction=require(_0xbb6e('0x7'));var config=require(_0xbb6e('0x8'));var controller=require(_0xbb6e('0x9'));router[_0xbb6e('0xa')]('/',auth[_0xbb6e('0xb')](),controller[_0xbb6e('0xc')]);router['get']('/:id',auth[_0xbb6e('0xb')](),controller['show']);router['post']('/',auth[_0xbb6e('0xb')](),controller['create']);router[_0xbb6e('0xd')](_0xbb6e('0xe'),auth[_0xbb6e('0xb')](),controller[_0xbb6e('0xf')]);router[_0xbb6e('0x10')]('/:id',auth[_0xbb6e('0xb')](),controller['destroy']);module[_0xbb6e('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f9b704e..21dc574 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 _0xe58e=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize','exports'];(function(_0x27289f,_0x2c7e98){var _0x45e652=function(_0x4124ea){while(--_0x4124ea){_0x27289f['push'](_0x27289f['shift']());}};_0x45e652(++_0x2c7e98);}(_0xe58e,0x15e));var _0xee58=function(_0x3bc904,_0x4b694a){_0x3bc904=_0x3bc904-0x0;var _0x262536=_0xe58e[_0x3bc904];return _0x262536;};'use strict';var Sequelize=require(_0xee58('0x0'));module[_0xee58('0x1')]={'type':{'type':Sequelize[_0xee58('0x2')](_0xee58('0x3'),_0xee58('0x4'),_0xee58('0x5'),_0xee58('0x6'),'picklist'),'defaultValue':_0xee58('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xee58('0x7')]},'keyType':{'type':Sequelize[_0xee58('0x2')](_0xee58('0x3'),'variable',_0xee58('0x5'))},'keyContent':{'type':Sequelize[_0xee58('0x7')]},'idField':{'type':Sequelize[_0xee58('0x7')]},'nameField':{'type':Sequelize[_0xee58('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee58('0x7')]}}; \ No newline at end of file +var _0x0c74=['exports','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x5bb781,_0x2d7ac7){var _0x2d1236=function(_0x2bb288){while(--_0x2bb288){_0x5bb781['push'](_0x5bb781['shift']());}};_0x2d1236(++_0x2d7ac7);}(_0x0c74,0x125));var _0x40c7=function(_0x3cf150,_0x178cb5){_0x3cf150=_0x3cf150-0x0;var _0x931f8b=_0x0c74[_0x3cf150];return _0x931f8b;};'use strict';var Sequelize=require(_0x40c7('0x0'));module[_0x40c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x40c7('0x2'),_0x40c7('0x3'),_0x40c7('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x40c7('0x5')]},'key':{'type':Sequelize[_0x40c7('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x40c7('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x40c7('0x5')]},'nameField':{'type':Sequelize[_0x40c7('0x5')]},'customField':{'type':Sequelize[_0x40c7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8318478..b462c28 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 _0xcfef=['findAll','rows','catch','show','params','keys','includeAll','merge','find','create','body','eml-format','zip-dir','moment','mustache','util','path','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','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','VIRTUAL','filter','options','ZendeskField','include'];(function(_0x328dfa,_0x12a11c){var _0x20a126=function(_0x38a7f2){while(--_0x38a7f2){_0x328dfa['push'](_0x328dfa['shift']());}};_0x20a126(++_0x12a11c);}(_0xcfef,0x1b5));var _0xfcfe=function(_0x1524b6,_0x13a5ae){_0x1524b6=_0x1524b6-0x0;var _0x352f95=_0xcfef[_0x1524b6];return _0x352f95;};'use strict';var emlformat=require(_0xfcfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfcfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfcfe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfcfe('0x3'));var util=require(_0xfcfe('0x4'));var path=require(_0xfcfe('0x5'));var sox=require(_0xfcfe('0x6'));var csv=require(_0xfcfe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcfe('0x8'));var _=require(_0xfcfe('0x9'));var squel=require(_0xfcfe('0xa'));var crypto=require(_0xfcfe('0xb'));var jsforce=require(_0xfcfe('0xc'));var deskjs=require(_0xfcfe('0xd'));var toCsv=require(_0xfcfe('0x7'));var querystring=require(_0xfcfe('0xe'));var Papa=require(_0xfcfe('0xf'));var Redis=require(_0xfcfe('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfcfe('0x11'));var as=require(_0xfcfe('0x12'));var hardwareService=require(_0xfcfe('0x13'));var logger=require(_0xfcfe('0x14'))(_0xfcfe('0x15'));var utils=require(_0xfcfe('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfcfe('0x17'))['db'];function respondWithStatusCode(_0x34951e,_0x98ac0d){_0x98ac0d=_0x98ac0d||0xcc;return function(_0x4c146e){if(_0x4c146e){return _0x34951e[_0xfcfe('0x18')](_0x98ac0d);}return _0x34951e[_0xfcfe('0x19')](_0x98ac0d)[_0xfcfe('0x1a')]();};}function respondWithResult(_0x546028,_0x3704bc){_0x3704bc=_0x3704bc||0xc8;return function(_0xdc15e8){if(_0xdc15e8){return _0x546028[_0xfcfe('0x19')](_0x3704bc)[_0xfcfe('0x1b')](_0xdc15e8);}};}function respondWithFilteredResult(_0x47f60c,_0x2f83e5){return function(_0x4f56c8){if(_0x4f56c8){var _0x54f5db=typeof _0x2f83e5[_0xfcfe('0x1c')]===_0xfcfe('0x1d')&&typeof _0x2f83e5[_0xfcfe('0x1e')]===_0xfcfe('0x1d');var _0x2d8327=_0x4f56c8['count'];var _0x308538=_0x54f5db?0x0:_0x2f83e5[_0xfcfe('0x1c')];var _0x1ee3bf=_0x54f5db?_0x4f56c8[_0xfcfe('0x1f')]:_0x2f83e5[_0xfcfe('0x1c')]+_0x2f83e5[_0xfcfe('0x1e')];var _0x1249ef;if(_0x1ee3bf>=_0x2d8327){_0x1ee3bf=_0x2d8327;_0x1249ef=0xc8;}else{_0x1249ef=0xce;}_0x47f60c[_0xfcfe('0x19')](_0x1249ef);return _0x47f60c[_0xfcfe('0x20')](_0xfcfe('0x21'),_0x308538+'-'+_0x1ee3bf+'/'+_0x2d8327)[_0xfcfe('0x1b')](_0x4f56c8);}return null;};}function patchUpdates(_0x2fbc35){return function(_0x579cf8){try{jsonpatch[_0xfcfe('0x22')](_0x579cf8,_0x2fbc35,!![]);}catch(_0x3e788a){return BPromise[_0xfcfe('0x23')](_0x3e788a);}return _0x579cf8[_0xfcfe('0x24')]();};}function saveUpdates(_0x264c5a,_0x346fb5){return function(_0x35e2b3){if(_0x35e2b3){return _0x35e2b3['update'](_0x264c5a)[_0xfcfe('0x25')](function(_0x53b6f5){return _0x53b6f5;});}return null;};}function removeEntity(_0x33bc0c,_0x823664){return function(_0x444347){if(_0x444347){return _0x444347[_0xfcfe('0x26')]()['then'](function(){_0x33bc0c[_0xfcfe('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3147a9,_0x56a56c){return function(_0x816c78){if(!_0x816c78){_0x3147a9['sendStatus'](0x194);}return _0x816c78;};}function handleError(_0x1b05a2,_0x4a29fd){_0x4a29fd=_0x4a29fd||0x1f4;return function(_0x581943){logger['error'](_0x581943['stack']);if(_0x581943[_0xfcfe('0x27')]){delete _0x581943[_0xfcfe('0x27')];}_0x1b05a2['status'](_0x4a29fd)['send'](_0x581943);};}exports[_0xfcfe('0x28')]=function(_0x573af4,_0x1a8377){var _0xc9ea3a={},_0x581d43={},_0x5abcbf={'count':0x0,'rows':[]};var _0x32ba1c=_[_0xfcfe('0x29')](db['ZendeskField'][_0xfcfe('0x2a')],function(_0x2b5957){return{'name':_0x2b5957['fieldName'],'type':_0x2b5957[_0xfcfe('0x2b')]['key']};});_0x581d43[_0xfcfe('0x2c')]=_['map'](_0x32ba1c,_0xfcfe('0x27'));_0x581d43[_0xfcfe('0x2d')]=_['keys'](_0x573af4[_0xfcfe('0x2d')]);_0x581d43[_0xfcfe('0x2e')]=_[_0xfcfe('0x2f')](_0x581d43[_0xfcfe('0x2c')],_0x581d43[_0xfcfe('0x2d')]);_0xc9ea3a['attributes']=_[_0xfcfe('0x2f')](_0x581d43['model'],qs[_0xfcfe('0x30')](_0x573af4[_0xfcfe('0x2d')]['fields']));_0xc9ea3a[_0xfcfe('0x31')]=_0xc9ea3a['attributes'][_0xfcfe('0x32')]?_0xc9ea3a[_0xfcfe('0x31')]:_0x581d43[_0xfcfe('0x2c')];if(!_0x573af4[_0xfcfe('0x2d')]['hasOwnProperty'](_0xfcfe('0x33'))){_0xc9ea3a[_0xfcfe('0x1e')]=qs['limit'](_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x1e')]);_0xc9ea3a[_0xfcfe('0x1c')]=qs['offset'](_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x1c')]);}_0xc9ea3a['order']=qs[_0xfcfe('0x34')](_0x573af4[_0xfcfe('0x2d')]['sort']);_0xc9ea3a[_0xfcfe('0x35')]=qs['filters'](_[_0xfcfe('0x36')](_0x573af4['query'],_0x581d43[_0xfcfe('0x2e')]),_0x32ba1c);if(_0x573af4['query']['filter']){_0xc9ea3a['where']=_['merge'](_0xc9ea3a[_0xfcfe('0x35')],{'$or':_[_0xfcfe('0x29')](_0x32ba1c,function(_0x43e0d7){if(_0x43e0d7['type']!==_0xfcfe('0x37')){var _0x32f5bf={};_0x32f5bf[_0x43e0d7[_0xfcfe('0x27')]]={'$like':'%'+_0x573af4[_0xfcfe('0x2d')][_0xfcfe('0x38')]+'%'};return _0x32f5bf;}})});}_0xc9ea3a=_['merge']({},_0xc9ea3a,_0x573af4[_0xfcfe('0x39')]);var _0x5a4ca5={'where':_0xc9ea3a['where']};return db[_0xfcfe('0x3a')][_0xfcfe('0x1f')](_0x5a4ca5)['then'](function(_0x256da9){_0x5abcbf[_0xfcfe('0x1f')]=_0x256da9;if(_0x573af4['query']['includeAll']){_0xc9ea3a[_0xfcfe('0x3b')]=[{'all':!![]}];}return db[_0xfcfe('0x3a')][_0xfcfe('0x3c')](_0xc9ea3a);})[_0xfcfe('0x25')](function(_0x15c0f3){_0x5abcbf[_0xfcfe('0x3d')]=_0x15c0f3;return _0x5abcbf;})['then'](respondWithFilteredResult(_0x1a8377,_0xc9ea3a))[_0xfcfe('0x3e')](handleError(_0x1a8377,null));};exports[_0xfcfe('0x3f')]=function(_0x278ffb,_0x19f911){var _0x3d00c2={'raw':!![],'where':{'id':_0x278ffb[_0xfcfe('0x40')]['id']}},_0x4a6c9a={};_0x4a6c9a[_0xfcfe('0x2c')]=_[_0xfcfe('0x41')](db['ZendeskField'][_0xfcfe('0x2a')]);_0x4a6c9a['query']=_['keys'](_0x278ffb[_0xfcfe('0x2d')]);_0x4a6c9a[_0xfcfe('0x2e')]=_['intersection'](_0x4a6c9a['model'],_0x4a6c9a[_0xfcfe('0x2d')]);_0x3d00c2[_0xfcfe('0x31')]=_[_0xfcfe('0x2f')](_0x4a6c9a[_0xfcfe('0x2c')],qs['fields'](_0x278ffb['query'][_0xfcfe('0x30')]));_0x3d00c2[_0xfcfe('0x31')]=_0x3d00c2[_0xfcfe('0x31')][_0xfcfe('0x32')]?_0x3d00c2[_0xfcfe('0x31')]:_0x4a6c9a[_0xfcfe('0x2c')];if(_0x278ffb[_0xfcfe('0x2d')][_0xfcfe('0x42')]){_0x3d00c2[_0xfcfe('0x3b')]=[{'all':!![]}];}_0x3d00c2=_[_0xfcfe('0x43')]({},_0x3d00c2,_0x278ffb[_0xfcfe('0x39')]);return db[_0xfcfe('0x3a')][_0xfcfe('0x44')](_0x3d00c2)[_0xfcfe('0x25')](handleEntityNotFound(_0x19f911,null))['then'](respondWithResult(_0x19f911,null))[_0xfcfe('0x3e')](handleError(_0x19f911,null));};exports['create']=function(_0x4ccb95,_0x583f35){return db['ZendeskField'][_0xfcfe('0x45')](_0x4ccb95['body'],{})[_0xfcfe('0x25')](respondWithResult(_0x583f35,0xc9))['catch'](handleError(_0x583f35,null));};exports['update']=function(_0x1afc28,_0x20e185){if(_0x1afc28[_0xfcfe('0x46')]['id']){delete _0x1afc28[_0xfcfe('0x46')]['id'];}return db['ZendeskField'][_0xfcfe('0x44')]({'where':{'id':_0x1afc28['params']['id']}})[_0xfcfe('0x25')](handleEntityNotFound(_0x20e185,null))[_0xfcfe('0x25')](saveUpdates(_0x1afc28[_0xfcfe('0x46')],null))[_0xfcfe('0x25')](respondWithResult(_0x20e185,null))[_0xfcfe('0x3e')](handleError(_0x20e185,null));};exports[_0xfcfe('0x26')]=function(_0x411ed8,_0x43ad0b){return db['ZendeskField'][_0xfcfe('0x44')]({'where':{'id':_0x411ed8[_0xfcfe('0x40')]['id']}})['then'](handleEntityNotFound(_0x43ad0b,null))[_0xfcfe('0x25')](removeEntity(_0x43ad0b,null))[_0xfcfe('0x3e')](handleError(_0x43ad0b,null));}; \ No newline at end of file +var _0x43e4=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','ZendeskField'];(function(_0x111712,_0xbbbcff){var _0x4c71a4=function(_0x1a845e){while(--_0x1a845e){_0x111712['push'](_0x111712['shift']());}};_0x4c71a4(++_0xbbbcff);}(_0x43e4,0x15a));var _0x443e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x43e4[_0x465028];return _0xb783d4;};'use strict';var emlformat=require(_0x443e('0x0'));var rimraf=require(_0x443e('0x1'));var zipdir=require(_0x443e('0x2'));var jsonpatch=require(_0x443e('0x3'));var rp=require(_0x443e('0x4'));var moment=require(_0x443e('0x5'));var BPromise=require(_0x443e('0x6'));var Mustache=require(_0x443e('0x7'));var util=require(_0x443e('0x8'));var path=require(_0x443e('0x9'));var sox=require(_0x443e('0xa'));var csv=require(_0x443e('0xb'));var ejs=require(_0x443e('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x443e('0xd'));var squel=require(_0x443e('0xe'));var crypto=require(_0x443e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x443e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x443e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x443e('0x12'));var qs=require(_0x443e('0x13'));var as=require(_0x443e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x443e('0x15'));var utils=require(_0x443e('0x16'));var config=require(_0x443e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39503a,_0x54f36a){_0x54f36a=_0x54f36a||0xcc;return function(_0x35e86f){if(_0x35e86f){return _0x39503a['sendStatus'](_0x54f36a);}return _0x39503a['status'](_0x54f36a)[_0x443e('0x18')]();};}function respondWithResult(_0x5d929c,_0x3af126){_0x3af126=_0x3af126||0xc8;return function(_0xc02f11){if(_0xc02f11){return _0x5d929c[_0x443e('0x19')](_0x3af126)['json'](_0xc02f11);}};}function respondWithFilteredResult(_0x4fb024,_0x4f2c8a){return function(_0x1143e4){if(_0x1143e4){var _0x5e1160=typeof _0x4f2c8a[_0x443e('0x1a')]===_0x443e('0x1b')&&typeof _0x4f2c8a[_0x443e('0x1c')]===_0x443e('0x1b');var _0x13167f=_0x1143e4[_0x443e('0x1d')];var _0x53bc15=_0x5e1160?0x0:_0x4f2c8a[_0x443e('0x1a')];var _0x510247=_0x5e1160?_0x1143e4[_0x443e('0x1d')]:_0x4f2c8a['offset']+_0x4f2c8a[_0x443e('0x1c')];var _0x41aba0;if(_0x510247>=_0x13167f){_0x510247=_0x13167f;_0x41aba0=0xc8;}else{_0x41aba0=0xce;}_0x4fb024['status'](_0x41aba0);return _0x4fb024[_0x443e('0x1e')](_0x443e('0x1f'),_0x53bc15+'-'+_0x510247+'/'+_0x13167f)['json'](_0x1143e4);}return null;};}function patchUpdates(_0x267e9c){return function(_0x23e5cc){try{jsonpatch[_0x443e('0x20')](_0x23e5cc,_0x267e9c,!![]);}catch(_0x5f197f){return BPromise[_0x443e('0x21')](_0x5f197f);}return _0x23e5cc[_0x443e('0x22')]();};}function saveUpdates(_0x43a9c6,_0x464cd2){return function(_0x4f67f8){if(_0x4f67f8){return _0x4f67f8[_0x443e('0x23')](_0x43a9c6)['then'](function(_0x33cc04){return _0x33cc04;});}return null;};}function removeEntity(_0x50471a,_0x5bc94f){return function(_0x39aff7){if(_0x39aff7){return _0x39aff7[_0x443e('0x24')]()['then'](function(){_0x50471a[_0x443e('0x19')](0xcc)[_0x443e('0x18')]();});}};}function handleEntityNotFound(_0x3f45b1,_0x315ebe){return function(_0x4664b1){if(!_0x4664b1){_0x3f45b1[_0x443e('0x25')](0x194);}return _0x4664b1;};}function handleError(_0x4dfa7b,_0x195bbb){_0x195bbb=_0x195bbb||0x1f4;return function(_0x10525a){logger[_0x443e('0x26')](_0x10525a[_0x443e('0x27')]);if(_0x10525a[_0x443e('0x28')]){delete _0x10525a[_0x443e('0x28')];}_0x4dfa7b[_0x443e('0x19')](_0x195bbb)[_0x443e('0x29')](_0x10525a);};}exports[_0x443e('0x2a')]=function(_0x30b6d0,_0x4d7882){var _0x53b196={},_0x9460a4={},_0x1d5ae3={'count':0x0,'rows':[]};var _0x498782=_['map'](db[_0x443e('0x2b')][_0x443e('0x2c')],function(_0x352ce2){return{'name':_0x352ce2[_0x443e('0x2d')],'type':_0x352ce2[_0x443e('0x2e')][_0x443e('0x2f')]};});_0x9460a4[_0x443e('0x30')]=_[_0x443e('0x31')](_0x498782,_0x443e('0x28'));_0x9460a4[_0x443e('0x32')]=_[_0x443e('0x33')](_0x30b6d0[_0x443e('0x32')]);_0x9460a4[_0x443e('0x34')]=_['intersection'](_0x9460a4[_0x443e('0x30')],_0x9460a4[_0x443e('0x32')]);_0x53b196[_0x443e('0x35')]=_[_0x443e('0x36')](_0x9460a4['model'],qs['fields'](_0x30b6d0[_0x443e('0x32')][_0x443e('0x37')]));_0x53b196[_0x443e('0x35')]=_0x53b196[_0x443e('0x35')]['length']?_0x53b196[_0x443e('0x35')]:_0x9460a4[_0x443e('0x30')];if(!_0x30b6d0[_0x443e('0x32')][_0x443e('0x38')](_0x443e('0x39'))){_0x53b196[_0x443e('0x1c')]=qs[_0x443e('0x1c')](_0x30b6d0[_0x443e('0x32')]['limit']);_0x53b196[_0x443e('0x1a')]=qs['offset'](_0x30b6d0[_0x443e('0x32')][_0x443e('0x1a')]);}_0x53b196[_0x443e('0x3a')]=qs[_0x443e('0x3b')](_0x30b6d0[_0x443e('0x32')]['sort']);_0x53b196[_0x443e('0x3c')]=qs[_0x443e('0x34')](_[_0x443e('0x3d')](_0x30b6d0[_0x443e('0x32')],_0x9460a4[_0x443e('0x34')]),_0x498782);if(_0x30b6d0[_0x443e('0x32')]['filter']){_0x53b196['where']=_[_0x443e('0x3e')](_0x53b196['where'],{'$or':_[_0x443e('0x31')](_0x498782,function(_0x31e8a3){if(_0x31e8a3[_0x443e('0x2e')]!==_0x443e('0x3f')){var _0x1d04c1={};_0x1d04c1[_0x31e8a3[_0x443e('0x28')]]={'$like':'%'+_0x30b6d0[_0x443e('0x32')][_0x443e('0x40')]+'%'};return _0x1d04c1;}})});}_0x53b196=_[_0x443e('0x3e')]({},_0x53b196,_0x30b6d0[_0x443e('0x41')]);var _0x115542={'where':_0x53b196[_0x443e('0x3c')]};return db[_0x443e('0x2b')]['count'](_0x115542)[_0x443e('0x42')](function(_0x1fef5){_0x1d5ae3[_0x443e('0x1d')]=_0x1fef5;if(_0x30b6d0[_0x443e('0x32')][_0x443e('0x43')]){_0x53b196[_0x443e('0x44')]=[{'all':!![]}];}return db[_0x443e('0x2b')][_0x443e('0x45')](_0x53b196);})['then'](function(_0x2e3bc6){_0x1d5ae3[_0x443e('0x46')]=_0x2e3bc6;return _0x1d5ae3;})[_0x443e('0x42')](respondWithFilteredResult(_0x4d7882,_0x53b196))['catch'](handleError(_0x4d7882,null));};exports[_0x443e('0x47')]=function(_0x298752,_0x287301){var _0x55aea6={'raw':!![],'where':{'id':_0x298752[_0x443e('0x48')]['id']}},_0x484b28={};_0x484b28[_0x443e('0x30')]=_[_0x443e('0x33')](db[_0x443e('0x2b')][_0x443e('0x2c')]);_0x484b28[_0x443e('0x32')]=_[_0x443e('0x33')](_0x298752[_0x443e('0x32')]);_0x484b28[_0x443e('0x34')]=_['intersection'](_0x484b28['model'],_0x484b28['query']);_0x55aea6[_0x443e('0x35')]=_[_0x443e('0x36')](_0x484b28[_0x443e('0x30')],qs[_0x443e('0x37')](_0x298752[_0x443e('0x32')][_0x443e('0x37')]));_0x55aea6[_0x443e('0x35')]=_0x55aea6['attributes'][_0x443e('0x49')]?_0x55aea6[_0x443e('0x35')]:_0x484b28[_0x443e('0x30')];if(_0x298752['query'][_0x443e('0x43')]){_0x55aea6['include']=[{'all':!![]}];}_0x55aea6=_[_0x443e('0x3e')]({},_0x55aea6,_0x298752[_0x443e('0x41')]);return db[_0x443e('0x2b')][_0x443e('0x4a')](_0x55aea6)['then'](handleEntityNotFound(_0x287301,null))[_0x443e('0x42')](respondWithResult(_0x287301,null))[_0x443e('0x4b')](handleError(_0x287301,null));};exports[_0x443e('0x4c')]=function(_0x11959b,_0x41a0ca){return db['ZendeskField'][_0x443e('0x4c')](_0x11959b['body'],{})[_0x443e('0x42')](respondWithResult(_0x41a0ca,0xc9))['catch'](handleError(_0x41a0ca,null));};exports['update']=function(_0x412c8a,_0x12fce7){if(_0x412c8a['body']['id']){delete _0x412c8a[_0x443e('0x4d')]['id'];}return db[_0x443e('0x2b')][_0x443e('0x4a')]({'where':{'id':_0x412c8a[_0x443e('0x48')]['id']}})[_0x443e('0x42')](handleEntityNotFound(_0x12fce7,null))['then'](saveUpdates(_0x412c8a['body'],null))['then'](respondWithResult(_0x12fce7,null))['catch'](handleError(_0x12fce7,null));};exports[_0x443e('0x24')]=function(_0x529952,_0x1818cc){return db['ZendeskField']['find']({'where':{'id':_0x529952[_0x443e('0x48')]['id']}})[_0x443e('0x42')](handleEntityNotFound(_0x1818cc,null))[_0x443e('0x42')](removeEntity(_0x1818cc,null))[_0x443e('0x4b')](handleError(_0x1818cc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 7cf823a..624d746 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 _0x07d8=['request-promise','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e6c3f,_0xd65ebf){var _0x3f408d=function(_0x584e77){while(--_0x584e77){_0x3e6c3f['push'](_0x3e6c3f['shift']());}};_0x3f408d(++_0xd65ebf);}(_0x07d8,0x126));var _0x807d=function(_0x35c1db,_0xd75c15){_0x35c1db=_0x35c1db-0x0;var _0x4173ff=_0x07d8[_0x35c1db];return _0x4173ff;};'use strict';var _=require(_0x807d('0x0'));var util=require(_0x807d('0x1'));var logger=require(_0x807d('0x2'))(_0x807d('0x3'));var moment=require(_0x807d('0x4'));var BPromise=require(_0x807d('0x5'));var rp=require(_0x807d('0x6'));var fs=require('fs');var path=require(_0x807d('0x7'));var rimraf=require('rimraf');var config=require(_0x807d('0x8'));var attributes=require(_0x807d('0x9'));module['exports']=function(_0x330f6c,_0x13badd){return _0x330f6c[_0x807d('0xa')](_0x807d('0xb'),attributes,{'tableName':_0x807d('0xc'),'paranoid':![],'indexes':[{'name':_0x807d('0xd'),'fields':['idField',_0x807d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb076=['path','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x29966f,_0x1e1659){var _0x285809=function(_0x42da13){while(--_0x42da13){_0x29966f['push'](_0x29966f['shift']());}};_0x285809(++_0x1e1659);}(_0xb076,0x9f));var _0x6b07=function(_0x51af96,_0x42104c){_0x51af96=_0x51af96-0x0;var _0x2bb16b=_0xb076[_0x51af96];return _0x2bb16b;};'use strict';var _=require('lodash');var util=require(_0x6b07('0x0'));var logger=require(_0x6b07('0x1'))(_0x6b07('0x2'));var moment=require(_0x6b07('0x3'));var BPromise=require(_0x6b07('0x4'));var rp=require(_0x6b07('0x5'));var fs=require('fs');var path=require(_0x6b07('0x6'));var rimraf=require('rimraf');var config=require(_0x6b07('0x7'));var attributes=require(_0x6b07('0x8'));module[_0x6b07('0x9')]=function(_0x429816,_0x5a507a){return _0x429816[_0x6b07('0xa')](_0x6b07('0xb'),attributes,{'tableName':_0x6b07('0xc'),'paranoid':![],'indexes':[{'name':_0x6b07('0xd'),'fields':['idField',_0x6b07('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 6bc0e64..74e9207 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 _0x7a46=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x596c59,_0x517b1d){var _0x1a5185=function(_0x5b5f4d){while(--_0x5b5f4d){_0x596c59['push'](_0x596c59['shift']());}};_0x1a5185(++_0x517b1d);}(_0x7a46,0x139));var _0x67a4=function(_0x2a11d8,_0x4ce142){_0x2a11d8=_0x2a11d8-0x0;var _0x8c72e9=_0x7a46[_0x2a11d8];return _0x8c72e9;};'use strict';var _=require(_0x67a4('0x0'));var util=require('util');var moment=require(_0x67a4('0x1'));var BPromise=require(_0x67a4('0x2'));var rs=require(_0x67a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67a4('0x4'))['db'];var utils=require(_0x67a4('0x5'));var logger=require('../../config/logger')(_0x67a4('0x6'));var config=require('../../config/environment');var jayson=require(_0x67a4('0x7'));var client=jayson[_0x67a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xba71a5,_0x402be0,_0x4ca4cb){return new BPromise(function(_0x18da80,_0x13de1a){return client[_0x67a4('0x9')](_0xba71a5,_0x4ca4cb)['then'](function(_0xa84a13){logger['info'](_0x67a4('0xa'),_0x402be0,_0x67a4('0xb'));logger[_0x67a4('0xc')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x402be0,_0x67a4('0xb'),JSON[_0x67a4('0xd')](_0xa84a13));if(_0xa84a13['error']){if(_0xa84a13[_0x67a4('0xe')][_0x67a4('0xf')]===0x1f4){logger[_0x67a4('0xe')](_0x67a4('0xa'),_0x402be0,_0xa84a13['error'][_0x67a4('0x10')]);return _0x13de1a(_0xa84a13[_0x67a4('0xe')][_0x67a4('0x10')]);}logger[_0x67a4('0xe')](_0x67a4('0xa'),_0x402be0,_0xa84a13['error'][_0x67a4('0x10')]);return _0x18da80(_0xa84a13['error'][_0x67a4('0x10')]);}else{logger[_0x67a4('0x11')](_0x67a4('0xa'),_0x402be0,_0x67a4('0xb'));_0x18da80(_0xa84a13['result'][_0x67a4('0x10')]);}})[_0x67a4('0x12')](function(_0x1fb67f){logger[_0x67a4('0xe')]('ZendeskField,\x20%s,\x20%s',_0x402be0,_0x1fb67f);_0x13de1a(_0x1fb67f);});});} \ No newline at end of file +var _0x182d=['request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x182d,0x16a));var _0xd182=function(_0x57aad6,_0x4f69fc){_0x57aad6=_0x57aad6-0x0;var _0x54f82=_0x182d[_0x57aad6];return _0x54f82;};'use strict';var _=require(_0xd182('0x0'));var util=require(_0xd182('0x1'));var moment=require(_0xd182('0x2'));var BPromise=require('bluebird');var rs=require(_0xd182('0x3'));var fs=require('fs');var Redis=require(_0xd182('0x4'));var db=require(_0xd182('0x5'))['db'];var utils=require(_0xd182('0x6'));var logger=require('../../config/logger')(_0xd182('0x7'));var config=require(_0xd182('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd182('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f6a6e,_0x573529,_0x25537b){return new BPromise(function(_0x4100c2,_0x2c4118){return client[_0xd182('0xa')](_0x4f6a6e,_0x25537b)[_0xd182('0xb')](function(_0x2c8da3){logger[_0xd182('0xc')](_0xd182('0xd'),_0x573529,'request\x20sent');logger[_0xd182('0xe')](_0xd182('0xf'),_0x573529,_0xd182('0x10'),JSON['stringify'](_0x2c8da3));if(_0x2c8da3[_0xd182('0x11')]){if(_0x2c8da3[_0xd182('0x11')]['code']===0x1f4){logger['error'](_0xd182('0xd'),_0x573529,_0x2c8da3['error'][_0xd182('0x12')]);return _0x2c4118(_0x2c8da3[_0xd182('0x11')][_0xd182('0x12')]);}logger[_0xd182('0x11')](_0xd182('0xd'),_0x573529,_0x2c8da3['error'][_0xd182('0x12')]);return _0x4100c2(_0x2c8da3[_0xd182('0x11')][_0xd182('0x12')]);}else{logger[_0xd182('0xc')](_0xd182('0xd'),_0x573529,_0xd182('0x10'));_0x4100c2(_0x2c8da3[_0xd182('0x13')]['message']);}})[_0xd182('0x14')](function(_0xaebc9e){logger[_0xd182('0x11')]('ZendeskField,\x20%s,\x20%s',_0x573529,_0xaebc9e);_0x2c4118(_0xaebc9e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 70229ae..3ee0a3c 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 _0x9804=['isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','update','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get'];(function(_0x205725,_0x582a1b){var _0x4c86ed=function(_0x17abf8){while(--_0x17abf8){_0x205725['push'](_0x205725['shift']());}};_0x4c86ed(++_0x582a1b);}(_0x9804,0x1b9));var _0x4980=function(_0x4c60ca,_0x34c331){_0x4c60ca=_0x4c60ca-0x0;var _0x1087fd=_0x9804[_0x4c60ca];return _0x1087fd;};'use strict';var multer=require('multer');var util=require(_0x4980('0x0'));var path=require(_0x4980('0x1'));var timeout=require('connect-timeout');var express=require(_0x4980('0x2'));var router=express[_0x4980('0x3')]();var fs_extra=require(_0x4980('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4980('0x5'));var config=require(_0x4980('0x6'));var controller=require(_0x4980('0x7'));router[_0x4980('0x8')]('/',auth[_0x4980('0x9')](),controller[_0x4980('0xa')]);router['get'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller['show']);router['get'](_0x4980('0xc'),auth[_0x4980('0x9')](),controller[_0x4980('0xd')]);router['get'](_0x4980('0xe'),auth[_0x4980('0x9')](),controller[_0x4980('0xf')]);router['post']('/',auth[_0x4980('0x9')](),controller['create']);router['post'](_0x4980('0xc'),auth[_0x4980('0x9')](),controller[_0x4980('0x10')]);router['put'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller[_0x4980('0x11')]);router['delete'](_0x4980('0xb'),auth[_0x4980('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf24f=['multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/configurations','getConfigurations','getFields','post','create','/:id','update','delete','destroy'];(function(_0x210af6,_0x56eb27){var _0x44a41c=function(_0x5d1f36){while(--_0x5d1f36){_0x210af6['push'](_0x210af6['shift']());}};_0x44a41c(++_0x56eb27);}(_0xf24f,0xa2));var _0xff24=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xf24f[_0x350258];return _0x3714b3;};'use strict';var multer=require(_0xff24('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff24('0x1')]();var fs_extra=require(_0xff24('0x2'));var auth=require(_0xff24('0x3'));var interaction=require(_0xff24('0x4'));var config=require(_0xff24('0x5'));var controller=require('./intZohoAccount.controller');router[_0xff24('0x6')]('/',auth[_0xff24('0x7')](),controller[_0xff24('0x8')]);router[_0xff24('0x6')]('/:id',auth[_0xff24('0x7')](),controller['show']);router[_0xff24('0x6')](_0xff24('0x9'),auth[_0xff24('0x7')](),controller[_0xff24('0xa')]);router[_0xff24('0x6')]('/:id/fields',auth[_0xff24('0x7')](),controller[_0xff24('0xb')]);router[_0xff24('0xc')]('/',auth[_0xff24('0x7')](),controller[_0xff24('0xd')]);router[_0xff24('0xc')](_0xff24('0x9'),auth[_0xff24('0x7')](),controller['addConfiguration']);router['put'](_0xff24('0xe'),auth[_0xff24('0x7')](),controller[_0xff24('0xf')]);router[_0xff24('0x10')](_0xff24('0xe'),auth[_0xff24('0x7')](),controller[_0xff24('0x11')]);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 b578e1d..b6d7f43 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 _0x99e9=['exports','STRING'];(function(_0x220774,_0x3926c3){var _0x51c540=function(_0x27fdea){while(--_0x27fdea){_0x220774['push'](_0x220774['shift']());}};_0x51c540(++_0x3926c3);}(_0x99e9,0xb4));var _0x999e=function(_0x44044a,_0x3a0097){_0x44044a=_0x44044a-0x0;var _0x43bb6e=_0x99e9[_0x44044a];return _0x43bb6e;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file +var _0x2750=['STRING','sequelize'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x2750,0x13b));var _0x0275=function(_0x5d973d,_0x47800a){_0x5d973d=_0x5d973d-0x0;var _0x7a06eb=_0x2750[_0x5d973d];return _0x7a06eb;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'name':{'type':Sequelize[_0x0275('0x1')]},'description':{'type':Sequelize[_0x0275('0x1')]},'host':{'type':Sequelize[_0x0275('0x1')]},'zone':{'type':Sequelize[_0x0275('0x1')]},'clientId':{'type':Sequelize[_0x0275('0x1')]},'clientSecret':{'type':Sequelize[_0x0275('0x1')]},'serverUrl':{'type':Sequelize[_0x0275('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x0275('0x1')]},'refreshToken':{'type':Sequelize[_0x0275('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index e1d9364..23ff7fb 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 _0xd27c=['clientSecret','refresh_token','access_token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Zoho-oauthtoken\x20','response','message','Owner','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','test','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','rows','keys','find','catch','create','update','body','params','getConfigurations','ZohoConfiguration','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','clientId'];(function(_0x22a6bd,_0x32b8bf){var _0x484ca8=function(_0x1854b6){while(--_0x1854b6){_0x22a6bd['push'](_0x22a6bd['shift']());}};_0x484ca8(++_0x32b8bf);}(_0xd27c,0xa7));var _0xcd27=function(_0x187790,_0x2a083b){_0x187790=_0x187790-0x0;var _0x472705=_0xd27c[_0x187790];return _0x472705;};'use strict';var emlformat=require(_0xcd27('0x0'));var rimraf=require(_0xcd27('0x1'));var zipdir=require(_0xcd27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd27('0x3'));var moment=require(_0xcd27('0x4'));var BPromise=require(_0xcd27('0x5'));var Mustache=require('mustache');var util=require(_0xcd27('0x6'));var path=require(_0xcd27('0x7'));var sox=require('sox');var csv=require(_0xcd27('0x8'));var ejs=require(_0xcd27('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcd27('0xa'));var squel=require(_0xcd27('0xb'));var crypto=require('crypto');var jsforce=require(_0xcd27('0xc'));var deskjs=require(_0xcd27('0xd'));var toCsv=require(_0xcd27('0x8'));var querystring=require(_0xcd27('0xe'));var Papa=require('papaparse');var Redis=require(_0xcd27('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcd27('0x10'));var as=require(_0xcd27('0x11'));var hardwareService=require(_0xcd27('0x12'));var logger=require(_0xcd27('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xcd27('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xcd27('0x15'));function respondWithStatusCode(_0x5a0620,_0x15b58e){_0x15b58e=_0x15b58e||0xcc;return function(_0x44d1a5){if(_0x44d1a5){return _0x5a0620[_0xcd27('0x16')](_0x15b58e);}return _0x5a0620[_0xcd27('0x17')](_0x15b58e)['end']();};}function respondWithResult(_0x51c67f,_0x2a8151){_0x2a8151=_0x2a8151||0xc8;return function(_0x2fa756){if(_0x2fa756){return _0x51c67f[_0xcd27('0x17')](_0x2a8151)[_0xcd27('0x18')](_0x2fa756);}};}function respondWithFilteredResult(_0x18c771,_0x4b2745){return function(_0x184046){if(_0x184046){var _0xe9faf1=typeof _0x4b2745[_0xcd27('0x19')]===_0xcd27('0x1a')&&typeof _0x4b2745[_0xcd27('0x1b')]===_0xcd27('0x1a');var _0xad2c88=_0x184046[_0xcd27('0x1c')];var _0x5f0640=_0xe9faf1?0x0:_0x4b2745[_0xcd27('0x19')];var _0x91316f=_0xe9faf1?_0x184046['count']:_0x4b2745[_0xcd27('0x19')]+_0x4b2745[_0xcd27('0x1b')];var _0x25ee5a;if(_0x91316f>=_0xad2c88){_0x91316f=_0xad2c88;_0x25ee5a=0xc8;}else{_0x25ee5a=0xce;}_0x18c771[_0xcd27('0x17')](_0x25ee5a);return _0x18c771[_0xcd27('0x1d')](_0xcd27('0x1e'),_0x5f0640+'-'+_0x91316f+'/'+_0xad2c88)[_0xcd27('0x18')](_0x184046);}return null;};}function patchUpdates(_0x3573f1){return function(_0x36a454){try{jsonpatch[_0xcd27('0x1f')](_0x36a454,_0x3573f1,!![]);}catch(_0x4a191f){return BPromise[_0xcd27('0x20')](_0x4a191f);}return _0x36a454[_0xcd27('0x21')]();};}function saveUpdates(_0x20f389,_0x2af751){return function(_0x10921b){if(_0x10921b){return _0x10921b['update'](_0x20f389)[_0xcd27('0x22')](function(_0x3e919e){return _0x3e919e;});}return null;};}function removeEntity(_0x18ce60,_0x13ea1c){return function(_0x323581){if(_0x323581){return _0x323581[_0xcd27('0x23')]()[_0xcd27('0x22')](function(){_0x18ce60[_0xcd27('0x17')](0xcc)[_0xcd27('0x24')]();});}};}function handleEntityNotFound(_0x53bb0b,_0xae4221){return function(_0x490be6){if(!_0x490be6){_0x53bb0b[_0xcd27('0x16')](0x194);}return _0x490be6;};}function handleError(_0x5526de,_0x38075d){_0x38075d=_0x38075d||0x1f4;return function(_0x1874a1){logger[_0xcd27('0x25')](_0x1874a1[_0xcd27('0x26')]);if(_0x1874a1[_0xcd27('0x27')]){delete _0x1874a1['name'];}_0x5526de['status'](_0x38075d)[_0xcd27('0x28')](_0x1874a1);};}exports[_0xcd27('0x29')]=function(_0x11212b,_0x4a50f6){var _0x3d7e3={},_0x54fd28={},_0x359f6f={'count':0x0,'rows':[]};var _0x2fbc59=_[_0xcd27('0x2a')](db['ZohoAccount'][_0xcd27('0x2b')],function(_0xe76a7f){return{'name':_0xe76a7f[_0xcd27('0x2c')],'type':_0xe76a7f[_0xcd27('0x2d')][_0xcd27('0x2e')]};});_0x54fd28[_0xcd27('0x2f')]=_[_0xcd27('0x2a')](_0x2fbc59,_0xcd27('0x27'));_0x54fd28['query']=_['keys'](_0x11212b[_0xcd27('0x30')]);_0x54fd28[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x54fd28[_0xcd27('0x2f')],_0x54fd28[_0xcd27('0x30')]);_0x3d7e3['attributes']=_['intersection'](_0x54fd28[_0xcd27('0x2f')],qs[_0xcd27('0x33')](_0x11212b['query']['fields']));_0x3d7e3[_0xcd27('0x34')]=_0x3d7e3[_0xcd27('0x34')][_0xcd27('0x35')]?_0x3d7e3[_0xcd27('0x34')]:_0x54fd28[_0xcd27('0x2f')];if(!_0x11212b[_0xcd27('0x30')][_0xcd27('0x36')](_0xcd27('0x37'))){_0x3d7e3[_0xcd27('0x1b')]=qs[_0xcd27('0x1b')](_0x11212b['query'][_0xcd27('0x1b')]);_0x3d7e3[_0xcd27('0x19')]=qs[_0xcd27('0x19')](_0x11212b[_0xcd27('0x30')]['offset']);}_0x3d7e3['order']=qs[_0xcd27('0x38')](_0x11212b[_0xcd27('0x30')][_0xcd27('0x38')]);_0x3d7e3[_0xcd27('0x39')]=qs[_0xcd27('0x31')](_[_0xcd27('0x3a')](_0x11212b[_0xcd27('0x30')],_0x54fd28['filters']),_0x2fbc59);if(_0x11212b['query'][_0xcd27('0x3b')]){_0x3d7e3['where']=_[_0xcd27('0x3c')](_0x3d7e3[_0xcd27('0x39')],{'$or':_[_0xcd27('0x2a')](_0x2fbc59,function(_0x152a9e){if(_0x152a9e['type']!==_0xcd27('0x3d')){var _0x24d3a8={};_0x24d3a8[_0x152a9e[_0xcd27('0x27')]]={'$like':'%'+_0x11212b[_0xcd27('0x30')][_0xcd27('0x3b')]+'%'};return _0x24d3a8;}})});}_0x3d7e3=_[_0xcd27('0x3c')]({},_0x3d7e3,_0x11212b[_0xcd27('0x3e')]);var _0x1d7c58={'where':_0x3d7e3[_0xcd27('0x39')]};return db[_0xcd27('0x3f')][_0xcd27('0x1c')](_0x1d7c58)[_0xcd27('0x22')](function(_0x20a4e6){_0x359f6f['count']=_0x20a4e6;if(_0x11212b[_0xcd27('0x30')][_0xcd27('0x40')]){_0x3d7e3[_0xcd27('0x41')]=[{'all':!![]}];}return db[_0xcd27('0x3f')]['findAll'](_0x3d7e3);})[_0xcd27('0x22')](function(_0xcee780){_0x359f6f[_0xcd27('0x42')]=_0xcee780;return _0x359f6f;})['then'](respondWithFilteredResult(_0x4a50f6,_0x3d7e3))['catch'](handleError(_0x4a50f6,null));};exports['show']=function(_0x20a5c5,_0x40db5b){var _0x80403c={'raw':![],'where':{'id':_0x20a5c5['params']['id']}},_0x102962={};_0x102962['model']=_[_0xcd27('0x43')](db[_0xcd27('0x3f')]['rawAttributes']);_0x102962[_0xcd27('0x30')]=_[_0xcd27('0x43')](_0x20a5c5['query']);_0x102962[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x102962[_0xcd27('0x2f')],_0x102962['query']);_0x80403c['attributes']=_['intersection'](_0x102962[_0xcd27('0x2f')],qs['fields'](_0x20a5c5['query'][_0xcd27('0x33')]));_0x80403c[_0xcd27('0x34')]=_0x80403c[_0xcd27('0x34')]['length']?_0x80403c['attributes']:_0x102962[_0xcd27('0x2f')];if(_0x20a5c5[_0xcd27('0x30')][_0xcd27('0x40')]){_0x80403c[_0xcd27('0x41')]=[{'all':!![]}];}_0x80403c=_[_0xcd27('0x3c')]({},_0x80403c,_0x20a5c5[_0xcd27('0x3e')]);return db[_0xcd27('0x3f')][_0xcd27('0x44')](_0x80403c)['then'](handleEntityNotFound(_0x40db5b,null))[_0xcd27('0x22')](respondWithResult(_0x40db5b,null))[_0xcd27('0x45')](handleError(_0x40db5b,null));};exports[_0xcd27('0x46')]=function(_0x43972c,_0x25a83e){return db[_0xcd27('0x3f')][_0xcd27('0x46')](_0x43972c['body'],{})[_0xcd27('0x22')](respondWithResult(_0x25a83e,0xc9))[_0xcd27('0x45')](handleError(_0x25a83e,null));};exports[_0xcd27('0x47')]=function(_0x27b165,_0x2316ac){if(_0x27b165[_0xcd27('0x48')]['id']){delete _0x27b165[_0xcd27('0x48')]['id'];}return db[_0xcd27('0x3f')][_0xcd27('0x44')]({'where':{'id':_0x27b165['params']['id']}})['then'](handleEntityNotFound(_0x2316ac,null))[_0xcd27('0x22')](saveUpdates(_0x27b165['body'],null))['then'](respondWithResult(_0x2316ac,null))['catch'](handleError(_0x2316ac,null));};exports[_0xcd27('0x23')]=function(_0x34c777,_0xa55623){return db[_0xcd27('0x3f')][_0xcd27('0x44')]({'where':{'id':_0x34c777[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0xa55623,null))[_0xcd27('0x22')](removeEntity(_0xa55623,null))['catch'](handleError(_0xa55623,null));};exports[_0xcd27('0x4a')]=function(_0x425f5e,_0x5c031e,_0x12fc36){var _0x151e99={};var _0x37d615={};var _0x135019;var _0x6edb34;return db['ZohoAccount']['findOne']({'where':{'id':_0x425f5e[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0x5c031e,null))[_0xcd27('0x22')](function(_0x3cf05f){if(_0x3cf05f){_0x135019=_0x3cf05f;_0x37d615[_0xcd27('0x2f')]=_[_0xcd27('0x43')](db[_0xcd27('0x4b')][_0xcd27('0x2b')]);_0x37d615[_0xcd27('0x30')]=_[_0xcd27('0x43')](_0x425f5e[_0xcd27('0x30')]);_0x37d615[_0xcd27('0x31')]=_[_0xcd27('0x32')](_0x37d615[_0xcd27('0x2f')],_0x37d615['query']);_0x151e99[_0xcd27('0x34')]=_[_0xcd27('0x32')](_0x37d615[_0xcd27('0x2f')],qs[_0xcd27('0x33')](_0x425f5e['query'][_0xcd27('0x33')]));_0x151e99[_0xcd27('0x34')]=_0x151e99[_0xcd27('0x34')][_0xcd27('0x35')]?_0x151e99[_0xcd27('0x34')]:_0x37d615[_0xcd27('0x2f')];_0x151e99[_0xcd27('0x4c')]=qs[_0xcd27('0x38')](_0x425f5e[_0xcd27('0x30')]['sort']);_0x151e99[_0xcd27('0x39')]=qs[_0xcd27('0x31')](_[_0xcd27('0x3a')](_0x425f5e[_0xcd27('0x30')],_0x37d615[_0xcd27('0x31')]));if(_0x425f5e[_0xcd27('0x30')][_0xcd27('0x3b')]){_0x151e99[_0xcd27('0x39')]=_[_0xcd27('0x3c')](_0x151e99[_0xcd27('0x39')],{'$or':_[_0xcd27('0x2a')](_0x151e99[_0xcd27('0x34')],function(_0x5acee0){var _0x3ad7cd={};_0x3ad7cd[_0x5acee0]={'$like':'%'+_0x425f5e['query']['filter']+'%'};return _0x3ad7cd;})});}_0x151e99=_[_0xcd27('0x3c')]({},_0x151e99,_0x425f5e[_0xcd27('0x3e')]);return _0x135019[_0xcd27('0x4a')](_0x151e99);}})[_0xcd27('0x22')](function(_0x470262){if(_0x470262){_0x6edb34=_0x470262[_0xcd27('0x35')];if(!_0x425f5e[_0xcd27('0x30')]['hasOwnProperty'](_0xcd27('0x37'))){_0x151e99['limit']=qs[_0xcd27('0x1b')](_0x425f5e[_0xcd27('0x30')][_0xcd27('0x1b')]);_0x151e99[_0xcd27('0x19')]=qs['offset'](_0x425f5e[_0xcd27('0x30')][_0xcd27('0x19')]);}return _0x135019[_0xcd27('0x4a')](_0x151e99);}})[_0xcd27('0x22')](function(_0x32279d){if(_0x32279d){return _0x32279d?{'count':_0x6edb34,'rows':_0x32279d}:null;}})[_0xcd27('0x22')](respondWithResult(_0x5c031e,null))[_0xcd27('0x45')](handleError(_0x5c031e,null));};exports[_0xcd27('0x4d')]=function(_0x5e8622,_0x235c88,_0x4c30c9){if(_0x5e8622[_0xcd27('0x48')]['id']){delete _0x5e8622[_0xcd27('0x48')]['id'];}return db[_0xcd27('0x3f')][_0xcd27('0x4e')]({'where':{'id':_0x5e8622[_0xcd27('0x49')]['id']}})[_0xcd27('0x22')](handleEntityNotFound(_0x235c88,null))['then'](function(_0x150b3d){if(_0x150b3d){_0x5e8622[_0xcd27('0x48')][_0xcd27('0x4f')]=_0x150b3d['id'];_0x5e8622[_0xcd27('0x48')][_0xcd27('0x50')]=integrations[_0xcd27('0x51')](_0x5e8622[_0xcd27('0x48')][_0xcd27('0x52')],_0x5e8622[_0xcd27('0x48')][_0xcd27('0x2d')]);_0x5e8622[_0xcd27('0x48')]['Descriptions']=integrations[_0xcd27('0x53')](_0x5e8622[_0xcd27('0x48')][_0xcd27('0x52')],_0x5e8622[_0xcd27('0x48')]['type']);return db['ZohoConfiguration'][_0xcd27('0x46')](_0x5e8622[_0xcd27('0x48')],{'include':[{'model':db[_0xcd27('0x54')],'as':'Subjects'},{'model':db[_0xcd27('0x54')],'as':_0xcd27('0x55')}]});}return null;})[_0xcd27('0x22')](respondWithResult(_0x235c88,null))[_0xcd27('0x45')](handleError(_0x235c88,null));};function getAccessToken(_0x5a1269){return new Promise(function(_0x18bfc9,_0x49a043){var _0x23cdf1;switch(_0x5a1269[_0xcd27('0x56')]){case'US':_0x23cdf1=_0xcd27('0x57');break;case'AU':_0x23cdf1=_0xcd27('0x58');break;case'EU':_0x23cdf1=_0xcd27('0x59');break;case'IN':_0x23cdf1='https://accounts.zoho.in';break;case'CN':_0x23cdf1=_0xcd27('0x5a');break;default:_0x23cdf1=_0xcd27('0x59');break;}var _0x216620={'method':'POST','uri':_0x23cdf1+_0xcd27('0x5b'),'qs':{'refresh_token':_0x5a1269['refreshToken'],'client_id':_0x5a1269[_0xcd27('0x5c')],'client_secret':_0x5a1269[_0xcd27('0x5d')],'grant_type':_0xcd27('0x5e')},'json':!![]};return rp(_0x216620)['then'](function(_0x393317){if(_0x393317['access_token']){_0x18bfc9(_0x393317[_0xcd27('0x5f')]);}else{_0x49a043('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xcd27('0x45')](function(_0x401d9b){_0x49a043(_0x401d9b);});});}exports['getFields']=function(_0x22d7d6,_0x8a540a,_0x2c090b){var _0x1d9327,_0xc0075,_0x17f1da,_0x253fb2,_0x369076;return db['ZohoAccount'][_0xcd27('0x4e')]({'where':{'id':_0x22d7d6['params']['id']},'attributes':['id',_0xcd27('0x60'),'zone',_0xcd27('0x5c'),_0xcd27('0x5d'),_0xcd27('0x61'),_0xcd27('0x62'),_0xcd27('0x63')]})[_0xcd27('0x22')](handleEntityNotFound(_0x8a540a,null))[_0xcd27('0x22')](function(_0x460928){_0x369076=_0x460928;_0x1d9327=_0x369076[_0xcd27('0x60')];_0xc0075=_0x1d9327===_0xcd27('0x64')?'eu':_0xcd27('0x65');_0x17f1da=_0x369076[_0xcd27('0x61')];var _0x1a3099=_0x17f1da[_0xcd27('0x66')](-0x1);if(_0x1a3099==='/'||_0x1a3099==='\x5c'||_0x1a3099===':'){_0x17f1da=_0x17f1da['substring'](0x0,_0x17f1da[_0xcd27('0x67')](_0x1a3099));}if(!_0x369076[_0xcd27('0x63')]){throw new Error(_0xcd27('0x68'));}return getAccessToken(_0x369076);})[_0xcd27('0x22')](function(_0x16efe3){if(_0x16efe3){return rp({'method':_0xcd27('0x69'),'uri':util[_0xcd27('0x6a')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xc0075),'qs':{'module':'Calls'},'headers':{'Authorization':_0xcd27('0x6b')+_0x16efe3},'json':!![]});}})[_0xcd27('0x22')](function(_0x3d84a8){if(_0x3d84a8){if(_0x3d84a8[_0xcd27('0x6c')]&&_0x3d84a8[_0xcd27('0x6c')]['error']){throw new Error(_0x3d84a8[_0xcd27('0x6c')]['error'][_0xcd27('0x6d')]);}var _0x11196d=[];var _0x239e55=[];var _0x41e31b=[_0xcd27('0x6e'),'Subject',_0xcd27('0x6f'),'WhoId',_0xcd27('0x70'),_0xcd27('0x71'),_0xcd27('0x72'),_0xcd27('0x73')];_0x239e55=_[_0xcd27('0x74')](_0x3d84a8[_0xcd27('0x33')],function(_0x334d82){return _0x41e31b[_0xcd27('0x75')](_0x334d82[_0xcd27('0x76')]);});for(var _0x413601=0x0;_0x413601<_0x239e55[_0xcd27('0x35')];_0x413601++){if(_0x239e55[_0x413601][_0xcd27('0x77')]===![]){_0x11196d[_0xcd27('0x78')]({'id':_0x239e55[_0x413601]['id'],'name':_0x239e55[_0x413601][_0xcd27('0x79')],'custom':_0x239e55[_0x413601][_0xcd27('0x7a')],'options':_0x239e55[_0x413601][_0xcd27('0x7b')]==='picklist'&&_0x239e55[_0x413601][_0xcd27('0x7c')][_0xcd27('0x35')]>-0x1?_[_0xcd27('0x2a')](_0x239e55[_0x413601][_0xcd27('0x7c')],function(_0x328718){return{'name':_0x328718,'value':_0x328718};}):[]});}}return{'count':_0x11196d['length'],'rows':_0x11196d};}else{return{'count':0x0,'rows':[]};}})[_0xcd27('0x22')](respondWithResult(_0x8a540a,null))[_0xcd27('0x45')](function(_0x41ba68){var _0x57ad9d=_0x22d7d6['query'][_0xcd27('0x7d')]?0x1f4:_0x41ba68['statusCode']||0x1f4;logger[_0xcd27('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xcd27('0x7e'),_0x57ad9d,JSON[_0xcd27('0x7f')](_0x41ba68));delete _0x41ba68[_0xcd27('0x27')];if(_0x57ad9d===0x191){_0x57ad9d=0x190;}_0x8a540a[_0xcd27('0x17')](_0x57ad9d)['send'](_0x22d7d6[_0xcd27('0x30')][_0xcd27('0x7d')]?{'message':_0xcd27('0x80'),'statusCode':_0x41ba68[_0xcd27('0x81')]}:_0x41ba68);});}; \ No newline at end of file +var _0xd6d2=['com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','show','params','keys','length','options','catch','create','body','update','find','getConfigurations','findOne','ZohoConfiguration','addConfiguration','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','refreshToken'];(function(_0x100916,_0x25270d){var _0xa31589=function(_0x2e5f3f){while(--_0x2e5f3f){_0x100916['push'](_0x100916['shift']());}};_0xa31589(++_0x25270d);}(_0xd6d2,0x11d));var _0x2d6d=function(_0x5deccf,_0x39995d){_0x5deccf=_0x5deccf-0x0;var _0x4fcb15=_0xd6d2[_0x5deccf];return _0x4fcb15;};'use strict';var emlformat=require(_0x2d6d('0x0'));var rimraf=require(_0x2d6d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2d6d('0x2'));var rp=require('request-promise');var moment=require(_0x2d6d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2d6d('0x4'));var util=require('util');var path=require(_0x2d6d('0x5'));var sox=require(_0x2d6d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d6d('0x7'));var squel=require('squel');var crypto=require(_0x2d6d('0x8'));var jsforce=require(_0x2d6d('0x9'));var deskjs=require(_0x2d6d('0xa'));var toCsv=require(_0x2d6d('0xb'));var querystring=require(_0x2d6d('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2d6d('0xd'));var qs=require(_0x2d6d('0xe'));var as=require(_0x2d6d('0xf'));var hardwareService=require(_0x2d6d('0x10'));var logger=require(_0x2d6d('0x11'))(_0x2d6d('0x12'));var utils=require(_0x2d6d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d6d('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41d4cc,_0x1165b9){_0x1165b9=_0x1165b9||0xcc;return function(_0x450bf8){if(_0x450bf8){return _0x41d4cc['sendStatus'](_0x1165b9);}return _0x41d4cc[_0x2d6d('0x15')](_0x1165b9)[_0x2d6d('0x16')]();};}function respondWithResult(_0x348e36,_0x576cf0){_0x576cf0=_0x576cf0||0xc8;return function(_0x3f1221){if(_0x3f1221){return _0x348e36['status'](_0x576cf0)[_0x2d6d('0x17')](_0x3f1221);}};}function respondWithFilteredResult(_0x51dbb1,_0x4744da){return function(_0x3da339){if(_0x3da339){var _0x85548b=typeof _0x4744da['offset']===_0x2d6d('0x18')&&typeof _0x4744da[_0x2d6d('0x19')]===_0x2d6d('0x18');var _0x545199=_0x3da339['count'];var _0x490411=_0x85548b?0x0:_0x4744da[_0x2d6d('0x1a')];var _0x339394=_0x85548b?_0x3da339[_0x2d6d('0x1b')]:_0x4744da[_0x2d6d('0x1a')]+_0x4744da['limit'];var _0x911859;if(_0x339394>=_0x545199){_0x339394=_0x545199;_0x911859=0xc8;}else{_0x911859=0xce;}_0x51dbb1[_0x2d6d('0x15')](_0x911859);return _0x51dbb1[_0x2d6d('0x1c')](_0x2d6d('0x1d'),_0x490411+'-'+_0x339394+'/'+_0x545199)[_0x2d6d('0x17')](_0x3da339);}return null;};}function patchUpdates(_0x5947d0){return function(_0x71a74f){try{jsonpatch[_0x2d6d('0x1e')](_0x71a74f,_0x5947d0,!![]);}catch(_0x542542){return BPromise[_0x2d6d('0x1f')](_0x542542);}return _0x71a74f[_0x2d6d('0x20')]();};}function saveUpdates(_0x439a95,_0x572cb9){return function(_0x273ea3){if(_0x273ea3){return _0x273ea3['update'](_0x439a95)[_0x2d6d('0x21')](function(_0x282892){return _0x282892;});}return null;};}function removeEntity(_0x250b4d,_0x3387af){return function(_0xae7bbf){if(_0xae7bbf){return _0xae7bbf[_0x2d6d('0x22')]()[_0x2d6d('0x21')](function(){_0x250b4d[_0x2d6d('0x15')](0xcc)[_0x2d6d('0x16')]();});}};}function handleEntityNotFound(_0x4c2ed9,_0x568476){return function(_0x490222){if(!_0x490222){_0x4c2ed9['sendStatus'](0x194);}return _0x490222;};}function handleError(_0x5ce23a,_0x39de4c){_0x39de4c=_0x39de4c||0x1f4;return function(_0x57aac5){logger['error'](_0x57aac5[_0x2d6d('0x23')]);if(_0x57aac5[_0x2d6d('0x24')]){delete _0x57aac5[_0x2d6d('0x24')];}_0x5ce23a['status'](_0x39de4c)[_0x2d6d('0x25')](_0x57aac5);};}exports[_0x2d6d('0x26')]=function(_0x4e5b61,_0x28543c){var _0xf11578={},_0x43c6fd={},_0x131722={'count':0x0,'rows':[]};var _0x348653=_[_0x2d6d('0x27')](db[_0x2d6d('0x28')][_0x2d6d('0x29')],function(_0x2022a4){return{'name':_0x2022a4['fieldName'],'type':_0x2022a4[_0x2d6d('0x2a')][_0x2d6d('0x2b')]};});_0x43c6fd[_0x2d6d('0x2c')]=_[_0x2d6d('0x27')](_0x348653,_0x2d6d('0x24'));_0x43c6fd[_0x2d6d('0x2d')]=_['keys'](_0x4e5b61[_0x2d6d('0x2d')]);_0x43c6fd[_0x2d6d('0x2e')]=_[_0x2d6d('0x2f')](_0x43c6fd[_0x2d6d('0x2c')],_0x43c6fd['query']);_0xf11578[_0x2d6d('0x30')]=_[_0x2d6d('0x2f')](_0x43c6fd['model'],qs['fields'](_0x4e5b61[_0x2d6d('0x2d')][_0x2d6d('0x31')]));_0xf11578[_0x2d6d('0x30')]=_0xf11578[_0x2d6d('0x30')]['length']?_0xf11578['attributes']:_0x43c6fd[_0x2d6d('0x2c')];if(!_0x4e5b61[_0x2d6d('0x2d')][_0x2d6d('0x32')](_0x2d6d('0x33'))){_0xf11578[_0x2d6d('0x19')]=qs[_0x2d6d('0x19')](_0x4e5b61[_0x2d6d('0x2d')][_0x2d6d('0x19')]);_0xf11578[_0x2d6d('0x1a')]=qs[_0x2d6d('0x1a')](_0x4e5b61[_0x2d6d('0x2d')]['offset']);}_0xf11578[_0x2d6d('0x34')]=qs[_0x2d6d('0x35')](_0x4e5b61[_0x2d6d('0x2d')]['sort']);_0xf11578[_0x2d6d('0x36')]=qs[_0x2d6d('0x2e')](_[_0x2d6d('0x37')](_0x4e5b61[_0x2d6d('0x2d')],_0x43c6fd['filters']),_0x348653);if(_0x4e5b61[_0x2d6d('0x2d')][_0x2d6d('0x38')]){_0xf11578[_0x2d6d('0x36')]=_[_0x2d6d('0x39')](_0xf11578['where'],{'$or':_['map'](_0x348653,function(_0x221946){if(_0x221946[_0x2d6d('0x2a')]!=='VIRTUAL'){var _0x850cbc={};_0x850cbc[_0x221946[_0x2d6d('0x24')]]={'$like':'%'+_0x4e5b61['query'][_0x2d6d('0x38')]+'%'};return _0x850cbc;}})});}_0xf11578=_[_0x2d6d('0x39')]({},_0xf11578,_0x4e5b61['options']);var _0x170626={'where':_0xf11578[_0x2d6d('0x36')]};return db[_0x2d6d('0x28')][_0x2d6d('0x1b')](_0x170626)[_0x2d6d('0x21')](function(_0x3e816d){_0x131722[_0x2d6d('0x1b')]=_0x3e816d;if(_0x4e5b61[_0x2d6d('0x2d')][_0x2d6d('0x3a')]){_0xf11578[_0x2d6d('0x3b')]=[{'all':!![]}];}return db[_0x2d6d('0x28')]['findAll'](_0xf11578);})[_0x2d6d('0x21')](function(_0x33a978){_0x131722[_0x2d6d('0x3c')]=_0x33a978;return _0x131722;})[_0x2d6d('0x21')](respondWithFilteredResult(_0x28543c,_0xf11578))['catch'](handleError(_0x28543c,null));};exports[_0x2d6d('0x3d')]=function(_0x288cc4,_0x458bf7){var _0x260e21={'raw':![],'where':{'id':_0x288cc4[_0x2d6d('0x3e')]['id']}},_0x31cddc={};_0x31cddc[_0x2d6d('0x2c')]=_[_0x2d6d('0x3f')](db['ZohoAccount'][_0x2d6d('0x29')]);_0x31cddc[_0x2d6d('0x2d')]=_[_0x2d6d('0x3f')](_0x288cc4['query']);_0x31cddc[_0x2d6d('0x2e')]=_[_0x2d6d('0x2f')](_0x31cddc['model'],_0x31cddc[_0x2d6d('0x2d')]);_0x260e21[_0x2d6d('0x30')]=_[_0x2d6d('0x2f')](_0x31cddc['model'],qs[_0x2d6d('0x31')](_0x288cc4[_0x2d6d('0x2d')][_0x2d6d('0x31')]));_0x260e21['attributes']=_0x260e21['attributes'][_0x2d6d('0x40')]?_0x260e21[_0x2d6d('0x30')]:_0x31cddc[_0x2d6d('0x2c')];if(_0x288cc4[_0x2d6d('0x2d')][_0x2d6d('0x3a')]){_0x260e21[_0x2d6d('0x3b')]=[{'all':!![]}];}_0x260e21=_[_0x2d6d('0x39')]({},_0x260e21,_0x288cc4[_0x2d6d('0x41')]);return db[_0x2d6d('0x28')]['find'](_0x260e21)[_0x2d6d('0x21')](handleEntityNotFound(_0x458bf7,null))[_0x2d6d('0x21')](respondWithResult(_0x458bf7,null))[_0x2d6d('0x42')](handleError(_0x458bf7,null));};exports[_0x2d6d('0x43')]=function(_0x1489c0,_0x4ae3ea){return db[_0x2d6d('0x28')][_0x2d6d('0x43')](_0x1489c0[_0x2d6d('0x44')],{})[_0x2d6d('0x21')](respondWithResult(_0x4ae3ea,0xc9))[_0x2d6d('0x42')](handleError(_0x4ae3ea,null));};exports[_0x2d6d('0x45')]=function(_0x4e05f0,_0x3a2739){if(_0x4e05f0[_0x2d6d('0x44')]['id']){delete _0x4e05f0['body']['id'];}return db[_0x2d6d('0x28')][_0x2d6d('0x46')]({'where':{'id':_0x4e05f0['params']['id']}})['then'](handleEntityNotFound(_0x3a2739,null))[_0x2d6d('0x21')](saveUpdates(_0x4e05f0['body'],null))['then'](respondWithResult(_0x3a2739,null))['catch'](handleError(_0x3a2739,null));};exports[_0x2d6d('0x22')]=function(_0x337e97,_0x5afce2){return db[_0x2d6d('0x28')][_0x2d6d('0x46')]({'where':{'id':_0x337e97['params']['id']}})[_0x2d6d('0x21')](handleEntityNotFound(_0x5afce2,null))['then'](removeEntity(_0x5afce2,null))[_0x2d6d('0x42')](handleError(_0x5afce2,null));};exports[_0x2d6d('0x47')]=function(_0x54fc8e,_0x18c078,_0x1b9f32){var _0x37e690={};var _0x386a6d={};var _0x39ba40;var _0x59e380;return db['ZohoAccount'][_0x2d6d('0x48')]({'where':{'id':_0x54fc8e['params']['id']}})['then'](handleEntityNotFound(_0x18c078,null))[_0x2d6d('0x21')](function(_0x2a5985){if(_0x2a5985){_0x39ba40=_0x2a5985;_0x386a6d['model']=_[_0x2d6d('0x3f')](db[_0x2d6d('0x49')][_0x2d6d('0x29')]);_0x386a6d['query']=_['keys'](_0x54fc8e[_0x2d6d('0x2d')]);_0x386a6d[_0x2d6d('0x2e')]=_[_0x2d6d('0x2f')](_0x386a6d[_0x2d6d('0x2c')],_0x386a6d[_0x2d6d('0x2d')]);_0x37e690[_0x2d6d('0x30')]=_[_0x2d6d('0x2f')](_0x386a6d[_0x2d6d('0x2c')],qs[_0x2d6d('0x31')](_0x54fc8e[_0x2d6d('0x2d')][_0x2d6d('0x31')]));_0x37e690[_0x2d6d('0x30')]=_0x37e690[_0x2d6d('0x30')]['length']?_0x37e690[_0x2d6d('0x30')]:_0x386a6d['model'];_0x37e690[_0x2d6d('0x34')]=qs[_0x2d6d('0x35')](_0x54fc8e['query'][_0x2d6d('0x35')]);_0x37e690[_0x2d6d('0x36')]=qs['filters'](_[_0x2d6d('0x37')](_0x54fc8e['query'],_0x386a6d['filters']));if(_0x54fc8e[_0x2d6d('0x2d')][_0x2d6d('0x38')]){_0x37e690['where']=_[_0x2d6d('0x39')](_0x37e690[_0x2d6d('0x36')],{'$or':_[_0x2d6d('0x27')](_0x37e690[_0x2d6d('0x30')],function(_0xa7ab9b){var _0x11194e={};_0x11194e[_0xa7ab9b]={'$like':'%'+_0x54fc8e[_0x2d6d('0x2d')]['filter']+'%'};return _0x11194e;})});}_0x37e690=_['merge']({},_0x37e690,_0x54fc8e[_0x2d6d('0x41')]);return _0x39ba40[_0x2d6d('0x47')](_0x37e690);}})[_0x2d6d('0x21')](function(_0x2075a3){if(_0x2075a3){_0x59e380=_0x2075a3[_0x2d6d('0x40')];if(!_0x54fc8e[_0x2d6d('0x2d')]['hasOwnProperty'](_0x2d6d('0x33'))){_0x37e690['limit']=qs['limit'](_0x54fc8e[_0x2d6d('0x2d')]['limit']);_0x37e690['offset']=qs[_0x2d6d('0x1a')](_0x54fc8e[_0x2d6d('0x2d')][_0x2d6d('0x1a')]);}return _0x39ba40['getConfigurations'](_0x37e690);}})['then'](function(_0x336b96){if(_0x336b96){return _0x336b96?{'count':_0x59e380,'rows':_0x336b96}:null;}})[_0x2d6d('0x21')](respondWithResult(_0x18c078,null))['catch'](handleError(_0x18c078,null));};exports[_0x2d6d('0x4a')]=function(_0x55368a,_0x467335,_0x2116f7){if(_0x55368a['body']['id']){delete _0x55368a['body']['id'];}return db['ZohoAccount'][_0x2d6d('0x48')]({'where':{'id':_0x55368a[_0x2d6d('0x3e')]['id']}})[_0x2d6d('0x21')](handleEntityNotFound(_0x467335,null))['then'](function(_0x1e1b1c){if(_0x1e1b1c){_0x55368a[_0x2d6d('0x44')]['AccountId']=_0x1e1b1c['id'];_0x55368a[_0x2d6d('0x44')][_0x2d6d('0x4b')]=integrations[_0x2d6d('0x4c')](_0x55368a[_0x2d6d('0x44')]['channel'],_0x55368a[_0x2d6d('0x44')][_0x2d6d('0x2a')]);_0x55368a[_0x2d6d('0x44')][_0x2d6d('0x4d')]=integrations['getDescriptions'](_0x55368a[_0x2d6d('0x44')][_0x2d6d('0x4e')],_0x55368a[_0x2d6d('0x44')][_0x2d6d('0x2a')]);return db[_0x2d6d('0x49')]['create'](_0x55368a['body'],{'include':[{'model':db['ZohoField'],'as':_0x2d6d('0x4b')},{'model':db[_0x2d6d('0x4f')],'as':_0x2d6d('0x4d')}]});}return null;})[_0x2d6d('0x21')](respondWithResult(_0x467335,null))[_0x2d6d('0x42')](handleError(_0x467335,null));};function getAccessToken(_0x299ff6){return new Promise(function(_0x137eea,_0x267d0d){var _0x382489;switch(_0x299ff6[_0x2d6d('0x50')]){case'US':_0x382489=_0x2d6d('0x51');break;case'AU':_0x382489=_0x2d6d('0x52');break;case'EU':_0x382489=_0x2d6d('0x53');break;case'IN':_0x382489='https://accounts.zoho.in';break;case'CN':_0x382489='https://accounts.zoho.com.cn';break;default:_0x382489=_0x2d6d('0x53');break;}var _0x545c94={'method':_0x2d6d('0x54'),'uri':_0x382489+_0x2d6d('0x55'),'qs':{'refresh_token':_0x299ff6['refreshToken'],'client_id':_0x299ff6[_0x2d6d('0x56')],'client_secret':_0x299ff6[_0x2d6d('0x57')],'grant_type':_0x2d6d('0x58')},'json':!![]};return rp(_0x545c94)[_0x2d6d('0x21')](function(_0x2f7b44){if(_0x2f7b44['access_token']){_0x137eea(_0x2f7b44[_0x2d6d('0x59')]);}else{_0x267d0d(_0x2d6d('0x5a'));}})[_0x2d6d('0x42')](function(_0x3f6356){_0x267d0d(_0x3f6356);});});}exports[_0x2d6d('0x5b')]=function(_0x77cc4a,_0x1f42da,_0x43f273){var _0x390a14,_0x289cc3,_0x363f65,_0x21f2cf,_0xb27dfd;return db[_0x2d6d('0x28')]['findOne']({'where':{'id':_0x77cc4a['params']['id']},'attributes':['id',_0x2d6d('0x5c'),'zone','clientId',_0x2d6d('0x57'),_0x2d6d('0x5d'),_0x2d6d('0x5e'),_0x2d6d('0x5f')]})[_0x2d6d('0x21')](handleEntityNotFound(_0x1f42da,null))[_0x2d6d('0x21')](function(_0x4ebf82){_0xb27dfd=_0x4ebf82;_0x390a14=_0xb27dfd[_0x2d6d('0x5c')];_0x289cc3=_0x390a14==='zoho.eu'?'eu':_0x2d6d('0x60');_0x363f65=_0xb27dfd[_0x2d6d('0x5d')];var _0x2e5150=_0x363f65[_0x2d6d('0x61')](-0x1);if(_0x2e5150==='/'||_0x2e5150==='\x5c'||_0x2e5150===':'){_0x363f65=_0x363f65[_0x2d6d('0x62')](0x0,_0x363f65[_0x2d6d('0x63')](_0x2e5150));}if(!_0xb27dfd[_0x2d6d('0x5f')]){throw new Error(_0x2d6d('0x64'));}return getAccessToken(_0xb27dfd);})[_0x2d6d('0x21')](function(_0x548e66){if(_0x548e66){return rp({'method':_0x2d6d('0x65'),'uri':util[_0x2d6d('0x66')](_0x2d6d('0x67'),_0x289cc3),'qs':{'module':_0x2d6d('0x68')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x548e66},'json':!![]});}})[_0x2d6d('0x21')](function(_0x303ac1){if(_0x303ac1){if(_0x303ac1['response']&&_0x303ac1[_0x2d6d('0x69')][_0x2d6d('0x6a')]){throw new Error(_0x303ac1[_0x2d6d('0x69')]['error'][_0x2d6d('0x6b')]);}var _0x8c150=[];var _0x4e9278=[];var _0x4791ec=[_0x2d6d('0x6c'),_0x2d6d('0x6d'),_0x2d6d('0x6e'),_0x2d6d('0x6f'),_0x2d6d('0x70'),_0x2d6d('0x71'),_0x2d6d('0x72'),'Call_Type'];_0x4e9278=_[_0x2d6d('0x73')](_0x303ac1['fields'],function(_0x2c30fa){return _0x4791ec[_0x2d6d('0x74')](_0x2c30fa[_0x2d6d('0x75')]);});for(var _0x4979ed=0x0;_0x4979ed<_0x4e9278['length'];_0x4979ed++){if(_0x4e9278[_0x4979ed][_0x2d6d('0x76')]===![]){_0x8c150[_0x2d6d('0x77')]({'id':_0x4e9278[_0x4979ed]['id'],'name':_0x4e9278[_0x4979ed]['display_label'],'custom':_0x4e9278[_0x4979ed][_0x2d6d('0x78')],'options':_0x4e9278[_0x4979ed][_0x2d6d('0x79')]===_0x2d6d('0x7a')&&_0x4e9278[_0x4979ed][_0x2d6d('0x7b')]['length']>-0x1?_[_0x2d6d('0x27')](_0x4e9278[_0x4979ed][_0x2d6d('0x7b')],function(_0x45fa62){return{'name':_0x45fa62,'value':_0x45fa62};}):[]});}}return{'count':_0x8c150['length'],'rows':_0x8c150};}else{return{'count':0x0,'rows':[]};}})[_0x2d6d('0x21')](respondWithResult(_0x1f42da,null))[_0x2d6d('0x42')](function(_0x372ec5){var _0x36033c=_0x77cc4a[_0x2d6d('0x2d')][_0x2d6d('0x7c')]?0x1f4:_0x372ec5[_0x2d6d('0x7d')]||0x1f4;logger[_0x2d6d('0x6a')](_0x2d6d('0x7e'),_0x2d6d('0x5b'),_0x36033c,JSON['stringify'](_0x372ec5));delete _0x372ec5[_0x2d6d('0x24')];if(_0x36033c===0x191){_0x36033c=0x190;}_0x1f42da[_0x2d6d('0x15')](_0x36033c)[_0x2d6d('0x25')](_0x77cc4a[_0x2d6d('0x2d')][_0x2d6d('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x372ec5[_0x2d6d('0x7d')]}:_0x372ec5);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 3b17384..b228f84 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 _0x20c8=['parse','catch','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','clientId','code','serverUrl','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','host','slice','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','clientSecret'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x20c8,0xae));var _0x820c=function(_0x23e4e6,_0x26ffea){_0x23e4e6=_0x23e4e6-0x0;var _0x393ec5=_0x20c8[_0x23e4e6];return _0x393ec5;};'use strict';var _=require(_0x820c('0x0'));var util=require('util');var logger=require(_0x820c('0x1'))('api');var moment=require(_0x820c('0x2'));var BPromise=require(_0x820c('0x3'));var rp=require(_0x820c('0x4'));var fs=require('fs');var path=require(_0x820c('0x5'));var rimraf=require('rimraf');var config=require(_0x820c('0x6'));var attributes=require(_0x820c('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x820c('0x8')]=function(_0x12ce89,_0x26220a){return _0x12ce89[_0x820c('0x9')](_0x820c('0xa'),attributes,{'tableName':_0x820c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc6beda,_0x44f069,_0x44df48){if(_0xc6beda[_0x820c('0xc')](_0x820c('0xd'))||_0xc6beda[_0x820c('0xc')]('serverUrl')||_0xc6beda[_0x820c('0xc')](_0x820c('0xe'))||_0xc6beda[_0x820c('0xc')]('clientSecret')||_0xc6beda[_0x820c('0xc')](_0x820c('0xf'))||_0xc6beda[_0x820c('0xc')]('host')){var _0x3a23e7,_0x194a3f;_0x3a23e7=_0xc6beda[_0x820c('0x10')];var _0x1b8a15=_0x3a23e7['slice'](-0x1);if(_0x1b8a15==='/'||_0x1b8a15==='\x5c'||_0x1b8a15===':'){_0x3a23e7=_0x3a23e7[_0x820c('0x11')](0x0,_0x3a23e7[_0x820c('0x12')](_0x1b8a15));}switch(_0xc6beda[_0x820c('0xd')]){case'US':_0x194a3f=_0x820c('0x13');break;case'AU':_0x194a3f='https://accounts.zoho.com.au';break;case'IN':_0x194a3f=_0x820c('0x14');break;case'CN':_0x194a3f=_0x820c('0x15');break;default:_0x194a3f='https://accounts.zoho.eu';break;}var _0x5dc2d6={'method':_0x820c('0x16'),'uri':_0x194a3f+'/oauth/v2/token','form':{'grant_type':_0x820c('0x17'),'client_id':_0xc6beda[_0x820c('0xe')],'client_secret':_0xc6beda['clientSecret'],'redirect_uri':_0xc6beda['serverUrl'],'code':_0xc6beda[_0x820c('0xf')]},'headers':{'Content-Type':_0x820c('0x18')}};return rp(_0x5dc2d6)[_0x820c('0x19')](function(_0x69d9a6){var _0x3b326d=JSON['parse'](_0x69d9a6);if(_0x3b326d[_0x820c('0x1a')]){_0xc6beda[_0x820c('0x1b')]=_0x3b326d[_0x820c('0x1a')];logger[_0x820c('0x1c')](util[_0x820c('0x1d')](_0x820c('0x1e'),_0xc6beda['name'],_0xc6beda['id']));}else{logger[_0x820c('0x1f')](util[_0x820c('0x1d')](_0x820c('0x20'),_0xc6beda[_0x820c('0x21')],_0xc6beda['id']),util['inspect'](_0x3b326d,{'showHidden':![],'depth':null}));}return _0x44df48(null,_0x44f069);})['catch'](function(_0x50b241){logger[_0x820c('0x1f')](util['format'](_0x820c('0x20'),_0xc6beda[_0x820c('0x21')],_0xc6beda['id']),util[_0x820c('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x44df48(_0x50b241);});}else{return _0x44df48(null,_0x44f069);}},'beforeUpdate':function(_0x5001b1,_0x16ceec,_0x43ad89){if(_0x5001b1[_0x820c('0xc')](_0x820c('0xd'))||_0x5001b1['changed'](_0x820c('0x10'))||_0x5001b1[_0x820c('0xc')](_0x820c('0xe'))||_0x5001b1[_0x820c('0xc')]('clientSecret')||_0x5001b1[_0x820c('0xc')](_0x820c('0xf'))||_0x5001b1['changed'](_0x820c('0x23'))){var _0x43f5ad,_0x21ae4d;_0x43f5ad=_0x5001b1['serverUrl'];var _0x3558c8=_0x43f5ad[_0x820c('0x24')](-0x1);if(_0x3558c8==='/'||_0x3558c8==='\x5c'||_0x3558c8===':'){_0x43f5ad=_0x43f5ad[_0x820c('0x11')](0x0,_0x43f5ad['lastIndexOf'](_0x3558c8));}switch(_0x5001b1[_0x820c('0xd')]){case'US':_0x21ae4d=_0x820c('0x13');break;case'AU':_0x21ae4d=_0x820c('0x25');break;case'IN':_0x21ae4d=_0x820c('0x14');break;case'CN':_0x21ae4d=_0x820c('0x15');break;default:_0x21ae4d=_0x820c('0x26');break;}var _0x53eea5={'method':_0x820c('0x16'),'uri':_0x21ae4d+_0x820c('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x5001b1[_0x820c('0xe')],'client_secret':_0x5001b1[_0x820c('0x28')],'redirect_uri':_0x5001b1[_0x820c('0x10')],'code':_0x5001b1[_0x820c('0xf')]},'headers':{'Content-Type':_0x820c('0x18')}};return rp(_0x53eea5)[_0x820c('0x19')](function(_0x204ae2){var _0x32a92d=JSON[_0x820c('0x29')](_0x204ae2);if(_0x32a92d['refresh_token']){_0x5001b1[_0x820c('0x1b')]=_0x32a92d[_0x820c('0x1a')];logger[_0x820c('0x1c')](util[_0x820c('0x1d')](_0x820c('0x1e'),_0x5001b1[_0x820c('0x21')],_0x5001b1['id']));}else{logger[_0x820c('0x1f')](util[_0x820c('0x1d')](_0x820c('0x20'),_0x5001b1[_0x820c('0x21')],_0x5001b1['id']),util[_0x820c('0x22')](_0x32a92d,{'showHidden':![],'depth':null}));}return _0x43ad89(null,_0x16ceec);})[_0x820c('0x2a')](function(_0x2dd666){logger[_0x820c('0x1f')](util[_0x820c('0x1d')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5001b1['name'],_0x5001b1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x43ad89(_0x2dd666);});}else{return _0x43ad89(null,_0x16ceec);}}}});}; \ No newline at end of file +var _0x6864=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','/oauth/v2/token','then','parse','refreshToken','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','refresh_token'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6864,0xdf));var _0x4686=function(_0x2666e0,_0x5b66a3){_0x2666e0=_0x2666e0-0x0;var _0x40935e=_0x6864[_0x2666e0];return _0x40935e;};'use strict';var _=require(_0x4686('0x0'));var util=require('util');var logger=require(_0x4686('0x1'))(_0x4686('0x2'));var moment=require(_0x4686('0x3'));var BPromise=require(_0x4686('0x4'));var rp=require(_0x4686('0x5'));var fs=require('fs');var path=require(_0x4686('0x6'));var rimraf=require(_0x4686('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x4686('0x8')]=function(_0x4fbc1b,_0x33bdc7){return _0x4fbc1b[_0x4686('0x9')]('ZohoAccount',attributes,{'tableName':_0x4686('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x35f210,_0x2f65ec,_0x1dfb14){if(_0x35f210[_0x4686('0xb')](_0x4686('0xc'))||_0x35f210[_0x4686('0xb')](_0x4686('0xd'))||_0x35f210['changed'](_0x4686('0xe'))||_0x35f210['changed'](_0x4686('0xf'))||_0x35f210[_0x4686('0xb')](_0x4686('0x10'))||_0x35f210[_0x4686('0xb')](_0x4686('0x11'))){var _0x2666cf,_0x353ed3;_0x2666cf=_0x35f210[_0x4686('0xd')];var _0x131434=_0x2666cf[_0x4686('0x12')](-0x1);if(_0x131434==='/'||_0x131434==='\x5c'||_0x131434===':'){_0x2666cf=_0x2666cf['substring'](0x0,_0x2666cf[_0x4686('0x13')](_0x131434));}switch(_0x35f210[_0x4686('0xc')]){case'US':_0x353ed3=_0x4686('0x14');break;case'AU':_0x353ed3=_0x4686('0x15');break;case'IN':_0x353ed3=_0x4686('0x16');break;case'CN':_0x353ed3=_0x4686('0x17');break;default:_0x353ed3=_0x4686('0x18');break;}var _0x236d03={'method':_0x4686('0x19'),'uri':_0x353ed3+'/oauth/v2/token','form':{'grant_type':_0x4686('0x1a'),'client_id':_0x35f210[_0x4686('0xe')],'client_secret':_0x35f210[_0x4686('0xf')],'redirect_uri':_0x35f210[_0x4686('0xd')],'code':_0x35f210['code']},'headers':{'Content-Type':_0x4686('0x1b')}};return rp(_0x236d03)['then'](function(_0x1fe47f){var _0x42606e=JSON['parse'](_0x1fe47f);if(_0x42606e['refresh_token']){_0x35f210['refreshToken']=_0x42606e[_0x4686('0x1c')];logger[_0x4686('0x1d')](util[_0x4686('0x1e')](_0x4686('0x1f'),_0x35f210[_0x4686('0x20')],_0x35f210['id']));}else{logger[_0x4686('0x21')](util[_0x4686('0x1e')](_0x4686('0x22'),_0x35f210[_0x4686('0x20')],_0x35f210['id']),util[_0x4686('0x23')](_0x42606e,{'showHidden':![],'depth':null}));}return _0x1dfb14(null,_0x2f65ec);})[_0x4686('0x24')](function(_0x43f1a2){logger[_0x4686('0x21')](util[_0x4686('0x1e')](_0x4686('0x22'),_0x35f210['name'],_0x35f210['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1dfb14(_0x43f1a2);});}else{return _0x1dfb14(null,_0x2f65ec);}},'beforeUpdate':function(_0x99d433,_0x5d6f4d,_0x1c0568){if(_0x99d433[_0x4686('0xb')]('zone')||_0x99d433['changed']('serverUrl')||_0x99d433[_0x4686('0xb')]('clientId')||_0x99d433[_0x4686('0xb')](_0x4686('0xf'))||_0x99d433[_0x4686('0xb')](_0x4686('0x10'))||_0x99d433['changed'](_0x4686('0x11'))){var _0x2702b3,_0x129a0d;_0x2702b3=_0x99d433[_0x4686('0xd')];var _0x45240d=_0x2702b3[_0x4686('0x12')](-0x1);if(_0x45240d==='/'||_0x45240d==='\x5c'||_0x45240d===':'){_0x2702b3=_0x2702b3[_0x4686('0x25')](0x0,_0x2702b3[_0x4686('0x13')](_0x45240d));}switch(_0x99d433['zone']){case'US':_0x129a0d='https://accounts.zoho.com';break;case'AU':_0x129a0d=_0x4686('0x15');break;case'IN':_0x129a0d=_0x4686('0x16');break;case'CN':_0x129a0d='https://accounts.zoho.com.cn';break;default:_0x129a0d=_0x4686('0x18');break;}var _0x20da26={'method':_0x4686('0x19'),'uri':_0x129a0d+_0x4686('0x26'),'form':{'grant_type':_0x4686('0x1a'),'client_id':_0x99d433[_0x4686('0xe')],'client_secret':_0x99d433[_0x4686('0xf')],'redirect_uri':_0x99d433[_0x4686('0xd')],'code':_0x99d433[_0x4686('0x10')]},'headers':{'Content-Type':_0x4686('0x1b')}};return rp(_0x20da26)[_0x4686('0x27')](function(_0x2dcd53){var _0x1cb0c4=JSON[_0x4686('0x28')](_0x2dcd53);if(_0x1cb0c4[_0x4686('0x1c')]){_0x99d433[_0x4686('0x29')]=_0x1cb0c4[_0x4686('0x1c')];logger[_0x4686('0x1d')](util[_0x4686('0x1e')](_0x4686('0x1f'),_0x99d433[_0x4686('0x20')],_0x99d433['id']));}else{logger['error'](util[_0x4686('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x99d433['name'],_0x99d433['id']),util['inspect'](_0x1cb0c4,{'showHidden':![],'depth':null}));}return _0x1c0568(null,_0x5d6f4d);})[_0x4686('0x24')](function(_0x378a63){logger[_0x4686('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x99d433[_0x4686('0x20')],_0x99d433['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1c0568(_0x378a63);});}else{return _0x1c0568(null,_0x5d6f4d);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2296134..799858a 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 _0xad5f=['rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZohoAccount','findAll','options','attributes','limit','map','include','model','ShowZohoAccount','ZohoAccount','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xad5f,0x1a8));var _0xfad5=function(_0x4c978c,_0xbd7d69){_0x4c978c=_0x4c978c-0x0;var _0x48db9c=_0xad5f[_0x4c978c];return _0x48db9c;};'use strict';var _=require(_0xfad5('0x0'));var util=require(_0xfad5('0x1'));var moment=require(_0xfad5('0x2'));var BPromise=require(_0xfad5('0x3'));var rs=require(_0xfad5('0x4'));var fs=require('fs');var Redis=require(_0xfad5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfad5('0x6'));var logger=require(_0xfad5('0x7'))(_0xfad5('0x8'));var config=require(_0xfad5('0x9'));var jayson=require(_0xfad5('0xa'));var client=jayson[_0xfad5('0xb')][_0xfad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5811f7,_0xf71084,_0x28566c){return new BPromise(function(_0x39d228,_0xbe8f56){return client['request'](_0x5811f7,_0x28566c)[_0xfad5('0xd')](function(_0xac127d){logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,_0xfad5('0x10'));logger[_0xfad5('0x11')](_0xfad5('0x12'),_0xf71084,'request\x20sent',JSON[_0xfad5('0x13')](_0xac127d));if(_0xac127d[_0xfad5('0x14')]){if(_0xac127d[_0xfad5('0x14')]['code']===0x1f4){logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0xbe8f56(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}logger['error'](_0xfad5('0xf'),_0xf71084,_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);return _0x39d228(_0xac127d[_0xfad5('0x14')][_0xfad5('0x15')]);}else{logger[_0xfad5('0xe')](_0xfad5('0xf'),_0xf71084,'request\x20sent');_0x39d228(_0xac127d['result'][_0xfad5('0x15')]);}})[_0xfad5('0x16')](function(_0x311e75){logger[_0xfad5('0x14')](_0xfad5('0xf'),_0xf71084,_0x311e75);_0xbe8f56(_0x311e75);});});}exports[_0xfad5('0x17')]=function(_0x10ae77){var _0x2fc3ed=this;return new Promise(function(_0x259766,_0x558590){return db['ZohoAccount'][_0xfad5('0x18')]({'raw':_0x10ae77[_0xfad5('0x19')]?_0x10ae77['options']['raw']===undefined?!![]:![]:!![],'where':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')]['where']||null:null,'attributes':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1a')]||null:null,'limit':_0x10ae77[_0xfad5('0x19')]?_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1b')]||null:null,'include':_0x10ae77['options']?_0x10ae77[_0xfad5('0x19')]['include']?_[_0xfad5('0x1c')](_0x10ae77[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x16e903){return{'model':db[_0x16e903[_0xfad5('0x1e')]],'as':_0x16e903['as'],'attributes':_0x16e903[_0xfad5('0x1a')],'include':_0x16e903[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x16e903[_0xfad5('0x1d')],function(_0x45c149){return{'model':db[_0x45c149[_0xfad5('0x1e')]],'as':_0x45c149['as'],'attributes':_0x45c149['attributes'],'include':_0x45c149[_0xfad5('0x1d')]?_[_0xfad5('0x1c')](_0x45c149[_0xfad5('0x1d')],function(_0xc772e6){return{'model':db[_0xc772e6[_0xfad5('0x1e')]],'as':_0xc772e6['as'],'attributes':_0xc772e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x3d9d95){logger[_0xfad5('0xe')]('GetZohoAccount',_0x10ae77);logger[_0xfad5('0x11')]('GetZohoAccount',_0x10ae77,JSON[_0xfad5('0x13')](_0x3d9d95));_0x259766(_0x3d9d95);})[_0xfad5('0x16')](function(_0x30ce5b){logger['error'](_0xfad5('0x17'),_0x30ce5b['message'],_0x10ae77);_0x558590(_0x2fc3ed['error'](0x1f4,_0x30ce5b['message']));});});};exports[_0xfad5('0x1f')]=function(_0x1f5329){var _0x3c3f0f=this;return new Promise(function(_0x1133fd,_0x1e789a){return db[_0xfad5('0x20')][_0xfad5('0x21')]({'raw':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x22')]===undefined?!![]:![]:!![],'where':_0x1f5329['options']?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x23')]||null:null,'attributes':_0x1f5329[_0xfad5('0x19')]?_0x1f5329['options'][_0xfad5('0x1a')]||null:null,'include':_0x1f5329[_0xfad5('0x19')]?_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')]?_['map'](_0x1f5329[_0xfad5('0x19')][_0xfad5('0x1d')],function(_0x147aa6){return{'model':db[_0x147aa6[_0xfad5('0x1e')]],'as':_0x147aa6['as'],'attributes':_0x147aa6[_0xfad5('0x1a')],'include':_0x147aa6['include']?_[_0xfad5('0x1c')](_0x147aa6[_0xfad5('0x1d')],function(_0x37fff5){return{'model':db[_0x37fff5['model']],'as':_0x37fff5['as'],'attributes':_0x37fff5[_0xfad5('0x1a')],'include':_0x37fff5[_0xfad5('0x1d')]?_['map'](_0x37fff5['include'],function(_0x334b10){return{'model':db[_0x334b10[_0xfad5('0x1e')]],'as':_0x334b10['as'],'attributes':_0x334b10[_0xfad5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xfad5('0xd')](function(_0x232192){logger[_0xfad5('0xe')](_0xfad5('0x1f'),_0x1f5329);logger['debug'](_0xfad5('0x1f'),_0x1f5329,JSON[_0xfad5('0x13')](_0x232192));_0x1133fd(_0x232192);})[_0xfad5('0x16')](function(_0x3aa0e2){logger[_0xfad5('0x14')]('ShowZohoAccount',_0x3aa0e2[_0xfad5('0x15')],_0x1f5329);_0x1e789a(_0x3c3f0f[_0xfad5('0x14')](0x1f4,_0x3aa0e2['message']));});});}; \ No newline at end of file +var _0xef66=['model','include','debug','stringify','ShowZohoAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','GetZohoAccount','ZohoAccount','findAll','options','where','attributes','map'];(function(_0x45132b,_0x466442){var _0x54b2cd=function(_0x27c8f0){while(--_0x27c8f0){_0x45132b['push'](_0x45132b['shift']());}};_0x54b2cd(++_0x466442);}(_0xef66,0x1db));var _0x6ef6=function(_0x1ef88c,_0x318397){_0x1ef88c=_0x1ef88c-0x0;var _0x40e56f=_0xef66[_0x1ef88c];return _0x40e56f;};'use strict';var _=require(_0x6ef6('0x0'));var util=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var rs=require(_0x6ef6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6ef6('0x5'));var logger=require(_0x6ef6('0x6'))(_0x6ef6('0x7'));var config=require(_0x6ef6('0x8'));var jayson=require(_0x6ef6('0x9'));var client=jayson[_0x6ef6('0xa')][_0x6ef6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1830aa,_0x3755b5,_0x4f06b9){return new BPromise(function(_0x5a7c74,_0xc0d555){return client[_0x6ef6('0xc')](_0x1830aa,_0x4f06b9)[_0x6ef6('0xd')](function(_0x391e0e){logger[_0x6ef6('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3755b5,_0x6ef6('0xf'),JSON['stringify'](_0x391e0e));if(_0x391e0e[_0x6ef6('0x10')]){if(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x11')]===0x1f4){logger[_0x6ef6('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3755b5,_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);return _0xc0d555(_0x391e0e[_0x6ef6('0x10')][_0x6ef6('0x12')]);}logger['error'](_0x6ef6('0x13'),_0x3755b5,_0x391e0e['error'][_0x6ef6('0x12')]);return _0x5a7c74(_0x391e0e[_0x6ef6('0x10')]['message']);}else{logger[_0x6ef6('0xe')](_0x6ef6('0x13'),_0x3755b5,_0x6ef6('0xf'));_0x5a7c74(_0x391e0e[_0x6ef6('0x14')][_0x6ef6('0x12')]);}})[_0x6ef6('0x15')](function(_0x4ea222){logger[_0x6ef6('0x10')](_0x6ef6('0x13'),_0x3755b5,_0x4ea222);_0xc0d555(_0x4ea222);});});}exports[_0x6ef6('0x16')]=function(_0x53586d){var _0x3fc3d1=this;return new Promise(function(_0x2510be,_0x292af9){return db[_0x6ef6('0x17')][_0x6ef6('0x18')]({'raw':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')][_0x6ef6('0x1a')]||null:null,'attributes':_0x53586d[_0x6ef6('0x19')]?_0x53586d['options'][_0x6ef6('0x1b')]||null:null,'limit':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['limit']||null:null,'include':_0x53586d[_0x6ef6('0x19')]?_0x53586d[_0x6ef6('0x19')]['include']?_[_0x6ef6('0x1c')](_0x53586d[_0x6ef6('0x19')]['include'],function(_0x366f2c){return{'model':db[_0x366f2c[_0x6ef6('0x1d')]],'as':_0x366f2c['as'],'attributes':_0x366f2c[_0x6ef6('0x1b')],'include':_0x366f2c[_0x6ef6('0x1e')]?_[_0x6ef6('0x1c')](_0x366f2c[_0x6ef6('0x1e')],function(_0x1cd549){return{'model':db[_0x1cd549['model']],'as':_0x1cd549['as'],'attributes':_0x1cd549[_0x6ef6('0x1b')],'include':_0x1cd549['include']?_[_0x6ef6('0x1c')](_0x1cd549[_0x6ef6('0x1e')],function(_0x443ded){return{'model':db[_0x443ded[_0x6ef6('0x1d')]],'as':_0x443ded['as'],'attributes':_0x443ded[_0x6ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0xd')](function(_0x23eb77){logger[_0x6ef6('0xe')](_0x6ef6('0x16'),_0x53586d);logger[_0x6ef6('0x1f')](_0x6ef6('0x16'),_0x53586d,JSON[_0x6ef6('0x20')](_0x23eb77));_0x2510be(_0x23eb77);})[_0x6ef6('0x15')](function(_0x40f9f6){logger[_0x6ef6('0x10')](_0x6ef6('0x16'),_0x40f9f6[_0x6ef6('0x12')],_0x53586d);_0x292af9(_0x3fc3d1[_0x6ef6('0x10')](0x1f4,_0x40f9f6[_0x6ef6('0x12')]));});});};exports[_0x6ef6('0x21')]=function(_0x512dda){var _0x4f901c=this;return new Promise(function(_0x5f3179,_0xce3e82){return db[_0x6ef6('0x17')][_0x6ef6('0x22')]({'raw':_0x512dda['options']?_0x512dda['options'][_0x6ef6('0x23')]===undefined?!![]:![]:!![],'where':_0x512dda[_0x6ef6('0x19')]?_0x512dda[_0x6ef6('0x19')]['where']||null:null,'attributes':_0x512dda[_0x6ef6('0x19')]?_0x512dda['options'][_0x6ef6('0x1b')]||null:null,'include':_0x512dda[_0x6ef6('0x19')]?_0x512dda['options']['include']?_[_0x6ef6('0x1c')](_0x512dda['options'][_0x6ef6('0x1e')],function(_0x52c901){return{'model':db[_0x52c901[_0x6ef6('0x1d')]],'as':_0x52c901['as'],'attributes':_0x52c901['attributes'],'include':_0x52c901['include']?_[_0x6ef6('0x1c')](_0x52c901[_0x6ef6('0x1e')],function(_0x5d1db9){return{'model':db[_0x5d1db9[_0x6ef6('0x1d')]],'as':_0x5d1db9['as'],'attributes':_0x5d1db9['attributes'],'include':_0x5d1db9[_0x6ef6('0x1e')]?_['map'](_0x5d1db9[_0x6ef6('0x1e')],function(_0x5cf0ea){return{'model':db[_0x5cf0ea[_0x6ef6('0x1d')]],'as':_0x5cf0ea['as'],'attributes':_0x5cf0ea[_0x6ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6ef6('0xd')](function(_0x57eaff){logger['info'](_0x6ef6('0x21'),_0x512dda);logger[_0x6ef6('0x1f')](_0x6ef6('0x21'),_0x512dda,JSON[_0x6ef6('0x20')](_0x57eaff));_0x5f3179(_0x57eaff);})['catch'](function(_0x538757){logger[_0x6ef6('0x10')]('ShowZohoAccount',_0x538757['message'],_0x512dda);_0xce3e82(_0x4f901c[_0x6ef6('0x10')](0x1f4,_0x538757['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index c28a2dc..012b662 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 _0x9d96=['/:id/descriptions','getDescriptions','post','create','put','delete','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0x9d96,0x195));var _0x69d9=function(_0x5aaf56,_0x590a02){_0x5aaf56=_0x5aaf56-0x0;var _0x4e2204=_0x9d96[_0x5aaf56];return _0x4e2204;};'use strict';var multer=require(_0x69d9('0x0'));var util=require(_0x69d9('0x1'));var path=require('path');var timeout=require(_0x69d9('0x2'));var express=require('express');var router=express[_0x69d9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x69d9('0x4'));var config=require(_0x69d9('0x5'));var controller=require(_0x69d9('0x6'));router[_0x69d9('0x7')]('/',auth[_0x69d9('0x8')](),controller[_0x69d9('0x9')]);router[_0x69d9('0x7')](_0x69d9('0xa'),auth[_0x69d9('0x8')](),controller['show']);router['get'](_0x69d9('0xb'),auth[_0x69d9('0x8')](),controller[_0x69d9('0xc')]);router[_0x69d9('0x7')](_0x69d9('0xd'),auth[_0x69d9('0x8')](),controller[_0x69d9('0xe')]);router['get'](_0x69d9('0xf'),auth[_0x69d9('0x8')](),controller[_0x69d9('0x10')]);router[_0x69d9('0x11')]('/',auth[_0x69d9('0x8')](),controller[_0x69d9('0x12')]);router[_0x69d9('0x13')](_0x69d9('0xa'),auth[_0x69d9('0x8')](),controller['update']);router[_0x69d9('0x14')]('/:id',auth[_0x69d9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb276=['../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','delete','exports','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xb276,0x120));var _0x6b27=function(_0x3ab353,_0x5d5283){_0x3ab353=_0x3ab353-0x0;var _0x1e2285=_0xb276[_0x3ab353];return _0x1e2285;};'use strict';var multer=require('multer');var util=require(_0x6b27('0x0'));var path=require(_0x6b27('0x1'));var timeout=require('connect-timeout');var express=require(_0x6b27('0x2'));var router=express[_0x6b27('0x3')]();var fs_extra=require(_0x6b27('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b27('0x5'));var config=require(_0x6b27('0x6'));var controller=require(_0x6b27('0x7'));router[_0x6b27('0x8')]('/',auth[_0x6b27('0x9')](),controller[_0x6b27('0xa')]);router[_0x6b27('0x8')](_0x6b27('0xb'),auth[_0x6b27('0x9')](),controller['show']);router['get'](_0x6b27('0xc'),auth['isAuthenticated'](),controller[_0x6b27('0xd')]);router[_0x6b27('0x8')](_0x6b27('0xe'),auth['isAuthenticated'](),controller[_0x6b27('0xf')]);router['get'](_0x6b27('0x10'),auth[_0x6b27('0x9')](),controller[_0x6b27('0x11')]);router[_0x6b27('0x12')]('/',auth[_0x6b27('0x9')](),controller['create']);router['put'](_0x6b27('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6b27('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6b27('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5b018b9..a71c03c 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 _0x7e17=['contact','nothing','lead','contact_lead','exports','STRING','ENUM'];(function(_0x32729c,_0xf5afd8){var _0x482cfd=function(_0x231471){while(--_0x231471){_0x32729c['push'](_0x32729c['shift']());}};_0x482cfd(++_0xf5afd8);}(_0x7e17,0x89));var _0x77e1=function(_0x2d33c7,_0x20e736){_0x2d33c7=_0x2d33c7-0x0;var _0x3f5a29=_0x7e17[_0x2d33c7];return _0x3f5a29;};'use strict';var Sequelize=require('sequelize');module[_0x77e1('0x0')]={'name':{'type':Sequelize[_0x77e1('0x1')]},'moduleCreate':{'type':Sequelize[_0x77e1('0x2')]('lead',_0x77e1('0x3'),_0x77e1('0x4')),'defaultValue':_0x77e1('0x5')},'moduleSearch':{'type':Sequelize[_0x77e1('0x2')](_0x77e1('0x6'),'contact',_0x77e1('0x5')),'defaultValue':_0x77e1('0x6')},'description':{'type':Sequelize[_0x77e1('0x1')]}}; \ No newline at end of file +var _0x962c=['ENUM','contact_lead','exports','STRING','lead','contact'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x962c,0x1a0));var _0xc962=function(_0x4e4424,_0x5913d8){_0x4e4424=_0x4e4424-0x0;var _0x15e866=_0x962c[_0x4e4424];return _0x15e866;};'use strict';var Sequelize=require('sequelize');module[_0xc962('0x0')]={'name':{'type':Sequelize[_0xc962('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc962('0x2'),_0xc962('0x3'),'nothing'),'defaultValue':_0xc962('0x2')},'moduleSearch':{'type':Sequelize[_0xc962('0x4')]('contact_lead',_0xc962('0x3'),_0xc962('0x2')),'defaultValue':_0xc962('0x5')},'description':{'type':Sequelize[_0xc962('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7c64f53..76ead9a 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 _0xd597=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','options','ZohoConfiguration','count','includeAll','include','findAll','rows','catch','params','find','create','body','findOne','pick','getFields','hasOwnProperty','nolimit','ZohoField','getSubjects','getDescriptions','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','jsforce','desk.js'];(function(_0x35c179,_0x2a8da2){var _0x2de3c9=function(_0x36537d){while(--_0x36537d){_0x35c179['push'](_0x35c179['shift']());}};_0x2de3c9(++_0x2a8da2);}(_0xd597,0x115));var _0x7d59=function(_0x96ff1,_0x5c8414){_0x96ff1=_0x96ff1-0x0;var _0x161431=_0xd597[_0x96ff1];return _0x161431;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7d59('0x0'));var jsonpatch=require(_0x7d59('0x1'));var rp=require(_0x7d59('0x2'));var moment=require(_0x7d59('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7d59('0x4'));var path=require(_0x7d59('0x5'));var sox=require(_0x7d59('0x6'));var csv=require(_0x7d59('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d59('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7d59('0x9'));var deskjs=require(_0x7d59('0xa'));var toCsv=require(_0x7d59('0x7'));var querystring=require(_0x7d59('0xb'));var Papa=require('papaparse');var Redis=require(_0x7d59('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7d59('0xd'));var as=require(_0x7d59('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d59('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x7d59('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x261383,_0x1fcefd){_0x1fcefd=_0x1fcefd||0xcc;return function(_0x3027b9){if(_0x3027b9){return _0x261383[_0x7d59('0x11')](_0x1fcefd);}return _0x261383[_0x7d59('0x12')](_0x1fcefd)[_0x7d59('0x13')]();};}function respondWithResult(_0x1887fb,_0x3f7d7e){_0x3f7d7e=_0x3f7d7e||0xc8;return function(_0x88bd02){if(_0x88bd02){return _0x1887fb[_0x7d59('0x12')](_0x3f7d7e)[_0x7d59('0x14')](_0x88bd02);}};}function respondWithFilteredResult(_0x46d0dc,_0x37c7dd){return function(_0x48c99c){if(_0x48c99c){var _0x35b012=typeof _0x37c7dd[_0x7d59('0x15')]===_0x7d59('0x16')&&typeof _0x37c7dd[_0x7d59('0x17')]===_0x7d59('0x16');var _0x18d33c=_0x48c99c['count'];var _0x27df9c=_0x35b012?0x0:_0x37c7dd[_0x7d59('0x15')];var _0x10eac7=_0x35b012?_0x48c99c['count']:_0x37c7dd[_0x7d59('0x15')]+_0x37c7dd[_0x7d59('0x17')];var _0x1df87f;if(_0x10eac7>=_0x18d33c){_0x10eac7=_0x18d33c;_0x1df87f=0xc8;}else{_0x1df87f=0xce;}_0x46d0dc['status'](_0x1df87f);return _0x46d0dc[_0x7d59('0x18')](_0x7d59('0x19'),_0x27df9c+'-'+_0x10eac7+'/'+_0x18d33c)[_0x7d59('0x14')](_0x48c99c);}return null;};}function patchUpdates(_0x1cd5c8){return function(_0x5efd60){try{jsonpatch['apply'](_0x5efd60,_0x1cd5c8,!![]);}catch(_0x3b0141){return BPromise[_0x7d59('0x1a')](_0x3b0141);}return _0x5efd60[_0x7d59('0x1b')]();};}function saveUpdates(_0x79677b,_0x51e5b4){return function(_0x50a019){if(_0x50a019){return _0x50a019[_0x7d59('0x1c')](_0x79677b)['then'](function(_0xf15a2a){return _0xf15a2a;});}return null;};}function removeEntity(_0x4fa598,_0x439e06){return function(_0x32b7bc){if(_0x32b7bc){return _0x32b7bc[_0x7d59('0x1d')]()[_0x7d59('0x1e')](function(){_0x4fa598['status'](0xcc)[_0x7d59('0x13')]();});}};}function handleEntityNotFound(_0x924953,_0x10f143){return function(_0x50f141){if(!_0x50f141){_0x924953[_0x7d59('0x11')](0x194);}return _0x50f141;};}function handleError(_0x3917d2,_0x1b1ca3){_0x1b1ca3=_0x1b1ca3||0x1f4;return function(_0x2a2501){logger['error'](_0x2a2501[_0x7d59('0x1f')]);if(_0x2a2501['name']){delete _0x2a2501[_0x7d59('0x20')];}_0x3917d2[_0x7d59('0x12')](_0x1b1ca3)['send'](_0x2a2501);};}exports['index']=function(_0x1f90de,_0x3c02d5){var _0x4c4dcd={},_0x5388b8={},_0x3e0ea4={'count':0x0,'rows':[]};var _0x5bd810=_[_0x7d59('0x21')](db['ZohoConfiguration'][_0x7d59('0x22')],function(_0x74b6d1){return{'name':_0x74b6d1[_0x7d59('0x23')],'type':_0x74b6d1[_0x7d59('0x24')][_0x7d59('0x25')]};});_0x5388b8[_0x7d59('0x26')]=_[_0x7d59('0x21')](_0x5bd810,_0x7d59('0x20'));_0x5388b8['query']=_[_0x7d59('0x27')](_0x1f90de[_0x7d59('0x28')]);_0x5388b8['filters']=_[_0x7d59('0x29')](_0x5388b8[_0x7d59('0x26')],_0x5388b8['query']);_0x4c4dcd[_0x7d59('0x2a')]=_[_0x7d59('0x29')](_0x5388b8[_0x7d59('0x26')],qs['fields'](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x4c4dcd[_0x7d59('0x2a')]=_0x4c4dcd['attributes'][_0x7d59('0x2c')]?_0x4c4dcd['attributes']:_0x5388b8[_0x7d59('0x26')];if(!_0x1f90de[_0x7d59('0x28')]['hasOwnProperty']('nolimit')){_0x4c4dcd[_0x7d59('0x17')]=qs[_0x7d59('0x17')](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x17')]);_0x4c4dcd[_0x7d59('0x15')]=qs[_0x7d59('0x15')](_0x1f90de[_0x7d59('0x28')][_0x7d59('0x15')]);}_0x4c4dcd[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x1f90de[_0x7d59('0x28')]['sort']);_0x4c4dcd[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_['pick'](_0x1f90de[_0x7d59('0x28')],_0x5388b8[_0x7d59('0x30')]),_0x5bd810);if(_0x1f90de['query'][_0x7d59('0x31')]){_0x4c4dcd['where']=_[_0x7d59('0x32')](_0x4c4dcd[_0x7d59('0x2f')],{'$or':_['map'](_0x5bd810,function(_0x3b9794){if(_0x3b9794[_0x7d59('0x24')]!==_0x7d59('0x33')){var _0x5e793a={};_0x5e793a[_0x3b9794[_0x7d59('0x20')]]={'$like':'%'+_0x1f90de[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x5e793a;}})});}_0x4c4dcd=_['merge']({},_0x4c4dcd,_0x1f90de[_0x7d59('0x34')]);var _0x1b68cd={'where':_0x4c4dcd[_0x7d59('0x2f')]};return db[_0x7d59('0x35')]['count'](_0x1b68cd)[_0x7d59('0x1e')](function(_0x3e15e9){_0x3e0ea4[_0x7d59('0x36')]=_0x3e15e9;if(_0x1f90de[_0x7d59('0x28')][_0x7d59('0x37')]){_0x4c4dcd[_0x7d59('0x38')]=[{'all':!![]}];}return db[_0x7d59('0x35')][_0x7d59('0x39')](_0x4c4dcd);})[_0x7d59('0x1e')](function(_0x9fe7e1){_0x3e0ea4[_0x7d59('0x3a')]=_0x9fe7e1;return _0x3e0ea4;})[_0x7d59('0x1e')](respondWithFilteredResult(_0x3c02d5,_0x4c4dcd))[_0x7d59('0x3b')](handleError(_0x3c02d5,null));};exports['show']=function(_0x5c9594,_0x1c2175){var _0x22630f={'raw':![],'where':{'id':_0x5c9594[_0x7d59('0x3c')]['id']}},_0x54a8a2={};_0x54a8a2[_0x7d59('0x26')]=_['keys'](db['ZohoConfiguration'][_0x7d59('0x22')]);_0x54a8a2[_0x7d59('0x28')]=_['keys'](_0x5c9594[_0x7d59('0x28')]);_0x54a8a2[_0x7d59('0x30')]=_['intersection'](_0x54a8a2[_0x7d59('0x26')],_0x54a8a2[_0x7d59('0x28')]);_0x22630f['attributes']=_['intersection'](_0x54a8a2['model'],qs['fields'](_0x5c9594['query'][_0x7d59('0x2b')]));_0x22630f[_0x7d59('0x2a')]=_0x22630f['attributes'][_0x7d59('0x2c')]?_0x22630f['attributes']:_0x54a8a2[_0x7d59('0x26')];if(_0x5c9594[_0x7d59('0x28')]['includeAll']){_0x22630f[_0x7d59('0x38')]=[{'all':!![]}];}_0x22630f=_['merge']({},_0x22630f,_0x5c9594[_0x7d59('0x34')]);return db['ZohoConfiguration'][_0x7d59('0x3d')](_0x22630f)[_0x7d59('0x1e')](handleEntityNotFound(_0x1c2175,null))[_0x7d59('0x1e')](respondWithResult(_0x1c2175,null))['catch'](handleError(_0x1c2175,null));};exports[_0x7d59('0x3e')]=function(_0x3250c7,_0x3c1933){return db[_0x7d59('0x35')]['create'](_0x3250c7['body'],{})[_0x7d59('0x1e')](respondWithResult(_0x3c1933,0xc9))[_0x7d59('0x3b')](handleError(_0x3c1933,null));};exports[_0x7d59('0x1c')]=function(_0x454713,_0x5a31b9){if(_0x454713[_0x7d59('0x3f')]['id']){delete _0x454713[_0x7d59('0x3f')]['id'];}return db[_0x7d59('0x35')][_0x7d59('0x3d')]({'where':{'id':_0x454713[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5a31b9,null))['then'](saveUpdates(_0x454713[_0x7d59('0x3f')],null))['then'](respondWithResult(_0x5a31b9,null))[_0x7d59('0x3b')](handleError(_0x5a31b9,null));};exports[_0x7d59('0x1d')]=function(_0x1824d2,_0x5449eb){return db[_0x7d59('0x35')][_0x7d59('0x3d')]({'where':{'id':_0x1824d2[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5449eb,null))[_0x7d59('0x1e')](removeEntity(_0x5449eb,null))['catch'](handleError(_0x5449eb,null));};exports['getFields']=function(_0x5eacf3,_0x50d295,_0x71a39a){var _0x23516c={};var _0x107cce={};var _0x1c1649;var _0x5ed008;return db[_0x7d59('0x35')][_0x7d59('0x40')]({'where':{'id':_0x5eacf3['params']['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x50d295,null))['then'](function(_0x5eebf6){if(_0x5eebf6){_0x1c1649=_0x5eebf6;_0x107cce[_0x7d59('0x26')]=_[_0x7d59('0x27')](db['ZohoField'][_0x7d59('0x22')]);_0x107cce['query']=_['keys'](_0x5eacf3['query']);_0x107cce[_0x7d59('0x30')]=_[_0x7d59('0x29')](_0x107cce[_0x7d59('0x26')],_0x107cce[_0x7d59('0x28')]);_0x23516c[_0x7d59('0x2a')]=_['intersection'](_0x107cce[_0x7d59('0x26')],qs['fields'](_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x23516c['attributes']=_0x23516c[_0x7d59('0x2a')][_0x7d59('0x2c')]?_0x23516c[_0x7d59('0x2a')]:_0x107cce[_0x7d59('0x26')];_0x23516c[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x5eacf3['query']['sort']);_0x23516c[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x5eacf3[_0x7d59('0x28')],_0x107cce[_0x7d59('0x30')]));if(_0x5eacf3[_0x7d59('0x28')]['filter']){_0x23516c[_0x7d59('0x2f')]=_[_0x7d59('0x32')](_0x23516c[_0x7d59('0x2f')],{'$or':_['map'](_0x23516c[_0x7d59('0x2a')],function(_0x3d393b){var _0x4f6b7c={};_0x4f6b7c[_0x3d393b]={'$like':'%'+_0x5eacf3[_0x7d59('0x28')]['filter']+'%'};return _0x4f6b7c;})});}_0x23516c=_['merge']({},_0x23516c,_0x5eacf3[_0x7d59('0x34')]);return _0x1c1649[_0x7d59('0x42')](_0x23516c);}})['then'](function(_0x6df241){if(_0x6df241){_0x5ed008=_0x6df241['length'];if(!_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x43')](_0x7d59('0x44'))){_0x23516c[_0x7d59('0x17')]=qs[_0x7d59('0x17')](_0x5eacf3[_0x7d59('0x28')][_0x7d59('0x17')]);_0x23516c['offset']=qs[_0x7d59('0x15')](_0x5eacf3[_0x7d59('0x28')]['offset']);}return _0x1c1649[_0x7d59('0x42')](_0x23516c);}})['then'](function(_0xe04858){if(_0xe04858){return _0xe04858?{'count':_0x5ed008,'rows':_0xe04858}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x50d295,null))[_0x7d59('0x3b')](handleError(_0x50d295,null));};exports['getSubjects']=function(_0x29f1c7,_0x510f2a,_0x17bdc6){var _0x3df1b0={};var _0x50211f={};var _0x57a74e;var _0x66f653;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x29f1c7[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x510f2a,null))['then'](function(_0x560910){if(_0x560910){_0x57a74e=_0x560910;_0x50211f[_0x7d59('0x26')]=_[_0x7d59('0x27')](db[_0x7d59('0x45')][_0x7d59('0x22')]);_0x50211f[_0x7d59('0x28')]=_[_0x7d59('0x27')](_0x29f1c7[_0x7d59('0x28')]);_0x50211f[_0x7d59('0x30')]=_['intersection'](_0x50211f[_0x7d59('0x26')],_0x50211f[_0x7d59('0x28')]);_0x3df1b0['attributes']=_[_0x7d59('0x29')](_0x50211f['model'],qs[_0x7d59('0x2b')](_0x29f1c7['query'][_0x7d59('0x2b')]));_0x3df1b0[_0x7d59('0x2a')]=_0x3df1b0[_0x7d59('0x2a')]['length']?_0x3df1b0[_0x7d59('0x2a')]:_0x50211f[_0x7d59('0x26')];_0x3df1b0[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x29f1c7['query'][_0x7d59('0x2e')]);_0x3df1b0[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x29f1c7['query'],_0x50211f[_0x7d59('0x30')]));if(_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x31')]){_0x3df1b0[_0x7d59('0x2f')]=_[_0x7d59('0x32')](_0x3df1b0[_0x7d59('0x2f')],{'$or':_['map'](_0x3df1b0[_0x7d59('0x2a')],function(_0x6456ae){var _0x1cd7ea={};_0x1cd7ea[_0x6456ae]={'$like':'%'+_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x1cd7ea;})});}_0x3df1b0=_['merge']({},_0x3df1b0,_0x29f1c7['options']);return _0x57a74e[_0x7d59('0x46')](_0x3df1b0);}})[_0x7d59('0x1e')](function(_0x1c1ad6){if(_0x1c1ad6){_0x66f653=_0x1c1ad6[_0x7d59('0x2c')];if(!_0x29f1c7['query'][_0x7d59('0x43')](_0x7d59('0x44'))){_0x3df1b0['limit']=qs['limit'](_0x29f1c7[_0x7d59('0x28')]['limit']);_0x3df1b0['offset']=qs[_0x7d59('0x15')](_0x29f1c7[_0x7d59('0x28')][_0x7d59('0x15')]);}return _0x57a74e[_0x7d59('0x46')](_0x3df1b0);}})['then'](function(_0x19b70c){if(_0x19b70c){return _0x19b70c?{'count':_0x66f653,'rows':_0x19b70c}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x510f2a,null))[_0x7d59('0x3b')](handleError(_0x510f2a,null));};exports[_0x7d59('0x47')]=function(_0x120f19,_0x5b89ef,_0x2cada0){var _0x1b3228={};var _0x4ca5e5={};var _0x282241;var _0x1522c7;return db[_0x7d59('0x35')][_0x7d59('0x40')]({'where':{'id':_0x120f19[_0x7d59('0x3c')]['id']}})[_0x7d59('0x1e')](handleEntityNotFound(_0x5b89ef,null))[_0x7d59('0x1e')](function(_0x4edb20){if(_0x4edb20){_0x282241=_0x4edb20;_0x4ca5e5[_0x7d59('0x26')]=_[_0x7d59('0x27')](db[_0x7d59('0x45')]['rawAttributes']);_0x4ca5e5[_0x7d59('0x28')]=_[_0x7d59('0x27')](_0x120f19['query']);_0x4ca5e5[_0x7d59('0x30')]=_[_0x7d59('0x29')](_0x4ca5e5[_0x7d59('0x26')],_0x4ca5e5[_0x7d59('0x28')]);_0x1b3228['attributes']=_['intersection'](_0x4ca5e5[_0x7d59('0x26')],qs[_0x7d59('0x2b')](_0x120f19[_0x7d59('0x28')][_0x7d59('0x2b')]));_0x1b3228['attributes']=_0x1b3228[_0x7d59('0x2a')]['length']?_0x1b3228['attributes']:_0x4ca5e5['model'];_0x1b3228[_0x7d59('0x2d')]=qs[_0x7d59('0x2e')](_0x120f19[_0x7d59('0x28')][_0x7d59('0x2e')]);_0x1b3228[_0x7d59('0x2f')]=qs[_0x7d59('0x30')](_[_0x7d59('0x41')](_0x120f19[_0x7d59('0x28')],_0x4ca5e5[_0x7d59('0x30')]));if(_0x120f19[_0x7d59('0x28')][_0x7d59('0x31')]){_0x1b3228[_0x7d59('0x2f')]=_['merge'](_0x1b3228[_0x7d59('0x2f')],{'$or':_[_0x7d59('0x21')](_0x1b3228[_0x7d59('0x2a')],function(_0x12ec02){var _0x3ed201={};_0x3ed201[_0x12ec02]={'$like':'%'+_0x120f19[_0x7d59('0x28')][_0x7d59('0x31')]+'%'};return _0x3ed201;})});}_0x1b3228=_[_0x7d59('0x32')]({},_0x1b3228,_0x120f19['options']);return _0x282241[_0x7d59('0x47')](_0x1b3228);}})[_0x7d59('0x1e')](function(_0x53f0de){if(_0x53f0de){_0x1522c7=_0x53f0de[_0x7d59('0x2c')];if(!_0x120f19[_0x7d59('0x28')][_0x7d59('0x43')](_0x7d59('0x44'))){_0x1b3228[_0x7d59('0x17')]=qs['limit'](_0x120f19[_0x7d59('0x28')][_0x7d59('0x17')]);_0x1b3228['offset']=qs[_0x7d59('0x15')](_0x120f19[_0x7d59('0x28')]['offset']);}return _0x282241[_0x7d59('0x47')](_0x1b3228);}})[_0x7d59('0x1e')](function(_0x4ccb0e){if(_0x4ccb0e){return _0x4ccb0e?{'count':_0x1522c7,'rows':_0x4ccb0e}:null;}})[_0x7d59('0x1e')](respondWithResult(_0x5b89ef,null))[_0x7d59('0x3b')](handleError(_0x5b89ef,null));}; \ No newline at end of file +var _0x766d=['attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','show','rawAttributes','options','find','create','body','params','getFields','ZohoField','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZohoConfiguration','fieldName','map','keys','query','filters','model'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x766d,0x155));var _0xd766=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x766d[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xd766('0x0'));var rimraf=require(_0xd766('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd766('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd766('0x3'));var Mustache=require('mustache');var util=require(_0xd766('0x4'));var path=require(_0xd766('0x5'));var sox=require(_0xd766('0x6'));var csv=require(_0xd766('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd766('0x8'));var _=require(_0xd766('0x9'));var squel=require('squel');var crypto=require(_0xd766('0xa'));var jsforce=require(_0xd766('0xb'));var deskjs=require(_0xd766('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd766('0xd'));var Redis=require(_0xd766('0xe'));var authService=require(_0xd766('0xf'));var qs=require(_0xd766('0x10'));var as=require(_0xd766('0x11'));var hardwareService=require(_0xd766('0x12'));var logger=require(_0xd766('0x13'))(_0xd766('0x14'));var utils=require('../../config/utils');var config=require(_0xd766('0x15'));var licenseUtil=require(_0xd766('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e6867,_0x5308d8){_0x5308d8=_0x5308d8||0xcc;return function(_0x47d830){if(_0x47d830){return _0x1e6867['sendStatus'](_0x5308d8);}return _0x1e6867[_0xd766('0x17')](_0x5308d8)[_0xd766('0x18')]();};}function respondWithResult(_0x1d73e9,_0x35a682){_0x35a682=_0x35a682||0xc8;return function(_0x2d04b7){if(_0x2d04b7){return _0x1d73e9['status'](_0x35a682)[_0xd766('0x19')](_0x2d04b7);}};}function respondWithFilteredResult(_0x2cb38d,_0x115d10){return function(_0x5a4dfa){if(_0x5a4dfa){var _0x7c6307=typeof _0x115d10[_0xd766('0x1a')]===_0xd766('0x1b')&&typeof _0x115d10[_0xd766('0x1c')]===_0xd766('0x1b');var _0x7a14a7=_0x5a4dfa[_0xd766('0x1d')];var _0x492ab2=_0x7c6307?0x0:_0x115d10[_0xd766('0x1a')];var _0x484428=_0x7c6307?_0x5a4dfa[_0xd766('0x1d')]:_0x115d10[_0xd766('0x1a')]+_0x115d10[_0xd766('0x1c')];var _0x4e19af;if(_0x484428>=_0x7a14a7){_0x484428=_0x7a14a7;_0x4e19af=0xc8;}else{_0x4e19af=0xce;}_0x2cb38d[_0xd766('0x17')](_0x4e19af);return _0x2cb38d['set'](_0xd766('0x1e'),_0x492ab2+'-'+_0x484428+'/'+_0x7a14a7)[_0xd766('0x19')](_0x5a4dfa);}return null;};}function patchUpdates(_0x47747a){return function(_0x116467){try{jsonpatch['apply'](_0x116467,_0x47747a,!![]);}catch(_0x4e1c1e){return BPromise[_0xd766('0x1f')](_0x4e1c1e);}return _0x116467[_0xd766('0x20')]();};}function saveUpdates(_0x2c9d51,_0x3a65ec){return function(_0x822345){if(_0x822345){return _0x822345[_0xd766('0x21')](_0x2c9d51)[_0xd766('0x22')](function(_0x1969ed){return _0x1969ed;});}return null;};}function removeEntity(_0x524298,_0x3de17a){return function(_0x43c43d){if(_0x43c43d){return _0x43c43d[_0xd766('0x23')]()[_0xd766('0x22')](function(){_0x524298['status'](0xcc)[_0xd766('0x18')]();});}};}function handleEntityNotFound(_0x10284c,_0x4e1bfc){return function(_0x4703a5){if(!_0x4703a5){_0x10284c[_0xd766('0x24')](0x194);}return _0x4703a5;};}function handleError(_0x171868,_0x118c7f){_0x118c7f=_0x118c7f||0x1f4;return function(_0x545cd3){logger[_0xd766('0x25')](_0x545cd3[_0xd766('0x26')]);if(_0x545cd3[_0xd766('0x27')]){delete _0x545cd3[_0xd766('0x27')];}_0x171868['status'](_0x118c7f)[_0xd766('0x28')](_0x545cd3);};}exports[_0xd766('0x29')]=function(_0x1f4c53,_0xc18aaf){var _0x137e5c={},_0x594401={},_0x1f3f19={'count':0x0,'rows':[]};var _0x2d5abc=_['map'](db[_0xd766('0x2a')]['rawAttributes'],function(_0x443e19){return{'name':_0x443e19[_0xd766('0x2b')],'type':_0x443e19['type']['key']};});_0x594401['model']=_[_0xd766('0x2c')](_0x2d5abc,_0xd766('0x27'));_0x594401['query']=_[_0xd766('0x2d')](_0x1f4c53[_0xd766('0x2e')]);_0x594401[_0xd766('0x2f')]=_['intersection'](_0x594401[_0xd766('0x30')],_0x594401[_0xd766('0x2e')]);_0x137e5c[_0xd766('0x31')]=_[_0xd766('0x32')](_0x594401['model'],qs['fields'](_0x1f4c53[_0xd766('0x2e')][_0xd766('0x33')]));_0x137e5c[_0xd766('0x31')]=_0x137e5c[_0xd766('0x31')][_0xd766('0x34')]?_0x137e5c[_0xd766('0x31')]:_0x594401[_0xd766('0x30')];if(!_0x1f4c53['query']['hasOwnProperty'](_0xd766('0x35'))){_0x137e5c[_0xd766('0x1c')]=qs[_0xd766('0x1c')](_0x1f4c53[_0xd766('0x2e')][_0xd766('0x1c')]);_0x137e5c['offset']=qs[_0xd766('0x1a')](_0x1f4c53[_0xd766('0x2e')]['offset']);}_0x137e5c[_0xd766('0x36')]=qs[_0xd766('0x37')](_0x1f4c53[_0xd766('0x2e')][_0xd766('0x37')]);_0x137e5c[_0xd766('0x38')]=qs['filters'](_[_0xd766('0x39')](_0x1f4c53['query'],_0x594401[_0xd766('0x2f')]),_0x2d5abc);if(_0x1f4c53[_0xd766('0x2e')][_0xd766('0x3a')]){_0x137e5c[_0xd766('0x38')]=_['merge'](_0x137e5c['where'],{'$or':_[_0xd766('0x2c')](_0x2d5abc,function(_0x204491){if(_0x204491['type']!==_0xd766('0x3b')){var _0x1d06fd={};_0x1d06fd[_0x204491[_0xd766('0x27')]]={'$like':'%'+_0x1f4c53['query'][_0xd766('0x3a')]+'%'};return _0x1d06fd;}})});}_0x137e5c=_[_0xd766('0x3c')]({},_0x137e5c,_0x1f4c53['options']);var _0x174896={'where':_0x137e5c[_0xd766('0x38')]};return db[_0xd766('0x2a')][_0xd766('0x1d')](_0x174896)[_0xd766('0x22')](function(_0x5a545e){_0x1f3f19[_0xd766('0x1d')]=_0x5a545e;if(_0x1f4c53[_0xd766('0x2e')]['includeAll']){_0x137e5c[_0xd766('0x3d')]=[{'all':!![]}];}return db[_0xd766('0x2a')][_0xd766('0x3e')](_0x137e5c);})[_0xd766('0x22')](function(_0x11bdb3){_0x1f3f19[_0xd766('0x3f')]=_0x11bdb3;return _0x1f3f19;})[_0xd766('0x22')](respondWithFilteredResult(_0xc18aaf,_0x137e5c))[_0xd766('0x40')](handleError(_0xc18aaf,null));};exports[_0xd766('0x41')]=function(_0x166751,_0x48aea8){var _0x5007be={'raw':![],'where':{'id':_0x166751['params']['id']}},_0x337702={};_0x337702['model']=_[_0xd766('0x2d')](db['ZohoConfiguration'][_0xd766('0x42')]);_0x337702[_0xd766('0x2e')]=_['keys'](_0x166751[_0xd766('0x2e')]);_0x337702[_0xd766('0x2f')]=_['intersection'](_0x337702[_0xd766('0x30')],_0x337702[_0xd766('0x2e')]);_0x5007be[_0xd766('0x31')]=_[_0xd766('0x32')](_0x337702[_0xd766('0x30')],qs[_0xd766('0x33')](_0x166751[_0xd766('0x2e')][_0xd766('0x33')]));_0x5007be[_0xd766('0x31')]=_0x5007be['attributes']['length']?_0x5007be[_0xd766('0x31')]:_0x337702[_0xd766('0x30')];if(_0x166751['query']['includeAll']){_0x5007be[_0xd766('0x3d')]=[{'all':!![]}];}_0x5007be=_[_0xd766('0x3c')]({},_0x5007be,_0x166751[_0xd766('0x43')]);return db[_0xd766('0x2a')][_0xd766('0x44')](_0x5007be)['then'](handleEntityNotFound(_0x48aea8,null))['then'](respondWithResult(_0x48aea8,null))[_0xd766('0x40')](handleError(_0x48aea8,null));};exports['create']=function(_0x28b98d,_0x2e24eb){return db[_0xd766('0x2a')][_0xd766('0x45')](_0x28b98d[_0xd766('0x46')],{})[_0xd766('0x22')](respondWithResult(_0x2e24eb,0xc9))['catch'](handleError(_0x2e24eb,null));};exports[_0xd766('0x21')]=function(_0x93c88f,_0xc286a8){if(_0x93c88f[_0xd766('0x46')]['id']){delete _0x93c88f[_0xd766('0x46')]['id'];}return db[_0xd766('0x2a')][_0xd766('0x44')]({'where':{'id':_0x93c88f[_0xd766('0x47')]['id']}})[_0xd766('0x22')](handleEntityNotFound(_0xc286a8,null))['then'](saveUpdates(_0x93c88f[_0xd766('0x46')],null))[_0xd766('0x22')](respondWithResult(_0xc286a8,null))[_0xd766('0x40')](handleError(_0xc286a8,null));};exports['destroy']=function(_0x472a80,_0x173333){return db[_0xd766('0x2a')][_0xd766('0x44')]({'where':{'id':_0x472a80[_0xd766('0x47')]['id']}})[_0xd766('0x22')](handleEntityNotFound(_0x173333,null))[_0xd766('0x22')](removeEntity(_0x173333,null))[_0xd766('0x40')](handleError(_0x173333,null));};exports[_0xd766('0x48')]=function(_0x20e1b7,_0xcb9b60,_0x1c05ec){var _0x2fb2a1={};var _0x3f2e8d={};var _0x33912a;var _0x43a2a5;return db[_0xd766('0x2a')]['findOne']({'where':{'id':_0x20e1b7[_0xd766('0x47')]['id']}})[_0xd766('0x22')](handleEntityNotFound(_0xcb9b60,null))[_0xd766('0x22')](function(_0x495a33){if(_0x495a33){_0x33912a=_0x495a33;_0x3f2e8d['model']=_[_0xd766('0x2d')](db[_0xd766('0x49')]['rawAttributes']);_0x3f2e8d[_0xd766('0x2e')]=_['keys'](_0x20e1b7[_0xd766('0x2e')]);_0x3f2e8d['filters']=_[_0xd766('0x32')](_0x3f2e8d['model'],_0x3f2e8d['query']);_0x2fb2a1[_0xd766('0x31')]=_[_0xd766('0x32')](_0x3f2e8d[_0xd766('0x30')],qs[_0xd766('0x33')](_0x20e1b7['query'][_0xd766('0x33')]));_0x2fb2a1[_0xd766('0x31')]=_0x2fb2a1[_0xd766('0x31')][_0xd766('0x34')]?_0x2fb2a1[_0xd766('0x31')]:_0x3f2e8d[_0xd766('0x30')];_0x2fb2a1['order']=qs[_0xd766('0x37')](_0x20e1b7[_0xd766('0x2e')]['sort']);_0x2fb2a1[_0xd766('0x38')]=qs[_0xd766('0x2f')](_[_0xd766('0x39')](_0x20e1b7[_0xd766('0x2e')],_0x3f2e8d[_0xd766('0x2f')]));if(_0x20e1b7[_0xd766('0x2e')][_0xd766('0x3a')]){_0x2fb2a1[_0xd766('0x38')]=_['merge'](_0x2fb2a1['where'],{'$or':_[_0xd766('0x2c')](_0x2fb2a1['attributes'],function(_0x2ba980){var _0x5428e7={};_0x5428e7[_0x2ba980]={'$like':'%'+_0x20e1b7[_0xd766('0x2e')][_0xd766('0x3a')]+'%'};return _0x5428e7;})});}_0x2fb2a1=_[_0xd766('0x3c')]({},_0x2fb2a1,_0x20e1b7[_0xd766('0x43')]);return _0x33912a[_0xd766('0x48')](_0x2fb2a1);}})['then'](function(_0x584bff){if(_0x584bff){_0x43a2a5=_0x584bff[_0xd766('0x34')];if(!_0x20e1b7[_0xd766('0x2e')][_0xd766('0x4a')]('nolimit')){_0x2fb2a1['limit']=qs[_0xd766('0x1c')](_0x20e1b7[_0xd766('0x2e')]['limit']);_0x2fb2a1['offset']=qs[_0xd766('0x1a')](_0x20e1b7['query'][_0xd766('0x1a')]);}return _0x33912a['getFields'](_0x2fb2a1);}})[_0xd766('0x22')](function(_0x277a2a){if(_0x277a2a){return _0x277a2a?{'count':_0x43a2a5,'rows':_0x277a2a}:null;}})[_0xd766('0x22')](respondWithResult(_0xcb9b60,null))[_0xd766('0x40')](handleError(_0xcb9b60,null));};exports[_0xd766('0x4b')]=function(_0x1b6e69,_0x4cb3c2,_0x5b1ea6){var _0x4b369d={};var _0x4ed383={};var _0x39b108;var _0x3f7a65;return db['ZohoConfiguration'][_0xd766('0x4c')]({'where':{'id':_0x1b6e69['params']['id']}})['then'](handleEntityNotFound(_0x4cb3c2,null))[_0xd766('0x22')](function(_0xce4bdf){if(_0xce4bdf){_0x39b108=_0xce4bdf;_0x4ed383[_0xd766('0x30')]=_['keys'](db[_0xd766('0x49')][_0xd766('0x42')]);_0x4ed383[_0xd766('0x2e')]=_[_0xd766('0x2d')](_0x1b6e69['query']);_0x4ed383['filters']=_['intersection'](_0x4ed383[_0xd766('0x30')],_0x4ed383[_0xd766('0x2e')]);_0x4b369d['attributes']=_[_0xd766('0x32')](_0x4ed383[_0xd766('0x30')],qs[_0xd766('0x33')](_0x1b6e69[_0xd766('0x2e')][_0xd766('0x33')]));_0x4b369d[_0xd766('0x31')]=_0x4b369d[_0xd766('0x31')][_0xd766('0x34')]?_0x4b369d['attributes']:_0x4ed383['model'];_0x4b369d[_0xd766('0x36')]=qs[_0xd766('0x37')](_0x1b6e69[_0xd766('0x2e')][_0xd766('0x37')]);_0x4b369d['where']=qs[_0xd766('0x2f')](_[_0xd766('0x39')](_0x1b6e69[_0xd766('0x2e')],_0x4ed383[_0xd766('0x2f')]));if(_0x1b6e69['query']['filter']){_0x4b369d[_0xd766('0x38')]=_[_0xd766('0x3c')](_0x4b369d[_0xd766('0x38')],{'$or':_[_0xd766('0x2c')](_0x4b369d[_0xd766('0x31')],function(_0x28e258){var _0xad3ac7={};_0xad3ac7[_0x28e258]={'$like':'%'+_0x1b6e69[_0xd766('0x2e')][_0xd766('0x3a')]+'%'};return _0xad3ac7;})});}_0x4b369d=_[_0xd766('0x3c')]({},_0x4b369d,_0x1b6e69['options']);return _0x39b108[_0xd766('0x4b')](_0x4b369d);}})[_0xd766('0x22')](function(_0x2523f9){if(_0x2523f9){_0x3f7a65=_0x2523f9[_0xd766('0x34')];if(!_0x1b6e69[_0xd766('0x2e')][_0xd766('0x4a')](_0xd766('0x35'))){_0x4b369d['limit']=qs[_0xd766('0x1c')](_0x1b6e69[_0xd766('0x2e')][_0xd766('0x1c')]);_0x4b369d[_0xd766('0x1a')]=qs[_0xd766('0x1a')](_0x1b6e69['query'][_0xd766('0x1a')]);}return _0x39b108[_0xd766('0x4b')](_0x4b369d);}})['then'](function(_0x5492d7){if(_0x5492d7){return _0x5492d7?{'count':_0x3f7a65,'rows':_0x5492d7}:null;}})[_0xd766('0x22')](respondWithResult(_0x4cb3c2,null))['catch'](handleError(_0x4cb3c2,null));};exports[_0xd766('0x4d')]=function(_0x31b57a,_0x451f7b,_0xd56131){var _0x50075c={};var _0x645c88={};var _0x345d32;var _0x1241c7;return db[_0xd766('0x2a')][_0xd766('0x4c')]({'where':{'id':_0x31b57a['params']['id']}})[_0xd766('0x22')](handleEntityNotFound(_0x451f7b,null))[_0xd766('0x22')](function(_0x4fa763){if(_0x4fa763){_0x345d32=_0x4fa763;_0x645c88[_0xd766('0x30')]=_[_0xd766('0x2d')](db[_0xd766('0x49')]['rawAttributes']);_0x645c88[_0xd766('0x2e')]=_['keys'](_0x31b57a[_0xd766('0x2e')]);_0x645c88[_0xd766('0x2f')]=_[_0xd766('0x32')](_0x645c88[_0xd766('0x30')],_0x645c88['query']);_0x50075c[_0xd766('0x31')]=_[_0xd766('0x32')](_0x645c88[_0xd766('0x30')],qs['fields'](_0x31b57a[_0xd766('0x2e')][_0xd766('0x33')]));_0x50075c[_0xd766('0x31')]=_0x50075c[_0xd766('0x31')][_0xd766('0x34')]?_0x50075c['attributes']:_0x645c88[_0xd766('0x30')];_0x50075c[_0xd766('0x36')]=qs[_0xd766('0x37')](_0x31b57a[_0xd766('0x2e')]['sort']);_0x50075c[_0xd766('0x38')]=qs[_0xd766('0x2f')](_[_0xd766('0x39')](_0x31b57a[_0xd766('0x2e')],_0x645c88[_0xd766('0x2f')]));if(_0x31b57a['query'][_0xd766('0x3a')]){_0x50075c[_0xd766('0x38')]=_[_0xd766('0x3c')](_0x50075c[_0xd766('0x38')],{'$or':_['map'](_0x50075c[_0xd766('0x31')],function(_0x19b93c){var _0x244cd5={};_0x244cd5[_0x19b93c]={'$like':'%'+_0x31b57a[_0xd766('0x2e')][_0xd766('0x3a')]+'%'};return _0x244cd5;})});}_0x50075c=_['merge']({},_0x50075c,_0x31b57a[_0xd766('0x43')]);return _0x345d32[_0xd766('0x4d')](_0x50075c);}})[_0xd766('0x22')](function(_0x2446f8){if(_0x2446f8){_0x1241c7=_0x2446f8['length'];if(!_0x31b57a[_0xd766('0x2e')][_0xd766('0x4a')](_0xd766('0x35'))){_0x50075c[_0xd766('0x1c')]=qs[_0xd766('0x1c')](_0x31b57a[_0xd766('0x2e')][_0xd766('0x1c')]);_0x50075c['offset']=qs['offset'](_0x31b57a['query'][_0xd766('0x1a')]);}return _0x345d32[_0xd766('0x4d')](_0x50075c);}})[_0xd766('0x22')](function(_0x33e931){if(_0x33e931){return _0x33e931?{'count':_0x1241c7,'rows':_0x33e931}:null;}})[_0xd766('0x22')](respondWithResult(_0x451f7b,null))[_0xd766('0x40')](handleError(_0x451f7b,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d687b86..cfde1ab 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 _0xf030=['exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xf030,0x1bd));var _0x0f03=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf030[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x0f03('0x0'));var util=require(_0x0f03('0x1'));var logger=require(_0x0f03('0x2'))(_0x0f03('0x3'));var moment=require(_0x0f03('0x4'));var BPromise=require(_0x0f03('0x5'));var rp=require(_0x0f03('0x6'));var fs=require('fs');var path=require(_0x0f03('0x7'));var rimraf=require('rimraf');var config=require(_0x0f03('0x8'));var attributes=require(_0x0f03('0x9'));module[_0x0f03('0xa')]=function(_0x1fa66c,_0x44a976){return _0x1fa66c['define'](_0x0f03('0xb'),attributes,{'tableName':_0x0f03('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d5d=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations'];(function(_0x43f416,_0x2773f3){var _0x3e91a1=function(_0x50967d){while(--_0x50967d){_0x43f416['push'](_0x43f416['shift']());}};_0x3e91a1(++_0x2773f3);}(_0x1d5d,0xb4));var _0xd1d5=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x1d5d[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0xd1d5('0x0'));var util=require(_0xd1d5('0x1'));var logger=require(_0xd1d5('0x2'))(_0xd1d5('0x3'));var moment=require('moment');var BPromise=require(_0xd1d5('0x4'));var rp=require(_0xd1d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1d5('0x6'));var config=require(_0xd1d5('0x7'));var attributes=require(_0xd1d5('0x8'));module[_0xd1d5('0x9')]=function(_0x3f0481,_0xdf768a){return _0x3f0481[_0xd1d5('0xa')]('ZohoConfiguration',attributes,{'tableName':_0xd1d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4ce52f9..14aa97a 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 _0x5794=['jayson/promise','client','http','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a127f,_0x2b4e71){var _0x2c5268=function(_0x2a5d49){while(--_0x2a5d49){_0x2a127f['push'](_0x2a127f['shift']());}};_0x2c5268(++_0x2b4e71);}(_0x5794,0x108));var _0x4579=function(_0x7fa00a,_0x1c689c){_0x7fa00a=_0x7fa00a-0x0;var _0x1cc856=_0x5794[_0x7fa00a];return _0x1cc856;};'use strict';var _=require('lodash');var util=require(_0x4579('0x0'));var moment=require(_0x4579('0x1'));var BPromise=require(_0x4579('0x2'));var rs=require(_0x4579('0x3'));var fs=require('fs');var Redis=require(_0x4579('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4579('0x5'));var logger=require(_0x4579('0x6'))(_0x4579('0x7'));var config=require(_0x4579('0x8'));var jayson=require(_0x4579('0x9'));var client=jayson[_0x4579('0xa')][_0x4579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ae904,_0x5479d0,_0x4f0c23){return new BPromise(function(_0x4f614a,_0x262923){return client['request'](_0x1ae904,_0x4f0c23)['then'](function(_0x2f6fd4){logger[_0x4579('0xc')](_0x4579('0xd'),_0x5479d0,_0x4579('0xe'));logger[_0x4579('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x5479d0,'request\x20sent',JSON['stringify'](_0x2f6fd4));if(_0x2f6fd4[_0x4579('0x10')]){if(_0x2f6fd4[_0x4579('0x10')][_0x4579('0x11')]===0x1f4){logger[_0x4579('0x10')](_0x4579('0xd'),_0x5479d0,_0x2f6fd4['error']['message']);return _0x262923(_0x2f6fd4['error'][_0x4579('0x12')]);}logger['error'](_0x4579('0xd'),_0x5479d0,_0x2f6fd4[_0x4579('0x10')][_0x4579('0x12')]);return _0x4f614a(_0x2f6fd4['error'][_0x4579('0x12')]);}else{logger['info'](_0x4579('0xd'),_0x5479d0,_0x4579('0xe'));_0x4f614a(_0x2f6fd4[_0x4579('0x13')][_0x4579('0x12')]);}})[_0x4579('0x14')](function(_0x55e3f6){logger['error'](_0x4579('0xd'),_0x5479d0,_0x55e3f6);_0x262923(_0x55e3f6);});});} \ No newline at end of file +var _0x1f24=['../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5151b7,_0x857b27){var _0x154bf3=function(_0x4f8645){while(--_0x4f8645){_0x5151b7['push'](_0x5151b7['shift']());}};_0x154bf3(++_0x857b27);}(_0x1f24,0x6b));var _0x41f2=function(_0x4f35ca,_0x2a8f2b){_0x4f35ca=_0x4f35ca-0x0;var _0x1dc962=_0x1f24[_0x4f35ca];return _0x1dc962;};'use strict';var _=require(_0x41f2('0x0'));var util=require('util');var moment=require(_0x41f2('0x1'));var BPromise=require('bluebird');var rs=require(_0x41f2('0x2'));var fs=require('fs');var Redis=require(_0x41f2('0x3'));var db=require(_0x41f2('0x4'))['db'];var utils=require(_0x41f2('0x5'));var logger=require(_0x41f2('0x6'))(_0x41f2('0x7'));var config=require(_0x41f2('0x8'));var jayson=require(_0x41f2('0x9'));var client=jayson[_0x41f2('0xa')][_0x41f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x449459,_0xd05e64,_0x53ed6c){return new BPromise(function(_0x567850,_0x521e64){return client[_0x41f2('0xc')](_0x449459,_0x53ed6c)['then'](function(_0x295660){logger[_0x41f2('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0xd05e64,'request\x20sent');logger[_0x41f2('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xd05e64,_0x41f2('0xf'),JSON[_0x41f2('0x10')](_0x295660));if(_0x295660[_0x41f2('0x11')]){if(_0x295660['error'][_0x41f2('0x12')]===0x1f4){logger[_0x41f2('0x11')](_0x41f2('0x13'),_0xd05e64,_0x295660[_0x41f2('0x11')][_0x41f2('0x14')]);return _0x521e64(_0x295660[_0x41f2('0x11')][_0x41f2('0x14')]);}logger[_0x41f2('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0xd05e64,_0x295660[_0x41f2('0x11')]['message']);return _0x567850(_0x295660[_0x41f2('0x11')][_0x41f2('0x14')]);}else{logger[_0x41f2('0xd')](_0x41f2('0x13'),_0xd05e64,'request\x20sent');_0x567850(_0x295660[_0x41f2('0x15')][_0x41f2('0x14')]);}})[_0x41f2('0x16')](function(_0x44e410){logger['error'](_0x41f2('0x13'),_0xd05e64,_0x44e410);_0x521e64(_0x44e410);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 03b652e..ba3fcb6 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 _0xf8b5=['Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x291aae,_0x18ac93){var _0x10bc29=function(_0x3dfe70){while(--_0x3dfe70){_0x291aae['push'](_0x291aae['shift']());}};_0x10bc29(++_0x18ac93);}(_0xf8b5,0x9e));var _0x5f8b=function(_0x394d0f,_0x15b6a5){_0x394d0f=_0x394d0f-0x0;var _0x59a66e=_0xf8b5[_0x394d0f];return _0x59a66e;};'use strict';var multer=require(_0x5f8b('0x0'));var util=require('util');var path=require(_0x5f8b('0x1'));var timeout=require(_0x5f8b('0x2'));var express=require(_0x5f8b('0x3'));var router=express[_0x5f8b('0x4')]();var fs_extra=require(_0x5f8b('0x5'));var auth=require(_0x5f8b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f8b('0x7'));var controller=require('./intZohoField.controller');router['get']('/',auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x9')]);router[_0x5f8b('0xa')](_0x5f8b('0xb'),auth['isAuthenticated'](),controller[_0x5f8b('0xc')]);router[_0x5f8b('0xd')]('/',auth[_0x5f8b('0x8')](),controller['create']);router[_0x5f8b('0xe')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0xf')]);router[_0x5f8b('0x10')](_0x5f8b('0xb'),auth[_0x5f8b('0x8')](),controller[_0x5f8b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0680=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','create','delete'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x0680,0x1de));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0068('0x0'));var util=require(_0x0068('0x1'));var path=require(_0x0068('0x2'));var timeout=require(_0x0068('0x3'));var express=require(_0x0068('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0068('0x5'));var interaction=require(_0x0068('0x6'));var config=require(_0x0068('0x7'));var controller=require(_0x0068('0x8'));router[_0x0068('0x9')]('/',auth[_0x0068('0xa')](),controller['index']);router['get'](_0x0068('0xb'),auth['isAuthenticated'](),controller[_0x0068('0xc')]);router['post']('/',auth[_0x0068('0xa')](),controller[_0x0068('0xd')]);router['put'](_0x0068('0xb'),auth[_0x0068('0xa')](),controller['update']);router[_0x0068('0xe')](_0x0068('0xb'),auth[_0x0068('0xa')](),controller[_0x0068('0xf')]);module[_0x0068('0x10')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 8b03ccd..f6888d8 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 _0x82fd=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x59c2cb,_0x671ebb){var _0x4d2910=function(_0x50c769){while(--_0x50c769){_0x59c2cb['push'](_0x59c2cb['shift']());}};_0x4d2910(++_0x671ebb);}(_0x82fd,0x6d));var _0xd82f=function(_0x581e56,_0x1a5593){_0x581e56=_0x581e56-0x0;var _0x41b16e=_0x82fd[_0x581e56];return _0x41b16e;};'use strict';var Sequelize=require(_0xd82f('0x0'));module[_0xd82f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xd82f('0x2'),'variable',_0xd82f('0x3'),_0xd82f('0x4'),_0xd82f('0x5')),'defaultValue':_0xd82f('0x2')},'content':{'type':Sequelize[_0xd82f('0x6')]},'key':{'type':Sequelize[_0xd82f('0x6')]},'keyType':{'type':Sequelize[_0xd82f('0x7')]('string',_0xd82f('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xd82f('0x6')]},'idField':{'type':Sequelize[_0xd82f('0x6')]},'nameField':{'type':Sequelize[_0xd82f('0x6')]},'customField':{'type':Sequelize[_0xd82f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd82f('0x6')]}}; \ No newline at end of file +var _0xf28b=['string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x1d0af1,_0x3ec60c){var _0xda6faa=function(_0x1712b9){while(--_0x1712b9){_0x1d0af1['push'](_0x1d0af1['shift']());}};_0xda6faa(++_0x3ec60c);}(_0xf28b,0x138));var _0xbf28=function(_0x2e1b2a,_0x2a42fa){_0x2e1b2a=_0x2e1b2a-0x0;var _0x4e13a6=_0xf28b[_0x2e1b2a];return _0x4e13a6;};'use strict';var Sequelize=require(_0xbf28('0x0'));module[_0xbf28('0x1')]={'type':{'type':Sequelize[_0xbf28('0x2')](_0xbf28('0x3'),_0xbf28('0x4'),_0xbf28('0x5'),'keyValue',_0xbf28('0x6')),'defaultValue':_0xbf28('0x3')},'content':{'type':Sequelize[_0xbf28('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbf28('0x2')](_0xbf28('0x3'),'variable',_0xbf28('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbf28('0x7')]},'nameField':{'type':Sequelize[_0xbf28('0x7')]},'customField':{'type':Sequelize[_0xbf28('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf28('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 44bcba3..3eb391a 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 _0x2f87=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoField','includeAll','include','findAll','rows','show','params','keys','intersection','find','catch','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x5d6725,_0x3f6ef9){var _0x275399=function(_0x133ac1){while(--_0x133ac1){_0x5d6725['push'](_0x5d6725['shift']());}};_0x275399(++_0x3f6ef9);}(_0x2f87,0xe2));var _0x72f8=function(_0x577ba3,_0xcc7789){_0x577ba3=_0x577ba3-0x0;var _0x5ed224=_0x2f87[_0x577ba3];return _0x5ed224;};'use strict';var emlformat=require(_0x72f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72f8('0x1'));var jsonpatch=require(_0x72f8('0x2'));var rp=require('request-promise');var moment=require(_0x72f8('0x3'));var BPromise=require(_0x72f8('0x4'));var Mustache=require(_0x72f8('0x5'));var util=require(_0x72f8('0x6'));var path=require(_0x72f8('0x7'));var sox=require(_0x72f8('0x8'));var csv=require(_0x72f8('0x9'));var ejs=require(_0x72f8('0xa'));var fs=require('fs');var fs_extra=require(_0x72f8('0xb'));var _=require(_0x72f8('0xc'));var squel=require(_0x72f8('0xd'));var crypto=require(_0x72f8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x72f8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x72f8('0x10'));var Papa=require(_0x72f8('0x11'));var Redis=require(_0x72f8('0x12'));var authService=require(_0x72f8('0x13'));var qs=require(_0x72f8('0x14'));var as=require(_0x72f8('0x15'));var hardwareService=require(_0x72f8('0x16'));var logger=require(_0x72f8('0x17'))(_0x72f8('0x18'));var utils=require('../../config/utils');var config=require(_0x72f8('0x19'));var licenseUtil=require(_0x72f8('0x1a'));var db=require(_0x72f8('0x1b'))['db'];function respondWithStatusCode(_0x2e3781,_0x116b9c){_0x116b9c=_0x116b9c||0xcc;return function(_0x19a0ee){if(_0x19a0ee){return _0x2e3781['sendStatus'](_0x116b9c);}return _0x2e3781[_0x72f8('0x1c')](_0x116b9c)[_0x72f8('0x1d')]();};}function respondWithResult(_0x2db2ab,_0x4430ec){_0x4430ec=_0x4430ec||0xc8;return function(_0x2ef441){if(_0x2ef441){return _0x2db2ab[_0x72f8('0x1c')](_0x4430ec)[_0x72f8('0x1e')](_0x2ef441);}};}function respondWithFilteredResult(_0x1244f9,_0x1e0105){return function(_0x34d355){if(_0x34d355){var _0x58071d=typeof _0x1e0105['offset']===_0x72f8('0x1f')&&typeof _0x1e0105['limit']===_0x72f8('0x1f');var _0x5764f5=_0x34d355[_0x72f8('0x20')];var _0x4a641d=_0x58071d?0x0:_0x1e0105['offset'];var _0x477f48=_0x58071d?_0x34d355[_0x72f8('0x20')]:_0x1e0105[_0x72f8('0x21')]+_0x1e0105[_0x72f8('0x22')];var _0x5a13f7;if(_0x477f48>=_0x5764f5){_0x477f48=_0x5764f5;_0x5a13f7=0xc8;}else{_0x5a13f7=0xce;}_0x1244f9['status'](_0x5a13f7);return _0x1244f9[_0x72f8('0x23')](_0x72f8('0x24'),_0x4a641d+'-'+_0x477f48+'/'+_0x5764f5)[_0x72f8('0x1e')](_0x34d355);}return null;};}function patchUpdates(_0x5f4cf6){return function(_0xbb1af8){try{jsonpatch[_0x72f8('0x25')](_0xbb1af8,_0x5f4cf6,!![]);}catch(_0x5d5aac){return BPromise['reject'](_0x5d5aac);}return _0xbb1af8[_0x72f8('0x26')]();};}function saveUpdates(_0x2c6ed0,_0x3bd17d){return function(_0x5f74a2){if(_0x5f74a2){return _0x5f74a2[_0x72f8('0x27')](_0x2c6ed0)['then'](function(_0x3749f8){return _0x3749f8;});}return null;};}function removeEntity(_0x525011,_0xb4fc26){return function(_0x10f19a){if(_0x10f19a){return _0x10f19a[_0x72f8('0x28')]()[_0x72f8('0x29')](function(){_0x525011['status'](0xcc)[_0x72f8('0x1d')]();});}};}function handleEntityNotFound(_0x5c3a9e,_0x2a4c87){return function(_0x2a30e8){if(!_0x2a30e8){_0x5c3a9e['sendStatus'](0x194);}return _0x2a30e8;};}function handleError(_0xb9eb91,_0x917f72){_0x917f72=_0x917f72||0x1f4;return function(_0x48b511){logger[_0x72f8('0x2a')](_0x48b511[_0x72f8('0x2b')]);if(_0x48b511['name']){delete _0x48b511[_0x72f8('0x2c')];}_0xb9eb91[_0x72f8('0x1c')](_0x917f72)[_0x72f8('0x2d')](_0x48b511);};}exports[_0x72f8('0x2e')]=function(_0x12f001,_0x5f12bd){var _0x4115b9={},_0x21a5fa={},_0x377747={'count':0x0,'rows':[]};var _0x46244a=_[_0x72f8('0x2f')](db['ZohoField'][_0x72f8('0x30')],function(_0x1ef18c){return{'name':_0x1ef18c[_0x72f8('0x31')],'type':_0x1ef18c[_0x72f8('0x32')][_0x72f8('0x33')]};});_0x21a5fa[_0x72f8('0x34')]=_[_0x72f8('0x2f')](_0x46244a,_0x72f8('0x2c'));_0x21a5fa['query']=_['keys'](_0x12f001[_0x72f8('0x35')]);_0x21a5fa[_0x72f8('0x36')]=_['intersection'](_0x21a5fa[_0x72f8('0x34')],_0x21a5fa[_0x72f8('0x35')]);_0x4115b9[_0x72f8('0x37')]=_['intersection'](_0x21a5fa[_0x72f8('0x34')],qs['fields'](_0x12f001['query'][_0x72f8('0x38')]));_0x4115b9[_0x72f8('0x37')]=_0x4115b9[_0x72f8('0x37')][_0x72f8('0x39')]?_0x4115b9[_0x72f8('0x37')]:_0x21a5fa['model'];if(!_0x12f001['query'][_0x72f8('0x3a')](_0x72f8('0x3b'))){_0x4115b9[_0x72f8('0x22')]=qs[_0x72f8('0x22')](_0x12f001['query'][_0x72f8('0x22')]);_0x4115b9[_0x72f8('0x21')]=qs[_0x72f8('0x21')](_0x12f001[_0x72f8('0x35')][_0x72f8('0x21')]);}_0x4115b9[_0x72f8('0x3c')]=qs[_0x72f8('0x3d')](_0x12f001['query'][_0x72f8('0x3d')]);_0x4115b9[_0x72f8('0x3e')]=qs[_0x72f8('0x36')](_[_0x72f8('0x3f')](_0x12f001[_0x72f8('0x35')],_0x21a5fa[_0x72f8('0x36')]),_0x46244a);if(_0x12f001[_0x72f8('0x35')][_0x72f8('0x40')]){_0x4115b9[_0x72f8('0x3e')]=_[_0x72f8('0x41')](_0x4115b9[_0x72f8('0x3e')],{'$or':_['map'](_0x46244a,function(_0x4ca43d){if(_0x4ca43d['type']!==_0x72f8('0x42')){var _0x4480cc={};_0x4480cc[_0x4ca43d[_0x72f8('0x2c')]]={'$like':'%'+_0x12f001[_0x72f8('0x35')][_0x72f8('0x40')]+'%'};return _0x4480cc;}})});}_0x4115b9=_['merge']({},_0x4115b9,_0x12f001[_0x72f8('0x43')]);var _0xa097a0={'where':_0x4115b9[_0x72f8('0x3e')]};return db[_0x72f8('0x44')][_0x72f8('0x20')](_0xa097a0)[_0x72f8('0x29')](function(_0x1885b2){_0x377747[_0x72f8('0x20')]=_0x1885b2;if(_0x12f001['query'][_0x72f8('0x45')]){_0x4115b9[_0x72f8('0x46')]=[{'all':!![]}];}return db['ZohoField'][_0x72f8('0x47')](_0x4115b9);})[_0x72f8('0x29')](function(_0x3d1a80){_0x377747[_0x72f8('0x48')]=_0x3d1a80;return _0x377747;})[_0x72f8('0x29')](respondWithFilteredResult(_0x5f12bd,_0x4115b9))['catch'](handleError(_0x5f12bd,null));};exports[_0x72f8('0x49')]=function(_0x42e627,_0x5d137f){var _0xe85838={'raw':!![],'where':{'id':_0x42e627[_0x72f8('0x4a')]['id']}},_0x1dcf58={};_0x1dcf58['model']=_[_0x72f8('0x4b')](db[_0x72f8('0x44')][_0x72f8('0x30')]);_0x1dcf58[_0x72f8('0x35')]=_['keys'](_0x42e627[_0x72f8('0x35')]);_0x1dcf58[_0x72f8('0x36')]=_[_0x72f8('0x4c')](_0x1dcf58[_0x72f8('0x34')],_0x1dcf58[_0x72f8('0x35')]);_0xe85838[_0x72f8('0x37')]=_[_0x72f8('0x4c')](_0x1dcf58[_0x72f8('0x34')],qs[_0x72f8('0x38')](_0x42e627[_0x72f8('0x35')]['fields']));_0xe85838[_0x72f8('0x37')]=_0xe85838[_0x72f8('0x37')][_0x72f8('0x39')]?_0xe85838[_0x72f8('0x37')]:_0x1dcf58[_0x72f8('0x34')];if(_0x42e627['query'][_0x72f8('0x45')]){_0xe85838[_0x72f8('0x46')]=[{'all':!![]}];}_0xe85838=_[_0x72f8('0x41')]({},_0xe85838,_0x42e627['options']);return db[_0x72f8('0x44')][_0x72f8('0x4d')](_0xe85838)[_0x72f8('0x29')](handleEntityNotFound(_0x5d137f,null))[_0x72f8('0x29')](respondWithResult(_0x5d137f,null))[_0x72f8('0x4e')](handleError(_0x5d137f,null));};exports[_0x72f8('0x4f')]=function(_0x1e89af,_0x56bfa4){return db[_0x72f8('0x44')][_0x72f8('0x4f')](_0x1e89af[_0x72f8('0x50')],{})[_0x72f8('0x29')](respondWithResult(_0x56bfa4,0xc9))[_0x72f8('0x4e')](handleError(_0x56bfa4,null));};exports['update']=function(_0x1b8226,_0xa6770){if(_0x1b8226[_0x72f8('0x50')]['id']){delete _0x1b8226['body']['id'];}return db['ZohoField'][_0x72f8('0x4d')]({'where':{'id':_0x1b8226['params']['id']}})[_0x72f8('0x29')](handleEntityNotFound(_0xa6770,null))[_0x72f8('0x29')](saveUpdates(_0x1b8226[_0x72f8('0x50')],null))['then'](respondWithResult(_0xa6770,null))[_0x72f8('0x4e')](handleError(_0xa6770,null));};exports[_0x72f8('0x28')]=function(_0xa7dcf5,_0x2ee94c){return db[_0x72f8('0x44')]['find']({'where':{'id':_0xa7dcf5['params']['id']}})['then'](handleEntityNotFound(_0x2ee94c,null))['then'](removeEntity(_0x2ee94c,null))[_0x72f8('0x4e')](handleError(_0x2ee94c,null));}; \ No newline at end of file +var _0x7f22=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','ZohoField','rawAttributes','fieldName','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','find','create','body','eml-format','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/license/hardware','api','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f22,0xc8));var _0x27f2=function(_0x38d700,_0x54bcfd){_0x38d700=_0x38d700-0x0;var _0x644bc2=_0x7f22[_0x38d700];return _0x644bc2;};'use strict';var emlformat=require(_0x27f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x27f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27f2('0x2'));var moment=require(_0x27f2('0x3'));var BPromise=require(_0x27f2('0x4'));var Mustache=require(_0x27f2('0x5'));var util=require(_0x27f2('0x6'));var path=require(_0x27f2('0x7'));var sox=require(_0x27f2('0x8'));var csv=require('to-csv');var ejs=require(_0x27f2('0x9'));var fs=require('fs');var fs_extra=require(_0x27f2('0xa'));var _=require(_0x27f2('0xb'));var squel=require(_0x27f2('0xc'));var crypto=require(_0x27f2('0xd'));var jsforce=require(_0x27f2('0xe'));var deskjs=require(_0x27f2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x27f2('0x10'));var Papa=require(_0x27f2('0x11'));var Redis=require(_0x27f2('0x12'));var authService=require(_0x27f2('0x13'));var qs=require(_0x27f2('0x14'));var as=require(_0x27f2('0x15'));var hardwareService=require(_0x27f2('0x16'));var logger=require('../../config/logger')(_0x27f2('0x17'));var utils=require('../../config/utils');var config=require(_0x27f2('0x18'));var licenseUtil=require(_0x27f2('0x19'));var db=require(_0x27f2('0x1a'))['db'];function respondWithStatusCode(_0x11f29e,_0x1cb4ce){_0x1cb4ce=_0x1cb4ce||0xcc;return function(_0x5d2daf){if(_0x5d2daf){return _0x11f29e[_0x27f2('0x1b')](_0x1cb4ce);}return _0x11f29e[_0x27f2('0x1c')](_0x1cb4ce)['end']();};}function respondWithResult(_0x395e01,_0x319156){_0x319156=_0x319156||0xc8;return function(_0x374949){if(_0x374949){return _0x395e01[_0x27f2('0x1c')](_0x319156)['json'](_0x374949);}};}function respondWithFilteredResult(_0x27535f,_0x9d9a9b){return function(_0x4fc122){if(_0x4fc122){var _0x1f3c07=typeof _0x9d9a9b[_0x27f2('0x1d')]===_0x27f2('0x1e')&&typeof _0x9d9a9b[_0x27f2('0x1f')]===_0x27f2('0x1e');var _0x49ab6e=_0x4fc122['count'];var _0x244b14=_0x1f3c07?0x0:_0x9d9a9b[_0x27f2('0x1d')];var _0x4d04e2=_0x1f3c07?_0x4fc122[_0x27f2('0x20')]:_0x9d9a9b[_0x27f2('0x1d')]+_0x9d9a9b[_0x27f2('0x1f')];var _0x18e217;if(_0x4d04e2>=_0x49ab6e){_0x4d04e2=_0x49ab6e;_0x18e217=0xc8;}else{_0x18e217=0xce;}_0x27535f['status'](_0x18e217);return _0x27535f['set'](_0x27f2('0x21'),_0x244b14+'-'+_0x4d04e2+'/'+_0x49ab6e)[_0x27f2('0x22')](_0x4fc122);}return null;};}function patchUpdates(_0x3efdac){return function(_0x49967a){try{jsonpatch['apply'](_0x49967a,_0x3efdac,!![]);}catch(_0xddb4ab){return BPromise[_0x27f2('0x23')](_0xddb4ab);}return _0x49967a[_0x27f2('0x24')]();};}function saveUpdates(_0x1e8b7a,_0x2b2cc4){return function(_0x2f6763){if(_0x2f6763){return _0x2f6763[_0x27f2('0x25')](_0x1e8b7a)[_0x27f2('0x26')](function(_0x22a1ca){return _0x22a1ca;});}return null;};}function removeEntity(_0x223a3a,_0x357979){return function(_0x4751c7){if(_0x4751c7){return _0x4751c7[_0x27f2('0x27')]()[_0x27f2('0x26')](function(){_0x223a3a[_0x27f2('0x1c')](0xcc)[_0x27f2('0x28')]();});}};}function handleEntityNotFound(_0x3dd52a,_0x14214f){return function(_0x5d2c20){if(!_0x5d2c20){_0x3dd52a[_0x27f2('0x1b')](0x194);}return _0x5d2c20;};}function handleError(_0xa0c52c,_0x53d97a){_0x53d97a=_0x53d97a||0x1f4;return function(_0xa27732){logger[_0x27f2('0x29')](_0xa27732['stack']);if(_0xa27732[_0x27f2('0x2a')]){delete _0xa27732['name'];}_0xa0c52c['status'](_0x53d97a)[_0x27f2('0x2b')](_0xa27732);};}exports['index']=function(_0x39a0aa,_0x540115){var _0x1cde4c={},_0x5aeb45={},_0x58a622={'count':0x0,'rows':[]};var _0x4674b9=_['map'](db[_0x27f2('0x2c')][_0x27f2('0x2d')],function(_0x334751){return{'name':_0x334751[_0x27f2('0x2e')],'type':_0x334751['type']['key']};});_0x5aeb45[_0x27f2('0x2f')]=_[_0x27f2('0x30')](_0x4674b9,'name');_0x5aeb45[_0x27f2('0x31')]=_[_0x27f2('0x32')](_0x39a0aa[_0x27f2('0x31')]);_0x5aeb45['filters']=_['intersection'](_0x5aeb45[_0x27f2('0x2f')],_0x5aeb45[_0x27f2('0x31')]);_0x1cde4c[_0x27f2('0x33')]=_[_0x27f2('0x34')](_0x5aeb45[_0x27f2('0x2f')],qs[_0x27f2('0x35')](_0x39a0aa['query'][_0x27f2('0x35')]));_0x1cde4c[_0x27f2('0x33')]=_0x1cde4c[_0x27f2('0x33')]['length']?_0x1cde4c['attributes']:_0x5aeb45['model'];if(!_0x39a0aa[_0x27f2('0x31')][_0x27f2('0x36')](_0x27f2('0x37'))){_0x1cde4c[_0x27f2('0x1f')]=qs[_0x27f2('0x1f')](_0x39a0aa[_0x27f2('0x31')][_0x27f2('0x1f')]);_0x1cde4c[_0x27f2('0x1d')]=qs[_0x27f2('0x1d')](_0x39a0aa[_0x27f2('0x31')][_0x27f2('0x1d')]);}_0x1cde4c[_0x27f2('0x38')]=qs[_0x27f2('0x39')](_0x39a0aa[_0x27f2('0x31')][_0x27f2('0x39')]);_0x1cde4c[_0x27f2('0x3a')]=qs[_0x27f2('0x3b')](_[_0x27f2('0x3c')](_0x39a0aa[_0x27f2('0x31')],_0x5aeb45[_0x27f2('0x3b')]),_0x4674b9);if(_0x39a0aa['query']['filter']){_0x1cde4c[_0x27f2('0x3a')]=_['merge'](_0x1cde4c[_0x27f2('0x3a')],{'$or':_[_0x27f2('0x30')](_0x4674b9,function(_0x22c0d3){if(_0x22c0d3[_0x27f2('0x3d')]!==_0x27f2('0x3e')){var _0x309f75={};_0x309f75[_0x22c0d3[_0x27f2('0x2a')]]={'$like':'%'+_0x39a0aa[_0x27f2('0x31')][_0x27f2('0x3f')]+'%'};return _0x309f75;}})});}_0x1cde4c=_[_0x27f2('0x40')]({},_0x1cde4c,_0x39a0aa[_0x27f2('0x41')]);var _0x49e331={'where':_0x1cde4c[_0x27f2('0x3a')]};return db[_0x27f2('0x2c')]['count'](_0x49e331)[_0x27f2('0x26')](function(_0x5a7d4c){_0x58a622['count']=_0x5a7d4c;if(_0x39a0aa[_0x27f2('0x31')]['includeAll']){_0x1cde4c[_0x27f2('0x42')]=[{'all':!![]}];}return db[_0x27f2('0x2c')][_0x27f2('0x43')](_0x1cde4c);})[_0x27f2('0x26')](function(_0x3a5a9e){_0x58a622[_0x27f2('0x44')]=_0x3a5a9e;return _0x58a622;})['then'](respondWithFilteredResult(_0x540115,_0x1cde4c))[_0x27f2('0x45')](handleError(_0x540115,null));};exports[_0x27f2('0x46')]=function(_0x44ba56,_0x46a384){var _0x57d264={'raw':!![],'where':{'id':_0x44ba56[_0x27f2('0x47')]['id']}},_0x2dc333={};_0x2dc333['model']=_[_0x27f2('0x32')](db['ZohoField'][_0x27f2('0x2d')]);_0x2dc333[_0x27f2('0x31')]=_['keys'](_0x44ba56['query']);_0x2dc333['filters']=_[_0x27f2('0x34')](_0x2dc333[_0x27f2('0x2f')],_0x2dc333[_0x27f2('0x31')]);_0x57d264[_0x27f2('0x33')]=_['intersection'](_0x2dc333[_0x27f2('0x2f')],qs['fields'](_0x44ba56[_0x27f2('0x31')][_0x27f2('0x35')]));_0x57d264[_0x27f2('0x33')]=_0x57d264[_0x27f2('0x33')]['length']?_0x57d264[_0x27f2('0x33')]:_0x2dc333['model'];if(_0x44ba56[_0x27f2('0x31')]['includeAll']){_0x57d264[_0x27f2('0x42')]=[{'all':!![]}];}_0x57d264=_['merge']({},_0x57d264,_0x44ba56[_0x27f2('0x41')]);return db[_0x27f2('0x2c')][_0x27f2('0x48')](_0x57d264)['then'](handleEntityNotFound(_0x46a384,null))[_0x27f2('0x26')](respondWithResult(_0x46a384,null))[_0x27f2('0x45')](handleError(_0x46a384,null));};exports['create']=function(_0xf940d3,_0x307c09){return db['ZohoField'][_0x27f2('0x49')](_0xf940d3['body'],{})['then'](respondWithResult(_0x307c09,0xc9))[_0x27f2('0x45')](handleError(_0x307c09,null));};exports[_0x27f2('0x25')]=function(_0x51fc9d,_0x1db093){if(_0x51fc9d[_0x27f2('0x4a')]['id']){delete _0x51fc9d[_0x27f2('0x4a')]['id'];}return db[_0x27f2('0x2c')][_0x27f2('0x48')]({'where':{'id':_0x51fc9d[_0x27f2('0x47')]['id']}})[_0x27f2('0x26')](handleEntityNotFound(_0x1db093,null))[_0x27f2('0x26')](saveUpdates(_0x51fc9d['body'],null))[_0x27f2('0x26')](respondWithResult(_0x1db093,null))['catch'](handleError(_0x1db093,null));};exports[_0x27f2('0x27')]=function(_0x308f3a,_0x965798){return db[_0x27f2('0x2c')]['find']({'where':{'id':_0x308f3a['params']['id']}})[_0x27f2('0x26')](handleEntityNotFound(_0x965798,null))[_0x27f2('0x26')](removeEntity(_0x965798,null))[_0x27f2('0x45')](handleError(_0x965798,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index a195149..982213d 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 _0x781d=['rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd781('0x2'));var BPromise=require(_0xd781('0x3'));var rp=require(_0xd781('0x4'));var fs=require('fs');var path=require(_0xd781('0x5'));var rimraf=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var attributes=require(_0xd781('0x8'));module[_0xd781('0x9')]=function(_0x830b,_0x2f98ee){return _0x830b['define'](_0xd781('0xa'),attributes,{'tableName':_0xd781('0xb'),'paranoid':![],'indexes':[{'name':_0xd781('0xc'),'fields':[_0xd781('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x66fa=['rimraf','../../config/environment','define','ZohoField','int_zoho_fields','idField','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x24721a,_0x1ac53c){var _0x6a9880=function(_0x558dc8){while(--_0x558dc8){_0x24721a['push'](_0x24721a['shift']());}};_0x6a9880(++_0x1ac53c);}(_0x66fa,0x117));var _0xa66f=function(_0x3ff4ca,_0x5e580d){_0x3ff4ca=_0x3ff4ca-0x0;var _0x4c578c=_0x66fa[_0x3ff4ca];return _0x4c578c;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var logger=require('../../config/logger')(_0xa66f('0x2'));var moment=require(_0xa66f('0x3'));var BPromise=require(_0xa66f('0x4'));var rp=require(_0xa66f('0x5'));var fs=require('fs');var path=require(_0xa66f('0x6'));var rimraf=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x2239d3,_0x20a150){return _0x2239d3[_0xa66f('0x9')](_0xa66f('0xa'),attributes,{'tableName':_0xa66f('0xb'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xa66f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 10d9f20..b0f35b2 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 _0x4f0d=['lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x40911a,_0x55ec99){var _0x27e8e3=function(_0x2ba910){while(--_0x2ba910){_0x40911a['push'](_0x40911a['shift']());}};_0x27e8e3(++_0x55ec99);}(_0x4f0d,0x7e));var _0xd4f0=function(_0x2ada6a,_0x49cece){_0x2ada6a=_0x2ada6a-0x0;var _0x42b8fa=_0x4f0d[_0x2ada6a];return _0x42b8fa;};'use strict';var _=require(_0xd4f0('0x0'));var util=require('util');var moment=require(_0xd4f0('0x1'));var BPromise=require(_0xd4f0('0x2'));var rs=require(_0xd4f0('0x3'));var fs=require('fs');var Redis=require(_0xd4f0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f0('0x5'));var logger=require(_0xd4f0('0x6'))(_0xd4f0('0x7'));var config=require(_0xd4f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd4f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2717f3,_0x157b64,_0x1153f1){return new BPromise(function(_0x46e681,_0x3361e1){return client['request'](_0x2717f3,_0x1153f1)[_0xd4f0('0xa')](function(_0x38076e){logger[_0xd4f0('0xb')](_0xd4f0('0xc'),_0x157b64,_0xd4f0('0xd'));logger[_0xd4f0('0xe')](_0xd4f0('0xf'),_0x157b64,_0xd4f0('0xd'),JSON[_0xd4f0('0x10')](_0x38076e));if(_0x38076e[_0xd4f0('0x11')]){if(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x12')]===0x1f4){logger[_0xd4f0('0x11')]('ZohoField,\x20%s,\x20%s',_0x157b64,_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);return _0x3361e1(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);}logger[_0xd4f0('0x11')](_0xd4f0('0xc'),_0x157b64,_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);return _0x46e681(_0x38076e[_0xd4f0('0x11')][_0xd4f0('0x13')]);}else{logger[_0xd4f0('0xb')](_0xd4f0('0xc'),_0x157b64,'request\x20sent');_0x46e681(_0x38076e['result'][_0xd4f0('0x13')]);}})[_0xd4f0('0x14')](function(_0x5b543e){logger['error']('ZohoField,\x20%s,\x20%s',_0x157b64,_0x5b543e);_0x3361e1(_0x5b543e);});});} \ No newline at end of file +var _0x98a8=['request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http'];(function(_0x36bb05,_0x4e4675){var _0x2a6e28=function(_0x5e4368){while(--_0x5e4368){_0x36bb05['push'](_0x36bb05['shift']());}};_0x2a6e28(++_0x4e4675);}(_0x98a8,0xc9));var _0x898a=function(_0x13ae82,_0x275b22){_0x13ae82=_0x13ae82-0x0;var _0xab7c2=_0x98a8[_0x13ae82];return _0xab7c2;};'use strict';var _=require(_0x898a('0x0'));var util=require('util');var moment=require(_0x898a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x898a('0x2'));var db=require(_0x898a('0x3'))['db'];var utils=require(_0x898a('0x4'));var logger=require(_0x898a('0x5'))(_0x898a('0x6'));var config=require(_0x898a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x898a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4855b7,_0xac6d6d,_0xeea0f){return new BPromise(function(_0x41ffff,_0x18fbd4){return client[_0x898a('0x9')](_0x4855b7,_0xeea0f)[_0x898a('0xa')](function(_0x5124b4){logger[_0x898a('0xb')](_0x898a('0xc'),_0xac6d6d,'request\x20sent');logger[_0x898a('0xd')](_0x898a('0xe'),_0xac6d6d,_0x898a('0xf'),JSON['stringify'](_0x5124b4));if(_0x5124b4['error']){if(_0x5124b4[_0x898a('0x10')][_0x898a('0x11')]===0x1f4){logger['error'](_0x898a('0xc'),_0xac6d6d,_0x5124b4[_0x898a('0x10')][_0x898a('0x12')]);return _0x18fbd4(_0x5124b4[_0x898a('0x10')][_0x898a('0x12')]);}logger['error'](_0x898a('0xc'),_0xac6d6d,_0x5124b4['error'][_0x898a('0x12')]);return _0x41ffff(_0x5124b4[_0x898a('0x10')]['message']);}else{logger[_0x898a('0xb')](_0x898a('0xc'),_0xac6d6d,_0x898a('0xf'));_0x41ffff(_0x5124b4[_0x898a('0x13')][_0x898a('0x12')]);}})[_0x898a('0x14')](function(_0x1dc002){logger['error'](_0x898a('0xc'),_0xac6d6d,_0x1dc002);_0x18fbd4(_0x1dc002);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9b92f95..13a2453 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1244f2,_0x353c26){var _0x13e270=function(_0x4941fc){while(--_0x4941fc){_0x1244f2['push'](_0x1244f2['shift']());}};_0x13e270(++_0x353c26);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x681dcc,_0x182192){var _0x394bdf=function(_0x1ace15){while(--_0x1ace15){_0x681dcc['push'](_0x681dcc['shift']());}};_0x394bdf(++_0x182192);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0xcb91[_0x5e42a7];return _0x36d21b;};'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 9973277..5c55623 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 _0xcf66=['app.js','INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x11832d,_0xfc910e){var _0x5b08b9=function(_0xdfa9fa){while(--_0xdfa9fa){_0x11832d['push'](_0x11832d['shift']());}};_0x5b08b9(++_0xfc910e);}(_0xcf66,0x11c));var _0x6cf6=function(_0x335d79,_0x388aa3){_0x335d79=_0x335d79-0x0;var _0x269b77=_0xcf66[_0x335d79];return _0x269b77;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'name':{'type':Sequelize[_0x6cf6('0x2')],'allowNull':![],'unique':_0x6cf6('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x6cf6('0x2')],'defaultValue':_0x6cf6('0x4')},'filename':{'type':Sequelize[_0x6cf6('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6cf6('0x2')]},'size':{'type':Sequelize[_0x6cf6('0x5')]},'active':{'type':Sequelize[_0x6cf6('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x6cf6('0x2')]},'logo':{'type':Sequelize[_0x6cf6('0x2')]},'state':{'type':Sequelize[_0x6cf6('0x2')],'unique':_0x6cf6('0x7')},'description':{'type':Sequelize[_0x6cf6('0x2')]},'title':{'type':Sequelize[_0x6cf6('0x2')]},'remoteUri':{'type':Sequelize[_0x6cf6('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x44af=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','STRING'];(function(_0x71bb53,_0x5970da){var _0x46c0bd=function(_0x1716b0){while(--_0x1716b0){_0x71bb53['push'](_0x71bb53['shift']());}};_0x46c0bd(++_0x5970da);}(_0x44af,0xc5));var _0xf44a=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x44af[_0x27c24d];return _0x14e722;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf44a('0x0')],'allowNull':![],'unique':_0xf44a('0x1')},'version':{'type':Sequelize[_0xf44a('0x0')],'allowNull':![],'unique':_0xf44a('0x1')},'main':{'type':Sequelize[_0xf44a('0x0')],'defaultValue':_0xf44a('0x2')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xf44a('0x0')]},'type':{'type':Sequelize[_0xf44a('0x0')]},'size':{'type':Sequelize[_0xf44a('0x3')]},'active':{'type':Sequelize[_0xf44a('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xf44a('0x0')]},'logo':{'type':Sequelize[_0xf44a('0x0')]},'state':{'type':Sequelize[_0xf44a('0x0')],'unique':_0xf44a('0x5')},'description':{'type':Sequelize[_0xf44a('0x0')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xf44a('0x0')]},'link':{'type':Sequelize[_0xf44a('0x0')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1bf4422..348baa9 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 _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xfd7129,_0x1b71b6){var _0x5914a0=function(_0xd3c902){while(--_0xd3c902){_0xfd7129['push'](_0xfd7129['shift']());}};_0x5914a0(++_0x1b71b6);}(_0xba34,0x119));var _0x4ba3=function(_0x26d89c,_0x4af13d){_0x26d89c=_0x26d89c-0x0;var _0x56e542=_0xba34[_0x26d89c];return _0x56e542;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ No newline at end of file +var _0x781d=['../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Integration','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','rawAttributes','options','body','find','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x403f73,_0x1ebbcf){var _0x51d398=function(_0x43a760){while(--_0x43a760){_0x403f73['push'](_0x403f73['shift']());}};_0x51d398(++_0x1ebbcf);}(_0x781d,0x14a));var _0xd781=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x781d[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xd781('0x0'));var rimraf=require(_0xd781('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xd781('0x2'));var moment=require(_0xd781('0x3'));var BPromise=require(_0xd781('0x4'));var Mustache=require(_0xd781('0x5'));var util=require(_0xd781('0x6'));var path=require(_0xd781('0x7'));var sox=require(_0xd781('0x8'));var csv=require(_0xd781('0x9'));var ejs=require(_0xd781('0xa'));var fs=require('fs');var fs_extra=require(_0xd781('0xb'));var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var licenseUtil=require(_0xd781('0x17'));var db=require(_0xd781('0x18'))['db'];function respondWithStatusCode(_0xbea78b,_0x1f2f1e){_0x1f2f1e=_0x1f2f1e||0xcc;return function(_0xc7758f){if(_0xc7758f){return _0xbea78b[_0xd781('0x19')](_0x1f2f1e);}return _0xbea78b[_0xd781('0x1a')](_0x1f2f1e)[_0xd781('0x1b')]();};}function respondWithResult(_0xd454e7,_0x587953){_0x587953=_0x587953||0xc8;return function(_0x477bdc){if(_0x477bdc){return _0xd454e7[_0xd781('0x1a')](_0x587953)['json'](_0x477bdc);}};}function respondWithFilteredResult(_0x3a1f48,_0x48bffc){return function(_0x294e5a){if(_0x294e5a){var _0x22d787=typeof _0x48bffc[_0xd781('0x1c')]===_0xd781('0x1d')&&typeof _0x48bffc[_0xd781('0x1e')]===_0xd781('0x1d');var _0x501b0d=_0x294e5a['count'];var _0x1407fc=_0x22d787?0x0:_0x48bffc[_0xd781('0x1c')];var _0x395d9c=_0x22d787?_0x294e5a[_0xd781('0x1f')]:_0x48bffc[_0xd781('0x1c')]+_0x48bffc[_0xd781('0x1e')];var _0x260aa8;if(_0x395d9c>=_0x501b0d){_0x395d9c=_0x501b0d;_0x260aa8=0xc8;}else{_0x260aa8=0xce;}_0x3a1f48[_0xd781('0x1a')](_0x260aa8);return _0x3a1f48['set'](_0xd781('0x20'),_0x1407fc+'-'+_0x395d9c+'/'+_0x501b0d)[_0xd781('0x21')](_0x294e5a);}return null;};}function patchUpdates(_0x1036d3){return function(_0x103758){try{jsonpatch[_0xd781('0x22')](_0x103758,_0x1036d3,!![]);}catch(_0x274665){return BPromise[_0xd781('0x23')](_0x274665);}return _0x103758['save']();};}function saveUpdates(_0xe0c65f,_0x4e2c56){return function(_0x567fdf){if(_0x567fdf){return _0x567fdf[_0xd781('0x24')](_0xe0c65f)['then'](function(_0x175ba6){return _0x175ba6;});}return null;};}function removeEntity(_0x101480,_0x395087){return function(_0x31bf57){if(_0x31bf57){return _0x31bf57[_0xd781('0x25')]()[_0xd781('0x26')](function(){_0x101480[_0xd781('0x1a')](0xcc)[_0xd781('0x1b')]();});}};}function handleEntityNotFound(_0x10940b,_0x5662db){return function(_0x529ca1){if(!_0x529ca1){_0x10940b[_0xd781('0x19')](0x194);}return _0x529ca1;};}function handleError(_0x849587,_0xdad0b1){_0xdad0b1=_0xdad0b1||0x1f4;return function(_0x57b41e){logger[_0xd781('0x27')](_0x57b41e['stack']);if(_0x57b41e['name']){delete _0x57b41e[_0xd781('0x28')];}_0x849587['status'](_0xdad0b1)[_0xd781('0x29')](_0x57b41e);};}exports[_0xd781('0x2a')]=function(_0x5c3848,_0x5b6b9d){var _0x43cc74={},_0x5b0464={},_0x296a0b={'count':0x0,'rows':[]};var _0x4a3bd3=_[_0xd781('0x2b')](db[_0xd781('0x2c')]['rawAttributes'],function(_0x54521e){return{'name':_0x54521e[_0xd781('0x2d')],'type':_0x54521e[_0xd781('0x2e')][_0xd781('0x2f')]};});_0x5b0464['model']=_['map'](_0x4a3bd3,_0xd781('0x28'));_0x5b0464[_0xd781('0x30')]=_[_0xd781('0x31')](_0x5c3848['query']);_0x5b0464['filters']=_[_0xd781('0x32')](_0x5b0464[_0xd781('0x33')],_0x5b0464['query']);_0x43cc74[_0xd781('0x34')]=_[_0xd781('0x32')](_0x5b0464['model'],qs[_0xd781('0x35')](_0x5c3848[_0xd781('0x30')][_0xd781('0x35')]));_0x43cc74[_0xd781('0x34')]=_0x43cc74['attributes'][_0xd781('0x36')]?_0x43cc74[_0xd781('0x34')]:_0x5b0464[_0xd781('0x33')];if(!_0x5c3848[_0xd781('0x30')]['hasOwnProperty'](_0xd781('0x37'))){_0x43cc74[_0xd781('0x1e')]=qs['limit'](_0x5c3848[_0xd781('0x30')]['limit']);_0x43cc74[_0xd781('0x1c')]=qs[_0xd781('0x1c')](_0x5c3848['query'][_0xd781('0x1c')]);}_0x43cc74[_0xd781('0x38')]=qs['sort'](_0x5c3848[_0xd781('0x30')]['sort']);_0x43cc74[_0xd781('0x39')]=qs[_0xd781('0x3a')](_['pick'](_0x5c3848[_0xd781('0x30')],_0x5b0464[_0xd781('0x3a')]),_0x4a3bd3);if(_0x5c3848['query'][_0xd781('0x3b')]){_0x43cc74[_0xd781('0x39')]=_[_0xd781('0x3c')](_0x43cc74['where'],{'$or':_[_0xd781('0x2b')](_0x4a3bd3,function(_0x22b94e){if(_0x22b94e[_0xd781('0x2e')]!==_0xd781('0x3d')){var _0x2e8218={};_0x2e8218[_0x22b94e[_0xd781('0x28')]]={'$like':'%'+_0x5c3848[_0xd781('0x30')][_0xd781('0x3b')]+'%'};return _0x2e8218;}})});}_0x43cc74=_[_0xd781('0x3c')]({},_0x43cc74,_0x5c3848['options']);var _0x2a60d6={'where':_0x43cc74['where']};return db[_0xd781('0x2c')][_0xd781('0x1f')](_0x2a60d6)['then'](function(_0x1a5833){_0x296a0b[_0xd781('0x1f')]=_0x1a5833;if(_0x5c3848[_0xd781('0x30')][_0xd781('0x3e')]){_0x43cc74['include']=[{'all':!![]}];}return db[_0xd781('0x2c')]['findAll'](_0x43cc74);})[_0xd781('0x26')](function(_0xcdaacf){_0x296a0b['rows']=_0xcdaacf;return _0x296a0b;})['then'](respondWithFilteredResult(_0x5b6b9d,_0x43cc74))[_0xd781('0x3f')](handleError(_0x5b6b9d,null));};exports[_0xd781('0x40')]=function(_0x15b49d,_0x23bbab){var _0x53aba6={'raw':![],'where':{'id':_0x15b49d[_0xd781('0x41')]['id']}},_0x46e7f6={};_0x46e7f6['model']=_['keys'](db[_0xd781('0x2c')][_0xd781('0x42')]);_0x46e7f6[_0xd781('0x30')]=_['keys'](_0x15b49d['query']);_0x46e7f6[_0xd781('0x3a')]=_[_0xd781('0x32')](_0x46e7f6[_0xd781('0x33')],_0x46e7f6[_0xd781('0x30')]);_0x53aba6[_0xd781('0x34')]=_[_0xd781('0x32')](_0x46e7f6['model'],qs['fields'](_0x15b49d[_0xd781('0x30')][_0xd781('0x35')]));_0x53aba6[_0xd781('0x34')]=_0x53aba6[_0xd781('0x34')][_0xd781('0x36')]?_0x53aba6['attributes']:_0x46e7f6[_0xd781('0x33')];if(_0x15b49d[_0xd781('0x30')][_0xd781('0x3e')]){_0x53aba6['include']=[{'all':!![]}];}_0x53aba6=_[_0xd781('0x3c')]({},_0x53aba6,_0x15b49d[_0xd781('0x43')]);return db[_0xd781('0x2c')]['find'](_0x53aba6)[_0xd781('0x26')](handleEntityNotFound(_0x23bbab,null))[_0xd781('0x26')](respondWithResult(_0x23bbab,null))['catch'](handleError(_0x23bbab,null));};exports['create']=function(_0x13a907,_0x16d16e){return db[_0xd781('0x2c')]['create'](_0x13a907[_0xd781('0x44')],{})[_0xd781('0x26')](respondWithResult(_0x16d16e,0xc9))[_0xd781('0x3f')](handleError(_0x16d16e,null));};exports[_0xd781('0x24')]=function(_0x336d30,_0x3828ad){if(_0x336d30[_0xd781('0x44')]['id']){delete _0x336d30['body']['id'];}return db[_0xd781('0x2c')][_0xd781('0x45')]({'where':{'id':_0x336d30[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x3828ad,null))[_0xd781('0x26')](saveUpdates(_0x336d30[_0xd781('0x44')],null))['then'](respondWithResult(_0x3828ad,null))[_0xd781('0x3f')](handleError(_0x3828ad,null));};exports[_0xd781('0x25')]=function(_0x41caac,_0x207546){return db[_0xd781('0x2c')]['find']({'where':{'id':_0x41caac[_0xd781('0x41')]['id']}})['then'](handleEntityNotFound(_0x207546,null))[_0xd781('0x26')](removeEntity(_0x207546,null))['catch'](handleError(_0x207546,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index d220a7f..81a7694 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 _0xaeaf=['lodash','util','moment','bluebird','request-promise','path','rimraf','./integration.attributes','define','integrations'];(function(_0x3509d3,_0x41881b){var _0x1d9d7e=function(_0x11bc29){while(--_0x11bc29){_0x3509d3['push'](_0x3509d3['shift']());}};_0x1d9d7e(++_0x41881b);}(_0xaeaf,0x96));var _0xfaea=function(_0x2649e2,_0x3e73be){_0x2649e2=_0x2649e2-0x0;var _0x4797d4=_0xaeaf[_0x2649e2];return _0x4797d4;};'use strict';var _=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfaea('0x2'));var BPromise=require(_0xfaea('0x3'));var rp=require(_0xfaea('0x4'));var fs=require('fs');var path=require(_0xfaea('0x5'));var rimraf=require(_0xfaea('0x6'));var config=require('../../config/environment');var attributes=require(_0xfaea('0x7'));module['exports']=function(_0x5064a0,_0x43b79a){return _0x5064a0[_0xfaea('0x8')]('Integration',attributes,{'tableName':_0xfaea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c35=['define','Integration','util','../../config/logger','api','moment','request-promise','path','rimraf','./integration.attributes','exports'];(function(_0x1c9fc5,_0x3ca335){var _0x4eea03=function(_0x191625){while(--_0x191625){_0x1c9fc5['push'](_0x1c9fc5['shift']());}};_0x4eea03(++_0x3ca335);}(_0x4c35,0x162));var _0x54c3=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x4c35[_0x5e77db];return _0x34b675;};'use strict';var _=require('lodash');var util=require(_0x54c3('0x0'));var logger=require(_0x54c3('0x1'))(_0x54c3('0x2'));var moment=require(_0x54c3('0x3'));var BPromise=require('bluebird');var rp=require(_0x54c3('0x4'));var fs=require('fs');var path=require(_0x54c3('0x5'));var rimraf=require(_0x54c3('0x6'));var config=require('../../config/environment');var attributes=require(_0x54c3('0x7'));module[_0x54c3('0x8')]=function(_0x5cb468,_0x352ce7){return _0x5cb468[_0x54c3('0x9')](_0x54c3('0xa'),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 a5ad572..0e633a9 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 _0x7a54=['info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x301ccc,_0x42cb38){_0x301ccc=_0x301ccc-0x0;var _0x3ee659=_0x7a54[_0x301ccc];return _0x3ee659;};'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')]('Integration,\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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Integration,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x214806,_0x18242c){var _0x46f14e=function(_0x4e4430){while(--_0x4e4430){_0x214806['push'](_0x214806['shift']());}};_0x46f14e(++_0x18242c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x20b5b3,_0x90f353){_0x20b5b3=_0x20b5b3-0x0;var _0x2b33d0=_0x5f2f[_0x20b5b3];return _0x2b33d0;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('Integration,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 8ad0264..948d3d2 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 _0x7880=['Router','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x6a790c,_0x19901b){var _0x16f7b4=function(_0x410505){while(--_0x410505){_0x6a790c['push'](_0x6a790c['shift']());}};_0x16f7b4(++_0x19901b);}(_0x7880,0x1f4));var _0x0788=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x7880[_0x4350c2];return _0x8b6406;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var fs_extra=require(_0x0788('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0788('0x6'));var config=require(_0x0788('0x7'));var controller=require(_0x0788('0x8'));router[_0x0788('0x9')]('/',auth[_0x0788('0xa')](),controller[_0x0788('0xb')]);router[_0x0788('0x9')](_0x0788('0xc'),auth[_0x0788('0xa')](),controller[_0x0788('0xd')]);router['get'](_0x0788('0xe'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router['post']('/',auth[_0x0788('0xa')](),controller[_0x0788('0x10')]);router[_0x0788('0x11')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller['update']);router[_0x0788('0x12')](_0x0788('0xe'),auth[_0x0788('0xa')](),controller[_0x0788('0x13')]);module[_0x0788('0x14')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x4aeed0,_0x4b6534){var _0x5a27f4=function(_0x5de2a5){while(--_0x5de2a5){_0x4aeed0['push'](_0x4aeed0['shift']());}};_0x5a27f4(++_0x4b6534);}(_0x4975,0x86));var _0x5497=function(_0x344bc4,_0x3b405e){_0x344bc4=_0x344bc4-0x0;var _0x3a4905=_0x4975[_0x344bc4];return _0x3a4905;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 299b9e0..c9342d3 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 _0x4b1d=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize','exports','STRING'];(function(_0x6a1c89,_0x5d695b){var _0x3396df=function(_0x1121bb){while(--_0x1121bb){_0x6a1c89['push'](_0x6a1c89['shift']());}};_0x3396df(++_0x5d695b);}(_0x4b1d,0x110));var _0xd4b1=function(_0x320402,_0x33a4b7){_0x320402=_0x320402-0x0;var _0x89f0a=_0x4b1d[_0x320402];return _0x89f0a;};'use strict';var Sequelize=require(_0xd4b1('0x0'));module[_0xd4b1('0x1')]={'integration':{'type':Sequelize[_0xd4b1('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd4b1('0x2')]},'ticketId':{'type':Sequelize[_0xd4b1('0x2')]},'integrationId':{'type':Sequelize[_0xd4b1('0x3')]},'contacts':{'type':Sequelize[_0xd4b1('0x2')]},'uniqueid':{'type':Sequelize[_0xd4b1('0x2')]},'calleridnum':{'type':Sequelize[_0xd4b1('0x2')]},'calleridname':{'type':Sequelize[_0xd4b1('0x2')]},'queue':{'type':Sequelize[_0xd4b1('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xd4b1('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd4b1('0x4')]},'agentconnectAt':{'type':Sequelize[_0xd4b1('0x4')]},'holdtime':{'type':Sequelize[_0xd4b1('0x3')]},'agentcomplete':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xd4b1('0x3')]},'agentacw':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd4b1('0x4')]},'agentdump':{'type':Sequelize[_0xd4b1('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xd4b1('0x2')]},'channel':{'type':Sequelize[_0xd4b1('0x2')]},'channelstate':{'type':Sequelize[_0xd4b1('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd4b1('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd4b1('0x2')]},'language':{'type':Sequelize[_0xd4b1('0x2')]},'accountcode':{'type':Sequelize[_0xd4b1('0x2')]},'context':{'type':Sequelize[_0xd4b1('0x2')]},'exten':{'type':Sequelize[_0xd4b1('0x2')]},'priority':{'type':Sequelize[_0xd4b1('0x2')]},'destchannel':{'type':Sequelize[_0xd4b1('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd4b1('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xd4b1('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd4b1('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd4b1('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd4b1('0x2')]},'destexten':{'type':Sequelize[_0xd4b1('0x2')]},'destpriority':{'type':Sequelize[_0xd4b1('0x2')]},'destuniqueid':{'type':Sequelize[_0xd4b1('0x2')]},'messageId':{'type':Sequelize[_0xd4b1('0x2')]},'inReplyTo':{'type':Sequelize[_0xd4b1('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd4b1('0x2')]},'to':{'type':Sequelize[_0xd4b1('0x2')]},'cc':{'type':Sequelize[_0xd4b1('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xd4b1('0x6')]},'text':{'type':Sequelize[_0xd4b1('0x6')]},'status':{'type':Sequelize[_0xd4b1('0x7')](_0xd4b1('0x8'),_0xd4b1('0x9'),'RECEIVED',_0xd4b1('0xa'))},'url':{'type':Sequelize[_0xd4b1('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xd4b1('0x3')]}}; \ No newline at end of file +var _0x0163=['exports','STRING','DATE','INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','FAILED','sequelize'];(function(_0x92a418,_0xb7558a){var _0x3eb3f1=function(_0x58e2a8){while(--_0x58e2a8){_0x92a418['push'](_0x92a418['shift']());}};_0x3eb3f1(++_0xb7558a);}(_0x0163,0xa4));var _0x3016=function(_0x5f142c,_0x4548a1){_0x5f142c=_0x5f142c-0x0;var _0x22f82a=_0x0163[_0x5f142c];return _0x22f82a;};'use strict';var Sequelize=require(_0x3016('0x0'));module[_0x3016('0x1')]={'integration':{'type':Sequelize[_0x3016('0x2')]},'eventChannel':{'type':Sequelize[_0x3016('0x2')]},'exitStatus':{'type':Sequelize[_0x3016('0x2')]},'ticketId':{'type':Sequelize[_0x3016('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3016('0x2')]},'calleridnum':{'type':Sequelize[_0x3016('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3016('0x2')]},'interface':{'type':Sequelize[_0x3016('0x2')]},'membername':{'type':Sequelize[_0x3016('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3016('0x3')]},'agentconnectAt':{'type':Sequelize[_0x3016('0x3')]},'holdtime':{'type':Sequelize[_0x3016('0x4')]},'agentcomplete':{'type':Sequelize[_0x3016('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3016('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3016('0x4')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3016('0x3')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3016('0x3')]},'lastevent':{'type':Sequelize[_0x3016('0x2')]},'channel':{'type':Sequelize[_0x3016('0x2')]},'channelstate':{'type':Sequelize[_0x3016('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x3016('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3016('0x2')]},'context':{'type':Sequelize[_0x3016('0x2')]},'exten':{'type':Sequelize[_0x3016('0x2')]},'priority':{'type':Sequelize[_0x3016('0x2')]},'destchannel':{'type':Sequelize[_0x3016('0x2')]},'destchannelstate':{'type':Sequelize[_0x3016('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x3016('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3016('0x2')]},'destcalleridname':{'type':Sequelize[_0x3016('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3016('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3016('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x3016('0x2')]},'destcontext':{'type':Sequelize[_0x3016('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x3016('0x2')]},'messageId':{'type':Sequelize[_0x3016('0x2')]},'inReplyTo':{'type':Sequelize[_0x3016('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3016('0x2')]},'to':{'type':Sequelize[_0x3016('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3016('0x6')]},'html':{'type':Sequelize[_0x3016('0x6')]},'text':{'type':Sequelize[_0x3016('0x6')]},'status':{'type':Sequelize[_0x3016('0x7')](_0x3016('0x8'),_0x3016('0x9'),'RECEIVED',_0x3016('0xa'))},'url':{'type':Sequelize[_0x3016('0x2')]},'app':{'type':Sequelize[_0x3016('0x2')]},'appdata':{'type':Sequelize[_0x3016('0x2')]},'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 c6560fd..8f1b98d 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 _0x7c78=['Content-Range','apply','save','update','then','stack','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','include','findAll','show','params','includeAll','catch','create','body','find','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x4ce336,_0xc6c97c){var _0x4df05c=function(_0x3978af){while(--_0x3978af){_0x4ce336['push'](_0x4ce336['shift']());}};_0x4df05c(++_0xc6c97c);}(_0x7c78,0x1a1));var _0x87c7=function(_0x230951,_0x4dad52){_0x230951=_0x230951-0x0;var _0xeb26b1=_0x7c78[_0x230951];return _0xeb26b1;};'use strict';var emlformat=require(_0x87c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87c7('0x1'));var rp=require(_0x87c7('0x2'));var moment=require(_0x87c7('0x3'));var BPromise=require(_0x87c7('0x4'));var Mustache=require(_0x87c7('0x5'));var util=require(_0x87c7('0x6'));var path=require(_0x87c7('0x7'));var sox=require('sox');var csv=require(_0x87c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x87c7('0x9'));var _=require(_0x87c7('0xa'));var squel=require(_0x87c7('0xb'));var crypto=require('crypto');var jsforce=require(_0x87c7('0xc'));var deskjs=require(_0x87c7('0xd'));var toCsv=require(_0x87c7('0x8'));var querystring=require(_0x87c7('0xe'));var Papa=require(_0x87c7('0xf'));var Redis=require(_0x87c7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x87c7('0x11'));var as=require(_0x87c7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87c7('0x13'))(_0x87c7('0x14'));var utils=require(_0x87c7('0x15'));var config=require(_0x87c7('0x16'));var licenseUtil=require(_0x87c7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a5fb7,_0x55fc3e){_0x55fc3e=_0x55fc3e||0xcc;return function(_0x3e6c3c){if(_0x3e6c3c){return _0x2a5fb7[_0x87c7('0x18')](_0x55fc3e);}return _0x2a5fb7[_0x87c7('0x19')](_0x55fc3e)[_0x87c7('0x1a')]();};}function respondWithResult(_0x4a6633,_0x2e9f4d){_0x2e9f4d=_0x2e9f4d||0xc8;return function(_0x2466b7){if(_0x2466b7){return _0x4a6633[_0x87c7('0x19')](_0x2e9f4d)[_0x87c7('0x1b')](_0x2466b7);}};}function respondWithFilteredResult(_0x16a7b2,_0x4b6593){return function(_0x40c909){if(_0x40c909){var _0x444737=typeof _0x4b6593[_0x87c7('0x1c')]===_0x87c7('0x1d')&&typeof _0x4b6593[_0x87c7('0x1e')]==='undefined';var _0x3dfab3=_0x40c909[_0x87c7('0x1f')];var _0x2d6a6a=_0x444737?0x0:_0x4b6593['offset'];var _0x472822=_0x444737?_0x40c909[_0x87c7('0x1f')]:_0x4b6593[_0x87c7('0x1c')]+_0x4b6593[_0x87c7('0x1e')];var _0x52c951;if(_0x472822>=_0x3dfab3){_0x472822=_0x3dfab3;_0x52c951=0xc8;}else{_0x52c951=0xce;}_0x16a7b2[_0x87c7('0x19')](_0x52c951);return _0x16a7b2[_0x87c7('0x20')](_0x87c7('0x21'),_0x2d6a6a+'-'+_0x472822+'/'+_0x3dfab3)['json'](_0x40c909);}return null;};}function patchUpdates(_0x598646){return function(_0x258f0a){try{jsonpatch[_0x87c7('0x22')](_0x258f0a,_0x598646,!![]);}catch(_0x41405b){return BPromise['reject'](_0x41405b);}return _0x258f0a[_0x87c7('0x23')]();};}function saveUpdates(_0x4385ae,_0x2aa1c1){return function(_0x383de3){if(_0x383de3){return _0x383de3[_0x87c7('0x24')](_0x4385ae)[_0x87c7('0x25')](function(_0x3cf82a){return _0x3cf82a;});}return null;};}function removeEntity(_0x457d36,_0x53d453){return function(_0x3f07d4){if(_0x3f07d4){return _0x3f07d4['destroy']()[_0x87c7('0x25')](function(){_0x457d36[_0x87c7('0x19')](0xcc)[_0x87c7('0x1a')]();});}};}function handleEntityNotFound(_0x5942d6,_0xf06d36){return function(_0x4c89f7){if(!_0x4c89f7){_0x5942d6[_0x87c7('0x18')](0x194);}return _0x4c89f7;};}function handleError(_0x3db0bf,_0x58e1c4){_0x58e1c4=_0x58e1c4||0x1f4;return function(_0x4e3c71){logger['error'](_0x4e3c71[_0x87c7('0x26')]);if(_0x4e3c71['name']){delete _0x4e3c71['name'];}_0x3db0bf[_0x87c7('0x19')](_0x58e1c4)[_0x87c7('0x27')](_0x4e3c71);};}exports[_0x87c7('0x28')]=function(_0x58f8c7,_0x1034fd){var _0x47aa4f={},_0x38ce94={},_0xfdd8a9={'count':0x0,'rows':[]};var _0x1c5c86=_[_0x87c7('0x29')](db[_0x87c7('0x2a')][_0x87c7('0x2b')],function(_0x23abfa){return{'name':_0x23abfa[_0x87c7('0x2c')],'type':_0x23abfa[_0x87c7('0x2d')]['key']};});_0x38ce94[_0x87c7('0x2e')]=_['map'](_0x1c5c86,'name');_0x38ce94[_0x87c7('0x2f')]=_[_0x87c7('0x30')](_0x58f8c7['query']);_0x38ce94[_0x87c7('0x31')]=_[_0x87c7('0x32')](_0x38ce94[_0x87c7('0x2e')],_0x38ce94[_0x87c7('0x2f')]);_0x47aa4f[_0x87c7('0x33')]=_['intersection'](_0x38ce94[_0x87c7('0x2e')],qs[_0x87c7('0x34')](_0x58f8c7['query'][_0x87c7('0x34')]));_0x47aa4f[_0x87c7('0x33')]=_0x47aa4f[_0x87c7('0x33')][_0x87c7('0x35')]?_0x47aa4f[_0x87c7('0x33')]:_0x38ce94[_0x87c7('0x2e')];if(!_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x36')](_0x87c7('0x37'))){_0x47aa4f[_0x87c7('0x1e')]=qs[_0x87c7('0x1e')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x1e')]);_0x47aa4f[_0x87c7('0x1c')]=qs[_0x87c7('0x1c')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x1c')]);}_0x47aa4f[_0x87c7('0x38')]=qs[_0x87c7('0x39')](_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x39')]);_0x47aa4f[_0x87c7('0x3a')]=qs['filters'](_[_0x87c7('0x3b')](_0x58f8c7[_0x87c7('0x2f')],_0x38ce94['filters']),_0x1c5c86);if(_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x3c')]){_0x47aa4f['where']=_[_0x87c7('0x3d')](_0x47aa4f['where'],{'$or':_['map'](_0x1c5c86,function(_0x527144){if(_0x527144[_0x87c7('0x2d')]!==_0x87c7('0x3e')){var _0x5ad295={};_0x5ad295[_0x527144[_0x87c7('0x3f')]]={'$like':'%'+_0x58f8c7[_0x87c7('0x2f')][_0x87c7('0x3c')]+'%'};return _0x5ad295;}})});}_0x47aa4f=_['merge']({},_0x47aa4f,_0x58f8c7[_0x87c7('0x40')]);var _0xbe2b74={'where':_0x47aa4f[_0x87c7('0x3a')]};return db['IntegrationReport']['count'](_0xbe2b74)[_0x87c7('0x25')](function(_0x145275){_0xfdd8a9[_0x87c7('0x1f')]=_0x145275;if(_0x58f8c7['query']['includeAll']){_0x47aa4f[_0x87c7('0x41')]=[{'all':!![]}];}return db[_0x87c7('0x2a')][_0x87c7('0x42')](_0x47aa4f);})[_0x87c7('0x25')](function(_0x5bc20c){_0xfdd8a9['rows']=_0x5bc20c;return _0xfdd8a9;})[_0x87c7('0x25')](respondWithFilteredResult(_0x1034fd,_0x47aa4f))['catch'](handleError(_0x1034fd,null));};exports[_0x87c7('0x43')]=function(_0x15d392,_0x2af91f){var _0x1e708f={'raw':![],'where':{'id':_0x15d392[_0x87c7('0x44')]['id']}},_0x4c6062={};_0x4c6062[_0x87c7('0x2e')]=_[_0x87c7('0x30')](db[_0x87c7('0x2a')]['rawAttributes']);_0x4c6062[_0x87c7('0x2f')]=_[_0x87c7('0x30')](_0x15d392[_0x87c7('0x2f')]);_0x4c6062['filters']=_[_0x87c7('0x32')](_0x4c6062[_0x87c7('0x2e')],_0x4c6062[_0x87c7('0x2f')]);_0x1e708f[_0x87c7('0x33')]=_[_0x87c7('0x32')](_0x4c6062['model'],qs[_0x87c7('0x34')](_0x15d392[_0x87c7('0x2f')][_0x87c7('0x34')]));_0x1e708f['attributes']=_0x1e708f[_0x87c7('0x33')][_0x87c7('0x35')]?_0x1e708f[_0x87c7('0x33')]:_0x4c6062[_0x87c7('0x2e')];if(_0x15d392['query'][_0x87c7('0x45')]){_0x1e708f[_0x87c7('0x41')]=[{'all':!![]}];}_0x1e708f=_[_0x87c7('0x3d')]({},_0x1e708f,_0x15d392[_0x87c7('0x40')]);return db[_0x87c7('0x2a')]['find'](_0x1e708f)[_0x87c7('0x25')](handleEntityNotFound(_0x2af91f,null))[_0x87c7('0x25')](respondWithResult(_0x2af91f,null))[_0x87c7('0x46')](handleError(_0x2af91f,null));};exports[_0x87c7('0x47')]=function(_0x3f173a,_0x5a3d8e){return db[_0x87c7('0x2a')][_0x87c7('0x47')](_0x3f173a[_0x87c7('0x48')],{})[_0x87c7('0x25')](respondWithResult(_0x5a3d8e,0xc9))[_0x87c7('0x46')](handleError(_0x5a3d8e,null));};exports[_0x87c7('0x24')]=function(_0x39f48d,_0x2a022f){if(_0x39f48d[_0x87c7('0x48')]['id']){delete _0x39f48d[_0x87c7('0x48')]['id'];}return db[_0x87c7('0x2a')][_0x87c7('0x49')]({'where':{'id':_0x39f48d[_0x87c7('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a022f,null))['then'](saveUpdates(_0x39f48d[_0x87c7('0x48')],null))[_0x87c7('0x25')](respondWithResult(_0x2a022f,null))['catch'](handleError(_0x2a022f,null));};exports['destroy']=function(_0x3efa3c,_0x4abca0){return db['IntegrationReport']['find']({'where':{'id':_0x3efa3c[_0x87c7('0x44')]['id']}})[_0x87c7('0x25')](handleEntityNotFound(_0x4abca0,null))['then'](removeEntity(_0x4abca0,null))[_0x87c7('0x46')](handleError(_0x4abca0,null));};exports['describe']=function(_0x34f461,_0x100089){return db['IntegrationReport'][_0x87c7('0x4a')]()[_0x87c7('0x25')](respondWithResult(_0x100089,null))[_0x87c7('0x46')](handleError(_0x100089,null));}; \ No newline at end of file +var _0x2129=['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','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs'];(function(_0x108dd7,_0x5036e9){var _0x329fa3=function(_0x4f1b97){while(--_0x4f1b97){_0x108dd7['push'](_0x108dd7['shift']());}};_0x329fa3(++_0x5036e9);}(_0x2129,0x90));var _0x9212=function(_0x4b09ed,_0x42ca2d){_0x4b09ed=_0x4b09ed-0x0;var _0x4ba68e=_0x2129[_0x4b09ed];return _0x4ba68e;};'use strict';var emlformat=require(_0x9212('0x0'));var rimraf=require(_0x9212('0x1'));var zipdir=require(_0x9212('0x2'));var jsonpatch=require(_0x9212('0x3'));var rp=require('request-promise');var moment=require(_0x9212('0x4'));var BPromise=require(_0x9212('0x5'));var Mustache=require(_0x9212('0x6'));var util=require(_0x9212('0x7'));var path=require('path');var sox=require(_0x9212('0x8'));var csv=require('to-csv');var ejs=require(_0x9212('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9212('0xa'));var squel=require(_0x9212('0xb'));var crypto=require(_0x9212('0xc'));var jsforce=require(_0x9212('0xd'));var deskjs=require(_0x9212('0xe'));var toCsv=require(_0x9212('0xf'));var querystring=require(_0x9212('0x10'));var Papa=require(_0x9212('0x11'));var Redis=require(_0x9212('0x12'));var authService=require(_0x9212('0x13'));var qs=require(_0x9212('0x14'));var as=require(_0x9212('0x15'));var hardwareService=require(_0x9212('0x16'));var logger=require(_0x9212('0x17'))(_0x9212('0x18'));var utils=require(_0x9212('0x19'));var config=require(_0x9212('0x1a'));var licenseUtil=require(_0x9212('0x1b'));var db=require(_0x9212('0x1c'))['db'];function respondWithStatusCode(_0xd019fc,_0x4d0f47){_0x4d0f47=_0x4d0f47||0xcc;return function(_0x447001){if(_0x447001){return _0xd019fc[_0x9212('0x1d')](_0x4d0f47);}return _0xd019fc[_0x9212('0x1e')](_0x4d0f47)['end']();};}function respondWithResult(_0x1a1cd6,_0x301b6e){_0x301b6e=_0x301b6e||0xc8;return function(_0x3c420e){if(_0x3c420e){return _0x1a1cd6[_0x9212('0x1e')](_0x301b6e)[_0x9212('0x1f')](_0x3c420e);}};}function respondWithFilteredResult(_0x1de721,_0x468e9b){return function(_0x4fcfeb){if(_0x4fcfeb){var _0x34ea2e=typeof _0x468e9b[_0x9212('0x20')]===_0x9212('0x21')&&typeof _0x468e9b[_0x9212('0x22')]==='undefined';var _0x47e0b9=_0x4fcfeb[_0x9212('0x23')];var _0x323ae2=_0x34ea2e?0x0:_0x468e9b[_0x9212('0x20')];var _0x815a2e=_0x34ea2e?_0x4fcfeb['count']:_0x468e9b[_0x9212('0x20')]+_0x468e9b[_0x9212('0x22')];var _0x20bf3a;if(_0x815a2e>=_0x47e0b9){_0x815a2e=_0x47e0b9;_0x20bf3a=0xc8;}else{_0x20bf3a=0xce;}_0x1de721[_0x9212('0x1e')](_0x20bf3a);return _0x1de721[_0x9212('0x24')]('Content-Range',_0x323ae2+'-'+_0x815a2e+'/'+_0x47e0b9)['json'](_0x4fcfeb);}return null;};}function patchUpdates(_0x564d27){return function(_0xa63170){try{jsonpatch[_0x9212('0x25')](_0xa63170,_0x564d27,!![]);}catch(_0x536b2b){return BPromise[_0x9212('0x26')](_0x536b2b);}return _0xa63170[_0x9212('0x27')]();};}function saveUpdates(_0x283f92,_0x1d891b){return function(_0x181ae7){if(_0x181ae7){return _0x181ae7[_0x9212('0x28')](_0x283f92)[_0x9212('0x29')](function(_0xfd44b1){return _0xfd44b1;});}return null;};}function removeEntity(_0x5d972c,_0x4946de){return function(_0x43b83b){if(_0x43b83b){return _0x43b83b[_0x9212('0x2a')]()[_0x9212('0x29')](function(){_0x5d972c[_0x9212('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23fc21,_0x2755e1){return function(_0x175cab){if(!_0x175cab){_0x23fc21[_0x9212('0x1d')](0x194);}return _0x175cab;};}function handleError(_0xcaf2a,_0x4570b6){_0x4570b6=_0x4570b6||0x1f4;return function(_0x1da1dd){logger['error'](_0x1da1dd[_0x9212('0x2b')]);if(_0x1da1dd[_0x9212('0x2c')]){delete _0x1da1dd[_0x9212('0x2c')];}_0xcaf2a[_0x9212('0x1e')](_0x4570b6)[_0x9212('0x2d')](_0x1da1dd);};}exports[_0x9212('0x2e')]=function(_0x34737d,_0x12cdee){var _0x380b38={},_0x5c9c4e={},_0x1cbb4e={'count':0x0,'rows':[]};var _0x7aaace=_[_0x9212('0x2f')](db[_0x9212('0x30')][_0x9212('0x31')],function(_0x39e8f3){return{'name':_0x39e8f3[_0x9212('0x32')],'type':_0x39e8f3[_0x9212('0x33')][_0x9212('0x34')]};});_0x5c9c4e['model']=_[_0x9212('0x2f')](_0x7aaace,'name');_0x5c9c4e[_0x9212('0x35')]=_['keys'](_0x34737d[_0x9212('0x35')]);_0x5c9c4e[_0x9212('0x36')]=_['intersection'](_0x5c9c4e[_0x9212('0x37')],_0x5c9c4e[_0x9212('0x35')]);_0x380b38[_0x9212('0x38')]=_[_0x9212('0x39')](_0x5c9c4e[_0x9212('0x37')],qs[_0x9212('0x3a')](_0x34737d[_0x9212('0x35')][_0x9212('0x3a')]));_0x380b38['attributes']=_0x380b38[_0x9212('0x38')][_0x9212('0x3b')]?_0x380b38['attributes']:_0x5c9c4e[_0x9212('0x37')];if(!_0x34737d[_0x9212('0x35')]['hasOwnProperty'](_0x9212('0x3c'))){_0x380b38[_0x9212('0x22')]=qs[_0x9212('0x22')](_0x34737d[_0x9212('0x35')]['limit']);_0x380b38[_0x9212('0x20')]=qs[_0x9212('0x20')](_0x34737d[_0x9212('0x35')]['offset']);}_0x380b38['order']=qs[_0x9212('0x3d')](_0x34737d[_0x9212('0x35')][_0x9212('0x3d')]);_0x380b38[_0x9212('0x3e')]=qs[_0x9212('0x36')](_[_0x9212('0x3f')](_0x34737d[_0x9212('0x35')],_0x5c9c4e['filters']),_0x7aaace);if(_0x34737d[_0x9212('0x35')]['filter']){_0x380b38[_0x9212('0x3e')]=_[_0x9212('0x40')](_0x380b38['where'],{'$or':_[_0x9212('0x2f')](_0x7aaace,function(_0x241f6f){if(_0x241f6f[_0x9212('0x33')]!=='VIRTUAL'){var _0x33db7c={};_0x33db7c[_0x241f6f[_0x9212('0x2c')]]={'$like':'%'+_0x34737d[_0x9212('0x35')]['filter']+'%'};return _0x33db7c;}})});}_0x380b38=_[_0x9212('0x40')]({},_0x380b38,_0x34737d[_0x9212('0x41')]);var _0xd666f8={'where':_0x380b38[_0x9212('0x3e')]};return db[_0x9212('0x30')][_0x9212('0x23')](_0xd666f8)[_0x9212('0x29')](function(_0x282654){_0x1cbb4e[_0x9212('0x23')]=_0x282654;if(_0x34737d[_0x9212('0x35')][_0x9212('0x42')]){_0x380b38['include']=[{'all':!![]}];}return db[_0x9212('0x30')][_0x9212('0x43')](_0x380b38);})[_0x9212('0x29')](function(_0x4dda2e){_0x1cbb4e[_0x9212('0x44')]=_0x4dda2e;return _0x1cbb4e;})[_0x9212('0x29')](respondWithFilteredResult(_0x12cdee,_0x380b38))[_0x9212('0x45')](handleError(_0x12cdee,null));};exports['show']=function(_0x5c2c0c,_0xbbfaed){var _0x4fccd0={'raw':![],'where':{'id':_0x5c2c0c[_0x9212('0x46')]['id']}},_0x34cab2={};_0x34cab2[_0x9212('0x37')]=_[_0x9212('0x47')](db['IntegrationReport']['rawAttributes']);_0x34cab2[_0x9212('0x35')]=_[_0x9212('0x47')](_0x5c2c0c[_0x9212('0x35')]);_0x34cab2[_0x9212('0x36')]=_[_0x9212('0x39')](_0x34cab2[_0x9212('0x37')],_0x34cab2[_0x9212('0x35')]);_0x4fccd0[_0x9212('0x38')]=_[_0x9212('0x39')](_0x34cab2[_0x9212('0x37')],qs[_0x9212('0x3a')](_0x5c2c0c[_0x9212('0x35')]['fields']));_0x4fccd0[_0x9212('0x38')]=_0x4fccd0[_0x9212('0x38')][_0x9212('0x3b')]?_0x4fccd0[_0x9212('0x38')]:_0x34cab2['model'];if(_0x5c2c0c[_0x9212('0x35')][_0x9212('0x42')]){_0x4fccd0[_0x9212('0x48')]=[{'all':!![]}];}_0x4fccd0=_['merge']({},_0x4fccd0,_0x5c2c0c['options']);return db[_0x9212('0x30')][_0x9212('0x49')](_0x4fccd0)[_0x9212('0x29')](handleEntityNotFound(_0xbbfaed,null))[_0x9212('0x29')](respondWithResult(_0xbbfaed,null))[_0x9212('0x45')](handleError(_0xbbfaed,null));};exports[_0x9212('0x4a')]=function(_0x313b31,_0x3aed82){return db[_0x9212('0x30')][_0x9212('0x4a')](_0x313b31[_0x9212('0x4b')],{})['then'](respondWithResult(_0x3aed82,0xc9))[_0x9212('0x45')](handleError(_0x3aed82,null));};exports[_0x9212('0x28')]=function(_0x1da77b,_0xd2f67c){if(_0x1da77b[_0x9212('0x4b')]['id']){delete _0x1da77b['body']['id'];}return db[_0x9212('0x30')]['find']({'where':{'id':_0x1da77b['params']['id']}})[_0x9212('0x29')](handleEntityNotFound(_0xd2f67c,null))[_0x9212('0x29')](saveUpdates(_0x1da77b[_0x9212('0x4b')],null))[_0x9212('0x29')](respondWithResult(_0xd2f67c,null))[_0x9212('0x45')](handleError(_0xd2f67c,null));};exports[_0x9212('0x2a')]=function(_0x40b8b4,_0x325133){return db[_0x9212('0x30')][_0x9212('0x49')]({'where':{'id':_0x40b8b4['params']['id']}})[_0x9212('0x29')](handleEntityNotFound(_0x325133,null))[_0x9212('0x29')](removeEntity(_0x325133,null))[_0x9212('0x45')](handleError(_0x325133,null));};exports['describe']=function(_0x101283,_0xc3ef6e){return db[_0x9212('0x30')][_0x9212('0x4c')]()[_0x9212('0x29')](respondWithResult(_0xc3ef6e,null))[_0x9212('0x45')](handleError(_0xc3ef6e,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 562700d..a7d2d44 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 _0x6df6=['bluebird','path','../../config/environment','./integrationReport.attributes','report_integration','lodash','util','../../config/logger','api','moment'];(function(_0x13bc5e,_0x1713d0){var _0xae6941=function(_0x36c0cc){while(--_0x36c0cc){_0x13bc5e['push'](_0x13bc5e['shift']());}};_0xae6941(++_0x1713d0);}(_0x6df6,0x127));var _0x66df=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0x6df6[_0x5c1345];return _0x1c070d;};'use strict';var _=require(_0x66df('0x0'));var util=require(_0x66df('0x1'));var logger=require(_0x66df('0x2'))(_0x66df('0x3'));var moment=require(_0x66df('0x4'));var BPromise=require(_0x66df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x66df('0x6'));var rimraf=require('rimraf');var config=require(_0x66df('0x7'));var attributes=require(_0x66df('0x8'));module['exports']=function(_0xfea7b5,_0x2e5de1){return _0xfea7b5['define']('IntegrationReport',attributes,{'tableName':_0x66df('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb946=['rimraf','../../config/environment','define','report_integration','../../config/logger','api','moment','bluebird','path'];(function(_0x2a7aea,_0x3aaa45){var _0x42234e=function(_0x25a679){while(--_0x25a679){_0x2a7aea['push'](_0x2a7aea['shift']());}};_0x42234e(++_0x3aaa45);}(_0xb946,0x109));var _0x6b94=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb946[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b94('0x0'))(_0x6b94('0x1'));var moment=require(_0x6b94('0x2'));var BPromise=require(_0x6b94('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6b94('0x4'));var rimraf=require(_0x6b94('0x5'));var config=require(_0x6b94('0x6'));var attributes=require('./integrationReport.attributes');module['exports']=function(_0x40fc3c,_0x17ed72){return _0x40fc3c[_0x6b94('0x7')]('IntegrationReport',attributes,{'tableName':_0x6b94('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 576a972..1790612 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 _0x3f8a=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x11863a,_0x4f488e){_0x11863a=_0x11863a-0x0;var _0x570d4f=_0x3f8a[_0x11863a];return _0x570d4f;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var moment=require(_0xa3f8('0x2'));var BPromise=require(_0xa3f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3f8('0x4'));var db=require(_0xa3f8('0x5'))['db'];var utils=require(_0xa3f8('0x6'));var logger=require(_0xa3f8('0x7'))(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var jayson=require(_0xa3f8('0xa'));var client=jayson[_0xa3f8('0xb')][_0xa3f8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf895d9,_0xcfea5,_0x268332){return new BPromise(function(_0x2faf2e,_0x2448de){return client[_0xa3f8('0xd')](_0xf895d9,_0x268332)[_0xa3f8('0xe')](function(_0xcdb0d4){logger['info'](_0xa3f8('0xf'),_0xcfea5,_0xa3f8('0x10'));logger[_0xa3f8('0x11')](_0xa3f8('0x12'),_0xcfea5,'request\x20sent',JSON[_0xa3f8('0x13')](_0xcdb0d4));if(_0xcdb0d4[_0xa3f8('0x14')]){if(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x15')]===0x1f4){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);return _0x2448de(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0xcdb0d4['error'][_0xa3f8('0x16')]);return _0x2faf2e(_0xcdb0d4[_0xa3f8('0x14')][_0xa3f8('0x16')]);}else{logger[_0xa3f8('0x17')]('IntegrationReport,\x20%s,\x20%s',_0xcfea5,_0xa3f8('0x10'));_0x2faf2e(_0xcdb0d4[_0xa3f8('0x18')][_0xa3f8('0x16')]);}})[_0xa3f8('0x19')](function(_0x45ef64){logger[_0xa3f8('0x14')](_0xa3f8('0xf'),_0xcfea5,_0x45ef64);_0x2448de(_0x45ef64);});});} \ No newline at end of file +var _0x326f=['info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x46bb76,_0x1ae888){var _0x547746=function(_0x20b2bc){while(--_0x20b2bc){_0x46bb76['push'](_0x46bb76['shift']());}};_0x547746(++_0x1ae888);}(_0x326f,0xd1));var _0xf326=function(_0x12b313,_0x522de2){_0x12b313=_0x12b313-0x0;var _0x47d2d5=_0x326f[_0x12b313];return _0x47d2d5;};'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')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index f1e1d62..0d5cb21 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 _0x965d=['addIntervals','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','/:id/sub_intervals','isAuthenticated','getIntervals','post','create'];(function(_0x2478b8,_0x40961b){var _0x102501=function(_0x26166c){while(--_0x26166c){_0x2478b8['push'](_0x2478b8['shift']());}};_0x102501(++_0x40961b);}(_0x965d,0x1be));var _0xd965=function(_0x4038d9,_0x9624f6){_0x4038d9=_0x4038d9-0x0;var _0x2f100=_0x965d[_0x4038d9];return _0x2f100;};'use strict';var multer=require(_0xd965('0x0'));var util=require(_0xd965('0x1'));var path=require('path');var timeout=require(_0xd965('0x2'));var express=require(_0xd965('0x3'));var router=express[_0xd965('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd965('0x5'));var interaction=require(_0xd965('0x6'));var config=require(_0xd965('0x7'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd965('0x8')](_0xd965('0x9'),auth['isAuthenticated'](),controller[_0xd965('0xa')]);router['get'](_0xd965('0xb'),auth[_0xd965('0xc')](),controller[_0xd965('0xd')]);router[_0xd965('0xe')]('/',auth['isAuthenticated'](),controller[_0xd965('0xf')]);router[_0xd965('0xe')](_0xd965('0xb'),auth['isAuthenticated'](),controller['addInterval']);router['post']('/:id/sub_intervals/create_many',auth[_0xd965('0xc')](),controller[_0xd965('0x10')]);router['put'](_0xd965('0x9'),auth[_0xd965('0xc')](),controller[_0xd965('0x11')]);router[_0xd965('0x12')](_0xd965('0x9'),auth['isAuthenticated'](),controller[_0xd965('0x13')]);module[_0xd965('0x14')]=router; \ No newline at end of file +var _0x603f=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','index','get','/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x5ca74e,_0x26ef3e){var _0x259df1=function(_0x40f163){while(--_0x40f163){_0x5ca74e['push'](_0x5ca74e['shift']());}};_0x259df1(++_0x26ef3e);}(_0x603f,0x65));var _0xf603=function(_0x450185,_0x10ba03){_0x450185=_0x450185-0x0;var _0x16431a=_0x603f[_0x450185];return _0x16431a;};'use strict';var multer=require(_0xf603('0x0'));var util=require('util');var path=require(_0xf603('0x1'));var timeout=require(_0xf603('0x2'));var express=require(_0xf603('0x3'));var router=express['Router']();var fs_extra=require(_0xf603('0x4'));var auth=require(_0xf603('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf603('0x6'));var controller=require(_0xf603('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf603('0x8')]);router[_0xf603('0x9')](_0xf603('0xa'),auth[_0xf603('0xb')](),controller['show']);router[_0xf603('0x9')](_0xf603('0xc'),auth['isAuthenticated'](),controller[_0xf603('0xd')]);router[_0xf603('0xe')]('/',auth[_0xf603('0xb')](),controller[_0xf603('0xf')]);router[_0xf603('0xe')](_0xf603('0xc'),auth[_0xf603('0xb')](),controller[_0xf603('0x10')]);router[_0xf603('0xe')](_0xf603('0x11'),auth[_0xf603('0xb')](),controller[_0xf603('0x12')]);router[_0xf603('0x13')](_0xf603('0xa'),auth[_0xf603('0xb')](),controller[_0xf603('0x14')]);router[_0xf603('0x15')]('/:id',auth[_0xf603('0xb')](),controller[_0xf603('0x16')]);module[_0xf603('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index cc99c1c..6acae91 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 _0x22dc=['sequelize','exports','STRING'];(function(_0x5cac1a,_0x276239){var _0x607a7a=function(_0x2dc925){while(--_0x2dc925){_0x5cac1a['push'](_0x5cac1a['shift']());}};_0x607a7a(++_0x276239);}(_0x22dc,0x1c5));var _0xc22d=function(_0x181566,_0x14f9ad){_0x181566=_0x181566-0x0;var _0x52a4a9=_0x22dc[_0x181566];return _0x52a4a9;};'use strict';var Sequelize=require(_0xc22d('0x0'));module[_0xc22d('0x1')]={'name':{'type':Sequelize[_0xc22d('0x2')]},'description':{'type':Sequelize[_0xc22d('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x75ac=['exports','STRING'];(function(_0x1dcbcc,_0x31a0fc){var _0x38590e=function(_0xd1a9aa){while(--_0xd1a9aa){_0x1dcbcc['push'](_0x1dcbcc['shift']());}};_0x38590e(++_0x31a0fc);}(_0x75ac,0xac));var _0xc75a=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x75ac[_0x519756];return _0x37047e;};'use strict';var Sequelize=require('sequelize');module[_0xc75a('0x0')]={'name':{'type':Sequelize[_0xc75a('0x1')]},'description':{'type':Sequelize[_0xc75a('0x1')]},'interval':{'type':Sequelize[_0xc75a('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index b6cffac..b9a59d6 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 _0x1265=['transaction','bulkCreate','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Interval','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addInterval','IntervalId','getIntervals','findOne','sequelize'];(function(_0x1d6a82,_0x37c315){var _0x5834ac=function(_0x2402ba){while(--_0x2402ba){_0x1d6a82['push'](_0x1d6a82['shift']());}};_0x5834ac(++_0x37c315);}(_0x1265,0x182));var _0x5126=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x1265[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x5126('0x0'));var rimraf=require(_0x5126('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5126('0x2'));var rp=require(_0x5126('0x3'));var moment=require('moment');var BPromise=require(_0x5126('0x4'));var Mustache=require(_0x5126('0x5'));var util=require(_0x5126('0x6'));var path=require(_0x5126('0x7'));var sox=require(_0x5126('0x8'));var csv=require(_0x5126('0x9'));var ejs=require(_0x5126('0xa'));var fs=require('fs');var fs_extra=require(_0x5126('0xb'));var _=require(_0x5126('0xc'));var squel=require(_0x5126('0xd'));var crypto=require(_0x5126('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5126('0xf'));var toCsv=require(_0x5126('0x9'));var querystring=require('querystring');var Papa=require(_0x5126('0x10'));var Redis=require('ioredis');var authService=require(_0x5126('0x11'));var qs=require(_0x5126('0x12'));var as=require(_0x5126('0x13'));var hardwareService=require(_0x5126('0x14'));var logger=require(_0x5126('0x15'))(_0x5126('0x16'));var utils=require(_0x5126('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5126('0x18'));var db=require('../../mysqldb')['db'];var extensions=require(_0x5126('0x19'));function respondWithStatusCode(_0x36eb63,_0x34b310){_0x34b310=_0x34b310||0xcc;return function(_0x37fbb5){if(_0x37fbb5){return _0x36eb63[_0x5126('0x1a')](_0x34b310);}return _0x36eb63[_0x5126('0x1b')](_0x34b310)[_0x5126('0x1c')]();};}function respondWithResult(_0x380f0b,_0x363a9e){_0x363a9e=_0x363a9e||0xc8;return function(_0x13a8e3){if(_0x13a8e3){return _0x380f0b[_0x5126('0x1b')](_0x363a9e)[_0x5126('0x1d')](_0x13a8e3);}};}function respondWithFilteredResult(_0x367344,_0x41c8a0){return function(_0x3f1299){if(_0x3f1299){var _0x178582=typeof _0x41c8a0['offset']===_0x5126('0x1e')&&typeof _0x41c8a0[_0x5126('0x1f')]===_0x5126('0x1e');var _0x317944=_0x3f1299[_0x5126('0x20')];var _0x54053c=_0x178582?0x0:_0x41c8a0[_0x5126('0x21')];var _0x3f7cbb=_0x178582?_0x3f1299[_0x5126('0x20')]:_0x41c8a0[_0x5126('0x21')]+_0x41c8a0[_0x5126('0x1f')];var _0x52bdfa;if(_0x3f7cbb>=_0x317944){_0x3f7cbb=_0x317944;_0x52bdfa=0xc8;}else{_0x52bdfa=0xce;}_0x367344[_0x5126('0x1b')](_0x52bdfa);return _0x367344[_0x5126('0x22')](_0x5126('0x23'),_0x54053c+'-'+_0x3f7cbb+'/'+_0x317944)[_0x5126('0x1d')](_0x3f1299);}return null;};}function patchUpdates(_0x2e25f1){return function(_0x2066db){try{jsonpatch[_0x5126('0x24')](_0x2066db,_0x2e25f1,!![]);}catch(_0x2e8bce){return BPromise[_0x5126('0x25')](_0x2e8bce);}return _0x2066db[_0x5126('0x26')]();};}function saveUpdates(_0x1fcbb1,_0x10f434){return function(_0x5bdced){if(_0x5bdced){return _0x5bdced['update'](_0x1fcbb1)[_0x5126('0x27')](function(_0x379ea8){return _0x379ea8;});}return null;};}function removeEntity(_0x57b624,_0x43e595){return function(_0x969979){if(_0x969979){return _0x969979[_0x5126('0x28')]()[_0x5126('0x27')](function(){var _0x587033=_0x969979[_0x5126('0x29')]({'plain':!![]});var _0x501159=_0x5126('0x2a');return db[_0x5126('0x2b')][_0x5126('0x28')]({'where':{'type':_0x501159,'resourceId':_0x587033['id']}})[_0x5126('0x27')](function(){return _0x969979;});})[_0x5126('0x27')](function(){_0x57b624[_0x5126('0x1b')](0xcc)[_0x5126('0x1c')]();});}};}function handleEntityNotFound(_0x6e969d,_0x4b16c9){return function(_0xaf7b64){if(!_0xaf7b64){_0x6e969d[_0x5126('0x1a')](0x194);}return _0xaf7b64;};}function handleError(_0xabc384,_0x5b6429){_0x5b6429=_0x5b6429||0x1f4;return function(_0x2f8480){logger[_0x5126('0x2c')](_0x2f8480[_0x5126('0x2d')]);if(_0x2f8480[_0x5126('0x2e')]){delete _0x2f8480[_0x5126('0x2e')];}_0xabc384[_0x5126('0x1b')](_0x5b6429)[_0x5126('0x2f')](_0x2f8480);};}exports[_0x5126('0x30')]=function(_0x4eac33,_0x43060a){var _0x59e955={},_0x516b27={},_0x17153b={'count':0x0,'rows':[]};var _0x38f627=_[_0x5126('0x31')](db['Interval'][_0x5126('0x32')],function(_0x5e7137){return{'name':_0x5e7137[_0x5126('0x33')],'type':_0x5e7137[_0x5126('0x34')][_0x5126('0x35')]};});_0x516b27[_0x5126('0x36')]=_['map'](_0x38f627,'name');_0x516b27[_0x5126('0x37')]=_[_0x5126('0x38')](_0x4eac33[_0x5126('0x37')]);_0x516b27['filters']=_[_0x5126('0x39')](_0x516b27[_0x5126('0x36')],_0x516b27[_0x5126('0x37')]);_0x59e955[_0x5126('0x3a')]=_[_0x5126('0x39')](_0x516b27[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x4eac33[_0x5126('0x37')]['fields']));_0x59e955[_0x5126('0x3a')]=_0x59e955[_0x5126('0x3a')]['length']?_0x59e955[_0x5126('0x3a')]:_0x516b27[_0x5126('0x36')];if(!_0x4eac33['query'][_0x5126('0x3c')](_0x5126('0x3d'))){_0x59e955[_0x5126('0x1f')]=qs['limit'](_0x4eac33[_0x5126('0x37')][_0x5126('0x1f')]);_0x59e955['offset']=qs[_0x5126('0x21')](_0x4eac33[_0x5126('0x37')][_0x5126('0x21')]);}_0x59e955[_0x5126('0x3e')]=qs[_0x5126('0x3f')](_0x4eac33[_0x5126('0x37')]['sort']);_0x59e955[_0x5126('0x40')]=qs[_0x5126('0x41')](_[_0x5126('0x42')](_0x4eac33[_0x5126('0x37')],_0x516b27[_0x5126('0x41')]),_0x38f627);if(_0x4eac33[_0x5126('0x37')][_0x5126('0x43')]){_0x59e955['where']=_[_0x5126('0x44')](_0x59e955[_0x5126('0x40')],{'$or':_['map'](_0x38f627,function(_0x4f8cd0){if(_0x4f8cd0[_0x5126('0x34')]!==_0x5126('0x45')){var _0x404783={};_0x404783[_0x4f8cd0[_0x5126('0x2e')]]={'$like':'%'+_0x4eac33[_0x5126('0x37')][_0x5126('0x43')]+'%'};return _0x404783;}})});}_0x59e955=_[_0x5126('0x44')]({},_0x59e955,_0x4eac33[_0x5126('0x46')]);var _0x279506={'where':_0x59e955[_0x5126('0x40')]};return db[_0x5126('0x47')][_0x5126('0x20')](_0x279506)[_0x5126('0x27')](function(_0x678b8a){_0x17153b[_0x5126('0x20')]=_0x678b8a;if(_0x4eac33['query'][_0x5126('0x48')]){_0x59e955['include']=[{'all':!![]}];}return db['Interval'][_0x5126('0x49')](_0x59e955);})[_0x5126('0x27')](function(_0x4de31d){_0x17153b[_0x5126('0x4a')]=_0x4de31d;return _0x17153b;})[_0x5126('0x27')](respondWithFilteredResult(_0x43060a,_0x59e955))[_0x5126('0x4b')](handleError(_0x43060a,null));};exports[_0x5126('0x4c')]=function(_0x525592,_0x3ff9d1){var _0x571fd5={'raw':!![],'where':{'id':_0x525592[_0x5126('0x4d')]['id']}},_0x55063f={};_0x55063f[_0x5126('0x36')]=_['keys'](db[_0x5126('0x47')]['rawAttributes']);_0x55063f[_0x5126('0x37')]=_['keys'](_0x525592['query']);_0x55063f[_0x5126('0x41')]=_[_0x5126('0x39')](_0x55063f[_0x5126('0x36')],_0x55063f[_0x5126('0x37')]);_0x571fd5['attributes']=_[_0x5126('0x39')](_0x55063f[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x525592['query']['fields']));_0x571fd5[_0x5126('0x3a')]=_0x571fd5[_0x5126('0x3a')][_0x5126('0x4e')]?_0x571fd5['attributes']:_0x55063f[_0x5126('0x36')];if(_0x525592['query'][_0x5126('0x48')]){_0x571fd5[_0x5126('0x4f')]=[{'all':!![]}];}_0x571fd5=_[_0x5126('0x44')]({},_0x571fd5,_0x525592[_0x5126('0x46')]);return db['Interval'][_0x5126('0x50')](_0x571fd5)[_0x5126('0x27')](handleEntityNotFound(_0x3ff9d1,null))[_0x5126('0x27')](respondWithResult(_0x3ff9d1,null))[_0x5126('0x4b')](handleError(_0x3ff9d1,null));};exports['create']=function(_0x20ec39,_0x1317b0){return db[_0x5126('0x47')][_0x5126('0x51')](_0x20ec39[_0x5126('0x52')],{})[_0x5126('0x27')](function(_0x2ea8ef){var _0x278858=_0x20ec39[_0x5126('0x53')][_0x5126('0x29')]({'plain':!![]});if(!_0x278858)throw new Error(_0x5126('0x54'));if(_0x278858[_0x5126('0x55')]==='user'){var _0x56be0d=_0x2ea8ef['get']({'plain':!![]});var _0x82f47a=_0x5126('0x2a');return db['UserProfileSection'][_0x5126('0x50')]({'where':{'name':_0x82f47a,'userProfileId':_0x278858['userProfileId']},'raw':!![]})[_0x5126('0x27')](function(_0x24d734){if(_0x24d734&&_0x24d734[_0x5126('0x56')]===0x0){return db[_0x5126('0x2b')][_0x5126('0x51')]({'name':_0x56be0d[_0x5126('0x2e')],'resourceId':_0x56be0d['id'],'type':_0x24d734[_0x5126('0x2e')],'sectionId':_0x24d734['id']},{})[_0x5126('0x27')](function(){return _0x2ea8ef;});}else{return _0x2ea8ef;}})[_0x5126('0x4b')](function(_0x2babe9){logger['error'](_0x5126('0x57'),_0x2babe9);throw _0x2babe9;});}return _0x2ea8ef;})[_0x5126('0x27')](respondWithResult(_0x1317b0,0xc9))[_0x5126('0x4b')](handleError(_0x1317b0,null));};exports[_0x5126('0x58')]=function(_0x5c6626,_0x3394c8){if(_0x5c6626[_0x5126('0x52')]['id']){delete _0x5c6626[_0x5126('0x52')]['id'];}return db[_0x5126('0x47')]['find']({'where':{'id':_0x5c6626[_0x5126('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3394c8,null))[_0x5126('0x27')](saveUpdates(_0x5c6626[_0x5126('0x52')],null))[_0x5126('0x27')](respondWithResult(_0x3394c8,null))[_0x5126('0x4b')](handleError(_0x3394c8,null));};exports['destroy']=function(_0x5d2d11,_0xd9fe66){return db[_0x5126('0x47')][_0x5126('0x50')]({'where':{'id':_0x5d2d11[_0x5126('0x4d')]['id']}})[_0x5126('0x27')](handleEntityNotFound(_0xd9fe66,null))[_0x5126('0x27')](removeEntity(_0xd9fe66,null))[_0x5126('0x4b')](handleError(_0xd9fe66,null));};exports[_0x5126('0x59')]=function(_0x21edd7,_0x59a2fd,_0x1d5706){if(_0x21edd7[_0x5126('0x52')]['id']){delete _0x21edd7[_0x5126('0x52')]['id'];}return db[_0x5126('0x47')][_0x5126('0x50')]({'where':{'id':_0x21edd7[_0x5126('0x4d')]['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x59a2fd,null))[_0x5126('0x27')](function(_0x56fabb){if(_0x56fabb){_0x21edd7[_0x5126('0x52')][_0x5126('0x5a')]=_0x56fabb['id'];return db['Interval'][_0x5126('0x51')](_0x21edd7[_0x5126('0x52')]);}})[_0x5126('0x27')](respondWithResult(_0x59a2fd,null))[_0x5126('0x4b')](handleError(_0x59a2fd,null));};exports[_0x5126('0x5b')]=function(_0x301308,_0x5cdc24,_0x4c0134){var _0x4c36a4={};var _0x2cb7b0={};var _0x4e10fb;var _0x179d55;return db[_0x5126('0x47')]['findOne']({'where':{'id':_0x301308['params']['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x5cdc24,null))[_0x5126('0x27')](function(_0x401a9e){if(_0x401a9e){_0x4e10fb=_0x401a9e;_0x2cb7b0[_0x5126('0x36')]=_['keys'](db['Interval'][_0x5126('0x32')]);_0x2cb7b0[_0x5126('0x37')]=_[_0x5126('0x38')](_0x301308[_0x5126('0x37')]);_0x2cb7b0['filters']=_[_0x5126('0x39')](_0x2cb7b0[_0x5126('0x36')],_0x2cb7b0['query']);_0x4c36a4[_0x5126('0x3a')]=_[_0x5126('0x39')](_0x2cb7b0[_0x5126('0x36')],qs[_0x5126('0x3b')](_0x301308['query'][_0x5126('0x3b')]));_0x4c36a4['attributes']=_0x4c36a4[_0x5126('0x3a')][_0x5126('0x4e')]?_0x4c36a4['attributes']:_0x2cb7b0[_0x5126('0x36')];_0x4c36a4[_0x5126('0x3e')]=qs[_0x5126('0x3f')](_0x301308[_0x5126('0x37')][_0x5126('0x3f')]);_0x4c36a4['where']=qs['filters'](_['pick'](_0x301308[_0x5126('0x37')],_0x2cb7b0[_0x5126('0x41')]));if(_0x301308[_0x5126('0x37')][_0x5126('0x43')]){_0x4c36a4['where']=_[_0x5126('0x44')](_0x4c36a4[_0x5126('0x40')],{'$or':_['map'](_0x4c36a4[_0x5126('0x3a')],function(_0x3300af){var _0x371317={};_0x371317[_0x3300af]={'$like':'%'+_0x301308[_0x5126('0x37')][_0x5126('0x43')]+'%'};return _0x371317;})});}_0x4c36a4=_['merge']({},_0x4c36a4,_0x301308[_0x5126('0x46')]);return _0x4e10fb['getIntervals'](_0x4c36a4);}})[_0x5126('0x27')](function(_0x2501ab){if(_0x2501ab){_0x179d55=_0x2501ab[_0x5126('0x4e')];if(!_0x301308[_0x5126('0x37')][_0x5126('0x3c')](_0x5126('0x3d'))){_0x4c36a4[_0x5126('0x1f')]=qs[_0x5126('0x1f')](_0x301308[_0x5126('0x37')][_0x5126('0x1f')]);_0x4c36a4[_0x5126('0x21')]=qs[_0x5126('0x21')](_0x301308['query'][_0x5126('0x21')]);}return _0x4e10fb['getIntervals'](_0x4c36a4);}})['then'](function(_0xcfa614){if(_0xcfa614){return _0xcfa614?{'count':_0x179d55,'rows':_0xcfa614}:null;}})['then'](respondWithResult(_0x5cdc24,null))[_0x5126('0x4b')](handleError(_0x5cdc24,null));};exports['addIntervals']=function(_0x219f72,_0x3088ba,_0x58e58e){return db['Interval'][_0x5126('0x5c')]({'where':{'id':_0x219f72['params']['id']}})[_0x5126('0x27')](handleEntityNotFound(_0x3088ba,null))[_0x5126('0x27')](function(_0x373fe2){if(_0x373fe2){return db[_0x5126('0x5d')][_0x5126('0x5e')](function(_0x263994){return db['Interval']['destroy']({'where':{'IntervalId':_0x219f72['params']['id']},'transaction':_0x263994})[_0x5126('0x27')](function(_0x1034e3){var _0x53a2e3=_[_0x5126('0x31')](_0x219f72['body'],function(_0x102cf3){delete _0x102cf3['id'];_0x102cf3[_0x5126('0x5a')]=_0x219f72[_0x5126('0x4d')]['id'];return _0x102cf3;});return db[_0x5126('0x47')][_0x5126('0x5f')](_0x53a2e3,{'transaction':_0x263994});});})[_0x5126('0x27')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x219f72[_0x5126('0x4d')]['id']}});});}})[_0x5126('0x27')](respondWithResult(_0x3088ba,null))['catch'](handleError(_0x3088ba,null));}; \ No newline at end of file +var _0x3029=['mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','map','Interval','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','addInterval','findOne','rawAttributes','options','getIntervals','addIntervals','transaction','IntervalId','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x426427,_0x266cdf){var _0x65057d=function(_0x44c3e7){while(--_0x44c3e7){_0x426427['push'](_0x426427['shift']());}};_0x65057d(++_0x266cdf);}(_0x3029,0x15e));var _0x9302=function(_0x138ed8,_0x394451){_0x138ed8=_0x138ed8-0x0;var _0xa1b00e=_0x3029[_0x138ed8];return _0xa1b00e;};'use strict';var emlformat=require(_0x9302('0x0'));var rimraf=require(_0x9302('0x1'));var zipdir=require(_0x9302('0x2'));var jsonpatch=require(_0x9302('0x3'));var rp=require('request-promise');var moment=require(_0x9302('0x4'));var BPromise=require(_0x9302('0x5'));var Mustache=require(_0x9302('0x6'));var util=require(_0x9302('0x7'));var path=require(_0x9302('0x8'));var sox=require(_0x9302('0x9'));var csv=require(_0x9302('0xa'));var ejs=require(_0x9302('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9302('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9302('0xd'));var deskjs=require(_0x9302('0xe'));var toCsv=require(_0x9302('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9302('0xf'));var authService=require(_0x9302('0x10'));var qs=require(_0x9302('0x11'));var as=require(_0x9302('0x12'));var hardwareService=require(_0x9302('0x13'));var logger=require('../../config/logger')(_0x9302('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9302('0x15'))['db'];var extensions=require(_0x9302('0x16'));function respondWithStatusCode(_0x1bdb36,_0x321d2d){_0x321d2d=_0x321d2d||0xcc;return function(_0x24b824){if(_0x24b824){return _0x1bdb36[_0x9302('0x17')](_0x321d2d);}return _0x1bdb36['status'](_0x321d2d)['end']();};}function respondWithResult(_0x1d1f66,_0x121318){_0x121318=_0x121318||0xc8;return function(_0x354596){if(_0x354596){return _0x1d1f66[_0x9302('0x18')](_0x121318)[_0x9302('0x19')](_0x354596);}};}function respondWithFilteredResult(_0x4f045f,_0x59f905){return function(_0x3015ea){if(_0x3015ea){var _0x54683a=typeof _0x59f905[_0x9302('0x1a')]==='undefined'&&typeof _0x59f905[_0x9302('0x1b')]===_0x9302('0x1c');var _0x3256b9=_0x3015ea[_0x9302('0x1d')];var _0x32377a=_0x54683a?0x0:_0x59f905[_0x9302('0x1a')];var _0x1486f0=_0x54683a?_0x3015ea[_0x9302('0x1d')]:_0x59f905['offset']+_0x59f905[_0x9302('0x1b')];var _0xa6f0e4;if(_0x1486f0>=_0x3256b9){_0x1486f0=_0x3256b9;_0xa6f0e4=0xc8;}else{_0xa6f0e4=0xce;}_0x4f045f['status'](_0xa6f0e4);return _0x4f045f[_0x9302('0x1e')](_0x9302('0x1f'),_0x32377a+'-'+_0x1486f0+'/'+_0x3256b9)['json'](_0x3015ea);}return null;};}function patchUpdates(_0x37d231){return function(_0x5d2b4b){try{jsonpatch[_0x9302('0x20')](_0x5d2b4b,_0x37d231,!![]);}catch(_0x2689a9){return BPromise[_0x9302('0x21')](_0x2689a9);}return _0x5d2b4b[_0x9302('0x22')]();};}function saveUpdates(_0x1f13a1,_0x2b0ba7){return function(_0x33cf83){if(_0x33cf83){return _0x33cf83['update'](_0x1f13a1)[_0x9302('0x23')](function(_0x9a86c3){return _0x9a86c3;});}return null;};}function removeEntity(_0x5f388d,_0x1e2b6f){return function(_0x34eb5a){if(_0x34eb5a){return _0x34eb5a[_0x9302('0x24')]()['then'](function(){var _0x2a45d6=_0x34eb5a[_0x9302('0x25')]({'plain':!![]});var _0x174495=_0x9302('0x26');return db[_0x9302('0x27')][_0x9302('0x24')]({'where':{'type':_0x174495,'resourceId':_0x2a45d6['id']}})[_0x9302('0x23')](function(){return _0x34eb5a;});})[_0x9302('0x23')](function(){_0x5f388d['status'](0xcc)[_0x9302('0x28')]();});}};}function handleEntityNotFound(_0x4ef15b,_0x1ee021){return function(_0x97cf9b){if(!_0x97cf9b){_0x4ef15b[_0x9302('0x17')](0x194);}return _0x97cf9b;};}function handleError(_0x401421,_0x38115f){_0x38115f=_0x38115f||0x1f4;return function(_0x57d8ec){logger[_0x9302('0x29')](_0x57d8ec[_0x9302('0x2a')]);if(_0x57d8ec[_0x9302('0x2b')]){delete _0x57d8ec[_0x9302('0x2b')];}_0x401421[_0x9302('0x18')](_0x38115f)[_0x9302('0x2c')](_0x57d8ec);};}exports['index']=function(_0x22addf,_0x383e2f){var _0x224451={},_0x3c195f={},_0x1be2af={'count':0x0,'rows':[]};var _0x369ad1=_[_0x9302('0x2d')](db[_0x9302('0x2e')]['rawAttributes'],function(_0x57f91f){return{'name':_0x57f91f[_0x9302('0x2f')],'type':_0x57f91f[_0x9302('0x30')]['key']};});_0x3c195f[_0x9302('0x31')]=_['map'](_0x369ad1,'name');_0x3c195f[_0x9302('0x32')]=_[_0x9302('0x33')](_0x22addf[_0x9302('0x32')]);_0x3c195f[_0x9302('0x34')]=_[_0x9302('0x35')](_0x3c195f[_0x9302('0x31')],_0x3c195f[_0x9302('0x32')]);_0x224451[_0x9302('0x36')]=_[_0x9302('0x35')](_0x3c195f[_0x9302('0x31')],qs[_0x9302('0x37')](_0x22addf[_0x9302('0x32')][_0x9302('0x37')]));_0x224451['attributes']=_0x224451[_0x9302('0x36')][_0x9302('0x38')]?_0x224451[_0x9302('0x36')]:_0x3c195f[_0x9302('0x31')];if(!_0x22addf[_0x9302('0x32')][_0x9302('0x39')](_0x9302('0x3a'))){_0x224451[_0x9302('0x1b')]=qs[_0x9302('0x1b')](_0x22addf['query'][_0x9302('0x1b')]);_0x224451[_0x9302('0x1a')]=qs[_0x9302('0x1a')](_0x22addf[_0x9302('0x32')][_0x9302('0x1a')]);}_0x224451[_0x9302('0x3b')]=qs['sort'](_0x22addf[_0x9302('0x32')][_0x9302('0x3c')]);_0x224451[_0x9302('0x3d')]=qs[_0x9302('0x34')](_[_0x9302('0x3e')](_0x22addf[_0x9302('0x32')],_0x3c195f[_0x9302('0x34')]),_0x369ad1);if(_0x22addf['query']['filter']){_0x224451[_0x9302('0x3d')]=_[_0x9302('0x3f')](_0x224451[_0x9302('0x3d')],{'$or':_[_0x9302('0x2d')](_0x369ad1,function(_0x2dec32){if(_0x2dec32[_0x9302('0x30')]!==_0x9302('0x40')){var _0x573bcd={};_0x573bcd[_0x2dec32[_0x9302('0x2b')]]={'$like':'%'+_0x22addf[_0x9302('0x32')][_0x9302('0x41')]+'%'};return _0x573bcd;}})});}_0x224451=_[_0x9302('0x3f')]({},_0x224451,_0x22addf['options']);var _0x5845ff={'where':_0x224451[_0x9302('0x3d')]};return db[_0x9302('0x2e')]['count'](_0x5845ff)[_0x9302('0x23')](function(_0x432afe){_0x1be2af[_0x9302('0x1d')]=_0x432afe;if(_0x22addf[_0x9302('0x32')]['includeAll']){_0x224451[_0x9302('0x42')]=[{'all':!![]}];}return db[_0x9302('0x2e')][_0x9302('0x43')](_0x224451);})[_0x9302('0x23')](function(_0x2b2220){_0x1be2af[_0x9302('0x44')]=_0x2b2220;return _0x1be2af;})['then'](respondWithFilteredResult(_0x383e2f,_0x224451))[_0x9302('0x45')](handleError(_0x383e2f,null));};exports[_0x9302('0x46')]=function(_0x51c7aa,_0x1ccfa3){var _0x77304d={'raw':!![],'where':{'id':_0x51c7aa[_0x9302('0x47')]['id']}},_0x4791bf={};_0x4791bf[_0x9302('0x31')]=_['keys'](db['Interval']['rawAttributes']);_0x4791bf['query']=_[_0x9302('0x33')](_0x51c7aa[_0x9302('0x32')]);_0x4791bf[_0x9302('0x34')]=_[_0x9302('0x35')](_0x4791bf[_0x9302('0x31')],_0x4791bf[_0x9302('0x32')]);_0x77304d[_0x9302('0x36')]=_['intersection'](_0x4791bf['model'],qs[_0x9302('0x37')](_0x51c7aa['query'][_0x9302('0x37')]));_0x77304d[_0x9302('0x36')]=_0x77304d[_0x9302('0x36')][_0x9302('0x38')]?_0x77304d['attributes']:_0x4791bf[_0x9302('0x31')];if(_0x51c7aa[_0x9302('0x32')][_0x9302('0x48')]){_0x77304d['include']=[{'all':!![]}];}_0x77304d=_[_0x9302('0x3f')]({},_0x77304d,_0x51c7aa['options']);return db[_0x9302('0x2e')][_0x9302('0x49')](_0x77304d)[_0x9302('0x23')](handleEntityNotFound(_0x1ccfa3,null))['then'](respondWithResult(_0x1ccfa3,null))[_0x9302('0x45')](handleError(_0x1ccfa3,null));};exports[_0x9302('0x4a')]=function(_0x5809e3,_0x1425ad){return db['Interval']['create'](_0x5809e3['body'],{})[_0x9302('0x23')](function(_0x55a0f6){var _0x116067=_0x5809e3[_0x9302('0x4b')][_0x9302('0x25')]({'plain':!![]});if(!_0x116067)throw new Error(_0x9302('0x4c'));if(_0x116067['role']==='user'){var _0x11bcb4=_0x55a0f6['get']({'plain':!![]});var _0x32ff63=_0x9302('0x26');return db[_0x9302('0x4d')]['find']({'where':{'name':_0x32ff63,'userProfileId':_0x116067[_0x9302('0x4e')]},'raw':!![]})[_0x9302('0x23')](function(_0x258d5b){if(_0x258d5b&&_0x258d5b[_0x9302('0x4f')]===0x0){return db[_0x9302('0x27')][_0x9302('0x4a')]({'name':_0x11bcb4['name'],'resourceId':_0x11bcb4['id'],'type':_0x258d5b[_0x9302('0x2b')],'sectionId':_0x258d5b['id']},{})[_0x9302('0x23')](function(){return _0x55a0f6;});}else{return _0x55a0f6;}})[_0x9302('0x45')](function(_0x50bdd8){logger[_0x9302('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50bdd8);throw _0x50bdd8;});}return _0x55a0f6;})['then'](respondWithResult(_0x1425ad,0xc9))[_0x9302('0x45')](handleError(_0x1425ad,null));};exports['update']=function(_0xa80c02,_0x5b847f){if(_0xa80c02[_0x9302('0x50')]['id']){delete _0xa80c02[_0x9302('0x50')]['id'];}return db[_0x9302('0x2e')]['find']({'where':{'id':_0xa80c02['params']['id']}})[_0x9302('0x23')](handleEntityNotFound(_0x5b847f,null))[_0x9302('0x23')](saveUpdates(_0xa80c02[_0x9302('0x50')],null))[_0x9302('0x23')](respondWithResult(_0x5b847f,null))[_0x9302('0x45')](handleError(_0x5b847f,null));};exports[_0x9302('0x24')]=function(_0x1b1ebe,_0xb088c2){return db[_0x9302('0x2e')][_0x9302('0x49')]({'where':{'id':_0x1b1ebe[_0x9302('0x47')]['id']}})[_0x9302('0x23')](handleEntityNotFound(_0xb088c2,null))[_0x9302('0x23')](removeEntity(_0xb088c2,null))[_0x9302('0x45')](handleError(_0xb088c2,null));};exports[_0x9302('0x51')]=function(_0x380b2e,_0x5761f5,_0x1ad890){if(_0x380b2e[_0x9302('0x50')]['id']){delete _0x380b2e['body']['id'];}return db[_0x9302('0x2e')][_0x9302('0x49')]({'where':{'id':_0x380b2e['params']['id']}})['then'](handleEntityNotFound(_0x5761f5,null))['then'](function(_0x3a216d){if(_0x3a216d){_0x380b2e[_0x9302('0x50')]['IntervalId']=_0x3a216d['id'];return db[_0x9302('0x2e')][_0x9302('0x4a')](_0x380b2e[_0x9302('0x50')]);}})[_0x9302('0x23')](respondWithResult(_0x5761f5,null))[_0x9302('0x45')](handleError(_0x5761f5,null));};exports['getIntervals']=function(_0x1f8eb6,_0xe70fc4,_0x592e14){var _0x3601a9={};var _0x4d1264={};var _0x592e8c;var _0x536b3b;return db[_0x9302('0x2e')][_0x9302('0x52')]({'where':{'id':_0x1f8eb6[_0x9302('0x47')]['id']}})['then'](handleEntityNotFound(_0xe70fc4,null))[_0x9302('0x23')](function(_0x21aabe){if(_0x21aabe){_0x592e8c=_0x21aabe;_0x4d1264['model']=_[_0x9302('0x33')](db[_0x9302('0x2e')][_0x9302('0x53')]);_0x4d1264[_0x9302('0x32')]=_[_0x9302('0x33')](_0x1f8eb6[_0x9302('0x32')]);_0x4d1264['filters']=_[_0x9302('0x35')](_0x4d1264[_0x9302('0x31')],_0x4d1264[_0x9302('0x32')]);_0x3601a9['attributes']=_['intersection'](_0x4d1264[_0x9302('0x31')],qs[_0x9302('0x37')](_0x1f8eb6[_0x9302('0x32')][_0x9302('0x37')]));_0x3601a9[_0x9302('0x36')]=_0x3601a9[_0x9302('0x36')]['length']?_0x3601a9[_0x9302('0x36')]:_0x4d1264[_0x9302('0x31')];_0x3601a9[_0x9302('0x3b')]=qs[_0x9302('0x3c')](_0x1f8eb6[_0x9302('0x32')]['sort']);_0x3601a9[_0x9302('0x3d')]=qs['filters'](_[_0x9302('0x3e')](_0x1f8eb6[_0x9302('0x32')],_0x4d1264[_0x9302('0x34')]));if(_0x1f8eb6[_0x9302('0x32')][_0x9302('0x41')]){_0x3601a9[_0x9302('0x3d')]=_[_0x9302('0x3f')](_0x3601a9[_0x9302('0x3d')],{'$or':_[_0x9302('0x2d')](_0x3601a9['attributes'],function(_0x4c68a2){var _0x23a175={};_0x23a175[_0x4c68a2]={'$like':'%'+_0x1f8eb6[_0x9302('0x32')]['filter']+'%'};return _0x23a175;})});}_0x3601a9=_['merge']({},_0x3601a9,_0x1f8eb6[_0x9302('0x54')]);return _0x592e8c[_0x9302('0x55')](_0x3601a9);}})['then'](function(_0x2ec5a7){if(_0x2ec5a7){_0x536b3b=_0x2ec5a7[_0x9302('0x38')];if(!_0x1f8eb6['query'][_0x9302('0x39')](_0x9302('0x3a'))){_0x3601a9[_0x9302('0x1b')]=qs[_0x9302('0x1b')](_0x1f8eb6[_0x9302('0x32')][_0x9302('0x1b')]);_0x3601a9[_0x9302('0x1a')]=qs['offset'](_0x1f8eb6[_0x9302('0x32')][_0x9302('0x1a')]);}return _0x592e8c[_0x9302('0x55')](_0x3601a9);}})['then'](function(_0x13aa81){if(_0x13aa81){return _0x13aa81?{'count':_0x536b3b,'rows':_0x13aa81}:null;}})[_0x9302('0x23')](respondWithResult(_0xe70fc4,null))[_0x9302('0x45')](handleError(_0xe70fc4,null));};exports[_0x9302('0x56')]=function(_0x4ee549,_0x35eb9b,_0xbd70be){return db['Interval'][_0x9302('0x52')]({'where':{'id':_0x4ee549[_0x9302('0x47')]['id']}})[_0x9302('0x23')](handleEntityNotFound(_0x35eb9b,null))[_0x9302('0x23')](function(_0x1f118e){if(_0x1f118e){return db['sequelize'][_0x9302('0x57')](function(_0x43aa46){return db['Interval'][_0x9302('0x24')]({'where':{'IntervalId':_0x4ee549[_0x9302('0x47')]['id']},'transaction':_0x43aa46})[_0x9302('0x23')](function(_0x5c3079){var _0x1a8ac9=_['map'](_0x4ee549[_0x9302('0x50')],function(_0x248de9){delete _0x248de9['id'];_0x248de9[_0x9302('0x58')]=_0x4ee549[_0x9302('0x47')]['id'];return _0x248de9;});return db[_0x9302('0x2e')]['bulkCreate'](_0x1a8ac9,{'transaction':_0x43aa46});});})[_0x9302('0x23')](function(){return db[_0x9302('0x2e')][_0x9302('0x43')]({'where':{'IntervalId':_0x4ee549[_0x9302('0x47')]['id']}});});}})[_0x9302('0x23')](respondWithResult(_0x35eb9b,null))['catch'](handleError(_0x35eb9b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 110e735..fa3bb13 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 _0xbb48=['rewrite','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./interval.attributes','exports','define'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0xbb48,0x9b));var _0x8bb4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb48[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x8bb4('0x0'));var util=require(_0x8bb4('0x1'));var logger=require(_0x8bb4('0x2'))(_0x8bb4('0x3'));var moment=require('moment');var BPromise=require(_0x8bb4('0x4'));var rp=require(_0x8bb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8bb4('0x6'));var attributes=require(_0x8bb4('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x8bb4('0x8')]=function(_0x1cbe01,_0x3a8cfa){return _0x1cbe01[_0x8bb4('0x9')]('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5011a2,_0x555a1c){extensions['rewrite'](_0x1cbe01,_0x5011a2);},'afterBulkCreate':function(_0x30c783,_0xaad904,_0xed2b7e){_0xed2b7e();extensions[_0x8bb4('0xa')](_0x1cbe01,_0x30c783[0x0]);},'afterUpdate':function(_0x4e1ca5,_0x274204){extensions[_0x8bb4('0xa')](_0x1cbe01,_0x4e1ca5);},'afterDestroy':function(_0xbed9c,_0x1e5fc3){extensions[_0x8bb4('0xa')](_0x1cbe01,_0xbed9c);}}});}; \ No newline at end of file +var _0x7709=['util','../../config/logger','path','rimraf','../../config/environment','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash'];(function(_0x2666c8,_0xc29795){var _0x1f01a4=function(_0x2ea25a){while(--_0x2ea25a){_0x2666c8['push'](_0x2666c8['shift']());}};_0x1f01a4(++_0xc29795);}(_0x7709,0xa4));var _0x9770=function(_0xb38255,_0x21b269){_0xb38255=_0xb38255-0x0;var _0x550d38=_0x7709[_0xb38255];return _0x550d38;};'use strict';var _=require(_0x9770('0x0'));var util=require(_0x9770('0x1'));var logger=require(_0x9770('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9770('0x3'));var rimraf=require(_0x9770('0x4'));var config=require(_0x9770('0x5'));var attributes=require('./interval.attributes');var extensions=require(_0x9770('0x6'));module[_0x9770('0x7')]=function(_0x5c4bab,_0x3c391b){return _0x5c4bab[_0x9770('0x8')](_0x9770('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x52d296,_0x4d5c89){extensions[_0x9770('0xa')](_0x5c4bab,_0x52d296);},'afterBulkCreate':function(_0x496121,_0x59e0f9,_0x106979){_0x106979();extensions[_0x9770('0xa')](_0x5c4bab,_0x496121[0x0]);},'afterUpdate':function(_0xb3cde7,_0x3ca0d8){extensions[_0x9770('0xa')](_0x5c4bab,_0xb3cde7);},'afterDestroy':function(_0x5a9c32,_0x581d8a){extensions[_0x9770('0xa')](_0x5c4bab,_0x5a9c32);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 46aece7..ca00285 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(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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(_0x2b9cf5,_0x2a7804){var _0xd0cf15=function(_0x92a896){while(--_0x92a896){_0x2b9cf5['push'](_0x2b9cf5['shift']());}};_0xd0cf15(++_0x2a7804);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var 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 735fedb..70b05df 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(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0xdb28=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller'];(function(_0x22ab01,_0x16b6ce){var _0x54e4cb=function(_0x187065){while(--_0x187065){_0x22ab01['push'](_0x22ab01['shift']());}};_0x54e4cb(++_0x16b6ce);}(_0xdb28,0x106));var _0x8db2=function(_0x4e9f8f,_0x3e3e1c){_0x4e9f8f=_0x4e9f8f-0x0;var _0x400088=_0xdb28[_0x4e9f8f];return _0x400088;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['post']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);module[_0x8db2('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index b20dd8d..f46eb30 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 _0x0c12=['socket','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','oldToken','newToken','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','send','x-forwarded-for','connection','remoteAddress'];(function(_0x70246c,_0x3019f3){var _0x1e7061=function(_0x5d1a5f){while(--_0x5d1a5f){_0x70246c['push'](_0x70246c['shift']());}};_0x1e7061(++_0x3019f3);}(_0x0c12,0xc9));var _0x20c1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0c12[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require('../../config/logger')(_0x20c1('0x0'));var USERNAME=_0x20c1('0x1');var PASSWORD=_0x20c1('0x2');function openIssue(_0x1fe6aa,_0x220c2b){var _0x4f9e8a={'fields':{'project':{'key':_0x1fe6aa[_0x20c1('0x3')]||_0x20c1('0x4')},'summary':(_0x1fe6aa[_0x20c1('0x5')]||_0x20c1('0x6'))+_0x20c1('0x7')+_0x1fe6aa['ip'],'description':_0x1fe6aa[_0x20c1('0x8')]||JSON[_0x20c1('0x9')](_0x1fe6aa),'issuetype':{'name':_0x1fe6aa[_0x20c1('0xa')]||_0x20c1('0xb')}}};_0x4f9e8a[_0x20c1('0xc')][_0x20c1('0xd')]=_0x1fe6aa['email'];_0x4f9e8a[_0x20c1('0xc')]['customfield_11501']=_0x1fe6aa[_0x20c1('0xe')];_0x4f9e8a[_0x20c1('0xc')]['customfield_11502']=_0x1fe6aa[_0x20c1('0xf')];_0x4f9e8a[_0x20c1('0xc')]['customfield_11503']=_0x1fe6aa[_0x20c1('0x10')];_0x4f9e8a['fields'][_0x20c1('0x11')]=_0x1fe6aa['reason'];_0x4f9e8a[_0x20c1('0xc')][_0x20c1('0x12')]=_0x1fe6aa['ip'];var _0x2730dc={'host':_0x20c1('0x13'),'port':0x1bb,'path':_0x20c1('0x14'),'method':_0x20c1('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x20c1('0x16'),'Authorization':_0x20c1('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x20c1('0x18')]('base64')}};var _0x16978f=JSON[_0x20c1('0x9')](_0x4f9e8a);var _0x1a5afd=https[_0x20c1('0x19')](_0x2730dc,function(_0x1046fc){_0x1046fc[_0x20c1('0x1a')]('utf8');var _0x348fa3='';_0x1046fc['on'](_0x20c1('0x1b'),function(_0x4e7764){_0x348fa3+=_0x4e7764;});_0x1046fc['on'](_0x20c1('0x1c'),function(){if(_0x220c2b){return _0x220c2b[_0x20c1('0x1d')](_0x1046fc[_0x20c1('0x1e')])[_0x20c1('0x1f')](JSON[_0x20c1('0x20')](_0x348fa3));}});});_0x1a5afd['on'](_0x20c1('0x21'),function(_0xc59b6a){if(_0x220c2b){return _0x220c2b[_0x20c1('0x1d')](0x1f4)[_0x20c1('0x1f')]({'errors':[{'message':_0x20c1('0x22'),'type':'api.jira'}]});}});_0x1a5afd['write'](_0x16978f);_0x1a5afd[_0x20c1('0x1c')]();}exports['openIssue']=openIssue;exports[_0x20c1('0x23')]=function(_0x5e74d5,_0x251179){_0x5e74d5['body']['ip']=_0x5e74d5['headers'][_0x20c1('0x24')]||_0x5e74d5[_0x20c1('0x25')][_0x20c1('0x26')]||_0x5e74d5[_0x20c1('0x27')][_0x20c1('0x26')]||_0x5e74d5[_0x20c1('0x25')][_0x20c1('0x27')][_0x20c1('0x26')];return openIssue(_0x5e74d5['body'],_0x251179);}; \ No newline at end of file +var _0xae71=['issuetype','fields','customfield_11500','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','stringify','setEncoding','utf8','data','end','statusCode','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','../../config/logger','api','3eAmWpBVP0','key','summary','Report','description'];(function(_0x4d98cc,_0x92dc34){var _0xf66eb5=function(_0x4f4643){while(--_0x4f4643){_0x4d98cc['push'](_0x4d98cc['shift']());}};_0xf66eb5(++_0x92dc34);}(_0xae71,0xd9));var _0x1ae7=function(_0x48147a,_0x3b0b76){_0x48147a=_0x48147a-0x0;var _0x5b061f=_0xae71[_0x48147a];return _0x5b061f;};'use strict';var BPromise=require(_0x1ae7('0x0'));var https=require('https');var logger=require(_0x1ae7('0x1'))(_0x1ae7('0x2'));var USERNAME='support';var PASSWORD=_0x1ae7('0x3');function openIssue(_0x235613,_0x1ce42a){var _0x32975f={'fields':{'project':{'key':_0x235613[_0x1ae7('0x4')]||'MOTGUI'},'summary':(_0x235613[_0x1ae7('0x5')]||_0x1ae7('0x6'))+'\x20from\x20'+_0x235613['ip'],'description':_0x235613[_0x1ae7('0x7')]||JSON['stringify'](_0x235613),'issuetype':{'name':_0x235613[_0x1ae7('0x8')]||'Bug'}}};_0x32975f[_0x1ae7('0x9')][_0x1ae7('0xa')]=_0x235613[_0x1ae7('0xb')];_0x32975f[_0x1ae7('0x9')]['customfield_11501']=_0x235613[_0x1ae7('0xc')];_0x32975f[_0x1ae7('0x9')][_0x1ae7('0xd')]=_0x235613[_0x1ae7('0xe')];_0x32975f[_0x1ae7('0x9')][_0x1ae7('0xf')]=_0x235613[_0x1ae7('0x10')];_0x32975f[_0x1ae7('0x9')][_0x1ae7('0x11')]=_0x235613[_0x1ae7('0x12')];_0x32975f[_0x1ae7('0x9')][_0x1ae7('0x13')]=_0x235613['ip'];var _0x44b43a={'host':_0x1ae7('0x14'),'port':0x1bb,'path':_0x1ae7('0x15'),'method':_0x1ae7('0x16'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x1ae7('0x17')](_0x1ae7('0x18'))}};var _0x410d25=JSON[_0x1ae7('0x19')](_0x32975f);var _0x3bb4c6=https['request'](_0x44b43a,function(_0xe22943){_0xe22943[_0x1ae7('0x1a')](_0x1ae7('0x1b'));var _0x53ac0a='';_0xe22943['on'](_0x1ae7('0x1c'),function(_0x2ddce2){_0x53ac0a+=_0x2ddce2;});_0xe22943['on'](_0x1ae7('0x1d'),function(){if(_0x1ce42a){return _0x1ce42a['status'](_0xe22943[_0x1ae7('0x1e')])[_0x1ae7('0x1f')](JSON['parse'](_0x53ac0a));}});});_0x3bb4c6['on'](_0x1ae7('0x20'),function(_0x36bb85){if(_0x1ce42a){return _0x1ce42a[_0x1ae7('0x21')](0x1f4)[_0x1ae7('0x1f')]({'errors':[{'message':_0x1ae7('0x22'),'type':_0x1ae7('0x23')}]});}});_0x3bb4c6[_0x1ae7('0x24')](_0x410d25);_0x3bb4c6[_0x1ae7('0x1d')]();}exports[_0x1ae7('0x25')]=openIssue;exports[_0x1ae7('0x26')]=function(_0xa3570d,_0x54dc25){_0xa3570d[_0x1ae7('0x27')]['ip']=_0xa3570d[_0x1ae7('0x28')][_0x1ae7('0x29')]||_0xa3570d[_0x1ae7('0x2a')][_0x1ae7('0x2b')]||_0xa3570d[_0x1ae7('0x2c')][_0x1ae7('0x2b')]||_0xa3570d['connection'][_0x1ae7('0x2c')][_0x1ae7('0x2b')];return openIssue(_0xa3570d[_0x1ae7('0x27')],_0x54dc25);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 08f97b1..27bb05c 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 _0x0a9a=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','destroy','util','connect-timeout','express'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x0a9a,0x183));var _0xa0a9=function(_0x38042c,_0x2d4ad8){_0x38042c=_0x38042c-0x0;var _0x4207f5=_0x0a9a[_0x38042c];return _0x4207f5;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./jscriptyAnswerReport.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/describe',auth[_0xa0a9('0x8')](),controller['describe']);router[_0xa0a9('0x7')](_0xa0a9('0xa'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xb')]);router['post']('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router['put']('/:id',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);router['delete'](_0xa0a9('0xa'),auth['isAuthenticated'](),controller[_0xa0a9('0xe')]);module['exports']=router; \ No newline at end of file +var _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x5c03e4,_0x40fe62){var _0x776c2a=function(_0x4d67a8){while(--_0x4d67a8){_0x5c03e4['push'](_0x5c03e4['shift']());}};_0x776c2a(++_0x40fe62);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x33f841,_0x2f5b6b){_0x33f841=_0x33f841-0x0;var _0x446e55=_0x6f0d[_0x33f841];return _0x446e55;};'use strict';var multer=require('multer');var util=require(_0xd6f0('0x0'));var path=require(_0xd6f0('0x1'));var timeout=require(_0xd6f0('0x2'));var express=require(_0xd6f0('0x3'));var router=express['Router']();var fs_extra=require(_0xd6f0('0x4'));var auth=require(_0xd6f0('0x5'));var interaction=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var controller=require(_0xd6f0('0x8'));router['get']('/',auth[_0xd6f0('0x9')](),controller['index']);router[_0xd6f0('0xa')](_0xd6f0('0xb'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 12c537d..144ac64 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(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7a54,0x106));var _0x47a5=function(_0x429d23,_0x217743){_0x429d23=_0x429d23-0x0;var _0xf7d9f=_0x7a54[_0x429d23];return _0xf7d9f;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2b8834,_0x7fa2dd){_0x2b8834=_0x2b8834-0x0;var _0x5296b0=_0x7a54[_0x2b8834];return _0x5296b0;};'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 5e090a1..19c09c5 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 _0x0763=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','JscriptyAnswerReport','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0763,0x87));var _0x3076=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x0763[_0x2d4421];return _0x2d3b01;};'use strict';var emlformat=require(_0x3076('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3076('0x1'));var jsonpatch=require(_0x3076('0x2'));var rp=require('request-promise');var moment=require(_0x3076('0x3'));var BPromise=require(_0x3076('0x4'));var Mustache=require(_0x3076('0x5'));var util=require(_0x3076('0x6'));var path=require('path');var sox=require(_0x3076('0x7'));var csv=require(_0x3076('0x8'));var ejs=require(_0x3076('0x9'));var fs=require('fs');var fs_extra=require(_0x3076('0xa'));var _=require(_0x3076('0xb'));var squel=require(_0x3076('0xc'));var crypto=require(_0x3076('0xd'));var jsforce=require(_0x3076('0xe'));var deskjs=require(_0x3076('0xf'));var toCsv=require(_0x3076('0x8'));var querystring=require('querystring');var Papa=require(_0x3076('0x10'));var Redis=require(_0x3076('0x11'));var authService=require(_0x3076('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3076('0x13'));var logger=require(_0x3076('0x14'))(_0x3076('0x15'));var utils=require(_0x3076('0x16'));var config=require(_0x3076('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3076('0x18'))['db'];function respondWithStatusCode(_0x209fc0,_0x2fe9d1){_0x2fe9d1=_0x2fe9d1||0xcc;return function(_0xc917fd){if(_0xc917fd){return _0x209fc0[_0x3076('0x19')](_0x2fe9d1);}return _0x209fc0[_0x3076('0x1a')](_0x2fe9d1)[_0x3076('0x1b')]();};}function respondWithResult(_0x3a6f74,_0x54ff6a){_0x54ff6a=_0x54ff6a||0xc8;return function(_0x5542c7){if(_0x5542c7){return _0x3a6f74[_0x3076('0x1a')](_0x54ff6a)[_0x3076('0x1c')](_0x5542c7);}};}function respondWithFilteredResult(_0x3bc84d,_0x1b2256){return function(_0x5a2088){if(_0x5a2088){var _0x5bf9ec=typeof _0x1b2256[_0x3076('0x1d')]===_0x3076('0x1e')&&typeof _0x1b2256[_0x3076('0x1f')]===_0x3076('0x1e');var _0x3d56fe=_0x5a2088[_0x3076('0x20')];var _0x21c242=_0x5bf9ec?0x0:_0x1b2256[_0x3076('0x1d')];var _0x1880b8=_0x5bf9ec?_0x5a2088[_0x3076('0x20')]:_0x1b2256[_0x3076('0x1d')]+_0x1b2256[_0x3076('0x1f')];var _0x4e441d;if(_0x1880b8>=_0x3d56fe){_0x1880b8=_0x3d56fe;_0x4e441d=0xc8;}else{_0x4e441d=0xce;}_0x3bc84d[_0x3076('0x1a')](_0x4e441d);return _0x3bc84d[_0x3076('0x21')]('Content-Range',_0x21c242+'-'+_0x1880b8+'/'+_0x3d56fe)[_0x3076('0x1c')](_0x5a2088);}return null;};}function patchUpdates(_0x50f366){return function(_0x34c831){try{jsonpatch[_0x3076('0x22')](_0x34c831,_0x50f366,!![]);}catch(_0x1f8914){return BPromise['reject'](_0x1f8914);}return _0x34c831[_0x3076('0x23')]();};}function saveUpdates(_0x250cc4,_0x2398f4){return function(_0x9b4bec){if(_0x9b4bec){return _0x9b4bec[_0x3076('0x24')](_0x250cc4)[_0x3076('0x25')](function(_0x1a2131){return _0x1a2131;});}return null;};}function removeEntity(_0xa975bc,_0x195606){return function(_0x39a33c){if(_0x39a33c){return _0x39a33c['destroy']()[_0x3076('0x25')](function(){_0xa975bc['status'](0xcc)[_0x3076('0x1b')]();});}};}function handleEntityNotFound(_0x4f4bdc,_0x53b45d){return function(_0x41ecf4){if(!_0x41ecf4){_0x4f4bdc[_0x3076('0x19')](0x194);}return _0x41ecf4;};}function handleError(_0x2f0848,_0x1b169b){_0x1b169b=_0x1b169b||0x1f4;return function(_0x28d834){logger[_0x3076('0x26')](_0x28d834[_0x3076('0x27')]);if(_0x28d834[_0x3076('0x28')]){delete _0x28d834[_0x3076('0x28')];}_0x2f0848[_0x3076('0x1a')](_0x1b169b)[_0x3076('0x29')](_0x28d834);};}exports['index']=function(_0x181591,_0x45805e){var _0x32bdbd={},_0x5af88e={},_0x330365={'count':0x0,'rows':[]};var _0x332a3b=_['map'](db[_0x3076('0x2a')][_0x3076('0x2b')],function(_0x5480eb){return{'name':_0x5480eb[_0x3076('0x2c')],'type':_0x5480eb['type']['key']};});_0x5af88e[_0x3076('0x2d')]=_[_0x3076('0x2e')](_0x332a3b,_0x3076('0x28'));_0x5af88e['query']=_[_0x3076('0x2f')](_0x181591[_0x3076('0x30')]);_0x5af88e[_0x3076('0x31')]=_[_0x3076('0x32')](_0x5af88e['model'],_0x5af88e[_0x3076('0x30')]);_0x32bdbd[_0x3076('0x33')]=_[_0x3076('0x32')](_0x5af88e[_0x3076('0x2d')],qs[_0x3076('0x34')](_0x181591['query'][_0x3076('0x34')]));_0x32bdbd[_0x3076('0x33')]=_0x32bdbd[_0x3076('0x33')][_0x3076('0x35')]?_0x32bdbd[_0x3076('0x33')]:_0x5af88e[_0x3076('0x2d')];if(!_0x181591['query'][_0x3076('0x36')]('nolimit')){_0x32bdbd[_0x3076('0x1f')]=qs[_0x3076('0x1f')](_0x181591[_0x3076('0x30')][_0x3076('0x1f')]);_0x32bdbd[_0x3076('0x1d')]=qs[_0x3076('0x1d')](_0x181591[_0x3076('0x30')][_0x3076('0x1d')]);}_0x32bdbd[_0x3076('0x37')]=qs[_0x3076('0x38')](_0x181591[_0x3076('0x30')][_0x3076('0x38')]);_0x32bdbd[_0x3076('0x39')]=qs[_0x3076('0x31')](_[_0x3076('0x3a')](_0x181591[_0x3076('0x30')],_0x5af88e[_0x3076('0x31')]),_0x332a3b);if(_0x181591[_0x3076('0x30')][_0x3076('0x3b')]){_0x32bdbd[_0x3076('0x39')]=_[_0x3076('0x3c')](_0x32bdbd[_0x3076('0x39')],{'$or':_[_0x3076('0x2e')](_0x332a3b,function(_0x852954){if(_0x852954[_0x3076('0x3d')]!==_0x3076('0x3e')){var _0x45ac78={};_0x45ac78[_0x852954['name']]={'$like':'%'+_0x181591[_0x3076('0x30')][_0x3076('0x3b')]+'%'};return _0x45ac78;}})});}_0x32bdbd=_[_0x3076('0x3c')]({},_0x32bdbd,_0x181591[_0x3076('0x3f')]);var _0x5b794a={'where':_0x32bdbd[_0x3076('0x39')]};return db[_0x3076('0x2a')][_0x3076('0x20')](_0x5b794a)[_0x3076('0x25')](function(_0x1d400c){_0x330365['count']=_0x1d400c;if(_0x181591[_0x3076('0x30')][_0x3076('0x40')]){_0x32bdbd[_0x3076('0x41')]=[{'all':!![]}];}return db[_0x3076('0x2a')]['findAll'](_0x32bdbd);})[_0x3076('0x25')](function(_0x526ad1){_0x330365[_0x3076('0x42')]=_0x526ad1;return _0x330365;})[_0x3076('0x25')](respondWithFilteredResult(_0x45805e,_0x32bdbd))[_0x3076('0x43')](handleError(_0x45805e,null));};exports[_0x3076('0x44')]=function(_0x3475f7,_0x2f4479){var _0x5b6d81={'raw':!![],'where':{'id':_0x3475f7[_0x3076('0x45')]['id']}},_0x5e0820={};_0x5e0820[_0x3076('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0x3076('0x2b')]);_0x5e0820[_0x3076('0x30')]=_[_0x3076('0x2f')](_0x3475f7[_0x3076('0x30')]);_0x5e0820['filters']=_[_0x3076('0x32')](_0x5e0820[_0x3076('0x2d')],_0x5e0820[_0x3076('0x30')]);_0x5b6d81['attributes']=_[_0x3076('0x32')](_0x5e0820[_0x3076('0x2d')],qs['fields'](_0x3475f7['query']['fields']));_0x5b6d81['attributes']=_0x5b6d81[_0x3076('0x33')]['length']?_0x5b6d81[_0x3076('0x33')]:_0x5e0820['model'];if(_0x3475f7['query'][_0x3076('0x40')]){_0x5b6d81[_0x3076('0x41')]=[{'all':!![]}];}_0x5b6d81=_[_0x3076('0x3c')]({},_0x5b6d81,_0x3475f7[_0x3076('0x3f')]);return db[_0x3076('0x2a')][_0x3076('0x46')](_0x5b6d81)[_0x3076('0x25')](handleEntityNotFound(_0x2f4479,null))[_0x3076('0x25')](respondWithResult(_0x2f4479,null))[_0x3076('0x43')](handleError(_0x2f4479,null));};exports[_0x3076('0x47')]=function(_0x36970c,_0x46fdf0){return db['JscriptyAnswerReport'][_0x3076('0x47')](_0x36970c['body'],{})[_0x3076('0x25')](respondWithResult(_0x46fdf0,0xc9))[_0x3076('0x43')](handleError(_0x46fdf0,null));};exports['update']=function(_0x5a7b95,_0x431a9e){if(_0x5a7b95[_0x3076('0x48')]['id']){delete _0x5a7b95[_0x3076('0x48')]['id'];}return db[_0x3076('0x2a')]['find']({'where':{'id':_0x5a7b95[_0x3076('0x45')]['id']}})[_0x3076('0x25')](handleEntityNotFound(_0x431a9e,null))['then'](saveUpdates(_0x5a7b95[_0x3076('0x48')],null))['then'](respondWithResult(_0x431a9e,null))['catch'](handleError(_0x431a9e,null));};exports[_0x3076('0x49')]=function(_0x6e5a16,_0x1c985d){return db[_0x3076('0x2a')][_0x3076('0x46')]({'where':{'id':_0x6e5a16[_0x3076('0x45')]['id']}})[_0x3076('0x25')](handleEntityNotFound(_0x1c985d,null))['then'](removeEntity(_0x1c985d,null))[_0x3076('0x43')](handleError(_0x1c985d,null));};exports['describe']=function(_0xa0e598,_0x382dd0){return db['JscriptyAnswerReport']['describe']()['then'](respondWithResult(_0x382dd0,null))[_0x3076('0x43')](handleError(_0x382dd0,null));}; \ No newline at end of file +var _0x9c63=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','apply','update','then','destroy','stack','name','send','index','JscriptyAnswerReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x4f29fb,_0x5ca0e1){var _0x340a1f=function(_0x39c0cc){while(--_0x39c0cc){_0x4f29fb['push'](_0x4f29fb['shift']());}};_0x340a1f(++_0x5ca0e1);}(_0x9c63,0x1a7));var _0x39c6=function(_0x346e53,_0xf6a8a1){_0x346e53=_0x346e53-0x0;var _0x5d3e9f=_0x9c63[_0x346e53];return _0x5d3e9f;};'use strict';var emlformat=require(_0x39c6('0x0'));var rimraf=require(_0x39c6('0x1'));var zipdir=require(_0x39c6('0x2'));var jsonpatch=require(_0x39c6('0x3'));var rp=require(_0x39c6('0x4'));var moment=require('moment');var BPromise=require(_0x39c6('0x5'));var Mustache=require(_0x39c6('0x6'));var util=require('util');var path=require('path');var sox=require(_0x39c6('0x7'));var csv=require(_0x39c6('0x8'));var ejs=require(_0x39c6('0x9'));var fs=require('fs');var fs_extra=require(_0x39c6('0xa'));var _=require(_0x39c6('0xb'));var squel=require(_0x39c6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39c6('0xd'));var deskjs=require(_0x39c6('0xe'));var toCsv=require(_0x39c6('0x8'));var querystring=require(_0x39c6('0xf'));var Papa=require(_0x39c6('0x10'));var Redis=require('ioredis');var authService=require(_0x39c6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x39c6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39c6('0x13'))(_0x39c6('0x14'));var utils=require(_0x39c6('0x15'));var config=require(_0x39c6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x39c6('0x17'))['db'];function respondWithStatusCode(_0x5a9e9a,_0x58a65f){_0x58a65f=_0x58a65f||0xcc;return function(_0x1f3e1d){if(_0x1f3e1d){return _0x5a9e9a[_0x39c6('0x18')](_0x58a65f);}return _0x5a9e9a[_0x39c6('0x19')](_0x58a65f)[_0x39c6('0x1a')]();};}function respondWithResult(_0x504041,_0x124d43){_0x124d43=_0x124d43||0xc8;return function(_0x4c83dc){if(_0x4c83dc){return _0x504041[_0x39c6('0x19')](_0x124d43)[_0x39c6('0x1b')](_0x4c83dc);}};}function respondWithFilteredResult(_0x2ac896,_0x4c732a){return function(_0x5e3046){if(_0x5e3046){var _0x4581d7=typeof _0x4c732a[_0x39c6('0x1c')]==='undefined'&&typeof _0x4c732a[_0x39c6('0x1d')]===_0x39c6('0x1e');var _0x10ffb8=_0x5e3046[_0x39c6('0x1f')];var _0x129613=_0x4581d7?0x0:_0x4c732a[_0x39c6('0x1c')];var _0x518536=_0x4581d7?_0x5e3046['count']:_0x4c732a['offset']+_0x4c732a['limit'];var _0x524702;if(_0x518536>=_0x10ffb8){_0x518536=_0x10ffb8;_0x524702=0xc8;}else{_0x524702=0xce;}_0x2ac896[_0x39c6('0x19')](_0x524702);return _0x2ac896['set']('Content-Range',_0x129613+'-'+_0x518536+'/'+_0x10ffb8)[_0x39c6('0x1b')](_0x5e3046);}return null;};}function patchUpdates(_0x37dce5){return function(_0x1d91aa){try{jsonpatch[_0x39c6('0x20')](_0x1d91aa,_0x37dce5,!![]);}catch(_0x5608dd){return BPromise['reject'](_0x5608dd);}return _0x1d91aa['save']();};}function saveUpdates(_0x35fc85,_0x588c1d){return function(_0x5d4083){if(_0x5d4083){return _0x5d4083[_0x39c6('0x21')](_0x35fc85)[_0x39c6('0x22')](function(_0x358f6f){return _0x358f6f;});}return null;};}function removeEntity(_0x2e88a3,_0x3e4d7d){return function(_0x33132f){if(_0x33132f){return _0x33132f[_0x39c6('0x23')]()[_0x39c6('0x22')](function(){_0x2e88a3[_0x39c6('0x19')](0xcc)[_0x39c6('0x1a')]();});}};}function handleEntityNotFound(_0x2fd3a7,_0x3018f6){return function(_0x3e49ca){if(!_0x3e49ca){_0x2fd3a7[_0x39c6('0x18')](0x194);}return _0x3e49ca;};}function handleError(_0x1ebdf2,_0x46d0c3){_0x46d0c3=_0x46d0c3||0x1f4;return function(_0x1708e7){logger['error'](_0x1708e7[_0x39c6('0x24')]);if(_0x1708e7[_0x39c6('0x25')]){delete _0x1708e7[_0x39c6('0x25')];}_0x1ebdf2['status'](_0x46d0c3)[_0x39c6('0x26')](_0x1708e7);};}exports[_0x39c6('0x27')]=function(_0x185869,_0x179f15){var _0x5c07f7={},_0x4937c4={},_0x43d1be={'count':0x0,'rows':[]};var _0x243d47=_['map'](db[_0x39c6('0x28')]['rawAttributes'],function(_0x520e8a){return{'name':_0x520e8a[_0x39c6('0x29')],'type':_0x520e8a[_0x39c6('0x2a')][_0x39c6('0x2b')]};});_0x4937c4[_0x39c6('0x2c')]=_[_0x39c6('0x2d')](_0x243d47,_0x39c6('0x25'));_0x4937c4[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x185869[_0x39c6('0x2e')]);_0x4937c4[_0x39c6('0x30')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],_0x4937c4[_0x39c6('0x2e')]);_0x5c07f7[_0x39c6('0x32')]=_[_0x39c6('0x31')](_0x4937c4[_0x39c6('0x2c')],qs[_0x39c6('0x33')](_0x185869['query']['fields']));_0x5c07f7[_0x39c6('0x32')]=_0x5c07f7[_0x39c6('0x32')][_0x39c6('0x34')]?_0x5c07f7[_0x39c6('0x32')]:_0x4937c4[_0x39c6('0x2c')];if(!_0x185869[_0x39c6('0x2e')][_0x39c6('0x35')]('nolimit')){_0x5c07f7[_0x39c6('0x1d')]=qs[_0x39c6('0x1d')](_0x185869['query']['limit']);_0x5c07f7[_0x39c6('0x1c')]=qs[_0x39c6('0x1c')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x1c')]);}_0x5c07f7[_0x39c6('0x36')]=qs[_0x39c6('0x37')](_0x185869[_0x39c6('0x2e')][_0x39c6('0x37')]);_0x5c07f7[_0x39c6('0x38')]=qs[_0x39c6('0x30')](_[_0x39c6('0x39')](_0x185869[_0x39c6('0x2e')],_0x4937c4[_0x39c6('0x30')]),_0x243d47);if(_0x185869['query']['filter']){_0x5c07f7[_0x39c6('0x38')]=_[_0x39c6('0x3a')](_0x5c07f7[_0x39c6('0x38')],{'$or':_['map'](_0x243d47,function(_0x2eda73){if(_0x2eda73[_0x39c6('0x2a')]!==_0x39c6('0x3b')){var _0xd92ccc={};_0xd92ccc[_0x2eda73['name']]={'$like':'%'+_0x185869['query'][_0x39c6('0x3c')]+'%'};return _0xd92ccc;}})});}_0x5c07f7=_['merge']({},_0x5c07f7,_0x185869[_0x39c6('0x3d')]);var _0x18aae9={'where':_0x5c07f7[_0x39c6('0x38')]};return db[_0x39c6('0x28')]['count'](_0x18aae9)[_0x39c6('0x22')](function(_0x8e4821){_0x43d1be[_0x39c6('0x1f')]=_0x8e4821;if(_0x185869[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x5c07f7[_0x39c6('0x3f')]=[{'all':!![]}];}return db[_0x39c6('0x28')][_0x39c6('0x40')](_0x5c07f7);})[_0x39c6('0x22')](function(_0x4bf748){_0x43d1be['rows']=_0x4bf748;return _0x43d1be;})[_0x39c6('0x22')](respondWithFilteredResult(_0x179f15,_0x5c07f7))['catch'](handleError(_0x179f15,null));};exports[_0x39c6('0x41')]=function(_0x4c3bf2,_0x4989ac){var _0x3642fc={'raw':!![],'where':{'id':_0x4c3bf2[_0x39c6('0x42')]['id']}},_0x1f6d26={};_0x1f6d26['model']=_[_0x39c6('0x2f')](db[_0x39c6('0x28')][_0x39c6('0x43')]);_0x1f6d26[_0x39c6('0x2e')]=_[_0x39c6('0x2f')](_0x4c3bf2[_0x39c6('0x2e')]);_0x1f6d26['filters']=_['intersection'](_0x1f6d26[_0x39c6('0x2c')],_0x1f6d26[_0x39c6('0x2e')]);_0x3642fc['attributes']=_[_0x39c6('0x31')](_0x1f6d26[_0x39c6('0x2c')],qs['fields'](_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x33')]));_0x3642fc[_0x39c6('0x32')]=_0x3642fc[_0x39c6('0x32')][_0x39c6('0x34')]?_0x3642fc[_0x39c6('0x32')]:_0x1f6d26['model'];if(_0x4c3bf2[_0x39c6('0x2e')][_0x39c6('0x3e')]){_0x3642fc[_0x39c6('0x3f')]=[{'all':!![]}];}_0x3642fc=_[_0x39c6('0x3a')]({},_0x3642fc,_0x4c3bf2[_0x39c6('0x3d')]);return db['JscriptyAnswerReport'][_0x39c6('0x44')](_0x3642fc)['then'](handleEntityNotFound(_0x4989ac,null))[_0x39c6('0x22')](respondWithResult(_0x4989ac,null))[_0x39c6('0x45')](handleError(_0x4989ac,null));};exports[_0x39c6('0x46')]=function(_0x15dc9a,_0x144130){return db[_0x39c6('0x28')][_0x39c6('0x46')](_0x15dc9a[_0x39c6('0x47')],{})['then'](respondWithResult(_0x144130,0xc9))[_0x39c6('0x45')](handleError(_0x144130,null));};exports[_0x39c6('0x21')]=function(_0x209bda,_0x3147e2){if(_0x209bda[_0x39c6('0x47')]['id']){delete _0x209bda[_0x39c6('0x47')]['id'];}return db[_0x39c6('0x28')][_0x39c6('0x44')]({'where':{'id':_0x209bda[_0x39c6('0x42')]['id']}})['then'](handleEntityNotFound(_0x3147e2,null))[_0x39c6('0x22')](saveUpdates(_0x209bda[_0x39c6('0x47')],null))[_0x39c6('0x22')](respondWithResult(_0x3147e2,null))['catch'](handleError(_0x3147e2,null));};exports[_0x39c6('0x23')]=function(_0x56df9b,_0x34f0bf){return db['JscriptyAnswerReport'][_0x39c6('0x44')]({'where':{'id':_0x56df9b[_0x39c6('0x42')]['id']}})[_0x39c6('0x22')](handleEntityNotFound(_0x34f0bf,null))['then'](removeEntity(_0x34f0bf,null))[_0x39c6('0x45')](handleError(_0x34f0bf,null));};exports[_0x39c6('0x48')]=function(_0x348228,_0x27e8e7){return db[_0x39c6('0x28')][_0x39c6('0x48')]()['then'](respondWithResult(_0x27e8e7,null))[_0x39c6('0x45')](handleError(_0x27e8e7,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9f649ef..6cc76ce 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 _0xe544=['path','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xb405ce,_0xfa2ec3){var _0x34097c=function(_0x383ab7){while(--_0x383ab7){_0xb405ce['push'](_0xb405ce['shift']());}};_0x34097c(++_0xfa2ec3);}(_0xe544,0xcb));var _0x4e54=function(_0x5986e0,_0x354432){_0x5986e0=_0x5986e0-0x0;var _0x161284=_0xe544[_0x5986e0];return _0x161284;};'use strict';var _=require(_0x4e54('0x0'));var util=require('util');var logger=require(_0x4e54('0x1'))('api');var moment=require(_0x4e54('0x2'));var BPromise=require(_0x4e54('0x3'));var rp=require(_0x4e54('0x4'));var fs=require('fs');var path=require(_0x4e54('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x204fdb,_0x26c88c){return _0x204fdb['define'](_0x4e54('0x6'),attributes,{'tableName':_0x4e54('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a13=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0xebe782,_0x27a501){var _0x381389=function(_0xeae801){while(--_0xeae801){_0xebe782['push'](_0xebe782['shift']());}};_0x381389(++_0x27a501);}(_0x6a13,0x16e));var _0x36a1=function(_0x3205eb,_0x99a703){_0x3205eb=_0x3205eb-0x0;var _0x3ce159=_0x6a13[_0x3205eb];return _0x3ce159;};'use strict';var _=require(_0x36a1('0x0'));var util=require(_0x36a1('0x1'));var logger=require(_0x36a1('0x2'))('api');var moment=require(_0x36a1('0x3'));var BPromise=require(_0x36a1('0x4'));var rp=require(_0x36a1('0x5'));var fs=require('fs');var path=require(_0x36a1('0x6'));var rimraf=require(_0x36a1('0x7'));var config=require(_0x36a1('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x36a1('0x9')]=function(_0xd452db,_0x3ddecf){return _0xd452db[_0x36a1('0xa')](_0x36a1('0xb'),attributes,{'tableName':_0x36a1('0xc'),'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 8335131..abe3fd3 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 _0x7a52=['request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x7a52,0x1bd));var _0x27a5=function(_0x44772d,_0x640e50){_0x44772d=_0x44772d-0x0;var _0x482a5f=_0x7a52[_0x44772d];return _0x482a5f;};'use strict';var _=require(_0x27a5('0x0'));var util=require('util');var moment=require(_0x27a5('0x1'));var BPromise=require(_0x27a5('0x2'));var rs=require(_0x27a5('0x3'));var fs=require('fs');var Redis=require(_0x27a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x27a5('0x5'));var logger=require(_0x27a5('0x6'))(_0x27a5('0x7'));var config=require(_0x27a5('0x8'));var jayson=require(_0x27a5('0x9'));var client=jayson[_0x27a5('0xa')][_0x27a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x568bbe,_0x26ddd,_0x2c49fe){return new BPromise(function(_0x4b6ef0,_0x47ab24){return client[_0x27a5('0xc')](_0x568bbe,_0x2c49fe)['then'](function(_0x2e1fe4){logger[_0x27a5('0xd')](_0x27a5('0xe'),_0x26ddd,'request\x20sent');logger[_0x27a5('0xf')](_0x27a5('0x10'),_0x26ddd,_0x27a5('0x11'),JSON['stringify'](_0x2e1fe4));if(_0x2e1fe4['error']){if(_0x2e1fe4[_0x27a5('0x12')]['code']===0x1f4){logger['error'](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);return _0x47ab24(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x2e1fe4['error'][_0x27a5('0x13')]);return _0x4b6ef0(_0x2e1fe4[_0x27a5('0x12')][_0x27a5('0x13')]);}else{logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x26ddd,_0x27a5('0x11'));_0x4b6ef0(_0x2e1fe4[_0x27a5('0x14')][_0x27a5('0x13')]);}})[_0x27a5('0x15')](function(_0x398354){logger[_0x27a5('0x12')](_0x27a5('0xe'),_0x26ddd,_0x398354);_0x47ab24(_0x398354);});});} \ No newline at end of file +var _0xf7fc=['stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf7fc,0x9c));var _0xcf7f=function(_0x22aea5,_0x17620b){_0x22aea5=_0x22aea5-0x0;var _0x264b57=_0xf7fc[_0x22aea5];return _0x264b57;};'use strict';var _=require(_0xcf7f('0x0'));var util=require(_0xcf7f('0x1'));var moment=require('moment');var BPromise=require(_0xcf7f('0x2'));var rs=require(_0xcf7f('0x3'));var fs=require('fs');var Redis=require(_0xcf7f('0x4'));var db=require(_0xcf7f('0x5'))['db'];var utils=require(_0xcf7f('0x6'));var logger=require(_0xcf7f('0x7'))(_0xcf7f('0x8'));var config=require('../../config/environment');var jayson=require(_0xcf7f('0x9'));var client=jayson['client'][_0xcf7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4da081,_0x39579c,_0x2f1f5c){return new BPromise(function(_0x3cc9c9,_0x42f764){return client['request'](_0x4da081,_0x2f1f5c)['then'](function(_0x138ac6){logger[_0xcf7f('0xb')](_0xcf7f('0xc'),_0x39579c,_0xcf7f('0xd'));logger[_0xcf7f('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x39579c,_0xcf7f('0xd'),JSON[_0xcf7f('0xf')](_0x138ac6));if(_0x138ac6[_0xcf7f('0x10')]){if(_0x138ac6[_0xcf7f('0x10')][_0xcf7f('0x11')]===0x1f4){logger[_0xcf7f('0x10')](_0xcf7f('0xc'),_0x39579c,_0x138ac6['error']['message']);return _0x42f764(_0x138ac6[_0xcf7f('0x10')]['message']);}logger['error'](_0xcf7f('0xc'),_0x39579c,_0x138ac6['error']['message']);return _0x3cc9c9(_0x138ac6[_0xcf7f('0x10')][_0xcf7f('0x12')]);}else{logger[_0xcf7f('0xb')](_0xcf7f('0xc'),_0x39579c,_0xcf7f('0xd'));_0x3cc9c9(_0x138ac6['result'][_0xcf7f('0x12')]);}})['catch'](function(_0xc084f5){logger[_0xcf7f('0x10')](_0xcf7f('0xc'),_0x39579c,_0xc084f5);_0x42f764(_0xc084f5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1d86904..eeb1410 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 _0x74ae=['/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74ae,0x118));var _0xe74a=function(_0x13e360,_0x287387){_0x13e360=_0x13e360-0x0;var _0x1674f4=_0x74ae[_0x13e360];return _0x1674f4;};'use strict';var multer=require(_0xe74a('0x0'));var util=require(_0xe74a('0x1'));var path=require(_0xe74a('0x2'));var timeout=require('connect-timeout');var express=require(_0xe74a('0x3'));var router=express[_0xe74a('0x4')]();var fs_extra=require(_0xe74a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe74a('0x6'));var config=require(_0xe74a('0x7'));var controller=require(_0xe74a('0x8'));router[_0xe74a('0x9')]('/',auth[_0xe74a('0xa')](),controller[_0xe74a('0xb')]);router[_0xe74a('0x9')](_0xe74a('0xc'),auth[_0xe74a('0xa')](),controller[_0xe74a('0xd')]);router[_0xe74a('0x9')]('/:id/sessions',auth[_0xe74a('0xa')](),controller[_0xe74a('0xe')]);router[_0xe74a('0x9')](_0xe74a('0xf'),auth['isAuthenticated'](),controller[_0xe74a('0x10')]);router[_0xe74a('0x9')](_0xe74a('0x11'),auth[_0xe74a('0xa')](),timeout(_0xe74a('0x12')),controller['getSummary']);router[_0xe74a('0x13')]('/',auth[_0xe74a('0xa')](),controller[_0xe74a('0x14')]);router[_0xe74a('0x13')](_0xe74a('0x15'),auth[_0xe74a('0xa')](),controller[_0xe74a('0x16')]);router[_0xe74a('0x17')]('/:id',auth[_0xe74a('0xa')](),controller[_0xe74a('0x18')]);router[_0xe74a('0x19')](_0xe74a('0xc'),auth[_0xe74a('0xa')](),controller[_0xe74a('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xc2b0=['express','Router','fs-extra','isAuthenticated','/:id','get','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','clone','update','destroy','multer','util','connect-timeout'];(function(_0x198add,_0x239d3c){var _0x35bfaa=function(_0x30eed2){while(--_0x30eed2){_0x198add['push'](_0x198add['shift']());}};_0x35bfaa(++_0x239d3c);}(_0xc2b0,0x115));var _0x0c2b=function(_0x573fdf,_0x16cc8f){_0x573fdf=_0x573fdf-0x0;var _0x269299=_0xc2b0[_0x573fdf];return _0x269299;};'use strict';var multer=require(_0x0c2b('0x0'));var util=require(_0x0c2b('0x1'));var path=require('path');var timeout=require(_0x0c2b('0x2'));var express=require(_0x0c2b('0x3'));var router=express[_0x0c2b('0x4')]();var fs_extra=require(_0x0c2b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x0c2b('0x6')](),controller['index']);router['get'](_0x0c2b('0x7'),auth[_0x0c2b('0x6')](),controller['show']);router[_0x0c2b('0x8')](_0x0c2b('0x9'),auth['isAuthenticated'](),controller[_0x0c2b('0xa')]);router[_0x0c2b('0x8')](_0x0c2b('0xb'),auth[_0x0c2b('0x6')](),controller[_0x0c2b('0xc')]);router[_0x0c2b('0x8')](_0x0c2b('0xd'),auth[_0x0c2b('0x6')](),timeout(_0x0c2b('0xe')),controller[_0x0c2b('0xf')]);router[_0x0c2b('0x10')]('/',auth[_0x0c2b('0x6')](),controller['create']);router[_0x0c2b('0x10')]('/:id/clone',auth[_0x0c2b('0x6')](),controller[_0x0c2b('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0c2b('0x12')]);router['delete'](_0x0c2b('0x7'),auth['isAuthenticated'](),controller[_0x0c2b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index aa6e3a4..a275c2d 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 _0xf7c4=['exports','name','STRING','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util'];(function(_0x455cd3,_0x12bf3f){var _0x1aaaff=function(_0x39b92b){while(--_0x39b92b){_0x455cd3['push'](_0x455cd3['shift']());}};_0x1aaaff(++_0x12bf3f);}(_0xf7c4,0x124));var _0x4f7c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7c4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4f7c('0x0'));var _=require('lodash');var util=require(_0x4f7c('0x1'));module[_0x4f7c('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4f7c('0x3')},'description':{'type':Sequelize[_0x4f7c('0x4')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x4960c2){if(_[_0x4f7c('0x5')](_0x4960c2)){this[_0x4f7c('0x6')](_0x4f7c('0x7'),JSON[_0x4f7c('0x8')](_0x4960c2));}else if(_['isString'](_0x4960c2)){this[_0x4f7c('0x6')](_0x4f7c('0x7'),_0x4960c2);}else{this['setDataValue'](_0x4f7c('0x7'),util[_0x4f7c('0x9')](_0x4f7c('0xa'),this[_0x4f7c('0xb')](_0x4f7c('0x3'))||'',this['getDataValue'](_0x4f7c('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4f7c('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0xc472=['description','BOOLEAN','sequelize','util','STRING','name','long','isObjectLike','formData','stringify','isString','format','getDataValue'];(function(_0x546a5d,_0x4b9bc8){var _0x53912d=function(_0x477b59){while(--_0x477b59){_0x546a5d['push'](_0x546a5d['shift']());}};_0x53912d(++_0x4b9bc8);}(_0xc472,0x91));var _0x2c47=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0xc472[_0x1fd4d7];return _0x7efe8a;};'use strict';var Sequelize=require(_0x2c47('0x0'));var _=require('lodash');var util=require(_0x2c47('0x1'));module['exports']={'name':{'type':Sequelize[_0x2c47('0x2')],'unique':_0x2c47('0x3')},'description':{'type':Sequelize[_0x2c47('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x2c47('0x4')),'set':function(_0x3520ed){if(_[_0x2c47('0x5')](_0x3520ed)){this['setDataValue'](_0x2c47('0x6'),JSON[_0x2c47('0x7')](_0x3520ed));}else if(_[_0x2c47('0x8')](_0x3520ed)){this['setDataValue'](_0x2c47('0x6'),_0x3520ed);}else{this['setDataValue']('formData',util[_0x2c47('0x9')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this['getDataValue'](_0x2c47('0x3'))||'',this[_0x2c47('0xa')](_0x2c47('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x2c47('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2c47('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 2076bc6..323a984 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 _0x57ef=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Projects','UserProfileResource','error','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','include','findAll','catch','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x26bd8e,_0x2a9fdf){var _0x3a659d=function(_0x1b82cd){while(--_0x1b82cd){_0x26bd8e['push'](_0x26bd8e['shift']());}};_0x3a659d(++_0x2a9fdf);}(_0x57ef,0xdb));var _0xf57e=function(_0xc2cb9e,_0x818fbe){_0xc2cb9e=_0xc2cb9e-0x0;var _0x194de3=_0x57ef[_0xc2cb9e];return _0x194de3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf57e('0x0'));var zipdir=require(_0xf57e('0x1'));var jsonpatch=require(_0xf57e('0x2'));var rp=require(_0xf57e('0x3'));var moment=require(_0xf57e('0x4'));var BPromise=require(_0xf57e('0x5'));var Mustache=require(_0xf57e('0x6'));var util=require('util');var path=require(_0xf57e('0x7'));var sox=require(_0xf57e('0x8'));var csv=require(_0xf57e('0x9'));var ejs=require(_0xf57e('0xa'));var fs=require('fs');var fs_extra=require(_0xf57e('0xb'));var _=require(_0xf57e('0xc'));var squel=require(_0xf57e('0xd'));var crypto=require(_0xf57e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf57e('0xf'));var toCsv=require(_0xf57e('0x9'));var querystring=require(_0xf57e('0x10'));var Papa=require(_0xf57e('0x11'));var Redis=require(_0xf57e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf57e('0x13'));var as=require(_0xf57e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf57e('0x15'))(_0xf57e('0x16'));var utils=require(_0xf57e('0x17'));var config=require(_0xf57e('0x18'));var licenseUtil=require(_0xf57e('0x19'));var db=require(_0xf57e('0x1a'))['db'];function respondWithStatusCode(_0x4e3b57,_0x1b6e4f){_0x1b6e4f=_0x1b6e4f||0xcc;return function(_0x379b53){if(_0x379b53){return _0x4e3b57[_0xf57e('0x1b')](_0x1b6e4f);}return _0x4e3b57[_0xf57e('0x1c')](_0x1b6e4f)[_0xf57e('0x1d')]();};}function respondWithResult(_0x3ffeee,_0x1f2f5e){_0x1f2f5e=_0x1f2f5e||0xc8;return function(_0x2f0d23){if(_0x2f0d23){return _0x3ffeee[_0xf57e('0x1c')](_0x1f2f5e)[_0xf57e('0x1e')](_0x2f0d23);}};}function respondWithFilteredResult(_0x150b80,_0x2a6ff7){return function(_0x3bf629){if(_0x3bf629){var _0x302c46=typeof _0x2a6ff7[_0xf57e('0x1f')]===_0xf57e('0x20')&&typeof _0x2a6ff7[_0xf57e('0x21')]===_0xf57e('0x20');var _0x236c0f=_0x3bf629[_0xf57e('0x22')];var _0x186f69=_0x302c46?0x0:_0x2a6ff7[_0xf57e('0x1f')];var _0x588ec8=_0x302c46?_0x3bf629['count']:_0x2a6ff7[_0xf57e('0x1f')]+_0x2a6ff7['limit'];var _0x3100ce;if(_0x588ec8>=_0x236c0f){_0x588ec8=_0x236c0f;_0x3100ce=0xc8;}else{_0x3100ce=0xce;}_0x150b80['status'](_0x3100ce);return _0x150b80[_0xf57e('0x23')](_0xf57e('0x24'),_0x186f69+'-'+_0x588ec8+'/'+_0x236c0f)[_0xf57e('0x1e')](_0x3bf629);}return null;};}function patchUpdates(_0xa8476e){return function(_0x571e57){try{jsonpatch[_0xf57e('0x25')](_0x571e57,_0xa8476e,!![]);}catch(_0x582ca5){return BPromise[_0xf57e('0x26')](_0x582ca5);}return _0x571e57[_0xf57e('0x27')]();};}function saveUpdates(_0x4eac1f,_0x49b80c){return function(_0x2068bc){if(_0x2068bc){return _0x2068bc[_0xf57e('0x28')](_0x4eac1f)[_0xf57e('0x29')](function(_0x297b2f){return _0x297b2f;});}return null;};}function removeEntity(_0x5d0f7f,_0x134557){return function(_0x1cd065){if(_0x1cd065){return _0x1cd065['destroy']()[_0xf57e('0x29')](function(){var _0x2d5893=_0x1cd065[_0xf57e('0x2a')]({'plain':!![]});var _0xa3072d=_0xf57e('0x2b');return db[_0xf57e('0x2c')]['destroy']({'where':{'type':_0xa3072d,'resourceId':_0x2d5893['id']}})[_0xf57e('0x29')](function(){return _0x1cd065;});})['then'](function(){_0x5d0f7f[_0xf57e('0x1c')](0xcc)[_0xf57e('0x1d')]();});}};}function handleEntityNotFound(_0x1b7f19,_0x4df26d){return function(_0x52147d){if(!_0x52147d){_0x1b7f19[_0xf57e('0x1b')](0x194);}return _0x52147d;};}function handleError(_0x22aeb6,_0x4f4c73){_0x4f4c73=_0x4f4c73||0x1f4;return function(_0x468048){logger[_0xf57e('0x2d')](_0x468048['stack']);if(_0x468048['name']){delete _0x468048[_0xf57e('0x2e')];}_0x22aeb6['status'](_0x4f4c73)[_0xf57e('0x2f')](_0x468048);};}exports[_0xf57e('0x30')]=function(_0x93f436,_0x27ee9f){var _0x502211={},_0x4e5ec2={},_0xc821b7={'count':0x0,'rows':[]};var _0x4bfefb=_[_0xf57e('0x31')](db[_0xf57e('0x32')][_0xf57e('0x33')],function(_0x488fb0){return{'name':_0x488fb0[_0xf57e('0x34')],'type':_0x488fb0[_0xf57e('0x35')]['key']};});_0x4e5ec2['model']=_[_0xf57e('0x31')](_0x4bfefb,'name');_0x4e5ec2[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x93f436['query']);_0x4e5ec2['filters']=_[_0xf57e('0x38')](_0x4e5ec2[_0xf57e('0x39')],_0x4e5ec2[_0xf57e('0x36')]);_0x502211[_0xf57e('0x3a')]=_['intersection'](_0x4e5ec2['model'],qs[_0xf57e('0x3b')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x502211[_0xf57e('0x3a')]=_0x502211[_0xf57e('0x3a')]['length']?_0x502211[_0xf57e('0x3a')]:_0x4e5ec2['model'];if(!_0x93f436['query'][_0xf57e('0x3c')]('nolimit')){_0x502211[_0xf57e('0x21')]=qs[_0xf57e('0x21')](_0x93f436['query'][_0xf57e('0x21')]);_0x502211[_0xf57e('0x1f')]=qs[_0xf57e('0x1f')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x502211[_0xf57e('0x3d')]=qs[_0xf57e('0x3e')](_0x93f436[_0xf57e('0x36')][_0xf57e('0x3e')]);_0x502211[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_[_0xf57e('0x41')](_0x93f436[_0xf57e('0x36')],_0x4e5ec2[_0xf57e('0x40')]),_0x4bfefb);if(_0x93f436['query'][_0xf57e('0x42')]){_0x502211['where']=_['merge'](_0x502211['where'],{'$or':_[_0xf57e('0x31')](_0x4bfefb,function(_0x16da7f){if(_0x16da7f['type']!=='VIRTUAL'){var _0x526a62={};_0x526a62[_0x16da7f[_0xf57e('0x2e')]]={'$like':'%'+_0x93f436[_0xf57e('0x36')][_0xf57e('0x42')]+'%'};return _0x526a62;}})});}_0x502211=_[_0xf57e('0x43')]({},_0x502211,_0x93f436[_0xf57e('0x44')]);var _0x55ad0d={'where':_0x502211[_0xf57e('0x3f')]};return db[_0xf57e('0x32')][_0xf57e('0x22')](_0x55ad0d)['then'](function(_0x2de3c7){_0xc821b7['count']=_0x2de3c7;if(_0x93f436['query']['includeAll']){_0x502211[_0xf57e('0x45')]=[{'all':!![]}];}return db[_0xf57e('0x32')][_0xf57e('0x46')](_0x502211);})['then'](function(_0x48d305){_0xc821b7['rows']=_0x48d305;return _0xc821b7;})[_0xf57e('0x29')](respondWithFilteredResult(_0x27ee9f,_0x502211))[_0xf57e('0x47')](handleError(_0x27ee9f,null));};exports['show']=function(_0x41aff1,_0x17cf8d){var _0x1c6fb8={'raw':![],'where':{'id':_0x41aff1[_0xf57e('0x48')]['id']}},_0x2afd40={};_0x2afd40['model']=_[_0xf57e('0x37')](db['JscriptyProject']['rawAttributes']);_0x2afd40[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x41aff1[_0xf57e('0x36')]);_0x2afd40[_0xf57e('0x40')]=_[_0xf57e('0x38')](_0x2afd40['model'],_0x2afd40['query']);_0x1c6fb8[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x2afd40[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x41aff1[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x1c6fb8['attributes']=_0x1c6fb8[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x1c6fb8[_0xf57e('0x3a')]:_0x2afd40[_0xf57e('0x39')];if(_0x41aff1[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x1c6fb8[_0xf57e('0x45')]=[{'all':!![]}];}_0x1c6fb8=_[_0xf57e('0x43')]({},_0x1c6fb8,_0x41aff1['options']);return db[_0xf57e('0x32')][_0xf57e('0x4b')](_0x1c6fb8)['then'](handleEntityNotFound(_0x17cf8d,null))[_0xf57e('0x29')](respondWithResult(_0x17cf8d,null))[_0xf57e('0x47')](handleError(_0x17cf8d,null));};exports[_0xf57e('0x4c')]=function(_0x31b625,_0x12aeac){return db[_0xf57e('0x32')][_0xf57e('0x4c')](_0x31b625[_0xf57e('0x4d')],{})['then'](function(_0x104aa2){var _0x177963=_0x31b625[_0xf57e('0x4e')][_0xf57e('0x2a')]({'plain':!![]});if(!_0x177963)throw new Error(_0xf57e('0x4f'));if(_0x177963[_0xf57e('0x50')]==='user'){var _0x1f3d55=_0x104aa2[_0xf57e('0x2a')]({'plain':!![]});var _0x3bcff1=_0xf57e('0x2b');return db[_0xf57e('0x51')][_0xf57e('0x4b')]({'where':{'name':_0x3bcff1,'userProfileId':_0x177963['userProfileId']},'raw':!![]})[_0xf57e('0x29')](function(_0x202628){if(_0x202628&&_0x202628[_0xf57e('0x52')]===0x0){return db['UserProfileResource'][_0xf57e('0x4c')]({'name':_0x1f3d55['name'],'resourceId':_0x1f3d55['id'],'type':_0x202628['name'],'sectionId':_0x202628['id']},{})[_0xf57e('0x29')](function(){return _0x104aa2;});}else{return _0x104aa2;}})[_0xf57e('0x47')](function(_0x12d614){logger[_0xf57e('0x2d')](_0xf57e('0x53'),_0x12d614);throw _0x12d614;});}return _0x104aa2;})[_0xf57e('0x29')](respondWithResult(_0x12aeac,0xc9))[_0xf57e('0x47')](handleError(_0x12aeac,null));};exports[_0xf57e('0x54')]=function(_0x5afd66,_0x2beccd){var _0x2a8edb={'where':{'id':_0x5afd66[_0xf57e('0x48')]['id']}},_0x22e1dc={};_0x22e1dc[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x32')][_0xf57e('0x33')]);_0x2a8edb[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x22e1dc[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x5afd66[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x2a8edb[_0xf57e('0x3a')]=_0x2a8edb[_0xf57e('0x3a')]['length']?_0x2a8edb['attributes']:_0x22e1dc[_0xf57e('0x39')];if(_0x5afd66[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x2a8edb[_0xf57e('0x45')]=[{'all':!![]}];}_0x2a8edb=_['merge']({},_0x2a8edb,_0x5afd66[_0xf57e('0x44')]);return db['JscriptyProject']['find'](_0x2a8edb)[_0xf57e('0x29')](handleEntityNotFound(_0x2beccd,null))[_0xf57e('0x29')](function(_0x577d73){if(_0x577d73){var _0x47750a=_0x577d73[_0xf57e('0x2a')]({'plain':!![]});_0x47750a=qs[_0xf57e('0x55')](_0x47750a,['id',_0xf57e('0x56'),_0xf57e('0x57')]);_0x5afd66[_0xf57e('0x4d')]=_[_0xf57e('0x55')](_0x5afd66[_0xf57e('0x4d')],['id','createdAt',_0xf57e('0x57')]);return db[_0xf57e('0x32')]['create'](_['merge'](_0x47750a,_0x5afd66[_0xf57e('0x4d')]),{'include':_0x5afd66[_0xf57e('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xf57e('0x29')](function(_0x1eb283){var _0x5c6e70=_0x5afd66[_0xf57e('0x4e')][_0xf57e('0x2a')]({'plain':!![]});if(!_0x5c6e70)throw new Error(_0xf57e('0x4f'));if(_0x5c6e70[_0xf57e('0x50')]===_0xf57e('0x4e')){var _0x5a63a2=_0x1eb283['get']({'plain':!![]});var _0x2aadb8='Projects';return db[_0xf57e('0x51')][_0xf57e('0x4b')]({'where':{'name':_0x2aadb8,'userProfileId':_0x5c6e70[_0xf57e('0x58')]},'raw':!![]})[_0xf57e('0x29')](function(_0x56c21e){if(_0x56c21e&&_0x56c21e[_0xf57e('0x52')]===0x0){return db['UserProfileResource'][_0xf57e('0x4c')]({'name':_0x5a63a2[_0xf57e('0x2e')],'resourceId':_0x5a63a2['id'],'type':_0x56c21e['name'],'sectionId':_0x56c21e['id']},{})[_0xf57e('0x29')](function(){return _0x1eb283;});}else{return _0x1eb283;}})['catch'](function(_0x6e0d02){logger['error'](_0xf57e('0x53'),_0x6e0d02);throw _0x6e0d02;});}return _0x1eb283;});}})[_0xf57e('0x29')](respondWithResult(_0x2beccd,0xc9))[_0xf57e('0x47')](handleError(_0x2beccd,null));};exports[_0xf57e('0x28')]=function(_0x7fcd52,_0x1f1746){if(_0x7fcd52[_0xf57e('0x4d')]['id']){delete _0x7fcd52[_0xf57e('0x4d')]['id'];}return db[_0xf57e('0x32')]['find']({'where':{'id':_0x7fcd52[_0xf57e('0x48')]['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x1f1746,null))[_0xf57e('0x29')](saveUpdates(_0x7fcd52[_0xf57e('0x4d')],null))['then'](respondWithResult(_0x1f1746,null))[_0xf57e('0x47')](handleError(_0x1f1746,null));};exports['destroy']=function(_0x366256,_0x3df6a7){return db['JscriptyProject'][_0xf57e('0x4b')]({'where':{'id':_0x366256[_0xf57e('0x48')]['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x3df6a7,null))[_0xf57e('0x29')](removeEntity(_0x3df6a7,null))[_0xf57e('0x47')](handleError(_0x3df6a7,null));};exports[_0xf57e('0x59')]=function(_0x40647f,_0x5258d1,_0x25745f){var _0x2276ba={'raw':!![],'where':{}};var _0xb67029={};var _0x2cf9f7={'count':0x0,'rows':[]};return db[_0xf57e('0x32')][_0xf57e('0x5a')]({'where':{'id':_0x40647f['params']['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x5258d1,null))[_0xf57e('0x29')](function(_0x440778){if(_0x440778){_0xb67029[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x5b')][_0xf57e('0x33')]);_0xb67029[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x40647f[_0xf57e('0x36')]);_0xb67029['filters']=_['intersection'](_0xb67029[_0xf57e('0x39')],_0xb67029[_0xf57e('0x36')]);_0x2276ba[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0xb67029[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x2276ba[_0xf57e('0x3a')]=_0x2276ba[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x2276ba[_0xf57e('0x3a')]:_0xb67029[_0xf57e('0x39')];if(!_0x40647f[_0xf57e('0x36')]['hasOwnProperty'](_0xf57e('0x5c'))){_0x2276ba[_0xf57e('0x21')]=qs['limit'](_0x40647f[_0xf57e('0x36')][_0xf57e('0x21')]);_0x2276ba['offset']=qs[_0xf57e('0x1f')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x2276ba['order']=qs[_0xf57e('0x3e')](_0x40647f[_0xf57e('0x36')][_0xf57e('0x3e')]);_0x2276ba[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_[_0xf57e('0x41')](_0x40647f[_0xf57e('0x36')],_0xb67029[_0xf57e('0x40')]));_0x2276ba[_0xf57e('0x3f')][_0xf57e('0x5d')]=_0x440778['id'];if(_0x40647f[_0xf57e('0x36')][_0xf57e('0x42')]){_0x2276ba[_0xf57e('0x3f')]=_['merge'](_0x2276ba[_0xf57e('0x3f')],{'$or':_['map'](_0x2276ba[_0xf57e('0x3a')],function(_0x550b7d){var _0x21b8e7={};_0x21b8e7[_0x550b7d]={'$like':'%'+_0x40647f['query'][_0xf57e('0x42')]+'%'};return _0x21b8e7;})});}_0x2276ba=_['merge']({},_0x2276ba,_0x40647f['options']);return db[_0xf57e('0x5b')][_0xf57e('0x22')]({'where':_0x2276ba[_0xf57e('0x3f')]})['then'](function(_0x2c63d2){_0x2cf9f7[_0xf57e('0x22')]=_0x2c63d2;if(_0x40647f[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x2276ba[_0xf57e('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xf57e('0x46')](_0x2276ba);})[_0xf57e('0x29')](function(_0x3f7336){_0x2cf9f7[_0xf57e('0x5e')]=_0x3f7336;return _0x2cf9f7;});}})[_0xf57e('0x29')](respondWithFilteredResult(_0x5258d1,_0x2276ba))[_0xf57e('0x47')](handleError(_0x5258d1,null));};exports['getAnswers']=function(_0x4463e2,_0x2977d1,_0x599cdd){var _0x148ab0={'raw':!![],'where':{}};var _0x577640={};var _0x135c04={'count':0x0,'rows':[]};return db[_0xf57e('0x32')][_0xf57e('0x5a')]({'where':{'id':_0x4463e2['params']['id']}})[_0xf57e('0x29')](handleEntityNotFound(_0x2977d1,null))['then'](function(_0x3d3fa4){if(_0x3d3fa4){_0x577640[_0xf57e('0x39')]=_[_0xf57e('0x37')](db[_0xf57e('0x5f')][_0xf57e('0x33')]);_0x577640[_0xf57e('0x36')]=_[_0xf57e('0x37')](_0x4463e2[_0xf57e('0x36')]);_0x577640[_0xf57e('0x40')]=_['intersection'](_0x577640[_0xf57e('0x39')],_0x577640[_0xf57e('0x36')]);_0x148ab0[_0xf57e('0x3a')]=_[_0xf57e('0x38')](_0x577640[_0xf57e('0x39')],qs[_0xf57e('0x3b')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x3b')]));_0x148ab0[_0xf57e('0x3a')]=_0x148ab0[_0xf57e('0x3a')][_0xf57e('0x49')]?_0x148ab0[_0xf57e('0x3a')]:_0x577640[_0xf57e('0x39')];if(!_0x4463e2[_0xf57e('0x36')][_0xf57e('0x3c')]('nolimit')){_0x148ab0[_0xf57e('0x21')]=qs[_0xf57e('0x21')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x21')]);_0x148ab0[_0xf57e('0x1f')]=qs[_0xf57e('0x1f')](_0x4463e2[_0xf57e('0x36')][_0xf57e('0x1f')]);}_0x148ab0['order']=qs[_0xf57e('0x3e')](_0x4463e2['query'][_0xf57e('0x3e')]);_0x148ab0[_0xf57e('0x3f')]=qs[_0xf57e('0x40')](_['pick'](_0x4463e2['query'],_0x577640[_0xf57e('0x40')]));_0x148ab0['where']['ProjectId']=_0x3d3fa4['id'];if(_0x4463e2['query'][_0xf57e('0x42')]){_0x148ab0[_0xf57e('0x3f')]=_[_0xf57e('0x43')](_0x148ab0[_0xf57e('0x3f')],{'$or':_[_0xf57e('0x31')](_0x148ab0['attributes'],function(_0x2ee2f2){var _0x2b5b60={};_0x2b5b60[_0x2ee2f2]={'$like':'%'+_0x4463e2[_0xf57e('0x36')]['filter']+'%'};return _0x2b5b60;})});}_0x148ab0=_['merge']({},_0x148ab0,_0x4463e2['options']);return db[_0xf57e('0x5f')][_0xf57e('0x22')]({'where':_0x148ab0[_0xf57e('0x3f')]})[_0xf57e('0x29')](function(_0x336916){_0x135c04[_0xf57e('0x22')]=_0x336916;if(_0x4463e2[_0xf57e('0x36')][_0xf57e('0x4a')]){_0x148ab0[_0xf57e('0x45')]=[{'all':!![]}];}return db[_0xf57e('0x5f')][_0xf57e('0x46')](_0x148ab0);})[_0xf57e('0x29')](function(_0x548c73){_0x135c04[_0xf57e('0x5e')]=_0x548c73;return _0x135c04;});}})[_0xf57e('0x29')](respondWithFilteredResult(_0x2977d1,_0x148ab0))[_0xf57e('0x47')](handleError(_0x2977d1,null));};function char(_0x355950){return _0xf57e('0x60')===typeof _0x355950?String[_0xf57e('0x61')][_0xf57e('0x25')](null,arguments):_0x355950;}function needsEncapsulation(_0x2657ac){return!!_0x2657ac&&(_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0xd))>=0x0||_0x2657ac['toString']()['indexOf'](char(0xa))>=0x0||_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0x2c))>=0x0||_0x2657ac[_0xf57e('0x62')]()[_0xf57e('0x63')](char(0x22))>=0x0);}function encapsulate(_0xd4e041){var _0x4f351e=char(0x22),_0x3c3652='\x5c'+char(0x22),_0x58bbea=_0xd4e041[_0xf57e('0x62')]()[_0xf57e('0x64')](new RegExp(_0x4f351e,'g'),_0x3c3652);return _0x4f351e+_0x58bbea+_0x4f351e;}exports[_0xf57e('0x65')]=function(_0x2e875c,_0x13922a,_0x71d92b){var _0x136876,_0x147b03;var _0x423a0c={'where':{'ProjectId':_0x2e875c[_0xf57e('0x48')]['id']}};if(_0x2e875c[_0xf57e('0x36')][_0xf57e('0x66')]){_0x423a0c['where'][_0xf57e('0x67')]=JSON[_0xf57e('0x68')](_0x2e875c[_0xf57e('0x36')][_0xf57e('0x66')]);}return db['JscriptySessionReport'][_0xf57e('0x46')](_0x423a0c)[_0xf57e('0x29')](handleEntityNotFound(_0x13922a,null))['then'](function(_0x57ae70){if(_0x57ae70){_0x136876=_0x57ae70;return db[_0xf57e('0x69')][_0xf57e('0x46')]({'where':{'SessionId':{'$in':_[_0xf57e('0x31')](_0x136876,'id')},'ProjectId':_0x2e875c['params']['id']},'order':'-createdAt'});}})[_0xf57e('0x29')](handleEntityNotFound(_0x13922a,null))[_0xf57e('0x29')](function(_0x26416a){if(_0x26416a){_0x147b03=_0x26416a;var _0x48bb5e={};for(var _0x1f1633=0x0,_0x38659d=_0x147b03[_0xf57e('0x49')];_0x1f1633<_0x38659d;_0x1f1633++){if(!_0x48bb5e[_0xf57e('0x3c')](_0x147b03[_0x1f1633][_0xf57e('0x6a')])){_0x48bb5e[_0x147b03[_0x1f1633][_0xf57e('0x6a')]]=needsEncapsulation(_0x147b03[_0x1f1633][_0xf57e('0x6b')])?encapsulate(_0x147b03[_0x1f1633][_0xf57e('0x6b')]):_0x147b03[_0x1f1633][_0xf57e('0x6b')];}}var _0x48620f=[],_0x32c943={};for(var _0x598788=0x0,_0xe72919=_0x136876[_0xf57e('0x49')];_0x598788<_0xe72919;_0x598788++){_0x32c943={'ProjectId':_0x2e875c[_0xf57e('0x48')]['id'],'SessionId':_0x136876[_0x598788]['id'],'StartTime':moment(_0x136876[_0x598788][_0xf57e('0x67')])[_0xf57e('0x6c')](_0xf57e('0x6d'))};for(var _0x2aae9d=0x0,_0x993872=_0x147b03[_0xf57e('0x49')];_0x2aae9d<_0x993872;_0x2aae9d++){if(_0x147b03[_0x2aae9d][_0xf57e('0x6e')]==_0x136876[_0x598788]['id']&&_0x48bb5e[_0xf57e('0x3c')](_0x147b03[_0x2aae9d][_0xf57e('0x6a')])){_0x32c943[_0x48bb5e[_0x147b03[_0x2aae9d][_0xf57e('0x6a')]]]=_0x147b03[_0x2aae9d][_0xf57e('0x6f')];}}for(var _0x2a32af in _0x48bb5e){if(!_0x32c943[_0xf57e('0x3c')](_0x48bb5e[_0x2a32af])){_0x32c943[_0x48bb5e[_0x2a32af]]=null;}}_0x48620f[_0xf57e('0x70')](_0x32c943);}return _0x48620f;}})['then'](function(_0x473288){if(!_[_0xf57e('0x71')](_0x473288)){var _0x569ec3=toCsv(_0x473288);var _0x28e958=Date[_0xf57e('0x72')]();fs['writeFileSync'](util['format'](_0xf57e('0x73'),_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958),_0x569ec3);_0x13922a[_0xf57e('0x74')](_0xf57e('0x75'),_0xf57e('0x76')+util[_0xf57e('0x6c')]('Jscripty_Project_%d_Summary_%s.csv',_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958));_0x13922a[_0xf57e('0x74')](_0xf57e('0x77'),'text/csv');return _0x13922a[_0xf57e('0x78')](util[_0xf57e('0x6c')](_0xf57e('0x73'),_0x2e875c[_0xf57e('0x48')]['id'],_0x28e958));}else{return _0x13922a[_0xf57e('0x1b')](0xcc);}})[_0xf57e('0x47')](handleError(_0x13922a,null));}; \ No newline at end of file +var _0x1691=['JscriptySessionReport','nolimit','order','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','indexOf','toString','replace','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','destroy','error','stack','name','map','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','type','options','include','JscriptyProject','findAll','rows','catch','show','rawAttributes','includeAll','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','params','getSessions','findOne'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x1691,0x1ed));var _0x1169=function(_0x51b474,_0x152542){_0x51b474=_0x51b474-0x0;var _0x29e5ea=_0x1691[_0x51b474];return _0x29e5ea;};'use strict';var emlformat=require(_0x1169('0x0'));var rimraf=require(_0x1169('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1169('0x2'));var rp=require(_0x1169('0x3'));var moment=require(_0x1169('0x4'));var BPromise=require(_0x1169('0x5'));var Mustache=require(_0x1169('0x6'));var util=require(_0x1169('0x7'));var path=require(_0x1169('0x8'));var sox=require(_0x1169('0x9'));var csv=require('to-csv');var ejs=require(_0x1169('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1169('0xb'));var squel=require('squel');var crypto=require(_0x1169('0xc'));var jsforce=require(_0x1169('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1169('0xe'));var querystring=require(_0x1169('0xf'));var Papa=require(_0x1169('0x10'));var Redis=require(_0x1169('0x11'));var authService=require(_0x1169('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1169('0x13'));var hardwareService=require(_0x1169('0x14'));var logger=require('../../config/logger')(_0x1169('0x15'));var utils=require('../../config/utils');var config=require(_0x1169('0x16'));var licenseUtil=require(_0x1169('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5d9b,_0x4f431e){_0x4f431e=_0x4f431e||0xcc;return function(_0x1a9f2b){if(_0x1a9f2b){return _0x5b5d9b['sendStatus'](_0x4f431e);}return _0x5b5d9b[_0x1169('0x18')](_0x4f431e)[_0x1169('0x19')]();};}function respondWithResult(_0x54ad46,_0x18ba76){_0x18ba76=_0x18ba76||0xc8;return function(_0x32636b){if(_0x32636b){return _0x54ad46[_0x1169('0x18')](_0x18ba76)[_0x1169('0x1a')](_0x32636b);}};}function respondWithFilteredResult(_0x4fc690,_0x4c4b90){return function(_0x34462b){if(_0x34462b){var _0x31a3e9=typeof _0x4c4b90[_0x1169('0x1b')]===_0x1169('0x1c')&&typeof _0x4c4b90[_0x1169('0x1d')]===_0x1169('0x1c');var _0x226420=_0x34462b[_0x1169('0x1e')];var _0x5f216f=_0x31a3e9?0x0:_0x4c4b90[_0x1169('0x1b')];var _0x51674a=_0x31a3e9?_0x34462b[_0x1169('0x1e')]:_0x4c4b90['offset']+_0x4c4b90['limit'];var _0x9c68cb;if(_0x51674a>=_0x226420){_0x51674a=_0x226420;_0x9c68cb=0xc8;}else{_0x9c68cb=0xce;}_0x4fc690['status'](_0x9c68cb);return _0x4fc690['set'](_0x1169('0x1f'),_0x5f216f+'-'+_0x51674a+'/'+_0x226420)['json'](_0x34462b);}return null;};}function patchUpdates(_0x3e6e45){return function(_0xba82ee){try{jsonpatch[_0x1169('0x20')](_0xba82ee,_0x3e6e45,!![]);}catch(_0x1b6af6){return BPromise[_0x1169('0x21')](_0x1b6af6);}return _0xba82ee[_0x1169('0x22')]();};}function saveUpdates(_0x38b4b1,_0x3c342e){return function(_0x594ac4){if(_0x594ac4){return _0x594ac4[_0x1169('0x23')](_0x38b4b1)[_0x1169('0x24')](function(_0x301646){return _0x301646;});}return null;};}function removeEntity(_0x277f69,_0x21e826){return function(_0x51040d){if(_0x51040d){return _0x51040d['destroy']()[_0x1169('0x24')](function(){var _0x5e235c=_0x51040d[_0x1169('0x25')]({'plain':!![]});var _0x428498='Projects';return db['UserProfileResource'][_0x1169('0x26')]({'where':{'type':_0x428498,'resourceId':_0x5e235c['id']}})[_0x1169('0x24')](function(){return _0x51040d;});})[_0x1169('0x24')](function(){_0x277f69['status'](0xcc)[_0x1169('0x19')]();});}};}function handleEntityNotFound(_0x3172c2,_0x494e2a){return function(_0x4edcac){if(!_0x4edcac){_0x3172c2['sendStatus'](0x194);}return _0x4edcac;};}function handleError(_0x4d89c7,_0xa60282){_0xa60282=_0xa60282||0x1f4;return function(_0x1c5499){logger[_0x1169('0x27')](_0x1c5499[_0x1169('0x28')]);if(_0x1c5499[_0x1169('0x29')]){delete _0x1c5499[_0x1169('0x29')];}_0x4d89c7[_0x1169('0x18')](_0xa60282)['send'](_0x1c5499);};}exports['index']=function(_0x40fa6d,_0x12edc7){var _0x23f6a7={},_0x44696c={},_0x44c0aa={'count':0x0,'rows':[]};var _0x4013f0=_[_0x1169('0x2a')](db['JscriptyProject']['rawAttributes'],function(_0x582758){return{'name':_0x582758['fieldName'],'type':_0x582758['type'][_0x1169('0x2b')]};});_0x44696c[_0x1169('0x2c')]=_[_0x1169('0x2a')](_0x4013f0,'name');_0x44696c[_0x1169('0x2d')]=_[_0x1169('0x2e')](_0x40fa6d[_0x1169('0x2d')]);_0x44696c[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x44696c[_0x1169('0x2c')],_0x44696c[_0x1169('0x2d')]);_0x23f6a7[_0x1169('0x31')]=_[_0x1169('0x30')](_0x44696c[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x40fa6d['query']['fields']));_0x23f6a7[_0x1169('0x31')]=_0x23f6a7['attributes'][_0x1169('0x33')]?_0x23f6a7[_0x1169('0x31')]:_0x44696c[_0x1169('0x2c')];if(!_0x40fa6d[_0x1169('0x2d')][_0x1169('0x34')]('nolimit')){_0x23f6a7[_0x1169('0x1d')]=qs['limit'](_0x40fa6d[_0x1169('0x2d')]['limit']);_0x23f6a7[_0x1169('0x1b')]=qs[_0x1169('0x1b')](_0x40fa6d[_0x1169('0x2d')][_0x1169('0x1b')]);}_0x23f6a7['order']=qs[_0x1169('0x35')](_0x40fa6d[_0x1169('0x2d')][_0x1169('0x35')]);_0x23f6a7['where']=qs['filters'](_[_0x1169('0x36')](_0x40fa6d[_0x1169('0x2d')],_0x44696c[_0x1169('0x2f')]),_0x4013f0);if(_0x40fa6d[_0x1169('0x2d')][_0x1169('0x37')]){_0x23f6a7[_0x1169('0x38')]=_['merge'](_0x23f6a7[_0x1169('0x38')],{'$or':_['map'](_0x4013f0,function(_0x2a307a){if(_0x2a307a[_0x1169('0x39')]!=='VIRTUAL'){var _0x120815={};_0x120815[_0x2a307a[_0x1169('0x29')]]={'$like':'%'+_0x40fa6d[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x120815;}})});}_0x23f6a7=_['merge']({},_0x23f6a7,_0x40fa6d[_0x1169('0x3a')]);var _0x8c4e97={'where':_0x23f6a7['where']};return db['JscriptyProject'][_0x1169('0x1e')](_0x8c4e97)[_0x1169('0x24')](function(_0x488025){_0x44c0aa['count']=_0x488025;if(_0x40fa6d['query']['includeAll']){_0x23f6a7[_0x1169('0x3b')]=[{'all':!![]}];}return db[_0x1169('0x3c')][_0x1169('0x3d')](_0x23f6a7);})[_0x1169('0x24')](function(_0x2ea766){_0x44c0aa[_0x1169('0x3e')]=_0x2ea766;return _0x44c0aa;})[_0x1169('0x24')](respondWithFilteredResult(_0x12edc7,_0x23f6a7))[_0x1169('0x3f')](handleError(_0x12edc7,null));};exports[_0x1169('0x40')]=function(_0x2e7d6b,_0xbc8661){var _0xef52fc={'raw':![],'where':{'id':_0x2e7d6b['params']['id']}},_0x255fc3={};_0x255fc3[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x3c')][_0x1169('0x41')]);_0x255fc3[_0x1169('0x2d')]=_['keys'](_0x2e7d6b['query']);_0x255fc3[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x255fc3[_0x1169('0x2c')],_0x255fc3[_0x1169('0x2d')]);_0xef52fc[_0x1169('0x31')]=_['intersection'](_0x255fc3['model'],qs[_0x1169('0x32')](_0x2e7d6b['query']['fields']));_0xef52fc[_0x1169('0x31')]=_0xef52fc[_0x1169('0x31')]['length']?_0xef52fc[_0x1169('0x31')]:_0x255fc3['model'];if(_0x2e7d6b[_0x1169('0x2d')][_0x1169('0x42')]){_0xef52fc['include']=[{'all':!![]}];}_0xef52fc=_[_0x1169('0x43')]({},_0xef52fc,_0x2e7d6b[_0x1169('0x3a')]);return db[_0x1169('0x3c')]['find'](_0xef52fc)[_0x1169('0x24')](handleEntityNotFound(_0xbc8661,null))[_0x1169('0x24')](respondWithResult(_0xbc8661,null))[_0x1169('0x3f')](handleError(_0xbc8661,null));};exports[_0x1169('0x44')]=function(_0x511eaa,_0x3160d2){return db[_0x1169('0x3c')][_0x1169('0x44')](_0x511eaa[_0x1169('0x45')],{})[_0x1169('0x24')](function(_0x27b2f1){var _0x2676f1=_0x511eaa[_0x1169('0x46')][_0x1169('0x25')]({'plain':!![]});if(!_0x2676f1)throw new Error(_0x1169('0x47'));if(_0x2676f1[_0x1169('0x48')]==='user'){var _0x23d3bb=_0x27b2f1[_0x1169('0x25')]({'plain':!![]});var _0x5f3e39=_0x1169('0x49');return db[_0x1169('0x4a')][_0x1169('0x4b')]({'where':{'name':_0x5f3e39,'userProfileId':_0x2676f1[_0x1169('0x4c')]},'raw':!![]})[_0x1169('0x24')](function(_0x54164d){if(_0x54164d&&_0x54164d[_0x1169('0x4d')]===0x0){return db[_0x1169('0x4e')][_0x1169('0x44')]({'name':_0x23d3bb[_0x1169('0x29')],'resourceId':_0x23d3bb['id'],'type':_0x54164d[_0x1169('0x29')],'sectionId':_0x54164d['id']},{})['then'](function(){return _0x27b2f1;});}else{return _0x27b2f1;}})[_0x1169('0x3f')](function(_0xb8bec8){logger[_0x1169('0x27')](_0x1169('0x4f'),_0xb8bec8);throw _0xb8bec8;});}return _0x27b2f1;})[_0x1169('0x24')](respondWithResult(_0x3160d2,0xc9))[_0x1169('0x3f')](handleError(_0x3160d2,null));};exports[_0x1169('0x50')]=function(_0x2863f9,_0x4ede5a){var _0xe6897a={'where':{'id':_0x2863f9['params']['id']}},_0x590536={};_0x590536[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x3c')][_0x1169('0x41')]);_0xe6897a[_0x1169('0x31')]=_['intersection'](_0x590536[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x2863f9[_0x1169('0x2d')][_0x1169('0x32')]));_0xe6897a[_0x1169('0x31')]=_0xe6897a[_0x1169('0x31')][_0x1169('0x33')]?_0xe6897a[_0x1169('0x31')]:_0x590536['model'];if(_0x2863f9[_0x1169('0x2d')][_0x1169('0x42')]){_0xe6897a['include']=[{'all':!![]}];}_0xe6897a=_['merge']({},_0xe6897a,_0x2863f9[_0x1169('0x3a')]);return db[_0x1169('0x3c')][_0x1169('0x4b')](_0xe6897a)['then'](handleEntityNotFound(_0x4ede5a,null))[_0x1169('0x24')](function(_0x19e50c){if(_0x19e50c){var _0x4f6932=_0x19e50c[_0x1169('0x25')]({'plain':!![]});_0x4f6932=qs[_0x1169('0x51')](_0x4f6932,['id',_0x1169('0x52'),_0x1169('0x53')]);_0x2863f9[_0x1169('0x45')]=_[_0x1169('0x51')](_0x2863f9[_0x1169('0x45')],['id','createdAt','updatedAt']);return db[_0x1169('0x3c')][_0x1169('0x44')](_[_0x1169('0x43')](_0x4f6932,_0x2863f9[_0x1169('0x45')]),{'include':_0x2863f9[_0x1169('0x2d')][_0x1169('0x42')]?[{'all':!![]}]:undefined})[_0x1169('0x24')](function(_0x1bd652){var _0x5c2437=_0x2863f9[_0x1169('0x46')]['get']({'plain':!![]});if(!_0x5c2437)throw new Error(_0x1169('0x47'));if(_0x5c2437[_0x1169('0x48')]===_0x1169('0x46')){var _0x5da8ef=_0x1bd652['get']({'plain':!![]});var _0x2cf9b7=_0x1169('0x49');return db[_0x1169('0x4a')][_0x1169('0x4b')]({'where':{'name':_0x2cf9b7,'userProfileId':_0x5c2437[_0x1169('0x4c')]},'raw':!![]})[_0x1169('0x24')](function(_0x4737f6){if(_0x4737f6&&_0x4737f6[_0x1169('0x4d')]===0x0){return db[_0x1169('0x4e')][_0x1169('0x44')]({'name':_0x5da8ef['name'],'resourceId':_0x5da8ef['id'],'type':_0x4737f6[_0x1169('0x29')],'sectionId':_0x4737f6['id']},{})[_0x1169('0x24')](function(){return _0x1bd652;});}else{return _0x1bd652;}})[_0x1169('0x3f')](function(_0x1bdb56){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bdb56);throw _0x1bdb56;});}return _0x1bd652;});}})[_0x1169('0x24')](respondWithResult(_0x4ede5a,0xc9))[_0x1169('0x3f')](handleError(_0x4ede5a,null));};exports['update']=function(_0x156d74,_0x2a2f83){if(_0x156d74[_0x1169('0x45')]['id']){delete _0x156d74['body']['id'];}return db['JscriptyProject'][_0x1169('0x4b')]({'where':{'id':_0x156d74[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x2a2f83,null))[_0x1169('0x24')](saveUpdates(_0x156d74[_0x1169('0x45')],null))[_0x1169('0x24')](respondWithResult(_0x2a2f83,null))['catch'](handleError(_0x2a2f83,null));};exports['destroy']=function(_0x3e0cb0,_0xd97aa8){return db['JscriptyProject'][_0x1169('0x4b')]({'where':{'id':_0x3e0cb0[_0x1169('0x54')]['id']}})['then'](handleEntityNotFound(_0xd97aa8,null))[_0x1169('0x24')](removeEntity(_0xd97aa8,null))[_0x1169('0x3f')](handleError(_0xd97aa8,null));};exports[_0x1169('0x55')]=function(_0x19e7b8,_0x3e8114,_0x10b230){var _0x3b67c0={'raw':!![],'where':{}};var _0x51e5a6={};var _0x58d4bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x1169('0x56')]({'where':{'id':_0x19e7b8[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x3e8114,null))[_0x1169('0x24')](function(_0x3ac07d){if(_0x3ac07d){_0x51e5a6[_0x1169('0x2c')]=_['keys'](db[_0x1169('0x57')][_0x1169('0x41')]);_0x51e5a6['query']=_[_0x1169('0x2e')](_0x19e7b8[_0x1169('0x2d')]);_0x51e5a6[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x51e5a6[_0x1169('0x2c')],_0x51e5a6[_0x1169('0x2d')]);_0x3b67c0['attributes']=_[_0x1169('0x30')](_0x51e5a6[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x19e7b8['query'][_0x1169('0x32')]));_0x3b67c0['attributes']=_0x3b67c0['attributes'][_0x1169('0x33')]?_0x3b67c0[_0x1169('0x31')]:_0x51e5a6[_0x1169('0x2c')];if(!_0x19e7b8['query'][_0x1169('0x34')](_0x1169('0x58'))){_0x3b67c0[_0x1169('0x1d')]=qs[_0x1169('0x1d')](_0x19e7b8[_0x1169('0x2d')][_0x1169('0x1d')]);_0x3b67c0['offset']=qs[_0x1169('0x1b')](_0x19e7b8['query']['offset']);}_0x3b67c0[_0x1169('0x59')]=qs[_0x1169('0x35')](_0x19e7b8[_0x1169('0x2d')]['sort']);_0x3b67c0[_0x1169('0x38')]=qs[_0x1169('0x2f')](_[_0x1169('0x36')](_0x19e7b8[_0x1169('0x2d')],_0x51e5a6[_0x1169('0x2f')]));_0x3b67c0[_0x1169('0x38')][_0x1169('0x5a')]=_0x3ac07d['id'];if(_0x19e7b8['query'][_0x1169('0x37')]){_0x3b67c0[_0x1169('0x38')]=_[_0x1169('0x43')](_0x3b67c0[_0x1169('0x38')],{'$or':_[_0x1169('0x2a')](_0x3b67c0[_0x1169('0x31')],function(_0x28f45c){var _0x24979b={};_0x24979b[_0x28f45c]={'$like':'%'+_0x19e7b8[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x24979b;})});}_0x3b67c0=_[_0x1169('0x43')]({},_0x3b67c0,_0x19e7b8[_0x1169('0x3a')]);return db[_0x1169('0x57')][_0x1169('0x1e')]({'where':_0x3b67c0[_0x1169('0x38')]})[_0x1169('0x24')](function(_0x52314b){_0x58d4bd[_0x1169('0x1e')]=_0x52314b;if(_0x19e7b8[_0x1169('0x2d')][_0x1169('0x42')]){_0x3b67c0[_0x1169('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x1169('0x3d')](_0x3b67c0);})[_0x1169('0x24')](function(_0x1585fe){_0x58d4bd[_0x1169('0x3e')]=_0x1585fe;return _0x58d4bd;});}})['then'](respondWithFilteredResult(_0x3e8114,_0x3b67c0))[_0x1169('0x3f')](handleError(_0x3e8114,null));};exports[_0x1169('0x5b')]=function(_0x10847e,_0x2ee5e3,_0x5ece74){var _0x1a3c90={'raw':!![],'where':{}};var _0x5159ab={};var _0x36fbfd={'count':0x0,'rows':[]};return db[_0x1169('0x3c')][_0x1169('0x56')]({'where':{'id':_0x10847e[_0x1169('0x54')]['id']}})[_0x1169('0x24')](handleEntityNotFound(_0x2ee5e3,null))[_0x1169('0x24')](function(_0xfaa12c){if(_0xfaa12c){_0x5159ab[_0x1169('0x2c')]=_[_0x1169('0x2e')](db[_0x1169('0x5c')]['rawAttributes']);_0x5159ab[_0x1169('0x2d')]=_[_0x1169('0x2e')](_0x10847e[_0x1169('0x2d')]);_0x5159ab[_0x1169('0x2f')]=_[_0x1169('0x30')](_0x5159ab[_0x1169('0x2c')],_0x5159ab[_0x1169('0x2d')]);_0x1a3c90[_0x1169('0x31')]=_[_0x1169('0x30')](_0x5159ab[_0x1169('0x2c')],qs[_0x1169('0x32')](_0x10847e[_0x1169('0x2d')][_0x1169('0x32')]));_0x1a3c90[_0x1169('0x31')]=_0x1a3c90[_0x1169('0x31')][_0x1169('0x33')]?_0x1a3c90[_0x1169('0x31')]:_0x5159ab['model'];if(!_0x10847e['query'][_0x1169('0x34')](_0x1169('0x58'))){_0x1a3c90[_0x1169('0x1d')]=qs[_0x1169('0x1d')](_0x10847e[_0x1169('0x2d')]['limit']);_0x1a3c90[_0x1169('0x1b')]=qs['offset'](_0x10847e['query'][_0x1169('0x1b')]);}_0x1a3c90[_0x1169('0x59')]=qs[_0x1169('0x35')](_0x10847e['query'][_0x1169('0x35')]);_0x1a3c90[_0x1169('0x38')]=qs[_0x1169('0x2f')](_[_0x1169('0x36')](_0x10847e['query'],_0x5159ab[_0x1169('0x2f')]));_0x1a3c90[_0x1169('0x38')][_0x1169('0x5a')]=_0xfaa12c['id'];if(_0x10847e['query'][_0x1169('0x37')]){_0x1a3c90['where']=_[_0x1169('0x43')](_0x1a3c90[_0x1169('0x38')],{'$or':_['map'](_0x1a3c90['attributes'],function(_0xd6ef34){var _0x58740d={};_0x58740d[_0xd6ef34]={'$like':'%'+_0x10847e[_0x1169('0x2d')][_0x1169('0x37')]+'%'};return _0x58740d;})});}_0x1a3c90=_[_0x1169('0x43')]({},_0x1a3c90,_0x10847e['options']);return db[_0x1169('0x5c')][_0x1169('0x1e')]({'where':_0x1a3c90[_0x1169('0x38')]})[_0x1169('0x24')](function(_0x4d3dfc){_0x36fbfd[_0x1169('0x1e')]=_0x4d3dfc;if(_0x10847e['query'][_0x1169('0x42')]){_0x1a3c90[_0x1169('0x3b')]=[{'all':!![]}];}return db[_0x1169('0x5c')][_0x1169('0x3d')](_0x1a3c90);})['then'](function(_0x496e54){_0x36fbfd[_0x1169('0x3e')]=_0x496e54;return _0x36fbfd;});}})[_0x1169('0x24')](respondWithFilteredResult(_0x2ee5e3,_0x1a3c90))[_0x1169('0x3f')](handleError(_0x2ee5e3,null));};function char(_0x2f8ad5){return _0x1169('0x5d')===typeof _0x2f8ad5?String[_0x1169('0x5e')][_0x1169('0x20')](null,arguments):_0x2f8ad5;}function needsEncapsulation(_0x34f006){return!!_0x34f006&&(_0x34f006['toString']()[_0x1169('0x5f')](char(0xd))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0xa))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0x2c))>=0x0||_0x34f006[_0x1169('0x60')]()[_0x1169('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x49fbd4){var _0x2bb509=char(0x22),_0x131d83='\x5c'+char(0x22),_0x19dd17=_0x49fbd4[_0x1169('0x60')]()[_0x1169('0x61')](new RegExp(_0x2bb509,'g'),_0x131d83);return _0x2bb509+_0x19dd17+_0x2bb509;}exports['getSummary']=function(_0x1d4bfc,_0x44b712,_0x325b5b){var _0x1776da,_0x40b47f;var _0x20a3a0={'where':{'ProjectId':_0x1d4bfc['params']['id']}};if(_0x1d4bfc[_0x1169('0x2d')][_0x1169('0x62')]){_0x20a3a0[_0x1169('0x38')][_0x1169('0x63')]=JSON['parse'](_0x1d4bfc[_0x1169('0x2d')]['startTime']);}return db[_0x1169('0x57')][_0x1169('0x3d')](_0x20a3a0)['then'](handleEntityNotFound(_0x44b712,null))[_0x1169('0x24')](function(_0x424ccc){if(_0x424ccc){_0x1776da=_0x424ccc;return db[_0x1169('0x64')][_0x1169('0x3d')]({'where':{'SessionId':{'$in':_[_0x1169('0x2a')](_0x1776da,'id')},'ProjectId':_0x1d4bfc[_0x1169('0x54')]['id']},'order':_0x1169('0x65')});}})[_0x1169('0x24')](handleEntityNotFound(_0x44b712,null))['then'](function(_0x23a2ba){if(_0x23a2ba){_0x40b47f=_0x23a2ba;var _0x5290a0={};for(var _0x2f097e=0x0,_0x11e7d0=_0x40b47f[_0x1169('0x33')];_0x2f097e<_0x11e7d0;_0x2f097e++){if(!_0x5290a0[_0x1169('0x34')](_0x40b47f[_0x2f097e][_0x1169('0x66')])){_0x5290a0[_0x40b47f[_0x2f097e][_0x1169('0x66')]]=needsEncapsulation(_0x40b47f[_0x2f097e][_0x1169('0x67')])?encapsulate(_0x40b47f[_0x2f097e]['question']):_0x40b47f[_0x2f097e]['question'];}}var _0x1dbe5b=[],_0x1e0f78={};for(var _0x27805f=0x0,_0x105ad1=_0x1776da[_0x1169('0x33')];_0x27805f<_0x105ad1;_0x27805f++){_0x1e0f78={'ProjectId':_0x1d4bfc[_0x1169('0x54')]['id'],'SessionId':_0x1776da[_0x27805f]['id'],'StartTime':moment(_0x1776da[_0x27805f][_0x1169('0x63')])[_0x1169('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x39a7b0=0x0,_0x299b63=_0x40b47f[_0x1169('0x33')];_0x39a7b0<_0x299b63;_0x39a7b0++){if(_0x40b47f[_0x39a7b0][_0x1169('0x69')]==_0x1776da[_0x27805f]['id']&&_0x5290a0['hasOwnProperty'](_0x40b47f[_0x39a7b0][_0x1169('0x66')])){_0x1e0f78[_0x5290a0[_0x40b47f[_0x39a7b0]['questionId']]]=_0x40b47f[_0x39a7b0][_0x1169('0x6a')];}}for(var _0x10c81e in _0x5290a0){if(!_0x1e0f78[_0x1169('0x34')](_0x5290a0[_0x10c81e])){_0x1e0f78[_0x5290a0[_0x10c81e]]=null;}}_0x1dbe5b[_0x1169('0x6b')](_0x1e0f78);}return _0x1dbe5b;}})['then'](function(_0x458107){if(!_[_0x1169('0x6c')](_0x458107)){var _0x4a8597=toCsv(_0x458107);var _0x4ba64d=Date['now']();fs['writeFileSync'](util[_0x1169('0x68')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d),_0x4a8597);_0x44b712['setHeader'](_0x1169('0x6d'),_0x1169('0x6e')+util[_0x1169('0x68')](_0x1169('0x6f'),_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d));_0x44b712[_0x1169('0x70')](_0x1169('0x71'),'text/csv');return _0x44b712[_0x1169('0x72')](util[_0x1169('0x68')](_0x1169('0x73'),_0x1d4bfc[_0x1169('0x54')]['id'],_0x4ba64d));}else{return _0x44b712['sendStatus'](0xcc);}})[_0x1169('0x3f')](handleError(_0x44b712,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 7170ebf..2223e7e 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 _0x51f2=['jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','exports','define'];(function(_0x5179a5,_0x419746){var _0x15c8ce=function(_0x1b13c4){while(--_0x1b13c4){_0x5179a5['push'](_0x5179a5['shift']());}};_0x15c8ce(++_0x419746);}(_0x51f2,0xeb));var _0x251f=function(_0x788920,_0x265a25){_0x788920=_0x788920-0x0;var _0x207f54=_0x51f2[_0x788920];return _0x207f54;};'use strict';var _=require(_0x251f('0x0'));var util=require(_0x251f('0x1'));var logger=require(_0x251f('0x2'))(_0x251f('0x3'));var moment=require(_0x251f('0x4'));var BPromise=require(_0x251f('0x5'));var rp=require(_0x251f('0x6'));var fs=require('fs');var path=require(_0x251f('0x7'));var rimraf=require(_0x251f('0x8'));var config=require('../../config/environment');var attributes=require(_0x251f('0x9'));module[_0x251f('0xa')]=function(_0x145630,_0xd9d8e1){return _0x145630[_0x251f('0xb')]('JscriptyProject',attributes,{'tableName':_0x251f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x308a=['./jscriptyProject.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x21a9e9,_0x3edad6){var _0x129d1d=function(_0x1cec7a){while(--_0x1cec7a){_0x21a9e9['push'](_0x21a9e9['shift']());}};_0x129d1d(++_0x3edad6);}(_0x308a,0x71));var _0xa308=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x308a[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xa308('0x0'));var util=require('util');var logger=require(_0xa308('0x1'))(_0xa308('0x2'));var moment=require(_0xa308('0x3'));var BPromise=require(_0xa308('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa308('0x5'));var config=require(_0xa308('0x6'));var attributes=require(_0xa308('0x7'));module[_0xa308('0x8')]=function(_0x26d8a4,_0x322331){return _0x26d8a4[_0xa308('0x9')]('JscriptyProject',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 4e2792e..8293316 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x499210,_0x325b29){var _0x2e153d=function(_0x951263){while(--_0x951263){_0x499210['push'](_0x499210['shift']());}};_0x2e153d(++_0x325b29);}(_0xda3f,0xec));var _0xfda3=function(_0x3c5564,_0x1e121a){_0x3c5564=_0x3c5564-0x0;var _0x569dcf=_0xda3f[_0x3c5564];return _0x569dcf;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xac4a=['JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xac4a,0x13f));var _0xaac4=function(_0xfd9e3e,_0x535a66){_0xfd9e3e=_0xfd9e3e-0x0;var _0x169105=_0xac4a[_0xfd9e3e];return _0x169105;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var moment=require(_0xaac4('0x2'));var BPromise=require(_0xaac4('0x3'));var rs=require(_0xaac4('0x4'));var fs=require('fs');var Redis=require(_0xaac4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaac4('0x6'))(_0xaac4('0x7'));var config=require(_0xaac4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaac4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cdfc5,_0x5870e8,_0x1e4283){return new BPromise(function(_0x27354c,_0x567295){return client['request'](_0x1cdfc5,_0x1e4283)[_0xaac4('0xa')](function(_0x50d114){logger[_0xaac4('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,'request\x20sent');logger[_0xaac4('0xc')](_0xaac4('0xd'),_0x5870e8,_0xaac4('0xe'),JSON[_0xaac4('0xf')](_0x50d114));if(_0x50d114[_0xaac4('0x10')]){if(_0x50d114['error']['code']===0x1f4){logger[_0xaac4('0x10')](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')]['message']);return _0x567295(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}logger['error'](_0xaac4('0x11'),_0x5870e8,_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);return _0x27354c(_0x50d114[_0xaac4('0x10')][_0xaac4('0x12')]);}else{logger[_0xaac4('0xb')](_0xaac4('0x11'),_0x5870e8,_0xaac4('0xe'));_0x27354c(_0x50d114[_0xaac4('0x13')][_0xaac4('0x12')]);}})[_0xaac4('0x14')](function(_0x1766c2){logger[_0xaac4('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5870e8,_0x1766c2);_0x567295(_0x1766c2);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index cefc440..bf222e8 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 _0x5b61=['destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x480dd7,_0x5836e0){var _0x3bc2aa=function(_0x3dfe04){while(--_0x3dfe04){_0x480dd7['push'](_0x480dd7['shift']());}};_0x3bc2aa(++_0x5836e0);}(_0x5b61,0xe6));var _0x15b6=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0x5b61[_0x69a451];return _0x3d6ef5;};'use strict';var multer=require(_0x15b6('0x0'));var util=require(_0x15b6('0x1'));var path=require(_0x15b6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x15b6('0x3')]();var fs_extra=require(_0x15b6('0x4'));var auth=require(_0x15b6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x15b6('0x6'));var controller=require(_0x15b6('0x7'));router[_0x15b6('0x8')]('/',auth[_0x15b6('0x9')](),controller[_0x15b6('0xa')]);router[_0x15b6('0x8')]('/describe',auth[_0x15b6('0x9')](),controller['describe']);router['get'](_0x15b6('0xb'),auth[_0x15b6('0x9')](),controller[_0x15b6('0xc')]);router[_0x15b6('0xd')]('/',auth[_0x15b6('0x9')](),controller[_0x15b6('0xe')]);router[_0x15b6('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x15b6('0x10')](_0x15b6('0xb'),auth['isAuthenticated'](),controller[_0x15b6('0x11')]);module[_0x15b6('0x12')]=router; \ No newline at end of file +var _0x191f=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','show','post','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1aa7b1,_0xe9e31d){var _0x5d4ff4=function(_0x1b3036){while(--_0x1b3036){_0x1aa7b1['push'](_0x1aa7b1['shift']());}};_0x5d4ff4(++_0xe9e31d);}(_0x191f,0x187));var _0xf191=function(_0x523212,_0x437cc3){_0x523212=_0x523212-0x0;var _0x38c3b2=_0x191f[_0x523212];return _0x38c3b2;};'use strict';var multer=require(_0xf191('0x0'));var util=require(_0xf191('0x1'));var path=require(_0xf191('0x2'));var timeout=require(_0xf191('0x3'));var express=require(_0xf191('0x4'));var router=express['Router']();var fs_extra=require(_0xf191('0x5'));var auth=require(_0xf191('0x6'));var interaction=require(_0xf191('0x7'));var config=require(_0xf191('0x8'));var controller=require(_0xf191('0x9'));router[_0xf191('0xa')]('/',auth[_0xf191('0xb')](),controller[_0xf191('0xc')]);router[_0xf191('0xa')](_0xf191('0xd'),auth[_0xf191('0xb')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf191('0xe')]);router[_0xf191('0xf')]('/',auth[_0xf191('0xb')](),controller['create']);router[_0xf191('0x10')]('/:id',auth[_0xf191('0xb')](),controller['update']);router['delete'](_0xf191('0x11'),auth[_0xf191('0xb')](),controller[_0xf191('0x12')]);module[_0xf191('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index b0deec1..846960f 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(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x7a54,0x106));var _0x47a5=function(_0x441b28,_0x427859){_0x441b28=_0x441b28-0x0;var _0x1c1e58=_0x7a54[_0x441b28];return _0x1c1e58;};'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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x1f0d08,_0xe414ed){_0x1f0d08=_0x1f0d08-0x0;var _0x165b12=_0x7a54[_0x1f0d08];return _0x165b12;};'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 1bd30a7..e5db18f 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 _0xf51d=['params','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','send','JscriptyQuestionReport','rawAttributes','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','find','create','body'];(function(_0x9192e6,_0x206608){var _0x394628=function(_0x1e39be){while(--_0x1e39be){_0x9192e6['push'](_0x9192e6['shift']());}};_0x394628(++_0x206608);}(_0xf51d,0x94));var _0xdf51=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf51d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf51('0x0'));var zipdir=require(_0xdf51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf51('0x2'));var moment=require('moment');var BPromise=require(_0xdf51('0x3'));var Mustache=require('mustache');var util=require(_0xdf51('0x4'));var path=require(_0xdf51('0x5'));var sox=require(_0xdf51('0x6'));var csv=require(_0xdf51('0x7'));var ejs=require(_0xdf51('0x8'));var fs=require('fs');var fs_extra=require(_0xdf51('0x9'));var _=require(_0xdf51('0xa'));var squel=require(_0xdf51('0xb'));var crypto=require(_0xdf51('0xc'));var jsforce=require(_0xdf51('0xd'));var deskjs=require(_0xdf51('0xe'));var toCsv=require(_0xdf51('0x7'));var querystring=require(_0xdf51('0xf'));var Papa=require('papaparse');var Redis=require(_0xdf51('0x10'));var authService=require(_0xdf51('0x11'));var qs=require(_0xdf51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf51('0x13'));var logger=require('../../config/logger')(_0xdf51('0x14'));var utils=require(_0xdf51('0x15'));var config=require(_0xdf51('0x16'));var licenseUtil=require(_0xdf51('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e6791,_0x3da3fc){_0x3da3fc=_0x3da3fc||0xcc;return function(_0x19c686){if(_0x19c686){return _0x2e6791[_0xdf51('0x18')](_0x3da3fc);}return _0x2e6791[_0xdf51('0x19')](_0x3da3fc)['end']();};}function respondWithResult(_0x211bbb,_0x551123){_0x551123=_0x551123||0xc8;return function(_0x4c307c){if(_0x4c307c){return _0x211bbb[_0xdf51('0x19')](_0x551123)[_0xdf51('0x1a')](_0x4c307c);}};}function respondWithFilteredResult(_0x5c6820,_0x92a588){return function(_0x220105){if(_0x220105){var _0x353786=typeof _0x92a588['offset']===_0xdf51('0x1b')&&typeof _0x92a588[_0xdf51('0x1c')]===_0xdf51('0x1b');var _0x290c31=_0x220105['count'];var _0x518bb1=_0x353786?0x0:_0x92a588['offset'];var _0x4e1a09=_0x353786?_0x220105[_0xdf51('0x1d')]:_0x92a588[_0xdf51('0x1e')]+_0x92a588['limit'];var _0x1d5b71;if(_0x4e1a09>=_0x290c31){_0x4e1a09=_0x290c31;_0x1d5b71=0xc8;}else{_0x1d5b71=0xce;}_0x5c6820[_0xdf51('0x19')](_0x1d5b71);return _0x5c6820[_0xdf51('0x1f')](_0xdf51('0x20'),_0x518bb1+'-'+_0x4e1a09+'/'+_0x290c31)[_0xdf51('0x1a')](_0x220105);}return null;};}function patchUpdates(_0x12d906){return function(_0x21c619){try{jsonpatch['apply'](_0x21c619,_0x12d906,!![]);}catch(_0x4458f9){return BPromise[_0xdf51('0x21')](_0x4458f9);}return _0x21c619[_0xdf51('0x22')]();};}function saveUpdates(_0x49179f,_0x274ae3){return function(_0x2b4396){if(_0x2b4396){return _0x2b4396[_0xdf51('0x23')](_0x49179f)[_0xdf51('0x24')](function(_0x28aaf2){return _0x28aaf2;});}return null;};}function removeEntity(_0x7aae47,_0x5d6193){return function(_0x54e4cd){if(_0x54e4cd){return _0x54e4cd[_0xdf51('0x25')]()['then'](function(){_0x7aae47[_0xdf51('0x19')](0xcc)[_0xdf51('0x26')]();});}};}function handleEntityNotFound(_0x33a176,_0x1cfc1b){return function(_0x2d6b0a){if(!_0x2d6b0a){_0x33a176[_0xdf51('0x18')](0x194);}return _0x2d6b0a;};}function handleError(_0x2eecff,_0x7b721d){_0x7b721d=_0x7b721d||0x1f4;return function(_0x772bb9){logger[_0xdf51('0x27')](_0x772bb9[_0xdf51('0x28')]);if(_0x772bb9['name']){delete _0x772bb9['name'];}_0x2eecff['status'](_0x7b721d)[_0xdf51('0x29')](_0x772bb9);};}exports['index']=function(_0x1d9b6f,_0x4630a8){var _0x1874ef={},_0x54db83={},_0x34cca2={'count':0x0,'rows':[]};var _0x582aa6=_['map'](db[_0xdf51('0x2a')][_0xdf51('0x2b')],function(_0x3f68f2){return{'name':_0x3f68f2['fieldName'],'type':_0x3f68f2['type']['key']};});_0x54db83['model']=_[_0xdf51('0x2c')](_0x582aa6,_0xdf51('0x2d'));_0x54db83[_0xdf51('0x2e')]=_[_0xdf51('0x2f')](_0x1d9b6f[_0xdf51('0x2e')]);_0x54db83[_0xdf51('0x30')]=_[_0xdf51('0x31')](_0x54db83[_0xdf51('0x32')],_0x54db83['query']);_0x1874ef[_0xdf51('0x33')]=_[_0xdf51('0x31')](_0x54db83['model'],qs[_0xdf51('0x34')](_0x1d9b6f['query'][_0xdf51('0x34')]));_0x1874ef[_0xdf51('0x33')]=_0x1874ef[_0xdf51('0x33')][_0xdf51('0x35')]?_0x1874ef['attributes']:_0x54db83[_0xdf51('0x32')];if(!_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x36')](_0xdf51('0x37'))){_0x1874ef[_0xdf51('0x1c')]=qs[_0xdf51('0x1c')](_0x1d9b6f['query'][_0xdf51('0x1c')]);_0x1874ef[_0xdf51('0x1e')]=qs[_0xdf51('0x1e')](_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x1e')]);}_0x1874ef[_0xdf51('0x38')]=qs[_0xdf51('0x39')](_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x39')]);_0x1874ef[_0xdf51('0x3a')]=qs[_0xdf51('0x30')](_['pick'](_0x1d9b6f[_0xdf51('0x2e')],_0x54db83[_0xdf51('0x30')]),_0x582aa6);if(_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x3b')]){_0x1874ef[_0xdf51('0x3a')]=_[_0xdf51('0x3c')](_0x1874ef[_0xdf51('0x3a')],{'$or':_[_0xdf51('0x2c')](_0x582aa6,function(_0x288f11){if(_0x288f11[_0xdf51('0x3d')]!==_0xdf51('0x3e')){var _0x1bd5af={};_0x1bd5af[_0x288f11[_0xdf51('0x2d')]]={'$like':'%'+_0x1d9b6f[_0xdf51('0x2e')][_0xdf51('0x3b')]+'%'};return _0x1bd5af;}})});}_0x1874ef=_[_0xdf51('0x3c')]({},_0x1874ef,_0x1d9b6f['options']);var _0x4b3a12={'where':_0x1874ef[_0xdf51('0x3a')]};return db['JscriptyQuestionReport'][_0xdf51('0x1d')](_0x4b3a12)[_0xdf51('0x24')](function(_0xf09a68){_0x34cca2[_0xdf51('0x1d')]=_0xf09a68;if(_0x1d9b6f['query'][_0xdf51('0x3f')]){_0x1874ef[_0xdf51('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xdf51('0x41')](_0x1874ef);})[_0xdf51('0x24')](function(_0x2ff58d){_0x34cca2[_0xdf51('0x42')]=_0x2ff58d;return _0x34cca2;})[_0xdf51('0x24')](respondWithFilteredResult(_0x4630a8,_0x1874ef))[_0xdf51('0x43')](handleError(_0x4630a8,null));};exports['show']=function(_0x2220bb,_0x2dd46a){var _0x3f459e={'raw':!![],'where':{'id':_0x2220bb['params']['id']}},_0x9225b5={};_0x9225b5[_0xdf51('0x32')]=_[_0xdf51('0x2f')](db[_0xdf51('0x2a')][_0xdf51('0x2b')]);_0x9225b5[_0xdf51('0x2e')]=_[_0xdf51('0x2f')](_0x2220bb[_0xdf51('0x2e')]);_0x9225b5[_0xdf51('0x30')]=_[_0xdf51('0x31')](_0x9225b5[_0xdf51('0x32')],_0x9225b5[_0xdf51('0x2e')]);_0x3f459e[_0xdf51('0x33')]=_[_0xdf51('0x31')](_0x9225b5[_0xdf51('0x32')],qs['fields'](_0x2220bb[_0xdf51('0x2e')][_0xdf51('0x34')]));_0x3f459e['attributes']=_0x3f459e[_0xdf51('0x33')]['length']?_0x3f459e[_0xdf51('0x33')]:_0x9225b5[_0xdf51('0x32')];if(_0x2220bb['query'][_0xdf51('0x3f')]){_0x3f459e['include']=[{'all':!![]}];}_0x3f459e=_[_0xdf51('0x3c')]({},_0x3f459e,_0x2220bb['options']);return db[_0xdf51('0x2a')][_0xdf51('0x44')](_0x3f459e)['then'](handleEntityNotFound(_0x2dd46a,null))['then'](respondWithResult(_0x2dd46a,null))[_0xdf51('0x43')](handleError(_0x2dd46a,null));};exports[_0xdf51('0x45')]=function(_0x5c66cb,_0x56f765){return db[_0xdf51('0x2a')]['create'](_0x5c66cb[_0xdf51('0x46')],{})[_0xdf51('0x24')](respondWithResult(_0x56f765,0xc9))[_0xdf51('0x43')](handleError(_0x56f765,null));};exports[_0xdf51('0x23')]=function(_0x20a285,_0x5e5e46){if(_0x20a285[_0xdf51('0x46')]['id']){delete _0x20a285[_0xdf51('0x46')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x20a285[_0xdf51('0x47')]['id']}})[_0xdf51('0x24')](handleEntityNotFound(_0x5e5e46,null))['then'](saveUpdates(_0x20a285['body'],null))[_0xdf51('0x24')](respondWithResult(_0x5e5e46,null))['catch'](handleError(_0x5e5e46,null));};exports['destroy']=function(_0x2fed2f,_0x2b7d31){return db[_0xdf51('0x2a')][_0xdf51('0x44')]({'where':{'id':_0x2fed2f[_0xdf51('0x47')]['id']}})[_0xdf51('0x24')](handleEntityNotFound(_0x2b7d31,null))['then'](removeEntity(_0x2b7d31,null))[_0xdf51('0x43')](handleError(_0x2b7d31,null));};exports[_0xdf51('0x48')]=function(_0x12b25a,_0x34bd17){return db[_0xdf51('0x2a')][_0xdf51('0x48')]()[_0xdf51('0x24')](respondWithResult(_0x34bd17,null))[_0xdf51('0x43')](handleError(_0x34bd17,null));}; \ No newline at end of file +var _0x9600=['util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1e9fd4,_0x253591){var _0x4de29f=function(_0x4cc161){while(--_0x4cc161){_0x1e9fd4['push'](_0x1e9fd4['shift']());}};_0x4de29f(++_0x253591);}(_0x9600,0x16f));var _0x0960=function(_0x2be3e1,_0x31da15){_0x2be3e1=_0x2be3e1-0x0;var _0x45f43c=_0x9600[_0x2be3e1];return _0x45f43c;};'use strict';var emlformat=require(_0x0960('0x0'));var rimraf=require(_0x0960('0x1'));var zipdir=require(_0x0960('0x2'));var jsonpatch=require(_0x0960('0x3'));var rp=require(_0x0960('0x4'));var moment=require(_0x0960('0x5'));var BPromise=require(_0x0960('0x6'));var Mustache=require(_0x0960('0x7'));var util=require(_0x0960('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0960('0x9'));var fs=require('fs');var fs_extra=require(_0x0960('0xa'));var _=require(_0x0960('0xb'));var squel=require(_0x0960('0xc'));var crypto=require(_0x0960('0xd'));var jsforce=require(_0x0960('0xe'));var deskjs=require(_0x0960('0xf'));var toCsv=require(_0x0960('0x10'));var querystring=require(_0x0960('0x11'));var Papa=require('papaparse');var Redis=require(_0x0960('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0960('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0960('0x14'));var logger=require(_0x0960('0x15'))('api');var utils=require(_0x0960('0x16'));var config=require(_0x0960('0x17'));var licenseUtil=require(_0x0960('0x18'));var db=require(_0x0960('0x19'))['db'];function respondWithStatusCode(_0x5f4c6f,_0x47f231){_0x47f231=_0x47f231||0xcc;return function(_0x2ca1ba){if(_0x2ca1ba){return _0x5f4c6f['sendStatus'](_0x47f231);}return _0x5f4c6f[_0x0960('0x1a')](_0x47f231)[_0x0960('0x1b')]();};}function respondWithResult(_0x490417,_0x483cd4){_0x483cd4=_0x483cd4||0xc8;return function(_0x26687c){if(_0x26687c){return _0x490417[_0x0960('0x1a')](_0x483cd4)[_0x0960('0x1c')](_0x26687c);}};}function respondWithFilteredResult(_0x299c98,_0x3140cc){return function(_0x6ebed0){if(_0x6ebed0){var _0x211c9b=typeof _0x3140cc['offset']===_0x0960('0x1d')&&typeof _0x3140cc[_0x0960('0x1e')]===_0x0960('0x1d');var _0x5c365e=_0x6ebed0[_0x0960('0x1f')];var _0x3522a3=_0x211c9b?0x0:_0x3140cc[_0x0960('0x20')];var _0x1bee7f=_0x211c9b?_0x6ebed0[_0x0960('0x1f')]:_0x3140cc[_0x0960('0x20')]+_0x3140cc[_0x0960('0x1e')];var _0x4b7b9b;if(_0x1bee7f>=_0x5c365e){_0x1bee7f=_0x5c365e;_0x4b7b9b=0xc8;}else{_0x4b7b9b=0xce;}_0x299c98['status'](_0x4b7b9b);return _0x299c98[_0x0960('0x21')](_0x0960('0x22'),_0x3522a3+'-'+_0x1bee7f+'/'+_0x5c365e)[_0x0960('0x1c')](_0x6ebed0);}return null;};}function patchUpdates(_0x820032){return function(_0x1acc40){try{jsonpatch[_0x0960('0x23')](_0x1acc40,_0x820032,!![]);}catch(_0xfaae3e){return BPromise[_0x0960('0x24')](_0xfaae3e);}return _0x1acc40['save']();};}function saveUpdates(_0x255afa,_0x221b5a){return function(_0x3f3854){if(_0x3f3854){return _0x3f3854[_0x0960('0x25')](_0x255afa)[_0x0960('0x26')](function(_0xd482c){return _0xd482c;});}return null;};}function removeEntity(_0x307d18,_0x4e8e76){return function(_0x215781){if(_0x215781){return _0x215781[_0x0960('0x27')]()[_0x0960('0x26')](function(){_0x307d18[_0x0960('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d4753,_0x4df564){return function(_0x259e06){if(!_0x259e06){_0x3d4753[_0x0960('0x28')](0x194);}return _0x259e06;};}function handleError(_0x15f04b,_0x4bdb62){_0x4bdb62=_0x4bdb62||0x1f4;return function(_0xf1584c){logger[_0x0960('0x29')](_0xf1584c[_0x0960('0x2a')]);if(_0xf1584c[_0x0960('0x2b')]){delete _0xf1584c['name'];}_0x15f04b['status'](_0x4bdb62)[_0x0960('0x2c')](_0xf1584c);};}exports['index']=function(_0x1d7a75,_0xe27492){var _0x315374={},_0x361caf={},_0x33ee74={'count':0x0,'rows':[]};var _0x54c115=_[_0x0960('0x2d')](db[_0x0960('0x2e')][_0x0960('0x2f')],function(_0x10f424){return{'name':_0x10f424[_0x0960('0x30')],'type':_0x10f424[_0x0960('0x31')]['key']};});_0x361caf[_0x0960('0x32')]=_[_0x0960('0x2d')](_0x54c115,_0x0960('0x2b'));_0x361caf[_0x0960('0x33')]=_[_0x0960('0x34')](_0x1d7a75[_0x0960('0x33')]);_0x361caf[_0x0960('0x35')]=_['intersection'](_0x361caf[_0x0960('0x32')],_0x361caf[_0x0960('0x33')]);_0x315374[_0x0960('0x36')]=_[_0x0960('0x37')](_0x361caf[_0x0960('0x32')],qs['fields'](_0x1d7a75[_0x0960('0x33')][_0x0960('0x38')]));_0x315374[_0x0960('0x36')]=_0x315374[_0x0960('0x36')][_0x0960('0x39')]?_0x315374[_0x0960('0x36')]:_0x361caf[_0x0960('0x32')];if(!_0x1d7a75[_0x0960('0x33')][_0x0960('0x3a')]('nolimit')){_0x315374[_0x0960('0x1e')]=qs[_0x0960('0x1e')](_0x1d7a75[_0x0960('0x33')][_0x0960('0x1e')]);_0x315374['offset']=qs[_0x0960('0x20')](_0x1d7a75[_0x0960('0x33')][_0x0960('0x20')]);}_0x315374['order']=qs['sort'](_0x1d7a75[_0x0960('0x33')][_0x0960('0x3b')]);_0x315374[_0x0960('0x3c')]=qs['filters'](_[_0x0960('0x3d')](_0x1d7a75['query'],_0x361caf[_0x0960('0x35')]),_0x54c115);if(_0x1d7a75['query'][_0x0960('0x3e')]){_0x315374[_0x0960('0x3c')]=_[_0x0960('0x3f')](_0x315374['where'],{'$or':_[_0x0960('0x2d')](_0x54c115,function(_0x20e078){if(_0x20e078['type']!==_0x0960('0x40')){var _0x572c32={};_0x572c32[_0x20e078['name']]={'$like':'%'+_0x1d7a75[_0x0960('0x33')][_0x0960('0x3e')]+'%'};return _0x572c32;}})});}_0x315374=_['merge']({},_0x315374,_0x1d7a75[_0x0960('0x41')]);var _0x4462ee={'where':_0x315374[_0x0960('0x3c')]};return db[_0x0960('0x2e')]['count'](_0x4462ee)[_0x0960('0x26')](function(_0x37ed70){_0x33ee74[_0x0960('0x1f')]=_0x37ed70;if(_0x1d7a75[_0x0960('0x33')][_0x0960('0x42')]){_0x315374[_0x0960('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x315374);})[_0x0960('0x26')](function(_0x4e43a0){_0x33ee74['rows']=_0x4e43a0;return _0x33ee74;})['then'](respondWithFilteredResult(_0xe27492,_0x315374))[_0x0960('0x44')](handleError(_0xe27492,null));};exports[_0x0960('0x45')]=function(_0x53c23b,_0x1b4efa){var _0x12093e={'raw':!![],'where':{'id':_0x53c23b[_0x0960('0x46')]['id']}},_0x293511={};_0x293511['model']=_[_0x0960('0x34')](db[_0x0960('0x2e')][_0x0960('0x2f')]);_0x293511['query']=_[_0x0960('0x34')](_0x53c23b[_0x0960('0x33')]);_0x293511[_0x0960('0x35')]=_['intersection'](_0x293511[_0x0960('0x32')],_0x293511[_0x0960('0x33')]);_0x12093e[_0x0960('0x36')]=_['intersection'](_0x293511[_0x0960('0x32')],qs[_0x0960('0x38')](_0x53c23b[_0x0960('0x33')][_0x0960('0x38')]));_0x12093e[_0x0960('0x36')]=_0x12093e[_0x0960('0x36')][_0x0960('0x39')]?_0x12093e[_0x0960('0x36')]:_0x293511[_0x0960('0x32')];if(_0x53c23b[_0x0960('0x33')][_0x0960('0x42')]){_0x12093e[_0x0960('0x43')]=[{'all':!![]}];}_0x12093e=_[_0x0960('0x3f')]({},_0x12093e,_0x53c23b[_0x0960('0x41')]);return db['JscriptyQuestionReport'][_0x0960('0x47')](_0x12093e)['then'](handleEntityNotFound(_0x1b4efa,null))[_0x0960('0x26')](respondWithResult(_0x1b4efa,null))['catch'](handleError(_0x1b4efa,null));};exports[_0x0960('0x48')]=function(_0x3b897d,_0x7be76d){return db['JscriptyQuestionReport']['create'](_0x3b897d[_0x0960('0x49')],{})[_0x0960('0x26')](respondWithResult(_0x7be76d,0xc9))[_0x0960('0x44')](handleError(_0x7be76d,null));};exports[_0x0960('0x25')]=function(_0x8545a4,_0x323d0e){if(_0x8545a4[_0x0960('0x49')]['id']){delete _0x8545a4['body']['id'];}return db[_0x0960('0x2e')][_0x0960('0x47')]({'where':{'id':_0x8545a4['params']['id']}})[_0x0960('0x26')](handleEntityNotFound(_0x323d0e,null))[_0x0960('0x26')](saveUpdates(_0x8545a4[_0x0960('0x49')],null))['then'](respondWithResult(_0x323d0e,null))[_0x0960('0x44')](handleError(_0x323d0e,null));};exports['destroy']=function(_0x1b5326,_0x5001b6){return db[_0x0960('0x2e')][_0x0960('0x47')]({'where':{'id':_0x1b5326['params']['id']}})[_0x0960('0x26')](handleEntityNotFound(_0x5001b6,null))[_0x0960('0x26')](removeEntity(_0x5001b6,null))['catch'](handleError(_0x5001b6,null));};exports[_0x0960('0x4a')]=function(_0x2a3b4c,_0x507445){return db['JscriptyQuestionReport'][_0x0960('0x4a')]()['then'](respondWithResult(_0x507445,null))['catch'](handleError(_0x507445,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b1e166b..d35206c 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 _0xd4c1=['exports','define','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x4dfe12,_0x59c69f){var _0x465909=function(_0x140308){while(--_0x140308){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x465909(++_0x59c69f);}(_0xd4c1,0xdb));var _0x1d4c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4c1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1d4c('0x0'));var util=require(_0x1d4c('0x1'));var logger=require(_0x1d4c('0x2'))(_0x1d4c('0x3'));var moment=require('moment');var BPromise=require(_0x1d4c('0x4'));var rp=require(_0x1d4c('0x5'));var fs=require('fs');var path=require(_0x1d4c('0x6'));var rimraf=require('rimraf');var config=require(_0x1d4c('0x7'));var attributes=require(_0x1d4c('0x8'));module[_0x1d4c('0x9')]=function(_0x4cf3d8,_0x5e427f){return _0x4cf3d8[_0x1d4c('0xa')](_0x1d4c('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x828c=['define','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0x285a09,_0x955feb){var _0x18a484=function(_0x48f247){while(--_0x48f247){_0x285a09['push'](_0x285a09['shift']());}};_0x18a484(++_0x955feb);}(_0x828c,0xf9));var _0xc828=function(_0x3d7f78,_0x17e4d0){_0x3d7f78=_0x3d7f78-0x0;var _0x3bf252=_0x828c[_0x3d7f78];return _0x3bf252;};'use strict';var _=require('lodash');var util=require(_0xc828('0x0'));var logger=require(_0xc828('0x1'))(_0xc828('0x2'));var moment=require(_0xc828('0x3'));var BPromise=require('bluebird');var rp=require(_0xc828('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc828('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xc828('0x6')]=function(_0x50ab08,_0x7d7321){return _0x50ab08[_0xc828('0x7')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','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 5a8bd63..96653c4 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 _0x2b14=['info','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x2b14,0x1cf));var _0x42b1=function(_0x16275f,_0x566e5f){_0x16275f=_0x16275f-0x0;var _0x569c51=_0x2b14[_0x16275f];return _0x569c51;};'use strict';var _=require(_0x42b1('0x0'));var util=require(_0x42b1('0x1'));var moment=require(_0x42b1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42b1('0x4'))(_0x42b1('0x5'));var config=require(_0x42b1('0x6'));var jayson=require(_0x42b1('0x7'));var client=jayson[_0x42b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c62e,_0x3e434c,_0x3740df){return new BPromise(function(_0x176c4d,_0x4cf7ca){return client['request'](_0x41c62e,_0x3740df)['then'](function(_0x5bf178){logger['info'](_0x42b1('0x9'),_0x3e434c,_0x42b1('0xa'));logger[_0x42b1('0xb')](_0x42b1('0xc'),_0x3e434c,_0x42b1('0xa'),JSON[_0x42b1('0xd')](_0x5bf178));if(_0x5bf178[_0x42b1('0xe')]){if(_0x5bf178['error'][_0x42b1('0xf')]===0x1f4){logger[_0x42b1('0xe')](_0x42b1('0x9'),_0x3e434c,_0x5bf178['error'][_0x42b1('0x10')]);return _0x4cf7ca(_0x5bf178[_0x42b1('0xe')][_0x42b1('0x10')]);}logger['error'](_0x42b1('0x9'),_0x3e434c,_0x5bf178[_0x42b1('0xe')][_0x42b1('0x10')]);return _0x176c4d(_0x5bf178['error'][_0x42b1('0x10')]);}else{logger[_0x42b1('0x11')](_0x42b1('0x9'),_0x3e434c,'request\x20sent');_0x176c4d(_0x5bf178[_0x42b1('0x12')]['message']);}})[_0x42b1('0x13')](function(_0x35fd74){logger['error'](_0x42b1('0x9'),_0x3e434c,_0x35fd74);_0x4cf7ca(_0x35fd74);});});} \ No newline at end of file +var _0x1c9e=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1c9e,0x6f));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe1c9('0x0'));var util=require(_0xe1c9('0x1'));var moment=require('moment');var BPromise=require(_0xe1c9('0x2'));var rs=require(_0xe1c9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe1c9('0x4'));var logger=require('../../config/logger')(_0xe1c9('0x5'));var config=require(_0xe1c9('0x6'));var jayson=require(_0xe1c9('0x7'));var client=jayson['client'][_0xe1c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa92f9d,_0x2f7d30,_0x2ef506){return new BPromise(function(_0x34aecb,_0x4497c3){return client[_0xe1c9('0x9')](_0xa92f9d,_0x2ef506)[_0xe1c9('0xa')](function(_0x599faf){logger[_0xe1c9('0xb')](_0xe1c9('0xc'),_0x2f7d30,_0xe1c9('0xd'));logger['debug'](_0xe1c9('0xe'),_0x2f7d30,_0xe1c9('0xd'),JSON[_0xe1c9('0xf')](_0x599faf));if(_0x599faf['error']){if(_0x599faf[_0xe1c9('0x10')][_0xe1c9('0x11')]===0x1f4){logger[_0xe1c9('0x10')](_0xe1c9('0xc'),_0x2f7d30,_0x599faf[_0xe1c9('0x10')]['message']);return _0x4497c3(_0x599faf[_0xe1c9('0x10')]['message']);}logger[_0xe1c9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2f7d30,_0x599faf['error'][_0xe1c9('0x12')]);return _0x34aecb(_0x599faf[_0xe1c9('0x10')][_0xe1c9('0x12')]);}else{logger[_0xe1c9('0xb')](_0xe1c9('0xc'),_0x2f7d30,_0xe1c9('0xd'));_0x34aecb(_0x599faf[_0xe1c9('0x13')]['message']);}})[_0xe1c9('0x14')](function(_0x4a4af1){logger[_0xe1c9('0x10')](_0xe1c9('0xc'),_0x2f7d30,_0x4a4af1);_0x4497c3(_0x4a4af1);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ca6bede..b58394c 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 _0x7861=['get','isAuthenticated','index','/describe','/:id','/:id/questions','post','create','put','update','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller'];(function(_0x3d0855,_0x10957f){var _0x2d90d4=function(_0x1cbaf0){while(--_0x1cbaf0){_0x3d0855['push'](_0x3d0855['shift']());}};_0x2d90d4(++_0x10957f);}(_0x7861,0x175));var _0x1786=function(_0x4e14bc,_0x4dc1c6){_0x4e14bc=_0x4e14bc-0x0;var _0x569489=_0x7861[_0x4e14bc];return _0x569489;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1786('0x0'));var router=express['Router']();var fs_extra=require(_0x1786('0x1'));var auth=require(_0x1786('0x2'));var interaction=require(_0x1786('0x3'));var config=require('../../config/environment');var controller=require(_0x1786('0x4'));router[_0x1786('0x5')]('/',auth[_0x1786('0x6')](),controller[_0x1786('0x7')]);router[_0x1786('0x5')](_0x1786('0x8'),auth[_0x1786('0x6')](),controller['describe']);router['get'](_0x1786('0x9'),auth[_0x1786('0x6')](),controller['show']);router[_0x1786('0x5')](_0x1786('0xa'),auth[_0x1786('0x6')](),controller['getQuestions']);router[_0x1786('0xb')]('/',auth['isAuthenticated'](),controller[_0x1786('0xc')]);router[_0x1786('0xd')](_0x1786('0x9'),auth[_0x1786('0x6')](),controller[_0x1786('0xe')]);router[_0x1786('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1786('0x10')]);module[_0x1786('0x11')]=router; \ No newline at end of file +var _0xcf5d=['/:id','show','/:id/questions','getQuestions','post','create','put','delete','destroy','util','path','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x4f0fc4,_0xc9a7f6){var _0x22c918=function(_0x152f1c){while(--_0x152f1c){_0x4f0fc4['push'](_0x4f0fc4['shift']());}};_0x22c918(++_0xc9a7f6);}(_0xcf5d,0x1e9));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdcf5('0x0'));var path=require(_0xdcf5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdcf5('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdcf5('0x3'));var interaction=require(_0xdcf5('0x4'));var config=require('../../config/environment');var controller=require(_0xdcf5('0x5'));router['get']('/',auth[_0xdcf5('0x6')](),controller[_0xdcf5('0x7')]);router[_0xdcf5('0x8')](_0xdcf5('0x9'),auth[_0xdcf5('0x6')](),controller[_0xdcf5('0xa')]);router[_0xdcf5('0x8')](_0xdcf5('0xb'),auth[_0xdcf5('0x6')](),controller[_0xdcf5('0xc')]);router[_0xdcf5('0x8')](_0xdcf5('0xd'),auth[_0xdcf5('0x6')](),controller[_0xdcf5('0xe')]);router[_0xdcf5('0xf')]('/',auth[_0xdcf5('0x6')](),controller[_0xdcf5('0x10')]);router[_0xdcf5('0x11')](_0xdcf5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xdcf5('0x12')](_0xdcf5('0xb'),auth[_0xdcf5('0x6')](),controller[_0xdcf5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 139ab37..afb2092 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 _0x15e9=['DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x15e9,0xd6));var _0x915e=function(_0xbd8612,_0x4684bd){_0xbd8612=_0xbd8612-0x0;var _0x51aa1c=_0x15e9[_0xbd8612];return _0x51aa1c;};'use strict';var moment=require(_0x915e('0x0'));var Sequelize=require(_0x915e('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x915e('0x2')],'set':function(_0x28a224){this[_0x915e('0x3')](_0x915e('0x4'),_0x28a224);this[_0x915e('0x3')](_0x915e('0x5'),moment()['format'](_0x915e('0x6')));}},'endtime':{'type':Sequelize[_0x915e('0x2')]},'membername':{'type':Sequelize[_0x915e('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x915e('0x7')]},'uniqueid':{'type':Sequelize[_0x915e('0x7')]},'calleridname':{'type':Sequelize[_0x915e('0x7')]},'calleridnum':{'type':Sequelize[_0x915e('0x7')]},'completed':{'type':Sequelize[_0x915e('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x4f8b=['exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize'];(function(_0x4b6389,_0x2a1c4b){var _0x48bbf8=function(_0x5bf953){while(--_0x5bf953){_0x4b6389['push'](_0x4b6389['shift']());}};_0x48bbf8(++_0x2a1c4b);}(_0x4f8b,0xb3));var _0xb4f8=function(_0x12fb70,_0xb07166){_0x12fb70=_0x12fb70-0x0;var _0x2c0468=_0x4f8b[_0x12fb70];return _0x2c0468;};'use strict';var moment=require('moment');var Sequelize=require(_0xb4f8('0x0'));module[_0xb4f8('0x1')]={'starttime':{'type':Sequelize[_0xb4f8('0x2')],'set':function(_0x475627){this[_0xb4f8('0x3')](_0xb4f8('0x4'),_0x475627);this[_0xb4f8('0x3')](_0xb4f8('0x5'),moment()[_0xb4f8('0x6')](_0xb4f8('0x7')));}},'endtime':{'type':Sequelize[_0xb4f8('0x2')]},'membername':{'type':Sequelize[_0xb4f8('0x8')]},'projectname':{'type':Sequelize[_0xb4f8('0x8')]},'queue':{'type':Sequelize[_0xb4f8('0x8')]},'uniqueid':{'type':Sequelize[_0xb4f8('0x8')]},'calleridname':{'type':Sequelize[_0xb4f8('0x8')]},'calleridnum':{'type':Sequelize[_0xb4f8('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4038501..1b67e5e 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 _0x7ef4=['find','body','describe','JscriptyQuestionReport','hasOwnProperty','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','JscriptySessionReport','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','keys','includeAll'];(function(_0x13189b,_0x31d86a){var _0x1ec58b=function(_0x5a9a81){while(--_0x5a9a81){_0x13189b['push'](_0x13189b['shift']());}};_0x1ec58b(++_0x31d86a);}(_0x7ef4,0xea));var _0x47ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7ef4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x47ef('0x0'));var rimraf=require(_0x47ef('0x1'));var zipdir=require(_0x47ef('0x2'));var jsonpatch=require(_0x47ef('0x3'));var rp=require(_0x47ef('0x4'));var moment=require(_0x47ef('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x47ef('0x6'));var sox=require(_0x47ef('0x7'));var csv=require(_0x47ef('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47ef('0x9'));var _=require(_0x47ef('0xa'));var squel=require(_0x47ef('0xb'));var crypto=require(_0x47ef('0xc'));var jsforce=require(_0x47ef('0xd'));var deskjs=require(_0x47ef('0xe'));var toCsv=require('to-csv');var querystring=require(_0x47ef('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x47ef('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x47ef('0x11'));var hardwareService=require(_0x47ef('0x12'));var logger=require(_0x47ef('0x13'))(_0x47ef('0x14'));var utils=require('../../config/utils');var config=require(_0x47ef('0x15'));var licenseUtil=require(_0x47ef('0x16'));var db=require(_0x47ef('0x17'))['db'];function respondWithStatusCode(_0x155256,_0x4e47b9){_0x4e47b9=_0x4e47b9||0xcc;return function(_0x4cd882){if(_0x4cd882){return _0x155256[_0x47ef('0x18')](_0x4e47b9);}return _0x155256[_0x47ef('0x19')](_0x4e47b9)[_0x47ef('0x1a')]();};}function respondWithResult(_0x3a8f6b,_0x2d4e0a){_0x2d4e0a=_0x2d4e0a||0xc8;return function(_0x1b12dc){if(_0x1b12dc){return _0x3a8f6b[_0x47ef('0x19')](_0x2d4e0a)['json'](_0x1b12dc);}};}function respondWithFilteredResult(_0x5549d5,_0x46466c){return function(_0x3a213f){if(_0x3a213f){var _0x33c386=typeof _0x46466c[_0x47ef('0x1b')]===_0x47ef('0x1c')&&typeof _0x46466c[_0x47ef('0x1d')]==='undefined';var _0x2386f5=_0x3a213f['count'];var _0x2f26a6=_0x33c386?0x0:_0x46466c[_0x47ef('0x1b')];var _0x1bb17c=_0x33c386?_0x3a213f['count']:_0x46466c[_0x47ef('0x1b')]+_0x46466c[_0x47ef('0x1d')];var _0x31f4d8;if(_0x1bb17c>=_0x2386f5){_0x1bb17c=_0x2386f5;_0x31f4d8=0xc8;}else{_0x31f4d8=0xce;}_0x5549d5['status'](_0x31f4d8);return _0x5549d5[_0x47ef('0x1e')]('Content-Range',_0x2f26a6+'-'+_0x1bb17c+'/'+_0x2386f5)[_0x47ef('0x1f')](_0x3a213f);}return null;};}function patchUpdates(_0x52a820){return function(_0x446f2e){try{jsonpatch[_0x47ef('0x20')](_0x446f2e,_0x52a820,!![]);}catch(_0x1283c3){return BPromise[_0x47ef('0x21')](_0x1283c3);}return _0x446f2e[_0x47ef('0x22')]();};}function saveUpdates(_0x47c84a,_0x1aae61){return function(_0x1dfca9){if(_0x1dfca9){return _0x1dfca9[_0x47ef('0x23')](_0x47c84a)[_0x47ef('0x24')](function(_0x424536){return _0x424536;});}return null;};}function removeEntity(_0x21b722,_0x2a66bd){return function(_0x48ac5f){if(_0x48ac5f){return _0x48ac5f[_0x47ef('0x25')]()[_0x47ef('0x24')](function(){_0x21b722[_0x47ef('0x19')](0xcc)[_0x47ef('0x1a')]();});}};}function handleEntityNotFound(_0xb99a3f,_0x287a3a){return function(_0x2f4893){if(!_0x2f4893){_0xb99a3f[_0x47ef('0x18')](0x194);}return _0x2f4893;};}function handleError(_0x5d8bd5,_0x1c5bf5){_0x1c5bf5=_0x1c5bf5||0x1f4;return function(_0x5e4205){logger[_0x47ef('0x26')](_0x5e4205[_0x47ef('0x27')]);if(_0x5e4205[_0x47ef('0x28')]){delete _0x5e4205[_0x47ef('0x28')];}_0x5d8bd5[_0x47ef('0x19')](_0x1c5bf5)[_0x47ef('0x29')](_0x5e4205);};}exports['index']=function(_0x517f2b,_0x4619f1){var _0x27e17e={},_0xe1e8c2={},_0x1b313c={'count':0x0,'rows':[]};var _0x5a9f8e=_['map'](db[_0x47ef('0x2a')][_0x47ef('0x2b')],function(_0x13492e){return{'name':_0x13492e['fieldName'],'type':_0x13492e[_0x47ef('0x2c')][_0x47ef('0x2d')]};});_0xe1e8c2[_0x47ef('0x2e')]=_[_0x47ef('0x2f')](_0x5a9f8e,'name');_0xe1e8c2[_0x47ef('0x30')]=_['keys'](_0x517f2b[_0x47ef('0x30')]);_0xe1e8c2[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0xe1e8c2[_0x47ef('0x2e')],_0xe1e8c2['query']);_0x27e17e[_0x47ef('0x33')]=_['intersection'](_0xe1e8c2[_0x47ef('0x2e')],qs[_0x47ef('0x34')](_0x517f2b[_0x47ef('0x30')]['fields']));_0x27e17e['attributes']=_0x27e17e[_0x47ef('0x33')][_0x47ef('0x35')]?_0x27e17e[_0x47ef('0x33')]:_0xe1e8c2[_0x47ef('0x2e')];if(!_0x517f2b['query']['hasOwnProperty'](_0x47ef('0x36'))){_0x27e17e[_0x47ef('0x1d')]=qs['limit'](_0x517f2b[_0x47ef('0x30')][_0x47ef('0x1d')]);_0x27e17e[_0x47ef('0x1b')]=qs[_0x47ef('0x1b')](_0x517f2b[_0x47ef('0x30')][_0x47ef('0x1b')]);}_0x27e17e[_0x47ef('0x37')]=qs['sort'](_0x517f2b[_0x47ef('0x30')]['sort']);_0x27e17e[_0x47ef('0x38')]=qs['filters'](_[_0x47ef('0x39')](_0x517f2b['query'],_0xe1e8c2[_0x47ef('0x31')]),_0x5a9f8e);if(_0x517f2b['query'][_0x47ef('0x3a')]){_0x27e17e[_0x47ef('0x38')]=_[_0x47ef('0x3b')](_0x27e17e[_0x47ef('0x38')],{'$or':_[_0x47ef('0x2f')](_0x5a9f8e,function(_0xb755f){if(_0xb755f[_0x47ef('0x2c')]!=='VIRTUAL'){var _0x42d659={};_0x42d659[_0xb755f['name']]={'$like':'%'+_0x517f2b[_0x47ef('0x30')][_0x47ef('0x3a')]+'%'};return _0x42d659;}})});}_0x27e17e=_[_0x47ef('0x3b')]({},_0x27e17e,_0x517f2b[_0x47ef('0x3c')]);var _0x50f243={'where':_0x27e17e[_0x47ef('0x38')]};return db[_0x47ef('0x2a')]['count'](_0x50f243)[_0x47ef('0x24')](function(_0x57b403){_0x1b313c[_0x47ef('0x3d')]=_0x57b403;if(_0x517f2b[_0x47ef('0x30')]['includeAll']){_0x27e17e[_0x47ef('0x3e')]=[{'all':!![]}];}return db[_0x47ef('0x2a')][_0x47ef('0x3f')](_0x27e17e);})['then'](function(_0x300854){_0x1b313c[_0x47ef('0x40')]=_0x300854;return _0x1b313c;})[_0x47ef('0x24')](respondWithFilteredResult(_0x4619f1,_0x27e17e))[_0x47ef('0x41')](handleError(_0x4619f1,null));};exports[_0x47ef('0x42')]=function(_0x801bcd,_0x1cd5b7){var _0x55d1d3={'raw':!![],'where':{'id':_0x801bcd[_0x47ef('0x43')]['id']}},_0x124978={};_0x124978[_0x47ef('0x2e')]=_[_0x47ef('0x44')](db[_0x47ef('0x2a')][_0x47ef('0x2b')]);_0x124978['query']=_['keys'](_0x801bcd[_0x47ef('0x30')]);_0x124978[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0x124978[_0x47ef('0x2e')],_0x124978[_0x47ef('0x30')]);_0x55d1d3[_0x47ef('0x33')]=_['intersection'](_0x124978['model'],qs['fields'](_0x801bcd[_0x47ef('0x30')][_0x47ef('0x34')]));_0x55d1d3[_0x47ef('0x33')]=_0x55d1d3[_0x47ef('0x33')][_0x47ef('0x35')]?_0x55d1d3[_0x47ef('0x33')]:_0x124978[_0x47ef('0x2e')];if(_0x801bcd[_0x47ef('0x30')][_0x47ef('0x45')]){_0x55d1d3[_0x47ef('0x3e')]=[{'all':!![]}];}_0x55d1d3=_[_0x47ef('0x3b')]({},_0x55d1d3,_0x801bcd[_0x47ef('0x3c')]);return db[_0x47ef('0x2a')][_0x47ef('0x46')](_0x55d1d3)['then'](handleEntityNotFound(_0x1cd5b7,null))['then'](respondWithResult(_0x1cd5b7,null))[_0x47ef('0x41')](handleError(_0x1cd5b7,null));};exports['create']=function(_0xa3134d,_0x496e9d){return db[_0x47ef('0x2a')]['create'](_0xa3134d[_0x47ef('0x47')],{})[_0x47ef('0x24')](respondWithResult(_0x496e9d,0xc9))[_0x47ef('0x41')](handleError(_0x496e9d,null));};exports[_0x47ef('0x23')]=function(_0x303146,_0x443eaf){if(_0x303146['body']['id']){delete _0x303146['body']['id'];}return db['JscriptySessionReport'][_0x47ef('0x46')]({'where':{'id':_0x303146['params']['id']}})[_0x47ef('0x24')](handleEntityNotFound(_0x443eaf,null))[_0x47ef('0x24')](saveUpdates(_0x303146['body'],null))[_0x47ef('0x24')](respondWithResult(_0x443eaf,null))['catch'](handleError(_0x443eaf,null));};exports[_0x47ef('0x25')]=function(_0x14481d,_0x280fd1){return db[_0x47ef('0x2a')][_0x47ef('0x46')]({'where':{'id':_0x14481d[_0x47ef('0x43')]['id']}})[_0x47ef('0x24')](handleEntityNotFound(_0x280fd1,null))[_0x47ef('0x24')](removeEntity(_0x280fd1,null))['catch'](handleError(_0x280fd1,null));};exports['describe']=function(_0x26d0ec,_0x378be3){return db[_0x47ef('0x2a')][_0x47ef('0x48')]()[_0x47ef('0x24')](respondWithResult(_0x378be3,null))['catch'](handleError(_0x378be3,null));};exports['getQuestions']=function(_0x477cd5,_0x1d3806,_0x4d730e){var _0x165aba={'raw':!![],'where':{}};var _0x14b7fa={};var _0x1dc09c={'count':0x0,'rows':[]};return db[_0x47ef('0x2a')]['findOne']({'where':{'id':_0x477cd5[_0x47ef('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d3806,null))[_0x47ef('0x24')](function(_0x35d0b6){if(_0x35d0b6){_0x14b7fa[_0x47ef('0x2e')]=_[_0x47ef('0x44')](db[_0x47ef('0x49')][_0x47ef('0x2b')]);_0x14b7fa[_0x47ef('0x30')]=_['keys'](_0x477cd5['query']);_0x14b7fa[_0x47ef('0x31')]=_[_0x47ef('0x32')](_0x14b7fa[_0x47ef('0x2e')],_0x14b7fa[_0x47ef('0x30')]);_0x165aba['attributes']=_[_0x47ef('0x32')](_0x14b7fa[_0x47ef('0x2e')],qs[_0x47ef('0x34')](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x34')]));_0x165aba[_0x47ef('0x33')]=_0x165aba['attributes'][_0x47ef('0x35')]?_0x165aba[_0x47ef('0x33')]:_0x14b7fa['model'];if(!_0x477cd5['query'][_0x47ef('0x4a')](_0x47ef('0x36'))){_0x165aba[_0x47ef('0x1d')]=qs[_0x47ef('0x1d')](_0x477cd5[_0x47ef('0x30')]['limit']);_0x165aba[_0x47ef('0x1b')]=qs['offset'](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x1b')]);}_0x165aba['order']=qs[_0x47ef('0x4b')](_0x477cd5[_0x47ef('0x30')][_0x47ef('0x4b')]);_0x165aba[_0x47ef('0x38')]=qs['filters'](_[_0x47ef('0x39')](_0x477cd5['query'],_0x14b7fa[_0x47ef('0x31')]));_0x165aba[_0x47ef('0x38')]['SessionId']=_0x35d0b6['id'];if(_0x477cd5[_0x47ef('0x30')][_0x47ef('0x3a')]){_0x165aba[_0x47ef('0x38')]=_[_0x47ef('0x3b')](_0x165aba['where'],{'$or':_['map'](_0x165aba[_0x47ef('0x33')],function(_0x10ed1f){var _0x45e9d1={};_0x45e9d1[_0x10ed1f]={'$like':'%'+_0x477cd5['query']['filter']+'%'};return _0x45e9d1;})});}_0x165aba=_[_0x47ef('0x3b')]({},_0x165aba,_0x477cd5[_0x47ef('0x3c')]);return db['JscriptyQuestionReport'][_0x47ef('0x3d')]({'where':_0x165aba['where']})[_0x47ef('0x24')](function(_0x403c7e){_0x1dc09c[_0x47ef('0x3d')]=_0x403c7e;if(_0x477cd5[_0x47ef('0x30')]['includeAll']){_0x165aba[_0x47ef('0x3e')]=[{'all':!![]}];}return db[_0x47ef('0x49')][_0x47ef('0x3f')](_0x165aba);})[_0x47ef('0x24')](function(_0x574003){_0x1dc09c[_0x47ef('0x40')]=_0x574003;return _0x1dc09c;});}})[_0x47ef('0x24')](respondWithFilteredResult(_0x1d3806,_0x165aba))[_0x47ef('0x41')](handleError(_0x1d3806,null));}; \ No newline at end of file +var _0x19d8=['../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','query','keys','filters','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','zip-dir','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0x19d8,0x83));var _0x819d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x19d8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x819d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x819d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x819d('0x2'));var moment=require('moment');var BPromise=require(_0x819d('0x3'));var Mustache=require(_0x819d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x819d('0x5'));var csv=require(_0x819d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x819d('0x7'));var _=require(_0x819d('0x8'));var squel=require(_0x819d('0x9'));var crypto=require(_0x819d('0xa'));var jsforce=require(_0x819d('0xb'));var deskjs=require(_0x819d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x819d('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x819d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x819d('0xf'))(_0x819d('0x10'));var utils=require(_0x819d('0x11'));var config=require(_0x819d('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49f0f9,_0x5ec176){_0x5ec176=_0x5ec176||0xcc;return function(_0x8fad5c){if(_0x8fad5c){return _0x49f0f9['sendStatus'](_0x5ec176);}return _0x49f0f9[_0x819d('0x13')](_0x5ec176)[_0x819d('0x14')]();};}function respondWithResult(_0x5b88ea,_0x137dbb){_0x137dbb=_0x137dbb||0xc8;return function(_0x15189e){if(_0x15189e){return _0x5b88ea['status'](_0x137dbb)['json'](_0x15189e);}};}function respondWithFilteredResult(_0x1b286f,_0x39420a){return function(_0x329e26){if(_0x329e26){var _0x531b1a=typeof _0x39420a[_0x819d('0x15')]===_0x819d('0x16')&&typeof _0x39420a[_0x819d('0x17')]===_0x819d('0x16');var _0x2893b2=_0x329e26['count'];var _0x300229=_0x531b1a?0x0:_0x39420a[_0x819d('0x15')];var _0x55aa8c=_0x531b1a?_0x329e26[_0x819d('0x18')]:_0x39420a[_0x819d('0x15')]+_0x39420a[_0x819d('0x17')];var _0x36423c;if(_0x55aa8c>=_0x2893b2){_0x55aa8c=_0x2893b2;_0x36423c=0xc8;}else{_0x36423c=0xce;}_0x1b286f[_0x819d('0x13')](_0x36423c);return _0x1b286f['set'](_0x819d('0x19'),_0x300229+'-'+_0x55aa8c+'/'+_0x2893b2)[_0x819d('0x1a')](_0x329e26);}return null;};}function patchUpdates(_0x2e219a){return function(_0x3b4a66){try{jsonpatch['apply'](_0x3b4a66,_0x2e219a,!![]);}catch(_0x16ef2e){return BPromise[_0x819d('0x1b')](_0x16ef2e);}return _0x3b4a66['save']();};}function saveUpdates(_0x41c8bd,_0x2f2b7f){return function(_0x386575){if(_0x386575){return _0x386575[_0x819d('0x1c')](_0x41c8bd)[_0x819d('0x1d')](function(_0x38e496){return _0x38e496;});}return null;};}function removeEntity(_0x55470d,_0x203bd5){return function(_0x3f8c7b){if(_0x3f8c7b){return _0x3f8c7b[_0x819d('0x1e')]()[_0x819d('0x1d')](function(){_0x55470d[_0x819d('0x13')](0xcc)[_0x819d('0x14')]();});}};}function handleEntityNotFound(_0x3fbfe9,_0x154466){return function(_0xed4ce5){if(!_0xed4ce5){_0x3fbfe9['sendStatus'](0x194);}return _0xed4ce5;};}function handleError(_0x4e4805,_0x14a0f7){_0x14a0f7=_0x14a0f7||0x1f4;return function(_0x16eeaa){logger['error'](_0x16eeaa[_0x819d('0x1f')]);if(_0x16eeaa[_0x819d('0x20')]){delete _0x16eeaa[_0x819d('0x20')];}_0x4e4805[_0x819d('0x13')](_0x14a0f7)[_0x819d('0x21')](_0x16eeaa);};}exports[_0x819d('0x22')]=function(_0x1955c7,_0x779536){var _0x500019={},_0x5d2efa={},_0x531789={'count':0x0,'rows':[]};var _0x4197b8=_[_0x819d('0x23')](db[_0x819d('0x24')][_0x819d('0x25')],function(_0x3a50a0){return{'name':_0x3a50a0[_0x819d('0x26')],'type':_0x3a50a0['type'][_0x819d('0x27')]};});_0x5d2efa['model']=_[_0x819d('0x23')](_0x4197b8,_0x819d('0x20'));_0x5d2efa[_0x819d('0x28')]=_[_0x819d('0x29')](_0x1955c7[_0x819d('0x28')]);_0x5d2efa[_0x819d('0x2a')]=_['intersection'](_0x5d2efa['model'],_0x5d2efa[_0x819d('0x28')]);_0x500019[_0x819d('0x2b')]=_['intersection'](_0x5d2efa['model'],qs[_0x819d('0x2c')](_0x1955c7[_0x819d('0x28')][_0x819d('0x2c')]));_0x500019[_0x819d('0x2b')]=_0x500019[_0x819d('0x2b')][_0x819d('0x2d')]?_0x500019[_0x819d('0x2b')]:_0x5d2efa[_0x819d('0x2e')];if(!_0x1955c7['query']['hasOwnProperty'](_0x819d('0x2f'))){_0x500019[_0x819d('0x17')]=qs[_0x819d('0x17')](_0x1955c7[_0x819d('0x28')][_0x819d('0x17')]);_0x500019[_0x819d('0x15')]=qs[_0x819d('0x15')](_0x1955c7[_0x819d('0x28')][_0x819d('0x15')]);}_0x500019[_0x819d('0x30')]=qs[_0x819d('0x31')](_0x1955c7[_0x819d('0x28')][_0x819d('0x31')]);_0x500019[_0x819d('0x32')]=qs[_0x819d('0x2a')](_[_0x819d('0x33')](_0x1955c7[_0x819d('0x28')],_0x5d2efa['filters']),_0x4197b8);if(_0x1955c7[_0x819d('0x28')][_0x819d('0x34')]){_0x500019[_0x819d('0x32')]=_[_0x819d('0x35')](_0x500019['where'],{'$or':_[_0x819d('0x23')](_0x4197b8,function(_0x85a1ee){if(_0x85a1ee[_0x819d('0x36')]!==_0x819d('0x37')){var _0x3ae7b3={};_0x3ae7b3[_0x85a1ee[_0x819d('0x20')]]={'$like':'%'+_0x1955c7[_0x819d('0x28')][_0x819d('0x34')]+'%'};return _0x3ae7b3;}})});}_0x500019=_[_0x819d('0x35')]({},_0x500019,_0x1955c7[_0x819d('0x38')]);var _0x333c2f={'where':_0x500019[_0x819d('0x32')]};return db[_0x819d('0x24')][_0x819d('0x18')](_0x333c2f)[_0x819d('0x1d')](function(_0x4d97dc){_0x531789[_0x819d('0x18')]=_0x4d97dc;if(_0x1955c7['query']['includeAll']){_0x500019[_0x819d('0x39')]=[{'all':!![]}];}return db[_0x819d('0x24')][_0x819d('0x3a')](_0x500019);})[_0x819d('0x1d')](function(_0x3c5e1a){_0x531789[_0x819d('0x3b')]=_0x3c5e1a;return _0x531789;})[_0x819d('0x1d')](respondWithFilteredResult(_0x779536,_0x500019))['catch'](handleError(_0x779536,null));};exports[_0x819d('0x3c')]=function(_0x1b2436,_0x54176b){var _0x477baf={'raw':!![],'where':{'id':_0x1b2436[_0x819d('0x3d')]['id']}},_0x224aae={};_0x224aae[_0x819d('0x2e')]=_[_0x819d('0x29')](db[_0x819d('0x24')][_0x819d('0x25')]);_0x224aae[_0x819d('0x28')]=_[_0x819d('0x29')](_0x1b2436[_0x819d('0x28')]);_0x224aae[_0x819d('0x2a')]=_[_0x819d('0x3e')](_0x224aae['model'],_0x224aae[_0x819d('0x28')]);_0x477baf[_0x819d('0x2b')]=_['intersection'](_0x224aae[_0x819d('0x2e')],qs[_0x819d('0x2c')](_0x1b2436[_0x819d('0x28')][_0x819d('0x2c')]));_0x477baf[_0x819d('0x2b')]=_0x477baf[_0x819d('0x2b')][_0x819d('0x2d')]?_0x477baf['attributes']:_0x224aae[_0x819d('0x2e')];if(_0x1b2436[_0x819d('0x28')][_0x819d('0x3f')]){_0x477baf[_0x819d('0x39')]=[{'all':!![]}];}_0x477baf=_[_0x819d('0x35')]({},_0x477baf,_0x1b2436[_0x819d('0x38')]);return db[_0x819d('0x24')][_0x819d('0x40')](_0x477baf)[_0x819d('0x1d')](handleEntityNotFound(_0x54176b,null))[_0x819d('0x1d')](respondWithResult(_0x54176b,null))[_0x819d('0x41')](handleError(_0x54176b,null));};exports[_0x819d('0x42')]=function(_0x56a0df,_0x2a9062){return db[_0x819d('0x24')][_0x819d('0x42')](_0x56a0df[_0x819d('0x43')],{})[_0x819d('0x1d')](respondWithResult(_0x2a9062,0xc9))[_0x819d('0x41')](handleError(_0x2a9062,null));};exports[_0x819d('0x1c')]=function(_0x4d7e9b,_0x5147e3){if(_0x4d7e9b[_0x819d('0x43')]['id']){delete _0x4d7e9b['body']['id'];}return db[_0x819d('0x24')][_0x819d('0x40')]({'where':{'id':_0x4d7e9b[_0x819d('0x3d')]['id']}})[_0x819d('0x1d')](handleEntityNotFound(_0x5147e3,null))[_0x819d('0x1d')](saveUpdates(_0x4d7e9b[_0x819d('0x43')],null))[_0x819d('0x1d')](respondWithResult(_0x5147e3,null))[_0x819d('0x41')](handleError(_0x5147e3,null));};exports['destroy']=function(_0x545469,_0x2a85d4){return db[_0x819d('0x24')][_0x819d('0x40')]({'where':{'id':_0x545469['params']['id']}})['then'](handleEntityNotFound(_0x2a85d4,null))[_0x819d('0x1d')](removeEntity(_0x2a85d4,null))[_0x819d('0x41')](handleError(_0x2a85d4,null));};exports[_0x819d('0x44')]=function(_0x31779e,_0x57266f){return db[_0x819d('0x24')]['describe']()[_0x819d('0x1d')](respondWithResult(_0x57266f,null))[_0x819d('0x41')](handleError(_0x57266f,null));};exports[_0x819d('0x45')]=function(_0x5e6fba,_0x188da1,_0x332e9c){var _0x194cf6={'raw':!![],'where':{}};var _0x3007aa={};var _0x10131b={'count':0x0,'rows':[]};return db[_0x819d('0x24')][_0x819d('0x46')]({'where':{'id':_0x5e6fba[_0x819d('0x3d')]['id']}})[_0x819d('0x1d')](handleEntityNotFound(_0x188da1,null))[_0x819d('0x1d')](function(_0x2eb890){if(_0x2eb890){_0x3007aa['model']=_['keys'](db[_0x819d('0x47')][_0x819d('0x25')]);_0x3007aa['query']=_['keys'](_0x5e6fba[_0x819d('0x28')]);_0x3007aa[_0x819d('0x2a')]=_['intersection'](_0x3007aa[_0x819d('0x2e')],_0x3007aa[_0x819d('0x28')]);_0x194cf6[_0x819d('0x2b')]=_[_0x819d('0x3e')](_0x3007aa[_0x819d('0x2e')],qs[_0x819d('0x2c')](_0x5e6fba[_0x819d('0x28')]['fields']));_0x194cf6['attributes']=_0x194cf6['attributes'][_0x819d('0x2d')]?_0x194cf6[_0x819d('0x2b')]:_0x3007aa['model'];if(!_0x5e6fba['query'][_0x819d('0x48')]('nolimit')){_0x194cf6[_0x819d('0x17')]=qs['limit'](_0x5e6fba['query']['limit']);_0x194cf6[_0x819d('0x15')]=qs['offset'](_0x5e6fba[_0x819d('0x28')]['offset']);}_0x194cf6[_0x819d('0x30')]=qs['sort'](_0x5e6fba[_0x819d('0x28')][_0x819d('0x31')]);_0x194cf6[_0x819d('0x32')]=qs[_0x819d('0x2a')](_[_0x819d('0x33')](_0x5e6fba[_0x819d('0x28')],_0x3007aa[_0x819d('0x2a')]));_0x194cf6[_0x819d('0x32')][_0x819d('0x49')]=_0x2eb890['id'];if(_0x5e6fba['query'][_0x819d('0x34')]){_0x194cf6[_0x819d('0x32')]=_['merge'](_0x194cf6[_0x819d('0x32')],{'$or':_[_0x819d('0x23')](_0x194cf6[_0x819d('0x2b')],function(_0x3d6f7c){var _0x905c5c={};_0x905c5c[_0x3d6f7c]={'$like':'%'+_0x5e6fba[_0x819d('0x28')]['filter']+'%'};return _0x905c5c;})});}_0x194cf6=_[_0x819d('0x35')]({},_0x194cf6,_0x5e6fba[_0x819d('0x38')]);return db[_0x819d('0x47')][_0x819d('0x18')]({'where':_0x194cf6[_0x819d('0x32')]})[_0x819d('0x1d')](function(_0x526a01){_0x10131b[_0x819d('0x18')]=_0x526a01;if(_0x5e6fba[_0x819d('0x28')][_0x819d('0x3f')]){_0x194cf6[_0x819d('0x39')]=[{'all':!![]}];}return db[_0x819d('0x47')][_0x819d('0x3a')](_0x194cf6);})[_0x819d('0x1d')](function(_0x326816){_0x10131b[_0x819d('0x3b')]=_0x326816;return _0x10131b;});}})[_0x819d('0x1d')](respondWithFilteredResult(_0x188da1,_0x194cf6))[_0x819d('0x41')](handleError(_0x188da1,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index dac7a36..4f9352f 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 _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x71e58f,_0x4d233b){var _0x47471a=function(_0x350bc1){while(--_0x350bc1){_0x71e58f['push'](_0x71e58f['shift']());}};_0x47471a(++_0x4d233b);}(_0x1883,0xab));var _0x3188=function(_0x140ede,_0x4abc15){_0x140ede=_0x140ede-0x0;var _0x5c316f=_0x1883[_0x140ede];return _0x5c316f;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['../../config/environment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x660b05,_0x3c7367){var _0x2ce2ae=function(_0x1cde19){while(--_0x1cde19){_0x660b05['push'](_0x660b05['shift']());}};_0x2ce2ae(++_0x3c7367);}(_0x6050,0x196));var _0x0605=function(_0x230278,_0x12be9d){_0x230278=_0x230278-0x0;var _0x292d3b=_0x6050[_0x230278];return _0x292d3b;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0605('0x6'));var rimraf=require(_0x0605('0x7'));var config=require(_0x0605('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x4aca21,_0xd78d96){return _0x4aca21['define']('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','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 0884055..bcf7a43 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(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0x524e,0x15e));var _0xe524=function(_0x464d51,_0x59329c){_0x464d51=_0x464d51-0x0;var _0x20126e=_0x524e[_0x464d51];return _0x20126e;};'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 _0x4745=['debug','JscriptySessionReport,\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','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent'];(function(_0x7a56f9,_0x5147a2){var _0x140c3a=function(_0x3f91cc){while(--_0x3f91cc){_0x7a56f9['push'](_0x7a56f9['shift']());}};_0x140c3a(++_0x5147a2);}(_0x4745,0x1e7));var _0x5474=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x4745[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('JscriptySessionReport,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 01b2399..0bec34f 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 _0x5c60=['./license.controller','get','isAuthenticated','/download_log_file','downloadLogFile','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0x5c60,0x19c));var _0x05c6=function(_0x5ed886,_0x4cbe13){_0x5ed886=_0x5ed886-0x0;var _0x25a29f=_0x5c60[_0x5ed886];return _0x25a29f;};'use strict';var multer=require('multer');var util=require(_0x05c6('0x0'));var path=require(_0x05c6('0x1'));var timeout=require(_0x05c6('0x2'));var express=require(_0x05c6('0x3'));var router=express[_0x05c6('0x4')]();var fs_extra=require(_0x05c6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x05c6('0x6'));var config=require(_0x05c6('0x7'));var controller=require(_0x05c6('0x8'));router[_0x05c6('0x9')]('/',controller['index']);router['put']('/:id',auth[_0x05c6('0xa')](),controller['update']);router[_0x05c6('0x9')](_0x05c6('0xb'),auth[_0x05c6('0xa')](),controller[_0x05c6('0xc')]);module[_0x05c6('0xd')]=router; \ No newline at end of file +var _0x5d46=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','put','update','/download_log_file','isAuthenticated','exports','multer','util'];(function(_0x182aa3,_0x55cb6c){var _0x4bd366=function(_0x200578){while(--_0x200578){_0x182aa3['push'](_0x182aa3['shift']());}};_0x4bd366(++_0x55cb6c);}(_0x5d46,0x10e));var _0x65d4=function(_0x2a4a9a,_0x4835a9){_0x2a4a9a=_0x2a4a9a-0x0;var _0x4336bd=_0x5d46[_0x2a4a9a];return _0x4336bd;};'use strict';var multer=require(_0x65d4('0x0'));var util=require(_0x65d4('0x1'));var path=require(_0x65d4('0x2'));var timeout=require(_0x65d4('0x3'));var express=require(_0x65d4('0x4'));var router=express[_0x65d4('0x5')]();var fs_extra=require(_0x65d4('0x6'));var auth=require(_0x65d4('0x7'));var interaction=require(_0x65d4('0x8'));var config=require(_0x65d4('0x9'));var controller=require('./license.controller');router[_0x65d4('0xa')]('/',controller['index']);router[_0x65d4('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x65d4('0xc')]);router[_0x65d4('0xa')](_0x65d4('0xd'),auth[_0x65d4('0xe')](),controller['downloadLogFile']);module[_0x65d4('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 6a9ec92..89a3b34 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 _0x2744=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0x2744,0x175));var _0x4274=function(_0x22cb0e,_0x190ba9){_0x22cb0e=_0x22cb0e-0x0;var _0x10b1ed=_0x2744[_0x22cb0e];return _0x10b1ed;};'use strict';var Sequelize=require(_0x4274('0x0'));module[_0x4274('0x1')]={'license':{'type':Sequelize[_0x4274('0x2')]},'data1':{'type':Sequelize[_0x4274('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x4274('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x612f=['STRING','INTEGER','exports','TEXT'];(function(_0x482b94,_0x29ad8e){var _0x579e3c=function(_0x4895e7){while(--_0x4895e7){_0x482b94['push'](_0x482b94['shift']());}};_0x579e3c(++_0x29ad8e);}(_0x612f,0x102));var _0xf612=function(_0x5ef582,_0x112f82){_0x5ef582=_0x5ef582-0x0;var _0x50baf7=_0x612f[_0x5ef582];return _0x50baf7;};'use strict';var Sequelize=require('sequelize');module[_0xf612('0x0')]={'license':{'type':Sequelize[_0xf612('0x1')]},'data1':{'type':Sequelize[_0xf612('0x2')]},'data2':{'type':Sequelize[_0xf612('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xf612('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5f2babc..ccdd3de 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 _0x17c8=['sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','getLicense','body','find','key','demo','catch','license-info.log','join','/var','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x56df4b,_0x4f70db){var _0x42100a=function(_0x14e72){while(--_0x14e72){_0x56df4b['push'](_0x56df4b['shift']());}};_0x42100a(++_0x4f70db);}(_0x17c8,0x12e));var _0x817c=function(_0x5e0758,_0x5d2e35){_0x5e0758=_0x5e0758-0x0;var _0xfc2326=_0x17c8[_0x5e0758];return _0xfc2326;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x817c('0x0'));var zipdir=require(_0x817c('0x1'));var jsonpatch=require(_0x817c('0x2'));var rp=require(_0x817c('0x3'));var moment=require(_0x817c('0x4'));var BPromise=require(_0x817c('0x5'));var Mustache=require('mustache');var util=require(_0x817c('0x6'));var path=require(_0x817c('0x7'));var sox=require('sox');var csv=require(_0x817c('0x8'));var ejs=require(_0x817c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x817c('0xa'));var squel=require(_0x817c('0xb'));var crypto=require(_0x817c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x817c('0x8'));var querystring=require(_0x817c('0xd'));var Papa=require('papaparse');var Redis=require(_0x817c('0xe'));var authService=require(_0x817c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x817c('0x10'));var hardwareService=require(_0x817c('0x11'));var logger=require(_0x817c('0x12'))(_0x817c('0x13'));var utils=require(_0x817c('0x14'));var config=require(_0x817c('0x15'));var licenseUtil=require(_0x817c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2240f5,_0x223291){_0x223291=_0x223291||0xcc;return function(_0x8df7d8){if(_0x8df7d8){return _0x2240f5[_0x817c('0x17')](_0x223291);}return _0x2240f5[_0x817c('0x18')](_0x223291)[_0x817c('0x19')]();};}function respondWithResult(_0x16bc08,_0x3e513a){_0x3e513a=_0x3e513a||0xc8;return function(_0x380ca0){if(_0x380ca0){return _0x16bc08[_0x817c('0x18')](_0x3e513a)['json'](_0x380ca0);}};}function respondWithFilteredResult(_0x43c3f4,_0x355f91){return function(_0xdc6863){if(_0xdc6863){var _0xc94bff=typeof _0x355f91[_0x817c('0x1a')]===_0x817c('0x1b')&&typeof _0x355f91['limit']===_0x817c('0x1b');var _0x32d639=_0xdc6863[_0x817c('0x1c')];var _0x1a2353=_0xc94bff?0x0:_0x355f91[_0x817c('0x1a')];var _0x54fbbc=_0xc94bff?_0xdc6863[_0x817c('0x1c')]:_0x355f91['offset']+_0x355f91[_0x817c('0x1d')];var _0x35cfa4;if(_0x54fbbc>=_0x32d639){_0x54fbbc=_0x32d639;_0x35cfa4=0xc8;}else{_0x35cfa4=0xce;}_0x43c3f4[_0x817c('0x18')](_0x35cfa4);return _0x43c3f4[_0x817c('0x1e')](_0x817c('0x1f'),_0x1a2353+'-'+_0x54fbbc+'/'+_0x32d639)['json'](_0xdc6863);}return null;};}function patchUpdates(_0x5ae9af){return function(_0x45eb0b){try{jsonpatch[_0x817c('0x20')](_0x45eb0b,_0x5ae9af,!![]);}catch(_0xb21195){return BPromise[_0x817c('0x21')](_0xb21195);}return _0x45eb0b[_0x817c('0x22')]();};}function saveUpdates(_0x48d9fb,_0x1b1493){return function(_0x5c1d0d){if(_0x5c1d0d){return _0x5c1d0d[_0x817c('0x23')](_0x48d9fb)[_0x817c('0x24')](function(_0x4b1a67){return _0x4b1a67;});}return null;};}function removeEntity(_0x2c4001,_0x4c2a38){return function(_0x6edeeb){if(_0x6edeeb){return _0x6edeeb[_0x817c('0x25')]()['then'](function(){_0x2c4001[_0x817c('0x18')](0xcc)[_0x817c('0x19')]();});}};}function handleEntityNotFound(_0x44276d,_0x47f3a2){return function(_0x3be0fd){if(!_0x3be0fd){_0x44276d[_0x817c('0x17')](0x194);}return _0x3be0fd;};}function handleError(_0x44e319,_0x5cde2c){_0x5cde2c=_0x5cde2c||0x1f4;return function(_0x522ef9){logger[_0x817c('0x26')](_0x522ef9[_0x817c('0x27')]);if(_0x522ef9[_0x817c('0x28')]){delete _0x522ef9[_0x817c('0x28')];}_0x44e319[_0x817c('0x18')](_0x5cde2c)[_0x817c('0x29')](_0x522ef9);};}var utilLicense=require(_0x817c('0x16'));exports[_0x817c('0x2a')]=function(_0x30560d,_0x4ed891){var _0x1da6e9={'raw':!![],'where':{'id':0x1}},_0x4f0cd5={};_0x4f0cd5[_0x817c('0x2b')]=_[_0x817c('0x2c')](db[_0x817c('0x2d')]['rawAttributes']);_0x4f0cd5[_0x817c('0x2e')]=_[_0x817c('0x2c')](_0x30560d[_0x817c('0x2e')]);_0x4f0cd5[_0x817c('0x2f')]=_[_0x817c('0x30')](_0x4f0cd5[_0x817c('0x2b')],_0x4f0cd5[_0x817c('0x2e')]);_0x1da6e9[_0x817c('0x31')]=_['intersection'](_0x4f0cd5[_0x817c('0x2b')],qs[_0x817c('0x32')](_0x30560d[_0x817c('0x2e')]['fields']));_0x1da6e9[_0x817c('0x31')]=_0x1da6e9[_0x817c('0x31')]['length']?_0x1da6e9['attributes']:_0x4f0cd5[_0x817c('0x2b')];_0x1da6e9=_['merge']({},_0x1da6e9,_0x30560d['options']);return utilLicense[_0x817c('0x33')](_0x1da6e9)['then'](respondWithResult(_0x4ed891,null))['catch'](handleError(_0x4ed891,null));};exports[_0x817c('0x23')]=function(_0x4c38a5,_0x473621){if(_0x4c38a5[_0x817c('0x34')]['id']){delete _0x4c38a5[_0x817c('0x34')]['id'];}return db[_0x817c('0x2d')][_0x817c('0x35')]({'where':{'id':_0x4c38a5['params']['id']}})[_0x817c('0x24')](handleEntityNotFound(_0x473621,null))[_0x817c('0x24')](function(_0x1f177d){var _0x2a9944=_0x1f177d['get']({'plain':!![]});return utilLicense['checkLicense'](_0x2a9944,_0x4c38a5['body'][_0x817c('0x36')]);})['then'](function(_0xe9f390){if(!_0xe9f390[_0x817c('0x37')]){return saveUpdates(_0x4c38a5[_0x817c('0x34')],null);}return _0xe9f390;})['then'](respondWithResult(_0x473621,null))[_0x817c('0x38')](handleError(_0x473621,null));};exports['downloadLogFile']=function(_0x48d7b5,_0x39f1a9){var _0x4f5a63=_0x817c('0x39');var _0x284b62=path[_0x817c('0x3a')](_0x817c('0x3b'),'log','xcally',_0x4f5a63);_0x39f1a9['setHeader'](_0x817c('0x3c'),_0x817c('0x3d')+_0x4f5a63);_0x39f1a9[_0x817c('0x1e')](_0x817c('0x3e'),_0x817c('0x3f'));_0x39f1a9[_0x817c('0x40')](_0x284b62);}; \ No newline at end of file +var _0xd95c=['then','destroy','stack','name','index','keys','License','query','filters','intersection','attributes','model','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','demo','downloadLogFile','/var','xcally','setHeader','attachment;\x20filename=','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range','json','apply','reject','save','update'];(function(_0x99a78,_0x57103e){var _0x5e7ee5=function(_0x489a62){while(--_0x489a62){_0x99a78['push'](_0x99a78['shift']());}};_0x5e7ee5(++_0x57103e);}(_0xd95c,0x159));var _0xcd95=function(_0x2681a4,_0x242db0){_0x2681a4=_0x2681a4-0x0;var _0x48b29a=_0xd95c[_0x2681a4];return _0x48b29a;};'use strict';var emlformat=require(_0xcd95('0x0'));var rimraf=require(_0xcd95('0x1'));var zipdir=require(_0xcd95('0x2'));var jsonpatch=require(_0xcd95('0x3'));var rp=require(_0xcd95('0x4'));var moment=require(_0xcd95('0x5'));var BPromise=require(_0xcd95('0x6'));var Mustache=require(_0xcd95('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcd95('0x8'));var ejs=require(_0xcd95('0x9'));var fs=require('fs');var fs_extra=require(_0xcd95('0xa'));var _=require(_0xcd95('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcd95('0xc'));var deskjs=require(_0xcd95('0xd'));var toCsv=require(_0xcd95('0x8'));var querystring=require(_0xcd95('0xe'));var Papa=require(_0xcd95('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd95('0x10'));var as=require(_0xcd95('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcd95('0x12'));var config=require(_0xcd95('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd95('0x14'))['db'];function respondWithStatusCode(_0x8431bd,_0x45c300){_0x45c300=_0x45c300||0xcc;return function(_0x23cb48){if(_0x23cb48){return _0x8431bd[_0xcd95('0x15')](_0x45c300);}return _0x8431bd[_0xcd95('0x16')](_0x45c300)[_0xcd95('0x17')]();};}function respondWithResult(_0x5ebd53,_0x4471cb){_0x4471cb=_0x4471cb||0xc8;return function(_0x442ff1){if(_0x442ff1){return _0x5ebd53['status'](_0x4471cb)['json'](_0x442ff1);}};}function respondWithFilteredResult(_0x50437f,_0x325ca2){return function(_0x3c694e){if(_0x3c694e){var _0xb83b36=typeof _0x325ca2[_0xcd95('0x18')]===_0xcd95('0x19')&&typeof _0x325ca2['limit']===_0xcd95('0x19');var _0xcc076=_0x3c694e['count'];var _0x20f8c3=_0xb83b36?0x0:_0x325ca2[_0xcd95('0x18')];var _0x5d7361=_0xb83b36?_0x3c694e['count']:_0x325ca2[_0xcd95('0x18')]+_0x325ca2['limit'];var _0x39e1fc;if(_0x5d7361>=_0xcc076){_0x5d7361=_0xcc076;_0x39e1fc=0xc8;}else{_0x39e1fc=0xce;}_0x50437f[_0xcd95('0x16')](_0x39e1fc);return _0x50437f[_0xcd95('0x1a')](_0xcd95('0x1b'),_0x20f8c3+'-'+_0x5d7361+'/'+_0xcc076)[_0xcd95('0x1c')](_0x3c694e);}return null;};}function patchUpdates(_0x37090a){return function(_0x5eb5eb){try{jsonpatch[_0xcd95('0x1d')](_0x5eb5eb,_0x37090a,!![]);}catch(_0x5c55d2){return BPromise[_0xcd95('0x1e')](_0x5c55d2);}return _0x5eb5eb[_0xcd95('0x1f')]();};}function saveUpdates(_0x5b12fa,_0x4c3af6){return function(_0x495382){if(_0x495382){return _0x495382[_0xcd95('0x20')](_0x5b12fa)[_0xcd95('0x21')](function(_0x1c6779){return _0x1c6779;});}return null;};}function removeEntity(_0x259334,_0x343077){return function(_0x3e05b7){if(_0x3e05b7){return _0x3e05b7[_0xcd95('0x22')]()['then'](function(){_0x259334[_0xcd95('0x16')](0xcc)[_0xcd95('0x17')]();});}};}function handleEntityNotFound(_0x2955da,_0x29191b){return function(_0x24bf4f){if(!_0x24bf4f){_0x2955da[_0xcd95('0x15')](0x194);}return _0x24bf4f;};}function handleError(_0x3710cd,_0x1a9e28){_0x1a9e28=_0x1a9e28||0x1f4;return function(_0x5f7ef7){logger['error'](_0x5f7ef7[_0xcd95('0x23')]);if(_0x5f7ef7[_0xcd95('0x24')]){delete _0x5f7ef7[_0xcd95('0x24')];}_0x3710cd[_0xcd95('0x16')](_0x1a9e28)['send'](_0x5f7ef7);};}var utilLicense=require('../../config/license/util');exports[_0xcd95('0x25')]=function(_0x3fdca8,_0x4d4e13){var _0x31c05e={'raw':!![],'where':{'id':0x1}},_0x11b429={};_0x11b429['model']=_[_0xcd95('0x26')](db[_0xcd95('0x27')]['rawAttributes']);_0x11b429['query']=_['keys'](_0x3fdca8[_0xcd95('0x28')]);_0x11b429[_0xcd95('0x29')]=_[_0xcd95('0x2a')](_0x11b429['model'],_0x11b429[_0xcd95('0x28')]);_0x31c05e[_0xcd95('0x2b')]=_[_0xcd95('0x2a')](_0x11b429[_0xcd95('0x2c')],qs['fields'](_0x3fdca8['query'][_0xcd95('0x2d')]));_0x31c05e['attributes']=_0x31c05e[_0xcd95('0x2b')][_0xcd95('0x2e')]?_0x31c05e[_0xcd95('0x2b')]:_0x11b429[_0xcd95('0x2c')];_0x31c05e=_[_0xcd95('0x2f')]({},_0x31c05e,_0x3fdca8[_0xcd95('0x30')]);return utilLicense[_0xcd95('0x31')](_0x31c05e)[_0xcd95('0x21')](respondWithResult(_0x4d4e13,null))[_0xcd95('0x32')](handleError(_0x4d4e13,null));};exports['update']=function(_0x1bd5c7,_0x3ff5f0){if(_0x1bd5c7['body']['id']){delete _0x1bd5c7[_0xcd95('0x33')]['id'];}return db[_0xcd95('0x27')][_0xcd95('0x34')]({'where':{'id':_0x1bd5c7['params']['id']}})[_0xcd95('0x21')](handleEntityNotFound(_0x3ff5f0,null))[_0xcd95('0x21')](function(_0x274ff9){var _0x1a0a15=_0x274ff9[_0xcd95('0x35')]({'plain':!![]});return utilLicense[_0xcd95('0x36')](_0x1a0a15,_0x1bd5c7[_0xcd95('0x33')][_0xcd95('0x37')]);})[_0xcd95('0x21')](function(_0x31efdd){if(!_0x31efdd[_0xcd95('0x38')]){return saveUpdates(_0x1bd5c7[_0xcd95('0x33')],null);}return _0x31efdd;})[_0xcd95('0x21')](respondWithResult(_0x3ff5f0,null))[_0xcd95('0x32')](handleError(_0x3ff5f0,null));};exports[_0xcd95('0x39')]=function(_0xc0b06c,_0x4157f9){var _0x359d1b='license-info.log';var _0x3e2956=path['join'](_0xcd95('0x3a'),'log',_0xcd95('0x3b'),_0x359d1b);_0x4157f9[_0xcd95('0x3c')]('Content-disposition',_0xcd95('0x3d')+_0x359d1b);_0x4157f9[_0xcd95('0x1a')]('Content-Type','text/plain');_0x4157f9[_0xcd95('0x3e')](_0x3e2956);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 87ee230..732ffe0 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 _0x12c8=['./license.attributes','exports','License','license','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x100b9c,_0x118bf2){var _0x446a40=function(_0x159cca){while(--_0x159cca){_0x100b9c['push'](_0x100b9c['shift']());}};_0x446a40(++_0x118bf2);}(_0x12c8,0x1d0));var _0x812c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12c8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x812c('0x0'))(_0x812c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x812c('0x2'));var fs=require('fs');var path=require(_0x812c('0x3'));var rimraf=require(_0x812c('0x4'));var config=require(_0x812c('0x5'));var attributes=require(_0x812c('0x6'));module[_0x812c('0x7')]=function(_0x4187b8,_0x5c27e4){return _0x4187b8['define'](_0x812c('0x8'),attributes,{'tableName':_0x812c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5cf7=['rimraf','../../config/environment','define','License','license','util','../../config/logger','api','moment','bluebird'];(function(_0x3b882d,_0x3eb36d){var _0x99002b=function(_0x3c13fe){while(--_0x3c13fe){_0x3b882d['push'](_0x3b882d['shift']());}};_0x99002b(++_0x3eb36d);}(_0x5cf7,0x87));var _0x75cf=function(_0x5554d8,_0x35af75){_0x5554d8=_0x5554d8-0x0;var _0x311575=_0x5cf7[_0x5554d8];return _0x311575;};'use strict';var _=require('lodash');var util=require(_0x75cf('0x0'));var logger=require(_0x75cf('0x1'))(_0x75cf('0x2'));var moment=require(_0x75cf('0x3'));var BPromise=require(_0x75cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x75cf('0x5'));var config=require(_0x75cf('0x6'));var attributes=require('./license.attributes');module['exports']=function(_0x48b63d,_0x5ab266){return _0x48b63d[_0x75cf('0x7')](_0x75cf('0x8'),attributes,{'tableName':_0x75cf('0x9'),'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 1bdf890..ece42d9 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 _0xe4a8=['stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s'];(function(_0x5d6efd,_0x168419){var _0x34fb11=function(_0x38de32){while(--_0x38de32){_0x5d6efd['push'](_0x5d6efd['shift']());}};_0x34fb11(++_0x168419);}(_0xe4a8,0x1d5));var _0x8e4a=function(_0x237f8b,_0xc5eddb){_0x237f8b=_0x237f8b-0x0;var _0x423f94=_0xe4a8[_0x237f8b];return _0x423f94;};'use strict';var _=require(_0x8e4a('0x0'));var util=require(_0x8e4a('0x1'));var moment=require('moment');var BPromise=require(_0x8e4a('0x2'));var rs=require(_0x8e4a('0x3'));var fs=require('fs');var Redis=require(_0x8e4a('0x4'));var db=require(_0x8e4a('0x5'))['db'];var utils=require(_0x8e4a('0x6'));var logger=require('../../config/logger')(_0x8e4a('0x7'));var config=require(_0x8e4a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49066c,_0x21fe75,_0x175754){return new BPromise(function(_0x268176,_0x3aca82){return client['request'](_0x49066c,_0x175754)[_0x8e4a('0x9')](function(_0x2a55ea){logger[_0x8e4a('0xa')]('License,\x20%s,\x20%s',_0x21fe75,_0x8e4a('0xb'));logger[_0x8e4a('0xc')](_0x8e4a('0xd'),_0x21fe75,_0x8e4a('0xb'),JSON[_0x8e4a('0xe')](_0x2a55ea));if(_0x2a55ea['error']){if(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x10')]===0x1f4){logger[_0x8e4a('0xf')](_0x8e4a('0x11'),_0x21fe75,_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);return _0x3aca82(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);}logger[_0x8e4a('0xf')]('License,\x20%s,\x20%s',_0x21fe75,_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);return _0x268176(_0x2a55ea[_0x8e4a('0xf')][_0x8e4a('0x12')]);}else{logger['info']('License,\x20%s,\x20%s',_0x21fe75,_0x8e4a('0xb'));_0x268176(_0x2a55ea[_0x8e4a('0x13')][_0x8e4a('0x12')]);}})[_0x8e4a('0x14')](function(_0x3fe67d){logger[_0x8e4a('0xf')](_0x8e4a('0x11'),_0x21fe75,_0x3fe67d);_0x3aca82(_0x3fe67d);});});} \ No newline at end of file +var _0x617a=['info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x617a,0x93));var _0xa617=function(_0x2a3f7a,_0x43ebfe){_0x2a3f7a=_0x2a3f7a-0x0;var _0x487795=_0x617a[_0x2a3f7a];return _0x487795;};'use strict';var _=require(_0xa617('0x0'));var util=require(_0xa617('0x1'));var moment=require(_0xa617('0x2'));var BPromise=require(_0xa617('0x3'));var rs=require(_0xa617('0x4'));var fs=require('fs');var Redis=require(_0xa617('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa617('0x6'));var logger=require(_0xa617('0x7'))(_0xa617('0x8'));var config=require(_0xa617('0x9'));var jayson=require(_0xa617('0xa'));var client=jayson['client'][_0xa617('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12d967,_0x3f9a7e,_0x307aaf){return new BPromise(function(_0x1b15fe,_0x1436a4){return client['request'](_0x12d967,_0x307aaf)[_0xa617('0xc')](function(_0x1bbda6){logger['info'](_0xa617('0xd'),_0x3f9a7e,_0xa617('0xe'));logger[_0xa617('0xf')](_0xa617('0x10'),_0x3f9a7e,_0xa617('0xe'),JSON[_0xa617('0x11')](_0x1bbda6));if(_0x1bbda6[_0xa617('0x12')]){if(_0x1bbda6['error'][_0xa617('0x13')]===0x1f4){logger[_0xa617('0x12')](_0xa617('0xd'),_0x3f9a7e,_0x1bbda6[_0xa617('0x12')][_0xa617('0x14')]);return _0x1436a4(_0x1bbda6[_0xa617('0x12')]['message']);}logger[_0xa617('0x12')]('License,\x20%s,\x20%s',_0x3f9a7e,_0x1bbda6[_0xa617('0x12')][_0xa617('0x14')]);return _0x1b15fe(_0x1bbda6[_0xa617('0x12')][_0xa617('0x14')]);}else{logger[_0xa617('0x15')](_0xa617('0xd'),_0x3f9a7e,_0xa617('0xe'));_0x1b15fe(_0x1bbda6[_0xa617('0x16')]['message']);}})[_0xa617('0x17')](function(_0xf55dab){logger['error']('License,\x20%s,\x20%s',_0x3f9a7e,_0xf55dab);_0x1436a4(_0xf55dab);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index f96f280..18960b6 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 _0x7b34=['/:id/messages','verifySmtp','getAgents','addDisposition','post','addAnswer','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','update','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications'];(function(_0xd550da,_0x35f59c){var _0x553963=function(_0x1d857a){while(--_0x1d857a){_0xd550da['push'](_0xd550da['shift']());}};_0x553963(++_0x35f59c);}(_0x7b34,0x154));var _0x47b3=function(_0x33411e,_0x2ca6ae){_0x33411e=_0x33411e-0x0;var _0x27089c=_0x7b34[_0x33411e];return _0x27089c;};'use strict';var multer=require(_0x47b3('0x0'));var util=require(_0x47b3('0x1'));var path=require(_0x47b3('0x2'));var timeout=require(_0x47b3('0x3'));var express=require('express');var router=express[_0x47b3('0x4')]();var fs_extra=require(_0x47b3('0x5'));var auth=require(_0x47b3('0x6'));var interaction=require(_0x47b3('0x7'));var config=require(_0x47b3('0x8'));var controller=require(_0x47b3('0x9'));router['get']('/',auth[_0x47b3('0xa')](),controller[_0x47b3('0xb')]);router[_0x47b3('0xc')](_0x47b3('0xd'),auth['isAuthenticated'](),controller[_0x47b3('0xe')]);router[_0x47b3('0xc')](_0x47b3('0xf'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x10')]);router[_0x47b3('0xc')](_0x47b3('0x11'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x12')]);router[_0x47b3('0xc')](_0x47b3('0x13'),auth[_0x47b3('0xa')](),controller['getAnswers']);router['get'](_0x47b3('0x14'),auth['isAuthenticated'](),controller[_0x47b3('0x15')]);router['get'](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x17')]);router['get'](_0x47b3('0x18'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x19')]);router[_0x47b3('0xc')](_0x47b3('0x1a'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x1b')]);router[_0x47b3('0xc')](_0x47b3('0x1c'),auth[_0x47b3('0xa')](),controller['getMessages']);router[_0x47b3('0xc')]('/:id/verify',auth[_0x47b3('0xa')](),controller[_0x47b3('0x1d')]);router[_0x47b3('0xc')]('/:id/users',auth[_0x47b3('0xa')](),controller[_0x47b3('0x1e')]);router['post'](_0x47b3('0x11'),auth['isAuthenticated'](),controller[_0x47b3('0x1f')]);router[_0x47b3('0x20')]('/:id/canned_answers',auth[_0x47b3('0xa')](),controller[_0x47b3('0x21')]);router[_0x47b3('0x20')]('/',auth[_0x47b3('0xa')](),controller['create']);router['post']('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x47b3('0x20')](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x22')]);router[_0x47b3('0x20')](_0x47b3('0x18'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x23')]);router[_0x47b3('0x20')](_0x47b3('0x1a'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x24')]);router[_0x47b3('0x20')]('/:id/send',auth[_0x47b3('0xa')](),controller[_0x47b3('0x25')]);router['post'](_0x47b3('0x26'),auth['isAuthenticated'](),controller[_0x47b3('0x27')]);router['put'](_0x47b3('0xf'),auth['isAuthenticated'](),controller[_0x47b3('0x28')]);router[_0x47b3('0x29')](_0x47b3('0x11'),auth[_0x47b3('0xa')](),controller['removeDispositions']);router['delete'](_0x47b3('0x13'),auth[_0x47b3('0xa')](),controller['removeAnswers']);router['delete'](_0x47b3('0x14'),auth[_0x47b3('0xa')](),controller['removeImap']);router[_0x47b3('0x29')](_0x47b3('0x16'),auth[_0x47b3('0xa')](),controller[_0x47b3('0x2a')]);router[_0x47b3('0x29')](_0x47b3('0xf'),auth['isAuthenticated'](),controller[_0x47b3('0x2b')]);router[_0x47b3('0x29')]('/:id/users',auth[_0x47b3('0xa')](),controller[_0x47b3('0x2c')]);module[_0x47b3('0x2d')]=router; \ No newline at end of file +var _0x4c46=['getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','getAgents','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','create','addImap','addSmtp','addApplications','addAgents','delete','removeDispositions','removeAnswers','removeImap','/:id','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers'];(function(_0x4d2ed7,_0x1999e5){var _0x12af27=function(_0x28e2d4){while(--_0x28e2d4){_0x4d2ed7['push'](_0x4d2ed7['shift']());}};_0x12af27(++_0x1999e5);}(_0x4c46,0x117));var _0x64c4=function(_0xb2584f,_0x39e36e){_0xb2584f=_0xb2584f-0x0;var _0x4588c4=_0x4c46[_0xb2584f];return _0x4588c4;};'use strict';var multer=require(_0x64c4('0x0'));var util=require(_0x64c4('0x1'));var path=require(_0x64c4('0x2'));var timeout=require('connect-timeout');var express=require(_0x64c4('0x3'));var router=express[_0x64c4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x64c4('0x5'));var interaction=require(_0x64c4('0x6'));var config=require(_0x64c4('0x7'));var controller=require('./mailAccount.controller');router[_0x64c4('0x8')]('/',auth[_0x64c4('0x9')](),controller['index']);router[_0x64c4('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x64c4('0x8')]('/:id',auth[_0x64c4('0x9')](),controller['show']);router[_0x64c4('0x8')]('/:id/dispositions',auth[_0x64c4('0x9')](),controller[_0x64c4('0xa')]);router[_0x64c4('0x8')]('/:id/canned_answers',auth[_0x64c4('0x9')](),controller[_0x64c4('0xb')]);router[_0x64c4('0x8')](_0x64c4('0xc'),auth['isAuthenticated'](),controller[_0x64c4('0xd')]);router[_0x64c4('0x8')](_0x64c4('0xe'),auth[_0x64c4('0x9')](),controller[_0x64c4('0xf')]);router[_0x64c4('0x8')](_0x64c4('0x10'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x11')]);router['get'](_0x64c4('0x12'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x13')]);router[_0x64c4('0x8')](_0x64c4('0x14'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x15')]);router[_0x64c4('0x8')]('/:id/verify',auth[_0x64c4('0x9')](),controller['verifySmtp']);router[_0x64c4('0x8')](_0x64c4('0x16'),auth['isAuthenticated'](),controller[_0x64c4('0x17')]);router['post'](_0x64c4('0x18'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x19')]);router[_0x64c4('0x1a')](_0x64c4('0x1b'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x1c')]);router[_0x64c4('0x1a')]('/',auth[_0x64c4('0x9')](),controller[_0x64c4('0x1d')]);router[_0x64c4('0x1a')]('/:id/in_servers',auth[_0x64c4('0x9')](),controller[_0x64c4('0x1e')]);router['post']('/:id/out_servers',auth[_0x64c4('0x9')](),controller[_0x64c4('0x1f')]);router['post'](_0x64c4('0x10'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x64c4('0x1a')](_0x64c4('0x12'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x20')]);router[_0x64c4('0x1a')]('/:id/send',auth[_0x64c4('0x9')](),controller['send']);router[_0x64c4('0x1a')](_0x64c4('0x16'),auth['isAuthenticated'](),controller[_0x64c4('0x21')]);router['put']('/:id',auth[_0x64c4('0x9')](),controller['update']);router[_0x64c4('0x22')](_0x64c4('0x18'),auth[_0x64c4('0x9')](),controller[_0x64c4('0x23')]);router[_0x64c4('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x64c4('0x24')]);router[_0x64c4('0x22')](_0x64c4('0xc'),auth['isAuthenticated'](),controller[_0x64c4('0x25')]);router[_0x64c4('0x22')]('/:id/out_servers',auth[_0x64c4('0x9')](),controller['removeSmtp']);router[_0x64c4('0x22')](_0x64c4('0x26'),auth['isAuthenticated'](),controller[_0x64c4('0x27')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x64c4('0x28')]);module[_0x64c4('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index e49cf09..7bfdffc 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 _0x94e0=['mandatoryDisposition','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x94e0,0x1ac));var _0x094e=function(_0x365296,_0x4a8e50){_0x365296=_0x365296-0x0;var _0x205033=_0x94e0[_0x365296];return _0x205033;};'use strict';var Sequelize=require(_0x094e('0x0'));module[_0x094e('0x1')]={'description':{'type':Sequelize[_0x094e('0x2')]},'name':{'type':Sequelize[_0x094e('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x094e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x094e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x094e('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x094e('0x4')]},'markAsUnread':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x094e('0x2')],'allowNull':![],'defaultValue':_0x094e('0x5')},'fontSize':{'type':Sequelize[_0x094e('0x6')](0x2)[_0x094e('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x094e('0x4')],'defaultValue':function(){return _0x094e('0x8');}},'notificationSound':{'type':Sequelize[_0x094e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x094e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x094e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x094e('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x094e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x094e('0x3')],'defaultValue':![],'comment':_0x094e('0xa'),'set':function(_0x54adbc){if(!_0x54adbc)this[_0x094e('0xb')]('mandatoryDispositionPauseId',null);this[_0x094e('0xb')](_0x094e('0xc'),_0x54adbc);}},'provider':{'type':Sequelize[_0x094e('0xd')]('gmail',_0x094e('0xe'),_0x094e('0xf'),_0x094e('0x10')),'defaultValue':null,'get':function(){if(!this[_0x094e('0x11')](_0x094e('0x12')))return'custom';return this[_0x094e('0x11')](_0x094e('0x12'));},'set':function(_0x260e10){if(_0x260e10===_0x094e('0x13'))_0x260e10=null;return this[_0x094e('0xb')](_0x094e('0x12'),_0x260e10);}}}; \ No newline at end of file +var _0x3e68=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER'];(function(_0x2437bc,_0x23c425){var _0x2a4247=function(_0x3aaa27){while(--_0x3aaa27){_0x2437bc['push'](_0x2437bc['shift']());}};_0x2a4247(++_0x23c425);}(_0x3e68,0xca));var _0x83e6=function(_0x43bd3f,_0xd50e31){_0x43bd3f=_0x43bd3f-0x0;var _0x3bf787=_0x3e68[_0x43bd3f];return _0x3bf787;};'use strict';var Sequelize=require(_0x83e6('0x0'));module['exports']={'description':{'type':Sequelize[_0x83e6('0x1')]},'name':{'type':Sequelize[_0x83e6('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x83e6('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x83e6('0x3')]},'markAsUnread':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x83e6('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x83e6('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x83e6('0x3')],'defaultValue':function(){return _0x83e6('0x6');}},'notificationSound':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x83e6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x83e6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x83e6('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x83e6('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x83e6('0x2')],'defaultValue':![],'comment':_0x83e6('0x9'),'set':function(_0xd54948){if(!_0xd54948)this['setDataValue'](_0x83e6('0xa'),null);this[_0x83e6('0xb')](_0x83e6('0xc'),_0xd54948);}},'provider':{'type':Sequelize[_0x83e6('0xd')](_0x83e6('0xe'),_0x83e6('0xf'),_0x83e6('0x10'),_0x83e6('0x11')),'defaultValue':null,'get':function(){if(!this[_0x83e6('0x12')](_0x83e6('0x13')))return _0x83e6('0x14');return this[_0x83e6('0x12')]('provider');},'set':function(_0x27c981){if(_0x27c981===_0x83e6('0x14'))_0x27c981=null;return this[_0x83e6('0xb')](_0x83e6('0x13'),_0x27c981);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 075c2c6..e41a988 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 _0x421c=['lodash','ioredis','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','update','get','MailAccounts','destroy','end','name','gmail','yahoo','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','Unknown\x20email\x20service\x20provider','user','password','modernAuthentication','CloudProviderId','host','port','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','MailServerIn','find','body','custom','provider','params','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','nolimit','pick','MailAccountId','removeDispositions','ids','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','send','split','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','bluebird','util'];(function(_0xc29f07,_0x3eb526){var _0x18d0c0=function(_0x16675d){while(--_0x16675d){_0xc29f07['push'](_0xc29f07['shift']());}};_0x18d0c0(++_0x3eb526);}(_0x421c,0xbb));var _0xc421=function(_0x38f24d,_0x4423fa){_0x38f24d=_0x38f24d-0x0;var _0x392a87=_0x421c[_0x38f24d];return _0x392a87;};'use strict';var moment=require(_0xc421('0x0'));var BPromise=require(_0xc421('0x1'));var util=require(_0xc421('0x2'));var path=require('path');var _=require(_0xc421('0x3'));var juice=require('juice');var Redis=require(_0xc421('0x4'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc421('0x5'));var config=require(_0xc421('0x6'));var db=require(_0xc421('0x7'))['db'];config['redis']=_[_0xc421('0x8')](config[_0xc421('0x9')],{'host':_0xc421('0xa'),'port':0x18eb});var socket=require(_0xc421('0xb'))(new Redis(config[_0xc421('0x9')]));require(_0xc421('0xc'))[_0xc421('0xd')](socket);var jayson=require(_0xc421('0xe'));var client=jayson[_0xc421('0xf')][_0xc421('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x684d7c,_0x398b27,_0x9e2dbd,_0x14fbae){return new BPromise(function(_0xc4c67f,_0x97d765){var _0x245447=_0x14fbae||client;return _0x245447['request'](_0x684d7c,_0x9e2dbd)[_0xc421('0x11')](function(_0x4c9553){logger[_0xc421('0x12')]('MailAccount,\x20%s,\x20%s',_0x398b27,_0xc421('0x13'));logger[_0xc421('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x398b27,_0xc421('0x13'),JSON[_0xc421('0x15')](_0x4c9553));if(_0x4c9553[_0xc421('0x16')]){if(_0x4c9553[_0xc421('0x16')]['code']===0x1f4){logger[_0xc421('0x16')]('MailAccount,\x20%s,\x20%s',_0x398b27,_0x4c9553[_0xc421('0x16')]['message']);return _0x97d765(_0x4c9553[_0xc421('0x16')]['message']);}logger[_0xc421('0x16')](_0xc421('0x17'),_0x398b27,_0x4c9553[_0xc421('0x16')][_0xc421('0x18')]);return _0xc4c67f(_0x4c9553['error'][_0xc421('0x18')]);}else{logger[_0xc421('0x12')](_0xc421('0x17'),_0x398b27,'request\x20sent');_0xc4c67f(_0x4c9553['result'][_0xc421('0x18')]);}})[_0xc421('0x19')](function(_0xc14b52){logger['error'](_0xc421('0x17'),_0x398b27,_0xc14b52);_0x97d765(_0xc14b52);});});}function respondWithStatusCode(_0x348218,_0x466faa){_0x466faa=_0x466faa||0xcc;return function(_0xe7f7f3){if(_0xe7f7f3){return _0x348218[_0xc421('0x1a')](_0x466faa);}return _0x348218[_0xc421('0x1b')](_0x466faa)['end']();};}function respondWithResult(_0x1bfc94,_0x46057c){_0x46057c=_0x46057c||0xc8;return function(_0xa1353c){if(_0xa1353c){return _0x1bfc94[_0xc421('0x1b')](_0x46057c)[_0xc421('0x1c')](_0xa1353c);}};}function respondWithFilteredResult(_0x1a8296,_0x3fd859){return function(_0x510aa8){if(_0x510aa8){var _0x148eca=typeof _0x3fd859['offset']===_0xc421('0x1d')&&typeof _0x3fd859[_0xc421('0x1e')]===_0xc421('0x1d');var _0x1e774c=_0x510aa8['count'];var _0x3b40ac=_0x148eca?0x0:_0x3fd859[_0xc421('0x1f')];var _0x3c5428=_0x148eca?_0x510aa8[_0xc421('0x20')]:_0x3fd859['offset']+_0x3fd859[_0xc421('0x1e')];var _0x563ee5;if(_0x3c5428>=_0x1e774c){_0x3c5428=_0x1e774c;_0x563ee5=0xc8;}else{_0x563ee5=0xce;}_0x1a8296[_0xc421('0x1b')](_0x563ee5);return _0x1a8296[_0xc421('0x21')](_0xc421('0x22'),_0x3b40ac+'-'+_0x3c5428+'/'+_0x1e774c)[_0xc421('0x1c')](_0x510aa8);}return null;};}function saveUpdates(_0x5bbf0){return function(_0x4471ad){if(_0x4471ad){return _0x4471ad[_0xc421('0x23')](_0x5bbf0)[_0xc421('0x11')](function(_0x2fdd7b){return _0x2fdd7b;});}return null;};}function removeEntity(_0x35585e){return function(_0x452512){if(_0x452512){return _0x452512['destroy']()[_0xc421('0x11')](function(){var _0x5d8c36=_0x452512[_0xc421('0x24')]({'plain':!![]});var _0x55f498=_0xc421('0x25');return db['UserProfileResource'][_0xc421('0x26')]({'where':{'type':_0x55f498,'resourceId':_0x5d8c36['id']}})[_0xc421('0x11')](function(){return _0x452512;});})[_0xc421('0x11')](function(){_0x35585e['status'](0xcc)[_0xc421('0x27')]();});}};}function handleEntityNotFound(_0x3d8c96){return function(_0x1287b7){if(!_0x1287b7){_0x3d8c96[_0xc421('0x1a')](0x194);}return _0x1287b7;};}function handleError(_0x1cfeeb,_0xbf9eb2){_0xbf9eb2=_0xbf9eb2||0x1f4;return function(_0x31f83c){logger[_0xc421('0x16')](_0x31f83c['stack']);if(_0x31f83c['name']){delete _0x31f83c[_0xc421('0x28')];}_0x1cfeeb['status'](_0xbf9eb2)['send'](_0x31f83c);};}function getImapHost(_0x219aab){switch(_0x219aab){case _0xc421('0x29'):return'imap.gmail.com';case _0xc421('0x2a'):return'imap.mail.yahoo.com';case _0xc421('0x2b'):return _0xc421('0x2c');case _0xc421('0x2d'):return _0xc421('0x2e');}throw new Error('Unknown\x20email\x20service\x20provider',_0x219aab);}function getSmtpHost(_0x122ff7){switch(_0x122ff7){case _0xc421('0x29'):return _0xc421('0x2f');case _0xc421('0x2a'):return _0xc421('0x30');case'hotmail':return'smtp-mail.outlook.com';case _0xc421('0x2d'):return'smtp.office365.com';}throw new Error(_0xc421('0x31'),_0x122ff7);}function getAuthenticationOptions(_0x45f8c1,_0x3de6cf){var _0x19055e={};var _0x28be42={};if(_0x45f8c1){_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=_0x3de6cf['username'];_0x19055e[_0xc421('0x33')]=_0x28be42['pass']=_0x3de6cf['password'];if(_0x3de6cf[_0xc421('0x34')]){_0x19055e[_0xc421('0x34')]=_0x28be42['modernAuthentication']=!![];_0x19055e['CloudProviderId']=_0x28be42[_0xc421('0x35')]=_0x3de6cf[_0xc421('0x35')];_0x19055e['password']=_0x28be42['pass']=null;}else{_0x19055e[_0xc421('0x35')]=_0x28be42[_0xc421('0x35')]=null;}_0x19055e[_0xc421('0x36')]=getImapHost(_0x45f8c1);_0x19055e[_0xc421('0x37')]=0x3e1;_0x28be42['host']=getSmtpHost(_0x45f8c1);_0x28be42[_0xc421('0x37')]=0x24b;_0x28be42['secure']=![];_0x19055e[_0xc421('0x38')]=_0x28be42[_0xc421('0x38')]=null;}else{if(_0x3de6cf[_0xc421('0x39')]){_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=_0x3de6cf[_0xc421('0x3a')];_0x19055e[_0xc421('0x33')]=_0x28be42[_0xc421('0x3b')]=_0x3de6cf[_0xc421('0x33')];}else{_0x19055e[_0xc421('0x39')]=_0x28be42[_0xc421('0x39')]=![];_0x19055e[_0xc421('0x32')]=_0x28be42[_0xc421('0x32')]=null;_0x19055e['password']=_0x28be42[_0xc421('0x3b')]=null;}_0x19055e[_0xc421('0x36')]=_0x3de6cf[_0xc421('0x3c')][_0xc421('0x36')];_0x19055e[_0xc421('0x37')]=_0x3de6cf[_0xc421('0x3c')][_0xc421('0x37')];_0x28be42[_0xc421('0x36')]=_0x3de6cf['Smtp'][_0xc421('0x36')];_0x28be42[_0xc421('0x37')]=_0x3de6cf[_0xc421('0x3d')][_0xc421('0x37')];}return{'Imap':_0x19055e,'Smtp':_0x28be42};}exports[_0xc421('0x3e')]=function(_0x25c71b,_0x284957){var _0xda3138={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':_0xc421('0x41')}]},_0x50def7={},_0x1d73a5={'count':0x0,'rows':[]};var _0x2bbb32=_['map'](db[_0xc421('0x42')][_0xc421('0x43')],function(_0x1528c3){return{'name':_0x1528c3[_0xc421('0x44')],'type':_0x1528c3[_0xc421('0x45')][_0xc421('0x46')]};});_0x50def7['model']=_[_0xc421('0x47')](_0x2bbb32,_0xc421('0x28'));_0x50def7['query']=_[_0xc421('0x48')](_0x25c71b['query']);_0x50def7[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x50def7[_0xc421('0x4b')],_0x50def7[_0xc421('0x4c')]);_0xda3138['attributes']=_[_0xc421('0x4a')](_0x50def7[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x25c71b[_0xc421('0x4c')][_0xc421('0x4d')]));_0xda3138[_0xc421('0x4e')]=_0xda3138[_0xc421('0x4e')][_0xc421('0x4f')]?_0xda3138[_0xc421('0x4e')]:_0x50def7[_0xc421('0x4b')];if(!_0x25c71b[_0xc421('0x4c')][_0xc421('0x50')]('nolimit')){_0xda3138[_0xc421('0x1e')]=qs['limit'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x1e')]);_0xda3138['offset']=qs['offset'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x1f')]);}_0xda3138[_0xc421('0x51')]=qs['sort'](_0x25c71b[_0xc421('0x4c')][_0xc421('0x52')]);_0xda3138[_0xc421('0x53')]=qs[_0xc421('0x49')](_['pick'](_0x25c71b[_0xc421('0x4c')],_0x50def7[_0xc421('0x49')]),_0x2bbb32);if(_0x25c71b['query'][_0xc421('0x54')]){_0xda3138['where']=_['merge'](_0xda3138[_0xc421('0x53')],{'$or':_['map'](_0x2bbb32,function(_0x53ca58){if(_0x53ca58[_0xc421('0x45')]!==_0xc421('0x55')){var _0xdd3f6c={};_0xdd3f6c[_0x53ca58[_0xc421('0x28')]]={'$like':'%'+_0x25c71b[_0xc421('0x4c')]['filter']+'%'};return _0xdd3f6c;}})});}_0xda3138=_[_0xc421('0x56')]({},_0xda3138,_0x25c71b[_0xc421('0x57')]);var _0x188d4c={'where':_0xda3138[_0xc421('0x53')]};return db[_0xc421('0x42')][_0xc421('0x20')](_0x188d4c)[_0xc421('0x11')](function(_0x4dc91a){_0x1d73a5['count']=_0x4dc91a;if(_0x25c71b[_0xc421('0x4c')][_0xc421('0x58')]){_0xda3138[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x42')][_0xc421('0x5a')](_0xda3138);})[_0xc421('0x11')](function(_0x258fb9){_0x1d73a5[_0xc421('0x5b')]=_0x258fb9;return _0x1d73a5;})[_0xc421('0x11')](respondWithFilteredResult(_0x284957,_0xda3138))[_0xc421('0x19')](handleError(_0x284957,null));};exports['show']=function(_0x1236ab,_0x3465fc){var _0x25548a={'raw':![],'where':{'id':_0x1236ab['params']['id']},'include':[{'model':db[_0xc421('0x5c')],'as':_0xc421('0x3c')},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':_0xc421('0x41')}]},_0xb5ea32={};_0xb5ea32[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x42')][_0xc421('0x43')]);_0xb5ea32['query']=_[_0xc421('0x48')](_0x1236ab[_0xc421('0x4c')]);_0xb5ea32[_0xc421('0x49')]=_[_0xc421('0x4a')](_0xb5ea32['model'],_0xb5ea32['query']);_0x25548a[_0xc421('0x4e')]=_[_0xc421('0x4a')](_0xb5ea32[_0xc421('0x4b')],qs['fields'](_0x1236ab[_0xc421('0x4c')]['fields']));_0x25548a[_0xc421('0x4e')]=_0x25548a[_0xc421('0x4e')][_0xc421('0x4f')]?_0x25548a[_0xc421('0x4e')]:_0xb5ea32[_0xc421('0x4b')];if(_0x1236ab[_0xc421('0x4c')]['includeAll']){_0x25548a[_0xc421('0x59')]=[{'all':!![]}];}_0x25548a=_['merge']({},_0x25548a,_0x1236ab[_0xc421('0x57')]);return db[_0xc421('0x42')][_0xc421('0x5d')](_0x25548a)[_0xc421('0x11')](handleEntityNotFound(_0x3465fc,null))[_0xc421('0x11')](respondWithResult(_0x3465fc,null))[_0xc421('0x19')](handleError(_0x3465fc,null));};exports[_0xc421('0x23')]=function(_0x4f4b0a,_0x4218cb){if(_0x4f4b0a[_0xc421('0x5e')]['id']){delete _0x4f4b0a['body']['id'];}var _0x4e8e37=_0x4f4b0a[_0xc421('0x5e')]['provider']===_0xc421('0x5f')?null:_0x4f4b0a['body'][_0xc421('0x60')];var _0x2b1e71=_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')]||{};var _0x373f23=_0x4f4b0a['body']['Smtp']||{};if(_0x4e8e37){_0x2b1e71[_0xc421('0x36')]=getImapHost(_0x4e8e37);_0x2b1e71[_0xc421('0x37')]=0x3e1;_0x373f23[_0xc421('0x36')]=getSmtpHost(_0x4e8e37);_0x373f23['port']=0x24b;_0x373f23['secure']=![];}if(_0x373f23[_0xc421('0x34')]){_0x373f23['secure']=![];}else{_0x373f23[_0xc421('0x35')]=null;}if(!_0x2b1e71[_0xc421('0x34')])_0x2b1e71[_0xc421('0x35')]=null;_0x4f4b0a['body'][_0xc421('0x3c')]=_0x2b1e71;_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3d')]=_0x373f23;return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x4f4b0a[_0xc421('0x61')]['id']},'include':[{'model':db[_0xc421('0x5c')],'as':_0xc421('0x3c')},{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d')},{'model':db[_0xc421('0x40')],'as':'mandatoryDispositionPause'}]})[_0xc421('0x11')](handleEntityNotFound(_0x4218cb,null))[_0xc421('0x11')](function(_0x38fcc5){if(!_0x38fcc5)throw new Error(_0xc421('0x62'));if(_0x38fcc5[_0xc421('0x38')])delete _0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')];return _0x38fcc5;})[_0xc421('0x11')](saveUpdates(_0x4f4b0a[_0xc421('0x5e')],null))[_0xc421('0x11')](function(_0x54873c){if(!_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')])return _0x54873c;return db[_0xc421('0x5c')][_0xc421('0x23')](_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3c')],{'where':{'MailAccountId':_0x54873c['id']}})['then'](function(){return _0x54873c;});})[_0xc421('0x11')](function(_0x5a1c9d){if(!_0x4f4b0a[_0xc421('0x5e')][_0xc421('0x3d')])return _0x5a1c9d;return db[_0xc421('0x3f')][_0xc421('0x23')](_0x4f4b0a['body']['Smtp'],{'where':{'MailAccountId':_0x5a1c9d['id']}})[_0xc421('0x11')](function(){return _0x5a1c9d;});})[_0xc421('0x11')](respondWithResult(_0x4218cb,null))['catch'](handleError(_0x4218cb,null));};exports[_0xc421('0x63')]=function(_0x625230,_0x14a1df){return db[_0xc421('0x42')][_0xc421('0x63')]()[_0xc421('0x11')](respondWithResult(_0x14a1df,null))[_0xc421('0x19')](handleError(_0x14a1df,null));};exports[_0xc421('0x64')]=function(_0x39e0dc,_0x22f9d4){if(_0x39e0dc[_0xc421('0x5e')]['id']){delete _0x39e0dc[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x39e0dc['params']['id']}})['then'](handleEntityNotFound(_0x22f9d4,null))[_0xc421('0x11')](function(_0x2fa4ae){if(_0x2fa4ae){_0x39e0dc[_0xc421('0x5e')]['MailAccountId']=_0x2fa4ae['id'];return db[_0xc421('0x65')][_0xc421('0x66')](_0x39e0dc[_0xc421('0x5e')]);}})['then'](respondWithResult(_0x22f9d4,null))[_0xc421('0x19')](handleError(_0x22f9d4,null));};exports[_0xc421('0x67')]=function(_0x4cc512,_0x365998){var _0x30afce={'raw':![],'where':{}};var _0x55c560={};var _0x2d0f76={'count':0x0,'rows':[]};return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x4cc512[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x365998,null))[_0xc421('0x11')](function(_0x3e8611){if(_0x3e8611){_0x55c560['model']=_[_0xc421('0x48')](db[_0xc421('0x65')][_0xc421('0x43')]);_0x55c560[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x4cc512[_0xc421('0x4c')]);_0x55c560['filters']=_['intersection'](_0x55c560[_0xc421('0x4b')],_0x55c560[_0xc421('0x4c')]);_0x30afce['attributes']=_[_0xc421('0x4a')](_0x55c560[_0xc421('0x4b')],qs['fields'](_0x4cc512['query'][_0xc421('0x4d')]));_0x30afce[_0xc421('0x4e')]=_0x30afce[_0xc421('0x4e')]['length']?_0x30afce[_0xc421('0x4e')]:_0x55c560['model'];if(!_0x4cc512['query']['hasOwnProperty'](_0xc421('0x68'))){_0x30afce[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x4cc512[_0xc421('0x4c')][_0xc421('0x1e')]);_0x30afce[_0xc421('0x1f')]=qs['offset'](_0x4cc512[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x30afce[_0xc421('0x51')]=qs['sort'](_0x4cc512[_0xc421('0x4c')][_0xc421('0x52')]);_0x30afce[_0xc421('0x53')]=qs['filters'](_[_0xc421('0x69')](_0x4cc512[_0xc421('0x4c')],_0x55c560[_0xc421('0x49')]));_0x30afce[_0xc421('0x53')][_0xc421('0x6a')]=_0x3e8611['id'];if(_0x4cc512['query']['filter']){_0x30afce[_0xc421('0x53')]=_[_0xc421('0x56')](_0x30afce[_0xc421('0x53')],{'$or':_[_0xc421('0x47')](_0x30afce[_0xc421('0x4e')],function(_0x47f172){var _0x5a9da2={};_0x5a9da2[_0x47f172]={'$like':'%'+_0x4cc512['query']['filter']+'%'};return _0x5a9da2;})});}_0x30afce=_[_0xc421('0x56')]({},_0x30afce,_0x4cc512[_0xc421('0x57')]);return db[_0xc421('0x65')][_0xc421('0x20')]({'where':_0x30afce[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x476b91){_0x2d0f76['count']=_0x476b91;if(_0x4cc512['query'][_0xc421('0x58')]){_0x30afce[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x65')][_0xc421('0x5a')](_0x30afce);})[_0xc421('0x11')](function(_0x52ddbb){_0x2d0f76[_0xc421('0x5b')]=_0x52ddbb;return _0x2d0f76;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x365998,_0x30afce))[_0xc421('0x19')](handleError(_0x365998,null));};exports[_0xc421('0x6b')]=function(_0x3150a0,_0x3d68ba){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x3150a0[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x3d68ba,null))[_0xc421('0x11')](function(_0x3e9bf5){if(_0x3e9bf5){return _0x3e9bf5[_0xc421('0x6b')](_0x3150a0[_0xc421('0x4c')][_0xc421('0x6c')]);}})[_0xc421('0x11')](respondWithStatusCode(_0x3d68ba,null))[_0xc421('0x19')](handleError(_0x3d68ba,null));};exports['addAnswer']=function(_0x5f196a,_0x528464){if(_0x5f196a[_0xc421('0x5e')]['id']){delete _0x5f196a[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x5f196a[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x528464,null))['then'](function(_0x4ce078){if(_0x4ce078){_0x5f196a[_0xc421('0x5e')][_0xc421('0x6a')]=_0x4ce078['id'];return db[_0xc421('0x6d')][_0xc421('0x66')](_0x5f196a[_0xc421('0x5e')]);}})['then'](respondWithResult(_0x528464,null))[_0xc421('0x19')](handleError(_0x528464,null));};exports[_0xc421('0x6e')]=function(_0x5b9377,_0x29ac9e){var _0x1ef204={'raw':![],'where':{}};var _0x23d8bc={};var _0x27738c={'count':0x0,'rows':[]};return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x5b9377[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x29ac9e,null))['then'](function(_0x5424a3){if(_0x5424a3){_0x23d8bc[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x6d')][_0xc421('0x43')]);_0x23d8bc[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x5b9377[_0xc421('0x4c')]);_0x23d8bc[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x23d8bc[_0xc421('0x4b')],_0x23d8bc[_0xc421('0x4c')]);_0x1ef204['attributes']=_[_0xc421('0x4a')](_0x23d8bc[_0xc421('0x4b')],qs['fields'](_0x5b9377[_0xc421('0x4c')]['fields']));_0x1ef204['attributes']=_0x1ef204[_0xc421('0x4e')][_0xc421('0x4f')]?_0x1ef204[_0xc421('0x4e')]:_0x23d8bc[_0xc421('0x4b')];if(!_0x5b9377['query'][_0xc421('0x50')](_0xc421('0x68'))){_0x1ef204[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x1e')]);_0x1ef204[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x1ef204[_0xc421('0x51')]=qs[_0xc421('0x52')](_0x5b9377[_0xc421('0x4c')][_0xc421('0x52')]);_0x1ef204[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x5b9377[_0xc421('0x4c')],_0x23d8bc[_0xc421('0x49')]));_0x1ef204['where']['MailAccountId']=_0x5424a3['id'];if(_0x5b9377[_0xc421('0x4c')]['filter']){_0x1ef204[_0xc421('0x53')]=_[_0xc421('0x56')](_0x1ef204[_0xc421('0x53')],{'$or':_['map'](_0x1ef204['attributes'],function(_0x53bbc1){var _0x4bb355={};_0x4bb355[_0x53bbc1]={'$like':'%'+_0x5b9377['query'][_0xc421('0x54')]+'%'};return _0x4bb355;})});}_0x1ef204=_[_0xc421('0x56')]({},_0x1ef204,_0x5b9377[_0xc421('0x57')]);return db[_0xc421('0x6d')][_0xc421('0x20')]({'where':_0x1ef204[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x1fed9d){_0x27738c[_0xc421('0x20')]=_0x1fed9d;if(_0x5b9377['query'][_0xc421('0x58')]){_0x1ef204[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x6d')]['findAll'](_0x1ef204);})['then'](function(_0x13b0bb){_0x27738c[_0xc421('0x5b')]=_0x13b0bb;return _0x27738c;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x29ac9e,_0x1ef204))[_0xc421('0x19')](handleError(_0x29ac9e,null));};exports['removeAnswers']=function(_0x59fe76,_0x2e05d4){return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x59fe76[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e05d4,null))['then'](function(_0x538a5c){if(_0x538a5c){return _0x538a5c[_0xc421('0x70')](_0x59fe76[_0xc421('0x4c')][_0xc421('0x6c')]);}})[_0xc421('0x11')](respondWithStatusCode(_0x2e05d4,null))[_0xc421('0x19')](handleError(_0x2e05d4,null));};exports[_0xc421('0x66')]=function(_0x5d3e34,_0x5254d8){var _0x553271={'name':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x28')],'key':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x46')],'provider':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x60')]===_0xc421('0x5f')?null:_0x5d3e34[_0xc421('0x5e')][_0xc421('0x60')],'email':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x71')],'ListId':_0x5d3e34['body'][_0xc421('0x72')],'active':!_[_0xc421('0x73')](_0x5d3e34[_0xc421('0x5e')][_0xc421('0x74')])?_0x5d3e34[_0xc421('0x5e')][_0xc421('0x74')]:!![],'description':_0x5d3e34[_0xc421('0x5e')][_0xc421('0x75')]||null};var _0x27b7be=getAuthenticationOptions(_0x553271[_0xc421('0x60')],_0x5d3e34[_0xc421('0x5e')]);_0x553271[_0xc421('0x3c')]=_0x27b7be[_0xc421('0x3c')];_0x553271[_0xc421('0x3d')]=_0x27b7be[_0xc421('0x3d')];return db[_0xc421('0x42')][_0xc421('0x66')](_0x553271,{'include':[{'model':db[_0xc421('0x3f')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xc421('0x3c')}]})[_0xc421('0x11')](function(_0x606d40){var _0x30d9f3=_0x5d3e34[_0xc421('0x32')]['get']({'plain':!![]});if(!_0x30d9f3)throw new Error(_0xc421('0x76'));if(_0x30d9f3[_0xc421('0x77')]===_0xc421('0x32')){var _0x5b0450=_0x606d40['get']({'plain':!![]});return db[_0xc421('0x78')][_0xc421('0x5d')]({'where':{'name':_0xc421('0x25'),'userProfileId':_0x30d9f3[_0xc421('0x79')]},'raw':!![]})['then'](function(_0x15b46b){if(_0x15b46b&&_0x15b46b[_0xc421('0x7a')]===0x0){return db['UserProfileResource'][_0xc421('0x66')]({'name':_0x5b0450[_0xc421('0x28')],'resourceId':_0x5b0450['id'],'type':_0x15b46b[_0xc421('0x28')],'sectionId':_0x15b46b['id']},{})[_0xc421('0x11')](function(){return _0x606d40;});}else{return _0x606d40;}})['catch'](function(_0x28981d){logger['error'](_0xc421('0x7b'),_0x28981d);throw _0x28981d;});}return _0x606d40;})[_0xc421('0x11')](respondWithResult(_0x5254d8,0xc9))['catch'](handleError(_0x5254d8,null));};exports['getImap']=function(_0x296e44,_0x1f4df4){return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x296e44[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x1f4df4,null))[_0xc421('0x11')](function(_0x2cf4cf){if(_0x2cf4cf){return _0x2cf4cf[_0xc421('0x7c')]();}return null;})['then'](respondWithResult(_0x1f4df4,null))['catch'](handleError(_0x1f4df4,null));};exports[_0xc421('0x7d')]=function(_0x44cb8c,_0x474e8f){if(_0x44cb8c[_0xc421('0x5e')]['id']){delete _0x44cb8c[_0xc421('0x5e')]['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x44cb8c[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x474e8f,null))[_0xc421('0x11')](function(_0x5c8d18){if(_0x5c8d18){_0x44cb8c[_0xc421('0x5e')][_0xc421('0x6a')]=_0x5c8d18['id'];return db[_0xc421('0x5c')][_0xc421('0x66')](_0x44cb8c[_0xc421('0x5e')]);}})[_0xc421('0x11')](respondWithResult(_0x474e8f,null))[_0xc421('0x19')](handleError(_0x474e8f,null));};exports['removeImap']=function(_0x1a5d10,_0xb83634){return db['MailAccount'][_0xc421('0x6f')]({'where':{'id':_0x1a5d10[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0xb83634,null))[_0xc421('0x11')](function(_0x40e452){if(_0x40e452){return _0x40e452[_0xc421('0x7e')](null);}return null;})[_0xc421('0x11')](respondWithStatusCode(_0xb83634,null))[_0xc421('0x19')](handleError(_0xb83634,null));};exports[_0xc421('0x7f')]=function(_0x559baf,_0x26b5a7){return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x559baf[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26b5a7,null))['then'](function(_0x2c44c8){if(_0x2c44c8){return _0x2c44c8[_0xc421('0x7f')]();}return null;})[_0xc421('0x11')](respondWithResult(_0x26b5a7,null))[_0xc421('0x19')](handleError(_0x26b5a7,null));};exports['addSmtp']=function(_0x39cc62,_0x245cdf){if(_0x39cc62[_0xc421('0x5e')]['id']){delete _0x39cc62['body']['id'];}return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x39cc62[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x245cdf,null))[_0xc421('0x11')](function(_0x1b81d5){if(_0x1b81d5){_0x39cc62['body']['MailAccountId']=_0x1b81d5['id'];return db[_0xc421('0x3f')][_0xc421('0x66')](_0x39cc62[_0xc421('0x5e')]);}})[_0xc421('0x11')](respondWithResult(_0x245cdf,null))[_0xc421('0x19')](handleError(_0x245cdf,null));};exports['removeSmtp']=function(_0xc17ff,_0x26238a){return db['MailAccount'][_0xc421('0x6f')]({'where':{'id':_0xc17ff[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26238a,null))['then'](function(_0x1e1839){if(_0x1e1839){return _0x1e1839[_0xc421('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x26238a,null))[_0xc421('0x19')](handleError(_0x26238a,null));};exports[_0xc421('0x81')]=function(_0x440689,_0x26381c){return db[_0xc421('0x82')]['find']({'where':{'id':_0x440689[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x26381c,null))[_0xc421('0x11')](function(_0x5a00d7){if(_0x5a00d7){return _0x5a00d7['addInteraction'](_0x440689['body'][_0xc421('0x6c')],_[_0xc421('0x83')](_0x440689['body'],[_0xc421('0x6c'),'id'])||{});}})[_0xc421('0x11')](respondWithResult(_0x26381c,null))['catch'](handleError(_0x26381c,null));};exports[_0xc421('0x84')]=function(_0x1f7c38,_0x3e0d63){var _0x288020={'raw':![],'where':{}};var _0x5303c1={};var _0x2392a0={'count':0x0,'rows':[]};return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x1f7c38[_0xc421('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e0d63,null))[_0xc421('0x11')](function(_0x58bb88){if(_0x58bb88){_0x5303c1[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x82')][_0xc421('0x43')]);_0x5303c1[_0xc421('0x4c')]=_[_0xc421('0x48')](_0x1f7c38[_0xc421('0x4c')]);_0x5303c1[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x5303c1[_0xc421('0x4b')],_0x5303c1[_0xc421('0x4c')]);_0x288020[_0xc421('0x4e')]=_[_0xc421('0x4a')](_0x5303c1[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x4d')]));_0x288020[_0xc421('0x4e')]=_0x288020[_0xc421('0x4e')][_0xc421('0x4f')]?_0x288020[_0xc421('0x4e')]:_0x5303c1['model'];if(!_0x1f7c38[_0xc421('0x4c')][_0xc421('0x50')](_0xc421('0x68'))){_0x288020[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x1e')]);_0x288020['offset']=qs['offset'](_0x1f7c38[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x288020[_0xc421('0x51')]=qs['sort'](_0x1f7c38['query'][_0xc421('0x52')]);_0x288020[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x1f7c38[_0xc421('0x4c')],_0x5303c1[_0xc421('0x49')]));_0x288020[_0xc421('0x53')][_0xc421('0x6a')]=_0x58bb88['id'];if(_0x1f7c38[_0xc421('0x4c')][_0xc421('0x54')]){_0x288020['where']=_['merge'](_0x288020[_0xc421('0x53')],{'$or':_['map'](_0x288020['attributes'],function(_0x16f53a){var _0x23b0f8={};_0x23b0f8[_0x16f53a]={'$like':'%'+_0x1f7c38[_0xc421('0x4c')]['filter']+'%'};return _0x23b0f8;})});}_0x288020=_[_0xc421('0x56')]({},_0x288020,_0x1f7c38[_0xc421('0x57')]);return db['MailInteraction'][_0xc421('0x20')]({'where':_0x288020[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x1f90ef){_0x2392a0[_0xc421('0x20')]=_0x1f90ef;if(_0x1f7c38['query'][_0xc421('0x58')]){_0x288020[_0xc421('0x59')]=[{'model':db[_0xc421('0x85')],'as':_0xc421('0x86'),'required':![]},{'model':db[_0xc421('0x87')],'as':_0xc421('0x88'),'attributes':[_0xc421('0x28'),_0xc421('0x89'),'internal'],'required':![]},{'model':db[_0xc421('0x8a')],'as':'Tags','attributes':['id','name',_0xc421('0x8b')],'where':_0x1f7c38['query']['tag']?{'id':_0x1f7c38['query'][_0xc421('0x8c')]}:undefined,'required':_0x1f7c38[_0xc421('0x4c')][_0xc421('0x8c')]?!![]:![]}];}return db[_0xc421('0x82')][_0xc421('0x5a')](_0x288020);})[_0xc421('0x11')](function(_0x11dc54){_0x2392a0['rows']=_0x11dc54;return _0x2392a0;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x3e0d63,_0x288020))[_0xc421('0x19')](handleError(_0x3e0d63,null));};exports[_0xc421('0x8d')]=function addApplications(_0x185293,_0x16a132){var _0x1e9d8c=_0x185293[_0xc421('0x61')]['id'];var _0xe25cf5=_0x185293[_0xc421('0x5e')];var _0x4def5f=0xc8;var _0x4c9ae4=null;return db[_0xc421('0x8e')][_0xc421('0x8f')]({'isolationLevel':db[_0xc421('0x8e')][_0xc421('0x90')][_0xc421('0x91')][_0xc421('0x92')]},function(_0x1d3c01){return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x1e9d8c},'transaction':_0x1d3c01})[_0xc421('0x11')](function(_0x4ba7a0){if(_0x4ba7a0){return db[_0xc421('0x93')][_0xc421('0x26')]({'where':{'MailAccountId':_0x1e9d8c},'transaction':_0x1d3c01})[_0xc421('0x11')](function(){var _0x13a9a2=_['map'](_0xe25cf5,function(_0x1b663e){_0x1b663e['MailAccountId']=_0x1e9d8c;return _0x1b663e;});return db['MailApplication']['bulkCreate'](_0x13a9a2,{'transaction':_0x1d3c01});});}else{_0x4def5f=0x194;_0x4c9ae4=[];}});})[_0xc421('0x11')](function(){if(_0x4def5f!==0x194){return db[_0xc421('0x93')][_0xc421('0x94')]({'where':{'MailAccountId':_0x1e9d8c},'order':_0xc421('0x95')})[_0xc421('0x11')](function(_0x4af8ad){_0x4c9ae4=_0x4af8ad;});}})[_0xc421('0x19')](function(_0x51ca56){_0x4def5f=0x1f4;logger[_0xc421('0x16')](_0x51ca56['stack']);if(_0x51ca56['name']){delete _0x51ca56['name'];}_0x4c9ae4=_0x51ca56;})['finally'](function(){if(_0x4c9ae4===null){_0x16a132[_0xc421('0x1a')](_0x4def5f);}else{if(_0x4def5f===0x1f4){_0x16a132[_0xc421('0x1b')](_0x4def5f)['send'](_0x4c9ae4);}else{_0x16a132[_0xc421('0x1b')](_0x4def5f)[_0xc421('0x1c')](_0x4c9ae4);}}});};exports[_0xc421('0x96')]=function(_0x3d6685,_0x19afd3){var _0x2988b2={};var _0x4b1ae9={};var _0x86a5c4;var _0x563ac5;return db[_0xc421('0x42')]['findOne']({'where':{'id':_0x3d6685[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x19afd3,null))[_0xc421('0x11')](function(_0x2ddde1){if(_0x2ddde1){_0x86a5c4=_0x2ddde1;_0x4b1ae9[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x93')][_0xc421('0x43')]);_0x4b1ae9[_0xc421('0x4c')]=_['keys'](_0x3d6685[_0xc421('0x4c')]);_0x4b1ae9[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x4b1ae9[_0xc421('0x4b')],_0x4b1ae9[_0xc421('0x4c')]);_0x2988b2[_0xc421('0x4e')]=_['intersection'](_0x4b1ae9[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x3d6685[_0xc421('0x4c')]['fields']));_0x2988b2[_0xc421('0x4e')]=_0x2988b2[_0xc421('0x4e')][_0xc421('0x4f')]?_0x2988b2[_0xc421('0x4e')]:_0x4b1ae9[_0xc421('0x4b')];_0x2988b2['order']=qs[_0xc421('0x52')](_0x3d6685[_0xc421('0x4c')][_0xc421('0x52')]);_0x2988b2[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x3d6685['query'],_0x4b1ae9['filters']));if(_0x3d6685[_0xc421('0x4c')]['filter']){_0x2988b2['where']=_['merge'](_0x2988b2[_0xc421('0x53')],{'$or':_['map'](_0x2988b2[_0xc421('0x4e')],function(_0x2051d0){var _0x4e43b1={};_0x4e43b1[_0x2051d0]={'$like':'%'+_0x3d6685[_0xc421('0x4c')][_0xc421('0x54')]+'%'};return _0x4e43b1;})});}_0x2988b2=_['merge']({},_0x2988b2,_0x3d6685[_0xc421('0x57')]);return _0x86a5c4[_0xc421('0x96')](_0x2988b2);}})[_0xc421('0x11')](function(_0x212d6a){if(_0x212d6a){_0x563ac5=_0x212d6a['length'];if(!_0x3d6685['query'][_0xc421('0x50')](_0xc421('0x68'))){_0x2988b2[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x3d6685['query']['limit']);_0x2988b2[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x3d6685[_0xc421('0x4c')][_0xc421('0x1f')]);}return _0x86a5c4[_0xc421('0x96')](_0x2988b2);}})[_0xc421('0x11')](function(_0x259f8f){if(_0x259f8f){return _0x259f8f?{'count':_0x563ac5,'rows':_0x259f8f}:null;}})[_0xc421('0x11')](respondWithResult(_0x19afd3,null))['catch'](handleError(_0x19afd3,null));};exports['getMessages']=function(_0x2fc9bb,_0x2c85b1){var _0x3c1ade={'raw':!![],'where':{}};var _0x1b61ea={};var _0x491c34={'count':0x0,'rows':[]};return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x2fc9bb[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x2c85b1,null))[_0xc421('0x11')](function(_0x3eaa8c){if(_0x3eaa8c){_0x1b61ea[_0xc421('0x4b')]=_[_0xc421('0x48')](db[_0xc421('0x97')][_0xc421('0x43')]);_0x1b61ea[_0xc421('0x4c')]=_['keys'](_0x2fc9bb['query']);_0x1b61ea[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x1b61ea['model'],_0x1b61ea['query']);_0x3c1ade[_0xc421('0x4e')]=_['intersection'](_0x1b61ea[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x4d')]));_0x3c1ade[_0xc421('0x4e')]=_0x3c1ade[_0xc421('0x4e')]['length']?_0x3c1ade[_0xc421('0x4e')]:_0x1b61ea[_0xc421('0x4b')];if(!_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x50')]('nolimit')){_0x3c1ade[_0xc421('0x1e')]=qs[_0xc421('0x1e')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x1e')]);_0x3c1ade[_0xc421('0x1f')]=qs[_0xc421('0x1f')](_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x1f')]);}_0x3c1ade['order']=qs[_0xc421('0x52')](_0x2fc9bb['query'][_0xc421('0x52')]);_0x3c1ade[_0xc421('0x53')]=qs[_0xc421('0x49')](_[_0xc421('0x69')](_0x2fc9bb[_0xc421('0x4c')],_0x1b61ea[_0xc421('0x49')]));_0x3c1ade[_0xc421('0x53')][_0xc421('0x6a')]=_0x3eaa8c['id'];if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x54')]){_0x3c1ade[_0xc421('0x53')]=_[_0xc421('0x56')](_0x3c1ade[_0xc421('0x53')],{'$or':_[_0xc421('0x47')](_0x3c1ade['attributes'],function(_0x4e65e0){var _0x2aeea0={};_0x2aeea0[_0x4e65e0]={'$like':'%'+_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x54')]+'%'};return _0x2aeea0;})});}if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x98')]){var _0x22450c=_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x98')]['split'](',');var _0x2800f5={};_0x2800f5[_0x22450c[0x0]]={'$gte':moment(_0x22450c[0x1])[_0xc421('0x99')](_0xc421('0x9a'))};_0x3c1ade[_0xc421('0x53')]=_[_0xc421('0x56')](_0x3c1ade[_0xc421('0x53')],_0x2800f5);}_0x3c1ade=_[_0xc421('0x56')]({},_0x3c1ade,_0x2fc9bb['options']);return db['MailMessage'][_0xc421('0x20')]({'where':_0x3c1ade[_0xc421('0x53')]})[_0xc421('0x11')](function(_0x2195f3){_0x491c34[_0xc421('0x20')]=_0x2195f3;if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x58')]){_0x3c1ade[_0xc421('0x59')]=[{'all':!![]}];}return db[_0xc421('0x97')][_0xc421('0x5a')](_0x3c1ade);})[_0xc421('0x11')](function(_0x151b52){if(_0x2fc9bb[_0xc421('0x4c')][_0xc421('0x9b')]==='true'){for(var _0x2d821d=0x0;_0x2d821d<_0x151b52[_0xc421('0x4f')];_0x2d821d++){_0x151b52[_0x2d821d][_0xc421('0x5e')]=juice(_0x151b52[_0x2d821d][_0xc421('0x5e')]);}}_0x491c34[_0xc421('0x5b')]=_0x151b52;return _0x491c34;});}})[_0xc421('0x11')](respondWithFilteredResult(_0x2c85b1,_0x3c1ade))['catch'](handleError(_0x2c85b1,null));};exports[_0xc421('0x9c')]=function(_0x3aad27,_0x1ff74d){var _0x555c7b,_0xe3b623={},_0x56f239;if(_0x3aad27[_0xc421('0x5e')]['to']){_0x56f239=_0x3aad27[_0xc421('0x5e')]['to'][_0xc421('0x9d')](',')[0x0];}return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x3aad27[_0xc421('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0xc421('0x9e'),'include':[{'model':db[_0xc421('0x85')],'as':_0xc421('0x9f'),'where':{'email':_0x56f239},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0xc421('0x3d'),'raw':!![],'include':[{'model':db[_0xc421('0xa0')],'as':_0xc421('0xa0'),'raw':!![]}]}]})[_0xc421('0x11')](handleEntityNotFound(_0x1ff74d,null))[_0xc421('0x11')](function(_0x2e3bcf){if(!_0x2e3bcf)return;_0x555c7b=_0x2e3bcf;if(!_0x2e3bcf['Smtp'])throw new Error(_0xc421('0xa1'));if(_[_0xc421('0x73')](_0x3aad27['body'][_0xc421('0xa2')])){_0x3aad27[_0xc421('0x5e')][_0xc421('0xa2')]=util['format'](_0xc421('0xa3'),_0x2e3bcf[_0xc421('0x28')],_0x2e3bcf[_0xc421('0x71')]||_0x2e3bcf[_0xc421('0x3d')][_0xc421('0x32')]);}if(_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')]&&_0x3aad27['body'][_0xc421('0xa4')][_0xc421('0x4f')]){for(var _0x9a4216=0x0;_0x9a4216<_0x3aad27['body'][_0xc421('0xa4')][_0xc421('0x4f')];_0x9a4216+=0x1){_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')][_0x9a4216]={'filename':_0x3aad27['body'][_0xc421('0xa4')][_0x9a4216][_0xc421('0x28')],'path':path[_0xc421('0xa5')](config[_0xc421('0xa6')],_0xc421('0xa7'),_0x3aad27[_0xc421('0x5e')][_0xc421('0xa4')][_0x9a4216][_0xc421('0xa8')])};}}var _0x521262=_0x2e3bcf[_0xc421('0xa9')]();return respondWithRpcPromise(_0xc421('0xaa'),_0xc421('0xab'),{'account':_0x521262,'message':_0x3aad27[_0xc421('0x5e')]});})['then'](function(_0xc17ef3){if(!_0xc17ef3)return;_0xe3b623=_0xc17ef3;if(!_0x555c7b[_0xc421('0x9e')])throw new Error(_0xc421('0xac'));if(_0x555c7b['List']['Contacts'][_0xc421('0x4f')])return _0x555c7b[_0xc421('0x9e')][_0xc421('0x9f')][0x0];return db[_0xc421('0x85')]['create'](_[_0xc421('0x8')](_0x3aad27[_0xc421('0x5e')],{'firstName':_0x3aad27[_0xc421('0x5e')]['to'],'email':_0x3aad27[_0xc421('0x5e')]['to'],'phone':_0x3aad27[_0xc421('0x5e')]['to'],'ListId':_0x555c7b['ListId']}));})[_0xc421('0x11')](function(_0x2a5d5b){if(!_0x2a5d5b)return;var _0x31a5a6={'UserId':_0x3aad27[_0xc421('0x32')]['id'],'ContactId':_0x2a5d5b['id'],'MailAccountId':_0x555c7b['id'],'inReplyTo':_0xe3b623[_0xc421('0xad')],'to':_0x3aad27[_0xc421('0x5e')][_0xc421('0xa2')],'cc':_0x3aad27['body']['cc'],'subject':_0x3aad27['body'][_0xc421('0xae')],'attach':_0x3aad27['body'][_0xc421('0xaf')],'firstMsgDirection':_0xc421('0xb0'),'lastMsgAt':moment()[_0xc421('0x99')](_0xc421('0x9a')),'lastMsgDirection':_0xc421('0xb0'),'Messages':[_[_0xc421('0x56')](_0x3aad27[_0xc421('0x5e')],{'messageId':_0xe3b623[_0xc421('0xad')],'sentAt':moment()[_0xc421('0x99')](_0xc421('0x9a')),'read':!![],'MailAccountId':_0x555c7b['id'],'UserId':_0x3aad27[_0xc421('0x32')]['id'],'ContactId':_0x2a5d5b['id']})]};if(_0x3aad27[_0xc421('0x5e')][_0xc421('0xb1')]){_0x31a5a6=_[_0xc421('0x56')](_0x31a5a6,_0x3aad27['body'][_0xc421('0xb1')]);}return db[_0xc421('0x82')][_0xc421('0x66')](_0x31a5a6,{'include':[{'model':db[_0xc421('0x97')],'as':_0xc421('0xb2')}]});})[_0xc421('0x11')](respondWithResult(_0x1ff74d,null))['catch'](handleError(_0x1ff74d,null));};exports['verifySmtp']=function(_0x1870d0,_0x4969c3){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x1870d0[_0xc421('0x61')]['id']},'include':[{'model':db[_0xc421('0x3f')],'as':_0xc421('0x3d'),'raw':!![],'include':[{'model':db[_0xc421('0xa0')],'as':'CloudProvider','raw':!![]}]}]})[_0xc421('0x11')](handleEntityNotFound(_0x4969c3,null))[_0xc421('0x11')](function(_0x5ea163){if(!_0x5ea163[_0xc421('0x3d')])return;var _0x459a39=_0x5ea163[_0xc421('0xa9')]();return respondWithRpcPromise(_0xc421('0xb3'),_0xc421('0xb4'),{'account':_0x459a39});})['then'](respondWithResult(_0x4969c3,null))[_0xc421('0x19')](handleError(_0x4969c3,null));};exports[_0xc421('0x26')]=function(_0x157291,_0x45d601){return db[_0xc421('0x42')]['find']({'where':{'id':_0x157291['params']['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x45d601,null))['then'](function(_0x31fdc2){if(_0x31fdc2&&_0x31fdc2['service']){throw new db['Sequelize'][(_0xc421('0xb5'))](_0xc421('0xb6'));}return _0x31fdc2;})[_0xc421('0x11')](removeEntity(_0x45d601,null))[_0xc421('0x19')](handleError(_0x45d601,null));};exports[_0xc421('0xb7')]=function(_0x110661,_0x574d04){return db['MailAccount'][_0xc421('0x5d')]({'where':{'id':_0x110661[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x574d04,null))['then'](function(_0x423bd9){if(_0x423bd9){return _0x423bd9['addAgents'](_0x110661[_0xc421('0x5e')][_0xc421('0x6c')],_[_0xc421('0x83')](_0x110661[_0xc421('0x5e')],['ids','id'])||{})[_0xc421('0xb8')](function(_0x1de13d){for(var _0x228e96=0x0;_0x228e96<_0x110661[_0xc421('0x5e')][_0xc421('0x6c')][_0xc421('0x4f')];_0x228e96+=0x1){socket[_0xc421('0xb9')]('userMailAccount:save',{'UserId':Number(_0x110661[_0xc421('0x5e')][_0xc421('0x6c')][_0x228e96]),'MailAccountId':Number(_0x110661[_0xc421('0x61')]['id'])});}return _0x1de13d;});}})[_0xc421('0x11')](respondWithResult(_0x574d04,null))[_0xc421('0x19')](handleError(_0x574d04,null));};exports['removeAgents']=function(_0x3e9358,_0x515e21){return db[_0xc421('0x42')][_0xc421('0x5d')]({'where':{'id':_0x3e9358[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x515e21,null))[_0xc421('0x11')](function(_0x5c8953){if(_0x5c8953){return _0x5c8953[_0xc421('0xba')](_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')])['then'](function(){if(_[_0xc421('0xbb')](_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')])){for(var _0x1ed7d6=0x0;_0x1ed7d6<_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')][_0xc421('0x4f')];_0x1ed7d6+=0x1){socket[_0xc421('0xb9')](_0xc421('0xbc'),{'UserId':Number(_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')][_0x1ed7d6]),'MailAccountId':Number(_0x3e9358[_0xc421('0x61')]['id'])});}}else{socket[_0xc421('0xb9')]('userMailAccount:remove',{'UserId':Number(_0x3e9358[_0xc421('0x4c')][_0xc421('0x6c')]),'MailAccountId':Number(_0x3e9358[_0xc421('0x61')]['id'])});}});}})[_0xc421('0x11')](respondWithStatusCode(_0x515e21,null))[_0xc421('0x19')](handleError(_0x515e21,null));};exports['getAgents']=function(_0x3716f2,_0x21fe01){var _0x4a945b={};var _0x437eef={};var _0x1a187e;var _0x401a17;return db[_0xc421('0x42')][_0xc421('0x6f')]({'where':{'id':_0x3716f2[_0xc421('0x61')]['id']}})[_0xc421('0x11')](handleEntityNotFound(_0x21fe01,null))['then'](function(_0x8578f7){if(_0x8578f7){_0x1a187e=_0x8578f7;_0x437eef[_0xc421('0x4b')]=_['keys'](db[_0xc421('0x87')][_0xc421('0x43')]);_0x437eef['query']=_[_0xc421('0x48')](_0x3716f2[_0xc421('0x4c')]);_0x437eef[_0xc421('0x49')]=_[_0xc421('0x4a')](_0x437eef[_0xc421('0x4b')],_0x437eef['query']);_0x4a945b['attributes']=_[_0xc421('0x4a')](_0x437eef[_0xc421('0x4b')],qs[_0xc421('0x4d')](_0x3716f2[_0xc421('0x4c')][_0xc421('0x4d')]));_0x4a945b['attributes']=_0x4a945b[_0xc421('0x4e')][_0xc421('0x4f')]?_0x4a945b[_0xc421('0x4e')]:_0x437eef['model'];_0x4a945b[_0xc421('0x51')]=qs[_0xc421('0x52')](_0x3716f2['query'][_0xc421('0x52')]);_0x4a945b[_0xc421('0x53')]=qs['filters'](_['pick'](_0x3716f2[_0xc421('0x4c')],_0x437eef['filters']));if(_0x3716f2['query']['filter']){_0x4a945b[_0xc421('0x53')]=_[_0xc421('0x56')](_0x4a945b['where'],{'$or':_[_0xc421('0x47')](_0x4a945b[_0xc421('0x4e')],function(_0x491b0a){var _0x54fcfb={};_0x54fcfb[_0x491b0a]={'$like':'%'+_0x3716f2[_0xc421('0x4c')]['filter']+'%'};return _0x54fcfb;})});}_0x4a945b=_[_0xc421('0x56')]({},_0x4a945b,_0x3716f2['options']);return _0x1a187e[_0xc421('0xbd')](_0x4a945b);}})[_0xc421('0x11')](function(_0x5a9bb){if(_0x5a9bb){_0x401a17=_0x5a9bb['length'];if(!_0x3716f2[_0xc421('0x4c')][_0xc421('0x50')](_0xc421('0x68'))){_0x4a945b['limit']=qs['limit'](_0x3716f2[_0xc421('0x4c')]['limit']);_0x4a945b['offset']=qs[_0xc421('0x1f')](_0x3716f2[_0xc421('0x4c')]['offset']);}return _0x1a187e[_0xc421('0xbd')](_0x4a945b);}})[_0xc421('0x11')](function(_0x3244dc){if(_0x3244dc){return _0x3244dc?{'count':_0x401a17,'rows':_0x3244dc}:null;}})['then'](respondWithResult(_0x21fe01,null))[_0xc421('0x19')](handleError(_0x21fe01,null));}; \ No newline at end of file +var _0x58a2=['where','filter','type','VIRTUAL','merge','options','includeAll','include','show','MailServerIn','MailServerOut','find','body','provider','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','pick','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','Owner','internal','Tag','Tags','color','tag','rows','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','stack','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','getSmtpOptions','List\x20not\x20found','messageId','subject','attach','out','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','offset','undefined','count','limit','set','update','destroy','get','MailAccounts','UserProfileResource','end','sendStatus','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x22df4d,_0xa4790a){var _0x6a2020=function(_0x215c88){while(--_0x215c88){_0x22df4d['push'](_0x22df4d['shift']());}};_0x6a2020(++_0xa4790a);}(_0x58a2,0x134));var _0x258a=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x58a2[_0x1203f];return _0x365f0a;};'use strict';var moment=require(_0x258a('0x0'));var BPromise=require(_0x258a('0x1'));var util=require(_0x258a('0x2'));var path=require(_0x258a('0x3'));var _=require(_0x258a('0x4'));var juice=require(_0x258a('0x5'));var Redis=require(_0x258a('0x6'));var qs=require(_0x258a('0x7'));var logger=require(_0x258a('0x8'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x258a('0x9')](config[_0x258a('0xa')],{'host':_0x258a('0xb'),'port':0x18eb});var socket=require(_0x258a('0xc'))(new Redis(config[_0x258a('0xa')]));require(_0x258a('0xd'))[_0x258a('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x258a('0xf')][_0x258a('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x1bd3b3,_0x330add,_0x4cde8d,_0x23658d){return new BPromise(function(_0x2b60ce,_0x413edf){var _0x46ee04=_0x23658d||client;return _0x46ee04[_0x258a('0x11')](_0x1bd3b3,_0x4cde8d)[_0x258a('0x12')](function(_0x592a20){logger[_0x258a('0x13')](_0x258a('0x14'),_0x330add,'request\x20sent');logger[_0x258a('0x15')](_0x258a('0x16'),_0x330add,_0x258a('0x17'),JSON[_0x258a('0x18')](_0x592a20));if(_0x592a20[_0x258a('0x19')]){if(_0x592a20[_0x258a('0x19')][_0x258a('0x1a')]===0x1f4){logger[_0x258a('0x19')]('MailAccount,\x20%s,\x20%s',_0x330add,_0x592a20[_0x258a('0x19')][_0x258a('0x1b')]);return _0x413edf(_0x592a20[_0x258a('0x19')][_0x258a('0x1b')]);}logger[_0x258a('0x19')](_0x258a('0x14'),_0x330add,_0x592a20['error'][_0x258a('0x1b')]);return _0x2b60ce(_0x592a20[_0x258a('0x19')][_0x258a('0x1b')]);}else{logger[_0x258a('0x13')]('MailAccount,\x20%s,\x20%s',_0x330add,'request\x20sent');_0x2b60ce(_0x592a20[_0x258a('0x1c')]['message']);}})[_0x258a('0x1d')](function(_0x4fd09f){logger['error'](_0x258a('0x14'),_0x330add,_0x4fd09f);_0x413edf(_0x4fd09f);});});}function respondWithStatusCode(_0x4e8a74,_0x485494){_0x485494=_0x485494||0xcc;return function(_0x29378c){if(_0x29378c){return _0x4e8a74['sendStatus'](_0x485494);}return _0x4e8a74[_0x258a('0x1e')](_0x485494)['end']();};}function respondWithResult(_0x2576b8,_0x2dc27f){_0x2dc27f=_0x2dc27f||0xc8;return function(_0x20c394){if(_0x20c394){return _0x2576b8[_0x258a('0x1e')](_0x2dc27f)[_0x258a('0x1f')](_0x20c394);}};}function respondWithFilteredResult(_0x39a85b,_0x3081d5){return function(_0x23d8d7){if(_0x23d8d7){var _0x21685f=typeof _0x3081d5[_0x258a('0x20')]==='undefined'&&typeof _0x3081d5['limit']===_0x258a('0x21');var _0x56e61f=_0x23d8d7[_0x258a('0x22')];var _0xb9ca89=_0x21685f?0x0:_0x3081d5[_0x258a('0x20')];var _0xa19b8f=_0x21685f?_0x23d8d7[_0x258a('0x22')]:_0x3081d5[_0x258a('0x20')]+_0x3081d5[_0x258a('0x23')];var _0x398012;if(_0xa19b8f>=_0x56e61f){_0xa19b8f=_0x56e61f;_0x398012=0xc8;}else{_0x398012=0xce;}_0x39a85b['status'](_0x398012);return _0x39a85b[_0x258a('0x24')]('Content-Range',_0xb9ca89+'-'+_0xa19b8f+'/'+_0x56e61f)['json'](_0x23d8d7);}return null;};}function saveUpdates(_0x2e0aee){return function(_0xc5f08){if(_0xc5f08){return _0xc5f08[_0x258a('0x25')](_0x2e0aee)[_0x258a('0x12')](function(_0x33ee63){return _0x33ee63;});}return null;};}function removeEntity(_0x507bce){return function(_0x241f42){if(_0x241f42){return _0x241f42[_0x258a('0x26')]()[_0x258a('0x12')](function(){var _0x23ad7a=_0x241f42[_0x258a('0x27')]({'plain':!![]});var _0x1c4b3a=_0x258a('0x28');return db[_0x258a('0x29')][_0x258a('0x26')]({'where':{'type':_0x1c4b3a,'resourceId':_0x23ad7a['id']}})[_0x258a('0x12')](function(){return _0x241f42;});})[_0x258a('0x12')](function(){_0x507bce['status'](0xcc)[_0x258a('0x2a')]();});}};}function handleEntityNotFound(_0x2607f2){return function(_0x500c4a){if(!_0x500c4a){_0x2607f2[_0x258a('0x2b')](0x194);}return _0x500c4a;};}function handleError(_0x410d5c,_0x5cdde9){_0x5cdde9=_0x5cdde9||0x1f4;return function(_0x4b05b5){logger[_0x258a('0x19')](_0x4b05b5['stack']);if(_0x4b05b5[_0x258a('0x2c')]){delete _0x4b05b5[_0x258a('0x2c')];}_0x410d5c['status'](_0x5cdde9)[_0x258a('0x2d')](_0x4b05b5);};}function getImapHost(_0x4410dd){switch(_0x4410dd){case _0x258a('0x2e'):return _0x258a('0x2f');case _0x258a('0x30'):return _0x258a('0x31');case _0x258a('0x32'):return _0x258a('0x33');case _0x258a('0x34'):return'outlook.office365.com';}throw new Error(_0x258a('0x35'),_0x4410dd);}function getSmtpHost(_0x1f5c5c){switch(_0x1f5c5c){case _0x258a('0x2e'):return'smtp.gmail.com';case _0x258a('0x30'):return _0x258a('0x36');case'hotmail':return _0x258a('0x37');case _0x258a('0x34'):return _0x258a('0x38');}throw new Error(_0x258a('0x35'),_0x1f5c5c);}function getAuthenticationOptions(_0x35adb9,_0x1bae36){var _0x1b808d={};var _0x21302a={};if(_0x35adb9){_0x1b808d[_0x258a('0x39')]=_0x21302a[_0x258a('0x39')]=_0x1bae36[_0x258a('0x3a')];_0x1b808d[_0x258a('0x3b')]=_0x21302a[_0x258a('0x3c')]=_0x1bae36[_0x258a('0x3b')];if(_0x1bae36[_0x258a('0x3d')]){_0x1b808d[_0x258a('0x3d')]=_0x21302a[_0x258a('0x3d')]=!![];_0x1b808d['CloudProviderId']=_0x21302a['CloudProviderId']=_0x1bae36['CloudProviderId'];_0x1b808d[_0x258a('0x3b')]=_0x21302a['pass']=null;}else{_0x1b808d[_0x258a('0x3e')]=_0x21302a[_0x258a('0x3e')]=null;}_0x1b808d['host']=getImapHost(_0x35adb9);_0x1b808d[_0x258a('0x3f')]=0x3e1;_0x21302a[_0x258a('0x40')]=getSmtpHost(_0x35adb9);_0x21302a[_0x258a('0x3f')]=0x24b;_0x21302a[_0x258a('0x41')]=![];_0x1b808d[_0x258a('0x42')]=_0x21302a[_0x258a('0x42')]=null;}else{if(_0x1bae36[_0x258a('0x43')]){_0x1b808d['user']=_0x21302a[_0x258a('0x39')]=_0x1bae36[_0x258a('0x3a')];_0x1b808d[_0x258a('0x3b')]=_0x21302a[_0x258a('0x3c')]=_0x1bae36[_0x258a('0x3b')];}else{_0x1b808d[_0x258a('0x43')]=_0x21302a['authentication']=![];_0x1b808d[_0x258a('0x39')]=_0x21302a[_0x258a('0x39')]=null;_0x1b808d[_0x258a('0x3b')]=_0x21302a[_0x258a('0x3c')]=null;}_0x1b808d[_0x258a('0x40')]=_0x1bae36[_0x258a('0x44')][_0x258a('0x40')];_0x1b808d[_0x258a('0x3f')]=_0x1bae36[_0x258a('0x44')][_0x258a('0x3f')];_0x21302a['host']=_0x1bae36[_0x258a('0x45')][_0x258a('0x40')];_0x21302a[_0x258a('0x3f')]=_0x1bae36[_0x258a('0x45')][_0x258a('0x3f')];}return{'Imap':_0x1b808d,'Smtp':_0x21302a};}exports[_0x258a('0x46')]=function(_0x30e811,_0x229217){var _0x1f882b={'include':[{'model':db['MailServerIn'],'as':_0x258a('0x44')},{'model':db['MailServerOut'],'as':_0x258a('0x45')},{'model':db[_0x258a('0x47')],'as':_0x258a('0x48')}]},_0x162957={},_0x113005={'count':0x0,'rows':[]};var _0x5ef6f7=_[_0x258a('0x49')](db[_0x258a('0x4a')][_0x258a('0x4b')],function(_0x4c2a3a){return{'name':_0x4c2a3a[_0x258a('0x4c')],'type':_0x4c2a3a['type'][_0x258a('0x4d')]};});_0x162957[_0x258a('0x4e')]=_[_0x258a('0x49')](_0x5ef6f7,_0x258a('0x2c'));_0x162957[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x30e811[_0x258a('0x4f')]);_0x162957[_0x258a('0x51')]=_[_0x258a('0x52')](_0x162957[_0x258a('0x4e')],_0x162957['query']);_0x1f882b[_0x258a('0x53')]=_['intersection'](_0x162957[_0x258a('0x4e')],qs['fields'](_0x30e811[_0x258a('0x4f')][_0x258a('0x54')]));_0x1f882b[_0x258a('0x53')]=_0x1f882b[_0x258a('0x53')][_0x258a('0x55')]?_0x1f882b[_0x258a('0x53')]:_0x162957[_0x258a('0x4e')];if(!_0x30e811[_0x258a('0x4f')][_0x258a('0x56')](_0x258a('0x57'))){_0x1f882b['limit']=qs[_0x258a('0x23')](_0x30e811['query']['limit']);_0x1f882b[_0x258a('0x20')]=qs[_0x258a('0x20')](_0x30e811[_0x258a('0x4f')][_0x258a('0x20')]);}_0x1f882b[_0x258a('0x58')]=qs['sort'](_0x30e811[_0x258a('0x4f')][_0x258a('0x59')]);_0x1f882b[_0x258a('0x5a')]=qs[_0x258a('0x51')](_['pick'](_0x30e811[_0x258a('0x4f')],_0x162957[_0x258a('0x51')]),_0x5ef6f7);if(_0x30e811[_0x258a('0x4f')][_0x258a('0x5b')]){_0x1f882b[_0x258a('0x5a')]=_['merge'](_0x1f882b[_0x258a('0x5a')],{'$or':_['map'](_0x5ef6f7,function(_0x29b8c9){if(_0x29b8c9[_0x258a('0x5c')]!==_0x258a('0x5d')){var _0x559e57={};_0x559e57[_0x29b8c9[_0x258a('0x2c')]]={'$like':'%'+_0x30e811[_0x258a('0x4f')][_0x258a('0x5b')]+'%'};return _0x559e57;}})});}_0x1f882b=_[_0x258a('0x5e')]({},_0x1f882b,_0x30e811[_0x258a('0x5f')]);var _0x218f13={'where':_0x1f882b['where']};return db[_0x258a('0x4a')][_0x258a('0x22')](_0x218f13)['then'](function(_0x50c613){_0x113005['count']=_0x50c613;if(_0x30e811[_0x258a('0x4f')][_0x258a('0x60')]){_0x1f882b[_0x258a('0x61')]=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x1f882b);})[_0x258a('0x12')](function(_0x2878ca){_0x113005['rows']=_0x2878ca;return _0x113005;})['then'](respondWithFilteredResult(_0x229217,_0x1f882b))[_0x258a('0x1d')](handleError(_0x229217,null));};exports[_0x258a('0x62')]=function(_0x4a6af5,_0x14854e){var _0x298245={'raw':![],'where':{'id':_0x4a6af5['params']['id']},'include':[{'model':db[_0x258a('0x63')],'as':_0x258a('0x44')},{'model':db[_0x258a('0x64')],'as':_0x258a('0x45')},{'model':db[_0x258a('0x47')],'as':'mandatoryDispositionPause'}]},_0xaed865={};_0xaed865['model']=_[_0x258a('0x50')](db[_0x258a('0x4a')][_0x258a('0x4b')]);_0xaed865[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x4a6af5[_0x258a('0x4f')]);_0xaed865[_0x258a('0x51')]=_[_0x258a('0x52')](_0xaed865[_0x258a('0x4e')],_0xaed865[_0x258a('0x4f')]);_0x298245[_0x258a('0x53')]=_[_0x258a('0x52')](_0xaed865[_0x258a('0x4e')],qs[_0x258a('0x54')](_0x4a6af5['query'][_0x258a('0x54')]));_0x298245[_0x258a('0x53')]=_0x298245[_0x258a('0x53')][_0x258a('0x55')]?_0x298245[_0x258a('0x53')]:_0xaed865[_0x258a('0x4e')];if(_0x4a6af5[_0x258a('0x4f')]['includeAll']){_0x298245['include']=[{'all':!![]}];}_0x298245=_[_0x258a('0x5e')]({},_0x298245,_0x4a6af5[_0x258a('0x5f')]);return db[_0x258a('0x4a')][_0x258a('0x65')](_0x298245)['then'](handleEntityNotFound(_0x14854e,null))['then'](respondWithResult(_0x14854e,null))['catch'](handleError(_0x14854e,null));};exports[_0x258a('0x25')]=function(_0x3b8d48,_0x50b093){if(_0x3b8d48[_0x258a('0x66')]['id']){delete _0x3b8d48['body']['id'];}var _0x1c8629=_0x3b8d48[_0x258a('0x66')][_0x258a('0x67')]==='custom'?null:_0x3b8d48[_0x258a('0x66')][_0x258a('0x67')];var _0x5d0d53=_0x3b8d48[_0x258a('0x66')][_0x258a('0x44')]||{};var _0x3c9349=_0x3b8d48[_0x258a('0x66')][_0x258a('0x45')]||{};if(_0x1c8629){_0x5d0d53[_0x258a('0x40')]=getImapHost(_0x1c8629);_0x5d0d53['port']=0x3e1;_0x3c9349[_0x258a('0x40')]=getSmtpHost(_0x1c8629);_0x3c9349['port']=0x24b;_0x3c9349[_0x258a('0x41')]=![];}if(_0x3c9349[_0x258a('0x3d')]){_0x3c9349[_0x258a('0x41')]=![];}else{_0x3c9349[_0x258a('0x3e')]=null;}if(!_0x5d0d53['modernAuthentication'])_0x5d0d53[_0x258a('0x3e')]=null;_0x3b8d48['body'][_0x258a('0x44')]=_0x5d0d53;_0x3b8d48[_0x258a('0x66')][_0x258a('0x45')]=_0x3c9349;return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x3b8d48[_0x258a('0x68')]['id']},'include':[{'model':db[_0x258a('0x63')],'as':_0x258a('0x44')},{'model':db[_0x258a('0x64')],'as':'Smtp'},{'model':db[_0x258a('0x47')],'as':_0x258a('0x48')}]})[_0x258a('0x12')](handleEntityNotFound(_0x50b093,null))[_0x258a('0x12')](function(_0x3463b6){if(!_0x3463b6)throw new Error(_0x258a('0x69'));if(_0x3463b6[_0x258a('0x42')])delete _0x3b8d48[_0x258a('0x66')][_0x258a('0x44')];return _0x3463b6;})[_0x258a('0x12')](saveUpdates(_0x3b8d48[_0x258a('0x66')],null))[_0x258a('0x12')](function(_0x2b5c8f){if(!_0x3b8d48[_0x258a('0x66')][_0x258a('0x44')])return _0x2b5c8f;return db['MailServerIn']['update'](_0x3b8d48[_0x258a('0x66')][_0x258a('0x44')],{'where':{'MailAccountId':_0x2b5c8f['id']}})[_0x258a('0x12')](function(){return _0x2b5c8f;});})[_0x258a('0x12')](function(_0x53be52){if(!_0x3b8d48[_0x258a('0x66')][_0x258a('0x45')])return _0x53be52;return db[_0x258a('0x64')][_0x258a('0x25')](_0x3b8d48[_0x258a('0x66')][_0x258a('0x45')],{'where':{'MailAccountId':_0x53be52['id']}})[_0x258a('0x12')](function(){return _0x53be52;});})[_0x258a('0x12')](respondWithResult(_0x50b093,null))['catch'](handleError(_0x50b093,null));};exports[_0x258a('0x6a')]=function(_0xbef4b4,_0x34a723){return db[_0x258a('0x4a')]['describe']()[_0x258a('0x12')](respondWithResult(_0x34a723,null))[_0x258a('0x1d')](handleError(_0x34a723,null));};exports['addDisposition']=function(_0x1205fd,_0x48e989){if(_0x1205fd[_0x258a('0x66')]['id']){delete _0x1205fd[_0x258a('0x66')]['id'];}return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x1205fd[_0x258a('0x68')]['id']}})['then'](handleEntityNotFound(_0x48e989,null))['then'](function(_0x4f5535){if(_0x4f5535){_0x1205fd['body'][_0x258a('0x6b')]=_0x4f5535['id'];return db[_0x258a('0x6c')][_0x258a('0x6d')](_0x1205fd[_0x258a('0x66')]);}})[_0x258a('0x12')](respondWithResult(_0x48e989,null))['catch'](handleError(_0x48e989,null));};exports[_0x258a('0x6e')]=function(_0x60994c,_0x143db9){var _0xbd1813={'raw':![],'where':{}};var _0x1b1bd2={};var _0x54a844={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x60994c[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x143db9,null))[_0x258a('0x12')](function(_0x1567b7){if(_0x1567b7){_0x1b1bd2[_0x258a('0x4e')]=_[_0x258a('0x50')](db[_0x258a('0x6c')][_0x258a('0x4b')]);_0x1b1bd2[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x60994c[_0x258a('0x4f')]);_0x1b1bd2[_0x258a('0x51')]=_[_0x258a('0x52')](_0x1b1bd2[_0x258a('0x4e')],_0x1b1bd2[_0x258a('0x4f')]);_0xbd1813[_0x258a('0x53')]=_['intersection'](_0x1b1bd2[_0x258a('0x4e')],qs[_0x258a('0x54')](_0x60994c[_0x258a('0x4f')][_0x258a('0x54')]));_0xbd1813[_0x258a('0x53')]=_0xbd1813[_0x258a('0x53')][_0x258a('0x55')]?_0xbd1813['attributes']:_0x1b1bd2[_0x258a('0x4e')];if(!_0x60994c['query'][_0x258a('0x56')](_0x258a('0x57'))){_0xbd1813[_0x258a('0x23')]=qs['limit'](_0x60994c[_0x258a('0x4f')][_0x258a('0x23')]);_0xbd1813[_0x258a('0x20')]=qs[_0x258a('0x20')](_0x60994c['query']['offset']);}_0xbd1813[_0x258a('0x58')]=qs['sort'](_0x60994c[_0x258a('0x4f')][_0x258a('0x59')]);_0xbd1813['where']=qs[_0x258a('0x51')](_[_0x258a('0x6f')](_0x60994c[_0x258a('0x4f')],_0x1b1bd2[_0x258a('0x51')]));_0xbd1813['where'][_0x258a('0x6b')]=_0x1567b7['id'];if(_0x60994c['query']['filter']){_0xbd1813['where']=_[_0x258a('0x5e')](_0xbd1813['where'],{'$or':_[_0x258a('0x49')](_0xbd1813[_0x258a('0x53')],function(_0x138f86){var _0x272729={};_0x272729[_0x138f86]={'$like':'%'+_0x60994c['query'][_0x258a('0x5b')]+'%'};return _0x272729;})});}_0xbd1813=_[_0x258a('0x5e')]({},_0xbd1813,_0x60994c[_0x258a('0x5f')]);return db['Disposition'][_0x258a('0x22')]({'where':_0xbd1813[_0x258a('0x5a')]})['then'](function(_0x1f4fe8){_0x54a844[_0x258a('0x22')]=_0x1f4fe8;if(_0x60994c[_0x258a('0x4f')][_0x258a('0x60')]){_0xbd1813[_0x258a('0x61')]=[{'all':!![]}];}return db['Disposition'][_0x258a('0x70')](_0xbd1813);})['then'](function(_0x58241b){_0x54a844['rows']=_0x58241b;return _0x54a844;});}})[_0x258a('0x12')](respondWithFilteredResult(_0x143db9,_0xbd1813))[_0x258a('0x1d')](handleError(_0x143db9,null));};exports['removeDispositions']=function(_0x252e99,_0x4a93f9){return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x252e99[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x4a93f9,null))['then'](function(_0x305ddb){if(_0x305ddb){return _0x305ddb[_0x258a('0x71')](_0x252e99[_0x258a('0x4f')]['ids']);}})[_0x258a('0x12')](respondWithStatusCode(_0x4a93f9,null))[_0x258a('0x1d')](handleError(_0x4a93f9,null));};exports[_0x258a('0x72')]=function(_0x1fa8ac,_0x5bac92){if(_0x1fa8ac[_0x258a('0x66')]['id']){delete _0x1fa8ac[_0x258a('0x66')]['id'];}return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x1fa8ac[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x5bac92,null))[_0x258a('0x12')](function(_0x449eb7){if(_0x449eb7){_0x1fa8ac[_0x258a('0x66')][_0x258a('0x6b')]=_0x449eb7['id'];return db[_0x258a('0x73')][_0x258a('0x6d')](_0x1fa8ac['body']);}})[_0x258a('0x12')](respondWithResult(_0x5bac92,null))[_0x258a('0x1d')](handleError(_0x5bac92,null));};exports[_0x258a('0x74')]=function(_0x1efc71,_0x5a8fd4){var _0x3aca25={'raw':![],'where':{}};var _0x14136a={};var _0x262cb7={'count':0x0,'rows':[]};return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x1efc71['params']['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x5a8fd4,null))[_0x258a('0x12')](function(_0x32fbdc){if(_0x32fbdc){_0x14136a[_0x258a('0x4e')]=_[_0x258a('0x50')](db['CannedAnswer'][_0x258a('0x4b')]);_0x14136a[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x1efc71[_0x258a('0x4f')]);_0x14136a[_0x258a('0x51')]=_['intersection'](_0x14136a[_0x258a('0x4e')],_0x14136a[_0x258a('0x4f')]);_0x3aca25[_0x258a('0x53')]=_[_0x258a('0x52')](_0x14136a[_0x258a('0x4e')],qs[_0x258a('0x54')](_0x1efc71[_0x258a('0x4f')][_0x258a('0x54')]));_0x3aca25[_0x258a('0x53')]=_0x3aca25[_0x258a('0x53')][_0x258a('0x55')]?_0x3aca25[_0x258a('0x53')]:_0x14136a[_0x258a('0x4e')];if(!_0x1efc71[_0x258a('0x4f')][_0x258a('0x56')]('nolimit')){_0x3aca25[_0x258a('0x23')]=qs[_0x258a('0x23')](_0x1efc71[_0x258a('0x4f')][_0x258a('0x23')]);_0x3aca25['offset']=qs[_0x258a('0x20')](_0x1efc71[_0x258a('0x4f')][_0x258a('0x20')]);}_0x3aca25[_0x258a('0x58')]=qs[_0x258a('0x59')](_0x1efc71[_0x258a('0x4f')][_0x258a('0x59')]);_0x3aca25[_0x258a('0x5a')]=qs['filters'](_['pick'](_0x1efc71[_0x258a('0x4f')],_0x14136a[_0x258a('0x51')]));_0x3aca25[_0x258a('0x5a')][_0x258a('0x6b')]=_0x32fbdc['id'];if(_0x1efc71[_0x258a('0x4f')][_0x258a('0x5b')]){_0x3aca25[_0x258a('0x5a')]=_['merge'](_0x3aca25['where'],{'$or':_[_0x258a('0x49')](_0x3aca25[_0x258a('0x53')],function(_0x50a70b){var _0x464ced={};_0x464ced[_0x50a70b]={'$like':'%'+_0x1efc71['query'][_0x258a('0x5b')]+'%'};return _0x464ced;})});}_0x3aca25=_[_0x258a('0x5e')]({},_0x3aca25,_0x1efc71[_0x258a('0x5f')]);return db['CannedAnswer'][_0x258a('0x22')]({'where':_0x3aca25['where']})['then'](function(_0x5c53a1){_0x262cb7[_0x258a('0x22')]=_0x5c53a1;if(_0x1efc71[_0x258a('0x4f')][_0x258a('0x60')]){_0x3aca25[_0x258a('0x61')]=[{'all':!![]}];}return db[_0x258a('0x73')][_0x258a('0x70')](_0x3aca25);})[_0x258a('0x12')](function(_0x308393){_0x262cb7['rows']=_0x308393;return _0x262cb7;});}})[_0x258a('0x12')](respondWithFilteredResult(_0x5a8fd4,_0x3aca25))['catch'](handleError(_0x5a8fd4,null));};exports[_0x258a('0x76')]=function(_0x13d2ad,_0x3c8991){return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x13d2ad[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x3c8991,null))[_0x258a('0x12')](function(_0x596ae7){if(_0x596ae7){return _0x596ae7['removeAnswers'](_0x13d2ad['query'][_0x258a('0x77')]);}})[_0x258a('0x12')](respondWithStatusCode(_0x3c8991,null))[_0x258a('0x1d')](handleError(_0x3c8991,null));};exports[_0x258a('0x6d')]=function(_0x2ee6bf,_0x46135a){var _0x39bb2c={'name':_0x2ee6bf[_0x258a('0x66')]['name'],'key':_0x2ee6bf[_0x258a('0x66')][_0x258a('0x4d')],'provider':_0x2ee6bf[_0x258a('0x66')][_0x258a('0x67')]===_0x258a('0x78')?null:_0x2ee6bf[_0x258a('0x66')][_0x258a('0x67')],'email':_0x2ee6bf[_0x258a('0x66')][_0x258a('0x79')],'ListId':_0x2ee6bf[_0x258a('0x66')][_0x258a('0x7a')],'active':!_[_0x258a('0x7b')](_0x2ee6bf['body']['active'])?_0x2ee6bf[_0x258a('0x66')][_0x258a('0x7c')]:!![],'description':_0x2ee6bf['body'][_0x258a('0x7d')]||null};var _0x45d189=getAuthenticationOptions(_0x39bb2c[_0x258a('0x67')],_0x2ee6bf[_0x258a('0x66')]);_0x39bb2c[_0x258a('0x44')]=_0x45d189[_0x258a('0x44')];_0x39bb2c['Smtp']=_0x45d189[_0x258a('0x45')];return db['MailAccount']['create'](_0x39bb2c,{'include':[{'model':db[_0x258a('0x64')],'as':_0x258a('0x45')},{'model':db[_0x258a('0x63')],'as':_0x258a('0x44')}]})[_0x258a('0x12')](function(_0x13ec16){var _0x3d0bdb=_0x2ee6bf[_0x258a('0x39')][_0x258a('0x27')]({'plain':!![]});if(!_0x3d0bdb)throw new Error(_0x258a('0x7e'));if(_0x3d0bdb[_0x258a('0x7f')]==='user'){var _0x411a42=_0x13ec16[_0x258a('0x27')]({'plain':!![]});return db[_0x258a('0x80')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x3d0bdb['userProfileId']},'raw':!![]})[_0x258a('0x12')](function(_0x227a07){if(_0x227a07&&_0x227a07[_0x258a('0x81')]===0x0){return db[_0x258a('0x29')]['create']({'name':_0x411a42[_0x258a('0x2c')],'resourceId':_0x411a42['id'],'type':_0x227a07[_0x258a('0x2c')],'sectionId':_0x227a07['id']},{})[_0x258a('0x12')](function(){return _0x13ec16;});}else{return _0x13ec16;}})['catch'](function(_0x19015c){logger[_0x258a('0x19')](_0x258a('0x82'),_0x19015c);throw _0x19015c;});}return _0x13ec16;})['then'](respondWithResult(_0x46135a,0xc9))['catch'](handleError(_0x46135a,null));};exports[_0x258a('0x83')]=function(_0x571f3f,_0x5a1059){return db[_0x258a('0x4a')]['findOne']({'where':{'id':_0x571f3f['params']['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x5a1059,null))[_0x258a('0x12')](function(_0x893fbb){if(_0x893fbb){return _0x893fbb[_0x258a('0x83')]();}return null;})[_0x258a('0x12')](respondWithResult(_0x5a1059,null))[_0x258a('0x1d')](handleError(_0x5a1059,null));};exports['addImap']=function(_0x1db45e,_0x1ba438){if(_0x1db45e[_0x258a('0x66')]['id']){delete _0x1db45e[_0x258a('0x66')]['id'];}return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x1db45e[_0x258a('0x68')]['id']}})['then'](handleEntityNotFound(_0x1ba438,null))[_0x258a('0x12')](function(_0xb8d630){if(_0xb8d630){_0x1db45e['body'][_0x258a('0x6b')]=_0xb8d630['id'];return db[_0x258a('0x63')][_0x258a('0x6d')](_0x1db45e[_0x258a('0x66')]);}})['then'](respondWithResult(_0x1ba438,null))[_0x258a('0x1d')](handleError(_0x1ba438,null));};exports[_0x258a('0x84')]=function(_0x50c600,_0x3e12d4){return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x50c600[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x3e12d4,null))[_0x258a('0x12')](function(_0x14b710){if(_0x14b710){return _0x14b710[_0x258a('0x85')](null);}return null;})[_0x258a('0x12')](respondWithStatusCode(_0x3e12d4,null))[_0x258a('0x1d')](handleError(_0x3e12d4,null));};exports['getSmtp']=function(_0x14e26c,_0x4d2b17){return db['MailAccount'][_0x258a('0x75')]({'where':{'id':_0x14e26c[_0x258a('0x68')]['id']}})['then'](handleEntityNotFound(_0x4d2b17,null))['then'](function(_0x5d6ad5){if(_0x5d6ad5){return _0x5d6ad5[_0x258a('0x86')]();}return null;})[_0x258a('0x12')](respondWithResult(_0x4d2b17,null))['catch'](handleError(_0x4d2b17,null));};exports[_0x258a('0x87')]=function(_0x42de1e,_0x265a7e){if(_0x42de1e[_0x258a('0x66')]['id']){delete _0x42de1e[_0x258a('0x66')]['id'];}return db[_0x258a('0x4a')]['find']({'where':{'id':_0x42de1e[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x265a7e,null))[_0x258a('0x12')](function(_0x513050){if(_0x513050){_0x42de1e[_0x258a('0x66')][_0x258a('0x6b')]=_0x513050['id'];return db['MailServerOut'][_0x258a('0x6d')](_0x42de1e[_0x258a('0x66')]);}})['then'](respondWithResult(_0x265a7e,null))['catch'](handleError(_0x265a7e,null));};exports[_0x258a('0x88')]=function(_0x45f857,_0x319a9f){return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x45f857[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x319a9f,null))[_0x258a('0x12')](function(_0x4792f8){if(_0x4792f8){return _0x4792f8[_0x258a('0x89')](null);}return null;})[_0x258a('0x12')](respondWithStatusCode(_0x319a9f,null))[_0x258a('0x1d')](handleError(_0x319a9f,null));};exports[_0x258a('0x8a')]=function(_0x1b9dd3,_0xcb5ead){return db['MailInteraction'][_0x258a('0x65')]({'where':{'id':_0x1b9dd3[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0xcb5ead,null))[_0x258a('0x12')](function(_0x2b7ad1){if(_0x2b7ad1){return _0x2b7ad1[_0x258a('0x8a')](_0x1b9dd3[_0x258a('0x66')][_0x258a('0x77')],_[_0x258a('0x8b')](_0x1b9dd3[_0x258a('0x66')],[_0x258a('0x77'),'id'])||{});}})['then'](respondWithResult(_0xcb5ead,null))[_0x258a('0x1d')](handleError(_0xcb5ead,null));};exports[_0x258a('0x8c')]=function(_0x36deb5,_0x3cb2af){var _0x2ddd45={'raw':![],'where':{}};var _0x3983f6={};var _0x5163e3={'count':0x0,'rows':[]};return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x36deb5[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x3cb2af,null))[_0x258a('0x12')](function(_0xadc2f7){if(_0xadc2f7){_0x3983f6[_0x258a('0x4e')]=_[_0x258a('0x50')](db[_0x258a('0x8d')][_0x258a('0x4b')]);_0x3983f6[_0x258a('0x4f')]=_['keys'](_0x36deb5[_0x258a('0x4f')]);_0x3983f6[_0x258a('0x51')]=_[_0x258a('0x52')](_0x3983f6[_0x258a('0x4e')],_0x3983f6['query']);_0x2ddd45[_0x258a('0x53')]=_[_0x258a('0x52')](_0x3983f6[_0x258a('0x4e')],qs[_0x258a('0x54')](_0x36deb5['query'][_0x258a('0x54')]));_0x2ddd45[_0x258a('0x53')]=_0x2ddd45['attributes'][_0x258a('0x55')]?_0x2ddd45['attributes']:_0x3983f6['model'];if(!_0x36deb5[_0x258a('0x4f')]['hasOwnProperty']('nolimit')){_0x2ddd45[_0x258a('0x23')]=qs[_0x258a('0x23')](_0x36deb5[_0x258a('0x4f')][_0x258a('0x23')]);_0x2ddd45[_0x258a('0x20')]=qs[_0x258a('0x20')](_0x36deb5[_0x258a('0x4f')][_0x258a('0x20')]);}_0x2ddd45[_0x258a('0x58')]=qs[_0x258a('0x59')](_0x36deb5[_0x258a('0x4f')][_0x258a('0x59')]);_0x2ddd45[_0x258a('0x5a')]=qs[_0x258a('0x51')](_['pick'](_0x36deb5['query'],_0x3983f6['filters']));_0x2ddd45[_0x258a('0x5a')]['MailAccountId']=_0xadc2f7['id'];if(_0x36deb5[_0x258a('0x4f')]['filter']){_0x2ddd45[_0x258a('0x5a')]=_['merge'](_0x2ddd45['where'],{'$or':_[_0x258a('0x49')](_0x2ddd45[_0x258a('0x53')],function(_0x2f0746){var _0x26d27e={};_0x26d27e[_0x2f0746]={'$like':'%'+_0x36deb5[_0x258a('0x4f')]['filter']+'%'};return _0x26d27e;})});}_0x2ddd45=_['merge']({},_0x2ddd45,_0x36deb5['options']);return db[_0x258a('0x8d')][_0x258a('0x22')]({'where':_0x2ddd45[_0x258a('0x5a')]})[_0x258a('0x12')](function(_0x3a8153){_0x5163e3[_0x258a('0x22')]=_0x3a8153;if(_0x36deb5[_0x258a('0x4f')][_0x258a('0x60')]){_0x2ddd45[_0x258a('0x61')]=[{'model':db['CmContact'],'as':_0x258a('0x8e'),'required':![]},{'model':db['User'],'as':_0x258a('0x8f'),'attributes':[_0x258a('0x2c'),'fullname',_0x258a('0x90')],'required':![]},{'model':db[_0x258a('0x91')],'as':_0x258a('0x92'),'attributes':['id',_0x258a('0x2c'),_0x258a('0x93')],'where':_0x36deb5['query'][_0x258a('0x94')]?{'id':_0x36deb5[_0x258a('0x4f')]['tag']}:undefined,'required':_0x36deb5[_0x258a('0x4f')][_0x258a('0x94')]?!![]:![]}];}return db['MailInteraction'][_0x258a('0x70')](_0x2ddd45);})[_0x258a('0x12')](function(_0x53f0ea){_0x5163e3[_0x258a('0x95')]=_0x53f0ea;return _0x5163e3;});}})[_0x258a('0x12')](respondWithFilteredResult(_0x3cb2af,_0x2ddd45))[_0x258a('0x1d')](handleError(_0x3cb2af,null));};exports[_0x258a('0x96')]=function addApplications(_0x3f08b5,_0x5bb88d){var _0x3453c0=_0x3f08b5['params']['id'];var _0x596067=_0x3f08b5['body'];var _0x4c8544=0xc8;var _0xd194f0=null;return db[_0x258a('0x97')][_0x258a('0x98')]({'isolationLevel':db[_0x258a('0x97')][_0x258a('0x99')]['ISOLATION_LEVELS'][_0x258a('0x9a')]},function(_0x1f36eb){return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x3453c0},'transaction':_0x1f36eb})[_0x258a('0x12')](function(_0x135277){if(_0x135277){return db[_0x258a('0x9b')][_0x258a('0x26')]({'where':{'MailAccountId':_0x3453c0},'transaction':_0x1f36eb})[_0x258a('0x12')](function(){var _0x55da14=_[_0x258a('0x49')](_0x596067,function(_0x107c02){_0x107c02['MailAccountId']=_0x3453c0;return _0x107c02;});return db[_0x258a('0x9b')][_0x258a('0x9c')](_0x55da14,{'transaction':_0x1f36eb});});}else{_0x4c8544=0x194;_0xd194f0=[];}});})[_0x258a('0x12')](function(){if(_0x4c8544!==0x194){return db[_0x258a('0x9b')][_0x258a('0x9d')]({'where':{'MailAccountId':_0x3453c0},'order':'priority'})[_0x258a('0x12')](function(_0x1d18b4){_0xd194f0=_0x1d18b4;});}})[_0x258a('0x1d')](function(_0x3e598c){_0x4c8544=0x1f4;logger[_0x258a('0x19')](_0x3e598c[_0x258a('0x9e')]);if(_0x3e598c[_0x258a('0x2c')]){delete _0x3e598c[_0x258a('0x2c')];}_0xd194f0=_0x3e598c;})['finally'](function(){if(_0xd194f0===null){_0x5bb88d[_0x258a('0x2b')](_0x4c8544);}else{if(_0x4c8544===0x1f4){_0x5bb88d[_0x258a('0x1e')](_0x4c8544)['send'](_0xd194f0);}else{_0x5bb88d['status'](_0x4c8544)[_0x258a('0x1f')](_0xd194f0);}}});};exports[_0x258a('0x9f')]=function(_0x4d0d73,_0x491529){var _0x1fd7bf={};var _0x49b0b2={};var _0x4ada89;var _0x245beb;return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x4d0d73[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x491529,null))[_0x258a('0x12')](function(_0x3cba53){if(_0x3cba53){_0x4ada89=_0x3cba53;_0x49b0b2['model']=_[_0x258a('0x50')](db['MailApplication'][_0x258a('0x4b')]);_0x49b0b2[_0x258a('0x4f')]=_['keys'](_0x4d0d73[_0x258a('0x4f')]);_0x49b0b2[_0x258a('0x51')]=_[_0x258a('0x52')](_0x49b0b2[_0x258a('0x4e')],_0x49b0b2[_0x258a('0x4f')]);_0x1fd7bf['attributes']=_['intersection'](_0x49b0b2[_0x258a('0x4e')],qs[_0x258a('0x54')](_0x4d0d73['query'][_0x258a('0x54')]));_0x1fd7bf[_0x258a('0x53')]=_0x1fd7bf[_0x258a('0x53')][_0x258a('0x55')]?_0x1fd7bf[_0x258a('0x53')]:_0x49b0b2[_0x258a('0x4e')];_0x1fd7bf[_0x258a('0x58')]=qs[_0x258a('0x59')](_0x4d0d73[_0x258a('0x4f')][_0x258a('0x59')]);_0x1fd7bf[_0x258a('0x5a')]=qs['filters'](_[_0x258a('0x6f')](_0x4d0d73['query'],_0x49b0b2['filters']));if(_0x4d0d73[_0x258a('0x4f')][_0x258a('0x5b')]){_0x1fd7bf[_0x258a('0x5a')]=_[_0x258a('0x5e')](_0x1fd7bf[_0x258a('0x5a')],{'$or':_[_0x258a('0x49')](_0x1fd7bf[_0x258a('0x53')],function(_0x6339bc){var _0x13ba79={};_0x13ba79[_0x6339bc]={'$like':'%'+_0x4d0d73[_0x258a('0x4f')]['filter']+'%'};return _0x13ba79;})});}_0x1fd7bf=_['merge']({},_0x1fd7bf,_0x4d0d73[_0x258a('0x5f')]);return _0x4ada89['getApplications'](_0x1fd7bf);}})[_0x258a('0x12')](function(_0x5f47a1){if(_0x5f47a1){_0x245beb=_0x5f47a1[_0x258a('0x55')];if(!_0x4d0d73[_0x258a('0x4f')]['hasOwnProperty'](_0x258a('0x57'))){_0x1fd7bf[_0x258a('0x23')]=qs[_0x258a('0x23')](_0x4d0d73[_0x258a('0x4f')][_0x258a('0x23')]);_0x1fd7bf['offset']=qs[_0x258a('0x20')](_0x4d0d73[_0x258a('0x4f')][_0x258a('0x20')]);}return _0x4ada89[_0x258a('0x9f')](_0x1fd7bf);}})[_0x258a('0x12')](function(_0x1cda54){if(_0x1cda54){return _0x1cda54?{'count':_0x245beb,'rows':_0x1cda54}:null;}})[_0x258a('0x12')](respondWithResult(_0x491529,null))[_0x258a('0x1d')](handleError(_0x491529,null));};exports[_0x258a('0xa0')]=function(_0x475372,_0x5a09d3){var _0xd64f23={'raw':!![],'where':{}};var _0x9cbcfb={};var _0x39979a={'count':0x0,'rows':[]};return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x475372[_0x258a('0x68')]['id']}})['then'](handleEntityNotFound(_0x5a09d3,null))[_0x258a('0x12')](function(_0x12332d){if(_0x12332d){_0x9cbcfb['model']=_['keys'](db[_0x258a('0xa1')]['rawAttributes']);_0x9cbcfb[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x475372[_0x258a('0x4f')]);_0x9cbcfb['filters']=_[_0x258a('0x52')](_0x9cbcfb['model'],_0x9cbcfb['query']);_0xd64f23['attributes']=_[_0x258a('0x52')](_0x9cbcfb[_0x258a('0x4e')],qs['fields'](_0x475372[_0x258a('0x4f')][_0x258a('0x54')]));_0xd64f23[_0x258a('0x53')]=_0xd64f23[_0x258a('0x53')]['length']?_0xd64f23[_0x258a('0x53')]:_0x9cbcfb[_0x258a('0x4e')];if(!_0x475372[_0x258a('0x4f')][_0x258a('0x56')](_0x258a('0x57'))){_0xd64f23[_0x258a('0x23')]=qs[_0x258a('0x23')](_0x475372[_0x258a('0x4f')][_0x258a('0x23')]);_0xd64f23[_0x258a('0x20')]=qs['offset'](_0x475372['query']['offset']);}_0xd64f23[_0x258a('0x58')]=qs[_0x258a('0x59')](_0x475372[_0x258a('0x4f')][_0x258a('0x59')]);_0xd64f23[_0x258a('0x5a')]=qs[_0x258a('0x51')](_[_0x258a('0x6f')](_0x475372['query'],_0x9cbcfb[_0x258a('0x51')]));_0xd64f23[_0x258a('0x5a')][_0x258a('0x6b')]=_0x12332d['id'];if(_0x475372['query'][_0x258a('0x5b')]){_0xd64f23[_0x258a('0x5a')]=_[_0x258a('0x5e')](_0xd64f23[_0x258a('0x5a')],{'$or':_[_0x258a('0x49')](_0xd64f23[_0x258a('0x53')],function(_0x254711){var _0x94bdf7={};_0x94bdf7[_0x254711]={'$like':'%'+_0x475372['query']['filter']+'%'};return _0x94bdf7;})});}if(_0x475372[_0x258a('0x4f')][_0x258a('0xa2')]){var _0x2f73d2=_0x475372[_0x258a('0x4f')][_0x258a('0xa2')][_0x258a('0xa3')](',');var _0x184c03={};_0x184c03[_0x2f73d2[0x0]]={'$gte':moment(_0x2f73d2[0x1])[_0x258a('0xa4')](_0x258a('0xa5'))};_0xd64f23[_0x258a('0x5a')]=_[_0x258a('0x5e')](_0xd64f23[_0x258a('0x5a')],_0x184c03);}_0xd64f23=_[_0x258a('0x5e')]({},_0xd64f23,_0x475372[_0x258a('0x5f')]);return db[_0x258a('0xa1')]['count']({'where':_0xd64f23[_0x258a('0x5a')]})[_0x258a('0x12')](function(_0x97aa62){_0x39979a[_0x258a('0x22')]=_0x97aa62;if(_0x475372['query'][_0x258a('0x60')]){_0xd64f23['include']=[{'all':!![]}];}return db[_0x258a('0xa1')]['findAll'](_0xd64f23);})[_0x258a('0x12')](function(_0x5f01e6){if(_0x475372['query'][_0x258a('0xa6')]===_0x258a('0xa7')){for(var _0x275c5d=0x0;_0x275c5d<_0x5f01e6[_0x258a('0x55')];_0x275c5d++){_0x5f01e6[_0x275c5d][_0x258a('0x66')]=juice(_0x5f01e6[_0x275c5d]['body']);}}_0x39979a[_0x258a('0x95')]=_0x5f01e6;return _0x39979a;});}})[_0x258a('0x12')](respondWithFilteredResult(_0x5a09d3,_0xd64f23))[_0x258a('0x1d')](handleError(_0x5a09d3,null));};exports[_0x258a('0x2d')]=function(_0x2cc148,_0x4130a8){var _0x5e045d,_0x2a2da0={},_0x1aa38c;if(_0x2cc148[_0x258a('0x66')]['to']){_0x1aa38c=_0x2cc148['body']['to'][_0x258a('0xa3')](',')[0x0];}return db['MailAccount'][_0x258a('0x65')]({'where':{'id':_0x2cc148[_0x258a('0x68')]['id']},'include':[{'model':db[_0x258a('0xa8')],'as':_0x258a('0xa9'),'include':[{'model':db[_0x258a('0xaa')],'as':_0x258a('0xab'),'where':{'email':_0x1aa38c},'limit':0x1,'order':[[_0x258a('0xac'),'DESC']]}]},{'model':db[_0x258a('0x64')],'as':_0x258a('0x45'),'raw':!![],'include':[{'model':db[_0x258a('0xad')],'as':_0x258a('0xad'),'raw':!![]}]}]})[_0x258a('0x12')](handleEntityNotFound(_0x4130a8,null))[_0x258a('0x12')](function(_0x42deb6){if(!_0x42deb6)return;_0x5e045d=_0x42deb6;if(!_0x42deb6[_0x258a('0x45')])throw new Error(_0x258a('0xae'));if(_[_0x258a('0x7b')](_0x2cc148['body'][_0x258a('0xaf')])){_0x2cc148[_0x258a('0x66')][_0x258a('0xaf')]=util[_0x258a('0xa4')](_0x258a('0xb0'),_0x42deb6[_0x258a('0x2c')],_0x42deb6[_0x258a('0x79')]||_0x42deb6[_0x258a('0x45')][_0x258a('0x39')]);}if(_0x2cc148[_0x258a('0x66')][_0x258a('0xb1')]&&_0x2cc148[_0x258a('0x66')][_0x258a('0xb1')][_0x258a('0x55')]){for(var _0x2c4a9a=0x0;_0x2c4a9a<_0x2cc148['body'][_0x258a('0xb1')][_0x258a('0x55')];_0x2c4a9a+=0x1){_0x2cc148[_0x258a('0x66')][_0x258a('0xb1')][_0x2c4a9a]={'filename':_0x2cc148[_0x258a('0x66')]['attachments'][_0x2c4a9a]['name'],'path':path[_0x258a('0xb2')](config[_0x258a('0xb3')],_0x258a('0xb4'),_0x2cc148[_0x258a('0x66')][_0x258a('0xb1')][_0x2c4a9a]['basename'])};}}var _0x424cde=_0x42deb6[_0x258a('0xb5')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x424cde,'message':_0x2cc148[_0x258a('0x66')]});})['then'](function(_0x4f7a28){if(!_0x4f7a28)return;_0x2a2da0=_0x4f7a28;if(!_0x5e045d[_0x258a('0xa9')])throw new Error(_0x258a('0xb6'));if(_0x5e045d['List']['Contacts']['length'])return _0x5e045d['List']['Contacts'][0x0];return db[_0x258a('0xaa')][_0x258a('0x6d')](_[_0x258a('0x9')](_0x2cc148[_0x258a('0x66')],{'firstName':_0x2cc148[_0x258a('0x66')]['to'],'email':_0x2cc148[_0x258a('0x66')]['to'],'phone':_0x2cc148['body']['to'],'ListId':_0x5e045d['ListId']}));})[_0x258a('0x12')](function(_0xfc5732){if(!_0xfc5732)return;var _0x1e8fb5={'UserId':_0x2cc148[_0x258a('0x39')]['id'],'ContactId':_0xfc5732['id'],'MailAccountId':_0x5e045d['id'],'inReplyTo':_0x2a2da0[_0x258a('0xb7')],'to':_0x2cc148[_0x258a('0x66')]['from'],'cc':_0x2cc148[_0x258a('0x66')]['cc'],'subject':_0x2cc148[_0x258a('0x66')][_0x258a('0xb8')],'attach':_0x2cc148[_0x258a('0x66')][_0x258a('0xb9')],'firstMsgDirection':_0x258a('0xba'),'lastMsgAt':moment()[_0x258a('0xa4')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0x258a('0x5e')](_0x2cc148[_0x258a('0x66')],{'messageId':_0x2a2da0[_0x258a('0xb7')],'sentAt':moment()[_0x258a('0xa4')](_0x258a('0xa5')),'read':!![],'MailAccountId':_0x5e045d['id'],'UserId':_0x2cc148[_0x258a('0x39')]['id'],'ContactId':_0xfc5732['id']})]};if(_0x2cc148['body']['Interaction']){_0x1e8fb5=_[_0x258a('0x5e')](_0x1e8fb5,_0x2cc148[_0x258a('0x66')]['Interaction']);}return db[_0x258a('0x8d')][_0x258a('0x6d')](_0x1e8fb5,{'include':[{'model':db[_0x258a('0xa1')],'as':'Messages'}]});})['then'](respondWithResult(_0x4130a8,null))['catch'](handleError(_0x4130a8,null));};exports[_0x258a('0xbb')]=function(_0x31dbd8,_0x2332f8){return db['MailAccount'][_0x258a('0x65')]({'where':{'id':_0x31dbd8['params']['id']},'include':[{'model':db[_0x258a('0x64')],'as':_0x258a('0x45'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x258a('0xad'),'raw':!![]}]}]})[_0x258a('0x12')](handleEntityNotFound(_0x2332f8,null))[_0x258a('0x12')](function(_0x45b364){if(!_0x45b364['Smtp'])return;var _0x4500a4=_0x45b364[_0x258a('0xb5')]();return respondWithRpcPromise('VerifySmtp',_0x258a('0xbb'),{'account':_0x4500a4});})['then'](respondWithResult(_0x2332f8,null))['catch'](handleError(_0x2332f8,null));};exports[_0x258a('0x26')]=function(_0x2eac7c,_0x396c3a){return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x2eac7c[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x396c3a,null))[_0x258a('0x12')](function(_0x2abec4){if(_0x2abec4&&_0x2abec4[_0x258a('0x42')]){throw new db[(_0x258a('0xbc'))][(_0x258a('0xbd'))](_0x258a('0xbe'));}return _0x2abec4;})[_0x258a('0x12')](removeEntity(_0x396c3a,null))['catch'](handleError(_0x396c3a,null));};exports[_0x258a('0xbf')]=function(_0x4a5603,_0x36de5d){return db[_0x258a('0x4a')]['find']({'where':{'id':_0x4a5603[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x36de5d,null))[_0x258a('0x12')](function(_0x4ebf9f){if(_0x4ebf9f){return _0x4ebf9f[_0x258a('0xbf')](_0x4a5603['body'][_0x258a('0x77')],_[_0x258a('0x8b')](_0x4a5603[_0x258a('0x66')],[_0x258a('0x77'),'id'])||{})['spread'](function(_0x50b9ca){for(var _0x1dd754=0x0;_0x1dd754<_0x4a5603[_0x258a('0x66')][_0x258a('0x77')][_0x258a('0x55')];_0x1dd754+=0x1){socket[_0x258a('0xc0')](_0x258a('0xc1'),{'UserId':Number(_0x4a5603[_0x258a('0x66')][_0x258a('0x77')][_0x1dd754]),'MailAccountId':Number(_0x4a5603[_0x258a('0x68')]['id'])});}return _0x50b9ca;});}})[_0x258a('0x12')](respondWithResult(_0x36de5d,null))[_0x258a('0x1d')](handleError(_0x36de5d,null));};exports[_0x258a('0xc2')]=function(_0x166714,_0x2c8f6b){return db[_0x258a('0x4a')][_0x258a('0x65')]({'where':{'id':_0x166714[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x2c8f6b,null))[_0x258a('0x12')](function(_0x32cd14){if(_0x32cd14){return _0x32cd14[_0x258a('0xc2')](_0x166714[_0x258a('0x4f')][_0x258a('0x77')])['then'](function(){if(_[_0x258a('0xc3')](_0x166714[_0x258a('0x4f')]['ids'])){for(var _0x5dae6c=0x0;_0x5dae6c<_0x166714[_0x258a('0x4f')][_0x258a('0x77')][_0x258a('0x55')];_0x5dae6c+=0x1){socket[_0x258a('0xc0')](_0x258a('0xc4'),{'UserId':Number(_0x166714[_0x258a('0x4f')][_0x258a('0x77')][_0x5dae6c]),'MailAccountId':Number(_0x166714[_0x258a('0x68')]['id'])});}}else{socket[_0x258a('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x166714[_0x258a('0x4f')]['ids']),'MailAccountId':Number(_0x166714[_0x258a('0x68')]['id'])});}});}})[_0x258a('0x12')](respondWithStatusCode(_0x2c8f6b,null))[_0x258a('0x1d')](handleError(_0x2c8f6b,null));};exports[_0x258a('0xc5')]=function(_0x17949f,_0x20c533){var _0x25912b={};var _0x465435={};var _0x481579;var _0x54a679;return db[_0x258a('0x4a')][_0x258a('0x75')]({'where':{'id':_0x17949f[_0x258a('0x68')]['id']}})[_0x258a('0x12')](handleEntityNotFound(_0x20c533,null))[_0x258a('0x12')](function(_0x1f380f){if(_0x1f380f){_0x481579=_0x1f380f;_0x465435[_0x258a('0x4e')]=_[_0x258a('0x50')](db[_0x258a('0xc6')]['rawAttributes']);_0x465435[_0x258a('0x4f')]=_[_0x258a('0x50')](_0x17949f[_0x258a('0x4f')]);_0x465435[_0x258a('0x51')]=_[_0x258a('0x52')](_0x465435[_0x258a('0x4e')],_0x465435['query']);_0x25912b['attributes']=_['intersection'](_0x465435['model'],qs[_0x258a('0x54')](_0x17949f[_0x258a('0x4f')][_0x258a('0x54')]));_0x25912b[_0x258a('0x53')]=_0x25912b[_0x258a('0x53')]['length']?_0x25912b[_0x258a('0x53')]:_0x465435[_0x258a('0x4e')];_0x25912b['order']=qs[_0x258a('0x59')](_0x17949f['query'][_0x258a('0x59')]);_0x25912b[_0x258a('0x5a')]=qs[_0x258a('0x51')](_[_0x258a('0x6f')](_0x17949f[_0x258a('0x4f')],_0x465435[_0x258a('0x51')]));if(_0x17949f['query'][_0x258a('0x5b')]){_0x25912b['where']=_[_0x258a('0x5e')](_0x25912b[_0x258a('0x5a')],{'$or':_[_0x258a('0x49')](_0x25912b[_0x258a('0x53')],function(_0x4bc1b7){var _0x4eb39d={};_0x4eb39d[_0x4bc1b7]={'$like':'%'+_0x17949f['query'][_0x258a('0x5b')]+'%'};return _0x4eb39d;})});}_0x25912b=_[_0x258a('0x5e')]({},_0x25912b,_0x17949f['options']);return _0x481579[_0x258a('0xc5')](_0x25912b);}})[_0x258a('0x12')](function(_0x247678){if(_0x247678){_0x54a679=_0x247678[_0x258a('0x55')];if(!_0x17949f[_0x258a('0x4f')][_0x258a('0x56')]('nolimit')){_0x25912b[_0x258a('0x23')]=qs['limit'](_0x17949f[_0x258a('0x4f')]['limit']);_0x25912b[_0x258a('0x20')]=qs[_0x258a('0x20')](_0x17949f[_0x258a('0x4f')][_0x258a('0x20')]);}return _0x481579[_0x258a('0xc5')](_0x25912b);}})[_0x258a('0x12')](function(_0x419e67){if(_0x419e67){return _0x419e67?{'count':_0x54a679,'rows':_0x419e67}:null;}})[_0x258a('0x12')](respondWithResult(_0x20c533,null))[_0x258a('0x1d')](handleError(_0x20c533,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index feb0a13..87d3328 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 _0xb53e=['exports','events','../../mysqldb','setMaxListeners','save','remove','hasOwnProperty','hook'];(function(_0x19aa25,_0x16019f){var _0x1b6a40=function(_0x2c1a2d){while(--_0x2c1a2d){_0x19aa25['push'](_0x19aa25['shift']());}};_0x1b6a40(++_0x16019f);}(_0xb53e,0xa9));var _0xeb53=function(_0xb4fb5e,_0x1c3cde){_0xb4fb5e=_0xb4fb5e-0x0;var _0x3ffbf8=_0xb53e[_0xb4fb5e];return _0x3ffbf8;};'use strict';var EventEmitter=require(_0xeb53('0x0'));var MailAccount=require(_0xeb53('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xeb53('0x2')](0x0);var events={'afterCreate':_0xeb53('0x3'),'afterUpdate':'update','afterDestroy':_0xeb53('0x4')};function emitEvent(_0xbce00b){return function(_0x526b45,_0x21ce3d,_0x3b4dd3){MailAccountEvents['emit'](_0xbce00b+':'+_0x526b45['id'],_0x526b45);MailAccountEvents['emit'](_0xbce00b,_0x526b45);_0x3b4dd3(null);};}for(var e in events){if(events[_0xeb53('0x5')](e)){var event=events[e];MailAccount[_0xeb53('0x6')](e,emitEvent(event));}}module[_0xeb53('0x7')]=MailAccountEvents; \ No newline at end of file +var _0xdf28=['hasOwnProperty','hook','exports','events','MailAccount','save','update','emit'];(function(_0x22a7cb,_0x1f68b4){var _0x49c3a9=function(_0x4bac69){while(--_0x4bac69){_0x22a7cb['push'](_0x22a7cb['shift']());}};_0x49c3a9(++_0x1f68b4);}(_0xdf28,0x1c3));var _0x8df2=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xdf28[_0x236d24];return _0x1574cf;};'use strict';var EventEmitter=require(_0x8df2('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x8df2('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8df2('0x2'),'afterUpdate':_0x8df2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4199a1){return function(_0x4db9ca,_0x304cb7,_0x251d50){MailAccountEvents[_0x8df2('0x4')](_0x4199a1+':'+_0x4db9ca['id'],_0x4db9ca);MailAccountEvents[_0x8df2('0x4')](_0x4199a1,_0x4db9ca);_0x251d50(null);};}for(var e in events){if(events[_0x8df2('0x5')](e)){var event=events[e];MailAccount[_0x8df2('0x6')](e,emitEvent(event));}}module[_0x8df2('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9630bd3..d9b7925 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 _0x804d=['Smtp','host','port','secure','authentication','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','exports','define','MailAccount','mail_accounts','provider','custom','service'];(function(_0x4f2b8c,_0x4012c8){var _0x1226ae=function(_0x495689){while(--_0x495689){_0x4f2b8c['push'](_0x4f2b8c['shift']());}};_0x1226ae(++_0x4012c8);}(_0x804d,0x185));var _0xd804=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0x804d[_0x3cb979];return _0x3a5e5f;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xd804('0x0')]=function(_0x217d80){return _0x217d80[_0xd804('0x1')](_0xd804('0x2'),attributes,{'tableName':_0xd804('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x329c1f=this;var _0x10d729={'id':_0x329c1f['id'],'tls':{'rejectUnauthorized':![]}};if(_0x329c1f[_0xd804('0x4')]!==_0xd804('0x5')){_0x10d729[_0xd804('0x6')]=_0x329c1f['provider'];}else{_0x10d729['host']=_0x329c1f[_0xd804('0x7')][_0xd804('0x8')];_0x10d729['port']=_0x329c1f[_0xd804('0x7')][_0xd804('0x9')];_0x10d729[_0xd804('0xa')]=_0x329c1f[_0xd804('0x7')]['secure'];}if(_0x329c1f[_0xd804('0x7')][_0xd804('0xb')]){if(_0x329c1f[_0xd804('0x7')][_0xd804('0xc')]){if(!_0x329c1f[_0xd804('0x7')]['CloudProvider'])throw new Error(_0xd804('0xd'));_0x10d729[_0xd804('0xe')]={'type':_0xd804('0xf'),'user':_0x329c1f[_0xd804('0x7')][_0xd804('0x10')],'accessToken':_0x329c1f[_0xd804('0x7')]['CloudProvider'][_0xd804('0x11')]};}else{_0x10d729[_0xd804('0xe')]={'user':_0x329c1f[_0xd804('0x7')][_0xd804('0x10')],'pass':_0x329c1f['Smtp']['pass']};}}return _0x10d729;}}});}; \ No newline at end of file +var _0xda98=['data5','user','pass','./mailAccount.attributes','exports','define','provider','custom','service','host','Smtp','port','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x215be6,_0xe05781){var _0x12cdcd=function(_0xdbb3b1){while(--_0xdbb3b1){_0x215be6['push'](_0x215be6['shift']());}};_0x12cdcd(++_0xe05781);}(_0xda98,0xad));var _0x8da9=function(_0x4ee9cd,_0xd375b0){_0x4ee9cd=_0x4ee9cd-0x0;var _0x328a5b=_0xda98[_0x4ee9cd];return _0x328a5b;};'use strict';var attributes=require(_0x8da9('0x0'));module[_0x8da9('0x1')]=function(_0x51eab4){return _0x51eab4[_0x8da9('0x2')]('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x499a2e=this;var _0x225bf4={'id':_0x499a2e['id'],'tls':{'rejectUnauthorized':![]}};if(_0x499a2e[_0x8da9('0x3')]!==_0x8da9('0x4')){_0x225bf4[_0x8da9('0x5')]=_0x499a2e['provider'];}else{_0x225bf4[_0x8da9('0x6')]=_0x499a2e['Smtp'][_0x8da9('0x6')];_0x225bf4['port']=_0x499a2e[_0x8da9('0x7')][_0x8da9('0x8')];_0x225bf4['secure']=_0x499a2e[_0x8da9('0x7')]['secure'];}if(_0x499a2e[_0x8da9('0x7')][_0x8da9('0x9')]){if(_0x499a2e[_0x8da9('0x7')][_0x8da9('0xa')]){if(!_0x499a2e[_0x8da9('0x7')][_0x8da9('0xb')])throw new Error(_0x8da9('0xc'));_0x225bf4[_0x8da9('0xd')]={'type':'OAuth2','user':_0x499a2e[_0x8da9('0x7')]['user'],'accessToken':_0x499a2e['Smtp'][_0x8da9('0xb')][_0x8da9('0xe')]};}else{_0x225bf4[_0x8da9('0xd')]={'user':_0x499a2e[_0x8da9('0x7')][_0x8da9('0xf')],'pass':_0x499a2e[_0x8da9('0x7')][_0x8da9('0x10')]};}}return _0x225bf4;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 39e507c..2502c4f 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 _0x4137=['Smtp','CloudProvider','get','omit','Applications','applications','priority','asc','push','length','Contacts','create','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Contact\x20not\x20found','spread','update','interaction','created','MailMessage','originTo','originCc','bcc','originChannel','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','*,*,*,*','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailServerOut'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7413('0x0'));var moment=require(_0x7413('0x1'));var BPromise=require(_0x7413('0x2'));var rs=require(_0x7413('0x3'));var Redis=require(_0x7413('0x4'));var db=require(_0x7413('0x5'))['db'];var logger=require(_0x7413('0x6'))(_0x7413('0x7'));var config=require(_0x7413('0x8'));var jayson=require(_0x7413('0x9'));var client=jayson[_0x7413('0xa')][_0x7413('0xb')]({'port':0x232c});config['redis']=_[_0x7413('0xc')](config[_0x7413('0xd')],{'host':_0x7413('0xe'),'port':0x18eb});var socket=require(_0x7413('0xf'))(new Redis(config['redis']));require(_0x7413('0x10'))[_0x7413('0x11')](socket);function respondWithRpcPromise(_0x4e320b,_0x422bf5,_0x2f4b54){return new BPromise(function(_0x50fde0,_0x29f124){return client[_0x7413('0x12')](_0x4e320b,_0x2f4b54)[_0x7413('0x13')](function(_0x3e026b){logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));logger[_0x7413('0x16')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'),JSON[_0x7413('0x17')](_0x3e026b));if(_0x3e026b[_0x7413('0x18')]){if(_0x3e026b['error']['code']===0x1f4){logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b[_0x7413('0x18')]['message']);return _0x29f124(_0x3e026b[_0x7413('0x18')][_0x7413('0x1a')]);}logger['error'](_0x7413('0x19'),_0x422bf5,_0x3e026b['error']['message']);return _0x50fde0(_0x3e026b[_0x7413('0x18')]['message']);}else{logger[_0x7413('0x14')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x7413('0x15'));_0x50fde0(_0x3e026b[_0x7413('0x1b')][_0x7413('0x1a')]);}})[_0x7413('0x1c')](function(_0x2a3417){logger[_0x7413('0x18')]('MailAccount,\x20%s,\x20%s',_0x422bf5,_0x2a3417);_0x29f124(_0x2a3417);});});}exports[_0x7413('0x1d')]=function(_0x17c062){var _0x11f8a1=this;return new Promise(function(_0xfe5b8c,_0x5bee15){return db[_0x7413('0x1e')][_0x7413('0x1f')]({'raw':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x21')]===undefined?!![]:![]:!![],'where':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x22')]||null:null,'attributes':_0x17c062['options']?_0x17c062['options'][_0x7413('0x23')]||null:null,'limit':_0x17c062['options']?_0x17c062[_0x7413('0x20')][_0x7413('0x24')]||null:null,'include':_0x17c062[_0x7413('0x20')]?_0x17c062[_0x7413('0x20')][_0x7413('0x25')]?_[_0x7413('0x26')](_0x17c062[_0x7413('0x20')][_0x7413('0x25')],function(_0x1d455b){return{'model':db[_0x1d455b['model']],'as':_0x1d455b['as'],'attributes':_0x1d455b['attributes'],'include':_0x1d455b[_0x7413('0x25')]?_['map'](_0x1d455b[_0x7413('0x25')],function(_0x71cbb4){return{'model':db[_0x71cbb4[_0x7413('0x27')]],'as':_0x71cbb4['as'],'attributes':_0x71cbb4['attributes'],'include':_0x71cbb4[_0x7413('0x25')]?_[_0x7413('0x26')](_0x71cbb4[_0x7413('0x25')],function(_0x4843fd){return{'model':db[_0x4843fd[_0x7413('0x27')]],'as':_0x4843fd['as'],'attributes':_0x4843fd[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24dce7){logger['info'](_0x7413('0x1d'),_0x17c062);logger[_0x7413('0x16')](_0x7413('0x1d'),_0x17c062,JSON[_0x7413('0x17')](_0x24dce7));_0xfe5b8c(_0x24dce7);})[_0x7413('0x1c')](function(_0x2004ea){logger['error'](_0x7413('0x1d'),_0x2004ea[_0x7413('0x1a')],_0x17c062);_0x5bee15(_0x11f8a1[_0x7413('0x18')](0x1f4,_0x2004ea[_0x7413('0x1a')]));});});};exports[_0x7413('0x28')]=function(_0x256395){var _0x185cfe=this;return new Promise(function(_0x5b4426,_0xd763f9){return db[_0x7413('0x1e')][_0x7413('0x29')]({'raw':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x22')]||null:null,'attributes':_0x256395[_0x7413('0x20')]?_0x256395[_0x7413('0x20')]['attributes']||null:null,'include':_0x256395[_0x7413('0x20')]?_0x256395['options'][_0x7413('0x25')]?_[_0x7413('0x26')](_0x256395['options']['include'],function(_0x440bfe){return{'model':db[_0x440bfe[_0x7413('0x27')]],'as':_0x440bfe['as'],'attributes':_0x440bfe[_0x7413('0x23')],'include':_0x440bfe['include']?_['map'](_0x440bfe[_0x7413('0x25')],function(_0x5a92ab){return{'model':db[_0x5a92ab['model']],'as':_0x5a92ab['as'],'attributes':_0x5a92ab[_0x7413('0x23')],'include':_0x5a92ab['include']?_[_0x7413('0x26')](_0x5a92ab[_0x7413('0x25')],function(_0xf34b21){return{'model':db[_0xf34b21[_0x7413('0x27')]],'as':_0xf34b21['as'],'attributes':_0xf34b21[_0x7413('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xa58bd2){if(_0x256395[_0x7413('0x20')][_0x7413('0x2a')]===!![])_0xa58bd2[_0x7413('0x2b')](_0x7413('0x2c'),_0xa58bd2[_0x7413('0x2d')]());logger[_0x7413('0x14')](_0x7413('0x28'),_0x256395);logger[_0x7413('0x16')](_0x7413('0x28'),_0x256395,JSON[_0x7413('0x17')](_0xa58bd2));_0x5b4426(_0xa58bd2);})[_0x7413('0x1c')](function(_0x5a9791){logger[_0x7413('0x18')]('ShowMailAccount',_0x5a9791['message'],_0x256395);_0xd763f9(_0x185cfe['error'](0x1f4,_0x5a9791['message']));});});};exports['NotifyMailAccount']=function(_0x44af7d){var _0x4c1770=this;return new Promise(function(_0x535e49,_0x5dc077){var _0x4d0008={'body':_0x44af7d['body'],'channel':_0x7413('0x2e')};var _0x32f1e8=_[_0x7413('0x2f')](_[_0x7413('0x30')](db[_0x7413('0x31')]['rawAttributes']),[_0x7413('0x32'),'updatedAt',_0x7413('0x33'),_0x7413('0x34')]);var _0xa063d1=![];if(_0x44af7d[_0x7413('0x35')]['id']){delete _0x44af7d[_0x7413('0x35')]['id'];}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x37')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x38')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x35')])||_0x44af7d['body'][_0x7413('0x35')]===''){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x39')));}if(_[_0x7413('0x36')](_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x7413('0x3b')+_0x32f1e8));}if(!_[_0x7413('0x3c')](_0x32f1e8,_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')])){return _0x5dc077(_0x4c1770['error'](0x1f4,_0x7413('0x3d')+_0x32f1e8));}var _0x52a088={};_0x52a088[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d[_0x7413('0x35')][_0x7413('0x37')];return db[_0x7413('0x1e')][_0x7413('0x29')]({'where':{'id':_0x44af7d[_0x7413('0x3e')]['id']},'include':[{'model':db[_0x7413('0x3f')],'as':_0x7413('0x40'),'include':[{'model':db[_0x7413('0x31')],'as':'Contacts','where':_0x52a088,'limit':0x1,'order':[['updatedAt',_0x7413('0x41')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x7413('0x42')],'as':_0x7413('0x43'),'include':[{'model':db['CloudProvider'],'as':_0x7413('0x44')}]}]})['then'](function(_0x562bae){if(_0x562bae&&_0x562bae[_0x7413('0x40')]){var _0x5f263e=_0x562bae[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x3e')]=_[_0x7413('0x46')](_0x5f263e,[_0x7413('0x47'),_0x7413('0x40')]);_0x4d0008[_0x7413('0x3e')][_0x7413('0x2c')]=_0x562bae[_0x7413('0x2d')]();_0x4d0008[_0x7413('0x48')]=_0x5f263e[_0x7413('0x47')];_0x4d0008['list']=_0x5f263e[_0x7413('0x40')];_0x4d0008['applications']=_['orderBy'](_0x4d0008['applications'],[_0x7413('0x49')],[_0x7413('0x4a')]);if(_0x4d0008[_0x7413('0x3e')]&&_0x4d0008[_0x7413('0x3e')]['autoclose']){_0x4d0008['applications'][_0x7413('0x4b')]({'id':0x0,'priority':_0x4d0008['applications'][_0x7413('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':'*,*,*,*'});}if(_0x4d0008['account']['Applications']){delete _0x4d0008[_0x7413('0x3e')][_0x7413('0x47')];}if(_0x4d0008[_0x7413('0x3e')][_0x7413('0x40')]){delete _0x4d0008[_0x7413('0x3e')]['List'];}if(_0x5f263e[_0x7413('0x40')][_0x7413('0x4d')][_0x7413('0x4c')]){return _0x5f263e['List'][_0x7413('0x4d')][0x0];}var _0x5c3324=_['defaults'](_0x44af7d[_0x7413('0x35')],{'firstName':_0x44af7d[_0x7413('0x35')][_0x7413('0x37')],'ListId':_0x5f263e[_0x7413('0x34')]});_0x5c3324[_0x44af7d[_0x7413('0x35')][_0x7413('0x3a')]]=_0x44af7d['body'][_0x7413('0x37')];return db['CmContact'][_0x7413('0x4e')](_0x5c3324);}else{throw new Error('List\x20not\x20found');}})[_0x7413('0x13')](function(_0x4d4faa){_0x4d0008[_0x7413('0x4f')]=_0x4d4faa;if(_0x4d4faa){if(!_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x50')]){_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')]=rs['generate']()+'\x20'+_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'];}var _0x3ce34c={'ContactId':_0x4d4faa['id'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'inReplyTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x50')],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x52')],'lastMsgAt':moment()[_0x7413('0x53')](_0x7413('0x54')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x44af7d['account']['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7413('0x50')],'where':{'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['inReplyTo']}}]})[_0x7413('0x13')](function(_0xb7dd83){if(_0xb7dd83){return[_0xb7dd83,![]];}return db[_0x7413('0x55')][_0x7413('0x4e')](_0x3ce34c)[_0x7413('0x13')](function(_0x3db284){return[_0x3db284,!![]];});});}else{throw new Error(_0x7413('0x56'));}})[_0x7413('0x57')](function(_0x1ec131,_0x47512d){if(_0x1ec131){_0xa063d1=_0x47512d;if(!_0x47512d){return _0x1ec131[_0x7413('0x58')]({'inReplyTo':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['messageId'],'to':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['from'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x1ec131[_0x7413('0x52')]?_0x1ec131['attach']:_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x7413('0x53')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x7413('0x54')),'lastMsgDirection':'in'});}else{return _0x1ec131;}}})[_0x7413('0x13')](function(_0x167c6b){_0x4d0008[_0x7413('0x59')]=_0x167c6b[_0x7413('0x45')]({'plain':!![]});_0x4d0008[_0x7413('0x59')][_0x7413('0x5a')]=_0xa063d1;return db[_0x7413('0x5b')]['create']({'body':_0x44af7d[_0x7413('0x35')]['body'],'MailAccountId':_0x44af7d[_0x7413('0x3e')]['id'],'MailInteractionId':_0x167c6b['id'],'direction':'in','ContactId':_0x4d0008[_0x7413('0x4f')]['id'],'messageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x50')],'from':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x37')],'to':_0x44af7d[_0x7413('0x35')]['message']['to'],'cc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['cc'],'subject':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x51')],'attach':_0x44af7d['body'][_0x7413('0x1a')]['attach'],'Attachments':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['attachments'],'originTo':_0x44af7d['body'][_0x7413('0x1a')][_0x7413('0x5c')],'originCc':_0x44af7d[_0x7413('0x35')]['message'][_0x7413('0x5d')],'bcc':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5e')],'ChatWebsiteId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x5f')]||'Email','ChatOfflineMessageId':_0x44af7d[_0x7413('0x35')][_0x7413('0x1a')][_0x7413('0x60')]||null},{'include':[{'model':db[_0x7413('0x61')],'as':_0x7413('0x62')}]});})[_0x7413('0x13')](function(_0x46e9f8){_0x4d0008[_0x7413('0x1a')]=_0x46e9f8;if(_0x4d0008[_0x7413('0x59')]['UserId']){return db[_0x7413('0x63')][_0x7413('0x29')]({'attributes':['id',_0x7413('0x64')],'where':{'id':_0x4d0008[_0x7413('0x59')][_0x7413('0x65')]}})[_0x7413('0x13')](function(_0x4c9d1b){if(_0x4c9d1b){_0x4d0008[_0x7413('0x48')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c9d1b[_0x7413('0x64')]+','+(_0x4d0008[_0x7413('0x3e')]['waitForTheAssignedAgent']||0xa),'interval':_0x7413('0x66')});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);});}return respondWithRpcPromise(_0x7413('0x67'),_0x7413('0x68'),_0x4d0008);})[_0x7413('0x13')](function(_0x2d361c){_0x535e49(_0x2d361c);})[_0x7413('0x1c')](function(_0x5f4765){_0x5dc077(_0x4c1770[_0x7413('0x18')](0x1f4,_0x5f4765['message']));});});}; \ No newline at end of file +var _0x5f66=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','debug','request\x20sent','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','GetMailAccount','MailAccount','options','raw','where','limit','include','map','model','attributes','stringify','find','smtp','smtpOptions','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','omit','getSmtpOptions','list','applications','orderBy','priority','autoclose','push','close','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','MailMessage','create','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','name','unshift','agent','*,*,*,*','startRouting','Start','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5f66[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var BPromise=require('bluebird');var rs=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var db=require(_0x65f6('0x3'))['db'];var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x6'));var client=jayson['client'][_0x65f6('0x7')]({'port':0x232c});config[_0x65f6('0x8')]=_['defaults'](config['redis'],{'host':_0x65f6('0x9'),'port':0x18eb});var socket=require(_0x65f6('0xa'))(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0xb'))[_0x65f6('0xc')](socket);function respondWithRpcPromise(_0x14f4c7,_0x48d85c,_0x5123ee){return new BPromise(function(_0x18fea1,_0x2f6d5b){return client[_0x65f6('0xd')](_0x14f4c7,_0x5123ee)[_0x65f6('0xe')](function(_0x50d26d){logger[_0x65f6('0xf')]('MailAccount,\x20%s,\x20%s',_0x48d85c,'request\x20sent');logger[_0x65f6('0x10')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x48d85c,_0x65f6('0x11'),JSON['stringify'](_0x50d26d));if(_0x50d26d[_0x65f6('0x12')]){if(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x13')]===0x1f4){logger[_0x65f6('0x12')](_0x65f6('0x14'),_0x48d85c,_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);return _0x2f6d5b(_0x50d26d[_0x65f6('0x12')][_0x65f6('0x15')]);}logger[_0x65f6('0x12')]('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x50d26d[_0x65f6('0x12')]['message']);return _0x18fea1(_0x50d26d['error'][_0x65f6('0x15')]);}else{logger[_0x65f6('0xf')](_0x65f6('0x14'),_0x48d85c,_0x65f6('0x11'));_0x18fea1(_0x50d26d[_0x65f6('0x16')][_0x65f6('0x15')]);}})[_0x65f6('0x17')](function(_0x18380e){logger['error']('MailAccount,\x20%s,\x20%s',_0x48d85c,_0x18380e);_0x2f6d5b(_0x18380e);});});}exports[_0x65f6('0x18')]=function(_0x5b4055){var _0x4c81f3=this;return new Promise(function(_0x5c5b91,_0x365159){return db[_0x65f6('0x19')]['findAll']({'raw':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b4055[_0x65f6('0x1a')]?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1c')]||null:null,'attributes':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')]['attributes']||null:null,'limit':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1d')]||null:null,'include':_0x5b4055['options']?_0x5b4055[_0x65f6('0x1a')][_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x5b4055[_0x65f6('0x1a')]['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x20')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x21')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x20')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes'],'include':_0x29abdb[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x29abdb['include'],function(_0x325cb4){return{'model':db[_0x325cb4[_0x65f6('0x20')]],'as':_0x325cb4['as'],'attributes':_0x325cb4[_0x65f6('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ac04b){logger['info'](_0x65f6('0x18'),_0x5b4055);logger[_0x65f6('0x10')](_0x65f6('0x18'),_0x5b4055,JSON[_0x65f6('0x22')](_0x4ac04b));_0x5c5b91(_0x4ac04b);})[_0x65f6('0x17')](function(_0x14a387){logger[_0x65f6('0x12')]('GetMailAccount',_0x14a387['message'],_0x5b4055);_0x365159(_0x4c81f3[_0x65f6('0x12')](0x1f4,_0x14a387[_0x65f6('0x15')]));});});};exports['ShowMailAccount']=function(_0x4e50c0){var _0x10b368=this;return new Promise(function(_0x1ce43c,_0x11fe3b){return db[_0x65f6('0x19')][_0x65f6('0x23')]({'raw':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0['options'][_0x65f6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')]['where']||null:null,'attributes':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x21')]||null:null,'include':_0x4e50c0[_0x65f6('0x1a')]?_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')]?_['map'](_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x1e')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x20')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1e')]?_['map'](_0x4f3e22[_0x65f6('0x1e')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x21')],'include':_0x24f7fd[_0x65f6('0x1e')]?_[_0x65f6('0x1f')](_0x24f7fd['include'],function(_0x582c7e){return{'model':db[_0x582c7e[_0x65f6('0x20')]],'as':_0x582c7e['as'],'attributes':_0x582c7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xe')](function(_0x4e6653){if(_0x4e50c0[_0x65f6('0x1a')][_0x65f6('0x24')]===!![])_0x4e6653['setDataValue'](_0x65f6('0x25'),_0x4e6653['getSmtpOptions']());logger['info'](_0x65f6('0x26'),_0x4e50c0);logger[_0x65f6('0x10')](_0x65f6('0x26'),_0x4e50c0,JSON[_0x65f6('0x22')](_0x4e6653));_0x1ce43c(_0x4e6653);})[_0x65f6('0x17')](function(_0x28845a){logger[_0x65f6('0x12')](_0x65f6('0x26'),_0x28845a['message'],_0x4e50c0);_0x11fe3b(_0x10b368[_0x65f6('0x12')](0x1f4,_0x28845a['message']));});});};exports[_0x65f6('0x27')]=function(_0xa4394a){var _0x4ba7db=this;return new Promise(function(_0x2ea7f7,_0x5ef5c2){var _0x32148f={'body':_0xa4394a[_0x65f6('0x28')],'channel':_0x65f6('0x29')};var _0x3fb1c6=_[_0x65f6('0x2a')](_[_0x65f6('0x2b')](db[_0x65f6('0x2c')][_0x65f6('0x2d')]),[_0x65f6('0x2e'),'updatedAt',_0x65f6('0x2f'),_0x65f6('0x30')]);var _0x377ae5=![];if(_0xa4394a[_0x65f6('0x28')]['id']){delete _0xa4394a[_0x65f6('0x28')]['id'];}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x65f6('0x33')));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')])||_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')]===''){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x65f6('0x31')](_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3fb1c6));}if(!_[_0x65f6('0x35')](_0x3fb1c6,_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')])){return _0x5ef5c2(_0x4ba7db['error'](0x1f4,_0x65f6('0x36')+_0x3fb1c6));}var _0x3386a2={};_0x3386a2[_0xa4394a[_0x65f6('0x28')][_0x65f6('0x34')]]=_0xa4394a['body'][_0x65f6('0x32')];return db['MailAccount'][_0x65f6('0x23')]({'where':{'id':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x65f6('0x38'),'include':[{'model':db['CmContact'],'as':_0x65f6('0x39'),'where':_0x3386a2,'limit':0x1,'order':[[_0x65f6('0x3a'),_0x65f6('0x3b')]]}]},{'model':db[_0x65f6('0x3c')],'as':_0x65f6('0x3d')},{'model':db[_0x65f6('0x3e')],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x65f6('0x3f')}]}]})[_0x65f6('0xe')](function(_0x3b647a){if(_0x3b647a&&_0x3b647a[_0x65f6('0x38')]){var _0x3b907c=_0x3b647a[_0x65f6('0x40')]({'plain':!![]});_0x32148f[_0x65f6('0x37')]=_[_0x65f6('0x41')](_0x3b907c,[_0x65f6('0x3d'),'List']);_0x32148f[_0x65f6('0x37')][_0x65f6('0x25')]=_0x3b647a[_0x65f6('0x42')]();_0x32148f['applications']=_0x3b907c[_0x65f6('0x3d')];_0x32148f[_0x65f6('0x43')]=_0x3b907c['List'];_0x32148f[_0x65f6('0x44')]=_[_0x65f6('0x45')](_0x32148f['applications'],[_0x65f6('0x46')],['asc']);if(_0x32148f[_0x65f6('0x37')]&&_0x32148f[_0x65f6('0x37')][_0x65f6('0x47')]){_0x32148f['applications'][_0x65f6('0x48')]({'id':0x0,'priority':_0x32148f[_0x65f6('0x44')]['length']+0x1,'app':_0x65f6('0x49'),'appdata':_0x65f6('0x47'),'interval':'*,*,*,*'});}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x3d')];}if(_0x32148f[_0x65f6('0x37')][_0x65f6('0x38')]){delete _0x32148f[_0x65f6('0x37')][_0x65f6('0x38')];}if(_0x3b907c['List']['Contacts']['length']){return _0x3b907c[_0x65f6('0x38')][_0x65f6('0x39')][0x0];}var _0x111a8a=_[_0x65f6('0x4a')](_0xa4394a['body'],{'firstName':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')],'ListId':_0x3b907c[_0x65f6('0x30')]});_0x111a8a[_0xa4394a['body'][_0x65f6('0x34')]]=_0xa4394a[_0x65f6('0x28')][_0x65f6('0x32')];return db['CmContact']['create'](_0x111a8a);}else{throw new Error(_0x65f6('0x4b'));}})[_0x65f6('0xe')](function(_0x4125cb){_0x32148f[_0x65f6('0x4c')]=_0x4125cb;if(_0x4125cb){if(!_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]){_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')]=rs[_0x65f6('0x4e')]()+'\x20'+_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')];}var _0x5ba9c6={'ContactId':_0x4125cb['id'],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a[_0x65f6('0x28')]['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x50')],'lastMsgAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x65f6('0x52')][_0x65f6('0x23')]({'where':{'closed':![],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id']},'include':[{'model':db['MailMessage'],'as':_0x65f6('0x53'),'attributes':[_0x65f6('0x4d')],'where':{'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x54')]}}]})[_0x65f6('0xe')](function(_0x5e4759){if(_0x5e4759){return[_0x5e4759,![]];}return db['MailInteraction']['create'](_0x5ba9c6)[_0x65f6('0xe')](function(_0x367d95){return[_0x367d95,!![]];});});}else{throw new Error(_0x65f6('0x55'));}})[_0x65f6('0x56')](function(_0xab6f0,_0x304cf9){if(_0xab6f0){_0x377ae5=_0x304cf9;if(!_0x304cf9){return _0xab6f0['update']({'inReplyTo':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['messageId'],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x32')],'cc':_0xa4394a['body'][_0x65f6('0x15')]['cc'],'subject':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x4f')],'attach':_0xab6f0[_0x65f6('0x50')]?_0xab6f0[_0x65f6('0x50')]:_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'substatus':null,'substatusAt':moment()[_0x65f6('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x65f6('0x57')),'lastMsgDirection':'in'});}else{return _0xab6f0;}}})[_0x65f6('0xe')](function(_0x4a9524){_0x32148f[_0x65f6('0x58')]=_0x4a9524['get']({'plain':!![]});_0x32148f[_0x65f6('0x58')]['created']=_0x377ae5;return db[_0x65f6('0x59')][_0x65f6('0x5a')]({'body':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x28')],'MailAccountId':_0xa4394a[_0x65f6('0x37')]['id'],'MailInteractionId':_0x4a9524['id'],'direction':'in','ContactId':_0x32148f[_0x65f6('0x4c')]['id'],'messageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4d')],'from':_0xa4394a['body']['message'][_0x65f6('0x32')],'to':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['to'],'cc':_0xa4394a['body']['message']['cc'],'subject':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x4f')],'attach':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x50')],'Attachments':_0xa4394a['body']['message'][_0x65f6('0x5b')],'originTo':_0xa4394a[_0x65f6('0x28')]['message'][_0x65f6('0x5c')],'originCc':_0xa4394a['body'][_0x65f6('0x15')][_0x65f6('0x5d')],'bcc':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')]['bcc'],'ChatWebsiteId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x5e')]||null,'originChannel':_0xa4394a['body']['message'][_0x65f6('0x5f')]||'Email','ChatOfflineMessageId':_0xa4394a[_0x65f6('0x28')][_0x65f6('0x15')][_0x65f6('0x60')]||null},{'include':[{'model':db[_0x65f6('0x61')],'as':'Attachments'}]});})['then'](function(_0x56f7f1){_0x32148f[_0x65f6('0x15')]=_0x56f7f1;if(_0x32148f[_0x65f6('0x58')][_0x65f6('0x62')]){return db['User'][_0x65f6('0x23')]({'attributes':['id',_0x65f6('0x63')],'where':{'id':_0x32148f[_0x65f6('0x58')]['UserId']}})[_0x65f6('0xe')](function(_0x15809e){if(_0x15809e){_0x32148f['applications'][_0x65f6('0x64')]({'id':0x0,'priority':0x0,'app':_0x65f6('0x65'),'appdata':_0x15809e['name']+','+(_0x32148f[_0x65f6('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x65f6('0x66')});}return respondWithRpcPromise('Start',_0x65f6('0x67'),_0x32148f);});}return respondWithRpcPromise(_0x65f6('0x68'),'startRouting',_0x32148f);})[_0x65f6('0xe')](function(_0x442e25){_0x2ea7f7(_0x442e25);})[_0x65f6('0x17')](function(_0x299b85){_0x5ef5c2(_0x4ba7db[_0x65f6('0x12')](0x1f4,_0x299b85[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a2ae837..43a921f 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 _0x1c2e=['removeListener','register','length','mailAccount:','save','emit'];(function(_0x48d033,_0x31fbbe){var _0x5464ed=function(_0x4ccc1f){while(--_0x4ccc1f){_0x48d033['push'](_0x48d033['shift']());}};_0x5464ed(++_0x31fbbe);}(_0x1c2e,0xb8));var _0xe1c2=function(_0x3059f7,_0x967d6){_0x3059f7=_0x3059f7-0x0;var _0xe56aa3=_0x1c2e[_0x3059f7];return _0xe56aa3;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe1c2('0x0'),'remove','update'];function createListener(_0x4a9deb,_0x39685f){return function(_0x51a89f){_0x39685f[_0xe1c2('0x1')](_0x4a9deb,_0x51a89f);};}function removeListener(_0x3ef607,_0x2cdeab){return function(){MailAccountEvents[_0xe1c2('0x2')](_0x3ef607,_0x2cdeab);};}exports[_0xe1c2('0x3')]=function(_0x32d4b0){for(var _0x5dac40=0x0,_0xe035ab=events[_0xe1c2('0x4')];_0x5dac40<_0xe035ab;_0x5dac40++){var _0xae7ba=events[_0x5dac40];var _0x4c6b9b=createListener(_0xe1c2('0x5')+_0xae7ba,_0x32d4b0);MailAccountEvents['on'](_0xae7ba,_0x4c6b9b);}}; \ No newline at end of file +var _0x1a9d=['register','mailAccount:','./mailAccount.events','remove','emit'];(function(_0x52c717,_0x447b13){var _0xffa6f9=function(_0x977931){while(--_0x977931){_0x52c717['push'](_0x52c717['shift']());}};_0xffa6f9(++_0x447b13);}(_0x1a9d,0x16f));var _0xd1a9=function(_0x42cdd2,_0x41e581){_0x42cdd2=_0x42cdd2-0x0;var _0x258077=_0x1a9d[_0x42cdd2];return _0x258077;};'use strict';var MailAccountEvents=require(_0xd1a9('0x0'));var events=['save',_0xd1a9('0x1'),'update'];function createListener(_0x8eb01f,_0x5f4d5f){return function(_0x1c04e3){_0x5f4d5f[_0xd1a9('0x2')](_0x8eb01f,_0x1c04e3);};}function removeListener(_0x1a1316,_0x274e4b){return function(){MailAccountEvents['removeListener'](_0x1a1316,_0x274e4b);};}exports[_0xd1a9('0x3')]=function(_0x11d430){for(var _0x275728=0x0,_0x1effef=events['length'];_0x275728<_0x1effef;_0x275728++){var _0x11f5fd=events[_0x275728];var _0x352197=createListener(_0xd1a9('0x4')+_0x11f5fd,_0x11d430);MailAccountEvents['on'](_0x11f5fd,_0x352197);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 826b6c6..23cf88a 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 _0x5e2b=['destroy','exports','multer','util','express','Router','fs-extra','../../config/environment','./mailApplication.controller','get','isAuthenticated','show','/:id','update','delete'];(function(_0xd679d7,_0x183013){var _0x747d4b=function(_0x10468e){while(--_0x10468e){_0xd679d7['push'](_0xd679d7['shift']());}};_0x747d4b(++_0x183013);}(_0x5e2b,0x110));var _0xb5e2=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x5e2b[_0x725b8e];return _0x43ac45;};'use strict';var multer=require(_0xb5e2('0x0'));var util=require(_0xb5e2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb5e2('0x2'));var router=express[_0xb5e2('0x3')]();var fs_extra=require(_0xb5e2('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb5e2('0x5'));var controller=require(_0xb5e2('0x6'));router[_0xb5e2('0x7')]('/:id',auth[_0xb5e2('0x8')](),controller[_0xb5e2('0x9')]);router['put'](_0xb5e2('0xa'),auth[_0xb5e2('0x8')](),controller[_0xb5e2('0xb')]);router[_0xb5e2('0xc')](_0xb5e2('0xa'),auth['isAuthenticated'](),controller[_0xb5e2('0xd')]);module[_0xb5e2('0xe')]=router; \ No newline at end of file +var _0x5a2f=['multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5a2f,0x15e));var _0xf5a2=function(_0xd87300,_0xec6c52){_0xd87300=_0xd87300-0x0;var _0x3ccc0b=_0x5a2f[_0xd87300];return _0x3ccc0b;};'use strict';var multer=require(_0xf5a2('0x0'));var util=require('util');var path=require(_0xf5a2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf5a2('0x2'));var auth=require(_0xf5a2('0x3'));var interaction=require(_0xf5a2('0x4'));var config=require(_0xf5a2('0x5'));var controller=require(_0xf5a2('0x6'));router[_0xf5a2('0x7')](_0xf5a2('0x8'),auth[_0xf5a2('0x9')](),controller[_0xf5a2('0xa')]);router[_0xf5a2('0xb')]('/:id',auth[_0xf5a2('0x9')](),controller[_0xf5a2('0xc')]);router['delete'](_0xf5a2('0x8'),auth[_0xf5a2('0x9')](),controller[_0xf5a2('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 36bc41a..e41b2e9 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 _0x7079=['*,*,*,*','sequelize','INTEGER','TEXT','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7079,0x1a5));var _0x9707=function(_0x9eb785,_0x3b26b6){_0x9eb785=_0x9eb785-0x0;var _0x5d5201=_0x7079[_0x9eb785];return _0x5d5201;};'use strict';var Sequelize=require(_0x9707('0x0'));module['exports']={'priority':{'type':Sequelize[_0x9707('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9707('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9707('0x3')],'defaultValue':_0x9707('0x4')}}; \ No newline at end of file +var _0x7e13=['TEXT','sequelize','exports','STRING','noop'];(function(_0x5a0a57,_0x21a339){var _0x4ed743=function(_0xb20248){while(--_0xb20248){_0x5a0a57['push'](_0x5a0a57['shift']());}};_0x4ed743(++_0x21a339);}(_0x7e13,0x18c));var _0x37e1=function(_0x49b4e3,_0x48a0cf){_0x49b4e3=_0x49b4e3-0x0;var _0x200199=_0x7e13[_0x49b4e3];return _0x200199;};'use strict';var Sequelize=require(_0x37e1('0x0'));module[_0x37e1('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x37e1('0x2')],'allowNull':![],'defaultValue':_0x37e1('0x3')},'appdata':{'type':Sequelize[_0x37e1('0x4')]()},'description':{'type':Sequelize[_0x37e1('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 0e8bf0c..967f37b 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x40bbce,_0x1541b9){var _0xb24be4=function(_0x9eb45d){while(--_0x9eb45d){_0x40bbce['push'](_0x40bbce['shift']());}};_0xb24be4(++_0x1541b9);}(_0x54ef,0x112));var _0xf54e=function(_0x51e767,_0x5993f0){_0x51e767=_0x51e767-0x0;var _0x4d947c=_0x54ef[_0x51e767];return _0x4d947c;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x381aca,_0x3784a1){var _0x17b285=function(_0x5c6b08){while(--_0x5c6b08){_0x381aca['push'](_0x381aca['shift']());}};_0x17b285(++_0x3784a1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index f3ad695..f872c3b 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 _0xa305=['path','rimraf','../../config/environment','exports','MailApplication','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x171896,_0x1a6ffd){var _0x5d8636=function(_0x53d97f){while(--_0x53d97f){_0x171896['push'](_0x171896['shift']());}};_0x5d8636(++_0x1a6ffd);}(_0xa305,0x1aa));var _0x5a30=function(_0x34ca50,_0x168ad8){_0x34ca50=_0x34ca50-0x0;var _0x2a72dd=_0xa305[_0x34ca50];return _0x2a72dd;};'use strict';var _=require(_0x5a30('0x0'));var util=require(_0x5a30('0x1'));var logger=require(_0x5a30('0x2'))(_0x5a30('0x3'));var moment=require(_0x5a30('0x4'));var BPromise=require(_0x5a30('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a30('0x6'));var rimraf=require(_0x5a30('0x7'));var config=require(_0x5a30('0x8'));var attributes=require('./mailApplication.attributes');module[_0x5a30('0x9')]=function(_0x2bdf99,_0x605347){return _0x2bdf99['define'](_0x5a30('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5a30('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x953c=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0xa7470c,_0x486789){var _0x2fd345=function(_0x1bf8ca){while(--_0x1bf8ca){_0xa7470c['push'](_0xa7470c['shift']());}};_0x2fd345(++_0x486789);}(_0x953c,0x1b3));var _0xc953=function(_0x19a49f,_0x444d74){_0x19a49f=_0x19a49f-0x0;var _0x5351ae=_0x953c[_0x19a49f];return _0x5351ae;};'use strict';var _=require(_0xc953('0x0'));var util=require(_0xc953('0x1'));var logger=require(_0xc953('0x2'))(_0xc953('0x3'));var moment=require('moment');var BPromise=require(_0xc953('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc953('0x5'));var rimraf=require(_0xc953('0x6'));var config=require(_0xc953('0x7'));var attributes=require(_0xc953('0x8'));module[_0xc953('0x9')]=function(_0x8903db,_0x9fc5af){return _0x8903db[_0xc953('0xa')](_0xc953('0xb'),attributes,{'tableName':_0xc953('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc953('0xd'),'collate':_0xc953('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6ca6abd..d75fbbf 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 _0x3ce8=['limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','MailApplication,\x20%s,\x20%s','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw'];(function(_0x15a569,_0x4ad6a1){var _0x536d3b=function(_0x1228fd){while(--_0x1228fd){_0x15a569['push'](_0x15a569['shift']());}};_0x536d3b(++_0x4ad6a1);}(_0x3ce8,0xdb));var _0x83ce=function(_0x5179c5,_0x47c3e1){_0x5179c5=_0x5179c5-0x0;var _0x25436c=_0x3ce8[_0x5179c5];return _0x25436c;};'use strict';var _=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var moment=require(_0x83ce('0x2'));var BPromise=require(_0x83ce('0x3'));var rs=require(_0x83ce('0x4'));var fs=require('fs');var Redis=require(_0x83ce('0x5'));var db=require(_0x83ce('0x6'))['db'];var utils=require(_0x83ce('0x7'));var logger=require(_0x83ce('0x8'))(_0x83ce('0x9'));var config=require('../../config/environment');var jayson=require(_0x83ce('0xa'));var client=jayson[_0x83ce('0xb')][_0x83ce('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd0a97d,_0x146418,_0x50a91d){return new BPromise(function(_0x20ee8a,_0x39ded9){return client[_0x83ce('0xd')](_0xd0a97d,_0x50a91d)['then'](function(_0x275af4){logger['info'](_0x83ce('0xe'),_0x146418,'request\x20sent');logger['debug'](_0x83ce('0xf'),_0x146418,_0x83ce('0x10'),JSON[_0x83ce('0x11')](_0x275af4));if(_0x275af4[_0x83ce('0x12')]){if(_0x275af4[_0x83ce('0x12')][_0x83ce('0x13')]===0x1f4){logger[_0x83ce('0x12')](_0x83ce('0xe'),_0x146418,_0x275af4[_0x83ce('0x12')][_0x83ce('0x14')]);return _0x39ded9(_0x275af4[_0x83ce('0x12')]['message']);}logger[_0x83ce('0x12')]('MailApplication,\x20%s,\x20%s',_0x146418,_0x275af4[_0x83ce('0x12')][_0x83ce('0x14')]);return _0x20ee8a(_0x275af4['error'][_0x83ce('0x14')]);}else{logger['info'](_0x83ce('0xe'),_0x146418,_0x83ce('0x10'));_0x20ee8a(_0x275af4[_0x83ce('0x15')][_0x83ce('0x14')]);}})[_0x83ce('0x16')](function(_0x4b9460){logger['error'](_0x83ce('0xe'),_0x146418,_0x4b9460);_0x39ded9(_0x4b9460);});});}exports[_0x83ce('0x17')]=function(_0x23fd56){var _0x3bc675=this;return new Promise(function(_0x3a629a,_0x36def0){return db[_0x83ce('0x18')][_0x83ce('0x19')](_0x23fd56[_0x83ce('0x1a')],{'raw':_0x23fd56[_0x83ce('0x1b')]?_0x23fd56[_0x83ce('0x1b')][_0x83ce('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23fd56['options']?_0x23fd56[_0x83ce('0x1b')]['where']||null:null,'attributes':_0x23fd56[_0x83ce('0x1b')]?_0x23fd56[_0x83ce('0x1b')]['attributes']||null:null,'limit':_0x23fd56['options']?_0x23fd56[_0x83ce('0x1b')][_0x83ce('0x1d')]||null:null})[_0x83ce('0x1e')](function(_0x2b0749){logger['info']('UpdateMailApplication',_0x23fd56);logger['debug'](_0x83ce('0x17'),_0x23fd56,JSON['stringify'](_0x2b0749));_0x3a629a(_0x2b0749);})[_0x83ce('0x16')](function(_0x864012){logger['error'](_0x83ce('0x17'),_0x864012[_0x83ce('0x14')],_0x23fd56);_0x36def0(_0x3bc675[_0x83ce('0x12')](0x1f4,_0x864012['message']));});});}; \ No newline at end of file +var _0xe66a=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','MailApplication,\x20%s,\x20%s','message','info','result','catch','UpdateMailApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment'];(function(_0x159cf6,_0x5c6dae){var _0x4dfa14=function(_0x245619){while(--_0x245619){_0x159cf6['push'](_0x159cf6['shift']());}};_0x4dfa14(++_0x5c6dae);}(_0xe66a,0xcf));var _0xae66=function(_0x117e30,_0x343bd7){_0x117e30=_0x117e30-0x0;var _0x266c91=_0xe66a[_0x117e30];return _0x266c91;};'use strict';var _=require(_0xae66('0x0'));var util=require(_0xae66('0x1'));var moment=require(_0xae66('0x2'));var BPromise=require('bluebird');var rs=require(_0xae66('0x3'));var fs=require('fs');var Redis=require(_0xae66('0x4'));var db=require(_0xae66('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xae66('0x6'))(_0xae66('0x7'));var config=require('../../config/environment');var jayson=require(_0xae66('0x8'));var client=jayson[_0xae66('0x9')][_0xae66('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45c95e,_0x44925c,_0x5028fb){return new BPromise(function(_0x1af58f,_0x54062a){return client[_0xae66('0xb')](_0x45c95e,_0x5028fb)['then'](function(_0x532bce){logger['info']('MailApplication,\x20%s,\x20%s',_0x44925c,_0xae66('0xc'));logger[_0xae66('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x44925c,_0xae66('0xc'),JSON[_0xae66('0xe')](_0x532bce));if(_0x532bce[_0xae66('0xf')]){if(_0x532bce['error']['code']===0x1f4){logger[_0xae66('0xf')](_0xae66('0x10'),_0x44925c,_0x532bce['error'][_0xae66('0x11')]);return _0x54062a(_0x532bce[_0xae66('0xf')][_0xae66('0x11')]);}logger[_0xae66('0xf')]('MailApplication,\x20%s,\x20%s',_0x44925c,_0x532bce[_0xae66('0xf')][_0xae66('0x11')]);return _0x1af58f(_0x532bce[_0xae66('0xf')]['message']);}else{logger[_0xae66('0x12')](_0xae66('0x10'),_0x44925c,_0xae66('0xc'));_0x1af58f(_0x532bce[_0xae66('0x13')][_0xae66('0x11')]);}})[_0xae66('0x14')](function(_0x1d4eed){logger[_0xae66('0xf')]('MailApplication,\x20%s,\x20%s',_0x44925c,_0x1d4eed);_0x54062a(_0x1d4eed);});});}exports[_0xae66('0x15')]=function(_0x2bba67){var _0x5232f9=this;return new Promise(function(_0x122859,_0x53f0e8){return db['MailApplication'][_0xae66('0x16')](_0x2bba67[_0xae66('0x17')],{'raw':_0x2bba67[_0xae66('0x18')]?_0x2bba67[_0xae66('0x18')][_0xae66('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bba67['options']?_0x2bba67[_0xae66('0x18')][_0xae66('0x1a')]||null:null,'attributes':_0x2bba67['options']?_0x2bba67['options'][_0xae66('0x1b')]||null:null,'limit':_0x2bba67[_0xae66('0x18')]?_0x2bba67[_0xae66('0x18')][_0xae66('0x1c')]||null:null})[_0xae66('0x1d')](function(_0x398f0a){logger['info'](_0xae66('0x15'),_0x2bba67);logger[_0xae66('0xd')](_0xae66('0x15'),_0x2bba67,JSON[_0xae66('0xe')](_0x398f0a));_0x122859(_0x398f0a);})[_0xae66('0x14')](function(_0x5e80aa){logger['error'](_0xae66('0x15'),_0x5e80aa[_0xae66('0x11')],_0x2bba67);_0x53f0e8(_0x5232f9[_0xae66('0xf')](0x1f4,_0x5e80aa['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 0b1b1dd..96a3dff 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 _0x61bb=['/describe','describe','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x515685,_0x4724ea){var _0x5b2d62=function(_0x3f53ea){while(--_0x3f53ea){_0x515685['push'](_0x515685['shift']());}};_0x5b2d62(++_0x4724ea);}(_0x61bb,0x89));var _0xb61b=function(_0x3f6d5b,_0x4ab947){_0x3f6d5b=_0x3f6d5b-0x0;var _0x5aceed=_0x61bb[_0x3f6d5b];return _0x5aceed;};'use strict';var express=require(_0xb61b('0x0'));var router=express[_0xb61b('0x1')]();var auth=require(_0xb61b('0x2'));var interaction=require(_0xb61b('0x3'));var controller=require(_0xb61b('0x4'));router[_0xb61b('0x5')]('/',auth[_0xb61b('0x6')](),controller[_0xb61b('0x7')]);router[_0xb61b('0x5')](_0xb61b('0x8'),auth['isAuthenticated'](),controller[_0xb61b('0x9')]);router[_0xb61b('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xb61b('0xa')]);router[_0xb61b('0x5')](_0xb61b('0xb'),auth[_0xb61b('0x6')](),controller[_0xb61b('0xc')]);router['get']('/:id/download',auth[_0xb61b('0x6')](),controller[_0xb61b('0xd')]);router['post']('/',auth[_0xb61b('0x6')](),controller['create']);router[_0xb61b('0xe')](_0xb61b('0xb'),auth[_0xb61b('0x6')](),controller[_0xb61b('0xf')]);router['post'](_0xb61b('0x10'),auth['isAuthenticated'](),interaction[_0xb61b('0x11')](_0xb61b('0x12'),_0xb61b('0x13')),controller[_0xb61b('0x14')]);router[_0xb61b('0x15')]('/:id',auth[_0xb61b('0x6')](),interaction[_0xb61b('0x11')]('mail',_0xb61b('0x16')),controller[_0xb61b('0x17')]);router[_0xb61b('0x18')]('/:id',auth[_0xb61b('0x6')](),interaction[_0xb61b('0x11')]('mail',_0xb61b('0x19')),controller[_0xb61b('0x1a')]);router[_0xb61b('0x18')]('/:id/tags',auth[_0xb61b('0x6')](),controller[_0xb61b('0x1b')]);module[_0xb61b('0x1c')]=router; \ No newline at end of file +var _0x1395=['show','getMessages','/:id/download','post','create','/:id/messages','addMessage','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update','delete','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe'];(function(_0x4dfc22,_0x5d561c){var _0x21fad8=function(_0x5c1105){while(--_0x5c1105){_0x4dfc22['push'](_0x4dfc22['shift']());}};_0x21fad8(++_0x5d561c);}(_0x1395,0x105));var _0x5139=function(_0x270325,_0x560264){_0x270325=_0x270325-0x0;var _0x1ae437=_0x1395[_0x270325];return _0x1ae437;};'use strict';var express=require(_0x5139('0x0'));var router=express[_0x5139('0x1')]();var auth=require(_0x5139('0x2'));var interaction=require(_0x5139('0x3'));var controller=require(_0x5139('0x4'));router[_0x5139('0x5')]('/',auth[_0x5139('0x6')](),controller[_0x5139('0x7')]);router['get'](_0x5139('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5139('0x5')]('/:id',auth[_0x5139('0x6')](),controller[_0x5139('0x9')]);router[_0x5139('0x5')]('/:id/messages',auth[_0x5139('0x6')](),controller[_0x5139('0xa')]);router[_0x5139('0x5')](_0x5139('0xb'),auth[_0x5139('0x6')](),controller['download']);router[_0x5139('0xc')]('/',auth['isAuthenticated'](),controller[_0x5139('0xd')]);router[_0x5139('0xc')](_0x5139('0xe'),auth[_0x5139('0x6')](),controller[_0x5139('0xf')]);router[_0x5139('0xc')]('/:id/tags',auth[_0x5139('0x6')](),interaction[_0x5139('0x10')](_0x5139('0x11'),_0x5139('0x12')),controller[_0x5139('0x13')]);router['put'](_0x5139('0x14'),auth['isAuthenticated'](),interaction[_0x5139('0x10')](_0x5139('0x11'),_0x5139('0x15')),controller[_0x5139('0x16')]);router[_0x5139('0x17')]('/:id',auth[_0x5139('0x6')](),interaction[_0x5139('0x10')](_0x5139('0x11'),'mailinteraction:destroy'),controller['destroy']);router['delete'](_0x5139('0x18'),auth['isAuthenticated'](),controller[_0x5139('0x19')]);module[_0x5139('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 18810b3..7e9cba3 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 _0x1a14=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x1a14,0xce));var _0x41a1=function(_0x359a87,_0x457515){_0x359a87=_0x359a87-0x0;var _0x4c5fa9=_0x1a14[_0x359a87];return _0x4c5fa9;};'use strict';var Sequelize=require(_0x41a1('0x0'));var iconv=require(_0x41a1('0x1'));module[_0x41a1('0x2')]={'closed':{'type':Sequelize[_0x41a1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x41a1('0x4')]},'disposition':{'type':Sequelize[_0x41a1('0x5')]},'secondDisposition':{'type':Sequelize[_0x41a1('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x41a1('0x5')]},'inReplyTo':{'type':Sequelize[_0x41a1('0x5')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x41a1('0x6')](_0x41a1('0x7'))},'subject':{'type':Sequelize[_0x41a1('0x6')]()},'attach':{'type':Sequelize[_0x41a1('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x41a1('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x41a1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x41a1('0x8')]('in',_0x41a1('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x41a1('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x41a1('0x8')]('in',_0x41a1('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x41a1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x555b=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv'];(function(_0xec3f92,_0x54762a){var _0x277a09=function(_0x71c529){while(--_0x71c529){_0xec3f92['push'](_0xec3f92['shift']());}};_0x277a09(++_0x54762a);}(_0x555b,0x16f));var _0xb555=function(_0x27f5c3,_0xefcec){_0x27f5c3=_0x27f5c3-0x0;var _0xf28982=_0x555b[_0x27f5c3];return _0xf28982;};'use strict';var Sequelize=require(_0xb555('0x0'));var iconv=require(_0xb555('0x1'));module['exports']={'closed':{'type':Sequelize[_0xb555('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb555('0x3')]},'disposition':{'type':Sequelize[_0xb555('0x4')]},'secondDisposition':{'type':Sequelize[_0xb555('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb555('0x4')]},'note':{'type':Sequelize[_0xb555('0x4')]},'inReplyTo':{'type':Sequelize[_0xb555('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb555('0x5')](_0xb555('0x6'))},'subject':{'type':Sequelize[_0xb555('0x5')]()},'attach':{'type':Sequelize[_0xb555('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb555('0x3')]},'substatus':{'type':Sequelize[_0xb555('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xb555('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xb555('0x7')]('in',_0xb555('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb555('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index cad8cc8..2b5630e 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 _0xe5f7=['rows','addTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','server','files','tmp','root','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','each','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','push','readFileSync','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','html-entities','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','map','MailInteraction','rawAttributes','key','getOptions','findAll','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','omit','ids','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','sort','where','pick','MailInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','length'];(function(_0x5d8792,_0x4f5438){var _0x986d0e=function(_0x1d4b83){while(--_0x1d4b83){_0x5d8792['push'](_0x5d8792['shift']());}};_0x986d0e(++_0x4f5438);}(_0xe5f7,0x178));var _0x7e5f=function(_0x1dddce,_0x3182e2){_0x1dddce=_0x1dddce-0x0;var _0x5ccb42=_0xe5f7[_0x1dddce];return _0x5ccb42;};'use strict';var emlformat=require(_0x7e5f('0x0'));var rimraf=require(_0x7e5f('0x1'));var zipdir=require(_0x7e5f('0x2'));var moment=require(_0x7e5f('0x3'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x7e5f('0x4'));var fs=require('fs');var _=require(_0x7e5f('0x5'));var juice=require(_0x7e5f('0x6'));var Redis=require('ioredis');var interaction=require(_0x7e5f('0x7'));var qs=require(_0x7e5f('0x8'));var logger=require('../../config/logger')(_0x7e5f('0x9'));var config=require(_0x7e5f('0xa'));var db=require(_0x7e5f('0xb'))['db'];var htmlEntities=require(_0x7e5f('0xc'));config[_0x7e5f('0xd')]=_[_0x7e5f('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e5f('0xf'))(new Redis(config[_0x7e5f('0xd')]));require(_0x7e5f('0x10'))[_0x7e5f('0x11')](socket);function respondWithStatusCode(_0x3844af,_0x218e50){_0x218e50=_0x218e50||0xcc;return function(_0x182035){if(_0x182035){return _0x3844af[_0x7e5f('0x12')](_0x218e50);}return _0x3844af[_0x7e5f('0x13')](_0x218e50)[_0x7e5f('0x14')]();};}function respondWithResult(_0x5bc453,_0x3dc3c8){_0x3dc3c8=_0x3dc3c8||0xc8;return function(_0x505fbb){if(_0x505fbb){return _0x5bc453[_0x7e5f('0x13')](_0x3dc3c8)[_0x7e5f('0x15')](_0x505fbb);}};}function respondWithFilteredResult(_0x14e2fe,_0x449e60){return function(_0x23e241){if(_0x23e241){var _0x282866=typeof _0x449e60[_0x7e5f('0x16')]===_0x7e5f('0x17')&&typeof _0x449e60[_0x7e5f('0x18')]===_0x7e5f('0x17');var _0x5ba25b=_0x23e241[_0x7e5f('0x19')];var _0x39b644=_0x282866?0x0:_0x449e60[_0x7e5f('0x16')];var _0x62cdf5=_0x282866?_0x23e241['count']:_0x449e60['offset']+_0x449e60['limit'];var _0x44e284;if(_0x62cdf5>=_0x5ba25b){_0x62cdf5=_0x5ba25b;_0x44e284=0xc8;}else{_0x44e284=0xce;}_0x14e2fe[_0x7e5f('0x13')](_0x44e284);return _0x14e2fe['set'](_0x7e5f('0x1a'),_0x39b644+'-'+_0x62cdf5+'/'+_0x5ba25b)[_0x7e5f('0x15')](_0x23e241);}return null;};}function saveUpdates(_0x30802b){return function(_0xd97c29){if(_0xd97c29){return _0xd97c29[_0x7e5f('0x1b')](_0x30802b)[_0x7e5f('0x1c')](function(_0x2e2385){return _0x2e2385;});}return null;};}function removeEntity(_0x5481c7){return function(_0x38bd30){if(_0x38bd30){return _0x38bd30['destroy']()[_0x7e5f('0x1c')](function(){_0x5481c7[_0x7e5f('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x892c6f){return function(_0x4c81d5){if(!_0x4c81d5){_0x892c6f['sendStatus'](0x194);}return _0x4c81d5;};}function handleError(_0x273c9b,_0x5b4aaa){_0x5b4aaa=_0x5b4aaa||0x1f4;return function(_0x196d5b){logger['error'](_0x196d5b[_0x7e5f('0x1d')]);if(_0x196d5b[_0x7e5f('0x1e')]){delete _0x196d5b[_0x7e5f('0x1e')];}_0x273c9b['status'](_0x5b4aaa)['send'](_0x196d5b);};}exports['index']=function(_0x33b4f6,_0x3e7191){var _0x372eb9={};var _0x2f250d=_[_0x7e5f('0x1f')](db[_0x7e5f('0x20')][_0x7e5f('0x21')],function(_0x39522f){return{'name':_0x39522f['fieldName'],'type':_0x39522f['type'][_0x7e5f('0x22')]};});_0x372eb9=qs[_0x7e5f('0x23')](_0x2f250d,_0x33b4f6);return interaction[_0x7e5f('0x24')](_0x7e5f('0x25'),_0x33b4f6[_0x7e5f('0x26')],_0x33b4f6[_0x7e5f('0x27')],_0x372eb9,_0x2f250d)[_0x7e5f('0x1c')](respondWithFilteredResult(_0x3e7191,_0x372eb9))[_0x7e5f('0x28')](handleError(_0x3e7191,null));};exports[_0x7e5f('0x29')]=function(_0x3b73c6,_0x142134){var _0x69cd03={'raw':![],'where':{'id':_0x3b73c6[_0x7e5f('0x2a')]['id']}},_0x453f0f={};_0x453f0f[_0x7e5f('0x2b')]=_[_0x7e5f('0x2c')](db['MailInteraction'][_0x7e5f('0x21')]);_0x453f0f[_0x7e5f('0x26')]=_[_0x7e5f('0x2c')](_0x3b73c6[_0x7e5f('0x26')]);_0x453f0f[_0x7e5f('0x2d')]=_[_0x7e5f('0x2e')](_0x453f0f['model'],_0x453f0f['query']);_0x69cd03[_0x7e5f('0x2f')]=_[_0x7e5f('0x2e')](_0x453f0f[_0x7e5f('0x2b')],qs[_0x7e5f('0x30')](_0x3b73c6[_0x7e5f('0x26')][_0x7e5f('0x30')]));_0x69cd03[_0x7e5f('0x2f')]=_0x69cd03[_0x7e5f('0x2f')]['length']?_0x69cd03[_0x7e5f('0x2f')]:_0x453f0f[_0x7e5f('0x2b')];if(_0x3b73c6[_0x7e5f('0x26')][_0x7e5f('0x31')]){_0x69cd03[_0x7e5f('0x32')]=[{'all':!![]}];}_0x69cd03=_[_0x7e5f('0x33')]({},_0x69cd03,_0x3b73c6[_0x7e5f('0x34')]);return db[_0x7e5f('0x20')][_0x7e5f('0x35')](_0x69cd03)[_0x7e5f('0x1c')](handleEntityNotFound(_0x142134,null))[_0x7e5f('0x1c')](respondWithResult(_0x142134,null))[_0x7e5f('0x28')](handleError(_0x142134,null));};exports['create']=function(_0x194879,_0x5dac2c){return db[_0x7e5f('0x20')][_0x7e5f('0x36')](_0x194879[_0x7e5f('0x37')],{})[_0x7e5f('0x1c')](respondWithResult(_0x5dac2c,0xc9))[_0x7e5f('0x28')](handleError(_0x5dac2c,null));};exports[_0x7e5f('0x1b')]=function(_0x1910d2,_0x16d0b6){if(_0x1910d2[_0x7e5f('0x37')]['id']){delete _0x1910d2[_0x7e5f('0x37')]['id'];}return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x1910d2['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x16d0b6,null))[_0x7e5f('0x1c')](saveUpdates(_0x1910d2[_0x7e5f('0x37')],null))[_0x7e5f('0x1c')](respondWithResult(_0x16d0b6,null))['catch'](handleError(_0x16d0b6,null));};exports['destroy']=function(_0x1b5e2a,_0x7abca4){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x1b5e2a[_0x7e5f('0x2a')]['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x7abca4,null))[_0x7e5f('0x1c')](removeEntity(_0x7abca4,null))[_0x7e5f('0x28')](handleError(_0x7abca4,null));};exports[_0x7e5f('0x38')]=function(_0x311c96,_0x370265){return db[_0x7e5f('0x20')][_0x7e5f('0x38')]()['then'](respondWithResult(_0x370265,null))[_0x7e5f('0x28')](handleError(_0x370265,null));};exports[_0x7e5f('0x39')]=function(_0xd3a9c2,_0x3dd373){return db['MailMessage'][_0x7e5f('0x35')]({'where':{'id':_0xd3a9c2['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3dd373,null))[_0x7e5f('0x1c')](function(_0x127a87){if(_0x127a87){return _0x127a87[_0x7e5f('0x39')](_0xd3a9c2[_0x7e5f('0x37')]['ids'],_[_0x7e5f('0x3a')](_0xd3a9c2[_0x7e5f('0x37')],[_0x7e5f('0x3b'),'id'])||{});}})[_0x7e5f('0x1c')](respondWithResult(_0x3dd373,null))['catch'](handleError(_0x3dd373,null));};exports[_0x7e5f('0x3c')]=function(_0x3dc064,_0x3f8562){var _0x30c54f={'raw':![],'where':{}};var _0x532eff={};var _0x37bf6a={'count':0x0,'rows':[]};return db['MailInteraction'][_0x7e5f('0x3d')]({'where':{'id':_0x3dc064['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3f8562,null))[_0x7e5f('0x1c')](function(_0x330a7c){if(_0x330a7c){_0x532eff['model']=_[_0x7e5f('0x2c')](db[_0x7e5f('0x3e')][_0x7e5f('0x21')]);_0x532eff[_0x7e5f('0x26')]=_[_0x7e5f('0x2c')](_0x3dc064[_0x7e5f('0x26')]);_0x532eff[_0x7e5f('0x2d')]=_[_0x7e5f('0x2e')](_0x532eff['model'],_0x532eff[_0x7e5f('0x26')]);_0x30c54f['attributes']=_[_0x7e5f('0x2e')](_0x532eff[_0x7e5f('0x2b')],qs[_0x7e5f('0x30')](_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x30')]));_0x30c54f[_0x7e5f('0x2f')]=_0x30c54f[_0x7e5f('0x2f')]['length']?_0x30c54f[_0x7e5f('0x2f')]:_0x532eff[_0x7e5f('0x2b')];if(!_0x3dc064['query'][_0x7e5f('0x3f')](_0x7e5f('0x40'))){_0x30c54f[_0x7e5f('0x18')]=qs[_0x7e5f('0x18')](_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x18')]);_0x30c54f[_0x7e5f('0x16')]=qs[_0x7e5f('0x16')](_0x3dc064['query']['offset']);}_0x30c54f['order']=qs[_0x7e5f('0x41')](_0x3dc064['query'][_0x7e5f('0x41')]);_0x30c54f[_0x7e5f('0x42')]=qs['filters'](_[_0x7e5f('0x43')](_0x3dc064[_0x7e5f('0x26')],_0x532eff['filters']));_0x30c54f[_0x7e5f('0x42')][_0x7e5f('0x44')]=_0x330a7c['id'];if(_0x3dc064[_0x7e5f('0x26')]['filter']){_0x30c54f[_0x7e5f('0x42')]=_[_0x7e5f('0x33')](_0x30c54f['where'],{'$or':_[_0x7e5f('0x1f')](_0x30c54f[_0x7e5f('0x2f')],function(_0x4b662c){var _0x106f93={};_0x106f93[_0x4b662c]={'$like':'%'+_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x45')]+'%'};return _0x106f93;})});}if(_0x3dc064['query'][_0x7e5f('0x46')]){var _0x520163=_0x3dc064[_0x7e5f('0x26')][_0x7e5f('0x46')][_0x7e5f('0x47')](',');var _0xb41d9d={};_0xb41d9d[_0x520163[0x0]]={'$gte':moment(_0x520163[0x1])['format'](_0x7e5f('0x48'))};_0x30c54f[_0x7e5f('0x42')]=_[_0x7e5f('0x33')](_0x30c54f['where'],_0xb41d9d);}_0x30c54f=_['merge']({},_0x30c54f,_0x3dc064[_0x7e5f('0x34')]);return db[_0x7e5f('0x3e')]['count']({'where':_0x30c54f[_0x7e5f('0x42')]})[_0x7e5f('0x1c')](function(_0x1940e3){_0x37bf6a['count']=_0x1940e3;if(_0x3dc064['query'][_0x7e5f('0x31')]){_0x30c54f['include']=[{'all':!![]}];}return db['MailMessage'][_0x7e5f('0x24')](_0x30c54f);})[_0x7e5f('0x1c')](function(_0x4050fb){if(_0x3dc064['query'][_0x7e5f('0x49')]===_0x7e5f('0x4a')){for(var _0x2f06de=0x0;_0x2f06de<_0x4050fb[_0x7e5f('0x4b')];_0x2f06de++){_0x4050fb[_0x2f06de][_0x7e5f('0x37')]=juice(_0x4050fb[_0x2f06de][_0x7e5f('0x37')]);}}_0x37bf6a[_0x7e5f('0x4c')]=_0x4050fb;return _0x37bf6a;});}})['then'](respondWithFilteredResult(_0x3f8562,_0x30c54f))[_0x7e5f('0x28')](handleError(_0x3f8562,null));};exports[_0x7e5f('0x4d')]=function(_0x3adc96,_0x3a3584){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x3adc96[_0x7e5f('0x2a')]['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x3a3584,null))[_0x7e5f('0x1c')](function(_0x1a01d9){if(_0x1a01d9){return _0x1a01d9['setTags'](_0x3adc96[_0x7e5f('0x37')][_0x7e5f('0x3b')],_['omit'](_0x3adc96[_0x7e5f('0x37')],['ids','id'])||{})[_0x7e5f('0x4e')](function(){return db[_0x7e5f('0x4f')]['findAll']({'attributes':['id','name',_0x7e5f('0x50')],'where':{'id':_0x3adc96[_0x7e5f('0x37')][_0x7e5f('0x3b')]}});})['then'](function(_0x5ec8ae){socket[_0x7e5f('0x51')](_0x7e5f('0x52'),{'id':Number(_0x3adc96['params']['id']),'tags':_0x5ec8ae||[]});return{'id':Number(_0x3adc96[_0x7e5f('0x2a')]['id']),'tags':_0x5ec8ae||[]};});}})[_0x7e5f('0x1c')](respondWithResult(_0x3a3584,null))['catch'](handleError(_0x3a3584,null));};exports[_0x7e5f('0x53')]=function(_0x59c07e,_0x23eda1){return db[_0x7e5f('0x20')][_0x7e5f('0x35')]({'where':{'id':_0x59c07e['params']['id']}})[_0x7e5f('0x1c')](handleEntityNotFound(_0x23eda1,null))['then'](function(_0x59a9ff){if(_0x59a9ff){return _0x59a9ff[_0x7e5f('0x53')](_0x59c07e[_0x7e5f('0x26')][_0x7e5f('0x3b')]);}})[_0x7e5f('0x1c')](respondWithStatusCode(_0x23eda1,null))['catch'](handleError(_0x23eda1,null));};exports['download']=function(_0x4f4a54,_0x19ea27){var _0x4a9bbf=moment()[_0x7e5f('0x54')]()[_0x7e5f('0x55')]();var _0xa26a59=path[_0x7e5f('0x56')](config['root'],_0x7e5f('0x57'),_0x7e5f('0x58'),_0x7e5f('0x59'));var _0x5d603b=path['join'](config[_0x7e5f('0x5a')],_0x7e5f('0x57'),_0x7e5f('0x58'),_0x7e5f('0x5b'));var _0x489e54=path[_0x7e5f('0x56')](_0xa26a59,_0x4a9bbf);var _0x58528e=util[_0x7e5f('0x5c')](_0x7e5f('0x5d'),_0x4f4a54[_0x7e5f('0x2a')]['id'],_0x4a9bbf);var _0x357578=path['join'](_0xa26a59,_0x58528e);var _0x30e0f5=[];if(_0x4f4a54[_0x7e5f('0x26')][_0x7e5f('0x5b')]){_0x30e0f5['push']({'model':db[_0x7e5f('0x5e')],'as':_0x7e5f('0x5f'),'raw':!![]});}var _0x5eca72=[{'model':db[_0x7e5f('0x3e')],'as':_0x7e5f('0x60'),'attributes':['id',_0x7e5f('0x37'),_0x7e5f('0x61'),'to','cc',_0x7e5f('0x62'),_0x7e5f('0x63'),_0x7e5f('0x64')],'where':{'secret':![]},'order':qs[_0x7e5f('0x41')]('id'),'include':_0x30e0f5}];return db[_0x7e5f('0x20')]['find']({'where':{'id':_0x4f4a54['params']['id']},'include':_0x5eca72})[_0x7e5f('0x1c')](handleEntityNotFound(_0x19ea27,null))['then'](function(_0x313c62){if(_0x313c62&&_0x313c62['Messages']){var _0x41234b=_0x313c62[_0x7e5f('0x65')]({'plain':!![]});fs['mkdirSync'](_0x489e54);return BPromise[_0x7e5f('0x66')](_0x41234b[_0x7e5f('0x60')],function(_0x45c6ac,_0x5c687d){var _0x489d2d={'from':_0x45c6ac[_0x7e5f('0x61')],'to':_0x45c6ac['to'],'subject':_0x45c6ac['subject'],'html':htmlEntities[_0x7e5f('0x67')](_0x45c6ac['body']),'headers':{'Date':moment(_0x45c6ac[_0x7e5f('0x64')])[_0x7e5f('0x5c')](_0x7e5f('0x68'))},'attachments':[]};if(_0x45c6ac['cc']){_0x489d2d['headers']['Cc']=_0x45c6ac['cc'];}if(_0x45c6ac[_0x7e5f('0x62')]){_0x489d2d[_0x7e5f('0x69')][_0x7e5f('0x6a')]=_0x45c6ac[_0x7e5f('0x62')];}return new BPromise(function(_0xd7376e,_0x4576c9){if(_0x45c6ac['Attachments']){for(var _0x40a213=0x0;_0x40a213<_0x45c6ac[_0x7e5f('0x5f')][_0x7e5f('0x4b')];_0x40a213++){var _0x8c3661=_0x45c6ac['Attachments'][_0x40a213];var _0x5a8acd=path[_0x7e5f('0x56')](_0x5d603b,_0x8c3661[_0x7e5f('0x6b')]);if(fs['existsSync'](_0x5a8acd)){_0x489d2d['attachments'][_0x7e5f('0x6c')]({'name':_0x8c3661[_0x7e5f('0x1e')],'contentType':_0x8c3661['type'],'data':fs[_0x7e5f('0x6d')](_0x5a8acd)});}}}emlformat['build'](_0x489d2d,function(_0x5290db,_0x467b85){if(_0x5290db)return _0x4576c9(_0x5290db);fs[_0x7e5f('0x6e')](path[_0x7e5f('0x56')](_0x489e54,util[_0x7e5f('0x5c')](_0x7e5f('0x6f'),_0x5c687d)),_0x467b85);return _0xd7376e(_0x467b85);});});})['then'](function(){return new BPromise(function(_0x2d8f12,_0x9b53ca){zipdir(_0x489e54,{'saveTo':_0x357578},function(_0x191fba,_0x5565df){if(_0x191fba)return _0x9b53ca(_0x191fba);return _0x2d8f12(_0x5565df);});})['then'](function(){return new BPromise(function(_0x3b03dd,_0x4f336a){rimraf(_0x489e54,function(_0xef6fb7){if(_0xef6fb7)_0x4f336a(_0xef6fb7);return _0x3b03dd();});});})[_0x7e5f('0x1c')](function(){return _0x19ea27['download'](_0x357578,_0x58528e,function(_0x5bd7be){if(!_0x5bd7be)fs[_0x7e5f('0x70')](_0x357578);});});});}else{return _0x19ea27[_0x7e5f('0x12')](0xc8);}})[_0x7e5f('0x28')](handleError(_0x19ea27,null));}; \ No newline at end of file +var _0x363b=['name','index','map','MailInteraction','rawAttributes','type','key','getOptions','findAll','mail','query','user','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','create','body','params','describe','MailMessage','addMessage','omit','getMessages','findOne','hasOwnProperty','order','where','MailInteractionId','filter','$gte','split','options','inlineCss','rows','addTags','setTags','ids','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','Attachments','from','subject','createdAt','sort','Messages','get','mkdirSync','each','missing.recipient@your.company.com','decode','headers','bcc','Bcc','basename','existsSync','push','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x363b,0x13e));var _0xb363=function(_0x370c24,_0x44d426){_0x370c24=_0x370c24-0x0;var _0x187d27=_0x363b[_0x370c24];return _0x187d27;};'use strict';var emlformat=require(_0xb363('0x0'));var rimraf=require(_0xb363('0x1'));var zipdir=require(_0xb363('0x2'));var moment=require('moment');var BPromise=require(_0xb363('0x3'));var util=require(_0xb363('0x4'));var path=require(_0xb363('0x5'));var fs=require('fs');var _=require(_0xb363('0x6'));var juice=require(_0xb363('0x7'));var Redis=require(_0xb363('0x8'));var interaction=require(_0xb363('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0xb363('0xa'))('api');var config=require(_0xb363('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xb363('0xc'));config[_0xb363('0xd')]=_[_0xb363('0xe')](config[_0xb363('0xd')],{'host':_0xb363('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb363('0x10'))[_0xb363('0x11')](socket);function respondWithStatusCode(_0x45fb5e,_0x221713){_0x221713=_0x221713||0xcc;return function(_0x25d3cc){if(_0x25d3cc){return _0x45fb5e[_0xb363('0x12')](_0x221713);}return _0x45fb5e[_0xb363('0x13')](_0x221713)[_0xb363('0x14')]();};}function respondWithResult(_0x3d0cdf,_0x5cc4c2){_0x5cc4c2=_0x5cc4c2||0xc8;return function(_0xb57643){if(_0xb57643){return _0x3d0cdf[_0xb363('0x13')](_0x5cc4c2)[_0xb363('0x15')](_0xb57643);}};}function respondWithFilteredResult(_0x4ad54a,_0x4173c5){return function(_0x4eb866){if(_0x4eb866){var _0x28ddb8=typeof _0x4173c5[_0xb363('0x16')]===_0xb363('0x17')&&typeof _0x4173c5[_0xb363('0x18')]==='undefined';var _0x324d0a=_0x4eb866['count'];var _0x27211f=_0x28ddb8?0x0:_0x4173c5[_0xb363('0x16')];var _0xc1d63a=_0x28ddb8?_0x4eb866[_0xb363('0x19')]:_0x4173c5[_0xb363('0x16')]+_0x4173c5[_0xb363('0x18')];var _0x485cfb;if(_0xc1d63a>=_0x324d0a){_0xc1d63a=_0x324d0a;_0x485cfb=0xc8;}else{_0x485cfb=0xce;}_0x4ad54a[_0xb363('0x13')](_0x485cfb);return _0x4ad54a[_0xb363('0x1a')](_0xb363('0x1b'),_0x27211f+'-'+_0xc1d63a+'/'+_0x324d0a)[_0xb363('0x15')](_0x4eb866);}return null;};}function saveUpdates(_0x3f0167){return function(_0xb837d3){if(_0xb837d3){return _0xb837d3[_0xb363('0x1c')](_0x3f0167)[_0xb363('0x1d')](function(_0x44fe0a){return _0x44fe0a;});}return null;};}function removeEntity(_0x2149c0){return function(_0x5f09b0){if(_0x5f09b0){return _0x5f09b0[_0xb363('0x1e')]()[_0xb363('0x1d')](function(){_0x2149c0['status'](0xcc)[_0xb363('0x14')]();});}};}function handleEntityNotFound(_0x1d1851){return function(_0x2f255b){if(!_0x2f255b){_0x1d1851[_0xb363('0x12')](0x194);}return _0x2f255b;};}function handleError(_0x4083e5,_0x2cc52f){_0x2cc52f=_0x2cc52f||0x1f4;return function(_0x112f69){logger[_0xb363('0x1f')](_0x112f69[_0xb363('0x20')]);if(_0x112f69['name']){delete _0x112f69[_0xb363('0x21')];}_0x4083e5[_0xb363('0x13')](_0x2cc52f)['send'](_0x112f69);};}exports[_0xb363('0x22')]=function(_0xd2f1b,_0x26020c){var _0x326376={};var _0x32c534=_[_0xb363('0x23')](db[_0xb363('0x24')][_0xb363('0x25')],function(_0xed7433){return{'name':_0xed7433['fieldName'],'type':_0xed7433[_0xb363('0x26')][_0xb363('0x27')]};});_0x326376=qs[_0xb363('0x28')](_0x32c534,_0xd2f1b);return interaction[_0xb363('0x29')](_0xb363('0x2a'),_0xd2f1b[_0xb363('0x2b')],_0xd2f1b[_0xb363('0x2c')],_0x326376,_0x32c534)[_0xb363('0x1d')](respondWithFilteredResult(_0x26020c,_0x326376))['catch'](handleError(_0x26020c,null));};exports[_0xb363('0x2d')]=function(_0x3a0c75,_0x16db09){var _0x8149a6={'raw':![],'where':{'id':_0x3a0c75['params']['id']}},_0x224876={};_0x224876[_0xb363('0x2e')]=_[_0xb363('0x2f')](db[_0xb363('0x24')][_0xb363('0x25')]);_0x224876[_0xb363('0x2b')]=_[_0xb363('0x2f')](_0x3a0c75[_0xb363('0x2b')]);_0x224876[_0xb363('0x30')]=_[_0xb363('0x31')](_0x224876[_0xb363('0x2e')],_0x224876[_0xb363('0x2b')]);_0x8149a6[_0xb363('0x32')]=_[_0xb363('0x31')](_0x224876[_0xb363('0x2e')],qs[_0xb363('0x33')](_0x3a0c75[_0xb363('0x2b')][_0xb363('0x33')]));_0x8149a6[_0xb363('0x32')]=_0x8149a6['attributes'][_0xb363('0x34')]?_0x8149a6[_0xb363('0x32')]:_0x224876[_0xb363('0x2e')];if(_0x3a0c75[_0xb363('0x2b')][_0xb363('0x35')]){_0x8149a6[_0xb363('0x36')]=[{'all':!![]}];}_0x8149a6=_[_0xb363('0x37')]({},_0x8149a6,_0x3a0c75['options']);return db['MailInteraction'][_0xb363('0x38')](_0x8149a6)[_0xb363('0x1d')](handleEntityNotFound(_0x16db09,null))[_0xb363('0x1d')](respondWithResult(_0x16db09,null))[_0xb363('0x39')](handleError(_0x16db09,null));};exports[_0xb363('0x3a')]=function(_0x3a6ede,_0x416388){return db['MailInteraction'][_0xb363('0x3a')](_0x3a6ede[_0xb363('0x3b')],{})['then'](respondWithResult(_0x416388,0xc9))[_0xb363('0x39')](handleError(_0x416388,null));};exports[_0xb363('0x1c')]=function(_0x518e4f,_0x4544ee){if(_0x518e4f['body']['id']){delete _0x518e4f['body']['id'];}return db[_0xb363('0x24')][_0xb363('0x38')]({'where':{'id':_0x518e4f[_0xb363('0x3c')]['id']}})[_0xb363('0x1d')](handleEntityNotFound(_0x4544ee,null))[_0xb363('0x1d')](saveUpdates(_0x518e4f[_0xb363('0x3b')],null))[_0xb363('0x1d')](respondWithResult(_0x4544ee,null))['catch'](handleError(_0x4544ee,null));};exports[_0xb363('0x1e')]=function(_0x36431d,_0x328454){return db[_0xb363('0x24')][_0xb363('0x38')]({'where':{'id':_0x36431d[_0xb363('0x3c')]['id']}})[_0xb363('0x1d')](handleEntityNotFound(_0x328454,null))[_0xb363('0x1d')](removeEntity(_0x328454,null))['catch'](handleError(_0x328454,null));};exports[_0xb363('0x3d')]=function(_0x11fab2,_0x597133){return db['MailInteraction'][_0xb363('0x3d')]()['then'](respondWithResult(_0x597133,null))[_0xb363('0x39')](handleError(_0x597133,null));};exports['addMessage']=function(_0x50d753,_0x42fa78){return db[_0xb363('0x3e')]['find']({'where':{'id':_0x50d753['params']['id']}})[_0xb363('0x1d')](handleEntityNotFound(_0x42fa78,null))[_0xb363('0x1d')](function(_0x5a4e52){if(_0x5a4e52){return _0x5a4e52[_0xb363('0x3f')](_0x50d753[_0xb363('0x3b')]['ids'],_[_0xb363('0x40')](_0x50d753['body'],['ids','id'])||{});}})[_0xb363('0x1d')](respondWithResult(_0x42fa78,null))[_0xb363('0x39')](handleError(_0x42fa78,null));};exports[_0xb363('0x41')]=function(_0x9e42f2,_0x268a5a){var _0x3ddfa0={'raw':![],'where':{}};var _0xd2227c={};var _0x3cb08b={'count':0x0,'rows':[]};return db[_0xb363('0x24')][_0xb363('0x42')]({'where':{'id':_0x9e42f2[_0xb363('0x3c')]['id']}})['then'](handleEntityNotFound(_0x268a5a,null))[_0xb363('0x1d')](function(_0x4d52e3){if(_0x4d52e3){_0xd2227c[_0xb363('0x2e')]=_[_0xb363('0x2f')](db['MailMessage']['rawAttributes']);_0xd2227c['query']=_[_0xb363('0x2f')](_0x9e42f2[_0xb363('0x2b')]);_0xd2227c[_0xb363('0x30')]=_[_0xb363('0x31')](_0xd2227c[_0xb363('0x2e')],_0xd2227c[_0xb363('0x2b')]);_0x3ddfa0['attributes']=_[_0xb363('0x31')](_0xd2227c['model'],qs[_0xb363('0x33')](_0x9e42f2[_0xb363('0x2b')][_0xb363('0x33')]));_0x3ddfa0[_0xb363('0x32')]=_0x3ddfa0[_0xb363('0x32')][_0xb363('0x34')]?_0x3ddfa0[_0xb363('0x32')]:_0xd2227c[_0xb363('0x2e')];if(!_0x9e42f2['query'][_0xb363('0x43')]('nolimit')){_0x3ddfa0[_0xb363('0x18')]=qs['limit'](_0x9e42f2['query'][_0xb363('0x18')]);_0x3ddfa0['offset']=qs[_0xb363('0x16')](_0x9e42f2[_0xb363('0x2b')][_0xb363('0x16')]);}_0x3ddfa0[_0xb363('0x44')]=qs['sort'](_0x9e42f2[_0xb363('0x2b')]['sort']);_0x3ddfa0[_0xb363('0x45')]=qs[_0xb363('0x30')](_['pick'](_0x9e42f2['query'],_0xd2227c[_0xb363('0x30')]));_0x3ddfa0[_0xb363('0x45')][_0xb363('0x46')]=_0x4d52e3['id'];if(_0x9e42f2[_0xb363('0x2b')][_0xb363('0x47')]){_0x3ddfa0[_0xb363('0x45')]=_[_0xb363('0x37')](_0x3ddfa0[_0xb363('0x45')],{'$or':_['map'](_0x3ddfa0[_0xb363('0x32')],function(_0x4209c6){var _0xf6be8e={};_0xf6be8e[_0x4209c6]={'$like':'%'+_0x9e42f2[_0xb363('0x2b')]['filter']+'%'};return _0xf6be8e;})});}if(_0x9e42f2[_0xb363('0x2b')][_0xb363('0x48')]){var _0xe2bc14=_0x9e42f2['query'][_0xb363('0x48')][_0xb363('0x49')](',');var _0x54a68e={};_0x54a68e[_0xe2bc14[0x0]]={'$gte':moment(_0xe2bc14[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x3ddfa0[_0xb363('0x45')]=_[_0xb363('0x37')](_0x3ddfa0[_0xb363('0x45')],_0x54a68e);}_0x3ddfa0=_[_0xb363('0x37')]({},_0x3ddfa0,_0x9e42f2[_0xb363('0x4a')]);return db[_0xb363('0x3e')]['count']({'where':_0x3ddfa0[_0xb363('0x45')]})[_0xb363('0x1d')](function(_0x336746){_0x3cb08b[_0xb363('0x19')]=_0x336746;if(_0x9e42f2['query'][_0xb363('0x35')]){_0x3ddfa0[_0xb363('0x36')]=[{'all':!![]}];}return db[_0xb363('0x3e')][_0xb363('0x29')](_0x3ddfa0);})[_0xb363('0x1d')](function(_0x1c56ff){if(_0x9e42f2[_0xb363('0x2b')][_0xb363('0x4b')]==='true'){for(var _0x5575c3=0x0;_0x5575c3<_0x1c56ff['length'];_0x5575c3++){_0x1c56ff[_0x5575c3][_0xb363('0x3b')]=juice(_0x1c56ff[_0x5575c3]['body']);}}_0x3cb08b[_0xb363('0x4c')]=_0x1c56ff;return _0x3cb08b;});}})[_0xb363('0x1d')](respondWithFilteredResult(_0x268a5a,_0x3ddfa0))[_0xb363('0x39')](handleError(_0x268a5a,null));};exports[_0xb363('0x4d')]=function(_0x1decb0,_0x968e3a){return db[_0xb363('0x24')][_0xb363('0x38')]({'where':{'id':_0x1decb0[_0xb363('0x3c')]['id']}})[_0xb363('0x1d')](handleEntityNotFound(_0x968e3a,null))[_0xb363('0x1d')](function(_0x41a1f5){if(_0x41a1f5){return _0x41a1f5[_0xb363('0x4e')](_0x1decb0['body'][_0xb363('0x4f')],_['omit'](_0x1decb0['body'],[_0xb363('0x4f'),'id'])||{})[_0xb363('0x50')](function(){return db[_0xb363('0x51')]['findAll']({'attributes':['id',_0xb363('0x21'),_0xb363('0x52')],'where':{'id':_0x1decb0[_0xb363('0x3b')][_0xb363('0x4f')]}});})[_0xb363('0x1d')](function(_0x44ad58){socket[_0xb363('0x53')](_0xb363('0x54'),{'id':Number(_0x1decb0[_0xb363('0x3c')]['id']),'tags':_0x44ad58||[]});return{'id':Number(_0x1decb0[_0xb363('0x3c')]['id']),'tags':_0x44ad58||[]};});}})['then'](respondWithResult(_0x968e3a,null))[_0xb363('0x39')](handleError(_0x968e3a,null));};exports['removeTags']=function(_0x3c83ca,_0x5320a9){return db[_0xb363('0x24')][_0xb363('0x38')]({'where':{'id':_0x3c83ca[_0xb363('0x3c')]['id']}})[_0xb363('0x1d')](handleEntityNotFound(_0x5320a9,null))[_0xb363('0x1d')](function(_0x513155){if(_0x513155){return _0x513155[_0xb363('0x55')](_0x3c83ca[_0xb363('0x2b')][_0xb363('0x4f')]);}})[_0xb363('0x1d')](respondWithStatusCode(_0x5320a9,null))[_0xb363('0x39')](handleError(_0x5320a9,null));};exports[_0xb363('0x56')]=function(_0x398570,_0x25992c){var _0x543f71=moment()['unix']()[_0xb363('0x57')]();var _0x1d1712=path[_0xb363('0x58')](config[_0xb363('0x59')],_0xb363('0x5a'),_0xb363('0x5b'),_0xb363('0x5c'));var _0x5b6c36=path[_0xb363('0x58')](config[_0xb363('0x59')],_0xb363('0x5a'),_0xb363('0x5b'),_0xb363('0x5d'));var _0x51d705=path[_0xb363('0x58')](_0x1d1712,_0x543f71);var _0x5ed2cf=util[_0xb363('0x5e')](_0xb363('0x5f'),_0x398570[_0xb363('0x3c')]['id'],_0x543f71);var _0x35e3d2=path[_0xb363('0x58')](_0x1d1712,_0x5ed2cf);var _0x50dcb3=[];if(_0x398570[_0xb363('0x2b')]['attachments']){_0x50dcb3['push']({'model':db[_0xb363('0x60')],'as':_0xb363('0x61'),'raw':!![]});}var _0x3a17e3=[{'model':db[_0xb363('0x3e')],'as':'Messages','attributes':['id',_0xb363('0x3b'),_0xb363('0x62'),'to','cc','bcc',_0xb363('0x63'),_0xb363('0x64')],'where':{'secret':![]},'order':qs[_0xb363('0x65')]('id'),'include':_0x50dcb3}];return db[_0xb363('0x24')][_0xb363('0x38')]({'where':{'id':_0x398570['params']['id']},'include':_0x3a17e3})[_0xb363('0x1d')](handleEntityNotFound(_0x25992c,null))[_0xb363('0x1d')](function(_0x1c4136){if(_0x1c4136&&_0x1c4136[_0xb363('0x66')]){var _0x12153c=_0x1c4136[_0xb363('0x67')]({'plain':!![]});fs[_0xb363('0x68')](_0x51d705);return BPromise[_0xb363('0x69')](_0x12153c['Messages'],function(_0x304278,_0x46c871){var _0x121dcb={'from':_0x304278[_0xb363('0x62')],'to':_0x304278['to']||_0xb363('0x6a'),'subject':_0x304278['subject'],'html':htmlEntities[_0xb363('0x6b')](_0x304278[_0xb363('0x3b')]),'headers':{'Date':moment(_0x304278[_0xb363('0x64')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x304278['cc']){_0x121dcb[_0xb363('0x6c')]['Cc']=_0x304278['cc'];}if(_0x304278[_0xb363('0x6d')]){_0x121dcb[_0xb363('0x6c')][_0xb363('0x6e')]=_0x304278[_0xb363('0x6d')];}return new BPromise(function(_0xe2ac66,_0x3440c0){if(_0x304278[_0xb363('0x61')]){for(var _0x4cfc3b=0x0;_0x4cfc3b<_0x304278[_0xb363('0x61')][_0xb363('0x34')];_0x4cfc3b++){var _0x787f6b=_0x304278[_0xb363('0x61')][_0x4cfc3b];var _0x4bd1af=path[_0xb363('0x58')](_0x5b6c36,_0x787f6b[_0xb363('0x6f')]);if(fs[_0xb363('0x70')](_0x4bd1af)){_0x121dcb[_0xb363('0x5d')][_0xb363('0x71')]({'name':_0x787f6b['name'],'contentType':_0x787f6b[_0xb363('0x26')],'data':fs['readFileSync'](_0x4bd1af)});}}}emlformat[_0xb363('0x72')](_0x121dcb,function(_0x4c2dd5,_0x5e65ba){if(_0x4c2dd5)return _0x3440c0(_0x4c2dd5);fs[_0xb363('0x73')](path[_0xb363('0x58')](_0x51d705,util['format'](_0xb363('0x74'),_0x46c871)),_0x5e65ba);return _0xe2ac66(_0x5e65ba);});});})[_0xb363('0x1d')](function(){return new BPromise(function(_0x5d665b,_0x4d0757){zipdir(_0x51d705,{'saveTo':_0x35e3d2},function(_0x61b426,_0x567e90){if(_0x61b426)return _0x4d0757(_0x61b426);return _0x5d665b(_0x567e90);});})[_0xb363('0x1d')](function(){return new BPromise(function(_0x3b59b4,_0x79f129){rimraf(_0x51d705,function(_0x3772c2){if(_0x3772c2)_0x79f129(_0x3772c2);return _0x3b59b4();});});})[_0xb363('0x1d')](function(){return _0x25992c[_0xb363('0x56')](_0x35e3d2,_0x5ed2cf,function(_0x4d8308){if(!_0x4d8308)fs['unlinkSync'](_0x35e3d2);});});});}else{return _0x25992c[_0xb363('0x12')](0xc8);}})['catch'](handleError(_0x25992c,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 924cc63..f4cabb8 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 _0x4fc5=['length','emit','hasOwnProperty','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update','then','setDataValue','findAll','unreadMessages'];(function(_0x470f0b,_0x11cfba){var _0x1f999d=function(_0x4c7922){while(--_0x4c7922){_0x470f0b['push'](_0x470f0b['shift']());}};_0x1f999d(++_0x11cfba);}(_0x4fc5,0xd6));var _0x54fc=function(_0x1ef0bc,_0x6e3409){_0x1ef0bc=_0x1ef0bc-0x0;var _0x2e52ed=_0x4fc5[_0x1ef0bc];return _0x2e52ed;};'use strict';var EventEmitter=require(_0x54fc('0x0'));var MailInteraction=require(_0x54fc('0x1'))['db'][_0x54fc('0x2')];var MailMessage=require(_0x54fc('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x54fc('0x3')](0x0);var events={'afterCreate':_0x54fc('0x4'),'afterUpdate':_0x54fc('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c20fc){return function(_0x50798e,_0x4c6d7d,_0x23a0c3){_0x50798e['getUsers']({'attributes':['id'],'raw':!![]})[_0x54fc('0x6')](function(_0x175b23){_0x50798e[_0x54fc('0x7')]('Users',_0x175b23['map'](function(_0x52e535){return{'id':_0x52e535['id']};}));return MailMessage[_0x54fc('0x8')]({'where':{'MailInteractionId':_0x50798e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x54fc('0x6')](function(_0x4e1543){_0x50798e[_0x54fc('0x7')](_0x54fc('0x9'),_0x4e1543[_0x54fc('0xa')]);MailInteractionEvents[_0x54fc('0xb')](_0x4c20fc+':'+_0x50798e['id'],_0x50798e);MailInteractionEvents[_0x54fc('0xb')](_0x4c20fc,_0x50798e);_0x23a0c3(null);})['catch'](_0x23a0c3(null));};}for(var e in events){if(events[_0x54fc('0xc')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x54fc('0xd')]=MailInteractionEvents; \ No newline at end of file +var _0xf7f4=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailInteraction','MailMessage','remove'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xf7f4,0x94));var _0x4f7f=function(_0x491612,_0x38c4da){_0x491612=_0x491612-0x0;var _0x3c6d4a=_0xf7f4[_0x491612];return _0x3c6d4a;};'use strict';var EventEmitter=require(_0x4f7f('0x0'));var MailInteraction=require(_0x4f7f('0x1'))['db'][_0x4f7f('0x2')];var MailMessage=require(_0x4f7f('0x1'))['db'][_0x4f7f('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x4f7f('0x4')};function emitEvent(_0x43d6d2){return function(_0x2d72e9,_0x3b71c5,_0x9fa02c){_0x2d72e9[_0x4f7f('0x5')]({'attributes':['id'],'raw':!![]})[_0x4f7f('0x6')](function(_0x4c2480){_0x2d72e9[_0x4f7f('0x7')](_0x4f7f('0x8'),_0x4c2480[_0x4f7f('0x9')](function(_0x519884){return{'id':_0x519884['id']};}));return MailMessage[_0x4f7f('0xa')]({'where':{'MailInteractionId':_0x2d72e9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f7f('0x6')](function(_0x1fc3a0){_0x2d72e9[_0x4f7f('0x7')](_0x4f7f('0xb'),_0x1fc3a0[_0x4f7f('0xc')]);MailInteractionEvents['emit'](_0x43d6d2+':'+_0x2d72e9['id'],_0x2d72e9);MailInteractionEvents[_0x4f7f('0xd')](_0x43d6d2,_0x2d72e9);_0x9fa02c(null);})[_0x4f7f('0xe')](_0x9fa02c(null));};}for(var e in events){if(events[_0x4f7f('0xf')](e)){var event=events[e];MailInteraction[_0x4f7f('0x10')](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 f173499..a84560e 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 _0xce75=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','FULLTEXT','substatusAt','format','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','substatus','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5cf6cd,_0x17ec58){var _0x4f1e41=function(_0x561b88){while(--_0x561b88){_0x5cf6cd['push'](_0x5cf6cd['shift']());}};_0x4f1e41(++_0x17ec58);}(_0xce75,0x1be));var _0x5ce7=function(_0x30310e,_0x1f511d){_0x30310e=_0x30310e-0x0;var _0x39e1ec=_0xce75[_0x30310e];return _0x39e1ec;};'use strict';var _=require(_0x5ce7('0x0'));var util=require(_0x5ce7('0x1'));var logger=require(_0x5ce7('0x2'))(_0x5ce7('0x3'));var moment=require('moment');var BPromise=require(_0x5ce7('0x4'));var rp=require(_0x5ce7('0x5'));var fs=require('fs');var path=require(_0x5ce7('0x6'));var rimraf=require(_0x5ce7('0x7'));var config=require(_0x5ce7('0x8'));var attributes=require(_0x5ce7('0x9'));module[_0x5ce7('0xa')]=function(_0x162935,_0x3b4d20){return _0x162935[_0x5ce7('0xb')]('MailInteraction',attributes,{'tableName':_0x5ce7('0xc'),'paranoid':![],'indexes':[{'name':_0x5ce7('0xd'),'fields':['subject','to'],'type':_0x5ce7('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53691e,_0x3f6e89,_0x3b6e26){if(_0x53691e['substatus']){_0x53691e[_0x5ce7('0xf')]=moment()[_0x5ce7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53691e[_0x5ce7('0x11')]){_0x53691e[_0x5ce7('0x12')]=moment()[_0x5ce7('0x10')](_0x5ce7('0x13'));}_0x3b6e26(null,_0x3f6e89);},'beforeUpdate':function(_0x2279d8,_0x197c51,_0x28b403){if(_0x2279d8[_0x5ce7('0x14')](_0x5ce7('0x15'))){_0x2279d8['substatusAt']=_0x2279d8['substatus']?moment()[_0x5ce7('0x10')](_0x5ce7('0x13')):null;}if(_0x2279d8[_0x5ce7('0x14')](_0x5ce7('0x11'))){_0x2279d8[_0x5ce7('0x12')]=moment()[_0x5ce7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x2279d8['substatus']=null;_0x2279d8[_0x5ce7('0xf')]=null;}_0x28b403(null,_0x2279d8);},'afterUpdate':function(_0x5bc103,_0x5d991a,_0x14015a){var _0x51be92=_0x162935[_0x5ce7('0x16')];var _0x43798a=_0x5bc103[_0x5ce7('0x17')]({'plain':!![]});if(_0x43798a[_0x5ce7('0x11')]){return _0x51be92[_0x5ce7('0x18')][_0x5ce7('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x43798a['id']}})[_0x5ce7('0x1a')](function(){_0x14015a();})[_0x5ce7('0x1b')](function(_0x39fafd){_0x14015a(_0x39fafd);});}else{_0x14015a();}}},'charset':_0x5ce7('0x1c'),'collate':_0x5ce7('0x1d')});}; \ No newline at end of file +var _0x6043=['format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','MailInteraction','fti_mail_interactions','FULLTEXT','substatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6043,0x6f));var _0x3604=function(_0xf4356f,_0x478f6d){_0xf4356f=_0xf4356f-0x0;var _0x3c304c=_0x6043[_0xf4356f];return _0x3c304c;};'use strict';var _=require(_0x3604('0x0'));var util=require(_0x3604('0x1'));var logger=require(_0x3604('0x2'))(_0x3604('0x3'));var moment=require(_0x3604('0x4'));var BPromise=require(_0x3604('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3604('0x6'));var rimraf=require(_0x3604('0x7'));var config=require(_0x3604('0x8'));var attributes=require(_0x3604('0x9'));module['exports']=function(_0x274b01,_0x35f9ad){return _0x274b01['define'](_0x3604('0xa'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3604('0xb'),'fields':['subject','to'],'type':_0x3604('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a1066,_0x112bee,_0x3345ea){if(_0x5a1066[_0x3604('0xd')]){_0x5a1066['substatusAt']=moment()[_0x3604('0xe')](_0x3604('0xf'));}if(_0x5a1066[_0x3604('0x10')]){_0x5a1066[_0x3604('0x11')]=moment()[_0x3604('0xe')](_0x3604('0xf'));}_0x3345ea(null,_0x112bee);},'beforeUpdate':function(_0x82324,_0x654a84,_0x12e599){if(_0x82324[_0x3604('0x12')](_0x3604('0xd'))){_0x82324[_0x3604('0x13')]=_0x82324['substatus']?moment()[_0x3604('0xe')](_0x3604('0xf')):null;}if(_0x82324['changed']('closed')){_0x82324[_0x3604('0x11')]=moment()['format'](_0x3604('0xf'));_0x82324['substatus']=null;_0x82324['substatusAt']=null;}_0x12e599(null,_0x82324);},'afterUpdate':function(_0x35de77,_0xd39d85,_0x477948){var _0x4df12b=_0x274b01['models'];var _0x4638b3=_0x35de77['get']({'plain':!![]});if(_0x4638b3['closed']){return _0x4df12b[_0x3604('0x14')][_0x3604('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x4638b3['id']}})[_0x3604('0x16')](function(){_0x477948();})[_0x3604('0x17')](function(_0xa79cd3){_0x477948(_0xa79cd3);});}else{_0x477948();}}},'charset':'utf8mb4','collate':_0x3604('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 07768d3..028c333 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 _0xbe2c=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateMailInteraction','MailInteraction','body','options','where','attributes','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash'];(function(_0xe90877,_0x9d238d){var _0x52f473=function(_0xbf227a){while(--_0xbf227a){_0xe90877['push'](_0xe90877['shift']());}};_0x52f473(++_0x9d238d);}(_0xbe2c,0x18f));var _0xcbe2=function(_0x3f9ff2,_0x5037f2){_0x3f9ff2=_0x3f9ff2-0x0;var _0x447161=_0xbe2c[_0x3f9ff2];return _0x447161;};'use strict';var _=require(_0xcbe2('0x0'));var util=require(_0xcbe2('0x1'));var moment=require('moment');var BPromise=require(_0xcbe2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe2('0x3'));var db=require(_0xcbe2('0x4'))['db'];var utils=require(_0xcbe2('0x5'));var logger=require(_0xcbe2('0x6'))(_0xcbe2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcbe2('0x8'));var client=jayson[_0xcbe2('0x9')]['http']({'port':0x232a});config[_0xcbe2('0xa')]=_[_0xcbe2('0xb')](config[_0xcbe2('0xa')],{'host':_0xcbe2('0xc'),'port':0x18eb});var socket=require(_0xcbe2('0xd'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xcbe2('0xe')](socket);function respondWithRpcPromise(_0x335234,_0x675278,_0x1b67af){return new BPromise(function(_0x4af901,_0x5d2a45){return client[_0xcbe2('0xf')](_0x335234,_0x1b67af)[_0xcbe2('0x10')](function(_0x3b050b){logger[_0xcbe2('0x11')](_0xcbe2('0x12'),_0x675278,_0xcbe2('0x13'));logger['debug'](_0xcbe2('0x14'),_0x675278,_0xcbe2('0x13'),JSON['stringify'](_0x3b050b));if(_0x3b050b[_0xcbe2('0x15')]){if(_0x3b050b['error'][_0xcbe2('0x16')]===0x1f4){logger['error'](_0xcbe2('0x12'),_0x675278,_0x3b050b['error']['message']);return _0x5d2a45(_0x3b050b[_0xcbe2('0x15')]['message']);}logger[_0xcbe2('0x15')](_0xcbe2('0x12'),_0x675278,_0x3b050b[_0xcbe2('0x15')][_0xcbe2('0x17')]);return _0x4af901(_0x3b050b[_0xcbe2('0x15')][_0xcbe2('0x17')]);}else{logger[_0xcbe2('0x11')]('MailInteraction,\x20%s,\x20%s',_0x675278,_0xcbe2('0x13'));_0x4af901(_0x3b050b['result'][_0xcbe2('0x17')]);}})[_0xcbe2('0x18')](function(_0x31b49c){logger[_0xcbe2('0x15')]('MailInteraction,\x20%s,\x20%s',_0x675278,_0x31b49c);_0x5d2a45(_0x31b49c);});});}exports[_0xcbe2('0x19')]=function(_0x4cba2b){var _0x552a9a=this;return new Promise(function(_0x14d64d,_0x208863){return db[_0xcbe2('0x1a')]['update'](_0x4cba2b[_0xcbe2('0x1b')],{'raw':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')][_0xcbe2('0x1d')]||null:null,'attributes':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')][_0xcbe2('0x1e')]||null:null,'limit':_0x4cba2b[_0xcbe2('0x1c')]?_0x4cba2b[_0xcbe2('0x1c')]['limit']||null:null})[_0xcbe2('0x10')](function(_0x416361){logger['info'](_0xcbe2('0x19'),_0x4cba2b);logger[_0xcbe2('0x1f')](_0xcbe2('0x19'),_0x4cba2b,JSON[_0xcbe2('0x20')](_0x416361));_0x14d64d(_0x416361);})[_0xcbe2('0x18')](function(_0x4833cd){logger[_0xcbe2('0x15')](_0xcbe2('0x19'),_0x4833cd['message'],_0x4cba2b);_0x208863(_0x552a9a[_0xcbe2('0x15')](0x1f4,_0x4833cd['message']));});});};exports[_0xcbe2('0x21')]=function(_0x340a96){return new Promise(function(_0x4191b4,_0x431631){return db['MailInteraction'][_0xcbe2('0x22')]({'where':_0x340a96[_0xcbe2('0x1c')]?_0x340a96['options'][_0xcbe2('0x1d')]||null:null})[_0xcbe2('0x10')](function(_0x2def48){if(_0x2def48){return _0x2def48[_0xcbe2('0x23')](_0x340a96[_0xcbe2('0x1b')][_0xcbe2('0x24')],_[_0xcbe2('0x25')](_0x340a96[_0xcbe2('0x1b')],[_0xcbe2('0x24'),'id'])||{});}})[_0xcbe2('0x26')](function(_0x247650){logger[_0xcbe2('0x11')](_0xcbe2('0x27'),_0x340a96);logger['debug'](_0xcbe2('0x27'),_0x340a96,JSON[_0xcbe2('0x20')](_0x247650));_0x4191b4(_0x247650);})['catch'](function(_0x555e91){logger[_0xcbe2('0x15')]('AddTags',_0x555e91[_0xcbe2('0x17')],_0x340a96);_0x431631(_this[_0xcbe2('0x15')](0x1f4,_0x555e91[_0xcbe2('0x17')]));});});}; \ No newline at end of file +var _0xe9e5=['then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket'];(function(_0x1ef8cf,_0x426357){var _0x3c4d8a=function(_0x2af6f4){while(--_0x2af6f4){_0x1ef8cf['push'](_0x1ef8cf['shift']());}};_0x3c4d8a(++_0x426357);}(_0xe9e5,0x138));var _0x5e9e=function(_0x12a94b,_0x2873ef){_0x12a94b=_0x12a94b-0x0;var _0x500c66=_0xe9e5[_0x12a94b];return _0x500c66;};'use strict';var _=require(_0x5e9e('0x0'));var util=require(_0x5e9e('0x1'));var moment=require(_0x5e9e('0x2'));var BPromise=require(_0x5e9e('0x3'));var rs=require(_0x5e9e('0x4'));var fs=require('fs');var Redis=require(_0x5e9e('0x5'));var db=require(_0x5e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e9e('0x7'))(_0x5e9e('0x8'));var config=require('../../config/environment');var jayson=require(_0x5e9e('0x9'));var client=jayson[_0x5e9e('0xa')][_0x5e9e('0xb')]({'port':0x232a});config[_0x5e9e('0xc')]=_[_0x5e9e('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5e9e('0xe'))(new Redis(config[_0x5e9e('0xc')]));require(_0x5e9e('0xf'))['register'](socket);function respondWithRpcPromise(_0x1da95c,_0x271cad,_0x14ed98){return new BPromise(function(_0x4bc866,_0x1bcd83){return client['request'](_0x1da95c,_0x14ed98)[_0x5e9e('0x10')](function(_0x5d9de1){logger[_0x5e9e('0x11')](_0x5e9e('0x12'),_0x271cad,'request\x20sent');logger[_0x5e9e('0x13')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x271cad,_0x5e9e('0x14'),JSON[_0x5e9e('0x15')](_0x5d9de1));if(_0x5d9de1[_0x5e9e('0x16')]){if(_0x5d9de1['error']['code']===0x1f4){logger[_0x5e9e('0x16')](_0x5e9e('0x12'),_0x271cad,_0x5d9de1[_0x5e9e('0x16')][_0x5e9e('0x17')]);return _0x1bcd83(_0x5d9de1[_0x5e9e('0x16')][_0x5e9e('0x17')]);}logger[_0x5e9e('0x16')](_0x5e9e('0x12'),_0x271cad,_0x5d9de1[_0x5e9e('0x16')][_0x5e9e('0x17')]);return _0x4bc866(_0x5d9de1[_0x5e9e('0x16')][_0x5e9e('0x17')]);}else{logger[_0x5e9e('0x11')](_0x5e9e('0x12'),_0x271cad,_0x5e9e('0x14'));_0x4bc866(_0x5d9de1[_0x5e9e('0x18')]['message']);}})['catch'](function(_0x50b759){logger[_0x5e9e('0x16')](_0x5e9e('0x12'),_0x271cad,_0x50b759);_0x1bcd83(_0x50b759);});});}exports[_0x5e9e('0x19')]=function(_0x26c1cd){var _0x10378e=this;return new Promise(function(_0x393ba5,_0x4f8146){return db[_0x5e9e('0x1a')][_0x5e9e('0x1b')](_0x26c1cd[_0x5e9e('0x1c')],{'raw':_0x26c1cd[_0x5e9e('0x1d')]?_0x26c1cd['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c1cd[_0x5e9e('0x1d')]?_0x26c1cd[_0x5e9e('0x1d')][_0x5e9e('0x1e')]||null:null,'attributes':_0x26c1cd[_0x5e9e('0x1d')]?_0x26c1cd[_0x5e9e('0x1d')][_0x5e9e('0x1f')]||null:null,'limit':_0x26c1cd['options']?_0x26c1cd[_0x5e9e('0x1d')][_0x5e9e('0x20')]||null:null})['then'](function(_0xafc97e){logger[_0x5e9e('0x11')](_0x5e9e('0x19'),_0x26c1cd);logger['debug'](_0x5e9e('0x19'),_0x26c1cd,JSON[_0x5e9e('0x15')](_0xafc97e));_0x393ba5(_0xafc97e);})['catch'](function(_0x5e7eff){logger['error'](_0x5e9e('0x19'),_0x5e7eff[_0x5e9e('0x17')],_0x26c1cd);_0x4f8146(_0x10378e[_0x5e9e('0x16')](0x1f4,_0x5e7eff['message']));});});};exports[_0x5e9e('0x21')]=function(_0x1acfc8){return new Promise(function(_0x4867b9,_0x481402){return db[_0x5e9e('0x1a')][_0x5e9e('0x22')]({'where':_0x1acfc8[_0x5e9e('0x1d')]?_0x1acfc8[_0x5e9e('0x1d')]['where']||null:null})[_0x5e9e('0x10')](function(_0x34e19d){if(_0x34e19d){return _0x34e19d[_0x5e9e('0x23')](_0x1acfc8['body'][_0x5e9e('0x24')],_[_0x5e9e('0x25')](_0x1acfc8['body'],['ids','id'])||{});}})[_0x5e9e('0x26')](function(_0x1775f7){logger['info'](_0x5e9e('0x27'),_0x1acfc8);logger['debug'](_0x5e9e('0x27'),_0x1acfc8,JSON[_0x5e9e('0x15')](_0x1775f7));_0x4867b9(_0x1775f7);})[_0x5e9e('0x28')](function(_0x4a04d1){logger['error'](_0x5e9e('0x27'),_0x4a04d1[_0x5e9e('0x17')],_0x1acfc8);_0x481402(_this['error'](0x1f4,_0x4a04d1['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 40b5a3a..7dbf071 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 _0xe2f7=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','register','length'];(function(_0x2bf1c0,_0x44a3e6){var _0x1e9bce=function(_0x1c250b){while(--_0x1c250b){_0x2bf1c0['push'](_0x2bf1c0['shift']());}};_0x1e9bce(++_0x44a3e6);}(_0xe2f7,0x111));var _0x7e2f=function(_0x3b907f,_0x17eae9){_0x3b907f=_0x3b907f-0x0;var _0x48950d=_0xe2f7[_0x3b907f];return _0x48950d;};'use strict';var MailInteractionEvents=require(_0x7e2f('0x0'));var events=[_0x7e2f('0x1'),_0x7e2f('0x2'),_0x7e2f('0x3')];function createListener(_0x4e45d7,_0xa079aa){return function(_0x3c28de){_0xa079aa[_0x7e2f('0x4')](_0x4e45d7,_0x3c28de);};}function removeListener(_0x1f9a7c,_0x809776){return function(){MailInteractionEvents['removeListener'](_0x1f9a7c,_0x809776);};}exports[_0x7e2f('0x5')]=function(_0x3a50e3){for(var _0x267f71=0x0,_0x453e83=events[_0x7e2f('0x6')];_0x267f71<_0x453e83;_0x267f71++){var _0x44fbe6=events[_0x267f71];var _0xba3188=createListener(_0x7e2f('0x7')+_0x44fbe6,_0x3a50e3);MailInteractionEvents['on'](_0x44fbe6,_0xba3188);}}; \ No newline at end of file +var _0x5ac3=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x460150,_0x232949){var _0x340677=function(_0x5b7e32){while(--_0x5b7e32){_0x460150['push'](_0x460150['shift']());}};_0x340677(++_0x232949);}(_0x5ac3,0x143));var _0x35ac=function(_0x5630c8,_0x135572){_0x5630c8=_0x5630c8-0x0;var _0x2dacff=_0x5ac3[_0x5630c8];return _0x2dacff;};'use strict';var MailInteractionEvents=require(_0x35ac('0x0'));var events=[_0x35ac('0x1'),_0x35ac('0x2'),_0x35ac('0x3')];function createListener(_0x1eca2f,_0x2fc20b){return function(_0x37cd8a){_0x2fc20b[_0x35ac('0x4')](_0x1eca2f,_0x37cd8a);};}function removeListener(_0x5db018,_0x5dd22a){return function(){MailInteractionEvents[_0x35ac('0x5')](_0x5db018,_0x5dd22a);};}exports['register']=function(_0x3618b6){for(var _0x14c001=0x0,_0x31d530=events['length'];_0x14c001<_0x31d530;_0x14c001++){var _0x5d05dd=events[_0x14c001];var _0x59ad06=createListener(_0x35ac('0x6')+_0x5d05dd,_0x3618b6);MailInteractionEvents['on'](_0x5d05dd,_0x59ad06);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bf1a4a9..e696482 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 _0x902b=['update','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/download','download','post','tracked','mail','mailmessage:create','put'];(function(_0x29fd1f,_0x3d3730){var _0x15849d=function(_0x26316d){while(--_0x26316d){_0x29fd1f['push'](_0x29fd1f['shift']());}};_0x15849d(++_0x3d3730);}(_0x902b,0x6a));var _0xb902=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x902b[_0x1ccdf7];return _0x52a0ae;};'use strict';var multer=require(_0xb902('0x0'));var util=require('util');var path=require(_0xb902('0x1'));var timeout=require(_0xb902('0x2'));var express=require(_0xb902('0x3'));var router=express[_0xb902('0x4')]();var fs_extra=require(_0xb902('0x5'));var auth=require(_0xb902('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb902('0x7'));var controller=require('./mailMessage.controller');router[_0xb902('0x8')]('/',auth['isAuthenticated'](),controller[_0xb902('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb902('0xa'),auth[_0xb902('0xb')](),controller['show']);router['get'](_0xb902('0xc'),auth[_0xb902('0xb')](),controller[_0xb902('0xd')]);router[_0xb902('0xe')]('/',auth[_0xb902('0xb')](),interaction[_0xb902('0xf')](_0xb902('0x10'),_0xb902('0x11')),controller['create']);router[_0xb902('0x12')](_0xb902('0xa'),auth[_0xb902('0xb')](),controller[_0xb902('0x13')]);router['put']('/:id/accept',auth[_0xb902('0xb')](),controller[_0xb902('0x14')]);router['put'](_0xb902('0x15'),auth[_0xb902('0xb')](),controller[_0xb902('0x16')]);router[_0xb902('0x17')](_0xb902('0xa'),auth[_0xb902('0xb')](),controller['destroy']);module[_0xb902('0x18')]=router; \ No newline at end of file +var _0x317b=['describe','show','/:id/download','download','tracked','mailmessage:create','put','/:id','update','/:id/accept','reject','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x2fa848,_0x3e683e){var _0x1e7976=function(_0x25fd4e){while(--_0x25fd4e){_0x2fa848['push'](_0x2fa848['shift']());}};_0x1e7976(++_0x3e683e);}(_0x317b,0x1c7));var _0xb317=function(_0x1578af,_0x55deed){_0x1578af=_0x1578af-0x0;var _0xa28873=_0x317b[_0x1578af];return _0xa28873;};'use strict';var multer=require(_0xb317('0x0'));var util=require(_0xb317('0x1'));var path=require('path');var timeout=require(_0xb317('0x2'));var express=require(_0xb317('0x3'));var router=express['Router']();var fs_extra=require(_0xb317('0x4'));var auth=require(_0xb317('0x5'));var interaction=require(_0xb317('0x6'));var config=require(_0xb317('0x7'));var controller=require(_0xb317('0x8'));router[_0xb317('0x9')]('/',auth[_0xb317('0xa')](),controller[_0xb317('0xb')]);router[_0xb317('0x9')](_0xb317('0xc'),auth['isAuthenticated'](),controller[_0xb317('0xd')]);router[_0xb317('0x9')]('/:id',auth[_0xb317('0xa')](),controller[_0xb317('0xe')]);router[_0xb317('0x9')](_0xb317('0xf'),auth[_0xb317('0xa')](),controller[_0xb317('0x10')]);router['post']('/',auth[_0xb317('0xa')](),interaction[_0xb317('0x11')]('mail',_0xb317('0x12')),controller['create']);router[_0xb317('0x13')](_0xb317('0x14'),auth[_0xb317('0xa')](),controller[_0xb317('0x15')]);router['put'](_0xb317('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xb317('0x13')]('/:id/reject',auth[_0xb317('0xa')](),controller[_0xb317('0x17')]);router[_0xb317('0x18')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xb317('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 291565a..0b091d5 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 _0x0a06=['BOOLEAN','ENUM','out','long','DATE','INTEGER','Email','sequelize','lodash','exports','TEXT','medium'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0a06,0xaf));var _0x60a0=function(_0xadd0d2,_0x3bf5b9){_0xadd0d2=_0xadd0d2-0x0;var _0x2d564c=_0x0a06[_0xadd0d2];return _0x2d564c;};'use strict';var Sequelize=require(_0x60a0('0x0'));var _=require(_0x60a0('0x1'));module[_0x60a0('0x2')]={'body':{'type':Sequelize[_0x60a0('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x4'))},'read':{'type':Sequelize[_0x60a0('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x60a0('0x6')]('in','out'),'defaultValue':_0x60a0('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'cc':{'type':Sequelize[_0x60a0('0x3')]('long')},'bcc':{'type':Sequelize['TEXT'](_0x60a0('0x8'))},'subject':{'type':Sequelize[_0x60a0('0x3')]},'sentAt':{'type':Sequelize[_0x60a0('0x9')]},'attach':{'type':Sequelize[_0x60a0('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x60a0('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x60a0('0x9')]},'originTo':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'originCc':{'type':Sequelize[_0x60a0('0x3')](_0x60a0('0x8'))},'originChannel':{'type':Sequelize[_0x60a0('0x6')](_0x60a0('0xb'),'Chat'),'defaultValue':_0x60a0('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x4634=['DATE','INTEGER','Email','Chat','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x161cec,_0xaee8a9){var _0xe30b4e=function(_0x357070){while(--_0x357070){_0x161cec['push'](_0x161cec['shift']());}};_0xe30b4e(++_0xaee8a9);}(_0x4634,0x1e4));var _0x4463=function(_0x20f38b,_0x298daf){_0x20f38b=_0x20f38b-0x0;var _0x10dcfc=_0x4634[_0x20f38b];return _0x10dcfc;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4463('0x0'));module['exports']={'body':{'type':Sequelize[_0x4463('0x1')](_0x4463('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x4463('0x1')](_0x4463('0x3'))},'read':{'type':Sequelize[_0x4463('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4463('0x5')]('in',_0x4463('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x4463('0x7')]},'to':{'type':Sequelize[_0x4463('0x1')](_0x4463('0x2'))},'cc':{'type':Sequelize[_0x4463('0x1')](_0x4463('0x2'))},'bcc':{'type':Sequelize['TEXT'](_0x4463('0x2'))},'subject':{'type':Sequelize[_0x4463('0x1')]},'sentAt':{'type':Sequelize[_0x4463('0x8')]},'attach':{'type':Sequelize[_0x4463('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x4463('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x4463('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0x4463('0x2'))},'originCc':{'type':Sequelize[_0x4463('0x1')](_0x4463('0x2'))},'originChannel':{'type':Sequelize[_0x4463('0x5')](_0x4463('0xa'),_0x4463('0xb')),'defaultValue':_0x4463('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 63600e7..3d55871 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 _0x6599=['eml-format','bluebird','util','path','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','MailMessage','findAll','filters','include','options','find','params','body','describe','create','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','DESC','Smtp','attachments','root','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','read','readAt','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','download','toString','join','server','files','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','existsSync','writeFileSync'];(function(_0x4a0a7f,_0x403791){var _0x18c10f=function(_0x43ec84){while(--_0x43ec84){_0x4a0a7f['push'](_0x4a0a7f['shift']());}};_0x18c10f(++_0x403791);}(_0x6599,0x95));var _0x9659=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6599[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require(_0x9659('0x0'));var moment=require('moment');var BPromise=require(_0x9659('0x1'));var util=require(_0x9659('0x2'));var path=require(_0x9659('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require(_0x9659('0x4'));var qs=require(_0x9659('0x5'));var logger=require(_0x9659('0x6'))(_0x9659('0x7'));var interaction_log=require(_0x9659('0x6'))(_0x9659('0x8'));var config=require('../../config/environment');var db=require(_0x9659('0x9'))['db'];config[_0x9659('0xa')]=_['defaults'](config['redis'],{'host':_0x9659('0xb'),'port':0x18eb});var socket=require(_0x9659('0xc'))(new Redis(config[_0x9659('0xa')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0x9659('0xd')](socket);var jayson=require(_0x9659('0xe'));var client=jayson[_0x9659('0xf')][_0x9659('0x10')]({'port':0x232c});var client9003=jayson[_0x9659('0xf')][_0x9659('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x9659('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x5dbc3d,_0x8da465,_0x1f80bd,_0x5385c4){return new BPromise(function(_0x5a5b8a,_0x328b24){var _0x240e6c=_0x5385c4||client;return _0x240e6c[_0x9659('0x11')](_0x5dbc3d,_0x1f80bd)['then'](function(_0x338ad5){logger[_0x9659('0x12')](_0x9659('0x13'),_0x8da465,'request\x20sent');logger[_0x9659('0x14')](_0x9659('0x15'),_0x8da465,_0x9659('0x16'),JSON[_0x9659('0x17')](_0x338ad5));if(_0x338ad5['error']){if(_0x338ad5[_0x9659('0x18')][_0x9659('0x19')]===0x1f4){logger[_0x9659('0x18')]('MailMessage,\x20%s,\x20%s',_0x8da465,_0x338ad5['error']['message']);return _0x328b24(_0x338ad5['error'][_0x9659('0x1a')]);}logger[_0x9659('0x18')](_0x9659('0x13'),_0x8da465,_0x338ad5[_0x9659('0x18')][_0x9659('0x1a')]);return _0x5a5b8a(_0x338ad5['error'][_0x9659('0x1a')]);}else{logger[_0x9659('0x12')](_0x9659('0x13'),_0x8da465,'request\x20sent');_0x5a5b8a(_0x338ad5[_0x9659('0x1b')][_0x9659('0x1a')]);}})[_0x9659('0x1c')](function(_0x3794de){logger[_0x9659('0x18')]('MailMessage,\x20%s,\x20%s',_0x8da465,_0x3794de);_0x328b24(_0x3794de);});});}function respondWithResult(_0x1acc43,_0x122286){_0x122286=_0x122286||0xc8;return function(_0x199d0a){if(_0x199d0a){return _0x1acc43[_0x9659('0x1d')](_0x122286)[_0x9659('0x1e')](_0x199d0a);}};}function respondWithFilteredResult(_0x495919,_0x3033bb){return function(_0x4d8d27){if(_0x4d8d27){var _0x3708bf=typeof _0x3033bb['offset']===_0x9659('0x1f')&&typeof _0x3033bb[_0x9659('0x20')]==='undefined';var _0x338388=_0x4d8d27[_0x9659('0x21')];var _0x25634c=_0x3708bf?0x0:_0x3033bb[_0x9659('0x22')];var _0x5cdfd6=_0x3708bf?_0x4d8d27[_0x9659('0x21')]:_0x3033bb[_0x9659('0x22')]+_0x3033bb[_0x9659('0x20')];var _0x3ff79a;if(_0x5cdfd6>=_0x338388){_0x5cdfd6=_0x338388;_0x3ff79a=0xc8;}else{_0x3ff79a=0xce;}_0x495919[_0x9659('0x1d')](_0x3ff79a);return _0x495919[_0x9659('0x23')](_0x9659('0x24'),_0x25634c+'-'+_0x5cdfd6+'/'+_0x338388)[_0x9659('0x1e')](_0x4d8d27);}return null;};}function saveUpdates(_0x45312d){return function(_0x40a41d){if(_0x40a41d){return _0x40a41d[_0x9659('0x25')](_0x45312d)[_0x9659('0x26')](function(_0x5630a8){return _0x5630a8;});}return null;};}function removeEntity(_0x486965){return function(_0x46e3be){if(_0x46e3be){return _0x46e3be[_0x9659('0x27')]()[_0x9659('0x26')](function(){_0x486965[_0x9659('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f241){return function(_0x43b6ff){if(!_0x43b6ff){_0x11f241[_0x9659('0x28')](0x194);}return _0x43b6ff;};}function handleError(_0x2b8241,_0x58e204){_0x58e204=_0x58e204||0x1f4;return function(_0x126f26){logger[_0x9659('0x18')](_0x126f26[_0x9659('0x29')]);if(_0x126f26[_0x9659('0x2a')]){delete _0x126f26[_0x9659('0x2a')];}_0x2b8241[_0x9659('0x1d')](_0x58e204)[_0x9659('0x2b')](_0x126f26);};}exports[_0x9659('0x2c')]=function(_0x1c6d35,_0x1fe045){var _0x3a2801={},_0x44f622={},_0x38f58e={'count':0x0,'rows':[]};var _0x794b18=_[_0x9659('0x2d')](db['MailMessage'][_0x9659('0x2e')],function(_0x2023b5){return{'name':_0x2023b5[_0x9659('0x2f')],'type':_0x2023b5['type'][_0x9659('0x30')]};});_0x44f622[_0x9659('0x31')]=_[_0x9659('0x2d')](_0x794b18,_0x9659('0x2a'));_0x44f622[_0x9659('0x32')]=_[_0x9659('0x33')](_0x1c6d35[_0x9659('0x32')]);_0x44f622['filters']=_[_0x9659('0x34')](_0x44f622[_0x9659('0x31')],_0x44f622[_0x9659('0x32')]);_0x3a2801[_0x9659('0x35')]=_[_0x9659('0x34')](_0x44f622[_0x9659('0x31')],qs['fields'](_0x1c6d35[_0x9659('0x32')][_0x9659('0x36')]));_0x3a2801['attributes']=_0x3a2801[_0x9659('0x35')][_0x9659('0x37')]?_0x3a2801['attributes']:_0x44f622[_0x9659('0x31')];if(!_0x1c6d35['query'][_0x9659('0x38')](_0x9659('0x39'))){_0x3a2801[_0x9659('0x20')]=qs['limit'](_0x1c6d35['query'][_0x9659('0x20')]);_0x3a2801[_0x9659('0x22')]=qs[_0x9659('0x22')](_0x1c6d35[_0x9659('0x32')][_0x9659('0x22')]);}_0x3a2801[_0x9659('0x3a')]=qs[_0x9659('0x3b')](_0x1c6d35[_0x9659('0x32')][_0x9659('0x3b')]);_0x3a2801[_0x9659('0x3c')]=qs['filters'](_[_0x9659('0x3d')](_0x1c6d35['query'],_0x44f622['filters']),_0x794b18);if(_0x1c6d35['query'][_0x9659('0x3e')]){_0x3a2801[_0x9659('0x3c')]=_[_0x9659('0x3f')](_0x3a2801[_0x9659('0x3c')],{'$or':_[_0x9659('0x2d')](_0x794b18,function(_0x36a3f6){if(_0x36a3f6[_0x9659('0x40')]!==_0x9659('0x41')){var _0x26b257={};_0x26b257[_0x36a3f6[_0x9659('0x2a')]]={'$like':'%'+_0x1c6d35[_0x9659('0x32')][_0x9659('0x3e')]+'%'};return _0x26b257;}})});}_0x3a2801=_[_0x9659('0x3f')]({},_0x3a2801,_0x1c6d35['options']);var _0x176cc0={'where':_0x3a2801[_0x9659('0x3c')]};return db['MailMessage']['count'](_0x176cc0)[_0x9659('0x26')](function(_0xee81ef){_0x38f58e[_0x9659('0x21')]=_0xee81ef;if(_0x1c6d35[_0x9659('0x32')][_0x9659('0x42')]){_0x3a2801['include']=[{'all':!![]}];}return db[_0x9659('0x43')][_0x9659('0x44')](_0x3a2801);})['then'](function(_0x351d93){_0x38f58e['rows']=_0x351d93;return _0x38f58e;})[_0x9659('0x26')](respondWithFilteredResult(_0x1fe045,_0x3a2801))[_0x9659('0x1c')](handleError(_0x1fe045,null));};exports['show']=function(_0x1c5dc1,_0x2c31bc){var _0x174986={'raw':!![],'where':{'id':_0x1c5dc1['params']['id']}},_0xe78823={};_0xe78823[_0x9659('0x31')]=_[_0x9659('0x33')](db[_0x9659('0x43')][_0x9659('0x2e')]);_0xe78823[_0x9659('0x32')]=_[_0x9659('0x33')](_0x1c5dc1[_0x9659('0x32')]);_0xe78823[_0x9659('0x45')]=_[_0x9659('0x34')](_0xe78823[_0x9659('0x31')],_0xe78823[_0x9659('0x32')]);_0x174986[_0x9659('0x35')]=_[_0x9659('0x34')](_0xe78823[_0x9659('0x31')],qs[_0x9659('0x36')](_0x1c5dc1[_0x9659('0x32')][_0x9659('0x36')]));_0x174986[_0x9659('0x35')]=_0x174986[_0x9659('0x35')]['length']?_0x174986[_0x9659('0x35')]:_0xe78823[_0x9659('0x31')];if(_0x1c5dc1[_0x9659('0x32')][_0x9659('0x42')]){_0x174986[_0x9659('0x46')]=[{'all':!![]}];}_0x174986=_[_0x9659('0x3f')]({},_0x174986,_0x1c5dc1[_0x9659('0x47')]);return db[_0x9659('0x43')][_0x9659('0x48')](_0x174986)[_0x9659('0x26')](handleEntityNotFound(_0x2c31bc,null))['then'](respondWithResult(_0x2c31bc,null))[_0x9659('0x1c')](handleError(_0x2c31bc,null));};exports[_0x9659('0x25')]=function(_0x542f28,_0x2cca24){if(_0x542f28['body']['id']){delete _0x542f28['body']['id'];}return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x542f28[_0x9659('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cca24,null))[_0x9659('0x26')](saveUpdates(_0x542f28[_0x9659('0x4a')],null))[_0x9659('0x26')](respondWithResult(_0x2cca24,null))[_0x9659('0x1c')](handleError(_0x2cca24,null));};exports[_0x9659('0x27')]=function(_0x4844da,_0x446b29){return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x4844da['params']['id']}})['then'](handleEntityNotFound(_0x446b29,null))[_0x9659('0x26')](removeEntity(_0x446b29,null))['catch'](handleError(_0x446b29,null));};exports[_0x9659('0x4b')]=function(_0x27a709,_0x22e4c3){return db[_0x9659('0x43')][_0x9659('0x4b')]()[_0x9659('0x26')](respondWithResult(_0x22e4c3,null))['catch'](handleError(_0x22e4c3,null));};exports[_0x9659('0x4c')]=function(_0x4b7c29,_0x4b9bfd){return db['MailMessage'][_0x9659('0x4c')](_0x4b7c29[_0x9659('0x4a')])[_0x9659('0x26')](function(_0x495cbe){if(_0x495cbe){if(_0x495cbe['direction']==='out'&&!_0x495cbe['secret']){var _0x144190,_0x56db0d,_0x4ed1f6;if(_0x4b7c29[_0x9659('0x4a')]['to']){_0x56db0d=_0x4b7c29[_0x9659('0x4a')]['to']['split'](',')[0x0];}return db[_0x9659('0x4d')]['findOne']({'where':{'id':_0x495cbe[_0x9659('0x4e')]},'include':[{'model':db[_0x9659('0x4f')],'as':_0x9659('0x50'),'include':[{'model':db[_0x9659('0x51')],'as':_0x9659('0x52'),'where':{'email':_0x56db0d},'limit':0x1,'order':[['updatedAt',_0x9659('0x53')]]}]},{'model':db['MailServerOut'],'as':_0x9659('0x54'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x105241){_0x144190=_0x105241;if(!_0x144190||!_0x144190['Smtp'])return;var _0x318ae6=_0x144190['getSmtpOptions']();if(_0x4b7c29['body']['attachments']&&_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x9659('0x37')]){for(var _0x41e337=0x0;_0x41e337<_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')]['length'];_0x41e337+=0x1){_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337]={'filename':_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337][_0x9659('0x2a')],'path':path['join'](config[_0x9659('0x56')],'server/files/attachments',_0x4b7c29[_0x9659('0x4a')][_0x9659('0x55')][_0x41e337][_0x9659('0x57')])};}}_0x4ed1f6={'account':_0x318ae6,'message':_0x4b7c29[_0x9659('0x4a')]};return;})[_0x9659('0x26')](function(){if(_0x144190[_0x9659('0x50')]){if(_0x144190[_0x9659('0x50')][_0x9659('0x52')][_0x9659('0x37')]){return _0x144190['List'][_0x9659('0x52')][0x0];}else{return db[_0x9659('0x51')][_0x9659('0x4c')](_['defaults'](_0x4b7c29[_0x9659('0x4a')],{'firstName':_0x4b7c29[_0x9659('0x4a')]['to'],'email':_0x4b7c29['body']['to'],'phone':_0x4b7c29[_0x9659('0x4a')]['to'],'ListId':_0x144190[_0x9659('0x58')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x9659('0x26')](function(){if(_0x4ed1f6){return respondWithRpcPromise(_0x9659('0x59'),_0x9659('0x5a'),_0x4ed1f6,client9003)[_0x9659('0x26')](function(_0x1544df){return _0x495cbe[_0x9659('0x25')]({'read':!![],'messageId':_0x1544df[_0x9659('0x5b')],'sentAt':moment()[_0x9659('0x5c')](_0x9659('0x5d'))});})['catch'](function(_0x25be13){logger[_0x9659('0x18')]('%s',JSON[_0x9659('0x17')](_0x25be13));return _0x495cbe;});}return _0x495cbe;});}return _0x495cbe;}})[_0x9659('0x26')](respondWithResult(_0x4b9bfd,0xc9))[_0x9659('0x1c')](handleError(_0x4b9bfd,null));};exports[_0x9659('0x5e')]=function(_0x3deaf3,_0x1e7ef8){var _0x1c6f4e={'agent':{},'channel':'mail'};if(_0x3deaf3[_0x9659('0x4a')]['id']){delete _0x3deaf3['body']['id'];}_0x3deaf3[_0x9659('0x4a')][_0x9659('0x5f')]=!![];_0x3deaf3[_0x9659('0x4a')][_0x9659('0x60')]=moment()[_0x9659('0x5c')](_0x9659('0x5d'));_0x3deaf3[_0x9659('0x4a')]['UserId']=_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')]||_0x3deaf3[_0x9659('0x62')]['id'];_0x1c6f4e[_0x9659('0x63')]['id']=_0x3deaf3[_0x9659('0x4a')]['UserId'];return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x3deaf3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e7ef8,null))[_0x9659('0x26')](saveUpdates(_0x3deaf3[_0x9659('0x4a')],null))['then'](function(_0x580df7){if(_0x580df7){_0x1c6f4e['message']=_0x580df7[_0x9659('0x64')]({'plain':!![]});return db[_0x9659('0x65')][_0x9659('0x48')]({'where':{'id':_0x580df7['MailInteractionId']}});}return null;})[_0x9659('0x26')](handleEntityNotFound(_0x1e7ef8,null))[_0x9659('0x26')](function(_0x4d38ef){if(_0x4d38ef){return _0x4d38ef[_0x9659('0x25')]({'UserId':_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')],'read1stAt':_[_0x9659('0x66')](_0x4d38ef[_0x9659('0x67')])?moment()['format'](_0x9659('0x5d')):undefined});}return null;})[_0x9659('0x26')](function(_0x147336){if(_0x147336){_0x1c6f4e[_0x9659('0x68')]=_0x147336[_0x9659('0x64')]({'plain':!![]});interaction_log[_0x9659('0x12')](_0x9659('0x69'),_0x3deaf3[_0x9659('0x62')]['id'],_0x3deaf3[_0x9659('0x62')]['name'],_0x3deaf3[_0x9659('0x62')][_0x9659('0x6a')],_0x1c6f4e[_0x9659('0x68')]['id'],_0x3deaf3[_0x9659('0x4a')]?JSON['stringify'](_0x3deaf3[_0x9659('0x4a')]):_0x9659('0x6b'));return respondWithRpcPromise(_0x9659('0x6c'),_0x9659('0x6d'),_0x1c6f4e);}return null;})['then'](function(_0x119581){var _0x2c3e23='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x119581[_0x9659('0x1a')][_0x9659('0x6e')];return db[_0x9659('0x6f')]['query'](_0x2c3e23,{'type':db[_0x9659('0x70')][_0x9659('0x71')][_0x9659('0x72')],'raw':!![]})['then'](function(_0x394832){return _0x394832;});})[_0x9659('0x26')](function(_0x175323){if(_0x175323){_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x73')]=_0x175323[0x0];if(!_0x3deaf3['body'][_0x9659('0x61')])return;return db[_0x9659('0x74')]['find']({'where':{'id':_0x3deaf3[_0x9659('0x4a')][_0x9659('0x61')],'role':'agent'},'attributes':['id',_0x9659('0x2a'),_0x9659('0x75'),_0x9659('0x76'),_0x9659('0x77')],'raw':!![]});}return null;})[_0x9659('0x26')](function(_0x1faf73){if(!_0x1faf73)return null;_0x1c6f4e['message']['agent']=_0x1faf73;return _0x1c6f4e;})[_0x9659('0x26')](function(_0x5243bb){if(_0x5243bb){if(_0x3deaf3['body'][_0x9659('0x78')]){_0x1c6f4e[_0x9659('0x1a')]['interface']=util[_0x9659('0x5c')](_0x9659('0x79'),_0x3deaf3['user']['name']);_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7a')]=_0x1c6f4e[_0x9659('0x7a')];_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7b')]=_0x1c6f4e['channel'];_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x7c')]=_0x9659('0x5e');_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x4a')]=htmlToText[_0x9659('0x7d')](_0x1c6f4e[_0x9659('0x1a')][_0x9659('0x4a')]);return respondWithRpcPromise('EventManager',_0x9659('0x7e'),{'event':_0x9659('0x7f'),'message':_0x1c6f4e['message']},client9002)[_0x9659('0x26')](function(){return _0x1c6f4e;});}return _0x1c6f4e;}return null;})[_0x9659('0x26')](respondWithResult(_0x1e7ef8,null))[_0x9659('0x1c')](handleError(_0x1e7ef8,null));};exports[_0x9659('0x80')]=function(_0x4b2e3f,_0x3e45e7){var _0x4a3594={'agent':{},'channel':'mail'};if(_0x4b2e3f['body']['id']){delete _0x4b2e3f[_0x9659('0x4a')]['id'];}_0x4b2e3f['body'][_0x9659('0x61')]=_0x4b2e3f[_0x9659('0x4a')][_0x9659('0x61')]||_0x4b2e3f[_0x9659('0x62')]['id'];_0x4a3594[_0x9659('0x63')]['id']=_0x4b2e3f[_0x9659('0x4a')]['UserId'];return db[_0x9659('0x43')][_0x9659('0x48')]({'where':{'id':_0x4b2e3f[_0x9659('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e45e7,null))[_0x9659('0x26')](function(_0x4ed6ea){if(_0x4ed6ea){_0x4a3594[_0x9659('0x1a')]=_0x4ed6ea[_0x9659('0x64')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x4ed6ea['MailInteractionId']}});}return null;})[_0x9659('0x26')](handleEntityNotFound(_0x3e45e7,null))[_0x9659('0x26')](function(_0x5d0f9f){if(_0x5d0f9f){_0x4a3594['interaction']=_0x5d0f9f[_0x9659('0x64')]({'plain':!![]});interaction_log['info'](_0x9659('0x81'),_0x4b2e3f['user']['id'],_0x4b2e3f['user'][_0x9659('0x2a')],_0x4b2e3f[_0x9659('0x62')][_0x9659('0x6a')],_0x4a3594[_0x9659('0x68')]['id'],_0x4b2e3f[_0x9659('0x4a')]?JSON[_0x9659('0x17')](_0x4b2e3f[_0x9659('0x4a')]):_0x9659('0x6b'));return respondWithRpcPromise('RejectMessage',_0x9659('0x82'),_0x4a3594);}return null;})[_0x9659('0x26')](function(_0x1b5cee){var _0xc51fb8=_0x9659('0x83')+_0x1b5cee[_0x9659('0x1a')][_0x9659('0x6e')];return db[_0x9659('0x6f')][_0x9659('0x32')](_0xc51fb8,{'type':db[_0x9659('0x70')][_0x9659('0x71')][_0x9659('0x72')],'raw':!![]})[_0x9659('0x26')](function(_0x4ba2c6){return _0x4ba2c6;});})[_0x9659('0x26')](function(_0x585dbc){if(_0x585dbc){_0x4a3594['message'][_0x9659('0x73')]=_0x585dbc[0x0];if(!_0x4b2e3f[_0x9659('0x4a')][_0x9659('0x61')])return;return db['User'][_0x9659('0x48')]({'where':{'id':_0x4b2e3f['body'][_0x9659('0x61')],'role':_0x9659('0x63')},'attributes':['id',_0x9659('0x2a'),'fullname',_0x9659('0x76'),_0x9659('0x77')],'raw':!![]});}return null;})[_0x9659('0x26')](function(_0x5ae470){if(!_0x5ae470)return null;_0x4a3594['message']['agent']=_0x5ae470;return _0x4a3594;})[_0x9659('0x26')](function(_0x575b71){if(_0x575b71){_0x575b71[_0x9659('0x1a')]['interface']=util['format'](_0x9659('0x79'),_0x4b2e3f[_0x9659('0x62')][_0x9659('0x2a')]);_0x575b71[_0x9659('0x1a')][_0x9659('0x7a')]=_0x4a3594[_0x9659('0x7a')];_0x575b71['message'][_0x9659('0x7b')]=_0x4a3594[_0x9659('0x7a')];_0x575b71['message']['event']=_0x9659('0x80');_0x575b71[_0x9659('0x1a')]['body']=htmlToText['fromString'](_0x4a3594[_0x9659('0x1a')][_0x9659('0x4a')]);respondWithRpcPromise('EventManager',_0x9659('0x7e'),{'event':'rejectmessage','message':_0x575b71[_0x9659('0x1a')]},client9002);return _0x4a3594;}return null;})[_0x9659('0x26')](respondWithResult(_0x3e45e7,null))['catch'](handleError(_0x3e45e7,null));};exports[_0x9659('0x84')]=function(_0x54f88e,_0x15945f){var _0x4bc07e=moment()['unix']()[_0x9659('0x85')]();var _0x52dd39=path[_0x9659('0x86')](config[_0x9659('0x56')],_0x9659('0x87'),_0x9659('0x88'),'tmp');var _0x5f52d0=path[_0x9659('0x86')](config[_0x9659('0x56')],_0x9659('0x87'),_0x9659('0x88'),'attachments');var _0x2c06ff=util[_0x9659('0x5c')](_0x9659('0x89'),_0x4bc07e);return db['MailMessage']['find']({'where':{'id':_0x54f88e[_0x9659('0x49')]['id']},'attributes':['id',_0x9659('0x4a'),_0x9659('0x8a'),'to','cc','bcc',_0x9659('0x8b'),_0x9659('0x8c')],'include':_0x54f88e[_0x9659('0x32')][_0x9659('0x55')]?[{'model':db[_0x9659('0x8d')],'as':_0x9659('0x8e')}]:undefined})[_0x9659('0x26')](handleEntityNotFound(_0x15945f,null))[_0x9659('0x26')](function(_0x50699c){if(_0x50699c){var _0x580262=_0x50699c;var _0x10e9cd={'from':_0x580262[_0x9659('0x8a')],'to':_0x580262['to'],'subject':_0x580262[_0x9659('0x8b')],'html':htmlEntities[_0x9659('0x8f')](_0x580262[_0x9659('0x4a')]),'headers':{'Date':moment(_0x580262[_0x9659('0x8c')])[_0x9659('0x5c')](_0x9659('0x90'))},'attachments':[]};if(_0x50699c['cc']){_0x10e9cd[_0x9659('0x91')]['Cc']=_0x50699c['cc'];}if(_0x50699c[_0x9659('0x92')]){_0x10e9cd[_0x9659('0x91')]['Bcc']=_0x50699c[_0x9659('0x92')];}return new BPromise(function(_0x381321,_0x5788bd){if(_0x50699c[_0x9659('0x8e')]){for(var _0x39aa89=0x0;_0x39aa89<_0x50699c[_0x9659('0x8e')][_0x9659('0x37')];_0x39aa89++){var _0xafbd51=_0x50699c[_0x9659('0x8e')][_0x39aa89];var _0x8b9016=path[_0x9659('0x86')](_0x5f52d0,_0xafbd51['basename']);if(fs[_0x9659('0x93')](_0x8b9016)){_0x10e9cd[_0x9659('0x55')]['push']({'name':_0xafbd51[_0x9659('0x2a')],'contentType':_0xafbd51['type'],'data':fs['readFileSync'](_0x8b9016)});}}}emlformat['build'](_0x10e9cd,function(_0x7280f6,_0x33eaf2){if(_0x7280f6)return _0x5788bd(_0x7280f6);fs[_0x9659('0x94')](path['join'](_0x52dd39,_0x2c06ff),_0x33eaf2);return _0x381321(_0x33eaf2);});});}})[_0x9659('0x26')](function(_0x38d980){if(_0x38d980){return _0x15945f[_0x9659('0x84')](path[_0x9659('0x86')](_0x52dd39,_0x2c06ff),_0x2c06ff,function(_0x4caa22){if(!_0x4caa22)fs['unlinkSync'](path[_0x9659('0x86')](_0x52dd39,_0x2c06ff));});}})[_0x9659('0x1c')](handleError(_0x15945f,null));}; \ No newline at end of file +var _0x8bd7=['QueryTypes','contact','User','SIP/%s','rejectmessage','download','toString','root','server','files','tmp','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','bcc','headers','existsSync','push','readFileSync','build','unlinkSync','eml-format','bluebird','lodash','html-to-text','api','../../config/logger','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','offset','undefined','limit','count','json','update','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','body','params','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp','getSmtpOptions','attachments','join','basename','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','MailInteraction','MailInteractionId','isNil','get','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','SELECT','fullname','email','internal','interface','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8bd7,0x155));var _0x78bd=function(_0x302030,_0x1786af){_0x302030=_0x302030-0x0;var _0x1412ff=_0x8bd7[_0x302030];return _0x1412ff;};'use strict';var emlformat=require(_0x78bd('0x0'));var moment=require('moment');var BPromise=require(_0x78bd('0x1'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x78bd('0x2'));var Redis=require('ioredis');var htmlToText=require(_0x78bd('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x78bd('0x4'));var interaction_log=require(_0x78bd('0x5'))(_0x78bd('0x6'));var config=require(_0x78bd('0x7'));var db=require('../../mysqldb')['db'];config[_0x78bd('0x8')]=_[_0x78bd('0x9')](config[_0x78bd('0x8')],{'host':_0x78bd('0xa'),'port':0x18eb});var socket=require(_0x78bd('0xb'))(new Redis(config[_0x78bd('0x8')]));var htmlEntities=require('html-entities');require(_0x78bd('0xc'))[_0x78bd('0xd')](socket);var jayson=require(_0x78bd('0xe'));var client=jayson[_0x78bd('0xf')]['http']({'port':0x232c});var client9003=jayson[_0x78bd('0xf')][_0x78bd('0x10')]({'port':0x232b});var client9002=jayson[_0x78bd('0xf')][_0x78bd('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x1d6c43,_0x28d952,_0x22ce0e,_0x79efbc){return new BPromise(function(_0x5decfc,_0x5185ca){var _0x5d892d=_0x79efbc||client;return _0x5d892d[_0x78bd('0x11')](_0x1d6c43,_0x22ce0e)[_0x78bd('0x12')](function(_0x361720){logger[_0x78bd('0x13')](_0x78bd('0x14'),_0x28d952,_0x78bd('0x15'));logger[_0x78bd('0x16')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x28d952,'request\x20sent',JSON[_0x78bd('0x17')](_0x361720));if(_0x361720[_0x78bd('0x18')]){if(_0x361720[_0x78bd('0x18')][_0x78bd('0x19')]===0x1f4){logger[_0x78bd('0x18')]('MailMessage,\x20%s,\x20%s',_0x28d952,_0x361720[_0x78bd('0x18')]['message']);return _0x5185ca(_0x361720[_0x78bd('0x18')]['message']);}logger[_0x78bd('0x18')](_0x78bd('0x14'),_0x28d952,_0x361720['error'][_0x78bd('0x1a')]);return _0x5decfc(_0x361720[_0x78bd('0x18')][_0x78bd('0x1a')]);}else{logger[_0x78bd('0x13')](_0x78bd('0x14'),_0x28d952,_0x78bd('0x15'));_0x5decfc(_0x361720[_0x78bd('0x1b')][_0x78bd('0x1a')]);}})[_0x78bd('0x1c')](function(_0x62b887){logger[_0x78bd('0x18')](_0x78bd('0x14'),_0x28d952,_0x62b887);_0x5185ca(_0x62b887);});});}function respondWithResult(_0x3dada2,_0x3b26d5){_0x3b26d5=_0x3b26d5||0xc8;return function(_0x4b66a8){if(_0x4b66a8){return _0x3dada2[_0x78bd('0x1d')](_0x3b26d5)['json'](_0x4b66a8);}};}function respondWithFilteredResult(_0x454ca2,_0x4e578b){return function(_0x30369b){if(_0x30369b){var _0x2fa7c2=typeof _0x4e578b[_0x78bd('0x1e')]===_0x78bd('0x1f')&&typeof _0x4e578b[_0x78bd('0x20')]==='undefined';var _0x2985a1=_0x30369b[_0x78bd('0x21')];var _0x3bad2f=_0x2fa7c2?0x0:_0x4e578b[_0x78bd('0x1e')];var _0x4d2f36=_0x2fa7c2?_0x30369b[_0x78bd('0x21')]:_0x4e578b['offset']+_0x4e578b[_0x78bd('0x20')];var _0x295cf8;if(_0x4d2f36>=_0x2985a1){_0x4d2f36=_0x2985a1;_0x295cf8=0xc8;}else{_0x295cf8=0xce;}_0x454ca2[_0x78bd('0x1d')](_0x295cf8);return _0x454ca2['set']('Content-Range',_0x3bad2f+'-'+_0x4d2f36+'/'+_0x2985a1)[_0x78bd('0x22')](_0x30369b);}return null;};}function saveUpdates(_0x4bf9ac){return function(_0xbfd5d7){if(_0xbfd5d7){return _0xbfd5d7[_0x78bd('0x23')](_0x4bf9ac)[_0x78bd('0x12')](function(_0x23d1e7){return _0x23d1e7;});}return null;};}function removeEntity(_0x29df84){return function(_0x2b1ac7){if(_0x2b1ac7){return _0x2b1ac7['destroy']()[_0x78bd('0x12')](function(){_0x29df84[_0x78bd('0x1d')](0xcc)[_0x78bd('0x24')]();});}};}function handleEntityNotFound(_0x5ac73d){return function(_0x38df73){if(!_0x38df73){_0x5ac73d[_0x78bd('0x25')](0x194);}return _0x38df73;};}function handleError(_0x50b336,_0x266002){_0x266002=_0x266002||0x1f4;return function(_0x1a3e00){logger[_0x78bd('0x18')](_0x1a3e00[_0x78bd('0x26')]);if(_0x1a3e00[_0x78bd('0x27')]){delete _0x1a3e00[_0x78bd('0x27')];}_0x50b336[_0x78bd('0x1d')](_0x266002)['send'](_0x1a3e00);};}exports[_0x78bd('0x28')]=function(_0x2ec7a7,_0x213dc3){var _0x5188b4={},_0x205e5a={},_0x338a8={'count':0x0,'rows':[]};var _0x41a9c5=_[_0x78bd('0x29')](db[_0x78bd('0x2a')][_0x78bd('0x2b')],function(_0x2c08d7){return{'name':_0x2c08d7[_0x78bd('0x2c')],'type':_0x2c08d7[_0x78bd('0x2d')][_0x78bd('0x2e')]};});_0x205e5a[_0x78bd('0x2f')]=_[_0x78bd('0x29')](_0x41a9c5,_0x78bd('0x27'));_0x205e5a[_0x78bd('0x30')]=_[_0x78bd('0x31')](_0x2ec7a7[_0x78bd('0x30')]);_0x205e5a[_0x78bd('0x32')]=_[_0x78bd('0x33')](_0x205e5a[_0x78bd('0x2f')],_0x205e5a['query']);_0x5188b4[_0x78bd('0x34')]=_['intersection'](_0x205e5a[_0x78bd('0x2f')],qs[_0x78bd('0x35')](_0x2ec7a7[_0x78bd('0x30')][_0x78bd('0x35')]));_0x5188b4[_0x78bd('0x34')]=_0x5188b4[_0x78bd('0x34')][_0x78bd('0x36')]?_0x5188b4[_0x78bd('0x34')]:_0x205e5a[_0x78bd('0x2f')];if(!_0x2ec7a7['query'][_0x78bd('0x37')](_0x78bd('0x38'))){_0x5188b4[_0x78bd('0x20')]=qs[_0x78bd('0x20')](_0x2ec7a7[_0x78bd('0x30')][_0x78bd('0x20')]);_0x5188b4[_0x78bd('0x1e')]=qs[_0x78bd('0x1e')](_0x2ec7a7[_0x78bd('0x30')][_0x78bd('0x1e')]);}_0x5188b4[_0x78bd('0x39')]=qs[_0x78bd('0x3a')](_0x2ec7a7['query'][_0x78bd('0x3a')]);_0x5188b4[_0x78bd('0x3b')]=qs['filters'](_[_0x78bd('0x3c')](_0x2ec7a7[_0x78bd('0x30')],_0x205e5a[_0x78bd('0x32')]),_0x41a9c5);if(_0x2ec7a7['query'][_0x78bd('0x3d')]){_0x5188b4[_0x78bd('0x3b')]=_[_0x78bd('0x3e')](_0x5188b4['where'],{'$or':_[_0x78bd('0x29')](_0x41a9c5,function(_0x417a5c){if(_0x417a5c[_0x78bd('0x2d')]!==_0x78bd('0x3f')){var _0x30cebd={};_0x30cebd[_0x417a5c[_0x78bd('0x27')]]={'$like':'%'+_0x2ec7a7['query'][_0x78bd('0x3d')]+'%'};return _0x30cebd;}})});}_0x5188b4=_['merge']({},_0x5188b4,_0x2ec7a7[_0x78bd('0x40')]);var _0x48c112={'where':_0x5188b4[_0x78bd('0x3b')]};return db[_0x78bd('0x2a')][_0x78bd('0x21')](_0x48c112)['then'](function(_0x1fd3de){_0x338a8['count']=_0x1fd3de;if(_0x2ec7a7[_0x78bd('0x30')][_0x78bd('0x41')]){_0x5188b4['include']=[{'all':!![]}];}return db['MailMessage'][_0x78bd('0x42')](_0x5188b4);})[_0x78bd('0x12')](function(_0x33f85f){_0x338a8[_0x78bd('0x43')]=_0x33f85f;return _0x338a8;})[_0x78bd('0x12')](respondWithFilteredResult(_0x213dc3,_0x5188b4))[_0x78bd('0x1c')](handleError(_0x213dc3,null));};exports[_0x78bd('0x44')]=function(_0x4c3a97,_0x578df6){var _0x294a72={'raw':!![],'where':{'id':_0x4c3a97['params']['id']}},_0x37affc={};_0x37affc[_0x78bd('0x2f')]=_[_0x78bd('0x31')](db[_0x78bd('0x2a')][_0x78bd('0x2b')]);_0x37affc[_0x78bd('0x30')]=_[_0x78bd('0x31')](_0x4c3a97[_0x78bd('0x30')]);_0x37affc[_0x78bd('0x32')]=_['intersection'](_0x37affc[_0x78bd('0x2f')],_0x37affc['query']);_0x294a72[_0x78bd('0x34')]=_[_0x78bd('0x33')](_0x37affc[_0x78bd('0x2f')],qs['fields'](_0x4c3a97[_0x78bd('0x30')][_0x78bd('0x35')]));_0x294a72[_0x78bd('0x34')]=_0x294a72['attributes'][_0x78bd('0x36')]?_0x294a72[_0x78bd('0x34')]:_0x37affc[_0x78bd('0x2f')];if(_0x4c3a97[_0x78bd('0x30')][_0x78bd('0x41')]){_0x294a72[_0x78bd('0x45')]=[{'all':!![]}];}_0x294a72=_[_0x78bd('0x3e')]({},_0x294a72,_0x4c3a97[_0x78bd('0x40')]);return db[_0x78bd('0x2a')][_0x78bd('0x46')](_0x294a72)[_0x78bd('0x12')](handleEntityNotFound(_0x578df6,null))[_0x78bd('0x12')](respondWithResult(_0x578df6,null))['catch'](handleError(_0x578df6,null));};exports['update']=function(_0x276828,_0x2691b9){if(_0x276828[_0x78bd('0x47')]['id']){delete _0x276828[_0x78bd('0x47')]['id'];}return db[_0x78bd('0x2a')][_0x78bd('0x46')]({'where':{'id':_0x276828[_0x78bd('0x48')]['id']}})[_0x78bd('0x12')](handleEntityNotFound(_0x2691b9,null))[_0x78bd('0x12')](saveUpdates(_0x276828[_0x78bd('0x47')],null))[_0x78bd('0x12')](respondWithResult(_0x2691b9,null))[_0x78bd('0x1c')](handleError(_0x2691b9,null));};exports[_0x78bd('0x49')]=function(_0x555d15,_0x42069e){return db[_0x78bd('0x2a')][_0x78bd('0x46')]({'where':{'id':_0x555d15[_0x78bd('0x48')]['id']}})[_0x78bd('0x12')](handleEntityNotFound(_0x42069e,null))[_0x78bd('0x12')](removeEntity(_0x42069e,null))['catch'](handleError(_0x42069e,null));};exports[_0x78bd('0x4a')]=function(_0x470850,_0x12ea96){return db[_0x78bd('0x2a')][_0x78bd('0x4a')]()[_0x78bd('0x12')](respondWithResult(_0x12ea96,null))[_0x78bd('0x1c')](handleError(_0x12ea96,null));};exports[_0x78bd('0x4b')]=function(_0x5d914b,_0x240871){return db['MailMessage'][_0x78bd('0x4b')](_0x5d914b[_0x78bd('0x47')])[_0x78bd('0x12')](function(_0x3dfbe2){if(_0x3dfbe2){if(_0x3dfbe2[_0x78bd('0x4c')]==='out'&&!_0x3dfbe2[_0x78bd('0x4d')]){var _0x524c82,_0x2d756e,_0x59627a;if(_0x5d914b['body']['to']){_0x2d756e=_0x5d914b[_0x78bd('0x47')]['to'][_0x78bd('0x4e')](',')[0x0];}return db[_0x78bd('0x4f')][_0x78bd('0x50')]({'where':{'id':_0x3dfbe2[_0x78bd('0x51')]},'include':[{'model':db['CmList'],'as':_0x78bd('0x52'),'include':[{'model':db[_0x78bd('0x53')],'as':_0x78bd('0x54'),'where':{'email':_0x2d756e},'limit':0x1,'order':[[_0x78bd('0x55'),_0x78bd('0x56')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x78bd('0x57')],'as':_0x78bd('0x57'),'raw':!![]}]}]})[_0x78bd('0x12')](function(_0xb64db2){_0x524c82=_0xb64db2;if(!_0x524c82||!_0x524c82[_0x78bd('0x58')])return;var _0x29fb21=_0x524c82[_0x78bd('0x59')]();if(_0x5d914b[_0x78bd('0x47')][_0x78bd('0x5a')]&&_0x5d914b[_0x78bd('0x47')][_0x78bd('0x5a')][_0x78bd('0x36')]){for(var _0x1eb7e3=0x0;_0x1eb7e3<_0x5d914b['body'][_0x78bd('0x5a')][_0x78bd('0x36')];_0x1eb7e3+=0x1){_0x5d914b[_0x78bd('0x47')][_0x78bd('0x5a')][_0x1eb7e3]={'filename':_0x5d914b[_0x78bd('0x47')][_0x78bd('0x5a')][_0x1eb7e3][_0x78bd('0x27')],'path':path[_0x78bd('0x5b')](config['root'],'server/files/attachments',_0x5d914b['body'][_0x78bd('0x5a')][_0x1eb7e3][_0x78bd('0x5c')])};}}_0x59627a={'account':_0x29fb21,'message':_0x5d914b['body']};return;})[_0x78bd('0x12')](function(){if(_0x524c82[_0x78bd('0x52')]){if(_0x524c82[_0x78bd('0x52')][_0x78bd('0x54')][_0x78bd('0x36')]){return _0x524c82[_0x78bd('0x52')][_0x78bd('0x54')][0x0];}else{return db['CmContact'][_0x78bd('0x4b')](_['defaults'](_0x5d914b['body'],{'firstName':_0x5d914b[_0x78bd('0x47')]['to'],'email':_0x5d914b[_0x78bd('0x47')]['to'],'phone':_0x5d914b[_0x78bd('0x47')]['to'],'ListId':_0x524c82[_0x78bd('0x5d')]}));}}else{throw new Error(_0x78bd('0x5e'));}})[_0x78bd('0x12')](function(){if(_0x59627a){return respondWithRpcPromise(_0x78bd('0x5f'),_0x78bd('0x60'),_0x59627a,client9003)['then'](function(_0x2b2516){return _0x3dfbe2['update']({'read':!![],'messageId':_0x2b2516['messageId'],'sentAt':moment()[_0x78bd('0x61')](_0x78bd('0x62'))});})[_0x78bd('0x1c')](function(_0x5332a5){logger['error']('%s',JSON['stringify'](_0x5332a5));return _0x3dfbe2;});}return _0x3dfbe2;});}return _0x3dfbe2;}})[_0x78bd('0x12')](respondWithResult(_0x240871,0xc9))[_0x78bd('0x1c')](handleError(_0x240871,null));};exports[_0x78bd('0x63')]=function(_0x3947f7,_0x5405c7){var _0x15654a={'agent':{},'channel':_0x78bd('0x64')};if(_0x3947f7[_0x78bd('0x47')]['id']){delete _0x3947f7[_0x78bd('0x47')]['id'];}_0x3947f7[_0x78bd('0x47')][_0x78bd('0x65')]=!![];_0x3947f7['body'][_0x78bd('0x66')]=moment()['format'](_0x78bd('0x62'));_0x3947f7['body'][_0x78bd('0x67')]=_0x3947f7[_0x78bd('0x47')][_0x78bd('0x67')]||_0x3947f7[_0x78bd('0x68')]['id'];_0x15654a[_0x78bd('0x69')]['id']=_0x3947f7[_0x78bd('0x47')][_0x78bd('0x67')];return db[_0x78bd('0x2a')]['find']({'where':{'id':_0x3947f7['params']['id'],'UserId':null}})[_0x78bd('0x12')](handleEntityNotFound(_0x5405c7,null))['then'](saveUpdates(_0x3947f7['body'],null))['then'](function(_0x14678c){if(_0x14678c){_0x15654a[_0x78bd('0x1a')]=_0x14678c['get']({'plain':!![]});return db[_0x78bd('0x6a')][_0x78bd('0x46')]({'where':{'id':_0x14678c[_0x78bd('0x6b')]}});}return null;})['then'](handleEntityNotFound(_0x5405c7,null))[_0x78bd('0x12')](function(_0x5b05e0){if(_0x5b05e0){return _0x5b05e0[_0x78bd('0x23')]({'UserId':_0x3947f7[_0x78bd('0x47')]['UserId'],'read1stAt':_[_0x78bd('0x6c')](_0x5b05e0['read1stAt'])?moment()[_0x78bd('0x61')](_0x78bd('0x62')):undefined});}return null;})[_0x78bd('0x12')](function(_0x31f771){if(_0x31f771){_0x15654a['interaction']=_0x31f771[_0x78bd('0x6d')]({'plain':!![]});interaction_log[_0x78bd('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3947f7[_0x78bd('0x68')]['id'],_0x3947f7[_0x78bd('0x68')][_0x78bd('0x27')],_0x3947f7[_0x78bd('0x68')]['role'],_0x15654a[_0x78bd('0x6e')]['id'],_0x3947f7['body']?JSON[_0x78bd('0x17')](_0x3947f7[_0x78bd('0x47')]):_0x78bd('0x6f'));return respondWithRpcPromise(_0x78bd('0x70'),_0x78bd('0x71'),_0x15654a);}return null;})[_0x78bd('0x12')](function(_0x3a6ce5){var _0x262958=_0x78bd('0x72')+_0x3a6ce5[_0x78bd('0x1a')][_0x78bd('0x73')];return db[_0x78bd('0x74')][_0x78bd('0x30')](_0x262958,{'type':db['Sequelize']['QueryTypes'][_0x78bd('0x75')],'raw':!![]})[_0x78bd('0x12')](function(_0x4bb9e7){return _0x4bb9e7;});})[_0x78bd('0x12')](function(_0x1eea1c){if(_0x1eea1c){_0x15654a[_0x78bd('0x1a')]['contact']=_0x1eea1c[0x0];if(!_0x3947f7[_0x78bd('0x47')]['UserId'])return;return db['User'][_0x78bd('0x46')]({'where':{'id':_0x3947f7[_0x78bd('0x47')][_0x78bd('0x67')],'role':_0x78bd('0x69')},'attributes':['id','name',_0x78bd('0x76'),_0x78bd('0x77'),_0x78bd('0x78')],'raw':!![]});}return null;})[_0x78bd('0x12')](function(_0x3e7216){if(!_0x3e7216)return null;_0x15654a[_0x78bd('0x1a')][_0x78bd('0x69')]=_0x3e7216;return _0x15654a;})[_0x78bd('0x12')](function(_0x340ee4){if(_0x340ee4){if(_0x3947f7['body']['manual']){_0x15654a[_0x78bd('0x1a')][_0x78bd('0x79')]=util[_0x78bd('0x61')]('SIP/%s',_0x3947f7[_0x78bd('0x68')][_0x78bd('0x27')]);_0x15654a[_0x78bd('0x1a')]['channel']=_0x15654a[_0x78bd('0x7a')];_0x15654a[_0x78bd('0x1a')][_0x78bd('0x7b')]=_0x15654a[_0x78bd('0x7a')];_0x15654a[_0x78bd('0x1a')][_0x78bd('0x7c')]='accept';_0x15654a[_0x78bd('0x1a')]['body']=htmlToText[_0x78bd('0x7d')](_0x15654a[_0x78bd('0x1a')][_0x78bd('0x47')]);return respondWithRpcPromise(_0x78bd('0x7e'),'EventManager',{'event':_0x78bd('0x7f'),'message':_0x15654a[_0x78bd('0x1a')]},client9002)['then'](function(){return _0x15654a;});}return _0x15654a;}return null;})[_0x78bd('0x12')](respondWithResult(_0x5405c7,null))[_0x78bd('0x1c')](handleError(_0x5405c7,null));};exports[_0x78bd('0x80')]=function(_0xb8dc7d,_0x373c23){var _0x1d65c9={'agent':{},'channel':_0x78bd('0x64')};if(_0xb8dc7d['body']['id']){delete _0xb8dc7d['body']['id'];}_0xb8dc7d[_0x78bd('0x47')][_0x78bd('0x67')]=_0xb8dc7d[_0x78bd('0x47')][_0x78bd('0x67')]||_0xb8dc7d[_0x78bd('0x68')]['id'];_0x1d65c9[_0x78bd('0x69')]['id']=_0xb8dc7d[_0x78bd('0x47')][_0x78bd('0x67')];return db[_0x78bd('0x2a')][_0x78bd('0x46')]({'where':{'id':_0xb8dc7d[_0x78bd('0x48')]['id'],'UserId':null}})[_0x78bd('0x12')](handleEntityNotFound(_0x373c23,null))[_0x78bd('0x12')](function(_0x522f15){if(_0x522f15){_0x1d65c9['message']=_0x522f15[_0x78bd('0x6d')]({'plain':!![]});return db[_0x78bd('0x6a')][_0x78bd('0x46')]({'where':{'id':_0x522f15[_0x78bd('0x6b')]}});}return null;})[_0x78bd('0x12')](handleEntityNotFound(_0x373c23,null))[_0x78bd('0x12')](function(_0xbce209){if(_0xbce209){_0x1d65c9[_0x78bd('0x6e')]=_0xbce209['get']({'plain':!![]});interaction_log[_0x78bd('0x13')](_0x78bd('0x81'),_0xb8dc7d[_0x78bd('0x68')]['id'],_0xb8dc7d[_0x78bd('0x68')][_0x78bd('0x27')],_0xb8dc7d[_0x78bd('0x68')]['role'],_0x1d65c9['interaction']['id'],_0xb8dc7d[_0x78bd('0x47')]?JSON[_0x78bd('0x17')](_0xb8dc7d['body']):_0x78bd('0x6f'));return respondWithRpcPromise(_0x78bd('0x82'),_0x78bd('0x83'),_0x1d65c9);}return null;})[_0x78bd('0x12')](function(_0x33c911){var _0x1ff4d2=_0x78bd('0x72')+_0x33c911['message'][_0x78bd('0x73')];return db['sequelize'][_0x78bd('0x30')](_0x1ff4d2,{'type':db[_0x78bd('0x84')][_0x78bd('0x85')][_0x78bd('0x75')],'raw':!![]})[_0x78bd('0x12')](function(_0x26093b){return _0x26093b;});})['then'](function(_0x20d3e9){if(_0x20d3e9){_0x1d65c9[_0x78bd('0x1a')][_0x78bd('0x86')]=_0x20d3e9[0x0];if(!_0xb8dc7d[_0x78bd('0x47')][_0x78bd('0x67')])return;return db[_0x78bd('0x87')]['find']({'where':{'id':_0xb8dc7d[_0x78bd('0x47')][_0x78bd('0x67')],'role':_0x78bd('0x69')},'attributes':['id',_0x78bd('0x27'),_0x78bd('0x76'),_0x78bd('0x77'),_0x78bd('0x78')],'raw':!![]});}return null;})[_0x78bd('0x12')](function(_0x47b8e3){if(!_0x47b8e3)return null;_0x1d65c9['message'][_0x78bd('0x69')]=_0x47b8e3;return _0x1d65c9;})[_0x78bd('0x12')](function(_0x137650){if(_0x137650){_0x137650[_0x78bd('0x1a')][_0x78bd('0x79')]=util['format'](_0x78bd('0x88'),_0xb8dc7d[_0x78bd('0x68')]['name']);_0x137650[_0x78bd('0x1a')][_0x78bd('0x7a')]=_0x1d65c9[_0x78bd('0x7a')];_0x137650[_0x78bd('0x1a')]['motionChannel']=_0x1d65c9[_0x78bd('0x7a')];_0x137650[_0x78bd('0x1a')][_0x78bd('0x7c')]=_0x78bd('0x80');_0x137650[_0x78bd('0x1a')][_0x78bd('0x47')]=htmlToText['fromString'](_0x1d65c9[_0x78bd('0x1a')][_0x78bd('0x47')]);respondWithRpcPromise(_0x78bd('0x7e'),_0x78bd('0x7e'),{'event':_0x78bd('0x89'),'message':_0x137650[_0x78bd('0x1a')]},client9002);return _0x1d65c9;}return null;})[_0x78bd('0x12')](respondWithResult(_0x373c23,null))[_0x78bd('0x1c')](handleError(_0x373c23,null));};exports[_0x78bd('0x8a')]=function(_0x1a5a7b,_0x29ef56){var _0x4b9a5b=moment()['unix']()[_0x78bd('0x8b')]();var _0x62880c=path['join'](config[_0x78bd('0x8c')],_0x78bd('0x8d'),_0x78bd('0x8e'),_0x78bd('0x8f'));var _0x170659=path['join'](config[_0x78bd('0x8c')],_0x78bd('0x8d'),'files',_0x78bd('0x5a'));var _0x3b6068=util[_0x78bd('0x61')]('message-%s.eml',_0x4b9a5b);return db['MailMessage'][_0x78bd('0x46')]({'where':{'id':_0x1a5a7b[_0x78bd('0x48')]['id']},'attributes':['id',_0x78bd('0x47'),_0x78bd('0x90'),'to','cc','bcc',_0x78bd('0x91'),_0x78bd('0x92')],'include':_0x1a5a7b[_0x78bd('0x30')][_0x78bd('0x5a')]?[{'model':db[_0x78bd('0x93')],'as':_0x78bd('0x94')}]:undefined})['then'](handleEntityNotFound(_0x29ef56,null))[_0x78bd('0x12')](function(_0x2fe27a){if(_0x2fe27a){var _0x15d925=_0x2fe27a;var _0x3f52a1={'from':_0x15d925[_0x78bd('0x90')],'to':_0x15d925['to'],'subject':_0x15d925[_0x78bd('0x91')],'html':htmlEntities[_0x78bd('0x95')](_0x15d925[_0x78bd('0x47')]),'headers':{'Date':moment(_0x15d925[_0x78bd('0x92')])[_0x78bd('0x61')](_0x78bd('0x96'))},'attachments':[]};if(_0x2fe27a['cc']){_0x3f52a1['headers']['Cc']=_0x2fe27a['cc'];}if(_0x2fe27a[_0x78bd('0x97')]){_0x3f52a1[_0x78bd('0x98')]['Bcc']=_0x2fe27a[_0x78bd('0x97')];}return new BPromise(function(_0x2e869a,_0xcfdf9e){if(_0x2fe27a[_0x78bd('0x94')]){for(var _0x301e19=0x0;_0x301e19<_0x2fe27a['Attachments']['length'];_0x301e19++){var _0x510357=_0x2fe27a[_0x78bd('0x94')][_0x301e19];var _0x26e840=path[_0x78bd('0x5b')](_0x170659,_0x510357[_0x78bd('0x5c')]);if(fs[_0x78bd('0x99')](_0x26e840)){_0x3f52a1['attachments'][_0x78bd('0x9a')]({'name':_0x510357[_0x78bd('0x27')],'contentType':_0x510357[_0x78bd('0x2d')],'data':fs[_0x78bd('0x9b')](_0x26e840)});}}}emlformat[_0x78bd('0x9c')](_0x3f52a1,function(_0xebcea7,_0x170375){if(_0xebcea7)return _0xcfdf9e(_0xebcea7);fs['writeFileSync'](path['join'](_0x62880c,_0x3b6068),_0x170375);return _0x2e869a(_0x170375);});});}})['then'](function(_0x45dbcc){if(_0x45dbcc){return _0x29ef56['download'](path['join'](_0x62880c,_0x3b6068),_0x3b6068,function(_0x3962d9){if(!_0x3962d9)fs[_0x78bd('0x9d')](path['join'](_0x62880c,_0x3b6068));});}})[_0x78bd('0x1c')](handleError(_0x29ef56,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 86d7c5a..ba2eff2 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 _0x479a=['save','update','remove','emit','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4c15e7,_0x4ad7f5){var _0x1f119a=function(_0x5b3da8){while(--_0x5b3da8){_0x4c15e7['push'](_0x4c15e7['shift']());}};_0x1f119a(++_0x4ad7f5);}(_0x479a,0xce));var _0xa479=function(_0xa4cfb1,_0x534a5a){_0xa4cfb1=_0xa4cfb1-0x0;var _0x270028=_0x479a[_0xa4cfb1];return _0x270028;};'use strict';var EventEmitter=require(_0xa479('0x0'));var MailMessage=require(_0xa479('0x1'))['db'][_0xa479('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa479('0x3')](0x0);var events={'afterCreate':_0xa479('0x4'),'afterUpdate':_0xa479('0x5'),'afterDestroy':_0xa479('0x6')};function emitEvent(_0x5bfd70){return function(_0x2a0da5,_0xd534d7,_0xebf1e5){MailMessageEvents[_0xa479('0x7')](_0x5bfd70+':'+_0x2a0da5['id'],_0x2a0da5);MailMessageEvents[_0xa479('0x7')](_0x5bfd70,_0x2a0da5);_0xebf1e5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xa479('0x8')](e,emitEvent(event));}}module[_0xa479('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x02f2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x377f79,_0x28ad29){var _0xf75b4b=function(_0x5a1d06){while(--_0x5a1d06){_0x377f79['push'](_0x377f79['shift']());}};_0xf75b4b(++_0x28ad29);}(_0x02f2,0x11b));var _0x202f=function(_0x4372dd,_0x4f2746){_0x4372dd=_0x4372dd-0x0;var _0x20ec89=_0x02f2[_0x4372dd];return _0x20ec89;};'use strict';var EventEmitter=require(_0x202f('0x0'));var MailMessage=require(_0x202f('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x202f('0x2'),'afterUpdate':_0x202f('0x3'),'afterDestroy':_0x202f('0x4')};function emitEvent(_0x5905d8){return function(_0x363bce,_0x31a05f,_0x27443e){MailMessageEvents['emit'](_0x5905d8+':'+_0x363bce['id'],_0x363bce);MailMessageEvents[_0x202f('0x5')](_0x5905d8,_0x363bce);_0x27443e(null);};}for(var e in events){if(events[_0x202f('0x6')](e)){var event=events[e];MailMessage[_0x202f('0x7')](e,emitEvent(event));}}module[_0x202f('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 98f239f..de363d6 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 _0x2dc1=['path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','fromString','body','models','get','direction','toLowerCase','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','html-to-text'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0x2dc1,0xc5));var _0x12dc=function(_0x2b6430,_0x584d96){_0x2b6430=_0x2b6430-0x0;var _0x48fed1=_0x2dc1[_0x2b6430];return _0x48fed1;};'use strict';var _=require(_0x12dc('0x0'));var util=require(_0x12dc('0x1'));var logger=require(_0x12dc('0x2'))(_0x12dc('0x3'));var moment=require('moment');var BPromise=require(_0x12dc('0x4'));var rp=require(_0x12dc('0x5'));var htmlToText=require(_0x12dc('0x6'));var fs=require('fs');var path=require(_0x12dc('0x7'));var rimraf=require('rimraf');var config=require(_0x12dc('0x8'));var attributes=require(_0x12dc('0x9'));module[_0x12dc('0xa')]=function(_0x52a818,_0xcfda53){return _0x52a818['define'](_0x12dc('0xb'),attributes,{'tableName':_0x12dc('0xc'),'paranoid':![],'indexes':[{'name':_0x12dc('0xd'),'fields':[_0x12dc('0xd')]},{'name':_0x12dc('0xe'),'fields':[_0x12dc('0xf'),_0x12dc('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x49f689,_0x56538e,_0x4bb70e){if(_0x49f689['body']){_0x49f689[_0x12dc('0xf')]=htmlToText[_0x12dc('0x11')](_0x49f689[_0x12dc('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4bb70e(null,_0x56538e);},'afterCreate':function(_0x58fdb3,_0x26929e,_0x301506){var _0x193588=_0x52a818[_0x12dc('0x13')];var _0x16ebbf=_0x58fdb3[_0x12dc('0x14')]({'plain':!![]});if(_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()==='in'||_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()==='out'&&!_0x16ebbf['secret']&&!_['isNil'](_0x16ebbf[_0x12dc('0x17')])){_0x193588[_0x12dc('0x18')][_0x12dc('0x19')]({'where':{'id':_0x16ebbf[_0x12dc('0x1a')]}})[_0x12dc('0x1b')](function(_0x2da0e0){if(_0x2da0e0){_0x2da0e0[_0x12dc('0x1c')]({'lastMsgAt':_0x16ebbf[_0x12dc('0x1d')],'lastMsgDirection':_0x16ebbf[_0x12dc('0x15')][_0x12dc('0x16')]()});}})[_0x12dc('0x1e')](function(_0x269aaf){console[_0x12dc('0x1f')](_0x269aaf);});}_0x301506();}},'charset':_0x12dc('0x20'),'collate':_0x12dc('0x21')});}; \ No newline at end of file +var _0x8169=['path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','plainBody','subject','FULLTEXT','body','fromString','models','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','html-to-text'];(function(_0x2e29d9,_0x37e372){var _0x29cd7a=function(_0xc1f004){while(--_0xc1f004){_0x2e29d9['push'](_0x2e29d9['shift']());}};_0x29cd7a(++_0x37e372);}(_0x8169,0x1a6));var _0x9816=function(_0xe73c82,_0x2a4b49){_0xe73c82=_0xe73c82-0x0;var _0x18024c=_0x8169[_0xe73c82];return _0x18024c;};'use strict';var _=require(_0x9816('0x0'));var util=require(_0x9816('0x1'));var logger=require(_0x9816('0x2'))('api');var moment=require(_0x9816('0x3'));var BPromise=require(_0x9816('0x4'));var rp=require(_0x9816('0x5'));var htmlToText=require(_0x9816('0x6'));var fs=require('fs');var path=require(_0x9816('0x7'));var rimraf=require(_0x9816('0x8'));var config=require(_0x9816('0x9'));var attributes=require(_0x9816('0xa'));module['exports']=function(_0x127b0f,_0x2daa26){return _0x127b0f[_0x9816('0xb')](_0x9816('0xc'),attributes,{'tableName':_0x9816('0xd'),'paranoid':![],'indexes':[{'name':_0x9816('0xe'),'fields':[_0x9816('0xe')]},{'name':'fti_mail_messages','fields':[_0x9816('0xf'),_0x9816('0x10')],'type':_0x9816('0x11')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43afe5,_0x405a33,_0xe0df4){if(_0x43afe5[_0x9816('0x12')]){_0x43afe5['plainBody']=htmlToText[_0x9816('0x13')](_0x43afe5[_0x9816('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xe0df4(null,_0x405a33);},'afterCreate':function(_0x2d6cb5,_0x591f74,_0x31c878){var _0x38eb36=_0x127b0f[_0x9816('0x14')];var _0x23a01d=_0x2d6cb5['get']({'plain':!![]});if(_0x23a01d['direction'][_0x9816('0x15')]()==='in'||_0x23a01d[_0x9816('0x16')][_0x9816('0x15')]()===_0x9816('0x17')&&!_0x23a01d['secret']&&!_[_0x9816('0x18')](_0x23a01d[_0x9816('0x19')])){_0x38eb36[_0x9816('0x1a')][_0x9816('0x1b')]({'where':{'id':_0x23a01d[_0x9816('0x1c')]}})[_0x9816('0x1d')](function(_0x1b9112){if(_0x1b9112){_0x1b9112['update']({'lastMsgAt':_0x23a01d[_0x9816('0x1e')],'lastMsgDirection':_0x23a01d[_0x9816('0x16')]['toLowerCase']()});}})['catch'](function(_0x3ce272){console[_0x9816('0x1f')](_0x3ce272);});}_0x31c878();}},'charset':'utf8mb4','collate':_0x9816('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bee42e0..417b2e5 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 _0x757a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./mailMessage.socket','request','then','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','info','catch','CreateMailMessage','MailMessage','create','body','raw','debug','stringify','util','moment'];(function(_0x5ed63c,_0x55b1f3){var _0x5cdf92=function(_0x3dc2da){while(--_0x3dc2da){_0x5ed63c['push'](_0x5ed63c['shift']());}};_0x5cdf92(++_0x55b1f3);}(_0x757a,0xde));var _0xa757=function(_0x2b4be0,_0x21d302){_0x2b4be0=_0x2b4be0-0x0;var _0x3069ef=_0x757a[_0x2b4be0];return _0x3069ef;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});config[_0xa757('0x9')]=_['defaults'](config[_0xa757('0x9')],{'host':_0xa757('0xa'),'port':0x18eb});var socket=require(_0xa757('0xb'))(new Redis(config[_0xa757('0x9')]));require(_0xa757('0xc'))['register'](socket);function respondWithRpcPromise(_0x89c630,_0x2ca96f,_0x32f0ec){return new BPromise(function(_0x3e2c9a,_0xb7610b){return client[_0xa757('0xd')](_0x89c630,_0x32f0ec)[_0xa757('0xe')](function(_0x483d77){logger['info']('MailMessage,\x20%s,\x20%s',_0x2ca96f,'request\x20sent');logger['debug'](_0xa757('0xf'),_0x2ca96f,'request\x20sent',JSON['stringify'](_0x483d77));if(_0x483d77[_0xa757('0x10')]){if(_0x483d77['error']['code']===0x1f4){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0xb7610b(_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);}logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x483d77[_0xa757('0x10')][_0xa757('0x12')]);return _0x3e2c9a(_0x483d77['error'][_0xa757('0x12')]);}else{logger[_0xa757('0x13')](_0xa757('0x11'),_0x2ca96f,'request\x20sent');_0x3e2c9a(_0x483d77['result'][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x1bd14c){logger[_0xa757('0x10')](_0xa757('0x11'),_0x2ca96f,_0x1bd14c);_0xb7610b(_0x1bd14c);});});}exports[_0xa757('0x15')]=function(_0x4bd137){var _0x58954=this;return new Promise(function(_0x4fec52,_0x32c2a1){return db[_0xa757('0x16')][_0xa757('0x17')](_0x4bd137[_0xa757('0x18')],{'raw':_0x4bd137['options']?_0x4bd137['options'][_0xa757('0x19')]===undefined?!![]:![]:!![]})[_0xa757('0xe')](function(_0x2ba923){logger[_0xa757('0x13')](_0xa757('0x15'),_0x4bd137);logger[_0xa757('0x1a')](_0xa757('0x15'),_0x4bd137,JSON[_0xa757('0x1b')](_0x2ba923));_0x4fec52(_0x2ba923);})[_0xa757('0x14')](function(_0x59fae6){logger[_0xa757('0x10')]('CreateMailMessage',_0x59fae6[_0xa757('0x12')],_0x4bd137);_0x32c2a1(_0x58954['error'](0x1f4,_0x59fae6[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x14a0=['code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1e6dcb,_0x55f6a4){var _0x470097=function(_0x4f404e){while(--_0x4f404e){_0x1e6dcb['push'](_0x1e6dcb['shift']());}};_0x470097(++_0x55f6a4);}(_0x14a0,0x8e));var _0x014a=function(_0x1ca51c,_0x329363){_0x1ca51c=_0x1ca51c-0x0;var _0x3943f9=_0x14a0[_0x1ca51c];return _0x3943f9;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});config['redis']=_[_0x014a('0xa')](config[_0x014a('0xb')],{'host':_0x014a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x014a('0xd'))['register'](socket);function respondWithRpcPromise(_0x490ea2,_0x5aa52f,_0x4f3539){return new BPromise(function(_0x330469,_0x4c7418){return client[_0x014a('0xe')](_0x490ea2,_0x4f3539)[_0x014a('0xf')](function(_0x543bbf){logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));logger[_0x014a('0x13')](_0x014a('0x14'),_0x5aa52f,_0x014a('0x12'),JSON[_0x014a('0x15')](_0x543bbf));if(_0x543bbf[_0x014a('0x16')]){if(_0x543bbf[_0x014a('0x16')][_0x014a('0x17')]===0x1f4){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x4c7418(_0x543bbf[_0x014a('0x16')]['message']);}logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x543bbf['error'][_0x014a('0x18')]);return _0x330469(_0x543bbf[_0x014a('0x16')][_0x014a('0x18')]);}else{logger[_0x014a('0x10')](_0x014a('0x11'),_0x5aa52f,_0x014a('0x12'));_0x330469(_0x543bbf[_0x014a('0x19')][_0x014a('0x18')]);}})[_0x014a('0x1a')](function(_0x3b9341){logger[_0x014a('0x16')](_0x014a('0x11'),_0x5aa52f,_0x3b9341);_0x4c7418(_0x3b9341);});});}exports[_0x014a('0x1b')]=function(_0x34e5c3){var _0x5c69c5=this;return new Promise(function(_0x359903,_0x109a9c){return db[_0x014a('0x1c')][_0x014a('0x1d')](_0x34e5c3[_0x014a('0x1e')],{'raw':_0x34e5c3[_0x014a('0x1f')]?_0x34e5c3[_0x014a('0x1f')][_0x014a('0x20')]===undefined?!![]:![]:!![]})[_0x014a('0xf')](function(_0x486e66){logger[_0x014a('0x10')]('CreateMailMessage',_0x34e5c3);logger[_0x014a('0x13')](_0x014a('0x1b'),_0x34e5c3,JSON[_0x014a('0x15')](_0x486e66));_0x359903(_0x486e66);})[_0x014a('0x1a')](function(_0x2b3c10){logger[_0x014a('0x16')](_0x014a('0x1b'),_0x2b3c10[_0x014a('0x18')],_0x34e5c3);_0x109a9c(_0x5c69c5[_0x014a('0x16')](0x1f4,_0x2b3c10['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 6c79e14..e1a591b 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 _0x6898=['register','length','mailMessage:','./mailMessage.events','remove','update','emit','removeListener'];(function(_0xfad043,_0x490b24){var _0x4dddfe=function(_0x4d083e){while(--_0x4d083e){_0xfad043['push'](_0xfad043['shift']());}};_0x4dddfe(++_0x490b24);}(_0x6898,0x11b));var _0x8689=function(_0x411d5b,_0x449a6c){_0x411d5b=_0x411d5b-0x0;var _0xed6856=_0x6898[_0x411d5b];return _0xed6856;};'use strict';var MailMessageEvents=require(_0x8689('0x0'));var events=['save',_0x8689('0x1'),_0x8689('0x2')];function createListener(_0x472b9d,_0x13fbdb){return function(_0x3ae917){_0x13fbdb[_0x8689('0x3')](_0x472b9d,_0x3ae917);};}function removeListener(_0x524f81,_0x5038aa){return function(){MailMessageEvents[_0x8689('0x4')](_0x524f81,_0x5038aa);};}exports[_0x8689('0x5')]=function(_0x2c723e){for(var _0x4e776d=0x0,_0xbc1b52=events[_0x8689('0x6')];_0x4e776d<_0xbc1b52;_0x4e776d++){var _0x9ab197=events[_0x4e776d];var _0x4e5261=createListener(_0x8689('0x7')+_0x9ab197,_0x2c723e);MailMessageEvents['on'](_0x9ab197,_0x4e5261);}}; \ No newline at end of file +var _0x8eba=['./mailMessage.events','save','remove','emit','register'];(function(_0x266451,_0x7ec45b){var _0x444e55=function(_0x45bb10){while(--_0x45bb10){_0x266451['push'](_0x266451['shift']());}};_0x444e55(++_0x7ec45b);}(_0x8eba,0x1ae));var _0xa8eb=function(_0x4c1ec2,_0x4f42b7){_0x4c1ec2=_0x4c1ec2-0x0;var _0x3f6f1c=_0x8eba[_0x4c1ec2];return _0x3f6f1c;};'use strict';var MailMessageEvents=require(_0xa8eb('0x0'));var events=[_0xa8eb('0x1'),_0xa8eb('0x2'),'update'];function createListener(_0x42b6e2,_0x92465f){return function(_0x2299b0){_0x92465f[_0xa8eb('0x3')](_0x42b6e2,_0x2299b0);};}function removeListener(_0x3b7143,_0x65b572){return function(){MailMessageEvents['removeListener'](_0x3b7143,_0x65b572);};}exports[_0xa8eb('0x4')]=function(_0x33b99d){for(var _0x490a8f=0x0,_0x366f7f=events['length'];_0x490a8f<_0x366f7f;_0x490a8f++){var _0x207fdf=events[_0x490a8f];var _0x281695=createListener('mailMessage:'+_0x207fdf,_0x33b99d);MailMessageEvents['on'](_0x207fdf,_0x281695);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 4c971dc..a71c5b5 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 _0xe154=['./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe154,0x162));var _0x4e15=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xe154[_0x432fca];return _0x3adba4;};'use strict';var multer=require('multer');var util=require(_0x4e15('0x0'));var path=require(_0x4e15('0x1'));var timeout=require(_0x4e15('0x2'));var express=require(_0x4e15('0x3'));var router=express['Router']();var fs_extra=require(_0x4e15('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e15('0x5'));var controller=require(_0x4e15('0x6'));router[_0x4e15('0x7')]('/',auth[_0x4e15('0x8')](),controller[_0x4e15('0x9')]);router[_0x4e15('0x7')](_0x4e15('0xa'),auth[_0x4e15('0x8')](),controller['describe']);router['get'](_0x4e15('0xb'),auth[_0x4e15('0x8')](),controller['show']);router['get']('/:id/members',auth[_0x4e15('0x8')](),controller[_0x4e15('0xc')]);router['get'](_0x4e15('0xd'),auth[_0x4e15('0x8')](),controller[_0x4e15('0xe')]);router[_0x4e15('0x7')](_0x4e15('0xf'),auth[_0x4e15('0x8')](),controller[_0x4e15('0x10')]);router[_0x4e15('0x11')]('/',auth[_0x4e15('0x8')](),controller[_0x4e15('0x12')]);router[_0x4e15('0x11')](_0x4e15('0xd'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x4e15('0x8')](),controller[_0x4e15('0x13')]);router['put'](_0x4e15('0xb'),auth[_0x4e15('0x8')](),controller['update']);router[_0x4e15('0x14')](_0x4e15('0xb'),auth['isAuthenticated'](),controller[_0x4e15('0x15')]);router['delete'](_0x4e15('0xd'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4e15('0x14')](_0x4e15('0xf'),auth['isAuthenticated'](),controller[_0x4e15('0x16')]);module[_0x4e15('0x17')]=router; \ No newline at end of file +var _0x09df=['create','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x09df,0xda));var _0xf09d=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x09df[_0x30bd4d];return _0x306915;};'use strict';var multer=require(_0xf09d('0x0'));var util=require(_0xf09d('0x1'));var path=require(_0xf09d('0x2'));var timeout=require(_0xf09d('0x3'));var express=require('express');var router=express[_0xf09d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf09d('0x5'));var interaction=require(_0xf09d('0x6'));var config=require(_0xf09d('0x7'));var controller=require(_0xf09d('0x8'));router['get']('/',auth[_0xf09d('0x9')](),controller[_0xf09d('0xa')]);router[_0xf09d('0xb')](_0xf09d('0xc'),auth[_0xf09d('0x9')](),controller[_0xf09d('0xd')]);router[_0xf09d('0xb')](_0xf09d('0xe'),auth[_0xf09d('0x9')](),controller[_0xf09d('0xf')]);router['get'](_0xf09d('0x10'),auth[_0xf09d('0x9')](),controller['getMembers']);router[_0xf09d('0xb')](_0xf09d('0x11'),auth['isAuthenticated'](),controller[_0xf09d('0x12')]);router[_0xf09d('0xb')](_0xf09d('0x13'),auth[_0xf09d('0x9')](),controller[_0xf09d('0x14')]);router[_0xf09d('0x15')]('/',auth[_0xf09d('0x9')](),controller[_0xf09d('0x16')]);router[_0xf09d('0x15')](_0xf09d('0x11'),auth[_0xf09d('0x9')](),controller[_0xf09d('0x17')]);router['post']('/:id/users',auth[_0xf09d('0x9')](),controller['addAgents']);router[_0xf09d('0x18')](_0xf09d('0xe'),auth[_0xf09d('0x9')](),controller[_0xf09d('0x19')]);router[_0xf09d('0x1a')](_0xf09d('0xe'),auth[_0xf09d('0x9')](),controller[_0xf09d('0x1b')]);router['delete'](_0xf09d('0x11'),auth[_0xf09d('0x9')](),controller['removeTeams']);router[_0xf09d('0x1a')](_0xf09d('0x13'),auth[_0xf09d('0x9')](),controller[_0xf09d('0x1c')]);module[_0xf09d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 54f574f..a8326ad 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 _0x0ffd=['ENUM','rrmemory','beepall','sequelize','name','STRING','INTEGER'];(function(_0xb77dfe,_0x39c4c7){var _0x5e4f5d=function(_0x49f1){while(--_0x49f1){_0xb77dfe['push'](_0xb77dfe['shift']());}};_0x5e4f5d(++_0x39c4c7);}(_0x0ffd,0x6c));var _0xd0ff=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x0ffd[_0xd1d19a];return _0x52a79d;};'use strict';var Sequelize=require(_0xd0ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xd0ff('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd0ff('0x2')]},'timeout':{'type':Sequelize[_0xd0ff('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd0ff('0x4')](_0xd0ff('0x5'),_0xd0ff('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xa251=['name','INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING'];(function(_0x1adffd,_0x144960){var _0x538879=function(_0x9756d4){while(--_0x9756d4){_0x1adffd['push'](_0x1adffd['shift']());}};_0x538879(++_0x144960);}(_0xa251,0x14e));var _0x1a25=function(_0x55841f,_0x487812){_0x55841f=_0x55841f-0x0;var _0x4c5ccf=_0xa251[_0x55841f];return _0x4c5ccf;};'use strict';var Sequelize=require(_0x1a25('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a25('0x1')],'unique':_0x1a25('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1a25('0x1')]},'timeout':{'type':Sequelize[_0x1a25('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1a25('0x4'),_0x1a25('0x5'),_0x1a25('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index fc00c7d..af7e595 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 _0x1d5c=['get','MailQueues','UserProfileResource','sendStatus','error','stack','name','map','MailQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','pick','addTeams','Team','Agents','online','voicePause','interface','transaction','each','findOrCreate','emit','userMailQueue:save','removeTeams','ids','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','includes','all','union','compact','value','isEmpty','forEach','userMailQueue:remove','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','status','end','undefined','count','offset','limit','set','Content-Range','apply','save','update','destroy','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d5c,0xeb));var _0xc1d5=function(_0x2d138a,_0x38524c){_0x2d138a=_0x2d138a-0x0;var _0x1c13e9=_0x1d5c[_0x2d138a];return _0x1c13e9;};'use strict';var emlformat=require(_0xc1d5('0x0'));var rimraf=require(_0xc1d5('0x1'));var zipdir=require(_0xc1d5('0x2'));var jsonpatch=require(_0xc1d5('0x3'));var rp=require(_0xc1d5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc1d5('0x5'));var path=require('path');var sox=require(_0xc1d5('0x6'));var csv=require(_0xc1d5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1d5('0x8'));var _=require(_0xc1d5('0x9'));var squel=require(_0xc1d5('0xa'));var crypto=require(_0xc1d5('0xb'));var jsforce=require(_0xc1d5('0xc'));var deskjs=require(_0xc1d5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc1d5('0xe'));var Papa=require(_0xc1d5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc1d5('0x10'));var as=require(_0xc1d5('0x11'));var hardwareService=require(_0xc1d5('0x12'));var logger=require(_0xc1d5('0x13'))(_0xc1d5('0x14'));var utils=require(_0xc1d5('0x15'));var config=require(_0xc1d5('0x16'));var licenseUtil=require(_0xc1d5('0x17'));var db=require(_0xc1d5('0x18'))['db'];config[_0xc1d5('0x19')]=_['defaults'](config[_0xc1d5('0x19')],{'host':_0xc1d5('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailQueue.socket')[_0xc1d5('0x1b')](socket);function respondWithStatusCode(_0x8f9117,_0x4dcb1d){_0x4dcb1d=_0x4dcb1d||0xcc;return function(_0x539da9){if(_0x539da9){return _0x8f9117['sendStatus'](_0x4dcb1d);}return _0x8f9117[_0xc1d5('0x1c')](_0x4dcb1d)[_0xc1d5('0x1d')]();};}function respondWithResult(_0x352070,_0x40c064){_0x40c064=_0x40c064||0xc8;return function(_0x215b5f){if(_0x215b5f){return _0x352070['status'](_0x40c064)['json'](_0x215b5f);}};}function respondWithFilteredResult(_0x9ffa73,_0x2cebc1){return function(_0x17f7c8){if(_0x17f7c8){var _0x1ca1dc=typeof _0x2cebc1['offset']===_0xc1d5('0x1e')&&typeof _0x2cebc1['limit']===_0xc1d5('0x1e');var _0x4c33d0=_0x17f7c8[_0xc1d5('0x1f')];var _0x1fcfb0=_0x1ca1dc?0x0:_0x2cebc1[_0xc1d5('0x20')];var _0x51346e=_0x1ca1dc?_0x17f7c8['count']:_0x2cebc1['offset']+_0x2cebc1[_0xc1d5('0x21')];var _0x318f99;if(_0x51346e>=_0x4c33d0){_0x51346e=_0x4c33d0;_0x318f99=0xc8;}else{_0x318f99=0xce;}_0x9ffa73[_0xc1d5('0x1c')](_0x318f99);return _0x9ffa73[_0xc1d5('0x22')](_0xc1d5('0x23'),_0x1fcfb0+'-'+_0x51346e+'/'+_0x4c33d0)['json'](_0x17f7c8);}return null;};}function patchUpdates(_0x35fc2d){return function(_0x644502){try{jsonpatch[_0xc1d5('0x24')](_0x644502,_0x35fc2d,!![]);}catch(_0x495d2d){return BPromise['reject'](_0x495d2d);}return _0x644502[_0xc1d5('0x25')]();};}function saveUpdates(_0x836a41,_0x48fa0a){return function(_0x5356d9){if(_0x5356d9){return _0x5356d9[_0xc1d5('0x26')](_0x836a41)['then'](function(_0x58d65a){return _0x58d65a;});}return null;};}function removeEntity(_0x13cc2e,_0x51a12e){return function(_0x3e6b0d){if(_0x3e6b0d){return _0x3e6b0d[_0xc1d5('0x27')]()[_0xc1d5('0x28')](function(){var _0x98fe96=_0x3e6b0d[_0xc1d5('0x29')]({'plain':!![]});var _0x5e2e5d=_0xc1d5('0x2a');return db[_0xc1d5('0x2b')][_0xc1d5('0x27')]({'where':{'type':_0x5e2e5d,'resourceId':_0x98fe96['id']}})['then'](function(){return _0x3e6b0d;});})[_0xc1d5('0x28')](function(){_0x13cc2e[_0xc1d5('0x1c')](0xcc)[_0xc1d5('0x1d')]();});}};}function handleEntityNotFound(_0xb31830,_0x5cef02){return function(_0x3f3a9c){if(!_0x3f3a9c){_0xb31830[_0xc1d5('0x2c')](0x194);}return _0x3f3a9c;};}function handleError(_0xcdb1b1,_0x29cf03){_0x29cf03=_0x29cf03||0x1f4;return function(_0x3796fd){logger[_0xc1d5('0x2d')](_0x3796fd[_0xc1d5('0x2e')]);if(_0x3796fd[_0xc1d5('0x2f')]){delete _0x3796fd['name'];}_0xcdb1b1[_0xc1d5('0x1c')](_0x29cf03)['send'](_0x3796fd);};}exports['index']=function(_0x503723,_0x4ac338){var _0xd22a28={},_0x546a1c={},_0xd6b2a4={'count':0x0,'rows':[]};var _0x429a4b=_[_0xc1d5('0x30')](db[_0xc1d5('0x31')][_0xc1d5('0x32')],function(_0x2db4c5){return{'name':_0x2db4c5['fieldName'],'type':_0x2db4c5['type'][_0xc1d5('0x33')]};});_0x546a1c[_0xc1d5('0x34')]=_['map'](_0x429a4b,_0xc1d5('0x2f'));_0x546a1c[_0xc1d5('0x35')]=_[_0xc1d5('0x36')](_0x503723[_0xc1d5('0x35')]);_0x546a1c[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x546a1c[_0xc1d5('0x34')],_0x546a1c[_0xc1d5('0x35')]);_0xd22a28[_0xc1d5('0x39')]=_['intersection'](_0x546a1c[_0xc1d5('0x34')],qs['fields'](_0x503723['query'][_0xc1d5('0x3a')]));_0xd22a28[_0xc1d5('0x39')]=_0xd22a28[_0xc1d5('0x39')]['length']?_0xd22a28[_0xc1d5('0x39')]:_0x546a1c[_0xc1d5('0x34')];if(!_0x503723[_0xc1d5('0x35')][_0xc1d5('0x3b')](_0xc1d5('0x3c'))){_0xd22a28['limit']=qs[_0xc1d5('0x21')](_0x503723[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0xd22a28[_0xc1d5('0x20')]=qs['offset'](_0x503723['query'][_0xc1d5('0x20')]);}_0xd22a28[_0xc1d5('0x3d')]=qs[_0xc1d5('0x3e')](_0x503723['query']['sort']);_0xd22a28[_0xc1d5('0x3f')]=qs['filters'](_['pick'](_0x503723['query'],_0x546a1c[_0xc1d5('0x37')]),_0x429a4b);if(_0x503723[_0xc1d5('0x35')][_0xc1d5('0x40')]){_0xd22a28[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0xd22a28[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x429a4b,function(_0x56181d){if(_0x56181d[_0xc1d5('0x42')]!==_0xc1d5('0x43')){var _0x5c30aa={};_0x5c30aa[_0x56181d[_0xc1d5('0x2f')]]={'$like':'%'+_0x503723[_0xc1d5('0x35')]['filter']+'%'};return _0x5c30aa;}})});}_0xd22a28=_['merge']({},_0xd22a28,_0x503723[_0xc1d5('0x44')]);var _0x7169c2={'where':_0xd22a28[_0xc1d5('0x3f')]};return db[_0xc1d5('0x31')]['count'](_0x7169c2)[_0xc1d5('0x28')](function(_0x5ad722){_0xd6b2a4[_0xc1d5('0x1f')]=_0x5ad722;if(_0x503723[_0xc1d5('0x35')]['includeAll']){_0xd22a28[_0xc1d5('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0xc1d5('0x46')](_0xd22a28);})[_0xc1d5('0x28')](function(_0x190f37){_0xd6b2a4[_0xc1d5('0x47')]=_0x190f37;return _0xd6b2a4;})[_0xc1d5('0x28')](respondWithFilteredResult(_0x4ac338,_0xd22a28))['catch'](handleError(_0x4ac338,null));};exports[_0xc1d5('0x48')]=function(_0x1f734e,_0x5ef2a7){var _0xa83078={'raw':!![],'where':{'id':_0x1f734e[_0xc1d5('0x49')]['id']}},_0x262b39={};_0x262b39[_0xc1d5('0x34')]=_['keys'](db['MailQueue'][_0xc1d5('0x32')]);_0x262b39[_0xc1d5('0x35')]=_['keys'](_0x1f734e[_0xc1d5('0x35')]);_0x262b39[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x262b39[_0xc1d5('0x34')],_0x262b39['query']);_0xa83078[_0xc1d5('0x39')]=_['intersection'](_0x262b39[_0xc1d5('0x34')],qs['fields'](_0x1f734e[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0xa83078[_0xc1d5('0x39')]=_0xa83078[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0xa83078[_0xc1d5('0x39')]:_0x262b39[_0xc1d5('0x34')];if(_0x1f734e[_0xc1d5('0x35')][_0xc1d5('0x4b')]){_0xa83078[_0xc1d5('0x45')]=[{'all':!![]}];}_0xa83078=_[_0xc1d5('0x41')]({},_0xa83078,_0x1f734e['options']);return db['MailQueue'][_0xc1d5('0x4c')](_0xa83078)[_0xc1d5('0x28')](handleEntityNotFound(_0x5ef2a7,null))['then'](respondWithResult(_0x5ef2a7,null))[_0xc1d5('0x4d')](handleError(_0x5ef2a7,null));};exports[_0xc1d5('0x4e')]=function(_0x2c3246,_0x40f9bd){return db[_0xc1d5('0x31')][_0xc1d5('0x4e')](_0x2c3246[_0xc1d5('0x4f')],{})[_0xc1d5('0x28')](function(_0x4d4820){var _0xe8970e=_0x2c3246['user'][_0xc1d5('0x29')]({'plain':!![]});if(!_0xe8970e)throw new Error(_0xc1d5('0x50'));if(_0xe8970e[_0xc1d5('0x51')]===_0xc1d5('0x52')){var _0xe508c7=_0x4d4820['get']({'plain':!![]});var _0x3b7eb2=_0xc1d5('0x2a');return db[_0xc1d5('0x53')][_0xc1d5('0x4c')]({'where':{'name':_0x3b7eb2,'userProfileId':_0xe8970e[_0xc1d5('0x54')]},'raw':!![]})[_0xc1d5('0x28')](function(_0x1a16c2){if(_0x1a16c2&&_0x1a16c2[_0xc1d5('0x55')]===0x0){return db[_0xc1d5('0x2b')][_0xc1d5('0x4e')]({'name':_0xe508c7[_0xc1d5('0x2f')],'resourceId':_0xe508c7['id'],'type':_0x1a16c2[_0xc1d5('0x2f')],'sectionId':_0x1a16c2['id']},{})[_0xc1d5('0x28')](function(){return _0x4d4820;});}else{return _0x4d4820;}})[_0xc1d5('0x4d')](function(_0x398c78){logger[_0xc1d5('0x2d')](_0xc1d5('0x56'),_0x398c78);throw _0x398c78;});}return _0x4d4820;})['then'](respondWithResult(_0x40f9bd,0xc9))[_0xc1d5('0x4d')](handleError(_0x40f9bd,null));};exports['update']=function(_0xbeb711,_0x3c575f){if(_0xbeb711[_0xc1d5('0x4f')]['id']){delete _0xbeb711[_0xc1d5('0x4f')]['id'];}return db[_0xc1d5('0x31')]['find']({'where':{'id':_0xbeb711[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x3c575f,null))[_0xc1d5('0x28')](saveUpdates(_0xbeb711[_0xc1d5('0x4f')],null))[_0xc1d5('0x28')](respondWithResult(_0x3c575f,null))[_0xc1d5('0x4d')](handleError(_0x3c575f,null));};exports['destroy']=function(_0x5ad6ea,_0x57ae57){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x5ad6ea[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x57ae57,null))[_0xc1d5('0x28')](removeEntity(_0x57ae57,null))[_0xc1d5('0x4d')](handleError(_0x57ae57,null));};exports[_0xc1d5('0x57')]=function(_0x241bf9,_0x5d962b){return db[_0xc1d5('0x31')][_0xc1d5('0x57')]()[_0xc1d5('0x28')](respondWithResult(_0x5d962b,null))[_0xc1d5('0x4d')](handleError(_0x5d962b,null));};exports['getMembers']=function(_0x553333,_0x1ba331,_0x451598){var _0x196588={'raw':!![],'where':{}},_0x15b9db={},_0x28cdc8;return db[_0xc1d5('0x31')][_0xc1d5('0x58')]({'where':{'id':_0x553333['params']['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x1ba331,null))[_0xc1d5('0x28')](function(_0x20205a){if(_0x20205a){_0x28cdc8=_0x20205a[_0xc1d5('0x29')]({'plain':!![]});_0x15b9db[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db[_0xc1d5('0x59')]['rawAttributes']);_0x15b9db[_0xc1d5('0x35')]=_[_0xc1d5('0x36')](_0x553333[_0xc1d5('0x35')]);_0x15b9db[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x15b9db[_0xc1d5('0x34')],_0x15b9db[_0xc1d5('0x35')]);_0x196588[_0xc1d5('0x39')]=_[_0xc1d5('0x38')](_0x15b9db['model'],qs[_0xc1d5('0x3a')](_0x553333[_0xc1d5('0x35')]['fields']));_0x196588[_0xc1d5('0x39')]=_0x196588[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0x196588['attributes']:_0x15b9db['model'];if(!_0x553333[_0xc1d5('0x35')][_0xc1d5('0x3b')]('nolimit')){_0x196588[_0xc1d5('0x21')]=qs[_0xc1d5('0x21')](_0x553333[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0x196588[_0xc1d5('0x20')]=qs[_0xc1d5('0x20')](_0x553333[_0xc1d5('0x35')][_0xc1d5('0x20')]);}_0x196588['order']=qs[_0xc1d5('0x3e')](_0x553333[_0xc1d5('0x35')]['sort']);_0x196588[_0xc1d5('0x3f')]=qs[_0xc1d5('0x37')](_['pick'](_0x553333[_0xc1d5('0x35')],_0x15b9db['filters']));_0x196588[_0xc1d5('0x3f')][_0xc1d5('0x5a')]=_0x20205a['id'];if(_0x553333['query'][_0xc1d5('0x40')]){_0x196588[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x196588[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x196588['attributes'],function(_0xdf6305){var _0x1db59b={};_0x1db59b[_0xdf6305]={'$like':'%'+_0x553333[_0xc1d5('0x35')]['filter']+'%'};return _0x1db59b;})});}_0x196588=_[_0xc1d5('0x41')]({},_0x196588,_0x553333[_0xc1d5('0x44')]);return db[_0xc1d5('0x59')][_0xc1d5('0x46')](_0x196588);}})[_0xc1d5('0x28')](function(_0x3ead8a){if(_0x3ead8a){return db[_0xc1d5('0x5b')][_0xc1d5('0x5c')]({'where':{'id':_[_0xc1d5('0x30')](_0x3ead8a,_0xc1d5('0x5d')),'role':'agent'},'attributes':['id','name',_0xc1d5('0x5e'),_0xc1d5('0x5f'),_0xc1d5('0x60')]});}})[_0xc1d5('0x28')](function(_0x12493e){if(_0x12493e){return{'count':_0x12493e[_0xc1d5('0x1f')],'rows':_[_0xc1d5('0x30')](_0x12493e[_0xc1d5('0x47')],function(_0x4cc52e){return{'membername':_0x4cc52e[_0xc1d5('0x2f')],'UserId':_0x4cc52e['id'],'queue_name':_0x28cdc8[_0xc1d5('0x2f')],'MailQueueId':_0x28cdc8['id'],'interface':util['format'](_0xc1d5('0x61'),_0xc1d5('0x62'),_0x4cc52e[_0xc1d5('0x2f')]),'penalty':0x0,'paused':_0x4cc52e[_0xc1d5('0x5e')],'createdAt':_0x4cc52e[_0xc1d5('0x60')],'updatedAt':_0x4cc52e[_0xc1d5('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc1d5('0x28')](respondWithFilteredResult(_0x1ba331,_0x196588))['catch'](handleError(_0x1ba331,null));};exports[_0xc1d5('0x63')]=function(_0x2d5673,_0x3df56b,_0x166154){var _0x119cf5={};var _0x1256bd={};var _0x1a0c12;var _0x349853;return db[_0xc1d5('0x31')]['findOne']({'where':{'id':_0x2d5673[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x3df56b,null))['then'](function(_0x2e41c8){if(_0x2e41c8){_0x1a0c12=_0x2e41c8;_0x1256bd[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db['Team']['rawAttributes']);_0x1256bd[_0xc1d5('0x35')]=_['keys'](_0x2d5673[_0xc1d5('0x35')]);_0x1256bd[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x1256bd[_0xc1d5('0x34')],_0x1256bd['query']);_0x119cf5[_0xc1d5('0x39')]=_[_0xc1d5('0x38')](_0x1256bd[_0xc1d5('0x34')],qs[_0xc1d5('0x3a')](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0x119cf5[_0xc1d5('0x39')]=_0x119cf5['attributes']['length']?_0x119cf5[_0xc1d5('0x39')]:_0x1256bd[_0xc1d5('0x34')];_0x119cf5[_0xc1d5('0x3d')]=qs['sort'](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3e')]);_0x119cf5[_0xc1d5('0x3f')]=qs[_0xc1d5('0x37')](_[_0xc1d5('0x64')](_0x2d5673[_0xc1d5('0x35')],_0x1256bd[_0xc1d5('0x37')]));if(_0x2d5673[_0xc1d5('0x35')]['filter']){_0x119cf5[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x119cf5[_0xc1d5('0x3f')],{'$or':_[_0xc1d5('0x30')](_0x119cf5[_0xc1d5('0x39')],function(_0x352206){var _0x5aa120={};_0x5aa120[_0x352206]={'$like':'%'+_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x40')]+'%'};return _0x5aa120;})});}_0x119cf5=_[_0xc1d5('0x41')]({},_0x119cf5,_0x2d5673['options']);return _0x1a0c12['getTeams'](_0x119cf5);}})[_0xc1d5('0x28')](function(_0x28f51f){if(_0x28f51f){_0x349853=_0x28f51f[_0xc1d5('0x4a')];if(!_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x3b')](_0xc1d5('0x3c'))){_0x119cf5[_0xc1d5('0x21')]=qs['limit'](_0x2d5673['query'][_0xc1d5('0x21')]);_0x119cf5[_0xc1d5('0x20')]=qs['offset'](_0x2d5673[_0xc1d5('0x35')][_0xc1d5('0x20')]);}return _0x1a0c12['getTeams'](_0x119cf5);}})[_0xc1d5('0x28')](function(_0x4d1735){if(_0x4d1735){return _0x4d1735?{'count':_0x349853,'rows':_0x4d1735}:null;}})['then'](respondWithResult(_0x3df56b,null))['catch'](handleError(_0x3df56b,null));};exports[_0xc1d5('0x65')]=function(_0x516e04,_0xa5a878,_0x4dac79){var _0x1f5ce2=_0x516e04[_0xc1d5('0x4f')]['ids'];return db[_0xc1d5('0x66')][_0xc1d5('0x46')]({'where':{'id':_0x1f5ce2},'attributes':['id'],'include':[{'model':db[_0xc1d5('0x5b')],'as':_0xc1d5('0x67'),'attributes':['id',_0xc1d5('0x2f'),_0xc1d5('0x68'),_0xc1d5('0x69'),_0xc1d5('0x6a')],'raw':!![]}]})[_0xc1d5('0x28')](function(_0x724d76){if(_0x724d76){var _0x45ee64=_['flatMap'](_0x724d76,function(_0x7fc2ff){var _0x2e0a9c=_0x7fc2ff[_0xc1d5('0x29')]({'plain':!![]});return _0x2e0a9c[_0xc1d5('0x67')];});return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x516e04[_0xc1d5('0x49')]['id']}})['then'](function(_0x5dad33){return db['sequelize'][_0xc1d5('0x6b')](function(_0xa5cba2){return _0x5dad33[_0xc1d5('0x65')](_0x1f5ce2,{'transaction':_0xa5cba2})[_0xc1d5('0x28')](function(){return BPromise[_0xc1d5('0x6c')](_0x45ee64,function(_0x572bcc){return db[_0xc1d5('0x59')][_0xc1d5('0x6d')]({'where':{'UserId':_0x572bcc['id'],'MailQueueId':_0x516e04[_0xc1d5('0x49')]['id']},'transaction':_0xa5cba2});});})[_0xc1d5('0x28')](function(){_0x45ee64['forEach'](function(_0x7ddc3b){socket[_0xc1d5('0x6e')](_0xc1d5('0x6f'),{'UserId':_0x7ddc3b['id'],'MailQueueId':_0x5dad33['id']});});});});});}})[_0xc1d5('0x28')](respondWithStatusCode(_0xa5a878,null))[_0xc1d5('0x4d')](handleError(_0xa5a878,null));};exports[_0xc1d5('0x70')]=function(_0x4994e1,_0x3da3ab,_0x11cc6c){return db[_0xc1d5('0x66')][_0xc1d5('0x46')]({'where':{'id':_0x4994e1[_0xc1d5('0x35')][_0xc1d5('0x71')]},'attributes':['id'],'include':[{'model':db[_0xc1d5('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc1d5('0x28')](handleEntityNotFound(_0x3da3ab,null))[_0xc1d5('0x28')](function(_0x203288){var _0xc7d7d0=_['map'](_0x203288,'id');var _0x101fcd=[];var _0x29d7ac=[];var _0x2dd8c5=squel['select']();_0x2dd8c5['field'](_0xc1d5('0x72'))[_0xc1d5('0x73')]('team_has_mail_queues','tq')[_0xc1d5('0x74')]('user_has_teams','ut',_0xc1d5('0x75'))[_0xc1d5('0x3f')](_0xc1d5('0x76'),_0x4994e1[_0xc1d5('0x49')]['id']);for(var _0x301aa0=0x0;_0x301aa0<_0x203288[_0xc1d5('0x4a')];_0x301aa0+=0x1){let _0x308013=_0x203288[_0x301aa0];for(var _0x3005ee=0x0;_0x3005ee<_0x308013[_0xc1d5('0x67')][_0xc1d5('0x4a')];_0x3005ee+=0x1){let _0xfc5b1=_0x308013[_0xc1d5('0x67')][_0x3005ee];var _0x4f6142=_0x2dd8c5[_0xc1d5('0x77')]();_0x4f6142[_0xc1d5('0x3f')](_0xc1d5('0x78'),_0xfc5b1['id']);_0x29d7ac[_0xc1d5('0x79')](db[_0xc1d5('0x7a')][_0xc1d5('0x35')](_0x4f6142['toString'](),{'type':db[_0xc1d5('0x7a')][_0xc1d5('0x7b')]['SELECT']})[_0xc1d5('0x28')](function(_0x2376b8){if(_0x2376b8[_0xc1d5('0x4a')]===0x1){return _0xfc5b1['id'];}else{var _0x22029e=_[_0xc1d5('0x7c')](_[_0xc1d5('0x30')](_0x2376b8,'TeamId'),function(_0x16ffd3){return _[_0xc1d5('0x7d')](_0xc7d7d0,_0x16ffd3);});if(_0x22029e){return _0xfc5b1['id'];}}}));}}return BPromise[_0xc1d5('0x7e')](_0x29d7ac)[_0xc1d5('0x28')](function(_0x5e8728){_0x101fcd=_(_0x101fcd)[_0xc1d5('0x7f')](_0x5e8728)[_0xc1d5('0x80')]()[_0xc1d5('0x81')]();return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x4994e1[_0xc1d5('0x49')]['id']}})['then'](function(_0xe032c5){return db[_0xc1d5('0x7a')][_0xc1d5('0x6b')](function(_0x11018f){return _0xe032c5[_0xc1d5('0x70')](_0x4994e1[_0xc1d5('0x35')][_0xc1d5('0x71')],{'transaction':_0x11018f})['then'](function(){if(!_[_0xc1d5('0x82')](_0x101fcd)){return _0xe032c5['removeAgents'](_0x101fcd,{'transaction':_0x11018f});}})[_0xc1d5('0x28')](function(){_0x101fcd[_0xc1d5('0x83')](function(_0x2af9c0){socket[_0xc1d5('0x6e')](_0xc1d5('0x84'),{'UserId':_0x2af9c0,'MailQueueId':_0xe032c5['id']});});});});});});})['then'](respondWithStatusCode(_0x3da3ab,null))[_0xc1d5('0x4d')](handleError(_0x3da3ab,null));};exports['addAgents']=function(_0x2f26c3,_0x4db88d,_0x55e854){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x2f26c3[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x4db88d,null))[_0xc1d5('0x28')](function(_0x4fb54f){if(_0x4fb54f){return _0x4fb54f['addAgents'](_0x2f26c3['body'][_0xc1d5('0x71')],_[_0xc1d5('0x85')](_0x2f26c3[_0xc1d5('0x4f')],['ids','id'])||{})[_0xc1d5('0x86')](function(_0x758b73){for(var _0x131185=0x0;_0x131185<_0x2f26c3[_0xc1d5('0x4f')][_0xc1d5('0x71')][_0xc1d5('0x4a')];_0x131185+=0x1){socket[_0xc1d5('0x6e')](_0xc1d5('0x6f'),{'UserId':Number(_0x2f26c3[_0xc1d5('0x4f')][_0xc1d5('0x71')][_0x131185]),'MailQueueId':Number(_0x2f26c3['params']['id'])});}return _0x758b73;});}})[_0xc1d5('0x28')](respondWithResult(_0x4db88d,null))['catch'](handleError(_0x4db88d,null));};exports[_0xc1d5('0x87')]=function(_0x5af7df,_0x4be978,_0x3a7c81){return db[_0xc1d5('0x31')][_0xc1d5('0x4c')]({'where':{'id':_0x5af7df[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x4be978,null))[_0xc1d5('0x28')](function(_0xdfe16e){if(_0xdfe16e){return _0xdfe16e['removeAgents'](_0x5af7df[_0xc1d5('0x35')]['ids'])[_0xc1d5('0x28')](function(){if(_[_0xc1d5('0x88')](_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')])){for(var _0x41d4c7=0x0;_0x41d4c7<_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')][_0xc1d5('0x4a')];_0x41d4c7+=0x1){socket['emit'](_0xc1d5('0x84'),{'UserId':Number(_0x5af7df[_0xc1d5('0x35')]['ids'][_0x41d4c7]),'MailQueueId':Number(_0x5af7df['params']['id'])});}}else{socket['emit'](_0xc1d5('0x84'),{'UserId':Number(_0x5af7df[_0xc1d5('0x35')][_0xc1d5('0x71')]),'MailQueueId':Number(_0x5af7df['params']['id'])});}});}})[_0xc1d5('0x28')](respondWithStatusCode(_0x4be978,null))[_0xc1d5('0x4d')](handleError(_0x4be978,null));};exports[_0xc1d5('0x89')]=function(_0x5d545c,_0x5dba28,_0x1c33e4){var _0x5bcc47={};var _0x292ea7={};var _0x32f279;var _0x4bff97;return db[_0xc1d5('0x31')][_0xc1d5('0x58')]({'where':{'id':_0x5d545c[_0xc1d5('0x49')]['id']}})[_0xc1d5('0x28')](handleEntityNotFound(_0x5dba28,null))['then'](function(_0x423cea){if(_0x423cea){_0x32f279=_0x423cea;_0x292ea7[_0xc1d5('0x34')]=_[_0xc1d5('0x36')](db['User']['rawAttributes']);_0x292ea7[_0xc1d5('0x35')]=_['keys'](_0x5d545c[_0xc1d5('0x35')]);_0x292ea7[_0xc1d5('0x37')]=_[_0xc1d5('0x38')](_0x292ea7[_0xc1d5('0x34')],_0x292ea7['query']);_0x5bcc47[_0xc1d5('0x39')]=_['intersection'](_0x292ea7[_0xc1d5('0x34')],qs[_0xc1d5('0x3a')](_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x3a')]));_0x5bcc47[_0xc1d5('0x39')]=_0x5bcc47[_0xc1d5('0x39')][_0xc1d5('0x4a')]?_0x5bcc47[_0xc1d5('0x39')]:_0x292ea7[_0xc1d5('0x34')];_0x5bcc47[_0xc1d5('0x3d')]=qs['sort'](_0x5d545c['query'][_0xc1d5('0x3e')]);_0x5bcc47[_0xc1d5('0x3f')]=qs['filters'](_['pick'](_0x5d545c[_0xc1d5('0x35')],_0x292ea7[_0xc1d5('0x37')]));if(_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x40')]){_0x5bcc47[_0xc1d5('0x3f')]=_[_0xc1d5('0x41')](_0x5bcc47['where'],{'$or':_[_0xc1d5('0x30')](_0x5bcc47[_0xc1d5('0x39')],function(_0x7bf23c){var _0x2e7f8f={};_0x2e7f8f[_0x7bf23c]={'$like':'%'+_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x40')]+'%'};return _0x2e7f8f;})});}_0x5bcc47=_['merge']({},_0x5bcc47,_0x5d545c[_0xc1d5('0x44')]);return _0x32f279[_0xc1d5('0x89')](_0x5bcc47);}})[_0xc1d5('0x28')](function(_0x2cde2b){if(_0x2cde2b){_0x4bff97=_0x2cde2b[_0xc1d5('0x4a')];if(!_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x3b')]('nolimit')){_0x5bcc47[_0xc1d5('0x21')]=qs[_0xc1d5('0x21')](_0x5d545c[_0xc1d5('0x35')][_0xc1d5('0x21')]);_0x5bcc47['offset']=qs['offset'](_0x5d545c[_0xc1d5('0x35')]['offset']);}return _0x32f279[_0xc1d5('0x89')](_0x5bcc47);}})[_0xc1d5('0x28')](function(_0x1b4f13){if(_0x1b4f13){return _0x1b4f13?{'count':_0x4bff97,'rows':_0x1b4f13}:null;}})[_0xc1d5('0x28')](respondWithResult(_0x5dba28,null))[_0xc1d5('0x4d')](handleError(_0x5dba28,null));}; \ No newline at end of file +var _0xe4f6=['removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./mailQueue.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','index','map','MailQueue','rawAttributes','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserMailQueue','hasOwnProperty','nolimit','pick','MailQueueId','findAll','User','UserId','agent','createdAt','rows','format','%s/%s','mailPause','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact'];(function(_0x80cf0b,_0x526c62){var _0x13c8c6=function(_0xa9ad34){while(--_0xa9ad34){_0x80cf0b['push'](_0x80cf0b['shift']());}};_0x13c8c6(++_0x526c62);}(_0xe4f6,0x195));var _0x6e4f=function(_0x48b22a,_0x45a587){_0x48b22a=_0x48b22a-0x0;var _0x506193=_0xe4f6[_0x48b22a];return _0x506193;};'use strict';var emlformat=require(_0x6e4f('0x0'));var rimraf=require(_0x6e4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e4f('0x2'));var rp=require(_0x6e4f('0x3'));var moment=require('moment');var BPromise=require(_0x6e4f('0x4'));var Mustache=require(_0x6e4f('0x5'));var util=require(_0x6e4f('0x6'));var path=require(_0x6e4f('0x7'));var sox=require('sox');var csv=require(_0x6e4f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e4f('0x9'));var _=require(_0x6e4f('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6e4f('0xb'));var deskjs=require(_0x6e4f('0xc'));var toCsv=require(_0x6e4f('0x8'));var querystring=require(_0x6e4f('0xd'));var Papa=require('papaparse');var Redis=require(_0x6e4f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6e4f('0xf'));var as=require(_0x6e4f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e4f('0x11'))('api');var utils=require(_0x6e4f('0x12'));var config=require(_0x6e4f('0x13'));var licenseUtil=require(_0x6e4f('0x14'));var db=require(_0x6e4f('0x15'))['db'];config[_0x6e4f('0x16')]=_[_0x6e4f('0x17')](config[_0x6e4f('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x6e4f('0x18'))(new Redis(config['redis']));require(_0x6e4f('0x19'))[_0x6e4f('0x1a')](socket);function respondWithStatusCode(_0x2a2fd8,_0x179143){_0x179143=_0x179143||0xcc;return function(_0x5bb1ab){if(_0x5bb1ab){return _0x2a2fd8['sendStatus'](_0x179143);}return _0x2a2fd8[_0x6e4f('0x1b')](_0x179143)[_0x6e4f('0x1c')]();};}function respondWithResult(_0x3bc1cc,_0x5467f9){_0x5467f9=_0x5467f9||0xc8;return function(_0x4f9931){if(_0x4f9931){return _0x3bc1cc['status'](_0x5467f9)[_0x6e4f('0x1d')](_0x4f9931);}};}function respondWithFilteredResult(_0x424b63,_0x239738){return function(_0x777940){if(_0x777940){var _0x1e2400=typeof _0x239738['offset']===_0x6e4f('0x1e')&&typeof _0x239738[_0x6e4f('0x1f')]===_0x6e4f('0x1e');var _0xc52741=_0x777940[_0x6e4f('0x20')];var _0x4958e4=_0x1e2400?0x0:_0x239738[_0x6e4f('0x21')];var _0x179a97=_0x1e2400?_0x777940[_0x6e4f('0x20')]:_0x239738[_0x6e4f('0x21')]+_0x239738[_0x6e4f('0x1f')];var _0x57ad34;if(_0x179a97>=_0xc52741){_0x179a97=_0xc52741;_0x57ad34=0xc8;}else{_0x57ad34=0xce;}_0x424b63[_0x6e4f('0x1b')](_0x57ad34);return _0x424b63['set'](_0x6e4f('0x22'),_0x4958e4+'-'+_0x179a97+'/'+_0xc52741)['json'](_0x777940);}return null;};}function patchUpdates(_0x225ad6){return function(_0x59eb7c){try{jsonpatch['apply'](_0x59eb7c,_0x225ad6,!![]);}catch(_0x4f4afb){return BPromise[_0x6e4f('0x23')](_0x4f4afb);}return _0x59eb7c[_0x6e4f('0x24')]();};}function saveUpdates(_0x2d330c,_0x142f95){return function(_0xf2dd06){if(_0xf2dd06){return _0xf2dd06['update'](_0x2d330c)[_0x6e4f('0x25')](function(_0xc5c50e){return _0xc5c50e;});}return null;};}function removeEntity(_0x59da73,_0x303f3b){return function(_0x524fa4){if(_0x524fa4){return _0x524fa4['destroy']()[_0x6e4f('0x25')](function(){var _0x547e5d=_0x524fa4[_0x6e4f('0x26')]({'plain':!![]});var _0x2468d3=_0x6e4f('0x27');return db[_0x6e4f('0x28')][_0x6e4f('0x29')]({'where':{'type':_0x2468d3,'resourceId':_0x547e5d['id']}})[_0x6e4f('0x25')](function(){return _0x524fa4;});})[_0x6e4f('0x25')](function(){_0x59da73['status'](0xcc)[_0x6e4f('0x1c')]();});}};}function handleEntityNotFound(_0x52477c,_0x13f022){return function(_0x2e7976){if(!_0x2e7976){_0x52477c['sendStatus'](0x194);}return _0x2e7976;};}function handleError(_0x3b28da,_0x355e83){_0x355e83=_0x355e83||0x1f4;return function(_0xf365cd){logger[_0x6e4f('0x2a')](_0xf365cd[_0x6e4f('0x2b')]);if(_0xf365cd[_0x6e4f('0x2c')]){delete _0xf365cd['name'];}_0x3b28da[_0x6e4f('0x1b')](_0x355e83)['send'](_0xf365cd);};}exports[_0x6e4f('0x2d')]=function(_0x398b83,_0xc6b877){var _0x43a854={},_0xc1d2be={},_0x1c751e={'count':0x0,'rows':[]};var _0x558f6e=_[_0x6e4f('0x2e')](db[_0x6e4f('0x2f')][_0x6e4f('0x30')],function(_0x5555ca){return{'name':_0x5555ca['fieldName'],'type':_0x5555ca[_0x6e4f('0x31')]['key']};});_0xc1d2be['model']=_[_0x6e4f('0x2e')](_0x558f6e,_0x6e4f('0x2c'));_0xc1d2be[_0x6e4f('0x32')]=_[_0x6e4f('0x33')](_0x398b83['query']);_0xc1d2be[_0x6e4f('0x34')]=_[_0x6e4f('0x35')](_0xc1d2be[_0x6e4f('0x36')],_0xc1d2be['query']);_0x43a854['attributes']=_['intersection'](_0xc1d2be[_0x6e4f('0x36')],qs[_0x6e4f('0x37')](_0x398b83[_0x6e4f('0x32')][_0x6e4f('0x37')]));_0x43a854[_0x6e4f('0x38')]=_0x43a854[_0x6e4f('0x38')][_0x6e4f('0x39')]?_0x43a854[_0x6e4f('0x38')]:_0xc1d2be[_0x6e4f('0x36')];if(!_0x398b83[_0x6e4f('0x32')]['hasOwnProperty']('nolimit')){_0x43a854[_0x6e4f('0x1f')]=qs['limit'](_0x398b83[_0x6e4f('0x32')][_0x6e4f('0x1f')]);_0x43a854[_0x6e4f('0x21')]=qs['offset'](_0x398b83[_0x6e4f('0x32')]['offset']);}_0x43a854[_0x6e4f('0x3a')]=qs[_0x6e4f('0x3b')](_0x398b83['query'][_0x6e4f('0x3b')]);_0x43a854[_0x6e4f('0x3c')]=qs['filters'](_['pick'](_0x398b83[_0x6e4f('0x32')],_0xc1d2be[_0x6e4f('0x34')]),_0x558f6e);if(_0x398b83['query'][_0x6e4f('0x3d')]){_0x43a854['where']=_[_0x6e4f('0x3e')](_0x43a854[_0x6e4f('0x3c')],{'$or':_[_0x6e4f('0x2e')](_0x558f6e,function(_0x5fd007){if(_0x5fd007[_0x6e4f('0x31')]!==_0x6e4f('0x3f')){var _0x58d4e8={};_0x58d4e8[_0x5fd007[_0x6e4f('0x2c')]]={'$like':'%'+_0x398b83[_0x6e4f('0x32')][_0x6e4f('0x3d')]+'%'};return _0x58d4e8;}})});}_0x43a854=_[_0x6e4f('0x3e')]({},_0x43a854,_0x398b83[_0x6e4f('0x40')]);var _0xb58654={'where':_0x43a854['where']};return db[_0x6e4f('0x2f')][_0x6e4f('0x20')](_0xb58654)[_0x6e4f('0x25')](function(_0x26855b){_0x1c751e[_0x6e4f('0x20')]=_0x26855b;if(_0x398b83[_0x6e4f('0x32')][_0x6e4f('0x41')]){_0x43a854['include']=[{'all':!![]}];}return db[_0x6e4f('0x2f')]['findAll'](_0x43a854);})[_0x6e4f('0x25')](function(_0x5711b9){_0x1c751e['rows']=_0x5711b9;return _0x1c751e;})[_0x6e4f('0x25')](respondWithFilteredResult(_0xc6b877,_0x43a854))[_0x6e4f('0x42')](handleError(_0xc6b877,null));};exports[_0x6e4f('0x43')]=function(_0x136e7b,_0x1825ab){var _0x4125e7={'raw':!![],'where':{'id':_0x136e7b[_0x6e4f('0x44')]['id']}},_0x20b6d5={};_0x20b6d5['model']=_[_0x6e4f('0x33')](db[_0x6e4f('0x2f')][_0x6e4f('0x30')]);_0x20b6d5[_0x6e4f('0x32')]=_[_0x6e4f('0x33')](_0x136e7b[_0x6e4f('0x32')]);_0x20b6d5['filters']=_[_0x6e4f('0x35')](_0x20b6d5[_0x6e4f('0x36')],_0x20b6d5[_0x6e4f('0x32')]);_0x4125e7[_0x6e4f('0x38')]=_[_0x6e4f('0x35')](_0x20b6d5[_0x6e4f('0x36')],qs[_0x6e4f('0x37')](_0x136e7b[_0x6e4f('0x32')][_0x6e4f('0x37')]));_0x4125e7[_0x6e4f('0x38')]=_0x4125e7[_0x6e4f('0x38')][_0x6e4f('0x39')]?_0x4125e7[_0x6e4f('0x38')]:_0x20b6d5[_0x6e4f('0x36')];if(_0x136e7b[_0x6e4f('0x32')][_0x6e4f('0x41')]){_0x4125e7[_0x6e4f('0x45')]=[{'all':!![]}];}_0x4125e7=_[_0x6e4f('0x3e')]({},_0x4125e7,_0x136e7b[_0x6e4f('0x40')]);return db[_0x6e4f('0x2f')][_0x6e4f('0x46')](_0x4125e7)[_0x6e4f('0x25')](handleEntityNotFound(_0x1825ab,null))['then'](respondWithResult(_0x1825ab,null))[_0x6e4f('0x42')](handleError(_0x1825ab,null));};exports[_0x6e4f('0x47')]=function(_0x933a77,_0x369506){return db['MailQueue']['create'](_0x933a77[_0x6e4f('0x48')],{})['then'](function(_0x277bfe){var _0x3a996d=_0x933a77[_0x6e4f('0x49')]['get']({'plain':!![]});if(!_0x3a996d)throw new Error(_0x6e4f('0x4a'));if(_0x3a996d[_0x6e4f('0x4b')]===_0x6e4f('0x49')){var _0xf9ee83=_0x277bfe[_0x6e4f('0x26')]({'plain':!![]});var _0x293874=_0x6e4f('0x27');return db[_0x6e4f('0x4c')]['find']({'where':{'name':_0x293874,'userProfileId':_0x3a996d[_0x6e4f('0x4d')]},'raw':!![]})[_0x6e4f('0x25')](function(_0x497fa0){if(_0x497fa0&&_0x497fa0['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xf9ee83[_0x6e4f('0x2c')],'resourceId':_0xf9ee83['id'],'type':_0x497fa0['name'],'sectionId':_0x497fa0['id']},{})['then'](function(){return _0x277bfe;});}else{return _0x277bfe;}})[_0x6e4f('0x42')](function(_0x5871cf){logger[_0x6e4f('0x2a')](_0x6e4f('0x4e'),_0x5871cf);throw _0x5871cf;});}return _0x277bfe;})[_0x6e4f('0x25')](respondWithResult(_0x369506,0xc9))[_0x6e4f('0x42')](handleError(_0x369506,null));};exports[_0x6e4f('0x4f')]=function(_0x2d609d,_0xdb0657){if(_0x2d609d[_0x6e4f('0x48')]['id']){delete _0x2d609d[_0x6e4f('0x48')]['id'];}return db[_0x6e4f('0x2f')][_0x6e4f('0x46')]({'where':{'id':_0x2d609d[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0xdb0657,null))[_0x6e4f('0x25')](saveUpdates(_0x2d609d[_0x6e4f('0x48')],null))[_0x6e4f('0x25')](respondWithResult(_0xdb0657,null))['catch'](handleError(_0xdb0657,null));};exports[_0x6e4f('0x29')]=function(_0x4db48b,_0x5cb17a){return db[_0x6e4f('0x2f')][_0x6e4f('0x46')]({'where':{'id':_0x4db48b[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0x5cb17a,null))[_0x6e4f('0x25')](removeEntity(_0x5cb17a,null))[_0x6e4f('0x42')](handleError(_0x5cb17a,null));};exports[_0x6e4f('0x50')]=function(_0x59fa2b,_0x1db923){return db[_0x6e4f('0x2f')][_0x6e4f('0x50')]()[_0x6e4f('0x25')](respondWithResult(_0x1db923,null))[_0x6e4f('0x42')](handleError(_0x1db923,null));};exports['getMembers']=function(_0x58af47,_0x2ca668,_0x46317e){var _0x4a0624={'raw':!![],'where':{}},_0x53d048={},_0x45c4e0;return db[_0x6e4f('0x2f')][_0x6e4f('0x51')]({'where':{'id':_0x58af47[_0x6e4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ca668,null))[_0x6e4f('0x25')](function(_0x4ec488){if(_0x4ec488){_0x45c4e0=_0x4ec488[_0x6e4f('0x26')]({'plain':!![]});_0x53d048['model']=_[_0x6e4f('0x33')](db[_0x6e4f('0x52')][_0x6e4f('0x30')]);_0x53d048['query']=_[_0x6e4f('0x33')](_0x58af47[_0x6e4f('0x32')]);_0x53d048[_0x6e4f('0x34')]=_[_0x6e4f('0x35')](_0x53d048[_0x6e4f('0x36')],_0x53d048[_0x6e4f('0x32')]);_0x4a0624[_0x6e4f('0x38')]=_[_0x6e4f('0x35')](_0x53d048['model'],qs[_0x6e4f('0x37')](_0x58af47[_0x6e4f('0x32')]['fields']));_0x4a0624[_0x6e4f('0x38')]=_0x4a0624['attributes'][_0x6e4f('0x39')]?_0x4a0624['attributes']:_0x53d048['model'];if(!_0x58af47[_0x6e4f('0x32')][_0x6e4f('0x53')](_0x6e4f('0x54'))){_0x4a0624[_0x6e4f('0x1f')]=qs[_0x6e4f('0x1f')](_0x58af47[_0x6e4f('0x32')][_0x6e4f('0x1f')]);_0x4a0624[_0x6e4f('0x21')]=qs[_0x6e4f('0x21')](_0x58af47[_0x6e4f('0x32')]['offset']);}_0x4a0624[_0x6e4f('0x3a')]=qs[_0x6e4f('0x3b')](_0x58af47[_0x6e4f('0x32')][_0x6e4f('0x3b')]);_0x4a0624['where']=qs[_0x6e4f('0x34')](_[_0x6e4f('0x55')](_0x58af47[_0x6e4f('0x32')],_0x53d048[_0x6e4f('0x34')]));_0x4a0624[_0x6e4f('0x3c')][_0x6e4f('0x56')]=_0x4ec488['id'];if(_0x58af47['query'][_0x6e4f('0x3d')]){_0x4a0624['where']=_[_0x6e4f('0x3e')](_0x4a0624[_0x6e4f('0x3c')],{'$or':_[_0x6e4f('0x2e')](_0x4a0624[_0x6e4f('0x38')],function(_0x7cce27){var _0x119799={};_0x119799[_0x7cce27]={'$like':'%'+_0x58af47['query']['filter']+'%'};return _0x119799;})});}_0x4a0624=_[_0x6e4f('0x3e')]({},_0x4a0624,_0x58af47[_0x6e4f('0x40')]);return db[_0x6e4f('0x52')][_0x6e4f('0x57')](_0x4a0624);}})[_0x6e4f('0x25')](function(_0x53c46d){if(_0x53c46d){return db[_0x6e4f('0x58')]['findAndCountAll']({'where':{'id':_[_0x6e4f('0x2e')](_0x53c46d,_0x6e4f('0x59')),'role':_0x6e4f('0x5a')},'attributes':['id',_0x6e4f('0x2c'),'mailPause','updatedAt',_0x6e4f('0x5b')]});}})[_0x6e4f('0x25')](function(_0x3ab965){if(_0x3ab965){return{'count':_0x3ab965[_0x6e4f('0x20')],'rows':_['map'](_0x3ab965[_0x6e4f('0x5c')],function(_0x12322f){return{'membername':_0x12322f[_0x6e4f('0x2c')],'UserId':_0x12322f['id'],'queue_name':_0x45c4e0[_0x6e4f('0x2c')],'MailQueueId':_0x45c4e0['id'],'interface':util[_0x6e4f('0x5d')](_0x6e4f('0x5e'),'SIP',_0x12322f['name']),'penalty':0x0,'paused':_0x12322f[_0x6e4f('0x5f')],'createdAt':_0x12322f[_0x6e4f('0x5b')],'updatedAt':_0x12322f[_0x6e4f('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6e4f('0x25')](respondWithFilteredResult(_0x2ca668,_0x4a0624))[_0x6e4f('0x42')](handleError(_0x2ca668,null));};exports[_0x6e4f('0x61')]=function(_0x366ed0,_0x5cbc94,_0x451009){var _0x428d73={};var _0x33fd74={};var _0x4ac801;var _0x384e70;return db['MailQueue'][_0x6e4f('0x51')]({'where':{'id':_0x366ed0[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0x5cbc94,null))[_0x6e4f('0x25')](function(_0x31a10b){if(_0x31a10b){_0x4ac801=_0x31a10b;_0x33fd74[_0x6e4f('0x36')]=_[_0x6e4f('0x33')](db[_0x6e4f('0x62')][_0x6e4f('0x30')]);_0x33fd74[_0x6e4f('0x32')]=_[_0x6e4f('0x33')](_0x366ed0[_0x6e4f('0x32')]);_0x33fd74[_0x6e4f('0x34')]=_[_0x6e4f('0x35')](_0x33fd74['model'],_0x33fd74[_0x6e4f('0x32')]);_0x428d73['attributes']=_[_0x6e4f('0x35')](_0x33fd74['model'],qs[_0x6e4f('0x37')](_0x366ed0[_0x6e4f('0x32')][_0x6e4f('0x37')]));_0x428d73[_0x6e4f('0x38')]=_0x428d73['attributes'][_0x6e4f('0x39')]?_0x428d73[_0x6e4f('0x38')]:_0x33fd74[_0x6e4f('0x36')];_0x428d73[_0x6e4f('0x3a')]=qs['sort'](_0x366ed0['query'][_0x6e4f('0x3b')]);_0x428d73[_0x6e4f('0x3c')]=qs[_0x6e4f('0x34')](_[_0x6e4f('0x55')](_0x366ed0[_0x6e4f('0x32')],_0x33fd74[_0x6e4f('0x34')]));if(_0x366ed0[_0x6e4f('0x32')][_0x6e4f('0x3d')]){_0x428d73[_0x6e4f('0x3c')]=_['merge'](_0x428d73['where'],{'$or':_[_0x6e4f('0x2e')](_0x428d73[_0x6e4f('0x38')],function(_0x384136){var _0x4435f0={};_0x4435f0[_0x384136]={'$like':'%'+_0x366ed0[_0x6e4f('0x32')]['filter']+'%'};return _0x4435f0;})});}_0x428d73=_['merge']({},_0x428d73,_0x366ed0[_0x6e4f('0x40')]);return _0x4ac801[_0x6e4f('0x61')](_0x428d73);}})['then'](function(_0x26d011){if(_0x26d011){_0x384e70=_0x26d011[_0x6e4f('0x39')];if(!_0x366ed0[_0x6e4f('0x32')][_0x6e4f('0x53')]('nolimit')){_0x428d73['limit']=qs[_0x6e4f('0x1f')](_0x366ed0[_0x6e4f('0x32')]['limit']);_0x428d73[_0x6e4f('0x21')]=qs[_0x6e4f('0x21')](_0x366ed0['query'][_0x6e4f('0x21')]);}return _0x4ac801[_0x6e4f('0x61')](_0x428d73);}})[_0x6e4f('0x25')](function(_0x4fec55){if(_0x4fec55){return _0x4fec55?{'count':_0x384e70,'rows':_0x4fec55}:null;}})['then'](respondWithResult(_0x5cbc94,null))[_0x6e4f('0x42')](handleError(_0x5cbc94,null));};exports[_0x6e4f('0x63')]=function(_0x52b2fd,_0x4608fc,_0x5e900c){var _0x174ace=_0x52b2fd[_0x6e4f('0x48')][_0x6e4f('0x64')];return db['Team'][_0x6e4f('0x57')]({'where':{'id':_0x174ace},'attributes':['id'],'include':[{'model':db[_0x6e4f('0x58')],'as':'Agents','attributes':['id',_0x6e4f('0x2c'),_0x6e4f('0x65'),_0x6e4f('0x66'),_0x6e4f('0x67')],'raw':!![]}]})[_0x6e4f('0x25')](function(_0x1178f3){if(_0x1178f3){var _0x4b3404=_[_0x6e4f('0x68')](_0x1178f3,function(_0x3b74a5){var _0x13a1ff=_0x3b74a5[_0x6e4f('0x26')]({'plain':!![]});return _0x13a1ff[_0x6e4f('0x69')];});return db[_0x6e4f('0x2f')][_0x6e4f('0x46')]({'where':{'id':_0x52b2fd['params']['id']}})[_0x6e4f('0x25')](function(_0xdb2841){return db[_0x6e4f('0x6a')][_0x6e4f('0x6b')](function(_0x3a6011){return _0xdb2841[_0x6e4f('0x63')](_0x174ace,{'transaction':_0x3a6011})[_0x6e4f('0x25')](function(){return BPromise['each'](_0x4b3404,function(_0x36d572){return db[_0x6e4f('0x52')]['findOrCreate']({'where':{'UserId':_0x36d572['id'],'MailQueueId':_0x52b2fd[_0x6e4f('0x44')]['id']},'transaction':_0x3a6011});});})[_0x6e4f('0x25')](function(){_0x4b3404[_0x6e4f('0x6c')](function(_0x3b6b2c){socket[_0x6e4f('0x6d')](_0x6e4f('0x6e'),{'UserId':_0x3b6b2c['id'],'MailQueueId':_0xdb2841['id']});});});});});}})['then'](respondWithStatusCode(_0x4608fc,null))[_0x6e4f('0x42')](handleError(_0x4608fc,null));};exports['removeTeams']=function(_0x4c9ab8,_0x96ee8f,_0x474a4b){return db[_0x6e4f('0x62')][_0x6e4f('0x57')]({'where':{'id':_0x4c9ab8[_0x6e4f('0x32')][_0x6e4f('0x64')]},'attributes':['id'],'include':[{'model':db[_0x6e4f('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6e4f('0x25')](handleEntityNotFound(_0x96ee8f,null))[_0x6e4f('0x25')](function(_0x3cb407){var _0x2fad94=_['map'](_0x3cb407,'id');var _0x405529=[];var _0x508054=[];var _0x760af1=squel[_0x6e4f('0x6f')]();_0x760af1[_0x6e4f('0x70')](_0x6e4f('0x71'))[_0x6e4f('0x72')](_0x6e4f('0x73'),'tq')['join'](_0x6e4f('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6e4f('0x3c')](_0x6e4f('0x75'),_0x4c9ab8[_0x6e4f('0x44')]['id']);for(var _0x2effa1=0x0;_0x2effa1<_0x3cb407[_0x6e4f('0x39')];_0x2effa1+=0x1){let _0xc95b88=_0x3cb407[_0x2effa1];for(var _0x319772=0x0;_0x319772<_0xc95b88[_0x6e4f('0x69')][_0x6e4f('0x39')];_0x319772+=0x1){let _0x434e24=_0xc95b88[_0x6e4f('0x69')][_0x319772];var _0xc758d=_0x760af1[_0x6e4f('0x76')]();_0xc758d['where']('ut.UserId\x20=\x20?',_0x434e24['id']);_0x508054[_0x6e4f('0x77')](db[_0x6e4f('0x6a')][_0x6e4f('0x32')](_0xc758d[_0x6e4f('0x78')](),{'type':db[_0x6e4f('0x6a')][_0x6e4f('0x79')]['SELECT']})[_0x6e4f('0x25')](function(_0x3431a6){if(_0x3431a6[_0x6e4f('0x39')]===0x1){return _0x434e24['id'];}else{var _0x49c2f0=_[_0x6e4f('0x7a')](_[_0x6e4f('0x2e')](_0x3431a6,_0x6e4f('0x7b')),function(_0x33e311){return _[_0x6e4f('0x7c')](_0x2fad94,_0x33e311);});if(_0x49c2f0){return _0x434e24['id'];}}}));}}return BPromise[_0x6e4f('0x7d')](_0x508054)['then'](function(_0xc2fefc){_0x405529=_(_0x405529)['union'](_0xc2fefc)[_0x6e4f('0x7e')]()['value']();return db[_0x6e4f('0x2f')]['find']({'where':{'id':_0x4c9ab8[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](function(_0x15d0f1){return db[_0x6e4f('0x6a')][_0x6e4f('0x6b')](function(_0x1d63e8){return _0x15d0f1['removeTeams'](_0x4c9ab8[_0x6e4f('0x32')]['ids'],{'transaction':_0x1d63e8})[_0x6e4f('0x25')](function(){if(!_['isEmpty'](_0x405529)){return _0x15d0f1[_0x6e4f('0x7f')](_0x405529,{'transaction':_0x1d63e8});}})['then'](function(){_0x405529['forEach'](function(_0x5cae71){socket[_0x6e4f('0x6d')](_0x6e4f('0x80'),{'UserId':_0x5cae71,'MailQueueId':_0x15d0f1['id']});});});});});});})[_0x6e4f('0x25')](respondWithStatusCode(_0x96ee8f,null))[_0x6e4f('0x42')](handleError(_0x96ee8f,null));};exports[_0x6e4f('0x81')]=function(_0x351648,_0x45d7aa,_0x1e49d4){return db[_0x6e4f('0x2f')]['find']({'where':{'id':_0x351648[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0x45d7aa,null))[_0x6e4f('0x25')](function(_0x12e442){if(_0x12e442){return _0x12e442[_0x6e4f('0x81')](_0x351648[_0x6e4f('0x48')][_0x6e4f('0x64')],_[_0x6e4f('0x82')](_0x351648[_0x6e4f('0x48')],[_0x6e4f('0x64'),'id'])||{})[_0x6e4f('0x83')](function(_0x150102){for(var _0x34ca7f=0x0;_0x34ca7f<_0x351648[_0x6e4f('0x48')][_0x6e4f('0x64')]['length'];_0x34ca7f+=0x1){socket[_0x6e4f('0x6d')]('userMailQueue:save',{'UserId':Number(_0x351648[_0x6e4f('0x48')][_0x6e4f('0x64')][_0x34ca7f]),'MailQueueId':Number(_0x351648['params']['id'])});}return _0x150102;});}})[_0x6e4f('0x25')](respondWithResult(_0x45d7aa,null))['catch'](handleError(_0x45d7aa,null));};exports[_0x6e4f('0x7f')]=function(_0x1780f4,_0x4969e1,_0x157061){return db[_0x6e4f('0x2f')][_0x6e4f('0x46')]({'where':{'id':_0x1780f4['params']['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0x4969e1,null))[_0x6e4f('0x25')](function(_0x57f33b){if(_0x57f33b){return _0x57f33b[_0x6e4f('0x7f')](_0x1780f4['query'][_0x6e4f('0x64')])[_0x6e4f('0x25')](function(){if(_['isArray'](_0x1780f4[_0x6e4f('0x32')][_0x6e4f('0x64')])){for(var _0x4762fa=0x0;_0x4762fa<_0x1780f4[_0x6e4f('0x32')][_0x6e4f('0x64')][_0x6e4f('0x39')];_0x4762fa+=0x1){socket[_0x6e4f('0x6d')](_0x6e4f('0x80'),{'UserId':Number(_0x1780f4['query'][_0x6e4f('0x64')][_0x4762fa]),'MailQueueId':Number(_0x1780f4['params']['id'])});}}else{socket[_0x6e4f('0x6d')](_0x6e4f('0x80'),{'UserId':Number(_0x1780f4['query']['ids']),'MailQueueId':Number(_0x1780f4[_0x6e4f('0x44')]['id'])});}});}})[_0x6e4f('0x25')](respondWithStatusCode(_0x4969e1,null))['catch'](handleError(_0x4969e1,null));};exports['getAgents']=function(_0x143eac,_0x4f6d2f,_0x86f789){var _0xe20ce9={};var _0x24cbcd={};var _0x328fad;var _0x3f25e5;return db[_0x6e4f('0x2f')][_0x6e4f('0x51')]({'where':{'id':_0x143eac[_0x6e4f('0x44')]['id']}})[_0x6e4f('0x25')](handleEntityNotFound(_0x4f6d2f,null))[_0x6e4f('0x25')](function(_0x3db013){if(_0x3db013){_0x328fad=_0x3db013;_0x24cbcd['model']=_[_0x6e4f('0x33')](db['User'][_0x6e4f('0x30')]);_0x24cbcd['query']=_['keys'](_0x143eac[_0x6e4f('0x32')]);_0x24cbcd[_0x6e4f('0x34')]=_[_0x6e4f('0x35')](_0x24cbcd[_0x6e4f('0x36')],_0x24cbcd[_0x6e4f('0x32')]);_0xe20ce9[_0x6e4f('0x38')]=_['intersection'](_0x24cbcd[_0x6e4f('0x36')],qs[_0x6e4f('0x37')](_0x143eac[_0x6e4f('0x32')][_0x6e4f('0x37')]));_0xe20ce9[_0x6e4f('0x38')]=_0xe20ce9[_0x6e4f('0x38')]['length']?_0xe20ce9[_0x6e4f('0x38')]:_0x24cbcd[_0x6e4f('0x36')];_0xe20ce9[_0x6e4f('0x3a')]=qs[_0x6e4f('0x3b')](_0x143eac[_0x6e4f('0x32')][_0x6e4f('0x3b')]);_0xe20ce9[_0x6e4f('0x3c')]=qs['filters'](_[_0x6e4f('0x55')](_0x143eac['query'],_0x24cbcd['filters']));if(_0x143eac[_0x6e4f('0x32')][_0x6e4f('0x3d')]){_0xe20ce9[_0x6e4f('0x3c')]=_[_0x6e4f('0x3e')](_0xe20ce9[_0x6e4f('0x3c')],{'$or':_[_0x6e4f('0x2e')](_0xe20ce9[_0x6e4f('0x38')],function(_0x44004d){var _0x20ed49={};_0x20ed49[_0x44004d]={'$like':'%'+_0x143eac[_0x6e4f('0x32')][_0x6e4f('0x3d')]+'%'};return _0x20ed49;})});}_0xe20ce9=_[_0x6e4f('0x3e')]({},_0xe20ce9,_0x143eac[_0x6e4f('0x40')]);return _0x328fad[_0x6e4f('0x84')](_0xe20ce9);}})[_0x6e4f('0x25')](function(_0x1451cd){if(_0x1451cd){_0x3f25e5=_0x1451cd[_0x6e4f('0x39')];if(!_0x143eac['query'][_0x6e4f('0x53')](_0x6e4f('0x54'))){_0xe20ce9[_0x6e4f('0x1f')]=qs[_0x6e4f('0x1f')](_0x143eac[_0x6e4f('0x32')][_0x6e4f('0x1f')]);_0xe20ce9[_0x6e4f('0x21')]=qs[_0x6e4f('0x21')](_0x143eac['query']['offset']);}return _0x328fad[_0x6e4f('0x84')](_0xe20ce9);}})[_0x6e4f('0x25')](function(_0x50bd8b){if(_0x50bd8b){return _0x50bd8b?{'count':_0x3f25e5,'rows':_0x50bd8b}:null;}})[_0x6e4f('0x25')](respondWithResult(_0x4f6d2f,null))[_0x6e4f('0x42')](handleError(_0x4f6d2f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5e2d4d2..2780fa4 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 _0x83c2=['MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x360f23,_0x17f555){var _0x21b7e0=function(_0x8eec){while(--_0x8eec){_0x360f23['push'](_0x360f23['shift']());}};_0x21b7e0(++_0x17f555);}(_0x83c2,0x1e5));var _0x283c=function(_0x3c7d53,_0x2826d0){_0x3c7d53=_0x3c7d53-0x0;var _0x2c8387=_0x83c2[_0x3c7d53];return _0x2c8387;};'use strict';var EventEmitter=require(_0x283c('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x283c('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x283c('0x2')](0x0);var events={'afterCreate':_0x283c('0x3'),'afterUpdate':_0x283c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x227a5a){return function(_0x21d27d,_0x1943be,_0x1dad89){MailQueueEvents[_0x283c('0x5')](_0x227a5a+':'+_0x21d27d['id'],_0x21d27d);MailQueueEvents[_0x283c('0x5')](_0x227a5a,_0x21d27d);_0x1dad89(null);};}for(var e in events){if(events[_0x283c('0x6')](e)){var event=events[e];MailQueue[_0x283c('0x7')](e,emitEvent(event));}}module[_0x283c('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x1810=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','MailQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1810,0x1c7));var _0x0181=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x1810[_0x322522];return _0x293bcf;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x0181('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0181('0x1')](0x0);var events={'afterCreate':_0x0181('0x2'),'afterUpdate':'update','afterDestroy':_0x0181('0x3')};function emitEvent(_0x1d5591){return function(_0x205af8,_0x2045bf,_0x14f39b){MailQueueEvents['emit'](_0x1d5591+':'+_0x205af8['id'],_0x205af8);MailQueueEvents[_0x0181('0x4')](_0x1d5591,_0x205af8);_0x14f39b(null);};}for(var e in events){if(events[_0x0181('0x5')](e)){var event=events[e];MailQueue[_0x0181('0x6')](e,emitEvent(event));}}module[_0x0181('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 83559e5..7591cbd 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 _0xd779=['define','MailQueue','mail_queues','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd779,0xab));var _0x9d77=function(_0x37b5be,_0x2832df){_0x37b5be=_0x37b5be-0x0;var _0x4f3b33=_0xd779[_0x37b5be];return _0x4f3b33;};'use strict';var _=require('lodash');var util=require(_0x9d77('0x0'));var logger=require(_0x9d77('0x1'))('api');var moment=require(_0x9d77('0x2'));var BPromise=require(_0x9d77('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d77('0x4'));var rimraf=require(_0x9d77('0x5'));var config=require(_0x9d77('0x6'));var attributes=require(_0x9d77('0x7'));module[_0x9d77('0x8')]=function(_0x246a8d,_0x2bac4e){return _0x246a8d[_0x9d77('0x9')](_0x9d77('0xa'),attributes,{'tableName':_0x9d77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c4f=['request-promise','path','../../config/environment','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x34fb19,_0xc493c6){var _0x3a1dcd=function(_0xed1626){while(--_0xed1626){_0x34fb19['push'](_0x34fb19['shift']());}};_0x3a1dcd(++_0xc493c6);}(_0x2c4f,0xcd));var _0xf2c4=function(_0x60155a,_0x5e8257){_0x60155a=_0x60155a-0x0;var _0x181370=_0x2c4f[_0x60155a];return _0x181370;};'use strict';var _=require(_0xf2c4('0x0'));var util=require('util');var logger=require(_0xf2c4('0x1'))(_0xf2c4('0x2'));var moment=require('moment');var BPromise=require(_0xf2c4('0x3'));var rp=require(_0xf2c4('0x4'));var fs=require('fs');var path=require(_0xf2c4('0x5'));var rimraf=require('rimraf');var config=require(_0xf2c4('0x6'));var attributes=require('./mailQueue.attributes');module[_0xf2c4('0x7')]=function(_0x38601a,_0xa49194){return _0x38601a[_0xf2c4('0x8')](_0xf2c4('0x9'),attributes,{'tableName':_0xf2c4('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 0e5a16d..756e444 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 _0x534f=['error','message','MailQueue,\x20%s,\x20%s','info','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','debug','ShowMailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','request\x20sent','stringify'];(function(_0x1e52ef,_0x14b9cf){var _0x51567c=function(_0x1f2780){while(--_0x1f2780){_0x1e52ef['push'](_0x1e52ef['shift']());}};_0x51567c(++_0x14b9cf);}(_0x534f,0x1a3));var _0xf534=function(_0x2eddfe,_0x3a123f){_0x2eddfe=_0x2eddfe-0x0;var _0x4043ac=_0x534f[_0x2eddfe];return _0x4043ac;};'use strict';var _=require(_0xf534('0x0'));var util=require(_0xf534('0x1'));var moment=require(_0xf534('0x2'));var BPromise=require(_0xf534('0x3'));var rs=require(_0xf534('0x4'));var fs=require('fs');var Redis=require(_0xf534('0x5'));var db=require(_0xf534('0x6'))['db'];var utils=require(_0xf534('0x7'));var logger=require(_0xf534('0x8'))(_0xf534('0x9'));var config=require('../../config/environment');var jayson=require(_0xf534('0xa'));var client=jayson[_0xf534('0xb')]['http']({'port':0x232a});config[_0xf534('0xc')]=_[_0xf534('0xd')](config[_0xf534('0xc')],{'host':_0xf534('0xe'),'port':0x18eb});var socket=require(_0xf534('0xf'))(new Redis(config[_0xf534('0xc')]));require(_0xf534('0x10'))[_0xf534('0x11')](socket);function respondWithRpcPromise(_0x3189e3,_0x5650f2,_0x5f0c21){return new BPromise(function(_0x59bc7c,_0x44493e){return client[_0xf534('0x12')](_0x3189e3,_0x5f0c21)['then'](function(_0x2cd464){logger['info']('MailQueue,\x20%s,\x20%s',_0x5650f2,_0xf534('0x13'));logger['debug']('MailQueue,\x20%s,\x20%s,\x20%s',_0x5650f2,_0xf534('0x13'),JSON[_0xf534('0x14')](_0x2cd464));if(_0x2cd464[_0xf534('0x15')]){if(_0x2cd464[_0xf534('0x15')]['code']===0x1f4){logger[_0xf534('0x15')]('MailQueue,\x20%s,\x20%s',_0x5650f2,_0x2cd464['error'][_0xf534('0x16')]);return _0x44493e(_0x2cd464['error'][_0xf534('0x16')]);}logger[_0xf534('0x15')](_0xf534('0x17'),_0x5650f2,_0x2cd464[_0xf534('0x15')]['message']);return _0x59bc7c(_0x2cd464['error']['message']);}else{logger[_0xf534('0x18')](_0xf534('0x17'),_0x5650f2,_0xf534('0x13'));_0x59bc7c(_0x2cd464['result'][_0xf534('0x16')]);}})[_0xf534('0x19')](function(_0x169d96){logger[_0xf534('0x15')]('MailQueue,\x20%s,\x20%s',_0x5650f2,_0x169d96);_0x44493e(_0x169d96);});});}exports[_0xf534('0x1a')]=function(_0x52995d){var _0x234055=this;return new Promise(function(_0xc9e2f4,_0x2598cf){return db[_0xf534('0x1b')][_0xf534('0x1c')]({'raw':_0x52995d['options']?_0x52995d[_0xf534('0x1d')][_0xf534('0x1e')]===undefined?!![]:![]:!![],'where':_0x52995d[_0xf534('0x1d')]?_0x52995d[_0xf534('0x1d')][_0xf534('0x1f')]||null:null,'attributes':_0x52995d[_0xf534('0x1d')]?_0x52995d[_0xf534('0x1d')][_0xf534('0x20')]||null:null,'limit':_0x52995d[_0xf534('0x1d')]?_0x52995d['options'][_0xf534('0x21')]||null:null,'include':_0x52995d['options']?_0x52995d[_0xf534('0x1d')][_0xf534('0x22')]?_['map'](_0x52995d[_0xf534('0x1d')][_0xf534('0x22')],function(_0x1ccdca){return{'model':db[_0x1ccdca[_0xf534('0x23')]],'as':_0x1ccdca['as'],'attributes':_0x1ccdca['attributes'],'include':_0x1ccdca['include']?_[_0xf534('0x24')](_0x1ccdca[_0xf534('0x22')],function(_0x4161e1){return{'model':db[_0x4161e1[_0xf534('0x23')]],'as':_0x4161e1['as'],'attributes':_0x4161e1['attributes'],'include':_0x4161e1['include']?_[_0xf534('0x24')](_0x4161e1[_0xf534('0x22')],function(_0x3c9932){return{'model':db[_0x3c9932[_0xf534('0x23')]],'as':_0x3c9932['as'],'attributes':_0x3c9932[_0xf534('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf534('0x25')](function(_0x1fde23){logger['info'](_0xf534('0x1a'),_0x52995d);logger[_0xf534('0x26')](_0xf534('0x1a'),_0x52995d,JSON[_0xf534('0x14')](_0x1fde23));_0xc9e2f4(_0x1fde23);})[_0xf534('0x19')](function(_0x23fead){logger[_0xf534('0x15')](_0xf534('0x1a'),_0x23fead[_0xf534('0x16')],_0x52995d);_0x2598cf(_0x234055[_0xf534('0x15')](0x1f4,_0x23fead[_0xf534('0x16')]));});});};exports[_0xf534('0x27')]=function(_0x56fcb6){var _0x297e9b=this;return new Promise(function(_0x4e901e,_0x2354f6){return db[_0xf534('0x1b')]['find']({'raw':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x1e')]===undefined?!![]:![]:!![],'where':_0x56fcb6['options']?_0x56fcb6[_0xf534('0x1d')]['where']||null:null,'attributes':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x20')]||null:null,'include':_0x56fcb6[_0xf534('0x1d')]?_0x56fcb6[_0xf534('0x1d')][_0xf534('0x22')]?_[_0xf534('0x24')](_0x56fcb6[_0xf534('0x1d')][_0xf534('0x22')],function(_0x4edc53){return{'model':db[_0x4edc53[_0xf534('0x23')]],'as':_0x4edc53['as'],'attributes':_0x4edc53['attributes'],'include':_0x4edc53[_0xf534('0x22')]?_[_0xf534('0x24')](_0x4edc53['include'],function(_0x59ca7c){return{'model':db[_0x59ca7c[_0xf534('0x23')]],'as':_0x59ca7c['as'],'attributes':_0x59ca7c['attributes'],'include':_0x59ca7c[_0xf534('0x22')]?_[_0xf534('0x24')](_0x59ca7c[_0xf534('0x22')],function(_0x2fcb75){return{'model':db[_0x2fcb75['model']],'as':_0x2fcb75['as'],'attributes':_0x2fcb75[_0xf534('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x203868){logger['info'](_0xf534('0x27'),_0x56fcb6);logger[_0xf534('0x26')](_0xf534('0x27'),_0x56fcb6,JSON[_0xf534('0x14')](_0x203868));_0x4e901e(_0x203868);})[_0xf534('0x19')](function(_0x259de6){logger[_0xf534('0x15')]('ShowMailQueue',_0x259de6[_0xf534('0x16')],_0x56fcb6);_0x2354f6(_0x297e9b[_0xf534('0x15')](0x1f4,_0x259de6[_0xf534('0x16')]));});});}; \ No newline at end of file +var _0xed7a=['model','ShowMailQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','./mailQueue.socket','register','request','then','info','debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x450076,_0x10983b){var _0x2029cc=function(_0x4a5e76){while(--_0x4a5e76){_0x450076['push'](_0x450076['shift']());}};_0x2029cc(++_0x10983b);}(_0xed7a,0x9f));var _0xaed7=function(_0x82c743,_0x2a3c70){_0x82c743=_0x82c743-0x0;var _0x528f97=_0xed7a[_0x82c743];return _0x528f97;};'use strict';var _=require(_0xaed7('0x0'));var util=require(_0xaed7('0x1'));var moment=require('moment');var BPromise=require(_0xaed7('0x2'));var rs=require(_0xaed7('0x3'));var fs=require('fs');var Redis=require(_0xaed7('0x4'));var db=require(_0xaed7('0x5'))['db'];var utils=require(_0xaed7('0x6'));var logger=require('../../config/logger')(_0xaed7('0x7'));var config=require(_0xaed7('0x8'));var jayson=require(_0xaed7('0x9'));var client=jayson['client'][_0xaed7('0xa')]({'port':0x232a});config[_0xaed7('0xb')]=_['defaults'](config[_0xaed7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaed7('0xb')]));require(_0xaed7('0xc'))[_0xaed7('0xd')](socket);function respondWithRpcPromise(_0x1ba57a,_0x2a3d2c,_0x17c79e){return new BPromise(function(_0x5285ae,_0x41bca3){return client[_0xaed7('0xe')](_0x1ba57a,_0x17c79e)[_0xaed7('0xf')](function(_0x5e2df1){logger[_0xaed7('0x10')]('MailQueue,\x20%s,\x20%s',_0x2a3d2c,'request\x20sent');logger[_0xaed7('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2a3d2c,'request\x20sent',JSON[_0xaed7('0x12')](_0x5e2df1));if(_0x5e2df1[_0xaed7('0x13')]){if(_0x5e2df1[_0xaed7('0x13')][_0xaed7('0x14')]===0x1f4){logger[_0xaed7('0x13')](_0xaed7('0x15'),_0x2a3d2c,_0x5e2df1['error'][_0xaed7('0x16')]);return _0x41bca3(_0x5e2df1[_0xaed7('0x13')][_0xaed7('0x16')]);}logger['error'](_0xaed7('0x15'),_0x2a3d2c,_0x5e2df1[_0xaed7('0x13')][_0xaed7('0x16')]);return _0x5285ae(_0x5e2df1[_0xaed7('0x13')][_0xaed7('0x16')]);}else{logger[_0xaed7('0x10')]('MailQueue,\x20%s,\x20%s',_0x2a3d2c,_0xaed7('0x17'));_0x5285ae(_0x5e2df1[_0xaed7('0x18')][_0xaed7('0x16')]);}})[_0xaed7('0x19')](function(_0xb59ca){logger[_0xaed7('0x13')](_0xaed7('0x15'),_0x2a3d2c,_0xb59ca);_0x41bca3(_0xb59ca);});});}exports[_0xaed7('0x1a')]=function(_0x36e775){var _0x1abf52=this;return new Promise(function(_0x4d3d57,_0x388980){return db[_0xaed7('0x1b')][_0xaed7('0x1c')]({'raw':_0x36e775['options']?_0x36e775[_0xaed7('0x1d')][_0xaed7('0x1e')]===undefined?!![]:![]:!![],'where':_0x36e775[_0xaed7('0x1d')]?_0x36e775[_0xaed7('0x1d')][_0xaed7('0x1f')]||null:null,'attributes':_0x36e775[_0xaed7('0x1d')]?_0x36e775[_0xaed7('0x1d')][_0xaed7('0x20')]||null:null,'limit':_0x36e775[_0xaed7('0x1d')]?_0x36e775[_0xaed7('0x1d')][_0xaed7('0x21')]||null:null,'include':_0x36e775[_0xaed7('0x1d')]?_0x36e775[_0xaed7('0x1d')][_0xaed7('0x22')]?_[_0xaed7('0x23')](_0x36e775[_0xaed7('0x1d')][_0xaed7('0x22')],function(_0x8f65d8){return{'model':db[_0x8f65d8[_0xaed7('0x24')]],'as':_0x8f65d8['as'],'attributes':_0x8f65d8['attributes'],'include':_0x8f65d8['include']?_['map'](_0x8f65d8[_0xaed7('0x22')],function(_0x3e05f5){return{'model':db[_0x3e05f5[_0xaed7('0x24')]],'as':_0x3e05f5['as'],'attributes':_0x3e05f5['attributes'],'include':_0x3e05f5[_0xaed7('0x22')]?_[_0xaed7('0x23')](_0x3e05f5['include'],function(_0x49e06d){return{'model':db[_0x49e06d['model']],'as':_0x49e06d['as'],'attributes':_0x49e06d['attributes']};}):[]};}):[]};}):[]:[]})[_0xaed7('0xf')](function(_0x581a4d){logger[_0xaed7('0x10')](_0xaed7('0x1a'),_0x36e775);logger[_0xaed7('0x11')](_0xaed7('0x1a'),_0x36e775,JSON[_0xaed7('0x12')](_0x581a4d));_0x4d3d57(_0x581a4d);})['catch'](function(_0x59e36b){logger[_0xaed7('0x13')](_0xaed7('0x1a'),_0x59e36b[_0xaed7('0x16')],_0x36e775);_0x388980(_0x1abf52[_0xaed7('0x13')](0x1f4,_0x59e36b['message']));});});};exports[_0xaed7('0x25')]=function(_0x142a14){var _0x456f6a=this;return new Promise(function(_0x2b4e8f,_0x558460){return db[_0xaed7('0x1b')][_0xaed7('0x26')]({'raw':_0x142a14[_0xaed7('0x1d')]?_0x142a14[_0xaed7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x142a14['options']?_0x142a14[_0xaed7('0x1d')][_0xaed7('0x1f')]||null:null,'attributes':_0x142a14[_0xaed7('0x1d')]?_0x142a14[_0xaed7('0x1d')]['attributes']||null:null,'include':_0x142a14['options']?_0x142a14[_0xaed7('0x1d')]['include']?_[_0xaed7('0x23')](_0x142a14[_0xaed7('0x1d')]['include'],function(_0x53554d){return{'model':db[_0x53554d[_0xaed7('0x24')]],'as':_0x53554d['as'],'attributes':_0x53554d['attributes'],'include':_0x53554d[_0xaed7('0x22')]?_[_0xaed7('0x23')](_0x53554d[_0xaed7('0x22')],function(_0x164885){return{'model':db[_0x164885[_0xaed7('0x24')]],'as':_0x164885['as'],'attributes':_0x164885[_0xaed7('0x20')],'include':_0x164885['include']?_[_0xaed7('0x23')](_0x164885[_0xaed7('0x22')],function(_0x4ab955){return{'model':db[_0x4ab955[_0xaed7('0x24')]],'as':_0x4ab955['as'],'attributes':_0x4ab955[_0xaed7('0x20')]};}):[]};}):[]};}):[]:[]})[_0xaed7('0xf')](function(_0x43a3fb){logger[_0xaed7('0x10')](_0xaed7('0x25'),_0x142a14);logger[_0xaed7('0x11')]('ShowMailQueue',_0x142a14,JSON['stringify'](_0x43a3fb));_0x2b4e8f(_0x43a3fb);})[_0xaed7('0x19')](function(_0x3a7399){logger[_0xaed7('0x13')](_0xaed7('0x25'),_0x3a7399[_0xaed7('0x16')],_0x142a14);_0x558460(_0x456f6a['error'](0x1f4,_0x3a7399[_0xaed7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7498975..f791451 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 _0x43b7=['register','length','./mailQueue.events','update','removeListener'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x43b7,0x183));var _0x743b=function(_0x401e27,_0xd6af56){_0x401e27=_0x401e27-0x0;var _0x56d460=_0x43b7[_0x401e27];return _0x56d460;};'use strict';var MailQueueEvents=require(_0x743b('0x0'));var events=['save','remove',_0x743b('0x1')];function createListener(_0x56d9c3,_0x2e177a){return function(_0x320b11){_0x2e177a['emit'](_0x56d9c3,_0x320b11);};}function removeListener(_0x5f0319,_0x45a9a7){return function(){MailQueueEvents[_0x743b('0x2')](_0x5f0319,_0x45a9a7);};}exports[_0x743b('0x3')]=function(_0x2e8cd2){for(var _0x8d405=0x0,_0x1b25ec=events[_0x743b('0x4')];_0x8d405<_0x1b25ec;_0x8d405++){var _0x515ed3=events[_0x8d405];var _0x542c29=createListener('mailQueue:'+_0x515ed3,_0x2e8cd2);MailQueueEvents['on'](_0x515ed3,_0x542c29);}}; \ No newline at end of file +var _0xfe36=['emit','removeListener','register','length','./mailQueue.events','save','update'];(function(_0x5460c4,_0x31b78a){var _0x4f45a7=function(_0x180fa5){while(--_0x180fa5){_0x5460c4['push'](_0x5460c4['shift']());}};_0x4f45a7(++_0x31b78a);}(_0xfe36,0x1b6));var _0x6fe3=function(_0x3d5ee9,_0xf409e1){_0x3d5ee9=_0x3d5ee9-0x0;var _0x49e6d5=_0xfe36[_0x3d5ee9];return _0x49e6d5;};'use strict';var MailQueueEvents=require(_0x6fe3('0x0'));var events=[_0x6fe3('0x1'),'remove',_0x6fe3('0x2')];function createListener(_0x1c7aca,_0x428ec0){return function(_0x4b866e){_0x428ec0[_0x6fe3('0x3')](_0x1c7aca,_0x4b866e);};}function removeListener(_0x476925,_0x3e54b4){return function(){MailQueueEvents[_0x6fe3('0x4')](_0x476925,_0x3e54b4);};}exports[_0x6fe3('0x5')]=function(_0x3a9e88){for(var _0x540c17=0x0,_0x5ef797=events[_0x6fe3('0x6')];_0x540c17<_0x5ef797;_0x540c17++){var _0x373ed8=events[_0x540c17];var _0x3b725c=createListener('mailQueue:'+_0x373ed8,_0x3a9e88);MailQueueEvents['on'](_0x373ed8,_0x3b725c);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b943c3d..c0fc580 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 _0xf7e9=['show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe'];(function(_0x4a2c56,_0x387e2c){var _0x5adfca=function(_0x560da0){while(--_0x560da0){_0x4a2c56['push'](_0x4a2c56['shift']());}};_0x5adfca(++_0x387e2c);}(_0xf7e9,0x143));var _0x9f7e=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0xf7e9[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x9f7e('0x0'));var util=require(_0x9f7e('0x1'));var path=require('path');var timeout=require(_0x9f7e('0x2'));var express=require(_0x9f7e('0x3'));var router=express[_0x9f7e('0x4')]();var fs_extra=require(_0x9f7e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f7e('0x6'));var config=require(_0x9f7e('0x7'));var controller=require(_0x9f7e('0x8'));router[_0x9f7e('0x9')]('/',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xb')]);router[_0x9f7e('0x9')]('/describe',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xc')]);router[_0x9f7e('0x9')]('/:id',auth[_0x9f7e('0xa')](),controller[_0x9f7e('0xd')]);router[_0x9f7e('0xe')]('/',auth['isAuthenticated'](),controller[_0x9f7e('0xf')]);router['put'](_0x9f7e('0x10'),auth['isAuthenticated'](),controller[_0x9f7e('0x11')]);router[_0x9f7e('0x12')](_0x9f7e('0x10'),auth[_0x9f7e('0xa')](),controller[_0x9f7e('0x13')]);module[_0x9f7e('0x14')]=router; \ No newline at end of file +var _0x625d=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','index','isAuthenticated','describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x1cbff5,_0x4d5c69){var _0x5fcda9=function(_0x3007bc){while(--_0x3007bc){_0x1cbff5['push'](_0x1cbff5['shift']());}};_0x5fcda9(++_0x4d5c69);}(_0x625d,0x112));var _0xd625=function(_0x3ba566,_0x5e009d){_0x3ba566=_0x3ba566-0x0;var _0x480317=_0x625d[_0x3ba566];return _0x480317;};'use strict';var multer=require(_0xd625('0x0'));var util=require(_0xd625('0x1'));var path=require(_0xd625('0x2'));var timeout=require('connect-timeout');var express=require(_0xd625('0x3'));var router=express[_0xd625('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd625('0x5'));var interaction=require(_0xd625('0x6'));var config=require(_0xd625('0x7'));var controller=require(_0xd625('0x8'));router[_0xd625('0x9')]('/',auth['isAuthenticated'](),controller[_0xd625('0xa')]);router['get']('/describe',auth[_0xd625('0xb')](),controller[_0xd625('0xc')]);router[_0xd625('0x9')](_0xd625('0xd'),auth[_0xd625('0xb')](),controller[_0xd625('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd625('0xf')]);router[_0xd625('0x10')](_0xd625('0xd'),auth[_0xd625('0xb')](),controller['update']);router[_0xd625('0x11')](_0xd625('0xd'),auth['isAuthenticated'](),controller[_0xd625('0x12')]);module[_0xd625('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 2b4e25c..d331138 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 _0x1d8a=['DATE','sequelize','exports','STRING'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x1d8a,0x1f1));var _0xa1d8=function(_0xeef39f,_0x3add43){_0xeef39f=_0xeef39f-0x0;var _0x4ed8a8=_0x1d8a[_0xeef39f];return _0x4ed8a8;};'use strict';var moment=require('moment');var Sequelize=require(_0xa1d8('0x0'));module[_0xa1d8('0x1')]={'uniqueid':{'type':Sequelize[_0xa1d8('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa1d8('0x3')]},'leaveAt':{'type':Sequelize[_0xa1d8('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xa1d8('0x3')]},'reason':{'type':Sequelize[_0xa1d8('0x2')]}}; \ No newline at end of file +var _0x0a2a=['moment','sequelize','exports','STRING','DATE'];(function(_0x875110,_0x7873af){var _0x39758a=function(_0x251608){while(--_0x251608){_0x875110['push'](_0x875110['shift']());}};_0x39758a(++_0x7873af);}(_0x0a2a,0x186));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0xa0a2('0x0'));var Sequelize=require(_0xa0a2('0x1'));module[_0xa0a2('0x2')]={'uniqueid':{'type':Sequelize[_0xa0a2('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa0a2('0x4')]},'acceptAt':{'type':Sequelize[_0xa0a2('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa0a2('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 320b181..fe8cd78 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 _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x583737,_0x1dffb1){var _0x552844=function(_0x2246c0){while(--_0x2246c0){_0x583737['push'](_0x583737['shift']());}};_0x552844(++_0x1dffb1);}(_0x6050,0x196));var _0x0605=function(_0x45dc33,_0x524b5f){_0x45dc33=_0x45dc33-0x0;var _0x398f42=_0x6050[_0x45dc33];return _0x398f42;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file +var _0x3a6d=['keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','pick','filter','where','type','options','includeAll','rows','catch','params','rawAttributes','merge','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','save','then','error','stack','name','send','index','map','MailQueueReport','fieldName','key','query'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3a6d,0x143));var _0xd3a6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3a6d[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xd3a6('0x0'));var rimraf=require(_0xd3a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd3a6('0x2'));var rp=require(_0xd3a6('0x3'));var moment=require(_0xd3a6('0x4'));var BPromise=require(_0xd3a6('0x5'));var Mustache=require(_0xd3a6('0x6'));var util=require('util');var path=require(_0xd3a6('0x7'));var sox=require(_0xd3a6('0x8'));var csv=require(_0xd3a6('0x9'));var ejs=require(_0xd3a6('0xa'));var fs=require('fs');var fs_extra=require(_0xd3a6('0xb'));var _=require(_0xd3a6('0xc'));var squel=require('squel');var crypto=require(_0xd3a6('0xd'));var jsforce=require(_0xd3a6('0xe'));var deskjs=require(_0xd3a6('0xf'));var toCsv=require(_0xd3a6('0x9'));var querystring=require(_0xd3a6('0x10'));var Papa=require(_0xd3a6('0x11'));var Redis=require(_0xd3a6('0x12'));var authService=require(_0xd3a6('0x13'));var qs=require(_0xd3a6('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd3a6('0x15'));var logger=require(_0xd3a6('0x16'))(_0xd3a6('0x17'));var utils=require(_0xd3a6('0x18'));var config=require(_0xd3a6('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0467,_0x1c6ad7){_0x1c6ad7=_0x1c6ad7||0xcc;return function(_0x671004){if(_0x671004){return _0x4b0467[_0xd3a6('0x1a')](_0x1c6ad7);}return _0x4b0467[_0xd3a6('0x1b')](_0x1c6ad7)[_0xd3a6('0x1c')]();};}function respondWithResult(_0x2911a0,_0xa56452){_0xa56452=_0xa56452||0xc8;return function(_0x4e67fb){if(_0x4e67fb){return _0x2911a0[_0xd3a6('0x1b')](_0xa56452)[_0xd3a6('0x1d')](_0x4e67fb);}};}function respondWithFilteredResult(_0x171a8f,_0x500a37){return function(_0x3c2399){if(_0x3c2399){var _0x305b61=typeof _0x500a37[_0xd3a6('0x1e')]==='undefined'&&typeof _0x500a37[_0xd3a6('0x1f')]==='undefined';var _0x518b6d=_0x3c2399[_0xd3a6('0x20')];var _0x8d1286=_0x305b61?0x0:_0x500a37[_0xd3a6('0x1e')];var _0xbe58b4=_0x305b61?_0x3c2399[_0xd3a6('0x20')]:_0x500a37[_0xd3a6('0x1e')]+_0x500a37[_0xd3a6('0x1f')];var _0x4ec27c;if(_0xbe58b4>=_0x518b6d){_0xbe58b4=_0x518b6d;_0x4ec27c=0xc8;}else{_0x4ec27c=0xce;}_0x171a8f[_0xd3a6('0x1b')](_0x4ec27c);return _0x171a8f['set'](_0xd3a6('0x21'),_0x8d1286+'-'+_0xbe58b4+'/'+_0x518b6d)[_0xd3a6('0x1d')](_0x3c2399);}return null;};}function patchUpdates(_0x12f2c1){return function(_0x20a34e){try{jsonpatch[_0xd3a6('0x22')](_0x20a34e,_0x12f2c1,!![]);}catch(_0x6ecd88){return BPromise['reject'](_0x6ecd88);}return _0x20a34e[_0xd3a6('0x23')]();};}function saveUpdates(_0x422f5c,_0x57cf15){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a['update'](_0x422f5c)['then'](function(_0x5c9075){return _0x5c9075;});}return null;};}function removeEntity(_0x98a12a,_0x400982){return function(_0x3d0b28){if(_0x3d0b28){return _0x3d0b28['destroy']()[_0xd3a6('0x24')](function(){_0x98a12a['status'](0xcc)[_0xd3a6('0x1c')]();});}};}function handleEntityNotFound(_0x16afc8,_0x429079){return function(_0x4f6130){if(!_0x4f6130){_0x16afc8[_0xd3a6('0x1a')](0x194);}return _0x4f6130;};}function handleError(_0x3bc8d1,_0x1b09ac){_0x1b09ac=_0x1b09ac||0x1f4;return function(_0x219e32){logger[_0xd3a6('0x25')](_0x219e32[_0xd3a6('0x26')]);if(_0x219e32['name']){delete _0x219e32[_0xd3a6('0x27')];}_0x3bc8d1[_0xd3a6('0x1b')](_0x1b09ac)[_0xd3a6('0x28')](_0x219e32);};}exports[_0xd3a6('0x29')]=function(_0x30abc2,_0x45c628){var _0x5c2186={},_0x535bd4={},_0x1f4859={'count':0x0,'rows':[]};var _0x210aa1=_[_0xd3a6('0x2a')](db[_0xd3a6('0x2b')]['rawAttributes'],function(_0x3de3bb){return{'name':_0x3de3bb[_0xd3a6('0x2c')],'type':_0x3de3bb['type'][_0xd3a6('0x2d')]};});_0x535bd4['model']=_[_0xd3a6('0x2a')](_0x210aa1,_0xd3a6('0x27'));_0x535bd4[_0xd3a6('0x2e')]=_[_0xd3a6('0x2f')](_0x30abc2[_0xd3a6('0x2e')]);_0x535bd4[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x535bd4['model'],_0x535bd4['query']);_0x5c2186[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x535bd4[_0xd3a6('0x33')],qs['fields'](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x5c2186[_0xd3a6('0x32')]=_0x5c2186[_0xd3a6('0x32')][_0xd3a6('0x35')]?_0x5c2186[_0xd3a6('0x32')]:_0x535bd4[_0xd3a6('0x33')];if(!_0x30abc2[_0xd3a6('0x2e')]['hasOwnProperty'](_0xd3a6('0x36'))){_0x5c2186[_0xd3a6('0x1f')]=qs[_0xd3a6('0x1f')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x1f')]);_0x5c2186[_0xd3a6('0x1e')]=qs['offset'](_0x30abc2[_0xd3a6('0x2e')]['offset']);}_0x5c2186[_0xd3a6('0x37')]=qs[_0xd3a6('0x38')](_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x38')]);_0x5c2186['where']=qs['filters'](_[_0xd3a6('0x39')](_0x30abc2[_0xd3a6('0x2e')],_0x535bd4[_0xd3a6('0x30')]),_0x210aa1);if(_0x30abc2['query'][_0xd3a6('0x3a')]){_0x5c2186[_0xd3a6('0x3b')]=_['merge'](_0x5c2186[_0xd3a6('0x3b')],{'$or':_['map'](_0x210aa1,function(_0x1e695a){if(_0x1e695a[_0xd3a6('0x3c')]!=='VIRTUAL'){var _0x219ba5={};_0x219ba5[_0x1e695a['name']]={'$like':'%'+_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3a')]+'%'};return _0x219ba5;}})});}_0x5c2186=_['merge']({},_0x5c2186,_0x30abc2[_0xd3a6('0x3d')]);var _0xfcef03={'where':_0x5c2186[_0xd3a6('0x3b')]};return db[_0xd3a6('0x2b')]['count'](_0xfcef03)[_0xd3a6('0x24')](function(_0x324dbd){_0x1f4859[_0xd3a6('0x20')]=_0x324dbd;if(_0x30abc2[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x5c2186['include']=[{'all':!![]}];}return db[_0xd3a6('0x2b')]['findAll'](_0x5c2186);})[_0xd3a6('0x24')](function(_0x1bc18a){_0x1f4859[_0xd3a6('0x3f')]=_0x1bc18a;return _0x1f4859;})['then'](respondWithFilteredResult(_0x45c628,_0x5c2186))[_0xd3a6('0x40')](handleError(_0x45c628,null));};exports['show']=function(_0x23aa99,_0x4cbf76){var _0x448213={'raw':!![],'where':{'id':_0x23aa99[_0xd3a6('0x41')]['id']}},_0x629153={};_0x629153[_0xd3a6('0x33')]=_[_0xd3a6('0x2f')](db[_0xd3a6('0x2b')][_0xd3a6('0x42')]);_0x629153['query']=_[_0xd3a6('0x2f')](_0x23aa99[_0xd3a6('0x2e')]);_0x629153[_0xd3a6('0x30')]=_[_0xd3a6('0x31')](_0x629153['model'],_0x629153[_0xd3a6('0x2e')]);_0x448213[_0xd3a6('0x32')]=_[_0xd3a6('0x31')](_0x629153[_0xd3a6('0x33')],qs[_0xd3a6('0x34')](_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x34')]));_0x448213[_0xd3a6('0x32')]=_0x448213['attributes'][_0xd3a6('0x35')]?_0x448213[_0xd3a6('0x32')]:_0x629153[_0xd3a6('0x33')];if(_0x23aa99[_0xd3a6('0x2e')][_0xd3a6('0x3e')]){_0x448213['include']=[{'all':!![]}];}_0x448213=_[_0xd3a6('0x43')]({},_0x448213,_0x23aa99[_0xd3a6('0x3d')]);return db[_0xd3a6('0x2b')][_0xd3a6('0x44')](_0x448213)[_0xd3a6('0x24')](handleEntityNotFound(_0x4cbf76,null))[_0xd3a6('0x24')](respondWithResult(_0x4cbf76,null))[_0xd3a6('0x40')](handleError(_0x4cbf76,null));};exports[_0xd3a6('0x45')]=function(_0x4ac576,_0x7828c2){return db['MailQueueReport'][_0xd3a6('0x45')](_0x4ac576[_0xd3a6('0x46')],{})['then'](respondWithResult(_0x7828c2,0xc9))[_0xd3a6('0x40')](handleError(_0x7828c2,null));};exports[_0xd3a6('0x47')]=function(_0x3cf99a,_0x375067){if(_0x3cf99a[_0xd3a6('0x46')]['id']){delete _0x3cf99a[_0xd3a6('0x46')]['id'];}return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x3cf99a[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x375067,null))['then'](saveUpdates(_0x3cf99a[_0xd3a6('0x46')],null))[_0xd3a6('0x24')](respondWithResult(_0x375067,null))[_0xd3a6('0x40')](handleError(_0x375067,null));};exports[_0xd3a6('0x48')]=function(_0x26bd65,_0x225393){return db[_0xd3a6('0x2b')][_0xd3a6('0x44')]({'where':{'id':_0x26bd65[_0xd3a6('0x41')]['id']}})[_0xd3a6('0x24')](handleEntityNotFound(_0x225393,null))['then'](removeEntity(_0x225393,null))[_0xd3a6('0x40')](handleError(_0x225393,null));};exports[_0xd3a6('0x49')]=function(_0x618b72,_0x4995b7){return db[_0xd3a6('0x2b')]['describe']()['then'](respondWithResult(_0x4995b7,null))['catch'](handleError(_0x4995b7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index a5ca37a..45cdc61 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 _0x7fcc=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','uniqueid','lodash'];(function(_0x4a4713,_0x12dcd0){var _0x2e5ae8=function(_0x5a5693){while(--_0x5a5693){_0x4a4713['push'](_0x4a4713['shift']());}};_0x2e5ae8(++_0x12dcd0);}(_0x7fcc,0x8b));var _0xc7fc=function(_0x3bee46,_0x5970e7){_0x3bee46=_0x3bee46-0x0;var _0x41adc7=_0x7fcc[_0x3bee46];return _0x41adc7;};'use strict';var _=require(_0xc7fc('0x0'));var util=require(_0xc7fc('0x1'));var logger=require(_0xc7fc('0x2'))(_0xc7fc('0x3'));var moment=require(_0xc7fc('0x4'));var BPromise=require(_0xc7fc('0x5'));var rp=require(_0xc7fc('0x6'));var fs=require('fs');var path=require(_0xc7fc('0x7'));var rimraf=require(_0xc7fc('0x8'));var config=require(_0xc7fc('0x9'));var attributes=require(_0xc7fc('0xa'));module['exports']=function(_0x4b1d93,_0x41fb12){return _0x4b1d93[_0xc7fc('0xb')](_0xc7fc('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xc7fc('0xd'),'fields':[_0xc7fc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0263=['request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x4ebb5d,_0x1e92b6){var _0x5abafd=function(_0x2e1f57){while(--_0x2e1f57){_0x4ebb5d['push'](_0x4ebb5d['shift']());}};_0x5abafd(++_0x1e92b6);}(_0x0263,0x75));var _0x3026=function(_0x26b906,_0x224652){_0x26b906=_0x26b906-0x0;var _0x3c42f2=_0x0263[_0x26b906];return _0x3c42f2;};'use strict';var _=require('lodash');var util=require(_0x3026('0x0'));var logger=require(_0x3026('0x1'))(_0x3026('0x2'));var moment=require(_0x3026('0x3'));var BPromise=require('bluebird');var rp=require(_0x3026('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3026('0x5'));var config=require(_0x3026('0x6'));var attributes=require(_0x3026('0x7'));module[_0x3026('0x8')]=function(_0x582e84,_0x2b0923){return _0x582e84['define']('MailQueueReport',attributes,{'tableName':_0x3026('0x9'),'paranoid':![],'indexes':[{'name':_0x3026('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 82c3171..f74f68c 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x5e70f0,_0x3481e1){var _0x3d8a82=function(_0x4d5649){while(--_0x4d5649){_0x5e70f0['push'](_0x5e70f0['shift']());}};_0x3d8a82(++_0x3481e1);}(_0x7a54,0x106));var _0x47a5=function(_0x2e4c27,_0x312d69){_0x2e4c27=_0x2e4c27-0x0;var _0x2e3714=_0x7a54[_0x2e4c27];return _0x2e3714;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateMailQueueReport',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x4a7bac,_0x1a8719){var _0x284a73=function(_0x19afeb){while(--_0x19afeb){_0x4a7bac['push'](_0x4a7bac['shift']());}};_0x284a73(++_0x1a8719);}(_0xdb28,0x106));var _0x8db2=function(_0x38f5b9,_0x22c7c7){_0x38f5b9=_0x38f5b9-0x0;var _0x6dad59=_0xdb28[_0x38f5b9];return _0x6dad59;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 84b7eea..3efb21c 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(_0x4aec87,_0x271913){var _0x3d4bdb=function(_0x27bb78){while(--_0x27bb78){_0x4aec87['push'](_0x4aec87['shift']());}};_0x3d4bdb(++_0x271913);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcb91[_0x1064bc];return _0x5edc45;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2a14e8,_0xaf7f4b){var _0x500641=function(_0xb4be7b){while(--_0xb4be7b){_0x2a14e8['push'](_0x2a14e8['shift']());}};_0x500641(++_0xaf7f4b);}(_0xedd9,0xfc));var _0x9edd=function(_0x411847,_0x3ddf69){_0x411847=_0x411847-0x0;var _0x12e236=_0xedd9[_0x411847];return _0x12e236;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9c1657e..7fc5b1e 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 _0x9275=['BOOLEAN','INTEGER','INBOX','exports','STRING'];(function(_0x475b28,_0x5b644){var _0x531cfd=function(_0x2b8732){while(--_0x2b8732){_0x475b28['push'](_0x475b28['shift']());}};_0x531cfd(++_0x5b644);}(_0x9275,0x170));var _0x5927=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x9275[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x5927('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5927('0x1')]},'authentication':{'type':Sequelize[_0x5927('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5927('0x1')]},'password':{'type':Sequelize[_0x5927('0x1')]},'port':{'type':Sequelize[_0x5927('0x3')]},'tls':{'type':Sequelize[_0x5927('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5927('0x4')},'connTimeout':{'type':Sequelize[_0x5927('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5927('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x850b=['BOOLEAN','STRING','INTEGER','sequelize','exports'];(function(_0x35c610,_0x2ec133){var _0x421aed=function(_0x1a66e1){while(--_0x1a66e1){_0x35c610['push'](_0x35c610['shift']());}};_0x421aed(++_0x2ec133);}(_0x850b,0x1b6));var _0xb850=function(_0x13e8e9,_0x14f979){_0x13e8e9=_0x13e8e9-0x0;var _0x24a0f1=_0x850b[_0x13e8e9];return _0x24a0f1;};'use strict';var Sequelize=require(_0xb850('0x0'));module[_0xb850('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb850('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0xb850('0x3')]},'password':{'type':Sequelize[_0xb850('0x3')]},'port':{'type':Sequelize[_0xb850('0x4')]},'tls':{'type':Sequelize[_0xb850('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xb850('0x3')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xb850('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xb850('0x3')]},'modernAuthentication':{'type':Sequelize[_0xb850('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 4352dd9..3ebe198 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 _0xb35e=['../../config/logger','api','bluebird','path','rimraf','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x1283ea,_0x1eeb8c){var _0x21bb56=function(_0x3f4009){while(--_0x3f4009){_0x1283ea['push'](_0x1283ea['shift']());}};_0x21bb56(++_0x1eeb8c);}(_0xb35e,0x15d));var _0xeb35=function(_0x25a1c4,_0xd8aaa6){_0x25a1c4=_0x25a1c4-0x0;var _0x470c9a=_0xb35e[_0x25a1c4];return _0x470c9a;};'use strict';var _=require(_0xeb35('0x0'));var util=require('util');var logger=require(_0xeb35('0x1'))(_0xeb35('0x2'));var moment=require('moment');var BPromise=require(_0xeb35('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb35('0x4'));var rimraf=require(_0xeb35('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb35('0x6'));module[_0xeb35('0x7')]=function(_0x2951c6,_0x2e4aa8){return _0x2951c6['define'](_0xeb35('0x8'),attributes,{'tableName':_0xeb35('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91d9=['rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','moment','bluebird','request-promise','path'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x91d9,0x124));var _0x991d=function(_0xb7741d,_0x3dc360){_0xb7741d=_0xb7741d-0x0;var _0x9eb3ee=_0x91d9[_0xb7741d];return _0x9eb3ee;};'use strict';var _=require(_0x991d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x991d('0x1'));var BPromise=require(_0x991d('0x2'));var rp=require(_0x991d('0x3'));var fs=require('fs');var path=require(_0x991d('0x4'));var rimraf=require(_0x991d('0x5'));var config=require(_0x991d('0x6'));var attributes=require(_0x991d('0x7'));module['exports']=function(_0x4b2beb,_0x3c5529){return _0x4b2beb[_0x991d('0x8')](_0x991d('0x9'),attributes,{'tableName':_0x991d('0xa'),'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 575b951..28d4204 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 _0x1317=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1317,0xa3));var _0x7131=function(_0x4ddb0c,_0x1bba02){_0x4ddb0c=_0x4ddb0c-0x0;var _0x554e87=_0x1317[_0x4ddb0c];return _0x554e87;};'use strict';var _=require(_0x7131('0x0'));var util=require('util');var moment=require(_0x7131('0x1'));var BPromise=require('bluebird');var rs=require(_0x7131('0x2'));var fs=require('fs');var Redis=require(_0x7131('0x3'));var db=require(_0x7131('0x4'))['db'];var utils=require(_0x7131('0x5'));var logger=require(_0x7131('0x6'))(_0x7131('0x7'));var config=require(_0x7131('0x8'));var jayson=require(_0x7131('0x9'));var client=jayson[_0x7131('0xa')][_0x7131('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd2844c,_0x55f1ad,_0xb3285d){return new BPromise(function(_0x5a000d,_0x5eb292){return client[_0x7131('0xc')](_0xd2844c,_0xb3285d)[_0x7131('0xd')](function(_0xb52b80){logger[_0x7131('0xe')](_0x7131('0xf'),_0x55f1ad,_0x7131('0x10'));logger['debug'](_0x7131('0x11'),_0x55f1ad,_0x7131('0x10'),JSON[_0x7131('0x12')](_0xb52b80));if(_0xb52b80['error']){if(_0xb52b80['error'][_0x7131('0x13')]===0x1f4){logger[_0x7131('0x14')](_0x7131('0xf'),_0x55f1ad,_0xb52b80[_0x7131('0x14')]['message']);return _0x5eb292(_0xb52b80[_0x7131('0x14')]['message']);}logger['error'](_0x7131('0xf'),_0x55f1ad,_0xb52b80[_0x7131('0x14')][_0x7131('0x15')]);return _0x5a000d(_0xb52b80[_0x7131('0x14')][_0x7131('0x15')]);}else{logger[_0x7131('0xe')]('MailServerIn,\x20%s,\x20%s',_0x55f1ad,_0x7131('0x10'));_0x5a000d(_0xb52b80[_0x7131('0x16')][_0x7131('0x15')]);}})['catch'](function(_0x5f10ad){logger['error'](_0x7131('0xf'),_0x55f1ad,_0x5f10ad);_0x5eb292(_0x5f10ad);});});}exports[_0x7131('0x17')]=function(_0x209800){var _0x60f266=this;return new Promise(function(_0x9b940d,_0xfbb29a){return db[_0x7131('0x18')][_0x7131('0x19')]({'raw':_0x209800[_0x7131('0x1a')]?_0x209800[_0x7131('0x1a')][_0x7131('0x1b')]===undefined?!![]:![]:!![],'where':_0x209800[_0x7131('0x1a')]?_0x209800[_0x7131('0x1a')]['where']||null:null,'attributes':_0x209800['options']?_0x209800[_0x7131('0x1a')][_0x7131('0x1c')]||null:null,'limit':_0x209800['options']?_0x209800[_0x7131('0x1a')][_0x7131('0x1d')]||null:null,'include':_0x209800[_0x7131('0x1a')]?_0x209800['options'][_0x7131('0x1e')]?_[_0x7131('0x1f')](_0x209800[_0x7131('0x1a')]['include'],function(_0x5a6940){return{'model':db[_0x5a6940[_0x7131('0x20')]],'as':_0x5a6940['as'],'attributes':_0x5a6940[_0x7131('0x1c')],'include':_0x5a6940[_0x7131('0x1e')]?_[_0x7131('0x1f')](_0x5a6940[_0x7131('0x1e')],function(_0x2a39e5){return{'model':db[_0x2a39e5[_0x7131('0x20')]],'as':_0x2a39e5['as'],'attributes':_0x2a39e5[_0x7131('0x1c')],'include':_0x2a39e5['include']?_['map'](_0x2a39e5[_0x7131('0x1e')],function(_0x2d16b9){return{'model':db[_0x2d16b9[_0x7131('0x20')]],'as':_0x2d16b9['as'],'attributes':_0x2d16b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x7131('0xd')](function(_0x5c79e4){logger[_0x7131('0xe')](_0x7131('0x17'),_0x209800);logger[_0x7131('0x21')](_0x7131('0x17'),_0x209800,JSON[_0x7131('0x12')](_0x5c79e4));_0x9b940d(_0x5c79e4);})['catch'](function(_0x15b18a){logger['error'](_0x7131('0x17'),_0x15b18a['message'],_0x209800);_0xfbb29a(_0x60f266[_0x7131('0x14')](0x1f4,_0x15b18a[_0x7131('0x15')]));});});}; \ No newline at end of file +var _0xa35d=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','catch','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa35d,0x11f));var _0xda35=function(_0x14a54b,_0x3eec32){_0x14a54b=_0x14a54b-0x0;var _0x5b5e4b=_0xa35d[_0x14a54b];return _0x5b5e4b;};'use strict';var _=require(_0xda35('0x0'));var util=require('util');var moment=require(_0xda35('0x1'));var BPromise=require(_0xda35('0x2'));var rs=require(_0xda35('0x3'));var fs=require('fs');var Redis=require(_0xda35('0x4'));var db=require(_0xda35('0x5'))['db'];var utils=require(_0xda35('0x6'));var logger=require(_0xda35('0x7'))(_0xda35('0x8'));var config=require(_0xda35('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xda35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x374fea,_0x4725b0,_0x1972a2){return new BPromise(function(_0x54bbde,_0x23eb2a){return client[_0xda35('0xb')](_0x374fea,_0x1972a2)[_0xda35('0xc')](function(_0x11aa04){logger[_0xda35('0xd')](_0xda35('0xe'),_0x4725b0,_0xda35('0xf'));logger['debug']('MailServerIn,\x20%s,\x20%s,\x20%s',_0x4725b0,_0xda35('0xf'),JSON[_0xda35('0x10')](_0x11aa04));if(_0x11aa04[_0xda35('0x11')]){if(_0x11aa04[_0xda35('0x11')][_0xda35('0x12')]===0x1f4){logger['error'](_0xda35('0xe'),_0x4725b0,_0x11aa04[_0xda35('0x11')]['message']);return _0x23eb2a(_0x11aa04[_0xda35('0x11')][_0xda35('0x13')]);}logger[_0xda35('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4725b0,_0x11aa04[_0xda35('0x11')][_0xda35('0x13')]);return _0x54bbde(_0x11aa04[_0xda35('0x11')][_0xda35('0x13')]);}else{logger[_0xda35('0xd')]('MailServerIn,\x20%s,\x20%s',_0x4725b0,_0xda35('0xf'));_0x54bbde(_0x11aa04['result'][_0xda35('0x13')]);}})['catch'](function(_0x179b0a){logger[_0xda35('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4725b0,_0x179b0a);_0x23eb2a(_0x179b0a);});});}exports['GetMailServerIn']=function(_0x3c0cd7){var _0x2ee39b=this;return new Promise(function(_0x1fbf31,_0x1435ca){return db[_0xda35('0x14')][_0xda35('0x15')]({'raw':_0x3c0cd7[_0xda35('0x16')]?_0x3c0cd7[_0xda35('0x16')][_0xda35('0x17')]===undefined?!![]:![]:!![],'where':_0x3c0cd7[_0xda35('0x16')]?_0x3c0cd7['options'][_0xda35('0x18')]||null:null,'attributes':_0x3c0cd7[_0xda35('0x16')]?_0x3c0cd7[_0xda35('0x16')][_0xda35('0x19')]||null:null,'limit':_0x3c0cd7[_0xda35('0x16')]?_0x3c0cd7[_0xda35('0x16')][_0xda35('0x1a')]||null:null,'include':_0x3c0cd7[_0xda35('0x16')]?_0x3c0cd7[_0xda35('0x16')][_0xda35('0x1b')]?_[_0xda35('0x1c')](_0x3c0cd7[_0xda35('0x16')][_0xda35('0x1b')],function(_0x5323eb){return{'model':db[_0x5323eb[_0xda35('0x1d')]],'as':_0x5323eb['as'],'attributes':_0x5323eb[_0xda35('0x19')],'include':_0x5323eb[_0xda35('0x1b')]?_[_0xda35('0x1c')](_0x5323eb[_0xda35('0x1b')],function(_0x535fe1){return{'model':db[_0x535fe1[_0xda35('0x1d')]],'as':_0x535fe1['as'],'attributes':_0x535fe1[_0xda35('0x19')],'include':_0x535fe1[_0xda35('0x1b')]?_[_0xda35('0x1c')](_0x535fe1[_0xda35('0x1b')],function(_0x3c8f92){return{'model':db[_0x3c8f92[_0xda35('0x1d')]],'as':_0x3c8f92['as'],'attributes':_0x3c8f92[_0xda35('0x19')]};}):[]};}):[]};}):[]:[]})[_0xda35('0xc')](function(_0x217d45){logger['info'](_0xda35('0x1e'),_0x3c0cd7);logger['debug'](_0xda35('0x1e'),_0x3c0cd7,JSON[_0xda35('0x10')](_0x217d45));_0x1fbf31(_0x217d45);})[_0xda35('0x1f')](function(_0x41b4ba){logger[_0xda35('0x11')](_0xda35('0x1e'),_0x41b4ba['message'],_0x3c0cd7);_0x1435ca(_0x2ee39b[_0xda35('0x11')](0x1f4,_0x41b4ba[_0xda35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index ef06900..9d1a3d0 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x5d3769,_0x11d817){_0x5d3769=_0x5d3769-0x0;var _0x11dcf2=_0x7a54[_0x5d3769];return _0x11dcf2;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x7a54,0x106));var _0x47a5=function(_0x498d12,_0x174db9){_0x498d12=_0x498d12-0x0;var _0x59dfb1=_0x7a54[_0x498d12];return _0x59dfb1;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index bd08963..da0a1d4 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 _0xa571=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x316844,_0x3e0c2a){var _0x13d10b=function(_0x5b40c7){while(--_0x5b40c7){_0x316844['push'](_0x316844['shift']());}};_0x13d10b(++_0x3e0c2a);}(_0xa571,0x107));var _0x1a57=function(_0x3a23b4,_0x49d839){_0x3a23b4=_0x3a23b4-0x0;var _0x302bca=_0xa571[_0x3a23b4];return _0x302bca;};'use strict';var Sequelize=require(_0x1a57('0x0'));module[_0x1a57('0x1')]={'description':{'type':Sequelize[_0x1a57('0x2')]},'host':{'type':Sequelize[_0x1a57('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x1a57('0x2')]},'port':{'type':Sequelize[_0x1a57('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1a57('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1399=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x417803,_0x23f61d){var _0x5eb678=function(_0x3788f3){while(--_0x3788f3){_0x417803['push'](_0x417803['shift']());}};_0x5eb678(++_0x23f61d);}(_0x1399,0x16c));var _0x9139=function(_0x3a00a1,_0x38e90a){_0x3a00a1=_0x3a00a1-0x0;var _0x2a4828=_0x1399[_0x3a00a1];return _0x2a4828;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9139('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x9139('0x2')]},'port':{'type':Sequelize[_0x9139('0x3')]},'secure':{'type':Sequelize[_0x9139('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x9139('0x2')]},'authentication':{'type':Sequelize[_0x9139('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x9139('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 ff9321a..230dd2e 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 _0xd382=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','end','error','stack','name','send','index','map','MailServerOut','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','update','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x4479f0,_0x3ea727){var _0x51961c=function(_0x516aa4){while(--_0x516aa4){_0x4479f0['push'](_0x4479f0['shift']());}};_0x51961c(++_0x3ea727);}(_0xd382,0xcc));var _0x2d38=function(_0x2cc212,_0x583180){_0x2cc212=_0x2cc212-0x0;var _0xff497a=_0xd382[_0x2cc212];return _0xff497a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d38('0x0'));var jsonpatch=require(_0x2d38('0x1'));var rp=require(_0x2d38('0x2'));var moment=require('moment');var BPromise=require(_0x2d38('0x3'));var Mustache=require(_0x2d38('0x4'));var util=require(_0x2d38('0x5'));var path=require(_0x2d38('0x6'));var sox=require(_0x2d38('0x7'));var csv=require(_0x2d38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2d38('0x9'));var _=require(_0x2d38('0xa'));var squel=require(_0x2d38('0xb'));var crypto=require(_0x2d38('0xc'));var jsforce=require(_0x2d38('0xd'));var deskjs=require(_0x2d38('0xe'));var toCsv=require(_0x2d38('0x8'));var querystring=require('querystring');var Papa=require(_0x2d38('0xf'));var Redis=require(_0x2d38('0x10'));var authService=require(_0x2d38('0x11'));var qs=require(_0x2d38('0x12'));var as=require(_0x2d38('0x13'));var hardwareService=require(_0x2d38('0x14'));var logger=require(_0x2d38('0x15'))(_0x2d38('0x16'));var utils=require('../../config/utils');var config=require(_0x2d38('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc1f49d,_0x11a3ee){_0x11a3ee=_0x11a3ee||0xcc;return function(_0x46b772){if(_0x46b772){return _0xc1f49d[_0x2d38('0x18')](_0x11a3ee);}return _0xc1f49d[_0x2d38('0x19')](_0x11a3ee)['end']();};}function respondWithResult(_0x52f481,_0x98bd4e){_0x98bd4e=_0x98bd4e||0xc8;return function(_0x325484){if(_0x325484){return _0x52f481[_0x2d38('0x19')](_0x98bd4e)[_0x2d38('0x1a')](_0x325484);}};}function respondWithFilteredResult(_0xfa286,_0x1ed483){return function(_0x6b5f03){if(_0x6b5f03){var _0x684a82=typeof _0x1ed483['offset']===_0x2d38('0x1b')&&typeof _0x1ed483[_0x2d38('0x1c')]===_0x2d38('0x1b');var _0x40cba7=_0x6b5f03['count'];var _0x4b65ff=_0x684a82?0x0:_0x1ed483['offset'];var _0x207b1c=_0x684a82?_0x6b5f03[_0x2d38('0x1d')]:_0x1ed483[_0x2d38('0x1e')]+_0x1ed483[_0x2d38('0x1c')];var _0x3306c4;if(_0x207b1c>=_0x40cba7){_0x207b1c=_0x40cba7;_0x3306c4=0xc8;}else{_0x3306c4=0xce;}_0xfa286[_0x2d38('0x19')](_0x3306c4);return _0xfa286[_0x2d38('0x1f')]('Content-Range',_0x4b65ff+'-'+_0x207b1c+'/'+_0x40cba7)[_0x2d38('0x1a')](_0x6b5f03);}return null;};}function patchUpdates(_0x4d5323){return function(_0x6836c5){try{jsonpatch[_0x2d38('0x20')](_0x6836c5,_0x4d5323,!![]);}catch(_0xab4834){return BPromise[_0x2d38('0x21')](_0xab4834);}return _0x6836c5[_0x2d38('0x22')]();};}function saveUpdates(_0x535810,_0x514913){return function(_0x7c0329){if(_0x7c0329){return _0x7c0329['update'](_0x535810)['then'](function(_0x2f23bb){return _0x2f23bb;});}return null;};}function removeEntity(_0x48ddb,_0x1ede78){return function(_0x2cc3a5){if(_0x2cc3a5){return _0x2cc3a5[_0x2d38('0x23')]()[_0x2d38('0x24')](function(){_0x48ddb['status'](0xcc)[_0x2d38('0x25')]();});}};}function handleEntityNotFound(_0x468b69,_0x5b78d1){return function(_0x4166f7){if(!_0x4166f7){_0x468b69['sendStatus'](0x194);}return _0x4166f7;};}function handleError(_0x5d192c,_0x121be3){_0x121be3=_0x121be3||0x1f4;return function(_0x419312){logger[_0x2d38('0x26')](_0x419312[_0x2d38('0x27')]);if(_0x419312[_0x2d38('0x28')]){delete _0x419312[_0x2d38('0x28')];}_0x5d192c[_0x2d38('0x19')](_0x121be3)[_0x2d38('0x29')](_0x419312);};}exports[_0x2d38('0x2a')]=function(_0x5a2918,_0x22d6b9){var _0x396cad={},_0x5e971={},_0x3b0611={'count':0x0,'rows':[]};var _0xda2f7b=_[_0x2d38('0x2b')](db[_0x2d38('0x2c')][_0x2d38('0x2d')],function(_0x14a828){return{'name':_0x14a828['fieldName'],'type':_0x14a828['type']['key']};});_0x5e971[_0x2d38('0x2e')]=_['map'](_0xda2f7b,_0x2d38('0x28'));_0x5e971[_0x2d38('0x2f')]=_[_0x2d38('0x30')](_0x5a2918[_0x2d38('0x2f')]);_0x5e971[_0x2d38('0x31')]=_[_0x2d38('0x32')](_0x5e971['model'],_0x5e971[_0x2d38('0x2f')]);_0x396cad[_0x2d38('0x33')]=_[_0x2d38('0x32')](_0x5e971[_0x2d38('0x2e')],qs[_0x2d38('0x34')](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x34')]));_0x396cad[_0x2d38('0x33')]=_0x396cad[_0x2d38('0x33')][_0x2d38('0x35')]?_0x396cad[_0x2d38('0x33')]:_0x5e971[_0x2d38('0x2e')];if(!_0x5a2918[_0x2d38('0x2f')]['hasOwnProperty'](_0x2d38('0x36'))){_0x396cad[_0x2d38('0x1c')]=qs['limit'](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x1c')]);_0x396cad[_0x2d38('0x1e')]=qs[_0x2d38('0x1e')](_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x1e')]);}_0x396cad[_0x2d38('0x37')]=qs[_0x2d38('0x38')](_0x5a2918['query'][_0x2d38('0x38')]);_0x396cad[_0x2d38('0x39')]=qs['filters'](_[_0x2d38('0x3a')](_0x5a2918[_0x2d38('0x2f')],_0x5e971[_0x2d38('0x31')]),_0xda2f7b);if(_0x5a2918[_0x2d38('0x2f')]['filter']){_0x396cad['where']=_[_0x2d38('0x3b')](_0x396cad[_0x2d38('0x39')],{'$or':_[_0x2d38('0x2b')](_0xda2f7b,function(_0x1fc4e0){if(_0x1fc4e0[_0x2d38('0x3c')]!==_0x2d38('0x3d')){var _0x50ddf7={};_0x50ddf7[_0x1fc4e0[_0x2d38('0x28')]]={'$like':'%'+_0x5a2918['query']['filter']+'%'};return _0x50ddf7;}})});}_0x396cad=_[_0x2d38('0x3b')]({},_0x396cad,_0x5a2918[_0x2d38('0x3e')]);var _0x1865a3={'where':_0x396cad['where']};return db['MailServerOut']['count'](_0x1865a3)[_0x2d38('0x24')](function(_0x11aa03){_0x3b0611[_0x2d38('0x1d')]=_0x11aa03;if(_0x5a2918[_0x2d38('0x2f')][_0x2d38('0x3f')]){_0x396cad[_0x2d38('0x40')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x396cad);})[_0x2d38('0x24')](function(_0x3f0db7){_0x3b0611[_0x2d38('0x41')]=_0x3f0db7;return _0x3b0611;})[_0x2d38('0x24')](respondWithFilteredResult(_0x22d6b9,_0x396cad))[_0x2d38('0x42')](handleError(_0x22d6b9,null));};exports['show']=function(_0x5119ca,_0x12b5db){var _0x3dab27={'raw':!![],'where':{'id':_0x5119ca[_0x2d38('0x43')]['id']}},_0x2f9dac={};_0x2f9dac[_0x2d38('0x2e')]=_[_0x2d38('0x30')](db[_0x2d38('0x2c')]['rawAttributes']);_0x2f9dac[_0x2d38('0x2f')]=_['keys'](_0x5119ca[_0x2d38('0x2f')]);_0x2f9dac[_0x2d38('0x31')]=_[_0x2d38('0x32')](_0x2f9dac[_0x2d38('0x2e')],_0x2f9dac[_0x2d38('0x2f')]);_0x3dab27[_0x2d38('0x33')]=_[_0x2d38('0x32')](_0x2f9dac[_0x2d38('0x2e')],qs[_0x2d38('0x34')](_0x5119ca[_0x2d38('0x2f')]['fields']));_0x3dab27[_0x2d38('0x33')]=_0x3dab27['attributes'][_0x2d38('0x35')]?_0x3dab27['attributes']:_0x2f9dac[_0x2d38('0x2e')];if(_0x5119ca[_0x2d38('0x2f')][_0x2d38('0x3f')]){_0x3dab27[_0x2d38('0x40')]=[{'all':!![]}];}_0x3dab27=_[_0x2d38('0x3b')]({},_0x3dab27,_0x5119ca[_0x2d38('0x3e')]);return db[_0x2d38('0x2c')][_0x2d38('0x44')](_0x3dab27)[_0x2d38('0x24')](handleEntityNotFound(_0x12b5db,null))[_0x2d38('0x24')](respondWithResult(_0x12b5db,null))[_0x2d38('0x42')](handleError(_0x12b5db,null));};exports[_0x2d38('0x45')]=function(_0x4494c7,_0x189519){return db[_0x2d38('0x2c')][_0x2d38('0x45')](_0x4494c7[_0x2d38('0x46')],{})[_0x2d38('0x24')](respondWithResult(_0x189519,0xc9))['catch'](handleError(_0x189519,null));};exports[_0x2d38('0x47')]=function(_0x241a40,_0x5c157c){if(_0x241a40[_0x2d38('0x46')]['id']){delete _0x241a40[_0x2d38('0x46')]['id'];}return db[_0x2d38('0x2c')]['find']({'where':{'id':_0x241a40[_0x2d38('0x43')]['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x5c157c,null))[_0x2d38('0x24')](saveUpdates(_0x241a40[_0x2d38('0x46')],null))[_0x2d38('0x24')](respondWithResult(_0x5c157c,null))['catch'](handleError(_0x5c157c,null));};exports[_0x2d38('0x23')]=function(_0x597cce,_0x4d9429){return db[_0x2d38('0x2c')]['find']({'where':{'id':_0x597cce[_0x2d38('0x43')]['id']}})[_0x2d38('0x24')](handleEntityNotFound(_0x4d9429,null))[_0x2d38('0x24')](removeEntity(_0x4d9429,null))[_0x2d38('0x42')](handleError(_0x4d9429,null));}; \ No newline at end of file +var _0x49e0=['status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','params','length','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x2fb3ef,_0x5a6000){var _0x46f9fc=function(_0x4ef80f){while(--_0x4ef80f){_0x2fb3ef['push'](_0x2fb3ef['shift']());}};_0x46f9fc(++_0x5a6000);}(_0x49e0,0x156));var _0x049e=function(_0x49b70e,_0x555a52){_0x49b70e=_0x49b70e-0x0;var _0x3eb520=_0x49e0[_0x49b70e];return _0x3eb520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x049e('0x0'));var zipdir=require(_0x049e('0x1'));var jsonpatch=require(_0x049e('0x2'));var rp=require(_0x049e('0x3'));var moment=require(_0x049e('0x4'));var BPromise=require(_0x049e('0x5'));var Mustache=require(_0x049e('0x6'));var util=require(_0x049e('0x7'));var path=require('path');var sox=require(_0x049e('0x8'));var csv=require('to-csv');var ejs=require(_0x049e('0x9'));var fs=require('fs');var fs_extra=require(_0x049e('0xa'));var _=require(_0x049e('0xb'));var squel=require(_0x049e('0xc'));var crypto=require(_0x049e('0xd'));var jsforce=require(_0x049e('0xe'));var deskjs=require(_0x049e('0xf'));var toCsv=require(_0x049e('0x10'));var querystring=require(_0x049e('0x11'));var Papa=require(_0x049e('0x12'));var Redis=require('ioredis');var authService=require(_0x049e('0x13'));var qs=require(_0x049e('0x14'));var as=require(_0x049e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x049e('0x16'))('api');var utils=require(_0x049e('0x17'));var config=require(_0x049e('0x18'));var licenseUtil=require(_0x049e('0x19'));var db=require(_0x049e('0x1a'))['db'];function respondWithStatusCode(_0x2d399f,_0x1aaecc){_0x1aaecc=_0x1aaecc||0xcc;return function(_0x446869){if(_0x446869){return _0x2d399f[_0x049e('0x1b')](_0x1aaecc);}return _0x2d399f[_0x049e('0x1c')](_0x1aaecc)['end']();};}function respondWithResult(_0x4e20dc,_0x4fa978){_0x4fa978=_0x4fa978||0xc8;return function(_0x371197){if(_0x371197){return _0x4e20dc[_0x049e('0x1c')](_0x4fa978)[_0x049e('0x1d')](_0x371197);}};}function respondWithFilteredResult(_0x55f6da,_0x48cc54){return function(_0x6f6d6e){if(_0x6f6d6e){var _0x4347ce=typeof _0x48cc54[_0x049e('0x1e')]===_0x049e('0x1f')&&typeof _0x48cc54['limit']==='undefined';var _0x17a1d8=_0x6f6d6e[_0x049e('0x20')];var _0x13ecd2=_0x4347ce?0x0:_0x48cc54[_0x049e('0x1e')];var _0xb671f4=_0x4347ce?_0x6f6d6e['count']:_0x48cc54[_0x049e('0x1e')]+_0x48cc54[_0x049e('0x21')];var _0x462ea1;if(_0xb671f4>=_0x17a1d8){_0xb671f4=_0x17a1d8;_0x462ea1=0xc8;}else{_0x462ea1=0xce;}_0x55f6da[_0x049e('0x1c')](_0x462ea1);return _0x55f6da[_0x049e('0x22')](_0x049e('0x23'),_0x13ecd2+'-'+_0xb671f4+'/'+_0x17a1d8)[_0x049e('0x1d')](_0x6f6d6e);}return null;};}function patchUpdates(_0x5214bf){return function(_0x27ca83){try{jsonpatch[_0x049e('0x24')](_0x27ca83,_0x5214bf,!![]);}catch(_0x45f568){return BPromise[_0x049e('0x25')](_0x45f568);}return _0x27ca83[_0x049e('0x26')]();};}function saveUpdates(_0x5aed0f,_0x35767b){return function(_0x15237d){if(_0x15237d){return _0x15237d[_0x049e('0x27')](_0x5aed0f)['then'](function(_0xab76af){return _0xab76af;});}return null;};}function removeEntity(_0x34e684,_0x98e532){return function(_0x1f098d){if(_0x1f098d){return _0x1f098d[_0x049e('0x28')]()[_0x049e('0x29')](function(){_0x34e684[_0x049e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a1e92,_0x6a43df){return function(_0x7661c5){if(!_0x7661c5){_0x2a1e92[_0x049e('0x1b')](0x194);}return _0x7661c5;};}function handleError(_0x559996,_0x28d911){_0x28d911=_0x28d911||0x1f4;return function(_0x4d50ff){logger[_0x049e('0x2a')](_0x4d50ff['stack']);if(_0x4d50ff['name']){delete _0x4d50ff[_0x049e('0x2b')];}_0x559996[_0x049e('0x1c')](_0x28d911)[_0x049e('0x2c')](_0x4d50ff);};}exports[_0x049e('0x2d')]=function(_0x57a38e,_0x59030e){var _0x3752ff={},_0x2b3ebf={},_0x5dbabd={'count':0x0,'rows':[]};var _0x8fb40a=_[_0x049e('0x2e')](db[_0x049e('0x2f')][_0x049e('0x30')],function(_0x2d53dc){return{'name':_0x2d53dc[_0x049e('0x31')],'type':_0x2d53dc[_0x049e('0x32')][_0x049e('0x33')]};});_0x2b3ebf[_0x049e('0x34')]=_[_0x049e('0x2e')](_0x8fb40a,'name');_0x2b3ebf[_0x049e('0x35')]=_[_0x049e('0x36')](_0x57a38e['query']);_0x2b3ebf[_0x049e('0x37')]=_[_0x049e('0x38')](_0x2b3ebf[_0x049e('0x34')],_0x2b3ebf[_0x049e('0x35')]);_0x3752ff['attributes']=_[_0x049e('0x38')](_0x2b3ebf[_0x049e('0x34')],qs[_0x049e('0x39')](_0x57a38e[_0x049e('0x35')][_0x049e('0x39')]));_0x3752ff['attributes']=_0x3752ff[_0x049e('0x3a')]['length']?_0x3752ff[_0x049e('0x3a')]:_0x2b3ebf['model'];if(!_0x57a38e[_0x049e('0x35')]['hasOwnProperty'](_0x049e('0x3b'))){_0x3752ff[_0x049e('0x21')]=qs[_0x049e('0x21')](_0x57a38e[_0x049e('0x35')]['limit']);_0x3752ff[_0x049e('0x1e')]=qs['offset'](_0x57a38e[_0x049e('0x35')][_0x049e('0x1e')]);}_0x3752ff['order']=qs[_0x049e('0x3c')](_0x57a38e[_0x049e('0x35')][_0x049e('0x3c')]);_0x3752ff[_0x049e('0x3d')]=qs[_0x049e('0x37')](_[_0x049e('0x3e')](_0x57a38e[_0x049e('0x35')],_0x2b3ebf['filters']),_0x8fb40a);if(_0x57a38e[_0x049e('0x35')]['filter']){_0x3752ff[_0x049e('0x3d')]=_[_0x049e('0x3f')](_0x3752ff['where'],{'$or':_[_0x049e('0x2e')](_0x8fb40a,function(_0x9cf3d){if(_0x9cf3d[_0x049e('0x32')]!==_0x049e('0x40')){var _0x3d1290={};_0x3d1290[_0x9cf3d[_0x049e('0x2b')]]={'$like':'%'+_0x57a38e[_0x049e('0x35')]['filter']+'%'};return _0x3d1290;}})});}_0x3752ff=_['merge']({},_0x3752ff,_0x57a38e[_0x049e('0x41')]);var _0x4c6769={'where':_0x3752ff['where']};return db[_0x049e('0x2f')][_0x049e('0x20')](_0x4c6769)['then'](function(_0x2df410){_0x5dbabd[_0x049e('0x20')]=_0x2df410;if(_0x57a38e[_0x049e('0x35')][_0x049e('0x42')]){_0x3752ff[_0x049e('0x43')]=[{'all':!![]}];}return db[_0x049e('0x2f')]['findAll'](_0x3752ff);})['then'](function(_0x2e08b0){_0x5dbabd[_0x049e('0x44')]=_0x2e08b0;return _0x5dbabd;})[_0x049e('0x29')](respondWithFilteredResult(_0x59030e,_0x3752ff))[_0x049e('0x45')](handleError(_0x59030e,null));};exports['show']=function(_0x5dfff9,_0x2212bc){var _0x36783f={'raw':!![],'where':{'id':_0x5dfff9[_0x049e('0x46')]['id']}},_0xce2bc6={};_0xce2bc6[_0x049e('0x34')]=_[_0x049e('0x36')](db[_0x049e('0x2f')]['rawAttributes']);_0xce2bc6[_0x049e('0x35')]=_['keys'](_0x5dfff9[_0x049e('0x35')]);_0xce2bc6['filters']=_[_0x049e('0x38')](_0xce2bc6[_0x049e('0x34')],_0xce2bc6[_0x049e('0x35')]);_0x36783f[_0x049e('0x3a')]=_[_0x049e('0x38')](_0xce2bc6['model'],qs[_0x049e('0x39')](_0x5dfff9[_0x049e('0x35')][_0x049e('0x39')]));_0x36783f[_0x049e('0x3a')]=_0x36783f['attributes'][_0x049e('0x47')]?_0x36783f[_0x049e('0x3a')]:_0xce2bc6['model'];if(_0x5dfff9[_0x049e('0x35')]['includeAll']){_0x36783f['include']=[{'all':!![]}];}_0x36783f=_[_0x049e('0x3f')]({},_0x36783f,_0x5dfff9[_0x049e('0x41')]);return db[_0x049e('0x2f')]['find'](_0x36783f)[_0x049e('0x29')](handleEntityNotFound(_0x2212bc,null))[_0x049e('0x29')](respondWithResult(_0x2212bc,null))[_0x049e('0x45')](handleError(_0x2212bc,null));};exports[_0x049e('0x48')]=function(_0x327580,_0x2bee58){return db[_0x049e('0x2f')][_0x049e('0x48')](_0x327580[_0x049e('0x49')],{})[_0x049e('0x29')](respondWithResult(_0x2bee58,0xc9))[_0x049e('0x45')](handleError(_0x2bee58,null));};exports[_0x049e('0x27')]=function(_0x2908fc,_0x1cc010){if(_0x2908fc[_0x049e('0x49')]['id']){delete _0x2908fc[_0x049e('0x49')]['id'];}return db[_0x049e('0x2f')]['find']({'where':{'id':_0x2908fc[_0x049e('0x46')]['id']}})[_0x049e('0x29')](handleEntityNotFound(_0x1cc010,null))['then'](saveUpdates(_0x2908fc[_0x049e('0x49')],null))[_0x049e('0x29')](respondWithResult(_0x1cc010,null))[_0x049e('0x45')](handleError(_0x1cc010,null));};exports['destroy']=function(_0x171ebb,_0x134da3){return db[_0x049e('0x2f')]['find']({'where':{'id':_0x171ebb[_0x049e('0x46')]['id']}})[_0x049e('0x29')](handleEntityNotFound(_0x134da3,null))[_0x049e('0x29')](removeEntity(_0x134da3,null))[_0x049e('0x45')](handleError(_0x134da3,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c639964..6e6325c 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 _0x9b38=['request-promise','path','../../config/environment','exports','define','mail_servers_out','lodash','util','api','moment','bluebird'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x9b38,0x7f));var _0x89b3=function(_0x5914a5,_0x1300e3){_0x5914a5=_0x5914a5-0x0;var _0x32922e=_0x9b38[_0x5914a5];return _0x32922e;};'use strict';var _=require(_0x89b3('0x0'));var util=require(_0x89b3('0x1'));var logger=require('../../config/logger')(_0x89b3('0x2'));var moment=require(_0x89b3('0x3'));var BPromise=require(_0x89b3('0x4'));var rp=require(_0x89b3('0x5'));var fs=require('fs');var path=require(_0x89b3('0x6'));var rimraf=require('rimraf');var config=require(_0x89b3('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x89b3('0x8')]=function(_0x447b62,_0x279974){return _0x447b62[_0x89b3('0x9')]('MailServerOut',attributes,{'tableName':_0x89b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32bc=['api','moment','bluebird','request-promise','../../config/environment','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger'];(function(_0x11f7e4,_0x195c63){var _0x2bc69b=function(_0xae44b5){while(--_0xae44b5){_0x11f7e4['push'](_0x11f7e4['shift']());}};_0x2bc69b(++_0x195c63);}(_0x32bc,0x11d));var _0xc32b=function(_0x223c26,_0x53099c){_0x223c26=_0x223c26-0x0;var _0x17a8b8=_0x32bc[_0x223c26];return _0x17a8b8;};'use strict';var _=require(_0xc32b('0x0'));var util=require(_0xc32b('0x1'));var logger=require(_0xc32b('0x2'))(_0xc32b('0x3'));var moment=require(_0xc32b('0x4'));var BPromise=require(_0xc32b('0x5'));var rp=require(_0xc32b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc32b('0x7'));var attributes=require(_0xc32b('0x8'));module['exports']=function(_0x366a9c,_0x10a379){return _0x366a9c[_0xc32b('0x9')](_0xc32b('0xa'),attributes,{'tableName':_0xc32b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 61d556d..b7f2660 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ddef8,_0x3c78fe){var _0x456403=function(_0x439273){while(--_0x439273){_0x4ddef8['push'](_0x4ddef8['shift']());}};_0x456403(++_0x3c78fe);}(_0x2ef3,0xba));var _0x32ef=function(_0x42dcca,_0x1638d5){_0x42dcca=_0x42dcca-0x0;var _0x38e78a=_0x2ef3[_0x42dcca];return _0x38e78a;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x200aac,_0x4dd090){var _0x3339b9=function(_0x544545){while(--_0x544545){_0x200aac['push'](_0x200aac['shift']());}};_0x3339b9(++_0x4dd090);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index b5c4d1a..f7d8cd6 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 _0xdc4d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','multer','util','path','connect-timeout'];(function(_0x360731,_0x58e409){var _0x13d84a=function(_0xaff662){while(--_0xaff662){_0x360731['push'](_0x360731['shift']());}};_0x13d84a(++_0x58e409);}(_0xdc4d,0x172));var _0xddc4=function(_0x1935a3,_0x2a23b4){_0x1935a3=_0x1935a3-0x0;var _0xf8d54c=_0xdc4d[_0x1935a3];return _0xf8d54c;};'use strict';var multer=require(_0xddc4('0x0'));var util=require(_0xddc4('0x1'));var path=require(_0xddc4('0x2'));var timeout=require(_0xddc4('0x3'));var express=require(_0xddc4('0x4'));var router=express[_0xddc4('0x5')]();var fs_extra=require(_0xddc4('0x6'));var auth=require(_0xddc4('0x7'));var interaction=require(_0xddc4('0x8'));var config=require(_0xddc4('0x9'));var controller=require('./mailSubstatus.controller');router[_0xddc4('0xa')]('/',auth['isAuthenticated'](),controller[_0xddc4('0xb')]);router[_0xddc4('0xa')](_0xddc4('0xc'),auth[_0xddc4('0xd')](),controller[_0xddc4('0xe')]);router['get']('/:id',auth[_0xddc4('0xd')](),controller[_0xddc4('0xf')]);router[_0xddc4('0x10')]('/',auth[_0xddc4('0xd')](),controller[_0xddc4('0x11')]);router[_0xddc4('0x12')](_0xddc4('0x13'),auth['isAuthenticated'](),controller[_0xddc4('0x14')]);router['delete'](_0xddc4('0x13'),auth['isAuthenticated'](),controller[_0xddc4('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2bfa=['show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x2bfa,0xa4));var _0xa2bf=function(_0x7a9ddf,_0x49fd56){_0x7a9ddf=_0x7a9ddf-0x0;var _0x293bd8=_0x2bfa[_0x7a9ddf];return _0x293bd8;};'use strict';var multer=require('multer');var util=require(_0xa2bf('0x0'));var path=require(_0xa2bf('0x1'));var timeout=require(_0xa2bf('0x2'));var express=require(_0xa2bf('0x3'));var router=express[_0xa2bf('0x4')]();var fs_extra=require(_0xa2bf('0x5'));var auth=require(_0xa2bf('0x6'));var interaction=require(_0xa2bf('0x7'));var config=require(_0xa2bf('0x8'));var controller=require(_0xa2bf('0x9'));router[_0xa2bf('0xa')]('/',auth[_0xa2bf('0xb')](),controller[_0xa2bf('0xc')]);router[_0xa2bf('0xa')](_0xa2bf('0xd'),auth['isAuthenticated'](),controller[_0xa2bf('0xe')]);router[_0xa2bf('0xa')](_0xa2bf('0xf'),auth[_0xa2bf('0xb')](),controller[_0xa2bf('0x10')]);router['post']('/',auth[_0xa2bf('0xb')](),controller[_0xa2bf('0x11')]);router['put'](_0xa2bf('0xf'),auth['isAuthenticated'](),controller['update']);router[_0xa2bf('0x12')](_0xa2bf('0xf'),auth[_0xa2bf('0xb')](),controller[_0xa2bf('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 3ea5078..cd39138 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 _0xacf4=['name','STRING'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xacf4,0xe7));var _0x4acf=function(_0x41c358,_0xb928de){_0x41c358=_0x41c358-0x0;var _0x25a609=_0xacf4[_0x41c358];return _0x25a609;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4acf('0x0')],'unique':_0x4acf('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4acf('0x0')]}}; \ No newline at end of file +var _0x6050=['STRING','name','sequelize','exports'];(function(_0x2f279c,_0x30260b){var _0x118f9c=function(_0x360969){while(--_0x360969){_0x2f279c['push'](_0x2f279c['shift']());}};_0x118f9c(++_0x30260b);}(_0x6050,0x196));var _0x0605=function(_0x52b687,_0x4d8209){_0x52b687=_0x52b687-0x0;var _0x4b4655=_0x6050[_0x52b687];return _0x4b4655;};'use strict';var Sequelize=require(_0x0605('0x0'));module[_0x0605('0x1')]={'name':{'type':Sequelize[_0x0605('0x2')],'unique':_0x0605('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0605('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index a341cd5..76b8102 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 _0x6e1e=['reject','save','update','then','destroy','error','stack','name','send','MailSubstatus','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x57fe33,_0x2769c0){var _0x3d2a5b=function(_0x198aa7){while(--_0x198aa7){_0x57fe33['push'](_0x57fe33['shift']());}};_0x3d2a5b(++_0x2769c0);}(_0x6e1e,0x10a));var _0xe6e1=function(_0x263de9,_0x433882){_0x263de9=_0x263de9-0x0;var _0x2707f8=_0x6e1e[_0x263de9];return _0x2707f8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe6e1('0x0'));var zipdir=require(_0xe6e1('0x1'));var jsonpatch=require(_0xe6e1('0x2'));var rp=require('request-promise');var moment=require(_0xe6e1('0x3'));var BPromise=require(_0xe6e1('0x4'));var Mustache=require('mustache');var util=require(_0xe6e1('0x5'));var path=require(_0xe6e1('0x6'));var sox=require(_0xe6e1('0x7'));var csv=require(_0xe6e1('0x8'));var ejs=require(_0xe6e1('0x9'));var fs=require('fs');var fs_extra=require(_0xe6e1('0xa'));var _=require(_0xe6e1('0xb'));var squel=require(_0xe6e1('0xc'));var crypto=require('crypto');var jsforce=require(_0xe6e1('0xd'));var deskjs=require(_0xe6e1('0xe'));var toCsv=require(_0xe6e1('0x8'));var querystring=require(_0xe6e1('0xf'));var Papa=require(_0xe6e1('0x10'));var Redis=require(_0xe6e1('0x11'));var authService=require(_0xe6e1('0x12'));var qs=require(_0xe6e1('0x13'));var as=require(_0xe6e1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6e1('0x15'))(_0xe6e1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe6e1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ef476,_0x8cccf){_0x8cccf=_0x8cccf||0xcc;return function(_0x78a9bf){if(_0x78a9bf){return _0x4ef476[_0xe6e1('0x18')](_0x8cccf);}return _0x4ef476['status'](_0x8cccf)[_0xe6e1('0x19')]();};}function respondWithResult(_0x32435c,_0x55e90a){_0x55e90a=_0x55e90a||0xc8;return function(_0x103475){if(_0x103475){return _0x32435c['status'](_0x55e90a)[_0xe6e1('0x1a')](_0x103475);}};}function respondWithFilteredResult(_0x420b94,_0x14ecd8){return function(_0x23c4b0){if(_0x23c4b0){var _0x5af81c=typeof _0x14ecd8[_0xe6e1('0x1b')]===_0xe6e1('0x1c')&&typeof _0x14ecd8[_0xe6e1('0x1d')]===_0xe6e1('0x1c');var _0x3a2e9e=_0x23c4b0[_0xe6e1('0x1e')];var _0x4b422d=_0x5af81c?0x0:_0x14ecd8[_0xe6e1('0x1b')];var _0x115322=_0x5af81c?_0x23c4b0['count']:_0x14ecd8[_0xe6e1('0x1b')]+_0x14ecd8['limit'];var _0x89cfcd;if(_0x115322>=_0x3a2e9e){_0x115322=_0x3a2e9e;_0x89cfcd=0xc8;}else{_0x89cfcd=0xce;}_0x420b94[_0xe6e1('0x1f')](_0x89cfcd);return _0x420b94[_0xe6e1('0x20')](_0xe6e1('0x21'),_0x4b422d+'-'+_0x115322+'/'+_0x3a2e9e)[_0xe6e1('0x1a')](_0x23c4b0);}return null;};}function patchUpdates(_0x37d454){return function(_0x1793ef){try{jsonpatch['apply'](_0x1793ef,_0x37d454,!![]);}catch(_0x88d38){return BPromise[_0xe6e1('0x22')](_0x88d38);}return _0x1793ef[_0xe6e1('0x23')]();};}function saveUpdates(_0x2bede9,_0x2ebf5a){return function(_0x50cc78){if(_0x50cc78){return _0x50cc78[_0xe6e1('0x24')](_0x2bede9)[_0xe6e1('0x25')](function(_0x346b1d){return _0x346b1d;});}return null;};}function removeEntity(_0x551cc5,_0x152fa7){return function(_0x13bd04){if(_0x13bd04){return _0x13bd04[_0xe6e1('0x26')]()[_0xe6e1('0x25')](function(){_0x551cc5[_0xe6e1('0x1f')](0xcc)[_0xe6e1('0x19')]();});}};}function handleEntityNotFound(_0x469949,_0x4fa47e){return function(_0x32fd7d){if(!_0x32fd7d){_0x469949['sendStatus'](0x194);}return _0x32fd7d;};}function handleError(_0x28da84,_0x33302a){_0x33302a=_0x33302a||0x1f4;return function(_0xfe0007){logger[_0xe6e1('0x27')](_0xfe0007[_0xe6e1('0x28')]);if(_0xfe0007[_0xe6e1('0x29')]){delete _0xfe0007[_0xe6e1('0x29')];}_0x28da84[_0xe6e1('0x1f')](_0x33302a)[_0xe6e1('0x2a')](_0xfe0007);};}exports['index']=function(_0x346f63,_0x954baf){var _0x5bff19={},_0x21f596={},_0x34bace={'count':0x0,'rows':[]};var _0x24a508=_['map'](db[_0xe6e1('0x2b')][_0xe6e1('0x2c')],function(_0x2cb50f){return{'name':_0x2cb50f[_0xe6e1('0x2d')],'type':_0x2cb50f[_0xe6e1('0x2e')][_0xe6e1('0x2f')]};});_0x21f596[_0xe6e1('0x30')]=_['map'](_0x24a508,_0xe6e1('0x29'));_0x21f596[_0xe6e1('0x31')]=_[_0xe6e1('0x32')](_0x346f63[_0xe6e1('0x31')]);_0x21f596[_0xe6e1('0x33')]=_['intersection'](_0x21f596[_0xe6e1('0x30')],_0x21f596['query']);_0x5bff19['attributes']=_[_0xe6e1('0x34')](_0x21f596[_0xe6e1('0x30')],qs[_0xe6e1('0x35')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x35')]));_0x5bff19[_0xe6e1('0x36')]=_0x5bff19[_0xe6e1('0x36')][_0xe6e1('0x37')]?_0x5bff19['attributes']:_0x21f596[_0xe6e1('0x30')];if(!_0x346f63[_0xe6e1('0x31')]['hasOwnProperty']('nolimit')){_0x5bff19['limit']=qs[_0xe6e1('0x1d')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x1d')]);_0x5bff19[_0xe6e1('0x1b')]=qs[_0xe6e1('0x1b')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x1b')]);}_0x5bff19[_0xe6e1('0x38')]=qs[_0xe6e1('0x39')](_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x39')]);_0x5bff19['where']=qs[_0xe6e1('0x33')](_[_0xe6e1('0x3a')](_0x346f63['query'],_0x21f596['filters']),_0x24a508);if(_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x3b')]){_0x5bff19[_0xe6e1('0x3c')]=_['merge'](_0x5bff19['where'],{'$or':_[_0xe6e1('0x3d')](_0x24a508,function(_0x30ee93){if(_0x30ee93[_0xe6e1('0x2e')]!==_0xe6e1('0x3e')){var _0x1ccd3b={};_0x1ccd3b[_0x30ee93['name']]={'$like':'%'+_0x346f63['query'][_0xe6e1('0x3b')]+'%'};return _0x1ccd3b;}})});}_0x5bff19=_['merge']({},_0x5bff19,_0x346f63[_0xe6e1('0x3f')]);var _0x1f12ed={'where':_0x5bff19[_0xe6e1('0x3c')]};return db[_0xe6e1('0x2b')][_0xe6e1('0x1e')](_0x1f12ed)[_0xe6e1('0x25')](function(_0x5656fa){_0x34bace[_0xe6e1('0x1e')]=_0x5656fa;if(_0x346f63[_0xe6e1('0x31')][_0xe6e1('0x40')]){_0x5bff19[_0xe6e1('0x41')]=[{'all':!![]}];}return db[_0xe6e1('0x2b')][_0xe6e1('0x42')](_0x5bff19);})[_0xe6e1('0x25')](function(_0x2b95c0){_0x34bace[_0xe6e1('0x43')]=_0x2b95c0;return _0x34bace;})['then'](respondWithFilteredResult(_0x954baf,_0x5bff19))['catch'](handleError(_0x954baf,null));};exports[_0xe6e1('0x44')]=function(_0x32f2f1,_0x1e269a){var _0x3d8c16={'raw':!![],'where':{'id':_0x32f2f1[_0xe6e1('0x45')]['id']}},_0x24d744={};_0x24d744['model']=_[_0xe6e1('0x32')](db[_0xe6e1('0x2b')][_0xe6e1('0x2c')]);_0x24d744[_0xe6e1('0x31')]=_[_0xe6e1('0x32')](_0x32f2f1[_0xe6e1('0x31')]);_0x24d744[_0xe6e1('0x33')]=_['intersection'](_0x24d744[_0xe6e1('0x30')],_0x24d744['query']);_0x3d8c16[_0xe6e1('0x36')]=_[_0xe6e1('0x34')](_0x24d744[_0xe6e1('0x30')],qs[_0xe6e1('0x35')](_0x32f2f1[_0xe6e1('0x31')]['fields']));_0x3d8c16['attributes']=_0x3d8c16[_0xe6e1('0x36')]['length']?_0x3d8c16[_0xe6e1('0x36')]:_0x24d744[_0xe6e1('0x30')];if(_0x32f2f1[_0xe6e1('0x31')][_0xe6e1('0x40')]){_0x3d8c16['include']=[{'all':!![]}];}_0x3d8c16=_[_0xe6e1('0x46')]({},_0x3d8c16,_0x32f2f1[_0xe6e1('0x3f')]);return db[_0xe6e1('0x2b')]['find'](_0x3d8c16)[_0xe6e1('0x25')](handleEntityNotFound(_0x1e269a,null))[_0xe6e1('0x25')](respondWithResult(_0x1e269a,null))['catch'](handleError(_0x1e269a,null));};exports[_0xe6e1('0x47')]=function(_0x5290e0,_0x2513df){return db[_0xe6e1('0x2b')][_0xe6e1('0x47')](_0x5290e0['body'],{})['then'](respondWithResult(_0x2513df,0xc9))['catch'](handleError(_0x2513df,null));};exports['update']=function(_0x3e4ba6,_0xf3193c){if(_0x3e4ba6[_0xe6e1('0x48')]['id']){delete _0x3e4ba6['body']['id'];}return db[_0xe6e1('0x2b')]['find']({'where':{'id':_0x3e4ba6[_0xe6e1('0x45')]['id']}})['then'](handleEntityNotFound(_0xf3193c,null))[_0xe6e1('0x25')](saveUpdates(_0x3e4ba6[_0xe6e1('0x48')],null))[_0xe6e1('0x25')](respondWithResult(_0xf3193c,null))['catch'](handleError(_0xf3193c,null));};exports[_0xe6e1('0x26')]=function(_0x35758b,_0x57c1ea){return db[_0xe6e1('0x2b')]['find']({'where':{'id':_0x35758b[_0xe6e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x57c1ea,null))[_0xe6e1('0x25')](removeEntity(_0x57c1ea,null))[_0xe6e1('0x49')](handleError(_0x57c1ea,null));};exports[_0xe6e1('0x4a')]=function(_0x196c0d,_0x1bafaf){return db[_0xe6e1('0x2b')][_0xe6e1('0x4a')]()[_0xe6e1('0x25')](respondWithResult(_0x1bafaf,null))[_0xe6e1('0x49')](handleError(_0x1bafaf,null));}; \ No newline at end of file +var _0x94b7=['sort','where','filters','pick','filter','merge','options','includeAll','include','rows','keys','rawAttributes','find','catch','create','update','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','then','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order'];(function(_0x299ce7,_0x3e2c0a){var _0x4c5253=function(_0x3febf1){while(--_0x3febf1){_0x299ce7['push'](_0x299ce7['shift']());}};_0x4c5253(++_0x3e2c0a);}(_0x94b7,0x1ee));var _0x794b=function(_0x3e7299,_0x3c151c){_0x3e7299=_0x3e7299-0x0;var _0x3e9602=_0x94b7[_0x3e7299];return _0x3e9602;};'use strict';var emlformat=require(_0x794b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x794b('0x1'));var jsonpatch=require(_0x794b('0x2'));var rp=require('request-promise');var moment=require(_0x794b('0x3'));var BPromise=require(_0x794b('0x4'));var Mustache=require(_0x794b('0x5'));var util=require(_0x794b('0x6'));var path=require(_0x794b('0x7'));var sox=require('sox');var csv=require(_0x794b('0x8'));var ejs=require(_0x794b('0x9'));var fs=require('fs');var fs_extra=require(_0x794b('0xa'));var _=require(_0x794b('0xb'));var squel=require(_0x794b('0xc'));var crypto=require(_0x794b('0xd'));var jsforce=require(_0x794b('0xe'));var deskjs=require(_0x794b('0xf'));var toCsv=require(_0x794b('0x8'));var querystring=require(_0x794b('0x10'));var Papa=require(_0x794b('0x11'));var Redis=require(_0x794b('0x12'));var authService=require(_0x794b('0x13'));var qs=require(_0x794b('0x14'));var as=require(_0x794b('0x15'));var hardwareService=require(_0x794b('0x16'));var logger=require('../../config/logger')(_0x794b('0x17'));var utils=require(_0x794b('0x18'));var config=require(_0x794b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x794b('0x1a'))['db'];function respondWithStatusCode(_0x2028f6,_0x269bfd){_0x269bfd=_0x269bfd||0xcc;return function(_0x341d7d){if(_0x341d7d){return _0x2028f6[_0x794b('0x1b')](_0x269bfd);}return _0x2028f6[_0x794b('0x1c')](_0x269bfd)[_0x794b('0x1d')]();};}function respondWithResult(_0x53b265,_0x514e51){_0x514e51=_0x514e51||0xc8;return function(_0x4ae39c){if(_0x4ae39c){return _0x53b265[_0x794b('0x1c')](_0x514e51)['json'](_0x4ae39c);}};}function respondWithFilteredResult(_0x3e8069,_0x327aba){return function(_0x1f5037){if(_0x1f5037){var _0x14e41d=typeof _0x327aba[_0x794b('0x1e')]===_0x794b('0x1f')&&typeof _0x327aba[_0x794b('0x20')]===_0x794b('0x1f');var _0x3e90a4=_0x1f5037[_0x794b('0x21')];var _0x88b205=_0x14e41d?0x0:_0x327aba['offset'];var _0x365d8c=_0x14e41d?_0x1f5037['count']:_0x327aba['offset']+_0x327aba[_0x794b('0x20')];var _0x4764bb;if(_0x365d8c>=_0x3e90a4){_0x365d8c=_0x3e90a4;_0x4764bb=0xc8;}else{_0x4764bb=0xce;}_0x3e8069['status'](_0x4764bb);return _0x3e8069[_0x794b('0x22')]('Content-Range',_0x88b205+'-'+_0x365d8c+'/'+_0x3e90a4)[_0x794b('0x23')](_0x1f5037);}return null;};}function patchUpdates(_0xe88e81){return function(_0x13bcfb){try{jsonpatch[_0x794b('0x24')](_0x13bcfb,_0xe88e81,!![]);}catch(_0x920408){return BPromise[_0x794b('0x25')](_0x920408);}return _0x13bcfb[_0x794b('0x26')]();};}function saveUpdates(_0x33e20a,_0xe2dc04){return function(_0x10d877){if(_0x10d877){return _0x10d877['update'](_0x33e20a)[_0x794b('0x27')](function(_0x316dc3){return _0x316dc3;});}return null;};}function removeEntity(_0x7417c2,_0x13233d){return function(_0x2ef608){if(_0x2ef608){return _0x2ef608['destroy']()[_0x794b('0x27')](function(){_0x7417c2[_0x794b('0x1c')](0xcc)[_0x794b('0x1d')]();});}};}function handleEntityNotFound(_0x1b179d,_0x39cebe){return function(_0x59ef08){if(!_0x59ef08){_0x1b179d[_0x794b('0x1b')](0x194);}return _0x59ef08;};}function handleError(_0x248435,_0x551b69){_0x551b69=_0x551b69||0x1f4;return function(_0x56f673){logger[_0x794b('0x28')](_0x56f673[_0x794b('0x29')]);if(_0x56f673[_0x794b('0x2a')]){delete _0x56f673['name'];}_0x248435[_0x794b('0x1c')](_0x551b69)[_0x794b('0x2b')](_0x56f673);};}exports[_0x794b('0x2c')]=function(_0x4421e8,_0x4e6364){var _0x12286c={},_0x915161={},_0x2f8861={'count':0x0,'rows':[]};var _0x2e9130=_[_0x794b('0x2d')](db[_0x794b('0x2e')]['rawAttributes'],function(_0x59ec8a){return{'name':_0x59ec8a[_0x794b('0x2f')],'type':_0x59ec8a[_0x794b('0x30')][_0x794b('0x31')]};});_0x915161[_0x794b('0x32')]=_[_0x794b('0x2d')](_0x2e9130,_0x794b('0x2a'));_0x915161['query']=_['keys'](_0x4421e8['query']);_0x915161['filters']=_[_0x794b('0x33')](_0x915161[_0x794b('0x32')],_0x915161['query']);_0x12286c[_0x794b('0x34')]=_[_0x794b('0x33')](_0x915161[_0x794b('0x32')],qs[_0x794b('0x35')](_0x4421e8[_0x794b('0x36')][_0x794b('0x35')]));_0x12286c[_0x794b('0x34')]=_0x12286c[_0x794b('0x34')][_0x794b('0x37')]?_0x12286c[_0x794b('0x34')]:_0x915161[_0x794b('0x32')];if(!_0x4421e8['query'][_0x794b('0x38')](_0x794b('0x39'))){_0x12286c[_0x794b('0x20')]=qs[_0x794b('0x20')](_0x4421e8[_0x794b('0x36')][_0x794b('0x20')]);_0x12286c[_0x794b('0x1e')]=qs['offset'](_0x4421e8[_0x794b('0x36')][_0x794b('0x1e')]);}_0x12286c[_0x794b('0x3a')]=qs['sort'](_0x4421e8[_0x794b('0x36')][_0x794b('0x3b')]);_0x12286c[_0x794b('0x3c')]=qs[_0x794b('0x3d')](_[_0x794b('0x3e')](_0x4421e8[_0x794b('0x36')],_0x915161[_0x794b('0x3d')]),_0x2e9130);if(_0x4421e8[_0x794b('0x36')][_0x794b('0x3f')]){_0x12286c[_0x794b('0x3c')]=_[_0x794b('0x40')](_0x12286c[_0x794b('0x3c')],{'$or':_[_0x794b('0x2d')](_0x2e9130,function(_0x5f3b1b){if(_0x5f3b1b[_0x794b('0x30')]!=='VIRTUAL'){var _0x1c5e3a={};_0x1c5e3a[_0x5f3b1b[_0x794b('0x2a')]]={'$like':'%'+_0x4421e8[_0x794b('0x36')]['filter']+'%'};return _0x1c5e3a;}})});}_0x12286c=_[_0x794b('0x40')]({},_0x12286c,_0x4421e8[_0x794b('0x41')]);var _0x44d434={'where':_0x12286c[_0x794b('0x3c')]};return db[_0x794b('0x2e')][_0x794b('0x21')](_0x44d434)[_0x794b('0x27')](function(_0x52d73){_0x2f8861[_0x794b('0x21')]=_0x52d73;if(_0x4421e8['query'][_0x794b('0x42')]){_0x12286c[_0x794b('0x43')]=[{'all':!![]}];}return db[_0x794b('0x2e')]['findAll'](_0x12286c);})[_0x794b('0x27')](function(_0x4624fd){_0x2f8861[_0x794b('0x44')]=_0x4624fd;return _0x2f8861;})[_0x794b('0x27')](respondWithFilteredResult(_0x4e6364,_0x12286c))['catch'](handleError(_0x4e6364,null));};exports['show']=function(_0x4ba3f1,_0x453649){var _0x2b7421={'raw':!![],'where':{'id':_0x4ba3f1['params']['id']}},_0x503813={};_0x503813[_0x794b('0x32')]=_[_0x794b('0x45')](db[_0x794b('0x2e')][_0x794b('0x46')]);_0x503813['query']=_[_0x794b('0x45')](_0x4ba3f1[_0x794b('0x36')]);_0x503813['filters']=_[_0x794b('0x33')](_0x503813['model'],_0x503813[_0x794b('0x36')]);_0x2b7421['attributes']=_[_0x794b('0x33')](_0x503813[_0x794b('0x32')],qs[_0x794b('0x35')](_0x4ba3f1['query']['fields']));_0x2b7421[_0x794b('0x34')]=_0x2b7421[_0x794b('0x34')][_0x794b('0x37')]?_0x2b7421[_0x794b('0x34')]:_0x503813['model'];if(_0x4ba3f1[_0x794b('0x36')][_0x794b('0x42')]){_0x2b7421[_0x794b('0x43')]=[{'all':!![]}];}_0x2b7421=_['merge']({},_0x2b7421,_0x4ba3f1['options']);return db['MailSubstatus'][_0x794b('0x47')](_0x2b7421)[_0x794b('0x27')](handleEntityNotFound(_0x453649,null))['then'](respondWithResult(_0x453649,null))[_0x794b('0x48')](handleError(_0x453649,null));};exports[_0x794b('0x49')]=function(_0x4518d8,_0x2bbd48){return db[_0x794b('0x2e')]['create'](_0x4518d8['body'],{})['then'](respondWithResult(_0x2bbd48,0xc9))[_0x794b('0x48')](handleError(_0x2bbd48,null));};exports[_0x794b('0x4a')]=function(_0x502800,_0x465779){if(_0x502800[_0x794b('0x4b')]['id']){delete _0x502800[_0x794b('0x4b')]['id'];}return db[_0x794b('0x2e')][_0x794b('0x47')]({'where':{'id':_0x502800[_0x794b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x465779,null))[_0x794b('0x27')](saveUpdates(_0x502800['body'],null))[_0x794b('0x27')](respondWithResult(_0x465779,null))[_0x794b('0x48')](handleError(_0x465779,null));};exports[_0x794b('0x4d')]=function(_0x4ea601,_0x17ff0f){return db[_0x794b('0x2e')][_0x794b('0x47')]({'where':{'id':_0x4ea601[_0x794b('0x4c')]['id']}})[_0x794b('0x27')](handleEntityNotFound(_0x17ff0f,null))[_0x794b('0x27')](removeEntity(_0x17ff0f,null))['catch'](handleError(_0x17ff0f,null));};exports[_0x794b('0x4e')]=function(_0x238c37,_0x4d8e2e){return db[_0x794b('0x2e')][_0x794b('0x4e')]()[_0x794b('0x27')](respondWithResult(_0x4d8e2e,null))[_0x794b('0x48')](handleError(_0x4d8e2e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index f24369e..9915e76 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 _0x4bf6=['hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit'];(function(_0x3a239d,_0x1413d9){var _0x1825cd=function(_0x3024d2){while(--_0x3024d2){_0x3a239d['push'](_0x3a239d['shift']());}};_0x1825cd(++_0x1413d9);}(_0x4bf6,0x17d));var _0x64bf=function(_0x56f571,_0x4ebb61){_0x56f571=_0x56f571-0x0;var _0x591cc0=_0x4bf6[_0x56f571];return _0x591cc0;};'use strict';var EventEmitter=require(_0x64bf('0x0'));var MailSubstatus=require(_0x64bf('0x1'))['db'][_0x64bf('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x64bf('0x3')](0x0);var events={'afterUpdate':_0x64bf('0x4')};function emitEvent(_0x41be04){return function(_0x2dea11,_0x2bb298,_0x4a1ed3){MailSubstatusEvents[_0x64bf('0x5')](_0x41be04+':'+_0x2dea11['id'],_0x2dea11);MailSubstatusEvents[_0x64bf('0x5')](_0x41be04,_0x2dea11);_0x4a1ed3(null);};}for(var e in events){if(events[_0x64bf('0x6')](e)){var event=events[e];MailSubstatus[_0x64bf('0x7')](e,emitEvent(event));}}module[_0x64bf('0x8')]=MailSubstatusEvents; \ No newline at end of file +var _0xb1b4=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailSubstatus','update'];(function(_0x334ade,_0x58f76f){var _0x7351d9=function(_0x10e001){while(--_0x10e001){_0x334ade['push'](_0x334ade['shift']());}};_0x7351d9(++_0x58f76f);}(_0xb1b4,0x9c));var _0x4b1b=function(_0x288db3,_0x3a88a0){_0x288db3=_0x288db3-0x0;var _0x2a476e=_0xb1b4[_0x288db3];return _0x2a476e;};'use strict';var EventEmitter=require(_0x4b1b('0x0'));var MailSubstatus=require(_0x4b1b('0x1'))['db'][_0x4b1b('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x4b1b('0x3')};function emitEvent(_0x28200f){return function(_0x803c25,_0x44d03c,_0x28c823){MailSubstatusEvents[_0x4b1b('0x4')](_0x28200f+':'+_0x803c25['id'],_0x803c25);MailSubstatusEvents[_0x4b1b('0x4')](_0x28200f,_0x803c25);_0x28c823(null);};}for(var e in events){if(events[_0x4b1b('0x5')](e)){var event=events[e];MailSubstatus[_0x4b1b('0x6')](e,emitEvent(event));}}module[_0x4b1b('0x7')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 05eaaec..2a8106c 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 _0xfee2=['define','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0xfee2,0x1ec));var _0x2fee=function(_0x238d10,_0x18534e){_0x238d10=_0x238d10-0x0;var _0x4d5b76=_0xfee2[_0x238d10];return _0x4d5b76;};'use strict';var attributes=require('./mailSubstatus.attributes');module['exports']=function(_0xafdaf6){var _0xdc4ed2=_0xafdaf6['models'];return _0xafdaf6[_0x2fee('0x0')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x53932a,_0x2323da,_0x4964c1){return _0xdc4ed2['Condition']['update']({'value':_0x53932a[_0x2fee('0x1')]},{'where':{'field':_0x2fee('0x2'),'value':_0x53932a[_0x2fee('0x3')]['name']}})[_0x2fee('0x4')](function(){_0x4964c1();})[_0x2fee('0x5')](function(_0x122758){_0x4964c1(_0x122758);});}}});}; \ No newline at end of file +var _0x4cf9=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','exports','models','define'];(function(_0x372b9f,_0x36ad0e){var _0x53db37=function(_0x27d6a7){while(--_0x27d6a7){_0x372b9f['push'](_0x372b9f['shift']());}};_0x53db37(++_0x36ad0e);}(_0x4cf9,0x105));var _0x94cf=function(_0x4dbbc1,_0x1df2b8){_0x4dbbc1=_0x4dbbc1-0x0;var _0x5e1faa=_0x4cf9[_0x4dbbc1];return _0x5e1faa;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x94cf('0x0')]=function(_0x5a412a){var _0x5a56f3=_0x5a412a[_0x94cf('0x1')];return _0x5a412a[_0x94cf('0x2')](_0x94cf('0x3'),attributes,{'tableName':_0x94cf('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x226425,_0x145b4e,_0x403f3c){return _0x5a56f3[_0x94cf('0x5')][_0x94cf('0x6')]({'value':_0x226425[_0x94cf('0x7')]},{'where':{'field':_0x94cf('0x8'),'value':_0x226425[_0x94cf('0x9')][_0x94cf('0x7')]}})[_0x94cf('0xa')](function(){_0x403f3c();})[_0x94cf('0xb')](function(_0xd039f6){_0x403f3c(_0xd039f6);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 53ec843..a9a3038 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 _0xab29=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x47669f,_0x494537){var _0x165ec9=function(_0x182d44){while(--_0x182d44){_0x47669f['push'](_0x47669f['shift']());}};_0x165ec9(++_0x494537);}(_0xab29,0x145));var _0x9ab2=function(_0xadfffd,_0x401102){_0xadfffd=_0xadfffd-0x0;var _0x3597e8=_0xab29[_0xadfffd];return _0x3597e8;};'use strict';var _=require(_0x9ab2('0x0'));var util=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ab2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ab2('0x5'));var logger=require(_0x9ab2('0x6'))(_0x9ab2('0x7'));var config=require(_0x9ab2('0x8'));var jayson=require(_0x9ab2('0x9'));var client=jayson['client'][_0x9ab2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3739c8,_0x42d544,_0x3c73e5){return new BPromise(function(_0x3a3553,_0x564109){return client[_0x9ab2('0xb')](_0x3739c8,_0x3c73e5)[_0x9ab2('0xc')](function(_0x398547){logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));logger[_0x9ab2('0x10')](_0x9ab2('0x11'),_0x42d544,_0x9ab2('0xf'),JSON['stringify'](_0x398547));if(_0x398547[_0x9ab2('0x12')]){if(_0x398547[_0x9ab2('0x12')]['code']===0x1f4){logger['error'](_0x9ab2('0xe'),_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x564109(_0x398547['error'][_0x9ab2('0x13')]);}logger[_0x9ab2('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x42d544,_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);return _0x3a3553(_0x398547[_0x9ab2('0x12')][_0x9ab2('0x13')]);}else{logger[_0x9ab2('0xd')](_0x9ab2('0xe'),_0x42d544,_0x9ab2('0xf'));_0x3a3553(_0x398547[_0x9ab2('0x14')]['message']);}})[_0x9ab2('0x15')](function(_0x273e07){logger[_0x9ab2('0x12')](_0x9ab2('0xe'),_0x42d544,_0x273e07);_0x564109(_0x273e07);});});} \ No newline at end of file +var _0x5da1=['catch','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','MailSubstatus,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5da1,0xbf));var _0x15da=function(_0x391883,_0x126ef3){_0x391883=_0x391883-0x0;var _0x1a2e45=_0x5da1[_0x391883];return _0x1a2e45;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x15da('0x0'));var rs=require(_0x15da('0x1'));var fs=require('fs');var Redis=require(_0x15da('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x15da('0x3'));var logger=require('../../config/logger')(_0x15da('0x4'));var config=require(_0x15da('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x15da('0x6')][_0x15da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb73a7b,_0x2993cc,_0x2372ad){return new BPromise(function(_0x140a5b,_0x1be731){return client[_0x15da('0x8')](_0xb73a7b,_0x2372ad)['then'](function(_0x347661){logger[_0x15da('0x9')]('MailSubstatus,\x20%s,\x20%s',_0x2993cc,_0x15da('0xa'));logger[_0x15da('0xb')](_0x15da('0xc'),_0x2993cc,'request\x20sent',JSON[_0x15da('0xd')](_0x347661));if(_0x347661['error']){if(_0x347661[_0x15da('0xe')]['code']===0x1f4){logger[_0x15da('0xe')](_0x15da('0xf'),_0x2993cc,_0x347661['error'][_0x15da('0x10')]);return _0x1be731(_0x347661[_0x15da('0xe')][_0x15da('0x10')]);}logger[_0x15da('0xe')](_0x15da('0xf'),_0x2993cc,_0x347661[_0x15da('0xe')][_0x15da('0x10')]);return _0x140a5b(_0x347661['error'][_0x15da('0x10')]);}else{logger[_0x15da('0x9')](_0x15da('0xf'),_0x2993cc,_0x15da('0xa'));_0x140a5b(_0x347661[_0x15da('0x11')][_0x15da('0x10')]);}})[_0x15da('0x12')](function(_0x133cb1){logger[_0x15da('0xe')](_0x15da('0xf'),_0x2993cc,_0x133cb1);_0x1be731(_0x133cb1);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 18ff454..41b1a7a 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 _0x11f0=['connect-timeout','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','exports','multer','util','path'];(function(_0x5ec841,_0x313346){var _0x2b18d9=function(_0x193c85){while(--_0x193c85){_0x5ec841['push'](_0x5ec841['shift']());}};_0x2b18d9(++_0x313346);}(_0x11f0,0x165));var _0x011f=function(_0x59841f,_0x44be67){_0x59841f=_0x59841f-0x0;var _0x5933b0=_0x11f0[_0x59841f];return _0x5933b0;};'use strict';var multer=require(_0x011f('0x0'));var util=require(_0x011f('0x1'));var path=require(_0x011f('0x2'));var timeout=require(_0x011f('0x3'));var express=require(_0x011f('0x4'));var router=express[_0x011f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x011f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x011f('0x7')]('/',auth[_0x011f('0x8')](),controller[_0x011f('0x9')]);router['get'](_0x011f('0xa'),auth['isAuthenticated'](),controller[_0x011f('0xb')]);router[_0x011f('0x7')]('/:id',auth[_0x011f('0x8')](),controller[_0x011f('0xc')]);router[_0x011f('0xd')]('/',auth['isAuthenticated'](),controller[_0x011f('0xe')]);router[_0x011f('0xf')]('/:id',auth[_0x011f('0x8')](),controller[_0x011f('0x10')]);router[_0x011f('0x11')](_0x011f('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x011f('0x13')]=router; \ No newline at end of file +var _0x4da3=['/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x56ff79,_0x8bf4c4){var _0x449295=function(_0x5a6eda){while(--_0x5a6eda){_0x56ff79['push'](_0x56ff79['shift']());}};_0x449295(++_0x8bf4c4);}(_0x4da3,0x1e3));var _0x34da=function(_0x5777b8,_0x50a718){_0x5777b8=_0x5777b8-0x0;var _0x520e76=_0x4da3[_0x5777b8];return _0x520e76;};'use strict';var multer=require('multer');var util=require(_0x34da('0x0'));var path=require(_0x34da('0x1'));var timeout=require(_0x34da('0x2'));var express=require(_0x34da('0x3'));var router=express['Router']();var fs_extra=require(_0x34da('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x34da('0x5'));router[_0x34da('0x6')]('/',auth[_0x34da('0x7')](),controller[_0x34da('0x8')]);router[_0x34da('0x6')](_0x34da('0x9'),auth[_0x34da('0x7')](),controller[_0x34da('0xa')]);router[_0x34da('0x6')](_0x34da('0xb'),auth['isAuthenticated'](),controller[_0x34da('0xc')]);router[_0x34da('0xd')]('/',auth[_0x34da('0x7')](),controller[_0x34da('0xe')]);router[_0x34da('0xf')](_0x34da('0xb'),auth[_0x34da('0x7')](),controller[_0x34da('0x10')]);router[_0x34da('0x11')](_0x34da('0xb'),auth[_0x34da('0x7')](),controller['destroy']);module[_0x34da('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 79771b7..978425d 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x3e41df,_0x529094){var _0x38d62c=function(_0x25f232){while(--_0x25f232){_0x3e41df['push'](_0x3e41df['shift']());}};_0x38d62c(++_0x529094);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0xcb91[_0x495e9f];return _0xb249d2;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2ed612,_0x5090f5){var _0xff695b=function(_0x1bf6df){while(--_0x1bf6df){_0x2ed612['push'](_0x2ed612['shift']());}};_0xff695b(++_0x5090f5);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 7a8f90e..1deace6 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 _0xf6d7=['rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','MailTransferReport'];(function(_0x49a500,_0x5c4bc1){var _0x28c568=function(_0x4a6a7c){while(--_0x4a6a7c){_0x49a500['push'](_0x49a500['shift']());}};_0x28c568(++_0x5c4bc1);}(_0xf6d7,0x102));var _0x7f6d=function(_0x330740,_0x58c0c0){_0x330740=_0x330740-0x0;var _0x1cb5f2=_0xf6d7[_0x330740];return _0x1cb5f2;};'use strict';var emlformat=require(_0x7f6d('0x0'));var rimraf=require(_0x7f6d('0x1'));var zipdir=require(_0x7f6d('0x2'));var jsonpatch=require(_0x7f6d('0x3'));var rp=require('request-promise');var moment=require(_0x7f6d('0x4'));var BPromise=require(_0x7f6d('0x5'));var Mustache=require(_0x7f6d('0x6'));var util=require('util');var path=require(_0x7f6d('0x7'));var sox=require('sox');var csv=require(_0x7f6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f6d('0x9'));var _=require(_0x7f6d('0xa'));var squel=require(_0x7f6d('0xb'));var crypto=require(_0x7f6d('0xc'));var jsforce=require(_0x7f6d('0xd'));var deskjs=require(_0x7f6d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f6d('0xf'));var Papa=require(_0x7f6d('0x10'));var Redis=require(_0x7f6d('0x11'));var authService=require(_0x7f6d('0x12'));var qs=require(_0x7f6d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7f6d('0x14'));var logger=require('../../config/logger')(_0x7f6d('0x15'));var utils=require(_0x7f6d('0x16'));var config=require(_0x7f6d('0x17'));var licenseUtil=require(_0x7f6d('0x18'));var db=require(_0x7f6d('0x19'))['db'];function respondWithStatusCode(_0x36e5fb,_0x3ffd9e){_0x3ffd9e=_0x3ffd9e||0xcc;return function(_0x51b5fc){if(_0x51b5fc){return _0x36e5fb[_0x7f6d('0x1a')](_0x3ffd9e);}return _0x36e5fb[_0x7f6d('0x1b')](_0x3ffd9e)['end']();};}function respondWithResult(_0x4b549a,_0x2ac7ca){_0x2ac7ca=_0x2ac7ca||0xc8;return function(_0x10ed9e){if(_0x10ed9e){return _0x4b549a['status'](_0x2ac7ca)[_0x7f6d('0x1c')](_0x10ed9e);}};}function respondWithFilteredResult(_0x29e722,_0x7c1abb){return function(_0xd52177){if(_0xd52177){var _0xafb70=typeof _0x7c1abb[_0x7f6d('0x1d')]===_0x7f6d('0x1e')&&typeof _0x7c1abb[_0x7f6d('0x1f')]===_0x7f6d('0x1e');var _0x11fab5=_0xd52177[_0x7f6d('0x20')];var _0x5c2109=_0xafb70?0x0:_0x7c1abb['offset'];var _0x6583e1=_0xafb70?_0xd52177[_0x7f6d('0x20')]:_0x7c1abb[_0x7f6d('0x1d')]+_0x7c1abb[_0x7f6d('0x1f')];var _0x593a99;if(_0x6583e1>=_0x11fab5){_0x6583e1=_0x11fab5;_0x593a99=0xc8;}else{_0x593a99=0xce;}_0x29e722[_0x7f6d('0x1b')](_0x593a99);return _0x29e722[_0x7f6d('0x21')]('Content-Range',_0x5c2109+'-'+_0x6583e1+'/'+_0x11fab5)[_0x7f6d('0x1c')](_0xd52177);}return null;};}function patchUpdates(_0x391a76){return function(_0x26e388){try{jsonpatch[_0x7f6d('0x22')](_0x26e388,_0x391a76,!![]);}catch(_0x385d24){return BPromise[_0x7f6d('0x23')](_0x385d24);}return _0x26e388['save']();};}function saveUpdates(_0x238009,_0x52d5b6){return function(_0x1e6efd){if(_0x1e6efd){return _0x1e6efd[_0x7f6d('0x24')](_0x238009)[_0x7f6d('0x25')](function(_0xa23e96){return _0xa23e96;});}return null;};}function removeEntity(_0x44ae5b,_0xd91efe){return function(_0x5914d5){if(_0x5914d5){return _0x5914d5['destroy']()[_0x7f6d('0x25')](function(){_0x44ae5b[_0x7f6d('0x1b')](0xcc)[_0x7f6d('0x26')]();});}};}function handleEntityNotFound(_0x4358df,_0x4a16b6){return function(_0x3441f7){if(!_0x3441f7){_0x4358df[_0x7f6d('0x1a')](0x194);}return _0x3441f7;};}function handleError(_0xf9dedb,_0x18b02f){_0x18b02f=_0x18b02f||0x1f4;return function(_0x24cba6){logger[_0x7f6d('0x27')](_0x24cba6[_0x7f6d('0x28')]);if(_0x24cba6[_0x7f6d('0x29')]){delete _0x24cba6[_0x7f6d('0x29')];}_0xf9dedb['status'](_0x18b02f)[_0x7f6d('0x2a')](_0x24cba6);};}exports[_0x7f6d('0x2b')]=function(_0x5a0c76,_0x472e64){var _0x4ef6e1={},_0x25cd24={},_0x4ff8ec={'count':0x0,'rows':[]};var _0x21ae79=_[_0x7f6d('0x2c')](db[_0x7f6d('0x2d')][_0x7f6d('0x2e')],function(_0x10687f){return{'name':_0x10687f[_0x7f6d('0x2f')],'type':_0x10687f[_0x7f6d('0x30')][_0x7f6d('0x31')]};});_0x25cd24[_0x7f6d('0x32')]=_[_0x7f6d('0x2c')](_0x21ae79,_0x7f6d('0x29'));_0x25cd24[_0x7f6d('0x33')]=_['keys'](_0x5a0c76[_0x7f6d('0x33')]);_0x25cd24[_0x7f6d('0x34')]=_['intersection'](_0x25cd24[_0x7f6d('0x32')],_0x25cd24[_0x7f6d('0x33')]);_0x4ef6e1[_0x7f6d('0x35')]=_[_0x7f6d('0x36')](_0x25cd24[_0x7f6d('0x32')],qs[_0x7f6d('0x37')](_0x5a0c76[_0x7f6d('0x33')][_0x7f6d('0x37')]));_0x4ef6e1[_0x7f6d('0x35')]=_0x4ef6e1[_0x7f6d('0x35')][_0x7f6d('0x38')]?_0x4ef6e1[_0x7f6d('0x35')]:_0x25cd24[_0x7f6d('0x32')];if(!_0x5a0c76['query'][_0x7f6d('0x39')](_0x7f6d('0x3a'))){_0x4ef6e1[_0x7f6d('0x1f')]=qs[_0x7f6d('0x1f')](_0x5a0c76['query'][_0x7f6d('0x1f')]);_0x4ef6e1[_0x7f6d('0x1d')]=qs[_0x7f6d('0x1d')](_0x5a0c76['query'][_0x7f6d('0x1d')]);}_0x4ef6e1['order']=qs['sort'](_0x5a0c76['query'][_0x7f6d('0x3b')]);_0x4ef6e1[_0x7f6d('0x3c')]=qs[_0x7f6d('0x34')](_['pick'](_0x5a0c76[_0x7f6d('0x33')],_0x25cd24[_0x7f6d('0x34')]),_0x21ae79);if(_0x5a0c76[_0x7f6d('0x33')]['filter']){_0x4ef6e1[_0x7f6d('0x3c')]=_['merge'](_0x4ef6e1[_0x7f6d('0x3c')],{'$or':_[_0x7f6d('0x2c')](_0x21ae79,function(_0x10e851){if(_0x10e851[_0x7f6d('0x30')]!==_0x7f6d('0x3d')){var _0x12f40b={};_0x12f40b[_0x10e851[_0x7f6d('0x29')]]={'$like':'%'+_0x5a0c76[_0x7f6d('0x33')]['filter']+'%'};return _0x12f40b;}})});}_0x4ef6e1=_[_0x7f6d('0x3e')]({},_0x4ef6e1,_0x5a0c76[_0x7f6d('0x3f')]);var _0x30da86={'where':_0x4ef6e1[_0x7f6d('0x3c')]};return db['MailTransferReport'][_0x7f6d('0x20')](_0x30da86)[_0x7f6d('0x25')](function(_0x41764d){_0x4ff8ec[_0x7f6d('0x20')]=_0x41764d;if(_0x5a0c76[_0x7f6d('0x33')][_0x7f6d('0x40')]){_0x4ef6e1['include']=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x4ef6e1);})[_0x7f6d('0x25')](function(_0x4459c1){_0x4ff8ec[_0x7f6d('0x41')]=_0x4459c1;return _0x4ff8ec;})[_0x7f6d('0x25')](respondWithFilteredResult(_0x472e64,_0x4ef6e1))[_0x7f6d('0x42')](handleError(_0x472e64,null));};exports[_0x7f6d('0x43')]=function(_0x355887,_0x270828){var _0x2be16d={'raw':!![],'where':{'id':_0x355887[_0x7f6d('0x44')]['id']}},_0x3ae1f7={};_0x3ae1f7[_0x7f6d('0x32')]=_['keys'](db[_0x7f6d('0x2d')]['rawAttributes']);_0x3ae1f7[_0x7f6d('0x33')]=_[_0x7f6d('0x45')](_0x355887[_0x7f6d('0x33')]);_0x3ae1f7[_0x7f6d('0x34')]=_[_0x7f6d('0x36')](_0x3ae1f7['model'],_0x3ae1f7[_0x7f6d('0x33')]);_0x2be16d[_0x7f6d('0x35')]=_[_0x7f6d('0x36')](_0x3ae1f7[_0x7f6d('0x32')],qs['fields'](_0x355887[_0x7f6d('0x33')]['fields']));_0x2be16d[_0x7f6d('0x35')]=_0x2be16d['attributes'][_0x7f6d('0x38')]?_0x2be16d[_0x7f6d('0x35')]:_0x3ae1f7[_0x7f6d('0x32')];if(_0x355887[_0x7f6d('0x33')][_0x7f6d('0x40')]){_0x2be16d[_0x7f6d('0x46')]=[{'all':!![]}];}_0x2be16d=_[_0x7f6d('0x3e')]({},_0x2be16d,_0x355887['options']);return db[_0x7f6d('0x2d')][_0x7f6d('0x47')](_0x2be16d)[_0x7f6d('0x25')](handleEntityNotFound(_0x270828,null))[_0x7f6d('0x25')](respondWithResult(_0x270828,null))[_0x7f6d('0x42')](handleError(_0x270828,null));};exports[_0x7f6d('0x48')]=function(_0x2f30ff,_0x9d647b){return db[_0x7f6d('0x2d')][_0x7f6d('0x48')](_0x2f30ff[_0x7f6d('0x49')],{})[_0x7f6d('0x25')](respondWithResult(_0x9d647b,0xc9))['catch'](handleError(_0x9d647b,null));};exports[_0x7f6d('0x24')]=function(_0x2f4451,_0x5db078){if(_0x2f4451[_0x7f6d('0x49')]['id']){delete _0x2f4451[_0x7f6d('0x49')]['id'];}return db[_0x7f6d('0x2d')][_0x7f6d('0x47')]({'where':{'id':_0x2f4451[_0x7f6d('0x44')]['id']}})[_0x7f6d('0x25')](handleEntityNotFound(_0x5db078,null))[_0x7f6d('0x25')](saveUpdates(_0x2f4451['body'],null))[_0x7f6d('0x25')](respondWithResult(_0x5db078,null))[_0x7f6d('0x42')](handleError(_0x5db078,null));};exports[_0x7f6d('0x4a')]=function(_0x5a65ca,_0x2f4514){return db[_0x7f6d('0x2d')]['find']({'where':{'id':_0x5a65ca['params']['id']}})[_0x7f6d('0x25')](handleEntityNotFound(_0x2f4514,null))[_0x7f6d('0x25')](removeEntity(_0x2f4514,null))['catch'](handleError(_0x2f4514,null));};exports[_0x7f6d('0x4b')]=function(_0x4b57f6,_0x2e4241){return db[_0x7f6d('0x2d')]['describe']()[_0x7f6d('0x25')](respondWithResult(_0x2e4241,null))[_0x7f6d('0x42')](handleError(_0x2e4241,null));}; \ No newline at end of file +var _0xc277=['index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','keys','MailTransferReport','options','body','find','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','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','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc277,0xff));var _0x7c27=function(_0x3e3b4a,_0x75a5b1){_0x3e3b4a=_0x3e3b4a-0x0;var _0xec68f4=_0xc277[_0x3e3b4a];return _0xec68f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c27('0x0'));var zipdir=require(_0x7c27('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7c27('0x2'));var moment=require(_0x7c27('0x3'));var BPromise=require(_0x7c27('0x4'));var Mustache=require(_0x7c27('0x5'));var util=require('util');var path=require(_0x7c27('0x6'));var sox=require('sox');var csv=require(_0x7c27('0x7'));var ejs=require(_0x7c27('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c27('0x9'));var squel=require('squel');var crypto=require(_0x7c27('0xa'));var jsforce=require(_0x7c27('0xb'));var deskjs=require(_0x7c27('0xc'));var toCsv=require(_0x7c27('0x7'));var querystring=require(_0x7c27('0xd'));var Papa=require('papaparse');var Redis=require(_0x7c27('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x7c27('0xf'));var as=require(_0x7c27('0x10'));var hardwareService=require(_0x7c27('0x11'));var logger=require('../../config/logger')(_0x7c27('0x12'));var utils=require(_0x7c27('0x13'));var config=require(_0x7c27('0x14'));var licenseUtil=require(_0x7c27('0x15'));var db=require(_0x7c27('0x16'))['db'];function respondWithStatusCode(_0x397caf,_0x3618b2){_0x3618b2=_0x3618b2||0xcc;return function(_0x4b3fa5){if(_0x4b3fa5){return _0x397caf[_0x7c27('0x17')](_0x3618b2);}return _0x397caf[_0x7c27('0x18')](_0x3618b2)[_0x7c27('0x19')]();};}function respondWithResult(_0x325541,_0xa678e5){_0xa678e5=_0xa678e5||0xc8;return function(_0x523cba){if(_0x523cba){return _0x325541[_0x7c27('0x18')](_0xa678e5)[_0x7c27('0x1a')](_0x523cba);}};}function respondWithFilteredResult(_0xc16326,_0x3944da){return function(_0x5ce3c5){if(_0x5ce3c5){var _0x35f926=typeof _0x3944da[_0x7c27('0x1b')]===_0x7c27('0x1c')&&typeof _0x3944da[_0x7c27('0x1d')]===_0x7c27('0x1c');var _0x3e11b0=_0x5ce3c5[_0x7c27('0x1e')];var _0x2202d1=_0x35f926?0x0:_0x3944da['offset'];var _0x23171f=_0x35f926?_0x5ce3c5[_0x7c27('0x1e')]:_0x3944da[_0x7c27('0x1b')]+_0x3944da['limit'];var _0x124e0b;if(_0x23171f>=_0x3e11b0){_0x23171f=_0x3e11b0;_0x124e0b=0xc8;}else{_0x124e0b=0xce;}_0xc16326[_0x7c27('0x18')](_0x124e0b);return _0xc16326[_0x7c27('0x1f')]('Content-Range',_0x2202d1+'-'+_0x23171f+'/'+_0x3e11b0)['json'](_0x5ce3c5);}return null;};}function patchUpdates(_0x3b1dd8){return function(_0x31c04a){try{jsonpatch[_0x7c27('0x20')](_0x31c04a,_0x3b1dd8,!![]);}catch(_0x921d29){return BPromise[_0x7c27('0x21')](_0x921d29);}return _0x31c04a[_0x7c27('0x22')]();};}function saveUpdates(_0x162380,_0x4491d7){return function(_0x4f7a7c){if(_0x4f7a7c){return _0x4f7a7c[_0x7c27('0x23')](_0x162380)[_0x7c27('0x24')](function(_0x1bb88b){return _0x1bb88b;});}return null;};}function removeEntity(_0x145cf6,_0x116d3f){return function(_0x558e60){if(_0x558e60){return _0x558e60['destroy']()[_0x7c27('0x24')](function(){_0x145cf6[_0x7c27('0x18')](0xcc)[_0x7c27('0x19')]();});}};}function handleEntityNotFound(_0x35192c,_0x467773){return function(_0x54eda0){if(!_0x54eda0){_0x35192c['sendStatus'](0x194);}return _0x54eda0;};}function handleError(_0xf18e9b,_0x45965f){_0x45965f=_0x45965f||0x1f4;return function(_0x52785a){logger[_0x7c27('0x25')](_0x52785a[_0x7c27('0x26')]);if(_0x52785a[_0x7c27('0x27')]){delete _0x52785a[_0x7c27('0x27')];}_0xf18e9b['status'](_0x45965f)[_0x7c27('0x28')](_0x52785a);};}exports[_0x7c27('0x29')]=function(_0x2d254d,_0x562a23){var _0x3dfb55={},_0x2b659b={},_0x910ff5={'count':0x0,'rows':[]};var _0x19d566=_[_0x7c27('0x2a')](db['MailTransferReport'][_0x7c27('0x2b')],function(_0x28ac68){return{'name':_0x28ac68[_0x7c27('0x2c')],'type':_0x28ac68[_0x7c27('0x2d')][_0x7c27('0x2e')]};});_0x2b659b[_0x7c27('0x2f')]=_[_0x7c27('0x2a')](_0x19d566,'name');_0x2b659b['query']=_['keys'](_0x2d254d[_0x7c27('0x30')]);_0x2b659b[_0x7c27('0x31')]=_[_0x7c27('0x32')](_0x2b659b['model'],_0x2b659b[_0x7c27('0x30')]);_0x3dfb55[_0x7c27('0x33')]=_[_0x7c27('0x32')](_0x2b659b[_0x7c27('0x2f')],qs['fields'](_0x2d254d['query'][_0x7c27('0x34')]));_0x3dfb55[_0x7c27('0x33')]=_0x3dfb55[_0x7c27('0x33')][_0x7c27('0x35')]?_0x3dfb55[_0x7c27('0x33')]:_0x2b659b['model'];if(!_0x2d254d['query'][_0x7c27('0x36')](_0x7c27('0x37'))){_0x3dfb55[_0x7c27('0x1d')]=qs[_0x7c27('0x1d')](_0x2d254d[_0x7c27('0x30')][_0x7c27('0x1d')]);_0x3dfb55[_0x7c27('0x1b')]=qs['offset'](_0x2d254d[_0x7c27('0x30')]['offset']);}_0x3dfb55['order']=qs[_0x7c27('0x38')](_0x2d254d[_0x7c27('0x30')][_0x7c27('0x38')]);_0x3dfb55[_0x7c27('0x39')]=qs[_0x7c27('0x31')](_[_0x7c27('0x3a')](_0x2d254d[_0x7c27('0x30')],_0x2b659b['filters']),_0x19d566);if(_0x2d254d[_0x7c27('0x30')][_0x7c27('0x3b')]){_0x3dfb55[_0x7c27('0x39')]=_['merge'](_0x3dfb55[_0x7c27('0x39')],{'$or':_[_0x7c27('0x2a')](_0x19d566,function(_0x2ae1ea){if(_0x2ae1ea[_0x7c27('0x2d')]!==_0x7c27('0x3c')){var _0xf81a9e={};_0xf81a9e[_0x2ae1ea[_0x7c27('0x27')]]={'$like':'%'+_0x2d254d[_0x7c27('0x30')][_0x7c27('0x3b')]+'%'};return _0xf81a9e;}})});}_0x3dfb55=_[_0x7c27('0x3d')]({},_0x3dfb55,_0x2d254d['options']);var _0x2c92c3={'where':_0x3dfb55['where']};return db['MailTransferReport']['count'](_0x2c92c3)[_0x7c27('0x24')](function(_0x41b1ff){_0x910ff5[_0x7c27('0x1e')]=_0x41b1ff;if(_0x2d254d[_0x7c27('0x30')]['includeAll']){_0x3dfb55[_0x7c27('0x3e')]=[{'all':!![]}];}return db['MailTransferReport'][_0x7c27('0x3f')](_0x3dfb55);})['then'](function(_0x88a523){_0x910ff5[_0x7c27('0x40')]=_0x88a523;return _0x910ff5;})['then'](respondWithFilteredResult(_0x562a23,_0x3dfb55))[_0x7c27('0x41')](handleError(_0x562a23,null));};exports['show']=function(_0x598b6a,_0x54fc4b){var _0x350c00={'raw':!![],'where':{'id':_0x598b6a[_0x7c27('0x42')]['id']}},_0x39f4a3={};_0x39f4a3[_0x7c27('0x2f')]=_[_0x7c27('0x43')](db[_0x7c27('0x44')][_0x7c27('0x2b')]);_0x39f4a3['query']=_[_0x7c27('0x43')](_0x598b6a['query']);_0x39f4a3[_0x7c27('0x31')]=_[_0x7c27('0x32')](_0x39f4a3[_0x7c27('0x2f')],_0x39f4a3[_0x7c27('0x30')]);_0x350c00[_0x7c27('0x33')]=_['intersection'](_0x39f4a3[_0x7c27('0x2f')],qs[_0x7c27('0x34')](_0x598b6a['query'][_0x7c27('0x34')]));_0x350c00[_0x7c27('0x33')]=_0x350c00[_0x7c27('0x33')][_0x7c27('0x35')]?_0x350c00['attributes']:_0x39f4a3[_0x7c27('0x2f')];if(_0x598b6a['query']['includeAll']){_0x350c00['include']=[{'all':!![]}];}_0x350c00=_[_0x7c27('0x3d')]({},_0x350c00,_0x598b6a[_0x7c27('0x45')]);return db['MailTransferReport']['find'](_0x350c00)[_0x7c27('0x24')](handleEntityNotFound(_0x54fc4b,null))[_0x7c27('0x24')](respondWithResult(_0x54fc4b,null))[_0x7c27('0x41')](handleError(_0x54fc4b,null));};exports['create']=function(_0x4badf1,_0x47220f){return db[_0x7c27('0x44')]['create'](_0x4badf1['body'],{})['then'](respondWithResult(_0x47220f,0xc9))[_0x7c27('0x41')](handleError(_0x47220f,null));};exports[_0x7c27('0x23')]=function(_0x373e12,_0x43bcdb){if(_0x373e12['body']['id']){delete _0x373e12[_0x7c27('0x46')]['id'];}return db[_0x7c27('0x44')][_0x7c27('0x47')]({'where':{'id':_0x373e12[_0x7c27('0x42')]['id']}})[_0x7c27('0x24')](handleEntityNotFound(_0x43bcdb,null))[_0x7c27('0x24')](saveUpdates(_0x373e12[_0x7c27('0x46')],null))['then'](respondWithResult(_0x43bcdb,null))[_0x7c27('0x41')](handleError(_0x43bcdb,null));};exports[_0x7c27('0x48')]=function(_0x432f01,_0x455fe1){return db['MailTransferReport']['find']({'where':{'id':_0x432f01[_0x7c27('0x42')]['id']}})[_0x7c27('0x24')](handleEntityNotFound(_0x455fe1,null))['then'](removeEntity(_0x455fe1,null))[_0x7c27('0x41')](handleError(_0x455fe1,null));};exports[_0x7c27('0x49')]=function(_0x12ebb0,_0x57348e){return db[_0x7c27('0x44')]['describe']()[_0x7c27('0x24')](respondWithResult(_0x57348e,null))[_0x7c27('0x41')](handleError(_0x57348e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e83209d..6c840ff 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 _0x18d6=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_mail_transfer','uniqueid','lodash','util'];(function(_0x10c51f,_0x11270f){var _0x56a0cd=function(_0x563ac6){while(--_0x563ac6){_0x10c51f['push'](_0x10c51f['shift']());}};_0x56a0cd(++_0x11270f);}(_0x18d6,0x166));var _0x618d=function(_0x2d5a9d,_0x499b8c){_0x2d5a9d=_0x2d5a9d-0x0;var _0x40fd1f=_0x18d6[_0x2d5a9d];return _0x40fd1f;};'use strict';var _=require(_0x618d('0x0'));var util=require(_0x618d('0x1'));var logger=require('../../config/logger')(_0x618d('0x2'));var moment=require(_0x618d('0x3'));var BPromise=require(_0x618d('0x4'));var rp=require(_0x618d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x618d('0x6'));var config=require(_0x618d('0x7'));var attributes=require('./mailTransferReport.attributes');module[_0x618d('0x8')]=function(_0x55caad,_0xa89cff){return _0x55caad[_0x618d('0x9')]('MailTransferReport',attributes,{'tableName':_0x618d('0xa'),'paranoid':![],'indexes':[{'name':_0x618d('0xb'),'fields':[_0x618d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7351=['exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes'];(function(_0x402d21,_0x206eff){var _0x934741=function(_0x2c7eb1){while(--_0x2c7eb1){_0x402d21['push'](_0x402d21['shift']());}};_0x934741(++_0x206eff);}(_0x7351,0x139));var _0x1735=function(_0x166a99,_0xffdfe1){_0x166a99=_0x166a99-0x0;var _0x4467ec=_0x7351[_0x166a99];return _0x4467ec;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var logger=require(_0x1735('0x2'))(_0x1735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1735('0x4'));var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require(_0x1735('0x7'));var attributes=require(_0x1735('0x8'));module[_0x1735('0x9')]=function(_0x47fa51,_0x3fdcc1){return _0x47fa51[_0x1735('0xa')](_0x1735('0xb'),attributes,{'tableName':_0x1735('0xc'),'paranoid':![],'indexes':[{'name':_0x1735('0xd'),'fields':[_0x1735('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 71dd6db..73aaa85 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 _0xbdbb=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0xba1dde,_0x16202d){var _0x30dfc0=function(_0x5aff98){while(--_0x5aff98){_0xba1dde['push'](_0xba1dde['shift']());}};_0x30dfc0(++_0x16202d);}(_0xbdbb,0x1e9));var _0xbbdb=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbdbb[_0x5f0089];return _0x193892;};'use strict';var _=require(_0xbbdb('0x0'));var util=require('util');var moment=require(_0xbbdb('0x1'));var BPromise=require(_0xbbdb('0x2'));var rs=require(_0xbbdb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbbdb('0x4'))(_0xbbdb('0x5'));var config=require(_0xbbdb('0x6'));var jayson=require(_0xbbdb('0x7'));var client=jayson[_0xbbdb('0x8')][_0xbbdb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2dd8d2,_0x732e31,_0x1c1a02){return new BPromise(function(_0x5200f1,_0x32d74e){return client[_0xbbdb('0xa')](_0x2dd8d2,_0x1c1a02)[_0xbbdb('0xb')](function(_0x49166e){logger[_0xbbdb('0xc')](_0xbbdb('0xd'),_0x732e31,_0xbbdb('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x732e31,_0xbbdb('0xe'),JSON['stringify'](_0x49166e));if(_0x49166e[_0xbbdb('0xf')]){if(_0x49166e[_0xbbdb('0xf')]['code']===0x1f4){logger[_0xbbdb('0xf')]('MailTransferReport,\x20%s,\x20%s',_0x732e31,_0x49166e['error'][_0xbbdb('0x10')]);return _0x32d74e(_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x732e31,_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);return _0x5200f1(_0x49166e[_0xbbdb('0xf')][_0xbbdb('0x10')]);}else{logger[_0xbbdb('0xc')](_0xbbdb('0xd'),_0x732e31,_0xbbdb('0xe'));_0x5200f1(_0x49166e[_0xbbdb('0x11')][_0xbbdb('0x10')]);}})[_0xbbdb('0x12')](function(_0x64265b){logger[_0xbbdb('0xf')](_0xbbdb('0xd'),_0x732e31,_0x64265b);_0x32d74e(_0x64265b);});});} \ No newline at end of file +var _0x1a5a=['http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','jayson/promise'];(function(_0x161a71,_0x7d2934){var _0x30d82b=function(_0x403a7a){while(--_0x403a7a){_0x161a71['push'](_0x161a71['shift']());}};_0x30d82b(++_0x7d2934);}(_0x1a5a,0x9a));var _0xa1a5=function(_0x5740cd,_0x170333){_0x5740cd=_0x5740cd-0x0;var _0x22994d=_0x1a5a[_0x5740cd];return _0x22994d;};'use strict';var _=require(_0xa1a5('0x0'));var util=require('util');var moment=require(_0xa1a5('0x1'));var BPromise=require(_0xa1a5('0x2'));var rs=require(_0xa1a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa1a5('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa1a5('0x5'));var client=jayson['client'][_0xa1a5('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5cc25b,_0xca9498,_0x2c5ea2){return new BPromise(function(_0x44b6c0,_0x9b7e6d){return client['request'](_0x5cc25b,_0x2c5ea2)['then'](function(_0x432151){logger[_0xa1a5('0x7')](_0xa1a5('0x8'),_0xca9498,_0xa1a5('0x9'));logger['debug'](_0xa1a5('0xa'),_0xca9498,_0xa1a5('0x9'),JSON['stringify'](_0x432151));if(_0x432151[_0xa1a5('0xb')]){if(_0x432151[_0xa1a5('0xb')][_0xa1a5('0xc')]===0x1f4){logger[_0xa1a5('0xb')](_0xa1a5('0x8'),_0xca9498,_0x432151[_0xa1a5('0xb')]['message']);return _0x9b7e6d(_0x432151['error']['message']);}logger[_0xa1a5('0xb')]('MailTransferReport,\x20%s,\x20%s',_0xca9498,_0x432151[_0xa1a5('0xb')][_0xa1a5('0xd')]);return _0x44b6c0(_0x432151[_0xa1a5('0xb')][_0xa1a5('0xd')]);}else{logger[_0xa1a5('0x7')](_0xa1a5('0x8'),_0xca9498,'request\x20sent');_0x44b6c0(_0x432151[_0xa1a5('0xe')][_0xa1a5('0xd')]);}})[_0xa1a5('0xf')](function(_0x511c9f){logger['error'](_0xa1a5('0x8'),_0xca9498,_0x511c9f);_0x9b7e6d(_0x511c9f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index fc1dbc7..85a0e2e 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 _0x93b9=['/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','index','/describe','describe'];(function(_0x1df9b0,_0x51f028){var _0x34c490=function(_0x515975){while(--_0x515975){_0x1df9b0['push'](_0x1df9b0['shift']());}};_0x34c490(++_0x51f028);}(_0x93b9,0xe6));var _0x993b=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x93b9[_0x6dfbaa];return _0xfbe02;};'use strict';var multer=require('multer');var util=require(_0x993b('0x0'));var path=require(_0x993b('0x1'));var timeout=require(_0x993b('0x2'));var express=require('express');var router=express[_0x993b('0x3')]();var fs_extra=require(_0x993b('0x4'));var auth=require(_0x993b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x993b('0x6'));var controller=require(_0x993b('0x7'));router[_0x993b('0x8')]('/',auth['isAuthenticated'](),controller[_0x993b('0x9')]);router[_0x993b('0x8')](_0x993b('0xa'),auth['isAuthenticated'](),controller[_0x993b('0xb')]);router['get'](_0x993b('0xc'),auth['isAuthenticated'](),controller[_0x993b('0xd')]);router[_0x993b('0xe')]('/',auth[_0x993b('0xf')](),controller[_0x993b('0x10')]);router[_0x993b('0x11')]('/:id',auth[_0x993b('0xf')](),controller[_0x993b('0x12')]);router[_0x993b('0x13')](_0x993b('0xc'),auth[_0x993b('0xf')](),controller[_0x993b('0x14')]);module[_0x993b('0x15')]=router; \ No newline at end of file +var _0xd589=['fs-extra','../../components/auth/service','../../components/interaction/service','./memberReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','exports','multer','util','express','Router'];(function(_0x5c78e5,_0xdcd8f1){var _0x24e7f3=function(_0x1b94fa){while(--_0x1b94fa){_0x5c78e5['push'](_0x5c78e5['shift']());}};_0x24e7f3(++_0xdcd8f1);}(_0xd589,0x81));var _0x9d58=function(_0x1fe613,_0xaf127b){_0x1fe613=_0x1fe613-0x0;var _0x2c65eb=_0xd589[_0x1fe613];return _0x2c65eb;};'use strict';var multer=require(_0x9d58('0x0'));var util=require(_0x9d58('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9d58('0x2'));var router=express[_0x9d58('0x3')]();var fs_extra=require(_0x9d58('0x4'));var auth=require(_0x9d58('0x5'));var interaction=require(_0x9d58('0x6'));var config=require('../../config/environment');var controller=require(_0x9d58('0x7'));router['get']('/',auth[_0x9d58('0x8')](),controller[_0x9d58('0x9')]);router[_0x9d58('0xa')](_0x9d58('0xb'),auth[_0x9d58('0x8')](),controller['describe']);router[_0x9d58('0xa')](_0x9d58('0xc'),auth[_0x9d58('0x8')](),controller[_0x9d58('0xd')]);router[_0x9d58('0xe')]('/',auth[_0x9d58('0x8')](),controller[_0x9d58('0xf')]);router[_0x9d58('0x10')](_0x9d58('0xc'),auth[_0x9d58('0x8')](),controller[_0x9d58('0x11')]);router['delete']('/:id',auth[_0x9d58('0x8')](),controller['destroy']);module[_0x9d58('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 0c1e9f1..a2579eb 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 _0x9e9e=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','moment','exports','STRING','DEFAULT\x20PAUSE','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration'];(function(_0x54f0b2,_0xe2655b){var _0x54dd1b=function(_0x2cbb9c){while(--_0x2cbb9c){_0x54f0b2['push'](_0x54f0b2['shift']());}};_0x54dd1b(++_0xe2655b);}(_0x9e9e,0x7d));var _0xe9e9=function(_0x27bcf5,_0x236765){_0x27bcf5=_0x27bcf5-0x0;var _0x4ce4cf=_0x9e9e[_0x27bcf5];return _0x4ce4cf;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe9e9('0x0'));module[_0xe9e9('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xe9e9('0x2')]},'interface':{'type':Sequelize[_0xe9e9('0x2')]},'type':{'type':Sequelize[_0xe9e9('0x2')],'defaultValue':_0xe9e9('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe9e9('0x4')],'set':function(_0x233f5e){var _0x3bec7a=moment(_0x233f5e);var _0xc43a70=moment(this[_0xe9e9('0x5')](_0xe9e9('0x6')));var _0x36fa1b=_0x3bec7a['diff'](_0xc43a70,_0xe9e9('0x7'));this[_0xe9e9('0x8')](_0xe9e9('0x9'),_0x233f5e);this[_0xe9e9('0x8')](_0xe9e9('0xa'),_0x36fa1b>=0x0?_0x36fa1b:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xe9e9('0xb')},'data2':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xc')},'data3':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xd')},'data4':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xe')},'data5':{'type':Sequelize[_0xe9e9('0x2')],'comment':_0xe9e9('0xf')},'role':{'type':Sequelize[_0xe9e9('0x2')]},'internal':{'type':Sequelize[_0xe9e9('0x10')]},'uniqueid':{'type':Sequelize[_0xe9e9('0x2')]}}; \ No newline at end of file +var _0x252a=['setDataValue','duration','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x252a,0x8c));var _0xa252=function(_0x4f7518,_0x564a10){_0x4f7518=_0x4f7518-0x0;var _0x2c11d1=_0x252a[_0x4f7518];return _0x2c11d1;};'use strict';var Sequelize=require(_0xa252('0x0'));var moment=require(_0xa252('0x1'));module['exports']={'channel':{'type':Sequelize[_0xa252('0x2')]},'membername':{'type':Sequelize[_0xa252('0x2')]},'interface':{'type':Sequelize[_0xa252('0x2')]},'type':{'type':Sequelize[_0xa252('0x2')],'defaultValue':_0xa252('0x3'),'comment':_0xa252('0x4')},'duration':{'type':Sequelize[_0xa252('0x5')]},'enterAt':{'type':Sequelize[_0xa252('0x6')]},'exitAt':{'type':Sequelize[_0xa252('0x6')],'set':function(_0x5d3c76){var _0x19921e=moment(_0x5d3c76);var _0x3ea8e4=moment(this['getDataValue'](_0xa252('0x7')));var _0x2e7051=_0x19921e[_0xa252('0x8')](_0x3ea8e4,_0xa252('0x9'));this[_0xa252('0xa')]('exitAt',_0x5d3c76);this['setDataValue'](_0xa252('0xb'),_0x2e7051>=0x0?_0x2e7051:null);}},'data1':{'type':Sequelize[_0xa252('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xa252('0x2')],'comment':_0xa252('0xc')},'data3':{'type':Sequelize[_0xa252('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0xa252('0x2')],'comment':_0xa252('0xd')},'data5':{'type':Sequelize[_0xa252('0x2')],'comment':_0xa252('0xe')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0xa252('0x5')]},'uniqueid':{'type':Sequelize[_0xa252('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 428931a..7c11d62 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x59be7f,_0x3647aa){var _0x13cbf1=function(_0x5b2c16){while(--_0x5b2c16){_0x59be7f['push'](_0x59be7f['shift']());}};_0x13cbf1(++_0x3647aa);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x55ca,0x126));var _0xa55c=function(_0x5712cc,_0x5db7dd){_0x5712cc=_0x5712cc-0x0;var _0x15561a=_0x55ca[_0x5712cc];return _0x15561a;};'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 174f8a8..9512ed0 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 _0x30d7=['path','rimraf','../../config/environment','./memberReport.attributes','report_member','membername','interface','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x30bd66,_0x36a93d){var _0x74c9dd=function(_0x2cd660){while(--_0x2cd660){_0x30bd66['push'](_0x30bd66['shift']());}};_0x74c9dd(++_0x36a93d);}(_0x30d7,0x173));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x730d('0x0'));var util=require(_0x730d('0x1'));var logger=require(_0x730d('0x2'))(_0x730d('0x3'));var moment=require(_0x730d('0x4'));var BPromise=require('bluebird');var rp=require(_0x730d('0x5'));var fs=require('fs');var path=require(_0x730d('0x6'));var rimraf=require(_0x730d('0x7'));var config=require(_0x730d('0x8'));var attributes=require(_0x730d('0x9'));module['exports']=function(_0x18cfa8,_0x5bc4bf){return _0x18cfa8['define']('MemberReport',attributes,{'tableName':_0x730d('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x730d('0xb'),_0x730d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5324=['exports','define','membername_interface','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0x5324,0x100));var _0x4532=function(_0x513133,_0x5d9f3f){_0x513133=_0x513133-0x0;var _0x5d3c56=_0x5324[_0x513133];return _0x5d3c56;};'use strict';var _=require('lodash');var util=require(_0x4532('0x0'));var logger=require(_0x4532('0x1'))(_0x4532('0x2'));var moment=require('moment');var BPromise=require(_0x4532('0x3'));var rp=require(_0x4532('0x4'));var fs=require('fs');var path=require(_0x4532('0x5'));var rimraf=require('rimraf');var config=require(_0x4532('0x6'));var attributes=require(_0x4532('0x7'));module[_0x4532('0x8')]=function(_0x9bcf98,_0x1de387){return _0x9bcf98[_0x4532('0x9')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x4532('0xa'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 1ceb099..a3c4191 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 _0x22da=['GetMemberReport','MemberReport','findAll','options','raw','attributes','include','model','map','then','CreateMemberReport','create','body','stringify','update','where','UpdateMemberReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','MemberReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x22da,0x80));var _0xa22d=function(_0x3afba0,_0x26e10f){_0x3afba0=_0x3afba0-0x0;var _0x13ca03=_0x22da[_0x3afba0];return _0x13ca03;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa22d('0x0'));var BPromise=require(_0xa22d('0x1'));var rs=require(_0xa22d('0x2'));var fs=require('fs');var Redis=require(_0xa22d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa22d('0x4'));var logger=require(_0xa22d('0x5'))(_0xa22d('0x6'));var config=require(_0xa22d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa22d('0x8')][_0xa22d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c67ad,_0x215529,_0x44a5c7){return new BPromise(function(_0x5678bc,_0x186e5c){return client['request'](_0x4c67ad,_0x44a5c7)['then'](function(_0x15f0bd){logger[_0xa22d('0xa')]('MemberReport,\x20%s,\x20%s',_0x215529,_0xa22d('0xb'));logger[_0xa22d('0xc')](_0xa22d('0xd'),_0x215529,_0xa22d('0xb'),JSON['stringify'](_0x15f0bd));if(_0x15f0bd['error']){if(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0xf')]===0x1f4){logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd['error'][_0xa22d('0x11')]);return _0x186e5c(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}logger['error'](_0xa22d('0x10'),_0x215529,_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);return _0x5678bc(_0x15f0bd[_0xa22d('0xe')][_0xa22d('0x11')]);}else{logger['info'](_0xa22d('0x10'),_0x215529,_0xa22d('0xb'));_0x5678bc(_0x15f0bd[_0xa22d('0x12')][_0xa22d('0x11')]);}})[_0xa22d('0x13')](function(_0x2159e1){logger[_0xa22d('0xe')](_0xa22d('0x10'),_0x215529,_0x2159e1);_0x186e5c(_0x2159e1);});});}exports[_0xa22d('0x14')]=function(_0x3d78b9){var _0xf50354=this;return new Promise(function(_0x1ed22e,_0x39c2bf){return db[_0xa22d('0x15')][_0xa22d('0x16')]({'raw':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9['options'][_0xa22d('0x18')]===undefined?!![]:![]:!![],'where':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')]['where']||null:null,'attributes':_0x3d78b9['options']?_0x3d78b9['options'][_0xa22d('0x19')]||null:null,'limit':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')]['limit']||null:null,'include':_0x3d78b9[_0xa22d('0x17')]?_0x3d78b9[_0xa22d('0x17')][_0xa22d('0x1a')]?_['map'](_0x3d78b9[_0xa22d('0x17')][_0xa22d('0x1a')],function(_0x502219){return{'model':db[_0x502219[_0xa22d('0x1b')]],'as':_0x502219['as'],'attributes':_0x502219[_0xa22d('0x19')],'include':_0x502219[_0xa22d('0x1a')]?_[_0xa22d('0x1c')](_0x502219[_0xa22d('0x1a')],function(_0x1c83e8){return{'model':db[_0x1c83e8[_0xa22d('0x1b')]],'as':_0x1c83e8['as'],'attributes':_0x1c83e8['attributes'],'include':_0x1c83e8['include']?_[_0xa22d('0x1c')](_0x1c83e8[_0xa22d('0x1a')],function(_0x2fe9e0){return{'model':db[_0x2fe9e0[_0xa22d('0x1b')]],'as':_0x2fe9e0['as'],'attributes':_0x2fe9e0[_0xa22d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa22d('0x1d')](function(_0x2ff235){logger[_0xa22d('0xa')](_0xa22d('0x14'),_0x3d78b9);logger[_0xa22d('0xc')](_0xa22d('0x14'),_0x3d78b9,JSON['stringify'](_0x2ff235));_0x1ed22e(_0x2ff235);})[_0xa22d('0x13')](function(_0x4d460f){logger['error'](_0xa22d('0x14'),_0x4d460f[_0xa22d('0x11')],_0x3d78b9);_0x39c2bf(_0xf50354[_0xa22d('0xe')](0x1f4,_0x4d460f[_0xa22d('0x11')]));});});};exports[_0xa22d('0x1e')]=function(_0x1892f8){var _0x1ef634=this;return new Promise(function(_0x384a4e,_0x5d9cc6){return db[_0xa22d('0x15')][_0xa22d('0x1f')](_0x1892f8[_0xa22d('0x20')],{'raw':_0x1892f8[_0xa22d('0x17')]?_0x1892f8[_0xa22d('0x17')][_0xa22d('0x18')]===undefined?!![]:![]:!![]})[_0xa22d('0x1d')](function(_0x70f222){logger[_0xa22d('0xa')](_0xa22d('0x1e'),_0x1892f8);logger['debug'](_0xa22d('0x1e'),_0x1892f8,JSON[_0xa22d('0x21')](_0x70f222));_0x384a4e(_0x70f222);})[_0xa22d('0x13')](function(_0x3977ef){logger[_0xa22d('0xe')](_0xa22d('0x1e'),_0x3977ef['message'],_0x1892f8);_0x5d9cc6(_0x1ef634[_0xa22d('0xe')](0x1f4,_0x3977ef[_0xa22d('0x11')]));});});};exports['UpdateMemberReport']=function(_0xd95fe4){var _0x4eb40d=this;return new Promise(function(_0x3e8859,_0x51b9a3){return db['MemberReport'][_0xa22d('0x22')](_0xd95fe4['body'],{'raw':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')][_0xa22d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')][_0xa22d('0x23')]||null:null,'attributes':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')]['attributes']||null:null,'limit':_0xd95fe4[_0xa22d('0x17')]?_0xd95fe4[_0xa22d('0x17')]['limit']||null:null})[_0xa22d('0x1d')](function(_0x33c0d0){logger['info']('UpdateMemberReport',_0xd95fe4);logger[_0xa22d('0xc')](_0xa22d('0x24'),_0xd95fe4,JSON[_0xa22d('0x21')](_0x33c0d0));_0x3e8859(_0x33c0d0);})[_0xa22d('0x13')](function(_0x265536){logger[_0xa22d('0xe')](_0xa22d('0x24'),_0x265536[_0xa22d('0x11')],_0xd95fe4);_0x51b9a3(_0x4eb40d[_0xa22d('0xe')](0x1f4,_0x265536[_0xa22d('0x11')]));});});}; \ No newline at end of file +var _0x9a96=['error','message','catch','GetMemberReport','MemberReport','findAll','options','raw','where','include','map','attributes','debug','CreateMemberReport','create','body','UpdateMemberReport','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc683b3,_0x30804c){var _0x12f2c4=function(_0x3c9cc2){while(--_0x3c9cc2){_0xc683b3['push'](_0xc683b3['shift']());}};_0x12f2c4(++_0x30804c);}(_0x9a96,0xd0));var _0x69a9=function(_0x5ee70c,_0x5c8069){_0x5ee70c=_0x5ee70c-0x0;var _0x1a1524=_0x9a96[_0x5ee70c];return _0x1a1524;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var moment=require(_0x69a9('0x2'));var BPromise=require(_0x69a9('0x3'));var rs=require(_0x69a9('0x4'));var fs=require('fs');var Redis=require(_0x69a9('0x5'));var db=require(_0x69a9('0x6'))['db'];var utils=require(_0x69a9('0x7'));var logger=require(_0x69a9('0x8'))(_0x69a9('0x9'));var config=require(_0x69a9('0xa'));var jayson=require(_0x69a9('0xb'));var client=jayson['client'][_0x69a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x260fd3,_0xca335e,_0x2306b8){return new BPromise(function(_0x49125f,_0x371fd0){return client[_0x69a9('0xd')](_0x260fd3,_0x2306b8)[_0x69a9('0xe')](function(_0x2587ef){logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));logger['debug'](_0x69a9('0x12'),_0xca335e,'request\x20sent',JSON[_0x69a9('0x13')](_0x2587ef));if(_0x2587ef[_0x69a9('0x14')]){if(_0x2587ef[_0x69a9('0x14')]['code']===0x1f4){logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);return _0x371fd0(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}logger[_0x69a9('0x14')](_0x69a9('0x10'),_0xca335e,_0x2587ef['error'][_0x69a9('0x15')]);return _0x49125f(_0x2587ef[_0x69a9('0x14')][_0x69a9('0x15')]);}else{logger[_0x69a9('0xf')](_0x69a9('0x10'),_0xca335e,_0x69a9('0x11'));_0x49125f(_0x2587ef['result']['message']);}})[_0x69a9('0x16')](function(_0x2061e4){logger[_0x69a9('0x14')]('MemberReport,\x20%s,\x20%s',_0xca335e,_0x2061e4);_0x371fd0(_0x2061e4);});});}exports[_0x69a9('0x17')]=function(_0x2f225f){var _0x3e02c3=this;return new Promise(function(_0x2fc505,_0x149570){return db[_0x69a9('0x18')][_0x69a9('0x19')]({'raw':_0x2f225f[_0x69a9('0x1a')]?_0x2f225f[_0x69a9('0x1a')][_0x69a9('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f225f['options']?_0x2f225f['options'][_0x69a9('0x1c')]||null:null,'attributes':_0x2f225f[_0x69a9('0x1a')]?_0x2f225f[_0x69a9('0x1a')]['attributes']||null:null,'limit':_0x2f225f['options']?_0x2f225f['options']['limit']||null:null,'include':_0x2f225f[_0x69a9('0x1a')]?_0x2f225f[_0x69a9('0x1a')][_0x69a9('0x1d')]?_[_0x69a9('0x1e')](_0x2f225f[_0x69a9('0x1a')]['include'],function(_0x4cf3b3){return{'model':db[_0x4cf3b3['model']],'as':_0x4cf3b3['as'],'attributes':_0x4cf3b3['attributes'],'include':_0x4cf3b3[_0x69a9('0x1d')]?_[_0x69a9('0x1e')](_0x4cf3b3['include'],function(_0x56314f){return{'model':db[_0x56314f['model']],'as':_0x56314f['as'],'attributes':_0x56314f[_0x69a9('0x1f')],'include':_0x56314f[_0x69a9('0x1d')]?_['map'](_0x56314f[_0x69a9('0x1d')],function(_0x23d2a1){return{'model':db[_0x23d2a1['model']],'as':_0x23d2a1['as'],'attributes':_0x23d2a1[_0x69a9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15dfcf){logger[_0x69a9('0xf')](_0x69a9('0x17'),_0x2f225f);logger[_0x69a9('0x20')](_0x69a9('0x17'),_0x2f225f,JSON[_0x69a9('0x13')](_0x15dfcf));_0x2fc505(_0x15dfcf);})[_0x69a9('0x16')](function(_0xad3854){logger[_0x69a9('0x14')](_0x69a9('0x17'),_0xad3854[_0x69a9('0x15')],_0x2f225f);_0x149570(_0x3e02c3['error'](0x1f4,_0xad3854[_0x69a9('0x15')]));});});};exports[_0x69a9('0x21')]=function(_0x2d59ad){var _0x4dcf96=this;return new Promise(function(_0x2d7a1d,_0xc0a53){return db[_0x69a9('0x18')][_0x69a9('0x22')](_0x2d59ad[_0x69a9('0x23')],{'raw':_0x2d59ad[_0x69a9('0x1a')]?_0x2d59ad['options'][_0x69a9('0x1b')]===undefined?!![]:![]:!![]})[_0x69a9('0xe')](function(_0x33a884){logger[_0x69a9('0xf')](_0x69a9('0x21'),_0x2d59ad);logger[_0x69a9('0x20')](_0x69a9('0x21'),_0x2d59ad,JSON[_0x69a9('0x13')](_0x33a884));_0x2d7a1d(_0x33a884);})['catch'](function(_0xb7a93a){logger[_0x69a9('0x14')]('CreateMemberReport',_0xb7a93a[_0x69a9('0x15')],_0x2d59ad);_0xc0a53(_0x4dcf96[_0x69a9('0x14')](0x1f4,_0xb7a93a[_0x69a9('0x15')]));});});};exports[_0x69a9('0x24')]=function(_0x480699){var _0x298b76=this;return new Promise(function(_0x387a92,_0x370bf4){return db['MemberReport']['update'](_0x480699[_0x69a9('0x23')],{'raw':_0x480699[_0x69a9('0x1a')]?_0x480699[_0x69a9('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x480699[_0x69a9('0x1a')]?_0x480699[_0x69a9('0x1a')][_0x69a9('0x1c')]||null:null,'attributes':_0x480699[_0x69a9('0x1a')]?_0x480699[_0x69a9('0x1a')]['attributes']||null:null,'limit':_0x480699[_0x69a9('0x1a')]?_0x480699[_0x69a9('0x1a')][_0x69a9('0x25')]||null:null})[_0x69a9('0xe')](function(_0x257336){logger[_0x69a9('0xf')]('UpdateMemberReport',_0x480699);logger[_0x69a9('0x20')](_0x69a9('0x24'),_0x480699,JSON[_0x69a9('0x13')](_0x257336));_0x387a92(_0x257336);})[_0x69a9('0x16')](function(_0x2beb5f){logger['error']('UpdateMemberReport',_0x2beb5f[_0x69a9('0x15')],_0x480699);_0x370bf4(_0x298b76[_0x69a9('0x14')](0x1f4,_0x2beb5f['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index d5fa8ee..63b5a74 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 _0xd825=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index'];(function(_0x30b0d8,_0x57470c){var _0x459c09=function(_0x5e51b6){while(--_0x5e51b6){_0x30b0d8['push'](_0x30b0d8['shift']());}};_0x459c09(++_0x57470c);}(_0xd825,0xb4));var _0x5d82=function(_0x537c8c,_0x5751c1){_0x537c8c=_0x537c8c-0x0;var _0x3133a3=_0xd825[_0x537c8c];return _0x3133a3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d82('0x0'));var timeout=require(_0x5d82('0x1'));var express=require(_0x5d82('0x2'));var router=express[_0x5d82('0x3')]();var fs_extra=require(_0x5d82('0x4'));var auth=require(_0x5d82('0x5'));var interaction=require(_0x5d82('0x6'));var config=require('../../config/environment');var controller=require(_0x5d82('0x7'));router[_0x5d82('0x8')]('/',controller[_0x5d82('0x9')]);module['exports']=router; \ No newline at end of file +var _0x2bc5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x1850ba,_0x55e013){var _0x2045e8=function(_0x5a5b09){while(--_0x5a5b09){_0x1850ba['push'](_0x1850ba['shift']());}};_0x2045e8(++_0x55e013);}(_0x2bc5,0x1ab));var _0x52bc=function(_0x2509f1,_0x5c9f8c){_0x2509f1=_0x2509f1-0x0;var _0x410842=_0x2bc5[_0x2509f1];return _0x410842;};'use strict';var multer=require(_0x52bc('0x0'));var util=require(_0x52bc('0x1'));var path=require(_0x52bc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52bc('0x3')]();var fs_extra=require(_0x52bc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52bc('0x5'));var config=require(_0x52bc('0x6'));var controller=require(_0x52bc('0x7'));router[_0x52bc('0x8')]('/',controller[_0x52bc('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 8249e00..59697a2 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 _0xcdde=['sequelize','exports','version'];(function(_0x36c525,_0x1a32de){var _0xacfb50=function(_0x581743){while(--_0x581743){_0x36c525['push'](_0x36c525['shift']());}};_0xacfb50(++_0x1a32de);}(_0xcdde,0x126));var _0xecdd=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcdde[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xecdd('0x0'));module[_0xecdd('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0xecdd('0x2')}}; \ No newline at end of file +var _0xd56e=['STRING','version','exports'];(function(_0x1088ec,_0x18aa05){var _0xef73e1=function(_0x1f9d0e){while(--_0x1f9d0e){_0x1088ec['push'](_0x1088ec['shift']());}};_0xef73e1(++_0x18aa05);}(_0xd56e,0x10d));var _0xed56=function(_0xbe9a50,_0x7b2f6c){_0xbe9a50=_0xbe9a50-0x0;var _0x300a62=_0xd56e[_0xbe9a50];return _0x300a62;};'use strict';var Sequelize=require('sequelize');module[_0xed56('0x0')]={'version':{'type':Sequelize[_0xed56('0x1')],'unique':_0xed56('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 66b3e2c..ef535c2 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 _0xdbb3=['hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','Content-Range','save','destroy','error','name','status','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','length'];(function(_0x11304d,_0x4352b5){var _0x4475f2=function(_0x4c78f8){while(--_0x4c78f8){_0x11304d['push'](_0x11304d['shift']());}};_0x4475f2(++_0x4352b5);}(_0xdbb3,0x1dc));var _0x3dbb=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0xdbb3[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require(_0x3dbb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3dbb('0x1'));var jsonpatch=require(_0x3dbb('0x2'));var rp=require(_0x3dbb('0x3'));var moment=require(_0x3dbb('0x4'));var BPromise=require(_0x3dbb('0x5'));var Mustache=require(_0x3dbb('0x6'));var util=require(_0x3dbb('0x7'));var path=require(_0x3dbb('0x8'));var sox=require(_0x3dbb('0x9'));var csv=require(_0x3dbb('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3dbb('0xb'));var _=require(_0x3dbb('0xc'));var squel=require('squel');var crypto=require(_0x3dbb('0xd'));var jsforce=require(_0x3dbb('0xe'));var deskjs=require(_0x3dbb('0xf'));var toCsv=require(_0x3dbb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3dbb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3dbb('0x11'));var as=require(_0x3dbb('0x12'));var hardwareService=require(_0x3dbb('0x13'));var logger=require(_0x3dbb('0x14'))(_0x3dbb('0x15'));var utils=require(_0x3dbb('0x16'));var config=require(_0x3dbb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3dbb('0x18'))['db'];function respondWithStatusCode(_0x16821e,_0x238c41){_0x238c41=_0x238c41||0xcc;return function(_0x1be731){if(_0x1be731){return _0x16821e[_0x3dbb('0x19')](_0x238c41);}return _0x16821e['status'](_0x238c41)[_0x3dbb('0x1a')]();};}function respondWithResult(_0x3b8d0d,_0xe49a38){_0xe49a38=_0xe49a38||0xc8;return function(_0x5720f9){if(_0x5720f9){return _0x3b8d0d['status'](_0xe49a38)[_0x3dbb('0x1b')](_0x5720f9);}};}function respondWithFilteredResult(_0x2182f2,_0x14e7d0){return function(_0x3f9a24){if(_0x3f9a24){var _0x5d34f4=typeof _0x14e7d0['offset']===_0x3dbb('0x1c')&&typeof _0x14e7d0[_0x3dbb('0x1d')]==='undefined';var _0x5ca2f1=_0x3f9a24[_0x3dbb('0x1e')];var _0x2db58c=_0x5d34f4?0x0:_0x14e7d0[_0x3dbb('0x1f')];var _0x2e93f7=_0x5d34f4?_0x3f9a24[_0x3dbb('0x1e')]:_0x14e7d0[_0x3dbb('0x1f')]+_0x14e7d0[_0x3dbb('0x1d')];var _0x5ddc6a;if(_0x2e93f7>=_0x5ca2f1){_0x2e93f7=_0x5ca2f1;_0x5ddc6a=0xc8;}else{_0x5ddc6a=0xce;}_0x2182f2['status'](_0x5ddc6a);return _0x2182f2['set'](_0x3dbb('0x20'),_0x2db58c+'-'+_0x2e93f7+'/'+_0x5ca2f1)[_0x3dbb('0x1b')](_0x3f9a24);}return null;};}function patchUpdates(_0x43fe82){return function(_0x22921f){try{jsonpatch['apply'](_0x22921f,_0x43fe82,!![]);}catch(_0x12f8b7){return BPromise['reject'](_0x12f8b7);}return _0x22921f[_0x3dbb('0x21')]();};}function saveUpdates(_0x16a267,_0x41712d){return function(_0x15c4f1){if(_0x15c4f1){return _0x15c4f1['update'](_0x16a267)['then'](function(_0x2b4a38){return _0x2b4a38;});}return null;};}function removeEntity(_0x58ba6b,_0x4f79ae){return function(_0x37b13b){if(_0x37b13b){return _0x37b13b[_0x3dbb('0x22')]()['then'](function(){_0x58ba6b['status'](0xcc)[_0x3dbb('0x1a')]();});}};}function handleEntityNotFound(_0x5374d2,_0x1069ba){return function(_0x68b288){if(!_0x68b288){_0x5374d2[_0x3dbb('0x19')](0x194);}return _0x68b288;};}function handleError(_0x93cd8f,_0x3addcb){_0x3addcb=_0x3addcb||0x1f4;return function(_0x2bda24){logger[_0x3dbb('0x23')](_0x2bda24['stack']);if(_0x2bda24[_0x3dbb('0x24')]){delete _0x2bda24[_0x3dbb('0x24')];}_0x93cd8f[_0x3dbb('0x25')](_0x3addcb)[_0x3dbb('0x26')](_0x2bda24);};}exports[_0x3dbb('0x27')]=function(_0x2b9f49,_0x4f3c4f){var _0x44865b={},_0x25f83e={},_0xa1ade4={'count':0x0,'rows':[]};var _0x231e23=_['map'](db[_0x3dbb('0x28')][_0x3dbb('0x29')],function(_0x411dc7){return{'name':_0x411dc7[_0x3dbb('0x2a')],'type':_0x411dc7[_0x3dbb('0x2b')][_0x3dbb('0x2c')]};});_0x25f83e[_0x3dbb('0x2d')]=_[_0x3dbb('0x2e')](_0x231e23,'name');_0x25f83e[_0x3dbb('0x2f')]=_['keys'](_0x2b9f49[_0x3dbb('0x2f')]);_0x25f83e[_0x3dbb('0x30')]=_['intersection'](_0x25f83e[_0x3dbb('0x2d')],_0x25f83e['query']);_0x44865b[_0x3dbb('0x31')]=_['intersection'](_0x25f83e[_0x3dbb('0x2d')],qs[_0x3dbb('0x32')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x32')]));_0x44865b[_0x3dbb('0x31')]=_0x44865b['attributes'][_0x3dbb('0x33')]?_0x44865b[_0x3dbb('0x31')]:_0x25f83e[_0x3dbb('0x2d')];if(!_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x34')](_0x3dbb('0x35'))){_0x44865b[_0x3dbb('0x1d')]=qs[_0x3dbb('0x1d')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x1d')]);_0x44865b[_0x3dbb('0x1f')]=qs[_0x3dbb('0x1f')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x1f')]);}_0x44865b[_0x3dbb('0x36')]=qs[_0x3dbb('0x37')](_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x37')]);_0x44865b['where']=qs[_0x3dbb('0x30')](_[_0x3dbb('0x38')](_0x2b9f49[_0x3dbb('0x2f')],_0x25f83e['filters']),_0x231e23);if(_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x39')]){_0x44865b[_0x3dbb('0x3a')]=_[_0x3dbb('0x3b')](_0x44865b[_0x3dbb('0x3a')],{'$or':_[_0x3dbb('0x2e')](_0x231e23,function(_0x112d01){if(_0x112d01['type']!==_0x3dbb('0x3c')){var _0x3ee252={};_0x3ee252[_0x112d01['name']]={'$like':'%'+_0x2b9f49[_0x3dbb('0x2f')][_0x3dbb('0x39')]+'%'};return _0x3ee252;}})});}_0x44865b=_[_0x3dbb('0x3b')]({},_0x44865b,_0x2b9f49[_0x3dbb('0x3d')]);var _0x4d65e8={'where':_0x44865b[_0x3dbb('0x3a')]};return db['Migration'][_0x3dbb('0x1e')](_0x4d65e8)[_0x3dbb('0x3e')](function(_0xe3bb98){_0xa1ade4[_0x3dbb('0x1e')]=_0xe3bb98;if(_0x2b9f49['query'][_0x3dbb('0x3f')]){_0x44865b[_0x3dbb('0x40')]=[{'all':!![]}];}return db['Migration']['findAll'](_0x44865b);})[_0x3dbb('0x3e')](function(_0x192774){_0xa1ade4[_0x3dbb('0x41')]=_0x192774;return _0xa1ade4;})[_0x3dbb('0x3e')](respondWithFilteredResult(_0x4f3c4f,_0x44865b))['catch'](handleError(_0x4f3c4f,null));}; \ No newline at end of file +var _0x86e7=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','end','error','stack','name','send','Migration','fieldName','type','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','include','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv'];(function(_0x514190,_0x153c4c){var _0x57be8b=function(_0x35b7ab){while(--_0x35b7ab){_0x514190['push'](_0x514190['shift']());}};_0x57be8b(++_0x153c4c);}(_0x86e7,0x130));var _0x786e=function(_0x5c3ae9,_0x450f9a){_0x5c3ae9=_0x5c3ae9-0x0;var _0x3f5950=_0x86e7[_0x5c3ae9];return _0x3f5950;};'use strict';var emlformat=require(_0x786e('0x0'));var rimraf=require(_0x786e('0x1'));var zipdir=require(_0x786e('0x2'));var jsonpatch=require(_0x786e('0x3'));var rp=require('request-promise');var moment=require(_0x786e('0x4'));var BPromise=require(_0x786e('0x5'));var Mustache=require(_0x786e('0x6'));var util=require(_0x786e('0x7'));var path=require(_0x786e('0x8'));var sox=require(_0x786e('0x9'));var csv=require('to-csv');var ejs=require(_0x786e('0xa'));var fs=require('fs');var fs_extra=require(_0x786e('0xb'));var _=require(_0x786e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x786e('0xd'));var deskjs=require(_0x786e('0xe'));var toCsv=require(_0x786e('0xf'));var querystring=require(_0x786e('0x10'));var Papa=require(_0x786e('0x11'));var Redis=require('ioredis');var authService=require(_0x786e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x786e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x786e('0x14'))(_0x786e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x786e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b59bd,_0x4c8759){_0x4c8759=_0x4c8759||0xcc;return function(_0x517d98){if(_0x517d98){return _0x3b59bd[_0x786e('0x17')](_0x4c8759);}return _0x3b59bd[_0x786e('0x18')](_0x4c8759)['end']();};}function respondWithResult(_0x5d627c,_0x557472){_0x557472=_0x557472||0xc8;return function(_0x40d7c3){if(_0x40d7c3){return _0x5d627c[_0x786e('0x18')](_0x557472)[_0x786e('0x19')](_0x40d7c3);}};}function respondWithFilteredResult(_0x4297b4,_0x269d9e){return function(_0x446453){if(_0x446453){var _0x5e47ac=typeof _0x269d9e[_0x786e('0x1a')]==='undefined'&&typeof _0x269d9e[_0x786e('0x1b')]===_0x786e('0x1c');var _0x4a6412=_0x446453[_0x786e('0x1d')];var _0x4d6a1a=_0x5e47ac?0x0:_0x269d9e[_0x786e('0x1a')];var _0x276e19=_0x5e47ac?_0x446453[_0x786e('0x1d')]:_0x269d9e['offset']+_0x269d9e[_0x786e('0x1b')];var _0x1a6a0e;if(_0x276e19>=_0x4a6412){_0x276e19=_0x4a6412;_0x1a6a0e=0xc8;}else{_0x1a6a0e=0xce;}_0x4297b4[_0x786e('0x18')](_0x1a6a0e);return _0x4297b4[_0x786e('0x1e')]('Content-Range',_0x4d6a1a+'-'+_0x276e19+'/'+_0x4a6412)['json'](_0x446453);}return null;};}function patchUpdates(_0x55edf5){return function(_0x2e07f6){try{jsonpatch[_0x786e('0x1f')](_0x2e07f6,_0x55edf5,!![]);}catch(_0xd8f19f){return BPromise[_0x786e('0x20')](_0xd8f19f);}return _0x2e07f6[_0x786e('0x21')]();};}function saveUpdates(_0x26a899,_0x789d77){return function(_0xda491f){if(_0xda491f){return _0xda491f['update'](_0x26a899)['then'](function(_0x1157e4){return _0x1157e4;});}return null;};}function removeEntity(_0x11534a,_0x4668d6){return function(_0x52287e){if(_0x52287e){return _0x52287e[_0x786e('0x22')]()[_0x786e('0x23')](function(){_0x11534a[_0x786e('0x18')](0xcc)[_0x786e('0x24')]();});}};}function handleEntityNotFound(_0x3cadeb,_0x1b38f8){return function(_0x1ac346){if(!_0x1ac346){_0x3cadeb['sendStatus'](0x194);}return _0x1ac346;};}function handleError(_0x3bd7f1,_0x40643f){_0x40643f=_0x40643f||0x1f4;return function(_0x76311){logger[_0x786e('0x25')](_0x76311[_0x786e('0x26')]);if(_0x76311['name']){delete _0x76311[_0x786e('0x27')];}_0x3bd7f1['status'](_0x40643f)[_0x786e('0x28')](_0x76311);};}exports['index']=function(_0x7b4459,_0x2f09e1){var _0x3021fc={},_0xba4de2={},_0x443b7c={'count':0x0,'rows':[]};var _0x1c99d3=_['map'](db[_0x786e('0x29')]['rawAttributes'],function(_0x77750e){return{'name':_0x77750e[_0x786e('0x2a')],'type':_0x77750e[_0x786e('0x2b')]['key']};});_0xba4de2[_0x786e('0x2c')]=_[_0x786e('0x2d')](_0x1c99d3,_0x786e('0x27'));_0xba4de2[_0x786e('0x2e')]=_['keys'](_0x7b4459[_0x786e('0x2e')]);_0xba4de2['filters']=_[_0x786e('0x2f')](_0xba4de2[_0x786e('0x2c')],_0xba4de2[_0x786e('0x2e')]);_0x3021fc[_0x786e('0x30')]=_[_0x786e('0x2f')](_0xba4de2[_0x786e('0x2c')],qs['fields'](_0x7b4459[_0x786e('0x2e')][_0x786e('0x31')]));_0x3021fc[_0x786e('0x30')]=_0x3021fc['attributes'][_0x786e('0x32')]?_0x3021fc[_0x786e('0x30')]:_0xba4de2['model'];if(!_0x7b4459[_0x786e('0x2e')][_0x786e('0x33')](_0x786e('0x34'))){_0x3021fc['limit']=qs[_0x786e('0x1b')](_0x7b4459[_0x786e('0x2e')][_0x786e('0x1b')]);_0x3021fc[_0x786e('0x1a')]=qs[_0x786e('0x1a')](_0x7b4459[_0x786e('0x2e')][_0x786e('0x1a')]);}_0x3021fc[_0x786e('0x35')]=qs['sort'](_0x7b4459[_0x786e('0x2e')][_0x786e('0x36')]);_0x3021fc[_0x786e('0x37')]=qs[_0x786e('0x38')](_[_0x786e('0x39')](_0x7b4459[_0x786e('0x2e')],_0xba4de2['filters']),_0x1c99d3);if(_0x7b4459[_0x786e('0x2e')]['filter']){_0x3021fc['where']=_['merge'](_0x3021fc['where'],{'$or':_[_0x786e('0x2d')](_0x1c99d3,function(_0x43f191){if(_0x43f191[_0x786e('0x2b')]!==_0x786e('0x3a')){var _0x23719b={};_0x23719b[_0x43f191['name']]={'$like':'%'+_0x7b4459[_0x786e('0x2e')][_0x786e('0x3b')]+'%'};return _0x23719b;}})});}_0x3021fc=_[_0x786e('0x3c')]({},_0x3021fc,_0x7b4459[_0x786e('0x3d')]);var _0x1a01c0={'where':_0x3021fc[_0x786e('0x37')]};return db[_0x786e('0x29')][_0x786e('0x1d')](_0x1a01c0)[_0x786e('0x23')](function(_0x5e4d6e){_0x443b7c[_0x786e('0x1d')]=_0x5e4d6e;if(_0x7b4459['query']['includeAll']){_0x3021fc[_0x786e('0x3e')]=[{'all':!![]}];}return db[_0x786e('0x29')]['findAll'](_0x3021fc);})[_0x786e('0x23')](function(_0x834d0e){_0x443b7c['rows']=_0x834d0e;return _0x443b7c;})[_0x786e('0x23')](respondWithFilteredResult(_0x2f09e1,_0x3021fc))[_0x786e('0x3f')](handleError(_0x2f09e1,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0f48118..8e9ae4e 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 _0xae4f=['bluebird','request-promise','path','rimraf','./migration.attributes','exports','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x895213,_0x46c7b0){var _0x4c2c65=function(_0x176f40){while(--_0x176f40){_0x895213['push'](_0x895213['shift']());}};_0x4c2c65(++_0x46c7b0);}(_0xae4f,0x1e9));var _0xfae4=function(_0x11ef08,_0x5d550f){_0x11ef08=_0x11ef08-0x0;var _0x5e7855=_0xae4f[_0x11ef08];return _0x5e7855;};'use strict';var _=require(_0xfae4('0x0'));var util=require(_0xfae4('0x1'));var logger=require(_0xfae4('0x2'))(_0xfae4('0x3'));var moment=require(_0xfae4('0x4'));var BPromise=require(_0xfae4('0x5'));var rp=require(_0xfae4('0x6'));var fs=require('fs');var path=require(_0xfae4('0x7'));var rimraf=require(_0xfae4('0x8'));var config=require('../../config/environment');var attributes=require(_0xfae4('0x9'));module[_0xfae4('0xa')]=function(_0x26eec6,_0x190583){return _0x26eec6['define'](_0xfae4('0xb'),attributes,{'tableName':_0xfae4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1db7=['rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x43156a,_0x3622a8){var _0x10c75c=function(_0x9f7fad){while(--_0x9f7fad){_0x43156a['push'](_0x43156a['shift']());}};_0x10c75c(++_0x3622a8);}(_0x1db7,0x13f));var _0x71db=function(_0x251f32,_0x207989){_0x251f32=_0x251f32-0x0;var _0x3c1d33=_0x1db7[_0x251f32];return _0x3c1d33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x71db('0x0'))(_0x71db('0x1'));var moment=require(_0x71db('0x2'));var BPromise=require(_0x71db('0x3'));var rp=require(_0x71db('0x4'));var fs=require('fs');var path=require(_0x71db('0x5'));var rimraf=require(_0x71db('0x6'));var config=require(_0x71db('0x7'));var attributes=require(_0x71db('0x8'));module[_0x71db('0x9')]=function(_0x9a36e,_0x5b7799){return _0x9a36e[_0x71db('0xa')](_0x71db('0xb'),attributes,{'tableName':_0x71db('0xc'),'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 65c5aa7..6bfcc2c 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 _0xfc65=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x463ae2,_0x572a04){var _0x3c842e=function(_0x2ad2b8){while(--_0x2ad2b8){_0x463ae2['push'](_0x463ae2['shift']());}};_0x3c842e(++_0x572a04);}(_0xfc65,0x1b4));var _0x5fc6=function(_0x1b3e3e,_0x4d76af){_0x1b3e3e=_0x1b3e3e-0x0;var _0x5f2b6b=_0xfc65[_0x1b3e3e];return _0x5f2b6b;};'use strict';var _=require(_0x5fc6('0x0'));var util=require(_0x5fc6('0x1'));var moment=require(_0x5fc6('0x2'));var BPromise=require(_0x5fc6('0x3'));var rs=require(_0x5fc6('0x4'));var fs=require('fs');var Redis=require(_0x5fc6('0x5'));var db=require(_0x5fc6('0x6'))['db'];var utils=require(_0x5fc6('0x7'));var logger=require(_0x5fc6('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5fc6('0x9'));var client=jayson[_0x5fc6('0xa')][_0x5fc6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26d89e,_0x1360cb,_0x5c93f7){return new BPromise(function(_0x5a47c1,_0x467f6b){return client[_0x5fc6('0xc')](_0x26d89e,_0x5c93f7)[_0x5fc6('0xd')](function(_0x52f28c){logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1360cb,'request\x20sent');logger[_0x5fc6('0x10')](_0x5fc6('0x11'),_0x1360cb,'request\x20sent',JSON['stringify'](_0x52f28c));if(_0x52f28c[_0x5fc6('0x12')]){if(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x13')]===0x1f4){logger['error'](_0x5fc6('0xf'),_0x1360cb,_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);return _0x467f6b(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);}logger[_0x5fc6('0x12')]('Migration,\x20%s,\x20%s',_0x1360cb,_0x52f28c[_0x5fc6('0x12')]['message']);return _0x5a47c1(_0x52f28c[_0x5fc6('0x12')][_0x5fc6('0x14')]);}else{logger[_0x5fc6('0xe')](_0x5fc6('0xf'),_0x1360cb,'request\x20sent');_0x5a47c1(_0x52f28c[_0x5fc6('0x15')]['message']);}})[_0x5fc6('0x16')](function(_0x585f13){logger['error'](_0x5fc6('0xf'),_0x1360cb,_0x585f13);_0x467f6b(_0x585f13);});});} \ No newline at end of file +var _0x3e5c=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xda7638,_0x5b033d){var _0x585b7d=function(_0x34d9e1){while(--_0x34d9e1){_0xda7638['push'](_0xda7638['shift']());}};_0x585b7d(++_0x5b033d);}(_0x3e5c,0x9a));var _0xc3e5=function(_0xc0bd42,_0x29a713){_0xc0bd42=_0xc0bd42-0x0;var _0x300e49=_0x3e5c[_0xc0bd42];return _0x300e49;};'use strict';var _=require(_0xc3e5('0x0'));var util=require(_0xc3e5('0x1'));var moment=require(_0xc3e5('0x2'));var BPromise=require(_0xc3e5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc3e5('0x4'));var db=require(_0xc3e5('0x5'))['db'];var utils=require(_0xc3e5('0x6'));var logger=require(_0xc3e5('0x7'))(_0xc3e5('0x8'));var config=require(_0xc3e5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc3e5('0xa')][_0xc3e5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d6089,_0xcbbec0,_0x2d580e){return new BPromise(function(_0x4864a2,_0x196f3a){return client[_0xc3e5('0xc')](_0x2d6089,_0x2d580e)[_0xc3e5('0xd')](function(_0x19813b){logger[_0xc3e5('0xe')](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));logger['debug'](_0xc3e5('0x11'),_0xcbbec0,_0xc3e5('0x10'),JSON[_0xc3e5('0x12')](_0x19813b));if(_0x19813b[_0xc3e5('0x13')]){if(_0x19813b['error'][_0xc3e5('0x14')]===0x1f4){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);return _0x196f3a(_0x19813b[_0xc3e5('0x13')]['message']);}logger['error']('Migration,\x20%s,\x20%s',_0xcbbec0,_0x19813b[_0xc3e5('0x13')]['message']);return _0x4864a2(_0x19813b[_0xc3e5('0x13')][_0xc3e5('0x15')]);}else{logger['info'](_0xc3e5('0xf'),_0xcbbec0,_0xc3e5('0x10'));_0x4864a2(_0x19813b[_0xc3e5('0x16')][_0xc3e5('0x15')]);}})[_0xc3e5('0x17')](function(_0x47cfd8){logger[_0xc3e5('0x13')](_0xc3e5('0xf'),_0xcbbec0,_0x47cfd8);_0x196f3a(_0x47cfd8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 824f821..7fe3b67 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 _0xe14a=['isAuthenticated','index','/:id','show','post','create','update','delete','Router','fs-extra','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14a,0x94));var _0xae14=function(_0x428543,_0x5de030){_0x428543=_0x428543-0x0;var _0x5e4468=_0xe14a[_0x428543];return _0x5e4468;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xae14('0x0')]();var fs_extra=require(_0xae14('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0xae14('0x2'));var config=require(_0xae14('0x3'));var controller=require(_0xae14('0x4'));router[_0xae14('0x5')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0x7')]);router[_0xae14('0x5')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller[_0xae14('0x9')]);router[_0xae14('0xa')]('/',auth[_0xae14('0x6')](),controller[_0xae14('0xb')]);router['put']('/:id',auth[_0xae14('0x6')](),controller[_0xae14('0xc')]);router[_0xae14('0xd')](_0xae14('0x8'),auth[_0xae14('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8b8e=['isAuthenticated','index','/:id','post','create','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get'];(function(_0x47eb6c,_0x5be3d1){var _0x218d80=function(_0x5ad4e1){while(--_0x5ad4e1){_0x47eb6c['push'](_0x47eb6c['shift']());}};_0x218d80(++_0x5be3d1);}(_0x8b8e,0x108));var _0xe8b8=function(_0x534517,_0x7a1313){_0x534517=_0x534517-0x0;var _0x258db3=_0x8b8e[_0x534517];return _0x258db3;};'use strict';var multer=require(_0xe8b8('0x0'));var util=require('util');var path=require(_0xe8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xe8b8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe8b8('0x3'));var interaction=require(_0xe8b8('0x4'));var config=require(_0xe8b8('0x5'));var controller=require(_0xe8b8('0x6'));router[_0xe8b8('0x7')]('/',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0x9')]);router[_0xe8b8('0x7')](_0xe8b8('0xa'),auth[_0xe8b8('0x8')](),controller['show']);router[_0xe8b8('0xb')]('/',auth['isAuthenticated'](),controller[_0xe8b8('0xc')]);router['put']('/:id',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xd')]);router['delete']('/:id',auth[_0xe8b8('0x8')](),controller[_0xe8b8('0xe')]);module[_0xe8b8('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index b3066af..dc6c896 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 _0xadc6=['STRING','sequelize','ENUM','externip','stun','turn'];(function(_0x583922,_0x1af506){var _0x46d2b9=function(_0x31630f){while(--_0x31630f){_0x583922['push'](_0x583922['shift']());}};_0x46d2b9(++_0x1af506);}(_0xadc6,0x1ed));var _0x6adc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xadc6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6adc('0x0'));module['exports']={'type':{'type':Sequelize[_0x6adc('0x1')]('localnet',_0x6adc('0x2'),_0x6adc('0x3'),_0x6adc('0x4'))},'value':{'type':Sequelize[_0x6adc('0x5')]},'username':{'type':Sequelize[_0x6adc('0x5')]},'password':{'type':Sequelize[_0x6adc('0x5')]}}; \ No newline at end of file +var _0xbcf8=['ENUM','localnet','stun','turn','STRING'];(function(_0xf43bc4,_0x50449c){var _0x237010=function(_0xdcd362){while(--_0xdcd362){_0xf43bc4['push'](_0xf43bc4['shift']());}};_0x237010(++_0x50449c);}(_0xbcf8,0x73));var _0x8bcf=function(_0x8d5241,_0x4b2266){_0x8d5241=_0x8d5241-0x0;var _0x5124e4=_0xbcf8[_0x8d5241];return _0x5124e4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8bcf('0x0')](_0x8bcf('0x1'),'externip',_0x8bcf('0x2'),_0x8bcf('0x3'))},'value':{'type':Sequelize[_0x8bcf('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8bcf('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 8dc52d9..ce4d16e 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 _0x7c25=['Network','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','TURN','root','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','/etc/asterisk/stun_xcally.conf','util','path','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','http','request','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','result','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','stack','name','send','index','map'];(function(_0x1ceceb,_0x4b74d3){var _0x5c541e=function(_0x5d36fa){while(--_0x5d36fa){_0x1ceceb['push'](_0x1ceceb['shift']());}};_0x5c541e(++_0x4b74d3);}(_0x7c25,0x138));var _0x57c2=function(_0x3cd40d,_0x220f25){_0x3cd40d=_0x3cd40d-0x0;var _0x572d71=_0x7c25[_0x3cd40d];return _0x572d71;};'use strict';var util=require(_0x57c2('0x0'));var path=require(_0x57c2('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x57c2('0x2'))('api');var config=require(_0x57c2('0x3'));var db=require(_0x57c2('0x4'))['db'];var jayson=require(_0x57c2('0x5'));var client=jayson[_0x57c2('0x6')][_0x57c2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d8c97,_0xbafa2e,_0x41897b,_0x52de9b){return new Promise(function(_0x133386,_0x58b9b6){var _0x379758=_0x52de9b||client;return _0x379758[_0x57c2('0x8')](_0x1d8c97,_0x41897b)['then'](function(_0x24bcc2){logger['info']('Network,\x20%s,\x20%s',_0xbafa2e,'request\x20sent');logger[_0x57c2('0x9')](_0x57c2('0xa'),_0xbafa2e,_0x57c2('0xb'),JSON[_0x57c2('0xc')](_0x24bcc2));if(_0x24bcc2[_0x57c2('0xd')]){if(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0xe')]===0x1f4){logger[_0x57c2('0xd')](_0x57c2('0xf'),_0xbafa2e,_0x24bcc2['error'][_0x57c2('0x10')]);return _0x58b9b6(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0x10')]);}logger[_0x57c2('0xd')]('Network,\x20%s,\x20%s',_0xbafa2e,_0x24bcc2[_0x57c2('0xd')]['message']);return _0x133386(_0x24bcc2[_0x57c2('0xd')][_0x57c2('0x10')]);}else{logger['info']('Network,\x20%s,\x20%s',_0xbafa2e,_0x57c2('0xb'));_0x133386(_0x24bcc2[_0x57c2('0x11')][_0x57c2('0x10')]);}})['catch'](function(_0x44f820){logger['error'](_0x57c2('0xf'),_0xbafa2e,_0x44f820);_0x58b9b6(_0x44f820);});});}function respondWithResult(_0x4e1fc3,_0x3c1049){_0x3c1049=_0x3c1049||0xc8;return function(_0x5293cc){if(_0x5293cc){return _0x4e1fc3[_0x57c2('0x12')](_0x3c1049)['json'](_0x5293cc);}};}function respondWithFilteredResult(_0xb1a184,_0x3ee74c){return function(_0x3a3585){if(_0x3a3585){var _0x2be300=typeof _0x3ee74c[_0x57c2('0x13')]===_0x57c2('0x14')&&typeof _0x3ee74c[_0x57c2('0x15')]===_0x57c2('0x14');var _0x364291=_0x3a3585[_0x57c2('0x16')];var _0x475594=_0x2be300?0x0:_0x3ee74c[_0x57c2('0x13')];var _0x430bda=_0x2be300?_0x3a3585[_0x57c2('0x16')]:_0x3ee74c[_0x57c2('0x13')]+_0x3ee74c['limit'];var _0x5da671;if(_0x430bda>=_0x364291){_0x430bda=_0x364291;_0x5da671=0xc8;}else{_0x5da671=0xce;}_0xb1a184[_0x57c2('0x12')](_0x5da671);return _0xb1a184[_0x57c2('0x17')](_0x57c2('0x18'),_0x475594+'-'+_0x430bda+'/'+_0x364291)[_0x57c2('0x19')](_0x3a3585);}return null;};}function saveUpdates(_0x373e17){return function(_0x443357){if(_0x443357){return _0x443357[_0x57c2('0x1a')](_0x373e17)[_0x57c2('0x1b')](function(_0x5c85cf){return _0x5c85cf;});}return null;};}function removeEntity(_0x20c18a){return function(_0x1efd23){if(_0x1efd23){return _0x1efd23[_0x57c2('0x1c')]()[_0x57c2('0x1b')](function(){_0x20c18a[_0x57c2('0x12')](0xcc)[_0x57c2('0x1d')]();});}};}function handleEntityNotFound(_0x1eac77){return function(_0x51d7b3){if(!_0x51d7b3){_0x1eac77[_0x57c2('0x1e')](0x194);}return _0x51d7b3;};}function handleError(_0x59b6d8,_0x5db01b){_0x5db01b=_0x5db01b||0x1f4;return function(_0x5ddaaa){logger['error'](_0x5ddaaa[_0x57c2('0x1f')]);if(_0x5ddaaa[_0x57c2('0x20')]){delete _0x5ddaaa[_0x57c2('0x20')];}_0x59b6d8[_0x57c2('0x12')](_0x5db01b)[_0x57c2('0x21')](_0x5ddaaa);};}exports[_0x57c2('0x22')]=function(_0x5df6e1,_0x48588c){var _0x28946b={},_0x47baed={},_0x1e2743={'count':0x0,'rows':[]};var _0x18f927=_[_0x57c2('0x23')](db[_0x57c2('0x24')][_0x57c2('0x25')],function(_0x3050c0){return{'name':_0x3050c0[_0x57c2('0x26')],'type':_0x3050c0[_0x57c2('0x27')]['key']};});_0x47baed[_0x57c2('0x28')]=_[_0x57c2('0x23')](_0x18f927,_0x57c2('0x20'));_0x47baed[_0x57c2('0x29')]=_[_0x57c2('0x2a')](_0x5df6e1[_0x57c2('0x29')]);_0x47baed[_0x57c2('0x2b')]=_[_0x57c2('0x2c')](_0x47baed[_0x57c2('0x28')],_0x47baed[_0x57c2('0x29')]);_0x28946b[_0x57c2('0x2d')]=_[_0x57c2('0x2c')](_0x47baed['model'],qs[_0x57c2('0x2e')](_0x5df6e1[_0x57c2('0x29')][_0x57c2('0x2e')]));_0x28946b[_0x57c2('0x2d')]=_0x28946b[_0x57c2('0x2d')][_0x57c2('0x2f')]?_0x28946b[_0x57c2('0x2d')]:_0x47baed['model'];if(!_0x5df6e1[_0x57c2('0x29')][_0x57c2('0x30')](_0x57c2('0x31'))){_0x28946b['limit']=qs[_0x57c2('0x15')](_0x5df6e1[_0x57c2('0x29')]['limit']);_0x28946b[_0x57c2('0x13')]=qs[_0x57c2('0x13')](_0x5df6e1[_0x57c2('0x29')]['offset']);}_0x28946b['order']=qs[_0x57c2('0x32')](_0x5df6e1['query'][_0x57c2('0x32')]);_0x28946b[_0x57c2('0x33')]=qs['filters'](_[_0x57c2('0x34')](_0x5df6e1[_0x57c2('0x29')],_0x47baed[_0x57c2('0x2b')]),_0x18f927);if(_0x5df6e1[_0x57c2('0x29')]['filter']){_0x28946b['where']=_[_0x57c2('0x35')](_0x28946b['where'],{'$or':_['map'](_0x18f927,function(_0xcf08c8){if(_0xcf08c8['type']!==_0x57c2('0x36')){var _0xfa5aa1={};_0xfa5aa1[_0xcf08c8['name']]={'$like':'%'+_0x5df6e1['query'][_0x57c2('0x37')]+'%'};return _0xfa5aa1;}})});}_0x28946b=_[_0x57c2('0x35')]({},_0x28946b,_0x5df6e1[_0x57c2('0x38')]);var _0x42398d={'where':_0x28946b[_0x57c2('0x33')]};return db[_0x57c2('0x24')][_0x57c2('0x16')](_0x42398d)[_0x57c2('0x1b')](function(_0x2b93f3){_0x1e2743[_0x57c2('0x16')]=_0x2b93f3;if(_0x5df6e1['query'][_0x57c2('0x39')]){_0x28946b[_0x57c2('0x3a')]=[{'all':!![]}];}return db[_0x57c2('0x24')]['findAll'](_0x28946b);})[_0x57c2('0x1b')](function(_0x5b002e){_0x1e2743[_0x57c2('0x3b')]=_0x5b002e;return _0x1e2743;})[_0x57c2('0x1b')](respondWithFilteredResult(_0x48588c,_0x28946b))[_0x57c2('0x3c')](handleError(_0x48588c,null));};exports[_0x57c2('0x3d')]=function(_0x3fe9a0,_0x3231d1){var _0x503712={'raw':!![],'where':{'id':_0x3fe9a0[_0x57c2('0x3e')]['id']}},_0x1e58cc={};_0x1e58cc[_0x57c2('0x28')]=_[_0x57c2('0x2a')](db[_0x57c2('0x24')][_0x57c2('0x25')]);_0x1e58cc['query']=_[_0x57c2('0x2a')](_0x3fe9a0[_0x57c2('0x29')]);_0x1e58cc[_0x57c2('0x2b')]=_[_0x57c2('0x2c')](_0x1e58cc['model'],_0x1e58cc[_0x57c2('0x29')]);_0x503712['attributes']=_[_0x57c2('0x2c')](_0x1e58cc[_0x57c2('0x28')],qs[_0x57c2('0x2e')](_0x3fe9a0[_0x57c2('0x29')][_0x57c2('0x2e')]));_0x503712[_0x57c2('0x2d')]=_0x503712[_0x57c2('0x2d')]['length']?_0x503712[_0x57c2('0x2d')]:_0x1e58cc[_0x57c2('0x28')];if(_0x3fe9a0['query'][_0x57c2('0x39')]){_0x503712[_0x57c2('0x3a')]=[{'all':!![]}];}_0x503712=_['merge']({},_0x503712,_0x3fe9a0[_0x57c2('0x38')]);return db[_0x57c2('0x24')][_0x57c2('0x3f')](_0x503712)['then'](handleEntityNotFound(_0x3231d1,null))['then'](respondWithResult(_0x3231d1,null))['catch'](handleError(_0x3231d1,null));};exports[_0x57c2('0x40')]=function(_0x39f829,_0x570976){var _0x3f490d;return db[_0x57c2('0x24')]['create'](_0x39f829[_0x57c2('0x41')],{'raw':!![]})['then'](function(_0x16cc0f){_0x3f490d=_0x16cc0f;return db[_0x57c2('0x24')][_0x57c2('0x42')]({'where':{'type':_0x39f829[_0x57c2('0x41')][_0x57c2('0x27')]},'raw':!![]});})[_0x57c2('0x1b')](function(_0x53fce9){if(_0x3f490d[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x4a1f4e=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config['root'],_0x57c2('0x47')),_0x57c2('0x48'));var _0x5df926=ejs['render'](_0x4a1f4e,{'networks':_0x53fce9||[]});fs[_0x57c2('0x49')]('/etc/asterisk/stun_xcally.conf',_0x5df926);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':'res_stun_monitor.so'});}else if(_0x3f490d[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x4b')){var _0x576b5f=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x4d')),_0x57c2('0x48'));var _0x510d39=ejs[_0x57c2('0x4e')](_0x576b5f,{'networks':_0x53fce9||[]});fs['writeFileSync'](_0x57c2('0x4f'),_0x510d39);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':_0x57c2('0x50')});}else{var _0xa5053d=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x51')),'utf8');var _0x468980=ejs[_0x57c2('0x4e')](_0xa5053d,{'networks':_0x53fce9||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x39f829['body'][_0x57c2('0x27')][_0x57c2('0x54')]()),_0x468980);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x40'),{'module':_0x57c2('0x55')});}})[_0x57c2('0x1b')](function(){return _0x3f490d;})[_0x57c2('0x1b')](respondWithResult(_0x570976,0xc9))[_0x57c2('0x3c')](handleError(_0x570976,null));};exports['update']=function(_0x1b97fe,_0x3209ab){var _0x345108;return db['Network'][_0x57c2('0x3f')]({'where':{'id':_0x1b97fe[_0x57c2('0x3e')]['id']}})[_0x57c2('0x1b')](handleEntityNotFound(_0x3209ab,null))[_0x57c2('0x1b')](saveUpdates(_0x1b97fe[_0x57c2('0x41')],null))['then'](function(_0x3b6398){if(_0x3b6398){_0x345108=_0x3b6398;return db[_0x57c2('0x24')]['findAll']({'where':{'type':_0x345108[_0x57c2('0x27')]},'raw':!![]});}return null;})[_0x57c2('0x1b')](function(_0x4862f2){if(_0x345108[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x39f8ee=fs['readFileSync'](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x47')),_0x57c2('0x48'));var _0x12c0c2=ejs[_0x57c2('0x4e')](_0x39f8ee,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](_0x57c2('0x56'),_0x12c0c2);return respondWithRpcPromise(_0x57c2('0x4a'),_0x57c2('0x1a'),{'module':_0x57c2('0x50')});}else if(_0x345108[_0x57c2('0x27')]['toUpperCase']()==_0x57c2('0x4b')){var _0x21465=fs['readFileSync'](path['join'](config[_0x57c2('0x4c')],_0x57c2('0x4d')),_0x57c2('0x48'));var _0x17abc3=ejs[_0x57c2('0x4e')](_0x21465,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](_0x57c2('0x4f'),_0x17abc3);return respondWithRpcPromise(_0x57c2('0x4a'),'update',{'module':_0x57c2('0x50')});}else{var _0xfa9a2e=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],_0x57c2('0x51')),'utf8');var _0x2227d6=ejs['render'](_0xfa9a2e,{'networks':_0x4862f2||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x1b97fe[_0x57c2('0x41')]['type']['toLowerCase']()),_0x2227d6);return respondWithRpcPromise(_0x57c2('0x4a'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x41d959){if(_0x41d959){return _0x345108;}return null;})[_0x57c2('0x1b')](respondWithResult(_0x3209ab,null))['catch'](handleError(_0x3209ab,null));};exports[_0x57c2('0x1c')]=function(_0xb50870,_0x13691c){var _0x16efe0;return db[_0x57c2('0x24')][_0x57c2('0x3f')]({'where':{'id':_0xb50870[_0x57c2('0x3e')]['id']}})[_0x57c2('0x1b')](function(_0x1dd8a6){_0x16efe0=_0x1dd8a6;return _0x1dd8a6;})[_0x57c2('0x1b')](handleEntityNotFound(_0x13691c,null))[_0x57c2('0x1b')](removeEntity(_0x13691c,null))[_0x57c2('0x1b')](function(){if(_0x16efe0){return db['Network'][_0x57c2('0x42')]({'where':{'type':_0x16efe0['type']},'raw':!![]});}})[_0x57c2('0x1b')](function(_0x303c14){if(_0x16efe0[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x44')){var _0x5096f1=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config[_0x57c2('0x4c')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x495d5c=ejs[_0x57c2('0x4e')](_0x5096f1,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')]('/etc/asterisk/stun_xcally.conf',_0x495d5c);return respondWithRpcPromise('Reload',_0x57c2('0x1c'),{'module':_0x57c2('0x50')});}else if(_0x16efe0[_0x57c2('0x27')][_0x57c2('0x43')]()==_0x57c2('0x4b')){var _0x4b4fa9=fs[_0x57c2('0x45')](path[_0x57c2('0x46')](config['root'],_0x57c2('0x4d')),_0x57c2('0x48'));var _0xe09917=ejs[_0x57c2('0x4e')](_0x4b4fa9,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')]('/etc/asterisk/turn_xcally.conf',_0xe09917);return respondWithRpcPromise('Reload',_0x57c2('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x18a7bb=fs[_0x57c2('0x45')](path['join'](config[_0x57c2('0x4c')],'server/files/templates/network.ejs'),'utf8');var _0x585c47=ejs[_0x57c2('0x4e')](_0x18a7bb,{'networks':_0x303c14||[]});fs[_0x57c2('0x49')](util[_0x57c2('0x52')](_0x57c2('0x53'),_0x16efe0[_0x57c2('0x27')][_0x57c2('0x54')]()),_0x585c47);return respondWithRpcPromise(_0x57c2('0x4a'),'destroy',{'module':_0x57c2('0x55')});}})[_0x57c2('0x3c')](handleError(_0x13691c,null));}; \ No newline at end of file +var _0x1204=['count','limit','status','set','update','destroy','sendStatus','stack','name','index','map','Network','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','rows','show','params','length','create','body','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','utf8','format','chan_sip.so','util','ejs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','Network,\x20%s,\x20%s','json','offset','undefined'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x1204,0x184));var _0x4120=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1204[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x4120('0x0'));var path=require('path');var ejs=require(_0x4120('0x1'));var fs=require('fs');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x4120('0x2'))(_0x4120('0x3'));var config=require(_0x4120('0x4'));var db=require(_0x4120('0x5'))['db'];var jayson=require(_0x4120('0x6'));var client=jayson[_0x4120('0x7')][_0x4120('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36e5c2,_0x4e441b,_0x1ad3b8,_0x2b21b8){return new Promise(function(_0x2dabaa,_0x1a5abb){var _0x39598a=_0x2b21b8||client;return _0x39598a[_0x4120('0x9')](_0x36e5c2,_0x1ad3b8)[_0x4120('0xa')](function(_0x3a2583){logger['info']('Network,\x20%s,\x20%s',_0x4e441b,'request\x20sent');logger['debug'](_0x4120('0xb'),_0x4e441b,_0x4120('0xc'),JSON[_0x4120('0xd')](_0x3a2583));if(_0x3a2583[_0x4120('0xe')]){if(_0x3a2583[_0x4120('0xe')]['code']===0x1f4){logger['error']('Network,\x20%s,\x20%s',_0x4e441b,_0x3a2583[_0x4120('0xe')][_0x4120('0xf')]);return _0x1a5abb(_0x3a2583[_0x4120('0xe')][_0x4120('0xf')]);}logger[_0x4120('0xe')]('Network,\x20%s,\x20%s',_0x4e441b,_0x3a2583['error'][_0x4120('0xf')]);return _0x2dabaa(_0x3a2583[_0x4120('0xe')]['message']);}else{logger[_0x4120('0x10')]('Network,\x20%s,\x20%s',_0x4e441b,_0x4120('0xc'));_0x2dabaa(_0x3a2583['result'][_0x4120('0xf')]);}})[_0x4120('0x11')](function(_0x5de416){logger['error'](_0x4120('0x12'),_0x4e441b,_0x5de416);_0x1a5abb(_0x5de416);});});}function respondWithResult(_0x5dfcc4,_0x293337){_0x293337=_0x293337||0xc8;return function(_0x1a8239){if(_0x1a8239){return _0x5dfcc4['status'](_0x293337)[_0x4120('0x13')](_0x1a8239);}};}function respondWithFilteredResult(_0xf6bd8,_0x2729e0){return function(_0x426f73){if(_0x426f73){var _0x50feb6=typeof _0x2729e0[_0x4120('0x14')]===_0x4120('0x15')&&typeof _0x2729e0['limit']==='undefined';var _0x346688=_0x426f73[_0x4120('0x16')];var _0x4ff3e3=_0x50feb6?0x0:_0x2729e0[_0x4120('0x14')];var _0xd76f40=_0x50feb6?_0x426f73[_0x4120('0x16')]:_0x2729e0['offset']+_0x2729e0[_0x4120('0x17')];var _0x3640df;if(_0xd76f40>=_0x346688){_0xd76f40=_0x346688;_0x3640df=0xc8;}else{_0x3640df=0xce;}_0xf6bd8[_0x4120('0x18')](_0x3640df);return _0xf6bd8[_0x4120('0x19')]('Content-Range',_0x4ff3e3+'-'+_0xd76f40+'/'+_0x346688)[_0x4120('0x13')](_0x426f73);}return null;};}function saveUpdates(_0x23ef87){return function(_0x2e1a38){if(_0x2e1a38){return _0x2e1a38[_0x4120('0x1a')](_0x23ef87)[_0x4120('0xa')](function(_0x4ec9e7){return _0x4ec9e7;});}return null;};}function removeEntity(_0x4f4395){return function(_0x24361d){if(_0x24361d){return _0x24361d[_0x4120('0x1b')]()[_0x4120('0xa')](function(){_0x4f4395[_0x4120('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x578ff5){return function(_0x286524){if(!_0x286524){_0x578ff5[_0x4120('0x1c')](0x194);}return _0x286524;};}function handleError(_0x2bf41b,_0x8f21ed){_0x8f21ed=_0x8f21ed||0x1f4;return function(_0x374a89){logger['error'](_0x374a89[_0x4120('0x1d')]);if(_0x374a89[_0x4120('0x1e')]){delete _0x374a89[_0x4120('0x1e')];}_0x2bf41b[_0x4120('0x18')](_0x8f21ed)['send'](_0x374a89);};}exports[_0x4120('0x1f')]=function(_0x68f930,_0x400522){var _0x49d7af={},_0xc5ecea={},_0x2324d9={'count':0x0,'rows':[]};var _0x2826a9=_[_0x4120('0x20')](db[_0x4120('0x21')][_0x4120('0x22')],function(_0x4ac0cc){return{'name':_0x4ac0cc[_0x4120('0x23')],'type':_0x4ac0cc[_0x4120('0x24')]['key']};});_0xc5ecea[_0x4120('0x25')]=_[_0x4120('0x20')](_0x2826a9,_0x4120('0x1e'));_0xc5ecea[_0x4120('0x26')]=_[_0x4120('0x27')](_0x68f930[_0x4120('0x26')]);_0xc5ecea['filters']=_[_0x4120('0x28')](_0xc5ecea[_0x4120('0x25')],_0xc5ecea[_0x4120('0x26')]);_0x49d7af[_0x4120('0x29')]=_[_0x4120('0x28')](_0xc5ecea['model'],qs[_0x4120('0x2a')](_0x68f930[_0x4120('0x26')]['fields']));_0x49d7af['attributes']=_0x49d7af[_0x4120('0x29')]['length']?_0x49d7af['attributes']:_0xc5ecea[_0x4120('0x25')];if(!_0x68f930[_0x4120('0x26')][_0x4120('0x2b')](_0x4120('0x2c'))){_0x49d7af[_0x4120('0x17')]=qs['limit'](_0x68f930[_0x4120('0x26')]['limit']);_0x49d7af[_0x4120('0x14')]=qs[_0x4120('0x14')](_0x68f930['query'][_0x4120('0x14')]);}_0x49d7af[_0x4120('0x2d')]=qs[_0x4120('0x2e')](_0x68f930[_0x4120('0x26')]['sort']);_0x49d7af['where']=qs['filters'](_[_0x4120('0x2f')](_0x68f930[_0x4120('0x26')],_0xc5ecea['filters']),_0x2826a9);if(_0x68f930['query']['filter']){_0x49d7af[_0x4120('0x30')]=_[_0x4120('0x31')](_0x49d7af[_0x4120('0x30')],{'$or':_[_0x4120('0x20')](_0x2826a9,function(_0x1ec0b1){if(_0x1ec0b1[_0x4120('0x24')]!=='VIRTUAL'){var _0x507d63={};_0x507d63[_0x1ec0b1[_0x4120('0x1e')]]={'$like':'%'+_0x68f930['query'][_0x4120('0x32')]+'%'};return _0x507d63;}})});}_0x49d7af=_[_0x4120('0x31')]({},_0x49d7af,_0x68f930[_0x4120('0x33')]);var _0x38a73f={'where':_0x49d7af[_0x4120('0x30')]};return db[_0x4120('0x21')][_0x4120('0x16')](_0x38a73f)[_0x4120('0xa')](function(_0x4ece8f){_0x2324d9[_0x4120('0x16')]=_0x4ece8f;if(_0x68f930[_0x4120('0x26')][_0x4120('0x34')]){_0x49d7af[_0x4120('0x35')]=[{'all':!![]}];}return db[_0x4120('0x21')]['findAll'](_0x49d7af);})[_0x4120('0xa')](function(_0x1d6736){_0x2324d9[_0x4120('0x36')]=_0x1d6736;return _0x2324d9;})[_0x4120('0xa')](respondWithFilteredResult(_0x400522,_0x49d7af))[_0x4120('0x11')](handleError(_0x400522,null));};exports[_0x4120('0x37')]=function(_0x431a21,_0x46d9e9){var _0x57899e={'raw':!![],'where':{'id':_0x431a21[_0x4120('0x38')]['id']}},_0x5f524e={};_0x5f524e[_0x4120('0x25')]=_[_0x4120('0x27')](db[_0x4120('0x21')][_0x4120('0x22')]);_0x5f524e['query']=_['keys'](_0x431a21[_0x4120('0x26')]);_0x5f524e['filters']=_[_0x4120('0x28')](_0x5f524e[_0x4120('0x25')],_0x5f524e[_0x4120('0x26')]);_0x57899e['attributes']=_[_0x4120('0x28')](_0x5f524e[_0x4120('0x25')],qs[_0x4120('0x2a')](_0x431a21[_0x4120('0x26')][_0x4120('0x2a')]));_0x57899e[_0x4120('0x29')]=_0x57899e[_0x4120('0x29')][_0x4120('0x39')]?_0x57899e[_0x4120('0x29')]:_0x5f524e[_0x4120('0x25')];if(_0x431a21[_0x4120('0x26')][_0x4120('0x34')]){_0x57899e[_0x4120('0x35')]=[{'all':!![]}];}_0x57899e=_['merge']({},_0x57899e,_0x431a21[_0x4120('0x33')]);return db[_0x4120('0x21')]['find'](_0x57899e)[_0x4120('0xa')](handleEntityNotFound(_0x46d9e9,null))[_0x4120('0xa')](respondWithResult(_0x46d9e9,null))[_0x4120('0x11')](handleError(_0x46d9e9,null));};exports[_0x4120('0x3a')]=function(_0xff9492,_0x439942){var _0x2765c6;return db['Network'][_0x4120('0x3a')](_0xff9492[_0x4120('0x3b')],{'raw':!![]})['then'](function(_0x1f7db5){_0x2765c6=_0x1f7db5;return db[_0x4120('0x21')][_0x4120('0x3c')]({'where':{'type':_0xff9492[_0x4120('0x3b')][_0x4120('0x24')]},'raw':!![]});})[_0x4120('0xa')](function(_0x181d2c){if(_0x2765c6['type'][_0x4120('0x3d')]()==_0x4120('0x3e')){var _0x128065=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config['root'],_0x4120('0x41')),'utf8');var _0x17dfaf=ejs[_0x4120('0x42')](_0x128065,{'networks':_0x181d2c||[]});fs[_0x4120('0x43')](_0x4120('0x44'),_0x17dfaf);return respondWithRpcPromise(_0x4120('0x45'),'create',{'module':'res_stun_monitor.so'});}else if(_0x2765c6[_0x4120('0x24')][_0x4120('0x3d')]()==_0x4120('0x46')){var _0x37a4dd=fs[_0x4120('0x3f')](path['join'](config[_0x4120('0x47')],_0x4120('0x48')),'utf8');var _0x1cded1=ejs[_0x4120('0x42')](_0x37a4dd,{'networks':_0x181d2c||[]});fs[_0x4120('0x43')](_0x4120('0x49'),_0x1cded1);return respondWithRpcPromise(_0x4120('0x45'),_0x4120('0x3a'),{'module':_0x4120('0x4a')});}else{var _0x1d34d9=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config[_0x4120('0x47')],_0x4120('0x4b')),'utf8');var _0x24e202=ejs[_0x4120('0x42')](_0x1d34d9,{'networks':_0x181d2c||[]});fs[_0x4120('0x43')](util['format'](_0x4120('0x4c'),_0xff9492[_0x4120('0x3b')][_0x4120('0x24')][_0x4120('0x4d')]()),_0x24e202);return respondWithRpcPromise('Reload',_0x4120('0x3a'),{'module':'chan_sip.so'});}})[_0x4120('0xa')](function(){return _0x2765c6;})['then'](respondWithResult(_0x439942,0xc9))[_0x4120('0x11')](handleError(_0x439942,null));};exports[_0x4120('0x1a')]=function(_0x139892,_0x5dbbc5){var _0x333b49;return db[_0x4120('0x21')][_0x4120('0x4e')]({'where':{'id':_0x139892['params']['id']}})['then'](handleEntityNotFound(_0x5dbbc5,null))[_0x4120('0xa')](saveUpdates(_0x139892['body'],null))[_0x4120('0xa')](function(_0x287a72){if(_0x287a72){_0x333b49=_0x287a72;return db['Network']['findAll']({'where':{'type':_0x333b49[_0x4120('0x24')]},'raw':!![]});}return null;})[_0x4120('0xa')](function(_0x33aa3d){if(_0x333b49[_0x4120('0x24')][_0x4120('0x3d')]()==_0x4120('0x3e')){var _0x431468=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config[_0x4120('0x47')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x197a3d=ejs['render'](_0x431468,{'networks':_0x33aa3d||[]});fs[_0x4120('0x43')](_0x4120('0x44'),_0x197a3d);return respondWithRpcPromise(_0x4120('0x45'),_0x4120('0x1a'),{'module':_0x4120('0x4a')});}else if(_0x333b49[_0x4120('0x24')][_0x4120('0x3d')]()==_0x4120('0x46')){var _0x2823e9=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config[_0x4120('0x47')],_0x4120('0x48')),_0x4120('0x4f'));var _0xd7d417=ejs[_0x4120('0x42')](_0x2823e9,{'networks':_0x33aa3d||[]});fs[_0x4120('0x43')](_0x4120('0x49'),_0xd7d417);return respondWithRpcPromise(_0x4120('0x45'),'update',{'module':_0x4120('0x4a')});}else{var _0x5584e0=fs['readFileSync'](path[_0x4120('0x40')](config[_0x4120('0x47')],'server/files/templates/network.ejs'),'utf8');var _0x514d22=ejs[_0x4120('0x42')](_0x5584e0,{'networks':_0x33aa3d||[]});fs[_0x4120('0x43')](util[_0x4120('0x50')](_0x4120('0x4c'),_0x139892[_0x4120('0x3b')]['type'][_0x4120('0x4d')]()),_0x514d22);return respondWithRpcPromise('Reload',_0x4120('0x1a'),{'module':_0x4120('0x51')});}})[_0x4120('0xa')](function(_0x1b251b){if(_0x1b251b){return _0x333b49;}return null;})[_0x4120('0xa')](respondWithResult(_0x5dbbc5,null))[_0x4120('0x11')](handleError(_0x5dbbc5,null));};exports[_0x4120('0x1b')]=function(_0x2136f2,_0x2c5f0d){var _0x3f1d2b;return db[_0x4120('0x21')][_0x4120('0x4e')]({'where':{'id':_0x2136f2[_0x4120('0x38')]['id']}})['then'](function(_0x1053ad){_0x3f1d2b=_0x1053ad;return _0x1053ad;})[_0x4120('0xa')](handleEntityNotFound(_0x2c5f0d,null))['then'](removeEntity(_0x2c5f0d,null))[_0x4120('0xa')](function(){if(_0x3f1d2b){return db[_0x4120('0x21')][_0x4120('0x3c')]({'where':{'type':_0x3f1d2b[_0x4120('0x24')]},'raw':!![]});}})['then'](function(_0xc43d04){if(_0x3f1d2b[_0x4120('0x24')]['toUpperCase']()==_0x4120('0x3e')){var _0x2980b9=fs['readFileSync'](path[_0x4120('0x40')](config[_0x4120('0x47')],_0x4120('0x41')),'utf8');var _0x272144=ejs['render'](_0x2980b9,{'networks':_0xc43d04||[]});fs[_0x4120('0x43')](_0x4120('0x44'),_0x272144);return respondWithRpcPromise(_0x4120('0x45'),_0x4120('0x1b'),{'module':_0x4120('0x4a')});}else if(_0x3f1d2b['type'][_0x4120('0x3d')]()==_0x4120('0x46')){var _0x9cc577=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config[_0x4120('0x47')],_0x4120('0x48')),_0x4120('0x4f'));var _0x3b2358=ejs[_0x4120('0x42')](_0x9cc577,{'networks':_0xc43d04||[]});fs[_0x4120('0x43')]('/etc/asterisk/turn_xcally.conf',_0x3b2358);return respondWithRpcPromise(_0x4120('0x45'),_0x4120('0x1b'),{'module':_0x4120('0x4a')});}else{var _0x2a04a4=fs[_0x4120('0x3f')](path[_0x4120('0x40')](config[_0x4120('0x47')],'server/files/templates/network.ejs'),_0x4120('0x4f'));var _0x31338b=ejs[_0x4120('0x42')](_0x2a04a4,{'networks':_0xc43d04||[]});fs[_0x4120('0x43')](util[_0x4120('0x50')](_0x4120('0x4c'),_0x3f1d2b[_0x4120('0x24')]['toLowerCase']()),_0x31338b);return respondWithRpcPromise(_0x4120('0x45'),_0x4120('0x1b'),{'module':'chan_sip.so'});}})[_0x4120('0x11')](handleError(_0x2c5f0d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b63eb21..d762c0b 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 _0x7a2c=['path','rimraf','../../config/environment','exports','network','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2ff972,_0x38a7b7){var _0x2ca507=function(_0x5593e8){while(--_0x5593e8){_0x2ff972['push'](_0x2ff972['shift']());}};_0x2ca507(++_0x38a7b7);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x319f86,_0x5784c1){_0x319f86=_0x319f86-0x0;var _0x5df682=_0x7a2c[_0x319f86];return _0x5df682;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var logger=require(_0xc7a2('0x1'))(_0xc7a2('0x2'));var moment=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var rp=require(_0xc7a2('0x5'));var fs=require('fs');var path=require(_0xc7a2('0x6'));var rimraf=require(_0xc7a2('0x7'));var config=require(_0xc7a2('0x8'));var attributes=require('./network.attributes');module[_0xc7a2('0x9')]=function(_0x1ddbae,_0x5f334e){return _0x1ddbae['define']('Network',attributes,{'tableName':_0xc7a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d2=['api','moment','bluebird','request-promise','path','rimraf','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger'];(function(_0x31295c,_0x2f2b82){var _0x2c150e=function(_0x957f1){while(--_0x957f1){_0x31295c['push'](_0x31295c['shift']());}};_0x2c150e(++_0x2f2b82);}(_0x16d2,0x123));var _0x216d=function(_0x2e5baf,_0x4b77a1){_0x2e5baf=_0x2e5baf-0x0;var _0x4c0797=_0x16d2[_0x2e5baf];return _0x4c0797;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var moment=require(_0x216d('0x4'));var BPromise=require(_0x216d('0x5'));var rp=require(_0x216d('0x6'));var fs=require('fs');var path=require(_0x216d('0x7'));var rimraf=require(_0x216d('0x8'));var config=require('../../config/environment');var attributes=require(_0x216d('0x9'));module[_0x216d('0xa')]=function(_0xef687c,_0x205101){return _0xef687c[_0x216d('0xb')](_0x216d('0xc'),attributes,{'tableName':_0x216d('0xd'),'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 e9613cf..181bf77 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(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x46ae0c,_0x12d1f9){_0x46ae0c=_0x46ae0c-0x0;var _0x30086c=_0x7a54[_0x46ae0c];return _0x30086c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x278a5c,_0x1506c7){_0x278a5c=_0x278a5c-0x0;var _0x53cbfc=_0x7a54[_0x278a5c];return _0x53cbfc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 01192ea..48b764f 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 _0xbdea=['connect-timeout','express','fs-extra','../../components/auth/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','create','post','addDisposition','addAnswer','notify','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x42dc1e,_0x42d851){var _0x522504=function(_0xf3c953){while(--_0xf3c953){_0x42dc1e['push'](_0x42dc1e['shift']());}};_0x522504(++_0x42d851);}(_0xbdea,0x15b));var _0xabde=function(_0x49d931,_0x121258){_0x49d931=_0x49d931-0x0;var _0x491a2a=_0xbdea[_0x49d931];return _0x491a2a;};'use strict';var multer=require(_0xabde('0x0'));var util=require(_0xabde('0x1'));var path=require(_0xabde('0x2'));var timeout=require(_0xabde('0x3'));var express=require(_0xabde('0x4'));var router=express['Router']();var fs_extra=require(_0xabde('0x5'));var auth=require(_0xabde('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xabde('0x7'));router[_0xabde('0x8')]('/',auth[_0xabde('0x9')](),controller[_0xabde('0xa')]);router[_0xabde('0x8')](_0xabde('0xb'),auth[_0xabde('0x9')](),controller[_0xabde('0xc')]);router[_0xabde('0x8')](_0xabde('0xd'),auth[_0xabde('0x9')](),controller[_0xabde('0xe')]);router[_0xabde('0x8')](_0xabde('0xf'),auth[_0xabde('0x9')](),controller[_0xabde('0x10')]);router[_0xabde('0x8')](_0xabde('0x11'),auth['isAuthenticated'](),controller[_0xabde('0x12')]);router[_0xabde('0x8')]('/:id/applications',auth[_0xabde('0x9')](),controller[_0xabde('0x13')]);router[_0xabde('0x8')]('/:id/interactions',auth[_0xabde('0x9')](),controller[_0xabde('0x14')]);router[_0xabde('0x8')](_0xabde('0x15'),auth[_0xabde('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xabde('0x16')]);router[_0xabde('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xabde('0x18')]);router[_0xabde('0x17')](_0xabde('0x11'),auth[_0xabde('0x9')](),controller[_0xabde('0x19')]);router[_0xabde('0x17')]('/:id/notify',controller[_0xabde('0x1a')]);router[_0xabde('0x17')]('/:id/applications',auth[_0xabde('0x9')](),controller['addApplications']);router[_0xabde('0x17')](_0xabde('0x15'),auth[_0xabde('0x9')](),controller['addAgents']);router[_0xabde('0x17')]('/:id/send',auth[_0xabde('0x9')](),controller[_0xabde('0x1b')]);router[_0xabde('0x1c')](_0xabde('0xd'),auth[_0xabde('0x9')](),controller[_0xabde('0x1d')]);router['delete'](_0xabde('0xd'),auth[_0xabde('0x9')](),controller['destroy']);router[_0xabde('0x1e')](_0xabde('0xf'),auth[_0xabde('0x9')](),controller[_0xabde('0x1f')]);router[_0xabde('0x1e')](_0xabde('0x11'),auth['isAuthenticated'](),controller[_0xabde('0x20')]);router[_0xabde('0x1e')]('/:id/users',auth[_0xabde('0x9')](),controller[_0xabde('0x21')]);module[_0xabde('0x22')]=router; \ No newline at end of file +var _0x519e=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/send','send','put','/:id','destroy','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x519e,0x1f4));var _0xe519=function(_0xa08ee3,_0x82742b){_0xa08ee3=_0xa08ee3-0x0;var _0x459416=_0x519e[_0xa08ee3];return _0x459416;};'use strict';var multer=require(_0xe519('0x0'));var util=require(_0xe519('0x1'));var path=require(_0xe519('0x2'));var timeout=require(_0xe519('0x3'));var express=require('express');var router=express[_0xe519('0x4')]();var fs_extra=require(_0xe519('0x5'));var auth=require(_0xe519('0x6'));var interaction=require(_0xe519('0x7'));var config=require(_0xe519('0x8'));var controller=require(_0xe519('0x9'));router[_0xe519('0xa')]('/',auth[_0xe519('0xb')](),controller[_0xe519('0xc')]);router[_0xe519('0xa')](_0xe519('0xd'),auth['isAuthenticated'](),controller[_0xe519('0xe')]);router[_0xe519('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe519('0xf')]);router[_0xe519('0xa')](_0xe519('0x10'),auth[_0xe519('0xb')](),controller[_0xe519('0x11')]);router[_0xe519('0xa')](_0xe519('0x12'),auth[_0xe519('0xb')](),controller[_0xe519('0x13')]);router[_0xe519('0xa')](_0xe519('0x14'),auth[_0xe519('0xb')](),controller[_0xe519('0x15')]);router[_0xe519('0xa')](_0xe519('0x16'),auth[_0xe519('0xb')](),controller['getInteractions']);router[_0xe519('0xa')](_0xe519('0x17'),auth[_0xe519('0xb')](),controller[_0xe519('0x18')]);router[_0xe519('0x19')]('/',auth[_0xe519('0xb')](),controller[_0xe519('0x1a')]);router[_0xe519('0x19')](_0xe519('0x10'),auth['isAuthenticated'](),controller[_0xe519('0x1b')]);router[_0xe519('0x19')](_0xe519('0x12'),auth[_0xe519('0xb')](),controller[_0xe519('0x1c')]);router['post']('/:id/notify',controller['notify']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe519('0x1d')]);router[_0xe519('0x19')](_0xe519('0x17'),auth[_0xe519('0xb')](),controller['addAgents']);router[_0xe519('0x19')](_0xe519('0x1e'),auth[_0xe519('0xb')](),controller[_0xe519('0x1f')]);router[_0xe519('0x20')](_0xe519('0x21'),auth[_0xe519('0xb')](),controller['update']);router['delete'](_0xe519('0x21'),auth['isAuthenticated'](),controller[_0xe519('0x22')]);router[_0xe519('0x23')](_0xe519('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xe519('0x23')](_0xe519('0x12'),auth['isAuthenticated'](),controller[_0xe519('0x24')]);router[_0xe519('0x23')](_0xe519('0x17'),auth['isAuthenticated'](),controller[_0xe519('0x25')]);module[_0xe519('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index e15a153..f46d0e0 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 _0x0124=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x20c836,_0x44bfa5){var _0x25f8e1=function(_0x38ec16){while(--_0x38ec16){_0x20c836['push'](_0x20c836['shift']());}};_0x25f8e1(++_0x44bfa5);}(_0x0124,0x1bd));var _0x4012=function(_0x3de447,_0x147ccd){_0x3de447=_0x3de447-0x0;var _0x29870a=_0x0124[_0x3de447];return _0x29870a;};'use strict';var Sequelize=require(_0x4012('0x0'));var rs=require(_0x4012('0x1'));module['exports']={'name':{'type':Sequelize[_0x4012('0x2')],'unique':_0x4012('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x4012('0x2')]},'token':{'type':Sequelize[_0x4012('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4012('0x4')],'defaultValue':function(){return _0x4012('0x5');}},'notificationSound':{'type':Sequelize[_0x4012('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4012('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4012('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4012('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x4012('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4012('0x6')],'defaultValue':![],'comment':_0x4012('0x9'),'set':function(_0x1e4fff){if(!_0x1e4fff)this[_0x4012('0xa')]('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x1e4fff);}}}; \ No newline at end of file +var _0x8633=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8633,0x1e8));var _0x3863=function(_0x1d35bf,_0x57a660){_0x1d35bf=_0x1d35bf-0x0;var _0x3721b5=_0x8633[_0x1d35bf];return _0x3721b5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3863('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x3863('0x1')]},'token':{'type':Sequelize[_0x3863('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x3863('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x3863('0x2')],'defaultValue':function(){return _0x3863('0x3');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3863('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x3863('0x1')]},'queueTransfer':{'type':Sequelize[_0x3863('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3863('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3863('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3863('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x3863('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3863('0x7'),'set':function(_0x4b3b89){if(!_0x4b3b89)this[_0x3863('0x8')](_0x3863('0x9'),null);this['setDataValue'](_0x3863('0xa'),_0x4b3b89);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 9289267..dd55993 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 _0xf53f=['limit','count','set','Content-Range','json','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','map','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','describe','addDisposition','OpenchannelAccountId','getDispositions','order','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','priority','asc','ListId','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','close','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','bulkCreate','finally','getApplications','getInteractions','Contact','internal','Tag','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','OpenchannelMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','http','client','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined'];(function(_0x5906a5,_0x48af0a){var _0x1b9a31=function(_0x4b72ac){while(--_0x4b72ac){_0x5906a5['push'](_0x5906a5['shift']());}};_0x1b9a31(++_0x48af0a);}(_0xf53f,0x8d));var _0xff53=function(_0x25d70f,_0x324ce1){_0x25d70f=_0x25d70f-0x0;var _0x331d46=_0xf53f[_0x25d70f];return _0x331d46;};'use strict';var emlformat=require(_0xff53('0x0'));var rimraf=require(_0xff53('0x1'));var zipdir=require(_0xff53('0x2'));var jsonpatch=require(_0xff53('0x3'));var rp=require(_0xff53('0x4'));var moment=require(_0xff53('0x5'));var BPromise=require(_0xff53('0x6'));var Mustache=require(_0xff53('0x7'));var util=require(_0xff53('0x8'));var path=require(_0xff53('0x9'));var sox=require(_0xff53('0xa'));var csv=require(_0xff53('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xff53('0xc'));var squel=require('squel');var crypto=require(_0xff53('0xd'));var jsforce=require(_0xff53('0xe'));var deskjs=require(_0xff53('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xff53('0x10'));var Redis=require('ioredis');var authService=require(_0xff53('0x11'));var qs=require(_0xff53('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff53('0x13'));var logger=require(_0xff53('0x14'))('api');var utils=require(_0xff53('0x15'));var config=require(_0xff53('0x16'));var licenseUtil=require(_0xff53('0x17'));var db=require('../../mysqldb')['db'];config[_0xff53('0x18')]=_[_0xff53('0x19')](config[_0xff53('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xff53('0x1a'))(new Redis(config[_0xff53('0x18')]));require('./openchannelAccount.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xff53('0x1b')]({'port':0x232c});var client9002=jayson[_0xff53('0x1c')][_0xff53('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5561ec,_0x37f680,_0x5d7dbd,_0x49949a){return new BPromise(function(_0x12e90b,_0x23caea){var _0x4eea1b=_0x49949a||client;return _0x4eea1b[_0xff53('0x1d')](_0x5561ec,_0x5d7dbd)[_0xff53('0x1e')](function(_0x319ce5){logger[_0xff53('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,'request\x20sent');logger[_0xff53('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x37f680,_0xff53('0x21'),JSON[_0xff53('0x22')](_0x319ce5));if(_0x319ce5[_0xff53('0x23')]){if(_0x319ce5[_0xff53('0x23')][_0xff53('0x24')]===0x1f4){logger[_0xff53('0x23')](_0xff53('0x25'),_0x37f680,_0x319ce5[_0xff53('0x23')][_0xff53('0x26')]);return _0x23caea(_0x319ce5['error'][_0xff53('0x26')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0x319ce5['error']['message']);return _0x12e90b(_0x319ce5[_0xff53('0x23')][_0xff53('0x26')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0xff53('0x21'));_0x12e90b(_0x319ce5[_0xff53('0x27')][_0xff53('0x26')]);}})[_0xff53('0x28')](function(_0x462a03){logger[_0xff53('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x37f680,_0x462a03);_0x23caea(_0x462a03);});});}function respondWithStatusCode(_0x4240af,_0x49da9f){_0x49da9f=_0x49da9f||0xcc;return function(_0xbf83e0){if(_0xbf83e0){return _0x4240af[_0xff53('0x29')](_0x49da9f);}return _0x4240af[_0xff53('0x2a')](_0x49da9f)[_0xff53('0x2b')]();};}function respondWithResult(_0x1b7a35,_0x37e39a){_0x37e39a=_0x37e39a||0xc8;return function(_0x43b400){if(_0x43b400){return _0x1b7a35[_0xff53('0x2a')](_0x37e39a)['json'](_0x43b400);}};}function respondWithFilteredResult(_0xe9031f,_0x579164){return function(_0x4b202b){if(_0x4b202b){var _0x25c661=typeof _0x579164[_0xff53('0x2c')]===_0xff53('0x2d')&&typeof _0x579164[_0xff53('0x2e')]===_0xff53('0x2d');var _0x4d870b=_0x4b202b[_0xff53('0x2f')];var _0x5b9661=_0x25c661?0x0:_0x579164[_0xff53('0x2c')];var _0x20e60a=_0x25c661?_0x4b202b[_0xff53('0x2f')]:_0x579164['offset']+_0x579164['limit'];var _0x44170f;if(_0x20e60a>=_0x4d870b){_0x20e60a=_0x4d870b;_0x44170f=0xc8;}else{_0x44170f=0xce;}_0xe9031f[_0xff53('0x2a')](_0x44170f);return _0xe9031f[_0xff53('0x30')](_0xff53('0x31'),_0x5b9661+'-'+_0x20e60a+'/'+_0x4d870b)[_0xff53('0x32')](_0x4b202b);}return null;};}function patchUpdates(_0x380275){return function(_0x539b4d){try{jsonpatch[_0xff53('0x33')](_0x539b4d,_0x380275,!![]);}catch(_0x560623){return BPromise[_0xff53('0x34')](_0x560623);}return _0x539b4d['save']();};}function saveUpdates(_0x2a4d2e,_0x3f6e44){return function(_0x2f34e2){if(_0x2f34e2){return _0x2f34e2[_0xff53('0x35')](_0x2a4d2e)['then'](function(_0x41464a){return _0x41464a;});}return null;};}function removeEntity(_0x134997,_0x18cf7f){return function(_0xad08ab){if(_0xad08ab){return _0xad08ab[_0xff53('0x36')]()[_0xff53('0x1e')](function(){var _0x3a68ac=_0xad08ab[_0xff53('0x37')]({'plain':!![]});var _0x1a9701=_0xff53('0x38');return db[_0xff53('0x39')][_0xff53('0x36')]({'where':{'type':_0x1a9701,'resourceId':_0x3a68ac['id']}})['then'](function(){return _0xad08ab;});})[_0xff53('0x1e')](function(){_0x134997[_0xff53('0x2a')](0xcc)[_0xff53('0x2b')]();});}};}function handleEntityNotFound(_0x237756,_0x1b0731){return function(_0x9ad6f0){if(!_0x9ad6f0){_0x237756[_0xff53('0x29')](0x194);}return _0x9ad6f0;};}function handleError(_0x37dfc3,_0x2b74e5){_0x2b74e5=_0x2b74e5||0x1f4;return function(_0x59847d){logger['error'](_0x59847d[_0xff53('0x3a')]);if(_0x59847d[_0xff53('0x3b')]){delete _0x59847d[_0xff53('0x3b')];}_0x37dfc3['status'](_0x2b74e5)['send'](_0x59847d);};}exports[_0xff53('0x3c')]=function(_0x35e9f9,_0x535d29){var _0x39f6d0={'include':[{'model':db[_0xff53('0x3d')],'as':'mandatoryDispositionPause'}]},_0x25e94b={},_0x34607b={'count':0x0,'rows':[]};var _0xc645b7=_['map'](db[_0xff53('0x3e')][_0xff53('0x3f')],function(_0x299cfd){return{'name':_0x299cfd[_0xff53('0x40')],'type':_0x299cfd[_0xff53('0x41')][_0xff53('0x42')]};});_0x25e94b['model']=_[_0xff53('0x43')](_0xc645b7,'name');_0x25e94b['query']=_['keys'](_0x35e9f9['query']);_0x25e94b[_0xff53('0x44')]=_[_0xff53('0x45')](_0x25e94b[_0xff53('0x46')],_0x25e94b[_0xff53('0x47')]);_0x39f6d0[_0xff53('0x48')]=_['intersection'](_0x25e94b[_0xff53('0x46')],qs[_0xff53('0x49')](_0x35e9f9['query']['fields']));_0x39f6d0[_0xff53('0x48')]=_0x39f6d0[_0xff53('0x48')][_0xff53('0x4a')]?_0x39f6d0['attributes']:_0x25e94b[_0xff53('0x46')];if(!_0x35e9f9['query'][_0xff53('0x4b')](_0xff53('0x4c'))){_0x39f6d0['limit']=qs['limit'](_0x35e9f9['query'][_0xff53('0x2e')]);_0x39f6d0[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x35e9f9[_0xff53('0x47')][_0xff53('0x2c')]);}_0x39f6d0['order']=qs[_0xff53('0x4d')](_0x35e9f9[_0xff53('0x47')][_0xff53('0x4d')]);_0x39f6d0[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x35e9f9['query'],_0x25e94b[_0xff53('0x44')]),_0xc645b7);if(_0x35e9f9[_0xff53('0x47')][_0xff53('0x50')]){_0x39f6d0[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x39f6d0[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0xc645b7,function(_0x133ee3){if(_0x133ee3[_0xff53('0x41')]!==_0xff53('0x52')){var _0x2c5fc3={};_0x2c5fc3[_0x133ee3['name']]={'$like':'%'+_0x35e9f9['query'][_0xff53('0x50')]+'%'};return _0x2c5fc3;}})});}_0x39f6d0=_['merge']({},_0x39f6d0,_0x35e9f9[_0xff53('0x53')]);var _0x419eaa={'where':_0x39f6d0[_0xff53('0x4e')]};return db['OpenchannelAccount'][_0xff53('0x2f')](_0x419eaa)['then'](function(_0x2ded5c){_0x34607b[_0xff53('0x2f')]=_0x2ded5c;if(_0x35e9f9[_0xff53('0x47')][_0xff53('0x54')]){_0x39f6d0[_0xff53('0x55')]=[{'all':!![]}];}return db[_0xff53('0x3e')][_0xff53('0x56')](_0x39f6d0);})['then'](function(_0x3a83b5){_0x34607b[_0xff53('0x57')]=_0x3a83b5;return _0x34607b;})['then'](respondWithFilteredResult(_0x535d29,_0x39f6d0))[_0xff53('0x28')](handleError(_0x535d29,null));};exports[_0xff53('0x58')]=function(_0x4254a5,_0x14e2b9){var _0x2daa89={'raw':![],'where':{'id':_0x4254a5[_0xff53('0x59')]['id']},'include':[{'model':db[_0xff53('0x3d')],'as':_0xff53('0x5a')}]},_0x19ea66={};_0x19ea66['model']=_[_0xff53('0x5b')](db[_0xff53('0x3e')][_0xff53('0x3f')]);_0x19ea66[_0xff53('0x47')]=_[_0xff53('0x5b')](_0x4254a5[_0xff53('0x47')]);_0x19ea66[_0xff53('0x44')]=_[_0xff53('0x45')](_0x19ea66[_0xff53('0x46')],_0x19ea66[_0xff53('0x47')]);_0x2daa89[_0xff53('0x48')]=_[_0xff53('0x45')](_0x19ea66[_0xff53('0x46')],qs[_0xff53('0x49')](_0x4254a5['query'][_0xff53('0x49')]));_0x2daa89[_0xff53('0x48')]=_0x2daa89[_0xff53('0x48')][_0xff53('0x4a')]?_0x2daa89[_0xff53('0x48')]:_0x19ea66[_0xff53('0x46')];if(_0x4254a5[_0xff53('0x47')]['includeAll']){_0x2daa89[_0xff53('0x55')]=[{'all':!![]}];}_0x2daa89=_[_0xff53('0x51')]({},_0x2daa89,_0x4254a5[_0xff53('0x53')]);return db[_0xff53('0x3e')][_0xff53('0x5c')](_0x2daa89)[_0xff53('0x1e')](handleEntityNotFound(_0x14e2b9,null))[_0xff53('0x1e')](respondWithResult(_0x14e2b9,null))[_0xff53('0x28')](handleError(_0x14e2b9,null));};exports['create']=function(_0x524067,_0x4ce20e){return db['OpenchannelAccount']['create'](_0x524067[_0xff53('0x5d')],{})[_0xff53('0x1e')](function(_0x470c84){var _0x21e3f5=_0x524067[_0xff53('0x5e')][_0xff53('0x37')]({'plain':!![]});if(!_0x21e3f5)throw new Error(_0xff53('0x5f'));if(_0x21e3f5[_0xff53('0x60')]==='user'){var _0xc8fc7=_0x470c84['get']({'plain':!![]});var _0x46484b=_0xff53('0x38');return db['UserProfileSection']['find']({'where':{'name':_0x46484b,'userProfileId':_0x21e3f5[_0xff53('0x61')]},'raw':!![]})[_0xff53('0x1e')](function(_0xafa098){if(_0xafa098&&_0xafa098[_0xff53('0x62')]===0x0){return db[_0xff53('0x39')][_0xff53('0x63')]({'name':_0xc8fc7['name'],'resourceId':_0xc8fc7['id'],'type':_0xafa098[_0xff53('0x3b')],'sectionId':_0xafa098['id']},{})[_0xff53('0x1e')](function(){return _0x470c84;});}else{return _0x470c84;}})[_0xff53('0x28')](function(_0x4ed1a7){logger[_0xff53('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ed1a7);throw _0x4ed1a7;});}return _0x470c84;})['then'](respondWithResult(_0x4ce20e,0xc9))[_0xff53('0x28')](handleError(_0x4ce20e,null));};exports[_0xff53('0x35')]=function(_0x881621,_0x3cbd1e){if(_0x881621[_0xff53('0x5d')]['id']){delete _0x881621['body']['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x881621[_0xff53('0x59')]['id']},'include':[{'model':db[_0xff53('0x3d')],'as':_0xff53('0x5a')}]})['then'](handleEntityNotFound(_0x3cbd1e,null))[_0xff53('0x1e')](saveUpdates(_0x881621[_0xff53('0x5d')],null))['then'](respondWithResult(_0x3cbd1e,null))[_0xff53('0x28')](handleError(_0x3cbd1e,null));};exports[_0xff53('0x36')]=function(_0x578f5d,_0x86076b){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x578f5d['params']['id']}})['then'](handleEntityNotFound(_0x86076b,null))[_0xff53('0x1e')](removeEntity(_0x86076b,null))[_0xff53('0x28')](handleError(_0x86076b,null));};exports[_0xff53('0x64')]=function(_0x2ca224,_0x28891d){return db['OpenchannelAccount'][_0xff53('0x64')]()[_0xff53('0x1e')](respondWithResult(_0x28891d,null))[_0xff53('0x28')](handleError(_0x28891d,null));};exports[_0xff53('0x65')]=function(_0x3eaf71,_0x91b7c5,_0x1ae1bb){if(_0x3eaf71[_0xff53('0x5d')]['id']){delete _0x3eaf71['body']['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x3eaf71[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x91b7c5,null))[_0xff53('0x1e')](function(_0x11e298){if(_0x11e298){_0x3eaf71[_0xff53('0x5d')][_0xff53('0x66')]=_0x11e298['id'];return db['Disposition'][_0xff53('0x63')](_0x3eaf71[_0xff53('0x5d')]);}})['then'](respondWithResult(_0x91b7c5,null))[_0xff53('0x28')](handleError(_0x91b7c5,null));};exports[_0xff53('0x67')]=function(_0xb55631,_0xe874a2,_0x16c705){var _0x2e3206={'raw':![],'where':{}};var _0x56af21={};var _0x310ee3={'count':0x0,'rows':[]};return db[_0xff53('0x3e')]['findOne']({'where':{'id':_0xb55631[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0xe874a2,null))[_0xff53('0x1e')](function(_0x4e5891){if(_0x4e5891){_0x56af21[_0xff53('0x46')]=_[_0xff53('0x5b')](db['Disposition'][_0xff53('0x3f')]);_0x56af21[_0xff53('0x47')]=_[_0xff53('0x5b')](_0xb55631[_0xff53('0x47')]);_0x56af21[_0xff53('0x44')]=_[_0xff53('0x45')](_0x56af21[_0xff53('0x46')],_0x56af21['query']);_0x2e3206['attributes']=_[_0xff53('0x45')](_0x56af21[_0xff53('0x46')],qs[_0xff53('0x49')](_0xb55631[_0xff53('0x47')][_0xff53('0x49')]));_0x2e3206[_0xff53('0x48')]=_0x2e3206[_0xff53('0x48')][_0xff53('0x4a')]?_0x2e3206[_0xff53('0x48')]:_0x56af21[_0xff53('0x46')];if(!_0xb55631[_0xff53('0x47')]['hasOwnProperty'](_0xff53('0x4c'))){_0x2e3206[_0xff53('0x2e')]=qs['limit'](_0xb55631[_0xff53('0x47')][_0xff53('0x2e')]);_0x2e3206['offset']=qs[_0xff53('0x2c')](_0xb55631['query'][_0xff53('0x2c')]);}_0x2e3206[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0xb55631[_0xff53('0x47')][_0xff53('0x4d')]);_0x2e3206['where']=qs[_0xff53('0x44')](_['pick'](_0xb55631[_0xff53('0x47')],_0x56af21[_0xff53('0x44')]));_0x2e3206['where']['OpenchannelAccountId']=_0x4e5891['id'];if(_0xb55631[_0xff53('0x47')][_0xff53('0x50')]){_0x2e3206[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x2e3206[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x2e3206[_0xff53('0x48')],function(_0x13aa77){var _0x57b1f9={};_0x57b1f9[_0x13aa77]={'$like':'%'+_0xb55631[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x57b1f9;})});}_0x2e3206=_['merge']({},_0x2e3206,_0xb55631['options']);return db[_0xff53('0x69')][_0xff53('0x2f')]({'where':_0x2e3206[_0xff53('0x4e')]})['then'](function(_0xffd7c1){_0x310ee3[_0xff53('0x2f')]=_0xffd7c1;if(_0xb55631[_0xff53('0x47')]['includeAll']){_0x2e3206['include']=[{'all':!![]}];}return db[_0xff53('0x69')][_0xff53('0x56')](_0x2e3206);})[_0xff53('0x1e')](function(_0x2f0df2){_0x310ee3[_0xff53('0x57')]=_0x2f0df2;return _0x310ee3;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0xe874a2,_0x2e3206))[_0xff53('0x28')](handleError(_0xe874a2,null));};exports[_0xff53('0x6a')]=function(_0x59b962,_0x2951d8,_0x19522b){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x59b962[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x2951d8,null))[_0xff53('0x1e')](function(_0x35b7eb){if(_0x35b7eb){return _0x35b7eb[_0xff53('0x6a')](_0x59b962[_0xff53('0x47')]['ids']);}})[_0xff53('0x1e')](respondWithStatusCode(_0x2951d8,null))[_0xff53('0x28')](handleError(_0x2951d8,null));};exports[_0xff53('0x6b')]=function(_0x20715d,_0x1e7eb0,_0x1ae09d){if(_0x20715d[_0xff53('0x5d')]['id']){delete _0x20715d[_0xff53('0x5d')]['id'];}return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x20715d[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x1e7eb0,null))[_0xff53('0x1e')](function(_0x5d0773){if(_0x5d0773){_0x20715d[_0xff53('0x5d')][_0xff53('0x66')]=_0x5d0773['id'];return db[_0xff53('0x6c')][_0xff53('0x63')](_0x20715d[_0xff53('0x5d')]);}})[_0xff53('0x1e')](respondWithResult(_0x1e7eb0,null))[_0xff53('0x28')](handleError(_0x1e7eb0,null));};exports[_0xff53('0x6d')]=function(_0x3a138c,_0x4e558c,_0x5cabc2){var _0x559db0={'raw':![],'where':{}};var _0x47a031={};var _0x59f354={'count':0x0,'rows':[]};return db[_0xff53('0x3e')]['findOne']({'where':{'id':_0x3a138c[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x4e558c,null))[_0xff53('0x1e')](function(_0x103d15){if(_0x103d15){_0x47a031[_0xff53('0x46')]=_[_0xff53('0x5b')](db[_0xff53('0x6c')]['rawAttributes']);_0x47a031[_0xff53('0x47')]=_['keys'](_0x3a138c[_0xff53('0x47')]);_0x47a031[_0xff53('0x44')]=_['intersection'](_0x47a031['model'],_0x47a031[_0xff53('0x47')]);_0x559db0['attributes']=_[_0xff53('0x45')](_0x47a031[_0xff53('0x46')],qs[_0xff53('0x49')](_0x3a138c[_0xff53('0x47')]['fields']));_0x559db0['attributes']=_0x559db0[_0xff53('0x48')][_0xff53('0x4a')]?_0x559db0[_0xff53('0x48')]:_0x47a031[_0xff53('0x46')];if(!_0x3a138c[_0xff53('0x47')][_0xff53('0x4b')](_0xff53('0x4c'))){_0x559db0['limit']=qs[_0xff53('0x2e')](_0x3a138c[_0xff53('0x47')][_0xff53('0x2e')]);_0x559db0[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x3a138c[_0xff53('0x47')][_0xff53('0x2c')]);}_0x559db0[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0x3a138c[_0xff53('0x47')][_0xff53('0x4d')]);_0x559db0[_0xff53('0x4e')]=qs[_0xff53('0x44')](_['pick'](_0x3a138c[_0xff53('0x47')],_0x47a031['filters']));_0x559db0[_0xff53('0x4e')][_0xff53('0x66')]=_0x103d15['id'];if(_0x3a138c[_0xff53('0x47')]['filter']){_0x559db0[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x559db0[_0xff53('0x4e')],{'$or':_['map'](_0x559db0[_0xff53('0x48')],function(_0x338326){var _0x28af69={};_0x28af69[_0x338326]={'$like':'%'+_0x3a138c['query'][_0xff53('0x50')]+'%'};return _0x28af69;})});}_0x559db0=_[_0xff53('0x51')]({},_0x559db0,_0x3a138c['options']);return db[_0xff53('0x6c')][_0xff53('0x2f')]({'where':_0x559db0['where']})[_0xff53('0x1e')](function(_0x110da5){_0x59f354[_0xff53('0x2f')]=_0x110da5;if(_0x3a138c[_0xff53('0x47')]['includeAll']){_0x559db0[_0xff53('0x55')]=[{'all':!![]}];}return db['CannedAnswer'][_0xff53('0x56')](_0x559db0);})[_0xff53('0x1e')](function(_0x131986){_0x59f354[_0xff53('0x57')]=_0x131986;return _0x59f354;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0x4e558c,_0x559db0))[_0xff53('0x28')](handleError(_0x4e558c,null));};exports[_0xff53('0x6e')]=function(_0x46078a,_0x58f0bd,_0x56fd70){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x46078a[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x58f0bd,null))[_0xff53('0x1e')](function(_0x691472){if(_0x691472){return _0x691472[_0xff53('0x6e')](_0x46078a[_0xff53('0x47')][_0xff53('0x6f')]);}})[_0xff53('0x1e')](respondWithStatusCode(_0x58f0bd,null))[_0xff53('0x28')](handleError(_0x58f0bd,null));};exports[_0xff53('0x70')]=function(_0x581894,_0x863e3e,_0x518c3b){var _0x126331={'body':_0x581894[_0xff53('0x5d')],'channel':_0xff53('0x71')};var _0x3e92e0=[];var _0x31f9e4=[];var _0x291965={};var _0x4a0d60=![];return db[_0xff53('0x72')][_0xff53('0x64')]()[_0xff53('0x1e')](function(_0x17a99d){if(!_0x17a99d){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))]('no\x20available\x20attributes');}_0x3e92e0=_[_0xff53('0x75')](_[_0xff53('0x5b')](_0x17a99d),[_0xff53('0x76'),'updatedAt']);_0x31f9e4=_[_0xff53('0x75')](_[_0xff53('0x5b')](_0x17a99d),[_0xff53('0x76'),'updatedAt',_0xff53('0x77'),'ListId']);if(_0x581894[_0xff53('0x5d')]['id']){delete _0x581894[_0xff53('0x5d')]['id'];}if(_[_0xff53('0x78')](_0x581894[_0xff53('0x5d')][_0xff53('0x79')])){throw new db['Sequelize']['ValidationError'](_0xff53('0x7a'));}if(_[_0xff53('0x78')](_0x581894['body']['body'])||_0x581894[_0xff53('0x5d')][_0xff53('0x5d')]===''){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xff53('0x78')](_0x581894['body'][_0xff53('0x7b')])){throw new db[(_0xff53('0x73'))]['ValidationError'](_0xff53('0x7c')+_0x31f9e4);}if(!_[_0xff53('0x7d')](_0x31f9e4,_0x581894['body']['mapKey'])){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))](_0xff53('0x7e')+_0x31f9e4);}_0x291965[_0x581894[_0xff53('0x5d')][_0xff53('0x7b')]]=_0x581894[_0xff53('0x5d')][_0xff53('0x79')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x581894[_0xff53('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0xff53('0x7f'),'include':[{'model':db[_0xff53('0x72')],'as':_0xff53('0x80'),'where':_0x291965,'limit':0x1,'order':[[_0xff53('0x81'),_0xff53('0x82')]]}]},{'model':db[_0xff53('0x83')],'as':_0xff53('0x84')}]});})[_0xff53('0x1e')](handleEntityNotFound(_0x863e3e,null))[_0xff53('0x1e')](function(_0x4e3a7f){if(_0x4e3a7f&&_0x4e3a7f[_0xff53('0x7f')]){_0x126331[_0xff53('0x85')]=_0x4e3a7f;_0x126331[_0xff53('0x86')]=_0x4e3a7f['Applications'];_0x126331[_0xff53('0x87')]=_0x4e3a7f[_0xff53('0x7f')];_0x126331['applications']=_['orderBy'](_0x126331['applications'],[_0xff53('0x88')],[_0xff53('0x89')]);if(_0x126331[_0xff53('0x85')][_0xff53('0x84')]){delete _0x126331[_0xff53('0x85')][_0xff53('0x84')];}if(_0x126331[_0xff53('0x85')][_0xff53('0x7f')]&&_0x126331[_0xff53('0x85')][_0xff53('0x7f')][_0xff53('0x80')][_0xff53('0x4a')]){return _0x126331[_0xff53('0x85')]['List']['Contacts'][0x0];}var _0x3a5e67=_[_0xff53('0x19')](_0x581894['body'],{'firstName':_0x581894[_0xff53('0x5d')][_0xff53('0x79')],'ListId':_0x4e3a7f[_0xff53('0x8a')]});_0x3a5e67[_0x581894[_0xff53('0x5d')][_0xff53('0x7b')]]=_0x581894[_0xff53('0x5d')][_0xff53('0x79')];return db[_0xff53('0x72')][_0xff53('0x63')](_0x3a5e67,{'fields':_0x3e92e0,'raw':!![]});}})[_0xff53('0x1e')](handleEntityNotFound(_0x863e3e,null))[_0xff53('0x1e')](function(_0x2e4e0b){_0x126331[_0xff53('0x8b')]=_0x2e4e0b;if(_0x2e4e0b){var _0x125d60={'ContactId':_0x2e4e0b['id'],'OpenchannelAccountId':_0x581894[_0xff53('0x59')]['id'],'from':(_0x2e4e0b[_0xff53('0x8c')]||'')+'\x20'+(_0x2e4e0b[_0xff53('0x8d')]||'')};var _0x4f15e1={'OpenchannelAccountId':_0x581894['params']['id'],'closed':![]};if(_0x581894[_0xff53('0x5d')]['threadId']){_0x4f15e1[_0xff53('0x8e')]=_0x581894[_0xff53('0x5d')][_0xff53('0x8e')];return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':_0x4f15e1})[_0xff53('0x1e')](function(_0x560b4e){if(_0x560b4e){return[_0x560b4e,![]];}_0x125d60['threadId']=_0x581894[_0xff53('0x5d')][_0xff53('0x8e')];_0x125d60['externalUrl']=_0x581894['body'][_0xff53('0x90')];return db[_0xff53('0x8f')][_0xff53('0x63')](_0x125d60)[_0xff53('0x1e')](function(_0x590a43){return[_0x590a43,!![]];});});}else{_0x4f15e1[_0xff53('0x8e')]=null;}_0x4f15e1['ContactId']=_0x2e4e0b['id'];return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':_0x4f15e1})['then'](function(_0x16dc09){if(_0x16dc09){return[_0x16dc09,![]];}return db[_0xff53('0x8f')][_0xff53('0x63')](_0x125d60)[_0xff53('0x1e')](function(_0x17f170){return[_0x17f170,!![]];});});}})[_0xff53('0x91')](function(_0xf7200e,_0x2a9b82){if(_0xf7200e){_0x4a0d60=_0x2a9b82;if(!_0x2a9b82){var _0x25b173={'from':(_0x126331[_0xff53('0x8b')][_0xff53('0x8c')]||'')+'\x20'+(_0x126331['contact'][_0xff53('0x8d')]||'')};if(_0x581894['body'][_0xff53('0x8e')]&&_0x581894[_0xff53('0x5d')][_0xff53('0x92')]&&_0x581894[_0xff53('0x5d')][_0xff53('0x8e')]!=_0x581894[_0xff53('0x5d')]['messageId']){_0x25b173['threadId']=_0x581894['body']['messageId'];}return _0xf7200e['update'](_0x25b173);}else{return _0xf7200e;}}})['then'](function(_0x33d207){_0x126331[_0xff53('0x93')]=_0x33d207[_0xff53('0x37')]({'plain':!![]});_0x126331[_0xff53('0x93')]['created']=_0x4a0d60;if(_0x126331['interaction']['created']){if(_0x126331[_0xff53('0x85')]['autoclose']){_0x126331[_0xff53('0x86')]['push']({'id':0x0,'priority':_0x126331[_0xff53('0x86')][_0xff53('0x4a')]+0x1,'app':_0xff53('0x94'),'appdata':'unmanaged','interval':_0xff53('0x95')});}}return db['OpenchannelMessage'][_0xff53('0x63')]({'body':_0x581894['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x581894[_0xff53('0x59')]['id'],'OpenchannelInteractionId':_0x33d207['id'],'direction':'in','ContactId':_0x126331['contact']['id'],'AttachmentId':_0x581894[_0xff53('0x5d')][_0xff53('0x96')]});})[_0xff53('0x1e')](function(_0x3f4470){_0x126331[_0xff53('0x26')]=_0x3f4470;if(_0x126331['interaction'][_0xff53('0x97')]){return db[_0xff53('0x98')][_0xff53('0x5c')]({'attributes':['id',_0xff53('0x3b')],'where':{'id':_0x126331[_0xff53('0x93')][_0xff53('0x97')]}})[_0xff53('0x1e')](function(_0x3722bf){if(_0x3722bf){_0x126331['applications'][_0xff53('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3722bf[_0xff53('0x3b')]+','+(_0x126331[_0xff53('0x85')][_0xff53('0x9a')]||0xa),'interval':_0xff53('0x95')});_0x126331['forcedOwnership']=![];}return respondWithRpcPromise(_0xff53('0x9b'),_0xff53('0x9c'),_0x126331);});}return respondWithRpcPromise(_0xff53('0x9b'),_0xff53('0x9c'),_0x126331);})[_0xff53('0x1e')](function(_0x264b34){respondWithRpcPromise('EventManager','EventManager',{'event':_0xff53('0x70'),'message':_0x264b34},client9002);return _0x264b34;})[_0xff53('0x1e')](respondWithResult(_0x863e3e,null))[_0xff53('0x28')](handleError(_0x863e3e,null));};exports[_0xff53('0x9d')]=function(_0x2df1fe,_0x42a875){var _0x23c87f=_0x2df1fe[_0xff53('0x59')]['id'];var _0x120a10=_0x2df1fe['body'];var _0x4efdf0=0xc8;var _0x49c933=null;return db[_0xff53('0x9e')][_0xff53('0x9f')]({'isolationLevel':db[_0xff53('0x9e')][_0xff53('0xa0')][_0xff53('0xa1')][_0xff53('0xa2')]},function(_0x3b9eca){return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x23c87f},'transaction':_0x3b9eca})[_0xff53('0x1e')](function(_0x340476){if(_0x340476){return db[_0xff53('0x83')]['destroy']({'where':{'OpenchannelAccountId':_0x23c87f},'transaction':_0x3b9eca})[_0xff53('0x1e')](function(){var _0x418e53=_[_0xff53('0x43')](_0x120a10,function(_0x3331a3){_0x3331a3[_0xff53('0x66')]=_0x23c87f;return _0x3331a3;});return db['OpenchannelApplication'][_0xff53('0xa4')](_0x418e53,{'transaction':_0x3b9eca});});}else{_0x4efdf0=0x194;_0x49c933=[];}});})[_0xff53('0x1e')](function(){if(_0x4efdf0!==0x194){return db[_0xff53('0x83')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x23c87f},'order':_0xff53('0x88')})[_0xff53('0x1e')](function(_0x42939a){_0x49c933=_0x42939a;});}})[_0xff53('0x28')](function(_0x4334a8){_0x4efdf0=0x1f4;logger[_0xff53('0x23')](_0x4334a8[_0xff53('0x3a')]);if(_0x4334a8[_0xff53('0x3b')]){delete _0x4334a8[_0xff53('0x3b')];}_0x49c933=_0x4334a8;})[_0xff53('0xa5')](function(){if(_0x49c933===null){_0x42a875[_0xff53('0x29')](_0x4efdf0);}else{if(_0x4efdf0===0x1f4){_0x42a875['status'](_0x4efdf0)['send'](_0x49c933);}else{_0x42a875[_0xff53('0x2a')](_0x4efdf0)[_0xff53('0x32')](_0x49c933);}}});};exports[_0xff53('0xa6')]=function(_0x1f2562,_0x297c0a,_0x48f8d1){var _0x40bcca={};var _0x223610={};var _0x448baf;var _0x4c52b4;return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x1f2562[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x297c0a,null))[_0xff53('0x1e')](function(_0x44bcb0){if(_0x44bcb0){_0x448baf=_0x44bcb0;_0x223610['model']=_[_0xff53('0x5b')](db[_0xff53('0x83')]['rawAttributes']);_0x223610[_0xff53('0x47')]=_[_0xff53('0x5b')](_0x1f2562[_0xff53('0x47')]);_0x223610[_0xff53('0x44')]=_[_0xff53('0x45')](_0x223610[_0xff53('0x46')],_0x223610[_0xff53('0x47')]);_0x40bcca[_0xff53('0x48')]=_[_0xff53('0x45')](_0x223610[_0xff53('0x46')],qs[_0xff53('0x49')](_0x1f2562['query'][_0xff53('0x49')]));_0x40bcca[_0xff53('0x48')]=_0x40bcca[_0xff53('0x48')]['length']?_0x40bcca[_0xff53('0x48')]:_0x223610['model'];_0x40bcca[_0xff53('0x68')]=qs['sort'](_0x1f2562[_0xff53('0x47')][_0xff53('0x4d')]);_0x40bcca[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x1f2562['query'],_0x223610[_0xff53('0x44')]));if(_0x1f2562[_0xff53('0x47')][_0xff53('0x50')]){_0x40bcca[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x40bcca[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x40bcca[_0xff53('0x48')],function(_0x1c059a){var _0x5b319d={};_0x5b319d[_0x1c059a]={'$like':'%'+_0x1f2562[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x5b319d;})});}_0x40bcca=_[_0xff53('0x51')]({},_0x40bcca,_0x1f2562[_0xff53('0x53')]);return _0x448baf[_0xff53('0xa6')](_0x40bcca);}})[_0xff53('0x1e')](function(_0x54cddc){if(_0x54cddc){_0x4c52b4=_0x54cddc[_0xff53('0x4a')];if(!_0x1f2562['query'][_0xff53('0x4b')](_0xff53('0x4c'))){_0x40bcca['limit']=qs[_0xff53('0x2e')](_0x1f2562[_0xff53('0x47')][_0xff53('0x2e')]);_0x40bcca[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x1f2562[_0xff53('0x47')][_0xff53('0x2c')]);}return _0x448baf[_0xff53('0xa6')](_0x40bcca);}})[_0xff53('0x1e')](function(_0x501da9){if(_0x501da9){return _0x501da9?{'count':_0x4c52b4,'rows':_0x501da9}:null;}})[_0xff53('0x1e')](respondWithResult(_0x297c0a,null))[_0xff53('0x28')](handleError(_0x297c0a,null));};exports[_0xff53('0xa7')]=function(_0xadbb0a,_0x17127a,_0xf2c647){var _0x4dc3cd={'raw':![],'where':{}};var _0x54bc0a={};var _0x5adc47={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xff53('0xa3')]({'where':{'id':_0xadbb0a['params']['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x17127a,null))[_0xff53('0x1e')](function(_0x4aec18){if(_0x4aec18){_0x54bc0a['model']=_['keys'](db[_0xff53('0x8f')]['rawAttributes']);_0x54bc0a[_0xff53('0x47')]=_['keys'](_0xadbb0a[_0xff53('0x47')]);_0x54bc0a[_0xff53('0x44')]=_['intersection'](_0x54bc0a['model'],_0x54bc0a['query']);_0x4dc3cd[_0xff53('0x48')]=_[_0xff53('0x45')](_0x54bc0a['model'],qs['fields'](_0xadbb0a[_0xff53('0x47')][_0xff53('0x49')]));_0x4dc3cd[_0xff53('0x48')]=_0x4dc3cd[_0xff53('0x48')][_0xff53('0x4a')]?_0x4dc3cd[_0xff53('0x48')]:_0x54bc0a[_0xff53('0x46')];if(!_0xadbb0a[_0xff53('0x47')][_0xff53('0x4b')](_0xff53('0x4c'))){_0x4dc3cd[_0xff53('0x2e')]=qs[_0xff53('0x2e')](_0xadbb0a['query'][_0xff53('0x2e')]);_0x4dc3cd['offset']=qs[_0xff53('0x2c')](_0xadbb0a[_0xff53('0x47')][_0xff53('0x2c')]);}_0x4dc3cd[_0xff53('0x68')]=qs['sort'](_0xadbb0a[_0xff53('0x47')][_0xff53('0x4d')]);_0x4dc3cd['where']=qs['filters'](_[_0xff53('0x4f')](_0xadbb0a[_0xff53('0x47')],_0x54bc0a[_0xff53('0x44')]));_0x4dc3cd['where'][_0xff53('0x66')]=_0x4aec18['id'];if(_0xadbb0a[_0xff53('0x47')][_0xff53('0x50')]){_0x4dc3cd['where']=_['merge'](_0x4dc3cd[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x4dc3cd[_0xff53('0x48')],function(_0xf5cd1a){var _0x404841={};_0x404841[_0xf5cd1a]={'$like':'%'+_0xadbb0a['query'][_0xff53('0x50')]+'%'};return _0x404841;})});}_0x4dc3cd=_['merge']({},_0x4dc3cd,_0xadbb0a[_0xff53('0x53')]);return db[_0xff53('0x8f')][_0xff53('0x2f')]({'where':_0x4dc3cd[_0xff53('0x4e')]})[_0xff53('0x1e')](function(_0x2c90b9){_0x5adc47[_0xff53('0x2f')]=_0x2c90b9;if(_0xadbb0a[_0xff53('0x47')][_0xff53('0x54')]){_0x4dc3cd[_0xff53('0x55')]=[{'model':db[_0xff53('0x72')],'as':_0xff53('0xa8'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name','fullname',_0xff53('0xa9')],'required':![]},{'model':db[_0xff53('0xaa')],'as':'Tags','attributes':['id',_0xff53('0x3b'),'color'],'where':_0xadbb0a[_0xff53('0x47')][_0xff53('0xab')]?{'id':_0xadbb0a['query'][_0xff53('0xab')]}:undefined,'required':_0xadbb0a[_0xff53('0x47')][_0xff53('0xab')]?!![]:![]}];}return db[_0xff53('0x8f')]['findAll'](_0x4dc3cd);})[_0xff53('0x1e')](function(_0x294a5c){_0x5adc47[_0xff53('0x57')]=_0x294a5c;return _0x5adc47;});}})[_0xff53('0x1e')](respondWithFilteredResult(_0x17127a,_0x4dc3cd))[_0xff53('0x28')](handleError(_0x17127a,null));};exports[_0xff53('0xac')]=function(_0x19fcc1,_0x493ab3,_0x24c036){return db['OpenchannelAccount']['find']({'where':{'id':_0x19fcc1[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x493ab3,null))['then'](function(_0x36a412){if(_0x36a412){return _0x36a412[_0xff53('0xac')](_0x19fcc1['body'][_0xff53('0x6f')],_[_0xff53('0xad')](_0x19fcc1[_0xff53('0x5d')],[_0xff53('0x6f'),'id'])||{})[_0xff53('0x91')](function(_0x83ac1a){for(var _0x1afb1e=0x0;_0x1afb1e<_0x19fcc1['body'][_0xff53('0x6f')]['length'];_0x1afb1e+=0x1){socket[_0xff53('0xae')](_0xff53('0xaf'),{'UserId':Number(_0x19fcc1['body'][_0xff53('0x6f')][_0x1afb1e]),'OpenchannelAccountId':Number(_0x19fcc1[_0xff53('0x59')]['id'])});}return _0x83ac1a;});}})[_0xff53('0x1e')](respondWithResult(_0x493ab3,null))[_0xff53('0x28')](handleError(_0x493ab3,null));};exports[_0xff53('0xb0')]=function(_0x1fbd5e,_0x1d1223,_0x554f05){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0x1fbd5e[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x1d1223,null))[_0xff53('0x1e')](function(_0x188b75){if(_0x188b75){return _0x188b75[_0xff53('0xb0')](_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')])[_0xff53('0x1e')](function(){if(_[_0xff53('0xb1')](_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')])){for(var _0xb3918=0x0;_0xb3918<_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')][_0xff53('0x4a')];_0xb3918+=0x1){socket[_0xff53('0xae')](_0xff53('0xb2'),{'UserId':Number(_0x1fbd5e[_0xff53('0x47')][_0xff53('0x6f')][_0xb3918]),'OpenchannelAccountId':Number(_0x1fbd5e[_0xff53('0x59')]['id'])});}}else{socket[_0xff53('0xae')](_0xff53('0xb2'),{'UserId':Number(_0x1fbd5e['query'][_0xff53('0x6f')]),'OpenchannelAccountId':Number(_0x1fbd5e[_0xff53('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x1d1223,null))[_0xff53('0x28')](handleError(_0x1d1223,null));};exports[_0xff53('0xb3')]=function(_0x1051a4,_0x24ca00,_0x24511e){var _0x510b11={};var _0x4e1171={};var _0x416caf;var _0x5d8f40;return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x1051a4[_0xff53('0x59')]['id']}})['then'](handleEntityNotFound(_0x24ca00,null))['then'](function(_0x4d6ae7){if(_0x4d6ae7){_0x416caf=_0x4d6ae7;_0x4e1171[_0xff53('0x46')]=_[_0xff53('0x5b')](db[_0xff53('0x98')][_0xff53('0x3f')]);_0x4e1171['query']=_[_0xff53('0x5b')](_0x1051a4['query']);_0x4e1171[_0xff53('0x44')]=_[_0xff53('0x45')](_0x4e1171[_0xff53('0x46')],_0x4e1171[_0xff53('0x47')]);_0x510b11['attributes']=_[_0xff53('0x45')](_0x4e1171[_0xff53('0x46')],qs[_0xff53('0x49')](_0x1051a4['query']['fields']));_0x510b11[_0xff53('0x48')]=_0x510b11[_0xff53('0x48')][_0xff53('0x4a')]?_0x510b11[_0xff53('0x48')]:_0x4e1171[_0xff53('0x46')];_0x510b11[_0xff53('0x68')]=qs[_0xff53('0x4d')](_0x1051a4['query'][_0xff53('0x4d')]);_0x510b11[_0xff53('0x4e')]=qs[_0xff53('0x44')](_[_0xff53('0x4f')](_0x1051a4['query'],_0x4e1171[_0xff53('0x44')]));if(_0x1051a4[_0xff53('0x47')][_0xff53('0x50')]){_0x510b11[_0xff53('0x4e')]=_[_0xff53('0x51')](_0x510b11[_0xff53('0x4e')],{'$or':_[_0xff53('0x43')](_0x510b11[_0xff53('0x48')],function(_0x23a6b9){var _0x3fa29d={};_0x3fa29d[_0x23a6b9]={'$like':'%'+_0x1051a4[_0xff53('0x47')][_0xff53('0x50')]+'%'};return _0x3fa29d;})});}_0x510b11=_[_0xff53('0x51')]({},_0x510b11,_0x1051a4[_0xff53('0x53')]);return _0x416caf[_0xff53('0xb3')](_0x510b11);}})['then'](function(_0x1b6c34){if(_0x1b6c34){_0x5d8f40=_0x1b6c34[_0xff53('0x4a')];if(!_0x1051a4[_0xff53('0x47')]['hasOwnProperty'](_0xff53('0x4c'))){_0x510b11[_0xff53('0x2e')]=qs[_0xff53('0x2e')](_0x1051a4[_0xff53('0x47')][_0xff53('0x2e')]);_0x510b11[_0xff53('0x2c')]=qs[_0xff53('0x2c')](_0x1051a4[_0xff53('0x47')]['offset']);}return _0x416caf[_0xff53('0xb3')](_0x510b11);}})[_0xff53('0x1e')](function(_0xf2ca7c){if(_0xf2ca7c){return _0xf2ca7c?{'count':_0x5d8f40,'rows':_0xf2ca7c}:null;}})[_0xff53('0x1e')](respondWithResult(_0x24ca00,null))[_0xff53('0x28')](handleError(_0x24ca00,null));};exports[_0xff53('0xb4')]=function(_0x2c1aee,_0x3abc19,_0x34ab7a){var _0x2ee3f9,_0x26e7d9,_0x57b3a8;if(_['isNil'](_0x2c1aee[_0xff53('0x5d')][_0xff53('0x5d')])||_0x2c1aee[_0xff53('0x5d')]['body']===''){throw new db[(_0xff53('0x73'))][(_0xff53('0x74'))](_0xff53('0xb5'));}if(_[_0xff53('0x78')](_0x2c1aee[_0xff53('0x5d')]['to'])){}_0x2ee3f9=_0x2c1aee[_0xff53('0x5d')]['to'];return db[_0xff53('0x3e')][_0xff53('0xa3')]({'where':{'id':_0x2c1aee[_0xff53('0x59')]['id']}})[_0xff53('0x1e')](handleEntityNotFound(_0x3abc19,null))[_0xff53('0x1e')](function(_0xe4f204){if(_0xe4f204){return db[_0xff53('0x3e')][_0xff53('0x5c')]({'where':{'id':_0xe4f204['id']},'include':[{'model':db[_0xff53('0xb6')],'as':_0xff53('0x7f'),'include':[{'model':db[_0xff53('0x72')],'as':_0xff53('0x80'),'where':{[_0xe4f204[_0xff53('0x7b')]]:_0x2ee3f9},'limit':0x1,'order':[[_0xff53('0x81'),_0xff53('0x82')]]}]}]})['then'](handleEntityNotFound(_0x3abc19,null))[_0xff53('0x1e')](function(_0x48da57){if(_0x48da57&&_0x48da57[_0xff53('0x7f')]){_0x26e7d9=_0x48da57[_0xff53('0x37')]({'plain':!![]});if(_0x26e7d9[_0xff53('0x7f')]&&_0x26e7d9[_0xff53('0x7f')][_0xff53('0x80')][_0xff53('0x4a')]){return _0x26e7d9[_0xff53('0x7f')]['Contacts'][0x0];}return db[_0xff53('0x72')]['create'](_[_0xff53('0x19')](_0x2c1aee[_0xff53('0x5d')],{'firstName':_0x2ee3f9,[_0x48da57['mapKey']]:_0x2ee3f9,'phone':_0x2ee3f9,'ListId':_0x26e7d9['ListId']}));}})['then'](handleEntityNotFound(_0x3abc19,null))['then'](function(_0x1429bd){if(_0x1429bd){_0x57b3a8=_0x1429bd;return db[_0xff53('0x8f')][_0xff53('0x5c')]({'where':{'ContactId':_0x57b3a8['id'],'closed':![],'OpenchannelAccountId':_0x26e7d9['id']}})[_0xff53('0x1e')](function(_0x272a35){if(_0x272a35){return[_0x272a35,![]];}return db[_0xff53('0x8f')]['create']({'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id'],'OpenchannelAccountId':_0x26e7d9['id'],'lastMsgDirection':_0xff53('0xb7'),'firstMsgDirection':_0xff53('0xb7'),'Messages':[_['merge'](_0x2c1aee[_0xff53('0x5d')],{'read':![],'body':_0x2c1aee['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x26e7d9['id'],'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id']})]},{'include':[{'model':db[_0xff53('0xb8')],'as':_0xff53('0xb9')}]})['then'](function(_0x36975f){return[_0x36975f,!![]];});});}})[_0xff53('0x91')](function(_0x45e87a,_0x18f933){if(_0x18f933){return _0x45e87a;}return db['OpenchannelMessage'][_0xff53('0x63')](_['merge'](_0x2c1aee['body'],{'read':![],'body':_0x2c1aee['body'][_0xff53('0x5d')],'OpenchannelAccountId':_0x26e7d9['id'],'OpenchannelInteractionId':_0x45e87a['id'],'UserId':_0x2c1aee[_0xff53('0x5e')]['id'],'ContactId':_0x57b3a8['id']}))[_0xff53('0x1e')](function(_0x5d1518){_0x45e87a['dataValues'][_0xff53('0xb9')]=[];_0x45e87a[_0xff53('0xba')][_0xff53('0xb9')]['push'](_0x5d1518[_0xff53('0xba')]);return _0x45e87a;});});}})[_0xff53('0x1e')](respondWithResult(_0x3abc19,null))[_0xff53('0x28')](handleError(_0x3abc19,null));}; \ No newline at end of file +var _0xde5d=['startRouting','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','send','json','getApplications','Owner','fullname','internal','Tag','tag','addAgents','spread','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./openchannelAccount.socket','register','http','client','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','apply','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','params','keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','findOne','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','difference','createdAt','CompanyId','ListId','isNil','from','Sequelize','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','Contacts','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','lastName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start'];(function(_0x592ba0,_0x43be5e){var _0x3a0d59=function(_0x56a270){while(--_0x56a270){_0x592ba0['push'](_0x592ba0['shift']());}};_0x3a0d59(++_0x43be5e);}(_0xde5d,0xd7));var _0xdde5=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xde5d[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xdde5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdde5('0x1'));var jsonpatch=require(_0xdde5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xdde5('0x3'));var Mustache=require(_0xdde5('0x4'));var util=require(_0xdde5('0x5'));var path=require('path');var sox=require(_0xdde5('0x6'));var csv=require(_0xdde5('0x7'));var ejs=require(_0xdde5('0x8'));var fs=require('fs');var fs_extra=require(_0xdde5('0x9'));var _=require('lodash');var squel=require(_0xdde5('0xa'));var crypto=require('crypto');var jsforce=require(_0xdde5('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdde5('0x7'));var querystring=require(_0xdde5('0xc'));var Papa=require('papaparse');var Redis=require(_0xdde5('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdde5('0xe'));var as=require(_0xdde5('0xf'));var hardwareService=require(_0xdde5('0x10'));var logger=require('../../config/logger')(_0xdde5('0x11'));var utils=require(_0xdde5('0x12'));var config=require(_0xdde5('0x13'));var licenseUtil=require(_0xdde5('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xdde5('0x15')](config[_0xdde5('0x16')],{'host':_0xdde5('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdde5('0x18'))[_0xdde5('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdde5('0x1a')]({'port':0x232c});var client9002=jayson[_0xdde5('0x1b')][_0xdde5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4ad81e,_0x44c50a,_0x515c47,_0x13fe23){return new BPromise(function(_0x29fd36,_0x2408ba){var _0x538541=_0x13fe23||client;return _0x538541[_0xdde5('0x1c')](_0x4ad81e,_0x515c47)['then'](function(_0x3d0f10){logger['info'](_0xdde5('0x1d'),_0x44c50a,_0xdde5('0x1e'));logger[_0xdde5('0x1f')](_0xdde5('0x20'),_0x44c50a,'request\x20sent',JSON[_0xdde5('0x21')](_0x3d0f10));if(_0x3d0f10[_0xdde5('0x22')]){if(_0x3d0f10['error'][_0xdde5('0x23')]===0x1f4){logger[_0xdde5('0x22')](_0xdde5('0x1d'),_0x44c50a,_0x3d0f10[_0xdde5('0x22')][_0xdde5('0x24')]);return _0x2408ba(_0x3d0f10[_0xdde5('0x22')][_0xdde5('0x24')]);}logger[_0xdde5('0x22')](_0xdde5('0x1d'),_0x44c50a,_0x3d0f10[_0xdde5('0x22')][_0xdde5('0x24')]);return _0x29fd36(_0x3d0f10[_0xdde5('0x22')][_0xdde5('0x24')]);}else{logger[_0xdde5('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x44c50a,_0xdde5('0x1e'));_0x29fd36(_0x3d0f10[_0xdde5('0x26')][_0xdde5('0x24')]);}})[_0xdde5('0x27')](function(_0x221307){logger[_0xdde5('0x22')](_0xdde5('0x1d'),_0x44c50a,_0x221307);_0x2408ba(_0x221307);});});}function respondWithStatusCode(_0x4ad857,_0x15fcf3){_0x15fcf3=_0x15fcf3||0xcc;return function(_0x13ca5b){if(_0x13ca5b){return _0x4ad857[_0xdde5('0x28')](_0x15fcf3);}return _0x4ad857[_0xdde5('0x29')](_0x15fcf3)[_0xdde5('0x2a')]();};}function respondWithResult(_0x1c88a0,_0x4ec934){_0x4ec934=_0x4ec934||0xc8;return function(_0x4d9eb8){if(_0x4d9eb8){return _0x1c88a0[_0xdde5('0x29')](_0x4ec934)['json'](_0x4d9eb8);}};}function respondWithFilteredResult(_0x59b459,_0x3eb92c){return function(_0x502e8f){if(_0x502e8f){var _0x178657=typeof _0x3eb92c[_0xdde5('0x2b')]===_0xdde5('0x2c')&&typeof _0x3eb92c[_0xdde5('0x2d')]==='undefined';var _0x3c07b5=_0x502e8f[_0xdde5('0x2e')];var _0x14300a=_0x178657?0x0:_0x3eb92c[_0xdde5('0x2b')];var _0x17a257=_0x178657?_0x502e8f[_0xdde5('0x2e')]:_0x3eb92c[_0xdde5('0x2b')]+_0x3eb92c['limit'];var _0x5bb77c;if(_0x17a257>=_0x3c07b5){_0x17a257=_0x3c07b5;_0x5bb77c=0xc8;}else{_0x5bb77c=0xce;}_0x59b459['status'](_0x5bb77c);return _0x59b459[_0xdde5('0x2f')]('Content-Range',_0x14300a+'-'+_0x17a257+'/'+_0x3c07b5)['json'](_0x502e8f);}return null;};}function patchUpdates(_0x38ddec){return function(_0x5cf215){try{jsonpatch[_0xdde5('0x30')](_0x5cf215,_0x38ddec,!![]);}catch(_0xc302d5){return BPromise['reject'](_0xc302d5);}return _0x5cf215[_0xdde5('0x31')]();};}function saveUpdates(_0x41b5b8,_0x3f69bc){return function(_0x4dbab7){if(_0x4dbab7){return _0x4dbab7[_0xdde5('0x32')](_0x41b5b8)[_0xdde5('0x33')](function(_0x5b4d8b){return _0x5b4d8b;});}return null;};}function removeEntity(_0x4f0ee3,_0x187b62){return function(_0x3876bd){if(_0x3876bd){return _0x3876bd[_0xdde5('0x34')]()[_0xdde5('0x33')](function(){var _0x3253f9=_0x3876bd['get']({'plain':!![]});var _0x59e7ed=_0xdde5('0x35');return db[_0xdde5('0x36')][_0xdde5('0x34')]({'where':{'type':_0x59e7ed,'resourceId':_0x3253f9['id']}})['then'](function(){return _0x3876bd;});})[_0xdde5('0x33')](function(){_0x4f0ee3['status'](0xcc)[_0xdde5('0x2a')]();});}};}function handleEntityNotFound(_0x1db4ae,_0x597701){return function(_0x303389){if(!_0x303389){_0x1db4ae[_0xdde5('0x28')](0x194);}return _0x303389;};}function handleError(_0x7b10ac,_0x26b423){_0x26b423=_0x26b423||0x1f4;return function(_0x392181){logger[_0xdde5('0x22')](_0x392181[_0xdde5('0x37')]);if(_0x392181[_0xdde5('0x38')]){delete _0x392181[_0xdde5('0x38')];}_0x7b10ac[_0xdde5('0x29')](_0x26b423)['send'](_0x392181);};}exports[_0xdde5('0x39')]=function(_0x2e9dcf,_0x435ed4){var _0x23e62f={'include':[{'model':db[_0xdde5('0x3a')],'as':_0xdde5('0x3b')}]},_0x66936a={},_0x2ac370={'count':0x0,'rows':[]};var _0x1db539=_['map'](db[_0xdde5('0x3c')][_0xdde5('0x3d')],function(_0x323b21){return{'name':_0x323b21[_0xdde5('0x3e')],'type':_0x323b21[_0xdde5('0x3f')][_0xdde5('0x40')]};});_0x66936a[_0xdde5('0x41')]=_['map'](_0x1db539,_0xdde5('0x38'));_0x66936a['query']=_['keys'](_0x2e9dcf[_0xdde5('0x42')]);_0x66936a[_0xdde5('0x43')]=_[_0xdde5('0x44')](_0x66936a[_0xdde5('0x41')],_0x66936a[_0xdde5('0x42')]);_0x23e62f[_0xdde5('0x45')]=_[_0xdde5('0x44')](_0x66936a['model'],qs[_0xdde5('0x46')](_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x46')]));_0x23e62f[_0xdde5('0x45')]=_0x23e62f[_0xdde5('0x45')][_0xdde5('0x47')]?_0x23e62f[_0xdde5('0x45')]:_0x66936a['model'];if(!_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x48')](_0xdde5('0x49'))){_0x23e62f[_0xdde5('0x2d')]=qs[_0xdde5('0x2d')](_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x2d')]);_0x23e62f[_0xdde5('0x2b')]=qs[_0xdde5('0x2b')](_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x2b')]);}_0x23e62f[_0xdde5('0x4a')]=qs[_0xdde5('0x4b')](_0x2e9dcf['query']['sort']);_0x23e62f[_0xdde5('0x4c')]=qs['filters'](_[_0xdde5('0x4d')](_0x2e9dcf['query'],_0x66936a['filters']),_0x1db539);if(_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x23e62f['where']=_[_0xdde5('0x4f')](_0x23e62f[_0xdde5('0x4c')],{'$or':_[_0xdde5('0x50')](_0x1db539,function(_0x158c67){if(_0x158c67[_0xdde5('0x3f')]!==_0xdde5('0x51')){var _0x5972d8={};_0x5972d8[_0x158c67[_0xdde5('0x38')]]={'$like':'%'+_0x2e9dcf['query'][_0xdde5('0x4e')]+'%'};return _0x5972d8;}})});}_0x23e62f=_['merge']({},_0x23e62f,_0x2e9dcf[_0xdde5('0x52')]);var _0xc76fdb={'where':_0x23e62f[_0xdde5('0x4c')]};return db['OpenchannelAccount']['count'](_0xc76fdb)['then'](function(_0x2cfa91){_0x2ac370[_0xdde5('0x2e')]=_0x2cfa91;if(_0x2e9dcf[_0xdde5('0x42')][_0xdde5('0x53')]){_0x23e62f['include']=[{'all':!![]}];}return db[_0xdde5('0x3c')]['findAll'](_0x23e62f);})[_0xdde5('0x33')](function(_0x565abf){_0x2ac370['rows']=_0x565abf;return _0x2ac370;})[_0xdde5('0x33')](respondWithFilteredResult(_0x435ed4,_0x23e62f))['catch'](handleError(_0x435ed4,null));};exports['show']=function(_0x15e4e9,_0x2cc1d6){var _0x2cb387={'raw':![],'where':{'id':_0x15e4e9[_0xdde5('0x54')]['id']},'include':[{'model':db[_0xdde5('0x3a')],'as':_0xdde5('0x3b')}]},_0x186e6={};_0x186e6[_0xdde5('0x41')]=_[_0xdde5('0x55')](db[_0xdde5('0x3c')][_0xdde5('0x3d')]);_0x186e6['query']=_[_0xdde5('0x55')](_0x15e4e9[_0xdde5('0x42')]);_0x186e6[_0xdde5('0x43')]=_['intersection'](_0x186e6[_0xdde5('0x41')],_0x186e6[_0xdde5('0x42')]);_0x2cb387['attributes']=_[_0xdde5('0x44')](_0x186e6[_0xdde5('0x41')],qs['fields'](_0x15e4e9['query']['fields']));_0x2cb387[_0xdde5('0x45')]=_0x2cb387[_0xdde5('0x45')][_0xdde5('0x47')]?_0x2cb387[_0xdde5('0x45')]:_0x186e6['model'];if(_0x15e4e9[_0xdde5('0x42')][_0xdde5('0x53')]){_0x2cb387[_0xdde5('0x56')]=[{'all':!![]}];}_0x2cb387=_[_0xdde5('0x4f')]({},_0x2cb387,_0x15e4e9[_0xdde5('0x52')]);return db[_0xdde5('0x3c')][_0xdde5('0x57')](_0x2cb387)['then'](handleEntityNotFound(_0x2cc1d6,null))[_0xdde5('0x33')](respondWithResult(_0x2cc1d6,null))[_0xdde5('0x27')](handleError(_0x2cc1d6,null));};exports[_0xdde5('0x58')]=function(_0xe96cb,_0x3a79bc){return db['OpenchannelAccount'][_0xdde5('0x58')](_0xe96cb[_0xdde5('0x59')],{})[_0xdde5('0x33')](function(_0x157838){var _0xb79a99=_0xe96cb['user'][_0xdde5('0x5a')]({'plain':!![]});if(!_0xb79a99)throw new Error(_0xdde5('0x5b'));if(_0xb79a99[_0xdde5('0x5c')]===_0xdde5('0x5d')){var _0x221022=_0x157838['get']({'plain':!![]});var _0x3e4ce8=_0xdde5('0x35');return db[_0xdde5('0x5e')][_0xdde5('0x57')]({'where':{'name':_0x3e4ce8,'userProfileId':_0xb79a99[_0xdde5('0x5f')]},'raw':!![]})[_0xdde5('0x33')](function(_0x1f1c5d){if(_0x1f1c5d&&_0x1f1c5d[_0xdde5('0x60')]===0x0){return db[_0xdde5('0x36')][_0xdde5('0x58')]({'name':_0x221022[_0xdde5('0x38')],'resourceId':_0x221022['id'],'type':_0x1f1c5d['name'],'sectionId':_0x1f1c5d['id']},{})[_0xdde5('0x33')](function(){return _0x157838;});}else{return _0x157838;}})[_0xdde5('0x27')](function(_0x5ef1c2){logger[_0xdde5('0x22')](_0xdde5('0x61'),_0x5ef1c2);throw _0x5ef1c2;});}return _0x157838;})[_0xdde5('0x33')](respondWithResult(_0x3a79bc,0xc9))[_0xdde5('0x27')](handleError(_0x3a79bc,null));};exports[_0xdde5('0x32')]=function(_0x247386,_0x356a9f){if(_0x247386[_0xdde5('0x59')]['id']){delete _0x247386[_0xdde5('0x59')]['id'];}return db[_0xdde5('0x3c')]['find']({'where':{'id':_0x247386[_0xdde5('0x54')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x356a9f,null))['then'](saveUpdates(_0x247386[_0xdde5('0x59')],null))[_0xdde5('0x33')](respondWithResult(_0x356a9f,null))[_0xdde5('0x27')](handleError(_0x356a9f,null));};exports[_0xdde5('0x34')]=function(_0x35805c,_0x4f11a9){return db['OpenchannelAccount']['find']({'where':{'id':_0x35805c[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x4f11a9,null))[_0xdde5('0x33')](removeEntity(_0x4f11a9,null))[_0xdde5('0x27')](handleError(_0x4f11a9,null));};exports[_0xdde5('0x62')]=function(_0x23f6d3,_0x161b02){return db[_0xdde5('0x3c')][_0xdde5('0x62')]()['then'](respondWithResult(_0x161b02,null))[_0xdde5('0x27')](handleError(_0x161b02,null));};exports[_0xdde5('0x63')]=function(_0x208931,_0x3e4305,_0x155de9){if(_0x208931[_0xdde5('0x59')]['id']){delete _0x208931[_0xdde5('0x59')]['id'];}return db[_0xdde5('0x3c')][_0xdde5('0x57')]({'where':{'id':_0x208931[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x3e4305,null))['then'](function(_0x24f919){if(_0x24f919){_0x208931[_0xdde5('0x59')][_0xdde5('0x64')]=_0x24f919['id'];return db['Disposition']['create'](_0x208931[_0xdde5('0x59')]);}})[_0xdde5('0x33')](respondWithResult(_0x3e4305,null))[_0xdde5('0x27')](handleError(_0x3e4305,null));};exports['getDispositions']=function(_0x13ccef,_0x14fdfe,_0x3cdcfb){var _0x4c0833={'raw':![],'where':{}};var _0xb95f1b={};var _0x5988b7={'count':0x0,'rows':[]};return db[_0xdde5('0x3c')][_0xdde5('0x65')]({'where':{'id':_0x13ccef[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x14fdfe,null))[_0xdde5('0x33')](function(_0x8cc3aa){if(_0x8cc3aa){_0xb95f1b[_0xdde5('0x41')]=_[_0xdde5('0x55')](db[_0xdde5('0x66')][_0xdde5('0x3d')]);_0xb95f1b[_0xdde5('0x42')]=_[_0xdde5('0x55')](_0x13ccef[_0xdde5('0x42')]);_0xb95f1b[_0xdde5('0x43')]=_[_0xdde5('0x44')](_0xb95f1b[_0xdde5('0x41')],_0xb95f1b[_0xdde5('0x42')]);_0x4c0833[_0xdde5('0x45')]=_[_0xdde5('0x44')](_0xb95f1b[_0xdde5('0x41')],qs[_0xdde5('0x46')](_0x13ccef[_0xdde5('0x42')][_0xdde5('0x46')]));_0x4c0833[_0xdde5('0x45')]=_0x4c0833[_0xdde5('0x45')][_0xdde5('0x47')]?_0x4c0833[_0xdde5('0x45')]:_0xb95f1b[_0xdde5('0x41')];if(!_0x13ccef[_0xdde5('0x42')][_0xdde5('0x48')](_0xdde5('0x49'))){_0x4c0833[_0xdde5('0x2d')]=qs[_0xdde5('0x2d')](_0x13ccef[_0xdde5('0x42')]['limit']);_0x4c0833[_0xdde5('0x2b')]=qs[_0xdde5('0x2b')](_0x13ccef[_0xdde5('0x42')][_0xdde5('0x2b')]);}_0x4c0833[_0xdde5('0x4a')]=qs['sort'](_0x13ccef[_0xdde5('0x42')][_0xdde5('0x4b')]);_0x4c0833[_0xdde5('0x4c')]=qs[_0xdde5('0x43')](_['pick'](_0x13ccef[_0xdde5('0x42')],_0xb95f1b[_0xdde5('0x43')]));_0x4c0833[_0xdde5('0x4c')][_0xdde5('0x64')]=_0x8cc3aa['id'];if(_0x13ccef[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x4c0833[_0xdde5('0x4c')]=_[_0xdde5('0x4f')](_0x4c0833['where'],{'$or':_[_0xdde5('0x50')](_0x4c0833['attributes'],function(_0xd65d8f){var _0x510a8a={};_0x510a8a[_0xd65d8f]={'$like':'%'+_0x13ccef[_0xdde5('0x42')][_0xdde5('0x4e')]+'%'};return _0x510a8a;})});}_0x4c0833=_['merge']({},_0x4c0833,_0x13ccef[_0xdde5('0x52')]);return db[_0xdde5('0x66')][_0xdde5('0x2e')]({'where':_0x4c0833[_0xdde5('0x4c')]})[_0xdde5('0x33')](function(_0x4a14a4){_0x5988b7[_0xdde5('0x2e')]=_0x4a14a4;if(_0x13ccef[_0xdde5('0x42')][_0xdde5('0x53')]){_0x4c0833[_0xdde5('0x56')]=[{'all':!![]}];}return db['Disposition'][_0xdde5('0x67')](_0x4c0833);})[_0xdde5('0x33')](function(_0x3c1811){_0x5988b7[_0xdde5('0x68')]=_0x3c1811;return _0x5988b7;});}})[_0xdde5('0x33')](respondWithFilteredResult(_0x14fdfe,_0x4c0833))['catch'](handleError(_0x14fdfe,null));};exports[_0xdde5('0x69')]=function(_0x35226b,_0x59bd36,_0x55b220){return db['OpenchannelAccount'][_0xdde5('0x57')]({'where':{'id':_0x35226b[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x59bd36,null))[_0xdde5('0x33')](function(_0x26e097){if(_0x26e097){return _0x26e097['removeDispositions'](_0x35226b[_0xdde5('0x42')][_0xdde5('0x6a')]);}})[_0xdde5('0x33')](respondWithStatusCode(_0x59bd36,null))['catch'](handleError(_0x59bd36,null));};exports[_0xdde5('0x6b')]=function(_0x33772f,_0x454c7f,_0x23e989){if(_0x33772f[_0xdde5('0x59')]['id']){delete _0x33772f[_0xdde5('0x59')]['id'];}return db[_0xdde5('0x3c')][_0xdde5('0x57')]({'where':{'id':_0x33772f['params']['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x454c7f,null))[_0xdde5('0x33')](function(_0x2f36cb){if(_0x2f36cb){_0x33772f['body'][_0xdde5('0x64')]=_0x2f36cb['id'];return db[_0xdde5('0x6c')][_0xdde5('0x58')](_0x33772f[_0xdde5('0x59')]);}})[_0xdde5('0x33')](respondWithResult(_0x454c7f,null))[_0xdde5('0x27')](handleError(_0x454c7f,null));};exports['getAnswers']=function(_0x25ac53,_0x76e74c,_0x29474d){var _0x3b4ca5={'raw':![],'where':{}};var _0x53f200={};var _0x5ce6e4={'count':0x0,'rows':[]};return db[_0xdde5('0x3c')][_0xdde5('0x65')]({'where':{'id':_0x25ac53[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x76e74c,null))['then'](function(_0x8030c5){if(_0x8030c5){_0x53f200[_0xdde5('0x41')]=_[_0xdde5('0x55')](db[_0xdde5('0x6c')]['rawAttributes']);_0x53f200[_0xdde5('0x42')]=_[_0xdde5('0x55')](_0x25ac53[_0xdde5('0x42')]);_0x53f200[_0xdde5('0x43')]=_[_0xdde5('0x44')](_0x53f200[_0xdde5('0x41')],_0x53f200[_0xdde5('0x42')]);_0x3b4ca5[_0xdde5('0x45')]=_['intersection'](_0x53f200[_0xdde5('0x41')],qs['fields'](_0x25ac53[_0xdde5('0x42')][_0xdde5('0x46')]));_0x3b4ca5[_0xdde5('0x45')]=_0x3b4ca5[_0xdde5('0x45')][_0xdde5('0x47')]?_0x3b4ca5[_0xdde5('0x45')]:_0x53f200['model'];if(!_0x25ac53[_0xdde5('0x42')][_0xdde5('0x48')]('nolimit')){_0x3b4ca5['limit']=qs[_0xdde5('0x2d')](_0x25ac53[_0xdde5('0x42')]['limit']);_0x3b4ca5[_0xdde5('0x2b')]=qs[_0xdde5('0x2b')](_0x25ac53['query'][_0xdde5('0x2b')]);}_0x3b4ca5[_0xdde5('0x4a')]=qs[_0xdde5('0x4b')](_0x25ac53[_0xdde5('0x42')][_0xdde5('0x4b')]);_0x3b4ca5['where']=qs['filters'](_['pick'](_0x25ac53[_0xdde5('0x42')],_0x53f200[_0xdde5('0x43')]));_0x3b4ca5[_0xdde5('0x4c')][_0xdde5('0x64')]=_0x8030c5['id'];if(_0x25ac53[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x3b4ca5['where']=_[_0xdde5('0x4f')](_0x3b4ca5[_0xdde5('0x4c')],{'$or':_[_0xdde5('0x50')](_0x3b4ca5[_0xdde5('0x45')],function(_0x2a2e4a){var _0xb23b97={};_0xb23b97[_0x2a2e4a]={'$like':'%'+_0x25ac53[_0xdde5('0x42')][_0xdde5('0x4e')]+'%'};return _0xb23b97;})});}_0x3b4ca5=_[_0xdde5('0x4f')]({},_0x3b4ca5,_0x25ac53[_0xdde5('0x52')]);return db['CannedAnswer'][_0xdde5('0x2e')]({'where':_0x3b4ca5[_0xdde5('0x4c')]})[_0xdde5('0x33')](function(_0x41450b){_0x5ce6e4[_0xdde5('0x2e')]=_0x41450b;if(_0x25ac53[_0xdde5('0x42')][_0xdde5('0x53')]){_0x3b4ca5[_0xdde5('0x56')]=[{'all':!![]}];}return db[_0xdde5('0x6c')][_0xdde5('0x67')](_0x3b4ca5);})[_0xdde5('0x33')](function(_0x1cb302){_0x5ce6e4[_0xdde5('0x68')]=_0x1cb302;return _0x5ce6e4;});}})[_0xdde5('0x33')](respondWithFilteredResult(_0x76e74c,_0x3b4ca5))['catch'](handleError(_0x76e74c,null));};exports[_0xdde5('0x6d')]=function(_0x1719c2,_0x313c8f,_0x3b0ffd){return db[_0xdde5('0x3c')]['find']({'where':{'id':_0x1719c2[_0xdde5('0x54')]['id']}})['then'](handleEntityNotFound(_0x313c8f,null))[_0xdde5('0x33')](function(_0x1482d0){if(_0x1482d0){return _0x1482d0[_0xdde5('0x6d')](_0x1719c2[_0xdde5('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x313c8f,null))[_0xdde5('0x27')](handleError(_0x313c8f,null));};exports[_0xdde5('0x6e')]=function(_0x2308d6,_0x174653,_0x5c439e){var _0x498be7={'body':_0x2308d6[_0xdde5('0x59')],'channel':_0xdde5('0x6f')};var _0x301d28=[];var _0x494b0c=[];var _0x2d55dc={};var _0x251dbd=![];return db[_0xdde5('0x70')]['describe']()[_0xdde5('0x33')](function(_0x1e040a){if(!_0x1e040a){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x301d28=_[_0xdde5('0x71')](_[_0xdde5('0x55')](_0x1e040a),[_0xdde5('0x72'),'updatedAt']);_0x494b0c=_[_0xdde5('0x71')](_[_0xdde5('0x55')](_0x1e040a),[_0xdde5('0x72'),'updatedAt',_0xdde5('0x73'),_0xdde5('0x74')]);if(_0x2308d6['body']['id']){delete _0x2308d6[_0xdde5('0x59')]['id'];}if(_[_0xdde5('0x75')](_0x2308d6[_0xdde5('0x59')][_0xdde5('0x76')])){throw new db[(_0xdde5('0x77'))][(_0xdde5('0x78'))]('from\x20is\x20mandatory');}if(_[_0xdde5('0x75')](_0x2308d6[_0xdde5('0x59')][_0xdde5('0x59')])||_0x2308d6[_0xdde5('0x59')][_0xdde5('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0xdde5('0x79'));}if(_[_0xdde5('0x75')](_0x2308d6[_0xdde5('0x59')][_0xdde5('0x7a')])){throw new db[(_0xdde5('0x77'))]['ValidationError'](_0xdde5('0x7b')+_0x494b0c);}if(!_[_0xdde5('0x7c')](_0x494b0c,_0x2308d6[_0xdde5('0x59')]['mapKey'])){throw new db['Sequelize'][(_0xdde5('0x78'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x494b0c);}_0x2d55dc[_0x2308d6[_0xdde5('0x59')]['mapKey']]=_0x2308d6[_0xdde5('0x59')]['from'];})[_0xdde5('0x33')](function(){return db['OpenchannelAccount'][_0xdde5('0x57')]({'where':{'id':_0x2308d6['params']['id']},'include':[{'model':db[_0xdde5('0x7d')],'as':_0xdde5('0x7e'),'include':[{'model':db[_0xdde5('0x70')],'as':_0xdde5('0x7f'),'where':_0x2d55dc,'limit':0x1,'order':[[_0xdde5('0x80'),_0xdde5('0x81')]]}]},{'model':db[_0xdde5('0x82')],'as':_0xdde5('0x83')}]});})[_0xdde5('0x33')](handleEntityNotFound(_0x174653,null))[_0xdde5('0x33')](function(_0x612874){if(_0x612874&&_0x612874['List']){_0x498be7[_0xdde5('0x84')]=_0x612874;_0x498be7[_0xdde5('0x85')]=_0x612874[_0xdde5('0x83')];_0x498be7[_0xdde5('0x86')]=_0x612874['List'];_0x498be7[_0xdde5('0x85')]=_[_0xdde5('0x87')](_0x498be7[_0xdde5('0x85')],[_0xdde5('0x88')],[_0xdde5('0x89')]);if(_0x498be7[_0xdde5('0x84')]['Applications']){delete _0x498be7[_0xdde5('0x84')][_0xdde5('0x83')];}if(_0x498be7[_0xdde5('0x84')][_0xdde5('0x7e')]&&_0x498be7[_0xdde5('0x84')][_0xdde5('0x7e')]['Contacts'][_0xdde5('0x47')]){return _0x498be7[_0xdde5('0x84')][_0xdde5('0x7e')][_0xdde5('0x7f')][0x0];}var _0x24ad04=_['defaults'](_0x2308d6['body'],{'firstName':_0x2308d6[_0xdde5('0x59')]['from'],'ListId':_0x612874[_0xdde5('0x74')]});_0x24ad04[_0x2308d6[_0xdde5('0x59')]['mapKey']]=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x76')];return db[_0xdde5('0x70')][_0xdde5('0x58')](_0x24ad04,{'fields':_0x301d28,'raw':!![]});}})[_0xdde5('0x33')](handleEntityNotFound(_0x174653,null))[_0xdde5('0x33')](function(_0x254338){_0x498be7[_0xdde5('0x8a')]=_0x254338;if(_0x254338){var _0x288191={'ContactId':_0x254338['id'],'OpenchannelAccountId':_0x2308d6[_0xdde5('0x54')]['id'],'from':(_0x254338[_0xdde5('0x8b')]||'')+'\x20'+(_0x254338['lastName']||'')};var _0x5ced35={'OpenchannelAccountId':_0x2308d6[_0xdde5('0x54')]['id'],'closed':![]};if(_0x2308d6['body'][_0xdde5('0x8c')]){_0x5ced35['threadId']=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x8c')];return db[_0xdde5('0x8d')][_0xdde5('0x57')]({'where':_0x5ced35})[_0xdde5('0x33')](function(_0x3c6225){if(_0x3c6225){return[_0x3c6225,![]];}_0x288191[_0xdde5('0x8c')]=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x8c')];_0x288191[_0xdde5('0x8e')]=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x8e')];return db['OpenchannelInteraction'][_0xdde5('0x58')](_0x288191)[_0xdde5('0x33')](function(_0x292abb){return[_0x292abb,!![]];});});}else{_0x5ced35[_0xdde5('0x8c')]=null;}_0x5ced35[_0xdde5('0x8f')]=_0x254338['id'];return db[_0xdde5('0x8d')][_0xdde5('0x57')]({'where':_0x5ced35})[_0xdde5('0x33')](function(_0x323799){if(_0x323799){return[_0x323799,![]];}return db[_0xdde5('0x8d')][_0xdde5('0x58')](_0x288191)[_0xdde5('0x33')](function(_0xfcf89a){return[_0xfcf89a,!![]];});});}})['spread'](function(_0x51ce39,_0x19e25b){if(_0x51ce39){_0x251dbd=_0x19e25b;if(!_0x19e25b){var _0x4135d9={'from':(_0x498be7[_0xdde5('0x8a')][_0xdde5('0x8b')]||'')+'\x20'+(_0x498be7['contact'][_0xdde5('0x90')]||'')};if(_0x2308d6[_0xdde5('0x59')]['threadId']&&_0x2308d6[_0xdde5('0x59')][_0xdde5('0x91')]&&_0x2308d6[_0xdde5('0x59')]['threadId']!=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x91')]){_0x4135d9[_0xdde5('0x8c')]=_0x2308d6[_0xdde5('0x59')][_0xdde5('0x91')];}return _0x51ce39[_0xdde5('0x32')](_0x4135d9);}else{return _0x51ce39;}}})[_0xdde5('0x33')](function(_0x37e5c9){_0x498be7[_0xdde5('0x92')]=_0x37e5c9[_0xdde5('0x5a')]({'plain':!![]});_0x498be7[_0xdde5('0x92')][_0xdde5('0x93')]=_0x251dbd;if(_0x498be7[_0xdde5('0x92')][_0xdde5('0x93')]){if(_0x498be7[_0xdde5('0x84')]['autoclose']){_0x498be7[_0xdde5('0x85')][_0xdde5('0x94')]({'id':0x0,'priority':_0x498be7[_0xdde5('0x85')][_0xdde5('0x47')]+0x1,'app':'close','appdata':_0xdde5('0x95'),'interval':_0xdde5('0x96')});}}return db[_0xdde5('0x97')]['create']({'body':_0x2308d6[_0xdde5('0x59')]['body'],'OpenchannelAccountId':_0x2308d6['params']['id'],'OpenchannelInteractionId':_0x37e5c9['id'],'direction':'in','ContactId':_0x498be7['contact']['id'],'AttachmentId':_0x2308d6[_0xdde5('0x59')][_0xdde5('0x98')]});})[_0xdde5('0x33')](function(_0x261616){_0x498be7[_0xdde5('0x24')]=_0x261616;if(_0x498be7[_0xdde5('0x92')][_0xdde5('0x99')]){return db[_0xdde5('0x9a')][_0xdde5('0x57')]({'attributes':['id','name'],'where':{'id':_0x498be7['interaction']['UserId']}})[_0xdde5('0x33')](function(_0xa6bd26){if(_0xa6bd26){_0x498be7[_0xdde5('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':_0xdde5('0x9b'),'appdata':_0xa6bd26[_0xdde5('0x38')]+','+(_0x498be7['account'][_0xdde5('0x9c')]||0xa),'interval':_0xdde5('0x96')});_0x498be7[_0xdde5('0x9d')]=![];}return respondWithRpcPromise(_0xdde5('0x9e'),_0xdde5('0x9f'),_0x498be7);});}return respondWithRpcPromise(_0xdde5('0x9e'),_0xdde5('0x9f'),_0x498be7);})[_0xdde5('0x33')](function(_0x34f1e0){respondWithRpcPromise('EventManager',_0xdde5('0xa0'),{'event':'notify','message':_0x34f1e0},client9002);return _0x34f1e0;})[_0xdde5('0x33')](respondWithResult(_0x174653,null))['catch'](handleError(_0x174653,null));};exports[_0xdde5('0xa1')]=function(_0x36d672,_0x24f7b3){var _0x1138c8=_0x36d672['params']['id'];var _0x42db29=_0x36d672['body'];var _0x5167e0=0xc8;var _0x4a79df=null;return db[_0xdde5('0xa2')]['transaction']({'isolationLevel':db[_0xdde5('0xa2')][_0xdde5('0xa3')][_0xdde5('0xa4')][_0xdde5('0xa5')]},function(_0x117ad7){return db[_0xdde5('0x3c')]['findOne']({'where':{'id':_0x1138c8},'transaction':_0x117ad7})['then'](function(_0x1cb200){if(_0x1cb200){return db[_0xdde5('0x82')][_0xdde5('0x34')]({'where':{'OpenchannelAccountId':_0x1138c8},'transaction':_0x117ad7})['then'](function(){var _0x48994e=_[_0xdde5('0x50')](_0x42db29,function(_0x74a947){_0x74a947['OpenchannelAccountId']=_0x1138c8;return _0x74a947;});return db[_0xdde5('0x82')][_0xdde5('0xa6')](_0x48994e,{'transaction':_0x117ad7});});}else{_0x5167e0=0x194;_0x4a79df=[];}});})[_0xdde5('0x33')](function(){if(_0x5167e0!==0x194){return db[_0xdde5('0x82')][_0xdde5('0xa7')]({'where':{'OpenchannelAccountId':_0x1138c8},'order':'priority'})[_0xdde5('0x33')](function(_0x26d513){_0x4a79df=_0x26d513;});}})[_0xdde5('0x27')](function(_0x2c924d){_0x5167e0=0x1f4;logger[_0xdde5('0x22')](_0x2c924d['stack']);if(_0x2c924d[_0xdde5('0x38')]){delete _0x2c924d[_0xdde5('0x38')];}_0x4a79df=_0x2c924d;})[_0xdde5('0xa8')](function(){if(_0x4a79df===null){_0x24f7b3[_0xdde5('0x28')](_0x5167e0);}else{if(_0x5167e0===0x1f4){_0x24f7b3[_0xdde5('0x29')](_0x5167e0)[_0xdde5('0xa9')](_0x4a79df);}else{_0x24f7b3[_0xdde5('0x29')](_0x5167e0)[_0xdde5('0xaa')](_0x4a79df);}}});};exports[_0xdde5('0xab')]=function(_0x133847,_0xd24c7f,_0x266664){var _0x149f9e={};var _0x4f475e={};var _0x47b7ac;var _0x215925;return db[_0xdde5('0x3c')]['findOne']({'where':{'id':_0x133847['params']['id']}})['then'](handleEntityNotFound(_0xd24c7f,null))['then'](function(_0x5d98e1){if(_0x5d98e1){_0x47b7ac=_0x5d98e1;_0x4f475e['model']=_['keys'](db['OpenchannelApplication'][_0xdde5('0x3d')]);_0x4f475e['query']=_['keys'](_0x133847[_0xdde5('0x42')]);_0x4f475e[_0xdde5('0x43')]=_[_0xdde5('0x44')](_0x4f475e[_0xdde5('0x41')],_0x4f475e[_0xdde5('0x42')]);_0x149f9e[_0xdde5('0x45')]=_['intersection'](_0x4f475e[_0xdde5('0x41')],qs['fields'](_0x133847[_0xdde5('0x42')]['fields']));_0x149f9e[_0xdde5('0x45')]=_0x149f9e[_0xdde5('0x45')][_0xdde5('0x47')]?_0x149f9e[_0xdde5('0x45')]:_0x4f475e[_0xdde5('0x41')];_0x149f9e['order']=qs[_0xdde5('0x4b')](_0x133847['query'][_0xdde5('0x4b')]);_0x149f9e[_0xdde5('0x4c')]=qs['filters'](_[_0xdde5('0x4d')](_0x133847[_0xdde5('0x42')],_0x4f475e[_0xdde5('0x43')]));if(_0x133847[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x149f9e[_0xdde5('0x4c')]=_[_0xdde5('0x4f')](_0x149f9e['where'],{'$or':_[_0xdde5('0x50')](_0x149f9e[_0xdde5('0x45')],function(_0x58b198){var _0x59a21e={};_0x59a21e[_0x58b198]={'$like':'%'+_0x133847['query'][_0xdde5('0x4e')]+'%'};return _0x59a21e;})});}_0x149f9e=_[_0xdde5('0x4f')]({},_0x149f9e,_0x133847[_0xdde5('0x52')]);return _0x47b7ac['getApplications'](_0x149f9e);}})[_0xdde5('0x33')](function(_0x872eda){if(_0x872eda){_0x215925=_0x872eda[_0xdde5('0x47')];if(!_0x133847[_0xdde5('0x42')][_0xdde5('0x48')](_0xdde5('0x49'))){_0x149f9e[_0xdde5('0x2d')]=qs['limit'](_0x133847[_0xdde5('0x42')][_0xdde5('0x2d')]);_0x149f9e['offset']=qs['offset'](_0x133847[_0xdde5('0x42')][_0xdde5('0x2b')]);}return _0x47b7ac[_0xdde5('0xab')](_0x149f9e);}})['then'](function(_0x19d46e){if(_0x19d46e){return _0x19d46e?{'count':_0x215925,'rows':_0x19d46e}:null;}})[_0xdde5('0x33')](respondWithResult(_0xd24c7f,null))['catch'](handleError(_0xd24c7f,null));};exports['getInteractions']=function(_0x5c996d,_0xcd7e01,_0x303543){var _0x375591={'raw':![],'where':{}};var _0x2c77cc={};var _0x1d42e0={'count':0x0,'rows':[]};return db[_0xdde5('0x3c')]['findOne']({'where':{'id':_0x5c996d[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0xcd7e01,null))[_0xdde5('0x33')](function(_0x4e7c9e){if(_0x4e7c9e){_0x2c77cc[_0xdde5('0x41')]=_['keys'](db[_0xdde5('0x8d')]['rawAttributes']);_0x2c77cc[_0xdde5('0x42')]=_['keys'](_0x5c996d[_0xdde5('0x42')]);_0x2c77cc['filters']=_['intersection'](_0x2c77cc[_0xdde5('0x41')],_0x2c77cc[_0xdde5('0x42')]);_0x375591[_0xdde5('0x45')]=_[_0xdde5('0x44')](_0x2c77cc[_0xdde5('0x41')],qs[_0xdde5('0x46')](_0x5c996d['query'][_0xdde5('0x46')]));_0x375591[_0xdde5('0x45')]=_0x375591[_0xdde5('0x45')][_0xdde5('0x47')]?_0x375591[_0xdde5('0x45')]:_0x2c77cc[_0xdde5('0x41')];if(!_0x5c996d['query'][_0xdde5('0x48')](_0xdde5('0x49'))){_0x375591['limit']=qs[_0xdde5('0x2d')](_0x5c996d[_0xdde5('0x42')]['limit']);_0x375591[_0xdde5('0x2b')]=qs[_0xdde5('0x2b')](_0x5c996d['query'][_0xdde5('0x2b')]);}_0x375591[_0xdde5('0x4a')]=qs['sort'](_0x5c996d[_0xdde5('0x42')]['sort']);_0x375591['where']=qs[_0xdde5('0x43')](_[_0xdde5('0x4d')](_0x5c996d[_0xdde5('0x42')],_0x2c77cc[_0xdde5('0x43')]));_0x375591['where'][_0xdde5('0x64')]=_0x4e7c9e['id'];if(_0x5c996d[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x375591[_0xdde5('0x4c')]=_[_0xdde5('0x4f')](_0x375591[_0xdde5('0x4c')],{'$or':_[_0xdde5('0x50')](_0x375591[_0xdde5('0x45')],function(_0x235285){var _0x7056d2={};_0x7056d2[_0x235285]={'$like':'%'+_0x5c996d[_0xdde5('0x42')][_0xdde5('0x4e')]+'%'};return _0x7056d2;})});}_0x375591=_[_0xdde5('0x4f')]({},_0x375591,_0x5c996d[_0xdde5('0x52')]);return db[_0xdde5('0x8d')][_0xdde5('0x2e')]({'where':_0x375591[_0xdde5('0x4c')]})['then'](function(_0x169bb8){_0x1d42e0[_0xdde5('0x2e')]=_0x169bb8;if(_0x5c996d[_0xdde5('0x42')][_0xdde5('0x53')]){_0x375591[_0xdde5('0x56')]=[{'model':db[_0xdde5('0x70')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xdde5('0xac'),'attributes':[_0xdde5('0x38'),_0xdde5('0xad'),_0xdde5('0xae')],'required':![]},{'model':db[_0xdde5('0xaf')],'as':'Tags','attributes':['id',_0xdde5('0x38'),'color'],'where':_0x5c996d[_0xdde5('0x42')][_0xdde5('0xb0')]?{'id':_0x5c996d[_0xdde5('0x42')]['tag']}:undefined,'required':_0x5c996d[_0xdde5('0x42')][_0xdde5('0xb0')]?!![]:![]}];}return db[_0xdde5('0x8d')][_0xdde5('0x67')](_0x375591);})['then'](function(_0x117388){_0x1d42e0[_0xdde5('0x68')]=_0x117388;return _0x1d42e0;});}})['then'](respondWithFilteredResult(_0xcd7e01,_0x375591))[_0xdde5('0x27')](handleError(_0xcd7e01,null));};exports[_0xdde5('0xb1')]=function(_0xa5722b,_0x2ab0ba,_0xf58079){return db[_0xdde5('0x3c')]['find']({'where':{'id':_0xa5722b[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x2ab0ba,null))[_0xdde5('0x33')](function(_0x315860){if(_0x315860){return _0x315860[_0xdde5('0xb1')](_0xa5722b['body'][_0xdde5('0x6a')],_['omit'](_0xa5722b['body'],['ids','id'])||{})[_0xdde5('0xb2')](function(_0x45b99f){for(var _0x1cf653=0x0;_0x1cf653<_0xa5722b[_0xdde5('0x59')][_0xdde5('0x6a')][_0xdde5('0x47')];_0x1cf653+=0x1){socket['emit'](_0xdde5('0xb3'),{'UserId':Number(_0xa5722b[_0xdde5('0x59')][_0xdde5('0x6a')][_0x1cf653]),'OpenchannelAccountId':Number(_0xa5722b[_0xdde5('0x54')]['id'])});}return _0x45b99f;});}})[_0xdde5('0x33')](respondWithResult(_0x2ab0ba,null))[_0xdde5('0x27')](handleError(_0x2ab0ba,null));};exports[_0xdde5('0xb4')]=function(_0x2c397b,_0x497478,_0x332910){return db[_0xdde5('0x3c')][_0xdde5('0x57')]({'where':{'id':_0x2c397b[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x497478,null))[_0xdde5('0x33')](function(_0x177c87){if(_0x177c87){return _0x177c87[_0xdde5('0xb4')](_0x2c397b[_0xdde5('0x42')][_0xdde5('0x6a')])['then'](function(){if(_['isArray'](_0x2c397b['query'][_0xdde5('0x6a')])){for(var _0x1aff6b=0x0;_0x1aff6b<_0x2c397b[_0xdde5('0x42')][_0xdde5('0x6a')][_0xdde5('0x47')];_0x1aff6b+=0x1){socket[_0xdde5('0xb5')](_0xdde5('0xb6'),{'UserId':Number(_0x2c397b[_0xdde5('0x42')]['ids'][_0x1aff6b]),'OpenchannelAccountId':Number(_0x2c397b['params']['id'])});}}else{socket[_0xdde5('0xb5')](_0xdde5('0xb6'),{'UserId':Number(_0x2c397b[_0xdde5('0x42')]['ids']),'OpenchannelAccountId':Number(_0x2c397b[_0xdde5('0x54')]['id'])});}});}})[_0xdde5('0x33')](respondWithStatusCode(_0x497478,null))['catch'](handleError(_0x497478,null));};exports['getAgents']=function(_0x4c0500,_0x32672c,_0x27a437){var _0x5f3bf9={};var _0x55cdf9={};var _0x104c32;var _0x5d4685;return db[_0xdde5('0x3c')]['findOne']({'where':{'id':_0x4c0500[_0xdde5('0x54')]['id']}})[_0xdde5('0x33')](handleEntityNotFound(_0x32672c,null))[_0xdde5('0x33')](function(_0x4ae326){if(_0x4ae326){_0x104c32=_0x4ae326;_0x55cdf9[_0xdde5('0x41')]=_['keys'](db[_0xdde5('0x9a')][_0xdde5('0x3d')]);_0x55cdf9['query']=_['keys'](_0x4c0500[_0xdde5('0x42')]);_0x55cdf9['filters']=_[_0xdde5('0x44')](_0x55cdf9[_0xdde5('0x41')],_0x55cdf9['query']);_0x5f3bf9[_0xdde5('0x45')]=_[_0xdde5('0x44')](_0x55cdf9['model'],qs[_0xdde5('0x46')](_0x4c0500[_0xdde5('0x42')][_0xdde5('0x46')]));_0x5f3bf9[_0xdde5('0x45')]=_0x5f3bf9[_0xdde5('0x45')][_0xdde5('0x47')]?_0x5f3bf9[_0xdde5('0x45')]:_0x55cdf9[_0xdde5('0x41')];_0x5f3bf9[_0xdde5('0x4a')]=qs[_0xdde5('0x4b')](_0x4c0500[_0xdde5('0x42')]['sort']);_0x5f3bf9['where']=qs[_0xdde5('0x43')](_['pick'](_0x4c0500['query'],_0x55cdf9[_0xdde5('0x43')]));if(_0x4c0500[_0xdde5('0x42')][_0xdde5('0x4e')]){_0x5f3bf9[_0xdde5('0x4c')]=_[_0xdde5('0x4f')](_0x5f3bf9[_0xdde5('0x4c')],{'$or':_['map'](_0x5f3bf9[_0xdde5('0x45')],function(_0x3803d3){var _0x5c17ce={};_0x5c17ce[_0x3803d3]={'$like':'%'+_0x4c0500[_0xdde5('0x42')][_0xdde5('0x4e')]+'%'};return _0x5c17ce;})});}_0x5f3bf9=_[_0xdde5('0x4f')]({},_0x5f3bf9,_0x4c0500[_0xdde5('0x52')]);return _0x104c32[_0xdde5('0xb7')](_0x5f3bf9);}})[_0xdde5('0x33')](function(_0xfb0e12){if(_0xfb0e12){_0x5d4685=_0xfb0e12[_0xdde5('0x47')];if(!_0x4c0500[_0xdde5('0x42')][_0xdde5('0x48')](_0xdde5('0x49'))){_0x5f3bf9[_0xdde5('0x2d')]=qs[_0xdde5('0x2d')](_0x4c0500[_0xdde5('0x42')]['limit']);_0x5f3bf9['offset']=qs[_0xdde5('0x2b')](_0x4c0500[_0xdde5('0x42')][_0xdde5('0x2b')]);}return _0x104c32[_0xdde5('0xb7')](_0x5f3bf9);}})[_0xdde5('0x33')](function(_0x3e3674){if(_0x3e3674){return _0x3e3674?{'count':_0x5d4685,'rows':_0x3e3674}:null;}})['then'](respondWithResult(_0x32672c,null))[_0xdde5('0x27')](handleError(_0x32672c,null));};exports['send']=function(_0x5aa1d8,_0x450ee6,_0x22eebc){var _0x18539d,_0x8e385d,_0x47cd45;if(_[_0xdde5('0x75')](_0x5aa1d8[_0xdde5('0x59')][_0xdde5('0x59')])||_0x5aa1d8['body'][_0xdde5('0x59')]===''){throw new db[(_0xdde5('0x77'))][(_0xdde5('0x78'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xdde5('0x75')](_0x5aa1d8[_0xdde5('0x59')]['to'])){}_0x18539d=_0x5aa1d8['body']['to'];return db['OpenchannelAccount'][_0xdde5('0x65')]({'where':{'id':_0x5aa1d8[_0xdde5('0x54')]['id']}})['then'](handleEntityNotFound(_0x450ee6,null))[_0xdde5('0x33')](function(_0x429d41){if(_0x429d41){return db[_0xdde5('0x3c')][_0xdde5('0x57')]({'where':{'id':_0x429d41['id']},'include':[{'model':db[_0xdde5('0x7d')],'as':_0xdde5('0x7e'),'include':[{'model':db[_0xdde5('0x70')],'as':_0xdde5('0x7f'),'where':{[_0x429d41['mapKey']]:_0x18539d},'limit':0x1,'order':[['updatedAt',_0xdde5('0x81')]]}]}]})[_0xdde5('0x33')](handleEntityNotFound(_0x450ee6,null))[_0xdde5('0x33')](function(_0x5dbb1b){if(_0x5dbb1b&&_0x5dbb1b['List']){_0x8e385d=_0x5dbb1b[_0xdde5('0x5a')]({'plain':!![]});if(_0x8e385d['List']&&_0x8e385d['List'][_0xdde5('0x7f')][_0xdde5('0x47')]){return _0x8e385d[_0xdde5('0x7e')][_0xdde5('0x7f')][0x0];}return db[_0xdde5('0x70')][_0xdde5('0x58')](_[_0xdde5('0x15')](_0x5aa1d8[_0xdde5('0x59')],{'firstName':_0x18539d,[_0x5dbb1b['mapKey']]:_0x18539d,'phone':_0x18539d,'ListId':_0x8e385d['ListId']}));}})[_0xdde5('0x33')](handleEntityNotFound(_0x450ee6,null))[_0xdde5('0x33')](function(_0x5b7b28){if(_0x5b7b28){_0x47cd45=_0x5b7b28;return db[_0xdde5('0x8d')]['find']({'where':{'ContactId':_0x47cd45['id'],'closed':![],'OpenchannelAccountId':_0x8e385d['id']}})[_0xdde5('0x33')](function(_0x3f9efb){if(_0x3f9efb){return[_0x3f9efb,![]];}return db[_0xdde5('0x8d')][_0xdde5('0x58')]({'UserId':_0x5aa1d8['user']['id'],'ContactId':_0x47cd45['id'],'OpenchannelAccountId':_0x8e385d['id'],'lastMsgDirection':_0xdde5('0xb8'),'firstMsgDirection':_0xdde5('0xb8'),'Messages':[_[_0xdde5('0x4f')](_0x5aa1d8[_0xdde5('0x59')],{'read':![],'body':_0x5aa1d8[_0xdde5('0x59')][_0xdde5('0x59')],'OpenchannelAccountId':_0x8e385d['id'],'UserId':_0x5aa1d8[_0xdde5('0x5d')]['id'],'ContactId':_0x47cd45['id']})]},{'include':[{'model':db[_0xdde5('0x97')],'as':_0xdde5('0xb9')}]})[_0xdde5('0x33')](function(_0xcb07b4){return[_0xcb07b4,!![]];});});}})[_0xdde5('0xb2')](function(_0x215bf6,_0x52cbc2){if(_0x52cbc2){return _0x215bf6;}return db[_0xdde5('0x97')][_0xdde5('0x58')](_[_0xdde5('0x4f')](_0x5aa1d8['body'],{'read':![],'body':_0x5aa1d8[_0xdde5('0x59')][_0xdde5('0x59')],'OpenchannelAccountId':_0x8e385d['id'],'OpenchannelInteractionId':_0x215bf6['id'],'UserId':_0x5aa1d8[_0xdde5('0x5d')]['id'],'ContactId':_0x47cd45['id']}))[_0xdde5('0x33')](function(_0x3641f2){_0x215bf6[_0xdde5('0xba')][_0xdde5('0xb9')]=[];_0x215bf6[_0xdde5('0xba')][_0xdde5('0xb9')][_0xdde5('0x94')](_0x3641f2[_0xdde5('0xba')]);return _0x215bf6;});});}})[_0xdde5('0x33')](respondWithResult(_0x450ee6,null))[_0xdde5('0x27')](handleError(_0x450ee6,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ad43ed5..7ee5934 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 _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xda3f,0xec));var _0xfda3=function(_0x30579a,_0xa0ba88){_0x30579a=_0x30579a-0x0;var _0x218543=_0xda3f[_0x30579a];return _0x218543;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x0bb5,0x148));var _0x50bb=function(_0x81d93c,_0x22cd3c){_0x81d93c=_0x81d93c-0x0;var _0x4afec0=_0x0bb5[_0x81d93c];return _0x4afec0;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index db95957..d16a767 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(_0x1a1e92,_0x36cffd){var _0x11f385=function(_0x57cb45){while(--_0x57cb45){_0x1a1e92['push'](_0x1a1e92['shift']());}};_0x11f385(++_0x36cffd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x25ee21,_0x5abac8){var _0x36c967=function(_0x19dac0){while(--_0x19dac0){_0x25ee21['push'](_0x25ee21['shift']());}};_0x36c967(++_0x5abac8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 df26b47..67ea1f5 100644 --- a/server/api/openchannelAccount/openchannelAccount.rpc.js +++ b/server/api/openchannelAccount/openchannelAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4058=['request','then','debug','code','error','message','OpenchannelAccount,\x20%s,\x20%s','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket'];(function(_0x5d971b,_0x385f6b){var _0x705338=function(_0x2171b5){while(--_0x2171b5){_0x5d971b['push'](_0x5d971b['shift']());}};_0x705338(++_0x385f6b);}(_0x4058,0x129));var _0x8405=function(_0x4b993d,_0x12c3cb){_0x4b993d=_0x4b993d-0x0;var _0x211966=_0x4058[_0x4b993d];return _0x211966;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});config[_0x8405('0xb')]=_[_0x8405('0xc')](config[_0x8405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8405('0xd'))(new Redis(config[_0x8405('0xb')]));require(_0x8405('0xe'))['register'](socket);function respondWithRpcPromise(_0x30705f,_0x5e132b,_0x6979fd){return new BPromise(function(_0xb442,_0x50344e){return client[_0x8405('0xf')](_0x30705f,_0x6979fd)[_0x8405('0x10')](function(_0x5b94d5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,'request\x20sent');logger[_0x8405('0x11')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5e132b,'request\x20sent',JSON['stringify'](_0x5b94d5));if(_0x5b94d5['error']){if(_0x5b94d5['error'][_0x8405('0x12')]===0x1f4){logger[_0x8405('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0x50344e(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}logger['error'](_0x8405('0x15'),_0x5e132b,_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);return _0xb442(_0x5b94d5[_0x8405('0x13')][_0x8405('0x14')]);}else{logger[_0x8405('0x16')](_0x8405('0x15'),_0x5e132b,_0x8405('0x17'));_0xb442(_0x5b94d5[_0x8405('0x18')][_0x8405('0x14')]);}})[_0x8405('0x19')](function(_0x21376d){logger[_0x8405('0x13')](_0x8405('0x15'),_0x5e132b,_0x21376d);_0x50344e(_0x21376d);});});} \ No newline at end of file +var _0xd547=['request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','redis','socket.io-emitter','register'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xd547,0x1c1));var _0x7d54=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xd547[_0x1f71d8];return _0x10b045;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7d54('0x0'));var BPromise=require(_0x7d54('0x1'));var rs=require(_0x7d54('0x2'));var fs=require('fs');var Redis=require(_0x7d54('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7d54('0x4'))('rpc');var config=require(_0x7d54('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x7d54('0x6')][_0x7d54('0x7')]({'port':0x232a});config[_0x7d54('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d54('0x9'))(new Redis(config[_0x7d54('0x8')]));require('./openchannelAccount.socket')[_0x7d54('0xa')](socket);function respondWithRpcPromise(_0x48b250,_0x2bede6,_0x4d9dc3){return new BPromise(function(_0x1d7ff7,_0x570460){return client[_0x7d54('0xb')](_0x48b250,_0x4d9dc3)[_0x7d54('0xc')](function(_0x5bd01a){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2bede6,_0x7d54('0xd'));logger[_0x7d54('0xe')](_0x7d54('0xf'),_0x2bede6,'request\x20sent',JSON[_0x7d54('0x10')](_0x5bd01a));if(_0x5bd01a['error']){if(_0x5bd01a[_0x7d54('0x11')]['code']===0x1f4){logger[_0x7d54('0x11')](_0x7d54('0x12'),_0x2bede6,_0x5bd01a['error'][_0x7d54('0x13')]);return _0x570460(_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);}logger['error'](_0x7d54('0x12'),_0x2bede6,_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);return _0x1d7ff7(_0x5bd01a[_0x7d54('0x11')][_0x7d54('0x13')]);}else{logger[_0x7d54('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x2bede6,_0x7d54('0xd'));_0x1d7ff7(_0x5bd01a[_0x7d54('0x15')]['message']);}})[_0x7d54('0x16')](function(_0x4b9caf){logger['error'](_0x7d54('0x12'),_0x2bede6,_0x4b9caf);_0x570460(_0x4b9caf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0246f27..697ce09 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 _0x130d=['remove','emit','removeListener','register','length','./openchannelAccount.events'];(function(_0x31ba0e,_0xa5d5c9){var _0xc37b80=function(_0x3d37f3){while(--_0x3d37f3){_0x31ba0e['push'](_0x31ba0e['shift']());}};_0xc37b80(++_0xa5d5c9);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0xd130('0x0'));var events=['save',_0xd130('0x1'),'update'];function createListener(_0x45f869,_0x389725){return function(_0x3591d2){_0x389725[_0xd130('0x2')](_0x45f869,_0x3591d2);};}function removeListener(_0x321e49,_0x2bc19d){return function(){OpenchannelAccountEvents[_0xd130('0x3')](_0x321e49,_0x2bc19d);};}exports[_0xd130('0x4')]=function(_0x287e61){for(var _0x4689a8=0x0,_0x44c215=events[_0xd130('0x5')];_0x4689a8<_0x44c215;_0x4689a8++){var _0x3f77e1=events[_0x4689a8];var _0x1b9875=createListener('openchannelAccount:'+_0x3f77e1,_0x287e61);OpenchannelAccountEvents['on'](_0x3f77e1,_0x1b9875);}}; \ No newline at end of file +var _0xc577=['./openchannelAccount.events','update','emit','register','length'];(function(_0x46b96c,_0x313c9a){var _0x199bd2=function(_0x25c435){while(--_0x25c435){_0x46b96c['push'](_0x46b96c['shift']());}};_0x199bd2(++_0x313c9a);}(_0xc577,0x172));var _0x7c57=function(_0x2b3cad,_0x573629){_0x2b3cad=_0x2b3cad-0x0;var _0x2175c4=_0xc577[_0x2b3cad];return _0x2175c4;};'use strict';var OpenchannelAccountEvents=require(_0x7c57('0x0'));var events=['save','remove',_0x7c57('0x1')];function createListener(_0x35af09,_0xe9a500){return function(_0x2a2415){_0xe9a500[_0x7c57('0x2')](_0x35af09,_0x2a2415);};}function removeListener(_0x304922,_0x2ea08b){return function(){OpenchannelAccountEvents['removeListener'](_0x304922,_0x2ea08b);};}exports[_0x7c57('0x3')]=function(_0x1339b3){for(var _0xf50a9f=0x0,_0x2bc454=events[_0x7c57('0x4')];_0xf50a9f<_0x2bc454;_0xf50a9f++){var _0x4bb81b=events[_0xf50a9f];var _0x4e5cb2=createListener('openchannelAccount:'+_0x4bb81b,_0x1339b3);OpenchannelAccountEvents['on'](_0x4bb81b,_0x4e5cb2);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f3f025c..bf0362f 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 _0xab74=['/:id','show','post','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x2a0cf5,_0x106165){var _0x2aaf66=function(_0x39620e){while(--_0x39620e){_0x2a0cf5['push'](_0x2a0cf5['shift']());}};_0x2aaf66(++_0x106165);}(_0xab74,0x15d));var _0x4ab7=function(_0x2ee8a8,_0x373bd4){_0x2ee8a8=_0x2ee8a8-0x0;var _0x5c9add=_0xab74[_0x2ee8a8];return _0x5c9add;};'use strict';var multer=require(_0x4ab7('0x0'));var util=require('util');var path=require(_0x4ab7('0x1'));var timeout=require(_0x4ab7('0x2'));var express=require(_0x4ab7('0x3'));var router=express[_0x4ab7('0x4')]();var fs_extra=require(_0x4ab7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4ab7('0x6'));var config=require(_0x4ab7('0x7'));var controller=require(_0x4ab7('0x8'));router[_0x4ab7('0x9')]('/',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xb')]);router['get'](_0x4ab7('0xc'),auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xd')]);router[_0x4ab7('0xe')]('/',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0xf')]);router['put']('/:id',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0x10')]);router[_0x4ab7('0x11')]('/:id',auth[_0x4ab7('0xa')](),controller[_0x4ab7('0x12')]);module['exports']=router; \ No newline at end of file +var _0x60e5=['post','create','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0xed354f,_0x489f2e){var _0x1484bd=function(_0x2d17bc){while(--_0x2d17bc){_0xed354f['push'](_0xed354f['shift']());}};_0x1484bd(++_0x489f2e);}(_0x60e5,0x18d));var _0x560e=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x60e5[_0x33c9f8];return _0x2d7004;};'use strict';var multer=require('multer');var util=require(_0x560e('0x0'));var path=require(_0x560e('0x1'));var timeout=require(_0x560e('0x2'));var express=require('express');var router=express[_0x560e('0x3')]();var fs_extra=require(_0x560e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x560e('0x5'));var config=require(_0x560e('0x6'));var controller=require('./openchannelApplication.controller');router[_0x560e('0x7')]('/',auth[_0x560e('0x8')](),controller['index']);router[_0x560e('0x7')](_0x560e('0x9'),auth['isAuthenticated'](),controller[_0x560e('0xa')]);router[_0x560e('0xb')]('/',auth[_0x560e('0x8')](),controller[_0x560e('0xc')]);router['put'](_0x560e('0x9'),auth['isAuthenticated'](),controller[_0x560e('0xd')]);router[_0x560e('0xe')]('/:id',auth[_0x560e('0x8')](),controller[_0x560e('0xf')]);module[_0x560e('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 710fa3a..22c7555 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 _0x7d0a=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x3099f4,_0x43c358){var _0x6fba4f=function(_0x3ee9dd){while(--_0x3ee9dd){_0x3099f4['push'](_0x3099f4['shift']());}};_0x6fba4f(++_0x43c358);}(_0x7d0a,0x1a3));var _0xa7d0=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x7d0a[_0x5cfa35];return _0xf7dffb;};'use strict';var Sequelize=require(_0xa7d0('0x0'));module[_0xa7d0('0x1')]={'priority':{'type':Sequelize[_0xa7d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa7d0('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa7d0('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa7d0('0x3')],'defaultValue':_0xa7d0('0x5')}}; \ No newline at end of file +var _0xeeec=['sequelize','INTEGER','STRING','noop','TEXT'];(function(_0x337804,_0x591325){var _0x374888=function(_0x46d2ae){while(--_0x46d2ae){_0x337804['push'](_0x337804['shift']());}};_0x374888(++_0x591325);}(_0xeeec,0x172));var _0xceee=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xeeec[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0xceee('0x0'));module['exports']={'priority':{'type':Sequelize[_0xceee('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xceee('0x2')],'allowNull':![],'defaultValue':_0xceee('0x3')},'appdata':{'type':Sequelize[_0xceee('0x4')]()},'description':{'type':Sequelize[_0xceee('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 5a4e901..18e49d7 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 _0x8c68=['VIRTUAL','merge','options','include','findAll','show','fields','includeAll','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','pick','filter','where'];(function(_0x4d319c,_0x446ee7){var _0x5e3419=function(_0x46e059){while(--_0x46e059){_0x4d319c['push'](_0x4d319c['shift']());}};_0x5e3419(++_0x446ee7);}(_0x8c68,0xfa));var _0x88c6=function(_0x506970,_0x1810b5){_0x506970=_0x506970-0x0;var _0x598791=_0x8c68[_0x506970];return _0x598791;};'use strict';var emlformat=require(_0x88c6('0x0'));var rimraf=require(_0x88c6('0x1'));var zipdir=require(_0x88c6('0x2'));var jsonpatch=require(_0x88c6('0x3'));var rp=require(_0x88c6('0x4'));var moment=require(_0x88c6('0x5'));var BPromise=require(_0x88c6('0x6'));var Mustache=require('mustache');var util=require(_0x88c6('0x7'));var path=require(_0x88c6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88c6('0x9'));var fs=require('fs');var fs_extra=require(_0x88c6('0xa'));var _=require(_0x88c6('0xb'));var squel=require(_0x88c6('0xc'));var crypto=require(_0x88c6('0xd'));var jsforce=require(_0x88c6('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x88c6('0xf'));var querystring=require(_0x88c6('0x10'));var Papa=require(_0x88c6('0x11'));var Redis=require(_0x88c6('0x12'));var authService=require(_0x88c6('0x13'));var qs=require(_0x88c6('0x14'));var as=require(_0x88c6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x88c6('0x16'))(_0x88c6('0x17'));var utils=require(_0x88c6('0x18'));var config=require(_0x88c6('0x19'));var licenseUtil=require(_0x88c6('0x1a'));var db=require(_0x88c6('0x1b'))['db'];function respondWithStatusCode(_0x2483df,_0x3e9937){_0x3e9937=_0x3e9937||0xcc;return function(_0xe66943){if(_0xe66943){return _0x2483df[_0x88c6('0x1c')](_0x3e9937);}return _0x2483df['status'](_0x3e9937)['end']();};}function respondWithResult(_0x4b4764,_0x311b2c){_0x311b2c=_0x311b2c||0xc8;return function(_0x496944){if(_0x496944){return _0x4b4764[_0x88c6('0x1d')](_0x311b2c)[_0x88c6('0x1e')](_0x496944);}};}function respondWithFilteredResult(_0x3a8c19,_0x5318fe){return function(_0x5428e1){if(_0x5428e1){var _0x530174=typeof _0x5318fe[_0x88c6('0x1f')]===_0x88c6('0x20')&&typeof _0x5318fe[_0x88c6('0x21')]===_0x88c6('0x20');var _0x2fad97=_0x5428e1['count'];var _0x1c3c8b=_0x530174?0x0:_0x5318fe[_0x88c6('0x1f')];var _0x52e31f=_0x530174?_0x5428e1[_0x88c6('0x22')]:_0x5318fe['offset']+_0x5318fe[_0x88c6('0x21')];var _0x8f3143;if(_0x52e31f>=_0x2fad97){_0x52e31f=_0x2fad97;_0x8f3143=0xc8;}else{_0x8f3143=0xce;}_0x3a8c19[_0x88c6('0x1d')](_0x8f3143);return _0x3a8c19[_0x88c6('0x23')](_0x88c6('0x24'),_0x1c3c8b+'-'+_0x52e31f+'/'+_0x2fad97)[_0x88c6('0x1e')](_0x5428e1);}return null;};}function patchUpdates(_0x5ec092){return function(_0x4570a2){try{jsonpatch[_0x88c6('0x25')](_0x4570a2,_0x5ec092,!![]);}catch(_0xf4fa66){return BPromise[_0x88c6('0x26')](_0xf4fa66);}return _0x4570a2[_0x88c6('0x27')]();};}function saveUpdates(_0x45d977,_0x512e62){return function(_0x41b0cb){if(_0x41b0cb){return _0x41b0cb[_0x88c6('0x28')](_0x45d977)['then'](function(_0x308303){return _0x308303;});}return null;};}function removeEntity(_0xee40df,_0x36939c){return function(_0x110de4){if(_0x110de4){return _0x110de4[_0x88c6('0x29')]()[_0x88c6('0x2a')](function(){_0xee40df[_0x88c6('0x1d')](0xcc)[_0x88c6('0x2b')]();});}};}function handleEntityNotFound(_0x252763,_0x4b5e37){return function(_0x1c592f){if(!_0x1c592f){_0x252763[_0x88c6('0x1c')](0x194);}return _0x1c592f;};}function handleError(_0x268b7e,_0x13f369){_0x13f369=_0x13f369||0x1f4;return function(_0x246b54){logger['error'](_0x246b54[_0x88c6('0x2c')]);if(_0x246b54[_0x88c6('0x2d')]){delete _0x246b54[_0x88c6('0x2d')];}_0x268b7e[_0x88c6('0x1d')](_0x13f369)[_0x88c6('0x2e')](_0x246b54);};}exports[_0x88c6('0x2f')]=function(_0x469a41,_0x5aab1a){var _0x32d53a={},_0x2a6e78={},_0xd41887={'count':0x0,'rows':[]};var _0x4dec43=_[_0x88c6('0x30')](db[_0x88c6('0x31')][_0x88c6('0x32')],function(_0x35e4e0){return{'name':_0x35e4e0[_0x88c6('0x33')],'type':_0x35e4e0[_0x88c6('0x34')]['key']};});_0x2a6e78['model']=_['map'](_0x4dec43,_0x88c6('0x2d'));_0x2a6e78['query']=_[_0x88c6('0x35')](_0x469a41[_0x88c6('0x36')]);_0x2a6e78[_0x88c6('0x37')]=_[_0x88c6('0x38')](_0x2a6e78[_0x88c6('0x39')],_0x2a6e78[_0x88c6('0x36')]);_0x32d53a[_0x88c6('0x3a')]=_[_0x88c6('0x38')](_0x2a6e78[_0x88c6('0x39')],qs['fields'](_0x469a41[_0x88c6('0x36')]['fields']));_0x32d53a['attributes']=_0x32d53a[_0x88c6('0x3a')][_0x88c6('0x3b')]?_0x32d53a[_0x88c6('0x3a')]:_0x2a6e78['model'];if(!_0x469a41['query'][_0x88c6('0x3c')]('nolimit')){_0x32d53a[_0x88c6('0x21')]=qs['limit'](_0x469a41['query'][_0x88c6('0x21')]);_0x32d53a[_0x88c6('0x1f')]=qs[_0x88c6('0x1f')](_0x469a41[_0x88c6('0x36')][_0x88c6('0x1f')]);}_0x32d53a[_0x88c6('0x3d')]=qs[_0x88c6('0x3e')](_0x469a41['query'][_0x88c6('0x3e')]);_0x32d53a['where']=qs[_0x88c6('0x37')](_[_0x88c6('0x3f')](_0x469a41[_0x88c6('0x36')],_0x2a6e78['filters']),_0x4dec43);if(_0x469a41[_0x88c6('0x36')][_0x88c6('0x40')]){_0x32d53a['where']=_['merge'](_0x32d53a[_0x88c6('0x41')],{'$or':_[_0x88c6('0x30')](_0x4dec43,function(_0x318ce5){if(_0x318ce5[_0x88c6('0x34')]!==_0x88c6('0x42')){var _0x204340={};_0x204340[_0x318ce5[_0x88c6('0x2d')]]={'$like':'%'+_0x469a41['query']['filter']+'%'};return _0x204340;}})});}_0x32d53a=_[_0x88c6('0x43')]({},_0x32d53a,_0x469a41[_0x88c6('0x44')]);var _0x59e5bd={'where':_0x32d53a[_0x88c6('0x41')]};return db[_0x88c6('0x31')]['count'](_0x59e5bd)[_0x88c6('0x2a')](function(_0x3c436b){_0xd41887[_0x88c6('0x22')]=_0x3c436b;if(_0x469a41[_0x88c6('0x36')]['includeAll']){_0x32d53a[_0x88c6('0x45')]=[{'all':!![]}];}return db[_0x88c6('0x31')][_0x88c6('0x46')](_0x32d53a);})[_0x88c6('0x2a')](function(_0x3a57bd){_0xd41887['rows']=_0x3a57bd;return _0xd41887;})[_0x88c6('0x2a')](respondWithFilteredResult(_0x5aab1a,_0x32d53a))['catch'](handleError(_0x5aab1a,null));};exports[_0x88c6('0x47')]=function(_0x109b9f,_0x114dcb){var _0x149670={'raw':!![],'where':{'id':_0x109b9f['params']['id']}},_0x5ba434={};_0x5ba434[_0x88c6('0x39')]=_[_0x88c6('0x35')](db[_0x88c6('0x31')][_0x88c6('0x32')]);_0x5ba434[_0x88c6('0x36')]=_[_0x88c6('0x35')](_0x109b9f['query']);_0x5ba434[_0x88c6('0x37')]=_[_0x88c6('0x38')](_0x5ba434[_0x88c6('0x39')],_0x5ba434['query']);_0x149670[_0x88c6('0x3a')]=_[_0x88c6('0x38')](_0x5ba434[_0x88c6('0x39')],qs[_0x88c6('0x48')](_0x109b9f['query']['fields']));_0x149670[_0x88c6('0x3a')]=_0x149670[_0x88c6('0x3a')]['length']?_0x149670[_0x88c6('0x3a')]:_0x5ba434[_0x88c6('0x39')];if(_0x109b9f[_0x88c6('0x36')][_0x88c6('0x49')]){_0x149670[_0x88c6('0x45')]=[{'all':!![]}];}_0x149670=_[_0x88c6('0x43')]({},_0x149670,_0x109b9f[_0x88c6('0x44')]);return db[_0x88c6('0x31')][_0x88c6('0x4a')](_0x149670)['then'](handleEntityNotFound(_0x114dcb,null))[_0x88c6('0x2a')](respondWithResult(_0x114dcb,null))['catch'](handleError(_0x114dcb,null));};exports[_0x88c6('0x4b')]=function(_0x503372,_0x390dc4){return db[_0x88c6('0x31')][_0x88c6('0x4b')](_0x503372[_0x88c6('0x4c')],{})[_0x88c6('0x2a')](respondWithResult(_0x390dc4,0xc9))[_0x88c6('0x4d')](handleError(_0x390dc4,null));};exports[_0x88c6('0x28')]=function(_0x2af00c,_0x1ee5a0){if(_0x2af00c['body']['id']){delete _0x2af00c[_0x88c6('0x4c')]['id'];}return db[_0x88c6('0x31')][_0x88c6('0x4a')]({'where':{'id':_0x2af00c[_0x88c6('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1ee5a0,null))[_0x88c6('0x2a')](saveUpdates(_0x2af00c[_0x88c6('0x4c')],null))[_0x88c6('0x2a')](respondWithResult(_0x1ee5a0,null))[_0x88c6('0x4d')](handleError(_0x1ee5a0,null));};exports[_0x88c6('0x29')]=function(_0x28fa13,_0x527555){return db[_0x88c6('0x31')][_0x88c6('0x4a')]({'where':{'id':_0x28fa13[_0x88c6('0x4e')]['id']}})[_0x88c6('0x2a')](handleEntityNotFound(_0x527555,null))[_0x88c6('0x2a')](removeEntity(_0x527555,null))['catch'](handleError(_0x527555,null));}; \ No newline at end of file +var _0xf9ed=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','OpenchannelApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body'];(function(_0x5b8bda,_0x921328){var _0x255ec8=function(_0x15bc84){while(--_0x15bc84){_0x5b8bda['push'](_0x5b8bda['shift']());}};_0x255ec8(++_0x921328);}(_0xf9ed,0x16e));var _0xdf9e=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xf9ed[_0x346737];return _0x1ade2e;};'use strict';var emlformat=require(_0xdf9e('0x0'));var rimraf=require(_0xdf9e('0x1'));var zipdir=require(_0xdf9e('0x2'));var jsonpatch=require(_0xdf9e('0x3'));var rp=require(_0xdf9e('0x4'));var moment=require(_0xdf9e('0x5'));var BPromise=require(_0xdf9e('0x6'));var Mustache=require('mustache');var util=require(_0xdf9e('0x7'));var path=require(_0xdf9e('0x8'));var sox=require(_0xdf9e('0x9'));var csv=require(_0xdf9e('0xa'));var ejs=require(_0xdf9e('0xb'));var fs=require('fs');var fs_extra=require(_0xdf9e('0xc'));var _=require(_0xdf9e('0xd'));var squel=require('squel');var crypto=require(_0xdf9e('0xe'));var jsforce=require(_0xdf9e('0xf'));var deskjs=require(_0xdf9e('0x10'));var toCsv=require(_0xdf9e('0xa'));var querystring=require(_0xdf9e('0x11'));var Papa=require(_0xdf9e('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdf9e('0x13'));var utils=require('../../config/utils');var config=require(_0xdf9e('0x14'));var licenseUtil=require(_0xdf9e('0x15'));var db=require(_0xdf9e('0x16'))['db'];function respondWithStatusCode(_0x1cf2a8,_0x3a2ae6){_0x3a2ae6=_0x3a2ae6||0xcc;return function(_0x497356){if(_0x497356){return _0x1cf2a8['sendStatus'](_0x3a2ae6);}return _0x1cf2a8[_0xdf9e('0x17')](_0x3a2ae6)[_0xdf9e('0x18')]();};}function respondWithResult(_0x4f7ed5,_0x1c68c3){_0x1c68c3=_0x1c68c3||0xc8;return function(_0x49e28c){if(_0x49e28c){return _0x4f7ed5[_0xdf9e('0x17')](_0x1c68c3)[_0xdf9e('0x19')](_0x49e28c);}};}function respondWithFilteredResult(_0x29eb04,_0x43ec1c){return function(_0x556c23){if(_0x556c23){var _0x5aa419=typeof _0x43ec1c['offset']===_0xdf9e('0x1a')&&typeof _0x43ec1c[_0xdf9e('0x1b')]==='undefined';var _0x21eccc=_0x556c23[_0xdf9e('0x1c')];var _0x2dec53=_0x5aa419?0x0:_0x43ec1c[_0xdf9e('0x1d')];var _0x40b45a=_0x5aa419?_0x556c23['count']:_0x43ec1c[_0xdf9e('0x1d')]+_0x43ec1c[_0xdf9e('0x1b')];var _0x39e625;if(_0x40b45a>=_0x21eccc){_0x40b45a=_0x21eccc;_0x39e625=0xc8;}else{_0x39e625=0xce;}_0x29eb04[_0xdf9e('0x17')](_0x39e625);return _0x29eb04['set']('Content-Range',_0x2dec53+'-'+_0x40b45a+'/'+_0x21eccc)[_0xdf9e('0x19')](_0x556c23);}return null;};}function patchUpdates(_0x40fa99){return function(_0x1bc86a){try{jsonpatch[_0xdf9e('0x1e')](_0x1bc86a,_0x40fa99,!![]);}catch(_0x321860){return BPromise[_0xdf9e('0x1f')](_0x321860);}return _0x1bc86a[_0xdf9e('0x20')]();};}function saveUpdates(_0x23f1a4,_0x2c2ec7){return function(_0x3ab601){if(_0x3ab601){return _0x3ab601[_0xdf9e('0x21')](_0x23f1a4)[_0xdf9e('0x22')](function(_0x28dd37){return _0x28dd37;});}return null;};}function removeEntity(_0x337869,_0x49d568){return function(_0x18b831){if(_0x18b831){return _0x18b831[_0xdf9e('0x23')]()['then'](function(){_0x337869[_0xdf9e('0x17')](0xcc)[_0xdf9e('0x18')]();});}};}function handleEntityNotFound(_0x541721,_0x47d415){return function(_0x50107a){if(!_0x50107a){_0x541721[_0xdf9e('0x24')](0x194);}return _0x50107a;};}function handleError(_0x5a9a14,_0x19021e){_0x19021e=_0x19021e||0x1f4;return function(_0x97ffe3){logger[_0xdf9e('0x25')](_0x97ffe3[_0xdf9e('0x26')]);if(_0x97ffe3[_0xdf9e('0x27')]){delete _0x97ffe3[_0xdf9e('0x27')];}_0x5a9a14[_0xdf9e('0x17')](_0x19021e)[_0xdf9e('0x28')](_0x97ffe3);};}exports['index']=function(_0x2c0717,_0x57ba0){var _0x3f1348={},_0x44df29={},_0x5a68ec={'count':0x0,'rows':[]};var _0x3263b7=_[_0xdf9e('0x29')](db[_0xdf9e('0x2a')]['rawAttributes'],function(_0x5bfb31){return{'name':_0x5bfb31[_0xdf9e('0x2b')],'type':_0x5bfb31[_0xdf9e('0x2c')][_0xdf9e('0x2d')]};});_0x44df29[_0xdf9e('0x2e')]=_[_0xdf9e('0x29')](_0x3263b7,_0xdf9e('0x27'));_0x44df29[_0xdf9e('0x2f')]=_[_0xdf9e('0x30')](_0x2c0717[_0xdf9e('0x2f')]);_0x44df29[_0xdf9e('0x31')]=_['intersection'](_0x44df29[_0xdf9e('0x2e')],_0x44df29[_0xdf9e('0x2f')]);_0x3f1348[_0xdf9e('0x32')]=_[_0xdf9e('0x33')](_0x44df29['model'],qs[_0xdf9e('0x34')](_0x2c0717[_0xdf9e('0x2f')][_0xdf9e('0x34')]));_0x3f1348[_0xdf9e('0x32')]=_0x3f1348[_0xdf9e('0x32')][_0xdf9e('0x35')]?_0x3f1348[_0xdf9e('0x32')]:_0x44df29[_0xdf9e('0x2e')];if(!_0x2c0717['query'][_0xdf9e('0x36')](_0xdf9e('0x37'))){_0x3f1348['limit']=qs[_0xdf9e('0x1b')](_0x2c0717[_0xdf9e('0x2f')][_0xdf9e('0x1b')]);_0x3f1348[_0xdf9e('0x1d')]=qs['offset'](_0x2c0717['query']['offset']);}_0x3f1348['order']=qs[_0xdf9e('0x38')](_0x2c0717[_0xdf9e('0x2f')][_0xdf9e('0x38')]);_0x3f1348[_0xdf9e('0x39')]=qs[_0xdf9e('0x31')](_[_0xdf9e('0x3a')](_0x2c0717[_0xdf9e('0x2f')],_0x44df29[_0xdf9e('0x31')]),_0x3263b7);if(_0x2c0717[_0xdf9e('0x2f')]['filter']){_0x3f1348[_0xdf9e('0x39')]=_[_0xdf9e('0x3b')](_0x3f1348['where'],{'$or':_[_0xdf9e('0x29')](_0x3263b7,function(_0xf9ba45){if(_0xf9ba45['type']!==_0xdf9e('0x3c')){var _0x156d14={};_0x156d14[_0xf9ba45[_0xdf9e('0x27')]]={'$like':'%'+_0x2c0717[_0xdf9e('0x2f')][_0xdf9e('0x3d')]+'%'};return _0x156d14;}})});}_0x3f1348=_[_0xdf9e('0x3b')]({},_0x3f1348,_0x2c0717[_0xdf9e('0x3e')]);var _0x5bb920={'where':_0x3f1348[_0xdf9e('0x39')]};return db[_0xdf9e('0x2a')][_0xdf9e('0x1c')](_0x5bb920)[_0xdf9e('0x22')](function(_0x2caf9e){_0x5a68ec[_0xdf9e('0x1c')]=_0x2caf9e;if(_0x2c0717[_0xdf9e('0x2f')]['includeAll']){_0x3f1348['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xdf9e('0x3f')](_0x3f1348);})['then'](function(_0xc3fe96){_0x5a68ec[_0xdf9e('0x40')]=_0xc3fe96;return _0x5a68ec;})['then'](respondWithFilteredResult(_0x57ba0,_0x3f1348))[_0xdf9e('0x41')](handleError(_0x57ba0,null));};exports[_0xdf9e('0x42')]=function(_0x177e96,_0x1ec958){var _0x58aef2={'raw':!![],'where':{'id':_0x177e96['params']['id']}},_0x34ef1b={};_0x34ef1b[_0xdf9e('0x2e')]=_[_0xdf9e('0x30')](db['OpenchannelApplication'][_0xdf9e('0x43')]);_0x34ef1b[_0xdf9e('0x2f')]=_[_0xdf9e('0x30')](_0x177e96[_0xdf9e('0x2f')]);_0x34ef1b[_0xdf9e('0x31')]=_['intersection'](_0x34ef1b['model'],_0x34ef1b['query']);_0x58aef2['attributes']=_[_0xdf9e('0x33')](_0x34ef1b[_0xdf9e('0x2e')],qs[_0xdf9e('0x34')](_0x177e96[_0xdf9e('0x2f')][_0xdf9e('0x34')]));_0x58aef2['attributes']=_0x58aef2[_0xdf9e('0x32')][_0xdf9e('0x35')]?_0x58aef2['attributes']:_0x34ef1b[_0xdf9e('0x2e')];if(_0x177e96[_0xdf9e('0x2f')][_0xdf9e('0x44')]){_0x58aef2['include']=[{'all':!![]}];}_0x58aef2=_[_0xdf9e('0x3b')]({},_0x58aef2,_0x177e96['options']);return db[_0xdf9e('0x2a')][_0xdf9e('0x45')](_0x58aef2)['then'](handleEntityNotFound(_0x1ec958,null))['then'](respondWithResult(_0x1ec958,null))[_0xdf9e('0x41')](handleError(_0x1ec958,null));};exports[_0xdf9e('0x46')]=function(_0x6d3432,_0x11955d){return db[_0xdf9e('0x2a')][_0xdf9e('0x46')](_0x6d3432[_0xdf9e('0x47')],{})['then'](respondWithResult(_0x11955d,0xc9))[_0xdf9e('0x41')](handleError(_0x11955d,null));};exports['update']=function(_0x4f5852,_0x275955){if(_0x4f5852[_0xdf9e('0x47')]['id']){delete _0x4f5852[_0xdf9e('0x47')]['id'];}return db[_0xdf9e('0x2a')][_0xdf9e('0x45')]({'where':{'id':_0x4f5852[_0xdf9e('0x48')]['id']}})['then'](handleEntityNotFound(_0x275955,null))[_0xdf9e('0x22')](saveUpdates(_0x4f5852[_0xdf9e('0x47')],null))['then'](respondWithResult(_0x275955,null))[_0xdf9e('0x41')](handleError(_0x275955,null));};exports['destroy']=function(_0xefe9db,_0x16977a){return db[_0xdf9e('0x2a')][_0xdf9e('0x45')]({'where':{'id':_0xefe9db['params']['id']}})[_0xdf9e('0x22')](handleEntityNotFound(_0x16977a,null))[_0xdf9e('0x22')](removeEntity(_0x16977a,null))[_0xdf9e('0x41')](handleError(_0x16977a,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7738071..454b245 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 _0x4d21=['moment','bluebird','request-promise','path','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','../../config/logger'];(function(_0x34e7c3,_0x30513f){var _0x879a78=function(_0x2a6e5c){while(--_0x2a6e5c){_0x34e7c3['push'](_0x34e7c3['shift']());}};_0x879a78(++_0x30513f);}(_0x4d21,0x1ae));var _0x14d2=function(_0x556a79,_0x36f191){_0x556a79=_0x556a79-0x0;var _0x27f52b=_0x4d21[_0x556a79];return _0x27f52b;};'use strict';var _=require(_0x14d2('0x0'));var util=require('util');var logger=require(_0x14d2('0x1'))('api');var moment=require(_0x14d2('0x2'));var BPromise=require(_0x14d2('0x3'));var rp=require(_0x14d2('0x4'));var fs=require('fs');var path=require(_0x14d2('0x5'));var rimraf=require('rimraf');var config=require(_0x14d2('0x6'));var attributes=require('./openchannelApplication.attributes');module[_0x14d2('0x7')]=function(_0x14ebb8,_0x893c8){return _0x14ebb8[_0x14d2('0x8')](_0x14d2('0x9'),attributes,{'tableName':_0x14d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14d2('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8736=['util','api','moment','path','rimraf','../../config/environment','./openchannelApplication.attributes','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x8736,0x16a));var _0x6873=function(_0x513c9c,_0x48fd82){_0x513c9c=_0x513c9c-0x0;var _0x219021=_0x8736[_0x513c9c];return _0x219021;};'use strict';var _=require(_0x6873('0x0'));var util=require(_0x6873('0x1'));var logger=require('../../config/logger')(_0x6873('0x2'));var moment=require(_0x6873('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6873('0x4'));var rimraf=require(_0x6873('0x5'));var config=require(_0x6873('0x6'));var attributes=require(_0x6873('0x7'));module['exports']=function(_0x2adc57,_0x44212d){return _0x2adc57['define'](_0x6873('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6873('0x9'),'collate':_0x6873('0xa')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 6391504..2ab4304 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 _0x08c2=['info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0xf3d537,_0x269aa4){var _0x5079fa=function(_0xf714fb){while(--_0xf714fb){_0xf3d537['push'](_0xf3d537['shift']());}};_0x5079fa(++_0x269aa4);}(_0x08c2,0x112));var _0x208c=function(_0x43139e,_0x762629){_0x43139e=_0x43139e-0x0;var _0x2bc838=_0x08c2[_0x43139e];return _0x2bc838;};'use strict';var _=require(_0x208c('0x0'));var util=require(_0x208c('0x1'));var moment=require(_0x208c('0x2'));var BPromise=require(_0x208c('0x3'));var rs=require(_0x208c('0x4'));var fs=require('fs');var Redis=require(_0x208c('0x5'));var db=require(_0x208c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x208c('0x7'))(_0x208c('0x8'));var config=require(_0x208c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x208c('0xa')][_0x208c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ea1b,_0x2abdb4,_0x3e954a){return new BPromise(function(_0x1ec0d1,_0x3a8a9d){return client[_0x208c('0xc')](_0x47ea1b,_0x3e954a)[_0x208c('0xd')](function(_0x2b75c4){logger[_0x208c('0xe')](_0x208c('0xf'),_0x2abdb4,_0x208c('0x10'));logger[_0x208c('0x11')](_0x208c('0x12'),_0x2abdb4,_0x208c('0x10'),JSON[_0x208c('0x13')](_0x2b75c4));if(_0x2b75c4[_0x208c('0x14')]){if(_0x2b75c4[_0x208c('0x14')][_0x208c('0x15')]===0x1f4){logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x2b75c4[_0x208c('0x14')]['message']);return _0x3a8a9d(_0x2b75c4[_0x208c('0x14')]['message']);}logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x2b75c4['error'][_0x208c('0x16')]);return _0x1ec0d1(_0x2b75c4[_0x208c('0x14')][_0x208c('0x16')]);}else{logger[_0x208c('0xe')](_0x208c('0xf'),_0x2abdb4,_0x208c('0x10'));_0x1ec0d1(_0x2b75c4[_0x208c('0x17')][_0x208c('0x16')]);}})[_0x208c('0x18')](function(_0x193b5d){logger[_0x208c('0x14')](_0x208c('0xf'),_0x2abdb4,_0x193b5d);_0x3a8a9d(_0x193b5d);});});}exports[_0x208c('0x19')]=function(_0x54c15a){var _0xaa257=this;return new Promise(function(_0x532367,_0x340433){return db[_0x208c('0x1a')]['update'](_0x54c15a['body'],{'raw':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1d')]||null:null,'attributes':_0x54c15a['options']?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1e')]||null:null,'limit':_0x54c15a[_0x208c('0x1b')]?_0x54c15a[_0x208c('0x1b')][_0x208c('0x1f')]||null:null})[_0x208c('0xd')](function(_0x3e0900){logger[_0x208c('0xe')]('UpdateOpenchannelApplication',_0x54c15a);logger[_0x208c('0x11')](_0x208c('0x19'),_0x54c15a,JSON[_0x208c('0x13')](_0x3e0900));_0x532367(_0x3e0900);})[_0x208c('0x18')](function(_0x1da4a7){logger[_0x208c('0x14')](_0x208c('0x19'),_0x1da4a7[_0x208c('0x16')],_0x54c15a);_0x340433(_0xaa257['error'](0x1f4,_0x1da4a7[_0x208c('0x16')]));});});}; \ No newline at end of file +var _0x459e=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','OpenchannelApplication','update','options','raw','where','attributes','limit','then','UpdateOpenchannelApplication'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x459e,0x14a));var _0xe459=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x459e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var moment=require('moment');var BPromise=require(_0xe459('0x2'));var rs=require(_0xe459('0x3'));var fs=require('fs');var Redis=require(_0xe459('0x4'));var db=require(_0xe459('0x5'))['db'];var utils=require(_0xe459('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe459('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe459('0x8')][_0xe459('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45269a,_0x4e0314,_0x44b98f){return new BPromise(function(_0x302cb4,_0xe5834){return client[_0xe459('0xa')](_0x45269a,_0x44b98f)['then'](function(_0x3ff041){logger[_0xe459('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x4e0314,_0xe459('0xc'));logger[_0xe459('0xd')](_0xe459('0xe'),_0x4e0314,_0xe459('0xc'),JSON[_0xe459('0xf')](_0x3ff041));if(_0x3ff041[_0xe459('0x10')]){if(_0x3ff041[_0xe459('0x10')]['code']===0x1f4){logger[_0xe459('0x10')](_0xe459('0x11'),_0x4e0314,_0x3ff041[_0xe459('0x10')][_0xe459('0x12')]);return _0xe5834(_0x3ff041[_0xe459('0x10')][_0xe459('0x12')]);}logger['error'](_0xe459('0x11'),_0x4e0314,_0x3ff041[_0xe459('0x10')][_0xe459('0x12')]);return _0x302cb4(_0x3ff041[_0xe459('0x10')]['message']);}else{logger[_0xe459('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x4e0314,'request\x20sent');_0x302cb4(_0x3ff041[_0xe459('0x13')][_0xe459('0x12')]);}})[_0xe459('0x14')](function(_0x1671a1){logger[_0xe459('0x10')](_0xe459('0x11'),_0x4e0314,_0x1671a1);_0xe5834(_0x1671a1);});});}exports['UpdateOpenchannelApplication']=function(_0x304021){var _0x11c21f=this;return new Promise(function(_0x49856b,_0x4e3b2c){return db[_0xe459('0x15')][_0xe459('0x16')](_0x304021['body'],{'raw':_0x304021[_0xe459('0x17')]?_0x304021[_0xe459('0x17')][_0xe459('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x304021['options']?_0x304021[_0xe459('0x17')][_0xe459('0x19')]||null:null,'attributes':_0x304021['options']?_0x304021[_0xe459('0x17')][_0xe459('0x1a')]||null:null,'limit':_0x304021[_0xe459('0x17')]?_0x304021[_0xe459('0x17')][_0xe459('0x1b')]||null:null})[_0xe459('0x1c')](function(_0x38b2bf){logger[_0xe459('0xb')](_0xe459('0x1d'),_0x304021);logger[_0xe459('0xd')]('UpdateOpenchannelApplication',_0x304021,JSON[_0xe459('0xf')](_0x38b2bf));_0x49856b(_0x38b2bf);})[_0xe459('0x14')](function(_0x1ba522){logger[_0xe459('0x10')](_0xe459('0x1d'),_0x1ba522[_0xe459('0x12')],_0x304021);_0x4e3b2c(_0x11c21f['error'](0x1f4,_0x1ba522[_0xe459('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3a0c08b..f1d699a 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 _0x6d25=['delete','openchannelinteraction:destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/:id/messages','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id','update'];(function(_0x4897d3,_0x1a6bb3){var _0x4f92e9=function(_0xcac1a0){while(--_0xcac1a0){_0x4897d3['push'](_0x4897d3['shift']());}};_0x4f92e9(++_0x1a6bb3);}(_0x6d25,0xb8));var _0x56d2=function(_0x2037fc,_0xec2955){_0x2037fc=_0x2037fc-0x0;var _0x234698=_0x6d25[_0x2037fc];return _0x234698;};'use strict';var multer=require('multer');var util=require(_0x56d2('0x0'));var path=require(_0x56d2('0x1'));var timeout=require(_0x56d2('0x2'));var express=require(_0x56d2('0x3'));var router=express[_0x56d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x56d2('0x5'));var interaction=require(_0x56d2('0x6'));var config=require(_0x56d2('0x7'));var controller=require(_0x56d2('0x8'));router[_0x56d2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x56d2('0xa')](),controller['describe']);router['get']('/:id',auth[_0x56d2('0xa')](),controller['show']);router[_0x56d2('0x9')](_0x56d2('0xb'),auth[_0x56d2('0xa')](),controller['getMessages']);router[_0x56d2('0x9')]('/:id/download',auth[_0x56d2('0xa')](),controller[_0x56d2('0xc')]);router[_0x56d2('0xd')]('/',auth['isAuthenticated'](),controller[_0x56d2('0xe')]);router['post'](_0x56d2('0xb'),auth[_0x56d2('0xa')](),controller[_0x56d2('0xf')]);router['post'](_0x56d2('0x10'),auth['isAuthenticated'](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),_0x56d2('0x13')),controller[_0x56d2('0x14')]);router[_0x56d2('0x15')](_0x56d2('0x16'),auth['isAuthenticated'](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),'openchannelinteraction:update'),controller[_0x56d2('0x17')]);router[_0x56d2('0x18')](_0x56d2('0x16'),auth[_0x56d2('0xa')](),interaction[_0x56d2('0x11')](_0x56d2('0x12'),_0x56d2('0x19')),controller['destroy']);router['delete'](_0x56d2('0x10'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x66e7=['openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','express','Router','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','/:id/download','post','tracked','openchannelinteraction:addtags','addTags','put'];(function(_0x54e8af,_0x249309){var _0x8944ae=function(_0x4b357f){while(--_0x4b357f){_0x54e8af['push'](_0x54e8af['shift']());}};_0x8944ae(++_0x249309);}(_0x66e7,0x121));var _0x766e=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0x66e7[_0x54edc9];return _0x2ae7a9;};'use strict';var multer=require('multer');var util=require(_0x766e('0x0'));var path=require(_0x766e('0x1'));var timeout=require('connect-timeout');var express=require(_0x766e('0x2'));var router=express[_0x766e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x766e('0x4'));var config=require('../../config/environment');var controller=require(_0x766e('0x5'));router[_0x766e('0x6')]('/',auth[_0x766e('0x7')](),controller[_0x766e('0x8')]);router[_0x766e('0x6')](_0x766e('0x9'),auth['isAuthenticated'](),controller[_0x766e('0xa')]);router[_0x766e('0x6')](_0x766e('0xb'),auth[_0x766e('0x7')](),controller['show']);router['get'](_0x766e('0xc'),auth[_0x766e('0x7')](),controller['getMessages']);router['get'](_0x766e('0xd'),auth[_0x766e('0x7')](),controller['download']);router[_0x766e('0xe')]('/',auth[_0x766e('0x7')](),controller['create']);router[_0x766e('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x766e('0xe')]('/:id/tags',auth[_0x766e('0x7')](),interaction[_0x766e('0xf')]('openchannel',_0x766e('0x10')),controller[_0x766e('0x11')]);router[_0x766e('0x12')](_0x766e('0xb'),auth[_0x766e('0x7')](),interaction[_0x766e('0xf')]('openchannel',_0x766e('0x13')),controller[_0x766e('0x14')]);router[_0x766e('0x15')]('/:id',auth[_0x766e('0x7')](),interaction['tracked'](_0x766e('0x16'),_0x766e('0x17')),controller[_0x766e('0x18')]);router['delete'](_0x766e('0x19'),auth[_0x766e('0x7')](),controller[_0x766e('0x1a')]);module[_0x766e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 6bff734..cf22d4a 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 _0xfa2b=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x214228,_0x1ae71e){var _0x291593=function(_0xdbaed0){while(--_0xdbaed0){_0x214228['push'](_0x214228['shift']());}};_0x291593(++_0x1ae71e);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x52955e,_0x4b988d){_0x52955e=_0x52955e-0x0;var _0x8993b8=_0xfa2b[_0x52955e];return _0x8993b8;};'use strict';var Sequelize=require(_0xbfa2('0x0'));module[_0xbfa2('0x1')]={'closed':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbfa2('0x3')]},'disposition':{'type':Sequelize[_0xbfa2('0x4')]},'secondDisposition':{'type':Sequelize[_0xbfa2('0x4')]},'thirdDisposition':{'type':Sequelize[_0xbfa2('0x4')]},'note':{'type':Sequelize[_0xbfa2('0x4')]},'read1stAt':{'type':Sequelize[_0xbfa2('0x3')]},'threadId':{'type':Sequelize[_0xbfa2('0x4')]},'externalUrl':{'type':Sequelize[_0xbfa2('0x4')]},'lastMsgAt':{'type':Sequelize[_0xbfa2('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbfa2('0x5')]('in',_0xbfa2('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xbfa2('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x50c1=['BOOLEAN','sequelize','DATE','STRING','ENUM'];(function(_0x4d9007,_0x3c4316){var _0x650c5f=function(_0x5b59b6){while(--_0x5b59b6){_0x4d9007['push'](_0x4d9007['shift']());}};_0x650c5f(++_0x3c4316);}(_0x50c1,0x1a5));var _0x150c=function(_0x304098,_0x18ec3e){_0x304098=_0x304098-0x0;var _0x121872=_0x50c1[_0x304098];return _0x121872;};'use strict';var Sequelize=require(_0x150c('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x150c('0x1')]},'disposition':{'type':Sequelize[_0x150c('0x2')]},'secondDisposition':{'type':Sequelize[_0x150c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x150c('0x2')]},'note':{'type':Sequelize[_0x150c('0x2')]},'read1stAt':{'type':Sequelize[_0x150c('0x1')]},'threadId':{'type':Sequelize[_0x150c('0x2')]},'externalUrl':{'type':Sequelize[_0x150c('0x2')]},'lastMsgAt':{'type':Sequelize[_0x150c('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x150c('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x150c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d93075f..42cc77b 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 _0xe8a4=['length','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','includeAll','include','rows','ids','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','transcript-%d-%s.zip','push','User','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','Openchannel','fullname','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','basename','createWriteStream','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','findAll','openchannel','query','user','show','from','params','OpenchannelInteraction','keys','filters','intersection','model','attributes','fields','merge','options','find','create','catch','body','describe','OpenchannelMessage','addMessage','omit','getMessages','findOne'];(function(_0x313f89,_0x393815){var _0x197008=function(_0x3da224){while(--_0x3da224){_0x313f89['push'](_0x313f89['shift']());}};_0x197008(++_0x393815);}(_0xe8a4,0xc1));var _0x4e8a=function(_0x34021d,_0x753aa6){_0x34021d=_0x34021d-0x0;var _0x16597b=_0xe8a4[_0x34021d];return _0x16597b;};'use strict';var rimraf=require(_0x4e8a('0x0'));var zipdir=require(_0x4e8a('0x1'));var moment=require('moment');var util=require(_0x4e8a('0x2'));var path=require(_0x4e8a('0x3'));var ejs=require(_0x4e8a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4e8a('0x5'));var interaction=require(_0x4e8a('0x6'));var qs=require(_0x4e8a('0x7'));var pdf=require(_0x4e8a('0x8'));var logger=require('../../config/logger')(_0x4e8a('0x9'));var config=require(_0x4e8a('0xa'));var db=require(_0x4e8a('0xb'))['db'];config['redis']=_[_0x4e8a('0xc')](config[_0x4e8a('0xd')],{'host':_0x4e8a('0xe'),'port':0x18eb});var socket=require(_0x4e8a('0xf'))(new Redis(config[_0x4e8a('0xd')]));require(_0x4e8a('0x10'))[_0x4e8a('0x11')](socket);function respondWithStatusCode(_0x39c624,_0x3a9ff4){_0x3a9ff4=_0x3a9ff4||0xcc;return function(_0x460800){if(_0x460800){return _0x39c624[_0x4e8a('0x12')](_0x3a9ff4);}return _0x39c624[_0x4e8a('0x13')](_0x3a9ff4)['end']();};}function respondWithResult(_0x1c896d,_0x201485){_0x201485=_0x201485||0xc8;return function(_0x46c413){if(_0x46c413){return _0x1c896d[_0x4e8a('0x13')](_0x201485)[_0x4e8a('0x14')](_0x46c413);}};}function respondWithFilteredResult(_0x1e648a,_0x30b5f7){return function(_0x3dcdda){if(_0x3dcdda){var _0x25739a=typeof _0x30b5f7[_0x4e8a('0x15')]===_0x4e8a('0x16')&&typeof _0x30b5f7[_0x4e8a('0x17')]===_0x4e8a('0x16');var _0xf9e9bd=_0x3dcdda[_0x4e8a('0x18')];var _0x2d773f=_0x25739a?0x0:_0x30b5f7['offset'];var _0x29a5b8=_0x25739a?_0x3dcdda['count']:_0x30b5f7[_0x4e8a('0x15')]+_0x30b5f7[_0x4e8a('0x17')];var _0x3d5ab0;if(_0x29a5b8>=_0xf9e9bd){_0x29a5b8=_0xf9e9bd;_0x3d5ab0=0xc8;}else{_0x3d5ab0=0xce;}_0x1e648a['status'](_0x3d5ab0);return _0x1e648a[_0x4e8a('0x19')]('Content-Range',_0x2d773f+'-'+_0x29a5b8+'/'+_0xf9e9bd)[_0x4e8a('0x14')](_0x3dcdda);}return null;};}function saveUpdates(_0x51275f){return function(_0x1abb53){if(_0x1abb53){return _0x1abb53[_0x4e8a('0x1a')](_0x51275f)[_0x4e8a('0x1b')](function(_0x25afd1){return _0x25afd1;});}return null;};}function removeEntity(_0x4284d3){return function(_0x3e63c2){if(_0x3e63c2){return _0x3e63c2[_0x4e8a('0x1c')]()[_0x4e8a('0x1b')](function(){_0x4284d3[_0x4e8a('0x13')](0xcc)[_0x4e8a('0x1d')]();});}};}function handleEntityNotFound(_0x4abe55){return function(_0x1ac0b0){if(!_0x1ac0b0){_0x4abe55[_0x4e8a('0x12')](0x194);}return _0x1ac0b0;};}function handleError(_0x457697,_0x573a47){_0x573a47=_0x573a47||0x1f4;return function(_0x3e645b){logger[_0x4e8a('0x1e')](_0x3e645b[_0x4e8a('0x1f')]);if(_0x3e645b[_0x4e8a('0x20')]){delete _0x3e645b[_0x4e8a('0x20')];}_0x457697[_0x4e8a('0x13')](_0x573a47)[_0x4e8a('0x21')](_0x3e645b);};}exports[_0x4e8a('0x22')]=function(_0x2b5355,_0x4baa7b){var _0x49b5e8={};var _0x135153=_[_0x4e8a('0x23')](db['OpenchannelInteraction'][_0x4e8a('0x24')],function(_0x37e09b){return{'name':_0x37e09b[_0x4e8a('0x25')],'type':_0x37e09b[_0x4e8a('0x26')][_0x4e8a('0x27')]};});_0x49b5e8=qs[_0x4e8a('0x28')](_0x135153,_0x2b5355);return interaction[_0x4e8a('0x29')](_0x4e8a('0x2a'),_0x2b5355[_0x4e8a('0x2b')],_0x2b5355[_0x4e8a('0x2c')],_0x49b5e8,_0x135153)[_0x4e8a('0x1b')](respondWithFilteredResult(_0x4baa7b,_0x49b5e8))['catch'](handleError(_0x4baa7b,null));};exports[_0x4e8a('0x2d')]=function(_0x86e8c6,_0x167644){var _0x3cf0a2={};if(_0x86e8c6['query'][_0x4e8a('0x26')]&&_0x86e8c6[_0x4e8a('0x2b')][_0x4e8a('0x26')]===_0x4e8a('0x2e')){_0x3cf0a2[_0x4e8a('0x2e')]=_0x86e8c6[_0x4e8a('0x2f')]['id'];}else{_0x3cf0a2['id']=_0x86e8c6['params']['id'];}var _0x412e73={'raw':![],'where':_0x3cf0a2},_0x4163bc={};_0x4163bc['model']=_['keys'](db[_0x4e8a('0x30')][_0x4e8a('0x24')]);_0x4163bc[_0x4e8a('0x2b')]=_[_0x4e8a('0x31')](_0x86e8c6['query']);_0x4163bc[_0x4e8a('0x32')]=_[_0x4e8a('0x33')](_0x4163bc[_0x4e8a('0x34')],_0x4163bc[_0x4e8a('0x2b')]);_0x412e73[_0x4e8a('0x35')]=_[_0x4e8a('0x33')](_0x4163bc[_0x4e8a('0x34')],qs[_0x4e8a('0x36')](_0x86e8c6[_0x4e8a('0x2b')]['fields']));_0x412e73[_0x4e8a('0x35')]=_0x412e73[_0x4e8a('0x35')]['length']?_0x412e73[_0x4e8a('0x35')]:_0x4163bc[_0x4e8a('0x34')];if(_0x86e8c6[_0x4e8a('0x2b')]['includeAll']){_0x412e73['include']=[{'all':!![]}];}_0x412e73=_[_0x4e8a('0x37')]({},_0x412e73,_0x86e8c6[_0x4e8a('0x38')]);return db[_0x4e8a('0x30')][_0x4e8a('0x39')](_0x412e73)[_0x4e8a('0x1b')](handleEntityNotFound(_0x167644,null))['then'](respondWithResult(_0x167644,null))['catch'](handleError(_0x167644,null));};exports[_0x4e8a('0x3a')]=function(_0x18682c,_0x60f516){return db['OpenchannelInteraction'][_0x4e8a('0x3a')](_0x18682c['body'],{})[_0x4e8a('0x1b')](respondWithResult(_0x60f516,0xc9))[_0x4e8a('0x3b')](handleError(_0x60f516,null));};exports[_0x4e8a('0x1a')]=function(_0x45c34e,_0x4aa96b){if(_0x45c34e['body']['id']){delete _0x45c34e[_0x4e8a('0x3c')]['id'];}return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x45c34e[_0x4e8a('0x2f')]['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x4aa96b,null))[_0x4e8a('0x1b')](saveUpdates(_0x45c34e['body'],null))[_0x4e8a('0x1b')](respondWithResult(_0x4aa96b,null))[_0x4e8a('0x3b')](handleError(_0x4aa96b,null));};exports['destroy']=function(_0x22067e,_0x22e84d){return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x22067e[_0x4e8a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x22e84d,null))[_0x4e8a('0x1b')](removeEntity(_0x22e84d,null))[_0x4e8a('0x3b')](handleError(_0x22e84d,null));};exports[_0x4e8a('0x3d')]=function(_0x40a563,_0x29b20c){return db['OpenchannelInteraction'][_0x4e8a('0x3d')]()[_0x4e8a('0x1b')](respondWithResult(_0x29b20c,null))[_0x4e8a('0x3b')](handleError(_0x29b20c,null));};exports['addMessage']=function(_0x4fa0ec,_0x315c66){return db[_0x4e8a('0x3e')]['find']({'where':{'id':_0x4fa0ec['params']['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x315c66,null))[_0x4e8a('0x1b')](function(_0x5aea0d){if(_0x5aea0d){return _0x5aea0d[_0x4e8a('0x3f')](_0x4fa0ec['body']['ids'],_[_0x4e8a('0x40')](_0x4fa0ec[_0x4e8a('0x3c')],['ids','id'])||{});}})[_0x4e8a('0x1b')](respondWithResult(_0x315c66,null))[_0x4e8a('0x3b')](handleError(_0x315c66,null));};exports[_0x4e8a('0x41')]=function(_0x5b5faf,_0x3e09ca){var _0x5e6597={'raw':![],'where':{}};var _0x42dbd5={};var _0x51814f={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x4e8a('0x42')]({'where':{'id':_0x5b5faf[_0x4e8a('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3e09ca,null))[_0x4e8a('0x1b')](function(_0x4e66ed){if(_0x4e66ed){_0x42dbd5['model']=_['keys'](db['OpenchannelMessage'][_0x4e8a('0x24')]);_0x42dbd5[_0x4e8a('0x2b')]=_['keys'](_0x5b5faf[_0x4e8a('0x2b')]);_0x42dbd5[_0x4e8a('0x32')]=_[_0x4e8a('0x33')](_0x42dbd5['model'],_0x42dbd5[_0x4e8a('0x2b')]);_0x5e6597['attributes']=_[_0x4e8a('0x33')](_0x42dbd5['model'],qs[_0x4e8a('0x36')](_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x36')]));_0x5e6597[_0x4e8a('0x35')]=_0x5e6597[_0x4e8a('0x35')][_0x4e8a('0x43')]?_0x5e6597[_0x4e8a('0x35')]:_0x42dbd5['model'];if(!_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x44')]('nolimit')){_0x5e6597[_0x4e8a('0x17')]=qs[_0x4e8a('0x17')](_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x17')]);_0x5e6597[_0x4e8a('0x15')]=qs['offset'](_0x5b5faf[_0x4e8a('0x2b')]['offset']);}_0x5e6597['order']=qs[_0x4e8a('0x45')](_0x5b5faf['query'][_0x4e8a('0x45')]);_0x5e6597[_0x4e8a('0x46')]=qs[_0x4e8a('0x32')](_[_0x4e8a('0x47')](_0x5b5faf[_0x4e8a('0x2b')],_0x42dbd5['filters']));_0x5e6597[_0x4e8a('0x46')][_0x4e8a('0x48')]=_0x4e66ed['id'];if(_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x49')]){_0x5e6597[_0x4e8a('0x46')]=_[_0x4e8a('0x37')](_0x5e6597[_0x4e8a('0x46')],{'$or':_['map'](_0x5e6597[_0x4e8a('0x35')],function(_0xc1ccf1){var _0x38a21d={};_0x38a21d[_0xc1ccf1]={'$like':'%'+_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x49')]+'%'};return _0x38a21d;})});}if(_0x5b5faf['query'][_0x4e8a('0x4a')]){var _0xa547d1=_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x4a')]['split'](',');var _0x178a9f={};_0x178a9f[_0xa547d1[0x0]]={'$gte':moment(_0xa547d1[0x1])[_0x4e8a('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5e6597[_0x4e8a('0x46')]=_['merge'](_0x5e6597[_0x4e8a('0x46')],_0x178a9f);}_0x5e6597=_[_0x4e8a('0x37')]({},_0x5e6597,_0x5b5faf[_0x4e8a('0x38')]);return db['OpenchannelMessage'][_0x4e8a('0x18')]({'where':_0x5e6597['where']})['then'](function(_0x5c91b5){_0x51814f['count']=_0x5c91b5;if(_0x5b5faf[_0x4e8a('0x2b')][_0x4e8a('0x4c')]){_0x5e6597[_0x4e8a('0x4d')]=[{'all':!![]}];}return db[_0x4e8a('0x3e')]['findAll'](_0x5e6597);})['then'](function(_0x2238b5){_0x51814f[_0x4e8a('0x4e')]=_0x2238b5;return _0x51814f;});}})[_0x4e8a('0x1b')](respondWithFilteredResult(_0x3e09ca,_0x5e6597))[_0x4e8a('0x3b')](handleError(_0x3e09ca,null));};exports['addTags']=function(_0x5155b8,_0x54a246){return db[_0x4e8a('0x30')]['find']({'where':{'id':_0x5155b8['params']['id']}})['then'](handleEntityNotFound(_0x54a246,null))['then'](function(_0x49ccad){if(_0x49ccad){return _0x49ccad['setTags'](_0x5155b8[_0x4e8a('0x3c')][_0x4e8a('0x4f')],_[_0x4e8a('0x40')](_0x5155b8['body'],[_0x4e8a('0x4f'),'id'])||{})[_0x4e8a('0x50')](function(){return db[_0x4e8a('0x51')][_0x4e8a('0x29')]({'attributes':['id',_0x4e8a('0x20'),_0x4e8a('0x52')],'where':{'id':_0x5155b8['body']['ids']}});})[_0x4e8a('0x1b')](function(_0x1f9919){socket[_0x4e8a('0x53')](_0x4e8a('0x54'),{'id':Number(_0x5155b8[_0x4e8a('0x2f')]['id']),'tags':_0x1f9919||[]});return{'id':Number(_0x5155b8[_0x4e8a('0x2f')]['id']),'tags':_0x1f9919||[]};});}})[_0x4e8a('0x1b')](respondWithResult(_0x54a246,null))[_0x4e8a('0x3b')](handleError(_0x54a246,null));};exports[_0x4e8a('0x55')]=function(_0x4cbb8b,_0x58cc52){return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x4cbb8b[_0x4e8a('0x2f')]['id']}})[_0x4e8a('0x1b')](handleEntityNotFound(_0x58cc52,null))['then'](function(_0x2d7c4b){if(_0x2d7c4b){return _0x2d7c4b[_0x4e8a('0x55')](_0x4cbb8b['query']['ids']);}})[_0x4e8a('0x1b')](respondWithStatusCode(_0x58cc52,null))[_0x4e8a('0x3b')](handleError(_0x58cc52,null));};exports[_0x4e8a('0x56')]=function(_0x432c09,_0x4ec915){var _0x134441=moment()[_0x4e8a('0x57')]()[_0x4e8a('0x58')]();var _0x2ddbf8=path['join'](config[_0x4e8a('0x59')],_0x4e8a('0x5a'),_0x4e8a('0x5b'),_0x4e8a('0x5c'));var _0x3ff2d8=path[_0x4e8a('0x5d')](config[_0x4e8a('0x59')],_0x4e8a('0x5a'),_0x4e8a('0x5b'),'attachments');var _0x37191a=path[_0x4e8a('0x5d')](_0x2ddbf8,_0x134441);var _0x11eaa3=util['format'](_0x4e8a('0x5e'),_0x432c09['params']['id'],_0x134441);var _0x200d53=path[_0x4e8a('0x5d')](_0x2ddbf8,_0x11eaa3);var _0xab849d=[];_0xab849d[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x60')],'as':_0x4e8a('0x60'),'attributes':['id','fullname'],'raw':!![]});_0xab849d[_0x4e8a('0x5f')]({'model':db['CmContact'],'as':_0x4e8a('0x61'),'attributes':['id',_0x4e8a('0x62'),_0x4e8a('0x63')],'raw':!![]});if(_0x432c09['query']['attachments']){_0xab849d[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x64')],'as':_0x4e8a('0x64'),'raw':!![]});}var _0x5388c1=[{'model':db['OpenchannelMessage'],'as':_0x4e8a('0x65'),'attributes':['id',_0x4e8a('0x3c'),_0x4e8a('0x66'),_0x4e8a('0x67'),_0x4e8a('0x68'),_0x4e8a('0x69')],'include':_0xab849d}];_0x5388c1[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x6a')],'as':_0x4e8a('0x6b'),'attributes':['id',_0x4e8a('0x20')]});_0x5388c1[_0x4e8a('0x5f')]({'model':db[_0x4e8a('0x60')],'as':_0x4e8a('0x6c'),'attributes':['id','fullname']});return db[_0x4e8a('0x30')][_0x4e8a('0x39')]({'where':{'id':_0x432c09[_0x4e8a('0x2f')]['id']},'include':_0x5388c1})[_0x4e8a('0x1b')](handleEntityNotFound(_0x4ec915,null))[_0x4e8a('0x1b')](function(_0x498521){if(_0x498521){var _0x2e6434=_0x498521['get']({'plain':!![]});fs['mkdirSync'](_0x37191a);var _0x4ddfa2={'channel':_0x4e8a('0x6d'),'account':_0x2e6434['Account'][_0x4e8a('0x20')],'agent':_0x2e6434[_0x4e8a('0x6c')]?_0x2e6434['Owner'][_0x4e8a('0x6e')]:_0x4e8a('0x6f'),'createdAt':moment(_0x2e6434[_0x4e8a('0x66')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))[_0x4e8a('0x58')](),'closedAt':_0x2e6434[_0x4e8a('0x71')]?moment(_0x2e6434[_0x4e8a('0x72')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))['toString']():'','disposition':_0x2e6434[_0x4e8a('0x73')],'visibility':_0x2e6434['threadId']?_0x4e8a('0x74'):_0x4e8a('0x75'),'messages':_(_0x2e6434[_0x4e8a('0x65')])[_0x4e8a('0x49')]({'secret':![]})[_0x4e8a('0x23')](function(_0x18578a){if(_0x18578a['Attachment']){var _0x204164=path[_0x4e8a('0x5d')](_0x3ff2d8,_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')]);if(fs['existsSync'](_0x204164)){fs['createReadStream'](_0x204164)['pipe'](fs[_0x4e8a('0x77')](path['join'](_0x37191a,_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')])));}}return{'date':moment(_0x18578a[_0x4e8a('0x66')])[_0x4e8a('0x4b')](_0x4e8a('0x70'))[_0x4e8a('0x58')](),'sender':_0x18578a[_0x4e8a('0x67')]===_0x4e8a('0x78')?_0x18578a[_0x4e8a('0x60')]?_0x18578a[_0x4e8a('0x60')]['fullname']:_0x4e8a('0x79'):_0x18578a[_0x4e8a('0x61')]['firstName']+(_0x18578a[_0x4e8a('0x61')]['lastName']?'\x20'+_0x18578a[_0x4e8a('0x61')][_0x4e8a('0x63')]:''),'body':_0x18578a[_0x4e8a('0x64')]?_0x18578a[_0x4e8a('0x64')][_0x4e8a('0x76')]:_0x18578a[_0x4e8a('0x3c')],'direction':_0x18578a['direction']===_0x4e8a('0x78')?'A':'C','secret':_0x18578a['secret'],'read':_0x18578a[_0x4e8a('0x69')],'attachment':_0x18578a[_0x4e8a('0x64')]};})['value']()};return ejs[_0x4e8a('0x7a')](path[_0x4e8a('0x5d')](config['root'],'server',_0x4e8a('0x7b'),_0x4e8a('0x7c')),{'interaction':_0x4ddfa2})[_0x4e8a('0x1b')](function(_0x411f09){var _0x43184e=path['join'](_0x37191a,_0x4e8a('0x7d')+_0x2e6434['id']+'-'+_0x134441+_0x4e8a('0x7e'));var _0x355bb4={'path':_0x43184e,'channel':_0x4e8a('0x6d'),'interactionId':_0x2e6434['id']};return pdf[_0x4e8a('0x7f')](_0x411f09,_0x355bb4);})[_0x4e8a('0x1b')](function(){return new Promise(function(_0x39455d,_0x3734ec){zipdir(_0x37191a,{'saveTo':_0x200d53},function(_0x456a4a,_0x208b31){if(_0x456a4a)return _0x3734ec(_0x456a4a);return _0x39455d(_0x208b31);});})[_0x4e8a('0x1b')](function(){return new Promise(function(_0x3c5a95,_0x4d5bf9){rimraf(_0x37191a,function(_0x36d5b1){if(_0x36d5b1)_0x4d5bf9(_0x36d5b1);return _0x3c5a95();});});})[_0x4e8a('0x1b')](function(){return _0x4ec915[_0x4e8a('0x56')](_0x200d53,_0x11eaa3,function(_0x507fb0){if(_0x507fb0){logger['error'](_0x4e8a('0x80'),_0x507fb0);}else{fs[_0x4e8a('0x81')](_0x200d53);}});});});}else{return _0x4ec915['sendStatus'](0xc8);}})[_0x4e8a('0x3b')](handleError(_0x4ec915,null));}; \ No newline at end of file +var _0x3175=['split','YYYY-MM-DD\x20HH:mm:ss','options','OpenchannelMessage','rows','addTags','setTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','fullname','Openchannel','N.A.','format','basename','existsSync','createReadStream','createWriteStream','out','System','firstName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','sendStatus','rimraf','zip-dir','moment','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','user','catch','show','query','from','params','model','keys','filters','intersection','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3175,0xaf));var _0x5317=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0x3175[_0x2459fd];return _0x364cd2;};'use strict';var rimraf=require(_0x5317('0x0'));var zipdir=require(_0x5317('0x1'));var moment=require(_0x5317('0x2'));var util=require(_0x5317('0x3'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x5317('0x4'));var interaction=require(_0x5317('0x5'));var qs=require(_0x5317('0x6'));var pdf=require('../../components/export/pdf');var logger=require(_0x5317('0x7'))(_0x5317('0x8'));var config=require(_0x5317('0x9'));var db=require(_0x5317('0xa'))['db'];config['redis']=_['defaults'](config[_0x5317('0xb')],{'host':_0x5317('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5317('0xb')]));require(_0x5317('0xd'))[_0x5317('0xe')](socket);function respondWithStatusCode(_0x1d7708,_0x299e95){_0x299e95=_0x299e95||0xcc;return function(_0x4c7872){if(_0x4c7872){return _0x1d7708['sendStatus'](_0x299e95);}return _0x1d7708[_0x5317('0xf')](_0x299e95)[_0x5317('0x10')]();};}function respondWithResult(_0x182bcb,_0xbc5733){_0xbc5733=_0xbc5733||0xc8;return function(_0x4ef6d3){if(_0x4ef6d3){return _0x182bcb[_0x5317('0xf')](_0xbc5733)[_0x5317('0x11')](_0x4ef6d3);}};}function respondWithFilteredResult(_0x15a7e1,_0x409156){return function(_0xf91244){if(_0xf91244){var _0x7fcb20=typeof _0x409156[_0x5317('0x12')]===_0x5317('0x13')&&typeof _0x409156[_0x5317('0x14')]===_0x5317('0x13');var _0x157223=_0xf91244[_0x5317('0x15')];var _0x111caa=_0x7fcb20?0x0:_0x409156[_0x5317('0x12')];var _0x52e601=_0x7fcb20?_0xf91244[_0x5317('0x15')]:_0x409156[_0x5317('0x12')]+_0x409156[_0x5317('0x14')];var _0x6a862;if(_0x52e601>=_0x157223){_0x52e601=_0x157223;_0x6a862=0xc8;}else{_0x6a862=0xce;}_0x15a7e1['status'](_0x6a862);return _0x15a7e1['set'](_0x5317('0x16'),_0x111caa+'-'+_0x52e601+'/'+_0x157223)[_0x5317('0x11')](_0xf91244);}return null;};}function saveUpdates(_0x24144c){return function(_0x41e1b5){if(_0x41e1b5){return _0x41e1b5[_0x5317('0x17')](_0x24144c)[_0x5317('0x18')](function(_0x422b2c){return _0x422b2c;});}return null;};}function removeEntity(_0x2f3d2a){return function(_0x12a161){if(_0x12a161){return _0x12a161[_0x5317('0x19')]()['then'](function(){_0x2f3d2a[_0x5317('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5df5){return function(_0x410622){if(!_0x410622){_0x4c5df5['sendStatus'](0x194);}return _0x410622;};}function handleError(_0x3029b6,_0x133cf8){_0x133cf8=_0x133cf8||0x1f4;return function(_0x758839){logger[_0x5317('0x1a')](_0x758839[_0x5317('0x1b')]);if(_0x758839[_0x5317('0x1c')]){delete _0x758839[_0x5317('0x1c')];}_0x3029b6[_0x5317('0xf')](_0x133cf8)['send'](_0x758839);};}exports[_0x5317('0x1d')]=function(_0xf0500a,_0x572e43){var _0x576ea1={};var _0x23c503=_[_0x5317('0x1e')](db[_0x5317('0x1f')][_0x5317('0x20')],function(_0x51462e){return{'name':_0x51462e[_0x5317('0x21')],'type':_0x51462e[_0x5317('0x22')][_0x5317('0x23')]};});_0x576ea1=qs['getOptions'](_0x23c503,_0xf0500a);return interaction[_0x5317('0x24')](_0x5317('0x25'),_0xf0500a['query'],_0xf0500a[_0x5317('0x26')],_0x576ea1,_0x23c503)[_0x5317('0x18')](respondWithFilteredResult(_0x572e43,_0x576ea1))[_0x5317('0x27')](handleError(_0x572e43,null));};exports[_0x5317('0x28')]=function(_0x5414e7,_0x2fc5fe){var _0x25f009={};if(_0x5414e7[_0x5317('0x29')][_0x5317('0x22')]&&_0x5414e7[_0x5317('0x29')]['type']===_0x5317('0x2a')){_0x25f009[_0x5317('0x2a')]=_0x5414e7[_0x5317('0x2b')]['id'];}else{_0x25f009['id']=_0x5414e7[_0x5317('0x2b')]['id'];}var _0x16a325={'raw':![],'where':_0x25f009},_0x361c32={};_0x361c32[_0x5317('0x2c')]=_['keys'](db[_0x5317('0x1f')][_0x5317('0x20')]);_0x361c32[_0x5317('0x29')]=_[_0x5317('0x2d')](_0x5414e7[_0x5317('0x29')]);_0x361c32[_0x5317('0x2e')]=_[_0x5317('0x2f')](_0x361c32['model'],_0x361c32[_0x5317('0x29')]);_0x16a325[_0x5317('0x30')]=_[_0x5317('0x2f')](_0x361c32[_0x5317('0x2c')],qs['fields'](_0x5414e7[_0x5317('0x29')]['fields']));_0x16a325[_0x5317('0x30')]=_0x16a325[_0x5317('0x30')][_0x5317('0x31')]?_0x16a325[_0x5317('0x30')]:_0x361c32[_0x5317('0x2c')];if(_0x5414e7[_0x5317('0x29')][_0x5317('0x32')]){_0x16a325[_0x5317('0x33')]=[{'all':!![]}];}_0x16a325=_[_0x5317('0x34')]({},_0x16a325,_0x5414e7['options']);return db[_0x5317('0x1f')][_0x5317('0x35')](_0x16a325)[_0x5317('0x18')](handleEntityNotFound(_0x2fc5fe,null))[_0x5317('0x18')](respondWithResult(_0x2fc5fe,null))['catch'](handleError(_0x2fc5fe,null));};exports[_0x5317('0x36')]=function(_0x132e9a,_0x80812c){return db[_0x5317('0x1f')]['create'](_0x132e9a['body'],{})[_0x5317('0x18')](respondWithResult(_0x80812c,0xc9))[_0x5317('0x27')](handleError(_0x80812c,null));};exports['update']=function(_0x350c48,_0x35875f){if(_0x350c48[_0x5317('0x37')]['id']){delete _0x350c48[_0x5317('0x37')]['id'];}return db[_0x5317('0x1f')]['find']({'where':{'id':_0x350c48[_0x5317('0x2b')]['id']}})[_0x5317('0x18')](handleEntityNotFound(_0x35875f,null))[_0x5317('0x18')](saveUpdates(_0x350c48['body'],null))['then'](respondWithResult(_0x35875f,null))[_0x5317('0x27')](handleError(_0x35875f,null));};exports[_0x5317('0x19')]=function(_0x1a4183,_0x488206){return db[_0x5317('0x1f')][_0x5317('0x35')]({'where':{'id':_0x1a4183[_0x5317('0x2b')]['id']}})['then'](handleEntityNotFound(_0x488206,null))['then'](removeEntity(_0x488206,null))[_0x5317('0x27')](handleError(_0x488206,null));};exports['describe']=function(_0x3de787,_0x189163){return db['OpenchannelInteraction'][_0x5317('0x38')]()[_0x5317('0x18')](respondWithResult(_0x189163,null))[_0x5317('0x27')](handleError(_0x189163,null));};exports[_0x5317('0x39')]=function(_0x2a5c68,_0x5efd02){return db['OpenchannelMessage'][_0x5317('0x35')]({'where':{'id':_0x2a5c68[_0x5317('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5efd02,null))['then'](function(_0x160377){if(_0x160377){return _0x160377[_0x5317('0x39')](_0x2a5c68[_0x5317('0x37')][_0x5317('0x3a')],_[_0x5317('0x3b')](_0x2a5c68[_0x5317('0x37')],[_0x5317('0x3a'),'id'])||{});}})[_0x5317('0x18')](respondWithResult(_0x5efd02,null))['catch'](handleError(_0x5efd02,null));};exports[_0x5317('0x3c')]=function(_0x165ef2,_0x333a6c){var _0x40bc58={'raw':![],'where':{}};var _0x6bcfc0={};var _0x54282e={'count':0x0,'rows':[]};return db[_0x5317('0x1f')][_0x5317('0x3d')]({'where':{'id':_0x165ef2[_0x5317('0x2b')]['id']}})[_0x5317('0x18')](handleEntityNotFound(_0x333a6c,null))[_0x5317('0x18')](function(_0x19f507){if(_0x19f507){_0x6bcfc0[_0x5317('0x2c')]=_[_0x5317('0x2d')](db['OpenchannelMessage'][_0x5317('0x20')]);_0x6bcfc0[_0x5317('0x29')]=_['keys'](_0x165ef2['query']);_0x6bcfc0[_0x5317('0x2e')]=_[_0x5317('0x2f')](_0x6bcfc0[_0x5317('0x2c')],_0x6bcfc0[_0x5317('0x29')]);_0x40bc58[_0x5317('0x30')]=_[_0x5317('0x2f')](_0x6bcfc0[_0x5317('0x2c')],qs[_0x5317('0x3e')](_0x165ef2['query']['fields']));_0x40bc58[_0x5317('0x30')]=_0x40bc58[_0x5317('0x30')][_0x5317('0x31')]?_0x40bc58[_0x5317('0x30')]:_0x6bcfc0[_0x5317('0x2c')];if(!_0x165ef2[_0x5317('0x29')][_0x5317('0x3f')](_0x5317('0x40'))){_0x40bc58[_0x5317('0x14')]=qs['limit'](_0x165ef2[_0x5317('0x29')]['limit']);_0x40bc58[_0x5317('0x12')]=qs['offset'](_0x165ef2[_0x5317('0x29')][_0x5317('0x12')]);}_0x40bc58[_0x5317('0x41')]=qs[_0x5317('0x42')](_0x165ef2[_0x5317('0x29')][_0x5317('0x42')]);_0x40bc58[_0x5317('0x43')]=qs[_0x5317('0x2e')](_[_0x5317('0x44')](_0x165ef2['query'],_0x6bcfc0['filters']));_0x40bc58['where']['OpenchannelInteractionId']=_0x19f507['id'];if(_0x165ef2[_0x5317('0x29')][_0x5317('0x45')]){_0x40bc58[_0x5317('0x43')]=_[_0x5317('0x34')](_0x40bc58[_0x5317('0x43')],{'$or':_[_0x5317('0x1e')](_0x40bc58['attributes'],function(_0x173aab){var _0x2cb89c={};_0x2cb89c[_0x173aab]={'$like':'%'+_0x165ef2[_0x5317('0x29')][_0x5317('0x45')]+'%'};return _0x2cb89c;})});}if(_0x165ef2['query'][_0x5317('0x46')]){var _0x1a8ad5=_0x165ef2[_0x5317('0x29')][_0x5317('0x46')][_0x5317('0x47')](',');var _0x1ec36f={};_0x1ec36f[_0x1a8ad5[0x0]]={'$gte':moment(_0x1a8ad5[0x1])['format'](_0x5317('0x48'))};_0x40bc58['where']=_[_0x5317('0x34')](_0x40bc58[_0x5317('0x43')],_0x1ec36f);}_0x40bc58=_[_0x5317('0x34')]({},_0x40bc58,_0x165ef2[_0x5317('0x49')]);return db[_0x5317('0x4a')][_0x5317('0x15')]({'where':_0x40bc58[_0x5317('0x43')]})[_0x5317('0x18')](function(_0x4aceb2){_0x54282e[_0x5317('0x15')]=_0x4aceb2;if(_0x165ef2[_0x5317('0x29')]['includeAll']){_0x40bc58[_0x5317('0x33')]=[{'all':!![]}];}return db[_0x5317('0x4a')][_0x5317('0x24')](_0x40bc58);})[_0x5317('0x18')](function(_0x47f703){_0x54282e[_0x5317('0x4b')]=_0x47f703;return _0x54282e;});}})['then'](respondWithFilteredResult(_0x333a6c,_0x40bc58))[_0x5317('0x27')](handleError(_0x333a6c,null));};exports[_0x5317('0x4c')]=function(_0x11ad4e,_0xb78ec8){return db[_0x5317('0x1f')]['find']({'where':{'id':_0x11ad4e[_0x5317('0x2b')]['id']}})[_0x5317('0x18')](handleEntityNotFound(_0xb78ec8,null))['then'](function(_0x2b51db){if(_0x2b51db){return _0x2b51db[_0x5317('0x4d')](_0x11ad4e['body'][_0x5317('0x3a')],_[_0x5317('0x3b')](_0x11ad4e['body'],['ids','id'])||{})[_0x5317('0x4e')](function(){return db['Tag'][_0x5317('0x24')]({'attributes':['id',_0x5317('0x1c'),'color'],'where':{'id':_0x11ad4e['body']['ids']}});})[_0x5317('0x18')](function(_0x363d22){socket[_0x5317('0x4f')](_0x5317('0x50'),{'id':Number(_0x11ad4e['params']['id']),'tags':_0x363d22||[]});return{'id':Number(_0x11ad4e[_0x5317('0x2b')]['id']),'tags':_0x363d22||[]};});}})[_0x5317('0x18')](respondWithResult(_0xb78ec8,null))[_0x5317('0x27')](handleError(_0xb78ec8,null));};exports[_0x5317('0x51')]=function(_0x3dd9ac,_0x172990){return db[_0x5317('0x1f')][_0x5317('0x35')]({'where':{'id':_0x3dd9ac['params']['id']}})[_0x5317('0x18')](handleEntityNotFound(_0x172990,null))[_0x5317('0x18')](function(_0x32f0c6){if(_0x32f0c6){return _0x32f0c6['removeTags'](_0x3dd9ac['query'][_0x5317('0x3a')]);}})[_0x5317('0x18')](respondWithStatusCode(_0x172990,null))[_0x5317('0x27')](handleError(_0x172990,null));};exports[_0x5317('0x52')]=function(_0x1b215e,_0x55d40b){var _0x2dd494=moment()[_0x5317('0x53')]()[_0x5317('0x54')]();var _0x1affb9=path[_0x5317('0x55')](config[_0x5317('0x56')],_0x5317('0x57'),_0x5317('0x58'),_0x5317('0x59'));var _0x276f85=path[_0x5317('0x55')](config['root'],_0x5317('0x57'),_0x5317('0x58'),_0x5317('0x5a'));var _0x5b83e8=path[_0x5317('0x55')](_0x1affb9,_0x2dd494);var _0x2e8049=util['format'](_0x5317('0x5b'),_0x1b215e[_0x5317('0x2b')]['id'],_0x2dd494);var _0x3a4c7b=path[_0x5317('0x55')](_0x1affb9,_0x2e8049);var _0x1c3e1f=[];_0x1c3e1f[_0x5317('0x5c')]({'model':db[_0x5317('0x5d')],'as':_0x5317('0x5d'),'attributes':['id','fullname'],'raw':!![]});_0x1c3e1f[_0x5317('0x5c')]({'model':db[_0x5317('0x5e')],'as':_0x5317('0x5f'),'attributes':['id','firstName',_0x5317('0x60')],'raw':!![]});if(_0x1b215e['query']['attachments']){_0x1c3e1f[_0x5317('0x5c')]({'model':db['Attachment'],'as':_0x5317('0x61'),'raw':!![]});}var _0x1115dd=[{'model':db[_0x5317('0x4a')],'as':_0x5317('0x62'),'attributes':['id','body',_0x5317('0x63'),_0x5317('0x64'),_0x5317('0x65'),_0x5317('0x66')],'include':_0x1c3e1f}];_0x1115dd['push']({'model':db[_0x5317('0x67')],'as':_0x5317('0x68'),'attributes':['id',_0x5317('0x1c')]});_0x1115dd[_0x5317('0x5c')]({'model':db[_0x5317('0x5d')],'as':_0x5317('0x69'),'attributes':['id',_0x5317('0x6a')]});return db[_0x5317('0x1f')]['find']({'where':{'id':_0x1b215e[_0x5317('0x2b')]['id']},'include':_0x1115dd})['then'](handleEntityNotFound(_0x55d40b,null))[_0x5317('0x18')](function(_0x306dc7){if(_0x306dc7){var _0x20b0c2=_0x306dc7['get']({'plain':!![]});fs['mkdirSync'](_0x5b83e8);var _0x1cfe6b={'channel':_0x5317('0x6b'),'account':_0x20b0c2[_0x5317('0x68')]['name'],'agent':_0x20b0c2[_0x5317('0x69')]?_0x20b0c2['Owner'][_0x5317('0x6a')]:_0x5317('0x6c'),'createdAt':moment(_0x20b0c2[_0x5317('0x63')])[_0x5317('0x6d')](_0x5317('0x48'))[_0x5317('0x54')](),'closedAt':_0x20b0c2['closed']?moment(_0x20b0c2['closedAt'])[_0x5317('0x6d')](_0x5317('0x48'))[_0x5317('0x54')]():'','disposition':_0x20b0c2['disposition'],'visibility':_0x20b0c2['threadId']?'Public':'Private','messages':_(_0x20b0c2['Messages'])[_0x5317('0x45')]({'secret':![]})[_0x5317('0x1e')](function(_0x13c63d){if(_0x13c63d[_0x5317('0x61')]){var _0xbcac3b=path[_0x5317('0x55')](_0x276f85,_0x13c63d['Attachment'][_0x5317('0x6e')]);if(fs[_0x5317('0x6f')](_0xbcac3b)){fs[_0x5317('0x70')](_0xbcac3b)['pipe'](fs[_0x5317('0x71')](path[_0x5317('0x55')](_0x5b83e8,_0x13c63d['Attachment'][_0x5317('0x6e')])));}}return{'date':moment(_0x13c63d[_0x5317('0x63')])[_0x5317('0x6d')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5317('0x54')](),'sender':_0x13c63d[_0x5317('0x64')]===_0x5317('0x72')?_0x13c63d['User']?_0x13c63d['User']['fullname']:_0x5317('0x73'):_0x13c63d[_0x5317('0x5f')][_0x5317('0x74')]+(_0x13c63d['Contact'][_0x5317('0x60')]?'\x20'+_0x13c63d[_0x5317('0x5f')][_0x5317('0x60')]:''),'body':_0x13c63d['Attachment']?_0x13c63d[_0x5317('0x61')][_0x5317('0x6e')]:_0x13c63d[_0x5317('0x37')],'direction':_0x13c63d[_0x5317('0x64')]===_0x5317('0x72')?'A':'C','secret':_0x13c63d[_0x5317('0x65')],'read':_0x13c63d[_0x5317('0x66')],'attachment':_0x13c63d[_0x5317('0x61')]};})['value']()};return ejs['renderFile'](path[_0x5317('0x55')](config[_0x5317('0x56')],_0x5317('0x57'),_0x5317('0x75'),_0x5317('0x76')),{'interaction':_0x1cfe6b})[_0x5317('0x18')](function(_0x1060e2){var _0x1bc246=path[_0x5317('0x55')](_0x5b83e8,_0x5317('0x77')+_0x20b0c2['id']+'-'+_0x2dd494+_0x5317('0x78'));var _0x2fa1ec={'path':_0x1bc246,'channel':_0x5317('0x6b'),'interactionId':_0x20b0c2['id']};return pdf[_0x5317('0x79')](_0x1060e2,_0x2fa1ec);})[_0x5317('0x18')](function(){return new Promise(function(_0x4012e3,_0x2fab4e){zipdir(_0x5b83e8,{'saveTo':_0x3a4c7b},function(_0x5481e1,_0x49a067){if(_0x5481e1)return _0x2fab4e(_0x5481e1);return _0x4012e3(_0x49a067);});})[_0x5317('0x18')](function(){return new Promise(function(_0x3a87fa,_0x405e5b){rimraf(_0x5b83e8,function(_0x4818c6){if(_0x4818c6)_0x405e5b(_0x4818c6);return _0x3a87fa();});});})[_0x5317('0x18')](function(){return _0x55d40b[_0x5317('0x52')](_0x3a4c7b,_0x2e8049,function(_0xfcfbaf){if(_0xfcfbaf){logger[_0x5317('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0xfcfbaf);}else{fs['unlinkSync'](_0x3a4c7b);}});});});}else{return _0x55d40b[_0x5317('0x7a')](0xc8);}})[_0x5317('0x27')](handleError(_0x55d40b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index dcfff7e..882bf42 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 _0x7f84=['Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','then','setDataValue'];(function(_0xc1d2ea,_0x4e719d){var _0x5f2388=function(_0xc86808){while(--_0xc86808){_0xc1d2ea['push'](_0xc1d2ea['shift']());}};_0x5f2388(++_0x4e719d);}(_0x7f84,0x128));var _0x47f8=function(_0x3c161f,_0x1accc1){_0x3c161f=_0x3c161f-0x0;var _0x46ec04=_0x7f84[_0x3c161f];return _0x46ec04;};'use strict';var EventEmitter=require(_0x47f8('0x0'));var OpenchannelInteraction=require(_0x47f8('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x47f8('0x1'))['db'][_0x47f8('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x47f8('0x3')](0x0);var events={'afterCreate':_0x47f8('0x4'),'afterUpdate':'update','afterDestroy':_0x47f8('0x5')};function emitEvent(_0x394066){return function(_0x548af5,_0x16ea4e,_0x2eeefd){_0x548af5['getUsers']({'attributes':['id'],'raw':!![]})[_0x47f8('0x6')](function(_0x4fbd80){_0x548af5[_0x47f8('0x7')](_0x47f8('0x8'),_0x4fbd80['map'](function(_0x43544b){return{'id':_0x43544b['id']};}));return OpenchannelMessage[_0x47f8('0x9')]({'where':{'OpenchannelInteractionId':_0x548af5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x47f8('0x6')](function(_0x5265b1){_0x548af5[_0x47f8('0x7')](_0x47f8('0xa'),_0x5265b1['length']);OpenchannelInteractionEvents[_0x47f8('0xb')](_0x394066+':'+_0x548af5['id'],_0x548af5);OpenchannelInteractionEvents[_0x47f8('0xb')](_0x394066,_0x548af5);_0x2eeefd(null);})[_0x47f8('0xc')](_0x2eeefd(null));};}for(var e in events){if(events[_0x47f8('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x47f8('0xe')](e,emitEvent(event));}}module[_0x47f8('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x4975=['map','unreadMessages','length','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue'];(function(_0x4befd7,_0x3497d8){var _0x582559=function(_0x2d07e0){while(--_0x2d07e0){_0x4befd7['push'](_0x4befd7['shift']());}};_0x582559(++_0x3497d8);}(_0x4975,0xc9));var _0x5497=function(_0x213caa,_0x4f6a7a){_0x213caa=_0x213caa-0x0;var _0x5a8d9b=_0x4975[_0x213caa];return _0x5a8d9b;};'use strict';var EventEmitter=require(_0x5497('0x0'));var OpenchannelInteraction=require(_0x5497('0x1'))['db'][_0x5497('0x2')];var OpenchannelMessage=require(_0x5497('0x1'))['db'][_0x5497('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5497('0x4')](0x0);var events={'afterCreate':_0x5497('0x5'),'afterUpdate':_0x5497('0x6'),'afterDestroy':'remove'};function emitEvent(_0x50ac37){return function(_0x4f457e,_0x4c3ed4,_0xf6d283){_0x4f457e[_0x5497('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2628d4){_0x4f457e[_0x5497('0x8')]('Users',_0x2628d4[_0x5497('0x9')](function(_0x386cbb){return{'id':_0x386cbb['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x4f457e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4e8d96){_0x4f457e[_0x5497('0x8')](_0x5497('0xa'),_0x4e8d96[_0x5497('0xb')]);OpenchannelInteractionEvents[_0x5497('0xc')](_0x50ac37+':'+_0x4f457e['id'],_0x4f457e);OpenchannelInteractionEvents[_0x5497('0xc')](_0x50ac37,_0x4f457e);_0xf6d283(null);})['catch'](_0xf6d283(null));};}for(var e in events){if(events[_0x5497('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x5497('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9b86f60..e9171bd 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 _0xedc4=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xedc4,0x1c9));var _0x4edc=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xedc4[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x4edc('0x0'));var util=require(_0x4edc('0x1'));var logger=require(_0x4edc('0x2'))(_0x4edc('0x3'));var moment=require(_0x4edc('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4edc('0x5'));var rimraf=require(_0x4edc('0x6'));var config=require(_0x4edc('0x7'));var attributes=require(_0x4edc('0x8'));module[_0x4edc('0x9')]=function(_0xc388a4,_0x5948bf){return _0xc388a4['define'](_0x4edc('0xa'),attributes,{'tableName':_0x4edc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4edc('0xc'),'collate':_0x4edc('0xd'),'hooks':{'beforeUpdate':function(_0x10bad0,_0x51d4ff,_0x40cb89){if(_0x10bad0[_0x4edc('0xe')]('closed')){_0x10bad0[_0x4edc('0xf')]=moment()[_0x4edc('0x10')](_0x4edc('0x11'));}_0x40cb89(null,_0x10bad0);}}});}; \ No newline at end of file +var _0x8850=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x20cf9d,_0x5666fe){var _0x7acffe=function(_0x1b4ad9){while(--_0x1b4ad9){_0x20cf9d['push'](_0x20cf9d['shift']());}};_0x7acffe(++_0x5666fe);}(_0x8850,0x8f));var _0x0885=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8850[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0885('0x0'));var util=require('util');var logger=require(_0x0885('0x1'))(_0x0885('0x2'));var moment=require(_0x0885('0x3'));var BPromise=require(_0x0885('0x4'));var rp=require(_0x0885('0x5'));var fs=require('fs');var path=require(_0x0885('0x6'));var rimraf=require(_0x0885('0x7'));var config=require(_0x0885('0x8'));var attributes=require(_0x0885('0x9'));module[_0x0885('0xa')]=function(_0x1aa41d,_0x4e6e5e){return _0x1aa41d['define'](_0x0885('0xb'),attributes,{'tableName':_0x0885('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0885('0xd'),'collate':_0x0885('0xe'),'hooks':{'beforeUpdate':function(_0x49371e,_0x35ef0e,_0x43ab8d){if(_0x49371e['changed'](_0x0885('0xf'))){_0x49371e['closedAt']=moment()[_0x0885('0x10')](_0x0885('0x11'));}_0x43ab8d(null,_0x49371e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4ec56cc..f55619f 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 _0xda13=['bluebird','ioredis','../../config/logger','jayson/promise','client','redis','socket.io-emitter','./openchannelInteraction.socket','register','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','OpenchannelInteraction','update','body','options','where','attributes','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','omit','AddTags','lodash','moment'];(function(_0x386710,_0x490427){var _0x5df359=function(_0x5d9df4){while(--_0x5d9df4){_0x386710['push'](_0x386710['shift']());}};_0x5df359(++_0x490427);}(_0xda13,0xd7));var _0x3da1=function(_0x4459b8,_0x3271b8){_0x4459b8=_0x4459b8-0x0;var _0x4a4b07=_0xda13[_0x4459b8];return _0x4a4b07;};'use strict';var _=require(_0x3da1('0x0'));var util=require('util');var moment=require(_0x3da1('0x1'));var BPromise=require(_0x3da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3da1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3da1('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3da1('0x5'));var client=jayson[_0x3da1('0x6')]['http']({'port':0x232a});config[_0x3da1('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3da1('0x8'))(new Redis(config[_0x3da1('0x7')]));require(_0x3da1('0x9'))[_0x3da1('0xa')](socket);function respondWithRpcPromise(_0x6b41f,_0x4f4be4,_0x3b0787){return new BPromise(function(_0x1d3f8c,_0x549249){return client['request'](_0x6b41f,_0x3b0787)['then'](function(_0x23b892){logger['info'](_0x3da1('0xb'),_0x4f4be4,_0x3da1('0xc'));logger[_0x3da1('0xd')](_0x3da1('0xe'),_0x4f4be4,_0x3da1('0xc'),JSON[_0x3da1('0xf')](_0x23b892));if(_0x23b892[_0x3da1('0x10')]){if(_0x23b892[_0x3da1('0x10')]['code']===0x1f4){logger[_0x3da1('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x23b892[_0x3da1('0x10')][_0x3da1('0x11')]);return _0x549249(_0x23b892[_0x3da1('0x10')][_0x3da1('0x11')]);}logger[_0x3da1('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x23b892[_0x3da1('0x10')]['message']);return _0x1d3f8c(_0x23b892['error'][_0x3da1('0x11')]);}else{logger[_0x3da1('0x12')](_0x3da1('0xb'),_0x4f4be4,_0x3da1('0xc'));_0x1d3f8c(_0x23b892['result'][_0x3da1('0x11')]);}})['catch'](function(_0x191b45){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4f4be4,_0x191b45);_0x549249(_0x191b45);});});}exports['UpdateOpenchannelInteraction']=function(_0x153742){var _0xb6fe07=this;return new Promise(function(_0x2f5056,_0x345a55){return db[_0x3da1('0x13')][_0x3da1('0x14')](_0x153742[_0x3da1('0x15')],{'raw':_0x153742[_0x3da1('0x16')]?_0x153742[_0x3da1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153742['options']?_0x153742[_0x3da1('0x16')][_0x3da1('0x17')]||null:null,'attributes':_0x153742['options']?_0x153742[_0x3da1('0x16')][_0x3da1('0x18')]||null:null,'limit':_0x153742[_0x3da1('0x16')]?_0x153742[_0x3da1('0x16')]['limit']||null:null})[_0x3da1('0x19')](function(_0x35d6a5){logger['info'](_0x3da1('0x1a'),_0x153742);logger['debug'](_0x3da1('0x1a'),_0x153742,JSON[_0x3da1('0xf')](_0x35d6a5));_0x2f5056(_0x35d6a5);})[_0x3da1('0x1b')](function(_0x2eb294){logger[_0x3da1('0x10')]('UpdateOpenchannelInteraction',_0x2eb294[_0x3da1('0x11')],_0x153742);_0x345a55(_0xb6fe07['error'](0x1f4,_0x2eb294[_0x3da1('0x11')]));});});};exports[_0x3da1('0x1c')]=function(_0x5b31c0){return new Promise(function(_0x4082c3,_0x54e9f0){return db[_0x3da1('0x13')]['find']({'where':_0x5b31c0[_0x3da1('0x16')]?_0x5b31c0[_0x3da1('0x16')][_0x3da1('0x17')]||null:null})[_0x3da1('0x19')](function(_0x3841d4){if(_0x3841d4){return _0x3841d4['addTags'](_0x5b31c0[_0x3da1('0x15')]['ids'],_[_0x3da1('0x1d')](_0x5b31c0['body'],['ids','id'])||{});}})['spread'](function(_0x159b84){logger[_0x3da1('0x12')]('AddTags',_0x5b31c0);logger['debug'](_0x3da1('0x1e'),_0x5b31c0,JSON[_0x3da1('0xf')](_0x159b84));_0x4082c3(_0x159b84);})[_0x3da1('0x1b')](function(_0x5443c1){logger[_0x3da1('0x10')](_0x3da1('0x1e'),_0x5443c1[_0x3da1('0x11')],_0x5b31c0);_0x54e9f0(_this[_0x3da1('0x10')](0x1f4,_0x5443c1[_0x3da1('0x11')]));});});}; \ No newline at end of file +var _0xe5f8=['addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xe5f8,0xeb));var _0x8e5f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe5f8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x8e5f('0x0'));var util=require(_0x8e5f('0x1'));var moment=require(_0x8e5f('0x2'));var BPromise=require(_0x8e5f('0x3'));var rs=require(_0x8e5f('0x4'));var fs=require('fs');var Redis=require(_0x8e5f('0x5'));var db=require(_0x8e5f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e5f('0x7'))(_0x8e5f('0x8'));var config=require(_0x8e5f('0x9'));var jayson=require(_0x8e5f('0xa'));var client=jayson[_0x8e5f('0xb')][_0x8e5f('0xc')]({'port':0x232a});config[_0x8e5f('0xd')]=_[_0x8e5f('0xe')](config['redis'],{'host':_0x8e5f('0xf'),'port':0x18eb});var socket=require(_0x8e5f('0x10'))(new Redis(config[_0x8e5f('0xd')]));require(_0x8e5f('0x11'))[_0x8e5f('0x12')](socket);function respondWithRpcPromise(_0x1a7abd,_0x487a69,_0x39d709){return new BPromise(function(_0x425842,_0x5cdd75){return client['request'](_0x1a7abd,_0x39d709)[_0x8e5f('0x13')](function(_0x5d3920){logger[_0x8e5f('0x14')](_0x8e5f('0x15'),_0x487a69,_0x8e5f('0x16'));logger['debug'](_0x8e5f('0x17'),_0x487a69,_0x8e5f('0x16'),JSON[_0x8e5f('0x18')](_0x5d3920));if(_0x5d3920[_0x8e5f('0x19')]){if(_0x5d3920[_0x8e5f('0x19')][_0x8e5f('0x1a')]===0x1f4){logger['error'](_0x8e5f('0x15'),_0x487a69,_0x5d3920[_0x8e5f('0x19')][_0x8e5f('0x1b')]);return _0x5cdd75(_0x5d3920[_0x8e5f('0x19')]['message']);}logger['error'](_0x8e5f('0x15'),_0x487a69,_0x5d3920[_0x8e5f('0x19')][_0x8e5f('0x1b')]);return _0x425842(_0x5d3920[_0x8e5f('0x19')][_0x8e5f('0x1b')]);}else{logger[_0x8e5f('0x14')](_0x8e5f('0x15'),_0x487a69,'request\x20sent');_0x425842(_0x5d3920[_0x8e5f('0x1c')][_0x8e5f('0x1b')]);}})[_0x8e5f('0x1d')](function(_0x5ecb41){logger[_0x8e5f('0x19')](_0x8e5f('0x15'),_0x487a69,_0x5ecb41);_0x5cdd75(_0x5ecb41);});});}exports['UpdateOpenchannelInteraction']=function(_0x3bb856){var _0x1a51a4=this;return new Promise(function(_0x2c9c87,_0x63c03c){return db['OpenchannelInteraction']['update'](_0x3bb856[_0x8e5f('0x1e')],{'raw':_0x3bb856[_0x8e5f('0x1f')]?_0x3bb856[_0x8e5f('0x1f')][_0x8e5f('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3bb856[_0x8e5f('0x1f')]?_0x3bb856[_0x8e5f('0x1f')]['where']||null:null,'attributes':_0x3bb856[_0x8e5f('0x1f')]?_0x3bb856[_0x8e5f('0x1f')][_0x8e5f('0x21')]||null:null,'limit':_0x3bb856[_0x8e5f('0x1f')]?_0x3bb856['options'][_0x8e5f('0x22')]||null:null})[_0x8e5f('0x13')](function(_0x199df3){logger[_0x8e5f('0x14')](_0x8e5f('0x23'),_0x3bb856);logger[_0x8e5f('0x24')](_0x8e5f('0x23'),_0x3bb856,JSON[_0x8e5f('0x18')](_0x199df3));_0x2c9c87(_0x199df3);})[_0x8e5f('0x1d')](function(_0x2574ea){logger[_0x8e5f('0x19')]('UpdateOpenchannelInteraction',_0x2574ea['message'],_0x3bb856);_0x63c03c(_0x1a51a4['error'](0x1f4,_0x2574ea[_0x8e5f('0x1b')]));});});};exports[_0x8e5f('0x25')]=function(_0x38327c){return new Promise(function(_0x3fdc5e,_0x3a1649){return db[_0x8e5f('0x26')][_0x8e5f('0x27')]({'where':_0x38327c['options']?_0x38327c[_0x8e5f('0x1f')][_0x8e5f('0x28')]||null:null})[_0x8e5f('0x13')](function(_0x24f78f){if(_0x24f78f){return _0x24f78f[_0x8e5f('0x29')](_0x38327c[_0x8e5f('0x1e')][_0x8e5f('0x2a')],_[_0x8e5f('0x2b')](_0x38327c[_0x8e5f('0x1e')],[_0x8e5f('0x2a'),'id'])||{});}})[_0x8e5f('0x2c')](function(_0x54ce9e){logger['info'](_0x8e5f('0x2d'),_0x38327c);logger[_0x8e5f('0x24')](_0x8e5f('0x2d'),_0x38327c,JSON[_0x8e5f('0x18')](_0x54ce9e));_0x3fdc5e(_0x54ce9e);})[_0x8e5f('0x1d')](function(_0x107f45){logger[_0x8e5f('0x19')](_0x8e5f('0x2d'),_0x107f45[_0x8e5f('0x1b')],_0x38327c);_0x3a1649(_this[_0x8e5f('0x19')](0x1f4,_0x107f45['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index b8b2d3f..00676df 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 _0x549f=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','removeListener','register'];(function(_0x43aea5,_0x2eca2d){var _0x433040=function(_0x3a2d6e){while(--_0x3a2d6e){_0x43aea5['push'](_0x43aea5['shift']());}};_0x433040(++_0x2eca2d);}(_0x549f,0xaa));var _0xf549=function(_0x143ee4,_0x1fd2ec){_0x143ee4=_0x143ee4-0x0;var _0x23f17f=_0x549f[_0x143ee4];return _0x23f17f;};'use strict';var OpenchannelInteractionEvents=require(_0xf549('0x0'));var events=[_0xf549('0x1'),_0xf549('0x2'),'update'];function createListener(_0x3e0521,_0x52f838){return function(_0x15a7d0){_0x52f838['emit'](_0x3e0521,_0x15a7d0);};}function removeListener(_0x3f31e9,_0x511417){return function(){OpenchannelInteractionEvents[_0xf549('0x3')](_0x3f31e9,_0x511417);};}exports[_0xf549('0x4')]=function(_0x424e5b){for(var _0x3345bf=0x0,_0x22df60=events[_0xf549('0x5')];_0x3345bf<_0x22df60;_0x3345bf++){var _0x2a2776=events[_0x3345bf];var _0x194822=createListener(_0xf549('0x6')+_0x2a2776,_0x424e5b);OpenchannelInteractionEvents['on'](_0x2a2776,_0x194822);}}; \ No newline at end of file +var _0x10db=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x10db,0x191));var _0xb10d=function(_0x341ae9,_0x178da2){_0x341ae9=_0x341ae9-0x0;var _0x1b225d=_0x10db[_0x341ae9];return _0x1b225d;};'use strict';var OpenchannelInteractionEvents=require(_0xb10d('0x0'));var events=[_0xb10d('0x1'),_0xb10d('0x2'),_0xb10d('0x3')];function createListener(_0x18d746,_0x272fd8){return function(_0x551b96){_0x272fd8[_0xb10d('0x4')](_0x18d746,_0x551b96);};}function removeListener(_0x5b32f0,_0x11214b){return function(){OpenchannelInteractionEvents[_0xb10d('0x5')](_0x5b32f0,_0x11214b);};}exports['register']=function(_0x3c898a){for(var _0x273fd0=0x0,_0x701304=events[_0xb10d('0x6')];_0x273fd0<_0x701304;_0x273fd0++){var _0x547fb8=events[_0x273fd0];var _0x930529=createListener(_0xb10d('0x7')+_0x547fb8,_0x3c898a);OpenchannelInteractionEvents['on'](_0x547fb8,_0x930529);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index b01aee5..662946f 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x53e26e,_0x4a5f9c){var _0xf87fd2=function(_0x1d5bdb){while(--_0x1d5bdb){_0x53e26e['push'](_0x53e26e['shift']());}};_0xf87fd2(++_0x4a5f9c);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x211a98,_0x113b58){var _0x5dcb64=function(_0x521db8){while(--_0x521db8){_0x211a98['push'](_0x211a98['shift']());}};_0x5dcb64(++_0x113b58);}(_0x9c44,0x178));var _0x49c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c44[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 1435176..253ee73 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 _0x30fc=['TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x30fc,0x64));var _0xc30f=function(_0x16fe01,_0x5039e1){_0x16fe01=_0x16fe01-0x0;var _0x56c48a=_0x30fc[_0x16fe01];return _0x56c48a;};'use strict';var Sequelize=require(_0xc30f('0x0'));module[_0xc30f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc30f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc30f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc30f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc30f('0x4')]('in','out'),'defaultValue':_0xc30f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc30f('0x6')]},'providerName':{'type':Sequelize[_0xc30f('0x7')]},'providerResponse':{'type':Sequelize[_0xc30f('0x8')]}}; \ No newline at end of file +var _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x49d3e5,_0x186250){var _0x23811e=function(_0x383441){while(--_0x383441){_0x49d3e5['push'](_0x49d3e5['shift']());}};_0x23811e(++_0x186250);}(_0x97db,0x1b4));var _0xb97d=function(_0x8ea456,_0x54a98f){_0x8ea456=_0x8ea456-0x0;var _0x4c1625=_0x97db[_0x8ea456];return _0x4c1625;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index c54d90a..21d9fbe 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 _0x5e8d=['openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','event','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','include','find','create','body','update','describe','openchannel-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage'];(function(_0x53ee43,_0x2a63ec){var _0x58b2ca=function(_0x35e8a0){while(--_0x35e8a0){_0x53ee43['push'](_0x53ee43['shift']());}};_0x58b2ca(++_0x2a63ec);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x1ff090,_0x574ab0){_0x1ff090=_0x1ff090-0x0;var _0x5d665c=_0x5e8d[_0x1ff090];return _0x5d665c;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];config[_0xd5e8('0x1a')]=_[_0xd5e8('0x1b')](config[_0xd5e8('0x1a')],{'host':_0xd5e8('0x1c'),'port':0x18eb});var socket=require(_0xd5e8('0x1d'))(new Redis(config['redis']));require('./openchannelMessage.socket')[_0xd5e8('0x1e')](socket);var jayson=require(_0xd5e8('0x1f'));var client=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232c});var client9002=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x489a8e,_0x2ef357,_0x18c61f,_0x282ce2){return new BPromise(function(_0x2dfd4a,_0x5dc327){var _0x3daf6a=_0x282ce2||client;return _0x3daf6a[_0xd5e8('0x22')](_0x489a8e,_0x18c61f)['then'](function(_0x4b89e9){logger[_0xd5e8('0x23')](_0xd5e8('0x24'),_0x2ef357,_0xd5e8('0x25'));logger[_0xd5e8('0x26')](_0xd5e8('0x27'),_0x2ef357,_0xd5e8('0x25'),JSON[_0xd5e8('0x28')](_0x4b89e9));if(_0x4b89e9['error']){if(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2a')]===0x1f4){logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x5dc327(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);}logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x2dfd4a(_0x4b89e9[_0xd5e8('0x29')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2ef357,'request\x20sent');_0x2dfd4a(_0x4b89e9[_0xd5e8('0x2c')]['message']);}})[_0xd5e8('0x2d')](function(_0x3b1a69){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x2ef357,_0x3b1a69);_0x5dc327(_0x3b1a69);});});}function respondWithStatusCode(_0x29d415,_0xfaad96){_0xfaad96=_0xfaad96||0xcc;return function(_0x2e220b){if(_0x2e220b){return _0x29d415[_0xd5e8('0x2e')](_0xfaad96);}return _0x29d415[_0xd5e8('0x2f')](_0xfaad96)[_0xd5e8('0x30')]();};}function respondWithResult(_0x3cb0ea,_0x2b7244){_0x2b7244=_0x2b7244||0xc8;return function(_0x45bf59){if(_0x45bf59){return _0x3cb0ea['status'](_0x2b7244)[_0xd5e8('0x31')](_0x45bf59);}};}function respondWithFilteredResult(_0x570e6a,_0x2aa786){return function(_0x24f7e1){if(_0x24f7e1){var _0x38414b=typeof _0x2aa786[_0xd5e8('0x32')]===_0xd5e8('0x33')&&typeof _0x2aa786['limit']===_0xd5e8('0x33');var _0x3d2e7b=_0x24f7e1['count'];var _0x315955=_0x38414b?0x0:_0x2aa786['offset'];var _0x3980a1=_0x38414b?_0x24f7e1[_0xd5e8('0x34')]:_0x2aa786[_0xd5e8('0x32')]+_0x2aa786[_0xd5e8('0x35')];var _0x14d8c6;if(_0x3980a1>=_0x3d2e7b){_0x3980a1=_0x3d2e7b;_0x14d8c6=0xc8;}else{_0x14d8c6=0xce;}_0x570e6a[_0xd5e8('0x2f')](_0x14d8c6);return _0x570e6a[_0xd5e8('0x36')](_0xd5e8('0x37'),_0x315955+'-'+_0x3980a1+'/'+_0x3d2e7b)['json'](_0x24f7e1);}return null;};}function patchUpdates(_0x40ab71){return function(_0x3ff7f5){try{jsonpatch[_0xd5e8('0x38')](_0x3ff7f5,_0x40ab71,!![]);}catch(_0x22a9c1){return BPromise[_0xd5e8('0x39')](_0x22a9c1);}return _0x3ff7f5[_0xd5e8('0x3a')]();};}function saveUpdates(_0x3ee3bb,_0xde1d49){return function(_0x5c086d){if(_0x5c086d){return _0x5c086d['update'](_0x3ee3bb)['then'](function(_0x306593){return _0x306593;});}return null;};}function removeEntity(_0x3c4e8c,_0x429921){return function(_0x1508ee){if(_0x1508ee){return _0x1508ee[_0xd5e8('0x3b')]()[_0xd5e8('0x3c')](function(){_0x3c4e8c[_0xd5e8('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56fb62,_0xc1fe5f){return function(_0x256812){if(!_0x256812){_0x56fb62[_0xd5e8('0x2e')](0x194);}return _0x256812;};}function handleError(_0x2f00b4,_0x216a82){_0x216a82=_0x216a82||0x1f4;return function(_0x37b5c5){logger[_0xd5e8('0x29')](_0x37b5c5[_0xd5e8('0x3d')]);if(_0x37b5c5[_0xd5e8('0x3e')]){delete _0x37b5c5[_0xd5e8('0x3e')];}_0x2f00b4[_0xd5e8('0x2f')](_0x216a82)['send'](_0x37b5c5);};}exports[_0xd5e8('0x3f')]=function(_0x569f00,_0x2e469a){var _0x561717={},_0x1e3182={},_0x53531d={'count':0x0,'rows':[]};var _0x1a7f59=_[_0xd5e8('0x40')](db[_0xd5e8('0x41')][_0xd5e8('0x42')],function(_0x39655c){return{'name':_0x39655c[_0xd5e8('0x43')],'type':_0x39655c['type']['key']};});_0x1e3182[_0xd5e8('0x44')]=_[_0xd5e8('0x40')](_0x1a7f59,'name');_0x1e3182['query']=_[_0xd5e8('0x45')](_0x569f00[_0xd5e8('0x46')]);_0x1e3182[_0xd5e8('0x47')]=_[_0xd5e8('0x48')](_0x1e3182[_0xd5e8('0x44')],_0x1e3182[_0xd5e8('0x46')]);_0x561717['attributes']=_['intersection'](_0x1e3182[_0xd5e8('0x44')],qs[_0xd5e8('0x49')](_0x569f00['query'][_0xd5e8('0x49')]));_0x561717[_0xd5e8('0x4a')]=_0x561717[_0xd5e8('0x4a')][_0xd5e8('0x4b')]?_0x561717[_0xd5e8('0x4a')]:_0x1e3182[_0xd5e8('0x44')];if(!_0x569f00['query'][_0xd5e8('0x4c')](_0xd5e8('0x4d'))){_0x561717['limit']=qs['limit'](_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x35')]);_0x561717[_0xd5e8('0x32')]=qs['offset'](_0x569f00['query'][_0xd5e8('0x32')]);}_0x561717[_0xd5e8('0x4e')]=qs['sort'](_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x4f')]);_0x561717[_0xd5e8('0x50')]=qs[_0xd5e8('0x47')](_[_0xd5e8('0x51')](_0x569f00[_0xd5e8('0x46')],_0x1e3182[_0xd5e8('0x47')]),_0x1a7f59);if(_0x569f00['query'][_0xd5e8('0x52')]){_0x561717[_0xd5e8('0x50')]=_[_0xd5e8('0x53')](_0x561717[_0xd5e8('0x50')],{'$or':_[_0xd5e8('0x40')](_0x1a7f59,function(_0x460943){if(_0x460943[_0xd5e8('0x54')]!==_0xd5e8('0x55')){var _0x58e0d2={};_0x58e0d2[_0x460943[_0xd5e8('0x3e')]]={'$like':'%'+_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x52')]+'%'};return _0x58e0d2;}})});}_0x561717=_[_0xd5e8('0x53')]({},_0x561717,_0x569f00[_0xd5e8('0x56')]);var _0x4db32f={'where':_0x561717[_0xd5e8('0x50')]};return db[_0xd5e8('0x41')][_0xd5e8('0x34')](_0x4db32f)[_0xd5e8('0x3c')](function(_0x5c8de6){_0x53531d[_0xd5e8('0x34')]=_0x5c8de6;if(_0x569f00[_0xd5e8('0x46')][_0xd5e8('0x57')]){_0x561717['include']=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x561717);})['then'](function(_0x234529){_0x53531d[_0xd5e8('0x58')]=_0x234529;return _0x53531d;})[_0xd5e8('0x3c')](respondWithFilteredResult(_0x2e469a,_0x561717))['catch'](handleError(_0x2e469a,null));};exports[_0xd5e8('0x59')]=function(_0x19b810,_0x5a99b2){var _0x565cdd={'raw':!![],'where':{'id':_0x19b810[_0xd5e8('0x5a')]['id']}},_0x4a35ca={};_0x4a35ca[_0xd5e8('0x44')]=_[_0xd5e8('0x45')](db[_0xd5e8('0x41')]['rawAttributes']);_0x4a35ca[_0xd5e8('0x46')]=_[_0xd5e8('0x45')](_0x19b810[_0xd5e8('0x46')]);_0x4a35ca[_0xd5e8('0x47')]=_[_0xd5e8('0x48')](_0x4a35ca[_0xd5e8('0x44')],_0x4a35ca[_0xd5e8('0x46')]);_0x565cdd['attributes']=_[_0xd5e8('0x48')](_0x4a35ca[_0xd5e8('0x44')],qs['fields'](_0x19b810[_0xd5e8('0x46')][_0xd5e8('0x49')]));_0x565cdd['attributes']=_0x565cdd[_0xd5e8('0x4a')]['length']?_0x565cdd[_0xd5e8('0x4a')]:_0x4a35ca[_0xd5e8('0x44')];if(_0x19b810['query']['includeAll']){_0x565cdd[_0xd5e8('0x5b')]=[{'all':!![]}];}_0x565cdd=_[_0xd5e8('0x53')]({},_0x565cdd,_0x19b810['options']);return db[_0xd5e8('0x41')][_0xd5e8('0x5c')](_0x565cdd)['then'](handleEntityNotFound(_0x5a99b2,null))[_0xd5e8('0x3c')](respondWithResult(_0x5a99b2,null))[_0xd5e8('0x2d')](handleError(_0x5a99b2,null));};exports[_0xd5e8('0x5d')]=function(_0x24f57c,_0x29a8ec){return db['OpenchannelMessage']['create'](_0x24f57c[_0xd5e8('0x5e')],{})[_0xd5e8('0x3c')](respondWithResult(_0x29a8ec,0xc9))[_0xd5e8('0x2d')](handleError(_0x29a8ec,null));};exports[_0xd5e8('0x5f')]=function(_0xc07558,_0x4eb31d){if(_0xc07558['body']['id']){delete _0xc07558[_0xd5e8('0x5e')]['id'];}return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0xc07558[_0xd5e8('0x5a')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x4eb31d,null))[_0xd5e8('0x3c')](saveUpdates(_0xc07558['body'],null))[_0xd5e8('0x3c')](respondWithResult(_0x4eb31d,null))[_0xd5e8('0x2d')](handleError(_0x4eb31d,null));};exports[_0xd5e8('0x3b')]=function(_0x4017a3,_0x1d4fee){return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x4017a3[_0xd5e8('0x5a')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x1d4fee,null))[_0xd5e8('0x3c')](removeEntity(_0x1d4fee,null))[_0xd5e8('0x2d')](handleError(_0x1d4fee,null));};exports['describe']=function(_0x1fe64d,_0x26c26f){return db[_0xd5e8('0x41')][_0xd5e8('0x60')]()['then'](respondWithResult(_0x26c26f,null))[_0xd5e8('0x2d')](handleError(_0x26c26f,null));};var interaction_log=require('../../config/logger')(_0xd5e8('0x61'));exports[_0xd5e8('0x62')]=function(_0x4ce82c,_0x594835,_0x4d98ac){var _0x13549b={'agent':{},'channel':'openchannel'};if(_0x4ce82c[_0xd5e8('0x5e')]['id']){delete _0x4ce82c[_0xd5e8('0x5e')]['id'];}_0x4ce82c['body']['read']=!![];_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x63')]=moment()[_0xd5e8('0x64')](_0xd5e8('0x65'));_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')]=_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')]||_0x4ce82c['user']['id'];_0x13549b[_0xd5e8('0x67')]['id']=_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')];return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x4ce82c[_0xd5e8('0x5a')]['id'],'UserId':null}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x594835,null))['then'](saveUpdates(_0x4ce82c[_0xd5e8('0x5e')],null))[_0xd5e8('0x3c')](function(_0x5b7d35){if(_0x5b7d35){_0x13549b[_0xd5e8('0x2b')]=_0x5b7d35[_0xd5e8('0x68')]({'plain':!![]});return db[_0xd5e8('0x69')][_0xd5e8('0x5c')]({'where':{'id':_0x5b7d35[_0xd5e8('0x6a')]}});}return null;})[_0xd5e8('0x3c')](handleEntityNotFound(_0x594835,null))[_0xd5e8('0x3c')](function(_0x4d94c4){if(_0x4d94c4){return _0x4d94c4[_0xd5e8('0x5f')]({'UserId':_0x4ce82c[_0xd5e8('0x5e')]['UserId'],'read1stAt':_[_0xd5e8('0x6b')](_0x4d94c4[_0xd5e8('0x6c')])?moment()[_0xd5e8('0x64')](_0xd5e8('0x65')):undefined});}return null;})['then'](function(_0x297fa6){if(_0x297fa6){_0x13549b[_0xd5e8('0x6d')]=_0x297fa6[_0xd5e8('0x68')]({'plain':!![]});interaction_log[_0xd5e8('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4ce82c[_0xd5e8('0x6e')]['id'],_0x4ce82c['user'][_0xd5e8('0x3e')],_0x4ce82c[_0xd5e8('0x6e')][_0xd5e8('0x6f')],_0x13549b[_0xd5e8('0x6d')]['id'],_0x4ce82c['body']?JSON['stringify'](_0x4ce82c[_0xd5e8('0x5e')]):_0xd5e8('0x70'));return respondWithRpcPromise(_0xd5e8('0x71'),'acceptMessage',_0x13549b);}return null;})[_0xd5e8('0x3c')](function(_0xea8dba){var _0x2fb610='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xea8dba['message'][_0xd5e8('0x72')];return db['sequelize'][_0xd5e8('0x46')](_0x2fb610,{'type':db[_0xd5e8('0x73')][_0xd5e8('0x74')][_0xd5e8('0x75')],'raw':!![]})[_0xd5e8('0x3c')](function(_0x80530f){return _0x80530f;});})['then'](function(_0x21bceb){if(_0x21bceb){_0x13549b[_0xd5e8('0x2b')]['contact']=_0x21bceb[0x0];if(!_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')])return;return db[_0xd5e8('0x76')][_0xd5e8('0x5c')]({'where':{'id':_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x66')],'role':'agent'},'attributes':['id',_0xd5e8('0x3e'),_0xd5e8('0x77'),_0xd5e8('0x78'),_0xd5e8('0x79')],'raw':!![]});}return null;})[_0xd5e8('0x3c')](function(_0x42ce26){if(!_0x42ce26)return null;_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x67')]=_0x42ce26;return _0x13549b;})[_0xd5e8('0x3c')](function(_0x2af521){if(_0x2af521){if(_0x4ce82c[_0xd5e8('0x5e')][_0xd5e8('0x7a')]){_0x13549b['message'][_0xd5e8('0x7b')]=util[_0xd5e8('0x64')](_0xd5e8('0x7c'),_0x4ce82c[_0xd5e8('0x6e')][_0xd5e8('0x3e')]);_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x7d')]=_0x13549b[_0xd5e8('0x7d')];_0x13549b[_0xd5e8('0x2b')][_0xd5e8('0x7e')]=_0x13549b['channel'];_0x13549b[_0xd5e8('0x2b')]['event']=_0xd5e8('0x62');return respondWithRpcPromise(_0xd5e8('0x7f'),_0xd5e8('0x7f'),{'event':_0xd5e8('0x80'),'message':_0x13549b[_0xd5e8('0x2b')]},client9002)['then'](function(){return _0x13549b;});}return _0x13549b;}return null;})[_0xd5e8('0x3c')](respondWithResult(_0x594835,null))[_0xd5e8('0x2d')](handleError(_0x594835,null));};var interaction_log=require(_0xd5e8('0x15'))(_0xd5e8('0x61'));exports[_0xd5e8('0x39')]=function(_0x2592bd,_0xf6835d,_0x2764ee){var _0x1b69d4={'agent':{},'channel':_0xd5e8('0x81')};if(_0x2592bd[_0xd5e8('0x5e')]['id']){delete _0x2592bd[_0xd5e8('0x5e')]['id'];}_0x2592bd['body'][_0xd5e8('0x66')]=_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')]||_0x2592bd[_0xd5e8('0x6e')]['id'];_0x1b69d4[_0xd5e8('0x67')]['id']=_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')];return db[_0xd5e8('0x41')][_0xd5e8('0x5c')]({'where':{'id':_0x2592bd['params']['id'],'UserId':null}})[_0xd5e8('0x3c')](handleEntityNotFound(_0xf6835d,null))[_0xd5e8('0x3c')](function(_0x5c20bd){if(_0x5c20bd){_0x1b69d4[_0xd5e8('0x2b')]=_0x5c20bd['get']({'plain':!![]});return db[_0xd5e8('0x69')][_0xd5e8('0x5c')]({'where':{'id':_0x5c20bd[_0xd5e8('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0xf6835d,null))[_0xd5e8('0x3c')](function(_0x55bcc5){if(_0x55bcc5){_0x1b69d4[_0xd5e8('0x6d')]=_0x55bcc5[_0xd5e8('0x68')]({'plain':!![]});interaction_log[_0xd5e8('0x23')](_0xd5e8('0x82'),_0x2592bd[_0xd5e8('0x6e')]['id'],_0x2592bd[_0xd5e8('0x6e')]['name'],_0x2592bd[_0xd5e8('0x6e')][_0xd5e8('0x6f')],_0x1b69d4[_0xd5e8('0x6d')]['id'],_0x2592bd[_0xd5e8('0x5e')]?JSON[_0xd5e8('0x28')](_0x2592bd[_0xd5e8('0x5e')]):'null');return respondWithRpcPromise(_0xd5e8('0x83'),_0xd5e8('0x84'),_0x1b69d4);}return null;})[_0xd5e8('0x3c')](function(_0x13c7ea){var _0x3690cf=_0xd5e8('0x85')+_0x13c7ea['message'][_0xd5e8('0x72')];return db[_0xd5e8('0x86')][_0xd5e8('0x46')](_0x3690cf,{'type':db[_0xd5e8('0x73')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x598df2){return _0x598df2;});})[_0xd5e8('0x3c')](function(_0x25449f){if(_0x25449f){_0x1b69d4[_0xd5e8('0x2b')]['contact']=_0x25449f[0x0];if(!_0x2592bd['body'][_0xd5e8('0x66')])return;return db[_0xd5e8('0x76')][_0xd5e8('0x5c')]({'where':{'id':_0x2592bd[_0xd5e8('0x5e')][_0xd5e8('0x66')],'role':'agent'},'attributes':['id','name',_0xd5e8('0x77'),_0xd5e8('0x78'),_0xd5e8('0x79')],'raw':!![]});}return null;})[_0xd5e8('0x3c')](function(_0xc075a5){if(!_0xc075a5)return null;_0x1b69d4[_0xd5e8('0x2b')][_0xd5e8('0x67')]=_0xc075a5;return _0x1b69d4;})[_0xd5e8('0x3c')](function(_0x3b9b63){if(_0x3b9b63){_0x3b9b63[_0xd5e8('0x2b')][_0xd5e8('0x7b')]=util[_0xd5e8('0x64')]('SIP/%s',_0x2592bd['user']['name']);_0x3b9b63['message']['channel']=_0x1b69d4[_0xd5e8('0x7d')];_0x3b9b63[_0xd5e8('0x2b')][_0xd5e8('0x7e')]=_0x1b69d4[_0xd5e8('0x7d')];_0x3b9b63['message'][_0xd5e8('0x87')]=_0xd5e8('0x39');respondWithRpcPromise('EventManager',_0xd5e8('0x7f'),{'event':_0xd5e8('0x88'),'message':_0x3b9b63[_0xd5e8('0x2b')]},client9002);return _0x1b69d4;}return null;})[_0xd5e8('0x3c')](respondWithResult(_0xf6835d,null))[_0xd5e8('0x2d')](handleError(_0xf6835d,null));}; \ No newline at end of file +var _0xb81d=['destroy','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteraction','read1stAt','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','agent','manual','SIP/%s','channel','event','accept','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','interface','EventManager','rejectmessage','eml-format','zip-dir','moment','bluebird','mustache','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/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x24896a,_0xe04e64){var _0x38f8b=function(_0x41bcec){while(--_0x41bcec){_0x24896a['push'](_0x24896a['shift']());}};_0x38f8b(++_0xe04e64);}(_0xb81d,0x14e));var _0xdb81=function(_0x8bd907,_0x4fbe20){_0x8bd907=_0x8bd907-0x0;var _0x49ca7c=_0xb81d[_0x8bd907];return _0x49ca7c;};'use strict';var emlformat=require(_0xdb81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdb81('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdb81('0x2'));var BPromise=require(_0xdb81('0x3'));var Mustache=require(_0xdb81('0x4'));var util=require(_0xdb81('0x5'));var path=require(_0xdb81('0x6'));var sox=require(_0xdb81('0x7'));var csv=require(_0xdb81('0x8'));var ejs=require(_0xdb81('0x9'));var fs=require('fs');var fs_extra=require(_0xdb81('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdb81('0xb'));var jsforce=require(_0xdb81('0xc'));var deskjs=require(_0xdb81('0xd'));var toCsv=require(_0xdb81('0x8'));var querystring=require(_0xdb81('0xe'));var Papa=require(_0xdb81('0xf'));var Redis=require(_0xdb81('0x10'));var authService=require(_0xdb81('0x11'));var qs=require(_0xdb81('0x12'));var as=require(_0xdb81('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdb81('0x14'))(_0xdb81('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xdb81('0x16'));var db=require(_0xdb81('0x17'))['db'];config['redis']=_[_0xdb81('0x18')](config[_0xdb81('0x19')],{'host':_0xdb81('0x1a'),'port':0x18eb});var socket=require(_0xdb81('0x1b'))(new Redis(config['redis']));require(_0xdb81('0x1c'))[_0xdb81('0x1d')](socket);var jayson=require(_0xdb81('0x1e'));var client=jayson[_0xdb81('0x1f')][_0xdb81('0x20')]({'port':0x232c});var client9002=jayson[_0xdb81('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x499bc8,_0x1ed20f,_0x5b9395,_0x55e7d8){return new BPromise(function(_0x219a5d,_0x5b7dec){var _0x48d5e7=_0x55e7d8||client;return _0x48d5e7[_0xdb81('0x21')](_0x499bc8,_0x5b9395)['then'](function(_0x131df3){logger[_0xdb81('0x22')](_0xdb81('0x23'),_0x1ed20f,'request\x20sent');logger[_0xdb81('0x24')](_0xdb81('0x25'),_0x1ed20f,_0xdb81('0x26'),JSON[_0xdb81('0x27')](_0x131df3));if(_0x131df3[_0xdb81('0x28')]){if(_0x131df3[_0xdb81('0x28')][_0xdb81('0x29')]===0x1f4){logger[_0xdb81('0x28')](_0xdb81('0x23'),_0x1ed20f,_0x131df3[_0xdb81('0x28')][_0xdb81('0x2a')]);return _0x5b7dec(_0x131df3['error']['message']);}logger['error'](_0xdb81('0x23'),_0x1ed20f,_0x131df3[_0xdb81('0x28')]['message']);return _0x219a5d(_0x131df3['error'][_0xdb81('0x2a')]);}else{logger[_0xdb81('0x22')](_0xdb81('0x23'),_0x1ed20f,_0xdb81('0x26'));_0x219a5d(_0x131df3['result']['message']);}})[_0xdb81('0x2b')](function(_0x427f4d){logger[_0xdb81('0x28')](_0xdb81('0x23'),_0x1ed20f,_0x427f4d);_0x5b7dec(_0x427f4d);});});}function respondWithStatusCode(_0x750046,_0x1c11b2){_0x1c11b2=_0x1c11b2||0xcc;return function(_0x4a6eeb){if(_0x4a6eeb){return _0x750046[_0xdb81('0x2c')](_0x1c11b2);}return _0x750046['status'](_0x1c11b2)[_0xdb81('0x2d')]();};}function respondWithResult(_0x2a5d16,_0x405d6c){_0x405d6c=_0x405d6c||0xc8;return function(_0x105b0f){if(_0x105b0f){return _0x2a5d16[_0xdb81('0x2e')](_0x405d6c)[_0xdb81('0x2f')](_0x105b0f);}};}function respondWithFilteredResult(_0x4517af,_0x4430a4){return function(_0x4c8010){if(_0x4c8010){var _0xed346d=typeof _0x4430a4[_0xdb81('0x30')]===_0xdb81('0x31')&&typeof _0x4430a4[_0xdb81('0x32')]===_0xdb81('0x31');var _0x53fbbe=_0x4c8010[_0xdb81('0x33')];var _0x2d41e6=_0xed346d?0x0:_0x4430a4[_0xdb81('0x30')];var _0x15b4f1=_0xed346d?_0x4c8010[_0xdb81('0x33')]:_0x4430a4[_0xdb81('0x30')]+_0x4430a4[_0xdb81('0x32')];var _0x15f03c;if(_0x15b4f1>=_0x53fbbe){_0x15b4f1=_0x53fbbe;_0x15f03c=0xc8;}else{_0x15f03c=0xce;}_0x4517af[_0xdb81('0x2e')](_0x15f03c);return _0x4517af[_0xdb81('0x34')](_0xdb81('0x35'),_0x2d41e6+'-'+_0x15b4f1+'/'+_0x53fbbe)['json'](_0x4c8010);}return null;};}function patchUpdates(_0x12e4f3){return function(_0x4e1586){try{jsonpatch[_0xdb81('0x36')](_0x4e1586,_0x12e4f3,!![]);}catch(_0x301a27){return BPromise[_0xdb81('0x37')](_0x301a27);}return _0x4e1586[_0xdb81('0x38')]();};}function saveUpdates(_0x8ab333,_0x28759b){return function(_0x17b62c){if(_0x17b62c){return _0x17b62c[_0xdb81('0x39')](_0x8ab333)[_0xdb81('0x3a')](function(_0x141c2f){return _0x141c2f;});}return null;};}function removeEntity(_0x224fca,_0x21a868){return function(_0x4085b1){if(_0x4085b1){return _0x4085b1[_0xdb81('0x3b')]()[_0xdb81('0x3a')](function(){_0x224fca[_0xdb81('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56e12d,_0x5da7cd){return function(_0x5217c3){if(!_0x5217c3){_0x56e12d['sendStatus'](0x194);}return _0x5217c3;};}function handleError(_0x56012a,_0x2d181c){_0x2d181c=_0x2d181c||0x1f4;return function(_0x20791f){logger[_0xdb81('0x28')](_0x20791f[_0xdb81('0x3c')]);if(_0x20791f[_0xdb81('0x3d')]){delete _0x20791f['name'];}_0x56012a['status'](_0x2d181c)[_0xdb81('0x3e')](_0x20791f);};}exports[_0xdb81('0x3f')]=function(_0x22a0ce,_0x369ad7){var _0x359a47={},_0x2dfb76={},_0x45952d={'count':0x0,'rows':[]};var _0x1cbe1f=_[_0xdb81('0x40')](db[_0xdb81('0x41')][_0xdb81('0x42')],function(_0x3d8894){return{'name':_0x3d8894[_0xdb81('0x43')],'type':_0x3d8894[_0xdb81('0x44')][_0xdb81('0x45')]};});_0x2dfb76[_0xdb81('0x46')]=_['map'](_0x1cbe1f,_0xdb81('0x3d'));_0x2dfb76[_0xdb81('0x47')]=_[_0xdb81('0x48')](_0x22a0ce[_0xdb81('0x47')]);_0x2dfb76[_0xdb81('0x49')]=_[_0xdb81('0x4a')](_0x2dfb76[_0xdb81('0x46')],_0x2dfb76[_0xdb81('0x47')]);_0x359a47['attributes']=_[_0xdb81('0x4a')](_0x2dfb76[_0xdb81('0x46')],qs[_0xdb81('0x4b')](_0x22a0ce['query'][_0xdb81('0x4b')]));_0x359a47[_0xdb81('0x4c')]=_0x359a47['attributes'][_0xdb81('0x4d')]?_0x359a47[_0xdb81('0x4c')]:_0x2dfb76['model'];if(!_0x22a0ce[_0xdb81('0x47')][_0xdb81('0x4e')](_0xdb81('0x4f'))){_0x359a47[_0xdb81('0x32')]=qs[_0xdb81('0x32')](_0x22a0ce['query'][_0xdb81('0x32')]);_0x359a47[_0xdb81('0x30')]=qs[_0xdb81('0x30')](_0x22a0ce['query']['offset']);}_0x359a47[_0xdb81('0x50')]=qs['sort'](_0x22a0ce[_0xdb81('0x47')][_0xdb81('0x51')]);_0x359a47['where']=qs['filters'](_[_0xdb81('0x52')](_0x22a0ce[_0xdb81('0x47')],_0x2dfb76[_0xdb81('0x49')]),_0x1cbe1f);if(_0x22a0ce[_0xdb81('0x47')][_0xdb81('0x53')]){_0x359a47[_0xdb81('0x54')]=_[_0xdb81('0x55')](_0x359a47[_0xdb81('0x54')],{'$or':_[_0xdb81('0x40')](_0x1cbe1f,function(_0x51d858){if(_0x51d858['type']!=='VIRTUAL'){var _0x5bc7c4={};_0x5bc7c4[_0x51d858['name']]={'$like':'%'+_0x22a0ce[_0xdb81('0x47')][_0xdb81('0x53')]+'%'};return _0x5bc7c4;}})});}_0x359a47=_['merge']({},_0x359a47,_0x22a0ce[_0xdb81('0x56')]);var _0x1e75d6={'where':_0x359a47['where']};return db[_0xdb81('0x41')][_0xdb81('0x33')](_0x1e75d6)[_0xdb81('0x3a')](function(_0x1c8316){_0x45952d[_0xdb81('0x33')]=_0x1c8316;if(_0x22a0ce[_0xdb81('0x47')]['includeAll']){_0x359a47[_0xdb81('0x57')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xdb81('0x58')](_0x359a47);})[_0xdb81('0x3a')](function(_0x26b668){_0x45952d[_0xdb81('0x59')]=_0x26b668;return _0x45952d;})[_0xdb81('0x3a')](respondWithFilteredResult(_0x369ad7,_0x359a47))[_0xdb81('0x2b')](handleError(_0x369ad7,null));};exports[_0xdb81('0x5a')]=function(_0x14c858,_0x49a22f){var _0x3cd850={'raw':!![],'where':{'id':_0x14c858[_0xdb81('0x5b')]['id']}},_0x3bba10={};_0x3bba10[_0xdb81('0x46')]=_[_0xdb81('0x48')](db[_0xdb81('0x41')]['rawAttributes']);_0x3bba10[_0xdb81('0x47')]=_[_0xdb81('0x48')](_0x14c858[_0xdb81('0x47')]);_0x3bba10[_0xdb81('0x49')]=_[_0xdb81('0x4a')](_0x3bba10[_0xdb81('0x46')],_0x3bba10[_0xdb81('0x47')]);_0x3cd850['attributes']=_[_0xdb81('0x4a')](_0x3bba10['model'],qs['fields'](_0x14c858[_0xdb81('0x47')]['fields']));_0x3cd850[_0xdb81('0x4c')]=_0x3cd850['attributes'][_0xdb81('0x4d')]?_0x3cd850[_0xdb81('0x4c')]:_0x3bba10['model'];if(_0x14c858[_0xdb81('0x47')][_0xdb81('0x5c')]){_0x3cd850[_0xdb81('0x57')]=[{'all':!![]}];}_0x3cd850=_[_0xdb81('0x55')]({},_0x3cd850,_0x14c858[_0xdb81('0x56')]);return db[_0xdb81('0x41')][_0xdb81('0x5d')](_0x3cd850)[_0xdb81('0x3a')](handleEntityNotFound(_0x49a22f,null))[_0xdb81('0x3a')](respondWithResult(_0x49a22f,null))[_0xdb81('0x2b')](handleError(_0x49a22f,null));};exports[_0xdb81('0x5e')]=function(_0x410f43,_0x53f0ce){return db['OpenchannelMessage'][_0xdb81('0x5e')](_0x410f43['body'],{})[_0xdb81('0x3a')](respondWithResult(_0x53f0ce,0xc9))[_0xdb81('0x2b')](handleError(_0x53f0ce,null));};exports[_0xdb81('0x39')]=function(_0x1f3f7a,_0x42a97e){if(_0x1f3f7a['body']['id']){delete _0x1f3f7a[_0xdb81('0x5f')]['id'];}return db['OpenchannelMessage'][_0xdb81('0x5d')]({'where':{'id':_0x1f3f7a[_0xdb81('0x5b')]['id']}})[_0xdb81('0x3a')](handleEntityNotFound(_0x42a97e,null))[_0xdb81('0x3a')](saveUpdates(_0x1f3f7a[_0xdb81('0x5f')],null))[_0xdb81('0x3a')](respondWithResult(_0x42a97e,null))['catch'](handleError(_0x42a97e,null));};exports[_0xdb81('0x3b')]=function(_0x210d86,_0x3a5d35){return db[_0xdb81('0x41')][_0xdb81('0x5d')]({'where':{'id':_0x210d86['params']['id']}})[_0xdb81('0x3a')](handleEntityNotFound(_0x3a5d35,null))[_0xdb81('0x3a')](removeEntity(_0x3a5d35,null))[_0xdb81('0x2b')](handleError(_0x3a5d35,null));};exports[_0xdb81('0x60')]=function(_0x5880ce,_0x3c12a2){return db[_0xdb81('0x41')][_0xdb81('0x60')]()[_0xdb81('0x3a')](respondWithResult(_0x3c12a2,null))['catch'](handleError(_0x3c12a2,null));};var interaction_log=require(_0xdb81('0x14'))(_0xdb81('0x61'));exports['accept']=function(_0xe4d9cb,_0x34a269,_0x5e2524){var _0x486c5e={'agent':{},'channel':_0xdb81('0x62')};if(_0xe4d9cb[_0xdb81('0x5f')]['id']){delete _0xe4d9cb[_0xdb81('0x5f')]['id'];}_0xe4d9cb['body'][_0xdb81('0x63')]=!![];_0xe4d9cb[_0xdb81('0x5f')][_0xdb81('0x64')]=moment()[_0xdb81('0x65')](_0xdb81('0x66'));_0xe4d9cb['body'][_0xdb81('0x67')]=_0xe4d9cb[_0xdb81('0x5f')][_0xdb81('0x67')]||_0xe4d9cb[_0xdb81('0x68')]['id'];_0x486c5e['agent']['id']=_0xe4d9cb[_0xdb81('0x5f')]['UserId'];return db['OpenchannelMessage'][_0xdb81('0x5d')]({'where':{'id':_0xe4d9cb[_0xdb81('0x5b')]['id'],'UserId':null}})[_0xdb81('0x3a')](handleEntityNotFound(_0x34a269,null))[_0xdb81('0x3a')](saveUpdates(_0xe4d9cb['body'],null))[_0xdb81('0x3a')](function(_0x2f4cc3){if(_0x2f4cc3){_0x486c5e[_0xdb81('0x2a')]=_0x2f4cc3[_0xdb81('0x69')]({'plain':!![]});return db[_0xdb81('0x6a')][_0xdb81('0x5d')]({'where':{'id':_0x2f4cc3['OpenchannelInteractionId']}});}return null;})[_0xdb81('0x3a')](handleEntityNotFound(_0x34a269,null))[_0xdb81('0x3a')](function(_0x13e853){if(_0x13e853){return _0x13e853['update']({'UserId':_0xe4d9cb['body'][_0xdb81('0x67')],'read1stAt':_['isNil'](_0x13e853[_0xdb81('0x6b')])?moment()[_0xdb81('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdb81('0x3a')](function(_0xc04b07){if(_0xc04b07){_0x486c5e[_0xdb81('0x6c')]=_0xc04b07[_0xdb81('0x69')]({'plain':!![]});interaction_log[_0xdb81('0x22')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe4d9cb[_0xdb81('0x68')]['id'],_0xe4d9cb[_0xdb81('0x68')][_0xdb81('0x3d')],_0xe4d9cb[_0xdb81('0x68')]['role'],_0x486c5e['interaction']['id'],_0xe4d9cb['body']?JSON[_0xdb81('0x27')](_0xe4d9cb[_0xdb81('0x5f')]):_0xdb81('0x6d'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x486c5e);}return null;})['then'](function(_0x115df2){var _0x3ee1ad=_0xdb81('0x6e')+_0x115df2[_0xdb81('0x2a')][_0xdb81('0x6f')];return db[_0xdb81('0x70')]['query'](_0x3ee1ad,{'type':db[_0xdb81('0x71')][_0xdb81('0x72')][_0xdb81('0x73')],'raw':!![]})[_0xdb81('0x3a')](function(_0x4a4e23){return _0x4a4e23;});})[_0xdb81('0x3a')](function(_0x4c1f98){if(_0x4c1f98){_0x486c5e[_0xdb81('0x2a')][_0xdb81('0x74')]=_0x4c1f98[0x0];if(!_0xe4d9cb[_0xdb81('0x5f')]['UserId'])return;return db[_0xdb81('0x75')][_0xdb81('0x5d')]({'where':{'id':_0xe4d9cb['body'][_0xdb81('0x67')],'role':'agent'},'attributes':['id',_0xdb81('0x3d'),'fullname',_0xdb81('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x5b6908){if(!_0x5b6908)return null;_0x486c5e['message'][_0xdb81('0x77')]=_0x5b6908;return _0x486c5e;})['then'](function(_0x285d83){if(_0x285d83){if(_0xe4d9cb[_0xdb81('0x5f')][_0xdb81('0x78')]){_0x486c5e['message']['interface']=util[_0xdb81('0x65')](_0xdb81('0x79'),_0xe4d9cb['user'][_0xdb81('0x3d')]);_0x486c5e[_0xdb81('0x2a')][_0xdb81('0x7a')]=_0x486c5e[_0xdb81('0x7a')];_0x486c5e[_0xdb81('0x2a')]['motionChannel']=_0x486c5e['channel'];_0x486c5e[_0xdb81('0x2a')][_0xdb81('0x7b')]=_0xdb81('0x7c');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x486c5e[_0xdb81('0x2a')]},client9002)[_0xdb81('0x3a')](function(){return _0x486c5e;});}return _0x486c5e;}return null;})[_0xdb81('0x3a')](respondWithResult(_0x34a269,null))['catch'](handleError(_0x34a269,null));};var interaction_log=require(_0xdb81('0x14'))(_0xdb81('0x61'));exports['reject']=function(_0x337301,_0x2ab490,_0x14bddc){var _0x2db436={'agent':{},'channel':_0xdb81('0x62')};if(_0x337301['body']['id']){delete _0x337301[_0xdb81('0x5f')]['id'];}_0x337301[_0xdb81('0x5f')][_0xdb81('0x67')]=_0x337301[_0xdb81('0x5f')][_0xdb81('0x67')]||_0x337301[_0xdb81('0x68')]['id'];_0x2db436[_0xdb81('0x77')]['id']=_0x337301[_0xdb81('0x5f')]['UserId'];return db[_0xdb81('0x41')][_0xdb81('0x5d')]({'where':{'id':_0x337301[_0xdb81('0x5b')]['id'],'UserId':null}})[_0xdb81('0x3a')](handleEntityNotFound(_0x2ab490,null))[_0xdb81('0x3a')](function(_0x584df9){if(_0x584df9){_0x2db436[_0xdb81('0x2a')]=_0x584df9[_0xdb81('0x69')]({'plain':!![]});return db[_0xdb81('0x6a')][_0xdb81('0x5d')]({'where':{'id':_0x584df9['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2ab490,null))[_0xdb81('0x3a')](function(_0x376470){if(_0x376470){_0x2db436['interaction']=_0x376470['get']({'plain':!![]});interaction_log[_0xdb81('0x22')](_0xdb81('0x7d'),_0x337301[_0xdb81('0x68')]['id'],_0x337301[_0xdb81('0x68')][_0xdb81('0x3d')],_0x337301['user'][_0xdb81('0x7e')],_0x2db436[_0xdb81('0x6c')]['id'],_0x337301[_0xdb81('0x5f')]?JSON[_0xdb81('0x27')](_0x337301['body']):_0xdb81('0x6d'));return respondWithRpcPromise(_0xdb81('0x7f'),'rejectMessage',_0x2db436);}return null;})['then'](function(_0x30b987){var _0xe6ebb7=_0xdb81('0x6e')+_0x30b987[_0xdb81('0x2a')][_0xdb81('0x6f')];return db[_0xdb81('0x70')]['query'](_0xe6ebb7,{'type':db['Sequelize']['QueryTypes'][_0xdb81('0x73')],'raw':!![]})[_0xdb81('0x3a')](function(_0x4441e2){return _0x4441e2;});})['then'](function(_0x6c3749){if(_0x6c3749){_0x2db436['message'][_0xdb81('0x74')]=_0x6c3749[0x0];if(!_0x337301[_0xdb81('0x5f')]['UserId'])return;return db['User'][_0xdb81('0x5d')]({'where':{'id':_0x337301[_0xdb81('0x5f')][_0xdb81('0x67')],'role':_0xdb81('0x77')},'attributes':['id',_0xdb81('0x3d'),'fullname',_0xdb81('0x76'),'internal'],'raw':!![]});}return null;})[_0xdb81('0x3a')](function(_0x2ca469){if(!_0x2ca469)return null;_0x2db436['message']['agent']=_0x2ca469;return _0x2db436;})[_0xdb81('0x3a')](function(_0x4aaae3){if(_0x4aaae3){_0x4aaae3[_0xdb81('0x2a')][_0xdb81('0x80')]=util[_0xdb81('0x65')]('SIP/%s',_0x337301[_0xdb81('0x68')][_0xdb81('0x3d')]);_0x4aaae3[_0xdb81('0x2a')][_0xdb81('0x7a')]=_0x2db436['channel'];_0x4aaae3[_0xdb81('0x2a')]['motionChannel']=_0x2db436['channel'];_0x4aaae3[_0xdb81('0x2a')][_0xdb81('0x7b')]='reject';respondWithRpcPromise(_0xdb81('0x81'),_0xdb81('0x81'),{'event':_0xdb81('0x82'),'message':_0x4aaae3[_0xdb81('0x2a')]},client9002);return _0x2db436;}return null;})[_0xdb81('0x3a')](respondWithResult(_0x2ab490,null))[_0xdb81('0x2b')](handleError(_0x2ab490,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 0823334..10085f9 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 _0xbbc0=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit'];(function(_0x37ffea,_0x25b006){var _0x2e2615=function(_0x5e6c74){while(--_0x5e6c74){_0x37ffea['push'](_0x37ffea['shift']());}};_0x2e2615(++_0x25b006);}(_0xbbc0,0xec));var _0x0bbc=function(_0x637800,_0x336c24){_0x637800=_0x637800-0x0;var _0x28ad13=_0xbbc0[_0x637800];return _0x28ad13;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x0bbc('0x0'))['db'][_0x0bbc('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0bbc('0x2')](0x0);var events={'afterCreate':_0x0bbc('0x3'),'afterUpdate':_0x0bbc('0x4'),'afterDestroy':_0x0bbc('0x5')};function emitEvent(_0x384076){return function(_0x47342f,_0x314337,_0x358ade){OpenchannelMessageEvents[_0x0bbc('0x6')](_0x384076+':'+_0x47342f['id'],_0x47342f);OpenchannelMessageEvents[_0x0bbc('0x6')](_0x384076,_0x47342f);_0x358ade(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x0bbc('0x7')](e,emitEvent(event));}}module[_0x0bbc('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x3d84=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x493c48,_0x4a41a8){var _0x598d76=function(_0xf25c10){while(--_0xf25c10){_0x493c48['push'](_0x493c48['shift']());}};_0x598d76(++_0x4a41a8);}(_0x3d84,0xc1));var _0x43d8=function(_0x43aa50,_0x4559c7){_0x43aa50=_0x43aa50-0x0;var _0x5e3e94=_0x3d84[_0x43aa50];return _0x5e3e94;};'use strict';var EventEmitter=require(_0x43d8('0x0'));var OpenchannelMessage=require(_0x43d8('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x43d8('0x2')](0x0);var events={'afterCreate':_0x43d8('0x3'),'afterUpdate':_0x43d8('0x4'),'afterDestroy':_0x43d8('0x5')};function emitEvent(_0x4af9dc){return function(_0x8a14a9,_0x16c605,_0x406685){OpenchannelMessageEvents[_0x43d8('0x6')](_0x4af9dc+':'+_0x8a14a9['id'],_0x8a14a9);OpenchannelMessageEvents[_0x43d8('0x6')](_0x4af9dc,_0x8a14a9);_0x406685(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x43d8('0x7')](e,emitEvent(event));}}module[_0x43d8('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index cbfa361..701c5c8 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 _0xcda0=['format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','Interaction','error','inspect','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch','out','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info'];(function(_0x416f54,_0x14e69a){var _0x46a554=function(_0x4064c4){while(--_0x4064c4){_0x416f54['push'](_0x416f54['shift']());}};_0x46a554(++_0x14e69a);}(_0xcda0,0xcb));var _0x0cda=function(_0x1fc52c,_0x13ca67){_0x1fc52c=_0x1fc52c-0x0;var _0x286f5b=_0xcda0[_0x1fc52c];return _0x286f5b;};'use strict';var _=require('lodash');var util=require(_0x0cda('0x0'));var logger=require('../../config/logger')(_0x0cda('0x1'));var moment=require('moment');var BPromise=require(_0x0cda('0x2'));var rp=require(_0x0cda('0x3'));var fs=require('fs');var path=require(_0x0cda('0x4'));var rimraf=require('rimraf');var config=require(_0x0cda('0x5'));var attributes=require(_0x0cda('0x6'));module[_0x0cda('0x7')]=function(_0xf1de88,_0x2506ca){return _0xf1de88[_0x0cda('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x0cda('0x9'),'paranoid':![],'indexes':[{'name':_0x0cda('0xa'),'fields':['body'],'type':_0x0cda('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20c163,_0x36a70a,_0x262f65){var _0x2011d1=_0xf1de88['models'];var _0xb0248c=_0x20c163[_0x0cda('0xc')]({'plain':!![]});if(_0xb0248c[_0x0cda('0xd')][_0x0cda('0xe')]()==='in'||_0xb0248c['direction']['toLowerCase']()==='out'&&!_0xb0248c['secret']&&!_[_0x0cda('0xf')](_0xb0248c[_0x0cda('0x10')])){_0x2011d1[_0x0cda('0x11')][_0x0cda('0x12')]({'where':{'id':_0xb0248c[_0x0cda('0x13')]}})[_0x0cda('0x14')](function(_0x296cfb){if(_0x296cfb){_0x296cfb[_0x0cda('0x15')]({'lastMsgAt':_0xb0248c['createdAt'],'lastMsgDirection':_0xb0248c[_0x0cda('0xd')][_0x0cda('0xe')]()});}})[_0x0cda('0x16')](function(_0x23c5be){console['error'](_0x23c5be);});}if(_0xb0248c['direction']===_0x0cda('0x17')&&!_0xb0248c['secret']){var _0x2b6fa3;_0x2011d1[_0x0cda('0x18')]['describe']()[_0x0cda('0x14')](function(_0x3d9a83){return _0x2011d1[_0x0cda('0x19')]['find']({'where':{'id':_0xb0248c[_0x0cda('0x1a')]},'include':[{'model':_0x2011d1[_0x0cda('0x11')],'as':_0x0cda('0x1b'),'where':{'id':_0xb0248c[_0x0cda('0x13')]},'limit':0x1,'include':[{'model':_0x2011d1['CmContact'],'as':_0x0cda('0x1c'),'attributes':_[_0x0cda('0x1d')](_0x3d9a83)}]}]});})[_0x0cda('0x14')](function(_0x24f5c8){_0x2b6fa3=_0x24f5c8[_0x0cda('0xc')]({'plain':!![]});if(_0x2b6fa3&&_0x2b6fa3[_0x0cda('0x1e')]){logger[_0x0cda('0x1f')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x0cda('0x20')](_0x0cda('0x21'),_0xb0248c['id'],_0x2b6fa3[_0x0cda('0x1e')]));if(_0x2b6fa3['Interactions']&&_0x2b6fa3[_0x0cda('0x1b')][_0x0cda('0x22')]){_0xb0248c['Interaction']=_[_0x0cda('0x23')](_0x2b6fa3[_0x0cda('0x1b')][0x0],'Contact');_0xb0248c['Contact']=_0x2b6fa3[_0x0cda('0x1b')][0x0][_0x0cda('0x1c')];}var _0x36a70a={'method':'POST','uri':encodeURI(_0x2b6fa3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x36a70a['method']){case _0x0cda('0x24'):_0x36a70a['qs']=_0xb0248c;break;case'POST':_0x36a70a['body']=_0xb0248c;break;}return rp(_0x36a70a)[_0x0cda('0x14')](function(_0x232532){logger['info'](_0x0cda('0x25'),_0x0cda('0x26'),util[_0x0cda('0x20')](_0x0cda('0x27'),_0xb0248c['id'],_0x2b6fa3[_0x0cda('0x1e')]));if(_0x232532[_0x0cda('0x28')]['threadId']&&_0x232532['body'][_0x0cda('0x29')]!=_0xb0248c[_0x0cda('0x2a')]['threadId']){return _0x2011d1[_0x0cda('0x11')]['update']({'threadId':_0x232532[_0x0cda('0x28')]['threadId']},{'where':{'id':_0xb0248c['Interaction']['id']}});}else{return;}})[_0x0cda('0x14')](function(){return _0x20c163['update']({'read':!![]});})[_0x0cda('0x16')](function(_0x3b8779){logger[_0x0cda('0x2b')]('OpenchannelMessage,\x20%s,\x20%s',_0x0cda('0x26'),util[_0x0cda('0x2c')](_0x3b8779,{'showHidden':![],'depth':null}));_0x262f65();});}else{_0x262f65();}})['finally'](function(){_0x262f65();});}else{_0x262f65();}}},'charset':_0x0cda('0x2d'),'collate':_0x0cda('0x2e')});}; \ No newline at end of file +var _0x53af=['FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','Contact','method','threadId','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body'];(function(_0x31163b,_0x2398a7){var _0x2a932a=function(_0x421d13){while(--_0x421d13){_0x31163b['push'](_0x31163b['shift']());}};_0x2a932a(++_0x2398a7);}(_0x53af,0xf4));var _0xf53a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x53af[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xf53a('0x0'));var util=require(_0xf53a('0x1'));var logger=require(_0xf53a('0x2'))(_0xf53a('0x3'));var moment=require(_0xf53a('0x4'));var BPromise=require('bluebird');var rp=require(_0xf53a('0x5'));var fs=require('fs');var path=require(_0xf53a('0x6'));var rimraf=require(_0xf53a('0x7'));var config=require(_0xf53a('0x8'));var attributes=require(_0xf53a('0x9'));module[_0xf53a('0xa')]=function(_0x5cc2f1,_0x54d7a3){return _0x5cc2f1[_0xf53a('0xb')](_0xf53a('0xc'),attributes,{'tableName':_0xf53a('0xd'),'paranoid':![],'indexes':[{'name':_0xf53a('0xe'),'fields':[_0xf53a('0xf')],'type':_0xf53a('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4bede9,_0x34e043,_0x163815){var _0x2e5a5e=_0x5cc2f1[_0xf53a('0x11')];var _0x326b25=_0x4bede9[_0xf53a('0x12')]({'plain':!![]});if(_0x326b25[_0xf53a('0x13')][_0xf53a('0x14')]()==='in'||_0x326b25[_0xf53a('0x13')][_0xf53a('0x14')]()===_0xf53a('0x15')&&!_0x326b25[_0xf53a('0x16')]&&!_[_0xf53a('0x17')](_0x326b25['UserId'])){_0x2e5a5e[_0xf53a('0x18')][_0xf53a('0x19')]({'where':{'id':_0x326b25[_0xf53a('0x1a')]}})[_0xf53a('0x1b')](function(_0x451f42){if(_0x451f42){_0x451f42[_0xf53a('0x1c')]({'lastMsgAt':_0x326b25['createdAt'],'lastMsgDirection':_0x326b25[_0xf53a('0x13')]['toLowerCase']()});}})['catch'](function(_0x4bce1d){console[_0xf53a('0x1d')](_0x4bce1d);});}if(_0x326b25[_0xf53a('0x13')]===_0xf53a('0x15')&&!_0x326b25[_0xf53a('0x16')]){var _0x5fc8a;_0x2e5a5e[_0xf53a('0x1e')][_0xf53a('0x1f')]()['then'](function(_0x4b173d){return _0x2e5a5e[_0xf53a('0x20')][_0xf53a('0x21')]({'where':{'id':_0x326b25[_0xf53a('0x22')]},'include':[{'model':_0x2e5a5e[_0xf53a('0x18')],'as':_0xf53a('0x23'),'where':{'id':_0x326b25[_0xf53a('0x1a')]},'limit':0x1,'include':[{'model':_0x2e5a5e[_0xf53a('0x1e')],'as':'Contact','attributes':_['keys'](_0x4b173d)}]}]});})['then'](function(_0x60b7dc){_0x5fc8a=_0x60b7dc[_0xf53a('0x12')]({'plain':!![]});if(_0x5fc8a&&_0x5fc8a[_0xf53a('0x24')]){logger[_0xf53a('0x25')](_0xf53a('0x26'),_0xf53a('0x27'),util[_0xf53a('0x28')](_0xf53a('0x29'),_0x326b25['id'],_0x5fc8a[_0xf53a('0x24')]));if(_0x5fc8a[_0xf53a('0x23')]&&_0x5fc8a['Interactions'][_0xf53a('0x2a')]){_0x326b25[_0xf53a('0x2b')]=_['omit'](_0x5fc8a[_0xf53a('0x23')][0x0],_0xf53a('0x2c'));_0x326b25[_0xf53a('0x2c')]=_0x5fc8a[_0xf53a('0x23')][0x0][_0xf53a('0x2c')];}var _0x34e043={'method':'POST','uri':encodeURI(_0x5fc8a[_0xf53a('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34e043[_0xf53a('0x2d')]){case'GET':_0x34e043['qs']=_0x326b25;break;case'POST':_0x34e043[_0xf53a('0xf')]=_0x326b25;break;}return rp(_0x34e043)[_0xf53a('0x1b')](function(_0x5a7bd7){logger['info'](_0xf53a('0x26'),_0xf53a('0x27'),util[_0xf53a('0x28')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x326b25['id'],_0x5fc8a[_0xf53a('0x24')]));if(_0x5a7bd7['body'][_0xf53a('0x2e')]&&_0x5a7bd7['body'][_0xf53a('0x2e')]!=_0x326b25[_0xf53a('0x2b')][_0xf53a('0x2e')]){return _0x2e5a5e[_0xf53a('0x18')]['update']({'threadId':_0x5a7bd7[_0xf53a('0xf')]['threadId']},{'where':{'id':_0x326b25[_0xf53a('0x2b')]['id']}});}else{return;}})[_0xf53a('0x1b')](function(){return _0x4bede9[_0xf53a('0x1c')]({'read':!![]});})[_0xf53a('0x2f')](function(_0x466368){logger[_0xf53a('0x1d')](_0xf53a('0x26'),_0xf53a('0x27'),util[_0xf53a('0x30')](_0x466368,{'showHidden':![],'depth':null}));_0x163815();});}else{_0x163815();}})[_0xf53a('0x31')](function(){_0x163815();});}else{_0x163815();}}},'charset':_0xf53a('0x32'),'collate':_0xf53a('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 4a57744..432faa7 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x3ce71c,_0x2b3392){var _0x339fcd=function(_0x511964){while(--_0x511964){_0x3ce71c['push'](_0x3ce71c['shift']());}};_0x339fcd(++_0x2b3392);}(_0x0b0e,0x187));var _0xe0b0=function(_0x450f09,_0x59561d){_0x450f09=_0x450f09-0x0;var _0x4e22ec=_0x0b0e[_0x450f09];return _0x4e22ec;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x36a713,_0x2f5131){var _0x4e0ad3=function(_0x553640){while(--_0x553640){_0x36a713['push'](_0x36a713['shift']());}};_0x4e0ad3(++_0x2f5131);}(_0x5f2f,0x73));var _0xf5f2=function(_0xcfa766,_0x2ab0ae){_0xcfa766=_0xcfa766-0x0;var _0x4ff08d=_0x5f2f[_0xcfa766];return _0x4ff08d;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cd178ab..897ebda 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 _0x204b=['save','remove','emit','removeListener','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x4889a2,_0x688e52){var _0x260d45=function(_0x28fa2b){while(--_0x28fa2b){_0x4889a2['push'](_0x4889a2['shift']());}};_0x260d45(++_0x688e52);}(_0x204b,0x6f));var _0xb204=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x204b[_0xaa1b3e];return _0x454d7d;};'use strict';var OpenchannelMessageEvents=require(_0xb204('0x0'));var events=[_0xb204('0x1'),_0xb204('0x2'),'update'];function createListener(_0x309253,_0x3f774b){return function(_0x2d718b){_0x3f774b[_0xb204('0x3')](_0x309253,_0x2d718b);};}function removeListener(_0x17d454,_0x58e5b4){return function(){OpenchannelMessageEvents[_0xb204('0x4')](_0x17d454,_0x58e5b4);};}exports['register']=function(_0xf41dce){for(var _0xf5a78e=0x0,_0xe05676=events[_0xb204('0x5')];_0xf5a78e<_0xe05676;_0xf5a78e++){var _0x337618=events[_0xf5a78e];var _0x3932ad=createListener(_0xb204('0x6')+_0x337618,_0xf41dce);OpenchannelMessageEvents['on'](_0x337618,_0x3932ad);}}; \ No newline at end of file +var _0xacd6=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove','update'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xacd6,0xef));var _0x6acd=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0xacd6[_0xf0bc07];return _0x1c50c2;};'use strict';var OpenchannelMessageEvents=require(_0x6acd('0x0'));var events=[_0x6acd('0x1'),_0x6acd('0x2'),_0x6acd('0x3')];function createListener(_0x339d03,_0x395606){return function(_0x27beed){_0x395606[_0x6acd('0x4')](_0x339d03,_0x27beed);};}function removeListener(_0xac184f,_0x34bae2){return function(){OpenchannelMessageEvents[_0x6acd('0x5')](_0xac184f,_0x34bae2);};}exports[_0x6acd('0x6')]=function(_0x592d42){for(var _0x115a7b=0x0,_0x1c6c37=events[_0x6acd('0x7')];_0x115a7b<_0x1c6c37;_0x115a7b++){var _0x9dec1e=events[_0x115a7b];var _0x1b834a=createListener(_0x6acd('0x8')+_0x9dec1e,_0x592d42);OpenchannelMessageEvents['on'](_0x9dec1e,_0x1b834a);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 779cfad..407832b 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 _0xf777=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','destroy','removeTeams','removeAgents','exports','multer'];(function(_0x5b1780,_0x1493a4){var _0x4c0324=function(_0x585178){while(--_0x585178){_0x5b1780['push'](_0x5b1780['shift']());}};_0x4c0324(++_0x1493a4);}(_0xf777,0x1af));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7f77('0x0'));var util=require(_0x7f77('0x1'));var path=require(_0x7f77('0x2'));var timeout=require(_0x7f77('0x3'));var express=require(_0x7f77('0x4'));var router=express['Router']();var fs_extra=require(_0x7f77('0x5'));var auth=require(_0x7f77('0x6'));var interaction=require(_0x7f77('0x7'));var config=require(_0x7f77('0x8'));var controller=require('./openchannelQueue.controller');router[_0x7f77('0x9')]('/',auth[_0x7f77('0xa')](),controller[_0x7f77('0xb')]);router['get']('/describe',auth[_0x7f77('0xa')](),controller[_0x7f77('0xc')]);router[_0x7f77('0x9')](_0x7f77('0xd'),auth[_0x7f77('0xa')](),controller[_0x7f77('0xe')]);router[_0x7f77('0x9')](_0x7f77('0xf'),auth[_0x7f77('0xa')](),controller['getMembers']);router[_0x7f77('0x9')](_0x7f77('0x10'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x11')]);router[_0x7f77('0x9')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x13')]);router[_0x7f77('0x14')]('/',auth[_0x7f77('0xa')](),controller['create']);router[_0x7f77('0x14')]('/:id/teams',auth[_0x7f77('0xa')](),controller['addTeams']);router[_0x7f77('0x14')](_0x7f77('0x12'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x15')]);router[_0x7f77('0x16')]('/:id',auth[_0x7f77('0xa')](),controller['update']);router['delete'](_0x7f77('0xd'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x17')]);router['delete'](_0x7f77('0x10'),auth[_0x7f77('0xa')](),controller[_0x7f77('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x7f77('0x19')]);module[_0x7f77('0x1a')]=router; \ No newline at end of file +var _0x9a05=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','/:id/teams','removeTeams','exports','multer'];(function(_0xc34345,_0x48d507){var _0x51fa23=function(_0x3197eb){while(--_0x3197eb){_0xc34345['push'](_0xc34345['shift']());}};_0x51fa23(++_0x48d507);}(_0x9a05,0x90));var _0x59a0=function(_0x46dbe2,_0x23a4ed){_0x46dbe2=_0x46dbe2-0x0;var _0xc79adc=_0x9a05[_0x46dbe2];return _0xc79adc;};'use strict';var multer=require(_0x59a0('0x0'));var util=require(_0x59a0('0x1'));var path=require(_0x59a0('0x2'));var timeout=require(_0x59a0('0x3'));var express=require(_0x59a0('0x4'));var router=express[_0x59a0('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x59a0('0x6'));var interaction=require(_0x59a0('0x7'));var config=require('../../config/environment');var controller=require(_0x59a0('0x8'));router['get']('/',auth[_0x59a0('0x9')](),controller[_0x59a0('0xa')]);router[_0x59a0('0xb')]('/describe',auth[_0x59a0('0x9')](),controller[_0x59a0('0xc')]);router[_0x59a0('0xb')](_0x59a0('0xd'),auth[_0x59a0('0x9')](),controller[_0x59a0('0xe')]);router['get'](_0x59a0('0xf'),auth[_0x59a0('0x9')](),controller[_0x59a0('0x10')]);router[_0x59a0('0xb')]('/:id/teams',auth[_0x59a0('0x9')](),controller[_0x59a0('0x11')]);router[_0x59a0('0xb')](_0x59a0('0x12'),auth[_0x59a0('0x9')](),controller[_0x59a0('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x59a0('0x14')]);router[_0x59a0('0x15')]('/:id/teams',auth[_0x59a0('0x9')](),controller['addTeams']);router[_0x59a0('0x15')](_0x59a0('0x12'),auth['isAuthenticated'](),controller[_0x59a0('0x16')]);router[_0x59a0('0x17')]('/:id',auth[_0x59a0('0x9')](),controller[_0x59a0('0x18')]);router[_0x59a0('0x19')](_0x59a0('0xd'),auth[_0x59a0('0x9')](),controller['destroy']);router['delete'](_0x59a0('0x1a'),auth[_0x59a0('0x9')](),controller[_0x59a0('0x1b')]);router[_0x59a0('0x19')](_0x59a0('0x12'),auth[_0x59a0('0x9')](),controller['removeAgents']);module[_0x59a0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 66479e5..6937383 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 _0x8fc0=['rrmemory','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x7775a3,_0xa2b8cd){var _0x26ea39=function(_0x1bb2e4){while(--_0x1bb2e4){_0x7775a3['push'](_0x7775a3['shift']());}};_0x26ea39(++_0xa2b8cd);}(_0x8fc0,0x1bb));var _0x08fc=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x8fc0[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0x08fc('0x0'));module['exports']={'name':{'type':Sequelize[_0x08fc('0x1')],'unique':_0x08fc('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x08fc('0x1')]},'timeout':{'type':Sequelize[_0x08fc('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x08fc('0x4')](_0x08fc('0x5'),'beepall',_0x08fc('0x6'))}}; \ No newline at end of file +var _0x1ed2=['name','INTEGER','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x571a17,_0x63fb3d){var _0x3ef337=function(_0x12096b){while(--_0x12096b){_0x571a17['push'](_0x571a17['shift']());}};_0x3ef337(++_0x63fb3d);}(_0x1ed2,0x1b6));var _0x21ed=function(_0x5745d2,_0x536b58){_0x5745d2=_0x5745d2-0x0;var _0xd6df54=_0x1ed2[_0x5745d2];return _0xd6df54;};'use strict';var Sequelize=require(_0x21ed('0x0'));module[_0x21ed('0x1')]={'name':{'type':Sequelize[_0x21ed('0x2')],'unique':_0x21ed('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x21ed('0x2')]},'timeout':{'type':Sequelize[_0x21ed('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x21ed('0x5'),_0x21ed('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d68ec8b..6e00c65 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 _0xda38=['path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','include','findAll','rows','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','getMembers','findOne','UserOpenchannelQueue','pick','OpenchannelQueueId','User','findAndCountAll','agent','createdAt','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','Agents','voicePause','flatMap','sequelize','transaction','each','forEach','userOpenchannelQueue:save','removeTeams','ids','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','removeAgents','emit','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x4503df,_0xfec122){var _0x3f1b2b=function(_0x32b1de){while(--_0x32b1de){_0x4503df['push'](_0x4503df['shift']());}};_0x3f1b2b(++_0xfec122);}(_0xda38,0x105));var _0x8da3=function(_0x24ccd7,_0x2eeca9){_0x24ccd7=_0x24ccd7-0x0;var _0x26aa79=_0xda38[_0x24ccd7];return _0x26aa79;};'use strict';var emlformat=require(_0x8da3('0x0'));var rimraf=require(_0x8da3('0x1'));var zipdir=require(_0x8da3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8da3('0x3'));var moment=require(_0x8da3('0x4'));var BPromise=require(_0x8da3('0x5'));var Mustache=require('mustache');var util=require(_0x8da3('0x6'));var path=require(_0x8da3('0x7'));var sox=require(_0x8da3('0x8'));var csv=require('to-csv');var ejs=require(_0x8da3('0x9'));var fs=require('fs');var fs_extra=require(_0x8da3('0xa'));var _=require(_0x8da3('0xb'));var squel=require(_0x8da3('0xc'));var crypto=require(_0x8da3('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8da3('0xe'));var querystring=require(_0x8da3('0xf'));var Papa=require(_0x8da3('0x10'));var Redis=require(_0x8da3('0x11'));var authService=require(_0x8da3('0x12'));var qs=require(_0x8da3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8da3('0x14'));var utils=require('../../config/utils');var config=require(_0x8da3('0x15'));var licenseUtil=require(_0x8da3('0x16'));var db=require(_0x8da3('0x17'))['db'];config[_0x8da3('0x18')]=_['defaults'](config[_0x8da3('0x18')],{'host':_0x8da3('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8da3('0x18')]));require('./openchannelQueue.socket')[_0x8da3('0x1a')](socket);function respondWithStatusCode(_0x2524b5,_0xaf18ff){_0xaf18ff=_0xaf18ff||0xcc;return function(_0x376bb8){if(_0x376bb8){return _0x2524b5[_0x8da3('0x1b')](_0xaf18ff);}return _0x2524b5[_0x8da3('0x1c')](_0xaf18ff)[_0x8da3('0x1d')]();};}function respondWithResult(_0x300821,_0x57fac9){_0x57fac9=_0x57fac9||0xc8;return function(_0x3bd35d){if(_0x3bd35d){return _0x300821[_0x8da3('0x1c')](_0x57fac9)[_0x8da3('0x1e')](_0x3bd35d);}};}function respondWithFilteredResult(_0x2a3b4e,_0x443871){return function(_0x41455c){if(_0x41455c){var _0x4ee54a=typeof _0x443871['offset']===_0x8da3('0x1f')&&typeof _0x443871[_0x8da3('0x20')]===_0x8da3('0x1f');var _0x578087=_0x41455c[_0x8da3('0x21')];var _0x599dce=_0x4ee54a?0x0:_0x443871['offset'];var _0x3209d5=_0x4ee54a?_0x41455c[_0x8da3('0x21')]:_0x443871[_0x8da3('0x22')]+_0x443871['limit'];var _0x48bce3;if(_0x3209d5>=_0x578087){_0x3209d5=_0x578087;_0x48bce3=0xc8;}else{_0x48bce3=0xce;}_0x2a3b4e[_0x8da3('0x1c')](_0x48bce3);return _0x2a3b4e['set'](_0x8da3('0x23'),_0x599dce+'-'+_0x3209d5+'/'+_0x578087)[_0x8da3('0x1e')](_0x41455c);}return null;};}function patchUpdates(_0xe1ffbd){return function(_0x3a118f){try{jsonpatch['apply'](_0x3a118f,_0xe1ffbd,!![]);}catch(_0x584dc3){return BPromise[_0x8da3('0x24')](_0x584dc3);}return _0x3a118f[_0x8da3('0x25')]();};}function saveUpdates(_0x189bac,_0x309dbe){return function(_0x4ad979){if(_0x4ad979){return _0x4ad979[_0x8da3('0x26')](_0x189bac)[_0x8da3('0x27')](function(_0x201b69){return _0x201b69;});}return null;};}function removeEntity(_0xbb236c,_0x1c97b7){return function(_0x493324){if(_0x493324){return _0x493324[_0x8da3('0x28')]()[_0x8da3('0x27')](function(){var _0x48496f=_0x493324[_0x8da3('0x29')]({'plain':!![]});var _0x571f05=_0x8da3('0x2a');return db['UserProfileResource'][_0x8da3('0x28')]({'where':{'type':_0x571f05,'resourceId':_0x48496f['id']}})[_0x8da3('0x27')](function(){return _0x493324;});})['then'](function(){_0xbb236c[_0x8da3('0x1c')](0xcc)[_0x8da3('0x1d')]();});}};}function handleEntityNotFound(_0x3872b1,_0x2fe16d){return function(_0x4f8027){if(!_0x4f8027){_0x3872b1[_0x8da3('0x1b')](0x194);}return _0x4f8027;};}function handleError(_0x5b0b90,_0x26ffa2){_0x26ffa2=_0x26ffa2||0x1f4;return function(_0x454ca9){logger['error'](_0x454ca9['stack']);if(_0x454ca9[_0x8da3('0x2b')]){delete _0x454ca9[_0x8da3('0x2b')];}_0x5b0b90[_0x8da3('0x1c')](_0x26ffa2)[_0x8da3('0x2c')](_0x454ca9);};}exports[_0x8da3('0x2d')]=function(_0x55f3d6,_0x4c6ee5){var _0x18eb39={},_0x949a01={},_0x3b61de={'count':0x0,'rows':[]};var _0x31c976=_[_0x8da3('0x2e')](db[_0x8da3('0x2f')][_0x8da3('0x30')],function(_0x3ea86e){return{'name':_0x3ea86e[_0x8da3('0x31')],'type':_0x3ea86e[_0x8da3('0x32')][_0x8da3('0x33')]};});_0x949a01['model']=_[_0x8da3('0x2e')](_0x31c976,_0x8da3('0x2b'));_0x949a01[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0x55f3d6[_0x8da3('0x34')]);_0x949a01[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x949a01[_0x8da3('0x38')],_0x949a01[_0x8da3('0x34')]);_0x18eb39[_0x8da3('0x39')]=_['intersection'](_0x949a01[_0x8da3('0x38')],qs[_0x8da3('0x3a')](_0x55f3d6['query'][_0x8da3('0x3a')]));_0x18eb39['attributes']=_0x18eb39[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x18eb39[_0x8da3('0x39')]:_0x949a01['model'];if(!_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x3c')](_0x8da3('0x3d'))){_0x18eb39[_0x8da3('0x20')]=qs['limit'](_0x55f3d6['query'][_0x8da3('0x20')]);_0x18eb39['offset']=qs[_0x8da3('0x22')](_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x22')]);}_0x18eb39[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0x55f3d6[_0x8da3('0x34')]['sort']);_0x18eb39[_0x8da3('0x40')]=qs[_0x8da3('0x36')](_['pick'](_0x55f3d6[_0x8da3('0x34')],_0x949a01[_0x8da3('0x36')]),_0x31c976);if(_0x55f3d6[_0x8da3('0x34')]['filter']){_0x18eb39[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x18eb39['where'],{'$or':_['map'](_0x31c976,function(_0x316e60){if(_0x316e60['type']!==_0x8da3('0x42')){var _0x45a16e={};_0x45a16e[_0x316e60[_0x8da3('0x2b')]]={'$like':'%'+_0x55f3d6[_0x8da3('0x34')][_0x8da3('0x43')]+'%'};return _0x45a16e;}})});}_0x18eb39=_['merge']({},_0x18eb39,_0x55f3d6['options']);var _0x36ea66={'where':_0x18eb39[_0x8da3('0x40')]};return db[_0x8da3('0x2f')][_0x8da3('0x21')](_0x36ea66)['then'](function(_0x59c279){_0x3b61de['count']=_0x59c279;if(_0x55f3d6[_0x8da3('0x34')]['includeAll']){_0x18eb39[_0x8da3('0x44')]=[{'all':!![]}];}return db[_0x8da3('0x2f')][_0x8da3('0x45')](_0x18eb39);})['then'](function(_0x2bbf5f){_0x3b61de[_0x8da3('0x46')]=_0x2bbf5f;return _0x3b61de;})[_0x8da3('0x27')](respondWithFilteredResult(_0x4c6ee5,_0x18eb39))[_0x8da3('0x47')](handleError(_0x4c6ee5,null));};exports[_0x8da3('0x48')]=function(_0x329394,_0x58cd02){var _0x55df6d={'raw':!![],'where':{'id':_0x329394[_0x8da3('0x49')]['id']}},_0x2a29a1={};_0x2a29a1[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x2f')][_0x8da3('0x30')]);_0x2a29a1[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0x329394[_0x8da3('0x34')]);_0x2a29a1[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x2a29a1[_0x8da3('0x38')],_0x2a29a1[_0x8da3('0x34')]);_0x55df6d[_0x8da3('0x39')]=_[_0x8da3('0x37')](_0x2a29a1[_0x8da3('0x38')],qs[_0x8da3('0x3a')](_0x329394[_0x8da3('0x34')]['fields']));_0x55df6d[_0x8da3('0x39')]=_0x55df6d['attributes'][_0x8da3('0x3b')]?_0x55df6d[_0x8da3('0x39')]:_0x2a29a1[_0x8da3('0x38')];if(_0x329394['query'][_0x8da3('0x4a')]){_0x55df6d[_0x8da3('0x44')]=[{'all':!![]}];}_0x55df6d=_[_0x8da3('0x41')]({},_0x55df6d,_0x329394[_0x8da3('0x4b')]);return db[_0x8da3('0x2f')]['find'](_0x55df6d)[_0x8da3('0x27')](handleEntityNotFound(_0x58cd02,null))[_0x8da3('0x27')](respondWithResult(_0x58cd02,null))['catch'](handleError(_0x58cd02,null));};exports[_0x8da3('0x4c')]=function(_0x4d73e2,_0x52e6ff){return db['OpenchannelQueue'][_0x8da3('0x4c')](_0x4d73e2[_0x8da3('0x4d')],{})[_0x8da3('0x27')](function(_0x5828f8){var _0x407f0e=_0x4d73e2[_0x8da3('0x4e')][_0x8da3('0x29')]({'plain':!![]});if(!_0x407f0e)throw new Error(_0x8da3('0x4f'));if(_0x407f0e[_0x8da3('0x50')]===_0x8da3('0x4e')){var _0xe92f3b=_0x5828f8[_0x8da3('0x29')]({'plain':!![]});var _0x11f854=_0x8da3('0x2a');return db[_0x8da3('0x51')]['find']({'where':{'name':_0x11f854,'userProfileId':_0x407f0e[_0x8da3('0x52')]},'raw':!![]})[_0x8da3('0x27')](function(_0x538425){if(_0x538425&&_0x538425['autoAssociation']===0x0){return db[_0x8da3('0x53')][_0x8da3('0x4c')]({'name':_0xe92f3b[_0x8da3('0x2b')],'resourceId':_0xe92f3b['id'],'type':_0x538425[_0x8da3('0x2b')],'sectionId':_0x538425['id']},{})['then'](function(){return _0x5828f8;});}else{return _0x5828f8;}})[_0x8da3('0x47')](function(_0x4f2b77){logger['error'](_0x8da3('0x54'),_0x4f2b77);throw _0x4f2b77;});}return _0x5828f8;})[_0x8da3('0x27')](respondWithResult(_0x52e6ff,0xc9))[_0x8da3('0x47')](handleError(_0x52e6ff,null));};exports[_0x8da3('0x26')]=function(_0x1d3cb3,_0x4f7821){if(_0x1d3cb3['body']['id']){delete _0x1d3cb3[_0x8da3('0x4d')]['id'];}return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x1d3cb3[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x4f7821,null))[_0x8da3('0x27')](saveUpdates(_0x1d3cb3[_0x8da3('0x4d')],null))['then'](respondWithResult(_0x4f7821,null))[_0x8da3('0x47')](handleError(_0x4f7821,null));};exports[_0x8da3('0x28')]=function(_0x5caa01,_0x4f17b2){return db['OpenchannelQueue'][_0x8da3('0x55')]({'where':{'id':_0x5caa01[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x4f17b2,null))[_0x8da3('0x27')](removeEntity(_0x4f17b2,null))['catch'](handleError(_0x4f17b2,null));};exports['describe']=function(_0x3ce91e,_0x1c4d07){return db['OpenchannelQueue']['describe']()[_0x8da3('0x27')](respondWithResult(_0x1c4d07,null))['catch'](handleError(_0x1c4d07,null));};exports[_0x8da3('0x56')]=function(_0xff7997,_0xe61eba,_0x53d946){var _0x1d7ddc={'raw':!![],'where':{}},_0x5a03d5={},_0x212505;return db[_0x8da3('0x2f')][_0x8da3('0x57')]({'where':{'id':_0xff7997[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0xe61eba,null))[_0x8da3('0x27')](function(_0x1c7b8a){if(_0x1c7b8a){_0x212505=_0x1c7b8a[_0x8da3('0x29')]({'plain':!![]});_0x5a03d5['model']=_[_0x8da3('0x35')](db[_0x8da3('0x58')]['rawAttributes']);_0x5a03d5[_0x8da3('0x34')]=_[_0x8da3('0x35')](_0xff7997[_0x8da3('0x34')]);_0x5a03d5[_0x8da3('0x36')]=_['intersection'](_0x5a03d5['model'],_0x5a03d5['query']);_0x1d7ddc['attributes']=_[_0x8da3('0x37')](_0x5a03d5['model'],qs[_0x8da3('0x3a')](_0xff7997['query'][_0x8da3('0x3a')]));_0x1d7ddc[_0x8da3('0x39')]=_0x1d7ddc[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x1d7ddc['attributes']:_0x5a03d5[_0x8da3('0x38')];if(!_0xff7997[_0x8da3('0x34')]['hasOwnProperty']('nolimit')){_0x1d7ddc['limit']=qs[_0x8da3('0x20')](_0xff7997[_0x8da3('0x34')]['limit']);_0x1d7ddc[_0x8da3('0x22')]=qs[_0x8da3('0x22')](_0xff7997[_0x8da3('0x34')]['offset']);}_0x1d7ddc[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0xff7997['query'][_0x8da3('0x3f')]);_0x1d7ddc[_0x8da3('0x40')]=qs[_0x8da3('0x36')](_[_0x8da3('0x59')](_0xff7997[_0x8da3('0x34')],_0x5a03d5[_0x8da3('0x36')]));_0x1d7ddc['where'][_0x8da3('0x5a')]=_0x1c7b8a['id'];if(_0xff7997['query'][_0x8da3('0x43')]){_0x1d7ddc[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x1d7ddc[_0x8da3('0x40')],{'$or':_[_0x8da3('0x2e')](_0x1d7ddc['attributes'],function(_0x5211bc){var _0x32d395={};_0x32d395[_0x5211bc]={'$like':'%'+_0xff7997[_0x8da3('0x34')]['filter']+'%'};return _0x32d395;})});}_0x1d7ddc=_[_0x8da3('0x41')]({},_0x1d7ddc,_0xff7997[_0x8da3('0x4b')]);return db[_0x8da3('0x58')][_0x8da3('0x45')](_0x1d7ddc);}})[_0x8da3('0x27')](function(_0x592b9c){if(_0x592b9c){return db[_0x8da3('0x5b')][_0x8da3('0x5c')]({'where':{'id':_[_0x8da3('0x2e')](_0x592b9c,'UserId'),'role':_0x8da3('0x5d')},'attributes':['id',_0x8da3('0x2b'),'openchannelPause','updatedAt',_0x8da3('0x5e')]});}})[_0x8da3('0x27')](function(_0x8b2cd){if(_0x8b2cd){return{'count':_0x8b2cd[_0x8da3('0x21')],'rows':_[_0x8da3('0x2e')](_0x8b2cd[_0x8da3('0x46')],function(_0x1785fc){return{'membername':_0x1785fc[_0x8da3('0x2b')],'UserId':_0x1785fc['id'],'queue_name':_0x212505[_0x8da3('0x2b')],'OpenchannelQueueId':_0x212505['id'],'interface':util['format'](_0x8da3('0x5f'),_0x8da3('0x60'),_0x1785fc[_0x8da3('0x2b')]),'penalty':0x0,'paused':_0x1785fc['openchannelPause'],'createdAt':_0x1785fc[_0x8da3('0x5e')],'updatedAt':_0x1785fc[_0x8da3('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8da3('0x27')](respondWithFilteredResult(_0xe61eba,_0x1d7ddc))[_0x8da3('0x47')](handleError(_0xe61eba,null));};exports['getTeams']=function(_0x205218,_0x5cad4d,_0x3c31bc){var _0x5e813d={};var _0x2d67f3={};var _0x2deb72;var _0x5d8627;return db[_0x8da3('0x2f')]['findOne']({'where':{'id':_0x205218[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x5cad4d,null))[_0x8da3('0x27')](function(_0x1a7609){if(_0x1a7609){_0x2deb72=_0x1a7609;_0x2d67f3[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x62')][_0x8da3('0x30')]);_0x2d67f3[_0x8da3('0x34')]=_['keys'](_0x205218[_0x8da3('0x34')]);_0x2d67f3[_0x8da3('0x36')]=_['intersection'](_0x2d67f3[_0x8da3('0x38')],_0x2d67f3[_0x8da3('0x34')]);_0x5e813d['attributes']=_[_0x8da3('0x37')](_0x2d67f3[_0x8da3('0x38')],qs['fields'](_0x205218['query'][_0x8da3('0x3a')]));_0x5e813d[_0x8da3('0x39')]=_0x5e813d[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x5e813d[_0x8da3('0x39')]:_0x2d67f3[_0x8da3('0x38')];_0x5e813d['order']=qs[_0x8da3('0x3f')](_0x205218[_0x8da3('0x34')]['sort']);_0x5e813d['where']=qs[_0x8da3('0x36')](_[_0x8da3('0x59')](_0x205218[_0x8da3('0x34')],_0x2d67f3['filters']));if(_0x205218[_0x8da3('0x34')][_0x8da3('0x43')]){_0x5e813d['where']=_[_0x8da3('0x41')](_0x5e813d['where'],{'$or':_[_0x8da3('0x2e')](_0x5e813d['attributes'],function(_0xf3fe28){var _0x3b9d83={};_0x3b9d83[_0xf3fe28]={'$like':'%'+_0x205218[_0x8da3('0x34')]['filter']+'%'};return _0x3b9d83;})});}_0x5e813d=_[_0x8da3('0x41')]({},_0x5e813d,_0x205218[_0x8da3('0x4b')]);return _0x2deb72['getTeams'](_0x5e813d);}})[_0x8da3('0x27')](function(_0x11dcd3){if(_0x11dcd3){_0x5d8627=_0x11dcd3[_0x8da3('0x3b')];if(!_0x205218[_0x8da3('0x34')]['hasOwnProperty'](_0x8da3('0x3d'))){_0x5e813d['limit']=qs[_0x8da3('0x20')](_0x205218[_0x8da3('0x34')][_0x8da3('0x20')]);_0x5e813d[_0x8da3('0x22')]=qs['offset'](_0x205218['query'][_0x8da3('0x22')]);}return _0x2deb72[_0x8da3('0x63')](_0x5e813d);}})[_0x8da3('0x27')](function(_0x25ae68){if(_0x25ae68){return _0x25ae68?{'count':_0x5d8627,'rows':_0x25ae68}:null;}})[_0x8da3('0x27')](respondWithResult(_0x5cad4d,null))['catch'](handleError(_0x5cad4d,null));};exports[_0x8da3('0x64')]=function(_0x882a1,_0x1b77e5,_0x302ef4){var _0x13ecf3=_0x882a1[_0x8da3('0x4d')]['ids'];return db[_0x8da3('0x62')][_0x8da3('0x45')]({'where':{'id':_0x13ecf3},'attributes':['id'],'include':[{'model':db[_0x8da3('0x5b')],'as':_0x8da3('0x65'),'attributes':['id','name','online',_0x8da3('0x66'),'interface'],'raw':!![]}]})[_0x8da3('0x27')](function(_0x4233fb){if(_0x4233fb){var _0x415d0f=_[_0x8da3('0x67')](_0x4233fb,function(_0x295a2d){var _0x491e85=_0x295a2d[_0x8da3('0x29')]({'plain':!![]});return _0x491e85[_0x8da3('0x65')];});return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x882a1[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](function(_0x46fdc7){return db[_0x8da3('0x68')][_0x8da3('0x69')](function(_0x17829e){return _0x46fdc7[_0x8da3('0x64')](_0x13ecf3,{'transaction':_0x17829e})[_0x8da3('0x27')](function(){return BPromise[_0x8da3('0x6a')](_0x415d0f,function(_0x3588f1){return db[_0x8da3('0x58')]['findOrCreate']({'where':{'UserId':_0x3588f1['id'],'OpenchannelQueueId':_0x882a1[_0x8da3('0x49')]['id']},'transaction':_0x17829e});});})[_0x8da3('0x27')](function(){_0x415d0f[_0x8da3('0x6b')](function(_0x58c4d1){socket['emit'](_0x8da3('0x6c'),{'UserId':_0x58c4d1['id'],'OpenchannelQueueId':_0x46fdc7['id']});});});});});}})[_0x8da3('0x27')](respondWithStatusCode(_0x1b77e5,null))['catch'](handleError(_0x1b77e5,null));};exports[_0x8da3('0x6d')]=function(_0x372f49,_0x215249,_0x56abcd){return db[_0x8da3('0x62')][_0x8da3('0x45')]({'where':{'id':_0x372f49['query'][_0x8da3('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x8da3('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8da3('0x27')](handleEntityNotFound(_0x215249,null))[_0x8da3('0x27')](function(_0x3747ba){var _0x376d74=_[_0x8da3('0x2e')](_0x3747ba,'id');var _0x2ed956=[];var _0x31b281=[];var _0x3162c1=squel['select']();_0x3162c1[_0x8da3('0x6f')](_0x8da3('0x70'))['from'](_0x8da3('0x71'),'tq')[_0x8da3('0x72')]('user_has_teams','ut',_0x8da3('0x73'))[_0x8da3('0x40')](_0x8da3('0x74'),_0x372f49[_0x8da3('0x49')]['id']);for(var _0x554f43=0x0;_0x554f43<_0x3747ba[_0x8da3('0x3b')];_0x554f43+=0x1){let _0x4b5134=_0x3747ba[_0x554f43];for(var _0x4d075b=0x0;_0x4d075b<_0x4b5134[_0x8da3('0x65')][_0x8da3('0x3b')];_0x4d075b+=0x1){let _0x16052c=_0x4b5134[_0x8da3('0x65')][_0x4d075b];var _0x370144=_0x3162c1[_0x8da3('0x75')]();_0x370144['where']('ut.UserId\x20=\x20?',_0x16052c['id']);_0x31b281['push'](db[_0x8da3('0x68')][_0x8da3('0x34')](_0x370144[_0x8da3('0x76')](),{'type':db['sequelize'][_0x8da3('0x77')][_0x8da3('0x78')]})[_0x8da3('0x27')](function(_0x3ab172){if(_0x3ab172[_0x8da3('0x3b')]===0x1){return _0x16052c['id'];}else{var _0x3b8330=_[_0x8da3('0x79')](_[_0x8da3('0x2e')](_0x3ab172,_0x8da3('0x7a')),function(_0x562b0f){return _['includes'](_0x376d74,_0x562b0f);});if(_0x3b8330){return _0x16052c['id'];}}}));}}return BPromise['all'](_0x31b281)[_0x8da3('0x27')](function(_0x14b813){_0x2ed956=_(_0x2ed956)[_0x8da3('0x7b')](_0x14b813)[_0x8da3('0x7c')]()[_0x8da3('0x7d')]();return db['OpenchannelQueue'][_0x8da3('0x55')]({'where':{'id':_0x372f49[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](function(_0x232d13){return db['sequelize'][_0x8da3('0x69')](function(_0x137454){return _0x232d13['removeTeams'](_0x372f49[_0x8da3('0x34')][_0x8da3('0x6e')],{'transaction':_0x137454})[_0x8da3('0x27')](function(){if(!_['isEmpty'](_0x2ed956)){return _0x232d13[_0x8da3('0x7e')](_0x2ed956,{'transaction':_0x137454});}})[_0x8da3('0x27')](function(){_0x2ed956[_0x8da3('0x6b')](function(_0x406d33){socket[_0x8da3('0x7f')](_0x8da3('0x80'),{'UserId':_0x406d33,'OpenchannelQueueId':_0x232d13['id']});});});});});});})['then'](respondWithStatusCode(_0x215249,null))[_0x8da3('0x47')](handleError(_0x215249,null));};exports[_0x8da3('0x81')]=function(_0x3b06fd,_0x1df1aa,_0x3aab38){return db[_0x8da3('0x2f')]['find']({'where':{'id':_0x3b06fd[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x1df1aa,null))['then'](function(_0x260ee9){if(_0x260ee9){return _0x260ee9[_0x8da3('0x81')](_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')],_[_0x8da3('0x82')](_0x3b06fd[_0x8da3('0x4d')],['ids','id'])||{})[_0x8da3('0x83')](function(_0xe48de3){for(var _0x55387e=0x0;_0x55387e<_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')]['length'];_0x55387e+=0x1){socket[_0x8da3('0x7f')](_0x8da3('0x6c'),{'UserId':Number(_0x3b06fd[_0x8da3('0x4d')][_0x8da3('0x6e')][_0x55387e]),'OpenchannelQueueId':Number(_0x3b06fd['params']['id'])});}return _0xe48de3;});}})[_0x8da3('0x27')](respondWithResult(_0x1df1aa,null))[_0x8da3('0x47')](handleError(_0x1df1aa,null));};exports[_0x8da3('0x7e')]=function(_0x25dc35,_0x2300ee,_0x4a48af){return db[_0x8da3('0x2f')][_0x8da3('0x55')]({'where':{'id':_0x25dc35['params']['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0x2300ee,null))[_0x8da3('0x27')](function(_0x499b18){if(_0x499b18){return _0x499b18['removeAgents'](_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')])[_0x8da3('0x27')](function(){if(_[_0x8da3('0x84')](_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')])){for(var _0x8a3a24=0x0;_0x8a3a24<_0x25dc35['query'][_0x8da3('0x6e')][_0x8da3('0x3b')];_0x8a3a24+=0x1){socket[_0x8da3('0x7f')](_0x8da3('0x80'),{'UserId':Number(_0x25dc35[_0x8da3('0x34')][_0x8da3('0x6e')][_0x8a3a24]),'OpenchannelQueueId':Number(_0x25dc35['params']['id'])});}}else{socket[_0x8da3('0x7f')]('userOpenchannelQueue:remove',{'UserId':Number(_0x25dc35[_0x8da3('0x34')]['ids']),'OpenchannelQueueId':Number(_0x25dc35[_0x8da3('0x49')]['id'])});}});}})[_0x8da3('0x27')](respondWithStatusCode(_0x2300ee,null))[_0x8da3('0x47')](handleError(_0x2300ee,null));};exports[_0x8da3('0x85')]=function(_0x44be7b,_0xf5fa55,_0x3adafc){var _0x5d5dd8={};var _0x14eeb2={};var _0x2c0fec;var _0x36a16b;return db[_0x8da3('0x2f')][_0x8da3('0x57')]({'where':{'id':_0x44be7b[_0x8da3('0x49')]['id']}})[_0x8da3('0x27')](handleEntityNotFound(_0xf5fa55,null))[_0x8da3('0x27')](function(_0x57f2db){if(_0x57f2db){_0x2c0fec=_0x57f2db;_0x14eeb2[_0x8da3('0x38')]=_[_0x8da3('0x35')](db[_0x8da3('0x5b')][_0x8da3('0x30')]);_0x14eeb2[_0x8da3('0x34')]=_['keys'](_0x44be7b[_0x8da3('0x34')]);_0x14eeb2[_0x8da3('0x36')]=_[_0x8da3('0x37')](_0x14eeb2[_0x8da3('0x38')],_0x14eeb2[_0x8da3('0x34')]);_0x5d5dd8[_0x8da3('0x39')]=_[_0x8da3('0x37')](_0x14eeb2[_0x8da3('0x38')],qs['fields'](_0x44be7b[_0x8da3('0x34')]['fields']));_0x5d5dd8[_0x8da3('0x39')]=_0x5d5dd8[_0x8da3('0x39')][_0x8da3('0x3b')]?_0x5d5dd8['attributes']:_0x14eeb2[_0x8da3('0x38')];_0x5d5dd8[_0x8da3('0x3e')]=qs[_0x8da3('0x3f')](_0x44be7b['query'][_0x8da3('0x3f')]);_0x5d5dd8[_0x8da3('0x40')]=qs['filters'](_[_0x8da3('0x59')](_0x44be7b['query'],_0x14eeb2[_0x8da3('0x36')]));if(_0x44be7b['query'][_0x8da3('0x43')]){_0x5d5dd8[_0x8da3('0x40')]=_[_0x8da3('0x41')](_0x5d5dd8['where'],{'$or':_[_0x8da3('0x2e')](_0x5d5dd8[_0x8da3('0x39')],function(_0x3c3700){var _0x512274={};_0x512274[_0x3c3700]={'$like':'%'+_0x44be7b[_0x8da3('0x34')][_0x8da3('0x43')]+'%'};return _0x512274;})});}_0x5d5dd8=_[_0x8da3('0x41')]({},_0x5d5dd8,_0x44be7b[_0x8da3('0x4b')]);return _0x2c0fec[_0x8da3('0x85')](_0x5d5dd8);}})[_0x8da3('0x27')](function(_0x856c8d){if(_0x856c8d){_0x36a16b=_0x856c8d['length'];if(!_0x44be7b[_0x8da3('0x34')][_0x8da3('0x3c')](_0x8da3('0x3d'))){_0x5d5dd8[_0x8da3('0x20')]=qs[_0x8da3('0x20')](_0x44be7b['query'][_0x8da3('0x20')]);_0x5d5dd8[_0x8da3('0x22')]=qs[_0x8da3('0x22')](_0x44be7b[_0x8da3('0x34')]['offset']);}return _0x2c0fec[_0x8da3('0x85')](_0x5d5dd8);}})[_0x8da3('0x27')](function(_0x3db61b){if(_0x3db61b){return _0x3db61b?{'count':_0x36a16b,'rows':_0x3db61b}:null;}})[_0x8da3('0x27')](respondWithResult(_0xf5fa55,null))[_0x8da3('0x47')](handleError(_0xf5fa55,null));}; \ No newline at end of file +var _0x0c8c=['findOne','Team','getTeams','addTeams','ids','online','voicePause','interface','Agents','sequelize','transaction','forEach','emit','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','omit','spread','removeAgents','userOpenchannelQueue:remove','getAgents','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','undefined','set','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','index','fieldName','key','query','filters','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','map','name','merge','options','OpenchannelQueue','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x0c8c,0xac));var _0xc0c8=function(_0x332fd2,_0x3d410c){_0x332fd2=_0x332fd2-0x0;var _0x1c1f0e=_0x0c8c[_0x332fd2];return _0x1c1f0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc0c8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc0c8('0x2'));var Mustache=require(_0xc0c8('0x3'));var util=require(_0xc0c8('0x4'));var path=require(_0xc0c8('0x5'));var sox=require(_0xc0c8('0x6'));var csv=require(_0xc0c8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0c8('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc0c8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc0c8('0xa'));var toCsv=require(_0xc0c8('0x7'));var querystring=require(_0xc0c8('0xb'));var Papa=require(_0xc0c8('0xc'));var Redis=require(_0xc0c8('0xd'));var authService=require(_0xc0c8('0xe'));var qs=require(_0xc0c8('0xf'));var as=require(_0xc0c8('0x10'));var hardwareService=require(_0xc0c8('0x11'));var logger=require(_0xc0c8('0x12'))('api');var utils=require(_0xc0c8('0x13'));var config=require(_0xc0c8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0c8('0x15'))['db'];config[_0xc0c8('0x16')]=_['defaults'](config[_0xc0c8('0x16')],{'host':_0xc0c8('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0c8('0x16')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x25431e,_0x2d4171){_0x2d4171=_0x2d4171||0xcc;return function(_0x1ab644){if(_0x1ab644){return _0x25431e[_0xc0c8('0x18')](_0x2d4171);}return _0x25431e[_0xc0c8('0x19')](_0x2d4171)[_0xc0c8('0x1a')]();};}function respondWithResult(_0x419270,_0xf39b67){_0xf39b67=_0xf39b67||0xc8;return function(_0x473f48){if(_0x473f48){return _0x419270[_0xc0c8('0x19')](_0xf39b67)[_0xc0c8('0x1b')](_0x473f48);}};}function respondWithFilteredResult(_0x7075f,_0x15f0fd){return function(_0x8a0a2f){if(_0x8a0a2f){var _0x316825=typeof _0x15f0fd[_0xc0c8('0x1c')]===_0xc0c8('0x1d')&&typeof _0x15f0fd['limit']===_0xc0c8('0x1d');var _0x188e28=_0x8a0a2f['count'];var _0x13238c=_0x316825?0x0:_0x15f0fd[_0xc0c8('0x1c')];var _0x5ba8b2=_0x316825?_0x8a0a2f['count']:_0x15f0fd[_0xc0c8('0x1c')]+_0x15f0fd['limit'];var _0x16b4c;if(_0x5ba8b2>=_0x188e28){_0x5ba8b2=_0x188e28;_0x16b4c=0xc8;}else{_0x16b4c=0xce;}_0x7075f[_0xc0c8('0x19')](_0x16b4c);return _0x7075f[_0xc0c8('0x1e')]('Content-Range',_0x13238c+'-'+_0x5ba8b2+'/'+_0x188e28)['json'](_0x8a0a2f);}return null;};}function patchUpdates(_0x5b589e){return function(_0x4c3fcc){try{jsonpatch[_0xc0c8('0x1f')](_0x4c3fcc,_0x5b589e,!![]);}catch(_0x3af566){return BPromise[_0xc0c8('0x20')](_0x3af566);}return _0x4c3fcc[_0xc0c8('0x21')]();};}function saveUpdates(_0xa42af7,_0x124cf9){return function(_0x368c27){if(_0x368c27){return _0x368c27[_0xc0c8('0x22')](_0xa42af7)[_0xc0c8('0x23')](function(_0x38d9e1){return _0x38d9e1;});}return null;};}function removeEntity(_0x59e8a2,_0x3c7bb5){return function(_0x126d94){if(_0x126d94){return _0x126d94[_0xc0c8('0x24')]()[_0xc0c8('0x23')](function(){var _0x21395c=_0x126d94[_0xc0c8('0x25')]({'plain':!![]});var _0x5a28f9=_0xc0c8('0x26');return db[_0xc0c8('0x27')][_0xc0c8('0x24')]({'where':{'type':_0x5a28f9,'resourceId':_0x21395c['id']}})['then'](function(){return _0x126d94;});})[_0xc0c8('0x23')](function(){_0x59e8a2[_0xc0c8('0x19')](0xcc)[_0xc0c8('0x1a')]();});}};}function handleEntityNotFound(_0xfd73e1,_0x1c5cf0){return function(_0x25cfe1){if(!_0x25cfe1){_0xfd73e1[_0xc0c8('0x18')](0x194);}return _0x25cfe1;};}function handleError(_0x186349,_0x5723d7){_0x5723d7=_0x5723d7||0x1f4;return function(_0x375750){logger[_0xc0c8('0x28')](_0x375750[_0xc0c8('0x29')]);if(_0x375750['name']){delete _0x375750['name'];}_0x186349['status'](_0x5723d7)['send'](_0x375750);};}exports[_0xc0c8('0x2a')]=function(_0x5a64b1,_0xc9e4aa){var _0x489174={},_0x586ea6={},_0x1e1901={'count':0x0,'rows':[]};var _0x591ad9=_['map'](db['OpenchannelQueue']['rawAttributes'],function(_0x2f9c14){return{'name':_0x2f9c14[_0xc0c8('0x2b')],'type':_0x2f9c14['type'][_0xc0c8('0x2c')]};});_0x586ea6['model']=_['map'](_0x591ad9,'name');_0x586ea6['query']=_['keys'](_0x5a64b1[_0xc0c8('0x2d')]);_0x586ea6[_0xc0c8('0x2e')]=_['intersection'](_0x586ea6['model'],_0x586ea6[_0xc0c8('0x2d')]);_0x489174[_0xc0c8('0x2f')]=_['intersection'](_0x586ea6[_0xc0c8('0x30')],qs[_0xc0c8('0x31')](_0x5a64b1['query'][_0xc0c8('0x31')]));_0x489174[_0xc0c8('0x2f')]=_0x489174[_0xc0c8('0x2f')][_0xc0c8('0x32')]?_0x489174[_0xc0c8('0x2f')]:_0x586ea6[_0xc0c8('0x30')];if(!_0x5a64b1[_0xc0c8('0x2d')][_0xc0c8('0x33')](_0xc0c8('0x34'))){_0x489174[_0xc0c8('0x35')]=qs[_0xc0c8('0x35')](_0x5a64b1['query'][_0xc0c8('0x35')]);_0x489174[_0xc0c8('0x1c')]=qs[_0xc0c8('0x1c')](_0x5a64b1[_0xc0c8('0x2d')]['offset']);}_0x489174[_0xc0c8('0x36')]=qs['sort'](_0x5a64b1[_0xc0c8('0x2d')][_0xc0c8('0x37')]);_0x489174[_0xc0c8('0x38')]=qs[_0xc0c8('0x2e')](_[_0xc0c8('0x39')](_0x5a64b1[_0xc0c8('0x2d')],_0x586ea6['filters']),_0x591ad9);if(_0x5a64b1[_0xc0c8('0x2d')][_0xc0c8('0x3a')]){_0x489174['where']=_['merge'](_0x489174[_0xc0c8('0x38')],{'$or':_[_0xc0c8('0x3b')](_0x591ad9,function(_0x7e5e62){if(_0x7e5e62['type']!=='VIRTUAL'){var _0xb5aa94={};_0xb5aa94[_0x7e5e62[_0xc0c8('0x3c')]]={'$like':'%'+_0x5a64b1[_0xc0c8('0x2d')][_0xc0c8('0x3a')]+'%'};return _0xb5aa94;}})});}_0x489174=_[_0xc0c8('0x3d')]({},_0x489174,_0x5a64b1[_0xc0c8('0x3e')]);var _0x1f886f={'where':_0x489174['where']};return db[_0xc0c8('0x3f')]['count'](_0x1f886f)[_0xc0c8('0x23')](function(_0x2cd0b5){_0x1e1901[_0xc0c8('0x40')]=_0x2cd0b5;if(_0x5a64b1[_0xc0c8('0x2d')][_0xc0c8('0x41')]){_0x489174[_0xc0c8('0x42')]=[{'all':!![]}];}return db[_0xc0c8('0x3f')][_0xc0c8('0x43')](_0x489174);})[_0xc0c8('0x23')](function(_0x1b36a4){_0x1e1901[_0xc0c8('0x44')]=_0x1b36a4;return _0x1e1901;})[_0xc0c8('0x23')](respondWithFilteredResult(_0xc9e4aa,_0x489174))[_0xc0c8('0x45')](handleError(_0xc9e4aa,null));};exports[_0xc0c8('0x46')]=function(_0x9f6537,_0x1c3f0c){var _0x6cb400={'raw':!![],'where':{'id':_0x9f6537[_0xc0c8('0x47')]['id']}},_0x520fbd={};_0x520fbd[_0xc0c8('0x30')]=_[_0xc0c8('0x48')](db[_0xc0c8('0x3f')][_0xc0c8('0x49')]);_0x520fbd[_0xc0c8('0x2d')]=_[_0xc0c8('0x48')](_0x9f6537['query']);_0x520fbd['filters']=_['intersection'](_0x520fbd[_0xc0c8('0x30')],_0x520fbd[_0xc0c8('0x2d')]);_0x6cb400[_0xc0c8('0x2f')]=_[_0xc0c8('0x4a')](_0x520fbd[_0xc0c8('0x30')],qs[_0xc0c8('0x31')](_0x9f6537[_0xc0c8('0x2d')][_0xc0c8('0x31')]));_0x6cb400[_0xc0c8('0x2f')]=_0x6cb400[_0xc0c8('0x2f')]['length']?_0x6cb400[_0xc0c8('0x2f')]:_0x520fbd[_0xc0c8('0x30')];if(_0x9f6537[_0xc0c8('0x2d')][_0xc0c8('0x41')]){_0x6cb400[_0xc0c8('0x42')]=[{'all':!![]}];}_0x6cb400=_['merge']({},_0x6cb400,_0x9f6537[_0xc0c8('0x3e')]);return db[_0xc0c8('0x3f')]['find'](_0x6cb400)['then'](handleEntityNotFound(_0x1c3f0c,null))[_0xc0c8('0x23')](respondWithResult(_0x1c3f0c,null))[_0xc0c8('0x45')](handleError(_0x1c3f0c,null));};exports[_0xc0c8('0x4b')]=function(_0x3b4db1,_0x436c53){return db['OpenchannelQueue'][_0xc0c8('0x4b')](_0x3b4db1[_0xc0c8('0x4c')],{})[_0xc0c8('0x23')](function(_0x190aba){var _0x3ce26b=_0x3b4db1['user'][_0xc0c8('0x25')]({'plain':!![]});if(!_0x3ce26b)throw new Error(_0xc0c8('0x4d'));if(_0x3ce26b[_0xc0c8('0x4e')]===_0xc0c8('0x4f')){var _0x5154dd=_0x190aba[_0xc0c8('0x25')]({'plain':!![]});var _0x2d106c='OpenchannelQueues';return db[_0xc0c8('0x50')][_0xc0c8('0x51')]({'where':{'name':_0x2d106c,'userProfileId':_0x3ce26b[_0xc0c8('0x52')]},'raw':!![]})[_0xc0c8('0x23')](function(_0x35105e){if(_0x35105e&&_0x35105e[_0xc0c8('0x53')]===0x0){return db[_0xc0c8('0x27')][_0xc0c8('0x4b')]({'name':_0x5154dd['name'],'resourceId':_0x5154dd['id'],'type':_0x35105e[_0xc0c8('0x3c')],'sectionId':_0x35105e['id']},{})[_0xc0c8('0x23')](function(){return _0x190aba;});}else{return _0x190aba;}})['catch'](function(_0x21335c){logger['error'](_0xc0c8('0x54'),_0x21335c);throw _0x21335c;});}return _0x190aba;})[_0xc0c8('0x23')](respondWithResult(_0x436c53,0xc9))['catch'](handleError(_0x436c53,null));};exports[_0xc0c8('0x22')]=function(_0x3e9d46,_0x3782b3){if(_0x3e9d46[_0xc0c8('0x4c')]['id']){delete _0x3e9d46[_0xc0c8('0x4c')]['id'];}return db['OpenchannelQueue'][_0xc0c8('0x51')]({'where':{'id':_0x3e9d46[_0xc0c8('0x47')]['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x3782b3,null))[_0xc0c8('0x23')](saveUpdates(_0x3e9d46[_0xc0c8('0x4c')],null))[_0xc0c8('0x23')](respondWithResult(_0x3782b3,null))['catch'](handleError(_0x3782b3,null));};exports[_0xc0c8('0x24')]=function(_0xaddea,_0x4fc626){return db['OpenchannelQueue'][_0xc0c8('0x51')]({'where':{'id':_0xaddea['params']['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x4fc626,null))[_0xc0c8('0x23')](removeEntity(_0x4fc626,null))[_0xc0c8('0x45')](handleError(_0x4fc626,null));};exports[_0xc0c8('0x55')]=function(_0x36d5ed,_0x1b0434){return db['OpenchannelQueue'][_0xc0c8('0x55')]()[_0xc0c8('0x23')](respondWithResult(_0x1b0434,null))[_0xc0c8('0x45')](handleError(_0x1b0434,null));};exports[_0xc0c8('0x56')]=function(_0x3f438d,_0x41d365,_0x1cac94){var _0x1c4fcf={'raw':!![],'where':{}},_0x32dd04={},_0x4b0f73;return db[_0xc0c8('0x3f')]['findOne']({'where':{'id':_0x3f438d[_0xc0c8('0x47')]['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x41d365,null))[_0xc0c8('0x23')](function(_0x366e41){if(_0x366e41){_0x4b0f73=_0x366e41['get']({'plain':!![]});_0x32dd04[_0xc0c8('0x30')]=_[_0xc0c8('0x48')](db[_0xc0c8('0x57')][_0xc0c8('0x49')]);_0x32dd04[_0xc0c8('0x2d')]=_['keys'](_0x3f438d[_0xc0c8('0x2d')]);_0x32dd04[_0xc0c8('0x2e')]=_['intersection'](_0x32dd04['model'],_0x32dd04[_0xc0c8('0x2d')]);_0x1c4fcf['attributes']=_[_0xc0c8('0x4a')](_0x32dd04[_0xc0c8('0x30')],qs[_0xc0c8('0x31')](_0x3f438d['query']['fields']));_0x1c4fcf[_0xc0c8('0x2f')]=_0x1c4fcf[_0xc0c8('0x2f')][_0xc0c8('0x32')]?_0x1c4fcf['attributes']:_0x32dd04[_0xc0c8('0x30')];if(!_0x3f438d[_0xc0c8('0x2d')][_0xc0c8('0x33')](_0xc0c8('0x34'))){_0x1c4fcf[_0xc0c8('0x35')]=qs[_0xc0c8('0x35')](_0x3f438d['query'][_0xc0c8('0x35')]);_0x1c4fcf[_0xc0c8('0x1c')]=qs['offset'](_0x3f438d[_0xc0c8('0x2d')][_0xc0c8('0x1c')]);}_0x1c4fcf[_0xc0c8('0x36')]=qs['sort'](_0x3f438d[_0xc0c8('0x2d')][_0xc0c8('0x37')]);_0x1c4fcf[_0xc0c8('0x38')]=qs[_0xc0c8('0x2e')](_[_0xc0c8('0x39')](_0x3f438d[_0xc0c8('0x2d')],_0x32dd04[_0xc0c8('0x2e')]));_0x1c4fcf[_0xc0c8('0x38')][_0xc0c8('0x58')]=_0x366e41['id'];if(_0x3f438d['query'][_0xc0c8('0x3a')]){_0x1c4fcf[_0xc0c8('0x38')]=_[_0xc0c8('0x3d')](_0x1c4fcf[_0xc0c8('0x38')],{'$or':_['map'](_0x1c4fcf['attributes'],function(_0x236a00){var _0x31a59c={};_0x31a59c[_0x236a00]={'$like':'%'+_0x3f438d[_0xc0c8('0x2d')][_0xc0c8('0x3a')]+'%'};return _0x31a59c;})});}_0x1c4fcf=_[_0xc0c8('0x3d')]({},_0x1c4fcf,_0x3f438d['options']);return db[_0xc0c8('0x57')][_0xc0c8('0x43')](_0x1c4fcf);}})[_0xc0c8('0x23')](function(_0x4ab750){if(_0x4ab750){return db[_0xc0c8('0x59')][_0xc0c8('0x5a')]({'where':{'id':_[_0xc0c8('0x3b')](_0x4ab750,_0xc0c8('0x5b')),'role':_0xc0c8('0x5c')},'attributes':['id','name',_0xc0c8('0x5d'),_0xc0c8('0x5e'),_0xc0c8('0x5f')]});}})[_0xc0c8('0x23')](function(_0xdde7d2){if(_0xdde7d2){return{'count':_0xdde7d2[_0xc0c8('0x40')],'rows':_[_0xc0c8('0x3b')](_0xdde7d2[_0xc0c8('0x44')],function(_0x4eb509){return{'membername':_0x4eb509[_0xc0c8('0x3c')],'UserId':_0x4eb509['id'],'queue_name':_0x4b0f73[_0xc0c8('0x3c')],'OpenchannelQueueId':_0x4b0f73['id'],'interface':util[_0xc0c8('0x60')](_0xc0c8('0x61'),'SIP',_0x4eb509[_0xc0c8('0x3c')]),'penalty':0x0,'paused':_0x4eb509['openchannelPause'],'createdAt':_0x4eb509['createdAt'],'updatedAt':_0x4eb509[_0xc0c8('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc0c8('0x23')](respondWithFilteredResult(_0x41d365,_0x1c4fcf))[_0xc0c8('0x45')](handleError(_0x41d365,null));};exports['getTeams']=function(_0xa479e2,_0x313f77,_0x312505){var _0x2d2066={};var _0xb43133={};var _0xa68998;var _0x8b666a;return db[_0xc0c8('0x3f')][_0xc0c8('0x62')]({'where':{'id':_0xa479e2[_0xc0c8('0x47')]['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x313f77,null))[_0xc0c8('0x23')](function(_0x1af710){if(_0x1af710){_0xa68998=_0x1af710;_0xb43133[_0xc0c8('0x30')]=_[_0xc0c8('0x48')](db[_0xc0c8('0x63')][_0xc0c8('0x49')]);_0xb43133[_0xc0c8('0x2d')]=_[_0xc0c8('0x48')](_0xa479e2[_0xc0c8('0x2d')]);_0xb43133['filters']=_['intersection'](_0xb43133[_0xc0c8('0x30')],_0xb43133['query']);_0x2d2066[_0xc0c8('0x2f')]=_['intersection'](_0xb43133[_0xc0c8('0x30')],qs[_0xc0c8('0x31')](_0xa479e2[_0xc0c8('0x2d')][_0xc0c8('0x31')]));_0x2d2066['attributes']=_0x2d2066[_0xc0c8('0x2f')][_0xc0c8('0x32')]?_0x2d2066[_0xc0c8('0x2f')]:_0xb43133[_0xc0c8('0x30')];_0x2d2066['order']=qs[_0xc0c8('0x37')](_0xa479e2[_0xc0c8('0x2d')][_0xc0c8('0x37')]);_0x2d2066[_0xc0c8('0x38')]=qs[_0xc0c8('0x2e')](_[_0xc0c8('0x39')](_0xa479e2[_0xc0c8('0x2d')],_0xb43133[_0xc0c8('0x2e')]));if(_0xa479e2[_0xc0c8('0x2d')][_0xc0c8('0x3a')]){_0x2d2066['where']=_[_0xc0c8('0x3d')](_0x2d2066[_0xc0c8('0x38')],{'$or':_[_0xc0c8('0x3b')](_0x2d2066[_0xc0c8('0x2f')],function(_0x4319e5){var _0xf63a60={};_0xf63a60[_0x4319e5]={'$like':'%'+_0xa479e2[_0xc0c8('0x2d')]['filter']+'%'};return _0xf63a60;})});}_0x2d2066=_[_0xc0c8('0x3d')]({},_0x2d2066,_0xa479e2[_0xc0c8('0x3e')]);return _0xa68998[_0xc0c8('0x64')](_0x2d2066);}})[_0xc0c8('0x23')](function(_0x451f63){if(_0x451f63){_0x8b666a=_0x451f63[_0xc0c8('0x32')];if(!_0xa479e2['query']['hasOwnProperty']('nolimit')){_0x2d2066['limit']=qs[_0xc0c8('0x35')](_0xa479e2[_0xc0c8('0x2d')]['limit']);_0x2d2066[_0xc0c8('0x1c')]=qs[_0xc0c8('0x1c')](_0xa479e2[_0xc0c8('0x2d')][_0xc0c8('0x1c')]);}return _0xa68998[_0xc0c8('0x64')](_0x2d2066);}})[_0xc0c8('0x23')](function(_0x50c9e0){if(_0x50c9e0){return _0x50c9e0?{'count':_0x8b666a,'rows':_0x50c9e0}:null;}})[_0xc0c8('0x23')](respondWithResult(_0x313f77,null))['catch'](handleError(_0x313f77,null));};exports[_0xc0c8('0x65')]=function(_0x5ca5f5,_0x3fddff,_0x264e53){var _0x57deda=_0x5ca5f5[_0xc0c8('0x4c')][_0xc0c8('0x66')];return db[_0xc0c8('0x63')]['findAll']({'where':{'id':_0x57deda},'attributes':['id'],'include':[{'model':db[_0xc0c8('0x59')],'as':'Agents','attributes':['id','name',_0xc0c8('0x67'),_0xc0c8('0x68'),_0xc0c8('0x69')],'raw':!![]}]})[_0xc0c8('0x23')](function(_0x55b897){if(_0x55b897){var _0x35fc45=_['flatMap'](_0x55b897,function(_0x342dc1){var _0x3208b1=_0x342dc1[_0xc0c8('0x25')]({'plain':!![]});return _0x3208b1[_0xc0c8('0x6a')];});return db[_0xc0c8('0x3f')]['find']({'where':{'id':_0x5ca5f5[_0xc0c8('0x47')]['id']}})[_0xc0c8('0x23')](function(_0x5ce0ca){return db[_0xc0c8('0x6b')][_0xc0c8('0x6c')](function(_0xb39a2a){return _0x5ce0ca[_0xc0c8('0x65')](_0x57deda,{'transaction':_0xb39a2a})[_0xc0c8('0x23')](function(){return BPromise['each'](_0x35fc45,function(_0x21b747){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x21b747['id'],'OpenchannelQueueId':_0x5ca5f5[_0xc0c8('0x47')]['id']},'transaction':_0xb39a2a});});})[_0xc0c8('0x23')](function(){_0x35fc45[_0xc0c8('0x6d')](function(_0x5d2149){socket[_0xc0c8('0x6e')](_0xc0c8('0x6f'),{'UserId':_0x5d2149['id'],'OpenchannelQueueId':_0x5ce0ca['id']});});});});});}})[_0xc0c8('0x23')](respondWithStatusCode(_0x3fddff,null))[_0xc0c8('0x45')](handleError(_0x3fddff,null));};exports[_0xc0c8('0x70')]=function(_0x347a09,_0x9d907f,_0x5e3203){return db['Team'][_0xc0c8('0x43')]({'where':{'id':_0x347a09[_0xc0c8('0x2d')][_0xc0c8('0x66')]},'attributes':['id'],'include':[{'model':db[_0xc0c8('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc0c8('0x23')](handleEntityNotFound(_0x9d907f,null))['then'](function(_0xf6ab85){var _0x16532c=_['map'](_0xf6ab85,'id');var _0x2b0d01=[];var _0x3028d3=[];var _0x4d26ee=squel['select']();_0x4d26ee[_0xc0c8('0x71')](_0xc0c8('0x72'))['from']('team_has_openchannel_queues','tq')['join'](_0xc0c8('0x73'),'ut',_0xc0c8('0x74'))['where'](_0xc0c8('0x75'),_0x347a09['params']['id']);for(var _0x41d6c1=0x0;_0x41d6c1<_0xf6ab85[_0xc0c8('0x32')];_0x41d6c1+=0x1){let _0x59ee1b=_0xf6ab85[_0x41d6c1];for(var _0xa1f6e6=0x0;_0xa1f6e6<_0x59ee1b['Agents'][_0xc0c8('0x32')];_0xa1f6e6+=0x1){let _0x52716f=_0x59ee1b['Agents'][_0xa1f6e6];var _0x3c41d1=_0x4d26ee[_0xc0c8('0x76')]();_0x3c41d1[_0xc0c8('0x38')](_0xc0c8('0x77'),_0x52716f['id']);_0x3028d3[_0xc0c8('0x78')](db[_0xc0c8('0x6b')][_0xc0c8('0x2d')](_0x3c41d1[_0xc0c8('0x79')](),{'type':db[_0xc0c8('0x6b')]['QueryTypes'][_0xc0c8('0x7a')]})[_0xc0c8('0x23')](function(_0x230652){if(_0x230652['length']===0x1){return _0x52716f['id'];}else{var _0x112c02=_[_0xc0c8('0x7b')](_[_0xc0c8('0x3b')](_0x230652,_0xc0c8('0x7c')),function(_0x588c81){return _['includes'](_0x16532c,_0x588c81);});if(_0x112c02){return _0x52716f['id'];}}}));}}return BPromise[_0xc0c8('0x7d')](_0x3028d3)[_0xc0c8('0x23')](function(_0x23d134){_0x2b0d01=_(_0x2b0d01)[_0xc0c8('0x7e')](_0x23d134)[_0xc0c8('0x7f')]()[_0xc0c8('0x80')]();return db[_0xc0c8('0x3f')][_0xc0c8('0x51')]({'where':{'id':_0x347a09['params']['id']}})[_0xc0c8('0x23')](function(_0x12d8b7){return db[_0xc0c8('0x6b')][_0xc0c8('0x6c')](function(_0x7a689c){return _0x12d8b7[_0xc0c8('0x70')](_0x347a09['query'][_0xc0c8('0x66')],{'transaction':_0x7a689c})[_0xc0c8('0x23')](function(){if(!_[_0xc0c8('0x81')](_0x2b0d01)){return _0x12d8b7['removeAgents'](_0x2b0d01,{'transaction':_0x7a689c});}})[_0xc0c8('0x23')](function(){_0x2b0d01[_0xc0c8('0x6d')](function(_0x525ecf){socket[_0xc0c8('0x6e')]('userOpenchannelQueue:remove',{'UserId':_0x525ecf,'OpenchannelQueueId':_0x12d8b7['id']});});});});});});})[_0xc0c8('0x23')](respondWithStatusCode(_0x9d907f,null))['catch'](handleError(_0x9d907f,null));};exports['addAgents']=function(_0x61a6d2,_0x424915,_0x4cf2f0){return db['OpenchannelQueue'][_0xc0c8('0x51')]({'where':{'id':_0x61a6d2[_0xc0c8('0x47')]['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x424915,null))[_0xc0c8('0x23')](function(_0xd300f0){if(_0xd300f0){return _0xd300f0['addAgents'](_0x61a6d2[_0xc0c8('0x4c')][_0xc0c8('0x66')],_[_0xc0c8('0x82')](_0x61a6d2['body'],[_0xc0c8('0x66'),'id'])||{})[_0xc0c8('0x83')](function(_0x2385ea){for(var _0x83efd0=0x0;_0x83efd0<_0x61a6d2[_0xc0c8('0x4c')]['ids'][_0xc0c8('0x32')];_0x83efd0+=0x1){socket[_0xc0c8('0x6e')](_0xc0c8('0x6f'),{'UserId':Number(_0x61a6d2[_0xc0c8('0x4c')][_0xc0c8('0x66')][_0x83efd0]),'OpenchannelQueueId':Number(_0x61a6d2[_0xc0c8('0x47')]['id'])});}return _0x2385ea;});}})['then'](respondWithResult(_0x424915,null))[_0xc0c8('0x45')](handleError(_0x424915,null));};exports[_0xc0c8('0x84')]=function(_0x4986df,_0x4ec014,_0x367b66){return db[_0xc0c8('0x3f')][_0xc0c8('0x51')]({'where':{'id':_0x4986df['params']['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x4ec014,null))[_0xc0c8('0x23')](function(_0x569b26){if(_0x569b26){return _0x569b26[_0xc0c8('0x84')](_0x4986df['query'][_0xc0c8('0x66')])[_0xc0c8('0x23')](function(){if(_['isArray'](_0x4986df['query'][_0xc0c8('0x66')])){for(var _0x5e6c60=0x0;_0x5e6c60<_0x4986df[_0xc0c8('0x2d')]['ids'][_0xc0c8('0x32')];_0x5e6c60+=0x1){socket[_0xc0c8('0x6e')](_0xc0c8('0x85'),{'UserId':Number(_0x4986df['query'][_0xc0c8('0x66')][_0x5e6c60]),'OpenchannelQueueId':Number(_0x4986df['params']['id'])});}}else{socket[_0xc0c8('0x6e')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4986df['query'][_0xc0c8('0x66')]),'OpenchannelQueueId':Number(_0x4986df[_0xc0c8('0x47')]['id'])});}});}})[_0xc0c8('0x23')](respondWithStatusCode(_0x4ec014,null))['catch'](handleError(_0x4ec014,null));};exports[_0xc0c8('0x86')]=function(_0x969a0,_0x5e555d,_0x3fe289){var _0xc5c81c={};var _0x535266={};var _0x10dc57;var _0x47c751;return db[_0xc0c8('0x3f')][_0xc0c8('0x62')]({'where':{'id':_0x969a0['params']['id']}})[_0xc0c8('0x23')](handleEntityNotFound(_0x5e555d,null))[_0xc0c8('0x23')](function(_0xf457a3){if(_0xf457a3){_0x10dc57=_0xf457a3;_0x535266['model']=_[_0xc0c8('0x48')](db[_0xc0c8('0x59')][_0xc0c8('0x49')]);_0x535266[_0xc0c8('0x2d')]=_[_0xc0c8('0x48')](_0x969a0[_0xc0c8('0x2d')]);_0x535266[_0xc0c8('0x2e')]=_[_0xc0c8('0x4a')](_0x535266[_0xc0c8('0x30')],_0x535266[_0xc0c8('0x2d')]);_0xc5c81c[_0xc0c8('0x2f')]=_[_0xc0c8('0x4a')](_0x535266['model'],qs[_0xc0c8('0x31')](_0x969a0[_0xc0c8('0x2d')][_0xc0c8('0x31')]));_0xc5c81c[_0xc0c8('0x2f')]=_0xc5c81c[_0xc0c8('0x2f')][_0xc0c8('0x32')]?_0xc5c81c['attributes']:_0x535266['model'];_0xc5c81c[_0xc0c8('0x36')]=qs[_0xc0c8('0x37')](_0x969a0[_0xc0c8('0x2d')]['sort']);_0xc5c81c[_0xc0c8('0x38')]=qs[_0xc0c8('0x2e')](_[_0xc0c8('0x39')](_0x969a0[_0xc0c8('0x2d')],_0x535266[_0xc0c8('0x2e')]));if(_0x969a0['query'][_0xc0c8('0x3a')]){_0xc5c81c['where']=_[_0xc0c8('0x3d')](_0xc5c81c[_0xc0c8('0x38')],{'$or':_[_0xc0c8('0x3b')](_0xc5c81c['attributes'],function(_0x32a42c){var _0xae358={};_0xae358[_0x32a42c]={'$like':'%'+_0x969a0[_0xc0c8('0x2d')][_0xc0c8('0x3a')]+'%'};return _0xae358;})});}_0xc5c81c=_[_0xc0c8('0x3d')]({},_0xc5c81c,_0x969a0[_0xc0c8('0x3e')]);return _0x10dc57['getAgents'](_0xc5c81c);}})[_0xc0c8('0x23')](function(_0x3f7bdc){if(_0x3f7bdc){_0x47c751=_0x3f7bdc[_0xc0c8('0x32')];if(!_0x969a0[_0xc0c8('0x2d')]['hasOwnProperty'](_0xc0c8('0x34'))){_0xc5c81c[_0xc0c8('0x35')]=qs[_0xc0c8('0x35')](_0x969a0[_0xc0c8('0x2d')][_0xc0c8('0x35')]);_0xc5c81c['offset']=qs['offset'](_0x969a0[_0xc0c8('0x2d')][_0xc0c8('0x1c')]);}return _0x10dc57[_0xc0c8('0x86')](_0xc5c81c);}})[_0xc0c8('0x23')](function(_0x5669d0){if(_0x5669d0){return _0x5669d0?{'count':_0x47c751,'rows':_0x5669d0}:null;}})['then'](respondWithResult(_0x5e555d,null))[_0xc0c8('0x45')](handleError(_0x5e555d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6574fb2..4ba4785 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 _0x7d84=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x7d84,0x178));var _0x47d8=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x7d84[_0x599e60];return _0x468e19;};'use strict';var EventEmitter=require(_0x47d8('0x0'));var OpenchannelQueue=require(_0x47d8('0x1'))['db'][_0x47d8('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x47d8('0x3')](0x0);var events={'afterCreate':_0x47d8('0x4'),'afterUpdate':_0x47d8('0x5'),'afterDestroy':_0x47d8('0x6')};function emitEvent(_0x48045f){return function(_0x82a782,_0x46965c,_0x3477ed){OpenchannelQueueEvents[_0x47d8('0x7')](_0x48045f+':'+_0x82a782['id'],_0x82a782);OpenchannelQueueEvents[_0x47d8('0x7')](_0x48045f,_0x82a782);_0x3477ed(null);};}for(var e in events){if(events[_0x47d8('0x8')](e)){var event=events[e];OpenchannelQueue[_0x47d8('0x9')](e,emitEvent(event));}}module[_0x47d8('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xbcc2=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelQueue','save','remove','emit'];(function(_0x7762d6,_0x1934b7){var _0x2627c3=function(_0x2fcf01){while(--_0x2fcf01){_0x7762d6['push'](_0x7762d6['shift']());}};_0x2627c3(++_0x1934b7);}(_0xbcc2,0xdb));var _0x2bcc=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0xbcc2[_0x26dd05];return _0x5da547;};'use strict';var EventEmitter=require(_0x2bcc('0x0'));var OpenchannelQueue=require(_0x2bcc('0x1'))['db'][_0x2bcc('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2bcc('0x3'),'afterUpdate':'update','afterDestroy':_0x2bcc('0x4')};function emitEvent(_0x49ca18){return function(_0x48a407,_0x5a4049,_0x3763bb){OpenchannelQueueEvents[_0x2bcc('0x5')](_0x49ca18+':'+_0x48a407['id'],_0x48a407);OpenchannelQueueEvents['emit'](_0x49ca18,_0x48a407);_0x3763bb(null);};}for(var e in events){if(events[_0x2bcc('0x6')](e)){var event=events[e];OpenchannelQueue[_0x2bcc('0x7')](e,emitEvent(event));}}module[_0x2bcc('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 25989bf..661ff05 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 _0x337a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger'];(function(_0x4ae0f8,_0x481211){var _0xcd39f7=function(_0x2a4134){while(--_0x2a4134){_0x4ae0f8['push'](_0x4ae0f8['shift']());}};_0xcd39f7(++_0x481211);}(_0x337a,0x193));var _0xa337=function(_0x1164cc,_0x485249){_0x1164cc=_0x1164cc-0x0;var _0x15e297=_0x337a[_0x1164cc];return _0x15e297;};'use strict';var _=require(_0xa337('0x0'));var util=require(_0xa337('0x1'));var logger=require(_0xa337('0x2'))(_0xa337('0x3'));var moment=require(_0xa337('0x4'));var BPromise=require(_0xa337('0x5'));var rp=require(_0xa337('0x6'));var fs=require('fs');var path=require(_0xa337('0x7'));var rimraf=require(_0xa337('0x8'));var config=require(_0xa337('0x9'));var attributes=require('./openchannelQueue.attributes');module[_0xa337('0xa')]=function(_0x15b9a4,_0xfd074d){return _0x15b9a4[_0xa337('0xb')](_0xa337('0xc'),attributes,{'tableName':_0xa337('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5c3=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2ba825,_0x4b2f7a){var _0x2e047e=function(_0x2f9ae4){while(--_0x2f9ae4){_0x2ba825['push'](_0x2ba825['shift']());}};_0x2e047e(++_0x4b2f7a);}(_0xb5c3,0x1ad));var _0x3b5c=function(_0x582416,_0x3cfd3a){_0x582416=_0x582416-0x0;var _0x58c109=_0xb5c3[_0x582416];return _0x58c109;};'use strict';var _=require(_0x3b5c('0x0'));var util=require(_0x3b5c('0x1'));var logger=require(_0x3b5c('0x2'))(_0x3b5c('0x3'));var moment=require(_0x3b5c('0x4'));var BPromise=require(_0x3b5c('0x5'));var rp=require(_0x3b5c('0x6'));var fs=require('fs');var path=require(_0x3b5c('0x7'));var rimraf=require(_0x3b5c('0x8'));var config=require(_0x3b5c('0x9'));var attributes=require('./openchannelQueue.attributes');module[_0x3b5c('0xa')]=function(_0x2250d,_0x536338){return _0x2250d[_0x3b5c('0xb')](_0x3b5c('0xc'),attributes,{'tableName':_0x3b5c('0xd'),'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 d4864f1..ff115d6 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 _0x4013=['./openchannelQueue.socket','register','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','attributes','limit','include','model','map','ShowOpenchannelQueue','where','debug','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x562447,_0x4f70cf){var _0x26397f=function(_0x755064){while(--_0x755064){_0x562447['push'](_0x562447['shift']());}};_0x26397f(++_0x4f70cf);}(_0x4013,0x8e));var _0x3401=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4013[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x3401('0x0'));var util=require(_0x3401('0x1'));var moment=require('moment');var BPromise=require(_0x3401('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3401('0x3'));var db=require(_0x3401('0x4'))['db'];var utils=require(_0x3401('0x5'));var logger=require(_0x3401('0x6'))(_0x3401('0x7'));var config=require('../../config/environment');var jayson=require(_0x3401('0x8'));var client=jayson[_0x3401('0x9')][_0x3401('0xa')]({'port':0x232a});config[_0x3401('0xb')]=_[_0x3401('0xc')](config[_0x3401('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3401('0xd'))(new Redis(config[_0x3401('0xb')]));require(_0x3401('0xe'))[_0x3401('0xf')](socket);function respondWithRpcPromise(_0x354ef5,_0x589240,_0x51de00){return new BPromise(function(_0x1dbfa6,_0x7adced){return client['request'](_0x354ef5,_0x51de00)[_0x3401('0x10')](function(_0x480b76){logger[_0x3401('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x589240,_0x3401('0x12'));logger['debug'](_0x3401('0x13'),_0x589240,'request\x20sent',JSON[_0x3401('0x14')](_0x480b76));if(_0x480b76['error']){if(_0x480b76[_0x3401('0x15')][_0x3401('0x16')]===0x1f4){logger[_0x3401('0x15')](_0x3401('0x17'),_0x589240,_0x480b76[_0x3401('0x15')][_0x3401('0x18')]);return _0x7adced(_0x480b76[_0x3401('0x15')][_0x3401('0x18')]);}logger[_0x3401('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x589240,_0x480b76['error'][_0x3401('0x18')]);return _0x1dbfa6(_0x480b76['error'][_0x3401('0x18')]);}else{logger[_0x3401('0x11')](_0x3401('0x17'),_0x589240,'request\x20sent');_0x1dbfa6(_0x480b76[_0x3401('0x19')][_0x3401('0x18')]);}})[_0x3401('0x1a')](function(_0x365cc9){logger['error'](_0x3401('0x17'),_0x589240,_0x365cc9);_0x7adced(_0x365cc9);});});}exports[_0x3401('0x1b')]=function(_0x6e970e){var _0x3a9ccd=this;return new Promise(function(_0x5c67f4,_0x297a8a){return db[_0x3401('0x1c')]['findAll']({'raw':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')][_0x3401('0x1e')]===undefined?!![]:![]:!![],'where':_0x6e970e[_0x3401('0x1d')]?_0x6e970e['options']['where']||null:null,'attributes':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')][_0x3401('0x1f')]||null:null,'limit':_0x6e970e['options']?_0x6e970e['options'][_0x3401('0x20')]||null:null,'include':_0x6e970e[_0x3401('0x1d')]?_0x6e970e[_0x3401('0x1d')]['include']?_['map'](_0x6e970e['options'][_0x3401('0x21')],function(_0x5da916){return{'model':db[_0x5da916[_0x3401('0x22')]],'as':_0x5da916['as'],'attributes':_0x5da916[_0x3401('0x1f')],'include':_0x5da916['include']?_['map'](_0x5da916['include'],function(_0x209f18){return{'model':db[_0x209f18[_0x3401('0x22')]],'as':_0x209f18['as'],'attributes':_0x209f18[_0x3401('0x1f')],'include':_0x209f18['include']?_[_0x3401('0x23')](_0x209f18['include'],function(_0x5d24e5){return{'model':db[_0x5d24e5['model']],'as':_0x5d24e5['as'],'attributes':_0x5d24e5[_0x3401('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3401('0x10')](function(_0x20b404){logger[_0x3401('0x11')](_0x3401('0x1b'),_0x6e970e);logger['debug']('GetOpenchannelQueue',_0x6e970e,JSON[_0x3401('0x14')](_0x20b404));_0x5c67f4(_0x20b404);})[_0x3401('0x1a')](function(_0x5034e2){logger[_0x3401('0x15')](_0x3401('0x1b'),_0x5034e2[_0x3401('0x18')],_0x6e970e);_0x297a8a(_0x3a9ccd[_0x3401('0x15')](0x1f4,_0x5034e2[_0x3401('0x18')]));});});};exports[_0x3401('0x24')]=function(_0x5afdbe){var _0x2c9f8a=this;return new Promise(function(_0x3cfcaf,_0x563170){return db[_0x3401('0x1c')]['find']({'raw':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')][_0x3401('0x25')]||null:null,'attributes':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')][_0x3401('0x1f')]||null:null,'include':_0x5afdbe[_0x3401('0x1d')]?_0x5afdbe[_0x3401('0x1d')]['include']?_[_0x3401('0x23')](_0x5afdbe[_0x3401('0x1d')]['include'],function(_0x51d4bf){return{'model':db[_0x51d4bf[_0x3401('0x22')]],'as':_0x51d4bf['as'],'attributes':_0x51d4bf['attributes'],'include':_0x51d4bf[_0x3401('0x21')]?_[_0x3401('0x23')](_0x51d4bf[_0x3401('0x21')],function(_0x3b9b54){return{'model':db[_0x3b9b54[_0x3401('0x22')]],'as':_0x3b9b54['as'],'attributes':_0x3b9b54[_0x3401('0x1f')],'include':_0x3b9b54['include']?_[_0x3401('0x23')](_0x3b9b54['include'],function(_0x45e2d8){return{'model':db[_0x45e2d8['model']],'as':_0x45e2d8['as'],'attributes':_0x45e2d8[_0x3401('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3401('0x10')](function(_0xcad69e){logger[_0x3401('0x11')]('ShowOpenchannelQueue',_0x5afdbe);logger[_0x3401('0x26')]('ShowOpenchannelQueue',_0x5afdbe,JSON[_0x3401('0x14')](_0xcad69e));_0x3cfcaf(_0xcad69e);})[_0x3401('0x1a')](function(_0xf11102){logger[_0x3401('0x15')](_0x3401('0x24'),_0xf11102['message'],_0x5afdbe);_0x563170(_0x2c9f8a[_0x3401('0x15')](0x1f4,_0xf11102[_0x3401('0x18')]));});});}; \ No newline at end of file +var _0x8d7c=['ShowOpenchannelQueue','find','lodash','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','GetOpenchannelQueue','catch'];(function(_0x1b9c11,_0x2d3e06){var _0x425019=function(_0x455b8b){while(--_0x455b8b){_0x1b9c11['push'](_0x1b9c11['shift']());}};_0x425019(++_0x2d3e06);}(_0x8d7c,0x71));var _0xc8d7=function(_0x26af69,_0x249327){_0x26af69=_0x26af69-0x0;var _0x5a333d=_0x8d7c[_0x26af69];return _0x5a333d;};'use strict';var _=require(_0xc8d7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8d7('0x1'));var fs=require('fs');var Redis=require(_0xc8d7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8d7('0x3'));var logger=require(_0xc8d7('0x4'))('rpc');var config=require(_0xc8d7('0x5'));var jayson=require(_0xc8d7('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0xc8d7('0x7')]=_[_0xc8d7('0x8')](config[_0xc8d7('0x7')],{'host':_0xc8d7('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8d7('0xa'))[_0xc8d7('0xb')](socket);function respondWithRpcPromise(_0x4f235e,_0x1e5c0d,_0x29c355){return new BPromise(function(_0x385540,_0x1d7f01){return client[_0xc8d7('0xc')](_0x4f235e,_0x29c355)['then'](function(_0x458680){logger[_0xc8d7('0xd')](_0xc8d7('0xe'),_0x1e5c0d,_0xc8d7('0xf'));logger[_0xc8d7('0x10')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x1e5c0d,_0xc8d7('0xf'),JSON[_0xc8d7('0x11')](_0x458680));if(_0x458680[_0xc8d7('0x12')]){if(_0x458680[_0xc8d7('0x12')][_0xc8d7('0x13')]===0x1f4){logger['error'](_0xc8d7('0xe'),_0x1e5c0d,_0x458680[_0xc8d7('0x12')]['message']);return _0x1d7f01(_0x458680[_0xc8d7('0x12')]['message']);}logger['error'](_0xc8d7('0xe'),_0x1e5c0d,_0x458680[_0xc8d7('0x12')]['message']);return _0x385540(_0x458680[_0xc8d7('0x12')][_0xc8d7('0x14')]);}else{logger[_0xc8d7('0xd')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e5c0d,_0xc8d7('0xf'));_0x385540(_0x458680[_0xc8d7('0x15')][_0xc8d7('0x14')]);}})['catch'](function(_0x19ab3){logger[_0xc8d7('0x12')](_0xc8d7('0xe'),_0x1e5c0d,_0x19ab3);_0x1d7f01(_0x19ab3);});});}exports['GetOpenchannelQueue']=function(_0x25615e){var _0x3b603a=this;return new Promise(function(_0x446b97,_0x135012){return db[_0xc8d7('0x16')][_0xc8d7('0x17')]({'raw':_0x25615e[_0xc8d7('0x18')]?_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x19')]===undefined?!![]:![]:!![],'where':_0x25615e['options']?_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x1a')]||null:null,'attributes':_0x25615e['options']?_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x1b')]||null:null,'limit':_0x25615e[_0xc8d7('0x18')]?_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x1c')]||null:null,'include':_0x25615e[_0xc8d7('0x18')]?_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x1d')]?_[_0xc8d7('0x1e')](_0x25615e[_0xc8d7('0x18')][_0xc8d7('0x1d')],function(_0x400a55){return{'model':db[_0x400a55[_0xc8d7('0x1f')]],'as':_0x400a55['as'],'attributes':_0x400a55[_0xc8d7('0x1b')],'include':_0x400a55[_0xc8d7('0x1d')]?_[_0xc8d7('0x1e')](_0x400a55['include'],function(_0x556733){return{'model':db[_0x556733[_0xc8d7('0x1f')]],'as':_0x556733['as'],'attributes':_0x556733[_0xc8d7('0x1b')],'include':_0x556733[_0xc8d7('0x1d')]?_['map'](_0x556733[_0xc8d7('0x1d')],function(_0x39a423){return{'model':db[_0x39a423[_0xc8d7('0x1f')]],'as':_0x39a423['as'],'attributes':_0x39a423[_0xc8d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8d7('0x20')](function(_0x3beee6){logger[_0xc8d7('0xd')](_0xc8d7('0x21'),_0x25615e);logger['debug']('GetOpenchannelQueue',_0x25615e,JSON['stringify'](_0x3beee6));_0x446b97(_0x3beee6);})[_0xc8d7('0x22')](function(_0xf22ff3){logger[_0xc8d7('0x12')](_0xc8d7('0x21'),_0xf22ff3[_0xc8d7('0x14')],_0x25615e);_0x135012(_0x3b603a[_0xc8d7('0x12')](0x1f4,_0xf22ff3[_0xc8d7('0x14')]));});});};exports[_0xc8d7('0x23')]=function(_0x400b9d){var _0x13849a=this;return new Promise(function(_0x1140f8,_0xaab22b){return db['OpenchannelQueue'][_0xc8d7('0x24')]({'raw':_0x400b9d[_0xc8d7('0x18')]?_0x400b9d['options'][_0xc8d7('0x19')]===undefined?!![]:![]:!![],'where':_0x400b9d['options']?_0x400b9d[_0xc8d7('0x18')][_0xc8d7('0x1a')]||null:null,'attributes':_0x400b9d[_0xc8d7('0x18')]?_0x400b9d[_0xc8d7('0x18')]['attributes']||null:null,'include':_0x400b9d[_0xc8d7('0x18')]?_0x400b9d['options']['include']?_[_0xc8d7('0x1e')](_0x400b9d[_0xc8d7('0x18')][_0xc8d7('0x1d')],function(_0x4fe1c0){return{'model':db[_0x4fe1c0[_0xc8d7('0x1f')]],'as':_0x4fe1c0['as'],'attributes':_0x4fe1c0['attributes'],'include':_0x4fe1c0['include']?_[_0xc8d7('0x1e')](_0x4fe1c0[_0xc8d7('0x1d')],function(_0x2aaa07){return{'model':db[_0x2aaa07[_0xc8d7('0x1f')]],'as':_0x2aaa07['as'],'attributes':_0x2aaa07[_0xc8d7('0x1b')],'include':_0x2aaa07['include']?_[_0xc8d7('0x1e')](_0x2aaa07[_0xc8d7('0x1d')],function(_0x1dbbf3){return{'model':db[_0x1dbbf3['model']],'as':_0x1dbbf3['as'],'attributes':_0x1dbbf3[_0xc8d7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8d7('0x20')](function(_0x251351){logger[_0xc8d7('0xd')](_0xc8d7('0x23'),_0x400b9d);logger['debug'](_0xc8d7('0x23'),_0x400b9d,JSON[_0xc8d7('0x11')](_0x251351));_0x1140f8(_0x251351);})['catch'](function(_0xb642f1){logger[_0xc8d7('0x12')](_0xc8d7('0x23'),_0xb642f1[_0xc8d7('0x14')],_0x400b9d);_0xaab22b(_0x13849a[_0xc8d7('0x12')](0x1f4,_0xb642f1[_0xc8d7('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 50059f8..8ac0c8b 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 _0xc8e9=['update','emit','removeListener','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc8e9,0x19a));var _0x9c8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc8e9[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require(_0x9c8e('0x0'));var events=[_0x9c8e('0x1'),_0x9c8e('0x2'),_0x9c8e('0x3')];function createListener(_0x37a02b,_0x53824f){return function(_0xe466d4){_0x53824f[_0x9c8e('0x4')](_0x37a02b,_0xe466d4);};}function removeListener(_0x5e293d,_0x49da9e){return function(){OpenchannelQueueEvents[_0x9c8e('0x5')](_0x5e293d,_0x49da9e);};}exports['register']=function(_0x2d2729){for(var _0xa9cfc4=0x0,_0x42194d=events['length'];_0xa9cfc4<_0x42194d;_0xa9cfc4++){var _0x5264ab=events[_0xa9cfc4];var _0x5bc919=createListener(_0x9c8e('0x6')+_0x5264ab,_0x2d2729);OpenchannelQueueEvents['on'](_0x5264ab,_0x5bc919);}}; \ No newline at end of file +var _0xaeda=['register','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xaeda,0x182));var _0xaaed=function(_0x25ef03,_0x5d5bcd){_0x25ef03=_0x25ef03-0x0;var _0x528716=_0xaeda[_0x25ef03];return _0x528716;};'use strict';var OpenchannelQueueEvents=require(_0xaaed('0x0'));var events=[_0xaaed('0x1'),_0xaaed('0x2'),_0xaaed('0x3')];function createListener(_0x3503a3,_0x3cd9a9){return function(_0x24592e){_0x3cd9a9[_0xaaed('0x4')](_0x3503a3,_0x24592e);};}function removeListener(_0x3b70a0,_0xa525b6){return function(){OpenchannelQueueEvents[_0xaaed('0x5')](_0x3b70a0,_0xa525b6);};}exports[_0xaaed('0x6')]=function(_0x119c8e){for(var _0x5a90cc=0x0,_0x555970=events['length'];_0x5a90cc<_0x555970;_0x5a90cc++){var _0x4956f9=events[_0x5a90cc];var _0x46d8de=createListener(_0xaaed('0x7')+_0x4956f9,_0x119c8e);OpenchannelQueueEvents['on'](_0x4956f9,_0x46d8de);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index d7e0ac2..ab66dab 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 _0x1f85=['path','connect-timeout','express','Router','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports'];(function(_0xd4b73a,_0x59b90a){var _0x68173d=function(_0x158d8b){while(--_0x158d8b){_0xd4b73a['push'](_0xd4b73a['shift']());}};_0x68173d(++_0x59b90a);}(_0x1f85,0x1a2));var _0x51f8=function(_0x41648c,_0x262b89){_0x41648c=_0x41648c-0x0;var _0x49ffc6=_0x1f85[_0x41648c];return _0x49ffc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51f8('0x0'));var timeout=require(_0x51f8('0x1'));var express=require(_0x51f8('0x2'));var router=express[_0x51f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x51f8('0x4'));var config=require('../../config/environment');var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x51f8('0x5')](),controller[_0x51f8('0x6')]);router[_0x51f8('0x7')](_0x51f8('0x8'),auth['isAuthenticated'](),controller[_0x51f8('0x9')]);router[_0x51f8('0x7')]('/:id',auth[_0x51f8('0x5')](),controller[_0x51f8('0xa')]);router[_0x51f8('0xb')]('/',auth['isAuthenticated'](),controller[_0x51f8('0xc')]);router[_0x51f8('0xd')](_0x51f8('0xe'),auth[_0x51f8('0x5')](),controller[_0x51f8('0xf')]);router[_0x51f8('0x10')]('/:id',auth[_0x51f8('0x5')](),controller[_0x51f8('0x11')]);module[_0x51f8('0x12')]=router; \ No newline at end of file +var _0x6346=['/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x5a016a,_0x30f892){var _0x5c8267=function(_0xad5a78){while(--_0xad5a78){_0x5a016a['push'](_0x5a016a['shift']());}};_0x5c8267(++_0x30f892);}(_0x6346,0x170));var _0x6634=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x6346[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x6634('0x0'));var util=require(_0x6634('0x1'));var path=require('path');var timeout=require(_0x6634('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6634('0x3'));var auth=require(_0x6634('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6634('0x5'));var controller=require(_0x6634('0x6'));router[_0x6634('0x7')]('/',auth[_0x6634('0x8')](),controller[_0x6634('0x9')]);router[_0x6634('0x7')](_0x6634('0xa'),auth[_0x6634('0x8')](),controller[_0x6634('0xb')]);router[_0x6634('0x7')](_0x6634('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6634('0xd')]('/',auth[_0x6634('0x8')](),controller[_0x6634('0xe')]);router[_0x6634('0xf')](_0x6634('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x6634('0x10')](_0x6634('0xc'),auth['isAuthenticated'](),controller[_0x6634('0x11')]);module[_0x6634('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ed37650..9b2123c 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 _0xc45f=['sequelize','STRING','DATE','moment'];(function(_0x1ba4bd,_0x2c8a44){var _0x59e274=function(_0x1d6858){while(--_0x1d6858){_0x1ba4bd['push'](_0x1ba4bd['shift']());}};_0x59e274(++_0x2c8a44);}(_0xc45f,0xfb));var _0xfc45=function(_0x3885ae,_0x2514e2){_0x3885ae=_0x3885ae-0x0;var _0xc12345=_0xc45f[_0x3885ae];return _0xc12345;};'use strict';var moment=require(_0xfc45('0x0'));var Sequelize=require(_0xfc45('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xfc45('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xfc45('0x2')]},'joinAt':{'type':Sequelize[_0xfc45('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xfc45('0x3')]},'exitAt':{'type':Sequelize[_0xfc45('0x3')]},'reason':{'type':Sequelize[_0xfc45('0x2')]}}; \ No newline at end of file +var _0x8df7=['STRING','DATE','moment','sequelize','exports'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0x8df7,0x197));var _0x78df=function(_0x39a981,_0x5f3d96){_0x39a981=_0x39a981-0x0;var _0x1f83a7=_0x8df7[_0x39a981];return _0x1f83a7;};'use strict';var moment=require(_0x78df('0x0'));var Sequelize=require(_0x78df('0x1'));module[_0x78df('0x2')]={'uniqueid':{'type':Sequelize[_0x78df('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x78df('0x3')]},'joinAt':{'type':Sequelize[_0x78df('0x4')]},'leaveAt':{'type':Sequelize[_0x78df('0x4')]},'acceptAt':{'type':Sequelize[_0x78df('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x78df('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 034d90c..40c8151 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 _0xe706=['limit','count','set','reject','update','then','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','find','create','body','params','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x366ce0,_0x4c3fad){var _0x5ae1c0=function(_0x6a4ad6){while(--_0x6a4ad6){_0x366ce0['push'](_0x366ce0['shift']());}};_0x5ae1c0(++_0x4c3fad);}(_0xe706,0x1a3));var _0x6e70=function(_0x2831cf,_0x24babf){_0x2831cf=_0x2831cf-0x0;var _0x5ec206=_0xe706[_0x2831cf];return _0x5ec206;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e70('0x1'));var jsonpatch=require(_0x6e70('0x2'));var rp=require('request-promise');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var Mustache=require('mustache');var util=require(_0x6e70('0x5'));var path=require(_0x6e70('0x6'));var sox=require(_0x6e70('0x7'));var csv=require(_0x6e70('0x8'));var ejs=require(_0x6e70('0x9'));var fs=require('fs');var fs_extra=require(_0x6e70('0xa'));var _=require('lodash');var squel=require(_0x6e70('0xb'));var crypto=require(_0x6e70('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6e70('0xd'));var toCsv=require(_0x6e70('0x8'));var querystring=require(_0x6e70('0xe'));var Papa=require(_0x6e70('0xf'));var Redis=require(_0x6e70('0x10'));var authService=require(_0x6e70('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e70('0x12'));var logger=require(_0x6e70('0x13'))(_0x6e70('0x14'));var utils=require(_0x6e70('0x15'));var config=require(_0x6e70('0x16'));var licenseUtil=require(_0x6e70('0x17'));var db=require(_0x6e70('0x18'))['db'];function respondWithStatusCode(_0x5ebe67,_0x41c51a){_0x41c51a=_0x41c51a||0xcc;return function(_0x448f21){if(_0x448f21){return _0x5ebe67[_0x6e70('0x19')](_0x41c51a);}return _0x5ebe67[_0x6e70('0x1a')](_0x41c51a)[_0x6e70('0x1b')]();};}function respondWithResult(_0x270b6b,_0x3bdfb9){_0x3bdfb9=_0x3bdfb9||0xc8;return function(_0x4641cd){if(_0x4641cd){return _0x270b6b[_0x6e70('0x1a')](_0x3bdfb9)[_0x6e70('0x1c')](_0x4641cd);}};}function respondWithFilteredResult(_0x23ee4e,_0x59794a){return function(_0x1e2c2e){if(_0x1e2c2e){var _0x30f770=typeof _0x59794a[_0x6e70('0x1d')]===_0x6e70('0x1e')&&typeof _0x59794a[_0x6e70('0x1f')]==='undefined';var _0x1c91ff=_0x1e2c2e[_0x6e70('0x20')];var _0x2c6b60=_0x30f770?0x0:_0x59794a['offset'];var _0x49c8ec=_0x30f770?_0x1e2c2e[_0x6e70('0x20')]:_0x59794a[_0x6e70('0x1d')]+_0x59794a['limit'];var _0x3b1ac7;if(_0x49c8ec>=_0x1c91ff){_0x49c8ec=_0x1c91ff;_0x3b1ac7=0xc8;}else{_0x3b1ac7=0xce;}_0x23ee4e[_0x6e70('0x1a')](_0x3b1ac7);return _0x23ee4e[_0x6e70('0x21')]('Content-Range',_0x2c6b60+'-'+_0x49c8ec+'/'+_0x1c91ff)[_0x6e70('0x1c')](_0x1e2c2e);}return null;};}function patchUpdates(_0x3b1afe){return function(_0x555b19){try{jsonpatch['apply'](_0x555b19,_0x3b1afe,!![]);}catch(_0x39866a){return BPromise[_0x6e70('0x22')](_0x39866a);}return _0x555b19['save']();};}function saveUpdates(_0x3e3f1d,_0x27dfa7){return function(_0x4685d8){if(_0x4685d8){return _0x4685d8[_0x6e70('0x23')](_0x3e3f1d)[_0x6e70('0x24')](function(_0x5b5b2f){return _0x5b5b2f;});}return null;};}function removeEntity(_0x18c913,_0x649d65){return function(_0x569955){if(_0x569955){return _0x569955['destroy']()[_0x6e70('0x24')](function(){_0x18c913[_0x6e70('0x1a')](0xcc)[_0x6e70('0x1b')]();});}};}function handleEntityNotFound(_0x12ca0,_0x3c30fe){return function(_0x1da867){if(!_0x1da867){_0x12ca0[_0x6e70('0x19')](0x194);}return _0x1da867;};}function handleError(_0x35e776,_0x14bdb4){_0x14bdb4=_0x14bdb4||0x1f4;return function(_0x450c3c){logger[_0x6e70('0x25')](_0x450c3c['stack']);if(_0x450c3c[_0x6e70('0x26')]){delete _0x450c3c[_0x6e70('0x26')];}_0x35e776[_0x6e70('0x1a')](_0x14bdb4)[_0x6e70('0x27')](_0x450c3c);};}exports[_0x6e70('0x28')]=function(_0x1d8a1c,_0x568e10){var _0x1a7c23={},_0x2de9bb={},_0x4e227e={'count':0x0,'rows':[]};var _0x6c102d=_[_0x6e70('0x29')](db[_0x6e70('0x2a')][_0x6e70('0x2b')],function(_0x413c2d){return{'name':_0x413c2d[_0x6e70('0x2c')],'type':_0x413c2d[_0x6e70('0x2d')][_0x6e70('0x2e')]};});_0x2de9bb[_0x6e70('0x2f')]=_[_0x6e70('0x29')](_0x6c102d,'name');_0x2de9bb[_0x6e70('0x30')]=_[_0x6e70('0x31')](_0x1d8a1c['query']);_0x2de9bb[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x2de9bb[_0x6e70('0x2f')],_0x2de9bb[_0x6e70('0x30')]);_0x1a7c23[_0x6e70('0x34')]=_[_0x6e70('0x33')](_0x2de9bb[_0x6e70('0x2f')],qs[_0x6e70('0x35')](_0x1d8a1c[_0x6e70('0x30')]['fields']));_0x1a7c23[_0x6e70('0x34')]=_0x1a7c23[_0x6e70('0x34')][_0x6e70('0x36')]?_0x1a7c23[_0x6e70('0x34')]:_0x2de9bb[_0x6e70('0x2f')];if(!_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x37')](_0x6e70('0x38'))){_0x1a7c23[_0x6e70('0x1f')]=qs[_0x6e70('0x1f')](_0x1d8a1c[_0x6e70('0x30')]['limit']);_0x1a7c23['offset']=qs[_0x6e70('0x1d')](_0x1d8a1c[_0x6e70('0x30')]['offset']);}_0x1a7c23[_0x6e70('0x39')]=qs[_0x6e70('0x3a')](_0x1d8a1c[_0x6e70('0x30')]['sort']);_0x1a7c23[_0x6e70('0x3b')]=qs['filters'](_[_0x6e70('0x3c')](_0x1d8a1c['query'],_0x2de9bb[_0x6e70('0x32')]),_0x6c102d);if(_0x1d8a1c['query'][_0x6e70('0x3d')]){_0x1a7c23[_0x6e70('0x3b')]=_['merge'](_0x1a7c23['where'],{'$or':_['map'](_0x6c102d,function(_0x3e6e74){if(_0x3e6e74[_0x6e70('0x2d')]!==_0x6e70('0x3e')){var _0x4f658c={};_0x4f658c[_0x3e6e74['name']]={'$like':'%'+_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x3d')]+'%'};return _0x4f658c;}})});}_0x1a7c23=_[_0x6e70('0x3f')]({},_0x1a7c23,_0x1d8a1c[_0x6e70('0x40')]);var _0x3ad54d={'where':_0x1a7c23[_0x6e70('0x3b')]};return db[_0x6e70('0x2a')][_0x6e70('0x20')](_0x3ad54d)['then'](function(_0x55a9bb){_0x4e227e[_0x6e70('0x20')]=_0x55a9bb;if(_0x1d8a1c[_0x6e70('0x30')][_0x6e70('0x41')]){_0x1a7c23[_0x6e70('0x42')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x6e70('0x43')](_0x1a7c23);})[_0x6e70('0x24')](function(_0x531247){_0x4e227e['rows']=_0x531247;return _0x4e227e;})[_0x6e70('0x24')](respondWithFilteredResult(_0x568e10,_0x1a7c23))[_0x6e70('0x44')](handleError(_0x568e10,null));};exports['show']=function(_0x16f389,_0x293110){var _0x4a534b={'raw':!![],'where':{'id':_0x16f389['params']['id']}},_0x267fdd={};_0x267fdd[_0x6e70('0x2f')]=_[_0x6e70('0x31')](db[_0x6e70('0x2a')]['rawAttributes']);_0x267fdd['query']=_['keys'](_0x16f389[_0x6e70('0x30')]);_0x267fdd['filters']=_['intersection'](_0x267fdd['model'],_0x267fdd[_0x6e70('0x30')]);_0x4a534b['attributes']=_[_0x6e70('0x33')](_0x267fdd[_0x6e70('0x2f')],qs[_0x6e70('0x35')](_0x16f389['query'][_0x6e70('0x35')]));_0x4a534b['attributes']=_0x4a534b[_0x6e70('0x34')][_0x6e70('0x36')]?_0x4a534b[_0x6e70('0x34')]:_0x267fdd[_0x6e70('0x2f')];if(_0x16f389['query'][_0x6e70('0x41')]){_0x4a534b[_0x6e70('0x42')]=[{'all':!![]}];}_0x4a534b=_[_0x6e70('0x3f')]({},_0x4a534b,_0x16f389[_0x6e70('0x40')]);return db[_0x6e70('0x2a')][_0x6e70('0x45')](_0x4a534b)[_0x6e70('0x24')](handleEntityNotFound(_0x293110,null))[_0x6e70('0x24')](respondWithResult(_0x293110,null))[_0x6e70('0x44')](handleError(_0x293110,null));};exports['create']=function(_0x3acd1e,_0x12e0e7){return db['OpenchannelQueueReport'][_0x6e70('0x46')](_0x3acd1e[_0x6e70('0x47')],{})[_0x6e70('0x24')](respondWithResult(_0x12e0e7,0xc9))[_0x6e70('0x44')](handleError(_0x12e0e7,null));};exports[_0x6e70('0x23')]=function(_0x2a6b82,_0x10f6c1){if(_0x2a6b82[_0x6e70('0x47')]['id']){delete _0x2a6b82[_0x6e70('0x47')]['id'];}return db[_0x6e70('0x2a')][_0x6e70('0x45')]({'where':{'id':_0x2a6b82[_0x6e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x10f6c1,null))['then'](saveUpdates(_0x2a6b82['body'],null))[_0x6e70('0x24')](respondWithResult(_0x10f6c1,null))['catch'](handleError(_0x10f6c1,null));};exports[_0x6e70('0x49')]=function(_0x4f47a6,_0x28775b){return db[_0x6e70('0x2a')][_0x6e70('0x45')]({'where':{'id':_0x4f47a6[_0x6e70('0x48')]['id']}})['then'](handleEntityNotFound(_0x28775b,null))[_0x6e70('0x24')](removeEntity(_0x28775b,null))[_0x6e70('0x44')](handleError(_0x28775b,null));};exports['describe']=function(_0x3b3f36,_0x4ecef3){return db[_0x6e70('0x2a')][_0x6e70('0x4a')]()['then'](respondWithResult(_0x4ecef3,null))[_0x6e70('0x44')](handleError(_0x4ecef3,null));}; \ No newline at end of file +var _0xfb89=['show','params','keys','filters','intersection','find','create','body','catch','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','type','key','model','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueueReport','includeAll','include','findAll'];(function(_0x2416d1,_0x2a2aca){var _0x2dff8c=function(_0x16d6be){while(--_0x16d6be){_0x2416d1['push'](_0x2416d1['shift']());}};_0x2dff8c(++_0x2a2aca);}(_0xfb89,0x181));var _0x9fb8=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0xfb89[_0xe66cf2];return _0x2d84e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9fb8('0x0'));var zipdir=require(_0x9fb8('0x1'));var jsonpatch=require(_0x9fb8('0x2'));var rp=require(_0x9fb8('0x3'));var moment=require(_0x9fb8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9fb8('0x5'));var util=require('util');var path=require(_0x9fb8('0x6'));var sox=require(_0x9fb8('0x7'));var csv=require(_0x9fb8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fb8('0x9'));var _=require(_0x9fb8('0xa'));var squel=require(_0x9fb8('0xb'));var crypto=require(_0x9fb8('0xc'));var jsforce=require(_0x9fb8('0xd'));var deskjs=require(_0x9fb8('0xe'));var toCsv=require(_0x9fb8('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9fb8('0xf'));var authService=require(_0x9fb8('0x10'));var qs=require(_0x9fb8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fb8('0x12'));var logger=require(_0x9fb8('0x13'))(_0x9fb8('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9fb8('0x15'))['db'];function respondWithStatusCode(_0x4c3a5a,_0x3e8d6c){_0x3e8d6c=_0x3e8d6c||0xcc;return function(_0x573e32){if(_0x573e32){return _0x4c3a5a['sendStatus'](_0x3e8d6c);}return _0x4c3a5a[_0x9fb8('0x16')](_0x3e8d6c)['end']();};}function respondWithResult(_0x1454bb,_0x1d3932){_0x1d3932=_0x1d3932||0xc8;return function(_0x2fb5ec){if(_0x2fb5ec){return _0x1454bb[_0x9fb8('0x16')](_0x1d3932)[_0x9fb8('0x17')](_0x2fb5ec);}};}function respondWithFilteredResult(_0x195ee8,_0x41863c){return function(_0x5c94cc){if(_0x5c94cc){var _0x5b9e71=typeof _0x41863c[_0x9fb8('0x18')]==='undefined'&&typeof _0x41863c['limit']===_0x9fb8('0x19');var _0x38f623=_0x5c94cc['count'];var _0x22f9d9=_0x5b9e71?0x0:_0x41863c[_0x9fb8('0x18')];var _0x460a4e=_0x5b9e71?_0x5c94cc[_0x9fb8('0x1a')]:_0x41863c[_0x9fb8('0x18')]+_0x41863c[_0x9fb8('0x1b')];var _0x310ae7;if(_0x460a4e>=_0x38f623){_0x460a4e=_0x38f623;_0x310ae7=0xc8;}else{_0x310ae7=0xce;}_0x195ee8[_0x9fb8('0x16')](_0x310ae7);return _0x195ee8[_0x9fb8('0x1c')](_0x9fb8('0x1d'),_0x22f9d9+'-'+_0x460a4e+'/'+_0x38f623)[_0x9fb8('0x17')](_0x5c94cc);}return null;};}function patchUpdates(_0x3a02ec){return function(_0x530c2e){try{jsonpatch[_0x9fb8('0x1e')](_0x530c2e,_0x3a02ec,!![]);}catch(_0x4e7200){return BPromise[_0x9fb8('0x1f')](_0x4e7200);}return _0x530c2e[_0x9fb8('0x20')]();};}function saveUpdates(_0x170353,_0x2b2e06){return function(_0x4e1e75){if(_0x4e1e75){return _0x4e1e75[_0x9fb8('0x21')](_0x170353)[_0x9fb8('0x22')](function(_0x50ede4){return _0x50ede4;});}return null;};}function removeEntity(_0xf0b0cd,_0x234cdc){return function(_0x57da8e){if(_0x57da8e){return _0x57da8e[_0x9fb8('0x23')]()['then'](function(){_0xf0b0cd[_0x9fb8('0x16')](0xcc)[_0x9fb8('0x24')]();});}};}function handleEntityNotFound(_0x38afe4,_0x2a97e5){return function(_0x4a051c){if(!_0x4a051c){_0x38afe4[_0x9fb8('0x25')](0x194);}return _0x4a051c;};}function handleError(_0x4d6a70,_0x53a21c){_0x53a21c=_0x53a21c||0x1f4;return function(_0x4c0c02){logger[_0x9fb8('0x26')](_0x4c0c02[_0x9fb8('0x27')]);if(_0x4c0c02[_0x9fb8('0x28')]){delete _0x4c0c02['name'];}_0x4d6a70['status'](_0x53a21c)['send'](_0x4c0c02);};}exports[_0x9fb8('0x29')]=function(_0x5bd7e3,_0x23266f){var _0x3cdd62={},_0x10304b={},_0x1b0290={'count':0x0,'rows':[]};var _0x4ce46a=_[_0x9fb8('0x2a')](db['OpenchannelQueueReport'][_0x9fb8('0x2b')],function(_0x5dacea){return{'name':_0x5dacea['fieldName'],'type':_0x5dacea[_0x9fb8('0x2c')][_0x9fb8('0x2d')]};});_0x10304b[_0x9fb8('0x2e')]=_[_0x9fb8('0x2a')](_0x4ce46a,_0x9fb8('0x28'));_0x10304b[_0x9fb8('0x2f')]=_['keys'](_0x5bd7e3[_0x9fb8('0x2f')]);_0x10304b['filters']=_['intersection'](_0x10304b[_0x9fb8('0x2e')],_0x10304b[_0x9fb8('0x2f')]);_0x3cdd62['attributes']=_['intersection'](_0x10304b[_0x9fb8('0x2e')],qs[_0x9fb8('0x30')](_0x5bd7e3['query'][_0x9fb8('0x30')]));_0x3cdd62['attributes']=_0x3cdd62[_0x9fb8('0x31')][_0x9fb8('0x32')]?_0x3cdd62['attributes']:_0x10304b[_0x9fb8('0x2e')];if(!_0x5bd7e3[_0x9fb8('0x2f')][_0x9fb8('0x33')](_0x9fb8('0x34'))){_0x3cdd62['limit']=qs[_0x9fb8('0x1b')](_0x5bd7e3['query']['limit']);_0x3cdd62[_0x9fb8('0x18')]=qs['offset'](_0x5bd7e3['query'][_0x9fb8('0x18')]);}_0x3cdd62[_0x9fb8('0x35')]=qs['sort'](_0x5bd7e3[_0x9fb8('0x2f')][_0x9fb8('0x36')]);_0x3cdd62[_0x9fb8('0x37')]=qs['filters'](_[_0x9fb8('0x38')](_0x5bd7e3[_0x9fb8('0x2f')],_0x10304b['filters']),_0x4ce46a);if(_0x5bd7e3['query'][_0x9fb8('0x39')]){_0x3cdd62[_0x9fb8('0x37')]=_[_0x9fb8('0x3a')](_0x3cdd62[_0x9fb8('0x37')],{'$or':_[_0x9fb8('0x2a')](_0x4ce46a,function(_0x4383f9){if(_0x4383f9['type']!==_0x9fb8('0x3b')){var _0x175a32={};_0x175a32[_0x4383f9[_0x9fb8('0x28')]]={'$like':'%'+_0x5bd7e3[_0x9fb8('0x2f')][_0x9fb8('0x39')]+'%'};return _0x175a32;}})});}_0x3cdd62=_[_0x9fb8('0x3a')]({},_0x3cdd62,_0x5bd7e3[_0x9fb8('0x3c')]);var _0x21d8af={'where':_0x3cdd62[_0x9fb8('0x37')]};return db[_0x9fb8('0x3d')][_0x9fb8('0x1a')](_0x21d8af)[_0x9fb8('0x22')](function(_0x2cd505){_0x1b0290['count']=_0x2cd505;if(_0x5bd7e3[_0x9fb8('0x2f')][_0x9fb8('0x3e')]){_0x3cdd62[_0x9fb8('0x3f')]=[{'all':!![]}];}return db[_0x9fb8('0x3d')][_0x9fb8('0x40')](_0x3cdd62);})[_0x9fb8('0x22')](function(_0x34d883){_0x1b0290['rows']=_0x34d883;return _0x1b0290;})['then'](respondWithFilteredResult(_0x23266f,_0x3cdd62))['catch'](handleError(_0x23266f,null));};exports[_0x9fb8('0x41')]=function(_0x569cb5,_0x13f75b){var _0x31a3b5={'raw':!![],'where':{'id':_0x569cb5[_0x9fb8('0x42')]['id']}},_0x4c1697={};_0x4c1697[_0x9fb8('0x2e')]=_[_0x9fb8('0x43')](db[_0x9fb8('0x3d')]['rawAttributes']);_0x4c1697[_0x9fb8('0x2f')]=_[_0x9fb8('0x43')](_0x569cb5[_0x9fb8('0x2f')]);_0x4c1697[_0x9fb8('0x44')]=_[_0x9fb8('0x45')](_0x4c1697[_0x9fb8('0x2e')],_0x4c1697[_0x9fb8('0x2f')]);_0x31a3b5[_0x9fb8('0x31')]=_[_0x9fb8('0x45')](_0x4c1697[_0x9fb8('0x2e')],qs['fields'](_0x569cb5[_0x9fb8('0x2f')][_0x9fb8('0x30')]));_0x31a3b5[_0x9fb8('0x31')]=_0x31a3b5[_0x9fb8('0x31')][_0x9fb8('0x32')]?_0x31a3b5['attributes']:_0x4c1697[_0x9fb8('0x2e')];if(_0x569cb5[_0x9fb8('0x2f')]['includeAll']){_0x31a3b5[_0x9fb8('0x3f')]=[{'all':!![]}];}_0x31a3b5=_[_0x9fb8('0x3a')]({},_0x31a3b5,_0x569cb5[_0x9fb8('0x3c')]);return db['OpenchannelQueueReport'][_0x9fb8('0x46')](_0x31a3b5)[_0x9fb8('0x22')](handleEntityNotFound(_0x13f75b,null))[_0x9fb8('0x22')](respondWithResult(_0x13f75b,null))['catch'](handleError(_0x13f75b,null));};exports[_0x9fb8('0x47')]=function(_0x5156f2,_0x533ca2){return db[_0x9fb8('0x3d')]['create'](_0x5156f2[_0x9fb8('0x48')],{})['then'](respondWithResult(_0x533ca2,0xc9))[_0x9fb8('0x49')](handleError(_0x533ca2,null));};exports['update']=function(_0x509e71,_0xfbaf2e){if(_0x509e71[_0x9fb8('0x48')]['id']){delete _0x509e71[_0x9fb8('0x48')]['id'];}return db[_0x9fb8('0x3d')][_0x9fb8('0x46')]({'where':{'id':_0x509e71[_0x9fb8('0x42')]['id']}})[_0x9fb8('0x22')](handleEntityNotFound(_0xfbaf2e,null))[_0x9fb8('0x22')](saveUpdates(_0x509e71[_0x9fb8('0x48')],null))[_0x9fb8('0x22')](respondWithResult(_0xfbaf2e,null))[_0x9fb8('0x49')](handleError(_0xfbaf2e,null));};exports[_0x9fb8('0x23')]=function(_0x2ab60e,_0x29c4d1){return db[_0x9fb8('0x3d')][_0x9fb8('0x46')]({'where':{'id':_0x2ab60e[_0x9fb8('0x42')]['id']}})[_0x9fb8('0x22')](handleEntityNotFound(_0x29c4d1,null))['then'](removeEntity(_0x29c4d1,null))[_0x9fb8('0x49')](handleError(_0x29c4d1,null));};exports[_0x9fb8('0x4a')]=function(_0x3a0e8d,_0x20f735){return db['OpenchannelQueueReport'][_0x9fb8('0x4a')]()[_0x9fb8('0x22')](respondWithResult(_0x20f735,null))['catch'](handleError(_0x20f735,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 41bd241..27a6d8e 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 _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0xdee10d,_0x57d73d){var _0x55c181=function(_0x198091){while(--_0x198091){_0xdee10d['push'](_0xdee10d['shift']());}};_0x55c181(++_0x57d73d);}(_0xe14b,0x93));var _0xbe14=function(_0x4b0437,_0x57dcf4){_0x4b0437=_0x4b0437-0x0;var _0x2d5505=_0xe14b[_0x4b0437];return _0x2d5505;};'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 +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x522c5c,_0x4983dc){var _0x247016=function(_0x23fa00){while(--_0x23fa00){_0x522c5c['push'](_0x522c5c['shift']());}};_0x247016(++_0x4983dc);}(_0xe14b,0x93));var _0xbe14=function(_0x4042f7,_0x59b6ef){_0x4042f7=_0x4042f7-0x0;var _0x314382=_0xe14b[_0x4042f7];return _0x314382;};'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 3dc6396..0ff06ee 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 _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x497bde,_0x3a3778){var _0x59b581=function(_0x22f4ab){while(--_0x22f4ab){_0x497bde['push'](_0x497bde['shift']());}};_0x59b581(++_0x3a3778);}(_0x47c5,0x165));var _0x547c=function(_0x36da00,_0x5b533b){_0x36da00=_0x36da00-0x0;var _0x4b72c5=_0x47c5[_0x36da00];return _0x4b72c5;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file +var _0xd914=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','UpdateOpenchannelQueueReport','update','attributes','limit','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x562e9c,_0x259a6d){var _0x106cfe=function(_0x4981ec){while(--_0x4981ec){_0x562e9c['push'](_0x562e9c['shift']());}};_0x106cfe(++_0x259a6d);}(_0xd914,0x17f));var _0x4d91=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0xd914[_0x511bd1];return _0x4c48ec;};'use strict';var _=require(_0x4d91('0x0'));var util=require(_0x4d91('0x1'));var moment=require('moment');var BPromise=require(_0x4d91('0x2'));var rs=require(_0x4d91('0x3'));var fs=require('fs');var Redis=require(_0x4d91('0x4'));var db=require(_0x4d91('0x5'))['db'];var utils=require(_0x4d91('0x6'));var logger=require(_0x4d91('0x7'))('rpc');var config=require(_0x4d91('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4d91('0x9')][_0x4d91('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x175ce3,_0x27c0d5,_0x22f2a4){return new BPromise(function(_0x150767,_0x3016c0){return client[_0x4d91('0xb')](_0x175ce3,_0x22f2a4)['then'](function(_0x37bde4){logger[_0x4d91('0xc')](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));logger[_0x4d91('0xf')](_0x4d91('0x10'),_0x27c0d5,'request\x20sent',JSON['stringify'](_0x37bde4));if(_0x37bde4[_0x4d91('0x11')]){if(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x12')]===0x1f4){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')]['message']);return _0x3016c0(_0x37bde4['error'][_0x4d91('0x13')]);}logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);return _0x150767(_0x37bde4[_0x4d91('0x11')][_0x4d91('0x13')]);}else{logger['info'](_0x4d91('0xd'),_0x27c0d5,_0x4d91('0xe'));_0x150767(_0x37bde4[_0x4d91('0x14')][_0x4d91('0x13')]);}})[_0x4d91('0x15')](function(_0x554ca8){logger[_0x4d91('0x11')](_0x4d91('0xd'),_0x27c0d5,_0x554ca8);_0x3016c0(_0x554ca8);});});}exports[_0x4d91('0x16')]=function(_0x44b9a7){var _0x4cfa40=this;return new Promise(function(_0x350e23,_0x3b579b){return db[_0x4d91('0x17')]['create'](_0x44b9a7[_0x4d91('0x18')],{'raw':_0x44b9a7[_0x4d91('0x19')]?_0x44b9a7[_0x4d91('0x19')][_0x4d91('0x1a')]===undefined?!![]:![]:!![]})[_0x4d91('0x1b')](function(_0x40cde4){logger[_0x4d91('0xc')](_0x4d91('0x16'),_0x44b9a7);logger[_0x4d91('0xf')](_0x4d91('0x16'),_0x44b9a7,JSON['stringify'](_0x40cde4));_0x350e23(_0x40cde4);})[_0x4d91('0x15')](function(_0x5f5236){logger['error'](_0x4d91('0x16'),_0x5f5236[_0x4d91('0x13')],_0x44b9a7);_0x3b579b(_0x4cfa40[_0x4d91('0x11')](0x1f4,_0x5f5236[_0x4d91('0x13')]));});});};exports[_0x4d91('0x1c')]=function(_0x12b722){var _0x100cd4=this;return new Promise(function(_0x123606,_0x55356b){return db['OpenchannelQueueReport'][_0x4d91('0x1d')](_0x12b722[_0x4d91('0x18')],{'raw':_0x12b722[_0x4d91('0x19')]?_0x12b722[_0x4d91('0x19')][_0x4d91('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12b722[_0x4d91('0x19')]?_0x12b722[_0x4d91('0x19')]['where']||null:null,'attributes':_0x12b722[_0x4d91('0x19')]?_0x12b722[_0x4d91('0x19')][_0x4d91('0x1e')]||null:null,'limit':_0x12b722['options']?_0x12b722['options'][_0x4d91('0x1f')]||null:null})[_0x4d91('0x1b')](function(_0x5ed948){logger['info'](_0x4d91('0x1c'),_0x12b722);logger[_0x4d91('0xf')](_0x4d91('0x1c'),_0x12b722,JSON[_0x4d91('0x20')](_0x5ed948));_0x123606(_0x5ed948);})['catch'](function(_0x2587a1){logger[_0x4d91('0x11')](_0x4d91('0x1c'),_0x2587a1[_0x4d91('0x13')],_0x12b722);_0x55356b(_0x100cd4[_0x4d91('0x11')](0x1f4,_0x2587a1[_0x4d91('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 38f8c25..43c0be6 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 _0xdb66=['put','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post','create'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdb66,0xe8));var _0x6db6=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xdb66[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x6db6('0x0'));var util=require('util');var path=require(_0x6db6('0x1'));var timeout=require('connect-timeout');var express=require(_0x6db6('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6db6('0x3'));var interaction=require(_0x6db6('0x4'));var config=require(_0x6db6('0x5'));var controller=require(_0x6db6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x6db6('0x7')]);router[_0x6db6('0x8')](_0x6db6('0x9'),auth[_0x6db6('0xa')](),controller[_0x6db6('0xb')]);router[_0x6db6('0x8')](_0x6db6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6db6('0xd')]('/',auth[_0x6db6('0xa')](),controller[_0x6db6('0xe')]);router[_0x6db6('0xf')](_0x6db6('0xc'),auth[_0x6db6('0xa')](),controller[_0x6db6('0x10')]);router['delete'](_0x6db6('0xc'),auth[_0x6db6('0xa')](),controller[_0x6db6('0x11')]);module[_0x6db6('0x12')]=router; \ No newline at end of file +var _0xb3ba=['update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x21b33e,_0x4fb796){var _0x4d440e=function(_0x1314f9){while(--_0x1314f9){_0x21b33e['push'](_0x21b33e['shift']());}};_0x4d440e(++_0x4fb796);}(_0xb3ba,0x1d2));var _0xab3b=function(_0x257de1,_0x496026){_0x257de1=_0x257de1-0x0;var _0x35b1fa=_0xb3ba[_0x257de1];return _0x35b1fa;};'use strict';var multer=require(_0xab3b('0x0'));var util=require('util');var path=require(_0xab3b('0x1'));var timeout=require(_0xab3b('0x2'));var express=require(_0xab3b('0x3'));var router=express['Router']();var fs_extra=require(_0xab3b('0x4'));var auth=require(_0xab3b('0x5'));var interaction=require(_0xab3b('0x6'));var config=require(_0xab3b('0x7'));var controller=require(_0xab3b('0x8'));router[_0xab3b('0x9')]('/',auth[_0xab3b('0xa')](),controller[_0xab3b('0xb')]);router[_0xab3b('0x9')](_0xab3b('0xc'),auth[_0xab3b('0xa')](),controller[_0xab3b('0xd')]);router[_0xab3b('0x9')](_0xab3b('0xe'),auth[_0xab3b('0xa')](),controller['show']);router[_0xab3b('0xf')]('/',auth['isAuthenticated'](),controller[_0xab3b('0x10')]);router[_0xab3b('0x11')](_0xab3b('0xe'),auth[_0xab3b('0xa')](),controller[_0xab3b('0x12')]);router[_0xab3b('0x13')](_0xab3b('0xe'),auth['isAuthenticated'](),controller[_0xab3b('0x14')]);module[_0xab3b('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 27731e1..da9fb5e 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x73b767,_0x43b382){var _0x4953c1=function(_0x1cb815){while(--_0x1cb815){_0x73b767['push'](_0x73b767['shift']());}};_0x4953c1(++_0x43b382);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x00bb[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x3dfea5,_0xc4bc46){var _0x16d2ad=function(_0xa9f375){while(--_0xa9f375){_0x3dfea5['push'](_0x3dfea5['shift']());}};_0x16d2ad(++_0xc4bc46);}(_0x4b84,0x1cc));var _0x44b8=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x4b84[_0x2eb3db];return _0x358f33;};'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 diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ee0220b..402ebf2 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 _0x0ff0=['send','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','VIRTUAL','filter','options','findAll','rows','show','params','include','merge','create','body','catch','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name'];(function(_0x3a7b71,_0x135bad){var _0x2fdef7=function(_0x365c64){while(--_0x365c64){_0x3a7b71['push'](_0x3a7b71['shift']());}};_0x2fdef7(++_0x135bad);}(_0x0ff0,0x140));var _0x00ff=function(_0x427793,_0x2b2019){_0x427793=_0x427793-0x0;var _0x3dd19a=_0x0ff0[_0x427793];return _0x3dd19a;};'use strict';var emlformat=require(_0x00ff('0x0'));var rimraf=require(_0x00ff('0x1'));var zipdir=require(_0x00ff('0x2'));var jsonpatch=require(_0x00ff('0x3'));var rp=require(_0x00ff('0x4'));var moment=require(_0x00ff('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x00ff('0x6'));var util=require('util');var path=require('path');var sox=require(_0x00ff('0x7'));var csv=require(_0x00ff('0x8'));var ejs=require(_0x00ff('0x9'));var fs=require('fs');var fs_extra=require(_0x00ff('0xa'));var _=require('lodash');var squel=require(_0x00ff('0xb'));var crypto=require(_0x00ff('0xc'));var jsforce=require(_0x00ff('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x00ff('0xe'));var authService=require(_0x00ff('0xf'));var qs=require(_0x00ff('0x10'));var as=require(_0x00ff('0x11'));var hardwareService=require(_0x00ff('0x12'));var logger=require('../../config/logger')(_0x00ff('0x13'));var utils=require(_0x00ff('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x00ff('0x15'));var db=require(_0x00ff('0x16'))['db'];function respondWithStatusCode(_0xd6ee3e,_0x2cdafb){_0x2cdafb=_0x2cdafb||0xcc;return function(_0xe893d5){if(_0xe893d5){return _0xd6ee3e['sendStatus'](_0x2cdafb);}return _0xd6ee3e[_0x00ff('0x17')](_0x2cdafb)[_0x00ff('0x18')]();};}function respondWithResult(_0x29f354,_0x23e51d){_0x23e51d=_0x23e51d||0xc8;return function(_0x65b707){if(_0x65b707){return _0x29f354[_0x00ff('0x17')](_0x23e51d)['json'](_0x65b707);}};}function respondWithFilteredResult(_0x3dfa25,_0x5cd681){return function(_0x1b1ac4){if(_0x1b1ac4){var _0x5b27a8=typeof _0x5cd681['offset']===_0x00ff('0x19')&&typeof _0x5cd681[_0x00ff('0x1a')]==='undefined';var _0x3105e2=_0x1b1ac4['count'];var _0x57f2a5=_0x5b27a8?0x0:_0x5cd681[_0x00ff('0x1b')];var _0x2efce9=_0x5b27a8?_0x1b1ac4[_0x00ff('0x1c')]:_0x5cd681[_0x00ff('0x1b')]+_0x5cd681['limit'];var _0x5abba4;if(_0x2efce9>=_0x3105e2){_0x2efce9=_0x3105e2;_0x5abba4=0xc8;}else{_0x5abba4=0xce;}_0x3dfa25[_0x00ff('0x17')](_0x5abba4);return _0x3dfa25['set'](_0x00ff('0x1d'),_0x57f2a5+'-'+_0x2efce9+'/'+_0x3105e2)[_0x00ff('0x1e')](_0x1b1ac4);}return null;};}function patchUpdates(_0x3b3c8b){return function(_0x4ed6f0){try{jsonpatch[_0x00ff('0x1f')](_0x4ed6f0,_0x3b3c8b,!![]);}catch(_0x3409b3){return BPromise[_0x00ff('0x20')](_0x3409b3);}return _0x4ed6f0[_0x00ff('0x21')]();};}function saveUpdates(_0x37b778,_0x16f5e7){return function(_0x183a40){if(_0x183a40){return _0x183a40[_0x00ff('0x22')](_0x37b778)['then'](function(_0x21a1fb){return _0x21a1fb;});}return null;};}function removeEntity(_0xcfcb37,_0x46214b){return function(_0x12df12){if(_0x12df12){return _0x12df12[_0x00ff('0x23')]()[_0x00ff('0x24')](function(){_0xcfcb37[_0x00ff('0x17')](0xcc)[_0x00ff('0x18')]();});}};}function handleEntityNotFound(_0x54740d,_0x11e552){return function(_0x36caa2){if(!_0x36caa2){_0x54740d[_0x00ff('0x25')](0x194);}return _0x36caa2;};}function handleError(_0x2c859e,_0x30665b){_0x30665b=_0x30665b||0x1f4;return function(_0x52bc19){logger['error'](_0x52bc19[_0x00ff('0x26')]);if(_0x52bc19[_0x00ff('0x27')]){delete _0x52bc19[_0x00ff('0x27')];}_0x2c859e[_0x00ff('0x17')](_0x30665b)[_0x00ff('0x28')](_0x52bc19);};}exports['index']=function(_0x1797b4,_0x3facb0){var _0x118e84={},_0x2683a7={},_0x184c9a={'count':0x0,'rows':[]};var _0x322634=_['map'](db[_0x00ff('0x29')][_0x00ff('0x2a')],function(_0x5465f8){return{'name':_0x5465f8[_0x00ff('0x2b')],'type':_0x5465f8[_0x00ff('0x2c')][_0x00ff('0x2d')]};});_0x2683a7[_0x00ff('0x2e')]=_[_0x00ff('0x2f')](_0x322634,_0x00ff('0x27'));_0x2683a7[_0x00ff('0x30')]=_[_0x00ff('0x31')](_0x1797b4[_0x00ff('0x30')]);_0x2683a7[_0x00ff('0x32')]=_['intersection'](_0x2683a7['model'],_0x2683a7['query']);_0x118e84[_0x00ff('0x33')]=_[_0x00ff('0x34')](_0x2683a7['model'],qs[_0x00ff('0x35')](_0x1797b4[_0x00ff('0x30')]['fields']));_0x118e84['attributes']=_0x118e84[_0x00ff('0x33')][_0x00ff('0x36')]?_0x118e84[_0x00ff('0x33')]:_0x2683a7[_0x00ff('0x2e')];if(!_0x1797b4[_0x00ff('0x30')]['hasOwnProperty']('nolimit')){_0x118e84[_0x00ff('0x1a')]=qs[_0x00ff('0x1a')](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x1a')]);_0x118e84[_0x00ff('0x1b')]=qs['offset'](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x1b')]);}_0x118e84[_0x00ff('0x37')]=qs[_0x00ff('0x38')](_0x1797b4[_0x00ff('0x30')][_0x00ff('0x38')]);_0x118e84[_0x00ff('0x39')]=qs[_0x00ff('0x32')](_['pick'](_0x1797b4[_0x00ff('0x30')],_0x2683a7['filters']),_0x322634);if(_0x1797b4[_0x00ff('0x30')]['filter']){_0x118e84[_0x00ff('0x39')]=_['merge'](_0x118e84[_0x00ff('0x39')],{'$or':_[_0x00ff('0x2f')](_0x322634,function(_0x2c8663){if(_0x2c8663['type']!==_0x00ff('0x3a')){var _0x4b64b4={};_0x4b64b4[_0x2c8663[_0x00ff('0x27')]]={'$like':'%'+_0x1797b4[_0x00ff('0x30')][_0x00ff('0x3b')]+'%'};return _0x4b64b4;}})});}_0x118e84=_['merge']({},_0x118e84,_0x1797b4[_0x00ff('0x3c')]);var _0x54cd0c={'where':_0x118e84[_0x00ff('0x39')]};return db[_0x00ff('0x29')][_0x00ff('0x1c')](_0x54cd0c)[_0x00ff('0x24')](function(_0x3fa4e3){_0x184c9a[_0x00ff('0x1c')]=_0x3fa4e3;if(_0x1797b4['query']['includeAll']){_0x118e84['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x00ff('0x3d')](_0x118e84);})[_0x00ff('0x24')](function(_0x398075){_0x184c9a[_0x00ff('0x3e')]=_0x398075;return _0x184c9a;})['then'](respondWithFilteredResult(_0x3facb0,_0x118e84))['catch'](handleError(_0x3facb0,null));};exports[_0x00ff('0x3f')]=function(_0x2dd440,_0x1dbb0c){var _0x127b0b={'raw':!![],'where':{'id':_0x2dd440[_0x00ff('0x40')]['id']}},_0x4b43cc={};_0x4b43cc[_0x00ff('0x2e')]=_[_0x00ff('0x31')](db[_0x00ff('0x29')][_0x00ff('0x2a')]);_0x4b43cc[_0x00ff('0x30')]=_[_0x00ff('0x31')](_0x2dd440[_0x00ff('0x30')]);_0x4b43cc[_0x00ff('0x32')]=_[_0x00ff('0x34')](_0x4b43cc['model'],_0x4b43cc[_0x00ff('0x30')]);_0x127b0b[_0x00ff('0x33')]=_[_0x00ff('0x34')](_0x4b43cc[_0x00ff('0x2e')],qs[_0x00ff('0x35')](_0x2dd440[_0x00ff('0x30')][_0x00ff('0x35')]));_0x127b0b[_0x00ff('0x33')]=_0x127b0b['attributes'][_0x00ff('0x36')]?_0x127b0b[_0x00ff('0x33')]:_0x4b43cc[_0x00ff('0x2e')];if(_0x2dd440[_0x00ff('0x30')]['includeAll']){_0x127b0b[_0x00ff('0x41')]=[{'all':!![]}];}_0x127b0b=_[_0x00ff('0x42')]({},_0x127b0b,_0x2dd440[_0x00ff('0x3c')]);return db['OpenchannelTransferReport']['find'](_0x127b0b)[_0x00ff('0x24')](handleEntityNotFound(_0x1dbb0c,null))[_0x00ff('0x24')](respondWithResult(_0x1dbb0c,null))['catch'](handleError(_0x1dbb0c,null));};exports[_0x00ff('0x43')]=function(_0x2bce8e,_0xf2a18d){return db['OpenchannelTransferReport']['create'](_0x2bce8e[_0x00ff('0x44')],{})[_0x00ff('0x24')](respondWithResult(_0xf2a18d,0xc9))[_0x00ff('0x45')](handleError(_0xf2a18d,null));};exports[_0x00ff('0x22')]=function(_0x3e40df,_0x431c64){if(_0x3e40df[_0x00ff('0x44')]['id']){delete _0x3e40df[_0x00ff('0x44')]['id'];}return db[_0x00ff('0x29')]['find']({'where':{'id':_0x3e40df[_0x00ff('0x40')]['id']}})[_0x00ff('0x24')](handleEntityNotFound(_0x431c64,null))['then'](saveUpdates(_0x3e40df[_0x00ff('0x44')],null))[_0x00ff('0x24')](respondWithResult(_0x431c64,null))[_0x00ff('0x45')](handleError(_0x431c64,null));};exports[_0x00ff('0x23')]=function(_0x59743e,_0x5b9b95){return db[_0x00ff('0x29')][_0x00ff('0x46')]({'where':{'id':_0x59743e[_0x00ff('0x40')]['id']}})[_0x00ff('0x24')](handleEntityNotFound(_0x5b9b95,null))[_0x00ff('0x24')](removeEntity(_0x5b9b95,null))[_0x00ff('0x45')](handleError(_0x5b9b95,null));};exports[_0x00ff('0x47')]=function(_0x23e1ba,_0x2959e8){return db['OpenchannelTransferReport'][_0x00ff('0x47')]()[_0x00ff('0x24')](respondWithResult(_0x2959e8,null))[_0x00ff('0x45')](handleError(_0x2959e8,null));}; \ No newline at end of file +var _0xac70=['save','then','destroy','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','options','OpenchannelTransferReport','includeAll','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xac70,0x18f));var _0x0ac7=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0xac70[_0x1cd5b1];return _0x25b4c7;};'use strict';var emlformat=require(_0x0ac7('0x0'));var rimraf=require(_0x0ac7('0x1'));var zipdir=require(_0x0ac7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0ac7('0x3'));var moment=require(_0x0ac7('0x4'));var BPromise=require(_0x0ac7('0x5'));var Mustache=require(_0x0ac7('0x6'));var util=require('util');var path=require(_0x0ac7('0x7'));var sox=require(_0x0ac7('0x8'));var csv=require('to-csv');var ejs=require(_0x0ac7('0x9'));var fs=require('fs');var fs_extra=require(_0x0ac7('0xa'));var _=require(_0x0ac7('0xb'));var squel=require(_0x0ac7('0xc'));var crypto=require(_0x0ac7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0ac7('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0ac7('0xf'));var authService=require(_0x0ac7('0x10'));var qs=require(_0x0ac7('0x11'));var as=require(_0x0ac7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0ac7('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0ac7('0x14'));var db=require(_0x0ac7('0x15'))['db'];function respondWithStatusCode(_0x21364b,_0x38cb5f){_0x38cb5f=_0x38cb5f||0xcc;return function(_0x2d9f51){if(_0x2d9f51){return _0x21364b[_0x0ac7('0x16')](_0x38cb5f);}return _0x21364b[_0x0ac7('0x17')](_0x38cb5f)[_0x0ac7('0x18')]();};}function respondWithResult(_0x24acce,_0x3a1e60){_0x3a1e60=_0x3a1e60||0xc8;return function(_0x3fdd45){if(_0x3fdd45){return _0x24acce[_0x0ac7('0x17')](_0x3a1e60)['json'](_0x3fdd45);}};}function respondWithFilteredResult(_0x13bf5e,_0xd4903d){return function(_0x3bf21b){if(_0x3bf21b){var _0x3f2423=typeof _0xd4903d[_0x0ac7('0x19')]===_0x0ac7('0x1a')&&typeof _0xd4903d['limit']===_0x0ac7('0x1a');var _0xd90511=_0x3bf21b[_0x0ac7('0x1b')];var _0x49574a=_0x3f2423?0x0:_0xd4903d[_0x0ac7('0x19')];var _0x55a026=_0x3f2423?_0x3bf21b[_0x0ac7('0x1b')]:_0xd4903d['offset']+_0xd4903d['limit'];var _0x148100;if(_0x55a026>=_0xd90511){_0x55a026=_0xd90511;_0x148100=0xc8;}else{_0x148100=0xce;}_0x13bf5e[_0x0ac7('0x17')](_0x148100);return _0x13bf5e[_0x0ac7('0x1c')](_0x0ac7('0x1d'),_0x49574a+'-'+_0x55a026+'/'+_0xd90511)[_0x0ac7('0x1e')](_0x3bf21b);}return null;};}function patchUpdates(_0x334844){return function(_0x59d09f){try{jsonpatch[_0x0ac7('0x1f')](_0x59d09f,_0x334844,!![]);}catch(_0x311bdc){return BPromise[_0x0ac7('0x20')](_0x311bdc);}return _0x59d09f[_0x0ac7('0x21')]();};}function saveUpdates(_0x5b0664,_0x2d93e2){return function(_0x87a89d){if(_0x87a89d){return _0x87a89d['update'](_0x5b0664)[_0x0ac7('0x22')](function(_0x2c2cbf){return _0x2c2cbf;});}return null;};}function removeEntity(_0x1f4ad7,_0x329838){return function(_0x443760){if(_0x443760){return _0x443760[_0x0ac7('0x23')]()[_0x0ac7('0x22')](function(){_0x1f4ad7['status'](0xcc)[_0x0ac7('0x18')]();});}};}function handleEntityNotFound(_0x5b9bc4,_0x187a9b){return function(_0x40fa9a){if(!_0x40fa9a){_0x5b9bc4[_0x0ac7('0x16')](0x194);}return _0x40fa9a;};}function handleError(_0x1d6d5f,_0x2cf792){_0x2cf792=_0x2cf792||0x1f4;return function(_0x44dfbd){logger['error'](_0x44dfbd['stack']);if(_0x44dfbd[_0x0ac7('0x24')]){delete _0x44dfbd[_0x0ac7('0x24')];}_0x1d6d5f[_0x0ac7('0x17')](_0x2cf792)[_0x0ac7('0x25')](_0x44dfbd);};}exports[_0x0ac7('0x26')]=function(_0x382a07,_0x4112b4){var _0x472894={},_0x375bf7={},_0x3a2605={'count':0x0,'rows':[]};var _0x4a5166=_['map'](db['OpenchannelTransferReport'][_0x0ac7('0x27')],function(_0x1b0c32){return{'name':_0x1b0c32[_0x0ac7('0x28')],'type':_0x1b0c32[_0x0ac7('0x29')][_0x0ac7('0x2a')]};});_0x375bf7[_0x0ac7('0x2b')]=_[_0x0ac7('0x2c')](_0x4a5166,_0x0ac7('0x24'));_0x375bf7[_0x0ac7('0x2d')]=_['keys'](_0x382a07[_0x0ac7('0x2d')]);_0x375bf7[_0x0ac7('0x2e')]=_[_0x0ac7('0x2f')](_0x375bf7[_0x0ac7('0x2b')],_0x375bf7[_0x0ac7('0x2d')]);_0x472894[_0x0ac7('0x30')]=_[_0x0ac7('0x2f')](_0x375bf7['model'],qs[_0x0ac7('0x31')](_0x382a07[_0x0ac7('0x2d')]['fields']));_0x472894[_0x0ac7('0x30')]=_0x472894[_0x0ac7('0x30')][_0x0ac7('0x32')]?_0x472894['attributes']:_0x375bf7[_0x0ac7('0x2b')];if(!_0x382a07[_0x0ac7('0x2d')][_0x0ac7('0x33')](_0x0ac7('0x34'))){_0x472894['limit']=qs[_0x0ac7('0x35')](_0x382a07[_0x0ac7('0x2d')]['limit']);_0x472894['offset']=qs[_0x0ac7('0x19')](_0x382a07[_0x0ac7('0x2d')]['offset']);}_0x472894[_0x0ac7('0x36')]=qs[_0x0ac7('0x37')](_0x382a07['query'][_0x0ac7('0x37')]);_0x472894[_0x0ac7('0x38')]=qs[_0x0ac7('0x2e')](_[_0x0ac7('0x39')](_0x382a07[_0x0ac7('0x2d')],_0x375bf7[_0x0ac7('0x2e')]),_0x4a5166);if(_0x382a07['query'][_0x0ac7('0x3a')]){_0x472894[_0x0ac7('0x38')]=_['merge'](_0x472894['where'],{'$or':_[_0x0ac7('0x2c')](_0x4a5166,function(_0x1954c5){if(_0x1954c5['type']!==_0x0ac7('0x3b')){var _0x40e562={};_0x40e562[_0x1954c5[_0x0ac7('0x24')]]={'$like':'%'+_0x382a07[_0x0ac7('0x2d')][_0x0ac7('0x3a')]+'%'};return _0x40e562;}})});}_0x472894=_['merge']({},_0x472894,_0x382a07[_0x0ac7('0x3c')]);var _0x1546b8={'where':_0x472894['where']};return db[_0x0ac7('0x3d')]['count'](_0x1546b8)[_0x0ac7('0x22')](function(_0x126d66){_0x3a2605[_0x0ac7('0x1b')]=_0x126d66;if(_0x382a07['query'][_0x0ac7('0x3e')]){_0x472894['include']=[{'all':!![]}];}return db[_0x0ac7('0x3d')][_0x0ac7('0x3f')](_0x472894);})[_0x0ac7('0x22')](function(_0x65387e){_0x3a2605[_0x0ac7('0x40')]=_0x65387e;return _0x3a2605;})[_0x0ac7('0x22')](respondWithFilteredResult(_0x4112b4,_0x472894))[_0x0ac7('0x41')](handleError(_0x4112b4,null));};exports['show']=function(_0x44f2b7,_0x26f14c){var _0x1fb96f={'raw':!![],'where':{'id':_0x44f2b7[_0x0ac7('0x42')]['id']}},_0x4632ab={};_0x4632ab[_0x0ac7('0x2b')]=_[_0x0ac7('0x43')](db[_0x0ac7('0x3d')]['rawAttributes']);_0x4632ab[_0x0ac7('0x2d')]=_[_0x0ac7('0x43')](_0x44f2b7[_0x0ac7('0x2d')]);_0x4632ab['filters']=_[_0x0ac7('0x2f')](_0x4632ab[_0x0ac7('0x2b')],_0x4632ab[_0x0ac7('0x2d')]);_0x1fb96f[_0x0ac7('0x30')]=_[_0x0ac7('0x2f')](_0x4632ab[_0x0ac7('0x2b')],qs[_0x0ac7('0x31')](_0x44f2b7[_0x0ac7('0x2d')][_0x0ac7('0x31')]));_0x1fb96f[_0x0ac7('0x30')]=_0x1fb96f[_0x0ac7('0x30')][_0x0ac7('0x32')]?_0x1fb96f[_0x0ac7('0x30')]:_0x4632ab[_0x0ac7('0x2b')];if(_0x44f2b7['query'][_0x0ac7('0x3e')]){_0x1fb96f['include']=[{'all':!![]}];}_0x1fb96f=_['merge']({},_0x1fb96f,_0x44f2b7['options']);return db[_0x0ac7('0x3d')][_0x0ac7('0x44')](_0x1fb96f)['then'](handleEntityNotFound(_0x26f14c,null))[_0x0ac7('0x22')](respondWithResult(_0x26f14c,null))[_0x0ac7('0x41')](handleError(_0x26f14c,null));};exports[_0x0ac7('0x45')]=function(_0x4cd603,_0x542883){return db[_0x0ac7('0x3d')][_0x0ac7('0x45')](_0x4cd603[_0x0ac7('0x46')],{})[_0x0ac7('0x22')](respondWithResult(_0x542883,0xc9))[_0x0ac7('0x41')](handleError(_0x542883,null));};exports['update']=function(_0x6f8310,_0x44106e){if(_0x6f8310[_0x0ac7('0x46')]['id']){delete _0x6f8310[_0x0ac7('0x46')]['id'];}return db[_0x0ac7('0x3d')][_0x0ac7('0x44')]({'where':{'id':_0x6f8310[_0x0ac7('0x42')]['id']}})['then'](handleEntityNotFound(_0x44106e,null))[_0x0ac7('0x22')](saveUpdates(_0x6f8310[_0x0ac7('0x46')],null))[_0x0ac7('0x22')](respondWithResult(_0x44106e,null))[_0x0ac7('0x41')](handleError(_0x44106e,null));};exports[_0x0ac7('0x23')]=function(_0x38878c,_0x434115){return db[_0x0ac7('0x3d')][_0x0ac7('0x44')]({'where':{'id':_0x38878c[_0x0ac7('0x42')]['id']}})[_0x0ac7('0x22')](handleEntityNotFound(_0x434115,null))['then'](removeEntity(_0x434115,null))[_0x0ac7('0x41')](handleError(_0x434115,null));};exports[_0x0ac7('0x47')]=function(_0x57a0ed,_0xebbb5a){return db[_0x0ac7('0x3d')][_0x0ac7('0x47')]()[_0x0ac7('0x22')](respondWithResult(_0xebbb5a,null))[_0x0ac7('0x41')](handleError(_0xebbb5a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c02dd8a..4aeb643 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 _0x6d48=['exports','define','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0x209e4c,_0x27199c){var _0x453986=function(_0x2bf57){while(--_0x2bf57){_0x209e4c['push'](_0x209e4c['shift']());}};_0x453986(++_0x27199c);}(_0x6d48,0x1d2));var _0x86d4=function(_0x36c230,_0x1c7cfd){_0x36c230=_0x36c230-0x0;var _0x321e0e=_0x6d48[_0x36c230];return _0x321e0e;};'use strict';var _=require(_0x86d4('0x0'));var util=require(_0x86d4('0x1'));var logger=require(_0x86d4('0x2'))(_0x86d4('0x3'));var moment=require('moment');var BPromise=require(_0x86d4('0x4'));var rp=require(_0x86d4('0x5'));var fs=require('fs');var path=require(_0x86d4('0x6'));var rimraf=require(_0x86d4('0x7'));var config=require(_0x86d4('0x8'));var attributes=require(_0x86d4('0x9'));module[_0x86d4('0xa')]=function(_0x168701,_0x562be7){return _0x168701[_0x86d4('0xb')]('OpenchannelTransferReport',attributes,{'tableName':_0x86d4('0xc'),'paranoid':![],'indexes':[{'name':_0x86d4('0xd'),'fields':[_0x86d4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x966d=['util','../../config/logger','api','bluebird','path','./openchannelTransferReport.attributes','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x966d,0xbd));var _0xd966=function(_0x21553e,_0x41e77d){_0x21553e=_0x21553e-0x0;var _0x5c9396=_0x966d[_0x21553e];return _0x5c9396;};'use strict';var _=require(_0xd966('0x0'));var util=require(_0xd966('0x1'));var logger=require(_0xd966('0x2'))(_0xd966('0x3'));var moment=require('moment');var BPromise=require(_0xd966('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd966('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd966('0x6'));module['exports']=function(_0x185200,_0x56c196){return _0x185200['define'](_0xd966('0x7'),attributes,{'tableName':_0xd966('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd966('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 01bb368..752acb3 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 _0xf95f=['../../config/logger','../../config/environment','client','request','then','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x145c99,_0x3fdb01){var _0x52a05f=function(_0x36feb0){while(--_0x36feb0){_0x145c99['push'](_0x145c99['shift']());}};_0x52a05f(++_0x3fdb01);}(_0xf95f,0x142));var _0xff95=function(_0x49f30e,_0xf28439){_0x49f30e=_0x49f30e-0x0;var _0x2cafd5=_0xf95f[_0x49f30e];return _0x2cafd5;};'use strict';var _=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var moment=require(_0xff95('0x2'));var BPromise=require(_0xff95('0x3'));var rs=require(_0xff95('0x4'));var fs=require('fs');var Redis=require(_0xff95('0x5'));var db=require(_0xff95('0x6'))['db'];var utils=require(_0xff95('0x7'));var logger=require(_0xff95('0x8'))('rpc');var config=require(_0xff95('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x314fb4,_0x781e05,_0x2b9ce9){return new BPromise(function(_0x1a42b2,_0x198a51){return client[_0xff95('0xb')](_0x314fb4,_0x2b9ce9)[_0xff95('0xc')](function(_0xa2a50d){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x781e05,_0xff95('0xd'));logger[_0xff95('0xe')](_0xff95('0xf'),_0x781e05,_0xff95('0xd'),JSON[_0xff95('0x10')](_0xa2a50d));if(_0xa2a50d[_0xff95('0x11')]){if(_0xa2a50d[_0xff95('0x11')]['code']===0x1f4){logger['error'](_0xff95('0x12'),_0x781e05,_0xa2a50d[_0xff95('0x11')]['message']);return _0x198a51(_0xa2a50d[_0xff95('0x11')]['message']);}logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x781e05,_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);return _0x1a42b2(_0xa2a50d[_0xff95('0x11')][_0xff95('0x13')]);}else{logger[_0xff95('0x14')](_0xff95('0x12'),_0x781e05,'request\x20sent');_0x1a42b2(_0xa2a50d['result'][_0xff95('0x13')]);}})[_0xff95('0x15')](function(_0x83e644){logger[_0xff95('0x11')](_0xff95('0x12'),_0x781e05,_0x83e644);_0x198a51(_0x83e644);});});} \ No newline at end of file +var _0x6bdc=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bdc,0x14e));var _0xc6bd=function(_0x5f2e03,_0x2f09b9){_0x5f2e03=_0x5f2e03-0x0;var _0x2dae52=_0x6bdc[_0x5f2e03];return _0x2dae52;};'use strict';var _=require(_0xc6bd('0x0'));var util=require(_0xc6bd('0x1'));var moment=require(_0xc6bd('0x2'));var BPromise=require(_0xc6bd('0x3'));var rs=require(_0xc6bd('0x4'));var fs=require('fs');var Redis=require(_0xc6bd('0x5'));var db=require(_0xc6bd('0x6'))['db'];var utils=require(_0xc6bd('0x7'));var logger=require(_0xc6bd('0x8'))(_0xc6bd('0x9'));var config=require('../../config/environment');var jayson=require(_0xc6bd('0xa'));var client=jayson[_0xc6bd('0xb')][_0xc6bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5327,_0x2c1c68,_0x8bd379){return new BPromise(function(_0x5ca385,_0x374067){return client[_0xc6bd('0xd')](_0x3f5327,_0x8bd379)[_0xc6bd('0xe')](function(_0x5e92e8){logger['info'](_0xc6bd('0xf'),_0x2c1c68,'request\x20sent');logger[_0xc6bd('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2c1c68,_0xc6bd('0x11'),JSON[_0xc6bd('0x12')](_0x5e92e8));if(_0x5e92e8[_0xc6bd('0x13')]){if(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x14')]===0x1f4){logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);return _0x374067(_0x5e92e8[_0xc6bd('0x13')][_0xc6bd('0x15')]);}logger[_0xc6bd('0x13')](_0xc6bd('0xf'),_0x2c1c68,_0x5e92e8[_0xc6bd('0x13')]['message']);return _0x5ca385(_0x5e92e8[_0xc6bd('0x13')]['message']);}else{logger['info'](_0xc6bd('0xf'),_0x2c1c68,_0xc6bd('0x11'));_0x5ca385(_0x5e92e8[_0xc6bd('0x16')][_0xc6bd('0x15')]);}})[_0xc6bd('0x17')](function(_0x5795bc){logger['error'](_0xc6bd('0xf'),_0x2c1c68,_0x5795bc);_0x374067(_0x5795bc);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 95f6522..30d9de4 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 _0x8f09=['get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0x29b762,_0x24fa32){var _0x3af2af=function(_0x30a4fd){while(--_0x30a4fd){_0x29b762['push'](_0x29b762['shift']());}};_0x3af2af(++_0x24fa32);}(_0x8f09,0x19c));var _0x98f0=function(_0x3c60f2,_0x3ad2fa){_0x3c60f2=_0x3c60f2-0x0;var _0x2aff17=_0x8f09[_0x3c60f2];return _0x2aff17;};'use strict';var multer=require(_0x98f0('0x0'));var util=require(_0x98f0('0x1'));var path=require('path');var timeout=require(_0x98f0('0x2'));var express=require(_0x98f0('0x3'));var router=express['Router']();var fs_extra=require(_0x98f0('0x4'));var auth=require(_0x98f0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x98f0('0x6'));var controller=require(_0x98f0('0x7'));router[_0x98f0('0x8')]('/',auth[_0x98f0('0x9')](),controller['index']);router[_0x98f0('0x8')](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller['show']);router['post']('/',auth[_0x98f0('0x9')](),controller['create']);router['put'](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller[_0x98f0('0xb')]);router[_0x98f0('0xc')](_0x98f0('0xa'),auth[_0x98f0('0x9')](),controller[_0x98f0('0xd')]);module[_0x98f0('0xe')]=router; \ No newline at end of file +var _0x976f=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','destroy'];(function(_0x339665,_0x125b33){var _0x316a86=function(_0x5285a0){while(--_0x5285a0){_0x339665['push'](_0x339665['shift']());}};_0x316a86(++_0x125b33);}(_0x976f,0x121));var _0xf976=function(_0x412484,_0x276b6c){_0x412484=_0x412484-0x0;var _0x1d6329=_0x976f[_0x412484];return _0x1d6329;};'use strict';var multer=require(_0xf976('0x0'));var util=require(_0xf976('0x1'));var path=require(_0xf976('0x2'));var timeout=require(_0xf976('0x3'));var express=require('express');var router=express[_0xf976('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf976('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf976('0x6'));var controller=require('./pause.controller');router[_0xf976('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf976('0x7')](_0xf976('0x8'),auth[_0xf976('0x9')](),controller[_0xf976('0xa')]);router[_0xf976('0xb')]('/',auth[_0xf976('0x9')](),controller[_0xf976('0xc')]);router[_0xf976('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf976('0x9')](),controller[_0xf976('0xe')]);module[_0xf976('0xf')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 0acb0b6..8ffd2bc 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 _0x3f96=['sequelize','STRING'];(function(_0x268c3f,_0x59e89f){var _0x191caa=function(_0x7b277d){while(--_0x7b277d){_0x268c3f['push'](_0x268c3f['shift']());}};_0x191caa(++_0x59e89f);}(_0x3f96,0x120));var _0x63f9=function(_0x35b969,_0x3f2d65){_0x35b969=_0x35b969-0x0;var _0x731384=_0x3f96[_0x35b969];return _0x731384;};'use strict';var Sequelize=require(_0x63f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x63f9('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x63f9('0x1')]}}; \ No newline at end of file +var _0x1d95=['name','sequelize','exports','STRING'];(function(_0x3300b0,_0x3a4431){var _0x3dc5f2=function(_0x331157){while(--_0x331157){_0x3300b0['push'](_0x3300b0['shift']());}};_0x3dc5f2(++_0x3a4431);}(_0x1d95,0xbd));var _0x51d9=function(_0x400424,_0x8ba476){_0x400424=_0x400424-0x0;var _0x31835d=_0x1d95[_0x400424];return _0x31835d;};'use strict';var Sequelize=require(_0x51d9('0x0'));module[_0x51d9('0x1')]={'name':{'type':Sequelize[_0x51d9('0x2')],'unique':_0x51d9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x51d9('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a721761..d132a79 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 _0x6743=['undefined','count','offset','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','catch','show','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Pauses','UserProfileSection','autoAssociation','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','limit'];(function(_0x2002b3,_0x11e91c){var _0x2756f0=function(_0x4bf0b3){while(--_0x4bf0b3){_0x2002b3['push'](_0x2002b3['shift']());}};_0x2756f0(++_0x11e91c);}(_0x6743,0x82));var _0x3674=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x6743[_0x3b56c0];return _0x377efe;};'use strict';var emlformat=require(_0x3674('0x0'));var rimraf=require(_0x3674('0x1'));var zipdir=require(_0x3674('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3674('0x3'));var moment=require(_0x3674('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3674('0x5'));var util=require(_0x3674('0x6'));var path=require('path');var sox=require(_0x3674('0x7'));var csv=require(_0x3674('0x8'));var ejs=require(_0x3674('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3674('0xa'));var squel=require('squel');var crypto=require(_0x3674('0xb'));var jsforce=require(_0x3674('0xc'));var deskjs=require(_0x3674('0xd'));var toCsv=require(_0x3674('0x8'));var querystring=require(_0x3674('0xe'));var Papa=require(_0x3674('0xf'));var Redis=require('ioredis');var authService=require(_0x3674('0x10'));var qs=require(_0x3674('0x11'));var as=require(_0x3674('0x12'));var hardwareService=require(_0x3674('0x13'));var logger=require(_0x3674('0x14'))(_0x3674('0x15'));var utils=require('../../config/utils');var config=require(_0x3674('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda4612,_0x32cf23){_0x32cf23=_0x32cf23||0xcc;return function(_0x3dceb8){if(_0x3dceb8){return _0xda4612[_0x3674('0x17')](_0x32cf23);}return _0xda4612[_0x3674('0x18')](_0x32cf23)['end']();};}function respondWithResult(_0x5b23c7,_0xbf8db3){_0xbf8db3=_0xbf8db3||0xc8;return function(_0x4e75d5){if(_0x4e75d5){return _0x5b23c7['status'](_0xbf8db3)['json'](_0x4e75d5);}};}function respondWithFilteredResult(_0x23b471,_0x19253a){return function(_0x503ca9){if(_0x503ca9){var _0xffd669=typeof _0x19253a['offset']==='undefined'&&typeof _0x19253a[_0x3674('0x19')]===_0x3674('0x1a');var _0x157288=_0x503ca9[_0x3674('0x1b')];var _0x4b2a6b=_0xffd669?0x0:_0x19253a[_0x3674('0x1c')];var _0x4c233d=_0xffd669?_0x503ca9[_0x3674('0x1b')]:_0x19253a[_0x3674('0x1c')]+_0x19253a['limit'];var _0x191508;if(_0x4c233d>=_0x157288){_0x4c233d=_0x157288;_0x191508=0xc8;}else{_0x191508=0xce;}_0x23b471[_0x3674('0x18')](_0x191508);return _0x23b471['set'](_0x3674('0x1d'),_0x4b2a6b+'-'+_0x4c233d+'/'+_0x157288)[_0x3674('0x1e')](_0x503ca9);}return null;};}function patchUpdates(_0x39ad13){return function(_0x2cbc07){try{jsonpatch[_0x3674('0x1f')](_0x2cbc07,_0x39ad13,!![]);}catch(_0x102ac9){return BPromise['reject'](_0x102ac9);}return _0x2cbc07[_0x3674('0x20')]();};}function saveUpdates(_0x3a34fd,_0x4e8101){return function(_0x46bafa){if(_0x46bafa){return _0x46bafa[_0x3674('0x21')](_0x3a34fd)[_0x3674('0x22')](function(_0x11b691){return _0x11b691;});}return null;};}function removeEntity(_0x4af1b7,_0x3a1b1d){return function(_0x5a507a){if(_0x5a507a){return _0x5a507a[_0x3674('0x23')]()[_0x3674('0x22')](function(){var _0x49df02=_0x5a507a[_0x3674('0x24')]({'plain':!![]});var _0x1a5b71='Pauses';return db[_0x3674('0x25')]['destroy']({'where':{'type':_0x1a5b71,'resourceId':_0x49df02['id']}})[_0x3674('0x22')](function(){return _0x5a507a;});})['then'](function(){_0x4af1b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaf257,_0x53bfe1){return function(_0x3ced5d){if(!_0x3ced5d){_0xbaf257['sendStatus'](0x194);}return _0x3ced5d;};}function handleError(_0x26b4cd,_0x371741){_0x371741=_0x371741||0x1f4;return function(_0x4de792){logger[_0x3674('0x26')](_0x4de792[_0x3674('0x27')]);if(_0x4de792[_0x3674('0x28')]){delete _0x4de792[_0x3674('0x28')];}_0x26b4cd[_0x3674('0x18')](_0x371741)[_0x3674('0x29')](_0x4de792);};}exports['index']=function(_0x3a7ce6,_0x375603){var _0xd21373={},_0x5275fa={},_0x271a6f={'count':0x0,'rows':[]};var _0x1af5cd=_[_0x3674('0x2a')](db[_0x3674('0x2b')][_0x3674('0x2c')],function(_0x510318){return{'name':_0x510318[_0x3674('0x2d')],'type':_0x510318[_0x3674('0x2e')][_0x3674('0x2f')]};});_0x5275fa[_0x3674('0x30')]=_['map'](_0x1af5cd,_0x3674('0x28'));_0x5275fa[_0x3674('0x31')]=_[_0x3674('0x32')](_0x3a7ce6[_0x3674('0x31')]);_0x5275fa['filters']=_[_0x3674('0x33')](_0x5275fa[_0x3674('0x30')],_0x5275fa['query']);_0xd21373[_0x3674('0x34')]=_[_0x3674('0x33')](_0x5275fa[_0x3674('0x30')],qs[_0x3674('0x35')](_0x3a7ce6[_0x3674('0x31')][_0x3674('0x35')]));_0xd21373['attributes']=_0xd21373['attributes']['length']?_0xd21373['attributes']:_0x5275fa[_0x3674('0x30')];if(!_0x3a7ce6[_0x3674('0x31')][_0x3674('0x36')]('nolimit')){_0xd21373['limit']=qs[_0x3674('0x19')](_0x3a7ce6['query'][_0x3674('0x19')]);_0xd21373[_0x3674('0x1c')]=qs['offset'](_0x3a7ce6['query']['offset']);}_0xd21373[_0x3674('0x37')]=qs[_0x3674('0x38')](_0x3a7ce6[_0x3674('0x31')][_0x3674('0x38')]);_0xd21373['where']=qs[_0x3674('0x39')](_[_0x3674('0x3a')](_0x3a7ce6['query'],_0x5275fa['filters']),_0x1af5cd);if(_0x3a7ce6[_0x3674('0x31')][_0x3674('0x3b')]){_0xd21373[_0x3674('0x3c')]=_['merge'](_0xd21373[_0x3674('0x3c')],{'$or':_[_0x3674('0x2a')](_0x1af5cd,function(_0x5804a4){if(_0x5804a4[_0x3674('0x2e')]!==_0x3674('0x3d')){var _0x32cdce={};_0x32cdce[_0x5804a4['name']]={'$like':'%'+_0x3a7ce6[_0x3674('0x31')][_0x3674('0x3b')]+'%'};return _0x32cdce;}})});}_0xd21373=_[_0x3674('0x3e')]({},_0xd21373,_0x3a7ce6[_0x3674('0x3f')]);var _0x397a90={'where':_0xd21373[_0x3674('0x3c')]};return db[_0x3674('0x2b')]['count'](_0x397a90)[_0x3674('0x22')](function(_0x4de021){_0x271a6f[_0x3674('0x1b')]=_0x4de021;if(_0x3a7ce6[_0x3674('0x31')]['includeAll']){_0xd21373[_0x3674('0x40')]=[{'all':!![]}];}return db[_0x3674('0x2b')]['findAll'](_0xd21373);})[_0x3674('0x22')](function(_0x4f76a6){_0x271a6f['rows']=_0x4f76a6;return _0x271a6f;})['then'](respondWithFilteredResult(_0x375603,_0xd21373))[_0x3674('0x41')](handleError(_0x375603,null));};exports[_0x3674('0x42')]=function(_0x6345e5,_0x199084){var _0x2af476={'raw':!![],'where':{'id':_0x6345e5['params']['id']}},_0x4858f4={};_0x4858f4[_0x3674('0x30')]=_['keys'](db['Pause']['rawAttributes']);_0x4858f4[_0x3674('0x31')]=_[_0x3674('0x32')](_0x6345e5[_0x3674('0x31')]);_0x4858f4[_0x3674('0x39')]=_[_0x3674('0x33')](_0x4858f4[_0x3674('0x30')],_0x4858f4[_0x3674('0x31')]);_0x2af476[_0x3674('0x34')]=_[_0x3674('0x33')](_0x4858f4[_0x3674('0x30')],qs[_0x3674('0x35')](_0x6345e5[_0x3674('0x31')][_0x3674('0x35')]));_0x2af476[_0x3674('0x34')]=_0x2af476['attributes'][_0x3674('0x43')]?_0x2af476[_0x3674('0x34')]:_0x4858f4['model'];if(_0x6345e5[_0x3674('0x31')][_0x3674('0x44')]){_0x2af476[_0x3674('0x40')]=[{'all':!![]}];}_0x2af476=_[_0x3674('0x3e')]({},_0x2af476,_0x6345e5[_0x3674('0x3f')]);return db[_0x3674('0x2b')][_0x3674('0x45')](_0x2af476)[_0x3674('0x22')](handleEntityNotFound(_0x199084,null))[_0x3674('0x22')](respondWithResult(_0x199084,null))[_0x3674('0x41')](handleError(_0x199084,null));};exports[_0x3674('0x46')]=function(_0xc899f4,_0x11ef09){return db[_0x3674('0x2b')][_0x3674('0x46')](_0xc899f4[_0x3674('0x47')],{})[_0x3674('0x22')](function(_0x4f2a75){var _0x351042=_0xc899f4[_0x3674('0x48')]['get']({'plain':!![]});if(!_0x351042)throw new Error(_0x3674('0x49'));if(_0x351042['role']==='user'){var _0x4ac7c1=_0x4f2a75[_0x3674('0x24')]({'plain':!![]});var _0x3be3ad=_0x3674('0x4a');return db[_0x3674('0x4b')][_0x3674('0x45')]({'where':{'name':_0x3be3ad,'userProfileId':_0x351042['userProfileId']},'raw':!![]})[_0x3674('0x22')](function(_0x1d3757){if(_0x1d3757&&_0x1d3757[_0x3674('0x4c')]===0x0){return db[_0x3674('0x25')]['create']({'name':_0x4ac7c1['name'],'resourceId':_0x4ac7c1['id'],'type':_0x1d3757['name'],'sectionId':_0x1d3757['id']},{})[_0x3674('0x22')](function(){return _0x4f2a75;});}else{return _0x4f2a75;}})['catch'](function(_0xf58264){logger[_0x3674('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf58264);throw _0xf58264;});}return _0x4f2a75;})[_0x3674('0x22')](respondWithResult(_0x11ef09,0xc9))[_0x3674('0x41')](handleError(_0x11ef09,null));};exports['update']=function(_0x81cee,_0x4e8926){if(_0x81cee[_0x3674('0x47')]['id']){delete _0x81cee[_0x3674('0x47')]['id'];}return db['Pause'][_0x3674('0x45')]({'where':{'id':_0x81cee[_0x3674('0x4d')]['id']}})[_0x3674('0x22')](handleEntityNotFound(_0x4e8926,null))['then'](saveUpdates(_0x81cee[_0x3674('0x47')],null))[_0x3674('0x22')](respondWithResult(_0x4e8926,null))[_0x3674('0x41')](handleError(_0x4e8926,null));};exports[_0x3674('0x23')]=function(_0x24d77d,_0x559c5e){return db[_0x3674('0x2b')]['find']({'where':{'id':_0x24d77d[_0x3674('0x4d')]['id']}})[_0x3674('0x22')](handleEntityNotFound(_0x559c5e,null))['then'](removeEntity(_0x559c5e,null))[_0x3674('0x41')](handleError(_0x559c5e,null));}; \ No newline at end of file +var _0xa9c9=['type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','fieldName'];(function(_0x41080e,_0x1b952b){var _0x62ffc2=function(_0x27374f){while(--_0x27374f){_0x41080e['push'](_0x41080e['shift']());}};_0x62ffc2(++_0x1b952b);}(_0xa9c9,0x172));var _0x9a9c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xa9c9[_0x565ed7];return _0x183ad7;};'use strict';var emlformat=require(_0x9a9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a9c('0x1'));var jsonpatch=require(_0x9a9c('0x2'));var rp=require(_0x9a9c('0x3'));var moment=require('moment');var BPromise=require(_0x9a9c('0x4'));var Mustache=require(_0x9a9c('0x5'));var util=require(_0x9a9c('0x6'));var path=require('path');var sox=require(_0x9a9c('0x7'));var csv=require(_0x9a9c('0x8'));var ejs=require(_0x9a9c('0x9'));var fs=require('fs');var fs_extra=require(_0x9a9c('0xa'));var _=require(_0x9a9c('0xb'));var squel=require(_0x9a9c('0xc'));var crypto=require(_0x9a9c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9a9c('0xe'));var toCsv=require(_0x9a9c('0x8'));var querystring=require(_0x9a9c('0xf'));var Papa=require(_0x9a9c('0x10'));var Redis=require(_0x9a9c('0x11'));var authService=require(_0x9a9c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a9c('0x13'));var logger=require(_0x9a9c('0x14'))('api');var utils=require(_0x9a9c('0x15'));var config=require(_0x9a9c('0x16'));var licenseUtil=require(_0x9a9c('0x17'));var db=require(_0x9a9c('0x18'))['db'];function respondWithStatusCode(_0x120d58,_0x764927){_0x764927=_0x764927||0xcc;return function(_0x10d922){if(_0x10d922){return _0x120d58[_0x9a9c('0x19')](_0x764927);}return _0x120d58[_0x9a9c('0x1a')](_0x764927)[_0x9a9c('0x1b')]();};}function respondWithResult(_0x74f72a,_0x5ed809){_0x5ed809=_0x5ed809||0xc8;return function(_0x5beae4){if(_0x5beae4){return _0x74f72a[_0x9a9c('0x1a')](_0x5ed809)[_0x9a9c('0x1c')](_0x5beae4);}};}function respondWithFilteredResult(_0x278733,_0x2ca493){return function(_0xdd82d1){if(_0xdd82d1){var _0x2db2d3=typeof _0x2ca493['offset']===_0x9a9c('0x1d')&&typeof _0x2ca493[_0x9a9c('0x1e')]==='undefined';var _0x286218=_0xdd82d1[_0x9a9c('0x1f')];var _0x4bb044=_0x2db2d3?0x0:_0x2ca493[_0x9a9c('0x20')];var _0x5e299d=_0x2db2d3?_0xdd82d1[_0x9a9c('0x1f')]:_0x2ca493[_0x9a9c('0x20')]+_0x2ca493['limit'];var _0xfb148c;if(_0x5e299d>=_0x286218){_0x5e299d=_0x286218;_0xfb148c=0xc8;}else{_0xfb148c=0xce;}_0x278733[_0x9a9c('0x1a')](_0xfb148c);return _0x278733[_0x9a9c('0x21')]('Content-Range',_0x4bb044+'-'+_0x5e299d+'/'+_0x286218)[_0x9a9c('0x1c')](_0xdd82d1);}return null;};}function patchUpdates(_0x258fe0){return function(_0xfe70f4){try{jsonpatch['apply'](_0xfe70f4,_0x258fe0,!![]);}catch(_0x4fd300){return BPromise[_0x9a9c('0x22')](_0x4fd300);}return _0xfe70f4[_0x9a9c('0x23')]();};}function saveUpdates(_0x1de4e1,_0x7fcb5f){return function(_0x570e89){if(_0x570e89){return _0x570e89[_0x9a9c('0x24')](_0x1de4e1)[_0x9a9c('0x25')](function(_0x331c82){return _0x331c82;});}return null;};}function removeEntity(_0x2b9657,_0x278d0f){return function(_0x4cf7e2){if(_0x4cf7e2){return _0x4cf7e2[_0x9a9c('0x26')]()['then'](function(){var _0x4941dc=_0x4cf7e2[_0x9a9c('0x27')]({'plain':!![]});var _0x709e31=_0x9a9c('0x28');return db[_0x9a9c('0x29')][_0x9a9c('0x26')]({'where':{'type':_0x709e31,'resourceId':_0x4941dc['id']}})[_0x9a9c('0x25')](function(){return _0x4cf7e2;});})[_0x9a9c('0x25')](function(){_0x2b9657['status'](0xcc)[_0x9a9c('0x1b')]();});}};}function handleEntityNotFound(_0x3347a8,_0x462a2a){return function(_0x4dfa5b){if(!_0x4dfa5b){_0x3347a8[_0x9a9c('0x19')](0x194);}return _0x4dfa5b;};}function handleError(_0x3a1386,_0x28a48d){_0x28a48d=_0x28a48d||0x1f4;return function(_0x1273c7){logger[_0x9a9c('0x2a')](_0x1273c7[_0x9a9c('0x2b')]);if(_0x1273c7[_0x9a9c('0x2c')]){delete _0x1273c7[_0x9a9c('0x2c')];}_0x3a1386[_0x9a9c('0x1a')](_0x28a48d)[_0x9a9c('0x2d')](_0x1273c7);};}exports[_0x9a9c('0x2e')]=function(_0x10efdb,_0xae671b){var _0x7d7ac5={},_0x326cfc={},_0x18c86d={'count':0x0,'rows':[]};var _0x21c4f4=_[_0x9a9c('0x2f')](db[_0x9a9c('0x30')]['rawAttributes'],function(_0x55d00c){return{'name':_0x55d00c[_0x9a9c('0x31')],'type':_0x55d00c[_0x9a9c('0x32')][_0x9a9c('0x33')]};});_0x326cfc[_0x9a9c('0x34')]=_[_0x9a9c('0x2f')](_0x21c4f4,'name');_0x326cfc[_0x9a9c('0x35')]=_['keys'](_0x10efdb['query']);_0x326cfc[_0x9a9c('0x36')]=_['intersection'](_0x326cfc['model'],_0x326cfc['query']);_0x7d7ac5[_0x9a9c('0x37')]=_[_0x9a9c('0x38')](_0x326cfc[_0x9a9c('0x34')],qs[_0x9a9c('0x39')](_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x39')]));_0x7d7ac5[_0x9a9c('0x37')]=_0x7d7ac5[_0x9a9c('0x37')][_0x9a9c('0x3a')]?_0x7d7ac5[_0x9a9c('0x37')]:_0x326cfc[_0x9a9c('0x34')];if(!_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x3b')](_0x9a9c('0x3c'))){_0x7d7ac5[_0x9a9c('0x1e')]=qs['limit'](_0x10efdb[_0x9a9c('0x35')]['limit']);_0x7d7ac5[_0x9a9c('0x20')]=qs[_0x9a9c('0x20')](_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x20')]);}_0x7d7ac5[_0x9a9c('0x3d')]=qs[_0x9a9c('0x3e')](_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x3e')]);_0x7d7ac5[_0x9a9c('0x3f')]=qs[_0x9a9c('0x36')](_[_0x9a9c('0x40')](_0x10efdb[_0x9a9c('0x35')],_0x326cfc[_0x9a9c('0x36')]),_0x21c4f4);if(_0x10efdb[_0x9a9c('0x35')]['filter']){_0x7d7ac5[_0x9a9c('0x3f')]=_[_0x9a9c('0x41')](_0x7d7ac5['where'],{'$or':_[_0x9a9c('0x2f')](_0x21c4f4,function(_0x1dbfaa){if(_0x1dbfaa[_0x9a9c('0x32')]!==_0x9a9c('0x42')){var _0x1ffd36={};_0x1ffd36[_0x1dbfaa[_0x9a9c('0x2c')]]={'$like':'%'+_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x43')]+'%'};return _0x1ffd36;}})});}_0x7d7ac5=_[_0x9a9c('0x41')]({},_0x7d7ac5,_0x10efdb[_0x9a9c('0x44')]);var _0xf99a21={'where':_0x7d7ac5[_0x9a9c('0x3f')]};return db[_0x9a9c('0x30')]['count'](_0xf99a21)[_0x9a9c('0x25')](function(_0x10f10b){_0x18c86d[_0x9a9c('0x1f')]=_0x10f10b;if(_0x10efdb[_0x9a9c('0x35')][_0x9a9c('0x45')]){_0x7d7ac5[_0x9a9c('0x46')]=[{'all':!![]}];}return db['Pause'][_0x9a9c('0x47')](_0x7d7ac5);})['then'](function(_0xf7d18b){_0x18c86d[_0x9a9c('0x48')]=_0xf7d18b;return _0x18c86d;})[_0x9a9c('0x25')](respondWithFilteredResult(_0xae671b,_0x7d7ac5))[_0x9a9c('0x49')](handleError(_0xae671b,null));};exports['show']=function(_0x323823,_0x5e5b46){var _0x52354f={'raw':!![],'where':{'id':_0x323823[_0x9a9c('0x4a')]['id']}},_0x47fc18={};_0x47fc18[_0x9a9c('0x34')]=_['keys'](db[_0x9a9c('0x30')][_0x9a9c('0x4b')]);_0x47fc18[_0x9a9c('0x35')]=_['keys'](_0x323823['query']);_0x47fc18[_0x9a9c('0x36')]=_[_0x9a9c('0x38')](_0x47fc18[_0x9a9c('0x34')],_0x47fc18['query']);_0x52354f[_0x9a9c('0x37')]=_[_0x9a9c('0x38')](_0x47fc18[_0x9a9c('0x34')],qs[_0x9a9c('0x39')](_0x323823[_0x9a9c('0x35')][_0x9a9c('0x39')]));_0x52354f['attributes']=_0x52354f[_0x9a9c('0x37')][_0x9a9c('0x3a')]?_0x52354f[_0x9a9c('0x37')]:_0x47fc18['model'];if(_0x323823[_0x9a9c('0x35')][_0x9a9c('0x45')]){_0x52354f[_0x9a9c('0x46')]=[{'all':!![]}];}_0x52354f=_[_0x9a9c('0x41')]({},_0x52354f,_0x323823[_0x9a9c('0x44')]);return db['Pause'][_0x9a9c('0x4c')](_0x52354f)[_0x9a9c('0x25')](handleEntityNotFound(_0x5e5b46,null))[_0x9a9c('0x25')](respondWithResult(_0x5e5b46,null))[_0x9a9c('0x49')](handleError(_0x5e5b46,null));};exports['create']=function(_0x45c6f2,_0x2a95c3){return db[_0x9a9c('0x30')][_0x9a9c('0x4d')](_0x45c6f2['body'],{})[_0x9a9c('0x25')](function(_0x516c75){var _0x1291de=_0x45c6f2[_0x9a9c('0x4e')]['get']({'plain':!![]});if(!_0x1291de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1291de[_0x9a9c('0x4f')]===_0x9a9c('0x4e')){var _0x40712b=_0x516c75[_0x9a9c('0x27')]({'plain':!![]});var _0x178d9d=_0x9a9c('0x28');return db[_0x9a9c('0x50')][_0x9a9c('0x4c')]({'where':{'name':_0x178d9d,'userProfileId':_0x1291de[_0x9a9c('0x51')]},'raw':!![]})[_0x9a9c('0x25')](function(_0x24c246){if(_0x24c246&&_0x24c246[_0x9a9c('0x52')]===0x0){return db[_0x9a9c('0x29')][_0x9a9c('0x4d')]({'name':_0x40712b['name'],'resourceId':_0x40712b['id'],'type':_0x24c246[_0x9a9c('0x2c')],'sectionId':_0x24c246['id']},{})[_0x9a9c('0x25')](function(){return _0x516c75;});}else{return _0x516c75;}})[_0x9a9c('0x49')](function(_0x2163d3){logger[_0x9a9c('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2163d3);throw _0x2163d3;});}return _0x516c75;})[_0x9a9c('0x25')](respondWithResult(_0x2a95c3,0xc9))[_0x9a9c('0x49')](handleError(_0x2a95c3,null));};exports[_0x9a9c('0x24')]=function(_0x654e1e,_0x48c7ca){if(_0x654e1e[_0x9a9c('0x53')]['id']){delete _0x654e1e[_0x9a9c('0x53')]['id'];}return db[_0x9a9c('0x30')][_0x9a9c('0x4c')]({'where':{'id':_0x654e1e[_0x9a9c('0x4a')]['id']}})[_0x9a9c('0x25')](handleEntityNotFound(_0x48c7ca,null))['then'](saveUpdates(_0x654e1e['body'],null))['then'](respondWithResult(_0x48c7ca,null))['catch'](handleError(_0x48c7ca,null));};exports['destroy']=function(_0x14bbb4,_0x2f9cbb){return db['Pause'][_0x9a9c('0x4c')]({'where':{'id':_0x14bbb4[_0x9a9c('0x4a')]['id']}})[_0x9a9c('0x25')](handleEntityNotFound(_0x2f9cbb,null))[_0x9a9c('0x25')](removeEntity(_0x2f9cbb,null))['catch'](handleError(_0x2f9cbb,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index acf1d7a..85ff016 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x23aa97,_0xe78aac){var _0xe50c39=function(_0x12208c){while(--_0x12208c){_0x23aa97['push'](_0x23aa97['shift']());}};_0xe50c39(++_0xe78aac);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2d6197,_0x82ebfb){_0x2d6197=_0x2d6197-0x0;var _0x4d0e75=_0x5fc3[_0x2d6197];return _0x4d0e75;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x422344,_0x276567){var _0x20efc8=function(_0x275ce9){while(--_0x275ce9){_0x422344['push'](_0x422344['shift']());}};_0x20efc8(++_0x276567);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2f8b8d,_0x31fc8e){_0x2f8b8d=_0x2f8b8d-0x0;var _0x3a737e=_0x8ef6[_0x2f8b8d];return _0x3a737e;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'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 2e595a5..d0fc965 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(_0xedec4b,_0x560710){var _0x41a5bf=function(_0x20938b){while(--_0x20938b){_0xedec4b['push'](_0xedec4b['shift']());}};_0x41a5bf(++_0x560710);}(_0xb10b,0x12a));var _0xbb10=function(_0x3903ef,_0x30063f){_0x3903ef=_0x3903ef-0x0;var _0x5a340b=_0xb10b[_0x3903ef];return _0x5a340b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x2f71ec,_0x183e85){var _0x53f611=function(_0x90161){while(--_0x90161){_0x2f71ec['push'](_0x2f71ec['shift']());}};_0x53f611(++_0x183e85);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fe90c,_0x231b20){_0x3fe90c=_0x3fe90c-0x0;var _0x12c302=_0xb10b[_0x3fe90c];return _0x12c302;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index e812870..f1a381d 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 _0x0faf=['extname','now','post','single','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','basename'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0x0faf,0x132));var _0xf0fa=function(_0x275caa,_0x166d5e){_0x275caa=_0x275caa-0x0;var _0x28d670=_0x0faf[_0x275caa];return _0x28d670;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),controller[_0xf0fa('0xe')]);router['get'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['show']);router['get'](_0xf0fa('0x10'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x11')]);var upload=multer({'storage':multer[_0xf0fa('0x12')]({'destination':function(_0x2bd807,_0x1151ea,_0x379ff6){_0x379ff6(null,path[_0xf0fa('0x13')](config['root'],_0xf0fa('0x14')));},'filename':function(_0x5b38fa,_0x2f46ff,_0x521034){_0x2f46ff[_0xf0fa('0x15')]=_0x2f46ff[_0xf0fa('0x15')][_0xf0fa('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x521034(null,util['format']('%s-%s%s',path[_0xf0fa('0x17')](_0x2f46ff['originalname'],path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])),Date[_0xf0fa('0x19')](),path[_0xf0fa('0x18')](_0x2f46ff[_0xf0fa('0x15')])));}})});router[_0xf0fa('0x1a')]('/',upload[_0xf0fa('0x1b')](_0xf0fa('0x1c')),controller['upload']);router[_0xf0fa('0x1a')](_0xf0fa('0xd'),controller[_0xf0fa('0x1d')]);router[_0xf0fa('0x1e')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller['update']);router['delete'](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x1f')]);module[_0xf0fa('0x20')]=router; \ No newline at end of file +var _0xadb8=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/webhook','webhookGet','/:id','/:id/download','join','root','server/files/plugins','originalname','%s-%s%s','extname','post','single','file','upload','webhookPost','update','delete','exports'];(function(_0x3517f7,_0x1ad501){var _0x44fde8=function(_0x4cf4d8){while(--_0x4cf4d8){_0x3517f7['push'](_0x3517f7['shift']());}};_0x44fde8(++_0x1ad501);}(_0xadb8,0x1d0));var _0x8adb=function(_0x54fc1f,_0x1703c2){_0x54fc1f=_0x54fc1f-0x0;var _0x53f699=_0xadb8[_0x54fc1f];return _0x53f699;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8adb('0x0'));var timeout=require('connect-timeout');var express=require(_0x8adb('0x1'));var router=express[_0x8adb('0x2')]();var fs_extra=require(_0x8adb('0x3'));var auth=require(_0x8adb('0x4'));var interaction=require(_0x8adb('0x5'));var config=require(_0x8adb('0x6'));var controller=require(_0x8adb('0x7'));router['get']('/',auth[_0x8adb('0x8')](),controller[_0x8adb('0x9')]);router[_0x8adb('0xa')](_0x8adb('0xb'),controller[_0x8adb('0xc')]);router[_0x8adb('0xa')](_0x8adb('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8adb('0xe'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa095e1,_0x628c45,_0x46c6fb){_0x46c6fb(null,path[_0x8adb('0xf')](config[_0x8adb('0x10')],_0x8adb('0x11')));},'filename':function(_0x2a6574,_0x2828f1,_0x2d6b55){_0x2828f1[_0x8adb('0x12')]=_0x2828f1['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d6b55(null,util['format'](_0x8adb('0x13'),path['basename'](_0x2828f1[_0x8adb('0x12')],path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])),Date['now'](),path[_0x8adb('0x14')](_0x2828f1[_0x8adb('0x12')])));}})});router[_0x8adb('0x15')]('/',upload[_0x8adb('0x16')](_0x8adb('0x17')),controller[_0x8adb('0x18')]);router['post'](_0x8adb('0xb'),controller[_0x8adb('0x19')]);router['put']('/:id',auth[_0x8adb('0x8')](),controller[_0x8adb('0x1a')]);router[_0x8adb('0x1b')](_0x8adb('0xd'),auth[_0x8adb('0x8')](),controller[_0x8adb('0x1b')]);module[_0x8adb('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index c67b889..5c2166b 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 _0xcd96=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','STRING','sequelize','exports','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x2e0e7b,_0x55d8b2){var _0xbad498=function(_0xf21e2a){while(--_0xf21e2a){_0x2e0e7b['push'](_0x2e0e7b['shift']());}};_0xbad498(++_0x55d8b2);}(_0xcd96,0x178));var _0x6cd9=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xcd96[_0x479160];return _0x47ac6d;};'use strict';var Sequelize=require(_0x6cd9('0x0'));module[_0x6cd9('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6cd9('0x2')](_0x6cd9('0x3'),_0x6cd9('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x6cd9('0x5')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x6cd9('0x6')},'sidebar':{'type':Sequelize['ENUM'](_0x6cd9('0x7'),_0x6cd9('0x8'),_0x6cd9('0x9'),'never'),'defaultValue':'always','comment':_0x6cd9('0xa')},'icon':{'type':Sequelize[_0x6cd9('0xb')]},'adminUrl':{'type':Sequelize[_0x6cd9('0xb')]},'agentUrl':{'type':Sequelize[_0x6cd9('0xb')]},'scriptName':{'type':Sequelize[_0x6cd9('0xb')]},'scriptPath':{'type':Sequelize[_0x6cd9('0xb')]}}; \ No newline at end of file +var _0x0ac7=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0x0ac7,0xfb));var _0x70ac=function(_0x18d2a9,_0x311ddf){_0x18d2a9=_0x18d2a9-0x0;var _0x556d26=_0x0ac7[_0x18d2a9];return _0x556d26;};'use strict';var Sequelize=require(_0x70ac('0x0'));module[_0x70ac('0x1')]={'name':{'type':Sequelize[_0x70ac('0x2')]},'type':{'type':Sequelize[_0x70ac('0x3')](_0x70ac('0x4'),_0x70ac('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x70ac('0x6')]},'path':{'type':Sequelize[_0x70ac('0x2')],'comment':_0x70ac('0x7')},'active':{'type':Sequelize[_0x70ac('0x8')],'defaultValue':0x0,'comment':_0x70ac('0x9')},'sidebar':{'type':Sequelize['ENUM'](_0x70ac('0xa'),_0x70ac('0xb'),_0x70ac('0xc'),_0x70ac('0xd')),'defaultValue':_0x70ac('0xc'),'comment':_0x70ac('0xe')},'icon':{'type':Sequelize[_0x70ac('0x2')]},'adminUrl':{'type':Sequelize[_0x70ac('0x2')]},'agentUrl':{'type':Sequelize[_0x70ac('0x2')]},'scriptName':{'type':Sequelize[_0x70ac('0x2')]},'scriptPath':{'type':Sequelize[_0x70ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dcd97d4..f7a5876 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 _0x7cff=['icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','endsWith','statusCode','content-type','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','Plugin','include','findAll','params','includeAll','options','find','catch','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','readdirSync','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon'];(function(_0x50cbab,_0x1c8b8a){var _0x19e6d3=function(_0x26e14c){while(--_0x26e14c){_0x50cbab['push'](_0x50cbab['shift']());}};_0x19e6d3(++_0x1c8b8a);}(_0x7cff,0x179));var _0xf7cf=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x7cff[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xf7cf('0x0'));var rimraf=require(_0xf7cf('0x1'));var zipdir=require(_0xf7cf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7cf('0x3'));var moment=require(_0xf7cf('0x4'));var BPromise=require(_0xf7cf('0x5'));var Mustache=require(_0xf7cf('0x6'));var util=require(_0xf7cf('0x7'));var path=require(_0xf7cf('0x8'));var sox=require(_0xf7cf('0x9'));var csv=require(_0xf7cf('0xa'));var ejs=require(_0xf7cf('0xb'));var fs=require('fs');var fs_extra=require(_0xf7cf('0xc'));var _=require('lodash');var squel=require(_0xf7cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xf7cf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf7cf('0xa'));var querystring=require(_0xf7cf('0xf'));var Papa=require('papaparse');var extract=require(_0xf7cf('0x10'));var rimraf=require(_0xf7cf('0x1'));var archiver=require(_0xf7cf('0x11'));var Redis=require(_0xf7cf('0x12'));var authService=require(_0xf7cf('0x13'));var qs=require(_0xf7cf('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7cf('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf7cf('0x16'));var config=require(_0xf7cf('0x17'));var licenseUtil=require(_0xf7cf('0x18'));var db=require(_0xf7cf('0x19'))['db'];config['redis']=_[_0xf7cf('0x1a')](config[_0xf7cf('0x1b')],{'host':_0xf7cf('0x1c'),'port':0x18eb});var socket=require(_0xf7cf('0x1d'))(new Redis(config[_0xf7cf('0x1b')]));require('./plugin.socket')[_0xf7cf('0x1e')](socket);function respondWithStatusCode(_0xf3b66d,_0xa943b6){_0xa943b6=_0xa943b6||0xcc;return function(_0x36eb14){if(_0x36eb14){return _0xf3b66d[_0xf7cf('0x1f')](_0xa943b6);}return _0xf3b66d[_0xf7cf('0x20')](_0xa943b6)[_0xf7cf('0x21')]();};}function respondWithResult(_0x19553c,_0x2e44cf){_0x2e44cf=_0x2e44cf||0xc8;return function(_0x229935){if(_0x229935){return _0x19553c[_0xf7cf('0x20')](_0x2e44cf)[_0xf7cf('0x22')](_0x229935);}};}function respondWithFilteredResult(_0x4d360c,_0x3ea4a2){return function(_0x3e6472){if(_0x3e6472){var _0x107c17=typeof _0x3ea4a2['offset']===_0xf7cf('0x23')&&typeof _0x3ea4a2[_0xf7cf('0x24')]==='undefined';var _0x56dfe2=_0x3e6472['count'];var _0x41c01f=_0x107c17?0x0:_0x3ea4a2['offset'];var _0x40465d=_0x107c17?_0x3e6472[_0xf7cf('0x25')]:_0x3ea4a2['offset']+_0x3ea4a2[_0xf7cf('0x24')];var _0x25f02a;if(_0x40465d>=_0x56dfe2){_0x40465d=_0x56dfe2;_0x25f02a=0xc8;}else{_0x25f02a=0xce;}_0x4d360c[_0xf7cf('0x20')](_0x25f02a);return _0x4d360c[_0xf7cf('0x26')]('Content-Range',_0x41c01f+'-'+_0x40465d+'/'+_0x56dfe2)[_0xf7cf('0x22')](_0x3e6472);}return null;};}function patchUpdates(_0x5cd9b9){return function(_0x190aa3){try{jsonpatch[_0xf7cf('0x27')](_0x190aa3,_0x5cd9b9,!![]);}catch(_0x8599ae){return BPromise[_0xf7cf('0x28')](_0x8599ae);}return _0x190aa3[_0xf7cf('0x29')]();};}function saveUpdates(_0x182972,_0x196ffb){return function(_0x1414c3){if(_0x1414c3){return _0x1414c3[_0xf7cf('0x2a')](_0x182972)[_0xf7cf('0x2b')](function(_0x33ac4a){return _0x33ac4a;});}return null;};}function removeEntity(_0x5637d1,_0x4b5f22){return function(_0x4d6be7){if(_0x4d6be7){return _0x4d6be7[_0xf7cf('0x2c')]()[_0xf7cf('0x2b')](function(){var _0x275019=_0x4d6be7[_0xf7cf('0x2d')]({'plain':!![]});var _0x3d29ac=_0xf7cf('0x2e');return db[_0xf7cf('0x2f')][_0xf7cf('0x2c')]({'where':{'type':_0x3d29ac,'resourceId':_0x275019['id']}})['then'](function(){return _0x4d6be7;});})[_0xf7cf('0x2b')](function(){_0x5637d1[_0xf7cf('0x20')](0xcc)[_0xf7cf('0x21')]();});}};}function handleEntityNotFound(_0x2fbf91,_0xc14d3d){return function(_0x57ba29){if(!_0x57ba29){_0x2fbf91[_0xf7cf('0x1f')](0x194);}return _0x57ba29;};}function handleError(_0x409b86,_0x5a5db5){_0x5a5db5=_0x5a5db5||0x1f4;return function(_0x587e90){logger[_0xf7cf('0x30')](_0x587e90[_0xf7cf('0x31')]);if(_0x587e90[_0xf7cf('0x32')]){delete _0x587e90[_0xf7cf('0x32')];}_0x409b86['status'](_0x5a5db5)[_0xf7cf('0x33')](_0x587e90);};}exports[_0xf7cf('0x34')]=function(_0x5dbb75,_0x24f9ad){var _0x2c457e={},_0x56966b={},_0x5c7c26={'count':0x0,'rows':[]};var _0x39260b=_[_0xf7cf('0x35')](db['Plugin'][_0xf7cf('0x36')],function(_0x394ee1){return{'name':_0x394ee1[_0xf7cf('0x37')],'type':_0x394ee1[_0xf7cf('0x38')][_0xf7cf('0x39')]};});_0x56966b[_0xf7cf('0x3a')]=_['map'](_0x39260b,_0xf7cf('0x32'));_0x56966b[_0xf7cf('0x3b')]=_[_0xf7cf('0x3c')](_0x5dbb75[_0xf7cf('0x3b')]);_0x56966b['filters']=_[_0xf7cf('0x3d')](_0x56966b[_0xf7cf('0x3a')],_0x56966b['query']);_0x2c457e[_0xf7cf('0x3e')]=_[_0xf7cf('0x3d')](_0x56966b[_0xf7cf('0x3a')],qs[_0xf7cf('0x3f')](_0x5dbb75[_0xf7cf('0x3b')]['fields']));_0x2c457e[_0xf7cf('0x3e')]=_0x2c457e[_0xf7cf('0x3e')][_0xf7cf('0x40')]?_0x2c457e[_0xf7cf('0x3e')]:_0x56966b['model'];if(!_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x41')](_0xf7cf('0x42'))){_0x2c457e[_0xf7cf('0x24')]=qs['limit'](_0x5dbb75[_0xf7cf('0x3b')]['limit']);_0x2c457e['offset']=qs[_0xf7cf('0x43')](_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x43')]);}_0x2c457e[_0xf7cf('0x44')]=qs[_0xf7cf('0x45')](_0x5dbb75['query'][_0xf7cf('0x45')]);_0x2c457e[_0xf7cf('0x46')]=qs[_0xf7cf('0x47')](_[_0xf7cf('0x48')](_0x5dbb75['query'],_0x56966b[_0xf7cf('0x47')]),_0x39260b);if(_0x5dbb75[_0xf7cf('0x3b')][_0xf7cf('0x49')]){_0x2c457e[_0xf7cf('0x46')]=_[_0xf7cf('0x4a')](_0x2c457e['where'],{'$or':_[_0xf7cf('0x35')](_0x39260b,function(_0x228f3c){if(_0x228f3c[_0xf7cf('0x38')]!==_0xf7cf('0x4b')){var _0x279874={};_0x279874[_0x228f3c['name']]={'$like':'%'+_0x5dbb75[_0xf7cf('0x3b')]['filter']+'%'};return _0x279874;}})});}_0x2c457e=_[_0xf7cf('0x4a')]({},_0x2c457e,_0x5dbb75['options']);var _0x336460={'where':_0x2c457e['where']};return db[_0xf7cf('0x4c')][_0xf7cf('0x25')](_0x336460)[_0xf7cf('0x2b')](function(_0x4a5785){_0x5c7c26['count']=_0x4a5785;if(_0x5dbb75[_0xf7cf('0x3b')]['includeAll']){_0x2c457e[_0xf7cf('0x4d')]=[{'all':!![]}];}return db[_0xf7cf('0x4c')][_0xf7cf('0x4e')](_0x2c457e);})['then'](function(_0x5e728c){_0x5c7c26['rows']=_0x5e728c;return _0x5c7c26;})[_0xf7cf('0x2b')](respondWithFilteredResult(_0x24f9ad,_0x2c457e))['catch'](handleError(_0x24f9ad,null));};exports['show']=function(_0x18396e,_0x511e5b){var _0x1428cd={'raw':!![],'where':{'id':_0x18396e[_0xf7cf('0x4f')]['id']}},_0x5db75e={};_0x5db75e['model']=_[_0xf7cf('0x3c')](db['Plugin'][_0xf7cf('0x36')]);_0x5db75e[_0xf7cf('0x3b')]=_[_0xf7cf('0x3c')](_0x18396e[_0xf7cf('0x3b')]);_0x5db75e[_0xf7cf('0x47')]=_[_0xf7cf('0x3d')](_0x5db75e[_0xf7cf('0x3a')],_0x5db75e[_0xf7cf('0x3b')]);_0x1428cd['attributes']=_['intersection'](_0x5db75e[_0xf7cf('0x3a')],qs[_0xf7cf('0x3f')](_0x18396e['query'][_0xf7cf('0x3f')]));_0x1428cd[_0xf7cf('0x3e')]=_0x1428cd[_0xf7cf('0x3e')]['length']?_0x1428cd[_0xf7cf('0x3e')]:_0x5db75e[_0xf7cf('0x3a')];if(_0x18396e[_0xf7cf('0x3b')][_0xf7cf('0x50')]){_0x1428cd['include']=[{'all':!![]}];}_0x1428cd=_['merge']({},_0x1428cd,_0x18396e[_0xf7cf('0x51')]);return db[_0xf7cf('0x4c')][_0xf7cf('0x52')](_0x1428cd)['then'](handleEntityNotFound(_0x511e5b,null))[_0xf7cf('0x2b')](respondWithResult(_0x511e5b,null))[_0xf7cf('0x53')](handleError(_0x511e5b,null));};exports[_0xf7cf('0x54')]=function(_0xd92dd9,_0x265ffe,_0x19a653){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0xd92dd9[_0xf7cf('0x4f')]['id']},'attributes':[_0xf7cf('0x32'),'path'],'raw':!![]})[_0xf7cf('0x2b')](handleEntityNotFound(_0x265ffe,null))[_0xf7cf('0x2b')](function(_0x4efc69){if(_0x4efc69){var _0x454e68=path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),util['format'](_0xf7cf('0x58'),path[_0xf7cf('0x59')](_0x4efc69['path'])));var _0x5845f7=fs[_0xf7cf('0x5a')](_0x454e68);var _0x2c999f=archiver('zip',{'zlib':{'level':0x9}});_0x2c999f['on'](_0xf7cf('0x5b'),function(_0x598aaf){if(_0x598aaf[_0xf7cf('0x5c')]===_0xf7cf('0x5d')){logger[_0xf7cf('0x30')](_0x598aaf);}else{throw new db[(_0xf7cf('0x5e'))][(_0xf7cf('0x5f'))](_0xf7cf('0x60'));}});_0x2c999f['on'](_0xf7cf('0x30'),function(_0x220e3d){throw new db[(_0xf7cf('0x5e'))][(_0xf7cf('0x5f'))](_0xf7cf('0x60'));});_0x2c999f[_0xf7cf('0x61')](_0x5845f7);_0x2c999f[_0xf7cf('0x62')](_0xf7cf('0x63'),{'cwd':path[_0xf7cf('0x55')](config['root'],_0xf7cf('0x57'),path['dirname'](_0x4efc69['path'])),'ignore':[path[_0xf7cf('0x55')](path['basename'](_0x4efc69[_0xf7cf('0x8')]),_0xf7cf('0x64')),path[_0xf7cf('0x55')](path['basename'](_0x4efc69['path']),_0xf7cf('0x65'))],'nodir':!![]})[_0xf7cf('0x66')]();_0x5845f7['on']('close',function(){if(!fs[_0xf7cf('0x67')](_0x454e68)){throw new db[(_0xf7cf('0x5e'))]['Error'](_0xf7cf('0x68'));}return _0x265ffe['download'](_0x454e68,util[_0xf7cf('0x69')](_0xf7cf('0x58'),path['basename'](_0x4efc69[_0xf7cf('0x8')])),function(_0x7b2278){if(_0x7b2278){throw new db['Sequelize'][(_0xf7cf('0x5f'))](_0xf7cf('0x6a'));}fs[_0xf7cf('0x6b')](_0x454e68);logger['info']('Download\x20completed');logger[_0xf7cf('0x6c')](_0xf7cf('0x6d'));});});}return null;})[_0xf7cf('0x53')](handleError(_0x265ffe,null));};exports[_0xf7cf('0x6e')]=function(_0x8f98c7,_0x39b86d,_0x504682){var _0x5cd237=path['basename'](_0x8f98c7['file']['filename'],path[_0xf7cf('0x6f')](_0x8f98c7[_0xf7cf('0x70')][_0xf7cf('0x71')]));var _0x497cb3=path['join'](config[_0xf7cf('0x56')],_0xf7cf('0x57'),_0x8f98c7[_0xf7cf('0x70')][_0xf7cf('0x71')]);var _0x1763b0=path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),_0x5cd237);logger[_0xf7cf('0x6c')](_0xf7cf('0x72'),_0x497cb3);logger[_0xf7cf('0x6c')](_0xf7cf('0x73'),_0x1763b0);try{fs[_0xf7cf('0x74')](_0x497cb3,parseInt(_0xf7cf('0x75'),0x8));extract(_0x497cb3,{'dir':_0x1763b0},function(_0x2ee484){if(_0x2ee484){logger['error'](_0x2ee484);handleError(_0x2ee484,!![]);};var _0x539895=fs['readdirSync'](_0x1763b0);if(_0x539895['length']>0x1){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error('Invalid\x20plugin\x20structure'));}var _0x12bcfd=fs[_0xf7cf('0x77')](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0]));if(_0x12bcfd[_0xf7cf('0x78')]()){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error(_0xf7cf('0x76')));}if(_0x12bcfd['isDirectory']()){var _0x2185c3=fs[_0xf7cf('0x79')](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0]));if(_0x2185c3['length']===0x0){removeReferences(_0x497cb3,_0x1763b0);logger[_0xf7cf('0x30')](_0xf7cf('0x76'));return _0x504682(new Error(_0xf7cf('0x76')));}var _0x2dc404=_0x2185c3['some'](function(_0x2b4695){return _0x2b4695===_0xf7cf('0x7a');});if(!_0x2dc404){return _0x504682(new Error(_0xf7cf('0x7b')));}var _0x4a526d=fs['readFileSync'](path[_0xf7cf('0x55')](_0x1763b0,_0x539895[0x0],_0xf7cf('0x7a')));var _0x4900db=JSON[_0xf7cf('0x7c')](_0x4a526d);if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x32')]){return _0x504682(new Error(_0xf7cf('0x7d')));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x38')]){return _0x504682(new Error(_0xf7cf('0x7e')));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x7f')]){return _0x504682(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')]){return _0x504682(new Error(_0xf7cf('0x81')));}if(_0x4900db[_0xf7cf('0x38')]===_0xf7cf('0x82')){if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')]){return _0x504682(new Error(_0xf7cf('0x84')));}if('undefined'==typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')]&&_0xf7cf('0x23')==typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x86')]){return _0x504682(new Error(_0xf7cf('0x87')));}}else if(_0x4900db[_0xf7cf('0x38')]===_0xf7cf('0x88')){if(_0xf7cf('0x23')==typeof _0x4900db[_0xf7cf('0x80')][_0xf7cf('0x89')]){return _0x504682(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xf7cf('0x23')==typeof _0x4900db['parameters'][_0xf7cf('0x8a')]){return _0x504682(new Error(_0xf7cf('0x8b')));}}else{return _0x504682(new Error(_0xf7cf('0x8c')));}var _0x171f63=_0x4900db[_0xf7cf('0x32')];var _0xb54e90=_0x4900db[_0xf7cf('0x8d')];var _0x1d9c76=_0x4900db['type'];var _0x419092=_0x4900db[_0xf7cf('0x8e')]?_0x4900db['sidebar']:_0xf7cf('0x8f');var _0x2105a9=_0x4900db[_0xf7cf('0x90')]?_0x4900db[_0xf7cf('0x90')]:_0xf7cf('0x91');var _0x29a2e9='';var _0x2ed671='';var _0x4207cc='';var _0x49bd83='';var _0x51121d=_0x4900db[_0xf7cf('0x7f')];if(_0x1d9c76==='html'){if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')]){var _0x3f9926=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xf7cf('0x92')](_0x3f9926)){_0x29a2e9=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x3f9926);}else{_0x29a2e9=_0x3f9926;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')]['agent']){var _0x1d820e=_0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x86')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1d820e)){_0x2ed671=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x1d820e);}else{_0x2ed671=_0x1d820e;}}else{logger['info'](_0xf7cf('0x94'));}}else if(_0x1d9c76===_0xf7cf('0x88')){_0x4207cc=_0x4900db[_0xf7cf('0x80')]['scriptName'];_0x49bd83=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x8a')];if(_0xf7cf('0x23')!=typeof _0x4900db['parameters'][_0xf7cf('0x83')]){if(_0xf7cf('0x23')!=typeof _0x4900db['parameters']['views'][_0xf7cf('0x85')]){var _0x3f9926=_0x4900db['parameters'][_0xf7cf('0x83')][_0xf7cf('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3f9926)){_0x29a2e9=path[_0xf7cf('0x55')](_0xf7cf('0x93'),_0x5cd237,_0x539895[0x0],_0x3f9926);}else{_0x29a2e9=_0x3f9926;}}if(_0xf7cf('0x23')!=typeof _0x4900db[_0xf7cf('0x80')]['views'][_0xf7cf('0x86')]){var _0x1d820e=_0x4900db[_0xf7cf('0x80')][_0xf7cf('0x83')][_0xf7cf('0x86')];if(!/^(f|ht)tps?:\/\//i[_0xf7cf('0x92')](_0x1d820e)){_0x2ed671=path[_0xf7cf('0x55')]('plugins',_0x5cd237,_0x539895[0x0],_0x1d820e);}else{_0x2ed671=_0x1d820e;}}}}var _0x12c09e={'name':_0x171f63,'description':_0xb54e90,'path':path[_0xf7cf('0x55')](_0x5cd237,_0x539895[0x0]),'type':_0x1d9c76,'sidebar':_0x419092,'icon':_0x2105a9,'adminUrl':_0x29a2e9,'agentUrl':_0x2ed671,'scriptName':_0x4207cc,'scriptPath':_0x49bd83,'version':_0x51121d};removeReferences(_0x497cb3,null);return db[_0xf7cf('0x4c')][_0xf7cf('0x95')](_0x12c09e)['then'](function(_0x58fd73){var _0xe026dc={'role':_0x8f98c7[_0xf7cf('0x96')][_0xf7cf('0x97')],'userProfileId':_0x8f98c7['body'][_0xf7cf('0x98')]};if(!_0xe026dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe026dc[_0xf7cf('0x97')]===_0xf7cf('0x99')){var _0x488c67=_0x58fd73['get']({'plain':!![]});return db['UserProfileSection'][_0xf7cf('0x52')]({'where':{'name':_0xf7cf('0x2e'),'userProfileId':_0xe026dc[_0xf7cf('0x98')]},'raw':!![]})[_0xf7cf('0x2b')](function(_0x3ee42c){if(_0x3ee42c&&_0x3ee42c[_0xf7cf('0x9a')]===0x0){return db[_0xf7cf('0x2f')]['create']({'name':_0x488c67[_0xf7cf('0x32')],'resourceId':_0x488c67['id'],'type':_0x3ee42c['name'],'sectionId':_0x3ee42c['id']},{})[_0xf7cf('0x2b')](function(){return _0x58fd73;});}else{return _0x58fd73;}})[_0xf7cf('0x53')](function(_0x1d7070){logger[_0xf7cf('0x30')](_0xf7cf('0x9b'),_0x1d7070);throw _0x1d7070;});}return _0x58fd73;})[_0xf7cf('0x2b')](respondWithResult(_0x39b86d,null))[_0xf7cf('0x53')](handleError(_0x39b86d,null));}});}catch(_0x1dbe2c){_0x39b86d[_0xf7cf('0x20')](0x1f4)[_0xf7cf('0x33')](_0x1dbe2c);}};function removeReferences(_0x27eeb1,_0x2088f6){try{if(_0x27eeb1){fs[_0xf7cf('0x6b')](_0x27eeb1);logger['info'](_0xf7cf('0x9c'));}if(_0x2088f6){rimraf(_0x2088f6,function(){});logger[_0xf7cf('0x6c')](_0xf7cf('0x9d'));}}catch(_0x4a0387){logger[_0xf7cf('0x30')](_0x4a0387);}}exports[_0xf7cf('0x2a')]=function(_0x3fe93a,_0x19d33f,_0x3f38be){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0x3fe93a['params']['id']}})[_0xf7cf('0x2b')](handleEntityNotFound(_0x19d33f,null))[_0xf7cf('0x2b')](saveUpdates(_0x3fe93a[_0xf7cf('0x96')],null))['then'](respondWithResult(_0x19d33f,null))[_0xf7cf('0x53')](handleError(_0x19d33f,null));};exports[_0xf7cf('0x9e')]=function(_0x39f384,_0x379e2b,_0x54bf16){return db[_0xf7cf('0x4c')][_0xf7cf('0x52')]({'where':{'id':_0x39f384[_0xf7cf('0x4f')]['id']}})[_0xf7cf('0x2b')](function(_0x40d0f6){if(_0x40d0f6){return _0x40d0f6[_0xf7cf('0x2c')]();}})[_0xf7cf('0x2b')](function(_0x4b4a90){rimraf(path[_0xf7cf('0x55')](config[_0xf7cf('0x56')],_0xf7cf('0x57'),path['dirname'](_0x4b4a90[_0xf7cf('0x8')])),function(){});return _0x4b4a90;})[_0xf7cf('0x2b')](handleEntityNotFound(_0x379e2b,null))[_0xf7cf('0x2b')](respondWithStatusCode(_0x379e2b,null))['catch'](handleError(_0x379e2b,null));};exports[_0xf7cf('0x9f')]=function(_0x1bd94e,_0x4fdfbc,_0x44163e){return BPromise[_0xf7cf('0xa0')]()[_0xf7cf('0x2b')](function(){if(!_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')]){throw new Error(_0xf7cf('0xa1'));}if(!_0x1bd94e[_0xf7cf('0x3b')]['port']){throw new Error(_0xf7cf('0xa2'));}var _0x707265=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa3')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa3')]+':'+_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa4')]:_0xf7cf('0xa5')+_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa4')];var _0x405129=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x22')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x22')]:!![];var _0xf29598=_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa6')]?_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0xa6')]:null;var _0x1ecb62={'method':_0x1bd94e[_0xf7cf('0xa7')],'uri':util['format'](_0xf7cf('0xa8'),_0x707265,_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')]),'json':_0x405129,'resolveWithFullResponse':!![],'encoding':_0xf29598,'qs':_0x1bd94e[_0xf7cf('0x3b')]};if(_0x1bd94e[_0xf7cf('0xa9')]){_0x1ecb62['headers']=_0x1bd94e[_0xf7cf('0xa9')];if(_0x1ecb62[_0xf7cf('0xa9')][_0xf7cf('0xaa')]){delete _0x1ecb62[_0xf7cf('0xa9')][_0xf7cf('0xaa')];}}if(_0x1ecb62[_0xf7cf('0xa9')]['content-type']){delete _0x1ecb62['headers']['content-type'];}return rp(_0x1ecb62);})['then'](function(_0x501403){if(_0x501403){_0x4fdfbc[_0xf7cf('0x26')](_0x501403[_0xf7cf('0xa9')]);logger['info'](_0x501403[_0xf7cf('0x96')]);if(_[_0xf7cf('0xab')](_0x1bd94e[_0xf7cf('0x3b')][_0xf7cf('0x8')],'download')&&_0x501403[_0xf7cf('0xac')]==0x1f4){return _0x4fdfbc[_0xf7cf('0x1f')](_0x501403[_0xf7cf('0xac')]);}else{return _0x4fdfbc[_0xf7cf('0x20')](_0x501403[_0xf7cf('0xac')])[_0xf7cf('0x33')](_0x501403[_0xf7cf('0x96')]);}}else{return _0x4fdfbc[_0xf7cf('0x1f')](0xc8);}})[_0xf7cf('0x53')](handleError(_0x4fdfbc,null));};exports['webhookPost']=function(_0xcce96c,_0x3fca48,_0x55011b){return BPromise[_0xf7cf('0xa0')]()[_0xf7cf('0x2b')](function(){if(!_0xcce96c['query']['path']){throw new Error(_0xf7cf('0xa1'));}if(!_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')]){throw new Error(_0xf7cf('0xa2'));}var _0x2970c7=_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa3')]?_0xcce96c[_0xf7cf('0x3b')]['hostname']+':'+_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')]:_0xf7cf('0xa5')+_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa4')];var _0x14056f=_0xcce96c[_0xf7cf('0x3b')]['json']?_0xcce96c['query'][_0xf7cf('0x22')]:!![];var _0x122054=_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa6')]?_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0xa6')]:null;var _0x1e3ec6={'method':_0xcce96c['method'],'uri':util[_0xf7cf('0x69')]('%s%s',_0x2970c7,_0xcce96c[_0xf7cf('0x3b')][_0xf7cf('0x8')]),'json':_0x14056f,'resolveWithFullResponse':!![],'encoding':_0x122054,'body':_0xcce96c[_0xf7cf('0x96')]};if(_0xcce96c[_0xf7cf('0xa9')]){_0x1e3ec6[_0xf7cf('0xa9')]=_0xcce96c['headers'];if(_0x1e3ec6[_0xf7cf('0xa9')]['content-length']){delete _0x1e3ec6[_0xf7cf('0xa9')][_0xf7cf('0xaa')];}}if(_0x1e3ec6['headers'][_0xf7cf('0xad')]){delete _0x1e3ec6['headers'][_0xf7cf('0xad')];}return rp(_0x1e3ec6);})['then'](function(_0x437784){if(_0x437784){_0x3fca48[_0xf7cf('0x26')](_0x437784[_0xf7cf('0xa9')]);logger['info'](_0x437784[_0xf7cf('0x96')]);return _0x3fca48['status'](_0x437784[_0xf7cf('0xac')])[_0xf7cf('0x33')](_0x437784[_0xf7cf('0x96')]);}else{return _0x3fca48[_0xf7cf('0x1f')](0xc8);}})[_0xf7cf('0x53')](handleError(_0x3fca48,null));}; \ No newline at end of file +var _0x6154=['admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','version','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','map','Plugin','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','include','findAll','rows','catch','params','keys','download','find','join','root','format','%s.zip','basename','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x6154,0x17a));var _0x4615=function(_0x3b52e6,_0x58c787){_0x3b52e6=_0x3b52e6-0x0;var _0x4e8883=_0x6154[_0x3b52e6];return _0x4e8883;};'use strict';var emlformat=require(_0x4615('0x0'));var rimraf=require(_0x4615('0x1'));var zipdir=require(_0x4615('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4615('0x3'));var moment=require(_0x4615('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4615('0x5'));var util=require(_0x4615('0x6'));var path=require(_0x4615('0x7'));var sox=require(_0x4615('0x8'));var csv=require(_0x4615('0x9'));var ejs=require(_0x4615('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4615('0xb'));var squel=require(_0x4615('0xc'));var crypto=require(_0x4615('0xd'));var jsforce=require(_0x4615('0xe'));var deskjs=require(_0x4615('0xf'));var toCsv=require(_0x4615('0x9'));var querystring=require(_0x4615('0x10'));var Papa=require(_0x4615('0x11'));var extract=require(_0x4615('0x12'));var rimraf=require(_0x4615('0x1'));var archiver=require('archiver');var Redis=require(_0x4615('0x13'));var authService=require(_0x4615('0x14'));var qs=require(_0x4615('0x15'));var as=require(_0x4615('0x16'));var hardwareService=require(_0x4615('0x17'));var logger=require(_0x4615('0x18'))(_0x4615('0x19'));var utils=require(_0x4615('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x4615('0x1b'));var db=require(_0x4615('0x1c'))['db'];config[_0x4615('0x1d')]=_['defaults'](config[_0x4615('0x1d')],{'host':_0x4615('0x1e'),'port':0x18eb});var socket=require(_0x4615('0x1f'))(new Redis(config[_0x4615('0x1d')]));require(_0x4615('0x20'))[_0x4615('0x21')](socket);function respondWithStatusCode(_0x290a64,_0x52ff8c){_0x52ff8c=_0x52ff8c||0xcc;return function(_0x16bb93){if(_0x16bb93){return _0x290a64[_0x4615('0x22')](_0x52ff8c);}return _0x290a64['status'](_0x52ff8c)[_0x4615('0x23')]();};}function respondWithResult(_0xe0545,_0x4bcad5){_0x4bcad5=_0x4bcad5||0xc8;return function(_0x2f1fdb){if(_0x2f1fdb){return _0xe0545[_0x4615('0x24')](_0x4bcad5)[_0x4615('0x25')](_0x2f1fdb);}};}function respondWithFilteredResult(_0x48c403,_0x1aa90f){return function(_0x2d039f){if(_0x2d039f){var _0x4f6c97=typeof _0x1aa90f['offset']===_0x4615('0x26')&&typeof _0x1aa90f['limit']==='undefined';var _0x42cce9=_0x2d039f[_0x4615('0x27')];var _0x449e18=_0x4f6c97?0x0:_0x1aa90f[_0x4615('0x28')];var _0x37dbf5=_0x4f6c97?_0x2d039f[_0x4615('0x27')]:_0x1aa90f[_0x4615('0x28')]+_0x1aa90f[_0x4615('0x29')];var _0x3732aa;if(_0x37dbf5>=_0x42cce9){_0x37dbf5=_0x42cce9;_0x3732aa=0xc8;}else{_0x3732aa=0xce;}_0x48c403['status'](_0x3732aa);return _0x48c403['set'](_0x4615('0x2a'),_0x449e18+'-'+_0x37dbf5+'/'+_0x42cce9)['json'](_0x2d039f);}return null;};}function patchUpdates(_0x670bc3){return function(_0xc20882){try{jsonpatch[_0x4615('0x2b')](_0xc20882,_0x670bc3,!![]);}catch(_0x3a3537){return BPromise['reject'](_0x3a3537);}return _0xc20882[_0x4615('0x2c')]();};}function saveUpdates(_0x1e1d09,_0x324f25){return function(_0x359d14){if(_0x359d14){return _0x359d14[_0x4615('0x2d')](_0x1e1d09)[_0x4615('0x2e')](function(_0x1835cf){return _0x1835cf;});}return null;};}function removeEntity(_0x1ed56a,_0x2edb75){return function(_0xe81d16){if(_0xe81d16){return _0xe81d16[_0x4615('0x2f')]()[_0x4615('0x2e')](function(){var _0x3c8352=_0xe81d16['get']({'plain':!![]});var _0xc94aa=_0x4615('0x30');return db[_0x4615('0x31')][_0x4615('0x2f')]({'where':{'type':_0xc94aa,'resourceId':_0x3c8352['id']}})[_0x4615('0x2e')](function(){return _0xe81d16;});})['then'](function(){_0x1ed56a[_0x4615('0x24')](0xcc)[_0x4615('0x23')]();});}};}function handleEntityNotFound(_0x15b46b,_0x3aad7c){return function(_0x97b49c){if(!_0x97b49c){_0x15b46b[_0x4615('0x22')](0x194);}return _0x97b49c;};}function handleError(_0x2f7bf4,_0x46f203){_0x46f203=_0x46f203||0x1f4;return function(_0x58653d){logger[_0x4615('0x32')](_0x58653d[_0x4615('0x33')]);if(_0x58653d[_0x4615('0x34')]){delete _0x58653d[_0x4615('0x34')];}_0x2f7bf4[_0x4615('0x24')](_0x46f203)['send'](_0x58653d);};}exports['index']=function(_0x379a5d,_0x56e83e){var _0x5cd5b2={},_0x450741={},_0x5002eb={'count':0x0,'rows':[]};var _0x15ea49=_[_0x4615('0x35')](db[_0x4615('0x36')]['rawAttributes'],function(_0x255bf4){return{'name':_0x255bf4['fieldName'],'type':_0x255bf4['type'][_0x4615('0x37')]};});_0x450741['model']=_[_0x4615('0x35')](_0x15ea49,_0x4615('0x34'));_0x450741[_0x4615('0x38')]=_['keys'](_0x379a5d[_0x4615('0x38')]);_0x450741[_0x4615('0x39')]=_['intersection'](_0x450741['model'],_0x450741['query']);_0x5cd5b2[_0x4615('0x3a')]=_[_0x4615('0x3b')](_0x450741[_0x4615('0x3c')],qs['fields'](_0x379a5d['query'][_0x4615('0x3d')]));_0x5cd5b2[_0x4615('0x3a')]=_0x5cd5b2['attributes'][_0x4615('0x3e')]?_0x5cd5b2[_0x4615('0x3a')]:_0x450741['model'];if(!_0x379a5d[_0x4615('0x38')][_0x4615('0x3f')]('nolimit')){_0x5cd5b2[_0x4615('0x29')]=qs[_0x4615('0x29')](_0x379a5d[_0x4615('0x38')][_0x4615('0x29')]);_0x5cd5b2[_0x4615('0x28')]=qs['offset'](_0x379a5d['query'][_0x4615('0x28')]);}_0x5cd5b2[_0x4615('0x40')]=qs[_0x4615('0x41')](_0x379a5d[_0x4615('0x38')]['sort']);_0x5cd5b2['where']=qs[_0x4615('0x39')](_[_0x4615('0x42')](_0x379a5d[_0x4615('0x38')],_0x450741['filters']),_0x15ea49);if(_0x379a5d[_0x4615('0x38')][_0x4615('0x43')]){_0x5cd5b2[_0x4615('0x44')]=_[_0x4615('0x45')](_0x5cd5b2[_0x4615('0x44')],{'$or':_[_0x4615('0x35')](_0x15ea49,function(_0x4358cc){if(_0x4358cc[_0x4615('0x46')]!=='VIRTUAL'){var _0x4d52d1={};_0x4d52d1[_0x4358cc[_0x4615('0x34')]]={'$like':'%'+_0x379a5d['query'][_0x4615('0x43')]+'%'};return _0x4d52d1;}})});}_0x5cd5b2=_[_0x4615('0x45')]({},_0x5cd5b2,_0x379a5d[_0x4615('0x47')]);var _0x1833aa={'where':_0x5cd5b2[_0x4615('0x44')]};return db[_0x4615('0x36')][_0x4615('0x27')](_0x1833aa)['then'](function(_0x299865){_0x5002eb['count']=_0x299865;if(_0x379a5d[_0x4615('0x38')]['includeAll']){_0x5cd5b2[_0x4615('0x48')]=[{'all':!![]}];}return db[_0x4615('0x36')][_0x4615('0x49')](_0x5cd5b2);})[_0x4615('0x2e')](function(_0x1aaeaa){_0x5002eb[_0x4615('0x4a')]=_0x1aaeaa;return _0x5002eb;})[_0x4615('0x2e')](respondWithFilteredResult(_0x56e83e,_0x5cd5b2))[_0x4615('0x4b')](handleError(_0x56e83e,null));};exports['show']=function(_0x420a88,_0x2e9da1){var _0x585469={'raw':!![],'where':{'id':_0x420a88[_0x4615('0x4c')]['id']}},_0x3c74fc={};_0x3c74fc[_0x4615('0x3c')]=_[_0x4615('0x4d')](db[_0x4615('0x36')]['rawAttributes']);_0x3c74fc[_0x4615('0x38')]=_['keys'](_0x420a88['query']);_0x3c74fc['filters']=_[_0x4615('0x3b')](_0x3c74fc['model'],_0x3c74fc[_0x4615('0x38')]);_0x585469[_0x4615('0x3a')]=_['intersection'](_0x3c74fc[_0x4615('0x3c')],qs[_0x4615('0x3d')](_0x420a88[_0x4615('0x38')][_0x4615('0x3d')]));_0x585469[_0x4615('0x3a')]=_0x585469[_0x4615('0x3a')][_0x4615('0x3e')]?_0x585469[_0x4615('0x3a')]:_0x3c74fc['model'];if(_0x420a88[_0x4615('0x38')]['includeAll']){_0x585469[_0x4615('0x48')]=[{'all':!![]}];}_0x585469=_['merge']({},_0x585469,_0x420a88['options']);return db[_0x4615('0x36')]['find'](_0x585469)[_0x4615('0x2e')](handleEntityNotFound(_0x2e9da1,null))['then'](respondWithResult(_0x2e9da1,null))['catch'](handleError(_0x2e9da1,null));};exports[_0x4615('0x4e')]=function(_0x22dce8,_0xc7e341,_0x586982){return db['Plugin'][_0x4615('0x4f')]({'where':{'id':_0x22dce8[_0x4615('0x4c')]['id']},'attributes':['name','path'],'raw':!![]})['then'](handleEntityNotFound(_0xc7e341,null))['then'](function(_0x174e59){if(_0x174e59){var _0x3b3bed=path[_0x4615('0x50')](config[_0x4615('0x51')],'server/files/plugins',util[_0x4615('0x52')](_0x4615('0x53'),path[_0x4615('0x54')](_0x174e59['path'])));var _0x14ce07=fs['createWriteStream'](_0x3b3bed);var _0x3406fe=archiver('zip',{'zlib':{'level':0x9}});_0x3406fe['on'](_0x4615('0x55'),function(_0x1f753e){if(_0x1f753e[_0x4615('0x56')]===_0x4615('0x57')){logger[_0x4615('0x32')](_0x1f753e);}else{throw new db[(_0x4615('0x58'))][(_0x4615('0x59'))](_0x4615('0x5a'));}});_0x3406fe['on'](_0x4615('0x32'),function(_0x32ae6d){throw new db['Sequelize']['Error'](_0x4615('0x5a'));});_0x3406fe[_0x4615('0x5b')](_0x14ce07);_0x3406fe[_0x4615('0x5c')](_0x4615('0x5d'),{'cwd':path[_0x4615('0x50')](config[_0x4615('0x51')],_0x4615('0x5e'),path[_0x4615('0x5f')](_0x174e59[_0x4615('0x7')])),'ignore':[path[_0x4615('0x50')](path[_0x4615('0x54')](_0x174e59[_0x4615('0x7')]),'node_modules/**/*'),path[_0x4615('0x50')](path[_0x4615('0x54')](_0x174e59[_0x4615('0x7')]),_0x4615('0x60'))],'nodir':!![]})[_0x4615('0x61')]();_0x14ce07['on'](_0x4615('0x62'),function(){if(!fs[_0x4615('0x63')](_0x3b3bed)){throw new db[(_0x4615('0x58'))]['Error'](_0x4615('0x64'));}return _0xc7e341[_0x4615('0x4e')](_0x3b3bed,util[_0x4615('0x52')](_0x4615('0x53'),path[_0x4615('0x54')](_0x174e59[_0x4615('0x7')])),function(_0x4363b8){if(_0x4363b8){throw new db['Sequelize'][(_0x4615('0x59'))](_0x4615('0x65'));}fs['unlinkSync'](_0x3b3bed);logger[_0x4615('0x66')](_0x4615('0x67'));logger[_0x4615('0x66')](_0x4615('0x68'));});});}return null;})['catch'](handleError(_0xc7e341,null));};exports[_0x4615('0x69')]=function(_0x3705ad,_0x4898f2,_0x503a0e){var _0x414466=path[_0x4615('0x54')](_0x3705ad['file'][_0x4615('0x6a')],path[_0x4615('0x6b')](_0x3705ad['file'][_0x4615('0x6a')]));var _0x30a9c5=path['join'](config['root'],_0x4615('0x5e'),_0x3705ad['file'][_0x4615('0x6a')]);var _0x45168c=path['join'](config[_0x4615('0x51')],_0x4615('0x5e'),_0x414466);logger[_0x4615('0x66')](_0x4615('0x6c'),_0x30a9c5);logger[_0x4615('0x66')](_0x4615('0x6d'),_0x45168c);try{fs[_0x4615('0x6e')](_0x30a9c5,parseInt(_0x4615('0x6f'),0x8));extract(_0x30a9c5,{'dir':_0x45168c},function(_0x28d290){if(_0x28d290){logger['error'](_0x28d290);handleError(_0x28d290,!![]);};var _0x3145a6=fs[_0x4615('0x70')](_0x45168c);if(_0x3145a6[_0x4615('0x3e')]>0x1){removeReferences(_0x30a9c5,_0x45168c);logger[_0x4615('0x32')]('Invalid\x20plugin\x20structure');return _0x503a0e(new Error(_0x4615('0x71')));}var _0x3b6542=fs[_0x4615('0x72')](path[_0x4615('0x50')](_0x45168c,_0x3145a6[0x0]));if(_0x3b6542[_0x4615('0x73')]()){removeReferences(_0x30a9c5,_0x45168c);logger[_0x4615('0x32')](_0x4615('0x71'));return _0x503a0e(new Error(_0x4615('0x71')));}if(_0x3b6542[_0x4615('0x74')]()){var _0x1b1a4f=fs['readdirSync'](path[_0x4615('0x50')](_0x45168c,_0x3145a6[0x0]));if(_0x1b1a4f['length']===0x0){removeReferences(_0x30a9c5,_0x45168c);logger['error'](_0x4615('0x71'));return _0x503a0e(new Error('Invalid\x20plugin\x20structure'));}var _0x4c369d=_0x1b1a4f['some'](function(_0x2331c2){return _0x2331c2===_0x4615('0x75');});if(!_0x4c369d){return _0x503a0e(new Error('Plugin\x20manifest\x20missing'));}var _0x111d60=fs[_0x4615('0x76')](path['join'](_0x45168c,_0x3145a6[0x0],_0x4615('0x75')));var _0x1c9d72=JSON[_0x4615('0x77')](_0x111d60);if('undefined'==typeof _0x1c9d72[_0x4615('0x34')]){return _0x503a0e(new Error(_0x4615('0x78')));}if('undefined'==typeof _0x1c9d72[_0x4615('0x46')]){return _0x503a0e(new Error(_0x4615('0x79')));}if(_0x4615('0x26')==typeof _0x1c9d72['version']){return _0x503a0e(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x4615('0x26')==typeof _0x1c9d72[_0x4615('0x7a')]){return _0x503a0e(new Error(_0x4615('0x7b')));}if(_0x1c9d72[_0x4615('0x46')]===_0x4615('0x7c')){if(_0x4615('0x26')==typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')]){return _0x503a0e(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x4615('0x26')==typeof _0x1c9d72[_0x4615('0x7a')]['views'][_0x4615('0x7e')]&&_0x4615('0x26')==typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')][_0x4615('0x7f')]){return _0x503a0e(new Error(_0x4615('0x80')));}}else if(_0x1c9d72[_0x4615('0x46')]===_0x4615('0x81')){if(_0x4615('0x26')==typeof _0x1c9d72['parameters'][_0x4615('0x82')]){return _0x503a0e(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x4615('0x26')==typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x83')]){return _0x503a0e(new Error(_0x4615('0x84')));}}else{return _0x503a0e(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5a3883=_0x1c9d72[_0x4615('0x34')];var _0x1f1b4b=_0x1c9d72[_0x4615('0x85')];var _0x58b1ec=_0x1c9d72[_0x4615('0x46')];var _0x2d64a1=_0x1c9d72[_0x4615('0x86')]?_0x1c9d72[_0x4615('0x86')]:_0x4615('0x87');var _0x5a5de0=_0x1c9d72[_0x4615('0x88')]?_0x1c9d72['icon']:'icon-apps';var _0x3d18a4='';var _0x3b3ba6='';var _0x493fe7='';var _0x53c2bb='';var _0x108332=_0x1c9d72[_0x4615('0x89')];if(_0x58b1ec===_0x4615('0x7c')){if(_0x4615('0x26')!=typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')][_0x4615('0x7e')]){var _0x1dcdf5=_0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x1dcdf5)){_0x3d18a4=path[_0x4615('0x50')]('plugins',_0x414466,_0x3145a6[0x0],_0x1dcdf5);}else{_0x3d18a4=_0x1dcdf5;}}else{logger[_0x4615('0x66')](_0x4615('0x8a'));}if(_0x4615('0x26')!=typeof _0x1c9d72[_0x4615('0x7a')]['views'][_0x4615('0x7f')]){var _0x3e14c6=_0x1c9d72['parameters'][_0x4615('0x7d')][_0x4615('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x4615('0x8b')](_0x3e14c6)){_0x3b3ba6=path[_0x4615('0x50')]('plugins',_0x414466,_0x3145a6[0x0],_0x3e14c6);}else{_0x3b3ba6=_0x3e14c6;}}else{logger[_0x4615('0x66')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x58b1ec==='script'){_0x493fe7=_0x1c9d72[_0x4615('0x7a')][_0x4615('0x82')];_0x53c2bb=_0x1c9d72[_0x4615('0x7a')]['scriptPath'];if(_0x4615('0x26')!=typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')]){if(_0x4615('0x26')!=typeof _0x1c9d72[_0x4615('0x7a')]['views'][_0x4615('0x7e')]){var _0x1dcdf5=_0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')][_0x4615('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x4615('0x8b')](_0x1dcdf5)){_0x3d18a4=path[_0x4615('0x50')](_0x4615('0x8c'),_0x414466,_0x3145a6[0x0],_0x1dcdf5);}else{_0x3d18a4=_0x1dcdf5;}}if(_0x4615('0x26')!=typeof _0x1c9d72[_0x4615('0x7a')][_0x4615('0x7d')][_0x4615('0x7f')]){var _0x3e14c6=_0x1c9d72[_0x4615('0x7a')]['views'][_0x4615('0x7f')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3e14c6)){_0x3b3ba6=path[_0x4615('0x50')](_0x4615('0x8c'),_0x414466,_0x3145a6[0x0],_0x3e14c6);}else{_0x3b3ba6=_0x3e14c6;}}}}var _0x16055a={'name':_0x5a3883,'description':_0x1f1b4b,'path':path[_0x4615('0x50')](_0x414466,_0x3145a6[0x0]),'type':_0x58b1ec,'sidebar':_0x2d64a1,'icon':_0x5a5de0,'adminUrl':_0x3d18a4,'agentUrl':_0x3b3ba6,'scriptName':_0x493fe7,'scriptPath':_0x53c2bb,'version':_0x108332};removeReferences(_0x30a9c5,null);return db[_0x4615('0x36')]['create'](_0x16055a)[_0x4615('0x2e')](function(_0x46fd4b){var _0x57e7be={'role':_0x3705ad[_0x4615('0x8d')][_0x4615('0x8e')],'userProfileId':_0x3705ad[_0x4615('0x8d')][_0x4615('0x8f')]};if(!_0x57e7be)throw new Error(_0x4615('0x90'));if(_0x57e7be[_0x4615('0x8e')]===_0x4615('0x91')){var _0x4fffc9=_0x46fd4b['get']({'plain':!![]});return db['UserProfileSection'][_0x4615('0x4f')]({'where':{'name':_0x4615('0x30'),'userProfileId':_0x57e7be[_0x4615('0x8f')]},'raw':!![]})[_0x4615('0x2e')](function(_0x26640d){if(_0x26640d&&_0x26640d[_0x4615('0x92')]===0x0){return db[_0x4615('0x31')][_0x4615('0x93')]({'name':_0x4fffc9['name'],'resourceId':_0x4fffc9['id'],'type':_0x26640d['name'],'sectionId':_0x26640d['id']},{})[_0x4615('0x2e')](function(){return _0x46fd4b;});}else{return _0x46fd4b;}})[_0x4615('0x4b')](function(_0x415b18){logger[_0x4615('0x32')](_0x4615('0x94'),_0x415b18);throw _0x415b18;});}return _0x46fd4b;})['then'](respondWithResult(_0x4898f2,null))[_0x4615('0x4b')](handleError(_0x4898f2,null));}});}catch(_0x5e8069){_0x4898f2[_0x4615('0x24')](0x1f4)[_0x4615('0x95')](_0x5e8069);}};function removeReferences(_0x275f0e,_0x2e99fe){try{if(_0x275f0e){fs[_0x4615('0x96')](_0x275f0e);logger['info']('Zip\x20archive\x20removed');}if(_0x2e99fe){rimraf(_0x2e99fe,function(){});logger[_0x4615('0x66')](_0x4615('0x97'));}}catch(_0x2113b7){logger['error'](_0x2113b7);}}exports[_0x4615('0x2d')]=function(_0x4593aa,_0x2cd80c,_0x3c7e2d){return db[_0x4615('0x36')][_0x4615('0x4f')]({'where':{'id':_0x4593aa['params']['id']}})['then'](handleEntityNotFound(_0x2cd80c,null))['then'](saveUpdates(_0x4593aa['body'],null))[_0x4615('0x2e')](respondWithResult(_0x2cd80c,null))[_0x4615('0x4b')](handleError(_0x2cd80c,null));};exports[_0x4615('0x98')]=function(_0x286a43,_0x58acc7,_0x5d9dfa){return db[_0x4615('0x36')]['find']({'where':{'id':_0x286a43[_0x4615('0x4c')]['id']}})[_0x4615('0x2e')](function(_0x39a2ad){if(_0x39a2ad){return _0x39a2ad[_0x4615('0x2f')]();}})['then'](function(_0x36d387){rimraf(path[_0x4615('0x50')](config[_0x4615('0x51')],_0x4615('0x5e'),path[_0x4615('0x5f')](_0x36d387['path'])),function(){});return _0x36d387;})[_0x4615('0x2e')](handleEntityNotFound(_0x58acc7,null))[_0x4615('0x2e')](respondWithStatusCode(_0x58acc7,null))[_0x4615('0x4b')](handleError(_0x58acc7,null));};exports[_0x4615('0x99')]=function(_0x2b1c99,_0x2d9a4c,_0x3edee4){return BPromise['resolve']()[_0x4615('0x2e')](function(){if(!_0x2b1c99[_0x4615('0x38')][_0x4615('0x7')]){throw new Error(_0x4615('0x9a'));}if(!_0x2b1c99['query'][_0x4615('0x9b')]){throw new Error(_0x4615('0x9c'));}var _0x5aa15c=_0x2b1c99[_0x4615('0x38')][_0x4615('0x9d')]?_0x2b1c99[_0x4615('0x38')][_0x4615('0x9d')]+':'+_0x2b1c99['query'][_0x4615('0x9b')]:_0x4615('0x9e')+_0x2b1c99[_0x4615('0x38')][_0x4615('0x9b')];var _0x350952=_0x2b1c99['query'][_0x4615('0x25')]?_0x2b1c99[_0x4615('0x38')]['json']:!![];var _0x5cc989=_0x2b1c99[_0x4615('0x38')][_0x4615('0x9f')]?_0x2b1c99[_0x4615('0x38')][_0x4615('0x9f')]:null;var _0x2dd35a={'method':_0x2b1c99[_0x4615('0xa0')],'uri':util[_0x4615('0x52')](_0x4615('0xa1'),_0x5aa15c,_0x2b1c99[_0x4615('0x38')][_0x4615('0x7')]),'json':_0x350952,'resolveWithFullResponse':!![],'encoding':_0x5cc989,'qs':_0x2b1c99['query']};if(_0x2b1c99['headers']){_0x2dd35a['headers']=_0x2b1c99[_0x4615('0xa2')];if(_0x2dd35a[_0x4615('0xa2')][_0x4615('0xa3')]){delete _0x2dd35a[_0x4615('0xa2')][_0x4615('0xa3')];}}if(_0x2dd35a[_0x4615('0xa2')][_0x4615('0xa4')]){delete _0x2dd35a['headers']['content-type'];}return rp(_0x2dd35a);})['then'](function(_0x1d33fc){if(_0x1d33fc){_0x2d9a4c[_0x4615('0xa5')](_0x1d33fc[_0x4615('0xa2')]);logger['info'](_0x1d33fc['body']);if(_['endsWith'](_0x2b1c99[_0x4615('0x38')][_0x4615('0x7')],_0x4615('0x4e'))&&_0x1d33fc[_0x4615('0xa6')]==0x1f4){return _0x2d9a4c[_0x4615('0x22')](_0x1d33fc[_0x4615('0xa6')]);}else{return _0x2d9a4c[_0x4615('0x24')](_0x1d33fc[_0x4615('0xa6')])[_0x4615('0x95')](_0x1d33fc['body']);}}else{return _0x2d9a4c[_0x4615('0x22')](0xc8);}})[_0x4615('0x4b')](handleError(_0x2d9a4c,null));};exports[_0x4615('0xa7')]=function(_0x5c50fa,_0x4a0855,_0x6e1e50){return BPromise['resolve']()[_0x4615('0x2e')](function(){if(!_0x5c50fa[_0x4615('0x38')][_0x4615('0x7')]){throw new Error(_0x4615('0x9a'));}if(!_0x5c50fa[_0x4615('0x38')][_0x4615('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x119ecf=_0x5c50fa['query']['hostname']?_0x5c50fa[_0x4615('0x38')][_0x4615('0x9d')]+':'+_0x5c50fa[_0x4615('0x38')][_0x4615('0x9b')]:_0x4615('0x9e')+_0x5c50fa[_0x4615('0x38')][_0x4615('0x9b')];var _0x522d1b=_0x5c50fa[_0x4615('0x38')][_0x4615('0x25')]?_0x5c50fa[_0x4615('0x38')][_0x4615('0x25')]:!![];var _0x37a3c9=_0x5c50fa[_0x4615('0x38')][_0x4615('0x9f')]?_0x5c50fa[_0x4615('0x38')][_0x4615('0x9f')]:null;var _0x4339e3={'method':_0x5c50fa[_0x4615('0xa0')],'uri':util[_0x4615('0x52')](_0x4615('0xa1'),_0x119ecf,_0x5c50fa['query'][_0x4615('0x7')]),'json':_0x522d1b,'resolveWithFullResponse':!![],'encoding':_0x37a3c9,'body':_0x5c50fa[_0x4615('0x8d')]};if(_0x5c50fa[_0x4615('0xa2')]){_0x4339e3[_0x4615('0xa2')]=_0x5c50fa[_0x4615('0xa2')];if(_0x4339e3[_0x4615('0xa2')][_0x4615('0xa3')]){delete _0x4339e3[_0x4615('0xa2')][_0x4615('0xa3')];}}if(_0x4339e3['headers'][_0x4615('0xa4')]){delete _0x4339e3[_0x4615('0xa2')][_0x4615('0xa4')];}return rp(_0x4339e3);})[_0x4615('0x2e')](function(_0x3837f5){if(_0x3837f5){_0x4a0855[_0x4615('0xa5')](_0x3837f5[_0x4615('0xa2')]);logger[_0x4615('0x66')](_0x3837f5[_0x4615('0x8d')]);return _0x4a0855['status'](_0x3837f5['statusCode'])[_0x4615('0x95')](_0x3837f5[_0x4615('0x8d')]);}else{return _0x4a0855[_0x4615('0x22')](0xc8);}})['catch'](handleError(_0x4a0855,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index e9bc7ff..62fb4a1 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 _0x2a9a=['hasOwnProperty','hook','events','Plugin','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a9a,0x64));var _0xa2a9=function(_0xb447f5,_0x40e178){_0xb447f5=_0xb447f5-0x0;var _0x44e395=_0x2a9a[_0xb447f5];return _0x44e395;};'use strict';var EventEmitter=require(_0xa2a9('0x0'));var Plugin=require('../../mysqldb')['db'][_0xa2a9('0x1')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa2a9('0x2'),'afterDestroy':_0xa2a9('0x3')};function emitEvent(_0x39eca6){return function(_0x1a817a,_0x593d5c,_0x55dc29){PluginEvents[_0xa2a9('0x4')](_0x39eca6+':'+_0x1a817a['id'],_0x1a817a);PluginEvents[_0xa2a9('0x4')](_0x39eca6,_0x1a817a);_0x55dc29(null);};}for(var e in events){if(events[_0xa2a9('0x5')](e)){var event=events[e];Plugin[_0xa2a9('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xf417=['Plugin','setMaxListeners','update','hasOwnProperty','exports','../../mysqldb'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf417,0x8f));var _0x7f41=function(_0x371d83,_0x49a0ce){_0x371d83=_0x371d83-0x0;var _0x27a8b8=_0xf417[_0x371d83];return _0x27a8b8;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x7f41('0x0'))['db'][_0x7f41('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x7f41('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f41('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4c7081){return function(_0x2b7d4c,_0x5170ec,_0x51b0cb){PluginEvents['emit'](_0x4c7081+':'+_0x2b7d4c['id'],_0x2b7d4c);PluginEvents['emit'](_0x4c7081,_0x2b7d4c);_0x51b0cb(null);};}for(var e in events){if(events[_0x7f41('0x4')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x7f41('0x5')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index bb9fc18..e062095 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 _0x64c4=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x2695ab,_0x3f4b39){var _0x3eaf50=function(_0x2ada55){while(--_0x2ada55){_0x2695ab['push'](_0x2695ab['shift']());}};_0x3eaf50(++_0x3f4b39);}(_0x64c4,0x11b));var _0x464c=function(_0x4cc883,_0x813627){_0x4cc883=_0x4cc883-0x0;var _0x174736=_0x64c4[_0x4cc883];return _0x174736;};'use strict';var _=require(_0x464c('0x0'));var util=require(_0x464c('0x1'));var logger=require(_0x464c('0x2'))(_0x464c('0x3'));var moment=require(_0x464c('0x4'));var BPromise=require(_0x464c('0x5'));var rp=require(_0x464c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x464c('0x7'));var config=require(_0x464c('0x8'));var attributes=require(_0x464c('0x9'));module['exports']=function(_0x50f541,_0x1ddd0b){return _0x50f541[_0x464c('0xa')](_0x464c('0xb'),attributes,{'tableName':_0x464c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c8b=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./plugin.attributes','lodash','util'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6c8b,0xa9));var _0xb6c8=function(_0x23616e,_0x50b986){_0x23616e=_0x23616e-0x0;var _0x551ef7=_0x6c8b[_0x23616e];return _0x551ef7;};'use strict';var _=require(_0xb6c8('0x0'));var util=require(_0xb6c8('0x1'));var logger=require(_0xb6c8('0x2'))(_0xb6c8('0x3'));var moment=require('moment');var BPromise=require(_0xb6c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6c8('0x5'));var rimraf=require(_0xb6c8('0x6'));var config=require(_0xb6c8('0x7'));var attributes=require(_0xb6c8('0x8'));module['exports']=function(_0x115024,_0x1eda6f){return _0x115024['define']('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 c6b18fc..daa5173 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 _0x9893=['Plugin','body','options','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreatePlugin'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x9893,0x1c6));var _0x3989=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9893[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3989('0x0'));var BPromise=require(_0x3989('0x1'));var rs=require(_0x3989('0x2'));var fs=require('fs');var Redis=require(_0x3989('0x3'));var db=require(_0x3989('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3989('0x5'))(_0x3989('0x6'));var config=require(_0x3989('0x7'));var jayson=require(_0x3989('0x8'));var client=jayson[_0x3989('0x9')]['http']({'port':0x232a});config[_0x3989('0xa')]=_[_0x3989('0xb')](config[_0x3989('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3989('0xc'))(new Redis(config[_0x3989('0xa')]));require(_0x3989('0xd'))[_0x3989('0xe')](socket);function respondWithRpcPromise(_0x19bccf,_0x5356a9,_0x2c70f5){return new BPromise(function(_0x459edf,_0x4b9145){return client['request'](_0x19bccf,_0x2c70f5)[_0x3989('0xf')](function(_0x431da6){logger[_0x3989('0x10')](_0x3989('0x11'),_0x5356a9,_0x3989('0x12'));logger[_0x3989('0x13')](_0x3989('0x14'),_0x5356a9,_0x3989('0x12'),JSON[_0x3989('0x15')](_0x431da6));if(_0x431da6[_0x3989('0x16')]){if(_0x431da6[_0x3989('0x16')]['code']===0x1f4){logger['error'](_0x3989('0x11'),_0x5356a9,_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);return _0x4b9145(_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);}logger[_0x3989('0x16')](_0x3989('0x11'),_0x5356a9,_0x431da6[_0x3989('0x16')][_0x3989('0x17')]);return _0x459edf(_0x431da6['error'][_0x3989('0x17')]);}else{logger[_0x3989('0x10')]('Plugin,\x20%s,\x20%s',_0x5356a9,_0x3989('0x12'));_0x459edf(_0x431da6[_0x3989('0x18')]['message']);}})['catch'](function(_0x22d5de){logger[_0x3989('0x16')]('Plugin,\x20%s,\x20%s',_0x5356a9,_0x22d5de);_0x4b9145(_0x22d5de);});});}exports[_0x3989('0x19')]=function(_0x3124a6){var _0x162047=this;return new Promise(function(_0x2ce29b,_0x437260){return db[_0x3989('0x1a')]['create'](_0x3124a6[_0x3989('0x1b')],{'raw':_0x3124a6['options']?_0x3124a6[_0x3989('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x3989('0xf')](function(_0x2df4ce){logger['info']('CreatePlugin',_0x3124a6);logger[_0x3989('0x13')](_0x3989('0x19'),_0x3124a6,JSON[_0x3989('0x15')](_0x2df4ce));_0x2ce29b(_0x2df4ce);})[_0x3989('0x1d')](function(_0x5b0940){logger[_0x3989('0x16')](_0x3989('0x19'),_0x5b0940[_0x3989('0x17')],_0x3124a6);_0x437260(_0x162047[_0x3989('0x16')](0x1f4,_0x5b0940['message']));});});}; \ No newline at end of file +var _0xb6c4=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xb6c4,0xe1));var _0x4b6c=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0xb6c4[_0x1dac7a];return _0x4cb363;};'use strict';var _=require(_0x4b6c('0x0'));var util=require('util');var moment=require(_0x4b6c('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b6c('0x2'));var fs=require('fs');var Redis=require(_0x4b6c('0x3'));var db=require(_0x4b6c('0x4'))['db'];var utils=require(_0x4b6c('0x5'));var logger=require('../../config/logger')(_0x4b6c('0x6'));var config=require(_0x4b6c('0x7'));var jayson=require(_0x4b6c('0x8'));var client=jayson[_0x4b6c('0x9')][_0x4b6c('0xa')]({'port':0x232a});config[_0x4b6c('0xb')]=_[_0x4b6c('0xc')](config[_0x4b6c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b6c('0xd'))(new Redis(config['redis']));require(_0x4b6c('0xe'))[_0x4b6c('0xf')](socket);function respondWithRpcPromise(_0x5e19e2,_0x423310,_0x500b3d){return new BPromise(function(_0x4ce6a7,_0x3c0789){return client[_0x4b6c('0x10')](_0x5e19e2,_0x500b3d)['then'](function(_0x1a274a){logger[_0x4b6c('0x11')](_0x4b6c('0x12'),_0x423310,'request\x20sent');logger[_0x4b6c('0x13')](_0x4b6c('0x14'),_0x423310,_0x4b6c('0x15'),JSON[_0x4b6c('0x16')](_0x1a274a));if(_0x1a274a[_0x4b6c('0x17')]){if(_0x1a274a[_0x4b6c('0x17')][_0x4b6c('0x18')]===0x1f4){logger['error'](_0x4b6c('0x12'),_0x423310,_0x1a274a[_0x4b6c('0x17')][_0x4b6c('0x19')]);return _0x3c0789(_0x1a274a[_0x4b6c('0x17')]['message']);}logger['error']('Plugin,\x20%s,\x20%s',_0x423310,_0x1a274a[_0x4b6c('0x17')][_0x4b6c('0x19')]);return _0x4ce6a7(_0x1a274a['error'][_0x4b6c('0x19')]);}else{logger[_0x4b6c('0x11')](_0x4b6c('0x12'),_0x423310,_0x4b6c('0x15'));_0x4ce6a7(_0x1a274a[_0x4b6c('0x1a')][_0x4b6c('0x19')]);}})[_0x4b6c('0x1b')](function(_0x388516){logger['error']('Plugin,\x20%s,\x20%s',_0x423310,_0x388516);_0x3c0789(_0x388516);});});}exports[_0x4b6c('0x1c')]=function(_0xd7cbc2){var _0x24ce97=this;return new Promise(function(_0x538feb,_0x7fd664){return db[_0x4b6c('0x1d')][_0x4b6c('0x1e')](_0xd7cbc2[_0x4b6c('0x1f')],{'raw':_0xd7cbc2['options']?_0xd7cbc2['options'][_0x4b6c('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2113bd){logger['info'](_0x4b6c('0x1c'),_0xd7cbc2);logger[_0x4b6c('0x13')]('CreatePlugin',_0xd7cbc2,JSON[_0x4b6c('0x16')](_0x2113bd));_0x538feb(_0x2113bd);})[_0x4b6c('0x1b')](function(_0x253fd2){logger[_0x4b6c('0x17')](_0x4b6c('0x1c'),_0x253fd2['message'],_0xd7cbc2);_0x7fd664(_0x24ce97[_0x4b6c('0x17')](0x1f4,_0x253fd2[_0x4b6c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2bae1af..0ff72f8 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 _0x7bb6=['length','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bb6,0x1d1));var _0x67bb=function(_0x89e27f,_0x19ff50){_0x89e27f=_0x89e27f-0x0;var _0x6559f=_0x7bb6[_0x89e27f];return _0x6559f;};'use strict';var PluginEvents=require(_0x67bb('0x0'));var events=[_0x67bb('0x1'),_0x67bb('0x2'),_0x67bb('0x3')];function createListener(_0x1e9fb2,_0x401368){return function(_0x3175c5){_0x401368[_0x67bb('0x4')](_0x1e9fb2,_0x3175c5);};}function removeListener(_0x1338ba,_0x49a964){return function(){PluginEvents[_0x67bb('0x5')](_0x1338ba,_0x49a964);};}exports[_0x67bb('0x6')]=function(_0x5a3d47){for(var _0x272fa0=0x0,_0x4ca196=events[_0x67bb('0x7')];_0x272fa0<_0x4ca196;_0x272fa0++){var _0x39b8c5=events[_0x272fa0];var _0x2f15ad=createListener('plugin:'+_0x39b8c5,_0x5a3d47);PluginEvents['on'](_0x39b8c5,_0x2f15ad);}}; \ No newline at end of file +var _0x3a80=['save','remove','update','removeListener','register','length','plugin:','./plugin.events'];(function(_0x42334a,_0x107b67){var _0x2d4dcb=function(_0x1a2721){while(--_0x1a2721){_0x42334a['push'](_0x42334a['shift']());}};_0x2d4dcb(++_0x107b67);}(_0x3a80,0x8f));var _0x03a8=function(_0xbc3c3f,_0x759d5e){_0xbc3c3f=_0xbc3c3f-0x0;var _0x592040=_0x3a80[_0xbc3c3f];return _0x592040;};'use strict';var PluginEvents=require(_0x03a8('0x0'));var events=[_0x03a8('0x1'),_0x03a8('0x2'),_0x03a8('0x3')];function createListener(_0x556a05,_0x34f775){return function(_0x2125e1){_0x34f775['emit'](_0x556a05,_0x2125e1);};}function removeListener(_0x32d2af,_0x59d02a){return function(){PluginEvents[_0x03a8('0x4')](_0x32d2af,_0x59d02a);};}exports[_0x03a8('0x5')]=function(_0x5a0b27){for(var _0x47b56d=0x0,_0x12c2ad=events[_0x03a8('0x6')];_0x47b56d<_0x12c2ad;_0x47b56d++){var _0x4c9e66=events[_0x47b56d];var _0x539ec5=createListener(_0x03a8('0x7')+_0x4c9e66,_0x5a0b27);PluginEvents['on'](_0x4c9e66,_0x539ec5);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 876cc2c..7820d01 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(_0x291cd4,_0x44288d){var _0x3bc45c=function(_0x8011cc){while(--_0x8011cc){_0x291cd4['push'](_0x291cd4['shift']());}};_0x3bc45c(++_0x44288d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x5a5fb2,_0x4d4a48){var _0x1cda0c=function(_0x5761d5){while(--_0x5761d5){_0x5a5fb2['push'](_0x5a5fb2['shift']());}};_0x1cda0c(++_0x4d4a48);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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 2478d5c..9c64560 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 _0x0565=['script','../../files/plugins','cwd','chdir','send','update','restart','stop','hasOwnProperty','params','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','error','stack','name','status','npm\x20install','index','list','then','reject','express','length','catch','show','describe','body'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x0565,0xf2));var _0x5056=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x0565[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0x5056('0x0'));var pm2=require(_0x5056('0x1'));var logger=require(_0x5056('0x2'))(_0x5056('0x3'));var path=require(_0x5056('0x4'));var exec=require(_0x5056('0x5'))[_0x5056('0x6')];var BPromise=require(_0x5056('0x7'));function handleEntityNotFound(_0x3657a8,_0x2b0883){return function(_0x554040){if(!_0x554040){_0x3657a8[_0x5056('0x8')](0x194);;}return _0x554040;};}function respondWithResult(_0x105ea8,_0x1143df){_0x1143df=_0x1143df||0xc8;return function(_0x22afb7){if(_0x22afb7){return _0x105ea8['status'](_0x1143df)['json'](_0x22afb7);}return null;};}function handleError(_0x38f74,_0x223c92){_0x223c92=_0x223c92||0x1f4;return function(_0x417065){logger[_0x5056('0x9')](_0x417065[_0x5056('0xa')]);if(_0x417065[_0x5056('0xb')]){delete _0x417065[_0x5056('0xb')];}_0x38f74[_0x5056('0xc')](_0x223c92)['send'](_0x417065);};}function execChildProcess(){return new BPromise(function(_0x78f7e4,_0xf04ea3){exec(_0x5056('0xd'),function(_0x5ab4b2,_0x4c0255,_0x17f43e){logger['info'](_0x4c0255);logger['info'](_0x17f43e);if(_0x5ab4b2){logger['error'](_0x5ab4b2);return _0xf04ea3(_0x5ab4b2);}return _0x78f7e4(_0x4c0255);});});}exports[_0x5056('0xe')]=function(_0x4b183a,_0x3e523b){return pm2[_0x5056('0xf')]()[_0x5056('0x10')](function(_0x543cee){if(_0x543cee){var _0x1e8b64=_[_0x5056('0x11')](_0x543cee,function(_0x15f52d){return _0x15f52d[_0x5056('0xb')]===_0x5056('0x12')||_0x15f52d[_0x5056('0xb')]==='motion2';});return{'rows':_0x1e8b64,'count':_0x1e8b64[_0x5056('0x13')]};}return null;})['then'](respondWithResult(_0x3e523b,null))[_0x5056('0x14')](handleError(_0x3e523b,null));};exports[_0x5056('0x15')]=function(_0x1c0ee9,_0x1f2ac6){return pm2[_0x5056('0x16')](_0x1c0ee9['params']['id'])[_0x5056('0x10')](respondWithResult(_0x1f2ac6,null))[_0x5056('0x10')](handleEntityNotFound(_0x1f2ac6,null))['catch'](handleError(_0x1f2ac6,null));};exports['create']=function(_0x20776c,_0x517bf3){if(_0x20776c[_0x5056('0x17')][_0x5056('0xb')]&&_0x20776c[_0x5056('0x17')][_0x5056('0x18')]){var _0x33035c=path['join'](__dirname,_0x5056('0x19'),_0x20776c[_0x5056('0x17')]['script']);var _0x271efc=process[_0x5056('0x1a')]();process[_0x5056('0x1b')](path['dirname'](_0x33035c));return execChildProcess()[_0x5056('0x10')](function(_0x26a3c2){process['chdir'](_0x271efc);return pm2['start']({'name':_0x20776c[_0x5056('0x17')][_0x5056('0xb')],'script':_0x33035c});})[_0x5056('0x10')](function(_0x37f7b5){pm2['dump']();return _0x37f7b5[0x0];})[_0x5056('0x10')](respondWithResult(_0x517bf3,0xc9))[_0x5056('0x14')](handleError(_0x517bf3,null));}else{return _0x517bf3['status'](0x1f4)[_0x5056('0x1c')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x5056('0x1d')]=function(_0x39d539,_0x1106e5){if(_0x39d539[_0x5056('0x17')]['id']){delete _0x39d539[_0x5056('0x17')]['id'];}var _0x50f2a8={'online':_0x5056('0x1e'),'stopped':_0x5056('0x1f')};if(_0x50f2a8[_0x5056('0x20')](_0x39d539[_0x5056('0x17')]['status'])){return pm2[_0x50f2a8[_0x39d539[_0x5056('0x17')]['status']]](_0x39d539[_0x5056('0x21')]['id'])['then'](respondWithResult(_0x1106e5,0xc8))['catch'](handleError(_0x1106e5,null));}else{return _0x1106e5['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x22')});}};exports['destroy']=function(_0x27f4be,_0x2c5728){if(_0x27f4be[_0x5056('0x17')]['id']){delete _0x27f4be[_0x5056('0x17')]['id'];}if(_0x27f4be[_0x5056('0x21')]['id']){return pm2[_0x5056('0x23')](_0x27f4be[_0x5056('0x21')]['id'])[_0x5056('0x10')](function(_0xd1aa24){pm2[_0x5056('0x24')]();return _0xd1aa24[0x0];})[_0x5056('0x10')](respondWithResult(_0x2c5728,null))['catch'](handleError(_0x2c5728,null));}else{return _0x2c5728['status'](0x1f4)[_0x5056('0x1c')]({'message':_0x5056('0x25')});}}; \ No newline at end of file +var _0x984b=['reject','express','motion2','catch','show','describe','params','create','body','script','../../files/plugins','cwd','chdir','dirname','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','delete','Unknown\x20id','api','path','child_process','status','json','error','stack','name','send','npm\x20install','info','index','list','then'];(function(_0x26aa1e,_0x47df1b){var _0x2254c8=function(_0x322e62){while(--_0x322e62){_0x26aa1e['push'](_0x26aa1e['shift']());}};_0x2254c8(++_0x47df1b);}(_0x984b,0xee));var _0xb984=function(_0x54a4ae,_0x31e55f){_0x54a4ae=_0x54a4ae-0x0;var _0x1e131a=_0x984b[_0x54a4ae];return _0x1e131a;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xb984('0x0'));var path=require(_0xb984('0x1'));var exec=require(_0xb984('0x2'))['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x8384b0,_0x340f2c){return function(_0x4d8f6a){if(!_0x4d8f6a){_0x8384b0['sendStatus'](0x194);;}return _0x4d8f6a;};}function respondWithResult(_0x2cca53,_0x46c541){_0x46c541=_0x46c541||0xc8;return function(_0x5a605a){if(_0x5a605a){return _0x2cca53[_0xb984('0x3')](_0x46c541)[_0xb984('0x4')](_0x5a605a);}return null;};}function handleError(_0x4d72b7,_0x37fd36){_0x37fd36=_0x37fd36||0x1f4;return function(_0x4e6b9a){logger[_0xb984('0x5')](_0x4e6b9a[_0xb984('0x6')]);if(_0x4e6b9a[_0xb984('0x7')]){delete _0x4e6b9a[_0xb984('0x7')];}_0x4d72b7[_0xb984('0x3')](_0x37fd36)[_0xb984('0x8')](_0x4e6b9a);};}function execChildProcess(){return new BPromise(function(_0x11525c,_0xfca315){exec(_0xb984('0x9'),function(_0x3c3e8a,_0x1f107f,_0x39e612){logger['info'](_0x1f107f);logger[_0xb984('0xa')](_0x39e612);if(_0x3c3e8a){logger['error'](_0x3c3e8a);return _0xfca315(_0x3c3e8a);}return _0x11525c(_0x1f107f);});});}exports[_0xb984('0xb')]=function(_0x2dba22,_0x594a5e){return pm2[_0xb984('0xc')]()[_0xb984('0xd')](function(_0x564d24){if(_0x564d24){var _0x203dba=_[_0xb984('0xe')](_0x564d24,function(_0x549791){return _0x549791[_0xb984('0x7')]===_0xb984('0xf')||_0x549791['name']===_0xb984('0x10');});return{'rows':_0x203dba,'count':_0x203dba['length']};}return null;})[_0xb984('0xd')](respondWithResult(_0x594a5e,null))[_0xb984('0x11')](handleError(_0x594a5e,null));};exports[_0xb984('0x12')]=function(_0x3f7cff,_0x59dcb7){return pm2[_0xb984('0x13')](_0x3f7cff[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x59dcb7,null))[_0xb984('0xd')](handleEntityNotFound(_0x59dcb7,null))[_0xb984('0x11')](handleError(_0x59dcb7,null));};exports[_0xb984('0x15')]=function(_0x5c2e25,_0x2492f4){if(_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')]&&_0x5c2e25[_0xb984('0x16')][_0xb984('0x17')]){var _0xcf9365=path['join'](__dirname,_0xb984('0x18'),_0x5c2e25[_0xb984('0x16')]['script']);var _0x44b570=process[_0xb984('0x19')]();process[_0xb984('0x1a')](path[_0xb984('0x1b')](_0xcf9365));return execChildProcess()[_0xb984('0xd')](function(_0x286033){process[_0xb984('0x1a')](_0x44b570);return pm2['start']({'name':_0x5c2e25[_0xb984('0x16')][_0xb984('0x7')],'script':_0xcf9365});})[_0xb984('0xd')](function(_0x5d4d38){pm2[_0xb984('0x1c')]();return _0x5d4d38[0x0];})[_0xb984('0xd')](respondWithResult(_0x2492f4,0xc9))[_0xb984('0x11')](handleError(_0x2492f4,null));}else{return _0x2492f4[_0xb984('0x3')](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x1d')});}};exports[_0xb984('0x1e')]=function(_0x4b3da0,_0x5d93d9){if(_0x4b3da0[_0xb984('0x16')]['id']){delete _0x4b3da0[_0xb984('0x16')]['id'];}var _0x3e254b={'online':_0xb984('0x1f'),'stopped':'stop'};if(_0x3e254b[_0xb984('0x20')](_0x4b3da0[_0xb984('0x16')][_0xb984('0x3')])){return pm2[_0x3e254b[_0x4b3da0['body'][_0xb984('0x3')]]](_0x4b3da0[_0xb984('0x14')]['id'])[_0xb984('0xd')](respondWithResult(_0x5d93d9,0xc8))[_0xb984('0x11')](handleError(_0x5d93d9,null));}else{return _0x5d93d9['status'](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xb984('0x21')]=function(_0x23ecf6,_0x58a98c){if(_0x23ecf6[_0xb984('0x16')]['id']){delete _0x23ecf6[_0xb984('0x16')]['id'];}if(_0x23ecf6[_0xb984('0x14')]['id']){return pm2[_0xb984('0x22')](_0x23ecf6['params']['id'])['then'](function(_0x315f70){pm2[_0xb984('0x1c')]();return _0x315f70[0x0];})[_0xb984('0xd')](respondWithResult(_0x58a98c,null))[_0xb984('0x11')](handleError(_0x58a98c,null));}else{return _0x58a98c['status'](0x1f4)[_0xb984('0x8')]({'message':_0xb984('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3f06ab1..e4a9ec5 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 _0x503c=['express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','getQueues','exports'];(function(_0x274e0e,_0x2e7080){var _0x4c370f=function(_0x1fedd9){while(--_0x1fedd9){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4c370f(++_0x2e7080);}(_0x503c,0x10e));var _0xc503=function(_0x253804,_0x4101e2){_0x253804=_0x253804-0x0;var _0x26cb31=_0x503c[_0x253804];return _0x26cb31;};'use strict';var express=require(_0xc503('0x0'));var router=express[_0xc503('0x1')]();var auth=require(_0xc503('0x2'));var controller=require(_0xc503('0x3'));router[_0xc503('0x4')](_0xc503('0x5'),auth[_0xc503('0x6')](),controller[_0xc503('0x7')]);router['get']('/queues',auth[_0xc503('0x6')](),controller[_0xc503('0x8')]);module[_0xc503('0x9')]=router; \ No newline at end of file +var _0xe5fc=['express','../../components/auth/service','./realtime.controller','get','/agents','getAgents'];(function(_0x4843cf,_0x480cb5){var _0x52ad78=function(_0xc6def3){while(--_0xc6def3){_0x4843cf['push'](_0x4843cf['shift']());}};_0x52ad78(++_0x480cb5);}(_0xe5fc,0x18c));var _0xce5f=function(_0x263919,_0x5bf78c){_0x263919=_0x263919-0x0;var _0x3bd0f5=_0xe5fc[_0x263919];return _0x3bd0f5;};'use strict';var express=require(_0xce5f('0x0'));var router=express['Router']();var auth=require(_0xce5f('0x1'));var controller=require(_0xce5f('0x2'));router[_0xce5f('0x3')](_0xce5f('0x4'),auth['isAuthenticated'](),controller[_0xce5f('0x5')]);router['get']('/queues',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 0ac1046..76aaf73 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 _0xbc0b=['predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','busy','outbound','find','merge','pick','filter','some','connectedlinenum','internal','toString','getMembers','length','UserId','accountcode','online','User','Queue','Pause','findAll','QueueId','getChannels','includes','toLowerCase','Invalid\x20channel','getAgents','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','*pause','resolve','channel','sort','validateSortParameter','getUpdatedSortOptions','fields','join','order','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','rawAttributes','fieldName','key','role','getOptions','sequelize','FIELD(id,','forEach','where','user','Agents','agent','assign','UserProfile','filterAgentAttributes','getAgentStatus','globalStatus','pause','Status','sortAgentsByStatus','getQueues','type','QueueCampaigns','findAndCountAll','all','jayson/promise','../../components/realtime/agents','../../config/utils','../../config/logger','api','../../mysqldb','client','http','offset','undefined','count','limit','status','set','Content-Range','stack','name','send','voice','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','request','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','talking','paused','push','pTalking','originated','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0xbc0b,0x1b1));var _0xbbc0=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0xbc0b[_0x4fbfd9];return _0x31dc94;};'use strict';var util=require('util');var _=require('lodash');var jayson=require(_0xbbc0('0x0'));var rta=require(_0xbbc0('0x1'));var qs=require('../../components/parsers/qs');var utils=require(_0xbbc0('0x2'));var logger=require(_0xbbc0('0x3'))(_0xbbc0('0x4'));var db=require(_0xbbc0('0x5'))['db'];var amiClient=jayson[_0xbbc0('0x6')]['http']({'port':0x232a});var routingClient=jayson[_0xbbc0('0x6')][_0xbbc0('0x7')]({'port':0x232c});function respondWithFilteredResult(_0x34c343,_0x46e9e3){return function(_0x438b0d){if(_0x438b0d){var _0x159c00=typeof _0x46e9e3[_0xbbc0('0x8')]===_0xbbc0('0x9')&&typeof _0x46e9e3['limit']===_0xbbc0('0x9');var _0x28aabb=_0x438b0d[_0xbbc0('0xa')];var _0x38351a=_0x159c00?0x0:_0x46e9e3[_0xbbc0('0x8')];var _0x3c2295=_0x159c00?_0x438b0d[_0xbbc0('0xa')]:_0x46e9e3[_0xbbc0('0x8')]+_0x46e9e3[_0xbbc0('0xb')];var _0x3052a2;if(_0x3c2295>=_0x28aabb){_0x3c2295=_0x28aabb;_0x3052a2=0xc8;}else{_0x3052a2=0xce;}_0x34c343[_0xbbc0('0xc')](_0x3052a2);return _0x34c343[_0xbbc0('0xd')](_0xbbc0('0xe'),_0x38351a+'-'+_0x3c2295+'/'+_0x28aabb)['json'](_0x438b0d);}return null;};}function handleError(_0x50f50e,_0x1f3657){_0x1f3657=_0x1f3657||0x1f4;return function(_0x2df96e){logger['error'](_0x2df96e[_0xbbc0('0xf')]);if(_0x2df96e[_0xbbc0('0x10')]){delete _0x2df96e[_0xbbc0('0x10')];}_0x50f50e[_0xbbc0('0xc')](_0x1f3657)[_0xbbc0('0x11')](_0x2df96e);};}function getRealtimeQueues(_0x240190,_0x29d795){return new Promise(function(_0x1bc94a,_0x15beed){var _0x5da46b=_0x29d795===_0xbbc0('0x12')?amiClient:routingClient;return _0x5da46b['request'](_[_0xbbc0('0x13')](_0x29d795)+_0xbbc0('0x14'),_0x240190)[_0xbbc0('0x15')](function(_0x2bf9ba){if(_0x2bf9ba[_0xbbc0('0x16')])throw new Error(util[_0xbbc0('0x17')](_0xbbc0('0x18'),_0x29d795));return _0x1bc94a(_0x2bf9ba[_0xbbc0('0x19')]);})[_0xbbc0('0x1a')](function(_0x45e2c5){_0x15beed(_0x45e2c5);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x54aa1b,_0x5b7684){return amiClient[_0xbbc0('0x1b')](_0xbbc0('0x1c'),{})[_0xbbc0('0x15')](function(_0x1a2077){if(_0x1a2077[_0xbbc0('0x16')])throw new Error(_0xbbc0('0x1d'));return _0x54aa1b(_0x1a2077[_0xbbc0('0x19')]);})[_0xbbc0('0x1a')](function(_0x185194){_0x5b7684(_0x185194);});});}function initializeQueues(_0x1e1350,_0x421e03,_0x1a2279,_0x14279d){var _0x4579dd=[_0xbbc0('0x1e'),'available','waiting',_0xbbc0('0x1f'),_0xbbc0('0x20')];if(_0x1a2279===_0xbbc0('0x12')&&_0x14279d==='outbound'){_0x4579dd[_0xbbc0('0x21')](_0xbbc0('0x22'),_0xbbc0('0x23'),_0xbbc0('0x24'),_0xbbc0('0x25'),_0xbbc0('0x26'),'Trunk','startPredictive',_0xbbc0('0x27'),_0xbbc0('0x28'),_0xbbc0('0x29'),_0xbbc0('0x2a'),_0xbbc0('0x2b'),_0xbbc0('0x2c'),_0xbbc0('0x2d'),_0xbbc0('0x2e'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls',_0xbbc0('0x2f'),'predictiveIntervalDroppedCallsTimeout',_0xbbc0('0x30'),_0xbbc0('0x31'),'predictiveIntervalAvgTalktime');}return _0x1e1350[_0xbbc0('0x32')](function(_0x114799){var _0x5ca29b=_0x114799[_0xbbc0('0x33')]({'plain':!![]});_0x5ca29b[_0xbbc0('0x34')]=[];_0x5ca29b['paused']=0x0;_0x5ca29b[_0xbbc0('0x35')]=0x0;_0x5ca29b[_0xbbc0('0x1e')]=0x0;_0x5ca29b['available']=0x0;_0x5ca29b['waiting']=0x0;if(_0x1a2279==='voice'){_0x5ca29b[_0xbbc0('0x1f')]=0x0;_0x5ca29b[_0xbbc0('0x36')]=0x0;if(_0x14279d===_0xbbc0('0x37')){_0x5ca29b[_0xbbc0('0x22')]=0x0;_0x5ca29b[_0xbbc0('0x23')]=0x0;}}var _0x29783f=_[_0xbbc0('0x38')](_0x421e03,['id',_0x5ca29b['id']]);if(_0x29783f)_[_0xbbc0('0x39')](_0x5ca29b,_[_0xbbc0('0x3a')](_0x29783f,_0x4579dd));return _0x5ca29b;});}function updateAgentVoiceStatus(_0x1d05cb,_0x25eaef,_0x3cd852){var _0xd27498=_[_0xbbc0('0x3b')](_0x3cd852,['queue',_0x25eaef[_0xbbc0('0x10')]]);if(_0xd27498['length']===0x0)return _0x1d05cb['busy']=!![];if(_[_0xbbc0('0x3c')](_0xd27498,[_0xbbc0('0x3d'),_0x1d05cb[_0xbbc0('0x3e')][_0xbbc0('0x3f')]()]))return _0x1d05cb[_0xbbc0('0x1f')]=!![];if(!_0x1d05cb[_0xbbc0('0x1f')])return _0x1d05cb[_0xbbc0('0x36')]=!![];}function getVoiceQueueAgents(_0x3dea47,_0x4b1210,_0x5afe76,_0x340c67){var _0x5cf812=_['find'](_0x4b1210,['id',_0x3dea47['id']]);if(!_0x5cf812)return _0x3dea47;return _0x5cf812[_0xbbc0('0x40')]({'raw':!![]})[_0xbbc0('0x15')](function(_0x614e63){for(var _0x173134=0x0;_0x173134<_0x614e63[_0xbbc0('0x41')];_0x173134++){var _0x3409bd=_[_0xbbc0('0x38')](_0x5afe76,['id',_0x614e63[_0x173134][_0xbbc0('0x42')]]);if(!_0x3409bd){_0x3409bd={'id':_0x614e63[_0x173134]['UserId'],'name':_0x614e63[_0x173134][_0xbbc0('0x42')],'accountcode':'','online':![]};}var _0x1a57f3={'id':_0x3409bd['id'],'name':_0x3409bd[_0xbbc0('0x10')],'internal':_0x3409bd[_0xbbc0('0x43')],'online':Boolean(_0x3409bd['online']),'paused':Boolean(_0x614e63[_0x173134][_0xbbc0('0x20')])};if(_0x3409bd['voiceStatus']===_0xbbc0('0x1f'))updateAgentVoiceStatus(_0x1a57f3,_0x3dea47,_0x340c67);if(_0x1a57f3[_0xbbc0('0x44')])_0x3dea47[_0xbbc0('0x35')]++;if(_0x1a57f3['busy'])_0x3dea47[_0xbbc0('0x36')]++;if(_0x1a57f3['paused']&&!_0x1a57f3['busy']&&!_0x1a57f3[_0xbbc0('0x1f')])_0x3dea47['paused']++;_0x3dea47[_0xbbc0('0x34')]['push'](_0x1a57f3);}return _0x3dea47;});}function getQueueAgents(_0x2be8ef,_0x277876,_0x2fc97e){var _0x44ee30=_0xbbc0('0x45')+_['startCase'](_0x2fc97e)+_0xbbc0('0x46');var _0x20315c=_0x2fc97e+_0xbbc0('0x47');return db[_0x44ee30][_0xbbc0('0x48')]({'where':{[_[_0xbbc0('0x13')](_0x2fc97e)+_0xbbc0('0x49')]:_0x2be8ef['id']},'raw':!![]})[_0xbbc0('0x15')](function(_0x56ad73){for(var _0x43113f=0x0;_0x43113f<_0x56ad73[_0xbbc0('0x41')];_0x43113f++){var _0x27952f=_[_0xbbc0('0x38')](_0x277876,['id',_0x56ad73[_0x43113f]['UserId']]);if(!_0x27952f){_0x27952f={'id':_0x56ad73[_0x43113f][_0xbbc0('0x42')],'name':_0x56ad73[_0x43113f][_0xbbc0('0x42')],'online':![],['pauseField']:![]};}var _0x244c4f={'id':_0x27952f['id'],'name':_0x27952f[_0xbbc0('0x10')],'online':Boolean(_0x27952f['online']),'paused':Boolean(_0x27952f[_0x20315c])};if(_0x244c4f[_0xbbc0('0x44')])_0x2be8ef[_0xbbc0('0x35')]++;_0x2be8ef[_0xbbc0('0x34')][_0xbbc0('0x21')](_0x244c4f);}return _0x2be8ef;});}function validateChannel(_0x1bd5b4){var _0x49cd97=utils[_0xbbc0('0x4a')]();if(!_[_0xbbc0('0x4b')](_0x49cd97,_0x1bd5b4[_0xbbc0('0x4c')]()))throw new Error(_0xbbc0('0x4d'));return _0x1bd5b4[_0xbbc0('0x4c')]();}exports[_0xbbc0('0x4e')]=function(_0x1266db,_0x8ce4cf){var _0x23ee68={'count':0x0,'rows':[]};var _0x2771cd={};var _0x23e9ee;var _0x526a3a;var _0x17cb6c;var _0x365fed;var _0x37e53e=utils[_0xbbc0('0x4a')]();var _0x4a4e12=_0x1266db['query'][_0xbbc0('0x4f')];var _0x2366a7=_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x51')];var _0x3db93b=_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x52')];var _0x47b464=_0x2366a7==='pause'||_0x2366a7===_0xbbc0('0x53')?!![]:![];var _0x332975=[];var _0x394fe5;Promise[_0xbbc0('0x54')]()['then'](function(){if(_0x1266db['query'][_0xbbc0('0x55')]){_0x23e9ee=validateChannel(_0x1266db['query'][_0xbbc0('0x55')]);}if(!_0x1266db['query'][_0xbbc0('0x56')]||!_0x1266db[_0xbbc0('0x50')]['sort'][_0xbbc0('0x4b')]('globalStatus')){_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x56')]=rta[_0xbbc0('0x57')](_0x1266db[_0xbbc0('0x50')]['sort']);return;}var _0x234a84=rta[_0xbbc0('0x58')](_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x56')]);_0x1266db[_0xbbc0('0x50')]['sort']=_0x234a84[_0xbbc0('0x59')][_0xbbc0('0x5a')](',');_0x526a3a=_0x234a84[_0xbbc0('0x5b')];})[_0xbbc0('0x15')](function(){if(!_0x4a4e12){return[];}return rta['getAgentIdsByQueues'](_0x4a4e12,_0x23e9ee);})['then'](function(_0x3c8597){_0x332975=_0x3c8597;return rta[_0xbbc0('0x5c')]();})[_0xbbc0('0x15')](function(_0x48a61c){_0x365fed=_0x48a61c[_0xbbc0('0x5d')];if((!_0x2366a7||_0x47b464)&&!_0x526a3a){return _0x332975;}if(_0x526a3a&&!_0x2366a7){return rta[_0xbbc0('0x5e')](_0x365fed,_0x332975,_0x526a3a);}else{return rta['getAgentIdsByStatus'](_0x365fed,_0x332975,_0x2366a7);}})[_0xbbc0('0x15')](function(_0x181f4d){_0x332975=_0x181f4d;var _0x5e0d88=![];if(_0x332975[_0xbbc0('0x41')]===0x0){if(_0x4a4e12||_0x2366a7){_0x5e0d88=!![];}if(_0x47b464){_0x5e0d88=![];}}if(_0x5e0d88){return _0x23ee68;}var _0x5cd70b=_[_0xbbc0('0x32')](db[_0xbbc0('0x45')][_0xbbc0('0x5f')],function(_0x1cdf53){return{'name':_0x1cdf53[_0xbbc0('0x60')],'type':_0x1cdf53['type'][_0xbbc0('0x61')]};});_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x62')]='agent';_0x1266db[_0xbbc0('0x50')][_0xbbc0('0x44')]=!![];_0x2771cd=qs[_0xbbc0('0x63')](_0x5cd70b,_0x1266db);_0x2771cd['raw']=!![];var _0x45f8ab=[];if(_0x332975['length']>0x0){_0x45f8ab['push']({'id':{'$in':_0x332975}});if(_0x526a3a&&!_0x2366a7){_0x394fe5=[db[_0xbbc0('0x64')]['literal'](_0xbbc0('0x65')+_0x332975+')')];_0x2771cd[_0xbbc0('0x5b')]=_0x394fe5;}}if(_0x47b464){_0x37e53e['forEach'](function(_0x31ec8d){var _0x20a870=!![];if(_0x2366a7===_0xbbc0('0x53')&&_0x23e9ee!==_0x31ec8d){_0x20a870=![];}_0x45f8ab[_0xbbc0('0x21')]({[_0x31ec8d+_0xbbc0('0x47')]:_0x20a870});});if(_0x3db93b){_0x45f8ab[_0xbbc0('0x21')]({'pauseType':_0x3db93b});}}else if(_0x2366a7){_0x37e53e[_0xbbc0('0x66')](function(_0x12d0ad){_0x45f8ab['push']({[_0x12d0ad+_0xbbc0('0x47')]:![]});});}_0x2771cd[_0xbbc0('0x67')]=_['merge'](_0x2771cd['where'],{'$and':_0x45f8ab});if(_0x1266db[_0xbbc0('0x68')]['role']===_0xbbc0('0x68')){var _0x5a5793={'params':{'id':_0x1266db[_0xbbc0('0x68')]['userProfileId']},'query':{'section':_0xbbc0('0x69'),'role':_0xbbc0('0x6a'),'online':!![],'raw':!![],'ids':_0x332975,'customSorting':_0x394fe5}};if(_0x47b464){_0x5a5793[_0xbbc0('0x50')]['extraQueryConditions']=_0x45f8ab;}_0x5a5793[_0xbbc0('0x50')]=Object[_0xbbc0('0x6b')](_0x5a5793['query'],_0x1266db[_0xbbc0('0x50')]);delete _0x5a5793[_0xbbc0('0x50')]['id'];return db[_0xbbc0('0x6c')]['getResources'](_0x5a5793);}return db['User']['findAndCountAll'](_0x2771cd);})[_0xbbc0('0x15')](function(_0x5e3e63){_0x23ee68[_0xbbc0('0xa')]=_0x5e3e63[_0xbbc0('0xa')];_0x17cb6c=_0x5e3e63[_0xbbc0('0x5d')];return _0x17cb6c[_0xbbc0('0x32')](function(_0x42129c){var _0x2138e7=_[_0xbbc0('0x38')](_0x365fed,['id',_0x42129c['id']]);if(_0x2138e7){var _0x4af54a=rta[_0xbbc0('0x6d')](_0x2138e7);_[_0xbbc0('0x39')](_0x42129c,_0x4af54a);}_0x42129c['globalStatus']=rta[_0xbbc0('0x6e')](_0x42129c);if(_0x42129c[_0xbbc0('0x6f')][_0xbbc0('0x4b')](_0xbbc0('0x70'))){_0x37e53e[_0xbbc0('0x66')](function(_0x1a141c){if(_0x42129c[_0x1a141c+'Pause']){_0x42129c[_0x1a141c+_0xbbc0('0x71')]=_0xbbc0('0x70');}});}return _0x42129c;});})[_0xbbc0('0x15')](function(_0x20b84e){if(!_0x526a3a||_0x394fe5){return _0x20b84e;}return rta[_0xbbc0('0x72')](_0x20b84e,_0x526a3a);})[_0xbbc0('0x15')](function(_0x4a422c){_0x23ee68[_0xbbc0('0x5d')]=_0x4a422c;return _0x23ee68;})[_0xbbc0('0x15')](respondWithFilteredResult(_0x8ce4cf,_0x2771cd))[_0xbbc0('0x1a')](handleError(_0x8ce4cf,null));};exports[_0xbbc0('0x73')]=function(_0x22722c,_0x530c60){var _0x184f73={'count':0x0,'rows':[]},_0xcbd7ca={},_0x4d8006,_0x11078a,_0x374ba3,_0x2f42e3,_0x1f1675;Promise['resolve']()[_0xbbc0('0x15')](function(){if(_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x55')])_0x4d8006=validateChannel(_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x55')]);var _0x25c02e=_['startCase'](_0x4d8006)+'Queue';var _0x5afabe=_[_0xbbc0('0x32')](db[_0x25c02e][_0xbbc0('0x5f')],function(_0x2e64f0){return{'name':_0x2e64f0[_0xbbc0('0x60')],'type':_0x2e64f0[_0xbbc0('0x74')][_0xbbc0('0x61')]};});_0xcbd7ca=qs[_0xbbc0('0x63')](_0x5afabe,_0x22722c);if(_0x22722c[_0xbbc0('0x68')][_0xbbc0('0x62')]===_0xbbc0('0x68')){var _0x2393e3={'params':{'id':_0x22722c[_0xbbc0('0x68')]['userProfileId']},'query':{'section':_0x4d8006===_0xbbc0('0x12')&&_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x74')]===_0xbbc0('0x37')?_0xbbc0('0x75'):_['startCase'](_0x4d8006)+'Queues','type':_0x22722c['query'][_0xbbc0('0x74')],'nolimit':!![],'sort':_0xbbc0('0x10'),'filter':_0x22722c[_0xbbc0('0x50')][_0xbbc0('0x3b')]}};return db[_0xbbc0('0x6c')]['getResources'](_0x2393e3);}return db[_0x25c02e][_0xbbc0('0x76')](_0xcbd7ca);})[_0xbbc0('0x15')](function(_0x19f11b){_0x184f73[_0xbbc0('0xa')]=_0x19f11b[_0xbbc0('0xa')];_0x11078a=_0x19f11b[_0xbbc0('0x5d')];return getRealtimeQueues(_0x22722c,_0x4d8006);})['then'](function(_0x548cf1){_0x2f42e3=_0x548cf1['rows'];return rta['getRealtimeAgents']();})[_0xbbc0('0x15')](function(_0x792898){_0x374ba3=_0x792898[_0xbbc0('0x5d')];if(_0x4d8006!=_0xbbc0('0x12'))return;return getRealtimeVoiceQueueChannels();})[_0xbbc0('0x15')](function(_0x28800b){_0x1f1675=_0x28800b?_0x28800b[_0xbbc0('0x5d')]:[];return initializeQueues(_0x11078a,_0x2f42e3,_0x4d8006,_0x22722c[_0xbbc0('0x50')]['type']);})['then'](function(_0x62b69d){var _0x2eee29=_0x62b69d[_0xbbc0('0x32')](function(_0x28e0ff){if(_0x4d8006===_0xbbc0('0x12'))return getVoiceQueueAgents(_0x28e0ff,_0x11078a,_0x374ba3,_0x1f1675);else return getQueueAgents(_0x28e0ff,_0x374ba3,_0x4d8006);});return Promise[_0xbbc0('0x77')](_0x2eee29);})['then'](function(_0x1829f1){_0x184f73[_0xbbc0('0x5d')]=_0x1829f1;return _0x184f73;})['then'](respondWithFilteredResult(_0x530c60,_0xcbd7ca))[_0xbbc0('0x1a')](handleError(_0x530c60,null));}; \ No newline at end of file +var _0xcec8=['getAgentIdsByStatus','rawAttributes','fieldName','type','key','role','agent','raw','sequelize','literal','FIELD(id,','forEach','Pause','where','user','Agents','extraQueryConditions','UserProfile','getResources','findAndCountAll','getAgentStatus','Status','sortAgentsByStatus','rows','catch','getQueues','resolve','getOptions','userProfileId','QueueCampaigns','all','util','jayson/promise','../../components/realtime/agents','../../components/parsers/qs','../../config/utils','../../config/logger','api','client','http','offset','limit','undefined','count','status','set','Content-Range','json','error','name','send','voice','startCase','Queues','then','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','request','VoiceQueuesChannels','loggedIn','waiting','outbound','push','originated','message','dialActive','dialMethod','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','loggedInDb','available','busy','pTalking','find','merge','filter','queue','length','some','toString','talking','getMembers','UserId','online','paused','voiceStatus','User','Queue','findAll','QueueId','includes','Invalid\x20channel','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','channel','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0xcec8,0x18d));var _0x8cec=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xcec8[_0x36f47c];return _0x296c55;};'use strict';var util=require(_0x8cec('0x0'));var _=require('lodash');var jayson=require(_0x8cec('0x1'));var rta=require(_0x8cec('0x2'));var qs=require(_0x8cec('0x3'));var utils=require(_0x8cec('0x4'));var logger=require(_0x8cec('0x5'))(_0x8cec('0x6'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x8cec('0x7')][_0x8cec('0x8')]({'port':0x232a});var routingClient=jayson[_0x8cec('0x7')][_0x8cec('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x2f2e7f,_0xadd593){return function(_0x4ec18c){if(_0x4ec18c){var _0x1e9337=typeof _0xadd593[_0x8cec('0x9')]==='undefined'&&typeof _0xadd593[_0x8cec('0xa')]===_0x8cec('0xb');var _0x3a2aed=_0x4ec18c[_0x8cec('0xc')];var _0x39a498=_0x1e9337?0x0:_0xadd593[_0x8cec('0x9')];var _0x548869=_0x1e9337?_0x4ec18c['count']:_0xadd593['offset']+_0xadd593['limit'];var _0x253e27;if(_0x548869>=_0x3a2aed){_0x548869=_0x3a2aed;_0x253e27=0xc8;}else{_0x253e27=0xce;}_0x2f2e7f[_0x8cec('0xd')](_0x253e27);return _0x2f2e7f[_0x8cec('0xe')](_0x8cec('0xf'),_0x39a498+'-'+_0x548869+'/'+_0x3a2aed)[_0x8cec('0x10')](_0x4ec18c);}return null;};}function handleError(_0xef47d1,_0x124f33){_0x124f33=_0x124f33||0x1f4;return function(_0x5a964f){logger[_0x8cec('0x11')](_0x5a964f['stack']);if(_0x5a964f[_0x8cec('0x12')]){delete _0x5a964f[_0x8cec('0x12')];}_0xef47d1['status'](_0x124f33)[_0x8cec('0x13')](_0x5a964f);};}function getRealtimeQueues(_0x54e877,_0x7fb045){return new Promise(function(_0x3f81a9,_0x2b96c7){var _0x46aba9=_0x7fb045===_0x8cec('0x14')?amiClient:routingClient;return _0x46aba9['request'](_[_0x8cec('0x15')](_0x7fb045)+_0x8cec('0x16'),_0x54e877)[_0x8cec('0x17')](function(_0x5e466d){if(_0x5e466d[_0x8cec('0x11')])throw new Error(util['format'](_0x8cec('0x18'),_0x7fb045));return _0x3f81a9(_0x5e466d[_0x8cec('0x19')]);})['catch'](function(_0x253581){_0x2b96c7(_0x253581);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x909337,_0x327842){return amiClient[_0x8cec('0x1a')](_0x8cec('0x1b'),{})[_0x8cec('0x17')](function(_0x1d60df){if(_0x1d60df['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x909337(_0x1d60df[_0x8cec('0x19')]);})['catch'](function(_0xe8de5b){_0x327842(_0xe8de5b);});});}function initializeQueues(_0x1e1e7a,_0x5a140f,_0x2480c3,_0x8e96fd){var _0x57689e=[_0x8cec('0x1c'),'available',_0x8cec('0x1d'),'talking','paused'];if(_0x2480c3===_0x8cec('0x14')&&_0x8e96fd===_0x8cec('0x1e')){_0x57689e[_0x8cec('0x1f')]('pTalking',_0x8cec('0x20'),_0x8cec('0x21'),_0x8cec('0x22'),_0x8cec('0x23'),'Trunk',_0x8cec('0x24'),_0x8cec('0x25'),_0x8cec('0x26'),_0x8cec('0x27'),_0x8cec('0x28'),_0x8cec('0x29'),_0x8cec('0x2a'),_0x8cec('0x2b'),'dialPredictiveIntervalMinThreshold',_0x8cec('0x2c'),'predictiveIntervalTotalCalls',_0x8cec('0x2d'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit',_0x8cec('0x2e'),_0x8cec('0x2f'));}return _0x1e1e7a[_0x8cec('0x30')](function(_0x4558fd){var _0x201582=_0x4558fd[_0x8cec('0x31')]({'plain':!![]});_0x201582[_0x8cec('0x32')]=[];_0x201582['paused']=0x0;_0x201582[_0x8cec('0x33')]=0x0;_0x201582[_0x8cec('0x1c')]=0x0;_0x201582[_0x8cec('0x34')]=0x0;_0x201582['waiting']=0x0;if(_0x2480c3==='voice'){_0x201582['talking']=0x0;_0x201582[_0x8cec('0x35')]=0x0;if(_0x8e96fd==='outbound'){_0x201582[_0x8cec('0x36')]=0x0;_0x201582['originated']=0x0;}}var _0x5695bf=_[_0x8cec('0x37')](_0x5a140f,['id',_0x201582['id']]);if(_0x5695bf)_[_0x8cec('0x38')](_0x201582,_['pick'](_0x5695bf,_0x57689e));return _0x201582;});}function updateAgentVoiceStatus(_0x8a9616,_0x4c18c0,_0x3bf9ad){var _0x5541e8=_[_0x8cec('0x39')](_0x3bf9ad,[_0x8cec('0x3a'),_0x4c18c0[_0x8cec('0x12')]]);if(_0x5541e8[_0x8cec('0x3b')]===0x0)return _0x8a9616[_0x8cec('0x35')]=!![];if(_[_0x8cec('0x3c')](_0x5541e8,['connectedlinenum',_0x8a9616['internal'][_0x8cec('0x3d')]()]))return _0x8a9616[_0x8cec('0x3e')]=!![];if(!_0x8a9616[_0x8cec('0x3e')])return _0x8a9616['busy']=!![];}function getVoiceQueueAgents(_0x465d0b,_0x4a08f3,_0x418fe4,_0x5ec3ca){var _0x109b78=_[_0x8cec('0x37')](_0x4a08f3,['id',_0x465d0b['id']]);if(!_0x109b78)return _0x465d0b;return _0x109b78[_0x8cec('0x3f')]({'raw':!![]})[_0x8cec('0x17')](function(_0x2a330){for(var _0x21b2ef=0x0;_0x21b2ef<_0x2a330['length'];_0x21b2ef++){var _0x29742c=_[_0x8cec('0x37')](_0x418fe4,['id',_0x2a330[_0x21b2ef][_0x8cec('0x40')]]);if(!_0x29742c){_0x29742c={'id':_0x2a330[_0x21b2ef][_0x8cec('0x40')],'name':_0x2a330[_0x21b2ef][_0x8cec('0x40')],'accountcode':'','online':![]};}var _0xf52692={'id':_0x29742c['id'],'name':_0x29742c[_0x8cec('0x12')],'internal':_0x29742c['accountcode'],'online':Boolean(_0x29742c[_0x8cec('0x41')]),'paused':Boolean(_0x2a330[_0x21b2ef][_0x8cec('0x42')])};if(_0x29742c[_0x8cec('0x43')]===_0x8cec('0x3e'))updateAgentVoiceStatus(_0xf52692,_0x465d0b,_0x5ec3ca);if(_0xf52692[_0x8cec('0x41')])_0x465d0b[_0x8cec('0x33')]++;if(_0xf52692[_0x8cec('0x35')])_0x465d0b[_0x8cec('0x35')]++;if(_0xf52692[_0x8cec('0x42')]&&!_0xf52692[_0x8cec('0x35')]&&!_0xf52692['talking'])_0x465d0b[_0x8cec('0x42')]++;_0x465d0b[_0x8cec('0x32')]['push'](_0xf52692);}return _0x465d0b;});}function getQueueAgents(_0x42f149,_0x532af6,_0x3c1583){var _0x155405=_0x8cec('0x44')+_['startCase'](_0x3c1583)+_0x8cec('0x45');var _0x45fd0a=_0x3c1583+'Pause';return db[_0x155405][_0x8cec('0x46')]({'where':{[_[_0x8cec('0x15')](_0x3c1583)+_0x8cec('0x47')]:_0x42f149['id']},'raw':!![]})[_0x8cec('0x17')](function(_0x3dec1a){for(var _0x475bdb=0x0;_0x475bdb<_0x3dec1a[_0x8cec('0x3b')];_0x475bdb++){var _0x128963=_['find'](_0x532af6,['id',_0x3dec1a[_0x475bdb][_0x8cec('0x40')]]);if(!_0x128963){_0x128963={'id':_0x3dec1a[_0x475bdb]['UserId'],'name':_0x3dec1a[_0x475bdb][_0x8cec('0x40')],'online':![],['pauseField']:![]};}var _0x34c858={'id':_0x128963['id'],'name':_0x128963[_0x8cec('0x12')],'online':Boolean(_0x128963[_0x8cec('0x41')]),'paused':Boolean(_0x128963[_0x45fd0a])};if(_0x34c858[_0x8cec('0x41')])_0x42f149[_0x8cec('0x33')]++;_0x42f149[_0x8cec('0x32')]['push'](_0x34c858);}return _0x42f149;});}function validateChannel(_0x3ff2cb){var _0x213b73=utils['getChannels']();if(!_[_0x8cec('0x48')](_0x213b73,_0x3ff2cb['toLowerCase']()))throw new Error(_0x8cec('0x49'));return _0x3ff2cb['toLowerCase']();}exports['getAgents']=function(_0x47658e,_0x121efe){var _0x1dc03c={'count':0x0,'rows':[]};var _0x3816ce={};var _0x3e5590;var _0x49cde2;var _0x310ecb;var _0x11dc9c;var _0x1b0831=utils['getChannels']();var _0x29ee26=_0x47658e[_0x8cec('0x4a')][_0x8cec('0x4b')];var _0x3a1676=_0x47658e[_0x8cec('0x4a')][_0x8cec('0x4c')];var _0x5e1ed1=_0x47658e[_0x8cec('0x4a')][_0x8cec('0x4d')];var _0x2d1dbf=_0x3a1676===_0x8cec('0x4e')||_0x3a1676===_0x8cec('0x4f')?!![]:![];var _0x52f6ad=[];var _0x15eacf;Promise['resolve']()[_0x8cec('0x17')](function(){if(_0x47658e[_0x8cec('0x4a')][_0x8cec('0x50')]){_0x3e5590=validateChannel(_0x47658e[_0x8cec('0x4a')][_0x8cec('0x50')]);}if(!_0x47658e[_0x8cec('0x4a')][_0x8cec('0x51')]||!_0x47658e[_0x8cec('0x4a')][_0x8cec('0x51')][_0x8cec('0x48')](_0x8cec('0x52'))){_0x47658e['query']['sort']=rta[_0x8cec('0x53')](_0x47658e[_0x8cec('0x4a')][_0x8cec('0x51')]);return;}var _0x50987b=rta[_0x8cec('0x54')](_0x47658e[_0x8cec('0x4a')][_0x8cec('0x51')]);_0x47658e[_0x8cec('0x4a')][_0x8cec('0x51')]=_0x50987b[_0x8cec('0x55')][_0x8cec('0x56')](',');_0x49cde2=_0x50987b[_0x8cec('0x57')];})['then'](function(){if(!_0x29ee26){return[];}return rta[_0x8cec('0x58')](_0x29ee26,_0x3e5590);})[_0x8cec('0x17')](function(_0x10e7c5){_0x52f6ad=_0x10e7c5;return rta[_0x8cec('0x59')]();})['then'](function(_0x3cd6a5){_0x11dc9c=_0x3cd6a5['rows'];if((!_0x3a1676||_0x2d1dbf)&&!_0x49cde2){return _0x52f6ad;}if(_0x49cde2&&!_0x3a1676){return rta[_0x8cec('0x5a')](_0x11dc9c,_0x52f6ad,_0x49cde2);}else{return rta[_0x8cec('0x5b')](_0x11dc9c,_0x52f6ad,_0x3a1676);}})['then'](function(_0x2890f9){_0x52f6ad=_0x2890f9;var _0x562463=![];if(_0x52f6ad[_0x8cec('0x3b')]===0x0){if(_0x29ee26||_0x3a1676){_0x562463=!![];}if(_0x2d1dbf){_0x562463=![];}}if(_0x562463){return _0x1dc03c;}var _0x5c6af0=_[_0x8cec('0x30')](db['User'][_0x8cec('0x5c')],function(_0x4085e2){return{'name':_0x4085e2[_0x8cec('0x5d')],'type':_0x4085e2[_0x8cec('0x5e')][_0x8cec('0x5f')]};});_0x47658e[_0x8cec('0x4a')][_0x8cec('0x60')]=_0x8cec('0x61');_0x47658e[_0x8cec('0x4a')][_0x8cec('0x41')]=!![];_0x3816ce=qs['getOptions'](_0x5c6af0,_0x47658e);_0x3816ce[_0x8cec('0x62')]=!![];var _0x3a25b3=[];if(_0x52f6ad[_0x8cec('0x3b')]>0x0){_0x3a25b3[_0x8cec('0x1f')]({'id':{'$in':_0x52f6ad}});if(_0x49cde2&&!_0x3a1676){_0x15eacf=[db[_0x8cec('0x63')][_0x8cec('0x64')](_0x8cec('0x65')+_0x52f6ad+')')];_0x3816ce[_0x8cec('0x57')]=_0x15eacf;}}if(_0x2d1dbf){_0x1b0831[_0x8cec('0x66')](function(_0x2ccef1){var _0x107b70=!![];if(_0x3a1676===_0x8cec('0x4f')&&_0x3e5590!==_0x2ccef1){_0x107b70=![];}_0x3a25b3['push']({[_0x2ccef1+'Pause']:_0x107b70});});if(_0x5e1ed1){_0x3a25b3[_0x8cec('0x1f')]({'pauseType':_0x5e1ed1});}}else if(_0x3a1676){_0x1b0831[_0x8cec('0x66')](function(_0x2a0e4d){_0x3a25b3[_0x8cec('0x1f')]({[_0x2a0e4d+_0x8cec('0x67')]:![]});});}_0x3816ce[_0x8cec('0x68')]=_['merge'](_0x3816ce[_0x8cec('0x68')],{'$and':_0x3a25b3});if(_0x47658e[_0x8cec('0x69')][_0x8cec('0x60')]===_0x8cec('0x69')){var _0x14b26b={'params':{'id':_0x47658e[_0x8cec('0x69')]['userProfileId']},'query':{'section':_0x8cec('0x6a'),'role':_0x8cec('0x61'),'online':!![],'raw':!![],'ids':_0x52f6ad,'customSorting':_0x15eacf}};if(_0x2d1dbf){_0x14b26b[_0x8cec('0x4a')][_0x8cec('0x6b')]=_0x3a25b3;}_0x14b26b['query']=Object['assign'](_0x14b26b[_0x8cec('0x4a')],_0x47658e[_0x8cec('0x4a')]);delete _0x14b26b[_0x8cec('0x4a')]['id'];return db[_0x8cec('0x6c')][_0x8cec('0x6d')](_0x14b26b);}return db[_0x8cec('0x44')][_0x8cec('0x6e')](_0x3816ce);})['then'](function(_0x43a885){_0x1dc03c[_0x8cec('0xc')]=_0x43a885[_0x8cec('0xc')];_0x310ecb=_0x43a885['rows'];return _0x310ecb[_0x8cec('0x30')](function(_0x3121a5){var _0x23b1a2=_['find'](_0x11dc9c,['id',_0x3121a5['id']]);if(_0x23b1a2){var _0x381fe8=rta['filterAgentAttributes'](_0x23b1a2);_['merge'](_0x3121a5,_0x381fe8);}_0x3121a5[_0x8cec('0x52')]=rta[_0x8cec('0x6f')](_0x3121a5);if(_0x3121a5[_0x8cec('0x52')]['includes']('pause')){_0x1b0831[_0x8cec('0x66')](function(_0x20bd93){if(_0x3121a5[_0x20bd93+_0x8cec('0x67')]){_0x3121a5[_0x20bd93+_0x8cec('0x70')]=_0x8cec('0x4e');}});}return _0x3121a5;});})[_0x8cec('0x17')](function(_0x427d50){if(!_0x49cde2||_0x15eacf){return _0x427d50;}return rta[_0x8cec('0x71')](_0x427d50,_0x49cde2);})[_0x8cec('0x17')](function(_0x3f669c){_0x1dc03c[_0x8cec('0x72')]=_0x3f669c;return _0x1dc03c;})[_0x8cec('0x17')](respondWithFilteredResult(_0x121efe,_0x3816ce))[_0x8cec('0x73')](handleError(_0x121efe,null));};exports[_0x8cec('0x74')]=function(_0x346df3,_0x1ac5f1){var _0x71a17d={'count':0x0,'rows':[]},_0x3c84b1={},_0x38ec81,_0x191e04,_0x1f7fc6,_0x184dc3,_0x59a468;Promise[_0x8cec('0x75')]()[_0x8cec('0x17')](function(){if(_0x346df3[_0x8cec('0x4a')][_0x8cec('0x50')])_0x38ec81=validateChannel(_0x346df3[_0x8cec('0x4a')][_0x8cec('0x50')]);var _0x8aea96=_[_0x8cec('0x15')](_0x38ec81)+'Queue';var _0xec8086=_[_0x8cec('0x30')](db[_0x8aea96][_0x8cec('0x5c')],function(_0x19ffa2){return{'name':_0x19ffa2[_0x8cec('0x5d')],'type':_0x19ffa2[_0x8cec('0x5e')][_0x8cec('0x5f')]};});_0x3c84b1=qs[_0x8cec('0x76')](_0xec8086,_0x346df3);if(_0x346df3[_0x8cec('0x69')]['role']==='user'){var _0x41eb3b={'params':{'id':_0x346df3[_0x8cec('0x69')][_0x8cec('0x77')]},'query':{'section':_0x38ec81===_0x8cec('0x14')&&_0x346df3[_0x8cec('0x4a')]['type']===_0x8cec('0x1e')?_0x8cec('0x78'):_[_0x8cec('0x15')](_0x38ec81)+'Queues','type':_0x346df3['query'][_0x8cec('0x5e')],'nolimit':!![],'sort':_0x8cec('0x12'),'filter':_0x346df3[_0x8cec('0x4a')]['filter']}};return db[_0x8cec('0x6c')][_0x8cec('0x6d')](_0x41eb3b);}return db[_0x8aea96][_0x8cec('0x6e')](_0x3c84b1);})[_0x8cec('0x17')](function(_0x24df8c){_0x71a17d[_0x8cec('0xc')]=_0x24df8c[_0x8cec('0xc')];_0x191e04=_0x24df8c[_0x8cec('0x72')];return getRealtimeQueues(_0x346df3,_0x38ec81);})[_0x8cec('0x17')](function(_0x5adfa7){_0x184dc3=_0x5adfa7[_0x8cec('0x72')];return rta['getRealtimeAgents']();})[_0x8cec('0x17')](function(_0x3fa5a2){_0x1f7fc6=_0x3fa5a2['rows'];if(_0x38ec81!=_0x8cec('0x14'))return;return getRealtimeVoiceQueueChannels();})[_0x8cec('0x17')](function(_0xf75752){_0x59a468=_0xf75752?_0xf75752[_0x8cec('0x72')]:[];return initializeQueues(_0x191e04,_0x184dc3,_0x38ec81,_0x346df3[_0x8cec('0x4a')][_0x8cec('0x5e')]);})['then'](function(_0x591166){var _0x3ad9a1=_0x591166[_0x8cec('0x30')](function(_0x11c094){if(_0x38ec81===_0x8cec('0x14'))return getVoiceQueueAgents(_0x11c094,_0x191e04,_0x1f7fc6,_0x59a468);else return getQueueAgents(_0x11c094,_0x1f7fc6,_0x38ec81);});return Promise[_0x8cec('0x79')](_0x3ad9a1);})[_0x8cec('0x17')](function(_0x26dfc6){_0x71a17d[_0x8cec('0x72')]=_0x26dfc6;return _0x71a17d;})[_0x8cec('0x17')](respondWithFilteredResult(_0x1ac5f1,_0x3c84b1))['catch'](handleError(_0x1ac5f1,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index a71c6c1..c8071fd 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x39ff71,_0x8e6288){var _0x3965bd=function(_0x3b7a67){while(--_0x3b7a67){_0x39ff71['push'](_0x39ff71['shift']());}};_0x3965bd(++_0x8e6288);}(_0xedd9,0xfc));var _0x9edd=function(_0x5773ef,_0x44c95e){_0x5773ef=_0x5773ef-0x0;var _0x5b20a3=_0xedd9[_0x5773ef];return _0x5b20a3;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x55689f,_0x53365d){var _0x3bd44d=function(_0x47bc3a){while(--_0x47bc3a){_0x55689f['push'](_0x55689f['shift']());}};_0x3bd44d(++_0x53365d);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 23ee4c6..fc889a0 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 _0x744c=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x744c,0xa0));var _0xc744=function(_0x449607,_0x287561){_0x449607=_0x449607-0x0;var _0x972d5=_0x744c[_0x449607];return _0x972d5;};'use strict';var Sequelize=require(_0xc744('0x0'));module[_0xc744('0x1')]={'state':{'type':Sequelize[_0xc744('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc744('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xc744('0x3')]},'starttime':{'type':Sequelize[_0xc744('0x4')]},'responsetime':{'type':Sequelize[_0xc744('0x4')]},'ringtime':{'type':Sequelize[_0xc744('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc744('0x3')]}}; \ No newline at end of file +var _0x1419=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x1419,0x127));var _0x9141=function(_0x378c30,_0x970915){_0x378c30=_0x378c30-0x0;var _0x2f04da=_0x1419[_0x378c30];return _0x2f04da;};'use strict';var Sequelize=require(_0x9141('0x0'));module[_0x9141('0x1')]={'state':{'type':Sequelize[_0x9141('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9141('0x3')]},'scheduledat':{'type':Sequelize[_0x9141('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x9141('0x4')]},'ringtime':{'type':Sequelize[_0x9141('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9141('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 85d42d9..2682f71 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 _0x8035=['rimraf','../../config/environment','exports','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0x8035,0xa3));var _0x5803=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x8035[_0x46c1d5];return _0x40fe7b;};'use strict';var _=require('lodash');var util=require(_0x5803('0x0'));var logger=require(_0x5803('0x1'))(_0x5803('0x2'));var moment=require(_0x5803('0x3'));var BPromise=require(_0x5803('0x4'));var rp=require(_0x5803('0x5'));var fs=require('fs');var path=require(_0x5803('0x6'));var rimraf=require(_0x5803('0x7'));var config=require(_0x5803('0x8'));var attributes=require('./reportAgentPreview.attributes');module[_0x5803('0x9')]=function(_0x41e174,_0x520db7){return _0x41e174['define']('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa47a=['bluebird','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview','../../config/logger','moment'];(function(_0x40e6e1,_0x1bab21){var _0x16949a=function(_0x214f7d){while(--_0x214f7d){_0x40e6e1['push'](_0x40e6e1['shift']());}};_0x16949a(++_0x1bab21);}(_0xa47a,0xa9));var _0xaa47=function(_0x15f863,_0x5e19a2){_0x15f863=_0x15f863-0x0;var _0x3170e6=_0xa47a[_0x15f863];return _0x3170e6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaa47('0x0'))('api');var moment=require(_0xaa47('0x1'));var BPromise=require(_0xaa47('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa47('0x3'));var rimraf=require(_0xaa47('0x4'));var config=require(_0xaa47('0x5'));var attributes=require(_0xaa47('0x6'));module['exports']=function(_0x2263b7,_0x3cb8d6){return _0x2263b7['define'](_0xaa47('0x7'),attributes,{'tableName':_0xaa47('0x8'),'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 b630291..e815776 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 _0x27bc=['ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x27bc,0x131));var _0xc27b=function(_0x507f1d,_0x4c14b6){_0x507f1d=_0x507f1d-0x0;var _0x8d6e46=_0x27bc[_0x507f1d];return _0x8d6e46;};'use strict';var _=require(_0xc27b('0x0'));var util=require(_0xc27b('0x1'));var moment=require('moment');var BPromise=require(_0xc27b('0x2'));var rs=require(_0xc27b('0x3'));var fs=require('fs');var Redis=require(_0xc27b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc27b('0x5'));var logger=require(_0xc27b('0x6'))(_0xc27b('0x7'));var config=require(_0xc27b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc27b('0x9')][_0xc27b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x429bd8,_0x3e0d6d,_0x21cdb6){return new BPromise(function(_0x3db9fa,_0x10bc91){return client[_0xc27b('0xb')](_0x429bd8,_0x21cdb6)[_0xc27b('0xc')](function(_0x33b0d1){logger[_0xc27b('0xd')](_0xc27b('0xe'),_0x3e0d6d,_0xc27b('0xf'));logger['debug'](_0xc27b('0x10'),_0x3e0d6d,_0xc27b('0xf'),JSON[_0xc27b('0x11')](_0x33b0d1));if(_0x33b0d1[_0xc27b('0x12')]){if(_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x13')]===0x1f4){logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x14')]);return _0x10bc91(_0x33b0d1[_0xc27b('0x12')][_0xc27b('0x14')]);}logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x33b0d1[_0xc27b('0x12')]['message']);return _0x3db9fa(_0x33b0d1['error'][_0xc27b('0x14')]);}else{logger['info'](_0xc27b('0xe'),_0x3e0d6d,_0xc27b('0xf'));_0x3db9fa(_0x33b0d1['result'][_0xc27b('0x14')]);}})[_0xc27b('0x15')](function(_0x30fdf0){logger[_0xc27b('0x12')](_0xc27b('0xe'),_0x3e0d6d,_0x30fdf0);_0x10bc91(_0x30fdf0);});});}exports[_0xc27b('0x16')]=function(_0x266de1){var _0x3ca39a=this;return new Promise(function(_0x5718ca,_0x5c0970){return db[_0xc27b('0x17')][_0xc27b('0x18')](_0x266de1[_0xc27b('0x19')],{'raw':_0x266de1[_0xc27b('0x1a')]?_0x266de1[_0xc27b('0x1a')][_0xc27b('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4e0bd6){logger[_0xc27b('0xd')](_0xc27b('0x16'),_0x266de1);logger[_0xc27b('0x1c')](_0xc27b('0x16'),_0x266de1,JSON[_0xc27b('0x11')](_0x4e0bd6));_0x5718ca(_0x4e0bd6);})[_0xc27b('0x15')](function(_0x162977){logger[_0xc27b('0x12')](_0xc27b('0x16'),_0x162977['message'],_0x266de1);_0x5c0970(_0x3ca39a[_0xc27b('0x12')](0x1f4,_0x162977[_0xc27b('0x14')]));});});}; \ No newline at end of file +var _0x34f3=['request','then','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0xb8e605,_0x332939){var _0x2f90f7=function(_0x248784){while(--_0x248784){_0xb8e605['push'](_0xb8e605['shift']());}};_0x2f90f7(++_0x332939);}(_0x34f3,0xbb));var _0x334f=function(_0x54500f,_0x4526f5){_0x54500f=_0x54500f-0x0;var _0x1d6f93=_0x34f3[_0x54500f];return _0x1d6f93;};'use strict';var _=require(_0x334f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x334f('0x1'));var fs=require('fs');var Redis=require(_0x334f('0x2'));var db=require(_0x334f('0x3'))['db'];var utils=require(_0x334f('0x4'));var logger=require(_0x334f('0x5'))(_0x334f('0x6'));var config=require(_0x334f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x334f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4410fa,_0xd3f951,_0x2997e1){return new BPromise(function(_0x4fd33f,_0x3f7418){return client[_0x334f('0x9')](_0x4410fa,_0x2997e1)[_0x334f('0xa')](function(_0x19bd06){logger[_0x334f('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0xd3f951,_0x334f('0xc'));logger['debug'](_0x334f('0xd'),_0xd3f951,'request\x20sent',JSON[_0x334f('0xe')](_0x19bd06));if(_0x19bd06['error']){if(_0x19bd06[_0x334f('0xf')][_0x334f('0x10')]===0x1f4){logger[_0x334f('0xf')](_0x334f('0x11'),_0xd3f951,_0x19bd06[_0x334f('0xf')]['message']);return _0x3f7418(_0x19bd06[_0x334f('0xf')][_0x334f('0x12')]);}logger[_0x334f('0xf')](_0x334f('0x11'),_0xd3f951,_0x19bd06[_0x334f('0xf')][_0x334f('0x12')]);return _0x4fd33f(_0x19bd06[_0x334f('0xf')][_0x334f('0x12')]);}else{logger[_0x334f('0xb')](_0x334f('0x11'),_0xd3f951,_0x334f('0xc'));_0x4fd33f(_0x19bd06[_0x334f('0x13')][_0x334f('0x12')]);}})[_0x334f('0x14')](function(_0x188e71){logger[_0x334f('0xf')](_0x334f('0x11'),_0xd3f951,_0x188e71);_0x3f7418(_0x188e71);});});}exports[_0x334f('0x15')]=function(_0x4d8b12){var _0x42ce02=this;return new Promise(function(_0x529090,_0x2b7013){return db[_0x334f('0x16')][_0x334f('0x17')](_0x4d8b12[_0x334f('0x18')],{'raw':_0x4d8b12[_0x334f('0x19')]?_0x4d8b12[_0x334f('0x19')][_0x334f('0x1a')]===undefined?!![]:![]:!![]})[_0x334f('0xa')](function(_0x2a5da8){logger[_0x334f('0xb')](_0x334f('0x15'),_0x4d8b12);logger[_0x334f('0x1b')](_0x334f('0x15'),_0x4d8b12,JSON[_0x334f('0xe')](_0x2a5da8));_0x529090(_0x2a5da8);})[_0x334f('0x14')](function(_0x3486de){logger[_0x334f('0xf')]('CreateReportAgentPreview',_0x3486de[_0x334f('0x12')],_0x4d8b12);_0x2b7013(_0x42ce02[_0x334f('0xf')](0x1f4,_0x3486de[_0x334f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a3e9abc..bc7bc73 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 _0x13fb=['isAuthenticated','voiceChannelMixMonitor','get','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','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/queues/:id','showChatQueues','/fax/queues/:id/notify','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','Router','./rpc.controller','/voice/channels','/voice/channels/:uniqueid/mixmonitor'];(function(_0x1778a8,_0x471207){var _0x59a0fb=function(_0x58146a){while(--_0x58146a){_0x1778a8['push'](_0x1778a8['shift']());}};_0x59a0fb(++_0x471207);}(_0x13fb,0xa0));var _0xb13f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x13fb[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xb13f('0x0'));var util=require(_0xb13f('0x1'));var path=require('path');var express=require('express');var router=express[_0xb13f('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0xb13f('0x3'));router['get'](_0xb13f('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xb13f('0x5'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x7')]);router[_0xb13f('0x8')](_0xb13f('0x9'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xa')]);router['get'](_0xb13f('0xb'),auth[_0xb13f('0x6')](),controller['voiceQueues']);router[_0xb13f('0x8')](_0xb13f('0xc'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xd')]);router[_0xb13f('0x8')](_0xb13f('0xe'),auth[_0xb13f('0x6')](),controller[_0xb13f('0xf')]);router[_0xb13f('0x8')](_0xb13f('0x10'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x11')]);router[_0xb13f('0x8')](_0xb13f('0x12'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x13')]);router['get'](_0xb13f('0x14'),auth[_0xb13f('0x6')](),controller['smsQueues']);router[_0xb13f('0x8')](_0xb13f('0x15'),auth[_0xb13f('0x6')](),controller['whatsappQueues']);router['get'](_0xb13f('0x16'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x17')]);router[_0xb13f('0x8')](_0xb13f('0x18'),auth['isAuthenticated'](),controller[_0xb13f('0x19')]);router[_0xb13f('0x8')](_0xb13f('0x1a'),auth['isAuthenticated'](),controller[_0xb13f('0x1b')]);router[_0xb13f('0x8')](_0xb13f('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xb13f('0x8')](_0xb13f('0x1d'),auth[_0xb13f('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0xb13f('0x1e'),auth['isAuthenticated'](),controller[_0xb13f('0x1f')]);router[_0xb13f('0x8')](_0xb13f('0x20'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0xb13f('0x21')]('/voice/queues/:id',auth[_0xb13f('0x6')](),controller[_0xb13f('0x22')]);router[_0xb13f('0x8')](_0xb13f('0x23'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x24')]);router[_0xb13f('0x8')](_0xb13f('0x25'),auth[_0xb13f('0x6')](),controller['outboundChannels']);router[_0xb13f('0x8')](_0xb13f('0x26'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x27')]);router[_0xb13f('0x21')](_0xb13f('0x28'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x29')]);router[_0xb13f('0x8')](_0xb13f('0x2a'),auth['isAuthenticated'](),controller['telephones']);router['get'](_0xb13f('0x2b'),auth[_0xb13f('0x6')](),controller['trunks']);router[_0xb13f('0x8')](_0xb13f('0x2c'),auth[_0xb13f('0x6')](),controller['campaigns']);router['get'](_0xb13f('0x2d'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x2e')]);router[_0xb13f('0x8')]('/chat/queues/waitinginteractions',auth[_0xb13f('0x6')](),controller[_0xb13f('0x2f')]);router[_0xb13f('0x8')](_0xb13f('0x30'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x31')]);router[_0xb13f('0x8')](_0xb13f('0x32'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x33')]);router[_0xb13f('0x8')](_0xb13f('0x34'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x35')]);router[_0xb13f('0x8')](_0xb13f('0x36'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x37')]);router['get'](_0xb13f('0x38'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x39')]);router[_0xb13f('0x8')](_0xb13f('0x3a'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3b')]);router[_0xb13f('0x3c')](_0xb13f('0x3d'),auth['isAuthenticated'](),controller[_0xb13f('0x3e')](_0xb13f('0x3f')));router[_0xb13f('0x8')](_0xb13f('0x40'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x41')]);router[_0xb13f('0x3c')](_0xb13f('0x42'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')]('chat'));router[_0xb13f('0x8')](_0xb13f('0x43'),auth['isAuthenticated'](),controller[_0xb13f('0x44')]);router[_0xb13f('0x3c')](_0xb13f('0x45'),auth['isAuthenticated'](),controller[_0xb13f('0x3e')]('fax'));router['get']('/fax/queues/:id',auth[_0xb13f('0x6')](),controller[_0xb13f('0x46')]);router[_0xb13f('0x3c')](_0xb13f('0x47'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')](_0xb13f('0x48')));router[_0xb13f('0x8')](_0xb13f('0x49'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x4a')]);router[_0xb13f('0x3c')](_0xb13f('0x4b'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')](_0xb13f('0x4c')));router[_0xb13f('0x3c')](_0xb13f('0x4d'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x3e')]('whatsapp'));router[_0xb13f('0x8')](_0xb13f('0x4e'),auth[_0xb13f('0x6')](),controller['showSmsQueues']);router[_0xb13f('0x8')](_0xb13f('0x4f'),auth['isAuthenticated'](),controller[_0xb13f('0x50')]);router[_0xb13f('0x3c')](_0xb13f('0x51'),auth[_0xb13f('0x6')](),controller[_0xb13f('0x52')]);module['exports']=router; \ No newline at end of file +var _0x49fe=['/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','Router','../../components/auth/service','get','/voice/channels','isAuthenticated','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x49fe,0x82));var _0xe49f=function(_0x4f8126,_0x2eacbd){_0x4f8126=_0x4f8126-0x0;var _0x3dccf8=_0x49fe[_0x4f8126];return _0x3dccf8;};'use strict';var multer=require(_0xe49f('0x0'));var util=require(_0xe49f('0x1'));var path=require(_0xe49f('0x2'));var express=require('express');var router=express[_0xe49f('0x3')]();var auth=require(_0xe49f('0x4'));var controller=require('./rpc.controller');router[_0xe49f('0x5')](_0xe49f('0x6'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0xe49f('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xe49f('0x7')](),controller['voiceChannelMixMonitor']);router[_0xe49f('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0xe49f('0x8')]);router['get'](_0xe49f('0x9'),auth[_0xe49f('0x7')](),controller[_0xe49f('0xa')]);router[_0xe49f('0x5')]('/chat/queues',auth[_0xe49f('0x7')](),controller[_0xe49f('0xb')]);router['get'](_0xe49f('0xc'),auth[_0xe49f('0x7')](),controller[_0xe49f('0xd')]);router[_0xe49f('0x5')](_0xe49f('0xe'),auth[_0xe49f('0x7')](),controller[_0xe49f('0xf')]);router[_0xe49f('0x5')](_0xe49f('0x10'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x11')]);router['get'](_0xe49f('0x12'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x13')]);router[_0xe49f('0x5')](_0xe49f('0x14'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x15')]);router[_0xe49f('0x5')]('/fax/queues',auth[_0xe49f('0x7')](),controller[_0xe49f('0x16')]);router[_0xe49f('0x5')](_0xe49f('0x17'),auth['isAuthenticated'](),controller[_0xe49f('0x18')]);router[_0xe49f('0x5')]('/voice/queues/channels',auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get'](_0xe49f('0x19'),auth[_0xe49f('0x7')](),controller['voiceQueuesChannel']);router['get'](_0xe49f('0x1a'),auth['isAuthenticated'](),controller[_0xe49f('0x1b')]);router[_0xe49f('0x5')](_0xe49f('0x1c'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x1d')]);router[_0xe49f('0x5')](_0xe49f('0x1e'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x1f')]);router[_0xe49f('0x20')](_0xe49f('0x1e'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x21')]);router[_0xe49f('0x5')](_0xe49f('0x22'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x23')]);router[_0xe49f('0x5')](_0xe49f('0x24'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x25')]);router['get'](_0xe49f('0x26'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x27')]);router['put']('/agents/:id/capacity',auth['isAuthenticated'](),controller[_0xe49f('0x28')]);router[_0xe49f('0x5')](_0xe49f('0x29'),auth[_0xe49f('0x7')](),controller['telephones']);router[_0xe49f('0x5')](_0xe49f('0x2a'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x2b')]);router[_0xe49f('0x5')](_0xe49f('0x2c'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x2d')]);router[_0xe49f('0x5')](_0xe49f('0x2e'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x2f')]);router['get'](_0xe49f('0x30'),auth[_0xe49f('0x7')](),controller['chatQueuesWaitingInteractions']);router[_0xe49f('0x5')](_0xe49f('0x31'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xe49f('0x5')](_0xe49f('0x32'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x33')]);router[_0xe49f('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0xe49f('0x7')](),controller[_0xe49f('0x34')]);router[_0xe49f('0x5')](_0xe49f('0x35'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x36')]);router[_0xe49f('0x5')](_0xe49f('0x37'),auth[_0xe49f('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0xe49f('0x5')](_0xe49f('0x38'),auth['isAuthenticated'](),controller[_0xe49f('0x39')]);router[_0xe49f('0x3a')](_0xe49f('0x3b'),auth['isAuthenticated'](),controller[_0xe49f('0x3c')](_0xe49f('0x3d')));router[_0xe49f('0x5')]('/mail/queues/:id',auth[_0xe49f('0x7')](),controller[_0xe49f('0x3e')]);router[_0xe49f('0x3a')](_0xe49f('0x3f'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x3c')](_0xe49f('0x40')));router[_0xe49f('0x5')](_0xe49f('0x41'),auth['isAuthenticated'](),controller[_0xe49f('0x42')]);router[_0xe49f('0x3a')]('/fax/queues/:id/notify',auth[_0xe49f('0x7')](),controller['queueNotify'](_0xe49f('0x43')));router[_0xe49f('0x5')](_0xe49f('0x44'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x45')]);router[_0xe49f('0x3a')](_0xe49f('0x46'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x3c')](_0xe49f('0x47')));router[_0xe49f('0x5')](_0xe49f('0x48'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0xe49f('0x3a')](_0xe49f('0x49'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x3c')](_0xe49f('0x4a')));router[_0xe49f('0x3a')](_0xe49f('0x4b'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x3c')](_0xe49f('0x4c')));router[_0xe49f('0x5')]('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xe49f('0x4d')]);router['get'](_0xe49f('0x4e'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x4f')]);router[_0xe49f('0x3a')](_0xe49f('0x50'),auth[_0xe49f('0x7')](),controller[_0xe49f('0x51')]);module[_0xe49f('0x52')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 2f39b25..03cdb8e 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 _0x038b=['\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','TransferReport','create','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','update','Start','agentTransferTimeout','moment','lodash','util','../../config/logger','jayson/promise','client','http','request','error','message','result','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','then','voiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','agentCapacity','interaction','user','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne'];(function(_0x58fc97,_0x2a5958){var _0x929e2=function(_0x270ba0){while(--_0x270ba0){_0x58fc97['push'](_0x58fc97['shift']());}};_0x929e2(++_0x2a5958);}(_0x038b,0x114));var _0xb038=function(_0x1d5122,_0x495639){_0x1d5122=_0x1d5122-0x0;var _0x245c74=_0x038b[_0x1d5122];return _0x245c74;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb038('0x0'));var _=require(_0xb038('0x1'));var util=require(_0xb038('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xb038('0x3'))('api');var jayson=require(_0xb038('0x4'));var amiClient=jayson[_0xb038('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0xb038('0x5')][_0xb038('0x6')]({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2e3e64,_0x1b077a,_0x1534a9){return new BPromise(function(_0x4b4085,_0x48a4d7){var _0x462e8f=_0x1534a9?_0x1534a9:amiClient;return _0x462e8f[_0xb038('0x7')](_0x2e3e64,_0x1b077a)['then'](function(_0x53bcc0){if(_0x53bcc0[_0xb038('0x8')]){if(_0x53bcc0[_0xb038('0x8')]['code']===0x1f4){return _0x48a4d7(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}return _0x4b4085(_0x53bcc0[_0xb038('0x8')][_0xb038('0x9')]);}else{_0x4b4085(_0x53bcc0[_0xb038('0xa')]);}})[_0xb038('0xb')](function(_0x1e6474){_0x48a4d7(_0x1e6474);});});}function respondWithResult(_0x439751,_0x16e4a3){_0x16e4a3=_0x16e4a3||0xc8;return function(_0x57acd8){if(_0x57acd8){return _0x439751[_0xb038('0xc')](_0x16e4a3)[_0xb038('0xd')](_0x57acd8);}return _0x439751[_0xb038('0xe')](0x194);};}function handleError(_0x3cc717,_0x3a71a6){_0x3a71a6=_0x3a71a6||0x1f4;return function(_0x13acc7){logger[_0xb038('0x8')](_0x13acc7['stack']);if(_0x13acc7[_0xb038('0xf')]){delete _0x13acc7[_0xb038('0xf')];}_0x3cc717[_0xb038('0xc')](_0x3a71a6)[_0xb038('0x10')](_0x13acc7);};}function findById(_0xdef213){return function(_0x2b4173){if(!_['isNil'](_0xdef213)&&!_[_0xb038('0x11')](_0x2b4173)&&!_[_0xb038('0x11')](_0x2b4173[_0xb038('0x12')])){return _[_0xb038('0x13')](_0x2b4173['rows'],function(_0x49b237){return _0x49b237['id']==_0xdef213;});}return null;};}exports[_0xb038('0x14')]=function(_0x3f48e6,_0x3e06ef){return respondWithRpcPromise(_0xb038('0x15'),_0x3f48e6['query'])[_0xb038('0x16')](respondWithResult(_0x3e06ef,null))[_0xb038('0xb')](handleError(_0x3e06ef,null));};exports[_0xb038('0x17')]=function(_0x33a377,_0xc6cd61){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0xb038('0x18')](_0x33a377[_0xb038('0x19')],_0x33a377[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0xc6cd61,null))['catch'](handleError(_0xc6cd61,null));};exports[_0xb038('0x1b')]=function(_0x1b7505,_0x4bbf38){return respondWithRpcPromise(_0xb038('0x1c'),_[_0xb038('0x18')](_0x1b7505['query'],_0x1b7505[_0xb038('0x1a')]))['then'](respondWithResult(_0x4bbf38,null))[_0xb038('0xb')](handleError(_0x4bbf38,null));};exports[_0xb038('0x1d')]=function(_0x27ff21,_0x1df7c4){return respondWithRpcPromise(_0xb038('0x1e'),_0x27ff21[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1df7c4,null))['catch'](handleError(_0x1df7c4,null));};exports[_0xb038('0x1f')]=function(_0x33cf3c,_0x226631){return respondWithRpcPromise('VoiceQueues',_0x33cf3c[_0xb038('0x19')])[_0xb038('0x16')](findById(_0x33cf3c[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x226631,null))[_0xb038('0xb')](handleError(_0x226631,null));};exports[_0xb038('0x20')]=function(_0x28a6a9,_0x12b3b6){return respondWithRpcPromise(_0xb038('0x21'),_['merge'](_0x28a6a9[_0xb038('0x22')],_0x28a6a9[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x12b3b6,null))[_0xb038('0xb')](handleError(_0x12b3b6,null));};exports[_0xb038('0x23')]=function(_0xbc8958,_0x29a0d7){return respondWithRpcPromise(_0xb038('0x24'),_[_0xb038('0x18')](_0xbc8958[_0xb038('0x19')],_0xbc8958[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x29a0d7,null))[_0xb038('0xb')](handleError(_0x29a0d7,null));};exports['voiceQueuesChannels']=function(_0x1d807a,_0x598554){return respondWithRpcPromise(_0xb038('0x25'),_0x1d807a[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x598554,null))[_0xb038('0xb')](handleError(_0x598554,null));};exports[_0xb038('0x26')]=function(_0x424b81,_0x3a393d){return respondWithRpcPromise(_0xb038('0x27'),_[_0xb038('0x18')](_0x424b81[_0xb038('0x19')],_0x424b81['params']))[_0xb038('0x16')](respondWithResult(_0x3a393d,null))[_0xb038('0xb')](handleError(_0x3a393d,null));};exports[_0xb038('0x28')]=function(_0x560342,_0x51e649){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xb038('0x18')](_0x560342[_0xb038('0x19')],_0x560342[_0xb038('0x1a')]))[_0xb038('0x16')](respondWithResult(_0x51e649,null))[_0xb038('0xb')](handleError(_0x51e649,null));};exports[_0xb038('0x29')]=function(_0x48f777,_0x16abea){return respondWithRpcPromise(_0xb038('0x2a'),_[_0xb038('0x18')](_0x48f777[_0xb038('0x19')],_0x48f777['params']))[_0xb038('0x16')](respondWithResult(_0x16abea,null))[_0xb038('0xb')](handleError(_0x16abea,null));};exports['outbound']=function(_0x5cb40c,_0x26c769){return respondWithRpcPromise(_0xb038('0x2b'),_0x5cb40c[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x26c769,null))[_0xb038('0xb')](handleError(_0x26c769,null));};exports['outboundChannels']=function(_0x404f82,_0x125d2a){return respondWithRpcPromise(_0xb038('0x2c'),_0x404f82[_0xb038('0x19')])['then'](respondWithResult(_0x125d2a,null))[_0xb038('0xb')](handleError(_0x125d2a,null));};exports[_0xb038('0x2d')]=function(_0x7d2f79,_0x573426){var _0x412d71;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')])[_0xb038('0x16')](function(_0x3ac1db){_0x412d71=_0x3ac1db;return respondWithRpcPromise('Agents',_0x7d2f79[_0xb038('0x19')],routingClient);})[_0xb038('0x16')](function(_0x4e0533){return _['merge']({},_0x4e0533,_0x412d71);})[_0xb038('0x16')](respondWithResult(_0x573426,null))[_0xb038('0xb')](handleError(_0x573426,null));};exports[_0xb038('0x2e')]=function(_0x3c291e,_0x5ad462){if(_0x3c291e[_0xb038('0x22')]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]&&_0x3c291e[_0xb038('0x30')]&&_0x3c291e['user'][_0xb038('0xf')]){for(var _0x269c7d in _0x3c291e['body'][_0xb038('0x2f')]){if(_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')]['hasOwnProperty'](_0x269c7d)){db[_0xb038('0x31')][_0xb038('0x32')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e['user']['name'],'type':_0xb038('0x33'),'exitAt':null,'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]&&_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0xb038('0x34')]?{'$notIn':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d]}:{'$ne':null}}})['then'](function(_0x5f0d9d){var _0x5e8383=moment()[_0xb038('0x35')](_0xb038('0x36'));for(var _0x52f0b8=0x0,_0x46a724=_0x5f0d9d[_0xb038('0x34')];_0x52f0b8<_0x46a724;_0x52f0b8+=0x1){_0x5f0d9d[_0x52f0b8][_0xb038('0x37')]({'exitAt':_0x5e8383});}});for(var _0x5f24cd=0x0;_0x5f24cd<_0x3c291e[_0xb038('0x22')]['interaction'][_0x269c7d]['length'];_0x5f24cd+=0x1){db[_0xb038('0x31')][_0xb038('0x38')]({'where':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'type':_0xb038('0x33'),'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd],'exitAt':null},'defaults':{'channel':_0x269c7d,'membername':_0x3c291e[_0xb038('0x30')][_0xb038('0xf')],'interface':_[_0xb038('0x11')](_0x3c291e['user'][_0xb038('0x39')])?util[_0xb038('0x35')]('SIP/%s',_0x3c291e[_0xb038('0x30')][_0xb038('0xf')]):_0x3c291e['user'][_0xb038('0x39')],'type':_0xb038('0x33'),'enterAt':moment()[_0xb038('0x35')](_0xb038('0x36')),'role':_0xb038('0x3a'),'internal':_0x3c291e[_0xb038('0x30')][_0xb038('0x3b')],'uniqueid':_0x3c291e[_0xb038('0x22')][_0xb038('0x2f')][_0x269c7d][_0x5f24cd]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3c291e[_0xb038('0x1a')]['id'],'capacity':_0x3c291e[_0xb038('0x22')][_0xb038('0x3c')]},routingClient)[_0xb038('0x16')](respondWithResult(_0x5ad462,null))[_0xb038('0xb')](handleError(_0x5ad462,null));};exports[_0xb038('0x3d')]=function(_0x591077,_0x1f4997){return respondWithRpcPromise(_0xb038('0x3e'),_0x591077[_0xb038('0x19')])[_0xb038('0x16')](respondWithResult(_0x1f4997,null))[_0xb038('0xb')](handleError(_0x1f4997,null));};exports[_0xb038('0x3f')]=function(_0xd7a862,_0x5b82f4){return respondWithRpcPromise(_0xb038('0x40'),_0xd7a862['query'])[_0xb038('0x16')](respondWithResult(_0x5b82f4,null))[_0xb038('0xb')](handleError(_0x5b82f4,null));};exports[_0xb038('0x41')]=function(_0x998fe3,_0x1518c4){return respondWithRpcPromise('Campaigns',_0x998fe3['query'])['then'](respondWithResult(_0x1518c4,null))[_0xb038('0xb')](handleError(_0x1518c4,null));};exports[_0xb038('0x42')]=function(_0x276fac,_0x218368){return respondWithRpcPromise(_0xb038('0x43'),_0x276fac[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x218368,null))[_0xb038('0xb')](handleError(_0x218368,null));};exports[_0xb038('0x44')]=function(_0x5b2cbb,_0x5b27d3){return respondWithRpcPromise(_0xb038('0x43'),_0x5b2cbb['query'],routingClient)[_0xb038('0x16')](findById(_0x5b2cbb['params']['id']))[_0xb038('0x16')](respondWithResult(_0x5b27d3,null))[_0xb038('0xb')](handleError(_0x5b27d3,null));};exports[_0xb038('0x45')]=function(_0x4300e9,_0x4ee38b){return respondWithRpcPromise(_0xb038('0x46'),_0x4300e9[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4ee38b,null))[_0xb038('0xb')](handleError(_0x4ee38b,null));};exports[_0xb038('0x47')]=function(_0x1246c8,_0x14a553){return respondWithRpcPromise(_0xb038('0x46'),_0x1246c8[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x1246c8[_0xb038('0x1a')]['id']))[_0xb038('0x16')](respondWithResult(_0x14a553,null))['catch'](handleError(_0x14a553,null));};exports[_0xb038('0x48')]=function(_0x2fc38d,_0x438e7e){return respondWithRpcPromise(_0xb038('0x49'),_0x2fc38d[_0xb038('0x19')],mailClient)['then'](respondWithResult(_0x438e7e,null))[_0xb038('0xb')](handleError(_0x438e7e,null));};exports['openchannelQueues']=function(_0xfb3ce6,_0x170a7e){return respondWithRpcPromise('OpenchannelQueues',_0xfb3ce6[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x170a7e,null))[_0xb038('0xb')](handleError(_0x170a7e,null));};exports[_0xb038('0x4a')]=function(_0x120cc7,_0x2f01c0){return respondWithRpcPromise(_0xb038('0x4b'),_0x120cc7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x120cc7[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2f01c0,null))[_0xb038('0xb')](handleError(_0x2f01c0,null));};exports['smsQueues']=function(_0x189894,_0x37e445){return respondWithRpcPromise(_0xb038('0x4c'),_0x189894[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x37e445,null))[_0xb038('0xb')](handleError(_0x37e445,null));};exports[_0xb038('0x4d')]=function(_0x4c23b2,_0x572ad4){return respondWithRpcPromise(_0xb038('0x4c'),_0x4c23b2[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4c23b2['params']['id']))['then'](respondWithResult(_0x572ad4,null))[_0xb038('0xb')](handleError(_0x572ad4,null));};exports['whatsappQueues']=function(_0x35da9e,_0x50e078){return respondWithRpcPromise(_0xb038('0x4e'),_0x35da9e['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x50e078,null))[_0xb038('0xb')](handleError(_0x50e078,null));};exports[_0xb038('0x4f')]=function(_0x112d77,_0x2c57b9){return respondWithRpcPromise(_0xb038('0x4e'),_0x112d77['query'],routingClient)['then'](findById(_0x112d77[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x2c57b9,null))[_0xb038('0xb')](handleError(_0x2c57b9,null));};exports[_0xb038('0x50')]=function(_0x2f4650,_0x538690){return respondWithRpcPromise(_0xb038('0x51'),_0x2f4650['query'],routingClient)[_0xb038('0x16')](respondWithResult(_0x538690,null))[_0xb038('0xb')](handleError(_0x538690,null));};exports[_0xb038('0x52')]=function(_0x4a417a,_0x40abb7){return respondWithRpcPromise(_0xb038('0x51'),_0x4a417a[_0xb038('0x19')],routingClient)[_0xb038('0x16')](findById(_0x4a417a[_0xb038('0x1a')]['id']))['then'](respondWithResult(_0x40abb7,null))['catch'](handleError(_0x40abb7,null));};exports['faxAccounts']=function(_0x609caf,_0x4efa0f){return respondWithRpcPromise(_0xb038('0x53'),_0x609caf['query'])[_0xb038('0x16')](respondWithResult(_0x4efa0f,null))[_0xb038('0xb')](handleError(_0x4efa0f,null));};exports[_0xb038('0x54')]=function(_0x1294d7,_0x7c8d01){return respondWithRpcPromise(_0xb038('0x55'),_0x1294d7[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x7c8d01,null))[_0xb038('0xb')](handleError(_0x7c8d01,null));};exports[_0xb038('0x56')]=function(_0x1db407,_0x1a5cf6){return respondWithRpcPromise(_0xb038('0x57'),_0x1db407[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1a5cf6,null))[_0xb038('0xb')](handleError(_0x1a5cf6,null));};exports[_0xb038('0x58')]=function(_0x123e31,_0x1f9a30){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x123e31[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x1f9a30,null))[_0xb038('0xb')](handleError(_0x1f9a30,null));};exports[_0xb038('0x59')]=function(_0xdaacfe,_0x5ead21){return respondWithRpcPromise(_0xb038('0x5a'),_0xdaacfe[_0xb038('0x19')],routingClient)[_0xb038('0x16')](function(_0x80d720){if(_0xdaacfe[_0xb038('0x19')][_0xb038('0x5b')]!==undefined){var _0x2acbf6=_(_0x80d720[_0xb038('0x12')])[_0xb038('0x5c')]([_0xdaacfe['query']['type'],_0xdaacfe[_0xb038('0x1a')]['id']])['map'](_0xb038('0x5d'))['uniq']()['value']();return _0x80d720['rows'][_0xb038('0x5c')](function(_0x463ae6){return _0x2acbf6['indexOf'](_0x463ae6[_0xb038('0x5d')])>-0x1;});}else{return _0x80d720[_0xb038('0x12')][_0xb038('0x5c')](function(_0x31ccf7){return _0x31ccf7[_0xb038('0x5d')]===parseInt(_0xdaacfe[_0xb038('0x1a')]['id']);});}})[_0xb038('0x16')](respondWithResult(_0x5ead21,null))[_0xb038('0xb')](handleError(_0x5ead21,null));};exports[_0xb038('0x5e')]=function(_0xde487d,_0x4b15b7){return respondWithRpcPromise(_0xb038('0x5f'),_0xde487d[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x4b15b7,null))[_0xb038('0xb')](handleError(_0x4b15b7,null));};exports[_0xb038('0x60')]=function(_0x222e90,_0x425854){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x222e90[_0xb038('0x19')],routingClient)[_0xb038('0x16')](respondWithResult(_0x425854,null))[_0xb038('0xb')](handleError(_0x425854,null));};exports['faxQueuesWaitingInteractions']=function(_0x551fcc,_0x2adf3b){return respondWithRpcPromise(_0xb038('0x61'),_0x551fcc[_0xb038('0x19')],routingClient)['then'](respondWithResult(_0x2adf3b,null))[_0xb038('0xb')](handleError(_0x2adf3b,null));};exports[_0xb038('0x62')]=function(_0x5b003a){return function(_0x2e6db4,_0x1d5640){var _0x240d06,_0x2a41c8;var _0x24f810=_[_0xb038('0x63')](_0x5b003a);var _0x1ea747=_0x5b003a===_0xb038('0x64')?_0xb038('0x65'):_0xb038('0x66');return db[_0x24f810+_0xb038('0x67')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x2e6db4[_0xb038('0x1a')]['id']}})[_0xb038('0x16')](function(_0x5d1410){if(_[_0xb038('0x11')](_0x5d1410)){throw new Error(_0x24f810+_0xb038('0x69'));}_0x240d06=_0x5d1410;return db[_0x24f810+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x2e6db4[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x24f810+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x24f810+_0x1ea747],'as':'Account'}]});})[_0xb038('0x16')](function(_0x3e01ce){if(_['isNil'](_0x3e01ce)){throw new Error(_0x24f810+_0xb038('0x6d'));}_0x2a41c8=_0x3e01ce;return _0x3e01ce['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x38a4d3={'uniqueid':_0x5b003a+'.'+_0x2a41c8['id']+'.'+_0x2a41c8['Interaction']['id'],'FromUserId':_0x2e6db4[_0xb038('0x30')]['id'],'type':'queue'};_0x38a4d3[_0x24f810+_0xb038('0x6e')]=_0x2a41c8['id'];_0x38a4d3[_0x24f810+_0xb038('0x6f')]=_0x2a41c8[_0xb038('0x6c')]['id'];_0x38a4d3[_0xb038('0x70')+_0x24f810+_0x1ea747+'Id']=_0x2a41c8[_0xb038('0x66')]['id'];_0x38a4d3['To'+_0x24f810+_0xb038('0x71')]=_0x240d06['id'];return db[_0x24f810+_0xb038('0x72')][_0xb038('0x73')](_0x38a4d3);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x5b003a,'interaction':_0x2a41c8[_0xb038('0x6c')],'message':_0x2a41c8,'account':_0x2a41c8[_0xb038('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x74'),'appdata':_0x240d06[_0xb038('0xf')]+','+(_0x2a41c8['Account'][_0xb038('0x75')]||0x12c),'interval':_0xb038('0x76')}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x1d5640,null))[_0xb038('0xb')](handleError(_0x1d5640,null));};};exports[_0xb038('0x77')]=function(_0x139ffa,_0x208cdd){var _0x2ee9bd,_0x32ee35;if(_[_0xb038('0x11')](_0x139ffa['body']['channel'])){throw new Error(_0xb038('0x78'));}var _0xb7f025=_0x139ffa[_0xb038('0x22')][_0xb038('0x79')];var _0x3ee569=_[_0xb038('0x63')](_0xb7f025);var _0x3e129d=_0xb7f025==='chat'?_0xb038('0x65'):_0xb038('0x66');return db[_0xb038('0x7a')][_0xb038('0x68')]({'raw':!![],'where':{'id':_0x139ffa[_0xb038('0x1a')]['id'],'role':_0xb038('0x3a')}})['then'](function(_0x451fe5){if(_[_0xb038('0x11')](_0x451fe5)){throw new Error(_0xb038('0x7b'));}_0x2ee9bd=_0x451fe5;return db[_0x3ee569+_0xb038('0x6a')][_0xb038('0x68')]({'where':{'id':_0x139ffa[_0xb038('0x22')][_0xb038('0x6b')]},'include':[{'model':db[_0x3ee569+_0xb038('0x6c')],'as':_0xb038('0x6c')},{'model':db[_0x3ee569+_0x3e129d],'as':_0xb038('0x66')}]});})[_0xb038('0x16')](function(_0x22e0bd){if(_[_0xb038('0x11')](_0x22e0bd)){throw new Error(_0x3ee569+_0xb038('0x6d'));}_0x32ee35=_0x22e0bd;return _0x22e0bd[_0xb038('0x7c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb038('0x16')](function(){var _0x5448e3={'uniqueid':_0xb7f025+'.'+_0x32ee35['id']+'.'+_0x32ee35['Interaction']['id'],'FromUserId':_0x139ffa[_0xb038('0x30')]['id'],'type':_0xb038('0x74'),'ToUserId':_0x2ee9bd['id']};_0x5448e3[_0x3ee569+_0xb038('0x6e')]=_0x32ee35['id'];_0x5448e3[_0x3ee569+'InteractionId']=_0x32ee35[_0xb038('0x6c')]['id'];_0x5448e3[_0xb038('0x70')+_0x3ee569+_0x3e129d+'Id']=_0x32ee35[_0xb038('0x66')]['id'];return db[_0x3ee569+_0xb038('0x72')]['create'](_0x5448e3);})['then'](function(){return respondWithRpcPromise(_0xb038('0x7d'),{'channel':_0xb7f025,'interaction':_0x32ee35[_0xb038('0x6c')],'message':_0x32ee35,'account':_0x32ee35['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xb038('0x3a'),'appdata':_0x2ee9bd[_0xb038('0xf')]+','+(_0x32ee35[_0xb038('0x66')][_0xb038('0x7e')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb038('0x16')](respondWithResult(_0x208cdd,null))[_0xb038('0xb')](handleError(_0x208cdd,null));}; \ No newline at end of file +var _0x46ed=['send','isNil','rows','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','OutboundChannels','agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','uniq','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','User','\x20Message\x20not\x20found','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','error','code','message','result','status','name'];(function(_0x20ded7,_0xa6dc9b){var _0xefc96f=function(_0x5b3130){while(--_0x5b3130){_0x20ded7['push'](_0x20ded7['shift']());}};_0xefc96f(++_0xa6dc9b);}(_0x46ed,0x168));var _0xd46e=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x46ed[_0x5d6456];return _0x4d66c1;};'use strict';var BPromise=require(_0xd46e('0x0'));var moment=require(_0xd46e('0x1'));var _=require('lodash');var util=require(_0xd46e('0x2'));var db=require(_0xd46e('0x3'))['db'];var logger=require(_0xd46e('0x4'))('api');var jayson=require(_0xd46e('0x5'));var amiClient=jayson[_0xd46e('0x6')]['http']({'port':0x232a});var mailClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232b});var routingClient=jayson[_0xd46e('0x6')][_0xd46e('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x45e680,_0x855f24,_0x437ea0){return new BPromise(function(_0x144687,_0x31259b){var _0x19e4f4=_0x437ea0?_0x437ea0:amiClient;return _0x19e4f4[_0xd46e('0x8')](_0x45e680,_0x855f24)['then'](function(_0x7b2d69){if(_0x7b2d69[_0xd46e('0x9')]){if(_0x7b2d69['error'][_0xd46e('0xa')]===0x1f4){return _0x31259b(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}return _0x144687(_0x7b2d69[_0xd46e('0x9')][_0xd46e('0xb')]);}else{_0x144687(_0x7b2d69[_0xd46e('0xc')]);}})['catch'](function(_0x24c54b){_0x31259b(_0x24c54b);});});}function respondWithResult(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xc8;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0xd')](_0x48550b)['json'](_0xf3048c);}return _0x5bc1da['sendStatus'](0x194);};}function handleError(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0x1f4;return function(_0x1e9aae){logger[_0xd46e('0x9')](_0x1e9aae['stack']);if(_0x1e9aae[_0xd46e('0xe')]){delete _0x1e9aae[_0xd46e('0xe')];}_0xacd799[_0xd46e('0xd')](_0x4688ae)[_0xd46e('0xf')](_0x1e9aae);};}function findById(_0x36a317){return function(_0x47fa8f){if(!_[_0xd46e('0x10')](_0x36a317)&&!_[_0xd46e('0x10')](_0x47fa8f)&&!_[_0xd46e('0x10')](_0x47fa8f['rows'])){return _['find'](_0x47fa8f[_0xd46e('0x11')],function(_0x1bd574){return _0x1bd574['id']==_0x36a317;});}return null;};}exports['voiceChannels']=function(_0x4fd1f2,_0x2d6f2c){return respondWithRpcPromise(_0xd46e('0x12'),_0x4fd1f2[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x2d6f2c,null))[_0xd46e('0x15')](handleError(_0x2d6f2c,null));};exports[_0xd46e('0x16')]=function(_0x3b5fa4,_0x327b7e){return respondWithRpcPromise(_0xd46e('0x17'),_[_0xd46e('0x18')](_0x3b5fa4[_0xd46e('0x13')],_0x3b5fa4['params']))[_0xd46e('0x14')](respondWithResult(_0x327b7e,null))[_0xd46e('0x15')](handleError(_0x327b7e,null));};exports[_0xd46e('0x19')]=function(_0x45ce0b,_0x128246){return respondWithRpcPromise(_0xd46e('0x1a'),_[_0xd46e('0x18')](_0x45ce0b[_0xd46e('0x13')],_0x45ce0b[_0xd46e('0x1b')]))['then'](respondWithResult(_0x128246,null))[_0xd46e('0x15')](handleError(_0x128246,null));};exports['voiceQueues']=function(_0x4b8f6a,_0x371054){return respondWithRpcPromise(_0xd46e('0x1c'),_0x4b8f6a[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x371054,null))[_0xd46e('0x15')](handleError(_0x371054,null));};exports[_0xd46e('0x1d')]=function(_0x1740d1,_0x4dab6a){return respondWithRpcPromise(_0xd46e('0x1c'),_0x1740d1[_0xd46e('0x13')])[_0xd46e('0x14')](findById(_0x1740d1[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4dab6a,null))[_0xd46e('0x15')](handleError(_0x4dab6a,null));};exports['updateVoiceQueue']=function(_0x465d54,_0x3a1ced){return respondWithRpcPromise(_0xd46e('0x1e'),_[_0xd46e('0x18')](_0x465d54[_0xd46e('0x1f')],_0x465d54[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x3a1ced,null))[_0xd46e('0x15')](handleError(_0x3a1ced,null));};exports[_0xd46e('0x20')]=function(_0x45ea47,_0x2ff785){return respondWithRpcPromise(_0xd46e('0x21'),_[_0xd46e('0x18')](_0x45ea47['query'],_0x45ea47[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x2ff785,null))[_0xd46e('0x15')](handleError(_0x2ff785,null));};exports[_0xd46e('0x22')]=function(_0x5ef248,_0x2eed3a){return respondWithRpcPromise(_0xd46e('0x23'),_0x5ef248['query'])[_0xd46e('0x14')](respondWithResult(_0x2eed3a,null))[_0xd46e('0x15')](handleError(_0x2eed3a,null));};exports['voiceQueuesChannel']=function(_0x306458,_0x1c15c9){return respondWithRpcPromise(_0xd46e('0x24'),_['merge'](_0x306458['query'],_0x306458[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x1c15c9,null))[_0xd46e('0x15')](handleError(_0x1c15c9,null));};exports[_0xd46e('0x25')]=function(_0x83526a,_0x423de9){return respondWithRpcPromise(_0xd46e('0x26'),_[_0xd46e('0x18')](_0x83526a['query'],_0x83526a[_0xd46e('0x1b')]))[_0xd46e('0x14')](respondWithResult(_0x423de9,null))[_0xd46e('0x15')](handleError(_0x423de9,null));};exports[_0xd46e('0x27')]=function(_0x1fa66c,_0x1e0897){return respondWithRpcPromise(_0xd46e('0x28'),_['merge'](_0x1fa66c[_0xd46e('0x13')],_0x1fa66c[_0xd46e('0x1b')]))['then'](respondWithResult(_0x1e0897,null))[_0xd46e('0x15')](handleError(_0x1e0897,null));};exports[_0xd46e('0x29')]=function(_0x12ccf8,_0x3b6e67){return respondWithRpcPromise('Outbound',_0x12ccf8[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x3b6e67,null))[_0xd46e('0x15')](handleError(_0x3b6e67,null));};exports[_0xd46e('0x2a')]=function(_0xefe5f4,_0x1f58ad){return respondWithRpcPromise(_0xd46e('0x2b'),_0xefe5f4[_0xd46e('0x13')])['then'](respondWithResult(_0x1f58ad,null))[_0xd46e('0x15')](handleError(_0x1f58ad,null));};exports[_0xd46e('0x2c')]=function(_0xc83ea1,_0x25657a){var _0x165ce8;return respondWithRpcPromise('Agents',_0xc83ea1[_0xd46e('0x13')])['then'](function(_0x55230d){_0x165ce8=_0x55230d;return respondWithRpcPromise('Agents',_0xc83ea1['query'],routingClient);})[_0xd46e('0x14')](function(_0x54949f){return _[_0xd46e('0x18')]({},_0x54949f,_0x165ce8);})[_0xd46e('0x14')](respondWithResult(_0x25657a,null))['catch'](handleError(_0x25657a,null));};exports[_0xd46e('0x2d')]=function(_0x4114e6,_0x3bd5e9){if(_0x4114e6[_0xd46e('0x1f')]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')]&&_0x4114e6[_0xd46e('0x2f')]&&_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]){for(var _0xec367d in _0x4114e6[_0xd46e('0x1f')]['interaction']){if(_0x4114e6['body']['interaction'][_0xd46e('0x30')](_0xec367d)){db['MemberReport'][_0xd46e('0x31')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':_0xd46e('0x32'),'exitAt':null,'uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]&&_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d]['length']?{'$notIn':_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d]}:{'$ne':null}}})[_0xd46e('0x14')](function(_0x196e51){var _0x41a983=moment()[_0xd46e('0x33')](_0xd46e('0x34'));for(var _0x5d65ca=0x0,_0x384b6e=_0x196e51[_0xd46e('0x35')];_0x5d65ca<_0x384b6e;_0x5d65ca+=0x1){_0x196e51[_0x5d65ca][_0xd46e('0x36')]({'exitAt':_0x41a983});}});for(var _0xac268d=0x0;_0xac268d<_0x4114e6[_0xd46e('0x1f')]['interaction'][_0xec367d][_0xd46e('0x35')];_0xac268d+=0x1){db[_0xd46e('0x37')][_0xd46e('0x38')]({'where':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'type':'INTERACTION','uniqueid':_0x4114e6[_0xd46e('0x1f')][_0xd46e('0x2e')][_0xec367d][_0xac268d],'exitAt':null},'defaults':{'channel':_0xec367d,'membername':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')],'interface':_[_0xd46e('0x10')](_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')])?util[_0xd46e('0x33')]('SIP/%s',_0x4114e6[_0xd46e('0x2f')][_0xd46e('0xe')]):_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x39')],'type':_0xd46e('0x32'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xd46e('0x3a'),'internal':_0x4114e6[_0xd46e('0x2f')][_0xd46e('0x3b')],'uniqueid':_0x4114e6['body']['interaction'][_0xec367d][_0xac268d]}});}}}}return respondWithRpcPromise(_0xd46e('0x3c'),{'id':_0x4114e6[_0xd46e('0x1b')]['id'],'capacity':_0x4114e6['body'][_0xd46e('0x3d')]},routingClient)[_0xd46e('0x14')](respondWithResult(_0x3bd5e9,null))[_0xd46e('0x15')](handleError(_0x3bd5e9,null));};exports[_0xd46e('0x3e')]=function(_0x1bd8a5,_0x34d4ca){return respondWithRpcPromise(_0xd46e('0x3f'),_0x1bd8a5[_0xd46e('0x13')])['then'](respondWithResult(_0x34d4ca,null))[_0xd46e('0x15')](handleError(_0x34d4ca,null));};exports[_0xd46e('0x40')]=function(_0x1c7f92,_0x63ee74){return respondWithRpcPromise('Trunks',_0x1c7f92['query'])[_0xd46e('0x14')](respondWithResult(_0x63ee74,null))['catch'](handleError(_0x63ee74,null));};exports[_0xd46e('0x41')]=function(_0x2af20b,_0x393cb9){return respondWithRpcPromise(_0xd46e('0x42'),_0x2af20b[_0xd46e('0x13')])[_0xd46e('0x14')](respondWithResult(_0x393cb9,null))['catch'](handleError(_0x393cb9,null));};exports[_0xd46e('0x43')]=function(_0x354739,_0x51f45a){return respondWithRpcPromise('ChatQueues',_0x354739[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x51f45a,null))[_0xd46e('0x15')](handleError(_0x51f45a,null));};exports[_0xd46e('0x44')]=function(_0x1886e6,_0x2cc676){return respondWithRpcPromise(_0xd46e('0x45'),_0x1886e6[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x1886e6[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x2cc676,null))[_0xd46e('0x15')](handleError(_0x2cc676,null));};exports[_0xd46e('0x46')]=function(_0x402df2,_0x47a86c){return respondWithRpcPromise(_0xd46e('0x47'),_0x402df2[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x47a86c,null))[_0xd46e('0x15')](handleError(_0x47a86c,null));};exports['showMailQueues']=function(_0x636f15,_0x36e18a){return respondWithRpcPromise(_0xd46e('0x47'),_0x636f15[_0xd46e('0x13')],routingClient)['then'](findById(_0x636f15[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x36e18a,null))['catch'](handleError(_0x36e18a,null));};exports['mailAccounts']=function(_0x45e102,_0xd59920){return respondWithRpcPromise(_0xd46e('0x48'),_0x45e102['query'],mailClient)['then'](respondWithResult(_0xd59920,null))[_0xd46e('0x15')](handleError(_0xd59920,null));};exports[_0xd46e('0x49')]=function(_0x1f310d,_0x263425){return respondWithRpcPromise(_0xd46e('0x4a'),_0x1f310d[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x263425,null))[_0xd46e('0x15')](handleError(_0x263425,null));};exports[_0xd46e('0x4b')]=function(_0x2a172c,_0x4af44){return respondWithRpcPromise(_0xd46e('0x4a'),_0x2a172c[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2a172c[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x4af44,null))['catch'](handleError(_0x4af44,null));};exports[_0xd46e('0x4c')]=function(_0x1a3771,_0x3a2dec){return respondWithRpcPromise('SmsQueues',_0x1a3771[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x3a2dec,null))['catch'](handleError(_0x3a2dec,null));};exports[_0xd46e('0x4d')]=function(_0x2c86fe,_0x1801d4){return respondWithRpcPromise('SmsQueues',_0x2c86fe[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2c86fe[_0xd46e('0x1b')]['id']))['then'](respondWithResult(_0x1801d4,null))[_0xd46e('0x15')](handleError(_0x1801d4,null));};exports['whatsappQueues']=function(_0x32eed0,_0x148187){return respondWithRpcPromise(_0xd46e('0x4e'),_0x32eed0['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x148187,null))[_0xd46e('0x15')](handleError(_0x148187,null));};exports[_0xd46e('0x4f')]=function(_0xbce76f,_0x502f37){return respondWithRpcPromise(_0xd46e('0x4e'),_0xbce76f[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0xbce76f[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x502f37,null))[_0xd46e('0x15')](handleError(_0x502f37,null));};exports[_0xd46e('0x50')]=function(_0x41057c,_0x24be84){return respondWithRpcPromise('FaxQueues',_0x41057c['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x24be84,null))[_0xd46e('0x15')](handleError(_0x24be84,null));};exports[_0xd46e('0x51')]=function(_0x2fff69,_0x249938){return respondWithRpcPromise('FaxQueues',_0x2fff69[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](findById(_0x2fff69[_0xd46e('0x1b')]['id']))[_0xd46e('0x14')](respondWithResult(_0x249938,null))['catch'](handleError(_0x249938,null));};exports[_0xd46e('0x52')]=function(_0x9dd439,_0x5a36df){return respondWithRpcPromise(_0xd46e('0x53'),_0x9dd439[_0xd46e('0x13')])['then'](respondWithResult(_0x5a36df,null))[_0xd46e('0x15')](handleError(_0x5a36df,null));};exports[_0xd46e('0x54')]=function(_0x566e65,_0x44ba36){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x566e65[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x44ba36,null))['catch'](handleError(_0x44ba36,null));};exports['mailQueuesWaitingInteractions']=function(_0x475133,_0x3eb6b){return respondWithRpcPromise(_0xd46e('0x55'),_0x475133[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x3eb6b,null))[_0xd46e('0x15')](handleError(_0x3eb6b,null));};exports[_0xd46e('0x56')]=function(_0x510a1e,_0x10bcdb){return respondWithRpcPromise(_0xd46e('0x57'),_0x510a1e[_0xd46e('0x13')],routingClient)[_0xd46e('0x14')](respondWithResult(_0x10bcdb,null))[_0xd46e('0x15')](handleError(_0x10bcdb,null));};exports[_0xd46e('0x58')]=function(_0x21f193,_0xaf7c79){return respondWithRpcPromise(_0xd46e('0x57'),_0x21f193['query'],routingClient)[_0xd46e('0x14')](function(_0x1c1bae){if(_0x21f193['query'][_0xd46e('0x59')]!==undefined){var _0x3ba83f=_(_0x1c1bae[_0xd46e('0x11')])[_0xd46e('0x5a')]([_0x21f193[_0xd46e('0x13')][_0xd46e('0x59')],_0x21f193['params']['id']])['map'](_0xd46e('0x5b'))[_0xd46e('0x5c')]()['value']();return _0x1c1bae['rows']['filter'](function(_0x825746){return _0x3ba83f[_0xd46e('0x5d')](_0x825746[_0xd46e('0x5b')])>-0x1;});}else{return _0x1c1bae['rows'][_0xd46e('0x5a')](function(_0x69ade9){return _0x69ade9[_0xd46e('0x5b')]===parseInt(_0x21f193['params']['id']);});}})['then'](respondWithResult(_0xaf7c79,null))['catch'](handleError(_0xaf7c79,null));};exports['smsQueuesWaitingInteractions']=function(_0x2d4410,_0x5d7c51){return respondWithRpcPromise(_0xd46e('0x5e'),_0x2d4410['query'],routingClient)['then'](respondWithResult(_0x5d7c51,null))[_0xd46e('0x15')](handleError(_0x5d7c51,null));};exports[_0xd46e('0x5f')]=function(_0x3df2c2,_0x2754ff){return respondWithRpcPromise(_0xd46e('0x60'),_0x3df2c2[_0xd46e('0x13')],routingClient)['then'](respondWithResult(_0x2754ff,null))['catch'](handleError(_0x2754ff,null));};exports[_0xd46e('0x61')]=function(_0x383919,_0x114f2c){return respondWithRpcPromise(_0xd46e('0x62'),_0x383919['query'],routingClient)[_0xd46e('0x14')](respondWithResult(_0x114f2c,null))[_0xd46e('0x15')](handleError(_0x114f2c,null));};exports['queueNotify']=function(_0x1309b5){return function(_0x483ef1,_0x2abaee){var _0x24a2e1,_0x5b54b6;var _0x59fb83=_[_0xd46e('0x63')](_0x1309b5);var _0x2c11b8=_0x1309b5===_0xd46e('0x64')?'Website':_0xd46e('0x65');return db[_0x59fb83+_0xd46e('0x66')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x483ef1[_0xd46e('0x1b')]['id']}})[_0xd46e('0x14')](function(_0x88460a){if(_[_0xd46e('0x10')](_0x88460a)){throw new Error(_0x59fb83+_0xd46e('0x68'));}_0x24a2e1=_0x88460a;return db[_0x59fb83+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x483ef1[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x59fb83+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x59fb83+_0x2c11b8],'as':_0xd46e('0x65')}]});})[_0xd46e('0x14')](function(_0x441f73){if(_[_0xd46e('0x10')](_0x441f73)){throw new Error(_0x59fb83+'\x20Message\x20not\x20found');}_0x5b54b6=_0x441f73;return _0x441f73[_0xd46e('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3436ff={'uniqueid':_0x1309b5+'.'+_0x5b54b6['id']+'.'+_0x5b54b6[_0xd46e('0x6b')]['id'],'FromUserId':_0x483ef1['user']['id'],'type':_0xd46e('0x6d')};_0x3436ff[_0x59fb83+_0xd46e('0x6e')]=_0x5b54b6['id'];_0x3436ff[_0x59fb83+_0xd46e('0x6f')]=_0x5b54b6[_0xd46e('0x6b')]['id'];_0x3436ff[_0xd46e('0x70')+_0x59fb83+_0x2c11b8+'Id']=_0x5b54b6[_0xd46e('0x65')]['id'];_0x3436ff['To'+_0x59fb83+_0xd46e('0x71')]=_0x24a2e1['id'];return db[_0x59fb83+_0xd46e('0x72')][_0xd46e('0x73')](_0x3436ff);})[_0xd46e('0x14')](function(){return respondWithRpcPromise(_0xd46e('0x74'),{'channel':_0x1309b5,'interaction':_0x5b54b6['Interaction'],'message':_0x5b54b6,'account':_0x5b54b6['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xd46e('0x6d'),'appdata':_0x24a2e1[_0xd46e('0xe')]+','+(_0x5b54b6[_0xd46e('0x65')][_0xd46e('0x75')]||0x12c),'interval':_0xd46e('0x76')}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0x2abaee,null))['catch'](handleError(_0x2abaee,null));};};exports[_0xd46e('0x77')]=function(_0x127604,_0xa254f5){var _0x2c9703,_0x41443d;if(_[_0xd46e('0x10')](_0x127604['body'][_0xd46e('0x78')])){throw new Error(_0xd46e('0x79'));}var _0x59067a=_0x127604[_0xd46e('0x1f')][_0xd46e('0x78')];var _0x9e222d=_[_0xd46e('0x63')](_0x59067a);var _0x97ee80=_0x59067a===_0xd46e('0x64')?_0xd46e('0x7a'):_0xd46e('0x65');return db[_0xd46e('0x7b')][_0xd46e('0x67')]({'raw':!![],'where':{'id':_0x127604[_0xd46e('0x1b')]['id'],'role':_0xd46e('0x3a')}})[_0xd46e('0x14')](function(_0x30dcfc){if(_['isNil'](_0x30dcfc)){throw new Error('Agent\x20not\x20found');}_0x2c9703=_0x30dcfc;return db[_0x9e222d+_0xd46e('0x69')][_0xd46e('0x67')]({'where':{'id':_0x127604[_0xd46e('0x1f')][_0xd46e('0x6a')]},'include':[{'model':db[_0x9e222d+_0xd46e('0x6b')],'as':_0xd46e('0x6b')},{'model':db[_0x9e222d+_0x97ee80],'as':'Account'}]});})[_0xd46e('0x14')](function(_0x216143){if(_[_0xd46e('0x10')](_0x216143)){throw new Error(_0x9e222d+_0xd46e('0x7c'));}_0x41443d=_0x216143;return _0x216143['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xd46e('0x14')](function(){var _0x191b48={'uniqueid':_0x59067a+'.'+_0x41443d['id']+'.'+_0x41443d['Interaction']['id'],'FromUserId':_0x127604[_0xd46e('0x2f')]['id'],'type':'queue','ToUserId':_0x2c9703['id']};_0x191b48[_0x9e222d+'MessageId']=_0x41443d['id'];_0x191b48[_0x9e222d+_0xd46e('0x6f')]=_0x41443d[_0xd46e('0x6b')]['id'];_0x191b48[_0xd46e('0x70')+_0x9e222d+_0x97ee80+'Id']=_0x41443d[_0xd46e('0x65')]['id'];return db[_0x9e222d+'TransferReport']['create'](_0x191b48);})[_0xd46e('0x14')](function(){return respondWithRpcPromise('Start',{'channel':_0x59067a,'interaction':_0x41443d[_0xd46e('0x6b')],'message':_0x41443d,'account':_0x41443d['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x2c9703[_0xd46e('0xe')]+','+(_0x41443d[_0xd46e('0x65')]['agentTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xd46e('0x14')](respondWithResult(_0xa254f5,null))[_0xd46e('0x15')](handleError(_0xa254f5,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1e36fd8..7839075 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 _0x33fc=['/:id','isAuthenticated','show','/:id/run','run','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','get'];(function(_0x469d87,_0x541092){var _0x49f6ac=function(_0x5a59ce){while(--_0x5a59ce){_0x469d87['push'](_0x469d87['shift']());}};_0x49f6ac(++_0x541092);}(_0x33fc,0x107));var _0xc33f=function(_0x409c75,_0x50c9aa){_0x409c75=_0x409c75-0x0;var _0x38a7f3=_0x33fc[_0x409c75];return _0x38a7f3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc33f('0x0'));var router=express[_0xc33f('0x1')]();var fs_extra=require(_0xc33f('0x2'));var auth=require(_0xc33f('0x3'));var interaction=require(_0xc33f('0x4'));var config=require(_0xc33f('0x5'));var controller=require(_0xc33f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc33f('0x7')]);router[_0xc33f('0x8')](_0xc33f('0x9'),auth[_0xc33f('0xa')](),controller[_0xc33f('0xb')]);router[_0xc33f('0x8')](_0xc33f('0xc'),auth[_0xc33f('0xa')](),controller[_0xc33f('0xd')]);router['post']('/',auth[_0xc33f('0xa')](),controller['create']);router['put'](_0xc33f('0x9'),auth['isAuthenticated'](),controller['update']);router[_0xc33f('0xe')](_0xc33f('0x9'),auth['isAuthenticated'](),controller[_0xc33f('0xf')]);module[_0xc33f('0x10')]=router; \ No newline at end of file +var _0x0fcf=['../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','run','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1163a0,_0xfed5f4){var _0x1af53e=function(_0x47b447){while(--_0x47b447){_0x1163a0['push'](_0x1163a0['shift']());}};_0x1af53e(++_0xfed5f4);}(_0x0fcf,0x139));var _0xf0fc=function(_0xd4db68,_0xc7901d){_0xd4db68=_0xd4db68-0x0;var _0xb153e4=_0x0fcf[_0xd4db68];return _0xb153e4;};'use strict';var multer=require('multer');var util=require(_0xf0fc('0x0'));var path=require(_0xf0fc('0x1'));var timeout=require(_0xf0fc('0x2'));var express=require(_0xf0fc('0x3'));var router=express[_0xf0fc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf0fc('0x5'));var interaction=require(_0xf0fc('0x6'));var config=require(_0xf0fc('0x7'));var controller=require(_0xf0fc('0x8'));router[_0xf0fc('0x9')]('/',auth[_0xf0fc('0xa')](),controller[_0xf0fc('0xb')]);router['get'](_0xf0fc('0xc'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0xd')]);router['get'](_0xf0fc('0xe'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0xf')]);router['post']('/',auth[_0xf0fc('0xa')](),controller['create']);router[_0xf0fc('0x10')](_0xf0fc('0xc'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0x11')]);router[_0xf0fc('0x12')](_0xf0fc('0xc'),auth[_0xf0fc('0xa')](),controller[_0xf0fc('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d064274..9b4cce6 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 _0xa934=['quarters','weeks','days','hours','minutes','csv','pdf','custom','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years'];(function(_0x51a6af,_0x219d20){var _0x190e2c=function(_0x1f391b){while(--_0x1f391b){_0x51a6af['push'](_0x51a6af['shift']());}};_0x190e2c(++_0x219d20);}(_0xa934,0xbe));var _0x4a93=function(_0x17f3b5,_0x511a3b){_0x17f3b5=_0x17f3b5-0x0;var _0x38f79c=_0xa934[_0x17f3b5];return _0x38f79c;};'use strict';var Sequelize=require(_0x4a93('0x0'));module['exports']={'name':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4a93('0x1')]},'active':{'type':Sequelize[_0x4a93('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4a93('0x1')],'allowNull':![],'defaultValue':_0x4a93('0x3')},'startAt':{'type':Sequelize[_0x4a93('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4a93('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4a93('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0x7'),_0x4a93('0x8'),'months',_0x4a93('0x9'),_0x4a93('0xa'),_0x4a93('0xb'),_0x4a93('0xc')),'allowNull':![],'defaultValue':_0x4a93('0xa')},'output':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0xd'),_0x4a93('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0x4a93('0xd')},'type':{'type':Sequelize[_0x4a93('0x6')](_0x4a93('0xf'),_0x4a93('0x10')),'allowNull':![],'defaultValue':_0x4a93('0xf')},'sendMail':{'type':Sequelize[_0x4a93('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4a93('0x1')]},'cc':{'type':Sequelize[_0x4a93('0x11')]},'bcc':{'type':Sequelize[_0x4a93('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x4a93('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x73ca=['sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','quarters','days','hours','minutes','ENUM','pdf','xlsx','csv','custom','default','TEXT'];(function(_0x503cd5,_0x57774a){var _0x1fdf1e=function(_0x5222cc){while(--_0x5222cc){_0x503cd5['push'](_0x503cd5['shift']());}};_0x1fdf1e(++_0x57774a);}(_0x73ca,0x1a9));var _0xa73c=function(_0x574261,_0x1d1e46){_0x574261=_0x574261-0x0;var _0x4ac8a2=_0x73ca[_0x574261];return _0x4ac8a2;};'use strict';var Sequelize=require(_0xa73c('0x0'));module[_0xa73c('0x1')]={'name':{'type':Sequelize[_0xa73c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa73c('0x2')]},'active':{'type':Sequelize[_0xa73c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa73c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xa73c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa73c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years',_0xa73c('0x6'),'months','weeks',_0xa73c('0x7'),_0xa73c('0x8'),_0xa73c('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xa73c('0xa')]('csv',_0xa73c('0xb'),_0xa73c('0xc')),'allowNull':![],'defaultValue':_0xa73c('0xd')},'type':{'type':Sequelize['ENUM'](_0xa73c('0xe'),_0xa73c('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xa73c('0x2')]},'cc':{'type':Sequelize[_0xa73c('0x10')]},'bcc':{'type':Sequelize[_0xa73c('0x10')]},'sendIfEmpty':{'type':Sequelize[_0xa73c('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0527238..0fdb1bc 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 _0x0e85=['eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','Schedule','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run'];(function(_0x5d6694,_0xf02a3a){var _0x5a20d0=function(_0x137bb1){while(--_0x137bb1){_0x5d6694['push'](_0x5d6694['shift']());}};_0x5a20d0(++_0xf02a3a);}(_0x0e85,0x1a9));var _0x50e8=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0e85[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x50e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x50e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x50e8('0x2'));var moment=require('moment');var BPromise=require(_0x50e8('0x3'));var Mustache=require(_0x50e8('0x4'));var util=require(_0x50e8('0x5'));var path=require(_0x50e8('0x6'));var sox=require(_0x50e8('0x7'));var csv=require('to-csv');var ejs=require(_0x50e8('0x8'));var fs=require('fs');var fs_extra=require(_0x50e8('0x9'));var _=require(_0x50e8('0xa'));var squel=require(_0x50e8('0xb'));var crypto=require(_0x50e8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x50e8('0xd'));var toCsv=require('to-csv');var querystring=require(_0x50e8('0xe'));var Papa=require(_0x50e8('0xf'));var Redis=require(_0x50e8('0x10'));var authService=require(_0x50e8('0x11'));var qs=require(_0x50e8('0x12'));var as=require(_0x50e8('0x13'));var hardwareService=require(_0x50e8('0x14'));var logger=require(_0x50e8('0x15'))(_0x50e8('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50e8('0x17'))['db'];function respondWithStatusCode(_0x41ddd1,_0x4334ee){_0x4334ee=_0x4334ee||0xcc;return function(_0x7ee4c9){if(_0x7ee4c9){return _0x41ddd1['sendStatus'](_0x4334ee);}return _0x41ddd1[_0x50e8('0x18')](_0x4334ee)['end']();};}function respondWithResult(_0x22096d,_0x5e3de6){_0x5e3de6=_0x5e3de6||0xc8;return function(_0x69c05b){if(_0x69c05b){return _0x22096d['status'](_0x5e3de6)[_0x50e8('0x19')](_0x69c05b);}};}function respondWithFilteredResult(_0x58cfcb,_0x1b97e6){return function(_0x34713e){if(_0x34713e){var _0x2cd902=typeof _0x1b97e6[_0x50e8('0x1a')]===_0x50e8('0x1b')&&typeof _0x1b97e6[_0x50e8('0x1c')]==='undefined';var _0x4b56fc=_0x34713e[_0x50e8('0x1d')];var _0x17c5ea=_0x2cd902?0x0:_0x1b97e6[_0x50e8('0x1a')];var _0x4cc498=_0x2cd902?_0x34713e['count']:_0x1b97e6['offset']+_0x1b97e6[_0x50e8('0x1c')];var _0x432507;if(_0x4cc498>=_0x4b56fc){_0x4cc498=_0x4b56fc;_0x432507=0xc8;}else{_0x432507=0xce;}_0x58cfcb[_0x50e8('0x18')](_0x432507);return _0x58cfcb[_0x50e8('0x1e')](_0x50e8('0x1f'),_0x17c5ea+'-'+_0x4cc498+'/'+_0x4b56fc)['json'](_0x34713e);}return null;};}function patchUpdates(_0x15f50e){return function(_0x33102a){try{jsonpatch[_0x50e8('0x20')](_0x33102a,_0x15f50e,!![]);}catch(_0x1bc715){return BPromise[_0x50e8('0x21')](_0x1bc715);}return _0x33102a['save']();};}function saveUpdates(_0x518612,_0x207d6d){return function(_0x3fa902){if(_0x3fa902){return _0x3fa902[_0x50e8('0x22')](_0x518612)[_0x50e8('0x23')](function(_0x4cceef){return _0x4cceef;});}return null;};}function removeEntity(_0xd5d659,_0x4a7d1f){return function(_0x4d5b4e){if(_0x4d5b4e){return _0x4d5b4e[_0x50e8('0x24')]()[_0x50e8('0x23')](function(){var _0x14b736=_0x4d5b4e[_0x50e8('0x25')]({'plain':!![]});var _0x477859='Scheduler';return db[_0x50e8('0x26')][_0x50e8('0x24')]({'where':{'type':_0x477859,'resourceId':_0x14b736['id']}})['then'](function(){return _0x4d5b4e;});})[_0x50e8('0x23')](function(){_0xd5d659['status'](0xcc)[_0x50e8('0x27')]();});}};}function handleEntityNotFound(_0x20a035,_0x12063b){return function(_0x378a61){if(!_0x378a61){_0x20a035[_0x50e8('0x28')](0x194);}return _0x378a61;};}function handleError(_0x358a50,_0x4da52b){_0x4da52b=_0x4da52b||0x1f4;return function(_0x33f50){logger[_0x50e8('0x29')](_0x33f50[_0x50e8('0x2a')]);if(_0x33f50[_0x50e8('0x2b')]){delete _0x33f50[_0x50e8('0x2b')];}_0x358a50[_0x50e8('0x18')](_0x4da52b)[_0x50e8('0x2c')](_0x33f50);};}exports[_0x50e8('0x2d')]=function(_0x5b3262,_0x1cc01f){var _0x4c8893={},_0x42e514={},_0x57c05b={'count':0x0,'rows':[]};var _0x4ac85e=_[_0x50e8('0x2e')](db[_0x50e8('0x2f')]['rawAttributes'],function(_0x11a54a){return{'name':_0x11a54a[_0x50e8('0x30')],'type':_0x11a54a['type'][_0x50e8('0x31')]};});_0x42e514[_0x50e8('0x32')]=_[_0x50e8('0x2e')](_0x4ac85e,'name');_0x42e514[_0x50e8('0x33')]=_[_0x50e8('0x34')](_0x5b3262['query']);_0x42e514['filters']=_[_0x50e8('0x35')](_0x42e514[_0x50e8('0x32')],_0x42e514['query']);_0x4c8893[_0x50e8('0x36')]=_[_0x50e8('0x35')](_0x42e514[_0x50e8('0x32')],qs['fields'](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x37')]));_0x4c8893[_0x50e8('0x36')]=_0x4c8893[_0x50e8('0x36')][_0x50e8('0x38')]?_0x4c8893[_0x50e8('0x36')]:_0x42e514[_0x50e8('0x32')];if(!_0x5b3262['query'][_0x50e8('0x39')](_0x50e8('0x3a'))){_0x4c8893[_0x50e8('0x1c')]=qs[_0x50e8('0x1c')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x1c')]);_0x4c8893[_0x50e8('0x1a')]=qs[_0x50e8('0x1a')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x1a')]);}_0x4c8893['order']=qs[_0x50e8('0x3b')](_0x5b3262[_0x50e8('0x33')][_0x50e8('0x3b')]);_0x4c8893['where']=qs[_0x50e8('0x3c')](_[_0x50e8('0x3d')](_0x5b3262[_0x50e8('0x33')],_0x42e514[_0x50e8('0x3c')]),_0x4ac85e);if(_0x5b3262[_0x50e8('0x33')]['filter']){_0x4c8893[_0x50e8('0x3e')]=_[_0x50e8('0x3f')](_0x4c8893[_0x50e8('0x3e')],{'$or':_[_0x50e8('0x2e')](_0x4ac85e,function(_0xf51e87){if(_0xf51e87['type']!==_0x50e8('0x40')){var _0x472cff={};_0x472cff[_0xf51e87['name']]={'$like':'%'+_0x5b3262[_0x50e8('0x33')][_0x50e8('0x41')]+'%'};return _0x472cff;}})});}_0x4c8893=_[_0x50e8('0x3f')]({},_0x4c8893,_0x5b3262[_0x50e8('0x42')]);var _0x16cd46={'where':_0x4c8893[_0x50e8('0x3e')]};return db['Schedule'][_0x50e8('0x1d')](_0x16cd46)[_0x50e8('0x23')](function(_0x3a660a){_0x57c05b['count']=_0x3a660a;if(_0x5b3262[_0x50e8('0x33')][_0x50e8('0x43')]){_0x4c8893[_0x50e8('0x44')]=[{'all':!![]}];}return db[_0x50e8('0x2f')][_0x50e8('0x45')](_0x4c8893);})[_0x50e8('0x23')](function(_0x3a3bd3){_0x57c05b['rows']=_0x3a3bd3;return _0x57c05b;})[_0x50e8('0x23')](respondWithFilteredResult(_0x1cc01f,_0x4c8893))['catch'](handleError(_0x1cc01f,null));};exports[_0x50e8('0x46')]=function(_0x2b56ea,_0x3c6398){var _0x18ec53={'raw':![],'where':{'id':_0x2b56ea['params']['id']}},_0x321562={};_0x321562[_0x50e8('0x32')]=_['keys'](db[_0x50e8('0x2f')][_0x50e8('0x47')]);_0x321562[_0x50e8('0x33')]=_['keys'](_0x2b56ea[_0x50e8('0x33')]);_0x321562[_0x50e8('0x3c')]=_['intersection'](_0x321562[_0x50e8('0x32')],_0x321562[_0x50e8('0x33')]);_0x18ec53['attributes']=_[_0x50e8('0x35')](_0x321562[_0x50e8('0x32')],qs['fields'](_0x2b56ea[_0x50e8('0x33')][_0x50e8('0x37')]));_0x18ec53[_0x50e8('0x36')]=_0x18ec53[_0x50e8('0x36')][_0x50e8('0x38')]?_0x18ec53[_0x50e8('0x36')]:_0x321562['model'];if(_0x2b56ea[_0x50e8('0x33')][_0x50e8('0x43')]){_0x18ec53[_0x50e8('0x44')]=[{'all':!![]}];}_0x18ec53=_[_0x50e8('0x3f')]({},_0x18ec53,_0x2b56ea[_0x50e8('0x42')]);return db[_0x50e8('0x2f')][_0x50e8('0x48')](_0x18ec53)['then'](handleEntityNotFound(_0x3c6398,null))[_0x50e8('0x23')](respondWithResult(_0x3c6398,null))[_0x50e8('0x49')](handleError(_0x3c6398,null));};exports[_0x50e8('0x4a')]=function(_0x156e68,_0x4e0de2){return db[_0x50e8('0x2f')][_0x50e8('0x4a')](_0x156e68[_0x50e8('0x4b')],{})[_0x50e8('0x23')](function(_0x565499){var _0x527f05=_0x156e68['user'][_0x50e8('0x25')]({'plain':!![]});if(!_0x527f05)throw new Error(_0x50e8('0x4c'));if(_0x527f05[_0x50e8('0x4d')]==='user'){var _0x806acd=_0x565499['get']({'plain':!![]});var _0x3ad557=_0x50e8('0x4e');return db[_0x50e8('0x4f')][_0x50e8('0x48')]({'where':{'name':_0x3ad557,'userProfileId':_0x527f05[_0x50e8('0x50')]},'raw':!![]})[_0x50e8('0x23')](function(_0x309dce){if(_0x309dce&&_0x309dce[_0x50e8('0x51')]===0x0){return db[_0x50e8('0x26')][_0x50e8('0x4a')]({'name':_0x806acd[_0x50e8('0x2b')],'resourceId':_0x806acd['id'],'type':_0x309dce[_0x50e8('0x2b')],'sectionId':_0x309dce['id']},{})[_0x50e8('0x23')](function(){return _0x565499;});}else{return _0x565499;}})[_0x50e8('0x49')](function(_0x433a5a){logger[_0x50e8('0x29')](_0x50e8('0x52'),_0x433a5a);throw _0x433a5a;});}return _0x565499;})[_0x50e8('0x23')](respondWithResult(_0x4e0de2,0xc9))[_0x50e8('0x49')](handleError(_0x4e0de2,null));};exports['update']=function(_0x594cd8,_0x34299f){if(_0x594cd8[_0x50e8('0x4b')]['id']){delete _0x594cd8[_0x50e8('0x4b')]['id'];}return db['Schedule']['find']({'where':{'id':_0x594cd8[_0x50e8('0x53')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x34299f,null))[_0x50e8('0x23')](saveUpdates(_0x594cd8['body'],null))[_0x50e8('0x23')](respondWithResult(_0x34299f,null))[_0x50e8('0x49')](handleError(_0x34299f,null));};exports['destroy']=function(_0x11b0fb,_0x5c7081){return db[_0x50e8('0x2f')]['find']({'where':{'id':_0x11b0fb[_0x50e8('0x53')]['id']}})[_0x50e8('0x23')](handleEntityNotFound(_0x5c7081,null))[_0x50e8('0x23')](removeEntity(_0x5c7081,null))[_0x50e8('0x49')](handleError(_0x5c7081,null));};exports[_0x50e8('0x54')]=function(_0x691e6d,_0x410c34,_0x40bcd2){var _0x2f2801=require('../../config/schedule');return db[_0x50e8('0x2f')][_0x50e8('0x48')]({'where':{'id':_0x691e6d[_0x50e8('0x53')]['id']},'raw':!![]})[_0x50e8('0x23')](handleEntityNotFound(_0x410c34,null))[_0x50e8('0x23')](function(){_0x2f2801['run'](_0x691e6d[_0x50e8('0x53')]['id']);})[_0x50e8('0x23')](respondWithStatusCode(_0x410c34,null))[_0x50e8('0x49')](handleError(_0x410c34,null));}; \ No newline at end of file +var _0x274a=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','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','set','Content-Range','json','apply','reject','save','update','then','destroy','Scheduler','end','error','stack','name','send','map','Schedule','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule'];(function(_0x228990,_0x542f9b){var _0x56a367=function(_0x42a930){while(--_0x42a930){_0x228990['push'](_0x228990['shift']());}};_0x56a367(++_0x542f9b);}(_0x274a,0x1b8));var _0xa274=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x274a[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0xa274('0x0'));var rimraf=require(_0xa274('0x1'));var zipdir=require(_0xa274('0x2'));var jsonpatch=require(_0xa274('0x3'));var rp=require(_0xa274('0x4'));var moment=require(_0xa274('0x5'));var BPromise=require(_0xa274('0x6'));var Mustache=require(_0xa274('0x7'));var util=require('util');var path=require(_0xa274('0x8'));var sox=require('sox');var csv=require(_0xa274('0x9'));var ejs=require(_0xa274('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa274('0xb'));var squel=require(_0xa274('0xc'));var crypto=require(_0xa274('0xd'));var jsforce=require(_0xa274('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa274('0x9'));var querystring=require(_0xa274('0xf'));var Papa=require('papaparse');var Redis=require(_0xa274('0x10'));var authService=require(_0xa274('0x11'));var qs=require(_0xa274('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa274('0x13'));var logger=require(_0xa274('0x14'))(_0xa274('0x15'));var utils=require(_0xa274('0x16'));var config=require(_0xa274('0x17'));var licenseUtil=require(_0xa274('0x18'));var db=require(_0xa274('0x19'))['db'];function respondWithStatusCode(_0x1d0fbe,_0x17252b){_0x17252b=_0x17252b||0xcc;return function(_0xb7d5d6){if(_0xb7d5d6){return _0x1d0fbe[_0xa274('0x1a')](_0x17252b);}return _0x1d0fbe[_0xa274('0x1b')](_0x17252b)['end']();};}function respondWithResult(_0x74f0c8,_0x116757){_0x116757=_0x116757||0xc8;return function(_0x2d4844){if(_0x2d4844){return _0x74f0c8[_0xa274('0x1b')](_0x116757)['json'](_0x2d4844);}};}function respondWithFilteredResult(_0x2196cc,_0x172c30){return function(_0x3f65a9){if(_0x3f65a9){var _0x38d239=typeof _0x172c30[_0xa274('0x1c')]===_0xa274('0x1d')&&typeof _0x172c30[_0xa274('0x1e')]===_0xa274('0x1d');var _0x3ff75b=_0x3f65a9['count'];var _0x3102d4=_0x38d239?0x0:_0x172c30['offset'];var _0x562f1d=_0x38d239?_0x3f65a9['count']:_0x172c30[_0xa274('0x1c')]+_0x172c30[_0xa274('0x1e')];var _0x1a3c0b;if(_0x562f1d>=_0x3ff75b){_0x562f1d=_0x3ff75b;_0x1a3c0b=0xc8;}else{_0x1a3c0b=0xce;}_0x2196cc['status'](_0x1a3c0b);return _0x2196cc[_0xa274('0x1f')](_0xa274('0x20'),_0x3102d4+'-'+_0x562f1d+'/'+_0x3ff75b)[_0xa274('0x21')](_0x3f65a9);}return null;};}function patchUpdates(_0x275a2d){return function(_0x32de3e){try{jsonpatch[_0xa274('0x22')](_0x32de3e,_0x275a2d,!![]);}catch(_0x44941a){return BPromise[_0xa274('0x23')](_0x44941a);}return _0x32de3e[_0xa274('0x24')]();};}function saveUpdates(_0x895d41,_0x48be69){return function(_0x3817e5){if(_0x3817e5){return _0x3817e5[_0xa274('0x25')](_0x895d41)[_0xa274('0x26')](function(_0x4e501b){return _0x4e501b;});}return null;};}function removeEntity(_0x573a11,_0x83f735){return function(_0xe7ce11){if(_0xe7ce11){return _0xe7ce11[_0xa274('0x27')]()[_0xa274('0x26')](function(){var _0x1a0236=_0xe7ce11['get']({'plain':!![]});var _0x5083c9=_0xa274('0x28');return db['UserProfileResource'][_0xa274('0x27')]({'where':{'type':_0x5083c9,'resourceId':_0x1a0236['id']}})[_0xa274('0x26')](function(){return _0xe7ce11;});})['then'](function(){_0x573a11[_0xa274('0x1b')](0xcc)[_0xa274('0x29')]();});}};}function handleEntityNotFound(_0x19dc3f,_0x540ede){return function(_0x3dc1ac){if(!_0x3dc1ac){_0x19dc3f['sendStatus'](0x194);}return _0x3dc1ac;};}function handleError(_0x5ab6f4,_0x2a0ac0){_0x2a0ac0=_0x2a0ac0||0x1f4;return function(_0x49deaa){logger[_0xa274('0x2a')](_0x49deaa[_0xa274('0x2b')]);if(_0x49deaa['name']){delete _0x49deaa[_0xa274('0x2c')];}_0x5ab6f4[_0xa274('0x1b')](_0x2a0ac0)[_0xa274('0x2d')](_0x49deaa);};}exports['index']=function(_0x373c7b,_0x3e5377){var _0x4b333c={},_0x23a653={},_0x45d164={'count':0x0,'rows':[]};var _0x9ed86a=_[_0xa274('0x2e')](db[_0xa274('0x2f')][_0xa274('0x30')],function(_0x14acf9){return{'name':_0x14acf9[_0xa274('0x31')],'type':_0x14acf9['type'][_0xa274('0x32')]};});_0x23a653['model']=_[_0xa274('0x2e')](_0x9ed86a,_0xa274('0x2c'));_0x23a653['query']=_['keys'](_0x373c7b[_0xa274('0x33')]);_0x23a653[_0xa274('0x34')]=_[_0xa274('0x35')](_0x23a653[_0xa274('0x36')],_0x23a653['query']);_0x4b333c[_0xa274('0x37')]=_[_0xa274('0x35')](_0x23a653['model'],qs['fields'](_0x373c7b[_0xa274('0x33')][_0xa274('0x38')]));_0x4b333c['attributes']=_0x4b333c[_0xa274('0x37')][_0xa274('0x39')]?_0x4b333c['attributes']:_0x23a653[_0xa274('0x36')];if(!_0x373c7b[_0xa274('0x33')][_0xa274('0x3a')]('nolimit')){_0x4b333c[_0xa274('0x1e')]=qs[_0xa274('0x1e')](_0x373c7b[_0xa274('0x33')][_0xa274('0x1e')]);_0x4b333c[_0xa274('0x1c')]=qs[_0xa274('0x1c')](_0x373c7b['query']['offset']);}_0x4b333c[_0xa274('0x3b')]=qs['sort'](_0x373c7b[_0xa274('0x33')][_0xa274('0x3c')]);_0x4b333c['where']=qs[_0xa274('0x34')](_[_0xa274('0x3d')](_0x373c7b[_0xa274('0x33')],_0x23a653[_0xa274('0x34')]),_0x9ed86a);if(_0x373c7b['query']['filter']){_0x4b333c[_0xa274('0x3e')]=_[_0xa274('0x3f')](_0x4b333c[_0xa274('0x3e')],{'$or':_[_0xa274('0x2e')](_0x9ed86a,function(_0xa2517a){if(_0xa2517a[_0xa274('0x40')]!==_0xa274('0x41')){var _0x205d14={};_0x205d14[_0xa2517a[_0xa274('0x2c')]]={'$like':'%'+_0x373c7b[_0xa274('0x33')][_0xa274('0x42')]+'%'};return _0x205d14;}})});}_0x4b333c=_[_0xa274('0x3f')]({},_0x4b333c,_0x373c7b[_0xa274('0x43')]);var _0x59e36b={'where':_0x4b333c[_0xa274('0x3e')]};return db[_0xa274('0x2f')][_0xa274('0x44')](_0x59e36b)['then'](function(_0x6b5e6d){_0x45d164[_0xa274('0x44')]=_0x6b5e6d;if(_0x373c7b[_0xa274('0x33')][_0xa274('0x45')]){_0x4b333c[_0xa274('0x46')]=[{'all':!![]}];}return db[_0xa274('0x2f')][_0xa274('0x47')](_0x4b333c);})['then'](function(_0x514ce3){_0x45d164[_0xa274('0x48')]=_0x514ce3;return _0x45d164;})[_0xa274('0x26')](respondWithFilteredResult(_0x3e5377,_0x4b333c))[_0xa274('0x49')](handleError(_0x3e5377,null));};exports[_0xa274('0x4a')]=function(_0x2e87f9,_0x2a218f){var _0x149bd3={'raw':![],'where':{'id':_0x2e87f9[_0xa274('0x4b')]['id']}},_0x502cf9={};_0x502cf9[_0xa274('0x36')]=_[_0xa274('0x4c')](db['Schedule'][_0xa274('0x30')]);_0x502cf9[_0xa274('0x33')]=_[_0xa274('0x4c')](_0x2e87f9[_0xa274('0x33')]);_0x502cf9[_0xa274('0x34')]=_[_0xa274('0x35')](_0x502cf9['model'],_0x502cf9['query']);_0x149bd3['attributes']=_['intersection'](_0x502cf9['model'],qs[_0xa274('0x38')](_0x2e87f9[_0xa274('0x33')][_0xa274('0x38')]));_0x149bd3[_0xa274('0x37')]=_0x149bd3[_0xa274('0x37')]['length']?_0x149bd3[_0xa274('0x37')]:_0x502cf9[_0xa274('0x36')];if(_0x2e87f9['query']['includeAll']){_0x149bd3[_0xa274('0x46')]=[{'all':!![]}];}_0x149bd3=_[_0xa274('0x3f')]({},_0x149bd3,_0x2e87f9[_0xa274('0x43')]);return db['Schedule'][_0xa274('0x4d')](_0x149bd3)['then'](handleEntityNotFound(_0x2a218f,null))[_0xa274('0x26')](respondWithResult(_0x2a218f,null))[_0xa274('0x49')](handleError(_0x2a218f,null));};exports[_0xa274('0x4e')]=function(_0x2cec1e,_0x1de5ef){return db[_0xa274('0x2f')]['create'](_0x2cec1e[_0xa274('0x4f')],{})[_0xa274('0x26')](function(_0x4263d5){var _0x2669b2=_0x2cec1e[_0xa274('0x50')][_0xa274('0x51')]({'plain':!![]});if(!_0x2669b2)throw new Error(_0xa274('0x52'));if(_0x2669b2['role']===_0xa274('0x50')){var _0x29a20d=_0x4263d5[_0xa274('0x51')]({'plain':!![]});var _0x5aeccd=_0xa274('0x28');return db[_0xa274('0x53')][_0xa274('0x4d')]({'where':{'name':_0x5aeccd,'userProfileId':_0x2669b2['userProfileId']},'raw':!![]})[_0xa274('0x26')](function(_0x3b3e53){if(_0x3b3e53&&_0x3b3e53[_0xa274('0x54')]===0x0){return db['UserProfileResource'][_0xa274('0x4e')]({'name':_0x29a20d[_0xa274('0x2c')],'resourceId':_0x29a20d['id'],'type':_0x3b3e53[_0xa274('0x2c')],'sectionId':_0x3b3e53['id']},{})[_0xa274('0x26')](function(){return _0x4263d5;});}else{return _0x4263d5;}})[_0xa274('0x49')](function(_0x2784ee){logger[_0xa274('0x2a')](_0xa274('0x55'),_0x2784ee);throw _0x2784ee;});}return _0x4263d5;})[_0xa274('0x26')](respondWithResult(_0x1de5ef,0xc9))[_0xa274('0x49')](handleError(_0x1de5ef,null));};exports[_0xa274('0x25')]=function(_0x58d272,_0x191628){if(_0x58d272[_0xa274('0x4f')]['id']){delete _0x58d272[_0xa274('0x4f')]['id'];}return db[_0xa274('0x2f')]['find']({'where':{'id':_0x58d272[_0xa274('0x4b')]['id']}})[_0xa274('0x26')](handleEntityNotFound(_0x191628,null))[_0xa274('0x26')](saveUpdates(_0x58d272[_0xa274('0x4f')],null))[_0xa274('0x26')](respondWithResult(_0x191628,null))['catch'](handleError(_0x191628,null));};exports[_0xa274('0x27')]=function(_0x1cac12,_0x158f35){return db[_0xa274('0x2f')]['find']({'where':{'id':_0x1cac12[_0xa274('0x4b')]['id']}})['then'](handleEntityNotFound(_0x158f35,null))[_0xa274('0x26')](removeEntity(_0x158f35,null))['catch'](handleError(_0x158f35,null));};exports[_0xa274('0x56')]=function(_0x69c6bf,_0xb0eb3e,_0x1dfc00){var _0x188404=require(_0xa274('0x57'));return db[_0xa274('0x2f')][_0xa274('0x4d')]({'where':{'id':_0x69c6bf[_0xa274('0x4b')]['id']},'raw':!![]})[_0xa274('0x26')](handleEntityNotFound(_0xb0eb3e,null))[_0xa274('0x26')](function(){_0x188404[_0xa274('0x56')](_0x69c6bf[_0xa274('0x4b')]['id']);})[_0xa274('0x26')](respondWithStatusCode(_0xb0eb3e,null))[_0xa274('0x49')](handleError(_0xb0eb3e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3e051dd..263d5d9 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 _0xb580=['bluebird','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','moment'];(function(_0x465abe,_0x584de5){var _0x5d9bcc=function(_0x103e6f){while(--_0x103e6f){_0x465abe['push'](_0x465abe['shift']());}};_0x5d9bcc(++_0x584de5);}(_0xb580,0x104));var _0x0b58=function(_0x2f44a3,_0x3fcbcc){_0x2f44a3=_0x2f44a3-0x0;var _0x3df76c=_0xb580[_0x2f44a3];return _0x3df76c;};'use strict';var _=require(_0x0b58('0x0'));var util=require(_0x0b58('0x1'));var logger=require(_0x0b58('0x2'))('api');var moment=require(_0x0b58('0x3'));var BPromise=require(_0x0b58('0x4'));var rp=require(_0x0b58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b58('0x6'));var config=require(_0x0b58('0x7'));var attributes=require(_0x0b58('0x8'));module[_0x0b58('0x9')]=function(_0x3a8d78,_0x108d55){return _0x3a8d78[_0x0b58('0xa')]('Schedule',attributes,{'tableName':_0x0b58('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f76=['exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./schedule.attributes'];(function(_0x3307de,_0x9f6699){var _0x3ccccc=function(_0x3705b0){while(--_0x3705b0){_0x3307de['push'](_0x3307de['shift']());}};_0x3ccccc(++_0x9f6699);}(_0x2f76,0x13b));var _0x62f7=function(_0x525526,_0x2b6b77){_0x525526=_0x525526-0x0;var _0x374cb5=_0x2f76[_0x525526];return _0x374cb5;};'use strict';var _=require(_0x62f7('0x0'));var util=require(_0x62f7('0x1'));var logger=require(_0x62f7('0x2'))(_0x62f7('0x3'));var moment=require(_0x62f7('0x4'));var BPromise=require(_0x62f7('0x5'));var rp=require(_0x62f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x62f7('0x7'));var config=require('../../config/environment');var attributes=require(_0x62f7('0x8'));module[_0x62f7('0x9')]=function(_0x5b8346,_0x38831e){return _0x5b8346[_0x62f7('0xa')]('Schedule',attributes,{'tableName':_0x62f7('0xb'),'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 2b5ef4d..f347343 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 _0xdf9c=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x176d6e,_0x5a2d05){var _0x650fe6=function(_0x2664b1){while(--_0x2664b1){_0x176d6e['push'](_0x176d6e['shift']());}};_0x650fe6(++_0x5a2d05);}(_0xdf9c,0xa4));var _0xcdf9=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdf9c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcdf9('0x0'));var util=require(_0xcdf9('0x1'));var moment=require(_0xcdf9('0x2'));var BPromise=require(_0xcdf9('0x3'));var rs=require(_0xcdf9('0x4'));var fs=require('fs');var Redis=require(_0xcdf9('0x5'));var db=require(_0xcdf9('0x6'))['db'];var utils=require(_0xcdf9('0x7'));var logger=require('../../config/logger')(_0xcdf9('0x8'));var config=require(_0xcdf9('0x9'));var jayson=require(_0xcdf9('0xa'));var client=jayson[_0xcdf9('0xb')][_0xcdf9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59b293,_0x171e27,_0x5cd62d){return new BPromise(function(_0xcb27af,_0x4d53d7){return client[_0xcdf9('0xd')](_0x59b293,_0x5cd62d)['then'](function(_0x4f0011){logger['info']('Schedule,\x20%s,\x20%s',_0x171e27,_0xcdf9('0xe'));logger[_0xcdf9('0xf')](_0xcdf9('0x10'),_0x171e27,_0xcdf9('0xe'),JSON[_0xcdf9('0x11')](_0x4f0011));if(_0x4f0011[_0xcdf9('0x12')]){if(_0x4f0011['error'][_0xcdf9('0x13')]===0x1f4){logger[_0xcdf9('0x12')](_0xcdf9('0x14'),_0x171e27,_0x4f0011[_0xcdf9('0x12')][_0xcdf9('0x15')]);return _0x4d53d7(_0x4f0011[_0xcdf9('0x12')][_0xcdf9('0x15')]);}logger['error'](_0xcdf9('0x14'),_0x171e27,_0x4f0011[_0xcdf9('0x12')]['message']);return _0xcb27af(_0x4f0011['error'][_0xcdf9('0x15')]);}else{logger[_0xcdf9('0x16')]('Schedule,\x20%s,\x20%s',_0x171e27,'request\x20sent');_0xcb27af(_0x4f0011[_0xcdf9('0x17')][_0xcdf9('0x15')]);}})['catch'](function(_0x4698e5){logger[_0xcdf9('0x12')](_0xcdf9('0x14'),_0x171e27,_0x4698e5);_0x4d53d7(_0x4698e5);});});} \ No newline at end of file +var _0x44f2=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','info','Schedule,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x271ca1,_0x12c26d){var _0x2c2f39=function(_0x24f09b){while(--_0x24f09b){_0x271ca1['push'](_0x271ca1['shift']());}};_0x2c2f39(++_0x12c26d);}(_0x44f2,0xd3));var _0x244f=function(_0x2f5302,_0x477d1a){_0x2f5302=_0x2f5302-0x0;var _0x142aad=_0x44f2[_0x2f5302];return _0x142aad;};'use strict';var _=require(_0x244f('0x0'));var util=require('util');var moment=require(_0x244f('0x1'));var BPromise=require(_0x244f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x244f('0x3'));var db=require(_0x244f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x244f('0x5'));var config=require(_0x244f('0x6'));var jayson=require(_0x244f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4f0b76,_0x50007e,_0xabda8){return new BPromise(function(_0x1dffa6,_0x5c7f3b){return client['request'](_0x4f0b76,_0xabda8)['then'](function(_0x3cb10b){logger[_0x244f('0x8')](_0x244f('0x9'),_0x50007e,_0x244f('0xa'));logger['debug']('Schedule,\x20%s,\x20%s,\x20%s',_0x50007e,_0x244f('0xa'),JSON['stringify'](_0x3cb10b));if(_0x3cb10b[_0x244f('0xb')]){if(_0x3cb10b[_0x244f('0xb')][_0x244f('0xc')]===0x1f4){logger[_0x244f('0xb')](_0x244f('0x9'),_0x50007e,_0x3cb10b[_0x244f('0xb')]['message']);return _0x5c7f3b(_0x3cb10b[_0x244f('0xb')]['message']);}logger[_0x244f('0xb')]('Schedule,\x20%s,\x20%s',_0x50007e,_0x3cb10b['error'][_0x244f('0xd')]);return _0x1dffa6(_0x3cb10b[_0x244f('0xb')][_0x244f('0xd')]);}else{logger['info'](_0x244f('0x9'),_0x50007e,_0x244f('0xa'));_0x1dffa6(_0x3cb10b[_0x244f('0xe')][_0x244f('0xd')]);}})[_0x244f('0xf')](function(_0x5240e7){logger[_0x244f('0xb')](_0x244f('0x9'),_0x50007e,_0x5240e7);_0x5c7f3b(_0x5240e7);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 3e3d3de..a0f6b7e 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 _0xd74b=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','download','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd74b,0x191));var _0xbd74=function(_0x3a311f,_0x3b317f){_0x3a311f=_0x3a311f-0x0;var _0x49aa74=_0xd74b[_0x3a311f];return _0x49aa74;};'use strict';var multer=require(_0xbd74('0x0'));var util=require(_0xbd74('0x1'));var path=require(_0xbd74('0x2'));var timeout=require(_0xbd74('0x3'));var express=require(_0xbd74('0x4'));var router=express[_0xbd74('0x5')]();var fs_extra=require(_0xbd74('0x6'));var auth=require(_0xbd74('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xbd74('0x8'));var controller=require('./screenRecording.controller');router[_0xbd74('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xbd74('0xa')](),controller[_0xbd74('0xb')]);router[_0xbd74('0x9')](_0xbd74('0xc'),auth['isAuthenticated'](),controller[_0xbd74('0xd')]);router[_0xbd74('0x9')](_0xbd74('0xe'),auth[_0xbd74('0xa')](),controller[_0xbd74('0xf')]);router['post']('/',auth[_0xbd74('0xa')](),controller[_0xbd74('0x10')]);router[_0xbd74('0x11')](_0xbd74('0xc'),auth[_0xbd74('0xa')](),controller[_0xbd74('0x12')]);router['delete'](_0xbd74('0xc'),auth[_0xbd74('0xa')](),controller[_0xbd74('0x13')]);module[_0xbd74('0x14')]=router; \ No newline at end of file +var _0x7439=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create'];(function(_0x1f1348,_0x439a1f){var _0x5b8025=function(_0x410b3a){while(--_0x410b3a){_0x1f1348['push'](_0x1f1348['shift']());}};_0x5b8025(++_0x439a1f);}(_0x7439,0x1a6));var _0x9743=function(_0x334165,_0x2f0d3f){_0x334165=_0x334165-0x0;var _0x131050=_0x7439[_0x334165];return _0x131050;};'use strict';var multer=require(_0x9743('0x0'));var util=require(_0x9743('0x1'));var path=require(_0x9743('0x2'));var timeout=require(_0x9743('0x3'));var express=require(_0x9743('0x4'));var router=express[_0x9743('0x5')]();var fs_extra=require(_0x9743('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9743('0x7'));router[_0x9743('0x8')]('/',auth[_0x9743('0x9')](),controller[_0x9743('0xa')]);router[_0x9743('0x8')]('/describe',auth[_0x9743('0x9')](),controller[_0x9743('0xb')]);router['get'](_0x9743('0xc'),auth['isAuthenticated'](),controller[_0x9743('0xd')]);router[_0x9743('0x8')](_0x9743('0xe'),auth['isAuthenticated'](),controller[_0x9743('0xf')]);router[_0x9743('0x10')]('/',auth['isAuthenticated'](),controller[_0x9743('0x11')]);router[_0x9743('0x12')]('/:id',auth[_0x9743('0x9')](),controller[_0x9743('0x13')]);router[_0x9743('0x14')]('/:id',auth[_0x9743('0x9')](),controller[_0x9743('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index e1c8d69..505b0ff 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 _0x457b=['replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','toString','format','createdAt','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING'];(function(_0x16154d,_0x12c711){var _0x36a45c=function(_0x2e34a8){while(--_0x2e34a8){_0x16154d['push'](_0x16154d['shift']());}};_0x36a45c(++_0x12c711);}(_0x457b,0xca));var _0xb457=function(_0xf8973d,_0x56a803){_0xf8973d=_0xf8973d-0x0;var _0x1c46bc=_0x457b[_0xf8973d];return _0x1c46bc;};'use strict';var Sequelize=require(_0xb457('0x0'));var moment=require(_0xb457('0x1'));var path=require('path');var config=require(_0xb457('0x2'));module[_0xb457('0x3')]={'format':{'type':Sequelize[_0xb457('0x4')],'get':function(){return this[_0xb457('0x5')](_0xb457('0x6'))?path['extname'](this[_0xb457('0x5')](_0xb457('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0xb457('0x7')]},'channel':{'type':Sequelize[_0xb457('0x7')]},'value':{'type':Sequelize[_0xb457('0x7')],'set':function(_0x523e05){var _0x5b8ba2=_0x523e05[_0xb457('0x8')](/\\/g,'/');this[_0xb457('0x9')]('value',_0x5b8ba2);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb457('0xa')],'set':function(_0x3baee8){this[_0xb457('0x9')](_0xb457('0xb'),moment()[_0xb457('0xc')](_0x3baee8,'ms'));this[_0xb457('0x9')](_0xb457('0xd'),moment());this[_0xb457('0x9')](_0xb457('0xe'),_0x3baee8);}},'startedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0xb')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb457('0x10')]();}},'closedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0xd')))[_0xb457('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0x12')))[_0xb457('0x11')]('MM-DD-YYYY\x20HH:mm')[_0xb457('0x10')]();}},'updatedAt':{'type':Sequelize[_0xb457('0xf')],'get':function(){return moment(this[_0xb457('0x5')](_0xb457('0x13')))[_0xb457('0x11')](_0xb457('0x14'))[_0xb457('0x10')]();}}}; \ No newline at end of file +var _0x7b84=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace'];(function(_0x1ce0b5,_0x2e4a21){var _0x3e31f2=function(_0x1f1f44){while(--_0x1f1f44){_0x1ce0b5['push'](_0x1ce0b5['shift']());}};_0x3e31f2(++_0x2e4a21);}(_0x7b84,0x17c));var _0x47b8=function(_0x447c73,_0x1dac58){_0x447c73=_0x447c73-0x0;var _0x5e0ac1=_0x7b84[_0x447c73];return _0x5e0ac1;};'use strict';var Sequelize=require(_0x47b8('0x0'));var moment=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var config=require(_0x47b8('0x3'));module[_0x47b8('0x4')]={'format':{'type':Sequelize[_0x47b8('0x5')],'get':function(){return this[_0x47b8('0x6')]('value')?path[_0x47b8('0x7')](this[_0x47b8('0x6')](_0x47b8('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x47b8('0x9')]},'channel':{'type':Sequelize[_0x47b8('0x9')]},'value':{'type':Sequelize[_0x47b8('0x9')],'set':function(_0x53e656){var _0x3867ca=_0x53e656[_0x47b8('0xa')](/\\/g,'/');this[_0x47b8('0xb')](_0x47b8('0x8'),_0x3867ca);}},'rating':{'type':Sequelize[_0x47b8('0xc')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x47b8('0xc')],'set':function(_0x24d240){this[_0x47b8('0xb')](_0x47b8('0xd'),moment()[_0x47b8('0xe')](_0x24d240,'ms'));this[_0x47b8('0xb')](_0x47b8('0xf'),moment());this[_0x47b8('0xb')](_0x47b8('0x10'),_0x24d240);}},'startedAt':{'type':Sequelize[_0x47b8('0x11')],'get':function(){return moment(this[_0x47b8('0x6')](_0x47b8('0xd')))[_0x47b8('0x12')](_0x47b8('0x13'))[_0x47b8('0x14')]();}},'closedAt':{'type':Sequelize[_0x47b8('0x11')],'get':function(){return moment(this[_0x47b8('0x6')](_0x47b8('0xf')))[_0x47b8('0x12')](_0x47b8('0x13'))[_0x47b8('0x14')]();}},'createdAt':{'type':Sequelize[_0x47b8('0x11')],'get':function(){return moment(this['getDataValue'](_0x47b8('0x15')))[_0x47b8('0x12')](_0x47b8('0x13'))[_0x47b8('0x14')]();}},'updatedAt':{'type':Sequelize[_0x47b8('0x11')],'get':function(){return moment(this[_0x47b8('0x6')](_0x47b8('0x16')))['format'](_0x47b8('0x13'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 6e8b3fd..74c0657 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 _0xdc97=['join','root','%s.cypher','existsSync','decryptFile','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','sendStatus','error','name','send','index','map','format','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','options','ScreenRecording','includeAll','rows','catch','show','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid'];(function(_0x1884c5,_0x4b73c7){var _0x2adc00=function(_0x1122c){while(--_0x1122c){_0x1884c5['push'](_0x1884c5['shift']());}};_0x2adc00(++_0x4b73c7);}(_0xdc97,0x13b));var _0x7dc9=function(_0x5833ff,_0x2a1a7e){_0x5833ff=_0x5833ff-0x0;var _0x2096d0=_0xdc97[_0x5833ff];return _0x2096d0;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){_0xffc080[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x55a482,_0x48c6bc){return function(_0x4b9ba6){if(!_0x4b9ba6){_0x55a482[_0x7dc9('0x22')](0x194);}return _0x4b9ba6;};}function handleError(_0x32d032,_0x5843bf){_0x5843bf=_0x5843bf||0x1f4;return function(_0x585eef){logger[_0x7dc9('0x23')](_0x585eef['stack']);if(_0x585eef[_0x7dc9('0x24')]){delete _0x585eef[_0x7dc9('0x24')];}_0x32d032[_0x7dc9('0x16')](_0x5843bf)[_0x7dc9('0x25')](_0x585eef);};}exports[_0x7dc9('0x26')]=function(_0x450124,_0x236d42){var _0x229f8e={},_0x1fcf0e={},_0x3c4379={'count':0x0,'rows':[]};var _0x14083d=_[_0x7dc9('0x27')](db['ScreenRecording']['rawAttributes'],function(_0x513dd6){return{'name':_0x513dd6['fieldName'],'type':_0x513dd6['type']['key']};});_0x1fcf0e['model']=_['differenceBy'](_[_0x7dc9('0x27')](_0x14083d,_0x7dc9('0x24')),[_0x7dc9('0x28')]);_0x1fcf0e[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x450124[_0x7dc9('0x29')]);_0x1fcf0e['filters']=_['intersection'](_0x1fcf0e['model'],_0x1fcf0e[_0x7dc9('0x29')]);_0x229f8e['attributes']=_[_0x7dc9('0x2b')](_0x1fcf0e[_0x7dc9('0x2c')],qs[_0x7dc9('0x2d')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x229f8e[_0x7dc9('0x2e')]=_0x229f8e[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x229f8e['attributes']:_0x1fcf0e[_0x7dc9('0x2c')];if(!_0x450124['query'][_0x7dc9('0x30')](_0x7dc9('0x31'))){_0x229f8e[_0x7dc9('0x1a')]=qs[_0x7dc9('0x1a')](_0x450124['query'][_0x7dc9('0x1a')]);_0x229f8e['offset']=qs[_0x7dc9('0x18')](_0x450124['query']['offset']);}_0x229f8e[_0x7dc9('0x32')]=qs[_0x7dc9('0x33')](_0x450124[_0x7dc9('0x29')][_0x7dc9('0x33')]);_0x229f8e['where']=qs[_0x7dc9('0x34')](_[_0x7dc9('0x35')](_0x450124[_0x7dc9('0x29')],_0x1fcf0e[_0x7dc9('0x34')]),_0x14083d);if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]){_0x229f8e[_0x7dc9('0x37')]=_[_0x7dc9('0x38')](_0x229f8e[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x27')](_0x14083d,function(_0x452aed){if(_0x452aed[_0x7dc9('0x39')]!=='VIRTUAL'){var _0x34b5c9={};_0x34b5c9[_0x452aed[_0x7dc9('0x24')]]={'$like':'%'+_0x450124[_0x7dc9('0x29')][_0x7dc9('0x36')]+'%'};return _0x34b5c9;}})});}_0x229f8e=_['merge']({},_0x229f8e,_0x450124[_0x7dc9('0x3a')]);var _0x89db0e={'where':_0x229f8e[_0x7dc9('0x37')]};return db[_0x7dc9('0x3b')][_0x7dc9('0x1b')](_0x89db0e)[_0x7dc9('0x21')](function(_0x5a1201){_0x3c4379['count']=_0x5a1201;if(_0x450124[_0x7dc9('0x29')][_0x7dc9('0x3c')]){_0x229f8e['include']=[{'all':!![]}];}return db[_0x7dc9('0x3b')]['findAll'](_0x229f8e);})[_0x7dc9('0x21')](function(_0x2a91fe){_0x3c4379[_0x7dc9('0x3d')]=_0x2a91fe;return _0x3c4379;})['then'](respondWithFilteredResult(_0x236d42,_0x229f8e))[_0x7dc9('0x3e')](handleError(_0x236d42,null));};exports[_0x7dc9('0x3f')]=function(_0x1929b6,_0x95513c){var _0x28ffc0={'raw':![],'where':{'id':_0x1929b6[_0x7dc9('0x40')]['id']}},_0x23499a={};_0x23499a['model']=_[_0x7dc9('0x2a')](db['ScreenRecording']['rawAttributes']);_0x23499a[_0x7dc9('0x29')]=_[_0x7dc9('0x2a')](_0x1929b6[_0x7dc9('0x29')]);_0x23499a[_0x7dc9('0x34')]=_[_0x7dc9('0x2b')](_0x23499a[_0x7dc9('0x2c')],_0x23499a[_0x7dc9('0x29')]);_0x28ffc0[_0x7dc9('0x2e')]=_[_0x7dc9('0x2b')](_0x23499a['model'],qs[_0x7dc9('0x2d')](_0x1929b6[_0x7dc9('0x29')][_0x7dc9('0x2d')]));_0x28ffc0[_0x7dc9('0x2e')]=_0x28ffc0[_0x7dc9('0x2e')][_0x7dc9('0x2f')]?_0x28ffc0['attributes']:_0x23499a[_0x7dc9('0x2c')];if(_0x1929b6[_0x7dc9('0x29')]['includeAll']){_0x28ffc0[_0x7dc9('0x41')]=[{'all':!![]}];}_0x28ffc0=_[_0x7dc9('0x38')]({},_0x28ffc0,_0x1929b6[_0x7dc9('0x3a')]);return db['ScreenRecording'][_0x7dc9('0x42')](_0x28ffc0)['then'](handleEntityNotFound(_0x95513c,null))['then'](respondWithResult(_0x95513c,null))[_0x7dc9('0x3e')](handleError(_0x95513c,null));};exports[_0x7dc9('0x43')]=function(_0x36d591,_0x5e0dc5){return db['ScreenRecording'][_0x7dc9('0x43')](_0x36d591['body'],{})[_0x7dc9('0x21')](respondWithResult(_0x5e0dc5,0xc9))[_0x7dc9('0x3e')](handleError(_0x5e0dc5,null));};exports['update']=function(_0x24ccce,_0x1d6c0a){if(_0x24ccce[_0x7dc9('0x44')]['id']){delete _0x24ccce[_0x7dc9('0x44')]['id'];}delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x45')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x46')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x47')];delete _0x24ccce[_0x7dc9('0x44')][_0x7dc9('0x48')];return db[_0x7dc9('0x3b')]['find']({'where':{'id':_0x24ccce[_0x7dc9('0x40')]['id']}})['then'](handleEntityNotFound(_0x1d6c0a,null))['then'](saveUpdates(_0x24ccce[_0x7dc9('0x44')],null))[_0x7dc9('0x21')](respondWithResult(_0x1d6c0a,null))[_0x7dc9('0x3e')](handleError(_0x1d6c0a,null));};exports[_0x7dc9('0x49')]=function(_0x346d27,_0x510e2a){return db[_0x7dc9('0x3b')][_0x7dc9('0x49')]()[_0x7dc9('0x21')](respondWithResult(_0x510e2a,null))['catch'](handleError(_0x510e2a,null));};exports[_0x7dc9('0x4a')]=function(_0x3fc164,_0x2cf133,_0x32bc31){var _0xf41b8c=require(_0x7dc9('0x4b'));var _0x593132=![];var _0x366b8b={};if(_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]&&_0x3fc164[_0x7dc9('0x29')][_0x7dc9('0x39')]===_0x7dc9('0x4c')){_0x366b8b[_0x7dc9('0x4c')]=_0x3fc164[_0x7dc9('0x40')]['id'];}else{_0x366b8b['id']=_0x3fc164[_0x7dc9('0x40')]['id'];}return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':_0x366b8b,'attributes':['id',_0x7dc9('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x2cf133,null))[_0x7dc9('0x21')](function(_0x39be46){if(_0x39be46){var _0x38df9a=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x39be46[_0x7dc9('0x48')]);var _0xd8d327=util[_0x7dc9('0x28')](_0x7dc9('0x4f'),_0x38df9a);if(fs[_0x7dc9('0x50')](_0xd8d327)){_0x593132=!![];return _0xf41b8c[_0x7dc9('0x51')](_0xd8d327,_0x38df9a,config['secrets']['recording'])['then'](function(){return _0x39be46;});}return _0x39be46;}})[_0x7dc9('0x21')](function(_0x3daf33){if(_0x3daf33){var _0x32a64f=path[_0x7dc9('0x4d')](config['root'],'server/files/screen_recordings',_0x3daf33[_0x7dc9('0x48')]);if(!fs[_0x7dc9('0x50')](_0x32a64f)){throw new db[(_0x7dc9('0x52'))][(_0x7dc9('0x53'))](_0x7dc9('0x54'));}if(_0x3daf33[_0x7dc9('0x55')]){return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,_0x3daf33['filename']+path[_0x7dc9('0x56')](_0x32a64f),function(){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}else{return _0x2cf133[_0x7dc9('0x4a')](_0x32a64f,function(_0x1dad95){if(_0x593132){fs[_0x7dc9('0x57')](_0x32a64f);}});}}})['catch'](function(_0x175858){if(_0x175858[_0x7dc9('0x58')]===_0x7dc9('0x54')){_0x2cf133[_0x7dc9('0x16')](0x194)[_0x7dc9('0x25')](_0x7dc9('0x59'));}else{return handleError(_0x2cf133,null);}});};exports[_0x7dc9('0x5a')]=function(_0x2a02ed,_0x3463e4){return db[_0x7dc9('0x3b')][_0x7dc9('0x42')]({'where':{'id':_0x2a02ed[_0x7dc9('0x40')]['id']}})[_0x7dc9('0x21')](function(_0x5eee27){if(_[_0x7dc9('0x5b')](_0x5eee27)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5eee27;})[_0x7dc9('0x21')](function(_0x15cf19){var _0x48ea37=path[_0x7dc9('0x4d')](config[_0x7dc9('0x4e')],'server/files/screen_recordings',_0x15cf19[_0x7dc9('0x48')]);logger[_0x7dc9('0x5c')](_0x7dc9('0x5d'),_0x48ea37);if(!_['isNil'](_0x15cf19['value'])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger[_0x7dc9('0x5c')](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}_0x48ea37=_0x48ea37+_0x7dc9('0x61');if(!_[_0x7dc9('0x5b')](_0x15cf19[_0x7dc9('0x48')])&&fs[_0x7dc9('0x50')](_0x48ea37)){logger['info'](_0x7dc9('0x5e')+_0x48ea37+_0x7dc9('0x5f'));fs[_0x7dc9('0x60')](_0x48ea37);}return _0x15cf19;})['then'](function(_0x4f80bd){if(!_0x4f80bd)throw new InternalError();return _0x4f80bd[_0x7dc9('0x5a')]();})[_0x7dc9('0x21')](function(){_0x3463e4[_0x7dc9('0x16')](0xcc)[_0x7dc9('0x17')]();})['catch'](handleError(_0x3463e4,null));}; \ No newline at end of file +var _0x4b84=['query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','show','params','find','catch','create','body','duration','createdAt','closedAt','value','download','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','join','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','send','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format'];(function(_0x45641d,_0x4410f5){var _0x461083=function(_0x51becc){while(--_0x51becc){_0x45641d['push'](_0x45641d['shift']());}};_0x461083(++_0x4410f5);}(_0x4b84,0x1cc));var _0x44b8=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4b84[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];function respondWithStatusCode(_0x4301a6,_0x4bcc43){_0x4bcc43=_0x4bcc43||0xcc;return function(_0x194230){if(_0x194230){return _0x4301a6['sendStatus'](_0x4bcc43);}return _0x4301a6[_0x44b8('0x14')](_0x4bcc43)[_0x44b8('0x15')]();};}function respondWithResult(_0x4df670,_0x63e8f6){_0x63e8f6=_0x63e8f6||0xc8;return function(_0x4be54c){if(_0x4be54c){return _0x4df670['status'](_0x63e8f6)[_0x44b8('0x16')](_0x4be54c);}};}function respondWithFilteredResult(_0x2af0ad,_0x1722da){return function(_0x41ab46){if(_0x41ab46){var _0x5e52f2=typeof _0x1722da['offset']==='undefined'&&typeof _0x1722da[_0x44b8('0x17')]==='undefined';var _0x28ef36=_0x41ab46[_0x44b8('0x18')];var _0x55e258=_0x5e52f2?0x0:_0x1722da[_0x44b8('0x19')];var _0xe3de8f=_0x5e52f2?_0x41ab46['count']:_0x1722da[_0x44b8('0x19')]+_0x1722da[_0x44b8('0x17')];var _0x4b600f;if(_0xe3de8f>=_0x28ef36){_0xe3de8f=_0x28ef36;_0x4b600f=0xc8;}else{_0x4b600f=0xce;}_0x2af0ad[_0x44b8('0x14')](_0x4b600f);return _0x2af0ad[_0x44b8('0x1a')](_0x44b8('0x1b'),_0x55e258+'-'+_0xe3de8f+'/'+_0x28ef36)[_0x44b8('0x16')](_0x41ab46);}return null;};}function patchUpdates(_0x102ef9){return function(_0x369c09){try{jsonpatch[_0x44b8('0x1c')](_0x369c09,_0x102ef9,!![]);}catch(_0x9b0536){return BPromise[_0x44b8('0x1d')](_0x9b0536);}return _0x369c09[_0x44b8('0x1e')]();};}function saveUpdates(_0x1d642b,_0x14996c){return function(_0x48327e){if(_0x48327e){return _0x48327e[_0x44b8('0x1f')](_0x1d642b)[_0x44b8('0x20')](function(_0x416b34){return _0x416b34;});}return null;};}function removeEntity(_0x1418db,_0x305a5c){return function(_0x51a34a){if(_0x51a34a){return _0x51a34a[_0x44b8('0x21')]()['then'](function(){_0x1418db[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();});}};}function handleEntityNotFound(_0x25a0c1,_0x47689e){return function(_0x230a3d){if(!_0x230a3d){_0x25a0c1['sendStatus'](0x194);}return _0x230a3d;};}function handleError(_0x474f01,_0x502acf){_0x502acf=_0x502acf||0x1f4;return function(_0x41d673){logger[_0x44b8('0x22')](_0x41d673['stack']);if(_0x41d673[_0x44b8('0x23')]){delete _0x41d673[_0x44b8('0x23')];}_0x474f01[_0x44b8('0x14')](_0x502acf)['send'](_0x41d673);};}exports[_0x44b8('0x24')]=function(_0x242342,_0x53d9c7){var _0x2e0174={},_0x4a182d={},_0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['ScreenRecording'][_0x44b8('0x25')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x26')],'type':_0x29b18d[_0x44b8('0x27')][_0x44b8('0x28')]};});_0x4a182d[_0x44b8('0x29')]=_[_0x44b8('0x2a')](_[_0x44b8('0x2b')](_0x5a544c,_0x44b8('0x23')),[_0x44b8('0x2c')]);_0x4a182d[_0x44b8('0x2d')]=_[_0x44b8('0x2e')](_0x242342[_0x44b8('0x2d')]);_0x4a182d['filters']=_[_0x44b8('0x2f')](_0x4a182d['model'],_0x4a182d[_0x44b8('0x2d')]);_0x2e0174[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0x4a182d[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x242342['query'][_0x44b8('0x31')]));_0x2e0174[_0x44b8('0x30')]=_0x2e0174[_0x44b8('0x30')][_0x44b8('0x32')]?_0x2e0174[_0x44b8('0x30')]:_0x4a182d['model'];if(!_0x242342[_0x44b8('0x2d')][_0x44b8('0x33')](_0x44b8('0x34'))){_0x2e0174[_0x44b8('0x17')]=qs[_0x44b8('0x17')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x17')]);_0x2e0174[_0x44b8('0x19')]=qs[_0x44b8('0x19')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x19')]);}_0x2e0174[_0x44b8('0x35')]=qs[_0x44b8('0x36')](_0x242342[_0x44b8('0x2d')][_0x44b8('0x36')]);_0x2e0174[_0x44b8('0x37')]=qs[_0x44b8('0x38')](_[_0x44b8('0x39')](_0x242342[_0x44b8('0x2d')],_0x4a182d[_0x44b8('0x38')]),_0x5a544c);if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]){_0x2e0174['where']=_[_0x44b8('0x3b')](_0x2e0174[_0x44b8('0x37')],{'$or':_['map'](_0x5a544c,function(_0x25688b){if(_0x25688b[_0x44b8('0x27')]!==_0x44b8('0x3c')){var _0x332c2b={};_0x332c2b[_0x25688b['name']]={'$like':'%'+_0x242342[_0x44b8('0x2d')][_0x44b8('0x3a')]+'%'};return _0x332c2b;}})});}_0x2e0174=_[_0x44b8('0x3b')]({},_0x2e0174,_0x242342[_0x44b8('0x3d')]);var _0x9cb2a={'where':_0x2e0174[_0x44b8('0x37')]};return db[_0x44b8('0x3e')][_0x44b8('0x18')](_0x9cb2a)[_0x44b8('0x20')](function(_0x3d1be1){_0xfb0028[_0x44b8('0x18')]=_0x3d1be1;if(_0x242342[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x2e0174[_0x44b8('0x40')]=[{'all':!![]}];}return db[_0x44b8('0x3e')][_0x44b8('0x41')](_0x2e0174);})['then'](function(_0x12a0a4){_0xfb0028[_0x44b8('0x42')]=_0x12a0a4;return _0xfb0028;})[_0x44b8('0x20')](respondWithFilteredResult(_0x53d9c7,_0x2e0174))['catch'](handleError(_0x53d9c7,null));};exports[_0x44b8('0x43')]=function(_0x1054c5,_0x229cc9){var _0x585a16={'raw':![],'where':{'id':_0x1054c5[_0x44b8('0x44')]['id']}},_0xbad4bb={};_0xbad4bb[_0x44b8('0x29')]=_[_0x44b8('0x2e')](db[_0x44b8('0x3e')]['rawAttributes']);_0xbad4bb['query']=_[_0x44b8('0x2e')](_0x1054c5[_0x44b8('0x2d')]);_0xbad4bb[_0x44b8('0x38')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],_0xbad4bb[_0x44b8('0x2d')]);_0x585a16[_0x44b8('0x30')]=_[_0x44b8('0x2f')](_0xbad4bb[_0x44b8('0x29')],qs[_0x44b8('0x31')](_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x31')]));_0x585a16[_0x44b8('0x30')]=_0x585a16[_0x44b8('0x30')][_0x44b8('0x32')]?_0x585a16[_0x44b8('0x30')]:_0xbad4bb[_0x44b8('0x29')];if(_0x1054c5[_0x44b8('0x2d')][_0x44b8('0x3f')]){_0x585a16['include']=[{'all':!![]}];}_0x585a16=_['merge']({},_0x585a16,_0x1054c5[_0x44b8('0x3d')]);return db[_0x44b8('0x3e')][_0x44b8('0x45')](_0x585a16)[_0x44b8('0x20')](handleEntityNotFound(_0x229cc9,null))[_0x44b8('0x20')](respondWithResult(_0x229cc9,null))[_0x44b8('0x46')](handleError(_0x229cc9,null));};exports[_0x44b8('0x47')]=function(_0x4fe73f,_0x156070){return db['ScreenRecording'][_0x44b8('0x47')](_0x4fe73f[_0x44b8('0x48')],{})[_0x44b8('0x20')](respondWithResult(_0x156070,0xc9))[_0x44b8('0x46')](handleError(_0x156070,null));};exports[_0x44b8('0x1f')]=function(_0x35ca19,_0x491600){if(_0x35ca19[_0x44b8('0x48')]['id']){delete _0x35ca19[_0x44b8('0x48')]['id'];}delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x49')];delete _0x35ca19['body'][_0x44b8('0x4a')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4b')];delete _0x35ca19[_0x44b8('0x48')][_0x44b8('0x4c')];return db[_0x44b8('0x3e')]['find']({'where':{'id':_0x35ca19[_0x44b8('0x44')]['id']}})[_0x44b8('0x20')](handleEntityNotFound(_0x491600,null))[_0x44b8('0x20')](saveUpdates(_0x35ca19[_0x44b8('0x48')],null))[_0x44b8('0x20')](respondWithResult(_0x491600,null))['catch'](handleError(_0x491600,null));};exports['describe']=function(_0x2516fc,_0x4eb344){return db[_0x44b8('0x3e')]['describe']()[_0x44b8('0x20')](respondWithResult(_0x4eb344,null))[_0x44b8('0x46')](handleError(_0x4eb344,null));};exports[_0x44b8('0x4d')]=function(_0x15f4c6,_0x2fa6b4,_0x32f588){var _0xdc67e8=require('../../components/encryptor');var _0x3ad278=![];var _0x37b2c2={};if(_0x15f4c6[_0x44b8('0x2d')]['type']&&_0x15f4c6[_0x44b8('0x2d')][_0x44b8('0x27')]===_0x44b8('0x4e')){_0x37b2c2[_0x44b8('0x4e')]=_0x15f4c6['params']['id'];}else{_0x37b2c2['id']=_0x15f4c6[_0x44b8('0x44')]['id'];}return db[_0x44b8('0x3e')]['find']({'where':_0x37b2c2,'attributes':['id',_0x44b8('0x4c')],'raw':!![]})[_0x44b8('0x20')](handleEntityNotFound(_0x2fa6b4,null))[_0x44b8('0x20')](function(_0x3df6aa){if(_0x3df6aa){var _0xe86e34=path['join'](config['root'],_0x44b8('0x4f'),_0x3df6aa[_0x44b8('0x4c')]);var _0xa30834=util[_0x44b8('0x2c')](_0x44b8('0x50'),_0xe86e34);if(fs[_0x44b8('0x51')](_0xa30834)){_0x3ad278=!![];return _0xdc67e8[_0x44b8('0x52')](_0xa30834,_0xe86e34,config[_0x44b8('0x53')][_0x44b8('0x54')])[_0x44b8('0x20')](function(){return _0x3df6aa;});}return _0x3df6aa;}})[_0x44b8('0x20')](function(_0x3f7576){if(_0x3f7576){var _0x5af3e6=path[_0x44b8('0x55')](config[_0x44b8('0x56')],_0x44b8('0x4f'),_0x3f7576[_0x44b8('0x4c')]);if(!fs[_0x44b8('0x51')](_0x5af3e6)){throw new db[(_0x44b8('0x57'))][(_0x44b8('0x58'))](_0x44b8('0x59'));}if(_0x3f7576[_0x44b8('0x5a')]){return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,_0x3f7576[_0x44b8('0x5a')]+path[_0x44b8('0x5b')](_0x5af3e6),function(){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}else{return _0x2fa6b4[_0x44b8('0x4d')](_0x5af3e6,function(_0x2250bb){if(_0x3ad278){fs[_0x44b8('0x5c')](_0x5af3e6);}});}}})[_0x44b8('0x46')](function(_0x20e563){if(_0x20e563['message']===_0x44b8('0x59')){_0x2fa6b4[_0x44b8('0x14')](0x194)[_0x44b8('0x5d')](_0x44b8('0x5e'));}else{return handleError(_0x2fa6b4,null);}});};exports[_0x44b8('0x21')]=function(_0x29ed5d,_0x2ecf65){return db['ScreenRecording'][_0x44b8('0x45')]({'where':{'id':_0x29ed5d[_0x44b8('0x44')]['id']}})['then'](function(_0x2a95f6){if(_[_0x44b8('0x5f')](_0x2a95f6)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2a95f6;})[_0x44b8('0x20')](function(_0x454fe6){var _0x370618=path['join'](config[_0x44b8('0x56')],'server/files/screen_recordings',_0x454fe6[_0x44b8('0x4c')]);logger['info'](_0x44b8('0x60'),_0x370618);if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs[_0x44b8('0x51')](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x44b8('0x63')](_0x370618);}_0x370618=_0x370618+'.cypher';if(!_[_0x44b8('0x5f')](_0x454fe6[_0x44b8('0x4c')])&&fs['existsSync'](_0x370618)){logger[_0x44b8('0x61')](_0x44b8('0x62')+_0x370618+_0x44b8('0x64'));fs[_0x44b8('0x63')](_0x370618);}return _0x454fe6;})[_0x44b8('0x20')](function(_0x3774fe){if(!_0x3774fe)throw new InternalError();return _0x3774fe[_0x44b8('0x21')]();})[_0x44b8('0x20')](function(){_0x2ecf65[_0x44b8('0x14')](0xcc)[_0x44b8('0x15')]();})[_0x44b8('0x46')](handleError(_0x2ecf65,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b3d77cc..8d8a759 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 _0x7746=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0xee588,_0x368239){var _0x58dd1a=function(_0x3fd2b1){while(--_0x3fd2b1){_0xee588['push'](_0xee588['shift']());}};_0x58dd1a(++_0x368239);}(_0x7746,0x1de));var _0x6774=function(_0x85359b,_0x591cb7){_0x85359b=_0x85359b-0x0;var _0x2d2156=_0x7746[_0x85359b];return _0x2d2156;};'use strict';var _=require(_0x6774('0x0'));var util=require(_0x6774('0x1'));var logger=require(_0x6774('0x2'))('api');var moment=require(_0x6774('0x3'));var BPromise=require(_0x6774('0x4'));var rp=require(_0x6774('0x5'));var fs=require('fs');var path=require(_0x6774('0x6'));var rimraf=require(_0x6774('0x7'));var config=require(_0x6774('0x8'));var attributes=require(_0x6774('0x9'));module[_0x6774('0xa')]=function(_0xbdf9f,_0x4f0de9){return _0xbdf9f[_0x6774('0xb')](_0x6774('0xc'),attributes,{'tableName':_0x6774('0xd'),'paranoid':![],'indexes':[{'name':_0x6774('0xe'),'fields':[_0x6774('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a12=['screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','path','exports','define','ScreenRecording'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x0a12,0x176));var _0x20a1=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0a12[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x20a1('0x0'));var util=require(_0x20a1('0x1'));var logger=require(_0x20a1('0x2'))(_0x20a1('0x3'));var moment=require(_0x20a1('0x4'));var BPromise=require(_0x20a1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0x20a1('0x7')]=function(_0x2a2110,_0x11e921){return _0x2a2110[_0x20a1('0x8')](_0x20a1('0x9'),attributes,{'tableName':_0x20a1('0xa'),'paranoid':![],'indexes':[{'name':_0x20a1('0xb'),'fields':[_0x20a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index d393c7c..25b3f46 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 _0x4414=['error','code','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3a698f,_0x1e1b8a){var _0x4b684c=function(_0x569555){while(--_0x569555){_0x3a698f['push'](_0x3a698f['shift']());}};_0x4b684c(++_0x1e1b8a);}(_0x4414,0x1e8));var _0x4441=function(_0x4b006b,_0x3c1db3){_0x4b006b=_0x4b006b-0x0;var _0x362121=_0x4414[_0x4b006b];return _0x362121;};'use strict';var _=require(_0x4441('0x0'));var util=require(_0x4441('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4441('0x2'));var fs=require('fs');var Redis=require(_0x4441('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4441('0x4'));var logger=require(_0x4441('0x5'))(_0x4441('0x6'));var config=require(_0x4441('0x7'));var jayson=require(_0x4441('0x8'));var client=jayson[_0x4441('0x9')][_0x4441('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26616c,_0x288503,_0x2e298f){return new BPromise(function(_0x566516,_0x1d194a){return client['request'](_0x26616c,_0x2e298f)[_0x4441('0xb')](function(_0x303aad){logger[_0x4441('0xc')](_0x4441('0xd'),_0x288503,_0x4441('0xe'));logger[_0x4441('0xf')](_0x4441('0x10'),_0x288503,'request\x20sent',JSON[_0x4441('0x11')](_0x303aad));if(_0x303aad['error']){if(_0x303aad[_0x4441('0x12')][_0x4441('0x13')]===0x1f4){logger[_0x4441('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x288503,_0x303aad[_0x4441('0x12')][_0x4441('0x14')]);return _0x1d194a(_0x303aad['error'][_0x4441('0x14')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x288503,_0x303aad['error'][_0x4441('0x14')]);return _0x566516(_0x303aad['error'][_0x4441('0x14')]);}else{logger['info'](_0x4441('0xd'),_0x288503,'request\x20sent');_0x566516(_0x303aad[_0x4441('0x15')][_0x4441('0x14')]);}})['catch'](function(_0x94c4ce){logger[_0x4441('0x12')](_0x4441('0xd'),_0x288503,_0x94c4ce);_0x1d194a(_0x94c4ce);});});} \ No newline at end of file +var _0x2f5c=['catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x2d4f6b,_0x1dde70){var _0x597ce4=function(_0x43f51d){while(--_0x43f51d){_0x2d4f6b['push'](_0x2d4f6b['shift']());}};_0x597ce4(++_0x1dde70);}(_0x2f5c,0x1ef));var _0xc2f5=function(_0x465895,_0x1b8471){_0x465895=_0x465895-0x0;var _0x15a901=_0x2f5c[_0x465895];return _0x15a901;};'use strict';var _=require(_0xc2f5('0x0'));var util=require(_0xc2f5('0x1'));var moment=require(_0xc2f5('0x2'));var BPromise=require('bluebird');var rs=require(_0xc2f5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f5('0x4'))['db'];var utils=require(_0xc2f5('0x5'));var logger=require(_0xc2f5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc2f5('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd0d9c0,_0x4b05be,_0x4be513){return new BPromise(function(_0x4681ba,_0x55ce97){return client[_0xc2f5('0x8')](_0xd0d9c0,_0x4be513)[_0xc2f5('0x9')](function(_0x26903f){logger[_0xc2f5('0xa')](_0xc2f5('0xb'),_0x4b05be,_0xc2f5('0xc'));logger[_0xc2f5('0xd')](_0xc2f5('0xe'),_0x4b05be,_0xc2f5('0xc'),JSON[_0xc2f5('0xf')](_0x26903f));if(_0x26903f[_0xc2f5('0x10')]){if(_0x26903f['error']['code']===0x1f4){logger[_0xc2f5('0x10')](_0xc2f5('0xb'),_0x4b05be,_0x26903f['error'][_0xc2f5('0x11')]);return _0x55ce97(_0x26903f[_0xc2f5('0x10')]['message']);}logger[_0xc2f5('0x10')](_0xc2f5('0xb'),_0x4b05be,_0x26903f[_0xc2f5('0x10')][_0xc2f5('0x11')]);return _0x4681ba(_0x26903f['error'][_0xc2f5('0x11')]);}else{logger[_0xc2f5('0xa')](_0xc2f5('0xb'),_0x4b05be,_0xc2f5('0xc'));_0x4681ba(_0x26903f['result'][_0xc2f5('0x11')]);}})[_0xc2f5('0x12')](function(_0x390f28){logger['error'](_0xc2f5('0xb'),_0x4b05be,_0x390f28);_0x55ce97(_0x390f28);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index b3e5cf2..68f4ce2 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 _0x9e3c=['/:id/gdpr','/:id/preferred','/:id/favicon','diskStorage','root','format','%s%s','logo','originalname','single','file','addLogo','logologin','extname','server/files/images/logos/','post','addPreferred','join','favicon','addFavicon','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin'];(function(_0x56b60c,_0x11c3ea){var _0x1c49ac=function(_0x2f9c7d){while(--_0x2f9c7d){_0x56b60c['push'](_0x56b60c['shift']());}};_0x1c49ac(++_0x11c3ea);}(_0x9e3c,0x1a6));var _0xc9e3=function(_0x3c9f56,_0x198760){_0x3c9f56=_0x3c9f56-0x0;var _0x33f1be=_0x9e3c[_0x3c9f56];return _0x33f1be;};'use strict';var multer=require(_0xc9e3('0x0'));var util=require(_0xc9e3('0x1'));var path=require(_0xc9e3('0x2'));var timeout=require('connect-timeout');var express=require(_0xc9e3('0x3'));var router=express[_0xc9e3('0x4')]();var fs_extra=require(_0xc9e3('0x5'));var auth=require(_0xc9e3('0x6'));var interaction=require(_0xc9e3('0x7'));var config=require(_0xc9e3('0x8'));var controller=require('./setting.controller');router['get']('/',auth[_0xc9e3('0x9')](),controller['index']);router[_0xc9e3('0xa')](_0xc9e3('0xb'),controller[_0xc9e3('0xc')]);router[_0xc9e3('0xa')](_0xc9e3('0xd'),controller[_0xc9e3('0xe')]);router[_0xc9e3('0xa')](_0xc9e3('0xf'),controller[_0xc9e3('0x10')]);router[_0xc9e3('0xa')]('/:id/logo_login',controller[_0xc9e3('0x11')]);router['get'](_0xc9e3('0x12'),controller['gdpr']);router['get'](_0xc9e3('0x13'),controller['getPreferred']);router['get'](_0xc9e3('0x14'),controller['getFavicon']);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x4e82e3,_0x436b5b,_0x13fe75){_0x13fe75(null,path['join'](config[_0xc9e3('0x16')],'server/files/images/logos/'));},'filename':function(_0x171e70,_0x4b767e,_0x3ed068){_0x3ed068(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x19'),path['extname'](_0x4b767e[_0xc9e3('0x1a')])));}})});router['post']('/:id/logo',upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x1d')]);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x416a95,_0x703d2d,_0x516d84){_0x516d84(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x15a9e8,_0x397949,_0x244f48){_0x244f48(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x1e'),path[_0xc9e3('0x1f')](_0x397949[_0xc9e3('0x1a')])));}})});router['post']('/:id/logo_login',upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x50d4df,_0x55471f,_0x3af641){_0x3af641(null,path['join'](config[_0xc9e3('0x16')],_0xc9e3('0x20')));},'filename':function(_0x330af8,_0x39cbbe,_0xc639c9){_0xc639c9(null,util['format']('%s%s','preferred',path['extname'](_0x39cbbe[_0xc9e3('0x1a')])));}})});router[_0xc9e3('0x21')](_0xc9e3('0x13'),upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x22')]);var upload=multer({'storage':multer[_0xc9e3('0x15')]({'destination':function(_0x162121,_0x1d18a1,_0x48ec99){_0x48ec99(null,path[_0xc9e3('0x23')](config[_0xc9e3('0x16')],'server/files/images/logos/'));},'filename':function(_0x40b1f4,_0x1439a0,_0xf0d57c){_0xf0d57c(null,util[_0xc9e3('0x17')](_0xc9e3('0x18'),_0xc9e3('0x24'),path[_0xc9e3('0x1f')](_0x1439a0[_0xc9e3('0x1a')])));}})});router[_0xc9e3('0x21')](_0xc9e3('0x14'),upload[_0xc9e3('0x1b')](_0xc9e3('0x1c')),controller[_0xc9e3('0x25')]);router[_0xc9e3('0x26')](_0xc9e3('0xd'),auth[_0xc9e3('0x9')](),controller['update']);module[_0xc9e3('0x27')]=router; \ No newline at end of file +var _0xaad6=['single','file','addLogoLogin','server/files/images/logos/','preferred','addPreferred','favicon','addFavicon','/:id','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','extname','originalname','post','addLogo','logologin'];(function(_0x2cc025,_0x294744){var _0x109231=function(_0x5966a5){while(--_0x5966a5){_0x2cc025['push'](_0x2cc025['shift']());}};_0x109231(++_0x294744);}(_0xaad6,0x1ed));var _0x6aad=function(_0x45dab2,_0x59b4c6){_0x45dab2=_0x45dab2-0x0;var _0x10dff3=_0xaad6[_0x45dab2];return _0x10dff3;};'use strict';var multer=require(_0x6aad('0x0'));var util=require('util');var path=require(_0x6aad('0x1'));var timeout=require(_0x6aad('0x2'));var express=require('express');var router=express[_0x6aad('0x3')]();var fs_extra=require(_0x6aad('0x4'));var auth=require(_0x6aad('0x5'));var interaction=require(_0x6aad('0x6'));var config=require(_0x6aad('0x7'));var controller=require(_0x6aad('0x8'));router['get']('/',auth[_0x6aad('0x9')](),controller[_0x6aad('0xa')]);router[_0x6aad('0xb')](_0x6aad('0xc'),controller[_0x6aad('0xd')]);router[_0x6aad('0xb')]('/:id',controller[_0x6aad('0xe')]);router['get'](_0x6aad('0xf'),controller['getLogo']);router[_0x6aad('0xb')](_0x6aad('0x10'),controller[_0x6aad('0x11')]);router[_0x6aad('0xb')](_0x6aad('0x12'),controller[_0x6aad('0x13')]);router[_0x6aad('0xb')](_0x6aad('0x14'),controller[_0x6aad('0x15')]);router[_0x6aad('0xb')](_0x6aad('0x16'),controller[_0x6aad('0x17')]);var upload=multer({'storage':multer[_0x6aad('0x18')]({'destination':function(_0xb27248,_0x58833d,_0x323d02){_0x323d02(null,path[_0x6aad('0x19')](config[_0x6aad('0x1a')],'server/files/images/logos/'));},'filename':function(_0x4424ee,_0x2cd917,_0x1c53e7){_0x1c53e7(null,util[_0x6aad('0x1b')](_0x6aad('0x1c'),_0x6aad('0x1d'),path[_0x6aad('0x1e')](_0x2cd917[_0x6aad('0x1f')])));}})});router[_0x6aad('0x20')](_0x6aad('0xf'),upload['single']('file'),controller[_0x6aad('0x21')]);var upload=multer({'storage':multer[_0x6aad('0x18')]({'destination':function(_0x2ebc57,_0x2b97f7,_0x5327bd){_0x5327bd(null,path[_0x6aad('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0x13d581,_0x11c750,_0xac240d){_0xac240d(null,util[_0x6aad('0x1b')](_0x6aad('0x1c'),_0x6aad('0x22'),path[_0x6aad('0x1e')](_0x11c750[_0x6aad('0x1f')])));}})});router[_0x6aad('0x20')](_0x6aad('0x10'),upload[_0x6aad('0x23')](_0x6aad('0x24')),controller[_0x6aad('0x25')]);var upload=multer({'storage':multer[_0x6aad('0x18')]({'destination':function(_0x425868,_0x3c7f27,_0x16113a){_0x16113a(null,path[_0x6aad('0x19')](config[_0x6aad('0x1a')],_0x6aad('0x26')));},'filename':function(_0x5d91d6,_0x354156,_0x1ae18b){_0x1ae18b(null,util[_0x6aad('0x1b')](_0x6aad('0x1c'),_0x6aad('0x27'),path['extname'](_0x354156['originalname'])));}})});router[_0x6aad('0x20')](_0x6aad('0x14'),upload[_0x6aad('0x23')](_0x6aad('0x24')),controller[_0x6aad('0x28')]);var upload=multer({'storage':multer[_0x6aad('0x18')]({'destination':function(_0x5d36ed,_0x1de1a3,_0x5bee26){_0x5bee26(null,path[_0x6aad('0x19')](config[_0x6aad('0x1a')],_0x6aad('0x26')));},'filename':function(_0x34f0cd,_0x8c95f0,_0x154473){_0x154473(null,util[_0x6aad('0x1b')](_0x6aad('0x1c'),_0x6aad('0x29'),path[_0x6aad('0x1e')](_0x8c95f0[_0x6aad('0x1f')])));}})});router[_0x6aad('0x20')](_0x6aad('0x16'),upload[_0x6aad('0x23')](_0x6aad('0x24')),controller[_0x6aad('0x2a')]);router['put'](_0x6aad('0x2b'),auth[_0x6aad('0x9')](),controller['update']);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 bcb33ed..a406fd2 100644 --- a/server/api/setting/setting.attributes.js +++ b/server/api/setting/setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x515ec9,_0xdddc9d){var _0xf2f0e3=function(_0x1151ba){while(--_0x1151ba){_0x515ec9['push'](_0x515ec9['shift']());}};_0xf2f0e3(++_0xdddc9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x3980d8,_0x8e8569){var _0x102314=function(_0x4775f6){while(--_0x4775f6){_0x3980d8['push'](_0x3980d8['shift']());}};_0x102314(++_0x8e8569);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 26a905d..92b5dd3 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 _0x862f=['index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','show','params','includeAll','Setting','find','body','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLoginLogo','defaultPreferred','root','toLower','join','default_logo.svg','default','upperFirst','existsSync','Sequelize','ValidationError','\x20not\x20found','download','server/files/images/logos','favicon','defaultLogo','defaultFavicon','default_loginLogo.svg','custom','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send'];(function(_0x214231,_0x576191){var _0x2ee472=function(_0x5da839){while(--_0x5da839){_0x214231['push'](_0x214231['shift']());}};_0x2ee472(++_0x576191);}(_0x862f,0xba));var _0xf862=function(_0x3bc0a9,_0x45a9f2){_0x3bc0a9=_0x3bc0a9-0x0;var _0x5ba1dc=_0x862f[_0x3bc0a9];return _0x5ba1dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf862('0x0'));var zipdir=require(_0xf862('0x1'));var jsonpatch=require(_0xf862('0x2'));var rp=require(_0xf862('0x3'));var moment=require('moment');var BPromise=require(_0xf862('0x4'));var Mustache=require(_0xf862('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf862('0x6'));var csv=require(_0xf862('0x7'));var ejs=require(_0xf862('0x8'));var fs=require('fs');var fs_extra=require(_0xf862('0x9'));var _=require('lodash');var squel=require(_0xf862('0xa'));var crypto=require(_0xf862('0xb'));var jsforce=require(_0xf862('0xc'));var deskjs=require(_0xf862('0xd'));var toCsv=require(_0xf862('0x7'));var querystring=require(_0xf862('0xe'));var Papa=require(_0xf862('0xf'));var Redis=require('ioredis');var authService=require(_0xf862('0x10'));var qs=require(_0xf862('0x11'));var as=require(_0xf862('0x12'));var hardwareService=require(_0xf862('0x13'));var logger=require(_0xf862('0x14'))(_0xf862('0x15'));var utils=require('../../config/utils');var config=require(_0xf862('0x16'));var licenseUtil=require(_0xf862('0x17'));var db=require(_0xf862('0x18'))['db'];var jayson=require(_0xf862('0x19'));var client=jayson['client'][_0xf862('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4a7979,_0xcdd9f5,_0x2dfd25,_0x33490b){return new BPromise(function(_0x31e8ac,_0x4eed6b){var _0xb0c054=_0x33490b||client;return _0xb0c054[_0xf862('0x1b')](_0x4a7979,_0x2dfd25)['then'](function(_0x1dce1e){logger[_0xf862('0x1c')]('Setting,\x20%s,\x20%s',_0xcdd9f5,'request\x20sent');logger[_0xf862('0x1d')](_0xf862('0x1e'),_0xcdd9f5,_0xf862('0x1f'),JSON[_0xf862('0x20')](_0x1dce1e));if(_0x1dce1e[_0xf862('0x21')]){if(_0x1dce1e[_0xf862('0x21')][_0xf862('0x22')]===0x1f4){logger['error'](_0xf862('0x23'),_0xcdd9f5,_0x1dce1e['error']['message']);return _0x4eed6b(_0x1dce1e['error']['message']);}logger[_0xf862('0x21')](_0xf862('0x23'),_0xcdd9f5,_0x1dce1e[_0xf862('0x21')][_0xf862('0x24')]);return _0x31e8ac(_0x1dce1e['error'][_0xf862('0x24')]);}else{logger[_0xf862('0x1c')]('Setting,\x20%s,\x20%s',_0xcdd9f5,'request\x20sent');_0x31e8ac(_0x1dce1e[_0xf862('0x25')][_0xf862('0x24')]);}})[_0xf862('0x26')](function(_0x11faa4){logger[_0xf862('0x21')]('Setting,\x20%s,\x20%s',_0xcdd9f5,_0x11faa4);_0x4eed6b(_0x11faa4);});});}function respondWithStatusCode(_0x58a33c,_0x102398){_0x102398=_0x102398||0xcc;return function(_0x30c9a7){if(_0x30c9a7){return _0x58a33c[_0xf862('0x27')](_0x102398);}return _0x58a33c[_0xf862('0x28')](_0x102398)['end']();};}function respondWithResult(_0x572a80,_0x1f1f55){_0x1f1f55=_0x1f1f55||0xc8;return function(_0xd3f8b6){if(_0xd3f8b6){return _0x572a80[_0xf862('0x28')](_0x1f1f55)[_0xf862('0x29')](_0xd3f8b6);}};}function respondWithFilteredResult(_0x3b57e9,_0x215ad1){return function(_0x26ae56){if(_0x26ae56){var _0x5dd858=typeof _0x215ad1['offset']===_0xf862('0x2a')&&typeof _0x215ad1[_0xf862('0x2b')]===_0xf862('0x2a');var _0x48c755=_0x26ae56[_0xf862('0x2c')];var _0x2891a2=_0x5dd858?0x0:_0x215ad1['offset'];var _0x3282f5=_0x5dd858?_0x26ae56[_0xf862('0x2c')]:_0x215ad1[_0xf862('0x2d')]+_0x215ad1['limit'];var _0x4f80c6;if(_0x3282f5>=_0x48c755){_0x3282f5=_0x48c755;_0x4f80c6=0xc8;}else{_0x4f80c6=0xce;}_0x3b57e9[_0xf862('0x28')](_0x4f80c6);return _0x3b57e9[_0xf862('0x2e')](_0xf862('0x2f'),_0x2891a2+'-'+_0x3282f5+'/'+_0x48c755)['json'](_0x26ae56);}return null;};}function patchUpdates(_0x5c31b8){return function(_0x547ce9){try{jsonpatch[_0xf862('0x30')](_0x547ce9,_0x5c31b8,!![]);}catch(_0x45de26){return BPromise[_0xf862('0x31')](_0x45de26);}return _0x547ce9[_0xf862('0x32')]();};}function saveUpdates(_0x2d84d1,_0x4f4fe8){return function(_0x55fe7d){if(_0x55fe7d){return _0x55fe7d[_0xf862('0x33')](_0x2d84d1)['then'](function(_0x5b5ff2){return _0x5b5ff2;});}return null;};}function removeEntity(_0x38f526,_0x2c3c40){return function(_0x5254b5){if(_0x5254b5){return _0x5254b5[_0xf862('0x34')]()[_0xf862('0x35')](function(){_0x38f526[_0xf862('0x28')](0xcc)[_0xf862('0x36')]();});}};}function handleEntityNotFound(_0x30ada1,_0x28a513){return function(_0x25389e){if(!_0x25389e){_0x30ada1['sendStatus'](0x194);}return _0x25389e;};}function handleError(_0x423de2,_0x21ec59){_0x21ec59=_0x21ec59||0x1f4;return function(_0x82afd9){logger[_0xf862('0x21')](_0x82afd9[_0xf862('0x37')]);if(_0x82afd9[_0xf862('0x38')]){delete _0x82afd9[_0xf862('0x38')];}_0x423de2[_0xf862('0x28')](_0x21ec59)[_0xf862('0x39')](_0x82afd9);};}exports[_0xf862('0x3a')]=function(_0x59278a,_0x52263e){var _0x3ff314={},_0x5bd98d={},_0x5ffb0f={'count':0x0,'rows':[]};var _0x1e5f1a=_['map'](db['Setting'][_0xf862('0x3b')],function(_0x89c571){return{'name':_0x89c571[_0xf862('0x3c')],'type':_0x89c571['type']['key']};});_0x5bd98d[_0xf862('0x3d')]=_[_0xf862('0x3e')](_0x1e5f1a,'name');_0x5bd98d[_0xf862('0x3f')]=_[_0xf862('0x40')](_0x59278a[_0xf862('0x3f')]);_0x5bd98d[_0xf862('0x41')]=_[_0xf862('0x42')](_0x5bd98d[_0xf862('0x3d')],_0x5bd98d[_0xf862('0x3f')]);_0x3ff314[_0xf862('0x43')]=_[_0xf862('0x42')](_0x5bd98d[_0xf862('0x3d')],qs[_0xf862('0x44')](_0x59278a[_0xf862('0x3f')][_0xf862('0x44')]));_0x3ff314[_0xf862('0x43')]=_0x3ff314[_0xf862('0x43')][_0xf862('0x45')]?_0x3ff314[_0xf862('0x43')]:_0x5bd98d[_0xf862('0x3d')];if(!_0x59278a['query']['hasOwnProperty']('nolimit')){_0x3ff314[_0xf862('0x2b')]=qs['limit'](_0x59278a[_0xf862('0x3f')]['limit']);_0x3ff314[_0xf862('0x2d')]=qs[_0xf862('0x2d')](_0x59278a[_0xf862('0x3f')][_0xf862('0x2d')]);}_0x3ff314['order']=qs['sort'](_0x59278a[_0xf862('0x3f')][_0xf862('0x46')]);_0x3ff314[_0xf862('0x47')]=qs[_0xf862('0x41')](_['pick'](_0x59278a[_0xf862('0x3f')],_0x5bd98d['filters']),_0x1e5f1a);if(_0x59278a['query'][_0xf862('0x48')]){_0x3ff314['where']=_[_0xf862('0x49')](_0x3ff314['where'],{'$or':_[_0xf862('0x3e')](_0x1e5f1a,function(_0x499d93){if(_0x499d93[_0xf862('0x4a')]!==_0xf862('0x4b')){var _0x1b14fc={};_0x1b14fc[_0x499d93[_0xf862('0x38')]]={'$like':'%'+_0x59278a['query'][_0xf862('0x48')]+'%'};return _0x1b14fc;}})});}_0x3ff314=_[_0xf862('0x49')]({},_0x3ff314,_0x59278a['options']);var _0x2cba51={'where':_0x3ff314[_0xf862('0x47')]};return db['Setting']['count'](_0x2cba51)[_0xf862('0x35')](function(_0x54be21){_0x5ffb0f['count']=_0x54be21;if(_0x59278a[_0xf862('0x3f')]['includeAll']){_0x3ff314[_0xf862('0x4c')]=[{'all':!![]}];}return db['Setting'][_0xf862('0x4d')](_0x3ff314);})[_0xf862('0x35')](function(_0x4bccf0){_0x5ffb0f[_0xf862('0x4e')]=_0x4bccf0;return _0x5ffb0f;})['then'](respondWithFilteredResult(_0x52263e,_0x3ff314))[_0xf862('0x26')](handleError(_0x52263e,null));};exports[_0xf862('0x4f')]=function(_0x46c0f2,_0xe395d6){var _0x18d322={'raw':![],'where':{'id':_0x46c0f2[_0xf862('0x50')]['id']}},_0x36a544={};_0x36a544[_0xf862('0x3d')]=_['keys'](db['Setting'][_0xf862('0x3b')]);_0x36a544[_0xf862('0x3f')]=_[_0xf862('0x40')](_0x46c0f2[_0xf862('0x3f')]);_0x36a544['filters']=_[_0xf862('0x42')](_0x36a544[_0xf862('0x3d')],_0x36a544[_0xf862('0x3f')]);_0x18d322[_0xf862('0x43')]=_[_0xf862('0x42')](_0x36a544[_0xf862('0x3d')],qs[_0xf862('0x44')](_0x46c0f2['query'][_0xf862('0x44')]));_0x18d322['attributes']=_0x18d322['attributes'][_0xf862('0x45')]?_0x18d322[_0xf862('0x43')]:_0x36a544['model'];if(_0x46c0f2[_0xf862('0x3f')][_0xf862('0x51')]){_0x18d322[_0xf862('0x4c')]=[{'all':!![]}];}_0x18d322=_[_0xf862('0x49')]({},_0x18d322,_0x46c0f2['options']);return db[_0xf862('0x52')][_0xf862('0x53')](_0x18d322)[_0xf862('0x35')](handleEntityNotFound(_0xe395d6,null))['then'](respondWithResult(_0xe395d6,null))[_0xf862('0x26')](handleError(_0xe395d6,null));};exports[_0xf862('0x33')]=function(_0x45782d,_0x305cee){if(_0x45782d[_0xf862('0x54')]['id']){delete _0x45782d[_0xf862('0x54')]['id'];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x45782d[_0xf862('0x50')]['id']}})['then'](handleEntityNotFound(_0x305cee,null))['then'](saveUpdates(_0x45782d[_0xf862('0x54')],null))['then'](respondWithResult(_0x305cee,null))[_0xf862('0x26')](handleError(_0x305cee,null));};exports['addLogo']=function(_0x5238e4,_0x35c1c0,_0x3639bd){if(_0x5238e4['file']&&_0x5238e4[_0xf862('0x55')][_0xf862('0x56')]){_0x5238e4[_0xf862('0x54')][_0xf862('0x57')]=_0x5238e4[_0xf862('0x55')][_0xf862('0x56')];}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x5238e4[_0xf862('0x50')]['id']}})['then'](handleEntityNotFound(_0x35c1c0,null))[_0xf862('0x35')](saveUpdates(_0x5238e4[_0xf862('0x54')],null))[_0xf862('0x35')](respondWithResult(_0x35c1c0,null))[_0xf862('0x26')](handleError(_0x35c1c0,null));};exports[_0xf862('0x58')]=function(_0x5c5d13,_0x575e00,_0x11c927){if(_0x5c5d13[_0xf862('0x55')]&&_0x5c5d13[_0xf862('0x55')][_0xf862('0x56')]){_0x5c5d13[_0xf862('0x54')][_0xf862('0x59')]=_0x5c5d13[_0xf862('0x55')][_0xf862('0x56')];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x5c5d13[_0xf862('0x50')]['id']}})[_0xf862('0x35')](handleEntityNotFound(_0x575e00,null))[_0xf862('0x35')](saveUpdates(_0x5c5d13[_0xf862('0x54')],null))[_0xf862('0x35')](respondWithResult(_0x575e00,null))['catch'](handleError(_0x575e00,null));};var utilLicense=require(_0xf862('0x17'));exports[_0xf862('0x5a')]=function(_0x49bc1e,_0x5c8cf8,_0x54d59c){var _0x13feb6='server/files/images/logos';var _0x25d730={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0x432f78){if(_0x432f78){_0x25d730=_0x432f78;}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x49bc1e[_0xf862('0x50')]['id']},'attributes':['logo',_0xf862('0x59'),_0xf862('0x5c'),'favicon','defaultLogo',_0xf862('0x5d'),_0xf862('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x5c8cf8,null))[_0xf862('0x35')](function(_0x4853cd){if(_0x4853cd){var _0x47534e=_0x4853cd[_0xf862('0x57')]&&fs['existsSync'](path['join'](config[_0xf862('0x5f')],_0x13feb6,_[_0xf862('0x60')](_0x4853cd[_0xf862('0x57')])))?path[_0xf862('0x61')](config['root'],_0x13feb6,_[_0xf862('0x60')](_0x4853cd[_0xf862('0x57')])):path[_0xf862('0x61')](config['root'],_0x13feb6,_['toLower'](_0xf862('0x62')));var _0x5470d3=_0xf862('0x63')+_[_0xf862('0x64')](_0xf862('0x57'));if(_0x4853cd[_0x5470d3]||!_0x25d730['custom']){_0x47534e=path[_0xf862('0x61')](config['root'],_0x13feb6,_['toLower'](_0xf862('0x62')));}if(!fs[_0xf862('0x65')](_0x47534e)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_['upperFirst'](_0xf862('0x57'))+_0xf862('0x68'));}return _0x5c8cf8[_0xf862('0x69')](_0x47534e);}})[_0xf862('0x26')](handleError(_0x5c8cf8,null));};var utilLicense=require(_0xf862('0x17'));exports['getLogoLogin']=function(_0x223b40,_0x1ff407,_0x1caf6e){var _0x17761a=_0xf862('0x6a');var _0x1fd540={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0xac2b8f){if(_0xac2b8f){_0x1fd540=_0xac2b8f;}return db[_0xf862('0x52')]['find']({'where':{'id':_0x223b40[_0xf862('0x50')]['id']},'attributes':[_0xf862('0x57'),_0xf862('0x59'),_0xf862('0x5c'),_0xf862('0x6b'),_0xf862('0x6c'),_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x6d')],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x1ff407,null))['then'](function(_0x45ec49){if(_0x45ec49){var _0x338729=_0x45ec49[_0xf862('0x59')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0x45ec49[_0xf862('0x59')])))?path['join'](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0x45ec49[_0xf862('0x59')])):path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x17761a,_[_0xf862('0x60')](_0xf862('0x6e')));var _0x1b8c05=_0xf862('0x63')+_[_0xf862('0x64')]('loginLogo');if(_0x45ec49[_0x1b8c05]||!_0x1fd540[_0xf862('0x6f')]){_0x338729=path[_0xf862('0x61')](config['root'],_0x17761a,_[_0xf862('0x60')](_0xf862('0x6e')));}if(!fs['existsSync'](_0x338729)){throw new db['Sequelize'][(_0xf862('0x67'))](_['upperFirst']('loginLogo')+_0xf862('0x68'));}return _0x1ff407[_0xf862('0x69')](_0x338729);}})['catch'](handleError(_0x1ff407,null));};exports[_0xf862('0x70')]=function(_0x24fd84,_0xf8e1d5){return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x24fd84[_0xf862('0x50')]['id']},'attributes':[_0xf862('0x71')]})[_0xf862('0x35')](respondWithResult(_0xf8e1d5,null))['catch'](handleError(_0xf8e1d5,null));};exports[_0xf862('0x72')]=function(_0x3ca7c4,_0x55f806,_0x15ebd1){if(_0x3ca7c4['file']&&_0x3ca7c4['file']['filename']){_0x3ca7c4[_0xf862('0x54')]['preferred']=_0x3ca7c4['file']['filename'];}return db['Setting'][_0xf862('0x53')]({'where':{'id':_0x3ca7c4['params']['id']}})['then'](handleEntityNotFound(_0x55f806,null))[_0xf862('0x35')](saveUpdates(_0x3ca7c4['body'],null))[_0xf862('0x35')](respondWithResult(_0x55f806,null))[_0xf862('0x26')](handleError(_0x55f806,null));};var utilLicense=require(_0xf862('0x17'));exports['getPreferred']=function(_0x478f7a,_0xf3aa22,_0x514f22){var _0x5b04f2=_0xf862('0x6a');var _0x5bb5e2={'custom':![]};return utilLicense[_0xf862('0x5b')]()[_0xf862('0x35')](function(_0x9ddd33){if(_0x9ddd33){_0x5bb5e2=_0x9ddd33;}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0x478f7a['params']['id']},'attributes':[_0xf862('0x57'),_0xf862('0x59'),_0xf862('0x5c'),'favicon',_0xf862('0x6c'),_0xf862('0x5d'),_0xf862('0x5e'),_0xf862('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0xf3aa22,null))[_0xf862('0x35')](function(_0xde27d3){if(_0xde27d3){var _0x59c4ab=_0xde27d3[_0xf862('0x5c')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_['toLower'](_0xde27d3['preferred'])))?path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_['toLower'](_0xde27d3[_0xf862('0x5c')])):path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_[_0xf862('0x60')](_0xf862('0x73')));var _0x464745='default'+_['upperFirst'](_0xf862('0x5c'));if(_0xde27d3[_0x464745]||!_0x5bb5e2['custom']||!_0x5bb5e2[_0xf862('0x5c')]){_0x59c4ab=path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x5b04f2,_[_0xf862('0x60')](_0xf862('0x73')));}if(!fs[_0xf862('0x65')](_0x59c4ab)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_[_0xf862('0x64')](_0xf862('0x5c'))+'\x20not\x20found');}return _0xf3aa22['download'](_0x59c4ab);}})[_0xf862('0x26')](handleError(_0xf3aa22,null));};exports[_0xf862('0x74')]=function(_0xb1037f,_0x24cac8,_0x2b1ee0){if(_0xb1037f[_0xf862('0x55')]&&_0xb1037f[_0xf862('0x55')][_0xf862('0x56')]){_0xb1037f[_0xf862('0x54')][_0xf862('0x6b')]=_0xb1037f['file'][_0xf862('0x56')];}return db[_0xf862('0x52')][_0xf862('0x53')]({'where':{'id':_0xb1037f[_0xf862('0x50')]['id']}})[_0xf862('0x35')](handleEntityNotFound(_0x24cac8,null))['then'](saveUpdates(_0xb1037f[_0xf862('0x54')],null))['then'](respondWithResult(_0x24cac8,null))[_0xf862('0x26')](handleError(_0x24cac8,null));};var utilLicense=require(_0xf862('0x17'));exports[_0xf862('0x75')]=function(_0x2fe08f,_0x2365f5,_0x453e09){var _0x35294c=_0xf862('0x6a');var _0x5ba94a={'custom':![]};return utilLicense[_0xf862('0x5b')]()['then'](function(_0x4bd347){if(_0x4bd347){_0x5ba94a=_0x4bd347;}return db[_0xf862('0x52')]['find']({'where':{'id':_0x2fe08f['params']['id']},'attributes':['logo','loginLogo',_0xf862('0x5c'),_0xf862('0x6b'),_0xf862('0x6c'),'defaultLoginLogo','defaultPreferred',_0xf862('0x6d')],'raw':!![]});})[_0xf862('0x35')](handleEntityNotFound(_0x2365f5,null))[_0xf862('0x35')](function(_0xfbf9e3){if(_0xfbf9e3){var _0x261d74=_0xfbf9e3[_0xf862('0x6b')]&&fs[_0xf862('0x65')](path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x35294c,_[_0xf862('0x60')](_0xfbf9e3[_0xf862('0x6b')])))?path[_0xf862('0x61')](config['root'],_0x35294c,_['toLower'](_0xfbf9e3[_0xf862('0x6b')])):path[_0xf862('0x61')](config['root'],_0x35294c,_[_0xf862('0x60')](_0xf862('0x76')));var _0x2c18c4=_0xf862('0x63')+_[_0xf862('0x64')](_0xf862('0x6b'));if(_0xfbf9e3[_0x2c18c4]||!_0x5ba94a[_0xf862('0x6f')]){_0x261d74=path[_0xf862('0x61')](config[_0xf862('0x5f')],_0x35294c,_[_0xf862('0x60')](_0xf862('0x76')));}if(!fs['existsSync'](_0x261d74)){throw new db[(_0xf862('0x66'))][(_0xf862('0x67'))](_[_0xf862('0x64')]('favicon')+_0xf862('0x68'));}return _0x2365f5[_0xf862('0x69')](_0x261d74);}})[_0xf862('0x26')](handleError(_0x2365f5,null));};exports[_0xf862('0x77')]=function(_0x135db4,_0x5d3ceb){var _0x443414={'offset':moment()['utcOffset']()};_0x443414['now']=moment()[_0xf862('0x78')](_0x443414[_0xf862('0x2d')])[_0xf862('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x5d3ceb['status'](0xc8)['send'](_0x443414);}; \ No newline at end of file +var _0x265f=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','map','rawAttributes','fieldName','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filters','filter','merge','type','options','Setting','include','findAll','rows','params','keys','includeAll','find','body','addLogo','file','filename','logo','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','preferred','default_loginLogo.svg','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','custom','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1a381e,_0x3030ab){var _0x4d0482=function(_0x56a0a6){while(--_0x56a0a6){_0x1a381e['push'](_0x1a381e['shift']());}};_0x4d0482(++_0x3030ab);}(_0x265f,0x1e1));var _0xf265=function(_0x2fb561,_0x579dbf){_0x2fb561=_0x2fb561-0x0;var _0x2b7be3=_0x265f[_0x2fb561];return _0x2b7be3;};'use strict';var emlformat=require(_0xf265('0x0'));var rimraf=require(_0xf265('0x1'));var zipdir=require(_0xf265('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf265('0x3'));var moment=require(_0xf265('0x4'));var BPromise=require(_0xf265('0x5'));var Mustache=require(_0xf265('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf265('0x7'));var csv=require(_0xf265('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf265('0x9'));var _=require(_0xf265('0xa'));var squel=require(_0xf265('0xb'));var crypto=require(_0xf265('0xc'));var jsforce=require(_0xf265('0xd'));var deskjs=require(_0xf265('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf265('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf265('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf265('0x11'));var logger=require(_0xf265('0x12'))(_0xf265('0x13'));var utils=require(_0xf265('0x14'));var config=require(_0xf265('0x15'));var licenseUtil=require(_0xf265('0x16'));var db=require(_0xf265('0x17'))['db'];var jayson=require(_0xf265('0x18'));var client=jayson[_0xf265('0x19')][_0xf265('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x1b7392,_0x33fe8c,_0x29c992,_0xa24e75){return new BPromise(function(_0x500b1d,_0x5237fa){var _0x3baa47=_0xa24e75||client;return _0x3baa47['request'](_0x1b7392,_0x29c992)[_0xf265('0x1b')](function(_0x5e6dcc){logger[_0xf265('0x1c')](_0xf265('0x1d'),_0x33fe8c,_0xf265('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x33fe8c,_0xf265('0x1e'),JSON[_0xf265('0x1f')](_0x5e6dcc));if(_0x5e6dcc[_0xf265('0x20')]){if(_0x5e6dcc[_0xf265('0x20')][_0xf265('0x21')]===0x1f4){logger[_0xf265('0x20')](_0xf265('0x1d'),_0x33fe8c,_0x5e6dcc[_0xf265('0x20')][_0xf265('0x22')]);return _0x5237fa(_0x5e6dcc[_0xf265('0x20')]['message']);}logger[_0xf265('0x20')](_0xf265('0x1d'),_0x33fe8c,_0x5e6dcc['error']['message']);return _0x500b1d(_0x5e6dcc[_0xf265('0x20')][_0xf265('0x22')]);}else{logger['info'](_0xf265('0x1d'),_0x33fe8c,'request\x20sent');_0x500b1d(_0x5e6dcc[_0xf265('0x23')]['message']);}})[_0xf265('0x24')](function(_0x395d32){logger['error'](_0xf265('0x1d'),_0x33fe8c,_0x395d32);_0x5237fa(_0x395d32);});});}function respondWithStatusCode(_0x2627a4,_0x35805b){_0x35805b=_0x35805b||0xcc;return function(_0x1efd7b){if(_0x1efd7b){return _0x2627a4[_0xf265('0x25')](_0x35805b);}return _0x2627a4[_0xf265('0x26')](_0x35805b)[_0xf265('0x27')]();};}function respondWithResult(_0x590c1d,_0x3a7d6b){_0x3a7d6b=_0x3a7d6b||0xc8;return function(_0x1fd485){if(_0x1fd485){return _0x590c1d['status'](_0x3a7d6b)[_0xf265('0x28')](_0x1fd485);}};}function respondWithFilteredResult(_0x49e59e,_0x12072b){return function(_0x6e1752){if(_0x6e1752){var _0x581c55=typeof _0x12072b[_0xf265('0x29')]===_0xf265('0x2a')&&typeof _0x12072b[_0xf265('0x2b')]===_0xf265('0x2a');var _0x4ddce6=_0x6e1752[_0xf265('0x2c')];var _0x6c589=_0x581c55?0x0:_0x12072b['offset'];var _0x9db8c6=_0x581c55?_0x6e1752[_0xf265('0x2c')]:_0x12072b['offset']+_0x12072b[_0xf265('0x2b')];var _0x42b64c;if(_0x9db8c6>=_0x4ddce6){_0x9db8c6=_0x4ddce6;_0x42b64c=0xc8;}else{_0x42b64c=0xce;}_0x49e59e['status'](_0x42b64c);return _0x49e59e[_0xf265('0x2d')](_0xf265('0x2e'),_0x6c589+'-'+_0x9db8c6+'/'+_0x4ddce6)[_0xf265('0x28')](_0x6e1752);}return null;};}function patchUpdates(_0x4f110e){return function(_0x2e524b){try{jsonpatch[_0xf265('0x2f')](_0x2e524b,_0x4f110e,!![]);}catch(_0x36cb7d){return BPromise[_0xf265('0x30')](_0x36cb7d);}return _0x2e524b[_0xf265('0x31')]();};}function saveUpdates(_0x562ce1,_0x40d916){return function(_0x4a8357){if(_0x4a8357){return _0x4a8357[_0xf265('0x32')](_0x562ce1)[_0xf265('0x1b')](function(_0x330e9a){return _0x330e9a;});}return null;};}function removeEntity(_0x53df69,_0x3268b2){return function(_0x180042){if(_0x180042){return _0x180042[_0xf265('0x33')]()[_0xf265('0x1b')](function(){_0x53df69[_0xf265('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x316e0c,_0x195a41){return function(_0x317823){if(!_0x317823){_0x316e0c[_0xf265('0x25')](0x194);}return _0x317823;};}function handleError(_0x367eef,_0x1cc0ca){_0x1cc0ca=_0x1cc0ca||0x1f4;return function(_0x19034e){logger[_0xf265('0x20')](_0x19034e[_0xf265('0x34')]);if(_0x19034e[_0xf265('0x35')]){delete _0x19034e['name'];}_0x367eef[_0xf265('0x26')](_0x1cc0ca)[_0xf265('0x36')](_0x19034e);};}exports['index']=function(_0x341f7d,_0x4eae5f){var _0x5a9817={},_0x3376e3={},_0x7557d6={'count':0x0,'rows':[]};var _0x216831=_[_0xf265('0x37')](db['Setting'][_0xf265('0x38')],function(_0x1f2d0c){return{'name':_0x1f2d0c[_0xf265('0x39')],'type':_0x1f2d0c['type']['key']};});_0x3376e3[_0xf265('0x3a')]=_[_0xf265('0x37')](_0x216831,_0xf265('0x35'));_0x3376e3[_0xf265('0x3b')]=_['keys'](_0x341f7d['query']);_0x3376e3['filters']=_[_0xf265('0x3c')](_0x3376e3[_0xf265('0x3a')],_0x3376e3['query']);_0x5a9817['attributes']=_[_0xf265('0x3c')](_0x3376e3['model'],qs[_0xf265('0x3d')](_0x341f7d[_0xf265('0x3b')][_0xf265('0x3d')]));_0x5a9817['attributes']=_0x5a9817[_0xf265('0x3e')][_0xf265('0x3f')]?_0x5a9817[_0xf265('0x3e')]:_0x3376e3[_0xf265('0x3a')];if(!_0x341f7d[_0xf265('0x3b')]['hasOwnProperty'](_0xf265('0x40'))){_0x5a9817[_0xf265('0x2b')]=qs['limit'](_0x341f7d[_0xf265('0x3b')][_0xf265('0x2b')]);_0x5a9817['offset']=qs[_0xf265('0x29')](_0x341f7d['query'][_0xf265('0x29')]);}_0x5a9817[_0xf265('0x41')]=qs['sort'](_0x341f7d[_0xf265('0x3b')][_0xf265('0x42')]);_0x5a9817[_0xf265('0x43')]=qs['filters'](_[_0xf265('0x44')](_0x341f7d['query'],_0x3376e3[_0xf265('0x45')]),_0x216831);if(_0x341f7d[_0xf265('0x3b')][_0xf265('0x46')]){_0x5a9817[_0xf265('0x43')]=_[_0xf265('0x47')](_0x5a9817[_0xf265('0x43')],{'$or':_[_0xf265('0x37')](_0x216831,function(_0x53a72a){if(_0x53a72a[_0xf265('0x48')]!=='VIRTUAL'){var _0x19f8f4={};_0x19f8f4[_0x53a72a['name']]={'$like':'%'+_0x341f7d[_0xf265('0x3b')][_0xf265('0x46')]+'%'};return _0x19f8f4;}})});}_0x5a9817=_[_0xf265('0x47')]({},_0x5a9817,_0x341f7d[_0xf265('0x49')]);var _0x53499e={'where':_0x5a9817[_0xf265('0x43')]};return db[_0xf265('0x4a')][_0xf265('0x2c')](_0x53499e)[_0xf265('0x1b')](function(_0x1fe7e9){_0x7557d6['count']=_0x1fe7e9;if(_0x341f7d[_0xf265('0x3b')]['includeAll']){_0x5a9817[_0xf265('0x4b')]=[{'all':!![]}];}return db[_0xf265('0x4a')][_0xf265('0x4c')](_0x5a9817);})[_0xf265('0x1b')](function(_0x1ecce1){_0x7557d6[_0xf265('0x4d')]=_0x1ecce1;return _0x7557d6;})[_0xf265('0x1b')](respondWithFilteredResult(_0x4eae5f,_0x5a9817))['catch'](handleError(_0x4eae5f,null));};exports['show']=function(_0x456ff7,_0x5348a9){var _0x44cccc={'raw':![],'where':{'id':_0x456ff7[_0xf265('0x4e')]['id']}},_0x2b4f60={};_0x2b4f60[_0xf265('0x3a')]=_[_0xf265('0x4f')](db[_0xf265('0x4a')][_0xf265('0x38')]);_0x2b4f60['query']=_[_0xf265('0x4f')](_0x456ff7[_0xf265('0x3b')]);_0x2b4f60[_0xf265('0x45')]=_[_0xf265('0x3c')](_0x2b4f60[_0xf265('0x3a')],_0x2b4f60[_0xf265('0x3b')]);_0x44cccc[_0xf265('0x3e')]=_[_0xf265('0x3c')](_0x2b4f60[_0xf265('0x3a')],qs[_0xf265('0x3d')](_0x456ff7[_0xf265('0x3b')]['fields']));_0x44cccc[_0xf265('0x3e')]=_0x44cccc[_0xf265('0x3e')]['length']?_0x44cccc['attributes']:_0x2b4f60['model'];if(_0x456ff7[_0xf265('0x3b')][_0xf265('0x50')]){_0x44cccc[_0xf265('0x4b')]=[{'all':!![]}];}_0x44cccc=_['merge']({},_0x44cccc,_0x456ff7[_0xf265('0x49')]);return db[_0xf265('0x4a')][_0xf265('0x51')](_0x44cccc)['then'](handleEntityNotFound(_0x5348a9,null))[_0xf265('0x1b')](respondWithResult(_0x5348a9,null))[_0xf265('0x24')](handleError(_0x5348a9,null));};exports[_0xf265('0x32')]=function(_0x1d76ac,_0x1f07b8){if(_0x1d76ac['body']['id']){delete _0x1d76ac['body']['id'];}return db[_0xf265('0x4a')][_0xf265('0x51')]({'where':{'id':_0x1d76ac[_0xf265('0x4e')]['id']}})[_0xf265('0x1b')](handleEntityNotFound(_0x1f07b8,null))[_0xf265('0x1b')](saveUpdates(_0x1d76ac[_0xf265('0x52')],null))[_0xf265('0x1b')](respondWithResult(_0x1f07b8,null))[_0xf265('0x24')](handleError(_0x1f07b8,null));};exports[_0xf265('0x53')]=function(_0x28e452,_0x448cc8,_0x39ef49){if(_0x28e452['file']&&_0x28e452[_0xf265('0x54')][_0xf265('0x55')]){_0x28e452[_0xf265('0x52')][_0xf265('0x56')]=_0x28e452['file'][_0xf265('0x55')];}return db['Setting']['find']({'where':{'id':_0x28e452[_0xf265('0x4e')]['id']}})[_0xf265('0x1b')](handleEntityNotFound(_0x448cc8,null))[_0xf265('0x1b')](saveUpdates(_0x28e452['body'],null))[_0xf265('0x1b')](respondWithResult(_0x448cc8,null))[_0xf265('0x24')](handleError(_0x448cc8,null));};exports[_0xf265('0x57')]=function(_0x48d1d2,_0x27a432,_0x228333){if(_0x48d1d2[_0xf265('0x54')]&&_0x48d1d2[_0xf265('0x54')]['filename']){_0x48d1d2[_0xf265('0x52')]['loginLogo']=_0x48d1d2[_0xf265('0x54')][_0xf265('0x55')];}return db[_0xf265('0x4a')][_0xf265('0x51')]({'where':{'id':_0x48d1d2[_0xf265('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27a432,null))[_0xf265('0x1b')](saveUpdates(_0x48d1d2[_0xf265('0x52')],null))['then'](respondWithResult(_0x27a432,null))[_0xf265('0x24')](handleError(_0x27a432,null));};var utilLicense=require(_0xf265('0x16'));exports[_0xf265('0x58')]=function(_0x13d292,_0x266953,_0x131dc8){var _0x431fe4=_0xf265('0x59');var _0x2b7a16={'custom':![]};return utilLicense[_0xf265('0x5a')]()[_0xf265('0x1b')](function(_0x281ee5){if(_0x281ee5){_0x2b7a16=_0x281ee5;}return db['Setting']['find']({'where':{'id':_0x13d292[_0xf265('0x4e')]['id']},'attributes':[_0xf265('0x56'),_0xf265('0x5b'),'preferred',_0xf265('0x5c'),_0xf265('0x5d'),_0xf265('0x5e'),_0xf265('0x5f'),_0xf265('0x60')],'raw':!![]});})[_0xf265('0x1b')](handleEntityNotFound(_0x266953,null))[_0xf265('0x1b')](function(_0x420909){if(_0x420909){var _0x4fd295=_0x420909[_0xf265('0x56')]&&fs[_0xf265('0x61')](path['join'](config['root'],_0x431fe4,_['toLower'](_0x420909[_0xf265('0x56')])))?path[_0xf265('0x62')](config[_0xf265('0x63')],_0x431fe4,_[_0xf265('0x64')](_0x420909['logo'])):path[_0xf265('0x62')](config[_0xf265('0x63')],_0x431fe4,_[_0xf265('0x64')]('default_logo.svg'));var _0x48e7e3=_0xf265('0x65')+_[_0xf265('0x66')](_0xf265('0x56'));if(_0x420909[_0x48e7e3]||!_0x2b7a16['custom']){_0x4fd295=path[_0xf265('0x62')](config['root'],_0x431fe4,_[_0xf265('0x64')]('default_logo.svg'));}if(!fs['existsSync'](_0x4fd295)){throw new db[(_0xf265('0x67'))][(_0xf265('0x68'))](_[_0xf265('0x66')](_0xf265('0x56'))+_0xf265('0x69'));}return _0x266953[_0xf265('0x6a')](_0x4fd295);}})[_0xf265('0x24')](handleError(_0x266953,null));};var utilLicense=require(_0xf265('0x16'));exports[_0xf265('0x6b')]=function(_0x4dd0ad,_0x29c727,_0x15cece){var _0xf479f4=_0xf265('0x59');var _0x2f529e={'custom':![]};return utilLicense[_0xf265('0x5a')]()[_0xf265('0x1b')](function(_0x5abf84){if(_0x5abf84){_0x2f529e=_0x5abf84;}return db['Setting'][_0xf265('0x51')]({'where':{'id':_0x4dd0ad[_0xf265('0x4e')]['id']},'attributes':[_0xf265('0x56'),_0xf265('0x5b'),_0xf265('0x6c'),'favicon','defaultLogo',_0xf265('0x5e'),_0xf265('0x5f'),_0xf265('0x60')],'raw':!![]});})[_0xf265('0x1b')](handleEntityNotFound(_0x29c727,null))[_0xf265('0x1b')](function(_0x7cdfdf){if(_0x7cdfdf){var _0x5f2132=_0x7cdfdf[_0xf265('0x5b')]&&fs['existsSync'](path[_0xf265('0x62')](config[_0xf265('0x63')],_0xf479f4,_[_0xf265('0x64')](_0x7cdfdf[_0xf265('0x5b')])))?path[_0xf265('0x62')](config[_0xf265('0x63')],_0xf479f4,_[_0xf265('0x64')](_0x7cdfdf[_0xf265('0x5b')])):path[_0xf265('0x62')](config[_0xf265('0x63')],_0xf479f4,_['toLower'](_0xf265('0x6d')));var _0x5d0651=_0xf265('0x65')+_[_0xf265('0x66')](_0xf265('0x5b'));if(_0x7cdfdf[_0x5d0651]||!_0x2f529e['custom']){_0x5f2132=path[_0xf265('0x62')](config[_0xf265('0x63')],_0xf479f4,_[_0xf265('0x64')](_0xf265('0x6d')));}if(!fs[_0xf265('0x61')](_0x5f2132)){throw new db[(_0xf265('0x67'))][(_0xf265('0x68'))](_[_0xf265('0x66')](_0xf265('0x5b'))+_0xf265('0x69'));}return _0x29c727[_0xf265('0x6a')](_0x5f2132);}})[_0xf265('0x24')](handleError(_0x29c727,null));};exports[_0xf265('0x6e')]=function(_0x9d1218,_0x543e2a){return db[_0xf265('0x4a')][_0xf265('0x51')]({'where':{'id':_0x9d1218[_0xf265('0x4e')]['id']},'attributes':[_0xf265('0x6f')]})['then'](respondWithResult(_0x543e2a,null))[_0xf265('0x24')](handleError(_0x543e2a,null));};exports[_0xf265('0x70')]=function(_0x720e8d,_0x1cec5f,_0x519211){if(_0x720e8d[_0xf265('0x54')]&&_0x720e8d[_0xf265('0x54')][_0xf265('0x55')]){_0x720e8d[_0xf265('0x52')][_0xf265('0x6c')]=_0x720e8d[_0xf265('0x54')][_0xf265('0x55')];}return db[_0xf265('0x4a')]['find']({'where':{'id':_0x720e8d['params']['id']}})[_0xf265('0x1b')](handleEntityNotFound(_0x1cec5f,null))[_0xf265('0x1b')](saveUpdates(_0x720e8d[_0xf265('0x52')],null))[_0xf265('0x1b')](respondWithResult(_0x1cec5f,null))['catch'](handleError(_0x1cec5f,null));};var utilLicense=require(_0xf265('0x16'));exports['getPreferred']=function(_0x55f1c5,_0xfe5ab1,_0x599a1a){var _0x53f8b4=_0xf265('0x59');var _0x2fe941={'custom':![]};return utilLicense[_0xf265('0x5a')]()[_0xf265('0x1b')](function(_0x1c6490){if(_0x1c6490){_0x2fe941=_0x1c6490;}return db[_0xf265('0x4a')][_0xf265('0x51')]({'where':{'id':_0x55f1c5['params']['id']},'attributes':[_0xf265('0x56'),_0xf265('0x5b'),'preferred',_0xf265('0x5c'),_0xf265('0x5d'),_0xf265('0x5e'),_0xf265('0x5f'),_0xf265('0x60')],'raw':!![]});})[_0xf265('0x1b')](handleEntityNotFound(_0xfe5ab1,null))[_0xf265('0x1b')](function(_0x1b8051){if(_0x1b8051){var _0x1c17cd=_0x1b8051[_0xf265('0x6c')]&&fs['existsSync'](path[_0xf265('0x62')](config[_0xf265('0x63')],_0x53f8b4,_[_0xf265('0x64')](_0x1b8051[_0xf265('0x6c')])))?path[_0xf265('0x62')](config[_0xf265('0x63')],_0x53f8b4,_[_0xf265('0x64')](_0x1b8051['preferred'])):path[_0xf265('0x62')](config[_0xf265('0x63')],_0x53f8b4,_[_0xf265('0x64')](_0xf265('0x71')));var _0x2d9afc='default'+_[_0xf265('0x66')]('preferred');if(_0x1b8051[_0x2d9afc]||!_0x2fe941['custom']||!_0x2fe941[_0xf265('0x6c')]){_0x1c17cd=path[_0xf265('0x62')](config[_0xf265('0x63')],_0x53f8b4,_[_0xf265('0x64')](_0xf265('0x71')));}if(!fs[_0xf265('0x61')](_0x1c17cd)){throw new db['Sequelize'][(_0xf265('0x68'))](_['upperFirst'](_0xf265('0x6c'))+'\x20not\x20found');}return _0xfe5ab1['download'](_0x1c17cd);}})[_0xf265('0x24')](handleError(_0xfe5ab1,null));};exports[_0xf265('0x72')]=function(_0x5e12ba,_0x4a7036,_0x49d1c3){if(_0x5e12ba[_0xf265('0x54')]&&_0x5e12ba[_0xf265('0x54')][_0xf265('0x55')]){_0x5e12ba[_0xf265('0x52')][_0xf265('0x5c')]=_0x5e12ba[_0xf265('0x54')][_0xf265('0x55')];}return db[_0xf265('0x4a')][_0xf265('0x51')]({'where':{'id':_0x5e12ba['params']['id']}})[_0xf265('0x1b')](handleEntityNotFound(_0x4a7036,null))[_0xf265('0x1b')](saveUpdates(_0x5e12ba[_0xf265('0x52')],null))[_0xf265('0x1b')](respondWithResult(_0x4a7036,null))['catch'](handleError(_0x4a7036,null));};var utilLicense=require(_0xf265('0x16'));exports[_0xf265('0x73')]=function(_0x516044,_0x41bc4c,_0x1a29c1){var _0x4166aa=_0xf265('0x59');var _0x4b2cd0={'custom':![]};return utilLicense['getLicense']()[_0xf265('0x1b')](function(_0x20c740){if(_0x20c740){_0x4b2cd0=_0x20c740;}return db['Setting'][_0xf265('0x51')]({'where':{'id':_0x516044['params']['id']},'attributes':[_0xf265('0x56'),_0xf265('0x5b'),_0xf265('0x6c'),_0xf265('0x5c'),'defaultLogo','defaultLoginLogo',_0xf265('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xf265('0x1b')](handleEntityNotFound(_0x41bc4c,null))[_0xf265('0x1b')](function(_0x35de5c){if(_0x35de5c){var _0x21afdc=_0x35de5c[_0xf265('0x5c')]&&fs[_0xf265('0x61')](path['join'](config[_0xf265('0x63')],_0x4166aa,_[_0xf265('0x64')](_0x35de5c[_0xf265('0x5c')])))?path[_0xf265('0x62')](config[_0xf265('0x63')],_0x4166aa,_[_0xf265('0x64')](_0x35de5c['favicon'])):path[_0xf265('0x62')](config['root'],_0x4166aa,_[_0xf265('0x64')]('default_favicon.ico'));var _0x32f730='default'+_[_0xf265('0x66')](_0xf265('0x5c'));if(_0x35de5c[_0x32f730]||!_0x4b2cd0[_0xf265('0x74')]){_0x21afdc=path[_0xf265('0x62')](config[_0xf265('0x63')],_0x4166aa,_[_0xf265('0x64')](_0xf265('0x75')));}if(!fs['existsSync'](_0x21afdc)){throw new db[(_0xf265('0x67'))][(_0xf265('0x68'))](_['upperFirst']('favicon')+_0xf265('0x69'));}return _0x41bc4c[_0xf265('0x6a')](_0x21afdc);}})[_0xf265('0x24')](handleError(_0x41bc4c,null));};exports[_0xf265('0x76')]=function(_0x55e1da,_0x27c131){var _0x242b27={'offset':moment()[_0xf265('0x77')]()};_0x242b27[_0xf265('0x78')]=moment()[_0xf265('0x77')](_0x242b27[_0xf265('0x29')])['format'](_0xf265('0x79'));return _0x27c131[_0xf265('0x26')](0xc8)[_0xf265('0x36')](_0x242b27);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 1c7a434..bbf27b2 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0x7217,0x19e));var _0x7721=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7217[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['./setting.attributes','exports','define','settings','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x55ca,0x126));var _0xa55c=function(_0x12bc0d,_0x1e40ca){_0x12bc0d=_0x12bc0d-0x0;var _0x18cf40=_0x55ca[_0x12bc0d];return _0x18cf40;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('Setting',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index bc615f5..b0dffbf 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 _0x7566=['../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','options','where','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7566,0xd0));var _0x6756=function(_0x2a238a,_0x1d5054){_0x2a238a=_0x2a238a-0x0;var _0xeef802=_0x7566[_0x2a238a];return _0xeef802;};'use strict';var _=require(_0x6756('0x0'));var util=require('util');var moment=require(_0x6756('0x1'));var BPromise=require(_0x6756('0x2'));var rs=require(_0x6756('0x3'));var fs=require('fs');var Redis=require(_0x6756('0x4'));var db=require(_0x6756('0x5'))['db'];var utils=require(_0x6756('0x6'));var logger=require(_0x6756('0x7'))(_0x6756('0x8'));var config=require(_0x6756('0x9'));var jayson=require(_0x6756('0xa'));var client=jayson[_0x6756('0xb')][_0x6756('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd4f7b8,_0x2bbfae,_0xd1aba6){return new BPromise(function(_0x5cc042,_0x43f023){return client[_0x6756('0xd')](_0xd4f7b8,_0xd1aba6)['then'](function(_0x2f44d0){logger[_0x6756('0xe')](_0x6756('0xf'),_0x2bbfae,_0x6756('0x10'));logger['debug'](_0x6756('0x11'),_0x2bbfae,_0x6756('0x10'),JSON[_0x6756('0x12')](_0x2f44d0));if(_0x2f44d0[_0x6756('0x13')]){if(_0x2f44d0['error'][_0x6756('0x14')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x2bbfae,_0x2f44d0['error'][_0x6756('0x15')]);return _0x43f023(_0x2f44d0[_0x6756('0x13')][_0x6756('0x15')]);}logger[_0x6756('0x13')](_0x6756('0xf'),_0x2bbfae,_0x2f44d0[_0x6756('0x13')][_0x6756('0x15')]);return _0x5cc042(_0x2f44d0['error'][_0x6756('0x15')]);}else{logger[_0x6756('0xe')](_0x6756('0xf'),_0x2bbfae,_0x6756('0x10'));_0x5cc042(_0x2f44d0['result'][_0x6756('0x15')]);}})['catch'](function(_0x3b1f1b){logger['error'](_0x6756('0xf'),_0x2bbfae,_0x3b1f1b);_0x43f023(_0x3b1f1b);});});}exports[_0x6756('0x16')]=function(_0xd3a3a8){var _0x2dc5d1=this;return new Promise(function(_0x34089c,_0x2e297d){return db[_0x6756('0x17')]['find']({'raw':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8[_0x6756('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8[_0x6756('0x18')][_0x6756('0x19')]||null:null,'attributes':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8['options'][_0x6756('0x1a')]||null:null,'include':_0xd3a3a8[_0x6756('0x18')]?_0xd3a3a8['options'][_0x6756('0x1b')]?_[_0x6756('0x1c')](_0xd3a3a8[_0x6756('0x18')][_0x6756('0x1b')],function(_0x4b4a47){return{'model':db[_0x4b4a47[_0x6756('0x1d')]],'as':_0x4b4a47['as'],'attributes':_0x4b4a47['attributes'],'include':_0x4b4a47['include']?_[_0x6756('0x1c')](_0x4b4a47['include'],function(_0x416401){return{'model':db[_0x416401[_0x6756('0x1d')]],'as':_0x416401['as'],'attributes':_0x416401['attributes'],'include':_0x416401[_0x6756('0x1b')]?_[_0x6756('0x1c')](_0x416401[_0x6756('0x1b')],function(_0x26835e){return{'model':db[_0x26835e[_0x6756('0x1d')]],'as':_0x26835e['as'],'attributes':_0x26835e[_0x6756('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6756('0x1e')](function(_0x7b8351){logger[_0x6756('0xe')](_0x6756('0x16'),_0xd3a3a8);logger['debug']('ShowSetting',_0xd3a3a8,JSON[_0x6756('0x12')](_0x7b8351));_0x34089c(_0x7b8351);})['catch'](function(_0x11d3c4){logger[_0x6756('0x13')]('ShowSetting',_0x11d3c4[_0x6756('0x15')],_0xd3a3a8);_0x2e297d(_0x2dc5d1[_0x6756('0x13')](0x1f4,_0x11d3c4['message']));});});}; \ No newline at end of file +var _0x724d=['http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x19da54,_0x57764d){var _0x33d1c9=function(_0x5eae14){while(--_0x5eae14){_0x19da54['push'](_0x19da54['shift']());}};_0x33d1c9(++_0x57764d);}(_0x724d,0x1f3));var _0xd724=function(_0x15af0f,_0x5454ce){_0x15af0f=_0x15af0f-0x0;var _0x2bd1cb=_0x724d[_0x15af0f];return _0x2bd1cb;};'use strict';var _=require(_0xd724('0x0'));var util=require(_0xd724('0x1'));var moment=require('moment');var BPromise=require(_0xd724('0x2'));var rs=require(_0xd724('0x3'));var fs=require('fs');var Redis=require(_0xd724('0x4'));var db=require(_0xd724('0x5'))['db'];var utils=require(_0xd724('0x6'));var logger=require(_0xd724('0x7'))('rpc');var config=require(_0xd724('0x8'));var jayson=require(_0xd724('0x9'));var client=jayson[_0xd724('0xa')][_0xd724('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2355ea,_0x3a8ff0,_0x2da127){return new BPromise(function(_0x182395,_0x2009bd){return client[_0xd724('0xc')](_0x2355ea,_0x2da127)[_0xd724('0xd')](function(_0x165c46){logger['info'](_0xd724('0xe'),_0x3a8ff0,_0xd724('0xf'));logger[_0xd724('0x10')](_0xd724('0x11'),_0x3a8ff0,_0xd724('0xf'),JSON[_0xd724('0x12')](_0x165c46));if(_0x165c46[_0xd724('0x13')]){if(_0x165c46['error']['code']===0x1f4){logger[_0xd724('0x13')](_0xd724('0xe'),_0x3a8ff0,_0x165c46[_0xd724('0x13')][_0xd724('0x14')]);return _0x2009bd(_0x165c46[_0xd724('0x13')][_0xd724('0x14')]);}logger[_0xd724('0x13')](_0xd724('0xe'),_0x3a8ff0,_0x165c46['error']['message']);return _0x182395(_0x165c46['error'][_0xd724('0x14')]);}else{logger[_0xd724('0x15')]('Setting,\x20%s,\x20%s',_0x3a8ff0,'request\x20sent');_0x182395(_0x165c46[_0xd724('0x16')][_0xd724('0x14')]);}})['catch'](function(_0x56a4e4){logger['error'](_0xd724('0xe'),_0x3a8ff0,_0x56a4e4);_0x2009bd(_0x56a4e4);});});}exports[_0xd724('0x17')]=function(_0x2f6607){var _0x111015=this;return new Promise(function(_0x43c2b7,_0x2e7691){return db[_0xd724('0x18')][_0xd724('0x19')]({'raw':_0x2f6607[_0xd724('0x1a')]?_0x2f6607[_0xd724('0x1a')][_0xd724('0x1b')]===undefined?!![]:![]:!![],'where':_0x2f6607[_0xd724('0x1a')]?_0x2f6607[_0xd724('0x1a')][_0xd724('0x1c')]||null:null,'attributes':_0x2f6607['options']?_0x2f6607['options'][_0xd724('0x1d')]||null:null,'include':_0x2f6607['options']?_0x2f6607['options'][_0xd724('0x1e')]?_[_0xd724('0x1f')](_0x2f6607['options']['include'],function(_0x13acf2){return{'model':db[_0x13acf2[_0xd724('0x20')]],'as':_0x13acf2['as'],'attributes':_0x13acf2[_0xd724('0x1d')],'include':_0x13acf2[_0xd724('0x1e')]?_['map'](_0x13acf2[_0xd724('0x1e')],function(_0x33c619){return{'model':db[_0x33c619['model']],'as':_0x33c619['as'],'attributes':_0x33c619['attributes'],'include':_0x33c619['include']?_[_0xd724('0x1f')](_0x33c619[_0xd724('0x1e')],function(_0x355518){return{'model':db[_0x355518[_0xd724('0x20')]],'as':_0x355518['as'],'attributes':_0x355518[_0xd724('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd724('0xd')](function(_0x1cfcbb){logger['info'](_0xd724('0x17'),_0x2f6607);logger[_0xd724('0x10')](_0xd724('0x17'),_0x2f6607,JSON[_0xd724('0x12')](_0x1cfcbb));_0x43c2b7(_0x1cfcbb);})[_0xd724('0x21')](function(_0x2428bb){logger[_0xd724('0x13')](_0xd724('0x17'),_0x2428bb['message'],_0x2f6607);_0x2e7691(_0x111015[_0xd724('0x13')](0x1f4,_0x2428bb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 55d057e..8c65781 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 _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(_0x90dfad,_0x4d127a){var _0x8cdcc7=function(_0x34b6e1){while(--_0x34b6e1){_0x90dfad['push'](_0x90dfad['shift']());}};_0x8cdcc7(++_0x4d127a);}(_0x814b,0x1a2));var _0xb814=function(_0x4df69e,_0x5131d5){_0x4df69e=_0x4df69e-0x0;var _0x1f9041=_0x814b[_0x4df69e];return _0x1f9041;};'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 +var _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x59016d,_0x41674f){var _0x236a98=function(_0x169179){while(--_0x169179){_0x59016d['push'](_0x59016d['shift']());}};_0x236a98(++_0x41674f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 52265f2..77d94d5 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 _0x96f2=['mandatoryDisposition','sequelize','randomstring','exports','name','STRING','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x173fef,_0xc5680e){var _0x43b4a4=function(_0x316f64){while(--_0x316f64){_0x173fef['push'](_0x173fef['shift']());}};_0x43b4a4(++_0xc5680e);}(_0x96f2,0x1b6));var _0x296f=function(_0x485fd4,_0x5821cc){_0x485fd4=_0x485fd4-0x0;var _0x257a58=_0x96f2[_0x485fd4];return _0x257a58;};'use strict';var Sequelize=require(_0x296f('0x0'));var rs=require(_0x296f('0x1'));module[_0x296f('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x296f('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x296f('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x296f('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x296f('0x5')](_0x296f('0x6'),_0x296f('0x7'),_0x296f('0x8'),_0x296f('0x9'),_0x296f('0xa'),_0x296f('0xb'),'bandwidth',_0x296f('0xc'),_0x296f('0xd'),_0x296f('0xe'))},'accountSid':{'type':Sequelize[_0x296f('0x4')]},'authId':{'type':Sequelize[_0x296f('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x296f('0x4')]},'password':{'type':Sequelize[_0x296f('0x4')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x296f('0x4')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x296f('0x4')]},'notificationTemplate':{'type':Sequelize[_0x296f('0xf')],'defaultValue':function(){return _0x296f('0x10');}},'notificationSound':{'type':Sequelize[_0x296f('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x296f('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x296f('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x296f('0x12')],'comment':_0x296f('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x296f('0x11')],'defaultValue':![],'comment':_0x296f('0x14'),'set':function(_0x37155c){if(!_0x37155c)this[_0x296f('0x15')]('mandatoryDispositionPauseId',null);this[_0x296f('0x15')](_0x296f('0x16'),_0x37155c);}}}; \ No newline at end of file +var _0x2150=['clicksend','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','ENUM','twilio'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x2150,0x14f));var _0x0215=function(_0x3be0c4,_0x5b7eff){_0x3be0c4=_0x3be0c4-0x0;var _0x11af9f=_0x2150[_0x3be0c4];return _0x11af9f;};'use strict';var Sequelize=require(_0x0215('0x0'));var rs=require(_0x0215('0x1'));module['exports']={'name':{'type':Sequelize[_0x0215('0x2')],'unique':_0x0215('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0215('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0215('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0215('0x2')],'defaultValue':function(){return rs[_0x0215('0x4')]();}},'phone':{'type':Sequelize[_0x0215('0x2')]},'type':{'type':Sequelize[_0x0215('0x5')](_0x0215('0x6'),'skebby','connectel',_0x0215('0x7'),'plivo',_0x0215('0x8'),_0x0215('0x9'),'csc',_0x0215('0xa'),_0x0215('0xb'))},'accountSid':{'type':Sequelize[_0x0215('0x2')]},'authId':{'type':Sequelize[_0x0215('0x2')]},'authToken':{'type':Sequelize[_0x0215('0x2')]},'smsMethod':{'type':Sequelize[_0x0215('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x0215('0x2')]},'password':{'type':Sequelize[_0x0215('0x2')]},'apiKey':{'type':Sequelize[_0x0215('0x2')]},'applicationId':{'type':Sequelize[_0x0215('0x2')]},'accountId':{'type':Sequelize[_0x0215('0x2')]},'senderString':{'type':Sequelize[_0x0215('0x2')]},'deliveryReport':{'type':Sequelize[_0x0215('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x0215('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0215('0xd');}},'notificationSound':{'type':Sequelize[_0x0215('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0215('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0215('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0215('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0215('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0215('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0215('0xe')],'comment':_0x0215('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x0215('0xc')],'defaultValue':![],'comment':_0x0215('0x10'),'set':function(_0x42c32f){if(!_0x42c32f)this[_0x0215('0x11')](_0x0215('0x12'),null);this[_0x0215('0x11')]('mandatoryDisposition',_0x42c32f);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 40d2e14..af973f7 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 _0x8c76=['text/xml','\x0a','addApplications','sequelize','Transaction','READ_COMMITTED','bulkCreate','send','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','clicksend','status_code','infobip','DELIVERED','groupName','clickatell','redif','error_code','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','User','eml-format','rimraf','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','Pause','intersection','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addDisposition','SmsAccountId','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','from','From','skebby','sender','text','message_id','plivo','Text','messageId','MessageUUID','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','CmList','CmContact','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio'];(function(_0x488f79,_0x305b4b){var _0x102892=function(_0x1af782){while(--_0x1af782){_0x488f79['push'](_0x488f79['shift']());}};_0x102892(++_0x305b4b);}(_0x8c76,0x117));var _0x68c7=function(_0x42d842,_0x5f5063){_0x42d842=_0x42d842-0x0;var _0x41bb03=_0x8c76[_0x42d842];return _0x41bb03;};'use strict';var emlformat=require(_0x68c7('0x0'));var rimraf=require(_0x68c7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x68c7('0x2'));var moment=require(_0x68c7('0x3'));var BPromise=require(_0x68c7('0x4'));var Mustache=require('mustache');var util=require(_0x68c7('0x5'));var path=require('path');var sox=require(_0x68c7('0x6'));var csv=require('to-csv');var ejs=require(_0x68c7('0x7'));var fs=require('fs');var fs_extra=require(_0x68c7('0x8'));var _=require(_0x68c7('0x9'));var squel=require(_0x68c7('0xa'));var crypto=require('crypto');var jsforce=require(_0x68c7('0xb'));var deskjs=require(_0x68c7('0xc'));var toCsv=require(_0x68c7('0xd'));var querystring=require('querystring');var Papa=require(_0x68c7('0xe'));var Redis=require('ioredis');var authService=require(_0x68c7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x68c7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68c7('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x68c7('0x12'));var licenseUtil=require(_0x68c7('0x13'));var db=require(_0x68c7('0x14'))['db'];config[_0x68c7('0x15')]=_[_0x68c7('0x16')](config[_0x68c7('0x15')],{'host':_0x68c7('0x17'),'port':0x18eb});var socket=require(_0x68c7('0x18'))(new Redis(config[_0x68c7('0x15')]));require(_0x68c7('0x19'))['register'](socket);var jayson=require(_0x68c7('0x1a'));var client=jayson[_0x68c7('0x1b')]['http']({'port':0x232c});function respondWithRpcPromise(_0x227787,_0x3b20b9,_0x35e0a7,_0x2b82ce){return new BPromise(function(_0x36e372,_0x3c9174){var _0x5cb84a=_0x2b82ce||client;return _0x5cb84a['request'](_0x227787,_0x35e0a7)[_0x68c7('0x1c')](function(_0x1cb5ba){logger[_0x68c7('0x1d')](_0x68c7('0x1e'),_0x3b20b9,_0x68c7('0x1f'));logger[_0x68c7('0x20')](_0x68c7('0x21'),_0x3b20b9,_0x68c7('0x1f'),JSON[_0x68c7('0x22')](_0x1cb5ba));if(_0x1cb5ba[_0x68c7('0x23')]){if(_0x1cb5ba['error'][_0x68c7('0x24')]===0x1f4){logger[_0x68c7('0x23')](_0x68c7('0x1e'),_0x3b20b9,_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);return _0x3c9174(_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);}logger['error'](_0x68c7('0x1e'),_0x3b20b9,_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);return _0x36e372(_0x1cb5ba[_0x68c7('0x23')][_0x68c7('0x25')]);}else{logger[_0x68c7('0x1d')](_0x68c7('0x1e'),_0x3b20b9,'request\x20sent');_0x36e372(_0x1cb5ba[_0x68c7('0x26')][_0x68c7('0x25')]);}})[_0x68c7('0x27')](function(_0x1eecd6){logger[_0x68c7('0x23')](_0x68c7('0x1e'),_0x3b20b9,_0x1eecd6);_0x3c9174(_0x1eecd6);});});}function respondWithStatusCode(_0x1848f0,_0x44dd08){_0x44dd08=_0x44dd08||0xcc;return function(_0x175c91){if(_0x175c91){return _0x1848f0[_0x68c7('0x28')](_0x44dd08);}return _0x1848f0['status'](_0x44dd08)[_0x68c7('0x29')]();};}function respondWithResult(_0x579e73,_0xc83077){_0xc83077=_0xc83077||0xc8;return function(_0x1b0c85){if(_0x1b0c85){return _0x579e73[_0x68c7('0x2a')](_0xc83077)[_0x68c7('0x2b')](_0x1b0c85);}};}function respondWithFilteredResult(_0x3e32a0,_0x5c446c){return function(_0x4cc79e){if(_0x4cc79e){var _0x22ccfc=typeof _0x5c446c[_0x68c7('0x2c')]===_0x68c7('0x2d')&&typeof _0x5c446c[_0x68c7('0x2e')]==='undefined';var _0x2a363a=_0x4cc79e[_0x68c7('0x2f')];var _0x5be58d=_0x22ccfc?0x0:_0x5c446c[_0x68c7('0x2c')];var _0x3bd661=_0x22ccfc?_0x4cc79e[_0x68c7('0x2f')]:_0x5c446c[_0x68c7('0x2c')]+_0x5c446c['limit'];var _0xb7f91b;if(_0x3bd661>=_0x2a363a){_0x3bd661=_0x2a363a;_0xb7f91b=0xc8;}else{_0xb7f91b=0xce;}_0x3e32a0[_0x68c7('0x2a')](_0xb7f91b);return _0x3e32a0['set']('Content-Range',_0x5be58d+'-'+_0x3bd661+'/'+_0x2a363a)[_0x68c7('0x2b')](_0x4cc79e);}return null;};}function patchUpdates(_0x3365b6){return function(_0x3ebc35){try{jsonpatch[_0x68c7('0x30')](_0x3ebc35,_0x3365b6,!![]);}catch(_0x55fdd6){return BPromise[_0x68c7('0x31')](_0x55fdd6);}return _0x3ebc35[_0x68c7('0x32')]();};}function saveUpdates(_0x54ba61,_0x309f82){return function(_0x59fc84){if(_0x59fc84){return _0x59fc84[_0x68c7('0x33')](_0x54ba61)[_0x68c7('0x1c')](function(_0x25e742){return _0x25e742;});}return null;};}function removeEntity(_0x2fab79,_0x2f24c3){return function(_0x1d515b){if(_0x1d515b){return _0x1d515b['destroy']()['then'](function(){var _0x1df7f1=_0x1d515b[_0x68c7('0x34')]({'plain':!![]});var _0x5078ae=_0x68c7('0x35');return db[_0x68c7('0x36')][_0x68c7('0x37')]({'where':{'type':_0x5078ae,'resourceId':_0x1df7f1['id']}})['then'](function(){return _0x1d515b;});})[_0x68c7('0x1c')](function(){_0x2fab79['status'](0xcc)[_0x68c7('0x29')]();});}};}function handleEntityNotFound(_0x333feb,_0x20be02){return function(_0x137f79){if(!_0x137f79){_0x333feb['sendStatus'](0x194);}return _0x137f79;};}function handleError(_0x3e7463,_0x5d15fc){_0x5d15fc=_0x5d15fc||0x1f4;return function(_0x5b864f){logger[_0x68c7('0x23')](_0x5b864f[_0x68c7('0x38')]);if(_0x5b864f[_0x68c7('0x39')]){delete _0x5b864f['name'];}_0x3e7463['status'](_0x5d15fc)['send'](_0x5b864f);};}exports[_0x68c7('0x3a')]=function(_0x22ffa2,_0x11dd18){var _0x4b1001={'include':[{'model':db['Pause'],'as':_0x68c7('0x3b')}]},_0x343770={},_0xf674c0={'count':0x0,'rows':[]};var _0x117d2e=_[_0x68c7('0x3c')](db[_0x68c7('0x3d')][_0x68c7('0x3e')],function(_0x1d6b58){return{'name':_0x1d6b58[_0x68c7('0x3f')],'type':_0x1d6b58[_0x68c7('0x40')]['key']};});_0x343770[_0x68c7('0x41')]=_[_0x68c7('0x3c')](_0x117d2e,'name');_0x343770[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x22ffa2[_0x68c7('0x42')]);_0x343770[_0x68c7('0x44')]=_['intersection'](_0x343770[_0x68c7('0x41')],_0x343770['query']);_0x4b1001[_0x68c7('0x45')]=_['intersection'](_0x343770[_0x68c7('0x41')],qs['fields'](_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x46')]));_0x4b1001[_0x68c7('0x45')]=_0x4b1001[_0x68c7('0x45')][_0x68c7('0x47')]?_0x4b1001[_0x68c7('0x45')]:_0x343770[_0x68c7('0x41')];if(!_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x48')](_0x68c7('0x49'))){_0x4b1001[_0x68c7('0x2e')]=qs['limit'](_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x4b1001[_0x68c7('0x2c')]=qs['offset'](_0x22ffa2[_0x68c7('0x42')]['offset']);}_0x4b1001[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x22ffa2[_0x68c7('0x42')]['sort']);_0x4b1001['where']=qs[_0x68c7('0x44')](_['pick'](_0x22ffa2[_0x68c7('0x42')],_0x343770[_0x68c7('0x44')]),_0x117d2e);if(_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x4b1001[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x4b1001[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x117d2e,function(_0x4e6b54){if(_0x4e6b54['type']!==_0x68c7('0x4f')){var _0x41f0a5={};_0x41f0a5[_0x4e6b54[_0x68c7('0x39')]]={'$like':'%'+_0x22ffa2[_0x68c7('0x42')]['filter']+'%'};return _0x41f0a5;}})});}_0x4b1001=_[_0x68c7('0x4e')]({},_0x4b1001,_0x22ffa2[_0x68c7('0x50')]);var _0x24fc09={'where':_0x4b1001[_0x68c7('0x4d')]};return db[_0x68c7('0x3d')][_0x68c7('0x2f')](_0x24fc09)['then'](function(_0x887177){_0xf674c0[_0x68c7('0x2f')]=_0x887177;if(_0x22ffa2[_0x68c7('0x42')][_0x68c7('0x51')]){_0x4b1001['include']=[{'all':!![]}];}return db['SmsAccount'][_0x68c7('0x52')](_0x4b1001);})[_0x68c7('0x1c')](function(_0x3fcfd3){_0xf674c0[_0x68c7('0x53')]=_0x3fcfd3;return _0xf674c0;})[_0x68c7('0x1c')](respondWithFilteredResult(_0x11dd18,_0x4b1001))[_0x68c7('0x27')](handleError(_0x11dd18,null));};exports[_0x68c7('0x54')]=function(_0x1e0cf0,_0x2da4f2){var _0x54641d={'raw':![],'where':{'id':_0x1e0cf0[_0x68c7('0x55')]['id']},'include':[{'model':db[_0x68c7('0x56')],'as':_0x68c7('0x3b')}]},_0x538349={};_0x538349['model']=_[_0x68c7('0x43')](db[_0x68c7('0x3d')][_0x68c7('0x3e')]);_0x538349[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x1e0cf0['query']);_0x538349['filters']=_[_0x68c7('0x57')](_0x538349['model'],_0x538349['query']);_0x54641d[_0x68c7('0x45')]=_['intersection'](_0x538349['model'],qs[_0x68c7('0x46')](_0x1e0cf0[_0x68c7('0x42')][_0x68c7('0x46')]));_0x54641d[_0x68c7('0x45')]=_0x54641d[_0x68c7('0x45')]['length']?_0x54641d['attributes']:_0x538349[_0x68c7('0x41')];if(_0x1e0cf0[_0x68c7('0x42')][_0x68c7('0x51')]){_0x54641d[_0x68c7('0x58')]=[{'all':!![]}];}_0x54641d=_[_0x68c7('0x4e')]({},_0x54641d,_0x1e0cf0[_0x68c7('0x50')]);return db[_0x68c7('0x3d')][_0x68c7('0x59')](_0x54641d)['then'](handleEntityNotFound(_0x2da4f2,null))['then'](respondWithResult(_0x2da4f2,null))[_0x68c7('0x27')](handleError(_0x2da4f2,null));};exports[_0x68c7('0x5a')]=function(_0x498db2,_0x3d1e3e){return db[_0x68c7('0x3d')][_0x68c7('0x5a')](_0x498db2['body'],{})[_0x68c7('0x1c')](function(_0x534cc8){var _0x2af087=_0x498db2['user'][_0x68c7('0x34')]({'plain':!![]});if(!_0x2af087)throw new Error(_0x68c7('0x5b'));if(_0x2af087[_0x68c7('0x5c')]===_0x68c7('0x5d')){var _0x26fc02=_0x534cc8[_0x68c7('0x34')]({'plain':!![]});var _0x501230='SmsAccounts';return db['UserProfileSection'][_0x68c7('0x59')]({'where':{'name':_0x501230,'userProfileId':_0x2af087['userProfileId']},'raw':!![]})[_0x68c7('0x1c')](function(_0x15f18f){if(_0x15f18f&&_0x15f18f[_0x68c7('0x5e')]===0x0){return db[_0x68c7('0x36')][_0x68c7('0x5a')]({'name':_0x26fc02[_0x68c7('0x39')],'resourceId':_0x26fc02['id'],'type':_0x15f18f['name'],'sectionId':_0x15f18f['id']},{})[_0x68c7('0x1c')](function(){return _0x534cc8;});}else{return _0x534cc8;}})[_0x68c7('0x27')](function(_0x4b2eca){logger[_0x68c7('0x23')](_0x68c7('0x5f'),_0x4b2eca);throw _0x4b2eca;});}return _0x534cc8;})[_0x68c7('0x1c')](respondWithResult(_0x3d1e3e,0xc9))[_0x68c7('0x27')](handleError(_0x3d1e3e,null));};exports[_0x68c7('0x33')]=function(_0x4286c1,_0x9e7738){if(_0x4286c1['body']['id']){delete _0x4286c1['body']['id'];}return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x4286c1['params']['id']},'include':[{'model':db[_0x68c7('0x56')],'as':'mandatoryDispositionPause'}]})[_0x68c7('0x1c')](handleEntityNotFound(_0x9e7738,null))['then'](saveUpdates(_0x4286c1[_0x68c7('0x60')],null))[_0x68c7('0x1c')](respondWithResult(_0x9e7738,null))[_0x68c7('0x27')](handleError(_0x9e7738,null));};exports[_0x68c7('0x37')]=function(_0x53b9e1,_0x2d09ef){return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x53b9e1[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x2d09ef,null))['then'](removeEntity(_0x2d09ef,null))[_0x68c7('0x27')](handleError(_0x2d09ef,null));};exports['describe']=function(_0x1d2d96,_0x4e96dd){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x4e96dd,null))[_0x68c7('0x27')](handleError(_0x4e96dd,null));};exports[_0x68c7('0x61')]=function(_0x56c0da,_0x3e94f8,_0x357590){if(_0x56c0da[_0x68c7('0x60')]['id']){delete _0x56c0da[_0x68c7('0x60')]['id'];}return db['SmsAccount']['find']({'where':{'id':_0x56c0da[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3e94f8,null))[_0x68c7('0x1c')](function(_0x466a4c){if(_0x466a4c){_0x56c0da[_0x68c7('0x60')][_0x68c7('0x62')]=_0x466a4c['id'];return db['Disposition'][_0x68c7('0x5a')](_0x56c0da[_0x68c7('0x60')]);}})[_0x68c7('0x1c')](respondWithResult(_0x3e94f8,null))['catch'](handleError(_0x3e94f8,null));};exports['getDispositions']=function(_0x536d01,_0x39d227,_0x15e6a3){var _0x114c43={'raw':![],'where':{}};var _0x37106c={};var _0x95f6bc={'count':0x0,'rows':[]};return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x536d01[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x39d227,null))[_0x68c7('0x1c')](function(_0x2a31c9){if(_0x2a31c9){_0x37106c[_0x68c7('0x41')]=_['keys'](db[_0x68c7('0x64')][_0x68c7('0x3e')]);_0x37106c[_0x68c7('0x42')]=_['keys'](_0x536d01[_0x68c7('0x42')]);_0x37106c[_0x68c7('0x44')]=_['intersection'](_0x37106c[_0x68c7('0x41')],_0x37106c[_0x68c7('0x42')]);_0x114c43['attributes']=_['intersection'](_0x37106c[_0x68c7('0x41')],qs[_0x68c7('0x46')](_0x536d01[_0x68c7('0x42')][_0x68c7('0x46')]));_0x114c43['attributes']=_0x114c43['attributes'][_0x68c7('0x47')]?_0x114c43['attributes']:_0x37106c[_0x68c7('0x41')];if(!_0x536d01['query'][_0x68c7('0x48')](_0x68c7('0x49'))){_0x114c43[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0x536d01['query'][_0x68c7('0x2e')]);_0x114c43['offset']=qs[_0x68c7('0x2c')](_0x536d01[_0x68c7('0x42')][_0x68c7('0x2c')]);}_0x114c43['order']=qs['sort'](_0x536d01[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x114c43[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_['pick'](_0x536d01[_0x68c7('0x42')],_0x37106c['filters']));_0x114c43[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x2a31c9['id'];if(_0x536d01[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x114c43[_0x68c7('0x4d')]=_['merge'](_0x114c43[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x114c43[_0x68c7('0x45')],function(_0x35bf15){var _0x257cff={};_0x257cff[_0x35bf15]={'$like':'%'+_0x536d01[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x257cff;})});}_0x114c43=_['merge']({},_0x114c43,_0x536d01['options']);return db[_0x68c7('0x64')][_0x68c7('0x2f')]({'where':_0x114c43['where']})[_0x68c7('0x1c')](function(_0x3c0dfb){_0x95f6bc[_0x68c7('0x2f')]=_0x3c0dfb;if(_0x536d01['query'][_0x68c7('0x51')]){_0x114c43['include']=[{'all':!![]}];}return db[_0x68c7('0x64')][_0x68c7('0x52')](_0x114c43);})['then'](function(_0x47b603){_0x95f6bc[_0x68c7('0x53')]=_0x47b603;return _0x95f6bc;});}})[_0x68c7('0x1c')](respondWithFilteredResult(_0x39d227,_0x114c43))[_0x68c7('0x27')](handleError(_0x39d227,null));};exports[_0x68c7('0x65')]=function(_0x457540,_0x4430c1,_0x321313){return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x457540['params']['id']}})['then'](handleEntityNotFound(_0x4430c1,null))['then'](function(_0x48c5a4){if(_0x48c5a4){return _0x48c5a4[_0x68c7('0x65')](_0x457540[_0x68c7('0x42')][_0x68c7('0x66')]);}})[_0x68c7('0x1c')](respondWithStatusCode(_0x4430c1,null))[_0x68c7('0x27')](handleError(_0x4430c1,null));};exports[_0x68c7('0x67')]=function(_0x59a8fd,_0x232fdb,_0x1b5edc){if(_0x59a8fd[_0x68c7('0x60')]['id']){delete _0x59a8fd[_0x68c7('0x60')]['id'];}return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x59a8fd[_0x68c7('0x55')]['id']}})['then'](handleEntityNotFound(_0x232fdb,null))[_0x68c7('0x1c')](function(_0x50f4ef){if(_0x50f4ef){_0x59a8fd[_0x68c7('0x60')]['SmsAccountId']=_0x50f4ef['id'];return db[_0x68c7('0x68')][_0x68c7('0x5a')](_0x59a8fd[_0x68c7('0x60')]);}})[_0x68c7('0x1c')](respondWithResult(_0x232fdb,null))[_0x68c7('0x27')](handleError(_0x232fdb,null));};exports[_0x68c7('0x69')]=function(_0x492163,_0x3c033c,_0x5030c4){var _0x10b178={'raw':![],'where':{}};var _0x4d8109={};var _0x12f4e4={'count':0x0,'rows':[]};return db['SmsAccount'][_0x68c7('0x63')]({'where':{'id':_0x492163[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3c033c,null))[_0x68c7('0x1c')](function(_0x1bf664){if(_0x1bf664){_0x4d8109[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0x68')][_0x68c7('0x3e')]);_0x4d8109[_0x68c7('0x42')]=_[_0x68c7('0x43')](_0x492163[_0x68c7('0x42')]);_0x4d8109[_0x68c7('0x44')]=_[_0x68c7('0x57')](_0x4d8109[_0x68c7('0x41')],_0x4d8109['query']);_0x10b178['attributes']=_[_0x68c7('0x57')](_0x4d8109[_0x68c7('0x41')],qs['fields'](_0x492163['query'][_0x68c7('0x46')]));_0x10b178[_0x68c7('0x45')]=_0x10b178[_0x68c7('0x45')][_0x68c7('0x47')]?_0x10b178[_0x68c7('0x45')]:_0x4d8109['model'];if(!_0x492163[_0x68c7('0x42')]['hasOwnProperty'](_0x68c7('0x49'))){_0x10b178[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0x492163[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x10b178[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x492163[_0x68c7('0x42')][_0x68c7('0x2c')]);}_0x10b178[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x492163[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x10b178['where']=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x492163['query'],_0x4d8109['filters']));_0x10b178[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x1bf664['id'];if(_0x492163[_0x68c7('0x42')][_0x68c7('0x4c')]){_0x10b178['where']=_[_0x68c7('0x4e')](_0x10b178['where'],{'$or':_[_0x68c7('0x3c')](_0x10b178[_0x68c7('0x45')],function(_0x8b539f){var _0x59ef8e={};_0x59ef8e[_0x8b539f]={'$like':'%'+_0x492163[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x59ef8e;})});}_0x10b178=_['merge']({},_0x10b178,_0x492163[_0x68c7('0x50')]);return db[_0x68c7('0x68')][_0x68c7('0x2f')]({'where':_0x10b178[_0x68c7('0x4d')]})[_0x68c7('0x1c')](function(_0x4ad247){_0x12f4e4[_0x68c7('0x2f')]=_0x4ad247;if(_0x492163[_0x68c7('0x42')][_0x68c7('0x51')]){_0x10b178[_0x68c7('0x58')]=[{'all':!![]}];}return db[_0x68c7('0x68')][_0x68c7('0x52')](_0x10b178);})[_0x68c7('0x1c')](function(_0x304d1d){_0x12f4e4[_0x68c7('0x53')]=_0x304d1d;return _0x12f4e4;});}})['then'](respondWithFilteredResult(_0x3c033c,_0x10b178))[_0x68c7('0x27')](handleError(_0x3c033c,null));};exports[_0x68c7('0x6b')]=function(_0x59c724,_0x29b06a,_0x55e044){return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x59c724[_0x68c7('0x55')]['id']}})['then'](handleEntityNotFound(_0x29b06a,null))['then'](function(_0x193ccc){if(_0x193ccc){return _0x193ccc['removeAnswers'](_0x59c724[_0x68c7('0x42')][_0x68c7('0x66')]);}})['then'](respondWithStatusCode(_0x29b06a,null))[_0x68c7('0x27')](handleError(_0x29b06a,null));};exports[_0x68c7('0x6c')]=function(_0x2e5cc2,_0xf5d897,_0xfe51a4){var _0x245e16={'channel':_0x68c7('0x6d')};var _0x30bf09=[];var _0x54d3d6=[];var _0x18eb00={};return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x2e5cc2['params']['id']},'include':[{'model':db[_0x68c7('0x6e')],'as':_0x68c7('0x6f')}]})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))[_0x68c7('0x1c')](function(_0x5e331e){_0x245e16[_0x68c7('0x70')]=_0x5e331e;_0x245e16[_0x68c7('0x71')]=_['orderBy'](_0x5e331e[_0x68c7('0x6f')],[_0x68c7('0x72')],[_0x68c7('0x73')]);if(_0x245e16[_0x68c7('0x70')]['Applications']){delete _0x245e16[_0x68c7('0x70')][_0x68c7('0x6f')];}return db['CmContact']['describe']();})[_0x68c7('0x1c')](function(_0x23a47d){if(!_0x23a47d){throw new db[(_0x68c7('0x74'))]['ValidationError'](_0x68c7('0x75'));}_0x30bf09=_['difference'](_[_0x68c7('0x43')](_0x23a47d),[_0x68c7('0x76'),'updatedAt']);_0x54d3d6=_[_0x68c7('0x77')](_[_0x68c7('0x43')](_0x23a47d),[_0x68c7('0x76'),_0x68c7('0x78'),_0x68c7('0x79'),_0x68c7('0x7a')]);_0x245e16[_0x68c7('0x60')]={'mapKey':_0x68c7('0x7b')};if(_0x245e16[_0x68c7('0x70')][_0x68c7('0x40')]){switch(_0x245e16['account']['type']){case'twilio':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]=_0x2e5cc2['body'][_0x68c7('0x7d')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')]['Body'];_0x245e16[_0x68c7('0x60')]['messageId']=_0x2e5cc2['body']['MessageSid'];break;case _0x68c7('0x7e'):_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]='+'+_0x2e5cc2['body'][_0x68c7('0x7f')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x80')];break;case'connectel':_0x245e16['body'][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')]['message'];break;case'clicksend':_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2[_0x68c7('0x60')]['from'];_0x245e16[_0x68c7('0x60')]['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x60')];_0x245e16[_0x68c7('0x60')]['messageId']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x81')];break;case _0x68c7('0x82'):_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2['body'][_0x68c7('0x7d')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x83')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x85')];break;case'infobip':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]='+'+_0x2e5cc2['body']['results'][0x0][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x86')][0x0]['text'];_0x245e16['body'][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x86')][0x0]['messageId'];break;case _0x68c7('0x87'):_0x245e16['body'][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x88')];_0x245e16['body']['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x89')]['message'];break;case'clickatell':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8a')];_0x245e16[_0x68c7('0x60')]['body']=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x80')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8b')];break;case _0x68c7('0x8c'):_0x245e16['body']['messageId']=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')]['id'];_0x245e16[_0x68c7('0x60')]['from']=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')][_0x68c7('0x7c')];_0x245e16['body'][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][0x0][_0x68c7('0x25')]['text'];break;case _0x68c7('0x8d'):_0x245e16['body']['from']=_0x2e5cc2['body'][_0x68c7('0x7c')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x25')];_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')]=_0x2e5cc2[_0x68c7('0x60')][_0x68c7('0x8e')];break;}}if(_0x245e16[_0x68c7('0x60')]['id']){delete _0x245e16['body']['id'];}if(_[_0x68c7('0x8f')](_0x245e16['body'][_0x68c7('0x7c')])){throw new db['Sequelize']['ValidationError'](_0x68c7('0x90'));}if(_[_0x68c7('0x8f')](_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')])||_0x245e16['body']['body']===''){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x68c7('0x8f')](_0x245e16[_0x68c7('0x60')]['mapKey'])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))](_0x68c7('0x92')+_0x54d3d6);}if(!_[_0x68c7('0x93')](_0x54d3d6,_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x54d3d6);}_0x18eb00[_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')]]=_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')];return db[_0x68c7('0x95')][_0x68c7('0x59')]({'where':{'id':_0x245e16[_0x68c7('0x70')]['ListId']},'include':[{'model':db[_0x68c7('0x96')],'as':_0x68c7('0x97'),'where':_0x18eb00,'limit':0x1,'order':[[_0x68c7('0x78'),_0x68c7('0x98')]]}]});})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))['then'](function(_0x196bbc){if(_0x196bbc){_0x245e16['list']=_[_0x68c7('0x99')](_0x196bbc,[_0x68c7('0x97')]);if(_0x196bbc['Contacts'][_0x68c7('0x47')]){return _0x196bbc[_0x68c7('0x97')][0x0];}var _0xf0ed2e=_['defaults'](_0x245e16[_0x68c7('0x60')],{'firstName':_0x245e16[_0x68c7('0x60')]['from'],'ListId':_0x196bbc['id']});_0xf0ed2e[_0x245e16[_0x68c7('0x60')][_0x68c7('0x94')]]=_0x245e16[_0x68c7('0x60')]['from'];return db['CmContact'][_0x68c7('0x5a')](_0xf0ed2e,{'fields':_0x30bf09,'raw':!![]});}})[_0x68c7('0x1c')](handleEntityNotFound(_0xf5d897,null))[_0x68c7('0x1c')](function(_0x1e0232){if(_0x1e0232){_0x245e16[_0x68c7('0x9a')]=_0x1e0232;var _0x5dfad7={'ContactId':_0x1e0232['id'],'phone':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')],'SmsAccountId':_0x2e5cc2['params']['id']};var _0x5e6ac8={'ContactId':_0x1e0232['id'],'SmsAccountId':_0x2e5cc2[_0x68c7('0x55')]['id'],'closed':![]};return db[_0x68c7('0x9b')][_0x68c7('0x59')]({'where':_0x5e6ac8})[_0x68c7('0x1c')](function(_0x2a2b20){if(_0x2a2b20){return[_0x2a2b20,![]];}return db[_0x68c7('0x9b')][_0x68c7('0x5a')](_0x5dfad7)['then'](function(_0x1a117d){return[_0x1a117d,!![]];});});}})[_0x68c7('0x9c')](function(_0x53011a,_0x54caf0){_0x245e16[_0x68c7('0x9d')]=_0x53011a[_0x68c7('0x34')]({'plain':!![]});_0x245e16[_0x68c7('0x9d')][_0x68c7('0x9e')]=![];if(_0x54caf0){if(_0x245e16['account'][_0x68c7('0x9f')]){_0x245e16['applications'][_0x68c7('0xa0')]({'id':0x0,'priority':_0x245e16['applications'][_0x68c7('0x47')]+0x1,'app':_0x68c7('0xa1'),'appdata':_0x68c7('0xa2'),'interval':'*,*,*,*'});}_0x245e16[_0x68c7('0x9d')][_0x68c7('0x9e')]=!![];}return db['SmsMessage'][_0x68c7('0x5a')]({'phone':_0x245e16[_0x68c7('0x60')][_0x68c7('0x7c')],'messageId':_0x245e16[_0x68c7('0x60')][_0x68c7('0x84')],'body':_0x245e16[_0x68c7('0x60')][_0x68c7('0x60')],'SmsAccountId':_0x2e5cc2[_0x68c7('0x55')]['id'],'SmsInteractionId':_0x53011a['id'],'direction':'in','ContactId':_0x53011a[_0x68c7('0xa3')],'AttachmentId':_0x245e16[_0x68c7('0x60')][_0x68c7('0xa4')]});})[_0x68c7('0x1c')](function(_0x3f8d15){_0x245e16['message']=_0x3f8d15;if(_0x245e16[_0x68c7('0x9d')][_0x68c7('0xa5')]){return db['User']['find']({'attributes':['id',_0x68c7('0x39')],'where':{'id':_0x245e16['interaction']['UserId']}})[_0x68c7('0x1c')](function(_0x37db10){if(_0x37db10){_0x245e16['applications'][_0x68c7('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x37db10[_0x68c7('0x39')]+','+(_0x245e16[_0x68c7('0x70')][_0x68c7('0xa7')]||0xa),'interval':_0x68c7('0xa8')});}return respondWithRpcPromise('Start',_0x68c7('0xa9'),_0x245e16);});}return respondWithRpcPromise(_0x68c7('0xaa'),_0x68c7('0xa9'),_0x245e16);})[_0x68c7('0x1c')](function(_0x16c120){if(_0x16c120){var _0x424e91=0xc8;var _0xc517a0=_0x68c7('0xab');logger['info'](_0x68c7('0x21'),_0xc517a0,_0x424e91,_0x68c7('0xac'));logger[_0x68c7('0x20')](_0x68c7('0xad'),_0xc517a0,_0x424e91,_0x68c7('0xac'),JSON[_0x68c7('0x22')](_0x16c120));if(_0x245e16[_0x68c7('0x70')][_0x68c7('0x40')]===_0x68c7('0xae')){return _0xf5d897[_0x68c7('0x2a')](_0x424e91)['set']('Content-Type',_0x68c7('0xaf'))['send'](_0x68c7('0xb0'));}else{return _0xf5d897['status'](_0x424e91)['json'](_0x16c120);}}})[_0x68c7('0x27')](handleError(_0xf5d897,null));};exports[_0x68c7('0xb1')]=function(_0x3708a6,_0x596d1c){var _0x249765=_0x3708a6['params']['id'];var _0x4c4029=_0x3708a6[_0x68c7('0x60')];var _0x508cc2=0xc8;var _0x24b5b4=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x68c7('0xb2')][_0x68c7('0xb3')]['ISOLATION_LEVELS'][_0x68c7('0xb4')]},function(_0x1be971){return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x249765},'transaction':_0x1be971})[_0x68c7('0x1c')](function(_0x1755ed){if(_0x1755ed){return db[_0x68c7('0x6e')]['destroy']({'where':{'SmsAccountId':_0x249765},'transaction':_0x1be971})[_0x68c7('0x1c')](function(){var _0x36ff25=_[_0x68c7('0x3c')](_0x4c4029,function(_0x99127f){_0x99127f['SmsAccountId']=_0x249765;return _0x99127f;});return db[_0x68c7('0x6e')][_0x68c7('0xb5')](_0x36ff25,{'transaction':_0x1be971});});}else{_0x508cc2=0x194;_0x24b5b4=[];}});})['then'](function(){if(_0x508cc2!==0x194){return db[_0x68c7('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x249765},'order':'priority'})[_0x68c7('0x1c')](function(_0x11dbc2){_0x24b5b4=_0x11dbc2;});}})[_0x68c7('0x27')](function(_0x270350){_0x508cc2=0x1f4;logger[_0x68c7('0x23')](_0x270350[_0x68c7('0x38')]);if(_0x270350[_0x68c7('0x39')]){delete _0x270350[_0x68c7('0x39')];}_0x24b5b4=_0x270350;})['finally'](function(){if(_0x24b5b4===null){_0x596d1c[_0x68c7('0x28')](_0x508cc2);}else{if(_0x508cc2===0x1f4){_0x596d1c[_0x68c7('0x2a')](_0x508cc2)[_0x68c7('0xb6')](_0x24b5b4);}else{_0x596d1c[_0x68c7('0x2a')](_0x508cc2)['json'](_0x24b5b4);}}});};exports['getApplications']=function(_0x8e013a,_0x370597,_0x2864a3){var _0x46a60b={};var _0x8b222e={};var _0x435c59;var _0x16d0b0;return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x8e013a[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x370597,null))['then'](function(_0x2b6335){if(_0x2b6335){_0x435c59=_0x2b6335;_0x8b222e[_0x68c7('0x41')]=_[_0x68c7('0x43')](db['SmsApplication'][_0x68c7('0x3e')]);_0x8b222e[_0x68c7('0x42')]=_['keys'](_0x8e013a[_0x68c7('0x42')]);_0x8b222e[_0x68c7('0x44')]=_['intersection'](_0x8b222e[_0x68c7('0x41')],_0x8b222e[_0x68c7('0x42')]);_0x46a60b[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x8b222e[_0x68c7('0x41')],qs['fields'](_0x8e013a[_0x68c7('0x42')]['fields']));_0x46a60b['attributes']=_0x46a60b[_0x68c7('0x45')][_0x68c7('0x47')]?_0x46a60b['attributes']:_0x8b222e[_0x68c7('0x41')];_0x46a60b['order']=qs[_0x68c7('0x4b')](_0x8e013a[_0x68c7('0x42')]['sort']);_0x46a60b[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x8e013a[_0x68c7('0x42')],_0x8b222e[_0x68c7('0x44')]));if(_0x8e013a[_0x68c7('0x42')]['filter']){_0x46a60b[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x46a60b[_0x68c7('0x4d')],{'$or':_[_0x68c7('0x3c')](_0x46a60b[_0x68c7('0x45')],function(_0x2638fd){var _0xbf6432={};_0xbf6432[_0x2638fd]={'$like':'%'+_0x8e013a['query']['filter']+'%'};return _0xbf6432;})});}_0x46a60b=_['merge']({},_0x46a60b,_0x8e013a[_0x68c7('0x50')]);return _0x435c59[_0x68c7('0xb7')](_0x46a60b);}})[_0x68c7('0x1c')](function(_0x54ba19){if(_0x54ba19){_0x16d0b0=_0x54ba19[_0x68c7('0x47')];if(!_0x8e013a[_0x68c7('0x42')][_0x68c7('0x48')]('nolimit')){_0x46a60b['limit']=qs[_0x68c7('0x2e')](_0x8e013a[_0x68c7('0x42')][_0x68c7('0x2e')]);_0x46a60b[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x8e013a['query'][_0x68c7('0x2c')]);}return _0x435c59['getApplications'](_0x46a60b);}})[_0x68c7('0x1c')](function(_0x50f1b3){if(_0x50f1b3){return _0x50f1b3?{'count':_0x16d0b0,'rows':_0x50f1b3}:null;}})[_0x68c7('0x1c')](respondWithResult(_0x370597,null))[_0x68c7('0x27')](handleError(_0x370597,null));};exports[_0x68c7('0xb8')]=function(_0x3bb124,_0x3c72e1,_0x5d53f5){var _0x5db3d8={'raw':![],'where':{}};var _0x19dbeb={};var _0x5ebfcc={'count':0x0,'rows':[]};return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0x3bb124[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x3c72e1,null))[_0x68c7('0x1c')](function(_0x5da704){if(_0x5da704){_0x19dbeb[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0x9b')]['rawAttributes']);_0x19dbeb['query']=_['keys'](_0x3bb124[_0x68c7('0x42')]);_0x19dbeb[_0x68c7('0x44')]=_[_0x68c7('0x57')](_0x19dbeb[_0x68c7('0x41')],_0x19dbeb['query']);_0x5db3d8[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x19dbeb['model'],qs[_0x68c7('0x46')](_0x3bb124[_0x68c7('0x42')]['fields']));_0x5db3d8[_0x68c7('0x45')]=_0x5db3d8[_0x68c7('0x45')][_0x68c7('0x47')]?_0x5db3d8[_0x68c7('0x45')]:_0x19dbeb[_0x68c7('0x41')];if(!_0x3bb124['query'][_0x68c7('0x48')](_0x68c7('0x49'))){_0x5db3d8[_0x68c7('0x2e')]=qs['limit'](_0x3bb124[_0x68c7('0x42')]['limit']);_0x5db3d8[_0x68c7('0x2c')]=qs[_0x68c7('0x2c')](_0x3bb124['query'][_0x68c7('0x2c')]);}_0x5db3d8[_0x68c7('0x4a')]=qs[_0x68c7('0x4b')](_0x3bb124[_0x68c7('0x42')]['sort']);_0x5db3d8[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0x3bb124[_0x68c7('0x42')],_0x19dbeb[_0x68c7('0x44')]));_0x5db3d8[_0x68c7('0x4d')][_0x68c7('0x62')]=_0x5da704['id'];if(_0x3bb124[_0x68c7('0x42')]['filter']){_0x5db3d8[_0x68c7('0x4d')]=_[_0x68c7('0x4e')](_0x5db3d8[_0x68c7('0x4d')],{'$or':_['map'](_0x5db3d8[_0x68c7('0x45')],function(_0x4a131f){var _0x5ec63={};_0x5ec63[_0x4a131f]={'$like':'%'+_0x3bb124['query']['filter']+'%'};return _0x5ec63;})});}_0x5db3d8=_[_0x68c7('0x4e')]({},_0x5db3d8,_0x3bb124[_0x68c7('0x50')]);return db[_0x68c7('0x9b')][_0x68c7('0x2f')]({'where':_0x5db3d8[_0x68c7('0x4d')]})['then'](function(_0x583404){_0x5ebfcc['count']=_0x583404;if(_0x3bb124[_0x68c7('0x42')][_0x68c7('0x51')]){_0x5db3d8[_0x68c7('0x58')]=[{'model':db[_0x68c7('0x96')],'as':_0x68c7('0xb9'),'required':![]},{'model':db['User'],'as':_0x68c7('0xba'),'attributes':[_0x68c7('0x39'),_0x68c7('0xbb'),'internal'],'required':![]},{'model':db[_0x68c7('0xbc')],'as':_0x68c7('0xbd'),'attributes':['id',_0x68c7('0x39'),_0x68c7('0xbe')],'where':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]?{'id':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]}:undefined,'required':_0x3bb124[_0x68c7('0x42')][_0x68c7('0xbf')]?!![]:![]}];}return db[_0x68c7('0x9b')]['findAll'](_0x5db3d8);})[_0x68c7('0x1c')](function(_0x40d9ce){_0x5ebfcc['rows']=_0x40d9ce;return _0x5ebfcc;});}})[_0x68c7('0x1c')](respondWithFilteredResult(_0x3c72e1,_0x5db3d8))[_0x68c7('0x27')](handleError(_0x3c72e1,null));};exports[_0x68c7('0xb6')]=function(_0x1c34cf,_0x528649,_0x459e82){var _0x538aed,_0x1e81df,_0x9152e8;if(_['isNil'](_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')])||_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')]===''){throw new db['Sequelize'][(_0x68c7('0x91'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x68c7('0x8f')](_0x1c34cf['body']['to'])){throw new db[(_0x68c7('0x74'))][(_0x68c7('0x91'))](_0x68c7('0xc0'));}_0x538aed=_0x1c34cf[_0x68c7('0x60')]['to'];return db[_0x68c7('0x3d')]['find']({'where':{'id':_0x1c34cf['params']['id']},'include':[{'model':db[_0x68c7('0x95')],'as':'List','include':[{'model':db['CmContact'],'as':_0x68c7('0x97'),'where':{'mobile':_0x538aed},'limit':0x1,'order':[[_0x68c7('0x78'),_0x68c7('0x98')]]}]}]})['then'](handleEntityNotFound(_0x528649,null))[_0x68c7('0x1c')](function(_0x137831){if(_0x137831&&_0x137831[_0x68c7('0xc1')]){_0x1e81df=_0x137831[_0x68c7('0x34')]({'plain':!![]});if(_0x1e81df[_0x68c7('0xc1')]&&_0x1e81df['List'][_0x68c7('0x97')]['length']){return _0x1e81df['List'][_0x68c7('0x97')][0x0];}return db[_0x68c7('0x96')]['create'](_['defaults'](_0x1c34cf['body'],{'firstName':_0x538aed,'mobile':_0x538aed,'phone':_0x538aed,'ListId':_0x1e81df[_0x68c7('0x7a')]}));}})['then'](handleEntityNotFound(_0x528649,null))[_0x68c7('0x1c')](function(_0x578e4c){if(_0x578e4c){_0x9152e8=_0x578e4c;return db[_0x68c7('0x9b')][_0x68c7('0x59')]({'where':{'ContactId':_0x9152e8['id'],'closed':![],'SmsAccountId':_0x1e81df['id']}})['then'](function(_0x2bb290){if(_0x2bb290){return[_0x2bb290,![]];}return db[_0x68c7('0x9b')]['create']({'UserId':_0x1c34cf[_0x68c7('0x5d')]['id'],'ContactId':_0x9152e8['id'],'SmsAccountId':_0x1e81df['id'],'phone':_0x538aed,'firstMsgDirection':_0x68c7('0xc2'),'Messages':[_['merge'](_0x1c34cf['body'],{'read':![],'body':_0x1c34cf[_0x68c7('0x60')]['body'],'phone':_0x538aed,'SmsAccountId':_0x1e81df['id'],'UserId':_0x1c34cf['user']['id'],'ContactId':_0x9152e8['id']})]},{'include':[{'model':db[_0x68c7('0xc3')],'as':_0x68c7('0xc4')}]})['then'](function(_0x3e6759){return[_0x3e6759,!![]];});});}})['spread'](function(_0xe96788,_0x3ecaf1){if(_0x3ecaf1){return _0xe96788;}return db[_0x68c7('0xc3')][_0x68c7('0x5a')](_[_0x68c7('0x4e')](_0x1c34cf[_0x68c7('0x60')],{'read':![],'body':_0x1c34cf[_0x68c7('0x60')][_0x68c7('0x60')],'phone':_0x538aed,'SmsAccountId':_0x1e81df['id'],'SmsInteractionId':_0xe96788['id'],'UserId':_0x1c34cf['user']['id'],'ContactId':_0x9152e8['id']}))[_0x68c7('0x1c')](function(_0x3e734c){_0xe96788[_0x68c7('0xc5')]['Messages']=[];_0xe96788['dataValues'][_0x68c7('0xc4')][_0x68c7('0xa0')](_0x3e734c[_0x68c7('0xc5')]);return _0xe96788;});})[_0x68c7('0x1c')](respondWithResult(_0x528649,null))['catch'](handleError(_0x528649,null));};exports[_0x68c7('0x2a')]=function(_0x2a341a,_0xe373d2,_0xf435b2){if(_0x2a341a[_0x68c7('0x60')]['id']){delete _0x2a341a[_0x68c7('0x60')]['id'];}var _0x54563a,_0x395761,_0x3f0d2c;return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x2a341a[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0xe373d2,null))[_0x68c7('0x1c')](function(_0x56d11c){if(_0x56d11c){_0x3f0d2c=_0x56d11c;logger[_0x68c7('0x20')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xc6'),_0x56d11c[_0x68c7('0x40')],util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));switch(_0x56d11c[_0x68c7('0x40')]){case _0x68c7('0x7e'):if(_0x2a341a['body']['skebby_dispatch_id']&&_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')]){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][_0x68c7('0xc8')]}});}break;case _0x68c7('0xc9'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0xca')]&&_0x2a341a[_0x68c7('0x60')]['statusInt']){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0xcb')];return db[_0x68c7('0xc3')]['find']({'where':{'messageId':_0x2a341a[_0x68c7('0x60')][_0x68c7('0xca')]}});}break;case _0x68c7('0xcc'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0x81')]&&_0x2a341a['body'][_0x68c7('0xcd')]){_0x395761=_0x2a341a[_0x68c7('0x60')]['status_code'];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body']['message_id']}});}break;case _0x68c7('0xce'):var _0x55549f=_0x2a341a[_0x68c7('0x60')]['results'][0x0];if(_0x55549f['messageId']&&_0x55549f[_0x68c7('0x2a')]['groupName']===_0x68c7('0xcf')){_0x395761=_0x55549f[_0x68c7('0x2a')][_0x68c7('0xd0')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x55549f[_0x68c7('0x84')]}});}break;case _0x68c7('0xd1'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0x84')]&&_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')]){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][_0x68c7('0x84')]}});}break;case _0x68c7('0x8c'):if(_0x2a341a[_0x68c7('0x60')][0x0]['message']['id']){_0x395761=_0x2a341a[_0x68c7('0x60')][0x0]['type'];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a['body'][0x0][_0x68c7('0x25')]['id']}});}break;case _0x68c7('0x8d'):if(_0x2a341a[_0x68c7('0x60')][_0x68c7('0xd2')]&&_0x2a341a[_0x68c7('0x60')]['status']){_0x395761=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x2a')];return db['SmsMessage'][_0x68c7('0x59')]({'where':{'messageId':_0x2a341a[_0x68c7('0x60')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0xe373d2,null))[_0x68c7('0x1c')](function(_0x2721d2){if(_0x2721d2){_0x54563a=_0x2721d2;switch(_0x3f0d2c[_0x68c7('0x40')]){case'skebby':if(_0x395761==='DELIVERED'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x68c7('0x2a'),_0x68c7('0x7e'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xc9'):if(_0x395761==='1'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),'status',_0x68c7('0x7e'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xcc'):if(!_0x2a341a[_0x68c7('0x60')][_0x68c7('0xd3')]&&_0x395761>=0xc8&&_0x395761<=0xce){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xcc'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case _0x68c7('0xce'):var _0x415dc4=_0x2a341a[_0x68c7('0x60')][_0x68c7('0x86')][0x0];if(_0x415dc4[_0x68c7('0x2a')][_0x68c7('0xd0')]==='DELIVERED'){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xce'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x395761=='DELIVERED_TO_GATEWAY'||_0x395761==_0x68c7('0xd4')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0xd1'),util[_0x68c7('0xc7')](_0x2a341a['body'],{'showHidden':![],'depth':null}));}break;case _0x68c7('0x8c'):if(_0x395761==_0x68c7('0xd5')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','bandwidth',util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;case _0x68c7('0x8d'):if(_0x395761===_0x68c7('0xd6')||_0x395761===_0x68c7('0xd7')){return _0x54563a[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x68c7('0x8d'),util[_0x68c7('0xc7')](_0x2a341a[_0x68c7('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x54563a;}})['then'](respondWithResult(_0xe373d2,null))[_0x68c7('0x27')](handleError(_0xe373d2,null));};exports[_0x68c7('0xd8')]=function(_0x4faed6,_0x20e976,_0x209ee2){var _0x5934fc,_0x2fd19b,_0x563e22;return db[_0x68c7('0x3d')][_0x68c7('0x59')]({'where':{'id':_0x4faed6['params']['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x20e976,null))[_0x68c7('0x1c')](function(_0x287046){if(_0x287046){_0x563e22=_0x287046;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x68c7('0x2a'),_0x68c7('0xc6'),_0x287046[_0x68c7('0x40')],util[_0x68c7('0xc7')](_0x4faed6[_0x68c7('0x42')],{'showHidden':![],'depth':null}));switch(_0x287046[_0x68c7('0x40')]){case _0x68c7('0x87'):if(_0x4faed6[_0x68c7('0x42')][_0x68c7('0xd9')]&&_0x4faed6[_0x68c7('0x42')][_0x68c7('0xda')]){_0x2fd19b=_0x4faed6[_0x68c7('0x42')][_0x68c7('0xda')];return db[_0x68c7('0xc3')][_0x68c7('0x59')]({'where':{'messageId':_0x4faed6[_0x68c7('0x42')][_0x68c7('0xd9')]}});}break;}}})[_0x68c7('0x1c')](handleEntityNotFound(_0x20e976,null))[_0x68c7('0x1c')](function(_0xb7f89c){if(_0xb7f89c){_0x5934fc=_0xb7f89c;switch(_0x563e22[_0x68c7('0x40')]){case _0x68c7('0x87'):if(_0x2fd19b==='2'||_0x2fd19b==='6'){return _0x5934fc[_0x68c7('0x33')]({'read':!![]});}else{logger[_0x68c7('0x23')](_0x68c7('0x21'),_0x68c7('0x2a'),_0x68c7('0x87'),util[_0x68c7('0xc7')](_0x4faed6[_0x68c7('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x5934fc;}})[_0x68c7('0x1c')](respondWithResult(_0x20e976,null))[_0x68c7('0x27')](handleError(_0x20e976,null));};exports[_0x68c7('0xdb')]=function(_0x150e63,_0x2fefb1,_0x506ace){return db['SmsAccount'][_0x68c7('0x59')]({'where':{'id':_0x150e63['params']['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x2fefb1,null))[_0x68c7('0x1c')](function(_0x441ddb){if(_0x441ddb){return _0x441ddb[_0x68c7('0xdb')](_0x150e63[_0x68c7('0x60')][_0x68c7('0x66')],_['omit'](_0x150e63[_0x68c7('0x60')],['ids','id'])||{})[_0x68c7('0x9c')](function(_0x304931){for(var _0x2cf803=0x0;_0x2cf803<_0x150e63[_0x68c7('0x60')]['ids']['length'];_0x2cf803+=0x1){socket[_0x68c7('0xdc')](_0x68c7('0xdd'),{'UserId':Number(_0x150e63[_0x68c7('0x60')][_0x68c7('0x66')][_0x2cf803]),'SmsAccountId':Number(_0x150e63[_0x68c7('0x55')]['id'])});}return _0x304931;});}})[_0x68c7('0x1c')](respondWithResult(_0x2fefb1,null))[_0x68c7('0x27')](handleError(_0x2fefb1,null));};exports[_0x68c7('0xde')]=function(_0x4063ff,_0xe5bcbc,_0x16dabb){return db['SmsAccount']['find']({'where':{'id':_0x4063ff[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0xe5bcbc,null))[_0x68c7('0x1c')](function(_0x577bda){if(_0x577bda){return _0x577bda[_0x68c7('0xde')](_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')])[_0x68c7('0x1c')](function(){if(_[_0x68c7('0xdf')](_0x4063ff['query']['ids'])){for(var _0x4ec0a1=0x0;_0x4ec0a1<_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')][_0x68c7('0x47')];_0x4ec0a1+=0x1){socket['emit'](_0x68c7('0xe0'),{'UserId':Number(_0x4063ff['query'][_0x68c7('0x66')][_0x4ec0a1]),'SmsAccountId':Number(_0x4063ff[_0x68c7('0x55')]['id'])});}}else{socket[_0x68c7('0xdc')](_0x68c7('0xe0'),{'UserId':Number(_0x4063ff[_0x68c7('0x42')][_0x68c7('0x66')]),'SmsAccountId':Number(_0x4063ff['params']['id'])});}});}})[_0x68c7('0x1c')](respondWithStatusCode(_0xe5bcbc,null))[_0x68c7('0x27')](handleError(_0xe5bcbc,null));};exports[_0x68c7('0xe1')]=function(_0xf4caf2,_0x23ecf5,_0x5bc875){var _0x136d2e={};var _0x5c0590={};var _0xab363a;var _0x4aad75;return db[_0x68c7('0x3d')][_0x68c7('0x63')]({'where':{'id':_0xf4caf2[_0x68c7('0x55')]['id']}})[_0x68c7('0x1c')](handleEntityNotFound(_0x23ecf5,null))['then'](function(_0x31a943){if(_0x31a943){_0xab363a=_0x31a943;_0x5c0590[_0x68c7('0x41')]=_[_0x68c7('0x43')](db[_0x68c7('0xe2')][_0x68c7('0x3e')]);_0x5c0590[_0x68c7('0x42')]=_['keys'](_0xf4caf2[_0x68c7('0x42')]);_0x5c0590['filters']=_['intersection'](_0x5c0590[_0x68c7('0x41')],_0x5c0590['query']);_0x136d2e[_0x68c7('0x45')]=_[_0x68c7('0x57')](_0x5c0590[_0x68c7('0x41')],qs['fields'](_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x46')]));_0x136d2e['attributes']=_0x136d2e[_0x68c7('0x45')]['length']?_0x136d2e['attributes']:_0x5c0590['model'];_0x136d2e[_0x68c7('0x4a')]=qs['sort'](_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x4b')]);_0x136d2e[_0x68c7('0x4d')]=qs[_0x68c7('0x44')](_[_0x68c7('0x6a')](_0xf4caf2[_0x68c7('0x42')],_0x5c0590[_0x68c7('0x44')]));if(_0xf4caf2[_0x68c7('0x42')]['filter']){_0x136d2e[_0x68c7('0x4d')]=_['merge'](_0x136d2e[_0x68c7('0x4d')],{'$or':_['map'](_0x136d2e[_0x68c7('0x45')],function(_0x54ebef){var _0x10668c={};_0x10668c[_0x54ebef]={'$like':'%'+_0xf4caf2[_0x68c7('0x42')][_0x68c7('0x4c')]+'%'};return _0x10668c;})});}_0x136d2e=_[_0x68c7('0x4e')]({},_0x136d2e,_0xf4caf2[_0x68c7('0x50')]);return _0xab363a['getAgents'](_0x136d2e);}})[_0x68c7('0x1c')](function(_0x5998bc){if(_0x5998bc){_0x4aad75=_0x5998bc[_0x68c7('0x47')];if(!_0xf4caf2['query']['hasOwnProperty'](_0x68c7('0x49'))){_0x136d2e[_0x68c7('0x2e')]=qs[_0x68c7('0x2e')](_0xf4caf2['query'][_0x68c7('0x2e')]);_0x136d2e['offset']=qs['offset'](_0xf4caf2[_0x68c7('0x42')]['offset']);}return _0xab363a[_0x68c7('0xe1')](_0x136d2e);}})[_0x68c7('0x1c')](function(_0x2d6fad){if(_0x2d6fad){return _0x2d6fad?{'count':_0x4aad75,'rows':_0x2d6fad}:null;}})[_0x68c7('0x1c')](respondWithResult(_0x23ecf5,null))[_0x68c7('0x27')](handleError(_0x23ecf5,null));}; \ No newline at end of file +var _0x51d7=['from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','SmsInteraction','spread','interaction','autoclose','push','created','SmsMessage','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','Content-Type','addApplications','transaction','sequelize','READ_COMMITTED','SmsApplication','bulkCreate','priority','stack','finally','getApplications','nolimit','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','List','ListId','out','Messages','dataValues','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','intelepeer','redif','update','error_code','DELIVERED','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','get','SmsAccounts','UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','includeAll','find','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','SmsAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','Applications','applications','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x51d7,0x138));var _0x751d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x51d7[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x751d('0x0'));var rimraf=require(_0x751d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x751d('0x2'));var BPromise=require(_0x751d('0x3'));var Mustache=require(_0x751d('0x4'));var util=require(_0x751d('0x5'));var path=require('path');var sox=require(_0x751d('0x6'));var csv=require(_0x751d('0x7'));var ejs=require(_0x751d('0x8'));var fs=require('fs');var fs_extra=require(_0x751d('0x9'));var _=require(_0x751d('0xa'));var squel=require('squel');var crypto=require(_0x751d('0xb'));var jsforce=require(_0x751d('0xc'));var deskjs=require(_0x751d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x751d('0xe'));var Papa=require(_0x751d('0xf'));var Redis=require(_0x751d('0x10'));var authService=require(_0x751d('0x11'));var qs=require(_0x751d('0x12'));var as=require(_0x751d('0x13'));var hardwareService=require(_0x751d('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x751d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x751d('0x16'));var db=require(_0x751d('0x17'))['db'];config[_0x751d('0x18')]=_[_0x751d('0x19')](config[_0x751d('0x18')],{'host':_0x751d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x751d('0x1b'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x407761,_0x3eef96,_0xb8f798,_0x41a773){return new BPromise(function(_0x2d6692,_0x5ace10){var _0x2764a3=_0x41a773||client;return _0x2764a3[_0x751d('0x1c')](_0x407761,_0xb8f798)['then'](function(_0x372d40){logger[_0x751d('0x1d')](_0x751d('0x1e'),_0x3eef96,_0x751d('0x1f'));logger[_0x751d('0x20')](_0x751d('0x21'),_0x3eef96,'request\x20sent',JSON[_0x751d('0x22')](_0x372d40));if(_0x372d40[_0x751d('0x23')]){if(_0x372d40[_0x751d('0x23')][_0x751d('0x24')]===0x1f4){logger[_0x751d('0x23')]('SmsAccount,\x20%s,\x20%s',_0x3eef96,_0x372d40[_0x751d('0x23')]['message']);return _0x5ace10(_0x372d40['error'][_0x751d('0x25')]);}logger[_0x751d('0x23')](_0x751d('0x1e'),_0x3eef96,_0x372d40['error']['message']);return _0x2d6692(_0x372d40[_0x751d('0x23')][_0x751d('0x25')]);}else{logger['info'](_0x751d('0x1e'),_0x3eef96,_0x751d('0x1f'));_0x2d6692(_0x372d40['result'][_0x751d('0x25')]);}})[_0x751d('0x26')](function(_0x3eccd6){logger['error'](_0x751d('0x1e'),_0x3eef96,_0x3eccd6);_0x5ace10(_0x3eccd6);});});}function respondWithStatusCode(_0x4319c2,_0x5d70ea){_0x5d70ea=_0x5d70ea||0xcc;return function(_0x4a4a04){if(_0x4a4a04){return _0x4319c2[_0x751d('0x27')](_0x5d70ea);}return _0x4319c2[_0x751d('0x28')](_0x5d70ea)[_0x751d('0x29')]();};}function respondWithResult(_0x4e82bb,_0x4e80ac){_0x4e80ac=_0x4e80ac||0xc8;return function(_0x3fe941){if(_0x3fe941){return _0x4e82bb['status'](_0x4e80ac)['json'](_0x3fe941);}};}function respondWithFilteredResult(_0x161efe,_0x2496ae){return function(_0x59af60){if(_0x59af60){var _0x903752=typeof _0x2496ae[_0x751d('0x2a')]===_0x751d('0x2b')&&typeof _0x2496ae['limit']==='undefined';var _0x31ef44=_0x59af60[_0x751d('0x2c')];var _0x1d23ab=_0x903752?0x0:_0x2496ae[_0x751d('0x2a')];var _0x5c6b9a=_0x903752?_0x59af60[_0x751d('0x2c')]:_0x2496ae[_0x751d('0x2a')]+_0x2496ae[_0x751d('0x2d')];var _0xea9c98;if(_0x5c6b9a>=_0x31ef44){_0x5c6b9a=_0x31ef44;_0xea9c98=0xc8;}else{_0xea9c98=0xce;}_0x161efe[_0x751d('0x28')](_0xea9c98);return _0x161efe[_0x751d('0x2e')](_0x751d('0x2f'),_0x1d23ab+'-'+_0x5c6b9a+'/'+_0x31ef44)[_0x751d('0x30')](_0x59af60);}return null;};}function patchUpdates(_0x53c9a5){return function(_0x47fa79){try{jsonpatch[_0x751d('0x31')](_0x47fa79,_0x53c9a5,!![]);}catch(_0x4b5c3a){return BPromise[_0x751d('0x32')](_0x4b5c3a);}return _0x47fa79[_0x751d('0x33')]();};}function saveUpdates(_0x772a4e,_0x166f01){return function(_0x512b63){if(_0x512b63){return _0x512b63['update'](_0x772a4e)[_0x751d('0x34')](function(_0x509d67){return _0x509d67;});}return null;};}function removeEntity(_0x3c7947,_0x2acf74){return function(_0x2b5137){if(_0x2b5137){return _0x2b5137['destroy']()['then'](function(){var _0xa5eca1=_0x2b5137[_0x751d('0x35')]({'plain':!![]});var _0x32a9ad=_0x751d('0x36');return db[_0x751d('0x37')][_0x751d('0x38')]({'where':{'type':_0x32a9ad,'resourceId':_0xa5eca1['id']}})[_0x751d('0x34')](function(){return _0x2b5137;});})[_0x751d('0x34')](function(){_0x3c7947[_0x751d('0x28')](0xcc)[_0x751d('0x29')]();});}};}function handleEntityNotFound(_0x46ff28,_0x20f524){return function(_0x25edfb){if(!_0x25edfb){_0x46ff28[_0x751d('0x27')](0x194);}return _0x25edfb;};}function handleError(_0x33f91f,_0x3272ee){_0x3272ee=_0x3272ee||0x1f4;return function(_0x233e87){logger['error'](_0x233e87['stack']);if(_0x233e87[_0x751d('0x39')]){delete _0x233e87[_0x751d('0x39')];}_0x33f91f[_0x751d('0x28')](_0x3272ee)[_0x751d('0x3a')](_0x233e87);};}exports['index']=function(_0x4e5b49,_0x5b8707){var _0x353896={'include':[{'model':db[_0x751d('0x3b')],'as':_0x751d('0x3c')}]},_0x31e508={},_0x31f7b7={'count':0x0,'rows':[]};var _0x3767ed=_[_0x751d('0x3d')](db[_0x751d('0x3e')][_0x751d('0x3f')],function(_0x48f129){return{'name':_0x48f129['fieldName'],'type':_0x48f129[_0x751d('0x40')][_0x751d('0x41')]};});_0x31e508[_0x751d('0x42')]=_[_0x751d('0x3d')](_0x3767ed,_0x751d('0x39'));_0x31e508[_0x751d('0x43')]=_[_0x751d('0x44')](_0x4e5b49['query']);_0x31e508['filters']=_['intersection'](_0x31e508['model'],_0x31e508[_0x751d('0x43')]);_0x353896['attributes']=_[_0x751d('0x45')](_0x31e508['model'],qs[_0x751d('0x46')](_0x4e5b49[_0x751d('0x43')][_0x751d('0x46')]));_0x353896[_0x751d('0x47')]=_0x353896[_0x751d('0x47')]['length']?_0x353896['attributes']:_0x31e508[_0x751d('0x42')];if(!_0x4e5b49['query'][_0x751d('0x48')]('nolimit')){_0x353896['limit']=qs[_0x751d('0x2d')](_0x4e5b49[_0x751d('0x43')]['limit']);_0x353896[_0x751d('0x2a')]=qs[_0x751d('0x2a')](_0x4e5b49[_0x751d('0x43')][_0x751d('0x2a')]);}_0x353896[_0x751d('0x49')]=qs[_0x751d('0x4a')](_0x4e5b49[_0x751d('0x43')]['sort']);_0x353896[_0x751d('0x4b')]=qs[_0x751d('0x4c')](_['pick'](_0x4e5b49[_0x751d('0x43')],_0x31e508['filters']),_0x3767ed);if(_0x4e5b49['query'][_0x751d('0x4d')]){_0x353896[_0x751d('0x4b')]=_[_0x751d('0x4e')](_0x353896[_0x751d('0x4b')],{'$or':_[_0x751d('0x3d')](_0x3767ed,function(_0x55ea92){if(_0x55ea92[_0x751d('0x40')]!==_0x751d('0x4f')){var _0x17a563={};_0x17a563[_0x55ea92[_0x751d('0x39')]]={'$like':'%'+_0x4e5b49[_0x751d('0x43')][_0x751d('0x4d')]+'%'};return _0x17a563;}})});}_0x353896=_[_0x751d('0x4e')]({},_0x353896,_0x4e5b49[_0x751d('0x50')]);var _0x15ee47={'where':_0x353896[_0x751d('0x4b')]};return db[_0x751d('0x3e')][_0x751d('0x2c')](_0x15ee47)[_0x751d('0x34')](function(_0x35bd6a){_0x31f7b7[_0x751d('0x2c')]=_0x35bd6a;if(_0x4e5b49[_0x751d('0x43')]['includeAll']){_0x353896[_0x751d('0x51')]=[{'all':!![]}];}return db[_0x751d('0x3e')][_0x751d('0x52')](_0x353896);})['then'](function(_0x188199){_0x31f7b7[_0x751d('0x53')]=_0x188199;return _0x31f7b7;})[_0x751d('0x34')](respondWithFilteredResult(_0x5b8707,_0x353896))[_0x751d('0x26')](handleError(_0x5b8707,null));};exports[_0x751d('0x54')]=function(_0x1450b6,_0x45f507){var _0x39b0c1={'raw':![],'where':{'id':_0x1450b6['params']['id']},'include':[{'model':db[_0x751d('0x3b')],'as':_0x751d('0x3c')}]},_0x1d8b38={};_0x1d8b38['model']=_[_0x751d('0x44')](db[_0x751d('0x3e')][_0x751d('0x3f')]);_0x1d8b38[_0x751d('0x43')]=_[_0x751d('0x44')](_0x1450b6[_0x751d('0x43')]);_0x1d8b38[_0x751d('0x4c')]=_[_0x751d('0x45')](_0x1d8b38[_0x751d('0x42')],_0x1d8b38[_0x751d('0x43')]);_0x39b0c1[_0x751d('0x47')]=_[_0x751d('0x45')](_0x1d8b38[_0x751d('0x42')],qs['fields'](_0x1450b6[_0x751d('0x43')]['fields']));_0x39b0c1[_0x751d('0x47')]=_0x39b0c1['attributes'][_0x751d('0x55')]?_0x39b0c1[_0x751d('0x47')]:_0x1d8b38[_0x751d('0x42')];if(_0x1450b6[_0x751d('0x43')][_0x751d('0x56')]){_0x39b0c1[_0x751d('0x51')]=[{'all':!![]}];}_0x39b0c1=_[_0x751d('0x4e')]({},_0x39b0c1,_0x1450b6[_0x751d('0x50')]);return db[_0x751d('0x3e')][_0x751d('0x57')](_0x39b0c1)[_0x751d('0x34')](handleEntityNotFound(_0x45f507,null))[_0x751d('0x34')](respondWithResult(_0x45f507,null))[_0x751d('0x26')](handleError(_0x45f507,null));};exports[_0x751d('0x58')]=function(_0x320e6b,_0x1afab6){return db[_0x751d('0x3e')][_0x751d('0x58')](_0x320e6b['body'],{})['then'](function(_0x48e763){var _0x4176fa=_0x320e6b[_0x751d('0x59')][_0x751d('0x35')]({'plain':!![]});if(!_0x4176fa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4176fa['role']===_0x751d('0x59')){var _0x530ab7=_0x48e763['get']({'plain':!![]});var _0x53666c='SmsAccounts';return db[_0x751d('0x5a')][_0x751d('0x57')]({'where':{'name':_0x53666c,'userProfileId':_0x4176fa[_0x751d('0x5b')]},'raw':!![]})[_0x751d('0x34')](function(_0x292f32){if(_0x292f32&&_0x292f32['autoAssociation']===0x0){return db[_0x751d('0x37')][_0x751d('0x58')]({'name':_0x530ab7[_0x751d('0x39')],'resourceId':_0x530ab7['id'],'type':_0x292f32[_0x751d('0x39')],'sectionId':_0x292f32['id']},{})[_0x751d('0x34')](function(){return _0x48e763;});}else{return _0x48e763;}})[_0x751d('0x26')](function(_0x5bb387){logger[_0x751d('0x23')](_0x751d('0x5c'),_0x5bb387);throw _0x5bb387;});}return _0x48e763;})[_0x751d('0x34')](respondWithResult(_0x1afab6,0xc9))[_0x751d('0x26')](handleError(_0x1afab6,null));};exports['update']=function(_0x511292,_0x2976e4){if(_0x511292[_0x751d('0x5d')]['id']){delete _0x511292[_0x751d('0x5d')]['id'];}return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x511292[_0x751d('0x5e')]['id']},'include':[{'model':db[_0x751d('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x751d('0x34')](handleEntityNotFound(_0x2976e4,null))[_0x751d('0x34')](saveUpdates(_0x511292[_0x751d('0x5d')],null))['then'](respondWithResult(_0x2976e4,null))[_0x751d('0x26')](handleError(_0x2976e4,null));};exports[_0x751d('0x38')]=function(_0x54d7e8,_0x4e0025){return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x54d7e8['params']['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x4e0025,null))[_0x751d('0x34')](removeEntity(_0x4e0025,null))[_0x751d('0x26')](handleError(_0x4e0025,null));};exports[_0x751d('0x5f')]=function(_0x112825,_0x189e0c){return db[_0x751d('0x3e')][_0x751d('0x5f')]()[_0x751d('0x34')](respondWithResult(_0x189e0c,null))[_0x751d('0x26')](handleError(_0x189e0c,null));};exports['addDisposition']=function(_0x2f11fa,_0x584fc3,_0x549ad1){if(_0x2f11fa[_0x751d('0x5d')]['id']){delete _0x2f11fa['body']['id'];}return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x2f11fa[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x584fc3,null))['then'](function(_0x1a5997){if(_0x1a5997){_0x2f11fa[_0x751d('0x5d')][_0x751d('0x60')]=_0x1a5997['id'];return db[_0x751d('0x61')][_0x751d('0x58')](_0x2f11fa[_0x751d('0x5d')]);}})[_0x751d('0x34')](respondWithResult(_0x584fc3,null))[_0x751d('0x26')](handleError(_0x584fc3,null));};exports['getDispositions']=function(_0x3e71fd,_0x2922c5,_0x32ba40){var _0x36b3c6={'raw':![],'where':{}};var _0x28b623={};var _0x2797d4={'count':0x0,'rows':[]};return db[_0x751d('0x3e')][_0x751d('0x62')]({'where':{'id':_0x3e71fd['params']['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x2922c5,null))['then'](function(_0x22041f){if(_0x22041f){_0x28b623[_0x751d('0x42')]=_[_0x751d('0x44')](db[_0x751d('0x61')]['rawAttributes']);_0x28b623[_0x751d('0x43')]=_[_0x751d('0x44')](_0x3e71fd[_0x751d('0x43')]);_0x28b623['filters']=_[_0x751d('0x45')](_0x28b623['model'],_0x28b623['query']);_0x36b3c6[_0x751d('0x47')]=_[_0x751d('0x45')](_0x28b623['model'],qs[_0x751d('0x46')](_0x3e71fd[_0x751d('0x43')][_0x751d('0x46')]));_0x36b3c6[_0x751d('0x47')]=_0x36b3c6['attributes'][_0x751d('0x55')]?_0x36b3c6['attributes']:_0x28b623[_0x751d('0x42')];if(!_0x3e71fd['query'][_0x751d('0x48')]('nolimit')){_0x36b3c6[_0x751d('0x2d')]=qs[_0x751d('0x2d')](_0x3e71fd[_0x751d('0x43')][_0x751d('0x2d')]);_0x36b3c6[_0x751d('0x2a')]=qs['offset'](_0x3e71fd[_0x751d('0x43')][_0x751d('0x2a')]);}_0x36b3c6[_0x751d('0x49')]=qs[_0x751d('0x4a')](_0x3e71fd[_0x751d('0x43')][_0x751d('0x4a')]);_0x36b3c6[_0x751d('0x4b')]=qs['filters'](_[_0x751d('0x63')](_0x3e71fd[_0x751d('0x43')],_0x28b623[_0x751d('0x4c')]));_0x36b3c6[_0x751d('0x4b')][_0x751d('0x60')]=_0x22041f['id'];if(_0x3e71fd[_0x751d('0x43')][_0x751d('0x4d')]){_0x36b3c6['where']=_[_0x751d('0x4e')](_0x36b3c6[_0x751d('0x4b')],{'$or':_[_0x751d('0x3d')](_0x36b3c6[_0x751d('0x47')],function(_0x2253c0){var _0x2c4f54={};_0x2c4f54[_0x2253c0]={'$like':'%'+_0x3e71fd[_0x751d('0x43')]['filter']+'%'};return _0x2c4f54;})});}_0x36b3c6=_[_0x751d('0x4e')]({},_0x36b3c6,_0x3e71fd[_0x751d('0x50')]);return db[_0x751d('0x61')]['count']({'where':_0x36b3c6[_0x751d('0x4b')]})['then'](function(_0x2d12e9){_0x2797d4[_0x751d('0x2c')]=_0x2d12e9;if(_0x3e71fd['query'][_0x751d('0x56')]){_0x36b3c6['include']=[{'all':!![]}];}return db[_0x751d('0x61')]['findAll'](_0x36b3c6);})[_0x751d('0x34')](function(_0x1a80c0){_0x2797d4[_0x751d('0x53')]=_0x1a80c0;return _0x2797d4;});}})[_0x751d('0x34')](respondWithFilteredResult(_0x2922c5,_0x36b3c6))[_0x751d('0x26')](handleError(_0x2922c5,null));};exports[_0x751d('0x64')]=function(_0x5561db,_0x2c069c,_0x500672){return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x5561db[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x2c069c,null))[_0x751d('0x34')](function(_0x5a06bc){if(_0x5a06bc){return _0x5a06bc[_0x751d('0x64')](_0x5561db[_0x751d('0x43')][_0x751d('0x65')]);}})[_0x751d('0x34')](respondWithStatusCode(_0x2c069c,null))['catch'](handleError(_0x2c069c,null));};exports[_0x751d('0x66')]=function(_0x407aba,_0x35e9c2,_0x10df11){if(_0x407aba[_0x751d('0x5d')]['id']){delete _0x407aba[_0x751d('0x5d')]['id'];}return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x407aba[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x35e9c2,null))[_0x751d('0x34')](function(_0x588597){if(_0x588597){_0x407aba[_0x751d('0x5d')][_0x751d('0x60')]=_0x588597['id'];return db[_0x751d('0x67')][_0x751d('0x58')](_0x407aba[_0x751d('0x5d')]);}})[_0x751d('0x34')](respondWithResult(_0x35e9c2,null))[_0x751d('0x26')](handleError(_0x35e9c2,null));};exports[_0x751d('0x68')]=function(_0x25352d,_0x5d4bd1,_0x434adf){var _0x3000e3={'raw':![],'where':{}};var _0x3ed25f={};var _0x4d0bbc={'count':0x0,'rows':[]};return db[_0x751d('0x3e')][_0x751d('0x62')]({'where':{'id':_0x25352d[_0x751d('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5d4bd1,null))[_0x751d('0x34')](function(_0x25d9c5){if(_0x25d9c5){_0x3ed25f[_0x751d('0x42')]=_[_0x751d('0x44')](db['CannedAnswer'][_0x751d('0x3f')]);_0x3ed25f[_0x751d('0x43')]=_[_0x751d('0x44')](_0x25352d[_0x751d('0x43')]);_0x3ed25f[_0x751d('0x4c')]=_[_0x751d('0x45')](_0x3ed25f[_0x751d('0x42')],_0x3ed25f[_0x751d('0x43')]);_0x3000e3[_0x751d('0x47')]=_[_0x751d('0x45')](_0x3ed25f[_0x751d('0x42')],qs['fields'](_0x25352d[_0x751d('0x43')][_0x751d('0x46')]));_0x3000e3[_0x751d('0x47')]=_0x3000e3[_0x751d('0x47')]['length']?_0x3000e3[_0x751d('0x47')]:_0x3ed25f[_0x751d('0x42')];if(!_0x25352d[_0x751d('0x43')][_0x751d('0x48')]('nolimit')){_0x3000e3[_0x751d('0x2d')]=qs['limit'](_0x25352d[_0x751d('0x43')]['limit']);_0x3000e3[_0x751d('0x2a')]=qs[_0x751d('0x2a')](_0x25352d[_0x751d('0x43')][_0x751d('0x2a')]);}_0x3000e3['order']=qs[_0x751d('0x4a')](_0x25352d[_0x751d('0x43')][_0x751d('0x4a')]);_0x3000e3[_0x751d('0x4b')]=qs[_0x751d('0x4c')](_[_0x751d('0x63')](_0x25352d['query'],_0x3ed25f['filters']));_0x3000e3[_0x751d('0x4b')][_0x751d('0x60')]=_0x25d9c5['id'];if(_0x25352d[_0x751d('0x43')][_0x751d('0x4d')]){_0x3000e3[_0x751d('0x4b')]=_['merge'](_0x3000e3[_0x751d('0x4b')],{'$or':_['map'](_0x3000e3[_0x751d('0x47')],function(_0x75ceb8){var _0x355215={};_0x355215[_0x75ceb8]={'$like':'%'+_0x25352d[_0x751d('0x43')][_0x751d('0x4d')]+'%'};return _0x355215;})});}_0x3000e3=_[_0x751d('0x4e')]({},_0x3000e3,_0x25352d['options']);return db[_0x751d('0x67')][_0x751d('0x2c')]({'where':_0x3000e3['where']})[_0x751d('0x34')](function(_0x5d07b5){_0x4d0bbc[_0x751d('0x2c')]=_0x5d07b5;if(_0x25352d[_0x751d('0x43')][_0x751d('0x56')]){_0x3000e3[_0x751d('0x51')]=[{'all':!![]}];}return db['CannedAnswer'][_0x751d('0x52')](_0x3000e3);})['then'](function(_0x229fc6){_0x4d0bbc[_0x751d('0x53')]=_0x229fc6;return _0x4d0bbc;});}})[_0x751d('0x34')](respondWithFilteredResult(_0x5d4bd1,_0x3000e3))['catch'](handleError(_0x5d4bd1,null));};exports['removeAnswers']=function(_0x516824,_0x5ed08f,_0xc9946c){return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x516824[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x5ed08f,null))['then'](function(_0x5da2f8){if(_0x5da2f8){return _0x5da2f8[_0x751d('0x69')](_0x516824[_0x751d('0x43')][_0x751d('0x65')]);}})[_0x751d('0x34')](respondWithStatusCode(_0x5ed08f,null))['catch'](handleError(_0x5ed08f,null));};exports[_0x751d('0x6a')]=function(_0x18e3b5,_0x5d2527,_0xea7d71){var _0x5cdc03={'channel':'sms'};var _0x2028c1=[];var _0x3f6895=[];var _0x973732={};return db['SmsAccount'][_0x751d('0x57')]({'where':{'id':_0x18e3b5['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x751d('0x6b')}]})[_0x751d('0x34')](handleEntityNotFound(_0x5d2527,null))[_0x751d('0x34')](function(_0x41a948){_0x5cdc03['account']=_0x41a948;_0x5cdc03[_0x751d('0x6c')]=_['orderBy'](_0x41a948['Applications'],['priority'],[_0x751d('0x6d')]);if(_0x5cdc03[_0x751d('0x6e')][_0x751d('0x6b')]){delete _0x5cdc03['account'][_0x751d('0x6b')];}return db[_0x751d('0x6f')]['describe']();})[_0x751d('0x34')](function(_0x2b4568){if(!_0x2b4568){throw new db['Sequelize'][(_0x751d('0x70'))](_0x751d('0x71'));}_0x2028c1=_[_0x751d('0x72')](_[_0x751d('0x44')](_0x2b4568),[_0x751d('0x73'),_0x751d('0x74')]);_0x3f6895=_[_0x751d('0x72')](_['keys'](_0x2b4568),[_0x751d('0x73'),_0x751d('0x74'),_0x751d('0x75'),'ListId']);_0x5cdc03[_0x751d('0x5d')]={'mapKey':_0x751d('0x76')};if(_0x5cdc03[_0x751d('0x6e')][_0x751d('0x40')]){switch(_0x5cdc03[_0x751d('0x6e')][_0x751d('0x40')]){case _0x751d('0x77'):_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')]=_0x18e3b5['body'][_0x751d('0x79')];_0x5cdc03['body']['body']=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x7a')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')]=_0x18e3b5['body'][_0x751d('0x7c')];break;case _0x751d('0x7d'):_0x5cdc03['body'][_0x751d('0x78')]='+'+_0x18e3b5[_0x751d('0x5d')][_0x751d('0x7e')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x7f')];break;case _0x751d('0x80'):_0x5cdc03['body']['from']=_0x18e3b5['body'][_0x751d('0x78')];_0x5cdc03['body'][_0x751d('0x5d')]=_0x18e3b5['body'][_0x751d('0x25')];break;case _0x751d('0x81'):_0x5cdc03[_0x751d('0x5d')]['from']=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x78')];_0x5cdc03['body']['body']=_0x18e3b5[_0x751d('0x5d')]['body'];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x82')];break;case _0x751d('0x83'):_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x79')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x84')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')]=_0x18e3b5['body']['MessageUUID'];break;case _0x751d('0x85'):_0x5cdc03['body'][_0x751d('0x78')]='+'+_0x18e3b5[_0x751d('0x5d')][_0x751d('0x86')][0x0][_0x751d('0x78')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x86')][0x0]['text'];_0x5cdc03['body']['messageId']=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x86')][0x0]['messageId'];break;case _0x751d('0x87'):_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')]=_0x18e3b5['body'][_0x751d('0x88')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x89')][_0x751d('0x25')];break;case _0x751d('0x8a'):_0x5cdc03[_0x751d('0x5d')]['from']=_0x18e3b5[_0x751d('0x5d')]['fromNumber'];_0x5cdc03[_0x751d('0x5d')]['body']=_0x18e3b5['body'][_0x751d('0x7f')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x8b')];break;case _0x751d('0x8c'):_0x5cdc03['body'][_0x751d('0x7b')]=_0x18e3b5[_0x751d('0x5d')][0x0][_0x751d('0x25')]['id'];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')]=_0x18e3b5['body'][0x0][_0x751d('0x25')][_0x751d('0x78')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][0x0][_0x751d('0x25')][_0x751d('0x7f')];break;case'intelepeer':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x78')];_0x5cdc03['body'][_0x751d('0x5d')]=_0x18e3b5[_0x751d('0x5d')][_0x751d('0x25')];_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')]=_0x18e3b5['body']['refid'];break;}}if(_0x5cdc03['body']['id']){delete _0x5cdc03[_0x751d('0x5d')]['id'];}if(_[_0x751d('0x8d')](_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')])){throw new db[(_0x751d('0x8e'))][(_0x751d('0x70'))]('from\x20is\x20mandatory');}if(_[_0x751d('0x8d')](_0x5cdc03['body'][_0x751d('0x5d')])||_0x5cdc03[_0x751d('0x5d')][_0x751d('0x5d')]===''){throw new db[(_0x751d('0x8e'))][(_0x751d('0x70'))](_0x751d('0x8f'));}if(_['isNil'](_0x5cdc03[_0x751d('0x5d')][_0x751d('0x90')])){throw new db[(_0x751d('0x8e'))][(_0x751d('0x70'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3f6895);}if(!_['includes'](_0x3f6895,_0x5cdc03[_0x751d('0x5d')]['mapKey'])){throw new db[(_0x751d('0x8e'))]['ValidationError'](_0x751d('0x91')+_0x3f6895);}_0x973732[_0x5cdc03[_0x751d('0x5d')][_0x751d('0x90')]]=_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')];return db[_0x751d('0x92')]['find']({'where':{'id':_0x5cdc03[_0x751d('0x6e')]['ListId']},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x973732,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x5d2527,null))['then'](function(_0x57f6ce){if(_0x57f6ce){_0x5cdc03[_0x751d('0x93')]=_['omit'](_0x57f6ce,['Contacts']);if(_0x57f6ce[_0x751d('0x94')][_0x751d('0x55')]){return _0x57f6ce[_0x751d('0x94')][0x0];}var _0x238e81=_[_0x751d('0x19')](_0x5cdc03[_0x751d('0x5d')],{'firstName':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')],'ListId':_0x57f6ce['id']});_0x238e81[_0x5cdc03['body'][_0x751d('0x90')]]=_0x5cdc03[_0x751d('0x5d')]['from'];return db['CmContact'][_0x751d('0x58')](_0x238e81,{'fields':_0x2028c1,'raw':!![]});}})['then'](handleEntityNotFound(_0x5d2527,null))[_0x751d('0x34')](function(_0x585c6a){if(_0x585c6a){_0x5cdc03['contact']=_0x585c6a;var _0x41341f={'ContactId':_0x585c6a['id'],'phone':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')],'SmsAccountId':_0x18e3b5['params']['id']};var _0x2dbdd9={'ContactId':_0x585c6a['id'],'SmsAccountId':_0x18e3b5[_0x751d('0x5e')]['id'],'closed':![]};return db[_0x751d('0x95')][_0x751d('0x57')]({'where':_0x2dbdd9})[_0x751d('0x34')](function(_0x39e587){if(_0x39e587){return[_0x39e587,![]];}return db[_0x751d('0x95')][_0x751d('0x58')](_0x41341f)[_0x751d('0x34')](function(_0x29bd56){return[_0x29bd56,!![]];});});}})[_0x751d('0x96')](function(_0x19ef80,_0x25b26d){_0x5cdc03[_0x751d('0x97')]=_0x19ef80[_0x751d('0x35')]({'plain':!![]});_0x5cdc03[_0x751d('0x97')]['created']=![];if(_0x25b26d){if(_0x5cdc03[_0x751d('0x6e')][_0x751d('0x98')]){_0x5cdc03['applications'][_0x751d('0x99')]({'id':0x0,'priority':_0x5cdc03['applications'][_0x751d('0x55')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x5cdc03[_0x751d('0x97')][_0x751d('0x9a')]=!![];}return db[_0x751d('0x9b')][_0x751d('0x58')]({'phone':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x78')],'messageId':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x7b')],'body':_0x5cdc03['body'][_0x751d('0x5d')],'SmsAccountId':_0x18e3b5[_0x751d('0x5e')]['id'],'SmsInteractionId':_0x19ef80['id'],'direction':'in','ContactId':_0x19ef80[_0x751d('0x9c')],'AttachmentId':_0x5cdc03[_0x751d('0x5d')][_0x751d('0x9d')]});})[_0x751d('0x34')](function(_0x481202){_0x5cdc03[_0x751d('0x25')]=_0x481202;if(_0x5cdc03[_0x751d('0x97')][_0x751d('0x9e')]){return db['User'][_0x751d('0x57')]({'attributes':['id',_0x751d('0x39')],'where':{'id':_0x5cdc03[_0x751d('0x97')][_0x751d('0x9e')]}})[_0x751d('0x34')](function(_0x5630a9){if(_0x5630a9){_0x5cdc03[_0x751d('0x6c')][_0x751d('0x9f')]({'id':0x0,'priority':0x0,'app':_0x751d('0xa0'),'appdata':_0x5630a9['name']+','+(_0x5cdc03['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x751d('0xa1'),'startRouting',_0x5cdc03);});}return respondWithRpcPromise(_0x751d('0xa1'),_0x751d('0xa2'),_0x5cdc03);})[_0x751d('0x34')](function(_0x4e9f12){if(_0x4e9f12){var _0x2ac411=0xc8;var _0x287a60=_0x751d('0xa3');logger['info'](_0x751d('0x21'),_0x287a60,_0x2ac411,_0x751d('0xa4'));logger[_0x751d('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x287a60,_0x2ac411,_0x751d('0xa4'),JSON['stringify'](_0x4e9f12));if(_0x5cdc03['account'][_0x751d('0x40')]===_0x751d('0x77')){return _0x5d2527[_0x751d('0x28')](_0x2ac411)['set'](_0x751d('0xa5'),'text/xml')[_0x751d('0x3a')]('\x0a');}else{return _0x5d2527[_0x751d('0x28')](_0x2ac411)[_0x751d('0x30')](_0x4e9f12);}}})[_0x751d('0x26')](handleError(_0x5d2527,null));};exports[_0x751d('0xa6')]=function(_0x380630,_0x5acc1f){var _0x5dfd7a=_0x380630[_0x751d('0x5e')]['id'];var _0x1e7b7a=_0x380630[_0x751d('0x5d')];var _0x4b8efa=0xc8;var _0x9c853=null;return db['sequelize'][_0x751d('0xa7')]({'isolationLevel':db[_0x751d('0xa8')]['Transaction']['ISOLATION_LEVELS'][_0x751d('0xa9')]},function(_0x236680){return db[_0x751d('0x3e')][_0x751d('0x62')]({'where':{'id':_0x5dfd7a},'transaction':_0x236680})[_0x751d('0x34')](function(_0x32766c){if(_0x32766c){return db[_0x751d('0xaa')][_0x751d('0x38')]({'where':{'SmsAccountId':_0x5dfd7a},'transaction':_0x236680})[_0x751d('0x34')](function(){var _0x39bf74=_[_0x751d('0x3d')](_0x1e7b7a,function(_0x128b52){_0x128b52[_0x751d('0x60')]=_0x5dfd7a;return _0x128b52;});return db['SmsApplication'][_0x751d('0xab')](_0x39bf74,{'transaction':_0x236680});});}else{_0x4b8efa=0x194;_0x9c853=[];}});})['then'](function(){if(_0x4b8efa!==0x194){return db[_0x751d('0xaa')]['findAndCountAll']({'where':{'SmsAccountId':_0x5dfd7a},'order':_0x751d('0xac')})[_0x751d('0x34')](function(_0xc1dbdc){_0x9c853=_0xc1dbdc;});}})['catch'](function(_0x1740ed){_0x4b8efa=0x1f4;logger['error'](_0x1740ed[_0x751d('0xad')]);if(_0x1740ed[_0x751d('0x39')]){delete _0x1740ed[_0x751d('0x39')];}_0x9c853=_0x1740ed;})[_0x751d('0xae')](function(){if(_0x9c853===null){_0x5acc1f['sendStatus'](_0x4b8efa);}else{if(_0x4b8efa===0x1f4){_0x5acc1f['status'](_0x4b8efa)[_0x751d('0x3a')](_0x9c853);}else{_0x5acc1f[_0x751d('0x28')](_0x4b8efa)['json'](_0x9c853);}}});};exports[_0x751d('0xaf')]=function(_0x4be272,_0x54ebe9,_0xcc8d12){var _0x166024={};var _0xb29976={};var _0x21da9d;var _0x4ff593;return db[_0x751d('0x3e')][_0x751d('0x62')]({'where':{'id':_0x4be272[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x54ebe9,null))['then'](function(_0x2bc525){if(_0x2bc525){_0x21da9d=_0x2bc525;_0xb29976[_0x751d('0x42')]=_[_0x751d('0x44')](db[_0x751d('0xaa')][_0x751d('0x3f')]);_0xb29976[_0x751d('0x43')]=_[_0x751d('0x44')](_0x4be272['query']);_0xb29976[_0x751d('0x4c')]=_[_0x751d('0x45')](_0xb29976[_0x751d('0x42')],_0xb29976[_0x751d('0x43')]);_0x166024[_0x751d('0x47')]=_['intersection'](_0xb29976[_0x751d('0x42')],qs[_0x751d('0x46')](_0x4be272[_0x751d('0x43')][_0x751d('0x46')]));_0x166024[_0x751d('0x47')]=_0x166024['attributes'][_0x751d('0x55')]?_0x166024[_0x751d('0x47')]:_0xb29976[_0x751d('0x42')];_0x166024['order']=qs[_0x751d('0x4a')](_0x4be272[_0x751d('0x43')][_0x751d('0x4a')]);_0x166024['where']=qs['filters'](_['pick'](_0x4be272['query'],_0xb29976[_0x751d('0x4c')]));if(_0x4be272[_0x751d('0x43')][_0x751d('0x4d')]){_0x166024[_0x751d('0x4b')]=_[_0x751d('0x4e')](_0x166024[_0x751d('0x4b')],{'$or':_[_0x751d('0x3d')](_0x166024[_0x751d('0x47')],function(_0x283be9){var _0x233b69={};_0x233b69[_0x283be9]={'$like':'%'+_0x4be272[_0x751d('0x43')][_0x751d('0x4d')]+'%'};return _0x233b69;})});}_0x166024=_[_0x751d('0x4e')]({},_0x166024,_0x4be272[_0x751d('0x50')]);return _0x21da9d[_0x751d('0xaf')](_0x166024);}})[_0x751d('0x34')](function(_0x3b178b){if(_0x3b178b){_0x4ff593=_0x3b178b[_0x751d('0x55')];if(!_0x4be272[_0x751d('0x43')][_0x751d('0x48')](_0x751d('0xb0'))){_0x166024['limit']=qs[_0x751d('0x2d')](_0x4be272[_0x751d('0x43')]['limit']);_0x166024['offset']=qs[_0x751d('0x2a')](_0x4be272['query']['offset']);}return _0x21da9d[_0x751d('0xaf')](_0x166024);}})[_0x751d('0x34')](function(_0x1e6852){if(_0x1e6852){return _0x1e6852?{'count':_0x4ff593,'rows':_0x1e6852}:null;}})[_0x751d('0x34')](respondWithResult(_0x54ebe9,null))['catch'](handleError(_0x54ebe9,null));};exports[_0x751d('0xb1')]=function(_0x453873,_0x39f085,_0x1edf8d){var _0x289cd3={'raw':![],'where':{}};var _0x14f93f={};var _0x4e071c={'count':0x0,'rows':[]};return db[_0x751d('0x3e')]['findOne']({'where':{'id':_0x453873['params']['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x39f085,null))[_0x751d('0x34')](function(_0x3399b2){if(_0x3399b2){_0x14f93f[_0x751d('0x42')]=_[_0x751d('0x44')](db['SmsInteraction'][_0x751d('0x3f')]);_0x14f93f[_0x751d('0x43')]=_['keys'](_0x453873[_0x751d('0x43')]);_0x14f93f['filters']=_[_0x751d('0x45')](_0x14f93f[_0x751d('0x42')],_0x14f93f['query']);_0x289cd3[_0x751d('0x47')]=_['intersection'](_0x14f93f[_0x751d('0x42')],qs[_0x751d('0x46')](_0x453873[_0x751d('0x43')]['fields']));_0x289cd3['attributes']=_0x289cd3[_0x751d('0x47')][_0x751d('0x55')]?_0x289cd3[_0x751d('0x47')]:_0x14f93f[_0x751d('0x42')];if(!_0x453873[_0x751d('0x43')][_0x751d('0x48')](_0x751d('0xb0'))){_0x289cd3[_0x751d('0x2d')]=qs['limit'](_0x453873['query'][_0x751d('0x2d')]);_0x289cd3[_0x751d('0x2a')]=qs['offset'](_0x453873['query'][_0x751d('0x2a')]);}_0x289cd3[_0x751d('0x49')]=qs[_0x751d('0x4a')](_0x453873[_0x751d('0x43')]['sort']);_0x289cd3[_0x751d('0x4b')]=qs[_0x751d('0x4c')](_[_0x751d('0x63')](_0x453873[_0x751d('0x43')],_0x14f93f['filters']));_0x289cd3[_0x751d('0x4b')][_0x751d('0x60')]=_0x3399b2['id'];if(_0x453873[_0x751d('0x43')]['filter']){_0x289cd3[_0x751d('0x4b')]=_[_0x751d('0x4e')](_0x289cd3[_0x751d('0x4b')],{'$or':_[_0x751d('0x3d')](_0x289cd3['attributes'],function(_0x17d891){var _0x529d6e={};_0x529d6e[_0x17d891]={'$like':'%'+_0x453873['query']['filter']+'%'};return _0x529d6e;})});}_0x289cd3=_['merge']({},_0x289cd3,_0x453873[_0x751d('0x50')]);return db['SmsInteraction'][_0x751d('0x2c')]({'where':_0x289cd3['where']})[_0x751d('0x34')](function(_0x15bd46){_0x4e071c[_0x751d('0x2c')]=_0x15bd46;if(_0x453873[_0x751d('0x43')][_0x751d('0x56')]){_0x289cd3[_0x751d('0x51')]=[{'model':db[_0x751d('0x6f')],'as':_0x751d('0xb2'),'required':![]},{'model':db[_0x751d('0xb3')],'as':_0x751d('0xb4'),'attributes':['name',_0x751d('0xb5'),_0x751d('0xb6')],'required':![]},{'model':db['Tag'],'as':_0x751d('0xb7'),'attributes':['id',_0x751d('0x39'),_0x751d('0xb8')],'where':_0x453873[_0x751d('0x43')][_0x751d('0xb9')]?{'id':_0x453873['query'][_0x751d('0xb9')]}:undefined,'required':_0x453873[_0x751d('0x43')][_0x751d('0xb9')]?!![]:![]}];}return db[_0x751d('0x95')][_0x751d('0x52')](_0x289cd3);})['then'](function(_0x3e914d){_0x4e071c[_0x751d('0x53')]=_0x3e914d;return _0x4e071c;});}})['then'](respondWithFilteredResult(_0x39f085,_0x289cd3))[_0x751d('0x26')](handleError(_0x39f085,null));};exports[_0x751d('0x3a')]=function(_0x5c4bba,_0x18d937,_0x369f2c){var _0x3d8ca1,_0x5187ec,_0x2470e4;if(_[_0x751d('0x8d')](_0x5c4bba['body'][_0x751d('0x5d')])||_0x5c4bba[_0x751d('0x5d')][_0x751d('0x5d')]===''){throw new db[(_0x751d('0x8e'))][(_0x751d('0x70'))](_0x751d('0x8f'));}if(_[_0x751d('0x8d')](_0x5c4bba[_0x751d('0x5d')]['to'])){throw new db[(_0x751d('0x8e'))][(_0x751d('0x70'))](_0x751d('0xba'));}_0x3d8ca1=_0x5c4bba['body']['to'];return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x5c4bba['params']['id']},'include':[{'model':db[_0x751d('0x92')],'as':_0x751d('0xbb'),'include':[{'model':db[_0x751d('0x6f')],'as':'Contacts','where':{'mobile':_0x3d8ca1},'limit':0x1,'order':[[_0x751d('0x74'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x18d937,null))[_0x751d('0x34')](function(_0x51d010){if(_0x51d010&&_0x51d010['List']){_0x5187ec=_0x51d010[_0x751d('0x35')]({'plain':!![]});if(_0x5187ec['List']&&_0x5187ec[_0x751d('0xbb')][_0x751d('0x94')][_0x751d('0x55')]){return _0x5187ec[_0x751d('0xbb')][_0x751d('0x94')][0x0];}return db[_0x751d('0x6f')][_0x751d('0x58')](_[_0x751d('0x19')](_0x5c4bba[_0x751d('0x5d')],{'firstName':_0x3d8ca1,'mobile':_0x3d8ca1,'phone':_0x3d8ca1,'ListId':_0x5187ec[_0x751d('0xbc')]}));}})[_0x751d('0x34')](handleEntityNotFound(_0x18d937,null))[_0x751d('0x34')](function(_0x2ec327){if(_0x2ec327){_0x2470e4=_0x2ec327;return db[_0x751d('0x95')][_0x751d('0x57')]({'where':{'ContactId':_0x2470e4['id'],'closed':![],'SmsAccountId':_0x5187ec['id']}})[_0x751d('0x34')](function(_0x1cff2c){if(_0x1cff2c){return[_0x1cff2c,![]];}return db[_0x751d('0x95')]['create']({'UserId':_0x5c4bba[_0x751d('0x59')]['id'],'ContactId':_0x2470e4['id'],'SmsAccountId':_0x5187ec['id'],'phone':_0x3d8ca1,'firstMsgDirection':_0x751d('0xbd'),'Messages':[_[_0x751d('0x4e')](_0x5c4bba['body'],{'read':![],'body':_0x5c4bba[_0x751d('0x5d')][_0x751d('0x5d')],'phone':_0x3d8ca1,'SmsAccountId':_0x5187ec['id'],'UserId':_0x5c4bba[_0x751d('0x59')]['id'],'ContactId':_0x2470e4['id']})]},{'include':[{'model':db[_0x751d('0x9b')],'as':_0x751d('0xbe')}]})[_0x751d('0x34')](function(_0x320525){return[_0x320525,!![]];});});}})[_0x751d('0x96')](function(_0xfa138,_0xa3c55c){if(_0xa3c55c){return _0xfa138;}return db[_0x751d('0x9b')][_0x751d('0x58')](_[_0x751d('0x4e')](_0x5c4bba[_0x751d('0x5d')],{'read':![],'body':_0x5c4bba[_0x751d('0x5d')][_0x751d('0x5d')],'phone':_0x3d8ca1,'SmsAccountId':_0x5187ec['id'],'SmsInteractionId':_0xfa138['id'],'UserId':_0x5c4bba['user']['id'],'ContactId':_0x2470e4['id']}))[_0x751d('0x34')](function(_0x3d661c){_0xfa138[_0x751d('0xbf')]['Messages']=[];_0xfa138[_0x751d('0xbf')][_0x751d('0xbe')]['push'](_0x3d661c[_0x751d('0xbf')]);return _0xfa138;});})[_0x751d('0x34')](respondWithResult(_0x18d937,null))[_0x751d('0x26')](handleError(_0x18d937,null));};exports['status']=function(_0x5a0e41,_0x280ce3,_0x47e619){if(_0x5a0e41['body']['id']){delete _0x5a0e41['body']['id'];}var _0x523e13,_0x45c034,_0x58bfb9;return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x5a0e41[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x280ce3,null))[_0x751d('0x34')](function(_0x5c03f6){if(_0x5c03f6){_0x58bfb9=_0x5c03f6;logger[_0x751d('0x20')](_0x751d('0x21'),'status','received\x20delivery\x20report\x20from',_0x5c03f6[_0x751d('0x40')],util[_0x751d('0xc0')](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));switch(_0x5c03f6[_0x751d('0x40')]){case _0x751d('0x7d'):if(_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc1')]&&_0x5a0e41[_0x751d('0x5d')][_0x751d('0x28')]){_0x45c034=_0x5a0e41[_0x751d('0x5d')][_0x751d('0x28')];return db['SmsMessage'][_0x751d('0x57')]({'where':{'messageId':_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc1')]}});}break;case'connectel':if(_0x5a0e41[_0x751d('0x5d')]['requestid']&&_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc2')]){_0x45c034=_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc2')];return db['SmsMessage']['find']({'where':{'messageId':_0x5a0e41['body'][_0x751d('0xc3')]}});}break;case _0x751d('0x81'):if(_0x5a0e41[_0x751d('0x5d')][_0x751d('0x82')]&&_0x5a0e41['body']['status_code']){_0x45c034=_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc4')];return db[_0x751d('0x9b')][_0x751d('0x57')]({'where':{'messageId':_0x5a0e41[_0x751d('0x5d')][_0x751d('0x82')]}});}break;case _0x751d('0x85'):var _0x3a9e6b=_0x5a0e41[_0x751d('0x5d')][_0x751d('0x86')][0x0];if(_0x3a9e6b['messageId']&&_0x3a9e6b['status'][_0x751d('0xc5')]==='DELIVERED'){_0x45c034=_0x3a9e6b[_0x751d('0x28')][_0x751d('0xc5')];return db[_0x751d('0x9b')][_0x751d('0x57')]({'where':{'messageId':_0x3a9e6b['messageId']}});}break;case _0x751d('0x8a'):if(_0x5a0e41[_0x751d('0x5d')][_0x751d('0x7b')]&&_0x5a0e41[_0x751d('0x5d')]['status']){_0x45c034=_0x5a0e41['body'][_0x751d('0x28')];return db[_0x751d('0x9b')][_0x751d('0x57')]({'where':{'messageId':_0x5a0e41[_0x751d('0x5d')][_0x751d('0x7b')]}});}break;case _0x751d('0x8c'):if(_0x5a0e41[_0x751d('0x5d')][0x0][_0x751d('0x25')]['id']){_0x45c034=_0x5a0e41[_0x751d('0x5d')][0x0][_0x751d('0x40')];return db[_0x751d('0x9b')][_0x751d('0x57')]({'where':{'messageId':_0x5a0e41['body'][0x0][_0x751d('0x25')]['id']}});}break;case _0x751d('0xc6'):if(_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc7')]&&_0x5a0e41[_0x751d('0x5d')][_0x751d('0x28')]){_0x45c034=_0x5a0e41[_0x751d('0x5d')][_0x751d('0x28')];return db[_0x751d('0x9b')][_0x751d('0x57')]({'where':{'messageId':_0x5a0e41['body'][_0x751d('0xc7')]}});}break;}}})['then'](handleEntityNotFound(_0x280ce3,null))[_0x751d('0x34')](function(_0x2593eb){if(_0x2593eb){_0x523e13=_0x2593eb;switch(_0x58bfb9[_0x751d('0x40')]){case _0x751d('0x7d'):if(_0x45c034==='DELIVERED'){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger[_0x751d('0x23')](_0x751d('0x21'),'status',_0x751d('0x7d'),util['inspect'](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x751d('0x80'):if(_0x45c034==='1'){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger['error'](_0x751d('0x21'),'status',_0x751d('0x7d'),util['inspect'](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x5a0e41[_0x751d('0x5d')][_0x751d('0xc9')]&&_0x45c034>=0xc8&&_0x45c034<=0xce){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger[_0x751d('0x23')](_0x751d('0x21'),'status','clicksend',util[_0x751d('0xc0')](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x751d('0x85'):var _0x253cc9=_0x5a0e41[_0x751d('0x5d')]['results'][0x0];if(_0x253cc9[_0x751d('0x28')]['groupName']===_0x751d('0xca')){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger[_0x751d('0x23')](_0x751d('0x21'),'status',_0x751d('0x85'),util['inspect'](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x45c034==_0x751d('0xcb')||_0x45c034=='RECEIVED_BY_RECIPIENT'){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger[_0x751d('0x23')](_0x751d('0x21'),'status',_0x751d('0x8a'),util[_0x751d('0xc0')](_0x5a0e41['body'],{'showHidden':![],'depth':null}));}break;case _0x751d('0x8c'):if(_0x45c034==_0x751d('0xcc')){return _0x523e13[_0x751d('0xc8')]({'read':!![]});}else{logger['error'](_0x751d('0x21'),'status','bandwidth',util[_0x751d('0xc0')](_0x5a0e41['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x45c034===_0x751d('0xcd')||_0x45c034===_0x751d('0xce')){return _0x523e13['update']({'read':!![]});}else{logger['error'](_0x751d('0x21'),'status',_0x751d('0xc6'),util['inspect'](_0x5a0e41[_0x751d('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x523e13;}})['then'](respondWithResult(_0x280ce3,null))['catch'](handleError(_0x280ce3,null));};exports['statusGet']=function(_0xb2c2d3,_0x1bcc28,_0x46a545){var _0x4d16c3,_0x182d18,_0x3524a;return db['SmsAccount'][_0x751d('0x57')]({'where':{'id':_0xb2c2d3[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x1bcc28,null))[_0x751d('0x34')](function(_0x1feec1){if(_0x1feec1){_0x3524a=_0x1feec1;logger['debug'](_0x751d('0x21'),_0x751d('0x28'),'received\x20delivery\x20report\x20from',_0x1feec1['type'],util[_0x751d('0xc0')](_0xb2c2d3[_0x751d('0x43')],{'showHidden':![],'depth':null}));switch(_0x1feec1[_0x751d('0x40')]){case _0x751d('0x87'):if(_0xb2c2d3['query'][_0x751d('0xcf')]&&_0xb2c2d3[_0x751d('0x43')][_0x751d('0xd0')]){_0x182d18=_0xb2c2d3[_0x751d('0x43')][_0x751d('0xd0')];return db['SmsMessage'][_0x751d('0x57')]({'where':{'messageId':_0xb2c2d3[_0x751d('0x43')][_0x751d('0xcf')]}});}break;}}})[_0x751d('0x34')](handleEntityNotFound(_0x1bcc28,null))['then'](function(_0x1e431f){if(_0x1e431f){_0x4d16c3=_0x1e431f;switch(_0x3524a[_0x751d('0x40')]){case _0x751d('0x87'):if(_0x182d18==='2'||_0x182d18==='6'){return _0x4d16c3[_0x751d('0xc8')]({'read':!![]});}else{logger[_0x751d('0x23')](_0x751d('0x21'),_0x751d('0x28'),_0x751d('0x87'),util[_0x751d('0xc0')](_0xb2c2d3[_0x751d('0x43')],{'showHidden':![],'depth':null}));};break;}return _0x4d16c3;}})[_0x751d('0x34')](respondWithResult(_0x1bcc28,null))[_0x751d('0x26')](handleError(_0x1bcc28,null));};exports[_0x751d('0xd1')]=function(_0x1d729d,_0x8b92a9,_0x54447e){return db[_0x751d('0x3e')]['find']({'where':{'id':_0x1d729d['params']['id']}})['then'](handleEntityNotFound(_0x8b92a9,null))[_0x751d('0x34')](function(_0x1b84d1){if(_0x1b84d1){return _0x1b84d1['addAgents'](_0x1d729d[_0x751d('0x5d')][_0x751d('0x65')],_[_0x751d('0xd2')](_0x1d729d[_0x751d('0x5d')],[_0x751d('0x65'),'id'])||{})[_0x751d('0x96')](function(_0x4d4b27){for(var _0x310a18=0x0;_0x310a18<_0x1d729d[_0x751d('0x5d')][_0x751d('0x65')][_0x751d('0x55')];_0x310a18+=0x1){socket[_0x751d('0xd3')](_0x751d('0xd4'),{'UserId':Number(_0x1d729d[_0x751d('0x5d')]['ids'][_0x310a18]),'SmsAccountId':Number(_0x1d729d['params']['id'])});}return _0x4d4b27;});}})[_0x751d('0x34')](respondWithResult(_0x8b92a9,null))[_0x751d('0x26')](handleError(_0x8b92a9,null));};exports['removeAgents']=function(_0x2b5a64,_0x1628b2,_0x33cb81){return db[_0x751d('0x3e')][_0x751d('0x57')]({'where':{'id':_0x2b5a64['params']['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x1628b2,null))[_0x751d('0x34')](function(_0x371740){if(_0x371740){return _0x371740[_0x751d('0xd5')](_0x2b5a64['query'][_0x751d('0x65')])[_0x751d('0x34')](function(){if(_['isArray'](_0x2b5a64[_0x751d('0x43')]['ids'])){for(var _0xbbed0f=0x0;_0xbbed0f<_0x2b5a64[_0x751d('0x43')][_0x751d('0x65')][_0x751d('0x55')];_0xbbed0f+=0x1){socket[_0x751d('0xd3')]('userSmsAccount:remove',{'UserId':Number(_0x2b5a64[_0x751d('0x43')][_0x751d('0x65')][_0xbbed0f]),'SmsAccountId':Number(_0x2b5a64[_0x751d('0x5e')]['id'])});}}else{socket['emit'](_0x751d('0xd6'),{'UserId':Number(_0x2b5a64[_0x751d('0x43')][_0x751d('0x65')]),'SmsAccountId':Number(_0x2b5a64['params']['id'])});}});}})[_0x751d('0x34')](respondWithStatusCode(_0x1628b2,null))[_0x751d('0x26')](handleError(_0x1628b2,null));};exports['getAgents']=function(_0x46576c,_0x3f232b,_0x4f0990){var _0x11c12c={};var _0x2f58fa={};var _0x5188d1;var _0x1ab10b;return db[_0x751d('0x3e')]['findOne']({'where':{'id':_0x46576c[_0x751d('0x5e')]['id']}})[_0x751d('0x34')](handleEntityNotFound(_0x3f232b,null))[_0x751d('0x34')](function(_0x3f5672){if(_0x3f5672){_0x5188d1=_0x3f5672;_0x2f58fa[_0x751d('0x42')]=_[_0x751d('0x44')](db[_0x751d('0xb3')][_0x751d('0x3f')]);_0x2f58fa[_0x751d('0x43')]=_['keys'](_0x46576c[_0x751d('0x43')]);_0x2f58fa['filters']=_[_0x751d('0x45')](_0x2f58fa['model'],_0x2f58fa['query']);_0x11c12c[_0x751d('0x47')]=_[_0x751d('0x45')](_0x2f58fa[_0x751d('0x42')],qs[_0x751d('0x46')](_0x46576c['query'][_0x751d('0x46')]));_0x11c12c[_0x751d('0x47')]=_0x11c12c[_0x751d('0x47')][_0x751d('0x55')]?_0x11c12c[_0x751d('0x47')]:_0x2f58fa[_0x751d('0x42')];_0x11c12c[_0x751d('0x49')]=qs[_0x751d('0x4a')](_0x46576c[_0x751d('0x43')][_0x751d('0x4a')]);_0x11c12c['where']=qs[_0x751d('0x4c')](_[_0x751d('0x63')](_0x46576c[_0x751d('0x43')],_0x2f58fa['filters']));if(_0x46576c[_0x751d('0x43')]['filter']){_0x11c12c[_0x751d('0x4b')]=_['merge'](_0x11c12c[_0x751d('0x4b')],{'$or':_[_0x751d('0x3d')](_0x11c12c['attributes'],function(_0x5e7199){var _0x28907b={};_0x28907b[_0x5e7199]={'$like':'%'+_0x46576c[_0x751d('0x43')][_0x751d('0x4d')]+'%'};return _0x28907b;})});}_0x11c12c=_[_0x751d('0x4e')]({},_0x11c12c,_0x46576c[_0x751d('0x50')]);return _0x5188d1[_0x751d('0xd7')](_0x11c12c);}})[_0x751d('0x34')](function(_0x562c60){if(_0x562c60){_0x1ab10b=_0x562c60[_0x751d('0x55')];if(!_0x46576c['query'][_0x751d('0x48')](_0x751d('0xb0'))){_0x11c12c[_0x751d('0x2d')]=qs[_0x751d('0x2d')](_0x46576c['query'][_0x751d('0x2d')]);_0x11c12c[_0x751d('0x2a')]=qs[_0x751d('0x2a')](_0x46576c[_0x751d('0x43')]['offset']);}return _0x5188d1[_0x751d('0xd7')](_0x11c12c);}})['then'](function(_0x134117){if(_0x134117){return _0x134117?{'count':_0x1ab10b,'rows':_0x134117}:null;}})[_0x751d('0x34')](respondWithResult(_0x3f232b,null))['catch'](handleError(_0x3f232b,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index a868497..2bfa4ed 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 _0xa7ed=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','remove'];(function(_0x5f1f63,_0x158cae){var _0x23b60b=function(_0x5e4048){while(--_0x5e4048){_0x5f1f63['push'](_0x5f1f63['shift']());}};_0x23b60b(++_0x158cae);}(_0xa7ed,0xae));var _0xda7e=function(_0xb0726a,_0x151a13){_0xb0726a=_0xb0726a-0x0;var _0xd6ab02=_0xa7ed[_0xb0726a];return _0xd6ab02;};'use strict';var EventEmitter=require(_0xda7e('0x0'));var SmsAccount=require(_0xda7e('0x1'))['db'][_0xda7e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xda7e('0x3')](0x0);var events={'afterCreate':_0xda7e('0x4'),'afterUpdate':'update','afterDestroy':_0xda7e('0x5')};function emitEvent(_0x3953d0){return function(_0x2641ad,_0xb7f5a,_0x485b69){SmsAccountEvents[_0xda7e('0x6')](_0x3953d0+':'+_0x2641ad['id'],_0x2641ad);SmsAccountEvents[_0xda7e('0x6')](_0x3953d0,_0x2641ad);_0x485b69(null);};}for(var e in events){if(events[_0xda7e('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xda7e('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xf656=['save','remove','hasOwnProperty','exports','../../mysqldb','SmsAccount','setMaxListeners'];(function(_0x59d294,_0x3a89a5){var _0x5b5681=function(_0x569ee0){while(--_0x569ee0){_0x59d294['push'](_0x59d294['shift']());}};_0x5b5681(++_0x3a89a5);}(_0xf656,0x12a));var _0x6f65=function(_0x1ca406,_0x263a87){_0x1ca406=_0x1ca406-0x0;var _0x1da46d=_0xf656[_0x1ca406];return _0x1da46d;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x6f65('0x0'))['db'][_0x6f65('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6f65('0x2')](0x0);var events={'afterCreate':_0x6f65('0x3'),'afterUpdate':'update','afterDestroy':_0x6f65('0x4')};function emitEvent(_0x5e8763){return function(_0x2f920e,_0x491a16,_0x5be51f){SmsAccountEvents['emit'](_0x5e8763+':'+_0x2f920e['id'],_0x2f920e);SmsAccountEvents['emit'](_0x5e8763,_0x2f920e);_0x5be51f(null);};}for(var e in events){if(events[_0x6f65('0x5')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6f65('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f164ea1..31a5358 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 _0xdc3b=['api','moment','bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','sms_accounts','lodash','../../config/logger'];(function(_0x2fc6c8,_0x458af3){var _0x5d89e1=function(_0x24e57){while(--_0x24e57){_0x2fc6c8['push'](_0x2fc6c8['shift']());}};_0x5d89e1(++_0x458af3);}(_0xdc3b,0x1ae));var _0xbdc3=function(_0x355353,_0x53c2aa){_0x355353=_0x355353-0x0;var _0x2091d3=_0xdc3b[_0x355353];return _0x2091d3;};'use strict';var _=require(_0xbdc3('0x0'));var util=require('util');var logger=require(_0xbdc3('0x1'))(_0xbdc3('0x2'));var moment=require(_0xbdc3('0x3'));var BPromise=require(_0xbdc3('0x4'));var rp=require(_0xbdc3('0x5'));var fs=require('fs');var path=require(_0xbdc3('0x6'));var rimraf=require(_0xbdc3('0x7'));var config=require('../../config/environment');var attributes=require(_0xbdc3('0x8'));module[_0xbdc3('0x9')]=function(_0x4bd66d,_0x5ab9ea){return _0x4bd66d[_0xbdc3('0xa')]('SmsAccount',attributes,{'tableName':_0xbdc3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf71f=['api','moment','bluebird','request-promise','path','../../config/environment','./smsAccount.attributes','exports','sms_accounts','lodash','util'];(function(_0x383653,_0x47e95c){var _0x54bce0=function(_0x2afdb3){while(--_0x2afdb3){_0x383653['push'](_0x383653['shift']());}};_0x54bce0(++_0x47e95c);}(_0xf71f,0x1ab));var _0xff71=function(_0x12515c,_0x5f0ec7){_0x12515c=_0x12515c-0x0;var _0x53973f=_0xf71f[_0x12515c];return _0x53973f;};'use strict';var _=require(_0xff71('0x0'));var util=require(_0xff71('0x1'));var logger=require('../../config/logger')(_0xff71('0x2'));var moment=require(_0xff71('0x3'));var BPromise=require(_0xff71('0x4'));var rp=require(_0xff71('0x5'));var fs=require('fs');var path=require(_0xff71('0x6'));var rimraf=require('rimraf');var config=require(_0xff71('0x7'));var attributes=require(_0xff71('0x8'));module[_0xff71('0x9')]=function(_0x218a61,_0xf4a368){return _0x218a61['define']('SmsAccount',attributes,{'tableName':_0xff71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 400dc70..b2fce6c 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 _0x1986=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3cac67,_0x438f03){var _0x508db9=function(_0xc11ec4){while(--_0xc11ec4){_0x3cac67['push'](_0x3cac67['shift']());}};_0x508db9(++_0x438f03);}(_0x1986,0x10e));var _0x6198=function(_0x2b31df,_0x39fd87){_0x2b31df=_0x2b31df-0x0;var _0x411b73=_0x1986[_0x2b31df];return _0x411b73;};'use strict';var _=require('lodash');var util=require(_0x6198('0x0'));var moment=require(_0x6198('0x1'));var BPromise=require(_0x6198('0x2'));var rs=require(_0x6198('0x3'));var fs=require('fs');var Redis=require(_0x6198('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6198('0x5'));var logger=require(_0x6198('0x6'))(_0x6198('0x7'));var config=require('../../config/environment');var jayson=require(_0x6198('0x8'));var client=jayson['client'][_0x6198('0x9')]({'port':0x232a});config[_0x6198('0xa')]=_['defaults'](config[_0x6198('0xa')],{'host':_0x6198('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6198('0xc'))[_0x6198('0xd')](socket);function respondWithRpcPromise(_0x33a2fe,_0xd82342,_0x587d36){return new BPromise(function(_0x14f8b7,_0x2dcfe1){return client['request'](_0x33a2fe,_0x587d36)[_0x6198('0xe')](function(_0x1fa6eb){logger[_0x6198('0xf')](_0x6198('0x10'),_0xd82342,_0x6198('0x11'));logger[_0x6198('0x12')](_0x6198('0x13'),_0xd82342,_0x6198('0x11'),JSON[_0x6198('0x14')](_0x1fa6eb));if(_0x1fa6eb['error']){if(_0x1fa6eb[_0x6198('0x15')][_0x6198('0x16')]===0x1f4){logger[_0x6198('0x15')](_0x6198('0x10'),_0xd82342,_0x1fa6eb[_0x6198('0x15')][_0x6198('0x17')]);return _0x2dcfe1(_0x1fa6eb[_0x6198('0x15')]['message']);}logger[_0x6198('0x15')](_0x6198('0x10'),_0xd82342,_0x1fa6eb[_0x6198('0x15')][_0x6198('0x17')]);return _0x14f8b7(_0x1fa6eb['error'][_0x6198('0x17')]);}else{logger['info'](_0x6198('0x10'),_0xd82342,'request\x20sent');_0x14f8b7(_0x1fa6eb[_0x6198('0x18')][_0x6198('0x17')]);}})[_0x6198('0x19')](function(_0x4f3183){logger['error'](_0x6198('0x10'),_0xd82342,_0x4f3183);_0x2dcfe1(_0x4f3183);});});}exports[_0x6198('0x1a')]=function(_0x3b0dba){var _0x2cb2e9=this;return new Promise(function(_0x15c2ff,_0x5036bf){return db[_0x6198('0x1b')][_0x6198('0x1c')]({'raw':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x1e')]===undefined?!![]:![]:!![],'where':_0x3b0dba['options']?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x1f')]||null:null,'attributes':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba['options'][_0x6198('0x20')]||null:null,'include':_0x3b0dba[_0x6198('0x1d')]?_0x3b0dba[_0x6198('0x1d')][_0x6198('0x21')]?_['map'](_0x3b0dba[_0x6198('0x1d')][_0x6198('0x21')],function(_0x2089ba){return{'model':db[_0x2089ba[_0x6198('0x22')]],'as':_0x2089ba['as'],'attributes':_0x2089ba[_0x6198('0x20')],'include':_0x2089ba[_0x6198('0x21')]?_[_0x6198('0x23')](_0x2089ba[_0x6198('0x21')],function(_0x6ac644){return{'model':db[_0x6ac644[_0x6198('0x22')]],'as':_0x6ac644['as'],'attributes':_0x6ac644[_0x6198('0x20')],'include':_0x6ac644[_0x6198('0x21')]?_[_0x6198('0x23')](_0x6ac644[_0x6198('0x21')],function(_0x2ee05d){return{'model':db[_0x2ee05d[_0x6198('0x22')]],'as':_0x2ee05d['as'],'attributes':_0x2ee05d[_0x6198('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6198('0xe')](function(_0x37520a){logger['info'](_0x6198('0x1a'),_0x3b0dba);logger['debug']('ShowSmsAccount',_0x3b0dba,JSON[_0x6198('0x14')](_0x37520a));_0x15c2ff(_0x37520a);})[_0x6198('0x19')](function(_0x845be4){logger[_0x6198('0x15')](_0x6198('0x1a'),_0x845be4['message'],_0x3b0dba);_0x5036bf(_0x2cb2e9[_0x6198('0x15')](0x1f4,_0x845be4[_0x6198('0x17')]));});});}; \ No newline at end of file +var _0xe34d=['include','map','model','ShowSmsAccount','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','SmsAccount','options','raw','where','attributes'];(function(_0x52bc98,_0x22d77a){var _0xf09506=function(_0xb67d99){while(--_0xb67d99){_0x52bc98['push'](_0x52bc98['shift']());}};_0xf09506(++_0x22d77a);}(_0xe34d,0xe5));var _0xde34=function(_0x463534,_0x1e2cc2){_0x463534=_0x463534-0x0;var _0x2c9b81=_0xe34d[_0x463534];return _0x2c9b81;};'use strict';var _=require(_0xde34('0x0'));var util=require('util');var moment=require(_0xde34('0x1'));var BPromise=require(_0xde34('0x2'));var rs=require(_0xde34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde34('0x4'))['db'];var utils=require(_0xde34('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xde34('0x6'));var client=jayson[_0xde34('0x7')]['http']({'port':0x232a});config[_0xde34('0x8')]=_[_0xde34('0x9')](config[_0xde34('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xde34('0xa'))(new Redis(config[_0xde34('0x8')]));require('./smsAccount.socket')[_0xde34('0xb')](socket);function respondWithRpcPromise(_0x3f9b63,_0x46310e,_0x5dc70c){return new BPromise(function(_0x4f0a68,_0x3e40be){return client[_0xde34('0xc')](_0x3f9b63,_0x5dc70c)[_0xde34('0xd')](function(_0x3953da){logger[_0xde34('0xe')](_0xde34('0xf'),_0x46310e,'request\x20sent');logger['debug'](_0xde34('0x10'),_0x46310e,'request\x20sent',JSON[_0xde34('0x11')](_0x3953da));if(_0x3953da[_0xde34('0x12')]){if(_0x3953da[_0xde34('0x12')]['code']===0x1f4){logger[_0xde34('0x12')](_0xde34('0xf'),_0x46310e,_0x3953da[_0xde34('0x12')]['message']);return _0x3e40be(_0x3953da[_0xde34('0x12')][_0xde34('0x13')]);}logger[_0xde34('0x12')]('SmsAccount,\x20%s,\x20%s',_0x46310e,_0x3953da[_0xde34('0x12')]['message']);return _0x4f0a68(_0x3953da[_0xde34('0x12')]['message']);}else{logger[_0xde34('0xe')]('SmsAccount,\x20%s,\x20%s',_0x46310e,_0xde34('0x14'));_0x4f0a68(_0x3953da['result'][_0xde34('0x13')]);}})[_0xde34('0x15')](function(_0x4635c6){logger['error'](_0xde34('0xf'),_0x46310e,_0x4635c6);_0x3e40be(_0x4635c6);});});}exports['ShowSmsAccount']=function(_0x220b96){var _0x2f65af=this;return new Promise(function(_0x9e0f23,_0x57a404){return db[_0xde34('0x16')]['find']({'raw':_0x220b96[_0xde34('0x17')]?_0x220b96[_0xde34('0x17')][_0xde34('0x18')]===undefined?!![]:![]:!![],'where':_0x220b96['options']?_0x220b96[_0xde34('0x17')][_0xde34('0x19')]||null:null,'attributes':_0x220b96['options']?_0x220b96[_0xde34('0x17')][_0xde34('0x1a')]||null:null,'include':_0x220b96[_0xde34('0x17')]?_0x220b96[_0xde34('0x17')][_0xde34('0x1b')]?_[_0xde34('0x1c')](_0x220b96['options'][_0xde34('0x1b')],function(_0x3826ee){return{'model':db[_0x3826ee['model']],'as':_0x3826ee['as'],'attributes':_0x3826ee[_0xde34('0x1a')],'include':_0x3826ee['include']?_[_0xde34('0x1c')](_0x3826ee[_0xde34('0x1b')],function(_0x343f98){return{'model':db[_0x343f98[_0xde34('0x1d')]],'as':_0x343f98['as'],'attributes':_0x343f98['attributes'],'include':_0x343f98[_0xde34('0x1b')]?_[_0xde34('0x1c')](_0x343f98[_0xde34('0x1b')],function(_0x2bf12c){return{'model':db[_0x2bf12c['model']],'as':_0x2bf12c['as'],'attributes':_0x2bf12c[_0xde34('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xde34('0xd')](function(_0x302a65){logger[_0xde34('0xe')](_0xde34('0x1e'),_0x220b96);logger[_0xde34('0x1f')]('ShowSmsAccount',_0x220b96,JSON[_0xde34('0x11')](_0x302a65));_0x9e0f23(_0x302a65);})[_0xde34('0x15')](function(_0x191144){logger[_0xde34('0x12')]('ShowSmsAccount',_0x191144['message'],_0x220b96);_0x57a404(_0x2f65af['error'](0x1f4,_0x191144[_0xde34('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 2c27651..3c98150 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 53c0885..cf28074 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _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(_0x3b6f5d,_0x4a9cb7){var _0x27a106=function(_0xdd7235){while(--_0xdd7235){_0x3b6f5d['push'](_0x3b6f5d['shift']());}};_0x27a106(++_0x4a9cb7);}(_0x008c,0x188));var _0xc008=function(_0x19ef32,_0x3b78ff){_0x19ef32=_0x19ef32-0x0;var _0x20034e=_0x008c[_0x19ef32];return _0x20034e;};'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 18b9c97..7fa3bfe 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 _0x208f=['TEXT','sequelize','exports','STRING'];(function(_0x407a3e,_0x15acb0){var _0x129fe3=function(_0x124c2f){while(--_0x124c2f){_0x407a3e['push'](_0x407a3e['shift']());}};_0x129fe3(++_0x15acb0);}(_0x208f,0x7d));var _0xf208=function(_0x28e9d7,_0x5b4d79){_0x28e9d7=_0x28e9d7-0x0;var _0x256323=_0x208f[_0x28e9d7];return _0x256323;};'use strict';var Sequelize=require(_0xf208('0x0'));module[_0xf208('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf208('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf208('0x3')]()},'description':{'type':Sequelize[_0xf208('0x2')]},'interval':{'type':Sequelize[_0xf208('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf100=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x1b152c,_0x34db95){var _0x3f739e=function(_0xa19a83){while(--_0xa19a83){_0x1b152c['push'](_0x1b152c['shift']());}};_0x3f739e(++_0x34db95);}(_0xf100,0x148));var _0x0f10=function(_0x20ca7f,_0x332c7d){_0x20ca7f=_0x20ca7f-0x0;var _0x29b228=_0xf100[_0x20ca7f];return _0x29b228;};'use strict';var Sequelize=require(_0x0f10('0x0'));module['exports']={'priority':{'type':Sequelize[_0x0f10('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x0f10('0x2')],'allowNull':![],'defaultValue':_0x0f10('0x3')},'appdata':{'type':Sequelize[_0x0f10('0x4')]()},'description':{'type':Sequelize[_0x0f10('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dd348ed..8aac4ed 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 _0x8a65=['fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','params','keys','includeAll','options','find','create','body','catch','update','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','then','end','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','model','query','intersection'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x8a65,0x1dc));var _0x58a6=function(_0x49dba5,_0x1086fd){_0x49dba5=_0x49dba5-0x0;var _0x495fc6=_0x8a65[_0x49dba5];return _0x495fc6;};'use strict';var emlformat=require(_0x58a6('0x0'));var rimraf=require(_0x58a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x58a6('0x2'));var rp=require(_0x58a6('0x3'));var moment=require(_0x58a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x58a6('0x5'));var util=require(_0x58a6('0x6'));var path=require(_0x58a6('0x7'));var sox=require('sox');var csv=require(_0x58a6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x58a6('0x9'));var _=require(_0x58a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58a6('0xb'));var deskjs=require(_0x58a6('0xc'));var toCsv=require(_0x58a6('0x8'));var querystring=require(_0x58a6('0xd'));var Papa=require(_0x58a6('0xe'));var Redis=require(_0x58a6('0xf'));var authService=require(_0x58a6('0x10'));var qs=require(_0x58a6('0x11'));var as=require(_0x58a6('0x12'));var hardwareService=require(_0x58a6('0x13'));var logger=require('../../config/logger')(_0x58a6('0x14'));var utils=require(_0x58a6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x58a6('0x16'));var db=require(_0x58a6('0x17'))['db'];function respondWithStatusCode(_0x1d68ad,_0x2089b3){_0x2089b3=_0x2089b3||0xcc;return function(_0x3fadba){if(_0x3fadba){return _0x1d68ad[_0x58a6('0x18')](_0x2089b3);}return _0x1d68ad[_0x58a6('0x19')](_0x2089b3)['end']();};}function respondWithResult(_0x328ab0,_0x1664fa){_0x1664fa=_0x1664fa||0xc8;return function(_0x37f5a9){if(_0x37f5a9){return _0x328ab0[_0x58a6('0x19')](_0x1664fa)['json'](_0x37f5a9);}};}function respondWithFilteredResult(_0x495904,_0x1a4953){return function(_0x137698){if(_0x137698){var _0x2f9518=typeof _0x1a4953[_0x58a6('0x1a')]===_0x58a6('0x1b')&&typeof _0x1a4953['limit']===_0x58a6('0x1b');var _0x159ca3=_0x137698[_0x58a6('0x1c')];var _0x5515c3=_0x2f9518?0x0:_0x1a4953[_0x58a6('0x1a')];var _0x3dc5f3=_0x2f9518?_0x137698[_0x58a6('0x1c')]:_0x1a4953[_0x58a6('0x1a')]+_0x1a4953[_0x58a6('0x1d')];var _0x1c43c9;if(_0x3dc5f3>=_0x159ca3){_0x3dc5f3=_0x159ca3;_0x1c43c9=0xc8;}else{_0x1c43c9=0xce;}_0x495904['status'](_0x1c43c9);return _0x495904[_0x58a6('0x1e')](_0x58a6('0x1f'),_0x5515c3+'-'+_0x3dc5f3+'/'+_0x159ca3)[_0x58a6('0x20')](_0x137698);}return null;};}function patchUpdates(_0x44b8b1){return function(_0x38865d){try{jsonpatch['apply'](_0x38865d,_0x44b8b1,!![]);}catch(_0x283b8a){return BPromise[_0x58a6('0x21')](_0x283b8a);}return _0x38865d[_0x58a6('0x22')]();};}function saveUpdates(_0x5d37c0,_0x53b1f7){return function(_0x6b76d9){if(_0x6b76d9){return _0x6b76d9['update'](_0x5d37c0)[_0x58a6('0x23')](function(_0x21fd0a){return _0x21fd0a;});}return null;};}function removeEntity(_0x264d64,_0xa07407){return function(_0xf88b6c){if(_0xf88b6c){return _0xf88b6c['destroy']()[_0x58a6('0x23')](function(){_0x264d64['status'](0xcc)[_0x58a6('0x24')]();});}};}function handleEntityNotFound(_0x4cb5d1,_0x243c9d){return function(_0x2a7591){if(!_0x2a7591){_0x4cb5d1[_0x58a6('0x18')](0x194);}return _0x2a7591;};}function handleError(_0x420b14,_0x556319){_0x556319=_0x556319||0x1f4;return function(_0x3740bf){logger[_0x58a6('0x25')](_0x3740bf[_0x58a6('0x26')]);if(_0x3740bf['name']){delete _0x3740bf[_0x58a6('0x27')];}_0x420b14[_0x58a6('0x19')](_0x556319)[_0x58a6('0x28')](_0x3740bf);};}exports['index']=function(_0x560de3,_0x1db7bb){var _0x4f969f={},_0x312304={},_0x3f58e6={'count':0x0,'rows':[]};var _0x195e21=_[_0x58a6('0x29')](db[_0x58a6('0x2a')][_0x58a6('0x2b')],function(_0x433d57){return{'name':_0x433d57[_0x58a6('0x2c')],'type':_0x433d57[_0x58a6('0x2d')]['key']};});_0x312304[_0x58a6('0x2e')]=_[_0x58a6('0x29')](_0x195e21,_0x58a6('0x27'));_0x312304[_0x58a6('0x2f')]=_['keys'](_0x560de3['query']);_0x312304['filters']=_[_0x58a6('0x30')](_0x312304[_0x58a6('0x2e')],_0x312304[_0x58a6('0x2f')]);_0x4f969f['attributes']=_[_0x58a6('0x30')](_0x312304['model'],qs[_0x58a6('0x31')](_0x560de3[_0x58a6('0x2f')]['fields']));_0x4f969f[_0x58a6('0x32')]=_0x4f969f[_0x58a6('0x32')][_0x58a6('0x33')]?_0x4f969f[_0x58a6('0x32')]:_0x312304['model'];if(!_0x560de3[_0x58a6('0x2f')][_0x58a6('0x34')](_0x58a6('0x35'))){_0x4f969f[_0x58a6('0x1d')]=qs[_0x58a6('0x1d')](_0x560de3['query'][_0x58a6('0x1d')]);_0x4f969f[_0x58a6('0x1a')]=qs[_0x58a6('0x1a')](_0x560de3[_0x58a6('0x2f')][_0x58a6('0x1a')]);}_0x4f969f[_0x58a6('0x36')]=qs[_0x58a6('0x37')](_0x560de3[_0x58a6('0x2f')][_0x58a6('0x37')]);_0x4f969f[_0x58a6('0x38')]=qs[_0x58a6('0x39')](_[_0x58a6('0x3a')](_0x560de3['query'],_0x312304['filters']),_0x195e21);if(_0x560de3[_0x58a6('0x2f')][_0x58a6('0x3b')]){_0x4f969f[_0x58a6('0x38')]=_[_0x58a6('0x3c')](_0x4f969f[_0x58a6('0x38')],{'$or':_[_0x58a6('0x29')](_0x195e21,function(_0x17d923){if(_0x17d923['type']!==_0x58a6('0x3d')){var _0x521d46={};_0x521d46[_0x17d923[_0x58a6('0x27')]]={'$like':'%'+_0x560de3[_0x58a6('0x2f')][_0x58a6('0x3b')]+'%'};return _0x521d46;}})});}_0x4f969f=_[_0x58a6('0x3c')]({},_0x4f969f,_0x560de3['options']);var _0x5d8b9d={'where':_0x4f969f[_0x58a6('0x38')]};return db[_0x58a6('0x2a')]['count'](_0x5d8b9d)[_0x58a6('0x23')](function(_0x4772f4){_0x3f58e6[_0x58a6('0x1c')]=_0x4772f4;if(_0x560de3[_0x58a6('0x2f')]['includeAll']){_0x4f969f[_0x58a6('0x3e')]=[{'all':!![]}];}return db[_0x58a6('0x2a')][_0x58a6('0x3f')](_0x4f969f);})[_0x58a6('0x23')](function(_0x5d8300){_0x3f58e6[_0x58a6('0x40')]=_0x5d8300;return _0x3f58e6;})[_0x58a6('0x23')](respondWithFilteredResult(_0x1db7bb,_0x4f969f))['catch'](handleError(_0x1db7bb,null));};exports['show']=function(_0x1bd0ac,_0xa837e0){var _0x483fe7={'raw':!![],'where':{'id':_0x1bd0ac[_0x58a6('0x41')]['id']}},_0x411555={};_0x411555[_0x58a6('0x2e')]=_[_0x58a6('0x42')](db[_0x58a6('0x2a')][_0x58a6('0x2b')]);_0x411555[_0x58a6('0x2f')]=_[_0x58a6('0x42')](_0x1bd0ac['query']);_0x411555[_0x58a6('0x39')]=_[_0x58a6('0x30')](_0x411555[_0x58a6('0x2e')],_0x411555[_0x58a6('0x2f')]);_0x483fe7[_0x58a6('0x32')]=_[_0x58a6('0x30')](_0x411555['model'],qs[_0x58a6('0x31')](_0x1bd0ac['query'][_0x58a6('0x31')]));_0x483fe7['attributes']=_0x483fe7[_0x58a6('0x32')][_0x58a6('0x33')]?_0x483fe7['attributes']:_0x411555[_0x58a6('0x2e')];if(_0x1bd0ac[_0x58a6('0x2f')][_0x58a6('0x43')]){_0x483fe7[_0x58a6('0x3e')]=[{'all':!![]}];}_0x483fe7=_[_0x58a6('0x3c')]({},_0x483fe7,_0x1bd0ac[_0x58a6('0x44')]);return db[_0x58a6('0x2a')][_0x58a6('0x45')](_0x483fe7)[_0x58a6('0x23')](handleEntityNotFound(_0xa837e0,null))['then'](respondWithResult(_0xa837e0,null))['catch'](handleError(_0xa837e0,null));};exports[_0x58a6('0x46')]=function(_0x3deca6,_0x45bcba){return db[_0x58a6('0x2a')][_0x58a6('0x46')](_0x3deca6[_0x58a6('0x47')],{})[_0x58a6('0x23')](respondWithResult(_0x45bcba,0xc9))[_0x58a6('0x48')](handleError(_0x45bcba,null));};exports[_0x58a6('0x49')]=function(_0x5504f0,_0x3d54b9){if(_0x5504f0['body']['id']){delete _0x5504f0[_0x58a6('0x47')]['id'];}return db[_0x58a6('0x2a')][_0x58a6('0x45')]({'where':{'id':_0x5504f0[_0x58a6('0x41')]['id']}})[_0x58a6('0x23')](handleEntityNotFound(_0x3d54b9,null))[_0x58a6('0x23')](saveUpdates(_0x5504f0['body'],null))[_0x58a6('0x23')](respondWithResult(_0x3d54b9,null))['catch'](handleError(_0x3d54b9,null));};exports[_0x58a6('0x4a')]=function(_0x25f6b2,_0x42dbb6){return db[_0x58a6('0x2a')][_0x58a6('0x45')]({'where':{'id':_0x25f6b2[_0x58a6('0x41')]['id']}})[_0x58a6('0x23')](handleEntityNotFound(_0x42dbb6,null))['then'](removeEntity(_0x42dbb6,null))[_0x58a6('0x48')](handleError(_0x42dbb6,null));}; \ No newline at end of file +var _0x38c8=['SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map'];(function(_0x4695ba,_0x5a7f2a){var _0x524b7d=function(_0xfc9707){while(--_0xfc9707){_0x4695ba['push'](_0x4695ba['shift']());}};_0x524b7d(++_0x5a7f2a);}(_0x38c8,0xb3));var _0x838c=function(_0x1e5b8b,_0x4937be){_0x1e5b8b=_0x1e5b8b-0x0;var _0x59393f=_0x38c8[_0x1e5b8b];return _0x59393f;};'use strict';var emlformat=require(_0x838c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x838c('0x1'));var jsonpatch=require(_0x838c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x838c('0x3'));var Mustache=require('mustache');var util=require(_0x838c('0x4'));var path=require('path');var sox=require(_0x838c('0x5'));var csv=require(_0x838c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x838c('0x7'));var _=require('lodash');var squel=require(_0x838c('0x8'));var crypto=require(_0x838c('0x9'));var jsforce=require(_0x838c('0xa'));var deskjs=require(_0x838c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x838c('0xc'));var Papa=require(_0x838c('0xd'));var Redis=require('ioredis');var authService=require(_0x838c('0xe'));var qs=require(_0x838c('0xf'));var as=require(_0x838c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x838c('0x11'))('api');var utils=require(_0x838c('0x12'));var config=require(_0x838c('0x13'));var licenseUtil=require(_0x838c('0x14'));var db=require(_0x838c('0x15'))['db'];function respondWithStatusCode(_0x3916ad,_0x82831f){_0x82831f=_0x82831f||0xcc;return function(_0x53fe01){if(_0x53fe01){return _0x3916ad[_0x838c('0x16')](_0x82831f);}return _0x3916ad[_0x838c('0x17')](_0x82831f)[_0x838c('0x18')]();};}function respondWithResult(_0x590099,_0x1fa8c6){_0x1fa8c6=_0x1fa8c6||0xc8;return function(_0x215dce){if(_0x215dce){return _0x590099[_0x838c('0x17')](_0x1fa8c6)[_0x838c('0x19')](_0x215dce);}};}function respondWithFilteredResult(_0x5691f0,_0x3df280){return function(_0x169710){if(_0x169710){var _0xc2cbf8=typeof _0x3df280['offset']===_0x838c('0x1a')&&typeof _0x3df280[_0x838c('0x1b')]===_0x838c('0x1a');var _0x3119f4=_0x169710[_0x838c('0x1c')];var _0x29d727=_0xc2cbf8?0x0:_0x3df280[_0x838c('0x1d')];var _0x59fc69=_0xc2cbf8?_0x169710[_0x838c('0x1c')]:_0x3df280['offset']+_0x3df280[_0x838c('0x1b')];var _0x56ccaf;if(_0x59fc69>=_0x3119f4){_0x59fc69=_0x3119f4;_0x56ccaf=0xc8;}else{_0x56ccaf=0xce;}_0x5691f0[_0x838c('0x17')](_0x56ccaf);return _0x5691f0[_0x838c('0x1e')](_0x838c('0x1f'),_0x29d727+'-'+_0x59fc69+'/'+_0x3119f4)[_0x838c('0x19')](_0x169710);}return null;};}function patchUpdates(_0x2475c0){return function(_0x330502){try{jsonpatch[_0x838c('0x20')](_0x330502,_0x2475c0,!![]);}catch(_0x3d1023){return BPromise[_0x838c('0x21')](_0x3d1023);}return _0x330502[_0x838c('0x22')]();};}function saveUpdates(_0x56e83a,_0x428eac){return function(_0x2e8239){if(_0x2e8239){return _0x2e8239[_0x838c('0x23')](_0x56e83a)[_0x838c('0x24')](function(_0x562869){return _0x562869;});}return null;};}function removeEntity(_0x3dab9c,_0x5044dd){return function(_0x4d781a){if(_0x4d781a){return _0x4d781a[_0x838c('0x25')]()['then'](function(){_0x3dab9c[_0x838c('0x17')](0xcc)[_0x838c('0x18')]();});}};}function handleEntityNotFound(_0x259ad0,_0x3b6807){return function(_0x18ee88){if(!_0x18ee88){_0x259ad0[_0x838c('0x16')](0x194);}return _0x18ee88;};}function handleError(_0x4e8400,_0x529ffc){_0x529ffc=_0x529ffc||0x1f4;return function(_0x141ad7){logger[_0x838c('0x26')](_0x141ad7[_0x838c('0x27')]);if(_0x141ad7[_0x838c('0x28')]){delete _0x141ad7[_0x838c('0x28')];}_0x4e8400[_0x838c('0x17')](_0x529ffc)[_0x838c('0x29')](_0x141ad7);};}exports['index']=function(_0x4953bd,_0x1378a3){var _0x170650={},_0x1e5fd4={},_0x1383eb={'count':0x0,'rows':[]};var _0x372cae=_[_0x838c('0x2a')](db[_0x838c('0x2b')][_0x838c('0x2c')],function(_0x2fe917){return{'name':_0x2fe917[_0x838c('0x2d')],'type':_0x2fe917['type'][_0x838c('0x2e')]};});_0x1e5fd4[_0x838c('0x2f')]=_['map'](_0x372cae,_0x838c('0x28'));_0x1e5fd4[_0x838c('0x30')]=_[_0x838c('0x31')](_0x4953bd[_0x838c('0x30')]);_0x1e5fd4[_0x838c('0x32')]=_[_0x838c('0x33')](_0x1e5fd4['model'],_0x1e5fd4[_0x838c('0x30')]);_0x170650[_0x838c('0x34')]=_[_0x838c('0x33')](_0x1e5fd4[_0x838c('0x2f')],qs[_0x838c('0x35')](_0x4953bd[_0x838c('0x30')][_0x838c('0x35')]));_0x170650['attributes']=_0x170650[_0x838c('0x34')][_0x838c('0x36')]?_0x170650[_0x838c('0x34')]:_0x1e5fd4[_0x838c('0x2f')];if(!_0x4953bd[_0x838c('0x30')][_0x838c('0x37')](_0x838c('0x38'))){_0x170650['limit']=qs[_0x838c('0x1b')](_0x4953bd[_0x838c('0x30')][_0x838c('0x1b')]);_0x170650[_0x838c('0x1d')]=qs[_0x838c('0x1d')](_0x4953bd['query'][_0x838c('0x1d')]);}_0x170650['order']=qs[_0x838c('0x39')](_0x4953bd[_0x838c('0x30')]['sort']);_0x170650['where']=qs[_0x838c('0x32')](_['pick'](_0x4953bd['query'],_0x1e5fd4['filters']),_0x372cae);if(_0x4953bd['query']['filter']){_0x170650[_0x838c('0x3a')]=_[_0x838c('0x3b')](_0x170650['where'],{'$or':_['map'](_0x372cae,function(_0x3cf2d7){if(_0x3cf2d7[_0x838c('0x3c')]!==_0x838c('0x3d')){var _0x351e60={};_0x351e60[_0x3cf2d7['name']]={'$like':'%'+_0x4953bd[_0x838c('0x30')][_0x838c('0x3e')]+'%'};return _0x351e60;}})});}_0x170650=_['merge']({},_0x170650,_0x4953bd[_0x838c('0x3f')]);var _0x273ec2={'where':_0x170650[_0x838c('0x3a')]};return db[_0x838c('0x2b')][_0x838c('0x1c')](_0x273ec2)[_0x838c('0x24')](function(_0x10011d){_0x1383eb[_0x838c('0x1c')]=_0x10011d;if(_0x4953bd[_0x838c('0x30')]['includeAll']){_0x170650[_0x838c('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0x838c('0x41')](_0x170650);})[_0x838c('0x24')](function(_0x596cf7){_0x1383eb[_0x838c('0x42')]=_0x596cf7;return _0x1383eb;})[_0x838c('0x24')](respondWithFilteredResult(_0x1378a3,_0x170650))[_0x838c('0x43')](handleError(_0x1378a3,null));};exports[_0x838c('0x44')]=function(_0x1af91e,_0x45ed59){var _0x530175={'raw':!![],'where':{'id':_0x1af91e['params']['id']}},_0x36e89b={};_0x36e89b[_0x838c('0x2f')]=_['keys'](db[_0x838c('0x2b')][_0x838c('0x2c')]);_0x36e89b[_0x838c('0x30')]=_[_0x838c('0x31')](_0x1af91e[_0x838c('0x30')]);_0x36e89b[_0x838c('0x32')]=_['intersection'](_0x36e89b['model'],_0x36e89b[_0x838c('0x30')]);_0x530175[_0x838c('0x34')]=_[_0x838c('0x33')](_0x36e89b[_0x838c('0x2f')],qs['fields'](_0x1af91e[_0x838c('0x30')][_0x838c('0x35')]));_0x530175[_0x838c('0x34')]=_0x530175[_0x838c('0x34')][_0x838c('0x36')]?_0x530175['attributes']:_0x36e89b[_0x838c('0x2f')];if(_0x1af91e[_0x838c('0x30')][_0x838c('0x45')]){_0x530175['include']=[{'all':!![]}];}_0x530175=_[_0x838c('0x3b')]({},_0x530175,_0x1af91e[_0x838c('0x3f')]);return db[_0x838c('0x2b')][_0x838c('0x46')](_0x530175)[_0x838c('0x24')](handleEntityNotFound(_0x45ed59,null))[_0x838c('0x24')](respondWithResult(_0x45ed59,null))[_0x838c('0x43')](handleError(_0x45ed59,null));};exports[_0x838c('0x47')]=function(_0x92ef9,_0x7f28dd){return db[_0x838c('0x2b')]['create'](_0x92ef9[_0x838c('0x48')],{})[_0x838c('0x24')](respondWithResult(_0x7f28dd,0xc9))['catch'](handleError(_0x7f28dd,null));};exports['update']=function(_0x5543f6,_0xaa6ea9){if(_0x5543f6[_0x838c('0x48')]['id']){delete _0x5543f6[_0x838c('0x48')]['id'];}return db[_0x838c('0x2b')][_0x838c('0x46')]({'where':{'id':_0x5543f6[_0x838c('0x49')]['id']}})[_0x838c('0x24')](handleEntityNotFound(_0xaa6ea9,null))['then'](saveUpdates(_0x5543f6['body'],null))[_0x838c('0x24')](respondWithResult(_0xaa6ea9,null))[_0x838c('0x43')](handleError(_0xaa6ea9,null));};exports[_0x838c('0x25')]=function(_0x910529,_0x4f243f){return db[_0x838c('0x2b')][_0x838c('0x46')]({'where':{'id':_0x910529[_0x838c('0x49')]['id']}})[_0x838c('0x24')](handleEntityNotFound(_0x4f243f,null))[_0x838c('0x24')](removeEntity(_0x4f243f,null))[_0x838c('0x43')](handleError(_0x4f243f,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c004e1d..14f2c4d 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 _0xe713=['rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','api','bluebird'];(function(_0x4a47e1,_0x28b1ca){var _0x3f321d=function(_0x5316d7){while(--_0x5316d7){_0x4a47e1['push'](_0x4a47e1['shift']());}};_0x3f321d(++_0x28b1ca);}(_0xe713,0x1dc));var _0x3e71=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xe713[_0x512c83];return _0x1f7f25;};'use strict';var _=require(_0x3e71('0x0'));var util=require(_0x3e71('0x1'));var logger=require('../../config/logger')(_0x3e71('0x2'));var moment=require('moment');var BPromise=require(_0x3e71('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3e71('0x4'));var config=require(_0x3e71('0x5'));var attributes=require(_0x3e71('0x6'));module[_0x3e71('0x7')]=function(_0x46cf5c,_0x52752c){return _0x46cf5c[_0x3e71('0x8')](_0x3e71('0x9'),attributes,{'tableName':_0x3e71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e71('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcde8=['path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x5c6b90,_0x4d181a){var _0x3071ce=function(_0x144c23){while(--_0x144c23){_0x5c6b90['push'](_0x5c6b90['shift']());}};_0x3071ce(++_0x4d181a);}(_0xcde8,0x10c));var _0x8cde=function(_0x218e7d,_0x46292b){_0x218e7d=_0x218e7d-0x0;var _0x1f6931=_0xcde8[_0x218e7d];return _0x1f6931;};'use strict';var _=require(_0x8cde('0x0'));var util=require(_0x8cde('0x1'));var logger=require(_0x8cde('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8cde('0x3'));var rp=require(_0x8cde('0x4'));var fs=require('fs');var path=require(_0x8cde('0x5'));var rimraf=require(_0x8cde('0x6'));var config=require(_0x8cde('0x7'));var attributes=require(_0x8cde('0x8'));module['exports']=function(_0x33a17a,_0x2a3834){return _0x33a17a[_0x8cde('0x9')](_0x8cde('0xa'),attributes,{'tableName':_0x8cde('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8cde('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 3805317..0dd85b1 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 _0x3a15=['code','error','message','SmsApplication,\x20%s,\x20%s','info','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','http','request','then','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x3a15,0xde));var _0x53a1=function(_0x98020e,_0x109498){_0x98020e=_0x98020e-0x0;var _0x355f5e=_0x3a15[_0x98020e];return _0x355f5e;};'use strict';var _=require(_0x53a1('0x0'));var util=require('util');var moment=require(_0x53a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x53a1('0x2'));var fs=require('fs');var Redis=require(_0x53a1('0x3'));var db=require(_0x53a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53a1('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x53a1('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x5a0168,_0x457bf4,_0x2ec206){return new BPromise(function(_0x439447,_0x5252d4){return client[_0x53a1('0x7')](_0x5a0168,_0x2ec206)[_0x53a1('0x8')](function(_0x49e45a){logger['info']('SmsApplication,\x20%s,\x20%s',_0x457bf4,_0x53a1('0x9'));logger[_0x53a1('0xa')](_0x53a1('0xb'),_0x457bf4,_0x53a1('0x9'),JSON['stringify'](_0x49e45a));if(_0x49e45a['error']){if(_0x49e45a['error'][_0x53a1('0xc')]===0x1f4){logger[_0x53a1('0xd')]('SmsApplication,\x20%s,\x20%s',_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x5252d4(_0x49e45a[_0x53a1('0xd')]['message']);}logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);return _0x439447(_0x49e45a[_0x53a1('0xd')][_0x53a1('0xe')]);}else{logger[_0x53a1('0x10')](_0x53a1('0xf'),_0x457bf4,_0x53a1('0x9'));_0x439447(_0x49e45a['result'][_0x53a1('0xe')]);}})[_0x53a1('0x11')](function(_0x1793e0){logger[_0x53a1('0xd')](_0x53a1('0xf'),_0x457bf4,_0x1793e0);_0x5252d4(_0x1793e0);});});} \ No newline at end of file +var _0xd232=['then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request'];(function(_0x4b8c54,_0x376eee){var _0x3190ce=function(_0x349dc5){while(--_0x349dc5){_0x4b8c54['push'](_0x4b8c54['shift']());}};_0x3190ce(++_0x376eee);}(_0xd232,0x74));var _0x2d23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d23('0x0'));var util=require('util');var moment=require(_0x2d23('0x1'));var BPromise=require(_0x2d23('0x2'));var rs=require(_0x2d23('0x3'));var fs=require('fs');var Redis=require(_0x2d23('0x4'));var db=require(_0x2d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d23('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2d23('0x7')][_0x2d23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15c735,_0x53ac18,_0x18cac8){return new BPromise(function(_0x4cf7f4,_0x2c4667){return client[_0x2d23('0x9')](_0x15c735,_0x18cac8)[_0x2d23('0xa')](function(_0x7847cb){logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x53ac18,_0x2d23('0xd'));logger['debug'](_0x2d23('0xe'),_0x53ac18,_0x2d23('0xd'),JSON[_0x2d23('0xf')](_0x7847cb));if(_0x7847cb[_0x2d23('0x10')]){if(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x11')]===0x1f4){logger[_0x2d23('0x10')](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x2c4667(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}logger['error'](_0x2d23('0xc'),_0x53ac18,_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);return _0x4cf7f4(_0x7847cb[_0x2d23('0x10')][_0x2d23('0x12')]);}else{logger['info'](_0x2d23('0xc'),_0x53ac18,'request\x20sent');_0x4cf7f4(_0x7847cb[_0x2d23('0x13')]['message']);}})[_0x2d23('0x14')](function(_0x30b578){logger['error']('SmsApplication,\x20%s,\x20%s',_0x53ac18,_0x30b578);_0x2c4667(_0x30b578);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9d18e26..674e644 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 _0x0713=['put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','smsinteraction:addtags','addTags'];(function(_0x552bf3,_0x948538){var _0xa22eec=function(_0x5a4936){while(--_0x5a4936){_0x552bf3['push'](_0x552bf3['shift']());}};_0xa22eec(++_0x948538);}(_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('0x8')](_0x3071('0xe'),auth[_0x3071('0x9')](),controller[_0x3071('0xf')]);router[_0x3071('0x8')]('/:id/download',auth[_0x3071('0x9')](),controller[_0x3071('0x10')]);router[_0x3071('0x11')]('/',auth[_0x3071('0x9')](),controller[_0x3071('0x12')]);router['post']('/:id/messages',auth[_0x3071('0x9')](),controller['addMessage']);router[_0x3071('0x11')](_0x3071('0x13'),auth['isAuthenticated'](),interaction[_0x3071('0x14')]('sms',_0x3071('0x15')),controller[_0x3071('0x16')]);router[_0x3071('0x17')](_0x3071('0xd'),auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x19')),controller[_0x3071('0x1a')]);router[_0x3071('0x1b')]('/:id',auth[_0x3071('0x9')](),interaction[_0x3071('0x14')](_0x3071('0x18'),_0x3071('0x1c')),controller[_0x3071('0x1d')]);router[_0x3071('0x1b')](_0x3071('0x13'),auth[_0x3071('0x9')](),controller['removeTags']);module[_0x3071('0x1e')]=router; \ No newline at end of file +var _0xb7e7=['download','post','create','addMessage','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy','removeTags','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb7e7[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x8')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0x8')](_0x7b7e('0xe'),auth['isAuthenticated'](),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x8')](_0x7b7e('0x10'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x11')]);router[_0x7b7e('0x12')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x13')]);router[_0x7b7e('0x12')]('/:id/messages',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x14')]);router['post'](_0x7b7e('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x17')),controller[_0x7b7e('0x18')]);router[_0x7b7e('0x19')](_0x7b7e('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7b7e('0x16'),_0x7b7e('0x1a')),controller[_0x7b7e('0x1b')]);router[_0x7b7e('0x1c')](_0x7b7e('0xb'),auth[_0x7b7e('0xc')](),interaction[_0x7b7e('0x1d')](_0x7b7e('0x16'),_0x7b7e('0x1e')),controller[_0x7b7e('0x1f')]);router[_0x7b7e('0x1c')](_0x7b7e('0x15'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x20')]);module[_0x7b7e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 170184e..131bf83 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 _0x39b3=['DATE','ENUM','out','sequelize','BOOLEAN','STRING'];(function(_0x58035f,_0x4db6fe){var _0x230bf4=function(_0x38af0b){while(--_0x38af0b){_0x58035f['push'](_0x58035f['shift']());}};_0x230bf4(++_0x4db6fe);}(_0x39b3,0xc9));var _0x339b=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x39b3[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require(_0x339b('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0x339b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x339b('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x339b('0x2')]},'note':{'type':Sequelize[_0x339b('0x2')]},'phone':{'type':Sequelize[_0x339b('0x2')]},'read1stAt':{'type':Sequelize[_0x339b('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x339b('0x4')]('in',_0x339b('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x339b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x339b('0x4')]('in',_0x339b('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x339b('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x379e=['ENUM','BOOLEAN','sequelize','DATE','STRING','out'];(function(_0x236c7f,_0x135415){var _0x5542c3=function(_0xd3d6aa){while(--_0xd3d6aa){_0x236c7f['push'](_0x236c7f['shift']());}};_0x5542c3(++_0x135415);}(_0x379e,0x104));var _0xe379=function(_0x14e019,_0x458908){_0x14e019=_0x14e019-0x0;var _0x51ef59=_0x379e[_0x14e019];return _0x51ef59;};'use strict';var Sequelize=require(_0xe379('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe379('0x1')]},'disposition':{'type':Sequelize[_0xe379('0x2')]},'secondDisposition':{'type':Sequelize[_0xe379('0x2')]},'thirdDisposition':{'type':Sequelize[_0xe379('0x2')]},'note':{'type':Sequelize[_0xe379('0x2')]},'phone':{'type':Sequelize[_0xe379('0x2')]},'read1stAt':{'type':Sequelize[_0xe379('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe379('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe379('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xe379('0x4')]('in',_0xe379('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe379('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 06e78be..1c663fa 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 _0x044e=['transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','end','error','stack','name','index','SmsInteraction','fieldName','type','key','findAll','sms','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','create','body','find','describe','addMessage','SmsMessage','ids','omit','findOne','rawAttributes','limit','sort','where','SmsInteractionId','filter','map','$gte','addTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','server','files','tmp','format'];(function(_0x53a1e8,_0x182a82){var _0x51c12c=function(_0x4f7c5e){while(--_0x4f7c5e){_0x53a1e8['push'](_0x53a1e8['shift']());}};_0x51c12c(++_0x182a82);}(_0x044e,0x96));var _0xe044=function(_0x4668d8,_0x2b51de){_0x4668d8=_0x4668d8-0x0;var _0x4d0a7b=_0x044e[_0x4668d8];return _0x4d0a7b;};'use strict';var rimraf=require(_0xe044('0x0'));var zipdir=require(_0xe044('0x1'));var moment=require('moment');var BPromise=require(_0xe044('0x2'));var util=require('util');var path=require('path');var ejs=require(_0xe044('0x3'));var fs=require('fs');var _=require(_0xe044('0x4'));var Redis=require(_0xe044('0x5'));var interaction=require(_0xe044('0x6'));var qs=require(_0xe044('0x7'));var pdf=require(_0xe044('0x8'));var logger=require(_0xe044('0x9'))(_0xe044('0xa'));var config=require('../../config/environment');var db=require(_0xe044('0xb'))['db'];config[_0xe044('0xc')]=_[_0xe044('0xd')](config[_0xe044('0xc')],{'host':_0xe044('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe044('0xc')]));require(_0xe044('0xf'))[_0xe044('0x10')](socket);function respondWithStatusCode(_0x2685a7,_0x37b8c3){_0x37b8c3=_0x37b8c3||0xcc;return function(_0x18f721){if(_0x18f721){return _0x2685a7[_0xe044('0x11')](_0x37b8c3);}return _0x2685a7[_0xe044('0x12')](_0x37b8c3)['end']();};}function respondWithResult(_0x206b94,_0x50b8fe){_0x50b8fe=_0x50b8fe||0xc8;return function(_0x1a0df1){if(_0x1a0df1){return _0x206b94[_0xe044('0x12')](_0x50b8fe)[_0xe044('0x13')](_0x1a0df1);}};}function respondWithFilteredResult(_0x210f4d,_0x47db68){return function(_0x39135d){if(_0x39135d){var _0x1df323=typeof _0x47db68[_0xe044('0x14')]===_0xe044('0x15')&&typeof _0x47db68['limit']==='undefined';var _0x4e52a7=_0x39135d[_0xe044('0x16')];var _0x12c148=_0x1df323?0x0:_0x47db68[_0xe044('0x14')];var _0x47e3d0=_0x1df323?_0x39135d[_0xe044('0x16')]:_0x47db68['offset']+_0x47db68['limit'];var _0x52cb2e;if(_0x47e3d0>=_0x4e52a7){_0x47e3d0=_0x4e52a7;_0x52cb2e=0xc8;}else{_0x52cb2e=0xce;}_0x210f4d[_0xe044('0x12')](_0x52cb2e);return _0x210f4d[_0xe044('0x17')](_0xe044('0x18'),_0x12c148+'-'+_0x47e3d0+'/'+_0x4e52a7)[_0xe044('0x13')](_0x39135d);}return null;};}function saveUpdates(_0x11ccdf){return function(_0x3ec556){if(_0x3ec556){return _0x3ec556[_0xe044('0x19')](_0x11ccdf)[_0xe044('0x1a')](function(_0x27b6c3){return _0x27b6c3;});}return null;};}function removeEntity(_0x509df6){return function(_0x16bd1f){if(_0x16bd1f){return _0x16bd1f[_0xe044('0x1b')]()[_0xe044('0x1a')](function(){_0x509df6[_0xe044('0x12')](0xcc)[_0xe044('0x1c')]();});}};}function handleEntityNotFound(_0xba5f13){return function(_0x3f87a2){if(!_0x3f87a2){_0xba5f13[_0xe044('0x11')](0x194);}return _0x3f87a2;};}function handleError(_0x4f18ef,_0x45b32e){_0x45b32e=_0x45b32e||0x1f4;return function(_0x233720){logger[_0xe044('0x1d')](_0x233720[_0xe044('0x1e')]);if(_0x233720[_0xe044('0x1f')]){delete _0x233720[_0xe044('0x1f')];}_0x4f18ef['status'](_0x45b32e)['send'](_0x233720);};}exports[_0xe044('0x20')]=function(_0x58e3e1,_0x83a1f9){var _0x190ad={};var _0x1b5726=_['map'](db[_0xe044('0x21')]['rawAttributes'],function(_0x4a727e){return{'name':_0x4a727e[_0xe044('0x22')],'type':_0x4a727e[_0xe044('0x23')][_0xe044('0x24')]};});_0x190ad=qs['getOptions'](_0x1b5726,_0x58e3e1);return interaction[_0xe044('0x25')](_0xe044('0x26'),_0x58e3e1[_0xe044('0x27')],_0x58e3e1[_0xe044('0x28')],_0x190ad,_0x1b5726)[_0xe044('0x1a')](respondWithFilteredResult(_0x83a1f9,_0x190ad))[_0xe044('0x29')](handleError(_0x83a1f9,null));};exports[_0xe044('0x2a')]=function(_0x1ccc52,_0x42dfd0){var _0x1429d3={'raw':![],'where':{'id':_0x1ccc52[_0xe044('0x2b')]['id']}},_0x42e0b9={};_0x42e0b9[_0xe044('0x2c')]=_[_0xe044('0x2d')](db[_0xe044('0x21')]['rawAttributes']);_0x42e0b9['query']=_[_0xe044('0x2d')](_0x1ccc52['query']);_0x42e0b9[_0xe044('0x2e')]=_[_0xe044('0x2f')](_0x42e0b9['model'],_0x42e0b9[_0xe044('0x27')]);_0x1429d3['attributes']=_[_0xe044('0x2f')](_0x42e0b9[_0xe044('0x2c')],qs[_0xe044('0x30')](_0x1ccc52[_0xe044('0x27')][_0xe044('0x30')]));_0x1429d3[_0xe044('0x31')]=_0x1429d3[_0xe044('0x31')][_0xe044('0x32')]?_0x1429d3['attributes']:_0x42e0b9[_0xe044('0x2c')];if(_0x1ccc52[_0xe044('0x27')][_0xe044('0x33')]){_0x1429d3['include']=[{'all':!![]}];}_0x1429d3=_[_0xe044('0x34')]({},_0x1429d3,_0x1ccc52[_0xe044('0x35')]);return db[_0xe044('0x21')]['find'](_0x1429d3)[_0xe044('0x1a')](handleEntityNotFound(_0x42dfd0,null))[_0xe044('0x1a')](respondWithResult(_0x42dfd0,null))['catch'](handleError(_0x42dfd0,null));};exports[_0xe044('0x36')]=function(_0x5ae7e1,_0x412758){return db[_0xe044('0x21')][_0xe044('0x36')](_0x5ae7e1['body'],{})[_0xe044('0x1a')](respondWithResult(_0x412758,0xc9))['catch'](handleError(_0x412758,null));};exports['update']=function(_0x284cf4,_0x27f2b2){if(_0x284cf4[_0xe044('0x37')]['id']){delete _0x284cf4[_0xe044('0x37')]['id'];}return db['SmsInteraction'][_0xe044('0x38')]({'where':{'id':_0x284cf4[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x27f2b2,null))[_0xe044('0x1a')](saveUpdates(_0x284cf4[_0xe044('0x37')],null))[_0xe044('0x1a')](respondWithResult(_0x27f2b2,null))['catch'](handleError(_0x27f2b2,null));};exports[_0xe044('0x1b')]=function(_0x68a6a2,_0x2c7b0b){return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0x68a6a2['params']['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2c7b0b,null))[_0xe044('0x1a')](removeEntity(_0x2c7b0b,null))[_0xe044('0x29')](handleError(_0x2c7b0b,null));};exports[_0xe044('0x39')]=function(_0x547be8,_0x2e25d5){return db[_0xe044('0x21')]['describe']()['then'](respondWithResult(_0x2e25d5,null))['catch'](handleError(_0x2e25d5,null));};exports[_0xe044('0x3a')]=function(_0x17cb2b,_0x1c4722){return db[_0xe044('0x3b')][_0xe044('0x38')]({'where':{'id':_0x17cb2b[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x1c4722,null))[_0xe044('0x1a')](function(_0x3e0184){if(_0x3e0184){return _0x3e0184[_0xe044('0x3a')](_0x17cb2b['body'][_0xe044('0x3c')],_[_0xe044('0x3d')](_0x17cb2b[_0xe044('0x37')],[_0xe044('0x3c'),'id'])||{});}})[_0xe044('0x1a')](respondWithResult(_0x1c4722,null))[_0xe044('0x29')](handleError(_0x1c4722,null));};exports['getMessages']=function(_0x2928f8,_0x48f880){var _0x2db405={'raw':![],'where':{}};var _0x3a7700={};var _0x4e4215={'count':0x0,'rows':[]};return db[_0xe044('0x21')][_0xe044('0x3e')]({'where':{'id':_0x2928f8[_0xe044('0x2b')]['id']}})['then'](handleEntityNotFound(_0x48f880,null))[_0xe044('0x1a')](function(_0x2392a8){if(_0x2392a8){_0x3a7700[_0xe044('0x2c')]=_[_0xe044('0x2d')](db['SmsMessage'][_0xe044('0x3f')]);_0x3a7700[_0xe044('0x27')]=_[_0xe044('0x2d')](_0x2928f8[_0xe044('0x27')]);_0x3a7700[_0xe044('0x2e')]=_['intersection'](_0x3a7700[_0xe044('0x2c')],_0x3a7700['query']);_0x2db405['attributes']=_[_0xe044('0x2f')](_0x3a7700[_0xe044('0x2c')],qs[_0xe044('0x30')](_0x2928f8['query'][_0xe044('0x30')]));_0x2db405['attributes']=_0x2db405[_0xe044('0x31')][_0xe044('0x32')]?_0x2db405['attributes']:_0x3a7700[_0xe044('0x2c')];if(!_0x2928f8[_0xe044('0x27')]['hasOwnProperty']('nolimit')){_0x2db405[_0xe044('0x40')]=qs[_0xe044('0x40')](_0x2928f8[_0xe044('0x27')][_0xe044('0x40')]);_0x2db405[_0xe044('0x14')]=qs[_0xe044('0x14')](_0x2928f8[_0xe044('0x27')]['offset']);}_0x2db405['order']=qs['sort'](_0x2928f8[_0xe044('0x27')][_0xe044('0x41')]);_0x2db405['where']=qs[_0xe044('0x2e')](_['pick'](_0x2928f8[_0xe044('0x27')],_0x3a7700[_0xe044('0x2e')]));_0x2db405[_0xe044('0x42')][_0xe044('0x43')]=_0x2392a8['id'];if(_0x2928f8[_0xe044('0x27')][_0xe044('0x44')]){_0x2db405['where']=_['merge'](_0x2db405[_0xe044('0x42')],{'$or':_[_0xe044('0x45')](_0x2db405[_0xe044('0x31')],function(_0x5b789c){var _0x1d767f={};_0x1d767f[_0x5b789c]={'$like':'%'+_0x2928f8[_0xe044('0x27')][_0xe044('0x44')]+'%'};return _0x1d767f;})});}if(_0x2928f8[_0xe044('0x27')][_0xe044('0x46')]){var _0x4b6bf6=_0x2928f8[_0xe044('0x27')][_0xe044('0x46')]['split'](',');var _0x91c5af={};_0x91c5af[_0x4b6bf6[0x0]]={'$gte':moment(_0x4b6bf6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x2db405[_0xe044('0x42')]=_[_0xe044('0x34')](_0x2db405[_0xe044('0x42')],_0x91c5af);}_0x2db405=_[_0xe044('0x34')]({},_0x2db405,_0x2928f8[_0xe044('0x35')]);return db[_0xe044('0x3b')][_0xe044('0x16')]({'where':_0x2db405[_0xe044('0x42')]})[_0xe044('0x1a')](function(_0x2cf9aa){_0x4e4215['count']=_0x2cf9aa;if(_0x2928f8['query'][_0xe044('0x33')]){_0x2db405['include']=[{'all':!![]}];}return db[_0xe044('0x3b')][_0xe044('0x25')](_0x2db405);})['then'](function(_0x4dec9c){_0x4e4215['rows']=_0x4dec9c;return _0x4e4215;});}})[_0xe044('0x1a')](respondWithFilteredResult(_0x48f880,_0x2db405))[_0xe044('0x29')](handleError(_0x48f880,null));};exports[_0xe044('0x47')]=function(_0x56b367,_0x2ec1ae){return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0x56b367[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2ec1ae,null))[_0xe044('0x1a')](function(_0x5f5a36){if(_0x5f5a36){return _0x5f5a36['setTags'](_0x56b367[_0xe044('0x37')][_0xe044('0x3c')],_[_0xe044('0x3d')](_0x56b367[_0xe044('0x37')],[_0xe044('0x3c'),'id'])||{})[_0xe044('0x48')](function(){return db[_0xe044('0x49')][_0xe044('0x25')]({'attributes':['id','name',_0xe044('0x4a')],'where':{'id':_0x56b367[_0xe044('0x37')][_0xe044('0x3c')]}});})['then'](function(_0x3c5abb){socket[_0xe044('0x4b')](_0xe044('0x4c'),{'id':Number(_0x56b367[_0xe044('0x2b')]['id']),'tags':_0x3c5abb||[]});return{'id':Number(_0x56b367[_0xe044('0x2b')]['id']),'tags':_0x3c5abb||[]};});}})['then'](respondWithResult(_0x2ec1ae,null))[_0xe044('0x29')](handleError(_0x2ec1ae,null));};exports['removeTags']=function(_0x33e457,_0x2dc078){return db['SmsInteraction'][_0xe044('0x38')]({'where':{'id':_0x33e457[_0xe044('0x2b')]['id']}})[_0xe044('0x1a')](handleEntityNotFound(_0x2dc078,null))['then'](function(_0x188f4f){if(_0x188f4f){return _0x188f4f[_0xe044('0x4d')](_0x33e457[_0xe044('0x27')][_0xe044('0x3c')]);}})[_0xe044('0x1a')](respondWithStatusCode(_0x2dc078,null))[_0xe044('0x29')](handleError(_0x2dc078,null));};exports[_0xe044('0x4e')]=function(_0xd1cda5,_0x51a321){var _0x1d900a=moment()[_0xe044('0x4f')]()[_0xe044('0x50')]();var _0x4486ca=path[_0xe044('0x51')](config['root'],_0xe044('0x52'),_0xe044('0x53'),_0xe044('0x54'));var _0x1443a3=path['join'](_0x4486ca,_0x1d900a);var _0x1cbab0=util[_0xe044('0x55')](_0xe044('0x56'),_0xd1cda5[_0xe044('0x2b')]['id'],_0x1d900a);var _0x3ac728=path['join'](_0x4486ca,_0x1cbab0);var _0x4806e6=[];_0x4806e6[_0xe044('0x57')]({'model':db[_0xe044('0x58')],'as':_0xe044('0x58'),'attributes':['id',_0xe044('0x59')],'raw':!![]});_0x4806e6['push']({'model':db['CmContact'],'as':_0xe044('0x5a'),'attributes':['id',_0xe044('0x5b'),_0xe044('0x5c')],'raw':!![]});var _0x112e6e=[{'model':db[_0xe044('0x3b')],'as':_0xe044('0x5d'),'attributes':['id',_0xe044('0x37'),_0xe044('0x5e'),_0xe044('0x5f'),_0xe044('0x60'),_0xe044('0x61')],'include':_0x4806e6}];_0x112e6e[_0xe044('0x57')]({'model':db[_0xe044('0x62')],'as':'Account','attributes':['id',_0xe044('0x1f')]});_0x112e6e[_0xe044('0x57')]({'model':db['User'],'as':_0xe044('0x63'),'attributes':['id','fullname']});return db[_0xe044('0x21')][_0xe044('0x38')]({'where':{'id':_0xd1cda5[_0xe044('0x2b')]['id']},'include':_0x112e6e})[_0xe044('0x1a')](handleEntityNotFound(_0x51a321,null))[_0xe044('0x1a')](function(_0x177de3){if(_0x177de3){var _0x2145a9=_0x177de3[_0xe044('0x64')]({'plain':!![]});fs[_0xe044('0x65')](_0x1443a3);var _0x9ced9a={'channel':'Sms','account':_0x2145a9['Account'][_0xe044('0x1f')],'agent':_0x2145a9[_0xe044('0x63')]?_0x2145a9[_0xe044('0x63')][_0xe044('0x59')]:_0xe044('0x66'),'createdAt':moment(_0x2145a9[_0xe044('0x5e')])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')](),'closedAt':_0x2145a9['closed']?moment(_0x2145a9[_0xe044('0x68')])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')]():'','disposition':_0x2145a9['disposition'],'messages':_(_0x2145a9['Messages'])[_0xe044('0x44')]({'secret':![]})[_0xe044('0x45')](function(_0x43d3d0){return{'date':moment(_0x43d3d0['createdAt'])[_0xe044('0x55')](_0xe044('0x67'))[_0xe044('0x50')](),'sender':_0x43d3d0[_0xe044('0x5f')]===_0xe044('0x69')?_0x43d3d0[_0xe044('0x58')]?_0x43d3d0[_0xe044('0x58')][_0xe044('0x59')]:_0xe044('0x6a'):_0x43d3d0[_0xe044('0x5a')][_0xe044('0x5b')]+(_0x43d3d0['Contact']['lastName']?'\x20'+_0x43d3d0[_0xe044('0x5a')][_0xe044('0x5c')]:''),'body':_0x43d3d0[_0xe044('0x37')],'direction':_0x43d3d0[_0xe044('0x5f')]===_0xe044('0x69')?'A':'C','secret':_0x43d3d0[_0xe044('0x60')],'read':_0x43d3d0[_0xe044('0x61')]};})[_0xe044('0x6b')]()};return ejs[_0xe044('0x6c')](path[_0xe044('0x51')](config['root'],'server',_0xe044('0x6d'),_0xe044('0x6e')),{'interaction':_0x9ced9a})[_0xe044('0x1a')](function(_0x1e7f29){var _0x1b13f7=path[_0xe044('0x51')](_0x1443a3,_0xe044('0x6f')+_0x2145a9['id']+'-'+_0x1d900a+_0xe044('0x70'));var _0x46b685={'path':_0x1b13f7,'channel':_0xe044('0x71'),'interactionId':_0x2145a9['id']};return pdf[_0xe044('0x72')](_0x1e7f29,_0x46b685);})[_0xe044('0x1a')](function(){return new BPromise(function(_0x264f05,_0x410ede){zipdir(_0x1443a3,{'saveTo':_0x3ac728},function(_0x1074c9,_0x218c96){if(_0x1074c9)return _0x410ede(_0x1074c9);return _0x264f05(_0x218c96);});})[_0xe044('0x1a')](function(){return new BPromise(function(_0x2e1aa2,_0x3b8755){rimraf(_0x1443a3,function(_0x4389fe){if(_0x4389fe)_0x3b8755(_0x4389fe);return _0x2e1aa2();});});})[_0xe044('0x1a')](function(){return _0x51a321[_0xe044('0x4e')](_0x3ac728,_0x1cbab0,function(_0x5270cc){if(_0x5270cc){console[_0xe044('0x73')](_0xe044('0x74'),_0x5270cc);}else{fs[_0xe044('0x75')](_0x3ac728);}});});});}else{return _0x51a321[_0xe044('0x11')](0xc8);}})[_0xe044('0x29')](handleError(_0x51a321,null));}; \ No newline at end of file +var _0x5c8c=['ejs','lodash','../../components/interaction/service','../../components/export/pdf','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','then','end','error','stack','name','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','update','params','destroy','find','describe','SmsMessage','addMessage','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','ids','spread','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','server','tmp','join','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Messages','direction','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','createdAt','closed','disposition','out','secret','value','root','views','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path'];(function(_0x4b4dbd,_0x341276){var _0x5df992=function(_0x46aac7){while(--_0x46aac7){_0x4b4dbd['push'](_0x4b4dbd['shift']());}};_0x5df992(++_0x341276);}(_0x5c8c,0xed));var _0xc5c8=function(_0x3bc3de,_0x27a600){_0x3bc3de=_0x3bc3de-0x0;var _0xb331e1=_0x5c8c[_0x3bc3de];return _0xb331e1;};'use strict';var rimraf=require(_0xc5c8('0x0'));var zipdir=require(_0xc5c8('0x1'));var moment=require(_0xc5c8('0x2'));var BPromise=require(_0xc5c8('0x3'));var util=require('util');var path=require(_0xc5c8('0x4'));var ejs=require(_0xc5c8('0x5'));var fs=require('fs');var _=require(_0xc5c8('0x6'));var Redis=require('ioredis');var interaction=require(_0xc5c8('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xc5c8('0x8'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0xc5c8('0x9'))['db'];config[_0xc5c8('0xa')]=_[_0xc5c8('0xb')](config[_0xc5c8('0xa')],{'host':_0xc5c8('0xc'),'port':0x18eb});var socket=require(_0xc5c8('0xd'))(new Redis(config[_0xc5c8('0xa')]));require(_0xc5c8('0xe'))[_0xc5c8('0xf')](socket);function respondWithStatusCode(_0xe4a1b6,_0x509675){_0x509675=_0x509675||0xcc;return function(_0x5388bd){if(_0x5388bd){return _0xe4a1b6[_0xc5c8('0x10')](_0x509675);}return _0xe4a1b6[_0xc5c8('0x11')](_0x509675)['end']();};}function respondWithResult(_0x4ed174,_0x1f07af){_0x1f07af=_0x1f07af||0xc8;return function(_0x38c4b8){if(_0x38c4b8){return _0x4ed174[_0xc5c8('0x11')](_0x1f07af)['json'](_0x38c4b8);}};}function respondWithFilteredResult(_0x4c86ec,_0x2c3077){return function(_0x142ea1){if(_0x142ea1){var _0x19ded2=typeof _0x2c3077[_0xc5c8('0x12')]===_0xc5c8('0x13')&&typeof _0x2c3077['limit']===_0xc5c8('0x13');var _0x44c419=_0x142ea1[_0xc5c8('0x14')];var _0x13342a=_0x19ded2?0x0:_0x2c3077[_0xc5c8('0x12')];var _0x4d5c1a=_0x19ded2?_0x142ea1['count']:_0x2c3077[_0xc5c8('0x12')]+_0x2c3077[_0xc5c8('0x15')];var _0x411c84;if(_0x4d5c1a>=_0x44c419){_0x4d5c1a=_0x44c419;_0x411c84=0xc8;}else{_0x411c84=0xce;}_0x4c86ec[_0xc5c8('0x11')](_0x411c84);return _0x4c86ec[_0xc5c8('0x16')](_0xc5c8('0x17'),_0x13342a+'-'+_0x4d5c1a+'/'+_0x44c419)[_0xc5c8('0x18')](_0x142ea1);}return null;};}function saveUpdates(_0x40fe08){return function(_0x50e9fa){if(_0x50e9fa){return _0x50e9fa['update'](_0x40fe08)[_0xc5c8('0x19')](function(_0x29f9ca){return _0x29f9ca;});}return null;};}function removeEntity(_0x4bf2d4){return function(_0x17fe5a){if(_0x17fe5a){return _0x17fe5a['destroy']()[_0xc5c8('0x19')](function(){_0x4bf2d4[_0xc5c8('0x11')](0xcc)[_0xc5c8('0x1a')]();});}};}function handleEntityNotFound(_0x4103f8){return function(_0x29d028){if(!_0x29d028){_0x4103f8[_0xc5c8('0x10')](0x194);}return _0x29d028;};}function handleError(_0x3be812,_0x527167){_0x527167=_0x527167||0x1f4;return function(_0xcc783d){logger[_0xc5c8('0x1b')](_0xcc783d[_0xc5c8('0x1c')]);if(_0xcc783d[_0xc5c8('0x1d')]){delete _0xcc783d[_0xc5c8('0x1d')];}_0x3be812[_0xc5c8('0x11')](_0x527167)['send'](_0xcc783d);};}exports['index']=function(_0x1d063d,_0x1f8f3c){var _0x35b60a={};var _0xc6a217=_[_0xc5c8('0x1e')](db[_0xc5c8('0x1f')][_0xc5c8('0x20')],function(_0x1f60e8){return{'name':_0x1f60e8[_0xc5c8('0x21')],'type':_0x1f60e8[_0xc5c8('0x22')][_0xc5c8('0x23')]};});_0x35b60a=qs[_0xc5c8('0x24')](_0xc6a217,_0x1d063d);return interaction[_0xc5c8('0x25')](_0xc5c8('0x26'),_0x1d063d[_0xc5c8('0x27')],_0x1d063d['user'],_0x35b60a,_0xc6a217)[_0xc5c8('0x19')](respondWithFilteredResult(_0x1f8f3c,_0x35b60a))[_0xc5c8('0x28')](handleError(_0x1f8f3c,null));};exports[_0xc5c8('0x29')]=function(_0x4b63c2,_0x3dee46){var _0x5a0fc4={'raw':![],'where':{'id':_0x4b63c2['params']['id']}},_0xec228d={};_0xec228d[_0xc5c8('0x2a')]=_[_0xc5c8('0x2b')](db[_0xc5c8('0x1f')][_0xc5c8('0x20')]);_0xec228d[_0xc5c8('0x27')]=_[_0xc5c8('0x2b')](_0x4b63c2[_0xc5c8('0x27')]);_0xec228d[_0xc5c8('0x2c')]=_[_0xc5c8('0x2d')](_0xec228d['model'],_0xec228d['query']);_0x5a0fc4[_0xc5c8('0x2e')]=_['intersection'](_0xec228d[_0xc5c8('0x2a')],qs['fields'](_0x4b63c2[_0xc5c8('0x27')][_0xc5c8('0x2f')]));_0x5a0fc4[_0xc5c8('0x2e')]=_0x5a0fc4[_0xc5c8('0x2e')][_0xc5c8('0x30')]?_0x5a0fc4[_0xc5c8('0x2e')]:_0xec228d[_0xc5c8('0x2a')];if(_0x4b63c2[_0xc5c8('0x27')][_0xc5c8('0x31')]){_0x5a0fc4[_0xc5c8('0x32')]=[{'all':!![]}];}_0x5a0fc4=_[_0xc5c8('0x33')]({},_0x5a0fc4,_0x4b63c2[_0xc5c8('0x34')]);return db[_0xc5c8('0x1f')]['find'](_0x5a0fc4)[_0xc5c8('0x19')](handleEntityNotFound(_0x3dee46,null))[_0xc5c8('0x19')](respondWithResult(_0x3dee46,null))[_0xc5c8('0x28')](handleError(_0x3dee46,null));};exports['create']=function(_0x520a24,_0x288cbd){return db['SmsInteraction'][_0xc5c8('0x35')](_0x520a24[_0xc5c8('0x36')],{})[_0xc5c8('0x19')](respondWithResult(_0x288cbd,0xc9))['catch'](handleError(_0x288cbd,null));};exports[_0xc5c8('0x37')]=function(_0x2cd41f,_0x4ed7f0){if(_0x2cd41f['body']['id']){delete _0x2cd41f[_0xc5c8('0x36')]['id'];}return db[_0xc5c8('0x1f')]['find']({'where':{'id':_0x2cd41f[_0xc5c8('0x38')]['id']}})[_0xc5c8('0x19')](handleEntityNotFound(_0x4ed7f0,null))['then'](saveUpdates(_0x2cd41f[_0xc5c8('0x36')],null))[_0xc5c8('0x19')](respondWithResult(_0x4ed7f0,null))['catch'](handleError(_0x4ed7f0,null));};exports[_0xc5c8('0x39')]=function(_0xcff9e2,_0x41d4cc){return db[_0xc5c8('0x1f')][_0xc5c8('0x3a')]({'where':{'id':_0xcff9e2[_0xc5c8('0x38')]['id']}})[_0xc5c8('0x19')](handleEntityNotFound(_0x41d4cc,null))[_0xc5c8('0x19')](removeEntity(_0x41d4cc,null))[_0xc5c8('0x28')](handleError(_0x41d4cc,null));};exports[_0xc5c8('0x3b')]=function(_0x24457f,_0x302b1f){return db['SmsInteraction'][_0xc5c8('0x3b')]()[_0xc5c8('0x19')](respondWithResult(_0x302b1f,null))[_0xc5c8('0x28')](handleError(_0x302b1f,null));};exports['addMessage']=function(_0x5928af,_0x3e0400){return db[_0xc5c8('0x3c')][_0xc5c8('0x3a')]({'where':{'id':_0x5928af[_0xc5c8('0x38')]['id']}})['then'](handleEntityNotFound(_0x3e0400,null))[_0xc5c8('0x19')](function(_0x199737){if(_0x199737){return _0x199737[_0xc5c8('0x3d')](_0x5928af[_0xc5c8('0x36')]['ids'],_[_0xc5c8('0x3e')](_0x5928af['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x3e0400,null))['catch'](handleError(_0x3e0400,null));};exports[_0xc5c8('0x3f')]=function(_0x5e616b,_0x4791ac){var _0x539405={'raw':![],'where':{}};var _0x2de48f={};var _0x1cfad2={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x5e616b['params']['id']}})[_0xc5c8('0x19')](handleEntityNotFound(_0x4791ac,null))[_0xc5c8('0x19')](function(_0x1d33b3){if(_0x1d33b3){_0x2de48f[_0xc5c8('0x2a')]=_[_0xc5c8('0x2b')](db[_0xc5c8('0x3c')][_0xc5c8('0x20')]);_0x2de48f[_0xc5c8('0x27')]=_[_0xc5c8('0x2b')](_0x5e616b[_0xc5c8('0x27')]);_0x2de48f[_0xc5c8('0x2c')]=_[_0xc5c8('0x2d')](_0x2de48f[_0xc5c8('0x2a')],_0x2de48f[_0xc5c8('0x27')]);_0x539405[_0xc5c8('0x2e')]=_[_0xc5c8('0x2d')](_0x2de48f[_0xc5c8('0x2a')],qs[_0xc5c8('0x2f')](_0x5e616b['query'][_0xc5c8('0x2f')]));_0x539405['attributes']=_0x539405['attributes'][_0xc5c8('0x30')]?_0x539405[_0xc5c8('0x2e')]:_0x2de48f['model'];if(!_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x40')](_0xc5c8('0x41'))){_0x539405[_0xc5c8('0x15')]=qs[_0xc5c8('0x15')](_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x15')]);_0x539405[_0xc5c8('0x12')]=qs[_0xc5c8('0x12')](_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x12')]);}_0x539405[_0xc5c8('0x42')]=qs[_0xc5c8('0x43')](_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x43')]);_0x539405[_0xc5c8('0x44')]=qs[_0xc5c8('0x2c')](_[_0xc5c8('0x45')](_0x5e616b['query'],_0x2de48f[_0xc5c8('0x2c')]));_0x539405[_0xc5c8('0x44')]['SmsInteractionId']=_0x1d33b3['id'];if(_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x46')]){_0x539405[_0xc5c8('0x44')]=_[_0xc5c8('0x33')](_0x539405[_0xc5c8('0x44')],{'$or':_[_0xc5c8('0x1e')](_0x539405['attributes'],function(_0x38652d){var _0x6b568a={};_0x6b568a[_0x38652d]={'$like':'%'+_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x46')]+'%'};return _0x6b568a;})});}if(_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x47')]){var _0x2f2408=_0x5e616b['query'][_0xc5c8('0x47')][_0xc5c8('0x48')](',');var _0x3d227c={};_0x3d227c[_0x2f2408[0x0]]={'$gte':moment(_0x2f2408[0x1])[_0xc5c8('0x49')](_0xc5c8('0x4a'))};_0x539405[_0xc5c8('0x44')]=_[_0xc5c8('0x33')](_0x539405[_0xc5c8('0x44')],_0x3d227c);}_0x539405=_[_0xc5c8('0x33')]({},_0x539405,_0x5e616b[_0xc5c8('0x34')]);return db[_0xc5c8('0x3c')][_0xc5c8('0x14')]({'where':_0x539405[_0xc5c8('0x44')]})['then'](function(_0x193931){_0x1cfad2[_0xc5c8('0x14')]=_0x193931;if(_0x5e616b[_0xc5c8('0x27')][_0xc5c8('0x31')]){_0x539405[_0xc5c8('0x32')]=[{'all':!![]}];}return db['SmsMessage'][_0xc5c8('0x25')](_0x539405);})[_0xc5c8('0x19')](function(_0x681b8b){_0x1cfad2[_0xc5c8('0x4b')]=_0x681b8b;return _0x1cfad2;});}})[_0xc5c8('0x19')](respondWithFilteredResult(_0x4791ac,_0x539405))[_0xc5c8('0x28')](handleError(_0x4791ac,null));};exports[_0xc5c8('0x4c')]=function(_0xe53fa9,_0x247f92){return db[_0xc5c8('0x1f')][_0xc5c8('0x3a')]({'where':{'id':_0xe53fa9[_0xc5c8('0x38')]['id']}})['then'](handleEntityNotFound(_0x247f92,null))[_0xc5c8('0x19')](function(_0xc5a2ec){if(_0xc5a2ec){return _0xc5a2ec[_0xc5c8('0x4d')](_0xe53fa9[_0xc5c8('0x36')][_0xc5c8('0x4e')],_['omit'](_0xe53fa9['body'],[_0xc5c8('0x4e'),'id'])||{})[_0xc5c8('0x4f')](function(){return db['Tag'][_0xc5c8('0x25')]({'attributes':['id',_0xc5c8('0x1d'),_0xc5c8('0x50')],'where':{'id':_0xe53fa9[_0xc5c8('0x36')][_0xc5c8('0x4e')]}});})['then'](function(_0x3edb41){socket[_0xc5c8('0x51')](_0xc5c8('0x52'),{'id':Number(_0xe53fa9[_0xc5c8('0x38')]['id']),'tags':_0x3edb41||[]});return{'id':Number(_0xe53fa9[_0xc5c8('0x38')]['id']),'tags':_0x3edb41||[]};});}})['then'](respondWithResult(_0x247f92,null))['catch'](handleError(_0x247f92,null));};exports[_0xc5c8('0x53')]=function(_0x4c1483,_0x201e78){return db['SmsInteraction'][_0xc5c8('0x3a')]({'where':{'id':_0x4c1483[_0xc5c8('0x38')]['id']}})[_0xc5c8('0x19')](handleEntityNotFound(_0x201e78,null))[_0xc5c8('0x19')](function(_0x136a58){if(_0x136a58){return _0x136a58[_0xc5c8('0x53')](_0x4c1483[_0xc5c8('0x27')]['ids']);}})[_0xc5c8('0x19')](respondWithStatusCode(_0x201e78,null))[_0xc5c8('0x28')](handleError(_0x201e78,null));};exports[_0xc5c8('0x54')]=function(_0x12245a,_0x20d6a6){var _0x53deb5=moment()[_0xc5c8('0x55')]()[_0xc5c8('0x56')]();var _0x2b4ea0=path['join'](config['root'],_0xc5c8('0x57'),'files',_0xc5c8('0x58'));var _0x58e973=path[_0xc5c8('0x59')](_0x2b4ea0,_0x53deb5);var _0x2868ef=util['format'](_0xc5c8('0x5a'),_0x12245a[_0xc5c8('0x38')]['id'],_0x53deb5);var _0x1d35bb=path[_0xc5c8('0x59')](_0x2b4ea0,_0x2868ef);var _0x28cbe0=[];_0x28cbe0['push']({'model':db['User'],'as':_0xc5c8('0x5b'),'attributes':['id',_0xc5c8('0x5c')],'raw':!![]});_0x28cbe0[_0xc5c8('0x5d')]({'model':db[_0xc5c8('0x5e')],'as':_0xc5c8('0x5f'),'attributes':['id',_0xc5c8('0x60'),_0xc5c8('0x61')],'raw':!![]});var _0x3c0c71=[{'model':db['SmsMessage'],'as':_0xc5c8('0x62'),'attributes':['id','body','createdAt',_0xc5c8('0x63'),'secret',_0xc5c8('0x64')],'include':_0x28cbe0}];_0x3c0c71[_0xc5c8('0x5d')]({'model':db[_0xc5c8('0x65')],'as':_0xc5c8('0x66'),'attributes':['id',_0xc5c8('0x1d')]});_0x3c0c71[_0xc5c8('0x5d')]({'model':db[_0xc5c8('0x5b')],'as':_0xc5c8('0x67'),'attributes':['id',_0xc5c8('0x5c')]});return db[_0xc5c8('0x1f')][_0xc5c8('0x3a')]({'where':{'id':_0x12245a[_0xc5c8('0x38')]['id']},'include':_0x3c0c71})[_0xc5c8('0x19')](handleEntityNotFound(_0x20d6a6,null))[_0xc5c8('0x19')](function(_0x240b05){if(_0x240b05){var _0x290b9a=_0x240b05[_0xc5c8('0x68')]({'plain':!![]});fs[_0xc5c8('0x69')](_0x58e973);var _0x41175a={'channel':_0xc5c8('0x6a'),'account':_0x290b9a['Account']['name'],'agent':_0x290b9a[_0xc5c8('0x67')]?_0x290b9a['Owner'][_0xc5c8('0x5c')]:_0xc5c8('0x6b'),'createdAt':moment(_0x290b9a[_0xc5c8('0x6c')])['format'](_0xc5c8('0x4a'))[_0xc5c8('0x56')](),'closedAt':_0x290b9a[_0xc5c8('0x6d')]?moment(_0x290b9a['closedAt'])[_0xc5c8('0x49')](_0xc5c8('0x4a'))[_0xc5c8('0x56')]():'','disposition':_0x290b9a[_0xc5c8('0x6e')],'messages':_(_0x290b9a[_0xc5c8('0x62')])[_0xc5c8('0x46')]({'secret':![]})['map'](function(_0x13be4d){return{'date':moment(_0x13be4d[_0xc5c8('0x6c')])[_0xc5c8('0x49')](_0xc5c8('0x4a'))[_0xc5c8('0x56')](),'sender':_0x13be4d['direction']==='out'?_0x13be4d['User']?_0x13be4d['User']['fullname']:'System':_0x13be4d[_0xc5c8('0x5f')][_0xc5c8('0x60')]+(_0x13be4d['Contact']['lastName']?'\x20'+_0x13be4d[_0xc5c8('0x5f')][_0xc5c8('0x61')]:''),'body':_0x13be4d[_0xc5c8('0x36')],'direction':_0x13be4d[_0xc5c8('0x63')]===_0xc5c8('0x6f')?'A':'C','secret':_0x13be4d[_0xc5c8('0x70')],'read':_0x13be4d[_0xc5c8('0x64')]};})[_0xc5c8('0x71')]()};return ejs['renderFile'](path[_0xc5c8('0x59')](config[_0xc5c8('0x72')],'server',_0xc5c8('0x73'),'downloadInteraction.ejs'),{'interaction':_0x41175a})[_0xc5c8('0x19')](function(_0x37d544){var _0xa236ac=path[_0xc5c8('0x59')](_0x58e973,_0xc5c8('0x74')+_0x290b9a['id']+'-'+_0x53deb5+'.pdf');var _0x505841={'path':_0xa236ac,'channel':'Sms','interactionId':_0x290b9a['id']};return pdf[_0xc5c8('0x75')](_0x37d544,_0x505841);})[_0xc5c8('0x19')](function(){return new BPromise(function(_0x1b1c34,_0x590602){zipdir(_0x58e973,{'saveTo':_0x1d35bb},function(_0x1a26ac,_0x105604){if(_0x1a26ac)return _0x590602(_0x1a26ac);return _0x1b1c34(_0x105604);});})[_0xc5c8('0x19')](function(){return new BPromise(function(_0x26011a,_0x5c41b8){rimraf(_0x58e973,function(_0xfbadb8){if(_0xfbadb8)_0x5c41b8(_0xfbadb8);return _0x26011a();});});})[_0xc5c8('0x19')](function(){return _0x20d6a6[_0xc5c8('0x54')](_0x1d35bb,_0x2868ef,function(_0xc3c6f0){if(_0xc3c6f0){console[_0xc5c8('0x76')](_0xc5c8('0x77'),_0xc3c6f0);}else{fs[_0xc5c8('0x78')](_0x1d35bb);}});});});}else{return _0x20d6a6['sendStatus'](0xc8);}})[_0xc5c8('0x28')](handleError(_0x20d6a6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 590e38a..81fc663 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 _0xe511=['Users','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove','getUsers','then'];(function(_0x3e8236,_0x514763){var _0x44ff54=function(_0x12e388){while(--_0x12e388){_0x3e8236['push'](_0x3e8236['shift']());}};_0x44ff54(++_0x514763);}(_0xe511,0x16f));var _0x1e51=function(_0x4f7d1,_0x50fa31){_0x4f7d1=_0x4f7d1-0x0;var _0x5ce698=_0xe511[_0x4f7d1];return _0x5ce698;};'use strict';var EventEmitter=require(_0x1e51('0x0'));var SmsInteraction=require(_0x1e51('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x1e51('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1e51('0x2')](0x0);var events={'afterCreate':_0x1e51('0x3'),'afterUpdate':'update','afterDestroy':_0x1e51('0x4')};function emitEvent(_0x2be2b7){return function(_0x204da7,_0x16ec99,_0x480cca){_0x204da7[_0x1e51('0x5')]({'attributes':['id'],'raw':!![]})[_0x1e51('0x6')](function(_0x5c4590){_0x204da7['setDataValue'](_0x1e51('0x7'),_0x5c4590[_0x1e51('0x8')](function(_0x4fa8a9){return{'id':_0x4fa8a9['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x204da7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1e51('0x6')](function(_0x2712e0){_0x204da7[_0x1e51('0x9')](_0x1e51('0xa'),_0x2712e0[_0x1e51('0xb')]);SmsInteractionEvents[_0x1e51('0xc')](_0x2be2b7+':'+_0x204da7['id'],_0x204da7);SmsInteractionEvents['emit'](_0x2be2b7,_0x204da7);_0x480cca(null);})[_0x1e51('0xd')](_0x480cca(null));};}for(var e in events){if(events[_0x1e51('0xe')](e)){var event=events[e];SmsInteraction[_0x1e51('0xf')](e,emitEvent(event));}}module[_0x1e51('0x10')]=SmsInteractionEvents; \ No newline at end of file +var _0xd4f4=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x4b902b,_0x111677){var _0x2239dc=function(_0x3baf0f){while(--_0x3baf0f){_0x4b902b['push'](_0x4b902b['shift']());}};_0x2239dc(++_0x111677);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3d1c7b,_0x19b748){_0x3d1c7b=_0x3d1c7b-0x0;var _0xe5ed9b=_0xd4f4[_0x3d1c7b];return _0xe5ed9b;};'use strict';var EventEmitter=require(_0x4d4f('0x0'));var SmsInteraction=require(_0x4d4f('0x1'))['db'][_0x4d4f('0x2')];var SmsMessage=require(_0x4d4f('0x1'))['db'][_0x4d4f('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d4f('0x4')](0x0);var events={'afterCreate':_0x4d4f('0x5'),'afterUpdate':_0x4d4f('0x6'),'afterDestroy':_0x4d4f('0x7')};function emitEvent(_0xa53cb8){return function(_0x15585,_0x5a98c7,_0x5f451b){_0x15585['getUsers']({'attributes':['id'],'raw':!![]})[_0x4d4f('0x8')](function(_0xecc103){_0x15585[_0x4d4f('0x9')](_0x4d4f('0xa'),_0xecc103[_0x4d4f('0xb')](function(_0x3c70b9){return{'id':_0x3c70b9['id']};}));return SmsMessage[_0x4d4f('0xc')]({'where':{'SmsInteractionId':_0x15585['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d4f('0x8')](function(_0x385597){_0x15585[_0x4d4f('0x9')](_0x4d4f('0xd'),_0x385597[_0x4d4f('0xe')]);SmsInteractionEvents[_0x4d4f('0xf')](_0xa53cb8+':'+_0x15585['id'],_0x15585);SmsInteractionEvents[_0x4d4f('0xf')](_0xa53cb8,_0x15585);_0x5f451b(null);})[_0x4d4f('0x10')](_0x5f451b(null));};}for(var e in events){if(events[_0x4d4f('0x11')](e)){var event=events[e];SmsInteraction[_0x4d4f('0x12')](e,emitEvent(event));}}module[_0x4d4f('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 7e8d301..a915bf9 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 _0x6b34=['define','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6b34,0x1a6));var _0x46b3=function(_0x53077d,_0x53f763){_0x53077d=_0x53077d-0x0;var _0x14323f=_0x6b34[_0x53077d];return _0x14323f;};'use strict';var _=require('lodash');var util=require(_0x46b3('0x0'));var logger=require(_0x46b3('0x1'))(_0x46b3('0x2'));var moment=require(_0x46b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b3('0x4'));var fs=require('fs');var path=require(_0x46b3('0x5'));var rimraf=require(_0x46b3('0x6'));var config=require(_0x46b3('0x7'));var attributes=require(_0x46b3('0x8'));module[_0x46b3('0x9')]=function(_0x4f71b2,_0x5e9fc0){return _0x4f71b2[_0x46b3('0xa')]('SmsInteraction',attributes,{'tableName':_0x46b3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x41f35d,_0x287d58,_0x4a9ba9){if(_0x41f35d['changed'](_0x46b3('0xc'))){_0x41f35d[_0x46b3('0xd')]=moment()[_0x46b3('0xe')](_0x46b3('0xf'));}_0x4a9ba9(null,_0x41f35d);}}});}; \ No newline at end of file +var _0xc48d=['rimraf','exports','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path'];(function(_0x306548,_0x14898c){var _0x2d8dfa=function(_0x5baac5){while(--_0x5baac5){_0x306548['push'](_0x306548['shift']());}};_0x2d8dfa(++_0x14898c);}(_0xc48d,0x1cb));var _0xdc48=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0xc48d[_0x339129];return _0x1570df;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var logger=require('../../config/logger')(_0xdc48('0x2'));var moment=require('moment');var BPromise=require(_0xdc48('0x3'));var rp=require(_0xdc48('0x4'));var fs=require('fs');var path=require(_0xdc48('0x5'));var rimraf=require(_0xdc48('0x6'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xdc48('0x7')]=function(_0x3f157d,_0x2b7719){return _0x3f157d[_0xdc48('0x8')](_0xdc48('0x9'),attributes,{'tableName':_0xdc48('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28bbfb,_0x5d224a,_0x3b045e){if(_0x28bbfb[_0xdc48('0xb')](_0xdc48('0xc'))){_0x28bbfb['closedAt']=moment()[_0xdc48('0xd')](_0xdc48('0xe'));}_0x3b045e(null,_0x28bbfb);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bec905f..4943328 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 _0x02d3=['info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','attributes','limit','AddTagsToSmsInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','request','then'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x02d3,0x10f));var _0x302d=function(_0x5c78d7,_0x25553a){_0x5c78d7=_0x5c78d7-0x0;var _0x211731=_0x02d3[_0x5c78d7];return _0x211731;};'use strict';var _=require(_0x302d('0x0'));var util=require(_0x302d('0x1'));var moment=require('moment');var BPromise=require(_0x302d('0x2'));var rs=require(_0x302d('0x3'));var fs=require('fs');var Redis=require(_0x302d('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x302d('0x5'));var jayson=require(_0x302d('0x6'));var client=jayson[_0x302d('0x7')][_0x302d('0x8')]({'port':0x232a});config[_0x302d('0x9')]=_[_0x302d('0xa')](config[_0x302d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x302d('0xb'))(new Redis(config['redis']));require(_0x302d('0xc'))[_0x302d('0xd')](socket);function respondWithRpcPromise(_0x230fe0,_0x46fa2f,_0x56b068){return new BPromise(function(_0x347495,_0x2ccda7){return client[_0x302d('0xe')](_0x230fe0,_0x56b068)[_0x302d('0xf')](function(_0x4b4478){logger[_0x302d('0x10')](_0x302d('0x11'),_0x46fa2f,_0x302d('0x12'));logger[_0x302d('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x46fa2f,_0x302d('0x12'),JSON[_0x302d('0x14')](_0x4b4478));if(_0x4b4478[_0x302d('0x15')]){if(_0x4b4478['error'][_0x302d('0x16')]===0x1f4){logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4b4478['error'][_0x302d('0x17')]);return _0x2ccda7(_0x4b4478[_0x302d('0x15')][_0x302d('0x17')]);}logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4b4478[_0x302d('0x15')]['message']);return _0x347495(_0x4b4478[_0x302d('0x15')][_0x302d('0x17')]);}else{logger['info'](_0x302d('0x11'),_0x46fa2f,_0x302d('0x12'));_0x347495(_0x4b4478[_0x302d('0x18')]['message']);}})[_0x302d('0x19')](function(_0x4e68c7){logger[_0x302d('0x15')](_0x302d('0x11'),_0x46fa2f,_0x4e68c7);_0x2ccda7(_0x4e68c7);});});}exports[_0x302d('0x1a')]=function(_0x5f5791){var _0x525e48=this;return new Promise(function(_0x2b22ad,_0x5a43d2){return db[_0x302d('0x1b')][_0x302d('0x1c')](_0x5f5791[_0x302d('0x1d')],{'raw':_0x5f5791[_0x302d('0x1e')]?_0x5f5791[_0x302d('0x1e')][_0x302d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f5791[_0x302d('0x1e')]?_0x5f5791['options']['where']||null:null,'attributes':_0x5f5791[_0x302d('0x1e')]?_0x5f5791[_0x302d('0x1e')][_0x302d('0x20')]||null:null,'limit':_0x5f5791[_0x302d('0x1e')]?_0x5f5791['options'][_0x302d('0x21')]||null:null})[_0x302d('0xf')](function(_0x4336d7){logger['info'](_0x302d('0x1a'),_0x5f5791);logger[_0x302d('0x13')]('UpdateSmsInteraction',_0x5f5791,JSON[_0x302d('0x14')](_0x4336d7));_0x2b22ad(_0x4336d7);})['catch'](function(_0x57877f){logger[_0x302d('0x15')]('UpdateSmsInteraction',_0x57877f[_0x302d('0x17')],_0x5f5791);_0x5a43d2(_0x525e48[_0x302d('0x15')](0x1f4,_0x57877f[_0x302d('0x17')]));});});};exports[_0x302d('0x22')]=function(_0x5257b5){return new Promise(function(_0x5660e9,_0x311844){return db[_0x302d('0x1b')]['find']({'where':_0x5257b5[_0x302d('0x1e')]?_0x5257b5[_0x302d('0x1e')][_0x302d('0x23')]||null:null})[_0x302d('0xf')](function(_0x39adb1){if(_0x39adb1){return _0x39adb1[_0x302d('0x24')](_0x5257b5[_0x302d('0x1d')][_0x302d('0x25')],_[_0x302d('0x26')](_0x5257b5[_0x302d('0x1d')],[_0x302d('0x25'),'id'])||{});}})[_0x302d('0x27')](function(_0xaace0f){logger[_0x302d('0x10')](_0x302d('0x28'),_0x5257b5);logger[_0x302d('0x13')]('AddTags',_0x5257b5,JSON[_0x302d('0x14')](_0xaace0f));_0x5660e9(_0xaace0f);})[_0x302d('0x19')](function(_0x161111){logger[_0x302d('0x15')](_0x302d('0x28'),_0x161111[_0x302d('0x17')],_0x5257b5);_0x311844(_this[_0x302d('0x15')](0x1f4,_0x161111['message']));});});}; \ No newline at end of file +var _0xeb5f=['update','body','options','raw','attributes','limit','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x434976,_0x4ded51){var _0x53f8c2=function(_0x4de617){while(--_0x4de617){_0x434976['push'](_0x434976['shift']());}};_0x53f8c2(++_0x4ded51);}(_0xeb5f,0x99));var _0xfeb5=function(_0x4cd531,_0x3d1d6b){_0x4cd531=_0x4cd531-0x0;var _0x4baaf4=_0xeb5f[_0x4cd531];return _0x4baaf4;};'use strict';var _=require(_0xfeb5('0x0'));var util=require(_0xfeb5('0x1'));var moment=require(_0xfeb5('0x2'));var BPromise=require(_0xfeb5('0x3'));var rs=require(_0xfeb5('0x4'));var fs=require('fs');var Redis=require(_0xfeb5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeb5('0x6'));var logger=require(_0xfeb5('0x7'))(_0xfeb5('0x8'));var config=require(_0xfeb5('0x9'));var jayson=require(_0xfeb5('0xa'));var client=jayson[_0xfeb5('0xb')][_0xfeb5('0xc')]({'port':0x232a});config[_0xfeb5('0xd')]=_[_0xfeb5('0xe')](config[_0xfeb5('0xd')],{'host':_0xfeb5('0xf'),'port':0x18eb});var socket=require(_0xfeb5('0x10'))(new Redis(config[_0xfeb5('0xd')]));require(_0xfeb5('0x11'))[_0xfeb5('0x12')](socket);function respondWithRpcPromise(_0x503f85,_0x42be69,_0x39ea95){return new BPromise(function(_0x5ee07d,_0x303ee9){return client['request'](_0x503f85,_0x39ea95)[_0xfeb5('0x13')](function(_0x1ae0c3){logger[_0xfeb5('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x42be69,_0xfeb5('0x15'));logger[_0xfeb5('0x16')](_0xfeb5('0x17'),_0x42be69,_0xfeb5('0x15'),JSON[_0xfeb5('0x18')](_0x1ae0c3));if(_0x1ae0c3[_0xfeb5('0x19')]){if(_0x1ae0c3[_0xfeb5('0x19')][_0xfeb5('0x1a')]===0x1f4){logger['error'](_0xfeb5('0x1b'),_0x42be69,_0x1ae0c3[_0xfeb5('0x19')][_0xfeb5('0x1c')]);return _0x303ee9(_0x1ae0c3['error'][_0xfeb5('0x1c')]);}logger[_0xfeb5('0x19')](_0xfeb5('0x1b'),_0x42be69,_0x1ae0c3[_0xfeb5('0x19')][_0xfeb5('0x1c')]);return _0x5ee07d(_0x1ae0c3['error'][_0xfeb5('0x1c')]);}else{logger['info'](_0xfeb5('0x1b'),_0x42be69,_0xfeb5('0x15'));_0x5ee07d(_0x1ae0c3[_0xfeb5('0x1d')][_0xfeb5('0x1c')]);}})[_0xfeb5('0x1e')](function(_0x103623){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x42be69,_0x103623);_0x303ee9(_0x103623);});});}exports['UpdateSmsInteraction']=function(_0x515e11){var _0x3d5cfa=this;return new Promise(function(_0x5f28a3,_0x3870e4){return db['SmsInteraction'][_0xfeb5('0x1f')](_0x515e11[_0xfeb5('0x20')],{'raw':_0x515e11[_0xfeb5('0x21')]?_0x515e11[_0xfeb5('0x21')][_0xfeb5('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x515e11[_0xfeb5('0x21')]?_0x515e11[_0xfeb5('0x21')]['where']||null:null,'attributes':_0x515e11[_0xfeb5('0x21')]?_0x515e11['options'][_0xfeb5('0x23')]||null:null,'limit':_0x515e11['options']?_0x515e11[_0xfeb5('0x21')][_0xfeb5('0x24')]||null:null})[_0xfeb5('0x13')](function(_0x455a87){logger['info'](_0xfeb5('0x25'),_0x515e11);logger[_0xfeb5('0x16')]('UpdateSmsInteraction',_0x515e11,JSON[_0xfeb5('0x18')](_0x455a87));_0x5f28a3(_0x455a87);})[_0xfeb5('0x1e')](function(_0x343b9f){logger[_0xfeb5('0x19')](_0xfeb5('0x25'),_0x343b9f['message'],_0x515e11);_0x3870e4(_0x3d5cfa[_0xfeb5('0x19')](0x1f4,_0x343b9f[_0xfeb5('0x1c')]));});});};exports[_0xfeb5('0x26')]=function(_0x4da521){return new Promise(function(_0x2df995,_0x20bd0a){return db[_0xfeb5('0x27')]['find']({'where':_0x4da521[_0xfeb5('0x21')]?_0x4da521['options'][_0xfeb5('0x28')]||null:null})[_0xfeb5('0x13')](function(_0x4af3e9){if(_0x4af3e9){return _0x4af3e9[_0xfeb5('0x29')](_0x4da521[_0xfeb5('0x20')][_0xfeb5('0x2a')],_[_0xfeb5('0x2b')](_0x4da521[_0xfeb5('0x20')],[_0xfeb5('0x2a'),'id'])||{});}})[_0xfeb5('0x2c')](function(_0x2a844e){logger[_0xfeb5('0x14')](_0xfeb5('0x2d'),_0x4da521);logger[_0xfeb5('0x16')](_0xfeb5('0x2d'),_0x4da521,JSON['stringify'](_0x2a844e));_0x2df995(_0x2a844e);})[_0xfeb5('0x1e')](function(_0x17c78e){logger['error'](_0xfeb5('0x2d'),_0x17c78e['message'],_0x4da521);_0x20bd0a(_this[_0xfeb5('0x19')](0x1f4,_0x17c78e['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 3310eff..281a5cd 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 _0x8eea=['update','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x8eea,0x1da));var _0xa8ee=function(_0x1e4f2f,_0x35edfa){_0x1e4f2f=_0x1e4f2f-0x0;var _0xccea89=_0x8eea[_0x1e4f2f];return _0xccea89;};'use strict';var SmsInteractionEvents=require(_0xa8ee('0x0'));var events=[_0xa8ee('0x1'),'remove',_0xa8ee('0x2')];function createListener(_0x3c7bff,_0x67fd88){return function(_0x7e4c99){_0x67fd88['emit'](_0x3c7bff,_0x7e4c99);};}function removeListener(_0x137127,_0x3a5315){return function(){SmsInteractionEvents[_0xa8ee('0x3')](_0x137127,_0x3a5315);};}exports[_0xa8ee('0x4')]=function(_0x4666db){for(var _0x27ece7=0x0,_0x568d2f=events[_0xa8ee('0x5')];_0x27ece7<_0x568d2f;_0x27ece7++){var _0x57cbf0=events[_0x27ece7];var _0x308c59=createListener(_0xa8ee('0x6')+_0x57cbf0,_0x4666db);SmsInteractionEvents['on'](_0x57cbf0,_0x308c59);}}; \ No newline at end of file +var _0x507d=['removeListener','register','length','save','remove','update','emit'];(function(_0x4aa789,_0x3a7ebe){var _0x51e3ba=function(_0x29ab31){while(--_0x29ab31){_0x4aa789['push'](_0x4aa789['shift']());}};_0x51e3ba(++_0x3a7ebe);}(_0x507d,0x153));var _0xd507=function(_0x49ba65,_0x36b550){_0x49ba65=_0x49ba65-0x0;var _0x201852=_0x507d[_0x49ba65];return _0x201852;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xd507('0x0'),_0xd507('0x1'),_0xd507('0x2')];function createListener(_0x18ac7c,_0x4e6466){return function(_0x5f421f){_0x4e6466[_0xd507('0x3')](_0x18ac7c,_0x5f421f);};}function removeListener(_0x1fbee0,_0x48317a){return function(){SmsInteractionEvents[_0xd507('0x4')](_0x1fbee0,_0x48317a);};}exports[_0xd507('0x5')]=function(_0x2e08ac){for(var _0x8eb12c=0x0,_0x1f9737=events[_0xd507('0x6')];_0x8eb12c<_0x1f9737;_0x8eb12c++){var _0x5440b7=events[_0x8eb12c];var _0x1ce845=createListener('smsInteraction:'+_0x5440b7,_0x2e08ac);SmsInteractionEvents['on'](_0x5440b7,_0x1ce845);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 4703b23..e213702 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 _0x9f08=['get','isAuthenticated','index','/describe','describe','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','reject','/:id','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./smsMessage.controller'];(function(_0x2b2a21,_0x3c34d0){var _0x3ccb8c=function(_0x5e9ad1){while(--_0x5e9ad1){_0x2b2a21['push'](_0x2b2a21['shift']());}};_0x3ccb8c(++_0x3c34d0);}(_0x9f08,0x8f));var _0x89f0=function(_0x5e870a,_0x175114){_0x5e870a=_0x5e870a-0x0;var _0x1a1bf7=_0x9f08[_0x5e870a];return _0x1a1bf7;};'use strict';var multer=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var path=require(_0x89f0('0x2'));var timeout=require(_0x89f0('0x3'));var express=require(_0x89f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x89f0('0x5'));var controller=require(_0x89f0('0x6'));router[_0x89f0('0x7')]('/',auth[_0x89f0('0x8')](),controller[_0x89f0('0x9')]);router[_0x89f0('0x7')](_0x89f0('0xa'),auth[_0x89f0('0x8')](),controller[_0x89f0('0xb')]);router['get']('/:id',auth[_0x89f0('0x8')](),controller[_0x89f0('0xc')]);router[_0x89f0('0xd')]('/',auth[_0x89f0('0x8')](),interaction['tracked'](_0x89f0('0xe'),_0x89f0('0xf')),controller[_0x89f0('0x10')]);router[_0x89f0('0xd')](_0x89f0('0x11'),controller[_0x89f0('0x12')]);router[_0x89f0('0x13')]('/:id',auth[_0x89f0('0x8')](),controller['update']);router[_0x89f0('0x13')](_0x89f0('0x14'),auth[_0x89f0('0x8')](),controller['accept']);router[_0x89f0('0x13')]('/:id/reject',auth[_0x89f0('0x8')](),controller[_0x89f0('0x15')]);router['delete'](_0x89f0('0x16'),auth[_0x89f0('0x8')](),controller[_0x89f0('0x17')]);module[_0x89f0('0x18')]=router; \ No newline at end of file +var _0x046a=['/:id/status','status','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','multer','path','connect-timeout','express','Router','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create'];(function(_0x85031d,_0x46eb8f){var _0x3eda33=function(_0x459fa2){while(--_0x459fa2){_0x85031d['push'](_0x85031d['shift']());}};_0x3eda33(++_0x46eb8f);}(_0x046a,0x122));var _0xa046=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x046a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xa046('0x0'));var util=require('util');var path=require(_0xa046('0x1'));var timeout=require(_0xa046('0x2'));var express=require(_0xa046('0x3'));var router=express[_0xa046('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa046('0x5'));router[_0xa046('0x6')]('/',auth[_0xa046('0x7')](),controller[_0xa046('0x8')]);router['get'](_0xa046('0x9'),auth[_0xa046('0x7')](),controller[_0xa046('0xa')]);router['get'](_0xa046('0xb'),auth[_0xa046('0x7')](),controller[_0xa046('0xc')]);router[_0xa046('0xd')]('/',auth['isAuthenticated'](),interaction[_0xa046('0xe')](_0xa046('0xf'),_0xa046('0x10')),controller[_0xa046('0x11')]);router[_0xa046('0xd')](_0xa046('0x12'),controller[_0xa046('0x13')]);router['put'](_0xa046('0xb'),auth[_0xa046('0x7')](),controller[_0xa046('0x14')]);router['put'](_0xa046('0x15'),auth[_0xa046('0x7')](),controller[_0xa046('0x16')]);router[_0xa046('0x17')](_0xa046('0x18'),auth[_0xa046('0x7')](),controller[_0xa046('0x19')]);router[_0xa046('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xa046('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index f7136c9..c0bc361 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 _0x5301=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','exports'];(function(_0x20b2ee,_0x2f5f73){var _0xa9ec2e=function(_0x440897){while(--_0x440897){_0x20b2ee['push'](_0x20b2ee['shift']());}};_0xa9ec2e(++_0x2f5f73);}(_0x5301,0x157));var _0x1530=function(_0x5bb2d0,_0x4df3c0){_0x5bb2d0=_0x5bb2d0-0x0;var _0x5f1e1b=_0x5301[_0x5bb2d0];return _0x5f1e1b;};'use strict';var Sequelize=require('sequelize');module[_0x1530('0x0')]={'body':{'type':Sequelize[_0x1530('0x1')](_0x1530('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1530('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1530('0x4')]('in','out'),'defaultValue':_0x1530('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1530('0x6')](0xbe)},'phone':{'type':Sequelize[_0x1530('0x6')]},'readAt':{'type':Sequelize[_0x1530('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1530('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe638=['STRING','DATE','BOOLEAN','TEXT','exports','medium','ENUM','out'];(function(_0x481962,_0xae1ecb){var _0xbc5818=function(_0x416062){while(--_0x416062){_0x481962['push'](_0x481962['shift']());}};_0xbc5818(++_0xae1ecb);}(_0xe638,0x1dc));var _0x8e63=function(_0x74ab89,_0x4595bf){_0x74ab89=_0x74ab89-0x0;var _0x51d309=_0xe638[_0x74ab89];return _0x51d309;};'use strict';var Sequelize=require('sequelize');module[_0x8e63('0x0')]={'body':{'type':Sequelize['TEXT'](_0x8e63('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8e63('0x2')]('in',_0x8e63('0x3')),'defaultValue':_0x8e63('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8e63('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x8e63('0x5')]},'secret':{'type':Sequelize[_0x8e63('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8e63('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 20ae118..b9bf222 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 _0x09d2=['MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','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','./smsMessage.socket','client','http','then','info','debug','request\x20sent','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','reject','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','show','include','options','create','body','find','params','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','QueryTypes','motionChannel','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect'];(function(_0x532e7e,_0x59b026){var _0x99b592=function(_0x50e0f9){while(--_0x50e0f9){_0x532e7e['push'](_0x532e7e['shift']());}};_0x99b592(++_0x59b026);}(_0x09d2,0x1d2));var _0x209d=function(_0x512ffb,_0x1bd7e5){_0x512ffb=_0x512ffb-0x0;var _0x5e76cc=_0x09d2[_0x512ffb];return _0x5e76cc;};'use strict';var emlformat=require(_0x209d('0x0'));var rimraf=require(_0x209d('0x1'));var zipdir=require(_0x209d('0x2'));var jsonpatch=require(_0x209d('0x3'));var rp=require(_0x209d('0x4'));var moment=require(_0x209d('0x5'));var BPromise=require(_0x209d('0x6'));var Mustache=require(_0x209d('0x7'));var util=require(_0x209d('0x8'));var path=require(_0x209d('0x9'));var sox=require('sox');var csv=require(_0x209d('0xa'));var ejs=require(_0x209d('0xb'));var fs=require('fs');var fs_extra=require(_0x209d('0xc'));var _=require(_0x209d('0xd'));var squel=require(_0x209d('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x209d('0xf'));var toCsv=require(_0x209d('0xa'));var querystring=require(_0x209d('0x10'));var Papa=require('papaparse');var Redis=require(_0x209d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x209d('0x12'));var as=require(_0x209d('0x13'));var hardwareService=require(_0x209d('0x14'));var logger=require(_0x209d('0x15'))(_0x209d('0x16'));var utils=require(_0x209d('0x17'));var config=require(_0x209d('0x18'));var licenseUtil=require(_0x209d('0x19'));var db=require(_0x209d('0x1a'))['db'];config[_0x209d('0x1b')]=_[_0x209d('0x1c')](config[_0x209d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x209d('0x1d'))(new Redis(config[_0x209d('0x1b')]));require(_0x209d('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x209d('0x1f')]['http']({'port':0x232c});var client9002=jayson['client'][_0x209d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x434fef,_0x2dd027,_0x546766,_0x129797){return new BPromise(function(_0xe0721,_0x1bff51){var _0x1ed340=_0x129797||client;return _0x1ed340['request'](_0x434fef,_0x546766)[_0x209d('0x21')](function(_0x437f76){logger[_0x209d('0x22')]('SmsMessage,\x20%s,\x20%s',_0x2dd027,'request\x20sent');logger[_0x209d('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2dd027,_0x209d('0x24'),JSON[_0x209d('0x25')](_0x437f76));if(_0x437f76[_0x209d('0x26')]){if(_0x437f76[_0x209d('0x26')][_0x209d('0x27')]===0x1f4){logger[_0x209d('0x26')](_0x209d('0x28'),_0x2dd027,_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);return _0x1bff51(_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);}logger[_0x209d('0x26')](_0x209d('0x28'),_0x2dd027,_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);return _0xe0721(_0x437f76[_0x209d('0x26')][_0x209d('0x29')]);}else{logger[_0x209d('0x22')](_0x209d('0x28'),_0x2dd027,_0x209d('0x24'));_0xe0721(_0x437f76[_0x209d('0x2a')]['message']);}})[_0x209d('0x2b')](function(_0x44ef65){logger['error'](_0x209d('0x28'),_0x2dd027,_0x44ef65);_0x1bff51(_0x44ef65);});});}function respondWithStatusCode(_0x561ad6,_0x396500){_0x396500=_0x396500||0xcc;return function(_0x15b8c7){if(_0x15b8c7){return _0x561ad6[_0x209d('0x2c')](_0x396500);}return _0x561ad6[_0x209d('0x2d')](_0x396500)[_0x209d('0x2e')]();};}function respondWithResult(_0x819a15,_0x5399e3){_0x5399e3=_0x5399e3||0xc8;return function(_0x182d8b){if(_0x182d8b){return _0x819a15[_0x209d('0x2d')](_0x5399e3)['json'](_0x182d8b);}};}function respondWithFilteredResult(_0x2f1b01,_0x14dc18){return function(_0x21899a){if(_0x21899a){var _0x28750e=typeof _0x14dc18[_0x209d('0x2f')]===_0x209d('0x30')&&typeof _0x14dc18['limit']==='undefined';var _0x46b3ef=_0x21899a['count'];var _0x3a69da=_0x28750e?0x0:_0x14dc18['offset'];var _0x1fbdba=_0x28750e?_0x21899a[_0x209d('0x31')]:_0x14dc18['offset']+_0x14dc18['limit'];var _0x48e200;if(_0x1fbdba>=_0x46b3ef){_0x1fbdba=_0x46b3ef;_0x48e200=0xc8;}else{_0x48e200=0xce;}_0x2f1b01[_0x209d('0x2d')](_0x48e200);return _0x2f1b01[_0x209d('0x32')](_0x209d('0x33'),_0x3a69da+'-'+_0x1fbdba+'/'+_0x46b3ef)['json'](_0x21899a);}return null;};}function patchUpdates(_0x182525){return function(_0x3fafab){try{jsonpatch['apply'](_0x3fafab,_0x182525,!![]);}catch(_0x4860f5){return BPromise[_0x209d('0x34')](_0x4860f5);}return _0x3fafab['save']();};}function saveUpdates(_0x36d058,_0x16b1d4){return function(_0x26f697){if(_0x26f697){return _0x26f697[_0x209d('0x35')](_0x36d058)[_0x209d('0x21')](function(_0x4471c1){return _0x4471c1;});}return null;};}function removeEntity(_0x2953aa,_0x4d8542){return function(_0x3546b0){if(_0x3546b0){return _0x3546b0[_0x209d('0x36')]()[_0x209d('0x21')](function(){_0x2953aa[_0x209d('0x2d')](0xcc)[_0x209d('0x2e')]();});}};}function handleEntityNotFound(_0x1442bf,_0x200c6b){return function(_0x29ece2){if(!_0x29ece2){_0x1442bf[_0x209d('0x2c')](0x194);}return _0x29ece2;};}function handleError(_0x454003,_0x130008){_0x130008=_0x130008||0x1f4;return function(_0x28a5cc){logger[_0x209d('0x26')](_0x28a5cc['stack']);if(_0x28a5cc[_0x209d('0x37')]){delete _0x28a5cc['name'];}_0x454003[_0x209d('0x2d')](_0x130008)[_0x209d('0x38')](_0x28a5cc);};}exports[_0x209d('0x39')]=function(_0x507c4c,_0x489746){var _0x40919e={},_0x2e3726={},_0x151753={'count':0x0,'rows':[]};var _0x38d6e4=_[_0x209d('0x3a')](db[_0x209d('0x3b')][_0x209d('0x3c')],function(_0x1581d7){return{'name':_0x1581d7[_0x209d('0x3d')],'type':_0x1581d7['type'][_0x209d('0x3e')]};});_0x2e3726[_0x209d('0x3f')]=_[_0x209d('0x3a')](_0x38d6e4,_0x209d('0x37'));_0x2e3726[_0x209d('0x40')]=_[_0x209d('0x41')](_0x507c4c[_0x209d('0x40')]);_0x2e3726[_0x209d('0x42')]=_[_0x209d('0x43')](_0x2e3726[_0x209d('0x3f')],_0x2e3726['query']);_0x40919e[_0x209d('0x44')]=_[_0x209d('0x43')](_0x2e3726[_0x209d('0x3f')],qs[_0x209d('0x45')](_0x507c4c['query'][_0x209d('0x45')]));_0x40919e[_0x209d('0x44')]=_0x40919e['attributes'][_0x209d('0x46')]?_0x40919e[_0x209d('0x44')]:_0x2e3726[_0x209d('0x3f')];if(!_0x507c4c['query']['hasOwnProperty'](_0x209d('0x47'))){_0x40919e[_0x209d('0x48')]=qs[_0x209d('0x48')](_0x507c4c[_0x209d('0x40')][_0x209d('0x48')]);_0x40919e['offset']=qs[_0x209d('0x2f')](_0x507c4c['query']['offset']);}_0x40919e[_0x209d('0x49')]=qs[_0x209d('0x4a')](_0x507c4c[_0x209d('0x40')][_0x209d('0x4a')]);_0x40919e[_0x209d('0x4b')]=qs[_0x209d('0x42')](_[_0x209d('0x4c')](_0x507c4c[_0x209d('0x40')],_0x2e3726[_0x209d('0x42')]),_0x38d6e4);if(_0x507c4c['query'][_0x209d('0x4d')]){_0x40919e[_0x209d('0x4b')]=_[_0x209d('0x4e')](_0x40919e[_0x209d('0x4b')],{'$or':_[_0x209d('0x3a')](_0x38d6e4,function(_0x39f36e){if(_0x39f36e['type']!==_0x209d('0x4f')){var _0x45dc3b={};_0x45dc3b[_0x39f36e['name']]={'$like':'%'+_0x507c4c[_0x209d('0x40')][_0x209d('0x4d')]+'%'};return _0x45dc3b;}})});}_0x40919e=_[_0x209d('0x4e')]({},_0x40919e,_0x507c4c['options']);var _0x3a6972={'where':_0x40919e[_0x209d('0x4b')]};return db[_0x209d('0x3b')][_0x209d('0x31')](_0x3a6972)[_0x209d('0x21')](function(_0x19c234){_0x151753['count']=_0x19c234;if(_0x507c4c['query'][_0x209d('0x50')]){_0x40919e['include']=[{'all':!![]}];}return db[_0x209d('0x3b')][_0x209d('0x51')](_0x40919e);})[_0x209d('0x21')](function(_0xacc1ca){_0x151753['rows']=_0xacc1ca;return _0x151753;})[_0x209d('0x21')](respondWithFilteredResult(_0x489746,_0x40919e))['catch'](handleError(_0x489746,null));};exports[_0x209d('0x52')]=function(_0x1503bd,_0x580bc5){var _0x26c63c={'raw':!![],'where':{'id':_0x1503bd['params']['id']}},_0x32cba3={};_0x32cba3[_0x209d('0x3f')]=_[_0x209d('0x41')](db['SmsMessage'][_0x209d('0x3c')]);_0x32cba3[_0x209d('0x40')]=_[_0x209d('0x41')](_0x1503bd[_0x209d('0x40')]);_0x32cba3[_0x209d('0x42')]=_[_0x209d('0x43')](_0x32cba3['model'],_0x32cba3[_0x209d('0x40')]);_0x26c63c[_0x209d('0x44')]=_['intersection'](_0x32cba3[_0x209d('0x3f')],qs[_0x209d('0x45')](_0x1503bd[_0x209d('0x40')][_0x209d('0x45')]));_0x26c63c['attributes']=_0x26c63c['attributes'][_0x209d('0x46')]?_0x26c63c[_0x209d('0x44')]:_0x32cba3['model'];if(_0x1503bd[_0x209d('0x40')][_0x209d('0x50')]){_0x26c63c[_0x209d('0x53')]=[{'all':!![]}];}_0x26c63c=_[_0x209d('0x4e')]({},_0x26c63c,_0x1503bd[_0x209d('0x54')]);return db[_0x209d('0x3b')]['find'](_0x26c63c)[_0x209d('0x21')](handleEntityNotFound(_0x580bc5,null))[_0x209d('0x21')](respondWithResult(_0x580bc5,null))[_0x209d('0x2b')](handleError(_0x580bc5,null));};exports[_0x209d('0x55')]=function(_0x2d4a5e,_0x532ba5){return db['SmsMessage'][_0x209d('0x55')](_0x2d4a5e[_0x209d('0x56')],{})['then'](respondWithResult(_0x532ba5,0xc9))[_0x209d('0x2b')](handleError(_0x532ba5,null));};exports[_0x209d('0x35')]=function(_0x65f8a,_0x25eb7b){if(_0x65f8a[_0x209d('0x56')]['id']){delete _0x65f8a['body']['id'];}return db['SmsMessage'][_0x209d('0x57')]({'where':{'id':_0x65f8a['params']['id']}})[_0x209d('0x21')](handleEntityNotFound(_0x25eb7b,null))[_0x209d('0x21')](saveUpdates(_0x65f8a[_0x209d('0x56')],null))[_0x209d('0x21')](respondWithResult(_0x25eb7b,null))[_0x209d('0x2b')](handleError(_0x25eb7b,null));};exports[_0x209d('0x36')]=function(_0x48f0e6,_0x12229c){return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x48f0e6[_0x209d('0x58')]['id']}})['then'](handleEntityNotFound(_0x12229c,null))['then'](removeEntity(_0x12229c,null))[_0x209d('0x2b')](handleError(_0x12229c,null));};exports[_0x209d('0x59')]=function(_0x24cbf9,_0x30a815){return db['SmsMessage']['describe']()['then'](respondWithResult(_0x30a815,null))[_0x209d('0x2b')](handleError(_0x30a815,null));};var interaction_log=require(_0x209d('0x15'))(_0x209d('0x5a'));exports[_0x209d('0x5b')]=function(_0x31f076,_0x4de4fa,_0x5e9d45){var _0x3d0403={'agent':{},'channel':'sms'};if(_0x31f076['body']['id']){delete _0x31f076[_0x209d('0x56')]['id'];}_0x31f076[_0x209d('0x56')]['read']=!![];_0x31f076[_0x209d('0x56')][_0x209d('0x5c')]=moment()[_0x209d('0x5d')](_0x209d('0x5e'));_0x31f076[_0x209d('0x56')]['UserId']=_0x31f076['body'][_0x209d('0x5f')]||_0x31f076[_0x209d('0x60')]['id'];_0x3d0403[_0x209d('0x61')]['id']=_0x31f076[_0x209d('0x56')]['UserId'];return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x31f076[_0x209d('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4de4fa,null))['then'](saveUpdates(_0x31f076[_0x209d('0x56')],null))[_0x209d('0x21')](function(_0x3b68eb){if(_0x3b68eb){_0x3d0403[_0x209d('0x29')]=_0x3b68eb[_0x209d('0x62')]({'plain':!![]});return db[_0x209d('0x63')][_0x209d('0x57')]({'where':{'id':_0x3b68eb[_0x209d('0x64')]}});}return null;})[_0x209d('0x21')](handleEntityNotFound(_0x4de4fa,null))[_0x209d('0x21')](function(_0x520995){if(_0x520995){return _0x520995[_0x209d('0x35')]({'UserId':_0x31f076[_0x209d('0x56')][_0x209d('0x5f')],'read1stAt':_[_0x209d('0x65')](_0x520995[_0x209d('0x66')])?moment()[_0x209d('0x5d')](_0x209d('0x5e')):undefined});}return null;})[_0x209d('0x21')](function(_0x1b9a13){if(_0x1b9a13){_0x3d0403[_0x209d('0x67')]=_0x1b9a13[_0x209d('0x62')]({'plain':!![]});interaction_log[_0x209d('0x22')](_0x209d('0x68'),_0x31f076[_0x209d('0x60')]['id'],_0x31f076['user']['name'],_0x31f076[_0x209d('0x60')][_0x209d('0x69')],_0x3d0403[_0x209d('0x67')]['id'],_0x31f076[_0x209d('0x56')]?JSON[_0x209d('0x25')](_0x31f076[_0x209d('0x56')]):'null');return respondWithRpcPromise(_0x209d('0x6a'),_0x209d('0x6b'),_0x3d0403);}return null;})[_0x209d('0x21')](function(_0xd745c7){var _0x85a029=_0x209d('0x6c')+_0xd745c7[_0x209d('0x29')][_0x209d('0x6d')];return db[_0x209d('0x6e')][_0x209d('0x40')](_0x85a029,{'type':db[_0x209d('0x6f')]['QueryTypes'][_0x209d('0x70')],'raw':!![]})['then'](function(_0x5daf79){return _0x5daf79;});})[_0x209d('0x21')](function(_0xa9b3f8){if(_0xa9b3f8){_0x3d0403[_0x209d('0x29')][_0x209d('0x71')]=_0xa9b3f8[0x0];if(!_0x31f076[_0x209d('0x56')][_0x209d('0x5f')])return;return db[_0x209d('0x72')][_0x209d('0x57')]({'where':{'id':_0x31f076['body'][_0x209d('0x5f')],'role':_0x209d('0x61')},'attributes':['id','name',_0x209d('0x73'),_0x209d('0x74'),_0x209d('0x75')],'raw':!![]});}return null;})[_0x209d('0x21')](function(_0x49260f){if(!_0x49260f)return null;_0x3d0403['message']['agent']=_0x49260f;return _0x3d0403;})[_0x209d('0x21')](function(_0x2d5901){if(_0x2d5901){if(_0x31f076[_0x209d('0x56')][_0x209d('0x76')]){_0x3d0403[_0x209d('0x29')][_0x209d('0x77')]=util['format'](_0x209d('0x78'),_0x31f076[_0x209d('0x60')][_0x209d('0x37')]);_0x3d0403['message']['channel']=_0x3d0403[_0x209d('0x79')];_0x3d0403['message']['motionChannel']=_0x3d0403['channel'];_0x3d0403[_0x209d('0x29')]['event']=_0x209d('0x5b');return respondWithRpcPromise('EventManager',_0x209d('0x7a'),{'event':_0x209d('0x7b'),'message':_0x3d0403[_0x209d('0x29')]},client9002)[_0x209d('0x21')](function(){return _0x3d0403;});}return _0x3d0403;}return null;})['then'](respondWithResult(_0x4de4fa,null))[_0x209d('0x2b')](handleError(_0x4de4fa,null));};var interaction_log=require(_0x209d('0x15'))('sms-interactions');exports[_0x209d('0x34')]=function(_0x195b46,_0x83df1b,_0x1fa82e){var _0x2bba8c={'agent':{},'channel':_0x209d('0x7c')};if(_0x195b46['body']['id']){delete _0x195b46[_0x209d('0x56')]['id'];}_0x195b46['body'][_0x209d('0x5f')]=_0x195b46[_0x209d('0x56')][_0x209d('0x5f')]||_0x195b46['user']['id'];_0x2bba8c[_0x209d('0x61')]['id']=_0x195b46[_0x209d('0x56')][_0x209d('0x5f')];return db['SmsMessage'][_0x209d('0x57')]({'where':{'id':_0x195b46[_0x209d('0x58')]['id'],'UserId':null}})[_0x209d('0x21')](handleEntityNotFound(_0x83df1b,null))[_0x209d('0x21')](function(_0x417c19){if(_0x417c19){_0x2bba8c[_0x209d('0x29')]=_0x417c19[_0x209d('0x62')]({'plain':!![]});return db[_0x209d('0x63')][_0x209d('0x57')]({'where':{'id':_0x417c19['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x83df1b,null))['then'](function(_0x4756ef){if(_0x4756ef){_0x2bba8c[_0x209d('0x67')]=_0x4756ef['get']({'plain':!![]});interaction_log[_0x209d('0x22')](_0x209d('0x7d'),_0x195b46[_0x209d('0x60')]['id'],_0x195b46['user']['name'],_0x195b46[_0x209d('0x60')]['role'],_0x2bba8c[_0x209d('0x67')]['id'],_0x195b46['body']?JSON['stringify'](_0x195b46[_0x209d('0x56')]):_0x209d('0x7e'));return respondWithRpcPromise(_0x209d('0x7f'),_0x209d('0x80'),_0x2bba8c);}return null;})[_0x209d('0x21')](function(_0x495921){var _0x510884=_0x209d('0x6c')+_0x495921[_0x209d('0x29')]['ContactId'];return db[_0x209d('0x6e')]['query'](_0x510884,{'type':db['Sequelize'][_0x209d('0x81')][_0x209d('0x70')],'raw':!![]})[_0x209d('0x21')](function(_0x42f5e5){return _0x42f5e5;});})[_0x209d('0x21')](function(_0x195a7d){if(_0x195a7d){_0x2bba8c[_0x209d('0x29')][_0x209d('0x71')]=_0x195a7d[0x0];if(!_0x195b46['body'][_0x209d('0x5f')])return;return db[_0x209d('0x72')][_0x209d('0x57')]({'where':{'id':_0x195b46[_0x209d('0x56')][_0x209d('0x5f')],'role':_0x209d('0x61')},'attributes':['id','name',_0x209d('0x73'),_0x209d('0x74'),_0x209d('0x75')],'raw':!![]});}return null;})['then'](function(_0x226045){if(!_0x226045)return null;_0x2bba8c['message']['agent']=_0x226045;return _0x2bba8c;})[_0x209d('0x21')](function(_0x3b24e4){if(_0x3b24e4){_0x3b24e4[_0x209d('0x29')][_0x209d('0x77')]=util[_0x209d('0x5d')](_0x209d('0x78'),_0x195b46[_0x209d('0x60')]['name']);_0x3b24e4[_0x209d('0x29')][_0x209d('0x79')]=_0x2bba8c[_0x209d('0x79')];_0x3b24e4[_0x209d('0x29')][_0x209d('0x82')]=_0x2bba8c['channel'];_0x3b24e4['message'][_0x209d('0x83')]=_0x209d('0x34');respondWithRpcPromise(_0x209d('0x7a'),_0x209d('0x7a'),{'event':_0x209d('0x84'),'message':_0x3b24e4[_0x209d('0x29')]},client9002);return _0x2bba8c;}return null;})[_0x209d('0x21')](respondWithResult(_0x83df1b,null))[_0x209d('0x2b')](handleError(_0x83df1b,null));};exports[_0x209d('0x2d')]=function(_0x22451e,_0x2f606c,_0x4bb216){if(_0x22451e[_0x209d('0x56')]['id']){delete _0x22451e[_0x209d('0x56')]['id'];}var _0x30f5f4;return db[_0x209d('0x3b')][_0x209d('0x57')]({'where':{'id':_0x22451e[_0x209d('0x58')]['id']}})[_0x209d('0x21')](handleEntityNotFound(_0x2f606c,null))[_0x209d('0x21')](function(_0x55e51f){if(_0x55e51f){_0x30f5f4=_0x55e51f;return db[_0x209d('0x85')]['find']({'where':{'id':_0x55e51f[_0x209d('0x86')]}});}})['then'](handleEntityNotFound(_0x2f606c,null))[_0x209d('0x21')](function(_0x54ed52){if(_0x54ed52){logger[_0x209d('0x23')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x209d('0x2d'),_0x209d('0x87'),_0x54ed52[_0x209d('0x88')],util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));switch(_0x54ed52[_0x209d('0x88')]){case'twilio':if(_0x22451e[_0x209d('0x56')][_0x209d('0x8a')]&&_0x22451e[_0x209d('0x56')]['MessageSid']===_0x30f5f4[_0x209d('0x8b')]){return _0x30f5f4['update']({'read':!![]});}else{logger['error'](_0x209d('0x8c'),_0x209d('0x2d'),_0x209d('0x8d'),util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;case _0x209d('0x8e'):if(_0x22451e[_0x209d('0x56')]['MessageUUID']&&_0x22451e[_0x209d('0x56')][_0x209d('0x8f')]===_0x30f5f4['messageId']&&_['indexOf']([_0x209d('0x90'),_0x209d('0x91')],_0x22451e[_0x209d('0x56')]['Status'])>=0x0){return _0x30f5f4[_0x209d('0x35')]({'read':!![]});}else{logger['error'](_0x209d('0x8c'),_0x209d('0x2d'),_0x209d('0x92'),util[_0x209d('0x89')](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;case _0x209d('0x93'):var _0x325f65=_0x22451e['body'][_0x209d('0x94')][0x0];if(_0x325f65[_0x209d('0x2d')][_0x209d('0x95')]===_0x209d('0x96')){return _0x30f5f4[_0x209d('0x35')]({'read':!![]});}else{logger[_0x209d('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x209d('0x93'),util['inspect'](_0x22451e[_0x209d('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x30f5f4;}})[_0x209d('0x21')](respondWithResult(_0x2f606c,null))[_0x209d('0x2b')](handleError(_0x2f606c,null));}; \ No newline at end of file +var _0x2250=['hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','SmsMessage','includeAll','include','rows','show','params','keys','options','create','body','find','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','SmsInteraction','isNil','read1stAt','format','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','agent','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','SmsInteractionId','stringify','RejectMessage','ContactId','User','interface','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','messageId','indexOf','sent','Status','plivio','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','error','code','message','result','catch','status','end','undefined','count','offset','limit','set','json','apply','reject','save','update','destroy','stack','name','map','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length'];(function(_0xdb0316,_0x1699ee){var _0xe43c0d=function(_0x104299){while(--_0x104299){_0xdb0316['push'](_0xdb0316['shift']());}};_0xe43c0d(++_0x1699ee);}(_0x2250,0x178));var _0x0225=function(_0x47b78c,_0x1b6295){_0x47b78c=_0x47b78c-0x0;var _0x230522=_0x2250[_0x47b78c];return _0x230522;};'use strict';var emlformat=require(_0x0225('0x0'));var rimraf=require(_0x0225('0x1'));var zipdir=require(_0x0225('0x2'));var jsonpatch=require(_0x0225('0x3'));var rp=require(_0x0225('0x4'));var moment=require(_0x0225('0x5'));var BPromise=require(_0x0225('0x6'));var Mustache=require('mustache');var util=require(_0x0225('0x7'));var path=require(_0x0225('0x8'));var sox=require(_0x0225('0x9'));var csv=require(_0x0225('0xa'));var ejs=require(_0x0225('0xb'));var fs=require('fs');var fs_extra=require(_0x0225('0xc'));var _=require(_0x0225('0xd'));var squel=require(_0x0225('0xe'));var crypto=require('crypto');var jsforce=require(_0x0225('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0225('0x10'));var Papa=require(_0x0225('0x11'));var Redis=require(_0x0225('0x12'));var authService=require(_0x0225('0x13'));var qs=require(_0x0225('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0225('0x15'));var logger=require(_0x0225('0x16'))(_0x0225('0x17'));var utils=require(_0x0225('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0225('0x19'));var db=require('../../mysqldb')['db'];config[_0x0225('0x1a')]=_[_0x0225('0x1b')](config['redis'],{'host':_0x0225('0x1c'),'port':0x18eb});var socket=require(_0x0225('0x1d'))(new Redis(config[_0x0225('0x1a')]));require(_0x0225('0x1e'))[_0x0225('0x1f')](socket);var jayson=require(_0x0225('0x20'));var client=jayson[_0x0225('0x21')][_0x0225('0x22')]({'port':0x232c});var client9002=jayson[_0x0225('0x21')][_0x0225('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x236a25,_0x494722,_0x2d41d3,_0x8f179c){return new BPromise(function(_0x59e455,_0x60d158){var _0x4e3697=_0x8f179c||client;return _0x4e3697[_0x0225('0x23')](_0x236a25,_0x2d41d3)[_0x0225('0x24')](function(_0x27ab34){logger[_0x0225('0x25')](_0x0225('0x26'),_0x494722,'request\x20sent');logger[_0x0225('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x494722,'request\x20sent',JSON['stringify'](_0x27ab34));if(_0x27ab34[_0x0225('0x28')]){if(_0x27ab34[_0x0225('0x28')][_0x0225('0x29')]===0x1f4){logger[_0x0225('0x28')](_0x0225('0x26'),_0x494722,_0x27ab34[_0x0225('0x28')][_0x0225('0x2a')]);return _0x60d158(_0x27ab34['error'][_0x0225('0x2a')]);}logger[_0x0225('0x28')](_0x0225('0x26'),_0x494722,_0x27ab34['error']['message']);return _0x59e455(_0x27ab34[_0x0225('0x28')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x494722,'request\x20sent');_0x59e455(_0x27ab34[_0x0225('0x2b')]['message']);}})[_0x0225('0x2c')](function(_0xcb5384){logger[_0x0225('0x28')](_0x0225('0x26'),_0x494722,_0xcb5384);_0x60d158(_0xcb5384);});});}function respondWithStatusCode(_0x340552,_0x406a8f){_0x406a8f=_0x406a8f||0xcc;return function(_0x338f49){if(_0x338f49){return _0x340552['sendStatus'](_0x406a8f);}return _0x340552[_0x0225('0x2d')](_0x406a8f)[_0x0225('0x2e')]();};}function respondWithResult(_0xf52abb,_0x32d45d){_0x32d45d=_0x32d45d||0xc8;return function(_0x58b084){if(_0x58b084){return _0xf52abb['status'](_0x32d45d)['json'](_0x58b084);}};}function respondWithFilteredResult(_0x1c44d5,_0x575a64){return function(_0x4b928b){if(_0x4b928b){var _0x3d205c=typeof _0x575a64['offset']===_0x0225('0x2f')&&typeof _0x575a64['limit']===_0x0225('0x2f');var _0x5f3ae2=_0x4b928b[_0x0225('0x30')];var _0x45ae3=_0x3d205c?0x0:_0x575a64[_0x0225('0x31')];var _0x391aed=_0x3d205c?_0x4b928b[_0x0225('0x30')]:_0x575a64['offset']+_0x575a64[_0x0225('0x32')];var _0x1f4888;if(_0x391aed>=_0x5f3ae2){_0x391aed=_0x5f3ae2;_0x1f4888=0xc8;}else{_0x1f4888=0xce;}_0x1c44d5[_0x0225('0x2d')](_0x1f4888);return _0x1c44d5[_0x0225('0x33')]('Content-Range',_0x45ae3+'-'+_0x391aed+'/'+_0x5f3ae2)[_0x0225('0x34')](_0x4b928b);}return null;};}function patchUpdates(_0x241631){return function(_0x5ac8d5){try{jsonpatch[_0x0225('0x35')](_0x5ac8d5,_0x241631,!![]);}catch(_0x402976){return BPromise[_0x0225('0x36')](_0x402976);}return _0x5ac8d5[_0x0225('0x37')]();};}function saveUpdates(_0x1f27b1,_0x7c5e5d){return function(_0x5ad394){if(_0x5ad394){return _0x5ad394[_0x0225('0x38')](_0x1f27b1)['then'](function(_0x58dbca){return _0x58dbca;});}return null;};}function removeEntity(_0x41eb83,_0x47cadf){return function(_0x4d4e3a){if(_0x4d4e3a){return _0x4d4e3a[_0x0225('0x39')]()['then'](function(){_0x41eb83[_0x0225('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x492ece,_0x346cd6){return function(_0x22e101){if(!_0x22e101){_0x492ece['sendStatus'](0x194);}return _0x22e101;};}function handleError(_0x329c7b,_0x61f1fe){_0x61f1fe=_0x61f1fe||0x1f4;return function(_0x208360){logger[_0x0225('0x28')](_0x208360[_0x0225('0x3a')]);if(_0x208360[_0x0225('0x3b')]){delete _0x208360[_0x0225('0x3b')];}_0x329c7b[_0x0225('0x2d')](_0x61f1fe)['send'](_0x208360);};}exports['index']=function(_0xc267cc,_0x375958){var _0xb365d8={},_0x126b20={},_0x476abc={'count':0x0,'rows':[]};var _0x4444b5=_[_0x0225('0x3c')](db['SmsMessage'][_0x0225('0x3d')],function(_0x4b0ca8){return{'name':_0x4b0ca8[_0x0225('0x3e')],'type':_0x4b0ca8[_0x0225('0x3f')][_0x0225('0x40')]};});_0x126b20[_0x0225('0x41')]=_[_0x0225('0x3c')](_0x4444b5,_0x0225('0x3b'));_0x126b20[_0x0225('0x42')]=_['keys'](_0xc267cc[_0x0225('0x42')]);_0x126b20['filters']=_['intersection'](_0x126b20[_0x0225('0x41')],_0x126b20[_0x0225('0x42')]);_0xb365d8[_0x0225('0x43')]=_[_0x0225('0x44')](_0x126b20[_0x0225('0x41')],qs[_0x0225('0x45')](_0xc267cc[_0x0225('0x42')][_0x0225('0x45')]));_0xb365d8[_0x0225('0x43')]=_0xb365d8[_0x0225('0x43')][_0x0225('0x46')]?_0xb365d8[_0x0225('0x43')]:_0x126b20[_0x0225('0x41')];if(!_0xc267cc['query'][_0x0225('0x47')](_0x0225('0x48'))){_0xb365d8[_0x0225('0x32')]=qs[_0x0225('0x32')](_0xc267cc[_0x0225('0x42')]['limit']);_0xb365d8[_0x0225('0x31')]=qs['offset'](_0xc267cc['query'][_0x0225('0x31')]);}_0xb365d8[_0x0225('0x49')]=qs[_0x0225('0x4a')](_0xc267cc[_0x0225('0x42')][_0x0225('0x4a')]);_0xb365d8[_0x0225('0x4b')]=qs[_0x0225('0x4c')](_[_0x0225('0x4d')](_0xc267cc[_0x0225('0x42')],_0x126b20[_0x0225('0x4c')]),_0x4444b5);if(_0xc267cc['query']['filter']){_0xb365d8['where']=_[_0x0225('0x4e')](_0xb365d8[_0x0225('0x4b')],{'$or':_[_0x0225('0x3c')](_0x4444b5,function(_0xf99879){if(_0xf99879[_0x0225('0x3f')]!==_0x0225('0x4f')){var _0xf64e42={};_0xf64e42[_0xf99879[_0x0225('0x3b')]]={'$like':'%'+_0xc267cc[_0x0225('0x42')][_0x0225('0x50')]+'%'};return _0xf64e42;}})});}_0xb365d8=_['merge']({},_0xb365d8,_0xc267cc['options']);var _0x33ddd9={'where':_0xb365d8[_0x0225('0x4b')]};return db[_0x0225('0x51')]['count'](_0x33ddd9)[_0x0225('0x24')](function(_0x3215e0){_0x476abc[_0x0225('0x30')]=_0x3215e0;if(_0xc267cc['query'][_0x0225('0x52')]){_0xb365d8[_0x0225('0x53')]=[{'all':!![]}];}return db[_0x0225('0x51')]['findAll'](_0xb365d8);})[_0x0225('0x24')](function(_0x35fe17){_0x476abc[_0x0225('0x54')]=_0x35fe17;return _0x476abc;})[_0x0225('0x24')](respondWithFilteredResult(_0x375958,_0xb365d8))[_0x0225('0x2c')](handleError(_0x375958,null));};exports[_0x0225('0x55')]=function(_0x4a90d5,_0x1b8d97){var _0x50afa1={'raw':!![],'where':{'id':_0x4a90d5[_0x0225('0x56')]['id']}},_0x522100={};_0x522100[_0x0225('0x41')]=_['keys'](db['SmsMessage'][_0x0225('0x3d')]);_0x522100[_0x0225('0x42')]=_[_0x0225('0x57')](_0x4a90d5[_0x0225('0x42')]);_0x522100['filters']=_[_0x0225('0x44')](_0x522100[_0x0225('0x41')],_0x522100[_0x0225('0x42')]);_0x50afa1[_0x0225('0x43')]=_[_0x0225('0x44')](_0x522100[_0x0225('0x41')],qs['fields'](_0x4a90d5[_0x0225('0x42')][_0x0225('0x45')]));_0x50afa1['attributes']=_0x50afa1['attributes'][_0x0225('0x46')]?_0x50afa1[_0x0225('0x43')]:_0x522100[_0x0225('0x41')];if(_0x4a90d5[_0x0225('0x42')][_0x0225('0x52')]){_0x50afa1[_0x0225('0x53')]=[{'all':!![]}];}_0x50afa1=_[_0x0225('0x4e')]({},_0x50afa1,_0x4a90d5[_0x0225('0x58')]);return db[_0x0225('0x51')]['find'](_0x50afa1)[_0x0225('0x24')](handleEntityNotFound(_0x1b8d97,null))[_0x0225('0x24')](respondWithResult(_0x1b8d97,null))[_0x0225('0x2c')](handleError(_0x1b8d97,null));};exports[_0x0225('0x59')]=function(_0x1159fa,_0x225c05){return db['SmsMessage'][_0x0225('0x59')](_0x1159fa['body'],{})[_0x0225('0x24')](respondWithResult(_0x225c05,0xc9))['catch'](handleError(_0x225c05,null));};exports[_0x0225('0x38')]=function(_0x135a3c,_0x73edb4){if(_0x135a3c['body']['id']){delete _0x135a3c[_0x0225('0x5a')]['id'];}return db[_0x0225('0x51')][_0x0225('0x5b')]({'where':{'id':_0x135a3c['params']['id']}})[_0x0225('0x24')](handleEntityNotFound(_0x73edb4,null))[_0x0225('0x24')](saveUpdates(_0x135a3c[_0x0225('0x5a')],null))[_0x0225('0x24')](respondWithResult(_0x73edb4,null))[_0x0225('0x2c')](handleError(_0x73edb4,null));};exports[_0x0225('0x39')]=function(_0x413d01,_0x2a7c7f){return db[_0x0225('0x51')][_0x0225('0x5b')]({'where':{'id':_0x413d01[_0x0225('0x56')]['id']}})[_0x0225('0x24')](handleEntityNotFound(_0x2a7c7f,null))[_0x0225('0x24')](removeEntity(_0x2a7c7f,null))['catch'](handleError(_0x2a7c7f,null));};exports['describe']=function(_0x6a743d,_0x9470ce){return db[_0x0225('0x51')]['describe']()[_0x0225('0x24')](respondWithResult(_0x9470ce,null))[_0x0225('0x2c')](handleError(_0x9470ce,null));};var interaction_log=require(_0x0225('0x16'))(_0x0225('0x5c'));exports[_0x0225('0x5d')]=function(_0x46bbd8,_0x4c584e,_0x49a25b){var _0x210d42={'agent':{},'channel':_0x0225('0x5e')};if(_0x46bbd8['body']['id']){delete _0x46bbd8['body']['id'];}_0x46bbd8[_0x0225('0x5a')][_0x0225('0x5f')]=!![];_0x46bbd8['body'][_0x0225('0x60')]=moment()['format'](_0x0225('0x61'));_0x46bbd8[_0x0225('0x5a')][_0x0225('0x62')]=_0x46bbd8[_0x0225('0x5a')][_0x0225('0x62')]||_0x46bbd8['user']['id'];_0x210d42['agent']['id']=_0x46bbd8['body'][_0x0225('0x62')];return db[_0x0225('0x51')]['find']({'where':{'id':_0x46bbd8[_0x0225('0x56')]['id'],'UserId':null}})[_0x0225('0x24')](handleEntityNotFound(_0x4c584e,null))['then'](saveUpdates(_0x46bbd8[_0x0225('0x5a')],null))[_0x0225('0x24')](function(_0x17f06c){if(_0x17f06c){_0x210d42['message']=_0x17f06c['get']({'plain':!![]});return db[_0x0225('0x63')][_0x0225('0x5b')]({'where':{'id':_0x17f06c['SmsInteractionId']}});}return null;})[_0x0225('0x24')](handleEntityNotFound(_0x4c584e,null))[_0x0225('0x24')](function(_0x37628a){if(_0x37628a){return _0x37628a[_0x0225('0x38')]({'UserId':_0x46bbd8[_0x0225('0x5a')][_0x0225('0x62')],'read1stAt':_[_0x0225('0x64')](_0x37628a[_0x0225('0x65')])?moment()[_0x0225('0x66')](_0x0225('0x61')):undefined});}return null;})[_0x0225('0x24')](function(_0x440ad4){if(_0x440ad4){_0x210d42[_0x0225('0x67')]=_0x440ad4[_0x0225('0x68')]({'plain':!![]});interaction_log[_0x0225('0x25')](_0x0225('0x69'),_0x46bbd8[_0x0225('0x6a')]['id'],_0x46bbd8[_0x0225('0x6a')]['name'],_0x46bbd8['user'][_0x0225('0x6b')],_0x210d42[_0x0225('0x67')]['id'],_0x46bbd8[_0x0225('0x5a')]?JSON['stringify'](_0x46bbd8[_0x0225('0x5a')]):_0x0225('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x0225('0x6d'),_0x210d42);}return null;})[_0x0225('0x24')](function(_0x3105ca){var _0xd1b926=_0x0225('0x6e')+_0x3105ca[_0x0225('0x2a')]['ContactId'];return db[_0x0225('0x6f')][_0x0225('0x42')](_0xd1b926,{'type':db[_0x0225('0x70')]['QueryTypes'][_0x0225('0x71')],'raw':!![]})[_0x0225('0x24')](function(_0x147721){return _0x147721;});})[_0x0225('0x24')](function(_0x3584a5){if(_0x3584a5){_0x210d42['message'][_0x0225('0x72')]=_0x3584a5[0x0];if(!_0x46bbd8['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x46bbd8[_0x0225('0x5a')][_0x0225('0x62')],'role':_0x0225('0x73')},'attributes':['id','name',_0x0225('0x74'),_0x0225('0x75'),_0x0225('0x76')],'raw':!![]});}return null;})[_0x0225('0x24')](function(_0x52d029){if(!_0x52d029)return null;_0x210d42[_0x0225('0x2a')][_0x0225('0x73')]=_0x52d029;return _0x210d42;})[_0x0225('0x24')](function(_0x3dfad0){if(_0x3dfad0){if(_0x46bbd8[_0x0225('0x5a')][_0x0225('0x77')]){_0x210d42[_0x0225('0x2a')]['interface']=util[_0x0225('0x66')](_0x0225('0x78'),_0x46bbd8[_0x0225('0x6a')][_0x0225('0x3b')]);_0x210d42[_0x0225('0x2a')][_0x0225('0x79')]=_0x210d42['channel'];_0x210d42['message'][_0x0225('0x7a')]=_0x210d42[_0x0225('0x79')];_0x210d42[_0x0225('0x2a')][_0x0225('0x7b')]='accept';return respondWithRpcPromise(_0x0225('0x7c'),_0x0225('0x7c'),{'event':_0x0225('0x7d'),'message':_0x210d42[_0x0225('0x2a')]},client9002)[_0x0225('0x24')](function(){return _0x210d42;});}return _0x210d42;}return null;})[_0x0225('0x24')](respondWithResult(_0x4c584e,null))[_0x0225('0x2c')](handleError(_0x4c584e,null));};var interaction_log=require(_0x0225('0x16'))('sms-interactions');exports['reject']=function(_0x40f39b,_0x2e3333,_0x4b1198){var _0x2b9636={'agent':{},'channel':_0x0225('0x5e')};if(_0x40f39b['body']['id']){delete _0x40f39b[_0x0225('0x5a')]['id'];}_0x40f39b[_0x0225('0x5a')][_0x0225('0x62')]=_0x40f39b[_0x0225('0x5a')][_0x0225('0x62')]||_0x40f39b[_0x0225('0x6a')]['id'];_0x2b9636[_0x0225('0x73')]['id']=_0x40f39b[_0x0225('0x5a')][_0x0225('0x62')];return db[_0x0225('0x51')][_0x0225('0x5b')]({'where':{'id':_0x40f39b[_0x0225('0x56')]['id'],'UserId':null}})[_0x0225('0x24')](handleEntityNotFound(_0x2e3333,null))[_0x0225('0x24')](function(_0x9635fd){if(_0x9635fd){_0x2b9636[_0x0225('0x2a')]=_0x9635fd['get']({'plain':!![]});return db[_0x0225('0x63')][_0x0225('0x5b')]({'where':{'id':_0x9635fd[_0x0225('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x2e3333,null))[_0x0225('0x24')](function(_0x3eb74e){if(_0x3eb74e){_0x2b9636[_0x0225('0x67')]=_0x3eb74e[_0x0225('0x68')]({'plain':!![]});interaction_log[_0x0225('0x25')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40f39b[_0x0225('0x6a')]['id'],_0x40f39b[_0x0225('0x6a')]['name'],_0x40f39b[_0x0225('0x6a')][_0x0225('0x6b')],_0x2b9636[_0x0225('0x67')]['id'],_0x40f39b[_0x0225('0x5a')]?JSON[_0x0225('0x7f')](_0x40f39b['body']):_0x0225('0x6c'));return respondWithRpcPromise(_0x0225('0x80'),'rejectMessage',_0x2b9636);}return null;})['then'](function(_0x408ec8){var _0x426a6d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x408ec8[_0x0225('0x2a')][_0x0225('0x81')];return db[_0x0225('0x6f')][_0x0225('0x42')](_0x426a6d,{'type':db[_0x0225('0x70')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x467abc){return _0x467abc;});})[_0x0225('0x24')](function(_0x37f0ba){if(_0x37f0ba){_0x2b9636[_0x0225('0x2a')][_0x0225('0x72')]=_0x37f0ba[0x0];if(!_0x40f39b[_0x0225('0x5a')][_0x0225('0x62')])return;return db[_0x0225('0x82')][_0x0225('0x5b')]({'where':{'id':_0x40f39b[_0x0225('0x5a')][_0x0225('0x62')],'role':_0x0225('0x73')},'attributes':['id',_0x0225('0x3b'),_0x0225('0x74'),_0x0225('0x75'),_0x0225('0x76')],'raw':!![]});}return null;})['then'](function(_0x1534df){if(!_0x1534df)return null;_0x2b9636['message'][_0x0225('0x73')]=_0x1534df;return _0x2b9636;})[_0x0225('0x24')](function(_0x4313ed){if(_0x4313ed){_0x4313ed['message'][_0x0225('0x83')]=util[_0x0225('0x66')](_0x0225('0x78'),_0x40f39b[_0x0225('0x6a')]['name']);_0x4313ed['message'][_0x0225('0x79')]=_0x2b9636[_0x0225('0x79')];_0x4313ed['message'][_0x0225('0x7a')]=_0x2b9636[_0x0225('0x79')];_0x4313ed[_0x0225('0x2a')][_0x0225('0x7b')]='reject';respondWithRpcPromise(_0x0225('0x7c'),_0x0225('0x7c'),{'event':'rejectmessage','message':_0x4313ed[_0x0225('0x2a')]},client9002);return _0x2b9636;}return null;})['then'](respondWithResult(_0x2e3333,null))[_0x0225('0x2c')](handleError(_0x2e3333,null));};exports[_0x0225('0x2d')]=function(_0xdbc872,_0x2eabd4,_0x148092){if(_0xdbc872[_0x0225('0x5a')]['id']){delete _0xdbc872[_0x0225('0x5a')]['id'];}var _0x3616a1;return db[_0x0225('0x51')][_0x0225('0x5b')]({'where':{'id':_0xdbc872[_0x0225('0x56')]['id']}})[_0x0225('0x24')](handleEntityNotFound(_0x2eabd4,null))[_0x0225('0x24')](function(_0x321e00){if(_0x321e00){_0x3616a1=_0x321e00;return db[_0x0225('0x84')][_0x0225('0x5b')]({'where':{'id':_0x321e00[_0x0225('0x85')]}});}})[_0x0225('0x24')](handleEntityNotFound(_0x2eabd4,null))[_0x0225('0x24')](function(_0x4c4c8d){if(_0x4c4c8d){logger[_0x0225('0x27')](_0x0225('0x86'),'status',_0x0225('0x87'),_0x4c4c8d['type'],util[_0x0225('0x88')](_0xdbc872[_0x0225('0x5a')],{'showHidden':![],'depth':null}));switch(_0x4c4c8d[_0x0225('0x3f')]){case _0x0225('0x89'):if(_0xdbc872[_0x0225('0x5a')][_0x0225('0x8a')]&&_0xdbc872[_0x0225('0x5a')][_0x0225('0x8a')]===_0x3616a1['messageId']){return _0x3616a1[_0x0225('0x38')]({'read':!![]});}else{logger['error'](_0x0225('0x8b'),'status',_0x0225('0x89'),util['inspect'](_0xdbc872[_0x0225('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x0225('0x8c'):if(_0xdbc872['body'][_0x0225('0x8d')]&&_0xdbc872['body'][_0x0225('0x8d')]===_0x3616a1[_0x0225('0x8e')]&&_[_0x0225('0x8f')]([_0x0225('0x90'),'delivered'],_0xdbc872[_0x0225('0x5a')][_0x0225('0x91')])>=0x0){return _0x3616a1[_0x0225('0x38')]({'read':!![]});}else{logger['error'](_0x0225('0x8b'),'status',_0x0225('0x92'),util[_0x0225('0x88')](_0xdbc872[_0x0225('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x529631=_0xdbc872[_0x0225('0x5a')]['results'][0x0];if(_0x529631[_0x0225('0x2d')][_0x0225('0x93')]===_0x0225('0x94')){return _0x3616a1[_0x0225('0x38')]({'read':!![]});}else{logger[_0x0225('0x28')](_0x0225('0x8b'),_0x0225('0x2d'),'infobip',util[_0x0225('0x88')](_0xdbc872[_0x0225('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3616a1;}})[_0x0225('0x24')](respondWithResult(_0x2eabd4,null))[_0x0225('0x2c')](handleError(_0x2eabd4,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 9a8b185..66ad380 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 _0xe500=['emit','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe500,0x153));var _0x0e50=function(_0x15a634,_0x4feb86){_0x15a634=_0x15a634-0x0;var _0xf4f7a0=_0xe500[_0x15a634];return _0xf4f7a0;};'use strict';var EventEmitter=require(_0x0e50('0x0'));var SmsMessage=require(_0x0e50('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x0e50('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0e50('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4cffbc){return function(_0x43272f,_0x45c15b,_0x1e9a21){SmsMessageEvents[_0x0e50('0x4')](_0x4cffbc+':'+_0x43272f['id'],_0x43272f);SmsMessageEvents['emit'](_0x4cffbc,_0x43272f);_0x1e9a21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x0e50('0x5')](e,emitEvent(event));}}module[_0x0e50('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0xf346=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3e8ecb,_0x37c003){var _0x4095e1=function(_0xe45051){while(--_0xe45051){_0x3e8ecb['push'](_0x3e8ecb['shift']());}};_0x4095e1(++_0x37c003);}(_0xf346,0x123));var _0x6f34=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf346[_0x565ed7];return _0x183ad7;};'use strict';var EventEmitter=require(_0x6f34('0x0'));var SmsMessage=require(_0x6f34('0x1'))['db'][_0x6f34('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6f34('0x3')](0x0);var events={'afterCreate':_0x6f34('0x4'),'afterUpdate':_0x6f34('0x5'),'afterDestroy':_0x6f34('0x6')};function emitEvent(_0x36c8b6){return function(_0x5b1979,_0x4bdb22,_0x1f2be2){SmsMessageEvents[_0x6f34('0x7')](_0x36c8b6+':'+_0x5b1979['id'],_0x5b1979);SmsMessageEvents['emit'](_0x36c8b6,_0x5b1979);_0x1f2be2(null);};}for(var e in events){if(events[_0x6f34('0x8')](e)){var event=events[e];SmsMessage[_0x6f34('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d1ae19d..fe624b2 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 _0x21b8=['https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','update','createdAt','catch','SmsAccount','SmsAccountId','then','type','twilio','authToken','phone','messages','create','remote','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','error','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','user_key','deliveryReport','read','afterCreate','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','Basic\x20%s','base64','http_code','queued_count','head','data','message_id','clickSend','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','toString','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','IBSSO\x20','Missing\x20parameters:\x20base_url','crypto','apiKey','login','sort','createHash','md5','hex','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer'];(function(_0x1be05d,_0x16412a){var _0x4c869f=function(_0x4a43de){while(--_0x4a43de){_0x1be05d['push'](_0x1be05d['shift']());}};_0x4c869f(++_0x16412a);}(_0x21b8,0x1eb));var _0x821b=function(_0x2c2ff4,_0x2e365d){_0x2c2ff4=_0x2c2ff4-0x0;var _0x8f9e95=_0x21b8[_0x2c2ff4];return _0x8f9e95;};'use strict';var _=require(_0x821b('0x0'));var util=require(_0x821b('0x1'));var logger=require(_0x821b('0x2'))(_0x821b('0x3'));var moment=require('moment');var BPromise=require(_0x821b('0x4'));var rp=require(_0x821b('0x5'));var fs=require('fs');var path=require(_0x821b('0x6'));var rimraf=require(_0x821b('0x7'));var config=require(_0x821b('0x8'));var attributes=require(_0x821b('0x9'));module['exports']=function(_0x2a3cf7,_0x448f79){return _0x2a3cf7[_0x821b('0xa')]('SmsMessage',attributes,{'tableName':_0x821b('0xb'),'paranoid':![],'indexes':[{'name':_0x821b('0xc'),'fields':[_0x821b('0xc')]},{'name':_0x821b('0xd'),'fields':[_0x821b('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x45cdf4,_0x319db9,_0x5e9953){var _0x3328be=_0x2a3cf7[_0x821b('0xf')];var _0x75fb89=_0x45cdf4[_0x821b('0x10')]({'plain':!![]});if(_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()==='in'||_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()===_0x821b('0x13')&&!_0x75fb89[_0x821b('0x14')]&&!_[_0x821b('0x15')](_0x75fb89['UserId'])&&!_['isNil'](_0x75fb89['SmsInteractionId'])){_0x3328be['SmsInteraction'][_0x821b('0x16')]({'where':{'id':_0x75fb89['SmsInteractionId']}})['then'](function(_0x1cbc47){if(_0x1cbc47){_0x1cbc47[_0x821b('0x17')]({'lastMsgAt':_0x75fb89[_0x821b('0x18')],'lastMsgDirection':_0x75fb89[_0x821b('0x11')][_0x821b('0x12')]()});}})[_0x821b('0x19')](function(_0x51c400){console['error'](_0x51c400);});}if(_0x75fb89[_0x821b('0x11')]===_0x821b('0x13')&&!_0x75fb89[_0x821b('0x14')]){var _0x4be4f4;_0x3328be[_0x821b('0x1a')]['find']({'where':{'id':_0x75fb89[_0x821b('0x1b')]},'raw':!![]})[_0x821b('0x1c')](function(_0x32f857){_0x4be4f4=_0x32f857;if(_0x4be4f4&&_0x4be4f4[_0x821b('0x1d')]){switch(_0x4be4f4[_0x821b('0x1d')]){case _0x821b('0x1e'):var _0x2140a2=require(_0x821b('0x1e'));if(_0x4be4f4['accountSid']&&_0x4be4f4[_0x821b('0x1f')]&&_0x4be4f4[_0x821b('0x20')]){var _0x234be4=new _0x2140a2(_0x4be4f4['accountSid'],_0x4be4f4['authToken']);_0x234be4[_0x821b('0x21')][_0x821b('0x22')]({'body':_0x75fb89[_0x821b('0xe')],'to':_0x75fb89[_0x821b('0x20')],'from':_0x4be4f4[_0x821b('0x20')],'statusCallback':_0x4be4f4[_0x821b('0x23')]+_0x821b('0x24')+_0x75fb89['id']+'/status?token='+_0x4be4f4[_0x821b('0x25')]})[_0x821b('0x1c')](function(_0x48102e){if(_0x48102e[_0x821b('0x26')]){return _0x45cdf4[_0x821b('0x17')]({'messageId':_0x48102e[_0x821b('0x26')]});}})[_0x821b('0x19')](function(_0x199ef3){logger['error'](_0x821b('0x27'),'afterCreate',_0x821b('0x1e'),util['inspect'](_0x199ef3,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x821b('0x29'):var _0x4aa48f=_0x821b('0x2a');if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4[_0x821b('0x2c')]){var _0xf8dd9a={'recipient':[_0x75fb89[_0x821b('0x20')]],'message':_0x75fb89[_0x821b('0xe')],'message_type':_0x4be4f4['smsMethod']};if(_0x4be4f4['smsMethod']&&_0x4be4f4[_0x821b('0x2d')]!=='SI'){_0xf8dd9a[_0x821b('0x2e')]=_0x4be4f4[_0x821b('0x20')];}var _0x3cdea7={'url':_0x4aa48f+_0x821b('0x2f')+_0x4be4f4['username']+_0x821b('0x30')+_0x4be4f4['password'],'method':_0x821b('0x31')};rp(_0x3cdea7)[_0x821b('0x1c')](function(_0x1fc7f9){var _0x28cd28=_0x1fc7f9[_0x821b('0x32')](';');var _0x58d71e={'user_key':_0x28cd28[0x0],'session_key':_0x28cd28[0x1]};_0x3cdea7={'url':_0x4aa48f+_0x821b('0x33'),'method':'POST','headers':{'user_key':_0x58d71e[_0x821b('0x34')],'Session_key':_0x58d71e['session_key']},'json':!![],'body':_0xf8dd9a};return rp(_0x3cdea7);})[_0x821b('0x1c')](function(_0x21c5b1){if(_0x21c5b1['total_sent']>=0x1){var _0x4725ba={'messageId':_0x21c5b1['internal_order_id']};if(_0x4be4f4[_0x821b('0x2d')]!=='GP'||!_0x4be4f4[_0x821b('0x35')]){_0x4725ba[_0x821b('0x36')]=!![];}return _0x45cdf4['update'](_0x4725ba);}else{return logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x29'),util['inspect'](_0x21c5b1,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x36bba2){return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'skebby',util[_0x821b('0x38')](_0x36bba2,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x29'),_0x821b('0x39'));}break;case _0x821b('0x3a'):if(_0x4be4f4[_0x821b('0x1f')]){var _0x3cd2df={'recipient':_0x75fb89['phone'],'message':_0x75fb89[_0x821b('0xe')],'sender':_0x4be4f4[_0x821b('0x3b')]||_0x4be4f4['phone'],'authorization':_0x4be4f4[_0x821b('0x1f')]};var _0x319db9={'method':_0x821b('0x3c'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x3cd2df,'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0xcb5cdc){var _0x421ebd={'messageId':_0xcb5cdc[_0x821b('0x3d')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x421ebd[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x421ebd);})['catch'](function(_0x48118c){logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'connectel',util[_0x821b('0x38')](_0x48118c,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x3a'),_0x821b('0x3e'));}break;case _0x821b('0x3f'):if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4['password']){var _0x3cd2df={'messages':[{'source':'xCALLY\x20Motion','to':_0x75fb89['phone'],'body':_0x75fb89[_0x821b('0xe')],'from':_0x4be4f4['senderString']||_0x4be4f4[_0x821b('0x20')]}]};var _0x733e2f=util[_0x821b('0x40')](_0x821b('0x41'),_0x4be4f4[_0x821b('0x2b')],_0x4be4f4[_0x821b('0x2c')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x3cd2df,'headers':{'Authorization':util[_0x821b('0x40')](_0x821b('0x42'),new Buffer(_0x733e2f)['toString'](_0x821b('0x43')))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x36d5ae){if(_0x36d5ae[_0x821b('0x44')]>=0xc8&&_0x36d5ae[_0x821b('0x44')]<=0xce){if(_0x36d5ae['data']&&_0x36d5ae['data'][_0x821b('0x45')]>0x0){var _0x867c53=_[_0x821b('0x46')](_0x36d5ae[_0x821b('0x47')][_0x821b('0x21')]);var _0x519bc6={'messageId':_0x867c53[_0x821b('0x48')]};if(!_0x4be4f4['deliveryReport']){_0x519bc6['read']=!![];}return _0x45cdf4[_0x821b('0x17')](_0x519bc6);}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x49'),util[_0x821b('0x38')](_0x36d5ae,{'showHidden':![],'depth':null}));}}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x49'),util[_0x821b('0x38')](_0x36d5ae,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x4026e7){logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x49'),util['inspect'](_0x4026e7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case'plivo':if(_0x4be4f4[_0x821b('0x4a')]&&_0x4be4f4[_0x821b('0x1f')]){var _0x3cd2df={'dst':_0x75fb89['phone'],'text':_0x75fb89[_0x821b('0xe')],'src':_0x4be4f4['senderString']||_0x4be4f4['phone'],'url':_0x4be4f4[_0x821b('0x23')]+_0x821b('0x24')+_0x75fb89['id']+_0x821b('0x4b')+_0x4be4f4[_0x821b('0x25')]};var _0x733e2f=util['format'](_0x821b('0x41'),_0x4be4f4[_0x821b('0x4a')],_0x4be4f4[_0x821b('0x1f')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':util[_0x821b('0x40')](_0x821b('0x4c'),_0x4be4f4[_0x821b('0x4a')]),'body':_0x3cd2df,'headers':{'Authorization':util['format'](_0x821b('0x42'),new Buffer(_0x733e2f)[_0x821b('0x4d')]('base64'))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x7a4e86){var _0x4c2d20={'messageId':_0x7a4e86[_0x821b('0x4e')][0x0]};return _0x45cdf4[_0x821b('0x17')](_0x4c2d20);})[_0x821b('0x19')](function(_0x49ed03){logger['error'](_0x821b('0x27'),'afterCreate',_0x821b('0x4f'),util[_0x821b('0x38')](_0x49ed03,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x4f'),_0x821b('0x50'));}break;case _0x821b('0x51'):if(_0x4be4f4['username']&&_0x4be4f4[_0x821b('0x2c')]){if(_0x4be4f4['baseUrl']){var _0x13150e={'method':'POST','uri':_0x4be4f4['baseUrl']+'/auth/1/session','body':{'username':_0x4be4f4[_0x821b('0x2b')],'password':_0x4be4f4[_0x821b('0x2c')]},'json':!![]};return rp(_0x13150e)[_0x821b('0x1c')](function(_0x77e8df){var _0x317e7c={'method':'POST','uri':_0x4be4f4[_0x821b('0x52')]+_0x821b('0x53'),'body':{'messages':[{'from':_0x4be4f4[_0x821b('0x20')],'destinations':[{'to':_0x75fb89[_0x821b('0x20')]}],'text':_0x75fb89[_0x821b('0xe')],'notifyUrl':_0x4be4f4['remote']+'/api/sms/messages/'+_0x75fb89['id']+_0x821b('0x4b')+_0x4be4f4[_0x821b('0x25')],'notifyContentType':'application/json','callbackData':_0x4be4f4[_0x821b('0x20')]+';'+_0x75fb89[_0x821b('0xe')]}]},'headers':{'Authorization':_0x821b('0x54')+_0x77e8df[_0x821b('0x25')]},'json':!![]};return rp(_0x317e7c)[_0x821b('0x1c')](function(_0x374cdf){if(_0x374cdf[_0x821b('0x21')]){var _0x38bc41={'messageId':_0x374cdf[_0x821b('0x21')][0x0][_0x821b('0xc')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x38bc41[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x38bc41);}else{return logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x51'),util['inspect'](_0x374cdf,{'showHidden':![],'depth':null}));}});})[_0x821b('0x19')](function(_0x342f0f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x51'),util[_0x821b('0x38')](_0x342f0f,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'infobip',_0x821b('0x55'));}}else{logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x51'),_0x821b('0x39'));}break;case'csc':var _0x393cfb=require(_0x821b('0x56'));if(_0x4be4f4[_0x821b('0x57')]){var _0x16f863={};_0x16f863[_0x821b('0x58')]=_0x4be4f4[_0x821b('0x2b')];_0x16f863[_0x821b('0x20')]=_0x75fb89[_0x821b('0x20')];_0x16f863[_0x821b('0x2e')]=_0x4be4f4[_0x821b('0x20')];_0x16f863['text']=_0x75fb89['body'];_0x16f863['timestamp']=+new Date();var _0x1100c5='';var _0x5124e1='';var _0xa0503d=Object['keys'](_0x16f863);_0xa0503d[_0x821b('0x59')]();for(var _0x54179c=0x0;_0x54179c<_0xa0503d['length'];_0x54179c++){if(_0x1100c5!=''){_0x1100c5+='&';}_0x1100c5+=_0xa0503d[_0x54179c]+'='+encodeURIComponent(_0x16f863[_0xa0503d[_0x54179c]]);_0x5124e1+=_0x16f863[_0xa0503d[_0x54179c]];}_0x5124e1+=_0x4be4f4['apiKey'];_0x5124e1=_0x393cfb[_0x821b('0x5a')](_0x821b('0x5b'))['update'](_0x5124e1)['digest'](_0x821b('0x5c'));if(_0x1100c5!==''){_0x1100c5+='&';}_0x1100c5+='signature='+_0x5124e1;var _0x3cdea7={'method':'GET','uri':_0x4be4f4[_0x821b('0x52')]+_0x821b('0x5d')+_0x1100c5,'json':!![]};return rp(_0x3cdea7)['then'](function(_0x421ed6){var _0x54ea63=Object[_0x821b('0x5e')](_0x421ed6);if(_0x421ed6[_0x54ea63[0x0]]['error']&&parseInt(_0x421ed6[_0x54ea63[0x0]][_0x821b('0x28')])===0x0){var _0x582eb5={'messageId':_0x421ed6[_0x54ea63[0x0]][_0x821b('0x5f')]};if(!_0x4be4f4[_0x821b('0x35')]){_0x582eb5[_0x821b('0x36')]=!![];}return _0x45cdf4[_0x821b('0x17')](_0x582eb5);}else{return logger[_0x821b('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x60'),util[_0x821b('0x38')](_0x421ed6[_0x821b('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x338d68){return logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x60'),util[_0x821b('0x38')](_0x338d68,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x60'),_0x821b('0x61'));}break;case'clickatell':if(_0x4be4f4[_0x821b('0x57')]){var _0x1820f3={'method':'POST','uri':_0x821b('0x62'),'headers':{'Authorization':_0x4be4f4[_0x821b('0x57')]},'body':{'content':_0x75fb89[_0x821b('0xe')],'to':[_0x75fb89[_0x821b('0x20')]],'from':_0x4be4f4['phone'],'binary':![],'clientMessageId':_0x821b('0x63'),'charset':_0x821b('0x64')},'json':!![]};rp(_0x1820f3)[_0x821b('0x1c')](function(_0x4650a4){if(!_0x4650a4[_0x821b('0x28')]){var _0x44e888={'messageId':_0x4650a4[_0x821b('0x21')][0x0][_0x821b('0x65')]};if(!_0x4be4f4['deliveryReport']){_0x44e888[_0x821b('0x36')]=!![];}return _0x45cdf4['update'](_0x44e888);}else{return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x66'),util[_0x821b('0x38')](_0x4650a4[_0x821b('0x28')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1ba9ae){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x66'),util[_0x821b('0x38')](_0x1ba9ae,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x66'),_0x821b('0x61'));}break;case _0x821b('0x67'):if(_0x4be4f4[_0x821b('0x2b')]&&_0x4be4f4[_0x821b('0x2c')]){var _0x733e2f=util[_0x821b('0x40')](_0x821b('0x41'),_0x4be4f4[_0x821b('0x2b')],_0x4be4f4[_0x821b('0x2c')]);var _0x319db9={'method':_0x821b('0x3c'),'uri':_0x821b('0x68')+_0x4be4f4[_0x821b('0x69')]+_0x821b('0x6a'),'body':{'to':[_0x75fb89[_0x821b('0x20')]],'text':_0x75fb89[_0x821b('0xe')],'from':_0x4be4f4[_0x821b('0x20')],'applicationId':_0x4be4f4[_0x821b('0x6b')]},'headers':{'Authorization':util[_0x821b('0x40')](_0x821b('0x42'),new Buffer(_0x733e2f)[_0x821b('0x4d')](_0x821b('0x43')))},'json':!![]};rp(_0x319db9)[_0x821b('0x1c')](function(_0x10b8be){if(_0x10b8be['id']){var _0x21f7c3={'messageId':_0x10b8be['id']};return _0x45cdf4[_0x821b('0x17')](_0x21f7c3);}else{logger[_0x821b('0x28')](_0x821b('0x27'),'afterCreate',_0x821b('0x67'),util[_0x821b('0x38')](_0x10b8be,{'showHidden':![],'depth':null}));}})[_0x821b('0x19')](function(_0x20b68e){logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x67'),util['inspect'](_0x20b68e,{'showHidden':![],'depth':null}));});}else{logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),'bandwidth',_0x821b('0x39'));}break;case _0x821b('0x6c'):if(_0x4be4f4['apiKey']){var _0x1f3eb2={};var _0x3cdea7={'method':_0x821b('0x3c'),'uri':_0x821b('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x4be4f4[_0x821b('0x57')],'Content-Type':_0x821b('0x6e')},'body':{'from':_0x4be4f4['phone'],'to':_0x75fb89['phone'],'text':_0x75fb89[_0x821b('0xe')]},'json':!![]};return rp(_0x3cdea7)[_0x821b('0x1c')](function(_0x255138){if(_0x255138[_0x821b('0x6f')]==0xca){_0x1f3eb2['message']=_0x255138;var _0x2c50cf={'method':_0x821b('0x3c'),'uri':_0x821b('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x4be4f4[_0x821b('0x57')],'Content-Type':_0x821b('0x6e')},'body':{'refid':_0x1f3eb2[_0x821b('0x71')][_0x821b('0x72')]},'json':!![]};return rp(_0x2c50cf)['then'](function(_0x35a981){_0x1f3eb2[_0x821b('0x73')]=_0x35a981;var _0x576b5b={'messageId':_0x1f3eb2[_0x821b('0x71')][_0x821b('0x72')],'read':!![]};return _0x45cdf4[_0x821b('0x17')](_0x576b5b);});}else{return logger[_0x821b('0x28')](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x6c'),util[_0x821b('0x38')](_0x255138,{'showHidden':![],'depth':null}));}})['catch'](function(_0x465973){return logger[_0x821b('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x821b('0x37'),_0x821b('0x6c'),util[_0x821b('0x38')](_0x465973,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x821b('0x27'),_0x821b('0x37'),_0x821b('0x6c'),_0x821b('0x74'));}break;}}})[_0x821b('0x75')](function(){_0x5e9953();});}else{_0x5e9953();}}},'charset':_0x821b('0x76'),'collate':_0x821b('0x77')});}; \ No newline at end of file +var _0xcfd1=['crypto','apiKey','login','text','keys','sort','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','fti_sms_messages','models','get','direction','toLowerCase','out','secret','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','token','sid','update','afterCreate','error','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','password','body','smsMethod','sender','username','&password=','GET','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','head','clickSend','plivo','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/status?token=','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url'];(function(_0x39cff5,_0x234f0c){var _0x430437=function(_0xb2375){while(--_0xb2375){_0x39cff5['push'](_0x39cff5['shift']());}};_0x430437(++_0x234f0c);}(_0xcfd1,0x162));var _0x1cfd=function(_0x2d9486,_0x238887){_0x2d9486=_0x2d9486-0x0;var _0x53bc88=_0xcfd1[_0x2d9486];return _0x53bc88;};'use strict';var _=require('lodash');var util=require(_0x1cfd('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1cfd('0x1'));var BPromise=require(_0x1cfd('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cfd('0x3'));var rimraf=require(_0x1cfd('0x4'));var config=require(_0x1cfd('0x5'));var attributes=require('./smsMessage.attributes');module[_0x1cfd('0x6')]=function(_0x4cc26d,_0x526807){return _0x4cc26d[_0x1cfd('0x7')](_0x1cfd('0x8'),attributes,{'tableName':_0x1cfd('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x1cfd('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x491ee3,_0x34492d,_0x17a2ad){var _0xf1d242=_0x4cc26d[_0x1cfd('0xb')];var _0x257e61=_0x491ee3[_0x1cfd('0xc')]({'plain':!![]});if(_0x257e61[_0x1cfd('0xd')][_0x1cfd('0xe')]()==='in'||_0x257e61[_0x1cfd('0xd')][_0x1cfd('0xe')]()===_0x1cfd('0xf')&&!_0x257e61[_0x1cfd('0x10')]&&!_['isNil'](_0x257e61[_0x1cfd('0x11')])&&!_['isNil'](_0x257e61[_0x1cfd('0x12')])){_0xf1d242[_0x1cfd('0x13')][_0x1cfd('0x14')]({'where':{'id':_0x257e61[_0x1cfd('0x12')]}})[_0x1cfd('0x15')](function(_0x1695d3){if(_0x1695d3){_0x1695d3['update']({'lastMsgAt':_0x257e61[_0x1cfd('0x16')],'lastMsgDirection':_0x257e61['direction'][_0x1cfd('0xe')]()});}})[_0x1cfd('0x17')](function(_0x82883e){console['error'](_0x82883e);});}if(_0x257e61[_0x1cfd('0xd')]===_0x1cfd('0xf')&&!_0x257e61[_0x1cfd('0x10')]){var _0x5f1eac;_0xf1d242[_0x1cfd('0x18')]['find']({'where':{'id':_0x257e61[_0x1cfd('0x19')]},'raw':!![]})[_0x1cfd('0x15')](function(_0x1af7ba){_0x5f1eac=_0x1af7ba;if(_0x5f1eac&&_0x5f1eac[_0x1cfd('0x1a')]){switch(_0x5f1eac[_0x1cfd('0x1a')]){case'twilio':var _0x1a9624=require(_0x1cfd('0x1b'));if(_0x5f1eac[_0x1cfd('0x1c')]&&_0x5f1eac[_0x1cfd('0x1d')]&&_0x5f1eac[_0x1cfd('0x1e')]){var _0x470e58=new _0x1a9624(_0x5f1eac['accountSid'],_0x5f1eac[_0x1cfd('0x1d')]);_0x470e58[_0x1cfd('0x1f')]['create']({'body':_0x257e61['body'],'to':_0x257e61['phone'],'from':_0x5f1eac[_0x1cfd('0x1e')],'statusCallback':_0x5f1eac[_0x1cfd('0x20')]+_0x1cfd('0x21')+_0x257e61['id']+'/status?token='+_0x5f1eac[_0x1cfd('0x22')]})[_0x1cfd('0x15')](function(_0x13e6f0){if(_0x13e6f0[_0x1cfd('0x23')]){return _0x491ee3[_0x1cfd('0x24')]({'messageId':_0x13e6f0['sid']});}})['catch'](function(_0x511408){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),'twilio',util['inspect'](_0x511408,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x1cfd('0x28'):var _0x144cf9='https://api.skebby.it/API/v1.0/REST/';if(_0x5f1eac['username']&&_0x5f1eac[_0x1cfd('0x29')]){var _0x3c48c8={'recipient':[_0x257e61[_0x1cfd('0x1e')]],'message':_0x257e61[_0x1cfd('0x2a')],'message_type':_0x5f1eac[_0x1cfd('0x2b')]};if(_0x5f1eac[_0x1cfd('0x2b')]&&_0x5f1eac[_0x1cfd('0x2b')]!=='SI'){_0x3c48c8[_0x1cfd('0x2c')]=_0x5f1eac[_0x1cfd('0x1e')];}var _0xaf0fb3={'url':_0x144cf9+'login?username='+_0x5f1eac[_0x1cfd('0x2d')]+_0x1cfd('0x2e')+_0x5f1eac[_0x1cfd('0x29')],'method':_0x1cfd('0x2f')};rp(_0xaf0fb3)[_0x1cfd('0x15')](function(_0x2a9499){var _0xac7fac=_0x2a9499['split'](';');var _0x35ea75={'user_key':_0xac7fac[0x0],'session_key':_0xac7fac[0x1]};_0xaf0fb3={'url':_0x144cf9+'sms','method':_0x1cfd('0x30'),'headers':{'user_key':_0x35ea75[_0x1cfd('0x31')],'Session_key':_0x35ea75[_0x1cfd('0x32')]},'json':!![],'body':_0x3c48c8};return rp(_0xaf0fb3);})[_0x1cfd('0x15')](function(_0x5ab825){if(_0x5ab825[_0x1cfd('0x33')]>=0x1){var _0x92cd69={'messageId':_0x5ab825[_0x1cfd('0x34')]};if(_0x5f1eac['smsMethod']!=='GP'||!_0x5f1eac[_0x1cfd('0x35')]){_0x92cd69[_0x1cfd('0x36')]=!![];}return _0x491ee3['update'](_0x92cd69);}else{return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x28'),util[_0x1cfd('0x37')](_0x5ab825,{'showHidden':![],'depth':null}));}})[_0x1cfd('0x17')](function(_0x2e0e8e){return logger['error'](_0x1cfd('0x27'),'afterCreate',_0x1cfd('0x28'),util[_0x1cfd('0x37')](_0x2e0e8e,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x28'),_0x1cfd('0x38'));}break;case'connectel':if(_0x5f1eac[_0x1cfd('0x1d')]){var _0x47d170={'recipient':_0x257e61[_0x1cfd('0x1e')],'message':_0x257e61[_0x1cfd('0x2a')],'sender':_0x5f1eac[_0x1cfd('0x39')]||_0x5f1eac[_0x1cfd('0x1e')],'authorization':_0x5f1eac[_0x1cfd('0x1d')]};var _0x34492d={'method':_0x1cfd('0x30'),'uri':_0x1cfd('0x3a'),'body':_0x47d170,'json':!![]};rp(_0x34492d)[_0x1cfd('0x15')](function(_0x500846){var _0x340f05={'messageId':_0x500846['requestid']};if(!_0x5f1eac[_0x1cfd('0x35')]){_0x340f05[_0x1cfd('0x36')]=!![];}return _0x491ee3[_0x1cfd('0x24')](_0x340f05);})['catch'](function(_0x2724cc){logger[_0x1cfd('0x26')](_0x1cfd('0x27'),'afterCreate',_0x1cfd('0x3b'),util[_0x1cfd('0x37')](_0x2724cc,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x1cfd('0x3c'):if(_0x5f1eac['username']&&_0x5f1eac[_0x1cfd('0x29')]){var _0x47d170={'messages':[{'source':_0x1cfd('0x3d'),'to':_0x257e61['phone'],'body':_0x257e61[_0x1cfd('0x2a')],'from':_0x5f1eac[_0x1cfd('0x39')]||_0x5f1eac['phone']}]};var _0x56cfa9=util[_0x1cfd('0x3e')](_0x1cfd('0x3f'),_0x5f1eac[_0x1cfd('0x2d')],_0x5f1eac[_0x1cfd('0x29')]);var _0x34492d={'method':_0x1cfd('0x30'),'uri':_0x1cfd('0x40'),'body':_0x47d170,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x56cfa9)[_0x1cfd('0x41')](_0x1cfd('0x42')))},'json':!![]};rp(_0x34492d)[_0x1cfd('0x15')](function(_0x224ca5){if(_0x224ca5['http_code']>=0xc8&&_0x224ca5[_0x1cfd('0x43')]<=0xce){if(_0x224ca5['data']&&_0x224ca5[_0x1cfd('0x44')]['queued_count']>0x0){var _0x26b834=_[_0x1cfd('0x45')](_0x224ca5[_0x1cfd('0x44')][_0x1cfd('0x1f')]);var _0x4447ab={'messageId':_0x26b834['message_id']};if(!_0x5f1eac[_0x1cfd('0x35')]){_0x4447ab['read']=!![];}return _0x491ee3[_0x1cfd('0x24')](_0x4447ab);}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),_0x1cfd('0x46'),util[_0x1cfd('0x37')](_0x224ca5,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x1cfd('0x27'),_0x1cfd('0x25'),'clickSend',util[_0x1cfd('0x37')](_0x224ca5,{'showHidden':![],'depth':null}));}})[_0x1cfd('0x17')](function(_0xc822b5){logger[_0x1cfd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),_0x1cfd('0x46'),util[_0x1cfd('0x37')](_0xc822b5,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),_0x1cfd('0x46'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1cfd('0x47'):if(_0x5f1eac[_0x1cfd('0x48')]&&_0x5f1eac['authToken']){var _0x47d170={'dst':_0x257e61[_0x1cfd('0x1e')],'text':_0x257e61['body'],'src':_0x5f1eac[_0x1cfd('0x39')]||_0x5f1eac[_0x1cfd('0x1e')],'url':_0x5f1eac[_0x1cfd('0x20')]+_0x1cfd('0x21')+_0x257e61['id']+'/status?token='+_0x5f1eac[_0x1cfd('0x22')]};var _0x56cfa9=util[_0x1cfd('0x3e')](_0x1cfd('0x3f'),_0x5f1eac[_0x1cfd('0x48')],_0x5f1eac['authToken']);var _0x34492d={'method':_0x1cfd('0x30'),'uri':util[_0x1cfd('0x3e')]('https://api.plivo.com/v1/Account/%s/Message/',_0x5f1eac[_0x1cfd('0x48')]),'body':_0x47d170,'headers':{'Authorization':util[_0x1cfd('0x3e')]('Basic\x20%s',new Buffer(_0x56cfa9)[_0x1cfd('0x41')](_0x1cfd('0x42')))},'json':!![]};rp(_0x34492d)[_0x1cfd('0x15')](function(_0x39e9a1){var _0x48a167={'messageId':_0x39e9a1[_0x1cfd('0x49')][0x0]};return _0x491ee3[_0x1cfd('0x24')](_0x48a167);})[_0x1cfd('0x17')](function(_0xf3a3e6){logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x47'),util[_0x1cfd('0x37')](_0xf3a3e6,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),'afterCreate',_0x1cfd('0x47'),_0x1cfd('0x4a'));}break;case _0x1cfd('0x4b'):if(_0x5f1eac[_0x1cfd('0x2d')]&&_0x5f1eac[_0x1cfd('0x29')]){if(_0x5f1eac[_0x1cfd('0x4c')]){var _0x5b78fa={'method':_0x1cfd('0x30'),'uri':_0x5f1eac[_0x1cfd('0x4c')]+_0x1cfd('0x4d'),'body':{'username':_0x5f1eac[_0x1cfd('0x2d')],'password':_0x5f1eac[_0x1cfd('0x29')]},'json':!![]};return rp(_0x5b78fa)[_0x1cfd('0x15')](function(_0xef3251){var _0x18408a={'method':_0x1cfd('0x30'),'uri':_0x5f1eac[_0x1cfd('0x4c')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x5f1eac[_0x1cfd('0x1e')],'destinations':[{'to':_0x257e61['phone']}],'text':_0x257e61[_0x1cfd('0x2a')],'notifyUrl':_0x5f1eac[_0x1cfd('0x20')]+_0x1cfd('0x21')+_0x257e61['id']+_0x1cfd('0x4e')+_0x5f1eac[_0x1cfd('0x22')],'notifyContentType':'application/json','callbackData':_0x5f1eac[_0x1cfd('0x1e')]+';'+_0x257e61['body']}]},'headers':{'Authorization':_0x1cfd('0x4f')+_0xef3251[_0x1cfd('0x22')]},'json':!![]};return rp(_0x18408a)['then'](function(_0x166459){if(_0x166459[_0x1cfd('0x1f')]){var _0x4bbd00={'messageId':_0x166459[_0x1cfd('0x1f')][0x0][_0x1cfd('0x50')]};if(!_0x5f1eac['deliveryReport']){_0x4bbd00[_0x1cfd('0x36')]=!![];}return _0x491ee3['update'](_0x4bbd00);}else{return logger['error'](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x4b'),util['inspect'](_0x166459,{'showHidden':![],'depth':null}));}});})[_0x1cfd('0x17')](function(_0x2d150c){return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),'infobip',util[_0x1cfd('0x37')](_0x2d150c,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),'infobip',_0x1cfd('0x51'));}}else{logger[_0x1cfd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),_0x1cfd('0x4b'),_0x1cfd('0x38'));}break;case'csc':var _0x136509=require(_0x1cfd('0x52'));if(_0x5f1eac[_0x1cfd('0x53')]){var _0x3dc8bc={};_0x3dc8bc[_0x1cfd('0x54')]=_0x5f1eac['username'];_0x3dc8bc[_0x1cfd('0x1e')]=_0x257e61[_0x1cfd('0x1e')];_0x3dc8bc[_0x1cfd('0x2c')]=_0x5f1eac['phone'];_0x3dc8bc[_0x1cfd('0x55')]=_0x257e61[_0x1cfd('0x2a')];_0x3dc8bc['timestamp']=+new Date();var _0x225100='';var _0x36c035='';var _0x2d4a61=Object[_0x1cfd('0x56')](_0x3dc8bc);_0x2d4a61[_0x1cfd('0x57')]();for(var _0x1e03a3=0x0;_0x1e03a3<_0x2d4a61['length'];_0x1e03a3++){if(_0x225100!=''){_0x225100+='&';}_0x225100+=_0x2d4a61[_0x1e03a3]+'='+encodeURIComponent(_0x3dc8bc[_0x2d4a61[_0x1e03a3]]);_0x36c035+=_0x3dc8bc[_0x2d4a61[_0x1e03a3]];}_0x36c035+=_0x5f1eac[_0x1cfd('0x53')];_0x36c035=_0x136509['createHash'](_0x1cfd('0x58'))[_0x1cfd('0x24')](_0x36c035)[_0x1cfd('0x59')](_0x1cfd('0x5a'));if(_0x225100!==''){_0x225100+='&';}_0x225100+=_0x1cfd('0x5b')+_0x36c035;var _0xaf0fb3={'method':_0x1cfd('0x2f'),'uri':_0x5f1eac[_0x1cfd('0x4c')]+_0x1cfd('0x5c')+_0x225100,'json':!![]};return rp(_0xaf0fb3)[_0x1cfd('0x15')](function(_0x345604){var _0x16f3c2=Object[_0x1cfd('0x56')](_0x345604);if(_0x345604[_0x16f3c2[0x0]][_0x1cfd('0x26')]&&parseInt(_0x345604[_0x16f3c2[0x0]][_0x1cfd('0x26')])===0x0){var _0x3e5568={'messageId':_0x345604[_0x16f3c2[0x0]][_0x1cfd('0x5d')]};if(!_0x5f1eac[_0x1cfd('0x35')]){_0x3e5568[_0x1cfd('0x36')]=!![];}return _0x491ee3[_0x1cfd('0x24')](_0x3e5568);}else{return logger['error'](_0x1cfd('0x27'),'afterCreate','csc',util[_0x1cfd('0x37')](_0x345604[_0x1cfd('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x2bdb39){return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),'csc',util[_0x1cfd('0x37')](_0x2bdb39,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),'csc',_0x1cfd('0x5e'));}break;case _0x1cfd('0x5f'):if(_0x5f1eac['apiKey']){var _0x2dbc9e={'method':_0x1cfd('0x30'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x5f1eac[_0x1cfd('0x53')]},'body':{'content':_0x257e61[_0x1cfd('0x2a')],'to':[_0x257e61[_0x1cfd('0x1e')]],'from':_0x5f1eac[_0x1cfd('0x1e')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2dbc9e)[_0x1cfd('0x15')](function(_0x19992c){if(!_0x19992c[_0x1cfd('0x26')]){var _0xef2762={'messageId':_0x19992c['messages'][0x0]['apiMessageId']};if(!_0x5f1eac[_0x1cfd('0x35')]){_0xef2762['read']=!![];}return _0x491ee3['update'](_0xef2762);}else{return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x5f'),util[_0x1cfd('0x37')](_0x19992c[_0x1cfd('0x26')],{'showHidden':![],'depth':null}));}})[_0x1cfd('0x17')](function(_0x4a6e8d){return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),'clickatell',util[_0x1cfd('0x37')](_0x4a6e8d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x5f'),_0x1cfd('0x5e'));}break;case _0x1cfd('0x60'):if(_0x5f1eac[_0x1cfd('0x2d')]&&_0x5f1eac[_0x1cfd('0x29')]){var _0x56cfa9=util[_0x1cfd('0x3e')](_0x1cfd('0x3f'),_0x5f1eac[_0x1cfd('0x2d')],_0x5f1eac[_0x1cfd('0x29')]);var _0x34492d={'method':_0x1cfd('0x30'),'uri':_0x1cfd('0x61')+_0x5f1eac[_0x1cfd('0x62')]+'/messages','body':{'to':[_0x257e61[_0x1cfd('0x1e')]],'text':_0x257e61['body'],'from':_0x5f1eac[_0x1cfd('0x1e')],'applicationId':_0x5f1eac[_0x1cfd('0x63')]},'headers':{'Authorization':util[_0x1cfd('0x3e')]('Basic\x20%s',new Buffer(_0x56cfa9)['toString'](_0x1cfd('0x42')))},'json':!![]};rp(_0x34492d)[_0x1cfd('0x15')](function(_0x1f2a06){if(_0x1f2a06['id']){var _0x5381a9={'messageId':_0x1f2a06['id']};return _0x491ee3['update'](_0x5381a9);}else{logger['error'](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x60'),util['inspect'](_0x1f2a06,{'showHidden':![],'depth':null}));}})['catch'](function(_0x485b17){logger[_0x1cfd('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1cfd('0x25'),_0x1cfd('0x60'),util['inspect'](_0x485b17,{'showHidden':![],'depth':null}));});}else{logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x60'),_0x1cfd('0x38'));}break;case _0x1cfd('0x64'):if(_0x5f1eac[_0x1cfd('0x53')]){var _0x3c58bd={};var _0xaf0fb3={'method':'POST','uri':_0x1cfd('0x65'),'headers':{'Authorization':_0x1cfd('0x66')+_0x5f1eac['apiKey'],'Content-Type':_0x1cfd('0x67')},'body':{'from':_0x5f1eac['phone'],'to':_0x257e61['phone'],'text':_0x257e61[_0x1cfd('0x2a')]},'json':!![]};return rp(_0xaf0fb3)[_0x1cfd('0x15')](function(_0x2e80f3){if(_0x2e80f3['code']==0xca){_0x3c58bd[_0x1cfd('0x68')]=_0x2e80f3;var _0xbdaad0={'method':'POST','uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x5f1eac['apiKey'],'Content-Type':'application/json'},'body':{'refid':_0x3c58bd[_0x1cfd('0x68')][_0x1cfd('0x69')]},'json':!![]};return rp(_0xbdaad0)['then'](function(_0x290620){_0x3c58bd['status']=_0x290620;var _0x4d71a4={'messageId':_0x3c58bd[_0x1cfd('0x68')][_0x1cfd('0x69')],'read':!![]};return _0x491ee3[_0x1cfd('0x24')](_0x4d71a4);});}else{return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x64'),util[_0x1cfd('0x37')](_0x2e80f3,{'showHidden':![],'depth':null}));}})[_0x1cfd('0x17')](function(_0x5e9702){return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),_0x1cfd('0x25'),_0x1cfd('0x64'),util[_0x1cfd('0x37')](_0x5e9702,{'showHidden':![],'depth':null}));});}else{return logger[_0x1cfd('0x26')](_0x1cfd('0x27'),'afterCreate',_0x1cfd('0x64'),'Token\x20not\x20received');}break;}}})[_0x1cfd('0x6a')](function(){_0x17a2ad();});}else{_0x17a2ad();}}},'charset':_0x1cfd('0x6b'),'collate':_0x1cfd('0x6c')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 2ac9ef9..3cc5d3f 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 _0x1192=['then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','debug','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','./smsMessage.socket','request'];(function(_0x3ea84c,_0x3b2d0c){var _0x3826ce=function(_0x1a8ed5){while(--_0x1a8ed5){_0x3ea84c['push'](_0x3ea84c['shift']());}};_0x3826ce(++_0x3b2d0c);}(_0x1192,0x9d));var _0x2119=function(_0x37a4cc,_0x1531a8){_0x37a4cc=_0x37a4cc-0x0;var _0x4ffbbf=_0x1192[_0x37a4cc];return _0x4ffbbf;};'use strict';var _=require(_0x2119('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2119('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2119('0x2'))['db'];var utils=require(_0x2119('0x3'));var logger=require(_0x2119('0x4'))(_0x2119('0x5'));var config=require(_0x2119('0x6'));var jayson=require(_0x2119('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x2119('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2119('0x8')]));require(_0x2119('0x9'))['register'](socket);function respondWithRpcPromise(_0x1ff1dc,_0x4f2fde,_0x55f1b4){return new BPromise(function(_0x107a07,_0x5bff06){return client[_0x2119('0xa')](_0x1ff1dc,_0x55f1b4)[_0x2119('0xb')](function(_0x396d06){logger[_0x2119('0xc')](_0x2119('0xd'),_0x4f2fde,'request\x20sent');logger['debug'](_0x2119('0xe'),_0x4f2fde,_0x2119('0xf'),JSON[_0x2119('0x10')](_0x396d06));if(_0x396d06[_0x2119('0x11')]){if(_0x396d06[_0x2119('0x11')][_0x2119('0x12')]===0x1f4){logger['error'](_0x2119('0xd'),_0x4f2fde,_0x396d06['error'][_0x2119('0x13')]);return _0x5bff06(_0x396d06[_0x2119('0x11')][_0x2119('0x13')]);}logger[_0x2119('0x11')](_0x2119('0xd'),_0x4f2fde,_0x396d06['error'][_0x2119('0x13')]);return _0x107a07(_0x396d06[_0x2119('0x11')][_0x2119('0x13')]);}else{logger[_0x2119('0xc')](_0x2119('0xd'),_0x4f2fde,_0x2119('0xf'));_0x107a07(_0x396d06[_0x2119('0x14')][_0x2119('0x13')]);}})[_0x2119('0x15')](function(_0x49af43){logger[_0x2119('0x11')]('SmsMessage,\x20%s,\x20%s',_0x4f2fde,_0x49af43);_0x5bff06(_0x49af43);});});}exports[_0x2119('0x16')]=function(_0x1c535f){var _0x15f026=this;return new Promise(function(_0x396a05,_0x2c9f75){return db[_0x2119('0x17')][_0x2119('0x18')](_0x1c535f[_0x2119('0x19')],{'raw':_0x1c535f['options']?_0x1c535f[_0x2119('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x2119('0xb')](function(_0x4d9d7b){logger[_0x2119('0xc')](_0x2119('0x16'),_0x1c535f);logger[_0x2119('0x1b')](_0x2119('0x16'),_0x1c535f,JSON[_0x2119('0x10')](_0x4d9d7b));_0x396a05(_0x4d9d7b);})[_0x2119('0x15')](function(_0x1c9594){logger[_0x2119('0x11')](_0x2119('0x16'),_0x1c9594[_0x2119('0x13')],_0x1c535f);_0x2c9f75(_0x15f026[_0x2119('0x11')](0x1f4,_0x1c9594['message']));});});}; \ No newline at end of file +var _0xb956=['jayson/promise','client','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0xb956,0xfe));var _0x6b95=function(_0x3eed3f,_0x5253b5){_0x3eed3f=_0x3eed3f-0x0;var _0xd68fd8=_0xb956[_0x3eed3f];return _0xd68fd8;};'use strict';var _=require(_0x6b95('0x0'));var util=require('util');var moment=require(_0x6b95('0x1'));var BPromise=require(_0x6b95('0x2'));var rs=require(_0x6b95('0x3'));var fs=require('fs');var Redis=require(_0x6b95('0x4'));var db=require(_0x6b95('0x5'))['db'];var utils=require(_0x6b95('0x6'));var logger=require(_0x6b95('0x7'))(_0x6b95('0x8'));var config=require(_0x6b95('0x9'));var jayson=require(_0x6b95('0xa'));var client=jayson[_0x6b95('0xb')]['http']({'port':0x232a});config[_0x6b95('0xc')]=_['defaults'](config[_0x6b95('0xc')],{'host':_0x6b95('0xd'),'port':0x18eb});var socket=require(_0x6b95('0xe'))(new Redis(config[_0x6b95('0xc')]));require(_0x6b95('0xf'))['register'](socket);function respondWithRpcPromise(_0x4733e6,_0x552a2b,_0x2612c0){return new BPromise(function(_0x3f2a69,_0x23b7ec){return client[_0x6b95('0x10')](_0x4733e6,_0x2612c0)[_0x6b95('0x11')](function(_0x3f8cde){logger[_0x6b95('0x12')](_0x6b95('0x13'),_0x552a2b,_0x6b95('0x14'));logger['debug'](_0x6b95('0x15'),_0x552a2b,_0x6b95('0x14'),JSON[_0x6b95('0x16')](_0x3f8cde));if(_0x3f8cde[_0x6b95('0x17')]){if(_0x3f8cde[_0x6b95('0x17')][_0x6b95('0x18')]===0x1f4){logger[_0x6b95('0x17')](_0x6b95('0x13'),_0x552a2b,_0x3f8cde[_0x6b95('0x17')][_0x6b95('0x19')]);return _0x23b7ec(_0x3f8cde['error'][_0x6b95('0x19')]);}logger[_0x6b95('0x17')](_0x6b95('0x13'),_0x552a2b,_0x3f8cde['error'][_0x6b95('0x19')]);return _0x3f2a69(_0x3f8cde[_0x6b95('0x17')][_0x6b95('0x19')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x552a2b,_0x6b95('0x14'));_0x3f2a69(_0x3f8cde[_0x6b95('0x1a')][_0x6b95('0x19')]);}})[_0x6b95('0x1b')](function(_0x301786){logger[_0x6b95('0x17')]('SmsMessage,\x20%s,\x20%s',_0x552a2b,_0x301786);_0x23b7ec(_0x301786);});});}exports[_0x6b95('0x1c')]=function(_0x1a4627){var _0x4f0482=this;return new Promise(function(_0x1be11e,_0x5a936b){return db['SmsMessage'][_0x6b95('0x1d')](_0x1a4627[_0x6b95('0x1e')],{'raw':_0x1a4627[_0x6b95('0x1f')]?_0x1a4627[_0x6b95('0x1f')][_0x6b95('0x20')]===undefined?!![]:![]:!![]})[_0x6b95('0x11')](function(_0x534192){logger[_0x6b95('0x12')]('CreateSmsMessage',_0x1a4627);logger['debug'](_0x6b95('0x1c'),_0x1a4627,JSON['stringify'](_0x534192));_0x1be11e(_0x534192);})[_0x6b95('0x1b')](function(_0x24ba68){logger[_0x6b95('0x17')]('CreateSmsMessage',_0x24ba68[_0x6b95('0x19')],_0x1a4627);_0x5a936b(_0x4f0482[_0x6b95('0x17')](0x1f4,_0x24ba68[_0x6b95('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 54618dc..a412c8e 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 _0x1eed=['emit','removeListener','register','length','smsMessage:','save','remove','update'];(function(_0x5b48ea,_0x10b0d1){var _0x2b9222=function(_0x14f737){while(--_0x14f737){_0x5b48ea['push'](_0x5b48ea['shift']());}};_0x2b9222(++_0x10b0d1);}(_0x1eed,0x1b5));var _0xd1ee=function(_0x22182f,_0x2bad5d){_0x22182f=_0x22182f-0x0;var _0x276276=_0x1eed[_0x22182f];return _0x276276;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xd1ee('0x0'),_0xd1ee('0x1'),_0xd1ee('0x2')];function createListener(_0x138321,_0x19999d){return function(_0x2b7194){_0x19999d[_0xd1ee('0x3')](_0x138321,_0x2b7194);};}function removeListener(_0x506a6f,_0x2b4f2f){return function(){SmsMessageEvents[_0xd1ee('0x4')](_0x506a6f,_0x2b4f2f);};}exports[_0xd1ee('0x5')]=function(_0xf0361){for(var _0x1abdf5=0x0,_0x4fd403=events[_0xd1ee('0x6')];_0x1abdf5<_0x4fd403;_0x1abdf5++){var _0x28a605=events[_0x1abdf5];var _0x1ff674=createListener(_0xd1ee('0x7')+_0x28a605,_0xf0361);SmsMessageEvents['on'](_0x28a605,_0x1ff674);}}; \ No newline at end of file +var _0xb9dc=['update','emit','length','smsMessage:','./smsMessage.events','save'];(function(_0xd14aa5,_0x31e7d2){var _0x43498d=function(_0xd33b30){while(--_0xd33b30){_0xd14aa5['push'](_0xd14aa5['shift']());}};_0x43498d(++_0x31e7d2);}(_0xb9dc,0x94));var _0xcb9d=function(_0x4d2497,_0x51326e){_0x4d2497=_0x4d2497-0x0;var _0x2e3958=_0xb9dc[_0x4d2497];return _0x2e3958;};'use strict';var SmsMessageEvents=require(_0xcb9d('0x0'));var events=[_0xcb9d('0x1'),'remove',_0xcb9d('0x2')];function createListener(_0x27202d,_0x5b0afa){return function(_0x174abe){_0x5b0afa[_0xcb9d('0x3')](_0x27202d,_0x174abe);};}function removeListener(_0x330903,_0x3e5ede){return function(){SmsMessageEvents['removeListener'](_0x330903,_0x3e5ede);};}exports['register']=function(_0x21981b){for(var _0x352cd6=0x0,_0x152d44=events[_0xcb9d('0x4')];_0x352cd6<_0x152d44;_0x352cd6++){var _0x16bc52=events[_0x352cd6];var _0x32c4fc=createListener(_0xcb9d('0x5')+_0x16bc52,_0x21981b);SmsMessageEvents['on'](_0x16bc52,_0x32c4fc);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 579f4cc..3aab588 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 _0xb002=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x368576,_0x2d15f6){var _0x43169e=function(_0xf18cc5){while(--_0xf18cc5){_0x368576['push'](_0x368576['shift']());}};_0x43169e(++_0x2d15f6);}(_0xb002,0xbc));var _0x2b00=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb002[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x2b00('0x0'));var util=require(_0x2b00('0x1'));var path=require(_0x2b00('0x2'));var timeout=require(_0x2b00('0x3'));var express=require(_0x2b00('0x4'));var router=express[_0x2b00('0x5')]();var fs_extra=require(_0x2b00('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2b00('0x7'));var config=require(_0x2b00('0x8'));var controller=require(_0x2b00('0x9'));router[_0x2b00('0xa')]('/',auth[_0x2b00('0xb')](),controller[_0x2b00('0xc')]);router[_0x2b00('0xa')](_0x2b00('0xd'),auth[_0x2b00('0xb')](),controller[_0x2b00('0xe')]);router['get'](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x10')]);router[_0x2b00('0xa')](_0x2b00('0x11'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x12')]);router['get'](_0x2b00('0x13'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x14')]);router['get'](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller['getAgents']);router[_0x2b00('0x16')]('/',auth[_0x2b00('0xb')](),controller[_0x2b00('0x17')]);router[_0x2b00('0x16')]('/:id/teams',auth['isAuthenticated'](),controller['addTeams']);router[_0x2b00('0x16')](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x18')]);router[_0x2b00('0x19')](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller[_0x2b00('0x1a')]);router[_0x2b00('0x1b')](_0x2b00('0xf'),auth[_0x2b00('0xb')](),controller['destroy']);router['delete'](_0x2b00('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x2b00('0x1b')](_0x2b00('0x15'),auth[_0x2b00('0xb')](),controller['removeAgents']);module[_0x2b00('0x1c')]=router; \ No newline at end of file +var _0x505e=['/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addTeams'];(function(_0x108de9,_0x59c896){var _0x3038af=function(_0x417e23){while(--_0x417e23){_0x108de9['push'](_0x108de9['shift']());}};_0x3038af(++_0x59c896);}(_0x505e,0x77));var _0xe505=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0x505e[_0x236c89];return _0x3b2a15;};'use strict';var multer=require(_0xe505('0x0'));var util=require(_0xe505('0x1'));var path=require('path');var timeout=require(_0xe505('0x2'));var express=require(_0xe505('0x3'));var router=express['Router']();var fs_extra=require(_0xe505('0x4'));var auth=require(_0xe505('0x5'));var interaction=require(_0xe505('0x6'));var config=require(_0xe505('0x7'));var controller=require(_0xe505('0x8'));router[_0xe505('0x9')]('/',auth[_0xe505('0xa')](),controller[_0xe505('0xb')]);router['get']('/describe',auth[_0xe505('0xa')](),controller['describe']);router['get'](_0xe505('0xc'),auth[_0xe505('0xa')](),controller[_0xe505('0xd')]);router[_0xe505('0x9')](_0xe505('0xe'),auth['isAuthenticated'](),controller[_0xe505('0xf')]);router[_0xe505('0x9')](_0xe505('0x10'),auth[_0xe505('0xa')](),controller['getTeams']);router[_0xe505('0x9')]('/:id/users',auth[_0xe505('0xa')](),controller[_0xe505('0x11')]);router[_0xe505('0x12')]('/',auth[_0xe505('0xa')](),controller[_0xe505('0x13')]);router[_0xe505('0x12')]('/:id/teams',auth[_0xe505('0xa')](),controller[_0xe505('0x14')]);router[_0xe505('0x12')](_0xe505('0x15'),auth[_0xe505('0xa')](),controller[_0xe505('0x16')]);router[_0xe505('0x17')]('/:id',auth[_0xe505('0xa')](),controller['update']);router[_0xe505('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xe505('0x19')]);router['delete'](_0xe505('0x10'),auth[_0xe505('0xa')](),controller[_0xe505('0x1a')]);router[_0xe505('0x18')](_0xe505('0x15'),auth[_0xe505('0xa')](),controller[_0xe505('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 7010749..fbe17f6 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 _0x706f=['roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x337627,_0x5f0682){var _0x1457ed=function(_0x1aab34){while(--_0x1aab34){_0x337627['push'](_0x337627['shift']());}};_0x1457ed(++_0x5f0682);}(_0x706f,0x1bd));var _0xf706=function(_0x5bfb92,_0x54a474){_0x5bfb92=_0x5bfb92-0x0;var _0x19e5fa=_0x706f[_0x5bfb92];return _0x19e5fa;};'use strict';var Sequelize=require(_0xf706('0x0'));module['exports']={'name':{'type':Sequelize[_0xf706('0x1')],'unique':_0xf706('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf706('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf706('0x3')](_0xf706('0x4'),'beepall',_0xf706('0x5'))}}; \ No newline at end of file +var _0x377d=['exports','STRING','name','rrmemory','roundrobin','sequelize'];(function(_0x2bbe62,_0x5f2657){var _0x16c209=function(_0x51820e){while(--_0x51820e){_0x2bbe62['push'](_0x2bbe62['shift']());}};_0x16c209(++_0x5f2657);}(_0x377d,0x185));var _0xd377=function(_0x5cd087,_0x157b58){_0x5cd087=_0x5cd087-0x0;var _0x4fc315=_0x377d[_0x5cd087];return _0x4fc315;};'use strict';var Sequelize=require(_0xd377('0x0'));module[_0xd377('0x1')]={'name':{'type':Sequelize[_0xd377('0x2')],'unique':_0xd377('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd377('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd377('0x4'),'beepall',_0xd377('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fa81ecf..acfff26 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 _0xd11c=['reject','update','then','destroy','get','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','SmsQueues','UserProfileSection','userProfileId','UserProfileResource','body','describe','findOne','UserSmsQueue','pick','SmsQueueId','findAndCountAll','smsPause','updatedAt','format','%s/%s','getTeams','Team','addTeams','User','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userSmsQueue:save','ids','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','apply'];(function(_0x29631f,_0xdb767){var _0x486d87=function(_0x33a1bb){while(--_0x33a1bb){_0x29631f['push'](_0x29631f['shift']());}};_0x486d87(++_0xdb767);}(_0xd11c,0x64));var _0xcd11=function(_0x220e36,_0x416c65){_0x220e36=_0x220e36-0x0;var _0x404680=_0xd11c[_0x220e36];return _0x404680;};'use strict';var emlformat=require(_0xcd11('0x0'));var rimraf=require(_0xcd11('0x1'));var zipdir=require(_0xcd11('0x2'));var jsonpatch=require(_0xcd11('0x3'));var rp=require('request-promise');var moment=require(_0xcd11('0x4'));var BPromise=require(_0xcd11('0x5'));var Mustache=require('mustache');var util=require(_0xcd11('0x6'));var path=require('path');var sox=require(_0xcd11('0x7'));var csv=require(_0xcd11('0x8'));var ejs=require(_0xcd11('0x9'));var fs=require('fs');var fs_extra=require(_0xcd11('0xa'));var _=require('lodash');var squel=require(_0xcd11('0xb'));var crypto=require(_0xcd11('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcd11('0xd'));var authService=require(_0xcd11('0xe'));var qs=require(_0xcd11('0xf'));var as=require(_0xcd11('0x10'));var hardwareService=require(_0xcd11('0x11'));var logger=require(_0xcd11('0x12'))(_0xcd11('0x13'));var utils=require(_0xcd11('0x14'));var config=require(_0xcd11('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xcd11('0x16')]=_[_0xcd11('0x17')](config[_0xcd11('0x16')],{'host':_0xcd11('0x18'),'port':0x18eb});var socket=require(_0xcd11('0x19'))(new Redis(config[_0xcd11('0x16')]));require('./smsQueue.socket')[_0xcd11('0x1a')](socket);function respondWithStatusCode(_0xc2072b,_0x4eac50){_0x4eac50=_0x4eac50||0xcc;return function(_0x1adf86){if(_0x1adf86){return _0xc2072b[_0xcd11('0x1b')](_0x4eac50);}return _0xc2072b[_0xcd11('0x1c')](_0x4eac50)[_0xcd11('0x1d')]();};}function respondWithResult(_0x48d514,_0x472754){_0x472754=_0x472754||0xc8;return function(_0x1de35f){if(_0x1de35f){return _0x48d514['status'](_0x472754)[_0xcd11('0x1e')](_0x1de35f);}};}function respondWithFilteredResult(_0x34bc1c,_0x5219ba){return function(_0x404948){if(_0x404948){var _0xf32d94=typeof _0x5219ba[_0xcd11('0x1f')]===_0xcd11('0x20')&&typeof _0x5219ba['limit']===_0xcd11('0x20');var _0x12e9b6=_0x404948[_0xcd11('0x21')];var _0x3587ca=_0xf32d94?0x0:_0x5219ba[_0xcd11('0x1f')];var _0x31ad3b=_0xf32d94?_0x404948['count']:_0x5219ba[_0xcd11('0x1f')]+_0x5219ba[_0xcd11('0x22')];var _0x3f0b36;if(_0x31ad3b>=_0x12e9b6){_0x31ad3b=_0x12e9b6;_0x3f0b36=0xc8;}else{_0x3f0b36=0xce;}_0x34bc1c[_0xcd11('0x1c')](_0x3f0b36);return _0x34bc1c[_0xcd11('0x23')]('Content-Range',_0x3587ca+'-'+_0x31ad3b+'/'+_0x12e9b6)[_0xcd11('0x1e')](_0x404948);}return null;};}function patchUpdates(_0x584070){return function(_0x293a13){try{jsonpatch[_0xcd11('0x24')](_0x293a13,_0x584070,!![]);}catch(_0x3b4850){return BPromise[_0xcd11('0x25')](_0x3b4850);}return _0x293a13['save']();};}function saveUpdates(_0x2bd1d8,_0x598483){return function(_0xe32181){if(_0xe32181){return _0xe32181[_0xcd11('0x26')](_0x2bd1d8)[_0xcd11('0x27')](function(_0x4166a2){return _0x4166a2;});}return null;};}function removeEntity(_0x5ce02c,_0x230f27){return function(_0x59585b){if(_0x59585b){return _0x59585b[_0xcd11('0x28')]()[_0xcd11('0x27')](function(){var _0x47820d=_0x59585b[_0xcd11('0x29')]({'plain':!![]});var _0x1387a0='SmsQueues';return db['UserProfileResource'][_0xcd11('0x28')]({'where':{'type':_0x1387a0,'resourceId':_0x47820d['id']}})[_0xcd11('0x27')](function(){return _0x59585b;});})[_0xcd11('0x27')](function(){_0x5ce02c['status'](0xcc)[_0xcd11('0x1d')]();});}};}function handleEntityNotFound(_0xbdda18,_0x4cbf62){return function(_0xfe86d3){if(!_0xfe86d3){_0xbdda18['sendStatus'](0x194);}return _0xfe86d3;};}function handleError(_0x1809f1,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x2e4b2e){logger[_0xcd11('0x2a')](_0x2e4b2e[_0xcd11('0x2b')]);if(_0x2e4b2e[_0xcd11('0x2c')]){delete _0x2e4b2e[_0xcd11('0x2c')];}_0x1809f1[_0xcd11('0x1c')](_0x3a0145)[_0xcd11('0x2d')](_0x2e4b2e);};}exports[_0xcd11('0x2e')]=function(_0x3030fc,_0x1fa23b){var _0x3eaf20={},_0x11bfc0={},_0x35a354={'count':0x0,'rows':[]};var _0x43e7bc=_[_0xcd11('0x2f')](db[_0xcd11('0x30')][_0xcd11('0x31')],function(_0x51160c){return{'name':_0x51160c[_0xcd11('0x32')],'type':_0x51160c[_0xcd11('0x33')][_0xcd11('0x34')]};});_0x11bfc0[_0xcd11('0x35')]=_[_0xcd11('0x2f')](_0x43e7bc,_0xcd11('0x2c'));_0x11bfc0[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x3030fc[_0xcd11('0x36')]);_0x11bfc0[_0xcd11('0x38')]=_[_0xcd11('0x39')](_0x11bfc0[_0xcd11('0x35')],_0x11bfc0[_0xcd11('0x36')]);_0x3eaf20[_0xcd11('0x3a')]=_[_0xcd11('0x39')](_0x11bfc0[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x3b')]));_0x3eaf20[_0xcd11('0x3a')]=_0x3eaf20[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x3eaf20['attributes']:_0x11bfc0['model'];if(!_0x3030fc['query'][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x3eaf20[_0xcd11('0x22')]=qs['limit'](_0x3030fc['query']['limit']);_0x3eaf20['offset']=qs[_0xcd11('0x1f')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x1f')]);}_0x3eaf20[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x3030fc[_0xcd11('0x36')][_0xcd11('0x40')]);_0x3eaf20[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_['pick'](_0x3030fc[_0xcd11('0x36')],_0x11bfc0[_0xcd11('0x38')]),_0x43e7bc);if(_0x3030fc[_0xcd11('0x36')][_0xcd11('0x42')]){_0x3eaf20[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x3eaf20[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x43e7bc,function(_0x2eb9d4){if(_0x2eb9d4['type']!=='VIRTUAL'){var _0x346683={};_0x346683[_0x2eb9d4[_0xcd11('0x2c')]]={'$like':'%'+_0x3030fc[_0xcd11('0x36')]['filter']+'%'};return _0x346683;}})});}_0x3eaf20=_[_0xcd11('0x43')]({},_0x3eaf20,_0x3030fc[_0xcd11('0x44')]);var _0x182b50={'where':_0x3eaf20[_0xcd11('0x41')]};return db[_0xcd11('0x30')][_0xcd11('0x21')](_0x182b50)[_0xcd11('0x27')](function(_0x2c4e86){_0x35a354['count']=_0x2c4e86;if(_0x3030fc[_0xcd11('0x36')][_0xcd11('0x45')]){_0x3eaf20[_0xcd11('0x46')]=[{'all':!![]}];}return db['SmsQueue'][_0xcd11('0x47')](_0x3eaf20);})[_0xcd11('0x27')](function(_0x48e855){_0x35a354[_0xcd11('0x48')]=_0x48e855;return _0x35a354;})['then'](respondWithFilteredResult(_0x1fa23b,_0x3eaf20))[_0xcd11('0x49')](handleError(_0x1fa23b,null));};exports[_0xcd11('0x4a')]=function(_0x59ce8c,_0x853ef1){var _0xd6ac3a={'raw':!![],'where':{'id':_0x59ce8c[_0xcd11('0x4b')]['id']}},_0xe53d52={};_0xe53d52[_0xcd11('0x35')]=_[_0xcd11('0x37')](db[_0xcd11('0x30')][_0xcd11('0x31')]);_0xe53d52[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x59ce8c[_0xcd11('0x36')]);_0xe53d52[_0xcd11('0x38')]=_[_0xcd11('0x39')](_0xe53d52[_0xcd11('0x35')],_0xe53d52[_0xcd11('0x36')]);_0xd6ac3a['attributes']=_[_0xcd11('0x39')](_0xe53d52[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x59ce8c[_0xcd11('0x36')]['fields']));_0xd6ac3a['attributes']=_0xd6ac3a['attributes'][_0xcd11('0x3c')]?_0xd6ac3a[_0xcd11('0x3a')]:_0xe53d52['model'];if(_0x59ce8c[_0xcd11('0x36')][_0xcd11('0x45')]){_0xd6ac3a[_0xcd11('0x46')]=[{'all':!![]}];}_0xd6ac3a=_['merge']({},_0xd6ac3a,_0x59ce8c[_0xcd11('0x44')]);return db[_0xcd11('0x30')][_0xcd11('0x4c')](_0xd6ac3a)[_0xcd11('0x27')](handleEntityNotFound(_0x853ef1,null))[_0xcd11('0x27')](respondWithResult(_0x853ef1,null))[_0xcd11('0x49')](handleError(_0x853ef1,null));};exports[_0xcd11('0x4d')]=function(_0x3607f4,_0x4c506f){return db[_0xcd11('0x30')][_0xcd11('0x4d')](_0x3607f4['body'],{})['then'](function(_0x3a37f0){var _0x70692d=_0x3607f4['user'][_0xcd11('0x29')]({'plain':!![]});if(!_0x70692d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x70692d[_0xcd11('0x4e')]===_0xcd11('0x4f')){var _0x5ad84f=_0x3a37f0[_0xcd11('0x29')]({'plain':!![]});var _0x4280c5=_0xcd11('0x50');return db[_0xcd11('0x51')][_0xcd11('0x4c')]({'where':{'name':_0x4280c5,'userProfileId':_0x70692d[_0xcd11('0x52')]},'raw':!![]})[_0xcd11('0x27')](function(_0x3c673d){if(_0x3c673d&&_0x3c673d['autoAssociation']===0x0){return db[_0xcd11('0x53')][_0xcd11('0x4d')]({'name':_0x5ad84f['name'],'resourceId':_0x5ad84f['id'],'type':_0x3c673d[_0xcd11('0x2c')],'sectionId':_0x3c673d['id']},{})[_0xcd11('0x27')](function(){return _0x3a37f0;});}else{return _0x3a37f0;}})['catch'](function(_0x309e4c){logger[_0xcd11('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x309e4c);throw _0x309e4c;});}return _0x3a37f0;})[_0xcd11('0x27')](respondWithResult(_0x4c506f,0xc9))['catch'](handleError(_0x4c506f,null));};exports['update']=function(_0x186da1,_0x37765b){if(_0x186da1[_0xcd11('0x54')]['id']){delete _0x186da1[_0xcd11('0x54')]['id'];}return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x186da1[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x37765b,null))[_0xcd11('0x27')](saveUpdates(_0x186da1['body'],null))['then'](respondWithResult(_0x37765b,null))[_0xcd11('0x49')](handleError(_0x37765b,null));};exports['destroy']=function(_0x120290,_0x1c2e7c){return db[_0xcd11('0x30')][_0xcd11('0x4c')]({'where':{'id':_0x120290[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x1c2e7c,null))[_0xcd11('0x27')](removeEntity(_0x1c2e7c,null))['catch'](handleError(_0x1c2e7c,null));};exports['describe']=function(_0x3aaf50,_0x1a9e4e){return db[_0xcd11('0x30')][_0xcd11('0x55')]()['then'](respondWithResult(_0x1a9e4e,null))[_0xcd11('0x49')](handleError(_0x1a9e4e,null));};exports['getMembers']=function(_0x3fbf9a,_0x167c25,_0x12b4a0){var _0x1f3b20={'raw':!![],'where':{}},_0x5ec37d={},_0x24d889;return db['SmsQueue'][_0xcd11('0x56')]({'where':{'id':_0x3fbf9a['params']['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x167c25,null))[_0xcd11('0x27')](function(_0x19d3b6){if(_0x19d3b6){_0x24d889=_0x19d3b6[_0xcd11('0x29')]({'plain':!![]});_0x5ec37d['model']=_[_0xcd11('0x37')](db[_0xcd11('0x57')]['rawAttributes']);_0x5ec37d[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x3fbf9a[_0xcd11('0x36')]);_0x5ec37d['filters']=_['intersection'](_0x5ec37d[_0xcd11('0x35')],_0x5ec37d['query']);_0x1f3b20[_0xcd11('0x3a')]=_[_0xcd11('0x39')](_0x5ec37d[_0xcd11('0x35')],qs['fields'](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x3b')]));_0x1f3b20['attributes']=_0x1f3b20[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x1f3b20['attributes']:_0x5ec37d['model'];if(!_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x1f3b20[_0xcd11('0x22')]=qs['limit'](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x22')]);_0x1f3b20[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x1f')]);}_0x1f3b20[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x3fbf9a['query'][_0xcd11('0x40')]);_0x1f3b20[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x3fbf9a[_0xcd11('0x36')],_0x5ec37d[_0xcd11('0x38')]));_0x1f3b20[_0xcd11('0x41')][_0xcd11('0x59')]=_0x19d3b6['id'];if(_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x42')]){_0x1f3b20[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x1f3b20[_0xcd11('0x41')],{'$or':_['map'](_0x1f3b20[_0xcd11('0x3a')],function(_0x30c15c){var _0x4ed29e={};_0x4ed29e[_0x30c15c]={'$like':'%'+_0x3fbf9a[_0xcd11('0x36')][_0xcd11('0x42')]+'%'};return _0x4ed29e;})});}_0x1f3b20=_[_0xcd11('0x43')]({},_0x1f3b20,_0x3fbf9a['options']);return db[_0xcd11('0x57')][_0xcd11('0x47')](_0x1f3b20);}})[_0xcd11('0x27')](function(_0x1bc744){if(_0x1bc744){return db['User'][_0xcd11('0x5a')]({'where':{'id':_[_0xcd11('0x2f')](_0x1bc744,'UserId'),'role':'agent'},'attributes':['id',_0xcd11('0x2c'),_0xcd11('0x5b'),_0xcd11('0x5c'),'createdAt']});}})[_0xcd11('0x27')](function(_0x379fe2){if(_0x379fe2){return{'count':_0x379fe2[_0xcd11('0x21')],'rows':_[_0xcd11('0x2f')](_0x379fe2[_0xcd11('0x48')],function(_0x18abf5){return{'membername':_0x18abf5[_0xcd11('0x2c')],'UserId':_0x18abf5['id'],'queue_name':_0x24d889['name'],'SmsQueueId':_0x24d889['id'],'interface':util[_0xcd11('0x5d')](_0xcd11('0x5e'),'SIP',_0x18abf5[_0xcd11('0x2c')]),'penalty':0x0,'paused':_0x18abf5[_0xcd11('0x5b')],'createdAt':_0x18abf5['createdAt'],'updatedAt':_0x18abf5[_0xcd11('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcd11('0x27')](respondWithFilteredResult(_0x167c25,_0x1f3b20))[_0xcd11('0x49')](handleError(_0x167c25,null));};exports[_0xcd11('0x5f')]=function(_0x4d521a,_0x293485,_0x11ec9f){var _0x4ddc07={};var _0x10c248={};var _0x38e5bb;var _0x70f609;return db[_0xcd11('0x30')][_0xcd11('0x56')]({'where':{'id':_0x4d521a[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x293485,null))[_0xcd11('0x27')](function(_0x263466){if(_0x263466){_0x38e5bb=_0x263466;_0x10c248[_0xcd11('0x35')]=_['keys'](db[_0xcd11('0x60')][_0xcd11('0x31')]);_0x10c248[_0xcd11('0x36')]=_[_0xcd11('0x37')](_0x4d521a[_0xcd11('0x36')]);_0x10c248['filters']=_[_0xcd11('0x39')](_0x10c248[_0xcd11('0x35')],_0x10c248[_0xcd11('0x36')]);_0x4ddc07['attributes']=_[_0xcd11('0x39')](_0x10c248[_0xcd11('0x35')],qs[_0xcd11('0x3b')](_0x4d521a['query'][_0xcd11('0x3b')]));_0x4ddc07[_0xcd11('0x3a')]=_0x4ddc07[_0xcd11('0x3a')][_0xcd11('0x3c')]?_0x4ddc07[_0xcd11('0x3a')]:_0x10c248[_0xcd11('0x35')];_0x4ddc07[_0xcd11('0x3f')]=qs['sort'](_0x4d521a[_0xcd11('0x36')][_0xcd11('0x40')]);_0x4ddc07[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x4d521a[_0xcd11('0x36')],_0x10c248[_0xcd11('0x38')]));if(_0x4d521a['query'][_0xcd11('0x42')]){_0x4ddc07[_0xcd11('0x41')]=_[_0xcd11('0x43')](_0x4ddc07[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x4ddc07[_0xcd11('0x3a')],function(_0x1cd68b){var _0x18a72f={};_0x18a72f[_0x1cd68b]={'$like':'%'+_0x4d521a[_0xcd11('0x36')]['filter']+'%'};return _0x18a72f;})});}_0x4ddc07=_[_0xcd11('0x43')]({},_0x4ddc07,_0x4d521a[_0xcd11('0x44')]);return _0x38e5bb[_0xcd11('0x5f')](_0x4ddc07);}})[_0xcd11('0x27')](function(_0x133c35){if(_0x133c35){_0x70f609=_0x133c35[_0xcd11('0x3c')];if(!_0x4d521a['query'][_0xcd11('0x3d')](_0xcd11('0x3e'))){_0x4ddc07[_0xcd11('0x22')]=qs['limit'](_0x4d521a['query'][_0xcd11('0x22')]);_0x4ddc07[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x4d521a[_0xcd11('0x36')][_0xcd11('0x1f')]);}return _0x38e5bb['getTeams'](_0x4ddc07);}})[_0xcd11('0x27')](function(_0x102b0c){if(_0x102b0c){return _0x102b0c?{'count':_0x70f609,'rows':_0x102b0c}:null;}})[_0xcd11('0x27')](respondWithResult(_0x293485,null))['catch'](handleError(_0x293485,null));};exports[_0xcd11('0x61')]=function(_0x272226,_0x5beaa8,_0x4250e9){var _0x505464=_0x272226[_0xcd11('0x54')]['ids'];return db[_0xcd11('0x60')][_0xcd11('0x47')]({'where':{'id':_0x505464},'attributes':['id'],'include':[{'model':db[_0xcd11('0x62')],'as':'Agents','attributes':['id','name',_0xcd11('0x63'),_0xcd11('0x64'),_0xcd11('0x65')],'raw':!![]}]})['then'](function(_0x1dff32){if(_0x1dff32){var _0x213d7f=_[_0xcd11('0x66')](_0x1dff32,function(_0x8f76bb){var _0x3554d1=_0x8f76bb['get']({'plain':!![]});return _0x3554d1['Agents'];});return db[_0xcd11('0x30')][_0xcd11('0x4c')]({'where':{'id':_0x272226[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](function(_0x55b488){return db[_0xcd11('0x67')][_0xcd11('0x68')](function(_0x3f4e36){return _0x55b488['addTeams'](_0x505464,{'transaction':_0x3f4e36})[_0xcd11('0x27')](function(){return BPromise[_0xcd11('0x69')](_0x213d7f,function(_0x4ba7a2){return db[_0xcd11('0x57')][_0xcd11('0x6a')]({'where':{'UserId':_0x4ba7a2['id'],'SmsQueueId':_0x272226[_0xcd11('0x4b')]['id']},'transaction':_0x3f4e36});});})[_0xcd11('0x27')](function(){_0x213d7f[_0xcd11('0x6b')](function(_0x43aa0c){socket['emit'](_0xcd11('0x6c'),{'UserId':_0x43aa0c['id'],'SmsQueueId':_0x55b488['id']});});});});});}})[_0xcd11('0x27')](respondWithStatusCode(_0x5beaa8,null))['catch'](handleError(_0x5beaa8,null));};exports['removeTeams']=function(_0x3b981d,_0x1a7c30,_0x373d0e){return db[_0xcd11('0x60')][_0xcd11('0x47')]({'where':{'id':_0x3b981d['query'][_0xcd11('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xcd11('0x27')](handleEntityNotFound(_0x1a7c30,null))[_0xcd11('0x27')](function(_0x38dbbd){var _0x2b139b=_['map'](_0x38dbbd,'id');var _0xaa904b=[];var _0x31865c=[];var _0x50c7b4=squel['select']();_0x50c7b4[_0xcd11('0x6e')](_0xcd11('0x6f'))[_0xcd11('0x70')](_0xcd11('0x71'),'tq')[_0xcd11('0x72')](_0xcd11('0x73'),'ut',_0xcd11('0x74'))[_0xcd11('0x41')]('SmsQueueId\x20=\x20?',_0x3b981d[_0xcd11('0x4b')]['id']);for(var _0x23c0f1=0x0;_0x23c0f1<_0x38dbbd[_0xcd11('0x3c')];_0x23c0f1+=0x1){let _0x34f2ba=_0x38dbbd[_0x23c0f1];for(var _0xeba205=0x0;_0xeba205<_0x34f2ba[_0xcd11('0x75')]['length'];_0xeba205+=0x1){let _0x1084f7=_0x34f2ba[_0xcd11('0x75')][_0xeba205];var _0x138535=_0x50c7b4['clone']();_0x138535['where'](_0xcd11('0x76'),_0x1084f7['id']);_0x31865c[_0xcd11('0x77')](db[_0xcd11('0x67')][_0xcd11('0x36')](_0x138535['toString'](),{'type':db[_0xcd11('0x67')][_0xcd11('0x78')][_0xcd11('0x79')]})['then'](function(_0x55bf4c){if(_0x55bf4c[_0xcd11('0x3c')]===0x1){return _0x1084f7['id'];}else{var _0x53d6f1=_[_0xcd11('0x7a')](_[_0xcd11('0x2f')](_0x55bf4c,_0xcd11('0x7b')),function(_0x24e142){return _['includes'](_0x2b139b,_0x24e142);});if(_0x53d6f1){return _0x1084f7['id'];}}}));}}return BPromise[_0xcd11('0x7c')](_0x31865c)[_0xcd11('0x27')](function(_0x5ebdea){_0xaa904b=_(_0xaa904b)[_0xcd11('0x7d')](_0x5ebdea)[_0xcd11('0x7e')]()[_0xcd11('0x7f')]();return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x3b981d['params']['id']}})[_0xcd11('0x27')](function(_0x3b9aed){return db[_0xcd11('0x67')][_0xcd11('0x68')](function(_0x4d1d59){return _0x3b9aed['removeTeams'](_0x3b981d[_0xcd11('0x36')][_0xcd11('0x6d')],{'transaction':_0x4d1d59})[_0xcd11('0x27')](function(){if(!_[_0xcd11('0x80')](_0xaa904b)){return _0x3b9aed[_0xcd11('0x81')](_0xaa904b,{'transaction':_0x4d1d59});}})[_0xcd11('0x27')](function(){_0xaa904b[_0xcd11('0x6b')](function(_0x3f32f2){socket['emit'](_0xcd11('0x82'),{'UserId':_0x3f32f2,'SmsQueueId':_0x3b9aed['id']});});});});});});})['then'](respondWithStatusCode(_0x1a7c30,null))['catch'](handleError(_0x1a7c30,null));};exports[_0xcd11('0x83')]=function(_0x154e5d,_0x5002b6,_0x372ac8){return db['SmsQueue'][_0xcd11('0x4c')]({'where':{'id':_0x154e5d[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x5002b6,null))[_0xcd11('0x27')](function(_0x19b074){if(_0x19b074){return _0x19b074[_0xcd11('0x83')](_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')],_[_0xcd11('0x84')](_0x154e5d[_0xcd11('0x54')],[_0xcd11('0x6d'),'id'])||{})[_0xcd11('0x85')](function(_0x251215){for(var _0x10e85e=0x0;_0x10e85e<_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')][_0xcd11('0x3c')];_0x10e85e+=0x1){socket[_0xcd11('0x86')](_0xcd11('0x6c'),{'UserId':Number(_0x154e5d[_0xcd11('0x54')][_0xcd11('0x6d')][_0x10e85e]),'SmsQueueId':Number(_0x154e5d[_0xcd11('0x4b')]['id'])});}return _0x251215;});}})[_0xcd11('0x27')](respondWithResult(_0x5002b6,null))[_0xcd11('0x49')](handleError(_0x5002b6,null));};exports[_0xcd11('0x81')]=function(_0x2ade4d,_0x1295cd,_0x29d625){return db[_0xcd11('0x30')]['find']({'where':{'id':_0x2ade4d[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x1295cd,null))[_0xcd11('0x27')](function(_0x559718){if(_0x559718){return _0x559718['removeAgents'](_0x2ade4d[_0xcd11('0x36')]['ids'])[_0xcd11('0x27')](function(){if(_[_0xcd11('0x87')](_0x2ade4d['query']['ids'])){for(var _0x4e0919=0x0;_0x4e0919<_0x2ade4d[_0xcd11('0x36')][_0xcd11('0x6d')]['length'];_0x4e0919+=0x1){socket[_0xcd11('0x86')]('userSmsQueue:remove',{'UserId':Number(_0x2ade4d[_0xcd11('0x36')]['ids'][_0x4e0919]),'SmsQueueId':Number(_0x2ade4d[_0xcd11('0x4b')]['id'])});}}else{socket[_0xcd11('0x86')](_0xcd11('0x82'),{'UserId':Number(_0x2ade4d[_0xcd11('0x36')]['ids']),'SmsQueueId':Number(_0x2ade4d[_0xcd11('0x4b')]['id'])});}});}})[_0xcd11('0x27')](respondWithStatusCode(_0x1295cd,null))[_0xcd11('0x49')](handleError(_0x1295cd,null));};exports['getAgents']=function(_0x23f788,_0x28f63f,_0x59451d){var _0x242981={};var _0x5b23c0={};var _0x4f41b5;var _0x3779eb;return db[_0xcd11('0x30')][_0xcd11('0x56')]({'where':{'id':_0x23f788[_0xcd11('0x4b')]['id']}})[_0xcd11('0x27')](handleEntityNotFound(_0x28f63f,null))[_0xcd11('0x27')](function(_0x5d6b2c){if(_0x5d6b2c){_0x4f41b5=_0x5d6b2c;_0x5b23c0[_0xcd11('0x35')]=_[_0xcd11('0x37')](db[_0xcd11('0x62')][_0xcd11('0x31')]);_0x5b23c0['query']=_[_0xcd11('0x37')](_0x23f788[_0xcd11('0x36')]);_0x5b23c0[_0xcd11('0x38')]=_['intersection'](_0x5b23c0[_0xcd11('0x35')],_0x5b23c0[_0xcd11('0x36')]);_0x242981['attributes']=_[_0xcd11('0x39')](_0x5b23c0['model'],qs[_0xcd11('0x3b')](_0x23f788['query'][_0xcd11('0x3b')]));_0x242981[_0xcd11('0x3a')]=_0x242981['attributes']['length']?_0x242981['attributes']:_0x5b23c0[_0xcd11('0x35')];_0x242981[_0xcd11('0x3f')]=qs[_0xcd11('0x40')](_0x23f788[_0xcd11('0x36')][_0xcd11('0x40')]);_0x242981[_0xcd11('0x41')]=qs[_0xcd11('0x38')](_[_0xcd11('0x58')](_0x23f788['query'],_0x5b23c0['filters']));if(_0x23f788[_0xcd11('0x36')][_0xcd11('0x42')]){_0x242981['where']=_[_0xcd11('0x43')](_0x242981[_0xcd11('0x41')],{'$or':_[_0xcd11('0x2f')](_0x242981[_0xcd11('0x3a')],function(_0x13afb2){var _0x1c279f={};_0x1c279f[_0x13afb2]={'$like':'%'+_0x23f788[_0xcd11('0x36')][_0xcd11('0x42')]+'%'};return _0x1c279f;})});}_0x242981=_[_0xcd11('0x43')]({},_0x242981,_0x23f788[_0xcd11('0x44')]);return _0x4f41b5['getAgents'](_0x242981);}})[_0xcd11('0x27')](function(_0x2c5f68){if(_0x2c5f68){_0x3779eb=_0x2c5f68['length'];if(!_0x23f788[_0xcd11('0x36')][_0xcd11('0x3d')]('nolimit')){_0x242981['limit']=qs[_0xcd11('0x22')](_0x23f788[_0xcd11('0x36')][_0xcd11('0x22')]);_0x242981[_0xcd11('0x1f')]=qs[_0xcd11('0x1f')](_0x23f788['query'][_0xcd11('0x1f')]);}return _0x4f41b5[_0xcd11('0x88')](_0x242981);}})[_0xcd11('0x27')](function(_0x5d96bb){if(_0x5d96bb){return _0x5d96bb?{'count':_0x3779eb,'rows':_0x5d96bb}:null;}})['then'](respondWithResult(_0x28f63f,null))[_0xcd11('0x49')](handleError(_0x28f63f,null));}; \ No newline at end of file +var _0x6b23=['to-csv','fs-extra','squel','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','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','SmsQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','filter','merge','type','VIRTUAL','options','SmsQueue','includeAll','rows','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','UserSmsQueue','sort','pick','SmsQueueId','findAll','findAndCountAll','UserId','smsPause','updatedAt','%s/%s','createdAt','getTeams','findOne','Team','order','addTeams','User','Agents','voicePause','interface','sequelize','transaction','findOrCreate','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT','union','value','ids','isEmpty','removeAgents','forEach','addAgents','omit','isArray','userSmsQueue:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','path'];(function(_0x1baf2e,_0x3d79ad){var _0x408e52=function(_0x4bcbca){while(--_0x4bcbca){_0x1baf2e['push'](_0x1baf2e['shift']());}};_0x408e52(++_0x3d79ad);}(_0x6b23,0x102));var _0x36b2=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x6b23[_0x2283dc];return _0x16db90;};'use strict';var emlformat=require(_0x36b2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x36b2('0x1'));var rp=require(_0x36b2('0x2'));var moment=require(_0x36b2('0x3'));var BPromise=require(_0x36b2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x36b2('0x5'));var sox=require('sox');var csv=require(_0x36b2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36b2('0x7'));var _=require('lodash');var squel=require(_0x36b2('0x8'));var crypto=require('crypto');var jsforce=require(_0x36b2('0x9'));var deskjs=require(_0x36b2('0xa'));var toCsv=require(_0x36b2('0x6'));var querystring=require(_0x36b2('0xb'));var Papa=require('papaparse');var Redis=require(_0x36b2('0xc'));var authService=require(_0x36b2('0xd'));var qs=require(_0x36b2('0xe'));var as=require(_0x36b2('0xf'));var hardwareService=require(_0x36b2('0x10'));var logger=require('../../config/logger')(_0x36b2('0x11'));var utils=require(_0x36b2('0x12'));var config=require(_0x36b2('0x13'));var licenseUtil=require(_0x36b2('0x14'));var db=require(_0x36b2('0x15'))['db'];config[_0x36b2('0x16')]=_[_0x36b2('0x17')](config[_0x36b2('0x16')],{'host':_0x36b2('0x18'),'port':0x18eb});var socket=require(_0x36b2('0x19'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x36b2('0x1a')](socket);function respondWithStatusCode(_0xbc7244,_0x90913b){_0x90913b=_0x90913b||0xcc;return function(_0x4a6cda){if(_0x4a6cda){return _0xbc7244[_0x36b2('0x1b')](_0x90913b);}return _0xbc7244[_0x36b2('0x1c')](_0x90913b)[_0x36b2('0x1d')]();};}function respondWithResult(_0x4421fb,_0x193c17){_0x193c17=_0x193c17||0xc8;return function(_0x3e90a4){if(_0x3e90a4){return _0x4421fb[_0x36b2('0x1c')](_0x193c17)[_0x36b2('0x1e')](_0x3e90a4);}};}function respondWithFilteredResult(_0x554730,_0x18d618){return function(_0x529801){if(_0x529801){var _0x5ef9ac=typeof _0x18d618[_0x36b2('0x1f')]===_0x36b2('0x20')&&typeof _0x18d618[_0x36b2('0x21')]===_0x36b2('0x20');var _0x4ce106=_0x529801[_0x36b2('0x22')];var _0x55ee77=_0x5ef9ac?0x0:_0x18d618[_0x36b2('0x1f')];var _0x399c2f=_0x5ef9ac?_0x529801[_0x36b2('0x22')]:_0x18d618[_0x36b2('0x1f')]+_0x18d618['limit'];var _0x45949e;if(_0x399c2f>=_0x4ce106){_0x399c2f=_0x4ce106;_0x45949e=0xc8;}else{_0x45949e=0xce;}_0x554730[_0x36b2('0x1c')](_0x45949e);return _0x554730[_0x36b2('0x23')](_0x36b2('0x24'),_0x55ee77+'-'+_0x399c2f+'/'+_0x4ce106)['json'](_0x529801);}return null;};}function patchUpdates(_0x26720a){return function(_0x297fff){try{jsonpatch[_0x36b2('0x25')](_0x297fff,_0x26720a,!![]);}catch(_0x44bb0c){return BPromise['reject'](_0x44bb0c);}return _0x297fff['save']();};}function saveUpdates(_0x20723d,_0x52ccc9){return function(_0x1a87fa){if(_0x1a87fa){return _0x1a87fa[_0x36b2('0x26')](_0x20723d)[_0x36b2('0x27')](function(_0x5c0c1f){return _0x5c0c1f;});}return null;};}function removeEntity(_0x51f5f3,_0x2301ac){return function(_0x4ab3dc){if(_0x4ab3dc){return _0x4ab3dc['destroy']()[_0x36b2('0x27')](function(){var _0x127453=_0x4ab3dc[_0x36b2('0x28')]({'plain':!![]});var _0x360f17=_0x36b2('0x29');return db[_0x36b2('0x2a')][_0x36b2('0x2b')]({'where':{'type':_0x360f17,'resourceId':_0x127453['id']}})['then'](function(){return _0x4ab3dc;});})['then'](function(){_0x51f5f3[_0x36b2('0x1c')](0xcc)[_0x36b2('0x1d')]();});}};}function handleEntityNotFound(_0x143f01,_0x333024){return function(_0x1f2f5c){if(!_0x1f2f5c){_0x143f01['sendStatus'](0x194);}return _0x1f2f5c;};}function handleError(_0x252c3c,_0xee7aaf){_0xee7aaf=_0xee7aaf||0x1f4;return function(_0x1b147f){logger[_0x36b2('0x2c')](_0x1b147f[_0x36b2('0x2d')]);if(_0x1b147f[_0x36b2('0x2e')]){delete _0x1b147f[_0x36b2('0x2e')];}_0x252c3c[_0x36b2('0x1c')](_0xee7aaf)[_0x36b2('0x2f')](_0x1b147f);};}exports[_0x36b2('0x30')]=function(_0x4855eb,_0x5066f2){var _0x1cb67d={},_0x2b3e51={},_0x10c73d={'count':0x0,'rows':[]};var _0x32eebf=_[_0x36b2('0x31')](db['SmsQueue'][_0x36b2('0x32')],function(_0x38121a){return{'name':_0x38121a[_0x36b2('0x33')],'type':_0x38121a['type']['key']};});_0x2b3e51[_0x36b2('0x34')]=_[_0x36b2('0x31')](_0x32eebf,'name');_0x2b3e51[_0x36b2('0x35')]=_[_0x36b2('0x36')](_0x4855eb[_0x36b2('0x35')]);_0x2b3e51['filters']=_[_0x36b2('0x37')](_0x2b3e51[_0x36b2('0x34')],_0x2b3e51['query']);_0x1cb67d[_0x36b2('0x38')]=_['intersection'](_0x2b3e51[_0x36b2('0x34')],qs[_0x36b2('0x39')](_0x4855eb[_0x36b2('0x35')][_0x36b2('0x39')]));_0x1cb67d[_0x36b2('0x38')]=_0x1cb67d['attributes']['length']?_0x1cb67d['attributes']:_0x2b3e51[_0x36b2('0x34')];if(!_0x4855eb[_0x36b2('0x35')][_0x36b2('0x3a')](_0x36b2('0x3b'))){_0x1cb67d[_0x36b2('0x21')]=qs[_0x36b2('0x21')](_0x4855eb[_0x36b2('0x35')][_0x36b2('0x21')]);_0x1cb67d['offset']=qs[_0x36b2('0x1f')](_0x4855eb['query']['offset']);}_0x1cb67d['order']=qs['sort'](_0x4855eb[_0x36b2('0x35')]['sort']);_0x1cb67d[_0x36b2('0x3c')]=qs[_0x36b2('0x3d')](_['pick'](_0x4855eb['query'],_0x2b3e51['filters']),_0x32eebf);if(_0x4855eb[_0x36b2('0x35')][_0x36b2('0x3e')]){_0x1cb67d[_0x36b2('0x3c')]=_[_0x36b2('0x3f')](_0x1cb67d[_0x36b2('0x3c')],{'$or':_[_0x36b2('0x31')](_0x32eebf,function(_0x18a615){if(_0x18a615[_0x36b2('0x40')]!==_0x36b2('0x41')){var _0xfdfb5f={};_0xfdfb5f[_0x18a615[_0x36b2('0x2e')]]={'$like':'%'+_0x4855eb[_0x36b2('0x35')][_0x36b2('0x3e')]+'%'};return _0xfdfb5f;}})});}_0x1cb67d=_[_0x36b2('0x3f')]({},_0x1cb67d,_0x4855eb[_0x36b2('0x42')]);var _0x12b7a4={'where':_0x1cb67d[_0x36b2('0x3c')]};return db[_0x36b2('0x43')][_0x36b2('0x22')](_0x12b7a4)['then'](function(_0x4440b8){_0x10c73d[_0x36b2('0x22')]=_0x4440b8;if(_0x4855eb[_0x36b2('0x35')][_0x36b2('0x44')]){_0x1cb67d['include']=[{'all':!![]}];}return db[_0x36b2('0x43')]['findAll'](_0x1cb67d);})[_0x36b2('0x27')](function(_0x29ab07){_0x10c73d[_0x36b2('0x45')]=_0x29ab07;return _0x10c73d;})[_0x36b2('0x27')](respondWithFilteredResult(_0x5066f2,_0x1cb67d))['catch'](handleError(_0x5066f2,null));};exports[_0x36b2('0x46')]=function(_0x39ee75,_0x15649d){var _0x494c74={'raw':!![],'where':{'id':_0x39ee75['params']['id']}},_0x230d82={};_0x230d82[_0x36b2('0x34')]=_['keys'](db['SmsQueue']['rawAttributes']);_0x230d82[_0x36b2('0x35')]=_[_0x36b2('0x36')](_0x39ee75[_0x36b2('0x35')]);_0x230d82[_0x36b2('0x3d')]=_['intersection'](_0x230d82[_0x36b2('0x34')],_0x230d82[_0x36b2('0x35')]);_0x494c74['attributes']=_[_0x36b2('0x37')](_0x230d82[_0x36b2('0x34')],qs[_0x36b2('0x39')](_0x39ee75[_0x36b2('0x35')][_0x36b2('0x39')]));_0x494c74[_0x36b2('0x38')]=_0x494c74[_0x36b2('0x38')][_0x36b2('0x47')]?_0x494c74[_0x36b2('0x38')]:_0x230d82[_0x36b2('0x34')];if(_0x39ee75[_0x36b2('0x35')][_0x36b2('0x44')]){_0x494c74['include']=[{'all':!![]}];}_0x494c74=_['merge']({},_0x494c74,_0x39ee75[_0x36b2('0x42')]);return db[_0x36b2('0x43')][_0x36b2('0x48')](_0x494c74)[_0x36b2('0x27')](handleEntityNotFound(_0x15649d,null))[_0x36b2('0x27')](respondWithResult(_0x15649d,null))[_0x36b2('0x49')](handleError(_0x15649d,null));};exports[_0x36b2('0x4a')]=function(_0x3ceec3,_0x2c6781){return db[_0x36b2('0x43')][_0x36b2('0x4a')](_0x3ceec3[_0x36b2('0x4b')],{})[_0x36b2('0x27')](function(_0x1b4ba5){var _0xa86990=_0x3ceec3[_0x36b2('0x4c')]['get']({'plain':!![]});if(!_0xa86990)throw new Error(_0x36b2('0x4d'));if(_0xa86990[_0x36b2('0x4e')]===_0x36b2('0x4c')){var _0x35ac5f=_0x1b4ba5['get']({'plain':!![]});var _0x32e1a9=_0x36b2('0x29');return db[_0x36b2('0x4f')]['find']({'where':{'name':_0x32e1a9,'userProfileId':_0xa86990['userProfileId']},'raw':!![]})[_0x36b2('0x27')](function(_0x3bc30c){if(_0x3bc30c&&_0x3bc30c['autoAssociation']===0x0){return db[_0x36b2('0x2a')][_0x36b2('0x4a')]({'name':_0x35ac5f[_0x36b2('0x2e')],'resourceId':_0x35ac5f['id'],'type':_0x3bc30c['name'],'sectionId':_0x3bc30c['id']},{})[_0x36b2('0x27')](function(){return _0x1b4ba5;});}else{return _0x1b4ba5;}})[_0x36b2('0x49')](function(_0x2baf0f){logger[_0x36b2('0x2c')](_0x36b2('0x50'),_0x2baf0f);throw _0x2baf0f;});}return _0x1b4ba5;})[_0x36b2('0x27')](respondWithResult(_0x2c6781,0xc9))[_0x36b2('0x49')](handleError(_0x2c6781,null));};exports[_0x36b2('0x26')]=function(_0x1c9b5d,_0x584ed7){if(_0x1c9b5d[_0x36b2('0x4b')]['id']){delete _0x1c9b5d[_0x36b2('0x4b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x1c9b5d[_0x36b2('0x51')]['id']}})[_0x36b2('0x27')](handleEntityNotFound(_0x584ed7,null))[_0x36b2('0x27')](saveUpdates(_0x1c9b5d[_0x36b2('0x4b')],null))[_0x36b2('0x27')](respondWithResult(_0x584ed7,null))[_0x36b2('0x49')](handleError(_0x584ed7,null));};exports['destroy']=function(_0x21ef49,_0x1ac35c){return db[_0x36b2('0x43')][_0x36b2('0x48')]({'where':{'id':_0x21ef49[_0x36b2('0x51')]['id']}})[_0x36b2('0x27')](handleEntityNotFound(_0x1ac35c,null))[_0x36b2('0x27')](removeEntity(_0x1ac35c,null))[_0x36b2('0x49')](handleError(_0x1ac35c,null));};exports[_0x36b2('0x52')]=function(_0x5e7fe1,_0x24e2e){return db['SmsQueue'][_0x36b2('0x52')]()[_0x36b2('0x27')](respondWithResult(_0x24e2e,null))[_0x36b2('0x49')](handleError(_0x24e2e,null));};exports[_0x36b2('0x53')]=function(_0x1a7f0d,_0x58973d,_0x51c649){var _0x3b7274={'raw':!![],'where':{}},_0x15e39c={},_0x31e0e9;return db[_0x36b2('0x43')]['findOne']({'where':{'id':_0x1a7f0d[_0x36b2('0x51')]['id']}})[_0x36b2('0x27')](handleEntityNotFound(_0x58973d,null))[_0x36b2('0x27')](function(_0x3f42bd){if(_0x3f42bd){_0x31e0e9=_0x3f42bd['get']({'plain':!![]});_0x15e39c[_0x36b2('0x34')]=_[_0x36b2('0x36')](db[_0x36b2('0x54')]['rawAttributes']);_0x15e39c['query']=_[_0x36b2('0x36')](_0x1a7f0d['query']);_0x15e39c[_0x36b2('0x3d')]=_[_0x36b2('0x37')](_0x15e39c[_0x36b2('0x34')],_0x15e39c[_0x36b2('0x35')]);_0x3b7274['attributes']=_[_0x36b2('0x37')](_0x15e39c[_0x36b2('0x34')],qs['fields'](_0x1a7f0d[_0x36b2('0x35')][_0x36b2('0x39')]));_0x3b7274[_0x36b2('0x38')]=_0x3b7274[_0x36b2('0x38')]['length']?_0x3b7274[_0x36b2('0x38')]:_0x15e39c[_0x36b2('0x34')];if(!_0x1a7f0d['query'][_0x36b2('0x3a')](_0x36b2('0x3b'))){_0x3b7274[_0x36b2('0x21')]=qs[_0x36b2('0x21')](_0x1a7f0d['query'][_0x36b2('0x21')]);_0x3b7274['offset']=qs['offset'](_0x1a7f0d[_0x36b2('0x35')][_0x36b2('0x1f')]);}_0x3b7274['order']=qs[_0x36b2('0x55')](_0x1a7f0d[_0x36b2('0x35')][_0x36b2('0x55')]);_0x3b7274[_0x36b2('0x3c')]=qs[_0x36b2('0x3d')](_[_0x36b2('0x56')](_0x1a7f0d['query'],_0x15e39c[_0x36b2('0x3d')]));_0x3b7274[_0x36b2('0x3c')][_0x36b2('0x57')]=_0x3f42bd['id'];if(_0x1a7f0d[_0x36b2('0x35')][_0x36b2('0x3e')]){_0x3b7274[_0x36b2('0x3c')]=_[_0x36b2('0x3f')](_0x3b7274[_0x36b2('0x3c')],{'$or':_[_0x36b2('0x31')](_0x3b7274[_0x36b2('0x38')],function(_0xbabef5){var _0x1f3094={};_0x1f3094[_0xbabef5]={'$like':'%'+_0x1a7f0d[_0x36b2('0x35')][_0x36b2('0x3e')]+'%'};return _0x1f3094;})});}_0x3b7274=_[_0x36b2('0x3f')]({},_0x3b7274,_0x1a7f0d[_0x36b2('0x42')]);return db[_0x36b2('0x54')][_0x36b2('0x58')](_0x3b7274);}})[_0x36b2('0x27')](function(_0x4ab448){if(_0x4ab448){return db['User'][_0x36b2('0x59')]({'where':{'id':_[_0x36b2('0x31')](_0x4ab448,_0x36b2('0x5a')),'role':'agent'},'attributes':['id',_0x36b2('0x2e'),_0x36b2('0x5b'),_0x36b2('0x5c'),'createdAt']});}})[_0x36b2('0x27')](function(_0x5b5d58){if(_0x5b5d58){return{'count':_0x5b5d58[_0x36b2('0x22')],'rows':_[_0x36b2('0x31')](_0x5b5d58[_0x36b2('0x45')],function(_0x2b6ed6){return{'membername':_0x2b6ed6['name'],'UserId':_0x2b6ed6['id'],'queue_name':_0x31e0e9[_0x36b2('0x2e')],'SmsQueueId':_0x31e0e9['id'],'interface':util['format'](_0x36b2('0x5d'),'SIP',_0x2b6ed6['name']),'penalty':0x0,'paused':_0x2b6ed6[_0x36b2('0x5b')],'createdAt':_0x2b6ed6[_0x36b2('0x5e')],'updatedAt':_0x2b6ed6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x36b2('0x27')](respondWithFilteredResult(_0x58973d,_0x3b7274))[_0x36b2('0x49')](handleError(_0x58973d,null));};exports[_0x36b2('0x5f')]=function(_0x37f1fa,_0xca4348,_0x5b255a){var _0x5d85e7={};var _0x42d6d1={};var _0x5a1531;var _0x4403c6;return db[_0x36b2('0x43')][_0x36b2('0x60')]({'where':{'id':_0x37f1fa[_0x36b2('0x51')]['id']}})['then'](handleEntityNotFound(_0xca4348,null))[_0x36b2('0x27')](function(_0x14b6fa){if(_0x14b6fa){_0x5a1531=_0x14b6fa;_0x42d6d1['model']=_[_0x36b2('0x36')](db[_0x36b2('0x61')][_0x36b2('0x32')]);_0x42d6d1['query']=_[_0x36b2('0x36')](_0x37f1fa[_0x36b2('0x35')]);_0x42d6d1['filters']=_[_0x36b2('0x37')](_0x42d6d1['model'],_0x42d6d1[_0x36b2('0x35')]);_0x5d85e7[_0x36b2('0x38')]=_[_0x36b2('0x37')](_0x42d6d1[_0x36b2('0x34')],qs[_0x36b2('0x39')](_0x37f1fa[_0x36b2('0x35')]['fields']));_0x5d85e7['attributes']=_0x5d85e7['attributes'][_0x36b2('0x47')]?_0x5d85e7[_0x36b2('0x38')]:_0x42d6d1[_0x36b2('0x34')];_0x5d85e7[_0x36b2('0x62')]=qs[_0x36b2('0x55')](_0x37f1fa[_0x36b2('0x35')]['sort']);_0x5d85e7[_0x36b2('0x3c')]=qs[_0x36b2('0x3d')](_[_0x36b2('0x56')](_0x37f1fa[_0x36b2('0x35')],_0x42d6d1[_0x36b2('0x3d')]));if(_0x37f1fa[_0x36b2('0x35')]['filter']){_0x5d85e7[_0x36b2('0x3c')]=_['merge'](_0x5d85e7[_0x36b2('0x3c')],{'$or':_['map'](_0x5d85e7[_0x36b2('0x38')],function(_0x102214){var _0x289fc0={};_0x289fc0[_0x102214]={'$like':'%'+_0x37f1fa['query'][_0x36b2('0x3e')]+'%'};return _0x289fc0;})});}_0x5d85e7=_[_0x36b2('0x3f')]({},_0x5d85e7,_0x37f1fa[_0x36b2('0x42')]);return _0x5a1531[_0x36b2('0x5f')](_0x5d85e7);}})[_0x36b2('0x27')](function(_0x107ed9){if(_0x107ed9){_0x4403c6=_0x107ed9[_0x36b2('0x47')];if(!_0x37f1fa[_0x36b2('0x35')][_0x36b2('0x3a')](_0x36b2('0x3b'))){_0x5d85e7[_0x36b2('0x21')]=qs[_0x36b2('0x21')](_0x37f1fa[_0x36b2('0x35')][_0x36b2('0x21')]);_0x5d85e7[_0x36b2('0x1f')]=qs['offset'](_0x37f1fa[_0x36b2('0x35')][_0x36b2('0x1f')]);}return _0x5a1531[_0x36b2('0x5f')](_0x5d85e7);}})[_0x36b2('0x27')](function(_0x412153){if(_0x412153){return _0x412153?{'count':_0x4403c6,'rows':_0x412153}:null;}})[_0x36b2('0x27')](respondWithResult(_0xca4348,null))[_0x36b2('0x49')](handleError(_0xca4348,null));};exports[_0x36b2('0x63')]=function(_0x284455,_0x7a9db3,_0x3780fd){var _0x12147c=_0x284455['body']['ids'];return db[_0x36b2('0x61')][_0x36b2('0x58')]({'where':{'id':_0x12147c},'attributes':['id'],'include':[{'model':db[_0x36b2('0x64')],'as':_0x36b2('0x65'),'attributes':['id',_0x36b2('0x2e'),'online',_0x36b2('0x66'),_0x36b2('0x67')],'raw':!![]}]})[_0x36b2('0x27')](function(_0x83e3d7){if(_0x83e3d7){var _0x2dc29d=_['flatMap'](_0x83e3d7,function(_0xdbc40f){var _0x3c467e=_0xdbc40f['get']({'plain':!![]});return _0x3c467e[_0x36b2('0x65')];});return db[_0x36b2('0x43')]['find']({'where':{'id':_0x284455[_0x36b2('0x51')]['id']}})[_0x36b2('0x27')](function(_0x16cdac){return db[_0x36b2('0x68')][_0x36b2('0x69')](function(_0x25f349){return _0x16cdac['addTeams'](_0x12147c,{'transaction':_0x25f349})[_0x36b2('0x27')](function(){return BPromise['each'](_0x2dc29d,function(_0x275ca7){return db[_0x36b2('0x54')][_0x36b2('0x6a')]({'where':{'UserId':_0x275ca7['id'],'SmsQueueId':_0x284455[_0x36b2('0x51')]['id']},'transaction':_0x25f349});});})[_0x36b2('0x27')](function(){_0x2dc29d['forEach'](function(_0x19fc3d){socket[_0x36b2('0x6b')](_0x36b2('0x6c'),{'UserId':_0x19fc3d['id'],'SmsQueueId':_0x16cdac['id']});});});});});}})[_0x36b2('0x27')](respondWithStatusCode(_0x7a9db3,null))[_0x36b2('0x49')](handleError(_0x7a9db3,null));};exports['removeTeams']=function(_0x509ecd,_0x228cf0,_0x5d6b3b){return db[_0x36b2('0x61')][_0x36b2('0x58')]({'where':{'id':_0x509ecd['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x36b2('0x64')],'as':_0x36b2('0x65'),'attributes':['id'],'raw':!![]}]})[_0x36b2('0x27')](handleEntityNotFound(_0x228cf0,null))[_0x36b2('0x27')](function(_0x1f29fe){var _0x1b5818=_[_0x36b2('0x31')](_0x1f29fe,'id');var _0x395abc=[];var _0x16d839=[];var _0x3fcb9e=squel[_0x36b2('0x6d')]();_0x3fcb9e[_0x36b2('0x6e')](_0x36b2('0x6f'))[_0x36b2('0x70')](_0x36b2('0x71'),'tq')[_0x36b2('0x72')](_0x36b2('0x73'),'ut',_0x36b2('0x74'))['where']('SmsQueueId\x20=\x20?',_0x509ecd[_0x36b2('0x51')]['id']);for(var _0x490bd6=0x0;_0x490bd6<_0x1f29fe[_0x36b2('0x47')];_0x490bd6+=0x1){let _0x2e9dac=_0x1f29fe[_0x490bd6];for(var _0x5ce713=0x0;_0x5ce713<_0x2e9dac[_0x36b2('0x65')]['length'];_0x5ce713+=0x1){let _0x16a9b4=_0x2e9dac['Agents'][_0x5ce713];var _0xcc425b=_0x3fcb9e[_0x36b2('0x75')]();_0xcc425b['where'](_0x36b2('0x76'),_0x16a9b4['id']);_0x16d839[_0x36b2('0x77')](db['sequelize'][_0x36b2('0x35')](_0xcc425b['toString'](),{'type':db[_0x36b2('0x68')]['QueryTypes'][_0x36b2('0x78')]})[_0x36b2('0x27')](function(_0x37a47a){if(_0x37a47a[_0x36b2('0x47')]===0x1){return _0x16a9b4['id'];}else{var _0x249635=_['every'](_[_0x36b2('0x31')](_0x37a47a,'TeamId'),function(_0x578a14){return _['includes'](_0x1b5818,_0x578a14);});if(_0x249635){return _0x16a9b4['id'];}}}));}}return BPromise['all'](_0x16d839)[_0x36b2('0x27')](function(_0x5d258f){_0x395abc=_(_0x395abc)[_0x36b2('0x79')](_0x5d258f)['compact']()[_0x36b2('0x7a')]();return db['SmsQueue']['find']({'where':{'id':_0x509ecd[_0x36b2('0x51')]['id']}})['then'](function(_0x4701dd){return db[_0x36b2('0x68')]['transaction'](function(_0xff7af2){return _0x4701dd['removeTeams'](_0x509ecd[_0x36b2('0x35')][_0x36b2('0x7b')],{'transaction':_0xff7af2})[_0x36b2('0x27')](function(){if(!_[_0x36b2('0x7c')](_0x395abc)){return _0x4701dd[_0x36b2('0x7d')](_0x395abc,{'transaction':_0xff7af2});}})[_0x36b2('0x27')](function(){_0x395abc[_0x36b2('0x7e')](function(_0x42564f){socket[_0x36b2('0x6b')]('userSmsQueue:remove',{'UserId':_0x42564f,'SmsQueueId':_0x4701dd['id']});});});});});});})[_0x36b2('0x27')](respondWithStatusCode(_0x228cf0,null))['catch'](handleError(_0x228cf0,null));};exports['addAgents']=function(_0x301825,_0x57b8fb,_0x20eb77){return db['SmsQueue']['find']({'where':{'id':_0x301825[_0x36b2('0x51')]['id']}})['then'](handleEntityNotFound(_0x57b8fb,null))['then'](function(_0x3e8eed){if(_0x3e8eed){return _0x3e8eed[_0x36b2('0x7f')](_0x301825[_0x36b2('0x4b')][_0x36b2('0x7b')],_[_0x36b2('0x80')](_0x301825[_0x36b2('0x4b')],[_0x36b2('0x7b'),'id'])||{})['spread'](function(_0x3afa03){for(var _0x1563bc=0x0;_0x1563bc<_0x301825[_0x36b2('0x4b')]['ids'][_0x36b2('0x47')];_0x1563bc+=0x1){socket['emit'](_0x36b2('0x6c'),{'UserId':Number(_0x301825[_0x36b2('0x4b')]['ids'][_0x1563bc]),'SmsQueueId':Number(_0x301825[_0x36b2('0x51')]['id'])});}return _0x3afa03;});}})[_0x36b2('0x27')](respondWithResult(_0x57b8fb,null))[_0x36b2('0x49')](handleError(_0x57b8fb,null));};exports[_0x36b2('0x7d')]=function(_0x190c74,_0x123426,_0x17f941){return db[_0x36b2('0x43')][_0x36b2('0x48')]({'where':{'id':_0x190c74[_0x36b2('0x51')]['id']}})[_0x36b2('0x27')](handleEntityNotFound(_0x123426,null))[_0x36b2('0x27')](function(_0x22d0c8){if(_0x22d0c8){return _0x22d0c8[_0x36b2('0x7d')](_0x190c74['query'][_0x36b2('0x7b')])[_0x36b2('0x27')](function(){if(_[_0x36b2('0x81')](_0x190c74[_0x36b2('0x35')][_0x36b2('0x7b')])){for(var _0x28ad57=0x0;_0x28ad57<_0x190c74[_0x36b2('0x35')][_0x36b2('0x7b')][_0x36b2('0x47')];_0x28ad57+=0x1){socket[_0x36b2('0x6b')](_0x36b2('0x82'),{'UserId':Number(_0x190c74[_0x36b2('0x35')][_0x36b2('0x7b')][_0x28ad57]),'SmsQueueId':Number(_0x190c74['params']['id'])});}}else{socket[_0x36b2('0x6b')](_0x36b2('0x82'),{'UserId':Number(_0x190c74[_0x36b2('0x35')][_0x36b2('0x7b')]),'SmsQueueId':Number(_0x190c74[_0x36b2('0x51')]['id'])});}});}})[_0x36b2('0x27')](respondWithStatusCode(_0x123426,null))[_0x36b2('0x49')](handleError(_0x123426,null));};exports[_0x36b2('0x83')]=function(_0x51b915,_0x2c8e2e,_0x53fae0){var _0x2c020f={};var _0x2a4c7f={};var _0x59245b;var _0x1a3af1;return db['SmsQueue']['findOne']({'where':{'id':_0x51b915['params']['id']}})[_0x36b2('0x27')](handleEntityNotFound(_0x2c8e2e,null))[_0x36b2('0x27')](function(_0x2c4343){if(_0x2c4343){_0x59245b=_0x2c4343;_0x2a4c7f[_0x36b2('0x34')]=_['keys'](db[_0x36b2('0x64')][_0x36b2('0x32')]);_0x2a4c7f[_0x36b2('0x35')]=_[_0x36b2('0x36')](_0x51b915[_0x36b2('0x35')]);_0x2a4c7f[_0x36b2('0x3d')]=_['intersection'](_0x2a4c7f['model'],_0x2a4c7f['query']);_0x2c020f[_0x36b2('0x38')]=_[_0x36b2('0x37')](_0x2a4c7f['model'],qs[_0x36b2('0x39')](_0x51b915[_0x36b2('0x35')]['fields']));_0x2c020f[_0x36b2('0x38')]=_0x2c020f[_0x36b2('0x38')][_0x36b2('0x47')]?_0x2c020f[_0x36b2('0x38')]:_0x2a4c7f[_0x36b2('0x34')];_0x2c020f[_0x36b2('0x62')]=qs[_0x36b2('0x55')](_0x51b915[_0x36b2('0x35')]['sort']);_0x2c020f[_0x36b2('0x3c')]=qs[_0x36b2('0x3d')](_[_0x36b2('0x56')](_0x51b915[_0x36b2('0x35')],_0x2a4c7f[_0x36b2('0x3d')]));if(_0x51b915[_0x36b2('0x35')][_0x36b2('0x3e')]){_0x2c020f[_0x36b2('0x3c')]=_[_0x36b2('0x3f')](_0x2c020f['where'],{'$or':_[_0x36b2('0x31')](_0x2c020f['attributes'],function(_0x5f6b94){var _0x4e7f91={};_0x4e7f91[_0x5f6b94]={'$like':'%'+_0x51b915[_0x36b2('0x35')][_0x36b2('0x3e')]+'%'};return _0x4e7f91;})});}_0x2c020f=_[_0x36b2('0x3f')]({},_0x2c020f,_0x51b915[_0x36b2('0x42')]);return _0x59245b[_0x36b2('0x83')](_0x2c020f);}})[_0x36b2('0x27')](function(_0x575013){if(_0x575013){_0x1a3af1=_0x575013[_0x36b2('0x47')];if(!_0x51b915[_0x36b2('0x35')][_0x36b2('0x3a')](_0x36b2('0x3b'))){_0x2c020f[_0x36b2('0x21')]=qs[_0x36b2('0x21')](_0x51b915[_0x36b2('0x35')][_0x36b2('0x21')]);_0x2c020f[_0x36b2('0x1f')]=qs['offset'](_0x51b915[_0x36b2('0x35')]['offset']);}return _0x59245b[_0x36b2('0x83')](_0x2c020f);}})['then'](function(_0x1ab7cd){if(_0x1ab7cd){return _0x1ab7cd?{'count':_0x1a3af1,'rows':_0x1ab7cd}:null;}})[_0x36b2('0x27')](respondWithResult(_0x2c8e2e,null))['catch'](handleError(_0x2c8e2e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 6b78899..fbfe7f7 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 _0xaba1=['save','update','remove','emit','hasOwnProperty','exports','events','SmsQueue','setMaxListeners'];(function(_0x39e069,_0x397588){var _0x17b2e7=function(_0x2e951f){while(--_0x2e951f){_0x39e069['push'](_0x39e069['shift']());}};_0x17b2e7(++_0x397588);}(_0xaba1,0x192));var _0x1aba=function(_0x4ee3b0,_0x499ed4){_0x4ee3b0=_0x4ee3b0-0x0;var _0x5839b6=_0xaba1[_0x4ee3b0];return _0x5839b6;};'use strict';var EventEmitter=require(_0x1aba('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x1aba('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1aba('0x2')](0x0);var events={'afterCreate':_0x1aba('0x3'),'afterUpdate':_0x1aba('0x4'),'afterDestroy':_0x1aba('0x5')};function emitEvent(_0x2650ce){return function(_0x35718e,_0xebc087,_0x9ef63b){SmsQueueEvents[_0x1aba('0x6')](_0x2650ce+':'+_0x35718e['id'],_0x35718e);SmsQueueEvents[_0x1aba('0x6')](_0x2650ce,_0x35718e);_0x9ef63b(null);};}for(var e in events){if(events[_0x1aba('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1aba('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x9152=['hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','save','update','emit'];(function(_0x10ce58,_0x1e1ff2){var _0x488d6f=function(_0x21e160){while(--_0x21e160){_0x10ce58['push'](_0x10ce58['shift']());}};_0x488d6f(++_0x1e1ff2);}(_0x9152,0x198));var _0x2915=function(_0x3970a3,_0x5978fe){_0x3970a3=_0x3970a3-0x0;var _0x2b7af4=_0x9152[_0x3970a3];return _0x2b7af4;};'use strict';var EventEmitter=require(_0x2915('0x0'));var SmsQueue=require(_0x2915('0x1'))['db'][_0x2915('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2915('0x3'),'afterUpdate':_0x2915('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5cd0bf){return function(_0x2589bc,_0x13bc02,_0x3ef96b){SmsQueueEvents[_0x2915('0x5')](_0x5cd0bf+':'+_0x2589bc['id'],_0x2589bc);SmsQueueEvents[_0x2915('0x5')](_0x5cd0bf,_0x2589bc);_0x3ef96b(null);};}for(var e in events){if(events[_0x2915('0x6')](e)){var event=events[e];SmsQueue[_0x2915('0x7')](e,emitEvent(event));}}module[_0x2915('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 5116eb4..3a20e96 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 _0x9218=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash','util'];(function(_0x300816,_0x2ac15c){var _0x20a7e4=function(_0x5522de){while(--_0x5522de){_0x300816['push'](_0x300816['shift']());}};_0x20a7e4(++_0x2ac15c);}(_0x9218,0x6a));var _0x8921=function(_0xc979f9,_0x34d85f){_0xc979f9=_0xc979f9-0x0;var _0x18da50=_0x9218[_0xc979f9];return _0x18da50;};'use strict';var _=require(_0x8921('0x0'));var util=require(_0x8921('0x1'));var logger=require(_0x8921('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8921('0x3'));var rp=require(_0x8921('0x4'));var fs=require('fs');var path=require(_0x8921('0x5'));var rimraf=require(_0x8921('0x6'));var config=require(_0x8921('0x7'));var attributes=require(_0x8921('0x8'));module[_0x8921('0x9')]=function(_0xeff42e,_0x45d1c2){return _0xeff42e[_0x8921('0xa')](_0x8921('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x65b3=['path','rimraf','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2e689d,_0x4c3b29){var _0x540160=function(_0xac5c81){while(--_0xac5c81){_0x2e689d['push'](_0x2e689d['shift']());}};_0x540160(++_0x4c3b29);}(_0x65b3,0xf1));var _0x365b=function(_0x258919,_0x1754e6){_0x258919=_0x258919-0x0;var _0xfbd68b=_0x65b3[_0x258919];return _0xfbd68b;};'use strict';var _=require(_0x365b('0x0'));var util=require(_0x365b('0x1'));var logger=require('../../config/logger')(_0x365b('0x2'));var moment=require(_0x365b('0x3'));var BPromise=require(_0x365b('0x4'));var rp=require(_0x365b('0x5'));var fs=require('fs');var path=require(_0x365b('0x6'));var rimraf=require(_0x365b('0x7'));var config=require('../../config/environment');var attributes=require(_0x365b('0x8'));module[_0x365b('0x9')]=function(_0x173d2a,_0x10f970){return _0x173d2a[_0x365b('0xa')](_0x365b('0xb'),attributes,{'tableName':_0x365b('0xc'),'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 8a9784b..2802bf9 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 _0xfa50=['debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','GetSmsQueue','ShowSmsQueue','find','lodash','util','moment','bluebird','../../config/utils','rpc','jayson/promise','redis','defaults','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2f78bd,_0x3c4b24){var _0x48383e=function(_0x293c8d){while(--_0x293c8d){_0x2f78bd['push'](_0x2f78bd['shift']());}};_0x48383e(++_0x3c4b24);}(_0xfa50,0x84));var _0x0fa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa50[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0fa5('0x0'));var util=require(_0x0fa5('0x1'));var moment=require(_0x0fa5('0x2'));var BPromise=require(_0x0fa5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0fa5('0x4'));var logger=require('../../config/logger')(_0x0fa5('0x5'));var config=require('../../config/environment');var jayson=require(_0x0fa5('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x0fa5('0x7')]=_[_0x0fa5('0x8')](config[_0x0fa5('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fa5('0x9'))(new Redis(config[_0x0fa5('0x7')]));require('./smsQueue.socket')[_0x0fa5('0xa')](socket);function respondWithRpcPromise(_0x371be2,_0x3b44c0,_0xb75782){return new BPromise(function(_0x38680e,_0x437ec8){return client[_0x0fa5('0xb')](_0x371be2,_0xb75782)[_0x0fa5('0xc')](function(_0x35dba5){logger[_0x0fa5('0xd')](_0x0fa5('0xe'),_0x3b44c0,_0x0fa5('0xf'));logger[_0x0fa5('0x10')](_0x0fa5('0x11'),_0x3b44c0,'request\x20sent',JSON[_0x0fa5('0x12')](_0x35dba5));if(_0x35dba5[_0x0fa5('0x13')]){if(_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x14')]===0x1f4){logger[_0x0fa5('0x13')]('SmsQueue,\x20%s,\x20%s',_0x3b44c0,_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);return _0x437ec8(_0x35dba5['error'][_0x0fa5('0x15')]);}logger['error'](_0x0fa5('0xe'),_0x3b44c0,_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);return _0x38680e(_0x35dba5[_0x0fa5('0x13')][_0x0fa5('0x15')]);}else{logger[_0x0fa5('0xd')](_0x0fa5('0xe'),_0x3b44c0,_0x0fa5('0xf'));_0x38680e(_0x35dba5[_0x0fa5('0x16')][_0x0fa5('0x15')]);}})[_0x0fa5('0x17')](function(_0x2be1e5){logger[_0x0fa5('0x13')](_0x0fa5('0xe'),_0x3b44c0,_0x2be1e5);_0x437ec8(_0x2be1e5);});});}exports['GetSmsQueue']=function(_0x28b7f3){var _0x2c83a0=this;return new Promise(function(_0x5c8c2f,_0x10fb18){return db[_0x0fa5('0x18')][_0x0fa5('0x19')]({'raw':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1c')]||null:null,'attributes':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')]['attributes']||null:null,'limit':_0x28b7f3[_0x0fa5('0x1a')]?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1d')]||null:null,'include':_0x28b7f3['options']?_0x28b7f3[_0x0fa5('0x1a')][_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x28b7f3[_0x0fa5('0x1a')]['include'],function(_0x28188c){return{'model':db[_0x28188c[_0x0fa5('0x20')]],'as':_0x28188c['as'],'attributes':_0x28188c[_0x0fa5('0x21')],'include':_0x28188c[_0x0fa5('0x1e')]?_['map'](_0x28188c[_0x0fa5('0x1e')],function(_0x25ac10){return{'model':db[_0x25ac10[_0x0fa5('0x20')]],'as':_0x25ac10['as'],'attributes':_0x25ac10['attributes'],'include':_0x25ac10[_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x25ac10[_0x0fa5('0x1e')],function(_0x4d2a90){return{'model':db[_0x4d2a90['model']],'as':_0x4d2a90['as'],'attributes':_0x4d2a90[_0x0fa5('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0fa5('0xc')](function(_0x2496ac){logger[_0x0fa5('0xd')]('GetSmsQueue',_0x28b7f3);logger[_0x0fa5('0x10')]('GetSmsQueue',_0x28b7f3,JSON['stringify'](_0x2496ac));_0x5c8c2f(_0x2496ac);})[_0x0fa5('0x17')](function(_0x358031){logger['error'](_0x0fa5('0x22'),_0x358031[_0x0fa5('0x15')],_0x28b7f3);_0x10fb18(_0x2c83a0['error'](0x1f4,_0x358031[_0x0fa5('0x15')]));});});};exports[_0x0fa5('0x23')]=function(_0x404b2c){var _0xd9950e=this;return new Promise(function(_0x2304e6,_0x5b715f){return db[_0x0fa5('0x18')][_0x0fa5('0x24')]({'raw':_0x404b2c['options']?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1b')]===undefined?!![]:![]:!![],'where':_0x404b2c['options']?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1c')]||null:null,'attributes':_0x404b2c[_0x0fa5('0x1a')]?_0x404b2c[_0x0fa5('0x1a')]['attributes']||null:null,'include':_0x404b2c[_0x0fa5('0x1a')]?_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1e')]?_[_0x0fa5('0x1f')](_0x404b2c[_0x0fa5('0x1a')][_0x0fa5('0x1e')],function(_0x2d4cff){return{'model':db[_0x2d4cff['model']],'as':_0x2d4cff['as'],'attributes':_0x2d4cff['attributes'],'include':_0x2d4cff['include']?_['map'](_0x2d4cff[_0x0fa5('0x1e')],function(_0xe4d66){return{'model':db[_0xe4d66[_0x0fa5('0x20')]],'as':_0xe4d66['as'],'attributes':_0xe4d66[_0x0fa5('0x21')],'include':_0xe4d66['include']?_[_0x0fa5('0x1f')](_0xe4d66[_0x0fa5('0x1e')],function(_0x264b3b){return{'model':db[_0x264b3b[_0x0fa5('0x20')]],'as':_0x264b3b['as'],'attributes':_0x264b3b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x15af5a){logger[_0x0fa5('0xd')](_0x0fa5('0x23'),_0x404b2c);logger['debug'](_0x0fa5('0x23'),_0x404b2c,JSON[_0x0fa5('0x12')](_0x15af5a));_0x2304e6(_0x15af5a);})[_0x0fa5('0x17')](function(_0x4da0b9){logger[_0x0fa5('0x13')](_0x0fa5('0x23'),_0x4da0b9[_0x0fa5('0x15')],_0x404b2c);_0x5b715f(_0xd9950e[_0x0fa5('0x13')](0x1f4,_0x4da0b9[_0x0fa5('0x15')]));});});}; \ No newline at end of file +var _0x6001=['find','where','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsQueue,\x20%s,\x20%s','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','GetSmsQueue','SmsQueue','findAll','options','raw','attributes','limit','include','model','map','debug','stringify','ShowSmsQueue'];(function(_0x4e60c7,_0x380dce){var _0x472406=function(_0x5b7b37){while(--_0x5b7b37){_0x4e60c7['push'](_0x4e60c7['shift']());}};_0x472406(++_0x380dce);}(_0x6001,0x129));var _0x1600=function(_0x30f2d1,_0x5710ac){_0x30f2d1=_0x30f2d1-0x0;var _0x44605d=_0x6001[_0x30f2d1];return _0x44605d;};'use strict';var _=require(_0x1600('0x0'));var util=require(_0x1600('0x1'));var moment=require(_0x1600('0x2'));var BPromise=require(_0x1600('0x3'));var rs=require(_0x1600('0x4'));var fs=require('fs');var Redis=require(_0x1600('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1600('0x6'));var logger=require(_0x1600('0x7'))('rpc');var config=require(_0x1600('0x8'));var jayson=require(_0x1600('0x9'));var client=jayson[_0x1600('0xa')][_0x1600('0xb')]({'port':0x232a});config[_0x1600('0xc')]=_[_0x1600('0xd')](config[_0x1600('0xc')],{'host':_0x1600('0xe'),'port':0x18eb});var socket=require(_0x1600('0xf'))(new Redis(config[_0x1600('0xc')]));require('./smsQueue.socket')[_0x1600('0x10')](socket);function respondWithRpcPromise(_0x2e4fae,_0x2e1e64,_0x2a9760){return new BPromise(function(_0x1d0687,_0x7b1b26){return client[_0x1600('0x11')](_0x2e4fae,_0x2a9760)[_0x1600('0x12')](function(_0x21b82e){logger[_0x1600('0x13')](_0x1600('0x14'),_0x2e1e64,'request\x20sent');logger['debug'](_0x1600('0x15'),_0x2e1e64,'request\x20sent',JSON['stringify'](_0x21b82e));if(_0x21b82e[_0x1600('0x16')]){if(_0x21b82e['error'][_0x1600('0x17')]===0x1f4){logger[_0x1600('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2e1e64,_0x21b82e[_0x1600('0x16')][_0x1600('0x18')]);return _0x7b1b26(_0x21b82e[_0x1600('0x16')][_0x1600('0x18')]);}logger[_0x1600('0x16')]('SmsQueue,\x20%s,\x20%s',_0x2e1e64,_0x21b82e[_0x1600('0x16')][_0x1600('0x18')]);return _0x1d0687(_0x21b82e[_0x1600('0x16')][_0x1600('0x18')]);}else{logger[_0x1600('0x13')]('SmsQueue,\x20%s,\x20%s',_0x2e1e64,_0x1600('0x19'));_0x1d0687(_0x21b82e['result'][_0x1600('0x18')]);}})['catch'](function(_0x534d3f){logger[_0x1600('0x16')](_0x1600('0x14'),_0x2e1e64,_0x534d3f);_0x7b1b26(_0x534d3f);});});}exports[_0x1600('0x1a')]=function(_0x1dd628){var _0x28e38e=this;return new Promise(function(_0x5eb802,_0x55e52f){return db[_0x1600('0x1b')][_0x1600('0x1c')]({'raw':_0x1dd628[_0x1600('0x1d')]?_0x1dd628['options'][_0x1600('0x1e')]===undefined?!![]:![]:!![],'where':_0x1dd628[_0x1600('0x1d')]?_0x1dd628[_0x1600('0x1d')]['where']||null:null,'attributes':_0x1dd628[_0x1600('0x1d')]?_0x1dd628[_0x1600('0x1d')][_0x1600('0x1f')]||null:null,'limit':_0x1dd628[_0x1600('0x1d')]?_0x1dd628[_0x1600('0x1d')][_0x1600('0x20')]||null:null,'include':_0x1dd628['options']?_0x1dd628[_0x1600('0x1d')]['include']?_['map'](_0x1dd628[_0x1600('0x1d')][_0x1600('0x21')],function(_0x88d548){return{'model':db[_0x88d548[_0x1600('0x22')]],'as':_0x88d548['as'],'attributes':_0x88d548[_0x1600('0x1f')],'include':_0x88d548[_0x1600('0x21')]?_[_0x1600('0x23')](_0x88d548[_0x1600('0x21')],function(_0x15822f){return{'model':db[_0x15822f[_0x1600('0x22')]],'as':_0x15822f['as'],'attributes':_0x15822f[_0x1600('0x1f')],'include':_0x15822f[_0x1600('0x21')]?_[_0x1600('0x23')](_0x15822f['include'],function(_0x1e3f9b){return{'model':db[_0x1e3f9b[_0x1600('0x22')]],'as':_0x1e3f9b['as'],'attributes':_0x1e3f9b[_0x1600('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1600('0x12')](function(_0x134244){logger[_0x1600('0x13')](_0x1600('0x1a'),_0x1dd628);logger[_0x1600('0x24')]('GetSmsQueue',_0x1dd628,JSON[_0x1600('0x25')](_0x134244));_0x5eb802(_0x134244);})['catch'](function(_0x3e4ee7){logger[_0x1600('0x16')](_0x1600('0x1a'),_0x3e4ee7['message'],_0x1dd628);_0x55e52f(_0x28e38e['error'](0x1f4,_0x3e4ee7[_0x1600('0x18')]));});});};exports[_0x1600('0x26')]=function(_0x2e3339){var _0x29d011=this;return new Promise(function(_0x11f4fe,_0x4f0f5d){return db[_0x1600('0x1b')][_0x1600('0x27')]({'raw':_0x2e3339[_0x1600('0x1d')]?_0x2e3339['options']['raw']===undefined?!![]:![]:!![],'where':_0x2e3339[_0x1600('0x1d')]?_0x2e3339[_0x1600('0x1d')][_0x1600('0x28')]||null:null,'attributes':_0x2e3339[_0x1600('0x1d')]?_0x2e3339['options']['attributes']||null:null,'include':_0x2e3339['options']?_0x2e3339[_0x1600('0x1d')][_0x1600('0x21')]?_[_0x1600('0x23')](_0x2e3339['options'][_0x1600('0x21')],function(_0x501e1c){return{'model':db[_0x501e1c[_0x1600('0x22')]],'as':_0x501e1c['as'],'attributes':_0x501e1c[_0x1600('0x1f')],'include':_0x501e1c[_0x1600('0x21')]?_['map'](_0x501e1c[_0x1600('0x21')],function(_0x491b87){return{'model':db[_0x491b87['model']],'as':_0x491b87['as'],'attributes':_0x491b87[_0x1600('0x1f')],'include':_0x491b87[_0x1600('0x21')]?_['map'](_0x491b87['include'],function(_0x3bb830){return{'model':db[_0x3bb830[_0x1600('0x22')]],'as':_0x3bb830['as'],'attributes':_0x3bb830['attributes']};}):[]};}):[]};}):[]:[]})[_0x1600('0x12')](function(_0x10d8be){logger[_0x1600('0x13')](_0x1600('0x26'),_0x2e3339);logger[_0x1600('0x24')](_0x1600('0x26'),_0x2e3339,JSON[_0x1600('0x25')](_0x10d8be));_0x11f4fe(_0x10d8be);})[_0x1600('0x29')](function(_0x542260){logger['error'](_0x1600('0x26'),_0x542260[_0x1600('0x18')],_0x2e3339);_0x4f0f5d(_0x29d011['error'](0x1f4,_0x542260[_0x1600('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index ef394d1..703b572 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 _0xc684=['register','length','smsQueue:','./smsQueue.events','save','update','emit'];(function(_0xd9418f,_0xf52b3a){var _0x5f4b79=function(_0x1a93b1){while(--_0x1a93b1){_0xd9418f['push'](_0xd9418f['shift']());}};_0x5f4b79(++_0xf52b3a);}(_0xc684,0x96));var _0x4c68=function(_0x510ed7,_0x133634){_0x510ed7=_0x510ed7-0x0;var _0x63c5b4=_0xc684[_0x510ed7];return _0x63c5b4;};'use strict';var SmsQueueEvents=require(_0x4c68('0x0'));var events=[_0x4c68('0x1'),'remove',_0x4c68('0x2')];function createListener(_0x3b4891,_0x4c11a9){return function(_0x4ea34e){_0x4c11a9[_0x4c68('0x3')](_0x3b4891,_0x4ea34e);};}function removeListener(_0x41c3f2,_0xcdb19){return function(){SmsQueueEvents['removeListener'](_0x41c3f2,_0xcdb19);};}exports[_0x4c68('0x4')]=function(_0xc18c92){for(var _0x3e9a80=0x0,_0xdb775a=events[_0x4c68('0x5')];_0x3e9a80<_0xdb775a;_0x3e9a80++){var _0x1571aa=events[_0x3e9a80];var _0xc47fa9=createListener(_0x4c68('0x6')+_0x1571aa,_0xc18c92);SmsQueueEvents['on'](_0x1571aa,_0xc47fa9);}}; \ No newline at end of file +var _0x58eb=['register','length','smsQueue:','./smsQueue.events','save','remove','emit','removeListener'];(function(_0x52414e,_0x4af831){var _0xad437e=function(_0x833fb6){while(--_0x833fb6){_0x52414e['push'](_0x52414e['shift']());}};_0xad437e(++_0x4af831);}(_0x58eb,0xa3));var _0xb58e=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x58eb[_0x432fca];return _0x3adba4;};'use strict';var SmsQueueEvents=require(_0xb58e('0x0'));var events=[_0xb58e('0x1'),_0xb58e('0x2'),'update'];function createListener(_0x257ca2,_0x32802e){return function(_0x4bafb7){_0x32802e[_0xb58e('0x3')](_0x257ca2,_0x4bafb7);};}function removeListener(_0xedd811,_0x1efae4){return function(){SmsQueueEvents[_0xb58e('0x4')](_0xedd811,_0x1efae4);};}exports[_0xb58e('0x5')]=function(_0x1ac8f2){for(var _0xb18f86=0x0,_0x571703=events[_0xb58e('0x6')];_0xb18f86<_0x571703;_0xb18f86++){var _0x19fe6f=events[_0xb18f86];var _0x5785e9=createListener(_0xb58e('0x7')+_0x19fe6f,_0x1ac8f2);SmsQueueEvents['on'](_0x19fe6f,_0x5785e9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 95e50b5..fdb1fae 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 _0x9677=['../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x83139e,_0x1060f9){var _0x7e5730=function(_0xcf8019){while(--_0xcf8019){_0x83139e['push'](_0x83139e['shift']());}};_0x7e5730(++_0x1060f9);}(_0x9677,0xc2));var _0x7967=function(_0x3a8b9b,_0x4b1728){_0x3a8b9b=_0x3a8b9b-0x0;var _0x1a3bba=_0x9677[_0x3a8b9b];return _0x1a3bba;};'use strict';var multer=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var path=require(_0x7967('0x2'));var timeout=require(_0x7967('0x3'));var express=require('express');var router=express[_0x7967('0x4')]();var fs_extra=require(_0x7967('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7967('0x6'));var controller=require('./smsQueueReport.controller');router[_0x7967('0x7')]('/',auth[_0x7967('0x8')](),controller[_0x7967('0x9')]);router[_0x7967('0x7')]('/describe',auth[_0x7967('0x8')](),controller[_0x7967('0xa')]);router[_0x7967('0x7')](_0x7967('0xb'),auth[_0x7967('0x8')](),controller[_0x7967('0xc')]);router[_0x7967('0xd')]('/',auth[_0x7967('0x8')](),controller[_0x7967('0xe')]);router[_0x7967('0xf')](_0x7967('0xb'),auth['isAuthenticated'](),controller[_0x7967('0x10')]);router[_0x7967('0x11')](_0x7967('0xb'),auth[_0x7967('0x8')](),controller[_0x7967('0x12')]);module[_0x7967('0x13')]=router; \ No newline at end of file +var _0x24e2=['post','create','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x24e2,0x109));var _0x224e=function(_0x24922e,_0x70b0e){_0x24922e=_0x24922e-0x0;var _0x2fd6f8=_0x24e2[_0x24922e];return _0x2fd6f8;};'use strict';var multer=require(_0x224e('0x0'));var util=require(_0x224e('0x1'));var path=require(_0x224e('0x2'));var timeout=require('connect-timeout');var express=require(_0x224e('0x3'));var router=express[_0x224e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x224e('0x5'));var interaction=require(_0x224e('0x6'));var config=require(_0x224e('0x7'));var controller=require(_0x224e('0x8'));router['get']('/',auth[_0x224e('0x9')](),controller[_0x224e('0xa')]);router[_0x224e('0xb')](_0x224e('0xc'),auth[_0x224e('0x9')](),controller[_0x224e('0xd')]);router[_0x224e('0xb')](_0x224e('0xe'),auth[_0x224e('0x9')](),controller['show']);router[_0x224e('0xf')]('/',auth[_0x224e('0x9')](),controller[_0x224e('0x10')]);router['put'](_0x224e('0xe'),auth[_0x224e('0x9')](),controller[_0x224e('0x11')]);router[_0x224e('0x12')](_0x224e('0xe'),auth[_0x224e('0x9')](),controller[_0x224e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 96b7c6e..15d31db 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 _0xcad5=['moment','sequelize','exports','STRING','DATE'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xcad5,0x1ae));var _0x5cad=function(_0x147e3e,_0x5d008d){_0x147e3e=_0x147e3e-0x0;var _0x201f52=_0xcad5[_0x147e3e];return _0x201f52;};'use strict';var moment=require(_0x5cad('0x0'));var Sequelize=require(_0x5cad('0x1'));module[_0x5cad('0x2')]={'uniqueid':{'type':Sequelize[_0x5cad('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5cad('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x5cad('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5cad('0x4')]},'reason':{'type':Sequelize[_0x5cad('0x3')]}}; \ No newline at end of file +var _0xd3fc=['STRING','DATE','moment','sequelize'];(function(_0x5a943a,_0x4c0d29){var _0x5c2c23=function(_0xf646b5){while(--_0xf646b5){_0x5a943a['push'](_0x5a943a['shift']());}};_0x5c2c23(++_0x4c0d29);}(_0xd3fc,0x19e));var _0xcd3f=function(_0x1c0736,_0x36769a){_0x1c0736=_0x1c0736-0x0;var _0x47e45b=_0xd3fc[_0x1c0736];return _0x47e45b;};'use strict';var moment=require(_0xcd3f('0x0'));var Sequelize=require(_0xcd3f('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcd3f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcd3f('0x3')]},'leaveAt':{'type':Sequelize[_0xcd3f('0x3')]},'acceptAt':{'type':Sequelize[_0xcd3f('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcd3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index f7412c2..297ae2b 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 _0xa6f9=['limit','count','set','apply','reject','save','update','then','sendStatus','name','send','index','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','include','findAll','rows','catch','show','params','rawAttributes','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined'];(function(_0x363150,_0x1d1aac){var _0x546cef=function(_0x43cdbf){while(--_0x43cdbf){_0x363150['push'](_0x363150['shift']());}};_0x546cef(++_0x1d1aac);}(_0xa6f9,0x75));var _0x9a6f=function(_0x53894a,_0x50dfb7){_0x53894a=_0x53894a-0x0;var _0x439324=_0xa6f9[_0x53894a];return _0x439324;};'use strict';var emlformat=require(_0x9a6f('0x0'));var rimraf=require(_0x9a6f('0x1'));var zipdir=require(_0x9a6f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9a6f('0x3'));var moment=require('moment');var BPromise=require(_0x9a6f('0x4'));var Mustache=require(_0x9a6f('0x5'));var util=require(_0x9a6f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9a6f('0x7'));var ejs=require(_0x9a6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a6f('0x9'));var squel=require(_0x9a6f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a6f('0xb'));var deskjs=require(_0x9a6f('0xc'));var toCsv=require(_0x9a6f('0x7'));var querystring=require('querystring');var Papa=require(_0x9a6f('0xd'));var Redis=require(_0x9a6f('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9a6f('0xf'));var as=require(_0x9a6f('0x10'));var hardwareService=require(_0x9a6f('0x11'));var logger=require(_0x9a6f('0x12'))('api');var utils=require(_0x9a6f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9a6f('0x14'));var db=require(_0x9a6f('0x15'))['db'];function respondWithStatusCode(_0x2ac76c,_0x3eee06){_0x3eee06=_0x3eee06||0xcc;return function(_0x42c928){if(_0x42c928){return _0x2ac76c['sendStatus'](_0x3eee06);}return _0x2ac76c[_0x9a6f('0x16')](_0x3eee06)[_0x9a6f('0x17')]();};}function respondWithResult(_0x122891,_0x47b7ad){_0x47b7ad=_0x47b7ad||0xc8;return function(_0x211f55){if(_0x211f55){return _0x122891[_0x9a6f('0x16')](_0x47b7ad)[_0x9a6f('0x18')](_0x211f55);}};}function respondWithFilteredResult(_0x4f54eb,_0x55c9b2){return function(_0x548f05){if(_0x548f05){var _0xb343c2=typeof _0x55c9b2[_0x9a6f('0x19')]===_0x9a6f('0x1a')&&typeof _0x55c9b2[_0x9a6f('0x1b')]===_0x9a6f('0x1a');var _0x40697e=_0x548f05[_0x9a6f('0x1c')];var _0x4ce0aa=_0xb343c2?0x0:_0x55c9b2[_0x9a6f('0x19')];var _0x20caf9=_0xb343c2?_0x548f05[_0x9a6f('0x1c')]:_0x55c9b2[_0x9a6f('0x19')]+_0x55c9b2[_0x9a6f('0x1b')];var _0x853956;if(_0x20caf9>=_0x40697e){_0x20caf9=_0x40697e;_0x853956=0xc8;}else{_0x853956=0xce;}_0x4f54eb[_0x9a6f('0x16')](_0x853956);return _0x4f54eb[_0x9a6f('0x1d')]('Content-Range',_0x4ce0aa+'-'+_0x20caf9+'/'+_0x40697e)[_0x9a6f('0x18')](_0x548f05);}return null;};}function patchUpdates(_0x1bec8c){return function(_0x105d67){try{jsonpatch[_0x9a6f('0x1e')](_0x105d67,_0x1bec8c,!![]);}catch(_0x7c2664){return BPromise[_0x9a6f('0x1f')](_0x7c2664);}return _0x105d67[_0x9a6f('0x20')]();};}function saveUpdates(_0x2e04f6,_0x1bdbec){return function(_0x6c341f){if(_0x6c341f){return _0x6c341f[_0x9a6f('0x21')](_0x2e04f6)[_0x9a6f('0x22')](function(_0xcd2dc5){return _0xcd2dc5;});}return null;};}function removeEntity(_0x116099,_0x474f36){return function(_0x3484c8){if(_0x3484c8){return _0x3484c8['destroy']()[_0x9a6f('0x22')](function(){_0x116099[_0x9a6f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52dbdb,_0x4ed794){return function(_0x38518c){if(!_0x38518c){_0x52dbdb[_0x9a6f('0x23')](0x194);}return _0x38518c;};}function handleError(_0x1e9f21,_0x2e587e){_0x2e587e=_0x2e587e||0x1f4;return function(_0x56e39c){logger['error'](_0x56e39c['stack']);if(_0x56e39c[_0x9a6f('0x24')]){delete _0x56e39c[_0x9a6f('0x24')];}_0x1e9f21[_0x9a6f('0x16')](_0x2e587e)[_0x9a6f('0x25')](_0x56e39c);};}exports[_0x9a6f('0x26')]=function(_0x69043c,_0x2c0199){var _0x2dc232={},_0x2594e6={},_0x17b50a={'count':0x0,'rows':[]};var _0x276df1=_[_0x9a6f('0x27')](db[_0x9a6f('0x28')]['rawAttributes'],function(_0xdd15b7){return{'name':_0xdd15b7[_0x9a6f('0x29')],'type':_0xdd15b7[_0x9a6f('0x2a')][_0x9a6f('0x2b')]};});_0x2594e6[_0x9a6f('0x2c')]=_[_0x9a6f('0x27')](_0x276df1,_0x9a6f('0x24'));_0x2594e6[_0x9a6f('0x2d')]=_[_0x9a6f('0x2e')](_0x69043c[_0x9a6f('0x2d')]);_0x2594e6[_0x9a6f('0x2f')]=_[_0x9a6f('0x30')](_0x2594e6[_0x9a6f('0x2c')],_0x2594e6[_0x9a6f('0x2d')]);_0x2dc232[_0x9a6f('0x31')]=_['intersection'](_0x2594e6[_0x9a6f('0x2c')],qs[_0x9a6f('0x32')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x32')]));_0x2dc232[_0x9a6f('0x31')]=_0x2dc232[_0x9a6f('0x31')][_0x9a6f('0x33')]?_0x2dc232['attributes']:_0x2594e6[_0x9a6f('0x2c')];if(!_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x34')](_0x9a6f('0x35'))){_0x2dc232['limit']=qs[_0x9a6f('0x1b')](_0x69043c[_0x9a6f('0x2d')]['limit']);_0x2dc232[_0x9a6f('0x19')]=qs[_0x9a6f('0x19')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x19')]);}_0x2dc232[_0x9a6f('0x36')]=qs[_0x9a6f('0x37')](_0x69043c[_0x9a6f('0x2d')][_0x9a6f('0x37')]);_0x2dc232[_0x9a6f('0x38')]=qs[_0x9a6f('0x2f')](_['pick'](_0x69043c[_0x9a6f('0x2d')],_0x2594e6[_0x9a6f('0x2f')]),_0x276df1);if(_0x69043c[_0x9a6f('0x2d')]['filter']){_0x2dc232[_0x9a6f('0x38')]=_[_0x9a6f('0x39')](_0x2dc232[_0x9a6f('0x38')],{'$or':_[_0x9a6f('0x27')](_0x276df1,function(_0x2e2603){if(_0x2e2603[_0x9a6f('0x2a')]!==_0x9a6f('0x3a')){var _0x52a201={};_0x52a201[_0x2e2603['name']]={'$like':'%'+_0x69043c[_0x9a6f('0x2d')]['filter']+'%'};return _0x52a201;}})});}_0x2dc232=_[_0x9a6f('0x39')]({},_0x2dc232,_0x69043c['options']);var _0x32a1a1={'where':_0x2dc232[_0x9a6f('0x38')]};return db['SmsQueueReport']['count'](_0x32a1a1)[_0x9a6f('0x22')](function(_0xc8b03c){_0x17b50a['count']=_0xc8b03c;if(_0x69043c[_0x9a6f('0x2d')]['includeAll']){_0x2dc232[_0x9a6f('0x3b')]=[{'all':!![]}];}return db[_0x9a6f('0x28')][_0x9a6f('0x3c')](_0x2dc232);})['then'](function(_0x5217c0){_0x17b50a[_0x9a6f('0x3d')]=_0x5217c0;return _0x17b50a;})[_0x9a6f('0x22')](respondWithFilteredResult(_0x2c0199,_0x2dc232))[_0x9a6f('0x3e')](handleError(_0x2c0199,null));};exports[_0x9a6f('0x3f')]=function(_0x1d57b8,_0xbd69a1){var _0x52b731={'raw':!![],'where':{'id':_0x1d57b8[_0x9a6f('0x40')]['id']}},_0x48914b={};_0x48914b[_0x9a6f('0x2c')]=_[_0x9a6f('0x2e')](db[_0x9a6f('0x28')][_0x9a6f('0x41')]);_0x48914b[_0x9a6f('0x2d')]=_[_0x9a6f('0x2e')](_0x1d57b8['query']);_0x48914b[_0x9a6f('0x2f')]=_[_0x9a6f('0x30')](_0x48914b[_0x9a6f('0x2c')],_0x48914b[_0x9a6f('0x2d')]);_0x52b731[_0x9a6f('0x31')]=_[_0x9a6f('0x30')](_0x48914b[_0x9a6f('0x2c')],qs['fields'](_0x1d57b8[_0x9a6f('0x2d')]['fields']));_0x52b731[_0x9a6f('0x31')]=_0x52b731[_0x9a6f('0x31')][_0x9a6f('0x33')]?_0x52b731[_0x9a6f('0x31')]:_0x48914b['model'];if(_0x1d57b8[_0x9a6f('0x2d')][_0x9a6f('0x42')]){_0x52b731[_0x9a6f('0x3b')]=[{'all':!![]}];}_0x52b731=_[_0x9a6f('0x39')]({},_0x52b731,_0x1d57b8['options']);return db[_0x9a6f('0x28')]['find'](_0x52b731)['then'](handleEntityNotFound(_0xbd69a1,null))[_0x9a6f('0x22')](respondWithResult(_0xbd69a1,null))[_0x9a6f('0x3e')](handleError(_0xbd69a1,null));};exports['create']=function(_0x267516,_0x1e54bb){return db[_0x9a6f('0x28')][_0x9a6f('0x43')](_0x267516[_0x9a6f('0x44')],{})[_0x9a6f('0x22')](respondWithResult(_0x1e54bb,0xc9))[_0x9a6f('0x3e')](handleError(_0x1e54bb,null));};exports[_0x9a6f('0x21')]=function(_0x256733,_0x505c5b){if(_0x256733[_0x9a6f('0x44')]['id']){delete _0x256733['body']['id'];}return db[_0x9a6f('0x28')][_0x9a6f('0x45')]({'where':{'id':_0x256733['params']['id']}})[_0x9a6f('0x22')](handleEntityNotFound(_0x505c5b,null))[_0x9a6f('0x22')](saveUpdates(_0x256733[_0x9a6f('0x44')],null))[_0x9a6f('0x22')](respondWithResult(_0x505c5b,null))['catch'](handleError(_0x505c5b,null));};exports[_0x9a6f('0x46')]=function(_0x1ad79b,_0x486c9a){return db[_0x9a6f('0x28')]['find']({'where':{'id':_0x1ad79b[_0x9a6f('0x40')]['id']}})['then'](handleEntityNotFound(_0x486c9a,null))[_0x9a6f('0x22')](removeEntity(_0x486c9a,null))['catch'](handleError(_0x486c9a,null));};exports[_0x9a6f('0x47')]=function(_0xdb15e,_0x549f72){return db[_0x9a6f('0x28')][_0x9a6f('0x47')]()['then'](respondWithResult(_0x549f72,null))[_0x9a6f('0x3e')](handleError(_0x549f72,null));}; \ No newline at end of file +var _0xdf41=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','reject','update','then','destroy','error','name','index','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','where','map','type','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x368811,_0x16c69e){var _0x18d8d0=function(_0x2c8062){while(--_0x2c8062){_0x368811['push'](_0x368811['shift']());}};_0x18d8d0(++_0x16c69e);}(_0xdf41,0x1b7));var _0x1df4=function(_0x3426ca,_0x58912a){_0x3426ca=_0x3426ca-0x0;var _0x344a8c=_0xdf41[_0x3426ca];return _0x344a8c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1df4('0x0'));var jsonpatch=require(_0x1df4('0x1'));var rp=require(_0x1df4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1df4('0x3'));var util=require(_0x1df4('0x4'));var path=require('path');var sox=require(_0x1df4('0x5'));var csv=require(_0x1df4('0x6'));var ejs=require(_0x1df4('0x7'));var fs=require('fs');var fs_extra=require(_0x1df4('0x8'));var _=require(_0x1df4('0x9'));var squel=require(_0x1df4('0xa'));var crypto=require(_0x1df4('0xb'));var jsforce=require(_0x1df4('0xc'));var deskjs=require(_0x1df4('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1df4('0xe'));var Papa=require(_0x1df4('0xf'));var Redis=require(_0x1df4('0x10'));var authService=require(_0x1df4('0x11'));var qs=require(_0x1df4('0x12'));var as=require(_0x1df4('0x13'));var hardwareService=require(_0x1df4('0x14'));var logger=require(_0x1df4('0x15'))(_0x1df4('0x16'));var utils=require('../../config/utils');var config=require(_0x1df4('0x17'));var licenseUtil=require(_0x1df4('0x18'));var db=require(_0x1df4('0x19'))['db'];function respondWithStatusCode(_0x122d4f,_0x32f724){_0x32f724=_0x32f724||0xcc;return function(_0x1abbf3){if(_0x1abbf3){return _0x122d4f[_0x1df4('0x1a')](_0x32f724);}return _0x122d4f[_0x1df4('0x1b')](_0x32f724)[_0x1df4('0x1c')]();};}function respondWithResult(_0x16f370,_0x2b2b65){_0x2b2b65=_0x2b2b65||0xc8;return function(_0xe4c712){if(_0xe4c712){return _0x16f370['status'](_0x2b2b65)[_0x1df4('0x1d')](_0xe4c712);}};}function respondWithFilteredResult(_0x5c21e0,_0x26cd57){return function(_0xd45eb3){if(_0xd45eb3){var _0x5f1a7b=typeof _0x26cd57[_0x1df4('0x1e')]===_0x1df4('0x1f')&&typeof _0x26cd57['limit']===_0x1df4('0x1f');var _0x1102f9=_0xd45eb3['count'];var _0x1ce861=_0x5f1a7b?0x0:_0x26cd57[_0x1df4('0x1e')];var _0x4eae7c=_0x5f1a7b?_0xd45eb3['count']:_0x26cd57[_0x1df4('0x1e')]+_0x26cd57['limit'];var _0x20be1b;if(_0x4eae7c>=_0x1102f9){_0x4eae7c=_0x1102f9;_0x20be1b=0xc8;}else{_0x20be1b=0xce;}_0x5c21e0[_0x1df4('0x1b')](_0x20be1b);return _0x5c21e0[_0x1df4('0x20')](_0x1df4('0x21'),_0x1ce861+'-'+_0x4eae7c+'/'+_0x1102f9)[_0x1df4('0x1d')](_0xd45eb3);}return null;};}function patchUpdates(_0x460145){return function(_0x56a777){try{jsonpatch[_0x1df4('0x22')](_0x56a777,_0x460145,!![]);}catch(_0x49dbe2){return BPromise[_0x1df4('0x23')](_0x49dbe2);}return _0x56a777['save']();};}function saveUpdates(_0x5018af,_0x20763c){return function(_0x85536e){if(_0x85536e){return _0x85536e[_0x1df4('0x24')](_0x5018af)[_0x1df4('0x25')](function(_0x2ef41e){return _0x2ef41e;});}return null;};}function removeEntity(_0x478cfb,_0x21beab){return function(_0xf24c52){if(_0xf24c52){return _0xf24c52[_0x1df4('0x26')]()[_0x1df4('0x25')](function(){_0x478cfb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4413d1,_0x392c0f){return function(_0x4b88e9){if(!_0x4b88e9){_0x4413d1[_0x1df4('0x1a')](0x194);}return _0x4b88e9;};}function handleError(_0x1575d4,_0x2ff8fd){_0x2ff8fd=_0x2ff8fd||0x1f4;return function(_0x56851f){logger[_0x1df4('0x27')](_0x56851f['stack']);if(_0x56851f[_0x1df4('0x28')]){delete _0x56851f[_0x1df4('0x28')];}_0x1575d4[_0x1df4('0x1b')](_0x2ff8fd)['send'](_0x56851f);};}exports[_0x1df4('0x29')]=function(_0x43d6fc,_0x970347){var _0x162b9b={},_0xe78c58={},_0x1abf57={'count':0x0,'rows':[]};var _0x19e3c7=_['map'](db[_0x1df4('0x2a')][_0x1df4('0x2b')],function(_0x183e0c){return{'name':_0x183e0c[_0x1df4('0x2c')],'type':_0x183e0c['type'][_0x1df4('0x2d')]};});_0xe78c58[_0x1df4('0x2e')]=_['map'](_0x19e3c7,'name');_0xe78c58[_0x1df4('0x2f')]=_[_0x1df4('0x30')](_0x43d6fc[_0x1df4('0x2f')]);_0xe78c58[_0x1df4('0x31')]=_['intersection'](_0xe78c58[_0x1df4('0x2e')],_0xe78c58['query']);_0x162b9b[_0x1df4('0x32')]=_[_0x1df4('0x33')](_0xe78c58[_0x1df4('0x2e')],qs[_0x1df4('0x34')](_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x34')]));_0x162b9b[_0x1df4('0x32')]=_0x162b9b[_0x1df4('0x32')][_0x1df4('0x35')]?_0x162b9b[_0x1df4('0x32')]:_0xe78c58[_0x1df4('0x2e')];if(!_0x43d6fc['query'][_0x1df4('0x36')](_0x1df4('0x37'))){_0x162b9b['limit']=qs[_0x1df4('0x38')](_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x38')]);_0x162b9b[_0x1df4('0x1e')]=qs[_0x1df4('0x1e')](_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x1e')]);}_0x162b9b[_0x1df4('0x39')]=qs[_0x1df4('0x3a')](_0x43d6fc['query']['sort']);_0x162b9b['where']=qs[_0x1df4('0x31')](_['pick'](_0x43d6fc[_0x1df4('0x2f')],_0xe78c58['filters']),_0x19e3c7);if(_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x3b')]){_0x162b9b[_0x1df4('0x3c')]=_['merge'](_0x162b9b[_0x1df4('0x3c')],{'$or':_[_0x1df4('0x3d')](_0x19e3c7,function(_0x12dc99){if(_0x12dc99[_0x1df4('0x3e')]!=='VIRTUAL'){var _0x2e7a64={};_0x2e7a64[_0x12dc99['name']]={'$like':'%'+_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x3b')]+'%'};return _0x2e7a64;}})});}_0x162b9b=_[_0x1df4('0x3f')]({},_0x162b9b,_0x43d6fc[_0x1df4('0x40')]);var _0x4148b1={'where':_0x162b9b[_0x1df4('0x3c')]};return db[_0x1df4('0x2a')][_0x1df4('0x41')](_0x4148b1)[_0x1df4('0x25')](function(_0x4f2e74){_0x1abf57[_0x1df4('0x41')]=_0x4f2e74;if(_0x43d6fc[_0x1df4('0x2f')][_0x1df4('0x42')]){_0x162b9b[_0x1df4('0x43')]=[{'all':!![]}];}return db[_0x1df4('0x2a')][_0x1df4('0x44')](_0x162b9b);})[_0x1df4('0x25')](function(_0x167e95){_0x1abf57[_0x1df4('0x45')]=_0x167e95;return _0x1abf57;})[_0x1df4('0x25')](respondWithFilteredResult(_0x970347,_0x162b9b))[_0x1df4('0x46')](handleError(_0x970347,null));};exports[_0x1df4('0x47')]=function(_0x1fc51d,_0x3b6d14){var _0x2fc895={'raw':!![],'where':{'id':_0x1fc51d[_0x1df4('0x48')]['id']}},_0x48cde5={};_0x48cde5['model']=_['keys'](db['SmsQueueReport'][_0x1df4('0x2b')]);_0x48cde5[_0x1df4('0x2f')]=_['keys'](_0x1fc51d[_0x1df4('0x2f')]);_0x48cde5[_0x1df4('0x31')]=_[_0x1df4('0x33')](_0x48cde5[_0x1df4('0x2e')],_0x48cde5[_0x1df4('0x2f')]);_0x2fc895['attributes']=_[_0x1df4('0x33')](_0x48cde5['model'],qs[_0x1df4('0x34')](_0x1fc51d[_0x1df4('0x2f')][_0x1df4('0x34')]));_0x2fc895[_0x1df4('0x32')]=_0x2fc895['attributes'][_0x1df4('0x35')]?_0x2fc895[_0x1df4('0x32')]:_0x48cde5[_0x1df4('0x2e')];if(_0x1fc51d[_0x1df4('0x2f')]['includeAll']){_0x2fc895[_0x1df4('0x43')]=[{'all':!![]}];}_0x2fc895=_[_0x1df4('0x3f')]({},_0x2fc895,_0x1fc51d[_0x1df4('0x40')]);return db[_0x1df4('0x2a')][_0x1df4('0x49')](_0x2fc895)[_0x1df4('0x25')](handleEntityNotFound(_0x3b6d14,null))['then'](respondWithResult(_0x3b6d14,null))[_0x1df4('0x46')](handleError(_0x3b6d14,null));};exports[_0x1df4('0x4a')]=function(_0x5efb59,_0x55c100){return db[_0x1df4('0x2a')]['create'](_0x5efb59[_0x1df4('0x4b')],{})[_0x1df4('0x25')](respondWithResult(_0x55c100,0xc9))['catch'](handleError(_0x55c100,null));};exports[_0x1df4('0x24')]=function(_0x199f73,_0x11b1bf){if(_0x199f73[_0x1df4('0x4b')]['id']){delete _0x199f73['body']['id'];}return db[_0x1df4('0x2a')][_0x1df4('0x49')]({'where':{'id':_0x199f73[_0x1df4('0x48')]['id']}})['then'](handleEntityNotFound(_0x11b1bf,null))[_0x1df4('0x25')](saveUpdates(_0x199f73[_0x1df4('0x4b')],null))[_0x1df4('0x25')](respondWithResult(_0x11b1bf,null))[_0x1df4('0x46')](handleError(_0x11b1bf,null));};exports['destroy']=function(_0x7195bc,_0x556ee1){return db['SmsQueueReport'][_0x1df4('0x49')]({'where':{'id':_0x7195bc[_0x1df4('0x48')]['id']}})[_0x1df4('0x25')](handleEntityNotFound(_0x556ee1,null))[_0x1df4('0x25')](removeEntity(_0x556ee1,null))[_0x1df4('0x46')](handleError(_0x556ee1,null));};exports[_0x1df4('0x4c')]=function(_0x596258,_0x163f51){return db[_0x1df4('0x2a')][_0x1df4('0x4c')]()[_0x1df4('0x25')](respondWithResult(_0x163f51,null))[_0x1df4('0x46')](handleError(_0x163f51,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index e8e8b38..46d2daf 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x2a8b5c,_0x429c22){var _0x3bbefe=function(_0xb97fd2){while(--_0xb97fd2){_0x2a8b5c['push'](_0x2a8b5c['shift']());}};_0x3bbefe(++_0x429c22);}(_0xe706,0xa3));var _0x6e70=function(_0x48ea38,_0xb5b397){_0x48ea38=_0x48ea38-0x0;var _0xa6780=_0xe706[_0x48ea38];return _0xa6780;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x43a84a,_0x6c500e){var _0x2ed43a=function(_0x8f88c3){while(--_0x8f88c3){_0x43a84a['push'](_0x43a84a['shift']());}};_0x2ed43a(++_0x6c500e);}(_0xe706,0xa3));var _0x6e70=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0xe706[_0x59e7e0];return _0x26b058;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index ca8d78d..80d9e86 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 _0x4dd4=['catch','CreateSmsQueueReport','SmsQueueReport','options','stringify','UpdateSmsQueueReport','update','where','attributes','lodash','moment','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1c9b98,_0x309a1a){var _0x3bf5ca=function(_0x4d9516){while(--_0x4d9516){_0x1c9b98['push'](_0x1c9b98['shift']());}};_0x3bf5ca(++_0x309a1a);}(_0x4dd4,0x1c3));var _0x44dd=function(_0x3bf780,_0x2a43ee){_0x3bf780=_0x3bf780-0x0;var _0x113541=_0x4dd4[_0x3bf780];return _0x113541;};'use strict';var _=require(_0x44dd('0x0'));var util=require('util');var moment=require(_0x44dd('0x1'));var BPromise=require('bluebird');var rs=require(_0x44dd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44dd('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x44dd('0x4'));var jayson=require(_0x44dd('0x5'));var client=jayson['client'][_0x44dd('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dcd88,_0x11de22,_0x1280af){return new BPromise(function(_0xf0d004,_0x3bca4d){return client['request'](_0x1dcd88,_0x1280af)[_0x44dd('0x7')](function(_0x588b5c){logger[_0x44dd('0x8')](_0x44dd('0x9'),_0x11de22,_0x44dd('0xa'));logger[_0x44dd('0xb')](_0x44dd('0xc'),_0x11de22,_0x44dd('0xa'),JSON['stringify'](_0x588b5c));if(_0x588b5c[_0x44dd('0xd')]){if(_0x588b5c[_0x44dd('0xd')][_0x44dd('0xe')]===0x1f4){logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x588b5c[_0x44dd('0xd')]['message']);return _0x3bca4d(_0x588b5c['error'][_0x44dd('0xf')]);}logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x588b5c[_0x44dd('0xd')][_0x44dd('0xf')]);return _0xf0d004(_0x588b5c['error'][_0x44dd('0xf')]);}else{logger[_0x44dd('0x8')](_0x44dd('0x9'),_0x11de22,_0x44dd('0xa'));_0xf0d004(_0x588b5c[_0x44dd('0x10')][_0x44dd('0xf')]);}})[_0x44dd('0x11')](function(_0x374f4b){logger[_0x44dd('0xd')](_0x44dd('0x9'),_0x11de22,_0x374f4b);_0x3bca4d(_0x374f4b);});});}exports[_0x44dd('0x12')]=function(_0x1e2cce){var _0x14290a=this;return new Promise(function(_0x20a565,_0x4daea0){return db[_0x44dd('0x13')]['create'](_0x1e2cce['body'],{'raw':_0x1e2cce[_0x44dd('0x14')]?_0x1e2cce[_0x44dd('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x44dd('0x7')](function(_0x49e06a){logger['info'](_0x44dd('0x12'),_0x1e2cce);logger[_0x44dd('0xb')]('CreateSmsQueueReport',_0x1e2cce,JSON[_0x44dd('0x15')](_0x49e06a));_0x20a565(_0x49e06a);})['catch'](function(_0x9eab3d){logger[_0x44dd('0xd')](_0x44dd('0x12'),_0x9eab3d[_0x44dd('0xf')],_0x1e2cce);_0x4daea0(_0x14290a[_0x44dd('0xd')](0x1f4,_0x9eab3d[_0x44dd('0xf')]));});});};exports[_0x44dd('0x16')]=function(_0x44e630){var _0x3c1879=this;return new Promise(function(_0x5de9c0,_0x2956a4){return db[_0x44dd('0x13')][_0x44dd('0x17')](_0x44e630['body'],{'raw':_0x44e630['options']?_0x44e630[_0x44dd('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e630['options']?_0x44e630[_0x44dd('0x14')][_0x44dd('0x18')]||null:null,'attributes':_0x44e630[_0x44dd('0x14')]?_0x44e630[_0x44dd('0x14')][_0x44dd('0x19')]||null:null,'limit':_0x44e630['options']?_0x44e630[_0x44dd('0x14')]['limit']||null:null})[_0x44dd('0x7')](function(_0x1cd245){logger[_0x44dd('0x8')]('UpdateSmsQueueReport',_0x44e630);logger[_0x44dd('0xb')](_0x44dd('0x16'),_0x44e630,JSON[_0x44dd('0x15')](_0x1cd245));_0x5de9c0(_0x1cd245);})['catch'](function(_0xa07d57){logger[_0x44dd('0xd')](_0x44dd('0x16'),_0xa07d57['message'],_0x44e630);_0x2956a4(_0x3c1879[_0x44dd('0xd')](0x1f4,_0xa07d57['message']));});});}; \ No newline at end of file +var _0x5f72=['moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateSmsQueueReport','create','options','raw','catch','UpdateSmsQueueReport','SmsQueueReport','update','body','where','lodash','util'];(function(_0x5a031a,_0xaca19e){var _0x47703e=function(_0x35f3c6){while(--_0x35f3c6){_0x5a031a['push'](_0x5a031a['shift']());}};_0x47703e(++_0xaca19e);}(_0x5f72,0x1de));var _0x25f7=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x5f72[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0x25f7('0x0'));var util=require(_0x25f7('0x1'));var moment=require(_0x25f7('0x2'));var BPromise=require(_0x25f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25f7('0x4'))['db'];var utils=require(_0x25f7('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x25f7('0x6'));var jayson=require(_0x25f7('0x7'));var client=jayson[_0x25f7('0x8')][_0x25f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44c03f,_0x40a4aa,_0x106522){return new BPromise(function(_0x16d5b6,_0x291ffb){return client[_0x25f7('0xa')](_0x44c03f,_0x106522)[_0x25f7('0xb')](function(_0xfb2dc4){logger[_0x25f7('0xc')](_0x25f7('0xd'),_0x40a4aa,'request\x20sent');logger[_0x25f7('0xe')](_0x25f7('0xf'),_0x40a4aa,'request\x20sent',JSON[_0x25f7('0x10')](_0xfb2dc4));if(_0xfb2dc4['error']){if(_0xfb2dc4[_0x25f7('0x11')][_0x25f7('0x12')]===0x1f4){logger[_0x25f7('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x40a4aa,_0xfb2dc4[_0x25f7('0x11')][_0x25f7('0x13')]);return _0x291ffb(_0xfb2dc4[_0x25f7('0x11')]['message']);}logger[_0x25f7('0x11')](_0x25f7('0xd'),_0x40a4aa,_0xfb2dc4[_0x25f7('0x11')][_0x25f7('0x13')]);return _0x16d5b6(_0xfb2dc4['error'][_0x25f7('0x13')]);}else{logger[_0x25f7('0xc')](_0x25f7('0xd'),_0x40a4aa,_0x25f7('0x14'));_0x16d5b6(_0xfb2dc4[_0x25f7('0x15')][_0x25f7('0x13')]);}})['catch'](function(_0x4f04ce){logger[_0x25f7('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x40a4aa,_0x4f04ce);_0x291ffb(_0x4f04ce);});});}exports[_0x25f7('0x16')]=function(_0x391905){var _0x158227=this;return new Promise(function(_0x5cca58,_0x2d313e){return db['SmsQueueReport'][_0x25f7('0x17')](_0x391905['body'],{'raw':_0x391905[_0x25f7('0x18')]?_0x391905[_0x25f7('0x18')][_0x25f7('0x19')]===undefined?!![]:![]:!![]})[_0x25f7('0xb')](function(_0x4beb48){logger[_0x25f7('0xc')](_0x25f7('0x16'),_0x391905);logger[_0x25f7('0xe')]('CreateSmsQueueReport',_0x391905,JSON[_0x25f7('0x10')](_0x4beb48));_0x5cca58(_0x4beb48);})[_0x25f7('0x1a')](function(_0x445da7){logger[_0x25f7('0x11')](_0x25f7('0x16'),_0x445da7[_0x25f7('0x13')],_0x391905);_0x2d313e(_0x158227[_0x25f7('0x11')](0x1f4,_0x445da7['message']));});});};exports[_0x25f7('0x1b')]=function(_0x25de23){var _0x3d9fe5=this;return new Promise(function(_0x1855bc,_0x3beb3b){return db[_0x25f7('0x1c')][_0x25f7('0x1d')](_0x25de23[_0x25f7('0x1e')],{'raw':_0x25de23[_0x25f7('0x18')]?_0x25de23[_0x25f7('0x18')][_0x25f7('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25de23[_0x25f7('0x18')]?_0x25de23['options'][_0x25f7('0x1f')]||null:null,'attributes':_0x25de23[_0x25f7('0x18')]?_0x25de23['options']['attributes']||null:null,'limit':_0x25de23[_0x25f7('0x18')]?_0x25de23[_0x25f7('0x18')]['limit']||null:null})['then'](function(_0x43529c){logger[_0x25f7('0xc')]('UpdateSmsQueueReport',_0x25de23);logger['debug'](_0x25f7('0x1b'),_0x25de23,JSON[_0x25f7('0x10')](_0x43529c));_0x1855bc(_0x43529c);})[_0x25f7('0x1a')](function(_0x38874f){logger[_0x25f7('0x11')](_0x25f7('0x1b'),_0x38874f[_0x25f7('0x13')],_0x25de23);_0x3beb3b(_0x3d9fe5[_0x25f7('0x11')](0x1f4,_0x38874f['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 32b4fb7..8aa5458 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 _0x7d9f=['isAuthenticated','describe','/:id','show','post','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index','get'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x6f114,_0x2ac0f9){_0x6f114=_0x6f114-0x0;var _0x40546b=_0x7d9f[_0x6f114];return _0x40546b;};'use strict';var multer=require(_0xf7d9('0x0'));var util=require(_0xf7d9('0x1'));var path=require(_0xf7d9('0x2'));var timeout=require(_0xf7d9('0x3'));var express=require(_0xf7d9('0x4'));var router=express['Router']();var fs_extra=require(_0xf7d9('0x5'));var auth=require(_0xf7d9('0x6'));var interaction=require(_0xf7d9('0x7'));var config=require(_0xf7d9('0x8'));var controller=require(_0xf7d9('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xf7d9('0xa')]);router[_0xf7d9('0xb')]('/describe',auth[_0xf7d9('0xc')](),controller[_0xf7d9('0xd')]);router['get'](_0xf7d9('0xe'),auth['isAuthenticated'](),controller[_0xf7d9('0xf')]);router[_0xf7d9('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf7d9('0x11')](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller['update']);router['delete'](_0xf7d9('0xe'),auth[_0xf7d9('0xc')](),controller[_0xf7d9('0x12')]);module[_0xf7d9('0x13')]=router; \ No newline at end of file +var _0x32ef=['show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x20608a,_0x24f71c){var _0x3d841f=function(_0x4c8320){while(--_0x4c8320){_0x20608a['push'](_0x20608a['shift']());}};_0x3d841f(++_0x24f71c);}(_0x32ef,0xf9));var _0xf32e=function(_0x1b3c93,_0x9d3a75){_0x1b3c93=_0x1b3c93-0x0;var _0x4f514a=_0x32ef[_0x1b3c93];return _0x4f514a;};'use strict';var multer=require(_0xf32e('0x0'));var util=require(_0xf32e('0x1'));var path=require(_0xf32e('0x2'));var timeout=require(_0xf32e('0x3'));var express=require(_0xf32e('0x4'));var router=express[_0xf32e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf32e('0x6'));var interaction=require(_0xf32e('0x7'));var config=require('../../config/environment');var controller=require(_0xf32e('0x8'));router[_0xf32e('0x9')]('/',auth[_0xf32e('0xa')](),controller[_0xf32e('0xb')]);router[_0xf32e('0x9')](_0xf32e('0xc'),auth['isAuthenticated'](),controller[_0xf32e('0xd')]);router['get'](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0xf')]);router[_0xf32e('0x10')]('/',auth[_0xf32e('0xa')](),controller['create']);router[_0xf32e('0x11')](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x12')]);router[_0xf32e('0x13')](_0xf32e('0xe'),auth[_0xf32e('0xa')](),controller[_0xf32e('0x14')]);module[_0xf32e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 66ac4a8..41edb76 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2d9f26,_0x10e8dd){var _0x5c7562=function(_0xc15ae9){while(--_0xc15ae9){_0x2d9f26['push'](_0x2d9f26['shift']());}};_0x5c7562(++_0x10e8dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x56bfaa,_0x5bc286){var _0x48f93b=function(_0xa3aab2){while(--_0xa3aab2){_0x56bfaa['push'](_0x56bfaa['shift']());}};_0x48f93b(++_0x5bc286);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x7c0074,_0x1ffdcf){_0x7c0074=_0x7c0074-0x0;var _0x13e95b=_0xcb91[_0x7c0074];return _0x13e95b;};'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 5dacb47..145216e 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 _0xd5bc=['key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','includeAll','include','findAll','rows','length','catch','create','body','find','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','SmsTransferReport','rawAttributes','type'];(function(_0x14d250,_0x4b2e12){var _0xb991d8=function(_0x4ea76d){while(--_0x4ea76d){_0x14d250['push'](_0x14d250['shift']());}};_0xb991d8(++_0x4b2e12);}(_0xd5bc,0x1e2));var _0xcd5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5bc[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcd5b('0x0'));var jsonpatch=require(_0xcd5b('0x1'));var rp=require(_0xcd5b('0x2'));var moment=require(_0xcd5b('0x3'));var BPromise=require(_0xcd5b('0x4'));var Mustache=require(_0xcd5b('0x5'));var util=require(_0xcd5b('0x6'));var path=require(_0xcd5b('0x7'));var sox=require(_0xcd5b('0x8'));var csv=require(_0xcd5b('0x9'));var ejs=require(_0xcd5b('0xa'));var fs=require('fs');var fs_extra=require(_0xcd5b('0xb'));var _=require(_0xcd5b('0xc'));var squel=require(_0xcd5b('0xd'));var crypto=require(_0xcd5b('0xe'));var jsforce=require(_0xcd5b('0xf'));var deskjs=require(_0xcd5b('0x10'));var toCsv=require(_0xcd5b('0x9'));var querystring=require(_0xcd5b('0x11'));var Papa=require(_0xcd5b('0x12'));var Redis=require('ioredis');var authService=require(_0xcd5b('0x13'));var qs=require(_0xcd5b('0x14'));var as=require(_0xcd5b('0x15'));var hardwareService=require(_0xcd5b('0x16'));var logger=require(_0xcd5b('0x17'))('api');var utils=require(_0xcd5b('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xcd5b('0x19'));var db=require(_0xcd5b('0x1a'))['db'];function respondWithStatusCode(_0x27c2b0,_0x229bf3){_0x229bf3=_0x229bf3||0xcc;return function(_0x1e989a){if(_0x1e989a){return _0x27c2b0[_0xcd5b('0x1b')](_0x229bf3);}return _0x27c2b0[_0xcd5b('0x1c')](_0x229bf3)[_0xcd5b('0x1d')]();};}function respondWithResult(_0x5b16bc,_0x5eef08){_0x5eef08=_0x5eef08||0xc8;return function(_0x447b76){if(_0x447b76){return _0x5b16bc[_0xcd5b('0x1c')](_0x5eef08)[_0xcd5b('0x1e')](_0x447b76);}};}function respondWithFilteredResult(_0x5d491f,_0x50b2d1){return function(_0x3e4501){if(_0x3e4501){var _0x5b531a=typeof _0x50b2d1[_0xcd5b('0x1f')]==='undefined'&&typeof _0x50b2d1[_0xcd5b('0x20')]===_0xcd5b('0x21');var _0x426a65=_0x3e4501[_0xcd5b('0x22')];var _0x487a25=_0x5b531a?0x0:_0x50b2d1[_0xcd5b('0x1f')];var _0x546210=_0x5b531a?_0x3e4501['count']:_0x50b2d1['offset']+_0x50b2d1['limit'];var _0x36469d;if(_0x546210>=_0x426a65){_0x546210=_0x426a65;_0x36469d=0xc8;}else{_0x36469d=0xce;}_0x5d491f[_0xcd5b('0x1c')](_0x36469d);return _0x5d491f[_0xcd5b('0x23')](_0xcd5b('0x24'),_0x487a25+'-'+_0x546210+'/'+_0x426a65)[_0xcd5b('0x1e')](_0x3e4501);}return null;};}function patchUpdates(_0x63f7fe){return function(_0x486c83){try{jsonpatch[_0xcd5b('0x25')](_0x486c83,_0x63f7fe,!![]);}catch(_0x207760){return BPromise[_0xcd5b('0x26')](_0x207760);}return _0x486c83[_0xcd5b('0x27')]();};}function saveUpdates(_0x43ae43,_0x425c93){return function(_0x2179c1){if(_0x2179c1){return _0x2179c1[_0xcd5b('0x28')](_0x43ae43)[_0xcd5b('0x29')](function(_0xe85c7e){return _0xe85c7e;});}return null;};}function removeEntity(_0x2a5aa9,_0x1afb50){return function(_0x54066d){if(_0x54066d){return _0x54066d[_0xcd5b('0x2a')]()['then'](function(){_0x2a5aa9[_0xcd5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x417305,_0x54f222){return function(_0x1eda84){if(!_0x1eda84){_0x417305['sendStatus'](0x194);}return _0x1eda84;};}function handleError(_0x51ddc3,_0x444541){_0x444541=_0x444541||0x1f4;return function(_0x1eb83b){logger['error'](_0x1eb83b[_0xcd5b('0x2b')]);if(_0x1eb83b[_0xcd5b('0x2c')]){delete _0x1eb83b['name'];}_0x51ddc3['status'](_0x444541)[_0xcd5b('0x2d')](_0x1eb83b);};}exports[_0xcd5b('0x2e')]=function(_0x20cd45,_0x10ab99){var _0x318b76={},_0x1a0ede={},_0x3ad452={'count':0x0,'rows':[]};var _0x3b0ec1=_['map'](db[_0xcd5b('0x2f')][_0xcd5b('0x30')],function(_0x4c23e0){return{'name':_0x4c23e0['fieldName'],'type':_0x4c23e0[_0xcd5b('0x31')][_0xcd5b('0x32')]};});_0x1a0ede[_0xcd5b('0x33')]=_[_0xcd5b('0x34')](_0x3b0ec1,_0xcd5b('0x2c'));_0x1a0ede['query']=_[_0xcd5b('0x35')](_0x20cd45[_0xcd5b('0x36')]);_0x1a0ede[_0xcd5b('0x37')]=_[_0xcd5b('0x38')](_0x1a0ede[_0xcd5b('0x33')],_0x1a0ede['query']);_0x318b76[_0xcd5b('0x39')]=_['intersection'](_0x1a0ede[_0xcd5b('0x33')],qs['fields'](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x3a')]));_0x318b76['attributes']=_0x318b76[_0xcd5b('0x39')]['length']?_0x318b76[_0xcd5b('0x39')]:_0x1a0ede['model'];if(!_0x20cd45['query'][_0xcd5b('0x3b')]('nolimit')){_0x318b76[_0xcd5b('0x20')]=qs[_0xcd5b('0x20')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x20')]);_0x318b76[_0xcd5b('0x1f')]=qs[_0xcd5b('0x1f')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x1f')]);}_0x318b76[_0xcd5b('0x3c')]=qs[_0xcd5b('0x3d')](_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x3d')]);_0x318b76[_0xcd5b('0x3e')]=qs[_0xcd5b('0x37')](_[_0xcd5b('0x3f')](_0x20cd45[_0xcd5b('0x36')],_0x1a0ede[_0xcd5b('0x37')]),_0x3b0ec1);if(_0x20cd45['query']['filter']){_0x318b76[_0xcd5b('0x3e')]=_[_0xcd5b('0x40')](_0x318b76[_0xcd5b('0x3e')],{'$or':_['map'](_0x3b0ec1,function(_0x5e87cb){if(_0x5e87cb[_0xcd5b('0x31')]!=='VIRTUAL'){var _0xf9a774={};_0xf9a774[_0x5e87cb[_0xcd5b('0x2c')]]={'$like':'%'+_0x20cd45[_0xcd5b('0x36')]['filter']+'%'};return _0xf9a774;}})});}_0x318b76=_['merge']({},_0x318b76,_0x20cd45['options']);var _0x55afa5={'where':_0x318b76[_0xcd5b('0x3e')]};return db[_0xcd5b('0x2f')]['count'](_0x55afa5)[_0xcd5b('0x29')](function(_0x1e8536){_0x3ad452[_0xcd5b('0x22')]=_0x1e8536;if(_0x20cd45[_0xcd5b('0x36')][_0xcd5b('0x41')]){_0x318b76[_0xcd5b('0x42')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xcd5b('0x43')](_0x318b76);})[_0xcd5b('0x29')](function(_0xa779cd){_0x3ad452[_0xcd5b('0x44')]=_0xa779cd;return _0x3ad452;})[_0xcd5b('0x29')](respondWithFilteredResult(_0x10ab99,_0x318b76))['catch'](handleError(_0x10ab99,null));};exports['show']=function(_0x1413e2,_0x3955ba){var _0x5695ed={'raw':!![],'where':{'id':_0x1413e2['params']['id']}},_0x50831d={};_0x50831d['model']=_['keys'](db['SmsTransferReport']['rawAttributes']);_0x50831d[_0xcd5b('0x36')]=_[_0xcd5b('0x35')](_0x1413e2[_0xcd5b('0x36')]);_0x50831d[_0xcd5b('0x37')]=_[_0xcd5b('0x38')](_0x50831d[_0xcd5b('0x33')],_0x50831d[_0xcd5b('0x36')]);_0x5695ed['attributes']=_[_0xcd5b('0x38')](_0x50831d[_0xcd5b('0x33')],qs['fields'](_0x1413e2[_0xcd5b('0x36')][_0xcd5b('0x3a')]));_0x5695ed[_0xcd5b('0x39')]=_0x5695ed[_0xcd5b('0x39')][_0xcd5b('0x45')]?_0x5695ed[_0xcd5b('0x39')]:_0x50831d[_0xcd5b('0x33')];if(_0x1413e2[_0xcd5b('0x36')][_0xcd5b('0x41')]){_0x5695ed['include']=[{'all':!![]}];}_0x5695ed=_[_0xcd5b('0x40')]({},_0x5695ed,_0x1413e2['options']);return db[_0xcd5b('0x2f')]['find'](_0x5695ed)[_0xcd5b('0x29')](handleEntityNotFound(_0x3955ba,null))[_0xcd5b('0x29')](respondWithResult(_0x3955ba,null))[_0xcd5b('0x46')](handleError(_0x3955ba,null));};exports[_0xcd5b('0x47')]=function(_0x516160,_0x3b63e6){return db['SmsTransferReport'][_0xcd5b('0x47')](_0x516160[_0xcd5b('0x48')],{})[_0xcd5b('0x29')](respondWithResult(_0x3b63e6,0xc9))[_0xcd5b('0x46')](handleError(_0x3b63e6,null));};exports['update']=function(_0x3dcf47,_0x24f42f){if(_0x3dcf47[_0xcd5b('0x48')]['id']){delete _0x3dcf47[_0xcd5b('0x48')]['id'];}return db[_0xcd5b('0x2f')][_0xcd5b('0x49')]({'where':{'id':_0x3dcf47[_0xcd5b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x24f42f,null))['then'](saveUpdates(_0x3dcf47[_0xcd5b('0x48')],null))[_0xcd5b('0x29')](respondWithResult(_0x24f42f,null))['catch'](handleError(_0x24f42f,null));};exports[_0xcd5b('0x2a')]=function(_0x42ca24,_0x5d0662){return db['SmsTransferReport'][_0xcd5b('0x49')]({'where':{'id':_0x42ca24[_0xcd5b('0x4a')]['id']}})[_0xcd5b('0x29')](handleEntityNotFound(_0x5d0662,null))['then'](removeEntity(_0x5d0662,null))[_0xcd5b('0x46')](handleError(_0x5d0662,null));};exports[_0xcd5b('0x4b')]=function(_0x34b533,_0x452048){return db['SmsTransferReport'][_0xcd5b('0x4b')]()['then'](respondWithResult(_0x452048,null))[_0xcd5b('0x46')](handleError(_0x452048,null));}; \ No newline at end of file +var _0x0f5b=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','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/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','destroy','then','error','stack','name','send','SmsTransferReport','rawAttributes','fieldName','type','key'];(function(_0x4b352f,_0x2c3ac1){var _0xb78495=function(_0x1d47df){while(--_0x1d47df){_0x4b352f['push'](_0x4b352f['shift']());}};_0xb78495(++_0x2c3ac1);}(_0x0f5b,0xb8));var _0xb0f5=function(_0x5d099e,_0x5c9423){_0x5d099e=_0x5d099e-0x0;var _0x14a37b=_0x0f5b[_0x5d099e];return _0x14a37b;};'use strict';var emlformat=require(_0xb0f5('0x0'));var rimraf=require(_0xb0f5('0x1'));var zipdir=require(_0xb0f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0f5('0x3'));var moment=require(_0xb0f5('0x4'));var BPromise=require(_0xb0f5('0x5'));var Mustache=require(_0xb0f5('0x6'));var util=require(_0xb0f5('0x7'));var path=require('path');var sox=require(_0xb0f5('0x8'));var csv=require(_0xb0f5('0x9'));var ejs=require(_0xb0f5('0xa'));var fs=require('fs');var fs_extra=require(_0xb0f5('0xb'));var _=require(_0xb0f5('0xc'));var squel=require(_0xb0f5('0xd'));var crypto=require(_0xb0f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb0f5('0xf'));var toCsv=require(_0xb0f5('0x9'));var querystring=require('querystring');var Papa=require(_0xb0f5('0x10'));var Redis=require(_0xb0f5('0x11'));var authService=require(_0xb0f5('0x12'));var qs=require(_0xb0f5('0x13'));var as=require(_0xb0f5('0x14'));var hardwareService=require(_0xb0f5('0x15'));var logger=require(_0xb0f5('0x16'))(_0xb0f5('0x17'));var utils=require(_0xb0f5('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0f5('0x19'));var db=require(_0xb0f5('0x1a'))['db'];function respondWithStatusCode(_0x56094a,_0x5d4d88){_0x5d4d88=_0x5d4d88||0xcc;return function(_0x207430){if(_0x207430){return _0x56094a[_0xb0f5('0x1b')](_0x5d4d88);}return _0x56094a[_0xb0f5('0x1c')](_0x5d4d88)[_0xb0f5('0x1d')]();};}function respondWithResult(_0x144381,_0x1c317b){_0x1c317b=_0x1c317b||0xc8;return function(_0x5ea33a){if(_0x5ea33a){return _0x144381[_0xb0f5('0x1c')](_0x1c317b)[_0xb0f5('0x1e')](_0x5ea33a);}};}function respondWithFilteredResult(_0x2cc66c,_0x37c8be){return function(_0xa9858d){if(_0xa9858d){var _0x300d40=typeof _0x37c8be['offset']==='undefined'&&typeof _0x37c8be[_0xb0f5('0x1f')]==='undefined';var _0x5ad260=_0xa9858d[_0xb0f5('0x20')];var _0x287f0f=_0x300d40?0x0:_0x37c8be[_0xb0f5('0x21')];var _0x4e4efc=_0x300d40?_0xa9858d[_0xb0f5('0x20')]:_0x37c8be[_0xb0f5('0x21')]+_0x37c8be[_0xb0f5('0x1f')];var _0x4e8d1a;if(_0x4e4efc>=_0x5ad260){_0x4e4efc=_0x5ad260;_0x4e8d1a=0xc8;}else{_0x4e8d1a=0xce;}_0x2cc66c[_0xb0f5('0x1c')](_0x4e8d1a);return _0x2cc66c[_0xb0f5('0x22')]('Content-Range',_0x287f0f+'-'+_0x4e4efc+'/'+_0x5ad260)['json'](_0xa9858d);}return null;};}function patchUpdates(_0x54694b){return function(_0x2483ad){try{jsonpatch[_0xb0f5('0x23')](_0x2483ad,_0x54694b,!![]);}catch(_0x574984){return BPromise['reject'](_0x574984);}return _0x2483ad['save']();};}function saveUpdates(_0x2922eb,_0x3de8f9){return function(_0x2353da){if(_0x2353da){return _0x2353da['update'](_0x2922eb)['then'](function(_0x229c1f){return _0x229c1f;});}return null;};}function removeEntity(_0x18366a,_0x40062b){return function(_0x151ea5){if(_0x151ea5){return _0x151ea5[_0xb0f5('0x24')]()[_0xb0f5('0x25')](function(){_0x18366a[_0xb0f5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x99fc53,_0xa42729){return function(_0x5538bd){if(!_0x5538bd){_0x99fc53['sendStatus'](0x194);}return _0x5538bd;};}function handleError(_0xdcf15c,_0x4b0430){_0x4b0430=_0x4b0430||0x1f4;return function(_0x55add4){logger[_0xb0f5('0x26')](_0x55add4[_0xb0f5('0x27')]);if(_0x55add4[_0xb0f5('0x28')]){delete _0x55add4['name'];}_0xdcf15c[_0xb0f5('0x1c')](_0x4b0430)[_0xb0f5('0x29')](_0x55add4);};}exports['index']=function(_0x3425d8,_0x3b1b0a){var _0x1a6d88={},_0x3ec185={},_0x477c85={'count':0x0,'rows':[]};var _0x4c8c46=_['map'](db[_0xb0f5('0x2a')][_0xb0f5('0x2b')],function(_0x5d4a2f){return{'name':_0x5d4a2f[_0xb0f5('0x2c')],'type':_0x5d4a2f[_0xb0f5('0x2d')][_0xb0f5('0x2e')]};});_0x3ec185[_0xb0f5('0x2f')]=_['map'](_0x4c8c46,_0xb0f5('0x28'));_0x3ec185[_0xb0f5('0x30')]=_['keys'](_0x3425d8['query']);_0x3ec185[_0xb0f5('0x31')]=_[_0xb0f5('0x32')](_0x3ec185[_0xb0f5('0x2f')],_0x3ec185[_0xb0f5('0x30')]);_0x1a6d88[_0xb0f5('0x33')]=_[_0xb0f5('0x32')](_0x3ec185[_0xb0f5('0x2f')],qs[_0xb0f5('0x34')](_0x3425d8[_0xb0f5('0x30')][_0xb0f5('0x34')]));_0x1a6d88[_0xb0f5('0x33')]=_0x1a6d88[_0xb0f5('0x33')][_0xb0f5('0x35')]?_0x1a6d88[_0xb0f5('0x33')]:_0x3ec185[_0xb0f5('0x2f')];if(!_0x3425d8[_0xb0f5('0x30')][_0xb0f5('0x36')]('nolimit')){_0x1a6d88['limit']=qs[_0xb0f5('0x1f')](_0x3425d8['query'][_0xb0f5('0x1f')]);_0x1a6d88['offset']=qs[_0xb0f5('0x21')](_0x3425d8[_0xb0f5('0x30')]['offset']);}_0x1a6d88[_0xb0f5('0x37')]=qs[_0xb0f5('0x38')](_0x3425d8[_0xb0f5('0x30')]['sort']);_0x1a6d88[_0xb0f5('0x39')]=qs[_0xb0f5('0x31')](_[_0xb0f5('0x3a')](_0x3425d8[_0xb0f5('0x30')],_0x3ec185[_0xb0f5('0x31')]),_0x4c8c46);if(_0x3425d8[_0xb0f5('0x30')][_0xb0f5('0x3b')]){_0x1a6d88['where']=_[_0xb0f5('0x3c')](_0x1a6d88[_0xb0f5('0x39')],{'$or':_[_0xb0f5('0x3d')](_0x4c8c46,function(_0x1b8efb){if(_0x1b8efb[_0xb0f5('0x2d')]!==_0xb0f5('0x3e')){var _0x5ce071={};_0x5ce071[_0x1b8efb[_0xb0f5('0x28')]]={'$like':'%'+_0x3425d8[_0xb0f5('0x30')][_0xb0f5('0x3b')]+'%'};return _0x5ce071;}})});}_0x1a6d88=_[_0xb0f5('0x3c')]({},_0x1a6d88,_0x3425d8[_0xb0f5('0x3f')]);var _0x5ea846={'where':_0x1a6d88[_0xb0f5('0x39')]};return db['SmsTransferReport']['count'](_0x5ea846)[_0xb0f5('0x25')](function(_0x9ad7f6){_0x477c85[_0xb0f5('0x20')]=_0x9ad7f6;if(_0x3425d8[_0xb0f5('0x30')][_0xb0f5('0x40')]){_0x1a6d88[_0xb0f5('0x41')]=[{'all':!![]}];}return db[_0xb0f5('0x2a')][_0xb0f5('0x42')](_0x1a6d88);})[_0xb0f5('0x25')](function(_0x562ed0){_0x477c85[_0xb0f5('0x43')]=_0x562ed0;return _0x477c85;})[_0xb0f5('0x25')](respondWithFilteredResult(_0x3b1b0a,_0x1a6d88))['catch'](handleError(_0x3b1b0a,null));};exports[_0xb0f5('0x44')]=function(_0x128599,_0x528b25){var _0x1400d2={'raw':!![],'where':{'id':_0x128599[_0xb0f5('0x45')]['id']}},_0x20b373={};_0x20b373['model']=_[_0xb0f5('0x46')](db[_0xb0f5('0x2a')][_0xb0f5('0x2b')]);_0x20b373['query']=_[_0xb0f5('0x46')](_0x128599[_0xb0f5('0x30')]);_0x20b373[_0xb0f5('0x31')]=_[_0xb0f5('0x32')](_0x20b373['model'],_0x20b373[_0xb0f5('0x30')]);_0x1400d2['attributes']=_[_0xb0f5('0x32')](_0x20b373[_0xb0f5('0x2f')],qs[_0xb0f5('0x34')](_0x128599[_0xb0f5('0x30')][_0xb0f5('0x34')]));_0x1400d2[_0xb0f5('0x33')]=_0x1400d2[_0xb0f5('0x33')][_0xb0f5('0x35')]?_0x1400d2[_0xb0f5('0x33')]:_0x20b373[_0xb0f5('0x2f')];if(_0x128599['query'][_0xb0f5('0x40')]){_0x1400d2[_0xb0f5('0x41')]=[{'all':!![]}];}_0x1400d2=_['merge']({},_0x1400d2,_0x128599['options']);return db[_0xb0f5('0x2a')][_0xb0f5('0x47')](_0x1400d2)[_0xb0f5('0x25')](handleEntityNotFound(_0x528b25,null))['then'](respondWithResult(_0x528b25,null))['catch'](handleError(_0x528b25,null));};exports[_0xb0f5('0x48')]=function(_0x3b70e8,_0x429f3b){return db[_0xb0f5('0x2a')]['create'](_0x3b70e8['body'],{})[_0xb0f5('0x25')](respondWithResult(_0x429f3b,0xc9))[_0xb0f5('0x49')](handleError(_0x429f3b,null));};exports[_0xb0f5('0x4a')]=function(_0x221038,_0x31d798){if(_0x221038[_0xb0f5('0x4b')]['id']){delete _0x221038[_0xb0f5('0x4b')]['id'];}return db['SmsTransferReport'][_0xb0f5('0x47')]({'where':{'id':_0x221038['params']['id']}})['then'](handleEntityNotFound(_0x31d798,null))[_0xb0f5('0x25')](saveUpdates(_0x221038[_0xb0f5('0x4b')],null))[_0xb0f5('0x25')](respondWithResult(_0x31d798,null))[_0xb0f5('0x49')](handleError(_0x31d798,null));};exports[_0xb0f5('0x24')]=function(_0x3cd3dd,_0x3d55bd){return db[_0xb0f5('0x2a')][_0xb0f5('0x47')]({'where':{'id':_0x3cd3dd[_0xb0f5('0x45')]['id']}})[_0xb0f5('0x25')](handleEntityNotFound(_0x3d55bd,null))[_0xb0f5('0x25')](removeEntity(_0x3d55bd,null))[_0xb0f5('0x49')](handleError(_0x3d55bd,null));};exports['describe']=function(_0x426d53,_0x2731d6){return db[_0xb0f5('0x2a')][_0xb0f5('0x4c')]()['then'](respondWithResult(_0x2731d6,null))['catch'](handleError(_0x2731d6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index e6801f4..619d079 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 _0xd6ce=['bluebird','request-promise','path','./smsTransferReport.attributes','exports','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xd6ce,0x127));var _0xed6c=function(_0x156d4,_0x37c674){_0x156d4=_0x156d4-0x0;var _0x52637b=_0xd6ce[_0x156d4];return _0x52637b;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var logger=require(_0xed6c('0x2'))(_0xed6c('0x3'));var moment=require(_0xed6c('0x4'));var BPromise=require(_0xed6c('0x5'));var rp=require(_0xed6c('0x6'));var fs=require('fs');var path=require(_0xed6c('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xed6c('0x8'));module[_0xed6c('0x9')]=function(_0x1a6d96,_0x1d0912){return _0x1a6d96['define']('SmsTransferReport',attributes,{'tableName':_0xed6c('0xa'),'paranoid':![],'indexes':[{'name':_0xed6c('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x331c=['rimraf','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','bluebird'];(function(_0x199408,_0x52c098){var _0x241cda=function(_0x1e5257){while(--_0x1e5257){_0x199408['push'](_0x199408['shift']());}};_0x241cda(++_0x52c098);}(_0x331c,0xf0));var _0xc331=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x331c[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0xc331('0x0'));var util=require('util');var logger=require(_0xc331('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc331('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc331('0x3'));var config=require('../../config/environment');var attributes=require(_0xc331('0x4'));module[_0xc331('0x5')]=function(_0x567fe9,_0x14a44f){return _0x567fe9[_0xc331('0x6')]('SmsTransferReport',attributes,{'tableName':_0xc331('0x7'),'paranoid':![],'indexes':[{'name':_0xc331('0x8'),'fields':[_0xc331('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 812310d..74b340c 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 _0x2494=['../../config/utils','../../config/environment','client','http','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37974b,_0xf0a0f8){var _0x1824b7=function(_0x186b92){while(--_0x186b92){_0x37974b['push'](_0x37974b['shift']());}};_0x1824b7(++_0xf0a0f8);}(_0x2494,0x82));var _0x4249=function(_0xd84ab3,_0x4c4a5f){_0xd84ab3=_0xd84ab3-0x0;var _0x3f534b=_0x2494[_0xd84ab3];return _0x3f534b;};'use strict';var _=require(_0x4249('0x0'));var util=require('util');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var rs=require(_0x4249('0x3'));var fs=require('fs');var Redis=require(_0x4249('0x4'));var db=require(_0x4249('0x5'))['db'];var utils=require(_0x4249('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4249('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4249('0x8')][_0x4249('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xed716a,_0x5b1b17,_0x326336){return new BPromise(function(_0x2b7934,_0x21060d){return client['request'](_0xed716a,_0x326336)['then'](function(_0x3efaa6){logger[_0x4249('0xa')](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));logger[_0x4249('0xd')](_0x4249('0xe'),_0x5b1b17,_0x4249('0xc'),JSON['stringify'](_0x3efaa6));if(_0x3efaa6['error']){if(_0x3efaa6[_0x4249('0xf')]['code']===0x1f4){logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6['error'][_0x4249('0x10')]);return _0x21060d(_0x3efaa6[_0x4249('0xf')]['message']);}logger[_0x4249('0xf')](_0x4249('0xb'),_0x5b1b17,_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);return _0x2b7934(_0x3efaa6[_0x4249('0xf')][_0x4249('0x10')]);}else{logger['info'](_0x4249('0xb'),_0x5b1b17,_0x4249('0xc'));_0x2b7934(_0x3efaa6['result'][_0x4249('0x10')]);}})['catch'](function(_0x501e9c){logger['error'](_0x4249('0xb'),_0x5b1b17,_0x501e9c);_0x21060d(_0x501e9c);});});} \ No newline at end of file +var _0xa348=['../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0xa348,0xb2));var _0x8a34=function(_0xad7c67,_0x1c92b9){_0xad7c67=_0xad7c67-0x0;var _0x53117b=_0xa348[_0xad7c67];return _0x53117b;};'use strict';var _=require(_0x8a34('0x0'));var util=require('util');var moment=require(_0x8a34('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a34('0x2'))['db'];var utils=require(_0x8a34('0x3'));var logger=require(_0x8a34('0x4'))(_0x8a34('0x5'));var config=require(_0x8a34('0x6'));var jayson=require(_0x8a34('0x7'));var client=jayson[_0x8a34('0x8')][_0x8a34('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26722e,_0xcefee9,_0x4d6455){return new BPromise(function(_0x43043e,_0x160b71){return client[_0x8a34('0xa')](_0x26722e,_0x4d6455)[_0x8a34('0xb')](function(_0x4cfb1d){logger[_0x8a34('0xc')](_0x8a34('0xd'),_0xcefee9,'request\x20sent');logger[_0x8a34('0xe')](_0x8a34('0xf'),_0xcefee9,_0x8a34('0x10'),JSON[_0x8a34('0x11')](_0x4cfb1d));if(_0x4cfb1d[_0x8a34('0x12')]){if(_0x4cfb1d[_0x8a34('0x12')][_0x8a34('0x13')]===0x1f4){logger[_0x8a34('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0xcefee9,_0x4cfb1d['error'][_0x8a34('0x14')]);return _0x160b71(_0x4cfb1d[_0x8a34('0x12')]['message']);}logger[_0x8a34('0x12')](_0x8a34('0xd'),_0xcefee9,_0x4cfb1d[_0x8a34('0x12')][_0x8a34('0x14')]);return _0x43043e(_0x4cfb1d[_0x8a34('0x12')][_0x8a34('0x14')]);}else{logger[_0x8a34('0xc')](_0x8a34('0xd'),_0xcefee9,_0x8a34('0x10'));_0x43043e(_0x4cfb1d[_0x8a34('0x15')]['message']);}})[_0x8a34('0x16')](function(_0x10cb3b){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xcefee9,_0x10cb3b);_0x160b71(_0x10cb3b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 02d3807..d7f022e 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 _0x4cc7=['express','Router','../../components/auth/service','../../components/interaction/service','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','now','extname','post','single','file','create','update','delete','exports','multer','util','connect-timeout'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x4cc7,0x190));var _0x74cc=function(_0x126c60,_0x4bda13){_0x126c60=_0x126c60-0x0;var _0x3110e0=_0x4cc7[_0x126c60];return _0x3110e0;};'use strict';var multer=require(_0x74cc('0x0'));var util=require(_0x74cc('0x1'));var path=require('path');var timeout=require(_0x74cc('0x2'));var express=require(_0x74cc('0x3'));var router=express[_0x74cc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x74cc('0x5'));var interaction=require(_0x74cc('0x6'));var config=require('../../config/environment');var controller=require(_0x74cc('0x7'));router[_0x74cc('0x8')]('/',auth[_0x74cc('0x9')](),controller[_0x74cc('0xa')]);router['get'](_0x74cc('0xb'),auth['isAuthenticated'](),controller[_0x74cc('0xc')]);router['get'](_0x74cc('0xd'),auth[_0x74cc('0x9')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2adbdd,_0x218bc1,_0x468be9){_0x468be9(null,path[_0x74cc('0xe')](config[_0x74cc('0xf')],_0x74cc('0x10')));},'filename':function(_0x4466ec,_0x35c9d0,_0x26c847){_0x35c9d0['originalname']=_0x35c9d0['originalname'][_0x74cc('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x26c847(null,util[_0x74cc('0x12')](_0x74cc('0x13'),path[_0x74cc('0x14')](_0x35c9d0['originalname'],path['extname'](_0x35c9d0[_0x74cc('0x15')])),Date[_0x74cc('0x16')](),path[_0x74cc('0x17')](_0x35c9d0[_0x74cc('0x15')])));}})});router[_0x74cc('0x18')]('/',upload[_0x74cc('0x19')](_0x74cc('0x1a')),controller[_0x74cc('0x1b')]);router['put'](_0x74cc('0xb'),auth[_0x74cc('0x9')](),controller[_0x74cc('0x1c')]);router[_0x74cc('0x1d')](_0x74cc('0xb'),auth[_0x74cc('0x9')](),controller[_0x74cc('0x1d')]);module[_0x74cc('0x1e')]=router; \ No newline at end of file +var _0xe81d=['post','single','file','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','diskStorage','server/files/sounds/original/','originalname','%s-%s%s','basename','now','extname'];(function(_0x2fe85a,_0x28c346){var _0x468e0f=function(_0x515887){while(--_0x515887){_0x2fe85a['push'](_0x2fe85a['shift']());}};_0x468e0f(++_0x28c346);}(_0xe81d,0xc4));var _0xde81=function(_0x3279b9,_0x27c6b4){_0x3279b9=_0x3279b9-0x0;var _0x4885ef=_0xe81d[_0x3279b9];return _0x4885ef;};'use strict';var multer=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var path=require(_0xde81('0x2'));var timeout=require(_0xde81('0x3'));var express=require(_0xde81('0x4'));var router=express[_0xde81('0x5')]();var fs_extra=require(_0xde81('0x6'));var auth=require(_0xde81('0x7'));var interaction=require(_0xde81('0x8'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xde81('0x9')]('/',auth[_0xde81('0xa')](),controller['index']);router[_0xde81('0x9')](_0xde81('0xb'),auth[_0xde81('0xa')](),controller[_0xde81('0xc')]);router[_0xde81('0x9')]('/:id/download',auth[_0xde81('0xa')](),controller['download']);var upload=multer({'storage':multer[_0xde81('0xd')]({'destination':function(_0x118eff,_0x20a335,_0x4074ef){_0x4074ef(null,path['join'](config['root'],_0xde81('0xe')));},'filename':function(_0x17ba97,_0x23a96b,_0x17a529){_0x23a96b['originalname']=_0x23a96b[_0xde81('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x17a529(null,util['format'](_0xde81('0x10'),path[_0xde81('0x11')](_0x23a96b[_0xde81('0xf')],path['extname'](_0x23a96b[_0xde81('0xf')])),Date[_0xde81('0x12')](),path[_0xde81('0x13')](_0x23a96b['originalname'])));}})});router[_0xde81('0x14')]('/',upload[_0xde81('0x15')](_0xde81('0x16')),controller[_0xde81('0x17')]);router['put'](_0xde81('0xb'),auth['isAuthenticated'](),controller[_0xde81('0x18')]);router[_0xde81('0x19')](_0xde81('0xb'),auth[_0xde81('0xa')](),controller[_0xde81('0x19')]);module[_0xde81('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index b857e65..4867d88 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 _0x7ff6=['INTEGER','sequelize','exports','STRING','FLOAT','BIGINT'];(function(_0x8e7772,_0x9d77b0){var _0x408200=function(_0x1c61b6){while(--_0x1c61b6){_0x8e7772['push'](_0x8e7772['shift']());}};_0x408200(++_0x9d77b0);}(_0x7ff6,0x187));var _0x67ff=function(_0x2c1698,_0x15f560){_0x2c1698=_0x2c1698-0x0;var _0x3bbade=_0x7ff6[_0x2c1698];return _0x3bbade;};'use strict';var Sequelize=require(_0x67ff('0x0'));module[_0x67ff('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x67ff('0x2')]},'display_name':{'type':Sequelize[_0x67ff('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x67ff('0x2')]},'original_format':{'type':Sequelize[_0x67ff('0x2')]},'original_duration':{'type':Sequelize[_0x67ff('0x3')]},'original_sampleCount':{'type':Sequelize[_0x67ff('0x4')]},'original_channelCount':{'type':Sequelize[_0x67ff('0x5')]},'original_bitRate':{'type':Sequelize[_0x67ff('0x4')]},'original_sampleRate':{'type':Sequelize[_0x67ff('0x5')]},'converted_format':{'type':Sequelize[_0x67ff('0x2')]},'converted_duration':{'type':Sequelize[_0x67ff('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x67ff('0x4')]},'converted_channelCount':{'type':Sequelize[_0x67ff('0x5')]},'converted_bitRate':{'type':Sequelize[_0x67ff('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x67ff('0x5')]}}; \ No newline at end of file +var _0x8185=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x202b7c,_0x143753){var _0x3b5401=function(_0x18d507){while(--_0x18d507){_0x202b7c['push'](_0x202b7c['shift']());}};_0x3b5401(++_0x143753);}(_0x8185,0xc6));var _0x5818=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8185[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x5818('0x0'));module[_0x5818('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x5818('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x5818('0x3')]},'original_sampleCount':{'type':Sequelize[_0x5818('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x5818('0x4')]},'original_sampleRate':{'type':Sequelize[_0x5818('0x5')]},'converted_format':{'type':Sequelize[_0x5818('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x5818('0x4')]},'converted_channelCount':{'type':Sequelize[_0x5818('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x5818('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 17fe2cd..ff544f8 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 _0xcc38=['duration','original_sampleCount','sampleCount','original_channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','converted_sampleRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','pick','delete','server/files/sounds/original','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','destroy','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','Sound','includeAll','findAll','rows','show','params','include','find','download','save_name','existsSync','root','server/files/sounds/converted','converted_format','Sound\x20not\x20found','join','%s.%s','format','catch','create','basename','file','originalname','filename','extname','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','unlinkSync','src','original_duration'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xcc38,0x19c));var _0x8cc3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xcc38[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8cc3('0x0'));var zipdir=require(_0x8cc3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cc3('0x2'));var moment=require(_0x8cc3('0x3'));var BPromise=require(_0x8cc3('0x4'));var Mustache=require('mustache');var util=require(_0x8cc3('0x5'));var path=require('path');var sox=require(_0x8cc3('0x6'));var csv=require(_0x8cc3('0x7'));var ejs=require(_0x8cc3('0x8'));var fs=require('fs');var fs_extra=require(_0x8cc3('0x9'));var _=require(_0x8cc3('0xa'));var squel=require(_0x8cc3('0xb'));var crypto=require(_0x8cc3('0xc'));var jsforce=require(_0x8cc3('0xd'));var deskjs=require(_0x8cc3('0xe'));var toCsv=require(_0x8cc3('0x7'));var querystring=require('querystring');var Papa=require(_0x8cc3('0xf'));var Redis=require(_0x8cc3('0x10'));var authService=require(_0x8cc3('0x11'));var qs=require(_0x8cc3('0x12'));var as=require(_0x8cc3('0x13'));var hardwareService=require(_0x8cc3('0x14'));var logger=require('../../config/logger')(_0x8cc3('0x15'));var utils=require(_0x8cc3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8cc3('0x17'));var db=require(_0x8cc3('0x18'))['db'];function respondWithStatusCode(_0x375e15,_0x5625c7){_0x5625c7=_0x5625c7||0xcc;return function(_0x151955){if(_0x151955){return _0x375e15[_0x8cc3('0x19')](_0x5625c7);}return _0x375e15[_0x8cc3('0x1a')](_0x5625c7)[_0x8cc3('0x1b')]();};}function respondWithResult(_0x235c76,_0x11f106){_0x11f106=_0x11f106||0xc8;return function(_0x366c70){if(_0x366c70){return _0x235c76[_0x8cc3('0x1a')](_0x11f106)[_0x8cc3('0x1c')](_0x366c70);}};}function respondWithFilteredResult(_0x2723d0,_0x79fa88){return function(_0x47b60e){if(_0x47b60e){var _0x47876c=typeof _0x79fa88['offset']===_0x8cc3('0x1d')&&typeof _0x79fa88[_0x8cc3('0x1e')]===_0x8cc3('0x1d');var _0x2bb8cb=_0x47b60e[_0x8cc3('0x1f')];var _0x410400=_0x47876c?0x0:_0x79fa88[_0x8cc3('0x20')];var _0x260db0=_0x47876c?_0x47b60e[_0x8cc3('0x1f')]:_0x79fa88[_0x8cc3('0x20')]+_0x79fa88[_0x8cc3('0x1e')];var _0x30f80f;if(_0x260db0>=_0x2bb8cb){_0x260db0=_0x2bb8cb;_0x30f80f=0xc8;}else{_0x30f80f=0xce;}_0x2723d0['status'](_0x30f80f);return _0x2723d0[_0x8cc3('0x21')]('Content-Range',_0x410400+'-'+_0x260db0+'/'+_0x2bb8cb)[_0x8cc3('0x1c')](_0x47b60e);}return null;};}function patchUpdates(_0x2e7952){return function(_0x27c717){try{jsonpatch[_0x8cc3('0x22')](_0x27c717,_0x2e7952,!![]);}catch(_0x4e5da0){return BPromise['reject'](_0x4e5da0);}return _0x27c717['save']();};}function saveUpdates(_0x3441a1,_0x1217a9){return function(_0x33d038){if(_0x33d038){return _0x33d038['update'](_0x3441a1)[_0x8cc3('0x23')](function(_0x2560d5){return _0x2560d5;});}return null;};}function removeEntity(_0x25f57f,_0x144484){return function(_0x5c991b){if(_0x5c991b){return _0x5c991b[_0x8cc3('0x24')]()[_0x8cc3('0x23')](function(){var _0x5c79df=_0x5c991b['get']({'plain':!![]});var _0x2f7b83='Sounds';return db[_0x8cc3('0x25')][_0x8cc3('0x24')]({'where':{'type':_0x2f7b83,'resourceId':_0x5c79df['id']}})['then'](function(){return _0x5c991b;});})[_0x8cc3('0x23')](function(){_0x25f57f[_0x8cc3('0x1a')](0xcc)[_0x8cc3('0x1b')]();});}};}function handleEntityNotFound(_0x60c5db,_0x419aab){return function(_0x4c5226){if(!_0x4c5226){_0x60c5db[_0x8cc3('0x19')](0x194);}return _0x4c5226;};}function handleError(_0x217f20,_0x333339){_0x333339=_0x333339||0x1f4;return function(_0x5dd466){logger[_0x8cc3('0x26')](_0x5dd466['stack']);if(_0x5dd466[_0x8cc3('0x27')]){delete _0x5dd466[_0x8cc3('0x27')];}_0x217f20[_0x8cc3('0x1a')](_0x333339)[_0x8cc3('0x28')](_0x5dd466);};}exports[_0x8cc3('0x29')]=function(_0x29a036,_0xc3cc91){var _0x158dc2={},_0x552772={},_0x2e2f01={'count':0x0,'rows':[]};var _0x42bcc3=_[_0x8cc3('0x2a')](db['Sound'][_0x8cc3('0x2b')],function(_0x13439c){return{'name':_0x13439c[_0x8cc3('0x2c')],'type':_0x13439c['type'][_0x8cc3('0x2d')]};});_0x552772[_0x8cc3('0x2e')]=_['map'](_0x42bcc3,_0x8cc3('0x27'));_0x552772[_0x8cc3('0x2f')]=_[_0x8cc3('0x30')](_0x29a036['query']);_0x552772['filters']=_['intersection'](_0x552772['model'],_0x552772['query']);_0x158dc2['attributes']=_[_0x8cc3('0x31')](_0x552772[_0x8cc3('0x2e')],qs[_0x8cc3('0x32')](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x32')]));_0x158dc2[_0x8cc3('0x33')]=_0x158dc2[_0x8cc3('0x33')][_0x8cc3('0x34')]?_0x158dc2[_0x8cc3('0x33')]:_0x552772[_0x8cc3('0x2e')];if(!_0x29a036['query'][_0x8cc3('0x35')](_0x8cc3('0x36'))){_0x158dc2[_0x8cc3('0x1e')]=qs['limit'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x1e')]);_0x158dc2['offset']=qs['offset'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x20')]);}_0x158dc2[_0x8cc3('0x37')]=qs['sort'](_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x38')]);_0x158dc2[_0x8cc3('0x39')]=qs[_0x8cc3('0x3a')](_['pick'](_0x29a036['query'],_0x552772[_0x8cc3('0x3a')]),_0x42bcc3);if(_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x3b')]){_0x158dc2[_0x8cc3('0x39')]=_[_0x8cc3('0x3c')](_0x158dc2[_0x8cc3('0x39')],{'$or':_[_0x8cc3('0x2a')](_0x42bcc3,function(_0x14bef5){if(_0x14bef5['type']!==_0x8cc3('0x3d')){var _0x45f440={};_0x45f440[_0x14bef5[_0x8cc3('0x27')]]={'$like':'%'+_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x3b')]+'%'};return _0x45f440;}})});}_0x158dc2=_[_0x8cc3('0x3c')]({},_0x158dc2,_0x29a036[_0x8cc3('0x3e')]);var _0x45132c={'where':_0x158dc2[_0x8cc3('0x39')]};return db[_0x8cc3('0x3f')]['count'](_0x45132c)[_0x8cc3('0x23')](function(_0x208831){_0x2e2f01[_0x8cc3('0x1f')]=_0x208831;if(_0x29a036[_0x8cc3('0x2f')][_0x8cc3('0x40')]){_0x158dc2['include']=[{'all':!![]}];}return db['Sound'][_0x8cc3('0x41')](_0x158dc2);})['then'](function(_0x2c2a7f){_0x2e2f01[_0x8cc3('0x42')]=_0x2c2a7f;return _0x2e2f01;})[_0x8cc3('0x23')](respondWithFilteredResult(_0xc3cc91,_0x158dc2))['catch'](handleError(_0xc3cc91,null));};exports[_0x8cc3('0x43')]=function(_0xfc9673,_0x1ba17c){var _0x9d1279={'raw':!![],'where':{'id':_0xfc9673[_0x8cc3('0x44')]['id']}},_0x30daea={};_0x30daea['model']=_['keys'](db[_0x8cc3('0x3f')][_0x8cc3('0x2b')]);_0x30daea[_0x8cc3('0x2f')]=_[_0x8cc3('0x30')](_0xfc9673['query']);_0x30daea[_0x8cc3('0x3a')]=_[_0x8cc3('0x31')](_0x30daea['model'],_0x30daea[_0x8cc3('0x2f')]);_0x9d1279[_0x8cc3('0x33')]=_[_0x8cc3('0x31')](_0x30daea[_0x8cc3('0x2e')],qs[_0x8cc3('0x32')](_0xfc9673[_0x8cc3('0x2f')][_0x8cc3('0x32')]));_0x9d1279[_0x8cc3('0x33')]=_0x9d1279['attributes'][_0x8cc3('0x34')]?_0x9d1279[_0x8cc3('0x33')]:_0x30daea[_0x8cc3('0x2e')];if(_0xfc9673[_0x8cc3('0x2f')][_0x8cc3('0x40')]){_0x9d1279[_0x8cc3('0x45')]=[{'all':!![]}];}_0x9d1279=_['merge']({},_0x9d1279,_0xfc9673[_0x8cc3('0x3e')]);return db[_0x8cc3('0x3f')][_0x8cc3('0x46')](_0x9d1279)[_0x8cc3('0x23')](handleEntityNotFound(_0x1ba17c,null))[_0x8cc3('0x23')](respondWithResult(_0x1ba17c,null))['catch'](handleError(_0x1ba17c,null));};exports[_0x8cc3('0x47')]=function(_0x70b832,_0x565254,_0x320eb3){return db['Sound'][_0x8cc3('0x46')]({'where':{'id':_0x70b832['params']['id']},'attributes':[_0x8cc3('0x27'),_0x8cc3('0x48'),'converted_format'],'raw':!![]})[_0x8cc3('0x23')](handleEntityNotFound(_0x565254,null))[_0x8cc3('0x23')](function(_0x2b2b38){if(_0x2b2b38){if(!fs[_0x8cc3('0x49')](path['join'](config[_0x8cc3('0x4a')],_0x8cc3('0x4b'),_0x2b2b38[_0x8cc3('0x48')]+'.'+_0x2b2b38[_0x8cc3('0x4c')]))){throw new db['Sequelize']['ValidationError'](_0x8cc3('0x4d'));}return _0x565254[_0x8cc3('0x47')](path[_0x8cc3('0x4e')](config['root'],'server/files/sounds/converted',util['format'](_0x8cc3('0x4f'),_0x2b2b38['save_name'],_0x2b2b38['converted_format'])),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),_0x2b2b38[_0x8cc3('0x27')],_0x2b2b38[_0x8cc3('0x4c')]));}return null;})[_0x8cc3('0x51')](handleError(_0x565254,null));};exports[_0x8cc3('0x52')]=function(_0x433c09,_0x5bc9ac,_0x21c913){var _0x23ddab={'name':path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')]['originalname'],path['extname'](_0x433c09['file'][_0x8cc3('0x55')])),'save_name':path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')],path[_0x8cc3('0x57')](_0x433c09['file'][_0x8cc3('0x56')])),'original_format':path['extname'](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x55')])[_0x8cc3('0x58')](0x1),'converted_format':_0x8cc3('0x59')};var _0xbf18a1=path['join'](config[_0x8cc3('0x4a')],'server/files/sounds/original',_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')]);var _0x1440b9=path[_0x8cc3('0x4e')](config[_0x8cc3('0x4a')],_0x8cc3('0x4b'),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),path[_0x8cc3('0x53')](_0x433c09[_0x8cc3('0x54')][_0x8cc3('0x56')],path[_0x8cc3('0x57')](_0x433c09['file'][_0x8cc3('0x56')])),_0x23ddab[_0x8cc3('0x4c')]));logger[_0x8cc3('0x5a')](_0x8cc3('0x5b'),_0xbf18a1);logger[_0x8cc3('0x5a')]('Sound\x20upload\x20destination:\x20%s',_0x1440b9);try{fs[_0x8cc3('0x5c')](_0xbf18a1,parseInt('0777',0x8));var _0x1b9b47=sox['transcode'](_0xbf18a1,_0x1440b9,{'sampleRate':0x1f40,'format':_0x8cc3('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b9b47['on'](_0x8cc3('0x26'),function(_0x13bea7){fs[_0x8cc3('0x5d')](_0xbf18a1);_0x5bc9ac[_0x8cc3('0x1a')](0x1f4)[_0x8cc3('0x28')](_0x13bea7);});_0x1b9b47['on'](_0x8cc3('0x5e'),function(_0x5deae9){_0x23ddab[_0x8cc3('0x5f')]=isNaN(_0x5deae9[_0x8cc3('0x60')])?null:_0x5deae9[_0x8cc3('0x60')]*0x3e8;_0x23ddab[_0x8cc3('0x61')]=isNaN(_0x5deae9['sampleCount'])?null:_0x5deae9[_0x8cc3('0x62')];_0x23ddab[_0x8cc3('0x63')]=isNaN(_0x5deae9['channelCount'])?null:_0x5deae9['channelCount'];_0x23ddab[_0x8cc3('0x64')]=isNaN(_0x5deae9[_0x8cc3('0x65')])?null:_0x5deae9[_0x8cc3('0x65')];_0x23ddab[_0x8cc3('0x66')]=isNaN(_0x5deae9[_0x8cc3('0x67')])?null:_0x5deae9[_0x8cc3('0x67')];});_0x1b9b47['on'](_0x8cc3('0x68'),function(_0x588ff0){_0x23ddab[_0x8cc3('0x69')]=isNaN(_0x588ff0[_0x8cc3('0x60')])?null:_0x588ff0[_0x8cc3('0x60')]*0x3e8;_0x23ddab[_0x8cc3('0x6a')]=isNaN(_0x588ff0[_0x8cc3('0x62')])?null:_0x588ff0[_0x8cc3('0x62')];_0x23ddab[_0x8cc3('0x6b')]=isNaN(_0x588ff0[_0x8cc3('0x6c')])?null:_0x588ff0[_0x8cc3('0x6c')];_0x23ddab[_0x8cc3('0x6d')]=isNaN(_0x588ff0[_0x8cc3('0x65')])?null:_0x588ff0[_0x8cc3('0x65')];_0x23ddab[_0x8cc3('0x6e')]=isNaN(_0x588ff0[_0x8cc3('0x67')])?null:_0x588ff0[_0x8cc3('0x67')];});_0x1b9b47['on'](_0x8cc3('0x1b'),function(){fs[_0x8cc3('0x5c')](_0x1440b9,parseInt(_0x8cc3('0x6f'),0x8));return db[_0x8cc3('0x3f')][_0x8cc3('0x52')](_0x23ddab)[_0x8cc3('0x23')](function(_0x2e64ad){var _0x2706ce={'role':_0x433c09['body'][_0x8cc3('0x70')],'userProfileId':_0x433c09[_0x8cc3('0x71')][_0x8cc3('0x72')]};if(!_0x2706ce)throw new Error(_0x8cc3('0x73'));if(_0x2706ce['role']===_0x8cc3('0x74')){var _0x4141e3=_0x2e64ad[_0x8cc3('0x75')]({'plain':!![]});return db[_0x8cc3('0x76')][_0x8cc3('0x46')]({'where':{'name':_0x8cc3('0x77'),'userProfileId':_0x2706ce[_0x8cc3('0x72')]},'raw':!![]})[_0x8cc3('0x23')](function(_0x3bdfd7){if(_0x3bdfd7&&_0x3bdfd7[_0x8cc3('0x78')]===0x0){return db[_0x8cc3('0x25')][_0x8cc3('0x52')]({'name':_0x4141e3[_0x8cc3('0x27')],'resourceId':_0x4141e3['id'],'type':_0x3bdfd7['name'],'sectionId':_0x3bdfd7['id']},{})[_0x8cc3('0x23')](function(){return _0x2e64ad;});}else{return _0x2e64ad;}})[_0x8cc3('0x51')](function(_0x1e6a9a){logger[_0x8cc3('0x26')](_0x8cc3('0x79'),_0x1e6a9a);throw _0x1e6a9a;});}return _0x2e64ad;})['then'](respondWithResult(_0x5bc9ac,null))[_0x8cc3('0x51')](handleError(_0x5bc9ac,null));});_0x1b9b47[_0x8cc3('0x7a')]();}catch(_0x54f175){_0x5bc9ac[_0x8cc3('0x1a')](0x1f4)[_0x8cc3('0x28')](_0x54f175);}};exports[_0x8cc3('0x7b')]=function(_0x422e4e,_0x312f73,_0x27af38){return db[_0x8cc3('0x3f')][_0x8cc3('0x46')]({'where':{'id':_0x422e4e[_0x8cc3('0x44')]['id']}})[_0x8cc3('0x23')](handleEntityNotFound(_0x312f73,null))['then'](saveUpdates(_[_0x8cc3('0x7c')](_0x422e4e[_0x8cc3('0x71')],[_0x8cc3('0x27'),'description']),null))[_0x8cc3('0x23')](respondWithResult(_0x312f73,null))[_0x8cc3('0x51')](handleError(_0x312f73,null));};exports[_0x8cc3('0x7d')]=function(_0x6ebd0e,_0x1704b1,_0xbda6dc){return db[_0x8cc3('0x3f')][_0x8cc3('0x46')]({'where':{'id':_0x6ebd0e[_0x8cc3('0x44')]['id']}})[_0x8cc3('0x23')](function(_0x15bbd3){if(_0x15bbd3){return _0x15bbd3[_0x8cc3('0x24')]();}})['then'](function(_0x234f66){var _0x1d1468=path[_0x8cc3('0x4e')](config[_0x8cc3('0x4a')],_0x8cc3('0x7e'),util[_0x8cc3('0x50')](_0x8cc3('0x4f'),_0x234f66[_0x8cc3('0x48')],_0x234f66['original_format']));var _0x4d9cd7=path[_0x8cc3('0x4e')](config['root'],_0x8cc3('0x4b'),util['format'](_0x8cc3('0x4f'),_0x234f66['save_name'],_0x234f66[_0x8cc3('0x4c')]));fs[_0x8cc3('0x5d')](_0x1d1468);fs['unlinkSync'](_0x4d9cd7);return _0x234f66;})[_0x8cc3('0x23')](function(_0x455b1d){if(_0x455b1d){return _0x1704b1[_0x8cc3('0x1a')](0xcc)[_0x8cc3('0x1b')]();}})[_0x8cc3('0x23')](handleEntityNotFound(_0x1704b1,null))[_0x8cc3('0x51')](handleError(_0x1704b1,null));}; \ No newline at end of file +var _0x1153=['limit','count','set','Content-Range','reject','save','update','then','destroy','Sounds','UserProfileResource','error','stack','name','index','map','Sound','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','download','params','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','extname','file','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','end','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x548089,_0xf0f782){var _0x1f8664=function(_0x196b9f){while(--_0x196b9f){_0x548089['push'](_0x548089['shift']());}};_0x1f8664(++_0xf0f782);}(_0x1153,0xd4));var _0x3115=function(_0x30db5b,_0x1864c2){_0x30db5b=_0x30db5b-0x0;var _0x13da97=_0x1153[_0x30db5b];return _0x13da97;};'use strict';var emlformat=require(_0x3115('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3115('0x1'));var jsonpatch=require(_0x3115('0x2'));var rp=require(_0x3115('0x3'));var moment=require(_0x3115('0x4'));var BPromise=require(_0x3115('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x3115('0x6'));var csv=require(_0x3115('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3115('0x8'));var _=require(_0x3115('0x9'));var squel=require('squel');var crypto=require(_0x3115('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3115('0xb'));var toCsv=require(_0x3115('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3115('0xc'));var authService=require(_0x3115('0xd'));var qs=require(_0x3115('0xe'));var as=require(_0x3115('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3115('0x10'));var utils=require(_0x3115('0x11'));var config=require(_0x3115('0x12'));var licenseUtil=require(_0x3115('0x13'));var db=require(_0x3115('0x14'))['db'];function respondWithStatusCode(_0x166620,_0x3ab538){_0x3ab538=_0x3ab538||0xcc;return function(_0x3d117c){if(_0x3d117c){return _0x166620[_0x3115('0x15')](_0x3ab538);}return _0x166620[_0x3115('0x16')](_0x3ab538)['end']();};}function respondWithResult(_0x4a282f,_0xe62472){_0xe62472=_0xe62472||0xc8;return function(_0x44adf1){if(_0x44adf1){return _0x4a282f[_0x3115('0x16')](_0xe62472)[_0x3115('0x17')](_0x44adf1);}};}function respondWithFilteredResult(_0x58070f,_0x5d1538){return function(_0x6efecb){if(_0x6efecb){var _0x49b698=typeof _0x5d1538[_0x3115('0x18')]===_0x3115('0x19')&&typeof _0x5d1538[_0x3115('0x1a')]===_0x3115('0x19');var _0x42a95c=_0x6efecb[_0x3115('0x1b')];var _0xb85d52=_0x49b698?0x0:_0x5d1538[_0x3115('0x18')];var _0x15baa4=_0x49b698?_0x6efecb[_0x3115('0x1b')]:_0x5d1538[_0x3115('0x18')]+_0x5d1538[_0x3115('0x1a')];var _0x2f2813;if(_0x15baa4>=_0x42a95c){_0x15baa4=_0x42a95c;_0x2f2813=0xc8;}else{_0x2f2813=0xce;}_0x58070f[_0x3115('0x16')](_0x2f2813);return _0x58070f[_0x3115('0x1c')](_0x3115('0x1d'),_0xb85d52+'-'+_0x15baa4+'/'+_0x42a95c)['json'](_0x6efecb);}return null;};}function patchUpdates(_0x13f813){return function(_0x4f00a8){try{jsonpatch['apply'](_0x4f00a8,_0x13f813,!![]);}catch(_0x4d1dc0){return BPromise[_0x3115('0x1e')](_0x4d1dc0);}return _0x4f00a8[_0x3115('0x1f')]();};}function saveUpdates(_0xfc75c0,_0x5c198e){return function(_0x2c9324){if(_0x2c9324){return _0x2c9324[_0x3115('0x20')](_0xfc75c0)[_0x3115('0x21')](function(_0x2d9363){return _0x2d9363;});}return null;};}function removeEntity(_0x518f52,_0x99de35){return function(_0xcde66a){if(_0xcde66a){return _0xcde66a[_0x3115('0x22')]()['then'](function(){var _0x4f53fd=_0xcde66a['get']({'plain':!![]});var _0x4fd752=_0x3115('0x23');return db[_0x3115('0x24')][_0x3115('0x22')]({'where':{'type':_0x4fd752,'resourceId':_0x4f53fd['id']}})['then'](function(){return _0xcde66a;});})[_0x3115('0x21')](function(){_0x518f52[_0x3115('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598d89,_0x5a5a3b){return function(_0x6d1377){if(!_0x6d1377){_0x598d89[_0x3115('0x15')](0x194);}return _0x6d1377;};}function handleError(_0x4b35b3,_0x3ecd1a){_0x3ecd1a=_0x3ecd1a||0x1f4;return function(_0x46589b){logger[_0x3115('0x25')](_0x46589b[_0x3115('0x26')]);if(_0x46589b[_0x3115('0x27')]){delete _0x46589b[_0x3115('0x27')];}_0x4b35b3[_0x3115('0x16')](_0x3ecd1a)['send'](_0x46589b);};}exports[_0x3115('0x28')]=function(_0x4d1f1e,_0x40bc37){var _0xa27ad1={},_0x233500={},_0x4fdfb2={'count':0x0,'rows':[]};var _0x40d8db=_[_0x3115('0x29')](db[_0x3115('0x2a')][_0x3115('0x2b')],function(_0xf8747b){return{'name':_0xf8747b[_0x3115('0x2c')],'type':_0xf8747b[_0x3115('0x2d')][_0x3115('0x2e')]};});_0x233500[_0x3115('0x2f')]=_[_0x3115('0x29')](_0x40d8db,_0x3115('0x27'));_0x233500[_0x3115('0x30')]=_[_0x3115('0x31')](_0x4d1f1e[_0x3115('0x30')]);_0x233500[_0x3115('0x32')]=_[_0x3115('0x33')](_0x233500['model'],_0x233500[_0x3115('0x30')]);_0xa27ad1[_0x3115('0x34')]=_[_0x3115('0x33')](_0x233500['model'],qs[_0x3115('0x35')](_0x4d1f1e[_0x3115('0x30')][_0x3115('0x35')]));_0xa27ad1[_0x3115('0x34')]=_0xa27ad1[_0x3115('0x34')][_0x3115('0x36')]?_0xa27ad1[_0x3115('0x34')]:_0x233500[_0x3115('0x2f')];if(!_0x4d1f1e[_0x3115('0x30')][_0x3115('0x37')]('nolimit')){_0xa27ad1['limit']=qs[_0x3115('0x1a')](_0x4d1f1e[_0x3115('0x30')][_0x3115('0x1a')]);_0xa27ad1[_0x3115('0x18')]=qs[_0x3115('0x18')](_0x4d1f1e['query'][_0x3115('0x18')]);}_0xa27ad1[_0x3115('0x38')]=qs[_0x3115('0x39')](_0x4d1f1e[_0x3115('0x30')][_0x3115('0x39')]);_0xa27ad1[_0x3115('0x3a')]=qs[_0x3115('0x32')](_[_0x3115('0x3b')](_0x4d1f1e['query'],_0x233500[_0x3115('0x32')]),_0x40d8db);if(_0x4d1f1e['query']['filter']){_0xa27ad1[_0x3115('0x3a')]=_[_0x3115('0x3c')](_0xa27ad1['where'],{'$or':_[_0x3115('0x29')](_0x40d8db,function(_0x3eb1c5){if(_0x3eb1c5[_0x3115('0x2d')]!=='VIRTUAL'){var _0x26aee0={};_0x26aee0[_0x3eb1c5[_0x3115('0x27')]]={'$like':'%'+_0x4d1f1e[_0x3115('0x30')]['filter']+'%'};return _0x26aee0;}})});}_0xa27ad1=_[_0x3115('0x3c')]({},_0xa27ad1,_0x4d1f1e[_0x3115('0x3d')]);var _0x192ef0={'where':_0xa27ad1[_0x3115('0x3a')]};return db[_0x3115('0x2a')][_0x3115('0x1b')](_0x192ef0)[_0x3115('0x21')](function(_0x1d6bb4){_0x4fdfb2[_0x3115('0x1b')]=_0x1d6bb4;if(_0x4d1f1e[_0x3115('0x30')][_0x3115('0x3e')]){_0xa27ad1[_0x3115('0x3f')]=[{'all':!![]}];}return db[_0x3115('0x2a')][_0x3115('0x40')](_0xa27ad1);})['then'](function(_0x5bdb36){_0x4fdfb2[_0x3115('0x41')]=_0x5bdb36;return _0x4fdfb2;})['then'](respondWithFilteredResult(_0x40bc37,_0xa27ad1))[_0x3115('0x42')](handleError(_0x40bc37,null));};exports[_0x3115('0x43')]=function(_0xf65fe2,_0xbab677){var _0x38e2d3={'raw':!![],'where':{'id':_0xf65fe2['params']['id']}},_0xa640bb={};_0xa640bb[_0x3115('0x2f')]=_[_0x3115('0x31')](db[_0x3115('0x2a')][_0x3115('0x2b')]);_0xa640bb[_0x3115('0x30')]=_[_0x3115('0x31')](_0xf65fe2[_0x3115('0x30')]);_0xa640bb[_0x3115('0x32')]=_['intersection'](_0xa640bb[_0x3115('0x2f')],_0xa640bb[_0x3115('0x30')]);_0x38e2d3['attributes']=_[_0x3115('0x33')](_0xa640bb['model'],qs[_0x3115('0x35')](_0xf65fe2[_0x3115('0x30')]['fields']));_0x38e2d3[_0x3115('0x34')]=_0x38e2d3[_0x3115('0x34')][_0x3115('0x36')]?_0x38e2d3[_0x3115('0x34')]:_0xa640bb[_0x3115('0x2f')];if(_0xf65fe2['query']['includeAll']){_0x38e2d3[_0x3115('0x3f')]=[{'all':!![]}];}_0x38e2d3=_[_0x3115('0x3c')]({},_0x38e2d3,_0xf65fe2['options']);return db[_0x3115('0x2a')]['find'](_0x38e2d3)['then'](handleEntityNotFound(_0xbab677,null))[_0x3115('0x21')](respondWithResult(_0xbab677,null))['catch'](handleError(_0xbab677,null));};exports[_0x3115('0x44')]=function(_0x4f851c,_0x1efad7,_0x6d7b6d){return db[_0x3115('0x2a')]['find']({'where':{'id':_0x4f851c[_0x3115('0x45')]['id']},'attributes':[_0x3115('0x27'),_0x3115('0x46'),'converted_format'],'raw':!![]})[_0x3115('0x21')](handleEntityNotFound(_0x1efad7,null))[_0x3115('0x21')](function(_0x271981){if(_0x271981){if(!fs[_0x3115('0x47')](path[_0x3115('0x48')](config[_0x3115('0x49')],_0x3115('0x4a'),_0x271981[_0x3115('0x46')]+'.'+_0x271981[_0x3115('0x4b')]))){throw new db[(_0x3115('0x4c'))][(_0x3115('0x4d'))](_0x3115('0x4e'));}return _0x1efad7[_0x3115('0x44')](path['join'](config[_0x3115('0x49')],'server/files/sounds/converted',util[_0x3115('0x4f')](_0x3115('0x50'),_0x271981[_0x3115('0x46')],_0x271981['converted_format'])),util[_0x3115('0x4f')](_0x3115('0x50'),_0x271981[_0x3115('0x27')],_0x271981[_0x3115('0x4b')]));}return null;})['catch'](handleError(_0x1efad7,null));};exports[_0x3115('0x51')]=function(_0xc1f5a8,_0x41ba91,_0x504101){var _0x4f7376={'name':path['basename'](_0xc1f5a8['file']['originalname'],path[_0x3115('0x52')](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x54')])),'save_name':path['basename'](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x55')],path[_0x3115('0x52')](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x55')])),'original_format':path['extname'](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x54')])[_0x3115('0x56')](0x1),'converted_format':_0x3115('0x57')};var _0x463d8f=path[_0x3115('0x48')](config['root'],_0x3115('0x58'),_0xc1f5a8[_0x3115('0x53')]['filename']);var _0x24196f=path[_0x3115('0x48')](config[_0x3115('0x49')],'server/files/sounds/converted',util[_0x3115('0x4f')](_0x3115('0x50'),path['basename'](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x55')],path['extname'](_0xc1f5a8[_0x3115('0x53')][_0x3115('0x55')])),_0x4f7376[_0x3115('0x4b')]));logger[_0x3115('0x59')](_0x3115('0x5a'),_0x463d8f);logger[_0x3115('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x24196f);try{fs['chmodSync'](_0x463d8f,parseInt(_0x3115('0x5b'),0x8));var _0x22180d=sox[_0x3115('0x5c')](_0x463d8f,_0x24196f,{'sampleRate':0x1f40,'format':_0x3115('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x22180d['on']('error',function(_0x72d5b2){fs[_0x3115('0x5d')](_0x463d8f);_0x41ba91['status'](0x1f4)[_0x3115('0x5e')](_0x72d5b2);});_0x22180d['on']('src',function(_0x1577c2){_0x4f7376[_0x3115('0x5f')]=isNaN(_0x1577c2[_0x3115('0x60')])?null:_0x1577c2[_0x3115('0x60')]*0x3e8;_0x4f7376[_0x3115('0x61')]=isNaN(_0x1577c2[_0x3115('0x62')])?null:_0x1577c2[_0x3115('0x62')];_0x4f7376[_0x3115('0x63')]=isNaN(_0x1577c2[_0x3115('0x64')])?null:_0x1577c2[_0x3115('0x64')];_0x4f7376[_0x3115('0x65')]=isNaN(_0x1577c2['bitRate'])?null:_0x1577c2[_0x3115('0x66')];_0x4f7376['original_sampleRate']=isNaN(_0x1577c2[_0x3115('0x67')])?null:_0x1577c2[_0x3115('0x67')];});_0x22180d['on'](_0x3115('0x68'),function(_0x117dec){_0x4f7376['converted_duration']=isNaN(_0x117dec[_0x3115('0x60')])?null:_0x117dec[_0x3115('0x60')]*0x3e8;_0x4f7376['converted_sampleCount']=isNaN(_0x117dec[_0x3115('0x62')])?null:_0x117dec['sampleCount'];_0x4f7376[_0x3115('0x69')]=isNaN(_0x117dec[_0x3115('0x64')])?null:_0x117dec[_0x3115('0x64')];_0x4f7376[_0x3115('0x6a')]=isNaN(_0x117dec[_0x3115('0x66')])?null:_0x117dec[_0x3115('0x66')];_0x4f7376[_0x3115('0x6b')]=isNaN(_0x117dec['sampleRate'])?null:_0x117dec['sampleRate'];});_0x22180d['on'](_0x3115('0x6c'),function(){fs['chmodSync'](_0x24196f,parseInt('0777',0x8));return db['Sound'][_0x3115('0x51')](_0x4f7376)[_0x3115('0x21')](function(_0x285c08){var _0x5f4cf9={'role':_0xc1f5a8[_0x3115('0x6d')][_0x3115('0x6e')],'userProfileId':_0xc1f5a8[_0x3115('0x6d')][_0x3115('0x6f')]};if(!_0x5f4cf9)throw new Error(_0x3115('0x70'));if(_0x5f4cf9[_0x3115('0x6e')]==='user'){var _0x4fad77=_0x285c08['get']({'plain':!![]});return db[_0x3115('0x71')][_0x3115('0x72')]({'where':{'name':_0x3115('0x23'),'userProfileId':_0x5f4cf9[_0x3115('0x6f')]},'raw':!![]})[_0x3115('0x21')](function(_0x3dde6c){if(_0x3dde6c&&_0x3dde6c['autoAssociation']===0x0){return db[_0x3115('0x24')][_0x3115('0x51')]({'name':_0x4fad77['name'],'resourceId':_0x4fad77['id'],'type':_0x3dde6c[_0x3115('0x27')],'sectionId':_0x3dde6c['id']},{})['then'](function(){return _0x285c08;});}else{return _0x285c08;}})[_0x3115('0x42')](function(_0x58fc94){logger['error'](_0x3115('0x73'),_0x58fc94);throw _0x58fc94;});}return _0x285c08;})['then'](respondWithResult(_0x41ba91,null))[_0x3115('0x42')](handleError(_0x41ba91,null));});_0x22180d['start']();}catch(_0x5af1a6){_0x41ba91[_0x3115('0x16')](0x1f4)[_0x3115('0x5e')](_0x5af1a6);}};exports[_0x3115('0x20')]=function(_0x4a5e60,_0x5056ba,_0x426d34){return db['Sound']['find']({'where':{'id':_0x4a5e60[_0x3115('0x45')]['id']}})['then'](handleEntityNotFound(_0x5056ba,null))[_0x3115('0x21')](saveUpdates(_['pick'](_0x4a5e60[_0x3115('0x6d')],[_0x3115('0x27'),_0x3115('0x74')]),null))[_0x3115('0x21')](respondWithResult(_0x5056ba,null))[_0x3115('0x42')](handleError(_0x5056ba,null));};exports[_0x3115('0x75')]=function(_0x56cb61,_0x26caef,_0x44dcc3){return db[_0x3115('0x2a')][_0x3115('0x72')]({'where':{'id':_0x56cb61[_0x3115('0x45')]['id']}})[_0x3115('0x21')](function(_0x30046c){if(_0x30046c){return _0x30046c[_0x3115('0x22')]();}})[_0x3115('0x21')](function(_0xeb3caf){var _0x3ae2d0=path[_0x3115('0x48')](config['root'],_0x3115('0x58'),util[_0x3115('0x4f')](_0x3115('0x50'),_0xeb3caf[_0x3115('0x46')],_0xeb3caf[_0x3115('0x76')]));var _0x5d29ae=path[_0x3115('0x48')](config['root'],'server/files/sounds/converted',util[_0x3115('0x4f')](_0x3115('0x50'),_0xeb3caf['save_name'],_0xeb3caf['converted_format']));fs[_0x3115('0x5d')](_0x3ae2d0);fs[_0x3115('0x5d')](_0x5d29ae);return _0xeb3caf;})['then'](function(_0x1e1566){if(_0x1e1566){return _0x26caef['status'](0xcc)['end']();}})[_0x3115('0x21')](handleEntityNotFound(_0x26caef,null))['catch'](handleError(_0x26caef,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index bec98ab..3538859 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 _0x7c65=['request-promise','path','../../config/environment','exports','define','Sound','tools_sounds','lodash','../../config/logger','moment'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7c65,0x6b));var _0x57c6=function(_0x1406ac,_0x245163){_0x1406ac=_0x1406ac-0x0;var _0x17998a=_0x7c65[_0x1406ac];return _0x17998a;};'use strict';var _=require(_0x57c6('0x0'));var util=require('util');var logger=require(_0x57c6('0x1'))('api');var moment=require(_0x57c6('0x2'));var BPromise=require('bluebird');var rp=require(_0x57c6('0x3'));var fs=require('fs');var path=require(_0x57c6('0x4'));var rimraf=require('rimraf');var config=require(_0x57c6('0x5'));var attributes=require('./sound.attributes');module[_0x57c6('0x6')]=function(_0x293dc8,_0x3d4312){return _0x293dc8[_0x57c6('0x7')](_0x57c6('0x8'),attributes,{'tableName':_0x57c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4a1=['define','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0xc4a1,0xab));var _0x1c4a=function(_0x5a8497,_0x4a6c8d){_0x5a8497=_0x5a8497-0x0;var _0x30f782=_0xc4a1[_0x5a8497];return _0x30f782;};'use strict';var _=require(_0x1c4a('0x0'));var util=require(_0x1c4a('0x1'));var logger=require(_0x1c4a('0x2'))(_0x1c4a('0x3'));var moment=require(_0x1c4a('0x4'));var BPromise=require(_0x1c4a('0x5'));var rp=require(_0x1c4a('0x6'));var fs=require('fs');var path=require(_0x1c4a('0x7'));var rimraf=require(_0x1c4a('0x8'));var config=require('../../config/environment');var attributes=require(_0x1c4a('0x9'));module[_0x1c4a('0xa')]=function(_0x1a76d8,_0x3973fd){return _0x1a76d8[_0x1c4a('0xb')](_0x1c4a('0xc'),attributes,{'tableName':_0x1c4a('0xd'),'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 25f7b5d..5f3acea 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 _0x959a=['attributes','debug','stringify','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Sound,\x20%s,\x20%s','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','ShowSound','Sound','options','raw','where','include','map','model'];(function(_0xe0f79b,_0x3ef196){var _0x46a3f9=function(_0x134c8c){while(--_0x134c8c){_0xe0f79b['push'](_0xe0f79b['shift']());}};_0x46a3f9(++_0x3ef196);}(_0x959a,0x1d4));var _0xa959=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x959a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xa959('0x0'));var util=require('util');var moment=require(_0xa959('0x1'));var BPromise=require(_0xa959('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa959('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa959('0x4'))(_0xa959('0x5'));var config=require(_0xa959('0x6'));var jayson=require(_0xa959('0x7'));var client=jayson['client'][_0xa959('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11ab24,_0x1d8ea5,_0x2afe04){return new BPromise(function(_0x10ce7e,_0x115797){return client[_0xa959('0x9')](_0x11ab24,_0x2afe04)[_0xa959('0xa')](function(_0x118aa7){logger['info'](_0xa959('0xb'),_0x1d8ea5,'request\x20sent');logger['debug'](_0xa959('0xc'),_0x1d8ea5,_0xa959('0xd'),JSON['stringify'](_0x118aa7));if(_0x118aa7['error']){if(_0x118aa7[_0xa959('0xe')][_0xa959('0xf')]===0x1f4){logger[_0xa959('0xe')]('Sound,\x20%s,\x20%s',_0x1d8ea5,_0x118aa7['error'][_0xa959('0x10')]);return _0x115797(_0x118aa7[_0xa959('0xe')][_0xa959('0x10')]);}logger[_0xa959('0xe')](_0xa959('0xb'),_0x1d8ea5,_0x118aa7['error'][_0xa959('0x10')]);return _0x10ce7e(_0x118aa7[_0xa959('0xe')][_0xa959('0x10')]);}else{logger[_0xa959('0x11')]('Sound,\x20%s,\x20%s',_0x1d8ea5,_0xa959('0xd'));_0x10ce7e(_0x118aa7[_0xa959('0x12')][_0xa959('0x10')]);}})[_0xa959('0x13')](function(_0x5cdad1){logger[_0xa959('0xe')](_0xa959('0xb'),_0x1d8ea5,_0x5cdad1);_0x115797(_0x5cdad1);});});}exports[_0xa959('0x14')]=function(_0xa71ad0){var _0x488735=this;return new Promise(function(_0x1ab9b4,_0x2b1c9a){return db[_0xa959('0x15')]['find']({'raw':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0[_0xa959('0x16')][_0xa959('0x17')]===undefined?!![]:![]:!![],'where':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0[_0xa959('0x16')][_0xa959('0x18')]||null:null,'attributes':_0xa71ad0[_0xa959('0x16')]?_0xa71ad0['options']['attributes']||null:null,'include':_0xa71ad0['options']?_0xa71ad0[_0xa959('0x16')][_0xa959('0x19')]?_[_0xa959('0x1a')](_0xa71ad0[_0xa959('0x16')][_0xa959('0x19')],function(_0x5a7729){return{'model':db[_0x5a7729[_0xa959('0x1b')]],'as':_0x5a7729['as'],'attributes':_0x5a7729[_0xa959('0x1c')],'include':_0x5a7729[_0xa959('0x19')]?_[_0xa959('0x1a')](_0x5a7729[_0xa959('0x19')],function(_0x2bb41e){return{'model':db[_0x2bb41e[_0xa959('0x1b')]],'as':_0x2bb41e['as'],'attributes':_0x2bb41e[_0xa959('0x1c')],'include':_0x2bb41e['include']?_['map'](_0x2bb41e[_0xa959('0x19')],function(_0x4712c9){return{'model':db[_0x4712c9['model']],'as':_0x4712c9['as'],'attributes':_0x4712c9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d3cf1){logger[_0xa959('0x11')](_0xa959('0x14'),_0xa71ad0);logger[_0xa959('0x1d')]('ShowSound',_0xa71ad0,JSON[_0xa959('0x1e')](_0x5d3cf1));_0x1ab9b4(_0x5d3cf1);})[_0xa959('0x13')](function(_0x141cb0){logger['error'](_0xa959('0x14'),_0x141cb0[_0xa959('0x10')],_0xa71ad0);_0x2b1c9a(_0x488735[_0xa959('0xe')](0x1f4,_0x141cb0[_0xa959('0x10')]));});});}; \ No newline at end of file +var _0x2464=['../../mysqldb','rpc','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','catch','ShowSound','Sound','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x279614,_0x4cce43){var _0x2a331c=function(_0x2d37b4){while(--_0x2d37b4){_0x279614['push'](_0x279614['shift']());}};_0x2a331c(++_0x4cce43);}(_0x2464,0xff));var _0x4246=function(_0x90d9ae,_0x59e54c){_0x90d9ae=_0x90d9ae-0x0;var _0x2550f3=_0x2464[_0x90d9ae];return _0x2550f3;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var moment=require(_0x4246('0x2'));var BPromise=require(_0x4246('0x3'));var rs=require(_0x4246('0x4'));var fs=require('fs');var Redis=require(_0x4246('0x5'));var db=require(_0x4246('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4246('0x7'));var config=require('../../config/environment');var jayson=require(_0x4246('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x444164,_0x3a466a,_0x482bb3){return new BPromise(function(_0x47cafb,_0x9d967b){return client[_0x4246('0x9')](_0x444164,_0x482bb3)[_0x4246('0xa')](function(_0xf17a46){logger[_0x4246('0xb')]('Sound,\x20%s,\x20%s',_0x3a466a,_0x4246('0xc'));logger[_0x4246('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x3a466a,_0x4246('0xc'),JSON[_0x4246('0xe')](_0xf17a46));if(_0xf17a46[_0x4246('0xf')]){if(_0xf17a46[_0x4246('0xf')][_0x4246('0x10')]===0x1f4){logger['error'](_0x4246('0x11'),_0x3a466a,_0xf17a46['error'][_0x4246('0x12')]);return _0x9d967b(_0xf17a46[_0x4246('0xf')][_0x4246('0x12')]);}logger['error'](_0x4246('0x11'),_0x3a466a,_0xf17a46[_0x4246('0xf')][_0x4246('0x12')]);return _0x47cafb(_0xf17a46[_0x4246('0xf')]['message']);}else{logger[_0x4246('0xb')](_0x4246('0x11'),_0x3a466a,_0x4246('0xc'));_0x47cafb(_0xf17a46['result'][_0x4246('0x12')]);}})[_0x4246('0x13')](function(_0x24cbf2){logger[_0x4246('0xf')]('Sound,\x20%s,\x20%s',_0x3a466a,_0x24cbf2);_0x9d967b(_0x24cbf2);});});}exports[_0x4246('0x14')]=function(_0x1c3af0){var _0x53bc2d=this;return new Promise(function(_0x834c6f,_0x5dfd1e){return db[_0x4246('0x15')][_0x4246('0x16')]({'raw':_0x1c3af0[_0x4246('0x17')]?_0x1c3af0[_0x4246('0x17')][_0x4246('0x18')]===undefined?!![]:![]:!![],'where':_0x1c3af0['options']?_0x1c3af0[_0x4246('0x17')]['where']||null:null,'attributes':_0x1c3af0[_0x4246('0x17')]?_0x1c3af0['options'][_0x4246('0x19')]||null:null,'include':_0x1c3af0['options']?_0x1c3af0[_0x4246('0x17')][_0x4246('0x1a')]?_[_0x4246('0x1b')](_0x1c3af0[_0x4246('0x17')][_0x4246('0x1a')],function(_0x411ffb){return{'model':db[_0x411ffb['model']],'as':_0x411ffb['as'],'attributes':_0x411ffb[_0x4246('0x19')],'include':_0x411ffb['include']?_['map'](_0x411ffb['include'],function(_0x4d1659){return{'model':db[_0x4d1659[_0x4246('0x1c')]],'as':_0x4d1659['as'],'attributes':_0x4d1659[_0x4246('0x19')],'include':_0x4d1659['include']?_[_0x4246('0x1b')](_0x4d1659[_0x4246('0x1a')],function(_0x4f94b6){return{'model':db[_0x4f94b6[_0x4246('0x1c')]],'as':_0x4f94b6['as'],'attributes':_0x4f94b6[_0x4246('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4246('0xa')](function(_0x87b34c){logger['info']('ShowSound',_0x1c3af0);logger[_0x4246('0xd')](_0x4246('0x14'),_0x1c3af0,JSON[_0x4246('0xe')](_0x87b34c));_0x834c6f(_0x87b34c);})[_0x4246('0x13')](function(_0x5292e8){logger[_0x4246('0xf')]('ShowSound',_0x5292e8[_0x4246('0x12')],_0x1c3af0);_0x5dfd1e(_0x53bc2d[_0x4246('0xf')](0x1f4,_0x5292e8[_0x4246('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 397b09e..980d738 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 _0x5eb8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','path','connect-timeout','express','Router'];(function(_0x4abf46,_0x2335c8){var _0x71c905=function(_0x271e04){while(--_0x271e04){_0x4abf46['push'](_0x4abf46['shift']());}};_0x71c905(++_0x2335c8);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5734e1,_0x3e1d75){_0x5734e1=_0x5734e1-0x0;var _0x22c784=_0x5eb8[_0x5734e1];return _0x22c784;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['post']('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0xe')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xf')]);router[_0x85eb('0x10')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['destroy']);module[_0x85eb('0x11')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4e3a9b,_0x251940){_0x4e3a9b=_0x4e3a9b-0x0;var _0x3c6dfb=_0x9ffd[_0x4e3a9b];return _0x3c6dfb;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('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 ea97107..d7f38fd 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 _0x5ced=['sequelize','exports','TEXT','ENUM','out','STRING'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x5ced,0xc6));var _0xd5ce=function(_0x54861c,_0x8756fc){_0x54861c=_0x54861c-0x0;var _0x4786d6=_0x5ced[_0x54861c];return _0x4786d6;};'use strict';var Sequelize=require(_0xd5ce('0x0'));module[_0xd5ce('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xd5ce('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xd5ce('0x3')]('in',_0xd5ce('0x4')),'defaultValue':_0xd5ce('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd5ce('0x5')]},'providerResponse':{'type':Sequelize[_0xd5ce('0x2')]}}; \ No newline at end of file +var _0x4ebd=['sequelize','STRING','TEXT','medium','out'];(function(_0x52648b,_0x36d540){var _0x56683f=function(_0x40b1eb){while(--_0x40b1eb){_0x52648b['push'](_0x52648b['shift']());}};_0x56683f(++_0x36d540);}(_0x4ebd,0xaf));var _0xd4eb=function(_0x4f8631,_0xe5629){_0x4f8631=_0x4f8631-0x0;var _0x709860=_0x4ebd[_0x4f8631];return _0x709860;};'use strict';var Sequelize=require(_0xd4eb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xd4eb('0x1')]},'body':{'type':Sequelize[_0xd4eb('0x2')](_0xd4eb('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4eb('0x4')),'defaultValue':_0xd4eb('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd4eb('0x1')]},'providerResponse':{'type':Sequelize[_0xd4eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 447d827..7de1637 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 _0x7bb9=['jsforce','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','limit','undefined','count','set','apply','reject','save','update','then','name','send','map','SquareMessage','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x15a1ef,_0x3dfb0a){var _0x24abd9=function(_0x5a42ba){while(--_0x5a42ba){_0x15a1ef['push'](_0x15a1ef['shift']());}};_0x24abd9(++_0x3dfb0a);}(_0x7bb9,0x1eb));var _0x97bb=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x7bb9[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0x97bb('0x0'));var rimraf=require(_0x97bb('0x1'));var zipdir=require(_0x97bb('0x2'));var jsonpatch=require(_0x97bb('0x3'));var rp=require(_0x97bb('0x4'));var moment=require('moment');var BPromise=require(_0x97bb('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97bb('0x6'));var csv=require(_0x97bb('0x7'));var ejs=require(_0x97bb('0x8'));var fs=require('fs');var fs_extra=require(_0x97bb('0x9'));var _=require(_0x97bb('0xa'));var squel=require(_0x97bb('0xb'));var crypto=require(_0x97bb('0xc'));var jsforce=require(_0x97bb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x97bb('0x7'));var querystring=require(_0x97bb('0xe'));var Papa=require(_0x97bb('0xf'));var Redis=require(_0x97bb('0x10'));var authService=require(_0x97bb('0x11'));var qs=require(_0x97bb('0x12'));var as=require(_0x97bb('0x13'));var hardwareService=require(_0x97bb('0x14'));var logger=require(_0x97bb('0x15'))(_0x97bb('0x16'));var utils=require(_0x97bb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x97bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x393be7,_0x309e71){_0x309e71=_0x309e71||0xcc;return function(_0x3ea5f1){if(_0x3ea5f1){return _0x393be7[_0x97bb('0x19')](_0x309e71);}return _0x393be7[_0x97bb('0x1a')](_0x309e71)[_0x97bb('0x1b')]();};}function respondWithResult(_0x46c5fd,_0x158bf9){_0x158bf9=_0x158bf9||0xc8;return function(_0x16d843){if(_0x16d843){return _0x46c5fd[_0x97bb('0x1a')](_0x158bf9)[_0x97bb('0x1c')](_0x16d843);}};}function respondWithFilteredResult(_0x1daffb,_0x3d63f2){return function(_0x5dbbd9){if(_0x5dbbd9){var _0x149bfe=typeof _0x3d63f2[_0x97bb('0x1d')]==='undefined'&&typeof _0x3d63f2[_0x97bb('0x1e')]===_0x97bb('0x1f');var _0x460937=_0x5dbbd9[_0x97bb('0x20')];var _0xecc171=_0x149bfe?0x0:_0x3d63f2[_0x97bb('0x1d')];var _0x235d12=_0x149bfe?_0x5dbbd9[_0x97bb('0x20')]:_0x3d63f2[_0x97bb('0x1d')]+_0x3d63f2[_0x97bb('0x1e')];var _0x43c45f;if(_0x235d12>=_0x460937){_0x235d12=_0x460937;_0x43c45f=0xc8;}else{_0x43c45f=0xce;}_0x1daffb[_0x97bb('0x1a')](_0x43c45f);return _0x1daffb[_0x97bb('0x21')]('Content-Range',_0xecc171+'-'+_0x235d12+'/'+_0x460937)[_0x97bb('0x1c')](_0x5dbbd9);}return null;};}function patchUpdates(_0x160c7b){return function(_0x1be334){try{jsonpatch[_0x97bb('0x22')](_0x1be334,_0x160c7b,!![]);}catch(_0x34c278){return BPromise[_0x97bb('0x23')](_0x34c278);}return _0x1be334[_0x97bb('0x24')]();};}function saveUpdates(_0x7c1f96,_0xd629df){return function(_0x5dc8e3){if(_0x5dc8e3){return _0x5dc8e3[_0x97bb('0x25')](_0x7c1f96)[_0x97bb('0x26')](function(_0x3ec791){return _0x3ec791;});}return null;};}function removeEntity(_0x17e9f5,_0x2ab133){return function(_0xbecd0f){if(_0xbecd0f){return _0xbecd0f['destroy']()[_0x97bb('0x26')](function(){_0x17e9f5[_0x97bb('0x1a')](0xcc)[_0x97bb('0x1b')]();});}};}function handleEntityNotFound(_0x5eeb10,_0x4d7ecd){return function(_0x4e4701){if(!_0x4e4701){_0x5eeb10[_0x97bb('0x19')](0x194);}return _0x4e4701;};}function handleError(_0x17dea2,_0x5f44ad){_0x5f44ad=_0x5f44ad||0x1f4;return function(_0x3098db){logger['error'](_0x3098db['stack']);if(_0x3098db[_0x97bb('0x27')]){delete _0x3098db[_0x97bb('0x27')];}_0x17dea2[_0x97bb('0x1a')](_0x5f44ad)[_0x97bb('0x28')](_0x3098db);};}exports['index']=function(_0x2c1d70,_0xe3aa4e){var _0x568c3d={},_0x4b0d64={},_0x2dfb2e={'count':0x0,'rows':[]};var _0x1f90f9=_[_0x97bb('0x29')](db[_0x97bb('0x2a')][_0x97bb('0x2b')],function(_0x26ed65){return{'name':_0x26ed65[_0x97bb('0x2c')],'type':_0x26ed65[_0x97bb('0x2d')]['key']};});_0x4b0d64[_0x97bb('0x2e')]=_[_0x97bb('0x29')](_0x1f90f9,'name');_0x4b0d64['query']=_[_0x97bb('0x2f')](_0x2c1d70[_0x97bb('0x30')]);_0x4b0d64['filters']=_['intersection'](_0x4b0d64[_0x97bb('0x2e')],_0x4b0d64['query']);_0x568c3d['attributes']=_[_0x97bb('0x31')](_0x4b0d64['model'],qs[_0x97bb('0x32')](_0x2c1d70['query'][_0x97bb('0x32')]));_0x568c3d[_0x97bb('0x33')]=_0x568c3d[_0x97bb('0x33')][_0x97bb('0x34')]?_0x568c3d[_0x97bb('0x33')]:_0x4b0d64[_0x97bb('0x2e')];if(!_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x35')]('nolimit')){_0x568c3d[_0x97bb('0x1e')]=qs[_0x97bb('0x1e')](_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x1e')]);_0x568c3d[_0x97bb('0x1d')]=qs[_0x97bb('0x1d')](_0x2c1d70['query']['offset']);}_0x568c3d[_0x97bb('0x36')]=qs['sort'](_0x2c1d70['query'][_0x97bb('0x37')]);_0x568c3d[_0x97bb('0x38')]=qs[_0x97bb('0x39')](_[_0x97bb('0x3a')](_0x2c1d70[_0x97bb('0x30')],_0x4b0d64[_0x97bb('0x39')]),_0x1f90f9);if(_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3b')]){_0x568c3d[_0x97bb('0x38')]=_[_0x97bb('0x3c')](_0x568c3d[_0x97bb('0x38')],{'$or':_[_0x97bb('0x29')](_0x1f90f9,function(_0x2888a5){if(_0x2888a5[_0x97bb('0x2d')]!=='VIRTUAL'){var _0x554311={};_0x554311[_0x2888a5[_0x97bb('0x27')]]={'$like':'%'+_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3b')]+'%'};return _0x554311;}})});}_0x568c3d=_[_0x97bb('0x3c')]({},_0x568c3d,_0x2c1d70[_0x97bb('0x3d')]);var _0x148d51={'where':_0x568c3d[_0x97bb('0x38')]};return db[_0x97bb('0x2a')]['count'](_0x148d51)[_0x97bb('0x26')](function(_0x483063){_0x2dfb2e[_0x97bb('0x20')]=_0x483063;if(_0x2c1d70[_0x97bb('0x30')][_0x97bb('0x3e')]){_0x568c3d[_0x97bb('0x3f')]=[{'all':!![]}];}return db[_0x97bb('0x2a')][_0x97bb('0x40')](_0x568c3d);})[_0x97bb('0x26')](function(_0x345a1b){_0x2dfb2e[_0x97bb('0x41')]=_0x345a1b;return _0x2dfb2e;})['then'](respondWithFilteredResult(_0xe3aa4e,_0x568c3d))[_0x97bb('0x42')](handleError(_0xe3aa4e,null));};exports['show']=function(_0x5650a9,_0x46603e){var _0x537d13={'raw':!![],'where':{'id':_0x5650a9['params']['id']}},_0x5e40fd={};_0x5e40fd[_0x97bb('0x2e')]=_[_0x97bb('0x2f')](db['SquareMessage'][_0x97bb('0x2b')]);_0x5e40fd[_0x97bb('0x30')]=_[_0x97bb('0x2f')](_0x5650a9[_0x97bb('0x30')]);_0x5e40fd[_0x97bb('0x39')]=_[_0x97bb('0x31')](_0x5e40fd[_0x97bb('0x2e')],_0x5e40fd[_0x97bb('0x30')]);_0x537d13[_0x97bb('0x33')]=_[_0x97bb('0x31')](_0x5e40fd[_0x97bb('0x2e')],qs[_0x97bb('0x32')](_0x5650a9[_0x97bb('0x30')]['fields']));_0x537d13[_0x97bb('0x33')]=_0x537d13[_0x97bb('0x33')][_0x97bb('0x34')]?_0x537d13[_0x97bb('0x33')]:_0x5e40fd['model'];if(_0x5650a9[_0x97bb('0x30')][_0x97bb('0x3e')]){_0x537d13[_0x97bb('0x3f')]=[{'all':!![]}];}_0x537d13=_[_0x97bb('0x3c')]({},_0x537d13,_0x5650a9[_0x97bb('0x3d')]);return db['SquareMessage'][_0x97bb('0x43')](_0x537d13)[_0x97bb('0x26')](handleEntityNotFound(_0x46603e,null))[_0x97bb('0x26')](respondWithResult(_0x46603e,null))['catch'](handleError(_0x46603e,null));};exports[_0x97bb('0x44')]=function(_0x375ac0,_0x2b2057){return db['SquareMessage']['create'](_0x375ac0[_0x97bb('0x45')],{})[_0x97bb('0x26')](respondWithResult(_0x2b2057,0xc9))[_0x97bb('0x42')](handleError(_0x2b2057,null));};exports['update']=function(_0x25fefe,_0xb7c95){if(_0x25fefe['body']['id']){delete _0x25fefe[_0x97bb('0x45')]['id'];}return db['SquareMessage'][_0x97bb('0x43')]({'where':{'id':_0x25fefe[_0x97bb('0x46')]['id']}})['then'](handleEntityNotFound(_0xb7c95,null))[_0x97bb('0x26')](saveUpdates(_0x25fefe[_0x97bb('0x45')],null))[_0x97bb('0x26')](respondWithResult(_0xb7c95,null))[_0x97bb('0x42')](handleError(_0xb7c95,null));};exports[_0x97bb('0x47')]=function(_0xd29787,_0xb1a38d){return db['SquareMessage']['find']({'where':{'id':_0xd29787[_0x97bb('0x46')]['id']}})['then'](handleEntityNotFound(_0xb1a38d,null))[_0x97bb('0x26')](removeEntity(_0xb1a38d,null))[_0x97bb('0x42')](handleError(_0xb1a38d,null));}; \ No newline at end of file +var _0x7582=['path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','params','intersection','fields','length','find','catch','create','body','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x166062,_0x2cc20b){var _0x13531f=function(_0x5a377d){while(--_0x5a377d){_0x166062['push'](_0x166062['shift']());}};_0x13531f(++_0x2cc20b);}(_0x7582,0x167));var _0x2758=function(_0x3f6c29,_0x370d86){_0x3f6c29=_0x3f6c29-0x0;var _0x4af959=_0x7582[_0x3f6c29];return _0x4af959;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2758('0x0'));var zipdir=require(_0x2758('0x1'));var jsonpatch=require(_0x2758('0x2'));var rp=require('request-promise');var moment=require(_0x2758('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2758('0x4'));var util=require(_0x2758('0x5'));var path=require(_0x2758('0x6'));var sox=require(_0x2758('0x7'));var csv=require('to-csv');var ejs=require(_0x2758('0x8'));var fs=require('fs');var fs_extra=require(_0x2758('0x9'));var _=require('lodash');var squel=require(_0x2758('0xa'));var crypto=require(_0x2758('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2758('0xc'));var toCsv=require(_0x2758('0xd'));var querystring=require(_0x2758('0xe'));var Papa=require('papaparse');var Redis=require(_0x2758('0xf'));var authService=require(_0x2758('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2758('0x11'));var logger=require(_0x2758('0x12'))(_0x2758('0x13'));var utils=require(_0x2758('0x14'));var config=require(_0x2758('0x15'));var licenseUtil=require(_0x2758('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x493357,_0x4caa8b){_0x4caa8b=_0x4caa8b||0xcc;return function(_0x1846cd){if(_0x1846cd){return _0x493357[_0x2758('0x17')](_0x4caa8b);}return _0x493357[_0x2758('0x18')](_0x4caa8b)[_0x2758('0x19')]();};}function respondWithResult(_0x3233af,_0x9db637){_0x9db637=_0x9db637||0xc8;return function(_0x3e1a7e){if(_0x3e1a7e){return _0x3233af[_0x2758('0x18')](_0x9db637)[_0x2758('0x1a')](_0x3e1a7e);}};}function respondWithFilteredResult(_0xad4346,_0x414a0b){return function(_0x361f14){if(_0x361f14){var _0x280ccc=typeof _0x414a0b[_0x2758('0x1b')]==='undefined'&&typeof _0x414a0b['limit']==='undefined';var _0x2b0ce0=_0x361f14[_0x2758('0x1c')];var _0x358358=_0x280ccc?0x0:_0x414a0b[_0x2758('0x1b')];var _0x1bccd9=_0x280ccc?_0x361f14[_0x2758('0x1c')]:_0x414a0b['offset']+_0x414a0b[_0x2758('0x1d')];var _0x4202e5;if(_0x1bccd9>=_0x2b0ce0){_0x1bccd9=_0x2b0ce0;_0x4202e5=0xc8;}else{_0x4202e5=0xce;}_0xad4346['status'](_0x4202e5);return _0xad4346[_0x2758('0x1e')](_0x2758('0x1f'),_0x358358+'-'+_0x1bccd9+'/'+_0x2b0ce0)[_0x2758('0x1a')](_0x361f14);}return null;};}function patchUpdates(_0x4100a0){return function(_0x50526b){try{jsonpatch[_0x2758('0x20')](_0x50526b,_0x4100a0,!![]);}catch(_0x4fa215){return BPromise[_0x2758('0x21')](_0x4fa215);}return _0x50526b[_0x2758('0x22')]();};}function saveUpdates(_0x27a887,_0x2797fe){return function(_0x4699c4){if(_0x4699c4){return _0x4699c4[_0x2758('0x23')](_0x27a887)[_0x2758('0x24')](function(_0x222601){return _0x222601;});}return null;};}function removeEntity(_0x38c483,_0x2ef395){return function(_0x1f645d){if(_0x1f645d){return _0x1f645d[_0x2758('0x25')]()['then'](function(){_0x38c483['status'](0xcc)[_0x2758('0x19')]();});}};}function handleEntityNotFound(_0x277f69,_0x1e6307){return function(_0x2209fc){if(!_0x2209fc){_0x277f69[_0x2758('0x17')](0x194);}return _0x2209fc;};}function handleError(_0x38f67d,_0x4aab11){_0x4aab11=_0x4aab11||0x1f4;return function(_0x48d5fa){logger[_0x2758('0x26')](_0x48d5fa[_0x2758('0x27')]);if(_0x48d5fa[_0x2758('0x28')]){delete _0x48d5fa[_0x2758('0x28')];}_0x38f67d['status'](_0x4aab11)['send'](_0x48d5fa);};}exports[_0x2758('0x29')]=function(_0x230f28,_0x46498b){var _0x5179ef={},_0x1d5f88={},_0x4b20ee={'count':0x0,'rows':[]};var _0x29d717=_[_0x2758('0x2a')](db[_0x2758('0x2b')][_0x2758('0x2c')],function(_0x2e0613){return{'name':_0x2e0613[_0x2758('0x2d')],'type':_0x2e0613[_0x2758('0x2e')][_0x2758('0x2f')]};});_0x1d5f88[_0x2758('0x30')]=_[_0x2758('0x2a')](_0x29d717,'name');_0x1d5f88[_0x2758('0x31')]=_[_0x2758('0x32')](_0x230f28[_0x2758('0x31')]);_0x1d5f88[_0x2758('0x33')]=_['intersection'](_0x1d5f88['model'],_0x1d5f88[_0x2758('0x31')]);_0x5179ef[_0x2758('0x34')]=_['intersection'](_0x1d5f88[_0x2758('0x30')],qs['fields'](_0x230f28[_0x2758('0x31')]['fields']));_0x5179ef[_0x2758('0x34')]=_0x5179ef[_0x2758('0x34')]['length']?_0x5179ef[_0x2758('0x34')]:_0x1d5f88[_0x2758('0x30')];if(!_0x230f28[_0x2758('0x31')][_0x2758('0x35')](_0x2758('0x36'))){_0x5179ef[_0x2758('0x1d')]=qs[_0x2758('0x1d')](_0x230f28[_0x2758('0x31')]['limit']);_0x5179ef[_0x2758('0x1b')]=qs[_0x2758('0x1b')](_0x230f28[_0x2758('0x31')][_0x2758('0x1b')]);}_0x5179ef[_0x2758('0x37')]=qs[_0x2758('0x38')](_0x230f28[_0x2758('0x31')][_0x2758('0x38')]);_0x5179ef[_0x2758('0x39')]=qs['filters'](_['pick'](_0x230f28[_0x2758('0x31')],_0x1d5f88[_0x2758('0x33')]),_0x29d717);if(_0x230f28[_0x2758('0x31')][_0x2758('0x3a')]){_0x5179ef[_0x2758('0x39')]=_[_0x2758('0x3b')](_0x5179ef['where'],{'$or':_[_0x2758('0x2a')](_0x29d717,function(_0x22be65){if(_0x22be65['type']!=='VIRTUAL'){var _0x4db245={};_0x4db245[_0x22be65[_0x2758('0x28')]]={'$like':'%'+_0x230f28[_0x2758('0x31')][_0x2758('0x3a')]+'%'};return _0x4db245;}})});}_0x5179ef=_[_0x2758('0x3b')]({},_0x5179ef,_0x230f28[_0x2758('0x3c')]);var _0x345e02={'where':_0x5179ef[_0x2758('0x39')]};return db[_0x2758('0x2b')][_0x2758('0x1c')](_0x345e02)[_0x2758('0x24')](function(_0x45ee16){_0x4b20ee['count']=_0x45ee16;if(_0x230f28[_0x2758('0x31')][_0x2758('0x3d')]){_0x5179ef[_0x2758('0x3e')]=[{'all':!![]}];}return db[_0x2758('0x2b')][_0x2758('0x3f')](_0x5179ef);})[_0x2758('0x24')](function(_0xf0df8e){_0x4b20ee[_0x2758('0x40')]=_0xf0df8e;return _0x4b20ee;})[_0x2758('0x24')](respondWithFilteredResult(_0x46498b,_0x5179ef))['catch'](handleError(_0x46498b,null));};exports['show']=function(_0x3055a2,_0x1efff2){var _0x562b0b={'raw':!![],'where':{'id':_0x3055a2[_0x2758('0x41')]['id']}},_0x2d19d8={};_0x2d19d8['model']=_[_0x2758('0x32')](db[_0x2758('0x2b')][_0x2758('0x2c')]);_0x2d19d8[_0x2758('0x31')]=_[_0x2758('0x32')](_0x3055a2['query']);_0x2d19d8['filters']=_['intersection'](_0x2d19d8[_0x2758('0x30')],_0x2d19d8[_0x2758('0x31')]);_0x562b0b[_0x2758('0x34')]=_[_0x2758('0x42')](_0x2d19d8[_0x2758('0x30')],qs[_0x2758('0x43')](_0x3055a2[_0x2758('0x31')][_0x2758('0x43')]));_0x562b0b['attributes']=_0x562b0b['attributes'][_0x2758('0x44')]?_0x562b0b[_0x2758('0x34')]:_0x2d19d8[_0x2758('0x30')];if(_0x3055a2['query']['includeAll']){_0x562b0b[_0x2758('0x3e')]=[{'all':!![]}];}_0x562b0b=_[_0x2758('0x3b')]({},_0x562b0b,_0x3055a2['options']);return db[_0x2758('0x2b')][_0x2758('0x45')](_0x562b0b)[_0x2758('0x24')](handleEntityNotFound(_0x1efff2,null))[_0x2758('0x24')](respondWithResult(_0x1efff2,null))[_0x2758('0x46')](handleError(_0x1efff2,null));};exports[_0x2758('0x47')]=function(_0x2ad215,_0x34c75c){return db[_0x2758('0x2b')][_0x2758('0x47')](_0x2ad215['body'],{})['then'](respondWithResult(_0x34c75c,0xc9))[_0x2758('0x46')](handleError(_0x34c75c,null));};exports[_0x2758('0x23')]=function(_0x43af2b,_0x2121df){if(_0x43af2b[_0x2758('0x48')]['id']){delete _0x43af2b['body']['id'];}return db[_0x2758('0x2b')]['find']({'where':{'id':_0x43af2b[_0x2758('0x41')]['id']}})[_0x2758('0x24')](handleEntityNotFound(_0x2121df,null))[_0x2758('0x24')](saveUpdates(_0x43af2b[_0x2758('0x48')],null))[_0x2758('0x24')](respondWithResult(_0x2121df,null))['catch'](handleError(_0x2121df,null));};exports[_0x2758('0x25')]=function(_0x5704c6,_0x403e05){return db[_0x2758('0x2b')]['find']({'where':{'id':_0x5704c6[_0x2758('0x41')]['id']}})[_0x2758('0x24')](handleEntityNotFound(_0x403e05,null))[_0x2758('0x24')](removeEntity(_0x403e05,null))[_0x2758('0x46')](handleError(_0x403e05,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 89efca7..fbb87d1 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 _0xb400=['request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','bluebird'];(function(_0x1d6b04,_0x4a613c){var _0x4c580e=function(_0x4a82ec){while(--_0x4a82ec){_0x1d6b04['push'](_0x1d6b04['shift']());}};_0x4c580e(++_0x4a613c);}(_0xb400,0x159));var _0x0b40=function(_0x2299a0,_0x36ca2c){_0x2299a0=_0x2299a0-0x0;var _0x5143f2=_0xb400[_0x2299a0];return _0x5143f2;};'use strict';var _=require(_0x0b40('0x0'));var util=require(_0x0b40('0x1'));var logger=require(_0x0b40('0x2'))(_0x0b40('0x3'));var moment=require('moment');var BPromise=require(_0x0b40('0x4'));var rp=require(_0x0b40('0x5'));var fs=require('fs');var path=require(_0x0b40('0x6'));var rimraf=require(_0x0b40('0x7'));var config=require(_0x0b40('0x8'));var attributes=require(_0x0b40('0x9'));module[_0x0b40('0xa')]=function(_0x448504,_0x572527){return _0x448504[_0x0b40('0xb')](_0x0b40('0xc'),attributes,{'tableName':_0x0b40('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd27d=['request-promise','path','exports','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x442a6f,_0x465db4){var _0x280685=function(_0x22b7b8){while(--_0x22b7b8){_0x442a6f['push'](_0x442a6f['shift']());}};_0x280685(++_0x465db4);}(_0xd27d,0x1f4));var _0xdd27=function(_0x3b7fb0,_0x553e21){_0x3b7fb0=_0x3b7fb0-0x0;var _0x3b7fc5=_0xd27d[_0x3b7fb0];return _0x3b7fc5;};'use strict';var _=require(_0xdd27('0x0'));var util=require(_0xdd27('0x1'));var logger=require(_0xdd27('0x2'))(_0xdd27('0x3'));var moment=require(_0xdd27('0x4'));var BPromise=require(_0xdd27('0x5'));var rp=require(_0xdd27('0x6'));var fs=require('fs');var path=require(_0xdd27('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0xdd27('0x8')]=function(_0x2ffd5d,_0x3e2862){return _0x2ffd5d['define'](_0xdd27('0x9'),attributes,{'tableName':_0xdd27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 3c212a7..1d3eb17 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 _0xf2c1=['info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request'];(function(_0x2cde6c,_0x51a8c2){var _0x308e14=function(_0x33f8e3){while(--_0x33f8e3){_0x2cde6c['push'](_0x2cde6c['shift']());}};_0x308e14(++_0x51a8c2);}(_0xf2c1,0x196));var _0x1f2c=function(_0x44e9d8,_0x13c3cd){_0x44e9d8=_0x44e9d8-0x0;var _0x32a396=_0xf2c1[_0x44e9d8];return _0x32a396;};'use strict';var _=require(_0x1f2c('0x0'));var util=require('util');var moment=require(_0x1f2c('0x1'));var BPromise=require(_0x1f2c('0x2'));var rs=require(_0x1f2c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f2c('0x4'))['db'];var utils=require(_0x1f2c('0x5'));var logger=require('../../config/logger')(_0x1f2c('0x6'));var config=require(_0x1f2c('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f2c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2baa72,_0x236bf7,_0x3d634e){return new BPromise(function(_0xbd7d38,_0x49f5ce){return client[_0x1f2c('0x9')](_0x2baa72,_0x3d634e)['then'](function(_0x3ad470){logger[_0x1f2c('0xa')](_0x1f2c('0xb'),_0x236bf7,_0x1f2c('0xc'));logger[_0x1f2c('0xd')](_0x1f2c('0xe'),_0x236bf7,_0x1f2c('0xc'),JSON[_0x1f2c('0xf')](_0x3ad470));if(_0x3ad470[_0x1f2c('0x10')]){if(_0x3ad470[_0x1f2c('0x10')]['code']===0x1f4){logger[_0x1f2c('0x10')](_0x1f2c('0xb'),_0x236bf7,_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);return _0x49f5ce(_0x3ad470['error']['message']);}logger['error'](_0x1f2c('0xb'),_0x236bf7,_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);return _0xbd7d38(_0x3ad470[_0x1f2c('0x10')][_0x1f2c('0x11')]);}else{logger[_0x1f2c('0xa')](_0x1f2c('0xb'),_0x236bf7,_0x1f2c('0xc'));_0xbd7d38(_0x3ad470['result'][_0x1f2c('0x11')]);}})[_0x1f2c('0x12')](function(_0x2e9f5d){logger[_0x1f2c('0x10')](_0x1f2c('0xb'),_0x236bf7,_0x2e9f5d);_0x49f5ce(_0x2e9f5d);});});}exports[_0x1f2c('0x13')]=function(_0x111113){var _0x329cb3=this;return new Promise(function(_0x40cc04,_0x34c9af){return db[_0x1f2c('0x14')][_0x1f2c('0x15')](_0x111113[_0x1f2c('0x16')],{'raw':_0x111113[_0x1f2c('0x17')]?_0x111113[_0x1f2c('0x17')][_0x1f2c('0x18')]===undefined?!![]:![]:!![]})[_0x1f2c('0x19')](function(_0x4bc87b){logger[_0x1f2c('0xa')](_0x1f2c('0x13'),_0x111113);logger[_0x1f2c('0xd')](_0x1f2c('0x13'),_0x111113,JSON[_0x1f2c('0xf')](_0x4bc87b));_0x40cc04(_0x4bc87b);})[_0x1f2c('0x12')](function(_0x40faf5){logger[_0x1f2c('0x10')](_0x1f2c('0x13'),_0x40faf5[_0x1f2c('0x11')],_0x111113);_0x34c9af(_0x329cb3[_0x1f2c('0x10')](0x1f4,_0x40faf5[_0x1f2c('0x11')]));});});}; \ No newline at end of file +var _0x2cd1=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','stringify','lodash','moment','randomstring'];(function(_0x3740fe,_0x6c543c){var _0x55492b=function(_0x1f851f){while(--_0x1f851f){_0x3740fe['push'](_0x3740fe['shift']());}};_0x55492b(++_0x6c543c);}(_0x2cd1,0xf9));var _0x12cd=function(_0x53476f,_0x6710f4){_0x53476f=_0x53476f-0x0;var _0x3662b0=_0x2cd1[_0x53476f];return _0x3662b0;};'use strict';var _=require(_0x12cd('0x0'));var util=require('util');var moment=require(_0x12cd('0x1'));var BPromise=require('bluebird');var rs=require(_0x12cd('0x2'));var fs=require('fs');var Redis=require(_0x12cd('0x3'));var db=require(_0x12cd('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x12cd('0x5'));var config=require(_0x12cd('0x6'));var jayson=require(_0x12cd('0x7'));var client=jayson['client'][_0x12cd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58345c,_0x15c91e,_0x3789fa){return new BPromise(function(_0x358399,_0xd72889){return client[_0x12cd('0x9')](_0x58345c,_0x3789fa)[_0x12cd('0xa')](function(_0x541a54){logger['info'](_0x12cd('0xb'),_0x15c91e,_0x12cd('0xc'));logger[_0x12cd('0xd')](_0x12cd('0xe'),_0x15c91e,'request\x20sent',JSON['stringify'](_0x541a54));if(_0x541a54[_0x12cd('0xf')]){if(_0x541a54[_0x12cd('0xf')][_0x12cd('0x10')]===0x1f4){logger[_0x12cd('0xf')](_0x12cd('0xb'),_0x15c91e,_0x541a54[_0x12cd('0xf')][_0x12cd('0x11')]);return _0xd72889(_0x541a54[_0x12cd('0xf')][_0x12cd('0x11')]);}logger['error'](_0x12cd('0xb'),_0x15c91e,_0x541a54[_0x12cd('0xf')][_0x12cd('0x11')]);return _0x358399(_0x541a54['error']['message']);}else{logger[_0x12cd('0x12')](_0x12cd('0xb'),_0x15c91e,'request\x20sent');_0x358399(_0x541a54[_0x12cd('0x13')]['message']);}})[_0x12cd('0x14')](function(_0x4c91bf){logger[_0x12cd('0xf')]('SquareMessage,\x20%s,\x20%s',_0x15c91e,_0x4c91bf);_0xd72889(_0x4c91bf);});});}exports[_0x12cd('0x15')]=function(_0x5ef1ed){var _0x4f8c84=this;return new Promise(function(_0x2d8012,_0x33a4fc){return db[_0x12cd('0x16')][_0x12cd('0x17')](_0x5ef1ed[_0x12cd('0x18')],{'raw':_0x5ef1ed['options']?_0x5ef1ed[_0x12cd('0x19')][_0x12cd('0x1a')]===undefined?!![]:![]:!![]})[_0x12cd('0xa')](function(_0x2faa1b){logger[_0x12cd('0x12')]('CreateSquareMessage',_0x5ef1ed);logger[_0x12cd('0xd')](_0x12cd('0x15'),_0x5ef1ed,JSON[_0x12cd('0x1b')](_0x2faa1b));_0x2d8012(_0x2faa1b);})[_0x12cd('0x14')](function(_0x1525d3){logger[_0x12cd('0xf')](_0x12cd('0x15'),_0x1525d3['message'],_0x5ef1ed);_0x33a4fc(_0x4f8c84[_0x12cd('0xf')](0x1f4,_0x1525d3[_0x12cd('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 7bbb95a..917810f 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 _0x18ea=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','/:id','show','isAuthenticated','test','post','create','put','update','exports','multer'];(function(_0xaee3df,_0x5853a0){var _0x4140f3=function(_0x4faec5){while(--_0x4faec5){_0xaee3df['push'](_0xaee3df['shift']());}};_0x4140f3(++_0x5853a0);}(_0x18ea,0xe9));var _0xa18e=function(_0x5eb089,_0x25944f){_0x5eb089=_0x5eb089-0x0;var _0x342cc3=_0x18ea[_0x5eb089];return _0x342cc3;};'use strict';var multer=require(_0xa18e('0x0'));var util=require(_0xa18e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa18e('0x2'));var router=express[_0xa18e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa18e('0x4'));var interaction=require(_0xa18e('0x5'));var config=require(_0xa18e('0x6'));var controller=require(_0xa18e('0x7'));router[_0xa18e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa18e('0x9'),auth['isAuthenticated'](),controller[_0xa18e('0xa')]);router[_0xa18e('0x8')]('/:id/test',auth[_0xa18e('0xb')](),timeout('15s'),controller[_0xa18e('0xc')]);router[_0xa18e('0xd')]('/',auth[_0xa18e('0xb')](),controller[_0xa18e('0xe')]);router[_0xa18e('0xf')](_0xa18e('0x9'),auth['isAuthenticated'](),controller[_0xa18e('0x10')]);router['delete'](_0xa18e('0x9'),auth[_0xa18e('0xb')](),controller['destroy']);module[_0xa18e('0x11')]=router; \ No newline at end of file +var _0x4f9b=['/:id','show','15s','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index'];(function(_0x4ba124,_0x1f6cd3){var _0x2cbd82=function(_0x30c8ec){while(--_0x30c8ec){_0x4ba124['push'](_0x4ba124['shift']());}};_0x2cbd82(++_0x1f6cd3);}(_0x4f9b,0x149));var _0xb4f9=function(_0x2e8f5e,_0x4068d9){_0x2e8f5e=_0x2e8f5e-0x0;var _0xb57b44=_0x4f9b[_0x2e8f5e];return _0xb57b44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb4f9('0x0'));var timeout=require(_0xb4f9('0x1'));var express=require(_0xb4f9('0x2'));var router=express[_0xb4f9('0x3')]();var fs_extra=require(_0xb4f9('0x4'));var auth=require(_0xb4f9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb4f9('0x6'));var controller=require(_0xb4f9('0x7'));router[_0xb4f9('0x8')]('/',auth[_0xb4f9('0x9')](),controller[_0xb4f9('0xa')]);router[_0xb4f9('0x8')](_0xb4f9('0xb'),auth[_0xb4f9('0x9')](),controller[_0xb4f9('0xc')]);router['get']('/:id/test',auth[_0xb4f9('0x9')](),timeout(_0xb4f9('0xd')),controller['test']);router[_0xb4f9('0xe')]('/',auth[_0xb4f9('0x9')](),controller['create']);router[_0xb4f9('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb4f9('0x10')]);router[_0xb4f9('0x11')](_0xb4f9('0xb'),auth['isAuthenticated'](),controller[_0xb4f9('0x12')]);module[_0xb4f9('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index e71040d..5f83525 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 _0x1766=['sequelize','exports','STRING','name'];(function(_0x1642fe,_0x4b21c7){var _0x5cac0c=function(_0x365929){while(--_0x365929){_0x1642fe['push'](_0x1642fe['shift']());}};_0x5cac0c(++_0x4b21c7);}(_0x1766,0x148));var _0x6176=function(_0x5101d6,_0x5d8aa3){_0x5101d6=_0x5101d6-0x0;var _0x14cff7=_0x1766[_0x5101d6];return _0x14cff7;};'use strict';var Sequelize=require(_0x6176('0x0'));module[_0x6176('0x1')]={'name':{'type':Sequelize[_0x6176('0x2')],'unique':_0x6176('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6176('0x2')]},'description':{'type':Sequelize[_0x6176('0x2')]}}; \ No newline at end of file +var _0x412e=['STRING'];(function(_0x35d08a,_0x298b24){var _0x541a50=function(_0x3b7587){while(--_0x3b7587){_0x35d08a['push'](_0x35d08a['shift']());}};_0x541a50(++_0x298b24);}(_0x412e,0x1ef));var _0xe412=function(_0x55aa7b,_0x4fc0eb){_0x55aa7b=_0x55aa7b-0x0;var _0x7e1f67=_0x412e[_0x55aa7b];return _0x7e1f67;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe412('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0xe412('0x0')]},'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 10e14fe..dd19c14 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 _0x6776=['name','send','index','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','order','sort','pick','type','VIRTUAL','filter','merge','options','SquareOdbc','count','findAll','catch','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','openSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','json','reject','save','then','destroy','get','ODBC','UserProfileResource','error','stack'];(function(_0x170b20,_0x49fc52){var _0xbe0395=function(_0x410eea){while(--_0x410eea){_0x170b20['push'](_0x170b20['shift']());}};_0xbe0395(++_0x49fc52);}(_0x6776,0x7f));var _0x6677=function(_0x5f0013,_0x39d054){_0x5f0013=_0x5f0013-0x0;var _0x5500cc=_0x6776[_0x5f0013];return _0x5500cc;};'use strict';var emlformat=require(_0x6677('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6677('0x1'));var jsonpatch=require(_0x6677('0x2'));var rp=require(_0x6677('0x3'));var moment=require(_0x6677('0x4'));var BPromise=require(_0x6677('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6677('0x6'));var sox=require(_0x6677('0x7'));var csv=require('to-csv');var ejs=require(_0x6677('0x8'));var fs=require('fs');var fs_extra=require(_0x6677('0x9'));var _=require(_0x6677('0xa'));var squel=require(_0x6677('0xb'));var crypto=require(_0x6677('0xc'));var jsforce=require(_0x6677('0xd'));var deskjs=require(_0x6677('0xe'));var toCsv=require(_0x6677('0xf'));var querystring=require(_0x6677('0x10'));var Papa=require(_0x6677('0x11'));var Redis=require(_0x6677('0x12'));var authService=require(_0x6677('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6677('0x14'));var hardwareService=require(_0x6677('0x15'));var logger=require(_0x6677('0x16'))(_0x6677('0x17'));var utils=require('../../config/utils');var config=require(_0x6677('0x18'));var licenseUtil=require(_0x6677('0x19'));var db=require(_0x6677('0x1a'))['db'];function respondWithStatusCode(_0x3988d3,_0x5e06cc){_0x5e06cc=_0x5e06cc||0xcc;return function(_0x1dec14){if(_0x1dec14){return _0x3988d3[_0x6677('0x1b')](_0x5e06cc);}return _0x3988d3[_0x6677('0x1c')](_0x5e06cc)[_0x6677('0x1d')]();};}function respondWithResult(_0x2d3347,_0xf4a6ba){_0xf4a6ba=_0xf4a6ba||0xc8;return function(_0x407b3f){if(_0x407b3f){return _0x2d3347[_0x6677('0x1c')](_0xf4a6ba)['json'](_0x407b3f);}};}function respondWithFilteredResult(_0x3692d1,_0x52a298){return function(_0x4d53f1){if(_0x4d53f1){var _0x2e6ba2=typeof _0x52a298[_0x6677('0x1e')]===_0x6677('0x1f')&&typeof _0x52a298[_0x6677('0x20')]===_0x6677('0x1f');var _0x472124=_0x4d53f1['count'];var _0x5ba494=_0x2e6ba2?0x0:_0x52a298[_0x6677('0x1e')];var _0x471f16=_0x2e6ba2?_0x4d53f1['count']:_0x52a298[_0x6677('0x1e')]+_0x52a298[_0x6677('0x20')];var _0x47a7e8;if(_0x471f16>=_0x472124){_0x471f16=_0x472124;_0x47a7e8=0xc8;}else{_0x47a7e8=0xce;}_0x3692d1['status'](_0x47a7e8);return _0x3692d1['set']('Content-Range',_0x5ba494+'-'+_0x471f16+'/'+_0x472124)[_0x6677('0x21')](_0x4d53f1);}return null;};}function patchUpdates(_0x3beeee){return function(_0x462109){try{jsonpatch['apply'](_0x462109,_0x3beeee,!![]);}catch(_0x188e33){return BPromise[_0x6677('0x22')](_0x188e33);}return _0x462109[_0x6677('0x23')]();};}function saveUpdates(_0x2a294d,_0x1537e1){return function(_0x3708f5){if(_0x3708f5){return _0x3708f5['update'](_0x2a294d)[_0x6677('0x24')](function(_0x1b229a){return _0x1b229a;});}return null;};}function removeEntity(_0x1194f9,_0x119ced){return function(_0xcc726e){if(_0xcc726e){return _0xcc726e[_0x6677('0x25')]()[_0x6677('0x24')](function(){var _0x41d686=_0xcc726e[_0x6677('0x26')]({'plain':!![]});var _0x471321=_0x6677('0x27');return db[_0x6677('0x28')][_0x6677('0x25')]({'where':{'type':_0x471321,'resourceId':_0x41d686['id']}})[_0x6677('0x24')](function(){return _0xcc726e;});})['then'](function(){_0x1194f9[_0x6677('0x1c')](0xcc)[_0x6677('0x1d')]();});}};}function handleEntityNotFound(_0x3cf5d9,_0x51cbb7){return function(_0x8edc87){if(!_0x8edc87){_0x3cf5d9[_0x6677('0x1b')](0x194);}return _0x8edc87;};}function handleError(_0x62e943,_0x2f9a67){_0x2f9a67=_0x2f9a67||0x1f4;return function(_0x137f95){logger[_0x6677('0x29')](_0x137f95[_0x6677('0x2a')]);if(_0x137f95[_0x6677('0x2b')]){delete _0x137f95['name'];}_0x62e943['status'](_0x2f9a67)[_0x6677('0x2c')](_0x137f95);};}exports[_0x6677('0x2d')]=function(_0x50e08f,_0x3fd61b){var _0xa24b19={},_0xffd83e={},_0x4245c7={'count':0x0,'rows':[]};var _0x1405b9=_['map'](db['SquareOdbc']['rawAttributes'],function(_0x4bea08){return{'name':_0x4bea08[_0x6677('0x2e')],'type':_0x4bea08['type'][_0x6677('0x2f')]};});_0xffd83e[_0x6677('0x30')]=_[_0x6677('0x31')](_0x1405b9,_0x6677('0x2b'));_0xffd83e[_0x6677('0x32')]=_[_0x6677('0x33')](_0x50e08f[_0x6677('0x32')]);_0xffd83e[_0x6677('0x34')]=_[_0x6677('0x35')](_0xffd83e['model'],_0xffd83e[_0x6677('0x32')]);_0xa24b19[_0x6677('0x36')]=_[_0x6677('0x35')](_0xffd83e[_0x6677('0x30')],qs[_0x6677('0x37')](_0x50e08f[_0x6677('0x32')][_0x6677('0x37')]));_0xa24b19['attributes']=_0xa24b19[_0x6677('0x36')][_0x6677('0x38')]?_0xa24b19[_0x6677('0x36')]:_0xffd83e[_0x6677('0x30')];if(!_0x50e08f[_0x6677('0x32')]['hasOwnProperty']('nolimit')){_0xa24b19[_0x6677('0x20')]=qs['limit'](_0x50e08f[_0x6677('0x32')]['limit']);_0xa24b19['offset']=qs[_0x6677('0x1e')](_0x50e08f['query']['offset']);}_0xa24b19[_0x6677('0x39')]=qs[_0x6677('0x3a')](_0x50e08f[_0x6677('0x32')][_0x6677('0x3a')]);_0xa24b19['where']=qs[_0x6677('0x34')](_[_0x6677('0x3b')](_0x50e08f['query'],_0xffd83e['filters']),_0x1405b9);if(_0x50e08f['query']['filter']){_0xa24b19['where']=_['merge'](_0xa24b19['where'],{'$or':_[_0x6677('0x31')](_0x1405b9,function(_0x51bd8a){if(_0x51bd8a[_0x6677('0x3c')]!==_0x6677('0x3d')){var _0x5e0fc4={};_0x5e0fc4[_0x51bd8a[_0x6677('0x2b')]]={'$like':'%'+_0x50e08f[_0x6677('0x32')][_0x6677('0x3e')]+'%'};return _0x5e0fc4;}})});}_0xa24b19=_[_0x6677('0x3f')]({},_0xa24b19,_0x50e08f[_0x6677('0x40')]);var _0x41c753={'where':_0xa24b19['where']};return db[_0x6677('0x41')][_0x6677('0x42')](_0x41c753)[_0x6677('0x24')](function(_0x1839b0){_0x4245c7[_0x6677('0x42')]=_0x1839b0;if(_0x50e08f[_0x6677('0x32')]['includeAll']){_0xa24b19['include']=[{'all':!![]}];}return db[_0x6677('0x41')][_0x6677('0x43')](_0xa24b19);})[_0x6677('0x24')](function(_0xfcf871){_0x4245c7['rows']=_0xfcf871;return _0x4245c7;})[_0x6677('0x24')](respondWithFilteredResult(_0x3fd61b,_0xa24b19))[_0x6677('0x44')](handleError(_0x3fd61b,null));};exports[_0x6677('0x45')]=function(_0x2c51c3,_0x57b3bb){var _0x55949f={'raw':!![],'where':{'id':_0x2c51c3['params']['id']}},_0x5b1c5c={};_0x5b1c5c[_0x6677('0x30')]=_[_0x6677('0x33')](db[_0x6677('0x41')]['rawAttributes']);_0x5b1c5c[_0x6677('0x32')]=_[_0x6677('0x33')](_0x2c51c3['query']);_0x5b1c5c['filters']=_[_0x6677('0x35')](_0x5b1c5c[_0x6677('0x30')],_0x5b1c5c[_0x6677('0x32')]);_0x55949f[_0x6677('0x36')]=_['intersection'](_0x5b1c5c[_0x6677('0x30')],qs[_0x6677('0x37')](_0x2c51c3[_0x6677('0x32')][_0x6677('0x37')]));_0x55949f[_0x6677('0x36')]=_0x55949f[_0x6677('0x36')][_0x6677('0x38')]?_0x55949f[_0x6677('0x36')]:_0x5b1c5c[_0x6677('0x30')];if(_0x2c51c3[_0x6677('0x32')][_0x6677('0x46')]){_0x55949f['include']=[{'all':!![]}];}_0x55949f=_['merge']({},_0x55949f,_0x2c51c3[_0x6677('0x40')]);return db['SquareOdbc'][_0x6677('0x47')](_0x55949f)[_0x6677('0x24')](handleEntityNotFound(_0x57b3bb,null))[_0x6677('0x24')](respondWithResult(_0x57b3bb,null))[_0x6677('0x44')](handleError(_0x57b3bb,null));};exports[_0x6677('0x48')]=function(_0x411a5c,_0x50a374){return db['SquareOdbc'][_0x6677('0x48')](_0x411a5c[_0x6677('0x49')],{})[_0x6677('0x24')](function(_0x3f0c6b){var _0x1b2bf2=_0x411a5c['user'][_0x6677('0x26')]({'plain':!![]});if(!_0x1b2bf2)throw new Error(_0x6677('0x4a'));if(_0x1b2bf2[_0x6677('0x4b')]===_0x6677('0x4c')){var _0x2dc992=_0x3f0c6b[_0x6677('0x26')]({'plain':!![]});var _0x41c8ae=_0x6677('0x27');return db[_0x6677('0x4d')][_0x6677('0x47')]({'where':{'name':_0x41c8ae,'userProfileId':_0x1b2bf2[_0x6677('0x4e')]},'raw':!![]})[_0x6677('0x24')](function(_0x147733){if(_0x147733&&_0x147733[_0x6677('0x4f')]===0x0){return db[_0x6677('0x28')][_0x6677('0x48')]({'name':_0x2dc992[_0x6677('0x2b')],'resourceId':_0x2dc992['id'],'type':_0x147733[_0x6677('0x2b')],'sectionId':_0x147733['id']},{})['then'](function(){return _0x3f0c6b;});}else{return _0x3f0c6b;}})[_0x6677('0x44')](function(_0x4b91af){logger['error'](_0x6677('0x50'),_0x4b91af);throw _0x4b91af;});}return _0x3f0c6b;})[_0x6677('0x24')](respondWithResult(_0x50a374,0xc9))[_0x6677('0x44')](handleError(_0x50a374,null));};exports['update']=function(_0x595f6d,_0x30846c){if(_0x595f6d[_0x6677('0x49')]['id']){delete _0x595f6d['body']['id'];}return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x595f6d['params']['id']}})[_0x6677('0x24')](handleEntityNotFound(_0x30846c,null))[_0x6677('0x24')](saveUpdates(_0x595f6d[_0x6677('0x49')],null))[_0x6677('0x24')](respondWithResult(_0x30846c,null))[_0x6677('0x44')](handleError(_0x30846c,null));};exports['destroy']=function(_0x556f00,_0x50af5a){return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x556f00[_0x6677('0x51')]['id']}})['then'](handleEntityNotFound(_0x50af5a,null))[_0x6677('0x24')](removeEntity(_0x50af5a,null))[_0x6677('0x44')](handleError(_0x50af5a,null));};exports[_0x6677('0x52')]=function(_0x425f92,_0x2574d5,_0x1a54c5){var _0x317453;return db[_0x6677('0x41')][_0x6677('0x47')]({'where':{'id':_0x425f92[_0x6677('0x51')]['id']},'attributes':['id',_0x6677('0x53')]})[_0x6677('0x24')](handleEntityNotFound(_0x2574d5,null))['then'](function(_0x4617eb){if(_0x4617eb){var _0x1e77b3=require('odbc')();_0x1e77b3[_0x6677('0x54')](_0x4617eb[_0x6677('0x53')]);_0x1e77b3['closeSync']();return _0x4617eb;}})[_0x6677('0x24')](respondWithResult(_0x2574d5,null))[_0x6677('0x44')](handleError(_0x2574d5,null));}; \ No newline at end of file +var _0x15fe=['../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ODBC','UserProfileResource','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','keys','include','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','dsn','closeSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util'];(function(_0x5f3117,_0x395d34){var _0x41ff85=function(_0x26168a){while(--_0x26168a){_0x5f3117['push'](_0x5f3117['shift']());}};_0x41ff85(++_0x395d34);}(_0x15fe,0x9a));var _0xe15f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x15fe[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe15f('0x0'));var zipdir=require(_0xe15f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe15f('0x2'));var moment=require(_0xe15f('0x3'));var BPromise=require(_0xe15f('0x4'));var Mustache=require(_0xe15f('0x5'));var util=require(_0xe15f('0x6'));var path=require(_0xe15f('0x7'));var sox=require(_0xe15f('0x8'));var csv=require(_0xe15f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe15f('0xa'));var _=require(_0xe15f('0xb'));var squel=require(_0xe15f('0xc'));var crypto=require(_0xe15f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe15f('0xe'));var toCsv=require(_0xe15f('0x9'));var querystring=require('querystring');var Papa=require(_0xe15f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe15f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe15f('0x11'));var logger=require(_0xe15f('0x12'))(_0xe15f('0x13'));var utils=require('../../config/utils');var config=require(_0xe15f('0x14'));var licenseUtil=require(_0xe15f('0x15'));var db=require(_0xe15f('0x16'))['db'];function respondWithStatusCode(_0x4684f8,_0x2b5fc1){_0x2b5fc1=_0x2b5fc1||0xcc;return function(_0x3c5acf){if(_0x3c5acf){return _0x4684f8[_0xe15f('0x17')](_0x2b5fc1);}return _0x4684f8['status'](_0x2b5fc1)[_0xe15f('0x18')]();};}function respondWithResult(_0x42d9f8,_0x31c4d9){_0x31c4d9=_0x31c4d9||0xc8;return function(_0x3325b9){if(_0x3325b9){return _0x42d9f8[_0xe15f('0x19')](_0x31c4d9)[_0xe15f('0x1a')](_0x3325b9);}};}function respondWithFilteredResult(_0x29b787,_0x55a711){return function(_0x37dd3c){if(_0x37dd3c){var _0x34cde2=typeof _0x55a711[_0xe15f('0x1b')]==='undefined'&&typeof _0x55a711[_0xe15f('0x1c')]==='undefined';var _0x24169d=_0x37dd3c[_0xe15f('0x1d')];var _0x12ba24=_0x34cde2?0x0:_0x55a711[_0xe15f('0x1b')];var _0x41aff8=_0x34cde2?_0x37dd3c['count']:_0x55a711[_0xe15f('0x1b')]+_0x55a711[_0xe15f('0x1c')];var _0x3177bd;if(_0x41aff8>=_0x24169d){_0x41aff8=_0x24169d;_0x3177bd=0xc8;}else{_0x3177bd=0xce;}_0x29b787[_0xe15f('0x19')](_0x3177bd);return _0x29b787[_0xe15f('0x1e')](_0xe15f('0x1f'),_0x12ba24+'-'+_0x41aff8+'/'+_0x24169d)['json'](_0x37dd3c);}return null;};}function patchUpdates(_0x54f17e){return function(_0x5a10b8){try{jsonpatch[_0xe15f('0x20')](_0x5a10b8,_0x54f17e,!![]);}catch(_0x4cf0ae){return BPromise[_0xe15f('0x21')](_0x4cf0ae);}return _0x5a10b8[_0xe15f('0x22')]();};}function saveUpdates(_0x52bdb4,_0x410b46){return function(_0x172840){if(_0x172840){return _0x172840[_0xe15f('0x23')](_0x52bdb4)['then'](function(_0x487caf){return _0x487caf;});}return null;};}function removeEntity(_0x5251d2,_0x9a933f){return function(_0x50c3d9){if(_0x50c3d9){return _0x50c3d9[_0xe15f('0x24')]()[_0xe15f('0x25')](function(){var _0x33a46c=_0x50c3d9[_0xe15f('0x26')]({'plain':!![]});var _0x55440d=_0xe15f('0x27');return db[_0xe15f('0x28')][_0xe15f('0x24')]({'where':{'type':_0x55440d,'resourceId':_0x33a46c['id']}})[_0xe15f('0x25')](function(){return _0x50c3d9;});})[_0xe15f('0x25')](function(){_0x5251d2[_0xe15f('0x19')](0xcc)[_0xe15f('0x18')]();});}};}function handleEntityNotFound(_0x38867e,_0x2011f0){return function(_0xa31819){if(!_0xa31819){_0x38867e[_0xe15f('0x17')](0x194);}return _0xa31819;};}function handleError(_0x1f7a9d,_0x3ec1cf){_0x3ec1cf=_0x3ec1cf||0x1f4;return function(_0x2bff63){logger[_0xe15f('0x29')](_0x2bff63[_0xe15f('0x2a')]);if(_0x2bff63[_0xe15f('0x2b')]){delete _0x2bff63[_0xe15f('0x2b')];}_0x1f7a9d[_0xe15f('0x19')](_0x3ec1cf)[_0xe15f('0x2c')](_0x2bff63);};}exports[_0xe15f('0x2d')]=function(_0x30078f,_0x2dc893){var _0x31e1c5={},_0x12c44f={},_0x5cdf21={'count':0x0,'rows':[]};var _0x2f11cb=_[_0xe15f('0x2e')](db[_0xe15f('0x2f')][_0xe15f('0x30')],function(_0x11cdee){return{'name':_0x11cdee[_0xe15f('0x31')],'type':_0x11cdee[_0xe15f('0x32')][_0xe15f('0x33')]};});_0x12c44f[_0xe15f('0x34')]=_['map'](_0x2f11cb,'name');_0x12c44f['query']=_['keys'](_0x30078f[_0xe15f('0x35')]);_0x12c44f[_0xe15f('0x36')]=_[_0xe15f('0x37')](_0x12c44f['model'],_0x12c44f[_0xe15f('0x35')]);_0x31e1c5[_0xe15f('0x38')]=_[_0xe15f('0x37')](_0x12c44f[_0xe15f('0x34')],qs[_0xe15f('0x39')](_0x30078f[_0xe15f('0x35')][_0xe15f('0x39')]));_0x31e1c5[_0xe15f('0x38')]=_0x31e1c5[_0xe15f('0x38')][_0xe15f('0x3a')]?_0x31e1c5[_0xe15f('0x38')]:_0x12c44f[_0xe15f('0x34')];if(!_0x30078f[_0xe15f('0x35')][_0xe15f('0x3b')](_0xe15f('0x3c'))){_0x31e1c5[_0xe15f('0x1c')]=qs['limit'](_0x30078f['query'][_0xe15f('0x1c')]);_0x31e1c5[_0xe15f('0x1b')]=qs[_0xe15f('0x1b')](_0x30078f['query'][_0xe15f('0x1b')]);}_0x31e1c5['order']=qs['sort'](_0x30078f['query'][_0xe15f('0x3d')]);_0x31e1c5[_0xe15f('0x3e')]=qs[_0xe15f('0x36')](_[_0xe15f('0x3f')](_0x30078f['query'],_0x12c44f[_0xe15f('0x36')]),_0x2f11cb);if(_0x30078f[_0xe15f('0x35')][_0xe15f('0x40')]){_0x31e1c5[_0xe15f('0x3e')]=_['merge'](_0x31e1c5[_0xe15f('0x3e')],{'$or':_[_0xe15f('0x2e')](_0x2f11cb,function(_0x19b0eb){if(_0x19b0eb['type']!==_0xe15f('0x41')){var _0x11bcc8={};_0x11bcc8[_0x19b0eb[_0xe15f('0x2b')]]={'$like':'%'+_0x30078f[_0xe15f('0x35')][_0xe15f('0x40')]+'%'};return _0x11bcc8;}})});}_0x31e1c5=_[_0xe15f('0x42')]({},_0x31e1c5,_0x30078f[_0xe15f('0x43')]);var _0x344827={'where':_0x31e1c5[_0xe15f('0x3e')]};return db[_0xe15f('0x2f')][_0xe15f('0x1d')](_0x344827)[_0xe15f('0x25')](function(_0x469639){_0x5cdf21[_0xe15f('0x1d')]=_0x469639;if(_0x30078f[_0xe15f('0x35')][_0xe15f('0x44')]){_0x31e1c5['include']=[{'all':!![]}];}return db['SquareOdbc'][_0xe15f('0x45')](_0x31e1c5);})[_0xe15f('0x25')](function(_0x2d95c7){_0x5cdf21[_0xe15f('0x46')]=_0x2d95c7;return _0x5cdf21;})[_0xe15f('0x25')](respondWithFilteredResult(_0x2dc893,_0x31e1c5))['catch'](handleError(_0x2dc893,null));};exports['show']=function(_0x16b4de,_0x4b4b79){var _0x4216a2={'raw':!![],'where':{'id':_0x16b4de[_0xe15f('0x47')]['id']}},_0x524074={};_0x524074[_0xe15f('0x34')]=_['keys'](db[_0xe15f('0x2f')][_0xe15f('0x30')]);_0x524074[_0xe15f('0x35')]=_[_0xe15f('0x48')](_0x16b4de[_0xe15f('0x35')]);_0x524074[_0xe15f('0x36')]=_[_0xe15f('0x37')](_0x524074['model'],_0x524074[_0xe15f('0x35')]);_0x4216a2['attributes']=_[_0xe15f('0x37')](_0x524074[_0xe15f('0x34')],qs['fields'](_0x16b4de[_0xe15f('0x35')][_0xe15f('0x39')]));_0x4216a2[_0xe15f('0x38')]=_0x4216a2[_0xe15f('0x38')]['length']?_0x4216a2['attributes']:_0x524074[_0xe15f('0x34')];if(_0x16b4de[_0xe15f('0x35')][_0xe15f('0x44')]){_0x4216a2[_0xe15f('0x49')]=[{'all':!![]}];}_0x4216a2=_[_0xe15f('0x42')]({},_0x4216a2,_0x16b4de[_0xe15f('0x43')]);return db[_0xe15f('0x2f')][_0xe15f('0x4a')](_0x4216a2)[_0xe15f('0x25')](handleEntityNotFound(_0x4b4b79,null))[_0xe15f('0x25')](respondWithResult(_0x4b4b79,null))[_0xe15f('0x4b')](handleError(_0x4b4b79,null));};exports['create']=function(_0x5271e0,_0x80f443){return db['SquareOdbc']['create'](_0x5271e0['body'],{})['then'](function(_0x43b840){var _0x476583=_0x5271e0['user'][_0xe15f('0x26')]({'plain':!![]});if(!_0x476583)throw new Error(_0xe15f('0x4c'));if(_0x476583[_0xe15f('0x4d')]===_0xe15f('0x4e')){var _0x264294=_0x43b840['get']({'plain':!![]});var _0x2503d9=_0xe15f('0x27');return db[_0xe15f('0x4f')][_0xe15f('0x4a')]({'where':{'name':_0x2503d9,'userProfileId':_0x476583['userProfileId']},'raw':!![]})[_0xe15f('0x25')](function(_0x2b6c15){if(_0x2b6c15&&_0x2b6c15[_0xe15f('0x50')]===0x0){return db[_0xe15f('0x28')][_0xe15f('0x51')]({'name':_0x264294[_0xe15f('0x2b')],'resourceId':_0x264294['id'],'type':_0x2b6c15[_0xe15f('0x2b')],'sectionId':_0x2b6c15['id']},{})[_0xe15f('0x25')](function(){return _0x43b840;});}else{return _0x43b840;}})[_0xe15f('0x4b')](function(_0x4df139){logger[_0xe15f('0x29')](_0xe15f('0x52'),_0x4df139);throw _0x4df139;});}return _0x43b840;})['then'](respondWithResult(_0x80f443,0xc9))[_0xe15f('0x4b')](handleError(_0x80f443,null));};exports['update']=function(_0x3beb7d,_0x1faf5e){if(_0x3beb7d[_0xe15f('0x53')]['id']){delete _0x3beb7d[_0xe15f('0x53')]['id'];}return db[_0xe15f('0x2f')][_0xe15f('0x4a')]({'where':{'id':_0x3beb7d['params']['id']}})[_0xe15f('0x25')](handleEntityNotFound(_0x1faf5e,null))['then'](saveUpdates(_0x3beb7d[_0xe15f('0x53')],null))[_0xe15f('0x25')](respondWithResult(_0x1faf5e,null))['catch'](handleError(_0x1faf5e,null));};exports[_0xe15f('0x24')]=function(_0x2861fd,_0x4f4bda){return db['SquareOdbc'][_0xe15f('0x4a')]({'where':{'id':_0x2861fd[_0xe15f('0x47')]['id']}})[_0xe15f('0x25')](handleEntityNotFound(_0x4f4bda,null))[_0xe15f('0x25')](removeEntity(_0x4f4bda,null))[_0xe15f('0x4b')](handleError(_0x4f4bda,null));};exports[_0xe15f('0x54')]=function(_0x2ed25a,_0x581eb0,_0x7a0008){var _0x5d01f6;return db[_0xe15f('0x2f')]['find']({'where':{'id':_0x2ed25a[_0xe15f('0x47')]['id']},'attributes':['id','dsn']})[_0xe15f('0x25')](handleEntityNotFound(_0x581eb0,null))[_0xe15f('0x25')](function(_0x484fd2){if(_0x484fd2){var _0x456018=require(_0xe15f('0x55'))();_0x456018['openSync'](_0x484fd2[_0xe15f('0x56')]);_0x456018[_0xe15f('0x57')]();return _0x484fd2;}})[_0xe15f('0x25')](respondWithResult(_0x581eb0,null))[_0xe15f('0x4b')](handleError(_0x581eb0,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 3e0786e..d0ef75b 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 _0x5276=['SquareOdbc','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x5c2733,_0x4464a3){var _0x37cd7f=function(_0x13c0a1){while(--_0x13c0a1){_0x5c2733['push'](_0x5c2733['shift']());}};_0x37cd7f(++_0x4464a3);}(_0x5276,0x11f));var _0x6527=function(_0x1ee1a8,_0x2d43fe){_0x1ee1a8=_0x1ee1a8-0x0;var _0x58bf44=_0x5276[_0x1ee1a8];return _0x58bf44;};'use strict';var _=require(_0x6527('0x0'));var util=require('util');var logger=require(_0x6527('0x1'))(_0x6527('0x2'));var moment=require(_0x6527('0x3'));var BPromise=require(_0x6527('0x4'));var rp=require(_0x6527('0x5'));var fs=require('fs');var path=require(_0x6527('0x6'));var rimraf=require(_0x6527('0x7'));var config=require(_0x6527('0x8'));var attributes=require(_0x6527('0x9'));module[_0x6527('0xa')]=function(_0x1aa40d,_0x11e6ad){return _0x1aa40d[_0x6527('0xb')](_0x6527('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9101=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','./squareOdbc.attributes','define','SquareOdbc'];(function(_0x183510,_0x43a3f8){var _0x154888=function(_0x1a074c){while(--_0x1a074c){_0x183510['push'](_0x183510['shift']());}};_0x154888(++_0x43a3f8);}(_0x9101,0x6e));var _0x1910=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9101[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x1910('0x0'));var util=require('util');var logger=require(_0x1910('0x1'))(_0x1910('0x2'));var moment=require(_0x1910('0x3'));var BPromise=require('bluebird');var rp=require(_0x1910('0x4'));var fs=require('fs');var path=require(_0x1910('0x5'));var rimraf=require(_0x1910('0x6'));var config=require('../../config/environment');var attributes=require(_0x1910('0x7'));module['exports']=function(_0x1aa0e8,_0x38617d){return _0x1aa0e8[_0x1910('0x8')](_0x1910('0x9'),attributes,{'tableName':'square_odbc','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 2257a0b..ce53aa7 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 _0x15b5=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','lodash','util','moment','randomstring','ioredis'];(function(_0x122556,_0x440778){var _0x227d73=function(_0x3f7dbe){while(--_0x3f7dbe){_0x122556['push'](_0x122556['shift']());}};_0x227d73(++_0x440778);}(_0x15b5,0x15b));var _0x515b=function(_0x1aab74,_0x38a57b){_0x1aab74=_0x1aab74-0x0;var _0x396af2=_0x15b5[_0x1aab74];return _0x396af2;};'use strict';var _=require(_0x515b('0x0'));var util=require(_0x515b('0x1'));var moment=require(_0x515b('0x2'));var BPromise=require('bluebird');var rs=require(_0x515b('0x3'));var fs=require('fs');var Redis=require(_0x515b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x515b('0x5'));var logger=require(_0x515b('0x6'))(_0x515b('0x7'));var config=require(_0x515b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x515b('0x9')][_0x515b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e19a6,_0x33863a,_0x196730){return new BPromise(function(_0x5d2bbe,_0x517615){return client['request'](_0x4e19a6,_0x196730)[_0x515b('0xb')](function(_0x4ab0d8){logger['info'](_0x515b('0xc'),_0x33863a,_0x515b('0xd'));logger[_0x515b('0xe')](_0x515b('0xf'),_0x33863a,'request\x20sent',JSON[_0x515b('0x10')](_0x4ab0d8));if(_0x4ab0d8['error']){if(_0x4ab0d8[_0x515b('0x11')][_0x515b('0x12')]===0x1f4){logger['error'](_0x515b('0xc'),_0x33863a,_0x4ab0d8['error'][_0x515b('0x13')]);return _0x517615(_0x4ab0d8['error'][_0x515b('0x13')]);}logger[_0x515b('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x33863a,_0x4ab0d8[_0x515b('0x11')]['message']);return _0x5d2bbe(_0x4ab0d8[_0x515b('0x11')][_0x515b('0x13')]);}else{logger[_0x515b('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x33863a,_0x515b('0xd'));_0x5d2bbe(_0x4ab0d8[_0x515b('0x15')]['message']);}})[_0x515b('0x16')](function(_0x5f0b7a){logger[_0x515b('0x11')](_0x515b('0xc'),_0x33863a,_0x5f0b7a);_0x517615(_0x5f0b7a);});});}exports[_0x515b('0x17')]=function(_0x4a2d3a){var _0x12737f=this;return new Promise(function(_0x4d71b0,_0x3a1049){return db[_0x515b('0x18')][_0x515b('0x19')]({'raw':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a['options'][_0x515b('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a2d3a['options']?_0x4a2d3a[_0x515b('0x1a')]['where']||null:null,'attributes':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a['options'][_0x515b('0x1c')]||null:null,'include':_0x4a2d3a[_0x515b('0x1a')]?_0x4a2d3a[_0x515b('0x1a')][_0x515b('0x1d')]?_['map'](_0x4a2d3a['options'][_0x515b('0x1d')],function(_0x5a4698){return{'model':db[_0x5a4698['model']],'as':_0x5a4698['as'],'attributes':_0x5a4698[_0x515b('0x1c')],'include':_0x5a4698['include']?_[_0x515b('0x1e')](_0x5a4698[_0x515b('0x1d')],function(_0x4c0fbf){return{'model':db[_0x4c0fbf[_0x515b('0x1f')]],'as':_0x4c0fbf['as'],'attributes':_0x4c0fbf[_0x515b('0x1c')],'include':_0x4c0fbf[_0x515b('0x1d')]?_[_0x515b('0x1e')](_0x4c0fbf['include'],function(_0x7f5fcb){return{'model':db[_0x7f5fcb['model']],'as':_0x7f5fcb['as'],'attributes':_0x7f5fcb[_0x515b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ccdde){logger[_0x515b('0x14')](_0x515b('0x17'),_0x4a2d3a);logger[_0x515b('0xe')]('ShowSquareOdbc',_0x4a2d3a,JSON[_0x515b('0x10')](_0x5ccdde));_0x4d71b0(_0x5ccdde);})['catch'](function(_0x23c8e2){logger[_0x515b('0x11')](_0x515b('0x17'),_0x23c8e2[_0x515b('0x13')],_0x4a2d3a);_0x3a1049(_0x12737f[_0x515b('0x11')](0x1f4,_0x23c8e2[_0x515b('0x13')]));});});}; \ No newline at end of file +var _0xf900=['request\x20sent','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1c540c,_0x294dff){var _0x4c372a=function(_0x4e5852){while(--_0x4e5852){_0x1c540c['push'](_0x1c540c['shift']());}};_0x4c372a(++_0x294dff);}(_0xf900,0x69));var _0x0f90=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xf900[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x0f90('0x0'));var moment=require(_0x0f90('0x1'));var BPromise=require(_0x0f90('0x2'));var rs=require(_0x0f90('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0f90('0x4'));var logger=require(_0x0f90('0x5'))(_0x0f90('0x6'));var config=require(_0x0f90('0x7'));var jayson=require(_0x0f90('0x8'));var client=jayson['client'][_0x0f90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x60ab43,_0x316178,_0x3d9603){return new BPromise(function(_0x97abfc,_0x37603c){return client[_0x0f90('0xa')](_0x60ab43,_0x3d9603)[_0x0f90('0xb')](function(_0x50998f){logger[_0x0f90('0xc')](_0x0f90('0xd'),_0x316178,'request\x20sent');logger[_0x0f90('0xe')](_0x0f90('0xf'),_0x316178,'request\x20sent',JSON['stringify'](_0x50998f));if(_0x50998f[_0x0f90('0x10')]){if(_0x50998f['error'][_0x0f90('0x11')]===0x1f4){logger[_0x0f90('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x316178,_0x50998f[_0x0f90('0x10')][_0x0f90('0x12')]);return _0x37603c(_0x50998f[_0x0f90('0x10')][_0x0f90('0x12')]);}logger['error'](_0x0f90('0xd'),_0x316178,_0x50998f[_0x0f90('0x10')][_0x0f90('0x12')]);return _0x97abfc(_0x50998f['error'][_0x0f90('0x12')]);}else{logger['info'](_0x0f90('0xd'),_0x316178,_0x0f90('0x13'));_0x97abfc(_0x50998f[_0x0f90('0x14')][_0x0f90('0x12')]);}})[_0x0f90('0x15')](function(_0x5a2428){logger[_0x0f90('0x10')](_0x0f90('0xd'),_0x316178,_0x5a2428);_0x37603c(_0x5a2428);});});}exports[_0x0f90('0x16')]=function(_0x256edc){var _0x4fcf75=this;return new Promise(function(_0x18688c,_0x3b8b0a){return db[_0x0f90('0x17')][_0x0f90('0x18')]({'raw':_0x256edc['options']?_0x256edc['options']['raw']===undefined?!![]:![]:!![],'where':_0x256edc[_0x0f90('0x19')]?_0x256edc[_0x0f90('0x19')][_0x0f90('0x1a')]||null:null,'attributes':_0x256edc[_0x0f90('0x19')]?_0x256edc[_0x0f90('0x19')][_0x0f90('0x1b')]||null:null,'include':_0x256edc[_0x0f90('0x19')]?_0x256edc[_0x0f90('0x19')][_0x0f90('0x1c')]?_[_0x0f90('0x1d')](_0x256edc[_0x0f90('0x19')][_0x0f90('0x1c')],function(_0x47fc35){return{'model':db[_0x47fc35[_0x0f90('0x1e')]],'as':_0x47fc35['as'],'attributes':_0x47fc35[_0x0f90('0x1b')],'include':_0x47fc35[_0x0f90('0x1c')]?_[_0x0f90('0x1d')](_0x47fc35[_0x0f90('0x1c')],function(_0x5ac63b){return{'model':db[_0x5ac63b['model']],'as':_0x5ac63b['as'],'attributes':_0x5ac63b[_0x0f90('0x1b')],'include':_0x5ac63b[_0x0f90('0x1c')]?_[_0x0f90('0x1d')](_0x5ac63b[_0x0f90('0x1c')],function(_0x22764d){return{'model':db[_0x22764d['model']],'as':_0x22764d['as'],'attributes':_0x22764d[_0x0f90('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0f90('0xb')](function(_0x2b29c8){logger['info'](_0x0f90('0x16'),_0x256edc);logger['debug']('ShowSquareOdbc',_0x256edc,JSON['stringify'](_0x2b29c8));_0x18688c(_0x2b29c8);})[_0x0f90('0x15')](function(_0x53db79){logger[_0x0f90('0x10')](_0x0f90('0x16'),_0x53db79[_0x0f90('0x12')],_0x256edc);_0x3b8b0a(_0x4fcf75['error'](0x1f4,_0x53db79[_0x0f90('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index e5a6d11..d046d7f 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 _0x093f=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','addUsers','put','update','destroy','delete','removeUsers','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x093f,0xd2));var _0xf093=function(_0x538309,_0x20ce8b){_0x538309=_0x538309-0x0;var _0x11aefa=_0x093f[_0x538309];return _0x11aefa;};'use strict';var multer=require(_0xf093('0x0'));var util=require(_0xf093('0x1'));var path=require(_0xf093('0x2'));var timeout=require(_0xf093('0x3'));var express=require(_0xf093('0x4'));var router=express[_0xf093('0x5')]();var fs_extra=require(_0xf093('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf093('0x7'));var config=require(_0xf093('0x8'));var controller=require('./squareProject.controller');router[_0xf093('0x9')]('/',auth[_0xf093('0xa')](),controller[_0xf093('0xb')]);router[_0xf093('0x9')](_0xf093('0xc'),auth[_0xf093('0xa')](),controller[_0xf093('0xd')]);router[_0xf093('0x9')](_0xf093('0xe'),auth[_0xf093('0xa')](),controller[_0xf093('0xf')]);router[_0xf093('0x10')]('/',auth[_0xf093('0xa')](),controller['create']);router['post'](_0xf093('0xe'),auth['isAuthenticated'](),controller[_0xf093('0x11')]);router[_0xf093('0x12')](_0xf093('0xc'),auth['isAuthenticated'](),controller[_0xf093('0x13')]);router['delete'](_0xf093('0xc'),auth['isAuthenticated'](),controller[_0xf093('0x14')]);router[_0xf093('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xf093('0x16')]);module[_0xf093('0x17')]=router; \ No newline at end of file +var _0xe5fc=['index','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','removeUsers','exports','multer','path','connect-timeout','express','../../components/interaction/service','./squareProject.controller','get','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe5fc,0x109));var _0xce5f=function(_0x16ed68,_0x4d1b48){_0x16ed68=_0x16ed68-0x0;var _0x2df40f=_0xe5fc[_0x16ed68];return _0x2df40f;};'use strict';var multer=require(_0xce5f('0x0'));var util=require('util');var path=require(_0xce5f('0x1'));var timeout=require(_0xce5f('0x2'));var express=require(_0xce5f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce5f('0x4'));var config=require('../../config/environment');var controller=require(_0xce5f('0x5'));router[_0xce5f('0x6')]('/',auth[_0xce5f('0x7')](),controller[_0xce5f('0x8')]);router[_0xce5f('0x6')](_0xce5f('0x9'),auth[_0xce5f('0x7')](),controller[_0xce5f('0xa')]);router['get'](_0xce5f('0xb'),auth[_0xce5f('0x7')](),controller[_0xce5f('0xc')]);router[_0xce5f('0xd')]('/',auth[_0xce5f('0x7')](),controller[_0xce5f('0xe')]);router[_0xce5f('0xd')]('/:id/users',auth[_0xce5f('0x7')](),controller[_0xce5f('0xf')]);router[_0xce5f('0x10')](_0xce5f('0x9'),auth[_0xce5f('0x7')](),controller[_0xce5f('0x11')]);router[_0xce5f('0x12')](_0xce5f('0x9'),auth[_0xce5f('0x7')](),controller['destroy']);router['delete']('/:id/users',auth[_0xce5f('0x7')](),controller[_0xce5f('0x13')]);module[_0xce5f('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 38f81ee..f1a7f2a 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 _0xf4b4=['production','DATE','exports','STRING','name','TEXT','BLOB','long','preproduction','toString','utf8','getDataValue'];(function(_0xb1dfbb,_0x43519c){var _0x45223a=function(_0x95e26f){while(--_0x95e26f){_0xb1dfbb['push'](_0xb1dfbb['shift']());}};_0x45223a(++_0x43519c);}(_0xf4b4,0x92));var _0x4f4b=function(_0x47024a,_0x2cc60a){_0x47024a=_0x47024a-0x0;var _0xc021b8=_0xf4b4[_0x47024a];return _0xc021b8;};'use strict';var Sequelize=require('sequelize');module[_0x4f4b('0x0')]={'name':{'type':Sequelize[_0x4f4b('0x1')],'unique':_0x4f4b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x4f4b('0x1')]},'notes':{'type':Sequelize[_0x4f4b('0x3')]},'preproduction':{'type':Sequelize[_0x4f4b('0x4')](_0x4f4b('0x5')),'get':function(){if(this['getDataValue'](_0x4f4b('0x6'))){return this['getDataValue'](_0x4f4b('0x6'))[_0x4f4b('0x7')](_0x4f4b('0x8'));}}},'production':{'type':Sequelize[_0x4f4b('0x4')](_0x4f4b('0x5')),'get':function(){if(this[_0x4f4b('0x9')]('production')){return this[_0x4f4b('0x9')](_0x4f4b('0xa'))[_0x4f4b('0x7')](_0x4f4b('0x8'));}}},'savedAt':{'type':Sequelize[_0x4f4b('0xb')]},'publishedAt':{'type':Sequelize[_0x4f4b('0xb')]}}; \ No newline at end of file +var _0xe236=['BLOB','getDataValue','preproduction','toString','long','production','DATE','sequelize','exports','STRING','name'];(function(_0x35f15b,_0x387db3){var _0x262619=function(_0x4467b9){while(--_0x4467b9){_0x35f15b['push'](_0x35f15b['shift']());}};_0x262619(++_0x387db3);}(_0xe236,0x6a));var _0x6e23=function(_0x10f6e8,_0x351db6){_0x10f6e8=_0x10f6e8-0x0;var _0x35bb3c=_0xe236[_0x10f6e8];return _0x35bb3c;};'use strict';var Sequelize=require(_0x6e23('0x0'));module[_0x6e23('0x1')]={'name':{'type':Sequelize[_0x6e23('0x2')],'unique':_0x6e23('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x6e23('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x6e23('0x4')]('long'),'get':function(){if(this[_0x6e23('0x5')](_0x6e23('0x6'))){return this[_0x6e23('0x5')](_0x6e23('0x6'))[_0x6e23('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0x6e23('0x8')),'get':function(){if(this[_0x6e23('0x5')](_0x6e23('0x9'))){return this[_0x6e23('0x5')](_0x6e23('0x9'))[_0x6e23('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0x6e23('0xa')]},'publishedAt':{'type':Sequelize[_0x6e23('0xa')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ca6bf52..03faf3d 100644 --- a/server/api/squareProject/squareProject.controller.js +++ b/server/api/squareProject/squareProject.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['include','findAll','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SquareProjects','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','stringify','pick','production','addUsers','omit','removeUsers','ids','isArray','getUsers','findOne','User','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','undefined','count','limit','set','update','then','destroy','get','UserProfileResource','agi','error','stack','map','SquareProject','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','merge','where','VIRTUAL','name','filter','options','includeAll'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a8a28,_0x459c9f){_0x4a8a28=_0x4a8a28-0x0;var _0x307f1e=_0x2ef3[_0x4a8a28];return _0x307f1e;};'use strict';var _=require(_0x32ef('0x0'));var Redis=require(_0x32ef('0x1'));var qs=require(_0x32ef('0x2'));var logger=require(_0x32ef('0x3'))(_0x32ef('0x4'));var config=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x6')]=_[_0x32ef('0x7')](config['redis'],{'host':_0x32ef('0x8'),'port':0x18eb});var socket=require(_0x32ef('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x32ef('0xa')](socket);function respondWithStatusCode(_0x4bfcf8,_0x367c39){_0x367c39=_0x367c39||0xcc;return function(_0x2fb8eb){if(_0x2fb8eb){return _0x4bfcf8[_0x32ef('0xb')](_0x367c39);}return _0x4bfcf8[_0x32ef('0xc')](_0x367c39)[_0x32ef('0xd')]();};}function respondWithResult(_0x2bbb50,_0x28275c){_0x28275c=_0x28275c||0xc8;return function(_0x77df79){if(_0x77df79){return _0x2bbb50['status'](_0x28275c)['json'](_0x77df79);}};}function respondWithFilteredResult(_0x401d0b,_0x33281d){return function(_0x45bfd5){if(_0x45bfd5){var _0x1499c2=typeof _0x33281d['offset']===_0x32ef('0xe')&&typeof _0x33281d['limit']===_0x32ef('0xe');var _0x49d590=_0x45bfd5[_0x32ef('0xf')];var _0x1ef1ae=_0x1499c2?0x0:_0x33281d['offset'];var _0x539d18=_0x1499c2?_0x45bfd5[_0x32ef('0xf')]:_0x33281d['offset']+_0x33281d[_0x32ef('0x10')];var _0x40a6e6;if(_0x539d18>=_0x49d590){_0x539d18=_0x49d590;_0x40a6e6=0xc8;}else{_0x40a6e6=0xce;}_0x401d0b[_0x32ef('0xc')](_0x40a6e6);return _0x401d0b[_0x32ef('0x11')]('Content-Range',_0x1ef1ae+'-'+_0x539d18+'/'+_0x49d590)['json'](_0x45bfd5);}return null;};}function saveUpdates(_0x531e30){return function(_0x13db1a){if(_0x13db1a){return _0x13db1a[_0x32ef('0x12')](_0x531e30)[_0x32ef('0x13')](function(_0x53a5ca){return _0x53a5ca;});}return null;};}function removeEntity(_0x5d559b){return function(_0x1eb468){if(_0x1eb468){return _0x1eb468[_0x32ef('0x14')]()[_0x32ef('0x13')](function(){var _0x57863c=_0x1eb468[_0x32ef('0x15')]({'plain':!![]});var _0x33e230='SquareProjects';return db[_0x32ef('0x16')][_0x32ef('0x14')]({'where':{'type':_0x33e230,'resourceId':_0x57863c['id']}})[_0x32ef('0x13')](function(){return _0x1eb468;});})[_0x32ef('0x13')](function(){var _0x445cda=new Redis(config[_0x32ef('0x6')]);_0x445cda['publish'](_0x32ef('0x17'),JSON['stringify']({'id':_0x1eb468['id'],'deleted':!![]}));})[_0x32ef('0x13')](function(){_0x5d559b[_0x32ef('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1af371){return function(_0x97780){if(!_0x97780){_0x1af371[_0x32ef('0xb')](0x194);}return _0x97780;};}function handleError(_0x55f7f2,_0x57f5e5){_0x57f5e5=_0x57f5e5||0x1f4;return function(_0x22f2d7){logger[_0x32ef('0x18')](_0x22f2d7[_0x32ef('0x19')]);if(_0x22f2d7['name']){delete _0x22f2d7['name'];}_0x55f7f2[_0x32ef('0xc')](_0x57f5e5)['send'](_0x22f2d7);};}exports['index']=function(_0x278495,_0x14d4b3){var _0x371540={},_0x1dbe98={},_0x15ce54={'count':0x0,'rows':[]};var _0x234175=_[_0x32ef('0x1a')](db[_0x32ef('0x1b')][_0x32ef('0x1c')],function(_0x2f52d7){return{'name':_0x2f52d7[_0x32ef('0x1d')],'type':_0x2f52d7[_0x32ef('0x1e')]['key']};});_0x1dbe98[_0x32ef('0x1f')]=_[_0x32ef('0x1a')](_0x234175,'name');_0x1dbe98[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x278495[_0x32ef('0x20')]);_0x1dbe98[_0x32ef('0x22')]=_['intersection'](_0x1dbe98[_0x32ef('0x1f')],_0x1dbe98[_0x32ef('0x20')]);_0x371540[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x1dbe98[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x278495[_0x32ef('0x20')]['fields']));_0x371540[_0x32ef('0x23')]=_0x371540['attributes'][_0x32ef('0x26')]?_0x371540[_0x32ef('0x23')]:_0x1dbe98['model'];if(!_0x278495[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x371540[_0x32ef('0x10')]=qs[_0x32ef('0x10')](_0x278495['query']['limit']);_0x371540[_0x32ef('0x29')]=qs['offset'](_0x278495[_0x32ef('0x20')][_0x32ef('0x29')]);}_0x371540[_0x32ef('0x2a')]=qs[_0x32ef('0x2b')](_0x278495[_0x32ef('0x20')][_0x32ef('0x2b')]);_0x371540['where']=qs['filters'](_['pick'](_0x278495[_0x32ef('0x20')],_0x1dbe98[_0x32ef('0x22')]),_0x234175);if(_0x278495[_0x32ef('0x20')]['filter']){_0x371540['where']=_[_0x32ef('0x2c')](_0x371540[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x234175,function(_0x480348){if(_0x480348['type']!==_0x32ef('0x2e')){var _0x21706f={};_0x21706f[_0x480348[_0x32ef('0x2f')]]={'$like':'%'+_0x278495[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x21706f;}})});}_0x371540=_[_0x32ef('0x2c')]({},_0x371540,_0x278495[_0x32ef('0x31')]);var _0x21da90={'where':_0x371540[_0x32ef('0x2d')]};return db['SquareProject'][_0x32ef('0xf')](_0x21da90)[_0x32ef('0x13')](function(_0x14b54f){_0x15ce54['count']=_0x14b54f;if(_0x278495[_0x32ef('0x20')][_0x32ef('0x32')]){_0x371540[_0x32ef('0x33')]=[{'all':!![]}];}return db[_0x32ef('0x1b')][_0x32ef('0x34')](_0x371540);})[_0x32ef('0x13')](function(_0x256c40){_0x15ce54[_0x32ef('0x35')]=_0x256c40;return _0x15ce54;})[_0x32ef('0x13')](respondWithFilteredResult(_0x14d4b3,_0x371540))[_0x32ef('0x36')](handleError(_0x14d4b3,null));};exports[_0x32ef('0x37')]=function(_0x4615b4,_0x48e071){var _0x3cac2e={'raw':![],'where':{'id':_0x4615b4[_0x32ef('0x38')]['id']}},_0xc3a6d3={};_0xc3a6d3[_0x32ef('0x1f')]=_[_0x32ef('0x21')](db[_0x32ef('0x1b')][_0x32ef('0x1c')]);_0xc3a6d3['query']=_['keys'](_0x4615b4[_0x32ef('0x20')]);_0xc3a6d3[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0xc3a6d3[_0x32ef('0x1f')],_0xc3a6d3['query']);_0x3cac2e[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0xc3a6d3['model'],qs[_0x32ef('0x25')](_0x4615b4['query'][_0x32ef('0x25')]));_0x3cac2e[_0x32ef('0x23')]=_0x3cac2e[_0x32ef('0x23')][_0x32ef('0x26')]?_0x3cac2e[_0x32ef('0x23')]:_0xc3a6d3[_0x32ef('0x1f')];if(_0x4615b4[_0x32ef('0x20')][_0x32ef('0x32')]){_0x3cac2e[_0x32ef('0x33')]=[{'all':!![]}];}_0x3cac2e=_[_0x32ef('0x2c')]({},_0x3cac2e,_0x4615b4['options']);return db[_0x32ef('0x1b')]['find'](_0x3cac2e)[_0x32ef('0x13')](handleEntityNotFound(_0x48e071,null))[_0x32ef('0x13')](respondWithResult(_0x48e071,null))[_0x32ef('0x36')](handleError(_0x48e071,null));};exports['create']=function(_0x502113,_0x230ac9){return db[_0x32ef('0x1b')][_0x32ef('0x39')](_0x502113[_0x32ef('0x3a')],{})[_0x32ef('0x13')](function(_0x12c9e6){var _0x47dbe1=_0x502113['user'][_0x32ef('0x15')]({'plain':!![]});if(!_0x47dbe1)throw new Error(_0x32ef('0x3b'));if(_0x47dbe1[_0x32ef('0x3c')]===_0x32ef('0x3d')){var _0x209361=_0x12c9e6[_0x32ef('0x15')]({'plain':!![]});var _0x44ad11=_0x32ef('0x3e');return db[_0x32ef('0x3f')][_0x32ef('0x40')]({'where':{'name':_0x44ad11,'userProfileId':_0x47dbe1[_0x32ef('0x41')]},'raw':!![]})[_0x32ef('0x13')](function(_0x36a65c){if(_0x36a65c&&_0x36a65c['autoAssociation']===0x0){return db[_0x32ef('0x16')][_0x32ef('0x39')]({'name':_0x209361[_0x32ef('0x2f')],'resourceId':_0x209361['id'],'type':_0x36a65c[_0x32ef('0x2f')],'sectionId':_0x36a65c['id']},{})[_0x32ef('0x13')](function(){return _0x12c9e6;});}else{return _0x12c9e6;}})[_0x32ef('0x36')](function(_0x278696){logger[_0x32ef('0x18')](_0x32ef('0x42'),_0x278696);throw _0x278696;});}return _0x12c9e6;})[_0x32ef('0x13')](respondWithResult(_0x230ac9,0xc9))[_0x32ef('0x36')](handleError(_0x230ac9,null));};exports[_0x32ef('0x12')]=function(_0x272377,_0x326445){if(_0x272377[_0x32ef('0x3a')]['id']){delete _0x272377[_0x32ef('0x3a')]['id'];}return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x272377['params']['id']}})['then'](handleEntityNotFound(_0x326445,null))[_0x32ef('0x13')](saveUpdates(_0x272377[_0x32ef('0x3a')],null))[_0x32ef('0x13')](function(_0x166405){if(!_0x166405)return;var _0x34bd3e=_0x166405[_0x32ef('0x15')]({'plain':!![]});return _0x34bd3e;})[_0x32ef('0x13')](function(_0x1f105a){var _0x15b640=new Redis(config[_0x32ef('0x6')]);_0x15b640[_0x32ef('0x43')]('agi',JSON[_0x32ef('0x44')](_[_0x32ef('0x45')](_0x1f105a,['id',_0x32ef('0x2f'),_0x32ef('0x46')])));return _0x1f105a;})[_0x32ef('0x13')](respondWithResult(_0x326445,null))[_0x32ef('0x36')](handleError(_0x326445,null));};exports['destroy']=function(_0x44a4e9,_0x1eeb3e){return db[_0x32ef('0x1b')]['find']({'where':{'id':_0x44a4e9[_0x32ef('0x38')]['id']}})['then'](handleEntityNotFound(_0x1eeb3e,null))[_0x32ef('0x13')](removeEntity(_0x1eeb3e,null))[_0x32ef('0x36')](handleError(_0x1eeb3e,null));};exports['addUsers']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x206ad5[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x13')](function(_0x30e377){if(_0x30e377){return _0x30e377[_0x32ef('0x47')](_0x206ad5['body']['ids'],_[_0x32ef('0x48')](_0x206ad5['body'],['ids','id'])||{});}})[_0x32ef('0x13')](respondWithResult(_0x59e5f9,null))[_0x32ef('0x36')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x49')]=function(_0x6aae59,_0x2468e6){return db[_0x32ef('0x1b')][_0x32ef('0x40')]({'where':{'id':_0x6aae59[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x2468e6,null))[_0x32ef('0x13')](function(_0x4c125c){if(_0x4c125c){return _0x4c125c['removeUsers'](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])['then'](function(){if(_[_0x32ef('0x4b')](_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')])){for(var _0x49c245=0x0;_0x49c245<_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')][_0x32ef('0x26')];_0x49c245+=0x1){socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')]['ids'][_0x49c245]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x6aae59[_0x32ef('0x20')][_0x32ef('0x4a')]),'SquareProjectId':Number(_0x6aae59[_0x32ef('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2468e6,null))[_0x32ef('0x36')](handleError(_0x2468e6,null));};exports[_0x32ef('0x4c')]=function(_0x5f9da7,_0x58ecbb){var _0x4557ce={};var _0x12b7f8={};var _0x4c3bab;var _0x4a4eaa;return db[_0x32ef('0x1b')][_0x32ef('0x4d')]({'where':{'id':_0x5f9da7[_0x32ef('0x38')]['id']}})[_0x32ef('0x13')](handleEntityNotFound(_0x58ecbb,null))[_0x32ef('0x13')](function(_0x40700e){if(_0x40700e){_0x4c3bab=_0x40700e;_0x12b7f8['model']=_[_0x32ef('0x21')](db[_0x32ef('0x4e')][_0x32ef('0x1c')]);_0x12b7f8[_0x32ef('0x20')]=_[_0x32ef('0x21')](_0x5f9da7[_0x32ef('0x20')]);_0x12b7f8[_0x32ef('0x22')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],_0x12b7f8['query']);_0x4557ce[_0x32ef('0x23')]=_[_0x32ef('0x24')](_0x12b7f8[_0x32ef('0x1f')],qs[_0x32ef('0x25')](_0x5f9da7[_0x32ef('0x20')]['fields']));_0x4557ce['attributes']=_0x4557ce[_0x32ef('0x23')][_0x32ef('0x26')]?_0x4557ce[_0x32ef('0x23')]:_0x12b7f8[_0x32ef('0x1f')];_0x4557ce[_0x32ef('0x2a')]=qs['sort'](_0x5f9da7[_0x32ef('0x20')]['sort']);_0x4557ce[_0x32ef('0x2d')]=qs[_0x32ef('0x22')](_['pick'](_0x5f9da7['query'],_0x12b7f8[_0x32ef('0x22')]));if(_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]){_0x4557ce['where']=_['merge'](_0x4557ce[_0x32ef('0x2d')],{'$or':_[_0x32ef('0x1a')](_0x4557ce[_0x32ef('0x23')],function(_0x416e62){var _0x4f4006={};_0x4f4006[_0x416e62]={'$like':'%'+_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x30')]+'%'};return _0x4f4006;})});}_0x4557ce=_[_0x32ef('0x2c')]({},_0x4557ce,_0x5f9da7[_0x32ef('0x31')]);return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x43b176){if(_0x43b176){_0x4a4eaa=_0x43b176[_0x32ef('0x26')];if(!_0x5f9da7[_0x32ef('0x20')][_0x32ef('0x27')](_0x32ef('0x28'))){_0x4557ce[_0x32ef('0x10')]=qs['limit'](_0x5f9da7['query'][_0x32ef('0x10')]);_0x4557ce[_0x32ef('0x29')]=qs['offset'](_0x5f9da7[_0x32ef('0x20')]['offset']);}return _0x4c3bab[_0x32ef('0x4c')](_0x4557ce);}})[_0x32ef('0x13')](function(_0x323758){if(_0x323758){return _0x323758?{'count':_0x4a4eaa,'rows':_0x323758}:null;}})['then'](respondWithResult(_0x58ecbb,null))[_0x32ef('0x36')](handleError(_0x58ecbb,null));}; \ No newline at end of file +var _0x1967=['findOne','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','register','status','end','offset','undefined','limit','count','Content-Range','json','update','then','destroy','SquareProjects','UserProfileResource','publish','agi','sendStatus','stack','name','send','index','map','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SquareProject','findAll','rows','catch','params','find','create','body','user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','addUsers','omit','ids','removeUsers','isArray','emit','getUsers'];(function(_0x1b036e,_0x205b2e){var _0x48a531=function(_0x4724dc){while(--_0x4724dc){_0x1b036e['push'](_0x1b036e['shift']());}};_0x48a531(++_0x205b2e);}(_0x1967,0x173));var _0x7196=function(_0x42297d,_0x760bd8){_0x42297d=_0x42297d-0x0;var _0x2b0d89=_0x1967[_0x42297d];return _0x2b0d89;};'use strict';var _=require('lodash');var Redis=require(_0x7196('0x0'));var qs=require(_0x7196('0x1'));var logger=require(_0x7196('0x2'))(_0x7196('0x3'));var config=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];config[_0x7196('0x6')]=_[_0x7196('0x7')](config[_0x7196('0x6')],{'host':_0x7196('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7196('0x6')]));require(_0x7196('0x9'))[_0x7196('0xa')](socket);function respondWithStatusCode(_0x40e0af,_0x266a6e){_0x266a6e=_0x266a6e||0xcc;return function(_0xad78a){if(_0xad78a){return _0x40e0af['sendStatus'](_0x266a6e);}return _0x40e0af[_0x7196('0xb')](_0x266a6e)[_0x7196('0xc')]();};}function respondWithResult(_0x3f846e,_0x259b18){_0x259b18=_0x259b18||0xc8;return function(_0x1e862d){if(_0x1e862d){return _0x3f846e['status'](_0x259b18)['json'](_0x1e862d);}};}function respondWithFilteredResult(_0x2028dd,_0x10459b){return function(_0x97bbff){if(_0x97bbff){var _0x107759=typeof _0x10459b[_0x7196('0xd')]===_0x7196('0xe')&&typeof _0x10459b[_0x7196('0xf')]===_0x7196('0xe');var _0x24f1c3=_0x97bbff[_0x7196('0x10')];var _0x154101=_0x107759?0x0:_0x10459b['offset'];var _0x26a1ef=_0x107759?_0x97bbff[_0x7196('0x10')]:_0x10459b[_0x7196('0xd')]+_0x10459b[_0x7196('0xf')];var _0x511aa1;if(_0x26a1ef>=_0x24f1c3){_0x26a1ef=_0x24f1c3;_0x511aa1=0xc8;}else{_0x511aa1=0xce;}_0x2028dd[_0x7196('0xb')](_0x511aa1);return _0x2028dd['set'](_0x7196('0x11'),_0x154101+'-'+_0x26a1ef+'/'+_0x24f1c3)[_0x7196('0x12')](_0x97bbff);}return null;};}function saveUpdates(_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){return _0x3ed1ad[_0x7196('0x13')](_0xf7e97)[_0x7196('0x14')](function(_0x22bd62){return _0x22bd62;});}return null;};}function removeEntity(_0x1ed296){return function(_0x3e4e69){if(_0x3e4e69){return _0x3e4e69[_0x7196('0x15')]()[_0x7196('0x14')](function(){var _0x5b716a=_0x3e4e69['get']({'plain':!![]});var _0x448f13=_0x7196('0x16');return db[_0x7196('0x17')]['destroy']({'where':{'type':_0x448f13,'resourceId':_0x5b716a['id']}})[_0x7196('0x14')](function(){return _0x3e4e69;});})['then'](function(){var _0x5b25f0=new Redis(config[_0x7196('0x6')]);_0x5b25f0[_0x7196('0x18')](_0x7196('0x19'),JSON['stringify']({'id':_0x3e4e69['id'],'deleted':!![]}));})['then'](function(){_0x1ed296[_0x7196('0xb')](0xcc)[_0x7196('0xc')]();});}};}function handleEntityNotFound(_0x598a26){return function(_0x18649b){if(!_0x18649b){_0x598a26[_0x7196('0x1a')](0x194);}return _0x18649b;};}function handleError(_0x6e22e5,_0x18d389){_0x18d389=_0x18d389||0x1f4;return function(_0x38b3d6){logger['error'](_0x38b3d6[_0x7196('0x1b')]);if(_0x38b3d6['name']){delete _0x38b3d6[_0x7196('0x1c')];}_0x6e22e5[_0x7196('0xb')](_0x18d389)[_0x7196('0x1d')](_0x38b3d6);};}exports[_0x7196('0x1e')]=function(_0x70aa65,_0x43f6a2){var _0x530ab5={},_0x57c404={},_0x1482e5={'count':0x0,'rows':[]};var _0x2d284f=_[_0x7196('0x1f')](db['SquareProject']['rawAttributes'],function(_0x41cfd2){return{'name':_0x41cfd2[_0x7196('0x20')],'type':_0x41cfd2[_0x7196('0x21')]['key']};});_0x57c404[_0x7196('0x22')]=_['map'](_0x2d284f,_0x7196('0x1c'));_0x57c404['query']=_[_0x7196('0x23')](_0x70aa65[_0x7196('0x24')]);_0x57c404[_0x7196('0x25')]=_['intersection'](_0x57c404[_0x7196('0x22')],_0x57c404[_0x7196('0x24')]);_0x530ab5[_0x7196('0x26')]=_[_0x7196('0x27')](_0x57c404['model'],qs[_0x7196('0x28')](_0x70aa65[_0x7196('0x24')][_0x7196('0x28')]));_0x530ab5[_0x7196('0x26')]=_0x530ab5[_0x7196('0x26')][_0x7196('0x29')]?_0x530ab5[_0x7196('0x26')]:_0x57c404[_0x7196('0x22')];if(!_0x70aa65[_0x7196('0x24')][_0x7196('0x2a')](_0x7196('0x2b'))){_0x530ab5['limit']=qs[_0x7196('0xf')](_0x70aa65['query'][_0x7196('0xf')]);_0x530ab5['offset']=qs[_0x7196('0xd')](_0x70aa65[_0x7196('0x24')]['offset']);}_0x530ab5[_0x7196('0x2c')]=qs[_0x7196('0x2d')](_0x70aa65[_0x7196('0x24')][_0x7196('0x2d')]);_0x530ab5[_0x7196('0x2e')]=qs['filters'](_[_0x7196('0x2f')](_0x70aa65[_0x7196('0x24')],_0x57c404[_0x7196('0x25')]),_0x2d284f);if(_0x70aa65[_0x7196('0x24')][_0x7196('0x30')]){_0x530ab5[_0x7196('0x2e')]=_['merge'](_0x530ab5[_0x7196('0x2e')],{'$or':_[_0x7196('0x1f')](_0x2d284f,function(_0x191df2){if(_0x191df2['type']!==_0x7196('0x31')){var _0x75530e={};_0x75530e[_0x191df2[_0x7196('0x1c')]]={'$like':'%'+_0x70aa65[_0x7196('0x24')][_0x7196('0x30')]+'%'};return _0x75530e;}})});}_0x530ab5=_[_0x7196('0x32')]({},_0x530ab5,_0x70aa65[_0x7196('0x33')]);var _0x1ab720={'where':_0x530ab5[_0x7196('0x2e')]};return db[_0x7196('0x34')]['count'](_0x1ab720)[_0x7196('0x14')](function(_0x17cefd){_0x1482e5['count']=_0x17cefd;if(_0x70aa65[_0x7196('0x24')]['includeAll']){_0x530ab5['include']=[{'all':!![]}];}return db[_0x7196('0x34')][_0x7196('0x35')](_0x530ab5);})['then'](function(_0x587f6f){_0x1482e5[_0x7196('0x36')]=_0x587f6f;return _0x1482e5;})[_0x7196('0x14')](respondWithFilteredResult(_0x43f6a2,_0x530ab5))[_0x7196('0x37')](handleError(_0x43f6a2,null));};exports['show']=function(_0x36a990,_0x2d13a5){var _0x29ba1c={'raw':![],'where':{'id':_0x36a990[_0x7196('0x38')]['id']}},_0x29c58d={};_0x29c58d[_0x7196('0x22')]=_[_0x7196('0x23')](db[_0x7196('0x34')]['rawAttributes']);_0x29c58d[_0x7196('0x24')]=_[_0x7196('0x23')](_0x36a990['query']);_0x29c58d[_0x7196('0x25')]=_[_0x7196('0x27')](_0x29c58d['model'],_0x29c58d[_0x7196('0x24')]);_0x29ba1c[_0x7196('0x26')]=_[_0x7196('0x27')](_0x29c58d['model'],qs[_0x7196('0x28')](_0x36a990[_0x7196('0x24')]['fields']));_0x29ba1c[_0x7196('0x26')]=_0x29ba1c[_0x7196('0x26')]['length']?_0x29ba1c[_0x7196('0x26')]:_0x29c58d['model'];if(_0x36a990['query']['includeAll']){_0x29ba1c['include']=[{'all':!![]}];}_0x29ba1c=_['merge']({},_0x29ba1c,_0x36a990[_0x7196('0x33')]);return db['SquareProject'][_0x7196('0x39')](_0x29ba1c)[_0x7196('0x14')](handleEntityNotFound(_0x2d13a5,null))[_0x7196('0x14')](respondWithResult(_0x2d13a5,null))[_0x7196('0x37')](handleError(_0x2d13a5,null));};exports['create']=function(_0x3f3171,_0x56ffdd){return db[_0x7196('0x34')][_0x7196('0x3a')](_0x3f3171[_0x7196('0x3b')],{})['then'](function(_0x3978bd){var _0x44d8e5=_0x3f3171[_0x7196('0x3c')]['get']({'plain':!![]});if(!_0x44d8e5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44d8e5[_0x7196('0x3d')]==='user'){var _0x29c7e8=_0x3978bd['get']({'plain':!![]});var _0x53b4c7=_0x7196('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x53b4c7,'userProfileId':_0x44d8e5['userProfileId']},'raw':!![]})[_0x7196('0x14')](function(_0x5052ee){if(_0x5052ee&&_0x5052ee['autoAssociation']===0x0){return db[_0x7196('0x17')][_0x7196('0x3a')]({'name':_0x29c7e8[_0x7196('0x1c')],'resourceId':_0x29c7e8['id'],'type':_0x5052ee[_0x7196('0x1c')],'sectionId':_0x5052ee['id']},{})['then'](function(){return _0x3978bd;});}else{return _0x3978bd;}})[_0x7196('0x37')](function(_0x564688){logger[_0x7196('0x3e')](_0x7196('0x3f'),_0x564688);throw _0x564688;});}return _0x3978bd;})['then'](respondWithResult(_0x56ffdd,0xc9))[_0x7196('0x37')](handleError(_0x56ffdd,null));};exports[_0x7196('0x13')]=function(_0x3fe092,_0x4fa18f){if(_0x3fe092[_0x7196('0x3b')]['id']){delete _0x3fe092['body']['id'];}return db[_0x7196('0x34')][_0x7196('0x39')]({'where':{'id':_0x3fe092[_0x7196('0x38')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x4fa18f,null))[_0x7196('0x14')](saveUpdates(_0x3fe092[_0x7196('0x3b')],null))[_0x7196('0x14')](function(_0x39ba84){if(!_0x39ba84)return;var _0x598dbe=_0x39ba84['get']({'plain':!![]});return _0x598dbe;})[_0x7196('0x14')](function(_0x191c80){var _0x40f820=new Redis(config[_0x7196('0x6')]);_0x40f820['publish'](_0x7196('0x19'),JSON[_0x7196('0x40')](_[_0x7196('0x2f')](_0x191c80,['id',_0x7196('0x1c'),_0x7196('0x41')])));return _0x191c80;})[_0x7196('0x14')](respondWithResult(_0x4fa18f,null))[_0x7196('0x37')](handleError(_0x4fa18f,null));};exports[_0x7196('0x15')]=function(_0x1f3c60,_0x391cd1){return db[_0x7196('0x34')]['find']({'where':{'id':_0x1f3c60[_0x7196('0x38')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x391cd1,null))[_0x7196('0x14')](removeEntity(_0x391cd1,null))['catch'](handleError(_0x391cd1,null));};exports[_0x7196('0x42')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x34')][_0x7196('0x39')]({'where':{'id':_0x5ca1ca[_0x7196('0x38')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x34407d,null))['then'](function(_0x3ece9f){if(_0x3ece9f){return _0x3ece9f['addUsers'](_0x5ca1ca['body']['ids'],_[_0x7196('0x43')](_0x5ca1ca[_0x7196('0x3b')],[_0x7196('0x44'),'id'])||{});}})[_0x7196('0x14')](respondWithResult(_0x34407d,null))[_0x7196('0x37')](handleError(_0x34407d,null));};exports[_0x7196('0x45')]=function(_0x2d8b3d,_0x560ddb){return db[_0x7196('0x34')][_0x7196('0x39')]({'where':{'id':_0x2d8b3d[_0x7196('0x38')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x560ddb,null))[_0x7196('0x14')](function(_0x5ef1eb){if(_0x5ef1eb){return _0x5ef1eb['removeUsers'](_0x2d8b3d[_0x7196('0x24')][_0x7196('0x44')])[_0x7196('0x14')](function(){if(_[_0x7196('0x46')](_0x2d8b3d[_0x7196('0x24')][_0x7196('0x44')])){for(var _0xe3fb61=0x0;_0xe3fb61<_0x2d8b3d[_0x7196('0x24')][_0x7196('0x44')][_0x7196('0x29')];_0xe3fb61+=0x1){socket[_0x7196('0x47')]('userSquareProject:remove',{'UserId':Number(_0x2d8b3d[_0x7196('0x24')][_0x7196('0x44')][_0xe3fb61]),'SquareProjectId':Number(_0x2d8b3d[_0x7196('0x38')]['id'])});}}else{socket[_0x7196('0x47')]('userSquareProject:remove',{'UserId':Number(_0x2d8b3d[_0x7196('0x24')][_0x7196('0x44')]),'SquareProjectId':Number(_0x2d8b3d[_0x7196('0x38')]['id'])});}});}})[_0x7196('0x14')](respondWithStatusCode(_0x560ddb,null))[_0x7196('0x37')](handleError(_0x560ddb,null));};exports[_0x7196('0x48')]=function(_0x1d9e75,_0x559b68){var _0x7a12d8={};var _0x2c5cba={};var _0x40df9b;var _0x3fb671;return db['SquareProject'][_0x7196('0x49')]({'where':{'id':_0x1d9e75[_0x7196('0x38')]['id']}})[_0x7196('0x14')](handleEntityNotFound(_0x559b68,null))[_0x7196('0x14')](function(_0x4673e9){if(_0x4673e9){_0x40df9b=_0x4673e9;_0x2c5cba[_0x7196('0x22')]=_[_0x7196('0x23')](db['User']['rawAttributes']);_0x2c5cba['query']=_[_0x7196('0x23')](_0x1d9e75['query']);_0x2c5cba[_0x7196('0x25')]=_[_0x7196('0x27')](_0x2c5cba[_0x7196('0x22')],_0x2c5cba[_0x7196('0x24')]);_0x7a12d8[_0x7196('0x26')]=_[_0x7196('0x27')](_0x2c5cba[_0x7196('0x22')],qs[_0x7196('0x28')](_0x1d9e75[_0x7196('0x24')]['fields']));_0x7a12d8['attributes']=_0x7a12d8[_0x7196('0x26')][_0x7196('0x29')]?_0x7a12d8[_0x7196('0x26')]:_0x2c5cba[_0x7196('0x22')];_0x7a12d8[_0x7196('0x2c')]=qs[_0x7196('0x2d')](_0x1d9e75[_0x7196('0x24')][_0x7196('0x2d')]);_0x7a12d8['where']=qs['filters'](_[_0x7196('0x2f')](_0x1d9e75['query'],_0x2c5cba[_0x7196('0x25')]));if(_0x1d9e75['query'][_0x7196('0x30')]){_0x7a12d8[_0x7196('0x2e')]=_[_0x7196('0x32')](_0x7a12d8[_0x7196('0x2e')],{'$or':_['map'](_0x7a12d8['attributes'],function(_0x33d301){var _0x5328c5={};_0x5328c5[_0x33d301]={'$like':'%'+_0x1d9e75[_0x7196('0x24')][_0x7196('0x30')]+'%'};return _0x5328c5;})});}_0x7a12d8=_[_0x7196('0x32')]({},_0x7a12d8,_0x1d9e75[_0x7196('0x33')]);return _0x40df9b[_0x7196('0x48')](_0x7a12d8);}})[_0x7196('0x14')](function(_0x4bb3e1){if(_0x4bb3e1){_0x3fb671=_0x4bb3e1[_0x7196('0x29')];if(!_0x1d9e75[_0x7196('0x24')][_0x7196('0x2a')](_0x7196('0x2b'))){_0x7a12d8[_0x7196('0xf')]=qs[_0x7196('0xf')](_0x1d9e75[_0x7196('0x24')][_0x7196('0xf')]);_0x7a12d8[_0x7196('0xd')]=qs[_0x7196('0xd')](_0x1d9e75[_0x7196('0x24')][_0x7196('0xd')]);}return _0x40df9b['getUsers'](_0x7a12d8);}})[_0x7196('0x14')](function(_0x13f802){if(_0x13f802){return _0x13f802?{'count':_0x3fb671,'rows':_0x13f802}:null;}})['then'](respondWithResult(_0x559b68,null))['catch'](handleError(_0x559b68,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 9dfdd35..d79dcdb 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 _0x240b=['remove','emit','hook','SquareProject','save','update'];(function(_0x59a5b5,_0x149bf2){var _0x3e4ba9=function(_0x37f3ed){while(--_0x37f3ed){_0x59a5b5['push'](_0x59a5b5['shift']());}};_0x3e4ba9(++_0x149bf2);}(_0x240b,0x9f));var _0xb240=function(_0x199632,_0x547ca0){_0x199632=_0x199632-0x0;var _0x2a516a=_0x240b[_0x199632];return _0x2a516a;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xb240('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb240('0x1'),'afterUpdate':_0xb240('0x2'),'afterDestroy':_0xb240('0x3')};function emitEvent(_0x2e05ce){return function(_0x4963f1,_0x4a892e,_0x1f2095){SquareProjectEvents[_0xb240('0x4')](_0x2e05ce+':'+_0x4963f1['id'],_0x4963f1);SquareProjectEvents['emit'](_0x2e05ce,_0x4963f1);_0x1f2095(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb240('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x298b=['exports','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','hook'];(function(_0xfd6b7d,_0x32959d){var _0x1b10ec=function(_0x46d0c1){while(--_0x46d0c1){_0xfd6b7d['push'](_0xfd6b7d['shift']());}};_0x1b10ec(++_0x32959d);}(_0x298b,0x1a9));var _0xb298=function(_0x28014b,_0x29334e){_0x28014b=_0x28014b-0x0;var _0x3fa341=_0x298b[_0x28014b];return _0x3fa341;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xb298('0x0'))['db'][_0xb298('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xb298('0x2'),'afterDestroy':_0xb298('0x3')};function emitEvent(_0x40e3f8){return function(_0x7a1022,_0x4bc29b,_0x37be0c){SquareProjectEvents[_0xb298('0x4')](_0x40e3f8+':'+_0x7a1022['id'],_0x7a1022);SquareProjectEvents[_0xb298('0x4')](_0x40e3f8,_0x7a1022);_0x37be0c(null);};}for(var e in events){if(events[_0xb298('0x5')](e)){var event=events[e];SquareProject[_0xb298('0x6')](e,emitEvent(event));}}module[_0xb298('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 39a294f..383ee2d 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 _0xc2b1=['savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction'];(function(_0x4abe2e,_0x277f70){var _0xcb1e19=function(_0x50fbd7){while(--_0x50fbd7){_0x4abe2e['push'](_0x4abe2e['shift']());}};_0xcb1e19(++_0x277f70);}(_0xc2b1,0x76));var _0x1c2b=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xc2b1[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0x1c2b('0x0'));var util=require(_0x1c2b('0x1'));var logger=require(_0x1c2b('0x2'))(_0x1c2b('0x3'));var moment=require(_0x1c2b('0x4'));var BPromise=require(_0x1c2b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c2b('0x6'));var rimraf=require(_0x1c2b('0x7'));var config=require(_0x1c2b('0x8'));var attributes=require(_0x1c2b('0x9'));module[_0x1c2b('0xa')]=function(_0x20920f,_0x5cf7ee){return _0x20920f['define'](_0x1c2b('0xb'),attributes,{'tableName':_0x1c2b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ce9e8,_0x7302b5,_0x5003cc){if(_0x4ce9e8[_0x1c2b('0xd')](_0x1c2b('0xe'))){_0x4ce9e8[_0x1c2b('0xf')]=moment()[_0x1c2b('0x10')](_0x1c2b('0x11'));}if(_0x4ce9e8[_0x1c2b('0xd')](_0x1c2b('0x12'))){_0x4ce9e8['publishedAt']=moment()[_0x1c2b('0x10')](_0x1c2b('0x11'));}_0x5003cc(null,_0x4ce9e8);}}});}; \ No newline at end of file +var _0xf360=['square_projects','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash','util','api','moment','path','rimraf','./squareProject.attributes','exports','define','SquareProject'];(function(_0x1ed9ca,_0x28a7b7){var _0x4c438a=function(_0x452c4a){while(--_0x452c4a){_0x1ed9ca['push'](_0x1ed9ca['shift']());}};_0x4c438a(++_0x28a7b7);}(_0xf360,0xc8));var _0x0f36=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf360[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x0f36('0x0'));var util=require(_0x0f36('0x1'));var logger=require('../../config/logger')(_0x0f36('0x2'));var moment=require(_0x0f36('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f36('0x4'));var rimraf=require(_0x0f36('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f36('0x6'));module[_0x0f36('0x7')]=function(_0x2a939b,_0x3cc749){return _0x2a939b[_0x0f36('0x8')](_0x0f36('0x9'),attributes,{'tableName':_0x0f36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x48182a,_0x3e892a,_0x436afb){if(_0x48182a['changed']('preproduction')){_0x48182a['savedAt']=moment()[_0x0f36('0xb')](_0x0f36('0xc'));}if(_0x48182a[_0x0f36('0xd')](_0x0f36('0xe'))){_0x48182a['publishedAt']=moment()[_0x0f36('0xb')](_0x0f36('0xc'));}_0x436afb(null,_0x48182a);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1789f83..e096575 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 _0x3f19=['GetSquareProjects','catch','message','error','SquareProject','find','where','ShowSquareProject','debug','stringify','lodash','../../mysqldb','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','findAll','raw','options','limit','include','map','model','attributes','then','info'];(function(_0xf5a599,_0x485419){var _0x5d0919=function(_0x313c5d){while(--_0x313c5d){_0xf5a599['push'](_0xf5a599['shift']());}};_0x5d0919(++_0x485419);}(_0x3f19,0x149));var _0x93f1=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x3f19[_0x4ec520];return _0xed49d7;};'use strict';var _=require(_0x93f1('0x0'));var Redis=require('ioredis');var db=require(_0x93f1('0x1'))['db'];var logger=require(_0x93f1('0x2'))(_0x93f1('0x3'));var config=require('../../config/environment');config[_0x93f1('0x4')]=_[_0x93f1('0x5')](config['redis'],{'host':_0x93f1('0x6'),'port':0x18eb});var socket=require(_0x93f1('0x7'))(new Redis(config[_0x93f1('0x4')]));require(_0x93f1('0x8'))['register'](socket);exports['GetSquareProjects']=function(_0x3bb48e){var _0x554013=this;return new Promise(function(_0x56f598,_0x359266){return db['SquareProject'][_0x93f1('0x9')]({'raw':_0x3bb48e['options']?_0x3bb48e['options'][_0x93f1('0xa')]===undefined?!![]:![]:!![],'where':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')]['where']||null:null,'attributes':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')]['attributes']||null:null,'limit':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xc')]||null:null,'include':_0x3bb48e[_0x93f1('0xb')]?_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x3bb48e[_0x93f1('0xb')][_0x93f1('0xd')],function(_0xca8f96){return{'model':db[_0xca8f96[_0x93f1('0xf')]],'as':_0xca8f96['as'],'attributes':_0xca8f96['attributes'],'include':_0xca8f96[_0x93f1('0xd')]?_[_0x93f1('0xe')](_0xca8f96['include'],function(_0x95e3b1){return{'model':db[_0x95e3b1['model']],'as':_0x95e3b1['as'],'attributes':_0x95e3b1['attributes'],'include':_0x95e3b1[_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x95e3b1[_0x93f1('0xd')],function(_0x3d4c47){return{'model':db[_0x3d4c47['model']],'as':_0x3d4c47['as'],'attributes':_0x3d4c47[_0x93f1('0x10')]};}):[]};}):[]};}):[]:[]})[_0x93f1('0x11')](function(_0x59517d){logger[_0x93f1('0x12')](_0x93f1('0x13'),_0x3bb48e);logger['debug'](_0x93f1('0x13'),_0x3bb48e,JSON['stringify'](_0x59517d));_0x56f598(_0x59517d);})[_0x93f1('0x14')](function(_0x5beaf3){logger['error'](_0x93f1('0x13'),_0x5beaf3[_0x93f1('0x15')],_0x3bb48e);_0x359266(_0x554013[_0x93f1('0x16')](0x1f4,_0x5beaf3['message']));});});};exports['ShowSquareProject']=function(_0x3a967b){var _0x35a536=this;return new Promise(function(_0x116943,_0xaab2b0){return db[_0x93f1('0x17')][_0x93f1('0x18')]({'raw':_0x3a967b[_0x93f1('0xb')]?_0x3a967b['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a967b['options']?_0x3a967b[_0x93f1('0xb')][_0x93f1('0x19')]||null:null,'attributes':_0x3a967b[_0x93f1('0xb')]?_0x3a967b[_0x93f1('0xb')][_0x93f1('0x10')]||null:null,'include':_0x3a967b['options']?_0x3a967b['options'][_0x93f1('0xd')]?_[_0x93f1('0xe')](_0x3a967b[_0x93f1('0xb')]['include'],function(_0x3fe9b4){return{'model':db[_0x3fe9b4[_0x93f1('0xf')]],'as':_0x3fe9b4['as'],'attributes':_0x3fe9b4['attributes'],'include':_0x3fe9b4['include']?_[_0x93f1('0xe')](_0x3fe9b4[_0x93f1('0xd')],function(_0x4f53e1){return{'model':db[_0x4f53e1['model']],'as':_0x4f53e1['as'],'attributes':_0x4f53e1['attributes'],'include':_0x4f53e1[_0x93f1('0xd')]?_['map'](_0x4f53e1[_0x93f1('0xd')],function(_0x4d0f12){return{'model':db[_0x4d0f12[_0x93f1('0xf')]],'as':_0x4d0f12['as'],'attributes':_0x4d0f12[_0x93f1('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc97c83){logger[_0x93f1('0x12')](_0x93f1('0x1a'),_0x3a967b);logger[_0x93f1('0x1b')](_0x93f1('0x1a'),_0x3a967b,JSON[_0x93f1('0x1c')](_0xc97c83));_0x116943(_0xc97c83);})[_0x93f1('0x14')](function(_0x39f0a4){logger[_0x93f1('0x16')]('ShowSquareProject',_0x39f0a4[_0x93f1('0x15')],_0x3a967b);_0xaab2b0(_0x35a536[_0x93f1('0x16')](0x1f4,_0x39f0a4['message']));});});}; \ No newline at end of file +var _0x67bc=['message','error','find','info','ShowSquareProject','ioredis','../../mysqldb','rpc','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','GetSquareProjects','SquareProject','findAll','raw','options','where','limit','include','model','attributes','map','then','debug','stringify','catch'];(function(_0x5e8721,_0x378840){var _0xc78d88=function(_0x3dbff7){while(--_0x3dbff7){_0x5e8721['push'](_0x5e8721['shift']());}};_0xc78d88(++_0x378840);}(_0x67bc,0x1a9));var _0xc67b=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x67bc[_0x39bc44];return _0x2916d8;};'use strict';var _=require('lodash');var Redis=require(_0xc67b('0x0'));var db=require(_0xc67b('0x1'))['db'];var logger=require('../../config/logger')(_0xc67b('0x2'));var config=require('../../config/environment');config[_0xc67b('0x3')]=_[_0xc67b('0x4')](config['redis'],{'host':_0xc67b('0x5'),'port':0x18eb});var socket=require(_0xc67b('0x6'))(new Redis(config['redis']));require(_0xc67b('0x7'))['register'](socket);exports[_0xc67b('0x8')]=function(_0x28db39){var _0x3c368d=this;return new Promise(function(_0x935781,_0x46e13f){return db[_0xc67b('0x9')][_0xc67b('0xa')]({'raw':_0x28db39['options']?_0x28db39['options'][_0xc67b('0xb')]===undefined?!![]:![]:!![],'where':_0x28db39[_0xc67b('0xc')]?_0x28db39[_0xc67b('0xc')][_0xc67b('0xd')]||null:null,'attributes':_0x28db39[_0xc67b('0xc')]?_0x28db39['options']['attributes']||null:null,'limit':_0x28db39['options']?_0x28db39[_0xc67b('0xc')][_0xc67b('0xe')]||null:null,'include':_0x28db39['options']?_0x28db39['options']['include']?_['map'](_0x28db39[_0xc67b('0xc')][_0xc67b('0xf')],function(_0x6de0fa){return{'model':db[_0x6de0fa[_0xc67b('0x10')]],'as':_0x6de0fa['as'],'attributes':_0x6de0fa[_0xc67b('0x11')],'include':_0x6de0fa[_0xc67b('0xf')]?_[_0xc67b('0x12')](_0x6de0fa['include'],function(_0x1bc537){return{'model':db[_0x1bc537[_0xc67b('0x10')]],'as':_0x1bc537['as'],'attributes':_0x1bc537[_0xc67b('0x11')],'include':_0x1bc537[_0xc67b('0xf')]?_[_0xc67b('0x12')](_0x1bc537[_0xc67b('0xf')],function(_0x35b38a){return{'model':db[_0x35b38a[_0xc67b('0x10')]],'as':_0x35b38a['as'],'attributes':_0x35b38a[_0xc67b('0x11')]};}):[]};}):[]};}):[]:[]})[_0xc67b('0x13')](function(_0x2d20c7){logger['info'](_0xc67b('0x8'),_0x28db39);logger[_0xc67b('0x14')](_0xc67b('0x8'),_0x28db39,JSON[_0xc67b('0x15')](_0x2d20c7));_0x935781(_0x2d20c7);})[_0xc67b('0x16')](function(_0x316c3c){logger['error'](_0xc67b('0x8'),_0x316c3c[_0xc67b('0x17')],_0x28db39);_0x46e13f(_0x3c368d[_0xc67b('0x18')](0x1f4,_0x316c3c[_0xc67b('0x17')]));});});};exports['ShowSquareProject']=function(_0x4b04c4){var _0x4bc2e9=this;return new Promise(function(_0x42b75e,_0x92ca46){return db[_0xc67b('0x9')][_0xc67b('0x19')]({'raw':_0x4b04c4['options']?_0x4b04c4[_0xc67b('0xc')][_0xc67b('0xb')]===undefined?!![]:![]:!![],'where':_0x4b04c4[_0xc67b('0xc')]?_0x4b04c4[_0xc67b('0xc')][_0xc67b('0xd')]||null:null,'attributes':_0x4b04c4[_0xc67b('0xc')]?_0x4b04c4['options']['attributes']||null:null,'include':_0x4b04c4[_0xc67b('0xc')]?_0x4b04c4[_0xc67b('0xc')][_0xc67b('0xf')]?_[_0xc67b('0x12')](_0x4b04c4[_0xc67b('0xc')][_0xc67b('0xf')],function(_0x1bd6f4){return{'model':db[_0x1bd6f4[_0xc67b('0x10')]],'as':_0x1bd6f4['as'],'attributes':_0x1bd6f4[_0xc67b('0x11')],'include':_0x1bd6f4[_0xc67b('0xf')]?_[_0xc67b('0x12')](_0x1bd6f4[_0xc67b('0xf')],function(_0x499b6f){return{'model':db[_0x499b6f['model']],'as':_0x499b6f['as'],'attributes':_0x499b6f[_0xc67b('0x11')],'include':_0x499b6f[_0xc67b('0xf')]?_['map'](_0x499b6f[_0xc67b('0xf')],function(_0x385d40){return{'model':db[_0x385d40[_0xc67b('0x10')]],'as':_0x385d40['as'],'attributes':_0x385d40['attributes']};}):[]};}):[]};}):[]:[]})[_0xc67b('0x13')](function(_0x29a3a6){logger[_0xc67b('0x1a')](_0xc67b('0x1b'),_0x4b04c4);logger[_0xc67b('0x14')](_0xc67b('0x1b'),_0x4b04c4,JSON['stringify'](_0x29a3a6));_0x42b75e(_0x29a3a6);})[_0xc67b('0x16')](function(_0x3dba50){logger[_0xc67b('0x18')]('ShowSquareProject',_0x3dba50[_0xc67b('0x17')],_0x4b04c4);_0x92ca46(_0x4bc2e9[_0xc67b('0x18')](0x1f4,_0x3dba50['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f387a55..bb37649 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 _0x92db=['squareProject:','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92db,0xc9));var _0xb92d=function(_0x1f51c0,_0x2ddf83){_0x1f51c0=_0x1f51c0-0x0;var _0x1841cb=_0x92db[_0x1f51c0];return _0x1841cb;};'use strict';var SquareProjectEvents=require(_0xb92d('0x0'));var events=[_0xb92d('0x1'),_0xb92d('0x2'),_0xb92d('0x3')];function createListener(_0x219ae2,_0x341948){return function(_0x2b1778){_0x341948[_0xb92d('0x4')](_0x219ae2,_0x2b1778);};}function removeListener(_0x58bbed,_0x1869e5){return function(){SquareProjectEvents[_0xb92d('0x5')](_0x58bbed,_0x1869e5);};}exports[_0xb92d('0x6')]=function(_0x3a6193){for(var _0x2b587b=0x0,_0x3ad789=events['length'];_0x2b587b<_0x3ad789;_0x2b587b++){var _0x9f3487=events[_0x2b587b];var _0x4ae176=createListener(_0xb92d('0x7')+_0x9f3487,_0x3a6193);SquareProjectEvents['on'](_0x9f3487,_0x4ae176);}}; \ No newline at end of file +var _0x1908=['register','squareProject:','save','update','emit','removeListener'];(function(_0x4adbbf,_0xd3383b){var _0x530f27=function(_0x2ddb40){while(--_0x2ddb40){_0x4adbbf['push'](_0x4adbbf['shift']());}};_0x530f27(++_0xd3383b);}(_0x1908,0xb6));var _0x8190=function(_0x41dba3,_0x1518aa){_0x41dba3=_0x41dba3-0x0;var _0x316604=_0x1908[_0x41dba3];return _0x316604;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x8190('0x0'),'remove',_0x8190('0x1')];function createListener(_0x599d19,_0x537023){return function(_0xf69abc){_0x537023[_0x8190('0x2')](_0x599d19,_0xf69abc);};}function removeListener(_0x2ff80a,_0x36919b){return function(){SquareProjectEvents[_0x8190('0x3')](_0x2ff80a,_0x36919b);};}exports[_0x8190('0x4')]=function(_0x499de2){for(var _0x3c44eb=0x0,_0x9c31e2=events['length'];_0x3c44eb<_0x9c31e2;_0x3c44eb++){var _0xb3a502=events[_0x3c44eb];var _0x4d6ddb=createListener(_0x8190('0x5')+_0xb3a502,_0x499de2);SquareProjectEvents['on'](_0xb3a502,_0x4d6ddb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fc86fca..a227d9b 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 _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x1c0b18,_0x67b802){var _0x4e7913=function(_0x2ca308){while(--_0x2ca308){_0x1c0b18['push'](_0x1c0b18['shift']());}};_0x4e7913(++_0x67b802);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file +var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x1d8f95,_0xcd1d0e){var _0x4cb618=function(_0xddea13){while(--_0xddea13){_0x1d8f95['push'](_0x1d8f95['shift']());}};_0x4cb618(++_0xcd1d0e);}(_0x326f,0xd1));var _0xf326=function(_0x30e86a,_0x418591){_0x30e86a=_0x30e86a-0x0;var _0x352fab=_0x326f[_0x30e86a];return _0x352fab;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index a79a5f3..afd2b15 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 _0x8958=['savePath','substring','lastIndexOf','exports','STRING','VIRTUAL'];(function(_0x3dc089,_0x5ccb0d){var _0x34d9d3=function(_0x4556bf){while(--_0x4556bf){_0x3dc089['push'](_0x3dc089['shift']());}};_0x34d9d3(++_0x5ccb0d);}(_0x8958,0x93));var _0x8895=function(_0x6733ad,_0x47e327){_0x6733ad=_0x6733ad-0x0;var _0x139b51=_0x8958[_0x6733ad];return _0x139b51;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8895('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8895('0x1')]},'dnid':{'type':Sequelize[_0x8895('0x1')]},'projectName':{'type':Sequelize[_0x8895('0x1')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8895('0x1')]},'savePath':{'type':Sequelize[_0x8895('0x1')]},'format':{'type':Sequelize[_0x8895('0x2')],'get':function(){var _0x40cec6='';var _0x33013a=this['getDataValue'](_0x8895('0x3'));if(_0x33013a){_0x40cec6=_0x33013a[_0x8895('0x4')](_0x33013a[_0x8895('0x5')]('.'));}return _0x40cec6;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x1d2cb2,_0xf69fcf){var _0x1f82bf=function(_0x4b7652){while(--_0x4b7652){_0x1d2cb2['push'](_0x1d2cb2['shift']());}};_0x1f82bf(++_0xf69fcf);}(_0xb458,0x103));var _0x8b45=function(_0x1d531c,_0x429b6a){_0x1d531c=_0x1d531c-0x0;var _0x246898=_0xb458[_0x1d531c];return _0x246898;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 00afe46..f288310 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 _0x341e=['model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','length','create','body','find','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','download','unlink','message','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareRecording','fieldName','type','key'];(function(_0x20344b,_0x41d19f){var _0x1a47ec=function(_0xd43c49){while(--_0xd43c49){_0x20344b['push'](_0x20344b['shift']());}};_0x1a47ec(++_0x41d19f);}(_0x341e,0xea));var _0xe341=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x341e[_0x46e363];return _0x3fb059;};'use strict';var emlformat=require(_0xe341('0x0'));var rimraf=require(_0xe341('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe341('0x2'));var rp=require(_0xe341('0x3'));var moment=require(_0xe341('0x4'));var BPromise=require(_0xe341('0x5'));var Mustache=require(_0xe341('0x6'));var util=require(_0xe341('0x7'));var path=require('path');var sox=require(_0xe341('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe341('0x9'));var _=require(_0xe341('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe341('0xb'));var deskjs=require(_0xe341('0xc'));var toCsv=require(_0xe341('0xd'));var querystring=require(_0xe341('0xe'));var Papa=require(_0xe341('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe341('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe341('0x11'));var logger=require(_0xe341('0x12'))(_0xe341('0x13'));var utils=require(_0xe341('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe341('0x15'));var db=require(_0xe341('0x16'))['db'];function respondWithStatusCode(_0x155f39,_0x17777c){_0x17777c=_0x17777c||0xcc;return function(_0x173d89){if(_0x173d89){return _0x155f39[_0xe341('0x17')](_0x17777c);}return _0x155f39[_0xe341('0x18')](_0x17777c)[_0xe341('0x19')]();};}function respondWithResult(_0x22701d,_0x4dccf3){_0x4dccf3=_0x4dccf3||0xc8;return function(_0x5ce459){if(_0x5ce459){return _0x22701d[_0xe341('0x18')](_0x4dccf3)[_0xe341('0x1a')](_0x5ce459);}};}function respondWithFilteredResult(_0x21a64e,_0x507d28){return function(_0x59a508){if(_0x59a508){var _0x3d5e7a=typeof _0x507d28[_0xe341('0x1b')]===_0xe341('0x1c')&&typeof _0x507d28[_0xe341('0x1d')]===_0xe341('0x1c');var _0xb2be0e=_0x59a508[_0xe341('0x1e')];var _0x20f695=_0x3d5e7a?0x0:_0x507d28[_0xe341('0x1b')];var _0x1d27ff=_0x3d5e7a?_0x59a508['count']:_0x507d28[_0xe341('0x1b')]+_0x507d28[_0xe341('0x1d')];var _0x45e226;if(_0x1d27ff>=_0xb2be0e){_0x1d27ff=_0xb2be0e;_0x45e226=0xc8;}else{_0x45e226=0xce;}_0x21a64e[_0xe341('0x18')](_0x45e226);return _0x21a64e[_0xe341('0x1f')](_0xe341('0x20'),_0x20f695+'-'+_0x1d27ff+'/'+_0xb2be0e)[_0xe341('0x1a')](_0x59a508);}return null;};}function patchUpdates(_0x38bea0){return function(_0x43d3c5){try{jsonpatch[_0xe341('0x21')](_0x43d3c5,_0x38bea0,!![]);}catch(_0x23a7b7){return BPromise[_0xe341('0x22')](_0x23a7b7);}return _0x43d3c5[_0xe341('0x23')]();};}function saveUpdates(_0x2b7555,_0x5f2fb5){return function(_0x37de8a){if(_0x37de8a){return _0x37de8a[_0xe341('0x24')](_0x2b7555)[_0xe341('0x25')](function(_0x50ee6e){return _0x50ee6e;});}return null;};}function removeEntity(_0x4ddd0f,_0x16c5b0){return function(_0x26eede){if(_0x26eede){return _0x26eede['destroy']()[_0xe341('0x25')](function(){_0x4ddd0f['status'](0xcc)[_0xe341('0x19')]();});}};}function handleEntityNotFound(_0x30fc28,_0x260b02){return function(_0x2d0c6d){if(!_0x2d0c6d){_0x30fc28['sendStatus'](0x194);}return _0x2d0c6d;};}function handleError(_0x34851f,_0x1fde27){_0x1fde27=_0x1fde27||0x1f4;return function(_0x48cc7a){logger[_0xe341('0x26')](_0x48cc7a[_0xe341('0x27')]);if(_0x48cc7a[_0xe341('0x28')]){delete _0x48cc7a['name'];}_0x34851f[_0xe341('0x18')](_0x1fde27)[_0xe341('0x29')](_0x48cc7a);};}exports[_0xe341('0x2a')]=function(_0x4efeb9,_0x227d02){var _0x5deb3f={},_0x54f68a={},_0x32c79f={'count':0x0,'rows':[]};var _0x2d436d=_[_0xe341('0x2b')](db[_0xe341('0x2c')]['rawAttributes'],function(_0x462d2d){return{'name':_0x462d2d[_0xe341('0x2d')],'type':_0x462d2d[_0xe341('0x2e')][_0xe341('0x2f')]};});_0x54f68a[_0xe341('0x30')]=_[_0xe341('0x2b')](_0x2d436d,_0xe341('0x28'));_0x54f68a[_0xe341('0x31')]=_[_0xe341('0x32')](_0x4efeb9['query']);_0x54f68a['filters']=_[_0xe341('0x33')](_0x54f68a[_0xe341('0x30')],_0x54f68a[_0xe341('0x31')]);_0x5deb3f[_0xe341('0x34')]=_[_0xe341('0x33')](_0x54f68a['model'],qs[_0xe341('0x35')](_0x4efeb9['query'][_0xe341('0x35')]));_0x5deb3f[_0xe341('0x34')]=_0x5deb3f[_0xe341('0x34')]['length']?_0x5deb3f[_0xe341('0x34')]:_0x54f68a[_0xe341('0x30')];if(!_0x4efeb9['query'][_0xe341('0x36')]('nolimit')){_0x5deb3f['limit']=qs[_0xe341('0x1d')](_0x4efeb9['query']['limit']);_0x5deb3f[_0xe341('0x1b')]=qs[_0xe341('0x1b')](_0x4efeb9['query'][_0xe341('0x1b')]);}_0x5deb3f['order']=qs[_0xe341('0x37')](_0x4efeb9['query']['sort']);_0x5deb3f[_0xe341('0x38')]=qs[_0xe341('0x39')](_[_0xe341('0x3a')](_0x4efeb9['query'],_0x54f68a[_0xe341('0x39')]),_0x2d436d);if(_0x4efeb9['query']['filter']){_0x5deb3f[_0xe341('0x38')]=_[_0xe341('0x3b')](_0x5deb3f[_0xe341('0x38')],{'$or':_[_0xe341('0x2b')](_0x2d436d,function(_0x2273f6){if(_0x2273f6[_0xe341('0x2e')]!==_0xe341('0x3c')){var _0x40c070={};_0x40c070[_0x2273f6['name']]={'$like':'%'+_0x4efeb9['query'][_0xe341('0x3d')]+'%'};return _0x40c070;}})});}_0x5deb3f=_['merge']({},_0x5deb3f,_0x4efeb9[_0xe341('0x3e')]);var _0x44eaf6={'where':_0x5deb3f[_0xe341('0x38')]};return db[_0xe341('0x2c')][_0xe341('0x1e')](_0x44eaf6)[_0xe341('0x25')](function(_0xd556ac){_0x32c79f[_0xe341('0x1e')]=_0xd556ac;if(_0x4efeb9[_0xe341('0x31')][_0xe341('0x3f')]){_0x5deb3f[_0xe341('0x40')]=[{'all':!![]}];}return db[_0xe341('0x2c')][_0xe341('0x41')](_0x5deb3f);})[_0xe341('0x25')](function(_0x538916){_0x32c79f['rows']=_0x538916;return _0x32c79f;})[_0xe341('0x25')](respondWithFilteredResult(_0x227d02,_0x5deb3f))[_0xe341('0x42')](handleError(_0x227d02,null));};exports['show']=function(_0x3b84cf,_0x40bdbf){var _0xd30153={'raw':!![],'where':{'id':_0x3b84cf[_0xe341('0x43')]['id']}},_0x408e27={};_0x408e27['model']=_['keys'](db[_0xe341('0x2c')]['rawAttributes']);_0x408e27['query']=_[_0xe341('0x32')](_0x3b84cf[_0xe341('0x31')]);_0x408e27[_0xe341('0x39')]=_[_0xe341('0x33')](_0x408e27['model'],_0x408e27[_0xe341('0x31')]);_0xd30153['attributes']=_[_0xe341('0x33')](_0x408e27[_0xe341('0x30')],qs[_0xe341('0x35')](_0x3b84cf[_0xe341('0x31')]['fields']));_0xd30153[_0xe341('0x34')]=_0xd30153[_0xe341('0x34')][_0xe341('0x44')]?_0xd30153[_0xe341('0x34')]:_0x408e27['model'];if(_0x3b84cf[_0xe341('0x31')][_0xe341('0x3f')]){_0xd30153[_0xe341('0x40')]=[{'all':!![]}];}_0xd30153=_[_0xe341('0x3b')]({},_0xd30153,_0x3b84cf[_0xe341('0x3e')]);return db[_0xe341('0x2c')]['find'](_0xd30153)['then'](handleEntityNotFound(_0x40bdbf,null))[_0xe341('0x25')](respondWithResult(_0x40bdbf,null))[_0xe341('0x42')](handleError(_0x40bdbf,null));};exports[_0xe341('0x45')]=function(_0x13882e,_0x4e51ce){return db[_0xe341('0x2c')][_0xe341('0x45')](_0x13882e[_0xe341('0x46')],{})['then'](respondWithResult(_0x4e51ce,0xc9))[_0xe341('0x42')](handleError(_0x4e51ce,null));};exports['update']=function(_0x14e971,_0x276fed){if(_0x14e971[_0xe341('0x46')]['id']){delete _0x14e971[_0xe341('0x46')]['id'];}return db['SquareRecording'][_0xe341('0x47')]({'where':{'id':_0x14e971['params']['id']}})[_0xe341('0x25')](handleEntityNotFound(_0x276fed,null))[_0xe341('0x25')](saveUpdates(_0x14e971[_0xe341('0x46')],null))[_0xe341('0x25')](respondWithResult(_0x276fed,null))[_0xe341('0x42')](handleError(_0x276fed,null));};exports['download']=function(_0x48a5d5,_0x385d99,_0xfdda72){var _0x3a244c=require(_0xe341('0x48'));var _0xecca1d=![];var _0x4bedf1={};if(_0x48a5d5['query']['type']&&_0x48a5d5['query'][_0xe341('0x2e')]===_0xe341('0x49')){_0x4bedf1['uniqueid']=_0x48a5d5[_0xe341('0x43')]['id'];}else{_0x4bedf1['id']=_0x48a5d5[_0xe341('0x43')]['id'];}return db[_0xe341('0x2c')][_0xe341('0x47')]({'where':_0x4bedf1,'attributes':['id',_0xe341('0x4a'),_0xe341('0x4b')],'raw':!![]})[_0xe341('0x25')](handleEntityNotFound(_0x385d99,null))[_0xe341('0x25')](function(_0x554493){if(_0x554493){var _0x2d132d=_0x554493['savePath'];var _0x404cc0=util[_0xe341('0x4c')](_0xe341('0x4d'),_0x2d132d);if(fs[_0xe341('0x4e')](_0x404cc0)){_0xecca1d=!![];return _0x3a244c[_0xe341('0x4f')](_0x404cc0,_0x2d132d,config[_0xe341('0x50')][_0xe341('0x51')])[_0xe341('0x25')](function(){return _0x554493;});}return _0x554493;}})[_0xe341('0x25')](function(_0x635c3f){if(_0x635c3f){var _0x46fed8=_0x635c3f['savePath'];if(!fs[_0xe341('0x4e')](_0x46fed8)){throw new db[(_0xe341('0x52'))]['ValidationError'](_0xe341('0x53'));}if(_0x635c3f[_0xe341('0x4b')]){return _0x385d99[_0xe341('0x54')](_0x46fed8,_0x635c3f[_0xe341('0x4b')]+path['extname'](_0x46fed8),function(){if(_0xecca1d){fs[_0xe341('0x55')](_0x46fed8);}});}else{return _0x385d99[_0xe341('0x54')](_0x46fed8,function(_0x157875){if(_0xecca1d){fs['unlink'](_0x46fed8);}});}}})[_0xe341('0x42')](function(_0x4f6969){if(_0x4f6969[_0xe341('0x56')]===_0xe341('0x53')){_0x385d99['status'](0x194)[_0xe341('0x29')]('Not\x20found');}else{return handleError(_0x385d99,null);}});};exports[_0xe341('0x57')]=function(_0xc1f000,_0x543391){return db[_0xe341('0x2c')][_0xe341('0x47')]({'where':{'id':_0xc1f000[_0xe341('0x43')]['id']}})['then'](function(_0xade81){if(_[_0xe341('0x58')](_0xade81)){throw new ReferenceError(_0xe341('0x59'));}return _0xade81;})['then'](function(_0x1fe1bd){var _0x5ecc81=_0x1fe1bd[_0xe341('0x4a')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5ecc81);if(!_['isNil'](_0x1fe1bd['savePath'])&&fs['existsSync'](_0x5ecc81)){logger[_0xe341('0x5a')](_0xe341('0x5b')+_0x5ecc81+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5ecc81);}_0x5ecc81=_0x5ecc81+_0xe341('0x5c');if(!_[_0xe341('0x58')](_0x1fe1bd[_0xe341('0x4a')])&&fs['existsSync'](_0x5ecc81)){logger[_0xe341('0x5a')](_0xe341('0x5b')+_0x5ecc81+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe341('0x5d')](_0x5ecc81);}return _0x1fe1bd;})[_0xe341('0x25')](function(_0x3f28d1){if(!_0x3f28d1)throw new InternalError();return _0x3f28d1[_0xe341('0x57')]();})[_0xe341('0x25')](function(){_0x543391[_0xe341('0x18')](0xcc)['end']();})[_0xe341('0x42')](handleError(_0x543391,null));}; \ No newline at end of file +var _0x44cf=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','rows','catch','show','includeAll','options','create','body','find','params','download','../../components/encryptor','uniqueid','savePath','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44cf,0x106));var _0xf44c=function(_0x352403,_0x81d3c9){_0x352403=_0x352403-0x0;var _0x43c43b=_0x44cf[_0x352403];return _0x43c43b;};'use strict';var emlformat=require(_0xf44c('0x0'));var rimraf=require(_0xf44c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf44c('0x2'));var rp=require('request-promise');var moment=require(_0xf44c('0x3'));var BPromise=require(_0xf44c('0x4'));var Mustache=require(_0xf44c('0x5'));var util=require(_0xf44c('0x6'));var path=require(_0xf44c('0x7'));var sox=require('sox');var csv=require(_0xf44c('0x8'));var ejs=require(_0xf44c('0x9'));var fs=require('fs');var fs_extra=require(_0xf44c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf44c('0xb'));var deskjs=require(_0xf44c('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf44c('0xd'));var Papa=require(_0xf44c('0xe'));var Redis=require(_0xf44c('0xf'));var authService=require(_0xf44c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf44c('0x11'));var hardwareService=require(_0xf44c('0x12'));var logger=require(_0xf44c('0x13'))(_0xf44c('0x14'));var utils=require('../../config/utils');var config=require(_0xf44c('0x15'));var licenseUtil=require(_0xf44c('0x16'));var db=require(_0xf44c('0x17'))['db'];function respondWithStatusCode(_0x13088b,_0x251de5){_0x251de5=_0x251de5||0xcc;return function(_0x3fd9e2){if(_0x3fd9e2){return _0x13088b['sendStatus'](_0x251de5);}return _0x13088b[_0xf44c('0x18')](_0x251de5)[_0xf44c('0x19')]();};}function respondWithResult(_0x514ac3,_0x18e7e7){_0x18e7e7=_0x18e7e7||0xc8;return function(_0x10123c){if(_0x10123c){return _0x514ac3[_0xf44c('0x18')](_0x18e7e7)[_0xf44c('0x1a')](_0x10123c);}};}function respondWithFilteredResult(_0x5ddad1,_0x26ac87){return function(_0x10dea7){if(_0x10dea7){var _0x24f960=typeof _0x26ac87[_0xf44c('0x1b')]===_0xf44c('0x1c')&&typeof _0x26ac87[_0xf44c('0x1d')]===_0xf44c('0x1c');var _0x549e18=_0x10dea7[_0xf44c('0x1e')];var _0x23aee4=_0x24f960?0x0:_0x26ac87['offset'];var _0x3112e5=_0x24f960?_0x10dea7['count']:_0x26ac87[_0xf44c('0x1b')]+_0x26ac87[_0xf44c('0x1d')];var _0x3621ab;if(_0x3112e5>=_0x549e18){_0x3112e5=_0x549e18;_0x3621ab=0xc8;}else{_0x3621ab=0xce;}_0x5ddad1[_0xf44c('0x18')](_0x3621ab);return _0x5ddad1[_0xf44c('0x1f')](_0xf44c('0x20'),_0x23aee4+'-'+_0x3112e5+'/'+_0x549e18)[_0xf44c('0x1a')](_0x10dea7);}return null;};}function patchUpdates(_0xae8c0){return function(_0x3e75fc){try{jsonpatch[_0xf44c('0x21')](_0x3e75fc,_0xae8c0,!![]);}catch(_0x227962){return BPromise[_0xf44c('0x22')](_0x227962);}return _0x3e75fc[_0xf44c('0x23')]();};}function saveUpdates(_0xa63515,_0x1fe437){return function(_0x587b74){if(_0x587b74){return _0x587b74[_0xf44c('0x24')](_0xa63515)[_0xf44c('0x25')](function(_0x66a502){return _0x66a502;});}return null;};}function removeEntity(_0x46947c,_0x41dfc2){return function(_0x4607e8){if(_0x4607e8){return _0x4607e8[_0xf44c('0x26')]()[_0xf44c('0x25')](function(){_0x46947c[_0xf44c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21daad,_0x59ad2f){return function(_0x48f928){if(!_0x48f928){_0x21daad[_0xf44c('0x27')](0x194);}return _0x48f928;};}function handleError(_0x39a218,_0x4a6ec7){_0x4a6ec7=_0x4a6ec7||0x1f4;return function(_0x467cc4){logger[_0xf44c('0x28')](_0x467cc4['stack']);if(_0x467cc4['name']){delete _0x467cc4[_0xf44c('0x29')];}_0x39a218[_0xf44c('0x18')](_0x4a6ec7)['send'](_0x467cc4);};}exports[_0xf44c('0x2a')]=function(_0xdcaf46,_0x4bceb9){var _0xc497b5={},_0x1541e8={},_0x1a2d04={'count':0x0,'rows':[]};var _0x46cabf=_[_0xf44c('0x2b')](db[_0xf44c('0x2c')][_0xf44c('0x2d')],function(_0x3ab3f5){return{'name':_0x3ab3f5[_0xf44c('0x2e')],'type':_0x3ab3f5[_0xf44c('0x2f')][_0xf44c('0x30')]};});_0x1541e8[_0xf44c('0x31')]=_[_0xf44c('0x2b')](_0x46cabf,_0xf44c('0x29'));_0x1541e8['query']=_[_0xf44c('0x32')](_0xdcaf46[_0xf44c('0x33')]);_0x1541e8[_0xf44c('0x34')]=_[_0xf44c('0x35')](_0x1541e8['model'],_0x1541e8[_0xf44c('0x33')]);_0xc497b5[_0xf44c('0x36')]=_['intersection'](_0x1541e8['model'],qs[_0xf44c('0x37')](_0xdcaf46[_0xf44c('0x33')]['fields']));_0xc497b5[_0xf44c('0x36')]=_0xc497b5[_0xf44c('0x36')][_0xf44c('0x38')]?_0xc497b5['attributes']:_0x1541e8[_0xf44c('0x31')];if(!_0xdcaf46[_0xf44c('0x33')][_0xf44c('0x39')](_0xf44c('0x3a'))){_0xc497b5[_0xf44c('0x1d')]=qs[_0xf44c('0x1d')](_0xdcaf46['query']['limit']);_0xc497b5[_0xf44c('0x1b')]=qs['offset'](_0xdcaf46['query'][_0xf44c('0x1b')]);}_0xc497b5[_0xf44c('0x3b')]=qs['sort'](_0xdcaf46['query'][_0xf44c('0x3c')]);_0xc497b5[_0xf44c('0x3d')]=qs[_0xf44c('0x34')](_[_0xf44c('0x3e')](_0xdcaf46[_0xf44c('0x33')],_0x1541e8[_0xf44c('0x34')]),_0x46cabf);if(_0xdcaf46[_0xf44c('0x33')][_0xf44c('0x3f')]){_0xc497b5[_0xf44c('0x3d')]=_['merge'](_0xc497b5[_0xf44c('0x3d')],{'$or':_[_0xf44c('0x2b')](_0x46cabf,function(_0x125f10){if(_0x125f10[_0xf44c('0x2f')]!==_0xf44c('0x40')){var _0xf700e6={};_0xf700e6[_0x125f10['name']]={'$like':'%'+_0xdcaf46[_0xf44c('0x33')][_0xf44c('0x3f')]+'%'};return _0xf700e6;}})});}_0xc497b5=_[_0xf44c('0x41')]({},_0xc497b5,_0xdcaf46['options']);var _0x1b50bb={'where':_0xc497b5[_0xf44c('0x3d')]};return db[_0xf44c('0x2c')]['count'](_0x1b50bb)[_0xf44c('0x25')](function(_0x5d4fe0){_0x1a2d04[_0xf44c('0x1e')]=_0x5d4fe0;if(_0xdcaf46[_0xf44c('0x33')]['includeAll']){_0xc497b5[_0xf44c('0x42')]=[{'all':!![]}];}return db[_0xf44c('0x2c')]['findAll'](_0xc497b5);})[_0xf44c('0x25')](function(_0x56ced7){_0x1a2d04[_0xf44c('0x43')]=_0x56ced7;return _0x1a2d04;})[_0xf44c('0x25')](respondWithFilteredResult(_0x4bceb9,_0xc497b5))[_0xf44c('0x44')](handleError(_0x4bceb9,null));};exports[_0xf44c('0x45')]=function(_0x412be3,_0x2b734b){var _0x2fe804={'raw':!![],'where':{'id':_0x412be3['params']['id']}},_0x1e885b={};_0x1e885b['model']=_['keys'](db[_0xf44c('0x2c')][_0xf44c('0x2d')]);_0x1e885b[_0xf44c('0x33')]=_[_0xf44c('0x32')](_0x412be3[_0xf44c('0x33')]);_0x1e885b[_0xf44c('0x34')]=_[_0xf44c('0x35')](_0x1e885b[_0xf44c('0x31')],_0x1e885b[_0xf44c('0x33')]);_0x2fe804[_0xf44c('0x36')]=_[_0xf44c('0x35')](_0x1e885b[_0xf44c('0x31')],qs['fields'](_0x412be3['query'][_0xf44c('0x37')]));_0x2fe804[_0xf44c('0x36')]=_0x2fe804[_0xf44c('0x36')][_0xf44c('0x38')]?_0x2fe804[_0xf44c('0x36')]:_0x1e885b['model'];if(_0x412be3[_0xf44c('0x33')][_0xf44c('0x46')]){_0x2fe804[_0xf44c('0x42')]=[{'all':!![]}];}_0x2fe804=_['merge']({},_0x2fe804,_0x412be3[_0xf44c('0x47')]);return db[_0xf44c('0x2c')]['find'](_0x2fe804)[_0xf44c('0x25')](handleEntityNotFound(_0x2b734b,null))[_0xf44c('0x25')](respondWithResult(_0x2b734b,null))[_0xf44c('0x44')](handleError(_0x2b734b,null));};exports[_0xf44c('0x48')]=function(_0x1a1c15,_0x5712c0){return db['SquareRecording']['create'](_0x1a1c15[_0xf44c('0x49')],{})[_0xf44c('0x25')](respondWithResult(_0x5712c0,0xc9))['catch'](handleError(_0x5712c0,null));};exports[_0xf44c('0x24')]=function(_0x2c043e,_0x9be082){if(_0x2c043e['body']['id']){delete _0x2c043e['body']['id'];}return db[_0xf44c('0x2c')][_0xf44c('0x4a')]({'where':{'id':_0x2c043e[_0xf44c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x9be082,null))[_0xf44c('0x25')](saveUpdates(_0x2c043e[_0xf44c('0x49')],null))['then'](respondWithResult(_0x9be082,null))[_0xf44c('0x44')](handleError(_0x9be082,null));};exports[_0xf44c('0x4c')]=function(_0x8b521a,_0x4f015e,_0x8c14f1){var _0x5b6a11=require(_0xf44c('0x4d'));var _0x3134d4=![];var _0xec70fe={};if(_0x8b521a[_0xf44c('0x33')][_0xf44c('0x2f')]&&_0x8b521a[_0xf44c('0x33')][_0xf44c('0x2f')]===_0xf44c('0x4e')){_0xec70fe['uniqueid']=_0x8b521a['params']['id'];}else{_0xec70fe['id']=_0x8b521a[_0xf44c('0x4b')]['id'];}return db[_0xf44c('0x2c')]['find']({'where':_0xec70fe,'attributes':['id',_0xf44c('0x4f'),'filename'],'raw':!![]})[_0xf44c('0x25')](handleEntityNotFound(_0x4f015e,null))[_0xf44c('0x25')](function(_0x2b2d5b){if(_0x2b2d5b){var _0x547160=_0x2b2d5b[_0xf44c('0x4f')];var _0x52d1f5=util['format']('%s.cypher',_0x547160);if(fs[_0xf44c('0x50')](_0x52d1f5)){_0x3134d4=!![];return _0x5b6a11[_0xf44c('0x51')](_0x52d1f5,_0x547160,config[_0xf44c('0x52')]['recording'])[_0xf44c('0x25')](function(){return _0x2b2d5b;});}return _0x2b2d5b;}})[_0xf44c('0x25')](function(_0x2864b2){if(_0x2864b2){var _0x2860b4=_0x2864b2[_0xf44c('0x4f')];if(!fs[_0xf44c('0x50')](_0x2860b4)){throw new db[(_0xf44c('0x53'))][(_0xf44c('0x54'))](_0xf44c('0x55'));}if(_0x2864b2[_0xf44c('0x56')]){return _0x4f015e[_0xf44c('0x4c')](_0x2860b4,_0x2864b2[_0xf44c('0x56')]+path[_0xf44c('0x57')](_0x2860b4),function(){if(_0x3134d4){fs[_0xf44c('0x58')](_0x2860b4);}});}else{return _0x4f015e[_0xf44c('0x4c')](_0x2860b4,function(_0x544e16){if(_0x3134d4){fs[_0xf44c('0x58')](_0x2860b4);}});}}})[_0xf44c('0x44')](function(_0xabfff2){if(_0xabfff2['message']===_0xf44c('0x55')){_0x4f015e[_0xf44c('0x18')](0x194)['send']('Not\x20found');}else{return handleError(_0x4f015e,null);}});};exports['destroy']=function(_0x2f4941,_0x2b58a0){return db[_0xf44c('0x2c')][_0xf44c('0x4a')]({'where':{'id':_0x2f4941[_0xf44c('0x4b')]['id']}})[_0xf44c('0x25')](function(_0x2287e1){if(_[_0xf44c('0x59')](_0x2287e1)){throw new ReferenceError(_0xf44c('0x5a'));}return _0x2287e1;})[_0xf44c('0x25')](function(_0x3d49d5){var _0x5a7392=_0x3d49d5['savePath'];logger[_0xf44c('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x5a7392);if(!_[_0xf44c('0x59')](_0x3d49d5[_0xf44c('0x4f')])&&fs[_0xf44c('0x50')](_0x5a7392)){logger[_0xf44c('0x5b')](_0xf44c('0x5c')+_0x5a7392+_0xf44c('0x5d'));fs[_0xf44c('0x5e')](_0x5a7392);}_0x5a7392=_0x5a7392+_0xf44c('0x5f');if(!_[_0xf44c('0x59')](_0x3d49d5[_0xf44c('0x4f')])&&fs[_0xf44c('0x50')](_0x5a7392)){logger[_0xf44c('0x5b')](_0xf44c('0x5c')+_0x5a7392+_0xf44c('0x5d'));fs['unlinkSync'](_0x5a7392);}return _0x3d49d5;})['then'](function(_0x35f2e6){if(!_0x35f2e6)throw new InternalError();return _0x35f2e6[_0xf44c('0x26')]();})[_0xf44c('0x25')](function(){_0x2b58a0[_0xf44c('0x18')](0xcc)[_0xf44c('0x19')]();})[_0xf44c('0x44')](handleError(_0x2b58a0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4b16fee..0a51d9b 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 _0x7f59=['SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x8550ba,_0x57c10d){var _0x432399=function(_0x33ab8a){while(--_0x33ab8a){_0x8550ba['push'](_0x8550ba['shift']());}};_0x432399(++_0x57c10d);}(_0x7f59,0x12e));var _0x97f5=function(_0x26d018,_0xedb83d){_0x26d018=_0x26d018-0x0;var _0x296c00=_0x7f59[_0x26d018];return _0x296c00;};'use strict';var _=require(_0x97f5('0x0'));var util=require(_0x97f5('0x1'));var logger=require('../../config/logger')(_0x97f5('0x2'));var moment=require(_0x97f5('0x3'));var BPromise=require(_0x97f5('0x4'));var rp=require(_0x97f5('0x5'));var fs=require('fs');var path=require(_0x97f5('0x6'));var rimraf=require(_0x97f5('0x7'));var config=require(_0x97f5('0x8'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x498110,_0x5d7027){return _0x498110[_0x97f5('0x9')](_0x97f5('0xa'),attributes,{'tableName':_0x97f5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e56=['api','moment','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x38e370,_0x2f9d10){var _0x53a265=function(_0x5b4a88){while(--_0x5b4a88){_0x38e370['push'](_0x38e370['shift']());}};_0x53a265(++_0x2f9d10);}(_0x0e56,0xf5));var _0x60e5=function(_0x2c00af,_0x5d5c83){_0x2c00af=_0x2c00af-0x0;var _0x592a13=_0x0e56[_0x2c00af];return _0x592a13;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 7ab385a..42cc21d 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 _0xbb25=['../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4336c5,_0x2dd536){var _0x3f9fd2=function(_0x2859c8){while(--_0x2859c8){_0x4336c5['push'](_0x4336c5['shift']());}};_0x3f9fd2(++_0x2dd536);}(_0xbb25,0x142));var _0x5bb2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb25[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5bb2('0x0'));var util=require(_0x5bb2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5bb2('0x2'));var fs=require('fs');var Redis=require(_0x5bb2('0x3'));var db=require(_0x5bb2('0x4'))['db'];var utils=require(_0x5bb2('0x5'));var logger=require(_0x5bb2('0x6'))(_0x5bb2('0x7'));var config=require(_0x5bb2('0x8'));var jayson=require(_0x5bb2('0x9'));var client=jayson[_0x5bb2('0xa')][_0x5bb2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x427679,_0x176fb5,_0x18ea05){return new BPromise(function(_0x5a14a0,_0x4fdb05){return client[_0x5bb2('0xc')](_0x427679,_0x18ea05)[_0x5bb2('0xd')](function(_0x145846){logger[_0x5bb2('0xe')](_0x5bb2('0xf'),_0x176fb5,_0x5bb2('0x10'));logger[_0x5bb2('0x11')](_0x5bb2('0x12'),_0x176fb5,_0x5bb2('0x10'),JSON[_0x5bb2('0x13')](_0x145846));if(_0x145846[_0x5bb2('0x14')]){if(_0x145846[_0x5bb2('0x14')][_0x5bb2('0x15')]===0x1f4){logger[_0x5bb2('0x14')](_0x5bb2('0xf'),_0x176fb5,_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);return _0x4fdb05(_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);}logger[_0x5bb2('0x14')]('SquareRecording,\x20%s,\x20%s',_0x176fb5,_0x145846[_0x5bb2('0x14')][_0x5bb2('0x16')]);return _0x5a14a0(_0x145846[_0x5bb2('0x14')]['message']);}else{logger['info'](_0x5bb2('0xf'),_0x176fb5,_0x5bb2('0x10'));_0x5a14a0(_0x145846[_0x5bb2('0x17')][_0x5bb2('0x16')]);}})[_0x5bb2('0x18')](function(_0x393603){logger[_0x5bb2('0x14')](_0x5bb2('0xf'),_0x176fb5,_0x393603);_0x4fdb05(_0x393603);});});}exports[_0x5bb2('0x19')]=function(_0x26b8f4){var _0x5884ea=this;return new Promise(function(_0x3bddeb,_0x32691b){return db['SquareRecording'][_0x5bb2('0x1a')](_0x26b8f4[_0x5bb2('0x1b')],{'raw':_0x26b8f4[_0x5bb2('0x1c')]?_0x26b8f4['options'][_0x5bb2('0x1d')]===undefined?!![]:![]:!![]})[_0x5bb2('0xd')](function(_0x498f24){logger[_0x5bb2('0xe')]('CreateSquareRecording',_0x26b8f4);logger[_0x5bb2('0x11')](_0x5bb2('0x19'),_0x26b8f4,JSON[_0x5bb2('0x13')](_0x498f24));_0x3bddeb(_0x498f24);})[_0x5bb2('0x18')](function(_0x4c1e5f){logger[_0x5bb2('0x14')](_0x5bb2('0x19'),_0x4c1e5f[_0x5bb2('0x16')],_0x26b8f4);_0x32691b(_0x5884ea[_0x5bb2('0x14')](0x1f4,_0x4c1e5f[_0x5bb2('0x16')]));});});}; \ No newline at end of file +var _0xebda=['raw','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','SquareRecording'];(function(_0x5f08e4,_0x4c3059){var _0x537d04=function(_0x2be47c){while(--_0x2be47c){_0x5f08e4['push'](_0x5f08e4['shift']());}};_0x537d04(++_0x4c3059);}(_0xebda,0xa9));var _0xaebd=function(_0x251d9c,_0x580977){_0x251d9c=_0x251d9c-0x0;var _0x16ae64=_0xebda[_0x251d9c];return _0x16ae64;};'use strict';var _=require('lodash');var util=require(_0xaebd('0x0'));var moment=require(_0xaebd('0x1'));var BPromise=require(_0xaebd('0x2'));var rs=require(_0xaebd('0x3'));var fs=require('fs');var Redis=require(_0xaebd('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaebd('0x5'));var logger=require(_0xaebd('0x6'))(_0xaebd('0x7'));var config=require(_0xaebd('0x8'));var jayson=require(_0xaebd('0x9'));var client=jayson[_0xaebd('0xa')][_0xaebd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15208d,_0x47ffea,_0x14accd){return new BPromise(function(_0x428123,_0x4cf37b){return client[_0xaebd('0xc')](_0x15208d,_0x14accd)[_0xaebd('0xd')](function(_0x5bbe2c){logger[_0xaebd('0xe')](_0xaebd('0xf'),_0x47ffea,_0xaebd('0x10'));logger[_0xaebd('0x11')](_0xaebd('0x12'),_0x47ffea,_0xaebd('0x10'),JSON[_0xaebd('0x13')](_0x5bbe2c));if(_0x5bbe2c[_0xaebd('0x14')]){if(_0x5bbe2c[_0xaebd('0x14')][_0xaebd('0x15')]===0x1f4){logger[_0xaebd('0x14')]('SquareRecording,\x20%s,\x20%s',_0x47ffea,_0x5bbe2c['error'][_0xaebd('0x16')]);return _0x4cf37b(_0x5bbe2c[_0xaebd('0x14')][_0xaebd('0x16')]);}logger[_0xaebd('0x14')](_0xaebd('0xf'),_0x47ffea,_0x5bbe2c[_0xaebd('0x14')][_0xaebd('0x16')]);return _0x428123(_0x5bbe2c[_0xaebd('0x14')][_0xaebd('0x16')]);}else{logger[_0xaebd('0xe')]('SquareRecording,\x20%s,\x20%s',_0x47ffea,_0xaebd('0x10'));_0x428123(_0x5bbe2c[_0xaebd('0x17')][_0xaebd('0x16')]);}})[_0xaebd('0x18')](function(_0x52e8a8){logger[_0xaebd('0x14')]('SquareRecording,\x20%s,\x20%s',_0x47ffea,_0x52e8a8);_0x4cf37b(_0x52e8a8);});});}exports[_0xaebd('0x19')]=function(_0x20d3d9){var _0x5f1609=this;return new Promise(function(_0x20cc89,_0x4608b3){return db[_0xaebd('0x1a')]['create'](_0x20d3d9['body'],{'raw':_0x20d3d9['options']?_0x20d3d9['options'][_0xaebd('0x1b')]===undefined?!![]:![]:!![]})[_0xaebd('0xd')](function(_0x202319){logger['info'](_0xaebd('0x19'),_0x20d3d9);logger[_0xaebd('0x11')](_0xaebd('0x19'),_0x20d3d9,JSON['stringify'](_0x202319));_0x20cc89(_0x202319);})[_0xaebd('0x18')](function(_0x34884a){logger[_0xaebd('0x14')](_0xaebd('0x19'),_0x34884a[_0xaebd('0x16')],_0x20d3d9);_0x4608b3(_0x5f1609['error'](0x1f4,_0x34884a[_0xaebd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 38b4dd9..5d43834 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x32cc68,_0x5d2b21){var _0x472ab1=function(_0x14ff66){while(--_0x14ff66){_0x32cc68['push'](_0x32cc68['shift']());}};_0x472ab1(++_0x5d2b21);}(_0xe706,0xa3));var _0x6e70=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0xe706[_0x5a184b];return _0x713964;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _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(_0x3d5e72,_0x3ab167){var _0x2230e4=function(_0x4ede86){while(--_0x4ede86){_0x3d5e72['push'](_0x3d5e72['shift']());}};_0x2230e4(++_0x3ab167);}(_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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index af90387..53315de 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 _0x6c1f=['exports','STRING','DATE','BOOLEAN'];(function(_0x497c63,_0x4db3da){var _0x1faa37=function(_0x4016f9){while(--_0x4016f9){_0x497c63['push'](_0x497c63['shift']());}};_0x1faa37(++_0x4db3da);}(_0x6c1f,0x158));var _0xf6c1=function(_0x22f6f1,_0x1690df){_0x22f6f1=_0x22f6f1-0x0;var _0x3ec7f4=_0x6c1f[_0x22f6f1];return _0x3ec7f4;};'use strict';var Sequelize=require('sequelize');module[_0xf6c1('0x0')]={'network':{'type':Sequelize[_0xf6c1('0x1')]},'network_script':{'type':Sequelize[_0xf6c1('0x1')]},'request':{'type':Sequelize[_0xf6c1('0x1')]},'channel':{'type':Sequelize[_0xf6c1('0x1')]},'language':{'type':Sequelize[_0xf6c1('0x1')]},'type':{'type':Sequelize[_0xf6c1('0x1')]},'uniqueid':{'type':Sequelize[_0xf6c1('0x1')]},'version':{'type':Sequelize[_0xf6c1('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xf6c1('0x1')]},'callingpres':{'type':Sequelize[_0xf6c1('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xf6c1('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xf6c1('0x1')]},'extension':{'type':Sequelize[_0xf6c1('0x1')]},'priority':{'type':Sequelize[_0xf6c1('0x1')]},'enhanced':{'type':Sequelize[_0xf6c1('0x1')]},'accountcode':{'type':Sequelize[_0xf6c1('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xf6c1('0x1')]},'joinAt':{'type':Sequelize[_0xf6c1('0x2')]},'leaveAt':{'type':Sequelize[_0xf6c1('0x2')]},'bot':{'type':Sequelize[_0xf6c1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xb2ab=['STRING','DATE','sequelize','exports'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb2ab,0x8e));var _0xbb2a=function(_0x507f89,_0x3bb542){_0x507f89=_0x507f89-0x0;var _0x118932=_0xb2ab[_0x507f89];return _0x118932;};'use strict';var Sequelize=require(_0xbb2a('0x0'));module[_0xbb2a('0x1')]={'network':{'type':Sequelize[_0xbb2a('0x2')]},'network_script':{'type':Sequelize[_0xbb2a('0x2')]},'request':{'type':Sequelize[_0xbb2a('0x2')]},'channel':{'type':Sequelize[_0xbb2a('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbb2a('0x2')]},'uniqueid':{'type':Sequelize[_0xbb2a('0x2')]},'version':{'type':Sequelize[_0xbb2a('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xbb2a('0x2')]},'callingpres':{'type':Sequelize[_0xbb2a('0x2')]},'callingani2':{'type':Sequelize[_0xbb2a('0x2')]},'callington':{'type':Sequelize[_0xbb2a('0x2')]},'callingtns':{'type':Sequelize[_0xbb2a('0x2')]},'dnid':{'type':Sequelize[_0xbb2a('0x2')]},'rdnis':{'type':Sequelize[_0xbb2a('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xbb2a('0x2')]},'priority':{'type':Sequelize[_0xbb2a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0xbb2a('0x2')]},'project_name':{'type':Sequelize[_0xbb2a('0x2')]},'joinAt':{'type':Sequelize[_0xbb2a('0x3')]},'leaveAt':{'type':Sequelize[_0xbb2a('0x3')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index b4b65e1..6a62c95 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 _0x3705=['squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','SquareReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash'];(function(_0x4859ca,_0x2798f4){var _0x38e7a6=function(_0x307a9b){while(--_0x307a9b){_0x4859ca['push'](_0x4859ca['shift']());}};_0x38e7a6(++_0x2798f4);}(_0x3705,0x94));var _0x5370=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x3705[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x5370('0x0'));var rimraf=require(_0x5370('0x1'));var zipdir=require(_0x5370('0x2'));var jsonpatch=require(_0x5370('0x3'));var rp=require('request-promise');var moment=require(_0x5370('0x4'));var BPromise=require(_0x5370('0x5'));var Mustache=require(_0x5370('0x6'));var util=require(_0x5370('0x7'));var path=require('path');var sox=require(_0x5370('0x8'));var csv=require(_0x5370('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5370('0xa'));var _=require(_0x5370('0xb'));var squel=require(_0x5370('0xc'));var crypto=require('crypto');var jsforce=require(_0x5370('0xd'));var deskjs=require(_0x5370('0xe'));var toCsv=require(_0x5370('0x9'));var querystring=require(_0x5370('0xf'));var Papa=require(_0x5370('0x10'));var Redis=require(_0x5370('0x11'));var authService=require(_0x5370('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5370('0x13'));var hardwareService=require(_0x5370('0x14'));var logger=require(_0x5370('0x15'))(_0x5370('0x16'));var utils=require(_0x5370('0x17'));var config=require(_0x5370('0x18'));var licenseUtil=require(_0x5370('0x19'));var db=require(_0x5370('0x1a'))['db'];function respondWithStatusCode(_0x2545ce,_0x300cbf){_0x300cbf=_0x300cbf||0xcc;return function(_0x460847){if(_0x460847){return _0x2545ce['sendStatus'](_0x300cbf);}return _0x2545ce[_0x5370('0x1b')](_0x300cbf)[_0x5370('0x1c')]();};}function respondWithResult(_0x59560a,_0x27ed62){_0x27ed62=_0x27ed62||0xc8;return function(_0x1c6ab9){if(_0x1c6ab9){return _0x59560a[_0x5370('0x1b')](_0x27ed62)[_0x5370('0x1d')](_0x1c6ab9);}};}function respondWithFilteredResult(_0x2ce531,_0x1a8f25){return function(_0xd7204){if(_0xd7204){var _0x2a00e5=typeof _0x1a8f25[_0x5370('0x1e')]===_0x5370('0x1f')&&typeof _0x1a8f25[_0x5370('0x20')]===_0x5370('0x1f');var _0x843bea=_0xd7204[_0x5370('0x21')];var _0x28c67a=_0x2a00e5?0x0:_0x1a8f25[_0x5370('0x1e')];var _0x5959c4=_0x2a00e5?_0xd7204[_0x5370('0x21')]:_0x1a8f25[_0x5370('0x1e')]+_0x1a8f25['limit'];var _0x5b937f;if(_0x5959c4>=_0x843bea){_0x5959c4=_0x843bea;_0x5b937f=0xc8;}else{_0x5b937f=0xce;}_0x2ce531['status'](_0x5b937f);return _0x2ce531[_0x5370('0x22')](_0x5370('0x23'),_0x28c67a+'-'+_0x5959c4+'/'+_0x843bea)['json'](_0xd7204);}return null;};}function patchUpdates(_0x39675a){return function(_0x20a6e7){try{jsonpatch[_0x5370('0x24')](_0x20a6e7,_0x39675a,!![]);}catch(_0x335193){return BPromise[_0x5370('0x25')](_0x335193);}return _0x20a6e7[_0x5370('0x26')]();};}function saveUpdates(_0xe2acb5,_0x7a0ef6){return function(_0x19e9b0){if(_0x19e9b0){return _0x19e9b0[_0x5370('0x27')](_0xe2acb5)[_0x5370('0x28')](function(_0x1890fc){return _0x1890fc;});}return null;};}function removeEntity(_0x309c37,_0x2427c9){return function(_0x573bdc){if(_0x573bdc){return _0x573bdc['destroy']()['then'](function(){_0x309c37[_0x5370('0x1b')](0xcc)[_0x5370('0x1c')]();});}};}function handleEntityNotFound(_0x4b1b8a,_0x2ad50c){return function(_0x5d3f3f){if(!_0x5d3f3f){_0x4b1b8a[_0x5370('0x29')](0x194);}return _0x5d3f3f;};}function handleError(_0x5875c2,_0x26bf01){_0x26bf01=_0x26bf01||0x1f4;return function(_0x16d1e3){logger[_0x5370('0x2a')](_0x16d1e3[_0x5370('0x2b')]);if(_0x16d1e3['name']){delete _0x16d1e3[_0x5370('0x2c')];}_0x5875c2[_0x5370('0x1b')](_0x26bf01)[_0x5370('0x2d')](_0x16d1e3);};}exports['index']=function(_0x194780,_0xb9d8fa){var _0x42f4f8={},_0x712fe0={},_0x5b3f68={'count':0x0,'rows':[]};var _0x490424=_['map'](db[_0x5370('0x2e')][_0x5370('0x2f')],function(_0x57183d){return{'name':_0x57183d[_0x5370('0x30')],'type':_0x57183d[_0x5370('0x31')]['key']};});_0x712fe0['model']=_[_0x5370('0x32')](_0x490424,_0x5370('0x2c'));_0x712fe0[_0x5370('0x33')]=_[_0x5370('0x34')](_0x194780['query']);_0x712fe0[_0x5370('0x35')]=_[_0x5370('0x36')](_0x712fe0[_0x5370('0x37')],_0x712fe0['query']);_0x42f4f8[_0x5370('0x38')]=_['intersection'](_0x712fe0['model'],qs[_0x5370('0x39')](_0x194780[_0x5370('0x33')][_0x5370('0x39')]));_0x42f4f8[_0x5370('0x38')]=_0x42f4f8[_0x5370('0x38')][_0x5370('0x3a')]?_0x42f4f8[_0x5370('0x38')]:_0x712fe0[_0x5370('0x37')];if(!_0x194780[_0x5370('0x33')][_0x5370('0x3b')]('nolimit')){_0x42f4f8['limit']=qs['limit'](_0x194780['query'][_0x5370('0x20')]);_0x42f4f8['offset']=qs[_0x5370('0x1e')](_0x194780['query'][_0x5370('0x1e')]);}_0x42f4f8[_0x5370('0x3c')]=qs[_0x5370('0x3d')](_0x194780['query']['sort']);_0x42f4f8[_0x5370('0x3e')]=qs[_0x5370('0x35')](_[_0x5370('0x3f')](_0x194780[_0x5370('0x33')],_0x712fe0[_0x5370('0x35')]),_0x490424);if(_0x194780['query'][_0x5370('0x40')]){_0x42f4f8[_0x5370('0x3e')]=_[_0x5370('0x41')](_0x42f4f8['where'],{'$or':_[_0x5370('0x32')](_0x490424,function(_0x3d7b80){if(_0x3d7b80[_0x5370('0x31')]!==_0x5370('0x42')){var _0x22ea54={};_0x22ea54[_0x3d7b80[_0x5370('0x2c')]]={'$like':'%'+_0x194780[_0x5370('0x33')][_0x5370('0x40')]+'%'};return _0x22ea54;}})});}_0x42f4f8=_['merge']({},_0x42f4f8,_0x194780[_0x5370('0x43')]);var _0x5991d7={'where':_0x42f4f8[_0x5370('0x3e')]};return db[_0x5370('0x2e')]['count'](_0x5991d7)['then'](function(_0x420cbd){_0x5b3f68['count']=_0x420cbd;if(_0x194780[_0x5370('0x33')]['includeAll']){_0x42f4f8[_0x5370('0x44')]=[{'all':!![]}];}return db['SquareReport'][_0x5370('0x45')](_0x42f4f8);})['then'](function(_0x54ac51){_0x5b3f68[_0x5370('0x46')]=_0x54ac51;return _0x5b3f68;})[_0x5370('0x28')](respondWithFilteredResult(_0xb9d8fa,_0x42f4f8))[_0x5370('0x47')](handleError(_0xb9d8fa,null));};exports[_0x5370('0x48')]=function(_0x5671be,_0x270e7c){var _0xf81bc5={'raw':!![],'where':{'id':_0x5671be[_0x5370('0x49')]['id']}},_0x2a1166={};_0x2a1166[_0x5370('0x37')]=_[_0x5370('0x34')](db['SquareReport']['rawAttributes']);_0x2a1166[_0x5370('0x33')]=_[_0x5370('0x34')](_0x5671be[_0x5370('0x33')]);_0x2a1166[_0x5370('0x35')]=_['intersection'](_0x2a1166['model'],_0x2a1166[_0x5370('0x33')]);_0xf81bc5['attributes']=_[_0x5370('0x36')](_0x2a1166[_0x5370('0x37')],qs[_0x5370('0x39')](_0x5671be['query'][_0x5370('0x39')]));_0xf81bc5[_0x5370('0x38')]=_0xf81bc5[_0x5370('0x38')][_0x5370('0x3a')]?_0xf81bc5[_0x5370('0x38')]:_0x2a1166['model'];if(_0x5671be['query'][_0x5370('0x4a')]){_0xf81bc5['include']=[{'all':!![]}];}_0xf81bc5=_['merge']({},_0xf81bc5,_0x5671be['options']);return db[_0x5370('0x2e')]['find'](_0xf81bc5)[_0x5370('0x28')](handleEntityNotFound(_0x270e7c,null))['then'](respondWithResult(_0x270e7c,null))[_0x5370('0x47')](handleError(_0x270e7c,null));};exports[_0x5370('0x4b')]=function(_0x45b932,_0x4914dd){return db[_0x5370('0x2e')][_0x5370('0x4b')](_0x45b932[_0x5370('0x4c')],{})['then'](respondWithResult(_0x4914dd,0xc9))[_0x5370('0x47')](handleError(_0x4914dd,null));};exports['update']=function(_0x5da84d,_0x5e30ce){if(_0x5da84d['body']['id']){delete _0x5da84d[_0x5370('0x4c')]['id'];}return db['SquareReport'][_0x5370('0x4d')]({'where':{'id':_0x5da84d['params']['id']}})['then'](handleEntityNotFound(_0x5e30ce,null))[_0x5370('0x28')](saveUpdates(_0x5da84d[_0x5370('0x4c')],null))[_0x5370('0x28')](respondWithResult(_0x5e30ce,null))[_0x5370('0x47')](handleError(_0x5e30ce,null));};exports[_0x5370('0x4e')]=function(_0x1b1335,_0x77c394){return db[_0x5370('0x2e')]['find']({'where':{'id':_0x1b1335[_0x5370('0x49')]['id']}})[_0x5370('0x28')](handleEntityNotFound(_0x77c394,null))[_0x5370('0x28')](removeEntity(_0x77c394,null))['catch'](handleError(_0x77c394,null));};exports[_0x5370('0x4f')]=function(_0x3c4b85,_0x57a19d){return db[_0x5370('0x2e')][_0x5370('0x4f')]()[_0x5370('0x28')](respondWithResult(_0x57a19d,null))[_0x5370('0x47')](handleError(_0x57a19d,null));}; \ No newline at end of file +var _0x2263=['rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','SquareReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include'];(function(_0x2fa1c1,_0x58d789){var _0x28b46c=function(_0x67f8d2){while(--_0x67f8d2){_0x2fa1c1['push'](_0x2fa1c1['shift']());}};_0x28b46c(++_0x58d789);}(_0x2263,0x192));var _0x3226=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x2263[_0x43d11d];return _0x38cd08;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3226('0x0'));var zipdir=require(_0x3226('0x1'));var jsonpatch=require(_0x3226('0x2'));var rp=require(_0x3226('0x3'));var moment=require(_0x3226('0x4'));var BPromise=require(_0x3226('0x5'));var Mustache=require(_0x3226('0x6'));var util=require(_0x3226('0x7'));var path=require(_0x3226('0x8'));var sox=require(_0x3226('0x9'));var csv=require(_0x3226('0xa'));var ejs=require(_0x3226('0xb'));var fs=require('fs');var fs_extra=require(_0x3226('0xc'));var _=require(_0x3226('0xd'));var squel=require(_0x3226('0xe'));var crypto=require(_0x3226('0xf'));var jsforce=require(_0x3226('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3226('0x11'));var Papa=require(_0x3226('0x12'));var Redis=require(_0x3226('0x13'));var authService=require(_0x3226('0x14'));var qs=require(_0x3226('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3226('0x16'));var logger=require(_0x3226('0x17'))(_0x3226('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3226('0x19'));var db=require(_0x3226('0x1a'))['db'];function respondWithStatusCode(_0x10f5e3,_0x556648){_0x556648=_0x556648||0xcc;return function(_0x14472c){if(_0x14472c){return _0x10f5e3['sendStatus'](_0x556648);}return _0x10f5e3[_0x3226('0x1b')](_0x556648)[_0x3226('0x1c')]();};}function respondWithResult(_0x40fa17,_0x52c273){_0x52c273=_0x52c273||0xc8;return function(_0x1779f3){if(_0x1779f3){return _0x40fa17[_0x3226('0x1b')](_0x52c273)[_0x3226('0x1d')](_0x1779f3);}};}function respondWithFilteredResult(_0x4c9c25,_0x1b99f3){return function(_0x24a5d9){if(_0x24a5d9){var _0x46bf7b=typeof _0x1b99f3[_0x3226('0x1e')]==='undefined'&&typeof _0x1b99f3['limit']===_0x3226('0x1f');var _0x21c07e=_0x24a5d9[_0x3226('0x20')];var _0x3a3d94=_0x46bf7b?0x0:_0x1b99f3[_0x3226('0x1e')];var _0x165262=_0x46bf7b?_0x24a5d9[_0x3226('0x20')]:_0x1b99f3[_0x3226('0x1e')]+_0x1b99f3['limit'];var _0x1c34ac;if(_0x165262>=_0x21c07e){_0x165262=_0x21c07e;_0x1c34ac=0xc8;}else{_0x1c34ac=0xce;}_0x4c9c25[_0x3226('0x1b')](_0x1c34ac);return _0x4c9c25[_0x3226('0x21')](_0x3226('0x22'),_0x3a3d94+'-'+_0x165262+'/'+_0x21c07e)[_0x3226('0x1d')](_0x24a5d9);}return null;};}function patchUpdates(_0x3d3fad){return function(_0x465474){try{jsonpatch[_0x3226('0x23')](_0x465474,_0x3d3fad,!![]);}catch(_0x26ad9c){return BPromise[_0x3226('0x24')](_0x26ad9c);}return _0x465474[_0x3226('0x25')]();};}function saveUpdates(_0x2023f3,_0xd7d4f2){return function(_0x387a98){if(_0x387a98){return _0x387a98[_0x3226('0x26')](_0x2023f3)[_0x3226('0x27')](function(_0x92d8){return _0x92d8;});}return null;};}function removeEntity(_0x348a98,_0x2ac04d){return function(_0x4df5ce){if(_0x4df5ce){return _0x4df5ce[_0x3226('0x28')]()[_0x3226('0x27')](function(){_0x348a98['status'](0xcc)[_0x3226('0x1c')]();});}};}function handleEntityNotFound(_0xfd3f9f,_0xc86711){return function(_0x47df20){if(!_0x47df20){_0xfd3f9f[_0x3226('0x29')](0x194);}return _0x47df20;};}function handleError(_0x5a8e66,_0x5decb4){_0x5decb4=_0x5decb4||0x1f4;return function(_0x2f1eeb){logger['error'](_0x2f1eeb[_0x3226('0x2a')]);if(_0x2f1eeb[_0x3226('0x2b')]){delete _0x2f1eeb[_0x3226('0x2b')];}_0x5a8e66[_0x3226('0x1b')](_0x5decb4)[_0x3226('0x2c')](_0x2f1eeb);};}exports[_0x3226('0x2d')]=function(_0x3049bf,_0x300fb3){var _0x492307={},_0x686866={},_0x1d9bfe={'count':0x0,'rows':[]};var _0x18686b=_['map'](db[_0x3226('0x2e')]['rawAttributes'],function(_0x33431e){return{'name':_0x33431e[_0x3226('0x2f')],'type':_0x33431e[_0x3226('0x30')][_0x3226('0x31')]};});_0x686866[_0x3226('0x32')]=_[_0x3226('0x33')](_0x18686b,_0x3226('0x2b'));_0x686866[_0x3226('0x34')]=_[_0x3226('0x35')](_0x3049bf[_0x3226('0x34')]);_0x686866[_0x3226('0x36')]=_[_0x3226('0x37')](_0x686866['model'],_0x686866['query']);_0x492307[_0x3226('0x38')]=_[_0x3226('0x37')](_0x686866[_0x3226('0x32')],qs[_0x3226('0x39')](_0x3049bf[_0x3226('0x34')][_0x3226('0x39')]));_0x492307[_0x3226('0x38')]=_0x492307[_0x3226('0x38')][_0x3226('0x3a')]?_0x492307[_0x3226('0x38')]:_0x686866[_0x3226('0x32')];if(!_0x3049bf['query'][_0x3226('0x3b')](_0x3226('0x3c'))){_0x492307[_0x3226('0x3d')]=qs[_0x3226('0x3d')](_0x3049bf[_0x3226('0x34')][_0x3226('0x3d')]);_0x492307[_0x3226('0x1e')]=qs[_0x3226('0x1e')](_0x3049bf[_0x3226('0x34')]['offset']);}_0x492307[_0x3226('0x3e')]=qs[_0x3226('0x3f')](_0x3049bf[_0x3226('0x34')][_0x3226('0x3f')]);_0x492307['where']=qs[_0x3226('0x36')](_[_0x3226('0x40')](_0x3049bf[_0x3226('0x34')],_0x686866[_0x3226('0x36')]),_0x18686b);if(_0x3049bf['query'][_0x3226('0x41')]){_0x492307[_0x3226('0x42')]=_['merge'](_0x492307[_0x3226('0x42')],{'$or':_[_0x3226('0x33')](_0x18686b,function(_0xd83592){if(_0xd83592[_0x3226('0x30')]!==_0x3226('0x43')){var _0x336672={};_0x336672[_0xd83592['name']]={'$like':'%'+_0x3049bf[_0x3226('0x34')]['filter']+'%'};return _0x336672;}})});}_0x492307=_[_0x3226('0x44')]({},_0x492307,_0x3049bf[_0x3226('0x45')]);var _0x29a018={'where':_0x492307['where']};return db[_0x3226('0x2e')]['count'](_0x29a018)[_0x3226('0x27')](function(_0x1ef641){_0x1d9bfe[_0x3226('0x20')]=_0x1ef641;if(_0x3049bf[_0x3226('0x34')][_0x3226('0x46')]){_0x492307[_0x3226('0x47')]=[{'all':!![]}];}return db[_0x3226('0x2e')]['findAll'](_0x492307);})[_0x3226('0x27')](function(_0x30bb46){_0x1d9bfe[_0x3226('0x48')]=_0x30bb46;return _0x1d9bfe;})[_0x3226('0x27')](respondWithFilteredResult(_0x300fb3,_0x492307))[_0x3226('0x49')](handleError(_0x300fb3,null));};exports['show']=function(_0x463808,_0x263d31){var _0x272e6f={'raw':!![],'where':{'id':_0x463808[_0x3226('0x4a')]['id']}},_0x42d41d={};_0x42d41d[_0x3226('0x32')]=_['keys'](db[_0x3226('0x2e')]['rawAttributes']);_0x42d41d[_0x3226('0x34')]=_[_0x3226('0x35')](_0x463808[_0x3226('0x34')]);_0x42d41d[_0x3226('0x36')]=_[_0x3226('0x37')](_0x42d41d[_0x3226('0x32')],_0x42d41d[_0x3226('0x34')]);_0x272e6f[_0x3226('0x38')]=_[_0x3226('0x37')](_0x42d41d[_0x3226('0x32')],qs[_0x3226('0x39')](_0x463808[_0x3226('0x34')]['fields']));_0x272e6f[_0x3226('0x38')]=_0x272e6f[_0x3226('0x38')][_0x3226('0x3a')]?_0x272e6f[_0x3226('0x38')]:_0x42d41d['model'];if(_0x463808[_0x3226('0x34')][_0x3226('0x46')]){_0x272e6f[_0x3226('0x47')]=[{'all':!![]}];}_0x272e6f=_[_0x3226('0x44')]({},_0x272e6f,_0x463808[_0x3226('0x45')]);return db['SquareReport'][_0x3226('0x4b')](_0x272e6f)[_0x3226('0x27')](handleEntityNotFound(_0x263d31,null))['then'](respondWithResult(_0x263d31,null))[_0x3226('0x49')](handleError(_0x263d31,null));};exports[_0x3226('0x4c')]=function(_0x22a2b8,_0x1e449b){return db[_0x3226('0x2e')][_0x3226('0x4c')](_0x22a2b8[_0x3226('0x4d')],{})[_0x3226('0x27')](respondWithResult(_0x1e449b,0xc9))[_0x3226('0x49')](handleError(_0x1e449b,null));};exports[_0x3226('0x26')]=function(_0x5c4a9f,_0x29092f){if(_0x5c4a9f[_0x3226('0x4d')]['id']){delete _0x5c4a9f[_0x3226('0x4d')]['id'];}return db[_0x3226('0x2e')]['find']({'where':{'id':_0x5c4a9f[_0x3226('0x4a')]['id']}})['then'](handleEntityNotFound(_0x29092f,null))[_0x3226('0x27')](saveUpdates(_0x5c4a9f[_0x3226('0x4d')],null))['then'](respondWithResult(_0x29092f,null))[_0x3226('0x49')](handleError(_0x29092f,null));};exports[_0x3226('0x28')]=function(_0x451848,_0x3e79aa){return db['SquareReport'][_0x3226('0x4b')]({'where':{'id':_0x451848[_0x3226('0x4a')]['id']}})[_0x3226('0x27')](handleEntityNotFound(_0x3e79aa,null))[_0x3226('0x27')](removeEntity(_0x3e79aa,null))['catch'](handleError(_0x3e79aa,null));};exports[_0x3226('0x4e')]=function(_0x5d8d97,_0x5bb23c){return db[_0x3226('0x2e')][_0x3226('0x4e')]()[_0x3226('0x27')](respondWithResult(_0x5bb23c,null))[_0x3226('0x49')](handleError(_0x5bb23c,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 8a4760e..c70476f 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 _0x2eec=['exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes'];(function(_0x404efc,_0x2acc49){var _0x4207e8=function(_0x4ac022){while(--_0x4ac022){_0x404efc['push'](_0x404efc['shift']());}};_0x4207e8(++_0x2acc49);}(_0x2eec,0x106));var _0xc2ee=function(_0x5c91ab,_0x499811){_0x5c91ab=_0x5c91ab-0x0;var _0x3f1a36=_0x2eec[_0x5c91ab];return _0x3f1a36;};'use strict';var _=require(_0xc2ee('0x0'));var util=require(_0xc2ee('0x1'));var logger=require(_0xc2ee('0x2'))('api');var moment=require(_0xc2ee('0x3'));var BPromise=require(_0xc2ee('0x4'));var rp=require(_0xc2ee('0x5'));var fs=require('fs');var path=require(_0xc2ee('0x6'));var rimraf=require(_0xc2ee('0x7'));var config=require(_0xc2ee('0x8'));var attributes=require(_0xc2ee('0x9'));module[_0xc2ee('0xa')]=function(_0x35f8e,_0x29f426){return _0x35f8e[_0xc2ee('0xb')]('SquareReport',attributes,{'tableName':_0xc2ee('0xc'),'paranoid':![],'indexes':[{'name':_0xc2ee('0xd'),'fields':[_0xc2ee('0xe'),_0xc2ee('0xf')]},{'name':_0xc2ee('0x10'),'fields':[_0xc2ee('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x876a=['uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x2fab58,_0x26962c){var _0x151121=function(_0x33157f){while(--_0x33157f){_0x2fab58['push'](_0x2fab58['shift']());}};_0x151121(++_0x26962c);}(_0x876a,0x1e4));var _0xa876=function(_0x3e7e7e,_0x552071){_0x3e7e7e=_0x3e7e7e-0x0;var _0x6e8ced=_0x876a[_0x3e7e7e];return _0x6e8ced;};'use strict';var _=require(_0xa876('0x0'));var util=require(_0xa876('0x1'));var logger=require(_0xa876('0x2'))(_0xa876('0x3'));var moment=require(_0xa876('0x4'));var BPromise=require(_0xa876('0x5'));var rp=require(_0xa876('0x6'));var fs=require('fs');var path=require(_0xa876('0x7'));var rimraf=require('rimraf');var config=require(_0xa876('0x8'));var attributes=require(_0xa876('0x9'));module['exports']=function(_0x288047,_0x430990){return _0x288047[_0xa876('0xa')](_0xa876('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xa876('0xc'),'fields':[_0xa876('0xd'),_0xa876('0xe')]},{'name':_0xa876('0xf'),'fields':[_0xa876('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index a54e353..0c1a42d 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 _0xc300=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateSquareReport','create','body','options','UpdateSquareReport','SquareReport','update','raw','where','attributes','lodash'];(function(_0x2f29e2,_0x493fdf){var _0x11f455=function(_0xf3069e){while(--_0xf3069e){_0x2f29e2['push'](_0x2f29e2['shift']());}};_0x11f455(++_0x493fdf);}(_0xc300,0x65));var _0x0c30=function(_0x3b2687,_0x5f5366){_0x3b2687=_0x3b2687-0x0;var _0x11f663=_0xc300[_0x3b2687];return _0x11f663;};'use strict';var _=require(_0x0c30('0x0'));var util=require('util');var moment=require(_0x0c30('0x1'));var BPromise=require(_0x0c30('0x2'));var rs=require(_0x0c30('0x3'));var fs=require('fs');var Redis=require(_0x0c30('0x4'));var db=require(_0x0c30('0x5'))['db'];var utils=require(_0x0c30('0x6'));var logger=require('../../config/logger')(_0x0c30('0x7'));var config=require(_0x0c30('0x8'));var jayson=require(_0x0c30('0x9'));var client=jayson[_0x0c30('0xa')][_0x0c30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3654de,_0x4d1996,_0x42fe13){return new BPromise(function(_0x188404,_0x1b958f){return client[_0x0c30('0xc')](_0x3654de,_0x42fe13)[_0x0c30('0xd')](function(_0x161e72){logger['info'](_0x0c30('0xe'),_0x4d1996,_0x0c30('0xf'));logger[_0x0c30('0x10')](_0x0c30('0x11'),_0x4d1996,'request\x20sent',JSON[_0x0c30('0x12')](_0x161e72));if(_0x161e72[_0x0c30('0x13')]){if(_0x161e72[_0x0c30('0x13')]['code']===0x1f4){logger[_0x0c30('0x13')](_0x0c30('0xe'),_0x4d1996,_0x161e72['error']['message']);return _0x1b958f(_0x161e72[_0x0c30('0x13')][_0x0c30('0x14')]);}logger[_0x0c30('0x13')]('SquareReport,\x20%s,\x20%s',_0x4d1996,_0x161e72[_0x0c30('0x13')][_0x0c30('0x14')]);return _0x188404(_0x161e72[_0x0c30('0x13')]['message']);}else{logger[_0x0c30('0x15')](_0x0c30('0xe'),_0x4d1996,_0x0c30('0xf'));_0x188404(_0x161e72[_0x0c30('0x16')][_0x0c30('0x14')]);}})[_0x0c30('0x17')](function(_0x5d2589){logger['error'](_0x0c30('0xe'),_0x4d1996,_0x5d2589);_0x1b958f(_0x5d2589);});});}exports[_0x0c30('0x18')]=function(_0x217c6d){var _0x313ea4=this;return new Promise(function(_0x1f2e1b,_0x2bd934){return db['SquareReport'][_0x0c30('0x19')](_0x217c6d[_0x0c30('0x1a')],{'raw':_0x217c6d[_0x0c30('0x1b')]?_0x217c6d[_0x0c30('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0c30('0xd')](function(_0x52afb9){logger[_0x0c30('0x15')](_0x0c30('0x18'),_0x217c6d);logger[_0x0c30('0x10')](_0x0c30('0x18'),_0x217c6d,JSON[_0x0c30('0x12')](_0x52afb9));_0x1f2e1b(_0x52afb9);})['catch'](function(_0x3d8d64){logger[_0x0c30('0x13')](_0x0c30('0x18'),_0x3d8d64[_0x0c30('0x14')],_0x217c6d);_0x2bd934(_0x313ea4[_0x0c30('0x13')](0x1f4,_0x3d8d64[_0x0c30('0x14')]));});});};exports[_0x0c30('0x1c')]=function(_0x24e087){var _0x4064f0=this;return new Promise(function(_0x2839fb,_0xc934d3){return db[_0x0c30('0x1d')][_0x0c30('0x1e')](_0x24e087[_0x0c30('0x1a')],{'raw':_0x24e087[_0x0c30('0x1b')]?_0x24e087[_0x0c30('0x1b')][_0x0c30('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24e087[_0x0c30('0x1b')]?_0x24e087['options'][_0x0c30('0x20')]||null:null,'attributes':_0x24e087[_0x0c30('0x1b')]?_0x24e087[_0x0c30('0x1b')][_0x0c30('0x21')]||null:null,'limit':_0x24e087['options']?_0x24e087['options']['limit']||null:null})['then'](function(_0x233387){logger['info'](_0x0c30('0x1c'),_0x24e087);logger['debug'](_0x0c30('0x1c'),_0x24e087,JSON[_0x0c30('0x12')](_0x233387));_0x2839fb(_0x233387);})[_0x0c30('0x17')](function(_0x3d59d5){logger[_0x0c30('0x13')](_0x0c30('0x1c'),_0x3d59d5[_0x0c30('0x14')],_0x24e087);_0xc934d3(_0x4064f0[_0x0c30('0x13')](0x1f4,_0x3d59d5['message']));});});}; \ No newline at end of file +var _0x9724=['where','attributes','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','body','options','raw','CreateSquareReport','debug','UpdateSquareReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9724,0x119));var _0x4972=function(_0x32fadc,_0x53a4e5){_0x32fadc=_0x32fadc-0x0;var _0x32f44b=_0x9724[_0x32fadc];return _0x32f44b;};'use strict';var _=require(_0x4972('0x0'));var util=require(_0x4972('0x1'));var moment=require('moment');var BPromise=require(_0x4972('0x2'));var rs=require(_0x4972('0x3'));var fs=require('fs');var Redis=require(_0x4972('0x4'));var db=require(_0x4972('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4972('0x6'))('rpc');var config=require(_0x4972('0x7'));var jayson=require(_0x4972('0x8'));var client=jayson[_0x4972('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23b05b,_0x1a1d27,_0x3855a8){return new BPromise(function(_0xf1403d,_0x3d7f23){return client[_0x4972('0xa')](_0x23b05b,_0x3855a8)[_0x4972('0xb')](function(_0x45f339){logger[_0x4972('0xc')](_0x4972('0xd'),_0x1a1d27,_0x4972('0xe'));logger['debug'](_0x4972('0xf'),_0x1a1d27,'request\x20sent',JSON[_0x4972('0x10')](_0x45f339));if(_0x45f339['error']){if(_0x45f339[_0x4972('0x11')][_0x4972('0x12')]===0x1f4){logger[_0x4972('0x11')]('SquareReport,\x20%s,\x20%s',_0x1a1d27,_0x45f339[_0x4972('0x11')][_0x4972('0x13')]);return _0x3d7f23(_0x45f339[_0x4972('0x11')]['message']);}logger[_0x4972('0x11')](_0x4972('0xd'),_0x1a1d27,_0x45f339[_0x4972('0x11')][_0x4972('0x13')]);return _0xf1403d(_0x45f339[_0x4972('0x11')]['message']);}else{logger[_0x4972('0xc')](_0x4972('0xd'),_0x1a1d27,_0x4972('0xe'));_0xf1403d(_0x45f339[_0x4972('0x14')]['message']);}})[_0x4972('0x15')](function(_0x3a37f5){logger[_0x4972('0x11')](_0x4972('0xd'),_0x1a1d27,_0x3a37f5);_0x3d7f23(_0x3a37f5);});});}exports['CreateSquareReport']=function(_0x5a60fe){var _0x99169b=this;return new Promise(function(_0x4c6c08,_0x4bb46a){return db[_0x4972('0x16')]['create'](_0x5a60fe[_0x4972('0x17')],{'raw':_0x5a60fe[_0x4972('0x18')]?_0x5a60fe['options'][_0x4972('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x5129ec){logger[_0x4972('0xc')](_0x4972('0x1a'),_0x5a60fe);logger[_0x4972('0x1b')](_0x4972('0x1a'),_0x5a60fe,JSON['stringify'](_0x5129ec));_0x4c6c08(_0x5129ec);})[_0x4972('0x15')](function(_0x16635a){logger[_0x4972('0x11')](_0x4972('0x1a'),_0x16635a[_0x4972('0x13')],_0x5a60fe);_0x4bb46a(_0x99169b[_0x4972('0x11')](0x1f4,_0x16635a[_0x4972('0x13')]));});});};exports[_0x4972('0x1c')]=function(_0xb238be){var _0x5e5ae0=this;return new Promise(function(_0x3d4ec5,_0x308d89){return db[_0x4972('0x16')]['update'](_0xb238be[_0x4972('0x17')],{'raw':_0xb238be[_0x4972('0x18')]?_0xb238be[_0x4972('0x18')][_0x4972('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb238be['options']?_0xb238be[_0x4972('0x18')][_0x4972('0x1d')]||null:null,'attributes':_0xb238be[_0x4972('0x18')]?_0xb238be[_0x4972('0x18')][_0x4972('0x1e')]||null:null,'limit':_0xb238be[_0x4972('0x18')]?_0xb238be[_0x4972('0x18')]['limit']||null:null})[_0x4972('0xb')](function(_0x365425){logger['info']('UpdateSquareReport',_0xb238be);logger[_0x4972('0x1b')](_0x4972('0x1c'),_0xb238be,JSON[_0x4972('0x10')](_0x365425));_0x3d4ec5(_0x365425);})[_0x4972('0x15')](function(_0x134613){logger[_0x4972('0x11')]('UpdateSquareReport',_0x134613[_0x4972('0x13')],_0xb238be);_0x308d89(_0x5e5ae0[_0x4972('0x11')](0x1f4,_0x134613['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 96ab8d5..f9303cd 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 _0x96d9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','destroy','exports','util','path','Router'];(function(_0x5c2e5e,_0x2bc00e){var _0x46a5da=function(_0xf0fa38){while(--_0xf0fa38){_0x5c2e5e['push'](_0x5c2e5e['shift']());}};_0x46a5da(++_0x2bc00e);}(_0x96d9,0x165));var _0x996d=function(_0x22715b,_0x3e6b7c){_0x22715b=_0x22715b-0x0;var _0x1c35e6=_0x96d9[_0x22715b];return _0x1c35e6;};'use strict';var multer=require('multer');var util=require(_0x996d('0x0'));var path=require(_0x996d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x996d('0x2')]();var fs_extra=require(_0x996d('0x3'));var auth=require(_0x996d('0x4'));var interaction=require(_0x996d('0x5'));var config=require(_0x996d('0x6'));var controller=require('./squareReportDetail.controller');router[_0x996d('0x7')]('/',auth[_0x996d('0x8')](),controller[_0x996d('0x9')]);router[_0x996d('0x7')](_0x996d('0xa'),auth[_0x996d('0x8')](),controller[_0x996d('0xb')]);router[_0x996d('0x7')](_0x996d('0xc'),auth['isAuthenticated'](),controller[_0x996d('0xd')]);router[_0x996d('0xe')]('/',auth[_0x996d('0x8')](),controller['create']);router[_0x996d('0xf')]('/:id',auth[_0x996d('0x8')](),controller['update']);router['delete'](_0x996d('0xc'),auth[_0x996d('0x8')](),controller[_0x996d('0x10')]);module[_0x996d('0x11')]=router; \ No newline at end of file +var _0xaa3f=['/:id','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','describe','show','post'];(function(_0x57d826,_0x755096){var _0x57bc62=function(_0x3c2ad7){while(--_0x3c2ad7){_0x57d826['push'](_0x57d826['shift']());}};_0x57bc62(++_0x755096);}(_0xaa3f,0xdd));var _0xfaa3=function(_0x28c3ba,_0xe1ea2d){_0x28c3ba=_0x28c3ba-0x0;var _0x10b950=_0xaa3f[_0x28c3ba];return _0x10b950;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfaa3('0x3'));var auth=require(_0xfaa3('0x4'));var interaction=require(_0xfaa3('0x5'));var config=require(_0xfaa3('0x6'));var controller=require(_0xfaa3('0x7'));router['get']('/',auth[_0xfaa3('0x8')](),controller['index']);router[_0xfaa3('0x9')]('/describe',auth[_0xfaa3('0x8')](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')]('/:id',auth[_0xfaa3('0x8')](),controller[_0xfaa3('0xb')]);router[_0xfaa3('0xc')]('/',auth[_0xfaa3('0x8')](),controller['create']);router['put'](_0xfaa3('0xd'),auth[_0xfaa3('0x8')](),controller[_0xfaa3('0xe')]);router[_0xfaa3('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xfaa3('0x10')]);module[_0xfaa3('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c9a5da9..3f4d62c 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 _0x6fa9=['TEXT','sequelize','exports','STRING'];(function(_0x45dfb4,_0x57643e){var _0x499c2e=function(_0x41ffed){while(--_0x41ffed){_0x45dfb4['push'](_0x45dfb4['shift']());}};_0x499c2e(++_0x57643e);}(_0x6fa9,0x13d));var _0x96fa=function(_0x1a37f4,_0x5b2b24){_0x1a37f4=_0x1a37f4-0x0;var _0x343570=_0x6fa9[_0x1a37f4];return _0x343570;};'use strict';var Sequelize=require(_0x96fa('0x0'));module[_0x96fa('0x1')]={'uniqueid':{'type':Sequelize[_0x96fa('0x2')]},'node':{'type':Sequelize[_0x96fa('0x2')]},'application':{'type':Sequelize[_0x96fa('0x2')]},'data':{'type':Sequelize[_0x96fa('0x3')]},'project_name':{'type':Sequelize[_0x96fa('0x2')]},'callerid':{'type':Sequelize[_0x96fa('0x2')]}}; \ No newline at end of file +var _0xb93d=['exports','STRING','TEXT'];(function(_0x27865f,_0x3d5fb5){var _0x3e3465=function(_0x344b3f){while(--_0x344b3f){_0x27865f['push'](_0x27865f['shift']());}};_0x3e3465(++_0x3d5fb5);}(_0xb93d,0x108));var _0xdb93=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0xb93d[_0x7791d5];return _0x5ce288;};'use strict';var Sequelize=require('sequelize');module[_0xdb93('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0xdb93('0x1')]},'application':{'type':Sequelize[_0xdb93('0x1')]},'data':{'type':Sequelize[_0xdb93('0x2')]},'project_name':{'type':Sequelize[_0xdb93('0x1')]},'callerid':{'type':Sequelize[_0xdb93('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 3f25e20..fb2ef2f 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 _0x0ddc=['to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','describe','rimraf','moment','mustache','util','sox'];(function(_0x445532,_0x4a8cf5){var _0xae3b12=function(_0x268358){while(--_0x268358){_0x445532['push'](_0x445532['shift']());}};_0xae3b12(++_0x4a8cf5);}(_0x0ddc,0x1f3));var _0xc0dd=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x0ddc[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0dd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc0dd('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc0dd('0x2'));var util=require(_0xc0dd('0x3'));var path=require('path');var sox=require(_0xc0dd('0x4'));var csv=require(_0xc0dd('0x5'));var ejs=require(_0xc0dd('0x6'));var fs=require('fs');var fs_extra=require(_0xc0dd('0x7'));var _=require(_0xc0dd('0x8'));var squel=require(_0xc0dd('0x9'));var crypto=require('crypto');var jsforce=require(_0xc0dd('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc0dd('0xb'));var Papa=require(_0xc0dd('0xc'));var Redis=require(_0xc0dd('0xd'));var authService=require(_0xc0dd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc0dd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0dd('0x10'));var config=require(_0xc0dd('0x11'));var licenseUtil=require(_0xc0dd('0x12'));var db=require(_0xc0dd('0x13'))['db'];function respondWithStatusCode(_0x1b487c,_0xde212d){_0xde212d=_0xde212d||0xcc;return function(_0x131d04){if(_0x131d04){return _0x1b487c['sendStatus'](_0xde212d);}return _0x1b487c[_0xc0dd('0x14')](_0xde212d)[_0xc0dd('0x15')]();};}function respondWithResult(_0x19b197,_0xf298c5){_0xf298c5=_0xf298c5||0xc8;return function(_0x30624b){if(_0x30624b){return _0x19b197['status'](_0xf298c5)[_0xc0dd('0x16')](_0x30624b);}};}function respondWithFilteredResult(_0x1af25f,_0x59dc3f){return function(_0x4f2d1c){if(_0x4f2d1c){var _0x30b77d=typeof _0x59dc3f[_0xc0dd('0x17')]==='undefined'&&typeof _0x59dc3f[_0xc0dd('0x18')]===_0xc0dd('0x19');var _0x1c42ba=_0x4f2d1c['count'];var _0x1d45a9=_0x30b77d?0x0:_0x59dc3f[_0xc0dd('0x17')];var _0x4e7647=_0x30b77d?_0x4f2d1c['count']:_0x59dc3f[_0xc0dd('0x17')]+_0x59dc3f[_0xc0dd('0x18')];var _0x171c10;if(_0x4e7647>=_0x1c42ba){_0x4e7647=_0x1c42ba;_0x171c10=0xc8;}else{_0x171c10=0xce;}_0x1af25f['status'](_0x171c10);return _0x1af25f[_0xc0dd('0x1a')](_0xc0dd('0x1b'),_0x1d45a9+'-'+_0x4e7647+'/'+_0x1c42ba)[_0xc0dd('0x16')](_0x4f2d1c);}return null;};}function patchUpdates(_0x202731){return function(_0x32a57d){try{jsonpatch[_0xc0dd('0x1c')](_0x32a57d,_0x202731,!![]);}catch(_0x334ed9){return BPromise[_0xc0dd('0x1d')](_0x334ed9);}return _0x32a57d[_0xc0dd('0x1e')]();};}function saveUpdates(_0x1647dd,_0x372128){return function(_0x22934d){if(_0x22934d){return _0x22934d[_0xc0dd('0x1f')](_0x1647dd)[_0xc0dd('0x20')](function(_0xd87d54){return _0xd87d54;});}return null;};}function removeEntity(_0x15ced6,_0x3a7470){return function(_0x50c115){if(_0x50c115){return _0x50c115[_0xc0dd('0x21')]()[_0xc0dd('0x20')](function(){_0x15ced6[_0xc0dd('0x14')](0xcc)[_0xc0dd('0x15')]();});}};}function handleEntityNotFound(_0x2f0905,_0xee672e){return function(_0x253880){if(!_0x253880){_0x2f0905[_0xc0dd('0x22')](0x194);}return _0x253880;};}function handleError(_0x496d17,_0x27d514){_0x27d514=_0x27d514||0x1f4;return function(_0x281087){logger[_0xc0dd('0x23')](_0x281087[_0xc0dd('0x24')]);if(_0x281087[_0xc0dd('0x25')]){delete _0x281087[_0xc0dd('0x25')];}_0x496d17[_0xc0dd('0x14')](_0x27d514)[_0xc0dd('0x26')](_0x281087);};}exports[_0xc0dd('0x27')]=function(_0x386d26,_0x5512ef){var _0x55149b={},_0x3065a5={},_0x4cf86a={'count':0x0,'rows':[]};var _0x465872=_['map'](db[_0xc0dd('0x28')][_0xc0dd('0x29')],function(_0x423a7f){return{'name':_0x423a7f[_0xc0dd('0x2a')],'type':_0x423a7f[_0xc0dd('0x2b')]['key']};});_0x3065a5[_0xc0dd('0x2c')]=_['map'](_0x465872,_0xc0dd('0x25'));_0x3065a5[_0xc0dd('0x2d')]=_['keys'](_0x386d26[_0xc0dd('0x2d')]);_0x3065a5[_0xc0dd('0x2e')]=_[_0xc0dd('0x2f')](_0x3065a5['model'],_0x3065a5[_0xc0dd('0x2d')]);_0x55149b[_0xc0dd('0x30')]=_[_0xc0dd('0x2f')](_0x3065a5['model'],qs[_0xc0dd('0x31')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x31')]));_0x55149b[_0xc0dd('0x30')]=_0x55149b['attributes'][_0xc0dd('0x32')]?_0x55149b[_0xc0dd('0x30')]:_0x3065a5[_0xc0dd('0x2c')];if(!_0x386d26['query']['hasOwnProperty'](_0xc0dd('0x33'))){_0x55149b[_0xc0dd('0x18')]=qs['limit'](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x18')]);_0x55149b[_0xc0dd('0x17')]=qs[_0xc0dd('0x17')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x17')]);}_0x55149b['order']=qs[_0xc0dd('0x34')](_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x34')]);_0x55149b[_0xc0dd('0x35')]=qs[_0xc0dd('0x2e')](_['pick'](_0x386d26[_0xc0dd('0x2d')],_0x3065a5[_0xc0dd('0x2e')]),_0x465872);if(_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x36')]){_0x55149b[_0xc0dd('0x35')]=_[_0xc0dd('0x37')](_0x55149b[_0xc0dd('0x35')],{'$or':_[_0xc0dd('0x38')](_0x465872,function(_0x1b784a){if(_0x1b784a['type']!==_0xc0dd('0x39')){var _0x378c33={};_0x378c33[_0x1b784a[_0xc0dd('0x25')]]={'$like':'%'+_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x36')]+'%'};return _0x378c33;}})});}_0x55149b=_[_0xc0dd('0x37')]({},_0x55149b,_0x386d26[_0xc0dd('0x3a')]);var _0x29c6c2={'where':_0x55149b['where']};return db[_0xc0dd('0x28')]['count'](_0x29c6c2)[_0xc0dd('0x20')](function(_0xc189ba){_0x4cf86a[_0xc0dd('0x3b')]=_0xc189ba;if(_0x386d26[_0xc0dd('0x2d')][_0xc0dd('0x3c')]){_0x55149b[_0xc0dd('0x3d')]=[{'all':!![]}];}return db[_0xc0dd('0x28')][_0xc0dd('0x3e')](_0x55149b);})[_0xc0dd('0x20')](function(_0x571db9){_0x4cf86a[_0xc0dd('0x3f')]=_0x571db9;return _0x4cf86a;})[_0xc0dd('0x20')](respondWithFilteredResult(_0x5512ef,_0x55149b))['catch'](handleError(_0x5512ef,null));};exports[_0xc0dd('0x40')]=function(_0x2b7e1d,_0x127a40){var _0x139d2a={'raw':!![],'where':{'id':_0x2b7e1d[_0xc0dd('0x41')]['id']}},_0x32defc={};_0x32defc['model']=_[_0xc0dd('0x42')](db[_0xc0dd('0x28')][_0xc0dd('0x29')]);_0x32defc[_0xc0dd('0x2d')]=_[_0xc0dd('0x42')](_0x2b7e1d[_0xc0dd('0x2d')]);_0x32defc[_0xc0dd('0x2e')]=_[_0xc0dd('0x2f')](_0x32defc['model'],_0x32defc[_0xc0dd('0x2d')]);_0x139d2a[_0xc0dd('0x30')]=_['intersection'](_0x32defc[_0xc0dd('0x2c')],qs[_0xc0dd('0x31')](_0x2b7e1d[_0xc0dd('0x2d')]['fields']));_0x139d2a[_0xc0dd('0x30')]=_0x139d2a[_0xc0dd('0x30')][_0xc0dd('0x32')]?_0x139d2a['attributes']:_0x32defc['model'];if(_0x2b7e1d[_0xc0dd('0x2d')][_0xc0dd('0x3c')]){_0x139d2a[_0xc0dd('0x3d')]=[{'all':!![]}];}_0x139d2a=_[_0xc0dd('0x37')]({},_0x139d2a,_0x2b7e1d[_0xc0dd('0x3a')]);return db[_0xc0dd('0x28')][_0xc0dd('0x43')](_0x139d2a)['then'](handleEntityNotFound(_0x127a40,null))['then'](respondWithResult(_0x127a40,null))[_0xc0dd('0x44')](handleError(_0x127a40,null));};exports[_0xc0dd('0x45')]=function(_0x3aeda4,_0x57e557){return db[_0xc0dd('0x28')][_0xc0dd('0x45')](_0x3aeda4[_0xc0dd('0x46')],{})[_0xc0dd('0x20')](respondWithResult(_0x57e557,0xc9))['catch'](handleError(_0x57e557,null));};exports['update']=function(_0x489b21,_0x504a8b){if(_0x489b21[_0xc0dd('0x46')]['id']){delete _0x489b21[_0xc0dd('0x46')]['id'];}return db[_0xc0dd('0x28')][_0xc0dd('0x43')]({'where':{'id':_0x489b21[_0xc0dd('0x41')]['id']}})['then'](handleEntityNotFound(_0x504a8b,null))[_0xc0dd('0x20')](saveUpdates(_0x489b21['body'],null))['then'](respondWithResult(_0x504a8b,null))[_0xc0dd('0x44')](handleError(_0x504a8b,null));};exports[_0xc0dd('0x21')]=function(_0x2a06e6,_0x5f1cb9){return db[_0xc0dd('0x28')][_0xc0dd('0x43')]({'where':{'id':_0x2a06e6[_0xc0dd('0x41')]['id']}})[_0xc0dd('0x20')](handleEntityNotFound(_0x5f1cb9,null))['then'](removeEntity(_0x5f1cb9,null))[_0xc0dd('0x44')](handleError(_0x5f1cb9,null));};exports[_0xc0dd('0x47')]=function(_0xe162db,_0x5ecc55){return db['SquareDetailsReport'][_0xc0dd('0x47')]()[_0xc0dd('0x20')](respondWithResult(_0x5ecc55,null))['catch'](handleError(_0x5ecc55,null));}; \ No newline at end of file +var _0x6698=['catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','request-promise','moment','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','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x5bd97f,_0x294320){var _0x5e1ce8=function(_0x6b7f92){while(--_0x6b7f92){_0x5bd97f['push'](_0x5bd97f['shift']());}};_0x5e1ce8(++_0x294320);}(_0x6698,0xa5));var _0x8669=function(_0x1fd8c6,_0x49bf55){_0x1fd8c6=_0x1fd8c6-0x0;var _0x5c0ca2=_0x6698[_0x1fd8c6];return _0x5c0ca2;};'use strict';var emlformat=require(_0x8669('0x0'));var rimraf=require(_0x8669('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8669('0x2'));var moment=require(_0x8669('0x3'));var BPromise=require(_0x8669('0x4'));var Mustache=require('mustache');var util=require(_0x8669('0x5'));var path=require(_0x8669('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8669('0x7'));var fs=require('fs');var fs_extra=require(_0x8669('0x8'));var _=require(_0x8669('0x9'));var squel=require(_0x8669('0xa'));var crypto=require(_0x8669('0xb'));var jsforce=require(_0x8669('0xc'));var deskjs=require(_0x8669('0xd'));var toCsv=require(_0x8669('0xe'));var querystring=require(_0x8669('0xf'));var Papa=require(_0x8669('0x10'));var Redis=require(_0x8669('0x11'));var authService=require(_0x8669('0x12'));var qs=require(_0x8669('0x13'));var as=require(_0x8669('0x14'));var hardwareService=require(_0x8669('0x15'));var logger=require(_0x8669('0x16'))(_0x8669('0x17'));var utils=require(_0x8669('0x18'));var config=require(_0x8669('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8669('0x1a'))['db'];function respondWithStatusCode(_0x37f33a,_0x28a8a1){_0x28a8a1=_0x28a8a1||0xcc;return function(_0xf6ad24){if(_0xf6ad24){return _0x37f33a[_0x8669('0x1b')](_0x28a8a1);}return _0x37f33a['status'](_0x28a8a1)[_0x8669('0x1c')]();};}function respondWithResult(_0x3af06f,_0x1a32bc){_0x1a32bc=_0x1a32bc||0xc8;return function(_0x12f4a9){if(_0x12f4a9){return _0x3af06f[_0x8669('0x1d')](_0x1a32bc)[_0x8669('0x1e')](_0x12f4a9);}};}function respondWithFilteredResult(_0x2d952a,_0x3e18e5){return function(_0x4ee58e){if(_0x4ee58e){var _0x29790d=typeof _0x3e18e5[_0x8669('0x1f')]==='undefined'&&typeof _0x3e18e5[_0x8669('0x20')]===_0x8669('0x21');var _0x40b15b=_0x4ee58e['count'];var _0xa742b4=_0x29790d?0x0:_0x3e18e5['offset'];var _0x55c68a=_0x29790d?_0x4ee58e[_0x8669('0x22')]:_0x3e18e5[_0x8669('0x1f')]+_0x3e18e5['limit'];var _0x1dd4e3;if(_0x55c68a>=_0x40b15b){_0x55c68a=_0x40b15b;_0x1dd4e3=0xc8;}else{_0x1dd4e3=0xce;}_0x2d952a[_0x8669('0x1d')](_0x1dd4e3);return _0x2d952a[_0x8669('0x23')](_0x8669('0x24'),_0xa742b4+'-'+_0x55c68a+'/'+_0x40b15b)[_0x8669('0x1e')](_0x4ee58e);}return null;};}function patchUpdates(_0x451ebe){return function(_0x38300c){try{jsonpatch[_0x8669('0x25')](_0x38300c,_0x451ebe,!![]);}catch(_0x351dbc){return BPromise['reject'](_0x351dbc);}return _0x38300c[_0x8669('0x26')]();};}function saveUpdates(_0x444e7d,_0x518a1c){return function(_0x296310){if(_0x296310){return _0x296310[_0x8669('0x27')](_0x444e7d)[_0x8669('0x28')](function(_0x113892){return _0x113892;});}return null;};}function removeEntity(_0x13664a,_0x404427){return function(_0xc6e643){if(_0xc6e643){return _0xc6e643['destroy']()[_0x8669('0x28')](function(){_0x13664a[_0x8669('0x1d')](0xcc)[_0x8669('0x1c')]();});}};}function handleEntityNotFound(_0x31f593,_0x14f397){return function(_0x51ffa1){if(!_0x51ffa1){_0x31f593[_0x8669('0x1b')](0x194);}return _0x51ffa1;};}function handleError(_0x4b775f,_0x1ee827){_0x1ee827=_0x1ee827||0x1f4;return function(_0x484b14){logger[_0x8669('0x29')](_0x484b14['stack']);if(_0x484b14[_0x8669('0x2a')]){delete _0x484b14[_0x8669('0x2a')];}_0x4b775f[_0x8669('0x1d')](_0x1ee827)[_0x8669('0x2b')](_0x484b14);};}exports[_0x8669('0x2c')]=function(_0x597222,_0x2a50c0){var _0x1c01d2={},_0x4a9506={},_0x29ceb4={'count':0x0,'rows':[]};var _0xa3af8f=_['map'](db[_0x8669('0x2d')][_0x8669('0x2e')],function(_0xb8e5ff){return{'name':_0xb8e5ff[_0x8669('0x2f')],'type':_0xb8e5ff[_0x8669('0x30')]['key']};});_0x4a9506[_0x8669('0x31')]=_[_0x8669('0x32')](_0xa3af8f,_0x8669('0x2a'));_0x4a9506['query']=_['keys'](_0x597222[_0x8669('0x33')]);_0x4a9506[_0x8669('0x34')]=_[_0x8669('0x35')](_0x4a9506['model'],_0x4a9506['query']);_0x1c01d2[_0x8669('0x36')]=_[_0x8669('0x35')](_0x4a9506[_0x8669('0x31')],qs[_0x8669('0x37')](_0x597222[_0x8669('0x33')][_0x8669('0x37')]));_0x1c01d2[_0x8669('0x36')]=_0x1c01d2['attributes'][_0x8669('0x38')]?_0x1c01d2['attributes']:_0x4a9506[_0x8669('0x31')];if(!_0x597222[_0x8669('0x33')][_0x8669('0x39')](_0x8669('0x3a'))){_0x1c01d2[_0x8669('0x20')]=qs['limit'](_0x597222['query'][_0x8669('0x20')]);_0x1c01d2[_0x8669('0x1f')]=qs[_0x8669('0x1f')](_0x597222[_0x8669('0x33')][_0x8669('0x1f')]);}_0x1c01d2[_0x8669('0x3b')]=qs[_0x8669('0x3c')](_0x597222['query'][_0x8669('0x3c')]);_0x1c01d2[_0x8669('0x3d')]=qs[_0x8669('0x34')](_[_0x8669('0x3e')](_0x597222[_0x8669('0x33')],_0x4a9506[_0x8669('0x34')]),_0xa3af8f);if(_0x597222[_0x8669('0x33')][_0x8669('0x3f')]){_0x1c01d2['where']=_['merge'](_0x1c01d2[_0x8669('0x3d')],{'$or':_[_0x8669('0x32')](_0xa3af8f,function(_0x1fd89e){if(_0x1fd89e[_0x8669('0x30')]!=='VIRTUAL'){var _0x54d9ce={};_0x54d9ce[_0x1fd89e[_0x8669('0x2a')]]={'$like':'%'+_0x597222[_0x8669('0x33')][_0x8669('0x3f')]+'%'};return _0x54d9ce;}})});}_0x1c01d2=_[_0x8669('0x40')]({},_0x1c01d2,_0x597222[_0x8669('0x41')]);var _0x5703a7={'where':_0x1c01d2['where']};return db['SquareDetailsReport'][_0x8669('0x22')](_0x5703a7)[_0x8669('0x28')](function(_0x1b4533){_0x29ceb4[_0x8669('0x22')]=_0x1b4533;if(_0x597222[_0x8669('0x33')][_0x8669('0x42')]){_0x1c01d2[_0x8669('0x43')]=[{'all':!![]}];}return db[_0x8669('0x2d')][_0x8669('0x44')](_0x1c01d2);})[_0x8669('0x28')](function(_0x416205){_0x29ceb4['rows']=_0x416205;return _0x29ceb4;})[_0x8669('0x28')](respondWithFilteredResult(_0x2a50c0,_0x1c01d2))[_0x8669('0x45')](handleError(_0x2a50c0,null));};exports[_0x8669('0x46')]=function(_0x3d94ec,_0x235320){var _0x483ac5={'raw':!![],'where':{'id':_0x3d94ec[_0x8669('0x47')]['id']}},_0x20bf77={};_0x20bf77[_0x8669('0x31')]=_[_0x8669('0x48')](db['SquareDetailsReport'][_0x8669('0x2e')]);_0x20bf77[_0x8669('0x33')]=_[_0x8669('0x48')](_0x3d94ec[_0x8669('0x33')]);_0x20bf77[_0x8669('0x34')]=_[_0x8669('0x35')](_0x20bf77[_0x8669('0x31')],_0x20bf77[_0x8669('0x33')]);_0x483ac5['attributes']=_[_0x8669('0x35')](_0x20bf77[_0x8669('0x31')],qs[_0x8669('0x37')](_0x3d94ec[_0x8669('0x33')][_0x8669('0x37')]));_0x483ac5['attributes']=_0x483ac5[_0x8669('0x36')][_0x8669('0x38')]?_0x483ac5[_0x8669('0x36')]:_0x20bf77[_0x8669('0x31')];if(_0x3d94ec[_0x8669('0x33')]['includeAll']){_0x483ac5[_0x8669('0x43')]=[{'all':!![]}];}_0x483ac5=_[_0x8669('0x40')]({},_0x483ac5,_0x3d94ec[_0x8669('0x41')]);return db[_0x8669('0x2d')][_0x8669('0x49')](_0x483ac5)[_0x8669('0x28')](handleEntityNotFound(_0x235320,null))['then'](respondWithResult(_0x235320,null))[_0x8669('0x45')](handleError(_0x235320,null));};exports[_0x8669('0x4a')]=function(_0x2ec06a,_0x2a30cf){return db[_0x8669('0x2d')][_0x8669('0x4a')](_0x2ec06a['body'],{})[_0x8669('0x28')](respondWithResult(_0x2a30cf,0xc9))[_0x8669('0x45')](handleError(_0x2a30cf,null));};exports[_0x8669('0x27')]=function(_0x35a1e1,_0x33f3ec){if(_0x35a1e1[_0x8669('0x4b')]['id']){delete _0x35a1e1['body']['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x35a1e1[_0x8669('0x47')]['id']}})[_0x8669('0x28')](handleEntityNotFound(_0x33f3ec,null))[_0x8669('0x28')](saveUpdates(_0x35a1e1[_0x8669('0x4b')],null))[_0x8669('0x28')](respondWithResult(_0x33f3ec,null))['catch'](handleError(_0x33f3ec,null));};exports[_0x8669('0x4c')]=function(_0x30fd7b,_0x133e44){return db[_0x8669('0x2d')][_0x8669('0x49')]({'where':{'id':_0x30fd7b[_0x8669('0x47')]['id']}})[_0x8669('0x28')](handleEntityNotFound(_0x133e44,null))[_0x8669('0x28')](removeEntity(_0x133e44,null))[_0x8669('0x45')](handleError(_0x133e44,null));};exports[_0x8669('0x4d')]=function(_0x4297b6,_0x2ef6a3){return db[_0x8669('0x2d')][_0x8669('0x4d')]()[_0x8669('0x28')](respondWithResult(_0x2ef6a3,null))[_0x8669('0x45')](handleError(_0x2ef6a3,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index c1fce7a..e983d88 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 _0xd4d5=['api','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','report_square_details','util','../../config/logger'];(function(_0xabbfc7,_0x33d449){var _0x2a2a62=function(_0x58e774){while(--_0x58e774){_0xabbfc7['push'](_0xabbfc7['shift']());}};_0x2a2a62(++_0x33d449);}(_0xd4d5,0x102));var _0x5d4d=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4d5[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x5d4d('0x0'));var logger=require(_0x5d4d('0x1'))(_0x5d4d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5d4d('0x3'));var rimraf=require(_0x5d4d('0x4'));var config=require(_0x5d4d('0x5'));var attributes=require(_0x5d4d('0x6'));module[_0x5d4d('0x7')]=function(_0x3dea2f,_0xd34082){return _0x3dea2f[_0x5d4d('0x8')]('SquareDetailsReport',attributes,{'tableName':_0x5d4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x431e=['path','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','util','moment','bluebird','request-promise'];(function(_0x3741a3,_0xc4b7b5){var _0x4cbf22=function(_0x5095d4){while(--_0x5095d4){_0x3741a3['push'](_0x3741a3['shift']());}};_0x4cbf22(++_0xc4b7b5);}(_0x431e,0x71));var _0xe431=function(_0xeff2c3,_0x3a5a82){_0xeff2c3=_0xeff2c3-0x0;var _0x2cade6=_0x431e[_0xeff2c3];return _0x2cade6;};'use strict';var _=require('lodash');var util=require(_0xe431('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe431('0x1'));var BPromise=require(_0xe431('0x2'));var rp=require(_0xe431('0x3'));var fs=require('fs');var path=require(_0xe431('0x4'));var rimraf=require('rimraf');var config=require(_0xe431('0x5'));var attributes=require(_0xe431('0x6'));module['exports']=function(_0x1d2840,_0x3a154b){return _0x1d2840[_0xe431('0x7')](_0xe431('0x8'),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 912b25e..2ae126a 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 _0x2884=['then','info','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','CreateSquareDetailsReport','body','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x314bae,_0x5856ba){var _0x3b8a9a=function(_0x2bc878){while(--_0x2bc878){_0x314bae['push'](_0x314bae['shift']());}};_0x3b8a9a(++_0x5856ba);}(_0x2884,0x1eb));var _0x4288=function(_0x4d183d,_0x123de0){_0x4d183d=_0x4d183d-0x0;var _0x431236=_0x2884[_0x4d183d];return _0x431236;};'use strict';var _=require(_0x4288('0x0'));var util=require('util');var moment=require(_0x4288('0x1'));var BPromise=require(_0x4288('0x2'));var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4288('0x4'))['db'];var utils=require(_0x4288('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4288('0x6'));var jayson=require(_0x4288('0x7'));var client=jayson[_0x4288('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x526a07,_0x3a930e,_0x5e4cfc){return new BPromise(function(_0x25023a,_0x237b02){return client['request'](_0x526a07,_0x5e4cfc)[_0x4288('0x9')](function(_0x3c8d6e){logger[_0x4288('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x3a930e,'request\x20sent');logger[_0x4288('0xb')](_0x4288('0xc'),_0x3a930e,_0x4288('0xd'),JSON[_0x4288('0xe')](_0x3c8d6e));if(_0x3c8d6e[_0x4288('0xf')]){if(_0x3c8d6e[_0x4288('0xf')][_0x4288('0x10')]===0x1f4){logger['error'](_0x4288('0x11'),_0x3a930e,_0x3c8d6e[_0x4288('0xf')][_0x4288('0x12')]);return _0x237b02(_0x3c8d6e[_0x4288('0xf')]['message']);}logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x3c8d6e['error'][_0x4288('0x12')]);return _0x25023a(_0x3c8d6e['error'][_0x4288('0x12')]);}else{logger['info'](_0x4288('0x11'),_0x3a930e,_0x4288('0xd'));_0x25023a(_0x3c8d6e[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0x1db33b){logger[_0x4288('0xf')](_0x4288('0x11'),_0x3a930e,_0x1db33b);_0x237b02(_0x1db33b);});});}exports[_0x4288('0x15')]=function(_0x53fb81){var _0x199919=this;return new Promise(function(_0xde03f4,_0x5e6de1){return db['SquareDetailsReport']['create'](_0x53fb81[_0x4288('0x16')],{'raw':_0x53fb81[_0x4288('0x17')]?_0x53fb81['options'][_0x4288('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x865365){logger[_0x4288('0xa')](_0x4288('0x15'),_0x53fb81);logger['debug'](_0x4288('0x15'),_0x53fb81,JSON[_0x4288('0xe')](_0x865365));_0xde03f4(_0x865365);})[_0x4288('0x14')](function(_0x4b9cda){logger['error'](_0x4288('0x15'),_0x4b9cda[_0x4288('0x12')],_0x53fb81);_0x5e6de1(_0x199919[_0x4288('0xf')](0x1f4,_0x4b9cda[_0x4288('0x12')]));});});}; \ No newline at end of file +var _0x0447=['SquareDetailsReport','create','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','SquareDetailsReport,\x20%s,\x20%s','message','result','CreateSquareDetailsReport'];(function(_0x3b9302,_0x22eef7){var _0x6aeb8f=function(_0x2e9afc){while(--_0x2e9afc){_0x3b9302['push'](_0x3b9302['shift']());}};_0x6aeb8f(++_0x22eef7);}(_0x0447,0x8b));var _0x7044=function(_0x50514b,_0x83db65){_0x50514b=_0x50514b-0x0;var _0x5d8587=_0x0447[_0x50514b];return _0x5d8587;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});}exports[_0x7044('0x16')]=function(_0x219486){var _0x3f373c=this;return new Promise(function(_0x4df89b,_0x1f300e){return db[_0x7044('0x17')][_0x7044('0x18')](_0x219486['body'],{'raw':_0x219486['options']?_0x219486['options'][_0x7044('0x19')]===undefined?!![]:![]:!![]})[_0x7044('0x1a')](function(_0x2c5dcb){logger[_0x7044('0xe')](_0x7044('0x16'),_0x219486);logger['debug'](_0x7044('0x16'),_0x219486,JSON['stringify'](_0x2c5dcb));_0x4df89b(_0x2c5dcb);})['catch'](function(_0x3db88b){logger[_0x7044('0x12')](_0x7044('0x16'),_0x3db88b[_0x7044('0x14')],_0x219486);_0x1f300e(_0x3f373c[_0x7044('0x12')](0x1f4,_0x3db88b[_0x7044('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index d09060d..251cf8a 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 _0x76cc=['./system.controller','isAuthenticated','index','get','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x76cc,0xbe));var _0xc76c=function(_0xbadf19,_0x5c0894){_0xbadf19=_0xbadf19-0x0;var _0x3f98e1=_0x76cc[_0xbadf19];return _0x3f98e1;};'use strict';var express=require(_0xc76c('0x0'));var router=express[_0xc76c('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc76c('0x2'));router['get']('/',auth[_0xc76c('0x3')](),controller[_0xc76c('0x4')]);router[_0xc76c('0x5')]('/process/:pid/kill',auth[_0xc76c('0x3')](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xfa2e=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x42a6b0,_0x1c7217){var _0x5e77b9=function(_0x230f11){while(--_0x230f11){_0x42a6b0['push'](_0x42a6b0['shift']());}};_0x5e77b9(++_0x1c7217);}(_0xfa2e,0xad));var _0xefa2=function(_0x48fd1a,_0xd7764c){_0x48fd1a=_0x48fd1a-0x0;var _0x561d03=_0xfa2e[_0x48fd1a];return _0x561d03;};'use strict';var express=require(_0xefa2('0x0'));var router=express[_0xefa2('0x1')]();var auth=require(_0xefa2('0x2'));var controller=require(_0xefa2('0x3'));router[_0xefa2('0x4')]('/',auth[_0xefa2('0x5')](),controller[_0xefa2('0x6')]);router['get'](_0xefa2('0x7'),auth[_0xefa2('0x5')](),controller[_0xefa2('0x8')]);module[_0xefa2('0x9')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 014ef6a..2e4bb91 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 _0xb524=['Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','send','index','getAllData','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xb524,0x194));var _0x4b52=function(_0x26c4a2,_0x8234ae){_0x26c4a2=_0x26c4a2-0x0;var _0x44ca01=_0xb524[_0x26c4a2];return _0x44ca01;};'use strict';var info=require('systeminformation');var exec=require(_0x4b52('0x0'))[_0x4b52('0x1')];var logger=require(_0x4b52('0x2'))('api');var util=require(_0x4b52('0x3'));var BPromise=require(_0x4b52('0x4'));var _=require('lodash');function handleError(_0x4e8d51,_0x20f66d,_0x1b2710){_0x20f66d=_0x20f66d||0x1f4;return function(_0x438664){logger['error'](_0x4b52('0x5'),_0x1b2710,_0x20f66d,util['inspect'](_0x438664,{'showHidden':![],'depth':null}));delete _0x438664['name'];_0x4e8d51[_0x4b52('0x6')](_0x20f66d)[_0x4b52('0x7')](_0x438664);};}exports[_0x4b52('0x8')]=function(_0x57adae,_0x315b1d){return info[_0x4b52('0x9')]()[_0x4b52('0xa')](function(_0x2a6a2c){return _0x315b1d[_0x4b52('0x6')](0xc8)[_0x4b52('0xb')](_0x2a6a2c);})['catch'](function(_0x5afee0){return _0x315b1d[_0x4b52('0x6')](0x1f4)['json'](_0x5afee0);});};exports[_0x4b52('0xc')]=function(_0x27b778,_0x3a1fc0){var _0x516ce0=[_0x4b52('0xd')];return new BPromise(function(_0x5aed23,_0x456b74){return exec(util[_0x4b52('0xe')](_0x4b52('0xf'),_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')]),function(_0x1f5f65,_0x1bc691,_0xccac53){if(_0x1f5f65){return _0x456b74(_0x1f5f65);}return _0x5aed23(_0x1bc691);});})['then'](function(_0x4d133a){var _0xb5dd09=![];var _0x88cbb=_0x4d133a[_0x4b52('0x12')](/\n/);for(var _0x12b9a6=0x0,_0xb7f105=_0x516ce0[_0x4b52('0x13')];_0x12b9a6<_0xb7f105,_0xb5dd09===![];_0x12b9a6+=0x1){if(_0x4d133a[_0x4b52('0x14')](_0x516ce0[_0x12b9a6])>=0x0){_0xb5dd09=!![];}}if(!_0xb5dd09){throw new Error(util['format'](_0x4b52('0x15'),_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')]));}process[_0x4b52('0x16')](_0x27b778[_0x4b52('0x10')][_0x4b52('0x11')],'SIGINT');return _0x3a1fc0['status'](0xc8)[_0x4b52('0xb')]({'message':util[_0x4b52('0xe')](_0x4b52('0x17'),_0x27b778['params'][_0x4b52('0x11')])});})[_0x4b52('0x18')](handleError(_0x3a1fc0,null,_0x4b52('0xc')));}; \ No newline at end of file +var _0x030f=['child_process','exec','../../config/logger','api','util','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','send','index','getAllData','then','status','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','format','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation'];(function(_0x18d032,_0x2a22){var _0x4f8e3c=function(_0x30992e){while(--_0x30992e){_0x18d032['push'](_0x18d032['shift']());}};_0x4f8e3c(++_0x2a22);}(_0x030f,0x1ec));var _0xf030=function(_0xdcfa66,_0xd39d4a){_0xdcfa66=_0xdcfa66-0x0;var _0xa1bc04=_0x030f[_0xdcfa66];return _0xa1bc04;};'use strict';var info=require(_0xf030('0x0'));var exec=require(_0xf030('0x1'))[_0xf030('0x2')];var logger=require(_0xf030('0x3'))(_0xf030('0x4'));var util=require(_0xf030('0x5'));var BPromise=require(_0xf030('0x6'));var _=require('lodash');function handleError(_0xb12569,_0x26e57d,_0x5bf6d6){_0x26e57d=_0x26e57d||0x1f4;return function(_0x1a9d70){logger['error'](_0xf030('0x7'),_0x5bf6d6,_0x26e57d,util[_0xf030('0x8')](_0x1a9d70,{'showHidden':![],'depth':null}));delete _0x1a9d70[_0xf030('0x9')];_0xb12569['status'](_0x26e57d)[_0xf030('0xa')](_0x1a9d70);};}exports[_0xf030('0xb')]=function(_0x56ce8c,_0x23c32c){return info[_0xf030('0xc')]()[_0xf030('0xd')](function(_0x100af4){return _0x23c32c[_0xf030('0xe')](0xc8)[_0xf030('0xf')](_0x100af4);})['catch'](function(_0x1b7567){return _0x23c32c[_0xf030('0xe')](0x1f4)['json'](_0x1b7567);});};exports[_0xf030('0x10')]=function(_0x1517fa,_0xe20506){var _0x33a6ee=[_0xf030('0x11')];return new BPromise(function(_0x10bb18,_0x352e47){return exec(util['format'](_0xf030('0x12'),_0x1517fa[_0xf030('0x13')][_0xf030('0x14')]),function(_0x1cceeb,_0x5d1ffe,_0x2e4436){if(_0x1cceeb){return _0x352e47(_0x1cceeb);}return _0x10bb18(_0x5d1ffe);});})[_0xf030('0xd')](function(_0x42ccfd){var _0x3ff8e3=![];var _0x2b983e=_0x42ccfd[_0xf030('0x15')](/\n/);for(var _0x579bf0=0x0,_0x58224a=_0x33a6ee['length'];_0x579bf0<_0x58224a,_0x3ff8e3===![];_0x579bf0+=0x1){if(_0x42ccfd[_0xf030('0x16')](_0x33a6ee[_0x579bf0])>=0x0){_0x3ff8e3=!![];}}if(!_0x3ff8e3){throw new Error(util['format'](_0xf030('0x17'),_0x1517fa[_0xf030('0x13')]['pid']));}process[_0xf030('0x18')](_0x1517fa['params']['pid'],_0xf030('0x19'));return _0xe20506[_0xf030('0xe')](0xc8)[_0xf030('0xf')]({'message':util[_0xf030('0x1a')](_0xf030('0x1b'),_0x1517fa[_0xf030('0x13')][_0xf030('0x14')])});})[_0xf030('0x1c')](handleError(_0xe20506,null,_0xf030('0x10')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 177fe76..5792f8a 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 _0x95c9=['exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x95c9,0x1e7));var _0x995c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x95c9[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x995c('0x0'));var timeout=require('connect-timeout');var express=require(_0x995c('0x1'));var router=express['Router']();var fs_extra=require(_0x995c('0x2'));var auth=require(_0x995c('0x3'));var interaction=require(_0x995c('0x4'));var config=require(_0x995c('0x5'));var controller=require(_0x995c('0x6'));router[_0x995c('0x7')]('/',auth[_0x995c('0x8')](),controller[_0x995c('0x9')]);router['get'](_0x995c('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x995c('0xb')]('/',auth[_0x995c('0x8')](),controller[_0x995c('0xc')]);router[_0x995c('0xd')](_0x995c('0xa'),auth[_0x995c('0x8')](),controller[_0x995c('0xe')]);router[_0x995c('0xf')](_0x995c('0xa'),auth[_0x995c('0x8')](),controller[_0x995c('0x10')]);module[_0x995c('0x11')]=router; \ No newline at end of file +var _0xc645=['/:id','post','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x17b4bc,_0x28a6f3){var _0x2207a2=function(_0x23f5ea){while(--_0x23f5ea){_0x17b4bc['push'](_0x17b4bc['shift']());}};_0x2207a2(++_0x28a6f3);}(_0xc645,0xb6));var _0x5c64=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc645[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0x5c64('0x0'));var util=require(_0x5c64('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5c64('0x2'));var router=express[_0x5c64('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5c64('0x4'));var interaction=require(_0x5c64('0x5'));var config=require(_0x5c64('0x6'));var controller=require('./tag.controller');router['get']('/',auth[_0x5c64('0x7')](),controller[_0x5c64('0x8')]);router[_0x5c64('0x9')](_0x5c64('0xa'),auth[_0x5c64('0x7')](),controller['show']);router[_0x5c64('0xb')]('/',auth[_0x5c64('0x7')](),controller['create']);router[_0x5c64('0xc')](_0x5c64('0xa'),auth['isAuthenticated'](),controller[_0x5c64('0xd')]);router['delete'](_0x5c64('0xa'),auth[_0x5c64('0x7')](),controller[_0x5c64('0xe')]);module[_0x5c64('0xf')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index abe5904..f57a074 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 _0x5106=['STRING','#0091EA','sequelize'];(function(_0xcc0e50,_0x4093fc){var _0x5a17ff=function(_0xa177b5){while(--_0xa177b5){_0xcc0e50['push'](_0xcc0e50['shift']());}};_0x5a17ff(++_0x4093fc);}(_0x5106,0x116));var _0x6510=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5106[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x6510('0x0'));module['exports']={'name':{'type':Sequelize[_0x6510('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x6510('0x1')],'defaultValue':_0x6510('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7035=['name','#0091EA','sequelize','STRING'];(function(_0x83fb35,_0x3345f1){var _0x390907=function(_0x50519e){while(--_0x50519e){_0x83fb35['push'](_0x83fb35['shift']());}};_0x390907(++_0x3345f1);}(_0x7035,0x15e));var _0x5703=function(_0xc0b049,_0x353b53){_0xc0b049=_0xc0b049-0x0;var _0xac630b=_0x7035[_0xc0b049];return _0xac630b;};'use strict';var Sequelize=require(_0x5703('0x0'));module['exports']={'name':{'type':Sequelize[_0x5703('0x1')],'unique':_0x5703('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x5703('0x3')},'description':{'type':Sequelize[_0x5703('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 0b3029c..9d93cd7 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 _0x70e0=['../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','Tags','sendStatus','error','stack','name','send','index','map','Tag','rawAttributes','query','keys','intersection','model','fields','length','attributes','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','params','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x70e0,0x17b));var _0x070e=function(_0x263b9e,_0x43c80f){_0x263b9e=_0x263b9e-0x0;var _0x55ed11=_0x70e0[_0x263b9e];return _0x55ed11;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){var _0x270061=_0x164cdf[_0x070e('0x24')]({'plain':!![]});var _0x503f4d=_0x070e('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x503f4d,'resourceId':_0x270061['id']}})[_0x070e('0x23')](function(){return _0x164cdf;});})[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x4763c6,_0x497f58){return function(_0x374c54){if(!_0x374c54){_0x4763c6[_0x070e('0x26')](0x194);}return _0x374c54;};}function handleError(_0x1d72d6,_0x1d2a34){_0x1d2a34=_0x1d2a34||0x1f4;return function(_0x43dd96){logger[_0x070e('0x27')](_0x43dd96[_0x070e('0x28')]);if(_0x43dd96[_0x070e('0x29')]){delete _0x43dd96['name'];}_0x1d72d6[_0x070e('0x19')](_0x1d2a34)[_0x070e('0x2a')](_0x43dd96);};}exports[_0x070e('0x2b')]=function(_0x56fc12,_0x5c5f0d){var _0x13097f={},_0x46065c={},_0xa6c0ab={'count':0x0,'rows':[]};var _0x51402c=_[_0x070e('0x2c')](db[_0x070e('0x2d')][_0x070e('0x2e')],function(_0x5f2bee){return{'name':_0x5f2bee['fieldName'],'type':_0x5f2bee['type']['key']};});_0x46065c['model']=_[_0x070e('0x2c')](_0x51402c,'name');_0x46065c[_0x070e('0x2f')]=_[_0x070e('0x30')](_0x56fc12['query']);_0x46065c['filters']=_[_0x070e('0x31')](_0x46065c[_0x070e('0x32')],_0x46065c['query']);_0x13097f['attributes']=_[_0x070e('0x31')](_0x46065c[_0x070e('0x32')],qs[_0x070e('0x33')](_0x56fc12[_0x070e('0x2f')][_0x070e('0x33')]));_0x13097f['attributes']=_0x13097f['attributes'][_0x070e('0x34')]?_0x13097f[_0x070e('0x35')]:_0x46065c[_0x070e('0x32')];if(!_0x56fc12[_0x070e('0x2f')][_0x070e('0x36')]('nolimit')){_0x13097f[_0x070e('0x1e')]=qs[_0x070e('0x1e')](_0x56fc12['query'][_0x070e('0x1e')]);_0x13097f[_0x070e('0x1b')]=qs['offset'](_0x56fc12['query']['offset']);}_0x13097f[_0x070e('0x37')]=qs[_0x070e('0x38')](_0x56fc12[_0x070e('0x2f')][_0x070e('0x38')]);_0x13097f[_0x070e('0x39')]=qs['filters'](_[_0x070e('0x3a')](_0x56fc12[_0x070e('0x2f')],_0x46065c[_0x070e('0x3b')]),_0x51402c);if(_0x56fc12['query'][_0x070e('0x3c')]){_0x13097f[_0x070e('0x39')]=_[_0x070e('0x3d')](_0x13097f['where'],{'$or':_[_0x070e('0x2c')](_0x51402c,function(_0x348092){if(_0x348092['type']!==_0x070e('0x3e')){var _0x5d689b={};_0x5d689b[_0x348092[_0x070e('0x29')]]={'$like':'%'+_0x56fc12[_0x070e('0x2f')][_0x070e('0x3c')]+'%'};return _0x5d689b;}})});}_0x13097f=_[_0x070e('0x3d')]({},_0x13097f,_0x56fc12[_0x070e('0x3f')]);var _0x47b929={'where':_0x13097f[_0x070e('0x39')]};return db['Tag']['count'](_0x47b929)[_0x070e('0x23')](function(_0x42c448){_0xa6c0ab[_0x070e('0x1d')]=_0x42c448;if(_0x56fc12['query'][_0x070e('0x40')]){_0x13097f[_0x070e('0x41')]=[{'all':!![]}];}return db[_0x070e('0x2d')][_0x070e('0x42')](_0x13097f);})['then'](function(_0x13e4e0){_0xa6c0ab['rows']=_0x13e4e0;return _0xa6c0ab;})['then'](respondWithFilteredResult(_0x5c5f0d,_0x13097f))['catch'](handleError(_0x5c5f0d,null));};exports[_0x070e('0x43')]=function(_0x926533,_0x26b3e2){var _0x29dccd={'raw':!![],'where':{'id':_0x926533['params']['id']}},_0x34f23e={};_0x34f23e[_0x070e('0x32')]=_['keys'](db[_0x070e('0x2d')][_0x070e('0x2e')]);_0x34f23e[_0x070e('0x2f')]=_['keys'](_0x926533['query']);_0x34f23e[_0x070e('0x3b')]=_['intersection'](_0x34f23e[_0x070e('0x32')],_0x34f23e[_0x070e('0x2f')]);_0x29dccd[_0x070e('0x35')]=_['intersection'](_0x34f23e[_0x070e('0x32')],qs[_0x070e('0x33')](_0x926533['query']['fields']));_0x29dccd[_0x070e('0x35')]=_0x29dccd[_0x070e('0x35')][_0x070e('0x34')]?_0x29dccd[_0x070e('0x35')]:_0x34f23e[_0x070e('0x32')];if(_0x926533['query'][_0x070e('0x40')]){_0x29dccd[_0x070e('0x41')]=[{'all':!![]}];}_0x29dccd=_[_0x070e('0x3d')]({},_0x29dccd,_0x926533[_0x070e('0x3f')]);return db[_0x070e('0x2d')][_0x070e('0x44')](_0x29dccd)[_0x070e('0x23')](handleEntityNotFound(_0x26b3e2,null))[_0x070e('0x23')](respondWithResult(_0x26b3e2,null))[_0x070e('0x45')](handleError(_0x26b3e2,null));};exports[_0x070e('0x46')]=function(_0x210c4d,_0x3be553){return db[_0x070e('0x2d')][_0x070e('0x46')](_0x210c4d[_0x070e('0x47')],{})['then'](function(_0x171621){var _0xa7a41b=_0x210c4d[_0x070e('0x48')][_0x070e('0x24')]({'plain':!![]});if(!_0xa7a41b)throw new Error(_0x070e('0x49'));if(_0xa7a41b[_0x070e('0x4a')]===_0x070e('0x48')){var _0x35dbaf=_0x171621[_0x070e('0x24')]({'plain':!![]});var _0x5744c5=_0x070e('0x25');return db['UserProfileSection'][_0x070e('0x44')]({'where':{'name':_0x5744c5,'userProfileId':_0xa7a41b[_0x070e('0x4b')]},'raw':!![]})['then'](function(_0x991d23){if(_0x991d23&&_0x991d23[_0x070e('0x4c')]===0x0){return db[_0x070e('0x4d')][_0x070e('0x46')]({'name':_0x35dbaf[_0x070e('0x29')],'resourceId':_0x35dbaf['id'],'type':_0x991d23[_0x070e('0x29')],'sectionId':_0x991d23['id']},{})[_0x070e('0x23')](function(){return _0x171621;});}else{return _0x171621;}})['catch'](function(_0x296978){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x296978);throw _0x296978;});}return _0x171621;})[_0x070e('0x23')](respondWithResult(_0x3be553,0xc9))[_0x070e('0x45')](handleError(_0x3be553,null));};exports[_0x070e('0x22')]=function(_0x149375,_0x202015){if(_0x149375[_0x070e('0x47')]['id']){delete _0x149375[_0x070e('0x47')]['id'];}return db[_0x070e('0x2d')]['find']({'where':{'id':_0x149375[_0x070e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x202015,null))['then'](saveUpdates(_0x149375[_0x070e('0x47')],null))[_0x070e('0x23')](respondWithResult(_0x202015,null))['catch'](handleError(_0x202015,null));};exports[_0x070e('0x4f')]=function(_0x1e6784,_0x210f4a){return db[_0x070e('0x2d')][_0x070e('0x44')]({'where':{'id':_0x1e6784[_0x070e('0x4e')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x210f4a,null))['then'](removeEntity(_0x210f4a,null))['catch'](handleError(_0x210f4a,null));}; \ No newline at end of file +var _0x2504=['update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','merge','VIRTUAL','filter','findAll','catch','show','params','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x2504,0xee));var _0x4250=function(_0x770794,_0x52ce3c){_0x770794=_0x770794-0x0;var _0x2825a1=_0x2504[_0x770794];return _0x2825a1;};'use strict';var emlformat=require(_0x4250('0x0'));var rimraf=require(_0x4250('0x1'));var zipdir=require(_0x4250('0x2'));var jsonpatch=require(_0x4250('0x3'));var rp=require(_0x4250('0x4'));var moment=require(_0x4250('0x5'));var BPromise=require(_0x4250('0x6'));var Mustache=require(_0x4250('0x7'));var util=require(_0x4250('0x8'));var path=require(_0x4250('0x9'));var sox=require(_0x4250('0xa'));var csv=require(_0x4250('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4250('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4250('0xd'));var jsforce=require(_0x4250('0xe'));var deskjs=require(_0x4250('0xf'));var toCsv=require(_0x4250('0xb'));var querystring=require(_0x4250('0x10'));var Papa=require('papaparse');var Redis=require(_0x4250('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4250('0x12'));var as=require(_0x4250('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4250('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4250('0x15'));var licenseUtil=require(_0x4250('0x16'));var db=require(_0x4250('0x17'))['db'];function respondWithStatusCode(_0x3c1e7e,_0x2a496b){_0x2a496b=_0x2a496b||0xcc;return function(_0x5d62a0){if(_0x5d62a0){return _0x3c1e7e[_0x4250('0x18')](_0x2a496b);}return _0x3c1e7e[_0x4250('0x19')](_0x2a496b)[_0x4250('0x1a')]();};}function respondWithResult(_0x2c8a75,_0xfa4d8a){_0xfa4d8a=_0xfa4d8a||0xc8;return function(_0x33f317){if(_0x33f317){return _0x2c8a75['status'](_0xfa4d8a)[_0x4250('0x1b')](_0x33f317);}};}function respondWithFilteredResult(_0x46ba15,_0x1b0c66){return function(_0x3cff02){if(_0x3cff02){var _0x2979cd=typeof _0x1b0c66[_0x4250('0x1c')]===_0x4250('0x1d')&&typeof _0x1b0c66['limit']===_0x4250('0x1d');var _0x35d232=_0x3cff02[_0x4250('0x1e')];var _0x17a8a9=_0x2979cd?0x0:_0x1b0c66[_0x4250('0x1c')];var _0x30e48c=_0x2979cd?_0x3cff02[_0x4250('0x1e')]:_0x1b0c66['offset']+_0x1b0c66[_0x4250('0x1f')];var _0x4f0154;if(_0x30e48c>=_0x35d232){_0x30e48c=_0x35d232;_0x4f0154=0xc8;}else{_0x4f0154=0xce;}_0x46ba15['status'](_0x4f0154);return _0x46ba15[_0x4250('0x20')](_0x4250('0x21'),_0x17a8a9+'-'+_0x30e48c+'/'+_0x35d232)[_0x4250('0x1b')](_0x3cff02);}return null;};}function patchUpdates(_0x42c331){return function(_0x242cf1){try{jsonpatch[_0x4250('0x22')](_0x242cf1,_0x42c331,!![]);}catch(_0x1ba772){return BPromise[_0x4250('0x23')](_0x1ba772);}return _0x242cf1[_0x4250('0x24')]();};}function saveUpdates(_0x3818c0,_0x728862){return function(_0x30e2ae){if(_0x30e2ae){return _0x30e2ae['update'](_0x3818c0)[_0x4250('0x25')](function(_0x171df4){return _0x171df4;});}return null;};}function removeEntity(_0x1feb98,_0x523053){return function(_0x5d1a74){if(_0x5d1a74){return _0x5d1a74[_0x4250('0x26')]()[_0x4250('0x25')](function(){var _0x1c1294=_0x5d1a74[_0x4250('0x27')]({'plain':!![]});var _0x328ffb='Tags';return db[_0x4250('0x28')][_0x4250('0x26')]({'where':{'type':_0x328ffb,'resourceId':_0x1c1294['id']}})[_0x4250('0x25')](function(){return _0x5d1a74;});})['then'](function(){_0x1feb98['status'](0xcc)[_0x4250('0x1a')]();});}};}function handleEntityNotFound(_0x5d0fa2,_0x3e8b4d){return function(_0x1c4fa5){if(!_0x1c4fa5){_0x5d0fa2[_0x4250('0x18')](0x194);}return _0x1c4fa5;};}function handleError(_0x2cdfdf,_0xb82299){_0xb82299=_0xb82299||0x1f4;return function(_0x501c5f){logger[_0x4250('0x29')](_0x501c5f[_0x4250('0x2a')]);if(_0x501c5f['name']){delete _0x501c5f[_0x4250('0x2b')];}_0x2cdfdf['status'](_0xb82299)[_0x4250('0x2c')](_0x501c5f);};}exports['index']=function(_0x5e0fe6,_0xea7ccc){var _0x5f20d5={},_0x16b8a4={},_0x281be9={'count':0x0,'rows':[]};var _0x4bed2b=_[_0x4250('0x2d')](db[_0x4250('0x2e')]['rawAttributes'],function(_0x217188){return{'name':_0x217188[_0x4250('0x2f')],'type':_0x217188['type'][_0x4250('0x30')]};});_0x16b8a4[_0x4250('0x31')]=_[_0x4250('0x2d')](_0x4bed2b,_0x4250('0x2b'));_0x16b8a4[_0x4250('0x32')]=_[_0x4250('0x33')](_0x5e0fe6[_0x4250('0x32')]);_0x16b8a4[_0x4250('0x34')]=_[_0x4250('0x35')](_0x16b8a4[_0x4250('0x31')],_0x16b8a4[_0x4250('0x32')]);_0x5f20d5[_0x4250('0x36')]=_[_0x4250('0x35')](_0x16b8a4['model'],qs[_0x4250('0x37')](_0x5e0fe6['query'][_0x4250('0x37')]));_0x5f20d5[_0x4250('0x36')]=_0x5f20d5['attributes'][_0x4250('0x38')]?_0x5f20d5[_0x4250('0x36')]:_0x16b8a4[_0x4250('0x31')];if(!_0x5e0fe6[_0x4250('0x32')]['hasOwnProperty']('nolimit')){_0x5f20d5['limit']=qs[_0x4250('0x1f')](_0x5e0fe6[_0x4250('0x32')]['limit']);_0x5f20d5[_0x4250('0x1c')]=qs[_0x4250('0x1c')](_0x5e0fe6[_0x4250('0x32')][_0x4250('0x1c')]);}_0x5f20d5[_0x4250('0x39')]=qs['sort'](_0x5e0fe6[_0x4250('0x32')]['sort']);_0x5f20d5['where']=qs[_0x4250('0x34')](_['pick'](_0x5e0fe6[_0x4250('0x32')],_0x16b8a4[_0x4250('0x34')]),_0x4bed2b);if(_0x5e0fe6[_0x4250('0x32')]['filter']){_0x5f20d5[_0x4250('0x3a')]=_[_0x4250('0x3b')](_0x5f20d5[_0x4250('0x3a')],{'$or':_[_0x4250('0x2d')](_0x4bed2b,function(_0x3bcdbf){if(_0x3bcdbf['type']!==_0x4250('0x3c')){var _0x1d8459={};_0x1d8459[_0x3bcdbf[_0x4250('0x2b')]]={'$like':'%'+_0x5e0fe6[_0x4250('0x32')][_0x4250('0x3d')]+'%'};return _0x1d8459;}})});}_0x5f20d5=_[_0x4250('0x3b')]({},_0x5f20d5,_0x5e0fe6['options']);var _0x3a340a={'where':_0x5f20d5['where']};return db[_0x4250('0x2e')][_0x4250('0x1e')](_0x3a340a)[_0x4250('0x25')](function(_0x2a10b9){_0x281be9[_0x4250('0x1e')]=_0x2a10b9;if(_0x5e0fe6[_0x4250('0x32')]['includeAll']){_0x5f20d5['include']=[{'all':!![]}];}return db['Tag'][_0x4250('0x3e')](_0x5f20d5);})[_0x4250('0x25')](function(_0x2e4a22){_0x281be9['rows']=_0x2e4a22;return _0x281be9;})[_0x4250('0x25')](respondWithFilteredResult(_0xea7ccc,_0x5f20d5))[_0x4250('0x3f')](handleError(_0xea7ccc,null));};exports[_0x4250('0x40')]=function(_0x53fb93,_0x100727){var _0x307d2c={'raw':!![],'where':{'id':_0x53fb93[_0x4250('0x41')]['id']}},_0x366cb7={};_0x366cb7['model']=_['keys'](db[_0x4250('0x2e')][_0x4250('0x42')]);_0x366cb7[_0x4250('0x32')]=_[_0x4250('0x33')](_0x53fb93[_0x4250('0x32')]);_0x366cb7['filters']=_[_0x4250('0x35')](_0x366cb7['model'],_0x366cb7[_0x4250('0x32')]);_0x307d2c[_0x4250('0x36')]=_[_0x4250('0x35')](_0x366cb7['model'],qs[_0x4250('0x37')](_0x53fb93[_0x4250('0x32')][_0x4250('0x37')]));_0x307d2c['attributes']=_0x307d2c['attributes']['length']?_0x307d2c[_0x4250('0x36')]:_0x366cb7[_0x4250('0x31')];if(_0x53fb93[_0x4250('0x32')][_0x4250('0x43')]){_0x307d2c[_0x4250('0x44')]=[{'all':!![]}];}_0x307d2c=_[_0x4250('0x3b')]({},_0x307d2c,_0x53fb93['options']);return db[_0x4250('0x2e')][_0x4250('0x45')](_0x307d2c)[_0x4250('0x25')](handleEntityNotFound(_0x100727,null))['then'](respondWithResult(_0x100727,null))[_0x4250('0x3f')](handleError(_0x100727,null));};exports['create']=function(_0x5895ea,_0x2e0d9d){return db[_0x4250('0x2e')][_0x4250('0x46')](_0x5895ea[_0x4250('0x47')],{})[_0x4250('0x25')](function(_0x34d672){var _0x59d51a=_0x5895ea[_0x4250('0x48')]['get']({'plain':!![]});if(!_0x59d51a)throw new Error(_0x4250('0x49'));if(_0x59d51a[_0x4250('0x4a')]===_0x4250('0x48')){var _0x544048=_0x34d672[_0x4250('0x27')]({'plain':!![]});var _0x440aa4='Tags';return db['UserProfileSection']['find']({'where':{'name':_0x440aa4,'userProfileId':_0x59d51a[_0x4250('0x4b')]},'raw':!![]})['then'](function(_0x4e3158){if(_0x4e3158&&_0x4e3158[_0x4250('0x4c')]===0x0){return db[_0x4250('0x28')][_0x4250('0x46')]({'name':_0x544048[_0x4250('0x2b')],'resourceId':_0x544048['id'],'type':_0x4e3158[_0x4250('0x2b')],'sectionId':_0x4e3158['id']},{})['then'](function(){return _0x34d672;});}else{return _0x34d672;}})[_0x4250('0x3f')](function(_0xb82981){logger[_0x4250('0x29')](_0x4250('0x4d'),_0xb82981);throw _0xb82981;});}return _0x34d672;})['then'](respondWithResult(_0x2e0d9d,0xc9))[_0x4250('0x3f')](handleError(_0x2e0d9d,null));};exports[_0x4250('0x4e')]=function(_0x59efc0,_0xc7ba0){if(_0x59efc0[_0x4250('0x47')]['id']){delete _0x59efc0['body']['id'];}return db[_0x4250('0x2e')][_0x4250('0x45')]({'where':{'id':_0x59efc0[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0xc7ba0,null))[_0x4250('0x25')](saveUpdates(_0x59efc0[_0x4250('0x47')],null))[_0x4250('0x25')](respondWithResult(_0xc7ba0,null))['catch'](handleError(_0xc7ba0,null));};exports[_0x4250('0x26')]=function(_0x39e9f5,_0x6094fb){return db['Tag']['find']({'where':{'id':_0x39e9f5[_0x4250('0x41')]['id']}})[_0x4250('0x25')](handleEntityNotFound(_0x6094fb,null))['then'](removeEntity(_0x6094fb,null))[_0x4250('0x3f')](handleError(_0x6094fb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 72fe67c..6bc491e 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 _0x8801=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0x8801,0x116));var _0x1880=function(_0x9a5356,_0x7a6f7){_0x9a5356=_0x9a5356-0x0;var _0x2878a5=_0x8801[_0x9a5356];return _0x2878a5;};'use strict';var _=require(_0x1880('0x0'));var util=require(_0x1880('0x1'));var logger=require(_0x1880('0x2'))(_0x1880('0x3'));var moment=require(_0x1880('0x4'));var BPromise=require(_0x1880('0x5'));var rp=require(_0x1880('0x6'));var fs=require('fs');var path=require(_0x1880('0x7'));var rimraf=require(_0x1880('0x8'));var config=require(_0x1880('0x9'));var attributes=require(_0x1880('0xa'));module[_0x1880('0xb')]=function(_0x51fa51,_0x25cbe3){return _0x51fa51['define'](_0x1880('0xc'),attributes,{'tableName':_0x1880('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8828=['path','rimraf','./tag.attributes','exports','Tag','lodash','util','moment','bluebird','request-promise'];(function(_0x24fca5,_0xe3f784){var _0x265362=function(_0x5e4027){while(--_0x5e4027){_0x24fca5['push'](_0x24fca5['shift']());}};_0x265362(++_0xe3f784);}(_0x8828,0x1d1));var _0x8882=function(_0x325000,_0x5cf4e0){_0x325000=_0x325000-0x0;var _0x4053b1=_0x8828[_0x325000];return _0x4053b1;};'use strict';var _=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8882('0x2'));var BPromise=require(_0x8882('0x3'));var rp=require(_0x8882('0x4'));var fs=require('fs');var path=require(_0x8882('0x5'));var rimraf=require(_0x8882('0x6'));var config=require('../../config/environment');var attributes=require(_0x8882('0x7'));module[_0x8882('0x8')]=function(_0x4ab43c,_0x1f78ad){return _0x4ab43c['define'](_0x8882('0x9'),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 ed4cbd0..de4b3db 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 _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0xe05e60,_0x19be53){var _0x3317c1=function(_0x2f28d3){while(--_0x2f28d3){_0xe05e60['push'](_0xe05e60['shift']());}};_0x3317c1(++_0x19be53);}(_0x55ca,0x126));var _0xa55c=function(_0x354bd6,_0x4a7c74){_0x354bd6=_0x354bd6-0x0;var _0x39bf52=_0x55ca[_0x354bd6];return _0x39bf52;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('Tag,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('Tag,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});} \ No newline at end of file +var _0x0bde=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xb0acd8,_0x4cac86){var _0x491d41=function(_0x13e79a){while(--_0x13e79a){_0xb0acd8['push'](_0xb0acd8['shift']());}};_0x491d41(++_0x4cac86);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0bd('0x0'));var util=require('util');var moment=require(_0xe0bd('0x1'));var BPromise=require(_0xe0bd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0bd('0x3'));var db=require(_0xe0bd('0x4'))['db'];var utils=require(_0xe0bd('0x5'));var logger=require('../../config/logger')(_0xe0bd('0x6'));var config=require(_0xe0bd('0x7'));var jayson=require(_0xe0bd('0x8'));var client=jayson[_0xe0bd('0x9')][_0xe0bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8892,_0x29faee,_0x1b75c1){return new BPromise(function(_0xf790d6,_0x54d27f){return client[_0xe0bd('0xb')](_0x1c8892,_0x1b75c1)[_0xe0bd('0xc')](function(_0x12a5f1){logger['info'](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));logger['debug'](_0xe0bd('0xf'),_0x29faee,'request\x20sent',JSON[_0xe0bd('0x10')](_0x12a5f1));if(_0x12a5f1[_0xe0bd('0x11')]){if(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x12')]===0x1f4){logger[_0xe0bd('0x11')](_0xe0bd('0xd'),_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0x54d27f(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}logger[_0xe0bd('0x11')]('Tag,\x20%s,\x20%s',_0x29faee,_0x12a5f1[_0xe0bd('0x11')]['message']);return _0xf790d6(_0x12a5f1[_0xe0bd('0x11')][_0xe0bd('0x13')]);}else{logger[_0xe0bd('0x14')](_0xe0bd('0xd'),_0x29faee,_0xe0bd('0xe'));_0xf790d6(_0x12a5f1[_0xe0bd('0x15')][_0xe0bd('0x13')]);}})[_0xe0bd('0x16')](function(_0x4ea791){logger['error'](_0xe0bd('0xd'),_0x29faee,_0x4ea791);_0x54d27f(_0x4ea791);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 06b728c..f3c8221 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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 c5d3df6..6e25ef0 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x146edb,_0x48e582){var _0x5f5c2e=function(_0x364ddb){while(--_0x364ddb){_0x146edb['push'](_0x146edb['shift']());}};_0x5f5c2e(++_0x48e582);}(_0xb10b,0x12a));var _0xbb10=function(_0x32a81f,_0x4eee66){_0x32a81f=_0x32a81f-0x0;var _0x5b67a2=_0xb10b[_0x32a81f];return _0x5b67a2;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x23decd,_0x54da15){var _0x6d5bf3=function(_0x2e0594){while(--_0x2e0594){_0x23decd['push'](_0x23decd['shift']());}};_0x6d5bf3(++_0x54da15);}(_0x757a,0xde));var _0xa757=function(_0x53b106,_0x3c03da){_0x53b106=_0x53b106-0x0;var _0x12130b=_0x757a[_0x53b106];return _0x12130b;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 8bd1bee..234799a 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 _0x32d7=['SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','ValidationError','Queues','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','User','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','TeamVoiceQueue','all','spread','removeAgents','Fax','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','stack','name','send','Team','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','find','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes'];(function(_0x163b57,_0xdf2a18){var _0x1f1007=function(_0x2da718){while(--_0x2da718){_0x163b57['push'](_0x163b57['shift']());}};_0x1f1007(++_0xdf2a18);}(_0x32d7,0xd2));var _0x732d=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0x32d7[_0x12e073];return _0x267748;};'use strict';var emlformat=require(_0x732d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x732d('0x1'));var jsonpatch=require(_0x732d('0x2'));var rp=require(_0x732d('0x3'));var moment=require(_0x732d('0x4'));var BPromise=require(_0x732d('0x5'));var Mustache=require(_0x732d('0x6'));var util=require(_0x732d('0x7'));var path=require(_0x732d('0x8'));var sox=require('sox');var csv=require(_0x732d('0x9'));var ejs=require(_0x732d('0xa'));var fs=require('fs');var fs_extra=require(_0x732d('0xb'));var _=require(_0x732d('0xc'));var squel=require(_0x732d('0xd'));var crypto=require(_0x732d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x732d('0xf'));var toCsv=require(_0x732d('0x9'));var querystring=require(_0x732d('0x10'));var Papa=require(_0x732d('0x11'));var Redis=require('ioredis');var authService=require(_0x732d('0x12'));var qs=require(_0x732d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x732d('0x14'));var logger=require('../../config/logger')(_0x732d('0x15'));var utils=require('../../config/utils');var config=require(_0x732d('0x16'));var licenseUtil=require(_0x732d('0x17'));var db=require(_0x732d('0x18'))['db'];config['redis']=_[_0x732d('0x19')](config['redis'],{'host':_0x732d('0x1a'),'port':0x18eb});var socket=require(_0x732d('0x1b'))(new Redis(config['redis']));require(_0x732d('0x1c'))[_0x732d('0x1d')](socket);function respondWithStatusCode(_0x19e9d3,_0x27a0e1){_0x27a0e1=_0x27a0e1||0xcc;return function(_0x989972){if(_0x989972){return _0x19e9d3[_0x732d('0x1e')](_0x27a0e1);}return _0x19e9d3[_0x732d('0x1f')](_0x27a0e1)[_0x732d('0x20')]();};}function respondWithResult(_0xee7e94,_0x239c07){_0x239c07=_0x239c07||0xc8;return function(_0x5d1ef6){if(_0x5d1ef6){return _0xee7e94[_0x732d('0x1f')](_0x239c07)['json'](_0x5d1ef6);}};}function respondWithFilteredResult(_0x4d328c,_0x2343f4){return function(_0x26c65c){if(_0x26c65c){var _0x1fe5c2=typeof _0x2343f4[_0x732d('0x21')]===_0x732d('0x22')&&typeof _0x2343f4[_0x732d('0x23')]===_0x732d('0x22');var _0x5144bd=_0x26c65c[_0x732d('0x24')];var _0x4f890b=_0x1fe5c2?0x0:_0x2343f4[_0x732d('0x21')];var _0x28e554=_0x1fe5c2?_0x26c65c[_0x732d('0x24')]:_0x2343f4[_0x732d('0x21')]+_0x2343f4['limit'];var _0x47dec9;if(_0x28e554>=_0x5144bd){_0x28e554=_0x5144bd;_0x47dec9=0xc8;}else{_0x47dec9=0xce;}_0x4d328c[_0x732d('0x1f')](_0x47dec9);return _0x4d328c[_0x732d('0x25')](_0x732d('0x26'),_0x4f890b+'-'+_0x28e554+'/'+_0x5144bd)[_0x732d('0x27')](_0x26c65c);}return null;};}function patchUpdates(_0x2cd7a2){return function(_0x4032cc){try{jsonpatch[_0x732d('0x28')](_0x4032cc,_0x2cd7a2,!![]);}catch(_0x37ab0d){return BPromise['reject'](_0x37ab0d);}return _0x4032cc['save']();};}function saveUpdates(_0x167fd2,_0x1245b2){return function(_0x1b1d56){if(_0x1b1d56){return _0x1b1d56[_0x732d('0x29')](_0x167fd2)[_0x732d('0x2a')](function(_0xd574b9){return _0xd574b9;});}return null;};}function handleEntityNotFound(_0x23e5fb,_0x1d5ca6){return function(_0x41ec6a){if(!_0x41ec6a){_0x23e5fb[_0x732d('0x1e')](0x194);}return _0x41ec6a;};}function handleError(_0x311013,_0x51af4a){_0x51af4a=_0x51af4a||0x1f4;return function(_0x16a07a){logger['error'](_0x16a07a[_0x732d('0x2b')]);if(_0x16a07a[_0x732d('0x2c')]){delete _0x16a07a['name'];}_0x311013[_0x732d('0x1f')](_0x51af4a)[_0x732d('0x2d')](_0x16a07a);};}exports['index']=function(_0x22cfec,_0x214a22){var _0x4a2f5f={},_0x50abcb={},_0x4a3dca={'count':0x0,'rows':[]};var _0x49dedb=_['map'](db[_0x732d('0x2e')][_0x732d('0x2f')],function(_0x31ab6d){return{'name':_0x31ab6d[_0x732d('0x30')],'type':_0x31ab6d[_0x732d('0x31')][_0x732d('0x32')]};});_0x50abcb[_0x732d('0x33')]=_['map'](_0x49dedb,_0x732d('0x2c'));_0x50abcb['query']=_[_0x732d('0x34')](_0x22cfec[_0x732d('0x35')]);_0x50abcb[_0x732d('0x36')]=_[_0x732d('0x37')](_0x50abcb[_0x732d('0x33')],_0x50abcb[_0x732d('0x35')]);_0x4a2f5f[_0x732d('0x38')]=_['intersection'](_0x50abcb['model'],qs[_0x732d('0x39')](_0x22cfec['query']['fields']));_0x4a2f5f['attributes']=_0x4a2f5f[_0x732d('0x38')][_0x732d('0x3a')]?_0x4a2f5f['attributes']:_0x50abcb[_0x732d('0x33')];if(!_0x22cfec[_0x732d('0x35')][_0x732d('0x3b')]('nolimit')){_0x4a2f5f['limit']=qs[_0x732d('0x23')](_0x22cfec[_0x732d('0x35')][_0x732d('0x23')]);_0x4a2f5f[_0x732d('0x21')]=qs[_0x732d('0x21')](_0x22cfec[_0x732d('0x35')][_0x732d('0x21')]);}_0x4a2f5f[_0x732d('0x3c')]=qs[_0x732d('0x3d')](_0x22cfec[_0x732d('0x35')]['sort']);_0x4a2f5f[_0x732d('0x3e')]=qs['filters'](_[_0x732d('0x3f')](_0x22cfec[_0x732d('0x35')],_0x50abcb['filters']),_0x49dedb);if(_0x22cfec[_0x732d('0x35')][_0x732d('0x40')]){_0x4a2f5f['where']=_[_0x732d('0x41')](_0x4a2f5f[_0x732d('0x3e')],{'$or':_[_0x732d('0x42')](_0x49dedb,function(_0x44bcaa){if(_0x44bcaa[_0x732d('0x31')]!==_0x732d('0x43')){var _0x3da5a5={};_0x3da5a5[_0x44bcaa[_0x732d('0x2c')]]={'$like':'%'+_0x22cfec[_0x732d('0x35')][_0x732d('0x40')]+'%'};return _0x3da5a5;}})});}_0x4a2f5f=_['merge']({},_0x4a2f5f,_0x22cfec[_0x732d('0x44')]);var _0x17fa3e={'where':_0x4a2f5f[_0x732d('0x3e')]};return db['Team'][_0x732d('0x24')](_0x17fa3e)[_0x732d('0x2a')](function(_0x3f40e2){_0x4a3dca[_0x732d('0x24')]=_0x3f40e2;if(_0x22cfec[_0x732d('0x35')]['includeAll']){_0x4a2f5f['include']=[{'all':!![]}];}return db['Team'][_0x732d('0x45')](_0x4a2f5f);})['then'](function(_0x1f94c7){_0x4a3dca[_0x732d('0x46')]=_0x1f94c7;return _0x4a3dca;})[_0x732d('0x2a')](respondWithFilteredResult(_0x214a22,_0x4a2f5f))[_0x732d('0x47')](handleError(_0x214a22,null));};exports[_0x732d('0x48')]=function(_0x573972,_0x26df5d){var _0x1bbff8={'raw':![],'where':{'id':_0x573972[_0x732d('0x49')]['id']}},_0x154b1f={};_0x154b1f[_0x732d('0x33')]=_[_0x732d('0x34')](db[_0x732d('0x2e')][_0x732d('0x2f')]);_0x154b1f[_0x732d('0x35')]=_[_0x732d('0x34')](_0x573972[_0x732d('0x35')]);_0x154b1f[_0x732d('0x36')]=_[_0x732d('0x37')](_0x154b1f[_0x732d('0x33')],_0x154b1f[_0x732d('0x35')]);_0x1bbff8['attributes']=_[_0x732d('0x37')](_0x154b1f[_0x732d('0x33')],qs[_0x732d('0x39')](_0x573972['query'][_0x732d('0x39')]));_0x1bbff8[_0x732d('0x38')]=_0x1bbff8['attributes']['length']?_0x1bbff8[_0x732d('0x38')]:_0x154b1f[_0x732d('0x33')];if(_0x573972[_0x732d('0x35')][_0x732d('0x4a')]){_0x1bbff8['include']=[{'all':!![]}];}_0x1bbff8=_[_0x732d('0x41')]({},_0x1bbff8,_0x573972[_0x732d('0x44')]);return db['Team'][_0x732d('0x4b')](_0x1bbff8)[_0x732d('0x2a')](handleEntityNotFound(_0x26df5d,null))[_0x732d('0x2a')](respondWithResult(_0x26df5d,null))[_0x732d('0x47')](handleError(_0x26df5d,null));};exports[_0x732d('0x4c')]=function(_0x23babc,_0x2b591b){return db[_0x732d('0x2e')][_0x732d('0x4c')](_0x23babc[_0x732d('0x4d')],{})[_0x732d('0x2a')](function(_0x455208){var _0xcff3cf=_0x23babc['user'][_0x732d('0x4e')]({'plain':!![]});if(!_0xcff3cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcff3cf[_0x732d('0x4f')]===_0x732d('0x50')){var _0x430a2e=_0x455208[_0x732d('0x4e')]({'plain':!![]});var _0x3553c0=_0x732d('0x51');return db[_0x732d('0x52')][_0x732d('0x4b')]({'where':{'name':_0x3553c0,'userProfileId':_0xcff3cf[_0x732d('0x53')]},'raw':!![]})[_0x732d('0x2a')](function(_0x3220b3){if(_0x3220b3&&_0x3220b3[_0x732d('0x54')]===0x0){return db[_0x732d('0x55')][_0x732d('0x4c')]({'name':_0x430a2e['name'],'resourceId':_0x430a2e['id'],'type':_0x3220b3['name'],'sectionId':_0x3220b3['id']},{})[_0x732d('0x2a')](function(){return _0x455208;});}else{return _0x455208;}})[_0x732d('0x47')](function(_0x1d7cd1){logger[_0x732d('0x56')](_0x732d('0x57'),_0x1d7cd1);throw _0x1d7cd1;});}return _0x455208;})[_0x732d('0x2a')](respondWithResult(_0x2b591b,0xc9))['catch'](handleError(_0x2b591b,null));};exports['update']=function(_0x145759,_0x1ca9c5){if(_0x145759[_0x732d('0x4d')]['id']){delete _0x145759['body']['id'];}return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0x145759['params']['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x1ca9c5,null))[_0x732d('0x2a')](saveUpdates(_0x145759[_0x732d('0x4d')],null))[_0x732d('0x2a')](respondWithResult(_0x1ca9c5,null))[_0x732d('0x47')](handleError(_0x1ca9c5,null));};exports[_0x732d('0x58')]=function(_0x526db2,_0x2e3334){var _0x17c344=_0x526db2[_0x732d('0x49')]['id'];var _0x35947d=[];return db['sequelize'][_0x732d('0x59')](function(_0xda306c){var _0x4b85c7=_0x732d('0x5a')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x4b85c7,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c})[_0x732d('0x2a')](function(_0x2a0075){_0x35947d=_['map'](_0x2a0075,function(_0x58d2d9){return Number(_0x58d2d9['UserId']);});})[_0x732d('0x2a')](function(){var _0x59ec67=_0x732d('0x5f')+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x59ec67,{'type':db[_0x732d('0x5c')]['QueryTypes'][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})['then'](function(_0x55f442){var _0x4e6262=_[_0x732d('0x42')](_0x55f442,function(_0x5a9db8){return Number(_0x5a9db8[_0x732d('0x60')]);});return db[_0x732d('0x61')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'VoiceQueueId':{'$in':_0x4e6262}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x5f4527=_0x732d('0x62')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x5f4527,{'type':db['Sequelize'][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})['then'](function(_0x43cf37){var _0x3dfc01=_[_0x732d('0x42')](_0x43cf37,function(_0x325c76){return Number(_0x325c76['MailQueueId']);});return db[_0x732d('0x63')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'MailQueueId':{'$in':_0x3dfc01}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x181d1a=_0x732d('0x64')+_0x17c344;return db['sequelize'][_0x732d('0x35')](_0x181d1a,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x2113cc){var _0x11f5a0=_['map'](_0x2113cc,function(_0x1a2a27){return Number(_0x1a2a27['SmsQueueId']);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x35947d},'SmsQueueId':{'$in':_0x11f5a0}},'transaction':_0xda306c});})['then'](function(){var _0x41d22d='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x41d22d,{'type':db[_0x732d('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x311f2f){var _0x416004=_[_0x732d('0x42')](_0x311f2f,function(_0x20a502){return Number(_0x20a502[_0x732d('0x65')]);});return db[_0x732d('0x66')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'ChatQueueId':{'$in':_0x416004}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x6eef3f=_0x732d('0x67')+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x6eef3f,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x4e9abe){var _0x4a1748=_[_0x732d('0x42')](_0x4e9abe,function(_0x283641){return Number(_0x283641[_0x732d('0x68')]);});return db[_0x732d('0x69')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'FaxQueueId':{'$in':_0x4a1748}},'transaction':_0xda306c});})['then'](function(){var _0x22e4b8=_0x732d('0x6a')+_0x17c344;return db[_0x732d('0x5b')][_0x732d('0x35')](_0x22e4b8,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')]['SELECT'],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x359de8){var _0x44186a=_[_0x732d('0x42')](_0x359de8,function(_0x81da20){return Number(_0x81da20[_0x732d('0x6b')]);});return db['UserOpenchannelQueue'][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'OpenchannelQueueId':{'$in':_0x44186a}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){var _0x3a3fda='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x17c344;return db[_0x732d('0x5b')]['query'](_0x3a3fda,{'type':db[_0x732d('0x5c')][_0x732d('0x5d')][_0x732d('0x5e')],'raw':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x414588){var _0x3c68f4=_['map'](_0x414588,function(_0x1ea0f2){return Number(_0x1ea0f2[_0x732d('0x6c')]);});return db[_0x732d('0x6d')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'WhatsappQueueId':{'$in':_0x3c68f4}},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){return db[_0x732d('0x6e')][_0x732d('0x4b')]({'where':{'TeamId':_0x17c344}});})[_0x732d('0x2a')](function(_0x11b6f6){if(_0x11b6f6===null){return;}return db[_0x732d('0x6f')][_0x732d('0x58')]({'where':{'UserId':{'$in':_0x35947d},'VoicePrefixId':_0x11b6f6[_0x732d('0x70')]},'transaction':_0xda306c});})[_0x732d('0x2a')](function(){return db[_0x732d('0x2e')][_0x732d('0x58')]({'where':{'id':_0x17c344},'cascade':!![],'transaction':_0xda306c});})[_0x732d('0x2a')](function(_0x108fc5){if(_0x108fc5===0x0){_0x2e3334['sendStatus'](0x194);}else{return db[_0x732d('0x55')][_0x732d('0x58')]({'where':{'type':_0x732d('0x51'),'resourceId':_0x17c344},'cascade':!![],'transaction':_0xda306c})['then'](function(){_0x2e3334[_0x732d('0x1f')](0xcc)[_0x732d('0x20')]();});}})['catch'](function(_0x25c227){_0x2e3334[_0x732d('0x1f')](0x1f4)[_0x732d('0x2d')](_0x25c227);});});};exports[_0x732d('0x71')]=function(_0x42fe9d,_0x13a0c4,_0x4d6490){return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x42fe9d['params']['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x13a0c4,null))[_0x732d('0x2a')](function(_0x504694){if(!_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')]||!utils[_0x732d('0x74')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')])){throw new db[(_0x732d('0x5c'))]['ValidationError'](_0x732d('0x75'));}var _0x3fca92={};var _0x426ceb={};_0x426ceb[_0x732d('0x33')]=_[_0x732d('0x34')](db[_[_0x732d('0x76')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x73')][_0x732d('0x77')]())+_0x732d('0x78')][_0x732d('0x2f')]);_0x426ceb[_0x732d('0x35')]=_[_0x732d('0x34')](_0x42fe9d[_0x732d('0x35')]);_0x426ceb[_0x732d('0x36')]=_['intersection'](_0x426ceb[_0x732d('0x33')],_0x426ceb[_0x732d('0x35')]);_0x3fca92[_0x732d('0x38')]=_[_0x732d('0x37')](_0x426ceb[_0x732d('0x33')],qs[_0x732d('0x39')](_0x42fe9d[_0x732d('0x35')][_0x732d('0x39')]));_0x3fca92['attributes']=_0x3fca92['attributes']['length']?_0x3fca92[_0x732d('0x38')]:_0x426ceb[_0x732d('0x33')];_0x3fca92['limit']=qs[_0x732d('0x23')](_0x42fe9d['query'][_0x732d('0x23')]);_0x3fca92[_0x732d('0x21')]=qs['offset'](_0x42fe9d[_0x732d('0x35')][_0x732d('0x21')]);_0x3fca92[_0x732d('0x3c')]=qs['sort'](_0x42fe9d['query']['sort']);_0x3fca92[_0x732d('0x3e')]=qs[_0x732d('0x36')](_[_0x732d('0x3f')](_0x42fe9d[_0x732d('0x35')],_0x426ceb['filters']));_0x3fca92=_[_0x732d('0x41')]({},_0x3fca92,_0x42fe9d['options']);return _0x504694['get'+_[_0x732d('0x76')](_0x42fe9d[_0x732d('0x35')]['channel'][_0x732d('0x77')]())+'Queues'](_0x3fca92);})['then'](respondWithResult(_0x13a0c4,null))[_0x732d('0x47')](handleError(_0x13a0c4,null));};exports[_0x732d('0x79')]=function(_0x1e0819,_0x37605c,_0x21e5e0){return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x1e0819[_0x732d('0x49')]['id']}})[_0x732d('0x2a')](function(_0x3203cc){if(_0x3203cc){if(!_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')]||!utils['isValidChannel'](_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')])){throw new db['Sequelize'][(_0x732d('0x7a'))](_0x732d('0x75'));}return _0x3203cc['add'+_[_0x732d('0x76')](_0x1e0819[_0x732d('0x4d')][_0x732d('0x73')]['toLowerCase']())+_0x732d('0x7b')](_0x1e0819[_0x732d('0x4d')]['ids']);}return null;})[_0x732d('0x2a')](handleEntityNotFound(_0x37605c,null))[_0x732d('0x2a')](respondWithStatusCode(_0x37605c,null))[_0x732d('0x47')](handleError(_0x37605c,null));};exports[_0x732d('0x7c')]=function(_0x18a3ce,_0x4ef338,_0x5c3717){return db['Team'][_0x732d('0x72')]({'where':{'id':_0x18a3ce['params']['id']}})['then'](function(_0x746063){if(_0x746063){if(!_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')]||!utils[_0x732d('0x74')](_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')])){throw new db[(_0x732d('0x5c'))]['ValidationError'](_0x732d('0x75'));}return _0x746063['remove'+_[_0x732d('0x76')](_0x18a3ce[_0x732d('0x35')][_0x732d('0x73')]['toLowerCase']())+'Queues'](_0x18a3ce[_0x732d('0x35')][_0x732d('0x7d')]);}return null;})[_0x732d('0x2a')](handleEntityNotFound(_0x4ef338,null))['then'](respondWithStatusCode(_0x4ef338,null))['catch'](handleError(_0x4ef338,null));};exports[_0x732d('0x7e')]=function(_0x458be5,_0x1e2db6){var _0xecf5c0=_[_0x732d('0x7f')](_0x458be5['body']['ids'])?_0x458be5['body'][_0x732d('0x7d')]:[_0x458be5[_0x732d('0x4d')][_0x732d('0x7d')]];var _0xe4ef2b=_0x458be5[_0x732d('0x49')]['id'];return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0xe4ef2b}})[_0x732d('0x2a')](handleEntityNotFound(_0x1e2db6,null))['then'](function(_0x14f8eb){if(_0x14f8eb){var _0x322690=[_0x732d('0x80'),_0x732d('0x81'),_0x732d('0x82'),_0x732d('0x83'),'Fax',_0x732d('0x84'),_0x732d('0x85')];return db['sequelize'][_0x732d('0x59')](function(_0x1393e7){var _0x507880=_['map'](_0x322690,function(_0x5e5046){var _0x1c9cea={'attributes':['id',_0x732d('0x2c')]};if(_0x5e5046===_0x732d('0x80')){_0x1c9cea[_0x732d('0x86')]={'attributes':[_0x732d('0x87')]};}return _0x14f8eb[_0x732d('0x4e')+_0x5e5046+_0x732d('0x7b')](_0x1c9cea)[_0x732d('0x2a')](function(_0x3574e2){var _0x32ea61=_[_0x732d('0x42')](_0x3574e2,function(_0x8745e9){var _0x46e637=_[_0x732d('0x42')](_0xecf5c0,function(_0x3f0560){var _0x3739b1={'where':{'UserId':_0x3f0560,[_0x5e5046+_0x732d('0x88')]:_0x8745e9['id']},'transaction':_0x1393e7};if(_0x5e5046===_0x732d('0x80')){_0x3739b1[_0x732d('0x19')]={'penalty':_0x8745e9['TeamVoiceQueue']['penalty']};}return db[_0x732d('0x89')+_0x5e5046+'Queue']['findOrCreate'](_0x3739b1)[_0x732d('0x2a')](function(){socket['emit'](_0x732d('0x50')+_0x5e5046+'Queue:save',{'UserId':_0x3f0560,[_0x5e5046+_0x732d('0x88')]:_0x8745e9['id']});if(_0x5e5046!=='Voice'){return;}return db[_0x732d('0x89')][_0x732d('0x45')]({'where':{'id':_0xecf5c0,'online':0x1},'attributes':['id',_0x732d('0x2c'),'online','voicePause','interface'],'raw':!![]})[_0x732d('0x2a')](function(_0x5af41b){var _0x22fd8a=_[_0x732d('0x42')](_0x5af41b,function(_0x1953aa){return db[_0x732d('0x8a')]['upsert']({'membername':_0x1953aa[_0x732d('0x2c')],'UserId':_0x1953aa['id'],'queue_name':_0x8745e9[_0x732d('0x2c')],'VoiceQueueId':_0x8745e9['id'],'interface':_[_0x732d('0x8b')](_0x1953aa[_0x732d('0x8c')])?util[_0x732d('0x8d')](_0x732d('0x8e'),_0x1953aa[_0x732d('0x2c')]):_0x1953aa[_0x732d('0x8c')],'paused':_0x1953aa[_0x732d('0x8f')]||![],'penalty':_0x8745e9[_0x732d('0x90')][_0x732d('0x87')]},{'transaction':_0x1393e7});});return Promise[_0x732d('0x91')](_0x22fd8a);});});});return Promise['all'](_0x46e637);});return Promise[_0x732d('0x91')](_0x32ea61);})['then'](function(){return db['TeamVoicePrefix'][_0x732d('0x72')]({'where':{'teamId':_0xe4ef2b}})['then'](function(_0x4bd873){if(_0x4bd873){var _0x130bf6=_['map'](_0xecf5c0,function(_0x353cf2){db[_0x732d('0x6f')]['upsert']({'UserId':_0x353cf2,'VoicePrefixId':_0x4bd873[_0x732d('0x70')]});});return Promise[_0x732d('0x91')](_0x130bf6);}});});});return Promise[_0x732d('0x91')](_0x507880)[_0x732d('0x2a')](function(){return _0x14f8eb[_0x732d('0x7e')](_0xecf5c0,{'transaction':_0x1393e7})[_0x732d('0x92')](function(_0x1140bb){return _0x1140bb;});});});}})[_0x732d('0x2a')](respondWithResult(_0x1e2db6,null))[_0x732d('0x47')](handleError(_0x1e2db6,null));};exports[_0x732d('0x93')]=function(_0x9799de,_0x4be48c){var _0x42403a=_['isArray'](_0x9799de['query'][_0x732d('0x7d')])?_0x9799de[_0x732d('0x35')]['ids']:[_0x9799de['query'][_0x732d('0x7d')]];var _0x4e21d7=_0x9799de[_0x732d('0x49')]['id'];return db[_0x732d('0x2e')][_0x732d('0x4b')]({'where':{'id':_0x4e21d7}})[_0x732d('0x2a')](handleEntityNotFound(_0x4be48c,null))[_0x732d('0x2a')](function(_0x177502){if(_0x177502){var _0x4cd462=[_0x732d('0x80'),_0x732d('0x81'),'Mail',_0x732d('0x83'),_0x732d('0x94'),'Openchannel',_0x732d('0x85')];return db[_0x732d('0x5b')][_0x732d('0x59')](function(_0x2c46fc){var _0x2807e7=_[_0x732d('0x42')](_0x4cd462,function(_0x49a7a6){var _0x405b56={'attributes':['id',_0x732d('0x2c')]};return _0x177502[_0x732d('0x4e')+_0x49a7a6+_0x732d('0x7b')](_0x405b56)[_0x732d('0x2a')](function(_0xfa6041){var _0x4aa39a=_[_0x732d('0x42')](_0xfa6041,function(_0x475116){return _0x475116[_0x732d('0x93')](_0x42403a,{'transaction':_0x2c46fc})[_0x732d('0x2a')](function(){var _0x34beb5=_[_0x732d('0x42')](_0x42403a,function(_0xb0b2b6){socket[_0x732d('0x95')]('user'+_0x49a7a6+_0x732d('0x96'),{'UserId':Number(_0xb0b2b6),[_0x49a7a6+'QueueId']:_0x475116['id']});if(_0x49a7a6!=='Voice'){return;}return db[_0x732d('0x8a')][_0x732d('0x58')]({'where':{'VoiceQueueId':_0x475116['id'],'UserId':_0xb0b2b6},'transaction':_0x2c46fc});});return Promise[_0x732d('0x91')](_0x34beb5);});});return Promise[_0x732d('0x91')](_0x4aa39a);});});return Promise[_0x732d('0x91')](_0x2807e7)['then'](function(){return _0x177502[_0x732d('0x93')](_0x42403a,{'transaction':_0x2c46fc});})[_0x732d('0x2a')](function(){return db[_0x732d('0x6e')][_0x732d('0x72')]({'where':{'teamId':_0x4e21d7}})['then'](function(_0x1e0403){if(_0x1e0403){var _0x274e03=_[_0x732d('0x42')](_0x42403a,function(_0x47ffe7){db[_0x732d('0x6f')][_0x732d('0x58')]({'where':{'UserId':_0x47ffe7,'VoicePrefixId':_0x1e0403[_0x732d('0x70')]}});});return Promise[_0x732d('0x91')](_0x274e03);}});});});}})['then'](respondWithStatusCode(_0x4be48c,null))[_0x732d('0x47')](handleError(_0x4be48c,null));};exports[_0x732d('0x97')]=function(_0x488655,_0x2713c0,_0x11db78){var _0x5eebd9={};var _0x1007cb={};var _0xf3892a;var _0x127c13;return db[_0x732d('0x2e')][_0x732d('0x72')]({'where':{'id':_0x488655[_0x732d('0x49')]['id']}})[_0x732d('0x2a')](handleEntityNotFound(_0x2713c0,null))['then'](function(_0x8dfeeb){if(_0x8dfeeb){_0xf3892a=_0x8dfeeb;_0x1007cb['model']=_[_0x732d('0x34')](db[_0x732d('0x89')]['rawAttributes']);_0x1007cb[_0x732d('0x35')]=_[_0x732d('0x34')](_0x488655['query']);_0x1007cb[_0x732d('0x36')]=_['intersection'](_0x1007cb[_0x732d('0x33')],_0x1007cb[_0x732d('0x35')]);_0x5eebd9['attributes']=_[_0x732d('0x37')](_0x1007cb[_0x732d('0x33')],qs[_0x732d('0x39')](_0x488655[_0x732d('0x35')][_0x732d('0x39')]));_0x5eebd9[_0x732d('0x38')]=_0x5eebd9[_0x732d('0x38')]['length']?_0x5eebd9['attributes']:_0x1007cb[_0x732d('0x33')];_0x5eebd9[_0x732d('0x3c')]=qs[_0x732d('0x3d')](_0x488655[_0x732d('0x35')][_0x732d('0x3d')]);_0x5eebd9[_0x732d('0x3e')]=qs['filters'](_[_0x732d('0x3f')](_0x488655[_0x732d('0x35')],_0x1007cb[_0x732d('0x36')]));if(_0x488655[_0x732d('0x35')][_0x732d('0x40')]){_0x5eebd9[_0x732d('0x3e')]=_[_0x732d('0x41')](_0x5eebd9[_0x732d('0x3e')],{'$or':_[_0x732d('0x42')](_0x5eebd9[_0x732d('0x38')],function(_0x424745){var _0x40df8b={};_0x40df8b[_0x424745]={'$like':'%'+_0x488655[_0x732d('0x35')][_0x732d('0x40')]+'%'};return _0x40df8b;})});}_0x5eebd9=_['merge']({},_0x5eebd9,_0x488655[_0x732d('0x44')]);return _0xf3892a[_0x732d('0x97')](_0x5eebd9);}})['then'](function(_0x1cad15){if(_0x1cad15){_0x127c13=_0x1cad15[_0x732d('0x3a')];if(!_0x488655['query']['hasOwnProperty']('nolimit')){_0x5eebd9['limit']=qs[_0x732d('0x23')](_0x488655[_0x732d('0x35')][_0x732d('0x23')]);_0x5eebd9['offset']=qs['offset'](_0x488655[_0x732d('0x35')][_0x732d('0x21')]);}return _0xf3892a[_0x732d('0x97')](_0x5eebd9);}})[_0x732d('0x2a')](function(_0x5d9264){if(_0x5d9264){return _0x5d9264?{'count':_0x127c13,'rows':_0x5d9264}:null;}})[_0x732d('0x2a')](respondWithResult(_0x2713c0,null))['catch'](handleError(_0x2713c0,null));}; \ No newline at end of file +var _0x06a6=['VoiceQueueId','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','Teams','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','Queues','params','Unknown\x20channel','add','toLowerCase','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','TeamVoiceQueue','penalty','User','Queue','findOrCreate','emit','Queue:save','QueueId','findAll','interface','UserVoiceQueueRt','upsert','format','SIP/%s','voicePause','all','TeamVoicePrefix','VoicePrefixId','addAgents','spread','removeAgents','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./team.socket','register','status','end','json','undefined','count','offset','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x06a6,0x188));var _0x606a=function(_0x40c7f7,_0x42bc78){_0x40c7f7=_0x40c7f7-0x0;var _0x479755=_0x06a6[_0x40c7f7];return _0x479755;};'use strict';var emlformat=require(_0x606a('0x0'));var rimraf=require(_0x606a('0x1'));var zipdir=require(_0x606a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x606a('0x3'));var moment=require(_0x606a('0x4'));var BPromise=require(_0x606a('0x5'));var Mustache=require(_0x606a('0x6'));var util=require(_0x606a('0x7'));var path=require(_0x606a('0x8'));var sox=require('sox');var csv=require(_0x606a('0x9'));var ejs=require(_0x606a('0xa'));var fs=require('fs');var fs_extra=require(_0x606a('0xb'));var _=require(_0x606a('0xc'));var squel=require(_0x606a('0xd'));var crypto=require(_0x606a('0xe'));var jsforce=require(_0x606a('0xf'));var deskjs=require(_0x606a('0x10'));var toCsv=require(_0x606a('0x9'));var querystring=require(_0x606a('0x11'));var Papa=require(_0x606a('0x12'));var Redis=require('ioredis');var authService=require(_0x606a('0x13'));var qs=require(_0x606a('0x14'));var as=require(_0x606a('0x15'));var hardwareService=require(_0x606a('0x16'));var logger=require('../../config/logger')(_0x606a('0x17'));var utils=require(_0x606a('0x18'));var config=require(_0x606a('0x19'));var licenseUtil=require(_0x606a('0x1a'));var db=require(_0x606a('0x1b'))['db'];config[_0x606a('0x1c')]=_[_0x606a('0x1d')](config[_0x606a('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x606a('0x1c')]));require(_0x606a('0x1e'))[_0x606a('0x1f')](socket);function respondWithStatusCode(_0x4de9c6,_0x26daa7){_0x26daa7=_0x26daa7||0xcc;return function(_0x52987f){if(_0x52987f){return _0x4de9c6['sendStatus'](_0x26daa7);}return _0x4de9c6[_0x606a('0x20')](_0x26daa7)[_0x606a('0x21')]();};}function respondWithResult(_0x35207a,_0xe005eb){_0xe005eb=_0xe005eb||0xc8;return function(_0x476c7d){if(_0x476c7d){return _0x35207a[_0x606a('0x20')](_0xe005eb)[_0x606a('0x22')](_0x476c7d);}};}function respondWithFilteredResult(_0x131742,_0xebeff5){return function(_0x4c3d6b){if(_0x4c3d6b){var _0x4e483d=typeof _0xebeff5['offset']==='undefined'&&typeof _0xebeff5['limit']===_0x606a('0x23');var _0x3902c5=_0x4c3d6b[_0x606a('0x24')];var _0x552e7e=_0x4e483d?0x0:_0xebeff5[_0x606a('0x25')];var _0x42e723=_0x4e483d?_0x4c3d6b[_0x606a('0x24')]:_0xebeff5[_0x606a('0x25')]+_0xebeff5['limit'];var _0x4288d6;if(_0x42e723>=_0x3902c5){_0x42e723=_0x3902c5;_0x4288d6=0xc8;}else{_0x4288d6=0xce;}_0x131742['status'](_0x4288d6);return _0x131742[_0x606a('0x26')]('Content-Range',_0x552e7e+'-'+_0x42e723+'/'+_0x3902c5)[_0x606a('0x22')](_0x4c3d6b);}return null;};}function patchUpdates(_0x24f467){return function(_0x164e24){try{jsonpatch[_0x606a('0x27')](_0x164e24,_0x24f467,!![]);}catch(_0x7dbeb7){return BPromise[_0x606a('0x28')](_0x7dbeb7);}return _0x164e24[_0x606a('0x29')]();};}function saveUpdates(_0x16c995,_0x577509){return function(_0x26f477){if(_0x26f477){return _0x26f477[_0x606a('0x2a')](_0x16c995)[_0x606a('0x2b')](function(_0x4ab244){return _0x4ab244;});}return null;};}function handleEntityNotFound(_0x497b4b,_0x108252){return function(_0x54e716){if(!_0x54e716){_0x497b4b[_0x606a('0x2c')](0x194);}return _0x54e716;};}function handleError(_0x2317f1,_0xcf0285){_0xcf0285=_0xcf0285||0x1f4;return function(_0x3a7b50){logger[_0x606a('0x2d')](_0x3a7b50['stack']);if(_0x3a7b50[_0x606a('0x2e')]){delete _0x3a7b50[_0x606a('0x2e')];}_0x2317f1[_0x606a('0x20')](_0xcf0285)[_0x606a('0x2f')](_0x3a7b50);};}exports[_0x606a('0x30')]=function(_0x40cf7e,_0x4317e6){var _0x325ecd={},_0x1c1cf8={},_0x34776a={'count':0x0,'rows':[]};var _0x2a6f9c=_[_0x606a('0x31')](db[_0x606a('0x32')][_0x606a('0x33')],function(_0x4082d5){return{'name':_0x4082d5[_0x606a('0x34')],'type':_0x4082d5['type'][_0x606a('0x35')]};});_0x1c1cf8[_0x606a('0x36')]=_[_0x606a('0x31')](_0x2a6f9c,_0x606a('0x2e'));_0x1c1cf8['query']=_['keys'](_0x40cf7e[_0x606a('0x37')]);_0x1c1cf8['filters']=_[_0x606a('0x38')](_0x1c1cf8['model'],_0x1c1cf8[_0x606a('0x37')]);_0x325ecd['attributes']=_['intersection'](_0x1c1cf8[_0x606a('0x36')],qs[_0x606a('0x39')](_0x40cf7e[_0x606a('0x37')]['fields']));_0x325ecd[_0x606a('0x3a')]=_0x325ecd[_0x606a('0x3a')][_0x606a('0x3b')]?_0x325ecd[_0x606a('0x3a')]:_0x1c1cf8[_0x606a('0x36')];if(!_0x40cf7e[_0x606a('0x37')][_0x606a('0x3c')]('nolimit')){_0x325ecd[_0x606a('0x3d')]=qs['limit'](_0x40cf7e[_0x606a('0x37')]['limit']);_0x325ecd[_0x606a('0x25')]=qs[_0x606a('0x25')](_0x40cf7e[_0x606a('0x37')][_0x606a('0x25')]);}_0x325ecd[_0x606a('0x3e')]=qs[_0x606a('0x3f')](_0x40cf7e['query'][_0x606a('0x3f')]);_0x325ecd[_0x606a('0x40')]=qs[_0x606a('0x41')](_[_0x606a('0x42')](_0x40cf7e[_0x606a('0x37')],_0x1c1cf8[_0x606a('0x41')]),_0x2a6f9c);if(_0x40cf7e[_0x606a('0x37')][_0x606a('0x43')]){_0x325ecd[_0x606a('0x40')]=_[_0x606a('0x44')](_0x325ecd['where'],{'$or':_['map'](_0x2a6f9c,function(_0x3a5ee4){if(_0x3a5ee4[_0x606a('0x45')]!==_0x606a('0x46')){var _0x285bd={};_0x285bd[_0x3a5ee4[_0x606a('0x2e')]]={'$like':'%'+_0x40cf7e[_0x606a('0x37')][_0x606a('0x43')]+'%'};return _0x285bd;}})});}_0x325ecd=_[_0x606a('0x44')]({},_0x325ecd,_0x40cf7e['options']);var _0x3a7d0b={'where':_0x325ecd[_0x606a('0x40')]};return db[_0x606a('0x32')][_0x606a('0x24')](_0x3a7d0b)[_0x606a('0x2b')](function(_0x3db2a1){_0x34776a[_0x606a('0x24')]=_0x3db2a1;if(_0x40cf7e['query'][_0x606a('0x47')]){_0x325ecd[_0x606a('0x48')]=[{'all':!![]}];}return db[_0x606a('0x32')]['findAll'](_0x325ecd);})[_0x606a('0x2b')](function(_0x4b1832){_0x34776a[_0x606a('0x49')]=_0x4b1832;return _0x34776a;})[_0x606a('0x2b')](respondWithFilteredResult(_0x4317e6,_0x325ecd))[_0x606a('0x4a')](handleError(_0x4317e6,null));};exports['show']=function(_0x21cd3a,_0x5a2a00){var _0x2384f0={'raw':![],'where':{'id':_0x21cd3a['params']['id']}},_0x4d7c85={};_0x4d7c85[_0x606a('0x36')]=_[_0x606a('0x4b')](db[_0x606a('0x32')]['rawAttributes']);_0x4d7c85['query']=_['keys'](_0x21cd3a[_0x606a('0x37')]);_0x4d7c85[_0x606a('0x41')]=_[_0x606a('0x38')](_0x4d7c85['model'],_0x4d7c85[_0x606a('0x37')]);_0x2384f0['attributes']=_[_0x606a('0x38')](_0x4d7c85[_0x606a('0x36')],qs[_0x606a('0x39')](_0x21cd3a[_0x606a('0x37')][_0x606a('0x39')]));_0x2384f0[_0x606a('0x3a')]=_0x2384f0[_0x606a('0x3a')][_0x606a('0x3b')]?_0x2384f0[_0x606a('0x3a')]:_0x4d7c85[_0x606a('0x36')];if(_0x21cd3a[_0x606a('0x37')][_0x606a('0x47')]){_0x2384f0[_0x606a('0x48')]=[{'all':!![]}];}_0x2384f0=_[_0x606a('0x44')]({},_0x2384f0,_0x21cd3a[_0x606a('0x4c')]);return db['Team'][_0x606a('0x4d')](_0x2384f0)[_0x606a('0x2b')](handleEntityNotFound(_0x5a2a00,null))[_0x606a('0x2b')](respondWithResult(_0x5a2a00,null))[_0x606a('0x4a')](handleError(_0x5a2a00,null));};exports[_0x606a('0x4e')]=function(_0x326117,_0x5e037a){return db[_0x606a('0x32')]['create'](_0x326117[_0x606a('0x4f')],{})[_0x606a('0x2b')](function(_0x1a001b){var _0x46ac96=_0x326117[_0x606a('0x50')][_0x606a('0x51')]({'plain':!![]});if(!_0x46ac96)throw new Error(_0x606a('0x52'));if(_0x46ac96[_0x606a('0x53')]===_0x606a('0x50')){var _0x495030=_0x1a001b[_0x606a('0x51')]({'plain':!![]});var _0x15676d='Teams';return db[_0x606a('0x54')][_0x606a('0x4d')]({'where':{'name':_0x15676d,'userProfileId':_0x46ac96[_0x606a('0x55')]},'raw':!![]})[_0x606a('0x2b')](function(_0x46e108){if(_0x46e108&&_0x46e108['autoAssociation']===0x0){return db[_0x606a('0x56')][_0x606a('0x4e')]({'name':_0x495030[_0x606a('0x2e')],'resourceId':_0x495030['id'],'type':_0x46e108[_0x606a('0x2e')],'sectionId':_0x46e108['id']},{})[_0x606a('0x2b')](function(){return _0x1a001b;});}else{return _0x1a001b;}})[_0x606a('0x4a')](function(_0x4b3cfd){logger[_0x606a('0x2d')](_0x606a('0x57'),_0x4b3cfd);throw _0x4b3cfd;});}return _0x1a001b;})['then'](respondWithResult(_0x5e037a,0xc9))['catch'](handleError(_0x5e037a,null));};exports['update']=function(_0x4af479,_0x5900e1){if(_0x4af479[_0x606a('0x4f')]['id']){delete _0x4af479[_0x606a('0x4f')]['id'];}return db['Team'][_0x606a('0x4d')]({'where':{'id':_0x4af479['params']['id']}})[_0x606a('0x2b')](handleEntityNotFound(_0x5900e1,null))[_0x606a('0x2b')](saveUpdates(_0x4af479[_0x606a('0x4f')],null))[_0x606a('0x2b')](respondWithResult(_0x5900e1,null))['catch'](handleError(_0x5900e1,null));};exports['destroy']=function(_0x1091db,_0x1ca7c9){var _0x3e5d2d=_0x1091db['params']['id'];var _0x3caec7=[];return db['sequelize']['transaction'](function(_0x184a2a){var _0x4a0c71=_0x606a('0x58')+_0x3e5d2d;return db['sequelize'][_0x606a('0x37')](_0x4a0c71,{'type':db[_0x606a('0x59')][_0x606a('0x5a')][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a})[_0x606a('0x2b')](function(_0x35f554){_0x3caec7=_[_0x606a('0x31')](_0x35f554,function(_0xaab272){return Number(_0xaab272['UserId']);});})['then'](function(){var _0x5a1d1d=_0x606a('0x5c')+_0x3e5d2d;return db[_0x606a('0x5d')][_0x606a('0x37')](_0x5a1d1d,{'type':db[_0x606a('0x59')]['QueryTypes'][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a});})[_0x606a('0x2b')](function(_0x2b3dbf){var _0x4e05cf=_['map'](_0x2b3dbf,function(_0x5c0d7b){return Number(_0x5c0d7b[_0x606a('0x5e')]);});return db['UserVoiceQueue'][_0x606a('0x5f')]({'where':{'UserId':{'$in':_0x3caec7},'VoiceQueueId':{'$in':_0x4e05cf}},'transaction':_0x184a2a});})['then'](function(){var _0x39b58b=_0x606a('0x60')+_0x3e5d2d;return db[_0x606a('0x5d')][_0x606a('0x37')](_0x39b58b,{'type':db[_0x606a('0x59')][_0x606a('0x5a')]['SELECT'],'raw':!![],'transaction':_0x184a2a});})[_0x606a('0x2b')](function(_0x117267){var _0x4e8125=_[_0x606a('0x31')](_0x117267,function(_0x305e2d){return Number(_0x305e2d[_0x606a('0x61')]);});return db[_0x606a('0x62')]['destroy']({'where':{'UserId':{'$in':_0x3caec7},'MailQueueId':{'$in':_0x4e8125}},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){var _0x113525=_0x606a('0x63')+_0x3e5d2d;return db['sequelize'][_0x606a('0x37')](_0x113525,{'type':db[_0x606a('0x59')][_0x606a('0x5a')][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a});})['then'](function(_0x9038d1){var _0x20b23a=_[_0x606a('0x31')](_0x9038d1,function(_0x17606a){return Number(_0x17606a[_0x606a('0x64')]);});return db[_0x606a('0x65')]['destroy']({'where':{'UserId':{'$in':_0x3caec7},'SmsQueueId':{'$in':_0x20b23a}},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){var _0x5f55b6='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3e5d2d;return db[_0x606a('0x5d')][_0x606a('0x37')](_0x5f55b6,{'type':db[_0x606a('0x59')][_0x606a('0x5a')][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a});})[_0x606a('0x2b')](function(_0x444490){var _0x4f3134=_[_0x606a('0x31')](_0x444490,function(_0x4a7016){return Number(_0x4a7016[_0x606a('0x66')]);});return db[_0x606a('0x67')][_0x606a('0x5f')]({'where':{'UserId':{'$in':_0x3caec7},'ChatQueueId':{'$in':_0x4f3134}},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){var _0x4be582=_0x606a('0x68')+_0x3e5d2d;return db[_0x606a('0x5d')]['query'](_0x4be582,{'type':db[_0x606a('0x59')]['QueryTypes'][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a});})['then'](function(_0x5e02ee){var _0x4e3f7d=_[_0x606a('0x31')](_0x5e02ee,function(_0x5a7313){return Number(_0x5a7313[_0x606a('0x69')]);});return db[_0x606a('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x3caec7},'FaxQueueId':{'$in':_0x4e3f7d}},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){var _0x2f59d5=_0x606a('0x6b')+_0x3e5d2d;return db[_0x606a('0x5d')][_0x606a('0x37')](_0x2f59d5,{'type':db[_0x606a('0x59')][_0x606a('0x5a')]['SELECT'],'raw':!![],'transaction':_0x184a2a});})['then'](function(_0x3aa12a){var _0x11ba52=_[_0x606a('0x31')](_0x3aa12a,function(_0x1bdcd6){return Number(_0x1bdcd6['OpenchannelQueueId']);});return db[_0x606a('0x6c')][_0x606a('0x5f')]({'where':{'UserId':{'$in':_0x3caec7},'OpenchannelQueueId':{'$in':_0x11ba52}},'transaction':_0x184a2a});})['then'](function(){var _0x3889ea=_0x606a('0x6d')+_0x3e5d2d;return db[_0x606a('0x5d')][_0x606a('0x37')](_0x3889ea,{'type':db[_0x606a('0x59')][_0x606a('0x5a')][_0x606a('0x5b')],'raw':!![],'transaction':_0x184a2a});})[_0x606a('0x2b')](function(_0x761eb4){var _0xe8ca62=_[_0x606a('0x31')](_0x761eb4,function(_0x3cb172){return Number(_0x3cb172[_0x606a('0x6e')]);});return db[_0x606a('0x6f')][_0x606a('0x5f')]({'where':{'UserId':{'$in':_0x3caec7},'WhatsappQueueId':{'$in':_0xe8ca62}},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){return db['TeamVoicePrefix'][_0x606a('0x4d')]({'where':{'TeamId':_0x3e5d2d}});})[_0x606a('0x2b')](function(_0x22c3e9){if(_0x22c3e9===null){return;}return db[_0x606a('0x70')][_0x606a('0x5f')]({'where':{'UserId':{'$in':_0x3caec7},'VoicePrefixId':_0x22c3e9['VoicePrefixId']},'transaction':_0x184a2a});})[_0x606a('0x2b')](function(){return db[_0x606a('0x32')][_0x606a('0x5f')]({'where':{'id':_0x3e5d2d},'cascade':!![],'transaction':_0x184a2a});})[_0x606a('0x2b')](function(_0x2f83eb){if(_0x2f83eb===0x0){_0x1ca7c9['sendStatus'](0x194);}else{return db[_0x606a('0x56')][_0x606a('0x5f')]({'where':{'type':_0x606a('0x71'),'resourceId':_0x3e5d2d},'cascade':!![],'transaction':_0x184a2a})[_0x606a('0x2b')](function(){_0x1ca7c9[_0x606a('0x20')](0xcc)['end']();});}})[_0x606a('0x4a')](function(_0x53a817){_0x1ca7c9[_0x606a('0x20')](0x1f4)[_0x606a('0x2f')](_0x53a817);});});};exports[_0x606a('0x72')]=function(_0x4d9812,_0x1ed2c7,_0x5e71c6){return db[_0x606a('0x32')][_0x606a('0x73')]({'where':{'id':_0x4d9812['params']['id']}})['then'](handleEntityNotFound(_0x1ed2c7,null))['then'](function(_0x3eec3b){if(!_0x4d9812[_0x606a('0x37')][_0x606a('0x74')]||!utils[_0x606a('0x75')](_0x4d9812[_0x606a('0x37')][_0x606a('0x74')])){throw new db[(_0x606a('0x59'))][(_0x606a('0x76'))]('Unknown\x20channel');}var _0x196481={};var _0x84b884={};_0x84b884['model']=_['keys'](db[_[_0x606a('0x77')](_0x4d9812['query'][_0x606a('0x74')]['toLowerCase']())+'Queue'][_0x606a('0x33')]);_0x84b884[_0x606a('0x37')]=_['keys'](_0x4d9812[_0x606a('0x37')]);_0x84b884['filters']=_['intersection'](_0x84b884['model'],_0x84b884['query']);_0x196481[_0x606a('0x3a')]=_[_0x606a('0x38')](_0x84b884['model'],qs[_0x606a('0x39')](_0x4d9812[_0x606a('0x37')]['fields']));_0x196481['attributes']=_0x196481[_0x606a('0x3a')][_0x606a('0x3b')]?_0x196481[_0x606a('0x3a')]:_0x84b884['model'];_0x196481[_0x606a('0x3d')]=qs[_0x606a('0x3d')](_0x4d9812['query'][_0x606a('0x3d')]);_0x196481['offset']=qs[_0x606a('0x25')](_0x4d9812['query'][_0x606a('0x25')]);_0x196481['order']=qs[_0x606a('0x3f')](_0x4d9812[_0x606a('0x37')][_0x606a('0x3f')]);_0x196481[_0x606a('0x40')]=qs[_0x606a('0x41')](_[_0x606a('0x42')](_0x4d9812['query'],_0x84b884[_0x606a('0x41')]));_0x196481=_['merge']({},_0x196481,_0x4d9812[_0x606a('0x4c')]);return _0x3eec3b['get'+_[_0x606a('0x77')](_0x4d9812[_0x606a('0x37')][_0x606a('0x74')]['toLowerCase']())+_0x606a('0x78')](_0x196481);})[_0x606a('0x2b')](respondWithResult(_0x1ed2c7,null))['catch'](handleError(_0x1ed2c7,null));};exports['addQueues']=function(_0x4d9da7,_0x4c0cb4,_0x5f0731){return db[_0x606a('0x32')]['findOne']({'where':{'id':_0x4d9da7[_0x606a('0x79')]['id']}})[_0x606a('0x2b')](function(_0x36fbeb){if(_0x36fbeb){if(!_0x4d9da7[_0x606a('0x4f')][_0x606a('0x74')]||!utils[_0x606a('0x75')](_0x4d9da7['body']['channel'])){throw new db['Sequelize'][(_0x606a('0x76'))](_0x606a('0x7a'));}return _0x36fbeb[_0x606a('0x7b')+_[_0x606a('0x77')](_0x4d9da7[_0x606a('0x4f')][_0x606a('0x74')][_0x606a('0x7c')]())+_0x606a('0x78')](_0x4d9da7['body'][_0x606a('0x7d')]);}return null;})[_0x606a('0x2b')](handleEntityNotFound(_0x4c0cb4,null))[_0x606a('0x2b')](respondWithStatusCode(_0x4c0cb4,null))['catch'](handleError(_0x4c0cb4,null));};exports[_0x606a('0x7e')]=function(_0x55ee3f,_0x394dbc,_0x3cd9e9){return db[_0x606a('0x32')][_0x606a('0x73')]({'where':{'id':_0x55ee3f[_0x606a('0x79')]['id']}})[_0x606a('0x2b')](function(_0x2df3e0){if(_0x2df3e0){if(!_0x55ee3f['query'][_0x606a('0x74')]||!utils['isValidChannel'](_0x55ee3f['query'][_0x606a('0x74')])){throw new db['Sequelize'][(_0x606a('0x76'))](_0x606a('0x7a'));}return _0x2df3e0[_0x606a('0x7f')+_['capitalize'](_0x55ee3f[_0x606a('0x37')]['channel'][_0x606a('0x7c')]())+_0x606a('0x78')](_0x55ee3f['query'][_0x606a('0x7d')]);}return null;})['then'](handleEntityNotFound(_0x394dbc,null))[_0x606a('0x2b')](respondWithStatusCode(_0x394dbc,null))['catch'](handleError(_0x394dbc,null));};exports['addAgents']=function(_0x16edbf,_0x13ed59){var _0x129aa0=_[_0x606a('0x80')](_0x16edbf[_0x606a('0x4f')][_0x606a('0x7d')])?_0x16edbf['body'][_0x606a('0x7d')]:[_0x16edbf[_0x606a('0x4f')]['ids']];var _0x1eb30e=_0x16edbf['params']['id'];return db[_0x606a('0x32')]['find']({'where':{'id':_0x1eb30e}})[_0x606a('0x2b')](handleEntityNotFound(_0x13ed59,null))[_0x606a('0x2b')](function(_0x5a6d50){if(_0x5a6d50){var _0x13b24c=[_0x606a('0x81'),_0x606a('0x82'),_0x606a('0x83'),_0x606a('0x84'),_0x606a('0x85'),_0x606a('0x86'),_0x606a('0x87')];return db['sequelize'][_0x606a('0x88')](function(_0x297348){var _0x36cfeb=_[_0x606a('0x31')](_0x13b24c,function(_0x1a829a){var _0x545b87={'attributes':['id','name']};if(_0x1a829a===_0x606a('0x81')){_0x545b87[_0x606a('0x89')]={'attributes':['penalty']};}return _0x5a6d50[_0x606a('0x51')+_0x1a829a+_0x606a('0x78')](_0x545b87)[_0x606a('0x2b')](function(_0x2a2e34){var _0x771533=_['map'](_0x2a2e34,function(_0x3cfe04){var _0x5b0e47=_[_0x606a('0x31')](_0x129aa0,function(_0x35939e){var _0x4fd1c1={'where':{'UserId':_0x35939e,[_0x1a829a+'QueueId']:_0x3cfe04['id']},'transaction':_0x297348};if(_0x1a829a===_0x606a('0x81')){_0x4fd1c1[_0x606a('0x1d')]={'penalty':_0x3cfe04[_0x606a('0x8a')][_0x606a('0x8b')]};}return db[_0x606a('0x8c')+_0x1a829a+_0x606a('0x8d')][_0x606a('0x8e')](_0x4fd1c1)[_0x606a('0x2b')](function(){socket[_0x606a('0x8f')]('user'+_0x1a829a+_0x606a('0x90'),{'UserId':_0x35939e,[_0x1a829a+_0x606a('0x91')]:_0x3cfe04['id']});if(_0x1a829a!==_0x606a('0x81')){return;}return db[_0x606a('0x8c')][_0x606a('0x92')]({'where':{'id':_0x129aa0,'online':0x1},'attributes':['id',_0x606a('0x2e'),'online','voicePause',_0x606a('0x93')],'raw':!![]})[_0x606a('0x2b')](function(_0xad7e38){var _0x411fc1=_[_0x606a('0x31')](_0xad7e38,function(_0x19c750){return db[_0x606a('0x94')][_0x606a('0x95')]({'membername':_0x19c750[_0x606a('0x2e')],'UserId':_0x19c750['id'],'queue_name':_0x3cfe04[_0x606a('0x2e')],'VoiceQueueId':_0x3cfe04['id'],'interface':_['isNil'](_0x19c750[_0x606a('0x93')])?util[_0x606a('0x96')](_0x606a('0x97'),_0x19c750[_0x606a('0x2e')]):_0x19c750[_0x606a('0x93')],'paused':_0x19c750[_0x606a('0x98')]||![],'penalty':_0x3cfe04[_0x606a('0x8a')][_0x606a('0x8b')]},{'transaction':_0x297348});});return Promise[_0x606a('0x99')](_0x411fc1);});});});return Promise[_0x606a('0x99')](_0x5b0e47);});return Promise[_0x606a('0x99')](_0x771533);})[_0x606a('0x2b')](function(){return db[_0x606a('0x9a')][_0x606a('0x73')]({'where':{'teamId':_0x1eb30e}})[_0x606a('0x2b')](function(_0x891ea){if(_0x891ea){var _0x252f21=_[_0x606a('0x31')](_0x129aa0,function(_0xd1fd2){db[_0x606a('0x70')][_0x606a('0x95')]({'UserId':_0xd1fd2,'VoicePrefixId':_0x891ea[_0x606a('0x9b')]});});return Promise[_0x606a('0x99')](_0x252f21);}});});});return Promise[_0x606a('0x99')](_0x36cfeb)[_0x606a('0x2b')](function(){return _0x5a6d50[_0x606a('0x9c')](_0x129aa0,{'transaction':_0x297348})[_0x606a('0x9d')](function(_0x23200b){return _0x23200b;});});});}})[_0x606a('0x2b')](respondWithResult(_0x13ed59,null))[_0x606a('0x4a')](handleError(_0x13ed59,null));};exports[_0x606a('0x9e')]=function(_0x894d7e,_0x41c3cd){var _0x479b96=_[_0x606a('0x80')](_0x894d7e[_0x606a('0x37')]['ids'])?_0x894d7e[_0x606a('0x37')]['ids']:[_0x894d7e['query'][_0x606a('0x7d')]];var _0x492812=_0x894d7e[_0x606a('0x79')]['id'];return db[_0x606a('0x32')][_0x606a('0x4d')]({'where':{'id':_0x492812}})[_0x606a('0x2b')](handleEntityNotFound(_0x41c3cd,null))[_0x606a('0x2b')](function(_0x293611){if(_0x293611){var _0x1abdde=[_0x606a('0x81'),_0x606a('0x82'),'Mail',_0x606a('0x84'),_0x606a('0x85'),_0x606a('0x86'),_0x606a('0x87')];return db[_0x606a('0x5d')]['transaction'](function(_0x33be5){var _0x329c8b=_[_0x606a('0x31')](_0x1abdde,function(_0x4e0903){var _0x4ff272={'attributes':['id','name']};return _0x293611['get'+_0x4e0903+_0x606a('0x78')](_0x4ff272)['then'](function(_0x2f52b0){var _0xcfafa4=_['map'](_0x2f52b0,function(_0x476beb){return _0x476beb[_0x606a('0x9e')](_0x479b96,{'transaction':_0x33be5})[_0x606a('0x2b')](function(){var _0x150919=_[_0x606a('0x31')](_0x479b96,function(_0x14fb7d){socket[_0x606a('0x8f')](_0x606a('0x50')+_0x4e0903+_0x606a('0x9f'),{'UserId':Number(_0x14fb7d),[_0x4e0903+_0x606a('0x91')]:_0x476beb['id']});if(_0x4e0903!==_0x606a('0x81')){return;}return db[_0x606a('0x94')][_0x606a('0x5f')]({'where':{'VoiceQueueId':_0x476beb['id'],'UserId':_0x14fb7d},'transaction':_0x33be5});});return Promise[_0x606a('0x99')](_0x150919);});});return Promise[_0x606a('0x99')](_0xcfafa4);});});return Promise[_0x606a('0x99')](_0x329c8b)[_0x606a('0x2b')](function(){return _0x293611['removeAgents'](_0x479b96,{'transaction':_0x33be5});})[_0x606a('0x2b')](function(){return db[_0x606a('0x9a')][_0x606a('0x73')]({'where':{'teamId':_0x492812}})[_0x606a('0x2b')](function(_0x374109){if(_0x374109){var _0x2458a2=_[_0x606a('0x31')](_0x479b96,function(_0x1da087){db[_0x606a('0x70')]['destroy']({'where':{'UserId':_0x1da087,'VoicePrefixId':_0x374109[_0x606a('0x9b')]}});});return Promise['all'](_0x2458a2);}});});});}})['then'](respondWithStatusCode(_0x41c3cd,null))['catch'](handleError(_0x41c3cd,null));};exports['getAgents']=function(_0x2aa94f,_0x23bfdf,_0x57f5ed){var _0x34c4cc={};var _0x1543f8={};var _0x17948f;var _0x5be7ef;return db[_0x606a('0x32')][_0x606a('0x73')]({'where':{'id':_0x2aa94f['params']['id']}})['then'](handleEntityNotFound(_0x23bfdf,null))[_0x606a('0x2b')](function(_0x5712db){if(_0x5712db){_0x17948f=_0x5712db;_0x1543f8[_0x606a('0x36')]=_['keys'](db['User'][_0x606a('0x33')]);_0x1543f8['query']=_[_0x606a('0x4b')](_0x2aa94f[_0x606a('0x37')]);_0x1543f8[_0x606a('0x41')]=_['intersection'](_0x1543f8[_0x606a('0x36')],_0x1543f8[_0x606a('0x37')]);_0x34c4cc['attributes']=_['intersection'](_0x1543f8[_0x606a('0x36')],qs[_0x606a('0x39')](_0x2aa94f[_0x606a('0x37')]['fields']));_0x34c4cc[_0x606a('0x3a')]=_0x34c4cc[_0x606a('0x3a')]['length']?_0x34c4cc['attributes']:_0x1543f8[_0x606a('0x36')];_0x34c4cc[_0x606a('0x3e')]=qs[_0x606a('0x3f')](_0x2aa94f[_0x606a('0x37')][_0x606a('0x3f')]);_0x34c4cc[_0x606a('0x40')]=qs[_0x606a('0x41')](_[_0x606a('0x42')](_0x2aa94f[_0x606a('0x37')],_0x1543f8['filters']));if(_0x2aa94f[_0x606a('0x37')][_0x606a('0x43')]){_0x34c4cc[_0x606a('0x40')]=_[_0x606a('0x44')](_0x34c4cc['where'],{'$or':_[_0x606a('0x31')](_0x34c4cc[_0x606a('0x3a')],function(_0x8aea27){var _0xfe58b6={};_0xfe58b6[_0x8aea27]={'$like':'%'+_0x2aa94f[_0x606a('0x37')][_0x606a('0x43')]+'%'};return _0xfe58b6;})});}_0x34c4cc=_['merge']({},_0x34c4cc,_0x2aa94f['options']);return _0x17948f[_0x606a('0xa0')](_0x34c4cc);}})[_0x606a('0x2b')](function(_0x21761f){if(_0x21761f){_0x5be7ef=_0x21761f[_0x606a('0x3b')];if(!_0x2aa94f[_0x606a('0x37')]['hasOwnProperty'](_0x606a('0xa1'))){_0x34c4cc[_0x606a('0x3d')]=qs[_0x606a('0x3d')](_0x2aa94f[_0x606a('0x37')]['limit']);_0x34c4cc[_0x606a('0x25')]=qs[_0x606a('0x25')](_0x2aa94f['query'][_0x606a('0x25')]);}return _0x17948f['getAgents'](_0x34c4cc);}})['then'](function(_0xde366f){if(_0xde366f){return _0xde366f?{'count':_0x5be7ef,'rows':_0xde366f}:null;}})[_0x606a('0x2b')](respondWithResult(_0x23bfdf,null))[_0x606a('0x4a')](handleError(_0x23bfdf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b681b9d..cf92b03 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 _0x8a21=['update','remove','emit','hasOwnProperty','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x2ba161,_0x450fc3){var _0x1846ad=function(_0x5aaa8a){while(--_0x5aaa8a){_0x2ba161['push'](_0x2ba161['shift']());}};_0x1846ad(++_0x450fc3);}(_0x8a21,0x112));var _0x18a2=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x8a21[_0x4c05da];return _0x1614db;};'use strict';var EventEmitter=require(_0x18a2('0x0'));var Team=require(_0x18a2('0x1'))['db'][_0x18a2('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x18a2('0x3')](0x0);var events={'afterCreate':_0x18a2('0x4'),'afterUpdate':_0x18a2('0x5'),'afterDestroy':_0x18a2('0x6')};function emitEvent(_0x3f3b5c){return function(_0x5087f1,_0x44e14c,_0x16490d){TeamEvents[_0x18a2('0x7')](_0x3f3b5c+':'+_0x5087f1['id'],_0x5087f1);TeamEvents[_0x18a2('0x7')](_0x3f3b5c,_0x5087f1);_0x16490d(null);};}for(var e in events){if(events[_0x18a2('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x9f73=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','save','update'];(function(_0x4564bb,_0x1ba93f){var _0x2e5073=function(_0x135898){while(--_0x135898){_0x4564bb['push'](_0x4564bb['shift']());}};_0x2e5073(++_0x1ba93f);}(_0x9f73,0x16d));var _0x39f7=function(_0x58601b,_0x25fa14){_0x58601b=_0x58601b-0x0;var _0x1f1c62=_0x9f73[_0x58601b];return _0x1f1c62;};'use strict';var EventEmitter=require(_0x39f7('0x0'));var Team=require(_0x39f7('0x1'))['db'][_0x39f7('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x39f7('0x3'),'afterUpdate':_0x39f7('0x4'),'afterDestroy':_0x39f7('0x5')};function emitEvent(_0x3b27df){return function(_0x33e8f7,_0x323863,_0x48870b){TeamEvents[_0x39f7('0x6')](_0x3b27df+':'+_0x33e8f7['id'],_0x33e8f7);TeamEvents[_0x39f7('0x6')](_0x3b27df,_0x33e8f7);_0x48870b(null);};}for(var e in events){if(events[_0x39f7('0x7')](e)){var event=events[e];Team[_0x39f7('0x8')](e,emitEvent(event));}}module[_0x39f7('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1a0d97b..9807e65 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 _0x2aa8=['catch','lodash','./team.attributes','get','Queues','then','exports','define','Team','teams','Chat','Openchannel','Sms','Voice','Whatsapp','map','all'];(function(_0x449daa,_0x5a1155){var _0x3b7960=function(_0x2f1350){while(--_0x2f1350){_0x449daa['push'](_0x449daa['shift']());}};_0x3b7960(++_0x5a1155);}(_0x2aa8,0xab));var _0x82aa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2aa8[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x82aa('0x0'));var attributes=require(_0x82aa('0x1'));function getQueuesByChannel(_0x3ff6a2,_0x38da9b){var _0x216a9d=_0x82aa('0x2')+_0x38da9b+_0x82aa('0x3');return _0x3ff6a2[_0x216a9d]()[_0x82aa('0x4')](function(_0x152e5f){return _['map'](_0x152e5f,function(_0x44a1db){_0x44a1db['setDataValue']('channel',_0x38da9b);return _0x44a1db;});})['catch'](function(_0x4349a8){throw _0x4349a8;});}module[_0x82aa('0x5')]=function(_0x46e72f){return _0x46e72f[_0x82aa('0x6')](_0x82aa('0x7'),attributes,{'tableName':_0x82aa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0xb45663=this;var _0x28011d=[_0x82aa('0x9'),'Fax','Mail',_0x82aa('0xa'),_0x82aa('0xb'),_0x82aa('0xc'),_0x82aa('0xd')];return Promise['resolve']()[_0x82aa('0x4')](function(){var _0x18ae12=_[_0x82aa('0xe')](_0x28011d,function(_0x1e467e){return getQueuesByChannel(_0xb45663,_0x1e467e);});return Promise[_0x82aa('0xf')](_0x18ae12);})[_0x82aa('0x10')](function(_0x282913){throw _0x282913;});}}});}; \ No newline at end of file +var _0xab7e=['Sms','Whatsapp','all','lodash','./team.attributes','get','Queues','then','map','channel','catch','exports','Team','teams','Chat','Fax','Mail'];(function(_0x3b8495,_0x1f75f3){var _0x3407e1=function(_0x11c480){while(--_0x11c480){_0x3b8495['push'](_0x3b8495['shift']());}};_0x3407e1(++_0x1f75f3);}(_0xab7e,0xad));var _0xeab7=function(_0x519036,_0x13f961){_0x519036=_0x519036-0x0;var _0x1147df=_0xab7e[_0x519036];return _0x1147df;};'use strict';var _=require(_0xeab7('0x0'));var attributes=require(_0xeab7('0x1'));function getQueuesByChannel(_0x19cc46,_0x16f2be){var _0x5658ba=_0xeab7('0x2')+_0x16f2be+_0xeab7('0x3');return _0x19cc46[_0x5658ba]()[_0xeab7('0x4')](function(_0x2e9bf4){return _[_0xeab7('0x5')](_0x2e9bf4,function(_0x14758b){_0x14758b['setDataValue'](_0xeab7('0x6'),_0x16f2be);return _0x14758b;});})[_0xeab7('0x7')](function(_0x20a674){throw _0x20a674;});}module[_0xeab7('0x8')]=function(_0x1dd4c2){return _0x1dd4c2['define'](_0xeab7('0x9'),attributes,{'tableName':_0xeab7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x46c810=this;var _0x48c577=[_0xeab7('0xb'),_0xeab7('0xc'),_0xeab7('0xd'),'Openchannel',_0xeab7('0xe'),'Voice',_0xeab7('0xf')];return Promise['resolve']()[_0xeab7('0x4')](function(){var _0x2db557=_[_0xeab7('0x5')](_0x48c577,function(_0x5ac959){return getQueuesByChannel(_0x46c810,_0x5ac959);});return Promise[_0xeab7('0x10')](_0x2db557);})[_0xeab7('0x7')](function(_0x32bed4){throw _0x32bed4;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 436f2bf..6e21487 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 _0xa631=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x2916f9,_0x195294){var _0x26207d=function(_0x52efd9){while(--_0x52efd9){_0x2916f9['push'](_0x2916f9['shift']());}};_0x26207d(++_0x195294);}(_0xa631,0x103));var _0x1a63=function(_0x4a10c1,_0x565b5d){_0x4a10c1=_0x4a10c1-0x0;var _0x50f854=_0xa631[_0x4a10c1];return _0x50f854;};'use strict';var _=require(_0x1a63('0x0'));var util=require(_0x1a63('0x1'));var moment=require(_0x1a63('0x2'));var BPromise=require(_0x1a63('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a63('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a63('0x5'));var logger=require(_0x1a63('0x6'))(_0x1a63('0x7'));var config=require(_0x1a63('0x8'));var jayson=require(_0x1a63('0x9'));var client=jayson[_0x1a63('0xa')][_0x1a63('0xb')]({'port':0x232a});config[_0x1a63('0xc')]=_[_0x1a63('0xd')](config[_0x1a63('0xc')],{'host':_0x1a63('0xe'),'port':0x18eb});var socket=require(_0x1a63('0xf'))(new Redis(config[_0x1a63('0xc')]));require(_0x1a63('0x10'))[_0x1a63('0x11')](socket);function respondWithRpcPromise(_0x57fc13,_0x5cc6c6,_0x30575e){return new BPromise(function(_0x44c0e3,_0x540d54){return client[_0x1a63('0x12')](_0x57fc13,_0x30575e)['then'](function(_0x183945){logger[_0x1a63('0x13')](_0x1a63('0x14'),_0x5cc6c6,_0x1a63('0x15'));logger[_0x1a63('0x16')](_0x1a63('0x17'),_0x5cc6c6,_0x1a63('0x15'),JSON[_0x1a63('0x18')](_0x183945));if(_0x183945[_0x1a63('0x19')]){if(_0x183945[_0x1a63('0x19')][_0x1a63('0x1a')]===0x1f4){logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);return _0x540d54(_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);}logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);return _0x44c0e3(_0x183945[_0x1a63('0x19')][_0x1a63('0x1b')]);}else{logger[_0x1a63('0x13')]('Team,\x20%s,\x20%s',_0x5cc6c6,_0x1a63('0x15'));_0x44c0e3(_0x183945[_0x1a63('0x1c')]['message']);}})['catch'](function(_0x68513d){logger[_0x1a63('0x19')](_0x1a63('0x14'),_0x5cc6c6,_0x68513d);_0x540d54(_0x68513d);});});} \ No newline at end of file +var _0xd57a=['stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x11efe1,_0x313f36){var _0x116427=function(_0x3526f8){while(--_0x3526f8){_0x11efe1['push'](_0x11efe1['shift']());}};_0x116427(++_0x313f36);}(_0xd57a,0x17b));var _0xad57=function(_0x10bf2b,_0x3d337b){_0x10bf2b=_0x10bf2b-0x0;var _0x2d973c=_0xd57a[_0x10bf2b];return _0x2d973c;};'use strict';var _=require(_0xad57('0x0'));var util=require(_0xad57('0x1'));var moment=require(_0xad57('0x2'));var BPromise=require(_0xad57('0x3'));var rs=require(_0xad57('0x4'));var fs=require('fs');var Redis=require(_0xad57('0x5'));var db=require(_0xad57('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xad57('0x7'))('rpc');var config=require(_0xad57('0x8'));var jayson=require(_0xad57('0x9'));var client=jayson['client'][_0xad57('0xa')]({'port':0x232a});config['redis']=_[_0xad57('0xb')](config[_0xad57('0xc')],{'host':_0xad57('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xad57('0xc')]));require(_0xad57('0xe'))[_0xad57('0xf')](socket);function respondWithRpcPromise(_0x210ec4,_0x3b54d3,_0x699a50){return new BPromise(function(_0x448f6b,_0xde30a5){return client[_0xad57('0x10')](_0x210ec4,_0x699a50)['then'](function(_0x5d2e08){logger[_0xad57('0x11')](_0xad57('0x12'),_0x3b54d3,'request\x20sent');logger[_0xad57('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x3b54d3,_0xad57('0x14'),JSON[_0xad57('0x15')](_0x5d2e08));if(_0x5d2e08[_0xad57('0x16')]){if(_0x5d2e08[_0xad57('0x16')]['code']===0x1f4){logger[_0xad57('0x16')](_0xad57('0x12'),_0x3b54d3,_0x5d2e08[_0xad57('0x16')]['message']);return _0xde30a5(_0x5d2e08[_0xad57('0x16')][_0xad57('0x17')]);}logger[_0xad57('0x16')](_0xad57('0x12'),_0x3b54d3,_0x5d2e08[_0xad57('0x16')][_0xad57('0x17')]);return _0x448f6b(_0x5d2e08[_0xad57('0x16')][_0xad57('0x17')]);}else{logger[_0xad57('0x11')](_0xad57('0x12'),_0x3b54d3,_0xad57('0x14'));_0x448f6b(_0x5d2e08[_0xad57('0x18')][_0xad57('0x17')]);}})['catch'](function(_0x1cc5fb){logger[_0xad57('0x16')](_0xad57('0x12'),_0x3b54d3,_0x1cc5fb);_0xde30a5(_0x1cc5fb);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c5061c7..e99d330 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 _0x252f=['removeListener','register','length','team:','./team.events','save'];(function(_0x543412,_0x4d2bea){var _0x4cab53=function(_0x21519f){while(--_0x21519f){_0x543412['push'](_0x543412['shift']());}};_0x4cab53(++_0x4d2bea);}(_0x252f,0xd0));var _0xf252=function(_0x420a7c,_0x3ef0bc){_0x420a7c=_0x420a7c-0x0;var _0x311c52=_0x252f[_0x420a7c];return _0x311c52;};'use strict';var TeamEvents=require(_0xf252('0x0'));var events=[_0xf252('0x1'),'remove','update'];function createListener(_0x296888,_0x2663b4){return function(_0x57b4a7){_0x2663b4['emit'](_0x296888,_0x57b4a7);};}function removeListener(_0x3c570c,_0x264343){return function(){TeamEvents[_0xf252('0x2')](_0x3c570c,_0x264343);};}exports[_0xf252('0x3')]=function(_0x2e0676){for(var _0x5cbe86=0x0,_0x3fad52=events[_0xf252('0x4')];_0x5cbe86<_0x3fad52;_0x5cbe86++){var _0x271d94=events[_0x5cbe86];var _0xc8ae97=createListener(_0xf252('0x5')+_0x271d94,_0x2e0676);TeamEvents['on'](_0x271d94,_0xc8ae97);}}; \ No newline at end of file +var _0x2ac2=['update','emit','register','length','team:','save'];(function(_0x288528,_0x3e9b45){var _0x5cdb7d=function(_0x2a6b6d){while(--_0x2a6b6d){_0x288528['push'](_0x288528['shift']());}};_0x5cdb7d(++_0x3e9b45);}(_0x2ac2,0x125));var _0x22ac=function(_0x1dc65f,_0x32e8b8){_0x1dc65f=_0x1dc65f-0x0;var _0x364b13=_0x2ac2[_0x1dc65f];return _0x364b13;};'use strict';var TeamEvents=require('./team.events');var events=[_0x22ac('0x0'),'remove',_0x22ac('0x1')];function createListener(_0x4ee882,_0x5364ea){return function(_0x587eaa){_0x5364ea[_0x22ac('0x2')](_0x4ee882,_0x587eaa);};}function removeListener(_0x389c76,_0x1f9011){return function(){TeamEvents['removeListener'](_0x389c76,_0x1f9011);};}exports[_0x22ac('0x3')]=function(_0x12d2c7){for(var _0x3f5c79=0x0,_0x31cf7b=events[_0x22ac('0x4')];_0x3f5c79<_0x31cf7b;_0x3f5c79++){var _0x3c95ca=events[_0x3f5c79];var _0x3c5cc2=createListener(_0x22ac('0x5')+_0x3c95ca,_0x12d2c7);TeamEvents['on'](_0x3c95ca,_0x3c5cc2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 0b97b43..9603d31 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 _0xa79e=['INTEGER','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa79e,0xf7));var _0xea79=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xa79e[_0x236c89];return _0x3b2a15;};'use strict';var Sequelize=require(_0xea79('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0xea79('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xea79('0x1')]}}; \ No newline at end of file +var _0xa8a8=['exports','INTEGER','sequelize'];(function(_0x44d80a,_0x39f19b){var _0x285e82=function(_0x2a034a){while(--_0x2a034a){_0x44d80a['push'](_0x44d80a['shift']());}};_0x285e82(++_0x39f19b);}(_0xa8a8,0xec));var _0x8a8a=function(_0x59f6de,_0xdafde6){_0x59f6de=_0x59f6de-0x0;var _0x1d7b6b=_0xa8a8[_0x59f6de];return _0x1d7b6b;};'use strict';var Sequelize=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]={'TeamId':{'type':Sequelize[_0x8a8a('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x8a8a('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index de315b3..cb69c1c 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 _0xa7b5=['path','rimraf','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xa7b5,0x162));var _0x5a7b=function(_0x542da3,_0x369391){_0x542da3=_0x542da3-0x0;var _0x3a1740=_0xa7b5[_0x542da3];return _0x3a1740;};'use strict';var _=require(_0x5a7b('0x0'));var util=require(_0x5a7b('0x1'));var logger=require(_0x5a7b('0x2'))(_0x5a7b('0x3'));var moment=require(_0x5a7b('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a7b('0x5'));var fs=require('fs');var path=require(_0x5a7b('0x6'));var rimraf=require(_0x5a7b('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x5a7b('0x8')]=function(_0x204212,_0x4899da){return _0x204212[_0x5a7b('0x9')](_0x5a7b('0xa'),attributes,{'tableName':_0x5a7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8b1=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./teamVoicePrefix.attributes','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8b1,0x182));var _0x1a8b=function(_0x18c29c,_0x1e92c4){_0x18c29c=_0x18c29c-0x0;var _0x4daf8a=_0xa8b1[_0x18c29c];return _0x4daf8a;};'use strict';var _=require(_0x1a8b('0x0'));var util=require(_0x1a8b('0x1'));var logger=require(_0x1a8b('0x2'))(_0x1a8b('0x3'));var moment=require(_0x1a8b('0x4'));var BPromise=require(_0x1a8b('0x5'));var rp=require(_0x1a8b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a8b('0x7'));var attributes=require(_0x1a8b('0x8'));module['exports']=function(_0x2d90b8,_0x23d6ec){return _0x2d90b8[_0x1a8b('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x1a8b('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 5f727af..430644c 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x465db0,_0x6cad00){var _0x25c194=function(_0x87caf2){while(--_0x87caf2){_0x465db0['push'](_0x465db0['shift']());}};_0x25c194(++_0x6cad00);}(_0xedd9,0xfc));var _0x9edd=function(_0x4591db,_0x1182cb){_0x4591db=_0x4591db-0x0;var _0x5891ed=_0xedd9[_0x4591db];return _0x5891ed;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x117994,_0x46bbbb){var _0x40814a=function(_0x5e88ca){while(--_0x5e88ca){_0x117994['push'](_0x117994['shift']());}};_0x40814a(++_0x46bbbb);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 16dd93c..060b6e1 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 _0x0c29=['INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0c29,0xb7));var _0x90c2=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x0c29[_0x49fcfb];return _0x964926;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x90c2('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf49a=['INTEGER','sequelize','exports'];(function(_0x32e51d,_0x3b3dde){var _0x440b2d=function(_0x9a0ac0){while(--_0x9a0ac0){_0x32e51d['push'](_0x32e51d['shift']());}};_0x440b2d(++_0x3b3dde);}(_0xf49a,0x199));var _0xaf49=function(_0xc6879,_0x84a966){_0xc6879=_0xc6879-0x0;var _0x54f7a4=_0xf49a[_0xc6879];return _0x54f7a4;};'use strict';var Sequelize=require(_0xaf49('0x0'));module[_0xaf49('0x1')]={'penalty':{'type':Sequelize[_0xaf49('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 9acd0c1..382243b 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 _0x8b2d=['moment','bluebird','path','rimraf','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger'];(function(_0x49cfcc,_0xf15540){var _0x44d1cc=function(_0x20eab9){while(--_0x20eab9){_0x49cfcc['push'](_0x49cfcc['shift']());}};_0x44d1cc(++_0xf15540);}(_0x8b2d,0xe5));var _0xd8b2=function(_0x3f9ea9,_0x19840d){_0x3f9ea9=_0x3f9ea9-0x0;var _0x291e7f=_0x8b2d[_0x3f9ea9];return _0x291e7f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8b2('0x0'))('api');var moment=require(_0xd8b2('0x1'));var BPromise=require(_0xd8b2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd8b2('0x3'));var rimraf=require(_0xd8b2('0x4'));var config=require('../../config/environment');var attributes=require(_0xd8b2('0x5'));module[_0xd8b2('0x6')]=function(_0x36eb23,_0x282a58){return _0x36eb23[_0xd8b2('0x7')](_0xd8b2('0x8'),attributes,{'tableName':_0xd8b2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0911=['moment','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0911,0x1a9));var _0x1091=function(_0x3b6f58,_0x5870de){_0x3b6f58=_0x3b6f58-0x0;var _0x987c61=_0x0911[_0x3b6f58];return _0x987c61;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var logger=require(_0x1091('0x2'))(_0x1091('0x3'));var moment=require(_0x1091('0x4'));var BPromise=require('bluebird');var rp=require(_0x1091('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var attributes=require(_0x1091('0x8'));module[_0x1091('0x9')]=function(_0x3e3868,_0x28747){return _0x3e3868[_0x1091('0xa')](_0x1091('0xb'),attributes,{'tableName':_0x1091('0xc'),'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 d4760fb..ecb3d37 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 _0xc122=['http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x41e745,_0x4e3812){var _0x5dcd2b=function(_0x20e3c6){while(--_0x20e3c6){_0x41e745['push'](_0x41e745['shift']());}};_0x5dcd2b(++_0x4e3812);}(_0xc122,0x1b9));var _0x2c12=function(_0x29d808,_0x1b1056){_0x29d808=_0x29d808-0x0;var _0x3ff7cd=_0xc122[_0x29d808];return _0x3ff7cd;};'use strict';var _=require('lodash');var util=require(_0x2c12('0x0'));var moment=require(_0x2c12('0x1'));var BPromise=require(_0x2c12('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c12('0x3'));var db=require(_0x2c12('0x4'))['db'];var utils=require(_0x2c12('0x5'));var logger=require('../../config/logger')(_0x2c12('0x6'));var config=require(_0x2c12('0x7'));var jayson=require(_0x2c12('0x8'));var client=jayson['client'][_0x2c12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x301600,_0x335c1e,_0x13b39b){return new BPromise(function(_0x122409,_0x10bbf3){return client['request'](_0x301600,_0x13b39b)[_0x2c12('0xa')](function(_0x1d109e){logger[_0x2c12('0xb')](_0x2c12('0xc'),_0x335c1e,_0x2c12('0xd'));logger['debug']('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x335c1e,_0x2c12('0xd'),JSON['stringify'](_0x1d109e));if(_0x1d109e['error']){if(_0x1d109e['error']['code']===0x1f4){logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x1d109e[_0x2c12('0xe')][_0x2c12('0xf')]);return _0x10bbf3(_0x1d109e[_0x2c12('0xe')]['message']);}logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x1d109e['error']['message']);return _0x122409(_0x1d109e[_0x2c12('0xe')][_0x2c12('0xf')]);}else{logger[_0x2c12('0xb')](_0x2c12('0xc'),_0x335c1e,'request\x20sent');_0x122409(_0x1d109e[_0x2c12('0x10')][_0x2c12('0xf')]);}})[_0x2c12('0x11')](function(_0x3d2828){logger[_0x2c12('0xe')](_0x2c12('0xc'),_0x335c1e,_0x3d2828);_0x10bbf3(_0x3d2828);});});} \ No newline at end of file +var _0x3c6d=['../../config/environment','client','http','then','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xe902c5,_0x3bde89){var _0x25a3f8=function(_0xc3aa07){while(--_0xc3aa07){_0xe902c5['push'](_0xe902c5['shift']());}};_0x25a3f8(++_0x3bde89);}(_0x3c6d,0x199));var _0xd3c6=function(_0x3880e6,_0x52917e){_0x3880e6=_0x3880e6-0x0;var _0x3741a7=_0x3c6d[_0x3880e6];return _0x3741a7;};'use strict';var _=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var moment=require(_0xd3c6('0x2'));var BPromise=require(_0xd3c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3c6('0x4'));var db=require(_0xd3c6('0x5'))['db'];var utils=require(_0xd3c6('0x6'));var logger=require(_0xd3c6('0x7'))(_0xd3c6('0x8'));var config=require(_0xd3c6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd3c6('0xa')][_0xd3c6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x438b25,_0x303abf,_0x341f8a){return new BPromise(function(_0x15a1c9,_0x4c29bb){return client['request'](_0x438b25,_0x341f8a)[_0xd3c6('0xc')](function(_0x23afce){logger[_0xd3c6('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x303abf,_0xd3c6('0xe'));logger['debug'](_0xd3c6('0xf'),_0x303abf,'request\x20sent',JSON['stringify'](_0x23afce));if(_0x23afce[_0xd3c6('0x10')]){if(_0x23afce[_0xd3c6('0x10')][_0xd3c6('0x11')]===0x1f4){logger[_0xd3c6('0x10')](_0xd3c6('0x12'),_0x303abf,_0x23afce[_0xd3c6('0x10')][_0xd3c6('0x13')]);return _0x4c29bb(_0x23afce[_0xd3c6('0x10')][_0xd3c6('0x13')]);}logger[_0xd3c6('0x10')](_0xd3c6('0x12'),_0x303abf,_0x23afce['error'][_0xd3c6('0x13')]);return _0x15a1c9(_0x23afce[_0xd3c6('0x10')][_0xd3c6('0x13')]);}else{logger[_0xd3c6('0xd')](_0xd3c6('0x12'),_0x303abf,_0xd3c6('0xe'));_0x15a1c9(_0x23afce[_0xd3c6('0x14')][_0xd3c6('0x13')]);}})[_0xd3c6('0x15')](function(_0x14a5f1){logger[_0xd3c6('0x10')](_0xd3c6('0x12'),_0x303abf,_0x14a5f1);_0x4c29bb(_0x14a5f1);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index e8f74cf..ecd2409 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 _0x82d8=['get','isAuthenticated','index','/:id','post','create','delete','exports','multer','path','Router','../../components/auth/service','./template.controller'];(function(_0x37b191,_0x261c0d){var _0x2acbce=function(_0x184fed){while(--_0x184fed){_0x37b191['push'](_0x37b191['shift']());}};_0x2acbce(++_0x261c0d);}(_0x82d8,0xff));var _0x882d=function(_0x162bf5,_0x197406){_0x162bf5=_0x162bf5-0x0;var _0x4f45aa=_0x82d8[_0x162bf5];return _0x4f45aa;};'use strict';var multer=require(_0x882d('0x0'));var util=require('util');var path=require(_0x882d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x882d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x882d('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x882d('0x4'));router[_0x882d('0x5')]('/',auth[_0x882d('0x6')](),controller[_0x882d('0x7')]);router[_0x882d('0x5')](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['show']);router[_0x882d('0x9')]('/',auth[_0x882d('0x6')](),controller[_0x882d('0xa')]);router['put'](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['update']);router[_0x882d('0xb')](_0x882d('0x8'),auth[_0x882d('0x6')](),controller['destroy']);module[_0x882d('0xc')]=router; \ No newline at end of file +var _0x67d1=['post','create','put','/:id','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','show'];(function(_0x5a0588,_0x2d25be){var _0xa2ba6d=function(_0x392d5b){while(--_0x392d5b){_0x5a0588['push'](_0x5a0588['shift']());}};_0xa2ba6d(++_0x2d25be);}(_0x67d1,0xf1));var _0x167d=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x67d1[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0x167d('0x0'));var path=require(_0x167d('0x1'));var timeout=require('connect-timeout');var express=require(_0x167d('0x2'));var router=express[_0x167d('0x3')]();var fs_extra=require(_0x167d('0x4'));var auth=require(_0x167d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x167d('0x6'));var controller=require(_0x167d('0x7'));router[_0x167d('0x8')]('/',auth[_0x167d('0x9')](),controller['index']);router[_0x167d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x167d('0xa')]);router[_0x167d('0xb')]('/',auth[_0x167d('0x9')](),controller[_0x167d('0xc')]);router[_0x167d('0xd')](_0x167d('0xe'),auth[_0x167d('0x9')](),controller['update']);router[_0x167d('0xf')](_0x167d('0xe'),auth[_0x167d('0x9')](),controller[_0x167d('0x10')]);module[_0x167d('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 5f969fb..c12ee4b 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 _0x0735=['sequelize','exports','STRING','TEXT'];(function(_0x15ce85,_0x1a1bbe){var _0x56e90b=function(_0x53ed0d){while(--_0x53ed0d){_0x15ce85['push'](_0x15ce85['shift']());}};_0x56e90b(++_0x1a1bbe);}(_0x0735,0x1c0));var _0x5073=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0735[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x5073('0x0'));module[_0x5073('0x1')]={'name':{'type':Sequelize[_0x5073('0x2')]},'description':{'type':Sequelize[_0x5073('0x2')]},'html':{'type':Sequelize[_0x5073('0x3')]}}; \ No newline at end of file +var _0x8ac9=['sequelize','exports','STRING'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8ac9,0x168));var _0x98ac=function(_0x449936,_0x58d877){_0x449936=_0x449936-0x0;var _0x2c2f94=_0x8ac9[_0x449936];return _0x2c2f94;};'use strict';var Sequelize=require(_0x98ac('0x0'));module[_0x98ac('0x1')]={'name':{'type':Sequelize[_0x98ac('0x2')]},'description':{'type':Sequelize[_0x98ac('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 07dc314..433573e 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 _0x982d=['../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','Template','includeAll','include','findAll','rows','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','catch','params','eml-format','zip-dir','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x1b0333,_0x42c267){var _0x1450fb=function(_0xfb8548){while(--_0xfb8548){_0x1b0333['push'](_0x1b0333['shift']());}};_0x1450fb(++_0x42c267);}(_0x982d,0x13a));var _0xd982=function(_0x51405b,_0x1b3ba1){_0x51405b=_0x51405b-0x0;var _0x2fac2d=_0x982d[_0x51405b];return _0x2fac2d;};'use strict';var emlformat=require(_0xd982('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd982('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd982('0x2'));var path=require(_0xd982('0x3'));var sox=require(_0xd982('0x4'));var csv=require(_0xd982('0x5'));var ejs=require(_0xd982('0x6'));var fs=require('fs');var fs_extra=require(_0xd982('0x7'));var _=require(_0xd982('0x8'));var squel=require(_0xd982('0x9'));var crypto=require(_0xd982('0xa'));var jsforce=require(_0xd982('0xb'));var deskjs=require(_0xd982('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd982('0xd'));var Papa=require(_0xd982('0xe'));var Redis=require(_0xd982('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd982('0x10'));var as=require(_0xd982('0x11'));var hardwareService=require(_0xd982('0x12'));var logger=require(_0xd982('0x13'))('api');var utils=require(_0xd982('0x14'));var config=require(_0xd982('0x15'));var licenseUtil=require(_0xd982('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7f9e7,_0xdec5bd){_0xdec5bd=_0xdec5bd||0xcc;return function(_0x3bd7e1){if(_0x3bd7e1){return _0x7f9e7['sendStatus'](_0xdec5bd);}return _0x7f9e7[_0xd982('0x17')](_0xdec5bd)[_0xd982('0x18')]();};}function respondWithResult(_0x164858,_0x1d7378){_0x1d7378=_0x1d7378||0xc8;return function(_0x5854da){if(_0x5854da){return _0x164858[_0xd982('0x17')](_0x1d7378)[_0xd982('0x19')](_0x5854da);}};}function respondWithFilteredResult(_0x481f73,_0x341e52){return function(_0x439a81){if(_0x439a81){var _0x1bb230=typeof _0x341e52[_0xd982('0x1a')]==='undefined'&&typeof _0x341e52[_0xd982('0x1b')]===_0xd982('0x1c');var _0x42dcf1=_0x439a81[_0xd982('0x1d')];var _0x343562=_0x1bb230?0x0:_0x341e52['offset'];var _0x455161=_0x1bb230?_0x439a81[_0xd982('0x1d')]:_0x341e52[_0xd982('0x1a')]+_0x341e52[_0xd982('0x1b')];var _0x38b4f8;if(_0x455161>=_0x42dcf1){_0x455161=_0x42dcf1;_0x38b4f8=0xc8;}else{_0x38b4f8=0xce;}_0x481f73[_0xd982('0x17')](_0x38b4f8);return _0x481f73[_0xd982('0x1e')](_0xd982('0x1f'),_0x343562+'-'+_0x455161+'/'+_0x42dcf1)[_0xd982('0x19')](_0x439a81);}return null;};}function patchUpdates(_0x15f377){return function(_0x1ebb3f){try{jsonpatch[_0xd982('0x20')](_0x1ebb3f,_0x15f377,!![]);}catch(_0x313227){return BPromise[_0xd982('0x21')](_0x313227);}return _0x1ebb3f[_0xd982('0x22')]();};}function saveUpdates(_0x382a14,_0x48e42f){return function(_0xed81c5){if(_0xed81c5){return _0xed81c5[_0xd982('0x23')](_0x382a14)[_0xd982('0x24')](function(_0x2e3a19){return _0x2e3a19;});}return null;};}function removeEntity(_0x495046,_0x172806){return function(_0x31db27){if(_0x31db27){return _0x31db27['destroy']()[_0xd982('0x24')](function(){var _0x356162=_0x31db27[_0xd982('0x25')]({'plain':!![]});var _0x464e69=_0xd982('0x26');return db[_0xd982('0x27')][_0xd982('0x28')]({'where':{'type':_0x464e69,'resourceId':_0x356162['id']}})[_0xd982('0x24')](function(){return _0x31db27;});})['then'](function(){_0x495046[_0xd982('0x17')](0xcc)[_0xd982('0x18')]();});}};}function handleEntityNotFound(_0x1d0e5d,_0x27ea40){return function(_0x102957){if(!_0x102957){_0x1d0e5d[_0xd982('0x29')](0x194);}return _0x102957;};}function handleError(_0x301472,_0x5a26be){_0x5a26be=_0x5a26be||0x1f4;return function(_0x19c446){logger[_0xd982('0x2a')](_0x19c446[_0xd982('0x2b')]);if(_0x19c446[_0xd982('0x2c')]){delete _0x19c446['name'];}_0x301472[_0xd982('0x17')](_0x5a26be)[_0xd982('0x2d')](_0x19c446);};}exports[_0xd982('0x2e')]=function(_0xb08607,_0x192f89){var _0x385d48={},_0x1436de={},_0x3f59e9={'count':0x0,'rows':[]};var _0x511cfe=_[_0xd982('0x2f')](db['Template'][_0xd982('0x30')],function(_0x5f1235){return{'name':_0x5f1235[_0xd982('0x31')],'type':_0x5f1235[_0xd982('0x32')][_0xd982('0x33')]};});_0x1436de[_0xd982('0x34')]=_[_0xd982('0x2f')](_0x511cfe,_0xd982('0x2c'));_0x1436de[_0xd982('0x35')]=_[_0xd982('0x36')](_0xb08607[_0xd982('0x35')]);_0x1436de[_0xd982('0x37')]=_[_0xd982('0x38')](_0x1436de[_0xd982('0x34')],_0x1436de[_0xd982('0x35')]);_0x385d48['attributes']=_[_0xd982('0x38')](_0x1436de[_0xd982('0x34')],qs[_0xd982('0x39')](_0xb08607[_0xd982('0x35')][_0xd982('0x39')]));_0x385d48[_0xd982('0x3a')]=_0x385d48[_0xd982('0x3a')][_0xd982('0x3b')]?_0x385d48[_0xd982('0x3a')]:_0x1436de['model'];if(!_0xb08607[_0xd982('0x35')][_0xd982('0x3c')](_0xd982('0x3d'))){_0x385d48[_0xd982('0x1b')]=qs[_0xd982('0x1b')](_0xb08607[_0xd982('0x35')]['limit']);_0x385d48[_0xd982('0x1a')]=qs[_0xd982('0x1a')](_0xb08607[_0xd982('0x35')][_0xd982('0x1a')]);}_0x385d48[_0xd982('0x3e')]=qs[_0xd982('0x3f')](_0xb08607[_0xd982('0x35')]['sort']);_0x385d48['where']=qs[_0xd982('0x37')](_[_0xd982('0x40')](_0xb08607[_0xd982('0x35')],_0x1436de['filters']),_0x511cfe);if(_0xb08607[_0xd982('0x35')][_0xd982('0x41')]){_0x385d48[_0xd982('0x42')]=_['merge'](_0x385d48[_0xd982('0x42')],{'$or':_[_0xd982('0x2f')](_0x511cfe,function(_0x2e8c65){if(_0x2e8c65['type']!=='VIRTUAL'){var _0x19ac2f={};_0x19ac2f[_0x2e8c65[_0xd982('0x2c')]]={'$like':'%'+_0xb08607[_0xd982('0x35')][_0xd982('0x41')]+'%'};return _0x19ac2f;}})});}_0x385d48=_[_0xd982('0x43')]({},_0x385d48,_0xb08607[_0xd982('0x44')]);var _0x1531d4={'where':_0x385d48[_0xd982('0x42')]};return db[_0xd982('0x45')]['count'](_0x1531d4)[_0xd982('0x24')](function(_0x11abb3){_0x3f59e9[_0xd982('0x1d')]=_0x11abb3;if(_0xb08607['query'][_0xd982('0x46')]){_0x385d48[_0xd982('0x47')]=[{'all':!![]}];}return db[_0xd982('0x45')][_0xd982('0x48')](_0x385d48);})[_0xd982('0x24')](function(_0x4567d1){_0x3f59e9[_0xd982('0x49')]=_0x4567d1;return _0x3f59e9;})[_0xd982('0x24')](respondWithFilteredResult(_0x192f89,_0x385d48))['catch'](handleError(_0x192f89,null));};exports[_0xd982('0x4a')]=function(_0x87726b,_0x363908){var _0x44cd0f={'raw':!![],'where':{'id':_0x87726b['params']['id']}},_0x505e7d={};_0x505e7d[_0xd982('0x34')]=_[_0xd982('0x36')](db[_0xd982('0x45')][_0xd982('0x30')]);_0x505e7d[_0xd982('0x35')]=_[_0xd982('0x36')](_0x87726b[_0xd982('0x35')]);_0x505e7d[_0xd982('0x37')]=_[_0xd982('0x38')](_0x505e7d[_0xd982('0x34')],_0x505e7d[_0xd982('0x35')]);_0x44cd0f[_0xd982('0x3a')]=_['intersection'](_0x505e7d[_0xd982('0x34')],qs['fields'](_0x87726b[_0xd982('0x35')][_0xd982('0x39')]));_0x44cd0f[_0xd982('0x3a')]=_0x44cd0f[_0xd982('0x3a')][_0xd982('0x3b')]?_0x44cd0f[_0xd982('0x3a')]:_0x505e7d[_0xd982('0x34')];if(_0x87726b[_0xd982('0x35')][_0xd982('0x46')]){_0x44cd0f[_0xd982('0x47')]=[{'all':!![]}];}_0x44cd0f=_[_0xd982('0x43')]({},_0x44cd0f,_0x87726b['options']);return db['Template']['find'](_0x44cd0f)[_0xd982('0x24')](handleEntityNotFound(_0x363908,null))[_0xd982('0x24')](respondWithResult(_0x363908,null))['catch'](handleError(_0x363908,null));};exports[_0xd982('0x4b')]=function(_0x1ba01d,_0x11ae4d){return db['Template'][_0xd982('0x4b')](_0x1ba01d[_0xd982('0x4c')],{})[_0xd982('0x24')](function(_0x18ac0d){var _0x4e85d6=_0x1ba01d['user'][_0xd982('0x25')]({'plain':!![]});if(!_0x4e85d6)throw new Error(_0xd982('0x4d'));if(_0x4e85d6[_0xd982('0x4e')]==='user'){var _0x4fd506=_0x18ac0d[_0xd982('0x25')]({'plain':!![]});var _0x4e854f=_0xd982('0x26');return db['UserProfileSection'][_0xd982('0x4f')]({'where':{'name':_0x4e854f,'userProfileId':_0x4e85d6[_0xd982('0x50')]},'raw':!![]})['then'](function(_0x2f032e){if(_0x2f032e&&_0x2f032e[_0xd982('0x51')]===0x0){return db[_0xd982('0x27')]['create']({'name':_0x4fd506[_0xd982('0x2c')],'resourceId':_0x4fd506['id'],'type':_0x2f032e[_0xd982('0x2c')],'sectionId':_0x2f032e['id']},{})[_0xd982('0x24')](function(){return _0x18ac0d;});}else{return _0x18ac0d;}})[_0xd982('0x52')](function(_0x593932){logger[_0xd982('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x593932);throw _0x593932;});}return _0x18ac0d;})[_0xd982('0x24')](respondWithResult(_0x11ae4d,0xc9))['catch'](handleError(_0x11ae4d,null));};exports['update']=function(_0x5cdf9e,_0x48b7fc){if(_0x5cdf9e[_0xd982('0x4c')]['id']){delete _0x5cdf9e[_0xd982('0x4c')]['id'];}return db[_0xd982('0x45')][_0xd982('0x4f')]({'where':{'id':_0x5cdf9e[_0xd982('0x53')]['id']}})[_0xd982('0x24')](handleEntityNotFound(_0x48b7fc,null))[_0xd982('0x24')](saveUpdates(_0x5cdf9e[_0xd982('0x4c')],null))[_0xd982('0x24')](respondWithResult(_0x48b7fc,null))['catch'](handleError(_0x48b7fc,null));};exports['destroy']=function(_0x2e7488,_0xe34ace){return db[_0xd982('0x45')]['find']({'where':{'id':_0x2e7488[_0xd982('0x53')]['id']}})[_0xd982('0x24')](handleEntityNotFound(_0xe34ace,null))['then'](removeEntity(_0xe34ace,null))[_0xd982('0x52')](handleError(_0xe34ace,null));}; \ No newline at end of file +var _0xc53e=['fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','keys','include','Template','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Templates','end','error','stack','name','index','map'];(function(_0x53422b,_0x882e9){var _0x40f07d=function(_0x24eb92){while(--_0x24eb92){_0x53422b['push'](_0x53422b['shift']());}};_0x40f07d(++_0x882e9);}(_0xc53e,0xc8));var _0xec53=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xc53e[_0x55e08b];return _0xd1a7ff;};'use strict';var emlformat=require(_0xec53('0x0'));var rimraf=require(_0xec53('0x1'));var zipdir=require(_0xec53('0x2'));var jsonpatch=require(_0xec53('0x3'));var rp=require('request-promise');var moment=require(_0xec53('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xec53('0x5'));var util=require('util');var path=require(_0xec53('0x6'));var sox=require(_0xec53('0x7'));var csv=require(_0xec53('0x8'));var ejs=require(_0xec53('0x9'));var fs=require('fs');var fs_extra=require(_0xec53('0xa'));var _=require(_0xec53('0xb'));var squel=require(_0xec53('0xc'));var crypto=require(_0xec53('0xd'));var jsforce=require(_0xec53('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xec53('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xec53('0xf'));var authService=require(_0xec53('0x10'));var qs=require(_0xec53('0x11'));var as=require(_0xec53('0x12'));var hardwareService=require(_0xec53('0x13'));var logger=require(_0xec53('0x14'))(_0xec53('0x15'));var utils=require(_0xec53('0x16'));var config=require(_0xec53('0x17'));var licenseUtil=require(_0xec53('0x18'));var db=require(_0xec53('0x19'))['db'];function respondWithStatusCode(_0x3fe95a,_0x5c7adc){_0x5c7adc=_0x5c7adc||0xcc;return function(_0x28d5ea){if(_0x28d5ea){return _0x3fe95a[_0xec53('0x1a')](_0x5c7adc);}return _0x3fe95a['status'](_0x5c7adc)['end']();};}function respondWithResult(_0x5762c5,_0x2f9574){_0x2f9574=_0x2f9574||0xc8;return function(_0x2f2838){if(_0x2f2838){return _0x5762c5[_0xec53('0x1b')](_0x2f9574)['json'](_0x2f2838);}};}function respondWithFilteredResult(_0x2a047a,_0x2da35e){return function(_0x495bdc){if(_0x495bdc){var _0xb5bf9b=typeof _0x2da35e[_0xec53('0x1c')]===_0xec53('0x1d')&&typeof _0x2da35e[_0xec53('0x1e')]===_0xec53('0x1d');var _0x23ec30=_0x495bdc[_0xec53('0x1f')];var _0x86cd9a=_0xb5bf9b?0x0:_0x2da35e[_0xec53('0x1c')];var _0x3911cf=_0xb5bf9b?_0x495bdc['count']:_0x2da35e[_0xec53('0x1c')]+_0x2da35e[_0xec53('0x1e')];var _0x3e83d7;if(_0x3911cf>=_0x23ec30){_0x3911cf=_0x23ec30;_0x3e83d7=0xc8;}else{_0x3e83d7=0xce;}_0x2a047a[_0xec53('0x1b')](_0x3e83d7);return _0x2a047a[_0xec53('0x20')]('Content-Range',_0x86cd9a+'-'+_0x3911cf+'/'+_0x23ec30)['json'](_0x495bdc);}return null;};}function patchUpdates(_0x5ef67e){return function(_0x591246){try{jsonpatch[_0xec53('0x21')](_0x591246,_0x5ef67e,!![]);}catch(_0x2b4596){return BPromise[_0xec53('0x22')](_0x2b4596);}return _0x591246[_0xec53('0x23')]();};}function saveUpdates(_0x2d4663,_0x350aeb){return function(_0x54e1c4){if(_0x54e1c4){return _0x54e1c4[_0xec53('0x24')](_0x2d4663)[_0xec53('0x25')](function(_0x479498){return _0x479498;});}return null;};}function removeEntity(_0x5d8607,_0x53c3d){return function(_0x5c2a7b){if(_0x5c2a7b){return _0x5c2a7b[_0xec53('0x26')]()[_0xec53('0x25')](function(){var _0x987fb2=_0x5c2a7b['get']({'plain':!![]});var _0x3e12af=_0xec53('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x3e12af,'resourceId':_0x987fb2['id']}})['then'](function(){return _0x5c2a7b;});})[_0xec53('0x25')](function(){_0x5d8607[_0xec53('0x1b')](0xcc)[_0xec53('0x28')]();});}};}function handleEntityNotFound(_0x1b9a32,_0x1cb635){return function(_0x2eade5){if(!_0x2eade5){_0x1b9a32[_0xec53('0x1a')](0x194);}return _0x2eade5;};}function handleError(_0x4afa2c,_0xbec017){_0xbec017=_0xbec017||0x1f4;return function(_0x35e137){logger[_0xec53('0x29')](_0x35e137[_0xec53('0x2a')]);if(_0x35e137['name']){delete _0x35e137[_0xec53('0x2b')];}_0x4afa2c['status'](_0xbec017)['send'](_0x35e137);};}exports[_0xec53('0x2c')]=function(_0xf4da99,_0x15a38){var _0x58d42b={},_0x3d4cf9={},_0x3459fb={'count':0x0,'rows':[]};var _0x3324c1=_[_0xec53('0x2d')](db['Template']['rawAttributes'],function(_0xf21e36){return{'name':_0xf21e36[_0xec53('0x2e')],'type':_0xf21e36[_0xec53('0x2f')][_0xec53('0x30')]};});_0x3d4cf9['model']=_[_0xec53('0x2d')](_0x3324c1,'name');_0x3d4cf9[_0xec53('0x31')]=_['keys'](_0xf4da99[_0xec53('0x31')]);_0x3d4cf9[_0xec53('0x32')]=_[_0xec53('0x33')](_0x3d4cf9[_0xec53('0x34')],_0x3d4cf9[_0xec53('0x31')]);_0x58d42b[_0xec53('0x35')]=_[_0xec53('0x33')](_0x3d4cf9[_0xec53('0x34')],qs[_0xec53('0x36')](_0xf4da99[_0xec53('0x31')][_0xec53('0x36')]));_0x58d42b[_0xec53('0x35')]=_0x58d42b[_0xec53('0x35')][_0xec53('0x37')]?_0x58d42b[_0xec53('0x35')]:_0x3d4cf9[_0xec53('0x34')];if(!_0xf4da99[_0xec53('0x31')][_0xec53('0x38')]('nolimit')){_0x58d42b[_0xec53('0x1e')]=qs[_0xec53('0x1e')](_0xf4da99['query'][_0xec53('0x1e')]);_0x58d42b[_0xec53('0x1c')]=qs[_0xec53('0x1c')](_0xf4da99[_0xec53('0x31')]['offset']);}_0x58d42b['order']=qs['sort'](_0xf4da99[_0xec53('0x31')]['sort']);_0x58d42b[_0xec53('0x39')]=qs[_0xec53('0x32')](_[_0xec53('0x3a')](_0xf4da99[_0xec53('0x31')],_0x3d4cf9[_0xec53('0x32')]),_0x3324c1);if(_0xf4da99[_0xec53('0x31')][_0xec53('0x3b')]){_0x58d42b[_0xec53('0x39')]=_[_0xec53('0x3c')](_0x58d42b[_0xec53('0x39')],{'$or':_['map'](_0x3324c1,function(_0x2d69af){if(_0x2d69af['type']!=='VIRTUAL'){var _0x425073={};_0x425073[_0x2d69af[_0xec53('0x2b')]]={'$like':'%'+_0xf4da99[_0xec53('0x31')]['filter']+'%'};return _0x425073;}})});}_0x58d42b=_['merge']({},_0x58d42b,_0xf4da99[_0xec53('0x3d')]);var _0x44835f={'where':_0x58d42b['where']};return db['Template'][_0xec53('0x1f')](_0x44835f)[_0xec53('0x25')](function(_0x5ba246){_0x3459fb['count']=_0x5ba246;if(_0xf4da99[_0xec53('0x31')][_0xec53('0x3e')]){_0x58d42b['include']=[{'all':!![]}];}return db['Template'][_0xec53('0x3f')](_0x58d42b);})[_0xec53('0x25')](function(_0x5541e1){_0x3459fb['rows']=_0x5541e1;return _0x3459fb;})[_0xec53('0x25')](respondWithFilteredResult(_0x15a38,_0x58d42b))[_0xec53('0x40')](handleError(_0x15a38,null));};exports[_0xec53('0x41')]=function(_0x39792d,_0x39320c){var _0x276348={'raw':!![],'where':{'id':_0x39792d[_0xec53('0x42')]['id']}},_0x318425={};_0x318425[_0xec53('0x34')]=_['keys'](db['Template'][_0xec53('0x43')]);_0x318425['query']=_[_0xec53('0x44')](_0x39792d['query']);_0x318425[_0xec53('0x32')]=_['intersection'](_0x318425[_0xec53('0x34')],_0x318425[_0xec53('0x31')]);_0x276348[_0xec53('0x35')]=_['intersection'](_0x318425[_0xec53('0x34')],qs[_0xec53('0x36')](_0x39792d[_0xec53('0x31')][_0xec53('0x36')]));_0x276348[_0xec53('0x35')]=_0x276348[_0xec53('0x35')][_0xec53('0x37')]?_0x276348[_0xec53('0x35')]:_0x318425[_0xec53('0x34')];if(_0x39792d[_0xec53('0x31')][_0xec53('0x3e')]){_0x276348[_0xec53('0x45')]=[{'all':!![]}];}_0x276348=_[_0xec53('0x3c')]({},_0x276348,_0x39792d[_0xec53('0x3d')]);return db[_0xec53('0x46')][_0xec53('0x47')](_0x276348)[_0xec53('0x25')](handleEntityNotFound(_0x39320c,null))[_0xec53('0x25')](respondWithResult(_0x39320c,null))[_0xec53('0x40')](handleError(_0x39320c,null));};exports[_0xec53('0x48')]=function(_0x121da6,_0x4ce443){return db[_0xec53('0x46')]['create'](_0x121da6[_0xec53('0x49')],{})[_0xec53('0x25')](function(_0x1037ae){var _0x1091ae=_0x121da6[_0xec53('0x4a')]['get']({'plain':!![]});if(!_0x1091ae)throw new Error(_0xec53('0x4b'));if(_0x1091ae[_0xec53('0x4c')]===_0xec53('0x4a')){var _0x39d7f2=_0x1037ae[_0xec53('0x4d')]({'plain':!![]});var _0x29734a=_0xec53('0x27');return db[_0xec53('0x4e')]['find']({'where':{'name':_0x29734a,'userProfileId':_0x1091ae[_0xec53('0x4f')]},'raw':!![]})['then'](function(_0x54f895){if(_0x54f895&&_0x54f895['autoAssociation']===0x0){return db[_0xec53('0x50')][_0xec53('0x48')]({'name':_0x39d7f2[_0xec53('0x2b')],'resourceId':_0x39d7f2['id'],'type':_0x54f895[_0xec53('0x2b')],'sectionId':_0x54f895['id']},{})[_0xec53('0x25')](function(){return _0x1037ae;});}else{return _0x1037ae;}})['catch'](function(_0x2aba9f){logger[_0xec53('0x29')](_0xec53('0x51'),_0x2aba9f);throw _0x2aba9f;});}return _0x1037ae;})['then'](respondWithResult(_0x4ce443,0xc9))[_0xec53('0x40')](handleError(_0x4ce443,null));};exports['update']=function(_0xb8aec3,_0x61b896){if(_0xb8aec3[_0xec53('0x49')]['id']){delete _0xb8aec3['body']['id'];}return db[_0xec53('0x46')][_0xec53('0x47')]({'where':{'id':_0xb8aec3[_0xec53('0x42')]['id']}})['then'](handleEntityNotFound(_0x61b896,null))[_0xec53('0x25')](saveUpdates(_0xb8aec3[_0xec53('0x49')],null))[_0xec53('0x25')](respondWithResult(_0x61b896,null))[_0xec53('0x40')](handleError(_0x61b896,null));};exports[_0xec53('0x26')]=function(_0x1fe57d,_0x1f8de2){return db[_0xec53('0x46')][_0xec53('0x47')]({'where':{'id':_0x1fe57d[_0xec53('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f8de2,null))['then'](removeEntity(_0x1f8de2,null))['catch'](handleError(_0x1f8de2,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index dd5f9b7..9da8ab3 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 _0xc745=['request-promise','path','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger','bluebird'];(function(_0x1af469,_0x584d95){var _0x336171=function(_0x574e25){while(--_0x574e25){_0x1af469['push'](_0x1af469['shift']());}};_0x336171(++_0x584d95);}(_0xc745,0x132));var _0x5c74=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc745[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5c74('0x0'));var util=require(_0x5c74('0x1'));var logger=require(_0x5c74('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5c74('0x3'));var rp=require(_0x5c74('0x4'));var fs=require('fs');var path=require(_0x5c74('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5c74('0x6'));module[_0x5c74('0x7')]=function(_0x1d2dbc,_0x51002c){return _0x1d2dbc['define'](_0x5c74('0x8'),attributes,{'tableName':_0x5c74('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe08=['tools_templates','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./template.attributes','exports','define'];(function(_0x56632b,_0x1a066a){var _0x57a626=function(_0x35f297){while(--_0x35f297){_0x56632b['push'](_0x56632b['shift']());}};_0x57a626(++_0x1a066a);}(_0xfe08,0x140));var _0x8fe0=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0xfe08[_0x301ca3];return _0x131292;};'use strict';var _=require(_0x8fe0('0x0'));var util=require(_0x8fe0('0x1'));var logger=require(_0x8fe0('0x2'))('api');var moment=require(_0x8fe0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8fe0('0x4'));var rimraf=require(_0x8fe0('0x5'));var config=require(_0x8fe0('0x6'));var attributes=require(_0x8fe0('0x7'));module[_0x8fe0('0x8')]=function(_0x527783,_0x3d1187){return _0x527783[_0x8fe0('0x9')]('Template',attributes,{'tableName':_0x8fe0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7794ed1..d046272 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 _0x9831=['raw','where','limit','include','model','attributes','map','GetTemplate','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Template','options'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x9831,0xf8));var _0x1983=function(_0x37ad1b,_0x512c69){_0x37ad1b=_0x37ad1b-0x0;var _0x3babbf=_0x9831[_0x37ad1b];return _0x3babbf;};'use strict';var _=require(_0x1983('0x0'));var util=require(_0x1983('0x1'));var moment=require(_0x1983('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1983('0x3'));var db=require(_0x1983('0x4'))['db'];var utils=require(_0x1983('0x5'));var logger=require(_0x1983('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1983('0x7'));var client=jayson[_0x1983('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1885fa,_0x17337f,_0x45dc42){return new BPromise(function(_0x1054ce,_0x1f6289){return client['request'](_0x1885fa,_0x45dc42)['then'](function(_0x4ba2f3){logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,'request\x20sent');logger[_0x1983('0xb')](_0x1983('0xc'),_0x17337f,_0x1983('0xd'),JSON[_0x1983('0xe')](_0x4ba2f3));if(_0x4ba2f3[_0x1983('0xf')]){if(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x10')]===0x1f4){logger[_0x1983('0xf')]('Template,\x20%s,\x20%s',_0x17337f,_0x4ba2f3['error'][_0x1983('0x11')]);return _0x1f6289(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}logger['error'](_0x1983('0xa'),_0x17337f,_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);return _0x1054ce(_0x4ba2f3[_0x1983('0xf')][_0x1983('0x11')]);}else{logger[_0x1983('0x9')](_0x1983('0xa'),_0x17337f,_0x1983('0xd'));_0x1054ce(_0x4ba2f3[_0x1983('0x12')][_0x1983('0x11')]);}})[_0x1983('0x13')](function(_0x297e42){logger[_0x1983('0xf')](_0x1983('0xa'),_0x17337f,_0x297e42);_0x1f6289(_0x297e42);});});}exports['GetTemplate']=function(_0xba2f09){var _0x22534=this;return new Promise(function(_0xc999f0,_0x25b19c){return db[_0x1983('0x14')]['findAll']({'raw':_0xba2f09[_0x1983('0x15')]?_0xba2f09['options'][_0x1983('0x16')]===undefined?!![]:![]:!![],'where':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x17')]||null:null,'attributes':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')]['attributes']||null:null,'limit':_0xba2f09[_0x1983('0x15')]?_0xba2f09[_0x1983('0x15')][_0x1983('0x18')]||null:null,'include':_0xba2f09['options']?_0xba2f09[_0x1983('0x15')][_0x1983('0x19')]?_['map'](_0xba2f09[_0x1983('0x15')][_0x1983('0x19')],function(_0xfebaa9){return{'model':db[_0xfebaa9[_0x1983('0x1a')]],'as':_0xfebaa9['as'],'attributes':_0xfebaa9[_0x1983('0x1b')],'include':_0xfebaa9[_0x1983('0x19')]?_[_0x1983('0x1c')](_0xfebaa9[_0x1983('0x19')],function(_0xf740b0){return{'model':db[_0xf740b0[_0x1983('0x1a')]],'as':_0xf740b0['as'],'attributes':_0xf740b0[_0x1983('0x1b')],'include':_0xf740b0['include']?_[_0x1983('0x1c')](_0xf740b0[_0x1983('0x19')],function(_0x4d59f4){return{'model':db[_0x4d59f4[_0x1983('0x1a')]],'as':_0x4d59f4['as'],'attributes':_0x4d59f4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4837cd){logger[_0x1983('0x9')](_0x1983('0x1d'),_0xba2f09);logger[_0x1983('0xb')](_0x1983('0x1d'),_0xba2f09,JSON[_0x1983('0xe')](_0x4837cd));_0xc999f0(_0x4837cd);})[_0x1983('0x13')](function(_0x4f0d48){logger['error']('GetTemplate',_0x4f0d48['message'],_0xba2f09);_0x25b19c(_0x22534['error'](0x1f4,_0x4f0d48[_0x1983('0x11')]));});});}; \ No newline at end of file +var _0x4ee7=['limit','map','include','model','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','attributes'];(function(_0x3aabbf,_0x4f6982){var _0x2c7502=function(_0x220c94){while(--_0x220c94){_0x3aabbf['push'](_0x3aabbf['shift']());}};_0x2c7502(++_0x4f6982);}(_0x4ee7,0x9a));var _0x74ee=function(_0x5c56a9,_0x19f266){_0x5c56a9=_0x5c56a9-0x0;var _0x2cfdbd=_0x4ee7[_0x5c56a9];return _0x2cfdbd;};'use strict';var _=require(_0x74ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x74ee('0x1'));var rs=require(_0x74ee('0x2'));var fs=require('fs');var Redis=require(_0x74ee('0x3'));var db=require(_0x74ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x74ee('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x74ee('0x6')][_0x74ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe1f4ef,_0x37d76a,_0x29218a){return new BPromise(function(_0x3d5268,_0x461ef2){return client[_0x74ee('0x8')](_0xe1f4ef,_0x29218a)[_0x74ee('0x9')](function(_0x2a02a9){logger[_0x74ee('0xa')](_0x74ee('0xb'),_0x37d76a,_0x74ee('0xc'));logger[_0x74ee('0xd')](_0x74ee('0xe'),_0x37d76a,_0x74ee('0xc'),JSON[_0x74ee('0xf')](_0x2a02a9));if(_0x2a02a9['error']){if(_0x2a02a9[_0x74ee('0x10')][_0x74ee('0x11')]===0x1f4){logger[_0x74ee('0x10')](_0x74ee('0xb'),_0x37d76a,_0x2a02a9['error'][_0x74ee('0x12')]);return _0x461ef2(_0x2a02a9[_0x74ee('0x10')][_0x74ee('0x12')]);}logger[_0x74ee('0x10')](_0x74ee('0xb'),_0x37d76a,_0x2a02a9[_0x74ee('0x10')][_0x74ee('0x12')]);return _0x3d5268(_0x2a02a9[_0x74ee('0x10')]['message']);}else{logger[_0x74ee('0xa')](_0x74ee('0xb'),_0x37d76a,'request\x20sent');_0x3d5268(_0x2a02a9[_0x74ee('0x13')][_0x74ee('0x12')]);}})[_0x74ee('0x14')](function(_0x499b3e){logger['error'](_0x74ee('0xb'),_0x37d76a,_0x499b3e);_0x461ef2(_0x499b3e);});});}exports[_0x74ee('0x15')]=function(_0x33486a){var _0x2b8a27=this;return new Promise(function(_0x2fa19a,_0x5dc42a){return db['Template'][_0x74ee('0x16')]({'raw':_0x33486a[_0x74ee('0x17')]?_0x33486a[_0x74ee('0x17')][_0x74ee('0x18')]===undefined?!![]:![]:!![],'where':_0x33486a[_0x74ee('0x17')]?_0x33486a[_0x74ee('0x17')]['where']||null:null,'attributes':_0x33486a[_0x74ee('0x17')]?_0x33486a[_0x74ee('0x17')][_0x74ee('0x19')]||null:null,'limit':_0x33486a['options']?_0x33486a[_0x74ee('0x17')][_0x74ee('0x1a')]||null:null,'include':_0x33486a[_0x74ee('0x17')]?_0x33486a['options']['include']?_[_0x74ee('0x1b')](_0x33486a[_0x74ee('0x17')][_0x74ee('0x1c')],function(_0x2d5bc1){return{'model':db[_0x2d5bc1['model']],'as':_0x2d5bc1['as'],'attributes':_0x2d5bc1[_0x74ee('0x19')],'include':_0x2d5bc1['include']?_[_0x74ee('0x1b')](_0x2d5bc1[_0x74ee('0x1c')],function(_0x428a2c){return{'model':db[_0x428a2c[_0x74ee('0x1d')]],'as':_0x428a2c['as'],'attributes':_0x428a2c[_0x74ee('0x19')],'include':_0x428a2c[_0x74ee('0x1c')]?_[_0x74ee('0x1b')](_0x428a2c[_0x74ee('0x1c')],function(_0x3f1c5e){return{'model':db[_0x3f1c5e[_0x74ee('0x1d')]],'as':_0x3f1c5e['as'],'attributes':_0x3f1c5e[_0x74ee('0x19')]};}):[]};}):[]};}):[]:[]})[_0x74ee('0x9')](function(_0x363dee){logger[_0x74ee('0xa')](_0x74ee('0x15'),_0x33486a);logger[_0x74ee('0xd')](_0x74ee('0x15'),_0x33486a,JSON[_0x74ee('0xf')](_0x363dee));_0x2fa19a(_0x363dee);})[_0x74ee('0x14')](function(_0x5e5b05){logger['error']('GetTemplate',_0x5e5b05[_0x74ee('0x12')],_0x33486a);_0x5dc42a(_0x2b8a27[_0x74ee('0x10')](0x1f4,_0x5e5b05['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 4d47f66..326ea44 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 _0x8897=['addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition'];(function(_0x1eb115,_0x37d12b){var _0x54a74f=function(_0x102f5b){while(--_0x102f5b){_0x1eb115['push'](_0x1eb115['shift']());}};_0x54a74f(++_0x37d12b);}(_0x8897,0x132));var _0x7889=function(_0x58b23d,_0x57cf15){_0x58b23d=_0x58b23d-0x0;var _0x6761e3=_0x8897[_0x58b23d];return _0x6761e3;};'use strict';var multer=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var path=require(_0x7889('0x2'));var timeout=require(_0x7889('0x3'));var express=require(_0x7889('0x4'));var router=express[_0x7889('0x5')]();var fs_extra=require(_0x7889('0x6'));var auth=require(_0x7889('0x7'));var interaction=require(_0x7889('0x8'));var config=require(_0x7889('0x9'));var controller=require(_0x7889('0xa'));router[_0x7889('0xb')]('/',auth[_0x7889('0xc')](),controller[_0x7889('0xd')]);router[_0x7889('0xb')](_0x7889('0xe'),auth['isAuthenticated'](),controller[_0x7889('0xf')]);router[_0x7889('0xb')](_0x7889('0x10'),auth['isAuthenticated'](),controller[_0x7889('0x11')]);router['get'](_0x7889('0x12'),auth[_0x7889('0xc')](),controller['getAnyConditions']);router[_0x7889('0xb')](_0x7889('0x13'),auth['isAuthenticated'](),controller[_0x7889('0x14')]);router[_0x7889('0x15')]('/',auth[_0x7889('0xc')](),controller['create']);router[_0x7889('0x15')](_0x7889('0x10'),auth['isAuthenticated'](),controller[_0x7889('0x16')]);router[_0x7889('0x15')](_0x7889('0x12'),auth[_0x7889('0xc')](),controller[_0x7889('0x17')]);router[_0x7889('0x15')]('/:id/actions',auth['isAuthenticated'](),controller[_0x7889('0x18')]);router[_0x7889('0x19')](_0x7889('0xe'),auth[_0x7889('0xc')](),controller[_0x7889('0x1a')]);router[_0x7889('0x1b')](_0x7889('0xe'),auth[_0x7889('0xc')](),controller[_0x7889('0x1c')]);module[_0x7889('0x1d')]=router; \ No newline at end of file +var _0x6f75=['/:id/actions','getActions','post','create','addAllCondition','addAnyCondition','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trigger.controller','get','/:id','show','isAuthenticated','getAllConditions','/:id/any_conditions','getAnyConditions'];(function(_0x2ff8f1,_0xc190e3){var _0xa78fea=function(_0x10dc51){while(--_0x10dc51){_0x2ff8f1['push'](_0x2ff8f1['shift']());}};_0xa78fea(++_0xc190e3);}(_0x6f75,0x71));var _0x56f7=function(_0x2190af,_0x3d98d2){_0x2190af=_0x2190af-0x0;var _0x287463=_0x6f75[_0x2190af];return _0x287463;};'use strict';var multer=require(_0x56f7('0x0'));var util=require(_0x56f7('0x1'));var path=require(_0x56f7('0x2'));var timeout=require(_0x56f7('0x3'));var express=require(_0x56f7('0x4'));var router=express[_0x56f7('0x5')]();var fs_extra=require(_0x56f7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x56f7('0x7'));var config=require(_0x56f7('0x8'));var controller=require(_0x56f7('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x56f7('0xa')](_0x56f7('0xb'),auth['isAuthenticated'](),controller[_0x56f7('0xc')]);router['get']('/:id/all_conditions',auth[_0x56f7('0xd')](),controller[_0x56f7('0xe')]);router[_0x56f7('0xa')](_0x56f7('0xf'),auth[_0x56f7('0xd')](),controller[_0x56f7('0x10')]);router[_0x56f7('0xa')](_0x56f7('0x11'),auth[_0x56f7('0xd')](),controller[_0x56f7('0x12')]);router[_0x56f7('0x13')]('/',auth[_0x56f7('0xd')](),controller[_0x56f7('0x14')]);router[_0x56f7('0x13')]('/:id/all_conditions',auth[_0x56f7('0xd')](),controller[_0x56f7('0x15')]);router[_0x56f7('0x13')](_0x56f7('0xf'),auth[_0x56f7('0xd')](),controller[_0x56f7('0x16')]);router[_0x56f7('0x13')](_0x56f7('0x11'),auth[_0x56f7('0xd')](),controller['addAction']);router['put'](_0x56f7('0xb'),auth[_0x56f7('0xd')](),controller[_0x56f7('0x17')]);router[_0x56f7('0x18')](_0x56f7('0xb'),auth[_0x56f7('0xd')](),controller['destroy']);module[_0x56f7('0x19')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index ff0a1f9..2cde4c2 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 _0xfcfc=['STRING','exports'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x33a257,_0x2e1a26){_0x33a257=_0x33a257-0x0;var _0x3bfd1e=_0xfcfc[_0x33a257];return _0x3bfd1e;};'use strict';var Sequelize=require('sequelize');module[_0xcfcf('0x0')]={'name':{'type':Sequelize[_0xcfcf('0x1')]},'channel':{'type':Sequelize[_0xcfcf('0x1')]},'description':{'type':Sequelize[_0xcfcf('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9f38=['BOOLEAN','sequelize','exports','STRING'];(function(_0x59ae79,_0x5b78bd){var _0x24a2c8=function(_0x1c1e1d){while(--_0x1c1e1d){_0x59ae79['push'](_0x59ae79['shift']());}};_0x24a2c8(++_0x5b78bd);}(_0x9f38,0xc9));var _0x89f3=function(_0x3115fe,_0x7c86ee){_0x3115fe=_0x3115fe-0x0;var _0x13e3f2=_0x9f38[_0x3115fe];return _0x13e3f2;};'use strict';var Sequelize=require(_0x89f3('0x0'));module[_0x89f3('0x1')]={'name':{'type':Sequelize[_0x89f3('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x89f3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 187f3a7..5ad96dd 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 _0xc8e6=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','reject','save','update','then','get','Triggers','destroy','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','order','getAnyConditions','findOne','pick','addAction','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xc8e6,0x112));var _0x6c8e=function(_0x168466,_0x5f37e5){_0x168466=_0x168466-0x0;var _0xcf8a4=_0xc8e6[_0x168466];return _0xcf8a4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c8e('0x0'));var zipdir=require(_0x6c8e('0x1'));var jsonpatch=require(_0x6c8e('0x2'));var rp=require('request-promise');var moment=require(_0x6c8e('0x3'));var BPromise=require(_0x6c8e('0x4'));var Mustache=require('mustache');var util=require(_0x6c8e('0x5'));var path=require(_0x6c8e('0x6'));var sox=require(_0x6c8e('0x7'));var csv=require('to-csv');var ejs=require(_0x6c8e('0x8'));var fs=require('fs');var fs_extra=require(_0x6c8e('0x9'));var _=require(_0x6c8e('0xa'));var squel=require(_0x6c8e('0xb'));var crypto=require(_0x6c8e('0xc'));var jsforce=require(_0x6c8e('0xd'));var deskjs=require(_0x6c8e('0xe'));var toCsv=require(_0x6c8e('0xf'));var querystring=require(_0x6c8e('0x10'));var Papa=require(_0x6c8e('0x11'));var Redis=require(_0x6c8e('0x12'));var authService=require(_0x6c8e('0x13'));var qs=require(_0x6c8e('0x14'));var as=require(_0x6c8e('0x15'));var hardwareService=require(_0x6c8e('0x16'));var logger=require('../../config/logger')(_0x6c8e('0x17'));var utils=require(_0x6c8e('0x18'));var config=require(_0x6c8e('0x19'));var licenseUtil=require(_0x6c8e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b790c,_0x4594bf){_0x4594bf=_0x4594bf||0xcc;return function(_0x5eb295){if(_0x5eb295){return _0x5b790c[_0x6c8e('0x1b')](_0x4594bf);}return _0x5b790c['status'](_0x4594bf)[_0x6c8e('0x1c')]();};}function respondWithResult(_0x386711,_0x32eb30){_0x32eb30=_0x32eb30||0xc8;return function(_0x239e52){if(_0x239e52){return _0x386711['status'](_0x32eb30)[_0x6c8e('0x1d')](_0x239e52);}};}function respondWithFilteredResult(_0x5db1e1,_0x2348aa){return function(_0x6ea0d4){if(_0x6ea0d4){var _0x1b43f9=typeof _0x2348aa['offset']===_0x6c8e('0x1e')&&typeof _0x2348aa['limit']==='undefined';var _0x332144=_0x6ea0d4[_0x6c8e('0x1f')];var _0x356ce4=_0x1b43f9?0x0:_0x2348aa[_0x6c8e('0x20')];var _0xe31d3e=_0x1b43f9?_0x6ea0d4[_0x6c8e('0x1f')]:_0x2348aa[_0x6c8e('0x20')]+_0x2348aa[_0x6c8e('0x21')];var _0x4552b2;if(_0xe31d3e>=_0x332144){_0xe31d3e=_0x332144;_0x4552b2=0xc8;}else{_0x4552b2=0xce;}_0x5db1e1[_0x6c8e('0x22')](_0x4552b2);return _0x5db1e1[_0x6c8e('0x23')]('Content-Range',_0x356ce4+'-'+_0xe31d3e+'/'+_0x332144)[_0x6c8e('0x1d')](_0x6ea0d4);}return null;};}function patchUpdates(_0x4aaaaa){return function(_0x8b47c3){try{jsonpatch[_0x6c8e('0x24')](_0x8b47c3,_0x4aaaaa,!![]);}catch(_0x16ea16){return BPromise[_0x6c8e('0x25')](_0x16ea16);}return _0x8b47c3[_0x6c8e('0x26')]();};}function saveUpdates(_0xc60e0,_0x1c9fc2){return function(_0x6941b8){if(_0x6941b8){return _0x6941b8[_0x6c8e('0x27')](_0xc60e0)[_0x6c8e('0x28')](function(_0xf4309f){return _0xf4309f;});}return null;};}function removeEntity(_0x10cab7,_0x5ae557){return function(_0x2d79f4){if(_0x2d79f4){return _0x2d79f4['destroy']()['then'](function(){var _0x344468=_0x2d79f4[_0x6c8e('0x29')]({'plain':!![]});var _0x1497b1=_0x6c8e('0x2a');return db['UserProfileResource'][_0x6c8e('0x2b')]({'where':{'type':_0x1497b1,'resourceId':_0x344468['id']}})[_0x6c8e('0x28')](function(){return _0x2d79f4;});})[_0x6c8e('0x28')](function(){_0x10cab7[_0x6c8e('0x22')](0xcc)[_0x6c8e('0x1c')]();});}};}function handleEntityNotFound(_0x14346d,_0xeb0c9e){return function(_0x3c1da0){if(!_0x3c1da0){_0x14346d['sendStatus'](0x194);}return _0x3c1da0;};}function handleError(_0x233b65,_0x2020cc){_0x2020cc=_0x2020cc||0x1f4;return function(_0x32c80f){logger[_0x6c8e('0x2c')](_0x32c80f[_0x6c8e('0x2d')]);if(_0x32c80f[_0x6c8e('0x2e')]){delete _0x32c80f[_0x6c8e('0x2e')];}_0x233b65[_0x6c8e('0x22')](_0x2020cc)[_0x6c8e('0x2f')](_0x32c80f);};}exports[_0x6c8e('0x30')]=function(_0x3c0e70,_0x455ee1){var _0x154ee7={},_0x47ca67={},_0x21da2a={'count':0x0,'rows':[]};var _0x4a9480=_[_0x6c8e('0x31')](db[_0x6c8e('0x32')][_0x6c8e('0x33')],function(_0x5e002d){return{'name':_0x5e002d[_0x6c8e('0x34')],'type':_0x5e002d[_0x6c8e('0x35')]['key']};});_0x47ca67[_0x6c8e('0x36')]=_[_0x6c8e('0x31')](_0x4a9480,_0x6c8e('0x2e'));_0x47ca67[_0x6c8e('0x37')]=_[_0x6c8e('0x38')](_0x3c0e70['query']);_0x47ca67[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x47ca67[_0x6c8e('0x36')],_0x47ca67[_0x6c8e('0x37')]);_0x154ee7[_0x6c8e('0x3b')]=_['intersection'](_0x47ca67[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x154ee7[_0x6c8e('0x3b')]=_0x154ee7[_0x6c8e('0x3b')][_0x6c8e('0x3d')]?_0x154ee7['attributes']:_0x47ca67[_0x6c8e('0x36')];if(!_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x3e')](_0x6c8e('0x3f'))){_0x154ee7[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x3c0e70[_0x6c8e('0x37')]['limit']);_0x154ee7[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x20')]);}_0x154ee7['order']=qs[_0x6c8e('0x40')](_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x154ee7[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_['pick'](_0x3c0e70['query'],_0x47ca67[_0x6c8e('0x39')]),_0x4a9480);if(_0x3c0e70[_0x6c8e('0x37')]['filter']){_0x154ee7[_0x6c8e('0x41')]=_[_0x6c8e('0x42')](_0x154ee7[_0x6c8e('0x41')],{'$or':_['map'](_0x4a9480,function(_0x4ade96){if(_0x4ade96[_0x6c8e('0x35')]!=='VIRTUAL'){var _0x7b1e5d={};_0x7b1e5d[_0x4ade96['name']]={'$like':'%'+_0x3c0e70[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x7b1e5d;}})});}_0x154ee7=_[_0x6c8e('0x42')]({},_0x154ee7,_0x3c0e70[_0x6c8e('0x44')]);var _0x2012f1={'where':_0x154ee7[_0x6c8e('0x41')]};return db[_0x6c8e('0x32')][_0x6c8e('0x1f')](_0x2012f1)[_0x6c8e('0x28')](function(_0x323dce){_0x21da2a[_0x6c8e('0x1f')]=_0x323dce;if(_0x3c0e70['query'][_0x6c8e('0x45')]){_0x154ee7[_0x6c8e('0x46')]=[{'all':!![]}];}return db[_0x6c8e('0x32')]['findAll'](_0x154ee7);})[_0x6c8e('0x28')](function(_0x293235){_0x21da2a[_0x6c8e('0x47')]=_0x293235;return _0x21da2a;})[_0x6c8e('0x28')](respondWithFilteredResult(_0x455ee1,_0x154ee7))[_0x6c8e('0x48')](handleError(_0x455ee1,null));};exports['show']=function(_0x2281f0,_0x5a1243){var _0xd0f905={'raw':![],'where':{'id':_0x2281f0[_0x6c8e('0x49')]['id']}},_0x21a519={};_0x21a519[_0x6c8e('0x36')]=_['keys'](db[_0x6c8e('0x32')]['rawAttributes']);_0x21a519['query']=_[_0x6c8e('0x38')](_0x2281f0['query']);_0x21a519[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x21a519['model'],_0x21a519[_0x6c8e('0x37')]);_0xd0f905['attributes']=_[_0x6c8e('0x3a')](_0x21a519[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x2281f0[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0xd0f905[_0x6c8e('0x3b')]=_0xd0f905[_0x6c8e('0x3b')]['length']?_0xd0f905[_0x6c8e('0x3b')]:_0x21a519[_0x6c8e('0x36')];if(_0x2281f0['query'][_0x6c8e('0x45')]){_0xd0f905[_0x6c8e('0x46')]=[{'all':!![]}];}_0xd0f905=_[_0x6c8e('0x42')]({},_0xd0f905,_0x2281f0[_0x6c8e('0x44')]);return db[_0x6c8e('0x32')][_0x6c8e('0x4a')](_0xd0f905)['then'](handleEntityNotFound(_0x5a1243,null))[_0x6c8e('0x28')](respondWithResult(_0x5a1243,null))['catch'](handleError(_0x5a1243,null));};exports[_0x6c8e('0x4b')]=function(_0x830a6d,_0x5d8fff){return db[_0x6c8e('0x32')][_0x6c8e('0x4b')](_0x830a6d[_0x6c8e('0x4c')],{})[_0x6c8e('0x28')](function(_0x4c4d1d){var _0x4db0a6=_0x830a6d[_0x6c8e('0x4d')]['get']({'plain':!![]});if(!_0x4db0a6)throw new Error(_0x6c8e('0x4e'));if(_0x4db0a6[_0x6c8e('0x4f')]==='user'){var _0x5df005=_0x4c4d1d[_0x6c8e('0x29')]({'plain':!![]});var _0x48c769=_0x6c8e('0x2a');return db[_0x6c8e('0x50')]['find']({'where':{'name':_0x48c769,'userProfileId':_0x4db0a6[_0x6c8e('0x51')]},'raw':!![]})[_0x6c8e('0x28')](function(_0x5c7509){if(_0x5c7509&&_0x5c7509[_0x6c8e('0x52')]===0x0){return db[_0x6c8e('0x53')][_0x6c8e('0x4b')]({'name':_0x5df005['name'],'resourceId':_0x5df005['id'],'type':_0x5c7509[_0x6c8e('0x2e')],'sectionId':_0x5c7509['id']},{})[_0x6c8e('0x28')](function(){return _0x4c4d1d;});}else{return _0x4c4d1d;}})['catch'](function(_0x2bced7){logger[_0x6c8e('0x2c')](_0x6c8e('0x54'),_0x2bced7);throw _0x2bced7;});}return _0x4c4d1d;})[_0x6c8e('0x28')](respondWithResult(_0x5d8fff,0xc9))[_0x6c8e('0x48')](handleError(_0x5d8fff,null));};exports[_0x6c8e('0x27')]=function(_0x5d57de,_0x2ccd1d){if(_0x5d57de[_0x6c8e('0x4c')]['id']){delete _0x5d57de['body']['id'];}return db['Trigger'][_0x6c8e('0x4a')]({'where':{'id':_0x5d57de['params']['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x2ccd1d,null))[_0x6c8e('0x28')](saveUpdates(_0x5d57de[_0x6c8e('0x4c')],null))[_0x6c8e('0x28')](respondWithResult(_0x2ccd1d,null))[_0x6c8e('0x48')](handleError(_0x2ccd1d,null));};exports[_0x6c8e('0x2b')]=function(_0x4ebee8,_0x4db4f8){return db[_0x6c8e('0x32')]['find']({'where':{'id':_0x4ebee8[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x4db4f8,null))[_0x6c8e('0x28')](removeEntity(_0x4db4f8,null))[_0x6c8e('0x48')](handleError(_0x4db4f8,null));};exports['addAllCondition']=function(_0x532625,_0x4350af,_0x3d6035){if(_0x532625[_0x6c8e('0x4c')]['id']){delete _0x532625['body']['id'];}return db[_0x6c8e('0x32')][_0x6c8e('0x4a')]({'where':{'id':_0x532625[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x4350af,null))['then'](function(_0x27e99b){if(_0x27e99b){_0x532625['body']['TriggerAllId']=_0x27e99b['id'];return db[_0x6c8e('0x55')][_0x6c8e('0x4b')](_0x532625[_0x6c8e('0x4c')]);}})[_0x6c8e('0x28')](respondWithResult(_0x4350af,null))[_0x6c8e('0x48')](handleError(_0x4350af,null));};exports[_0x6c8e('0x56')]=function(_0x1414c2,_0xc002f8,_0x474be8){if(_0x1414c2[_0x6c8e('0x4c')]['id']){delete _0x1414c2[_0x6c8e('0x4c')]['id'];}return db['Trigger'][_0x6c8e('0x4a')]({'where':{'id':_0x1414c2[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0xc002f8,null))[_0x6c8e('0x28')](function(_0x14ef08){if(_0x14ef08){_0x1414c2[_0x6c8e('0x4c')][_0x6c8e('0x57')]=_0x14ef08['id'];return db['Condition'][_0x6c8e('0x4b')](_0x1414c2['body']);}})['then'](respondWithResult(_0xc002f8,null))[_0x6c8e('0x48')](handleError(_0xc002f8,null));};exports[_0x6c8e('0x58')]=function(_0x1a3612,_0x1c49bb,_0x22b830){var _0x34ba8b={};var _0x377b80={};var _0x8edb5f;var _0x406612;return db['Trigger']['findOne']({'where':{'id':_0x1a3612['params']['id']}})['then'](handleEntityNotFound(_0x1c49bb,null))[_0x6c8e('0x28')](function(_0x401e9c){if(_0x401e9c){_0x8edb5f=_0x401e9c;_0x377b80[_0x6c8e('0x36')]=_[_0x6c8e('0x38')](db[_0x6c8e('0x55')][_0x6c8e('0x33')]);_0x377b80['query']=_[_0x6c8e('0x38')](_0x1a3612[_0x6c8e('0x37')]);_0x377b80[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x377b80[_0x6c8e('0x36')],_0x377b80[_0x6c8e('0x37')]);_0x34ba8b[_0x6c8e('0x3b')]=_['intersection'](_0x377b80[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x1a3612['query'][_0x6c8e('0x3c')]));_0x34ba8b[_0x6c8e('0x3b')]=_0x34ba8b['attributes'][_0x6c8e('0x3d')]?_0x34ba8b[_0x6c8e('0x3b')]:_0x377b80['model'];_0x34ba8b[_0x6c8e('0x59')]=qs[_0x6c8e('0x40')](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x34ba8b['where']=qs[_0x6c8e('0x39')](_['pick'](_0x1a3612[_0x6c8e('0x37')],_0x377b80['filters']));if(_0x1a3612[_0x6c8e('0x37')]['filter']){_0x34ba8b['where']=_[_0x6c8e('0x42')](_0x34ba8b['where'],{'$or':_[_0x6c8e('0x31')](_0x34ba8b[_0x6c8e('0x3b')],function(_0x3ee78e){var _0x321fbb={};_0x321fbb[_0x3ee78e]={'$like':'%'+_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x321fbb;})});}_0x34ba8b=_[_0x6c8e('0x42')]({},_0x34ba8b,_0x1a3612[_0x6c8e('0x44')]);return _0x8edb5f[_0x6c8e('0x58')](_0x34ba8b);}})['then'](function(_0x50336b){if(_0x50336b){_0x406612=_0x50336b[_0x6c8e('0x3d')];if(!_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x3e')]('nolimit')){_0x34ba8b[_0x6c8e('0x21')]=qs['limit'](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x21')]);_0x34ba8b[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x1a3612[_0x6c8e('0x37')][_0x6c8e('0x20')]);}return _0x8edb5f['getAllConditions'](_0x34ba8b);}})[_0x6c8e('0x28')](function(_0x473844){if(_0x473844){return _0x473844?{'count':_0x406612,'rows':_0x473844}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x1c49bb,null))['catch'](handleError(_0x1c49bb,null));};exports[_0x6c8e('0x5a')]=function(_0x41be56,_0x28165c,_0x3440f4){var _0x5cf9d5={};var _0x5020fb={};var _0x1edbd3;var _0x5612d3;return db['Trigger'][_0x6c8e('0x5b')]({'where':{'id':_0x41be56[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x28165c,null))[_0x6c8e('0x28')](function(_0x20eb7e){if(_0x20eb7e){_0x1edbd3=_0x20eb7e;_0x5020fb['model']=_[_0x6c8e('0x38')](db[_0x6c8e('0x55')]['rawAttributes']);_0x5020fb['query']=_[_0x6c8e('0x38')](_0x41be56[_0x6c8e('0x37')]);_0x5020fb[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x5020fb[_0x6c8e('0x36')],_0x5020fb['query']);_0x5cf9d5[_0x6c8e('0x3b')]=_['intersection'](_0x5020fb['model'],qs[_0x6c8e('0x3c')](_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x5cf9d5[_0x6c8e('0x3b')]=_0x5cf9d5[_0x6c8e('0x3b')]['length']?_0x5cf9d5['attributes']:_0x5020fb['model'];_0x5cf9d5[_0x6c8e('0x59')]=qs[_0x6c8e('0x40')](_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x40')]);_0x5cf9d5[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_[_0x6c8e('0x5c')](_0x41be56['query'],_0x5020fb[_0x6c8e('0x39')]));if(_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x43')]){_0x5cf9d5[_0x6c8e('0x41')]=_[_0x6c8e('0x42')](_0x5cf9d5['where'],{'$or':_[_0x6c8e('0x31')](_0x5cf9d5[_0x6c8e('0x3b')],function(_0x2f3e52){var _0x5c0c72={};_0x5c0c72[_0x2f3e52]={'$like':'%'+_0x41be56['query'][_0x6c8e('0x43')]+'%'};return _0x5c0c72;})});}_0x5cf9d5=_[_0x6c8e('0x42')]({},_0x5cf9d5,_0x41be56[_0x6c8e('0x44')]);return _0x1edbd3[_0x6c8e('0x5a')](_0x5cf9d5);}})['then'](function(_0xc50836){if(_0xc50836){_0x5612d3=_0xc50836[_0x6c8e('0x3d')];if(!_0x41be56[_0x6c8e('0x37')][_0x6c8e('0x3e')]('nolimit')){_0x5cf9d5[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x41be56[_0x6c8e('0x37')]['limit']);_0x5cf9d5[_0x6c8e('0x20')]=qs[_0x6c8e('0x20')](_0x41be56['query'][_0x6c8e('0x20')]);}return _0x1edbd3[_0x6c8e('0x5a')](_0x5cf9d5);}})[_0x6c8e('0x28')](function(_0x591b8b){if(_0x591b8b){return _0x591b8b?{'count':_0x5612d3,'rows':_0x591b8b}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x28165c,null))['catch'](handleError(_0x28165c,null));};exports[_0x6c8e('0x5d')]=function(_0x56e8c1,_0x2e02bb,_0x4f67f7){if(_0x56e8c1[_0x6c8e('0x4c')]['id']){delete _0x56e8c1[_0x6c8e('0x4c')]['id'];}return db[_0x6c8e('0x32')][_0x6c8e('0x4a')]({'where':{'id':_0x56e8c1[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x2e02bb,null))[_0x6c8e('0x28')](function(_0x36e738){if(_0x36e738){_0x56e8c1[_0x6c8e('0x4c')]['TriggerId']=_0x36e738['id'];return db[_0x6c8e('0x5e')][_0x6c8e('0x4b')](_0x56e8c1[_0x6c8e('0x4c')]);}})[_0x6c8e('0x28')](respondWithResult(_0x2e02bb,null))[_0x6c8e('0x48')](handleError(_0x2e02bb,null));};exports[_0x6c8e('0x5f')]=function(_0x15994c,_0x13e932,_0x332017){var _0x12c3d2={};var _0x3cf99a={};var _0xab77b;var _0x135766;return db['Trigger'][_0x6c8e('0x5b')]({'where':{'id':_0x15994c[_0x6c8e('0x49')]['id']}})[_0x6c8e('0x28')](handleEntityNotFound(_0x13e932,null))[_0x6c8e('0x28')](function(_0x1b725b){if(_0x1b725b){_0xab77b=_0x1b725b;_0x3cf99a[_0x6c8e('0x36')]=_[_0x6c8e('0x38')](db[_0x6c8e('0x5e')][_0x6c8e('0x33')]);_0x3cf99a['query']=_['keys'](_0x15994c['query']);_0x3cf99a[_0x6c8e('0x39')]=_[_0x6c8e('0x3a')](_0x3cf99a[_0x6c8e('0x36')],_0x3cf99a[_0x6c8e('0x37')]);_0x12c3d2['attributes']=_['intersection'](_0x3cf99a[_0x6c8e('0x36')],qs[_0x6c8e('0x3c')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x3c')]));_0x12c3d2[_0x6c8e('0x3b')]=_0x12c3d2['attributes'][_0x6c8e('0x3d')]?_0x12c3d2[_0x6c8e('0x3b')]:_0x3cf99a['model'];_0x12c3d2['order']=qs[_0x6c8e('0x40')](_0x15994c[_0x6c8e('0x37')]['sort']);_0x12c3d2[_0x6c8e('0x41')]=qs[_0x6c8e('0x39')](_[_0x6c8e('0x5c')](_0x15994c[_0x6c8e('0x37')],_0x3cf99a[_0x6c8e('0x39')]));if(_0x15994c[_0x6c8e('0x37')]['filter']){_0x12c3d2[_0x6c8e('0x41')]=_['merge'](_0x12c3d2[_0x6c8e('0x41')],{'$or':_['map'](_0x12c3d2[_0x6c8e('0x3b')],function(_0x11d1f9){var _0x32774d={};_0x32774d[_0x11d1f9]={'$like':'%'+_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x43')]+'%'};return _0x32774d;})});}_0x12c3d2=_[_0x6c8e('0x42')]({},_0x12c3d2,_0x15994c[_0x6c8e('0x44')]);return _0xab77b[_0x6c8e('0x5f')](_0x12c3d2);}})['then'](function(_0x4b8b1b){if(_0x4b8b1b){_0x135766=_0x4b8b1b[_0x6c8e('0x3d')];if(!_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x3e')](_0x6c8e('0x3f'))){_0x12c3d2[_0x6c8e('0x21')]=qs[_0x6c8e('0x21')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x21')]);_0x12c3d2['offset']=qs[_0x6c8e('0x20')](_0x15994c[_0x6c8e('0x37')][_0x6c8e('0x20')]);}return _0xab77b[_0x6c8e('0x5f')](_0x12c3d2);}})[_0x6c8e('0x28')](function(_0x4355c8){if(_0x4355c8){return _0x4355c8?{'count':_0x135766,'rows':_0x4355c8}:null;}})[_0x6c8e('0x28')](respondWithResult(_0x13e932,null))['catch'](handleError(_0x13e932,null));}; \ No newline at end of file +var _0xb202=['rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','order','sort','length','getAnyConditions','nolimit','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','get','Triggers','error','name','send','index','map','Trigger'];(function(_0x5c4c6d,_0xaadcb2){var _0x304bbf=function(_0x4ce877){while(--_0x4ce877){_0x5c4c6d['push'](_0x5c4c6d['shift']());}};_0x304bbf(++_0xaadcb2);}(_0xb202,0xeb));var _0x2b20=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xb202[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0x2b20('0x0'));var rimraf=require(_0x2b20('0x1'));var zipdir=require(_0x2b20('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2b20('0x3'));var moment=require(_0x2b20('0x4'));var BPromise=require(_0x2b20('0x5'));var Mustache=require(_0x2b20('0x6'));var util=require(_0x2b20('0x7'));var path=require('path');var sox=require(_0x2b20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2b20('0x9'));var squel=require(_0x2b20('0xa'));var crypto=require(_0x2b20('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2b20('0xc'));var querystring=require('querystring');var Papa=require(_0x2b20('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2b20('0xe'));var as=require(_0x2b20('0xf'));var hardwareService=require(_0x2b20('0x10'));var logger=require(_0x2b20('0x11'))('api');var utils=require(_0x2b20('0x12'));var config=require(_0x2b20('0x13'));var licenseUtil=require(_0x2b20('0x14'));var db=require(_0x2b20('0x15'))['db'];function respondWithStatusCode(_0xfd19ee,_0x3b5fa0){_0x3b5fa0=_0x3b5fa0||0xcc;return function(_0x244f63){if(_0x244f63){return _0xfd19ee[_0x2b20('0x16')](_0x3b5fa0);}return _0xfd19ee['status'](_0x3b5fa0)[_0x2b20('0x17')]();};}function respondWithResult(_0xc30a18,_0x2daaae){_0x2daaae=_0x2daaae||0xc8;return function(_0x36e8e0){if(_0x36e8e0){return _0xc30a18[_0x2b20('0x18')](_0x2daaae)[_0x2b20('0x19')](_0x36e8e0);}};}function respondWithFilteredResult(_0x1b1522,_0x30d935){return function(_0x3ae697){if(_0x3ae697){var _0xa597d5=typeof _0x30d935[_0x2b20('0x1a')]==='undefined'&&typeof _0x30d935[_0x2b20('0x1b')]===_0x2b20('0x1c');var _0x5d1875=_0x3ae697['count'];var _0x3cf808=_0xa597d5?0x0:_0x30d935[_0x2b20('0x1a')];var _0x46e435=_0xa597d5?_0x3ae697[_0x2b20('0x1d')]:_0x30d935['offset']+_0x30d935[_0x2b20('0x1b')];var _0x46089c;if(_0x46e435>=_0x5d1875){_0x46e435=_0x5d1875;_0x46089c=0xc8;}else{_0x46089c=0xce;}_0x1b1522['status'](_0x46089c);return _0x1b1522[_0x2b20('0x1e')](_0x2b20('0x1f'),_0x3cf808+'-'+_0x46e435+'/'+_0x5d1875)[_0x2b20('0x19')](_0x3ae697);}return null;};}function patchUpdates(_0x496819){return function(_0x166c69){try{jsonpatch[_0x2b20('0x20')](_0x166c69,_0x496819,!![]);}catch(_0x60dfe4){return BPromise['reject'](_0x60dfe4);}return _0x166c69[_0x2b20('0x21')]();};}function saveUpdates(_0x2a0077,_0x189eba){return function(_0x151fbd){if(_0x151fbd){return _0x151fbd[_0x2b20('0x22')](_0x2a0077)[_0x2b20('0x23')](function(_0xd9e894){return _0xd9e894;});}return null;};}function removeEntity(_0x12fcba,_0x5bafb4){return function(_0x35a589){if(_0x35a589){return _0x35a589['destroy']()[_0x2b20('0x23')](function(){var _0x19e313=_0x35a589[_0x2b20('0x24')]({'plain':!![]});var _0xaf07f3=_0x2b20('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0xaf07f3,'resourceId':_0x19e313['id']}})['then'](function(){return _0x35a589;});})[_0x2b20('0x23')](function(){_0x12fcba[_0x2b20('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47aebd,_0x520f62){return function(_0xc198d6){if(!_0xc198d6){_0x47aebd['sendStatus'](0x194);}return _0xc198d6;};}function handleError(_0x20201b,_0x10a5ce){_0x10a5ce=_0x10a5ce||0x1f4;return function(_0x52fd65){logger[_0x2b20('0x26')](_0x52fd65['stack']);if(_0x52fd65[_0x2b20('0x27')]){delete _0x52fd65[_0x2b20('0x27')];}_0x20201b['status'](_0x10a5ce)[_0x2b20('0x28')](_0x52fd65);};}exports[_0x2b20('0x29')]=function(_0x2a374b,_0x1a54a4){var _0x1c59d6={},_0x264d50={},_0x194843={'count':0x0,'rows':[]};var _0x111792=_[_0x2b20('0x2a')](db[_0x2b20('0x2b')][_0x2b20('0x2c')],function(_0x853d63){return{'name':_0x853d63[_0x2b20('0x2d')],'type':_0x853d63[_0x2b20('0x2e')][_0x2b20('0x2f')]};});_0x264d50[_0x2b20('0x30')]=_[_0x2b20('0x2a')](_0x111792,_0x2b20('0x27'));_0x264d50[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x2a374b[_0x2b20('0x31')]);_0x264d50['filters']=_[_0x2b20('0x33')](_0x264d50['model'],_0x264d50[_0x2b20('0x31')]);_0x1c59d6[_0x2b20('0x34')]=_['intersection'](_0x264d50[_0x2b20('0x30')],qs[_0x2b20('0x35')](_0x2a374b[_0x2b20('0x31')][_0x2b20('0x35')]));_0x1c59d6[_0x2b20('0x34')]=_0x1c59d6[_0x2b20('0x34')]['length']?_0x1c59d6[_0x2b20('0x34')]:_0x264d50['model'];if(!_0x2a374b[_0x2b20('0x31')][_0x2b20('0x36')]('nolimit')){_0x1c59d6['limit']=qs['limit'](_0x2a374b[_0x2b20('0x31')][_0x2b20('0x1b')]);_0x1c59d6[_0x2b20('0x1a')]=qs['offset'](_0x2a374b['query'][_0x2b20('0x1a')]);}_0x1c59d6['order']=qs['sort'](_0x2a374b['query']['sort']);_0x1c59d6[_0x2b20('0x37')]=qs['filters'](_[_0x2b20('0x38')](_0x2a374b['query'],_0x264d50[_0x2b20('0x39')]),_0x111792);if(_0x2a374b[_0x2b20('0x31')][_0x2b20('0x3a')]){_0x1c59d6[_0x2b20('0x37')]=_[_0x2b20('0x3b')](_0x1c59d6['where'],{'$or':_[_0x2b20('0x2a')](_0x111792,function(_0x21280b){if(_0x21280b[_0x2b20('0x2e')]!==_0x2b20('0x3c')){var _0x2539b3={};_0x2539b3[_0x21280b[_0x2b20('0x27')]]={'$like':'%'+_0x2a374b[_0x2b20('0x31')][_0x2b20('0x3a')]+'%'};return _0x2539b3;}})});}_0x1c59d6=_['merge']({},_0x1c59d6,_0x2a374b['options']);var _0x1ad9ce={'where':_0x1c59d6[_0x2b20('0x37')]};return db['Trigger'][_0x2b20('0x1d')](_0x1ad9ce)['then'](function(_0x3e7c08){_0x194843[_0x2b20('0x1d')]=_0x3e7c08;if(_0x2a374b['query'][_0x2b20('0x3d')]){_0x1c59d6[_0x2b20('0x3e')]=[{'all':!![]}];}return db[_0x2b20('0x2b')]['findAll'](_0x1c59d6);})[_0x2b20('0x23')](function(_0x32c201){_0x194843[_0x2b20('0x3f')]=_0x32c201;return _0x194843;})[_0x2b20('0x23')](respondWithFilteredResult(_0x1a54a4,_0x1c59d6))[_0x2b20('0x40')](handleError(_0x1a54a4,null));};exports[_0x2b20('0x41')]=function(_0x5a491f,_0x2c96e4){var _0x5e73af={'raw':![],'where':{'id':_0x5a491f[_0x2b20('0x42')]['id']}},_0x51b90d={};_0x51b90d[_0x2b20('0x30')]=_[_0x2b20('0x32')](db[_0x2b20('0x2b')][_0x2b20('0x2c')]);_0x51b90d[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x5a491f[_0x2b20('0x31')]);_0x51b90d[_0x2b20('0x39')]=_[_0x2b20('0x33')](_0x51b90d[_0x2b20('0x30')],_0x51b90d[_0x2b20('0x31')]);_0x5e73af['attributes']=_[_0x2b20('0x33')](_0x51b90d[_0x2b20('0x30')],qs['fields'](_0x5a491f[_0x2b20('0x31')][_0x2b20('0x35')]));_0x5e73af['attributes']=_0x5e73af['attributes']['length']?_0x5e73af['attributes']:_0x51b90d['model'];if(_0x5a491f[_0x2b20('0x31')][_0x2b20('0x3d')]){_0x5e73af[_0x2b20('0x3e')]=[{'all':!![]}];}_0x5e73af=_['merge']({},_0x5e73af,_0x5a491f[_0x2b20('0x43')]);return db[_0x2b20('0x2b')][_0x2b20('0x44')](_0x5e73af)[_0x2b20('0x23')](handleEntityNotFound(_0x2c96e4,null))[_0x2b20('0x23')](respondWithResult(_0x2c96e4,null))[_0x2b20('0x40')](handleError(_0x2c96e4,null));};exports[_0x2b20('0x45')]=function(_0x538073,_0x373603){return db[_0x2b20('0x2b')][_0x2b20('0x45')](_0x538073['body'],{})[_0x2b20('0x23')](function(_0x3e41ff){var _0x518678=_0x538073[_0x2b20('0x46')][_0x2b20('0x24')]({'plain':!![]});if(!_0x518678)throw new Error(_0x2b20('0x47'));if(_0x518678['role']===_0x2b20('0x46')){var _0x2e71af=_0x3e41ff[_0x2b20('0x24')]({'plain':!![]});var _0x2afd5d='Triggers';return db[_0x2b20('0x48')]['find']({'where':{'name':_0x2afd5d,'userProfileId':_0x518678[_0x2b20('0x49')]},'raw':!![]})['then'](function(_0xc9696e){if(_0xc9696e&&_0xc9696e[_0x2b20('0x4a')]===0x0){return db[_0x2b20('0x4b')][_0x2b20('0x45')]({'name':_0x2e71af[_0x2b20('0x27')],'resourceId':_0x2e71af['id'],'type':_0xc9696e['name'],'sectionId':_0xc9696e['id']},{})[_0x2b20('0x23')](function(){return _0x3e41ff;});}else{return _0x3e41ff;}})['catch'](function(_0x4d5a13){logger[_0x2b20('0x26')](_0x2b20('0x4c'),_0x4d5a13);throw _0x4d5a13;});}return _0x3e41ff;})[_0x2b20('0x23')](respondWithResult(_0x373603,0xc9))[_0x2b20('0x40')](handleError(_0x373603,null));};exports[_0x2b20('0x22')]=function(_0x1100b0,_0x31a7dc){if(_0x1100b0['body']['id']){delete _0x1100b0['body']['id'];}return db[_0x2b20('0x2b')][_0x2b20('0x44')]({'where':{'id':_0x1100b0[_0x2b20('0x42')]['id']}})['then'](handleEntityNotFound(_0x31a7dc,null))[_0x2b20('0x23')](saveUpdates(_0x1100b0[_0x2b20('0x4d')],null))[_0x2b20('0x23')](respondWithResult(_0x31a7dc,null))[_0x2b20('0x40')](handleError(_0x31a7dc,null));};exports[_0x2b20('0x4e')]=function(_0x525136,_0x583fe1){return db['Trigger'][_0x2b20('0x44')]({'where':{'id':_0x525136['params']['id']}})[_0x2b20('0x23')](handleEntityNotFound(_0x583fe1,null))[_0x2b20('0x23')](removeEntity(_0x583fe1,null))[_0x2b20('0x40')](handleError(_0x583fe1,null));};exports['addAllCondition']=function(_0x25210e,_0x439999,_0x4f8eb0){if(_0x25210e['body']['id']){delete _0x25210e['body']['id'];}return db[_0x2b20('0x2b')][_0x2b20('0x44')]({'where':{'id':_0x25210e[_0x2b20('0x42')]['id']}})[_0x2b20('0x23')](handleEntityNotFound(_0x439999,null))[_0x2b20('0x23')](function(_0x407125){if(_0x407125){_0x25210e[_0x2b20('0x4d')][_0x2b20('0x4f')]=_0x407125['id'];return db['Condition'][_0x2b20('0x45')](_0x25210e['body']);}})[_0x2b20('0x23')](respondWithResult(_0x439999,null))[_0x2b20('0x40')](handleError(_0x439999,null));};exports[_0x2b20('0x50')]=function(_0x5cf85b,_0x2256ce,_0xfcd224){if(_0x5cf85b[_0x2b20('0x4d')]['id']){delete _0x5cf85b[_0x2b20('0x4d')]['id'];}return db[_0x2b20('0x2b')][_0x2b20('0x44')]({'where':{'id':_0x5cf85b[_0x2b20('0x42')]['id']}})['then'](handleEntityNotFound(_0x2256ce,null))[_0x2b20('0x23')](function(_0x4cf8bd){if(_0x4cf8bd){_0x5cf85b[_0x2b20('0x4d')][_0x2b20('0x51')]=_0x4cf8bd['id'];return db[_0x2b20('0x52')]['create'](_0x5cf85b['body']);}})[_0x2b20('0x23')](respondWithResult(_0x2256ce,null))[_0x2b20('0x40')](handleError(_0x2256ce,null));};exports[_0x2b20('0x53')]=function(_0x745b40,_0x38de3a,_0x564775){var _0x265e90={};var _0x3978fa={};var _0x243643;var _0x36f41a;return db['Trigger'][_0x2b20('0x54')]({'where':{'id':_0x745b40[_0x2b20('0x42')]['id']}})[_0x2b20('0x23')](handleEntityNotFound(_0x38de3a,null))[_0x2b20('0x23')](function(_0x9f640e){if(_0x9f640e){_0x243643=_0x9f640e;_0x3978fa['model']=_[_0x2b20('0x32')](db['Condition'][_0x2b20('0x2c')]);_0x3978fa[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x745b40[_0x2b20('0x31')]);_0x3978fa['filters']=_[_0x2b20('0x33')](_0x3978fa[_0x2b20('0x30')],_0x3978fa[_0x2b20('0x31')]);_0x265e90[_0x2b20('0x34')]=_[_0x2b20('0x33')](_0x3978fa[_0x2b20('0x30')],qs['fields'](_0x745b40[_0x2b20('0x31')][_0x2b20('0x35')]));_0x265e90[_0x2b20('0x34')]=_0x265e90[_0x2b20('0x34')]['length']?_0x265e90['attributes']:_0x3978fa[_0x2b20('0x30')];_0x265e90[_0x2b20('0x55')]=qs[_0x2b20('0x56')](_0x745b40[_0x2b20('0x31')][_0x2b20('0x56')]);_0x265e90[_0x2b20('0x37')]=qs[_0x2b20('0x39')](_[_0x2b20('0x38')](_0x745b40[_0x2b20('0x31')],_0x3978fa[_0x2b20('0x39')]));if(_0x745b40[_0x2b20('0x31')][_0x2b20('0x3a')]){_0x265e90[_0x2b20('0x37')]=_['merge'](_0x265e90[_0x2b20('0x37')],{'$or':_[_0x2b20('0x2a')](_0x265e90[_0x2b20('0x34')],function(_0x537010){var _0x2dea59={};_0x2dea59[_0x537010]={'$like':'%'+_0x745b40['query'][_0x2b20('0x3a')]+'%'};return _0x2dea59;})});}_0x265e90=_[_0x2b20('0x3b')]({},_0x265e90,_0x745b40[_0x2b20('0x43')]);return _0x243643['getAllConditions'](_0x265e90);}})['then'](function(_0x4d6320){if(_0x4d6320){_0x36f41a=_0x4d6320[_0x2b20('0x57')];if(!_0x745b40[_0x2b20('0x31')][_0x2b20('0x36')]('nolimit')){_0x265e90[_0x2b20('0x1b')]=qs[_0x2b20('0x1b')](_0x745b40[_0x2b20('0x31')][_0x2b20('0x1b')]);_0x265e90['offset']=qs['offset'](_0x745b40[_0x2b20('0x31')][_0x2b20('0x1a')]);}return _0x243643[_0x2b20('0x53')](_0x265e90);}})[_0x2b20('0x23')](function(_0x28c676){if(_0x28c676){return _0x28c676?{'count':_0x36f41a,'rows':_0x28c676}:null;}})[_0x2b20('0x23')](respondWithResult(_0x38de3a,null))[_0x2b20('0x40')](handleError(_0x38de3a,null));};exports[_0x2b20('0x58')]=function(_0x4f6043,_0x7e37c5,_0x1736ef){var _0x558f74={};var _0x594f58={};var _0x1e5e4d;var _0x251b8f;return db['Trigger']['findOne']({'where':{'id':_0x4f6043[_0x2b20('0x42')]['id']}})[_0x2b20('0x23')](handleEntityNotFound(_0x7e37c5,null))['then'](function(_0x25c9c2){if(_0x25c9c2){_0x1e5e4d=_0x25c9c2;_0x594f58[_0x2b20('0x30')]=_[_0x2b20('0x32')](db[_0x2b20('0x52')][_0x2b20('0x2c')]);_0x594f58[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x4f6043['query']);_0x594f58['filters']=_[_0x2b20('0x33')](_0x594f58[_0x2b20('0x30')],_0x594f58[_0x2b20('0x31')]);_0x558f74[_0x2b20('0x34')]=_[_0x2b20('0x33')](_0x594f58[_0x2b20('0x30')],qs[_0x2b20('0x35')](_0x4f6043['query']['fields']));_0x558f74[_0x2b20('0x34')]=_0x558f74[_0x2b20('0x34')][_0x2b20('0x57')]?_0x558f74['attributes']:_0x594f58[_0x2b20('0x30')];_0x558f74[_0x2b20('0x55')]=qs[_0x2b20('0x56')](_0x4f6043[_0x2b20('0x31')][_0x2b20('0x56')]);_0x558f74[_0x2b20('0x37')]=qs['filters'](_[_0x2b20('0x38')](_0x4f6043['query'],_0x594f58[_0x2b20('0x39')]));if(_0x4f6043[_0x2b20('0x31')][_0x2b20('0x3a')]){_0x558f74[_0x2b20('0x37')]=_[_0x2b20('0x3b')](_0x558f74[_0x2b20('0x37')],{'$or':_['map'](_0x558f74[_0x2b20('0x34')],function(_0x3ac920){var _0x3fe1cc={};_0x3fe1cc[_0x3ac920]={'$like':'%'+_0x4f6043['query'][_0x2b20('0x3a')]+'%'};return _0x3fe1cc;})});}_0x558f74=_[_0x2b20('0x3b')]({},_0x558f74,_0x4f6043['options']);return _0x1e5e4d[_0x2b20('0x58')](_0x558f74);}})[_0x2b20('0x23')](function(_0x3a5711){if(_0x3a5711){_0x251b8f=_0x3a5711[_0x2b20('0x57')];if(!_0x4f6043[_0x2b20('0x31')][_0x2b20('0x36')](_0x2b20('0x59'))){_0x558f74['limit']=qs[_0x2b20('0x1b')](_0x4f6043[_0x2b20('0x31')][_0x2b20('0x1b')]);_0x558f74[_0x2b20('0x1a')]=qs['offset'](_0x4f6043[_0x2b20('0x31')][_0x2b20('0x1a')]);}return _0x1e5e4d[_0x2b20('0x58')](_0x558f74);}})['then'](function(_0x24e196){if(_0x24e196){return _0x24e196?{'count':_0x251b8f,'rows':_0x24e196}:null;}})[_0x2b20('0x23')](respondWithResult(_0x7e37c5,null))[_0x2b20('0x40')](handleError(_0x7e37c5,null));};exports['addAction']=function(_0xe3c360,_0x590d8a,_0x1bae5e){if(_0xe3c360[_0x2b20('0x4d')]['id']){delete _0xe3c360['body']['id'];}return db[_0x2b20('0x2b')]['find']({'where':{'id':_0xe3c360[_0x2b20('0x42')]['id']}})[_0x2b20('0x23')](handleEntityNotFound(_0x590d8a,null))[_0x2b20('0x23')](function(_0x1ce5b7){if(_0x1ce5b7){_0xe3c360[_0x2b20('0x4d')][_0x2b20('0x5a')]=_0x1ce5b7['id'];return db[_0x2b20('0x5b')]['create'](_0xe3c360[_0x2b20('0x4d')]);}})[_0x2b20('0x23')](respondWithResult(_0x590d8a,null))[_0x2b20('0x40')](handleError(_0x590d8a,null));};exports[_0x2b20('0x5c')]=function(_0x37ec35,_0xac2966,_0x352d6b){var _0x2c0fa5={};var _0x558f22={};var _0x4a4f21;var _0x37c546;return db[_0x2b20('0x2b')][_0x2b20('0x54')]({'where':{'id':_0x37ec35[_0x2b20('0x42')]['id']}})['then'](handleEntityNotFound(_0xac2966,null))[_0x2b20('0x23')](function(_0x333ca3){if(_0x333ca3){_0x4a4f21=_0x333ca3;_0x558f22[_0x2b20('0x30')]=_[_0x2b20('0x32')](db[_0x2b20('0x5b')][_0x2b20('0x2c')]);_0x558f22[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x37ec35[_0x2b20('0x31')]);_0x558f22[_0x2b20('0x39')]=_[_0x2b20('0x33')](_0x558f22[_0x2b20('0x30')],_0x558f22[_0x2b20('0x31')]);_0x2c0fa5[_0x2b20('0x34')]=_[_0x2b20('0x33')](_0x558f22[_0x2b20('0x30')],qs[_0x2b20('0x35')](_0x37ec35['query'][_0x2b20('0x35')]));_0x2c0fa5[_0x2b20('0x34')]=_0x2c0fa5[_0x2b20('0x34')]['length']?_0x2c0fa5[_0x2b20('0x34')]:_0x558f22[_0x2b20('0x30')];_0x2c0fa5[_0x2b20('0x55')]=qs[_0x2b20('0x56')](_0x37ec35['query'][_0x2b20('0x56')]);_0x2c0fa5[_0x2b20('0x37')]=qs[_0x2b20('0x39')](_[_0x2b20('0x38')](_0x37ec35[_0x2b20('0x31')],_0x558f22[_0x2b20('0x39')]));if(_0x37ec35['query'][_0x2b20('0x3a')]){_0x2c0fa5[_0x2b20('0x37')]=_[_0x2b20('0x3b')](_0x2c0fa5[_0x2b20('0x37')],{'$or':_[_0x2b20('0x2a')](_0x2c0fa5['attributes'],function(_0xe26e76){var _0x5805c2={};_0x5805c2[_0xe26e76]={'$like':'%'+_0x37ec35['query'][_0x2b20('0x3a')]+'%'};return _0x5805c2;})});}_0x2c0fa5=_[_0x2b20('0x3b')]({},_0x2c0fa5,_0x37ec35['options']);return _0x4a4f21[_0x2b20('0x5c')](_0x2c0fa5);}})[_0x2b20('0x23')](function(_0x50a4be){if(_0x50a4be){_0x37c546=_0x50a4be['length'];if(!_0x37ec35[_0x2b20('0x31')][_0x2b20('0x36')](_0x2b20('0x59'))){_0x2c0fa5['limit']=qs[_0x2b20('0x1b')](_0x37ec35[_0x2b20('0x31')][_0x2b20('0x1b')]);_0x2c0fa5['offset']=qs['offset'](_0x37ec35['query'][_0x2b20('0x1a')]);}return _0x4a4f21[_0x2b20('0x5c')](_0x2c0fa5);}})['then'](function(_0x3209b1){if(_0x3209b1){return _0x3209b1?{'count':_0x37c546,'rows':_0x3209b1}:null;}})[_0x2b20('0x23')](respondWithResult(_0xac2966,null))['catch'](handleError(_0xac2966,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 956e056..1582cc9 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 _0x130d=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4f9baf,_0x17a0a1){var _0x5dd2dd=function(_0xc553ed){while(--_0xc553ed){_0x4f9baf['push'](_0x4f9baf['shift']());}};_0x5dd2dd(++_0x17a0a1);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa631=['./trigger.attributes','Trigger','tools_triggers','util','../../config/logger','api','bluebird','rimraf','../../config/environment'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0xa631,0xe4));var _0x1a63=function(_0xe49fdf,_0x1222e9){_0xe49fdf=_0xe49fdf-0x0;var _0x6faa66=_0xa631[_0xe49fdf];return _0x6faa66;};'use strict';var _=require('lodash');var util=require(_0x1a63('0x0'));var logger=require(_0x1a63('0x1'))(_0x1a63('0x2'));var moment=require('moment');var BPromise=require(_0x1a63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a63('0x4'));var config=require(_0x1a63('0x5'));var attributes=require(_0x1a63('0x6'));module['exports']=function(_0x51ff47,_0x5a2067){return _0x51ff47['define'](_0x1a63('0x7'),attributes,{'tableName':_0x1a63('0x8'),'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 e402cf8..4c57fcf 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 _0xb712=['request','then','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','Trigger','findAll','options','where','include','map','model','attributes','GetTrigger','ShowTrigger','find','raw','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x378891,_0x4e3e16){var _0xfbfda2=function(_0x3b7681){while(--_0x3b7681){_0x378891['push'](_0x378891['shift']());}};_0xfbfda2(++_0x4e3e16);}(_0xb712,0x129));var _0x2b71=function(_0x4d2248,_0x56403d){_0x4d2248=_0x4d2248-0x0;var _0x4ca283=_0xb712[_0x4d2248];return _0x4ca283;};'use strict';var _=require(_0x2b71('0x0'));var util=require('util');var moment=require(_0x2b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b71('0x2'));var fs=require('fs');var Redis=require(_0x2b71('0x3'));var db=require(_0x2b71('0x4'))['db'];var utils=require(_0x2b71('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b71('0x6'));var jayson=require(_0x2b71('0x7'));var client=jayson['client'][_0x2b71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e1635,_0x398016,_0x378d95){return new BPromise(function(_0x5da993,_0xd0252c){return client[_0x2b71('0x9')](_0x3e1635,_0x378d95)[_0x2b71('0xa')](function(_0xf2b09f){logger['info'](_0x2b71('0xb'),_0x398016,'request\x20sent');logger[_0x2b71('0xc')](_0x2b71('0xd'),_0x398016,_0x2b71('0xe'),JSON[_0x2b71('0xf')](_0xf2b09f));if(_0xf2b09f[_0x2b71('0x10')]){if(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x11')]===0x1f4){logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);return _0xd0252c(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);}logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);return _0x5da993(_0xf2b09f[_0x2b71('0x10')][_0x2b71('0x12')]);}else{logger[_0x2b71('0x13')](_0x2b71('0xb'),_0x398016,'request\x20sent');_0x5da993(_0xf2b09f[_0x2b71('0x14')][_0x2b71('0x12')]);}})[_0x2b71('0x15')](function(_0x42fa81){logger[_0x2b71('0x10')](_0x2b71('0xb'),_0x398016,_0x42fa81);_0xd0252c(_0x42fa81);});});}exports['GetTrigger']=function(_0x4cf03b){var _0x4dd7ad=this;return new Promise(function(_0x4ab14b,_0x16a586){return db[_0x2b71('0x16')][_0x2b71('0x17')]({'raw':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b['options'][_0x2b71('0x19')]||null:null,'attributes':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['attributes']||null:null,'limit':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b[_0x2b71('0x18')]['limit']||null:null,'include':_0x4cf03b[_0x2b71('0x18')]?_0x4cf03b['options'][_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x4cf03b[_0x2b71('0x18')][_0x2b71('0x1a')],function(_0x3cb273){return{'model':db[_0x3cb273[_0x2b71('0x1c')]],'as':_0x3cb273['as'],'attributes':_0x3cb273[_0x2b71('0x1d')],'include':_0x3cb273[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x3cb273[_0x2b71('0x1a')],function(_0x2ad5f7){return{'model':db[_0x2ad5f7[_0x2b71('0x1c')]],'as':_0x2ad5f7['as'],'attributes':_0x2ad5f7[_0x2b71('0x1d')],'include':_0x2ad5f7[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x2ad5f7['include'],function(_0x14e47a){return{'model':db[_0x14e47a[_0x2b71('0x1c')]],'as':_0x14e47a['as'],'attributes':_0x14e47a[_0x2b71('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2b71('0xa')](function(_0x3410c9){logger[_0x2b71('0x13')](_0x2b71('0x1e'),_0x4cf03b);logger['debug'](_0x2b71('0x1e'),_0x4cf03b,JSON[_0x2b71('0xf')](_0x3410c9));_0x4ab14b(_0x3410c9);})['catch'](function(_0x19e28f){logger[_0x2b71('0x10')](_0x2b71('0x1e'),_0x19e28f[_0x2b71('0x12')],_0x4cf03b);_0x16a586(_0x4dd7ad[_0x2b71('0x10')](0x1f4,_0x19e28f[_0x2b71('0x12')]));});});};exports[_0x2b71('0x1f')]=function(_0x16d773){var _0x52c857=this;return new Promise(function(_0x37ab13,_0x4b0da6){return db['Trigger'][_0x2b71('0x20')]({'raw':_0x16d773[_0x2b71('0x18')]?_0x16d773['options'][_0x2b71('0x21')]===undefined?!![]:![]:!![],'where':_0x16d773[_0x2b71('0x18')]?_0x16d773[_0x2b71('0x18')][_0x2b71('0x19')]||null:null,'attributes':_0x16d773[_0x2b71('0x18')]?_0x16d773[_0x2b71('0x18')][_0x2b71('0x1d')]||null:null,'include':_0x16d773['options']?_0x16d773[_0x2b71('0x18')]['include']?_['map'](_0x16d773[_0x2b71('0x18')][_0x2b71('0x1a')],function(_0x4672c3){return{'model':db[_0x4672c3[_0x2b71('0x1c')]],'as':_0x4672c3['as'],'attributes':_0x4672c3[_0x2b71('0x1d')],'include':_0x4672c3[_0x2b71('0x1a')]?_[_0x2b71('0x1b')](_0x4672c3[_0x2b71('0x1a')],function(_0x1d321f){return{'model':db[_0x1d321f['model']],'as':_0x1d321f['as'],'attributes':_0x1d321f[_0x2b71('0x1d')],'include':_0x1d321f['include']?_[_0x2b71('0x1b')](_0x1d321f[_0x2b71('0x1a')],function(_0x3b0f5d){return{'model':db[_0x3b0f5d['model']],'as':_0x3b0f5d['as'],'attributes':_0x3b0f5d[_0x2b71('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1274bc){logger[_0x2b71('0x13')](_0x2b71('0x1f'),_0x16d773);logger[_0x2b71('0xc')](_0x2b71('0x1f'),_0x16d773,JSON[_0x2b71('0xf')](_0x1274bc));_0x37ab13(_0x1274bc);})[_0x2b71('0x15')](function(_0x33f218){logger[_0x2b71('0x10')](_0x2b71('0x1f'),_0x33f218['message'],_0x16d773);_0x4b0da6(_0x52c857[_0x2b71('0x10')](0x1f4,_0x33f218[_0x2b71('0x12')]));});});}; \ No newline at end of file +var _0x913f=['code','message','result','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','catch','ShowTrigger','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1cba84,_0x265db3){var _0xafddf0=function(_0x5f0640){while(--_0x5f0640){_0x1cba84['push'](_0x1cba84['shift']());}};_0xafddf0(++_0x265db3);}(_0x913f,0xc4));var _0xf913=function(_0x2e042a,_0x3528d8){_0x2e042a=_0x2e042a-0x0;var _0x34a85b=_0x913f[_0x2e042a];return _0x34a85b;};'use strict';var _=require(_0xf913('0x0'));var util=require(_0xf913('0x1'));var moment=require(_0xf913('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf913('0x3'));var db=require(_0xf913('0x4'))['db'];var utils=require(_0xf913('0x5'));var logger=require(_0xf913('0x6'))(_0xf913('0x7'));var config=require('../../config/environment');var jayson=require(_0xf913('0x8'));var client=jayson[_0xf913('0x9')][_0xf913('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4171,_0x4ea1ff,_0x4da1ac){return new BPromise(function(_0x17d7e5,_0x15c4ce){return client[_0xf913('0xb')](_0x1c4171,_0x4da1ac)[_0xf913('0xc')](function(_0x132568){logger[_0xf913('0xd')](_0xf913('0xe'),_0x4ea1ff,_0xf913('0xf'));logger[_0xf913('0x10')](_0xf913('0x11'),_0x4ea1ff,'request\x20sent',JSON[_0xf913('0x12')](_0x132568));if(_0x132568[_0xf913('0x13')]){if(_0x132568[_0xf913('0x13')][_0xf913('0x14')]===0x1f4){logger['error'](_0xf913('0xe'),_0x4ea1ff,_0x132568['error'][_0xf913('0x15')]);return _0x15c4ce(_0x132568['error']['message']);}logger[_0xf913('0x13')](_0xf913('0xe'),_0x4ea1ff,_0x132568[_0xf913('0x13')][_0xf913('0x15')]);return _0x17d7e5(_0x132568[_0xf913('0x13')][_0xf913('0x15')]);}else{logger['info'](_0xf913('0xe'),_0x4ea1ff,_0xf913('0xf'));_0x17d7e5(_0x132568[_0xf913('0x16')][_0xf913('0x15')]);}})['catch'](function(_0x515f14){logger[_0xf913('0x13')](_0xf913('0xe'),_0x4ea1ff,_0x515f14);_0x15c4ce(_0x515f14);});});}exports[_0xf913('0x17')]=function(_0x2f348d){var _0x222f98=this;return new Promise(function(_0x41f52a,_0x5620c8){return db[_0xf913('0x18')]['findAll']({'raw':_0x2f348d['options']?_0x2f348d[_0xf913('0x19')][_0xf913('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f348d[_0xf913('0x19')]?_0x2f348d[_0xf913('0x19')][_0xf913('0x1b')]||null:null,'attributes':_0x2f348d[_0xf913('0x19')]?_0x2f348d[_0xf913('0x19')][_0xf913('0x1c')]||null:null,'limit':_0x2f348d[_0xf913('0x19')]?_0x2f348d['options'][_0xf913('0x1d')]||null:null,'include':_0x2f348d[_0xf913('0x19')]?_0x2f348d[_0xf913('0x19')]['include']?_['map'](_0x2f348d[_0xf913('0x19')][_0xf913('0x1e')],function(_0x20ab64){return{'model':db[_0x20ab64[_0xf913('0x1f')]],'as':_0x20ab64['as'],'attributes':_0x20ab64[_0xf913('0x1c')],'include':_0x20ab64[_0xf913('0x1e')]?_['map'](_0x20ab64[_0xf913('0x1e')],function(_0x573657){return{'model':db[_0x573657[_0xf913('0x1f')]],'as':_0x573657['as'],'attributes':_0x573657[_0xf913('0x1c')],'include':_0x573657[_0xf913('0x1e')]?_[_0xf913('0x20')](_0x573657[_0xf913('0x1e')],function(_0x4a87a3){return{'model':db[_0x4a87a3[_0xf913('0x1f')]],'as':_0x4a87a3['as'],'attributes':_0x4a87a3[_0xf913('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4440c8){logger[_0xf913('0xd')](_0xf913('0x17'),_0x2f348d);logger[_0xf913('0x10')](_0xf913('0x17'),_0x2f348d,JSON['stringify'](_0x4440c8));_0x41f52a(_0x4440c8);})[_0xf913('0x21')](function(_0x3ab4cf){logger['error']('GetTrigger',_0x3ab4cf[_0xf913('0x15')],_0x2f348d);_0x5620c8(_0x222f98[_0xf913('0x13')](0x1f4,_0x3ab4cf['message']));});});};exports[_0xf913('0x22')]=function(_0x2f8bae){var _0x271255=this;return new Promise(function(_0x193882,_0x3776ba){return db[_0xf913('0x18')][_0xf913('0x23')]({'raw':_0x2f8bae[_0xf913('0x19')]?_0x2f8bae[_0xf913('0x19')][_0xf913('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f8bae['options']?_0x2f8bae[_0xf913('0x19')]['where']||null:null,'attributes':_0x2f8bae[_0xf913('0x19')]?_0x2f8bae[_0xf913('0x19')][_0xf913('0x1c')]||null:null,'include':_0x2f8bae['options']?_0x2f8bae[_0xf913('0x19')]['include']?_[_0xf913('0x20')](_0x2f8bae[_0xf913('0x19')][_0xf913('0x1e')],function(_0x17e161){return{'model':db[_0x17e161[_0xf913('0x1f')]],'as':_0x17e161['as'],'attributes':_0x17e161[_0xf913('0x1c')],'include':_0x17e161['include']?_[_0xf913('0x20')](_0x17e161['include'],function(_0x566990){return{'model':db[_0x566990[_0xf913('0x1f')]],'as':_0x566990['as'],'attributes':_0x566990[_0xf913('0x1c')],'include':_0x566990[_0xf913('0x1e')]?_[_0xf913('0x20')](_0x566990[_0xf913('0x1e')],function(_0x4aceea){return{'model':db[_0x4aceea[_0xf913('0x1f')]],'as':_0x4aceea['as'],'attributes':_0x4aceea[_0xf913('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf913('0xc')](function(_0x45457e){logger['info'](_0xf913('0x22'),_0x2f8bae);logger[_0xf913('0x10')](_0xf913('0x22'),_0x2f8bae,JSON[_0xf913('0x12')](_0x45457e));_0x193882(_0x45457e);})['catch'](function(_0x25cc42){logger[_0xf913('0x13')]('ShowTrigger',_0x25cc42[_0xf913('0x15')],_0x2f8bae);_0x3776ba(_0x271255[_0xf913('0x13')](0x1f4,_0x25cc42['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 8e10479..8966e70 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 _0x447b=['clone','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','isAuthenticated','index','get','/:id','show','post','/:id/clone'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x447b,0x1a9));var _0xb447=function(_0x823eb3,_0x3bb3f3){_0x823eb3=_0x823eb3-0x0;var _0x1c946d=_0x447b[_0x823eb3];return _0x1c946d;};'use strict';var multer=require(_0xb447('0x0'));var util=require('util');var path=require(_0xb447('0x1'));var timeout=require(_0xb447('0x2'));var express=require(_0xb447('0x3'));var router=express[_0xb447('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth[_0xb447('0x5')](),controller[_0xb447('0x6')]);router[_0xb447('0x7')](_0xb447('0x8'),auth['isAuthenticated'](),controller[_0xb447('0x9')]);router[_0xb447('0xa')](_0xb447('0xb'),auth[_0xb447('0x5')](),controller[_0xb447('0xc')]);router[_0xb447('0xa')]('/',auth[_0xb447('0x5')](),controller[_0xb447('0xd')]);router[_0xb447('0xe')](_0xb447('0x8'),auth[_0xb447('0x5')](),controller[_0xb447('0xf')]);router[_0xb447('0x10')]('/:id',auth[_0xb447('0x5')](),controller[_0xb447('0x11')]);module[_0xb447('0x12')]=router; \ No newline at end of file +var _0x3f38=['isAuthenticated','show','post','/:id/clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x737a1f,_0x235fef){var _0x16eba1=function(_0x292aa8){while(--_0x292aa8){_0x737a1f['push'](_0x737a1f['shift']());}};_0x16eba1(++_0x235fef);}(_0x3f38,0x180));var _0x83f3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3f38[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x83f3('0x0'));var util=require(_0x83f3('0x1'));var path=require(_0x83f3('0x2'));var timeout=require(_0x83f3('0x3'));var express=require('express');var router=express[_0x83f3('0x4')]();var fs_extra=require(_0x83f3('0x5'));var auth=require(_0x83f3('0x6'));var interaction=require(_0x83f3('0x7'));var config=require(_0x83f3('0x8'));var controller=require('./trunk.controller');router[_0x83f3('0x9')]('/',auth['isAuthenticated'](),controller[_0x83f3('0xa')]);router[_0x83f3('0x9')](_0x83f3('0xb'),auth[_0x83f3('0xc')](),controller[_0x83f3('0xd')]);router[_0x83f3('0xe')](_0x83f3('0xf'),auth['isAuthenticated'](),controller['clone']);router['post']('/',auth['isAuthenticated'](),controller[_0x83f3('0x10')]);router[_0x83f3('0x11')](_0x83f3('0xb'),auth[_0x83f3('0xc')](),controller[_0x83f3('0x12')]);router[_0x83f3('0x13')](_0x83f3('0xb'),auth[_0x83f3('0xc')](),controller[_0x83f3('0x14')]);module[_0x83f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 43ea006..deaf20b 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 _0x4e7f=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto','outgoing','yes','force_rport,comedia','nat','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','nonat','update','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','join','getDataValue','transport'];(function(_0x30c649,_0x2ebbac){var _0x3edfb9=function(_0xab82f5){while(--_0xab82f5){_0x30c649['push'](_0x30c649['shift']());}};_0x3edfb9(++_0x2ebbac);}(_0x4e7f,0x130));var _0xf4e7=function(_0x41d684,_0x52f976){_0x41d684=_0x41d684-0x0;var _0x83b011=_0x4e7f[_0x41d684];return _0x83b011;};'use strict';var Sequelize=require(_0xf4e7('0x0'));module[_0xf4e7('0x1')]={'name':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x4'),_0xf4e7('0x5'),_0xf4e7('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'defaultValue':_0xf4e7('0x7')},'callingpres':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x8'),_0xf4e7('0x9'),_0xf4e7('0xa'),_0xf4e7('0xb'),_0xf4e7('0xc'),_0xf4e7('0xd'),_0xf4e7('0xe'),_0xf4e7('0xf'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xf4e7('0x2')]},'secret':{'type':Sequelize[_0xf4e7('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x1726be){this[_0xf4e7('0x10')]('transport',_0x1726be?_0x1726be[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x13'))?this['getDataValue'](_0xf4e7('0x13'))[_0xf4e7('0x14')](','):null;},'comment':_0xf4e7('0x15')},'dtmfmode':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x16'),_0xf4e7('0x17'),'shortinfo',_0xf4e7('0x18'),_0xf4e7('0x19')),'defaultValue':_0xf4e7('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no','nonat','update',_0xf4e7('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf4e7('0x2')]},'directmediadeny':{'type':Sequelize[_0xf4e7('0x2')]},'nat':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x1c'),'set':function(_0x332217){this['setDataValue'](_0xf4e7('0x1d'),_0x332217?_0x332217[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x1d'))?this[_0xf4e7('0x12')]('nat')[_0xf4e7('0x14')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf4e7('0x2')]},'pickupgroup':{'type':Sequelize[_0xf4e7('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x1e')},'allow':{'type':Sequelize[_0xf4e7('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x49d6e3){this[_0xf4e7('0x10')](_0xf4e7('0x1f'),_0x49d6e3?_0x49d6e3[_0xf4e7('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xf4e7('0x12')](_0xf4e7('0x1f'))?this[_0xf4e7('0x12')](_0xf4e7('0x1f'))[_0xf4e7('0x14')](';'):null;},'comment':_0xf4e7('0x20')},'autoframing':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'insecure':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'port,invite','set':function(_0x10f95c){this[_0xf4e7('0x10')](_0xf4e7('0x21'),_0x10f95c?_0x10f95c[_0xf4e7('0x11')](','):null);},'get':function(){return this[_0xf4e7('0x12')]('insecure')?this[_0xf4e7('0x12')](_0xf4e7('0x21'))['split'](','):null;},'comment':_0xf4e7('0x22')},'trustrpid':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x23'))},'promiscredir':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'setvar':{'type':Sequelize[_0xf4e7('0x2')]},'callerid':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':_0xf4e7('0x25')},'amaflags':{'type':Sequelize[_0xf4e7('0x2')]},'callcounter':{'type':Sequelize[_0xf4e7('0x3')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xf4e7('0x3')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf4e7('0x2')]},'videosupport':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'mailbox':{'type':Sequelize[_0xf4e7('0x2')]},'session_timers':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x27'),_0xf4e7('0x28'),_0xf4e7('0x29'))},'session_expires':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x2a'),_0xf4e7('0x2b')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf4e7('0x2')]},'regexten':{'type':Sequelize[_0xf4e7('0x2')]},'fromdomain':{'type':Sequelize[_0xf4e7('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xf4e7('0x2')]},'rtptimeout':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0xf4e7('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xf4e7('0x2')]},'contactacl':{'type':Sequelize[_0xf4e7('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xf4e7('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'encryption':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xf4e7('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no',_0xf4e7('0x2d'),_0xf4e7('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xf4e7('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf4e7('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf4e7('0x2')]},'dtlscipher':{'type':Sequelize[_0xf4e7('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf4e7('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xf4e7('0x2f'),_0xf4e7('0x30'),_0xf4e7('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf4e7('0x2')]},'usereqphone':{'type':Sequelize[_0xf4e7('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xf4e7('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf4e7('0x3')](_0xf4e7('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xf4e7('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0xf4e7('0x2')]},'mohinterpret':{'type':Sequelize[_0xf4e7('0x2')]},'mohsuggest':{'type':Sequelize[_0xf4e7('0x2')]},'parkinglot':{'type':Sequelize[_0xf4e7('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xf4e7('0x3')]('yes','no',_0xf4e7('0x32'),_0xf4e7('0x33'),_0xf4e7('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf4e7('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xf4e7('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xf4e7('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x9111=['friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','getDataValue','split','info','shortinfo','inband','auto','rfc2833','yes','nonat','outgoing','force_rport,comedia','setDataValue','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','never','\x22\x22\x20<>','INTEGER','accept','refuse','uas','pai','certificate','passive','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM'];(function(_0x25902b,_0x229966){var _0x1884f0=function(_0x1eb2b2){while(--_0x1eb2b2){_0x25902b['push'](_0x25902b['shift']());}};_0x1884f0(++_0x229966);}(_0x9111,0x121));var _0x1911=function(_0x4bc852,_0x198c63){_0x4bc852=_0x4bc852-0x0;var _0x168ece=_0x9111[_0x4bc852];return _0x168ece;};'use strict';var Sequelize=require(_0x1911('0x0'));module[_0x1911('0x1')]={'name':{'type':Sequelize[_0x1911('0x2')],'allowNull':![],'unique':_0x1911('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x5'),'user',_0x1911('0x6')),'allowNull':![],'defaultValue':_0x1911('0x5')},'context':{'type':Sequelize[_0x1911('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x7'),_0x1911('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x1911('0x9'),_0x1911('0xa'),_0x1911('0xb'),_0x1911('0xc'))},'deny':{'type':Sequelize[_0x1911('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x1911('0x2')]},'md5secret':{'type':Sequelize[_0x1911('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x1911('0x2')],'defaultValue':_0x1911('0xd'),'set':function(_0x26a110){this['setDataValue'](_0x1911('0xe'),_0x26a110?_0x26a110[_0x1911('0xf')](','):null);},'get':function(){return this[_0x1911('0x10')](_0x1911('0xe'))?this[_0x1911('0x10')]('transport')[_0x1911('0x11')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x1911('0x12'),_0x1911('0x13'),_0x1911('0x14'),_0x1911('0x15')),'defaultValue':_0x1911('0x16')},'directmedia':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no',_0x1911('0x18'),'update',_0x1911('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1911('0x2')]},'directmediadeny':{'type':Sequelize[_0x1911('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x1911('0x1a'),'set':function(_0x97e7e0){this[_0x1911('0x1b')](_0x1911('0x1c'),_0x97e7e0?_0x97e7e0[_0x1911('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x1911('0x1c'))?this[_0x1911('0x10')](_0x1911('0x1c'))[_0x1911('0x11')](','):null;},'comment':_0x1911('0x1d')},'callgroup':{'type':Sequelize[_0x1911('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x1911('0x2')]},'language':{'type':Sequelize[_0x1911('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1911('0x2')],'defaultValue':_0x1911('0x1e')},'allow':{'type':Sequelize[_0x1911('0x2')],'allowNull':![],'defaultValue':_0x1911('0x1f'),'set':function(_0x5a8774){this[_0x1911('0x1b')](_0x1911('0x20'),_0x5a8774?_0x5a8774[_0x1911('0xf')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x1911('0x10')]('allow')?this[_0x1911('0x10')]('allow')[_0x1911('0x11')](';'):null;},'comment':_0x1911('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x5d0277){this[_0x1911('0x1b')](_0x1911('0x22'),_0x5d0277?_0x5d0277[_0x1911('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x1911('0x22'))?this[_0x1911('0x10')](_0x1911('0x22'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no',_0x1911('0x23'))},'promiscredir':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x1911('0x2')]},'callerid':{'type':Sequelize[_0x1911('0x2')],'defaultValue':_0x1911('0x24')},'amaflags':{'type':Sequelize[_0x1911('0x2')]},'callcounter':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':_0x1911('0x17')},'busylevel':{'type':Sequelize[_0x1911('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'allowtransfer':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x1911('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1911('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'mailbox':{'type':Sequelize[_0x1911('0x2')]},'session_timers':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x26'),_0x1911('0x27'),'originate')},'session_expires':{'type':Sequelize[_0x1911('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x1911('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x1911('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1911('0x2')]},'regexten':{'type':Sequelize[_0x1911('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x1911('0x2')]},'port':{'type':Sequelize[_0x1911('0x25')](0x5)},'qualify':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x1911('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x1911('0x2')]},'defaultuser':{'type':Sequelize[_0x1911('0x2')]},'rtptimeout':{'type':Sequelize[_0x1911('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x1911('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1911('0x2')]},'callbackextension':{'type':Sequelize[_0x1911('0x2')]},'timert1':{'type':Sequelize[_0x1911('0x25')](0xb)},'timerb':{'type':Sequelize[_0x1911('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1911('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x1911('0x2')]},'contactdeny':{'type':Sequelize[_0x1911('0x2')]},'contactacl':{'type':Sequelize[_0x1911('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x1911('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x1911('0x25')](0xb)},'encryption':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'force_avp':{'type':Sequelize[_0x1911('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x1911('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x1911('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no','fingerprint',_0x1911('0x2a'))},'dtlsrekey':{'type':Sequelize[_0x1911('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x1911('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x1911('0x2')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x1911('0x2b'),_0x1911('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1911('0x2')]},'usereqphone':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x1911('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x1911('0x4')](_0x1911('0x17'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x1911('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x1911('0x2')],'defaultValue':_0x1911('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0x1911('0x17'),'no','nonat',_0x1911('0x2e'),_0x1911('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x1911('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x1911('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 7750f28..f2cba9f 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 _0x98a8=['../../mysqldb','jayson/promise','client','request','Trunk,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','Trunks','UserProfileResource','stack','name','map','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Trunk','include','show','params','keys','rawAttributes','includeAll','clone','find','createdAt','updatedAt','body','omit','create','user','role','UserProfileSection','userProfileId','autoAssociation','findAll','readFileSync','root','server/files/templates/trunk.ejs','join','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment'];(function(_0x766197,_0x1e43b0){var _0x8ea430=function(_0x2ee670){while(--_0x2ee670){_0x766197['push'](_0x766197['shift']());}};_0x8ea430(++_0x1e43b0);}(_0x98a8,0x12c));var _0x898a=function(_0x29a1a2,_0x232615){_0x29a1a2=_0x29a1a2-0x0;var _0xc5175f=_0x98a8[_0x29a1a2];return _0xc5175f;};'use strict';var emlformat=require(_0x898a('0x0'));var rimraf=require(_0x898a('0x1'));var zipdir=require(_0x898a('0x2'));var jsonpatch=require(_0x898a('0x3'));var rp=require(_0x898a('0x4'));var moment=require(_0x898a('0x5'));var BPromise=require(_0x898a('0x6'));var Mustache=require('mustache');var util=require(_0x898a('0x7'));var path=require(_0x898a('0x8'));var sox=require(_0x898a('0x9'));var csv=require(_0x898a('0xa'));var ejs=require(_0x898a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x898a('0xc'));var squel=require('squel');var crypto=require(_0x898a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x898a('0xe'));var toCsv=require(_0x898a('0xa'));var querystring=require(_0x898a('0xf'));var Papa=require(_0x898a('0x10'));var Redis=require(_0x898a('0x11'));var authService=require(_0x898a('0x12'));var qs=require(_0x898a('0x13'));var as=require(_0x898a('0x14'));var hardwareService=require(_0x898a('0x15'));var logger=require('../../config/logger')(_0x898a('0x16'));var utils=require('../../config/utils');var config=require(_0x898a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x898a('0x18'))['db'];var jayson=require(_0x898a('0x19'));var client=jayson[_0x898a('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bfded,_0x5b5c9c,_0x373d53,_0x1f5be4){return new BPromise(function(_0xb24335,_0x116fbe){var _0x1873e9=_0x1f5be4||client;return _0x1873e9[_0x898a('0x1b')](_0x5bfded,_0x373d53)['then'](function(_0x47033c){logger['info'](_0x898a('0x1c'),_0x5b5c9c,'request\x20sent');logger[_0x898a('0x1d')]('Trunk,\x20%s,\x20%s,\x20%s',_0x5b5c9c,_0x898a('0x1e'),JSON['stringify'](_0x47033c));if(_0x47033c[_0x898a('0x1f')]){if(_0x47033c[_0x898a('0x1f')][_0x898a('0x20')]===0x1f4){logger['error'](_0x898a('0x1c'),_0x5b5c9c,_0x47033c['error']['message']);return _0x116fbe(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5b5c9c,_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);return _0xb24335(_0x47033c[_0x898a('0x1f')][_0x898a('0x21')]);}else{logger[_0x898a('0x22')](_0x898a('0x1c'),_0x5b5c9c,_0x898a('0x1e'));_0xb24335(_0x47033c['result'][_0x898a('0x21')]);}})[_0x898a('0x23')](function(_0x11cae2){logger[_0x898a('0x1f')](_0x898a('0x1c'),_0x5b5c9c,_0x11cae2);_0x116fbe(_0x11cae2);});});}function respondWithStatusCode(_0x310bfa,_0x4e254d){_0x4e254d=_0x4e254d||0xcc;return function(_0x274cdf){if(_0x274cdf){return _0x310bfa[_0x898a('0x24')](_0x4e254d);}return _0x310bfa[_0x898a('0x25')](_0x4e254d)[_0x898a('0x26')]();};}function respondWithResult(_0x3901ab,_0x1426e3){_0x1426e3=_0x1426e3||0xc8;return function(_0x5b7719){if(_0x5b7719){return _0x3901ab[_0x898a('0x25')](_0x1426e3)['json'](_0x5b7719);}};}function respondWithFilteredResult(_0x513c6b,_0x53ddb2){return function(_0x3678be){if(_0x3678be){var _0x1f4d86=typeof _0x53ddb2[_0x898a('0x27')]===_0x898a('0x28')&&typeof _0x53ddb2[_0x898a('0x29')]===_0x898a('0x28');var _0x398e98=_0x3678be[_0x898a('0x2a')];var _0xd31922=_0x1f4d86?0x0:_0x53ddb2['offset'];var _0x4b3e68=_0x1f4d86?_0x3678be['count']:_0x53ddb2[_0x898a('0x27')]+_0x53ddb2[_0x898a('0x29')];var _0x3b7704;if(_0x4b3e68>=_0x398e98){_0x4b3e68=_0x398e98;_0x3b7704=0xc8;}else{_0x3b7704=0xce;}_0x513c6b[_0x898a('0x25')](_0x3b7704);return _0x513c6b[_0x898a('0x2b')](_0x898a('0x2c'),_0xd31922+'-'+_0x4b3e68+'/'+_0x398e98)[_0x898a('0x2d')](_0x3678be);}return null;};}function patchUpdates(_0xf74645){return function(_0x18773a){try{jsonpatch[_0x898a('0x2e')](_0x18773a,_0xf74645,!![]);}catch(_0x44c5d2){return BPromise[_0x898a('0x2f')](_0x44c5d2);}return _0x18773a['save']();};}function saveUpdates(_0x7a1eb5,_0x17a5f3){return function(_0x26eead){if(_0x26eead){return _0x26eead[_0x898a('0x30')](_0x7a1eb5)[_0x898a('0x31')](function(_0x47af5b){return _0x47af5b;});}return null;};}function removeEntity(_0x48cefb,_0x20a3fe){return function(_0x1e2fd4){if(_0x1e2fd4){return _0x1e2fd4[_0x898a('0x32')]()['then'](function(){var _0x105477=_0x1e2fd4[_0x898a('0x33')]({'plain':!![]});var _0x5eafc7=_0x898a('0x34');return db[_0x898a('0x35')][_0x898a('0x32')]({'where':{'type':_0x5eafc7,'resourceId':_0x105477['id']}})[_0x898a('0x31')](function(){return _0x1e2fd4;});})[_0x898a('0x31')](function(){_0x48cefb['status'](0xcc)[_0x898a('0x26')]();});}};}function handleEntityNotFound(_0x5baf5b,_0x573eb3){return function(_0x14e2dc){if(!_0x14e2dc){_0x5baf5b['sendStatus'](0x194);}return _0x14e2dc;};}function handleError(_0x3c9588,_0x4b3aac){_0x4b3aac=_0x4b3aac||0x1f4;return function(_0x37cb11){logger['error'](_0x37cb11[_0x898a('0x36')]);if(_0x37cb11[_0x898a('0x37')]){delete _0x37cb11[_0x898a('0x37')];}_0x3c9588['status'](_0x4b3aac)['send'](_0x37cb11);};}exports['index']=function(_0x1575d2,_0x429c32){var _0x5a228f={},_0xdd019d={},_0x3d3463={'count':0x0,'rows':[]};var _0xe84f7e=_[_0x898a('0x38')](db['Trunk']['rawAttributes'],function(_0x3aed01){return{'name':_0x3aed01[_0x898a('0x39')],'type':_0x3aed01['type']['key']};});_0xdd019d[_0x898a('0x3a')]=_[_0x898a('0x38')](_0xe84f7e,_0x898a('0x37'));_0xdd019d[_0x898a('0x3b')]=_['keys'](_0x1575d2[_0x898a('0x3b')]);_0xdd019d[_0x898a('0x3c')]=_['intersection'](_0xdd019d['model'],_0xdd019d['query']);_0x5a228f[_0x898a('0x3d')]=_[_0x898a('0x3e')](_0xdd019d[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x3f')]));_0x5a228f[_0x898a('0x3d')]=_0x5a228f[_0x898a('0x3d')][_0x898a('0x40')]?_0x5a228f[_0x898a('0x3d')]:_0xdd019d[_0x898a('0x3a')];if(!_0x1575d2[_0x898a('0x3b')][_0x898a('0x41')](_0x898a('0x42'))){_0x5a228f[_0x898a('0x29')]=qs['limit'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x29')]);_0x5a228f[_0x898a('0x27')]=qs['offset'](_0x1575d2[_0x898a('0x3b')][_0x898a('0x27')]);}_0x5a228f[_0x898a('0x43')]=qs[_0x898a('0x44')](_0x1575d2[_0x898a('0x3b')][_0x898a('0x44')]);_0x5a228f[_0x898a('0x45')]=qs[_0x898a('0x3c')](_['pick'](_0x1575d2[_0x898a('0x3b')],_0xdd019d[_0x898a('0x3c')]),_0xe84f7e);if(_0x1575d2[_0x898a('0x3b')][_0x898a('0x46')]){_0x5a228f['where']=_[_0x898a('0x47')](_0x5a228f[_0x898a('0x45')],{'$or':_['map'](_0xe84f7e,function(_0x241677){if(_0x241677['type']!==_0x898a('0x48')){var _0x5137c4={};_0x5137c4[_0x241677['name']]={'$like':'%'+_0x1575d2[_0x898a('0x3b')]['filter']+'%'};return _0x5137c4;}})});}_0x5a228f=_[_0x898a('0x47')]({},_0x5a228f,_0x1575d2[_0x898a('0x49')]);var _0x4d6ac0={'where':_0x5a228f[_0x898a('0x45')]};return db[_0x898a('0x4a')]['count'](_0x4d6ac0)[_0x898a('0x31')](function(_0x199437){_0x3d3463[_0x898a('0x2a')]=_0x199437;if(_0x1575d2[_0x898a('0x3b')]['includeAll']){_0x5a228f[_0x898a('0x4b')]=[{'all':!![]}];}return db[_0x898a('0x4a')]['findAll'](_0x5a228f);})[_0x898a('0x31')](function(_0x1d8c16){_0x3d3463['rows']=_0x1d8c16;return _0x3d3463;})[_0x898a('0x31')](respondWithFilteredResult(_0x429c32,_0x5a228f))['catch'](handleError(_0x429c32,null));};exports[_0x898a('0x4c')]=function(_0x41f291,_0x32ccb9){var _0x50f9e3={'raw':![],'where':{'id':_0x41f291[_0x898a('0x4d')]['id']}},_0x2f6cb3={};_0x2f6cb3[_0x898a('0x3a')]=_[_0x898a('0x4e')](db['Trunk'][_0x898a('0x4f')]);_0x2f6cb3['query']=_[_0x898a('0x4e')](_0x41f291[_0x898a('0x3b')]);_0x2f6cb3[_0x898a('0x3c')]=_['intersection'](_0x2f6cb3[_0x898a('0x3a')],_0x2f6cb3[_0x898a('0x3b')]);_0x50f9e3[_0x898a('0x3d')]=_['intersection'](_0x2f6cb3['model'],qs[_0x898a('0x3f')](_0x41f291[_0x898a('0x3b')][_0x898a('0x3f')]));_0x50f9e3[_0x898a('0x3d')]=_0x50f9e3[_0x898a('0x3d')][_0x898a('0x40')]?_0x50f9e3[_0x898a('0x3d')]:_0x2f6cb3[_0x898a('0x3a')];if(_0x41f291[_0x898a('0x3b')][_0x898a('0x50')]){_0x50f9e3[_0x898a('0x4b')]=[{'all':!![]}];}_0x50f9e3=_['merge']({},_0x50f9e3,_0x41f291[_0x898a('0x49')]);return db[_0x898a('0x4a')]['find'](_0x50f9e3)[_0x898a('0x31')](handleEntityNotFound(_0x32ccb9,null))['then'](respondWithResult(_0x32ccb9,null))['catch'](handleError(_0x32ccb9,null));};exports[_0x898a('0x51')]=function(_0x124f9b,_0x209529){var _0x5bfd61={'where':{'id':_0x124f9b[_0x898a('0x4d')]['id']}},_0x556fd8={};_0x556fd8[_0x898a('0x3a')]=_['keys'](db[_0x898a('0x4a')][_0x898a('0x4f')]);_0x5bfd61['attributes']=_[_0x898a('0x3e')](_0x556fd8[_0x898a('0x3a')],qs[_0x898a('0x3f')](_0x124f9b['query'][_0x898a('0x3f')]));_0x5bfd61[_0x898a('0x3d')]=_0x5bfd61[_0x898a('0x3d')][_0x898a('0x40')]?_0x5bfd61[_0x898a('0x3d')]:_0x556fd8[_0x898a('0x3a')];if(_0x124f9b['query'][_0x898a('0x50')]){_0x5bfd61['include']=[{'all':!![]}];}_0x5bfd61=_[_0x898a('0x47')]({},_0x5bfd61,_0x124f9b[_0x898a('0x49')]);return db[_0x898a('0x4a')][_0x898a('0x52')](_0x5bfd61)[_0x898a('0x31')](handleEntityNotFound(_0x209529,null))[_0x898a('0x31')](function(_0x2486a5){if(_0x2486a5){var _0x75ff57=_0x2486a5[_0x898a('0x33')]({'plain':!![]});_0x75ff57=qs['omit'](_0x75ff57,['id',_0x898a('0x53'),_0x898a('0x54')]);_0x124f9b[_0x898a('0x55')]=_[_0x898a('0x56')](_0x124f9b[_0x898a('0x55')],['id',_0x898a('0x53'),_0x898a('0x54')]);return db[_0x898a('0x4a')][_0x898a('0x57')](_[_0x898a('0x47')](_0x75ff57,_0x124f9b[_0x898a('0x55')]),{'include':_0x124f9b[_0x898a('0x3b')][_0x898a('0x50')]?[{'all':!![]}]:undefined})[_0x898a('0x31')](function(_0x22f9ba){var _0x5f42ae=_0x124f9b[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x5f42ae)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f42ae[_0x898a('0x59')]===_0x898a('0x58')){var _0x5f0944=_0x22f9ba[_0x898a('0x33')]({'plain':!![]});var _0x1daecd=_0x898a('0x34');return db[_0x898a('0x5a')]['find']({'where':{'name':_0x1daecd,'userProfileId':_0x5f42ae[_0x898a('0x5b')]},'raw':!![]})[_0x898a('0x31')](function(_0x137935){if(_0x137935&&_0x137935[_0x898a('0x5c')]===0x0){return db['UserProfileResource'][_0x898a('0x57')]({'name':_0x5f0944[_0x898a('0x37')],'resourceId':_0x5f0944['id'],'type':_0x137935['name'],'sectionId':_0x137935['id']},{})[_0x898a('0x31')](function(){return _0x22f9ba;});}else{return _0x22f9ba;}})[_0x898a('0x23')](function(_0x5b7019){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b7019);throw _0x5b7019;});}return _0x22f9ba;});}})[_0x898a('0x31')](respondWithResult(_0x209529,0xc9))['catch'](handleError(_0x209529,null));};exports['create']=function(_0x5ed35e,_0xfdd6d8,_0x473f5c){var _0x3909c5;return db[_0x898a('0x4a')]['create'](_0x5ed35e['body'],{'raw':!![]})[_0x898a('0x31')](function(_0x232be0){_0x3909c5=_0x232be0;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x41cf94){var _0x30051d=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x42fda8=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),_0x898a('0x63'));var _0x3bcc3d=ejs[_0x898a('0x64')](_0x30051d,{'trunks':_0x41cf94||[]});fs[_0x898a('0x65')](_0x898a('0x66'),_0x3bcc3d);if(_0x3909c5[_0x898a('0x67')]){var _0x307849=ejs[_0x898a('0x64')](_0x42fda8,{'trunks':_0x41cf94||[]});fs['writeFileSync'](_0x898a('0x68'),_0x307849);}})['then'](function(){return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x57'),{'module':_0x898a('0x6a')});})['then'](function(){var _0x31102d=_0x5ed35e[_0x898a('0x58')][_0x898a('0x33')]({'plain':!![]});if(!_0x31102d)throw new Error(_0x898a('0x6b'));if(_0x31102d[_0x898a('0x59')]==='user'){var _0x4b9487=_0x3909c5[_0x898a('0x33')]({'plain':!![]});return db[_0x898a('0x5a')][_0x898a('0x52')]({'where':{'name':_0x898a('0x34'),'userProfileId':_0x31102d['userProfileId']},'raw':!![]})[_0x898a('0x31')](function(_0x3d3451){if(_0x3d3451&&_0x3d3451[_0x898a('0x5c')]===0x0){return db[_0x898a('0x35')][_0x898a('0x57')]({'name':_0x4b9487[_0x898a('0x37')],'resourceId':_0x4b9487['id'],'type':_0x3d3451[_0x898a('0x37')],'sectionId':_0x3d3451['id']},{})[_0x898a('0x31')](function(){return _0x3909c5;});}else{return _0x3909c5;}})['catch'](function(_0x32a207){logger[_0x898a('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32a207);throw _0x32a207;});}return _0x3909c5;})[_0x898a('0x31')](respondWithResult(_0xfdd6d8,0xc9))['catch'](handleError(_0xfdd6d8,null));};exports[_0x898a('0x30')]=function(_0x4b2575,_0x2471d8,_0x387f2c){var _0x3b07dc;return db[_0x898a('0x4a')][_0x898a('0x52')]({'where':{'id':_0x4b2575[_0x898a('0x4d')]['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x2471d8,null))[_0x898a('0x31')](saveUpdates(_0x4b2575[_0x898a('0x55')],null))['then'](function(_0x3fe54b){if(_0x3fe54b){_0x3b07dc=_0x3fe54b;return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});}})[_0x898a('0x31')](function(_0x290972){if(_0x290972){var _0x1d594b=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x4fad03=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config['root'],'server/files/templates/registry.ejs'),_0x898a('0x63'));var _0x4a79a4=ejs[_0x898a('0x64')](_0x1d594b,{'trunks':_0x290972||[]});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a79a4);var _0x3f6815=ejs[_0x898a('0x64')](_0x4fad03,{'trunks':_0x290972||[]});fs[_0x898a('0x65')](_0x898a('0x68'),_0x3f6815);return respondWithRpcPromise(_0x898a('0x69'),_0x898a('0x30'),{'module':_0x898a('0x6a')});}return null;})['then'](function(_0x3237e8){if(_0x3237e8){return _0x3b07dc;}})[_0x898a('0x31')](respondWithResult(_0x2471d8,null))[_0x898a('0x23')](handleError(_0x2471d8,null));};exports['destroy']=function(_0x27560f,_0x61247c,_0x5c6247){var _0x39e917;return db['Trunk']['find']({'where':{'id':_0x27560f['params']['id']}})[_0x898a('0x31')](handleEntityNotFound(_0x61247c,null))[_0x898a('0x31')](removeEntity(_0x61247c,null))[_0x898a('0x31')](function(){return db[_0x898a('0x4a')][_0x898a('0x5d')]({'raw':!![]});})[_0x898a('0x31')](function(_0x12e54b){var _0x50dd52=fs[_0x898a('0x5e')](path['join'](config[_0x898a('0x5f')],_0x898a('0x60')),'utf8');var _0x24670c=fs[_0x898a('0x5e')](path[_0x898a('0x61')](config[_0x898a('0x5f')],_0x898a('0x62')),'utf8');var _0x5847cb=ejs['render'](_0x50dd52,{'trunks':_0x12e54b});var _0x3b8fb5=ejs[_0x898a('0x64')](_0x24670c,{'trunks':_0x12e54b});fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5847cb);fs[_0x898a('0x65')]('/etc/asterisk/sip_xcally_registers.conf',_0x3b8fb5);return respondWithRpcPromise('Reload',_0x898a('0x32'),{'module':_0x898a('0x6a')});})[_0x898a('0x23')](handleError(_0x61247c,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x2198dc,_0xe90409){var _0x4e4d37=function(_0x8772e3){while(--_0x8772e3){_0x2198dc['push'](_0x2198dc['shift']());}};_0x4e4d37(++_0xe90409);}(_0x55ca,0x126));var _0xa55c=function(_0x2bbbc2,_0x2fd8b9){_0x2bbbc2=_0x2bbbc2-0x0;var _0x1f0319=_0x55ca[_0x2bbbc2];return _0x1f0319;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index df9eba9..3d535f2 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 _0x22b8=['path','../../config/environment','exports','define','Trunk','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x2710b4,_0x5885ae){var _0x4724f5=function(_0x114e4c){while(--_0x114e4c){_0x2710b4['push'](_0x2710b4['shift']());}};_0x4724f5(++_0x5885ae);}(_0x22b8,0x19c));var _0x822b=function(_0x49258d,_0x5bcf0e){_0x49258d=_0x49258d-0x0;var _0x2a9044=_0x22b8[_0x49258d];return _0x2a9044;};'use strict';var _=require(_0x822b('0x0'));var util=require(_0x822b('0x1'));var logger=require(_0x822b('0x2'))('api');var moment=require(_0x822b('0x3'));var BPromise=require(_0x822b('0x4'));var rp=require(_0x822b('0x5'));var fs=require('fs');var path=require(_0x822b('0x6'));var rimraf=require('rimraf');var config=require(_0x822b('0x7'));var attributes=require('./trunk.attributes');module[_0x822b('0x8')]=function(_0x5448f2,_0x4fe959){return _0x5448f2[_0x822b('0x9')](_0x822b('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x58a2=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./trunk.attributes'];(function(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0x58a2,0x124));var _0x258a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x58a2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x258a('0x0'));var util=require(_0x258a('0x1'));var logger=require(_0x258a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x258a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x258a('0x4'));var rimraf=require(_0x258a('0x5'));var config=require(_0x258a('0x6'));var attributes=require(_0x258a('0x7'));module[_0x258a('0x8')]=function(_0x31b5d8,_0xb73bcf){return _0x31b5d8[_0x258a('0x9')](_0x258a('0xa'),attributes,{'tableName':_0x258a('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 1d96a36..c967388 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 _0xa3e9=['include','model','map','ShowTrunk','find','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetTrunk','findAll','options','raw','attributes','limit'];(function(_0x2c9c3f,_0x2f64bb){var _0xec6fd0=function(_0x53486c){while(--_0x53486c){_0x2c9c3f['push'](_0x2c9c3f['shift']());}};_0xec6fd0(++_0x2f64bb);}(_0xa3e9,0x106));var _0x9a3e=function(_0x2e3840,_0x1a36b6){_0x2e3840=_0x2e3840-0x0;var _0x22a726=_0xa3e9[_0x2e3840];return _0x22a726;};'use strict';var _=require(_0x9a3e('0x0'));var util=require('util');var moment=require(_0x9a3e('0x1'));var BPromise=require(_0x9a3e('0x2'));var rs=require(_0x9a3e('0x3'));var fs=require('fs');var Redis=require(_0x9a3e('0x4'));var db=require(_0x9a3e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9a3e('0x6'));var jayson=require(_0x9a3e('0x7'));var client=jayson['client'][_0x9a3e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2767cf,_0x49dc23,_0x387329){return new BPromise(function(_0x176ed5,_0x173a5f){return client[_0x9a3e('0x9')](_0x2767cf,_0x387329)[_0x9a3e('0xa')](function(_0x2caecb){logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));logger[_0x9a3e('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x49dc23,_0x9a3e('0xd'),JSON[_0x9a3e('0xf')](_0x2caecb));if(_0x2caecb['error']){if(_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x11')]===0x1f4){logger[_0x9a3e('0x10')]('Trunk,\x20%s,\x20%s',_0x49dc23,_0x2caecb[_0x9a3e('0x10')][_0x9a3e('0x12')]);return _0x173a5f(_0x2caecb[_0x9a3e('0x10')]['message']);}logger[_0x9a3e('0x10')](_0x9a3e('0xc'),_0x49dc23,_0x2caecb[_0x9a3e('0x10')]['message']);return _0x176ed5(_0x2caecb['error'][_0x9a3e('0x12')]);}else{logger[_0x9a3e('0xb')](_0x9a3e('0xc'),_0x49dc23,_0x9a3e('0xd'));_0x176ed5(_0x2caecb['result']['message']);}})[_0x9a3e('0x13')](function(_0x57a273){logger[_0x9a3e('0x10')]('Trunk,\x20%s,\x20%s',_0x49dc23,_0x57a273);_0x173a5f(_0x57a273);});});}exports[_0x9a3e('0x14')]=function(_0xc0c7a3){var _0xa145cf=this;return new Promise(function(_0x2983e7,_0x5736a5){return db['Trunk'][_0x9a3e('0x15')]({'raw':_0xc0c7a3['options']?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x17')]===undefined?!![]:![]:!![],'where':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3['options']['where']||null:null,'attributes':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x18')]||null:null,'limit':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x19')]||null:null,'include':_0xc0c7a3[_0x9a3e('0x16')]?_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x1a')]?_['map'](_0xc0c7a3[_0x9a3e('0x16')][_0x9a3e('0x1a')],function(_0x4d02a0){return{'model':db[_0x4d02a0[_0x9a3e('0x1b')]],'as':_0x4d02a0['as'],'attributes':_0x4d02a0['attributes'],'include':_0x4d02a0[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x4d02a0[_0x9a3e('0x1a')],function(_0x160d29){return{'model':db[_0x160d29[_0x9a3e('0x1b')]],'as':_0x160d29['as'],'attributes':_0x160d29[_0x9a3e('0x18')],'include':_0x160d29[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x160d29[_0x9a3e('0x1a')],function(_0xd35503){return{'model':db[_0xd35503[_0x9a3e('0x1b')]],'as':_0xd35503['as'],'attributes':_0xd35503[_0x9a3e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a3e('0xa')](function(_0x16ac8f){logger[_0x9a3e('0xb')](_0x9a3e('0x14'),_0xc0c7a3);logger[_0x9a3e('0xe')]('GetTrunk',_0xc0c7a3,JSON['stringify'](_0x16ac8f));_0x2983e7(_0x16ac8f);})[_0x9a3e('0x13')](function(_0x150d1a){logger[_0x9a3e('0x10')](_0x9a3e('0x14'),_0x150d1a[_0x9a3e('0x12')],_0xc0c7a3);_0x5736a5(_0xa145cf[_0x9a3e('0x10')](0x1f4,_0x150d1a['message']));});});};exports[_0x9a3e('0x1d')]=function(_0x121d33){var _0x2eae82=this;return new Promise(function(_0x2fc3b5,_0x5c341b){return db['Trunk'][_0x9a3e('0x1e')]({'raw':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x17')]===undefined?!![]:![]:!![],'where':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x1f')]||null:null,'attributes':_0x121d33[_0x9a3e('0x16')]?_0x121d33[_0x9a3e('0x16')]['attributes']||null:null,'include':_0x121d33['options']?_0x121d33[_0x9a3e('0x16')][_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x121d33[_0x9a3e('0x16')]['include'],function(_0x5721a6){return{'model':db[_0x5721a6[_0x9a3e('0x1b')]],'as':_0x5721a6['as'],'attributes':_0x5721a6['attributes'],'include':_0x5721a6[_0x9a3e('0x1a')]?_['map'](_0x5721a6[_0x9a3e('0x1a')],function(_0x53a654){return{'model':db[_0x53a654[_0x9a3e('0x1b')]],'as':_0x53a654['as'],'attributes':_0x53a654[_0x9a3e('0x18')],'include':_0x53a654[_0x9a3e('0x1a')]?_[_0x9a3e('0x1c')](_0x53a654[_0x9a3e('0x1a')],function(_0x2d2637){return{'model':db[_0x2d2637[_0x9a3e('0x1b')]],'as':_0x2d2637['as'],'attributes':_0x2d2637[_0x9a3e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9a3e('0xa')](function(_0x54b763){logger[_0x9a3e('0xb')](_0x9a3e('0x1d'),_0x121d33);logger['debug'](_0x9a3e('0x1d'),_0x121d33,JSON['stringify'](_0x54b763));_0x2fc3b5(_0x54b763);})[_0x9a3e('0x13')](function(_0x36d675){logger[_0x9a3e('0x10')]('ShowTrunk',_0x36d675[_0x9a3e('0x12')],_0x121d33);_0x5c341b(_0x2eae82[_0x9a3e('0x10')](0x1f4,_0x36d675['message']));});});}; \ No newline at end of file +var _0x543b=['attributes','limit','map','model','include','stringify','ShowTrunk','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where'];(function(_0x57ce63,_0x27251c){var _0x1557d9=function(_0x487e7b){while(--_0x487e7b){_0x57ce63['push'](_0x57ce63['shift']());}};_0x1557d9(++_0x27251c);}(_0x543b,0x120));var _0xb543=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x543b[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xb543('0x0'));var util=require(_0xb543('0x1'));var moment=require(_0xb543('0x2'));var BPromise=require('bluebird');var rs=require(_0xb543('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb543('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb543('0x5'))('rpc');var config=require(_0xb543('0x6'));var jayson=require(_0xb543('0x7'));var client=jayson[_0xb543('0x8')][_0xb543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f2448,_0x4f8467,_0x42c69e){return new BPromise(function(_0x2cc349,_0x10d7e3){return client[_0xb543('0xa')](_0x5f2448,_0x42c69e)[_0xb543('0xb')](function(_0x297c11){logger[_0xb543('0xc')](_0xb543('0xd'),_0x4f8467,_0xb543('0xe'));logger[_0xb543('0xf')](_0xb543('0x10'),_0x4f8467,_0xb543('0xe'),JSON['stringify'](_0x297c11));if(_0x297c11[_0xb543('0x11')]){if(_0x297c11[_0xb543('0x11')][_0xb543('0x12')]===0x1f4){logger[_0xb543('0x11')](_0xb543('0xd'),_0x4f8467,_0x297c11['error'][_0xb543('0x13')]);return _0x10d7e3(_0x297c11[_0xb543('0x11')]['message']);}logger[_0xb543('0x11')](_0xb543('0xd'),_0x4f8467,_0x297c11[_0xb543('0x11')][_0xb543('0x13')]);return _0x2cc349(_0x297c11[_0xb543('0x11')][_0xb543('0x13')]);}else{logger[_0xb543('0xc')](_0xb543('0xd'),_0x4f8467,'request\x20sent');_0x2cc349(_0x297c11[_0xb543('0x14')]['message']);}})[_0xb543('0x15')](function(_0x20c74f){logger[_0xb543('0x11')]('Trunk,\x20%s,\x20%s',_0x4f8467,_0x20c74f);_0x10d7e3(_0x20c74f);});});}exports[_0xb543('0x16')]=function(_0x5ee48e){var _0x3d412b=this;return new Promise(function(_0x373aae,_0xb2c050){return db[_0xb543('0x17')]['findAll']({'raw':_0x5ee48e[_0xb543('0x18')]?_0x5ee48e[_0xb543('0x18')][_0xb543('0x19')]===undefined?!![]:![]:!![],'where':_0x5ee48e[_0xb543('0x18')]?_0x5ee48e['options'][_0xb543('0x1a')]||null:null,'attributes':_0x5ee48e[_0xb543('0x18')]?_0x5ee48e[_0xb543('0x18')][_0xb543('0x1b')]||null:null,'limit':_0x5ee48e[_0xb543('0x18')]?_0x5ee48e['options'][_0xb543('0x1c')]||null:null,'include':_0x5ee48e[_0xb543('0x18')]?_0x5ee48e[_0xb543('0x18')]['include']?_[_0xb543('0x1d')](_0x5ee48e['options']['include'],function(_0x1c10b9){return{'model':db[_0x1c10b9[_0xb543('0x1e')]],'as':_0x1c10b9['as'],'attributes':_0x1c10b9[_0xb543('0x1b')],'include':_0x1c10b9[_0xb543('0x1f')]?_[_0xb543('0x1d')](_0x1c10b9[_0xb543('0x1f')],function(_0x2e38e4){return{'model':db[_0x2e38e4[_0xb543('0x1e')]],'as':_0x2e38e4['as'],'attributes':_0x2e38e4[_0xb543('0x1b')],'include':_0x2e38e4[_0xb543('0x1f')]?_[_0xb543('0x1d')](_0x2e38e4[_0xb543('0x1f')],function(_0x7a831f){return{'model':db[_0x7a831f['model']],'as':_0x7a831f['as'],'attributes':_0x7a831f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb543('0xb')](function(_0x2ae2ff){logger[_0xb543('0xc')](_0xb543('0x16'),_0x5ee48e);logger[_0xb543('0xf')](_0xb543('0x16'),_0x5ee48e,JSON[_0xb543('0x20')](_0x2ae2ff));_0x373aae(_0x2ae2ff);})[_0xb543('0x15')](function(_0x515c49){logger[_0xb543('0x11')](_0xb543('0x16'),_0x515c49[_0xb543('0x13')],_0x5ee48e);_0xb2c050(_0x3d412b[_0xb543('0x11')](0x1f4,_0x515c49[_0xb543('0x13')]));});});};exports[_0xb543('0x21')]=function(_0x3cb349){var _0x2a3dcc=this;return new Promise(function(_0x4536f3,_0x30fc10){return db[_0xb543('0x17')][_0xb543('0x22')]({'raw':_0x3cb349[_0xb543('0x18')]?_0x3cb349['options'][_0xb543('0x19')]===undefined?!![]:![]:!![],'where':_0x3cb349[_0xb543('0x18')]?_0x3cb349[_0xb543('0x18')][_0xb543('0x1a')]||null:null,'attributes':_0x3cb349[_0xb543('0x18')]?_0x3cb349[_0xb543('0x18')][_0xb543('0x1b')]||null:null,'include':_0x3cb349[_0xb543('0x18')]?_0x3cb349[_0xb543('0x18')]['include']?_[_0xb543('0x1d')](_0x3cb349[_0xb543('0x18')][_0xb543('0x1f')],function(_0x3a69df){return{'model':db[_0x3a69df[_0xb543('0x1e')]],'as':_0x3a69df['as'],'attributes':_0x3a69df[_0xb543('0x1b')],'include':_0x3a69df[_0xb543('0x1f')]?_[_0xb543('0x1d')](_0x3a69df['include'],function(_0x1b5677){return{'model':db[_0x1b5677[_0xb543('0x1e')]],'as':_0x1b5677['as'],'attributes':_0x1b5677[_0xb543('0x1b')],'include':_0x1b5677['include']?_[_0xb543('0x1d')](_0x1b5677['include'],function(_0x179a3b){return{'model':db[_0x179a3b[_0xb543('0x1e')]],'as':_0x179a3b['as'],'attributes':_0x179a3b['attributes']};}):[]};}):[]};}):[]:[]})[_0xb543('0xb')](function(_0x8f3da1){logger[_0xb543('0xc')](_0xb543('0x21'),_0x3cb349);logger[_0xb543('0xf')](_0xb543('0x21'),_0x3cb349,JSON[_0xb543('0x20')](_0x8f3da1));_0x4536f3(_0x8f3da1);})[_0xb543('0x15')](function(_0x141a21){logger[_0xb543('0x11')](_0xb543('0x21'),_0x141a21[_0xb543('0x13')],_0x3cb349);_0x30fc10(_0x2a3dcc[_0xb543('0x11')](0x1f4,_0x141a21[_0xb543('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 6babb18..6702dd2 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 _0xdd03=['put','isAuthenticated','update','exports','express','../../components/auth/service'];(function(_0x7ad478,_0x2e89ef){var _0x1c660c=function(_0x1191c2){while(--_0x1191c2){_0x7ad478['push'](_0x7ad478['shift']());}};_0x1c660c(++_0x2e89ef);}(_0xdd03,0x124));var _0x3dd0=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdd03[_0x4b369d];return _0x571a98;};'use strict';var express=require(_0x3dd0('0x0'));var router=express['Router']();var auth=require(_0x3dd0('0x1'));var controller=require('./user-setting.controller');router[_0x3dd0('0x2')]('/:id',auth[_0x3dd0('0x3')](),controller[_0x3dd0('0x4')]);module[_0x3dd0('0x5')]=router; \ No newline at end of file +var _0x4365=['express','Router','../../components/auth/service','put','/:id','update','exports'];(function(_0x18ebd6,_0xde5e75){var _0x303d26=function(_0x1921ce){while(--_0x1921ce){_0x18ebd6['push'](_0x18ebd6['shift']());}};_0x303d26(++_0xde5e75);}(_0x4365,0x1ce));var _0x5436=function(_0x5caaa0,_0x393cc3){_0x5caaa0=_0x5caaa0-0x0;var _0x46b273=_0x4365[_0x5caaa0];return _0x46b273;};'use strict';var express=require(_0x5436('0x0'));var router=express[_0x5436('0x1')]();var auth=require(_0x5436('0x2'));var controller=require('./user-setting.controller');router[_0x5436('0x3')](_0x5436('0x4'),auth['isAuthenticated'](),controller[_0x5436('0x5')]);module[_0x5436('0x6')]=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 053eff9..190bfe5 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 _0x06c0=['INTEGER','sequelize','warning','debug','exports','ENUM','TEXT'];(function(_0x317dc2,_0x2fcb0a){var _0x332e60=function(_0x3de79e){while(--_0x3de79e){_0x317dc2['push'](_0x317dc2['shift']());}};_0x332e60(++_0x2fcb0a);}(_0x06c0,0xc5));var _0x006c=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x06c0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x006c('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x006c('0x1'),'info',_0x006c('0x2')];module[_0x006c('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x006c('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x006c('0x5')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x006c('0x6')],'unique':'UserId'}}; \ No newline at end of file +var _0x0cdf=['UserId','sequelize','error','warning','info','debug','exports','TEXT','INTEGER'];(function(_0x1d3a8b,_0x417a06){var _0xae29ba=function(_0x383fdf){while(--_0x383fdf){_0x1d3a8b['push'](_0x1d3a8b['shift']());}};_0xae29ba(++_0x417a06);}(_0x0cdf,0x12a));var _0xf0cd=function(_0x487f47,_0x32b30b){_0x487f47=_0x487f47-0x0;var _0x35988b=_0x0cdf[_0x487f47];return _0x35988b;};'use strict';var Sequelize=require(_0xf0cd('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xf0cd('0x1'),_0xf0cd('0x2'),_0xf0cd('0x3'),_0xf0cd('0x4')];module[_0xf0cd('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xf0cd('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xf0cd('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xf0cd('0x7')],'unique':_0xf0cd('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 663cd86..c7e21d3 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 _0xd240=['localhost','status','json','update','then','error','stack','send','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','ioredis','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register'];(function(_0x459e7b,_0x58d063){var _0x20b4e3=function(_0x4a00d1){while(--_0x4a00d1){_0x459e7b['push'](_0x459e7b['shift']());}};_0x20b4e3(++_0x58d063);}(_0xd240,0x1c7));var _0x0d24=function(_0x5758b5,_0x4bb1dd){_0x5758b5=_0x5758b5-0x0;var _0x36b590=_0xd240[_0x5758b5];return _0x36b590;};'use strict';var _=require('lodash');var Redis=require(_0x0d24('0x0'));var logger=require('../../config/logger')('api');var config=require(_0x0d24('0x1'));var db=require(_0x0d24('0x2'))['db'];var socket=require(_0x0d24('0x3'))(new Redis(config[_0x0d24('0x4')]));require(_0x0d24('0x5'))[_0x0d24('0x6')](socket);config['redis']=_['defaults'](config[_0x0d24('0x4')],{'host':_0x0d24('0x7'),'port':0x18eb});function respondWithResult(_0x1005ff,_0x250141){_0x250141=_0x250141||0xc8;return function(_0x48fb91){if(_0x48fb91){return _0x1005ff[_0x0d24('0x8')](_0x250141)[_0x0d24('0x9')](_0x48fb91);}};}function saveUpdates(_0x4345ae){return function(_0x43d5e0){if(_0x43d5e0){return _0x43d5e0[_0x0d24('0xa')](_0x4345ae)[_0x0d24('0xb')](function(_0x23f9ed){return _0x23f9ed;});}return null;};}function handleEntityNotFound(_0x4b55f0){return function(_0x3aedef){if(!_0x3aedef){_0x4b55f0['sendStatus'](0x194);}return _0x3aedef;};}function handleError(_0xc98389,_0x52550f){_0x52550f=_0x52550f||0x1f4;return function(_0x1603a8){logger[_0x0d24('0xc')](_0x1603a8[_0x0d24('0xd')]);if(_0x1603a8['name']){delete _0x1603a8['name'];}_0xc98389[_0x0d24('0x8')](_0x52550f)[_0x0d24('0xe')](_0x1603a8);};}exports[_0x0d24('0xa')]=function(_0x4de3a0,_0x1149ec){if(_0x4de3a0[_0x0d24('0xf')]['role']!=='admin')throw new Error(_0x0d24('0x10'));if(isNaN(Number(_0x4de3a0[_0x0d24('0x11')]['id'])))throw new Error(_0x0d24('0x12'));return db[_0x0d24('0x13')][_0x0d24('0x14')]({'where':{'id':_0x4de3a0[_0x0d24('0x11')]['id']}})[_0x0d24('0xb')](handleEntityNotFound(_0x1149ec,null))[_0x0d24('0xb')](saveUpdates(_0x4de3a0['body'],null))[_0x0d24('0xb')](respondWithResult(_0x1149ec,null))[_0x0d24('0x15')](handleError(_0x1149ec,null));}; \ No newline at end of file +var _0xae53=['Invalid\x20user\x20setting\x20id','UserSetting','find','then','body','catch','lodash','../../config/logger','api','../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','status','json','update','sendStatus','stack','name','user','role','admin','Unauthorized'];(function(_0x7ba09d,_0x1acf31){var _0x307fcf=function(_0x329969){while(--_0x329969){_0x7ba09d['push'](_0x7ba09d['shift']());}};_0x307fcf(++_0x1acf31);}(_0xae53,0x16e));var _0x3ae5=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xae53[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x3ae5('0x0'));var Redis=require('ioredis');var logger=require(_0x3ae5('0x1'))(_0x3ae5('0x2'));var config=require(_0x3ae5('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x3ae5('0x4'))(new Redis(config[_0x3ae5('0x5')]));require(_0x3ae5('0x6'))[_0x3ae5('0x7')](socket);config[_0x3ae5('0x5')]=_['defaults'](config[_0x3ae5('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x2664cd,_0x2205f7){_0x2205f7=_0x2205f7||0xc8;return function(_0x29174e){if(_0x29174e){return _0x2664cd[_0x3ae5('0x8')](_0x2205f7)[_0x3ae5('0x9')](_0x29174e);}};}function saveUpdates(_0x16e9b1){return function(_0x2b4d6f){if(_0x2b4d6f){return _0x2b4d6f[_0x3ae5('0xa')](_0x16e9b1)['then'](function(_0xbd3c3e){return _0xbd3c3e;});}return null;};}function handleEntityNotFound(_0x494053){return function(_0x8147f4){if(!_0x8147f4){_0x494053[_0x3ae5('0xb')](0x194);}return _0x8147f4;};}function handleError(_0x315476,_0x11bc49){_0x11bc49=_0x11bc49||0x1f4;return function(_0x1f24bf){logger['error'](_0x1f24bf[_0x3ae5('0xc')]);if(_0x1f24bf[_0x3ae5('0xd')]){delete _0x1f24bf[_0x3ae5('0xd')];}_0x315476['status'](_0x11bc49)['send'](_0x1f24bf);};}exports[_0x3ae5('0xa')]=function(_0x5943e6,_0x8627d8){if(_0x5943e6[_0x3ae5('0xe')][_0x3ae5('0xf')]!==_0x3ae5('0x10'))throw new Error(_0x3ae5('0x11'));if(isNaN(Number(_0x5943e6['params']['id'])))throw new Error(_0x3ae5('0x12'));return db[_0x3ae5('0x13')][_0x3ae5('0x14')]({'where':{'id':_0x5943e6['params']['id']}})['then'](handleEntityNotFound(_0x8627d8,null))[_0x3ae5('0x15')](saveUpdates(_0x5943e6[_0x3ae5('0x16')],null))[_0x3ae5('0x15')](respondWithResult(_0x8627d8,null))[_0x3ae5('0x17')](handleError(_0x8627d8,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 bdea77c..af9ef11 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 _0xcf91=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0xcf91,0x1cd));var _0x1cf9=function(_0x416d0c,_0x3116a6){_0x416d0c=_0x416d0c-0x0;var _0x2b1ac4=_0xcf91[_0x416d0c];return _0x2b1ac4;};'use strict';var EventEmitter=require(_0x1cf9('0x0'));var UserSetting=require(_0x1cf9('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x1cf9('0x2')](0x0);var events={'afterCreate':_0x1cf9('0x3'),'afterUpdate':_0x1cf9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5acdb7){return function(_0x10ff91,_0x433bf2,_0x2dc694){UserSettingEvents[_0x1cf9('0x5')](_0x5acdb7+':'+_0x10ff91['id'],_0x10ff91);UserSettingEvents[_0x1cf9('0x5')](_0x5acdb7,_0x10ff91);_0x2dc694(null);};}for(var e in events){if(events[_0x1cf9('0x6')](e)){var event=events[e];UserSetting[_0x1cf9('0x7')](e,emitEvent(event));}}module[_0x1cf9('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x400a=['emit','hook','exports','events','../../mysqldb','UserSetting','setMaxListeners','save','update'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x400a,0xf6));var _0xa400=function(_0xde4037,_0x368fcd){_0xde4037=_0xde4037-0x0;var _0x296e14=_0x400a[_0xde4037];return _0x296e14;};'use strict';var EventEmitter=require(_0xa400('0x0'));var UserSetting=require(_0xa400('0x1'))['db'][_0xa400('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa400('0x3')](0x0);var events={'afterCreate':_0xa400('0x4'),'afterUpdate':_0xa400('0x5'),'afterDestroy':'remove'};function emitEvent(_0x10f4ba){return function(_0x45f52f,_0x1ad7f9,_0x246cbe){UserSettingEvents[_0xa400('0x6')](_0x10f4ba+':'+_0x45f52f['id'],_0x45f52f);UserSettingEvents[_0xa400('0x6')](_0x10f4ba,_0x45f52f);_0x246cbe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xa400('0x7')](e,emitEvent(event));}}module[_0xa400('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 b40f56d..6437c06 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 _0x0490=['exports','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x0490,0x147));var _0x0049=function(_0x41479d,_0x2911da){_0x41479d=_0x41479d-0x0;var _0x435670=_0x0490[_0x41479d];return _0x435670;};'use strict';var attributes=require('./user-setting.attributes');module[_0x0049('0x0')]=function(_0x5f5313){return _0x5f5313['define']('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2803f6){if(!_0x2803f6[_0x0049('0x1')])_0x2803f6[_0x0049('0x2')]=null;else if(_0x2803f6[_0x0049('0x2')]===null)_0x2803f6[_0x0049('0x2')]=new Date();}}});}; \ No newline at end of file +var _0x4dd2=['clientSideLoggingEnabledSince','exports','define','user_settings','clientSideLoggingEnabled'];(function(_0x300317,_0x513ce6){var _0x56a1f6=function(_0xecd705){while(--_0xecd705){_0x300317['push'](_0x300317['shift']());}};_0x56a1f6(++_0x513ce6);}(_0x4dd2,0xf1));var _0x24dd=function(_0x2300fa,_0x41c382){_0x2300fa=_0x2300fa-0x0;var _0x11fef0=_0x4dd2[_0x2300fa];return _0x11fef0;};'use strict';var attributes=require('./user-setting.attributes');module[_0x24dd('0x0')]=function(_0x2ee27b){return _0x2ee27b[_0x24dd('0x1')]('UserSetting',attributes,{'tableName':_0x24dd('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c459c){if(!_0x5c459c[_0x24dd('0x3')])_0x5c459c['clientSideLoggingEnabledSince']=null;else if(_0x5c459c[_0x24dd('0x4')]===null)_0x5c459c[_0x24dd('0x4')]=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 be390f8..a76d40d 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 _0xe19d=['user-setting:update','UserId','register','length','user-setting:','./user-setting.events','remove','emit'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0xe19d,0x12d));var _0xde19=function(_0x1fdce6,_0x4412d9){_0x1fdce6=_0x1fdce6-0x0;var _0x36b546=_0xe19d[_0x1fdce6];return _0x36b546;};'use strict';var UserSettingEvents=require(_0xde19('0x0'));var events=['save',_0xde19('0x1'),'update'];function createListener(_0x3c3f9d,_0x130926){return function(_0x44cbfc){_0x130926[_0xde19('0x2')](_0x3c3f9d,_0x44cbfc);if(_0x3c3f9d===_0xde19('0x3')){_0x130926[_0xde19('0x2')]('user-setting:update:user-'+_0x44cbfc[_0xde19('0x4')],_0x44cbfc);}};}exports[_0xde19('0x5')]=function(_0x3727ef){for(var _0x4f17b9=0x0,_0x1ed5bd=events[_0xde19('0x6')];_0x4f17b9<_0x1ed5bd;_0x4f17b9++){var _0x274391=events[_0x4f17b9];var _0x391df3=createListener(_0xde19('0x7')+_0x274391,_0x3727ef);UserSettingEvents['on'](_0x274391,_0x391df3);}}; \ No newline at end of file +var _0x8e7a=['save','remove','update','emit','user-setting:update','UserId','./user-setting.events'];(function(_0x2b32fe,_0x3235ca){var _0x232ef9=function(_0x3b0807){while(--_0x3b0807){_0x2b32fe['push'](_0x2b32fe['shift']());}};_0x232ef9(++_0x3235ca);}(_0x8e7a,0xdf));var _0xa8e7=function(_0x19b4e1,_0x1cb1d7){_0x19b4e1=_0x19b4e1-0x0;var _0xff3d75=_0x8e7a[_0x19b4e1];return _0xff3d75;};'use strict';var UserSettingEvents=require(_0xa8e7('0x0'));var events=[_0xa8e7('0x1'),_0xa8e7('0x2'),_0xa8e7('0x3')];function createListener(_0x1f909d,_0x27f268){return function(_0x853951){_0x27f268[_0xa8e7('0x4')](_0x1f909d,_0x853951);if(_0x1f909d===_0xa8e7('0x5')){_0x27f268[_0xa8e7('0x4')]('user-setting:update:user-'+_0x853951[_0xa8e7('0x6')],_0x853951);}};}exports['register']=function(_0x57aebb){for(var _0x3154e2=0x0,_0x24b53b=events['length'];_0x3154e2<_0x24b53b;_0x3154e2++){var _0x47bf91=events[_0x3154e2];var _0x9e88cf=createListener('user-setting:'+_0x47bf91,_0x57aebb);UserSettingEvents['on'](_0x47bf91,_0x9e88cf);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 0748546..f49e24f 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 _0x5126=['/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','/:id/password','removeQueues','removeTeams','delete','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','/:id/chat_websites','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','/whoami','whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/sms_accounts','getSmsAccounts','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','/:id/contacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','originalname','file','addAvatar','login','/:id/logout','logout','pause','/:id/unpause','unpause','addTeams'];(function(_0x75ce5b,_0x3b582f){var _0x22195e=function(_0x166668){while(--_0x166668){_0x75ce5b['push'](_0x75ce5b['shift']());}};_0x22195e(++_0x3b582f);}(_0x5126,0x113));var _0x6512=function(_0x5a5203,_0x1210a9){_0x5a5203=_0x5a5203-0x0;var _0x5eaa19=_0x5126[_0x5a5203];return _0x5eaa19;};'use strict';var multer=require(_0x6512('0x0'));var util=require(_0x6512('0x1'));var path=require(_0x6512('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6512('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6512('0x4'));var controller=require(_0x6512('0x5'));router[_0x6512('0x6')]('/',auth[_0x6512('0x7')](),controller['index']);router[_0x6512('0x6')](_0x6512('0x8'),auth[_0x6512('0x7')](),controller['describe']);router[_0x6512('0x6')](_0x6512('0x9'),auth[_0x6512('0x7')](),controller[_0x6512('0xa')]);router['get']('/presence',auth[_0x6512('0x7')](),controller[_0x6512('0xb')]);router[_0x6512('0x6')](_0x6512('0xc'),auth[_0x6512('0x7')](),controller[_0x6512('0xd')]);router[_0x6512('0x6')](_0x6512('0xe'),controller[_0x6512('0xf')]);router[_0x6512('0x6')](_0x6512('0x10'),auth[_0x6512('0x7')](),controller[_0x6512('0x11')]);router[_0x6512('0x6')]('/:id/contacts',auth['isAuthenticated'](),controller['getContacts']);router[_0x6512('0x6')](_0x6512('0x12'),auth[_0x6512('0x7')](),controller[_0x6512('0x13')]);router[_0x6512('0x6')](_0x6512('0x14'),auth[_0x6512('0x7')](),controller[_0x6512('0x15')]);router[_0x6512('0x6')](_0x6512('0x16'),auth[_0x6512('0x7')](),controller[_0x6512('0x17')]);router['get']('/:id/recordings',auth[_0x6512('0x7')](),controller[_0x6512('0x18')]);router[_0x6512('0x6')](_0x6512('0x19'),auth[_0x6512('0x7')](),controller[_0x6512('0x1a')]);router['get'](_0x6512('0x1b'),auth['isAuthenticated'](),controller[_0x6512('0x1c')]);router['get']('/:id/openchannel/interactions',auth[_0x6512('0x7')](),controller[_0x6512('0x1d')]);router[_0x6512('0x6')](_0x6512('0x1e'),auth[_0x6512('0x7')](),controller[_0x6512('0x1f')]);router[_0x6512('0x6')](_0x6512('0x20'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x6512('0x6')](_0x6512('0x21'),auth[_0x6512('0x7')](),controller[_0x6512('0x22')]);router[_0x6512('0x6')](_0x6512('0x23'),auth[_0x6512('0x7')](),controller[_0x6512('0x24')]);router[_0x6512('0x6')](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x26')]);router[_0x6512('0x6')](_0x6512('0x27'),auth['isAuthenticated'](),controller[_0x6512('0x28')]);router[_0x6512('0x6')]('/:id/agents',auth['isAuthenticated'](),controller[_0x6512('0x29')]);router[_0x6512('0x6')]('/:id/prefixes',auth[_0x6512('0x7')](),controller[_0x6512('0x2a')]);router['get'](_0x6512('0x2b'),auth[_0x6512('0x7')](),controller[_0x6512('0x2c')]);router['get'](_0x6512('0x2d'),auth[_0x6512('0x7')](),controller[_0x6512('0x2e')]);router['get']('/:id/openchannel_accounts',auth[_0x6512('0x7')](),controller['getOpenchannelAccounts']);router[_0x6512('0x6')](_0x6512('0x2f'),auth[_0x6512('0x7')](),controller[_0x6512('0x30')]);router[_0x6512('0x6')]('/:id/chat_websites',auth['isAuthenticated'](),controller['getChatWebsites']);router[_0x6512('0x6')](_0x6512('0x31'),auth[_0x6512('0x7')](),controller['getWhatsappAccounts']);router[_0x6512('0x6')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x33')]);router[_0x6512('0x6')]('/:id/scheduled_calls',auth[_0x6512('0x7')](),controller[_0x6512('0x34')]);router[_0x6512('0x6')](_0x6512('0x35'),auth['isAuthenticated'](),controller[_0x6512('0x36')]);router[_0x6512('0x37')](_0x6512('0x38'),auth[_0x6512('0x7')](),controller['addContacts']);router[_0x6512('0x37')]('/',auth[_0x6512('0x7')](),controller[_0x6512('0x39')]);router[_0x6512('0x37')](_0x6512('0x3a'),auth['isAuthenticated'](),controller[_0x6512('0x3b')]);router[_0x6512('0x37')](_0x6512('0x12'),auth[_0x6512('0x7')](),controller[_0x6512('0x3c')]);var upload=multer({'storage':multer[_0x6512('0x3d')]({'destination':function(_0x11e25c,_0x20f8c9,_0x4b65a5){_0x4b65a5(null,path[_0x6512('0x3e')](config[_0x6512('0x3f')],_0x6512('0x40')));},'filename':function(_0x3ec79d,_0x433655,_0x4c4c12){_0x4c4c12(null,util[_0x6512('0x41')]('%s-%s',Date['now'](),_0x433655[_0x6512('0x42')]));}})});router[_0x6512('0x37')]('/:id/avatar',upload['single'](_0x6512('0x43')),controller[_0x6512('0x44')]);router[_0x6512('0x37')]('/:id/login',auth[_0x6512('0x7')](),controller[_0x6512('0x45')]);router[_0x6512('0x37')](_0x6512('0x46'),auth[_0x6512('0x7')](),controller[_0x6512('0x47')]);router[_0x6512('0x37')]('/:id/pause',auth[_0x6512('0x7')](),controller[_0x6512('0x48')]);router[_0x6512('0x37')](_0x6512('0x49'),auth['isAuthenticated'](),controller[_0x6512('0x4a')]);router[_0x6512('0x37')](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x4b')]);router[_0x6512('0x37')](_0x6512('0x4c'),auth[_0x6512('0x7')](),controller[_0x6512('0x4d')]);router['post'](_0x6512('0x4e'),auth[_0x6512('0x7')](),controller[_0x6512('0x4f')]);router[_0x6512('0x37')](_0x6512('0x50'),auth[_0x6512('0x7')](),controller[_0x6512('0x51')]);router['post'](_0x6512('0x52'),auth[_0x6512('0x7')](),controller[_0x6512('0x53')]);router[_0x6512('0x37')](_0x6512('0x54'),auth[_0x6512('0x7')](),controller['addOpenchannelInteractions']);router[_0x6512('0x37')](_0x6512('0x55'),auth[_0x6512('0x7')](),controller[_0x6512('0x56')]);router[_0x6512('0x37')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x6512('0x57')]);router[_0x6512('0x37')](_0x6512('0x2d'),auth[_0x6512('0x7')](),controller[_0x6512('0x58')]);router[_0x6512('0x37')](_0x6512('0x59'),auth[_0x6512('0x7')](),controller[_0x6512('0x5a')]);router['post'](_0x6512('0x2f'),auth[_0x6512('0x7')](),controller['addSmsAccounts']);router[_0x6512('0x37')]('/:id/chat_websites',auth[_0x6512('0x7')](),controller[_0x6512('0x5b')]);router[_0x6512('0x37')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x6512('0x5c')]);router[_0x6512('0x37')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x5d')]);router[_0x6512('0x37')]('/:id/api_key',auth[_0x6512('0x7')](),controller[_0x6512('0x5e')]);router[_0x6512('0x5f')](_0x6512('0xc'),auth[_0x6512('0x7')](),controller[_0x6512('0x60')]);router[_0x6512('0x5f')](_0x6512('0x61'),auth[_0x6512('0x7')](),controller['changePassword']);router['delete'](_0x6512('0x12'),auth['isAuthenticated'](),controller[_0x6512('0x62')]);router['delete'](_0x6512('0x25'),auth[_0x6512('0x7')](),controller[_0x6512('0x63')]);router[_0x6512('0x64')]('/:id',auth[_0x6512('0x7')](),controller[_0x6512('0x65')]);router['delete'](_0x6512('0x4c'),auth[_0x6512('0x7')](),controller[_0x6512('0x66')]);router['delete'](_0x6512('0x4e'),auth[_0x6512('0x7')](),controller['removeMailInteractions']);router[_0x6512('0x64')](_0x6512('0x50'),auth[_0x6512('0x7')](),controller[_0x6512('0x67')]);router['delete']('/:id/sms_interactions',auth[_0x6512('0x7')](),controller[_0x6512('0x68')]);router[_0x6512('0x64')](_0x6512('0x54'),auth['isAuthenticated'](),controller[_0x6512('0x69')]);router[_0x6512('0x64')](_0x6512('0x55'),auth[_0x6512('0x7')](),controller[_0x6512('0x6a')]);router[_0x6512('0x64')]('/:id/fax_accounts',auth[_0x6512('0x7')](),controller[_0x6512('0x6b')]);router[_0x6512('0x64')](_0x6512('0x2d'),auth['isAuthenticated'](),controller[_0x6512('0x6c')]);router['delete'](_0x6512('0x59'),auth[_0x6512('0x7')](),controller[_0x6512('0x6d')]);router['delete']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x6512('0x6e')]);router[_0x6512('0x64')](_0x6512('0x6f'),auth[_0x6512('0x7')](),controller[_0x6512('0x70')]);router['delete'](_0x6512('0x31'),auth[_0x6512('0x7')](),controller[_0x6512('0x71')]);router[_0x6512('0x64')](_0x6512('0x32'),auth[_0x6512('0x7')](),controller[_0x6512('0x72')]);router[_0x6512('0x64')](_0x6512('0x35'),auth[_0x6512('0x7')](),controller[_0x6512('0x73')]);module[_0x6512('0x74')]=router; \ No newline at end of file +var _0xfb03=['getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','addContacts','post','create','diskStorage','join','root','server/files/images/','now','originalname','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','/:id/fax_accounts','addMailAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addSquareProjects','/:id/api_key','put','update','/:id/password','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','whoami','/presence','getPresence','/:id','show','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/chat_websites'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfb03,0x125));var _0x3fb0=function(_0x301a8f,_0x56294e){_0x301a8f=_0x301a8f-0x0;var _0xcbe001=_0xfb03[_0x301a8f];return _0xcbe001;};'use strict';var multer=require(_0x3fb0('0x0'));var util=require(_0x3fb0('0x1'));var path=require(_0x3fb0('0x2'));var timeout=require(_0x3fb0('0x3'));var express=require(_0x3fb0('0x4'));var router=express[_0x3fb0('0x5')]();var fs_extra=require(_0x3fb0('0x6'));var auth=require(_0x3fb0('0x7'));var interaction=require(_0x3fb0('0x8'));var config=require(_0x3fb0('0x9'));var controller=require(_0x3fb0('0xa'));router[_0x3fb0('0xb')]('/',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0xd')]);router[_0x3fb0('0xb')](_0x3fb0('0xe'),auth['isAuthenticated'](),controller[_0x3fb0('0xf')]);router[_0x3fb0('0xb')]('/whoami',auth['isAuthenticated'](),controller[_0x3fb0('0x10')]);router['get'](_0x3fb0('0x11'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x12')]);router[_0x3fb0('0xb')](_0x3fb0('0x13'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x14')]);router[_0x3fb0('0xb')]('/:id/avatar',controller['getAvatar']);router[_0x3fb0('0xb')](_0x3fb0('0x15'),auth[_0x3fb0('0xc')](),controller['getOpenTabs']);router[_0x3fb0('0xb')](_0x3fb0('0x16'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x17')]);router[_0x3fb0('0xb')](_0x3fb0('0x18'),auth[_0x3fb0('0xc')](),controller['getQueues']);router[_0x3fb0('0xb')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x3fb0('0x19')]);router[_0x3fb0('0xb')](_0x3fb0('0x1a'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x1b')]);router['get'](_0x3fb0('0x1c'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x1d')]);router[_0x3fb0('0xb')](_0x3fb0('0x1e'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x1f')]);router[_0x3fb0('0xb')](_0x3fb0('0x20'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x3fb0('0xb')](_0x3fb0('0x21'),auth[_0x3fb0('0xc')](),controller['getOpenchannelInteractions']);router[_0x3fb0('0xb')](_0x3fb0('0x22'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x23')]);router[_0x3fb0('0xb')](_0x3fb0('0x24'),auth[_0x3fb0('0xc')](),controller['getSmsInteractions']);router[_0x3fb0('0xb')](_0x3fb0('0x25'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x26')]);router[_0x3fb0('0xb')](_0x3fb0('0x27'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x28')]);router['get'](_0x3fb0('0x29'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x2a')]);router['get'](_0x3fb0('0x2b'),auth[_0x3fb0('0xc')](),controller['getLists']);router['get']('/:id/agents',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x2c')]);router[_0x3fb0('0xb')](_0x3fb0('0x2d'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x2e')]);router[_0x3fb0('0xb')]('/:id/fax_accounts',auth[_0x3fb0('0xc')](),controller['getFaxAccounts']);router[_0x3fb0('0xb')](_0x3fb0('0x2f'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x30')]);router[_0x3fb0('0xb')](_0x3fb0('0x31'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x32')]);router[_0x3fb0('0xb')]('/:id/sms_accounts',auth[_0x3fb0('0xc')](),controller['getSmsAccounts']);router[_0x3fb0('0xb')](_0x3fb0('0x33'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x34')]);router[_0x3fb0('0xb')](_0x3fb0('0x35'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x36')]);router['get'](_0x3fb0('0x37'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x38')]);router[_0x3fb0('0xb')](_0x3fb0('0x39'),auth[_0x3fb0('0xc')](),controller['getScheduledCalls']);router[_0x3fb0('0xb')]('/:id/api_key',auth[_0x3fb0('0xc')](),controller['getApiKey']);router['post'](_0x3fb0('0x16'),auth['isAuthenticated'](),controller[_0x3fb0('0x3a')]);router[_0x3fb0('0x3b')]('/',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x3c')]);router[_0x3fb0('0x3b')]('/create_many',auth[_0x3fb0('0xc')](),controller['bulkCreate']);router[_0x3fb0('0x3b')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x3fb0('0x3d')]({'destination':function(_0x3b532a,_0x2d589b,_0x3523fb){_0x3523fb(null,path[_0x3fb0('0x3e')](config[_0x3fb0('0x3f')],_0x3fb0('0x40')));},'filename':function(_0x4b9b4f,_0x233d97,_0x341dcc){_0x341dcc(null,util['format']('%s-%s',Date[_0x3fb0('0x41')](),_0x233d97[_0x3fb0('0x42')]));}})});router['post'](_0x3fb0('0x43'),upload[_0x3fb0('0x44')](_0x3fb0('0x45')),controller[_0x3fb0('0x46')]);router[_0x3fb0('0x3b')](_0x3fb0('0x47'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x48')]);router['post'](_0x3fb0('0x49'),auth['isAuthenticated'](),controller[_0x3fb0('0x4a')]);router[_0x3fb0('0x3b')]('/:id/pause',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x4b')]);router['post'](_0x3fb0('0x4c'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x4d')]);router[_0x3fb0('0x3b')](_0x3fb0('0x29'),auth[_0x3fb0('0xc')](),controller['addTeams']);router['post'](_0x3fb0('0x4e'),auth[_0x3fb0('0xc')](),controller['addChatInteractions']);router[_0x3fb0('0x3b')](_0x3fb0('0x4f'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x50')]);router[_0x3fb0('0x3b')]('/:id/fax_interactions',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x51')]);router[_0x3fb0('0x3b')](_0x3fb0('0x52'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x53')]);router[_0x3fb0('0x3b')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3fb0('0x54')]);router['post'](_0x3fb0('0x55'),auth[_0x3fb0('0xc')](),controller['addWhatsappInteractions']);router[_0x3fb0('0x3b')](_0x3fb0('0x56'),auth[_0x3fb0('0xc')](),controller['addFaxAccounts']);router[_0x3fb0('0x3b')](_0x3fb0('0x2f'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x57')]);router[_0x3fb0('0x3b')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x3fb0('0x58')]);router[_0x3fb0('0x3b')](_0x3fb0('0x59'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x5a')]);router[_0x3fb0('0x3b')](_0x3fb0('0x33'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x5b')]);router[_0x3fb0('0x3b')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x3fb0('0x3b')](_0x3fb0('0x37'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x5c')]);router[_0x3fb0('0x3b')](_0x3fb0('0x5d'),auth[_0x3fb0('0xc')](),controller['createApiKey']);router[_0x3fb0('0x5e')](_0x3fb0('0x13'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x5f')]);router[_0x3fb0('0x5e')](_0x3fb0('0x60'),auth['isAuthenticated'](),controller[_0x3fb0('0x61')]);router[_0x3fb0('0x62')]('/:id/queues',auth['isAuthenticated'](),controller[_0x3fb0('0x63')]);router['delete'](_0x3fb0('0x29'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x64')]);router[_0x3fb0('0x62')](_0x3fb0('0x13'),auth[_0x3fb0('0xc')](),controller['destroy']);router['delete'](_0x3fb0('0x4e'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x65')]);router[_0x3fb0('0x62')](_0x3fb0('0x4f'),auth['isAuthenticated'](),controller[_0x3fb0('0x66')]);router[_0x3fb0('0x62')](_0x3fb0('0x67'),auth[_0x3fb0('0xc')](),controller['removeFaxInteractions']);router['delete'](_0x3fb0('0x52'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x68')]);router['delete'](_0x3fb0('0x69'),auth['isAuthenticated'](),controller[_0x3fb0('0x6a')]);router['delete'](_0x3fb0('0x55'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x6b')]);router[_0x3fb0('0x62')](_0x3fb0('0x56'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router['delete'](_0x3fb0('0x2f'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x6c')]);router[_0x3fb0('0x62')](_0x3fb0('0x31'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x6d')]);router['delete'](_0x3fb0('0x59'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x6e')]);router['delete']('/:id/chat_websites',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x6f')]);router[_0x3fb0('0x62')]('/:id/whatsapp_accounts',auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x70')]);router[_0x3fb0('0x62')](_0x3fb0('0x37'),auth[_0x3fb0('0xc')](),controller[_0x3fb0('0x71')]);router[_0x3fb0('0x62')]('/:id/api_key',auth['isAuthenticated'](),controller['removeApiKey']);module[_0x3fb0('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a2d64e5..f10f7b9 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0xfbe06e,_0x2fb7ab){var _0x24e5b6=function(_0x48569f){while(--_0x48569f){_0xfbe06e['push'](_0xfbe06e['shift']());}};_0x24e5b6(++_0x2fb7ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 57c3051..f782146 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 _0x2974=['upsert','removeQueues','Unknown\x20channel','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','file','filename','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','whatsapp','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','concat','getContacts','CmContact','filters','order','sort','pick','hasOwnProperty','CmList','List','color','tag','nolimit','getQueues','Queue','getVoiceQueuesRt','getGroups','getRecordings','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','MemberReport','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','forEach','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','addAgent','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','TeamVoicePrefix','getLists','getAgents','values','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','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','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notILike','$overlap','$contained','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','API\x20key\x20not\x20available','whoami','getPresence','queues','teams','inbound','flatten','col','toString','asc','desc','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','idle','unknown','ringing','voiceStatus','busy','slice','toUpperCase','select','InteractionId','field','ui.createdAt','user_has_','OpenTabs','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../errors/api','APIBadRequestError','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','emit','userNotification:recalc:','destroy','role','admin','Users','Agents','agent','Telephones','telephone','filter','ignore','map','value','find','name','UserProfileResource','send','index','User','rawAttributes','fieldName','key','includes','where','include','query','userSetting','UserSetting','findAll','rows','push','chat','sms','dataValues','mail','all','model','differenceBy','password','keys','intersection','attributes','fields','length','includeAll','true','merge','options','openTabs','openchannel','fax','update','body','params','describe','addContacts','ids','Setting','findById','securePassword','validatePasswordPattern','max','isNil','internal','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','fullname','email','permissions','101','102','113','104','105','106','107','108','109','114','create','user','Unauthorized','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','VoiceMail','UserProfileSection','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\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','isEmpty','compact','changePassword','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','oldPassword','Sequelize','Wrong\x20credentials','newPassword','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','previousPasswords','channel','voicePause','interface','isValidChannel','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','VoiceQueue','get','online','format','SIP/%s'];(function(_0x49cbbd,_0x1d7755){var _0x210de1=function(_0xe1e312){while(--_0xe1e312){_0x49cbbd['push'](_0x49cbbd['shift']());}};_0x210de1(++_0x1d7755);}(_0x2974,0xdd));var _0x4297=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x2974[_0xa3c06b];return _0x33aa1d;};'use strict';var moment=require('moment');var util=require(_0x4297('0x0'));var path=require(_0x4297('0x1'));var fs=require('fs');var _=require(_0x4297('0x2'));var squel=require(_0x4297('0x3'));var jayson=require(_0x4297('0x4'));var Redis=require(_0x4297('0x5'));var authService=require(_0x4297('0x6'));var qs=require(_0x4297('0x7'));var logger=require(_0x4297('0x8'))(_0x4297('0x9'));var utils=require(_0x4297('0xa'));var config=require('../../config/environment');var licenseUtil=require(_0x4297('0xb'));var APIBadRequestError=require(_0x4297('0xc'))[_0x4297('0xd')];var APINotFoundError=require(_0x4297('0xc'))[_0x4297('0xe')];var APIHandleError=require(_0x4297('0xc'))[_0x4297('0xf')];var db=require(_0x4297('0x10'))['db'];var socket=require(_0x4297('0x11'))(new Redis(config['redis']));require(_0x4297('0x12'))[_0x4297('0x13')](socket);config[_0x4297('0x14')]=_[_0x4297('0x15')](config[_0x4297('0x14')],{'host':_0x4297('0x16'),'port':0x18eb});var amiClient=jayson[_0x4297('0x17')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x3c0a7d,_0x28402b,_0x1ee4fb,_0x5e96ac){return new Promise(function(_0xc4918e,_0x1af7e4){var _0x5cd9f3=_0x5e96ac||amiClient;return _0x5cd9f3[_0x4297('0x18')](_0x3c0a7d,_0x1ee4fb)[_0x4297('0x19')](function(_0x1710da){logger[_0x4297('0x1a')](_0x4297('0x1b'),_0x28402b,_0x4297('0x1c'));logger[_0x4297('0x1d')]('User,\x20%s,\x20%s,\x20%s',_0x28402b,_0x4297('0x1c'),JSON[_0x4297('0x1e')](_0x1710da));if(_0x1710da[_0x4297('0x1f')]){if(_0x1710da['error'][_0x4297('0x20')]===0x1f4){logger[_0x4297('0x1f')](_0x4297('0x1b'),_0x28402b,_0x1710da['error']['message']);return _0x1af7e4(_0x1710da[_0x4297('0x1f')][_0x4297('0x21')]);}logger[_0x4297('0x1f')](_0x4297('0x1b'),_0x28402b,_0x1710da[_0x4297('0x1f')][_0x4297('0x21')]);return _0xc4918e(_0x1710da[_0x4297('0x1f')][_0x4297('0x21')]);}else{logger[_0x4297('0x1a')](_0x4297('0x1b'),_0x28402b,'request\x20sent');_0xc4918e(_0x1710da[_0x4297('0x22')][_0x4297('0x21')]);}})[_0x4297('0x23')](function(_0x307713){logger[_0x4297('0x1f')](_0x4297('0x1b'),_0x28402b,_0x307713);_0x1af7e4(_0x307713);});});}function respondWithStatusCode(_0x2d7427,_0x470198){_0x470198=_0x470198||0xcc;return function(_0x4e6c22){if(_0x4e6c22){return _0x2d7427[_0x4297('0x24')](_0x470198);}return _0x2d7427['status'](_0x470198)[_0x4297('0x25')]();};}function respondWithResult(_0x242478,_0xb4dde7){_0xb4dde7=_0xb4dde7||0xc8;return function(_0x4fe1f4){if(_0x4fe1f4){return _0x242478[_0x4297('0x26')](_0xb4dde7)[_0x4297('0x27')](_0x4fe1f4);}};}function respondWithFilteredResult(_0x5924a6,_0x3fca25){return function(_0x2bbd86){if(_0x2bbd86){var _0x535b33=typeof _0x3fca25['offset']===_0x4297('0x28')&&typeof _0x3fca25[_0x4297('0x29')]===_0x4297('0x28');var _0xab556b=_0x2bbd86['count'];var _0x3edeb2=_0x535b33?0x0:_0x3fca25[_0x4297('0x2a')];var _0x40e119=_0x535b33?_0x2bbd86[_0x4297('0x2b')]:_0x3fca25[_0x4297('0x2a')]+_0x3fca25[_0x4297('0x29')];var _0xb5b31b;if(_0x40e119>=_0xab556b){_0x40e119=_0xab556b;_0xb5b31b=0xc8;}else{_0xb5b31b=0xce;}_0x5924a6[_0x4297('0x26')](_0xb5b31b);return _0x5924a6[_0x4297('0x2c')](_0x4297('0x2d'),_0x3edeb2+'-'+_0x40e119+'/'+_0xab556b)[_0x4297('0x27')](_0x2bbd86);}return null;};}function saveUpdates(_0x582482){return function(_0x5713a5){if(_0x5713a5){return _0x5713a5['update'](_0x582482)[_0x4297('0x19')](function(_0x41b320){socket[_0x4297('0x2e')](_0x4297('0x2f')+_0x41b320['id'],{});return _0x41b320;});}return null;};}function removeEntity(_0x4849be){return function(_0x4c185f){if(_0x4c185f){return _0x4c185f[_0x4297('0x30')]()[_0x4297('0x19')](function(){var _0x5e5aab=_0x4c185f['get']({'plain':!![]});if(_0x5e5aab[_0x4297('0x31')]===_0x4297('0x32'))return;var _0x25ea79=[{'name':_0x4297('0x33'),'value':'user','ignore':!![]},{'name':_0x4297('0x34'),'value':_0x4297('0x35'),'ignore':![]},{'name':_0x4297('0x36'),'value':_0x4297('0x37'),'ignore':![]}];var _0x16d809=_(_0x25ea79)[_0x4297('0x38')](_0x4297('0x39'))[_0x4297('0x3a')](_0x4297('0x3b'))['value']();if(_['includes'](_0x16d809,_0x5e5aab[_0x4297('0x31')])){return;}var _0x834b1f=_[_0x4297('0x3c')](_0x25ea79,[_0x4297('0x3b'),_0x5e5aab[_0x4297('0x31')]])[_0x4297('0x3d')];return db[_0x4297('0x3e')][_0x4297('0x30')]({'where':{'type':_0x834b1f,'resourceId':_0x5e5aab['id']}})[_0x4297('0x19')](function(){return _0x4c185f;});})[_0x4297('0x19')](function(){_0x4849be[_0x4297('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xba79c1){return function(_0x1f6892){if(!_0x1f6892){_0xba79c1['sendStatus'](0x194);}return _0x1f6892;};}function handleError(_0x3f74c6,_0x9f2423){_0x9f2423=_0x9f2423||0x1f4;return function(_0x2c7309){logger[_0x4297('0x1f')](_0x2c7309['stack']);if(_0x2c7309[_0x4297('0x3d')]){delete _0x2c7309[_0x4297('0x3d')];}_0x3f74c6[_0x4297('0x26')](_0x9f2423)[_0x4297('0x3f')](_0x2c7309);};}exports[_0x4297('0x40')]=function(_0x2e6e2a,_0x986919){var _0x222373={},_0x2e4839={'count':0x0,'rows':[]};var _0x4a13b5=_(db[_0x4297('0x41')][_0x4297('0x42')])[_0x4297('0x3a')](function(_0x4aa21e){return{'name':_0x4aa21e[_0x4297('0x43')],'type':_0x4aa21e['type'][_0x4297('0x44')]};})[_0x4297('0x38')](function(_0x13e06d){return!_[_0x4297('0x45')](['password','salt'],_0x13e06d[_0x4297('0x3d')]);})[_0x4297('0x3b')]();_0x222373=qs['getOptions'](_0x4a13b5,_0x2e6e2a);var _0x59609a={'where':_0x222373[_0x4297('0x46')]};return db[_0x4297('0x41')][_0x4297('0x2b')](_0x59609a)[_0x4297('0x19')](function(_0x4e6e49){_0x2e4839[_0x4297('0x2b')]=_0x4e6e49;if(_0x2e6e2a['query']['includeAll']){_0x222373[_0x4297('0x47')]=[{'all':!![]}];}if(_0x2e6e2a[_0x4297('0x48')][_0x4297('0x49')]==='true'){_0x222373[_0x4297('0x47')]=[{'model':db[_0x4297('0x4a')],'as':_0x4297('0x49')}];}if(!_['includes'](_0x222373['attributes'],'id')){_0x222373['attributes']['push']('id');}return db[_0x4297('0x41')][_0x4297('0x4b')](_0x222373);})[_0x4297('0x19')](function(_0x15b36d){_0x2e4839[_0x4297('0x4c')]=_0x15b36d;if(_0x2e6e2a['query']['openTabs']==='true'){var _0x31454e=[];for(var _0x17ba9d=0x0;_0x17ba9d<_0x2e4839['rows']['length'];_0x17ba9d++){_0x31454e[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4e'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e['push'](get_open_tabs(_0x4297('0x4f'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d][_0x4297('0x50')]));_0x31454e['push'](get_open_tabs('fax',_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs(_0x4297('0x51'),_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs('openchannel',_0x2e4839[_0x4297('0x4c')][_0x17ba9d]['dataValues']));_0x31454e[_0x4297('0x4d')](get_open_tabs('whatsapp',_0x2e4839['rows'][_0x17ba9d][_0x4297('0x50')]));}return Promise[_0x4297('0x52')](_0x31454e)['then'](function(){return _0x2e4839;});}else{return _0x2e4839;}})[_0x4297('0x19')](respondWithFilteredResult(_0x986919,_0x222373))[_0x4297('0x23')](handleError(_0x986919,null));};exports['show']=function(_0x6545cf,_0x54c83f){var _0x557947={'raw':![],'where':{'id':_0x6545cf['params']['id']}},_0x118130={};_0x118130[_0x4297('0x53')]=_[_0x4297('0x54')](_['keys'](db[_0x4297('0x41')][_0x4297('0x42')]),[_0x4297('0x55'),'salt']);_0x118130[_0x4297('0x48')]=_[_0x4297('0x56')](_0x6545cf[_0x4297('0x48')]);_0x118130['filters']=_[_0x4297('0x57')](_0x118130[_0x4297('0x53')],_0x118130['query']);_0x557947[_0x4297('0x58')]=_['intersection'](_0x118130[_0x4297('0x53')],qs[_0x4297('0x59')](_0x6545cf['query'][_0x4297('0x59')]));_0x557947['attributes']=_0x557947['attributes'][_0x4297('0x5a')]?_0x557947[_0x4297('0x58')]:_0x118130[_0x4297('0x53')];if(_0x6545cf[_0x4297('0x48')][_0x4297('0x5b')]){_0x557947[_0x4297('0x47')]=[{'all':!![]}];}if(_0x6545cf[_0x4297('0x48')][_0x4297('0x49')]===_0x4297('0x5c')){_0x557947[_0x4297('0x47')]=[{'model':db[_0x4297('0x4a')],'as':_0x4297('0x49')}];}_0x557947=_[_0x4297('0x5d')]({},_0x557947,_0x6545cf[_0x4297('0x5e')]);if(!_['includes'](_0x557947['attributes'],'id')){_0x557947[_0x4297('0x58')][_0x4297('0x4d')]('id');}return db[_0x4297('0x41')][_0x4297('0x3c')](_0x557947)[_0x4297('0x19')](handleEntityNotFound(_0x54c83f,null))[_0x4297('0x19')](function(_0x11b0ab){var _0x189e7a=[];values=_0x11b0ab;if(_0x6545cf[_0x4297('0x48')][_0x4297('0x5f')]===_0x4297('0x5c')){_0x189e7a['push'](get_open_tabs('chat',_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4f'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x60'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs('whatsapp',_0x11b0ab['dataValues']));_0x189e7a['push'](get_open_tabs(_0x4297('0x61'),_0x11b0ab[_0x4297('0x50')]));_0x189e7a[_0x4297('0x4d')](get_open_tabs(_0x4297('0x51'),_0x11b0ab[_0x4297('0x50')]));return Promise[_0x4297('0x52')](_0x189e7a);}else{return values;}})[_0x4297('0x19')](function(){return values;})[_0x4297('0x19')](respondWithResult(_0x54c83f,null))[_0x4297('0x23')](handleError(_0x54c83f,null));};exports[_0x4297('0x62')]=function(_0x4da332,_0x2ab1b2){if(_0x4da332[_0x4297('0x63')]['id']){delete _0x4da332['body']['id'];}delete _0x4da332[_0x4297('0x63')][_0x4297('0x31')];return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x4da332[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x2ab1b2,null))[_0x4297('0x19')](saveUpdates(_0x4da332[_0x4297('0x63')],null))['then'](respondWithResult(_0x2ab1b2,null))[_0x4297('0x23')](handleError(_0x2ab1b2,null));};exports[_0x4297('0x65')]=function(_0x379131,_0x549dee){return db[_0x4297('0x41')]['describe']()['then'](respondWithResult(_0x549dee,null))[_0x4297('0x23')](handleError(_0x549dee,null));};exports['addContacts']=function(_0x436c2b,_0x59cc2b){return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x436c2b[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x59cc2b,null))[_0x4297('0x19')](function(_0x2052ab){if(_0x2052ab){return _0x2052ab[_0x4297('0x66')](_0x436c2b[_0x4297('0x63')][_0x4297('0x67')],_['omit'](_0x436c2b[_0x4297('0x63')],[_0x4297('0x67'),'id'])||{});}})[_0x4297('0x19')](respondWithResult(_0x59cc2b,null))[_0x4297('0x23')](handleError(_0x59cc2b,null));};function validateUser(_0x591b50){return new Promise(function(_0x81f128,_0x2950f2){if(_0x591b50['internal'])return _0x81f128(_0x591b50);return db[_0x4297('0x68')][_0x4297('0x69')](0x1)['then'](function(_0x7241fd){if(_0x7241fd[_0x4297('0x6a')])authService[_0x4297('0x6b')](_0x591b50[_0x4297('0x55')]);db[_0x4297('0x41')][_0x4297('0x6c')]('internal')[_0x4297('0x19')](function(_0x4c5e16){if(_[_0x4297('0x6d')](_0x4c5e16)){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')]||0x1;return;}if(_[_0x4297('0x6d')](_0x7241fd[_0x4297('0x6f')])||_0x7241fd[_0x4297('0x6f')]===_0x4c5e16){_0x591b50[_0x4297('0x6e')]=_0x4c5e16+0x1;return;}if(_0x7241fd[_0x4297('0x6f')]>_0x4c5e16){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')];return;}return db['sequelize'][_0x4297('0x48')](_0x4297('0x70'),{'type':db[_0x4297('0x71')][_0x4297('0x72')][_0x4297('0x73')]})[_0x4297('0x19')](function(_0x1301dd){if(_0x1301dd&&_0x1301dd['length']){for(var _0x541c80=0x0,_0x1b7d13=_0x1301dd['length'];_0x541c80<_0x1b7d13&&_['isNil'](_0x591b50['internal']);_0x541c80++){if(_0x7241fd[_0x4297('0x6f')]<=_0x1301dd[_0x541c80][_0x4297('0x74')]){_0x591b50[_0x4297('0x6e')]=_0x1301dd[_0x541c80][_0x4297('0x74')];}else if(_0x7241fd[_0x4297('0x6f')]>_0x1301dd[_0x541c80][_0x4297('0x74')]&&_0x7241fd[_0x4297('0x6f')]<=_0x1301dd[_0x541c80]['to']){_0x591b50[_0x4297('0x6e')]=_0x7241fd[_0x4297('0x6f')];}}}if(_[_0x4297('0x6d')](_0x591b50[_0x4297('0x6e')])){_0x591b50[_0x4297('0x6e')]=_0x4c5e16+0x1;}return _0x81f128(_0x591b50);});});})[_0x4297('0x23')](function(_0x4dedcc){_0x2950f2(_0x4dedcc);});});}function updateUser(_0x4dda0a){return new Promise(function(_0x4f6d5e,_0x416d75){try{if(_0x4dda0a[_0x4297('0x75')]){_0x4dda0a['mailbox']=_0x4dda0a[_0x4297('0x6e')];_0x4dda0a['VoiceMail']={'mailbox':_0x4dda0a[_0x4297('0x6e')],'password':_0x4dda0a['password'],'fullname':_0x4dda0a[_0x4297('0x76')],'email':_0x4dda0a[_0x4297('0x77')]};}if(_0x4dda0a['role']==='agent'){if(!_0x4dda0a[_0x4297('0x78')])_0x4dda0a['permissions']=[_0x4297('0x79'),_0x4297('0x7a'),'103',_0x4297('0x7b'),'110',_0x4297('0x7c'),_0x4297('0x7d'),_0x4297('0x7e'),_0x4297('0x7f'),_0x4297('0x80'),_0x4297('0x81'),'100','111',_0x4297('0x82'),'115'];}_0x4f6d5e(_0x4dda0a);}catch(_0x5affc4){_0x416d75(_0x5affc4);}});}exports[_0x4297('0x83')]=function(_0x5ec213,_0x25e938){if(_0x5ec213[_0x4297('0x84')][_0x4297('0x31')]==='agent')throw new Error(_0x4297('0x85'));if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]==='user'&&_0x5ec213[_0x4297('0x84')]['role']!==_0x4297('0x32')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]==='admin'&&_0x5ec213[_0x4297('0x84')]['role']!==_0x4297('0x32')){throw new Error(_0x4297('0x86'));}return licenseUtil[_0x4297('0x87')]([_0x5ec213[_0x4297('0x63')]])[_0x4297('0x19')](function(){return validateUser(_0x5ec213[_0x4297('0x63')]);})[_0x4297('0x19')](function(_0x305fbd){return updateUser(_0x305fbd)[_0x4297('0x19')](function(_0x3a2242){if(_0x3a2242[_0x4297('0x31')]===_0x4297('0x32')){_0x3a2242[_0x4297('0x88')]=_0x5ec213['user'][_0x4297('0x88')];delete _0x3a2242[_0x4297('0x89')];}return _0x3a2242;});})[_0x4297('0x19')](function(_0x3006e5){return db[_0x4297('0x41')][_0x4297('0x83')](_0x3006e5,{'include':[{'model':db[_0x4297('0x8a')],'as':_0x4297('0x8a')}]});})['then'](function(_0x360ad4){if(_0x5ec213[_0x4297('0x63')][_0x4297('0x31')]===_0x4297('0x84'))return _0x360ad4;if(_0x5ec213['user']['role']!==_0x4297('0x84'))return _0x360ad4;return db[_0x4297('0x8b')][_0x4297('0x3c')]({'where':{'name':_0x360ad4['role']==='agent'?'Agents':_0x4297('0x36'),'userProfileId':_0x5ec213[_0x4297('0x84')]['userProfileId']},'raw':!![]})[_0x4297('0x19')](function(_0x3410a5){if(!_0x3410a5||_0x3410a5[_0x4297('0x8c')]!=0x0)return _0x360ad4;return db[_0x4297('0x3e')][_0x4297('0x83')]({'name':_0x360ad4[_0x4297('0x3d')],'resourceId':_0x360ad4['id'],'type':_0x3410a5[_0x4297('0x3d')],'sectionId':_0x3410a5['id']},{})[_0x4297('0x19')](function(){return _0x360ad4;});})['catch'](function(_0x29bc5e){logger[_0x4297('0x1f')](_0x4297('0x8d'),_0x29bc5e);throw _0x29bc5e;});})['then'](respondWithResult(_0x25e938,0xc9))['catch'](handleError(_0x25e938,null));};exports[_0x4297('0x8e')]=function(_0x5bd71f,_0x3ea11a){var _0x9abc35=_0x5bd71f[_0x4297('0x63')];var _0x3ab93e=[];if(_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]===_0x4297('0x35'))throw new Error('Unauthorized');if(_[_0x4297('0x8f')](_0x9abc35,[_0x4297('0x31'),_0x4297('0x84')])&&_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]!==_0x4297('0x32')){throw new Error(_0x4297('0x90'));}if(_[_0x4297('0x8f')](_0x9abc35,[_0x4297('0x31'),_0x4297('0x32')])&&_0x5bd71f['user'][_0x4297('0x31')]!==_0x4297('0x32')){throw new Error(_0x4297('0x91'));}return licenseUtil[_0x4297('0x87')](_0x9abc35)['then'](function(){return validateUser(_0x9abc35[0x0]);})[_0x4297('0x19')](function(){for(var _0x2d14cc=0x1;_0x2d14cc<_0x9abc35[_0x4297('0x5a')];_0x2d14cc++){var _0x41797a=_0x9abc35[_0x2d14cc-0x1]['internal'];if(!_0x9abc35[_0x2d14cc][_0x4297('0x6e')])_0x9abc35[_0x2d14cc][_0x4297('0x6e')]=_0x41797a+0x1;_0x3ab93e['push'](validateUser(_0x9abc35[_0x2d14cc]));}return Promise[_0x4297('0x52')](_0x3ab93e);})['then'](function(){_0x3ab93e=[];for(var _0x5bbb83=0x0;_0x5bbb83<_0x9abc35[_0x4297('0x5a')];_0x5bbb83++){_0x3ab93e[_0x4297('0x4d')](updateUser(_0x9abc35[_0x5bbb83]));}return Promise[_0x4297('0x52')](_0x3ab93e);})[_0x4297('0x19')](function(){_0x3ab93e=_0x9abc35['map'](function(_0x274947){return db['User']['create'](_0x274947,{'include':[{'model':db[_0x4297('0x8a')],'as':_0x4297('0x8a')}]})[_0x4297('0x19')](function(_0x5def37){_0x274947['id']=_0x5def37['id'];return _0x274947;});});return Promise[_0x4297('0x52')](_0x3ab93e);})[_0x4297('0x19')](function(_0x42e321){if(_0x5bd71f[_0x4297('0x63')][_0x4297('0x31')]===_0x4297('0x84'))return _0x42e321;if(_0x5bd71f[_0x4297('0x84')][_0x4297('0x31')]!=='user')return _0x42e321;var _0xd0f956=_['some'](_0x42e321,function(_0x5b1fa3){return _0x5b1fa3['role']===_0x4297('0x35')||_0x5b1fa3[_0x4297('0x31')]==='telephone';});if(!_0xd0f956)return _0x42e321;return db[_0x4297('0x8b')][_0x4297('0x4b')]({'where':{'name':{'$or':[_0x4297('0x34'),_0x4297('0x36')]},'userProfileId':_0x5bd71f['user'][_0x4297('0x89')]},'raw':!![]})['then'](function(_0x382959){if(_[_0x4297('0x92')](_0x382959)||!_[_0x4297('0x8f')](_0x382959,[_0x4297('0x8c'),0x0]))return _0x42e321;_0x3ab93e=[];var _0x285295=_(_0x382959)['map'](function(_0xa07ccf){if(_0xa07ccf[_0x4297('0x8c')]===0x1)return;return _0xa07ccf[_0x4297('0x3d')]===_0x4297('0x34')?_0x4297('0x35'):'telephone';})[_0x4297('0x93')]()[_0x4297('0x3b')]();for(var _0xd04f9a=0x0;_0xd04f9a<_0x42e321[_0x4297('0x5a')];_0xd04f9a++){if(!_[_0x4297('0x45')](_0x285295,_0x42e321[_0xd04f9a][_0x4297('0x31')]))return;var _0x24d75d=_0x42e321[_0xd04f9a][_0x4297('0x31')]===_0x4297('0x35')?_0x4297('0x34'):_0x4297('0x36');_0x3ab93e[_0x4297('0x4d')](db['UserProfileResource']['create']({'name':_0x42e321[_0xd04f9a][_0x4297('0x3d')],'resourceId':_0x42e321[_0xd04f9a]['id'],'type':_0x24d75d,'sectionId':_[_0x4297('0x3c')](_0x382959,[_0x4297('0x3d'),_0x24d75d])['id']},{}));}return Promise[_0x4297('0x52')](_0x3ab93e);});})[_0x4297('0x19')](respondWithResult(_0x3ea11a,0xc9))['catch'](handleError(_0x3ea11a,null));};exports[_0x4297('0x94')]=function(_0x43e5c7,_0x52a87b){if(_0x43e5c7[_0x4297('0x63')]['id']){delete _0x43e5c7['body']['id'];}return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x43e5c7[_0x4297('0x64')]['id']}})[_0x4297('0x19')](function(_0x499999){if(!_0x499999)return null;if(_0x499999['id']===_0x43e5c7[_0x4297('0x84')]['id']){if(!_0x43e5c7[_0x4297('0x63')]['oldPassword']||!_0x43e5c7['body']['newPassword']){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x96'));}if(!_0x499999[_0x4297('0x97')](_0x43e5c7[_0x4297('0x63')][_0x4297('0x98')])){throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0x9a'));}if(_0x43e5c7[_0x4297('0x63')][_0x4297('0x98')]===_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')]){throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x43e5c7[_0x4297('0x84')][_0x4297('0x31')]==='admin'){if(!_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')]){throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))](_0x4297('0x9c'));}}else if(_0x43e5c7[_0x4297('0x84')][_0x4297('0x31')]===_0x4297('0x84')){if(!_0x43e5c7[_0x4297('0x63')]['newPassword']){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x9c'));}if(_0x499999[_0x4297('0x31')]!==_0x4297('0x35')){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0x85'));}}else{throw new db['Sequelize']['ValidationError'](_0x4297('0x85'));}return _0x499999;})[_0x4297('0x19')](handleEntityNotFound(_0x52a87b,null))[_0x4297('0x19')](function(_0x3182cc){return db[_0x4297('0x68')][_0x4297('0x9d')]({'attributes':['id','securePassword',_0x4297('0x9e'),_0x4297('0x9f')]})[_0x4297('0x19')](function(_0x474066){if(_0x474066['securePassword'])authService[_0x4297('0x6b')](_0x43e5c7['body']['newPassword']);if(!_0x474066['enforcePasswordHistory']||!_0x3182cc['previousPasswords'])return _0x3182cc;authService[_0x4297('0xa0')](_0x43e5c7[_0x4297('0x63')][_0x4297('0x9b')],_0x3182cc['previousPasswords'],_0x474066[_0x4297('0x9f')]);return _0x3182cc;})[_0x4297('0x19')](saveUpdates({'password':_0x43e5c7['body']['newPassword'],'passwordResetAt':_0x43e5c7['user']['id']==_0x43e5c7[_0x4297('0x64')]['id']?moment():null,'previousPasswords':authService[_0x4297('0xa1')](_0x43e5c7[_0x4297('0x63')]['newPassword'],_0x3182cc[_0x4297('0xa2')])},null));})[_0x4297('0x19')](respondWithResult(_0x52a87b,null))[_0x4297('0x23')](handleError(_0x52a87b,null));};exports['addQueues']=function(_0x522786,_0x36a5d7){var _0x49e446=_0x522786[_0x4297('0x63')][_0x4297('0xa3')];return db['User'][_0x4297('0x3c')]({'where':{'id':_0x522786[_0x4297('0x64')]['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31'),'online','loginInPause',_0x4297('0xa4'),_0x4297('0xa5')]})[_0x4297('0x19')](handleEntityNotFound(_0x36a5d7,null))[_0x4297('0x19')](function(_0x485eea){if(_0x485eea){if(!utils[_0x4297('0xa6')](_0x49e446)){throw new db['Sequelize'][(_0x4297('0x95'))]('Unknown\x20channel');}return _0x485eea['add'+_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xa9')](_0x522786[_0x4297('0x63')]['ids'],{'penalty':_0x522786['body'][_0x4297('0xaa')]||0x0})[_0x4297('0xab')](function(_0x42050c){for(var _0x1656a7=0x0;_0x1656a7<_0x522786['body'][_0x4297('0x67')]['length'];_0x1656a7+=0x1){var _0x3b8748={'UserId':Number(_0x522786[_0x4297('0x64')]['id'])};_0x3b8748[_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xac')]=Number(_0x522786[_0x4297('0x63')][_0x4297('0x67')][_0x1656a7]);socket[_0x4297('0x2e')](_0x4297('0x84')+_[_0x4297('0xa7')](_0x49e446[_0x4297('0xa8')]())+_0x4297('0xad'),_0x3b8748);}return _0x42050c;})['then'](function(){if(_0x49e446===_0x4297('0xae')){return db[_0x4297('0xaf')][_0x4297('0x4b')]({'where':{'id':_0x522786[_0x4297('0x63')][_0x4297('0x67')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x4297('0x19')](function(_0x5a860d){var _0x2b78a8=_0x485eea[_0x4297('0xb0')]({'plain':!![]});var _0x493d2e=[];if(_0x49e446==='voice'&&_0x2b78a8[_0x4297('0x31')]==='agent'&&_0x2b78a8[_0x4297('0xb1')]){for(let _0x49c2a1=0x0;_0x49c2a1<_0x5a860d[_0x4297('0x5a')];_0x49c2a1+=0x1){_0x493d2e['push']({'membername':_0x2b78a8[_0x4297('0x3d')],'UserId':_0x2b78a8['id'],'queue_name':_0x5a860d[_0x49c2a1][_0x4297('0x3d')],'VoiceQueueId':_0x5a860d[_0x49c2a1]['id'],'interface':_[_0x4297('0x6d')](_0x2b78a8[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0x2b78a8[_0x4297('0x3d')]):_0x2b78a8[_0x4297('0xa5')],'paused':_0x2b78a8[_0x4297('0xa4')]||![],'penalty':_0x522786[_0x4297('0x63')][_0x4297('0xaa')]||0x0});}return Promise[_0x4297('0x52')](_0x493d2e[_0x4297('0x3a')](function(_0x1fd4e5){return db['UserVoiceQueueRt'][_0x4297('0xb4')](_0x1fd4e5);}));}return _0x485eea;});}})['then'](respondWithStatusCode(_0x36a5d7,null))[_0x4297('0x23')](handleError(_0x36a5d7,null));};exports[_0x4297('0xb5')]=function(_0x5c6bed,_0x20a21d){var _0x3df505,_0x1db29a;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x5c6bed['params']['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0x20a21d,null))[_0x4297('0x19')](function(_0x2bfc7e){if(_0x2bfc7e){_0x3df505=_0x2bfc7e;if(!_0x5c6bed['query'][_0x4297('0xa3')]||!utils[_0x4297('0xa6')](_0x5c6bed['query'][_0x4297('0xa3')])){throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0xb6'));}return _0x2bfc7e['remove'+_['capitalize'](_0x5c6bed['query'][_0x4297('0xa3')][_0x4297('0xa8')]())+_0x4297('0xa9')](_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')]);}})[_0x4297('0x19')](function(_0x9255b5){if(_[_0x4297('0xb7')](_0x5c6bed['query'][_0x4297('0x67')])){for(var _0x46a97f=0x0;_0x46a97f<_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')][_0x4297('0x5a')];_0x46a97f+=0x1){_0x1db29a={'UserId':Number(_0x5c6bed[_0x4297('0x64')]['id'])};_0x1db29a[_['capitalize'](_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')]['toLowerCase']())+_0x4297('0xac')]=Number(_0x5c6bed['query'][_0x4297('0x67')][_0x46a97f]);socket[_0x4297('0x2e')](_0x4297('0x84')+_[_0x4297('0xa7')](_0x5c6bed[_0x4297('0x48')]['channel']['toLowerCase']())+_0x4297('0xb8'),_0x1db29a);}}else{_0x1db29a={'UserId':Number(_0x5c6bed[_0x4297('0x64')]['id'])};_0x1db29a[_[_0x4297('0xa7')](_0x5c6bed[_0x4297('0x48')]['channel'][_0x4297('0xa8')]())+'QueueId']=Number(_0x5c6bed[_0x4297('0x48')][_0x4297('0x67')]);socket[_0x4297('0x2e')]('user'+_['capitalize'](_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')][_0x4297('0xa8')]())+_0x4297('0xb8'),_0x1db29a);}return _0x9255b5;})[_0x4297('0x19')](function(){if(_0x5c6bed[_0x4297('0x48')][_0x4297('0xa3')]===_0x4297('0xae')){return db[_0x4297('0xb9')][_0x4297('0x30')]({'where':{'UserId':_0x5c6bed[_0x4297('0x64')]['id'],'VoiceQueueId':_0x5c6bed['query'][_0x4297('0x67')]},'individualHooks':!![]})['then'](function(){return _0x3df505;});}return _0x3df505;})[_0x4297('0x19')](respondWithStatusCode(_0x20a21d,null))[_0x4297('0x23')](handleError(_0x20a21d,null));};exports[_0x4297('0xba')]=function(_0x1107ee,_0x5c7cdd){_0x1107ee[_0x4297('0x63')][_0x4297('0xbb')]=_0x1107ee[_0x4297('0xbc')][_0x4297('0xbd')];return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x1107ee[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x5c7cdd,null))[_0x4297('0x19')](saveUpdates(_0x1107ee['body'],null))['then'](respondWithResult(_0x5c7cdd,null))['catch'](handleError(_0x5c7cdd,null));};exports['getAvatar']=function(_0x135b15,_0x294426){var _0x183045=path[_0x4297('0xbe')](config[_0x4297('0xbf')],_0x4297('0xc0'));return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x135b15['params']['id']},'attributes':['id',_0x4297('0xbb')],'raw':!![]})[_0x4297('0x19')](handleEntityNotFound(_0x294426,null))[_0x4297('0x19')](function(_0x12c894){if(_0x12c894){if(_[_0x4297('0x6d')](_0x12c894[_0x4297('0xbb')])){return _0x294426[_0x4297('0xc1')](_0x183045);}else{if(!fs[_0x4297('0xc2')](path['join'](config[_0x4297('0xbf')],_0x4297('0xc3'),_0x12c894[_0x4297('0xbb')]))){return _0x294426[_0x4297('0xc1')](_0x183045);}return _0x294426[_0x4297('0xc1')](path['join'](config[_0x4297('0xbf')],_0x4297('0xc3'),_0x12c894[_0x4297('0xbb')]));}}})[_0x4297('0x23')](handleError(_0x294426,null));};exports[_0x4297('0xc4')]=function(_0x37a8f2,_0x75f7fc){return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x37a8f2[_0x4297('0x64')]['id']},'attributes':['id']})[_0x4297('0x19')](handleEntityNotFound(_0x75f7fc,null))[_0x4297('0x19')](function(_0x108c5b){var _0x4cd39f=[];values=_0x108c5b[_0x4297('0x50')];_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4e'),_0x108c5b['dataValues']));_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x4f'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f[_0x4297('0x4d')](get_open_tabs(_0x4297('0x60'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f['push'](get_open_tabs(_0x4297('0xc5'),_0x108c5b[_0x4297('0x50')]));_0x4cd39f[_0x4297('0x4d')](get_open_tabs('fax',_0x108c5b['dataValues']));_0x4cd39f['push'](get_open_tabs(_0x4297('0x51'),_0x108c5b['dataValues']));return Promise[_0x4297('0x52')](_0x4cd39f);})['then'](function(_0x235757){if(_0x235757){var _0x8ab2c6=_[_0x4297('0x3a')](values[_0x4297('0xc6')],function(_0x2a2fef){return{'channel':_0x4297('0xc7'),'id':_0x2a2fef['id'],'createdAt':_0x2a2fef[_0x4297('0xc8')]};});var _0x609b71=_[_0x4297('0x3a')](values['FaxOpenTabs'],function(_0x1c8469){return{'channel':_0x4297('0xc9'),'id':_0x1c8469['id'],'createdAt':_0x1c8469['createdAt']};});var _0x21eea9=_[_0x4297('0x3a')](values[_0x4297('0xca')],function(_0x11b713){return{'channel':_0x4297('0xcb'),'id':_0x11b713['id'],'createdAt':_0x11b713[_0x4297('0xc8')]};});var _0x4e10d8=_[_0x4297('0x3a')](values[_0x4297('0xcc')],function(_0x3cba2a){return{'channel':_0x4297('0xcd'),'id':_0x3cba2a['id'],'createdAt':_0x3cba2a['createdAt']};});var _0x5a5a2b=_[_0x4297('0x3a')](values[_0x4297('0xce')],function(_0x3a405f){return{'channel':_0x4297('0xcf'),'id':_0x3a405f['id'],'createdAt':_0x3a405f['createdAt']};});var _0x2fa63d=_[_0x4297('0x3a')](values['WhatsappOpenTabs'],function(_0x17a07a){return{'channel':'WHATSAPP','id':_0x17a07a['id'],'createdAt':_0x17a07a['createdAt']};});var _0x5a0df3=_[_0x4297('0xd0')](_0x8ab2c6,_0x609b71,_0x21eea9,_0x4e10d8,_0x5a5a2b,_0x2fa63d);var _0x38ab5b={'count':_0x5a0df3[_0x4297('0x5a')],'rows':_0x5a0df3};return _0x38ab5b;}else return null;})['then'](respondWithResult(_0x75f7fc,null))[_0x4297('0x23')](handleError(_0x75f7fc,null));};exports[_0x4297('0xd1')]=function(_0x241953,_0x4b1b52){var _0x33de33={};var _0x5ca46f={};var _0x2d074b;var _0x1c4e2a;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x241953['params']['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x4b1b52,null))['then'](function(_0x2d5f8c){if(_0x2d5f8c){_0x2d074b=_0x2d5f8c;_0x5ca46f['model']=_['keys'](db[_0x4297('0xd2')][_0x4297('0x42')]);_0x5ca46f['query']=_[_0x4297('0x56')](_0x241953[_0x4297('0x48')]);_0x5ca46f[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x5ca46f[_0x4297('0x53')],_0x5ca46f[_0x4297('0x48')]);_0x33de33[_0x4297('0x58')]=_[_0x4297('0x57')](_0x5ca46f[_0x4297('0x53')],qs[_0x4297('0x59')](_0x241953[_0x4297('0x48')][_0x4297('0x59')]));_0x33de33[_0x4297('0x58')]=_0x33de33[_0x4297('0x58')][_0x4297('0x5a')]?_0x33de33[_0x4297('0x58')]:_0x5ca46f[_0x4297('0x53')];_0x33de33[_0x4297('0xd4')]=qs['sort'](_0x241953[_0x4297('0x48')][_0x4297('0xd5')]);_0x33de33['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x241953[_0x4297('0x48')],_0x5ca46f[_0x4297('0xd3')]));if(_0x241953['query'][_0x4297('0x38')]){_0x33de33['where']=_['merge'](_0x33de33[_0x4297('0x46')],{'$or':_['map'](_0x33de33['attributes'],function(_0x298d3b){var _0xc4499c={};_0xc4499c[_0x298d3b]={'$like':'%'+_0x241953[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0xc4499c;})});}_0x33de33=_[_0x4297('0x5d')]({},_0x33de33,_0x241953['options']);return _0x2d074b[_0x4297('0xd1')](_0x33de33);}})[_0x4297('0x19')](function(_0x5eebb8){if(_0x5eebb8){_0x1c4e2a=_0x5eebb8[_0x4297('0x5a')];if(_0x241953[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0x5b'))){_0x33de33[_0x4297('0x47')]=[{'model':db[_0x4297('0xd8')],'as':_0x4297('0xd9'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x4297('0x3d'),_0x4297('0xda')],'where':_0x241953['query']['tag']?{'id':_0x241953[_0x4297('0x48')][_0x4297('0xdb')]}:undefined,'required':_0x241953[_0x4297('0x48')][_0x4297('0xdb')]?!![]:![]}];}if(!_0x241953[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x33de33[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x241953[_0x4297('0x48')][_0x4297('0x29')]);_0x33de33[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x241953[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x2d074b[_0x4297('0xd1')](_0x33de33);}})['then'](function(_0x24d6ce){if(_0x24d6ce){return _0x24d6ce?{'count':_0x1c4e2a,'rows':_0x24d6ce}:null;}})[_0x4297('0x19')](respondWithResult(_0x4b1b52,null))[_0x4297('0x23')](handleError(_0x4b1b52,null));};exports[_0x4297('0xdd')]=function(_0x33ab6e,_0xc3f3c6){var _0x204385;var _0x1ee7fd={};var _0x2a8feb;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x33ab6e[_0x4297('0x64')]['id']},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0xc3f3c6,null))[_0x4297('0x19')](function(_0x94c74c){if(!utils[_0x4297('0xa6')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])){throw new db['Sequelize'][(_0x4297('0x95'))](_0x4297('0xb6'));}_0x204385=_0x94c74c;var _0x4e45ec={};_0x4e45ec[_0x4297('0x53')]=_[_0x4297('0x56')](db[_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+_0x4297('0xde')][_0x4297('0x42')]);_0x4e45ec[_0x4297('0x48')]=_[_0x4297('0x56')](_0x33ab6e[_0x4297('0x48')]);_0x4e45ec[_0x4297('0xd3')]=_['intersection'](_0x4e45ec[_0x4297('0x53')],_0x4e45ec[_0x4297('0x48')]);_0x1ee7fd[_0x4297('0x58')]=_['intersection'](_0x4e45ec['model'],qs[_0x4297('0x59')](_0x33ab6e[_0x4297('0x48')]['fields']));_0x1ee7fd['attributes']=_0x1ee7fd[_0x4297('0x58')]['length']?_0x1ee7fd[_0x4297('0x58')]:_0x4e45ec[_0x4297('0x53')];_0x1ee7fd[_0x4297('0xd4')]=qs['sort'](_0x33ab6e[_0x4297('0x48')][_0x4297('0xd5')]);_0x1ee7fd[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x33ab6e[_0x4297('0x48')],_0x4e45ec[_0x4297('0xd3')]));if(_0x33ab6e[_0x4297('0x48')][_0x4297('0x38')]){_0x1ee7fd[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x1ee7fd['where'],{'$or':_[_0x4297('0x3a')](_0x1ee7fd[_0x4297('0x58')],function(_0x20c8b9){var _0x51ee9b={};_0x51ee9b[_0x20c8b9]={'$like':'%'+_0x33ab6e[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x51ee9b;})});}_0x1ee7fd=_['merge']({},_0x1ee7fd,_0x33ab6e['options']);switch(_0x204385['role']){case'admin':return db[_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+'Queue'][_0x4297('0x4b')](_0x1ee7fd);case _0x4297('0x84'):case _0x4297('0x35'):return _0x204385['get'+_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')][_0x4297('0xa3')])+_0x4297('0xa9')](_0x1ee7fd);default:throw new db[(_0x4297('0x99'))][(_0x4297('0x95'))]('Unknown\x20role');}})[_0x4297('0x19')](function(_0x3f16d9){_0x2a8feb=_0x3f16d9[_0x4297('0x5a')];if(!_0x33ab6e[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x1ee7fd[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x33ab6e[_0x4297('0x48')][_0x4297('0x29')]);_0x1ee7fd['offset']=qs[_0x4297('0x2a')](_0x33ab6e['query'][_0x4297('0x2a')]);}switch(_0x204385[_0x4297('0x31')]){case'admin':return db[_['capitalize'](_0x33ab6e['query'][_0x4297('0xa3')])+_0x4297('0xde')][_0x4297('0x4b')](_0x1ee7fd);case _0x4297('0x84'):case _0x4297('0x35'):return _0x204385[_0x4297('0xb0')+_[_0x4297('0xa7')](_0x33ab6e[_0x4297('0x48')]['channel'])+_0x4297('0xa9')](_0x1ee7fd);}})[_0x4297('0x19')](function(_0x40aff8){return{'count':_0x2a8feb,'rows':_0x40aff8};})[_0x4297('0x19')](respondWithResult(_0xc3f3c6,null))[_0x4297('0x23')](handleError(_0xc3f3c6,null));};exports[_0x4297('0xdf')]=function(_0x242cb9,_0x2db886){var _0x138c4d={};var _0x29432c={};var _0x1fe52f;var _0x5e62c9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x242cb9[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x2db886,null))[_0x4297('0x19')](function(_0x5491d8){if(_0x5491d8){_0x1fe52f=_0x5491d8;_0x29432c[_0x4297('0x53')]=_[_0x4297('0x56')](db[_0x4297('0xb9')][_0x4297('0x42')]);_0x29432c[_0x4297('0x48')]=_[_0x4297('0x56')](_0x242cb9[_0x4297('0x48')]);_0x29432c[_0x4297('0xd3')]=_['intersection'](_0x29432c['model'],_0x29432c[_0x4297('0x48')]);_0x138c4d[_0x4297('0x58')]=_[_0x4297('0x57')](_0x29432c[_0x4297('0x53')],qs[_0x4297('0x59')](_0x242cb9[_0x4297('0x48')]['fields']));_0x138c4d['attributes']=_0x138c4d[_0x4297('0x58')][_0x4297('0x5a')]?_0x138c4d[_0x4297('0x58')]:_0x29432c[_0x4297('0x53')];_0x138c4d['order']=qs[_0x4297('0xd5')](_0x242cb9[_0x4297('0x48')]['sort']);_0x138c4d[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x242cb9['query'],_0x29432c[_0x4297('0xd3')]));if(_0x242cb9[_0x4297('0x48')][_0x4297('0x38')]){_0x138c4d[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x138c4d[_0x4297('0x46')],{'$or':_['map'](_0x138c4d[_0x4297('0x58')],function(_0x4a8a77){var _0x5e4724={};_0x5e4724[_0x4a8a77]={'$like':'%'+_0x242cb9['query'][_0x4297('0x38')]+'%'};return _0x5e4724;})});}_0x138c4d=_[_0x4297('0x5d')]({},_0x138c4d,_0x242cb9[_0x4297('0x5e')]);return _0x1fe52f[_0x4297('0xdf')](_0x138c4d);}})['then'](function(_0x46241a){if(_0x46241a){_0x5e62c9=_0x46241a['length'];if(!_0x242cb9['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x138c4d[_0x4297('0x29')]=qs['limit'](_0x242cb9[_0x4297('0x48')]['limit']);_0x138c4d[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x242cb9['query'][_0x4297('0x2a')]);}return _0x1fe52f[_0x4297('0xdf')](_0x138c4d);}})[_0x4297('0x19')](function(_0x42f93b){if(_0x42f93b){return _0x42f93b?{'count':_0x5e62c9,'rows':_0x42f93b}:null;}})[_0x4297('0x19')](respondWithResult(_0x2db886,null))[_0x4297('0x23')](handleError(_0x2db886,null));};exports[_0x4297('0xe0')]=function(_0x4f86b8,_0x99f71b){var _0x4086e5={};var _0x30bc4a={};var _0x5f464a;var _0x1bcf4a;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x4f86b8[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x99f71b,null))[_0x4297('0x19')](function(_0x18dbba){if(_0x18dbba){_0x5f464a=_0x18dbba;_0x30bc4a[_0x4297('0x53')]=_[_0x4297('0x56')](db['ChatGroup'][_0x4297('0x42')]);_0x30bc4a[_0x4297('0x48')]=_['keys'](_0x4f86b8[_0x4297('0x48')]);_0x30bc4a[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x30bc4a[_0x4297('0x53')],_0x30bc4a[_0x4297('0x48')]);_0x4086e5[_0x4297('0x58')]=_[_0x4297('0x57')](_0x30bc4a[_0x4297('0x53')],qs['fields'](_0x4f86b8[_0x4297('0x48')][_0x4297('0x59')]));_0x4086e5[_0x4297('0x58')]=_0x4086e5['attributes'][_0x4297('0x5a')]?_0x4086e5[_0x4297('0x58')]:_0x30bc4a['model'];_0x4086e5[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x4f86b8[_0x4297('0x48')][_0x4297('0xd5')]);_0x4086e5[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x4f86b8['query'],_0x30bc4a[_0x4297('0xd3')]));if(_0x4f86b8['query'][_0x4297('0x38')]){_0x4086e5[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x4086e5[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x4086e5['attributes'],function(_0x4edeec){var _0x336290={};_0x336290[_0x4edeec]={'$like':'%'+_0x4f86b8[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x336290;})});}_0x4086e5=_[_0x4297('0x5d')]({},_0x4086e5,_0x4f86b8[_0x4297('0x5e')]);return _0x5f464a[_0x4297('0xe0')](_0x4086e5);}})[_0x4297('0x19')](function(_0x2feac8){if(_0x2feac8){_0x1bcf4a=_0x2feac8['length'];if(!_0x4f86b8[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x4086e5[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x4f86b8[_0x4297('0x48')][_0x4297('0x29')]);_0x4086e5[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x4f86b8[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x5f464a[_0x4297('0xe0')](_0x4086e5);}})[_0x4297('0x19')](function(_0x15c16c){if(_0x15c16c){return _0x15c16c?{'count':_0x1bcf4a,'rows':_0x15c16c}:null;}})['then'](respondWithResult(_0x99f71b,null))['catch'](handleError(_0x99f71b,null));};exports[_0x4297('0xe1')]=function(_0x492686,_0x48a897){var _0x102db5={'raw':!![],'where':{}};var _0x2ef6c3={};var _0x16b2b2={'count':0x0,'rows':[]};return db[_0x4297('0x41')]['findOne']({'where':{'id':_0x492686[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x48a897,null))[_0x4297('0x19')](function(_0x2c7114){if(_0x2c7114){_0x2ef6c3[_0x4297('0x53')]=_[_0x4297('0x56')](db['VoiceRecording']['rawAttributes']);_0x2ef6c3[_0x4297('0x48')]=_[_0x4297('0x56')](_0x492686[_0x4297('0x48')]);_0x2ef6c3[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x2ef6c3['model'],_0x2ef6c3[_0x4297('0x48')]);_0x102db5['attributes']=_['intersection'](_0x2ef6c3[_0x4297('0x53')],qs[_0x4297('0x59')](_0x492686[_0x4297('0x48')][_0x4297('0x59')]));_0x102db5[_0x4297('0x58')]=_0x102db5[_0x4297('0x58')]['length']?_0x102db5[_0x4297('0x58')]:_0x2ef6c3[_0x4297('0x53')];if(!_0x492686[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x102db5[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x492686[_0x4297('0x48')][_0x4297('0x29')]);_0x102db5['offset']=qs[_0x4297('0x2a')](_0x492686[_0x4297('0x48')][_0x4297('0x2a')]);}_0x102db5[_0x4297('0xd4')]=qs['sort'](_0x492686[_0x4297('0x48')][_0x4297('0xd5')]);_0x102db5[_0x4297('0x46')]=qs[_0x4297('0xd3')](_['pick'](_0x492686['query'],_0x2ef6c3[_0x4297('0xd3')]));_0x102db5[_0x4297('0x46')][_0x4297('0xe2')]=_0x2c7114['id'];if(_0x492686['query'][_0x4297('0x38')]){_0x102db5[_0x4297('0x46')]=_['merge'](_0x102db5['where'],{'$or':_[_0x4297('0x3a')](_0x102db5['attributes'],function(_0x1860b4){var _0x4db1cf={};_0x4db1cf[_0x1860b4]={'$like':'%'+_0x492686[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x4db1cf;})});}_0x102db5=_[_0x4297('0x5d')]({},_0x102db5,_0x492686[_0x4297('0x5e')]);return db['VoiceRecording'][_0x4297('0x2b')]({'where':_0x102db5[_0x4297('0x46')]})[_0x4297('0x19')](function(_0x1d8860){_0x16b2b2[_0x4297('0x2b')]=_0x1d8860;if(_0x492686[_0x4297('0x48')][_0x4297('0x5b')]){_0x102db5[_0x4297('0x47')]=[{'all':!![]}];}return db['VoiceRecording'][_0x4297('0x4b')](_0x102db5);})[_0x4297('0x19')](function(_0x56f0ec){_0x16b2b2[_0x4297('0x4c')]=_0x56f0ec;return _0x16b2b2;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x48a897,_0x102db5))[_0x4297('0x23')](handleError(_0x48a897,null));};exports[_0x4297('0xe3')]=function(_0xa85e3d,_0x488389){var _0x2d4fa7={'raw':!![],'where':{}};var _0x31ebcf={};var _0x31b204={'count':0x0,'rows':[]};return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0xa85e3d[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x488389,null))['then'](function(_0x21e7f3){if(_0x21e7f3){_0x31ebcf[_0x4297('0x53')]=_['keys'](db['ScreenRecording']['rawAttributes']);_0x31ebcf[_0x4297('0x48')]=_['keys'](_0xa85e3d[_0x4297('0x48')]);_0x31ebcf[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x31ebcf['model'],_0x31ebcf[_0x4297('0x48')]);_0x2d4fa7[_0x4297('0x58')]=_[_0x4297('0x57')](_0x31ebcf[_0x4297('0x53')],qs['fields'](_0xa85e3d[_0x4297('0x48')]['fields']));_0x2d4fa7[_0x4297('0x58')]=_0x2d4fa7[_0x4297('0x58')][_0x4297('0x5a')]?_0x2d4fa7[_0x4297('0x58')]:_0x31ebcf[_0x4297('0x53')];if(!_0xa85e3d[_0x4297('0x48')]['hasOwnProperty'](_0x4297('0xdc'))){_0x2d4fa7[_0x4297('0x29')]=qs[_0x4297('0x29')](_0xa85e3d[_0x4297('0x48')][_0x4297('0x29')]);_0x2d4fa7[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0xa85e3d[_0x4297('0x48')][_0x4297('0x2a')]);}_0x2d4fa7['order']=qs['sort'](_0xa85e3d['query'][_0x4297('0xd5')]);_0x2d4fa7['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0xa85e3d[_0x4297('0x48')],_0x31ebcf[_0x4297('0xd3')]));_0x2d4fa7[_0x4297('0x46')][_0x4297('0xe2')]=_0x21e7f3['id'];if(_0xa85e3d[_0x4297('0x48')][_0x4297('0x38')]){_0x2d4fa7[_0x4297('0x46')]=_['merge'](_0x2d4fa7[_0x4297('0x46')],{'$or':_['map'](_0x2d4fa7[_0x4297('0x58')],function(_0x2578e4){var _0xd80039={};_0xd80039[_0x2578e4]={'$like':'%'+_0xa85e3d[_0x4297('0x48')]['filter']+'%'};return _0xd80039;})});}_0x2d4fa7=_[_0x4297('0x5d')]({},_0x2d4fa7,_0xa85e3d[_0x4297('0x5e')]);return db['ScreenRecording'][_0x4297('0x2b')]({'where':_0x2d4fa7[_0x4297('0x46')]})[_0x4297('0x19')](function(_0x176abd){_0x31b204[_0x4297('0x2b')]=_0x176abd;if(_0xa85e3d[_0x4297('0x48')][_0x4297('0x5b')]){_0x2d4fa7[_0x4297('0x47')]=[{'all':!![]}];}return db[_0x4297('0xe4')][_0x4297('0x4b')](_0x2d4fa7);})['then'](function(_0x27c503){_0x31b204[_0x4297('0x4c')]=_0x27c503;return _0x31b204;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x488389,_0x2d4fa7))[_0x4297('0x23')](handleError(_0x488389,null));};exports[_0x4297('0xe5')]=function(_0x2bab91,_0x34570f){var _0x4fc24b={};var _0x57b126={};var _0x5f78eb;var _0x2fe4fc;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x2bab91[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x34570f,null))[_0x4297('0x19')](function(_0x236d3a){if(_0x236d3a){_0x5f78eb=_0x236d3a;_0x57b126[_0x4297('0x53')]=_[_0x4297('0x56')](db['ChatInteraction'][_0x4297('0x42')]);_0x57b126[_0x4297('0x48')]=_[_0x4297('0x56')](_0x2bab91[_0x4297('0x48')]);_0x57b126[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x57b126[_0x4297('0x53')],_0x57b126[_0x4297('0x48')]);_0x4fc24b['attributes']=_[_0x4297('0x57')](_0x57b126['model'],qs[_0x4297('0x59')](_0x2bab91[_0x4297('0x48')][_0x4297('0x59')]));_0x4fc24b[_0x4297('0x58')]=_0x4fc24b['attributes']['length']?_0x4fc24b[_0x4297('0x58')]:_0x57b126[_0x4297('0x53')];_0x4fc24b['order']=qs['sort'](_0x2bab91[_0x4297('0x48')][_0x4297('0xd5')]);_0x4fc24b[_0x4297('0x46')]=qs['filters'](_[_0x4297('0xd6')](_0x2bab91[_0x4297('0x48')],_0x57b126[_0x4297('0xd3')]));if(_0x2bab91[_0x4297('0x48')][_0x4297('0x38')]){_0x4fc24b[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x4fc24b[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x4fc24b[_0x4297('0x58')],function(_0x4f2b44){var _0x1e8de5={};_0x1e8de5[_0x4f2b44]={'$like':'%'+_0x2bab91[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x1e8de5;})});}_0x4fc24b=_[_0x4297('0x5d')]({},_0x4fc24b,_0x2bab91[_0x4297('0x5e')]);return _0x5f78eb['getChatInteractions'](_0x4fc24b);}})[_0x4297('0x19')](function(_0x1cbbca){if(_0x1cbbca){_0x2fe4fc=_0x1cbbca['length'];if(!_0x2bab91[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x4fc24b['limit']=qs['limit'](_0x2bab91[_0x4297('0x48')]['limit']);_0x4fc24b['offset']=qs[_0x4297('0x2a')](_0x2bab91[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x5f78eb[_0x4297('0xe5')](_0x4fc24b);}})[_0x4297('0x19')](function(_0x1d735d){if(_0x1d735d){return _0x1d735d?{'count':_0x2fe4fc,'rows':_0x1d735d}:null;}})[_0x4297('0x19')](respondWithResult(_0x34570f,null))[_0x4297('0x23')](handleError(_0x34570f,null));};exports[_0x4297('0xe6')]=function(_0x4d1312,_0x53fa1d){var _0x2ea765={};var _0xdce734={};var _0x7b616e;var _0x367593;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x4d1312[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x53fa1d,null))[_0x4297('0x19')](function(_0x2a30ea){if(_0x2a30ea){_0x7b616e=_0x2a30ea;_0xdce734['model']=_[_0x4297('0x56')](db[_0x4297('0xe7')][_0x4297('0x42')]);_0xdce734['query']=_[_0x4297('0x56')](_0x4d1312[_0x4297('0x48')]);_0xdce734['filters']=_['intersection'](_0xdce734[_0x4297('0x53')],_0xdce734[_0x4297('0x48')]);_0x2ea765[_0x4297('0x58')]=_[_0x4297('0x57')](_0xdce734[_0x4297('0x53')],qs[_0x4297('0x59')](_0x4d1312[_0x4297('0x48')][_0x4297('0x59')]));_0x2ea765[_0x4297('0x58')]=_0x2ea765[_0x4297('0x58')][_0x4297('0x5a')]?_0x2ea765[_0x4297('0x58')]:_0xdce734[_0x4297('0x53')];_0x2ea765[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x4d1312['query'][_0x4297('0xd5')]);_0x2ea765[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x4d1312[_0x4297('0x48')],_0xdce734[_0x4297('0xd3')]));if(_0x4d1312[_0x4297('0x48')][_0x4297('0x38')]){_0x2ea765[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x2ea765[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x2ea765['attributes'],function(_0x41d927){var _0x65327d={};_0x65327d[_0x41d927]={'$like':'%'+_0x4d1312[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x65327d;})});}_0x2ea765=_[_0x4297('0x5d')]({},_0x2ea765,_0x4d1312[_0x4297('0x5e')]);return _0x7b616e[_0x4297('0xe6')](_0x2ea765);}})['then'](function(_0x58a8da){if(_0x58a8da){_0x367593=_0x58a8da[_0x4297('0x5a')];if(!_0x4d1312['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x2ea765[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x4d1312[_0x4297('0x48')][_0x4297('0x29')]);_0x2ea765[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x4d1312[_0x4297('0x48')]['offset']);}return _0x7b616e[_0x4297('0xe6')](_0x2ea765);}})[_0x4297('0x19')](function(_0x142f4f){if(_0x142f4f){return _0x142f4f?{'count':_0x367593,'rows':_0x142f4f}:null;}})[_0x4297('0x19')](respondWithResult(_0x53fa1d,null))[_0x4297('0x23')](handleError(_0x53fa1d,null));};exports[_0x4297('0xe8')]=function(_0x3dbfb3,_0x98c0d9){var _0x212c94={'raw':!![],'where':{}};var _0x150efa={};var _0x4ca29e={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x3dbfb3[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x98c0d9,null))[_0x4297('0x19')](function(_0x3e4d0b){if(_0x3e4d0b){_0x150efa[_0x4297('0x53')]=_['keys'](db[_0x4297('0xe9')][_0x4297('0x42')]);_0x150efa[_0x4297('0x48')]=_[_0x4297('0x56')](_0x3dbfb3[_0x4297('0x48')]);_0x150efa[_0x4297('0xd3')]=_['intersection'](_0x150efa['model'],_0x150efa[_0x4297('0x48')]);_0x212c94[_0x4297('0x58')]=_['intersection'](_0x150efa[_0x4297('0x53')],qs['fields'](_0x3dbfb3[_0x4297('0x48')][_0x4297('0x59')]));_0x212c94[_0x4297('0x58')]=_0x212c94[_0x4297('0x58')][_0x4297('0x5a')]?_0x212c94[_0x4297('0x58')]:_0x150efa[_0x4297('0x53')];if(!_0x3dbfb3['query']['hasOwnProperty'](_0x4297('0xdc'))){_0x212c94[_0x4297('0x29')]=qs['limit'](_0x3dbfb3[_0x4297('0x48')][_0x4297('0x29')]);_0x212c94[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x3dbfb3['query'][_0x4297('0x2a')]);}_0x212c94[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x3dbfb3['query'][_0x4297('0xd5')]);_0x212c94[_0x4297('0x46')]=qs[_0x4297('0xd3')](_['pick'](_0x3dbfb3['query'],_0x150efa[_0x4297('0xd3')]));_0x212c94[_0x4297('0x46')]['UserId']=_0x3e4d0b['id'];if(_0x3dbfb3[_0x4297('0x48')][_0x4297('0x38')]){_0x212c94[_0x4297('0x46')]=_['merge'](_0x212c94['where'],{'$or':_['map'](_0x212c94['attributes'],function(_0x10b36b){var _0xcb79b2={};_0xcb79b2[_0x10b36b]={'$like':'%'+_0x3dbfb3[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0xcb79b2;})});}_0x212c94=_['merge']({},_0x212c94,_0x3dbfb3[_0x4297('0x5e')]);return db['MailInteraction'][_0x4297('0x2b')]({'where':_0x212c94['where']})[_0x4297('0x19')](function(_0x3cbb8b){_0x4ca29e[_0x4297('0x2b')]=_0x3cbb8b;if(_0x3dbfb3['query']['includeAll']){_0x212c94[_0x4297('0x47')]=[{'all':!![]}];}return db[_0x4297('0xe9')]['findAll'](_0x212c94);})[_0x4297('0x19')](function(_0x1fe3bc){_0x4ca29e[_0x4297('0x4c')]=_0x1fe3bc;return _0x4ca29e;});}})[_0x4297('0x19')](respondWithFilteredResult(_0x98c0d9,_0x212c94))[_0x4297('0x23')](handleError(_0x98c0d9,null));};exports['getSmsInteractions']=function(_0x3c382a,_0x3525d8){var _0x2db818={};var _0x160131={};var _0x2b8fef;var _0x4887dc;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x3c382a[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x3525d8,null))[_0x4297('0x19')](function(_0x4176f6){if(_0x4176f6){_0x2b8fef=_0x4176f6;_0x160131[_0x4297('0x53')]=_[_0x4297('0x56')](db[_0x4297('0xea')][_0x4297('0x42')]);_0x160131[_0x4297('0x48')]=_[_0x4297('0x56')](_0x3c382a[_0x4297('0x48')]);_0x160131[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x160131['model'],_0x160131['query']);_0x2db818[_0x4297('0x58')]=_[_0x4297('0x57')](_0x160131[_0x4297('0x53')],qs[_0x4297('0x59')](_0x3c382a[_0x4297('0x48')][_0x4297('0x59')]));_0x2db818[_0x4297('0x58')]=_0x2db818['attributes'][_0x4297('0x5a')]?_0x2db818[_0x4297('0x58')]:_0x160131[_0x4297('0x53')];_0x2db818['order']=qs[_0x4297('0xd5')](_0x3c382a['query'][_0x4297('0xd5')]);_0x2db818[_0x4297('0x46')]=qs['filters'](_['pick'](_0x3c382a['query'],_0x160131[_0x4297('0xd3')]));if(_0x3c382a[_0x4297('0x48')][_0x4297('0x38')]){_0x2db818['where']=_[_0x4297('0x5d')](_0x2db818['where'],{'$or':_[_0x4297('0x3a')](_0x2db818[_0x4297('0x58')],function(_0x324611){var _0x128d7d={};_0x128d7d[_0x324611]={'$like':'%'+_0x3c382a['query'][_0x4297('0x38')]+'%'};return _0x128d7d;})});}_0x2db818=_['merge']({},_0x2db818,_0x3c382a[_0x4297('0x5e')]);return _0x2b8fef['getSmsInteractions'](_0x2db818);}})[_0x4297('0x19')](function(_0x241e65){if(_0x241e65){_0x4887dc=_0x241e65[_0x4297('0x5a')];if(!_0x3c382a[_0x4297('0x48')][_0x4297('0xd7')]('nolimit')){_0x2db818[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x3c382a[_0x4297('0x48')][_0x4297('0x29')]);_0x2db818['offset']=qs[_0x4297('0x2a')](_0x3c382a[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x2b8fef[_0x4297('0xeb')](_0x2db818);}})['then'](function(_0x36071d){if(_0x36071d){return _0x36071d?{'count':_0x4887dc,'rows':_0x36071d}:null;}})[_0x4297('0x19')](respondWithResult(_0x3525d8,null))[_0x4297('0x23')](handleError(_0x3525d8,null));};exports[_0x4297('0xec')]=function(_0x389d2b,_0xaf4d4d){var _0x3400c9={};var _0x19c4e0={};var _0x4c23dd;var _0x154684;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x389d2b[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0xaf4d4d,null))[_0x4297('0x19')](function(_0x4489c6){if(_0x4489c6){_0x4c23dd=_0x4489c6;_0x19c4e0['model']=_[_0x4297('0x56')](db[_0x4297('0xed')][_0x4297('0x42')]);_0x19c4e0[_0x4297('0x48')]=_[_0x4297('0x56')](_0x389d2b[_0x4297('0x48')]);_0x19c4e0[_0x4297('0xd3')]=_['intersection'](_0x19c4e0[_0x4297('0x53')],_0x19c4e0[_0x4297('0x48')]);_0x3400c9[_0x4297('0x58')]=_[_0x4297('0x57')](_0x19c4e0['model'],qs['fields'](_0x389d2b[_0x4297('0x48')]['fields']));_0x3400c9[_0x4297('0x58')]=_0x3400c9[_0x4297('0x58')][_0x4297('0x5a')]?_0x3400c9[_0x4297('0x58')]:_0x19c4e0[_0x4297('0x53')];_0x3400c9[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x389d2b[_0x4297('0x48')]['sort']);_0x3400c9[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x389d2b[_0x4297('0x48')],_0x19c4e0[_0x4297('0xd3')]));if(_0x389d2b[_0x4297('0x48')][_0x4297('0x38')]){_0x3400c9[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x3400c9[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x3400c9[_0x4297('0x58')],function(_0x5e6524){var _0x4010d2={};_0x4010d2[_0x5e6524]={'$like':'%'+_0x389d2b[_0x4297('0x48')]['filter']+'%'};return _0x4010d2;})});}_0x3400c9=_[_0x4297('0x5d')]({},_0x3400c9,_0x389d2b[_0x4297('0x5e')]);return _0x4c23dd[_0x4297('0xec')](_0x3400c9);}})[_0x4297('0x19')](function(_0x1191ca){if(_0x1191ca){_0x154684=_0x1191ca['length'];if(!_0x389d2b[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x3400c9['limit']=qs[_0x4297('0x29')](_0x389d2b['query'][_0x4297('0x29')]);_0x3400c9[_0x4297('0x2a')]=qs[_0x4297('0x2a')](_0x389d2b['query'][_0x4297('0x2a')]);}return _0x4c23dd[_0x4297('0xec')](_0x3400c9);}})['then'](function(_0x2786f9){if(_0x2786f9){return _0x2786f9?{'count':_0x154684,'rows':_0x2786f9}:null;}})[_0x4297('0x19')](respondWithResult(_0xaf4d4d,null))[_0x4297('0x23')](handleError(_0xaf4d4d,null));};exports[_0x4297('0xee')]=function(_0x41158a,_0x4ac75){var _0x2ec50f={};var _0x55f6d4={};var _0x15477e;var _0x495d0b;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x41158a[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x4ac75,null))[_0x4297('0x19')](function(_0x1d5446){if(_0x1d5446){_0x15477e=_0x1d5446;_0x55f6d4[_0x4297('0x53')]=_['keys'](db[_0x4297('0xef')][_0x4297('0x42')]);_0x55f6d4[_0x4297('0x48')]=_[_0x4297('0x56')](_0x41158a[_0x4297('0x48')]);_0x55f6d4[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x55f6d4[_0x4297('0x53')],_0x55f6d4[_0x4297('0x48')]);_0x2ec50f['attributes']=_[_0x4297('0x57')](_0x55f6d4[_0x4297('0x53')],qs['fields'](_0x41158a[_0x4297('0x48')][_0x4297('0x59')]));_0x2ec50f[_0x4297('0x58')]=_0x2ec50f['attributes'][_0x4297('0x5a')]?_0x2ec50f[_0x4297('0x58')]:_0x55f6d4['model'];_0x2ec50f[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x41158a[_0x4297('0x48')]['sort']);_0x2ec50f[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x41158a['query'],_0x55f6d4['filters']));if(_0x41158a[_0x4297('0x48')]['filter']){_0x2ec50f[_0x4297('0x46')]=_['merge'](_0x2ec50f[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0x2ec50f[_0x4297('0x58')],function(_0x585564){var _0x123dab={};_0x123dab[_0x585564]={'$like':'%'+_0x41158a[_0x4297('0x48')][_0x4297('0x38')]+'%'};return _0x123dab;})});}_0x2ec50f=_['merge']({},_0x2ec50f,_0x41158a[_0x4297('0x5e')]);return _0x15477e[_0x4297('0xee')](_0x2ec50f);}})[_0x4297('0x19')](function(_0x27ead0){if(_0x27ead0){_0x495d0b=_0x27ead0[_0x4297('0x5a')];if(!_0x41158a['query'][_0x4297('0xd7')](_0x4297('0xdc'))){_0x2ec50f[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x41158a[_0x4297('0x48')][_0x4297('0x29')]);_0x2ec50f['offset']=qs['offset'](_0x41158a[_0x4297('0x48')]['offset']);}return _0x15477e[_0x4297('0xee')](_0x2ec50f);}})[_0x4297('0x19')](function(_0x19957c){if(_0x19957c){return _0x19957c?{'count':_0x495d0b,'rows':_0x19957c}:null;}})[_0x4297('0x19')](respondWithResult(_0x4ac75,null))[_0x4297('0x23')](handleError(_0x4ac75,null));};exports[_0x4297('0xf0')]=function(_0x477075,_0x4bdd13,_0x5e3d2c){var _0x55003a;var _0x235b2c;var _0x591c71;var _0x40622b=!_['isNil'](_0x477075[_0x4297('0x64')]['id'])?_0x477075[_0x4297('0x64')]['id']:!_[_0x4297('0x6d')](_0x477075['user']['id'])?_0x477075[_0x4297('0x84')]['id']:null;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x40622b,'role':{'$or':[_0x4297('0x32'),_0x4297('0x84'),_0x4297('0x35')]}},'attributes':['id','name',_0x4297('0xf1'),_0x4297('0xf2'),_0x4297('0x31'),_0x4297('0x6e'),'loginInPause']})[_0x4297('0x19')](function(_0x5a671d){if(_0x5a671d){if(_0x5a671d[_0x4297('0x31')]===_0x4297('0x35')){_0x55003a=_0x5a671d;if(_0x477075[_0x4297('0x63')][_0x4297('0xa5')]){_0x591c71=util[_0x4297('0xb2')](_0x4297('0xf3'),_0x55003a[_0x477075['body'][_0x4297('0xa5')]]);}else if(_0x477075[_0x4297('0x63')][_0x4297('0xf4')]){_0x591c71=util[_0x4297('0xb2')]('SIP/%s',_0x477075[_0x4297('0x63')][_0x4297('0xf4')]);}else{_0x591c71=util[_0x4297('0xb2')](_0x4297('0xb3'),_0x55003a[_0x4297('0x3d')]);}socket['to'](util[_0x4297('0xb2')](_0x4297('0xf5'),_0x55003a['name']))[_0x4297('0x2e')](_0x4297('0xf6'),{'user':{'id':_0x55003a['id'],'name':_0x55003a[_0x4297('0x3d')]},'ip':_0x477075[_0x4297('0xf7')][_0x4297('0xf8')]||_0x477075['connection']['remoteAddress']||_0x477075['socket'][_0x4297('0xf9')]||_0x477075[_0x4297('0xfa')]['socket'][_0x4297('0xf9')]});return db['UserVoiceQueueRt'][_0x4297('0x30')]({'where':{'membername':_0x55003a[_0x4297('0x3d')]},'individualHooks':!![]});}}else{throw new db[(_0x4297('0x99'))]['ValidationError'](_0x4297('0xfb'));}})['then'](function(){if(_0x55003a){return _0x55003a[_0x4297('0xfc')]({'raw':!![]});}})['then'](function(_0x1e5fd7){if(_0x55003a){if(_0x1e5fd7){_0x235b2c=_0x1e5fd7;if(_0x235b2c[_0x4297('0x5a')]){var _0xc5bda=_0x235b2c[_0x4297('0x3a')](function(_0x1a1370){var _0x154d0e={'membername':_0x55003a[_0x4297('0x3d')],'UserId':_0x55003a['id'],'queue_name':_0x1a1370[_0x4297('0x3d')],'VoiceQueueId':_0x1a1370['id'],'interface':_0x591c71,'paused':_0x55003a[_0x4297('0xfd')]||![],'penalty':_0x1a1370[_0x4297('0xfe')]||0x0};return db[_0x4297('0xb9')]['upsert'](_0x154d0e);});return Promise[_0x4297('0x52')](_0xc5bda);}}}})[_0x4297('0x19')](function(){if(_0x55003a){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0x55003a['name'],'exitAt':null}});}})[_0x4297('0x19')](function(_0x551d64){if(_0x55003a){var _0x1f2793=[];_0x551d64['forEach'](function(_0x4f43ef){_0x1f2793[_0x4297('0x4d')](_0x4f43ef[_0x4297('0x62')]({'exitAt':moment()[_0x4297('0xb2')](_0x4297('0x100'))}));});return Promise['all'](_0x1f2793);}})[_0x4297('0x19')](function(){if(_0x55003a){var _0xb60279=[];var _0x4ef74b=[];var _0x23a769=utils[_0x4297('0x101')]();var _0x465179={'membername':_0x55003a[_0x4297('0x3d')],'interface':_0x591c71,'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x55003a['role'],'internal':_0x55003a[_0x4297('0x6e')]};_0x23a769['forEach'](function(_0x20e8bc){_0xb60279['push'](_['merge']({'channel':_0x20e8bc,'type':_0x4297('0x102'),'data1':_0x477075[_0x4297('0x63')][_0x4297('0x103')],'data2':_0x591c71},_0x465179));if(_0x55003a[_0x4297('0xfd')]){_0x4ef74b[_0x4297('0x4d')](_[_0x4297('0x5d')]({'channel':_0x20e8bc,'type':_0x4297('0x104'),'data1':_0x4297('0x105')},_0x465179));}});return db[_0x4297('0xff')][_0x4297('0x8e')](_0xb60279[_0x4297('0xd0')](_0x4ef74b),{'individualHooks':!![]});}})[_0x4297('0x19')](function(){if(_0x55003a){return _0x55003a[_0x4297('0x62')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x55003a['loginInPause']||![],'mailPause':_0x55003a[_0x4297('0xfd')]||![],'chatPause':_0x55003a['loginInPause']||![],'faxPause':_0x55003a[_0x4297('0xfd')]||![],'smsPause':_0x55003a[_0x4297('0xfd')]||![],'openchannelPause':_0x55003a['loginInPause']||![],'whatsappPause':_0x55003a[_0x4297('0xfd')]||![],'pauseType':_0x55003a[_0x4297('0xfd')]?_0x4297('0x105'):null,'interface':_0x591c71,'lastPauseAt':moment()[_0x4297('0xb2')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0x4297('0x19')](function(_0xdce183){if(_0x477075[_0x4297('0x106')]){return _0x5e3d2c();}else{return Promise[_0x4297('0x107')](_0xdce183)[_0x4297('0x19')](respondWithResult(_0x4bdd13,null));}})[_0x4297('0x23')](handleError(_0x4bdd13,null));};exports['logout']=function(_0x28f5f2,_0x426675){var _0x2d6b8f;return db[_0x4297('0x41')][_0x4297('0x3c')]({'where':{'id':_0x28f5f2[_0x4297('0x64')]['id'],'role':_0x4297('0x35')},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31')]})[_0x4297('0x19')](handleEntityNotFound(_0x426675,null))[_0x4297('0x19')](function(_0x52123b){if(_0x52123b){_0x2d6b8f=_0x52123b;return db[_0x4297('0xb9')]['destroy']({'where':{'membername':_0x2d6b8f[_0x4297('0x3d')]},'individualHooks':!![]});}})['then'](function(){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0x2d6b8f[_0x4297('0x3d')],'exitAt':null}});})[_0x4297('0x19')](function(_0x58a249){var _0x41df54=[];_0x58a249[_0x4297('0x108')](function(_0xe7ac1c){_0x41df54[_0x4297('0x4d')](_0xe7ac1c[_0x4297('0x62')]({'exitAt':moment()['format'](_0x4297('0x100'))}));});return Promise[_0x4297('0x52')](_0x41df54);})['then'](function(){return _0x2d6b8f[_0x4297('0x62')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x426675,null))[_0x4297('0x23')](handleError(_0x426675,null));};exports[_0x4297('0x109')]=function(_0x18a493,_0x2c48db){var _0xf3c51d;return db[_0x4297('0xb9')][_0x4297('0x62')]({'paused':0x1},{'where':{'UserId':_0x18a493['params']['id']},'individualHooks':!![]})[_0x4297('0x19')](function(){return db['User'][_0x4297('0x3c')]({'where':{'id':_0x18a493[_0x4297('0x64')]['id'],'role':_0x4297('0x35')},'attributes':['id',_0x4297('0x3d'),_0x4297('0x31'),_0x4297('0x6e'),_0x4297('0xa5'),_0x4297('0xb1')]});})[_0x4297('0x19')](handleEntityNotFound(_0x2c48db,null))['then'](function(_0x5a726d){if(_0x5a726d){_0xf3c51d=_0x5a726d;return respondWithRpcPromise(_0x4297('0x10a'),_0x4297('0x109'),{'id':_0xf3c51d['id'],'name':_0xf3c51d[_0x4297('0x3d')],'pause':!![]});}})[_0x4297('0x19')](function(){if(_0xf3c51d){return db[_0x4297('0xff')][_0x4297('0x4b')]({'where':{'membername':_0xf3c51d[_0x4297('0x3d')],'type':_0x4297('0x104'),'exitAt':null}});}})[_0x4297('0x19')](function(_0x115545){if(_0x115545[_0x4297('0x5a')]){var _0x42721b=moment()['format'](_0x4297('0x100'));for(var _0x374814=0x0,_0x3ff2e7=_0x115545['length'];_0x374814<_0x3ff2e7;_0x374814++){_0x115545[_0x374814][_0x4297('0x10b')]({'exitAt':_0x42721b});}}})[_0x4297('0x19')](function(){var _0xc6b4d9=[];var _0x5c823d=utils[_0x4297('0x101')]();_0x5c823d[_0x4297('0x108')](function(_0x5e3199){_0xc6b4d9['push']({'channel':_0x5e3199,'membername':_0xf3c51d[_0x4297('0x3d')],'interface':_[_0x4297('0x6d')](_0xf3c51d[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0xf3c51d[_0x4297('0x3d')]):_0xf3c51d[_0x4297('0xa5')],'type':_0x4297('0x104'),'enterAt':moment()[_0x4297('0xb2')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x18a493['body']['type']||_0x4297('0x10c'),'role':_0xf3c51d[_0x4297('0x31')],'internal':_0xf3c51d[_0x4297('0x6e')]});});return db[_0x4297('0xff')][_0x4297('0x8e')](_0xc6b4d9,{'individualHooks':!![]});})[_0x4297('0x19')](function(){return _0xf3c51d[_0x4297('0x62')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x18a493[_0x4297('0x63')]['type']||_0x4297('0x10c'),'lastPauseAt':moment()[_0x4297('0xb2')](_0x4297('0x100'))});})[_0x4297('0x19')](respondWithResult(_0x2c48db,null))[_0x4297('0x23')](handleError(_0x2c48db,null));};exports[_0x4297('0x10d')]=function(_0x26a11a,_0x382609){if(_0x26a11a[_0x4297('0x63')]['channel']&&!utils[_0x4297('0xa6')](_0x26a11a[_0x4297('0x63')][_0x4297('0xa3')])){throw new APIBadRequestError(util[_0x4297('0xb2')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x26a11a[_0x4297('0x63')]['channel']));}return db['User'][_0x4297('0x3c')]({'where':{'id':_0x26a11a['params']['id']},'attributes':['id',_0x4297('0x3d'),'role','internal',_0x4297('0xa5'),_0x4297('0xb1'),'voicePause',_0x4297('0x10e'),_0x4297('0x10f'),_0x4297('0x110'),_0x4297('0x111'),'smsPause',_0x4297('0x112'),_0x4297('0x113'),_0x4297('0x114')]})[_0x4297('0x19')](function(_0x5e4005){if(!_0x5e4005){throw new APINotFoundError(util[_0x4297('0xb2')](_0x4297('0x115'),_0x26a11a[_0x4297('0x64')]['id']));}return _0x5e4005[_0x4297('0x10d')](_0x26a11a[_0x4297('0x63')][_0x4297('0xa3')]);})[_0x4297('0x19')](respondWithResult(_0x382609,null))[_0x4297('0x23')](APIHandleError(_0x382609));};exports[_0x4297('0x116')]=function(_0x6ea156,_0x87c349){var _0x3b6f84={};var _0x227a32={};var _0x4a61fd;var _0x3398e9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x6ea156[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x87c349,null))[_0x4297('0x19')](function(_0x29953e){if(_0x29953e){_0x4a61fd=_0x29953e;_0x227a32[_0x4297('0x53')]=_['keys'](db[_0x4297('0x117')]['rawAttributes']);_0x227a32[_0x4297('0x48')]=_[_0x4297('0x56')](_0x6ea156[_0x4297('0x48')]);_0x227a32[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x227a32[_0x4297('0x53')],_0x227a32['query']);_0x3b6f84['attributes']=_[_0x4297('0x57')](_0x227a32[_0x4297('0x53')],qs[_0x4297('0x59')](_0x6ea156['query'][_0x4297('0x59')]));_0x3b6f84[_0x4297('0x58')]=_0x3b6f84[_0x4297('0x58')][_0x4297('0x5a')]?_0x3b6f84[_0x4297('0x58')]:_0x227a32[_0x4297('0x53')];_0x3b6f84[_0x4297('0xd4')]=qs['sort'](_0x6ea156['query'][_0x4297('0xd5')]);_0x3b6f84[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x6ea156[_0x4297('0x48')],_0x227a32['filters']));if(_0x6ea156[_0x4297('0x48')][_0x4297('0x38')]){_0x3b6f84[_0x4297('0x46')]=_[_0x4297('0x5d')](_0x3b6f84[_0x4297('0x46')],{'$or':_['map'](_0x3b6f84['attributes'],function(_0xa09570){var _0x43f2a9={};_0x43f2a9[_0xa09570]={'$like':'%'+_0x6ea156[_0x4297('0x48')]['filter']+'%'};return _0x43f2a9;})});}_0x3b6f84=_[_0x4297('0x5d')]({},_0x3b6f84,_0x6ea156[_0x4297('0x5e')]);return _0x4a61fd[_0x4297('0x116')](_0x3b6f84);}})[_0x4297('0x19')](function(_0x51cb25){if(_0x51cb25){_0x3398e9=_0x51cb25[_0x4297('0x5a')];if(!_0x6ea156[_0x4297('0x48')][_0x4297('0xd7')](_0x4297('0xdc'))){_0x3b6f84[_0x4297('0x29')]=qs[_0x4297('0x29')](_0x6ea156[_0x4297('0x48')][_0x4297('0x29')]);_0x3b6f84['offset']=qs[_0x4297('0x2a')](_0x6ea156[_0x4297('0x48')][_0x4297('0x2a')]);}return _0x4a61fd[_0x4297('0x116')](_0x3b6f84);}})[_0x4297('0x19')](function(_0x1ca6b0){if(_0x1ca6b0){return _0x1ca6b0?{'count':_0x3398e9,'rows':_0x1ca6b0}:null;}})['then'](respondWithResult(_0x87c349,null))[_0x4297('0x23')](handleError(_0x87c349,null));};exports[_0x4297('0x118')]=function(_0x1bd053,_0x1830fd){var _0x4268ff=_0x1bd053['params']['id'];var _0x5d09f4=_0x1bd053['body']?_0x1bd053[_0x4297('0x63')][_0x4297('0x67')]:null;var _0x11ddc6=[];return Promise[_0x4297('0x107')]()['then'](function(){if(!_0x5d09f4)throw new APIBadRequestError(_0x4297('0x119'));})[_0x4297('0x19')](function(){return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x4268ff}});})[_0x4297('0x19')](function(_0x42902d){if(!_0x42902d)throw new APINotFoundError(util[_0x4297('0xb2')](_0x4297('0x115'),_0x1bd053[_0x4297('0x64')]['id']));return db[_0x4297('0x71')][_0x4297('0x11a')](function(_0x36823d){return _0x42902d['addTeams'](_0x5d09f4,{'transaction':_0x36823d})[_0x4297('0x19')](function(){return db['Team'][_0x4297('0x4b')]({'where':{'id':{'$in':_0x5d09f4}}});})[_0x4297('0x19')](function(_0x10ec03){var _0x2751b8=_[_0x4297('0x3a')](_0x10ec03,function(_0x3cd697){return _0x3cd697[_0x4297('0x11b')]();});return Promise[_0x4297('0x52')](_0x2751b8);})['then'](function(_0x554756){_0x11ddc6=_['flattenDeep'](_0x554756);var _0x4c727a=_[_0x4297('0x3a')](_0x11ddc6,function(_0x735688){return _0x735688[_0x4297('0x11c')](_0x42902d['id'],{'transaction':_0x36823d});});return Promise[_0x4297('0x52')](_0x4c727a);})[_0x4297('0x19')](function(){if(!_0x42902d[_0x4297('0xb1')])return;var _0x18c6a0=_[_0x4297('0x38')](_0x11ddc6,function(_0x48d521){return _0x48d521[_0x4297('0x11d')](_0x4297('0xa3'))===_0x4297('0x11e');});var _0x2bcaaf=_[_0x4297('0x3a')](_0x18c6a0,function(_0x5b4f55){return db[_0x4297('0xb9')][_0x4297('0xb4')]({'membername':_0x42902d[_0x4297('0x3d')],'UserId':_0x42902d['id'],'queue_name':_0x5b4f55[_0x4297('0x3d')],'VoiceQueueId':_0x5b4f55['id'],'interface':_[_0x4297('0x6d')](_0x42902d[_0x4297('0xa5')])?util[_0x4297('0xb2')](_0x4297('0xb3'),_0x42902d[_0x4297('0x3d')]):_0x42902d[_0x4297('0xa5')],'paused':_0x42902d[_0x4297('0xa4')]||![],'penalty':_0x42902d[_0x4297('0xaa')]},{'transaction':_0x36823d});});return Promise['all'](_0x2bcaaf);})[_0x4297('0x19')](function(){return db['TeamVoicePrefix'][_0x4297('0x4b')]({'where':{'teamId':{'$in':_0x5d09f4}}});})[_0x4297('0x19')](function(_0x132433){var _0x578147=_[_0x4297('0x3a')](_0x132433,function(_0x137bd3){return db[_0x4297('0x11f')]['create']({'UserId':_0x42902d['id'],'VoicePrefixId':_0x137bd3[_0x4297('0x120')]},{'transaction':_0x36823d});});return Promise[_0x4297('0x52')](_0x578147);});});})[_0x4297('0x19')](function(){for(var _0x5a4ad0=0x0;_0x5a4ad0<_0x11ddc6['length'];_0x5a4ad0++){var _0xbea9ed=_0x11ddc6[_0x5a4ad0][_0x4297('0x11d')](_0x4297('0xa3'));var _0x57a925=_0xbea9ed+_0x4297('0xac');socket['emit'](_0x4297('0x84')+_0xbea9ed+'Queue:save',{'UserId':_0x4268ff,['queueField']:_0x11ddc6[_0x5a4ad0]['id']});}})['then'](respondWithStatusCode(_0x1830fd,null))[_0x4297('0x23')](APIHandleError(_0x1830fd));};exports[_0x4297('0x121')]=function(_0x219235,_0x42ebdb){var _0x52eb0b=_0x219235[_0x4297('0x64')]['id'];var _0x49ddcf=null;if(_0x219235[_0x4297('0x48')]['ids']){_0x49ddcf=_[_0x4297('0xb7')](_0x219235[_0x4297('0x48')][_0x4297('0x67')])?_0x219235[_0x4297('0x48')][_0x4297('0x67')]:[_0x219235[_0x4297('0x48')][_0x4297('0x67')]];}var _0x429896=[];return Promise[_0x4297('0x107')]()[_0x4297('0x19')](function(){if(!_0x49ddcf)throw new APIBadRequestError(_0x4297('0x122'));})[_0x4297('0x19')](function(){return db['User']['findOne']({'where':{'id':_0x52eb0b}});})[_0x4297('0x19')](function(_0x16dd15){if(!_0x16dd15)throw new APINotFoundError(util['format'](_0x4297('0x115'),_0x219235[_0x4297('0x64')]['id']));return db[_0x4297('0x71')]['transaction'](function(_0x356abb){return _0x16dd15[_0x4297('0x121')](_0x49ddcf,{'transaction':_0x356abb})[_0x4297('0x19')](function(){return db[_0x4297('0x117')][_0x4297('0x4b')]({'where':{'id':{'$in':_0x49ddcf}}});})[_0x4297('0x19')](function(_0xcf7e21){var _0x268a44=_[_0x4297('0x3a')](_0xcf7e21,function(_0x2a4296){return _0x2a4296[_0x4297('0x11b')]();});return Promise[_0x4297('0x52')](_0x268a44);})['then'](function(_0x379f84){_0x429896=_['flattenDeep'](_0x379f84);var _0x2239b5=_[_0x4297('0x3a')](_0x429896,function(_0x5aeac3){return _0x5aeac3[_0x4297('0x123')](_0x16dd15['id'],{'transaction':_0x356abb});});return Promise['all'](_0x2239b5);})[_0x4297('0x19')](function(){if(!_0x16dd15[_0x4297('0xb1')])return;var _0x509820=_[_0x4297('0x38')](_0x429896,function(_0xcea0b6){return _0xcea0b6[_0x4297('0x11d')]('channel')==='Voice';});var _0x752b3f=_[_0x4297('0x3a')](_0x509820,function(_0x416d1f){return db['UserVoiceQueueRt'][_0x4297('0x30')]({'where':{'VoiceQueueId':_0x416d1f['id'],'UserId':_0x16dd15['id']},'transaction':_0x356abb});});return Promise['all'](_0x752b3f);})[_0x4297('0x19')](function(){return db[_0x4297('0x124')][_0x4297('0x4b')]({'where':{'teamId':{'$in':_0x49ddcf}}});})[_0x4297('0x19')](function(_0x30caef){var _0x56a071=_[_0x4297('0x3a')](_0x30caef,function(_0x304703){return db['UserVoicePrefix'][_0x4297('0x30')]({'where':{'UserId':_0x16dd15['id'],'VoicePrefixId':_0x304703[_0x4297('0x120')]}},{'transaction':_0x356abb});});return Promise[_0x4297('0x52')](_0x56a071);});});})['then'](function(){for(var _0x507bec=0x0;_0x507bec<_0x429896[_0x4297('0x5a')];_0x507bec++){var _0x2c11d6=_0x429896[_0x507bec][_0x4297('0x11d')](_0x4297('0xa3'));var _0x7d9d3a=_0x2c11d6+_0x4297('0xac');socket[_0x4297('0x2e')](_0x4297('0x84')+_0x2c11d6+_0x4297('0xb8'),{'UserId':_0x52eb0b,['queueField']:_0x429896[_0x507bec]['id']});}})['then'](respondWithStatusCode(_0x42ebdb,null))[_0x4297('0x23')](APIHandleError(_0x42ebdb));};exports['getLists']=function(_0x57714f,_0x17fca9){var _0x2038dd={};var _0x4a3369={};var _0x4b73bc;var _0x55b2a0;return db['User'][_0x4297('0x9d')]({'where':{'id':_0x57714f[_0x4297('0x64')]['id']}})['then'](handleEntityNotFound(_0x17fca9,null))[_0x4297('0x19')](function(_0x37d315){if(_0x37d315){_0x4b73bc=_0x37d315;_0x4a3369['model']=_[_0x4297('0x56')](db[_0x4297('0xd8')][_0x4297('0x42')]);_0x4a3369[_0x4297('0x48')]=_[_0x4297('0x56')](_0x57714f[_0x4297('0x48')]);_0x4a3369[_0x4297('0xd3')]=_['intersection'](_0x4a3369['model'],_0x4a3369['query']);_0x2038dd[_0x4297('0x58')]=_['intersection'](_0x4a3369[_0x4297('0x53')],qs['fields'](_0x57714f[_0x4297('0x48')][_0x4297('0x59')]));_0x2038dd[_0x4297('0x58')]=_0x2038dd['attributes'][_0x4297('0x5a')]?_0x2038dd[_0x4297('0x58')]:_0x4a3369[_0x4297('0x53')];_0x2038dd[_0x4297('0xd4')]=qs[_0x4297('0xd5')](_0x57714f[_0x4297('0x48')]['sort']);_0x2038dd['where']=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x57714f[_0x4297('0x48')],_0x4a3369['filters']));if(_0x57714f[_0x4297('0x48')]['filter']){_0x2038dd['where']=_[_0x4297('0x5d')](_0x2038dd[_0x4297('0x46')],{'$or':_['map'](_0x2038dd[_0x4297('0x58')],function(_0x56e218){var _0x5f5136={};_0x5f5136[_0x56e218]={'$like':'%'+_0x57714f['query'][_0x4297('0x38')]+'%'};return _0x5f5136;})});}_0x2038dd=_[_0x4297('0x5d')]({},_0x2038dd,_0x57714f[_0x4297('0x5e')]);return _0x4b73bc[_0x4297('0x125')](_0x2038dd);}})['then'](function(_0x3ca3d6){if(_0x3ca3d6){_0x55b2a0=_0x3ca3d6[_0x4297('0x5a')];if(!_0x57714f['query'][_0x4297('0xd7')]('nolimit')){_0x2038dd['limit']=qs[_0x4297('0x29')](_0x57714f[_0x4297('0x48')][_0x4297('0x29')]);_0x2038dd[_0x4297('0x2a')]=qs['offset'](_0x57714f[_0x4297('0x48')]['offset']);}return _0x4b73bc[_0x4297('0x125')](_0x2038dd);}})[_0x4297('0x19')](function(_0x1fd097){if(_0x1fd097){return _0x1fd097?{'count':_0x55b2a0,'rows':_0x1fd097}:null;}})['then'](respondWithResult(_0x17fca9,null))['catch'](handleError(_0x17fca9,null));};exports[_0x4297('0x126')]=function(_0x118554,_0x6dc290){var _0xa51569={};var _0x4bbf90={};var _0x4c8cb9;return db[_0x4297('0x41')][_0x4297('0x9d')]({'where':{'id':_0x118554[_0x4297('0x64')]['id']}})[_0x4297('0x19')](handleEntityNotFound(_0x6dc290,null))[_0x4297('0x19')](function(_0x5111b8){if(_0x5111b8){_0x4c8cb9=_0x5111b8;_0x4bbf90[_0x4297('0x53')]=_[_0x4297('0x56')](db['User'][_0x4297('0x42')]);_0x4bbf90[_0x4297('0x48')]=_[_0x4297('0x56')](_0x118554[_0x4297('0x48')]);_0x4bbf90[_0x4297('0xd3')]=_[_0x4297('0x57')](_0x4bbf90[_0x4297('0x53')],_0x4bbf90[_0x4297('0x48')]);_0xa51569['attributes']=_[_0x4297('0x57')](_0x4bbf90[_0x4297('0x53')],qs['fields'](_0x118554['query'][_0x4297('0x59')]));_0xa51569[_0x4297('0x58')]=_0xa51569[_0x4297('0x58')][_0x4297('0x5a')]?_0xa51569[_0x4297('0x58')]:_0x4bbf90[_0x4297('0x53')];_0xa51569['order']=qs[_0x4297('0xd5')](_0x118554[_0x4297('0x48')][_0x4297('0xd5')]);_0xa51569[_0x4297('0x46')]=qs[_0x4297('0xd3')](_[_0x4297('0xd6')](_0x118554[_0x4297('0x48')],_0x4bbf90['filters']));if(_0x118554[_0x4297('0x48')][_0x4297('0x38')]){_0xa51569[_0x4297('0x46')]=_[_0x4297('0x5d')](_0xa51569[_0x4297('0x46')],{'$or':_[_0x4297('0x3a')](_0xa51569[_0x4297('0x58')],function(_0x523c8a){var _0x3d9559={};_0x3d9559[_0x523c8a]={'$like':'%'+_0x118554[_0x4297('0x48')]['filter']+'%'};return _0x3d9559;})});}_0xa51569[_0x4297('0x53')]=db[_0x4297('0x41')];_0xa51569['as']=_0x4297('0x34');_0xa51569=_[_0x4297('0x5d')]({},_0xa51569,_0x118554[_0x4297('0x5e')]);return _0x4c8cb9[_0x4297('0xfc')]({'include':[_0xa51569]});}})[_0x4297('0x19')](function(_0x3c8726){if(_0x3c8726){var _0x71ff75={},_0x5cb260=[];for(var _0x348702=0x0;_0x348702<_0x3c8726[_0x4297('0x5a')];_0x348702+=0x1){for(var _0x4b572a=0x0,_0x28b735;_0x4b572a<_0x3c8726[_0x348702][_0x4297('0x34')][_0x4297('0x5a')];_0x4b572a+=0x1){_0x28b735=_0x3c8726[_0x348702][_0x4297('0x34')][_0x4b572a][_0x4297('0xb0')]({'plain':!![]});_0x71ff75[_0x28b735['id']]=_0x28b735;}}_0x71ff75=_[_0x4297('0x127')](_0x71ff75);for(var _0xa05dc1=qs[_0x4297('0x2a')](_0x118554['query'][_0x4297('0x2a')]);_0xa05dc1<_0x71ff75[_0x4297('0x5a')]&&_0x5cb260['length']=_0x5c7183){_0x4efb46=_0x5c7183;_0x56c7c9=0xc8;}else{_0x56c7c9=0xce;}_0x1b0ff7[_0x71cf('0x1e')](_0x56c7c9);return _0x1b0ff7[_0x71cf('0x23')]('Content-Range',_0x1a6af1+'-'+_0x4efb46+'/'+_0x5c7183)['json'](_0x2b5293);}return null;};}function saveUpdates(_0x550a7d){return function(_0x57fee3){if(_0x57fee3){return _0x57fee3[_0x71cf('0x24')](_0x550a7d)[_0x71cf('0x13')](function(_0x355c75){socket[_0x71cf('0x25')](_0x71cf('0x26')+_0x355c75['id'],{});return _0x355c75;});}return null;};}function removeEntity(_0x2f092b){return function(_0x4e5db6){if(_0x4e5db6){return _0x4e5db6['destroy']()[_0x71cf('0x13')](function(){var _0x42cef8=_0x4e5db6[_0x71cf('0x27')]({'plain':!![]});if(_0x42cef8['role']===_0x71cf('0x28'))return;var _0x5690b9=[{'name':_0x71cf('0x29'),'value':_0x71cf('0x2a'),'ignore':!![]},{'name':_0x71cf('0x2b'),'value':_0x71cf('0x2c'),'ignore':![]},{'name':_0x71cf('0x2d'),'value':_0x71cf('0x2e'),'ignore':![]}];var _0x2db174=_(_0x5690b9)['filter']('ignore')[_0x71cf('0x2f')](_0x71cf('0x30'))['value']();if(_['includes'](_0x2db174,_0x42cef8[_0x71cf('0x31')])){return;}var _0x2bdbab=_[_0x71cf('0x32')](_0x5690b9,[_0x71cf('0x30'),_0x42cef8[_0x71cf('0x31')]])[_0x71cf('0x33')];return db['UserProfileResource'][_0x71cf('0x34')]({'where':{'type':_0x2bdbab,'resourceId':_0x42cef8['id']}})['then'](function(){return _0x4e5db6;});})['then'](function(){_0x2f092b[_0x71cf('0x1e')](0xcc)[_0x71cf('0x1d')]();});}};}function handleEntityNotFound(_0x5d3e0d){return function(_0x19d632){if(!_0x19d632){_0x5d3e0d[_0x71cf('0x1c')](0x194);}return _0x19d632;};}function handleError(_0x2eba23,_0x3bc718){_0x3bc718=_0x3bc718||0x1f4;return function(_0x44df5a){logger[_0x71cf('0x17')](_0x44df5a[_0x71cf('0x35')]);if(_0x44df5a[_0x71cf('0x33')]){delete _0x44df5a[_0x71cf('0x33')];}_0x2eba23[_0x71cf('0x1e')](_0x3bc718)[_0x71cf('0x36')](_0x44df5a);};}exports[_0x71cf('0x37')]=function(_0x3d5e74,_0x3c8f40){var _0x375df1={},_0x593778={'count':0x0,'rows':[]};var _0x4c9d7b=_(db[_0x71cf('0x38')]['rawAttributes'])[_0x71cf('0x2f')](function(_0x15bb71){return{'name':_0x15bb71[_0x71cf('0x39')],'type':_0x15bb71[_0x71cf('0x3a')][_0x71cf('0x3b')]};})['filter'](function(_0x54fc12){return!_[_0x71cf('0x3c')]([_0x71cf('0x3d'),_0x71cf('0x3e')],_0x54fc12[_0x71cf('0x33')]);})['value']();_0x375df1=qs[_0x71cf('0x3f')](_0x4c9d7b,_0x3d5e74);var _0x642ee={'where':_0x375df1[_0x71cf('0x40')]};return db[_0x71cf('0x38')][_0x71cf('0x21')](_0x642ee)[_0x71cf('0x13')](function(_0x3e97b1){_0x593778[_0x71cf('0x21')]=_0x3e97b1;if(_0x3d5e74['query']['includeAll']){_0x375df1[_0x71cf('0x41')]=[{'all':!![]}];}if(_0x3d5e74['query']['userSetting']==='true'){_0x375df1[_0x71cf('0x41')]=[{'model':db[_0x71cf('0x42')],'as':_0x71cf('0x43')}];}if(!_['includes'](_0x375df1[_0x71cf('0x44')],'id')){_0x375df1['attributes'][_0x71cf('0x45')]('id');}return db['User'][_0x71cf('0x46')](_0x375df1);})[_0x71cf('0x13')](function(_0x4381ff){_0x593778['rows']=_0x4381ff;if(_0x3d5e74[_0x71cf('0x47')]['openTabs']===_0x71cf('0x48')){var _0x9fff5d=[];for(var _0x2bda67=0x0;_0x2bda67<_0x593778[_0x71cf('0x49')][_0x71cf('0x4a')];_0x2bda67++){_0x9fff5d[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4b'),_0x593778['rows'][_0x2bda67][_0x71cf('0x4c')]));_0x9fff5d['push'](get_open_tabs(_0x71cf('0x4d'),_0x593778[_0x71cf('0x49')][_0x2bda67][_0x71cf('0x4c')]));_0x9fff5d['push'](get_open_tabs(_0x71cf('0x4e'),_0x593778[_0x71cf('0x49')][_0x2bda67][_0x71cf('0x4c')]));_0x9fff5d[_0x71cf('0x45')](get_open_tabs('mail',_0x593778[_0x71cf('0x49')][_0x2bda67][_0x71cf('0x4c')]));_0x9fff5d[_0x71cf('0x45')](get_open_tabs('openchannel',_0x593778[_0x71cf('0x49')][_0x2bda67][_0x71cf('0x4c')]));_0x9fff5d['push'](get_open_tabs(_0x71cf('0x4f'),_0x593778[_0x71cf('0x49')][_0x2bda67][_0x71cf('0x4c')]));}return Promise[_0x71cf('0x50')](_0x9fff5d)[_0x71cf('0x13')](function(){return _0x593778;});}else{return _0x593778;}})[_0x71cf('0x13')](respondWithFilteredResult(_0x3c8f40,_0x375df1))[_0x71cf('0x51')](handleError(_0x3c8f40,null));};exports[_0x71cf('0x52')]=function(_0x414ffa,_0x35fe6f){var _0x54497c={'raw':![],'where':{'id':_0x414ffa['params']['id']}},_0x1235d1={};_0x1235d1[_0x71cf('0x53')]=_['differenceBy'](_[_0x71cf('0x54')](db[_0x71cf('0x38')][_0x71cf('0x55')]),[_0x71cf('0x3d'),_0x71cf('0x3e')]);_0x1235d1[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x414ffa[_0x71cf('0x47')]);_0x1235d1['filters']=_[_0x71cf('0x56')](_0x1235d1['model'],_0x1235d1[_0x71cf('0x47')]);_0x54497c[_0x71cf('0x44')]=_[_0x71cf('0x56')](_0x1235d1[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x414ffa['query'][_0x71cf('0x57')]));_0x54497c[_0x71cf('0x44')]=_0x54497c[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x54497c['attributes']:_0x1235d1[_0x71cf('0x53')];if(_0x414ffa['query'][_0x71cf('0x58')]){_0x54497c[_0x71cf('0x41')]=[{'all':!![]}];}if(_0x414ffa[_0x71cf('0x47')]['userSetting']==='true'){_0x54497c[_0x71cf('0x41')]=[{'model':db[_0x71cf('0x42')],'as':'userSetting'}];}_0x54497c=_[_0x71cf('0x59')]({},_0x54497c,_0x414ffa['options']);if(!_[_0x71cf('0x3c')](_0x54497c[_0x71cf('0x44')],'id')){_0x54497c[_0x71cf('0x44')][_0x71cf('0x45')]('id');}return db[_0x71cf('0x38')]['find'](_0x54497c)['then'](handleEntityNotFound(_0x35fe6f,null))['then'](function(_0x3cc5a8){var _0x3d6422=[];values=_0x3cc5a8;if(_0x414ffa[_0x71cf('0x47')][_0x71cf('0x5a')]===_0x71cf('0x48')){_0x3d6422[_0x71cf('0x45')](get_open_tabs('chat',_0x3cc5a8['dataValues']));_0x3d6422['push'](get_open_tabs(_0x71cf('0x4d'),_0x3cc5a8[_0x71cf('0x4c')]));_0x3d6422[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x5b'),_0x3cc5a8['dataValues']));_0x3d6422[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4f'),_0x3cc5a8[_0x71cf('0x4c')]));_0x3d6422[_0x71cf('0x45')](get_open_tabs('fax',_0x3cc5a8[_0x71cf('0x4c')]));_0x3d6422['push'](get_open_tabs(_0x71cf('0x5c'),_0x3cc5a8[_0x71cf('0x4c')]));return Promise[_0x71cf('0x50')](_0x3d6422);}else{return values;}})['then'](function(){return values;})[_0x71cf('0x13')](respondWithResult(_0x35fe6f,null))[_0x71cf('0x51')](handleError(_0x35fe6f,null));};exports[_0x71cf('0x24')]=function(_0x550772,_0x5140c4){if(_0x550772[_0x71cf('0x5d')]['id']){delete _0x550772[_0x71cf('0x5d')]['id'];}delete _0x550772[_0x71cf('0x5d')]['role'];return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x550772[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x5140c4,null))[_0x71cf('0x13')](saveUpdates(_0x550772[_0x71cf('0x5d')],null))[_0x71cf('0x13')](respondWithResult(_0x5140c4,null))[_0x71cf('0x51')](handleError(_0x5140c4,null));};exports[_0x71cf('0x5f')]=function(_0x31ff28,_0x218b8e){return db[_0x71cf('0x38')]['describe']()[_0x71cf('0x13')](respondWithResult(_0x218b8e,null))[_0x71cf('0x51')](handleError(_0x218b8e,null));};exports[_0x71cf('0x60')]=function(_0x29523c,_0x5512b4){return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x29523c[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x5512b4,null))['then'](function(_0x57f9ea){if(_0x57f9ea){return _0x57f9ea[_0x71cf('0x60')](_0x29523c['body']['ids'],_[_0x71cf('0x61')](_0x29523c[_0x71cf('0x5d')],[_0x71cf('0x62'),'id'])||{});}})['then'](respondWithResult(_0x5512b4,null))['catch'](handleError(_0x5512b4,null));};function validateUser(_0x3d83eb){return new Promise(function(_0x438372,_0x50d184){if(_0x3d83eb[_0x71cf('0x63')])return _0x438372(_0x3d83eb);return db[_0x71cf('0x64')][_0x71cf('0x65')](0x1)[_0x71cf('0x13')](function(_0x418258){if(_0x418258[_0x71cf('0x66')])authService['validatePasswordPattern'](_0x3d83eb['password']);db['User']['max'](_0x71cf('0x63'))['then'](function(_0x174d2b){if(_[_0x71cf('0x67')](_0x174d2b)){_0x3d83eb[_0x71cf('0x63')]=_0x418258[_0x71cf('0x68')]||0x1;return;}if(_['isNil'](_0x418258[_0x71cf('0x68')])||_0x418258[_0x71cf('0x68')]===_0x174d2b){_0x3d83eb[_0x71cf('0x63')]=_0x174d2b+0x1;return;}if(_0x418258[_0x71cf('0x68')]>_0x174d2b){_0x3d83eb['internal']=_0x418258[_0x71cf('0x68')];return;}return db[_0x71cf('0x69')]['query'](_0x71cf('0x6a'),{'type':db[_0x71cf('0x69')][_0x71cf('0x6b')][_0x71cf('0x6c')]})[_0x71cf('0x13')](function(_0x2011eb){if(_0x2011eb&&_0x2011eb['length']){for(var _0x5531b2=0x0,_0x5d24a1=_0x2011eb[_0x71cf('0x4a')];_0x5531b2<_0x5d24a1&&_[_0x71cf('0x67')](_0x3d83eb['internal']);_0x5531b2++){if(_0x418258[_0x71cf('0x68')]<=_0x2011eb[_0x5531b2][_0x71cf('0x6d')]){_0x3d83eb['internal']=_0x2011eb[_0x5531b2][_0x71cf('0x6d')];}else if(_0x418258[_0x71cf('0x68')]>_0x2011eb[_0x5531b2]['from']&&_0x418258['min_internal']<=_0x2011eb[_0x5531b2]['to']){_0x3d83eb[_0x71cf('0x63')]=_0x418258[_0x71cf('0x68')];}}}if(_['isNil'](_0x3d83eb[_0x71cf('0x63')])){_0x3d83eb[_0x71cf('0x63')]=_0x174d2b+0x1;}return _0x438372(_0x3d83eb);});});})[_0x71cf('0x51')](function(_0x28492d){_0x50d184(_0x28492d);});});}function updateUser(_0x347f21){return new Promise(function(_0x564346,_0x1c08e3){try{if(_0x347f21[_0x71cf('0x6e')]){_0x347f21['mailbox']=_0x347f21[_0x71cf('0x63')];_0x347f21['VoiceMail']={'mailbox':_0x347f21['internal'],'password':_0x347f21[_0x71cf('0x3d')],'fullname':_0x347f21[_0x71cf('0x6f')],'email':_0x347f21[_0x71cf('0x70')]};}if(_0x347f21[_0x71cf('0x31')]===_0x71cf('0x2c')){if(!_0x347f21[_0x71cf('0x71')])_0x347f21[_0x71cf('0x71')]=['101',_0x71cf('0x72'),_0x71cf('0x73'),_0x71cf('0x74'),_0x71cf('0x75'),'104',_0x71cf('0x76'),_0x71cf('0x77'),_0x71cf('0x78'),_0x71cf('0x79'),'109','100',_0x71cf('0x7a'),'114','115'];}_0x564346(_0x347f21);}catch(_0x34315f){_0x1c08e3(_0x34315f);}});}exports[_0x71cf('0x7b')]=function(_0x19ec8a,_0x16ca97){if(_0x19ec8a[_0x71cf('0x2a')][_0x71cf('0x31')]===_0x71cf('0x2c'))throw new Error(_0x71cf('0x7c'));if(_0x19ec8a['body'][_0x71cf('0x31')]===_0x71cf('0x2a')&&_0x19ec8a['user']['role']!==_0x71cf('0x28')){throw new Error(_0x71cf('0x7d'));}if(_0x19ec8a[_0x71cf('0x5d')]['role']==='admin'&&_0x19ec8a['user']['role']!==_0x71cf('0x28')){throw new Error(_0x71cf('0x7e'));}return licenseUtil[_0x71cf('0x7f')]([_0x19ec8a[_0x71cf('0x5d')]])['then'](function(){return validateUser(_0x19ec8a['body']);})[_0x71cf('0x13')](function(_0x28149d){return updateUser(_0x28149d)[_0x71cf('0x13')](function(_0x12d141){if(_0x12d141[_0x71cf('0x31')]===_0x71cf('0x28')){_0x12d141['settingsEnabled']=_0x19ec8a[_0x71cf('0x2a')][_0x71cf('0x80')];delete _0x12d141['userProfileId'];}return _0x12d141;});})[_0x71cf('0x13')](function(_0x41c5ac){return db[_0x71cf('0x38')][_0x71cf('0x7b')](_0x41c5ac,{'include':[{'model':db[_0x71cf('0x81')],'as':_0x71cf('0x81')}]});})['then'](function(_0x1a645c){if(_0x19ec8a[_0x71cf('0x5d')][_0x71cf('0x31')]===_0x71cf('0x2a'))return _0x1a645c;if(_0x19ec8a[_0x71cf('0x2a')][_0x71cf('0x31')]!=='user')return _0x1a645c;return db[_0x71cf('0x82')]['find']({'where':{'name':_0x1a645c[_0x71cf('0x31')]===_0x71cf('0x2c')?_0x71cf('0x2b'):_0x71cf('0x2d'),'userProfileId':_0x19ec8a['user'][_0x71cf('0x83')]},'raw':!![]})[_0x71cf('0x13')](function(_0x19955d){if(!_0x19955d||_0x19955d['autoAssociation']!=0x0)return _0x1a645c;return db[_0x71cf('0x84')]['create']({'name':_0x1a645c[_0x71cf('0x33')],'resourceId':_0x1a645c['id'],'type':_0x19955d[_0x71cf('0x33')],'sectionId':_0x19955d['id']},{})[_0x71cf('0x13')](function(){return _0x1a645c;});})[_0x71cf('0x51')](function(_0xd923d7){logger[_0x71cf('0x17')](_0x71cf('0x85'),_0xd923d7);throw _0xd923d7;});})[_0x71cf('0x13')](respondWithResult(_0x16ca97,0xc9))[_0x71cf('0x51')](handleError(_0x16ca97,null));};exports['bulkCreate']=function(_0x5bdfe5,_0x5cd88a){var _0x584d90=_0x5bdfe5[_0x71cf('0x5d')];var _0x5b80ed=[];if(_0x5bdfe5[_0x71cf('0x2a')][_0x71cf('0x31')]===_0x71cf('0x2c'))throw new Error(_0x71cf('0x7c'));if(_[_0x71cf('0x86')](_0x584d90,['role',_0x71cf('0x2a')])&&_0x5bdfe5[_0x71cf('0x2a')][_0x71cf('0x31')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x71cf('0x86')](_0x584d90,[_0x71cf('0x31'),_0x71cf('0x28')])&&_0x5bdfe5[_0x71cf('0x2a')][_0x71cf('0x31')]!==_0x71cf('0x28')){throw new Error(_0x71cf('0x87'));}return licenseUtil[_0x71cf('0x7f')](_0x584d90)[_0x71cf('0x13')](function(){return validateUser(_0x584d90[0x0]);})[_0x71cf('0x13')](function(){for(var _0x48be3a=0x1;_0x48be3a<_0x584d90[_0x71cf('0x4a')];_0x48be3a++){var _0x5d96a9=_0x584d90[_0x48be3a-0x1][_0x71cf('0x63')];if(!_0x584d90[_0x48be3a]['internal'])_0x584d90[_0x48be3a][_0x71cf('0x63')]=_0x5d96a9+0x1;_0x5b80ed[_0x71cf('0x45')](validateUser(_0x584d90[_0x48be3a]));}return Promise[_0x71cf('0x50')](_0x5b80ed);})[_0x71cf('0x13')](function(){_0x5b80ed=[];for(var _0x459896=0x0;_0x459896<_0x584d90[_0x71cf('0x4a')];_0x459896++){_0x5b80ed[_0x71cf('0x45')](updateUser(_0x584d90[_0x459896]));}return Promise[_0x71cf('0x50')](_0x5b80ed);})[_0x71cf('0x13')](function(){_0x5b80ed=_0x584d90['map'](function(_0x47279a){return db['User']['create'](_0x47279a,{'include':[{'model':db['VoiceMail'],'as':_0x71cf('0x81')}]})['then'](function(_0x1f3f4d){_0x47279a['id']=_0x1f3f4d['id'];return _0x47279a;});});return Promise[_0x71cf('0x50')](_0x5b80ed);})[_0x71cf('0x13')](function(_0x3c8255){if(_0x5bdfe5[_0x71cf('0x5d')]['role']===_0x71cf('0x2a'))return _0x3c8255;if(_0x5bdfe5['user'][_0x71cf('0x31')]!==_0x71cf('0x2a'))return _0x3c8255;var _0x38e9cb=_[_0x71cf('0x86')](_0x3c8255,function(_0x2dc2bc){return _0x2dc2bc[_0x71cf('0x31')]===_0x71cf('0x2c')||_0x2dc2bc[_0x71cf('0x31')]===_0x71cf('0x2e');});if(!_0x38e9cb)return _0x3c8255;return db[_0x71cf('0x82')][_0x71cf('0x46')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x5bdfe5['user'][_0x71cf('0x83')]},'raw':!![]})['then'](function(_0xf4b3e4){if(_[_0x71cf('0x88')](_0xf4b3e4)||!_['some'](_0xf4b3e4,[_0x71cf('0x89'),0x0]))return _0x3c8255;_0x5b80ed=[];var _0x297dd6=_(_0xf4b3e4)[_0x71cf('0x2f')](function(_0x5d94ac){if(_0x5d94ac[_0x71cf('0x89')]===0x1)return;return _0x5d94ac[_0x71cf('0x33')]==='Agents'?_0x71cf('0x2c'):_0x71cf('0x2e');})[_0x71cf('0x8a')]()[_0x71cf('0x30')]();for(var _0x16e5e2=0x0;_0x16e5e2<_0x3c8255[_0x71cf('0x4a')];_0x16e5e2++){if(!_['includes'](_0x297dd6,_0x3c8255[_0x16e5e2][_0x71cf('0x31')]))return;var _0x14b66a=_0x3c8255[_0x16e5e2][_0x71cf('0x31')]===_0x71cf('0x2c')?'Agents':_0x71cf('0x2d');_0x5b80ed['push'](db['UserProfileResource'][_0x71cf('0x7b')]({'name':_0x3c8255[_0x16e5e2][_0x71cf('0x33')],'resourceId':_0x3c8255[_0x16e5e2]['id'],'type':_0x14b66a,'sectionId':_[_0x71cf('0x32')](_0xf4b3e4,['name',_0x14b66a])['id']},{}));}return Promise[_0x71cf('0x50')](_0x5b80ed);});})[_0x71cf('0x13')](respondWithResult(_0x5cd88a,0xc9))[_0x71cf('0x51')](handleError(_0x5cd88a,null));};exports[_0x71cf('0x8b')]=function(_0x28693d,_0x2f6634){if(_0x28693d['body']['id']){delete _0x28693d['body']['id'];}return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x28693d[_0x71cf('0x5e')]['id']}})['then'](function(_0x33142a){if(!_0x33142a)return null;if(_0x33142a['id']===_0x28693d['user']['id']){if(!_0x28693d[_0x71cf('0x5d')]['oldPassword']||!_0x28693d[_0x71cf('0x5d')][_0x71cf('0x8c')]){throw new db['Sequelize'][(_0x71cf('0x8d'))](_0x71cf('0x8e'));}if(!_0x33142a[_0x71cf('0x8f')](_0x28693d[_0x71cf('0x5d')][_0x71cf('0x90')])){throw new db['Sequelize'][(_0x71cf('0x8d'))](_0x71cf('0x91'));}if(_0x28693d['body']['oldPassword']===_0x28693d['body'][_0x71cf('0x8c')]){throw new db[(_0x71cf('0x92'))][(_0x71cf('0x8d'))](_0x71cf('0x93'));}}else if(_0x28693d[_0x71cf('0x2a')]['role']===_0x71cf('0x28')){if(!_0x28693d[_0x71cf('0x5d')]['newPassword']){throw new db['Sequelize'][(_0x71cf('0x8d'))](_0x71cf('0x94'));}}else if(_0x28693d[_0x71cf('0x2a')][_0x71cf('0x31')]===_0x71cf('0x2a')){if(!_0x28693d['body'][_0x71cf('0x8c')]){throw new db[(_0x71cf('0x92'))][(_0x71cf('0x8d'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x33142a[_0x71cf('0x31')]!==_0x71cf('0x2c')){throw new db['Sequelize'][(_0x71cf('0x8d'))](_0x71cf('0x7c'));}}else{throw new db[(_0x71cf('0x92'))]['ValidationError'](_0x71cf('0x7c'));}return _0x33142a;})['then'](handleEntityNotFound(_0x2f6634,null))[_0x71cf('0x13')](function(_0x3bd114){return db['Setting'][_0x71cf('0x95')]({'attributes':['id',_0x71cf('0x66'),_0x71cf('0x96'),_0x71cf('0x97')]})[_0x71cf('0x13')](function(_0x3c66fd){if(_0x3c66fd['securePassword'])authService[_0x71cf('0x98')](_0x28693d['body'][_0x71cf('0x8c')]);if(!_0x3c66fd[_0x71cf('0x96')]||!_0x3bd114[_0x71cf('0x99')])return _0x3bd114;authService[_0x71cf('0x9a')](_0x28693d['body'][_0x71cf('0x8c')],_0x3bd114['previousPasswords'],_0x3c66fd['passwordHistoryLimit']);return _0x3bd114;})[_0x71cf('0x13')](saveUpdates({'password':_0x28693d['body'][_0x71cf('0x8c')],'passwordResetAt':_0x28693d[_0x71cf('0x2a')]['id']==_0x28693d[_0x71cf('0x5e')]['id']?moment():null,'previousPasswords':authService[_0x71cf('0x9b')](_0x28693d['body']['newPassword'],_0x3bd114[_0x71cf('0x99')])},null));})[_0x71cf('0x13')](respondWithResult(_0x2f6634,null))[_0x71cf('0x51')](handleError(_0x2f6634,null));};exports[_0x71cf('0x9c')]=function(_0x2c6b21,_0x5a9887){var _0x4f15aa=_0x2c6b21[_0x71cf('0x5d')][_0x71cf('0x9d')];return db['User'][_0x71cf('0x32')]({'where':{'id':_0x2c6b21[_0x71cf('0x5e')]['id']},'attributes':['id','name',_0x71cf('0x31'),'online','loginInPause',_0x71cf('0x9e'),_0x71cf('0x9f')]})[_0x71cf('0x13')](handleEntityNotFound(_0x5a9887,null))['then'](function(_0x3f5306){if(_0x3f5306){if(!utils[_0x71cf('0xa0')](_0x4f15aa)){throw new db[(_0x71cf('0x92'))][(_0x71cf('0x8d'))]('Unknown\x20channel');}return _0x3f5306['add'+_[_0x71cf('0xa1')](_0x4f15aa['toLowerCase']())+_0x71cf('0xa2')](_0x2c6b21['body'][_0x71cf('0x62')],{'penalty':_0x2c6b21[_0x71cf('0x5d')]['penalty']||0x0})[_0x71cf('0xa3')](function(_0x391643){for(var _0x1d05ae=0x0;_0x1d05ae<_0x2c6b21[_0x71cf('0x5d')]['ids'][_0x71cf('0x4a')];_0x1d05ae+=0x1){var _0x510951={'UserId':Number(_0x2c6b21[_0x71cf('0x5e')]['id'])};_0x510951[_[_0x71cf('0xa1')](_0x4f15aa[_0x71cf('0xa4')]())+_0x71cf('0xa5')]=Number(_0x2c6b21[_0x71cf('0x5d')][_0x71cf('0x62')][_0x1d05ae]);socket[_0x71cf('0x25')](_0x71cf('0x2a')+_[_0x71cf('0xa1')](_0x4f15aa[_0x71cf('0xa4')]())+'Queue:save',_0x510951);}return _0x391643;})[_0x71cf('0x13')](function(){if(_0x4f15aa===_0x71cf('0xa6')){return db[_0x71cf('0xa7')][_0x71cf('0x46')]({'where':{'id':_0x2c6b21[_0x71cf('0x5d')][_0x71cf('0x62')]||[]},'raw':!![],'attributes':['id',_0x71cf('0x33')]});}})[_0x71cf('0x13')](function(_0x34bd0a){var _0x54752d=_0x3f5306[_0x71cf('0x27')]({'plain':!![]});var _0x50bd34=[];if(_0x4f15aa==='voice'&&_0x54752d['role']===_0x71cf('0x2c')&&_0x54752d[_0x71cf('0xa8')]){for(let _0xe730cc=0x0;_0xe730cc<_0x34bd0a[_0x71cf('0x4a')];_0xe730cc+=0x1){_0x50bd34[_0x71cf('0x45')]({'membername':_0x54752d[_0x71cf('0x33')],'UserId':_0x54752d['id'],'queue_name':_0x34bd0a[_0xe730cc]['name'],'VoiceQueueId':_0x34bd0a[_0xe730cc]['id'],'interface':_['isNil'](_0x54752d['interface'])?util[_0x71cf('0xa9')](_0x71cf('0xaa'),_0x54752d[_0x71cf('0x33')]):_0x54752d['interface'],'paused':_0x54752d['voicePause']||![],'penalty':_0x2c6b21['body']['penalty']||0x0});}return Promise[_0x71cf('0x50')](_0x50bd34[_0x71cf('0x2f')](function(_0x13d2b5){return db[_0x71cf('0xab')][_0x71cf('0xac')](_0x13d2b5);}));}return _0x3f5306;});}})[_0x71cf('0x13')](respondWithStatusCode(_0x5a9887,null))['catch'](handleError(_0x5a9887,null));};exports['removeQueues']=function(_0x5e2bd4,_0xa3e176){var _0x403ab1,_0x5206e4;return db[_0x71cf('0x38')]['find']({'where':{'id':_0x5e2bd4[_0x71cf('0x5e')]['id']},'attributes':['id',_0x71cf('0x33'),_0x71cf('0x31')]})[_0x71cf('0x13')](handleEntityNotFound(_0xa3e176,null))[_0x71cf('0x13')](function(_0xb05677){if(_0xb05677){_0x403ab1=_0xb05677;if(!_0x5e2bd4[_0x71cf('0x47')]['channel']||!utils[_0x71cf('0xa0')](_0x5e2bd4['query'][_0x71cf('0x9d')])){throw new db['Sequelize'][(_0x71cf('0x8d'))](_0x71cf('0xad'));}return _0xb05677[_0x71cf('0xae')+_[_0x71cf('0xa1')](_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x9d')][_0x71cf('0xa4')]())+'Queues'](_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x62')]);}})[_0x71cf('0x13')](function(_0x3326be){if(_['isArray'](_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x62')])){for(var _0x36c48f=0x0;_0x36c48f<_0x5e2bd4['query'][_0x71cf('0x62')][_0x71cf('0x4a')];_0x36c48f+=0x1){_0x5206e4={'UserId':Number(_0x5e2bd4[_0x71cf('0x5e')]['id'])};_0x5206e4[_['capitalize'](_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x9d')][_0x71cf('0xa4')]())+_0x71cf('0xa5')]=Number(_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x62')][_0x36c48f]);socket[_0x71cf('0x25')](_0x71cf('0x2a')+_[_0x71cf('0xa1')](_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x9d')][_0x71cf('0xa4')]())+_0x71cf('0xaf'),_0x5206e4);}}else{_0x5206e4={'UserId':Number(_0x5e2bd4[_0x71cf('0x5e')]['id'])};_0x5206e4[_[_0x71cf('0xa1')](_0x5e2bd4['query']['channel']['toLowerCase']())+_0x71cf('0xa5')]=Number(_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x62')]);socket['emit'](_0x71cf('0x2a')+_['capitalize'](_0x5e2bd4['query'][_0x71cf('0x9d')][_0x71cf('0xa4')]())+_0x71cf('0xaf'),_0x5206e4);}return _0x3326be;})['then'](function(){if(_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x9d')]==='voice'){return db['UserVoiceQueueRt'][_0x71cf('0x34')]({'where':{'UserId':_0x5e2bd4[_0x71cf('0x5e')]['id'],'VoiceQueueId':_0x5e2bd4[_0x71cf('0x47')][_0x71cf('0x62')]},'individualHooks':!![]})['then'](function(){return _0x403ab1;});}return _0x403ab1;})['then'](respondWithStatusCode(_0xa3e176,null))[_0x71cf('0x51')](handleError(_0xa3e176,null));};exports['addAvatar']=function(_0x49bafa,_0x379e4c){_0x49bafa[_0x71cf('0x5d')][_0x71cf('0xb0')]=_0x49bafa[_0x71cf('0xb1')][_0x71cf('0xb2')];return db['User'][_0x71cf('0x32')]({'where':{'id':_0x49bafa[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x379e4c,null))[_0x71cf('0x13')](saveUpdates(_0x49bafa[_0x71cf('0x5d')],null))[_0x71cf('0x13')](respondWithResult(_0x379e4c,null))[_0x71cf('0x51')](handleError(_0x379e4c,null));};exports[_0x71cf('0xb3')]=function(_0x50b083,_0x218baf){var _0x9c713=path[_0x71cf('0xb4')](config[_0x71cf('0xb5')],'server/files/images/logos/default_profile.png');return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x50b083['params']['id']},'attributes':['id',_0x71cf('0xb0')],'raw':!![]})[_0x71cf('0x13')](handleEntityNotFound(_0x218baf,null))[_0x71cf('0x13')](function(_0x2256ca){if(_0x2256ca){if(_[_0x71cf('0x67')](_0x2256ca['userpic'])){return _0x218baf[_0x71cf('0xb6')](_0x9c713);}else{if(!fs[_0x71cf('0xb7')](path[_0x71cf('0xb4')](config[_0x71cf('0xb5')],'server/files/images/',_0x2256ca[_0x71cf('0xb0')]))){return _0x218baf[_0x71cf('0xb6')](_0x9c713);}return _0x218baf[_0x71cf('0xb6')](path[_0x71cf('0xb4')](config[_0x71cf('0xb5')],_0x71cf('0xb8'),_0x2256ca[_0x71cf('0xb0')]));}}})[_0x71cf('0x51')](handleError(_0x218baf,null));};exports[_0x71cf('0xb9')]=function(_0x40169f,_0x22aa27){return db['User'][_0x71cf('0x32')]({'where':{'id':_0x40169f[_0x71cf('0x5e')]['id']},'attributes':['id']})[_0x71cf('0x13')](handleEntityNotFound(_0x22aa27,null))['then'](function(_0x4f7cdb){var _0x316bb5=[];values=_0x4f7cdb['dataValues'];_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4b'),_0x4f7cdb['dataValues']));_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4d'),_0x4f7cdb[_0x71cf('0x4c')]));_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x5b'),_0x4f7cdb[_0x71cf('0x4c')]));_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4f'),_0x4f7cdb[_0x71cf('0x4c')]));_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x4e'),_0x4f7cdb[_0x71cf('0x4c')]));_0x316bb5[_0x71cf('0x45')](get_open_tabs(_0x71cf('0x5c'),_0x4f7cdb['dataValues']));return Promise[_0x71cf('0x50')](_0x316bb5);})[_0x71cf('0x13')](function(_0x5cddc3){if(_0x5cddc3){var _0x489328=_['map'](values[_0x71cf('0xba')],function(_0x537cb0){return{'channel':_0x71cf('0xbb'),'id':_0x537cb0['id'],'createdAt':_0x537cb0[_0x71cf('0xbc')]};});var _0x1d7da7=_[_0x71cf('0x2f')](values[_0x71cf('0xbd')],function(_0xd4422a){return{'channel':_0x71cf('0xbe'),'id':_0xd4422a['id'],'createdAt':_0xd4422a['createdAt']};});var _0x3c0a54=_['map'](values[_0x71cf('0xbf')],function(_0x347795){return{'channel':'OPENCHANNEL','id':_0x347795['id'],'createdAt':_0x347795['createdAt']};});var _0x3f53d1=_[_0x71cf('0x2f')](values['MailOpenTabs'],function(_0x269baa){return{'channel':_0x71cf('0xc0'),'id':_0x269baa['id'],'createdAt':_0x269baa['createdAt']};});var _0x25c30d=_['map'](values['SmsOpenTabs'],function(_0x2fd299){return{'channel':_0x71cf('0xc1'),'id':_0x2fd299['id'],'createdAt':_0x2fd299[_0x71cf('0xbc')]};});var _0x20062c=_[_0x71cf('0x2f')](values['WhatsappOpenTabs'],function(_0x36ac0a){return{'channel':'WHATSAPP','id':_0x36ac0a['id'],'createdAt':_0x36ac0a[_0x71cf('0xbc')]};});var _0x316f32=_['concat'](_0x489328,_0x1d7da7,_0x3c0a54,_0x3f53d1,_0x25c30d,_0x20062c);var _0x553ccd={'count':_0x316f32[_0x71cf('0x4a')],'rows':_0x316f32};return _0x553ccd;}else return null;})[_0x71cf('0x13')](respondWithResult(_0x22aa27,null))[_0x71cf('0x51')](handleError(_0x22aa27,null));};exports[_0x71cf('0xc2')]=function(_0x530d95,_0x103791){var _0x27aef1={};var _0x2e1524={};var _0x16a573;var _0x27eb6e;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x530d95['params']['id']}})['then'](handleEntityNotFound(_0x103791,null))[_0x71cf('0x13')](function(_0x3fda0f){if(_0x3fda0f){_0x16a573=_0x3fda0f;_0x2e1524[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xc3')][_0x71cf('0x55')]);_0x2e1524[_0x71cf('0x47')]=_['keys'](_0x530d95[_0x71cf('0x47')]);_0x2e1524[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x2e1524['model'],_0x2e1524['query']);_0x27aef1[_0x71cf('0x44')]=_[_0x71cf('0x56')](_0x2e1524[_0x71cf('0x53')],qs['fields'](_0x530d95['query'][_0x71cf('0x57')]));_0x27aef1['attributes']=_0x27aef1[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x27aef1[_0x71cf('0x44')]:_0x2e1524[_0x71cf('0x53')];_0x27aef1[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x530d95[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x27aef1['where']=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x530d95['query'],_0x2e1524[_0x71cf('0xc4')]));if(_0x530d95[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x27aef1[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x27aef1[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x27aef1[_0x71cf('0x44')],function(_0x4c12f5){var _0x472654={};_0x472654[_0x4c12f5]={'$like':'%'+_0x530d95[_0x71cf('0x47')]['filter']+'%'};return _0x472654;})});}_0x27aef1=_['merge']({},_0x27aef1,_0x530d95[_0x71cf('0xc9')]);return _0x16a573[_0x71cf('0xc2')](_0x27aef1);}})[_0x71cf('0x13')](function(_0x3ffa6b){if(_0x3ffa6b){_0x27eb6e=_0x3ffa6b[_0x71cf('0x4a')];if(_0x530d95[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0x58'))){_0x27aef1[_0x71cf('0x41')]=[{'model':db['CmList'],'as':_0x71cf('0xcb'),'required':![]},{'model':db['Tag'],'as':_0x71cf('0xcc'),'attributes':['id',_0x71cf('0x33'),_0x71cf('0xcd')],'where':_0x530d95[_0x71cf('0x47')]['tag']?{'id':_0x530d95['query']['tag']}:undefined,'required':_0x530d95[_0x71cf('0x47')][_0x71cf('0xce')]?!![]:![]}];}if(!_0x530d95[_0x71cf('0x47')]['hasOwnProperty'](_0x71cf('0xcf'))){_0x27aef1[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x530d95[_0x71cf('0x47')][_0x71cf('0x22')]);_0x27aef1[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x530d95['query']['offset']);}return _0x16a573[_0x71cf('0xc2')](_0x27aef1);}})['then'](function(_0xfd59d){if(_0xfd59d){return _0xfd59d?{'count':_0x27eb6e,'rows':_0xfd59d}:null;}})['then'](respondWithResult(_0x103791,null))[_0x71cf('0x51')](handleError(_0x103791,null));};exports[_0x71cf('0xd0')]=function(_0x2db5f1,_0x1a4fdc){var _0x2667e2;var _0x1026d9={};var _0x472272;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x2db5f1[_0x71cf('0x5e')]['id']},'attributes':['id',_0x71cf('0x33'),_0x71cf('0x31')]})['then'](handleEntityNotFound(_0x1a4fdc,null))[_0x71cf('0x13')](function(_0x208e3e){if(!utils[_0x71cf('0xa0')](_0x2db5f1[_0x71cf('0x47')][_0x71cf('0x9d')])){throw new db[(_0x71cf('0x92'))][(_0x71cf('0x8d'))](_0x71cf('0xad'));}_0x2667e2=_0x208e3e;var _0x5001c0={};_0x5001c0[_0x71cf('0x53')]=_['keys'](db[_[_0x71cf('0xa1')](_0x2db5f1['query']['channel'])+_0x71cf('0xd1')]['rawAttributes']);_0x5001c0[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x2db5f1[_0x71cf('0x47')]);_0x5001c0['filters']=_['intersection'](_0x5001c0['model'],_0x5001c0[_0x71cf('0x47')]);_0x1026d9['attributes']=_[_0x71cf('0x56')](_0x5001c0['model'],qs[_0x71cf('0x57')](_0x2db5f1['query'][_0x71cf('0x57')]));_0x1026d9['attributes']=_0x1026d9[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x1026d9[_0x71cf('0x44')]:_0x5001c0['model'];_0x1026d9[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x2db5f1['query'][_0x71cf('0xc6')]);_0x1026d9[_0x71cf('0x40')]=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x2db5f1[_0x71cf('0x47')],_0x5001c0['filters']));if(_0x2db5f1['query'][_0x71cf('0xc8')]){_0x1026d9[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x1026d9[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x1026d9['attributes'],function(_0x4c6185){var _0xa90829={};_0xa90829[_0x4c6185]={'$like':'%'+_0x2db5f1[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0xa90829;})});}_0x1026d9=_['merge']({},_0x1026d9,_0x2db5f1[_0x71cf('0xc9')]);switch(_0x2667e2[_0x71cf('0x31')]){case _0x71cf('0x28'):return db[_[_0x71cf('0xa1')](_0x2db5f1[_0x71cf('0x47')][_0x71cf('0x9d')])+_0x71cf('0xd1')][_0x71cf('0x46')](_0x1026d9);case'user':case'agent':return _0x2667e2[_0x71cf('0x27')+_[_0x71cf('0xa1')](_0x2db5f1[_0x71cf('0x47')][_0x71cf('0x9d')])+_0x71cf('0xa2')](_0x1026d9);default:throw new db[(_0x71cf('0x92'))]['ValidationError'](_0x71cf('0xd2'));}})[_0x71cf('0x13')](function(_0x57b4dd){_0x472272=_0x57b4dd[_0x71cf('0x4a')];if(!_0x2db5f1[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0xcf'))){_0x1026d9[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x2db5f1[_0x71cf('0x47')]['limit']);_0x1026d9[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x2db5f1['query'][_0x71cf('0x1f')]);}switch(_0x2667e2['role']){case _0x71cf('0x28'):return db[_['capitalize'](_0x2db5f1[_0x71cf('0x47')][_0x71cf('0x9d')])+'Queue'][_0x71cf('0x46')](_0x1026d9);case _0x71cf('0x2a'):case _0x71cf('0x2c'):return _0x2667e2[_0x71cf('0x27')+_[_0x71cf('0xa1')](_0x2db5f1[_0x71cf('0x47')][_0x71cf('0x9d')])+'Queues'](_0x1026d9);}})['then'](function(_0x2c90f4){return{'count':_0x472272,'rows':_0x2c90f4};})[_0x71cf('0x13')](respondWithResult(_0x1a4fdc,null))[_0x71cf('0x51')](handleError(_0x1a4fdc,null));};exports[_0x71cf('0xd3')]=function(_0x1f5680,_0x2df8a5){var _0x4cceef={};var _0x6b92b9={};var _0x1c7d85;var _0x2f9f2c;return db['User'][_0x71cf('0x95')]({'where':{'id':_0x1f5680['params']['id']}})['then'](handleEntityNotFound(_0x2df8a5,null))['then'](function(_0x55867e){if(_0x55867e){_0x1c7d85=_0x55867e;_0x6b92b9[_0x71cf('0x53')]=_['keys'](db['UserVoiceQueueRt'][_0x71cf('0x55')]);_0x6b92b9[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x1f5680['query']);_0x6b92b9['filters']=_[_0x71cf('0x56')](_0x6b92b9[_0x71cf('0x53')],_0x6b92b9[_0x71cf('0x47')]);_0x4cceef[_0x71cf('0x44')]=_['intersection'](_0x6b92b9['model'],qs[_0x71cf('0x57')](_0x1f5680[_0x71cf('0x47')][_0x71cf('0x57')]));_0x4cceef[_0x71cf('0x44')]=_0x4cceef['attributes'][_0x71cf('0x4a')]?_0x4cceef[_0x71cf('0x44')]:_0x6b92b9[_0x71cf('0x53')];_0x4cceef['order']=qs['sort'](_0x1f5680[_0x71cf('0x47')]['sort']);_0x4cceef[_0x71cf('0x40')]=qs[_0x71cf('0xc4')](_['pick'](_0x1f5680[_0x71cf('0x47')],_0x6b92b9[_0x71cf('0xc4')]));if(_0x1f5680['query'][_0x71cf('0xc8')]){_0x4cceef[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x4cceef['where'],{'$or':_[_0x71cf('0x2f')](_0x4cceef['attributes'],function(_0x2c9b41){var _0x3f0478={};_0x3f0478[_0x2c9b41]={'$like':'%'+_0x1f5680[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x3f0478;})});}_0x4cceef=_[_0x71cf('0x59')]({},_0x4cceef,_0x1f5680[_0x71cf('0xc9')]);return _0x1c7d85[_0x71cf('0xd3')](_0x4cceef);}})[_0x71cf('0x13')](function(_0x325eac){if(_0x325eac){_0x2f9f2c=_0x325eac['length'];if(!_0x1f5680[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0xcf'))){_0x4cceef[_0x71cf('0x22')]=qs['limit'](_0x1f5680[_0x71cf('0x47')][_0x71cf('0x22')]);_0x4cceef[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x1f5680[_0x71cf('0x47')][_0x71cf('0x1f')]);}return _0x1c7d85['getVoiceQueuesRt'](_0x4cceef);}})[_0x71cf('0x13')](function(_0xc08003){if(_0xc08003){return _0xc08003?{'count':_0x2f9f2c,'rows':_0xc08003}:null;}})[_0x71cf('0x13')](respondWithResult(_0x2df8a5,null))['catch'](handleError(_0x2df8a5,null));};exports[_0x71cf('0xd4')]=function(_0x5cbfb,_0x25f56f){var _0x2e349b={};var _0x1e2d4c={};var _0x1d6a25;var _0x5d45b5;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x5cbfb[_0x71cf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x25f56f,null))['then'](function(_0x24cae5){if(_0x24cae5){_0x1d6a25=_0x24cae5;_0x1e2d4c['model']=_[_0x71cf('0x54')](db[_0x71cf('0xd5')]['rawAttributes']);_0x1e2d4c[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x5cbfb['query']);_0x1e2d4c[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x1e2d4c[_0x71cf('0x53')],_0x1e2d4c[_0x71cf('0x47')]);_0x2e349b[_0x71cf('0x44')]=_['intersection'](_0x1e2d4c[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x5cbfb[_0x71cf('0x47')]['fields']));_0x2e349b['attributes']=_0x2e349b[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x2e349b['attributes']:_0x1e2d4c[_0x71cf('0x53')];_0x2e349b[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x5cbfb[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x2e349b['where']=qs[_0x71cf('0xc4')](_['pick'](_0x5cbfb[_0x71cf('0x47')],_0x1e2d4c[_0x71cf('0xc4')]));if(_0x5cbfb[_0x71cf('0x47')]['filter']){_0x2e349b[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x2e349b[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x2e349b[_0x71cf('0x44')],function(_0x232f5d){var _0x28c8c8={};_0x28c8c8[_0x232f5d]={'$like':'%'+_0x5cbfb['query'][_0x71cf('0xc8')]+'%'};return _0x28c8c8;})});}_0x2e349b=_['merge']({},_0x2e349b,_0x5cbfb['options']);return _0x1d6a25['getGroups'](_0x2e349b);}})['then'](function(_0x299ae2){if(_0x299ae2){_0x5d45b5=_0x299ae2[_0x71cf('0x4a')];if(!_0x5cbfb[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0xcf'))){_0x2e349b[_0x71cf('0x22')]=qs['limit'](_0x5cbfb[_0x71cf('0x47')]['limit']);_0x2e349b[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x5cbfb['query']['offset']);}return _0x1d6a25[_0x71cf('0xd4')](_0x2e349b);}})[_0x71cf('0x13')](function(_0xbc8dac){if(_0xbc8dac){return _0xbc8dac?{'count':_0x5d45b5,'rows':_0xbc8dac}:null;}})['then'](respondWithResult(_0x25f56f,null))[_0x71cf('0x51')](handleError(_0x25f56f,null));};exports[_0x71cf('0xd6')]=function(_0x3b6b15,_0x5c300d){var _0x42324d={'raw':!![],'where':{}};var _0x4fd940={};var _0x9b6447={'count':0x0,'rows':[]};return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x3b6b15[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x5c300d,null))['then'](function(_0xc5cc75){if(_0xc5cc75){_0x4fd940[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xd7')][_0x71cf('0x55')]);_0x4fd940[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x3b6b15[_0x71cf('0x47')]);_0x4fd940[_0x71cf('0xc4')]=_['intersection'](_0x4fd940[_0x71cf('0x53')],_0x4fd940[_0x71cf('0x47')]);_0x42324d['attributes']=_[_0x71cf('0x56')](_0x4fd940['model'],qs[_0x71cf('0x57')](_0x3b6b15[_0x71cf('0x47')][_0x71cf('0x57')]));_0x42324d[_0x71cf('0x44')]=_0x42324d[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x42324d[_0x71cf('0x44')]:_0x4fd940[_0x71cf('0x53')];if(!_0x3b6b15[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0xcf'))){_0x42324d[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x3b6b15[_0x71cf('0x47')][_0x71cf('0x22')]);_0x42324d[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x3b6b15['query'][_0x71cf('0x1f')]);}_0x42324d[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x3b6b15[_0x71cf('0x47')]['sort']);_0x42324d[_0x71cf('0x40')]=qs[_0x71cf('0xc4')](_['pick'](_0x3b6b15[_0x71cf('0x47')],_0x4fd940[_0x71cf('0xc4')]));_0x42324d['where'][_0x71cf('0xd8')]=_0xc5cc75['id'];if(_0x3b6b15[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x42324d['where']=_[_0x71cf('0x59')](_0x42324d[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x42324d[_0x71cf('0x44')],function(_0x41976b){var _0x14d3f6={};_0x14d3f6[_0x41976b]={'$like':'%'+_0x3b6b15[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x14d3f6;})});}_0x42324d=_[_0x71cf('0x59')]({},_0x42324d,_0x3b6b15[_0x71cf('0xc9')]);return db[_0x71cf('0xd7')]['count']({'where':_0x42324d['where']})[_0x71cf('0x13')](function(_0x430034){_0x9b6447[_0x71cf('0x21')]=_0x430034;if(_0x3b6b15[_0x71cf('0x47')][_0x71cf('0x58')]){_0x42324d[_0x71cf('0x41')]=[{'all':!![]}];}return db[_0x71cf('0xd7')][_0x71cf('0x46')](_0x42324d);})[_0x71cf('0x13')](function(_0x429c54){_0x9b6447[_0x71cf('0x49')]=_0x429c54;return _0x9b6447;});}})[_0x71cf('0x13')](respondWithFilteredResult(_0x5c300d,_0x42324d))[_0x71cf('0x51')](handleError(_0x5c300d,null));};exports[_0x71cf('0xd9')]=function(_0x2603d5,_0x4470c5){var _0x48babd={'raw':!![],'where':{}};var _0x594297={};var _0xb5efe4={'count':0x0,'rows':[]};return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x2603d5[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x4470c5,null))[_0x71cf('0x13')](function(_0x1ad641){if(_0x1ad641){_0x594297[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xda')]['rawAttributes']);_0x594297[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x2603d5[_0x71cf('0x47')]);_0x594297[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x594297[_0x71cf('0x53')],_0x594297[_0x71cf('0x47')]);_0x48babd[_0x71cf('0x44')]=_['intersection'](_0x594297[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x2603d5['query']['fields']));_0x48babd['attributes']=_0x48babd['attributes']['length']?_0x48babd[_0x71cf('0x44')]:_0x594297[_0x71cf('0x53')];if(!_0x2603d5[_0x71cf('0x47')]['hasOwnProperty']('nolimit')){_0x48babd[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x2603d5[_0x71cf('0x47')]['limit']);_0x48babd[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x2603d5[_0x71cf('0x47')][_0x71cf('0x1f')]);}_0x48babd[_0x71cf('0xc5')]=qs['sort'](_0x2603d5[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x48babd['where']=qs[_0x71cf('0xc4')](_['pick'](_0x2603d5['query'],_0x594297[_0x71cf('0xc4')]));_0x48babd[_0x71cf('0x40')][_0x71cf('0xd8')]=_0x1ad641['id'];if(_0x2603d5[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x48babd[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x48babd['where'],{'$or':_[_0x71cf('0x2f')](_0x48babd[_0x71cf('0x44')],function(_0x276890){var _0x1bb39e={};_0x1bb39e[_0x276890]={'$like':'%'+_0x2603d5[_0x71cf('0x47')]['filter']+'%'};return _0x1bb39e;})});}_0x48babd=_[_0x71cf('0x59')]({},_0x48babd,_0x2603d5[_0x71cf('0xc9')]);return db[_0x71cf('0xda')][_0x71cf('0x21')]({'where':_0x48babd[_0x71cf('0x40')]})[_0x71cf('0x13')](function(_0x37c0e6){_0xb5efe4[_0x71cf('0x21')]=_0x37c0e6;if(_0x2603d5[_0x71cf('0x47')][_0x71cf('0x58')]){_0x48babd[_0x71cf('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x71cf('0x46')](_0x48babd);})[_0x71cf('0x13')](function(_0x5f03a7){_0xb5efe4[_0x71cf('0x49')]=_0x5f03a7;return _0xb5efe4;});}})[_0x71cf('0x13')](respondWithFilteredResult(_0x4470c5,_0x48babd))[_0x71cf('0x51')](handleError(_0x4470c5,null));};exports[_0x71cf('0xdb')]=function(_0x162cb3,_0x38165b){var _0xff5b2c={};var _0xff32c4={};var _0x37a802;var _0x3937da;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x162cb3[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x38165b,null))['then'](function(_0x15981b){if(_0x15981b){_0x37a802=_0x15981b;_0xff32c4[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xdc')][_0x71cf('0x55')]);_0xff32c4[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x162cb3['query']);_0xff32c4[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0xff32c4[_0x71cf('0x53')],_0xff32c4[_0x71cf('0x47')]);_0xff5b2c['attributes']=_['intersection'](_0xff32c4[_0x71cf('0x53')],qs['fields'](_0x162cb3[_0x71cf('0x47')][_0x71cf('0x57')]));_0xff5b2c[_0x71cf('0x44')]=_0xff5b2c['attributes'][_0x71cf('0x4a')]?_0xff5b2c['attributes']:_0xff32c4['model'];_0xff5b2c['order']=qs[_0x71cf('0xc6')](_0x162cb3[_0x71cf('0x47')][_0x71cf('0xc6')]);_0xff5b2c[_0x71cf('0x40')]=qs['filters'](_[_0x71cf('0xc7')](_0x162cb3[_0x71cf('0x47')],_0xff32c4[_0x71cf('0xc4')]));if(_0x162cb3[_0x71cf('0x47')][_0x71cf('0xc8')]){_0xff5b2c[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0xff5b2c[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0xff5b2c[_0x71cf('0x44')],function(_0x4c0fd3){var _0x59071d={};_0x59071d[_0x4c0fd3]={'$like':'%'+_0x162cb3[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x59071d;})});}_0xff5b2c=_[_0x71cf('0x59')]({},_0xff5b2c,_0x162cb3[_0x71cf('0xc9')]);return _0x37a802[_0x71cf('0xdb')](_0xff5b2c);}})[_0x71cf('0x13')](function(_0x3484c2){if(_0x3484c2){_0x3937da=_0x3484c2[_0x71cf('0x4a')];if(!_0x162cb3['query'][_0x71cf('0xca')](_0x71cf('0xcf'))){_0xff5b2c[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x162cb3[_0x71cf('0x47')][_0x71cf('0x22')]);_0xff5b2c[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x162cb3['query'][_0x71cf('0x1f')]);}return _0x37a802[_0x71cf('0xdb')](_0xff5b2c);}})[_0x71cf('0x13')](function(_0xee8488){if(_0xee8488){return _0xee8488?{'count':_0x3937da,'rows':_0xee8488}:null;}})[_0x71cf('0x13')](respondWithResult(_0x38165b,null))[_0x71cf('0x51')](handleError(_0x38165b,null));};exports[_0x71cf('0xdd')]=function(_0x5ea9d0,_0x64b4cf){var _0x2f2050={};var _0x32e849={};var _0x27b4e3;var _0x3becd9;return db['User']['findOne']({'where':{'id':_0x5ea9d0[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x64b4cf,null))[_0x71cf('0x13')](function(_0x378c21){if(_0x378c21){_0x27b4e3=_0x378c21;_0x32e849[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xde')][_0x71cf('0x55')]);_0x32e849[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x5ea9d0[_0x71cf('0x47')]);_0x32e849[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x32e849[_0x71cf('0x53')],_0x32e849[_0x71cf('0x47')]);_0x2f2050['attributes']=_['intersection'](_0x32e849[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x5ea9d0[_0x71cf('0x47')]['fields']));_0x2f2050[_0x71cf('0x44')]=_0x2f2050[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x2f2050['attributes']:_0x32e849[_0x71cf('0x53')];_0x2f2050[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x2f2050['where']=qs[_0x71cf('0xc4')](_['pick'](_0x5ea9d0['query'],_0x32e849[_0x71cf('0xc4')]));if(_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x2f2050[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x2f2050['where'],{'$or':_[_0x71cf('0x2f')](_0x2f2050[_0x71cf('0x44')],function(_0x21d296){var _0x3e80de={};_0x3e80de[_0x21d296]={'$like':'%'+_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x3e80de;})});}_0x2f2050=_[_0x71cf('0x59')]({},_0x2f2050,_0x5ea9d0[_0x71cf('0xc9')]);return _0x27b4e3[_0x71cf('0xdd')](_0x2f2050);}})[_0x71cf('0x13')](function(_0x17e6c0){if(_0x17e6c0){_0x3becd9=_0x17e6c0['length'];if(!_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0xca')](_0x71cf('0xcf'))){_0x2f2050[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0x22')]);_0x2f2050[_0x71cf('0x1f')]=qs['offset'](_0x5ea9d0[_0x71cf('0x47')][_0x71cf('0x1f')]);}return _0x27b4e3[_0x71cf('0xdd')](_0x2f2050);}})[_0x71cf('0x13')](function(_0x50c835){if(_0x50c835){return _0x50c835?{'count':_0x3becd9,'rows':_0x50c835}:null;}})[_0x71cf('0x13')](respondWithResult(_0x64b4cf,null))['catch'](handleError(_0x64b4cf,null));};exports['getMailInteractions']=function(_0x2f5627,_0x17e887){var _0x386053={'raw':!![],'where':{}};var _0xda216c={};var _0x1cfed4={'count':0x0,'rows':[]};return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x2f5627[_0x71cf('0x5e')]['id']}})['then'](handleEntityNotFound(_0x17e887,null))[_0x71cf('0x13')](function(_0x1e8378){if(_0x1e8378){_0xda216c[_0x71cf('0x53')]=_['keys'](db['MailInteraction'][_0x71cf('0x55')]);_0xda216c['query']=_[_0x71cf('0x54')](_0x2f5627[_0x71cf('0x47')]);_0xda216c[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0xda216c['model'],_0xda216c[_0x71cf('0x47')]);_0x386053[_0x71cf('0x44')]=_[_0x71cf('0x56')](_0xda216c['model'],qs[_0x71cf('0x57')](_0x2f5627[_0x71cf('0x47')][_0x71cf('0x57')]));_0x386053['attributes']=_0x386053[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x386053[_0x71cf('0x44')]:_0xda216c[_0x71cf('0x53')];if(!_0x2f5627['query']['hasOwnProperty'](_0x71cf('0xcf'))){_0x386053['limit']=qs[_0x71cf('0x22')](_0x2f5627['query'][_0x71cf('0x22')]);_0x386053[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x2f5627[_0x71cf('0x47')][_0x71cf('0x1f')]);}_0x386053['order']=qs[_0x71cf('0xc6')](_0x2f5627[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x386053[_0x71cf('0x40')]=qs['filters'](_[_0x71cf('0xc7')](_0x2f5627[_0x71cf('0x47')],_0xda216c['filters']));_0x386053[_0x71cf('0x40')][_0x71cf('0xd8')]=_0x1e8378['id'];if(_0x2f5627['query'][_0x71cf('0xc8')]){_0x386053[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x386053[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x386053[_0x71cf('0x44')],function(_0x48eda3){var _0x1768b7={};_0x1768b7[_0x48eda3]={'$like':'%'+_0x2f5627['query'][_0x71cf('0xc8')]+'%'};return _0x1768b7;})});}_0x386053=_['merge']({},_0x386053,_0x2f5627[_0x71cf('0xc9')]);return db[_0x71cf('0xdf')][_0x71cf('0x21')]({'where':_0x386053[_0x71cf('0x40')]})[_0x71cf('0x13')](function(_0x2c7300){_0x1cfed4['count']=_0x2c7300;if(_0x2f5627[_0x71cf('0x47')]['includeAll']){_0x386053[_0x71cf('0x41')]=[{'all':!![]}];}return db[_0x71cf('0xdf')]['findAll'](_0x386053);})['then'](function(_0x30c34b){_0x1cfed4[_0x71cf('0x49')]=_0x30c34b;return _0x1cfed4;});}})['then'](respondWithFilteredResult(_0x17e887,_0x386053))[_0x71cf('0x51')](handleError(_0x17e887,null));};exports[_0x71cf('0xe0')]=function(_0x39402d,_0x1518be){var _0x46d73b={};var _0x3ded9f={};var _0x4265eb;var _0x55db56;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x39402d['params']['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x1518be,null))[_0x71cf('0x13')](function(_0x3c68c9){if(_0x3c68c9){_0x4265eb=_0x3c68c9;_0x3ded9f[_0x71cf('0x53')]=_[_0x71cf('0x54')](db[_0x71cf('0xe1')]['rawAttributes']);_0x3ded9f[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x39402d[_0x71cf('0x47')]);_0x3ded9f['filters']=_[_0x71cf('0x56')](_0x3ded9f[_0x71cf('0x53')],_0x3ded9f['query']);_0x46d73b[_0x71cf('0x44')]=_[_0x71cf('0x56')](_0x3ded9f['model'],qs['fields'](_0x39402d[_0x71cf('0x47')][_0x71cf('0x57')]));_0x46d73b[_0x71cf('0x44')]=_0x46d73b[_0x71cf('0x44')]['length']?_0x46d73b[_0x71cf('0x44')]:_0x3ded9f['model'];_0x46d73b[_0x71cf('0xc5')]=qs['sort'](_0x39402d[_0x71cf('0x47')]['sort']);_0x46d73b[_0x71cf('0x40')]=qs[_0x71cf('0xc4')](_['pick'](_0x39402d[_0x71cf('0x47')],_0x3ded9f['filters']));if(_0x39402d[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x46d73b['where']=_[_0x71cf('0x59')](_0x46d73b[_0x71cf('0x40')],{'$or':_['map'](_0x46d73b[_0x71cf('0x44')],function(_0x15372a){var _0x4f4631={};_0x4f4631[_0x15372a]={'$like':'%'+_0x39402d[_0x71cf('0x47')]['filter']+'%'};return _0x4f4631;})});}_0x46d73b=_[_0x71cf('0x59')]({},_0x46d73b,_0x39402d['options']);return _0x4265eb[_0x71cf('0xe0')](_0x46d73b);}})['then'](function(_0x5084d0){if(_0x5084d0){_0x55db56=_0x5084d0['length'];if(!_0x39402d['query']['hasOwnProperty'](_0x71cf('0xcf'))){_0x46d73b[_0x71cf('0x22')]=qs['limit'](_0x39402d[_0x71cf('0x47')][_0x71cf('0x22')]);_0x46d73b[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x39402d['query'][_0x71cf('0x1f')]);}return _0x4265eb[_0x71cf('0xe0')](_0x46d73b);}})[_0x71cf('0x13')](function(_0x1b08a2){if(_0x1b08a2){return _0x1b08a2?{'count':_0x55db56,'rows':_0x1b08a2}:null;}})['then'](respondWithResult(_0x1518be,null))[_0x71cf('0x51')](handleError(_0x1518be,null));};exports[_0x71cf('0xe2')]=function(_0x24eb4c,_0x11b10a){var _0x3f3e9e={};var _0x1ffc0c={};var _0x351ce4;var _0x3d8574;return db['User']['findOne']({'where':{'id':_0x24eb4c[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x11b10a,null))[_0x71cf('0x13')](function(_0x594e33){if(_0x594e33){_0x351ce4=_0x594e33;_0x1ffc0c[_0x71cf('0x53')]=_[_0x71cf('0x54')](db['FaxInteraction']['rawAttributes']);_0x1ffc0c[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x24eb4c[_0x71cf('0x47')]);_0x1ffc0c[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x1ffc0c[_0x71cf('0x53')],_0x1ffc0c['query']);_0x3f3e9e[_0x71cf('0x44')]=_['intersection'](_0x1ffc0c[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x24eb4c['query'][_0x71cf('0x57')]));_0x3f3e9e[_0x71cf('0x44')]=_0x3f3e9e[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x3f3e9e[_0x71cf('0x44')]:_0x1ffc0c[_0x71cf('0x53')];_0x3f3e9e[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x24eb4c[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x3f3e9e['where']=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x24eb4c[_0x71cf('0x47')],_0x1ffc0c['filters']));if(_0x24eb4c[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x3f3e9e[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x3f3e9e[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x3f3e9e[_0x71cf('0x44')],function(_0x67ef6f){var _0x120a8f={};_0x120a8f[_0x67ef6f]={'$like':'%'+_0x24eb4c[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x120a8f;})});}_0x3f3e9e=_[_0x71cf('0x59')]({},_0x3f3e9e,_0x24eb4c[_0x71cf('0xc9')]);return _0x351ce4[_0x71cf('0xe2')](_0x3f3e9e);}})['then'](function(_0x2265cf){if(_0x2265cf){_0x3d8574=_0x2265cf['length'];if(!_0x24eb4c[_0x71cf('0x47')]['hasOwnProperty'](_0x71cf('0xcf'))){_0x3f3e9e[_0x71cf('0x22')]=qs['limit'](_0x24eb4c[_0x71cf('0x47')][_0x71cf('0x22')]);_0x3f3e9e[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x24eb4c[_0x71cf('0x47')]['offset']);}return _0x351ce4['getFaxInteractions'](_0x3f3e9e);}})['then'](function(_0xb876f){if(_0xb876f){return _0xb876f?{'count':_0x3d8574,'rows':_0xb876f}:null;}})[_0x71cf('0x13')](respondWithResult(_0x11b10a,null))['catch'](handleError(_0x11b10a,null));};exports[_0x71cf('0xe3')]=function(_0x5a73ef,_0x31317f){var _0x125ae5={};var _0x219dec={};var _0x35f4ed;var _0x5259c6;return db[_0x71cf('0x38')]['findOne']({'where':{'id':_0x5a73ef['params']['id']}})['then'](handleEntityNotFound(_0x31317f,null))[_0x71cf('0x13')](function(_0x5a2111){if(_0x5a2111){_0x35f4ed=_0x5a2111;_0x219dec['model']=_[_0x71cf('0x54')](db['WhatsappInteraction'][_0x71cf('0x55')]);_0x219dec[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x5a73ef[_0x71cf('0x47')]);_0x219dec[_0x71cf('0xc4')]=_['intersection'](_0x219dec[_0x71cf('0x53')],_0x219dec['query']);_0x125ae5[_0x71cf('0x44')]=_['intersection'](_0x219dec[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x5a73ef[_0x71cf('0x47')]['fields']));_0x125ae5[_0x71cf('0x44')]=_0x125ae5[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x125ae5[_0x71cf('0x44')]:_0x219dec[_0x71cf('0x53')];_0x125ae5['order']=qs[_0x71cf('0xc6')](_0x5a73ef[_0x71cf('0x47')]['sort']);_0x125ae5['where']=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x5a73ef[_0x71cf('0x47')],_0x219dec[_0x71cf('0xc4')]));if(_0x5a73ef[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x125ae5[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x125ae5[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x125ae5[_0x71cf('0x44')],function(_0x334e91){var _0x5b4729={};_0x5b4729[_0x334e91]={'$like':'%'+_0x5a73ef[_0x71cf('0x47')]['filter']+'%'};return _0x5b4729;})});}_0x125ae5=_[_0x71cf('0x59')]({},_0x125ae5,_0x5a73ef[_0x71cf('0xc9')]);return _0x35f4ed['getWhatsappInteractions'](_0x125ae5);}})['then'](function(_0x367fd3){if(_0x367fd3){_0x5259c6=_0x367fd3[_0x71cf('0x4a')];if(!_0x5a73ef[_0x71cf('0x47')]['hasOwnProperty'](_0x71cf('0xcf'))){_0x125ae5[_0x71cf('0x22')]=qs['limit'](_0x5a73ef[_0x71cf('0x47')]['limit']);_0x125ae5[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x5a73ef[_0x71cf('0x47')][_0x71cf('0x1f')]);}return _0x35f4ed['getWhatsappInteractions'](_0x125ae5);}})['then'](function(_0x5780f8){if(_0x5780f8){return _0x5780f8?{'count':_0x5259c6,'rows':_0x5780f8}:null;}})[_0x71cf('0x13')](respondWithResult(_0x31317f,null))[_0x71cf('0x51')](handleError(_0x31317f,null));};exports[_0x71cf('0xe4')]=function(_0xbd5568,_0xd7d886,_0x40a29d){var _0x5d95ff;var _0x314340;var _0xcb2212;var _0x2cc088=!_[_0x71cf('0x67')](_0xbd5568[_0x71cf('0x5e')]['id'])?_0xbd5568['params']['id']:!_['isNil'](_0xbd5568[_0x71cf('0x2a')]['id'])?_0xbd5568[_0x71cf('0x2a')]['id']:null;return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x2cc088,'role':{'$or':[_0x71cf('0x28'),'user',_0x71cf('0x2c')]}},'attributes':['id',_0x71cf('0x33'),_0x71cf('0xe5'),_0x71cf('0xe6'),_0x71cf('0x31'),_0x71cf('0x63'),_0x71cf('0xe7')]})[_0x71cf('0x13')](function(_0x55c102){if(_0x55c102){if(_0x55c102[_0x71cf('0x31')]==='agent'){_0x5d95ff=_0x55c102;if(_0xbd5568[_0x71cf('0x5d')][_0x71cf('0x9f')]){_0xcb2212=util[_0x71cf('0xa9')]('LOCAL/%s@from-sip/n',_0x5d95ff[_0xbd5568[_0x71cf('0x5d')]['interface']]);}else if(_0xbd5568[_0x71cf('0x5d')][_0x71cf('0xe8')]){_0xcb2212=util[_0x71cf('0xa9')](_0x71cf('0xaa'),_0xbd5568[_0x71cf('0x5d')][_0x71cf('0xe8')]);}else{_0xcb2212=util['format'](_0x71cf('0xaa'),_0x5d95ff['name']);}socket['to'](util[_0x71cf('0xa9')](_0x71cf('0xe9'),_0x5d95ff[_0x71cf('0x33')]))[_0x71cf('0x25')](_0x71cf('0xea'),{'user':{'id':_0x5d95ff['id'],'name':_0x5d95ff['name']},'ip':_0xbd5568[_0x71cf('0xeb')][_0x71cf('0xec')]||_0xbd5568[_0x71cf('0xed')][_0x71cf('0xee')]||_0xbd5568['socket']['remoteAddress']||_0xbd5568['connection'][_0x71cf('0xef')][_0x71cf('0xee')]});return db[_0x71cf('0xab')][_0x71cf('0x34')]({'where':{'membername':_0x5d95ff[_0x71cf('0x33')]},'individualHooks':!![]});}}else{throw new db[(_0x71cf('0x92'))][(_0x71cf('0x8d'))](_0x71cf('0xf0'));}})[_0x71cf('0x13')](function(){if(_0x5d95ff){return _0x5d95ff[_0x71cf('0xf1')]({'raw':!![]});}})[_0x71cf('0x13')](function(_0x5eb5d3){if(_0x5d95ff){if(_0x5eb5d3){_0x314340=_0x5eb5d3;if(_0x314340[_0x71cf('0x4a')]){var _0x16d157=_0x314340['map'](function(_0x2f981c){var _0xcf238a={'membername':_0x5d95ff[_0x71cf('0x33')],'UserId':_0x5d95ff['id'],'queue_name':_0x2f981c['name'],'VoiceQueueId':_0x2f981c['id'],'interface':_0xcb2212,'paused':_0x5d95ff[_0x71cf('0xe7')]||![],'penalty':_0x2f981c[_0x71cf('0xf2')]||0x0};return db[_0x71cf('0xab')][_0x71cf('0xac')](_0xcf238a);});return Promise['all'](_0x16d157);}}}})[_0x71cf('0x13')](function(){if(_0x5d95ff){return db[_0x71cf('0xf3')][_0x71cf('0x46')]({'where':{'membername':_0x5d95ff[_0x71cf('0x33')],'exitAt':null}});}})[_0x71cf('0x13')](function(_0x32e51c){if(_0x5d95ff){var _0x6b42ec=[];_0x32e51c[_0x71cf('0xf4')](function(_0x3df4f5){_0x6b42ec['push'](_0x3df4f5[_0x71cf('0x24')]({'exitAt':moment()[_0x71cf('0xa9')](_0x71cf('0xf5'))}));});return Promise[_0x71cf('0x50')](_0x6b42ec);}})[_0x71cf('0x13')](function(){if(_0x5d95ff){var _0x886784=[];var _0x3200b6=[];var _0x5b3e5f=utils[_0x71cf('0xf6')]();var _0xc3db1a={'membername':_0x5d95ff[_0x71cf('0x33')],'interface':_0xcb2212,'enterAt':moment()[_0x71cf('0xa9')](_0x71cf('0xf5')),'role':_0x5d95ff[_0x71cf('0x31')],'internal':_0x5d95ff[_0x71cf('0x63')]};_0x5b3e5f['forEach'](function(_0x24d688){_0x886784[_0x71cf('0x45')](_[_0x71cf('0x59')]({'channel':_0x24d688,'type':_0x71cf('0xf7'),'data1':_0xbd5568[_0x71cf('0x5d')][_0x71cf('0xf8')],'data2':_0xcb2212},_0xc3db1a));if(_0x5d95ff['loginInPause']){_0x3200b6['push'](_[_0x71cf('0x59')]({'channel':_0x24d688,'type':_0x71cf('0xf9'),'data1':'LOGININPAUSE'},_0xc3db1a));}});return db['MemberReport'][_0x71cf('0xfa')](_0x886784[_0x71cf('0xfb')](_0x3200b6),{'individualHooks':!![]});}})[_0x71cf('0x13')](function(){if(_0x5d95ff){return _0x5d95ff[_0x71cf('0x24')]({'online':!![],'lastLoginAt':moment()[_0x71cf('0xa9')](_0x71cf('0xf5')),'voicePause':_0x5d95ff['loginInPause']||![],'mailPause':_0x5d95ff[_0x71cf('0xe7')]||![],'chatPause':_0x5d95ff[_0x71cf('0xe7')]||![],'faxPause':_0x5d95ff[_0x71cf('0xe7')]||![],'smsPause':_0x5d95ff[_0x71cf('0xe7')]||![],'openchannelPause':_0x5d95ff[_0x71cf('0xe7')]||![],'whatsappPause':_0x5d95ff[_0x71cf('0xe7')]||![],'pauseType':_0x5d95ff[_0x71cf('0xe7')]?'LOGININPAUSE':null,'interface':_0xcb2212,'lastPauseAt':moment()[_0x71cf('0xa9')](_0x71cf('0xf5'))});}})[_0x71cf('0x13')](function(_0x2ecdda){if(_0xbd5568[_0x71cf('0xfc')]){return _0x40a29d();}else{return Promise[_0x71cf('0xfd')](_0x2ecdda)[_0x71cf('0x13')](respondWithResult(_0xd7d886,null));}})[_0x71cf('0x51')](handleError(_0xd7d886,null));};exports[_0x71cf('0xfe')]=function(_0x3c8f12,_0x254210){var _0x9a8a7f;return db[_0x71cf('0x38')]['find']({'where':{'id':_0x3c8f12[_0x71cf('0x5e')]['id'],'role':_0x71cf('0x2c')},'attributes':['id','name',_0x71cf('0x31')]})[_0x71cf('0x13')](handleEntityNotFound(_0x254210,null))[_0x71cf('0x13')](function(_0x4a302d){if(_0x4a302d){_0x9a8a7f=_0x4a302d;return db[_0x71cf('0xab')][_0x71cf('0x34')]({'where':{'membername':_0x9a8a7f[_0x71cf('0x33')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x71cf('0x46')]({'where':{'membername':_0x9a8a7f[_0x71cf('0x33')],'exitAt':null}});})[_0x71cf('0x13')](function(_0x5e3094){var _0x44ee05=[];_0x5e3094[_0x71cf('0xf4')](function(_0x3f89dd){_0x44ee05['push'](_0x3f89dd[_0x71cf('0x24')]({'exitAt':moment()[_0x71cf('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x71cf('0x50')](_0x44ee05);})['then'](function(){return _0x9a8a7f['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x71cf('0x13')](respondWithResult(_0x254210,null))['catch'](handleError(_0x254210,null));};exports['pause']=function(_0x54d01e,_0x1033c2){var _0x1b42b9;return db[_0x71cf('0xab')]['update']({'paused':0x1},{'where':{'UserId':_0x54d01e[_0x71cf('0x5e')]['id']},'individualHooks':!![]})[_0x71cf('0x13')](function(){return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x54d01e[_0x71cf('0x5e')]['id'],'role':'agent'},'attributes':['id',_0x71cf('0x33'),_0x71cf('0x31'),'internal','interface',_0x71cf('0xa8')]});})['then'](handleEntityNotFound(_0x1033c2,null))[_0x71cf('0x13')](function(_0x53c1d2){if(_0x53c1d2){_0x1b42b9=_0x53c1d2;return respondWithRpcPromise(_0x71cf('0xff'),_0x71cf('0x100'),{'id':_0x1b42b9['id'],'name':_0x1b42b9['name'],'pause':!![]});}})[_0x71cf('0x13')](function(){if(_0x1b42b9){return db[_0x71cf('0xf3')][_0x71cf('0x46')]({'where':{'membername':_0x1b42b9[_0x71cf('0x33')],'type':_0x71cf('0xf9'),'exitAt':null}});}})['then'](function(_0x104de4){if(_0x104de4[_0x71cf('0x4a')]){var _0x223ee8=moment()[_0x71cf('0xa9')](_0x71cf('0xf5'));for(var _0x5e2ea9=0x0,_0xcdce6d=_0x104de4[_0x71cf('0x4a')];_0x5e2ea9<_0xcdce6d;_0x5e2ea9++){_0x104de4[_0x5e2ea9]['updateAttributes']({'exitAt':_0x223ee8});}}})['then'](function(){var _0x24ebb0=[];var _0x3cdb5c=utils[_0x71cf('0xf6')]();_0x3cdb5c[_0x71cf('0xf4')](function(_0x29c480){_0x24ebb0[_0x71cf('0x45')]({'channel':_0x29c480,'membername':_0x1b42b9[_0x71cf('0x33')],'interface':_['isNil'](_0x1b42b9['interface'])?util[_0x71cf('0xa9')](_0x71cf('0xaa'),_0x1b42b9[_0x71cf('0x33')]):_0x1b42b9['interface'],'type':_0x71cf('0xf9'),'enterAt':moment()['format'](_0x71cf('0xf5')),'data1':_0x54d01e[_0x71cf('0x5d')][_0x71cf('0x3a')]||_0x71cf('0x101'),'role':_0x1b42b9[_0x71cf('0x31')],'internal':_0x1b42b9[_0x71cf('0x63')]});});return db[_0x71cf('0xf3')]['bulkCreate'](_0x24ebb0,{'individualHooks':!![]});})['then'](function(){return _0x1b42b9[_0x71cf('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x54d01e['body'][_0x71cf('0x3a')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x71cf('0xa9')](_0x71cf('0xf5'))});})[_0x71cf('0x13')](respondWithResult(_0x1033c2,null))['catch'](handleError(_0x1033c2,null));};exports[_0x71cf('0x102')]=function(_0x5295e4,_0x1026cc){if(_0x5295e4[_0x71cf('0x5d')]['channel']&&!utils[_0x71cf('0xa0')](_0x5295e4[_0x71cf('0x5d')][_0x71cf('0x9d')])){throw new APIBadRequestError(util[_0x71cf('0xa9')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5295e4[_0x71cf('0x5d')][_0x71cf('0x9d')]));}return db[_0x71cf('0x38')][_0x71cf('0x32')]({'where':{'id':_0x5295e4[_0x71cf('0x5e')]['id']},'attributes':['id',_0x71cf('0x33'),_0x71cf('0x31'),'internal',_0x71cf('0x9f'),_0x71cf('0xa8'),_0x71cf('0x9e'),_0x71cf('0x103'),_0x71cf('0x104'),_0x71cf('0x105'),_0x71cf('0x106'),_0x71cf('0x107'),_0x71cf('0x108'),_0x71cf('0x109'),'lastPauseAt']})[_0x71cf('0x13')](function(_0x1673db){if(!_0x1673db){throw new APINotFoundError(util[_0x71cf('0xa9')](_0x71cf('0x10a'),_0x5295e4[_0x71cf('0x5e')]['id']));}return _0x1673db[_0x71cf('0x102')](_0x5295e4[_0x71cf('0x5d')][_0x71cf('0x9d')]);})[_0x71cf('0x13')](respondWithResult(_0x1026cc,null))[_0x71cf('0x51')](APIHandleError(_0x1026cc));};exports[_0x71cf('0x10b')]=function(_0x4c3967,_0x976ca2){var _0x2f76a7={};var _0x138aa8={};var _0x53cc5b;var _0x2c0a34;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x4c3967['params']['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x976ca2,null))[_0x71cf('0x13')](function(_0x3b7e16){if(_0x3b7e16){_0x53cc5b=_0x3b7e16;_0x138aa8['model']=_[_0x71cf('0x54')](db['Team']['rawAttributes']);_0x138aa8['query']=_[_0x71cf('0x54')](_0x4c3967[_0x71cf('0x47')]);_0x138aa8[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x138aa8['model'],_0x138aa8[_0x71cf('0x47')]);_0x2f76a7[_0x71cf('0x44')]=_[_0x71cf('0x56')](_0x138aa8[_0x71cf('0x53')],qs['fields'](_0x4c3967[_0x71cf('0x47')]['fields']));_0x2f76a7[_0x71cf('0x44')]=_0x2f76a7['attributes'][_0x71cf('0x4a')]?_0x2f76a7[_0x71cf('0x44')]:_0x138aa8['model'];_0x2f76a7[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x4c3967[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x2f76a7['where']=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x4c3967[_0x71cf('0x47')],_0x138aa8[_0x71cf('0xc4')]));if(_0x4c3967[_0x71cf('0x47')][_0x71cf('0xc8')]){_0x2f76a7[_0x71cf('0x40')]=_[_0x71cf('0x59')](_0x2f76a7[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x2f76a7[_0x71cf('0x44')],function(_0xa3728a){var _0x4bbd55={};_0x4bbd55[_0xa3728a]={'$like':'%'+_0x4c3967[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x4bbd55;})});}_0x2f76a7=_[_0x71cf('0x59')]({},_0x2f76a7,_0x4c3967[_0x71cf('0xc9')]);return _0x53cc5b[_0x71cf('0x10b')](_0x2f76a7);}})[_0x71cf('0x13')](function(_0x400882){if(_0x400882){_0x2c0a34=_0x400882[_0x71cf('0x4a')];if(!_0x4c3967[_0x71cf('0x47')]['hasOwnProperty'](_0x71cf('0xcf'))){_0x2f76a7[_0x71cf('0x22')]=qs[_0x71cf('0x22')](_0x4c3967['query']['limit']);_0x2f76a7[_0x71cf('0x1f')]=qs['offset'](_0x4c3967['query'][_0x71cf('0x1f')]);}return _0x53cc5b['getTeams'](_0x2f76a7);}})[_0x71cf('0x13')](function(_0x317671){if(_0x317671){return _0x317671?{'count':_0x2c0a34,'rows':_0x317671}:null;}})[_0x71cf('0x13')](respondWithResult(_0x976ca2,null))[_0x71cf('0x51')](handleError(_0x976ca2,null));};exports[_0x71cf('0x10c')]=function(_0x4f190a,_0x57ee26){var _0x59f14b=_0x4f190a[_0x71cf('0x5e')]['id'];var _0x58ed95=_0x4f190a['body']?_0x4f190a[_0x71cf('0x5d')][_0x71cf('0x62')]:null;var _0x469a09=[];return Promise['resolve']()['then'](function(){if(!_0x58ed95)throw new APIBadRequestError(_0x71cf('0x10d'));})[_0x71cf('0x13')](function(){return db['User'][_0x71cf('0x95')]({'where':{'id':_0x59f14b}});})['then'](function(_0x4729ff){if(!_0x4729ff)throw new APINotFoundError(util[_0x71cf('0xa9')](_0x71cf('0x10a'),_0x4f190a[_0x71cf('0x5e')]['id']));return db[_0x71cf('0x69')][_0x71cf('0x10e')](function(_0x54556e){return _0x4729ff[_0x71cf('0x10c')](_0x58ed95,{'transaction':_0x54556e})[_0x71cf('0x13')](function(){return db['Team'][_0x71cf('0x46')]({'where':{'id':{'$in':_0x58ed95}}});})[_0x71cf('0x13')](function(_0x554ed8){var _0x5517b3=_[_0x71cf('0x2f')](_0x554ed8,function(_0x1fc7da){return _0x1fc7da[_0x71cf('0x10f')]();});return Promise[_0x71cf('0x50')](_0x5517b3);})[_0x71cf('0x13')](function(_0x3c09b5){_0x469a09=_[_0x71cf('0x110')](_0x3c09b5);var _0x30e34b=_[_0x71cf('0x2f')](_0x469a09,function(_0x3ec035){return _0x3ec035['addAgent'](_0x4729ff['id'],{'transaction':_0x54556e});});return Promise[_0x71cf('0x50')](_0x30e34b);})[_0x71cf('0x13')](function(){if(!_0x4729ff[_0x71cf('0xa8')])return;var _0x485fa5=_['filter'](_0x469a09,function(_0x301ba0){return _0x301ba0[_0x71cf('0x111')](_0x71cf('0x9d'))===_0x71cf('0x112');});var _0x555e63=_['map'](_0x485fa5,function(_0x6707f9){return db[_0x71cf('0xab')][_0x71cf('0xac')]({'membername':_0x4729ff[_0x71cf('0x33')],'UserId':_0x4729ff['id'],'queue_name':_0x6707f9[_0x71cf('0x33')],'VoiceQueueId':_0x6707f9['id'],'interface':_[_0x71cf('0x67')](_0x4729ff['interface'])?util[_0x71cf('0xa9')](_0x71cf('0xaa'),_0x4729ff[_0x71cf('0x33')]):_0x4729ff[_0x71cf('0x9f')],'paused':_0x4729ff[_0x71cf('0x9e')]||![],'penalty':_0x4729ff['penalty']},{'transaction':_0x54556e});});return Promise[_0x71cf('0x50')](_0x555e63);})[_0x71cf('0x13')](function(){return db[_0x71cf('0x113')][_0x71cf('0x46')]({'where':{'teamId':{'$in':_0x58ed95}}});})[_0x71cf('0x13')](function(_0x498fc8){var _0x4d7dee=_[_0x71cf('0x2f')](_0x498fc8,function(_0x19e2cf){return db[_0x71cf('0x114')][_0x71cf('0x7b')]({'UserId':_0x4729ff['id'],'VoicePrefixId':_0x19e2cf[_0x71cf('0x115')]},{'transaction':_0x54556e});});return Promise[_0x71cf('0x50')](_0x4d7dee);});});})['then'](function(){for(var _0x31a2a2=0x0;_0x31a2a2<_0x469a09[_0x71cf('0x4a')];_0x31a2a2++){var _0x76111d=_0x469a09[_0x31a2a2][_0x71cf('0x111')]('channel');var _0x43f324=_0x76111d+_0x71cf('0xa5');socket[_0x71cf('0x25')](_0x71cf('0x2a')+_0x76111d+_0x71cf('0x116'),{'UserId':_0x59f14b,['queueField']:_0x469a09[_0x31a2a2]['id']});}})[_0x71cf('0x13')](respondWithStatusCode(_0x57ee26,null))[_0x71cf('0x51')](APIHandleError(_0x57ee26));};exports[_0x71cf('0x117')]=function(_0x5973d5,_0x485de5){var _0x23f433=_0x5973d5[_0x71cf('0x5e')]['id'];var _0x40bd91=null;if(_0x5973d5[_0x71cf('0x47')][_0x71cf('0x62')]){_0x40bd91=_[_0x71cf('0x118')](_0x5973d5['query']['ids'])?_0x5973d5['query'][_0x71cf('0x62')]:[_0x5973d5['query'][_0x71cf('0x62')]];}var _0x269629=[];return Promise[_0x71cf('0xfd')]()[_0x71cf('0x13')](function(){if(!_0x40bd91)throw new APIBadRequestError(_0x71cf('0x119'));})[_0x71cf('0x13')](function(){return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x23f433}});})[_0x71cf('0x13')](function(_0x1bbf88){if(!_0x1bbf88)throw new APINotFoundError(util[_0x71cf('0xa9')](_0x71cf('0x10a'),_0x5973d5['params']['id']));return db['sequelize'][_0x71cf('0x10e')](function(_0x4e8076){return _0x1bbf88[_0x71cf('0x117')](_0x40bd91,{'transaction':_0x4e8076})['then'](function(){return db[_0x71cf('0x11a')][_0x71cf('0x46')]({'where':{'id':{'$in':_0x40bd91}}});})['then'](function(_0xbee5e8){var _0x833612=_[_0x71cf('0x2f')](_0xbee5e8,function(_0x5ee18c){return _0x5ee18c[_0x71cf('0x10f')]();});return Promise[_0x71cf('0x50')](_0x833612);})['then'](function(_0x184f40){_0x269629=_['flattenDeep'](_0x184f40);var _0x29e73c=_[_0x71cf('0x2f')](_0x269629,function(_0x5dbd65){return _0x5dbd65[_0x71cf('0x11b')](_0x1bbf88['id'],{'transaction':_0x4e8076});});return Promise['all'](_0x29e73c);})[_0x71cf('0x13')](function(){if(!_0x1bbf88['online'])return;var _0x2f2496=_[_0x71cf('0xc8')](_0x269629,function(_0x5546f9){return _0x5546f9[_0x71cf('0x111')](_0x71cf('0x9d'))==='Voice';});var _0xb90c01=_['map'](_0x2f2496,function(_0x3ada15){return db['UserVoiceQueueRt'][_0x71cf('0x34')]({'where':{'VoiceQueueId':_0x3ada15['id'],'UserId':_0x1bbf88['id']},'transaction':_0x4e8076});});return Promise[_0x71cf('0x50')](_0xb90c01);})['then'](function(){return db[_0x71cf('0x113')][_0x71cf('0x46')]({'where':{'teamId':{'$in':_0x40bd91}}});})['then'](function(_0x7931d7){var _0x4a45d5=_[_0x71cf('0x2f')](_0x7931d7,function(_0x298f19){return db[_0x71cf('0x114')][_0x71cf('0x34')]({'where':{'UserId':_0x1bbf88['id'],'VoicePrefixId':_0x298f19[_0x71cf('0x115')]}},{'transaction':_0x4e8076});});return Promise[_0x71cf('0x50')](_0x4a45d5);});});})[_0x71cf('0x13')](function(){for(var _0x39a756=0x0;_0x39a756<_0x269629[_0x71cf('0x4a')];_0x39a756++){var _0x5809c4=_0x269629[_0x39a756]['getDataValue'](_0x71cf('0x9d'));var _0xf605c1=_0x5809c4+_0x71cf('0xa5');socket[_0x71cf('0x25')](_0x71cf('0x2a')+_0x5809c4+'Queue:remove',{'UserId':_0x23f433,['queueField']:_0x269629[_0x39a756]['id']});}})['then'](respondWithStatusCode(_0x485de5,null))[_0x71cf('0x51')](APIHandleError(_0x485de5));};exports['getLists']=function(_0x370d13,_0x30ead1){var _0x4d68d3={};var _0xa27a4d={};var _0x29df25;var _0x12135f;return db['User']['findOne']({'where':{'id':_0x370d13['params']['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x30ead1,null))[_0x71cf('0x13')](function(_0x49d322){if(_0x49d322){_0x29df25=_0x49d322;_0xa27a4d[_0x71cf('0x53')]=_[_0x71cf('0x54')](db['CmList'][_0x71cf('0x55')]);_0xa27a4d['query']=_[_0x71cf('0x54')](_0x370d13['query']);_0xa27a4d[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0xa27a4d['model'],_0xa27a4d[_0x71cf('0x47')]);_0x4d68d3['attributes']=_['intersection'](_0xa27a4d['model'],qs[_0x71cf('0x57')](_0x370d13[_0x71cf('0x47')][_0x71cf('0x57')]));_0x4d68d3['attributes']=_0x4d68d3[_0x71cf('0x44')]['length']?_0x4d68d3[_0x71cf('0x44')]:_0xa27a4d['model'];_0x4d68d3[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x370d13[_0x71cf('0x47')][_0x71cf('0xc6')]);_0x4d68d3[_0x71cf('0x40')]=qs['filters'](_[_0x71cf('0xc7')](_0x370d13[_0x71cf('0x47')],_0xa27a4d['filters']));if(_0x370d13[_0x71cf('0x47')]['filter']){_0x4d68d3[_0x71cf('0x40')]=_['merge'](_0x4d68d3[_0x71cf('0x40')],{'$or':_[_0x71cf('0x2f')](_0x4d68d3[_0x71cf('0x44')],function(_0x628605){var _0x17d679={};_0x17d679[_0x628605]={'$like':'%'+_0x370d13[_0x71cf('0x47')]['filter']+'%'};return _0x17d679;})});}_0x4d68d3=_[_0x71cf('0x59')]({},_0x4d68d3,_0x370d13[_0x71cf('0xc9')]);return _0x29df25[_0x71cf('0x11c')](_0x4d68d3);}})['then'](function(_0x11b1fb){if(_0x11b1fb){_0x12135f=_0x11b1fb[_0x71cf('0x4a')];if(!_0x370d13[_0x71cf('0x47')]['hasOwnProperty'](_0x71cf('0xcf'))){_0x4d68d3[_0x71cf('0x22')]=qs['limit'](_0x370d13[_0x71cf('0x47')]['limit']);_0x4d68d3[_0x71cf('0x1f')]=qs[_0x71cf('0x1f')](_0x370d13[_0x71cf('0x47')]['offset']);}return _0x29df25[_0x71cf('0x11c')](_0x4d68d3);}})[_0x71cf('0x13')](function(_0x397486){if(_0x397486){return _0x397486?{'count':_0x12135f,'rows':_0x397486}:null;}})['then'](respondWithResult(_0x30ead1,null))['catch'](handleError(_0x30ead1,null));};exports[_0x71cf('0x11d')]=function(_0x28c8be,_0x10b6ff){var _0x534dc8={};var _0x4cb76a={};var _0x290c12;return db[_0x71cf('0x38')][_0x71cf('0x95')]({'where':{'id':_0x28c8be[_0x71cf('0x5e')]['id']}})[_0x71cf('0x13')](handleEntityNotFound(_0x10b6ff,null))['then'](function(_0x3d784f){if(_0x3d784f){_0x290c12=_0x3d784f;_0x4cb76a[_0x71cf('0x53')]=_['keys'](db[_0x71cf('0x38')][_0x71cf('0x55')]);_0x4cb76a[_0x71cf('0x47')]=_[_0x71cf('0x54')](_0x28c8be[_0x71cf('0x47')]);_0x4cb76a[_0x71cf('0xc4')]=_[_0x71cf('0x56')](_0x4cb76a[_0x71cf('0x53')],_0x4cb76a['query']);_0x534dc8['attributes']=_[_0x71cf('0x56')](_0x4cb76a[_0x71cf('0x53')],qs[_0x71cf('0x57')](_0x28c8be[_0x71cf('0x47')][_0x71cf('0x57')]));_0x534dc8[_0x71cf('0x44')]=_0x534dc8[_0x71cf('0x44')][_0x71cf('0x4a')]?_0x534dc8[_0x71cf('0x44')]:_0x4cb76a[_0x71cf('0x53')];_0x534dc8[_0x71cf('0xc5')]=qs[_0x71cf('0xc6')](_0x28c8be['query'][_0x71cf('0xc6')]);_0x534dc8[_0x71cf('0x40')]=qs[_0x71cf('0xc4')](_[_0x71cf('0xc7')](_0x28c8be[_0x71cf('0x47')],_0x4cb76a[_0x71cf('0xc4')]));if(_0x28c8be['query'][_0x71cf('0xc8')]){_0x534dc8['where']=_[_0x71cf('0x59')](_0x534dc8['where'],{'$or':_['map'](_0x534dc8[_0x71cf('0x44')],function(_0x56f96d){var _0x184b66={};_0x184b66[_0x56f96d]={'$like':'%'+_0x28c8be[_0x71cf('0x47')][_0x71cf('0xc8')]+'%'};return _0x184b66;})});}_0x534dc8[_0x71cf('0x53')]=db[_0x71cf('0x38')];_0x534dc8['as']=_0x71cf('0x2b');_0x534dc8=_[_0x71cf('0x59')]({},_0x534dc8,_0x28c8be[_0x71cf('0xc9')]);return _0x290c12[_0x71cf('0xf1')]({'include':[_0x534dc8]});}})[_0x71cf('0x13')](function(_0x2fcb9f){if(_0x2fcb9f){var _0x128fdf={},_0x5c99bb=[];for(var _0x1dc90e=0x0;_0x1dc90e<_0x2fcb9f['length'];_0x1dc90e+=0x1){for(var _0x263299=0x0,_0x312de8;_0x263299<_0x2fcb9f[_0x1dc90e][_0x71cf('0x2b')][_0x71cf('0x4a')];_0x263299+=0x1){_0x312de8=_0x2fcb9f[_0x1dc90e][_0x71cf('0x2b')][_0x263299][_0x71cf('0x27')]({'plain':!![]});_0x128fdf[_0x312de8['id']]=_0x312de8;}}_0x128fdf=_[_0x71cf('0x11e')](_0x128fdf);for(var _0x10830a=qs[_0x71cf('0x1f')](_0x28c8be[_0x71cf('0x47')][_0x71cf('0x1f')]);_0x10830a<_0x128fdf[_0x71cf('0x4a')]&&_0x5c99bb['length']=_0x277b36[_0x9f51('0x4f')]){throw new Error(_0x9f51('0x50'));}})[_0x9f51('0x17')](function(){if(_0x52bd11){return db[_0x9f51('0x25')][_0x9f51('0x51')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')]},'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x52')]({'raw':!![]});}})['then'](function(_0x4d7634){if(_0x52bd11){if(_0x4d7634){var _0x325e22=[];_0x577590=_0x4d7634;if(_0x577590[_0x9f51('0x29')]){for(var _0x4a68fa=0x0;_0x4a68fa<_0x577590[_0x9f51('0x29')];_0x4a68fa++){_0x325e22['push'](db[_0x9f51('0x25')]['upsert']({'membername':_0x52bd11[_0x9f51('0x22')],'UserId':_0x52bd11['id'],'queue_name':_0x577590[_0x4a68fa]['name'],'VoiceQueueId':_0x577590[_0x4a68fa]['id'],'interface':_0x457b37,'paused':_0x52bd11[_0x9f51('0x4a')]||![],'penalty':_0x577590[_0x4a68fa]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x9f51('0x46')](_0x325e22);}}}})['then'](function(){if(_0x52bd11){return db[_0x9f51('0x27')][_0x9f51('0xf')]({'where':{'membername':_0x52bd11[_0x9f51('0x22')],'exitAt':null}});}})[_0x9f51('0x17')](function(_0x5234c5){if(_0x52bd11){if(_0x5234c5&&_0x5234c5[_0x9f51('0x29')]){var _0x4b4886=[];_0x5234c5[_0x9f51('0x45')](function(_0x273e75){_0x4b4886[_0x9f51('0x2d')](_0x273e75[_0x9f51('0x26')]({'exitAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31'))}));});return BPromise[_0x9f51('0x46')](_0x4b4886);}}})[_0x9f51('0x17')](function(){if(_0x52bd11){var _0x57c1c8=[];var _0x27013e=[];var _0x532bbb=utils['getChannels']();var _0x528454={'membername':_0x52bd11[_0x9f51('0x22')],'interface':_0x457b37,'enterAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x52bd11[_0x9f51('0x23')],'internal':_0x52bd11[_0x9f51('0x24')]};_0x532bbb['forEach'](function(_0x257e7b){_0x57c1c8[_0x9f51('0x2d')](_[_0x9f51('0x53')]({'channel':_0x257e7b,'type':_0x9f51('0x54'),'data1':'callysquare','data2':_0x457b37},_0x528454));if(_0x52bd11[_0x9f51('0x4a')]){_0x27013e[_0x9f51('0x2d')](_['merge']({'channel':_0x257e7b,'type':'PAUSE','data1':_0x9f51('0x55')},_0x528454));}});return db[_0x9f51('0x27')][_0x9f51('0x56')](_0x57c1c8[_0x9f51('0x57')](_0x27013e),{'individualHooks':!![]});}})[_0x9f51('0x17')](function(){if(_0x52bd11){return _0x52bd11[_0x9f51('0x26')]({'online':!![],'lastLoginAt':moment()[_0x9f51('0x2a')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x52bd11[_0x9f51('0x4a')]||![],'mailPause':_0x52bd11[_0x9f51('0x4a')]||![],'chatPause':_0x52bd11[_0x9f51('0x4a')]||![],'faxPause':_0x52bd11[_0x9f51('0x4a')]||![],'smsPause':_0x52bd11[_0x9f51('0x4a')]||![],'openchannelPause':_0x52bd11[_0x9f51('0x4a')]||![],'pauseType':_0x52bd11[_0x9f51('0x4a')]?_0x9f51('0x55'):null,'lastPauseAt':moment()[_0x9f51('0x2a')](_0x9f51('0x31')),'interface':_0x457b37});}})[_0x9f51('0x17')](function(_0x3e8679){_0x3c170e(_0x3e8679);})[_0x9f51('0x1a')](function(_0x5cb256){_0x5ecda2(_0x59a9d0[_0x9f51('0x1b')](0x1f4,_0x5cb256[_0x9f51('0x1c')]));});});}; \ No newline at end of file +var _0x7a7d=['map','include','model','then','debug','stringify','catch','error','message','ShowUser','find','info','PauseUser','name','UserVoiceQueueRt','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','SIP/%s','interface','body','type','DEFAULT\x20PAUSE','role','uniqueid','UnpauseUser','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','LogoutUser','destroy','LoginUser','mobile','internal','loginInPause','agent','../../config/license/util','Maximum\x20login\x20has\x20been\x20reached','UserVoiceQueue.penalty','all','merge','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','bluebird','ioredis','rpc','redis','localhost','./user.socket','GetUser','User','findAll','options','raw','where','attributes','limit'];(function(_0x1f13d6,_0x1be4af){var _0x5b94aa=function(_0x1e155e){while(--_0x1e155e){_0x1f13d6['push'](_0x1f13d6['shift']());}};_0x5b94aa(++_0x1be4af);}(_0x7a7d,0x95));var _0xd7a7=function(_0x477023,_0x427b5c){_0x477023=_0x477023-0x0;var _0x859892=_0x7a7d[_0x477023];return _0x859892;};'use strict';var _=require(_0xd7a7('0x0'));var util=require(_0xd7a7('0x1'));var moment=require(_0xd7a7('0x2'));var BPromise=require(_0xd7a7('0x3'));var Redis=require(_0xd7a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd7a7('0x5'));var config=require('../../config/environment');config[_0xd7a7('0x6')]=_['defaults'](config[_0xd7a7('0x6')],{'host':_0xd7a7('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd7a7('0x8'))['register'](socket);exports[_0xd7a7('0x9')]=function(_0x50248d){var _0x181235=this;return new Promise(function(_0x45afa,_0x27aa82){return db[_0xd7a7('0xa')][_0xd7a7('0xb')]({'raw':_0x50248d[_0xd7a7('0xc')]?_0x50248d['options'][_0xd7a7('0xd')]===undefined?!![]:![]:!![],'where':_0x50248d[_0xd7a7('0xc')]?_0x50248d[_0xd7a7('0xc')][_0xd7a7('0xe')]||null:null,'attributes':_0x50248d[_0xd7a7('0xc')]?_0x50248d[_0xd7a7('0xc')][_0xd7a7('0xf')]||null:null,'limit':_0x50248d['options']?_0x50248d[_0xd7a7('0xc')][_0xd7a7('0x10')]||null:null,'include':_0x50248d['options']?_0x50248d[_0xd7a7('0xc')]['include']?_[_0xd7a7('0x11')](_0x50248d['options'][_0xd7a7('0x12')],function(_0x4b6337){return{'model':db[_0x4b6337[_0xd7a7('0x13')]],'as':_0x4b6337['as'],'attributes':_0x4b6337['attributes'],'include':_0x4b6337[_0xd7a7('0x12')]?_[_0xd7a7('0x11')](_0x4b6337[_0xd7a7('0x12')],function(_0xc4bde0){return{'model':db[_0xc4bde0[_0xd7a7('0x13')]],'as':_0xc4bde0['as'],'attributes':_0xc4bde0[_0xd7a7('0xf')],'include':_0xc4bde0[_0xd7a7('0x12')]?_[_0xd7a7('0x11')](_0xc4bde0[_0xd7a7('0x12')],function(_0x5079bb){return{'model':db[_0x5079bb[_0xd7a7('0x13')]],'as':_0x5079bb['as'],'attributes':_0x5079bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7a7('0x14')](function(_0xe21935){logger['info'](_0xd7a7('0x9'),_0x50248d);logger[_0xd7a7('0x15')](_0xd7a7('0x9'),_0x50248d,JSON[_0xd7a7('0x16')](_0xe21935));_0x45afa(_0xe21935);})[_0xd7a7('0x17')](function(_0x5d7595){logger[_0xd7a7('0x18')](_0xd7a7('0x9'),_0x5d7595[_0xd7a7('0x19')],_0x50248d);_0x27aa82(_0x181235['error'](0x1f4,_0x5d7595['message']));});});};exports[_0xd7a7('0x1a')]=function(_0x225b3d){var _0x752fb=this;return new Promise(function(_0x4c4288,_0x4cf270){return db[_0xd7a7('0xa')][_0xd7a7('0x1b')]({'raw':_0x225b3d[_0xd7a7('0xc')]?_0x225b3d[_0xd7a7('0xc')][_0xd7a7('0xd')]===undefined?!![]:![]:!![],'where':_0x225b3d[_0xd7a7('0xc')]?_0x225b3d[_0xd7a7('0xc')][_0xd7a7('0xe')]||null:null,'attributes':_0x225b3d[_0xd7a7('0xc')]?_0x225b3d['options'][_0xd7a7('0xf')]||null:null,'include':_0x225b3d[_0xd7a7('0xc')]?_0x225b3d[_0xd7a7('0xc')]['include']?_[_0xd7a7('0x11')](_0x225b3d[_0xd7a7('0xc')]['include'],function(_0x1fd81b){return{'model':db[_0x1fd81b[_0xd7a7('0x13')]],'as':_0x1fd81b['as'],'attributes':_0x1fd81b['attributes'],'include':_0x1fd81b[_0xd7a7('0x12')]?_[_0xd7a7('0x11')](_0x1fd81b['include'],function(_0x4cabbb){return{'model':db[_0x4cabbb[_0xd7a7('0x13')]],'as':_0x4cabbb['as'],'attributes':_0x4cabbb[_0xd7a7('0xf')],'include':_0x4cabbb[_0xd7a7('0x12')]?_['map'](_0x4cabbb['include'],function(_0x8f5ae0){return{'model':db[_0x8f5ae0[_0xd7a7('0x13')]],'as':_0x8f5ae0['as'],'attributes':_0x8f5ae0[_0xd7a7('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x7eaed3){logger[_0xd7a7('0x1c')]('ShowUser',_0x225b3d);logger['debug'](_0xd7a7('0x1a'),_0x225b3d,JSON['stringify'](_0x7eaed3));_0x4c4288(_0x7eaed3);})[_0xd7a7('0x17')](function(_0x2a6db9){logger[_0xd7a7('0x18')]('ShowUser',_0x2a6db9[_0xd7a7('0x19')],_0x225b3d);_0x4cf270(_0x752fb[_0xd7a7('0x18')](0x1f4,_0x2a6db9['message']));});});};exports[_0xd7a7('0x1d')]=function(_0x1f602b){var _0x46aef9=this;return new Promise(function(_0x2cbe6f,_0x116472){var _0x27be33;return db[_0xd7a7('0xa')][_0xd7a7('0x1b')]({'where':_0x1f602b['options']['where']||{},'attributes':['id',_0xd7a7('0x1e'),'role','internal','interface']})['then'](function(_0x56fa67){if(_0x56fa67){_0x27be33=_0x56fa67;return db[_0xd7a7('0x1f')][_0xd7a7('0x20')]({'paused':0x1},{'where':{'UserId':_0x27be33['id']},'individualHooks':!![]});}})[_0xd7a7('0x14')](function(){if(_0x27be33){return db[_0xd7a7('0x21')][_0xd7a7('0xb')]({'where':{'membername':_0x27be33[_0xd7a7('0x1e')],'type':_0xd7a7('0x22'),'exitAt':null}});}})[_0xd7a7('0x14')](function(_0x4b1ffe){if(_0x27be33){if(_0x4b1ffe&&_0x4b1ffe[_0xd7a7('0x23')]){var _0x26c045=moment()[_0xd7a7('0x24')](_0xd7a7('0x25'));for(var _0x1fb671=0x0,_0x5c1eac=_0x4b1ffe[_0xd7a7('0x23')];_0x1fb671<_0x5c1eac;_0x1fb671++){_0x4b1ffe[_0x1fb671][_0xd7a7('0x26')]({'exitAt':_0x26c045});}}}})[_0xd7a7('0x14')](function(){if(_0x27be33){var _0xcdd636=[];var _0x11b588=utils[_0xd7a7('0x27')]();_0x11b588[_0xd7a7('0x28')](function(_0x148f8e){_0xcdd636[_0xd7a7('0x29')]({'channel':_0x148f8e,'membername':_0x27be33[_0xd7a7('0x1e')],'interface':_['isNil'](_0x27be33['interface'])?util[_0xd7a7('0x24')](_0xd7a7('0x2a'),_0x27be33['name']):_0x27be33[_0xd7a7('0x2b')],'type':_0xd7a7('0x22'),'enterAt':moment()['format'](_0xd7a7('0x25')),'data1':_0x1f602b[_0xd7a7('0x2c')][_0xd7a7('0x2d')]||_0xd7a7('0x2e'),'role':_0x27be33[_0xd7a7('0x2f')],'internal':_0x27be33['internal'],'uniqueid':_0x1f602b[_0xd7a7('0x2c')][_0xd7a7('0x30')]||null});});return db[_0xd7a7('0x21')]['bulkCreate'](_0xcdd636,{'individualHooks':!![]});}})[_0xd7a7('0x14')](function(){if(_0x27be33){return _0x27be33[_0xd7a7('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1f602b[_0xd7a7('0x2c')][_0xd7a7('0x2d')]||_0xd7a7('0x2e'),'lastPauseAt':moment()['format'](_0xd7a7('0x25'))});}})[_0xd7a7('0x14')](function(_0x2209ac){_0x2cbe6f(_0x2209ac);})[_0xd7a7('0x17')](function(_0x15f87c){_0x116472(_0x46aef9['error'](0x1f4,_0x15f87c['message']));});});};exports[_0xd7a7('0x31')]=function(_0x10d9b6){var _0x1b644e=this;return new Promise(function(_0x650b76,_0x552a4d){if(_0x10d9b6[_0xd7a7('0x2c')][_0xd7a7('0x32')]&&!utils[_0xd7a7('0x33')](_0x10d9b6['body'][_0xd7a7('0x32')])){throw new Error(util['format'](_0xd7a7('0x34'),_0x10d9b6['body'][_0xd7a7('0x32')]));}return db['User'][_0xd7a7('0x35')]({'where':_0x10d9b6[_0xd7a7('0xc')][_0xd7a7('0xe')]||{},'attributes':['id',_0xd7a7('0x1e'),_0xd7a7('0x2f'),'internal',_0xd7a7('0x2b'),_0xd7a7('0x36'),_0xd7a7('0x37'),_0xd7a7('0x38'),_0xd7a7('0x39'),_0xd7a7('0x3a'),_0xd7a7('0x3b'),'smsPause',_0xd7a7('0x3c'),_0xd7a7('0x3d'),_0xd7a7('0x3e')]})[_0xd7a7('0x14')](function(_0x3d0212){if(!_0x3d0212){throw new Error(util[_0xd7a7('0x24')](_0xd7a7('0x3f'),_0x10d9b6[_0xd7a7('0x40')]['id']));}return _0x3d0212[_0xd7a7('0x41')](_0x10d9b6['body'][_0xd7a7('0x32')],'system');})[_0xd7a7('0x14')](function(_0x2344b2){_0x650b76(_0x2344b2);})['catch'](function(_0x5a3868){_0x552a4d(_0x1b644e['error'](0x1f4,_0x5a3868[_0xd7a7('0x19')]));});});};exports[_0xd7a7('0x42')]=function(_0x5a47c1){var _0x248646=this;return new Promise(function(_0x15640d,_0x5454b6){var _0x570381;return db[_0xd7a7('0xa')]['findOne']({'where':_0x5a47c1[_0xd7a7('0xc')][_0xd7a7('0xe')]||{},'attributes':['id',_0xd7a7('0x1e')]})[_0xd7a7('0x14')](function(_0x5e7a98){if(_0x5e7a98){_0x570381=_0x5e7a98;return db[_0xd7a7('0x1f')][_0xd7a7('0x43')]({'where':{'membername':_0x570381['name']},'individualHooks':!![]});}})[_0xd7a7('0x14')](function(){if(_0x570381){return db[_0xd7a7('0x21')][_0xd7a7('0xb')]({'where':{'membername':_0x570381['name'],'exitAt':null}});}})['then'](function(_0x255447){if(_0x570381){if(_0x255447&&_0x255447[_0xd7a7('0x23')]){var _0x446aae=[];_0x255447['forEach'](function(_0x14caa8){_0x446aae['push'](_0x14caa8[_0xd7a7('0x20')]({'exitAt':moment()[_0xd7a7('0x24')](_0xd7a7('0x25'))}));});return BPromise['all'](_0x446aae);}}})[_0xd7a7('0x14')](function(){if(_0x570381){return _0x570381[_0xd7a7('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xd7a7('0x14')](function(_0x4f0f9b){_0x15640d(_0x4f0f9b);})[_0xd7a7('0x17')](function(_0x2332ee){_0x5454b6(_0x248646[_0xd7a7('0x18')](0x1f4,_0x2332ee[_0xd7a7('0x19')]));});});};exports[_0xd7a7('0x44')]=function(_0x158e97){var _0x221106=this;return new Promise(function(_0x42eeb0,_0x3a17d4){var _0x3a494a;var _0x4a08bc;var _0x1ed25e;var _0x23c6a0;return db['User'][_0xd7a7('0x35')]({'where':_0x158e97['options']['where']||{},'attributes':['id',_0xd7a7('0x1e'),_0xd7a7('0x2f'),_0xd7a7('0x45'),'phone',_0xd7a7('0x46'),_0xd7a7('0x47'),_0xd7a7('0x2b')]})[_0xd7a7('0x14')](function(_0x3f9e87){if(_0x3f9e87){_0x3a494a=_0x3f9e87;_0x23c6a0=_0x158e97['body']['interface']?_0x158e97[_0xd7a7('0x2c')]['interface']:util[_0xd7a7('0x24')](_0xd7a7('0x2a'),_0x3a494a[_0xd7a7('0x1e')]);return db['User']['count']({'where':{'role':_0xd7a7('0x48'),'online':!![],'id':{'$ne':_0x3a494a['id']}}});}})[_0xd7a7('0x14')](function(_0x3b5d1a){if(_0x3b5d1a){_0x1ed25e=_0x3b5d1a;return require(_0xd7a7('0x49'))['getLicense']();}})[_0xd7a7('0x14')](function(_0x90a9f7){if(_0x90a9f7&&_0x90a9f7['agents']&&_0x1ed25e>=_0x90a9f7['agents']){throw new Error(_0xd7a7('0x4a'));}})[_0xd7a7('0x14')](function(){if(_0x3a494a){return db[_0xd7a7('0x1f')][_0xd7a7('0x43')]({'where':{'membername':_0x3a494a[_0xd7a7('0x1e')]},'individualHooks':!![]});}})['then'](function(){if(_0x3a494a){return _0x3a494a['getVoiceQueues']({'raw':!![]});}})[_0xd7a7('0x14')](function(_0x700ae){if(_0x3a494a){if(_0x700ae){var _0x3c7774=[];_0x4a08bc=_0x700ae;if(_0x4a08bc[_0xd7a7('0x23')]){for(var _0x5e00ea=0x0;_0x5e00ea<_0x4a08bc[_0xd7a7('0x23')];_0x5e00ea++){_0x3c7774[_0xd7a7('0x29')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3a494a['name'],'UserId':_0x3a494a['id'],'queue_name':_0x4a08bc[_0x5e00ea][_0xd7a7('0x1e')],'VoiceQueueId':_0x4a08bc[_0x5e00ea]['id'],'interface':_0x23c6a0,'paused':_0x3a494a[_0xd7a7('0x47')]||![],'penalty':_0x4a08bc[_0x5e00ea][_0xd7a7('0x4b')]||0x0}));}return BPromise['all'](_0x3c7774);}}}})[_0xd7a7('0x14')](function(){if(_0x3a494a){return db[_0xd7a7('0x21')][_0xd7a7('0xb')]({'where':{'membername':_0x3a494a[_0xd7a7('0x1e')],'exitAt':null}});}})[_0xd7a7('0x14')](function(_0x4ea1b1){if(_0x3a494a){if(_0x4ea1b1&&_0x4ea1b1[_0xd7a7('0x23')]){var _0x18d9e4=[];_0x4ea1b1[_0xd7a7('0x28')](function(_0x248e60){_0x18d9e4['push'](_0x248e60[_0xd7a7('0x20')]({'exitAt':moment()[_0xd7a7('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xd7a7('0x4c')](_0x18d9e4);}}})[_0xd7a7('0x14')](function(){if(_0x3a494a){var _0x262d9f=[];var _0x152362=[];var _0x49f349=utils['getChannels']();var _0x2f3783={'membername':_0x3a494a[_0xd7a7('0x1e')],'interface':_0x23c6a0,'enterAt':moment()['format'](_0xd7a7('0x25')),'role':_0x3a494a[_0xd7a7('0x2f')],'internal':_0x3a494a[_0xd7a7('0x46')]};_0x49f349['forEach'](function(_0x4ef949){_0x262d9f['push'](_[_0xd7a7('0x4d')]({'channel':_0x4ef949,'type':_0xd7a7('0x4e'),'data1':_0xd7a7('0x4f'),'data2':_0x23c6a0},_0x2f3783));if(_0x3a494a[_0xd7a7('0x47')]){_0x152362[_0xd7a7('0x29')](_[_0xd7a7('0x4d')]({'channel':_0x4ef949,'type':_0xd7a7('0x22'),'data1':_0xd7a7('0x50')},_0x2f3783));}});return db['MemberReport'][_0xd7a7('0x51')](_0x262d9f[_0xd7a7('0x52')](_0x152362),{'individualHooks':!![]});}})[_0xd7a7('0x14')](function(){if(_0x3a494a){return _0x3a494a[_0xd7a7('0x20')]({'online':!![],'lastLoginAt':moment()['format'](_0xd7a7('0x25')),'voicePause':_0x3a494a[_0xd7a7('0x47')]||![],'mailPause':_0x3a494a[_0xd7a7('0x47')]||![],'chatPause':_0x3a494a[_0xd7a7('0x47')]||![],'faxPause':_0x3a494a[_0xd7a7('0x47')]||![],'smsPause':_0x3a494a['loginInPause']||![],'openchannelPause':_0x3a494a[_0xd7a7('0x47')]||![],'pauseType':_0x3a494a['loginInPause']?_0xd7a7('0x50'):null,'lastPauseAt':moment()[_0xd7a7('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x23c6a0});}})[_0xd7a7('0x14')](function(_0x25b61e){_0x42eeb0(_0x25b61e);})[_0xd7a7('0x17')](function(_0x5cfba3){_0x3a17d4(_0x221106[_0xd7a7('0x18')](0x1f4,_0x5cfba3['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0562b45..542cb54 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 _0x3e14=['removeListener','length','user:','./user.events','save','remove','update','emit'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x3e14,0x1a3));var _0x43e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e14[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x43e1('0x0'));var events=[_0x43e1('0x1'),_0x43e1('0x2'),_0x43e1('0x3')];function createListener(_0x21e403,_0x36a3e5){return function(_0xd52559){_0x36a3e5[_0x43e1('0x4')](_0x21e403,_0xd52559);};}function removeListener(_0x160741,_0x174c44){return function(){UserEvents[_0x43e1('0x5')](_0x160741,_0x174c44);};}exports['register']=function(_0x3bc5c7){for(var _0x5e4552=0x0,_0x2594f7=events[_0x43e1('0x6')];_0x5e4552<_0x2594f7;_0x5e4552++){var _0xfde6ba=events[_0x5e4552];var _0x4849eb=createListener(_0x43e1('0x7')+_0xfde6ba,_0x3bc5c7);UserEvents['on'](_0xfde6ba,_0x4849eb);}}; \ No newline at end of file +var _0x9403=['save','remove','update','emit','removeListener','user:'];(function(_0x35036f,_0x5dc350){var _0x1d4fb1=function(_0x4eb96d){while(--_0x4eb96d){_0x35036f['push'](_0x35036f['shift']());}};_0x1d4fb1(++_0x5dc350);}(_0x9403,0xba));var _0x3940=function(_0x374214,_0x262429){_0x374214=_0x374214-0x0;var _0x402719=_0x9403[_0x374214];return _0x402719;};'use strict';var UserEvents=require('./user.events');var events=[_0x3940('0x0'),_0x3940('0x1'),_0x3940('0x2')];function createListener(_0x22f97e,_0x484bfb){return function(_0x384c83){_0x484bfb[_0x3940('0x3')](_0x22f97e,_0x384c83);};}function removeListener(_0x41a75d,_0xa2d775){return function(){UserEvents[_0x3940('0x4')](_0x41a75d,_0xa2d775);};}exports['register']=function(_0x2e2186){for(var _0x37f310=0x0,_0x38f3f9=events['length'];_0x37f310<_0x38f3f9;_0x37f310++){var _0x534c6a=events[_0x37f310];var _0x480986=createListener(_0x3940('0x5')+_0x534c6a,_0x2e2186);UserEvents['on'](_0x534c6a,_0x480986);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c44a8cd..ab7a8bb 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15d229,_0x132b33){var _0x2ebafc=function(_0x41a43c){while(--_0x41a43c){_0x15d229['push'](_0x15d229['shift']());}};_0x2ebafc(++_0x132b33);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x175f8a,_0x409eea){var _0x3e05a0=function(_0x1e3d9c){while(--_0x1e3d9c){_0x175f8a['push'](_0x175f8a['shift']());}};_0x3e05a0(++_0x409eea);}(_0xedd9,0xfc));var _0x9edd=function(_0x4ee5c0,_0x270d92){_0x4ee5c0=_0x4ee5c0-0x0;var _0x11855a=_0xedd9[_0x4ee5c0];return _0x11855a;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 1b66aa1..ffcb991 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 _0xe920=['sequelize'];(function(_0x451646,_0x5a9280){var _0x28c085=function(_0x4bb194){while(--_0x4bb194){_0x451646['push'](_0x451646['shift']());}};_0x28c085(++_0x5a9280);}(_0xe920,0x11c));var _0x0e92=function(_0x102b0c,_0x33dee4){_0x102b0c=_0x102b0c-0x0;var _0x9b15ca=_0xe920[_0x102b0c];return _0x9b15ca;};'use strict';var Sequelize=require(_0x0e92('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe351=['sequelize','exports','INTEGER'];(function(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0xe351,0x10b));var _0x1e35=function(_0x54227b,_0x58532d){_0x54227b=_0x54227b-0x0;var _0x494dc2=_0xe351[_0x54227b];return _0x494dc2;};'use strict';var Sequelize=require(_0x1e35('0x0'));module[_0x1e35('0x1')]={'penalty':{'type':Sequelize[_0x1e35('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 1c7a70d..940b19c 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 _0x6d62=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x6d62,0x18b));var _0x26d6=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0x6d62[_0x3c42ff];return _0x4c0f6d;};'use strict';var _=require(_0x26d6('0x0'));var util=require('util');var logger=require(_0x26d6('0x1'))('api');var moment=require(_0x26d6('0x2'));var BPromise=require(_0x26d6('0x3'));var rp=require(_0x26d6('0x4'));var fs=require('fs');var path=require(_0x26d6('0x5'));var rimraf=require(_0x26d6('0x6'));var config=require(_0x26d6('0x7'));var attributes=require(_0x26d6('0x8'));module[_0x26d6('0x9')]=function(_0x1187ac,_0x15fccb){return _0x1187ac[_0x26d6('0xa')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6713=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6713,0x6b));var _0x3671=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x6713[_0x1d39f6];return _0x3dbd7a;};'use strict';var _=require(_0x3671('0x0'));var util=require(_0x3671('0x1'));var logger=require(_0x3671('0x2'))('api');var moment=require(_0x3671('0x3'));var BPromise=require(_0x3671('0x4'));var rp=require(_0x3671('0x5'));var fs=require('fs');var path=require(_0x3671('0x6'));var rimraf=require(_0x3671('0x7'));var config=require(_0x3671('0x8'));var attributes=require(_0x3671('0x9'));module[_0x3671('0xa')]=function(_0x567701,_0x10c1a0){return _0x567701[_0x3671('0xb')](_0x3671('0xc'),attributes,{'tableName':_0x3671('0xd'),'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 99950a2..8e92941 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 _0x0749=['jayson/promise','http','request','then','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','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x44c3c1,_0x33d4cd){var _0x3a78ba=function(_0x1d8cbc){while(--_0x1d8cbc){_0x44c3c1['push'](_0x44c3c1['shift']());}};_0x3a78ba(++_0x33d4cd);}(_0x0749,0x18f));var _0x9074=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0749[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x9074('0x0'));var util=require(_0x9074('0x1'));var moment=require(_0x9074('0x2'));var BPromise=require(_0x9074('0x3'));var rs=require(_0x9074('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9074('0x5'))['db'];var utils=require(_0x9074('0x6'));var logger=require('../../config/logger')(_0x9074('0x7'));var config=require(_0x9074('0x8'));var jayson=require(_0x9074('0x9'));var client=jayson['client'][_0x9074('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3633a5,_0x4adb8b,_0x529c69){return new BPromise(function(_0x24db7e,_0x584e86){return client[_0x9074('0xb')](_0x3633a5,_0x529c69)[_0x9074('0xc')](function(_0x15e4b5){logger[_0x9074('0xd')](_0x9074('0xe'),_0x4adb8b,_0x9074('0xf'));logger[_0x9074('0x10')](_0x9074('0x11'),_0x4adb8b,_0x9074('0xf'),JSON[_0x9074('0x12')](_0x15e4b5));if(_0x15e4b5['error']){if(_0x15e4b5[_0x9074('0x13')][_0x9074('0x14')]===0x1f4){logger[_0x9074('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4adb8b,_0x15e4b5[_0x9074('0x13')][_0x9074('0x15')]);return _0x584e86(_0x15e4b5['error'][_0x9074('0x15')]);}logger['error'](_0x9074('0xe'),_0x4adb8b,_0x15e4b5[_0x9074('0x13')]['message']);return _0x24db7e(_0x15e4b5[_0x9074('0x13')][_0x9074('0x15')]);}else{logger[_0x9074('0xd')](_0x9074('0xe'),_0x4adb8b,_0x9074('0xf'));_0x24db7e(_0x15e4b5[_0x9074('0x16')]['message']);}})[_0x9074('0x17')](function(_0x20ec9e){logger[_0x9074('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4adb8b,_0x20ec9e);_0x584e86(_0x20ec9e);});});} \ No newline at end of file +var _0xdba7=['UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x16fd08,_0x44d25c){var _0x332392=function(_0x1a645b){while(--_0x1a645b){_0x16fd08['push'](_0x16fd08['shift']());}};_0x332392(++_0x44d25c);}(_0xdba7,0x18b));var _0x7dba=function(_0x3bdfdf,_0x15ebe7){_0x3bdfdf=_0x3bdfdf-0x0;var _0x2170d0=_0xdba7[_0x3bdfdf];return _0x2170d0;};'use strict';var _=require(_0x7dba('0x0'));var util=require(_0x7dba('0x1'));var moment=require(_0x7dba('0x2'));var BPromise=require(_0x7dba('0x3'));var rs=require(_0x7dba('0x4'));var fs=require('fs');var Redis=require(_0x7dba('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7dba('0x6'));var logger=require('../../config/logger')(_0x7dba('0x7'));var config=require(_0x7dba('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7dba('0x9')][_0x7dba('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c1fb,_0xff5947,_0x1f41ee){return new BPromise(function(_0x4502c7,_0x3173fd){return client[_0x7dba('0xb')](_0x32c1fb,_0x1f41ee)[_0x7dba('0xc')](function(_0x512e8c){logger[_0x7dba('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xff5947,'request\x20sent');logger[_0x7dba('0xe')](_0x7dba('0xf'),_0xff5947,_0x7dba('0x10'),JSON['stringify'](_0x512e8c));if(_0x512e8c[_0x7dba('0x11')]){if(_0x512e8c['error'][_0x7dba('0x12')]===0x1f4){logger['error'](_0x7dba('0x13'),_0xff5947,_0x512e8c['error'][_0x7dba('0x14')]);return _0x3173fd(_0x512e8c[_0x7dba('0x11')][_0x7dba('0x14')]);}logger[_0x7dba('0x11')](_0x7dba('0x13'),_0xff5947,_0x512e8c[_0x7dba('0x11')]['message']);return _0x4502c7(_0x512e8c['error'][_0x7dba('0x14')]);}else{logger[_0x7dba('0xd')]('UserChatQueue,\x20%s,\x20%s',_0xff5947,_0x7dba('0x10'));_0x4502c7(_0x512e8c[_0x7dba('0x15')]['message']);}})[_0x7dba('0x16')](function(_0x225b72){logger[_0x7dba('0x11')](_0x7dba('0x13'),_0xff5947,_0x225b72);_0x3173fd(_0x225b72);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 3e5f9bf..2be95e6 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x152998,_0x673cc5){var _0x348f90=function(_0x2c1054){while(--_0x2c1054){_0x152998['push'](_0x152998['shift']());}};_0x348f90(++_0x673cc5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8883e44..3a6d485 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 _0xf490=['STRING','sequelize','exports','INTEGER'];(function(_0x2b67f3,_0x2285d2){var _0xb81c62=function(_0x4aec70){while(--_0x4aec70){_0x2b67f3['push'](_0x2b67f3['shift']());}};_0xb81c62(++_0x2285d2);}(_0xf490,0xc1));var _0x0f49=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0xf490[_0x3efe87];return _0x56a4cc;};'use strict';var Sequelize=require(_0x0f49('0x0'));module[_0x0f49('0x1')]={'penalty':{'type':Sequelize[_0x0f49('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0f49('0x3')]}}; \ No newline at end of file +var _0x4e0e=['exports','INTEGER','sequelize'];(function(_0x4a9fb7,_0x4cbfd7){var _0x40b90e=function(_0x59664c){while(--_0x59664c){_0x4a9fb7['push'](_0x4a9fb7['shift']());}};_0x40b90e(++_0x4cbfd7);}(_0x4e0e,0x11f));var _0xe4e0=function(_0x461736,_0x3783d7){_0x461736=_0x461736-0x0;var _0x132a4c=_0x4e0e[_0x461736];return _0x132a4c;};'use strict';var Sequelize=require(_0xe4e0('0x0'));module[_0xe4e0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xe4e0('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 7978535..3a0d0d5 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 _0x81ab=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define'];(function(_0x5c62fc,_0x41431a){var _0x14c817=function(_0x34dd8a){while(--_0x34dd8a){_0x5c62fc['push'](_0x5c62fc['shift']());}};_0x14c817(++_0x41431a);}(_0x81ab,0xd1));var _0xb81a=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x81ab[_0x5c2c7c];return _0xea7ffe;};'use strict';var _=require(_0xb81a('0x0'));var util=require(_0xb81a('0x1'));var logger=require(_0xb81a('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb81a('0x3'));var rp=require(_0xb81a('0x4'));var fs=require('fs');var path=require(_0xb81a('0x5'));var rimraf=require(_0xb81a('0x6'));var config=require(_0xb81a('0x7'));var attributes=require(_0xb81a('0x8'));module[_0xb81a('0x9')]=function(_0x37640b,_0x46879d){return _0x37640b[_0xb81a('0xa')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x46d3=['bluebird','request-promise','path','rimraf','define','UserFaxQueue','user_has_fax_queues','lodash','../../config/logger'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x46d3,0xbb));var _0x346d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x46d3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x346d('0x0'));var util=require('util');var logger=require(_0x346d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x346d('0x2'));var rp=require(_0x346d('0x3'));var fs=require('fs');var path=require(_0x346d('0x4'));var rimraf=require(_0x346d('0x5'));var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x3063d5,_0x41b094){return _0x3063d5[_0x346d('0x6')](_0x346d('0x7'),attributes,{'tableName':_0x346d('0x8'),'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 13e0145..365421d 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 _0x7a92=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a92,0x90));var _0x27a9=function(_0x485bae,_0x33a0c1){_0x485bae=_0x485bae-0x0;var _0x4702c6=_0x7a92[_0x485bae];return _0x4702c6;};'use strict';var _=require(_0x27a9('0x0'));var util=require(_0x27a9('0x1'));var moment=require('moment');var BPromise=require(_0x27a9('0x2'));var rs=require(_0x27a9('0x3'));var fs=require('fs');var Redis=require(_0x27a9('0x4'));var db=require(_0x27a9('0x5'))['db'];var utils=require(_0x27a9('0x6'));var logger=require(_0x27a9('0x7'))('rpc');var config=require(_0x27a9('0x8'));var jayson=require(_0x27a9('0x9'));var client=jayson[_0x27a9('0xa')][_0x27a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28ea35,_0x1bf7ea,_0x4300f8){return new BPromise(function(_0x2141bb,_0x11a1b5){return client[_0x27a9('0xc')](_0x28ea35,_0x4300f8)[_0x27a9('0xd')](function(_0x230aa8){logger[_0x27a9('0xe')](_0x27a9('0xf'),_0x1bf7ea,'request\x20sent');logger[_0x27a9('0x10')](_0x27a9('0x11'),_0x1bf7ea,_0x27a9('0x12'),JSON[_0x27a9('0x13')](_0x230aa8));if(_0x230aa8[_0x27a9('0x14')]){if(_0x230aa8['error'][_0x27a9('0x15')]===0x1f4){logger['error'](_0x27a9('0xf'),_0x1bf7ea,_0x230aa8[_0x27a9('0x14')]['message']);return _0x11a1b5(_0x230aa8[_0x27a9('0x14')][_0x27a9('0x16')]);}logger[_0x27a9('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x1bf7ea,_0x230aa8[_0x27a9('0x14')]['message']);return _0x2141bb(_0x230aa8[_0x27a9('0x14')][_0x27a9('0x16')]);}else{logger['info'](_0x27a9('0xf'),_0x1bf7ea,_0x27a9('0x12'));_0x2141bb(_0x230aa8[_0x27a9('0x17')][_0x27a9('0x16')]);}})['catch'](function(_0x4e302d){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1bf7ea,_0x4e302d);_0x11a1b5(_0x4e302d);});});} \ No newline at end of file +var _0x10b9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','moment','randomstring','ioredis'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0x10b9,0xcf));var _0x910b=function(_0x48a80d,_0x1b2aaf){_0x48a80d=_0x48a80d-0x0;var _0x267bcb=_0x10b9[_0x48a80d];return _0x267bcb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x910b('0x0'));var BPromise=require('bluebird');var rs=require(_0x910b('0x1'));var fs=require('fs');var Redis=require(_0x910b('0x2'));var db=require(_0x910b('0x3'))['db'];var utils=require(_0x910b('0x4'));var logger=require(_0x910b('0x5'))(_0x910b('0x6'));var config=require(_0x910b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x910b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28272f,_0x3b2fdd,_0x12bc5d){return new BPromise(function(_0x1555dd,_0x2822f6){return client[_0x910b('0x9')](_0x28272f,_0x12bc5d)[_0x910b('0xa')](function(_0x11ba17){logger[_0x910b('0xb')]('UserFaxQueue,\x20%s,\x20%s',_0x3b2fdd,'request\x20sent');logger['debug'](_0x910b('0xc'),_0x3b2fdd,'request\x20sent',JSON[_0x910b('0xd')](_0x11ba17));if(_0x11ba17[_0x910b('0xe')]){if(_0x11ba17[_0x910b('0xe')][_0x910b('0xf')]===0x1f4){logger[_0x910b('0xe')](_0x910b('0x10'),_0x3b2fdd,_0x11ba17[_0x910b('0xe')][_0x910b('0x11')]);return _0x2822f6(_0x11ba17['error'][_0x910b('0x11')]);}logger[_0x910b('0xe')](_0x910b('0x10'),_0x3b2fdd,_0x11ba17[_0x910b('0xe')][_0x910b('0x11')]);return _0x1555dd(_0x11ba17[_0x910b('0xe')][_0x910b('0x11')]);}else{logger[_0x910b('0xb')](_0x910b('0x10'),_0x3b2fdd,_0x910b('0x12'));_0x1555dd(_0x11ba17[_0x910b('0x13')][_0x910b('0x11')]);}})[_0x910b('0x14')](function(_0x209d36){logger[_0x910b('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x3b2fdd,_0x209d36);_0x2822f6(_0x209d36);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 718f8c4..d40d92b 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x47a4d2,_0x2fb66e){var _0x14a141=function(_0x3dacc6){while(--_0x3dacc6){_0x47a4d2['push'](_0x47a4d2['shift']());}};_0x14a141(++_0x2fb66e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0xcb91[_0x29e35f];return _0x266b74;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2c8ed1,_0x214cf9){var _0x4aec7e=function(_0x42f77b){while(--_0x42f77b){_0x2c8ed1['push'](_0x2c8ed1['shift']());}};_0x4aec7e(++_0x214cf9);}(_0x70e0,0x17b));var _0x070e=function(_0xc38673,_0x35d04d){_0xc38673=_0xc38673-0x0;var _0x5bfe6b=_0x70e0[_0xc38673];return _0x5bfe6b;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 00e035f..4d2a9cb 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 _0x0e42=['INTEGER'];(function(_0x42586b,_0x5c02f4){var _0x2d3403=function(_0x3bdfcb){while(--_0x3bdfcb){_0x42586b['push'](_0x42586b['shift']());}};_0x2d3403(++_0x5c02f4);}(_0x0e42,0x1e9));var _0x20e4=function(_0x42f37e,_0xe79d40){_0x42f37e=_0x42f37e-0x0;var _0x262086=_0x0e42[_0x42f37e];return _0x262086;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x20e4('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1c55=['exports','INTEGER'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1c55,0x11e));var _0x51c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c55[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x51c5('0x0')]={'penalty':{'type':Sequelize[_0x51c5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index a082dd4..9c10e9f 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 _0x7c06=['UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes','define'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x7c06,0x121));var _0x67c0=function(_0x47e309,_0x1e771a){_0x47e309=_0x47e309-0x0;var _0x2e1900=_0x7c06[_0x47e309];return _0x2e1900;};'use strict';var _=require(_0x67c0('0x0'));var util=require(_0x67c0('0x1'));var logger=require(_0x67c0('0x2'))(_0x67c0('0x3'));var moment=require(_0x67c0('0x4'));var BPromise=require(_0x67c0('0x5'));var rp=require(_0x67c0('0x6'));var fs=require('fs');var path=require(_0x67c0('0x7'));var rimraf=require(_0x67c0('0x8'));var config=require('../../config/environment');var attributes=require(_0x67c0('0x9'));module['exports']=function(_0x56d861,_0x34c202){return _0x56d861[_0x67c0('0xa')](_0x67c0('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0dd0=['./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x0dd0,0x1b7));var _0x00dd=function(_0x3ebf9d,_0x343227){_0x3ebf9d=_0x3ebf9d-0x0;var _0x538e25=_0x0dd0[_0x3ebf9d];return _0x538e25;};'use strict';var _=require(_0x00dd('0x0'));var util=require(_0x00dd('0x1'));var logger=require(_0x00dd('0x2'))('api');var moment=require(_0x00dd('0x3'));var BPromise=require(_0x00dd('0x4'));var rp=require(_0x00dd('0x5'));var fs=require('fs');var path=require(_0x00dd('0x6'));var rimraf=require(_0x00dd('0x7'));var config=require(_0x00dd('0x8'));var attributes=require(_0x00dd('0x9'));module[_0x00dd('0xa')]=function(_0x3e2b8e,_0x59c6a6){return _0x3e2b8e[_0x00dd('0xb')](_0x00dd('0xc'),attributes,{'tableName':_0x00dd('0xd'),'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 667f76c..9bf6557 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x35ba3d,_0x328a1f){var _0x19a8e7=function(_0x5dbc81){while(--_0x5dbc81){_0x35ba3d['push'](_0x35ba3d['shift']());}};_0x19a8e7(++_0x328a1f);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2ea54c,_0x2b3c66){_0x2ea54c=_0x2ea54c-0x0;var _0x2b771c=_0x8ef6[_0x2ea54c];return _0x2b771c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5eb30e,_0x37900c){var _0x2c493e=function(_0x4eb18c){while(--_0x4eb18c){_0x5eb30e['push'](_0x5eb30e['shift']());}};_0x2c493e(++_0x37900c);}(_0x34e8,0x12c));var _0x834e=function(_0x19c72f,_0x20de0d){_0x19c72f=_0x19c72f-0x0;var _0xa0e37b=_0x34e8[_0x19c72f];return _0xa0e37b;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 08dea8c..81dd303 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 _0x45b8=['post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x4d093a,_0x15d59c){var _0x5d7227=function(_0x4e2fee){while(--_0x4e2fee){_0x4d093a['push'](_0x4d093a['shift']());}};_0x5d7227(++_0x15d59c);}(_0x45b8,0x1e4));var _0x845b=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x45b8[_0x40220a];return _0x3903cc;};'use strict';var multer=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var path=require(_0x845b('0x2'));var timeout=require(_0x845b('0x3'));var express=require(_0x845b('0x4'));var router=express[_0x845b('0x5')]();var fs_extra=require(_0x845b('0x6'));var auth=require(_0x845b('0x7'));var interaction=require(_0x845b('0x8'));var config=require(_0x845b('0x9'));var controller=require(_0x845b('0xa'));router[_0x845b('0xb')]('/',auth[_0x845b('0xc')](),controller[_0x845b('0xd')]);module[_0x845b('0xe')]=router; \ No newline at end of file +var _0xa35d=['multer','path','connect-timeout','Router','fs-extra','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification'];(function(_0x40584d,_0x17fc4c){var _0x2244d0=function(_0x1e73ca){while(--_0x1e73ca){_0x40584d['push'](_0x40584d['shift']());}};_0x2244d0(++_0x17fc4c);}(_0xa35d,0x156));var _0xda35=function(_0x4b9878,_0x32fe17){_0x4b9878=_0x4b9878-0x0;var _0x14808b=_0xa35d[_0x4b9878];return _0x14808b;};'use strict';var multer=require(_0xda35('0x0'));var util=require('util');var path=require(_0xda35('0x1'));var timeout=require(_0xda35('0x2'));var express=require('express');var router=express[_0xda35('0x3')]();var fs_extra=require(_0xda35('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda35('0x5'));var controller=require(_0xda35('0x6'));router['post']('/',auth[_0xda35('0x7')](),controller[_0xda35('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 35a8040..16991a9 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 _0xce2d=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x544586,_0xf5da31){var _0x2ee451=function(_0x77f203){while(--_0x77f203){_0x544586['push'](_0x544586['shift']());}};_0x2ee451(++_0xf5da31);}(_0xce2d,0x93));var _0xdce2=function(_0x5c22e0,_0x3b8f74){_0x5c22e0=_0x5c22e0-0x0;var _0x24ad5a=_0xce2d[_0x5c22e0];return _0x24ad5a;};'use strict';var Sequelize=require(_0xdce2('0x0'));module['exports']={'body':{'type':Sequelize[_0xdce2('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xdce2('0x1')]},'recipientsDescription':{'type':Sequelize[_0xdce2('0x2')]},'beep':{'type':Sequelize[_0xdce2('0x3')]}}; \ No newline at end of file +var _0x343e=['BOOLEAN','exports','TEXT','STRING'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x343e,0x115));var _0xe343=function(_0x1cd038,_0x254db6){_0x1cd038=_0x1cd038-0x0;var _0x586a85=_0x343e[_0x1cd038];return _0x586a85;};'use strict';var Sequelize=require('sequelize');module[_0xe343('0x0')]={'body':{'type':Sequelize[_0xe343('0x1')]},'senderName':{'type':Sequelize[_0xe343('0x2')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xe343('0x2')]},'beep':{'type':Sequelize[_0xe343('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 3f80411..57a3299 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 _0xd276=['forEach','recipient','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','User','union','ids','queue','replace','Queue','push','all','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','update','destroy','then','end','stack','name','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','openchannelqueue','smsqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','join','sequelize','transaction','UserNotification','create'];(function(_0x755a0e,_0x4a79e7){var _0xaf71a4=function(_0x4f221a){while(--_0x4f221a){_0x755a0e['push'](_0x755a0e['shift']());}};_0xaf71a4(++_0x4a79e7);}(_0xd276,0x185));var _0x6d27=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0xd276[_0x47e549];return _0x251374;};'use strict';var emlformat=require(_0x6d27('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d27('0x1'));var jsonpatch=require(_0x6d27('0x2'));var rp=require(_0x6d27('0x3'));var moment=require('moment');var BPromise=require(_0x6d27('0x4'));var Mustache=require(_0x6d27('0x5'));var util=require(_0x6d27('0x6'));var path=require('path');var sox=require(_0x6d27('0x7'));var csv=require(_0x6d27('0x8'));var ejs=require(_0x6d27('0x9'));var fs=require('fs');var fs_extra=require(_0x6d27('0xa'));var _=require(_0x6d27('0xb'));var squel=require(_0x6d27('0xc'));var crypto=require(_0x6d27('0xd'));var jsforce=require(_0x6d27('0xe'));var deskjs=require(_0x6d27('0xf'));var toCsv=require(_0x6d27('0x8'));var querystring=require('querystring');var Papa=require(_0x6d27('0x10'));var Redis=require('ioredis');var authService=require(_0x6d27('0x11'));var qs=require(_0x6d27('0x12'));var as=require(_0x6d27('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6d27('0x14'));var utils=require(_0x6d27('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6d27('0x16'));var db=require(_0x6d27('0x17'))['db'];config[_0x6d27('0x18')]=_[_0x6d27('0x19')](config[_0x6d27('0x18')],{'host':_0x6d27('0x1a'),'port':0x18eb});var socket=require(_0x6d27('0x1b'))(new Redis(config[_0x6d27('0x18')]));require('./userNotification.socket')[_0x6d27('0x1c')](socket);function respondWithStatusCode(_0x2f67e3,_0x33fef8){_0x33fef8=_0x33fef8||0xcc;return function(_0x302b43){if(_0x302b43){return _0x2f67e3[_0x6d27('0x1d')](_0x33fef8);}return _0x2f67e3[_0x6d27('0x1e')](_0x33fef8)['end']();};}function respondWithResult(_0x457490,_0x3bb019){_0x3bb019=_0x3bb019||0xc8;return function(_0x532dba){if(_0x532dba){return _0x457490['status'](_0x3bb019)[_0x6d27('0x1f')](_0x532dba);}};}function respondWithFilteredResult(_0x57fb4d,_0x42776d){return function(_0xe52dbe){if(_0xe52dbe){var _0x5b149a=typeof _0x42776d['offset']===_0x6d27('0x20')&&typeof _0x42776d['limit']==='undefined';var _0x580e56=_0xe52dbe[_0x6d27('0x21')];var _0x4808e8=_0x5b149a?0x0:_0x42776d[_0x6d27('0x22')];var _0x4d87b5=_0x5b149a?_0xe52dbe[_0x6d27('0x21')]:_0x42776d[_0x6d27('0x22')]+_0x42776d[_0x6d27('0x23')];var _0x2f36cf;if(_0x4d87b5>=_0x580e56){_0x4d87b5=_0x580e56;_0x2f36cf=0xc8;}else{_0x2f36cf=0xce;}_0x57fb4d[_0x6d27('0x1e')](_0x2f36cf);return _0x57fb4d['set'](_0x6d27('0x24'),_0x4808e8+'-'+_0x4d87b5+'/'+_0x580e56)[_0x6d27('0x1f')](_0xe52dbe);}return null;};}function patchUpdates(_0x3ca8aa){return function(_0x4ede4b){try{jsonpatch['apply'](_0x4ede4b,_0x3ca8aa,!![]);}catch(_0x366ae1){return BPromise[_0x6d27('0x25')](_0x366ae1);}return _0x4ede4b['save']();};}function saveUpdates(_0x5f1434,_0x17bb5a){return function(_0x5e5722){if(_0x5e5722){return _0x5e5722[_0x6d27('0x26')](_0x5f1434)['then'](function(_0x5c6bde){return _0x5c6bde;});}return null;};}function removeEntity(_0x4f2052,_0x3373b5){return function(_0x4c88d6){if(_0x4c88d6){return _0x4c88d6[_0x6d27('0x27')]()[_0x6d27('0x28')](function(){_0x4f2052[_0x6d27('0x1e')](0xcc)[_0x6d27('0x29')]();});}};}function handleEntityNotFound(_0x7ed77d,_0x1063b0){return function(_0x5ee00c){if(!_0x5ee00c){_0x7ed77d['sendStatus'](0x194);}return _0x5ee00c;};}function handleError(_0xf80590,_0x38b15a){_0x38b15a=_0x38b15a||0x1f4;return function(_0x33b8b4){logger['error'](_0x33b8b4[_0x6d27('0x2a')]);if(_0x33b8b4[_0x6d27('0x2b')]){delete _0x33b8b4[_0x6d27('0x2b')];}_0xf80590[_0x6d27('0x1e')](_0x38b15a)['send'](_0x33b8b4);};}exports['sendUserNotification']=function(_0x81030e,_0x2f3668,_0xb6d449){if(!_0x81030e[_0x6d27('0x2c')]['hasOwnProperty'](_0x6d27('0x2d'))&&!_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')](_0x6d27('0x2f'))){throw new db[(_0x6d27('0x30'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x81030e['body'][_0x6d27('0x2e')](_0x6d27('0x2f'))&&!_0x81030e['body'][_0x6d27('0x2e')]('view')){throw new db['Sequelize'][(_0x6d27('0x31'))](_0x6d27('0x32'));}if(!_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')](_0x6d27('0x33'))){throw new db[(_0x6d27('0x30'))][(_0x6d27('0x31'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x4fcc6a=JSON['parse'](_0x81030e[_0x6d27('0x2c')][_0x6d27('0x33')]);}catch(_0x2e3663){logger['error'](_0x2e3663);throw new db[(_0x6d27('0x30'))]['ValidationError'](_0x6d27('0x34'));}var _0x2ece17=[_0x6d27('0x35'),_0x6d27('0x36'),'mailqueue',_0x6d27('0x37'),_0x6d27('0x38'),'voicequeue','whatsappqueue',_0x6d27('0x39'),_0x6d27('0x3a')];if(_[_0x6d27('0x3b')](_0x4fcc6a,function(_0xe3cfdf){return!_[_0x6d27('0x3c')](_0x2ece17,_0xe3cfdf[_0x6d27('0x3d')][_0x6d27('0x3e')]());})){throw new db['Sequelize'][(_0x6d27('0x31'))](_0x6d27('0x3f'));}}}var _0x2350b2={};_0x2350b2[_0x6d27('0x40')]=_0x81030e[_0x6d27('0x2c')][_0x6d27('0x2e')]('senderName')?_0x81030e[_0x6d27('0x2c')][_0x6d27('0x40')]:_0x81030e[_0x6d27('0x3a')][_0x6d27('0x41')];_0x2350b2[_0x6d27('0x42')]=_[_0x6d27('0x43')](_0x81030e['body']['recipientsDescription'])?null:_0x81030e[_0x6d27('0x2c')]['recipientsDescription'];_0x2350b2[_0x6d27('0x44')]=_0x81030e[_0x6d27('0x2c')][_0x6d27('0x44')]||![];_0x2350b2[_0x6d27('0x45')]=_0x81030e['user']['id'];return getContent(_0x81030e[_0x6d27('0x2c')])['then'](function(_0x4db782){_0x2350b2[_0x6d27('0x2c')]=_0x4db782;return getRecipients(_0x4fcc6a);})[_0x6d27('0x28')](function(_0x33b57a){_0x2350b2[_0x6d27('0x46')]=_['sortBy'](_0x33b57a)[_0x6d27('0x47')](',');return db[_0x6d27('0x48')][_0x6d27('0x49')](function(_0x51a886){return db[_0x6d27('0x4a')][_0x6d27('0x4b')](_0x2350b2,{'raw':!![],'transaction':_0x51a886})['then'](function(_0x376433){var _0x26e872={'sender':_0x2350b2[_0x6d27('0x40')],'description':_0x2350b2[_0x6d27('0x42')],'content':_0x2350b2[_0x6d27('0x2c')],'beep':_0x2350b2[_0x6d27('0x44')]};_0x33b57a[_0x6d27('0x4c')](function(_0x1d4380){_0x26e872[_0x6d27('0x4d')]=_0x1d4380;socket['emit']('userNotification:send',_0x26e872);});return _0x376433;});});})['then'](respondWithResult(_0x2f3668,0xc9))[_0x6d27('0x4e')](handleError(_0x2f3668,null));};function getContent(_0x5eb1a3){return new BPromise(function(_0x425660,_0x12e6ae){if(_0x5eb1a3[_0x6d27('0x2d')]){_0x425660(_0x5eb1a3['text']);return;}return db[_0x6d27('0x4f')][_0x6d27('0x50')]({'attributes':['html'],'where':{'id':_0x5eb1a3[_0x6d27('0x2f')]},'raw':!![]})[_0x6d27('0x28')](function(_0x680a30){if(!_0x680a30)throw new db['Sequelize']['ValidationError'](_0x6d27('0x51'));var _0x2ced53=Mustache['render'](_0x680a30[_0x6d27('0x52')],_0x5eb1a3['view']);_0x425660(_0x2ced53);})['catch'](function(_0x3fdf4f){_0x12e6ae(_0x3fdf4f);});});}function getRecipients(_0xc78669){return new BPromise(function(_0x14f366,_0x1df93a){var _0x44a816=[];var _0xde583b=[];_0xc78669[_0x6d27('0x4c')](function(_0x3f7784){var _0x70510c=_['startCase'](_0x3f7784[_0x6d27('0x3d')]['toLowerCase']());if(_0x70510c===_0x6d27('0x53')){_0x44a816=_[_0x6d27('0x54')](_0x44a816,_0x3f7784[_0x6d27('0x55')]);}else{if(_['includes'](_0x70510c,_0x6d27('0x56')))_0x70510c=_0x70510c[_0x6d27('0x57')](_0x6d27('0x56'),_0x6d27('0x58'));_0x3f7784[_0x6d27('0x55')]['forEach'](function(_0x333a76){_0xde583b[_0x6d27('0x59')](getAgents(_0x70510c,_0x333a76));});}});return BPromise[_0x6d27('0x5a')](_0xde583b)[_0x6d27('0x28')](function(_0x36b884){_0x44a816=_[_0x6d27('0x54')](_0x44a816,_[_0x6d27('0x5b')](_0x36b884));_0x14f366(_0x44a816);})['catch'](function(_0x1803dd){_0x1df93a(_0x1803dd);});});}function getAgents(_0x1f4a37,_0x273b6e){return new BPromise(function(_0x28f012,_0x2cd3e0){return db[_0x1f4a37][_0x6d27('0x50')]({'where':{'id':_0x273b6e}})[_0x6d27('0x28')](function(_0x3b4250){return _0x3b4250['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0xfcc28b){var _0x444bf4=_[_0x6d27('0x5c')](_0xfcc28b,'id');_0x28f012(_0x444bf4);});})[_0x6d27('0x4e')](function(_0x26514b){_0x2cd3e0(_0x26514b);});});} \ No newline at end of file +var _0xd9f5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./userNotification.socket','register','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','user','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','push','all','flatten','getAgents','map','eml-format','rimraf'];(function(_0x26b247,_0x2de234){var _0x54e774=function(_0x36ca9e){while(--_0x36ca9e){_0x26b247['push'](_0x26b247['shift']());}};_0x54e774(++_0x2de234);}(_0xd9f5,0x13c));var _0x5d9f=function(_0x12cbd8,_0x8ef0ce){_0x12cbd8=_0x12cbd8-0x0;var _0x2fb1ab=_0xd9f5[_0x12cbd8];return _0x2fb1ab;};'use strict';var emlformat=require(_0x5d9f('0x0'));var rimraf=require(_0x5d9f('0x1'));var zipdir=require(_0x5d9f('0x2'));var jsonpatch=require(_0x5d9f('0x3'));var rp=require(_0x5d9f('0x4'));var moment=require(_0x5d9f('0x5'));var BPromise=require(_0x5d9f('0x6'));var Mustache=require(_0x5d9f('0x7'));var util=require(_0x5d9f('0x8'));var path=require(_0x5d9f('0x9'));var sox=require(_0x5d9f('0xa'));var csv=require(_0x5d9f('0xb'));var ejs=require(_0x5d9f('0xc'));var fs=require('fs');var fs_extra=require(_0x5d9f('0xd'));var _=require('lodash');var squel=require(_0x5d9f('0xe'));var crypto=require(_0x5d9f('0xf'));var jsforce=require(_0x5d9f('0x10'));var deskjs=require(_0x5d9f('0x11'));var toCsv=require(_0x5d9f('0xb'));var querystring=require(_0x5d9f('0x12'));var Papa=require(_0x5d9f('0x13'));var Redis=require(_0x5d9f('0x14'));var authService=require(_0x5d9f('0x15'));var qs=require(_0x5d9f('0x16'));var as=require(_0x5d9f('0x17'));var hardwareService=require(_0x5d9f('0x18'));var logger=require(_0x5d9f('0x19'))(_0x5d9f('0x1a'));var utils=require(_0x5d9f('0x1b'));var config=require(_0x5d9f('0x1c'));var licenseUtil=require(_0x5d9f('0x1d'));var db=require(_0x5d9f('0x1e'))['db'];config[_0x5d9f('0x1f')]=_[_0x5d9f('0x20')](config[_0x5d9f('0x1f')],{'host':_0x5d9f('0x21'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5d9f('0x1f')]));require(_0x5d9f('0x22'))[_0x5d9f('0x23')](socket);function respondWithStatusCode(_0x4a819f,_0x518ab7){_0x518ab7=_0x518ab7||0xcc;return function(_0x3628ac){if(_0x3628ac){return _0x4a819f['sendStatus'](_0x518ab7);}return _0x4a819f[_0x5d9f('0x24')](_0x518ab7)[_0x5d9f('0x25')]();};}function respondWithResult(_0x428213,_0x588165){_0x588165=_0x588165||0xc8;return function(_0x4fac92){if(_0x4fac92){return _0x428213[_0x5d9f('0x24')](_0x588165)[_0x5d9f('0x26')](_0x4fac92);}};}function respondWithFilteredResult(_0x4f70c3,_0x521f50){return function(_0x1ffb65){if(_0x1ffb65){var _0x349d59=typeof _0x521f50[_0x5d9f('0x27')]===_0x5d9f('0x28')&&typeof _0x521f50['limit']==='undefined';var _0x581bc5=_0x1ffb65[_0x5d9f('0x29')];var _0x71985b=_0x349d59?0x0:_0x521f50[_0x5d9f('0x27')];var _0x1ae2f6=_0x349d59?_0x1ffb65['count']:_0x521f50['offset']+_0x521f50[_0x5d9f('0x2a')];var _0x3cd89d;if(_0x1ae2f6>=_0x581bc5){_0x1ae2f6=_0x581bc5;_0x3cd89d=0xc8;}else{_0x3cd89d=0xce;}_0x4f70c3['status'](_0x3cd89d);return _0x4f70c3[_0x5d9f('0x2b')]('Content-Range',_0x71985b+'-'+_0x1ae2f6+'/'+_0x581bc5)[_0x5d9f('0x26')](_0x1ffb65);}return null;};}function patchUpdates(_0x29e8bd){return function(_0x3744c0){try{jsonpatch[_0x5d9f('0x2c')](_0x3744c0,_0x29e8bd,!![]);}catch(_0x5ab7cb){return BPromise['reject'](_0x5ab7cb);}return _0x3744c0[_0x5d9f('0x2d')]();};}function saveUpdates(_0x3ac1da,_0x50baee){return function(_0x1e7d64){if(_0x1e7d64){return _0x1e7d64[_0x5d9f('0x2e')](_0x3ac1da)['then'](function(_0x6834f){return _0x6834f;});}return null;};}function removeEntity(_0x431ed8,_0x332460){return function(_0x48cbb5){if(_0x48cbb5){return _0x48cbb5[_0x5d9f('0x2f')]()[_0x5d9f('0x30')](function(){_0x431ed8[_0x5d9f('0x24')](0xcc)[_0x5d9f('0x25')]();});}};}function handleEntityNotFound(_0x7c03a4,_0x5bdfa5){return function(_0x711abe){if(!_0x711abe){_0x7c03a4[_0x5d9f('0x31')](0x194);}return _0x711abe;};}function handleError(_0x222432,_0x47927a){_0x47927a=_0x47927a||0x1f4;return function(_0x3fb839){logger[_0x5d9f('0x32')](_0x3fb839[_0x5d9f('0x33')]);if(_0x3fb839[_0x5d9f('0x34')]){delete _0x3fb839[_0x5d9f('0x34')];}_0x222432[_0x5d9f('0x24')](_0x47927a)[_0x5d9f('0x35')](_0x3fb839);};}exports['sendUserNotification']=function(_0x50d62b,_0x5f87ac,_0x540d5b){if(!_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x37')](_0x5d9f('0x38'))&&!_0x50d62b[_0x5d9f('0x36')]['hasOwnProperty'](_0x5d9f('0x39'))){throw new db[(_0x5d9f('0x3a'))]['ValidationError'](_0x5d9f('0x3b'));}else{if(_0x50d62b['body'][_0x5d9f('0x37')](_0x5d9f('0x39'))&&!_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x37')](_0x5d9f('0x3c'))){throw new db[(_0x5d9f('0x3a'))][(_0x5d9f('0x3d'))](_0x5d9f('0x3e'));}if(!_0x50d62b['body'][_0x5d9f('0x37')](_0x5d9f('0x3f'))){throw new db[(_0x5d9f('0x3a'))][(_0x5d9f('0x3d'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0xa77a25=JSON['parse'](_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x3f')]);}catch(_0x4449fa){logger[_0x5d9f('0x32')](_0x4449fa);throw new db['Sequelize'][(_0x5d9f('0x3d'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x399572=[_0x5d9f('0x40'),'faxqueue',_0x5d9f('0x41'),_0x5d9f('0x42'),_0x5d9f('0x43'),_0x5d9f('0x44'),_0x5d9f('0x45'),_0x5d9f('0x46'),'user'];if(_['some'](_0xa77a25,function(_0x4a8a1e){return!_[_0x5d9f('0x47')](_0x399572,_0x4a8a1e[_0x5d9f('0x48')][_0x5d9f('0x49')]());})){throw new db['Sequelize']['ValidationError'](_0x5d9f('0x4a'));}}}var _0x1b6d7a={};_0x1b6d7a[_0x5d9f('0x4b')]=_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x37')](_0x5d9f('0x4b'))?_0x50d62b['body'][_0x5d9f('0x4b')]:_0x50d62b['user'][_0x5d9f('0x4c')];_0x1b6d7a['recipientsDescription']=_[_0x5d9f('0x4d')](_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x4e')])?null:_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x4e')];_0x1b6d7a[_0x5d9f('0x4f')]=_0x50d62b[_0x5d9f('0x36')][_0x5d9f('0x4f')]||![];_0x1b6d7a['SenderId']=_0x50d62b[_0x5d9f('0x50')]['id'];return getContent(_0x50d62b[_0x5d9f('0x36')])[_0x5d9f('0x30')](function(_0x2677b4){_0x1b6d7a['body']=_0x2677b4;return getRecipients(_0xa77a25);})[_0x5d9f('0x30')](function(_0x379476){_0x1b6d7a[_0x5d9f('0x51')]=_[_0x5d9f('0x52')](_0x379476)[_0x5d9f('0x53')](',');return db['sequelize'][_0x5d9f('0x54')](function(_0x12ba4a){return db[_0x5d9f('0x55')][_0x5d9f('0x56')](_0x1b6d7a,{'raw':!![],'transaction':_0x12ba4a})[_0x5d9f('0x30')](function(_0x1a40c0){var _0x33c2d3={'sender':_0x1b6d7a[_0x5d9f('0x4b')],'description':_0x1b6d7a['recipientsDescription'],'content':_0x1b6d7a[_0x5d9f('0x36')],'beep':_0x1b6d7a[_0x5d9f('0x4f')]};_0x379476[_0x5d9f('0x57')](function(_0x4b9b9a){_0x33c2d3[_0x5d9f('0x58')]=_0x4b9b9a;socket[_0x5d9f('0x59')](_0x5d9f('0x5a'),_0x33c2d3);});return _0x1a40c0;});});})['then'](respondWithResult(_0x5f87ac,0xc9))[_0x5d9f('0x5b')](handleError(_0x5f87ac,null));};function getContent(_0x1c5be1){return new BPromise(function(_0x5ceae8,_0x5c8055){if(_0x1c5be1[_0x5d9f('0x38')]){_0x5ceae8(_0x1c5be1[_0x5d9f('0x38')]);return;}return db[_0x5d9f('0x5c')][_0x5d9f('0x5d')]({'attributes':['html'],'where':{'id':_0x1c5be1['TemplateId']},'raw':!![]})['then'](function(_0x20776f){if(!_0x20776f)throw new db['Sequelize']['ValidationError'](_0x5d9f('0x5e'));var _0x3e8986=Mustache[_0x5d9f('0x5f')](_0x20776f['html'],_0x1c5be1[_0x5d9f('0x3c')]);_0x5ceae8(_0x3e8986);})[_0x5d9f('0x5b')](function(_0x16706c){_0x5c8055(_0x16706c);});});}function getRecipients(_0x5de2bc){return new BPromise(function(_0x4169b5,_0x125674){var _0x31d124=[];var _0x4c43eb=[];_0x5de2bc[_0x5d9f('0x57')](function(_0x2ab163){var _0xe9f445=_[_0x5d9f('0x60')](_0x2ab163[_0x5d9f('0x48')][_0x5d9f('0x49')]());if(_0xe9f445===_0x5d9f('0x61')){_0x31d124=_[_0x5d9f('0x62')](_0x31d124,_0x2ab163[_0x5d9f('0x63')]);}else{if(_[_0x5d9f('0x47')](_0xe9f445,_0x5d9f('0x64')))_0xe9f445=_0xe9f445['replace'](_0x5d9f('0x64'),'Queue');_0x2ab163['ids'][_0x5d9f('0x57')](function(_0x37a262){_0x4c43eb[_0x5d9f('0x65')](getAgents(_0xe9f445,_0x37a262));});}});return BPromise[_0x5d9f('0x66')](_0x4c43eb)['then'](function(_0x51d420){_0x31d124=_[_0x5d9f('0x62')](_0x31d124,_[_0x5d9f('0x67')](_0x51d420));_0x4169b5(_0x31d124);})['catch'](function(_0x128186){_0x125674(_0x128186);});});}function getAgents(_0x2888ff,_0x25499b){return new BPromise(function(_0x541a14,_0x38b0fa){return db[_0x2888ff][_0x5d9f('0x5d')]({'where':{'id':_0x25499b}})[_0x5d9f('0x30')](function(_0x2113ad){return _0x2113ad[_0x5d9f('0x68')]({'attributes':['id'],'raw':!![]})[_0x5d9f('0x30')](function(_0x3b8e3d){var _0x5ad068=_[_0x5d9f('0x69')](_0x3b8e3d,'id');_0x541a14(_0x5ad068);});})[_0x5d9f('0x5b')](function(_0x12a942){_0x38b0fa(_0x12a942);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 7da75d8..8912ed4 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 _0xd853=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd853,0xac));var _0x3d85=function(_0x3dff0d,_0x4d59ff){_0x3dff0d=_0x3dff0d-0x0;var _0x352383=_0xd853[_0x3dff0d];return _0x352383;};'use strict';var EventEmitter=require(_0x3d85('0x0'));var UserNotification=require(_0x3d85('0x1'))['db'][_0x3d85('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3d85('0x3')](0x0);var events={'afterCreate':_0x3d85('0x4'),'afterUpdate':_0x3d85('0x5'),'afterDestroy':_0x3d85('0x6')};function emitEvent(_0xd54a79){return function(_0x21874d,_0x1d0385,_0x59c3b0){UserNotificationEvents[_0x3d85('0x7')](_0xd54a79+':'+_0x21874d['id'],_0x21874d);UserNotificationEvents[_0x3d85('0x7')](_0xd54a79,_0x21874d);_0x59c3b0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x3d85('0x8')](e,emitEvent(event));}}module[_0x3d85('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x8d34=['events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1da582,_0x2dc08d){var _0x11cb30=function(_0x748692){while(--_0x748692){_0x1da582['push'](_0x1da582['shift']());}};_0x11cb30(++_0x2dc08d);}(_0x8d34,0x1f4));var _0x48d3=function(_0x516dae,_0x4e14c8){_0x516dae=_0x516dae-0x0;var _0x2344c5=_0x8d34[_0x516dae];return _0x2344c5;};'use strict';var EventEmitter=require(_0x48d3('0x0'));var UserNotification=require(_0x48d3('0x1'))['db'][_0x48d3('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x48d3('0x3')](0x0);var events={'afterCreate':_0x48d3('0x4'),'afterUpdate':_0x48d3('0x5'),'afterDestroy':_0x48d3('0x6')};function emitEvent(_0xb2c5ed){return function(_0x1d91b7,_0x105432,_0x49a208){UserNotificationEvents[_0x48d3('0x7')](_0xb2c5ed+':'+_0x1d91b7['id'],_0x1d91b7);UserNotificationEvents[_0x48d3('0x7')](_0xb2c5ed,_0x1d91b7);_0x49a208(null);};}for(var e in events){if(events[_0x48d3('0x8')](e)){var event=events[e];UserNotification[_0x48d3('0x9')](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 cb8f7f6..563a801 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 _0x3e2d=['exports','define','userNotifications','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x443f42,_0x248e76){var _0x3aca21=function(_0x4537f5){while(--_0x4537f5){_0x443f42['push'](_0x443f42['shift']());}};_0x3aca21(++_0x248e76);}(_0x3e2d,0x142));var _0xd3e2=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x3e2d[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xd3e2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd3e2('0x1'));var BPromise=require(_0xd3e2('0x2'));var rp=require(_0xd3e2('0x3'));var fs=require('fs');var path=require(_0xd3e2('0x4'));var rimraf=require(_0xd3e2('0x5'));var config=require(_0xd3e2('0x6'));var attributes=require(_0xd3e2('0x7'));module[_0xd3e2('0x8')]=function(_0x37bad9,_0x58fc16){return _0x37bad9[_0xd3e2('0x9')]('UserNotification',attributes,{'tableName':_0xd3e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb197=['rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0xb197,0xad));var _0x7b19=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xb197[_0x1f3aec];return _0x409f0d;};'use strict';var _=require(_0x7b19('0x0'));var util=require(_0x7b19('0x1'));var logger=require(_0x7b19('0x2'))(_0x7b19('0x3'));var moment=require(_0x7b19('0x4'));var BPromise=require(_0x7b19('0x5'));var rp=require(_0x7b19('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b19('0x7'));var config=require(_0x7b19('0x8'));var attributes=require(_0x7b19('0x9'));module[_0x7b19('0xa')]=function(_0x5c3d35,_0x1ff8cd){return _0x5c3d35['define'](_0x7b19('0xb'),attributes,{'tableName':_0x7b19('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b19('0xd'),'collate':_0x7b19('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7350769..eb13c2a 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 _0x36dd=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./userNotification.socket','register','then','info','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x98b363,_0x5f1146){var _0x103b5c=function(_0x495442){while(--_0x495442){_0x98b363['push'](_0x98b363['shift']());}};_0x103b5c(++_0x5f1146);}(_0x36dd,0x13f));var _0xd36d=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x36dd[_0xa60623];return _0x4a6487;};'use strict';var _=require(_0xd36d('0x0'));var util=require(_0xd36d('0x1'));var moment=require(_0xd36d('0x2'));var BPromise=require('bluebird');var rs=require(_0xd36d('0x3'));var fs=require('fs');var Redis=require(_0xd36d('0x4'));var db=require(_0xd36d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd36d('0x6'))(_0xd36d('0x7'));var config=require(_0xd36d('0x8'));var jayson=require(_0xd36d('0x9'));var client=jayson[_0xd36d('0xa')][_0xd36d('0xb')]({'port':0x232a});config[_0xd36d('0xc')]=_[_0xd36d('0xd')](config[_0xd36d('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd36d('0xc')]));require(_0xd36d('0xe'))[_0xd36d('0xf')](socket);function respondWithRpcPromise(_0x30bf53,_0x3c9141,_0x5e7044){return new BPromise(function(_0xa69248,_0x5e7c2c){return client['request'](_0x30bf53,_0x5e7044)[_0xd36d('0x10')](function(_0x3dae36){logger[_0xd36d('0x11')]('UserNotification,\x20%s,\x20%s',_0x3c9141,_0xd36d('0x12'));logger[_0xd36d('0x13')](_0xd36d('0x14'),_0x3c9141,_0xd36d('0x12'),JSON[_0xd36d('0x15')](_0x3dae36));if(_0x3dae36['error']){if(_0x3dae36[_0xd36d('0x16')][_0xd36d('0x17')]===0x1f4){logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x3dae36['error']['message']);return _0x5e7c2c(_0x3dae36[_0xd36d('0x16')]['message']);}logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x3dae36[_0xd36d('0x16')]['message']);return _0xa69248(_0x3dae36[_0xd36d('0x16')][_0xd36d('0x19')]);}else{logger[_0xd36d('0x11')](_0xd36d('0x18'),_0x3c9141,_0xd36d('0x12'));_0xa69248(_0x3dae36[_0xd36d('0x1a')][_0xd36d('0x19')]);}})['catch'](function(_0x4b0e7d){logger[_0xd36d('0x16')](_0xd36d('0x18'),_0x3c9141,_0x4b0e7d);_0x5e7c2c(_0x4b0e7d);});});} \ No newline at end of file +var _0xf980=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x286901,_0x47e586){var _0x187f50=function(_0x4550c9){while(--_0x4550c9){_0x286901['push'](_0x286901['shift']());}};_0x187f50(++_0x47e586);}(_0xf980,0x1c1));var _0x0f98=function(_0x27a0bd,_0x41e831){_0x27a0bd=_0x27a0bd-0x0;var _0xa68da6=_0xf980[_0x27a0bd];return _0xa68da6;};'use strict';var _=require(_0x0f98('0x0'));var util=require(_0x0f98('0x1'));var moment=require(_0x0f98('0x2'));var BPromise=require(_0x0f98('0x3'));var rs=require(_0x0f98('0x4'));var fs=require('fs');var Redis=require(_0x0f98('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0f98('0x6'));var logger=require(_0x0f98('0x7'))(_0x0f98('0x8'));var config=require(_0x0f98('0x9'));var jayson=require(_0x0f98('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0f98('0xb')](config[_0x0f98('0xc')],{'host':_0x0f98('0xd'),'port':0x18eb});var socket=require(_0x0f98('0xe'))(new Redis(config[_0x0f98('0xc')]));require(_0x0f98('0xf'))[_0x0f98('0x10')](socket);function respondWithRpcPromise(_0x1ea1ae,_0x4e0e05,_0x151bfe){return new BPromise(function(_0x5c0726,_0xbe93fe){return client[_0x0f98('0x11')](_0x1ea1ae,_0x151bfe)[_0x0f98('0x12')](function(_0x4b9cf4){logger[_0x0f98('0x13')](_0x0f98('0x14'),_0x4e0e05,'request\x20sent');logger[_0x0f98('0x15')](_0x0f98('0x16'),_0x4e0e05,_0x0f98('0x17'),JSON['stringify'](_0x4b9cf4));if(_0x4b9cf4[_0x0f98('0x18')]){if(_0x4b9cf4['error'][_0x0f98('0x19')]===0x1f4){logger[_0x0f98('0x18')](_0x0f98('0x14'),_0x4e0e05,_0x4b9cf4[_0x0f98('0x18')][_0x0f98('0x1a')]);return _0xbe93fe(_0x4b9cf4[_0x0f98('0x18')][_0x0f98('0x1a')]);}logger[_0x0f98('0x18')](_0x0f98('0x14'),_0x4e0e05,_0x4b9cf4['error'][_0x0f98('0x1a')]);return _0x5c0726(_0x4b9cf4['error'][_0x0f98('0x1a')]);}else{logger[_0x0f98('0x13')]('UserNotification,\x20%s,\x20%s',_0x4e0e05,_0x0f98('0x17'));_0x5c0726(_0x4b9cf4['result']['message']);}})[_0x0f98('0x1b')](function(_0x4163c8){logger[_0x0f98('0x18')]('UserNotification,\x20%s,\x20%s',_0x4e0e05,_0x4163c8);_0xbe93fe(_0x4163c8);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 3a51b8e..7de17ca 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 _0x76c1=['removeListener','length','userNotification:','./userNotification.events','remove','update'];(function(_0xde9083,_0x40ea54){var _0x191c72=function(_0x415fed){while(--_0x415fed){_0xde9083['push'](_0xde9083['shift']());}};_0x191c72(++_0x40ea54);}(_0x76c1,0xab));var _0x176c=function(_0xf0ec6e,_0xa183d3){_0xf0ec6e=_0xf0ec6e-0x0;var _0x8bbc27=_0x76c1[_0xf0ec6e];return _0x8bbc27;};'use strict';var UserNotificationEvents=require(_0x176c('0x0'));var events=['save',_0x176c('0x1'),_0x176c('0x2')];function createListener(_0x48b361,_0x5e7601){return function(_0x465a8e){_0x5e7601['emit'](_0x48b361,_0x465a8e);};}function removeListener(_0x5bbe4b,_0x5746eb){return function(){UserNotificationEvents[_0x176c('0x3')](_0x5bbe4b,_0x5746eb);};}exports['register']=function(_0x252f2d){for(var _0x4f8090=0x0,_0x5020dc=events[_0x176c('0x4')];_0x4f8090<_0x5020dc;_0x4f8090++){var _0x25c80d=events[_0x4f8090];var _0x4f9311=createListener(_0x176c('0x5')+_0x25c80d,_0x252f2d);UserNotificationEvents['on'](_0x25c80d,_0x4f9311);}}; \ No newline at end of file +var _0xba81=['update','removeListener','length','./userNotification.events','save','remove'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xba81,0x14d));var _0x1ba8=function(_0x53b199,_0x38ff21){_0x53b199=_0x53b199-0x0;var _0x1ba42d=_0xba81[_0x53b199];return _0x1ba42d;};'use strict';var UserNotificationEvents=require(_0x1ba8('0x0'));var events=[_0x1ba8('0x1'),_0x1ba8('0x2'),_0x1ba8('0x3')];function createListener(_0x3b5a43,_0x23d29a){return function(_0x5378c5){_0x23d29a['emit'](_0x3b5a43,_0x5378c5);};}function removeListener(_0xc4ea65,_0x3be437){return function(){UserNotificationEvents[_0x1ba8('0x4')](_0xc4ea65,_0x3be437);};}exports['register']=function(_0x17acc7){for(var _0x456587=0x0,_0x24ced4=events[_0x1ba8('0x5')];_0x456587<_0x24ced4;_0x456587++){var _0x5698b3=events[_0x456587];var _0x1cfbec=createListener('userNotification:'+_0x5698b3,_0x17acc7);UserNotificationEvents['on'](_0x5698b3,_0x1cfbec);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 46579ce..422f67a 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ac9b1,_0x3d7bf2){var _0x55792b=function(_0x16e132){while(--_0x16e132){_0x2ac9b1['push'](_0x2ac9b1['shift']());}};_0x55792b(++_0x3d7bf2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x48ec91,_0x212edc){_0x48ec91=_0x48ec91-0x0;var _0x22766c=_0xcb91[_0x48ec91];return _0x22766c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x177207,_0x261a5f){var _0x279d5b=function(_0xdb2858){while(--_0xdb2858){_0x177207['push'](_0x177207['shift']());}};_0x279d5b(++_0x261a5f);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 756afe1..4eed9a2 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 _0xd4f7=['sequelize'];(function(_0x4e00f1,_0x427920){var _0x2c95f4=function(_0xc445e0){while(--_0xc445e0){_0x4e00f1['push'](_0x4e00f1['shift']());}};_0x2c95f4(++_0x427920);}(_0xd4f7,0x8c));var _0x7d4f=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xd4f7[_0x54edc9];return _0x2ae7a9;};'use strict';var Sequelize=require(_0x7d4f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x64ea=['INTEGER','exports'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x64ea,0x85));var _0xa64e=function(_0x40d078,_0x541e13){_0x40d078=_0x40d078-0x0;var _0x52c06b=_0x64ea[_0x40d078];return _0x52c06b;};'use strict';var Sequelize=require('sequelize');module[_0xa64e('0x0')]={'penalty':{'type':Sequelize[_0xa64e('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 c101bf1..19c752f 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 _0x6fdb=['api','moment','bluebird','path','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash','util','../../config/logger'];(function(_0x7457fe,_0x564a5e){var _0x57a6e4=function(_0x566577){while(--_0x566577){_0x7457fe['push'](_0x7457fe['shift']());}};_0x57a6e4(++_0x564a5e);}(_0x6fdb,0x1e1));var _0xb6fd=function(_0xd72a57,_0x5b119d){_0xd72a57=_0xd72a57-0x0;var _0x37c1f2=_0x6fdb[_0xd72a57];return _0x37c1f2;};'use strict';var _=require(_0xb6fd('0x0'));var util=require(_0xb6fd('0x1'));var logger=require(_0xb6fd('0x2'))(_0xb6fd('0x3'));var moment=require(_0xb6fd('0x4'));var BPromise=require(_0xb6fd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb6fd('0x6'));var rimraf=require('rimraf');var config=require(_0xb6fd('0x7'));var attributes=require(_0xb6fd('0x8'));module['exports']=function(_0x2590d5,_0x196b5c){return _0x2590d5[_0xb6fd('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xb6fd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86b7=['UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define'];(function(_0x46c4ce,_0x41e737){var _0x2e39f5=function(_0xfdba19){while(--_0xfdba19){_0x46c4ce['push'](_0x46c4ce['shift']());}};_0x2e39f5(++_0x41e737);}(_0x86b7,0xc2));var _0x786b=function(_0x21ec2a,_0x5838f2){_0x21ec2a=_0x21ec2a-0x0;var _0x20cd5a=_0x86b7[_0x21ec2a];return _0x20cd5a;};'use strict';var _=require(_0x786b('0x0'));var util=require('util');var logger=require(_0x786b('0x1'))(_0x786b('0x2'));var moment=require(_0x786b('0x3'));var BPromise=require(_0x786b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x786b('0x5'));var config=require(_0x786b('0x6'));var attributes=require(_0x786b('0x7'));module[_0x786b('0x8')]=function(_0x33f140,_0x5e5dfa){return _0x33f140[_0x786b('0x9')](_0x786b('0xa'),attributes,{'tableName':_0x786b('0xb'),'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 c7647b3..fb4f1da 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 _0xa6d4=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','catch','moment','bluebird'];(function(_0x57e5e2,_0x50f2f0){var _0x1215f9=function(_0xc7ab72){while(--_0xc7ab72){_0x57e5e2['push'](_0x57e5e2['shift']());}};_0x1215f9(++_0x50f2f0);}(_0xa6d4,0x140));var _0x4a6d=function(_0x397a32,_0x1a6cf5){_0x397a32=_0x397a32-0x0;var _0x135033=_0xa6d4[_0x397a32];return _0x135033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4a6d('0x0'));var BPromise=require(_0x4a6d('0x1'));var rs=require(_0x4a6d('0x2'));var fs=require('fs');var Redis=require(_0x4a6d('0x3'));var db=require(_0x4a6d('0x4'))['db'];var utils=require(_0x4a6d('0x5'));var logger=require(_0x4a6d('0x6'))(_0x4a6d('0x7'));var config=require(_0x4a6d('0x8'));var jayson=require(_0x4a6d('0x9'));var client=jayson[_0x4a6d('0xa')][_0x4a6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16c82d,_0x5ed03b,_0x324d09){return new BPromise(function(_0x116610,_0x25aeb4){return client[_0x4a6d('0xc')](_0x16c82d,_0x324d09)[_0x4a6d('0xd')](function(_0x3bedc4){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ed03b,_0x4a6d('0xe'));logger[_0x4a6d('0xf')](_0x4a6d('0x10'),_0x5ed03b,_0x4a6d('0xe'),JSON[_0x4a6d('0x11')](_0x3bedc4));if(_0x3bedc4[_0x4a6d('0x12')]){if(_0x3bedc4['error'][_0x4a6d('0x13')]===0x1f4){logger[_0x4a6d('0x12')](_0x4a6d('0x14'),_0x5ed03b,_0x3bedc4[_0x4a6d('0x12')][_0x4a6d('0x15')]);return _0x25aeb4(_0x3bedc4[_0x4a6d('0x12')]['message']);}logger['error'](_0x4a6d('0x14'),_0x5ed03b,_0x3bedc4['error'][_0x4a6d('0x15')]);return _0x116610(_0x3bedc4[_0x4a6d('0x12')][_0x4a6d('0x15')]);}else{logger['info'](_0x4a6d('0x14'),_0x5ed03b,'request\x20sent');_0x116610(_0x3bedc4['result']['message']);}})[_0x4a6d('0x16')](function(_0x1430b2){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ed03b,_0x1430b2);_0x25aeb4(_0x1430b2);});});} \ No newline at end of file +var _0x8959=['client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x8959,0x195));var _0x9895=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x8959[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var util=require(_0x9895('0x0'));var moment=require(_0x9895('0x1'));var BPromise=require(_0x9895('0x2'));var rs=require(_0x9895('0x3'));var fs=require('fs');var Redis=require(_0x9895('0x4'));var db=require(_0x9895('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9895('0x6'))(_0x9895('0x7'));var config=require('../../config/environment');var jayson=require(_0x9895('0x8'));var client=jayson[_0x9895('0x9')][_0x9895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9ff959,_0x24d153,_0x1e3420){return new BPromise(function(_0x1e9514,_0x2e22c7){return client['request'](_0x9ff959,_0x1e3420)['then'](function(_0x261e0a){logger[_0x9895('0xb')](_0x9895('0xc'),_0x24d153,'request\x20sent');logger['debug'](_0x9895('0xd'),_0x24d153,'request\x20sent',JSON['stringify'](_0x261e0a));if(_0x261e0a[_0x9895('0xe')]){if(_0x261e0a['error'][_0x9895('0xf')]===0x1f4){logger[_0x9895('0xe')](_0x9895('0xc'),_0x24d153,_0x261e0a[_0x9895('0xe')][_0x9895('0x10')]);return _0x2e22c7(_0x261e0a[_0x9895('0xe')]['message']);}logger[_0x9895('0xe')](_0x9895('0xc'),_0x24d153,_0x261e0a[_0x9895('0xe')][_0x9895('0x10')]);return _0x1e9514(_0x261e0a[_0x9895('0xe')][_0x9895('0x10')]);}else{logger[_0x9895('0xb')](_0x9895('0xc'),_0x24d153,'request\x20sent');_0x1e9514(_0x261e0a['result'][_0x9895('0x10')]);}})[_0x9895('0x11')](function(_0x4eec74){logger[_0x9895('0xe')](_0x9895('0xc'),_0x24d153,_0x4eec74);_0x2e22c7(_0x4eec74);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index dfe5ca4..e7135bc 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 _0x5336=['exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x5336,0xa9));var _0x6533=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x5336[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require(_0x6533('0x0'));var path=require(_0x6533('0x1'));var timeout=require('connect-timeout');var express=require(_0x6533('0x2'));var router=express['Router']();var fs_extra=require(_0x6533('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6533('0x4'));var config=require(_0x6533('0x5'));var controller=require(_0x6533('0x6'));router['get']('/',auth[_0x6533('0x7')](),controller['index']);router[_0x6533('0x8')](_0x6533('0x9'),auth[_0x6533('0x7')](),controller[_0x6533('0xa')]);router[_0x6533('0x8')](_0x6533('0xb'),auth[_0x6533('0x7')](),controller[_0x6533('0xc')]);router[_0x6533('0x8')](_0x6533('0xd'),auth[_0x6533('0x7')](),controller[_0x6533('0xe')]);router[_0x6533('0x8')](_0x6533('0xf'),auth[_0x6533('0x7')](),controller[_0x6533('0x10')]);router[_0x6533('0x11')]('/',auth[_0x6533('0x7')](),controller[_0x6533('0x12')]);router[_0x6533('0x11')](_0x6533('0x13'),auth[_0x6533('0x7')](),controller['clone']);router['post'](_0x6533('0xd'),auth[_0x6533('0x7')](),controller[_0x6533('0x14')]);router[_0x6533('0x11')](_0x6533('0xf'),auth['isAuthenticated'](),controller[_0x6533('0x15')]);router[_0x6533('0x16')](_0x6533('0xb'),auth['isAuthenticated'](),controller[_0x6533('0x17')]);router[_0x6533('0x18')](_0x6533('0xb'),auth[_0x6533('0x7')](),controller[_0x6533('0x19')]);router['delete'](_0x6533('0xd'),auth[_0x6533('0x7')](),controller['removeSections']);router[_0x6533('0x18')](_0x6533('0xf'),auth['isAuthenticated'](),controller[_0x6533('0x1a')]);module[_0x6533('0x1b')]=router; \ No newline at end of file +var _0xf864=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','getSections','/:id/resources','getResources','create','/:id/clone','clone','post','addSections','addResources','put','/:id','update','delete','destroy','/:id/sections','removeSections','removeResources','exports','util','connect-timeout'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0xf864,0x1de));var _0x4f86=function(_0x3ef678,_0x1ac66c){_0x3ef678=_0x3ef678-0x0;var _0xbbf881=_0xf864[_0x3ef678];return _0xbbf881;};'use strict';var multer=require('multer');var util=require(_0x4f86('0x0'));var path=require('path');var timeout=require(_0x4f86('0x1'));var express=require(_0x4f86('0x2'));var router=express[_0x4f86('0x3')]();var fs_extra=require(_0x4f86('0x4'));var auth=require(_0x4f86('0x5'));var interaction=require(_0x4f86('0x6'));var config=require(_0x4f86('0x7'));var controller=require('./userProfile.controller');router[_0x4f86('0x8')]('/',auth[_0x4f86('0x9')](),controller[_0x4f86('0xa')]);router[_0x4f86('0x8')](_0x4f86('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x4f86('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x4f86('0x8')]('/:id/sections',auth[_0x4f86('0x9')](),controller[_0x4f86('0xc')]);router[_0x4f86('0x8')](_0x4f86('0xd'),auth['isAuthenticated'](),controller[_0x4f86('0xe')]);router['post']('/',auth[_0x4f86('0x9')](),controller[_0x4f86('0xf')]);router['post'](_0x4f86('0x10'),auth[_0x4f86('0x9')](),controller[_0x4f86('0x11')]);router[_0x4f86('0x12')]('/:id/sections',auth[_0x4f86('0x9')](),controller[_0x4f86('0x13')]);router[_0x4f86('0x12')](_0x4f86('0xd'),auth[_0x4f86('0x9')](),controller[_0x4f86('0x14')]);router[_0x4f86('0x15')](_0x4f86('0x16'),auth[_0x4f86('0x9')](),controller[_0x4f86('0x17')]);router[_0x4f86('0x18')](_0x4f86('0x16'),auth['isAuthenticated'](),controller[_0x4f86('0x19')]);router[_0x4f86('0x18')](_0x4f86('0x1a'),auth[_0x4f86('0x9')](),controller[_0x4f86('0x1b')]);router[_0x4f86('0x18')](_0x4f86('0xd'),auth[_0x4f86('0x9')](),controller[_0x4f86('0x1c')]);module[_0x4f86('0x1d')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8e9f442..e791421 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 _0xb8d2=['getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join'];(function(_0x39bc44,_0x1d4373){var _0x2916d8=function(_0x1767ac){while(--_0x1767ac){_0x39bc44['push'](_0x39bc44['shift']());}};_0x2916d8(++_0x1d4373);}(_0xb8d2,0xb8));var _0x2b8d=function(_0x3a4c07,_0x18440c){_0x3a4c07=_0x3a4c07-0x0;var _0x5a4943=_0xb8d2[_0x3a4c07];return _0x5a4943;};'use strict';var Sequelize=require(_0x2b8d('0x0'));module[_0x2b8d('0x1')]={'name':{'type':Sequelize[_0x2b8d('0x2')],'allowNull':![],'unique':_0x2b8d('0x3')},'crudPermissions':{'type':Sequelize[_0x2b8d('0x2')],'set':function(_0x1c9130){this[_0x2b8d('0x4')]('crudPermissions',_0x1c9130?_0x1c9130[_0x2b8d('0x5')](''):[]);},'get':function(){return this[_0x2b8d('0x6')](_0x2b8d('0x7'))?this['getDataValue'](_0x2b8d('0x7'))[_0x2b8d('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2b8d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2b8d('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xda28=['setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x5d05d4,_0x13fb7c){var _0xa8c366=function(_0x22e7ce){while(--_0x22e7ce){_0x5d05d4['push'](_0x5d05d4['shift']());}};_0xa8c366(++_0x13fb7c);}(_0xda28,0xef));var _0x8da2=function(_0x15d754,_0x149800){_0x15d754=_0x15d754-0x0;var _0x56830a=_0xda28[_0x15d754];return _0x56830a;};'use strict';var Sequelize=require(_0x8da2('0x0'));module[_0x8da2('0x1')]={'name':{'type':Sequelize[_0x8da2('0x2')],'allowNull':![],'unique':_0x8da2('0x3')},'crudPermissions':{'type':Sequelize[_0x8da2('0x2')],'set':function(_0x543bef){this[_0x8da2('0x4')]('crudPermissions',_0x543bef?_0x543bef[_0x8da2('0x5')](''):[]);},'get':function(){return this[_0x8da2('0x6')]('crudPermissions')?this[_0x8da2('0x6')](_0x8da2('0x7'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8da2('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8da2('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8da2('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8da2('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8da2('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8da2('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index f019ff6..6736ca9 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 _0xb5fa=['getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','UserProfile','include','findAll','rows','catch','show','keys','rawAttributes','fields','length','includeAll','merge','find','create','body','clone','get','updatedAt','omit','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','params','describe','addSections','sectionId','each','push'];(function(_0x404d07,_0x114ff6){var _0xaf09a8=function(_0x3d1cca){while(--_0x3d1cca){_0x404d07['push'](_0x404d07['shift']());}};_0xaf09a8(++_0x114ff6);}(_0xb5fa,0xf8));var _0xab5f=function(_0x5a8ee3,_0x5864a3){_0x5a8ee3=_0x5a8ee3-0x0;var _0x59042a=_0xb5fa[_0x5a8ee3];return _0x59042a;};'use strict';var emlformat=require(_0xab5f('0x0'));var rimraf=require(_0xab5f('0x1'));var zipdir=require(_0xab5f('0x2'));var jsonpatch=require(_0xab5f('0x3'));var rp=require(_0xab5f('0x4'));var moment=require(_0xab5f('0x5'));var BPromise=require(_0xab5f('0x6'));var Mustache=require(_0xab5f('0x7'));var util=require(_0xab5f('0x8'));var path=require(_0xab5f('0x9'));var sox=require(_0xab5f('0xa'));var csv=require(_0xab5f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab5f('0xc'));var crypto=require(_0xab5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab5f('0xe'));var toCsv=require(_0xab5f('0xb'));var querystring=require(_0xab5f('0xf'));var Papa=require(_0xab5f('0x10'));var Redis=require(_0xab5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5f('0x13'));var logger=require('../../config/logger')(_0xab5f('0x14'));var utils=require(_0xab5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xab5f('0x16')]=_[_0xab5f('0x17')](config['redis'],{'host':_0xab5f('0x18'),'port':0x18eb});var socket=require(_0xab5f('0x19'))(new Redis(config[_0xab5f('0x16')]));require(_0xab5f('0x1a'))[_0xab5f('0x1b')](socket);function respondWithStatusCode(_0x4101ee,_0x4319c7){_0x4319c7=_0x4319c7||0xcc;return function(_0x425053){if(_0x425053){return _0x4101ee[_0xab5f('0x1c')](_0x4319c7);}return _0x4101ee[_0xab5f('0x1d')](_0x4319c7)[_0xab5f('0x1e')]();};}function respondWithResult(_0x30089f,_0x177e6d){_0x177e6d=_0x177e6d||0xc8;return function(_0x22588b){if(_0x22588b){return _0x30089f[_0xab5f('0x1d')](_0x177e6d)[_0xab5f('0x1f')](_0x22588b);}};}function respondWithFilteredResult(_0xecd649,_0x340190){return function(_0x4aca7d){if(_0x4aca7d){var _0x2caadb=typeof _0x340190['offset']===_0xab5f('0x20')&&typeof _0x340190[_0xab5f('0x21')]===_0xab5f('0x20');var _0x1d6c2b=_0x4aca7d['count'];var _0xd2df62=_0x2caadb?0x0:_0x340190[_0xab5f('0x22')];var _0x3bca15=_0x2caadb?_0x4aca7d[_0xab5f('0x23')]:_0x340190[_0xab5f('0x22')]+_0x340190[_0xab5f('0x21')];var _0x58cfa4;if(_0x3bca15>=_0x1d6c2b){_0x3bca15=_0x1d6c2b;_0x58cfa4=0xc8;}else{_0x58cfa4=0xce;}_0xecd649[_0xab5f('0x1d')](_0x58cfa4);return _0xecd649[_0xab5f('0x24')](_0xab5f('0x25'),_0xd2df62+'-'+_0x3bca15+'/'+_0x1d6c2b)['json'](_0x4aca7d);}return null;};}function patchUpdates(_0xb47124){return function(_0x134a23){try{jsonpatch[_0xab5f('0x26')](_0x134a23,_0xb47124,!![]);}catch(_0x237704){return BPromise[_0xab5f('0x27')](_0x237704);}return _0x134a23[_0xab5f('0x28')]();};}function saveUpdates(_0x4b3127,_0x55daaf){return function(_0x3c5847){if(_0x3c5847){return _0x3c5847[_0xab5f('0x29')](_0x4b3127)[_0xab5f('0x2a')](function(_0x39bf0f){return _0x39bf0f;});}return null;};}function removeEntity(_0x3fb403,_0x49972a){return function(_0x3db1a6){if(_0x3db1a6){return _0x3db1a6[_0xab5f('0x2b')]()['then'](function(){_0x3fb403[_0xab5f('0x1d')](0xcc)[_0xab5f('0x1e')]();});}};}function handleEntityNotFound(_0x56e074,_0x391fec){return function(_0x4fee82){if(!_0x4fee82){_0x56e074[_0xab5f('0x1c')](0x194);}return _0x4fee82;};}function handleError(_0x2c0a1a,_0x1e1fa9){_0x1e1fa9=_0x1e1fa9||0x1f4;return function(_0x239229){logger['error'](_0x239229[_0xab5f('0x2c')]);if(_0x239229[_0xab5f('0x2d')]){delete _0x239229[_0xab5f('0x2d')];}_0x2c0a1a[_0xab5f('0x1d')](_0x1e1fa9)[_0xab5f('0x2e')](_0x239229);};}exports['index']=function(_0x5c6229,_0x7f5308){var _0x464287={},_0x290df8={},_0x274951={'count':0x0,'rows':[]};var _0x4bd729=_['map'](db['UserProfile']['rawAttributes'],function(_0x494c4b){return{'name':_0x494c4b[_0xab5f('0x2f')],'type':_0x494c4b[_0xab5f('0x30')][_0xab5f('0x31')]};});_0x290df8[_0xab5f('0x32')]=_[_0xab5f('0x33')](_0x4bd729,_0xab5f('0x2d'));_0x290df8[_0xab5f('0x34')]=_['keys'](_0x5c6229[_0xab5f('0x34')]);_0x290df8[_0xab5f('0x35')]=_[_0xab5f('0x36')](_0x290df8[_0xab5f('0x32')],_0x290df8[_0xab5f('0x34')]);_0x464287[_0xab5f('0x37')]=_['intersection'](_0x290df8[_0xab5f('0x32')],qs['fields'](_0x5c6229[_0xab5f('0x34')]['fields']));_0x464287['attributes']=_0x464287['attributes']['length']?_0x464287[_0xab5f('0x37')]:_0x290df8['model'];if(!_0x5c6229[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x464287[_0xab5f('0x21')]=qs[_0xab5f('0x21')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x21')]);_0x464287[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x5c6229['query'][_0xab5f('0x22')]);}_0x464287['order']=qs[_0xab5f('0x3a')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3a')]);_0x464287['where']=qs[_0xab5f('0x35')](_[_0xab5f('0x3b')](_0x5c6229[_0xab5f('0x34')],_0x290df8[_0xab5f('0x35')]),_0x4bd729);if(_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3c')]){_0x464287[_0xab5f('0x3d')]=_['merge'](_0x464287[_0xab5f('0x3d')],{'$or':_[_0xab5f('0x33')](_0x4bd729,function(_0x6298c4){if(_0x6298c4[_0xab5f('0x30')]!==_0xab5f('0x3e')){var _0x141a34={};_0x141a34[_0x6298c4[_0xab5f('0x2d')]]={'$like':'%'+_0x5c6229[_0xab5f('0x34')]['filter']+'%'};return _0x141a34;}})});}_0x464287=_['merge']({},_0x464287,_0x5c6229[_0xab5f('0x3f')]);var _0x384cbf={'where':_0x464287['where']};return db[_0xab5f('0x40')]['count'](_0x384cbf)[_0xab5f('0x2a')](function(_0x71490a){_0x274951['count']=_0x71490a;if(_0x5c6229[_0xab5f('0x34')]['includeAll']){_0x464287[_0xab5f('0x41')]=[{'all':!![]}];}return db[_0xab5f('0x40')][_0xab5f('0x42')](_0x464287);})[_0xab5f('0x2a')](function(_0x2da96f){_0x274951[_0xab5f('0x43')]=_0x2da96f;return _0x274951;})['then'](respondWithFilteredResult(_0x7f5308,_0x464287))[_0xab5f('0x44')](handleError(_0x7f5308,null));};exports[_0xab5f('0x45')]=function(_0x22249a,_0x2e81c6){var _0x366c5d={'raw':![],'where':{'id':_0x22249a['params']['id']}},_0x358e13={};_0x358e13[_0xab5f('0x32')]=_[_0xab5f('0x46')](db['UserProfile'][_0xab5f('0x47')]);_0x358e13['query']=_[_0xab5f('0x46')](_0x22249a[_0xab5f('0x34')]);_0x358e13['filters']=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],_0x358e13[_0xab5f('0x34')]);_0x366c5d[_0xab5f('0x37')]=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x22249a[_0xab5f('0x34')]['fields']));_0x366c5d[_0xab5f('0x37')]=_0x366c5d[_0xab5f('0x37')][_0xab5f('0x49')]?_0x366c5d['attributes']:_0x358e13[_0xab5f('0x32')];if(_0x22249a[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x366c5d[_0xab5f('0x41')]=[{'all':!![]}];}_0x366c5d=_[_0xab5f('0x4b')]({},_0x366c5d,_0x22249a[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x366c5d)[_0xab5f('0x2a')](handleEntityNotFound(_0x2e81c6,null))[_0xab5f('0x2a')](respondWithResult(_0x2e81c6,null))[_0xab5f('0x44')](handleError(_0x2e81c6,null));};exports[_0xab5f('0x4d')]=function(_0x4502ee,_0x28a126){return db['UserProfile'][_0xab5f('0x4d')](_0x4502ee[_0xab5f('0x4e')],{})[_0xab5f('0x2a')](respondWithResult(_0x28a126,0xc9))[_0xab5f('0x44')](handleError(_0x28a126,null));};exports[_0xab5f('0x4f')]=function(_0x500258,_0x5d1daf){var _0x1cd159={'where':{'id':_0x500258['params']['id']}},_0x20a959={};_0x20a959[_0xab5f('0x32')]=_[_0xab5f('0x46')](db[_0xab5f('0x40')][_0xab5f('0x47')]);_0x1cd159['attributes']=_['intersection'](_0x20a959[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x500258['query'][_0xab5f('0x48')]));_0x1cd159[_0xab5f('0x37')]=_0x1cd159['attributes']['length']?_0x1cd159[_0xab5f('0x37')]:_0x20a959['model'];if(_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x1cd159[_0xab5f('0x41')]=[{'all':!![]}];}_0x1cd159=_[_0xab5f('0x4b')]({},_0x1cd159,_0x500258[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x1cd159)[_0xab5f('0x2a')](handleEntityNotFound(_0x5d1daf,null))[_0xab5f('0x2a')](function(_0x454932){if(_0x454932){var _0x4c5f73=_0x454932[_0xab5f('0x50')]({'plain':!![]});_0x4c5f73=qs['omit'](_0x4c5f73,['id','createdAt',_0xab5f('0x51'),'crudPermissions']);_0x500258[_0xab5f('0x4e')]=_[_0xab5f('0x52')](_0x500258[_0xab5f('0x4e')],['id',_0xab5f('0x53'),_0xab5f('0x51')]);return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0xd56352){return db[_0xab5f('0x40')]['create'](_[_0xab5f('0x4b')](_0x4c5f73,_0x500258[_0xab5f('0x4e')]),{'include':_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0xd56352})['then'](function(_0x5b8ca3){var _0x438c04=_0x5b8ca3[_0xab5f('0x50')]({'plain':!![]});return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x500258['params']['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x42e5e6){if(_0x42e5e6){return BPromise['each'](_0x42e5e6,function(_0x454822){return new BPromise(function(_0x2a5f34,_0x3ca59d){if(_0x454822[_0xab5f('0x57')]===null||_0x454822[_0xab5f('0x57')]===0x1)_0x2a5f34(null);return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x454822['id']},'raw':!![]})['then'](function(_0x1f2084){var _0x8ea961=_[_0xab5f('0x33')](_0x1f2084,function(_0x2b13f9){return qs[_0xab5f('0x52')](_0x2b13f9,['id',_0xab5f('0x53'),'updatedAt','sectionId']);});_0x2a5f34(_0x8ea961);})[_0xab5f('0x44')](function(_0x3aa745){_0x3ca59d(_0x3aa745);});})['then'](function(_0x449ae7){var _0x183e7a=qs['omit'](_0x454822,['id',_0xab5f('0x53'),_0xab5f('0x51')]);_0x183e7a[_0xab5f('0x59')]=_0x438c04['id'];if(_0x449ae7)_0x183e7a[_0xab5f('0x5a')]=_0x449ae7;return _0x183e7a;})['then'](function(_0x5e6ff2){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x5e6ff2,{'include':[{'model':db[_0xab5f('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0xd56352});});})[_0xab5f('0x2a')](function(){return _0x438c04;});}});});});}})[_0xab5f('0x2a')](respondWithResult(_0x5d1daf,0xc9))['catch'](handleError(_0x5d1daf,null));};exports[_0xab5f('0x29')]=function(_0x20cab5,_0x30911c){if(_0x20cab5[_0xab5f('0x4e')]['id']){delete _0x20cab5[_0xab5f('0x4e')]['id'];}return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x20cab5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x30911c,null))[_0xab5f('0x2a')](saveUpdates(_0x20cab5[_0xab5f('0x4e')],null))['then'](respondWithResult(_0x30911c,null))[_0xab5f('0x44')](handleError(_0x30911c,null));};exports[_0xab5f('0x2b')]=function(_0xf925f4,_0x391b32){return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0xf925f4[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x391b32,null))[_0xab5f('0x2a')](removeEntity(_0x391b32,null))[_0xab5f('0x44')](handleError(_0x391b32,null));};exports['describe']=function(_0x542ca0,_0x15b9b1){return db[_0xab5f('0x40')][_0xab5f('0x5c')]()[_0xab5f('0x2a')](respondWithResult(_0x15b9b1,null))[_0xab5f('0x44')](handleError(_0x15b9b1,null));};exports[_0xab5f('0x5d')]=function(_0x2acbaf,_0x2026da){var _0x58442f=_0x2acbaf[_0xab5f('0x4e')];return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x2acbaf[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x2026da,null))[_0xab5f('0x2a')](function(_0x1bf11e){if(_0x1bf11e){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x23298f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2acbaf['params']['id'],'sectionId':_[_0xab5f('0x33')](_0x58442f,function(_0x4a6ce5){return _0x4a6ce5[_0xab5f('0x5e')];})},'transaction':_0x23298f})[_0xab5f('0x2a')](function(){var _0x5ec60c=_['map'](_0x58442f,function(_0x1db10e){_0x1db10e[_0xab5f('0x59')]=_0x2acbaf[_0xab5f('0x5b')]['id'];return _0x1db10e;});var _0x515c5c=[];return BPromise[_0xab5f('0x5f')](_0x5ec60c,function(_0x76055e){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x76055e,{'include':[{'model':db[_0xab5f('0x58')],'as':_0xab5f('0x5a')}],'raw':!![],'transaction':_0x23298f})[_0xab5f('0x2a')](function(_0xed5baf){_0x515c5c[_0xab5f('0x60')](_0xed5baf[_0xab5f('0x50')]({'plain':!![]}));});})['then'](function(){return _0x515c5c;});});});}})['then'](function(_0x429d50){return _0x429d50;})['then'](respondWithResult(_0x2026da,null))[_0xab5f('0x44')](handleError(_0x2026da,null));};exports['removeSections']=function(_0x66f756,_0x1b0485){var _0x4aaf14;return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0x66f756[_0xab5f('0x5b')]['id']},'attributes':['id',_0xab5f('0x2d')]})[_0xab5f('0x2a')](handleEntityNotFound(_0x1b0485,null))[_0xab5f('0x2a')](function(_0x181470){if(_0x181470){_0x4aaf14=_0x181470;return db[_0xab5f('0x56')]['destroy']({'where':{'userProfileId':_0x66f756['params']['id'],'sectionId':_0x66f756[_0xab5f('0x34')]['ids']}});}})[_0xab5f('0x2a')](function(){return _0x4aaf14;})[_0xab5f('0x2a')](respondWithStatusCode(_0x1b0485,null))['catch'](handleError(_0x1b0485,null));};exports[_0xab5f('0x61')]=function(_0x11fa3d,_0x3667ac){var _0x4ff35f=[];var _0x4f5881=[];return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x11fa3d['params']['id']},'raw':!![]})['then'](function(_0x1cb964){_0x4ff35f=_[_0xab5f('0x3c')](_0x1cb964,function(_0x9857fd){return _0x9857fd[_0xab5f('0x62')]===0x1||_[_0xab5f('0x63')]([0x3eb,0x709],_0x9857fd[_0xab5f('0x5e')]);});if(!_[_0xab5f('0x64')](_0x4ff35f)){return _['map'](_0x4ff35f,function(_0x23acfb){return _0x23acfb['sectionId'];});}else{return;}})[_0xab5f('0x2a')](function(_0x16036a){if(_0x16036a)_0x4f5881=_0x16036a;if(_[_0xab5f('0x63')](_0x4f5881,0x64)){var _0x3ddba3=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x64});return hasDefaultDashboard(_0x3ddba3)[_0xab5f('0x2a')](function(_0x58bb7e){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x12f94e){if(_0x12f94e[_0xab5f('0x5e')]===0x64){_0x12f94e[_0xab5f('0x65')]=_0x58bb7e;}return _0x12f94e;});});}else{return;}})[_0xab5f('0x2a')](function(_0x13b2e7){if(_0x13b2e7)_0x4ff35f=_0x13b2e7;if(_['includes'](_0x4f5881,0x3eb)){var _0x3e32ee=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x3eb});return getCustomDashboards(_0x3e32ee)[_0xab5f('0x2a')](function(_0x210f9b){return _['map'](_0x4ff35f,function(_0x4dc8a4){if(_0x3e32ee[_0xab5f('0x62')]){if(_0x4dc8a4[_0xab5f('0x5e')]===0x3eb){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}else{if(_0x4dc8a4[_0xab5f('0x5e')]===0x64){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}return _0x4dc8a4;});});}else{return;}})['then'](function(_0x313156){if(_0x313156)_0x4ff35f=_0x313156;if(_['includes'](_0x4f5881,0x709)){var _0x15bee3=_['find'](_0x4ff35f,{'sectionId':0x709});return getPlugins(_0x15bee3)[_0xab5f('0x2a')](function(_0x502538){if(_0x15bee3[_0xab5f('0x62')]){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x3f2735){if(_0x3f2735[_0xab5f('0x5e')]===0x709){_0x3f2735[_0xab5f('0x65')]=_0x502538;}return _0x3f2735;});}else{var _0x323c4f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x502538};var _0x2e08c4=_[_0xab5f('0x33')](_0x4ff35f);_0x2e08c4[_0xab5f('0x60')](_0x323c4f);return _0x2e08c4;}});}else{return;}})[_0xab5f('0x2a')](function(_0x265b37){if(_0x265b37)_0x4ff35f=_0x265b37;return _[_0xab5f('0x3c')](_0x4ff35f,[_0xab5f('0x62'),0x1]);})[_0xab5f('0x2a')](respondWithResult(_0x3667ac,null))[_0xab5f('0x44')](handleError(_0x3667ac,null));};function hasDefaultDashboard(_0x5eb263){var _0x61d75f=[0x65];return new BPromise(function(_0x5c3d83,_0x1faa75){try{if(_0x5eb263['autoAssociation']){_0x5c3d83(_0x61d75f);}else{return db[_0xab5f('0x58')][_0xab5f('0x66')]({'where':{'sectionId':_0x5eb263['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x22cfbf){_0x22cfbf?_0x5c3d83(_0x61d75f):_0x5c3d83();});}}catch(_0x4c1181){_0x1faa75(_0x4c1181);}});}function getCustomDashboards(_0x1bfd18){var _0x513869=[];return new BPromise(function(_0x5327c8,_0x5db8b8){try{if(_0x1bfd18['autoAssociation']){return db[_0xab5f('0x67')][_0xab5f('0x42')]({'raw':!![]})[_0xab5f('0x2a')](function(_0x10a07f){_0x10a07f[_0xab5f('0x68')](function(_0x400d80){_0x513869['push'](_0x400d80['id']+0x1869f);});_0x5327c8(_0x513869);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x1bfd18['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x5ae266){_0x5ae266[_0xab5f('0x68')](function(_0x358b00){_0x513869[_0xab5f('0x60')](_0x358b00[_0xab5f('0x69')]+0x1869f);});_0x5327c8(_0x513869);});}}catch(_0xa6014b){_0x5db8b8(_0xa6014b);}});}function getPlugins(_0x5eac9c){var _0x221e99=[];return new BPromise(function(_0x291d86,_0x5e60f1){try{if(_0x5eac9c[_0xab5f('0x57')]){return db[_0xab5f('0x6a')]['findAll']({'raw':!![]})[_0xab5f('0x2a')](function(_0x36e6e2){_0x36e6e2[_0xab5f('0x68')](function(_0x52d479){_0x221e99['push'](_0x52d479['id']+0x15b38);});_0x291d86(_0x221e99);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x5eac9c['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x1eecbb){_0x1eecbb['forEach'](function(_0x2a4491){_0x221e99['push'](_0x2a4491[_0xab5f('0x69')]+0x15b38);});_0x291d86(_0x221e99);});}}catch(_0x159113){_0x5e60f1(_0x159113);}});}exports[_0xab5f('0x6b')]=function(_0x1fdae5,_0x19e4e9){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x1fdae5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x19e4e9,null))[_0xab5f('0x2a')](function(_0xf1566f){if(_0xf1566f){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x9d7975){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x28cf22){if(_0x28cf22){return db['UserProfileSection'][_0xab5f('0x2b')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id'],'id':_['map'](_0x28cf22,function(_0x38012a){return _0x38012a['id'];})},'transaction':_0x9d7975});}})[_0xab5f('0x2a')](function(_0x22b3d9){var _0x316a2c=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x3a9f61){_0x3a9f61[_0xab5f('0x59')]=_0x1fdae5[_0xab5f('0x5b')]['id'];return _0x3a9f61;});return db[_0xab5f('0x56')][_0xab5f('0x6c')](_0x316a2c,{'raw':!![],'transaction':_0x9d7975});})[_0xab5f('0x2a')](function(_0x323cd8){var _0x1988fc=_[_0xab5f('0x3c')](_[_0xab5f('0x33')](_0x323cd8,function(_0xc39441){return _0xc39441[_0xab5f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1988fc){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5['params']['id'],'sectionId':_['map'](_0x1988fc,function(_0x282af9){return _0x282af9[_0xab5f('0x5e')];})},'attributes':['id',_0xab5f('0x5e')],'raw':!![]})['then'](function(_0x24cd3c){var _0x3dab9a=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x6f1db9){_0x6f1db9['userProfileId']=_0x1fdae5['params']['id'];return _0x6f1db9;});return db[_0xab5f('0x58')][_0xab5f('0x6c')](_0x3dab9a,{'raw':!![],'transaction':_0x9d7975});});}})['catch'](handleError(_0x19e4e9,null));});}})['then'](function(_0x282e61){var _0x3a8573=_[_0xab5f('0x33')](_0x282e61,function(_0x436a24){return _0x436a24['get']({'plain':!![]});});})[_0xab5f('0x2a')](respondWithResult(_0x19e4e9,null))['catch'](handleError(_0x19e4e9,null));};exports[_0xab5f('0x6d')]=function(_0x46b37f,_0x21d746,_0x17a648){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x46b37f[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x21d746,null))[_0xab5f('0x2a')](function(_0x1284d0){if(_0x1284d0){return _0x1284d0[_0xab5f('0x6d')](_0x46b37f['query'][_0xab5f('0x6e')]);}})[_0xab5f('0x2a')](respondWithStatusCode(_0x21d746,null))[_0xab5f('0x44')](handleError(_0x21d746,null));};exports[_0xab5f('0x6f')]=function(_0x41a241,_0x40f320){var _0x1f1cf2={};if(!_0x41a241['query'][_0xab5f('0x70')])throw new Error(_0xab5f('0x71'));if(!_0x41a241[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x1f1cf2[_0xab5f('0x21')]=qs['limit'](_0x41a241['query'][_0xab5f('0x21')]);_0x1f1cf2[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x41a241[_0xab5f('0x34')]['offset']);}return db[_0xab5f('0x40')]['find']({'where':{'id':_0x41a241[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](function(_0x278900){if(!_0x278900)throw new Error(_0xab5f('0x72')+_0x41a241[_0xab5f('0x5b')]['id']);return db['UserProfile']['getResources'](_0x41a241);})['then'](respondWithFilteredResult(_0x40f320,_0x1f1cf2))['catch'](handleError(_0x40f320,null));}; \ No newline at end of file +var _0x2deb=['mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./userProfile.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','UserProfile','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','params','include','find','create','body','catch','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','sectionId','UserProfileSection','UserProfileResource','Resources','describe','addSections','userProfileId','push','ids','getSections','isEmpty','includes','subsections','enabled','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb2de('0x0'));var rimraf=require(_0xb2de('0x1'));var zipdir=require(_0xb2de('0x2'));var jsonpatch=require(_0xb2de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2de('0x4'));var Mustache=require(_0xb2de('0x5'));var util=require(_0xb2de('0x6'));var path=require(_0xb2de('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb2de('0x8'));var fs=require('fs');var fs_extra=require(_0xb2de('0x9'));var _=require(_0xb2de('0xa'));var squel=require('squel');var crypto=require(_0xb2de('0xb'));var jsforce=require(_0xb2de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb2de('0xd'));var querystring=require(_0xb2de('0xe'));var Papa=require(_0xb2de('0xf'));var Redis=require('ioredis');var authService=require(_0xb2de('0x10'));var qs=require(_0xb2de('0x11'));var as=require(_0xb2de('0x12'));var hardwareService=require(_0xb2de('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb2de('0x14'));var config=require(_0xb2de('0x15'));var licenseUtil=require(_0xb2de('0x16'));var db=require('../../mysqldb')['db'];config[_0xb2de('0x17')]=_[_0xb2de('0x18')](config[_0xb2de('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xb2de('0x19'))(new Redis(config['redis']));require(_0xb2de('0x1a'))['register'](socket);function respondWithStatusCode(_0x10ef21,_0x839c22){_0x839c22=_0x839c22||0xcc;return function(_0x3f9541){if(_0x3f9541){return _0x10ef21['sendStatus'](_0x839c22);}return _0x10ef21[_0xb2de('0x1b')](_0x839c22)[_0xb2de('0x1c')]();};}function respondWithResult(_0x2dc98f,_0x1413f6){_0x1413f6=_0x1413f6||0xc8;return function(_0x317528){if(_0x317528){return _0x2dc98f[_0xb2de('0x1b')](_0x1413f6)[_0xb2de('0x1d')](_0x317528);}};}function respondWithFilteredResult(_0x2db287,_0x1809b1){return function(_0x5d06ac){if(_0x5d06ac){var _0x2a7e89=typeof _0x1809b1['offset']===_0xb2de('0x1e')&&typeof _0x1809b1[_0xb2de('0x1f')]==='undefined';var _0x2fbe63=_0x5d06ac[_0xb2de('0x20')];var _0x499c2f=_0x2a7e89?0x0:_0x1809b1[_0xb2de('0x21')];var _0x1743d1=_0x2a7e89?_0x5d06ac[_0xb2de('0x20')]:_0x1809b1[_0xb2de('0x21')]+_0x1809b1[_0xb2de('0x1f')];var _0x3014b9;if(_0x1743d1>=_0x2fbe63){_0x1743d1=_0x2fbe63;_0x3014b9=0xc8;}else{_0x3014b9=0xce;}_0x2db287[_0xb2de('0x1b')](_0x3014b9);return _0x2db287[_0xb2de('0x22')](_0xb2de('0x23'),_0x499c2f+'-'+_0x1743d1+'/'+_0x2fbe63)['json'](_0x5d06ac);}return null;};}function patchUpdates(_0x280644){return function(_0x2ebdde){try{jsonpatch[_0xb2de('0x24')](_0x2ebdde,_0x280644,!![]);}catch(_0xa97fb4){return BPromise['reject'](_0xa97fb4);}return _0x2ebdde['save']();};}function saveUpdates(_0x102da8,_0x1efd51){return function(_0x3d9ece){if(_0x3d9ece){return _0x3d9ece['update'](_0x102da8)[_0xb2de('0x25')](function(_0x1cc2db){return _0x1cc2db;});}return null;};}function removeEntity(_0x4a6d12,_0x16c249){return function(_0x5b7c2f){if(_0x5b7c2f){return _0x5b7c2f[_0xb2de('0x26')]()[_0xb2de('0x25')](function(){_0x4a6d12[_0xb2de('0x1b')](0xcc)[_0xb2de('0x1c')]();});}};}function handleEntityNotFound(_0xeb4e31,_0x1ad5a2){return function(_0x48675d){if(!_0x48675d){_0xeb4e31[_0xb2de('0x27')](0x194);}return _0x48675d;};}function handleError(_0x5b04ae,_0x38fee9){_0x38fee9=_0x38fee9||0x1f4;return function(_0x5c74e6){logger['error'](_0x5c74e6[_0xb2de('0x28')]);if(_0x5c74e6[_0xb2de('0x29')]){delete _0x5c74e6[_0xb2de('0x29')];}_0x5b04ae[_0xb2de('0x1b')](_0x38fee9)[_0xb2de('0x2a')](_0x5c74e6);};}exports[_0xb2de('0x2b')]=function(_0x1e7248,_0x88f02){var _0x1e0f6d={},_0x379e5f={},_0x40c5d7={'count':0x0,'rows':[]};var _0x101878=_['map'](db[_0xb2de('0x2c')][_0xb2de('0x2d')],function(_0x5b8700){return{'name':_0x5b8700[_0xb2de('0x2e')],'type':_0x5b8700[_0xb2de('0x2f')]['key']};});_0x379e5f[_0xb2de('0x30')]=_[_0xb2de('0x31')](_0x101878,_0xb2de('0x29'));_0x379e5f['query']=_[_0xb2de('0x32')](_0x1e7248[_0xb2de('0x33')]);_0x379e5f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],_0x379e5f[_0xb2de('0x33')]);_0x1e0f6d[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0x379e5f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e7248[_0xb2de('0x33')]['fields']));_0x1e0f6d[_0xb2de('0x36')]=_0x1e0f6d[_0xb2de('0x36')][_0xb2de('0x38')]?_0x1e0f6d[_0xb2de('0x36')]:_0x379e5f[_0xb2de('0x30')];if(!_0x1e7248[_0xb2de('0x33')][_0xb2de('0x39')](_0xb2de('0x3a'))){_0x1e0f6d[_0xb2de('0x1f')]=qs[_0xb2de('0x1f')](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x1f')]);_0x1e0f6d[_0xb2de('0x21')]=qs[_0xb2de('0x21')](_0x1e7248[_0xb2de('0x33')]['offset']);}_0x1e0f6d[_0xb2de('0x3b')]=qs['sort'](_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3c')]);_0x1e0f6d[_0xb2de('0x3d')]=qs[_0xb2de('0x34')](_[_0xb2de('0x3e')](_0x1e7248[_0xb2de('0x33')],_0x379e5f[_0xb2de('0x34')]),_0x101878);if(_0x1e7248[_0xb2de('0x33')][_0xb2de('0x3f')]){_0x1e0f6d[_0xb2de('0x3d')]=_[_0xb2de('0x40')](_0x1e0f6d[_0xb2de('0x3d')],{'$or':_[_0xb2de('0x31')](_0x101878,function(_0x1e7091){if(_0x1e7091[_0xb2de('0x2f')]!=='VIRTUAL'){var _0x179a92={};_0x179a92[_0x1e7091[_0xb2de('0x29')]]={'$like':'%'+_0x1e7248['query'][_0xb2de('0x3f')]+'%'};return _0x179a92;}})});}_0x1e0f6d=_[_0xb2de('0x40')]({},_0x1e0f6d,_0x1e7248[_0xb2de('0x41')]);var _0x12b5b7={'where':_0x1e0f6d['where']};return db[_0xb2de('0x2c')][_0xb2de('0x20')](_0x12b5b7)['then'](function(_0x47448a){_0x40c5d7[_0xb2de('0x20')]=_0x47448a;if(_0x1e7248['query'][_0xb2de('0x42')]){_0x1e0f6d['include']=[{'all':!![]}];}return db['UserProfile'][_0xb2de('0x43')](_0x1e0f6d);})['then'](function(_0x514623){_0x40c5d7[_0xb2de('0x44')]=_0x514623;return _0x40c5d7;})[_0xb2de('0x25')](respondWithFilteredResult(_0x88f02,_0x1e0f6d))['catch'](handleError(_0x88f02,null));};exports[_0xb2de('0x45')]=function(_0x1e35a5,_0x14b0b2){var _0x25f7d1={'raw':![],'where':{'id':_0x1e35a5[_0xb2de('0x46')]['id']}},_0x5d447f={};_0x5d447f[_0xb2de('0x30')]=_[_0xb2de('0x32')](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x5d447f[_0xb2de('0x33')]=_[_0xb2de('0x32')](_0x1e35a5['query']);_0x5d447f[_0xb2de('0x34')]=_[_0xb2de('0x35')](_0x5d447f[_0xb2de('0x30')],_0x5d447f['query']);_0x25f7d1[_0xb2de('0x36')]=_['intersection'](_0x5d447f[_0xb2de('0x30')],qs[_0xb2de('0x37')](_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x37')]));_0x25f7d1['attributes']=_0x25f7d1[_0xb2de('0x36')][_0xb2de('0x38')]?_0x25f7d1['attributes']:_0x5d447f['model'];if(_0x1e35a5[_0xb2de('0x33')][_0xb2de('0x42')]){_0x25f7d1[_0xb2de('0x47')]=[{'all':!![]}];}_0x25f7d1=_[_0xb2de('0x40')]({},_0x25f7d1,_0x1e35a5[_0xb2de('0x41')]);return db['UserProfile'][_0xb2de('0x48')](_0x25f7d1)['then'](handleEntityNotFound(_0x14b0b2,null))[_0xb2de('0x25')](respondWithResult(_0x14b0b2,null))['catch'](handleError(_0x14b0b2,null));};exports[_0xb2de('0x49')]=function(_0x3dca27,_0x4c52bc){return db[_0xb2de('0x2c')]['create'](_0x3dca27[_0xb2de('0x4a')],{})[_0xb2de('0x25')](respondWithResult(_0x4c52bc,0xc9))[_0xb2de('0x4b')](handleError(_0x4c52bc,null));};exports[_0xb2de('0x4c')]=function(_0x5e0968,_0x2e7506){var _0x1eabf7={'where':{'id':_0x5e0968[_0xb2de('0x46')]['id']}},_0xeb9165={};_0xeb9165[_0xb2de('0x30')]=_['keys'](db[_0xb2de('0x2c')][_0xb2de('0x2d')]);_0x1eabf7[_0xb2de('0x36')]=_[_0xb2de('0x35')](_0xeb9165[_0xb2de('0x30')],qs['fields'](_0x5e0968[_0xb2de('0x33')][_0xb2de('0x37')]));_0x1eabf7['attributes']=_0x1eabf7[_0xb2de('0x36')]['length']?_0x1eabf7[_0xb2de('0x36')]:_0xeb9165[_0xb2de('0x30')];if(_0x5e0968[_0xb2de('0x33')][_0xb2de('0x42')]){_0x1eabf7['include']=[{'all':!![]}];}_0x1eabf7=_[_0xb2de('0x40')]({},_0x1eabf7,_0x5e0968[_0xb2de('0x41')]);return db['UserProfile']['find'](_0x1eabf7)[_0xb2de('0x25')](handleEntityNotFound(_0x2e7506,null))[_0xb2de('0x25')](function(_0x15165f){if(_0x15165f){var _0x3ec51d=_0x15165f[_0xb2de('0x4d')]({'plain':!![]});_0x3ec51d=qs[_0xb2de('0x4e')](_0x3ec51d,['id',_0xb2de('0x4f'),_0xb2de('0x50'),_0xb2de('0x51')]);_0x5e0968[_0xb2de('0x4a')]=_[_0xb2de('0x4e')](_0x5e0968['body'],['id','createdAt',_0xb2de('0x50')]);return db[_0xb2de('0x52')][_0xb2de('0x53')](function(_0x1a0ace){return db[_0xb2de('0x2c')][_0xb2de('0x49')](_[_0xb2de('0x40')](_0x3ec51d,_0x5e0968['body']),{'include':_0x5e0968['query'][_0xb2de('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x1a0ace})[_0xb2de('0x25')](function(_0x10ac78){var _0x46282c=_0x10ac78['get']({'plain':!![]});return db['UserProfileSection'][_0xb2de('0x43')]({'where':{'userProfileId':_0x5e0968[_0xb2de('0x46')]['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x4d4af5){if(_0x4d4af5){return BPromise[_0xb2de('0x54')](_0x4d4af5,function(_0x42d894){return new BPromise(function(_0xafe72,_0x41ed6a){if(_0x42d894[_0xb2de('0x55')]===null||_0x42d894[_0xb2de('0x55')]===0x1)_0xafe72(null);return db['UserProfileResource'][_0xb2de('0x43')]({'where':{'sectionId':_0x42d894['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x322b11){var _0x1c1253=_[_0xb2de('0x31')](_0x322b11,function(_0xfce2d5){return qs['omit'](_0xfce2d5,['id',_0xb2de('0x4f'),'updatedAt',_0xb2de('0x56')]);});_0xafe72(_0x1c1253);})[_0xb2de('0x4b')](function(_0x4c76ab){_0x41ed6a(_0x4c76ab);});})[_0xb2de('0x25')](function(_0x4adb89){var _0x594e8a=qs['omit'](_0x42d894,['id',_0xb2de('0x4f'),'updatedAt']);_0x594e8a['userProfileId']=_0x46282c['id'];if(_0x4adb89)_0x594e8a['Resources']=_0x4adb89;return _0x594e8a;})[_0xb2de('0x25')](function(_0x41de3b){return db[_0xb2de('0x57')][_0xb2de('0x49')](_0x41de3b,{'include':[{'model':db[_0xb2de('0x58')],'as':_0xb2de('0x59')}],'raw':!![],'transaction':_0x1a0ace});});})[_0xb2de('0x25')](function(){return _0x46282c;});}});});});}})[_0xb2de('0x25')](respondWithResult(_0x2e7506,0xc9))['catch'](handleError(_0x2e7506,null));};exports['update']=function(_0x135833,_0x5178c8){if(_0x135833['body']['id']){delete _0x135833[_0xb2de('0x4a')]['id'];}return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x135833['params']['id']}})['then'](handleEntityNotFound(_0x5178c8,null))[_0xb2de('0x25')](saveUpdates(_0x135833['body'],null))[_0xb2de('0x25')](respondWithResult(_0x5178c8,null))[_0xb2de('0x4b')](handleError(_0x5178c8,null));};exports[_0xb2de('0x26')]=function(_0x116e74,_0x14cd30){return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x116e74[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x14cd30,null))[_0xb2de('0x25')](removeEntity(_0x14cd30,null))[_0xb2de('0x4b')](handleError(_0x14cd30,null));};exports[_0xb2de('0x5a')]=function(_0x14a730,_0x1d47ab){return db['UserProfile'][_0xb2de('0x5a')]()[_0xb2de('0x25')](respondWithResult(_0x1d47ab,null))[_0xb2de('0x4b')](handleError(_0x1d47ab,null));};exports[_0xb2de('0x5b')]=function(_0x16293e,_0x470a8a){var _0x643557=_0x16293e[_0xb2de('0x4a')];return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x16293e[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x470a8a,null))[_0xb2de('0x25')](function(_0x36f1af){if(_0x36f1af){return db[_0xb2de('0x52')][_0xb2de('0x53')](function(_0x36476b){return db[_0xb2de('0x57')][_0xb2de('0x26')]({'where':{'userProfileId':_0x16293e[_0xb2de('0x46')]['id'],'sectionId':_[_0xb2de('0x31')](_0x643557,function(_0x5802b3){return _0x5802b3[_0xb2de('0x56')];})},'transaction':_0x36476b})[_0xb2de('0x25')](function(){var _0x110d3a=_['map'](_0x643557,function(_0x59db9e){_0x59db9e[_0xb2de('0x5c')]=_0x16293e[_0xb2de('0x46')]['id'];return _0x59db9e;});var _0x24f892=[];return BPromise['each'](_0x110d3a,function(_0x1fff3c){return db[_0xb2de('0x57')][_0xb2de('0x49')](_0x1fff3c,{'include':[{'model':db[_0xb2de('0x58')],'as':_0xb2de('0x59')}],'raw':!![],'transaction':_0x36476b})[_0xb2de('0x25')](function(_0x44d562){_0x24f892[_0xb2de('0x5d')](_0x44d562[_0xb2de('0x4d')]({'plain':!![]}));});})[_0xb2de('0x25')](function(){return _0x24f892;});});});}})['then'](function(_0x563bdb){return _0x563bdb;})[_0xb2de('0x25')](respondWithResult(_0x470a8a,null))[_0xb2de('0x4b')](handleError(_0x470a8a,null));};exports['removeSections']=function(_0x130f5d,_0x11b299){var _0x1ebbbb;return db[_0xb2de('0x2c')]['find']({'where':{'id':_0x130f5d[_0xb2de('0x46')]['id']},'attributes':['id',_0xb2de('0x29')]})['then'](handleEntityNotFound(_0x11b299,null))[_0xb2de('0x25')](function(_0xf4bc84){if(_0xf4bc84){_0x1ebbbb=_0xf4bc84;return db[_0xb2de('0x57')][_0xb2de('0x26')]({'where':{'userProfileId':_0x130f5d['params']['id'],'sectionId':_0x130f5d['query'][_0xb2de('0x5e')]}});}})[_0xb2de('0x25')](function(){return _0x1ebbbb;})[_0xb2de('0x25')](respondWithStatusCode(_0x11b299,null))[_0xb2de('0x4b')](handleError(_0x11b299,null));};exports[_0xb2de('0x5f')]=function(_0x3c43d1,_0x52188f){var _0x5bbedf=[];var _0x79de58=[];return db[_0xb2de('0x57')][_0xb2de('0x43')]({'where':{'userProfileId':_0x3c43d1[_0xb2de('0x46')]['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x227030){_0x5bbedf=_[_0xb2de('0x3f')](_0x227030,function(_0x47c7b6){return _0x47c7b6['enabled']===0x1||_['includes']([0x3eb,0x709],_0x47c7b6[_0xb2de('0x56')]);});if(!_[_0xb2de('0x60')](_0x5bbedf)){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x2b92db){return _0x2b92db[_0xb2de('0x56')];});}else{return;}})[_0xb2de('0x25')](function(_0x3ca7d4){if(_0x3ca7d4)_0x79de58=_0x3ca7d4;if(_[_0xb2de('0x61')](_0x79de58,0x64)){var _0x35a9f4=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x64});return hasDefaultDashboard(_0x35a9f4)[_0xb2de('0x25')](function(_0x823071){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x3b99ab){if(_0x3b99ab[_0xb2de('0x56')]===0x64){_0x3b99ab[_0xb2de('0x62')]=_0x823071;}return _0x3b99ab;});});}else{return;}})[_0xb2de('0x25')](function(_0x55f45e){if(_0x55f45e)_0x5bbedf=_0x55f45e;if(_['includes'](_0x79de58,0x3eb)){var _0x275539=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x3eb});return getCustomDashboards(_0x275539)[_0xb2de('0x25')](function(_0x487030){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x4bb348){if(_0x275539[_0xb2de('0x63')]){if(_0x4bb348[_0xb2de('0x56')]===0x3eb){_0x4bb348[_0xb2de('0x62')]=_0x487030;}}else{if(_0x4bb348[_0xb2de('0x56')]===0x64){_0x4bb348[_0xb2de('0x62')]=_0x487030;}}return _0x4bb348;});});}else{return;}})['then'](function(_0x3f043d){if(_0x3f043d)_0x5bbedf=_0x3f043d;if(_[_0xb2de('0x61')](_0x79de58,0x709)){var _0x544015=_[_0xb2de('0x48')](_0x5bbedf,{'sectionId':0x709});return getPlugins(_0x544015)['then'](function(_0x2ab4ea){if(_0x544015[_0xb2de('0x63')]){return _[_0xb2de('0x31')](_0x5bbedf,function(_0x37de79){if(_0x37de79[_0xb2de('0x56')]===0x709){_0x37de79[_0xb2de('0x62')]=_0x2ab4ea;}return _0x37de79;});}else{var _0x19cde8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2ab4ea};var _0xb20560=_[_0xb2de('0x31')](_0x5bbedf);_0xb20560['push'](_0x19cde8);return _0xb20560;}});}else{return;}})['then'](function(_0x427b9d){if(_0x427b9d)_0x5bbedf=_0x427b9d;return _[_0xb2de('0x3f')](_0x5bbedf,['enabled',0x1]);})['then'](respondWithResult(_0x52188f,null))[_0xb2de('0x4b')](handleError(_0x52188f,null));};function hasDefaultDashboard(_0x1ea080){var _0x4883cd=[0x65];return new BPromise(function(_0x370685,_0x1e925c){try{if(_0x1ea080['autoAssociation']){_0x370685(_0x4883cd);}else{return db['UserProfileResource'][_0xb2de('0x64')]({'where':{'sectionId':_0x1ea080['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x151b19){_0x151b19?_0x370685(_0x4883cd):_0x370685();});}}catch(_0x1dff1d){_0x1e925c(_0x1dff1d);}});}function getCustomDashboards(_0x5d8db7){var _0x273a9a=[];return new BPromise(function(_0x40f801,_0x41f9e8){try{if(_0x5d8db7[_0xb2de('0x55')]){return db[_0xb2de('0x65')][_0xb2de('0x43')]({'raw':!![]})['then'](function(_0x48d204){_0x48d204[_0xb2de('0x66')](function(_0x22d7d3){_0x273a9a[_0xb2de('0x5d')](_0x22d7d3['id']+0x1869f);});_0x40f801(_0x273a9a);});}else{return db[_0xb2de('0x58')][_0xb2de('0x43')]({'where':{'sectionId':_0x5d8db7['id']},'raw':!![]})['then'](function(_0x3ec3c8){_0x3ec3c8[_0xb2de('0x66')](function(_0x1cb271){_0x273a9a[_0xb2de('0x5d')](_0x1cb271[_0xb2de('0x67')]+0x1869f);});_0x40f801(_0x273a9a);});}}catch(_0xf4a624){_0x41f9e8(_0xf4a624);}});}function getPlugins(_0x85fe26){var _0x5cc9b2=[];return new BPromise(function(_0x544a32,_0x5c8d38){try{if(_0x85fe26[_0xb2de('0x55')]){return db[_0xb2de('0x68')]['findAll']({'raw':!![]})['then'](function(_0x5246c1){_0x5246c1[_0xb2de('0x66')](function(_0x2c74cb){_0x5cc9b2['push'](_0x2c74cb['id']+0x15b38);});_0x544a32(_0x5cc9b2);});}else{return db['UserProfileResource'][_0xb2de('0x43')]({'where':{'sectionId':_0x85fe26['id']},'raw':!![]})[_0xb2de('0x25')](function(_0x1313c5){_0x1313c5[_0xb2de('0x66')](function(_0x4b46f4){_0x5cc9b2[_0xb2de('0x5d')](_0x4b46f4[_0xb2de('0x67')]+0x15b38);});_0x544a32(_0x5cc9b2);});}}catch(_0x5196f3){_0x5c8d38(_0x5196f3);}});}exports[_0xb2de('0x69')]=function(_0x4149df,_0xb454b4){return db['UserProfile'][_0xb2de('0x48')]({'where':{'id':_0x4149df[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0xb454b4,null))[_0xb2de('0x25')](function(_0xea3661){if(_0xea3661){return db['sequelize'][_0xb2de('0x53')](function(_0x6aca7a){return db[_0xb2de('0x57')][_0xb2de('0x43')]({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x50eb1a){if(_0x50eb1a){return db[_0xb2de('0x57')]['destroy']({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id'],'id':_[_0xb2de('0x31')](_0x50eb1a,function(_0x39d83a){return _0x39d83a['id'];})},'transaction':_0x6aca7a});}})['then'](function(_0x2d8b74){var _0x47df11=_[_0xb2de('0x31')](_0x4149df[_0xb2de('0x4a')],function(_0x3169f0){_0x3169f0[_0xb2de('0x5c')]=_0x4149df[_0xb2de('0x46')]['id'];return _0x3169f0;});return db[_0xb2de('0x57')][_0xb2de('0x6a')](_0x47df11,{'raw':!![],'transaction':_0x6aca7a});})[_0xb2de('0x25')](function(_0x481b1c){var _0x50ed45=_[_0xb2de('0x3f')](_['map'](_0x481b1c,function(_0x530eea){return _0x530eea['get']({'plain':!![]});}),{'includeAll':![]});if(_0x50ed45){return db['UserProfileSection'][_0xb2de('0x43')]({'where':{'userProfileId':_0x4149df[_0xb2de('0x46')]['id'],'sectionId':_[_0xb2de('0x31')](_0x50ed45,function(_0x3f4996){return _0x3f4996[_0xb2de('0x56')];})},'attributes':['id',_0xb2de('0x56')],'raw':!![]})[_0xb2de('0x25')](function(_0x22e557){var _0x511fd7=_[_0xb2de('0x31')](_0x4149df[_0xb2de('0x4a')],function(_0x3e2b6d){_0x3e2b6d[_0xb2de('0x5c')]=_0x4149df[_0xb2de('0x46')]['id'];return _0x3e2b6d;});return db[_0xb2de('0x58')][_0xb2de('0x6a')](_0x511fd7,{'raw':!![],'transaction':_0x6aca7a});});}})[_0xb2de('0x4b')](handleError(_0xb454b4,null));});}})[_0xb2de('0x25')](function(_0x243183){var _0x36cce6=_[_0xb2de('0x31')](_0x243183,function(_0x4d7af4){return _0x4d7af4['get']({'plain':!![]});});})['then'](respondWithResult(_0xb454b4,null))[_0xb2de('0x4b')](handleError(_0xb454b4,null));};exports[_0xb2de('0x6b')]=function(_0x2fb0c5,_0x2b71ef,_0x151cf4){return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x2fb0c5[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](handleEntityNotFound(_0x2b71ef,null))[_0xb2de('0x25')](function(_0x353993){if(_0x353993){return _0x353993[_0xb2de('0x6b')](_0x2fb0c5['query'][_0xb2de('0x5e')]);}})['then'](respondWithStatusCode(_0x2b71ef,null))[_0xb2de('0x4b')](handleError(_0x2b71ef,null));};exports[_0xb2de('0x6c')]=function(_0x3aa7c0,_0x2b294b){var _0x3854bc={};if(!_0x3aa7c0[_0xb2de('0x33')][_0xb2de('0x6d')])throw new Error(_0xb2de('0x6e'));if(!_0x3aa7c0[_0xb2de('0x33')]['hasOwnProperty'](_0xb2de('0x3a'))){_0x3854bc[_0xb2de('0x1f')]=qs[_0xb2de('0x1f')](_0x3aa7c0[_0xb2de('0x33')][_0xb2de('0x1f')]);_0x3854bc[_0xb2de('0x21')]=qs[_0xb2de('0x21')](_0x3aa7c0['query'][_0xb2de('0x21')]);}return db[_0xb2de('0x2c')][_0xb2de('0x48')]({'where':{'id':_0x3aa7c0[_0xb2de('0x46')]['id']}})[_0xb2de('0x25')](function(_0x42994e){if(!_0x42994e)throw new Error(_0xb2de('0x6f')+_0x3aa7c0[_0xb2de('0x46')]['id']);return db[_0xb2de('0x2c')][_0xb2de('0x6c')](_0x3aa7c0);})['then'](respondWithFilteredResult(_0x2b294b,_0x3854bc))[_0xb2de('0x4b')](handleError(_0x2b294b,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d793f8e..4a50c54 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 _0x5430=['UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x9e110d,_0x3f26f4){var _0x291f4a=function(_0x1e4508){while(--_0x1e4508){_0x9e110d['push'](_0x9e110d['shift']());}};_0x291f4a(++_0x3f26f4);}(_0x5430,0x10c));var _0x0543=function(_0x1819d1,_0x22f8d0){_0x1819d1=_0x1819d1-0x0;var _0x5193b8=_0x5430[_0x1819d1];return _0x5193b8;};'use strict';var EventEmitter=require(_0x0543('0x0'));var UserProfile=require(_0x0543('0x1'))['db'][_0x0543('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0543('0x3')](0x0);var events={'afterCreate':_0x0543('0x4'),'afterUpdate':_0x0543('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5b122c){return function(_0x1c5ab7,_0x4ee416,_0x523f3d){UserProfileEvents[_0x0543('0x6')](_0x5b122c+':'+_0x1c5ab7['id'],_0x1c5ab7);UserProfileEvents[_0x0543('0x6')](_0x5b122c,_0x1c5ab7);_0x523f3d(null);};}for(var e in events){if(events[_0x0543('0x7')](e)){var event=events[e];UserProfile[_0x0543('0x8')](e,emitEvent(event));}}module[_0x0543('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x6333=['update','remove','emit','hook','exports','setMaxListeners'];(function(_0x816827,_0x478eee){var _0x3b6429=function(_0xa7e7fd){while(--_0xa7e7fd){_0x816827['push'](_0x816827['shift']());}};_0x3b6429(++_0x478eee);}(_0x6333,0x83));var _0x3633=function(_0xe53377,_0x47fa0e){_0xe53377=_0xe53377-0x0;var _0x497069=_0x6333[_0xe53377];return _0x497069;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3633('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3633('0x1'),'afterDestroy':_0x3633('0x2')};function emitEvent(_0x596f7e){return function(_0x3e0961,_0x5cb6c6,_0x2439e1){UserProfileEvents[_0x3633('0x3')](_0x596f7e+':'+_0x3e0961['id'],_0x3e0961);UserProfileEvents['emit'](_0x596f7e,_0x3e0961);_0x2439e1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x3633('0x4')](e,emitEvent(event));}}module[_0x3633('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d6a2196..a9389a6 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 _0xe2de=['nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','forEach','include','reportType','default','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','tag','ThroughTags','color','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','value','findAll','then','associatedResources','map','field','model','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','projectName','projects','JscriptyProject','contacts','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','whatsappqueues','whatsappaccounts','WhatsappAccount','Team','queuecampaigns','users','agents','telephones','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','Schedule','sounds','Sound','tags','Tag','triggers','Trigger','trunks','Trunk','variables','extractedreports','Reports','reportId','metrics','charAt','toUpperCase','slice','QueryTypes','select','InteractionId','ui.createdAt','where','ui.UserId\x20=\x20?','toString','OpenTabs','define','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','union','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x5ed0f8,_0x34e76d){var _0x4e6fd8=function(_0x3b0be9){while(--_0x3b0be9){_0x5ed0f8['push'](_0x5ed0f8['shift']());}};_0x4e6fd8(++_0x34e76d);}(_0xe2de,0x1a7));var _0xee2d=function(_0x155586,_0x163199){_0x155586=_0x155586-0x0;var _0x4262fc=_0xe2de[_0x155586];return _0x4262fc;};'use strict';var _=require('lodash');var attributes=require(_0xee2d('0x0'));var qs=require(_0xee2d('0x1'));var squel=require(_0xee2d('0x2'));module[_0xee2d('0x3')]=function(_0x327fcd){var _0x5946fc=_0x327fcd[_0xee2d('0x4')];function _0x58c47e(_0x5d6407,_0x3b05c9){return new Promise(function(_0x53d9c9,_0x1197c5){if(!_0x3b05c9)return _0x53d9c9(null);var _0x2fe034=_0x3b05c9[_0xee2d('0x5')]?{[_0x3b05c9[_0xee2d('0x5')]['field']]:_0x3b05c9[_0xee2d('0x5')][_0xee2d('0x6')]}:undefined;return _0x5946fc[_0x5d6407][_0xee2d('0x7')]({'where':_0x2fe034,'raw':!![]})[_0xee2d('0x8')](function(_0x5c7461){_0x3b05c9[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0x5c7461,'id');_0x53d9c9(_0x3b05c9);})['catch'](function(_0x155c99){_0x1197c5(_0x155c99);});});}function _0x4d8af8(_0x2b74e9,_0x12acf1){return new Promise(function(_0x49d645,_0x96c95e){var _0xf46889=_0x2b74e9['filter']?{[_0x2b74e9[_0xee2d('0x5')][_0xee2d('0xb')]]:_0x2b74e9[_0xee2d('0x5')]['value']}:undefined;return _0x5946fc[_0x2b74e9[_0xee2d('0xc')]][_0xee2d('0x7')]({'where':_0xf46889,'raw':!![]})[_0xee2d('0x8')](function(_0x369026){_0x12acf1[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0x369026,function(_0x345bcb){return _0x345bcb[_0xee2d('0xd')];});_0x49d645(_0x12acf1);})[_0xee2d('0xe')](function(_0x5288af){_0x96c95e(_0x5288af);});});}function _0x484078(_0x445aa6,_0x164810,_0x23baee){if(!_0x164810)return Promise[_0xee2d('0xf')](null);return new Promise(function(_0x258773,_0x5c9523){return _0x5946fc[_0xee2d('0x10')][_0xee2d('0x7')]({'where':{'sectionId':_0x164810['id']},'raw':!![]})['then'](function(_0xf9f21){if(_0x445aa6[_0xee2d('0xb')]&&_0x445aa6[_0xee2d('0xb')]!=='id'){_0x164810[_0xee2d('0x9')]=_['map'](_0xf9f21,function(_0x3aaa8e){return _0x3aaa8e[_0x445aa6[_0xee2d('0xb')]];});}else{if(_0x23baee===_0xee2d('0x11')){_0x164810[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0xf9f21,function(_0x192d27){return{'id':_0x192d27['resourceId'],'type':_0x192d27[_0xee2d('0x12')]};});}else{_0x164810[_0xee2d('0x9')]=_[_0xee2d('0xa')](_0xf9f21,function(_0x292d80){return _0x292d80[_0xee2d('0x13')];});}}_0x258773(_0x164810);})[_0xee2d('0xe')](function(_0x71ea97){_0x5c9523(_0x71ea97);});});}function _0x1d2460(_0x23baa6,_0x132f17){var _0x1cef66={'parentSections':[]};switch(_0x23baa6[_0xee2d('0x14')]()){case _0xee2d('0x15'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x17');break;case _0xee2d('0x18'):_0x1cef66['childModel']=_0xee2d('0x19');break;case'squarerecordings':_0x1cef66['childModel']=_0xee2d('0x1a');_0x1cef66[_0xee2d('0x1b')]=[{'name':'SquareProjects','field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x1c')}];break;case _0xee2d('0x1d'):_0x1cef66['childModel']=_0xee2d('0x1e');break;case _0xee2d('0x1f'):_0x1cef66['childModel']='CmContact';_0x1cef66[_0xee2d('0x1b')]=[{'name':_0xee2d('0x20'),'field':'id','foreignKey':_0xee2d('0x21')}];break;case _0xee2d('0x22'):_0x1cef66['childModel']=_0xee2d('0x23');break;case _0xee2d('0x24'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x25');break;case _0xee2d('0x26'):_0x1cef66['childModel']=_0xee2d('0x27');break;case _0xee2d('0x28'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x29');break;case _0xee2d('0x2a'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2b');break;case _0xee2d('0x2c'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2d');break;case'faxaccounts':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x2e');break;case _0xee2d('0x2f'):case _0xee2d('0x30'):case _0xee2d('0x31'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x32');break;case _0xee2d('0x33'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x34');break;case _0xee2d('0x35'):_0x1cef66[_0xee2d('0x16')]='VoiceMail';break;case _0xee2d('0x36'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x37');_0x1cef66['parentSections']=[{'name':_0xee2d('0x38'),'field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x39'),'model':_0xee2d('0x3a'),'filter':{'field':_0xee2d('0x3b'),'value':[_0xee2d('0x3c')]}},{'name':_0xee2d('0x3d'),'field':'name','foreignKey':_0xee2d('0x39'),'model':'User','filter':{'field':'role','value':[_0xee2d('0x3e')]}},{'name':'VoiceQueues','field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x3f'),'model':_0xee2d('0x40'),'filter':{'field':_0xee2d('0x12'),'value':[_0xee2d('0x41')]}},{'name':_0xee2d('0x42'),'field':_0xee2d('0xd'),'foreignKey':_0xee2d('0x3f'),'model':_0xee2d('0x40'),'filter':{'field':'type','value':[_0xee2d('0x43')]}}];break;case _0xee2d('0x44'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x45');break;case _0xee2d('0x46'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x47');break;case'voiceprefixes':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x48');break;case _0xee2d('0x49'):_0x1cef66['childModel']='Campaign';break;case _0xee2d('0x4a'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x4b');break;case _0xee2d('0x4c'):_0x1cef66[_0xee2d('0x16')]='MailAccount';break;case'mailsubstatuses':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x4d');break;case _0xee2d('0x4e'):_0x1cef66['childModel']=_0xee2d('0x4f');break;case _0xee2d('0x50'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x51');break;case _0xee2d('0x52'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x53');break;case'smsaccounts':_0x1cef66[_0xee2d('0x16')]='SmsAccount';break;case _0xee2d('0x54'):_0x1cef66[_0xee2d('0x16')]='WhatsappQueue';break;case _0xee2d('0x55'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x56');break;case'teams':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x57');break;case'voicequeues':case _0xee2d('0x58'):_0x1cef66['childModel']=_0xee2d('0x40');if(_0x132f17){_0x1cef66[_0xee2d('0x1b')]=[{'name':'VoiceQueues'},{'name':_0xee2d('0x42')}];}break;case _0xee2d('0x59'):case _0xee2d('0x5a'):case _0xee2d('0x5b'):_0x1cef66['childModel']=_0xee2d('0x3a');if(_0x132f17){_0x1cef66[_0xee2d('0x1b')]=[{'name':'Users','filter':{'field':_0xee2d('0x3b'),'value':[_0xee2d('0x5c'),_0xee2d('0x5d')]},'ignore':!![]},{'name':_0xee2d('0x38')},{'name':_0xee2d('0x3d')}];}break;case _0xee2d('0x5e'):_0x1cef66[_0xee2d('0x16')]='ZendeskAccount';break;case _0xee2d('0x5f'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x60');break;case _0xee2d('0x61'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x62');break;case _0xee2d('0x63'):_0x1cef66['childModel']='SugarcrmAccount';break;case _0xee2d('0x64'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x65');break;case'zohoaccounts':_0x1cef66[_0xee2d('0x16')]='ZohoAccount';break;case'vtigeraccounts':_0x1cef66[_0xee2d('0x16')]='User';break;case'cannedanswers':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x66');break;case _0xee2d('0x67'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x68');break;case _0xee2d('0x69'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6a');break;case _0xee2d('0x6b'):_0x1cef66[_0xee2d('0x16')]='Interval';break;case _0xee2d('0x6c'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6d');break;case'scheduler':_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x6e');break;case _0xee2d('0x6f'):_0x1cef66['childModel']=_0xee2d('0x70');break;case _0xee2d('0x71'):_0x1cef66['childModel']=_0xee2d('0x72');break;case'templates':_0x1cef66[_0xee2d('0x16')]='Template';break;case _0xee2d('0x73'):_0x1cef66['childModel']=_0xee2d('0x74');break;case _0xee2d('0x75'):_0x1cef66[_0xee2d('0x16')]=_0xee2d('0x76');break;case _0xee2d('0x77'):_0x1cef66[_0xee2d('0x16')]='Variable';break;case'plugins':_0x1cef66[_0xee2d('0x16')]='Plugin';break;case _0xee2d('0x78'):_0x1cef66['childModel']=_0xee2d('0x11');_0x1cef66[_0xee2d('0x1b')]=[{'name':_0xee2d('0x79'),'field':'id','foreignKey':_0xee2d('0x7a')}];break;case _0xee2d('0x7b'):_0x1cef66['childModel']='AnalyticMetric';break;}return _0x1cef66;}function _0xa65656(_0x487b9a,_0x469bd8){var _0x3de3e6=_0x487b9a[_0xee2d('0x7c')](0x0)[_0xee2d('0x7d')]()+_0x487b9a[_0xee2d('0x7e')](0x1);var _0x4a6399={'type':_0x5946fc['Sequelize'][_0xee2d('0x7f')]['SELECT'],'raw':!![]};return new Promise(function(_0x1e9bd4,_0x177b52){var _0x5861b3=squel[_0xee2d('0x80')]()[_0xee2d('0xb')]('ui.'+_0x3de3e6+_0xee2d('0x81'),'id')[_0xee2d('0xb')](_0xee2d('0x82'))['from']('user_has_'+_0x487b9a+'_interactions','ui')[_0xee2d('0x83')](_0xee2d('0x84'),_0x469bd8['id']);return _0x5946fc['sequelize']['query'](_0x5861b3[_0xee2d('0x85')](),_0x4a6399)[_0xee2d('0x8')](function(_0x461f24){_0x469bd8[_0x3de3e6+_0xee2d('0x86')]=_0x461f24;_0x1e9bd4(_0x461f24);})['catch'](function(_0x2b3de1){_0x177b52(_0x2b3de1);});});}return _0x327fcd[_0xee2d('0x87')](_0xee2d('0x88'),attributes,{'tableName':_0xee2d('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x447f5c){var _0x1c7ee2={'raw':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8b')],'where':{}};var _0x34fa56={};var _0x1c3b77={'count':0x0,'rows':[]};var _0x208e0f=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8c')];var _0x514edf=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x8d')]||![];var _0x1d1c8d=_0x1d2460(_0x208e0f,_0x514edf);if(!_0x1d1c8d[_0xee2d('0x16')])throw new Error(_0xee2d('0x8e')+_0x208e0f+'\x27');var _0x1a99ef=[{'name':_0x208e0f}];if(!_[_0xee2d('0x8f')](_0x1d1c8d['parentSections']))_0x1a99ef=_0x1d1c8d['parentSections'];var _0x44e0f2=[];for(var _0x4092bd=0x0;_0x4092bd<_0x1a99ef[_0xee2d('0x90')];_0x4092bd++){_0x44e0f2['push'](_0x5946fc['UserProfileSection'][_0xee2d('0x91')]({'where':{'userProfileId':_0x447f5c[_0xee2d('0x92')]['id'],'name':_0x1a99ef[_0x4092bd][_0xee2d('0xd')]},'raw':!![]}));}return Promise[_0xee2d('0x93')](_0x44e0f2)[_0xee2d('0x8')](function(_0x27b3ef){var _0x4f0e03=_[_0xee2d('0x5')](_0x27b3ef,function(_0x248938){return _0x248938?_0x248938:undefined;});var _0x382f96=_[_0xee2d('0x5')](_0x1a99ef,[_0xee2d('0x94'),!![]]);var _0x1875c0=_['isEmpty'](_0x4f0e03)&&_[_0xee2d('0x8f')](_0x382f96)?null:_[_0xee2d('0x95')](_0x382f96,_0x4f0e03);if(!_0x1875c0)return null;var _0x15842c=[];for(var _0x22e0ff=0x0;_0x22e0ff<_0x1875c0[_0xee2d('0x90')];_0x22e0ff++){var _0x1dd01e=_[_0xee2d('0x91')](_0x1a99ef,function(_0x1c8caf){return _0x1875c0[_0x22e0ff]?_0x1c8caf['name']===_0x1875c0[_0x22e0ff][_0xee2d('0xd')]:null;});if(_0x1dd01e){if(_0x1875c0[_0x22e0ff][_0xee2d('0x94')]){_0x15842c[_0xee2d('0x96')](_0x58c47e(_0x1d1c8d[_0xee2d('0x16')],_0x1875c0[_0x22e0ff]));}else{if(!_0x1875c0[_0x22e0ff][_0xee2d('0x97')]){_0x15842c[_0xee2d('0x96')](_0x484078(_0x1dd01e,_0x1875c0[_0x22e0ff],_0x1d1c8d[_0xee2d('0x16')]));}else{if(_0x1dd01e['model']){_0x15842c[_0xee2d('0x96')](_0x4d8af8(_0x1dd01e,_0x1875c0[_0x22e0ff]));}}}}}return Promise[_0xee2d('0x93')](_0x15842c);})[_0xee2d('0x8')](function(_0x3fbd04){var _0x48718c=_0x3fbd04;var _0x2540ec=null;if(_0x48718c){_0x2540ec=_0x48718c[_0xee2d('0x90')]===0x1?_0x48718c[0x0]:null;}if(!_0x2540ec&&!_0x48718c)return _0x1c3b77;var _0x176990=_0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x98')];_0x34fa56[_0xee2d('0xc')]=_[_0xee2d('0x99')](_0x176990);_0x34fa56[_0xee2d('0x8a')]=_[_0xee2d('0x99')](_0x447f5c['query']);_0x34fa56[_0xee2d('0x9a')]=_['intersection'](_0x34fa56[_0xee2d('0xc')],_0x34fa56[_0xee2d('0x8a')]);_0x1c7ee2['attributes']=_[_0xee2d('0x9b')](_0x34fa56[_0xee2d('0xc')],qs[_0xee2d('0x9c')](_0x447f5c['query'][_0xee2d('0x9c')]));_0x1c7ee2['attributes']=_0x1c7ee2['attributes'][_0xee2d('0x90')]?_0x1c7ee2[_0xee2d('0x9d')]:_0x34fa56[_0xee2d('0xc')];if(!_0x447f5c['query'][_0xee2d('0x9e')](_0xee2d('0x9f'))){_0x1c7ee2[_0xee2d('0xa0')]=qs[_0xee2d('0xa0')](_0x447f5c[_0xee2d('0x8a')]['limit']);_0x1c7ee2[_0xee2d('0xa1')]=qs[_0xee2d('0xa1')](_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xa1')]);}_0x1c7ee2[_0xee2d('0xa2')]=qs[_0xee2d('0xa3')](_0x447f5c['query'][_0xee2d('0xa3')]);_0x1c7ee2[_0xee2d('0x83')]=qs[_0xee2d('0x9a')](_[_0xee2d('0xa4')](_0x447f5c['query'],_0x34fa56['filters']));if(_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x5')]){_0x1c7ee2[_0xee2d('0x83')]=_[_0xee2d('0xa5')](_0x1c7ee2[_0xee2d('0x83')],{'$or':_['map'](_0x176990,function(_0x24e724){if(_0x24e724[_0xee2d('0x12')]['key']!==_0xee2d('0xa6')){var _0xed11fa={};_0xed11fa[_0x24e724['field']]={'$like':'%'+_0x447f5c[_0xee2d('0x8a')][_0xee2d('0x5')]+'%'};return _0xed11fa;}})});}var _0x50f043=[];var _0x9e5b6c=null;var _0x56b2cb={};if(_0x2540ec){_0x9e5b6c=_[_0xee2d('0x91')](_0x1a99ef,[_0xee2d('0xd'),_0x2540ec[_0xee2d('0xd')]]);if(_0x9e5b6c[_0xee2d('0xb')]){_0x56b2cb={};if(_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0x11')){_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_[_0xee2d('0xa')](_0x2540ec['associatedResources'],'id');}else{_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_0x2540ec[_0xee2d('0x9')];}_0x50f043[_0xee2d('0x96')](_0x56b2cb);}else{_0x1c7ee2[_0xee2d('0x83')]['id']=_0x2540ec[_0xee2d('0x9')];}}else{for(var _0x57c49b=0x0;_0x57c49b<_0x48718c[_0xee2d('0x90')];_0x57c49b++){_0x9e5b6c=_[_0xee2d('0x91')](_0x1a99ef,[_0xee2d('0xd'),_0x48718c[_0x57c49b][_0xee2d('0xd')]]);if(_0x9e5b6c[_0xee2d('0xb')]){_0x56b2cb={};_0x56b2cb[_0x9e5b6c[_0xee2d('0xa7')]]=_0x48718c[_0x57c49b][_0xee2d('0x9')];_0x50f043[_0xee2d('0x96')](_0x56b2cb);}else{if(!_0x1c7ee2[_0xee2d('0x83')]['id'])_0x1c7ee2[_0xee2d('0x83')]['id']=[];_0x48718c[_0x57c49b]['associatedResources'][_0xee2d('0xa8')](function(_0x421829){_0x1c7ee2[_0xee2d('0x83')]['id']['push'](_0x421829);});}}}if(!_[_0xee2d('0x8f')](_0x50f043)){_0x1c7ee2['where']=_[_0xee2d('0xa5')](_0x1c7ee2['where'],{'$and':{'$or':_0x50f043}});}_0x1c7ee2=_[_0xee2d('0xa5')]({},_0x1c7ee2,_0x447f5c['options']);if(_0x2540ec&&!_0x2540ec[_0xee2d('0x97')]&&_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0x11')){if(_0x447f5c[_0xee2d('0x8a')]['includeAll']){_0x1c7ee2[_0xee2d('0xa9')]=[{'all':!![]}];}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x7')](_0x1c7ee2)['then'](function(_0x40075c){var _0x31f442=[];_0x40075c[_0xee2d('0xa8')](function(_0x4cfcb5){var _0x2f1328;switch(_0x4cfcb5[_0xee2d('0xaa')]){case _0xee2d('0xab'):_0x2f1328=_[_0xee2d('0x91')](_0x2540ec[_0xee2d('0x9')],function(_0x3701c5){return _0x3701c5['id']===_0x4cfcb5['reportId']&&_0x3701c5['type']===_0xee2d('0xac');});break;case _0xee2d('0xad'):_0x2f1328=_['find'](_0x2540ec['associatedResources'],function(_0x40f17d){return _0x40f17d['id']===_0x4cfcb5['reportId']&&_0x40f17d['type']==='CustomReports';});break;}if(_0x2f1328)_0x31f442['push'](_0x4cfcb5);});_0x1c3b77[_0xee2d('0xae')]=_0x31f442[_0xee2d('0x90')];_0x1c3b77[_0xee2d('0xaf')]=_0x31f442;return _0x1c3b77;});}else{if(!_[_0xee2d('0x8f')](_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb0')])){_0x1c7ee2[_0xee2d('0x83')]['id']=_0x1c7ee2[_0xee2d('0x83')]['id']?_[_0xee2d('0x9b')](_0x1c7ee2[_0xee2d('0x83')]['id'],_0x447f5c[_0xee2d('0x8a')]['ids']):_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb0')];if(_0x447f5c[_0xee2d('0x8a')]['customSorting']){_0x1c7ee2['order']=_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb1')];}}if(_0x447f5c['query'][_0xee2d('0xb2')]){_0x1c7ee2[_0xee2d('0x83')]=_['merge'](_0x1c7ee2[_0xee2d('0x83')],{'$and':_0x447f5c[_0xee2d('0x8a')]['extraQueryConditions']});}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0xae')]({'where':_0x1c7ee2['where']})[_0xee2d('0x8')](function(_0x3b48b0){_0x1c3b77[_0xee2d('0xae')]=_0x3b48b0;if(_0x447f5c['query'][_0xee2d('0xb3')]){if(_0x1d1c8d[_0xee2d('0x16')]===_0xee2d('0xb4')){_0x1c7ee2['include']=[{'model':_0x5946fc[_0xee2d('0x72')],'as':_0xee2d('0xb5'),'attributes':['id',_0xee2d('0xd'),'color'],'required':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]?!![]:![]},{'model':_0x5946fc[_0xee2d('0x72')],'as':_0xee2d('0xb7'),'attributes':['id',_0xee2d('0xd'),_0xee2d('0xb8')],'through':_0x447f5c[_0xee2d('0x8a')]['tag']?{'attributes':[],'where':{'TagId':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]||undefined}}:{},'required':_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb6')]?!![]:![]}];}else{_0x1c7ee2['include']=[{'all':!![]}];}}return _0x5946fc[_0x1d1c8d[_0xee2d('0x16')]][_0xee2d('0x7')](_0x1c7ee2);})['then'](function(_0x16071a){_0x1c3b77[_0xee2d('0xaf')]=_0x16071a;if(_0x208e0f===_0xee2d('0x38')&&_0x447f5c[_0xee2d('0x8a')][_0xee2d('0xb9')]===_0xee2d('0xba')){var _0x5001e3=[];for(var _0x3658f5=0x0;_0x3658f5<_0x1c3b77[_0xee2d('0xaf')][_0xee2d('0x90')];_0x3658f5++){_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbb'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbd'),_0x1c3b77[_0xee2d('0xaf')][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbe'),_0x1c3b77[_0xee2d('0xaf')][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xbf'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xc0'),_0x1c3b77['rows'][_0x3658f5][_0xee2d('0xbc')]));_0x5001e3[_0xee2d('0x96')](_0xa65656(_0xee2d('0xc1'),_0x1c3b77['rows'][_0x3658f5]['dataValues']));}return Promise['all'](_0x5001e3)['then'](function(){return _0x1c3b77;});}return _0x1c3b77;});}});}}});}; \ No newline at end of file +var _0x3f6c=['Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','QueryTypes','SELECT','select','InteractionId','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','query','raw','mergeResources','Invalid\x20section\x20\x27','length','push','find','params','all','ignore','isEmpty','union','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','where','merge','key','AnalyticExtractedReport','foreignKey','forEach','includeAll','reportType','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','include','color','tag','ThroughTags','openTabs','true','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','map','model','catch','UserProfileResource','associatedResources','resourceId','type','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','name','projectName','projects','JscriptyProject','contacts','CmContact','parentSections','Lists','ListId','lists','CmList','companies','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','role','agent','Telephones','telephone','queue','VoiceQueue','inbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','VoiceQueues','QueueCampaigns','users','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','pauses','Pause','scheduler','Schedule','sounds'];(function(_0x5a7611,_0x215f41){var _0x1357eb=function(_0x538f35){while(--_0x538f35){_0x5a7611['push'](_0x5a7611['shift']());}};_0x1357eb(++_0x215f41);}(_0x3f6c,0x113));var _0xc3f6=function(_0x4f9cc5,_0x33626d){_0x4f9cc5=_0x4f9cc5-0x0;var _0x238fdf=_0x3f6c[_0x4f9cc5];return _0x238fdf;};'use strict';var _=require(_0xc3f6('0x0'));var attributes=require(_0xc3f6('0x1'));var qs=require(_0xc3f6('0x2'));var squel=require('squel');module[_0xc3f6('0x3')]=function(_0x556357){var _0x50fb98=_0x556357[_0xc3f6('0x4')];function _0x388029(_0x392077,_0x20810e){return new Promise(function(_0x2bee71,_0x5cc99d){if(!_0x20810e)return _0x2bee71(null);var _0x40a9cf=_0x20810e[_0xc3f6('0x5')]?{[_0x20810e[_0xc3f6('0x5')][_0xc3f6('0x6')]]:_0x20810e[_0xc3f6('0x5')][_0xc3f6('0x7')]}:undefined;return _0x50fb98[_0x392077][_0xc3f6('0x8')]({'where':_0x40a9cf,'raw':!![]})[_0xc3f6('0x9')](function(_0x1b87b6){_0x20810e['associatedResources']=_[_0xc3f6('0xa')](_0x1b87b6,'id');_0x2bee71(_0x20810e);})['catch'](function(_0xa0eb06){_0x5cc99d(_0xa0eb06);});});}function _0x160d63(_0x554efb,_0x5b29ff){return new Promise(function(_0xd2a829,_0xbfe625){var _0x34a177=_0x554efb[_0xc3f6('0x5')]?{[_0x554efb['filter'][_0xc3f6('0x6')]]:_0x554efb['filter']['value']}:undefined;return _0x50fb98[_0x554efb[_0xc3f6('0xb')]][_0xc3f6('0x8')]({'where':_0x34a177,'raw':!![]})[_0xc3f6('0x9')](function(_0x9e0b47){_0x5b29ff['associatedResources']=_['map'](_0x9e0b47,function(_0x3b4a77){return _0x3b4a77['name'];});_0xd2a829(_0x5b29ff);})[_0xc3f6('0xc')](function(_0x5b7f5b){_0xbfe625(_0x5b7f5b);});});}function _0x51cc59(_0x43c3a9,_0x146c44,_0x290a38){if(!_0x146c44)return Promise['resolve'](null);return new Promise(function(_0xc065b5,_0x37951c){return _0x50fb98[_0xc3f6('0xd')][_0xc3f6('0x8')]({'where':{'sectionId':_0x146c44['id']},'raw':!![]})[_0xc3f6('0x9')](function(_0x4ea926){if(_0x43c3a9[_0xc3f6('0x6')]&&_0x43c3a9[_0xc3f6('0x6')]!=='id'){_0x146c44[_0xc3f6('0xe')]=_[_0xc3f6('0xa')](_0x4ea926,function(_0x3c0554){return _0x3c0554[_0x43c3a9[_0xc3f6('0x6')]];});}else{if(_0x290a38==='AnalyticExtractedReport'){_0x146c44['associatedResources']=_[_0xc3f6('0xa')](_0x4ea926,function(_0x3f4680){return{'id':_0x3f4680[_0xc3f6('0xf')],'type':_0x3f4680[_0xc3f6('0x10')]};});}else{_0x146c44[_0xc3f6('0xe')]=_['map'](_0x4ea926,function(_0x2837a4){return _0x2837a4[_0xc3f6('0xf')];});}}_0xc065b5(_0x146c44);})[_0xc3f6('0xc')](function(_0x53732b){_0x37951c(_0x53732b);});});}function _0x38afb5(_0xd73668,_0x1fbeaa){var _0xcc5093={'parentSections':[]};switch(_0xd73668['toLowerCase']()){case'squareprojects':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x12');break;case _0xc3f6('0x13'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x14');break;case _0xc3f6('0x15'):_0xcc5093['childModel']=_0xc3f6('0x16');_0xcc5093['parentSections']=[{'name':'SquareProjects','field':_0xc3f6('0x17'),'foreignKey':_0xc3f6('0x18')}];break;case _0xc3f6('0x19'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x1a');break;case _0xc3f6('0x1b'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x1c');_0xcc5093[_0xc3f6('0x1d')]=[{'name':_0xc3f6('0x1e'),'field':'id','foreignKey':_0xc3f6('0x1f')}];break;case _0xc3f6('0x20'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x21');break;case _0xc3f6('0x22'):_0xcc5093[_0xc3f6('0x11')]='CmCompany';break;case'globalcustomfields':_0xcc5093['childModel']='CmCustomField';break;case _0xc3f6('0x23'):_0xcc5093['childModel']=_0xc3f6('0x24');break;case'chatwebsites':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x25');break;case _0xc3f6('0x26'):_0xcc5093['childModel']=_0xc3f6('0x27');break;case _0xc3f6('0x28'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x29');break;case _0xc3f6('0x2a'):case _0xc3f6('0x2b'):case _0xc3f6('0x2c'):_0xcc5093[_0xc3f6('0x11')]='VoiceExtension';break;case'contexts':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x2d');break;case _0xc3f6('0x2e'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x2f');break;case _0xc3f6('0x30'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x31');_0xcc5093[_0xc3f6('0x1d')]=[{'name':'Agents','field':_0xc3f6('0x17'),'foreignKey':_0xc3f6('0x32'),'model':_0xc3f6('0x33'),'filter':{'field':_0xc3f6('0x34'),'value':[_0xc3f6('0x35')]}},{'name':_0xc3f6('0x36'),'field':_0xc3f6('0x17'),'foreignKey':_0xc3f6('0x32'),'model':_0xc3f6('0x33'),'filter':{'field':_0xc3f6('0x34'),'value':[_0xc3f6('0x37')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0xc3f6('0x38'),'model':_0xc3f6('0x39'),'filter':{'field':_0xc3f6('0x10'),'value':[_0xc3f6('0x3a')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':_0xc3f6('0x39'),'filter':{'field':_0xc3f6('0x10'),'value':['outbound']}}];break;case'musiconholds':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x3b');break;case _0xc3f6('0x3c'):_0xcc5093['childModel']=_0xc3f6('0x3d');break;case _0xc3f6('0x3e'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x3f');break;case _0xc3f6('0x40'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x41');break;case _0xc3f6('0x42'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x43');break;case _0xc3f6('0x44'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x45');break;case _0xc3f6('0x46'):_0xcc5093['childModel']=_0xc3f6('0x47');break;case'openchannelqueues':_0xcc5093[_0xc3f6('0x11')]='OpenchannelQueue';break;case _0xc3f6('0x48'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x49');break;case'smsqueues':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x4a');break;case'smsaccounts':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x4b');break;case _0xc3f6('0x4c'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x4d');break;case'whatsappaccounts':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x4e');break;case'teams':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x4f');break;case _0xc3f6('0x50'):case'queuecampaigns':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x39');if(_0x1fbeaa){_0xcc5093[_0xc3f6('0x1d')]=[{'name':_0xc3f6('0x51')},{'name':_0xc3f6('0x52')}];}break;case _0xc3f6('0x53'):case'agents':case _0xc3f6('0x54'):_0xcc5093['childModel']=_0xc3f6('0x33');if(_0x1fbeaa){_0xcc5093['parentSections']=[{'name':_0xc3f6('0x55'),'filter':{'field':_0xc3f6('0x34'),'value':[_0xc3f6('0x56'),_0xc3f6('0x57')]},'ignore':!![]},{'name':_0xc3f6('0x58')},{'name':_0xc3f6('0x36')}];}break;case'zendeskaccounts':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x59');break;case _0xc3f6('0x5a'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x5b');break;case'freshdeskaccounts':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x5c');break;case _0xc3f6('0x5d'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x5e');break;case _0xc3f6('0x5f'):_0xcc5093[_0xc3f6('0x11')]='DeskAccount';break;case _0xc3f6('0x60'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x61');break;case _0xc3f6('0x62'):_0xcc5093[_0xc3f6('0x11')]='User';break;case _0xc3f6('0x63'):_0xcc5093['childModel']=_0xc3f6('0x64');break;case _0xc3f6('0x65'):_0xcc5093['childModel']=_0xc3f6('0x66');break;case'customdashboards':_0xcc5093['childModel']=_0xc3f6('0x67');break;case'intervals':_0xcc5093[_0xc3f6('0x11')]='Interval';break;case _0xc3f6('0x68'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x69');break;case _0xc3f6('0x6a'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x6b');break;case _0xc3f6('0x6c'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x6d');break;case _0xc3f6('0x6e'):_0xcc5093['childModel']=_0xc3f6('0x6f');break;case'templates':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x70');break;case _0xc3f6('0x71'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x72');break;case _0xc3f6('0x73'):_0xcc5093['childModel']=_0xc3f6('0x74');break;case'variables':_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x75');break;case _0xc3f6('0x76'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x77');break;case _0xc3f6('0x78'):_0xcc5093[_0xc3f6('0x11')]='AnalyticExtractedReport';_0xcc5093[_0xc3f6('0x1d')]=[{'name':_0xc3f6('0x79'),'field':'id','foreignKey':_0xc3f6('0x7a')}];break;case _0xc3f6('0x7b'):_0xcc5093[_0xc3f6('0x11')]=_0xc3f6('0x7c');break;}return _0xcc5093;}function _0x7bcee7(_0x93d420,_0x12e57d){var _0x3da7ed=_0x93d420[_0xc3f6('0x7d')](0x0)['toUpperCase']()+_0x93d420[_0xc3f6('0x7e')](0x1);var _0x20f655={'type':_0x50fb98['Sequelize'][_0xc3f6('0x7f')][_0xc3f6('0x80')],'raw':!![]};return new Promise(function(_0x427358,_0x46eea2){var _0x4389f6=squel[_0xc3f6('0x81')]()[_0xc3f6('0x6')]('ui.'+_0x3da7ed+_0xc3f6('0x82'),'id')[_0xc3f6('0x6')]('ui.createdAt')[_0xc3f6('0x83')](_0xc3f6('0x84')+_0x93d420+_0xc3f6('0x85'),'ui')['where'](_0xc3f6('0x86'),_0x12e57d['id']);return _0x50fb98[_0xc3f6('0x87')]['query'](_0x4389f6[_0xc3f6('0x88')](),_0x20f655)[_0xc3f6('0x9')](function(_0x5ef24c){_0x12e57d[_0x3da7ed+_0xc3f6('0x89')]=_0x5ef24c;_0x427358(_0x5ef24c);})[_0xc3f6('0xc')](function(_0x7a071c){_0x46eea2(_0x7a071c);});});}return _0x556357[_0xc3f6('0x8a')](_0xc3f6('0x8b'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x4f099c){var _0xde583e={'raw':_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0x8d')],'where':{}};var _0x546eb2={};var _0x4a1f57={'count':0x0,'rows':[]};var _0x322703=_0x4f099c[_0xc3f6('0x8c')]['section'];var _0x231f2=_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0x8e')]||![];var _0x1863eb=_0x38afb5(_0x322703,_0x231f2);if(!_0x1863eb[_0xc3f6('0x11')])throw new Error(_0xc3f6('0x8f')+_0x322703+'\x27');var _0x148dd3=[{'name':_0x322703}];if(!_['isEmpty'](_0x1863eb[_0xc3f6('0x1d')]))_0x148dd3=_0x1863eb[_0xc3f6('0x1d')];var _0x39e1d4=[];for(var _0xc0d0e3=0x0;_0xc0d0e3<_0x148dd3[_0xc3f6('0x90')];_0xc0d0e3++){_0x39e1d4[_0xc3f6('0x91')](_0x50fb98['UserProfileSection'][_0xc3f6('0x92')]({'where':{'userProfileId':_0x4f099c[_0xc3f6('0x93')]['id'],'name':_0x148dd3[_0xc0d0e3][_0xc3f6('0x17')]},'raw':!![]}));}return Promise[_0xc3f6('0x94')](_0x39e1d4)[_0xc3f6('0x9')](function(_0x57a053){var _0x8a780c=_[_0xc3f6('0x5')](_0x57a053,function(_0x415170){return _0x415170?_0x415170:undefined;});var _0x3e2792=_['filter'](_0x148dd3,[_0xc3f6('0x95'),!![]]);var _0x4b3d74=_['isEmpty'](_0x8a780c)&&_[_0xc3f6('0x96')](_0x3e2792)?null:_[_0xc3f6('0x97')](_0x3e2792,_0x8a780c);if(!_0x4b3d74)return null;var _0x4224db=[];for(var _0xc8f6d5=0x0;_0xc8f6d5<_0x4b3d74[_0xc3f6('0x90')];_0xc8f6d5++){var _0x3e8229=_[_0xc3f6('0x92')](_0x148dd3,function(_0x2831cd){return _0x4b3d74[_0xc8f6d5]?_0x2831cd['name']===_0x4b3d74[_0xc8f6d5]['name']:null;});if(_0x3e8229){if(_0x4b3d74[_0xc8f6d5][_0xc3f6('0x95')]){_0x4224db[_0xc3f6('0x91')](_0x388029(_0x1863eb[_0xc3f6('0x11')],_0x4b3d74[_0xc8f6d5]));}else{if(!_0x4b3d74[_0xc8f6d5][_0xc3f6('0x98')]){_0x4224db[_0xc3f6('0x91')](_0x51cc59(_0x3e8229,_0x4b3d74[_0xc8f6d5],_0x1863eb[_0xc3f6('0x11')]));}else{if(_0x3e8229[_0xc3f6('0xb')]){_0x4224db['push'](_0x160d63(_0x3e8229,_0x4b3d74[_0xc8f6d5]));}}}}}return Promise[_0xc3f6('0x94')](_0x4224db);})[_0xc3f6('0x9')](function(_0x2b8197){var _0x4d6ae2=_0x2b8197;var _0x42bf9d=null;if(_0x4d6ae2){_0x42bf9d=_0x4d6ae2[_0xc3f6('0x90')]===0x1?_0x4d6ae2[0x0]:null;}if(!_0x42bf9d&&!_0x4d6ae2)return _0x4a1f57;var _0x1750a5=_0x50fb98[_0x1863eb[_0xc3f6('0x11')]][_0xc3f6('0x99')];_0x546eb2[_0xc3f6('0xb')]=_[_0xc3f6('0x9a')](_0x1750a5);_0x546eb2[_0xc3f6('0x8c')]=_[_0xc3f6('0x9a')](_0x4f099c[_0xc3f6('0x8c')]);_0x546eb2[_0xc3f6('0x9b')]=_[_0xc3f6('0x9c')](_0x546eb2['model'],_0x546eb2['query']);_0xde583e['attributes']=_[_0xc3f6('0x9c')](_0x546eb2['model'],qs[_0xc3f6('0x9d')](_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0x9d')]));_0xde583e['attributes']=_0xde583e['attributes'][_0xc3f6('0x90')]?_0xde583e[_0xc3f6('0x9e')]:_0x546eb2[_0xc3f6('0xb')];if(!_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0x9f')](_0xc3f6('0xa0'))){_0xde583e[_0xc3f6('0xa1')]=qs[_0xc3f6('0xa1')](_0x4f099c['query'][_0xc3f6('0xa1')]);_0xde583e[_0xc3f6('0xa2')]=qs['offset'](_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xa2')]);}_0xde583e[_0xc3f6('0xa3')]=qs[_0xc3f6('0xa4')](_0x4f099c['query']['sort']);_0xde583e['where']=qs['filters'](_['pick'](_0x4f099c[_0xc3f6('0x8c')],_0x546eb2[_0xc3f6('0x9b')]));if(_0x4f099c[_0xc3f6('0x8c')]['filter']){_0xde583e[_0xc3f6('0xa5')]=_[_0xc3f6('0xa6')](_0xde583e['where'],{'$or':_['map'](_0x1750a5,function(_0x197f6a){if(_0x197f6a[_0xc3f6('0x10')][_0xc3f6('0xa7')]!=='VIRTUAL'){var _0x4f7e6f={};_0x4f7e6f[_0x197f6a[_0xc3f6('0x6')]]={'$like':'%'+_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0x5')]+'%'};return _0x4f7e6f;}})});}var _0x2bc10b=[];var _0x4ddae7=null;var _0x4e5af9={};if(_0x42bf9d){_0x4ddae7=_['find'](_0x148dd3,[_0xc3f6('0x17'),_0x42bf9d['name']]);if(_0x4ddae7[_0xc3f6('0x6')]){_0x4e5af9={};if(_0x1863eb['childModel']===_0xc3f6('0xa8')){_0x4e5af9[_0x4ddae7[_0xc3f6('0xa9')]]=_[_0xc3f6('0xa')](_0x42bf9d[_0xc3f6('0xe')],'id');}else{_0x4e5af9[_0x4ddae7[_0xc3f6('0xa9')]]=_0x42bf9d[_0xc3f6('0xe')];}_0x2bc10b['push'](_0x4e5af9);}else{_0xde583e[_0xc3f6('0xa5')]['id']=_0x42bf9d[_0xc3f6('0xe')];}}else{for(var _0x4e8635=0x0;_0x4e8635<_0x4d6ae2[_0xc3f6('0x90')];_0x4e8635++){_0x4ddae7=_['find'](_0x148dd3,[_0xc3f6('0x17'),_0x4d6ae2[_0x4e8635][_0xc3f6('0x17')]]);if(_0x4ddae7[_0xc3f6('0x6')]){_0x4e5af9={};_0x4e5af9[_0x4ddae7['foreignKey']]=_0x4d6ae2[_0x4e8635][_0xc3f6('0xe')];_0x2bc10b['push'](_0x4e5af9);}else{if(!_0xde583e[_0xc3f6('0xa5')]['id'])_0xde583e['where']['id']=[];_0x4d6ae2[_0x4e8635]['associatedResources'][_0xc3f6('0xaa')](function(_0x40f28b){_0xde583e[_0xc3f6('0xa5')]['id'][_0xc3f6('0x91')](_0x40f28b);});}}}if(!_[_0xc3f6('0x96')](_0x2bc10b)){_0xde583e['where']=_['merge'](_0xde583e[_0xc3f6('0xa5')],{'$and':{'$or':_0x2bc10b}});}_0xde583e=_[_0xc3f6('0xa6')]({},_0xde583e,_0x4f099c['options']);if(_0x42bf9d&&!_0x42bf9d[_0xc3f6('0x98')]&&_0x1863eb[_0xc3f6('0x11')]===_0xc3f6('0xa8')){if(_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xab')]){_0xde583e['include']=[{'all':!![]}];}return _0x50fb98[_0x1863eb[_0xc3f6('0x11')]]['findAll'](_0xde583e)[_0xc3f6('0x9')](function(_0x48abe6){var _0x4f834e=[];_0x48abe6[_0xc3f6('0xaa')](function(_0x53914b){var _0x4e469a;switch(_0x53914b[_0xc3f6('0xac')]){case _0xc3f6('0xad'):_0x4e469a=_[_0xc3f6('0x92')](_0x42bf9d[_0xc3f6('0xe')],function(_0x263d4b){return _0x263d4b['id']===_0x53914b[_0xc3f6('0x7a')]&&_0x263d4b['type']==='DefaultReports';});break;case _0xc3f6('0xae'):_0x4e469a=_[_0xc3f6('0x92')](_0x42bf9d[_0xc3f6('0xe')],function(_0x310bec){return _0x310bec['id']===_0x53914b[_0xc3f6('0x7a')]&&_0x310bec['type']===_0xc3f6('0xaf');});break;}if(_0x4e469a)_0x4f834e[_0xc3f6('0x91')](_0x53914b);});_0x4a1f57[_0xc3f6('0xb0')]=_0x4f834e['length'];_0x4a1f57[_0xc3f6('0xb1')]=_0x4f834e;return _0x4a1f57;});}else{if(!_[_0xc3f6('0x96')](_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb2')])){_0xde583e['where']['id']=_0xde583e['where']['id']?_[_0xc3f6('0x9c')](_0xde583e[_0xc3f6('0xa5')]['id'],_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb2')]):_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb2')];if(_0x4f099c['query']['customSorting']){_0xde583e['order']=_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb3')];}}if(_0x4f099c['query'][_0xc3f6('0xb4')]){_0xde583e['where']=_['merge'](_0xde583e[_0xc3f6('0xa5')],{'$and':_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb4')]});}return _0x50fb98[_0x1863eb[_0xc3f6('0x11')]][_0xc3f6('0xb0')]({'where':_0xde583e['where']})['then'](function(_0x213fd5){_0x4a1f57[_0xc3f6('0xb0')]=_0x213fd5;if(_0x4f099c['query'][_0xc3f6('0xab')]){if(_0x1863eb[_0xc3f6('0x11')]===_0xc3f6('0x1c')){_0xde583e[_0xc3f6('0xb5')]=[{'model':_0x50fb98[_0xc3f6('0x6f')],'as':'Tags','attributes':['id',_0xc3f6('0x17'),_0xc3f6('0xb6')],'required':_0x4f099c['query'][_0xc3f6('0xb7')]?!![]:![]},{'model':_0x50fb98[_0xc3f6('0x6f')],'as':_0xc3f6('0xb8'),'attributes':['id','name',_0xc3f6('0xb6')],'through':_0x4f099c['query'][_0xc3f6('0xb7')]?{'attributes':[],'where':{'TagId':_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb7')]||undefined}}:{},'required':_0x4f099c[_0xc3f6('0x8c')]['tag']?!![]:![]}];}else{_0xde583e[_0xc3f6('0xb5')]=[{'all':!![]}];}}return _0x50fb98[_0x1863eb['childModel']]['findAll'](_0xde583e);})['then'](function(_0x1b4d6e){_0x4a1f57[_0xc3f6('0xb1')]=_0x1b4d6e;if(_0x322703===_0xc3f6('0x58')&&_0x4f099c[_0xc3f6('0x8c')][_0xc3f6('0xb9')]===_0xc3f6('0xba')){var _0x118aad=[];for(var _0x244cb1=0x0;_0x244cb1<_0x4a1f57[_0xc3f6('0xb1')][_0xc3f6('0x90')];_0x244cb1++){_0x118aad[_0xc3f6('0x91')](_0x7bcee7('chat',_0x4a1f57[_0xc3f6('0xb1')][_0x244cb1][_0xc3f6('0xbb')]));_0x118aad['push'](_0x7bcee7(_0xc3f6('0xbc'),_0x4a1f57[_0xc3f6('0xb1')][_0x244cb1][_0xc3f6('0xbb')]));_0x118aad[_0xc3f6('0x91')](_0x7bcee7('fax',_0x4a1f57[_0xc3f6('0xb1')][_0x244cb1]['dataValues']));_0x118aad[_0xc3f6('0x91')](_0x7bcee7(_0xc3f6('0xbd'),_0x4a1f57[_0xc3f6('0xb1')][_0x244cb1][_0xc3f6('0xbb')]));_0x118aad['push'](_0x7bcee7(_0xc3f6('0xbe'),_0x4a1f57[_0xc3f6('0xb1')][_0x244cb1][_0xc3f6('0xbb')]));_0x118aad['push'](_0x7bcee7(_0xc3f6('0xbf'),_0x4a1f57['rows'][_0x244cb1]['dataValues']));}return Promise[_0xc3f6('0x94')](_0x118aad)[_0xc3f6('0x9')](function(){return _0x4a1f57;});}return _0x4a1f57;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 3c01f34..fc50765 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 _0x3e24=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register'];(function(_0x22dc58,_0x38deff){var _0x242216=function(_0x5244af){while(--_0x5244af){_0x22dc58['push'](_0x22dc58['shift']());}};_0x242216(++_0x38deff);}(_0x3e24,0x167));var _0x43e2=function(_0xc3f3bd,_0x20b7f5){_0xc3f3bd=_0xc3f3bd-0x0;var _0x27d0bd=_0x3e24[_0xc3f3bd];return _0x27d0bd;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});config[_0x43e2('0xc')]=_[_0x43e2('0xd')](config['redis'],{'host':_0x43e2('0xe'),'port':0x18eb});var socket=require(_0x43e2('0xf'))(new Redis(config['redis']));require(_0x43e2('0x10'))[_0x43e2('0x11')](socket);function respondWithRpcPromise(_0x5375d8,_0x2ed387,_0x1ef968){return new BPromise(function(_0x52146c,_0x45848e){return client['request'](_0x5375d8,_0x1ef968)['then'](function(_0x5847f0){logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));logger[_0x43e2('0x15')](_0x43e2('0x16'),_0x2ed387,_0x43e2('0x14'),JSON[_0x43e2('0x17')](_0x5847f0));if(_0x5847f0[_0x43e2('0x18')]){if(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x19')]===0x1f4){logger[_0x43e2('0x18')](_0x43e2('0x13'),_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x45848e(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}logger[_0x43e2('0x18')]('UserProfile,\x20%s,\x20%s',_0x2ed387,_0x5847f0['error'][_0x43e2('0x1a')]);return _0x52146c(_0x5847f0[_0x43e2('0x18')][_0x43e2('0x1a')]);}else{logger[_0x43e2('0x12')](_0x43e2('0x13'),_0x2ed387,_0x43e2('0x14'));_0x52146c(_0x5847f0[_0x43e2('0x1b')][_0x43e2('0x1a')]);}})[_0x43e2('0x1c')](function(_0x399cab){logger['error'](_0x43e2('0x13'),_0x2ed387,_0x399cab);_0x45848e(_0x399cab);});});} \ No newline at end of file +var _0x1410=['error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1410,0x130));var _0x0141=function(_0x458deb,_0x1d40f3){_0x458deb=_0x458deb-0x0;var _0x12ca07=_0x1410[_0x458deb];return _0x12ca07;};'use strict';var _=require(_0x0141('0x0'));var util=require(_0x0141('0x1'));var moment=require(_0x0141('0x2'));var BPromise=require(_0x0141('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0141('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0141('0x5'));var logger=require('../../config/logger')(_0x0141('0x6'));var config=require(_0x0141('0x7'));var jayson=require(_0x0141('0x8'));var client=jayson[_0x0141('0x9')][_0x0141('0xa')]({'port':0x232a});config[_0x0141('0xb')]=_[_0x0141('0xc')](config[_0x0141('0xb')],{'host':_0x0141('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0141('0xb')]));require(_0x0141('0xe'))[_0x0141('0xf')](socket);function respondWithRpcPromise(_0x3465f2,_0x1b6b66,_0x1798ae){return new BPromise(function(_0x3f5e8f,_0x5f368f){return client['request'](_0x3465f2,_0x1798ae)[_0x0141('0x10')](function(_0x3b7718){logger[_0x0141('0x11')](_0x0141('0x12'),_0x1b6b66,'request\x20sent');logger['debug'](_0x0141('0x13'),_0x1b6b66,_0x0141('0x14'),JSON['stringify'](_0x3b7718));if(_0x3b7718[_0x0141('0x15')]){if(_0x3b7718[_0x0141('0x15')][_0x0141('0x16')]===0x1f4){logger[_0x0141('0x15')](_0x0141('0x12'),_0x1b6b66,_0x3b7718['error'][_0x0141('0x17')]);return _0x5f368f(_0x3b7718['error'][_0x0141('0x17')]);}logger[_0x0141('0x15')](_0x0141('0x12'),_0x1b6b66,_0x3b7718[_0x0141('0x15')][_0x0141('0x17')]);return _0x3f5e8f(_0x3b7718[_0x0141('0x15')]['message']);}else{logger['info'](_0x0141('0x12'),_0x1b6b66,_0x0141('0x14'));_0x3f5e8f(_0x3b7718['result'][_0x0141('0x17')]);}})[_0x0141('0x18')](function(_0x8beed8){logger[_0x0141('0x15')]('UserProfile,\x20%s,\x20%s',_0x1b6b66,_0x8beed8);_0x5f368f(_0x8beed8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 07d8f6a..e87c4c6 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 _0x6f30=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x3fc3c1,_0x332974){var _0x430c0b=function(_0x2cca0d){while(--_0x2cca0d){_0x3fc3c1['push'](_0x3fc3c1['shift']());}};_0x430c0b(++_0x332974);}(_0x6f30,0x1ce));var _0x06f3=function(_0xc5e02a,_0xd9da3c){_0xc5e02a=_0xc5e02a-0x0;var _0xbeca77=_0x6f30[_0xc5e02a];return _0xbeca77;};'use strict';var UserProfileEvents=require(_0x06f3('0x0'));var events=[_0x06f3('0x1'),_0x06f3('0x2'),_0x06f3('0x3')];function createListener(_0x55de13,_0x336365){return function(_0x251841){_0x336365[_0x06f3('0x4')](_0x55de13,_0x251841);};}function removeListener(_0x4a9f5c,_0x338a42){return function(){UserProfileEvents[_0x06f3('0x5')](_0x4a9f5c,_0x338a42);};}exports['register']=function(_0xda242a){for(var _0x229e97=0x0,_0x4b47ef=events[_0x06f3('0x6')];_0x229e97<_0x4b47ef;_0x229e97++){var _0x3b23dd=events[_0x229e97];var _0x41a85f=createListener(_0x06f3('0x7')+_0x3b23dd,_0xda242a);UserProfileEvents['on'](_0x3b23dd,_0x41a85f);}}; \ No newline at end of file +var _0x8a46=['emit','removeListener','length','save','remove'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x8a46,0x1f2));var _0x68a4=function(_0x58b2ed,_0x5dda14){_0x58b2ed=_0x58b2ed-0x0;var _0x17a40b=_0x8a46[_0x58b2ed];return _0x17a40b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x68a4('0x0'),_0x68a4('0x1'),'update'];function createListener(_0x44c962,_0x19699d){return function(_0x22398a){_0x19699d[_0x68a4('0x2')](_0x44c962,_0x22398a);};}function removeListener(_0x14ba1e,_0x616cd0){return function(){UserProfileEvents[_0x68a4('0x3')](_0x14ba1e,_0x616cd0);};}exports['register']=function(_0x18ee58){for(var _0x1d666c=0x0,_0x225da8=events[_0x68a4('0x4')];_0x1d666c<_0x225da8;_0x1d666c++){var _0x273a5a=events[_0x1d666c];var _0x6b14cb=createListener('userProfile:'+_0x273a5a,_0x18ee58);UserProfileEvents['on'](_0x273a5a,_0x6b14cb);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6e8128f..ba0c0f4 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 _0x8def=['post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','show'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8def,0x18e));var _0xf8de=function(_0x49c2e1,_0x16469a){_0x49c2e1=_0x49c2e1-0x0;var _0x14f88b=_0x8def[_0x49c2e1];return _0x14f88b;};'use strict';var multer=require('multer');var util=require(_0xf8de('0x0'));var path=require(_0xf8de('0x1'));var timeout=require(_0xf8de('0x2'));var express=require(_0xf8de('0x3'));var router=express[_0xf8de('0x4')]();var fs_extra=require(_0xf8de('0x5'));var auth=require(_0xf8de('0x6'));var interaction=require(_0xf8de('0x7'));var config=require(_0xf8de('0x8'));var controller=require(_0xf8de('0x9'));router[_0xf8de('0xa')]('/',auth['isAuthenticated'](),controller[_0xf8de('0xb')]);router[_0xf8de('0xa')](_0xf8de('0xc'),auth[_0xf8de('0xd')](),controller[_0xf8de('0xe')]);router[_0xf8de('0xa')]('/:id',auth[_0xf8de('0xd')](),controller[_0xf8de('0xf')]);router[_0xf8de('0x10')]('/',auth['isAuthenticated'](),controller[_0xf8de('0x11')]);router[_0xf8de('0x12')](_0xf8de('0x13'),auth[_0xf8de('0xd')](),controller[_0xf8de('0x14')]);router[_0xf8de('0x15')]('/:id',auth[_0xf8de('0xd')](),controller[_0xf8de('0x16')]);module['exports']=router; \ No newline at end of file +var _0xf0e9=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller'];(function(_0x43e25e,_0x3cb8d2){var _0x3f4a8a=function(_0x4fded4){while(--_0x4fded4){_0x43e25e['push'](_0x43e25e['shift']());}};_0x3f4a8a(++_0x3cb8d2);}(_0xf0e9,0x66));var _0x9f0e=function(_0x1387f3,_0x44e5ce){_0x1387f3=_0x1387f3-0x0;var _0x4137de=_0xf0e9[_0x1387f3];return _0x4137de;};'use strict';var multer=require(_0x9f0e('0x0'));var util=require(_0x9f0e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9f0e('0x2'));var router=express[_0x9f0e('0x3')]();var fs_extra=require(_0x9f0e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9f0e('0x5'));var config=require(_0x9f0e('0x6'));var controller=require(_0x9f0e('0x7'));router[_0x9f0e('0x8')]('/',auth[_0x9f0e('0x9')](),controller[_0x9f0e('0xa')]);router[_0x9f0e('0x8')](_0x9f0e('0xb'),auth[_0x9f0e('0x9')](),controller[_0x9f0e('0xc')]);router[_0x9f0e('0x8')](_0x9f0e('0xd'),auth[_0x9f0e('0x9')](),controller[_0x9f0e('0xe')]);router[_0x9f0e('0xf')]('/',auth[_0x9f0e('0x9')](),controller[_0x9f0e('0x10')]);router[_0x9f0e('0x11')](_0x9f0e('0xd'),auth['isAuthenticated'](),controller[_0x9f0e('0x12')]);router[_0x9f0e('0x13')](_0x9f0e('0xd'),auth[_0x9f0e('0x9')](),controller[_0x9f0e('0x14')]);module[_0x9f0e('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 c819b73..413f9c6 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 _0xa0d2=['STRING','INTEGER','sequelize'];(function(_0xf0aa82,_0x6cd556){var _0x1e1caa=function(_0x30985e){while(--_0x30985e){_0xf0aa82['push'](_0xf0aa82['shift']());}};_0x1e1caa(++_0x6cd556);}(_0xa0d2,0x146));var _0x2a0d=function(_0x55ff57,_0x19cabf){_0x55ff57=_0x55ff57-0x0;var _0x42cf8b=_0xa0d2[_0x55ff57];return _0x42cf8b;};'use strict';var Sequelize=require(_0x2a0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a0d('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x2a0d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a0d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe077=['INTEGER','sequelize','STRING'];(function(_0x37bc1e,_0x3cd4f6){var _0x463f4c=function(_0x31ec8c){while(--_0x31ec8c){_0x37bc1e['push'](_0x37bc1e['shift']());}};_0x463f4c(++_0x3cd4f6);}(_0xe077,0x1a2));var _0x7e07=function(_0xa99343,_0x5cea58){_0xa99343=_0xa99343-0x0;var _0x24d47c=_0xe077[_0xa99343];return _0x24d47c;};'use strict';var Sequelize=require(_0x7e07('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e07('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7e07('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7e07('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index d87aae4..fbd3c38 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 _0x9f0e=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f0e,0x116));var _0xe9f0=function(_0x54b8ae,_0x2de98e){_0x54b8ae=_0x54b8ae-0x0;var _0x427596=_0x9f0e[_0x54b8ae];return _0x427596;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['UserProfileResource'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['UserProfileResource'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['UserProfileResource'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));};exports[_0xe9f0('0x49')]=function(_0x5163ea,_0x2bf65c){return db[_0xe9f0('0x2c')][_0xe9f0('0x49')]()[_0xe9f0('0x24')](respondWithResult(_0x2bf65c,null))['catch'](handleError(_0x2bf65c,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x4c7d8b,_0x572388){var _0x187158=function(_0x5e956d){while(--_0x5e956d){_0x4c7d8b['push'](_0x4c7d8b['shift']());}};_0x187158(++_0x572388);}(_0xba34,0x119));var _0x4ba3=function(_0x273549,_0x239d70){_0x273549=_0x273549-0x0;var _0x5d11fb=_0xba34[_0x273549];return _0x5d11fb;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 6b0fac9..344efb1 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 _0x6f32=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','user_profile_has_resources','compositeIndex','resourceId','lodash','api'];(function(_0x23f211,_0x19fae5){var _0x428abf=function(_0x2bc256){while(--_0x2bc256){_0x23f211['push'](_0x23f211['shift']());}};_0x428abf(++_0x19fae5);}(_0x6f32,0x15a));var _0x26f3=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6f32[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x26f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x26f3('0x1'));var moment=require(_0x26f3('0x2'));var BPromise=require(_0x26f3('0x3'));var rp=require(_0x26f3('0x4'));var fs=require('fs');var path=require(_0x26f3('0x5'));var rimraf=require(_0x26f3('0x6'));var config=require(_0x26f3('0x7'));var attributes=require('./userProfileResource.attributes');module[_0x26f3('0x8')]=function(_0x442c63,_0x3aa2d9){return _0x442c63['define']('UserProfileResource',attributes,{'tableName':_0x26f3('0x9'),'paranoid':![],'indexes':[{'name':_0x26f3('0xa'),'fields':[_0x26f3('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x826f=['path','../../config/environment','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','api','moment','bluebird'];(function(_0x3de75b,_0x26dd7d){var _0x94ff7e=function(_0x5641fe){while(--_0x5641fe){_0x3de75b['push'](_0x3de75b['shift']());}};_0x94ff7e(++_0x26dd7d);}(_0x826f,0x131));var _0xf826=function(_0x5ec333,_0x4ec690){_0x5ec333=_0x5ec333-0x0;var _0x4febba=_0x826f[_0x5ec333];return _0x4febba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf826('0x0'));var moment=require(_0xf826('0x1'));var BPromise=require(_0xf826('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf826('0x3'));var rimraf=require('rimraf');var config=require(_0xf826('0x4'));var attributes=require('./userProfileResource.attributes');module[_0xf826('0x5')]=function(_0x445b12,_0x39e1c6){return _0x445b12[_0xf826('0x6')]('UserProfileResource',attributes,{'tableName':_0xf826('0x7'),'paranoid':![],'indexes':[{'name':_0xf826('0x8'),'fields':[_0xf826('0x9'),_0xf826('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 1c143dc..9e28bd7 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 _0x1def=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4ff8b9,_0x1631d4){var _0xdcd7e1=function(_0xb207fc){while(--_0xb207fc){_0x4ff8b9['push'](_0x4ff8b9['shift']());}};_0xdcd7e1(++_0x1631d4);}(_0x1def,0x15e));var _0xf1de=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x1def[_0x51fe5f];return _0x4abce9;};'use strict';var _=require('lodash');var util=require(_0xf1de('0x0'));var moment=require(_0xf1de('0x1'));var BPromise=require('bluebird');var rs=require(_0xf1de('0x2'));var fs=require('fs');var Redis=require(_0xf1de('0x3'));var db=require(_0xf1de('0x4'))['db'];var utils=require(_0xf1de('0x5'));var logger=require(_0xf1de('0x6'))(_0xf1de('0x7'));var config=require(_0xf1de('0x8'));var jayson=require(_0xf1de('0x9'));var client=jayson[_0xf1de('0xa')][_0xf1de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1308e1,_0x51231b,_0x16ca3e){return new BPromise(function(_0x481e38,_0x150e49){return client[_0xf1de('0xc')](_0x1308e1,_0x16ca3e)[_0xf1de('0xd')](function(_0x3aee60){logger[_0xf1de('0xe')](_0xf1de('0xf'),_0x51231b,_0xf1de('0x10'));logger[_0xf1de('0x11')](_0xf1de('0x12'),_0x51231b,'request\x20sent',JSON[_0xf1de('0x13')](_0x3aee60));if(_0x3aee60[_0xf1de('0x14')]){if(_0x3aee60[_0xf1de('0x14')][_0xf1de('0x15')]===0x1f4){logger[_0xf1de('0x14')](_0xf1de('0xf'),_0x51231b,_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);return _0x150e49(_0x3aee60['error'][_0xf1de('0x16')]);}logger[_0xf1de('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x51231b,_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);return _0x481e38(_0x3aee60[_0xf1de('0x14')][_0xf1de('0x16')]);}else{logger[_0xf1de('0xe')](_0xf1de('0xf'),_0x51231b,_0xf1de('0x10'));_0x481e38(_0x3aee60[_0xf1de('0x17')][_0xf1de('0x16')]);}})[_0xf1de('0x18')](function(_0x482224){logger[_0xf1de('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x51231b,_0x482224);_0x150e49(_0x482224);});});} \ No newline at end of file +var _0x0b76=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x25dc97,_0x3c08e7){var _0x408fa2=function(_0x54a509){while(--_0x54a509){_0x25dc97['push'](_0x25dc97['shift']());}};_0x408fa2(++_0x3c08e7);}(_0x0b76,0xb7));var _0x60b7=function(_0x2fac60,_0xe09450){_0x2fac60=_0x2fac60-0x0;var _0x48d582=_0x0b76[_0x2fac60];return _0x48d582;};'use strict';var _=require(_0x60b7('0x0'));var util=require(_0x60b7('0x1'));var moment=require('moment');var BPromise=require(_0x60b7('0x2'));var rs=require(_0x60b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60b7('0x4'))['db'];var utils=require(_0x60b7('0x5'));var logger=require(_0x60b7('0x6'))(_0x60b7('0x7'));var config=require(_0x60b7('0x8'));var jayson=require(_0x60b7('0x9'));var client=jayson[_0x60b7('0xa')][_0x60b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x360c9a,_0x370684,_0xe2a51d){return new BPromise(function(_0x2929b0,_0x26d99b){return client['request'](_0x360c9a,_0xe2a51d)[_0x60b7('0xc')](function(_0x47e353){logger[_0x60b7('0xd')](_0x60b7('0xe'),_0x370684,_0x60b7('0xf'));logger[_0x60b7('0x10')](_0x60b7('0x11'),_0x370684,_0x60b7('0xf'),JSON[_0x60b7('0x12')](_0x47e353));if(_0x47e353[_0x60b7('0x13')]){if(_0x47e353[_0x60b7('0x13')]['code']===0x1f4){logger[_0x60b7('0x13')](_0x60b7('0xe'),_0x370684,_0x47e353[_0x60b7('0x13')]['message']);return _0x26d99b(_0x47e353[_0x60b7('0x13')][_0x60b7('0x14')]);}logger[_0x60b7('0x13')](_0x60b7('0xe'),_0x370684,_0x47e353[_0x60b7('0x13')][_0x60b7('0x14')]);return _0x2929b0(_0x47e353['error'][_0x60b7('0x14')]);}else{logger[_0x60b7('0xd')](_0x60b7('0xe'),_0x370684,_0x60b7('0xf'));_0x2929b0(_0x47e353[_0x60b7('0x15')][_0x60b7('0x14')]);}})[_0x60b7('0x16')](function(_0x28be58){logger['error'](_0x60b7('0xe'),_0x370684,_0x28be58);_0x26d99b(_0x28be58);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c28e843..64410ae 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 _0x1aaf=['describe','/:id','show','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index','/describe','isAuthenticated'];(function(_0x1fe140,_0x39a06a){var _0x3afa84=function(_0xe907b3){while(--_0xe907b3){_0x1fe140['push'](_0x1fe140['shift']());}};_0x3afa84(++_0x39a06a);}(_0x1aaf,0x138));var _0xf1aa=function(_0x12fdf4,_0x537462){_0x12fdf4=_0x12fdf4-0x0;var _0x3e8b88=_0x1aaf[_0x12fdf4];return _0x3e8b88;};'use strict';var multer=require('multer');var util=require(_0xf1aa('0x0'));var path=require(_0xf1aa('0x1'));var timeout=require(_0xf1aa('0x2'));var express=require('express');var router=express[_0xf1aa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1aa('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf1aa('0x5'));var controller=require(_0xf1aa('0x6'));router[_0xf1aa('0x7')]('/',auth['isAuthenticated'](),controller[_0xf1aa('0x8')]);router[_0xf1aa('0x7')](_0xf1aa('0x9'),auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xb')]);router[_0xf1aa('0x7')](_0xf1aa('0xc'),auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xd')]);router['post']('/',auth[_0xf1aa('0xa')](),controller['create']);router[_0xf1aa('0xe')]('/:id',auth[_0xf1aa('0xa')](),controller[_0xf1aa('0xf')]);router[_0xf1aa('0x10')]('/:id',auth[_0xf1aa('0xa')](),controller[_0xf1aa('0x11')]);module[_0xf1aa('0x12')]=router; \ No newline at end of file +var _0x4042=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','get','index','isAuthenticated'];(function(_0x544c03,_0x558fe4){var _0x5e86ad=function(_0x3b2aaf){while(--_0x3b2aaf){_0x544c03['push'](_0x544c03['shift']());}};_0x5e86ad(++_0x558fe4);}(_0x4042,0x199));var _0x2404=function(_0x1a62bb,_0x157e87){_0x1a62bb=_0x1a62bb-0x0;var _0x4ade6f=_0x4042[_0x1a62bb];return _0x4ade6f;};'use strict';var multer=require(_0x2404('0x0'));var util=require(_0x2404('0x1'));var path=require(_0x2404('0x2'));var timeout=require(_0x2404('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2404('0x4'));var auth=require(_0x2404('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0x2404('0x6')]('/',auth['isAuthenticated'](),controller[_0x2404('0x7')]);router['get']('/describe',auth[_0x2404('0x8')](),controller[_0x2404('0x9')]);router['get']('/:id',auth[_0x2404('0x8')](),controller[_0x2404('0xa')]);router[_0x2404('0xb')]('/',auth['isAuthenticated'](),controller[_0x2404('0xc')]);router[_0x2404('0xd')](_0x2404('0xe'),auth['isAuthenticated'](),controller[_0x2404('0xf')]);router[_0x2404('0x10')](_0x2404('0xe'),auth['isAuthenticated'](),controller[_0x2404('0x11')]);module[_0x2404('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 8a1b422..5780360 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(_0x139e7f,_0x45855a){var _0x271c5f=function(_0x56350e){while(--_0x56350e){_0x139e7f['push'](_0x139e7f['shift']());}};_0x271c5f(++_0x45855a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x18896b,_0xb22a57){_0x18896b=_0x18896b-0x0;var _0x5a81d2=_0x9ffd[_0x18896b];return _0x5a81d2;};'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 _0x056b=['getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x3ad497,_0x196433){var _0x5d2b57=function(_0x294cf2){while(--_0x294cf2){_0x3ad497['push'](_0x3ad497['shift']());}};_0x5d2b57(++_0x196433);}(_0x056b,0xb6));var _0xb056=function(_0x14914a,_0x3eae81){_0x14914a=_0x14914a-0x0;var _0x3766ec=_0x056b[_0x14914a];return _0x3766ec;};'use strict';var Sequelize=require('sequelize');module[_0xb056('0x0')]={'name':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xb056('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb056('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xb056('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb056('0x1')],'set':function(_0x4157e0){this[_0xb056('0x4')](_0xb056('0x5'),_0x4157e0?_0x4157e0[_0xb056('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xb056('0x5'))?this[_0xb056('0x7')](_0xb056('0x5'))[_0xb056('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 2af6728..61decee 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 _0xb6cb=['catch','show','params','rawAttributes','options','find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','json','reject','save','update','then','stack','name','send','map','UserProfileSection','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','includeAll','include'];(function(_0x564608,_0x3dfdc7){var _0x197419=function(_0x29b71e){while(--_0x29b71e){_0x564608['push'](_0x564608['shift']());}};_0x197419(++_0x3dfdc7);}(_0xb6cb,0x1de));var _0xbb6c=function(_0x256cc1,_0x568424){_0x256cc1=_0x256cc1-0x0;var _0x330d0a=_0xb6cb[_0x256cc1];return _0x330d0a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb6c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb6c('0x1'));var rp=require(_0xbb6c('0x2'));var moment=require(_0xbb6c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbb6c('0x4'));var path=require(_0xbb6c('0x5'));var sox=require(_0xbb6c('0x6'));var csv=require(_0xbb6c('0x7'));var ejs=require(_0xbb6c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb6c('0x9'));var squel=require(_0xbb6c('0xa'));var crypto=require(_0xbb6c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb6c('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbb6c('0xd'));var Redis=require('ioredis');var authService=require(_0xbb6c('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbb6c('0xf'));var hardwareService=require(_0xbb6c('0x10'));var logger=require('../../config/logger')(_0xbb6c('0x11'));var utils=require(_0xbb6c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xbb6c('0x13'));var db=require(_0xbb6c('0x14'))['db'];function respondWithStatusCode(_0x1e24fb,_0x43c5fb){_0x43c5fb=_0x43c5fb||0xcc;return function(_0x5d9455){if(_0x5d9455){return _0x1e24fb[_0xbb6c('0x15')](_0x43c5fb);}return _0x1e24fb['status'](_0x43c5fb)[_0xbb6c('0x16')]();};}function respondWithResult(_0x51e667,_0x41ee74){_0x41ee74=_0x41ee74||0xc8;return function(_0x347316){if(_0x347316){return _0x51e667['status'](_0x41ee74)['json'](_0x347316);}};}function respondWithFilteredResult(_0x528c9c,_0x229899){return function(_0x37ce90){if(_0x37ce90){var _0xa1da9f=typeof _0x229899[_0xbb6c('0x17')]==='undefined'&&typeof _0x229899[_0xbb6c('0x18')]===_0xbb6c('0x19');var _0x3456f6=_0x37ce90[_0xbb6c('0x1a')];var _0x25395d=_0xa1da9f?0x0:_0x229899[_0xbb6c('0x17')];var _0x314210=_0xa1da9f?_0x37ce90[_0xbb6c('0x1a')]:_0x229899[_0xbb6c('0x17')]+_0x229899[_0xbb6c('0x18')];var _0x4c30e3;if(_0x314210>=_0x3456f6){_0x314210=_0x3456f6;_0x4c30e3=0xc8;}else{_0x4c30e3=0xce;}_0x528c9c[_0xbb6c('0x1b')](_0x4c30e3);return _0x528c9c[_0xbb6c('0x1c')]('Content-Range',_0x25395d+'-'+_0x314210+'/'+_0x3456f6)[_0xbb6c('0x1d')](_0x37ce90);}return null;};}function patchUpdates(_0x48ccca){return function(_0x2e88c7){try{jsonpatch['apply'](_0x2e88c7,_0x48ccca,!![]);}catch(_0x33dc99){return BPromise[_0xbb6c('0x1e')](_0x33dc99);}return _0x2e88c7[_0xbb6c('0x1f')]();};}function saveUpdates(_0x4b45ed,_0x3aa538){return function(_0x2a0536){if(_0x2a0536){return _0x2a0536[_0xbb6c('0x20')](_0x4b45ed)[_0xbb6c('0x21')](function(_0x1d298f){return _0x1d298f;});}return null;};}function removeEntity(_0x4de603,_0x9d2106){return function(_0x30c2e0){if(_0x30c2e0){return _0x30c2e0['destroy']()[_0xbb6c('0x21')](function(){_0x4de603[_0xbb6c('0x1b')](0xcc)[_0xbb6c('0x16')]();});}};}function handleEntityNotFound(_0x1afb13,_0x57db4a){return function(_0xa95384){if(!_0xa95384){_0x1afb13[_0xbb6c('0x15')](0x194);}return _0xa95384;};}function handleError(_0x3b9b25,_0x3ee350){_0x3ee350=_0x3ee350||0x1f4;return function(_0x537315){logger['error'](_0x537315[_0xbb6c('0x22')]);if(_0x537315[_0xbb6c('0x23')]){delete _0x537315[_0xbb6c('0x23')];}_0x3b9b25['status'](_0x3ee350)[_0xbb6c('0x24')](_0x537315);};}exports['index']=function(_0x4258da,_0x589e58){var _0x1cb7c9={},_0x3a5c5b={},_0x2769fa={'count':0x0,'rows':[]};var _0x2b9157=_[_0xbb6c('0x25')](db[_0xbb6c('0x26')]['rawAttributes'],function(_0x36bf2b){return{'name':_0x36bf2b[_0xbb6c('0x27')],'type':_0x36bf2b['type']['key']};});_0x3a5c5b['model']=_[_0xbb6c('0x25')](_0x2b9157,'name');_0x3a5c5b[_0xbb6c('0x28')]=_[_0xbb6c('0x29')](_0x4258da[_0xbb6c('0x28')]);_0x3a5c5b[_0xbb6c('0x2a')]=_[_0xbb6c('0x2b')](_0x3a5c5b[_0xbb6c('0x2c')],_0x3a5c5b[_0xbb6c('0x28')]);_0x1cb7c9[_0xbb6c('0x2d')]=_[_0xbb6c('0x2b')](_0x3a5c5b['model'],qs[_0xbb6c('0x2e')](_0x4258da['query'][_0xbb6c('0x2e')]));_0x1cb7c9['attributes']=_0x1cb7c9['attributes'][_0xbb6c('0x2f')]?_0x1cb7c9['attributes']:_0x3a5c5b['model'];if(!_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x30')](_0xbb6c('0x31'))){_0x1cb7c9[_0xbb6c('0x18')]=qs[_0xbb6c('0x18')](_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x18')]);_0x1cb7c9[_0xbb6c('0x17')]=qs[_0xbb6c('0x17')](_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x17')]);}_0x1cb7c9[_0xbb6c('0x32')]=qs[_0xbb6c('0x33')](_0x4258da[_0xbb6c('0x28')]['sort']);_0x1cb7c9[_0xbb6c('0x34')]=qs[_0xbb6c('0x2a')](_['pick'](_0x4258da['query'],_0x3a5c5b[_0xbb6c('0x2a')]),_0x2b9157);if(_0x4258da['query'][_0xbb6c('0x35')]){_0x1cb7c9['where']=_['merge'](_0x1cb7c9[_0xbb6c('0x34')],{'$or':_[_0xbb6c('0x25')](_0x2b9157,function(_0x5c28e8){if(_0x5c28e8[_0xbb6c('0x36')]!=='VIRTUAL'){var _0x44dd0d={};_0x44dd0d[_0x5c28e8[_0xbb6c('0x23')]]={'$like':'%'+_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x35')]+'%'};return _0x44dd0d;}})});}_0x1cb7c9=_[_0xbb6c('0x37')]({},_0x1cb7c9,_0x4258da['options']);var _0x35fb46={'where':_0x1cb7c9[_0xbb6c('0x34')]};return db[_0xbb6c('0x26')][_0xbb6c('0x1a')](_0x35fb46)[_0xbb6c('0x21')](function(_0x640b1d){_0x2769fa[_0xbb6c('0x1a')]=_0x640b1d;if(_0x4258da[_0xbb6c('0x28')][_0xbb6c('0x38')]){_0x1cb7c9[_0xbb6c('0x39')]=[{'all':!![]}];}return db[_0xbb6c('0x26')]['findAll'](_0x1cb7c9);})[_0xbb6c('0x21')](function(_0x45d999){_0x2769fa['rows']=_0x45d999;return _0x2769fa;})[_0xbb6c('0x21')](respondWithFilteredResult(_0x589e58,_0x1cb7c9))[_0xbb6c('0x3a')](handleError(_0x589e58,null));};exports[_0xbb6c('0x3b')]=function(_0x51731e,_0x10c120){var _0x107e89={'raw':![],'where':{'id':_0x51731e[_0xbb6c('0x3c')]['id']}},_0x436b2f={};_0x436b2f[_0xbb6c('0x2c')]=_['keys'](db['UserProfileSection'][_0xbb6c('0x3d')]);_0x436b2f[_0xbb6c('0x28')]=_[_0xbb6c('0x29')](_0x51731e[_0xbb6c('0x28')]);_0x436b2f[_0xbb6c('0x2a')]=_[_0xbb6c('0x2b')](_0x436b2f[_0xbb6c('0x2c')],_0x436b2f[_0xbb6c('0x28')]);_0x107e89[_0xbb6c('0x2d')]=_[_0xbb6c('0x2b')](_0x436b2f[_0xbb6c('0x2c')],qs['fields'](_0x51731e[_0xbb6c('0x28')][_0xbb6c('0x2e')]));_0x107e89['attributes']=_0x107e89[_0xbb6c('0x2d')][_0xbb6c('0x2f')]?_0x107e89[_0xbb6c('0x2d')]:_0x436b2f[_0xbb6c('0x2c')];if(_0x51731e[_0xbb6c('0x28')][_0xbb6c('0x38')]){_0x107e89[_0xbb6c('0x39')]=[{'all':!![]}];}_0x107e89=_[_0xbb6c('0x37')]({},_0x107e89,_0x51731e[_0xbb6c('0x3e')]);return db['UserProfileSection'][_0xbb6c('0x3f')](_0x107e89)[_0xbb6c('0x21')](handleEntityNotFound(_0x10c120,null))[_0xbb6c('0x21')](respondWithResult(_0x10c120,null))['catch'](handleError(_0x10c120,null));};exports[_0xbb6c('0x40')]=function(_0x56146a,_0x43d776){return db['UserProfileSection'][_0xbb6c('0x40')](_0x56146a[_0xbb6c('0x41')],{})[_0xbb6c('0x21')](respondWithResult(_0x43d776,0xc9))[_0xbb6c('0x3a')](handleError(_0x43d776,null));};exports[_0xbb6c('0x20')]=function(_0x2f4f04,_0x7dfb5){if(_0x2f4f04[_0xbb6c('0x41')]['id']){delete _0x2f4f04[_0xbb6c('0x41')]['id'];}return db[_0xbb6c('0x26')][_0xbb6c('0x3f')]({'where':{'id':_0x2f4f04[_0xbb6c('0x3c')]['id']}})[_0xbb6c('0x21')](handleEntityNotFound(_0x7dfb5,null))[_0xbb6c('0x21')](saveUpdates(_0x2f4f04[_0xbb6c('0x41')],null))['then'](respondWithResult(_0x7dfb5,null))[_0xbb6c('0x3a')](handleError(_0x7dfb5,null));};exports['destroy']=function(_0x491990,_0x3cd456){return db[_0xbb6c('0x26')][_0xbb6c('0x3f')]({'where':{'id':_0x491990['params']['id']}})[_0xbb6c('0x21')](handleEntityNotFound(_0x3cd456,null))[_0xbb6c('0x21')](removeEntity(_0x3cd456,null))['catch'](handleError(_0x3cd456,null));};exports[_0xbb6c('0x42')]=function(_0x501bd1,_0x55c7bd){return db[_0xbb6c('0x26')][_0xbb6c('0x42')]()[_0xbb6c('0x21')](respondWithResult(_0x55c7bd,null))[_0xbb6c('0x3a')](handleError(_0x55c7bd,null));}; \ No newline at end of file +var _0xa842=['../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','UserProfileSection','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5d491a,_0x2ef6d9){var _0x4d69b0=function(_0x5b7e79){while(--_0x5b7e79){_0x5d491a['push'](_0x5d491a['shift']());}};_0x4d69b0(++_0x2ef6d9);}(_0xa842,0x165));var _0x2a84=function(_0x122a0f,_0x259414){_0x122a0f=_0x122a0f-0x0;var _0x2f5526=_0xa842[_0x122a0f];return _0x2f5526;};'use strict';var emlformat=require(_0x2a84('0x0'));var rimraf=require(_0x2a84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a84('0x2'));var rp=require(_0x2a84('0x3'));var moment=require(_0x2a84('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a84('0x5'));var path=require(_0x2a84('0x6'));var sox=require(_0x2a84('0x7'));var csv=require(_0x2a84('0x8'));var ejs=require(_0x2a84('0x9'));var fs=require('fs');var fs_extra=require(_0x2a84('0xa'));var _=require(_0x2a84('0xb'));var squel=require('squel');var crypto=require(_0x2a84('0xc'));var jsforce=require(_0x2a84('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2a84('0x8'));var querystring=require(_0x2a84('0xe'));var Papa=require(_0x2a84('0xf'));var Redis=require(_0x2a84('0x10'));var authService=require(_0x2a84('0x11'));var qs=require(_0x2a84('0x12'));var as=require(_0x2a84('0x13'));var hardwareService=require(_0x2a84('0x14'));var logger=require(_0x2a84('0x15'))(_0x2a84('0x16'));var utils=require(_0x2a84('0x17'));var config=require(_0x2a84('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a84('0x19'))['db'];function respondWithStatusCode(_0x264fef,_0x15af91){_0x15af91=_0x15af91||0xcc;return function(_0xf406e0){if(_0xf406e0){return _0x264fef['sendStatus'](_0x15af91);}return _0x264fef[_0x2a84('0x1a')](_0x15af91)[_0x2a84('0x1b')]();};}function respondWithResult(_0x26bd24,_0x492423){_0x492423=_0x492423||0xc8;return function(_0x509180){if(_0x509180){return _0x26bd24['status'](_0x492423)['json'](_0x509180);}};}function respondWithFilteredResult(_0x3b9d37,_0xab5fc4){return function(_0x230e77){if(_0x230e77){var _0x2915bb=typeof _0xab5fc4[_0x2a84('0x1c')]===_0x2a84('0x1d')&&typeof _0xab5fc4['limit']===_0x2a84('0x1d');var _0x560231=_0x230e77[_0x2a84('0x1e')];var _0x541939=_0x2915bb?0x0:_0xab5fc4['offset'];var _0x5e5712=_0x2915bb?_0x230e77[_0x2a84('0x1e')]:_0xab5fc4[_0x2a84('0x1c')]+_0xab5fc4[_0x2a84('0x1f')];var _0x1540d6;if(_0x5e5712>=_0x560231){_0x5e5712=_0x560231;_0x1540d6=0xc8;}else{_0x1540d6=0xce;}_0x3b9d37[_0x2a84('0x1a')](_0x1540d6);return _0x3b9d37[_0x2a84('0x20')](_0x2a84('0x21'),_0x541939+'-'+_0x5e5712+'/'+_0x560231)[_0x2a84('0x22')](_0x230e77);}return null;};}function patchUpdates(_0x2750e3){return function(_0x5b24ac){try{jsonpatch[_0x2a84('0x23')](_0x5b24ac,_0x2750e3,!![]);}catch(_0x53c65c){return BPromise[_0x2a84('0x24')](_0x53c65c);}return _0x5b24ac[_0x2a84('0x25')]();};}function saveUpdates(_0xfe1c25,_0x3d0258){return function(_0x40e559){if(_0x40e559){return _0x40e559[_0x2a84('0x26')](_0xfe1c25)[_0x2a84('0x27')](function(_0x38d14c){return _0x38d14c;});}return null;};}function removeEntity(_0x59e707,_0xd0cb7d){return function(_0x2c302b){if(_0x2c302b){return _0x2c302b[_0x2a84('0x28')]()[_0x2a84('0x27')](function(){_0x59e707[_0x2a84('0x1a')](0xcc)[_0x2a84('0x1b')]();});}};}function handleEntityNotFound(_0x5511aa,_0x2bfd96){return function(_0x72450c){if(!_0x72450c){_0x5511aa[_0x2a84('0x29')](0x194);}return _0x72450c;};}function handleError(_0x1f2085,_0x38a202){_0x38a202=_0x38a202||0x1f4;return function(_0xefd4bf){logger[_0x2a84('0x2a')](_0xefd4bf[_0x2a84('0x2b')]);if(_0xefd4bf['name']){delete _0xefd4bf[_0x2a84('0x2c')];}_0x1f2085[_0x2a84('0x1a')](_0x38a202)[_0x2a84('0x2d')](_0xefd4bf);};}exports['index']=function(_0x276d99,_0x399132){var _0x4d0078={},_0x3349ca={},_0x47b6ba={'count':0x0,'rows':[]};var _0x273d6a=_[_0x2a84('0x2e')](db[_0x2a84('0x2f')]['rawAttributes'],function(_0x33a1c2){return{'name':_0x33a1c2['fieldName'],'type':_0x33a1c2[_0x2a84('0x30')][_0x2a84('0x31')]};});_0x3349ca[_0x2a84('0x32')]=_['map'](_0x273d6a,_0x2a84('0x2c'));_0x3349ca[_0x2a84('0x33')]=_[_0x2a84('0x34')](_0x276d99[_0x2a84('0x33')]);_0x3349ca[_0x2a84('0x35')]=_[_0x2a84('0x36')](_0x3349ca[_0x2a84('0x32')],_0x3349ca[_0x2a84('0x33')]);_0x4d0078[_0x2a84('0x37')]=_[_0x2a84('0x36')](_0x3349ca[_0x2a84('0x32')],qs[_0x2a84('0x38')](_0x276d99[_0x2a84('0x33')][_0x2a84('0x38')]));_0x4d0078['attributes']=_0x4d0078[_0x2a84('0x37')][_0x2a84('0x39')]?_0x4d0078[_0x2a84('0x37')]:_0x3349ca['model'];if(!_0x276d99['query'][_0x2a84('0x3a')](_0x2a84('0x3b'))){_0x4d0078[_0x2a84('0x1f')]=qs[_0x2a84('0x1f')](_0x276d99['query'][_0x2a84('0x1f')]);_0x4d0078[_0x2a84('0x1c')]=qs[_0x2a84('0x1c')](_0x276d99[_0x2a84('0x33')]['offset']);}_0x4d0078[_0x2a84('0x3c')]=qs[_0x2a84('0x3d')](_0x276d99['query']['sort']);_0x4d0078[_0x2a84('0x3e')]=qs[_0x2a84('0x35')](_[_0x2a84('0x3f')](_0x276d99[_0x2a84('0x33')],_0x3349ca[_0x2a84('0x35')]),_0x273d6a);if(_0x276d99[_0x2a84('0x33')]['filter']){_0x4d0078['where']=_[_0x2a84('0x40')](_0x4d0078[_0x2a84('0x3e')],{'$or':_[_0x2a84('0x2e')](_0x273d6a,function(_0x1bbbf4){if(_0x1bbbf4['type']!==_0x2a84('0x41')){var _0x9e25b6={};_0x9e25b6[_0x1bbbf4[_0x2a84('0x2c')]]={'$like':'%'+_0x276d99[_0x2a84('0x33')]['filter']+'%'};return _0x9e25b6;}})});}_0x4d0078=_['merge']({},_0x4d0078,_0x276d99['options']);var _0x518e6d={'where':_0x4d0078[_0x2a84('0x3e')]};return db[_0x2a84('0x2f')][_0x2a84('0x1e')](_0x518e6d)[_0x2a84('0x27')](function(_0x1ea35e){_0x47b6ba[_0x2a84('0x1e')]=_0x1ea35e;if(_0x276d99[_0x2a84('0x33')][_0x2a84('0x42')]){_0x4d0078['include']=[{'all':!![]}];}return db[_0x2a84('0x2f')]['findAll'](_0x4d0078);})['then'](function(_0x31ef5b){_0x47b6ba[_0x2a84('0x43')]=_0x31ef5b;return _0x47b6ba;})[_0x2a84('0x27')](respondWithFilteredResult(_0x399132,_0x4d0078))[_0x2a84('0x44')](handleError(_0x399132,null));};exports[_0x2a84('0x45')]=function(_0x1d0a2c,_0x3d942b){var _0x85331={'raw':![],'where':{'id':_0x1d0a2c[_0x2a84('0x46')]['id']}},_0x4b9e48={};_0x4b9e48[_0x2a84('0x32')]=_[_0x2a84('0x34')](db[_0x2a84('0x2f')]['rawAttributes']);_0x4b9e48[_0x2a84('0x33')]=_[_0x2a84('0x34')](_0x1d0a2c[_0x2a84('0x33')]);_0x4b9e48[_0x2a84('0x35')]=_[_0x2a84('0x36')](_0x4b9e48['model'],_0x4b9e48[_0x2a84('0x33')]);_0x85331[_0x2a84('0x37')]=_[_0x2a84('0x36')](_0x4b9e48['model'],qs['fields'](_0x1d0a2c[_0x2a84('0x33')][_0x2a84('0x38')]));_0x85331[_0x2a84('0x37')]=_0x85331[_0x2a84('0x37')][_0x2a84('0x39')]?_0x85331['attributes']:_0x4b9e48[_0x2a84('0x32')];if(_0x1d0a2c[_0x2a84('0x33')][_0x2a84('0x42')]){_0x85331[_0x2a84('0x47')]=[{'all':!![]}];}_0x85331=_['merge']({},_0x85331,_0x1d0a2c['options']);return db[_0x2a84('0x2f')]['find'](_0x85331)[_0x2a84('0x27')](handleEntityNotFound(_0x3d942b,null))[_0x2a84('0x27')](respondWithResult(_0x3d942b,null))['catch'](handleError(_0x3d942b,null));};exports[_0x2a84('0x48')]=function(_0x4f8425,_0x23a0a7){return db[_0x2a84('0x2f')]['create'](_0x4f8425[_0x2a84('0x49')],{})[_0x2a84('0x27')](respondWithResult(_0x23a0a7,0xc9))[_0x2a84('0x44')](handleError(_0x23a0a7,null));};exports['update']=function(_0x23f10b,_0x35e9d0){if(_0x23f10b[_0x2a84('0x49')]['id']){delete _0x23f10b[_0x2a84('0x49')]['id'];}return db[_0x2a84('0x2f')][_0x2a84('0x4a')]({'where':{'id':_0x23f10b[_0x2a84('0x46')]['id']}})[_0x2a84('0x27')](handleEntityNotFound(_0x35e9d0,null))[_0x2a84('0x27')](saveUpdates(_0x23f10b[_0x2a84('0x49')],null))[_0x2a84('0x27')](respondWithResult(_0x35e9d0,null))[_0x2a84('0x44')](handleError(_0x35e9d0,null));};exports[_0x2a84('0x28')]=function(_0x1b8f41,_0x3aeea5){return db[_0x2a84('0x2f')][_0x2a84('0x4a')]({'where':{'id':_0x1b8f41['params']['id']}})[_0x2a84('0x27')](handleEntityNotFound(_0x3aeea5,null))[_0x2a84('0x27')](removeEntity(_0x3aeea5,null))[_0x2a84('0x44')](handleError(_0x3aeea5,null));};exports[_0x2a84('0x4b')]=function(_0x446887,_0x189a6d){return db[_0x2a84('0x2f')]['describe']()[_0x2a84('0x27')](respondWithResult(_0x189a6d,null))['catch'](handleError(_0x189a6d,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ab78a16..ab5f518 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 _0xd65e=['userProfileId','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userProfileSection.attributes','UserProfileSection','sectionId'];(function(_0x4d5448,_0x316bd2){var _0x4c8ed7=function(_0x384a95){while(--_0x384a95){_0x4d5448['push'](_0x4d5448['shift']());}};_0x4c8ed7(++_0x316bd2);}(_0xd65e,0x91));var _0xed65=function(_0x30b27b,_0x34036b){_0x30b27b=_0x30b27b-0x0;var _0x59fa11=_0xd65e[_0x30b27b];return _0x59fa11;};'use strict';var _=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var logger=require(_0xed65('0x2'))(_0xed65('0x3'));var moment=require(_0xed65('0x4'));var BPromise=require(_0xed65('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed65('0x6'));var config=require(_0xed65('0x7'));var attributes=require(_0xed65('0x8'));module['exports']=function(_0x109571,_0x3dd68f){return _0x109571['define'](_0xed65('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xed65('0xa'),_0xed65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x61cb=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','UserProfileSection','userProfileId','lodash'];(function(_0x487f68,_0x255998){var _0x58825a=function(_0x51f559){while(--_0x51f559){_0x487f68['push'](_0x487f68['shift']());}};_0x58825a(++_0x255998);}(_0x61cb,0xbf));var _0xb61c=function(_0x4bfade,_0xb26c0e){_0x4bfade=_0x4bfade-0x0;var _0x272465=_0x61cb[_0x4bfade];return _0x272465;};'use strict';var _=require(_0xb61c('0x0'));var util=require(_0xb61c('0x1'));var logger=require(_0xb61c('0x2'))('api');var moment=require(_0xb61c('0x3'));var BPromise=require(_0xb61c('0x4'));var rp=require(_0xb61c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb61c('0x6'));var config=require(_0xb61c('0x7'));var attributes=require(_0xb61c('0x8'));module[_0xb61c('0x9')]=function(_0x45121e,_0x2e31a0){return _0x45121e['define'](_0xb61c('0xa'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xb61c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b1b85fe..95f0f1a 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 _0xc79b=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s'];(function(_0x10dc64,_0x11bb29){var _0x9cf98d=function(_0x558d71){while(--_0x558d71){_0x10dc64['push'](_0x10dc64['shift']());}};_0x9cf98d(++_0x11bb29);}(_0xc79b,0x1d1));var _0xbc79=function(_0x43ff08,_0x28e72b){_0x43ff08=_0x43ff08-0x0;var _0x444971=_0xc79b[_0x43ff08];return _0x444971;};'use strict';var _=require(_0xbc79('0x0'));var util=require('util');var moment=require(_0xbc79('0x1'));var BPromise=require(_0xbc79('0x2'));var rs=require(_0xbc79('0x3'));var fs=require('fs');var Redis=require(_0xbc79('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc79('0x5'));var logger=require(_0xbc79('0x6'))(_0xbc79('0x7'));var config=require('../../config/environment');var jayson=require(_0xbc79('0x8'));var client=jayson['client'][_0xbc79('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcda29b,_0x127f1d,_0x4af038){return new BPromise(function(_0x3abe25,_0x19489b){return client[_0xbc79('0xa')](_0xcda29b,_0x4af038)['then'](function(_0x53b09b){logger[_0xbc79('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x127f1d,_0xbc79('0xc'));logger[_0xbc79('0xd')](_0xbc79('0xe'),_0x127f1d,'request\x20sent',JSON[_0xbc79('0xf')](_0x53b09b));if(_0x53b09b[_0xbc79('0x10')]){if(_0x53b09b[_0xbc79('0x10')][_0xbc79('0x11')]===0x1f4){logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x53b09b[_0xbc79('0x10')][_0xbc79('0x13')]);return _0x19489b(_0x53b09b[_0xbc79('0x10')][_0xbc79('0x13')]);}logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x53b09b['error'][_0xbc79('0x13')]);return _0x3abe25(_0x53b09b['error'][_0xbc79('0x13')]);}else{logger['info'](_0xbc79('0x12'),_0x127f1d,_0xbc79('0xc'));_0x3abe25(_0x53b09b[_0xbc79('0x14')][_0xbc79('0x13')]);}})[_0xbc79('0x15')](function(_0x529ad0){logger[_0xbc79('0x10')](_0xbc79('0x12'),_0x127f1d,_0x529ad0);_0x19489b(_0x529ad0);});});} \ No newline at end of file +var _0xa2a5=['../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0xa2a5,0x19e));var _0x5a2a=function(_0x1af734,_0x20e275){_0x1af734=_0x1af734-0x0;var _0x42b072=_0xa2a5[_0x1af734];return _0x42b072;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5a2a('0x0'));var fs=require('fs');var Redis=require(_0x5a2a('0x1'));var db=require(_0x5a2a('0x2'))['db'];var utils=require(_0x5a2a('0x3'));var logger=require(_0x5a2a('0x4'))(_0x5a2a('0x5'));var config=require(_0x5a2a('0x6'));var jayson=require(_0x5a2a('0x7'));var client=jayson[_0x5a2a('0x8')][_0x5a2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2cd96a,_0x2d0f69,_0x534679){return new BPromise(function(_0x3ed816,_0x445181){return client[_0x5a2a('0xa')](_0x2cd96a,_0x534679)['then'](function(_0xc19e66){logger[_0x5a2a('0xb')](_0x5a2a('0xc'),_0x2d0f69,_0x5a2a('0xd'));logger[_0x5a2a('0xe')](_0x5a2a('0xf'),_0x2d0f69,_0x5a2a('0xd'),JSON[_0x5a2a('0x10')](_0xc19e66));if(_0xc19e66['error']){if(_0xc19e66[_0x5a2a('0x11')][_0x5a2a('0x12')]===0x1f4){logger[_0x5a2a('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x2d0f69,_0xc19e66[_0x5a2a('0x11')][_0x5a2a('0x13')]);return _0x445181(_0xc19e66['error'][_0x5a2a('0x13')]);}logger['error'](_0x5a2a('0xc'),_0x2d0f69,_0xc19e66['error']['message']);return _0x3ed816(_0xc19e66['error'][_0x5a2a('0x13')]);}else{logger['info'](_0x5a2a('0xc'),_0x2d0f69,_0x5a2a('0xd'));_0x3ed816(_0xc19e66['result'][_0x5a2a('0x13')]);}})[_0x5a2a('0x14')](function(_0x48960f){logger['error'](_0x5a2a('0xc'),_0x2d0f69,_0x48960f);_0x445181(_0x48960f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 530dbbb..a04ca30 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x31feaa,_0x2e975c){var _0x53bdce=function(_0x2d9d60){while(--_0x2d9d60){_0x31feaa['push'](_0x31feaa['shift']());}};_0x53bdce(++_0x2e975c);}(_0xedd9,0xfc));var _0x9edd=function(_0x122cdb,_0x296c7c){_0x122cdb=_0x122cdb-0x0;var _0x29c292=_0xedd9[_0x122cdb];return _0x29c292;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2799ba,_0x58813f){var _0x24fba1=function(_0x3b5482){while(--_0x3b5482){_0x2799ba['push'](_0x2799ba['shift']());}};_0x24fba1(++_0x58813f);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 929be65..59087d6 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 _0xb2e9=['exports','INTEGER'];(function(_0x21ba22,_0x38908f){var _0x997b34=function(_0x5630f5){while(--_0x5630f5){_0x21ba22['push'](_0x21ba22['shift']());}};_0x997b34(++_0x38908f);}(_0xb2e9,0x1a2));var _0x9b2e=function(_0xaa817a,_0x2263f4){_0xaa817a=_0xaa817a-0x0;var _0xd40af8=_0xb2e9[_0xaa817a];return _0xd40af8;};'use strict';var Sequelize=require('sequelize');module[_0x9b2e('0x0')]={'penalty':{'type':Sequelize[_0x9b2e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe443=['INTEGER','sequelize','exports'];(function(_0xe80ada,_0x23a9ac){var _0x2f58e0=function(_0x3c8abb){while(--_0x3c8abb){_0xe80ada['push'](_0xe80ada['shift']());}};_0x2f58e0(++_0x23a9ac);}(_0xe443,0x14e));var _0x3e44=function(_0x41f0cb,_0x3fa4f3){_0x41f0cb=_0x41f0cb-0x0;var _0x2d561d=_0xe443[_0x41f0cb];return _0x2d561d;};'use strict';var Sequelize=require(_0x3e44('0x0'));module[_0x3e44('0x1')]={'penalty':{'type':Sequelize[_0x3e44('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 00c377d..878dfe8 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 _0x4317=['./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3e3dc7,_0x4fd37b){var _0x27b565=function(_0xa886f5){while(--_0xa886f5){_0x3e3dc7['push'](_0x3e3dc7['shift']());}};_0x27b565(++_0x4fd37b);}(_0x4317,0x7c));var _0x7431=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4317[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x7431('0x0'));var logger=require(_0x7431('0x1'))(_0x7431('0x2'));var moment=require('moment');var BPromise=require(_0x7431('0x3'));var rp=require(_0x7431('0x4'));var fs=require('fs');var path=require(_0x7431('0x5'));var rimraf=require(_0x7431('0x6'));var config=require(_0x7431('0x7'));var attributes=require(_0x7431('0x8'));module['exports']=function(_0x57adc1,_0x1e1f35){return _0x57adc1[_0x7431('0x9')](_0x7431('0xa'),attributes,{'tableName':_0x7431('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf0=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue'];(function(_0x4e36f4,_0x261ad8){var _0xeecf66=function(_0x176705){while(--_0x176705){_0x4e36f4['push'](_0x4e36f4['shift']());}};_0xeecf66(++_0x261ad8);}(_0xfcf0,0x138));var _0x0fcf=function(_0x4667b2,_0x135b67){_0x4667b2=_0x4667b2-0x0;var _0x1070f2=_0xfcf0[_0x4667b2];return _0x1070f2;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fcf('0x6'));var config=require(_0x0fcf('0x7'));var attributes=require(_0x0fcf('0x8'));module[_0x0fcf('0x9')]=function(_0x1bace8,_0x1a7b03){return _0x1bace8[_0x0fcf('0xa')](_0x0fcf('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index dac4f83..cd0e844 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 _0x23bf=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x105d93,_0x1e3730){var _0x2743c3=function(_0x3bc972){while(--_0x3bc972){_0x105d93['push'](_0x105d93['shift']());}};_0x2743c3(++_0x1e3730);}(_0x23bf,0x18d));var _0xf23b=function(_0x3677ae,_0x2984a2){_0x3677ae=_0x3677ae-0x0;var _0x3d25bb=_0x23bf[_0x3677ae];return _0x3d25bb;};'use strict';var _=require('lodash');var util=require(_0xf23b('0x0'));var moment=require(_0xf23b('0x1'));var BPromise=require(_0xf23b('0x2'));var rs=require(_0xf23b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf23b('0x4'))['db'];var utils=require(_0xf23b('0x5'));var logger=require(_0xf23b('0x6'))(_0xf23b('0x7'));var config=require('../../config/environment');var jayson=require(_0xf23b('0x8'));var client=jayson[_0xf23b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x445c9b,_0x2c4231,_0x15e398){return new BPromise(function(_0x110773,_0x5a3ab5){return client[_0xf23b('0xa')](_0x445c9b,_0x15e398)[_0xf23b('0xb')](function(_0x18d6d1){logger[_0xf23b('0xc')](_0xf23b('0xd'),_0x2c4231,_0xf23b('0xe'));logger['debug'](_0xf23b('0xf'),_0x2c4231,'request\x20sent',JSON[_0xf23b('0x10')](_0x18d6d1));if(_0x18d6d1['error']){if(_0x18d6d1[_0xf23b('0x11')]['code']===0x1f4){logger['error'](_0xf23b('0xd'),_0x2c4231,_0x18d6d1[_0xf23b('0x11')][_0xf23b('0x12')]);return _0x5a3ab5(_0x18d6d1[_0xf23b('0x11')]['message']);}logger['error'](_0xf23b('0xd'),_0x2c4231,_0x18d6d1['error'][_0xf23b('0x12')]);return _0x110773(_0x18d6d1['error'][_0xf23b('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x2c4231,_0xf23b('0xe'));_0x110773(_0x18d6d1[_0xf23b('0x13')][_0xf23b('0x12')]);}})[_0xf23b('0x14')](function(_0x2c2f2c){logger[_0xf23b('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x2c4231,_0x2c2f2c);_0x5a3ab5(_0x2c2f2c);});});} \ No newline at end of file +var _0x8c08=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring'];(function(_0x2c275c,_0x3e1035){var _0x5e1699=function(_0x2c693c){while(--_0x2c693c){_0x2c275c['push'](_0x2c275c['shift']());}};_0x5e1699(++_0x3e1035);}(_0x8c08,0x195));var _0x88c0=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x8c08[_0x29c3b2];return _0x4b3aa7;};'use strict';var _=require('lodash');var util=require(_0x88c0('0x0'));var moment=require(_0x88c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x88c0('0x2'));var fs=require('fs');var Redis=require(_0x88c0('0x3'));var db=require(_0x88c0('0x4'))['db'];var utils=require(_0x88c0('0x5'));var logger=require('../../config/logger')(_0x88c0('0x6'));var config=require(_0x88c0('0x7'));var jayson=require(_0x88c0('0x8'));var client=jayson[_0x88c0('0x9')][_0x88c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xae4694,_0x430519,_0x3883c3){return new BPromise(function(_0x523a4c,_0x303b1d){return client[_0x88c0('0xb')](_0xae4694,_0x3883c3)[_0x88c0('0xc')](function(_0x260547){logger[_0x88c0('0xd')](_0x88c0('0xe'),_0x430519,'request\x20sent');logger[_0x88c0('0xf')](_0x88c0('0x10'),_0x430519,_0x88c0('0x11'),JSON[_0x88c0('0x12')](_0x260547));if(_0x260547['error']){if(_0x260547[_0x88c0('0x13')][_0x88c0('0x14')]===0x1f4){logger[_0x88c0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x430519,_0x260547[_0x88c0('0x13')][_0x88c0('0x15')]);return _0x303b1d(_0x260547[_0x88c0('0x13')][_0x88c0('0x15')]);}logger[_0x88c0('0x13')](_0x88c0('0xe'),_0x430519,_0x260547[_0x88c0('0x13')]['message']);return _0x523a4c(_0x260547[_0x88c0('0x13')][_0x88c0('0x15')]);}else{logger[_0x88c0('0xd')](_0x88c0('0xe'),_0x430519,_0x88c0('0x11'));_0x523a4c(_0x260547[_0x88c0('0x16')][_0x88c0('0x15')]);}})[_0x88c0('0x17')](function(_0x1c10ca){logger[_0x88c0('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x430519,_0x1c10ca);_0x303b1d(_0x1c10ca);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 33b3d8f..69eaee0 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 _0x83fd=['sequelize','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x83fd,0xae));var _0xd83f=function(_0xfea915,_0x59e24b){_0xfea915=_0xfea915-0x0;var _0x254ddf=_0x83fd[_0xfea915];return _0x254ddf;};'use strict';var Sequelize=require(_0xd83f('0x0'));module['exports']={'UserId':{'type':Sequelize[_0xd83f('0x1')]},'VoicePrefixId':{'type':Sequelize[_0xd83f('0x1')]}}; \ No newline at end of file +var _0x53f7=['exports','INTEGER','sequelize'];(function(_0xa858de,_0xc547b7){var _0x10ea85=function(_0xc5025a){while(--_0xc5025a){_0xa858de['push'](_0xa858de['shift']());}};_0x10ea85(++_0xc547b7);}(_0x53f7,0x158));var _0x753f=function(_0x162246,_0x4e5038){_0x162246=_0x162246-0x0;var _0x32ac95=_0x53f7[_0x162246];return _0x32ac95;};'use strict';var Sequelize=require(_0x753f('0x0'));module[_0x753f('0x1')]={'UserId':{'type':Sequelize[_0x753f('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 6b04ab4..879bc86 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(_0x20de17,_0x39b0c0){var _0x489f34=function(_0x361eb1){while(--_0x361eb1){_0x20de17['push'](_0x20de17['shift']());}};_0x489f34(++_0x39b0c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x4caf17,_0x395d3d){var _0x1a2b46=function(_0x37ad7a){while(--_0x37ad7a){_0x4caf17['push'](_0x4caf17['shift']());}};_0x1a2b46(++_0x395d3d);}(_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 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 77c6a1a..253d058 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x519c98,_0x22e47c){var _0x3b9a8e=function(_0x45bc5c){while(--_0x45bc5c){_0x519c98['push'](_0x519c98['shift']());}};_0x3b9a8e(++_0x22e47c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0xcb91[_0x2ef8f1];return _0x17498d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x51dafb,_0x1bfacc){var _0x3e5c04=function(_0x4d01c9){while(--_0x4d01c9){_0x51dafb['push'](_0x51dafb['shift']());}};_0x3e5c04(++_0x1bfacc);}(_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 19bca13..489001c 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 _0x1d53=['INTEGER','sequelize'];(function(_0x5a70d3,_0x21f1a5){var _0xdd91cd=function(_0x4d8dd9){while(--_0x4d8dd9){_0x5a70d3['push'](_0x5a70d3['shift']());}};_0xdd91cd(++_0x21f1a5);}(_0x1d53,0x123));var _0x31d5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1d53[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x31d5('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x31d5('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x46d7=['INTEGER','sequelize','exports'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x46d7,0x1b1));var _0x746d=function(_0x5005f5,_0x3225dc){_0x5005f5=_0x5005f5-0x0;var _0x4c8a6a=_0x46d7[_0x5005f5];return _0x4c8a6a;};'use strict';var Sequelize=require(_0x746d('0x0'));module[_0x746d('0x1')]={'penalty':{'type':Sequelize[_0x746d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index acd5522..e2cc197 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 _0x0c1a=['api','moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0c1a,0x15b));var _0xa0c1=function(_0x320d86,_0x23afb1){_0x320d86=_0x320d86-0x0;var _0x1b9f83=_0x0c1a[_0x320d86];return _0x1b9f83;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa0c1('0x0'))(_0xa0c1('0x1'));var moment=require(_0xa0c1('0x2'));var BPromise=require('bluebird');var rp=require(_0xa0c1('0x3'));var fs=require('fs');var path=require(_0xa0c1('0x4'));var rimraf=require(_0xa0c1('0x5'));var config=require(_0xa0c1('0x6'));var attributes=require(_0xa0c1('0x7'));module[_0xa0c1('0x8')]=function(_0x2cb2db,_0x2bd519){return _0x2cb2db[_0xa0c1('0x9')](_0xa0c1('0xa'),attributes,{'tableName':_0xa0c1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ca1=['../../config/logger','api','moment','bluebird','path','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','util'];(function(_0x57fa12,_0x4b82fe){var _0x5dae05=function(_0xb88f94){while(--_0xb88f94){_0x57fa12['push'](_0x57fa12['shift']());}};_0x5dae05(++_0x4b82fe);}(_0x0ca1,0xc4));var _0x10ca=function(_0x20b1b3,_0x3564ae){_0x20b1b3=_0x20b1b3-0x0;var _0x31bbb2=_0x0ca1[_0x20b1b3];return _0x31bbb2;};'use strict';var _=require(_0x10ca('0x0'));var util=require(_0x10ca('0x1'));var logger=require(_0x10ca('0x2'))(_0x10ca('0x3'));var moment=require(_0x10ca('0x4'));var BPromise=require(_0x10ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10ca('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x10ca('0x7'));module[_0x10ca('0x8')]=function(_0x4d90ee,_0x4cd3dc){return _0x4d90ee[_0x10ca('0x9')](_0x10ca('0xa'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 0ca084d..8521ec0 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 _0x6855=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x1a8913,_0x506f3a){var _0x3d084e=function(_0x4a1c3){while(--_0x4a1c3){_0x1a8913['push'](_0x1a8913['shift']());}};_0x3d084e(++_0x506f3a);}(_0x6855,0x100));var _0x5685=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x6855[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0x5685('0x0'));var util=require('util');var moment=require(_0x5685('0x1'));var BPromise=require('bluebird');var rs=require(_0x5685('0x2'));var fs=require('fs');var Redis=require(_0x5685('0x3'));var db=require(_0x5685('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5685('0x5'))(_0x5685('0x6'));var config=require('../../config/environment');var jayson=require(_0x5685('0x7'));var client=jayson[_0x5685('0x8')][_0x5685('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbd7c1e,_0x417b58,_0x466be5){return new BPromise(function(_0x459114,_0x505e76){return client['request'](_0xbd7c1e,_0x466be5)[_0x5685('0xa')](function(_0x4951aa){logger[_0x5685('0xb')](_0x5685('0xc'),_0x417b58,'request\x20sent');logger[_0x5685('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x417b58,_0x5685('0xe'),JSON[_0x5685('0xf')](_0x4951aa));if(_0x4951aa['error']){if(_0x4951aa[_0x5685('0x10')][_0x5685('0x11')]===0x1f4){logger[_0x5685('0x10')](_0x5685('0xc'),_0x417b58,_0x4951aa['error']['message']);return _0x505e76(_0x4951aa[_0x5685('0x10')][_0x5685('0x12')]);}logger[_0x5685('0x10')](_0x5685('0xc'),_0x417b58,_0x4951aa[_0x5685('0x10')][_0x5685('0x12')]);return _0x459114(_0x4951aa['error']['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x417b58,'request\x20sent');_0x459114(_0x4951aa[_0x5685('0x13')][_0x5685('0x12')]);}})[_0x5685('0x14')](function(_0x4088f3){logger['error'](_0x5685('0xc'),_0x417b58,_0x4088f3);_0x505e76(_0x4088f3);});});} \ No newline at end of file +var _0x02db=['error','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x16af88,_0x1c6a15){var _0x376ddd=function(_0x13300f){while(--_0x13300f){_0x16af88['push'](_0x16af88['shift']());}};_0x376ddd(++_0x1c6a15);}(_0x02db,0x130));var _0xb02d=function(_0xcb307e,_0x4396da){_0xcb307e=_0xcb307e-0x0;var _0x14cfda=_0x02db[_0xcb307e];return _0x14cfda;};'use strict';var _=require('lodash');var util=require(_0xb02d('0x0'));var moment=require(_0xb02d('0x1'));var BPromise=require(_0xb02d('0x2'));var rs=require(_0xb02d('0x3'));var fs=require('fs');var Redis=require(_0xb02d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb02d('0x5'));var logger=require(_0xb02d('0x6'))(_0xb02d('0x7'));var config=require('../../config/environment');var jayson=require(_0xb02d('0x8'));var client=jayson['client'][_0xb02d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fd1b,_0x2535ca,_0x268205){return new BPromise(function(_0xe936d8,_0x19d4b5){return client[_0xb02d('0xa')](_0x20fd1b,_0x268205)['then'](function(_0x3e4e07){logger['info'](_0xb02d('0xb'),_0x2535ca,'request\x20sent');logger[_0xb02d('0xc')](_0xb02d('0xd'),_0x2535ca,_0xb02d('0xe'),JSON[_0xb02d('0xf')](_0x3e4e07));if(_0x3e4e07[_0xb02d('0x10')]){if(_0x3e4e07[_0xb02d('0x10')]['code']===0x1f4){logger[_0xb02d('0x10')](_0xb02d('0xb'),_0x2535ca,_0x3e4e07[_0xb02d('0x10')][_0xb02d('0x11')]);return _0x19d4b5(_0x3e4e07[_0xb02d('0x10')][_0xb02d('0x11')]);}logger[_0xb02d('0x10')](_0xb02d('0xb'),_0x2535ca,_0x3e4e07[_0xb02d('0x10')][_0xb02d('0x11')]);return _0xe936d8(_0x3e4e07[_0xb02d('0x10')][_0xb02d('0x11')]);}else{logger[_0xb02d('0x12')](_0xb02d('0xb'),_0x2535ca,'request\x20sent');_0xe936d8(_0x3e4e07['result']['message']);}})[_0xb02d('0x13')](function(_0x2cd3e4){logger[_0xb02d('0x10')](_0xb02d('0xb'),_0x2535ca,_0x2cd3e4);_0x19d4b5(_0x2cd3e4);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9c8e9f9..adb8580 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5000e5,_0x1a2ed9){var _0x496c30=function(_0x789477){while(--_0x789477){_0x5000e5['push'](_0x5000e5['shift']());}};_0x496c30(++_0x1a2ed9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x5717dd,_0x16c953){var _0x1d36ab=function(_0x3098ce){while(--_0x3098ce){_0x5717dd['push'](_0x5717dd['shift']());}};_0x1d36ab(++_0x16c953);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xcb91[_0x207811];return _0x170d56;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 160559b..a7651c4 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 _0xcf58=['queue_interface','sequelize','exports','Required\x20by\x20Asterisk','STRING','INTEGER'];(function(_0x37c769,_0x2fb02f){var _0x2f5a22=function(_0x21d190){while(--_0x21d190){_0x37c769['push'](_0x37c769['shift']());}};_0x2f5a22(++_0x2fb02f);}(_0xcf58,0x193));var _0x8cf5=function(_0x44bf88,_0x478b6e){_0x44bf88=_0x44bf88-0x0;var _0xe552a8=_0xcf58[_0x44bf88];return _0xe552a8;};'use strict';var Sequelize=require(_0x8cf5('0x0'));module[_0x8cf5('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8cf5('0x2')},'membername':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'comment':_0x8cf5('0x2')},'UserId':{'type':Sequelize[_0x8cf5('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'unique':_0x8cf5('0x5'),'comment':_0x8cf5('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8cf5('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x8cf5('0x3')],'allowNull':![],'unique':_0x8cf5('0x5'),'comment':_0x8cf5('0x2')},'penalty':{'type':Sequelize[_0x8cf5('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8cf5('0x4')](0xb),'defaultValue':0x0,'comment':_0x8cf5('0x2')}}; \ No newline at end of file +var _0x6aa4=['Required\x20by\x20Asterisk','INTEGER','STRING','queue_interface','exports'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6aa4,0x15d));var _0x46aa=function(_0x543474,_0x365d00){_0x543474=_0x543474-0x0;var _0x3c43d8=_0x6aa4[_0x543474];return _0x3c43d8;};'use strict';var Sequelize=require('sequelize');module[_0x46aa('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x46aa('0x1')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x46aa('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x46aa('0x3')],'allowNull':![],'unique':_0x46aa('0x4'),'comment':_0x46aa('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x46aa('0x3')],'allowNull':![],'unique':_0x46aa('0x4'),'comment':_0x46aa('0x1')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x46aa('0x1')},'paused':{'type':Sequelize[_0x46aa('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index aef1eee..145ace0 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 _0x1597=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','UserVoiceQueueRt'];(function(_0x471e8a,_0x35e1cc){var _0x37f362=function(_0x3c9207){while(--_0x3c9207){_0x471e8a['push'](_0x471e8a['shift']());}};_0x37f362(++_0x35e1cc);}(_0x1597,0x16e));var _0x7159=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x1597[_0x217c2e];return _0x22b7d8;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x7159('0x0'))['db'][_0x7159('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7159('0x2'),'afterUpdate':_0x7159('0x3'),'afterDestroy':_0x7159('0x4')};function emitEvent(_0x19a554){return function(_0x2bf7f0,_0x3777e9,_0xcd1d){UserVoiceQueueRtEvents[_0x7159('0x5')](_0x19a554+':'+_0x2bf7f0['id'],_0x2bf7f0);UserVoiceQueueRtEvents[_0x7159('0x5')](_0x19a554,_0x2bf7f0);_0xcd1d(null);};}for(var e in events){if(events[_0x7159('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x7159('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x614a=['hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','update','remove','emit'];(function(_0x14ee16,_0x18dfb4){var _0x2306c0=function(_0x48ed1b){while(--_0x48ed1b){_0x14ee16['push'](_0x14ee16['shift']());}};_0x2306c0(++_0x18dfb4);}(_0x614a,0x9c));var _0xa614=function(_0x1e3cc9,_0x212a55){_0x1e3cc9=_0x1e3cc9-0x0;var _0xf26d1f=_0x614a[_0x1e3cc9];return _0xf26d1f;};'use strict';var EventEmitter=require(_0xa614('0x0'));var UserVoiceQueueRt=require(_0xa614('0x1'))['db'][_0xa614('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa614('0x3'),'afterDestroy':_0xa614('0x4')};function emitEvent(_0x496f08){return function(_0x19b856,_0x1e52e7,_0x4f8eaa){UserVoiceQueueRtEvents[_0xa614('0x5')](_0x496f08+':'+_0x19b856['id'],_0x19b856);UserVoiceQueueRtEvents[_0xa614('0x5')](_0x496f08,_0x19b856);_0x4f8eaa(null);};}for(var e in events){if(events[_0xa614('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0xa614('0x7')](e,emitEvent(event));}}module[_0xa614('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 74d3a2f..e108adc 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 _0x600a=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x600a,0xce));var _0xa600=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x600a[_0x10dbf6];return _0x452147;};'use strict';var _=require('lodash');var util=require(_0xa600('0x0'));var logger=require('../../config/logger')(_0xa600('0x1'));var moment=require(_0xa600('0x2'));var BPromise=require(_0xa600('0x3'));var rp=require(_0xa600('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa600('0x5'));var config=require(_0xa600('0x6'));var attributes=require(_0xa600('0x7'));module[_0xa600('0x8')]=function(_0x420b64,_0x4f3abe){return _0x420b64[_0xa600('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa27c=['request-promise','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x53f69f,_0x24335a){var _0x423f27=function(_0x1d42f9){while(--_0x1d42f9){_0x53f69f['push'](_0x53f69f['shift']());}};_0x423f27(++_0x24335a);}(_0xa27c,0x186));var _0xca27=function(_0x122fa5,_0x2803ce){_0x122fa5=_0x122fa5-0x0;var _0x19c994=_0xa27c[_0x122fa5];return _0x19c994;};'use strict';var _=require(_0xca27('0x0'));var util=require(_0xca27('0x1'));var logger=require(_0xca27('0x2'))(_0xca27('0x3'));var moment=require(_0xca27('0x4'));var BPromise=require(_0xca27('0x5'));var rp=require(_0xca27('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xca27('0x7'));var attributes=require(_0xca27('0x8'));module['exports']=function(_0x1242b9,_0x2219c3){return _0x1242b9[_0xca27('0x9')](_0xca27('0xa'),attributes,{'tableName':_0xca27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 9432c41..9a36273 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 _0x8eec=['literal','`paused`\x20=\x201,\x201,\x20null','then','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','findAll','options','raw','where','COUNT','sequelize'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x8eec,0x124));var _0xc8ee=function(_0x3d7b5e,_0x5a5b35){_0x3d7b5e=_0x3d7b5e-0x0;var _0x456ad9=_0x8eec[_0x3d7b5e];return _0x456ad9;};'use strict';var _=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var moment=require(_0xc8ee('0x2'));var BPromise=require(_0xc8ee('0x3'));var rs=require(_0xc8ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8ee('0x5'))['db'];var utils=require(_0xc8ee('0x6'));var logger=require(_0xc8ee('0x7'))(_0xc8ee('0x8'));var config=require(_0xc8ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc8ee('0xa')][_0xc8ee('0xb')]({'port':0x232a});config[_0xc8ee('0xc')]=_['defaults'](config[_0xc8ee('0xc')],{'host':_0xc8ee('0xd'),'port':0x18eb});var socket=require(_0xc8ee('0xe'))(new Redis(config[_0xc8ee('0xc')]));require('./userVoiceQueueRt.socket')[_0xc8ee('0xf')](socket);function respondWithRpcPromise(_0x30d60d,_0x42cd5c,_0x387ef0){return new BPromise(function(_0x3fa068,_0x414878){return client['request'](_0x30d60d,_0x387ef0)['then'](function(_0x2a5500){logger[_0xc8ee('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0xc8ee('0x11'));logger[_0xc8ee('0x12')](_0xc8ee('0x13'),_0x42cd5c,_0xc8ee('0x11'),JSON[_0xc8ee('0x14')](_0x2a5500));if(_0x2a5500[_0xc8ee('0x15')]){if(_0x2a5500[_0xc8ee('0x15')][_0xc8ee('0x16')]===0x1f4){logger[_0xc8ee('0x15')](_0xc8ee('0x17'),_0x42cd5c,_0x2a5500['error'][_0xc8ee('0x18')]);return _0x414878(_0x2a5500['error'][_0xc8ee('0x18')]);}logger[_0xc8ee('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0x2a5500[_0xc8ee('0x15')][_0xc8ee('0x18')]);return _0x3fa068(_0x2a5500['error'][_0xc8ee('0x18')]);}else{logger[_0xc8ee('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0xc8ee('0x11'));_0x3fa068(_0x2a5500['result'][_0xc8ee('0x18')]);}})[_0xc8ee('0x19')](function(_0x2e7fc1){logger[_0xc8ee('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x42cd5c,_0x2e7fc1);_0x414878(_0x2e7fc1);});});}exports['GetVoiceQueueRtPauses']=function(_0x268506){var _0x298201=this;return new Promise(function(_0x511ac5,_0x48a3ca){return db['UserVoiceQueueRt'][_0xc8ee('0x1a')]({'raw':_0x268506[_0xc8ee('0x1b')]?_0x268506[_0xc8ee('0x1b')][_0xc8ee('0x1c')]===undefined?!![]:![]:!![],'where':_0x268506['options']?_0x268506[_0xc8ee('0x1b')][_0xc8ee('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc8ee('0x1e'),db[_0xc8ee('0x1f')]['fn']('IF',db[_0xc8ee('0x1f')][_0xc8ee('0x20')](_0xc8ee('0x21')))),'outboundQueuePauses']]})[_0xc8ee('0x22')](function(_0x224069){logger['info']('GetVoiceQueueRtPauses',_0x268506);logger['debug'](_0xc8ee('0x23'),_0x268506,JSON[_0xc8ee('0x14')](_0x224069));_0x511ac5(_0x224069);})['catch'](function(_0xbdb7ae){logger['error'](_0xc8ee('0x23'),_0xbdb7ae[_0xc8ee('0x18')],_0x268506);_0x48a3ca(_0x298201[_0xc8ee('0x15')](0x1f4,_0xbdb7ae['message']));});});}; \ No newline at end of file +var _0xb322=['stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','error','message','request\x20sent','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug'];(function(_0xe762b,_0x433f3b){var _0x22c83e=function(_0x5b0a53){while(--_0x5b0a53){_0xe762b['push'](_0xe762b['shift']());}};_0x22c83e(++_0x433f3b);}(_0xb322,0x155));var _0x2b32=function(_0x5e0acd,_0x47abd0){_0x5e0acd=_0x5e0acd-0x0;var _0x4518d2=_0xb322[_0x5e0acd];return _0x4518d2;};'use strict';var _=require(_0x2b32('0x0'));var util=require('util');var moment=require(_0x2b32('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b32('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b32('0x3'))['db'];var utils=require(_0x2b32('0x4'));var logger=require(_0x2b32('0x5'))(_0x2b32('0x6'));var config=require('../../config/environment');var jayson=require(_0x2b32('0x7'));var client=jayson[_0x2b32('0x8')]['http']({'port':0x232a});config['redis']=_[_0x2b32('0x9')](config[_0x2b32('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x2b32('0xb'))(new Redis(config[_0x2b32('0xa')]));require('./userVoiceQueueRt.socket')[_0x2b32('0xc')](socket);function respondWithRpcPromise(_0x1c7420,_0x112ef5,_0x41bea6){return new BPromise(function(_0x5c8f1b,_0x120336){return client[_0x2b32('0xd')](_0x1c7420,_0x41bea6)['then'](function(_0x36faa1){logger[_0x2b32('0xe')](_0x2b32('0xf'),_0x112ef5,'request\x20sent');logger['debug']('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x112ef5,'request\x20sent',JSON['stringify'](_0x36faa1));if(_0x36faa1['error']){if(_0x36faa1[_0x2b32('0x10')]['code']===0x1f4){logger[_0x2b32('0x10')](_0x2b32('0xf'),_0x112ef5,_0x36faa1['error'][_0x2b32('0x11')]);return _0x120336(_0x36faa1[_0x2b32('0x10')][_0x2b32('0x11')]);}logger[_0x2b32('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x112ef5,_0x36faa1[_0x2b32('0x10')][_0x2b32('0x11')]);return _0x5c8f1b(_0x36faa1[_0x2b32('0x10')][_0x2b32('0x11')]);}else{logger[_0x2b32('0xe')](_0x2b32('0xf'),_0x112ef5,_0x2b32('0x12'));_0x5c8f1b(_0x36faa1[_0x2b32('0x13')][_0x2b32('0x11')]);}})['catch'](function(_0xad3ead){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x112ef5,_0xad3ead);_0x120336(_0xad3ead);});});}exports[_0x2b32('0x14')]=function(_0x185dc5){var _0x373f83=this;return new Promise(function(_0x29f30c,_0x1a7ba1){return db[_0x2b32('0x15')][_0x2b32('0x16')]({'raw':_0x185dc5[_0x2b32('0x17')]?_0x185dc5['options'][_0x2b32('0x18')]===undefined?!![]:![]:!![],'where':_0x185dc5[_0x2b32('0x17')]?_0x185dc5[_0x2b32('0x17')][_0x2b32('0x19')]||null:null,'attributes':[[db[_0x2b32('0x1a')]['fn'](_0x2b32('0x1b'),db[_0x2b32('0x1a')]['fn']('IF',db[_0x2b32('0x1a')][_0x2b32('0x1c')](_0x2b32('0x1d')))),_0x2b32('0x1e')]]})[_0x2b32('0x1f')](function(_0xb7e593){logger[_0x2b32('0xe')]('GetVoiceQueueRtPauses',_0x185dc5);logger[_0x2b32('0x20')]('GetVoiceQueueRtPauses',_0x185dc5,JSON[_0x2b32('0x21')](_0xb7e593));_0x29f30c(_0xb7e593);})['catch'](function(_0x375ed7){logger[_0x2b32('0x10')](_0x2b32('0x14'),_0x375ed7[_0x2b32('0x11')],_0x185dc5);_0x1a7ba1(_0x373f83[_0x2b32('0x10')](0x1f4,_0x375ed7[_0x2b32('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 3dbc793..65a149a 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 _0xa93e=['update','emit','removeListener','register','length','remove'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa93e,0x1df));var _0xea93=function(_0x57239f,_0x567a7b){_0x57239f=_0x57239f-0x0;var _0x4b1456=_0xa93e[_0x57239f];return _0x4b1456;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0xea93('0x0'),_0xea93('0x1')];function createListener(_0x47d9db,_0xd64380){return function(_0x50af65){_0xd64380[_0xea93('0x2')](_0x47d9db,_0x50af65);};}function removeListener(_0x5b5341,_0x5398ba){return function(){UserVoiceQueueRtEvents[_0xea93('0x3')](_0x5b5341,_0x5398ba);};}exports[_0xea93('0x4')]=function(_0x6c6985){for(var _0x26def3=0x0,_0x477a7d=events[_0xea93('0x5')];_0x26def3<_0x477a7d;_0x26def3++){var _0x54ebdf=events[_0x26def3];var _0x12876e=createListener('userVoiceQueueRt:'+_0x54ebdf,_0x6c6985);UserVoiceQueueRtEvents['on'](_0x54ebdf,_0x12876e);}}; \ No newline at end of file +var _0xfd50=['register','save','remove','update','emit'];(function(_0xa9bcf1,_0x4d3f01){var _0x1e1c82=function(_0x368bd6){while(--_0x368bd6){_0xa9bcf1['push'](_0xa9bcf1['shift']());}};_0x1e1c82(++_0x4d3f01);}(_0xfd50,0x178));var _0x0fd5=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xfd50[_0x2341c6];return _0x54c34d;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x0fd5('0x0'),_0x0fd5('0x1'),_0x0fd5('0x2')];function createListener(_0x13a17f,_0x1c3165){return function(_0x573e75){_0x1c3165[_0x0fd5('0x3')](_0x13a17f,_0x573e75);};}function removeListener(_0x1029f4,_0x4dc01d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1029f4,_0x4dc01d);};}exports[_0x0fd5('0x4')]=function(_0x25c401){for(var _0x3f390f=0x0,_0x24319e=events['length'];_0x3f390f<_0x24319e;_0x3f390f++){var _0x1baf7=events[_0x3f390f];var _0x6a536=createListener('userVoiceQueueRt:'+_0x1baf7,_0x25c401);UserVoiceQueueRtEvents['on'](_0x1baf7,_0x6a536);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index cb4e731..189a186 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(_0x16a223,_0x31b6e8){var _0x5ded66=function(_0x25eb5f){while(--_0x25eb5f){_0x16a223['push'](_0x16a223['shift']());}};_0x5ded66(++_0x31b6e8);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x45ae99,_0x219805){var _0x396da1=function(_0x26edf9){while(--_0x26edf9){_0x45ae99['push'](_0x45ae99['shift']());}};_0x396da1(++_0x219805);}(_0x70e0,0x17b));var _0x070e=function(_0x3da200,_0xb3148a){_0x3da200=_0x3da200-0x0;var _0x290884=_0x70e0[_0x3da200];return _0x290884;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 54fb3b1..09463cc 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 _0x338e=['exports','INTEGER','sequelize'];(function(_0x4c3cce,_0x543dc3){var _0x117afe=function(_0x5f4179){while(--_0x5f4179){_0x4c3cce['push'](_0x4c3cce['shift']());}};_0x117afe(++_0x543dc3);}(_0x338e,0x137));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe338('0x0'));module[_0xe338('0x1')]={'penalty':{'type':Sequelize[_0xe338('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc0de=['INTEGER','sequelize','exports'];(function(_0x30fb8a,_0x3ff832){var _0x4c8393=function(_0x499ec3){while(--_0x499ec3){_0x30fb8a['push'](_0x30fb8a['shift']());}};_0x4c8393(++_0x3ff832);}(_0xc0de,0xac));var _0xec0d=function(_0x5c62e2,_0xe0276a){_0x5c62e2=_0x5c62e2-0x0;var _0x10d8ba=_0xc0de[_0x5c62e2];return _0x10d8ba;};'use strict';var Sequelize=require(_0xec0d('0x0'));module[_0xec0d('0x1')]={'penalty':{'type':Sequelize[_0xec0d('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 01486ee..5f15041 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 _0x96d1=['define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports'];(function(_0x1c1e61,_0xfa2e23){var _0x231251=function(_0x246c0a){while(--_0x246c0a){_0x1c1e61['push'](_0x1c1e61['shift']());}};_0x231251(++_0xfa2e23);}(_0x96d1,0xea));var _0x196d=function(_0x4704e5,_0x11046f){_0x4704e5=_0x4704e5-0x0;var _0x334dca=_0x96d1[_0x4704e5];return _0x334dca;};'use strict';var _=require(_0x196d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x196d('0x1'));var BPromise=require(_0x196d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x196d('0x3'));var rimraf=require(_0x196d('0x4'));var config=require(_0x196d('0x5'));var attributes=require(_0x196d('0x6'));module[_0x196d('0x7')]=function(_0x75f161,_0x50f3d9){return _0x75f161[_0x196d('0x8')](_0x196d('0x9'),attributes,{'tableName':_0x196d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd993=['path','rimraf','../../config/environment','define','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4240d4,_0x5e4f48){var _0x535b48=function(_0xde0666){while(--_0xde0666){_0x4240d4['push'](_0x4240d4['shift']());}};_0x535b48(++_0x5e4f48);}(_0xd993,0x7e));var _0x3d99=function(_0xbf9cf4,_0x17db62){_0xbf9cf4=_0xbf9cf4-0x0;var _0x47ba5d=_0xd993[_0xbf9cf4];return _0x47ba5d;};'use strict';var _=require(_0x3d99('0x0'));var util=require('util');var logger=require(_0x3d99('0x1'))(_0x3d99('0x2'));var moment=require(_0x3d99('0x3'));var BPromise=require(_0x3d99('0x4'));var rp=require(_0x3d99('0x5'));var fs=require('fs');var path=require(_0x3d99('0x6'));var rimraf=require(_0x3d99('0x7'));var config=require(_0x3d99('0x8'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x1058fc,_0x4ccd72){return _0x1058fc[_0x3d99('0x9')]('UserWhatsappQueue',attributes,{'tableName':_0x3d99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 67bf75f..760989d 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 _0xc38f=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0xbf6110,_0x552776){var _0x496027=function(_0x16af15){while(--_0x16af15){_0xbf6110['push'](_0xbf6110['shift']());}};_0x496027(++_0x552776);}(_0xc38f,0x1b0));var _0xfc38=function(_0x309a8e,_0x498f0b){_0x309a8e=_0x309a8e-0x0;var _0x3e9808=_0xc38f[_0x309a8e];return _0x3e9808;};'use strict';var _=require(_0xfc38('0x0'));var util=require(_0xfc38('0x1'));var moment=require(_0xfc38('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc38('0x3'));var fs=require('fs');var Redis=require(_0xfc38('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc38('0x5'));var logger=require('../../config/logger')(_0xfc38('0x6'));var config=require(_0xfc38('0x7'));var jayson=require(_0xfc38('0x8'));var client=jayson[_0xfc38('0x9')][_0xfc38('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439b6f,_0x869169,_0x12abb8){return new BPromise(function(_0x57d164,_0x20d66b){return client[_0xfc38('0xb')](_0x439b6f,_0x12abb8)[_0xfc38('0xc')](function(_0xb64f0d){logger['info'](_0xfc38('0xd'),_0x869169,_0xfc38('0xe'));logger[_0xfc38('0xf')](_0xfc38('0x10'),_0x869169,'request\x20sent',JSON[_0xfc38('0x11')](_0xb64f0d));if(_0xb64f0d[_0xfc38('0x12')]){if(_0xb64f0d['error'][_0xfc38('0x13')]===0x1f4){logger[_0xfc38('0x12')](_0xfc38('0xd'),_0x869169,_0xb64f0d[_0xfc38('0x12')]['message']);return _0x20d66b(_0xb64f0d[_0xfc38('0x12')][_0xfc38('0x14')]);}logger[_0xfc38('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x869169,_0xb64f0d['error'][_0xfc38('0x14')]);return _0x57d164(_0xb64f0d['error'][_0xfc38('0x14')]);}else{logger[_0xfc38('0x15')](_0xfc38('0xd'),_0x869169,_0xfc38('0xe'));_0x57d164(_0xb64f0d[_0xfc38('0x16')]['message']);}})[_0xfc38('0x17')](function(_0x355386){logger[_0xfc38('0x12')](_0xfc38('0xd'),_0x869169,_0x355386);_0x20d66b(_0x355386);});});} \ No newline at end of file +var _0xffa4=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info'];(function(_0x568161,_0x454e44){var _0xab4547=function(_0x2cadb1){while(--_0x2cadb1){_0x568161['push'](_0x568161['shift']());}};_0xab4547(++_0x454e44);}(_0xffa4,0x103));var _0x4ffa=function(_0x451959,_0x18c7a5){_0x451959=_0x451959-0x0;var _0x490269=_0xffa4[_0x451959];return _0x490269;};'use strict';var _=require(_0x4ffa('0x0'));var util=require(_0x4ffa('0x1'));var moment=require(_0x4ffa('0x2'));var BPromise=require(_0x4ffa('0x3'));var rs=require(_0x4ffa('0x4'));var fs=require('fs');var Redis=require(_0x4ffa('0x5'));var db=require(_0x4ffa('0x6'))['db'];var utils=require(_0x4ffa('0x7'));var logger=require(_0x4ffa('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4ffa('0x9'));var client=jayson[_0x4ffa('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a8b71,_0x52cfd0,_0x21d339){return new BPromise(function(_0x31c2f6,_0x99c8ec){return client[_0x4ffa('0xb')](_0x3a8b71,_0x21d339)[_0x4ffa('0xc')](function(_0x12b898){logger[_0x4ffa('0xd')](_0x4ffa('0xe'),_0x52cfd0,_0x4ffa('0xf'));logger[_0x4ffa('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x52cfd0,'request\x20sent',JSON[_0x4ffa('0x11')](_0x12b898));if(_0x12b898[_0x4ffa('0x12')]){if(_0x12b898[_0x4ffa('0x12')][_0x4ffa('0x13')]===0x1f4){logger[_0x4ffa('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52cfd0,_0x12b898['error']['message']);return _0x99c8ec(_0x12b898[_0x4ffa('0x12')][_0x4ffa('0x14')]);}logger['error'](_0x4ffa('0xe'),_0x52cfd0,_0x12b898[_0x4ffa('0x12')][_0x4ffa('0x14')]);return _0x31c2f6(_0x12b898[_0x4ffa('0x12')][_0x4ffa('0x14')]);}else{logger['info'](_0x4ffa('0xe'),_0x52cfd0,'request\x20sent');_0x31c2f6(_0x12b898['result'][_0x4ffa('0x14')]);}})['catch'](function(_0x278e90){logger[_0x4ffa('0x12')]('UserWhatsappQueue,\x20%s,\x20%s',_0x52cfd0,_0x278e90);_0x99c8ec(_0x278e90);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 8b7ff27..abf0c72 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 _0x777f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0x4d4f61,_0x56d7a7){var _0x297414=function(_0x30d055){while(--_0x30d055){_0x4d4f61['push'](_0x4d4f61['shift']());}};_0x297414(++_0x56d7a7);}(_0x777f,0x9f));var _0xf777=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x777f[_0x35ef6b];return _0x3ad145;};'use strict';var multer=require(_0xf777('0x0'));var util=require(_0xf777('0x1'));var path=require(_0xf777('0x2'));var timeout=require(_0xf777('0x3'));var express=require(_0xf777('0x4'));var router=express[_0xf777('0x5')]();var fs_extra=require(_0xf777('0x6'));var auth=require(_0xf777('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf777('0x8'));var controller=require(_0xf777('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf777('0xa')](_0xf777('0xb'),auth[_0xf777('0xc')](),controller[_0xf777('0xd')]);router[_0xf777('0xe')]('/',auth[_0xf777('0xc')](),controller[_0xf777('0xf')]);router[_0xf777('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf777('0x11')](_0xf777('0xb'),auth['isAuthenticated'](),controller[_0xf777('0x12')]);module[_0xf777('0x13')]=router; \ No newline at end of file +var _0xbf83=['connect-timeout','express','Router','fs-extra','../../config/environment','./variable.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x29cf01,_0x473688){var _0x356517=function(_0x3154d5){while(--_0x3154d5){_0x29cf01['push'](_0x29cf01['shift']());}};_0x356517(++_0x473688);}(_0xbf83,0x11e));var _0x3bf8=function(_0x3ab1cf,_0xfc8621){_0x3ab1cf=_0x3ab1cf-0x0;var _0x31185b=_0xbf83[_0x3ab1cf];return _0x31185b;};'use strict';var multer=require(_0x3bf8('0x0'));var util=require('util');var path=require(_0x3bf8('0x1'));var timeout=require(_0x3bf8('0x2'));var express=require(_0x3bf8('0x3'));var router=express[_0x3bf8('0x4')]();var fs_extra=require(_0x3bf8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3bf8('0x6'));var controller=require(_0x3bf8('0x7'));router[_0x3bf8('0x8')]('/',auth[_0x3bf8('0x9')](),controller['index']);router['get'](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller['show']);router[_0x3bf8('0xb')]('/',auth['isAuthenticated'](),controller[_0x3bf8('0xc')]);router[_0x3bf8('0xd')](_0x3bf8('0xa'),auth[_0x3bf8('0x9')](),controller[_0x3bf8('0xe')]);router[_0x3bf8('0xf')](_0x3bf8('0xa'),auth['isAuthenticated'](),controller[_0x3bf8('0x10')]);module[_0x3bf8('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 54da648..37b602c 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 _0x46de=['exports','STRING','name','sequelize'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x46de,0x1c3));var _0xe46d=function(_0x3cffb3,_0x284b2d){_0x3cffb3=_0x3cffb3-0x0;var _0x57a846=_0x46de[_0x3cffb3];return _0x57a846;};'use strict';var Sequelize=require(_0xe46d('0x0'));module[_0xe46d('0x1')]={'name':{'type':Sequelize[_0xe46d('0x2')],'unique':_0xe46d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc0b=['exports','STRING','name'];(function(_0x13239f,_0x2be38){var _0x37a51d=function(_0xda0804){while(--_0xda0804){_0x13239f['push'](_0x13239f['shift']());}};_0x37a51d(++_0x2be38);}(_0xfc0b,0x189));var _0xbfc0=function(_0x5e82b9,_0x2f781e){_0x5e82b9=_0x5e82b9-0x0;var _0x378ebf=_0xfc0b[_0x5e82b9];return _0x378ebf;};'use strict';var Sequelize=require('sequelize');module[_0xbfc0('0x0')]={'name':{'type':Sequelize[_0xbfc0('0x1')],'unique':_0xbfc0('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 79b601e..99ec376 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 _0xf31c=['zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','name','send','map','Variable','key','model','query','keys','intersection','attributes','fields','limit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','rawAttributes','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Variables','UserProfileSection','userProfileId','autoAssociation','rimraf'];(function(_0x1cefbe,_0x4fc06c){var _0x4cd985=function(_0x14dc2a){while(--_0x14dc2a){_0x1cefbe['push'](_0x1cefbe['shift']());}};_0x4cd985(++_0x4fc06c);}(_0xf31c,0x1e5));var _0xcf31=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xf31c[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf31('0x0'));var zipdir=require(_0xcf31('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcf31('0x2'));var BPromise=require(_0xcf31('0x3'));var Mustache=require(_0xcf31('0x4'));var util=require(_0xcf31('0x5'));var path=require(_0xcf31('0x6'));var sox=require(_0xcf31('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf31('0x8'));var _=require('lodash');var squel=require(_0xcf31('0x9'));var crypto=require('crypto');var jsforce=require(_0xcf31('0xa'));var deskjs=require(_0xcf31('0xb'));var toCsv=require(_0xcf31('0xc'));var querystring=require(_0xcf31('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf31('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcf31('0xf'));var as=require(_0xcf31('0x10'));var hardwareService=require(_0xcf31('0x11'));var logger=require(_0xcf31('0x12'))(_0xcf31('0x13'));var utils=require(_0xcf31('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcf31('0x15'));var db=require(_0xcf31('0x16'))['db'];function respondWithStatusCode(_0x103e76,_0x4b105d){_0x4b105d=_0x4b105d||0xcc;return function(_0x129306){if(_0x129306){return _0x103e76[_0xcf31('0x17')](_0x4b105d);}return _0x103e76[_0xcf31('0x18')](_0x4b105d)[_0xcf31('0x19')]();};}function respondWithResult(_0x432b7b,_0x192400){_0x192400=_0x192400||0xc8;return function(_0x4699be){if(_0x4699be){return _0x432b7b['status'](_0x192400)[_0xcf31('0x1a')](_0x4699be);}};}function respondWithFilteredResult(_0x41b8e8,_0x19c6b){return function(_0x2d0be3){if(_0x2d0be3){var _0x53cfda=typeof _0x19c6b[_0xcf31('0x1b')]===_0xcf31('0x1c')&&typeof _0x19c6b['limit']===_0xcf31('0x1c');var _0x1e3c24=_0x2d0be3[_0xcf31('0x1d')];var _0xa625a2=_0x53cfda?0x0:_0x19c6b['offset'];var _0x14ab81=_0x53cfda?_0x2d0be3[_0xcf31('0x1d')]:_0x19c6b['offset']+_0x19c6b['limit'];var _0x5560e8;if(_0x14ab81>=_0x1e3c24){_0x14ab81=_0x1e3c24;_0x5560e8=0xc8;}else{_0x5560e8=0xce;}_0x41b8e8['status'](_0x5560e8);return _0x41b8e8[_0xcf31('0x1e')](_0xcf31('0x1f'),_0xa625a2+'-'+_0x14ab81+'/'+_0x1e3c24)['json'](_0x2d0be3);}return null;};}function patchUpdates(_0x12900e){return function(_0x14da81){try{jsonpatch[_0xcf31('0x20')](_0x14da81,_0x12900e,!![]);}catch(_0x83762b){return BPromise[_0xcf31('0x21')](_0x83762b);}return _0x14da81[_0xcf31('0x22')]();};}function saveUpdates(_0x5f2b2a,_0x19d345){return function(_0x1461ed){if(_0x1461ed){return _0x1461ed[_0xcf31('0x23')](_0x5f2b2a)[_0xcf31('0x24')](function(_0x230c7d){return _0x230c7d;});}return null;};}function removeEntity(_0x17b189,_0x466fe0){return function(_0x27d18f){if(_0x27d18f){return _0x27d18f[_0xcf31('0x25')]()[_0xcf31('0x24')](function(){var _0x26395f=_0x27d18f['get']({'plain':!![]});var _0x35d6fa='Variables';return db[_0xcf31('0x26')][_0xcf31('0x25')]({'where':{'type':_0x35d6fa,'resourceId':_0x26395f['id']}})[_0xcf31('0x24')](function(){return _0x27d18f;});})[_0xcf31('0x24')](function(){_0x17b189['status'](0xcc)[_0xcf31('0x19')]();});}};}function handleEntityNotFound(_0x2927fa,_0x447756){return function(_0x416887){if(!_0x416887){_0x2927fa[_0xcf31('0x17')](0x194);}return _0x416887;};}function handleError(_0x159f86,_0x29de3f){_0x29de3f=_0x29de3f||0x1f4;return function(_0x406a28){logger[_0xcf31('0x27')](_0x406a28['stack']);if(_0x406a28[_0xcf31('0x28')]){delete _0x406a28[_0xcf31('0x28')];}_0x159f86['status'](_0x29de3f)[_0xcf31('0x29')](_0x406a28);};}exports['index']=function(_0x25fc77,_0x576e51){var _0x352e47={},_0x35de54={},_0x3e2530={'count':0x0,'rows':[]};var _0x1aa93c=_[_0xcf31('0x2a')](db[_0xcf31('0x2b')]['rawAttributes'],function(_0x13ee40){return{'name':_0x13ee40['fieldName'],'type':_0x13ee40['type'][_0xcf31('0x2c')]};});_0x35de54[_0xcf31('0x2d')]=_[_0xcf31('0x2a')](_0x1aa93c,'name');_0x35de54[_0xcf31('0x2e')]=_[_0xcf31('0x2f')](_0x25fc77['query']);_0x35de54['filters']=_[_0xcf31('0x30')](_0x35de54['model'],_0x35de54[_0xcf31('0x2e')]);_0x352e47[_0xcf31('0x31')]=_['intersection'](_0x35de54[_0xcf31('0x2d')],qs[_0xcf31('0x32')](_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x32')]));_0x352e47[_0xcf31('0x31')]=_0x352e47[_0xcf31('0x31')]['length']?_0x352e47[_0xcf31('0x31')]:_0x35de54[_0xcf31('0x2d')];if(!_0x25fc77[_0xcf31('0x2e')]['hasOwnProperty']('nolimit')){_0x352e47[_0xcf31('0x33')]=qs[_0xcf31('0x33')](_0x25fc77[_0xcf31('0x2e')]['limit']);_0x352e47[_0xcf31('0x1b')]=qs[_0xcf31('0x1b')](_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x1b')]);}_0x352e47[_0xcf31('0x34')]=qs[_0xcf31('0x35')](_0x25fc77[_0xcf31('0x2e')]['sort']);_0x352e47[_0xcf31('0x36')]=qs[_0xcf31('0x37')](_[_0xcf31('0x38')](_0x25fc77[_0xcf31('0x2e')],_0x35de54[_0xcf31('0x37')]),_0x1aa93c);if(_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x39')]){_0x352e47[_0xcf31('0x36')]=_[_0xcf31('0x3a')](_0x352e47[_0xcf31('0x36')],{'$or':_[_0xcf31('0x2a')](_0x1aa93c,function(_0x544b78){if(_0x544b78[_0xcf31('0x3b')]!==_0xcf31('0x3c')){var _0x2f1f52={};_0x2f1f52[_0x544b78[_0xcf31('0x28')]]={'$like':'%'+_0x25fc77[_0xcf31('0x2e')][_0xcf31('0x39')]+'%'};return _0x2f1f52;}})});}_0x352e47=_['merge']({},_0x352e47,_0x25fc77[_0xcf31('0x3d')]);var _0x30edb8={'where':_0x352e47[_0xcf31('0x36')]};return db['Variable']['count'](_0x30edb8)['then'](function(_0x4a9979){_0x3e2530[_0xcf31('0x1d')]=_0x4a9979;if(_0x25fc77[_0xcf31('0x2e')]['includeAll']){_0x352e47['include']=[{'all':!![]}];}return db['Variable'][_0xcf31('0x3e')](_0x352e47);})[_0xcf31('0x24')](function(_0x2c78f4){_0x3e2530['rows']=_0x2c78f4;return _0x3e2530;})[_0xcf31('0x24')](respondWithFilteredResult(_0x576e51,_0x352e47))[_0xcf31('0x3f')](handleError(_0x576e51,null));};exports[_0xcf31('0x40')]=function(_0x4068f3,_0x213c30){var _0x15e789={'raw':!![],'where':{'id':_0x4068f3[_0xcf31('0x41')]['id']}},_0x1ddd75={};_0x1ddd75['model']=_['keys'](db['Variable'][_0xcf31('0x42')]);_0x1ddd75[_0xcf31('0x2e')]=_[_0xcf31('0x2f')](_0x4068f3[_0xcf31('0x2e')]);_0x1ddd75[_0xcf31('0x37')]=_['intersection'](_0x1ddd75[_0xcf31('0x2d')],_0x1ddd75['query']);_0x15e789[_0xcf31('0x31')]=_['intersection'](_0x1ddd75[_0xcf31('0x2d')],qs['fields'](_0x4068f3['query'][_0xcf31('0x32')]));_0x15e789[_0xcf31('0x31')]=_0x15e789[_0xcf31('0x31')][_0xcf31('0x43')]?_0x15e789[_0xcf31('0x31')]:_0x1ddd75['model'];if(_0x4068f3['query'][_0xcf31('0x44')]){_0x15e789[_0xcf31('0x45')]=[{'all':!![]}];}_0x15e789=_[_0xcf31('0x3a')]({},_0x15e789,_0x4068f3[_0xcf31('0x3d')]);return db[_0xcf31('0x2b')][_0xcf31('0x46')](_0x15e789)[_0xcf31('0x24')](handleEntityNotFound(_0x213c30,null))[_0xcf31('0x24')](respondWithResult(_0x213c30,null))[_0xcf31('0x3f')](handleError(_0x213c30,null));};exports[_0xcf31('0x47')]=function(_0x4a663a,_0x4cd825){return db[_0xcf31('0x2b')][_0xcf31('0x47')](_0x4a663a[_0xcf31('0x48')],{})[_0xcf31('0x24')](function(_0xb6f7ab){var _0x3c7d5f=_0x4a663a[_0xcf31('0x49')][_0xcf31('0x4a')]({'plain':!![]});if(!_0x3c7d5f)throw new Error(_0xcf31('0x4b'));if(_0x3c7d5f[_0xcf31('0x4c')]===_0xcf31('0x49')){var _0x4234bb=_0xb6f7ab[_0xcf31('0x4a')]({'plain':!![]});var _0x27c5ad=_0xcf31('0x4d');return db[_0xcf31('0x4e')][_0xcf31('0x46')]({'where':{'name':_0x27c5ad,'userProfileId':_0x3c7d5f[_0xcf31('0x4f')]},'raw':!![]})[_0xcf31('0x24')](function(_0x4d1d1a){if(_0x4d1d1a&&_0x4d1d1a[_0xcf31('0x50')]===0x0){return db[_0xcf31('0x26')][_0xcf31('0x47')]({'name':_0x4234bb['name'],'resourceId':_0x4234bb['id'],'type':_0x4d1d1a['name'],'sectionId':_0x4d1d1a['id']},{})[_0xcf31('0x24')](function(){return _0xb6f7ab;});}else{return _0xb6f7ab;}})[_0xcf31('0x3f')](function(_0x541685){logger[_0xcf31('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x541685);throw _0x541685;});}return _0xb6f7ab;})[_0xcf31('0x24')](respondWithResult(_0x4cd825,0xc9))[_0xcf31('0x3f')](handleError(_0x4cd825,null));};exports['update']=function(_0x2d32c5,_0x14b324){if(_0x2d32c5[_0xcf31('0x48')]['id']){delete _0x2d32c5[_0xcf31('0x48')]['id'];}return db[_0xcf31('0x2b')][_0xcf31('0x46')]({'where':{'id':_0x2d32c5[_0xcf31('0x41')]['id']}})['then'](handleEntityNotFound(_0x14b324,null))[_0xcf31('0x24')](saveUpdates(_0x2d32c5[_0xcf31('0x48')],null))[_0xcf31('0x24')](respondWithResult(_0x14b324,null))['catch'](handleError(_0x14b324,null));};exports['destroy']=function(_0x169b1d,_0x303b82){return db['Variable']['find']({'where':{'id':_0x169b1d[_0xcf31('0x41')]['id']}})[_0xcf31('0x24')](handleEntityNotFound(_0x303b82,null))[_0xcf31('0x24')](removeEntity(_0x303b82,null))[_0xcf31('0x3f')](handleError(_0x303b82,null));}; \ No newline at end of file +var _0x88b7=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','find'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x88b7,0x141));var _0x788b=function(_0x4e4416,_0x195668){_0x4e4416=_0x4e4416-0x0;var _0x3e96c4=_0x88b7[_0x4e4416];return _0x3e96c4;};'use strict';var emlformat=require(_0x788b('0x0'));var rimraf=require(_0x788b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x788b('0x2'));var rp=require(_0x788b('0x3'));var moment=require(_0x788b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x788b('0x5'));var util=require(_0x788b('0x6'));var path=require('path');var sox=require(_0x788b('0x7'));var csv=require(_0x788b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x788b('0x9'));var squel=require(_0x788b('0xa'));var crypto=require('crypto');var jsforce=require(_0x788b('0xb'));var deskjs=require(_0x788b('0xc'));var toCsv=require(_0x788b('0x8'));var querystring=require(_0x788b('0xd'));var Papa=require('papaparse');var Redis=require(_0x788b('0xe'));var authService=require(_0x788b('0xf'));var qs=require(_0x788b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x788b('0x11'));var logger=require(_0x788b('0x12'))('api');var utils=require(_0x788b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x788b('0x14'));var db=require(_0x788b('0x15'))['db'];function respondWithStatusCode(_0x4078c5,_0x2c2569){_0x2c2569=_0x2c2569||0xcc;return function(_0x3c8ad5){if(_0x3c8ad5){return _0x4078c5[_0x788b('0x16')](_0x2c2569);}return _0x4078c5[_0x788b('0x17')](_0x2c2569)[_0x788b('0x18')]();};}function respondWithResult(_0x356079,_0x2ebd1d){_0x2ebd1d=_0x2ebd1d||0xc8;return function(_0x58bd92){if(_0x58bd92){return _0x356079['status'](_0x2ebd1d)[_0x788b('0x19')](_0x58bd92);}};}function respondWithFilteredResult(_0x4dadae,_0x486714){return function(_0x6bbfcf){if(_0x6bbfcf){var _0x20caf8=typeof _0x486714['offset']==='undefined'&&typeof _0x486714[_0x788b('0x1a')]===_0x788b('0x1b');var _0x3a1598=_0x6bbfcf[_0x788b('0x1c')];var _0x49e968=_0x20caf8?0x0:_0x486714[_0x788b('0x1d')];var _0xd0b13=_0x20caf8?_0x6bbfcf[_0x788b('0x1c')]:_0x486714['offset']+_0x486714[_0x788b('0x1a')];var _0xc6a04b;if(_0xd0b13>=_0x3a1598){_0xd0b13=_0x3a1598;_0xc6a04b=0xc8;}else{_0xc6a04b=0xce;}_0x4dadae[_0x788b('0x17')](_0xc6a04b);return _0x4dadae[_0x788b('0x1e')](_0x788b('0x1f'),_0x49e968+'-'+_0xd0b13+'/'+_0x3a1598)[_0x788b('0x19')](_0x6bbfcf);}return null;};}function patchUpdates(_0x1c0ec0){return function(_0x5780b5){try{jsonpatch['apply'](_0x5780b5,_0x1c0ec0,!![]);}catch(_0x4c6a7c){return BPromise['reject'](_0x4c6a7c);}return _0x5780b5[_0x788b('0x20')]();};}function saveUpdates(_0x4b6164,_0x115c60){return function(_0x1db810){if(_0x1db810){return _0x1db810[_0x788b('0x21')](_0x4b6164)[_0x788b('0x22')](function(_0x520156){return _0x520156;});}return null;};}function removeEntity(_0x51b741,_0x106f32){return function(_0x2f7a32){if(_0x2f7a32){return _0x2f7a32[_0x788b('0x23')]()[_0x788b('0x22')](function(){var _0x25da1f=_0x2f7a32[_0x788b('0x24')]({'plain':!![]});var _0x180d87=_0x788b('0x25');return db[_0x788b('0x26')][_0x788b('0x23')]({'where':{'type':_0x180d87,'resourceId':_0x25da1f['id']}})[_0x788b('0x22')](function(){return _0x2f7a32;});})[_0x788b('0x22')](function(){_0x51b741[_0x788b('0x17')](0xcc)[_0x788b('0x18')]();});}};}function handleEntityNotFound(_0x4a0e5f,_0x56a204){return function(_0x350ff0){if(!_0x350ff0){_0x4a0e5f[_0x788b('0x16')](0x194);}return _0x350ff0;};}function handleError(_0x54a198,_0x38d32f){_0x38d32f=_0x38d32f||0x1f4;return function(_0x5e32df){logger[_0x788b('0x27')](_0x5e32df[_0x788b('0x28')]);if(_0x5e32df[_0x788b('0x29')]){delete _0x5e32df[_0x788b('0x29')];}_0x54a198['status'](_0x38d32f)[_0x788b('0x2a')](_0x5e32df);};}exports['index']=function(_0x5de27b,_0x5551eb){var _0x33cf86={},_0x56f067={},_0x9dabce={'count':0x0,'rows':[]};var _0x44fbfd=_[_0x788b('0x2b')](db[_0x788b('0x2c')][_0x788b('0x2d')],function(_0x48cc2d){return{'name':_0x48cc2d[_0x788b('0x2e')],'type':_0x48cc2d[_0x788b('0x2f')][_0x788b('0x30')]};});_0x56f067[_0x788b('0x31')]=_['map'](_0x44fbfd,_0x788b('0x29'));_0x56f067[_0x788b('0x32')]=_[_0x788b('0x33')](_0x5de27b[_0x788b('0x32')]);_0x56f067[_0x788b('0x34')]=_['intersection'](_0x56f067[_0x788b('0x31')],_0x56f067['query']);_0x33cf86[_0x788b('0x35')]=_[_0x788b('0x36')](_0x56f067[_0x788b('0x31')],qs[_0x788b('0x37')](_0x5de27b['query'][_0x788b('0x37')]));_0x33cf86[_0x788b('0x35')]=_0x33cf86[_0x788b('0x35')][_0x788b('0x38')]?_0x33cf86[_0x788b('0x35')]:_0x56f067[_0x788b('0x31')];if(!_0x5de27b[_0x788b('0x32')][_0x788b('0x39')](_0x788b('0x3a'))){_0x33cf86[_0x788b('0x1a')]=qs[_0x788b('0x1a')](_0x5de27b['query'][_0x788b('0x1a')]);_0x33cf86[_0x788b('0x1d')]=qs['offset'](_0x5de27b[_0x788b('0x32')][_0x788b('0x1d')]);}_0x33cf86[_0x788b('0x3b')]=qs[_0x788b('0x3c')](_0x5de27b[_0x788b('0x32')][_0x788b('0x3c')]);_0x33cf86[_0x788b('0x3d')]=qs['filters'](_[_0x788b('0x3e')](_0x5de27b[_0x788b('0x32')],_0x56f067[_0x788b('0x34')]),_0x44fbfd);if(_0x5de27b['query'][_0x788b('0x3f')]){_0x33cf86['where']=_['merge'](_0x33cf86['where'],{'$or':_[_0x788b('0x2b')](_0x44fbfd,function(_0x1017a8){if(_0x1017a8[_0x788b('0x2f')]!==_0x788b('0x40')){var _0x39f1c2={};_0x39f1c2[_0x1017a8[_0x788b('0x29')]]={'$like':'%'+_0x5de27b['query'][_0x788b('0x3f')]+'%'};return _0x39f1c2;}})});}_0x33cf86=_[_0x788b('0x41')]({},_0x33cf86,_0x5de27b[_0x788b('0x42')]);var _0x481507={'where':_0x33cf86[_0x788b('0x3d')]};return db['Variable'][_0x788b('0x1c')](_0x481507)[_0x788b('0x22')](function(_0xb66319){_0x9dabce[_0x788b('0x1c')]=_0xb66319;if(_0x5de27b['query'][_0x788b('0x43')]){_0x33cf86[_0x788b('0x44')]=[{'all':!![]}];}return db['Variable'][_0x788b('0x45')](_0x33cf86);})[_0x788b('0x22')](function(_0xfe3464){_0x9dabce[_0x788b('0x46')]=_0xfe3464;return _0x9dabce;})[_0x788b('0x22')](respondWithFilteredResult(_0x5551eb,_0x33cf86))[_0x788b('0x47')](handleError(_0x5551eb,null));};exports['show']=function(_0x3229d7,_0x1c9381){var _0x30b458={'raw':!![],'where':{'id':_0x3229d7[_0x788b('0x48')]['id']}},_0x5c489f={};_0x5c489f['model']=_[_0x788b('0x33')](db[_0x788b('0x2c')]['rawAttributes']);_0x5c489f[_0x788b('0x32')]=_[_0x788b('0x33')](_0x3229d7[_0x788b('0x32')]);_0x5c489f[_0x788b('0x34')]=_['intersection'](_0x5c489f['model'],_0x5c489f[_0x788b('0x32')]);_0x30b458[_0x788b('0x35')]=_['intersection'](_0x5c489f[_0x788b('0x31')],qs[_0x788b('0x37')](_0x3229d7['query'][_0x788b('0x37')]));_0x30b458[_0x788b('0x35')]=_0x30b458['attributes']['length']?_0x30b458['attributes']:_0x5c489f[_0x788b('0x31')];if(_0x3229d7[_0x788b('0x32')][_0x788b('0x43')]){_0x30b458['include']=[{'all':!![]}];}_0x30b458=_[_0x788b('0x41')]({},_0x30b458,_0x3229d7['options']);return db[_0x788b('0x2c')][_0x788b('0x49')](_0x30b458)[_0x788b('0x22')](handleEntityNotFound(_0x1c9381,null))[_0x788b('0x22')](respondWithResult(_0x1c9381,null))['catch'](handleError(_0x1c9381,null));};exports['create']=function(_0x53e3cb,_0xbb9e1b){return db[_0x788b('0x2c')][_0x788b('0x4a')](_0x53e3cb[_0x788b('0x4b')],{})[_0x788b('0x22')](function(_0x34c4cb){var _0x6305c8=_0x53e3cb['user'][_0x788b('0x24')]({'plain':!![]});if(!_0x6305c8)throw new Error(_0x788b('0x4c'));if(_0x6305c8['role']==='user'){var _0x59af47=_0x34c4cb['get']({'plain':!![]});var _0x8b7354='Variables';return db[_0x788b('0x4d')][_0x788b('0x49')]({'where':{'name':_0x8b7354,'userProfileId':_0x6305c8['userProfileId']},'raw':!![]})[_0x788b('0x22')](function(_0x5ca9a8){if(_0x5ca9a8&&_0x5ca9a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x788b('0x4a')]({'name':_0x59af47[_0x788b('0x29')],'resourceId':_0x59af47['id'],'type':_0x5ca9a8[_0x788b('0x29')],'sectionId':_0x5ca9a8['id']},{})['then'](function(){return _0x34c4cb;});}else{return _0x34c4cb;}})[_0x788b('0x47')](function(_0x420a3f){logger['error'](_0x788b('0x4e'),_0x420a3f);throw _0x420a3f;});}return _0x34c4cb;})[_0x788b('0x22')](respondWithResult(_0xbb9e1b,0xc9))[_0x788b('0x47')](handleError(_0xbb9e1b,null));};exports['update']=function(_0x3e54fb,_0x4b4af4){if(_0x3e54fb[_0x788b('0x4b')]['id']){delete _0x3e54fb['body']['id'];}return db[_0x788b('0x2c')]['find']({'where':{'id':_0x3e54fb['params']['id']}})['then'](handleEntityNotFound(_0x4b4af4,null))[_0x788b('0x22')](saveUpdates(_0x3e54fb['body'],null))[_0x788b('0x22')](respondWithResult(_0x4b4af4,null))[_0x788b('0x47')](handleError(_0x4b4af4,null));};exports[_0x788b('0x23')]=function(_0x22e469,_0x43cfa4){return db['Variable'][_0x788b('0x49')]({'where':{'id':_0x22e469[_0x788b('0x48')]['id']}})[_0x788b('0x22')](handleEntityNotFound(_0x43cfa4,null))[_0x788b('0x22')](removeEntity(_0x43cfa4,null))['catch'](handleError(_0x43cfa4,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index c5b1a13..6173fc4 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 _0x4e41=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','api','moment','bluebird'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x4e41,0x175));var _0x14e4=function(_0x5d4a92,_0x2b4533){_0x5d4a92=_0x5d4a92-0x0;var _0x5468fb=_0x4e41[_0x5d4a92];return _0x5468fb;};'use strict';var _=require(_0x14e4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e4('0x1'));var moment=require(_0x14e4('0x2'));var BPromise=require(_0x14e4('0x3'));var rp=require(_0x14e4('0x4'));var fs=require('fs');var path=require(_0x14e4('0x5'));var rimraf=require(_0x14e4('0x6'));var config=require(_0x14e4('0x7'));var attributes=require(_0x14e4('0x8'));module[_0x14e4('0x9')]=function(_0x175fa5,_0x57d21f){return _0x175fa5[_0x14e4('0xa')](_0x14e4('0xb'),attributes,{'tableName':_0x14e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ce0=['exports','define','lodash','../../config/logger','api','moment','bluebird','rimraf','./variable.attributes'];(function(_0x29ee43,_0x37f00e){var _0x4d8059=function(_0x56b52b){while(--_0x56b52b){_0x29ee43['push'](_0x29ee43['shift']());}};_0x4d8059(++_0x37f00e);}(_0x9ce0,0x173));var _0x09ce=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9ce0[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x09ce('0x0'));var util=require('util');var logger=require(_0x09ce('0x1'))(_0x09ce('0x2'));var moment=require(_0x09ce('0x3'));var BPromise=require(_0x09ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x09ce('0x5'));var config=require('../../config/environment');var attributes=require(_0x09ce('0x6'));module[_0x09ce('0x7')]=function(_0x1c8509,_0x52a8f3){return _0x1c8509[_0x09ce('0x8')]('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index b4eb500..a236818 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 _0x8ef6=['result','catch','Variable','find','options','raw','include','model','attributes','map','ShowVariable','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1e1f17,_0x4bd574){var _0x465b52=function(_0x46accd){while(--_0x46accd){_0x1e1f17['push'](_0x1e1f17['shift']());}};_0x465b52(++_0x4bd574);}(_0x8ef6,0xf2));var _0x68ef=function(_0x2dce85,_0x1ac12a){_0x2dce85=_0x2dce85-0x0;var _0x4340b6=_0x8ef6[_0x2dce85];return _0x4340b6;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('Variable,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});}exports['ShowVariable']=function(_0x2633c1){var _0x404870=this;return new Promise(function(_0x4ade0d,_0x527870){return db[_0x68ef('0x18')][_0x68ef('0x19')]({'raw':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1['options'][_0x68ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['where']||null:null,'attributes':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')]['attributes']||null:null,'include':_0x2633c1[_0x68ef('0x1a')]?_0x2633c1[_0x68ef('0x1a')][_0x68ef('0x1c')]?_['map'](_0x2633c1['options']['include'],function(_0x26018d){return{'model':db[_0x26018d[_0x68ef('0x1d')]],'as':_0x26018d['as'],'attributes':_0x26018d[_0x68ef('0x1e')],'include':_0x26018d[_0x68ef('0x1c')]?_[_0x68ef('0x1f')](_0x26018d[_0x68ef('0x1c')],function(_0x258cd5){return{'model':db[_0x258cd5[_0x68ef('0x1d')]],'as':_0x258cd5['as'],'attributes':_0x258cd5[_0x68ef('0x1e')],'include':_0x258cd5[_0x68ef('0x1c')]?_['map'](_0x258cd5[_0x68ef('0x1c')],function(_0x57f9ee){return{'model':db[_0x57f9ee['model']],'as':_0x57f9ee['as'],'attributes':_0x57f9ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x68ef('0xc')](function(_0x268f32){logger[_0x68ef('0xd')](_0x68ef('0x20'),_0x2633c1);logger['debug']('ShowVariable',_0x2633c1,JSON[_0x68ef('0x12')](_0x268f32));_0x4ade0d(_0x268f32);})[_0x68ef('0x17')](function(_0x7bf96){logger[_0x68ef('0x13')](_0x68ef('0x20'),_0x7bf96[_0x68ef('0x15')],_0x2633c1);_0x527870(_0x404870[_0x68ef('0x13')](0x1f4,_0x7bf96[_0x68ef('0x15')]));});});}; \ No newline at end of file +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(_0x2b76c7,_0x41aa00){var _0x2dbe8e=function(_0x432a77){while(--_0x432a77){_0x2b76c7['push'](_0x2b76c7['shift']());}};_0x2dbe8e(++_0x41aa00);}(_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']('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 52279e0..23cd28c 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 _0xe677=['get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','pull','/migrations','migrations','exports','express','../../components/auth/service','index'];(function(_0x36ac49,_0x4a4afe){var _0x42aee0=function(_0x3e1ac3){while(--_0x3e1ac3){_0x36ac49['push'](_0x36ac49['shift']());}};_0x42aee0(++_0x4a4afe);}(_0xe677,0xf9));var _0x7e67=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xe677[_0x35a274];return _0x40d905;};'use strict';var express=require(_0x7e67('0x0'));var router=express['Router']();var auth=require(_0x7e67('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0x7e67('0x2')]);router[_0x7e67('0x3')](_0x7e67('0x4'),auth['isAuthenticated'](),auth[_0x7e67('0x5')](),controller[_0x7e67('0x6')]);router['get'](_0x7e67('0x7'),auth[_0x7e67('0x8')](),auth[_0x7e67('0x5')](),controller[_0x7e67('0x9')]);router[_0x7e67('0x3')]('/pull',auth[_0x7e67('0x8')](),auth[_0x7e67('0x5')](),controller[_0x7e67('0xa')]);router[_0x7e67('0x3')]('/restart',auth[_0x7e67('0x8')](),controller['restart']);router['get'](_0x7e67('0xb'),controller[_0x7e67('0xc')]);module[_0x7e67('0xd')]=router; \ No newline at end of file +var _0x333d=['Router','../../components/auth/service','./version.controller','get','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull','restart','/migrations','migrations','exports','express'];(function(_0x13e85b,_0x45e29d){var _0x1611ea=function(_0x195c52){while(--_0x195c52){_0x13e85b['push'](_0x13e85b['shift']());}};_0x1611ea(++_0x45e29d);}(_0x333d,0x19f));var _0xd333=function(_0x311374,_0x132c28){_0x311374=_0x311374-0x0;var _0x1bf041=_0x333d[_0x311374];return _0x1bf041;};'use strict';var express=require(_0xd333('0x0'));var router=express[_0xd333('0x1')]();var auth=require(_0xd333('0x2'));var controller=require(_0xd333('0x3'));router[_0xd333('0x4')]('/',controller['index']);router[_0xd333('0x4')](_0xd333('0x5'),auth['isAuthenticated'](),auth[_0xd333('0x6')](),controller[_0xd333('0x7')]);router[_0xd333('0x4')](_0xd333('0x8'),auth[_0xd333('0x9')](),auth[_0xd333('0x6')](),controller[_0xd333('0xa')]);router[_0xd333('0x4')](_0xd333('0xb'),auth['isAuthenticated'](),auth[_0xd333('0x6')](),controller['pull']);router[_0xd333('0x4')]('/restart',auth[_0xd333('0x9')](),controller[_0xd333('0xc')]);router[_0xd333('0x4')](_0xd333('0xd'),controller[_0xd333('0xe')]);module[_0xd333('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 737efb5..bc31300 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 _0x623c=['getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','version','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','fetch','tags','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','length','replace','.js','push','sort','sequelize','Migration'];(function(_0x54522a,_0x519c28){var _0x57def8=function(_0x2b91eb){while(--_0x2b91eb){_0x54522a['push'](_0x54522a['shift']());}};_0x57def8(++_0x519c28);}(_0x623c,0x14e));var _0xc623=function(_0x152a61,_0x133061){_0x152a61=_0x152a61-0x0;var _0x42e94c=_0x623c[_0x152a61];return _0x42e94c;};'use strict';var Umzug=require('umzug');var path=require(_0xc623('0x0'));var fs=require('fs');var _=require(_0xc623('0x1'));var pkginfo=require(_0xc623('0x2'))(module,_0xc623('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xc623('0x4'))[_0xc623('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0xc623('0x6'));var pm2=require(_0xc623('0x7'));var logger=require(_0xc623('0x8'))(_0xc623('0x9'));var git=require(_0xc623('0xa'))(config[_0xc623('0xb')]);exports[_0xc623('0xc')]=function(_0x23f724,_0x2c42ed){var _0x3b2820={'current':module[_0xc623('0xd')][_0xc623('0x3')],'phonebar':0x2};if(_0x23f724['query']&&_0x23f724['query'][_0xc623('0xe')]){return git[_0xc623('0xf')]()[_0xc623('0x10')](function(_0x3e5568,_0x47d377){_0x3b2820[_0xc623('0xe')]=(_0x3e5568?module[_0xc623('0xd')][_0xc623('0x3')]:_0x47d377[_0xc623('0xe')])||'2.0.0';return _0x2c42ed[_0xc623('0x11')](0xc8)[_0xc623('0x12')](_0x3b2820);});}else{return _0x2c42ed['status'](0xc8)[_0xc623('0x12')](_0x3b2820);}};exports[_0xc623('0xf')]=function(_0x2bdd09,_0x3b4792){return git[_0xc623('0xf')](['origin',_0xc623('0x13')],function(_0x5eed5e){if(_0x5eed5e){logger[_0xc623('0x14')](_0x5eed5e);return _0x3b4792['status'](0x1f4)['json'](_0x5eed5e);}logger[_0xc623('0x15')](_0xc623('0x16'));return _0x3b4792[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x17')});});};exports[_0xc623('0x18')]=function(_0x217718,_0xdd8a25){return git[_0xc623('0x18')]([_0xc623('0x19'),'FETCH_HEAD'],function(_0xc8b7ef){if(_0xc8b7ef){logger[_0xc623('0x14')](_0xc8b7ef);return _0xdd8a25[_0xc623('0x11')](0x1f4)['json'](_0xc8b7ef);}logger[_0xc623('0x15')](_0xc623('0x1a'));return _0xdd8a25[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x1b')});});};exports['pull']=function(_0x17005b,_0x59f662){exec(_0xc623('0x1c'),function(_0x113646,_0x588610,_0x572691){logger[_0xc623('0x15')](_0x588610);logger[_0xc623('0x15')](_0x572691);if(_0x113646){logger[_0xc623('0x14')](_0x113646);return _0x59f662[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x113646);}return _0x59f662[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':_0x588610});});};exports['restart']=function(_0x2a9620,_0x50683e){return pm2[_0xc623('0x1d')](_0xc623('0x1e'))[_0xc623('0x1f')](function(_0x24786d){logger['info'](_0xc623('0x20'),_0x24786d);return _0x50683e['status'](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x21')});})[_0xc623('0x22')](function(_0x358d3b){logger[_0xc623('0x14')](_0x358d3b);return _0x50683e[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x358d3b);});};exports[_0xc623('0x23')]=function(_0x5caac4,_0x37e12a){var _0xcce323=fs['readdirSync'](path['join'](config[_0xc623('0xb')],_0xc623('0x24'),_0xc623('0x23')));var _0x311f22=[];for(var _0x1788e5=0x0;_0x1788e5<_0xcce323[_0xc623('0x25')];_0x1788e5++){var _0x2198d3=_0xcce323[_0x1788e5][_0xc623('0x26')](_0xc623('0x27'),'');if(compareVersions(module[_0xc623('0xd')][_0xc623('0x3')],_0x2198d3)===-0x1){_0x311f22[_0xc623('0x28')](_0x2198d3);}}if(_0x311f22[_0xc623('0x25')]){var _0x5f488b=_0x311f22[_0xc623('0x29')](compareVersions);var _0x85a20c=new Umzug({'storage':_0xc623('0x2a'),'storageOptions':{'model':db[_0xc623('0x2b')],'modelName':_0xc623('0x2b'),'columnName':_0xc623('0x3')},'migrations':{'params':[db[_0xc623('0x2a')][_0xc623('0x2c')](),db[_0xc623('0x2a')][_0xc623('0x2d')],function(){throw new Error(_0xc623('0x2e'));}],'path':path[_0xc623('0x2f')](config[_0xc623('0xb')],_0xc623('0x24'),_0xc623('0x23')),'pattern':/\.js$/}});_0x85a20c['up']({'migrations':_[_0xc623('0x30')](_0x5f488b,function(_0x3bc9af){return _0x3bc9af+_0xc623('0x27');})})[_0xc623('0x1f')](function(){return _0x37e12a[_0xc623('0x11')](0xc8)['json']({'output':_0xc623('0x31')+module[_0xc623('0xd')]['version']+_0xc623('0x32')+_[_0xc623('0x33')](_0x5f488b),'migrations':_['join'](_0x5f488b)});})['catch'](function(_0x127e00){if(_0x127e00 instanceof db[_0xc623('0x2a')][_0xc623('0x34')]){return _0x37e12a['status'](0xc8)[_0xc623('0x12')]({'output':_0xc623('0x35')});}else{return _0x37e12a[_0xc623('0x11')](0x1f4)[_0xc623('0x12')](_0x127e00);}});}else{return _0x37e12a[_0xc623('0x11')](0xc8)[_0xc623('0x12')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x7562=['map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','child_process','exec','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','version','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','replace','length','sort','sequelize','Migration','constructor'];(function(_0x2b7868,_0x3c7807){var _0x1d66f3=function(_0x410596){while(--_0x410596){_0x2b7868['push'](_0x2b7868['shift']());}};_0x1d66f3(++_0x3c7807);}(_0x7562,0x6d));var _0x2756=function(_0x1b953f,_0x38387c){_0x1b953f=_0x1b953f-0x0;var _0x30bfe5=_0x7562[_0x1b953f];return _0x30bfe5;};'use strict';var Umzug=require(_0x2756('0x0'));var path=require(_0x2756('0x1'));var fs=require('fs');var _=require(_0x2756('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x2756('0x3'));var exec=require(_0x2756('0x4'))[_0x2756('0x5')];var db=require('../../mysqldb')['db'];var config=require(_0x2756('0x6'));var pm2=require(_0x2756('0x7'));var logger=require(_0x2756('0x8'))('update');var git=require(_0x2756('0x9'))(config[_0x2756('0xa')]);exports[_0x2756('0xb')]=function(_0x14f2bb,_0x3ec765){var _0x4c3d9c={'current':module[_0x2756('0xc')][_0x2756('0xd')],'phonebar':0x2};if(_0x14f2bb[_0x2756('0xe')]&&_0x14f2bb[_0x2756('0xe')][_0x2756('0xf')]){return git[_0x2756('0x10')]()[_0x2756('0x11')](function(_0x1fa1e6,_0x12311b){_0x4c3d9c[_0x2756('0xf')]=(_0x1fa1e6?module[_0x2756('0xc')][_0x2756('0xd')]:_0x12311b['latest'])||_0x2756('0x12');return _0x3ec765[_0x2756('0x13')](0xc8)[_0x2756('0x14')](_0x4c3d9c);});}else{return _0x3ec765[_0x2756('0x13')](0xc8)[_0x2756('0x14')](_0x4c3d9c);}};exports[_0x2756('0x10')]=function(_0x136b40,_0x5a85de){return git[_0x2756('0x10')](['origin',_0x2756('0x15')],function(_0x3e9d8a){if(_0x3e9d8a){logger[_0x2756('0x16')](_0x3e9d8a);return _0x5a85de[_0x2756('0x13')](0x1f4)[_0x2756('0x14')](_0x3e9d8a);}logger[_0x2756('0x17')](_0x2756('0x18'));return _0x5a85de[_0x2756('0x13')](0xc8)[_0x2756('0x14')]({'output':_0x2756('0x19')});});};exports[_0x2756('0x1a')]=function(_0x228275,_0x3ea9ec){return git[_0x2756('0x1a')]([_0x2756('0x1b'),'FETCH_HEAD'],function(_0x9ceb69){if(_0x9ceb69){logger[_0x2756('0x16')](_0x9ceb69);return _0x3ea9ec[_0x2756('0x13')](0x1f4)[_0x2756('0x14')](_0x9ceb69);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x3ea9ec[_0x2756('0x13')](0xc8)[_0x2756('0x14')]({'output':_0x2756('0x1c')});});};exports[_0x2756('0x1d')]=function(_0x3d476f,_0x54863f){exec(_0x2756('0x1e'),function(_0x264d54,_0x5c1f96,_0x1fc976){logger[_0x2756('0x17')](_0x5c1f96);logger['info'](_0x1fc976);if(_0x264d54){logger[_0x2756('0x16')](_0x264d54);return _0x54863f['status'](0x1f4)[_0x2756('0x14')](_0x264d54);}return _0x54863f['status'](0xc8)[_0x2756('0x14')]({'output':_0x5c1f96});});};exports[_0x2756('0x1f')]=function(_0x1fb22e,_0x5325e7){return pm2[_0x2756('0x1f')](_0x2756('0x20'))[_0x2756('0x21')](function(_0x2d50e7){logger[_0x2756('0x17')](_0x2756('0x22'),_0x2d50e7);return _0x5325e7[_0x2756('0x13')](0xc8)[_0x2756('0x14')]({'output':_0x2756('0x23')});})[_0x2756('0x24')](function(_0x468b98){logger[_0x2756('0x16')](_0x468b98);return _0x5325e7[_0x2756('0x13')](0x1f4)['json'](_0x468b98);});};exports[_0x2756('0x25')]=function(_0x84f045,_0x3b291e){var _0x34fca1=fs[_0x2756('0x26')](path[_0x2756('0x27')](config[_0x2756('0xa')],_0x2756('0x28'),_0x2756('0x25')));var _0x3b3ea1=[];for(var _0x408ec7=0x0;_0x408ec7<_0x34fca1['length'];_0x408ec7++){var _0x47775e=_0x34fca1[_0x408ec7][_0x2756('0x29')]('.js','');if(compareVersions(module[_0x2756('0xc')][_0x2756('0xd')],_0x47775e)===-0x1){_0x3b3ea1['push'](_0x47775e);}}if(_0x3b3ea1[_0x2756('0x2a')]){var _0x8a199c=_0x3b3ea1[_0x2756('0x2b')](compareVersions);var _0x1dc77a=new Umzug({'storage':_0x2756('0x2c'),'storageOptions':{'model':db[_0x2756('0x2d')],'modelName':'Migration','columnName':_0x2756('0xd')},'migrations':{'params':[db[_0x2756('0x2c')]['getQueryInterface'](),db['sequelize'][_0x2756('0x2e')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0x2756('0x27')](config['root'],_0x2756('0x28'),'migrations'),'pattern':/\.js$/}});_0x1dc77a['up']({'migrations':_[_0x2756('0x2f')](_0x8a199c,function(_0x3dc39f){return _0x3dc39f+_0x2756('0x30');})})[_0x2756('0x21')](function(){return _0x3b291e[_0x2756('0x13')](0xc8)[_0x2756('0x14')]({'output':_0x2756('0x31')+module[_0x2756('0xc')]['version']+'\x20to\x20'+_[_0x2756('0x32')](_0x8a199c),'migrations':_['join'](_0x8a199c)});})[_0x2756('0x24')](function(_0x3064a9){if(_0x3064a9 instanceof db[_0x2756('0x2c')]['UniqueConstraintError']){return _0x3b291e[_0x2756('0x13')](0xc8)[_0x2756('0x14')]({'output':_0x2756('0x33')});}else{return _0x3b291e[_0x2756('0x13')](0x1f4)[_0x2756('0x14')](_0x3064a9);}});}else{return _0x3b291e['status'](0xc8)[_0x2756('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 48483de..a7bc1dd 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 _0x2d43=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x2d43,0x12e));var _0x32d4=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2d43[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require('multer');var util=require(_0x32d4('0x0'));var path=require(_0x32d4('0x1'));var timeout=require('connect-timeout');var express=require(_0x32d4('0x2'));var router=express[_0x32d4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x32d4('0x4'));var interaction=require(_0x32d4('0x5'));var config=require(_0x32d4('0x6'));var controller=require(_0x32d4('0x7'));router[_0x32d4('0x8')]('/',auth[_0x32d4('0x9')](),controller[_0x32d4('0xa')]);router[_0x32d4('0x8')](_0x32d4('0xb'),auth[_0x32d4('0x9')](),controller[_0x32d4('0xc')]);router['get'](_0x32d4('0xd'),auth[_0x32d4('0x9')](),controller[_0x32d4('0xe')]);router[_0x32d4('0xf')]('/',auth[_0x32d4('0x9')](),controller['create']);router['put'](_0x32d4('0xd'),auth['isAuthenticated'](),controller[_0x32d4('0x10')]);router[_0x32d4('0x11')](_0x32d4('0xd'),auth[_0x32d4('0x9')](),controller[_0x32d4('0x12')]);module[_0x32d4('0x13')]=router; \ No newline at end of file +var _0xcdeb=['describe','/:id','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x3756e7,_0x3ff49c){var _0x3388d0=function(_0x4f7b2d){while(--_0x4f7b2d){_0x3756e7['push'](_0x3756e7['shift']());}};_0x3388d0(++_0x3ff49c);}(_0xcdeb,0xd9));var _0xbcde=function(_0xbf8697,_0x140d66){_0xbf8697=_0xbf8697-0x0;var _0x41c47e=_0xcdeb[_0xbf8697];return _0x41c47e;};'use strict';var multer=require(_0xbcde('0x0'));var util=require('util');var path=require(_0xbcde('0x1'));var timeout=require(_0xbcde('0x2'));var express=require(_0xbcde('0x3'));var router=express[_0xbcde('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbcde('0x5'));var interaction=require(_0xbcde('0x6'));var config=require('../../config/environment');var controller=require(_0xbcde('0x7'));router[_0xbcde('0x8')]('/',auth[_0xbcde('0x9')](),controller[_0xbcde('0xa')]);router[_0xbcde('0x8')]('/describe',auth[_0xbcde('0x9')](),controller[_0xbcde('0xb')]);router[_0xbcde('0x8')](_0xbcde('0xc'),auth[_0xbcde('0x9')](),controller[_0xbcde('0xd')]);router['post']('/',auth[_0xbcde('0x9')](),controller['create']);router[_0xbcde('0xe')](_0xbcde('0xc'),auth[_0xbcde('0x9')](),controller[_0xbcde('0xf')]);router[_0xbcde('0x10')](_0xbcde('0xc'),auth[_0xbcde('0x9')](),controller[_0xbcde('0x11')]);module[_0xbcde('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 91630a1..83a1a7e 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 _0x3da6=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3da6,0xc1));var _0x63da=function(_0x2ad4e0,_0x4f0a5c){_0x2ad4e0=_0x2ad4e0-0x0;var _0x5ef8a7=_0x3da6[_0x2ad4e0];return _0x5ef8a7;};'use strict';var Sequelize=require(_0x63da('0x0'));module[_0x63da('0x1')]={'type':{'type':Sequelize[_0x63da('0x2')]},'uniqueid':{'type':Sequelize[_0x63da('0x2')]},'calleridnum':{'type':Sequelize[_0x63da('0x2')]},'calleridname':{'type':Sequelize[_0x63da('0x2')]},'queue':{'type':Sequelize[_0x63da('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x63da('0x2')]},'agentcalledAt':{'type':Sequelize[_0x63da('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize[_0x63da('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x63da('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x63da('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x63da('0x5')]},'reason':{'type':Sequelize[_0x63da('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x63da('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x63da('0x2')]},'connectedlinenum':{'type':Sequelize[_0x63da('0x2')]},'connectedlinename':{'type':Sequelize[_0x63da('0x2')]},'language':{'type':Sequelize[_0x63da('0x2')]},'accountcode':{'type':Sequelize[_0x63da('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x63da('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x63da('0x2')]},'destchannelstate':{'type':Sequelize[_0x63da('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x63da('0x2')]},'destcalleridnum':{'type':Sequelize[_0x63da('0x2')]},'destcalleridname':{'type':Sequelize[_0x63da('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x63da('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x63da('0x2')]},'destlanguage':{'type':Sequelize[_0x63da('0x2')]},'destaccountcode':{'type':Sequelize[_0x63da('0x2')]},'destcontext':{'type':Sequelize[_0x63da('0x2')]},'destexten':{'type':Sequelize[_0x63da('0x2')]},'destpriority':{'type':Sequelize[_0x63da('0x2')]},'destuniqueid':{'type':Sequelize[_0x63da('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x63da('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x63da('0x6')},'transferexten':{'type':Sequelize[_0x63da('0x2')]},'transferuniqueid':{'type':Sequelize[_0x63da('0x2')]},'agententerreason':{'type':Sequelize[_0x63da('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x80cd=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','BOOLEAN'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x80cd,0x146));var _0xd80c=function(_0x164760,_0x5874b0){_0x164760=_0x164760-0x0;var _0x8b91b2=_0x80cd[_0x164760];return _0x8b91b2;};'use strict';var Sequelize=require('sequelize');module[_0xd80c('0x0')]={'type':{'type':Sequelize[_0xd80c('0x1')]},'uniqueid':{'type':Sequelize[_0xd80c('0x1')]},'calleridnum':{'type':Sequelize[_0xd80c('0x1')]},'calleridname':{'type':Sequelize[_0xd80c('0x1')]},'queue':{'type':Sequelize[_0xd80c('0x1')]},'interface':{'type':Sequelize[_0xd80c('0x1')]},'membername':{'type':Sequelize[_0xd80c('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xd80c('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xd80c('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xd80c('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd80c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd80c('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xd80c('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd80c('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd80c('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd80c('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd80c('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd80c('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd80c('0x1')]},'connectedlinename':{'type':Sequelize[_0xd80c('0x1')]},'language':{'type':Sequelize[_0xd80c('0x1')]},'accountcode':{'type':Sequelize[_0xd80c('0x1')]},'context':{'type':Sequelize[_0xd80c('0x1')]},'exten':{'type':Sequelize[_0xd80c('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd80c('0x1')]},'destchannelstate':{'type':Sequelize[_0xd80c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd80c('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd80c('0x1')]},'destcalleridname':{'type':Sequelize[_0xd80c('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd80c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd80c('0x1')]},'destlanguage':{'type':Sequelize[_0xd80c('0x1')]},'destaccountcode':{'type':Sequelize[_0xd80c('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd80c('0x1')]},'destpriority':{'type':Sequelize[_0xd80c('0x1')]},'destuniqueid':{'type':Sequelize[_0xd80c('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd80c('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd80c('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd80c('0x1')],'comment':_0xd80c('0x5')},'transferexten':{'type':Sequelize[_0xd80c('0x1')]},'transferuniqueid':{'type':Sequelize[_0xd80c('0x1')]},'agententerreason':{'type':Sequelize[_0xd80c('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 965bb45..df6eef2 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 1763abf..10efb76 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 _0x0618=['util','api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x332339,_0x3a98e1){var _0x2d78e9=function(_0x574ea5){while(--_0x574ea5){_0x332339['push'](_0x332339['shift']());}};_0x2d78e9(++_0x3a98e1);}(_0x0618,0x1c6));var _0x8061=function(_0x426706,_0x5a7138){_0x426706=_0x426706-0x0;var _0x2288d1=_0x0618[_0x426706];return _0x2288d1;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var logger=require('../../config/logger')(_0x8061('0x2'));var moment=require(_0x8061('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8061('0x4'));var rimraf=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var attributes=require(_0x8061('0x7'));module[_0x8061('0x8')]=function(_0x2c47b6,_0x1cca7f){return _0x2c47b6[_0x8061('0x9')](_0x8061('0xa'),attributes,{'tableName':_0x8061('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8061('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x26d1=['api','moment','bluebird','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','../../config/logger'];(function(_0xe03d21,_0x379378){var _0xe2c0ab=function(_0x147fe0){while(--_0x147fe0){_0xe03d21['push'](_0xe03d21['shift']());}};_0xe2c0ab(++_0x379378);}(_0x26d1,0x8e));var _0x126d=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x26d1[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x126d('0x0'));var util=require('util');var logger=require(_0x126d('0x1'))(_0x126d('0x2'));var moment=require(_0x126d('0x3'));var BPromise=require(_0x126d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x126d('0x5'));var config=require('../../config/environment');var attributes=require(_0x126d('0x6'));module[_0x126d('0x7')]=function(_0x442e04,_0x449ed0){return _0x442e04[_0x126d('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x126d('0x9'),'paranoid':![],'indexes':[{'fields':[_0x126d('0xa'),_0x126d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c7b42fa..57a368a 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 _0xfae3=['options','raw','debug','UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','create','body'];(function(_0x241ca9,_0x4d8a2f){var _0x13d5c5=function(_0x594c95){while(--_0x594c95){_0x241ca9['push'](_0x241ca9['shift']());}};_0x13d5c5(++_0x4d8a2f);}(_0xfae3,0x15d));var _0x3fae=function(_0x10e74e,_0x1603ae){_0x10e74e=_0x10e74e-0x0;var _0x2198c1=_0xfae3[_0x10e74e];return _0x2198c1;};'use strict';var _=require(_0x3fae('0x0'));var util=require(_0x3fae('0x1'));var moment=require(_0x3fae('0x2'));var BPromise=require(_0x3fae('0x3'));var rs=require(_0x3fae('0x4'));var fs=require('fs');var Redis=require(_0x3fae('0x5'));var db=require(_0x3fae('0x6'))['db'];var utils=require(_0x3fae('0x7'));var logger=require(_0x3fae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x345c70,_0x2fa869,_0x2b4fca){return new BPromise(function(_0x555929,_0x37856a){return client[_0x3fae('0x9')](_0x345c70,_0x2b4fca)[_0x3fae('0xa')](function(_0x1d8246){logger[_0x3fae('0xb')](_0x3fae('0xc'),_0x2fa869,_0x3fae('0xd'));logger['debug'](_0x3fae('0xe'),_0x2fa869,'request\x20sent',JSON[_0x3fae('0xf')](_0x1d8246));if(_0x1d8246[_0x3fae('0x10')]){if(_0x1d8246[_0x3fae('0x10')][_0x3fae('0x11')]===0x1f4){logger[_0x3fae('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fa869,_0x1d8246[_0x3fae('0x10')][_0x3fae('0x12')]);return _0x37856a(_0x1d8246[_0x3fae('0x10')]['message']);}logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x2fa869,_0x1d8246['error']['message']);return _0x555929(_0x1d8246[_0x3fae('0x10')]['message']);}else{logger[_0x3fae('0xb')]('VoiceAgentReport,\x20%s,\x20%s',_0x2fa869,_0x3fae('0xd'));_0x555929(_0x1d8246['result'][_0x3fae('0x12')]);}})[_0x3fae('0x13')](function(_0x4ce05f){logger[_0x3fae('0x10')](_0x3fae('0xc'),_0x2fa869,_0x4ce05f);_0x37856a(_0x4ce05f);});});}exports[_0x3fae('0x14')]=function(_0x2d3820){var _0x3b25ed=this;return new Promise(function(_0x5e1c68,_0x5dcb57){return db['VoiceAgentReport'][_0x3fae('0x15')](_0x2d3820[_0x3fae('0x16')],{'raw':_0x2d3820[_0x3fae('0x17')]?_0x2d3820[_0x3fae('0x17')][_0x3fae('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x59b7c5){logger[_0x3fae('0xb')](_0x3fae('0x14'),_0x2d3820);logger[_0x3fae('0x19')]('CreateVoiceAgentReport',_0x2d3820,JSON[_0x3fae('0xf')](_0x59b7c5));_0x5e1c68(_0x59b7c5);})['catch'](function(_0x23caef){logger[_0x3fae('0x10')](_0x3fae('0x14'),_0x23caef[_0x3fae('0x12')],_0x2d3820);_0x5dcb57(_0x3b25ed[_0x3fae('0x10')](0x1f4,_0x23caef['message']));});});};exports[_0x3fae('0x1a')]=function(_0x2114ee){var _0x58ab0e=this;return new Promise(function(_0x1b06f7,_0x535580){return db['VoiceAgentReport'][_0x3fae('0x1b')](_0x2114ee[_0x3fae('0x16')],{'raw':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1c')]||null:null,'attributes':_0x2114ee[_0x3fae('0x17')]?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1d')]||null:null,'limit':_0x2114ee['options']?_0x2114ee[_0x3fae('0x17')][_0x3fae('0x1e')]||null:null})[_0x3fae('0xa')](function(_0x4589d9){logger[_0x3fae('0xb')](_0x3fae('0x1a'),_0x2114ee);logger[_0x3fae('0x19')](_0x3fae('0x1a'),_0x2114ee,JSON[_0x3fae('0xf')](_0x4589d9));_0x1b06f7(_0x4589d9);})[_0x3fae('0x13')](function(_0x1cadd1){logger[_0x3fae('0x10')]('UpdateVoiceAgentReport',_0x1cadd1[_0x3fae('0x12')],_0x2114ee);_0x535580(_0x58ab0e[_0x3fae('0x10')](0x1f4,_0x1cadd1[_0x3fae('0x12')]));});});}; \ No newline at end of file +var _0xcd44=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','attributes','UpdateVoiceAgentReport','util','moment'];(function(_0x173605,_0x47f348){var _0x12f717=function(_0x4bc818){while(--_0x4bc818){_0x173605['push'](_0x173605['shift']());}};_0x12f717(++_0x47f348);}(_0xcd44,0xbe));var _0x4cd4=function(_0x2eff61,_0x16f880){_0x2eff61=_0x2eff61-0x0;var _0x202593=_0xcd44[_0x2eff61];return _0x202593;};'use strict';var _=require('lodash');var util=require(_0x4cd4('0x0'));var moment=require(_0x4cd4('0x1'));var BPromise=require(_0x4cd4('0x2'));var rs=require(_0x4cd4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4cd4('0x4'))['db'];var utils=require(_0x4cd4('0x5'));var logger=require('../../config/logger')(_0x4cd4('0x6'));var config=require(_0x4cd4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4cd4('0x8')][_0x4cd4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x247111,_0x19f8ed,_0x59fb7f){return new BPromise(function(_0x46bd8f,_0x2974a0){return client[_0x4cd4('0xa')](_0x247111,_0x59fb7f)[_0x4cd4('0xb')](function(_0x3ab540){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x19f8ed,_0x4cd4('0xc'));logger[_0x4cd4('0xd')](_0x4cd4('0xe'),_0x19f8ed,_0x4cd4('0xc'),JSON[_0x4cd4('0xf')](_0x3ab540));if(_0x3ab540[_0x4cd4('0x10')]){if(_0x3ab540[_0x4cd4('0x10')][_0x4cd4('0x11')]===0x1f4){logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x19f8ed,_0x3ab540[_0x4cd4('0x10')]['message']);return _0x2974a0(_0x3ab540['error']['message']);}logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x19f8ed,_0x3ab540[_0x4cd4('0x10')][_0x4cd4('0x13')]);return _0x46bd8f(_0x3ab540[_0x4cd4('0x10')][_0x4cd4('0x13')]);}else{logger[_0x4cd4('0x14')](_0x4cd4('0x12'),_0x19f8ed,_0x4cd4('0xc'));_0x46bd8f(_0x3ab540[_0x4cd4('0x15')][_0x4cd4('0x13')]);}})[_0x4cd4('0x16')](function(_0x1fe367){logger[_0x4cd4('0x10')](_0x4cd4('0x12'),_0x19f8ed,_0x1fe367);_0x2974a0(_0x1fe367);});});}exports[_0x4cd4('0x17')]=function(_0x2c6d4f){var _0x44b042=this;return new Promise(function(_0x43f1b6,_0x287211){return db[_0x4cd4('0x18')][_0x4cd4('0x19')](_0x2c6d4f[_0x4cd4('0x1a')],{'raw':_0x2c6d4f[_0x4cd4('0x1b')]?_0x2c6d4f[_0x4cd4('0x1b')][_0x4cd4('0x1c')]===undefined?!![]:![]:!![]})[_0x4cd4('0xb')](function(_0x1d00e1){logger[_0x4cd4('0x14')](_0x4cd4('0x17'),_0x2c6d4f);logger[_0x4cd4('0xd')](_0x4cd4('0x17'),_0x2c6d4f,JSON[_0x4cd4('0xf')](_0x1d00e1));_0x43f1b6(_0x1d00e1);})[_0x4cd4('0x16')](function(_0x7fd446){logger[_0x4cd4('0x10')](_0x4cd4('0x17'),_0x7fd446[_0x4cd4('0x13')],_0x2c6d4f);_0x287211(_0x44b042[_0x4cd4('0x10')](0x1f4,_0x7fd446[_0x4cd4('0x13')]));});});};exports['UpdateVoiceAgentReport']=function(_0x423439){var _0x32edee=this;return new Promise(function(_0x2f9ffe,_0x5d32d9){return db[_0x4cd4('0x18')][_0x4cd4('0x1d')](_0x423439[_0x4cd4('0x1a')],{'raw':_0x423439[_0x4cd4('0x1b')]?_0x423439[_0x4cd4('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x423439['options']?_0x423439['options']['where']||null:null,'attributes':_0x423439[_0x4cd4('0x1b')]?_0x423439[_0x4cd4('0x1b')][_0x4cd4('0x1e')]||null:null,'limit':_0x423439['options']?_0x423439[_0x4cd4('0x1b')]['limit']||null:null})['then'](function(_0x909391){logger[_0x4cd4('0x14')](_0x4cd4('0x1f'),_0x423439);logger[_0x4cd4('0xd')]('UpdateVoiceAgentReport',_0x423439,JSON[_0x4cd4('0xf')](_0x909391));_0x2f9ffe(_0x909391);})[_0x4cd4('0x16')](function(_0x46c9c5){logger['error'](_0x4cd4('0x1f'),_0x46c9c5[_0x4cd4('0x13')],_0x423439);_0x5d32d9(_0x32edee[_0x4cd4('0x10')](0x1f4,_0x46c9c5[_0x4cd4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 242082f..9a4b0a6 100644 --- a/server/api/voiceCallReport/index.js +++ b/server/api/voiceCallReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['/:id','show','post','create','put','update','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe'];(function(_0x534d06,_0x37270b){var _0x11c86a=function(_0xc9c6ff){while(--_0xc9c6ff){_0x534d06['push'](_0x534d06['shift']());}};_0x11c86a(++_0x37270b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x5fc3[_0x695b76];return _0x1dc21f;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xee14=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','path'];(function(_0x2dcd21,_0x1df1b5){var _0x43b3fd=function(_0x39dde0){while(--_0x39dde0){_0x2dcd21['push'](_0x2dcd21['shift']());}};_0x43b3fd(++_0x1df1b5);}(_0xee14,0x13a));var _0x4ee1=function(_0x4bfa0a,_0x52b603){_0x4bfa0a=_0x4bfa0a-0x0;var _0x2758e5=_0xee14[_0x4bfa0a];return _0x2758e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get']('/',auth[_0x4ee1('0x9')](),controller['index']);router[_0x4ee1('0xa')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xa')](_0x4ee1('0xd'),auth['isAuthenticated'](),controller[_0x4ee1('0xe')]);router[_0x4ee1('0xf')]('/',auth['isAuthenticated'](),controller[_0x4ee1('0x10')]);router[_0x4ee1('0x11')](_0x4ee1('0xd'),auth[_0x4ee1('0x9')](),controller['update']);router[_0x4ee1('0x12')](_0x4ee1('0xd'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0x13')]);module[_0x4ee1('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 e499b52..7cd6200 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 _0xe820=['TEXT','DATE','INTEGER','sequelize','STRING','internal','outbound','inbound-fax','dialer'];(function(_0x1c3f09,_0x342d1c){var _0x3ebaad=function(_0x54df20){while(--_0x54df20){_0x1c3f09['push'](_0x1c3f09['shift']());}};_0x3ebaad(++_0x342d1c);}(_0xe820,0xd2));var _0x0e82=function(_0x3dc7e4,_0x22bfac){_0x3dc7e4=_0x3dc7e4-0x0;var _0x57329e=_0xe820[_0x3dc7e4];return _0x57329e;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0e82('0x1')]},'type':{'type':Sequelize['ENUM']('inbound',_0x0e82('0x2'),_0x0e82('0x3'),_0x0e82('0x4'),'outbound-fax',_0x0e82('0x5'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0e82('0x1')]},'source':{'type':Sequelize[_0x0e82('0x1')]},'destination':{'type':Sequelize[_0x0e82('0x1')]},'destinationcontext':{'type':Sequelize[_0x0e82('0x1')]},'callerid':{'type':Sequelize[_0x0e82('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x0e82('0x1')]},'lastapplication':{'type':Sequelize[_0x0e82('0x1')]},'lastdata':{'type':Sequelize[_0x0e82('0x6')]},'starttime':{'type':Sequelize[_0x0e82('0x7')]},'systemanswertime':{'type':Sequelize[_0x0e82('0x7')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x0e82('0x7')]},'duration':{'type':Sequelize[_0x0e82('0x8')]},'billableseconds':{'type':Sequelize[_0x0e82('0x8')]},'mohtime':{'type':Sequelize[_0x0e82('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0e82('0x1')]},'amaflags':{'type':Sequelize[_0x0e82('0x1')]},'userfield':{'type':Sequelize[_0x0e82('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0e82('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x0e82('0x1')]},'note':{'type':Sequelize[_0x0e82('0x1')]},'prefix':{'type':Sequelize[_0x0e82('0x1')]},'routeid':{'type':Sequelize[_0x0e82('0x8')]},'sipcallid':{'type':Sequelize[_0x0e82('0x1')]}}; \ No newline at end of file +var _0xf79b=['inbound','internal','outbound','outbound-fax','dialer','DATE','INTEGER','exports','STRING'];(function(_0x35dbc8,_0x22d487){var _0x3cee22=function(_0x4b6583){while(--_0x4b6583){_0x35dbc8['push'](_0x35dbc8['shift']());}};_0x3cee22(++_0x22d487);}(_0xf79b,0xa0));var _0xbf79=function(_0x5ac604,_0x5d3cac){_0x5ac604=_0x5ac604-0x0;var _0x592aa6=_0xf79b[_0x5ac604];return _0x592aa6;};'use strict';var Sequelize=require('sequelize');module[_0xbf79('0x0')]={'uniqueid':{'type':Sequelize[_0xbf79('0x1')]},'type':{'type':Sequelize['ENUM'](_0xbf79('0x2'),_0xbf79('0x3'),_0xbf79('0x4'),'inbound-fax',_0xbf79('0x5'),_0xbf79('0x6'))},'tag':{'type':Sequelize[_0xbf79('0x1')]},'accountcode':{'type':Sequelize[_0xbf79('0x1')]},'source':{'type':Sequelize[_0xbf79('0x1')]},'destination':{'type':Sequelize[_0xbf79('0x1')]},'destinationcontext':{'type':Sequelize[_0xbf79('0x1')]},'callerid':{'type':Sequelize[_0xbf79('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0xbf79('0x1')]},'lastapplication':{'type':Sequelize[_0xbf79('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xbf79('0x7')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xbf79('0x7')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0xbf79('0x8')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xbf79('0x1')]},'amaflags':{'type':Sequelize[_0xbf79('0x1')]},'userfield':{'type':Sequelize[_0xbf79('0x1')]},'userDisposition':{'type':Sequelize[_0xbf79('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xbf79('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xbf79('0x1')]},'note':{'type':Sequelize[_0xbf79('0x1')]},'prefix':{'type':Sequelize[_0xbf79('0x1')]},'routeid':{'type':Sequelize[_0xbf79('0x8')]},'sipcallid':{'type':Sequelize[_0xbf79('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 73fbb13..504892a 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x53c679,_0xd36565){var _0x50e85d=function(_0x2ecbab){while(--_0x2ecbab){_0x53c679['push'](_0x53c679['shift']());}};_0x50e85d(++_0xd36565);}(_0x0b0e,0x187));var _0xe0b0=function(_0x56355a,_0x138baf){_0x56355a=_0x56355a-0x0;var _0x573afa=_0x0b0e[_0x56355a];return _0x573afa;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x510637,_0x513e0f){var _0xed3ee3=function(_0x273c27){while(--_0x273c27){_0x510637['push'](_0x510637['shift']());}};_0xed3ee3(++_0x513e0f);}(_0xdb28,0x106));var _0x8db2=function(_0x5c962d,_0x4af158){_0x5c962d=_0x5c962d-0x0;var _0x44b466=_0xdb28[_0x5c962d];return _0x44b466;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6206d77..854ae5d 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 _0x51a1=['request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x53fb01,_0x5c6f99){var _0x4d9126=function(_0x256f88){while(--_0x256f88){_0x53fb01['push'](_0x53fb01['shift']());}};_0x4d9126(++_0x5c6f99);}(_0x51a1,0x1b7));var _0x151a=function(_0x5c3afe,_0x50a0e0){_0x5c3afe=_0x5c3afe-0x0;var _0x222563=_0x51a1[_0x5c3afe];return _0x222563;};'use strict';var _=require(_0x151a('0x0'));var util=require(_0x151a('0x1'));var logger=require('../../config/logger')(_0x151a('0x2'));var moment=require(_0x151a('0x3'));var BPromise=require(_0x151a('0x4'));var rp=require(_0x151a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x151a('0x6'));var config=require(_0x151a('0x7'));var attributes=require(_0x151a('0x8'));module['exports']=function(_0x2d8fba,_0x5cf0e7){return _0x2d8fba['define'](_0x151a('0x9'),attributes,{'tableName':_0x151a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x151a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc9b7=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x4e2e87,_0xf43485){var _0x1916b9=function(_0x54bd25){while(--_0x54bd25){_0x4e2e87['push'](_0x4e2e87['shift']());}};_0x1916b9(++_0xf43485);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x27ed41,_0xb780a1){_0x27ed41=_0x27ed41-0x0;var _0x507934=_0xc9b7[_0x27ed41];return _0x507934;};'use strict';var _=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var logger=require(_0x7c9b('0x2'))(_0x7c9b('0x3'));var moment=require('moment');var BPromise=require(_0x7c9b('0x4'));var rp=require(_0x7c9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c9b('0x6'));var config=require(_0x7c9b('0x7'));var attributes=require(_0x7c9b('0x8'));module[_0x7c9b('0x9')]=function(_0x3d19d7,_0x4714e0){return _0x3d19d7[_0x7c9b('0xa')](_0x7c9b('0xb'),attributes,{'tableName':_0x7c9b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7c9b('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 e3acb9d..36f657e 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 _0x0354=['request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','map','model','include','catch','CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x21df35,_0x47c3f7){var _0x4b5524=function(_0x4470d){while(--_0x4470d){_0x21df35['push'](_0x21df35['shift']());}};_0x4b5524(++_0x47c3f7);}(_0x0354,0x196));var _0x4035=function(_0x1d8cf8,_0x4e1e5b){_0x1d8cf8=_0x1d8cf8-0x0;var _0x22f848=_0x0354[_0x1d8cf8];return _0x22f848;};'use strict';var _=require(_0x4035('0x0'));var util=require(_0x4035('0x1'));var moment=require(_0x4035('0x2'));var BPromise=require(_0x4035('0x3'));var rs=require(_0x4035('0x4'));var fs=require('fs');var Redis=require(_0x4035('0x5'));var db=require(_0x4035('0x6'))['db'];var utils=require(_0x4035('0x7'));var logger=require(_0x4035('0x8'))(_0x4035('0x9'));var config=require(_0x4035('0xa'));var jayson=require(_0x4035('0xb'));var client=jayson[_0x4035('0xc')][_0x4035('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x28c9e0,_0x1f6363,_0x14a971){return new BPromise(function(_0x4fbedb,_0x54a7bf){return client[_0x4035('0xe')](_0x28c9e0,_0x14a971)['then'](function(_0x61538a){logger[_0x4035('0xf')](_0x4035('0x10'),_0x1f6363,_0x4035('0x11'));logger[_0x4035('0x12')](_0x4035('0x13'),_0x1f6363,_0x4035('0x11'),JSON[_0x4035('0x14')](_0x61538a));if(_0x61538a[_0x4035('0x15')]){if(_0x61538a[_0x4035('0x15')]['code']===0x1f4){logger[_0x4035('0x15')]('VoiceCallReport,\x20%s,\x20%s',_0x1f6363,_0x61538a[_0x4035('0x15')][_0x4035('0x16')]);return _0x54a7bf(_0x61538a[_0x4035('0x15')][_0x4035('0x16')]);}logger[_0x4035('0x15')](_0x4035('0x10'),_0x1f6363,_0x61538a[_0x4035('0x15')]['message']);return _0x4fbedb(_0x61538a[_0x4035('0x15')]['message']);}else{logger[_0x4035('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1f6363,_0x4035('0x11'));_0x4fbedb(_0x61538a[_0x4035('0x17')][_0x4035('0x16')]);}})['catch'](function(_0x335ffe){logger[_0x4035('0x15')](_0x4035('0x10'),_0x1f6363,_0x335ffe);_0x54a7bf(_0x335ffe);});});}exports[_0x4035('0x18')]=function(_0x4c9683){var _0x2a84c2=this;return new Promise(function(_0x230043,_0x187b91){return db[_0x4035('0x19')][_0x4035('0x1a')]({'raw':_0x4c9683[_0x4035('0x1b')]?_0x4c9683['options'][_0x4035('0x1c')]===undefined?!![]:![]:!![],'where':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1d')]||null:null,'attributes':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1e')]||null:null,'limit':_0x4c9683[_0x4035('0x1b')]?_0x4c9683[_0x4035('0x1b')][_0x4035('0x1f')]||null:null,'include':_0x4c9683[_0x4035('0x1b')]?_0x4c9683['options']['include']?_[_0x4035('0x20')](_0x4c9683[_0x4035('0x1b')]['include'],function(_0x5aa45e){return{'model':db[_0x5aa45e[_0x4035('0x21')]],'as':_0x5aa45e['as'],'attributes':_0x5aa45e[_0x4035('0x1e')],'include':_0x5aa45e[_0x4035('0x22')]?_['map'](_0x5aa45e[_0x4035('0x22')],function(_0x2fb9b9){return{'model':db[_0x2fb9b9[_0x4035('0x21')]],'as':_0x2fb9b9['as'],'attributes':_0x2fb9b9[_0x4035('0x1e')],'include':_0x2fb9b9[_0x4035('0x22')]?_[_0x4035('0x20')](_0x2fb9b9[_0x4035('0x22')],function(_0x338731){return{'model':db[_0x338731['model']],'as':_0x338731['as'],'attributes':_0x338731[_0x4035('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b590c){logger['info']('GetVoiceCallReport',_0x4c9683);logger[_0x4035('0x12')](_0x4035('0x18'),_0x4c9683,JSON[_0x4035('0x14')](_0x5b590c));_0x230043(_0x5b590c);})[_0x4035('0x23')](function(_0x391fa0){logger['error'](_0x4035('0x18'),_0x391fa0[_0x4035('0x16')],_0x4c9683);_0x187b91(_0x2a84c2[_0x4035('0x15')](0x1f4,_0x391fa0['message']));});});};exports[_0x4035('0x24')]=function(_0x489bcf){var _0x2499b7=this;return new Promise(function(_0x452ec3,_0x5456ac){return db[_0x4035('0x19')][_0x4035('0x25')](_0x489bcf[_0x4035('0x26')],{'raw':_0x489bcf[_0x4035('0x1b')]?_0x489bcf[_0x4035('0x1b')][_0x4035('0x1c')]===undefined?!![]:![]:!![]})[_0x4035('0x27')](function(_0x4c0541){logger[_0x4035('0xf')](_0x4035('0x24'),_0x489bcf);logger[_0x4035('0x12')](_0x4035('0x24'),_0x489bcf,JSON[_0x4035('0x14')](_0x4c0541));_0x452ec3(_0x4c0541);})[_0x4035('0x23')](function(_0x237deb){logger[_0x4035('0x15')](_0x4035('0x24'),_0x237deb['message'],_0x489bcf);_0x5456ac(_0x2499b7[_0x4035('0x15')](0x1f4,_0x237deb['message']));});});};exports[_0x4035('0x28')]=function(_0x43bb8b){var _0x22ec92=this;return new Promise(function(_0xd9a4b5,_0x2ea44c){return db['VoiceCallReport'][_0x4035('0x29')](_0x43bb8b[_0x4035('0x26')],{'raw':_0x43bb8b['options']?_0x43bb8b[_0x4035('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43bb8b[_0x4035('0x1b')]?_0x43bb8b['options'][_0x4035('0x1d')]||null:null,'attributes':_0x43bb8b['options']?_0x43bb8b['options'][_0x4035('0x1e')]||null:null,'limit':_0x43bb8b[_0x4035('0x1b')]?_0x43bb8b[_0x4035('0x1b')]['limit']||null:null})['then'](function(_0x549743){logger[_0x4035('0xf')](_0x4035('0x28'),_0x43bb8b);logger[_0x4035('0x12')](_0x4035('0x28'),_0x43bb8b,JSON[_0x4035('0x14')](_0x549743));_0xd9a4b5(_0x549743);})[_0x4035('0x23')](function(_0x125c42){logger[_0x4035('0x15')]('UpdateVoiceCallReport',_0x125c42[_0x4035('0x16')],_0x43bb8b);_0x2ea44c(_0x22ec92[_0x4035('0x15')](0x1f4,_0x125c42[_0x4035('0x16')]));});});}; \ No newline at end of file +var _0x0df4=['body','VoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create'];(function(_0x55cec5,_0x2258b4){var _0x545c82=function(_0x516fa2){while(--_0x516fa2){_0x55cec5['push'](_0x55cec5['shift']());}};_0x545c82(++_0x2258b4);}(_0x0df4,0xee));var _0x40df=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0df4[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x40df('0x0'));var util=require(_0x40df('0x1'));var moment=require(_0x40df('0x2'));var BPromise=require(_0x40df('0x3'));var rs=require(_0x40df('0x4'));var fs=require('fs');var Redis=require(_0x40df('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x40df('0x6'));var logger=require('../../config/logger')(_0x40df('0x7'));var config=require(_0x40df('0x8'));var jayson=require(_0x40df('0x9'));var client=jayson[_0x40df('0xa')][_0x40df('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x178689,_0x4ca94d,_0x57e06d){return new BPromise(function(_0x1cebc3,_0x4c07fb){return client[_0x40df('0xc')](_0x178689,_0x57e06d)[_0x40df('0xd')](function(_0x5f2a36){logger[_0x40df('0xe')](_0x40df('0xf'),_0x4ca94d,_0x40df('0x10'));logger[_0x40df('0x11')](_0x40df('0x12'),_0x4ca94d,_0x40df('0x10'),JSON[_0x40df('0x13')](_0x5f2a36));if(_0x5f2a36[_0x40df('0x14')]){if(_0x5f2a36[_0x40df('0x14')][_0x40df('0x15')]===0x1f4){logger['error'](_0x40df('0xf'),_0x4ca94d,_0x5f2a36['error'][_0x40df('0x16')]);return _0x4c07fb(_0x5f2a36[_0x40df('0x14')][_0x40df('0x16')]);}logger['error'](_0x40df('0xf'),_0x4ca94d,_0x5f2a36['error'][_0x40df('0x16')]);return _0x1cebc3(_0x5f2a36[_0x40df('0x14')][_0x40df('0x16')]);}else{logger[_0x40df('0xe')](_0x40df('0xf'),_0x4ca94d,_0x40df('0x10'));_0x1cebc3(_0x5f2a36['result']['message']);}})[_0x40df('0x17')](function(_0x5af471){logger[_0x40df('0x14')](_0x40df('0xf'),_0x4ca94d,_0x5af471);_0x4c07fb(_0x5af471);});});}exports[_0x40df('0x18')]=function(_0x476ff0){var _0x5a94af=this;return new Promise(function(_0x339bbc,_0x3e1f92){return db['VoiceCallReport']['findAll']({'raw':_0x476ff0[_0x40df('0x19')]?_0x476ff0['options'][_0x40df('0x1a')]===undefined?!![]:![]:!![],'where':_0x476ff0[_0x40df('0x19')]?_0x476ff0['options'][_0x40df('0x1b')]||null:null,'attributes':_0x476ff0[_0x40df('0x19')]?_0x476ff0[_0x40df('0x19')][_0x40df('0x1c')]||null:null,'limit':_0x476ff0[_0x40df('0x19')]?_0x476ff0['options'][_0x40df('0x1d')]||null:null,'include':_0x476ff0['options']?_0x476ff0[_0x40df('0x19')][_0x40df('0x1e')]?_[_0x40df('0x1f')](_0x476ff0[_0x40df('0x19')]['include'],function(_0x450818){return{'model':db[_0x450818[_0x40df('0x20')]],'as':_0x450818['as'],'attributes':_0x450818['attributes'],'include':_0x450818[_0x40df('0x1e')]?_[_0x40df('0x1f')](_0x450818[_0x40df('0x1e')],function(_0x226a20){return{'model':db[_0x226a20[_0x40df('0x20')]],'as':_0x226a20['as'],'attributes':_0x226a20['attributes'],'include':_0x226a20[_0x40df('0x1e')]?_[_0x40df('0x1f')](_0x226a20['include'],function(_0x2438fe){return{'model':db[_0x2438fe[_0x40df('0x20')]],'as':_0x2438fe['as'],'attributes':_0x2438fe[_0x40df('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x40df('0xd')](function(_0x137b98){logger['info'](_0x40df('0x18'),_0x476ff0);logger[_0x40df('0x11')](_0x40df('0x18'),_0x476ff0,JSON[_0x40df('0x13')](_0x137b98));_0x339bbc(_0x137b98);})[_0x40df('0x17')](function(_0xe2f77a){logger[_0x40df('0x14')](_0x40df('0x18'),_0xe2f77a[_0x40df('0x16')],_0x476ff0);_0x3e1f92(_0x5a94af['error'](0x1f4,_0xe2f77a[_0x40df('0x16')]));});});};exports[_0x40df('0x21')]=function(_0x443e67){var _0x56a03d=this;return new Promise(function(_0xd84b9c,_0x3cedfc){return db['VoiceCallReport'][_0x40df('0x22')](_0x443e67[_0x40df('0x23')],{'raw':_0x443e67['options']?_0x443e67[_0x40df('0x19')][_0x40df('0x1a')]===undefined?!![]:![]:!![]})[_0x40df('0xd')](function(_0x1a0418){logger[_0x40df('0xe')](_0x40df('0x21'),_0x443e67);logger[_0x40df('0x11')](_0x40df('0x21'),_0x443e67,JSON[_0x40df('0x13')](_0x1a0418));_0xd84b9c(_0x1a0418);})[_0x40df('0x17')](function(_0x543df8){logger[_0x40df('0x14')](_0x40df('0x21'),_0x543df8[_0x40df('0x16')],_0x443e67);_0x3cedfc(_0x56a03d[_0x40df('0x14')](0x1f4,_0x543df8[_0x40df('0x16')]));});});};exports['UpdateVoiceCallReport']=function(_0x529a7d){var _0x3dcbe0=this;return new Promise(function(_0xf99f13,_0x26b781){return db[_0x40df('0x24')][_0x40df('0x25')](_0x529a7d[_0x40df('0x23')],{'raw':_0x529a7d[_0x40df('0x19')]?_0x529a7d[_0x40df('0x19')][_0x40df('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529a7d[_0x40df('0x19')]?_0x529a7d['options']['where']||null:null,'attributes':_0x529a7d[_0x40df('0x19')]?_0x529a7d[_0x40df('0x19')][_0x40df('0x1c')]||null:null,'limit':_0x529a7d['options']?_0x529a7d[_0x40df('0x19')][_0x40df('0x1d')]||null:null})['then'](function(_0x50fa45){logger['info']('UpdateVoiceCallReport',_0x529a7d);logger[_0x40df('0x11')](_0x40df('0x26'),_0x529a7d,JSON['stringify'](_0x50fa45));_0xf99f13(_0x50fa45);})[_0x40df('0x17')](function(_0x565287){logger[_0x40df('0x14')](_0x40df('0x26'),_0x565287[_0x40df('0x16')],_0x529a7d);_0x26b781(_0x3dcbe0['error'](0x1f4,_0x565287[_0x40df('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 3303301..277f0aa 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 _0xa574=['index','/:id','create','put','update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated'];(function(_0x1f5b22,_0x576d92){var _0x47bc6e=function(_0x238b0e){while(--_0x238b0e){_0x1f5b22['push'](_0x1f5b22['shift']());}};_0x47bc6e(++_0x576d92);}(_0xa574,0x6d));var _0x4a57=function(_0x1b334a,_0x3d4c05){_0x1b334a=_0x1b334a-0x0;var _0xc1b3cc=_0xa574[_0x1b334a];return _0xc1b3cc;};'use strict';var multer=require(_0x4a57('0x0'));var util=require(_0x4a57('0x1'));var path=require(_0x4a57('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a57('0x3'));var router=express[_0x4a57('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a57('0x5'));var interaction=require(_0x4a57('0x6'));var config=require(_0x4a57('0x7'));var controller=require(_0x4a57('0x8'));router['get']('/',auth[_0x4a57('0x9')](),controller[_0x4a57('0xa')]);router['get'](_0x4a57('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4a57('0xc')]);router[_0x4a57('0xd')](_0x4a57('0xb'),auth['isAuthenticated'](),controller[_0x4a57('0xe')]);router['delete'](_0x4a57('0xb'),auth['isAuthenticated'](),controller[_0x4a57('0xf')]);module[_0x4a57('0x10')]=router; \ No newline at end of file +var _0x0d34=['Router','../../components/auth/service','./voiceChanSpy.controller','index','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x27d2fc,_0x1b484c){var _0x23eb07=function(_0x269f2e){while(--_0x269f2e){_0x27d2fc['push'](_0x27d2fc['shift']());}};_0x23eb07(++_0x1b484c);}(_0x0d34,0x109));var _0x40d3=function(_0x216b17,_0x10a718){_0x216b17=_0x216b17-0x0;var _0x2e33c6=_0x0d34[_0x216b17];return _0x2e33c6;};'use strict';var multer=require(_0x40d3('0x0'));var util=require(_0x40d3('0x1'));var path=require(_0x40d3('0x2'));var timeout=require(_0x40d3('0x3'));var express=require(_0x40d3('0x4'));var router=express[_0x40d3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x40d3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x40d3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x40d3('0x8')]);router[_0x40d3('0x9')](_0x40d3('0xa'),auth[_0x40d3('0xb')](),controller['show']);router[_0x40d3('0xc')]('/',auth[_0x40d3('0xb')](),controller['create']);router[_0x40d3('0xd')](_0x40d3('0xa'),auth[_0x40d3('0xb')](),controller[_0x40d3('0xe')]);router[_0x40d3('0xf')](_0x40d3('0xa'),auth[_0x40d3('0xb')](),controller[_0x40d3('0x10')]);module[_0x40d3('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index cbb6b33..9ccbafd 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 _0x2902=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x5c98ea,_0xa782aa){var _0x51e853=function(_0x57d5b0){while(--_0x57d5b0){_0x5c98ea['push'](_0x5c98ea['shift']());}};_0x51e853(++_0xa782aa);}(_0x2902,0x122));var _0x2290=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0x2902[_0x1a0ef3];return _0x2b86da;};'use strict';var Sequelize=require('sequelize');module[_0x2290('0x0')]={'name':{'type':Sequelize[_0x2290('0x1')]},'prefix':{'type':Sequelize[_0x2290('0x1')],'unique':_0x2290('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x2290('0x1')],'set':function(_0x25e66a){this[_0x2290('0x3')](_0x2290('0x4'),_0x25e66a?_0x25e66a[_0x2290('0x5')](''):[]);},'get':function(){return this[_0x2290('0x6')](_0x2290('0x4'))?this[_0x2290('0x6')](_0x2290('0x4'))[_0x2290('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x2290('0x1')]},'record':{'type':Sequelize[_0x2290('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x2290('0x1')]},'description':{'type':Sequelize[_0x2290('0x1')]}}; \ No newline at end of file +var _0x0a3e=['getDataValue','split','BOOLEAN','STRING','name','setDataValue','options'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x0a3e,0x88));var _0xe0a3=function(_0x3447a3,_0x3ab5a5){_0x3447a3=_0x3447a3-0x0;var _0x3e667f=_0x0a3e[_0x3447a3];return _0x3e667f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe0a3('0x0')]},'prefix':{'type':Sequelize[_0xe0a3('0x0')],'unique':_0xe0a3('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x5f1ac0){this[_0xe0a3('0x2')](_0xe0a3('0x3'),_0x5f1ac0?_0x5f1ac0['join'](''):[]);},'get':function(){return this[_0xe0a3('0x4')](_0xe0a3('0x3'))?this[_0xe0a3('0x4')](_0xe0a3('0x3'))[_0xe0a3('0x5')](''):[];}},'auth':{'type':Sequelize[_0xe0a3('0x6')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xe0a3('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xe0a3('0x0')]},'description':{'type':Sequelize[_0xe0a3('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 4b770c1..f919593 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 _0xf0cc=['rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','eml-format','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','update','then','get','ChanSpies','error','send','index','map','rawAttributes','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xf0cc,0xa7));var _0xcf0c=function(_0xd8310b,_0x4713e2){_0xd8310b=_0xd8310b-0x0;var _0x149acf=_0xf0cc[_0xd8310b];return _0x149acf;};'use strict';var emlformat=require(_0xcf0c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcf0c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf0c('0x2'));var Mustache=require(_0xcf0c('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcf0c('0x4'));var csv=require(_0xcf0c('0x5'));var ejs=require(_0xcf0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcf0c('0x7'));var squel=require(_0xcf0c('0x8'));var crypto=require(_0xcf0c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcf0c('0x5'));var querystring=require('querystring');var Papa=require(_0xcf0c('0xa'));var Redis=require('ioredis');var authService=require(_0xcf0c('0xb'));var qs=require(_0xcf0c('0xc'));var as=require(_0xcf0c('0xd'));var hardwareService=require(_0xcf0c('0xe'));var logger=require(_0xcf0c('0xf'))(_0xcf0c('0x10'));var utils=require(_0xcf0c('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xcf0c('0x12'));var db=require(_0xcf0c('0x13'))['db'];function respondWithStatusCode(_0x6dde21,_0x34f74f){_0x34f74f=_0x34f74f||0xcc;return function(_0x327f65){if(_0x327f65){return _0x6dde21['sendStatus'](_0x34f74f);}return _0x6dde21[_0xcf0c('0x14')](_0x34f74f)[_0xcf0c('0x15')]();};}function respondWithResult(_0x26fc43,_0x4fd482){_0x4fd482=_0x4fd482||0xc8;return function(_0x52038a){if(_0x52038a){return _0x26fc43[_0xcf0c('0x14')](_0x4fd482)['json'](_0x52038a);}};}function respondWithFilteredResult(_0x1f7a47,_0x8ed57d){return function(_0x5362ef){if(_0x5362ef){var _0x58f9ab=typeof _0x8ed57d['offset']===_0xcf0c('0x16')&&typeof _0x8ed57d['limit']===_0xcf0c('0x16');var _0xee0e66=_0x5362ef['count'];var _0x48766e=_0x58f9ab?0x0:_0x8ed57d[_0xcf0c('0x17')];var _0x3c43e5=_0x58f9ab?_0x5362ef[_0xcf0c('0x18')]:_0x8ed57d['offset']+_0x8ed57d[_0xcf0c('0x19')];var _0x134ecb;if(_0x3c43e5>=_0xee0e66){_0x3c43e5=_0xee0e66;_0x134ecb=0xc8;}else{_0x134ecb=0xce;}_0x1f7a47[_0xcf0c('0x14')](_0x134ecb);return _0x1f7a47[_0xcf0c('0x1a')](_0xcf0c('0x1b'),_0x48766e+'-'+_0x3c43e5+'/'+_0xee0e66)[_0xcf0c('0x1c')](_0x5362ef);}return null;};}function patchUpdates(_0x29bb2b){return function(_0xcfb5bd){try{jsonpatch['apply'](_0xcfb5bd,_0x29bb2b,!![]);}catch(_0x203da7){return BPromise[_0xcf0c('0x1d')](_0x203da7);}return _0xcfb5bd['save']();};}function saveUpdates(_0x4832d2,_0x39b1ed){return function(_0x20b8f3){if(_0x20b8f3){return _0x20b8f3[_0xcf0c('0x1e')](_0x4832d2)[_0xcf0c('0x1f')](function(_0x1ceea0){return _0x1ceea0;});}return null;};}function removeEntity(_0x8c4978,_0xbdf266){return function(_0x33628d){if(_0x33628d){return _0x33628d['destroy']()[_0xcf0c('0x1f')](function(){var _0x5466f4=_0x33628d[_0xcf0c('0x20')]({'plain':!![]});var _0x39f5e0=_0xcf0c('0x21');return db['UserProfileResource']['destroy']({'where':{'type':_0x39f5e0,'resourceId':_0x5466f4['id']}})[_0xcf0c('0x1f')](function(){return _0x33628d;});})[_0xcf0c('0x1f')](function(){_0x8c4978[_0xcf0c('0x14')](0xcc)[_0xcf0c('0x15')]();});}};}function handleEntityNotFound(_0x9b0174,_0x36c637){return function(_0x3b38d9){if(!_0x3b38d9){_0x9b0174['sendStatus'](0x194);}return _0x3b38d9;};}function handleError(_0x1d9501,_0x1ce8d4){_0x1ce8d4=_0x1ce8d4||0x1f4;return function(_0x2bd2e3){logger[_0xcf0c('0x22')](_0x2bd2e3['stack']);if(_0x2bd2e3['name']){delete _0x2bd2e3['name'];}_0x1d9501['status'](_0x1ce8d4)[_0xcf0c('0x23')](_0x2bd2e3);};}exports[_0xcf0c('0x24')]=function(_0x3bdfd0,_0x34db17){var _0x3da4df={},_0x3fa73f={},_0x358e43={'count':0x0,'rows':[]};var _0x249d54=_[_0xcf0c('0x25')](db['VoiceChanSpy'][_0xcf0c('0x26')],function(_0x4f5ee2){return{'name':_0x4f5ee2[_0xcf0c('0x27')],'type':_0x4f5ee2[_0xcf0c('0x28')][_0xcf0c('0x29')]};});_0x3fa73f['model']=_['map'](_0x249d54,_0xcf0c('0x2a'));_0x3fa73f['query']=_[_0xcf0c('0x2b')](_0x3bdfd0[_0xcf0c('0x2c')]);_0x3fa73f[_0xcf0c('0x2d')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],_0x3fa73f['query']);_0x3da4df[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x3fa73f[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x3bdfd0['query'][_0xcf0c('0x31')]));_0x3da4df[_0xcf0c('0x30')]=_0x3da4df[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x3da4df['attributes']:_0x3fa73f[_0xcf0c('0x2f')];if(!_0x3bdfd0[_0xcf0c('0x2c')]['hasOwnProperty'](_0xcf0c('0x33'))){_0x3da4df[_0xcf0c('0x19')]=qs[_0xcf0c('0x19')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x19')]);_0x3da4df[_0xcf0c('0x17')]=qs[_0xcf0c('0x17')](_0x3bdfd0['query'][_0xcf0c('0x17')]);}_0x3da4df['order']=qs[_0xcf0c('0x34')](_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x34')]);_0x3da4df[_0xcf0c('0x35')]=qs[_0xcf0c('0x2d')](_['pick'](_0x3bdfd0['query'],_0x3fa73f[_0xcf0c('0x2d')]),_0x249d54);if(_0x3bdfd0['query'][_0xcf0c('0x36')]){_0x3da4df[_0xcf0c('0x35')]=_[_0xcf0c('0x37')](_0x3da4df[_0xcf0c('0x35')],{'$or':_[_0xcf0c('0x25')](_0x249d54,function(_0x532b2a){if(_0x532b2a[_0xcf0c('0x28')]!==_0xcf0c('0x38')){var _0xc1d73e={};_0xc1d73e[_0x532b2a[_0xcf0c('0x2a')]]={'$like':'%'+_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x36')]+'%'};return _0xc1d73e;}})});}_0x3da4df=_[_0xcf0c('0x37')]({},_0x3da4df,_0x3bdfd0[_0xcf0c('0x39')]);var _0x12b43f={'where':_0x3da4df[_0xcf0c('0x35')]};return db[_0xcf0c('0x3a')]['count'](_0x12b43f)['then'](function(_0xf39dea){_0x358e43[_0xcf0c('0x18')]=_0xf39dea;if(_0x3bdfd0[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x3da4df[_0xcf0c('0x3c')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x3da4df);})[_0xcf0c('0x1f')](function(_0x24f4bd){_0x358e43[_0xcf0c('0x3d')]=_0x24f4bd;return _0x358e43;})['then'](respondWithFilteredResult(_0x34db17,_0x3da4df))[_0xcf0c('0x3e')](handleError(_0x34db17,null));};exports[_0xcf0c('0x3f')]=function(_0x2c8fa2,_0x1e688e){var _0x53af37={'raw':![],'where':{'id':_0x2c8fa2['params']['id']}},_0x681778={};_0x681778[_0xcf0c('0x2f')]=_['keys'](db[_0xcf0c('0x3a')]['rawAttributes']);_0x681778[_0xcf0c('0x2c')]=_[_0xcf0c('0x2b')](_0x2c8fa2['query']);_0x681778['filters']=_['intersection'](_0x681778[_0xcf0c('0x2f')],_0x681778[_0xcf0c('0x2c')]);_0x53af37[_0xcf0c('0x30')]=_[_0xcf0c('0x2e')](_0x681778[_0xcf0c('0x2f')],qs[_0xcf0c('0x31')](_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x31')]));_0x53af37[_0xcf0c('0x30')]=_0x53af37[_0xcf0c('0x30')][_0xcf0c('0x32')]?_0x53af37[_0xcf0c('0x30')]:_0x681778['model'];if(_0x2c8fa2[_0xcf0c('0x2c')][_0xcf0c('0x3b')]){_0x53af37[_0xcf0c('0x3c')]=[{'all':!![]}];}_0x53af37=_[_0xcf0c('0x37')]({},_0x53af37,_0x2c8fa2[_0xcf0c('0x39')]);return db['VoiceChanSpy']['find'](_0x53af37)[_0xcf0c('0x1f')](handleEntityNotFound(_0x1e688e,null))[_0xcf0c('0x1f')](respondWithResult(_0x1e688e,null))['catch'](handleError(_0x1e688e,null));};exports[_0xcf0c('0x40')]=function(_0x1f9728,_0x87e6d4){return db[_0xcf0c('0x3a')][_0xcf0c('0x40')](_0x1f9728[_0xcf0c('0x41')],{})[_0xcf0c('0x1f')](function(_0xe9f843){var _0x2fca4a=_0x1f9728[_0xcf0c('0x42')][_0xcf0c('0x20')]({'plain':!![]});if(!_0x2fca4a)throw new Error(_0xcf0c('0x43'));if(_0x2fca4a[_0xcf0c('0x44')]===_0xcf0c('0x42')){var _0x11558c=_0xe9f843[_0xcf0c('0x20')]({'plain':!![]});var _0x5563be=_0xcf0c('0x21');return db['UserProfileSection'][_0xcf0c('0x45')]({'where':{'name':_0x5563be,'userProfileId':_0x2fca4a[_0xcf0c('0x46')]},'raw':!![]})[_0xcf0c('0x1f')](function(_0x5103ff){if(_0x5103ff&&_0x5103ff[_0xcf0c('0x47')]===0x0){return db[_0xcf0c('0x48')][_0xcf0c('0x40')]({'name':_0x11558c[_0xcf0c('0x2a')],'resourceId':_0x11558c['id'],'type':_0x5103ff[_0xcf0c('0x2a')],'sectionId':_0x5103ff['id']},{})[_0xcf0c('0x1f')](function(){return _0xe9f843;});}else{return _0xe9f843;}})['catch'](function(_0x20b133){logger['error'](_0xcf0c('0x49'),_0x20b133);throw _0x20b133;});}return _0xe9f843;})[_0xcf0c('0x1f')](respondWithResult(_0x87e6d4,0xc9))[_0xcf0c('0x3e')](handleError(_0x87e6d4,null));};exports[_0xcf0c('0x1e')]=function(_0x543d75,_0x19782d){if(_0x543d75[_0xcf0c('0x41')]['id']){delete _0x543d75[_0xcf0c('0x41')]['id'];}return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x543d75[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x19782d,null))['then'](saveUpdates(_0x543d75[_0xcf0c('0x41')],null))[_0xcf0c('0x1f')](respondWithResult(_0x19782d,null))[_0xcf0c('0x3e')](handleError(_0x19782d,null));};exports[_0xcf0c('0x4b')]=function(_0x3f9edd,_0x53a2c8){return db[_0xcf0c('0x3a')][_0xcf0c('0x45')]({'where':{'id':_0x3f9edd[_0xcf0c('0x4a')]['id']}})[_0xcf0c('0x1f')](handleEntityNotFound(_0x53a2c8,null))[_0xcf0c('0x1f')](removeEntity(_0x53a2c8,null))['catch'](handleError(_0x53a2c8,null));}; \ No newline at end of file +var _0xd3b4=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','error','stack','name','map','VoiceChanSpy','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','user','role','UserProfileSection','userProfileId'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0x114c7f,_0x6097d4){_0x114c7f=_0x114c7f-0x0;var _0x2c192e=_0xd3b4[_0x114c7f];return _0x2c192e;};'use strict';var emlformat=require(_0x4d3b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4d3b('0x1'));var rp=require(_0x4d3b('0x2'));var moment=require(_0x4d3b('0x3'));var BPromise=require(_0x4d3b('0x4'));var Mustache=require('mustache');var util=require(_0x4d3b('0x5'));var path=require('path');var sox=require(_0x4d3b('0x6'));var csv=require(_0x4d3b('0x7'));var ejs=require(_0x4d3b('0x8'));var fs=require('fs');var fs_extra=require(_0x4d3b('0x9'));var _=require(_0x4d3b('0xa'));var squel=require(_0x4d3b('0xb'));var crypto=require(_0x4d3b('0xc'));var jsforce=require(_0x4d3b('0xd'));var deskjs=require(_0x4d3b('0xe'));var toCsv=require(_0x4d3b('0x7'));var querystring=require('querystring');var Papa=require(_0x4d3b('0xf'));var Redis=require('ioredis');var authService=require(_0x4d3b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4d3b('0x11'));var hardwareService=require(_0x4d3b('0x12'));var logger=require(_0x4d3b('0x13'))(_0x4d3b('0x14'));var utils=require(_0x4d3b('0x15'));var config=require(_0x4d3b('0x16'));var licenseUtil=require(_0x4d3b('0x17'));var db=require(_0x4d3b('0x18'))['db'];function respondWithStatusCode(_0xc5e0f4,_0xa23977){_0xa23977=_0xa23977||0xcc;return function(_0x43e1b6){if(_0x43e1b6){return _0xc5e0f4[_0x4d3b('0x19')](_0xa23977);}return _0xc5e0f4['status'](_0xa23977)[_0x4d3b('0x1a')]();};}function respondWithResult(_0x3e64ce,_0x2f5fa0){_0x2f5fa0=_0x2f5fa0||0xc8;return function(_0x156e79){if(_0x156e79){return _0x3e64ce[_0x4d3b('0x1b')](_0x2f5fa0)[_0x4d3b('0x1c')](_0x156e79);}};}function respondWithFilteredResult(_0xee1de1,_0x263268){return function(_0x19aad9){if(_0x19aad9){var _0x43a9a2=typeof _0x263268['offset']===_0x4d3b('0x1d')&&typeof _0x263268['limit']===_0x4d3b('0x1d');var _0x37c854=_0x19aad9[_0x4d3b('0x1e')];var _0x408b9b=_0x43a9a2?0x0:_0x263268[_0x4d3b('0x1f')];var _0x2f8a24=_0x43a9a2?_0x19aad9[_0x4d3b('0x1e')]:_0x263268[_0x4d3b('0x1f')]+_0x263268[_0x4d3b('0x20')];var _0x1fe7f5;if(_0x2f8a24>=_0x37c854){_0x2f8a24=_0x37c854;_0x1fe7f5=0xc8;}else{_0x1fe7f5=0xce;}_0xee1de1[_0x4d3b('0x1b')](_0x1fe7f5);return _0xee1de1[_0x4d3b('0x21')](_0x4d3b('0x22'),_0x408b9b+'-'+_0x2f8a24+'/'+_0x37c854)['json'](_0x19aad9);}return null;};}function patchUpdates(_0x44da95){return function(_0x401d86){try{jsonpatch[_0x4d3b('0x23')](_0x401d86,_0x44da95,!![]);}catch(_0x50ef5a){return BPromise[_0x4d3b('0x24')](_0x50ef5a);}return _0x401d86['save']();};}function saveUpdates(_0x2133d7,_0x19c4c0){return function(_0x335bd8){if(_0x335bd8){return _0x335bd8['update'](_0x2133d7)[_0x4d3b('0x25')](function(_0x508335){return _0x508335;});}return null;};}function removeEntity(_0x1a7b5c,_0x293388){return function(_0xc3fe1d){if(_0xc3fe1d){return _0xc3fe1d['destroy']()[_0x4d3b('0x25')](function(){var _0x31bd95=_0xc3fe1d[_0x4d3b('0x26')]({'plain':!![]});var _0x24ada0='ChanSpies';return db[_0x4d3b('0x27')][_0x4d3b('0x28')]({'where':{'type':_0x24ada0,'resourceId':_0x31bd95['id']}})[_0x4d3b('0x25')](function(){return _0xc3fe1d;});})[_0x4d3b('0x25')](function(){_0x1a7b5c[_0x4d3b('0x1b')](0xcc)[_0x4d3b('0x1a')]();});}};}function handleEntityNotFound(_0x1223c7,_0x37fc9d){return function(_0x1b7c1b){if(!_0x1b7c1b){_0x1223c7['sendStatus'](0x194);}return _0x1b7c1b;};}function handleError(_0x3b62a7,_0x48adb6){_0x48adb6=_0x48adb6||0x1f4;return function(_0x26209a){logger[_0x4d3b('0x29')](_0x26209a[_0x4d3b('0x2a')]);if(_0x26209a[_0x4d3b('0x2b')]){delete _0x26209a[_0x4d3b('0x2b')];}_0x3b62a7[_0x4d3b('0x1b')](_0x48adb6)['send'](_0x26209a);};}exports['index']=function(_0x3817bd,_0x599e10){var _0x5dc8a9={},_0x18d048={},_0x4a7280={'count':0x0,'rows':[]};var _0x364d24=_[_0x4d3b('0x2c')](db[_0x4d3b('0x2d')][_0x4d3b('0x2e')],function(_0x5cbafd){return{'name':_0x5cbafd['fieldName'],'type':_0x5cbafd['type'][_0x4d3b('0x2f')]};});_0x18d048['model']=_[_0x4d3b('0x2c')](_0x364d24,_0x4d3b('0x2b'));_0x18d048[_0x4d3b('0x30')]=_[_0x4d3b('0x31')](_0x3817bd[_0x4d3b('0x30')]);_0x18d048[_0x4d3b('0x32')]=_[_0x4d3b('0x33')](_0x18d048[_0x4d3b('0x34')],_0x18d048[_0x4d3b('0x30')]);_0x5dc8a9[_0x4d3b('0x35')]=_['intersection'](_0x18d048[_0x4d3b('0x34')],qs['fields'](_0x3817bd['query'][_0x4d3b('0x36')]));_0x5dc8a9[_0x4d3b('0x35')]=_0x5dc8a9[_0x4d3b('0x35')][_0x4d3b('0x37')]?_0x5dc8a9[_0x4d3b('0x35')]:_0x18d048[_0x4d3b('0x34')];if(!_0x3817bd[_0x4d3b('0x30')][_0x4d3b('0x38')](_0x4d3b('0x39'))){_0x5dc8a9[_0x4d3b('0x20')]=qs['limit'](_0x3817bd[_0x4d3b('0x30')]['limit']);_0x5dc8a9['offset']=qs[_0x4d3b('0x1f')](_0x3817bd[_0x4d3b('0x30')][_0x4d3b('0x1f')]);}_0x5dc8a9[_0x4d3b('0x3a')]=qs['sort'](_0x3817bd['query'][_0x4d3b('0x3b')]);_0x5dc8a9[_0x4d3b('0x3c')]=qs[_0x4d3b('0x32')](_['pick'](_0x3817bd[_0x4d3b('0x30')],_0x18d048[_0x4d3b('0x32')]),_0x364d24);if(_0x3817bd[_0x4d3b('0x30')]['filter']){_0x5dc8a9[_0x4d3b('0x3c')]=_[_0x4d3b('0x3d')](_0x5dc8a9[_0x4d3b('0x3c')],{'$or':_['map'](_0x364d24,function(_0x371c37){if(_0x371c37[_0x4d3b('0x3e')]!==_0x4d3b('0x3f')){var _0x4651c2={};_0x4651c2[_0x371c37[_0x4d3b('0x2b')]]={'$like':'%'+_0x3817bd[_0x4d3b('0x30')]['filter']+'%'};return _0x4651c2;}})});}_0x5dc8a9=_[_0x4d3b('0x3d')]({},_0x5dc8a9,_0x3817bd[_0x4d3b('0x40')]);var _0x4bd624={'where':_0x5dc8a9[_0x4d3b('0x3c')]};return db[_0x4d3b('0x2d')]['count'](_0x4bd624)['then'](function(_0x37123c){_0x4a7280[_0x4d3b('0x1e')]=_0x37123c;if(_0x3817bd[_0x4d3b('0x30')][_0x4d3b('0x41')]){_0x5dc8a9[_0x4d3b('0x42')]=[{'all':!![]}];}return db[_0x4d3b('0x2d')][_0x4d3b('0x43')](_0x5dc8a9);})[_0x4d3b('0x25')](function(_0xe623ca){_0x4a7280[_0x4d3b('0x44')]=_0xe623ca;return _0x4a7280;})[_0x4d3b('0x25')](respondWithFilteredResult(_0x599e10,_0x5dc8a9))['catch'](handleError(_0x599e10,null));};exports[_0x4d3b('0x45')]=function(_0x29556c,_0x5c4784){var _0x2b067c={'raw':![],'where':{'id':_0x29556c['params']['id']}},_0x435add={};_0x435add[_0x4d3b('0x34')]=_[_0x4d3b('0x31')](db[_0x4d3b('0x2d')]['rawAttributes']);_0x435add['query']=_[_0x4d3b('0x31')](_0x29556c[_0x4d3b('0x30')]);_0x435add[_0x4d3b('0x32')]=_[_0x4d3b('0x33')](_0x435add['model'],_0x435add[_0x4d3b('0x30')]);_0x2b067c[_0x4d3b('0x35')]=_['intersection'](_0x435add[_0x4d3b('0x34')],qs[_0x4d3b('0x36')](_0x29556c['query'][_0x4d3b('0x36')]));_0x2b067c[_0x4d3b('0x35')]=_0x2b067c[_0x4d3b('0x35')][_0x4d3b('0x37')]?_0x2b067c[_0x4d3b('0x35')]:_0x435add[_0x4d3b('0x34')];if(_0x29556c[_0x4d3b('0x30')]['includeAll']){_0x2b067c[_0x4d3b('0x42')]=[{'all':!![]}];}_0x2b067c=_[_0x4d3b('0x3d')]({},_0x2b067c,_0x29556c[_0x4d3b('0x40')]);return db[_0x4d3b('0x2d')][_0x4d3b('0x46')](_0x2b067c)[_0x4d3b('0x25')](handleEntityNotFound(_0x5c4784,null))['then'](respondWithResult(_0x5c4784,null))[_0x4d3b('0x47')](handleError(_0x5c4784,null));};exports[_0x4d3b('0x48')]=function(_0x257289,_0x178dda){return db[_0x4d3b('0x2d')][_0x4d3b('0x48')](_0x257289[_0x4d3b('0x49')],{})[_0x4d3b('0x25')](function(_0x15a962){var _0x457b92=_0x257289[_0x4d3b('0x4a')][_0x4d3b('0x26')]({'plain':!![]});if(!_0x457b92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x457b92[_0x4d3b('0x4b')]===_0x4d3b('0x4a')){var _0x1f7fd3=_0x15a962[_0x4d3b('0x26')]({'plain':!![]});var _0x364ce1='ChanSpies';return db[_0x4d3b('0x4c')]['find']({'where':{'name':_0x364ce1,'userProfileId':_0x457b92[_0x4d3b('0x4d')]},'raw':!![]})['then'](function(_0xac1a01){if(_0xac1a01&&_0xac1a01['autoAssociation']===0x0){return db[_0x4d3b('0x27')][_0x4d3b('0x48')]({'name':_0x1f7fd3[_0x4d3b('0x2b')],'resourceId':_0x1f7fd3['id'],'type':_0xac1a01[_0x4d3b('0x2b')],'sectionId':_0xac1a01['id']},{})[_0x4d3b('0x25')](function(){return _0x15a962;});}else{return _0x15a962;}})[_0x4d3b('0x47')](function(_0x171499){logger[_0x4d3b('0x29')](_0x4d3b('0x4e'),_0x171499);throw _0x171499;});}return _0x15a962;})[_0x4d3b('0x25')](respondWithResult(_0x178dda,0xc9))[_0x4d3b('0x47')](handleError(_0x178dda,null));};exports[_0x4d3b('0x4f')]=function(_0x576273,_0x381e23){if(_0x576273[_0x4d3b('0x49')]['id']){delete _0x576273[_0x4d3b('0x49')]['id'];}return db[_0x4d3b('0x2d')]['find']({'where':{'id':_0x576273[_0x4d3b('0x50')]['id']}})['then'](handleEntityNotFound(_0x381e23,null))[_0x4d3b('0x25')](saveUpdates(_0x576273[_0x4d3b('0x49')],null))[_0x4d3b('0x25')](respondWithResult(_0x381e23,null))['catch'](handleError(_0x381e23,null));};exports[_0x4d3b('0x28')]=function(_0x1ea2e2,_0x237a1f){return db[_0x4d3b('0x2d')][_0x4d3b('0x46')]({'where':{'id':_0x1ea2e2['params']['id']}})[_0x4d3b('0x25')](handleEntityNotFound(_0x237a1f,null))[_0x4d3b('0x25')](removeEntity(_0x237a1f,null))[_0x4d3b('0x47')](handleError(_0x237a1f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index be385ab..12b0e6b 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 _0x8a47=['password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','bluebird','./voiceChanSpy.attributes','format','%s%s','push','merge','CDR(type)=%s','recordingFormat','auth','Authenticate'];(function(_0x27b26c,_0x169539){var _0x5aa488=function(_0xd06b5c){while(--_0xd06b5c){_0x27b26c['push'](_0x27b26c['shift']());}};_0x5aa488(++_0x169539);}(_0x8a47,0x195));var _0x78a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8a47[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x78a4('0x0'));var util=require('util');var BPromise=require(_0x78a4('0x1'));var attributes=require(_0x78a4('0x2'));var getUserApplications=function(_0x47d551,_0x16bc9e,_0x5f3692){var _0x27ca51=0x1;var _0x260ec6=[];var _0x80cbb7={'context':_0x16bc9e['context']||'from-sip','exten':util[_0x78a4('0x3')](_0x78a4('0x4'),_0x47d551['prefix'],_0x5f3692),'type':'system','isApp':![],'ChanSpyId':_0x47d551['id'],'UserId':_0x16bc9e['id']};_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':'Set','appdata':util[_0x78a4('0x3')](_0x78a4('0x7'),'chanspy'),'priority':_0x27ca51++},_0x80cbb7));if(_0x47d551['record']){_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':'MixMonitor','appdata':util[_0x78a4('0x3')]('${UNIQUEID}.%s,a',_0x47d551[_0x78a4('0x8')]),'priority':_0x27ca51++},_0x80cbb7));}if(_0x47d551[_0x78a4('0x9')]){_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':_0x78a4('0xa'),'appdata':_0x47d551[_0x78a4('0xb')],'priority':_0x27ca51++},_0x80cbb7));}_0x260ec6[_0x78a4('0x5')](_[_0x78a4('0x6')]({'app':_0x78a4('0xc'),'appdata':util[_0x78a4('0x3')](_0x78a4('0xd'),_0x16bc9e[_0x78a4('0xe')],_0x47d551[_0x78a4('0xf')]?_0x47d551[_0x78a4('0xf')][_0x78a4('0x10')](''):''),'priority':_0x27ca51++},_0x80cbb7));if(_0x47d551['record']){_0x260ec6['push'](_['merge']({'app':'StopMixMonitor','priority':_0x27ca51++},_0x80cbb7));}return _0x260ec6;};var getChanSpyApplications=function(_0x1759c3,_0x390cb6){var _0x2ff636=[];for(var _0x33df47=0x0,_0x298499=0x1;_0x33df47<_0x390cb6[_0x78a4('0x11')];_0x33df47++,_0x298499=0x1){_0x2ff636=_0x2ff636[_0x78a4('0x12')](getUserApplications(_0x1759c3,_0x390cb6[_0x33df47],_0x390cb6[_0x33df47][_0x78a4('0x13')]));if(_0x390cb6[_0x33df47]['internal']!=_0x390cb6[_0x33df47]['name']){_0x2ff636=_0x2ff636[_0x78a4('0x12')](getUserApplications(_0x1759c3,_0x390cb6[_0x33df47],_0x390cb6[_0x33df47][_0x78a4('0xe')]));}}return _0x2ff636;};var getChanSpyPromise=function(_0x2e3fb3,_0x3dd7cc){return new BPromise(function(_0x4e5972,_0x32a7d4){return _0x2e3fb3[_0x78a4('0x14')][_0x78a4('0x15')]({'attributes':['id',_0x78a4('0xe'),_0x78a4('0x13')],'where':{'role':_0x78a4('0x16'),'chanspy':!![]},'raw':!![]})[_0x78a4('0x17')](function(_0x474825){if(_0x474825){return _0x4e5972(getChanSpyApplications(_0x3dd7cc,_0x474825));}return _0x4e5972([]);})[_0x78a4('0x18')](function(_0x1da2de){_0x32a7d4(_0x1da2de);});});};module['exports']=function(_0x3184d9,_0x5724f5){var _0x786999=_0x3184d9[_0x78a4('0x19')];return _0x3184d9[_0x78a4('0x1a')](_0x78a4('0x1b'),attributes,{'tableName':_0x78a4('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3890e4,_0x5d0275,_0x2ff1ad){return getChanSpyPromise(_0x786999,_0x3890e4)[_0x78a4('0x17')](function(_0x45e250){if(_0x45e250&&_0x45e250[_0x78a4('0x11')]){return _0x786999[_0x78a4('0x1d')]['bulkCreate'](_0x45e250);}})[_0x78a4('0x17')](function(){_0x2ff1ad();})[_0x78a4('0x18')](function(_0xd7ec01){_0x2ff1ad(_0xd7ec01);});},'afterUpdate':function(_0x41a62e,_0x27fe6c,_0x3b84d1){return _0x786999['VoiceExtension'][_0x78a4('0x1e')]({'where':{'ChanSpyId':_0x41a62e['id']}})['then'](function(){return getChanSpyPromise(_0x786999,_0x41a62e);})['then'](function(_0x322841){if(_0x322841&&_0x322841['length']){return _0x786999[_0x78a4('0x1d')][_0x78a4('0x1f')](_0x322841);}})[_0x78a4('0x17')](function(){_0x3b84d1();})[_0x78a4('0x18')](function(_0x2beef6){_0x3b84d1(_0x2beef6);});},'afterDestroy':function(_0x2025fd,_0x4cb607,_0x1fc527){return _0x786999[_0x78a4('0x1d')][_0x78a4('0x1e')]({'where':{'ChanSpyId':_0x2025fd['id']}})[_0x78a4('0x17')](function(){_0x1fc527();})['catch'](function(_0x142e21){_0x1fc527(_0x142e21);});}}});}; \ No newline at end of file +var _0xc465=['voice_chanspy','length','VoiceExtension','bulkCreate','catch','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','push','${UNIQUEID}.%s,a','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','concat','internal','User','agent','then','models','define'];(function(_0x46cbb3,_0x4c15e8){var _0x59754b=function(_0x22729f){while(--_0x22729f){_0x46cbb3['push'](_0x46cbb3['shift']());}};_0x59754b(++_0x4c15e8);}(_0xc465,0x163));var _0x5c46=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc465[_0x11005e];return _0x29338f;};'use strict';var _=require('lodash');var util=require(_0x5c46('0x0'));var BPromise=require(_0x5c46('0x1'));var attributes=require(_0x5c46('0x2'));var getUserApplications=function(_0x307926,_0x581da4,_0x36c3f2){var _0x3287dd=0x1;var _0xd3a6fb=[];var _0x2c930c={'context':_0x581da4[_0x5c46('0x3')]||_0x5c46('0x4'),'exten':util[_0x5c46('0x5')](_0x5c46('0x6'),_0x307926[_0x5c46('0x7')],_0x36c3f2),'type':_0x5c46('0x8'),'isApp':![],'ChanSpyId':_0x307926['id'],'UserId':_0x581da4['id']};_0xd3a6fb['push'](_[_0x5c46('0x9')]({'app':_0x5c46('0xa'),'appdata':util[_0x5c46('0x5')](_0x5c46('0xb'),_0x5c46('0xc')),'priority':_0x3287dd++},_0x2c930c));if(_0x307926[_0x5c46('0xd')]){_0xd3a6fb[_0x5c46('0xe')](_[_0x5c46('0x9')]({'app':'MixMonitor','appdata':util['format'](_0x5c46('0xf'),_0x307926['recordingFormat']),'priority':_0x3287dd++},_0x2c930c));}if(_0x307926[_0x5c46('0x10')]){_0xd3a6fb[_0x5c46('0xe')](_[_0x5c46('0x9')]({'app':_0x5c46('0x11'),'appdata':_0x307926['password'],'priority':_0x3287dd++},_0x2c930c));}_0xd3a6fb[_0x5c46('0xe')](_[_0x5c46('0x9')]({'app':_0x5c46('0x12'),'appdata':util['format'](_0x5c46('0x13'),_0x581da4[_0x5c46('0x14')],_0x307926[_0x5c46('0x15')]?_0x307926[_0x5c46('0x15')][_0x5c46('0x16')](''):''),'priority':_0x3287dd++},_0x2c930c));if(_0x307926[_0x5c46('0xd')]){_0xd3a6fb[_0x5c46('0xe')](_['merge']({'app':'StopMixMonitor','priority':_0x3287dd++},_0x2c930c));}return _0xd3a6fb;};var getChanSpyApplications=function(_0x59909b,_0x2fac21){var _0x414643=[];for(var _0x21e6d5=0x0,_0x1c3f0b=0x1;_0x21e6d5<_0x2fac21['length'];_0x21e6d5++,_0x1c3f0b=0x1){_0x414643=_0x414643[_0x5c46('0x17')](getUserApplications(_0x59909b,_0x2fac21[_0x21e6d5],_0x2fac21[_0x21e6d5][_0x5c46('0x18')]));if(_0x2fac21[_0x21e6d5]['internal']!=_0x2fac21[_0x21e6d5]['name']){_0x414643=_0x414643[_0x5c46('0x17')](getUserApplications(_0x59909b,_0x2fac21[_0x21e6d5],_0x2fac21[_0x21e6d5][_0x5c46('0x14')]));}}return _0x414643;};var getChanSpyPromise=function(_0x2bd525,_0x15c6e7){return new BPromise(function(_0x3536b8,_0xbc0ba5){return _0x2bd525[_0x5c46('0x19')]['findAll']({'attributes':['id',_0x5c46('0x14'),_0x5c46('0x18')],'where':{'role':_0x5c46('0x1a'),'chanspy':!![]},'raw':!![]})[_0x5c46('0x1b')](function(_0x2eb052){if(_0x2eb052){return _0x3536b8(getChanSpyApplications(_0x15c6e7,_0x2eb052));}return _0x3536b8([]);})['catch'](function(_0x26bb8a){_0xbc0ba5(_0x26bb8a);});});};module['exports']=function(_0x4a7101,_0x29cc00){var _0x441cfb=_0x4a7101[_0x5c46('0x1c')];return _0x4a7101[_0x5c46('0x1d')]('VoiceChanSpy',attributes,{'tableName':_0x5c46('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58b6b8,_0x162860,_0x2616f4){return getChanSpyPromise(_0x441cfb,_0x58b6b8)[_0x5c46('0x1b')](function(_0x57a306){if(_0x57a306&&_0x57a306[_0x5c46('0x1f')]){return _0x441cfb[_0x5c46('0x20')]['bulkCreate'](_0x57a306);}})[_0x5c46('0x1b')](function(){_0x2616f4();})['catch'](function(_0x186be3){_0x2616f4(_0x186be3);});},'afterUpdate':function(_0x3c2cfb,_0x72092d,_0x4c5447){return _0x441cfb[_0x5c46('0x20')]['destroy']({'where':{'ChanSpyId':_0x3c2cfb['id']}})[_0x5c46('0x1b')](function(){return getChanSpyPromise(_0x441cfb,_0x3c2cfb);})[_0x5c46('0x1b')](function(_0x412ace){if(_0x412ace&&_0x412ace['length']){return _0x441cfb[_0x5c46('0x20')][_0x5c46('0x21')](_0x412ace);}})[_0x5c46('0x1b')](function(){_0x4c5447();})[_0x5c46('0x22')](function(_0x5600bb){_0x4c5447(_0x5600bb);});},'afterDestroy':function(_0x4e804c,_0x1757a1,_0x1df1cb){return _0x441cfb[_0x5c46('0x20')]['destroy']({'where':{'ChanSpyId':_0x4e804c['id']}})[_0x5c46('0x1b')](function(){_0x1df1cb();})[_0x5c46('0x22')](function(_0x5513ec){_0x1df1cb(_0x5513ec);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 65e2778..c468ac9 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 _0xdb94=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','message','catch'];(function(_0x4bd995,_0x5abdf1){var _0x40d9f3=function(_0x431cb1){while(--_0x431cb1){_0x4bd995['push'](_0x4bd995['shift']());}};_0x40d9f3(++_0x5abdf1);}(_0xdb94,0xab));var _0x4db9=function(_0xf049d3,_0x7742d5){_0xf049d3=_0xf049d3-0x0;var _0x4262d1=_0xdb94[_0xf049d3];return _0x4262d1;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rs=require(_0x4db9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4db9('0x5'))['db'];var utils=require(_0x4db9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4db9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4db9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1f45,_0x196ede,_0x50c27a){return new BPromise(function(_0x14deb9,_0x26248b){return client[_0x4db9('0x9')](_0x5d1f45,_0x50c27a)[_0x4db9('0xa')](function(_0x2cacca){logger[_0x4db9('0xb')](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));logger[_0x4db9('0xe')](_0x4db9('0xf'),_0x196ede,_0x4db9('0xd'),JSON['stringify'](_0x2cacca));if(_0x2cacca[_0x4db9('0x10')]){if(_0x2cacca[_0x4db9('0x10')]['code']===0x1f4){logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca['error']['message']);return _0x26248b(_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);}logger['error'](_0x4db9('0xc'),_0x196ede,_0x2cacca[_0x4db9('0x10')][_0x4db9('0x11')]);return _0x14deb9(_0x2cacca[_0x4db9('0x10')]['message']);}else{logger['info'](_0x4db9('0xc'),_0x196ede,_0x4db9('0xd'));_0x14deb9(_0x2cacca['result'][_0x4db9('0x11')]);}})[_0x4db9('0x12')](function(_0x5d6471){logger['error'](_0x4db9('0xc'),_0x196ede,_0x5d6471);_0x26248b(_0x5d6471);});});} \ No newline at end of file +var _0xa588=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xa588,0xe1));var _0x8a58=function(_0x5948c6,_0x4de8ac){_0x5948c6=_0x5948c6-0x0;var _0x30059e=_0xa588[_0x5948c6];return _0x30059e;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var moment=require(_0x8a58('0x1'));var BPromise=require(_0x8a58('0x2'));var rs=require(_0x8a58('0x3'));var fs=require('fs');var Redis=require(_0x8a58('0x4'));var db=require(_0x8a58('0x5'))['db'];var utils=require(_0x8a58('0x6'));var logger=require(_0x8a58('0x7'))(_0x8a58('0x8'));var config=require('../../config/environment');var jayson=require(_0x8a58('0x9'));var client=jayson[_0x8a58('0xa')][_0x8a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35d5ad,_0xe0af18,_0x140f99){return new BPromise(function(_0x77b421,_0x585376){return client['request'](_0x35d5ad,_0x140f99)[_0x8a58('0xc')](function(_0x39a20e){logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));logger['debug'](_0x8a58('0x10'),_0xe0af18,_0x8a58('0xf'),JSON[_0x8a58('0x11')](_0x39a20e));if(_0x39a20e[_0x8a58('0x12')]){if(_0x39a20e['error']['code']===0x1f4){logger[_0x8a58('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x585376(_0x39a20e['error'][_0x8a58('0x13')]);}logger[_0x8a58('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0xe0af18,_0x39a20e[_0x8a58('0x12')][_0x8a58('0x13')]);return _0x77b421(_0x39a20e['error'][_0x8a58('0x13')]);}else{logger[_0x8a58('0xd')](_0x8a58('0xe'),_0xe0af18,_0x8a58('0xf'));_0x77b421(_0x39a20e[_0x8a58('0x14')][_0x8a58('0x13')]);}})[_0x8a58('0x15')](function(_0x49ee0e){logger['error'](_0x8a58('0xe'),_0xe0af18,_0x49ee0e);_0x585376(_0x49ee0e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index c3a093f..d01ee03 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 _0x7336=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x11e6d6,_0x93cb1){var _0x4df6bb=function(_0x3866c9){while(--_0x3866c9){_0x11e6d6['push'](_0x11e6d6['shift']());}};_0x4df6bb(++_0x93cb1);}(_0x7336,0x140));var _0x6733=function(_0x54356c,_0x21b801){_0x54356c=_0x54356c-0x0;var _0x397aa8=_0x7336[_0x54356c];return _0x397aa8;};'use strict';var multer=require(_0x6733('0x0'));var util=require(_0x6733('0x1'));var path=require(_0x6733('0x2'));var timeout=require(_0x6733('0x3'));var express=require(_0x6733('0x4'));var router=express[_0x6733('0x5')]();var fs_extra=require(_0x6733('0x6'));var auth=require(_0x6733('0x7'));var interaction=require(_0x6733('0x8'));var config=require(_0x6733('0x9'));var controller=require('./voiceContext.controller');router[_0x6733('0xa')]('/',auth[_0x6733('0xb')](),controller[_0x6733('0xc')]);router[_0x6733('0xa')](_0x6733('0xd'),auth[_0x6733('0xb')](),controller[_0x6733('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6733('0xd'),auth[_0x6733('0xb')](),controller[_0x6733('0xf')]);router[_0x6733('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6733('0x11')]);module[_0x6733('0x12')]=router; \ No newline at end of file +var _0x7d5e=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0x7d5e,0xbb));var _0xe7d5=function(_0x2c873b,_0x458f46){_0x2c873b=_0x2c873b-0x0;var _0x1f7b07=_0x7d5e[_0x2c873b];return _0x1f7b07;};'use strict';var multer=require(_0xe7d5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe7d5('0x1'));var express=require(_0xe7d5('0x2'));var router=express[_0xe7d5('0x3')]();var fs_extra=require(_0xe7d5('0x4'));var auth=require(_0xe7d5('0x5'));var interaction=require(_0xe7d5('0x6'));var config=require('../../config/environment');var controller=require(_0xe7d5('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe7d5('0x8'),auth[_0xe7d5('0x9')](),controller[_0xe7d5('0xa')]);router[_0xe7d5('0xb')]('/',auth[_0xe7d5('0x9')](),controller[_0xe7d5('0xc')]);router['put']('/:id',auth[_0xe7d5('0x9')](),controller[_0xe7d5('0xd')]);router[_0xe7d5('0xe')](_0xe7d5('0x8'),auth[_0xe7d5('0x9')](),controller[_0xe7d5('0xf')]);module[_0xe7d5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 04b0f33..a6a0339 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 _0x3f4a=['BOOLEAN','exports','STRING'];(function(_0x87239,_0x38c793){var _0x53af1e=function(_0x11eb5f){while(--_0x11eb5f){_0x87239['push'](_0x87239['shift']());}};_0x53af1e(++_0x38c793);}(_0x3f4a,0x12a));var _0xa3f4=function(_0x4526e1,_0x48a88c){_0x4526e1=_0x4526e1-0x0;var _0x38b122=_0x3f4a[_0x4526e1];return _0x38b122;};'use strict';var Sequelize=require('sequelize');module[_0xa3f4('0x0')]={'name':{'type':Sequelize[_0xa3f4('0x1')],'unique':'name'},'description':{'type':Sequelize[_0xa3f4('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa3f4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd565=['STRING','BOOLEAN','exports','name'];(function(_0x4b277b,_0x11e6e0){var _0x2114ac=function(_0x45f00f){while(--_0x45f00f){_0x4b277b['push'](_0x4b277b['shift']());}};_0x2114ac(++_0x11e6e0);}(_0xd565,0x1ba));var _0x5d56=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd565[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x5d56('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5d56('0x1')},'description':{'type':Sequelize[_0x5d56('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5d56('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 269474b..fba3ba7 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 _0x9556=['../../config/logger','api','../../config/utils','../../config/environment','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','get','Contexts','UserProfileResource','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceContext','includeAll','findAll','rows','show','keys','length','include','find','create','body','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','readFileSync','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x14761d,_0x204fcc){var _0x8f69ee=function(_0x1fd266){while(--_0x1fd266){_0x14761d['push'](_0x14761d['shift']());}};_0x8f69ee(++_0x204fcc);}(_0x9556,0x1db));var _0x6955=function(_0x38d329,_0x5ea6d0){_0x38d329=_0x38d329-0x0;var _0x3ae28f=_0x9556[_0x38d329];return _0x3ae28f;};'use strict';var emlformat=require(_0x6955('0x0'));var rimraf=require(_0x6955('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6955('0x2'));var rp=require('request-promise');var moment=require(_0x6955('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6955('0x4'));var util=require(_0x6955('0x5'));var path=require(_0x6955('0x6'));var sox=require(_0x6955('0x7'));var csv=require('to-csv');var ejs=require(_0x6955('0x8'));var fs=require('fs');var fs_extra=require(_0x6955('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6955('0xa'));var jsforce=require(_0x6955('0xb'));var deskjs=require(_0x6955('0xc'));var toCsv=require(_0x6955('0xd'));var querystring=require(_0x6955('0xe'));var Papa=require(_0x6955('0xf'));var Redis=require(_0x6955('0x10'));var authService=require(_0x6955('0x11'));var qs=require(_0x6955('0x12'));var as=require(_0x6955('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6955('0x14'))(_0x6955('0x15'));var utils=require(_0x6955('0x16'));var config=require(_0x6955('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x6955('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554ddc,_0x31b595,_0x2a8237,_0x2c7702){return new BPromise(function(_0x176d04,_0x50c011){var _0x244533=_0x2c7702||client;return _0x244533['request'](_0x554ddc,_0x2a8237)[_0x6955('0x19')](function(_0x246ea3){logger[_0x6955('0x1a')](_0x6955('0x1b'),_0x31b595,_0x6955('0x1c'));logger[_0x6955('0x1d')](_0x6955('0x1e'),_0x31b595,'request\x20sent',JSON[_0x6955('0x1f')](_0x246ea3));if(_0x246ea3[_0x6955('0x20')]){if(_0x246ea3[_0x6955('0x20')]['code']===0x1f4){logger[_0x6955('0x20')]('VoiceContext,\x20%s,\x20%s',_0x31b595,_0x246ea3[_0x6955('0x20')][_0x6955('0x21')]);return _0x50c011(_0x246ea3['error'][_0x6955('0x21')]);}logger[_0x6955('0x20')](_0x6955('0x1b'),_0x31b595,_0x246ea3[_0x6955('0x20')][_0x6955('0x21')]);return _0x176d04(_0x246ea3['error'][_0x6955('0x21')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x31b595,_0x6955('0x1c'));_0x176d04(_0x246ea3[_0x6955('0x22')]['message']);}})[_0x6955('0x23')](function(_0x4fd680){logger['error'](_0x6955('0x1b'),_0x31b595,_0x4fd680);_0x50c011(_0x4fd680);});});}function respondWithStatusCode(_0xdabaf3,_0x3ea0c1){_0x3ea0c1=_0x3ea0c1||0xcc;return function(_0x4cce68){if(_0x4cce68){return _0xdabaf3['sendStatus'](_0x3ea0c1);}return _0xdabaf3['status'](_0x3ea0c1)[_0x6955('0x24')]();};}function respondWithResult(_0x2f7436,_0x1889a8){_0x1889a8=_0x1889a8||0xc8;return function(_0x28bb53){if(_0x28bb53){return _0x2f7436[_0x6955('0x25')](_0x1889a8)[_0x6955('0x26')](_0x28bb53);}};}function respondWithFilteredResult(_0x5d41f3,_0x4fb0e5){return function(_0x191063){if(_0x191063){var _0x15363a=typeof _0x4fb0e5['offset']===_0x6955('0x27')&&typeof _0x4fb0e5[_0x6955('0x28')]==='undefined';var _0x39f54f=_0x191063['count'];var _0x470f99=_0x15363a?0x0:_0x4fb0e5[_0x6955('0x29')];var _0x479fbb=_0x15363a?_0x191063[_0x6955('0x2a')]:_0x4fb0e5[_0x6955('0x29')]+_0x4fb0e5['limit'];var _0x3d4735;if(_0x479fbb>=_0x39f54f){_0x479fbb=_0x39f54f;_0x3d4735=0xc8;}else{_0x3d4735=0xce;}_0x5d41f3[_0x6955('0x25')](_0x3d4735);return _0x5d41f3[_0x6955('0x2b')](_0x6955('0x2c'),_0x470f99+'-'+_0x479fbb+'/'+_0x39f54f)[_0x6955('0x26')](_0x191063);}return null;};}function patchUpdates(_0x19a2e7){return function(_0x45a91c){try{jsonpatch['apply'](_0x45a91c,_0x19a2e7,!![]);}catch(_0xecc929){return BPromise[_0x6955('0x2d')](_0xecc929);}return _0x45a91c[_0x6955('0x2e')]();};}function saveUpdates(_0x3e7070,_0x53e3b0){return function(_0x1bc25c){if(_0x1bc25c){return _0x1bc25c[_0x6955('0x2f')](_0x3e7070)[_0x6955('0x19')](function(_0x3e0cb2){return _0x3e0cb2;});}return null;};}function removeEntity(_0x592577,_0x234588){return function(_0x497779){if(_0x497779){return _0x497779[_0x6955('0x30')]()[_0x6955('0x19')](function(){var _0x291ee1=_0x497779[_0x6955('0x31')]({'plain':!![]});var _0x4d98b5=_0x6955('0x32');return db[_0x6955('0x33')][_0x6955('0x30')]({'where':{'type':_0x4d98b5,'resourceId':_0x291ee1['id']}})[_0x6955('0x19')](function(){return _0x497779;});})[_0x6955('0x19')](function(){_0x592577[_0x6955('0x25')](0xcc)[_0x6955('0x24')]();});}};}function handleEntityNotFound(_0x15ae9c,_0x168ebf){return function(_0x3fc7e5){if(!_0x3fc7e5){_0x15ae9c['sendStatus'](0x194);}return _0x3fc7e5;};}function handleError(_0x975ba2,_0x360d6b){_0x360d6b=_0x360d6b||0x1f4;return function(_0x1796f3){logger[_0x6955('0x20')](_0x1796f3['stack']);if(_0x1796f3[_0x6955('0x34')]){delete _0x1796f3[_0x6955('0x34')];}_0x975ba2[_0x6955('0x25')](_0x360d6b)[_0x6955('0x35')](_0x1796f3);};}exports['index']=function(_0x1d2615,_0x592c52){var _0x2fde5e={},_0x42e1ba={},_0x55e9b2={'count':0x0,'rows':[]};var _0x5c0be3=_[_0x6955('0x36')](db['VoiceContext'][_0x6955('0x37')],function(_0x3f93e0){return{'name':_0x3f93e0['fieldName'],'type':_0x3f93e0[_0x6955('0x38')][_0x6955('0x39')]};});_0x42e1ba[_0x6955('0x3a')]=_[_0x6955('0x36')](_0x5c0be3,_0x6955('0x34'));_0x42e1ba[_0x6955('0x3b')]=_['keys'](_0x1d2615['query']);_0x42e1ba[_0x6955('0x3c')]=_[_0x6955('0x3d')](_0x42e1ba[_0x6955('0x3a')],_0x42e1ba[_0x6955('0x3b')]);_0x2fde5e[_0x6955('0x3e')]=_[_0x6955('0x3d')](_0x42e1ba[_0x6955('0x3a')],qs[_0x6955('0x3f')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x3f')]));_0x2fde5e[_0x6955('0x3e')]=_0x2fde5e[_0x6955('0x3e')]['length']?_0x2fde5e[_0x6955('0x3e')]:_0x42e1ba['model'];if(!_0x1d2615[_0x6955('0x3b')][_0x6955('0x40')](_0x6955('0x41'))){_0x2fde5e[_0x6955('0x28')]=qs[_0x6955('0x28')](_0x1d2615['query'][_0x6955('0x28')]);_0x2fde5e['offset']=qs[_0x6955('0x29')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x29')]);}_0x2fde5e['order']=qs[_0x6955('0x42')](_0x1d2615[_0x6955('0x3b')][_0x6955('0x42')]);_0x2fde5e[_0x6955('0x43')]=qs[_0x6955('0x3c')](_['pick'](_0x1d2615[_0x6955('0x3b')],_0x42e1ba[_0x6955('0x3c')]),_0x5c0be3);if(_0x1d2615[_0x6955('0x3b')][_0x6955('0x44')]){_0x2fde5e[_0x6955('0x43')]=_[_0x6955('0x45')](_0x2fde5e[_0x6955('0x43')],{'$or':_['map'](_0x5c0be3,function(_0x37b478){if(_0x37b478['type']!==_0x6955('0x46')){var _0x2ce9a0={};_0x2ce9a0[_0x37b478['name']]={'$like':'%'+_0x1d2615['query']['filter']+'%'};return _0x2ce9a0;}})});}_0x2fde5e=_[_0x6955('0x45')]({},_0x2fde5e,_0x1d2615[_0x6955('0x47')]);var _0x18e0b8={'where':_0x2fde5e[_0x6955('0x43')]};return db[_0x6955('0x48')]['count'](_0x18e0b8)['then'](function(_0x5701d9){_0x55e9b2['count']=_0x5701d9;if(_0x1d2615['query'][_0x6955('0x49')]){_0x2fde5e['include']=[{'all':!![]}];}return db[_0x6955('0x48')][_0x6955('0x4a')](_0x2fde5e);})['then'](function(_0x28baed){_0x55e9b2[_0x6955('0x4b')]=_0x28baed;return _0x55e9b2;})[_0x6955('0x19')](respondWithFilteredResult(_0x592c52,_0x2fde5e))[_0x6955('0x23')](handleError(_0x592c52,null));};exports[_0x6955('0x4c')]=function(_0x133995,_0x2daff7){var _0x700e69={'raw':![],'where':{'id':_0x133995['params']['id']}},_0x1fd3b4={};_0x1fd3b4['model']=_[_0x6955('0x4d')](db['VoiceContext'][_0x6955('0x37')]);_0x1fd3b4[_0x6955('0x3b')]=_[_0x6955('0x4d')](_0x133995[_0x6955('0x3b')]);_0x1fd3b4[_0x6955('0x3c')]=_[_0x6955('0x3d')](_0x1fd3b4['model'],_0x1fd3b4['query']);_0x700e69[_0x6955('0x3e')]=_[_0x6955('0x3d')](_0x1fd3b4['model'],qs[_0x6955('0x3f')](_0x133995[_0x6955('0x3b')][_0x6955('0x3f')]));_0x700e69[_0x6955('0x3e')]=_0x700e69[_0x6955('0x3e')][_0x6955('0x4e')]?_0x700e69[_0x6955('0x3e')]:_0x1fd3b4[_0x6955('0x3a')];if(_0x133995[_0x6955('0x3b')]['includeAll']){_0x700e69[_0x6955('0x4f')]=[{'all':!![]}];}_0x700e69=_[_0x6955('0x45')]({},_0x700e69,_0x133995[_0x6955('0x47')]);return db['VoiceContext'][_0x6955('0x50')](_0x700e69)['then'](handleEntityNotFound(_0x2daff7,null))[_0x6955('0x19')](respondWithResult(_0x2daff7,null))[_0x6955('0x23')](handleError(_0x2daff7,null));};exports['create']=function(_0x410cb3,_0x25be3b,_0x4b6caa){var _0x171878;return db[_0x6955('0x48')][_0x6955('0x51')](_0x410cb3[_0x6955('0x52')],{'raw':!![]})[_0x6955('0x19')](function(_0x45fd75){_0x171878=_0x45fd75;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1a938b){var _0x36dbdc=fs['readFileSync'](path[_0x6955('0x53')](config[_0x6955('0x54')],_0x6955('0x55')),_0x6955('0x56'));var _0x4bae92=ejs[_0x6955('0x57')](_0x36dbdc,{'contexts':_0x1a938b||[]});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4bae92);})[_0x6955('0x19')](function(){return respondWithRpcPromise(_0x6955('0x59'),_0x6955('0x51'),{'module':_0x6955('0x5a')});})[_0x6955('0x19')](function(){var _0x53d7b7=_0x410cb3[_0x6955('0x5b')][_0x6955('0x31')]({'plain':!![]});if(!_0x53d7b7)throw new Error(_0x6955('0x5c'));if(_0x53d7b7[_0x6955('0x5d')]==='user'){var _0x21e197=_0x171878['get']({'plain':!![]});return db['UserProfileSection'][_0x6955('0x50')]({'where':{'name':_0x6955('0x32'),'userProfileId':_0x53d7b7[_0x6955('0x5e')]},'raw':!![]})[_0x6955('0x19')](function(_0x163e29){if(_0x163e29&&_0x163e29[_0x6955('0x5f')]===0x0){return db[_0x6955('0x33')][_0x6955('0x51')]({'name':_0x21e197[_0x6955('0x34')],'resourceId':_0x21e197['id'],'type':_0x163e29[_0x6955('0x34')],'sectionId':_0x163e29['id']},{})['then'](function(){return _0x171878;});}else{return _0x171878;}})[_0x6955('0x23')](function(_0x391dd8){logger['error'](_0x6955('0x60'),_0x391dd8);throw _0x391dd8;});}return _0x171878;})[_0x6955('0x19')](respondWithResult(_0x25be3b,0xc9))[_0x6955('0x23')](handleError(_0x25be3b,null));};exports['update']=function(_0x385e4,_0x58a1fa,_0xb3db18){var _0x154aab;return db[_0x6955('0x48')][_0x6955('0x50')]({'where':{'id':_0x385e4[_0x6955('0x61')]['id']}})[_0x6955('0x19')](handleEntityNotFound(_0x58a1fa,null))[_0x6955('0x19')](saveUpdates(_0x385e4[_0x6955('0x52')],null))['then'](function(_0x3472ab){if(_0x3472ab){_0x154aab=_0x3472ab;return db['VoiceContext'][_0x6955('0x4a')]({'raw':!![]});}})[_0x6955('0x19')](function(_0x2dd09e){var _0xc8f562=fs[_0x6955('0x62')](path[_0x6955('0x53')](config[_0x6955('0x54')],'server/files/templates/context.ejs'),_0x6955('0x56'));var _0x9d12bc=ejs[_0x6955('0x57')](_0xc8f562,{'contexts':_0x2dd09e||[]});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x9d12bc);})[_0x6955('0x19')](function(){return respondWithRpcPromise(_0x6955('0x59'),'update',{'module':_0x6955('0x5a')});})['then'](function(){return _0x154aab;})[_0x6955('0x19')](respondWithResult(_0x58a1fa,null))['catch'](handleError(_0x58a1fa,null));};exports[_0x6955('0x30')]=function(_0x4a83e8,_0x50e854,_0x29e27b){var _0x19553a;return db[_0x6955('0x48')][_0x6955('0x50')]({'where':{'id':_0x4a83e8['params']['id']}})[_0x6955('0x19')](handleEntityNotFound(_0x50e854,null))[_0x6955('0x19')](removeEntity(_0x50e854,null))[_0x6955('0x19')](function(){return db['VoiceContext'][_0x6955('0x4a')]({'raw':!![]});})[_0x6955('0x19')](function(_0xd3b11f){var _0x2a3b7d=fs[_0x6955('0x62')](path[_0x6955('0x53')](config[_0x6955('0x54')],_0x6955('0x55')),_0x6955('0x56'));var _0xd4afc3=ejs[_0x6955('0x57')](_0x2a3b7d,{'contexts':_0xd3b11f});fs[_0x6955('0x58')]('/etc/asterisk/extensions_xcally_contexts.conf',_0xd4afc3);return respondWithRpcPromise(_0x6955('0x59'),'destroy',{'module':_0x6955('0x5a')});})['catch'](handleError(_0x50e854,null));}; \ No newline at end of file +var _0x3faa=['destroy','get','Contexts','UserProfileResource','name','send','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','options','includeAll','include','findAll','rows','params','length','merge','find','create','body','join','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','root','render','utf8','Reload','chan_sip.so','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x1f2279,_0x3b3632){var _0x38b4e8=function(_0x358f83){while(--_0x358f83){_0x1f2279['push'](_0x1f2279['shift']());}};_0x38b4e8(++_0x3b3632);}(_0x3faa,0x96));var _0xa3fa=function(_0x9685f2,_0x14755b){_0x9685f2=_0x9685f2-0x0;var _0x24c98b=_0x3faa[_0x9685f2];return _0x24c98b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa3fa('0x0'));var zipdir=require(_0xa3fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa3fa('0x2'));var moment=require(_0xa3fa('0x3'));var BPromise=require(_0xa3fa('0x4'));var Mustache=require(_0xa3fa('0x5'));var util=require(_0xa3fa('0x6'));var path=require(_0xa3fa('0x7'));var sox=require(_0xa3fa('0x8'));var csv=require(_0xa3fa('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa3fa('0xa'));var _=require('lodash');var squel=require(_0xa3fa('0xb'));var crypto=require(_0xa3fa('0xc'));var jsforce=require(_0xa3fa('0xd'));var deskjs=require(_0xa3fa('0xe'));var toCsv=require(_0xa3fa('0x9'));var querystring=require(_0xa3fa('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3fa('0x10'));var authService=require(_0xa3fa('0x11'));var qs=require(_0xa3fa('0x12'));var as=require(_0xa3fa('0x13'));var hardwareService=require(_0xa3fa('0x14'));var logger=require(_0xa3fa('0x15'))('api');var utils=require(_0xa3fa('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa3fa('0x17'))['db'];var jayson=require(_0xa3fa('0x18'));var client=jayson['client'][_0xa3fa('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x28ee51,_0x48fd81,_0x3aa1e5,_0x554085){return new BPromise(function(_0x5dc523,_0x3ea187){var _0x364f3a=_0x554085||client;return _0x364f3a[_0xa3fa('0x1a')](_0x28ee51,_0x3aa1e5)[_0xa3fa('0x1b')](function(_0x14a8b3){logger['info'](_0xa3fa('0x1c'),_0x48fd81,_0xa3fa('0x1d'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x48fd81,_0xa3fa('0x1d'),JSON[_0xa3fa('0x1e')](_0x14a8b3));if(_0x14a8b3[_0xa3fa('0x1f')]){if(_0x14a8b3[_0xa3fa('0x1f')][_0xa3fa('0x20')]===0x1f4){logger[_0xa3fa('0x1f')](_0xa3fa('0x1c'),_0x48fd81,_0x14a8b3[_0xa3fa('0x1f')][_0xa3fa('0x21')]);return _0x3ea187(_0x14a8b3[_0xa3fa('0x1f')][_0xa3fa('0x21')]);}logger['error'](_0xa3fa('0x1c'),_0x48fd81,_0x14a8b3[_0xa3fa('0x1f')][_0xa3fa('0x21')]);return _0x5dc523(_0x14a8b3[_0xa3fa('0x1f')][_0xa3fa('0x21')]);}else{logger[_0xa3fa('0x22')](_0xa3fa('0x1c'),_0x48fd81,_0xa3fa('0x1d'));_0x5dc523(_0x14a8b3[_0xa3fa('0x23')][_0xa3fa('0x21')]);}})[_0xa3fa('0x24')](function(_0x4dc2d6){logger['error'](_0xa3fa('0x1c'),_0x48fd81,_0x4dc2d6);_0x3ea187(_0x4dc2d6);});});}function respondWithStatusCode(_0x36f0f4,_0x25d733){_0x25d733=_0x25d733||0xcc;return function(_0x3e8515){if(_0x3e8515){return _0x36f0f4[_0xa3fa('0x25')](_0x25d733);}return _0x36f0f4[_0xa3fa('0x26')](_0x25d733)[_0xa3fa('0x27')]();};}function respondWithResult(_0x405d25,_0x113c20){_0x113c20=_0x113c20||0xc8;return function(_0x2fb768){if(_0x2fb768){return _0x405d25['status'](_0x113c20)[_0xa3fa('0x28')](_0x2fb768);}};}function respondWithFilteredResult(_0x51ba84,_0x19d094){return function(_0xbd0c89){if(_0xbd0c89){var _0x4f0d18=typeof _0x19d094[_0xa3fa('0x29')]==='undefined'&&typeof _0x19d094[_0xa3fa('0x2a')]==='undefined';var _0x2699b9=_0xbd0c89[_0xa3fa('0x2b')];var _0x2c2655=_0x4f0d18?0x0:_0x19d094[_0xa3fa('0x29')];var _0x213623=_0x4f0d18?_0xbd0c89[_0xa3fa('0x2b')]:_0x19d094[_0xa3fa('0x29')]+_0x19d094['limit'];var _0x10a752;if(_0x213623>=_0x2699b9){_0x213623=_0x2699b9;_0x10a752=0xc8;}else{_0x10a752=0xce;}_0x51ba84[_0xa3fa('0x26')](_0x10a752);return _0x51ba84[_0xa3fa('0x2c')](_0xa3fa('0x2d'),_0x2c2655+'-'+_0x213623+'/'+_0x2699b9)[_0xa3fa('0x28')](_0xbd0c89);}return null;};}function patchUpdates(_0x2076c5){return function(_0x2d1872){try{jsonpatch[_0xa3fa('0x2e')](_0x2d1872,_0x2076c5,!![]);}catch(_0x20c3f7){return BPromise[_0xa3fa('0x2f')](_0x20c3f7);}return _0x2d1872[_0xa3fa('0x30')]();};}function saveUpdates(_0x482b19,_0x12e972){return function(_0x188f3c){if(_0x188f3c){return _0x188f3c[_0xa3fa('0x31')](_0x482b19)['then'](function(_0xb577d3){return _0xb577d3;});}return null;};}function removeEntity(_0xc98e90,_0x3f1b9d){return function(_0x54bd26){if(_0x54bd26){return _0x54bd26[_0xa3fa('0x32')]()[_0xa3fa('0x1b')](function(){var _0x38c998=_0x54bd26[_0xa3fa('0x33')]({'plain':!![]});var _0x2fcd30=_0xa3fa('0x34');return db[_0xa3fa('0x35')][_0xa3fa('0x32')]({'where':{'type':_0x2fcd30,'resourceId':_0x38c998['id']}})[_0xa3fa('0x1b')](function(){return _0x54bd26;});})[_0xa3fa('0x1b')](function(){_0xc98e90[_0xa3fa('0x26')](0xcc)[_0xa3fa('0x27')]();});}};}function handleEntityNotFound(_0x62be13,_0x1e08e5){return function(_0xa5a238){if(!_0xa5a238){_0x62be13[_0xa3fa('0x25')](0x194);}return _0xa5a238;};}function handleError(_0x2c2187,_0x56a5b1){_0x56a5b1=_0x56a5b1||0x1f4;return function(_0x1aa367){logger['error'](_0x1aa367['stack']);if(_0x1aa367['name']){delete _0x1aa367[_0xa3fa('0x36')];}_0x2c2187[_0xa3fa('0x26')](_0x56a5b1)[_0xa3fa('0x37')](_0x1aa367);};}exports[_0xa3fa('0x38')]=function(_0x51cc72,_0x4a3df6){var _0x4c2b2a={},_0x298e5b={},_0x2afafa={'count':0x0,'rows':[]};var _0x37b4b9=_['map'](db[_0xa3fa('0x39')][_0xa3fa('0x3a')],function(_0x36ff81){return{'name':_0x36ff81[_0xa3fa('0x3b')],'type':_0x36ff81[_0xa3fa('0x3c')][_0xa3fa('0x3d')]};});_0x298e5b[_0xa3fa('0x3e')]=_[_0xa3fa('0x3f')](_0x37b4b9,_0xa3fa('0x36'));_0x298e5b['query']=_[_0xa3fa('0x40')](_0x51cc72['query']);_0x298e5b[_0xa3fa('0x41')]=_[_0xa3fa('0x42')](_0x298e5b[_0xa3fa('0x3e')],_0x298e5b[_0xa3fa('0x43')]);_0x4c2b2a[_0xa3fa('0x44')]=_[_0xa3fa('0x42')](_0x298e5b[_0xa3fa('0x3e')],qs[_0xa3fa('0x45')](_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x45')]));_0x4c2b2a[_0xa3fa('0x44')]=_0x4c2b2a[_0xa3fa('0x44')]['length']?_0x4c2b2a[_0xa3fa('0x44')]:_0x298e5b['model'];if(!_0x51cc72['query'][_0xa3fa('0x46')](_0xa3fa('0x47'))){_0x4c2b2a[_0xa3fa('0x2a')]=qs[_0xa3fa('0x2a')](_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x2a')]);_0x4c2b2a[_0xa3fa('0x29')]=qs[_0xa3fa('0x29')](_0x51cc72[_0xa3fa('0x43')]['offset']);}_0x4c2b2a[_0xa3fa('0x48')]=qs[_0xa3fa('0x49')](_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x49')]);_0x4c2b2a[_0xa3fa('0x4a')]=qs[_0xa3fa('0x41')](_['pick'](_0x51cc72[_0xa3fa('0x43')],_0x298e5b[_0xa3fa('0x41')]),_0x37b4b9);if(_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x4b')]){_0x4c2b2a['where']=_['merge'](_0x4c2b2a['where'],{'$or':_[_0xa3fa('0x3f')](_0x37b4b9,function(_0x9418b1){if(_0x9418b1[_0xa3fa('0x3c')]!=='VIRTUAL'){var _0x22a011={};_0x22a011[_0x9418b1['name']]={'$like':'%'+_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x4b')]+'%'};return _0x22a011;}})});}_0x4c2b2a=_['merge']({},_0x4c2b2a,_0x51cc72[_0xa3fa('0x4c')]);var _0x18de1f={'where':_0x4c2b2a[_0xa3fa('0x4a')]};return db['VoiceContext']['count'](_0x18de1f)[_0xa3fa('0x1b')](function(_0xb24910){_0x2afafa['count']=_0xb24910;if(_0x51cc72[_0xa3fa('0x43')][_0xa3fa('0x4d')]){_0x4c2b2a[_0xa3fa('0x4e')]=[{'all':!![]}];}return db[_0xa3fa('0x39')][_0xa3fa('0x4f')](_0x4c2b2a);})['then'](function(_0x575075){_0x2afafa[_0xa3fa('0x50')]=_0x575075;return _0x2afafa;})['then'](respondWithFilteredResult(_0x4a3df6,_0x4c2b2a))['catch'](handleError(_0x4a3df6,null));};exports['show']=function(_0x16cdc4,_0x22dae7){var _0x4e9bb2={'raw':![],'where':{'id':_0x16cdc4[_0xa3fa('0x51')]['id']}},_0x447893={};_0x447893['model']=_[_0xa3fa('0x40')](db[_0xa3fa('0x39')][_0xa3fa('0x3a')]);_0x447893['query']=_[_0xa3fa('0x40')](_0x16cdc4[_0xa3fa('0x43')]);_0x447893[_0xa3fa('0x41')]=_[_0xa3fa('0x42')](_0x447893[_0xa3fa('0x3e')],_0x447893[_0xa3fa('0x43')]);_0x4e9bb2['attributes']=_[_0xa3fa('0x42')](_0x447893[_0xa3fa('0x3e')],qs[_0xa3fa('0x45')](_0x16cdc4[_0xa3fa('0x43')]['fields']));_0x4e9bb2[_0xa3fa('0x44')]=_0x4e9bb2[_0xa3fa('0x44')][_0xa3fa('0x52')]?_0x4e9bb2[_0xa3fa('0x44')]:_0x447893[_0xa3fa('0x3e')];if(_0x16cdc4[_0xa3fa('0x43')][_0xa3fa('0x4d')]){_0x4e9bb2[_0xa3fa('0x4e')]=[{'all':!![]}];}_0x4e9bb2=_[_0xa3fa('0x53')]({},_0x4e9bb2,_0x16cdc4[_0xa3fa('0x4c')]);return db[_0xa3fa('0x39')][_0xa3fa('0x54')](_0x4e9bb2)[_0xa3fa('0x1b')](handleEntityNotFound(_0x22dae7,null))['then'](respondWithResult(_0x22dae7,null))[_0xa3fa('0x24')](handleError(_0x22dae7,null));};exports[_0xa3fa('0x55')]=function(_0x56f0c4,_0xc3df7a,_0x29243d){var _0x154c17;return db['VoiceContext'][_0xa3fa('0x55')](_0x56f0c4[_0xa3fa('0x56')],{'raw':!![]})[_0xa3fa('0x1b')](function(_0x2babfe){_0x154c17=_0x2babfe;return db[_0xa3fa('0x39')][_0xa3fa('0x4f')]({'raw':!![]});})['then'](function(_0x3d1bf0){var _0x198258=fs['readFileSync'](path[_0xa3fa('0x57')](config['root'],_0xa3fa('0x58')),'utf8');var _0x56cf15=ejs['render'](_0x198258,{'contexts':_0x3d1bf0||[]});fs[_0xa3fa('0x59')](_0xa3fa('0x5a'),_0x56cf15);})[_0xa3fa('0x1b')](function(){return respondWithRpcPromise('Reload',_0xa3fa('0x55'),{'module':'chan_sip.so'});})[_0xa3fa('0x1b')](function(){var _0x569cf4=_0x56f0c4['user'][_0xa3fa('0x33')]({'plain':!![]});if(!_0x569cf4)throw new Error(_0xa3fa('0x5b'));if(_0x569cf4['role']===_0xa3fa('0x5c')){var _0x23cff0=_0x154c17[_0xa3fa('0x33')]({'plain':!![]});return db[_0xa3fa('0x5d')][_0xa3fa('0x54')]({'where':{'name':_0xa3fa('0x34'),'userProfileId':_0x569cf4[_0xa3fa('0x5e')]},'raw':!![]})['then'](function(_0x5232e7){if(_0x5232e7&&_0x5232e7['autoAssociation']===0x0){return db[_0xa3fa('0x35')][_0xa3fa('0x55')]({'name':_0x23cff0['name'],'resourceId':_0x23cff0['id'],'type':_0x5232e7[_0xa3fa('0x36')],'sectionId':_0x5232e7['id']},{})['then'](function(){return _0x154c17;});}else{return _0x154c17;}})[_0xa3fa('0x24')](function(_0x83bc0a){logger[_0xa3fa('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x83bc0a);throw _0x83bc0a;});}return _0x154c17;})[_0xa3fa('0x1b')](respondWithResult(_0xc3df7a,0xc9))[_0xa3fa('0x24')](handleError(_0xc3df7a,null));};exports[_0xa3fa('0x31')]=function(_0x3f540b,_0x4ae119,_0x47ddf2){var _0x307725;return db[_0xa3fa('0x39')][_0xa3fa('0x54')]({'where':{'id':_0x3f540b[_0xa3fa('0x51')]['id']}})[_0xa3fa('0x1b')](handleEntityNotFound(_0x4ae119,null))['then'](saveUpdates(_0x3f540b[_0xa3fa('0x56')],null))['then'](function(_0x3d00e2){if(_0x3d00e2){_0x307725=_0x3d00e2;return db[_0xa3fa('0x39')]['findAll']({'raw':!![]});}})[_0xa3fa('0x1b')](function(_0xa395c3){var _0x440727=fs['readFileSync'](path[_0xa3fa('0x57')](config[_0xa3fa('0x5f')],_0xa3fa('0x58')),'utf8');var _0x1bcd71=ejs[_0xa3fa('0x60')](_0x440727,{'contexts':_0xa395c3||[]});fs[_0xa3fa('0x59')](_0xa3fa('0x5a'),_0x1bcd71);})[_0xa3fa('0x1b')](function(){return respondWithRpcPromise('Reload',_0xa3fa('0x31'),{'module':'chan_sip.so'});})[_0xa3fa('0x1b')](function(){return _0x307725;})[_0xa3fa('0x1b')](respondWithResult(_0x4ae119,null))['catch'](handleError(_0x4ae119,null));};exports[_0xa3fa('0x32')]=function(_0x244d76,_0x55d58f,_0x100ad9){var _0x3d751b;return db[_0xa3fa('0x39')][_0xa3fa('0x54')]({'where':{'id':_0x244d76[_0xa3fa('0x51')]['id']}})[_0xa3fa('0x1b')](handleEntityNotFound(_0x55d58f,null))[_0xa3fa('0x1b')](removeEntity(_0x55d58f,null))[_0xa3fa('0x1b')](function(){return db[_0xa3fa('0x39')][_0xa3fa('0x4f')]({'raw':!![]});})['then'](function(_0x502115){var _0x2f2aec=fs['readFileSync'](path[_0xa3fa('0x57')](config['root'],_0xa3fa('0x58')),_0xa3fa('0x61'));var _0x20bb2e=ejs['render'](_0x2f2aec,{'contexts':_0x502115});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x20bb2e);return respondWithRpcPromise(_0xa3fa('0x62'),_0xa3fa('0x32'),{'module':_0xa3fa('0x63')});})[_0xa3fa('0x24')](handleError(_0x55d58f,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 87ee0e0..69cc32f 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 _0x0f8d=['util','../../config/logger','moment','bluebird','request-promise','rimraf','./voiceContext.attributes','exports','voice_contexts','lodash'];(function(_0x1defb2,_0x429099){var _0xad8973=function(_0xe26c42){while(--_0xe26c42){_0x1defb2['push'](_0x1defb2['shift']());}};_0xad8973(++_0x429099);}(_0x0f8d,0x185));var _0xd0f8=function(_0x2a2f0d,_0x56b22a){_0x2a2f0d=_0x2a2f0d-0x0;var _0x36809c=_0x0f8d[_0x2a2f0d];return _0x36809c;};'use strict';var _=require(_0xd0f8('0x0'));var util=require(_0xd0f8('0x1'));var logger=require(_0xd0f8('0x2'))('api');var moment=require(_0xd0f8('0x3'));var BPromise=require(_0xd0f8('0x4'));var rp=require(_0xd0f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0f8('0x6'));var config=require('../../config/environment');var attributes=require(_0xd0f8('0x7'));module[_0xd0f8('0x8')]=function(_0x3ec97d,_0x202090){return _0x3ec97d['define']('VoiceContext',attributes,{'tableName':_0xd0f8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb329=['./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x5be190,_0x50fd27){var _0x3b690d=function(_0x1a1063){while(--_0x1a1063){_0x5be190['push'](_0x5be190['shift']());}};_0x3b690d(++_0x50fd27);}(_0xb329,0x119));var _0x9b32=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xb329[_0x548d7d];return _0xb1c878;};'use strict';var _=require(_0x9b32('0x0'));var util=require(_0x9b32('0x1'));var logger=require(_0x9b32('0x2'))(_0x9b32('0x3'));var moment=require(_0x9b32('0x4'));var BPromise=require(_0x9b32('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b32('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b32('0x7'));module[_0x9b32('0x8')]=function(_0x204f96,_0x246734){return _0x204f96[_0x9b32('0x9')](_0x9b32('0xa'),attributes,{'tableName':_0x9b32('0xb'),'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 3d132a5..ab8fb4e 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 _0x2fe5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','message','VoiceContext,\x20%s,\x20%s','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x40ff3b,_0x238af7){var _0x3ccf4f=function(_0x397ae0){while(--_0x397ae0){_0x40ff3b['push'](_0x40ff3b['shift']());}};_0x3ccf4f(++_0x238af7);}(_0x2fe5,0x14b));var _0x52fe=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2fe5[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x52fe('0x2'));var fs=require('fs');var Redis=require(_0x52fe('0x3'));var db=require(_0x52fe('0x4'))['db'];var utils=require(_0x52fe('0x5'));var logger=require(_0x52fe('0x6'))('rpc');var config=require(_0x52fe('0x7'));var jayson=require(_0x52fe('0x8'));var client=jayson['client'][_0x52fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157c5a,_0x2b3f41,_0x31b5dd){return new BPromise(function(_0x408cef,_0x49f7d9){return client[_0x52fe('0xa')](_0x157c5a,_0x31b5dd)[_0x52fe('0xb')](function(_0xe73ece){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'));logger[_0x52fe('0xd')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2b3f41,_0x52fe('0xc'),JSON[_0x52fe('0xe')](_0xe73ece));if(_0xe73ece[_0x52fe('0xf')]){if(_0xe73ece[_0x52fe('0xf')]['code']===0x1f4){logger[_0x52fe('0xf')]('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0xe73ece[_0x52fe('0xf')]['message']);return _0x49f7d9(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}logger[_0x52fe('0xf')](_0x52fe('0x11'),_0x2b3f41,_0xe73ece['error'][_0x52fe('0x10')]);return _0x408cef(_0xe73ece[_0x52fe('0xf')][_0x52fe('0x10')]);}else{logger[_0x52fe('0x12')](_0x52fe('0x11'),_0x2b3f41,_0x52fe('0xc'));_0x408cef(_0xe73ece[_0x52fe('0x13')][_0x52fe('0x10')]);}})[_0x52fe('0x14')](function(_0x33ab22){logger['error']('VoiceContext,\x20%s,\x20%s',_0x2b3f41,_0x33ab22);_0x49f7d9(_0x33ab22);});});} \ No newline at end of file +var _0xdef9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3af95e,_0x17cf19){var _0x1e3c17=function(_0x308135){while(--_0x308135){_0x3af95e['push'](_0x3af95e['shift']());}};_0x1e3c17(++_0x17cf19);}(_0xdef9,0x1ed));var _0x9def=function(_0x24d61f,_0x38cebb){_0x24d61f=_0x24d61f-0x0;var _0x29ae79=_0xdef9[_0x24d61f];return _0x29ae79;};'use strict';var _=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var moment=require(_0x9def('0x2'));var BPromise=require(_0x9def('0x3'));var rs=require(_0x9def('0x4'));var fs=require('fs');var Redis=require(_0x9def('0x5'));var db=require(_0x9def('0x6'))['db'];var utils=require(_0x9def('0x7'));var logger=require(_0x9def('0x8'))(_0x9def('0x9'));var config=require(_0x9def('0xa'));var jayson=require(_0x9def('0xb'));var client=jayson[_0x9def('0xc')][_0x9def('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40c607,_0x25a03e,_0x42296c){return new BPromise(function(_0x1efce0,_0x8262f1){return client['request'](_0x40c607,_0x42296c)[_0x9def('0xe')](function(_0x4f0a0d){logger['info'](_0x9def('0xf'),_0x25a03e,_0x9def('0x10'));logger[_0x9def('0x11')](_0x9def('0x12'),_0x25a03e,'request\x20sent',JSON[_0x9def('0x13')](_0x4f0a0d));if(_0x4f0a0d[_0x9def('0x14')]){if(_0x4f0a0d[_0x9def('0x14')][_0x9def('0x15')]===0x1f4){logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')]['message']);return _0x8262f1(_0x4f0a0d[_0x9def('0x14')]['message']);}logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')][_0x9def('0x16')]);return _0x1efce0(_0x4f0a0d['error'][_0x9def('0x16')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x25a03e,_0x9def('0x10'));_0x1efce0(_0x4f0a0d[_0x9def('0x17')][_0x9def('0x16')]);}})[_0x9def('0x18')](function(_0x463520){logger[_0x9def('0x14')](_0x9def('0xf'),_0x25a03e,_0x463520);_0x8262f1(_0x463520);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 568594a..d753707 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 _0x682e=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0x682e,0x1ce));var _0xe682=function(_0x191460,_0x434d78){_0x191460=_0x191460-0x0;var _0x458b5a=_0x682e[_0x191460];return _0x458b5a;};'use strict';var multer=require(_0xe682('0x0'));var util=require(_0xe682('0x1'));var path=require(_0xe682('0x2'));var timeout=require(_0xe682('0x3'));var express=require(_0xe682('0x4'));var router=express[_0xe682('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe682('0x6'));var interaction=require(_0xe682('0x7'));var config=require(_0xe682('0x8'));var controller=require(_0xe682('0x9'));router[_0xe682('0xa')]('/',auth[_0xe682('0xb')](),controller[_0xe682('0xc')]);router[_0xe682('0xa')](_0xe682('0xd'),auth[_0xe682('0xb')](),controller['describe']);router[_0xe682('0xa')](_0xe682('0xe'),auth[_0xe682('0xb')](),controller[_0xe682('0xf')]);router[_0xe682('0x10')]('/',auth[_0xe682('0xb')](),controller['create']);router[_0xe682('0x11')]('/:id',auth[_0xe682('0xb')](),controller['update']);router['delete'](_0xe682('0xe'),auth[_0xe682('0xb')](),controller[_0xe682('0x12')]);module[_0xe682('0x13')]=router; \ No newline at end of file +var _0xfd4c=['put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create'];(function(_0x169ca0,_0x48d215){var _0x2ce4df=function(_0x2721ca){while(--_0x2721ca){_0x169ca0['push'](_0x169ca0['shift']());}};_0x2ce4df(++_0x48d215);}(_0xfd4c,0x1bd));var _0xcfd4=function(_0xf4825a,_0x2bc9b7){_0xf4825a=_0xf4825a-0x0;var _0x92de9f=_0xfd4c[_0xf4825a];return _0x92de9f;};'use strict';var multer=require(_0xcfd4('0x0'));var util=require(_0xcfd4('0x1'));var path=require(_0xcfd4('0x2'));var timeout=require(_0xcfd4('0x3'));var express=require(_0xcfd4('0x4'));var router=express[_0xcfd4('0x5')]();var fs_extra=require(_0xcfd4('0x6'));var auth=require(_0xcfd4('0x7'));var interaction=require(_0xcfd4('0x8'));var config=require('../../config/environment');var controller=require(_0xcfd4('0x9'));router[_0xcfd4('0xa')]('/',auth[_0xcfd4('0xb')](),controller['index']);router['get'](_0xcfd4('0xc'),auth[_0xcfd4('0xb')](),controller[_0xcfd4('0xd')]);router[_0xcfd4('0xa')](_0xcfd4('0xe'),auth[_0xcfd4('0xb')](),controller[_0xcfd4('0xf')]);router['post']('/',auth[_0xcfd4('0xb')](),controller[_0xcfd4('0x10')]);router[_0xcfd4('0x11')](_0xcfd4('0xe'),auth[_0xcfd4('0xb')](),controller[_0xcfd4('0x12')]);router[_0xcfd4('0x13')](_0xcfd4('0xe'),auth[_0xcfd4('0xb')](),controller['destroy']);module[_0xcfd4('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 04bd127..3fb2016 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 _0x55ca=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x3f9d1d,_0x3fc4dd){var _0x4be18a=function(_0x11efd8){while(--_0x11efd8){_0x3f9d1d['push'](_0x3f9d1d['shift']());}};_0x4be18a(++_0x3fc4dd);}(_0x55ca,0x126));var _0xa55c=function(_0x316904,_0x1e8b77){_0x316904=_0x316904-0x0;var _0xfa9a21=_0x55ca[_0x316904];return _0xfa9a21;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'calleridnum':{'type':Sequelize[_0xa55c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xa55c('0x2')]},'connectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'language':{'type':Sequelize[_0xa55c('0x2')]},'accountcode':{'type':Sequelize[_0xa55c('0x2')]},'context':{'type':Sequelize[_0xa55c('0x2')]},'exten':{'type':Sequelize[_0xa55c('0x2')]},'priority':{'type':Sequelize[_0xa55c('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xa55c('0x2')]},'destchannel':{'type':Sequelize[_0xa55c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa55c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xa55c('0x2')]},'destlanguage':{'type':Sequelize[_0xa55c('0x2')]},'destaccountcode':{'type':Sequelize[_0xa55c('0x2')]},'destcontext':{'type':Sequelize[_0xa55c('0x2')]},'destexten':{'type':Sequelize[_0xa55c('0x2')]},'destpriority':{'type':Sequelize[_0xa55c('0x3')]},'destuniqueid':{'type':Sequelize[_0xa55c('0x2')]},'destlinkedid':{'type':Sequelize[_0xa55c('0x2')]},'dialstring':{'type':Sequelize[_0xa55c('0x2')]},'dialstatus':{'type':Sequelize[_0xa55c('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xa55c('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xa55c('0x3')]},'holdtime':{'type':Sequelize[_0xa55c('0x3')]},'billableseconds':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file +var _0xbec5=['called,connect,complete','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x2ca84b,_0x183f76){var _0x2cedbb=function(_0x4bc5d9){while(--_0x4bc5d9){_0x2ca84b['push'](_0x2ca84b['shift']());}};_0x2cedbb(++_0x183f76);}(_0xbec5,0xe5));var _0x5bec=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xbec5[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x5bec('0x0'));module[_0x5bec('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5bec('0x2')]},'channelstate':{'type':Sequelize[_0x5bec('0x3')]},'channelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'calleridnum':{'type':Sequelize[_0x5bec('0x2')]},'calleridname':{'type':Sequelize[_0x5bec('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x5bec('0x2')]},'language':{'type':Sequelize[_0x5bec('0x2')]},'accountcode':{'type':Sequelize[_0x5bec('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x5bec('0x2')]},'priority':{'type':Sequelize[_0x5bec('0x3')]},'uniqueid':{'type':Sequelize[_0x5bec('0x2')]},'linkedid':{'type':Sequelize[_0x5bec('0x2')]},'destchannel':{'type':Sequelize[_0x5bec('0x2')]},'destchannelstate':{'type':Sequelize[_0x5bec('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridnum':{'type':Sequelize[_0x5bec('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x5bec('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x5bec('0x2')]},'destaccountcode':{'type':Sequelize[_0x5bec('0x2')]},'destcontext':{'type':Sequelize[_0x5bec('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x5bec('0x3')]},'destuniqueid':{'type':Sequelize[_0x5bec('0x2')]},'destlinkedid':{'type':Sequelize[_0x5bec('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x5bec('0x2')]},'starttime':{'type':Sequelize[_0x5bec('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x5bec('0x4')]},'lastevent':{'type':Sequelize[_0x5bec('0x2')],'comment':_0x5bec('0x5')},'routeId':{'type':Sequelize[_0x5bec('0x3')]},'duration':{'type':Sequelize[_0x5bec('0x3')]},'holdtime':{'type':Sequelize[_0x5bec('0x3')]},'billableseconds':{'type':Sequelize[_0x5bec('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 55896e5..82c7796 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 _0x0a7c=['../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','sendStatus','stack','name','send','index','map','VoiceDialReport','fieldName','type','key','keys','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x1c21f7,_0x474549){var _0x119f60=function(_0x5eddab){while(--_0x5eddab){_0x1c21f7['push'](_0x1c21f7['shift']());}};_0x119f60(++_0x474549);}(_0x0a7c,0x1a6));var _0xc0a7=function(_0x46ce21,_0x254327){_0x46ce21=_0x46ce21-0x0;var _0x4901ba=_0x0a7c[_0x46ce21];return _0x4901ba;};'use strict';var emlformat=require(_0xc0a7('0x0'));var rimraf=require(_0xc0a7('0x1'));var zipdir=require(_0xc0a7('0x2'));var jsonpatch=require(_0xc0a7('0x3'));var rp=require(_0xc0a7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc0a7('0x5'));var util=require(_0xc0a7('0x6'));var path=require(_0xc0a7('0x7'));var sox=require(_0xc0a7('0x8'));var csv=require(_0xc0a7('0x9'));var ejs=require(_0xc0a7('0xa'));var fs=require('fs');var fs_extra=require(_0xc0a7('0xb'));var _=require('lodash');var squel=require(_0xc0a7('0xc'));var crypto=require('crypto');var jsforce=require(_0xc0a7('0xd'));var deskjs=require(_0xc0a7('0xe'));var toCsv=require(_0xc0a7('0x9'));var querystring=require(_0xc0a7('0xf'));var Papa=require(_0xc0a7('0x10'));var Redis=require(_0xc0a7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc0a7('0x12'));var as=require(_0xc0a7('0x13'));var hardwareService=require(_0xc0a7('0x14'));var logger=require('../../config/logger')(_0xc0a7('0x15'));var utils=require(_0xc0a7('0x16'));var config=require(_0xc0a7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc0a7('0x18'))['db'];function respondWithStatusCode(_0x3ae11a,_0xfffd22){_0xfffd22=_0xfffd22||0xcc;return function(_0x24e45d){if(_0x24e45d){return _0x3ae11a['sendStatus'](_0xfffd22);}return _0x3ae11a[_0xc0a7('0x19')](_0xfffd22)[_0xc0a7('0x1a')]();};}function respondWithResult(_0x5277f1,_0x1db16b){_0x1db16b=_0x1db16b||0xc8;return function(_0x138149){if(_0x138149){return _0x5277f1[_0xc0a7('0x19')](_0x1db16b)[_0xc0a7('0x1b')](_0x138149);}};}function respondWithFilteredResult(_0x31a5fb,_0x1d6c5c){return function(_0xce907d){if(_0xce907d){var _0x5b2451=typeof _0x1d6c5c['offset']===_0xc0a7('0x1c')&&typeof _0x1d6c5c[_0xc0a7('0x1d')]===_0xc0a7('0x1c');var _0x439859=_0xce907d[_0xc0a7('0x1e')];var _0x561732=_0x5b2451?0x0:_0x1d6c5c[_0xc0a7('0x1f')];var _0x43dbc7=_0x5b2451?_0xce907d[_0xc0a7('0x1e')]:_0x1d6c5c[_0xc0a7('0x1f')]+_0x1d6c5c[_0xc0a7('0x1d')];var _0x19a6d5;if(_0x43dbc7>=_0x439859){_0x43dbc7=_0x439859;_0x19a6d5=0xc8;}else{_0x19a6d5=0xce;}_0x31a5fb[_0xc0a7('0x19')](_0x19a6d5);return _0x31a5fb[_0xc0a7('0x20')](_0xc0a7('0x21'),_0x561732+'-'+_0x43dbc7+'/'+_0x439859)[_0xc0a7('0x1b')](_0xce907d);}return null;};}function patchUpdates(_0x4a0499){return function(_0x4adc10){try{jsonpatch[_0xc0a7('0x22')](_0x4adc10,_0x4a0499,!![]);}catch(_0x456823){return BPromise['reject'](_0x456823);}return _0x4adc10['save']();};}function saveUpdates(_0x4dd9bd,_0x3a617f){return function(_0x207b3f){if(_0x207b3f){return _0x207b3f[_0xc0a7('0x23')](_0x4dd9bd)[_0xc0a7('0x24')](function(_0x1f40e0){return _0x1f40e0;});}return null;};}function removeEntity(_0x3f54c3,_0x4a7b41){return function(_0x597181){if(_0x597181){return _0x597181['destroy']()[_0xc0a7('0x24')](function(){_0x3f54c3[_0xc0a7('0x19')](0xcc)[_0xc0a7('0x1a')]();});}};}function handleEntityNotFound(_0xf64e84,_0x33e957){return function(_0x5c8f26){if(!_0x5c8f26){_0xf64e84[_0xc0a7('0x25')](0x194);}return _0x5c8f26;};}function handleError(_0x1068ac,_0x358073){_0x358073=_0x358073||0x1f4;return function(_0x4ad89e){logger['error'](_0x4ad89e[_0xc0a7('0x26')]);if(_0x4ad89e[_0xc0a7('0x27')]){delete _0x4ad89e[_0xc0a7('0x27')];}_0x1068ac[_0xc0a7('0x19')](_0x358073)[_0xc0a7('0x28')](_0x4ad89e);};}exports[_0xc0a7('0x29')]=function(_0x5a4da3,_0x40b7e3){var _0x32b509={},_0x575a77={},_0x559d7f={'count':0x0,'rows':[]};var _0x232be5=_[_0xc0a7('0x2a')](db[_0xc0a7('0x2b')]['rawAttributes'],function(_0x586a5d){return{'name':_0x586a5d[_0xc0a7('0x2c')],'type':_0x586a5d[_0xc0a7('0x2d')][_0xc0a7('0x2e')]};});_0x575a77['model']=_[_0xc0a7('0x2a')](_0x232be5,_0xc0a7('0x27'));_0x575a77['query']=_[_0xc0a7('0x2f')](_0x5a4da3['query']);_0x575a77['filters']=_['intersection'](_0x575a77[_0xc0a7('0x30')],_0x575a77[_0xc0a7('0x31')]);_0x32b509['attributes']=_[_0xc0a7('0x32')](_0x575a77['model'],qs[_0xc0a7('0x33')](_0x5a4da3[_0xc0a7('0x31')]['fields']));_0x32b509[_0xc0a7('0x34')]=_0x32b509[_0xc0a7('0x34')][_0xc0a7('0x35')]?_0x32b509[_0xc0a7('0x34')]:_0x575a77[_0xc0a7('0x30')];if(!_0x5a4da3[_0xc0a7('0x31')]['hasOwnProperty'](_0xc0a7('0x36'))){_0x32b509[_0xc0a7('0x1d')]=qs[_0xc0a7('0x1d')](_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x1d')]);_0x32b509['offset']=qs[_0xc0a7('0x1f')](_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x1f')]);}_0x32b509['order']=qs[_0xc0a7('0x37')](_0x5a4da3['query']['sort']);_0x32b509[_0xc0a7('0x38')]=qs[_0xc0a7('0x39')](_['pick'](_0x5a4da3['query'],_0x575a77['filters']),_0x232be5);if(_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3a')]){_0x32b509['where']=_['merge'](_0x32b509[_0xc0a7('0x38')],{'$or':_[_0xc0a7('0x2a')](_0x232be5,function(_0x292d5e){if(_0x292d5e[_0xc0a7('0x2d')]!==_0xc0a7('0x3b')){var _0x3b1f83={};_0x3b1f83[_0x292d5e[_0xc0a7('0x27')]]={'$like':'%'+_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3a')]+'%'};return _0x3b1f83;}})});}_0x32b509=_[_0xc0a7('0x3c')]({},_0x32b509,_0x5a4da3[_0xc0a7('0x3d')]);var _0x1ddfe8={'where':_0x32b509[_0xc0a7('0x38')]};return db[_0xc0a7('0x2b')][_0xc0a7('0x1e')](_0x1ddfe8)['then'](function(_0xef46c3){_0x559d7f[_0xc0a7('0x1e')]=_0xef46c3;if(_0x5a4da3[_0xc0a7('0x31')][_0xc0a7('0x3e')]){_0x32b509[_0xc0a7('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xc0a7('0x40')](_0x32b509);})[_0xc0a7('0x24')](function(_0x51ce99){_0x559d7f['rows']=_0x51ce99;return _0x559d7f;})['then'](respondWithFilteredResult(_0x40b7e3,_0x32b509))['catch'](handleError(_0x40b7e3,null));};exports[_0xc0a7('0x41')]=function(_0x3c2a04,_0x34a249){var _0x56941a={'raw':!![],'where':{'id':_0x3c2a04[_0xc0a7('0x42')]['id']}},_0x1aa4fe={};_0x1aa4fe[_0xc0a7('0x30')]=_[_0xc0a7('0x2f')](db[_0xc0a7('0x2b')][_0xc0a7('0x43')]);_0x1aa4fe[_0xc0a7('0x31')]=_['keys'](_0x3c2a04['query']);_0x1aa4fe[_0xc0a7('0x39')]=_[_0xc0a7('0x32')](_0x1aa4fe[_0xc0a7('0x30')],_0x1aa4fe[_0xc0a7('0x31')]);_0x56941a[_0xc0a7('0x34')]=_[_0xc0a7('0x32')](_0x1aa4fe[_0xc0a7('0x30')],qs[_0xc0a7('0x33')](_0x3c2a04[_0xc0a7('0x31')][_0xc0a7('0x33')]));_0x56941a[_0xc0a7('0x34')]=_0x56941a['attributes'][_0xc0a7('0x35')]?_0x56941a[_0xc0a7('0x34')]:_0x1aa4fe[_0xc0a7('0x30')];if(_0x3c2a04['query'][_0xc0a7('0x3e')]){_0x56941a[_0xc0a7('0x3f')]=[{'all':!![]}];}_0x56941a=_[_0xc0a7('0x3c')]({},_0x56941a,_0x3c2a04[_0xc0a7('0x3d')]);return db[_0xc0a7('0x2b')][_0xc0a7('0x44')](_0x56941a)[_0xc0a7('0x24')](handleEntityNotFound(_0x34a249,null))[_0xc0a7('0x24')](respondWithResult(_0x34a249,null))[_0xc0a7('0x45')](handleError(_0x34a249,null));};exports[_0xc0a7('0x46')]=function(_0x49fe21,_0x3206b5){return db[_0xc0a7('0x2b')]['create'](_0x49fe21[_0xc0a7('0x47')],{})[_0xc0a7('0x24')](respondWithResult(_0x3206b5,0xc9))['catch'](handleError(_0x3206b5,null));};exports['update']=function(_0x1a6286,_0x50873b){if(_0x1a6286[_0xc0a7('0x47')]['id']){delete _0x1a6286[_0xc0a7('0x47')]['id'];}return db[_0xc0a7('0x2b')][_0xc0a7('0x44')]({'where':{'id':_0x1a6286[_0xc0a7('0x42')]['id']}})[_0xc0a7('0x24')](handleEntityNotFound(_0x50873b,null))[_0xc0a7('0x24')](saveUpdates(_0x1a6286[_0xc0a7('0x47')],null))['then'](respondWithResult(_0x50873b,null))[_0xc0a7('0x45')](handleError(_0x50873b,null));};exports[_0xc0a7('0x48')]=function(_0x2e8a86,_0x27b673){return db[_0xc0a7('0x2b')]['find']({'where':{'id':_0x2e8a86['params']['id']}})[_0xc0a7('0x24')](handleEntityNotFound(_0x27b673,null))['then'](removeEntity(_0x27b673,null))[_0xc0a7('0x45')](handleError(_0x27b673,null));};exports[_0xc0a7('0x49')]=function(_0x228f2f,_0x4b798c){return db['VoiceDialReport'][_0xc0a7('0x49')]()[_0xc0a7('0x24')](respondWithResult(_0x4b798c,null))[_0xc0a7('0x45')](handleError(_0x4b798c,null));}; \ No newline at end of file +var _0xfd9a=['set','Content-Range','json','reject','update','then','destroy','sendStatus','stack','name','send','VoiceDialReport','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','findAll','catch','params','includeAll','include','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count'];(function(_0x4cff96,_0x584782){var _0x39dd96=function(_0x4655fd){while(--_0x4655fd){_0x4cff96['push'](_0x4cff96['shift']());}};_0x39dd96(++_0x584782);}(_0xfd9a,0x108));var _0xafd9=function(_0x150ee9,_0x14dcd0){_0x150ee9=_0x150ee9-0x0;var _0x39d181=_0xfd9a[_0x150ee9];return _0x39d181;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xafd9('0x0'));var zipdir=require(_0xafd9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xafd9('0x2'));var moment=require(_0xafd9('0x3'));var BPromise=require(_0xafd9('0x4'));var Mustache=require(_0xafd9('0x5'));var util=require(_0xafd9('0x6'));var path=require(_0xafd9('0x7'));var sox=require(_0xafd9('0x8'));var csv=require(_0xafd9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafd9('0xa'));var squel=require(_0xafd9('0xb'));var crypto=require(_0xafd9('0xc'));var jsforce=require(_0xafd9('0xd'));var deskjs=require(_0xafd9('0xe'));var toCsv=require(_0xafd9('0x9'));var querystring=require(_0xafd9('0xf'));var Papa=require(_0xafd9('0x10'));var Redis=require(_0xafd9('0x11'));var authService=require(_0xafd9('0x12'));var qs=require(_0xafd9('0x13'));var as=require(_0xafd9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xafd9('0x15'))('api');var utils=require(_0xafd9('0x16'));var config=require(_0xafd9('0x17'));var licenseUtil=require(_0xafd9('0x18'));var db=require(_0xafd9('0x19'))['db'];function respondWithStatusCode(_0x1412ad,_0x3acbf4){_0x3acbf4=_0x3acbf4||0xcc;return function(_0x17a955){if(_0x17a955){return _0x1412ad['sendStatus'](_0x3acbf4);}return _0x1412ad[_0xafd9('0x1a')](_0x3acbf4)[_0xafd9('0x1b')]();};}function respondWithResult(_0x27e5c3,_0x4012cf){_0x4012cf=_0x4012cf||0xc8;return function(_0x233e65){if(_0x233e65){return _0x27e5c3[_0xafd9('0x1a')](_0x4012cf)['json'](_0x233e65);}};}function respondWithFilteredResult(_0x1fd547,_0x3c52a0){return function(_0xe2c173){if(_0xe2c173){var _0x573b4b=typeof _0x3c52a0[_0xafd9('0x1c')]==='undefined'&&typeof _0x3c52a0[_0xafd9('0x1d')]===_0xafd9('0x1e');var _0x4e6220=_0xe2c173[_0xafd9('0x1f')];var _0x38866b=_0x573b4b?0x0:_0x3c52a0[_0xafd9('0x1c')];var _0x57dabd=_0x573b4b?_0xe2c173['count']:_0x3c52a0['offset']+_0x3c52a0[_0xafd9('0x1d')];var _0x2904f9;if(_0x57dabd>=_0x4e6220){_0x57dabd=_0x4e6220;_0x2904f9=0xc8;}else{_0x2904f9=0xce;}_0x1fd547[_0xafd9('0x1a')](_0x2904f9);return _0x1fd547[_0xafd9('0x20')](_0xafd9('0x21'),_0x38866b+'-'+_0x57dabd+'/'+_0x4e6220)[_0xafd9('0x22')](_0xe2c173);}return null;};}function patchUpdates(_0x48eb04){return function(_0x325bdd){try{jsonpatch['apply'](_0x325bdd,_0x48eb04,!![]);}catch(_0x517df0){return BPromise[_0xafd9('0x23')](_0x517df0);}return _0x325bdd['save']();};}function saveUpdates(_0x3ef156,_0x44da1d){return function(_0x21d5cd){if(_0x21d5cd){return _0x21d5cd[_0xafd9('0x24')](_0x3ef156)[_0xafd9('0x25')](function(_0xb295bc){return _0xb295bc;});}return null;};}function removeEntity(_0x45a528,_0x36e04d){return function(_0x50a32a){if(_0x50a32a){return _0x50a32a[_0xafd9('0x26')]()['then'](function(){_0x45a528['status'](0xcc)[_0xafd9('0x1b')]();});}};}function handleEntityNotFound(_0x559603,_0x435f4a){return function(_0x18b537){if(!_0x18b537){_0x559603[_0xafd9('0x27')](0x194);}return _0x18b537;};}function handleError(_0x47d312,_0x15c790){_0x15c790=_0x15c790||0x1f4;return function(_0x46d2cb){logger['error'](_0x46d2cb[_0xafd9('0x28')]);if(_0x46d2cb[_0xafd9('0x29')]){delete _0x46d2cb[_0xafd9('0x29')];}_0x47d312[_0xafd9('0x1a')](_0x15c790)[_0xafd9('0x2a')](_0x46d2cb);};}exports['index']=function(_0x2b73ce,_0x97c5a5){var _0x380cdd={},_0x1f4d8a={},_0x327b12={'count':0x0,'rows':[]};var _0x163efe=_['map'](db[_0xafd9('0x2b')]['rawAttributes'],function(_0x2cf79b){return{'name':_0x2cf79b[_0xafd9('0x2c')],'type':_0x2cf79b[_0xafd9('0x2d')][_0xafd9('0x2e')]};});_0x1f4d8a[_0xafd9('0x2f')]=_[_0xafd9('0x30')](_0x163efe,_0xafd9('0x29'));_0x1f4d8a['query']=_[_0xafd9('0x31')](_0x2b73ce[_0xafd9('0x32')]);_0x1f4d8a['filters']=_[_0xafd9('0x33')](_0x1f4d8a[_0xafd9('0x2f')],_0x1f4d8a[_0xafd9('0x32')]);_0x380cdd[_0xafd9('0x34')]=_['intersection'](_0x1f4d8a[_0xafd9('0x2f')],qs[_0xafd9('0x35')](_0x2b73ce[_0xafd9('0x32')]['fields']));_0x380cdd[_0xafd9('0x34')]=_0x380cdd[_0xafd9('0x34')][_0xafd9('0x36')]?_0x380cdd[_0xafd9('0x34')]:_0x1f4d8a[_0xafd9('0x2f')];if(!_0x2b73ce[_0xafd9('0x32')][_0xafd9('0x37')](_0xafd9('0x38'))){_0x380cdd[_0xafd9('0x1d')]=qs[_0xafd9('0x1d')](_0x2b73ce[_0xafd9('0x32')][_0xafd9('0x1d')]);_0x380cdd[_0xafd9('0x1c')]=qs[_0xafd9('0x1c')](_0x2b73ce[_0xafd9('0x32')][_0xafd9('0x1c')]);}_0x380cdd['order']=qs['sort'](_0x2b73ce[_0xafd9('0x32')][_0xafd9('0x39')]);_0x380cdd[_0xafd9('0x3a')]=qs[_0xafd9('0x3b')](_[_0xafd9('0x3c')](_0x2b73ce[_0xafd9('0x32')],_0x1f4d8a[_0xafd9('0x3b')]),_0x163efe);if(_0x2b73ce['query'][_0xafd9('0x3d')]){_0x380cdd['where']=_['merge'](_0x380cdd[_0xafd9('0x3a')],{'$or':_['map'](_0x163efe,function(_0x3c88a7){if(_0x3c88a7['type']!==_0xafd9('0x3e')){var _0x52c0b={};_0x52c0b[_0x3c88a7[_0xafd9('0x29')]]={'$like':'%'+_0x2b73ce[_0xafd9('0x32')][_0xafd9('0x3d')]+'%'};return _0x52c0b;}})});}_0x380cdd=_[_0xafd9('0x3f')]({},_0x380cdd,_0x2b73ce[_0xafd9('0x40')]);var _0x47ddb={'where':_0x380cdd[_0xafd9('0x3a')]};return db[_0xafd9('0x2b')][_0xafd9('0x1f')](_0x47ddb)[_0xafd9('0x25')](function(_0x271e5a){_0x327b12[_0xafd9('0x1f')]=_0x271e5a;if(_0x2b73ce[_0xafd9('0x32')]['includeAll']){_0x380cdd['include']=[{'all':!![]}];}return db[_0xafd9('0x2b')][_0xafd9('0x41')](_0x380cdd);})[_0xafd9('0x25')](function(_0x4f7363){_0x327b12['rows']=_0x4f7363;return _0x327b12;})[_0xafd9('0x25')](respondWithFilteredResult(_0x97c5a5,_0x380cdd))[_0xafd9('0x42')](handleError(_0x97c5a5,null));};exports['show']=function(_0x57311f,_0x51754b){var _0x38afb3={'raw':!![],'where':{'id':_0x57311f[_0xafd9('0x43')]['id']}},_0xba3e8d={};_0xba3e8d[_0xafd9('0x2f')]=_[_0xafd9('0x31')](db[_0xafd9('0x2b')]['rawAttributes']);_0xba3e8d[_0xafd9('0x32')]=_[_0xafd9('0x31')](_0x57311f[_0xafd9('0x32')]);_0xba3e8d[_0xafd9('0x3b')]=_[_0xafd9('0x33')](_0xba3e8d[_0xafd9('0x2f')],_0xba3e8d[_0xafd9('0x32')]);_0x38afb3[_0xafd9('0x34')]=_[_0xafd9('0x33')](_0xba3e8d['model'],qs[_0xafd9('0x35')](_0x57311f[_0xafd9('0x32')][_0xafd9('0x35')]));_0x38afb3[_0xafd9('0x34')]=_0x38afb3[_0xafd9('0x34')][_0xafd9('0x36')]?_0x38afb3[_0xafd9('0x34')]:_0xba3e8d[_0xafd9('0x2f')];if(_0x57311f[_0xafd9('0x32')][_0xafd9('0x44')]){_0x38afb3[_0xafd9('0x45')]=[{'all':!![]}];}_0x38afb3=_['merge']({},_0x38afb3,_0x57311f[_0xafd9('0x40')]);return db[_0xafd9('0x2b')][_0xafd9('0x46')](_0x38afb3)[_0xafd9('0x25')](handleEntityNotFound(_0x51754b,null))[_0xafd9('0x25')](respondWithResult(_0x51754b,null))[_0xafd9('0x42')](handleError(_0x51754b,null));};exports[_0xafd9('0x47')]=function(_0xc2a75e,_0x3ea064){return db[_0xafd9('0x2b')][_0xafd9('0x47')](_0xc2a75e[_0xafd9('0x48')],{})[_0xafd9('0x25')](respondWithResult(_0x3ea064,0xc9))['catch'](handleError(_0x3ea064,null));};exports[_0xafd9('0x24')]=function(_0xb5d96d,_0x5bd8df){if(_0xb5d96d[_0xafd9('0x48')]['id']){delete _0xb5d96d['body']['id'];}return db[_0xafd9('0x2b')][_0xafd9('0x46')]({'where':{'id':_0xb5d96d[_0xafd9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5bd8df,null))[_0xafd9('0x25')](saveUpdates(_0xb5d96d['body'],null))['then'](respondWithResult(_0x5bd8df,null))[_0xafd9('0x42')](handleError(_0x5bd8df,null));};exports[_0xafd9('0x26')]=function(_0x319a22,_0x30e658){return db['VoiceDialReport'][_0xafd9('0x46')]({'where':{'id':_0x319a22[_0xafd9('0x43')]['id']}})['then'](handleEntityNotFound(_0x30e658,null))[_0xafd9('0x25')](removeEntity(_0x30e658,null))[_0xafd9('0x42')](handleError(_0x30e658,null));};exports[_0xafd9('0x49')]=function(_0x205fc0,_0x23dcba){return db[_0xafd9('0x2b')][_0xafd9('0x49')]()[_0xafd9('0x25')](respondWithResult(_0x23dcba,null))[_0xafd9('0x42')](handleError(_0x23dcba,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 019727f..13f98b1 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 _0xf569=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceDialReport.attributes','VoiceDialReport','report_dial','util'];(function(_0x2c3517,_0x513b08){var _0x2be0a6=function(_0x45bae1){while(--_0x45bae1){_0x2c3517['push'](_0x2c3517['shift']());}};_0x2be0a6(++_0x513b08);}(_0xf569,0xd0));var _0x9f56=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xf569[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var logger=require(_0x9f56('0x1'))(_0x9f56('0x2'));var moment=require(_0x9f56('0x3'));var BPromise=require(_0x9f56('0x4'));var rp=require(_0x9f56('0x5'));var fs=require('fs');var path=require(_0x9f56('0x6'));var rimraf=require(_0x9f56('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f56('0x8'));module['exports']=function(_0x467a46,_0x3488f2){return _0x467a46['define'](_0x9f56('0x9'),attributes,{'tableName':_0x9f56('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa3b4=['exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes'];(function(_0xea34ca,_0x31054a){var _0xe6c09c=function(_0x230395){while(--_0x230395){_0xea34ca['push'](_0xea34ca['shift']());}};_0xe6c09c(++_0x31054a);}(_0xa3b4,0x130));var _0x4a3b=function(_0x4a1b04,_0x3dd301){_0x4a1b04=_0x4a1b04-0x0;var _0x44b4c9=_0xa3b4[_0x4a1b04];return _0x44b4c9;};'use strict';var _=require('lodash');var util=require(_0x4a3b('0x0'));var logger=require(_0x4a3b('0x1'))(_0x4a3b('0x2'));var moment=require(_0x4a3b('0x3'));var BPromise=require(_0x4a3b('0x4'));var rp=require(_0x4a3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a3b('0x6'));var attributes=require(_0x4a3b('0x7'));module[_0x4a3b('0x8')]=function(_0x3acfed,_0x4b6b77){return _0x3acfed[_0x4a3b('0x9')](_0x4a3b('0xa'),attributes,{'tableName':_0x4a3b('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4a3b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 75e6b0a..34c341e 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 _0x42da=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','limit','util','bluebird','randomstring'];(function(_0x28d8bd,_0x2a9333){var _0x4eacd4=function(_0x52d2a0){while(--_0x52d2a0){_0x28d8bd['push'](_0x28d8bd['shift']());}};_0x4eacd4(++_0x2a9333);}(_0x42da,0x11d));var _0xa42d=function(_0x2846b3,_0x58897b){_0x2846b3=_0x2846b3-0x0;var _0x19e97a=_0x42da[_0x2846b3];return _0x19e97a;};'use strict';var _=require('lodash');var util=require(_0xa42d('0x0'));var moment=require('moment');var BPromise=require(_0xa42d('0x1'));var rs=require(_0xa42d('0x2'));var fs=require('fs');var Redis=require(_0xa42d('0x3'));var db=require(_0xa42d('0x4'))['db'];var utils=require(_0xa42d('0x5'));var logger=require('../../config/logger')(_0xa42d('0x6'));var config=require(_0xa42d('0x7'));var jayson=require(_0xa42d('0x8'));var client=jayson[_0xa42d('0x9')][_0xa42d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de4cb,_0x2bc3e4,_0x2b9dbc){return new BPromise(function(_0x4c98c4,_0x4b2793){return client[_0xa42d('0xb')](_0x1de4cb,_0x2b9dbc)[_0xa42d('0xc')](function(_0x3fb4dd){logger[_0xa42d('0xd')](_0xa42d('0xe'),_0x2bc3e4,_0xa42d('0xf'));logger[_0xa42d('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2bc3e4,_0xa42d('0xf'),JSON[_0xa42d('0x11')](_0x3fb4dd));if(_0x3fb4dd[_0xa42d('0x12')]){if(_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x13')]===0x1f4){logger[_0xa42d('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x2bc3e4,_0x3fb4dd['error'][_0xa42d('0x14')]);return _0x4b2793(_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x14')]);}logger['error'](_0xa42d('0xe'),_0x2bc3e4,_0x3fb4dd[_0xa42d('0x12')][_0xa42d('0x14')]);return _0x4c98c4(_0x3fb4dd['error'][_0xa42d('0x14')]);}else{logger['info'](_0xa42d('0xe'),_0x2bc3e4,_0xa42d('0xf'));_0x4c98c4(_0x3fb4dd[_0xa42d('0x15')][_0xa42d('0x14')]);}})[_0xa42d('0x16')](function(_0x2f451b){logger['error'](_0xa42d('0xe'),_0x2bc3e4,_0x2f451b);_0x4b2793(_0x2f451b);});});}exports[_0xa42d('0x17')]=function(_0x1e256c){var _0x3f47e7=this;return new Promise(function(_0x49e01c,_0x352dd8){return db[_0xa42d('0x18')][_0xa42d('0x19')](_0x1e256c[_0xa42d('0x1a')],{'raw':_0x1e256c[_0xa42d('0x1b')]?_0x1e256c[_0xa42d('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2a8b86){logger[_0xa42d('0xd')]('CreateVoiceDialReport',_0x1e256c);logger[_0xa42d('0x10')](_0xa42d('0x17'),_0x1e256c,JSON[_0xa42d('0x11')](_0x2a8b86));_0x49e01c(_0x2a8b86);})[_0xa42d('0x16')](function(_0x28d244){logger[_0xa42d('0x12')]('CreateVoiceDialReport',_0x28d244['message'],_0x1e256c);_0x352dd8(_0x3f47e7[_0xa42d('0x12')](0x1f4,_0x28d244['message']));});});};exports[_0xa42d('0x1c')]=function(_0x53eb17){var _0x23c633=this;return new Promise(function(_0x3eb10b,_0x58503c){return db[_0xa42d('0x18')][_0xa42d('0x1d')](_0x53eb17[_0xa42d('0x1a')],{'raw':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')][_0xa42d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')]['where']||null:null,'attributes':_0x53eb17[_0xa42d('0x1b')]?_0x53eb17['options']['attributes']||null:null,'limit':_0x53eb17['options']?_0x53eb17[_0xa42d('0x1b')][_0xa42d('0x1f')]||null:null})['then'](function(_0x509172){logger[_0xa42d('0xd')](_0xa42d('0x1c'),_0x53eb17);logger[_0xa42d('0x10')](_0xa42d('0x1c'),_0x53eb17,JSON[_0xa42d('0x11')](_0x509172));_0x3eb10b(_0x509172);})[_0xa42d('0x16')](function(_0x414b9a){logger['error']('UpdateVoiceDialReport',_0x414b9a['message'],_0x53eb17);_0x58503c(_0x23c633[_0xa42d('0x12')](0x1f4,_0x414b9a['message']));});});}; \ No newline at end of file +var _0xe238=['client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','UpdateVoiceDialReport','update','body','raw','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3a597e,_0x335c69){var _0x79826=function(_0x417756){while(--_0x417756){_0x3a597e['push'](_0x3a597e['shift']());}};_0x79826(++_0x335c69);}(_0xe238,0x1b6));var _0x8e23=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe238[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x8e23('0x0'));var util=require('util');var moment=require(_0x8e23('0x1'));var BPromise=require(_0x8e23('0x2'));var rs=require(_0x8e23('0x3'));var fs=require('fs');var Redis=require(_0x8e23('0x4'));var db=require(_0x8e23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e23('0x6'))(_0x8e23('0x7'));var config=require(_0x8e23('0x8'));var jayson=require(_0x8e23('0x9'));var client=jayson[_0x8e23('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x945032,_0x4b7807,_0x39ad6d){return new BPromise(function(_0x38c551,_0xf81c6a){return client[_0x8e23('0xb')](_0x945032,_0x39ad6d)[_0x8e23('0xc')](function(_0x196675){logger[_0x8e23('0xd')](_0x8e23('0xe'),_0x4b7807,_0x8e23('0xf'));logger[_0x8e23('0x10')](_0x8e23('0x11'),_0x4b7807,_0x8e23('0xf'),JSON[_0x8e23('0x12')](_0x196675));if(_0x196675[_0x8e23('0x13')]){if(_0x196675['error'][_0x8e23('0x14')]===0x1f4){logger[_0x8e23('0x13')](_0x8e23('0xe'),_0x4b7807,_0x196675[_0x8e23('0x13')][_0x8e23('0x15')]);return _0xf81c6a(_0x196675['error'][_0x8e23('0x15')]);}logger[_0x8e23('0x13')](_0x8e23('0xe'),_0x4b7807,_0x196675[_0x8e23('0x13')][_0x8e23('0x15')]);return _0x38c551(_0x196675[_0x8e23('0x13')][_0x8e23('0x15')]);}else{logger['info'](_0x8e23('0xe'),_0x4b7807,'request\x20sent');_0x38c551(_0x196675['result'][_0x8e23('0x15')]);}})[_0x8e23('0x16')](function(_0x456c67){logger[_0x8e23('0x13')](_0x8e23('0xe'),_0x4b7807,_0x456c67);_0xf81c6a(_0x456c67);});});}exports[_0x8e23('0x17')]=function(_0x40f218){var _0x3baa30=this;return new Promise(function(_0x38e787,_0x28babf){return db[_0x8e23('0x18')][_0x8e23('0x19')](_0x40f218['body'],{'raw':_0x40f218[_0x8e23('0x1a')]?_0x40f218[_0x8e23('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x8e23('0xc')](function(_0x308fdf){logger[_0x8e23('0xd')]('CreateVoiceDialReport',_0x40f218);logger[_0x8e23('0x10')](_0x8e23('0x17'),_0x40f218,JSON[_0x8e23('0x12')](_0x308fdf));_0x38e787(_0x308fdf);})[_0x8e23('0x16')](function(_0x497741){logger[_0x8e23('0x13')]('CreateVoiceDialReport',_0x497741[_0x8e23('0x15')],_0x40f218);_0x28babf(_0x3baa30[_0x8e23('0x13')](0x1f4,_0x497741[_0x8e23('0x15')]));});});};exports[_0x8e23('0x1b')]=function(_0x31aa16){var _0x239518=this;return new Promise(function(_0x2b4819,_0x3d8daa){return db[_0x8e23('0x18')][_0x8e23('0x1c')](_0x31aa16[_0x8e23('0x1d')],{'raw':_0x31aa16[_0x8e23('0x1a')]?_0x31aa16[_0x8e23('0x1a')][_0x8e23('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31aa16[_0x8e23('0x1a')]?_0x31aa16[_0x8e23('0x1a')][_0x8e23('0x1f')]||null:null,'attributes':_0x31aa16[_0x8e23('0x1a')]?_0x31aa16[_0x8e23('0x1a')]['attributes']||null:null,'limit':_0x31aa16[_0x8e23('0x1a')]?_0x31aa16[_0x8e23('0x1a')]['limit']||null:null})[_0x8e23('0xc')](function(_0x31c656){logger[_0x8e23('0xd')](_0x8e23('0x1b'),_0x31aa16);logger[_0x8e23('0x10')](_0x8e23('0x1b'),_0x31aa16,JSON[_0x8e23('0x12')](_0x31c656));_0x2b4819(_0x31c656);})[_0x8e23('0x16')](function(_0x3647f1){logger['error'](_0x8e23('0x1b'),_0x3647f1[_0x8e23('0x15')],_0x31aa16);_0x3d8daa(_0x239518[_0x8e23('0x13')](0x1f4,_0x3647f1[_0x8e23('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0bc10d2..9b2a9a6 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 _0xd5be=['get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put','update','delete','destroy','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1bfb29,_0x1d6359){var _0x28ff29=function(_0x375585){while(--_0x375585){_0x1bfb29['push'](_0x1bfb29['shift']());}};_0x28ff29(++_0x1d6359);}(_0xd5be,0x11a));var _0xed5b=function(_0x203387,_0x25ee77){_0x203387=_0x203387-0x0;var _0x358e6b=_0xd5be[_0x203387];return _0x358e6b;};'use strict';var multer=require('multer');var util=require(_0xed5b('0x0'));var path=require(_0xed5b('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xed5b('0x2')]();var fs_extra=require(_0xed5b('0x3'));var auth=require(_0xed5b('0x4'));var interaction=require(_0xed5b('0x5'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xed5b('0x6')]('/',auth['isAuthenticated'](),controller[_0xed5b('0x7')]);router[_0xed5b('0x6')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0xa')]);router[_0xed5b('0xb')]('/',auth['isAuthenticated'](),controller[_0xed5b('0xc')]);router['post'](_0xed5b('0xd'),auth[_0xed5b('0x9')](),controller['addApplications']);router[_0xed5b('0xe')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0xf')]);router[_0xed5b('0x10')](_0xed5b('0x8'),auth[_0xed5b('0x9')](),controller[_0xed5b('0x11')]);module['exports']=router; \ No newline at end of file +var _0xee6d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','put','update','/:id','destroy','exports','multer','util'];(function(_0x16be13,_0x3c4415){var _0x2f1ace=function(_0x5b0b14){while(--_0x5b0b14){_0x16be13['push'](_0x16be13['shift']());}};_0x2f1ace(++_0x3c4415);}(_0xee6d,0xee));var _0xdee6=function(_0x6bd29b,_0x495ca9){_0x6bd29b=_0x6bd29b-0x0;var _0xfa30ff=_0xee6d[_0x6bd29b];return _0xfa30ff;};'use strict';var multer=require(_0xdee6('0x0'));var util=require(_0xdee6('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xdee6('0x2'));var router=express[_0xdee6('0x3')]();var fs_extra=require(_0xdee6('0x4'));var auth=require(_0xdee6('0x5'));var interaction=require(_0xdee6('0x6'));var config=require(_0xdee6('0x7'));var controller=require(_0xdee6('0x8'));router[_0xdee6('0x9')]('/',auth[_0xdee6('0xa')](),controller[_0xdee6('0xb')]);router['get']('/:id',auth[_0xdee6('0xa')](),controller[_0xdee6('0xc')]);router[_0xdee6('0xd')]('/',auth[_0xdee6('0xa')](),controller['create']);router[_0xdee6('0xd')](_0xdee6('0xe'),auth[_0xdee6('0xa')](),controller['addApplications']);router[_0xdee6('0xf')]('/:id',auth[_0xdee6('0xa')](),controller[_0xdee6('0x10')]);router['delete'](_0xdee6('0x11'),auth['isAuthenticated'](),controller[_0xdee6('0x12')]);module[_0xdee6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 55c264c..d1e1c5f 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 _0xf5a5=['NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0xf5a5,0x11d));var _0x5f5a=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf5a5[_0x5608a3];return _0x1ed50a;};'use strict';var Sequelize=require(_0x5f5a('0x0'));module[_0x5f5a('0x1')]={'context':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'unique':_0x5f5a('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x5f5a('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':![],'defaultValue':_0x5f5a('0x4')},'appdata':{'type':Sequelize[_0x5f5a('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x5f5a('0x5')]('inbound','outbound','internal',_0x5f5a('0x6'),_0x5f5a('0x7'),_0x5f5a('0x8'),_0x5f5a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x5f5a('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5f5a('0xa')},'IntervalId':{'type':Sequelize[_0x5f5a('0xb')]},'isApp':{'type':Sequelize[_0x5f5a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x5f5a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x5f5a('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x5f5a('0xd')},'answer':{'type':Sequelize[_0x5f5a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x5f5a('0xe')],'get':function(_0x2337bf){return this[_0x5f5a('0xf')](_0x5f5a('0x10'));}},'alias':{'type':Sequelize[_0x5f5a('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xebed=['STRING','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','compositeIndex'];(function(_0x405e0f,_0x26eb17){var _0x47a72b=function(_0x340bd7){while(--_0x340bd7){_0x405e0f['push'](_0x405e0f['shift']());}};_0x47a72b(++_0x26eb17);}(_0xebed,0xfa));var _0xdebe=function(_0x187d80,_0x5b793f){_0x187d80=_0x187d80-0x0;var _0x498a77=_0xebed[_0x187d80];return _0x498a77;};'use strict';var Sequelize=require('sequelize');module[_0xdebe('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdebe('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xdebe('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xdebe('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xdebe('0x2')],'allowNull':![],'defaultValue':_0xdebe('0x3')},'appdata':{'type':Sequelize[_0xdebe('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xdebe('0x4')](_0xdebe('0x5'),_0xdebe('0x6'),_0xdebe('0x7'),_0xdebe('0x8'),_0xdebe('0x9'),_0xdebe('0xa'),_0xdebe('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0xdebe('0x2')]},'interval':{'type':Sequelize[_0xdebe('0x2')],'allowNull':![],'defaultValue':_0xdebe('0xc')},'IntervalId':{'type':Sequelize[_0xdebe('0xd')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xdebe('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0xdebe('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0xdebe('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xdebe('0xf')},'answer':{'type':Sequelize[_0xdebe('0xe')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53fa68){return this[_0xdebe('0x10')](_0xdebe('0x11'));}},'alias':{'type':Sequelize[_0xdebe('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3b0b424..ea8e370 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 _0xd2f2=['VoiceExtension','findAll','catch','rawAttributes','include','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','update','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','type','find','name','then','error','stack','send','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','options'];(function(_0x515b56,_0x285acf){var _0x589680=function(_0x366eff){while(--_0x366eff){_0x515b56['push'](_0x515b56['shift']());}};_0x589680(++_0x285acf);}(_0xd2f2,0x83));var _0x2d2f=function(_0x1014d7,_0x3d98ff){_0x1014d7=_0x1014d7-0x0;var _0x8d83ee=_0xd2f2[_0x1014d7];return _0x8d83ee;};'use strict';var _=require(_0x2d2f('0x0'));var Redis=require(_0x2d2f('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x2d2f('0x2'))(_0x2d2f('0x3'));var config=require('../../config/environment');var db=require(_0x2d2f('0x4'))['db'];config['redis']=_[_0x2d2f('0x5')](config[_0x2d2f('0x6')],{'host':_0x2d2f('0x7'),'port':0x18eb});var socket=require(_0x2d2f('0x8'))(new Redis(config[_0x2d2f('0x6')]));require(_0x2d2f('0x9'))[_0x2d2f('0xa')](socket);function respondWithStatusCode(_0x39f2eb,_0x105a06){_0x105a06=_0x105a06||0xcc;return function(_0x3c6777){if(_0x3c6777){return _0x39f2eb[_0x2d2f('0xb')](_0x105a06);}return _0x39f2eb[_0x2d2f('0xc')](_0x105a06)[_0x2d2f('0xd')]();};}function respondWithResult(_0x196f94,_0x4195e5){_0x4195e5=_0x4195e5||0xc8;return function(_0x18a56e){if(_0x18a56e){return _0x196f94[_0x2d2f('0xc')](_0x4195e5)[_0x2d2f('0xe')](_0x18a56e);}};}function respondWithFilteredResult(_0x53965d,_0x301b4f){return function(_0x315f28){if(_0x315f28){var _0xc88f73=typeof _0x301b4f[_0x2d2f('0xf')]===_0x2d2f('0x10')&&typeof _0x301b4f[_0x2d2f('0x11')]===_0x2d2f('0x10');var _0xd6e74a=_0x315f28['count'];var _0x480be0=_0xc88f73?0x0:_0x301b4f['offset'];var _0x2835f3=_0xc88f73?_0x315f28[_0x2d2f('0x12')]:_0x301b4f[_0x2d2f('0xf')]+_0x301b4f[_0x2d2f('0x11')];var _0x1b4a2c;if(_0x2835f3>=_0xd6e74a){_0x2835f3=_0xd6e74a;_0x1b4a2c=0xc8;}else{_0x1b4a2c=0xce;}_0x53965d[_0x2d2f('0xc')](_0x1b4a2c);return _0x53965d['set'](_0x2d2f('0x13'),_0x480be0+'-'+_0x2835f3+'/'+_0xd6e74a)[_0x2d2f('0xe')](_0x315f28);}return null;};}function removeEntity(_0x5a2140){return function(_0x8943fd){if(_0x8943fd){return _0x8943fd[_0x2d2f('0x14')]()['then'](function(){var _0x12bdc9=_0x8943fd[_0x2d2f('0x15')]({'plain':!![]});var _0x2224f6=[{'name':_0x2d2f('0x16'),'value':_0x2d2f('0x17'),'ignore':![]},{'name':_0x2d2f('0x18'),'value':_0x2d2f('0x19'),'ignore':![]},{'name':'InternalRoutes','value':_0x2d2f('0x1a'),'ignore':![]}];var _0x49a456=_(_0x2224f6)[_0x2d2f('0x1b')](_0x2d2f('0x1c'))[_0x2d2f('0x1d')](_0x2d2f('0x1e'))['value']();if(_[_0x2d2f('0x1f')](_0x49a456,_0x12bdc9[_0x2d2f('0x20')])){return;}var _0x599a07=_[_0x2d2f('0x21')](_0x2224f6,[_0x2d2f('0x1e'),_0x12bdc9[_0x2d2f('0x20')]])[_0x2d2f('0x22')];return db['UserProfileResource'][_0x2d2f('0x14')]({'where':{'type':_0x599a07,'resourceId':_0x12bdc9['id']}})['then'](function(){return _0x8943fd;});})[_0x2d2f('0x23')](function(){_0x5a2140[_0x2d2f('0xc')](0xcc)[_0x2d2f('0xd')]();});}};}function handleEntityNotFound(_0x4cc261){return function(_0x4fe286){if(!_0x4fe286){_0x4cc261[_0x2d2f('0xb')](0x194);}return _0x4fe286;};}function handleError(_0x3208f1,_0x1b57f2){_0x1b57f2=_0x1b57f2||0x1f4;return function(_0x2524e0){logger[_0x2d2f('0x24')](_0x2524e0[_0x2d2f('0x25')]);if(_0x2524e0['name']){delete _0x2524e0[_0x2d2f('0x22')];}_0x3208f1[_0x2d2f('0xc')](_0x1b57f2)[_0x2d2f('0x26')](_0x2524e0);};}exports['index']=function(_0x5b6d5e,_0x3ee953){var _0x5f17ff={},_0x33d4eb={},_0x69d76e={'count':0x0,'rows':[]};var _0x3f7c22=_['map'](db['VoiceExtension']['rawAttributes'],function(_0x414180){return{'name':_0x414180[_0x2d2f('0x27')],'type':_0x414180['type']['key']};});_0x33d4eb['model']=_[_0x2d2f('0x1d')](_0x3f7c22,'name');_0x33d4eb[_0x2d2f('0x28')]=_[_0x2d2f('0x29')](_0x5b6d5e[_0x2d2f('0x28')]);_0x33d4eb['filters']=_['intersection'](_0x33d4eb[_0x2d2f('0x2a')],_0x33d4eb[_0x2d2f('0x28')]);_0x5f17ff[_0x2d2f('0x2b')]=_[_0x2d2f('0x2c')](_0x33d4eb[_0x2d2f('0x2a')],qs[_0x2d2f('0x2d')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x2d')]));_0x5f17ff[_0x2d2f('0x2b')]=_0x5f17ff['attributes'][_0x2d2f('0x2e')]?_0x5f17ff['attributes']:_0x33d4eb[_0x2d2f('0x2a')];if(!_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x2f')]('nolimit')){_0x5f17ff[_0x2d2f('0x11')]=qs[_0x2d2f('0x11')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x11')]);_0x5f17ff[_0x2d2f('0xf')]=qs[_0x2d2f('0xf')](_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0xf')]);}_0x5f17ff[_0x2d2f('0x30')]=qs[_0x2d2f('0x31')](_0x5b6d5e[_0x2d2f('0x28')]['sort']);_0x5f17ff[_0x2d2f('0x32')]=qs[_0x2d2f('0x33')](_[_0x2d2f('0x34')](_0x5b6d5e[_0x2d2f('0x28')],_0x33d4eb[_0x2d2f('0x33')]),_0x3f7c22);if(_0x5b6d5e[_0x2d2f('0x28')][_0x2d2f('0x1b')]){_0x5f17ff[_0x2d2f('0x32')]=_[_0x2d2f('0x35')](_0x5f17ff['where'],{'$or':_['map'](_0x3f7c22,function(_0x3fc97a){if(_0x3fc97a[_0x2d2f('0x20')]!=='VIRTUAL'){var _0x53203c={};_0x53203c[_0x3fc97a[_0x2d2f('0x22')]]={'$like':'%'+_0x5b6d5e['query']['filter']+'%'};return _0x53203c;}})});}_0x5f17ff=_[_0x2d2f('0x35')]({},_0x5f17ff,_0x5b6d5e[_0x2d2f('0x36')]);var _0x5e649c={'where':_0x5f17ff[_0x2d2f('0x32')]};return db[_0x2d2f('0x37')]['count'](_0x5e649c)[_0x2d2f('0x23')](function(_0x11b9e8){_0x69d76e[_0x2d2f('0x12')]=_0x11b9e8;if(_0x5b6d5e['query']['includeAll']){_0x5f17ff['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x2d2f('0x38')](_0x5f17ff);})['then'](function(_0x1cb263){_0x69d76e['rows']=_0x1cb263;return _0x69d76e;})[_0x2d2f('0x23')](respondWithFilteredResult(_0x3ee953,_0x5f17ff))[_0x2d2f('0x39')](handleError(_0x3ee953,null));};exports['show']=function(_0x492733,_0x5490b0){var _0x5d0909={'raw':![],'where':{'id':_0x492733['params']['id']}},_0x40d22b={};_0x40d22b[_0x2d2f('0x2a')]=_[_0x2d2f('0x29')](db['VoiceExtension'][_0x2d2f('0x3a')]);_0x40d22b[_0x2d2f('0x28')]=_['keys'](_0x492733[_0x2d2f('0x28')]);_0x40d22b[_0x2d2f('0x33')]=_[_0x2d2f('0x2c')](_0x40d22b[_0x2d2f('0x2a')],_0x40d22b['query']);_0x5d0909[_0x2d2f('0x2b')]=_[_0x2d2f('0x2c')](_0x40d22b[_0x2d2f('0x2a')],qs[_0x2d2f('0x2d')](_0x492733['query'][_0x2d2f('0x2d')]));_0x5d0909[_0x2d2f('0x2b')]=_0x5d0909[_0x2d2f('0x2b')][_0x2d2f('0x2e')]?_0x5d0909[_0x2d2f('0x2b')]:_0x40d22b[_0x2d2f('0x2a')];if(_0x492733[_0x2d2f('0x28')]['includeAll']){_0x5d0909[_0x2d2f('0x3b')]=[{'all':!![]}];}_0x5d0909=_['merge']({},_0x5d0909,_0x492733[_0x2d2f('0x36')]);return db[_0x2d2f('0x37')][_0x2d2f('0x21')](_0x5d0909)['then'](handleEntityNotFound(_0x5490b0,null))[_0x2d2f('0x23')](respondWithResult(_0x5490b0,null))[_0x2d2f('0x39')](handleError(_0x5490b0,null));};exports[_0x2d2f('0x14')]=function(_0x226b53,_0x43343f){return db[_0x2d2f('0x37')][_0x2d2f('0x21')]({'where':{'id':_0x226b53['params']['id']}})[_0x2d2f('0x23')](handleEntityNotFound(_0x43343f,null))['then'](removeEntity(_0x43343f,null))[_0x2d2f('0x39')](handleError(_0x43343f,null));};exports[_0x2d2f('0x3c')]=function(_0x550edf,_0x2d833a){if(_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x20')]===_0x2d2f('0x19')&&!_[_0x2d2f('0x3e')](_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x3f')],'_')){_0x550edf[_0x2d2f('0x3d')][_0x2d2f('0x3f')]='_'[_0x2d2f('0x40')](_0x550edf['body'][_0x2d2f('0x3f')]);}return db[_0x2d2f('0x37')]['create'](_0x550edf[_0x2d2f('0x3d')],{'raw':![]})['then'](function(_0x4029bd){var _0x2f1be8=_0x550edf[_0x2d2f('0x41')][_0x2d2f('0x15')]({'plain':!![]});if(!_0x2f1be8)throw new Error(_0x2d2f('0x42'));if(_0x2f1be8[_0x2d2f('0x43')]===_0x2d2f('0x41')){var _0x137dc2=_0x4029bd[_0x2d2f('0x15')]({'plain':!![]});var _0x240aed=[{'name':_0x2d2f('0x16'),'value':_0x2d2f('0x17')},{'name':'OutboundRoutes','value':_0x2d2f('0x19')},{'name':_0x2d2f('0x44'),'value':_0x2d2f('0x1a')}];var _0x5af15b=_[_0x2d2f('0x21')](_0x240aed,[_0x2d2f('0x1e'),_0x137dc2[_0x2d2f('0x20')]])[_0x2d2f('0x22')];return db[_0x2d2f('0x45')][_0x2d2f('0x21')]({'where':{'name':_0x5af15b,'userProfileId':_0x2f1be8[_0x2d2f('0x46')]},'raw':!![]})['then'](function(_0x4966cc){if(_0x4966cc&&_0x4966cc[_0x2d2f('0x47')]===0x0){return db[_0x2d2f('0x48')][_0x2d2f('0x3c')]({'name':_0x137dc2[_0x2d2f('0x22')],'resourceId':_0x137dc2['id'],'type':_0x4966cc[_0x2d2f('0x22')],'sectionId':_0x4966cc['id']},{})[_0x2d2f('0x23')](function(){return _0x4029bd;});}else{return _0x4029bd;}})['catch'](function(_0x53041a){logger[_0x2d2f('0x24')](_0x2d2f('0x49'),_0x53041a);throw _0x53041a;});}return _0x4029bd;})[_0x2d2f('0x23')](respondWithResult(_0x2d833a,0xc9))[_0x2d2f('0x39')](handleError(_0x2d833a,null));};exports['update']=function(_0x1ac451,_0x5d3427){if(_0x1ac451[_0x2d2f('0x3d')]['id']){delete _0x1ac451['body']['id'];}return db[_0x2d2f('0x37')][_0x2d2f('0x21')]({'where':{'id':_0x1ac451[_0x2d2f('0x4a')]['id']}})[_0x2d2f('0x23')](handleEntityNotFound(_0x5d3427,null))['then'](function(_0x19f4cf){if(_0x19f4cf){return db['VoiceExtension'][_0x2d2f('0x4b')](_['pick'](_0x1ac451[_0x2d2f('0x3d')],[_0x2d2f('0x3f'),_0x2d2f('0x4c'),'description',_0x2d2f('0x4d'),_0x2d2f('0x4e'),_0x2d2f('0x4f'),_0x2d2f('0x50')]),{'where':{'context':_0x19f4cf[_0x2d2f('0x4c')],'exten':_0x19f4cf[_0x2d2f('0x3f')]},'individualHooks':!![]})[_0x2d2f('0x23')](function(_0x2656a1){return _0x2656a1;});}return null;})[_0x2d2f('0x23')](respondWithStatusCode(_0x5d3427,null))[_0x2d2f('0x39')](handleError(_0x5d3427,null));};exports[_0x2d2f('0x51')]=function(_0x5a91d9,_0x76811d){var _0x468100=_0x5a91d9[_0x2d2f('0x4a')]['id'];var _0x2f6bdb=_0x5a91d9[_0x2d2f('0x3d')];var _0x1c0ff1=0xc8;var _0x5aa2dd=null;return db[_0x2d2f('0x52')][_0x2d2f('0x53')]({'isolationLevel':db['sequelize'][_0x2d2f('0x54')]['ISOLATION_LEVELS'][_0x2d2f('0x55')]},function(_0x326c7a){return db[_0x2d2f('0x37')][_0x2d2f('0x56')]({'where':{'id':_0x468100},'transaction':_0x326c7a})[_0x2d2f('0x23')](function(_0x574d62){if(_0x574d62){return db['VoiceExtension'][_0x2d2f('0x14')]({'where':{'VoiceExtensionId':_0x468100},'transaction':_0x326c7a})[_0x2d2f('0x23')](function(){var _0x26703e=_[_0x2d2f('0x1d')](_0x2f6bdb,function(_0x394bdf){_0x394bdf[_0x2d2f('0x57')]=_0x468100;_0x394bdf[_0x2d2f('0x58')]=!![];return _0x394bdf;});return _0x574d62[_0x2d2f('0x59')](_0x26703e);})[_0x2d2f('0x23')](function(_0x38405c){return db['VoiceExtension'][_0x2d2f('0x5a')](_0x38405c,{'transaction':_0x326c7a});});}else{_0x1c0ff1=0x194;_0x5aa2dd=[];}});})[_0x2d2f('0x23')](function(){if(_0x1c0ff1!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x468100},'order':_0x2d2f('0x5b')})['then'](function(_0x3017c7){_0x5aa2dd=_0x3017c7;});}})[_0x2d2f('0x39')](function(_0x4e4413){_0x1c0ff1=0x1f4;logger[_0x2d2f('0x24')](_0x4e4413['stack']);if(_0x4e4413[_0x2d2f('0x22')]){delete _0x4e4413[_0x2d2f('0x22')];}_0x5aa2dd=_0x4e4413;})[_0x2d2f('0x5c')](function(){if(_0x5aa2dd===null){_0x76811d['sendStatus'](_0x1c0ff1);}else{if(_0x1c0ff1===0x1f4){_0x76811d[_0x2d2f('0xc')](_0x1c0ff1)[_0x2d2f('0x26')](_0x5aa2dd);}else{_0x76811d[_0x2d2f('0xc')](_0x1c0ff1)['json'](_0x5aa2dd);}}});}; \ No newline at end of file +var _0x15c1=['redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','InboundRoutes','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','find','name','then','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','includeAll','findAll','rows','catch','show','options','destroy','params','create','body','outbound','startsWith','exten','get','role','user','inbound','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x2670a6,_0x2838b3){var _0x568ddf=function(_0x461d48){while(--_0x461d48){_0x2670a6['push'](_0x2670a6['shift']());}};_0x568ddf(++_0x2838b3);}(_0x15c1,0x107));var _0x115c=function(_0x4030df,_0x1de717){_0x4030df=_0x4030df-0x0;var _0x1bd3fe=_0x15c1[_0x4030df];return _0x1bd3fe;};'use strict';var _=require(_0x115c('0x0'));var Redis=require(_0x115c('0x1'));var qs=require(_0x115c('0x2'));var logger=require(_0x115c('0x3'))(_0x115c('0x4'));var config=require(_0x115c('0x5'));var db=require(_0x115c('0x6'))['db'];config[_0x115c('0x7')]=_[_0x115c('0x8')](config[_0x115c('0x7')],{'host':_0x115c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x115c('0xa'))[_0x115c('0xb')](socket);function respondWithStatusCode(_0x4949d4,_0x369c65){_0x369c65=_0x369c65||0xcc;return function(_0x3025cf){if(_0x3025cf){return _0x4949d4[_0x115c('0xc')](_0x369c65);}return _0x4949d4['status'](_0x369c65)[_0x115c('0xd')]();};}function respondWithResult(_0x9b26ae,_0x70c811){_0x70c811=_0x70c811||0xc8;return function(_0x4cdead){if(_0x4cdead){return _0x9b26ae[_0x115c('0xe')](_0x70c811)['json'](_0x4cdead);}};}function respondWithFilteredResult(_0x1e5599,_0x1ac653){return function(_0xb76af6){if(_0xb76af6){var _0x5c7e9f=typeof _0x1ac653[_0x115c('0xf')]===_0x115c('0x10')&&typeof _0x1ac653[_0x115c('0x11')]===_0x115c('0x10');var _0x2e91e0=_0xb76af6['count'];var _0x4ed917=_0x5c7e9f?0x0:_0x1ac653['offset'];var _0x5587e8=_0x5c7e9f?_0xb76af6[_0x115c('0x12')]:_0x1ac653['offset']+_0x1ac653[_0x115c('0x11')];var _0xab2872;if(_0x5587e8>=_0x2e91e0){_0x5587e8=_0x2e91e0;_0xab2872=0xc8;}else{_0xab2872=0xce;}_0x1e5599[_0x115c('0xe')](_0xab2872);return _0x1e5599['set'](_0x115c('0x13'),_0x4ed917+'-'+_0x5587e8+'/'+_0x2e91e0)[_0x115c('0x14')](_0xb76af6);}return null;};}function removeEntity(_0x1dcf6c){return function(_0x1a8904){if(_0x1a8904){return _0x1a8904['destroy']()['then'](function(){var _0x3e8a37=_0x1a8904['get']({'plain':!![]});var _0x5e5d16=[{'name':_0x115c('0x15'),'value':'inbound','ignore':![]},{'name':_0x115c('0x16'),'value':'outbound','ignore':![]},{'name':_0x115c('0x17'),'value':_0x115c('0x18'),'ignore':![]}];var _0x256dad=_(_0x5e5d16)['filter']('ignore')[_0x115c('0x19')]('value')[_0x115c('0x1a')]();if(_[_0x115c('0x1b')](_0x256dad,_0x3e8a37[_0x115c('0x1c')])){return;}var _0x14b5ad=_[_0x115c('0x1d')](_0x5e5d16,[_0x115c('0x1a'),_0x3e8a37['type']])[_0x115c('0x1e')];return db['UserProfileResource']['destroy']({'where':{'type':_0x14b5ad,'resourceId':_0x3e8a37['id']}})[_0x115c('0x1f')](function(){return _0x1a8904;});})[_0x115c('0x1f')](function(){_0x1dcf6c[_0x115c('0xe')](0xcc)[_0x115c('0xd')]();});}};}function handleEntityNotFound(_0x36155f){return function(_0x1f6b6f){if(!_0x1f6b6f){_0x36155f[_0x115c('0xc')](0x194);}return _0x1f6b6f;};}function handleError(_0x5860f4,_0x2d0815){_0x2d0815=_0x2d0815||0x1f4;return function(_0xd1bfe0){logger[_0x115c('0x20')](_0xd1bfe0[_0x115c('0x21')]);if(_0xd1bfe0[_0x115c('0x1e')]){delete _0xd1bfe0['name'];}_0x5860f4[_0x115c('0xe')](_0x2d0815)[_0x115c('0x22')](_0xd1bfe0);};}exports[_0x115c('0x23')]=function(_0x4d07b8,_0x3c798e){var _0x1d4fb8={},_0x366ec2={},_0x2ae8c5={'count':0x0,'rows':[]};var _0xec4d38=_[_0x115c('0x19')](db[_0x115c('0x24')][_0x115c('0x25')],function(_0x4cdb0d){return{'name':_0x4cdb0d[_0x115c('0x26')],'type':_0x4cdb0d[_0x115c('0x1c')]['key']};});_0x366ec2[_0x115c('0x27')]=_[_0x115c('0x19')](_0xec4d38,_0x115c('0x1e'));_0x366ec2[_0x115c('0x28')]=_[_0x115c('0x29')](_0x4d07b8['query']);_0x366ec2[_0x115c('0x2a')]=_[_0x115c('0x2b')](_0x366ec2[_0x115c('0x27')],_0x366ec2[_0x115c('0x28')]);_0x1d4fb8['attributes']=_[_0x115c('0x2b')](_0x366ec2[_0x115c('0x27')],qs[_0x115c('0x2c')](_0x4d07b8['query']['fields']));_0x1d4fb8['attributes']=_0x1d4fb8[_0x115c('0x2d')]['length']?_0x1d4fb8[_0x115c('0x2d')]:_0x366ec2['model'];if(!_0x4d07b8[_0x115c('0x28')][_0x115c('0x2e')](_0x115c('0x2f'))){_0x1d4fb8[_0x115c('0x11')]=qs[_0x115c('0x11')](_0x4d07b8[_0x115c('0x28')]['limit']);_0x1d4fb8['offset']=qs[_0x115c('0xf')](_0x4d07b8[_0x115c('0x28')][_0x115c('0xf')]);}_0x1d4fb8['order']=qs[_0x115c('0x30')](_0x4d07b8[_0x115c('0x28')][_0x115c('0x30')]);_0x1d4fb8[_0x115c('0x31')]=qs[_0x115c('0x2a')](_[_0x115c('0x32')](_0x4d07b8[_0x115c('0x28')],_0x366ec2['filters']),_0xec4d38);if(_0x4d07b8[_0x115c('0x28')][_0x115c('0x33')]){_0x1d4fb8['where']=_['merge'](_0x1d4fb8[_0x115c('0x31')],{'$or':_[_0x115c('0x19')](_0xec4d38,function(_0x2089f1){if(_0x2089f1[_0x115c('0x1c')]!==_0x115c('0x34')){var _0x1122fd={};_0x1122fd[_0x2089f1[_0x115c('0x1e')]]={'$like':'%'+_0x4d07b8[_0x115c('0x28')][_0x115c('0x33')]+'%'};return _0x1122fd;}})});}_0x1d4fb8=_['merge']({},_0x1d4fb8,_0x4d07b8['options']);var _0x4498aa={'where':_0x1d4fb8[_0x115c('0x31')]};return db[_0x115c('0x24')][_0x115c('0x12')](_0x4498aa)[_0x115c('0x1f')](function(_0xb05368){_0x2ae8c5['count']=_0xb05368;if(_0x4d07b8[_0x115c('0x28')][_0x115c('0x35')]){_0x1d4fb8['include']=[{'all':!![]}];}return db[_0x115c('0x24')][_0x115c('0x36')](_0x1d4fb8);})[_0x115c('0x1f')](function(_0x4f83a6){_0x2ae8c5[_0x115c('0x37')]=_0x4f83a6;return _0x2ae8c5;})['then'](respondWithFilteredResult(_0x3c798e,_0x1d4fb8))[_0x115c('0x38')](handleError(_0x3c798e,null));};exports[_0x115c('0x39')]=function(_0xd29c6d,_0x4fed15){var _0x41dffd={'raw':![],'where':{'id':_0xd29c6d['params']['id']}},_0x188848={};_0x188848['model']=_[_0x115c('0x29')](db[_0x115c('0x24')][_0x115c('0x25')]);_0x188848[_0x115c('0x28')]=_['keys'](_0xd29c6d[_0x115c('0x28')]);_0x188848['filters']=_[_0x115c('0x2b')](_0x188848[_0x115c('0x27')],_0x188848[_0x115c('0x28')]);_0x41dffd[_0x115c('0x2d')]=_['intersection'](_0x188848[_0x115c('0x27')],qs[_0x115c('0x2c')](_0xd29c6d[_0x115c('0x28')]['fields']));_0x41dffd[_0x115c('0x2d')]=_0x41dffd[_0x115c('0x2d')]['length']?_0x41dffd[_0x115c('0x2d')]:_0x188848[_0x115c('0x27')];if(_0xd29c6d[_0x115c('0x28')][_0x115c('0x35')]){_0x41dffd['include']=[{'all':!![]}];}_0x41dffd=_['merge']({},_0x41dffd,_0xd29c6d[_0x115c('0x3a')]);return db[_0x115c('0x24')][_0x115c('0x1d')](_0x41dffd)['then'](handleEntityNotFound(_0x4fed15,null))[_0x115c('0x1f')](respondWithResult(_0x4fed15,null))[_0x115c('0x38')](handleError(_0x4fed15,null));};exports[_0x115c('0x3b')]=function(_0x15db00,_0x3774b4){return db[_0x115c('0x24')][_0x115c('0x1d')]({'where':{'id':_0x15db00[_0x115c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3774b4,null))['then'](removeEntity(_0x3774b4,null))[_0x115c('0x38')](handleError(_0x3774b4,null));};exports[_0x115c('0x3d')]=function(_0x3b7ac4,_0x51dd5d){if(_0x3b7ac4[_0x115c('0x3e')][_0x115c('0x1c')]===_0x115c('0x3f')&&!_[_0x115c('0x40')](_0x3b7ac4[_0x115c('0x3e')][_0x115c('0x41')],'_')){_0x3b7ac4[_0x115c('0x3e')][_0x115c('0x41')]='_'['concat'](_0x3b7ac4[_0x115c('0x3e')][_0x115c('0x41')]);}return db['VoiceExtension'][_0x115c('0x3d')](_0x3b7ac4[_0x115c('0x3e')],{'raw':![]})[_0x115c('0x1f')](function(_0x403e34){var _0x469c61=_0x3b7ac4['user'][_0x115c('0x42')]({'plain':!![]});if(!_0x469c61)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x469c61[_0x115c('0x43')]===_0x115c('0x44')){var _0x28dae8=_0x403e34['get']({'plain':!![]});var _0x8596fe=[{'name':_0x115c('0x15'),'value':_0x115c('0x45')},{'name':_0x115c('0x16'),'value':_0x115c('0x3f')},{'name':_0x115c('0x17'),'value':'internal'}];var _0x3a2bbd=_[_0x115c('0x1d')](_0x8596fe,['value',_0x28dae8[_0x115c('0x1c')]])[_0x115c('0x1e')];return db[_0x115c('0x46')][_0x115c('0x1d')]({'where':{'name':_0x3a2bbd,'userProfileId':_0x469c61['userProfileId']},'raw':!![]})[_0x115c('0x1f')](function(_0x2814ed){if(_0x2814ed&&_0x2814ed[_0x115c('0x47')]===0x0){return db['UserProfileResource'][_0x115c('0x3d')]({'name':_0x28dae8['name'],'resourceId':_0x28dae8['id'],'type':_0x2814ed['name'],'sectionId':_0x2814ed['id']},{})[_0x115c('0x1f')](function(){return _0x403e34;});}else{return _0x403e34;}})[_0x115c('0x38')](function(_0x17a3e3){logger[_0x115c('0x20')](_0x115c('0x48'),_0x17a3e3);throw _0x17a3e3;});}return _0x403e34;})[_0x115c('0x1f')](respondWithResult(_0x51dd5d,0xc9))[_0x115c('0x38')](handleError(_0x51dd5d,null));};exports[_0x115c('0x49')]=function(_0xb0559e,_0x1de435){if(_0xb0559e[_0x115c('0x3e')]['id']){delete _0xb0559e[_0x115c('0x3e')]['id'];}return db['VoiceExtension'][_0x115c('0x1d')]({'where':{'id':_0xb0559e[_0x115c('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1de435,null))[_0x115c('0x1f')](function(_0x293c31){if(_0x293c31){return db['VoiceExtension'][_0x115c('0x49')](_[_0x115c('0x32')](_0xb0559e['body'],[_0x115c('0x41'),_0x115c('0x4a'),'description',_0x115c('0x4b'),_0x115c('0x4c'),_0x115c('0x4d'),'alias']),{'where':{'context':_0x293c31[_0x115c('0x4a')],'exten':_0x293c31[_0x115c('0x41')]},'individualHooks':!![]})[_0x115c('0x1f')](function(_0x24233d){return _0x24233d;});}return null;})['then'](respondWithStatusCode(_0x1de435,null))[_0x115c('0x38')](handleError(_0x1de435,null));};exports[_0x115c('0x4e')]=function(_0x1958b9,_0x771d4){var _0x8846=_0x1958b9[_0x115c('0x3c')]['id'];var _0x3bcd8a=_0x1958b9[_0x115c('0x3e')];var _0x41e0d3=0xc8;var _0x51542e=null;return db[_0x115c('0x4f')][_0x115c('0x50')]({'isolationLevel':db[_0x115c('0x4f')][_0x115c('0x51')][_0x115c('0x52')]['READ_COMMITTED']},function(_0x2bfe33){return db[_0x115c('0x24')][_0x115c('0x53')]({'where':{'id':_0x8846},'transaction':_0x2bfe33})[_0x115c('0x1f')](function(_0x3b65bc){if(_0x3b65bc){return db['VoiceExtension'][_0x115c('0x3b')]({'where':{'VoiceExtensionId':_0x8846},'transaction':_0x2bfe33})[_0x115c('0x1f')](function(){var _0x5a8c67=_[_0x115c('0x19')](_0x3bcd8a,function(_0x578356){_0x578356[_0x115c('0x54')]=_0x8846;_0x578356[_0x115c('0x55')]=!![];return _0x578356;});return _0x3b65bc[_0x115c('0x56')](_0x5a8c67);})[_0x115c('0x1f')](function(_0xd67228){return db['VoiceExtension'][_0x115c('0x57')](_0xd67228,{'transaction':_0x2bfe33});});}else{_0x41e0d3=0x194;_0x51542e=[];}});})['then'](function(){if(_0x41e0d3!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x8846},'order':_0x115c('0x58')})[_0x115c('0x1f')](function(_0xaa7ab5){_0x51542e=_0xaa7ab5;});}})[_0x115c('0x38')](function(_0x3e2385){_0x41e0d3=0x1f4;logger[_0x115c('0x20')](_0x3e2385[_0x115c('0x21')]);if(_0x3e2385['name']){delete _0x3e2385[_0x115c('0x1e')];}_0x51542e=_0x3e2385;})[_0x115c('0x59')](function(){if(_0x51542e===null){_0x771d4['sendStatus'](_0x41e0d3);}else{if(_0x41e0d3===0x1f4){_0x771d4[_0x115c('0xe')](_0x41e0d3)[_0x115c('0x22')](_0x51542e);}else{_0x771d4[_0x115c('0xe')](_0x41e0d3)['json'](_0x51542e);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index eba38f6..21a4f01 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 _0x41f4=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x29a2ce,_0x5d6558){var _0x2fa9ea=function(_0x526d35){while(--_0x526d35){_0x29a2ce['push'](_0x29a2ce['shift']());}};_0x2fa9ea(++_0x5d6558);}(_0x41f4,0x66));var _0x441f=function(_0x3279f2,_0x51210e){_0x3279f2=_0x3279f2-0x0;var _0xf506ea=_0x41f4[_0x3279f2];return _0xf506ea;};'use strict';var EventEmitter=require(_0x441f('0x0'));var VoiceExtension=require(_0x441f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x441f('0x2')](0x0);var events={'afterCreate':_0x441f('0x3'),'afterUpdate':'update','afterDestroy':_0x441f('0x4')};function emitEvent(_0x212312){return function(_0xc41de3,_0x207604,_0x42ae1d){VoiceExtensionEvents[_0x441f('0x5')](_0x212312+':'+_0xc41de3['id'],_0xc41de3);VoiceExtensionEvents[_0x441f('0x5')](_0x212312,_0xc41de3);_0x42ae1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x441f('0x6')](e,emitEvent(event));}}module[_0x441f('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x5ccf=['VoiceExtension','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x4b573a,_0x13828a){var _0x1ae343=function(_0x325298){while(--_0x325298){_0x4b573a['push'](_0x4b573a['shift']());}};_0x1ae343(++_0x13828a);}(_0x5ccf,0x104));var _0xf5cc=function(_0x364461,_0xc856c8){_0x364461=_0x364461-0x0;var _0x52bc8e=_0x5ccf[_0x364461];return _0x52bc8e;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf5cc('0x0'))['db'][_0xf5cc('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf5cc('0x2')](0x0);var events={'afterCreate':_0xf5cc('0x3'),'afterUpdate':_0xf5cc('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1294eb){return function(_0x3623a5,_0x342bea,_0x5bbe8a){VoiceExtensionEvents[_0xf5cc('0x5')](_0x1294eb+':'+_0x3623a5['id'],_0x3623a5);VoiceExtensionEvents[_0xf5cc('0x5')](_0x1294eb,_0x3623a5);_0x5bbe8a(null);};}for(var e in events){if(events[_0xf5cc('0x6')](e)){var event=events[e];VoiceExtension[_0xf5cc('0x7')](e,emitEvent(event));}}module[_0xf5cc('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 12b33e1..ac7ecca 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 _0x8456=['outboundDial','appdata','priority','last','define','VoiceExtension','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(routeAlias)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','length','name','param','phone','prefix','${EXTEN:','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','intervals','IntervalId','map','tag','CDR(tag)=','toLowerCase','callerID','Set(CALLERID(all)=','answer','playback','includes','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8456,0xfd));var _0x6845=function(_0x2516d4,_0x4f5208){_0x2516d4=_0x2516d4-0x0;var _0x511da6=_0x8456[_0x2516d4];return _0x511da6;};'use strict';var _=require(_0x6845('0x0'));var attributes=require(_0x6845('0x1'));module[_0x6845('0x2')]=function(_0x4ac25c){var _0x95d10d=_0x4ac25c['models'];function _0x20f486(_0x45801c){var _0x20f1bc=0x2;var _0x15c118=[{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0x5')+_0x45801c[_0x6845('0x3')],'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c['type'],'app':_0x45801c[_0x6845('0x8')]?'Set':_0x6845('0x9'),'appdata':_0x45801c[_0x6845('0x8')]?'CDR(routeAlias)='+_0x45801c[_0x6845('0x8')]:_0x6845('0xa'),'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c['exten'],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']}];if(_0x45801c[_0x6845('0x3')]===_0x6845('0xb')){_0x15c118[_0x6845('0xc')]({'type':_0x6845('0xb'),'app':_0x6845('0x4'),'appdata':_0x6845('0xd')+_0x45801c['id'],'context':_0x45801c['context'],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']});}_0x15c118[_0x6845('0xc')]({'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0xe'),'context':_0x45801c['context'],'exten':_0x45801c['exten'],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0xf'),'context':_0x45801c['context'],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']},{'type':_0x45801c[_0x6845('0x3')],'app':_0x6845('0x4'),'appdata':_0x6845('0x10'),'context':_0x45801c[_0x6845('0x6')],'exten':_0x45801c[_0x6845('0x7')],'priority':_0x20f1bc++,'VoiceExtensionId':_0x45801c['id']});return _0x15c118;}function _0x3d6f07(_0x4f7035){var _0x14043b=0x2;var _0x5c5a1b=[{'type':'outbound','app':_0x6845('0x4'),'appdata':_0x6845('0x11'),'context':_0x4f7035['context'],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x4f7035[_0x6845('0x8')]?_0x6845('0x4'):_0x6845('0x9'),'appdata':_0x4f7035[_0x6845('0x8')]?_0x6845('0x13')+_0x4f7035[_0x6845('0x8')]:'No\x20alias\x20set','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'CDR(destination)='+(_0x4f7035['cutdigits']?'${EXTEN:'+_0x4f7035[_0x6845('0x14')]+'}':_0x6845('0x15')),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':'outbound','app':_0x6845('0x4'),'appdata':'CDR(routeid)='+_0x4f7035['id'],'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':'outbound','app':_0x6845('0x16'),'appdata':_0x6845('0x17')+(_0x14043b+0x2)+_0x6845('0x18')+(_0x14043b+0x1)+')','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x4f7035['cutdigits']?_0x6845('0x19')+_0x4f7035[_0x6845('0x14')]+'}':_0x6845('0x1a'),'context':_0x4f7035['context'],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x6845('0xe'),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035['exten'],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':'outboundrouteid='+_0x4f7035['id'],'context':_0x4f7035['context'],'exten':_0x4f7035['exten'],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']}];if(_0x4f7035[_0x6845('0x1b')]('recordingFormat')&&_0x4f7035[_0x6845('0x1c')]!=='none'){_0x5c5a1b[_0x6845('0xc')]({'type':_0x6845('0x12'),'app':_0x6845('0x4'),'appdata':_0x6845('0x1d'),'context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']},{'type':_0x6845('0x12'),'app':'Set','appdata':_0x6845('0x1e')+_0x4f7035['recordingFormat']||'wav','context':_0x4f7035[_0x6845('0x6')],'exten':_0x4f7035[_0x6845('0x7')],'priority':_0x14043b++,'VoiceExtensionId':_0x4f7035['id']});}return _0x5c5a1b;}function _0x35adaf(_0x14e752,_0x498506){var _0xda3bfc=[{'name':_0x6845('0x1f'),'param':0x0},{'name':_0x6845('0x20'),'param':0x1},{'name':_0x6845('0x21'),'param':0x2},{'name':_0x6845('0x22'),'param':0x3}];var _0x1698bd={};var _0x367f98=_0x498506[_0x6845('0x23')](',');var _0x4f76da=[];for(var _0x4739fe=0x0;_0x4739fe<_0xda3bfc[_0x6845('0x24')];_0x4739fe++){switch(_0xda3bfc[_0x4739fe][_0x6845('0x25')]){case _0x6845('0x1f'):_0x1698bd[_0x6845('0x1f')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]][_0x6845('0x23')]('/')[0x1];_0x1698bd[_0x6845('0x27')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]][_0x6845('0x23')]('/')[0x2];_0x1698bd['prefix']=_0x1698bd[_0x6845('0x27')]?_0x1698bd[_0x6845('0x27')]['split']('$')[0x0]:undefined;_0x1698bd[_0x6845('0x27')]=_0x14e752[_0x6845('0x14')]?(_0x1698bd[_0x6845('0x28')]||'')+_0x6845('0x29')+_0x14e752[_0x6845('0x14')]+'}':(_0x1698bd[_0x6845('0x28')]||'')+_0x6845('0x15');_0x4f76da[_0xda3bfc[_0x4739fe]['param']]=['SIP',_0x1698bd['trunk'],_0x1698bd[_0x6845('0x27')]][_0x6845('0x2a')]('/');break;case _0x6845('0x21'):_0x1698bd[_0x6845('0x21')]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]];if(_0x14e752[_0x6845('0x1c')]!=='none'){if(_0x1698bd[_0x6845('0x21')][_0x6845('0x2b')](_0x6845('0x2c'))<0x0){_0x1698bd[_0x6845('0x21')]+=_0x6845('0x2c');}}else{_0x1698bd[_0x6845('0x21')]=_0x1698bd[_0x6845('0x21')][_0x6845('0x2d')](_0x6845('0x2c'),'');}_0x4f76da[_0xda3bfc[_0x4739fe][_0x6845('0x26')]]=_0x1698bd[_0x6845('0x21')];break;default:_0x4f76da[_0xda3bfc[_0x4739fe][_0x6845('0x26')]]=_0x367f98[_0xda3bfc[_0x4739fe][_0x6845('0x26')]];}}return _0x4f76da[_0x6845('0x2a')](',');}function _0x3d9825(_0x4a9cb1,_0x5cf943,_0x440067){return new Promise(function(_0x11e959,_0x4a9201){var _0x3eeb3f=[];if(_[_0x6845('0x2e')](_0x5cf943))return _0x11e959(_0x3eeb3f);_0x95d10d[_0x6845('0x2f')][_0x6845('0x30')]({'attributes':['id',_0x6845('0x31'),'IntervalId'],'raw':!![]})[_0x6845('0x32')](function(_0x3ca763){for(var _0x372d60=0x0,_0x209787=0x0;_0x372d60<_0x5cf943[_0x6845('0x24')];_0x372d60++,_0x209787=0x0){var _0x4ce0fa=_0x5cf943[_0x372d60];var _0x26ccea=[];var _0x1def0d=[];delete _0x4ce0fa['id'];if(_0x4ce0fa[_0x6845('0x31')]!=='*,*,*,*'){_0x4ce0fa['intervals']=[_0x4ce0fa['interval']];}else{_0x4ce0fa[_0x6845('0x33')]=_0x4ce0fa[_0x6845('0x34')]?_[_0x6845('0x35')](_['filter'](_0x3ca763,{'IntervalId':_0x4ce0fa['IntervalId']}),'interval'):[];}_0x4ce0fa[_0x6845('0x6')]=_0x4a9cb1[_0x6845('0x6')];_0x4ce0fa[_0x6845('0x7')]=_0x4a9cb1[_0x6845('0x7')];if(_0x4ce0fa['type'])_0x4ce0fa[_0x6845('0x3')]=_0x4ce0fa[_0x6845('0x3')]['toLowerCase']();if(_0x4a9cb1[_0x6845('0x3')]===_0x6845('0x12')){if(_0x4ce0fa[_0x6845('0x1b')](_0x6845('0x36'))&&_0x4ce0fa[_0x6845('0x36')]&&_0x4ce0fa[_0x6845('0x36')]!=='--'){_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')]['toLowerCase'](),'app':_0x6845('0x4'),'appdata':_0x6845('0x37')+_0x4ce0fa[_0x6845('0x36')],'context':_0x4a9cb1[_0x6845('0x6')],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':_0x6845('0x16'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x4ce0fa[_0x6845('0x39')]?_0x6845('0x3a')+_0x4ce0fa['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x4a9cb1[_0x6845('0x6')],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}else{if(_0x4ce0fa[_0x6845('0x1b')](_0x6845('0x3b'))){if(['queue',_0x6845('0x3c')][_0x6845('0x3d')](_0x4ce0fa[_0x6845('0x3e')][_0x6845('0x38')]())&&_0x4ce0fa['appType']!==_0x6845('0x3f')){if(_0x4ce0fa[_0x6845('0x3b')]){_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa['intervals'][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':_0x6845('0x4'),'appdata':_0x6845('0x40'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}else{_0x26ccea['push']({'type':_0x4ce0fa[_0x6845('0x3')][_0x6845('0x38')](),'app':'ExecIf','appdata':_0x6845('0x41'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1[_0x6845('0x7')],'priority':_0x4ce0fa[_0x6845('0x33')][_0x6845('0x24')]+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});_0x26ccea[_0x6845('0xc')]({'type':_0x4ce0fa[_0x6845('0x3')]['toLowerCase'](),'app':_0x6845('0x4'),'appdata':_0x6845('0x42'),'context':_0x4a9cb1['context'],'exten':_0x4a9cb1['exten'],'priority':_0x4ce0fa[_0x6845('0x33')]['length']+_0x440067+_0x209787++,'VoiceExtensionId':_0x4a9cb1['id']});}}}}for(var _0x47cc96=0x0;_0x47cc96<_0x4ce0fa['intervals'][_0x6845('0x24')];_0x47cc96++){var _0x50443e=_0x440067+_0x4ce0fa[_0x6845('0x33')]['length'];var _0x26c6f6=_0x47cc96===_0x4ce0fa['intervals']['length']-0x1?_0x440067+_0x26ccea[_0x6845('0x24')]+_0x1def0d['length']+0x2:_0x440067+_0x47cc96+0x1;_0x26ccea[_0x6845('0x43')](_0x47cc96,0x0,{'type':_0x4a9cb1[_0x6845('0x3')],'app':_0x6845('0x44'),'appdata':_0x4ce0fa[_0x6845('0x33')][_0x47cc96]+'?'+_0x4a9cb1['context']+_0x6845('0x45')+_0x50443e+':'+_0x4a9cb1['context']+_0x6845('0x45')+_0x26c6f6,'exten':_0x4a9cb1[_0x6845('0x7')],'context':_0x4a9cb1['context'],'priority':_0x440067+_0x47cc96,'VoiceExtensionId':_0x4a9cb1['id']});}if(_0x4ce0fa[_0x6845('0x46')]===_0x6845('0x47'))_0x4ce0fa[_0x6845('0x48')]=_0x35adaf(_0x4a9cb1,_0x4ce0fa[_0x6845('0x48')]);_0x4ce0fa[_0x6845('0x49')]=_0x26ccea['length']?_['last'](_0x26ccea)['priority']+0x1:_0x440067;_0x3eeb3f=_['concat'](_0x3eeb3f,_0x26ccea,[_0x4ce0fa],_0x1def0d);_0x440067=_[_0x6845('0x4a')](_0x3eeb3f)[_0x6845('0x49')]+0x1;}return _0x11e959(_0x3eeb3f);})['catch'](function(_0x28bcd2){_0x4a9201(_0x28bcd2);});});}return _0x4ac25c[_0x6845('0x4b')](_0x6845('0x4c'),attributes,{'tableName':_0x6845('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4e58c9){var _0x1ba944=this[_0x6845('0x4e')]({'plain':!![]});var _0x5355c6=_0x1ba944['type']===_0x6845('0x12')?_0x3d6f07(_0x1ba944):_0x20f486(_0x1ba944);return _0x3d9825(_0x1ba944,_0x4e58c9,_[_0x6845('0x4a')](_0x5355c6)[_0x6845('0x49')]+0x1)[_0x6845('0x32')](function(_0x56f077){var _0x572ef1=_[_0x6845('0x4f')](_0x5355c6,_0x56f077);_0x572ef1[_0x6845('0xc')]({'type':_0x1ba944['type'],'app':_0x6845('0x50'),'exten':_0x1ba944['exten'],'context':_0x1ba944[_0x6845('0x6')],'priority':_['last'](_0x572ef1)[_0x6845('0x49')]+0x1,'VoiceExtensionId':_0x1ba944['id']});return _0x572ef1;});}}});}; \ No newline at end of file +var _0x0023=['callerID','answer','queue','playback','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','get','Hangup','lodash','exports','models','type','CDR(type)=','context','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','push','inbound','Set','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','url','length','name','split','param','prefix','phone','SIP','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0023,0x10a));var _0x3002=function(_0x556afd,_0x26c2c3){_0x556afd=_0x556afd-0x0;var _0x708f4c=_0x0023[_0x556afd];return _0x708f4c;};'use strict';var _=require(_0x3002('0x0'));var attributes=require('./voiceExtension.attributes');module[_0x3002('0x1')]=function(_0x27eab5){var _0x459746=_0x27eab5[_0x3002('0x2')];function _0x5335a4(_0x1eb073){var _0x5b257c=0x2;var _0x531e8c=[{'type':_0x1eb073[_0x3002('0x3')],'app':'Set','appdata':_0x3002('0x4')+_0x1eb073[_0x3002('0x3')],'context':_0x1eb073[_0x3002('0x5')],'exten':_0x1eb073[_0x3002('0x6')],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']},{'type':_0x1eb073[_0x3002('0x3')],'app':_0x1eb073[_0x3002('0x7')]?'Set':_0x3002('0x8'),'appdata':_0x1eb073['alias']?_0x3002('0x9')+_0x1eb073[_0x3002('0x7')]:_0x3002('0xa'),'context':_0x1eb073[_0x3002('0x5')],'exten':_0x1eb073[_0x3002('0x6')],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']}];if(_0x1eb073[_0x3002('0x3')]==='inbound'){_0x531e8c[_0x3002('0xb')]({'type':_0x3002('0xc'),'app':_0x3002('0xd'),'appdata':_0x3002('0xe')+_0x1eb073['id'],'context':_0x1eb073['context'],'exten':_0x1eb073[_0x3002('0x6')],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']});}_0x531e8c[_0x3002('0xb')]({'type':_0x1eb073[_0x3002('0x3')],'app':_0x3002('0xd'),'appdata':_0x3002('0xf'),'context':_0x1eb073[_0x3002('0x5')],'exten':_0x1eb073[_0x3002('0x6')],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']},{'type':_0x1eb073[_0x3002('0x3')],'app':_0x3002('0xd'),'appdata':_0x3002('0x10'),'context':_0x1eb073[_0x3002('0x5')],'exten':_0x1eb073[_0x3002('0x6')],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']},{'type':_0x1eb073['type'],'app':_0x3002('0xd'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1eb073[_0x3002('0x5')],'exten':_0x1eb073['exten'],'priority':_0x5b257c++,'VoiceExtensionId':_0x1eb073['id']});return _0x531e8c;}function _0x4da0f0(_0x3628f9){var _0x5d12e7=0x2;var _0x3751c1=[{'type':'outbound','app':'Set','appdata':_0x3002('0x11'),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3628f9[_0x3002('0x7')]?_0x3002('0xd'):'NoOp','appdata':_0x3628f9[_0x3002('0x7')]?'CDR(routeAlias)='+_0x3628f9[_0x3002('0x7')]:_0x3002('0xa'),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9['exten'],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0x13')+(_0x3628f9['cutdigits']?_0x3002('0x14')+_0x3628f9[_0x3002('0x15')]+'}':_0x3002('0x16')),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9['exten'],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0xe')+_0x3628f9['id'],'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0x17'),'appdata':_0x3002('0x18')+(_0x5d12e7+0x2)+_0x3002('0x19')+(_0x5d12e7+0x1)+')','context':_0x3628f9['context'],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3628f9[_0x3002('0x15')]?'CDR(prefix)=${EXTEN:0:'+_0x3628f9[_0x3002('0x15')]+'}':_0x3002('0x1a'),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0x10'),'context':_0x3628f9['context'],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':'outbound','app':'Set','appdata':_0x3002('0x1b'),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0x1c')+_0x3628f9['id'],'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9['exten'],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']}];if(_0x3628f9[_0x3002('0x1d')](_0x3002('0x1e'))&&_0x3628f9['recordingFormat']!==_0x3002('0x1f')){_0x3751c1['push']({'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0x20'),'context':_0x3628f9[_0x3002('0x5')],'exten':_0x3628f9['exten'],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']},{'type':_0x3002('0x12'),'app':_0x3002('0xd'),'appdata':_0x3002('0x21')+_0x3628f9[_0x3002('0x1e')]||_0x3002('0x22'),'context':_0x3628f9['context'],'exten':_0x3628f9[_0x3002('0x6')],'priority':_0x5d12e7++,'VoiceExtensionId':_0x3628f9['id']});}return _0x3751c1;}function _0x397bbd(_0x3ace82,_0x89bc37){var _0x52e27c=[{'name':_0x3002('0x23'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x3002('0x24'),'param':0x2},{'name':_0x3002('0x25'),'param':0x3}];var _0x3de92d={};var _0x494832=_0x89bc37['split'](',');var _0x2e7608=[];for(var _0x5089a6=0x0;_0x5089a6<_0x52e27c[_0x3002('0x26')];_0x5089a6++){switch(_0x52e27c[_0x5089a6][_0x3002('0x27')]){case _0x3002('0x23'):_0x3de92d[_0x3002('0x23')]=_0x494832[_0x52e27c[_0x5089a6]['param']][_0x3002('0x28')]('/')[0x1];_0x3de92d['phone']=_0x494832[_0x52e27c[_0x5089a6][_0x3002('0x29')]][_0x3002('0x28')]('/')[0x2];_0x3de92d[_0x3002('0x2a')]=_0x3de92d[_0x3002('0x2b')]?_0x3de92d[_0x3002('0x2b')][_0x3002('0x28')]('$')[0x0]:undefined;_0x3de92d[_0x3002('0x2b')]=_0x3ace82[_0x3002('0x15')]?(_0x3de92d[_0x3002('0x2a')]||'')+_0x3002('0x14')+_0x3ace82['cutdigits']+'}':(_0x3de92d[_0x3002('0x2a')]||'')+_0x3002('0x16');_0x2e7608[_0x52e27c[_0x5089a6]['param']]=[_0x3002('0x2c'),_0x3de92d[_0x3002('0x23')],_0x3de92d[_0x3002('0x2b')]]['join']('/');break;case _0x3002('0x24'):_0x3de92d[_0x3002('0x24')]=_0x494832[_0x52e27c[_0x5089a6][_0x3002('0x29')]];if(_0x3ace82[_0x3002('0x1e')]!=='none'){if(_0x3de92d[_0x3002('0x24')][_0x3002('0x2d')](_0x3002('0x2e'))<0x0){_0x3de92d[_0x3002('0x24')]+=_0x3002('0x2e');}}else{_0x3de92d[_0x3002('0x24')]=_0x3de92d[_0x3002('0x24')][_0x3002('0x2f')]('U(xcally-mixmonitor-context)','');}_0x2e7608[_0x52e27c[_0x5089a6][_0x3002('0x29')]]=_0x3de92d[_0x3002('0x24')];break;default:_0x2e7608[_0x52e27c[_0x5089a6][_0x3002('0x29')]]=_0x494832[_0x52e27c[_0x5089a6][_0x3002('0x29')]];}}return _0x2e7608[_0x3002('0x30')](',');}function _0x1fd36b(_0x38f044,_0x2bd4d3,_0x14c3c4){return new Promise(function(_0x3bc9e7,_0x15f0cd){var _0x209903=[];if(_[_0x3002('0x31')](_0x2bd4d3))return _0x3bc9e7(_0x209903);_0x459746[_0x3002('0x32')][_0x3002('0x33')]({'attributes':['id',_0x3002('0x34'),_0x3002('0x35')],'raw':!![]})[_0x3002('0x36')](function(_0x365755){for(var _0xad78fe=0x0,_0x10821e=0x0;_0xad78fe<_0x2bd4d3[_0x3002('0x26')];_0xad78fe++,_0x10821e=0x0){var _0x4beb7b=_0x2bd4d3[_0xad78fe];var _0x128f3f=[];var _0x137e95=[];delete _0x4beb7b['id'];if(_0x4beb7b[_0x3002('0x34')]!==_0x3002('0x37')){_0x4beb7b[_0x3002('0x38')]=[_0x4beb7b['interval']];}else{_0x4beb7b[_0x3002('0x38')]=_0x4beb7b['IntervalId']?_[_0x3002('0x39')](_['filter'](_0x365755,{'IntervalId':_0x4beb7b['IntervalId']}),'interval'):[];}_0x4beb7b[_0x3002('0x5')]=_0x38f044['context'];_0x4beb7b[_0x3002('0x6')]=_0x38f044[_0x3002('0x6')];if(_0x4beb7b[_0x3002('0x3')])_0x4beb7b['type']=_0x4beb7b['type'][_0x3002('0x3a')]();if(_0x38f044[_0x3002('0x3')]===_0x3002('0x12')){if(_0x4beb7b[_0x3002('0x1d')](_0x3002('0x3b'))&&_0x4beb7b[_0x3002('0x3b')]&&_0x4beb7b[_0x3002('0x3b')]!=='--'){_0x128f3f[_0x3002('0xb')]({'type':_0x4beb7b[_0x3002('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x3002('0x3c')+_0x4beb7b[_0x3002('0x3b')],'context':_0x38f044[_0x3002('0x5')],'exten':_0x38f044[_0x3002('0x6')],'priority':_0x4beb7b[_0x3002('0x38')]['length']+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});}_0x128f3f[_0x3002('0xb')]({'type':_0x4beb7b['type'][_0x3002('0x3a')](),'app':'ExecIf','appdata':_0x3002('0x3d')+(_0x4beb7b[_0x3002('0x3e')]?'Set(CALLERID(all)='+_0x4beb7b[_0x3002('0x3e')]+')':'NoOp(No\x20number\x20available)'),'context':_0x38f044['context'],'exten':_0x38f044[_0x3002('0x6')],'priority':_0x4beb7b[_0x3002('0x38')][_0x3002('0x26')]+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});}else{if(_0x4beb7b['hasOwnProperty'](_0x3002('0x3f'))){if([_0x3002('0x40'),_0x3002('0x41')]['includes'](_0x4beb7b['app']['toLowerCase']())&&_0x4beb7b['appType']!==_0x3002('0x42')){if(_0x4beb7b[_0x3002('0x3f')]){_0x128f3f[_0x3002('0xb')]({'type':_0x4beb7b[_0x3002('0x3')][_0x3002('0x3a')](),'app':_0x3002('0x17'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x38f044[_0x3002('0x5')],'exten':_0x38f044['exten'],'priority':_0x4beb7b[_0x3002('0x38')][_0x3002('0x26')]+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});_0x128f3f[_0x3002('0xb')]({'type':_0x4beb7b['type'][_0x3002('0x3a')](),'app':_0x3002('0xd'),'appdata':_0x3002('0x43'),'context':_0x38f044[_0x3002('0x5')],'exten':_0x38f044['exten'],'priority':_0x4beb7b[_0x3002('0x38')][_0x3002('0x26')]+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});}else{_0x128f3f['push']({'type':_0x4beb7b['type']['toLowerCase'](),'app':_0x3002('0x17'),'appdata':_0x3002('0x44'),'context':_0x38f044['context'],'exten':_0x38f044[_0x3002('0x6')],'priority':_0x4beb7b['intervals'][_0x3002('0x26')]+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});_0x128f3f[_0x3002('0xb')]({'type':_0x4beb7b[_0x3002('0x3')]['toLowerCase'](),'app':'Set','appdata':_0x3002('0x45'),'context':_0x38f044[_0x3002('0x5')],'exten':_0x38f044['exten'],'priority':_0x4beb7b[_0x3002('0x38')][_0x3002('0x26')]+_0x14c3c4+_0x10821e++,'VoiceExtensionId':_0x38f044['id']});}}}}for(var _0x435bd1=0x0;_0x435bd1<_0x4beb7b[_0x3002('0x38')][_0x3002('0x26')];_0x435bd1++){var _0x5f2210=_0x14c3c4+_0x4beb7b[_0x3002('0x38')]['length'];var _0x551e8c=_0x435bd1===_0x4beb7b[_0x3002('0x38')]['length']-0x1?_0x14c3c4+_0x128f3f[_0x3002('0x26')]+_0x137e95[_0x3002('0x26')]+0x2:_0x14c3c4+_0x435bd1+0x1;_0x128f3f[_0x3002('0x46')](_0x435bd1,0x0,{'type':_0x38f044[_0x3002('0x3')],'app':'GotoIfTime','appdata':_0x4beb7b['intervals'][_0x435bd1]+'?'+_0x38f044[_0x3002('0x5')]+_0x3002('0x47')+_0x5f2210+':'+_0x38f044[_0x3002('0x5')]+_0x3002('0x47')+_0x551e8c,'exten':_0x38f044[_0x3002('0x6')],'context':_0x38f044[_0x3002('0x5')],'priority':_0x14c3c4+_0x435bd1,'VoiceExtensionId':_0x38f044['id']});}if(_0x4beb7b['appType']===_0x3002('0x48'))_0x4beb7b[_0x3002('0x49')]=_0x397bbd(_0x38f044,_0x4beb7b[_0x3002('0x49')]);_0x4beb7b[_0x3002('0x4a')]=_0x128f3f[_0x3002('0x26')]?_['last'](_0x128f3f)[_0x3002('0x4a')]+0x1:_0x14c3c4;_0x209903=_[_0x3002('0x4b')](_0x209903,_0x128f3f,[_0x4beb7b],_0x137e95);_0x14c3c4=_[_0x3002('0x4c')](_0x209903)[_0x3002('0x4a')]+0x1;}return _0x3bc9e7(_0x209903);})[_0x3002('0x4d')](function(_0x222eae){_0x15f0cd(_0x222eae);});});}return _0x27eab5[_0x3002('0x4e')](_0x3002('0x4f'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x33cb34){var _0x561d59=this[_0x3002('0x50')]({'plain':!![]});var _0xfd45d7=_0x561d59[_0x3002('0x3')]===_0x3002('0x12')?_0x4da0f0(_0x561d59):_0x5335a4(_0x561d59);return _0x1fd36b(_0x561d59,_0x33cb34,_['last'](_0xfd45d7)[_0x3002('0x4a')]+0x1)['then'](function(_0x3ee3ae){var _0x555a1c=_[_0x3002('0x4b')](_0xfd45d7,_0x3ee3ae);_0x555a1c[_0x3002('0xb')]({'type':_0x561d59[_0x3002('0x3')],'app':_0x3002('0x51'),'exten':_0x561d59[_0x3002('0x6')],'context':_0x561d59[_0x3002('0x5')],'priority':_[_0x3002('0x4c')](_0x555a1c)[_0x3002('0x4a')]+0x1,'VoiceExtensionId':_0x561d59['id']});return _0x555a1c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 20b4f23..b7b352c 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 _0xf69d=['./voiceExtension.socket','register','request','then','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch','GetVoiceExtension','options','raw','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf69d,0xd3));var _0xdf69=function(_0x56356f,_0x487c2f){_0x56356f=_0x56356f-0x0;var _0x4a8bd6=_0xf69d[_0x56356f];return _0x4a8bd6;};'use strict';var _=require(_0xdf69('0x0'));var util=require(_0xdf69('0x1'));var moment=require(_0xdf69('0x2'));var BPromise=require(_0xdf69('0x3'));var rs=require(_0xdf69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf69('0x5'))['db'];var utils=require(_0xdf69('0x6'));var logger=require(_0xdf69('0x7'))(_0xdf69('0x8'));var config=require(_0xdf69('0x9'));var jayson=require(_0xdf69('0xa'));var client=jayson[_0xdf69('0xb')][_0xdf69('0xc')]({'port':0x232a});config[_0xdf69('0xd')]=_[_0xdf69('0xe')](config[_0xdf69('0xd')],{'host':_0xdf69('0xf'),'port':0x18eb});var socket=require(_0xdf69('0x10'))(new Redis(config[_0xdf69('0xd')]));require(_0xdf69('0x11'))[_0xdf69('0x12')](socket);function respondWithRpcPromise(_0x1e0e8d,_0x4fcc93,_0x305726){return new BPromise(function(_0x420011,_0x20cc6c){return client[_0xdf69('0x13')](_0x1e0e8d,_0x305726)[_0xdf69('0x14')](function(_0x1b86d4){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x4fcc93,'request\x20sent');logger['debug'](_0xdf69('0x15'),_0x4fcc93,_0xdf69('0x16'),JSON[_0xdf69('0x17')](_0x1b86d4));if(_0x1b86d4[_0xdf69('0x18')]){if(_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x19')]===0x1f4){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x20cc6c(_0x1b86d4[_0xdf69('0x18')]['message']);}logger[_0xdf69('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x4fcc93,_0x1b86d4[_0xdf69('0x18')][_0xdf69('0x1b')]);return _0x420011(_0x1b86d4['error'][_0xdf69('0x1b')]);}else{logger[_0xdf69('0x1c')](_0xdf69('0x1a'),_0x4fcc93,_0xdf69('0x16'));_0x420011(_0x1b86d4['result']['message']);}})[_0xdf69('0x1d')](function(_0x15e73a){logger['error'](_0xdf69('0x1a'),_0x4fcc93,_0x15e73a);_0x20cc6c(_0x15e73a);});});}exports[_0xdf69('0x1e')]=function(_0x68fa80){var _0x526cbc=this;return new Promise(function(_0x4776df,_0x452cfa){return db['VoiceExtension']['findAll']({'raw':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80[_0xdf69('0x1f')][_0xdf69('0x20')]===undefined?!![]:![]:!![],'where':_0x68fa80['options']?_0x68fa80['options']['where']||null:null,'attributes':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80['options'][_0xdf69('0x21')]||null:null,'limit':_0x68fa80[_0xdf69('0x1f')]?_0x68fa80[_0xdf69('0x1f')]['limit']||null:null,'include':_0x68fa80['options']?_0x68fa80[_0xdf69('0x1f')][_0xdf69('0x22')]?_[_0xdf69('0x23')](_0x68fa80[_0xdf69('0x1f')]['include'],function(_0x3b727c){return{'model':db[_0x3b727c[_0xdf69('0x24')]],'as':_0x3b727c['as'],'attributes':_0x3b727c[_0xdf69('0x21')],'include':_0x3b727c['include']?_[_0xdf69('0x23')](_0x3b727c['include'],function(_0x5dcabd){return{'model':db[_0x5dcabd['model']],'as':_0x5dcabd['as'],'attributes':_0x5dcabd['attributes'],'include':_0x5dcabd[_0xdf69('0x22')]?_[_0xdf69('0x23')](_0x5dcabd['include'],function(_0x301bd2){return{'model':db[_0x301bd2[_0xdf69('0x24')]],'as':_0x301bd2['as'],'attributes':_0x301bd2[_0xdf69('0x21')]};}):[]};}):[]};}):[]:[]})[_0xdf69('0x14')](function(_0x1b7c16){logger[_0xdf69('0x1c')](_0xdf69('0x1e'),_0x68fa80);logger[_0xdf69('0x25')](_0xdf69('0x1e'),_0x68fa80,JSON[_0xdf69('0x17')](_0x1b7c16));_0x4776df(_0x1b7c16);})[_0xdf69('0x1d')](function(_0x2a23ed){logger[_0xdf69('0x18')](_0xdf69('0x1e'),_0x2a23ed[_0xdf69('0x1b')],_0x68fa80);_0x452cfa(_0x526cbc[_0xdf69('0x18')](0x1f4,_0x2a23ed[_0xdf69('0x1b')]));});});}; \ No newline at end of file +var _0x1228=['socket.io-emitter','./voiceExtension.socket','register','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','GetVoiceExtension','VoiceExtension','options','raw','where','limit','include','map','model','attributes','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x12ad1b,_0x106d01){var _0x22efbb=function(_0x468f70){while(--_0x468f70){_0x12ad1b['push'](_0x12ad1b['shift']());}};_0x22efbb(++_0x106d01);}(_0x1228,0x12f));var _0x8122=function(_0x3367b7,_0x1e0234){_0x3367b7=_0x3367b7-0x0;var _0x52bb97=_0x1228[_0x3367b7];return _0x52bb97;};'use strict';var _=require(_0x8122('0x0'));var util=require('util');var moment=require(_0x8122('0x1'));var BPromise=require('bluebird');var rs=require(_0x8122('0x2'));var fs=require('fs');var Redis=require(_0x8122('0x3'));var db=require(_0x8122('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8122('0x5'))(_0x8122('0x6'));var config=require('../../config/environment');var jayson=require(_0x8122('0x7'));var client=jayson[_0x8122('0x8')]['http']({'port':0x232a});config[_0x8122('0x9')]=_[_0x8122('0xa')](config['redis'],{'host':_0x8122('0xb'),'port':0x18eb});var socket=require(_0x8122('0xc'))(new Redis(config['redis']));require(_0x8122('0xd'))[_0x8122('0xe')](socket);function respondWithRpcPromise(_0x4a1378,_0x5a7875,_0x4fa7b3){return new BPromise(function(_0x52f48b,_0x208043){return client['request'](_0x4a1378,_0x4fa7b3)[_0x8122('0xf')](function(_0x23a9e4){logger[_0x8122('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x5a7875,_0x8122('0x11'));logger['debug'](_0x8122('0x12'),_0x5a7875,_0x8122('0x11'),JSON[_0x8122('0x13')](_0x23a9e4));if(_0x23a9e4[_0x8122('0x14')]){if(_0x23a9e4[_0x8122('0x14')][_0x8122('0x15')]===0x1f4){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);return _0x208043(_0x23a9e4[_0x8122('0x14')][_0x8122('0x17')]);}logger['error'](_0x8122('0x16'),_0x5a7875,_0x23a9e4['error'][_0x8122('0x17')]);return _0x52f48b(_0x23a9e4['error'][_0x8122('0x17')]);}else{logger[_0x8122('0x10')](_0x8122('0x16'),_0x5a7875,_0x8122('0x11'));_0x52f48b(_0x23a9e4['result']['message']);}})['catch'](function(_0x56a926){logger[_0x8122('0x14')](_0x8122('0x16'),_0x5a7875,_0x56a926);_0x208043(_0x56a926);});});}exports[_0x8122('0x18')]=function(_0x5a5a57){var _0x5df55f=this;return new Promise(function(_0x1162a8,_0x174321){return db[_0x8122('0x19')]['findAll']({'raw':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1c')]||null:null,'attributes':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')]['attributes']||null:null,'limit':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57['options'][_0x8122('0x1d')]||null:null,'include':_0x5a5a57[_0x8122('0x1a')]?_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x5a5a57[_0x8122('0x1a')][_0x8122('0x1e')],function(_0x2708a5){return{'model':db[_0x2708a5[_0x8122('0x20')]],'as':_0x2708a5['as'],'attributes':_0x2708a5['attributes'],'include':_0x2708a5[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0x2708a5[_0x8122('0x1e')],function(_0xc90a18){return{'model':db[_0xc90a18[_0x8122('0x20')]],'as':_0xc90a18['as'],'attributes':_0xc90a18[_0x8122('0x21')],'include':_0xc90a18[_0x8122('0x1e')]?_[_0x8122('0x1f')](_0xc90a18[_0x8122('0x1e')],function(_0x4610b1){return{'model':db[_0x4610b1['model']],'as':_0x4610b1['as'],'attributes':_0x4610b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x8122('0xf')](function(_0x264ccf){logger['info']('GetVoiceExtension',_0x5a5a57);logger[_0x8122('0x22')](_0x8122('0x18'),_0x5a5a57,JSON[_0x8122('0x13')](_0x264ccf));_0x1162a8(_0x264ccf);})['catch'](function(_0x4c8339){logger[_0x8122('0x14')](_0x8122('0x18'),_0x4c8339[_0x8122('0x17')],_0x5a5a57);_0x174321(_0x5df55f[_0x8122('0x14')](0x1f4,_0x4c8339[_0x8122('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 566b149..1ecb6ee 100644 --- a/server/api/voiceExtension/voiceExtension.socket.js +++ b/server/api/voiceExtension/voiceExtension.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x3d1ec3,_0x5e2d7c){var _0x998c76=function(_0x38054a){while(--_0x38054a){_0x3d1ec3['push'](_0x3d1ec3['shift']());}};_0x998c76(++_0x5e2d7c);}(_0x5fab,0x177));var _0xb5fa=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x5fab[_0x741a7b];return _0x43a8e6;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x34105f,_0x3f464b){var _0xd6d36e=function(_0x1c82ef){while(--_0x1c82ef){_0x34105f['push'](_0x34105f['shift']());}};_0xd6d36e(++_0x3f464b);}(_0x5fab,0x177));var _0xb5fa=function(_0x2c8afe,_0x100f80){_0x2c8afe=_0x2c8afe-0x0;var _0x982977=_0x5fab[_0x2c8afe];return _0x982977;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 90518f8..872dafa 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 _0x77d4=['index','show','getMessages','post','create','/:id','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../config/environment','./voiceMail.controller','get','isAuthenticated'];(function(_0x38ba3f,_0x1fefe3){var _0x4076d2=function(_0x55f7f9){while(--_0x55f7f9){_0x38ba3f['push'](_0x38ba3f['shift']());}};_0x4076d2(++_0x1fefe3);}(_0x77d4,0x108));var _0x477d=function(_0x1c7377,_0x8a8698){_0x1c7377=_0x1c7377-0x0;var _0x5d03e3=_0x77d4[_0x1c7377];return _0x5d03e3;};'use strict';var multer=require('multer');var util=require(_0x477d('0x0'));var path=require('path');var timeout=require(_0x477d('0x1'));var express=require('express');var router=express[_0x477d('0x2')]();var fs_extra=require(_0x477d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x477d('0x4'));var controller=require(_0x477d('0x5'));router[_0x477d('0x6')]('/',auth[_0x477d('0x7')](),controller[_0x477d('0x8')]);router[_0x477d('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x477d('0x9')]);router['get']('/:id/messages',auth[_0x477d('0x7')](),controller[_0x477d('0xa')]);router[_0x477d('0xb')]('/',auth[_0x477d('0x7')](),controller[_0x477d('0xc')]);router['put'](_0x477d('0xd'),auth['isAuthenticated'](),controller[_0x477d('0xe')]);router[_0x477d('0xf')]('/:id',auth[_0x477d('0x7')](),controller[_0x477d('0x10')]);module['exports']=router; \ No newline at end of file +var _0xba34=['getMessages','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages'];(function(_0x85d56d,_0x37f5c1){var _0x51f613=function(_0x4927df){while(--_0x4927df){_0x85d56d['push'](_0x85d56d['shift']());}};_0x51f613(++_0x37f5c1);}(_0xba34,0x119));var _0x4ba3=function(_0x3c8544,_0x3f16b5){_0x3c8544=_0x3c8544-0x0;var _0x3af73a=_0xba34[_0x3c8544];return _0x3af73a;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/:id',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router[_0x4ba3('0x13')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 73cde76..d3d7a91 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 _0x8c14=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0x8c14,0xc5));var _0x48c1=function(_0x2282af,_0x1c263f){_0x2282af=_0x2282af-0x0;var _0x599a7e=_0x8c14[_0x2282af];return _0x599a7e;};'use strict';var Sequelize=require(_0x48c1('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x48c1('0x1')],'defaultValue':_0x48c1('0x2'),'unique':_0x48c1('0x3')},'mailbox':{'type':Sequelize[_0x48c1('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x48c1('0x1')]},'fullname':{'type':Sequelize[_0x48c1('0x1')]},'email':{'type':Sequelize[_0x48c1('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5d0cb1){this[_0x48c1('0x4')](_0x48c1('0x5'),typeof _0x5d0cb1===_0x48c1('0x6')&&_0x5d0cb1[_0x48c1('0x7')]()?_0x5d0cb1[_0x48c1('0x7')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x48c1('0x8')},'attach':{'type':Sequelize[_0x48c1('0x9')]('yes','no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x48c1('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x48c1('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x48c1('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x48c1('0x9')](_0x48c1('0xa'),'no'),'defaultValue':_0x48c1('0xa'),'allowNull':![]},'stamp':{'type':_0x48c1('0xc')},'emailsubject':{'type':Sequelize[_0x48c1('0x1')]},'emailbody':{'type':Sequelize[_0x48c1('0x1')]},'maxsecs':{'type':Sequelize[_0x48c1('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x48c1('0xe')],'get':function(){return this['getDataValue'](_0x48c1('0xf'))+_0x48c1('0x10')+this[_0x48c1('0x11')](_0x48c1('0x12'));}}}; \ No newline at end of file +var _0xcdf5=['from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING'];(function(_0x24775c,_0x46cd47){var _0x4689de=function(_0x1fb0a3){while(--_0x1fb0a3){_0x24775c['push'](_0x24775c['shift']());}};_0x4689de(++_0x46cd47);}(_0xcdf5,0x95));var _0x5cdf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xcdf5[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x5cdf('0x0'));module[_0x5cdf('0x1')]={'customer_id':{'type':Sequelize[_0x5cdf('0x2')]},'context':{'type':Sequelize[_0x5cdf('0x2')],'defaultValue':_0x5cdf('0x3'),'unique':_0x5cdf('0x4')},'mailbox':{'type':Sequelize[_0x5cdf('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5cdf('0x4')},'password':{'type':Sequelize[_0x5cdf('0x2')]},'fullname':{'type':Sequelize[_0x5cdf('0x2')]},'email':{'type':Sequelize[_0x5cdf('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4829fd){this[_0x5cdf('0x5')](_0x5cdf('0x6'),typeof _0x4829fd===_0x5cdf('0x7')&&_0x4829fd[_0x5cdf('0x8')]()?_0x4829fd[_0x5cdf('0x8')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x5cdf('0x2')],'defaultValue':_0x5cdf('0x9')},'attach':{'type':Sequelize[_0x5cdf('0xa')]('yes','no'),'defaultValue':_0x5cdf('0xb'),'allowNull':![]},'saycid':{'type':Sequelize[_0x5cdf('0xa')](_0x5cdf('0xb'),'no'),'defaultValue':_0x5cdf('0xb'),'allowNull':![]},'dialout':{'type':Sequelize[_0x5cdf('0x2')]},'callback':{'type':Sequelize[_0x5cdf('0x2')]},'review':{'type':Sequelize[_0x5cdf('0xa')](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x5cdf('0xa')](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5cdf('0xa')](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5cdf('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5cdf('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5cdf('0xa')]('yes','no'),'defaultValue':_0x5cdf('0xb'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x5cdf('0xb'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5cdf('0xa')](_0x5cdf('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x5cdf('0xd')},'emailsubject':{'type':Sequelize[_0x5cdf('0x2')]},'emailbody':{'type':Sequelize[_0x5cdf('0x2')]},'maxsecs':{'type':Sequelize[_0x5cdf('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x5cdf('0xf')](_0x5cdf('0x10'))+_0x5cdf('0x11')+this['getDataValue'](_0x5cdf('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 47870d5..ca2ad53 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 _0xd4f4=['get','Voicemails','then','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','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','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy'];(function(_0x545e41,_0x55830d){var _0x20ee17=function(_0xac9b17){while(--_0xac9b17){_0x545e41['push'](_0x545e41['shift']());}};_0x20ee17(++_0x55830d);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x29df7d,_0xd61a65){_0x29df7d=_0x29df7d-0x0;var _0xd68f20=_0xd4f4[_0x29df7d];return _0xd68f20;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['VoiceMail'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['VoiceMail'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['VoiceMail'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['VoiceMail'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));};exports[_0x4d4f('0x58')]=function(_0x23bf8e,_0x213cdb,_0x29a3a1){return db['VoiceMail']['findOne']({'where':{'id':_0x23bf8e[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x213cdb,null))[_0x4d4f('0x2d')](function(_0xadc9ac){var _0x23771c;var _0x4585b5={},_0x31aba3={};_0x31aba3[_0x4d4f('0x3d')]=_['keys'](db[_0x4d4f('0x59')][_0x4d4f('0x34')]);_0x31aba3[_0x4d4f('0x37')]=_['keys'](_0x23bf8e[_0x4d4f('0x37')]);_0x31aba3[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x31aba3['model'],_0x31aba3[_0x4d4f('0x37')]);_0x4585b5['attributes']=_[_0x4d4f('0x39')](_0x31aba3[_0x4d4f('0x3d')],qs[_0x4d4f('0x3b')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x4585b5[_0x4d4f('0x3a')]=_0x4585b5[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x4585b5[_0x4d4f('0x3a')]:_0x31aba3['model'];if(!_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x4585b5[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x23')]);_0x4585b5['offset']=qs[_0x4d4f('0x21')](_0x23bf8e[_0x4d4f('0x37')]['offset']);}_0x4585b5['order']=qs[_0x4d4f('0x40')](_0x23bf8e[_0x4d4f('0x37')]['sort']);_0x4585b5['where']=qs['filters'](_[_0x4d4f('0x41')](_0x23bf8e[_0x4d4f('0x37')],_0x31aba3['filters']));if(_0x23bf8e[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'$or':_[_0x4d4f('0x32')](_0x4585b5[_0x4d4f('0x3a')],function(_0x20845c){var _0x542513={};_0x542513[_0x20845c]={'$like':'%'+_0x23bf8e[_0x4d4f('0x37')]['filter']+'%'};return _0x542513;})});}_0x4585b5[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x4585b5[_0x4d4f('0x43')],{'mailboxuser':_0xadc9ac['mailbox']});_0x4585b5=_[_0x4d4f('0x44')]({},_0x4585b5,_0x23bf8e[_0x4d4f('0x47')]);return db[_0x4d4f('0x59')][_0x4d4f('0x5a')](_0x4585b5)['then'](respondWithFilteredResult(_0x213cdb,_0x4585b5));})[_0x4d4f('0x4c')](handleError(_0x213cdb,null));}; \ No newline at end of file +var _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x54953c,_0x5a1188){var _0x307915=function(_0x2d7a47){while(--_0x2d7a47){_0x54953c['push'](_0x54953c['shift']());}};_0x307915(++_0x5a1188);}(_0x58a4,0xbf));var _0x458a=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0x58a4[_0x3198fd];return _0x2dd0b;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 59f72fb..684adf9 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 _0xaa76=['bluebird','request-promise','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','../../config/logger','api','moment'];(function(_0x13be43,_0x1261e8){var _0x2b5d2f=function(_0x4a979f){while(--_0x4a979f){_0x13be43['push'](_0x13be43['shift']());}};_0x2b5d2f(++_0x1261e8);}(_0xaa76,0x1bc));var _0x6aa7=function(_0x24d7d2,_0x2d04ec){_0x24d7d2=_0x24d7d2-0x0;var _0x7c0a5f=_0xaa76[_0x24d7d2];return _0x7c0a5f;};'use strict';var _=require(_0x6aa7('0x0'));var util=require('util');var logger=require(_0x6aa7('0x1'))(_0x6aa7('0x2'));var moment=require(_0x6aa7('0x3'));var BPromise=require(_0x6aa7('0x4'));var rp=require(_0x6aa7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6aa7('0x6'));module[_0x6aa7('0x7')]=function(_0x5d4e1a,_0x4da9df){return _0x5d4e1a[_0x6aa7('0x8')](_0x6aa7('0x9'),attributes,{'tableName':_0x6aa7('0xa'),'paranoid':![],'indexes':[{'name':_0x6aa7('0xb'),'fields':[_0x6aa7('0xc'),_0x6aa7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd10d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','mailbox_context','context','util','../../config/logger','api'];(function(_0x445970,_0x217bd1){var _0x17d902=function(_0x1eafdb){while(--_0x1eafdb){_0x445970['push'](_0x445970['shift']());}};_0x17d902(++_0x217bd1);}(_0xd10d,0x190));var _0xdd10=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0xd10d[_0x305c8f];return _0x5ddc30;};'use strict';var _=require('lodash');var util=require(_0xdd10('0x0'));var logger=require(_0xdd10('0x1'))(_0xdd10('0x2'));var moment=require(_0xdd10('0x3'));var BPromise=require(_0xdd10('0x4'));var rp=require(_0xdd10('0x5'));var fs=require('fs');var path=require(_0xdd10('0x6'));var rimraf=require(_0xdd10('0x7'));var config=require(_0xdd10('0x8'));var attributes=require(_0xdd10('0x9'));module['exports']=function(_0x565158,_0x2e1054){return _0x565158['define'](_0xdd10('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xdd10('0xb'),'fields':['mailbox',_0xdd10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index a2c461f..bd3d73d 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 _0x5333=['../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x5333,0x69));var _0x3533=function(_0x250298,_0x5a869a){_0x250298=_0x250298-0x0;var _0x798dbf=_0x5333[_0x250298];return _0x798dbf;};'use strict';var _=require(_0x3533('0x0'));var util=require(_0x3533('0x1'));var moment=require(_0x3533('0x2'));var BPromise=require(_0x3533('0x3'));var rs=require(_0x3533('0x4'));var fs=require('fs');var Redis=require(_0x3533('0x5'));var db=require(_0x3533('0x6'))['db'];var utils=require(_0x3533('0x7'));var logger=require(_0x3533('0x8'))(_0x3533('0x9'));var config=require(_0x3533('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3533('0xb')][_0x3533('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1d2d02,_0x4f6410,_0x2a513d){return new BPromise(function(_0x5399b5,_0x252dae){return client['request'](_0x1d2d02,_0x2a513d)[_0x3533('0xd')](function(_0x214b92){logger[_0x3533('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4f6410,_0x3533('0xf'));logger['debug']('VoiceMail,\x20%s,\x20%s,\x20%s',_0x4f6410,'request\x20sent',JSON[_0x3533('0x10')](_0x214b92));if(_0x214b92[_0x3533('0x11')]){if(_0x214b92[_0x3533('0x11')][_0x3533('0x12')]===0x1f4){logger[_0x3533('0x11')](_0x3533('0x13'),_0x4f6410,_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);return _0x252dae(_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);}logger['error'](_0x3533('0x13'),_0x4f6410,_0x214b92[_0x3533('0x11')][_0x3533('0x14')]);return _0x5399b5(_0x214b92[_0x3533('0x11')]['message']);}else{logger[_0x3533('0xe')]('VoiceMail,\x20%s,\x20%s',_0x4f6410,'request\x20sent');_0x5399b5(_0x214b92[_0x3533('0x15')][_0x3533('0x14')]);}})[_0x3533('0x16')](function(_0x1420e5){logger['error']('VoiceMail,\x20%s,\x20%s',_0x4f6410,_0x1420e5);_0x252dae(_0x1420e5);});});} \ No newline at end of file +var _0x9269=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','moment'];(function(_0x19714e,_0x1a20d9){var _0x336b02=function(_0x43358d){while(--_0x43358d){_0x19714e['push'](_0x19714e['shift']());}};_0x336b02(++_0x1a20d9);}(_0x9269,0x6d));var _0x9926=function(_0x8720df,_0x3f41ea){_0x8720df=_0x8720df-0x0;var _0x44b435=_0x9269[_0x8720df];return _0x44b435;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9926('0x0'));var BPromise=require(_0x9926('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9926('0x2'))['db'];var utils=require(_0x9926('0x3'));var logger=require(_0x9926('0x4'))(_0x9926('0x5'));var config=require(_0x9926('0x6'));var jayson=require(_0x9926('0x7'));var client=jayson[_0x9926('0x8')][_0x9926('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24303e,_0x49c7f5,_0x3e4477){return new BPromise(function(_0x2b00d7,_0x6c7f3c){return client['request'](_0x24303e,_0x3e4477)[_0x9926('0xa')](function(_0x3f761b){logger[_0x9926('0xb')]('VoiceMail,\x20%s,\x20%s',_0x49c7f5,'request\x20sent');logger[_0x9926('0xc')](_0x9926('0xd'),_0x49c7f5,_0x9926('0xe'),JSON[_0x9926('0xf')](_0x3f761b));if(_0x3f761b[_0x9926('0x10')]){if(_0x3f761b['error'][_0x9926('0x11')]===0x1f4){logger['error'](_0x9926('0x12'),_0x49c7f5,_0x3f761b[_0x9926('0x10')][_0x9926('0x13')]);return _0x6c7f3c(_0x3f761b[_0x9926('0x10')][_0x9926('0x13')]);}logger['error'](_0x9926('0x12'),_0x49c7f5,_0x3f761b[_0x9926('0x10')][_0x9926('0x13')]);return _0x2b00d7(_0x3f761b['error'][_0x9926('0x13')]);}else{logger[_0x9926('0xb')](_0x9926('0x12'),_0x49c7f5,'request\x20sent');_0x2b00d7(_0x3f761b[_0x9926('0x14')][_0x9926('0x13')]);}})[_0x9926('0x15')](function(_0x568632){logger['error']('VoiceMail,\x20%s,\x20%s',_0x49c7f5,_0x568632);_0x6c7f3c(_0x568632);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4c06423..f4b7f04 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 _0x7a38=['./voiceMailMessage.controller','get','index','/:id','isAuthenticated','show','/:id/download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x41378f,_0x5e2214){var _0x4fa590=function(_0x29dba8){while(--_0x29dba8){_0x41378f['push'](_0x41378f['shift']());}};_0x4fa590(++_0x5e2214);}(_0x7a38,0x173));var _0x87a3=function(_0x1ae0a7,_0x6ae49d){_0x1ae0a7=_0x1ae0a7-0x0;var _0x5ebf43=_0x7a38[_0x1ae0a7];return _0x5ebf43;};'use strict';var multer=require(_0x87a3('0x0'));var util=require(_0x87a3('0x1'));var path=require(_0x87a3('0x2'));var timeout=require(_0x87a3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87a3('0x4'));var auth=require(_0x87a3('0x5'));var interaction=require(_0x87a3('0x6'));var config=require('../../config/environment');var controller=require(_0x87a3('0x7'));router[_0x87a3('0x8')]('/',auth['isAuthenticated'](),controller[_0x87a3('0x9')]);router[_0x87a3('0x8')](_0x87a3('0xa'),auth[_0x87a3('0xb')](),controller[_0x87a3('0xc')]);router['get'](_0x87a3('0xd'),auth[_0x87a3('0xb')](),controller['download']);router[_0x87a3('0xe')]('/',auth[_0x87a3('0xb')](),controller[_0x87a3('0xf')]);router[_0x87a3('0x10')](_0x87a3('0xa'),auth[_0x87a3('0xb')](),controller[_0x87a3('0x11')]);router[_0x87a3('0x12')]('/:id',auth[_0x87a3('0xb')](),controller[_0x87a3('0x13')]);module[_0x87a3('0x14')]=router; \ No newline at end of file +var _0xd6dd=['../../config/environment','isAuthenticated','index','get','/:id','show','download','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x8d975b,_0xf6a223){var _0xb338b0=function(_0x39969b){while(--_0x39969b){_0x8d975b['push'](_0x8d975b['shift']());}};_0xb338b0(++_0xf6a223);}(_0xd6dd,0x1bd));var _0xdd6d=function(_0x3893da,_0x22bffb){_0x3893da=_0x3893da-0x0;var _0x1c3533=_0xd6dd[_0x3893da];return _0x1c3533;};'use strict';var multer=require('multer');var util=require(_0xdd6d('0x0'));var path=require(_0xdd6d('0x1'));var timeout=require(_0xdd6d('0x2'));var express=require('express');var router=express[_0xdd6d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdd6d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd6d('0x5'));var controller=require('./voiceMailMessage.controller');router['get']('/',auth[_0xdd6d('0x6')](),controller[_0xdd6d('0x7')]);router[_0xdd6d('0x8')](_0xdd6d('0x9'),auth[_0xdd6d('0x6')](),controller[_0xdd6d('0xa')]);router[_0xdd6d('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0xdd6d('0xb')]);router[_0xdd6d('0xc')]('/',auth[_0xdd6d('0x6')](),controller[_0xdd6d('0xd')]);router[_0xdd6d('0xe')](_0xdd6d('0x9'),auth[_0xdd6d('0x6')](),controller[_0xdd6d('0xf')]);router[_0xdd6d('0x10')](_0xdd6d('0x9'),auth[_0xdd6d('0x6')](),controller['destroy']);module[_0xdd6d('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 9224bce..608c33b 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 _0x510c=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x510c,0xee));var _0xc510=function(_0x175f2d,_0x535afb){_0x175f2d=_0x175f2d-0x0;var _0x3d894c=_0x510c[_0x175f2d];return _0x3d894c;};'use strict';var Sequelize=require(_0xc510('0x0'));module[_0xc510('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5b4482){return this[_0xc510('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xc510('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xc510('0x5')](_0xc510('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc510('0x4')],'defaultValue':''},'stamp':{'type':_0xc510('0x7'),'defaultValue':Sequelize[_0xc510('0x8')](_0xc510('0x9'))}}; \ No newline at end of file +var _0x5590=['sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x597e40,_0x51c34e){var _0x369fcb=function(_0x347d92){while(--_0x347d92){_0x597e40['push'](_0x597e40['shift']());}};_0x369fcb(++_0x51c34e);}(_0x5590,0x129));var _0x0559=function(_0x2a58ab,_0x4e4082){_0x2a58ab=_0x2a58ab-0x0;var _0x2fae47=_0x5590[_0x2a58ab];return _0x2fae47;};'use strict';var Sequelize=require(_0x0559('0x0'));module[_0x0559('0x1')]={'name':{'type':Sequelize[_0x0559('0x2')],'get':function(_0xfa25c4){return this[_0x0559('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x0559('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x0559('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0559('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0x0559('0x7')](_0x0559('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b9a6211..2d5886c 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 _0xebce=['VoiceMailMessage','count','includeAll','findAll','rows','show','params','keys','include','catch','create','body','find','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options'];(function(_0x18b9a8,_0x1770b6){var _0x4a0a8f=function(_0x80ea93){while(--_0x80ea93){_0x18b9a8['push'](_0x18b9a8['shift']());}};_0x4a0a8f(++_0x1770b6);}(_0xebce,0xb8));var _0xeebc=function(_0x3722d2,_0x206336){_0x3722d2=_0x3722d2-0x0;var _0x15ae66=_0xebce[_0x3722d2];return _0x15ae66;};'use strict';var emlformat=require(_0xeebc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeebc('0x1'));var jsonpatch=require(_0xeebc('0x2'));var rp=require(_0xeebc('0x3'));var moment=require('moment');var BPromise=require(_0xeebc('0x4'));var Mustache=require('mustache');var util=require(_0xeebc('0x5'));var path=require(_0xeebc('0x6'));var sox=require('sox');var csv=require(_0xeebc('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeebc('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xeebc('0x9'));var deskjs=require(_0xeebc('0xa'));var toCsv=require('to-csv');var querystring=require(_0xeebc('0xb'));var Papa=require('papaparse');var Redis=require(_0xeebc('0xc'));var authService=require(_0xeebc('0xd'));var qs=require(_0xeebc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeebc('0xf'));var logger=require(_0xeebc('0x10'))(_0xeebc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeebc('0x12'))['db'];function respondWithStatusCode(_0x471f1a,_0xa2dc21){_0xa2dc21=_0xa2dc21||0xcc;return function(_0x3aee81){if(_0x3aee81){return _0x471f1a[_0xeebc('0x13')](_0xa2dc21);}return _0x471f1a[_0xeebc('0x14')](_0xa2dc21)[_0xeebc('0x15')]();};}function respondWithResult(_0x3987f5,_0x26c323){_0x26c323=_0x26c323||0xc8;return function(_0x2bcb44){if(_0x2bcb44){return _0x3987f5[_0xeebc('0x14')](_0x26c323)[_0xeebc('0x16')](_0x2bcb44);}};}function respondWithFilteredResult(_0x1e8b76,_0x1bc151){return function(_0x572f8b){if(_0x572f8b){var _0x358635=typeof _0x1bc151[_0xeebc('0x17')]===_0xeebc('0x18')&&typeof _0x1bc151[_0xeebc('0x19')]===_0xeebc('0x18');var _0x226c56=_0x572f8b['count'];var _0x13672d=_0x358635?0x0:_0x1bc151[_0xeebc('0x17')];var _0x323bfa=_0x358635?_0x572f8b['count']:_0x1bc151[_0xeebc('0x17')]+_0x1bc151[_0xeebc('0x19')];var _0x4b6135;if(_0x323bfa>=_0x226c56){_0x323bfa=_0x226c56;_0x4b6135=0xc8;}else{_0x4b6135=0xce;}_0x1e8b76[_0xeebc('0x14')](_0x4b6135);return _0x1e8b76[_0xeebc('0x1a')]('Content-Range',_0x13672d+'-'+_0x323bfa+'/'+_0x226c56)[_0xeebc('0x16')](_0x572f8b);}return null;};}function patchUpdates(_0x2a973f){return function(_0x3fa15f){try{jsonpatch[_0xeebc('0x1b')](_0x3fa15f,_0x2a973f,!![]);}catch(_0xfe871){return BPromise[_0xeebc('0x1c')](_0xfe871);}return _0x3fa15f[_0xeebc('0x1d')]();};}function saveUpdates(_0x4c4a57,_0x16989f){return function(_0x2b3bde){if(_0x2b3bde){return _0x2b3bde[_0xeebc('0x1e')](_0x4c4a57)[_0xeebc('0x1f')](function(_0x33034e){return _0x33034e;});}return null;};}function removeEntity(_0x47d9c5,_0x34e83d){return function(_0x4dbc20){if(_0x4dbc20){return _0x4dbc20[_0xeebc('0x20')]()[_0xeebc('0x1f')](function(){_0x47d9c5[_0xeebc('0x14')](0xcc)[_0xeebc('0x15')]();});}};}function handleEntityNotFound(_0x3bd946,_0x5c5da2){return function(_0x1d6c8a){if(!_0x1d6c8a){_0x3bd946['sendStatus'](0x194);}return _0x1d6c8a;};}function handleError(_0x283449,_0x329355){_0x329355=_0x329355||0x1f4;return function(_0x56d1da){logger['error'](_0x56d1da[_0xeebc('0x21')]);if(_0x56d1da['name']){delete _0x56d1da[_0xeebc('0x22')];}_0x283449[_0xeebc('0x14')](_0x329355)[_0xeebc('0x23')](_0x56d1da);};}exports[_0xeebc('0x24')]=function(_0x31ffc4,_0x126a1b){var _0x5dc271={},_0x1a9dc9={},_0x234ef9={'count':0x0,'rows':[]};var _0x47c58d=_[_0xeebc('0x25')](db['VoiceMailMessage'][_0xeebc('0x26')],function(_0x58fdb4){return{'name':_0x58fdb4[_0xeebc('0x27')],'type':_0x58fdb4[_0xeebc('0x28')][_0xeebc('0x29')]};});_0x1a9dc9[_0xeebc('0x2a')]=_['differenceBy'](_[_0xeebc('0x25')](_0x47c58d,_0xeebc('0x22')),[_0xeebc('0x22')]);_0x1a9dc9[_0xeebc('0x2b')]=_['keys'](_0x31ffc4[_0xeebc('0x2b')]);_0x1a9dc9['filters']=_[_0xeebc('0x2c')](_0x1a9dc9[_0xeebc('0x2a')],_0x1a9dc9[_0xeebc('0x2b')]);_0x5dc271['attributes']=_[_0xeebc('0x2c')](_0x1a9dc9[_0xeebc('0x2a')],qs[_0xeebc('0x2d')](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x2d')]));_0x5dc271[_0xeebc('0x2e')]=_0x5dc271[_0xeebc('0x2e')][_0xeebc('0x2f')]?_0x5dc271[_0xeebc('0x2e')]:_0x1a9dc9[_0xeebc('0x2a')];if(!_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x30')](_0xeebc('0x31'))){_0x5dc271['limit']=qs[_0xeebc('0x19')](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x19')]);_0x5dc271['offset']=qs[_0xeebc('0x17')](_0x31ffc4[_0xeebc('0x2b')]['offset']);}_0x5dc271[_0xeebc('0x32')]=qs['sort'](_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x33')]);_0x5dc271[_0xeebc('0x34')]=qs['filters'](_[_0xeebc('0x35')](_0x31ffc4[_0xeebc('0x2b')],_0x1a9dc9[_0xeebc('0x36')]),_0x47c58d);if(_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x37')]){_0x5dc271['where']=_[_0xeebc('0x38')](_0x5dc271[_0xeebc('0x34')],{'$or':_[_0xeebc('0x25')](_0x47c58d,function(_0xbb4d5e){if(_0xbb4d5e[_0xeebc('0x28')]!==_0xeebc('0x39')){var _0x1511af={};_0x1511af[_0xbb4d5e[_0xeebc('0x22')]]={'$like':'%'+_0x31ffc4[_0xeebc('0x2b')][_0xeebc('0x37')]+'%'};return _0x1511af;}})});}_0x5dc271=_[_0xeebc('0x38')]({},_0x5dc271,_0x31ffc4[_0xeebc('0x3a')]);var _0x1ab704={'where':_0x5dc271[_0xeebc('0x34')]};return db[_0xeebc('0x3b')][_0xeebc('0x3c')](_0x1ab704)[_0xeebc('0x1f')](function(_0x309cb2){_0x234ef9[_0xeebc('0x3c')]=_0x309cb2;if(_0x31ffc4['query'][_0xeebc('0x3d')]){_0x5dc271['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0xeebc('0x3e')](_0x5dc271);})[_0xeebc('0x1f')](function(_0x4bf53b){_0x234ef9[_0xeebc('0x3f')]=_0x4bf53b;return _0x234ef9;})[_0xeebc('0x1f')](respondWithFilteredResult(_0x126a1b,_0x5dc271))['catch'](handleError(_0x126a1b,null));};exports[_0xeebc('0x40')]=function(_0x3a8145,_0x3d3e91){var _0x5dc13a={'raw':!![],'where':{'id':_0x3a8145[_0xeebc('0x41')]['id']}},_0x356ad8={};_0x356ad8[_0xeebc('0x2a')]=_[_0xeebc('0x42')](db[_0xeebc('0x3b')]['rawAttributes']);_0x356ad8[_0xeebc('0x2b')]=_[_0xeebc('0x42')](_0x3a8145[_0xeebc('0x2b')]);_0x356ad8[_0xeebc('0x36')]=_['intersection'](_0x356ad8[_0xeebc('0x2a')],_0x356ad8[_0xeebc('0x2b')]);_0x5dc13a[_0xeebc('0x2e')]=_[_0xeebc('0x2c')](_0x356ad8[_0xeebc('0x2a')],qs[_0xeebc('0x2d')](_0x3a8145[_0xeebc('0x2b')]['fields']));_0x5dc13a[_0xeebc('0x2e')]=_0x5dc13a['attributes']['length']?_0x5dc13a[_0xeebc('0x2e')]:_0x356ad8[_0xeebc('0x2a')];if(_0x3a8145[_0xeebc('0x2b')]['includeAll']){_0x5dc13a[_0xeebc('0x43')]=[{'all':!![]}];}_0x5dc13a=_[_0xeebc('0x38')]({},_0x5dc13a,_0x3a8145[_0xeebc('0x3a')]);return db[_0xeebc('0x3b')]['find'](_0x5dc13a)[_0xeebc('0x1f')](handleEntityNotFound(_0x3d3e91,null))[_0xeebc('0x1f')](respondWithResult(_0x3d3e91,null))[_0xeebc('0x44')](handleError(_0x3d3e91,null));};exports[_0xeebc('0x45')]=function(_0x47a597,_0x4103a8){return db[_0xeebc('0x3b')][_0xeebc('0x45')](_0x47a597[_0xeebc('0x46')],{})['then'](respondWithResult(_0x4103a8,0xc9))[_0xeebc('0x44')](handleError(_0x4103a8,null));};exports['update']=function(_0x487b3e,_0x43dcde){if(_0x487b3e[_0xeebc('0x46')]['id']){delete _0x487b3e['body']['id'];}return db[_0xeebc('0x3b')][_0xeebc('0x47')]({'where':{'id':_0x487b3e[_0xeebc('0x41')]['id']}})[_0xeebc('0x1f')](handleEntityNotFound(_0x43dcde,null))[_0xeebc('0x1f')](saveUpdates(_0x487b3e[_0xeebc('0x46')],null))[_0xeebc('0x1f')](respondWithResult(_0x43dcde,null))[_0xeebc('0x44')](handleError(_0x43dcde,null));};exports[_0xeebc('0x20')]=function(_0x38de65,_0x4dedde){return db[_0xeebc('0x3b')][_0xeebc('0x47')]({'where':{'id':_0x38de65[_0xeebc('0x41')]['id']}})[_0xeebc('0x1f')](handleEntityNotFound(_0x4dedde,null))[_0xeebc('0x1f')](removeEntity(_0x4dedde,null))['catch'](handleError(_0x4dedde,null));};exports[_0xeebc('0x48')]=function(_0x485ef0,_0x163f5a,_0x80fc9a){return db['VoiceMailMessage'][_0xeebc('0x47')]({'where':{'id':_0x485ef0[_0xeebc('0x41')]['id']},'attributes':['id',_0xeebc('0x49'),_0xeebc('0x4a')]})[_0xeebc('0x1f')](handleEntityNotFound(_0x163f5a,null))['then'](function(_0x1a519c){if(_0x1a519c){if(!_0x1a519c[_0xeebc('0x49')]){throw new db[(_0xeebc('0x4b'))][(_0xeebc('0x4c'))]('VoiceMailMessage\x20not\x20found');}var _0x21cbb9={'Content-Type':_0xeebc('0x4d'),'Content-Disposition':_0xeebc('0x4e')};if(_0x1a519c['msg_id']){_0x21cbb9[_0xeebc('0x4f')]='attachment;\x20filename=\x22'+_0x1a519c[_0xeebc('0x4a')]+_0xeebc('0x50');}_0x163f5a[_0xeebc('0x1a')](_0x21cbb9);return _0x163f5a['send'](new Buffer(_0x1a519c[_0xeebc('0x49')]));}})[_0xeebc('0x44')](handleError(_0x163f5a,null));}; \ No newline at end of file +var _0x93dc=['set','json','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','differenceBy','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','attachment','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','ejs','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count'];(function(_0x5f2d8f,_0x20d697){var _0x1d44fa=function(_0x278cfe){while(--_0x278cfe){_0x5f2d8f['push'](_0x5f2d8f['shift']());}};_0x1d44fa(++_0x20d697);}(_0x93dc,0x178));var _0xc93d=function(_0x59d292,_0x4a7736){_0x59d292=_0x59d292-0x0;var _0x5aa282=_0x93dc[_0x59d292];return _0x5aa282;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc93d('0x0'));var zipdir=require(_0xc93d('0x1'));var jsonpatch=require(_0xc93d('0x2'));var rp=require('request-promise');var moment=require(_0xc93d('0x3'));var BPromise=require(_0xc93d('0x4'));var Mustache=require('mustache');var util=require(_0xc93d('0x5'));var path=require('path');var sox=require(_0xc93d('0x6'));var csv=require('to-csv');var ejs=require(_0xc93d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc93d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc93d('0x9'));var toCsv=require(_0xc93d('0xa'));var querystring=require('querystring');var Papa=require(_0xc93d('0xb'));var Redis=require(_0xc93d('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc93d('0xd'));var hardwareService=require(_0xc93d('0xe'));var logger=require('../../config/logger')(_0xc93d('0xf'));var utils=require(_0xc93d('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xc93d('0x11'));var db=require(_0xc93d('0x12'))['db'];function respondWithStatusCode(_0x3d2c17,_0x2f6620){_0x2f6620=_0x2f6620||0xcc;return function(_0x40aa99){if(_0x40aa99){return _0x3d2c17[_0xc93d('0x13')](_0x2f6620);}return _0x3d2c17[_0xc93d('0x14')](_0x2f6620)['end']();};}function respondWithResult(_0x2c464f,_0x3ca6d5){_0x3ca6d5=_0x3ca6d5||0xc8;return function(_0x170197){if(_0x170197){return _0x2c464f[_0xc93d('0x14')](_0x3ca6d5)['json'](_0x170197);}};}function respondWithFilteredResult(_0x2b6181,_0xfdbf7c){return function(_0x1a3d78){if(_0x1a3d78){var _0x57ae51=typeof _0xfdbf7c[_0xc93d('0x15')]===_0xc93d('0x16')&&typeof _0xfdbf7c['limit']==='undefined';var _0x45d277=_0x1a3d78[_0xc93d('0x17')];var _0x1f35c=_0x57ae51?0x0:_0xfdbf7c['offset'];var _0x237702=_0x57ae51?_0x1a3d78[_0xc93d('0x17')]:_0xfdbf7c['offset']+_0xfdbf7c['limit'];var _0x32462a;if(_0x237702>=_0x45d277){_0x237702=_0x45d277;_0x32462a=0xc8;}else{_0x32462a=0xce;}_0x2b6181[_0xc93d('0x14')](_0x32462a);return _0x2b6181[_0xc93d('0x18')]('Content-Range',_0x1f35c+'-'+_0x237702+'/'+_0x45d277)[_0xc93d('0x19')](_0x1a3d78);}return null;};}function patchUpdates(_0x13695f){return function(_0x27c23c){try{jsonpatch[_0xc93d('0x1a')](_0x27c23c,_0x13695f,!![]);}catch(_0x28f985){return BPromise[_0xc93d('0x1b')](_0x28f985);}return _0x27c23c[_0xc93d('0x1c')]();};}function saveUpdates(_0x1a2e17,_0x85fc58){return function(_0x4609ba){if(_0x4609ba){return _0x4609ba[_0xc93d('0x1d')](_0x1a2e17)[_0xc93d('0x1e')](function(_0x3beac8){return _0x3beac8;});}return null;};}function removeEntity(_0x303788,_0x4494fd){return function(_0x4c4bae){if(_0x4c4bae){return _0x4c4bae[_0xc93d('0x1f')]()[_0xc93d('0x1e')](function(){_0x303788[_0xc93d('0x14')](0xcc)[_0xc93d('0x20')]();});}};}function handleEntityNotFound(_0x589a83,_0x271803){return function(_0x899c43){if(!_0x899c43){_0x589a83['sendStatus'](0x194);}return _0x899c43;};}function handleError(_0x303cb0,_0x5efb1a){_0x5efb1a=_0x5efb1a||0x1f4;return function(_0x4ce178){logger[_0xc93d('0x21')](_0x4ce178['stack']);if(_0x4ce178['name']){delete _0x4ce178[_0xc93d('0x22')];}_0x303cb0[_0xc93d('0x14')](_0x5efb1a)[_0xc93d('0x23')](_0x4ce178);};}exports[_0xc93d('0x24')]=function(_0x55d1d1,_0xa76a30){var _0x10de42={},_0x171093={},_0x56ab87={'count':0x0,'rows':[]};var _0x23836c=_[_0xc93d('0x25')](db[_0xc93d('0x26')][_0xc93d('0x27')],function(_0x2d15be){return{'name':_0x2d15be[_0xc93d('0x28')],'type':_0x2d15be['type']['key']};});_0x171093[_0xc93d('0x29')]=_[_0xc93d('0x2a')](_[_0xc93d('0x25')](_0x23836c,_0xc93d('0x22')),[_0xc93d('0x22')]);_0x171093[_0xc93d('0x2b')]=_[_0xc93d('0x2c')](_0x55d1d1[_0xc93d('0x2b')]);_0x171093['filters']=_['intersection'](_0x171093[_0xc93d('0x29')],_0x171093[_0xc93d('0x2b')]);_0x10de42[_0xc93d('0x2d')]=_[_0xc93d('0x2e')](_0x171093[_0xc93d('0x29')],qs['fields'](_0x55d1d1[_0xc93d('0x2b')][_0xc93d('0x2f')]));_0x10de42['attributes']=_0x10de42[_0xc93d('0x2d')][_0xc93d('0x30')]?_0x10de42[_0xc93d('0x2d')]:_0x171093[_0xc93d('0x29')];if(!_0x55d1d1['query'][_0xc93d('0x31')](_0xc93d('0x32'))){_0x10de42['limit']=qs['limit'](_0x55d1d1[_0xc93d('0x2b')][_0xc93d('0x33')]);_0x10de42['offset']=qs[_0xc93d('0x15')](_0x55d1d1[_0xc93d('0x2b')][_0xc93d('0x15')]);}_0x10de42[_0xc93d('0x34')]=qs[_0xc93d('0x35')](_0x55d1d1[_0xc93d('0x2b')]['sort']);_0x10de42['where']=qs[_0xc93d('0x36')](_[_0xc93d('0x37')](_0x55d1d1[_0xc93d('0x2b')],_0x171093[_0xc93d('0x36')]),_0x23836c);if(_0x55d1d1[_0xc93d('0x2b')][_0xc93d('0x38')]){_0x10de42[_0xc93d('0x39')]=_[_0xc93d('0x3a')](_0x10de42[_0xc93d('0x39')],{'$or':_[_0xc93d('0x25')](_0x23836c,function(_0x1b25a2){if(_0x1b25a2[_0xc93d('0x3b')]!==_0xc93d('0x3c')){var _0x5eb9ab={};_0x5eb9ab[_0x1b25a2['name']]={'$like':'%'+_0x55d1d1[_0xc93d('0x2b')][_0xc93d('0x38')]+'%'};return _0x5eb9ab;}})});}_0x10de42=_[_0xc93d('0x3a')]({},_0x10de42,_0x55d1d1[_0xc93d('0x3d')]);var _0x4fbac8={'where':_0x10de42[_0xc93d('0x39')]};return db['VoiceMailMessage'][_0xc93d('0x17')](_0x4fbac8)[_0xc93d('0x1e')](function(_0x5d9658){_0x56ab87[_0xc93d('0x17')]=_0x5d9658;if(_0x55d1d1[_0xc93d('0x2b')]['includeAll']){_0x10de42[_0xc93d('0x3e')]=[{'all':!![]}];}return db[_0xc93d('0x26')][_0xc93d('0x3f')](_0x10de42);})[_0xc93d('0x1e')](function(_0x3e4cb1){_0x56ab87[_0xc93d('0x40')]=_0x3e4cb1;return _0x56ab87;})[_0xc93d('0x1e')](respondWithFilteredResult(_0xa76a30,_0x10de42))[_0xc93d('0x41')](handleError(_0xa76a30,null));};exports[_0xc93d('0x42')]=function(_0x1bbe12,_0x195149){var _0xa81dd9={'raw':!![],'where':{'id':_0x1bbe12[_0xc93d('0x43')]['id']}},_0x4ad780={};_0x4ad780[_0xc93d('0x29')]=_[_0xc93d('0x2c')](db[_0xc93d('0x26')]['rawAttributes']);_0x4ad780[_0xc93d('0x2b')]=_[_0xc93d('0x2c')](_0x1bbe12[_0xc93d('0x2b')]);_0x4ad780[_0xc93d('0x36')]=_['intersection'](_0x4ad780['model'],_0x4ad780[_0xc93d('0x2b')]);_0xa81dd9['attributes']=_[_0xc93d('0x2e')](_0x4ad780[_0xc93d('0x29')],qs[_0xc93d('0x2f')](_0x1bbe12[_0xc93d('0x2b')][_0xc93d('0x2f')]));_0xa81dd9[_0xc93d('0x2d')]=_0xa81dd9[_0xc93d('0x2d')]['length']?_0xa81dd9['attributes']:_0x4ad780[_0xc93d('0x29')];if(_0x1bbe12[_0xc93d('0x2b')][_0xc93d('0x44')]){_0xa81dd9[_0xc93d('0x3e')]=[{'all':!![]}];}_0xa81dd9=_[_0xc93d('0x3a')]({},_0xa81dd9,_0x1bbe12[_0xc93d('0x3d')]);return db[_0xc93d('0x26')][_0xc93d('0x45')](_0xa81dd9)[_0xc93d('0x1e')](handleEntityNotFound(_0x195149,null))[_0xc93d('0x1e')](respondWithResult(_0x195149,null))['catch'](handleError(_0x195149,null));};exports[_0xc93d('0x46')]=function(_0x19627a,_0x4af480){return db['VoiceMailMessage'][_0xc93d('0x46')](_0x19627a[_0xc93d('0x47')],{})[_0xc93d('0x1e')](respondWithResult(_0x4af480,0xc9))[_0xc93d('0x41')](handleError(_0x4af480,null));};exports[_0xc93d('0x1d')]=function(_0x45a492,_0x37401b){if(_0x45a492[_0xc93d('0x47')]['id']){delete _0x45a492[_0xc93d('0x47')]['id'];}return db['VoiceMailMessage'][_0xc93d('0x45')]({'where':{'id':_0x45a492[_0xc93d('0x43')]['id']}})[_0xc93d('0x1e')](handleEntityNotFound(_0x37401b,null))['then'](saveUpdates(_0x45a492[_0xc93d('0x47')],null))[_0xc93d('0x1e')](respondWithResult(_0x37401b,null))[_0xc93d('0x41')](handleError(_0x37401b,null));};exports['destroy']=function(_0x75b00e,_0x20c107){return db[_0xc93d('0x26')][_0xc93d('0x45')]({'where':{'id':_0x75b00e['params']['id']}})[_0xc93d('0x1e')](handleEntityNotFound(_0x20c107,null))[_0xc93d('0x1e')](removeEntity(_0x20c107,null))[_0xc93d('0x41')](handleError(_0x20c107,null));};exports[_0xc93d('0x48')]=function(_0x308139,_0x479eb6,_0x476624){return db[_0xc93d('0x26')][_0xc93d('0x45')]({'where':{'id':_0x308139[_0xc93d('0x43')]['id']},'attributes':['id',_0xc93d('0x49'),_0xc93d('0x4a')]})[_0xc93d('0x1e')](handleEntityNotFound(_0x479eb6,null))[_0xc93d('0x1e')](function(_0x1f13a0){if(_0x1f13a0){if(!_0x1f13a0[_0xc93d('0x49')]){throw new db[(_0xc93d('0x4b'))]['ValidationError'](_0xc93d('0x4c'));}var _0x32f66a={'Content-Type':'audio/wav','Content-Disposition':_0xc93d('0x4d')};if(_0x1f13a0[_0xc93d('0x4a')]){_0x32f66a['Content-Disposition']=_0xc93d('0x4e')+_0x1f13a0[_0xc93d('0x4a')]+_0xc93d('0x4f');}_0x479eb6[_0xc93d('0x18')](_0x32f66a);return _0x479eb6['send'](new Buffer(_0x1f13a0[_0xc93d('0x49')]));}})['catch'](handleError(_0x479eb6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index ee84497..b43beb7 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 _0xab0d=['../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x226b19,_0x4bdfb8){var _0x6bfc30=function(_0x40b6a4){while(--_0x40b6a4){_0x226b19['push'](_0x226b19['shift']());}};_0x6bfc30(++_0x4bdfb8);}(_0xab0d,0x102));var _0xdab0=function(_0x15f104,_0x5293de){_0x15f104=_0x15f104-0x0;var _0x2aea1f=_0xab0d[_0x15f104];return _0x2aea1f;};'use strict';var _=require('lodash');var util=require(_0xdab0('0x0'));var logger=require(_0xdab0('0x1'))(_0xdab0('0x2'));var moment=require(_0xdab0('0x3'));var BPromise=require(_0xdab0('0x4'));var rp=require(_0xdab0('0x5'));var fs=require('fs');var path=require(_0xdab0('0x6'));var rimraf=require(_0xdab0('0x7'));var config=require(_0xdab0('0x8'));var attributes=require(_0xdab0('0x9'));module[_0xdab0('0xa')]=function(_0x38fea6,_0x213d0f){return _0x38fea6[_0xdab0('0xb')](_0xdab0('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xdab0('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1181=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage','dir','lodash','../../config/logger'];(function(_0x3b6648,_0x2d723a){var _0x5a0a0d=function(_0x133dea){while(--_0x133dea){_0x3b6648['push'](_0x3b6648['shift']());}};_0x5a0a0d(++_0x2d723a);}(_0x1181,0x12a));var _0x1118=function(_0xb725be,_0x45bd01){_0xb725be=_0xb725be-0x0;var _0x2f2424=_0x1181[_0xb725be];return _0x2f2424;};'use strict';var _=require(_0x1118('0x0'));var util=require('util');var logger=require(_0x1118('0x1'))('api');var moment=require(_0x1118('0x2'));var BPromise=require(_0x1118('0x3'));var rp=require(_0x1118('0x4'));var fs=require('fs');var path=require(_0x1118('0x5'));var rimraf=require(_0x1118('0x6'));var config=require(_0x1118('0x7'));var attributes=require(_0x1118('0x8'));module['exports']=function(_0x1e40bf,_0xafed33){return _0x1e40bf[_0x1118('0x9')](_0x1118('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x1118('0xb'),'fields':[_0x1118('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 7827e0e..6a63a44 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 _0x9bc5=['info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0xe75f9a,_0x429af9){var _0x534d1f=function(_0x3eefc0){while(--_0x3eefc0){_0xe75f9a['push'](_0xe75f9a['shift']());}};_0x534d1f(++_0x429af9);}(_0x9bc5,0x17b));var _0x59bc=function(_0x42c06b,_0x597a58){_0x42c06b=_0x42c06b-0x0;var _0x162a27=_0x9bc5[_0x42c06b];return _0x162a27;};'use strict';var _=require(_0x59bc('0x0'));var util=require(_0x59bc('0x1'));var moment=require(_0x59bc('0x2'));var BPromise=require(_0x59bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59bc('0x4'))['db'];var utils=require(_0x59bc('0x5'));var logger=require(_0x59bc('0x6'))('rpc');var config=require(_0x59bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x59bc('0x8')][_0x59bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x467514,_0x148abf,_0x338789){return new BPromise(function(_0x3fc282,_0x4e2092){return client[_0x59bc('0xa')](_0x467514,_0x338789)[_0x59bc('0xb')](function(_0x3cf74c){logger[_0x59bc('0xc')](_0x59bc('0xd'),_0x148abf,'request\x20sent');logger[_0x59bc('0xe')](_0x59bc('0xf'),_0x148abf,'request\x20sent',JSON[_0x59bc('0x10')](_0x3cf74c));if(_0x3cf74c[_0x59bc('0x11')]){if(_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x12')]===0x1f4){logger[_0x59bc('0x11')](_0x59bc('0xd'),_0x148abf,_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x13')]);return _0x4e2092(_0x3cf74c['error'][_0x59bc('0x13')]);}logger[_0x59bc('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x148abf,_0x3cf74c[_0x59bc('0x11')][_0x59bc('0x13')]);return _0x3fc282(_0x3cf74c[_0x59bc('0x11')]['message']);}else{logger[_0x59bc('0xc')](_0x59bc('0xd'),_0x148abf,_0x59bc('0x14'));_0x3fc282(_0x3cf74c[_0x59bc('0x15')][_0x59bc('0x13')]);}})[_0x59bc('0x16')](function(_0x12a1f4){logger[_0x59bc('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x148abf,_0x12a1f4);_0x4e2092(_0x12a1f4);});});} \ No newline at end of file +var _0xad09=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util'];(function(_0x390f39,_0x5cbda5){var _0x4c52c4=function(_0x3a160b){while(--_0x3a160b){_0x390f39['push'](_0x390f39['shift']());}};_0x4c52c4(++_0x5cbda5);}(_0xad09,0xe4));var _0x9ad0=function(_0x216af3,_0x1b2340){_0x216af3=_0x216af3-0x0;var _0x421227=_0xad09[_0x216af3];return _0x421227;};'use strict';var _=require(_0x9ad0('0x0'));var util=require(_0x9ad0('0x1'));var moment=require(_0x9ad0('0x2'));var BPromise=require(_0x9ad0('0x3'));var rs=require(_0x9ad0('0x4'));var fs=require('fs');var Redis=require(_0x9ad0('0x5'));var db=require(_0x9ad0('0x6'))['db'];var utils=require(_0x9ad0('0x7'));var logger=require('../../config/logger')(_0x9ad0('0x8'));var config=require(_0x9ad0('0x9'));var jayson=require(_0x9ad0('0xa'));var client=jayson[_0x9ad0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x307ba0,_0x59209c,_0x30dcc3){return new BPromise(function(_0x3210a7,_0x153293){return client[_0x9ad0('0xc')](_0x307ba0,_0x30dcc3)[_0x9ad0('0xd')](function(_0x39819e){logger[_0x9ad0('0xe')](_0x9ad0('0xf'),_0x59209c,_0x9ad0('0x10'));logger[_0x9ad0('0x11')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x59209c,'request\x20sent',JSON[_0x9ad0('0x12')](_0x39819e));if(_0x39819e[_0x9ad0('0x13')]){if(_0x39819e[_0x9ad0('0x13')]['code']===0x1f4){logger[_0x9ad0('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x59209c,_0x39819e[_0x9ad0('0x13')][_0x9ad0('0x14')]);return _0x153293(_0x39819e[_0x9ad0('0x13')][_0x9ad0('0x14')]);}logger[_0x9ad0('0x13')](_0x9ad0('0xf'),_0x59209c,_0x39819e[_0x9ad0('0x13')]['message']);return _0x3210a7(_0x39819e[_0x9ad0('0x13')][_0x9ad0('0x14')]);}else{logger[_0x9ad0('0xe')](_0x9ad0('0xf'),_0x59209c,'request\x20sent');_0x3210a7(_0x39819e[_0x9ad0('0x15')][_0x9ad0('0x14')]);}})[_0x9ad0('0x16')](function(_0x52aa77){logger['error'](_0x9ad0('0xf'),_0x59209c,_0x52aa77);_0x153293(_0x52aa77);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index c951cc2..d515e88 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 _0x6986=['destroy','/:id/sounds/:id2','removeSound','exports','multer','connect-timeout','express','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','/:id'];(function(_0x12e032,_0x51fbb1){var _0x4abbd5=function(_0x3af43f){while(--_0x3af43f){_0x12e032['push'](_0x12e032['shift']());}};_0x4abbd5(++_0x51fbb1);}(_0x6986,0x1a2));var _0x6698=function(_0x19e928,_0x26a0e4){_0x19e928=_0x19e928-0x0;var _0x4e941f=_0x6986[_0x19e928];return _0x4e941f;};'use strict';var multer=require(_0x6698('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6698('0x1'));var express=require(_0x6698('0x2'));var router=express['Router']();var fs_extra=require(_0x6698('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6698('0x4'));var config=require('../../config/environment');var controller=require(_0x6698('0x5'));router[_0x6698('0x6')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0x8')]);router['get']('/:id',auth[_0x6698('0x7')](),controller[_0x6698('0x9')]);router[_0x6698('0x6')](_0x6698('0xa'),auth['isAuthenticated'](),controller[_0x6698('0xb')]);router[_0x6698('0xc')]('/',auth[_0x6698('0x7')](),controller[_0x6698('0xd')]);router[_0x6698('0xc')](_0x6698('0xa'),auth[_0x6698('0x7')](),controller[_0x6698('0xe')]);router[_0x6698('0xf')]('/:id',auth[_0x6698('0x7')](),controller[_0x6698('0x10')]);router[_0x6698('0x11')](_0x6698('0x12'),auth['isAuthenticated'](),controller[_0x6698('0x13')]);router[_0x6698('0x11')](_0x6698('0x14'),auth[_0x6698('0x7')](),controller[_0x6698('0x15')]);module[_0x6698('0x16')]=router; \ No newline at end of file +var _0x4088=['destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','create','addSound','put','/:id'];(function(_0xebec55,_0x3f4f14){var _0x355d91=function(_0x465b47){while(--_0x465b47){_0xebec55['push'](_0xebec55['shift']());}};_0x355d91(++_0x3f4f14);}(_0x4088,0x1e8));var _0x8408=function(_0x17afca,_0x5d6455){_0x17afca=_0x17afca-0x0;var _0x4691c9=_0x4088[_0x17afca];return _0x4691c9;};'use strict';var multer=require(_0x8408('0x0'));var util=require(_0x8408('0x1'));var path=require('path');var timeout=require(_0x8408('0x2'));var express=require(_0x8408('0x3'));var router=express[_0x8408('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8408('0x5'));var config=require('../../config/environment');var controller=require(_0x8408('0x6'));router[_0x8408('0x7')]('/',auth[_0x8408('0x8')](),controller[_0x8408('0x9')]);router[_0x8408('0x7')]('/:id',auth[_0x8408('0x8')](),controller[_0x8408('0xa')]);router[_0x8408('0x7')](_0x8408('0xb'),auth[_0x8408('0x8')](),controller[_0x8408('0xc')]);router[_0x8408('0xd')]('/',auth['isAuthenticated'](),controller[_0x8408('0xe')]);router[_0x8408('0xd')](_0x8408('0xb'),auth[_0x8408('0x8')](),controller[_0x8408('0xf')]);router[_0x8408('0x10')](_0x8408('0x11'),auth[_0x8408('0x8')](),controller['update']);router['delete']('/:id',auth[_0x8408('0x8')](),controller[_0x8408('0x12')]);router[_0x8408('0x13')](_0x8408('0x14'),auth[_0x8408('0x8')](),controller[_0x8408('0x15')]);module[_0x8408('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 706a15b..60fdbcb 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 _0xa2bc=['name','custom','files','quietmp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa2bc,0xe2));var _0xca2b=function(_0x4cef94,_0x3db7e2){_0x4cef94=_0x4cef94-0x0;var _0x5ecb8a=_0xa2bc[_0x4cef94];return _0x5ecb8a;};'use strict';var Sequelize=require(_0xca2b('0x0'));module[_0xca2b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xca2b('0x2')},'mode':{'type':Sequelize['ENUM'](_0xca2b('0x3'),_0xca2b('0x4'),'mp3nb',_0xca2b('0x5'),_0xca2b('0x6'),_0xca2b('0x7')),'allowNull':!![],'defaultValue':_0xca2b('0x4')},'directory':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xca2b('0x9')},'format':{'type':Sequelize[_0xca2b('0x8')],'allowNull':!![]},'stamp':{'type':_0xca2b('0xa')},'defaultEntry':{'type':Sequelize[_0xca2b('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb932=['STRING','name','ENUM','custom','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports'];(function(_0x34271c,_0x28a8b){var _0x83585f=function(_0x7d2264){while(--_0x7d2264){_0x34271c['push'](_0x34271c['shift']());}};_0x83585f(++_0x28a8b);}(_0xb932,0x111));var _0x2b93=function(_0x34a32e,_0x26f089){_0x34a32e=_0x34a32e-0x0;var _0x24ca9b=_0xb932[_0x34a32e];return _0x24ca9b;};'use strict';var Sequelize=require(_0x2b93('0x0'));module[_0x2b93('0x1')]={'name':{'type':Sequelize[_0x2b93('0x2')],'allowNull':![],'unique':_0x2b93('0x3')},'mode':{'type':Sequelize[_0x2b93('0x4')](_0x2b93('0x5'),'files','mp3nb',_0x2b93('0x6'),_0x2b93('0x7'),_0x2b93('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x2b93('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2b93('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x2b93('0x2')],'allowNull':!![],'defaultValue':_0x2b93('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x2b93('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 c75ea48..f923024 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 _0xb436=['intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','catch','show','body','find','params','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','create','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','sequelize','transaction','save_name','createdAt','server/files/sounds/converted','%s.%s','basename','format','converted_format','symlinkSync','removeSound','findOne','id2','Sound','getSounds','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','status','set','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters'];(function(_0xb8daa7,_0x46a4ac){var _0x1effa3=function(_0xb907ee){while(--_0xb907ee){_0xb8daa7['push'](_0xb8daa7['shift']());}};_0x1effa3(++_0x46a4ac);}(_0xb436,0x124));var _0x6b43=function(_0x46e523,_0xe6fccb){_0x46e523=_0x46e523-0x0;var _0x5da0ee=_0xb436[_0x46e523];return _0x5da0ee;};'use strict';var emlformat=require(_0x6b43('0x0'));var rimraf=require(_0x6b43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b43('0x2'));var rp=require(_0x6b43('0x3'));var moment=require(_0x6b43('0x4'));var BPromise=require(_0x6b43('0x5'));var Mustache=require(_0x6b43('0x6'));var util=require(_0x6b43('0x7'));var path=require(_0x6b43('0x8'));var sox=require(_0x6b43('0x9'));var csv=require(_0x6b43('0xa'));var ejs=require(_0x6b43('0xb'));var fs=require('fs');var fs_extra=require(_0x6b43('0xc'));var _=require(_0x6b43('0xd'));var squel=require(_0x6b43('0xe'));var crypto=require(_0x6b43('0xf'));var jsforce=require(_0x6b43('0x10'));var deskjs=require(_0x6b43('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6b43('0x12'));var Redis=require(_0x6b43('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6b43('0x14'));var hardwareService=require(_0x6b43('0x15'));var logger=require(_0x6b43('0x16'))(_0x6b43('0x17'));var utils=require(_0x6b43('0x18'));var config=require(_0x6b43('0x19'));var licenseUtil=require(_0x6b43('0x1a'));var db=require(_0x6b43('0x1b'))['db'];function respondWithStatusCode(_0x4ac1a2,_0x2b43fe){_0x2b43fe=_0x2b43fe||0xcc;return function(_0x1d502b){if(_0x1d502b){return _0x4ac1a2[_0x6b43('0x1c')](_0x2b43fe);}return _0x4ac1a2['status'](_0x2b43fe)[_0x6b43('0x1d')]();};}function respondWithResult(_0x566578,_0x1e2c80){_0x1e2c80=_0x1e2c80||0xc8;return function(_0x5463bf){if(_0x5463bf){return _0x566578['status'](_0x1e2c80)[_0x6b43('0x1e')](_0x5463bf);}};}function respondWithFilteredResult(_0x539061,_0x85385a){return function(_0x1eb66c){if(_0x1eb66c){var _0x370844=typeof _0x85385a[_0x6b43('0x1f')]===_0x6b43('0x20')&&typeof _0x85385a['limit']===_0x6b43('0x20');var _0x5ce079=_0x1eb66c['count'];var _0x227e8d=_0x370844?0x0:_0x85385a[_0x6b43('0x1f')];var _0x5d36d6=_0x370844?_0x1eb66c['count']:_0x85385a[_0x6b43('0x1f')]+_0x85385a[_0x6b43('0x21')];var _0x4886b9;if(_0x5d36d6>=_0x5ce079){_0x5d36d6=_0x5ce079;_0x4886b9=0xc8;}else{_0x4886b9=0xce;}_0x539061[_0x6b43('0x22')](_0x4886b9);return _0x539061[_0x6b43('0x23')]('Content-Range',_0x227e8d+'-'+_0x5d36d6+'/'+_0x5ce079)[_0x6b43('0x1e')](_0x1eb66c);}return null;};}function patchUpdates(_0x4b5f43){return function(_0x246395){try{jsonpatch[_0x6b43('0x24')](_0x246395,_0x4b5f43,!![]);}catch(_0x579c79){return BPromise[_0x6b43('0x25')](_0x579c79);}return _0x246395[_0x6b43('0x26')]();};}function saveUpdates(_0x561fba,_0x227a33){return function(_0x128dc6){if(_0x128dc6){return _0x128dc6[_0x6b43('0x27')](_0x561fba)[_0x6b43('0x28')](function(_0x5c60a1){return _0x5c60a1;});}return null;};}function removeEntity(_0x2501fa,_0x2fc4f8){return function(_0x48d339){if(_0x48d339){return _0x48d339[_0x6b43('0x29')]()[_0x6b43('0x28')](function(){var _0x86f55c=_0x48d339['get']({'plain':!![]});var _0x7f2275=_0x6b43('0x2a');return db[_0x6b43('0x2b')][_0x6b43('0x29')]({'where':{'type':_0x7f2275,'resourceId':_0x86f55c['id']}})[_0x6b43('0x28')](function(){return _0x48d339;});})[_0x6b43('0x28')](function(){_0x2501fa[_0x6b43('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dee01,_0x17441a){return function(_0x13a54c){if(!_0x13a54c){_0x2dee01['sendStatus'](0x194);}return _0x13a54c;};}function handleError(_0x20c87c,_0x7eac6){_0x7eac6=_0x7eac6||0x1f4;return function(_0x401412){logger[_0x6b43('0x2c')](_0x401412['stack']);if(_0x401412[_0x6b43('0x2d')]){delete _0x401412[_0x6b43('0x2d')];}_0x20c87c[_0x6b43('0x22')](_0x7eac6)[_0x6b43('0x2e')](_0x401412);};}exports['index']=function(_0x221c6f,_0x4551a2){var _0x3a4f2e={},_0x7b57ca={},_0xf1e198={'count':0x0,'rows':[]};var _0x425828=_[_0x6b43('0x2f')](db[_0x6b43('0x30')][_0x6b43('0x31')],function(_0x3f9de4){return{'name':_0x3f9de4['fieldName'],'type':_0x3f9de4[_0x6b43('0x32')][_0x6b43('0x33')]};});_0x7b57ca[_0x6b43('0x34')]=_[_0x6b43('0x2f')](_0x425828,_0x6b43('0x2d'));_0x7b57ca['query']=_[_0x6b43('0x35')](_0x221c6f[_0x6b43('0x36')]);_0x7b57ca[_0x6b43('0x37')]=_[_0x6b43('0x38')](_0x7b57ca[_0x6b43('0x34')],_0x7b57ca['query']);_0x3a4f2e[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x7b57ca['model'],qs[_0x6b43('0x3a')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x3a')]));_0x3a4f2e['attributes']=_0x3a4f2e[_0x6b43('0x39')][_0x6b43('0x3b')]?_0x3a4f2e['attributes']:_0x7b57ca[_0x6b43('0x34')];if(!_0x221c6f[_0x6b43('0x36')]['hasOwnProperty'](_0x6b43('0x3c'))){_0x3a4f2e[_0x6b43('0x21')]=qs[_0x6b43('0x21')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x21')]);_0x3a4f2e[_0x6b43('0x1f')]=qs[_0x6b43('0x1f')](_0x221c6f[_0x6b43('0x36')][_0x6b43('0x1f')]);}_0x3a4f2e[_0x6b43('0x3d')]=qs[_0x6b43('0x3e')](_0x221c6f['query'][_0x6b43('0x3e')]);delete _0x221c6f[_0x6b43('0x36')]['sort'];_0x3a4f2e['where']=qs[_0x6b43('0x37')](_[_0x6b43('0x3f')](_0x221c6f[_0x6b43('0x36')],_0x7b57ca[_0x6b43('0x37')]),_0x425828);if(_0x221c6f['query'][_0x6b43('0x40')]){_0x3a4f2e[_0x6b43('0x41')]=_[_0x6b43('0x42')](_0x3a4f2e[_0x6b43('0x41')],{'$or':_[_0x6b43('0x2f')](_0x425828,function(_0x3ad144){if(_0x3ad144['type']!=='VIRTUAL'){var _0x327972={};_0x327972[_0x3ad144[_0x6b43('0x2d')]]={'$like':'%'+_0x221c6f[_0x6b43('0x36')][_0x6b43('0x40')]+'%'};return _0x327972;}})});}_0x3a4f2e=_[_0x6b43('0x42')]({},_0x3a4f2e,_0x221c6f[_0x6b43('0x43')]);var _0x4e974b={'where':_0x3a4f2e[_0x6b43('0x41')]};return db[_0x6b43('0x30')]['count'](_0x4e974b)[_0x6b43('0x28')](function(_0x47aca2){_0xf1e198[_0x6b43('0x44')]=_0x47aca2;if(_0x221c6f[_0x6b43('0x36')][_0x6b43('0x45')]){_0x3a4f2e[_0x6b43('0x46')]=[{'all':!![]}];}return db[_0x6b43('0x30')][_0x6b43('0x47')](_0x3a4f2e);})['then'](function(_0x756a89){_0xf1e198[_0x6b43('0x48')]=_0x756a89;return _0xf1e198;})[_0x6b43('0x28')](respondWithFilteredResult(_0x4551a2,_0x3a4f2e))[_0x6b43('0x49')](handleError(_0x4551a2,null));};exports[_0x6b43('0x4a')]=function(_0x5522dc,_0x40296f){var _0x532167={'raw':![],'where':{'id':_0x5522dc['params']['id']}},_0x16ee29={};_0x16ee29['model']=_[_0x6b43('0x35')](db['VoiceMusicOnHold'][_0x6b43('0x31')]);_0x16ee29[_0x6b43('0x36')]=_[_0x6b43('0x35')](_0x5522dc['query']);_0x16ee29['filters']=_['intersection'](_0x16ee29['model'],_0x16ee29[_0x6b43('0x36')]);_0x532167[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x16ee29['model'],qs['fields'](_0x5522dc['query']['fields']));_0x532167['attributes']=_0x532167[_0x6b43('0x39')]['length']?_0x532167[_0x6b43('0x39')]:_0x16ee29['model'];if(_0x5522dc[_0x6b43('0x36')][_0x6b43('0x45')]){_0x532167['include']=[{'all':!![]}];}_0x532167=_['merge']({},_0x532167,_0x5522dc['options']);return db[_0x6b43('0x30')]['find'](_0x532167)[_0x6b43('0x28')](handleEntityNotFound(_0x40296f,null))[_0x6b43('0x28')](respondWithResult(_0x40296f,null))['catch'](handleError(_0x40296f,null));};exports['update']=function(_0x542fa3,_0xf14da7){if(_0x542fa3[_0x6b43('0x4b')]['id']){delete _0x542fa3['body']['id'];}return db[_0x6b43('0x30')][_0x6b43('0x4c')]({'where':{'id':_0x542fa3[_0x6b43('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf14da7,null))[_0x6b43('0x28')](saveUpdates(_0x542fa3[_0x6b43('0x4b')],null))[_0x6b43('0x28')](respondWithResult(_0xf14da7,null))['catch'](handleError(_0xf14da7,null));};exports['create']=function(_0x22049a,_0x7f6705,_0x475de2){return db['sequelize']['transaction'](function(_0x3db7a6){if(_0x22049a[_0x6b43('0x4b')][_0x6b43('0x4e')]===_0x6b43('0x4f')){_0x22049a['body'][_0x6b43('0x50')]=path[_0x6b43('0x51')](config[_0x6b43('0x52')],_0x6b43('0x53'),_0x22049a[_0x6b43('0x4b')]['name']);}return db[_0x6b43('0x30')]['create'](_0x22049a[_0x6b43('0x4b')],{'transaction':_0x3db7a6})[_0x6b43('0x28')](function(_0x3d9c40){if(_0x22049a['body'][_0x6b43('0x4e')]===_0x6b43('0x4f')){fs[_0x6b43('0x54')](_0x3d9c40[_0x6b43('0x50')],parseInt(_0x6b43('0x55'),0x8));}var _0x4964d3=_0x22049a[_0x6b43('0x56')]['get']({'plain':!![]});if(!_0x4964d3)throw new Error(_0x6b43('0x57'));if(_0x4964d3[_0x6b43('0x58')]===_0x6b43('0x56')){var _0x910dcc=_0x3d9c40[_0x6b43('0x59')]({'plain':!![]});return db[_0x6b43('0x5a')][_0x6b43('0x4c')]({'where':{'name':_0x6b43('0x2a'),'userProfileId':_0x4964d3['userProfileId']},'raw':!![]})[_0x6b43('0x28')](function(_0x29fc81){if(_0x29fc81&&_0x29fc81[_0x6b43('0x5b')]===0x0){return db[_0x6b43('0x2b')][_0x6b43('0x5c')]({'name':_0x910dcc['name'],'resourceId':_0x910dcc['id'],'type':_0x29fc81[_0x6b43('0x2d')],'sectionId':_0x29fc81['id']},{})[_0x6b43('0x28')](function(){return _0x3d9c40;});}else{return _0x3d9c40;}})['catch'](function(_0x2535db){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2535db);});}return _0x3d9c40;});})[_0x6b43('0x28')](respondWithResult(_0x7f6705,0xc9))[_0x6b43('0x49')](handleError(_0x7f6705,null));};exports[_0x6b43('0x29')]=function(_0x177480,_0x169724,_0x5487d0){var _0x16d241;return db[_0x6b43('0x30')]['find']({'where':{'id':_0x177480['params']['id']}})[_0x6b43('0x28')](function(_0x566927){if(_0x566927){return db['sequelize']['transaction'](function(_0x44353b){return _0x566927[_0x6b43('0x29')]({'transaction':_0x44353b,'raw':!![]})['then'](function(_0x4771c7){if(_0x4771c7[_0x6b43('0x50')]){fs[_0x6b43('0x5d')](_0x4771c7[_0x6b43('0x50')])[_0x6b43('0x5e')](function(_0x407e8c){fs[_0x6b43('0x5f')](path[_0x6b43('0x51')](_0x4771c7[_0x6b43('0x50')],_0x407e8c));});fs[_0x6b43('0x60')](_0x4771c7[_0x6b43('0x50')]);}return _0x4771c7;});})[_0x6b43('0x49')](function(_0x20b6bb){throw new db[(_0x6b43('0x61'))][(_0x6b43('0x62'))](_0x20b6bb[_0x6b43('0x63')]);});}})[_0x6b43('0x28')](handleEntityNotFound(_0x169724,null))[_0x6b43('0x28')](removeEntity(_0x169724,null))['catch'](handleError(_0x169724,null));};exports[_0x6b43('0x64')]=function(_0x217246,_0x338344,_0x39b452){return db[_0x6b43('0x65')][_0x6b43('0x66')](function(_0x28d7f8){var _0x13d704;return db[_0x6b43('0x30')][_0x6b43('0x4c')]({'where':{'id':_0x217246[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](function(_0x624013){if(_0x624013){_0x13d704=_0x624013;return _0x624013[_0x6b43('0x64')](_0x217246['body']['id'],{'transaction':_0x28d7f8});}})[_0x6b43('0x28')](function(_0x3023cb){if(_0x3023cb){return db['Sound']['findOne']({'where':{'id':_0x217246[_0x6b43('0x4b')]['id']},'attributes':['id',_0x6b43('0x2d'),_0x6b43('0x67'),'converted_format',_0x6b43('0x68')],'raw':!![]});}})[_0x6b43('0x28')](function(_0x4733a4){if(_0x4733a4){var _0x18a29c=path['join'](config[_0x6b43('0x52')],_0x6b43('0x69'),util['format'](_0x6b43('0x6a'),path[_0x6b43('0x6b')](_0x4733a4[_0x6b43('0x67')],path['extname'](_0x4733a4[_0x6b43('0x67')])),_0x4733a4['converted_format']));var _0x3f793d=path[_0x6b43('0x51')](config['root'],_0x6b43('0x53'),_0x13d704['name'],util[_0x6b43('0x6c')](_0x6b43('0x6a'),_0x4733a4['name'],_0x4733a4[_0x6b43('0x6d')]));fs[_0x6b43('0x6e')](_0x18a29c,_0x3f793d);return _0x4733a4;}})[_0x6b43('0x49')](function(_0x22a834){throw new db[(_0x6b43('0x61'))][(_0x6b43('0x62'))](_0x22a834[_0x6b43('0x63')]);});})[_0x6b43('0x28')](handleEntityNotFound(_0x338344,null))['then'](respondWithResult(_0x338344,0xc9))[_0x6b43('0x49')](handleError(_0x338344,null));};exports[_0x6b43('0x6f')]=function(_0x2222e0,_0x2a0cb7,_0x126654){return db[_0x6b43('0x65')][_0x6b43('0x66')](function(_0x417fab){var _0x31e763;return db[_0x6b43('0x30')][_0x6b43('0x70')]({'where':{'id':_0x2222e0[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](handleEntityNotFound(_0x2a0cb7,null))[_0x6b43('0x28')](function(_0xa62769){if(_0xa62769){_0x31e763=_0xa62769;return _0xa62769[_0x6b43('0x6f')](_0x2222e0[_0x6b43('0x4d')][_0x6b43('0x71')]);}})[_0x6b43('0x28')](function(_0x3ba56a){if(_0x3ba56a){return db[_0x6b43('0x72')]['findOne']({'where':{'id':_0x2222e0[_0x6b43('0x4d')][_0x6b43('0x71')]},'attributes':['id',_0x6b43('0x2d'),'save_name',_0x6b43('0x6d'),_0x6b43('0x68')],'raw':!![]});}})[_0x6b43('0x28')](function(_0x3e0fcf){if(_0x3e0fcf){fs['unlinkSync'](path[_0x6b43('0x51')](_0x31e763[_0x6b43('0x50')],util[_0x6b43('0x6c')](_0x6b43('0x6a'),_0x3e0fcf['name'],_0x3e0fcf[_0x6b43('0x6d')])));return _0x3e0fcf;}})['catch'](function(_0x56cb9c){throw new db['Sequelize'][(_0x6b43('0x62'))](_0x56cb9c[_0x6b43('0x63')]);});})[_0x6b43('0x28')](handleEntityNotFound(_0x2a0cb7,null))[_0x6b43('0x28')](respondWithStatusCode(_0x2a0cb7,0xcc))['catch'](handleError(_0x2a0cb7,null));};exports[_0x6b43('0x73')]=function(_0x1899fa,_0x15ddf9,_0xc1833f){var _0x48c386={};var _0x3af795={};var _0x402607;var _0x1904c6;return db['VoiceMusicOnHold'][_0x6b43('0x70')]({'where':{'id':_0x1899fa[_0x6b43('0x4d')]['id']}})[_0x6b43('0x28')](handleEntityNotFound(_0x15ddf9,null))['then'](function(_0x4622b0){if(_0x4622b0){_0x402607=_0x4622b0;_0x3af795['model']=_[_0x6b43('0x35')](db[_0x6b43('0x72')][_0x6b43('0x31')]);_0x3af795['query']=_[_0x6b43('0x35')](_0x1899fa['query']);_0x3af795[_0x6b43('0x37')]=_[_0x6b43('0x38')](_0x3af795[_0x6b43('0x34')],_0x3af795['query']);_0x48c386[_0x6b43('0x39')]=_[_0x6b43('0x38')](_0x3af795[_0x6b43('0x34')],qs[_0x6b43('0x3a')](_0x1899fa['query'][_0x6b43('0x3a')]));_0x48c386[_0x6b43('0x39')]=_0x48c386[_0x6b43('0x39')][_0x6b43('0x3b')]?_0x48c386[_0x6b43('0x39')]:_0x3af795[_0x6b43('0x34')];_0x48c386['order']=qs[_0x6b43('0x3e')](_0x1899fa['query'][_0x6b43('0x3e')]);_0x48c386[_0x6b43('0x41')]=qs['filters'](_[_0x6b43('0x3f')](_0x1899fa[_0x6b43('0x36')],_0x3af795[_0x6b43('0x37')]));if(_0x1899fa[_0x6b43('0x36')]['filter']){_0x48c386[_0x6b43('0x41')]=_['merge'](_0x48c386[_0x6b43('0x41')],{'$or':_[_0x6b43('0x2f')](_0x48c386['attributes'],function(_0x56c2f7){var _0x14d1a0={};_0x14d1a0[_0x56c2f7]={'$like':'%'+_0x1899fa[_0x6b43('0x36')]['filter']+'%'};return _0x14d1a0;})});}_0x48c386=_[_0x6b43('0x42')]({},_0x48c386,_0x1899fa['options']);return _0x402607[_0x6b43('0x73')](_0x48c386);}})['then'](function(_0x27ef27){if(_0x27ef27){_0x1904c6=_0x27ef27['length'];if(!_0x1899fa[_0x6b43('0x36')]['hasOwnProperty'](_0x6b43('0x3c'))){_0x48c386[_0x6b43('0x21')]=qs[_0x6b43('0x21')](_0x1899fa[_0x6b43('0x36')]['limit']);_0x48c386[_0x6b43('0x1f')]=qs['offset'](_0x1899fa['query'][_0x6b43('0x1f')]);}return _0x402607[_0x6b43('0x73')](_0x48c386);}})[_0x6b43('0x28')](function(_0x4d9304){if(_0x4d9304){return _0x4d9304?{'count':_0x1904c6,'rows':_0x4d9304}:null;}})[_0x6b43('0x28')](respondWithResult(_0x15ddf9,null))[_0x6b43('0x49')](handleError(_0x15ddf9,null));}; \ No newline at end of file +var _0x58aa=['../../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','MusicOnHolds','UserProfileResource','error','stack','send','index','map','VoiceMusicOnHold','fieldName','model','name','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','type','options','include','findAll','rows','catch','show','rawAttributes','includeAll','body','params','create','sequelize','transaction','join','server/files/moh','mode','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','unlinkSync','Sequelize','ValidationError','addSound','find','Sound','findOne','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','converted_format','symlinkSync','removeSound','id2','getSounds','length','hasOwnProperty','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x58aa,0x1b0));var _0xa58a=function(_0x17e417,_0x53e0d8){_0x17e417=_0x17e417-0x0;var _0x41dc1f=_0x58aa[_0x17e417];return _0x41dc1f;};'use strict';var emlformat=require(_0xa58a('0x0'));var rimraf=require(_0xa58a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa58a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa58a('0x3'));var Mustache=require(_0xa58a('0x4'));var util=require(_0xa58a('0x5'));var path=require(_0xa58a('0x6'));var sox=require(_0xa58a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa58a('0x8'));var _=require(_0xa58a('0x9'));var squel=require(_0xa58a('0xa'));var crypto=require(_0xa58a('0xb'));var jsforce=require(_0xa58a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa58a('0xd'));var querystring=require(_0xa58a('0xe'));var Papa=require('papaparse');var Redis=require(_0xa58a('0xf'));var authService=require(_0xa58a('0x10'));var qs=require(_0xa58a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa58a('0x12'));var logger=require(_0xa58a('0x13'))(_0xa58a('0x14'));var utils=require('../../config/utils');var config=require(_0xa58a('0x15'));var licenseUtil=require(_0xa58a('0x16'));var db=require(_0xa58a('0x17'))['db'];function respondWithStatusCode(_0x4e67e2,_0x1eaf40){_0x1eaf40=_0x1eaf40||0xcc;return function(_0x2bbee9){if(_0x2bbee9){return _0x4e67e2[_0xa58a('0x18')](_0x1eaf40);}return _0x4e67e2[_0xa58a('0x19')](_0x1eaf40)[_0xa58a('0x1a')]();};}function respondWithResult(_0x1af345,_0x895973){_0x895973=_0x895973||0xc8;return function(_0x2acfa8){if(_0x2acfa8){return _0x1af345[_0xa58a('0x19')](_0x895973)[_0xa58a('0x1b')](_0x2acfa8);}};}function respondWithFilteredResult(_0xa4fb75,_0x2d6787){return function(_0x4ec53f){if(_0x4ec53f){var _0x5e0f13=typeof _0x2d6787['offset']==='undefined'&&typeof _0x2d6787[_0xa58a('0x1c')]===_0xa58a('0x1d');var _0x33c6cc=_0x4ec53f[_0xa58a('0x1e')];var _0x493402=_0x5e0f13?0x0:_0x2d6787[_0xa58a('0x1f')];var _0x527642=_0x5e0f13?_0x4ec53f['count']:_0x2d6787[_0xa58a('0x1f')]+_0x2d6787['limit'];var _0x1834ee;if(_0x527642>=_0x33c6cc){_0x527642=_0x33c6cc;_0x1834ee=0xc8;}else{_0x1834ee=0xce;}_0xa4fb75['status'](_0x1834ee);return _0xa4fb75[_0xa58a('0x20')](_0xa58a('0x21'),_0x493402+'-'+_0x527642+'/'+_0x33c6cc)[_0xa58a('0x1b')](_0x4ec53f);}return null;};}function patchUpdates(_0x4d189e){return function(_0x4388f1){try{jsonpatch[_0xa58a('0x22')](_0x4388f1,_0x4d189e,!![]);}catch(_0x542347){return BPromise[_0xa58a('0x23')](_0x542347);}return _0x4388f1['save']();};}function saveUpdates(_0x1d20f6,_0x50e95e){return function(_0x39a31f){if(_0x39a31f){return _0x39a31f[_0xa58a('0x24')](_0x1d20f6)[_0xa58a('0x25')](function(_0x3fb965){return _0x3fb965;});}return null;};}function removeEntity(_0x323a63,_0x35e8c3){return function(_0x2127c0){if(_0x2127c0){return _0x2127c0[_0xa58a('0x26')]()[_0xa58a('0x25')](function(){var _0x361924=_0x2127c0[_0xa58a('0x27')]({'plain':!![]});var _0x56b6a9=_0xa58a('0x28');return db[_0xa58a('0x29')][_0xa58a('0x26')]({'where':{'type':_0x56b6a9,'resourceId':_0x361924['id']}})[_0xa58a('0x25')](function(){return _0x2127c0;});})[_0xa58a('0x25')](function(){_0x323a63['status'](0xcc)[_0xa58a('0x1a')]();});}};}function handleEntityNotFound(_0x1240f2,_0x84bfc0){return function(_0x323225){if(!_0x323225){_0x1240f2[_0xa58a('0x18')](0x194);}return _0x323225;};}function handleError(_0xaa5ccb,_0x31ab3e){_0x31ab3e=_0x31ab3e||0x1f4;return function(_0x1af5b6){logger[_0xa58a('0x2a')](_0x1af5b6[_0xa58a('0x2b')]);if(_0x1af5b6['name']){delete _0x1af5b6['name'];}_0xaa5ccb[_0xa58a('0x19')](_0x31ab3e)[_0xa58a('0x2c')](_0x1af5b6);};}exports[_0xa58a('0x2d')]=function(_0x51cead,_0x1cec77){var _0x140c48={},_0x3a8991={},_0x279689={'count':0x0,'rows':[]};var _0x544948=_[_0xa58a('0x2e')](db[_0xa58a('0x2f')]['rawAttributes'],function(_0x5f05f0){return{'name':_0x5f05f0[_0xa58a('0x30')],'type':_0x5f05f0['type']['key']};});_0x3a8991[_0xa58a('0x31')]=_[_0xa58a('0x2e')](_0x544948,_0xa58a('0x32'));_0x3a8991[_0xa58a('0x33')]=_[_0xa58a('0x34')](_0x51cead[_0xa58a('0x33')]);_0x3a8991[_0xa58a('0x35')]=_[_0xa58a('0x36')](_0x3a8991[_0xa58a('0x31')],_0x3a8991[_0xa58a('0x33')]);_0x140c48[_0xa58a('0x37')]=_['intersection'](_0x3a8991[_0xa58a('0x31')],qs[_0xa58a('0x38')](_0x51cead[_0xa58a('0x33')]['fields']));_0x140c48[_0xa58a('0x37')]=_0x140c48['attributes']['length']?_0x140c48[_0xa58a('0x37')]:_0x3a8991[_0xa58a('0x31')];if(!_0x51cead[_0xa58a('0x33')]['hasOwnProperty'](_0xa58a('0x39'))){_0x140c48[_0xa58a('0x1c')]=qs[_0xa58a('0x1c')](_0x51cead[_0xa58a('0x33')]['limit']);_0x140c48[_0xa58a('0x1f')]=qs[_0xa58a('0x1f')](_0x51cead[_0xa58a('0x33')]['offset']);}_0x140c48[_0xa58a('0x3a')]=qs['sort'](_0x51cead[_0xa58a('0x33')][_0xa58a('0x3b')]);delete _0x51cead[_0xa58a('0x33')][_0xa58a('0x3b')];_0x140c48['where']=qs[_0xa58a('0x35')](_[_0xa58a('0x3c')](_0x51cead[_0xa58a('0x33')],_0x3a8991[_0xa58a('0x35')]),_0x544948);if(_0x51cead[_0xa58a('0x33')][_0xa58a('0x3d')]){_0x140c48[_0xa58a('0x3e')]=_[_0xa58a('0x3f')](_0x140c48[_0xa58a('0x3e')],{'$or':_[_0xa58a('0x2e')](_0x544948,function(_0x1d6e79){if(_0x1d6e79[_0xa58a('0x40')]!=='VIRTUAL'){var _0x5dce3a={};_0x5dce3a[_0x1d6e79[_0xa58a('0x32')]]={'$like':'%'+_0x51cead[_0xa58a('0x33')][_0xa58a('0x3d')]+'%'};return _0x5dce3a;}})});}_0x140c48=_[_0xa58a('0x3f')]({},_0x140c48,_0x51cead[_0xa58a('0x41')]);var _0x23376f={'where':_0x140c48[_0xa58a('0x3e')]};return db[_0xa58a('0x2f')][_0xa58a('0x1e')](_0x23376f)[_0xa58a('0x25')](function(_0x2e5c60){_0x279689['count']=_0x2e5c60;if(_0x51cead['query']['includeAll']){_0x140c48[_0xa58a('0x42')]=[{'all':!![]}];}return db[_0xa58a('0x2f')][_0xa58a('0x43')](_0x140c48);})[_0xa58a('0x25')](function(_0x383599){_0x279689[_0xa58a('0x44')]=_0x383599;return _0x279689;})[_0xa58a('0x25')](respondWithFilteredResult(_0x1cec77,_0x140c48))[_0xa58a('0x45')](handleError(_0x1cec77,null));};exports[_0xa58a('0x46')]=function(_0x164fcc,_0x22a2b9){var _0x11d347={'raw':![],'where':{'id':_0x164fcc['params']['id']}},_0x546553={};_0x546553[_0xa58a('0x31')]=_[_0xa58a('0x34')](db[_0xa58a('0x2f')][_0xa58a('0x47')]);_0x546553[_0xa58a('0x33')]=_[_0xa58a('0x34')](_0x164fcc[_0xa58a('0x33')]);_0x546553['filters']=_[_0xa58a('0x36')](_0x546553[_0xa58a('0x31')],_0x546553[_0xa58a('0x33')]);_0x11d347[_0xa58a('0x37')]=_[_0xa58a('0x36')](_0x546553[_0xa58a('0x31')],qs[_0xa58a('0x38')](_0x164fcc[_0xa58a('0x33')][_0xa58a('0x38')]));_0x11d347[_0xa58a('0x37')]=_0x11d347[_0xa58a('0x37')]['length']?_0x11d347[_0xa58a('0x37')]:_0x546553[_0xa58a('0x31')];if(_0x164fcc['query'][_0xa58a('0x48')]){_0x11d347[_0xa58a('0x42')]=[{'all':!![]}];}_0x11d347=_[_0xa58a('0x3f')]({},_0x11d347,_0x164fcc[_0xa58a('0x41')]);return db[_0xa58a('0x2f')]['find'](_0x11d347)['then'](handleEntityNotFound(_0x22a2b9,null))[_0xa58a('0x25')](respondWithResult(_0x22a2b9,null))[_0xa58a('0x45')](handleError(_0x22a2b9,null));};exports[_0xa58a('0x24')]=function(_0x51b1f0,_0x215c92){if(_0x51b1f0[_0xa58a('0x49')]['id']){delete _0x51b1f0[_0xa58a('0x49')]['id'];}return db[_0xa58a('0x2f')]['find']({'where':{'id':_0x51b1f0[_0xa58a('0x4a')]['id']}})[_0xa58a('0x25')](handleEntityNotFound(_0x215c92,null))[_0xa58a('0x25')](saveUpdates(_0x51b1f0[_0xa58a('0x49')],null))[_0xa58a('0x25')](respondWithResult(_0x215c92,null))[_0xa58a('0x45')](handleError(_0x215c92,null));};exports[_0xa58a('0x4b')]=function(_0x1d815f,_0x457ab8,_0x2670f2){return db[_0xa58a('0x4c')][_0xa58a('0x4d')](function(_0x5d3032){if(_0x1d815f[_0xa58a('0x49')]['mode']==='files'){_0x1d815f[_0xa58a('0x49')]['directory']=path[_0xa58a('0x4e')](config['root'],_0xa58a('0x4f'),_0x1d815f[_0xa58a('0x49')][_0xa58a('0x32')]);}return db[_0xa58a('0x2f')][_0xa58a('0x4b')](_0x1d815f[_0xa58a('0x49')],{'transaction':_0x5d3032})[_0xa58a('0x25')](function(_0x2ad128){if(_0x1d815f['body'][_0xa58a('0x50')]==='files'){fs[_0xa58a('0x51')](_0x2ad128[_0xa58a('0x52')],parseInt(_0xa58a('0x53'),0x8));}var _0x2ef62c=_0x1d815f[_0xa58a('0x54')][_0xa58a('0x27')]({'plain':!![]});if(!_0x2ef62c)throw new Error(_0xa58a('0x55'));if(_0x2ef62c[_0xa58a('0x56')]==='user'){var _0x37bfb3=_0x2ad128['get']({'plain':!![]});return db[_0xa58a('0x57')]['find']({'where':{'name':'MusicOnHolds','userProfileId':_0x2ef62c['userProfileId']},'raw':!![]})['then'](function(_0x6a1dc6){if(_0x6a1dc6&&_0x6a1dc6[_0xa58a('0x58')]===0x0){return db[_0xa58a('0x29')][_0xa58a('0x4b')]({'name':_0x37bfb3[_0xa58a('0x32')],'resourceId':_0x37bfb3['id'],'type':_0x6a1dc6[_0xa58a('0x32')],'sectionId':_0x6a1dc6['id']},{})[_0xa58a('0x25')](function(){return _0x2ad128;});}else{return _0x2ad128;}})[_0xa58a('0x45')](function(_0x37f8b5){logger[_0xa58a('0x2a')](_0xa58a('0x59'),_0x37f8b5);});}return _0x2ad128;});})[_0xa58a('0x25')](respondWithResult(_0x457ab8,0xc9))['catch'](handleError(_0x457ab8,null));};exports[_0xa58a('0x26')]=function(_0x555b7c,_0x2a6221,_0x1fb693){var _0x2f8755;return db[_0xa58a('0x2f')]['find']({'where':{'id':_0x555b7c[_0xa58a('0x4a')]['id']}})[_0xa58a('0x25')](function(_0x274846){if(_0x274846){return db['sequelize'][_0xa58a('0x4d')](function(_0x167482){return _0x274846['destroy']({'transaction':_0x167482,'raw':!![]})[_0xa58a('0x25')](function(_0x4aeda4){if(_0x4aeda4[_0xa58a('0x52')]){fs[_0xa58a('0x5a')](_0x4aeda4[_0xa58a('0x52')])['forEach'](function(_0xa96173){fs[_0xa58a('0x5b')](path[_0xa58a('0x4e')](_0x4aeda4[_0xa58a('0x52')],_0xa96173));});fs['rmdirSync'](_0x4aeda4['directory']);}return _0x4aeda4;});})[_0xa58a('0x45')](function(_0x4e8b2b){throw new db[(_0xa58a('0x5c'))][(_0xa58a('0x5d'))](_0x4e8b2b['message']);});}})['then'](handleEntityNotFound(_0x2a6221,null))[_0xa58a('0x25')](removeEntity(_0x2a6221,null))['catch'](handleError(_0x2a6221,null));};exports[_0xa58a('0x5e')]=function(_0x7ad93d,_0x353890,_0x50ad42){return db[_0xa58a('0x4c')]['transaction'](function(_0x1649bb){var _0x4c52e0;return db['VoiceMusicOnHold'][_0xa58a('0x5f')]({'where':{'id':_0x7ad93d[_0xa58a('0x4a')]['id']}})['then'](function(_0x21a475){if(_0x21a475){_0x4c52e0=_0x21a475;return _0x21a475[_0xa58a('0x5e')](_0x7ad93d['body']['id'],{'transaction':_0x1649bb});}})[_0xa58a('0x25')](function(_0x59efb1){if(_0x59efb1){return db[_0xa58a('0x60')][_0xa58a('0x61')]({'where':{'id':_0x7ad93d[_0xa58a('0x49')]['id']},'attributes':['id',_0xa58a('0x32'),_0xa58a('0x62'),'converted_format',_0xa58a('0x63')],'raw':!![]});}})[_0xa58a('0x25')](function(_0x375e47){if(_0x375e47){var _0x50d30d=path[_0xa58a('0x4e')](config[_0xa58a('0x64')],_0xa58a('0x65'),util[_0xa58a('0x66')](_0xa58a('0x67'),path[_0xa58a('0x68')](_0x375e47[_0xa58a('0x62')],path['extname'](_0x375e47['save_name'])),_0x375e47[_0xa58a('0x69')]));var _0x18343c=path[_0xa58a('0x4e')](config[_0xa58a('0x64')],'server/files/moh',_0x4c52e0['name'],util[_0xa58a('0x66')]('%s.%s',_0x375e47[_0xa58a('0x32')],_0x375e47[_0xa58a('0x69')]));fs[_0xa58a('0x6a')](_0x50d30d,_0x18343c);return _0x375e47;}})[_0xa58a('0x45')](function(_0x7e1827){throw new db[(_0xa58a('0x5c'))][(_0xa58a('0x5d'))](_0x7e1827['message']);});})['then'](handleEntityNotFound(_0x353890,null))['then'](respondWithResult(_0x353890,0xc9))[_0xa58a('0x45')](handleError(_0x353890,null));};exports['removeSound']=function(_0x23bf33,_0x988f15,_0x5cd7d5){return db[_0xa58a('0x4c')]['transaction'](function(_0x3b006e){var _0x4dfb0e;return db[_0xa58a('0x2f')][_0xa58a('0x61')]({'where':{'id':_0x23bf33[_0xa58a('0x4a')]['id']}})[_0xa58a('0x25')](handleEntityNotFound(_0x988f15,null))[_0xa58a('0x25')](function(_0x1a25d0){if(_0x1a25d0){_0x4dfb0e=_0x1a25d0;return _0x1a25d0[_0xa58a('0x6b')](_0x23bf33[_0xa58a('0x4a')]['id2']);}})['then'](function(_0x38db96){if(_0x38db96){return db['Sound'][_0xa58a('0x61')]({'where':{'id':_0x23bf33[_0xa58a('0x4a')][_0xa58a('0x6c')]},'attributes':['id',_0xa58a('0x32'),_0xa58a('0x62'),_0xa58a('0x69'),_0xa58a('0x63')],'raw':!![]});}})[_0xa58a('0x25')](function(_0x289b24){if(_0x289b24){fs[_0xa58a('0x5b')](path[_0xa58a('0x4e')](_0x4dfb0e[_0xa58a('0x52')],util['format'](_0xa58a('0x67'),_0x289b24[_0xa58a('0x32')],_0x289b24['converted_format'])));return _0x289b24;}})[_0xa58a('0x45')](function(_0x3e3b4a){throw new db[(_0xa58a('0x5c'))]['ValidationError'](_0x3e3b4a['message']);});})[_0xa58a('0x25')](handleEntityNotFound(_0x988f15,null))[_0xa58a('0x25')](respondWithStatusCode(_0x988f15,0xcc))[_0xa58a('0x45')](handleError(_0x988f15,null));};exports[_0xa58a('0x6d')]=function(_0x1c7165,_0x1e200e,_0x23877a){var _0x35fdd4={};var _0x177157={};var _0x3f8271;var _0x1d8768;return db[_0xa58a('0x2f')][_0xa58a('0x61')]({'where':{'id':_0x1c7165[_0xa58a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e200e,null))[_0xa58a('0x25')](function(_0x545025){if(_0x545025){_0x3f8271=_0x545025;_0x177157['model']=_[_0xa58a('0x34')](db[_0xa58a('0x60')][_0xa58a('0x47')]);_0x177157[_0xa58a('0x33')]=_[_0xa58a('0x34')](_0x1c7165[_0xa58a('0x33')]);_0x177157[_0xa58a('0x35')]=_[_0xa58a('0x36')](_0x177157[_0xa58a('0x31')],_0x177157[_0xa58a('0x33')]);_0x35fdd4[_0xa58a('0x37')]=_['intersection'](_0x177157[_0xa58a('0x31')],qs[_0xa58a('0x38')](_0x1c7165[_0xa58a('0x33')][_0xa58a('0x38')]));_0x35fdd4[_0xa58a('0x37')]=_0x35fdd4[_0xa58a('0x37')]['length']?_0x35fdd4[_0xa58a('0x37')]:_0x177157[_0xa58a('0x31')];_0x35fdd4['order']=qs[_0xa58a('0x3b')](_0x1c7165[_0xa58a('0x33')][_0xa58a('0x3b')]);_0x35fdd4['where']=qs[_0xa58a('0x35')](_[_0xa58a('0x3c')](_0x1c7165['query'],_0x177157[_0xa58a('0x35')]));if(_0x1c7165['query']['filter']){_0x35fdd4[_0xa58a('0x3e')]=_[_0xa58a('0x3f')](_0x35fdd4[_0xa58a('0x3e')],{'$or':_['map'](_0x35fdd4['attributes'],function(_0x407ef5){var _0x1fd042={};_0x1fd042[_0x407ef5]={'$like':'%'+_0x1c7165[_0xa58a('0x33')]['filter']+'%'};return _0x1fd042;})});}_0x35fdd4=_[_0xa58a('0x3f')]({},_0x35fdd4,_0x1c7165[_0xa58a('0x41')]);return _0x3f8271[_0xa58a('0x6d')](_0x35fdd4);}})[_0xa58a('0x25')](function(_0xb75040){if(_0xb75040){_0x1d8768=_0xb75040[_0xa58a('0x6e')];if(!_0x1c7165[_0xa58a('0x33')][_0xa58a('0x6f')](_0xa58a('0x39'))){_0x35fdd4['limit']=qs[_0xa58a('0x1c')](_0x1c7165['query'][_0xa58a('0x1c')]);_0x35fdd4[_0xa58a('0x1f')]=qs[_0xa58a('0x1f')](_0x1c7165['query'][_0xa58a('0x1f')]);}return _0x3f8271[_0xa58a('0x6d')](_0x35fdd4);}})[_0xa58a('0x25')](function(_0x2108b1){if(_0x2108b1){return _0x2108b1?{'count':_0x1d8768,'rows':_0x2108b1}:null;}})['then'](respondWithResult(_0x1e200e,null))['catch'](handleError(_0x1e200e,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 6a9e3ca..84bb927 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 _0xb241=['path','rimraf','../../config/environment','exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x556694,_0x488ae7){var _0x5e566f=function(_0x49472e){while(--_0x49472e){_0x556694['push'](_0x556694['shift']());}};_0x5e566f(++_0x488ae7);}(_0xb241,0x125));var _0x1b24=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xb241[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x1b24('0x0'));var util=require(_0x1b24('0x1'));var logger=require(_0x1b24('0x2'))(_0x1b24('0x3'));var moment=require(_0x1b24('0x4'));var BPromise=require(_0x1b24('0x5'));var rp=require(_0x1b24('0x6'));var fs=require('fs');var path=require(_0x1b24('0x7'));var rimraf=require(_0x1b24('0x8'));var config=require(_0x1b24('0x9'));var attributes=require('./voiceMusicOnHold.attributes');module[_0x1b24('0xa')]=function(_0x14680b,_0x1297d0){return _0x14680b['define'](_0x1b24('0xb'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1013=['moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','voice_musiconhold','util','../../config/logger','api'];(function(_0x4fc4e7,_0x16bfc4){var _0x297133=function(_0x5d1eb6){while(--_0x5d1eb6){_0x4fc4e7['push'](_0x4fc4e7['shift']());}};_0x297133(++_0x16bfc4);}(_0x1013,0x1d1));var _0x3101=function(_0x35b7b9,_0x4cb716){_0x35b7b9=_0x35b7b9-0x0;var _0x49856f=_0x1013[_0x35b7b9];return _0x49856f;};'use strict';var _=require('lodash');var util=require(_0x3101('0x0'));var logger=require(_0x3101('0x1'))(_0x3101('0x2'));var moment=require(_0x3101('0x3'));var BPromise=require(_0x3101('0x4'));var rp=require(_0x3101('0x5'));var fs=require('fs');var path=require(_0x3101('0x6'));var rimraf=require('rimraf');var config=require(_0x3101('0x7'));var attributes=require(_0x3101('0x8'));module[_0x3101('0x9')]=function(_0x541065,_0x977d07){return _0x541065[_0x3101('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0x3101('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f0b90ad..1934171 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 _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x6d3c0c,_0x3e8582){var _0x4eff80=function(_0x2a7001){while(--_0x2a7001){_0x6d3c0c['push'](_0x6d3c0c['shift']());}};_0x4eff80(++_0x3e8582);}(_0x70e0,0x17b));var _0x070e=function(_0x5e340b,_0x38fa12){_0x5e340b=_0x5e340b-0x0;var _0x553cb9=_0x70e0[_0x5e340b];return _0x553cb9;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _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(_0x3f1472,_0x179704){var _0x2d90b7=function(_0x49abc4){while(--_0x49abc4){_0x3f1472['push'](_0x3f1472['shift']());}};_0x2d90b7(++_0x179704);}(_0xedd9,0xfc));var _0x9edd=function(_0x103843,_0x3c3750){_0x103843=_0x103843-0x0;var _0x490af6=_0xedd9[_0x103843];return _0x490af6;};'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 6752a9b..069ea0d 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 _0xc631=['/:id','show','/:id/users','getAgents','getTeams','post','create','addAgents','put','update','delete','/:id/teams','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x551834,_0x330d01){var _0x3ae736=function(_0xb1a1b7){while(--_0xb1a1b7){_0x551834['push'](_0x551834['shift']());}};_0x3ae736(++_0x330d01);}(_0xc631,0x82));var _0x1c63=function(_0x5bd02a,_0x2abcc0){_0x5bd02a=_0x5bd02a-0x0;var _0x402ca8=_0xc631[_0x5bd02a];return _0x402ca8;};'use strict';var multer=require('multer');var util=require(_0x1c63('0x0'));var path=require(_0x1c63('0x1'));var timeout=require(_0x1c63('0x2'));var express=require(_0x1c63('0x3'));var router=express[_0x1c63('0x4')]();var fs_extra=require(_0x1c63('0x5'));var auth=require(_0x1c63('0x6'));var interaction=require(_0x1c63('0x7'));var config=require(_0x1c63('0x8'));var controller=require(_0x1c63('0x9'));router['get']('/',auth[_0x1c63('0xa')](),controller[_0x1c63('0xb')]);router[_0x1c63('0xc')](_0x1c63('0xd'),auth[_0x1c63('0xa')](),controller[_0x1c63('0xe')]);router['get'](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x10')]);router[_0x1c63('0xc')](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x12')]);router['get']('/:id/teams',auth[_0x1c63('0xa')](),controller[_0x1c63('0x13')]);router[_0x1c63('0x14')]('/',auth[_0x1c63('0xa')](),controller[_0x1c63('0x15')]);router[_0x1c63('0x14')](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x16')]);router[_0x1c63('0x14')]('/:id/teams',auth[_0x1c63('0xa')](),controller['addTeams']);router[_0x1c63('0x17')](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller[_0x1c63('0x18')]);router[_0x1c63('0x19')](_0x1c63('0xf'),auth[_0x1c63('0xa')](),controller['destroy']);router['delete'](_0x1c63('0x11'),auth[_0x1c63('0xa')](),controller['removeAgents']);router['delete'](_0x1c63('0x1a'),auth['isAuthenticated'](),controller[_0x1c63('0x1b')]);module[_0x1c63('0x1c')]=router; \ No newline at end of file +var _0x9879=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','put','update','delete','destroy','removeAgents','multer','util','path','express'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x9879,0x98));var _0x9987=function(_0x537478,_0x267f1a){_0x537478=_0x537478-0x0;var _0x242b68=_0x9879[_0x537478];return _0x242b68;};'use strict';var multer=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var path=require(_0x9987('0x2'));var timeout=require('connect-timeout');var express=require(_0x9987('0x3'));var router=express['Router']();var fs_extra=require(_0x9987('0x4'));var auth=require(_0x9987('0x5'));var interaction=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var controller=require(_0x9987('0x8'));router[_0x9987('0x9')]('/',auth[_0x9987('0xa')](),controller['index']);router[_0x9987('0x9')]('/describe',auth[_0x9987('0xa')](),controller[_0x9987('0xb')]);router[_0x9987('0x9')](_0x9987('0xc'),auth[_0x9987('0xa')](),controller[_0x9987('0xd')]);router[_0x9987('0x9')](_0x9987('0xe'),auth[_0x9987('0xa')](),controller[_0x9987('0xf')]);router[_0x9987('0x9')](_0x9987('0x10'),auth[_0x9987('0xa')](),controller[_0x9987('0x11')]);router[_0x9987('0x12')]('/',auth[_0x9987('0xa')](),controller[_0x9987('0x13')]);router[_0x9987('0x12')]('/:id/users',auth[_0x9987('0xa')](),controller[_0x9987('0x14')]);router[_0x9987('0x12')](_0x9987('0x10'),auth[_0x9987('0xa')](),controller['addTeams']);router[_0x9987('0x15')]('/:id',auth[_0x9987('0xa')](),controller[_0x9987('0x16')]);router[_0x9987('0x17')](_0x9987('0xc'),auth[_0x9987('0xa')](),controller[_0x9987('0x18')]);router[_0x9987('0x17')](_0x9987('0xe'),auth[_0x9987('0xa')](),controller[_0x9987('0x19')]);router[_0x9987('0x17')](_0x9987('0x10'),auth[_0x9987('0xa')](),controller['removeTeams']);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 463cb3e..fbb26a9 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 _0x8622=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0xbe97ea,_0x1a2102){var _0x5ddc50=function(_0x3de1d9){while(--_0x3de1d9){_0xbe97ea['push'](_0xbe97ea['shift']());}};_0x5ddc50(++_0x1a2102);}(_0x8622,0x1a9));var _0x2862=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8622[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2862('0x0'));module[_0x2862('0x1')]={'name':{'type':Sequelize[_0x2862('0x2')],'allowNull':![],'unique':_0x2862('0x3')},'prefix':{'type':Sequelize[_0x2862('0x4')],'get':function(_0x522760){return _0x2862('0x5')+this[_0x2862('0x6')](_0x2862('0x3'))+'-';}},'description':{'type':Sequelize[_0x2862('0x2')]},'callerIdAll':{'type':Sequelize[_0x2862('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2862('0x7')]}}; \ No newline at end of file +var _0x8cdc=['exports','VIRTUAL','getDataValue','name','STRING','sequelize'];(function(_0x2f4097,_0x13202b){var _0x526386=function(_0x5674cc){while(--_0x5674cc){_0x2f4097['push'](_0x2f4097['shift']());}};_0x526386(++_0x13202b);}(_0x8cdc,0x1d3));var _0xc8cd=function(_0x2f6409,_0x5a614a){_0x2f6409=_0x2f6409-0x0;var _0x485530=_0x8cdc[_0x2f6409];return _0x485530;};'use strict';var Sequelize=require(_0xc8cd('0x0'));module[_0xc8cd('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xc8cd('0x2')],'get':function(_0x10cc95){return'system-'+this[_0xc8cd('0x3')](_0xc8cd('0x4'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xc8cd('0x5')]},'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 b87ff7f..15c18fe 100644 --- a/server/api/voicePrefix/voicePrefix.controller.js +++ b/server/api/voicePrefix/voicePrefix.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1c9a,0x98));var _0xa1c9=function(_0x276658,_0x3f5f6e){_0x276658=_0x276658-0x0;var _0x12bb75=_0x1c9a[_0x276658];return _0x12bb75;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file +var _0xfef3=['../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','VoicePrefixes','then','error','stack','name','index','map','VoicePrefix','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','No\x20callerid\x20available','charAt','system-','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','getTeams','hasOwnProperty','Team','Agents','online','interface','flatMap','each','TeamVoicePrefix','upsert','findOrCreate','forEach','select','field','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','value','isEmpty','eml-format','zip-dir','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x47d0fa,_0x1beca8){var _0x35ee23=function(_0x2cec1a){while(--_0x2cec1a){_0x47d0fa['push'](_0x47d0fa['shift']());}};_0x35ee23(++_0x1beca8);}(_0xfef3,0x118));var _0x3fef=function(_0x1c676d,_0x4a62ea){_0x1c676d=_0x1c676d-0x0;var _0x287e93=_0xfef3[_0x1c676d];return _0x287e93;};'use strict';var emlformat=require(_0x3fef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3fef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fef('0x2'));var moment=require(_0x3fef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x4'));var util=require(_0x3fef('0x5'));var path=require('path');var sox=require(_0x3fef('0x6'));var csv=require(_0x3fef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fef('0x8'));var _=require(_0x3fef('0x9'));var squel=require(_0x3fef('0xa'));var crypto=require(_0x3fef('0xb'));var jsforce=require(_0x3fef('0xc'));var deskjs=require(_0x3fef('0xd'));var toCsv=require(_0x3fef('0x7'));var querystring=require(_0x3fef('0xe'));var Papa=require(_0x3fef('0xf'));var Redis=require(_0x3fef('0x10'));var authService=require(_0x3fef('0x11'));var qs=require(_0x3fef('0x12'));var as=require(_0x3fef('0x13'));var hardwareService=require(_0x3fef('0x14'));var logger=require('../../config/logger')(_0x3fef('0x15'));var utils=require(_0x3fef('0x16'));var config=require(_0x3fef('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fef('0x18'))['db'];config['redis']=_[_0x3fef('0x19')](config[_0x3fef('0x1a')],{'host':_0x3fef('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3fef('0x1a')]));require('./voicePrefix.socket')[_0x3fef('0x1c')](socket);function respondWithStatusCode(_0x14c053,_0x56a65d){_0x56a65d=_0x56a65d||0xcc;return function(_0x2dec1b){if(_0x2dec1b){return _0x14c053[_0x3fef('0x1d')](_0x56a65d);}return _0x14c053[_0x3fef('0x1e')](_0x56a65d)[_0x3fef('0x1f')]();};}function respondWithResult(_0x395df0,_0x2af1ba){_0x2af1ba=_0x2af1ba||0xc8;return function(_0x5c899f){if(_0x5c899f){return _0x395df0[_0x3fef('0x1e')](_0x2af1ba)[_0x3fef('0x20')](_0x5c899f);}};}function respondWithFilteredResult(_0x1ec282,_0x3f2997){return function(_0x1613ad){if(_0x1613ad){var _0xaa0ae3=typeof _0x3f2997['offset']===_0x3fef('0x21')&&typeof _0x3f2997[_0x3fef('0x22')]==='undefined';var _0x2c7f36=_0x1613ad[_0x3fef('0x23')];var _0x42e095=_0xaa0ae3?0x0:_0x3f2997[_0x3fef('0x24')];var _0x245332=_0xaa0ae3?_0x1613ad[_0x3fef('0x23')]:_0x3f2997[_0x3fef('0x24')]+_0x3f2997[_0x3fef('0x22')];var _0x124e7c;if(_0x245332>=_0x2c7f36){_0x245332=_0x2c7f36;_0x124e7c=0xc8;}else{_0x124e7c=0xce;}_0x1ec282[_0x3fef('0x1e')](_0x124e7c);return _0x1ec282[_0x3fef('0x25')](_0x3fef('0x26'),_0x42e095+'-'+_0x245332+'/'+_0x2c7f36)[_0x3fef('0x20')](_0x1613ad);}return null;};}function patchUpdates(_0x39a8ea){return function(_0x433a3e){try{jsonpatch['apply'](_0x433a3e,_0x39a8ea,!![]);}catch(_0x5b56de){return BPromise['reject'](_0x5b56de);}return _0x433a3e[_0x3fef('0x27')]();};}function saveUpdates(_0x3ba38d,_0xa16dc){return function(_0x5f047c){if(_0x5f047c){return _0x5f047c[_0x3fef('0x28')](_0x3ba38d)['then'](function(_0x45464b){return _0x45464b;});}return null;};}function removeEntity(_0x2c0848,_0x64d3e6){return function(_0xf2b269){if(_0xf2b269){return _0xf2b269[_0x3fef('0x29')]()['then'](function(){var _0x4b4dee=_0xf2b269['get']({'plain':!![]});var _0x121ff0=_0x3fef('0x2a');return db['UserProfileResource'][_0x3fef('0x29')]({'where':{'type':_0x121ff0,'resourceId':_0x4b4dee['id']}})[_0x3fef('0x2b')](function(){return _0xf2b269;});})['then'](function(){_0x2c0848[_0x3fef('0x1e')](0xcc)[_0x3fef('0x1f')]();});}};}function handleEntityNotFound(_0xf892bb,_0x2b73fb){return function(_0x3a1a0a){if(!_0x3a1a0a){_0xf892bb[_0x3fef('0x1d')](0x194);}return _0x3a1a0a;};}function handleError(_0x20abb6,_0x4a632c){_0x4a632c=_0x4a632c||0x1f4;return function(_0x34576a){logger[_0x3fef('0x2c')](_0x34576a[_0x3fef('0x2d')]);if(_0x34576a[_0x3fef('0x2e')]){delete _0x34576a['name'];}_0x20abb6[_0x3fef('0x1e')](_0x4a632c)['send'](_0x34576a);};}exports[_0x3fef('0x2f')]=function(_0x3c4483,_0x16009a){var _0x1136b3={},_0x10b803={},_0x464763={'count':0x0,'rows':[]};var _0x355c03=_[_0x3fef('0x30')](db[_0x3fef('0x31')][_0x3fef('0x32')],function(_0x4f1061){return{'name':_0x4f1061['fieldName'],'type':_0x4f1061[_0x3fef('0x33')]['key']};});_0x10b803[_0x3fef('0x34')]=_[_0x3fef('0x30')](_0x355c03,_0x3fef('0x2e'));_0x10b803[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x3c4483[_0x3fef('0x35')]);_0x10b803[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],_0x10b803[_0x3fef('0x35')]);_0x1136b3[_0x3fef('0x39')]=_[_0x3fef('0x38')](_0x10b803[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x3c4483['query'][_0x3fef('0x3a')]));_0x1136b3[_0x3fef('0x39')]=_0x1136b3[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1136b3[_0x3fef('0x39')]:_0x10b803[_0x3fef('0x34')];if(!_0x3c4483['query']['hasOwnProperty'](_0x3fef('0x3c'))){_0x1136b3[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x22')]);_0x1136b3[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x3c4483[_0x3fef('0x35')][_0x3fef('0x24')]);}_0x1136b3[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x3c4483['query'][_0x3fef('0x3e')]);_0x1136b3[_0x3fef('0x3f')]=qs['filters'](_['pick'](_0x3c4483[_0x3fef('0x35')],_0x10b803[_0x3fef('0x37')]),_0x355c03);if(_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]){_0x1136b3[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1136b3[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x355c03,function(_0x577ab8){if(_0x577ab8[_0x3fef('0x33')]!==_0x3fef('0x42')){var _0x2859db={};_0x2859db[_0x577ab8[_0x3fef('0x2e')]]={'$like':'%'+_0x3c4483[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x2859db;}})});}_0x1136b3=_[_0x3fef('0x41')]({},_0x1136b3,_0x3c4483[_0x3fef('0x43')]);var _0x3df52b={'where':_0x1136b3[_0x3fef('0x3f')]};return db[_0x3fef('0x31')][_0x3fef('0x23')](_0x3df52b)[_0x3fef('0x2b')](function(_0x15d2c7){_0x464763[_0x3fef('0x23')]=_0x15d2c7;if(_0x3c4483['query'][_0x3fef('0x44')]){_0x1136b3[_0x3fef('0x45')]=[{'all':!![]}];}return db[_0x3fef('0x31')][_0x3fef('0x46')](_0x1136b3);})[_0x3fef('0x2b')](function(_0x33b145){_0x464763['rows']=_0x33b145;return _0x464763;})[_0x3fef('0x2b')](respondWithFilteredResult(_0x16009a,_0x1136b3))['catch'](handleError(_0x16009a,null));};exports[_0x3fef('0x47')]=function(_0x40a206,_0x59e3b0){var _0xa1a53d={'raw':![],'where':{'id':_0x40a206[_0x3fef('0x48')]['id']}},_0x4e662c={};_0x4e662c[_0x3fef('0x34')]=_[_0x3fef('0x36')](db[_0x3fef('0x31')][_0x3fef('0x32')]);_0x4e662c[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x40a206[_0x3fef('0x35')]);_0x4e662c[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x4e662c[_0x3fef('0x34')],_0x4e662c[_0x3fef('0x35')]);_0xa1a53d[_0x3fef('0x39')]=_['intersection'](_0x4e662c[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x40a206['query'][_0x3fef('0x3a')]));_0xa1a53d[_0x3fef('0x39')]=_0xa1a53d[_0x3fef('0x39')]['length']?_0xa1a53d[_0x3fef('0x39')]:_0x4e662c[_0x3fef('0x34')];if(_0x40a206['query'][_0x3fef('0x44')]){_0xa1a53d['include']=[{'all':!![]}];}_0xa1a53d=_['merge']({},_0xa1a53d,_0x40a206[_0x3fef('0x43')]);return db['VoicePrefix'][_0x3fef('0x49')](_0xa1a53d)[_0x3fef('0x2b')](handleEntityNotFound(_0x59e3b0,null))['then'](respondWithResult(_0x59e3b0,null))[_0x3fef('0x4a')](handleError(_0x59e3b0,null));};exports[_0x3fef('0x29')]=function(_0x2f8bb2,_0x5902b1){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x2f8bb2[_0x3fef('0x48')]['id']}})['then'](handleEntityNotFound(_0x5902b1,null))[_0x3fef('0x2b')](removeEntity(_0x5902b1,null))[_0x3fef('0x4a')](handleError(_0x5902b1,null));};exports[_0x3fef('0x4b')]=function(_0x6a5321,_0x3ae6a7){return db['VoicePrefix'][_0x3fef('0x4b')]()[_0x3fef('0x2b')](respondWithResult(_0x3ae6a7,null))[_0x3fef('0x4a')](handleError(_0x3ae6a7,null));};exports[_0x3fef('0x4c')]=function(_0x3dc5b5,_0x15be93){var _0x3f9d35;return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x4862a5){return db['VoicePrefix'][_0x3fef('0x4c')](_0x3dc5b5[_0x3fef('0x4f')],{'transaction':_0x4862a5})[_0x3fef('0x2b')](function(_0x29c619){_0x3f9d35=_0x29c619[_0x3fef('0x50')]({'plain':!![]});return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x3f9d35[_0x3fef('0x52')]},'raw':!![]})[_0x3fef('0x2b')](function(_0x36e054){return createVoicePrefixExtensions(_0x3f9d35,_0x36e054,_0x4862a5);});});})[_0x3fef('0x2b')](function(){var _0x109fac=_0x3dc5b5['user'][_0x3fef('0x50')]({'plain':!![]});if(!_0x109fac)throw new Error(_0x3fef('0x53'));if(_0x109fac[_0x3fef('0x54')]===_0x3fef('0x55')){var _0x5b0415=_0x3f9d35;return db[_0x3fef('0x56')][_0x3fef('0x49')]({'where':{'name':_0x3fef('0x2a'),'userProfileId':_0x109fac[_0x3fef('0x57')]},'raw':!![]})['then'](function(_0x189d48){if(_0x189d48&&_0x189d48[_0x3fef('0x58')]===0x0){return db[_0x3fef('0x59')]['create']({'name':_0x5b0415['name'],'resourceId':_0x5b0415['id'],'type':_0x189d48[_0x3fef('0x2e')],'sectionId':_0x189d48['id']},{})[_0x3fef('0x2b')](function(){return _0x3f9d35;});}else{return _0x3f9d35;}})[_0x3fef('0x4a')](function(_0x3370ef){logger['error'](_0x3fef('0x5a'),_0x3370ef);throw _0x3370ef;});}return _0x3f9d35;})['then'](respondWithResult(_0x15be93,null))[_0x3fef('0x4a')](handleError(_0x15be93,null));};function Extension(_0x48a329,_0x43b311,_0x4cc6de,_0x155fcb){this[_0x3fef('0x5b')]=_0x3fef('0x5c');this['exten']=_0x48a329;this['app']=_0x4cc6de;this[_0x3fef('0x33')]=_0x3fef('0x5d');this[_0x3fef('0x5e')]=_0x3fef('0x5f');this[_0x3fef('0x60')]=_0x43b311;this[_0x3fef('0x61')]=_0x155fcb;}function createVoicePrefixExtensions(_0x1095b6,_0x2b9a5e,_0x5493a8){return new BPromise(function(_0x12ffca,_0x4b6d74){var _0x5ec4e7=new Extension(formatPrefixName(_0x1095b6[_0x3fef('0x62')]),0x1,_0x3fef('0x63'),_0x3fef('0x64'));_0x5ec4e7[_0x3fef('0x65')]=_0x1095b6['id'];return db[_0x3fef('0x51')][_0x3fef('0x4c')](_0x5ec4e7,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x187c0f){var _0x62e2c4=_0x187c0f['get']({'plain':!![]});var _0x2d36fd=_['map'](addVoicePrefixExtensions(_0x1095b6,_0x2b9a5e),function(_0xc01327){_0xc01327[_0x3fef('0x52')]=_0x62e2c4['id'];_0xc01327[_0x3fef('0x65')]=_0x1095b6['id'];return _0xc01327;});return db[_0x3fef('0x51')][_0x3fef('0x66')](_0x2d36fd,{'transaction':_0x5493a8})[_0x3fef('0x2b')](function(_0x4a4631){if(!_0x4a4631){return _0x4b6d74(_0x3fef('0x67'));}else{return _0x12ffca(_0x4a4631);}})[_0x3fef('0x4a')](function(_0x3e98fb){return _0x4b6d74(_0x3e98fb);});});;});};function addVoicePrefixExtensions(_0x200d07,_0x6cc4a3){var _0x40bd7e=[];var _0x10b869=formatPrefixName(_0x200d07[_0x3fef('0x62')]);_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x2,_0x3fef('0x69'),_0x3fef('0x6a')+_0x200d07['name']));if(_0x200d07[_0x3fef('0x6b')]){_0x40bd7e['push'](new Extension(_0x10b869,0x3,'Set','PREFIX-CALLERIDALL='+_0x200d07[_0x3fef('0x6b')]));}else{_0x40bd7e['push'](new Extension(_0x10b869,0x3,_0x3fef('0x63'),_0x3fef('0x6c')));}_0x40bd7e[_0x3fef('0x68')](new Extension(_0x10b869,0x4,'goto',_0x6cc4a3[_0x3fef('0x5b')]+','+'${EXTEN:'+(0x8+_0x200d07[_0x3fef('0x2e')][_0x3fef('0x3b')])+'}'+','+0x1));return _0x40bd7e;}function formatPrefixName(_0x51ea04){var _0x1d0ae0='_';for(var _0x458583=0x0;_0x458583<_0x51ea04[_0x3fef('0x3b')];_0x458583++){if(_0x51ea04[_0x3fef('0x6d')](_0x458583)=='-'){_0x1d0ae0+=_0x51ea04[_0x3fef('0x6d')](_0x458583);}else{_0x1d0ae0+='['+_0x51ea04[_0x3fef('0x6d')](_0x458583)+']';}}_0x1d0ae0+='.';return _0x1d0ae0;}exports[_0x3fef('0x28')]=function(_0x1362ce,_0x4fde10,_0x25467e){var _0x410951=_0x1362ce[_0x3fef('0x4f')];_0x410951[_0x3fef('0x62')]=_0x3fef('0x6e')+_0x410951[_0x3fef('0x2e')]+'-';return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0xaff567){return db[_0x3fef('0x31')][_0x3fef('0x28')](_0x410951,{'where':{'id':_0x410951['id']},'transaction':_0xaff567})[_0x3fef('0x2b')](function(){return db[_0x3fef('0x51')][_0x3fef('0x29')]({'where':{'VoicePrefixId':_0x410951['id']},'transaction':_0xaff567})['then'](function(){return db[_0x3fef('0x51')][_0x3fef('0x49')]({'where':{'id':_0x410951[_0x3fef('0x52')]},'raw':!![]})['then'](function(_0x5e430a){return createVoicePrefixExtensions(_0x410951,_0x5e430a,_0xaff567);});});});})['then'](function(){return db[_0x3fef('0x31')][_0x3fef('0x6f')](_0x410951['id']);})[_0x3fef('0x2b')](respondWithResult(_0x4fde10,null))[_0x3fef('0x4a')](handleError(_0x4fde10,null));};exports['addAgents']=function(_0x441f1f,_0x17856b,_0x2f9b5f){return db[_0x3fef('0x31')]['find']({'where':{'id':_0x441f1f[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x17856b,null))[_0x3fef('0x2b')](function(_0xf80bab){if(_0xf80bab){return _0xf80bab[_0x3fef('0x70')](_0x441f1f['body'][_0x3fef('0x71')],_['omit'](_0x441f1f[_0x3fef('0x4f')],['ids','id'])||{})[_0x3fef('0x72')](function(_0x13b272){for(var _0x2948c4=0x0;_0x2948c4<_0x441f1f[_0x3fef('0x4f')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x2948c4+=0x1){socket[_0x3fef('0x73')](_0x3fef('0x74'),{'UserId':Number(_0x441f1f[_0x3fef('0x4f')]['ids'][_0x2948c4]),'VoicePrefixId':Number(_0x441f1f[_0x3fef('0x48')]['id'])});}return _0x13b272;});}})[_0x3fef('0x2b')](respondWithResult(_0x17856b,null))[_0x3fef('0x4a')](handleError(_0x17856b,null));};exports[_0x3fef('0x75')]=function(_0x4d8a00,_0x766e5d,_0x244d0b){return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x4d8a00[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x766e5d,null))['then'](function(_0x34aecb){if(_0x34aecb){return _0x34aecb[_0x3fef('0x75')](_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')])[_0x3fef('0x2b')](function(){if(_[_0x3fef('0x76')](_0x4d8a00['query'][_0x3fef('0x71')])){for(var _0x414bfe=0x0;_0x414bfe<_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x3fef('0x3b')];_0x414bfe+=0x1){socket['emit'](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')][_0x3fef('0x71')][_0x414bfe]),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}}else{socket[_0x3fef('0x73')](_0x3fef('0x77'),{'UserId':Number(_0x4d8a00[_0x3fef('0x35')]['ids']),'VoicePrefixId':Number(_0x4d8a00['params']['id'])});}});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x766e5d,null))[_0x3fef('0x4a')](handleError(_0x766e5d,null));};exports[_0x3fef('0x78')]=function(_0x25914c,_0x573323,_0x169b33){var _0x1361d2={};var _0x29b668={};var _0x5bf8b7;var _0x1cddf6;return db[_0x3fef('0x31')][_0x3fef('0x79')]({'where':{'id':_0x25914c[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x573323,null))[_0x3fef('0x2b')](function(_0x277f65){if(_0x277f65){_0x5bf8b7=_0x277f65;_0x29b668['model']=_['keys'](db[_0x3fef('0x7a')]['rawAttributes']);_0x29b668[_0x3fef('0x35')]=_[_0x3fef('0x36')](_0x25914c[_0x3fef('0x35')]);_0x29b668['filters']=_[_0x3fef('0x38')](_0x29b668['model'],_0x29b668[_0x3fef('0x35')]);_0x1361d2['attributes']=_['intersection'](_0x29b668['model'],qs[_0x3fef('0x3a')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x1361d2[_0x3fef('0x39')]=_0x1361d2[_0x3fef('0x39')][_0x3fef('0x3b')]?_0x1361d2[_0x3fef('0x39')]:_0x29b668['model'];_0x1361d2[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x25914c[_0x3fef('0x35')]['sort']);_0x1361d2[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x25914c[_0x3fef('0x35')],_0x29b668['filters']));if(_0x25914c[_0x3fef('0x35')]['filter']){_0x1361d2[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x1361d2[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x1361d2[_0x3fef('0x39')],function(_0x1804a5){var _0x3100c3={};_0x3100c3[_0x1804a5]={'$like':'%'+_0x25914c[_0x3fef('0x35')]['filter']+'%'};return _0x3100c3;})});}_0x1361d2=_[_0x3fef('0x41')]({},_0x1361d2,_0x25914c['options']);return _0x5bf8b7['getAgents'](_0x1361d2);}})[_0x3fef('0x2b')](function(_0x1b9cdc){if(_0x1b9cdc){_0x1cddf6=_0x1b9cdc[_0x3fef('0x3b')];if(!_0x25914c[_0x3fef('0x35')]['hasOwnProperty'](_0x3fef('0x3c'))){_0x1361d2[_0x3fef('0x22')]=qs[_0x3fef('0x22')](_0x25914c[_0x3fef('0x35')]['limit']);_0x1361d2[_0x3fef('0x24')]=qs[_0x3fef('0x24')](_0x25914c[_0x3fef('0x35')][_0x3fef('0x24')]);}return _0x5bf8b7[_0x3fef('0x78')](_0x1361d2);}})['then'](function(_0x27fd0b){if(_0x27fd0b){return _0x27fd0b?{'count':_0x1cddf6,'rows':_0x27fd0b}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x573323,null))[_0x3fef('0x4a')](handleError(_0x573323,null));};exports[_0x3fef('0x7c')]=function(_0x14e142,_0x5894f5,_0xe6a6b7){var _0x26b1c0={};var _0x2000b2={};var _0x44310b;var _0x400fff;return db['VoicePrefix'][_0x3fef('0x79')]({'where':{'id':_0x14e142[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](handleEntityNotFound(_0x5894f5,null))[_0x3fef('0x2b')](function(_0x1a5f47){if(_0x1a5f47){_0x44310b=_0x1a5f47;_0x2000b2[_0x3fef('0x34')]=_['keys'](db['Team']['rawAttributes']);_0x2000b2['query']=_['keys'](_0x14e142[_0x3fef('0x35')]);_0x2000b2[_0x3fef('0x37')]=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],_0x2000b2[_0x3fef('0x35')]);_0x26b1c0['attributes']=_[_0x3fef('0x38')](_0x2000b2[_0x3fef('0x34')],qs[_0x3fef('0x3a')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3a')]));_0x26b1c0[_0x3fef('0x39')]=_0x26b1c0[_0x3fef('0x39')]['length']?_0x26b1c0[_0x3fef('0x39')]:_0x2000b2['model'];_0x26b1c0[_0x3fef('0x3d')]=qs[_0x3fef('0x3e')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x3e')]);_0x26b1c0[_0x3fef('0x3f')]=qs[_0x3fef('0x37')](_[_0x3fef('0x7b')](_0x14e142['query'],_0x2000b2['filters']));if(_0x14e142['query']['filter']){_0x26b1c0[_0x3fef('0x3f')]=_[_0x3fef('0x41')](_0x26b1c0[_0x3fef('0x3f')],{'$or':_[_0x3fef('0x30')](_0x26b1c0[_0x3fef('0x39')],function(_0x580a23){var _0x8d6d0e={};_0x8d6d0e[_0x580a23]={'$like':'%'+_0x14e142[_0x3fef('0x35')][_0x3fef('0x40')]+'%'};return _0x8d6d0e;})});}_0x26b1c0=_['merge']({},_0x26b1c0,_0x14e142[_0x3fef('0x43')]);return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})['then'](function(_0x59654f){if(_0x59654f){_0x400fff=_0x59654f[_0x3fef('0x3b')];if(!_0x14e142['query'][_0x3fef('0x7d')](_0x3fef('0x3c'))){_0x26b1c0['limit']=qs[_0x3fef('0x22')](_0x14e142[_0x3fef('0x35')][_0x3fef('0x22')]);_0x26b1c0['offset']=qs[_0x3fef('0x24')](_0x14e142[_0x3fef('0x35')]['offset']);}return _0x44310b[_0x3fef('0x7c')](_0x26b1c0);}})[_0x3fef('0x2b')](function(_0xb08e2c){if(_0xb08e2c){return _0xb08e2c?{'count':_0x400fff,'rows':_0xb08e2c}:null;}})[_0x3fef('0x2b')](respondWithResult(_0x5894f5,null))['catch'](handleError(_0x5894f5,null));};exports['addTeams']=function(_0x91a872,_0x5ce3d8,_0x15cc4f){var _0x11a3d3=_0x91a872[_0x3fef('0x4f')][_0x3fef('0x71')];var _0x4e4a3c;return db[_0x3fef('0x7e')][_0x3fef('0x46')]({'where':{'id':_0x11a3d3},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id','name',_0x3fef('0x80'),'voicePause',_0x3fef('0x81')],'raw':!![]}]})[_0x3fef('0x2b')](function(_0x578303){if(_0x578303){_0x4e4a3c=_0x578303;var _0x4c575a=_[_0x3fef('0x82')](_0x578303,function(_0xee8848){var _0x5089f2=_0xee8848[_0x3fef('0x50')]({'plain':!![]});return _0x5089f2[_0x3fef('0x7f')];});return db['VoicePrefix']['find']({'where':{'id':_0x91a872[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x5e5b34){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x14c4bb){return _0x5e5b34['addTeams'](_0x11a3d3,{'transaction':_0x14c4bb})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4e4a3c,function(_0x349180){return db[_0x3fef('0x84')][_0x3fef('0x85')]({'TeamId':_0x349180['id'],'VoicePrefixId':_0x91a872['params']['id']},{'transaction':_0x14c4bb});});})[_0x3fef('0x2b')](function(){return BPromise[_0x3fef('0x83')](_0x4c575a,function(_0x45ab57){return db['UserVoicePrefix'][_0x3fef('0x86')]({'where':{'UserId':_0x45ab57['id'],'VoicePrefixId':_0x91a872['params']['id']},'transaction':_0x14c4bb});});})['then'](function(){_0x4c575a[_0x3fef('0x87')](function(_0x1d43ba){socket['emit'](_0x3fef('0x74'),{'UserId':_0x1d43ba['id'],'VoicePrefixId':_0x5e5b34['id']});});});});});}})[_0x3fef('0x2b')](respondWithStatusCode(_0x5ce3d8,null))['catch'](handleError(_0x5ce3d8,null));};exports['removeTeams']=function(_0x373a45,_0x1a792b,_0x34e182){return db['Team'][_0x3fef('0x46')]({'where':{'id':_0x373a45[_0x3fef('0x35')][_0x3fef('0x71')]},'attributes':['id'],'include':[{'model':db[_0x3fef('0x7a')],'as':_0x3fef('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x3fef('0x2b')](handleEntityNotFound(_0x1a792b,null))[_0x3fef('0x2b')](function(_0x114585){var _0x4725dd=_[_0x3fef('0x30')](_0x114585,'id');var _0x3b9285=[];var _0x550ba3=[];var _0x778837=squel[_0x3fef('0x88')]();_0x778837[_0x3fef('0x89')](_0x3fef('0x8a'))['from'](_0x3fef('0x8b'),'tq')[_0x3fef('0x8c')](_0x3fef('0x8d'),'ut',_0x3fef('0x8e'))['where']('VoicePrefixId\x20=\x20?',_0x373a45[_0x3fef('0x48')]['id']);for(var _0x9110ca=0x0;_0x9110ca<_0x114585[_0x3fef('0x3b')];_0x9110ca+=0x1){let _0x2bb28c=_0x114585[_0x9110ca];for(var _0x99fa04=0x0;_0x99fa04<_0x2bb28c['Agents'][_0x3fef('0x3b')];_0x99fa04+=0x1){let _0x2aa67e=_0x2bb28c['Agents'][_0x99fa04];var _0x541b46=_0x778837[_0x3fef('0x8f')]();_0x541b46[_0x3fef('0x3f')](_0x3fef('0x90'),_0x2aa67e['id']);_0x550ba3[_0x3fef('0x68')](db[_0x3fef('0x4d')][_0x3fef('0x35')](_0x541b46['toString'](),{'type':db['sequelize'][_0x3fef('0x91')]['SELECT']})[_0x3fef('0x2b')](function(_0x18afc9){if(_0x18afc9[_0x3fef('0x3b')]===0x1){return _0x2aa67e['id'];}else{var _0x5b6489=_[_0x3fef('0x92')](_[_0x3fef('0x30')](_0x18afc9,_0x3fef('0x93')),function(_0x259fc1){return _['includes'](_0x4725dd,_0x259fc1);});if(_0x5b6489){return _0x2aa67e['id'];}}}));}}return BPromise[_0x3fef('0x94')](_0x550ba3)[_0x3fef('0x2b')](function(_0x37b1a3){_0x3b9285=_(_0x3b9285)[_0x3fef('0x95')](_0x37b1a3)['compact']()[_0x3fef('0x96')]();return db[_0x3fef('0x31')][_0x3fef('0x49')]({'where':{'id':_0x373a45[_0x3fef('0x48')]['id']}})[_0x3fef('0x2b')](function(_0x446bab){return db[_0x3fef('0x4d')][_0x3fef('0x4e')](function(_0x2eddc5){return _0x446bab['removeTeams'](_0x373a45['query'][_0x3fef('0x71')],{'transaction':_0x2eddc5})[_0x3fef('0x2b')](function(){if(!_[_0x3fef('0x97')](_0x3b9285)){return _0x446bab[_0x3fef('0x75')](_0x3b9285,{'transaction':_0x2eddc5});}})['then'](function(){_0x3b9285[_0x3fef('0x87')](function(_0x2e642d){socket[_0x3fef('0x73')]('userVoicePrefix:remove',{'UserId':_0x2e642d,'VoicePrefixId':_0x446bab['id']});});});});});});})[_0x3fef('0x2b')](respondWithStatusCode(_0x1a792b,null))['catch'](handleError(_0x1a792b,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 02a7d02..44c43b1 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 _0xb68f=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x22e6b4,_0x174b0d){var _0x48aaa5=function(_0x284f3a){while(--_0x284f3a){_0x22e6b4['push'](_0x22e6b4['shift']());}};_0x48aaa5(++_0x174b0d);}(_0xb68f,0xb0));var _0xfb68=function(_0x1f29fa,_0x31ece8){_0x1f29fa=_0x1f29fa-0x0;var _0x3eb5dd=_0xb68f[_0x1f29fa];return _0x3eb5dd;};'use strict';var EventEmitter=require(_0xfb68('0x0'));var VoicePrefix=require(_0xfb68('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfb68('0x2')](0x0);var events={'afterCreate':_0xfb68('0x3'),'afterUpdate':_0xfb68('0x4'),'afterDestroy':_0xfb68('0x5')};function emitEvent(_0x4eb4ca){return function(_0x58d4cd,_0xe13d81,_0x1b6ca0){VoicePrefixEvents['emit'](_0x4eb4ca+':'+_0x58d4cd['id'],_0x58d4cd);VoicePrefixEvents[_0xfb68('0x6')](_0x4eb4ca,_0x58d4cd);_0x1b6ca0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xfb68('0x7')](e,emitEvent(event));}}module[_0xfb68('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x083c=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x083c,0x143));var _0xc083=function(_0x3a8697,_0x4e39e8){_0x3a8697=_0x3a8697-0x0;var _0xa4c873=_0x083c[_0x3a8697];return _0xa4c873;};'use strict';var EventEmitter=require(_0xc083('0x0'));var VoicePrefix=require(_0xc083('0x1'))['db'][_0xc083('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc083('0x3')](0x0);var events={'afterCreate':_0xc083('0x4'),'afterUpdate':_0xc083('0x5'),'afterDestroy':'remove'};function emitEvent(_0x380265){return function(_0x5e964d,_0x4a4148,_0xc6413){VoicePrefixEvents[_0xc083('0x6')](_0x380265+':'+_0x5e964d['id'],_0x5e964d);VoicePrefixEvents['emit'](_0x380265,_0x5e964d);_0xc6413(null);};}for(var e in events){if(events[_0xc083('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xc083('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 0694d24..18cb174 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 _0x8a35=['bluebird','request-promise','path','../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment'];(function(_0x11a694,_0x16854a){var _0x10b5b9=function(_0x224052){while(--_0x224052){_0x11a694['push'](_0x11a694['shift']());}};_0x10b5b9(++_0x16854a);}(_0x8a35,0x1e9));var _0x58a3=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8a35[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x58a3('0x0'));var util=require(_0x58a3('0x1'));var logger=require(_0x58a3('0x2'))(_0x58a3('0x3'));var moment=require(_0x58a3('0x4'));var BPromise=require(_0x58a3('0x5'));var rp=require(_0x58a3('0x6'));var fs=require('fs');var path=require(_0x58a3('0x7'));var rimraf=require('rimraf');var config=require(_0x58a3('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x58a3('0x9')]=function(_0x373ecb,_0x51cf38){return _0x373ecb[_0x58a3('0xa')](_0x58a3('0xb'),attributes,{'tableName':_0x58a3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0595=['exports','VoicePrefix','voice_prefixes','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes'];(function(_0x2a811d,_0x5245c0){var _0x20a32d=function(_0x2f54b8){while(--_0x2f54b8){_0x2a811d['push'](_0x2a811d['shift']());}};_0x20a32d(++_0x5245c0);}(_0x0595,0x12c));var _0x5059=function(_0x38f712,_0x2f1bf7){_0x38f712=_0x38f712-0x0;var _0x4766e1=_0x0595[_0x38f712];return _0x4766e1;};'use strict';var _=require(_0x5059('0x0'));var util=require(_0x5059('0x1'));var logger=require('../../config/logger')(_0x5059('0x2'));var moment=require('moment');var BPromise=require(_0x5059('0x3'));var rp=require(_0x5059('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5059('0x5'));var config=require(_0x5059('0x6'));var attributes=require(_0x5059('0x7'));module[_0x5059('0x8')]=function(_0x309688,_0x1c1025){return _0x309688['define'](_0x5059('0x9'),attributes,{'tableName':_0x5059('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 a0edf1f..bb1cc66 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 _0xe3da=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment'];(function(_0x1fbe59,_0x45dd45){var _0x315b32=function(_0x403fe){while(--_0x403fe){_0x1fbe59['push'](_0x1fbe59['shift']());}};_0x315b32(++_0x45dd45);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var moment=require(_0xae3d('0x2'));var BPromise=require(_0xae3d('0x3'));var rs=require(_0xae3d('0x4'));var fs=require('fs');var Redis=require(_0xae3d('0x5'));var db=require(_0xae3d('0x6'))['db'];var utils=require(_0xae3d('0x7'));var logger=require(_0xae3d('0x8'))(_0xae3d('0x9'));var config=require(_0xae3d('0xa'));var jayson=require(_0xae3d('0xb'));var client=jayson[_0xae3d('0xc')][_0xae3d('0xd')]({'port':0x232a});config[_0xae3d('0xe')]=_[_0xae3d('0xf')](config['redis'],{'host':_0xae3d('0x10'),'port':0x18eb});var socket=require(_0xae3d('0x11'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0xae3d('0x12')](socket);function respondWithRpcPromise(_0x157a3e,_0x420e28,_0x124833){return new BPromise(function(_0x2705b8,_0x15d6da){return client['request'](_0x157a3e,_0x124833)[_0xae3d('0x13')](function(_0x49fe58){logger[_0xae3d('0x14')](_0xae3d('0x15'),_0x420e28,_0xae3d('0x16'));logger[_0xae3d('0x17')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'),JSON[_0xae3d('0x18')](_0x49fe58));if(_0x49fe58[_0xae3d('0x19')]){if(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1a')]===0x1f4){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58['error'][_0xae3d('0x1b')]);return _0x15d6da(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x49fe58[_0xae3d('0x19')]['message']);return _0x2705b8(_0x49fe58[_0xae3d('0x19')][_0xae3d('0x1b')]);}else{logger[_0xae3d('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x420e28,_0xae3d('0x16'));_0x2705b8(_0x49fe58[_0xae3d('0x1c')]['message']);}})['catch'](function(_0x8a37cc){logger[_0xae3d('0x19')](_0xae3d('0x15'),_0x420e28,_0x8a37cc);_0x15d6da(_0x8a37cc);});});} \ No newline at end of file +var _0x9582=['redis','defaults','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x18c59d,_0x127a90){var _0x592891=function(_0x42d242){while(--_0x42d242){_0x18c59d['push'](_0x18c59d['shift']());}};_0x592891(++_0x127a90);}(_0x9582,0x95));var _0x2958=function(_0x1c7fce,_0x1a974c){_0x1c7fce=_0x1c7fce-0x0;var _0x35f3cf=_0x9582[_0x1c7fce];return _0x35f3cf;};'use strict';var _=require(_0x2958('0x0'));var util=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));var BPromise=require(_0x2958('0x3'));var rs=require(_0x2958('0x4'));var fs=require('fs');var Redis=require(_0x2958('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2958('0x6'));var logger=require(_0x2958('0x7'))(_0x2958('0x8'));var config=require(_0x2958('0x9'));var jayson=require(_0x2958('0xa'));var client=jayson[_0x2958('0xb')][_0x2958('0xc')]({'port':0x232a});config[_0x2958('0xd')]=_[_0x2958('0xe')](config[_0x2958('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2958('0xd')]));require('./voicePrefix.socket')[_0x2958('0xf')](socket);function respondWithRpcPromise(_0x51e460,_0x44cccc,_0x5ef23c){return new BPromise(function(_0x3aacfa,_0x29776c){return client[_0x2958('0x10')](_0x51e460,_0x5ef23c)[_0x2958('0x11')](function(_0x11ec8d){logger['info'](_0x2958('0x12'),_0x44cccc,_0x2958('0x13'));logger[_0x2958('0x14')](_0x2958('0x15'),_0x44cccc,_0x2958('0x13'),JSON[_0x2958('0x16')](_0x11ec8d));if(_0x11ec8d[_0x2958('0x17')]){if(_0x11ec8d[_0x2958('0x17')]['code']===0x1f4){logger[_0x2958('0x17')](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x29776c(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}logger['error'](_0x2958('0x12'),_0x44cccc,_0x11ec8d['error']['message']);return _0x3aacfa(_0x11ec8d[_0x2958('0x17')][_0x2958('0x18')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x44cccc,_0x2958('0x13'));_0x3aacfa(_0x11ec8d[_0x2958('0x19')][_0x2958('0x18')]);}})[_0x2958('0x1a')](function(_0x27599c){logger['error'](_0x2958('0x12'),_0x44cccc,_0x27599c);_0x29776c(_0x27599c);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f3c754c..159b892 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 _0x8efc=['emit','removeListener','register','length','save','remove','update'];(function(_0x25f3a7,_0x58ec8b){var _0x5a5d9b=function(_0x301d5f){while(--_0x301d5f){_0x25f3a7['push'](_0x25f3a7['shift']());}};_0x5a5d9b(++_0x58ec8b);}(_0x8efc,0xb3));var _0xc8ef=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x8efc[_0x24b477];return _0x4041a6;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc8ef('0x0'),_0xc8ef('0x1'),_0xc8ef('0x2')];function createListener(_0x1753d9,_0x517faf){return function(_0x2e2c8f){_0x517faf[_0xc8ef('0x3')](_0x1753d9,_0x2e2c8f);};}function removeListener(_0x33b9c9,_0x50d1f6){return function(){VoicePrefixEvents[_0xc8ef('0x4')](_0x33b9c9,_0x50d1f6);};}exports[_0xc8ef('0x5')]=function(_0x1cd466){for(var _0x13b433=0x0,_0x576ff9=events[_0xc8ef('0x6')];_0x13b433<_0x576ff9;_0x13b433++){var _0x3d06cd=events[_0x13b433];var _0x1c8931=createListener('voicePrefix:'+_0x3d06cd,_0x1cd466);VoicePrefixEvents['on'](_0x3d06cd,_0x1c8931);}}; \ No newline at end of file +var _0x7a72=['removeListener','voicePrefix:','save','remove'];(function(_0x351509,_0x54725c){var _0x4e9861=function(_0x54f92c){while(--_0x54f92c){_0x351509['push'](_0x351509['shift']());}};_0x4e9861(++_0x54725c);}(_0x7a72,0x1be));var _0x27a7=function(_0x5248db,_0x43f66b){_0x5248db=_0x5248db-0x0;var _0x520f73=_0x7a72[_0x5248db];return _0x520f73;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x27a7('0x0'),_0x27a7('0x1'),'update'];function createListener(_0x316bd3,_0x4b4ed5){return function(_0x15d71f){_0x4b4ed5['emit'](_0x316bd3,_0x15d71f);};}function removeListener(_0x30a1a8,_0x502521){return function(){VoicePrefixEvents[_0x27a7('0x2')](_0x30a1a8,_0x502521);};}exports['register']=function(_0x320fad){for(var _0x372bb8=0x0,_0x5d7305=events['length'];_0x372bb8<_0x5d7305;_0x372bb8++){var _0x1de957=events[_0x372bb8];var _0x54e6ee=createListener(_0x27a7('0x3')+_0x1de957,_0x320fad);VoicePrefixEvents['on'](_0x1de957,_0x54e6ee);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8d2b8c8..224bade 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(_0x24bfd6,_0x40e032){var _0x4f46c1=function(_0x374cd1){while(--_0x374cd1){_0x24bfd6['push'](_0x24bfd6['shift']());}};_0x4f46c1(++_0x40e032);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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(_0x364471,_0x302e8a){var _0x59236f=function(_0x524944){while(--_0x524944){_0x364471['push'](_0x364471['shift']());}};_0x59236f(++_0x302e8a);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a1d58,_0x42ab8d){_0x5a1d58=_0x5a1d58-0x0;var _0x5911a9=_0xb10b[_0x5a1d58];return _0x5911a9;};'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 dc9efec..21e632f 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 _0xcb74=['agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#RecallMe\x20Timeout\x20(min:1)','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','exports','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','booked','progressive','predictive','power','INTEGER','STRING','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT'];(function(_0x6fbb94,_0xc2bdee){var _0x16f0e8=function(_0x20b41c){while(--_0x20b41c){_0x6fbb94['push'](_0x6fbb94['shift']());}};_0x16f0e8(++_0xc2bdee);}(_0xcb74,0x127));var _0x4cb7=function(_0x514f7a,_0x3640f7){_0x514f7a=_0x514f7a-0x0;var _0x5f47b5=_0xcb74[_0x514f7a];return _0x5f47b5;};'use strict';var Sequelize=require('sequelize');module[_0x4cb7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4cb7('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x3'),_0x4cb7('0x4')),'allowNull':![],'defaultValue':_0x4cb7('0x3')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x4cb7('0x5')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x4cb7('0x2')]('rr',_0x4cb7('0x6'),_0x4cb7('0x7'),_0x4cb7('0x8'),_0x4cb7('0x9'),_0x4cb7('0xa'),_0x4cb7('0xb'),_0x4cb7('0xc'),_0x4cb7('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x2a548b){this[_0x4cb7('0xe')](_0x4cb7('0xf'),_0x2a548b?_0x2a548b:_0x4cb7('0xa'));},'get':function(){var _0x33218a=this[_0x4cb7('0x10')](_0x4cb7('0x11'));var _0x4a32b3=this[_0x4cb7('0x10')]('dialMethod');var _0x574ec8=this[_0x4cb7('0x10')]('strategy');if(_0x33218a===_0x4cb7('0x3')){return _0x574ec8;}if(_0x4a32b3===_0x4cb7('0x12')&&_0x574ec8===_0x4cb7('0xa')||_0x4a32b3===_0x4cb7('0x12')&&_0x574ec8==='roundrobin'){return _0x574ec8;}if(_0x4a32b3===_0x4cb7('0x13')||_0x4a32b3===_0x4cb7('0x14')||_0x4a32b3===_0x4cb7('0x15')){return _0x574ec8;}return null;}},'servicelevel':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4cb7('0x17')]},'weight':{'type':Sequelize[_0x4cb7('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4cb7('0x2')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no',_0x4cb7('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4cb7('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4cb7('0x2')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no',_0x4cb7('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no')},'announce_position_limit':{'type':Sequelize[_0x4cb7('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4cb7('0x17')]},'queue_youarenext':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4cb7('0x17')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4cb7('0x17')]},'queue_quantity1':{'type':Sequelize[_0x4cb7('0x17')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x4cb7('0x17')]},'queue_less_than':{'type':Sequelize[_0x4cb7('0x17')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x52976e){this['setDataValue'](_0x4cb7('0x1b'),_0x52976e?_0x52976e[_0x4cb7('0x1c')](','):[]);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1b'))?this[_0x4cb7('0x10')]('periodic_announce')[_0x4cb7('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'yes','set':function(_0x5af969){this[_0x4cb7('0xe')]('joinempty',_0x5af969?_0x5af969[_0x4cb7('0x1c')](','):undefined);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1e'))?this[_0x4cb7('0x10')](_0x4cb7('0x1e'))[_0x4cb7('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':'no','set':function(_0x68008b){this['setDataValue'](_0x4cb7('0x1f'),_0x68008b?_0x68008b[_0x4cb7('0x1c')](','):undefined);},'get':function(){return this[_0x4cb7('0x10')](_0x4cb7('0x1f'))?this['getDataValue'](_0x4cb7('0x1f'))[_0x4cb7('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4cb7('0x17')]},'description':{'type':Sequelize[_0x4cb7('0x17')]},'acw':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'set':function(_0x407567){this[_0x4cb7('0xe')](_0x4cb7('0x21'),_0x407567);if(_0x407567){if(this[_0x4cb7('0x10')](_0x4cb7('0x22'))<0x2){this[_0x4cb7('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x23'),_0x4cb7('0x13'),_0x4cb7('0x15'),_0x4cb7('0x14'),_0x4cb7('0x12')),'defaultValue':_0x4cb7('0x13'),'comment':_0x4cb7('0x24')},'dialLimitChannel':{'type':Sequelize[_0x4cb7('0x16')](0x4)[_0x4cb7('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4cb7('0x26')},'dialLimitQueue':{'type':Sequelize[_0x4cb7('0x16')](0x4)[_0x4cb7('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4cb7('0x27')},'dialPowerLevel':{'type':Sequelize[_0x4cb7('0x28')](0x2)[_0x4cb7('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x4cb7('0x29'),_0x4cb7('0x2a')),'defaultValue':'dropRate','comment':_0x4cb7('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4cb7('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4cb7('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4cb7('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4cb7('0x17')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4cb7('0x17')]},'dialOriginateTimeout':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':_0x4cb7('0x2f'),'comment':_0x4cb7('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x31')},'dialQueueProject':{'type':Sequelize[_0x4cb7('0x17')],'comment':_0x4cb7('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x35')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'comment':_0x4cb7('0x37')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x38')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4cb7('0x39')},'dialTimezone':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':_0x4cb7('0x3a')},'dialPrefix':{'type':Sequelize[_0x4cb7('0x17')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x3b'),_0x4cb7('0x3c'),'onlyIfOpen'),'defaultValue':_0x4cb7('0x3b')},'dialAMDActive':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':_0x4cb7('0x3d')},'dialAMDInitialSilence':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4cb7('0x3e')},'dialAMDGreeting':{'type':Sequelize[_0x4cb7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4cb7('0x3f')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4cb7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4cb7('0x40')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4cb7('0x41')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x4cb7('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4cb7('0x42')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4cb7('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4cb7('0x43')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4cb7('0x16')](0x9)[_0x4cb7('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4cb7('0x44')},'dialRecallInQueue':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4cb7('0x2')](_0x4cb7('0x45'),'ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x4cb7('0x17')],'comment':_0x4cb7('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4cb7('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x49')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x4e')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4cb7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4cb7('0x4f')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4cb7('0x16')](0x5)[_0x4cb7('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4cb7('0x50')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cb7('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':![],'comment':_0x4cb7('0x51'),'set':function(_0x44c85f){if(!_0x44c85f)this[_0x4cb7('0xe')](_0x4cb7('0x52'),null);this[_0x4cb7('0xe')](_0x4cb7('0x53'),_0x44c85f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4cb7('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4cb7('0x16')](0x3)[_0x4cb7('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa5b2=['#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','outbound','default','ENUM','leastrecent','fewestcalls','random','linear','rrordered','setDataValue','strategy','getDataValue','type','booked','rrmemory','progressive','predictive','power','INTEGER','yes','all','periodic_announce','split','joinempty','join','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','UNSIGNED','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x47bde6,_0x5840db){var _0x1c4dd5=function(_0x294445){while(--_0x294445){_0x47bde6['push'](_0x47bde6['shift']());}};_0x1c4dd5(++_0x5840db);}(_0xa5b2,0xec));var _0x2a5b=function(_0x5d31f3,_0x4239b0){_0x5d31f3=_0x5d31f3-0x0;var _0x1cc88c=_0xa5b2[_0x5d31f3];return _0x1cc88c;};'use strict';var Sequelize=require(_0x2a5b('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a5b('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x2a5b('0x2')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x2a5b('0x3')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x2a5b('0x4')]('rr','ringall',_0x2a5b('0x5'),_0x2a5b('0x6'),_0x2a5b('0x7'),'rrmemory',_0x2a5b('0x8'),'wrandom',_0x2a5b('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x3fbf0a){this[_0x2a5b('0xa')](_0x2a5b('0xb'),_0x3fbf0a?_0x3fbf0a:'rrmemory');},'get':function(){var _0x3cde64=this[_0x2a5b('0xc')](_0x2a5b('0xd'));var _0x37170f=this[_0x2a5b('0xc')]('dialMethod');var _0x1f6779=this[_0x2a5b('0xc')]('strategy');if(_0x3cde64==='inbound'){return _0x1f6779;}if(_0x37170f===_0x2a5b('0xe')&&_0x1f6779===_0x2a5b('0xf')||_0x37170f===_0x2a5b('0xe')&&_0x1f6779==='roundrobin'){return _0x1f6779;}if(_0x37170f===_0x2a5b('0x10')||_0x37170f===_0x2a5b('0x11')||_0x37170f===_0x2a5b('0x12')){return _0x1f6779;}return null;}},'servicelevel':{'type':Sequelize[_0x2a5b('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x2a5b('0x13')](0xb)},'timeout':{'type':Sequelize[_0x2a5b('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x2a5b('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x2a5b('0x1')]},'weight':{'type':Sequelize[_0x2a5b('0x13')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x2a5b('0x14'),'no'),'defaultValue':_0x2a5b('0x14')},'autopause':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x14'),'no',_0x2a5b('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x2a5b('0x13')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x2a5b('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x2a5b('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x2a5b('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x2a5b('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](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['ENUM'](_0x2a5b('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x2a5b('0x4')]('yes','no'),'defaultValue':_0x2a5b('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x2a5b('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0x2a5b('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x2a5b('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x2a5b('0x1')]},'queue_youarenext':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x2a5b('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x2a5b('0x1')]},'queue_quantity2':{'type':Sequelize[_0x2a5b('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x2a5b('0x1')]},'queue_less_than':{'type':Sequelize[_0x2a5b('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3ffa6e){this[_0x2a5b('0xa')](_0x2a5b('0x16'),_0x3ffa6e?_0x3ffa6e['join'](','):[]);},'get':function(){return this[_0x2a5b('0xc')](_0x2a5b('0x16'))?this[_0x2a5b('0xc')]('periodic_announce')[_0x2a5b('0x17')](','):[];}},'joinempty':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':'yes','set':function(_0x569329){this[_0x2a5b('0xa')](_0x2a5b('0x18'),_0x569329?_0x569329['join'](','):undefined);},'get':function(){return this[_0x2a5b('0xc')]('joinempty')?this[_0x2a5b('0xc')](_0x2a5b('0x18'))[_0x2a5b('0x17')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x117312){this[_0x2a5b('0xa')]('leavewhenempty',_0x117312?_0x117312[_0x2a5b('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x2a5b('0x1a'))?this['getDataValue'](_0x2a5b('0x1a'))[_0x2a5b('0x17')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x2a5b('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x2a5b('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x2a5b('0x1')]},'description':{'type':Sequelize[_0x2a5b('0x1')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x394210){this[_0x2a5b('0xa')]('acw',_0x394210);if(_0x394210){if(this[_0x2a5b('0xc')](_0x2a5b('0x1b'))<0x2){this[_0x2a5b('0xa')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x2a5b('0x1c')],'defaultValue':0x0,'comment':_0x2a5b('0x1d')},'dialMethod':{'type':Sequelize[_0x2a5b('0x4')]('preview',_0x2a5b('0x10'),_0x2a5b('0x12'),_0x2a5b('0x11'),_0x2a5b('0xe')),'defaultValue':_0x2a5b('0x10'),'comment':_0x2a5b('0x1e')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a5b('0x1f')},'dialLimitQueue':{'type':Sequelize[_0x2a5b('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x2a5b('0x20')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x2a5b('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x2a5b('0x4')]('agentBusyFactor',_0x2a5b('0x22')),'defaultValue':_0x2a5b('0x22'),'comment':_0x2a5b('0x23')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x2a5b('0x24')](0x2)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x2a5b('0x25')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x2a5b('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x2a5b('0x26')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2a5b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x2a5b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x27')},'dialQueueOptions':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':_0x2a5b('0x28'),'comment':_0x2a5b('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x2a')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x2a5b('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x2c')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x2d')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2a5b('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x2f')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2a5b('0x30')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':_0x2a5b('0x31')},'dialPrefix':{'type':Sequelize[_0x2a5b('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x32'),'never','onlyIfOpen'),'defaultValue':_0x2a5b('0x32')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2a5b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2a5b('0x33')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x2a5b('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a5b('0x34')},'dialAMDMinWordLength':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2a5b('0x35')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x2a5b('0x36')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2a5b('0x37')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2a5b('0x13')](0x9)[_0x2a5b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2a5b('0x38')},'dialRecallMeTimeout':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x2a5b('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x2a5b('0x1c')],'defaultValue':0x0,'comment':_0x2a5b('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2a5b('0x4')](_0x2a5b('0x3b'),_0x2a5b('0x3c')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x2a5b('0x2b')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x2a5b('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2a5b('0x3d')},'dialCutDigit':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x3e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x3f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x43')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)[_0x2a5b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2a5b('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2a5b('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2a5b('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2a5b('0x13')],'allowNull':!![],'comment':_0x2a5b('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x2a5b('0x1c')],'defaultValue':![],'comment':_0x2a5b('0x48'),'set':function(_0x44b1ae){if(!_0x44b1ae)this[_0x2a5b('0xa')](_0x2a5b('0x49'),null);this['setDataValue'](_0x2a5b('0x4a'),_0x44b1ae);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x2a5b('0x13')](0x3)[_0x2a5b('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x2a5b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x2a5b('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 481a9c4..a10cd13 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 _0x4af9=['body','user','get','role','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','penalty','Agents','sequelize','transaction','each','upsert','isNil','format','forEach','emit','userVoiceQueue:save','ids','select','field','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','spread','push','userVoiceQueue:remove','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','into','cm_hopper','phone','scheduledAt','ListId','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','phone\x20NOT\x20IN\x20(?)','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','removeBlackLists','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','findAll','rows','params','include','catch','create'];(function(_0x55b65f,_0x44fa1a){var _0xe652a6=function(_0x1f6ba2){while(--_0x1f6ba2){_0x55b65f['push'](_0x55b65f['shift']());}};_0xe652a6(++_0x44fa1a);}(_0x4af9,0x12c));var _0x94af=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4af9[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x94af('0x0'));var rimraf=require(_0x94af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x94af('0x2'));var moment=require(_0x94af('0x3'));var BPromise=require(_0x94af('0x4'));var Mustache=require(_0x94af('0x5'));var util=require(_0x94af('0x6'));var path=require(_0x94af('0x7'));var sox=require(_0x94af('0x8'));var csv=require('to-csv');var ejs=require(_0x94af('0x9'));var fs=require('fs');var fs_extra=require(_0x94af('0xa'));var _=require(_0x94af('0xb'));var squel=require(_0x94af('0xc'));var crypto=require('crypto');var jsforce=require(_0x94af('0xd'));var deskjs=require(_0x94af('0xe'));var toCsv=require(_0x94af('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x94af('0x10'));var authService=require(_0x94af('0x11'));var qs=require(_0x94af('0x12'));var as=require(_0x94af('0x13'));var hardwareService=require(_0x94af('0x14'));var logger=require(_0x94af('0x15'))('api');var utils=require(_0x94af('0x16'));var config=require(_0x94af('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x94af('0x18'))['db'];config[_0x94af('0x19')]=_[_0x94af('0x1a')](config[_0x94af('0x19')],{'host':_0x94af('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x94af('0x19')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x4d080c,_0xa68306){_0xa68306=_0xa68306||0xcc;return function(_0x3300a3){if(_0x3300a3){return _0x4d080c[_0x94af('0x1c')](_0xa68306);}return _0x4d080c[_0x94af('0x1d')](_0xa68306)['end']();};}function respondWithResult(_0x275c63,_0x204ad7){_0x204ad7=_0x204ad7||0xc8;return function(_0x539f74){if(_0x539f74){return _0x275c63[_0x94af('0x1d')](_0x204ad7)[_0x94af('0x1e')](_0x539f74);}};}function respondWithFilteredResult(_0x11ee85,_0x32b1d4){return function(_0x414bc9){if(_0x414bc9){var _0x3d3611=typeof _0x32b1d4[_0x94af('0x1f')]===_0x94af('0x20')&&typeof _0x32b1d4[_0x94af('0x21')]===_0x94af('0x20');var _0x4a9d75=_0x414bc9['count'];var _0x4349db=_0x3d3611?0x0:_0x32b1d4[_0x94af('0x1f')];var _0xee81a=_0x3d3611?_0x414bc9[_0x94af('0x22')]:_0x32b1d4[_0x94af('0x1f')]+_0x32b1d4[_0x94af('0x21')];var _0x4adbea;if(_0xee81a>=_0x4a9d75){_0xee81a=_0x4a9d75;_0x4adbea=0xc8;}else{_0x4adbea=0xce;}_0x11ee85[_0x94af('0x1d')](_0x4adbea);return _0x11ee85['set'](_0x94af('0x23'),_0x4349db+'-'+_0xee81a+'/'+_0x4a9d75)['json'](_0x414bc9);}return null;};}function patchUpdates(_0xa0cf1a){return function(_0x3445cd){try{jsonpatch[_0x94af('0x24')](_0x3445cd,_0xa0cf1a,!![]);}catch(_0x521828){return BPromise[_0x94af('0x25')](_0x521828);}return _0x3445cd[_0x94af('0x26')]();};}function saveUpdates(_0x906599,_0x270f9a){return function(_0x587b74){if(_0x587b74){return _0x587b74[_0x94af('0x27')](_0x906599)[_0x94af('0x28')](function(_0x24e8a0){return _0x24e8a0;});}return null;};}function removeEntity(_0x3b6152,_0x202e5c){return function(_0x4334c2){if(_0x4334c2){return _0x4334c2[_0x94af('0x29')]()[_0x94af('0x28')](function(){var _0x131a93=_0x4334c2['get']({'plain':!![]});var _0x1ac64d=[{'name':'VoiceQueues','value':_0x94af('0x2a'),'ignore':![]},{'name':_0x94af('0x2b'),'value':_0x94af('0x2c'),'ignore':![]}];var _0x4898ac=_(_0x1ac64d)[_0x94af('0x2d')](_0x94af('0x2e'))['map'](_0x94af('0x2f'))[_0x94af('0x2f')]();if(_[_0x94af('0x30')](_0x4898ac,_0x131a93[_0x94af('0x31')])){return;}var _0x1700f6=_[_0x94af('0x32')](_0x1ac64d,['value',_0x131a93[_0x94af('0x31')]])['name'];return db['UserProfileResource'][_0x94af('0x29')]({'where':{'type':_0x1700f6,'resourceId':_0x131a93['id']}})[_0x94af('0x28')](function(){return _0x4334c2;});})[_0x94af('0x28')](function(){_0x3b6152[_0x94af('0x1d')](0xcc)[_0x94af('0x33')]();});}};}function handleEntityNotFound(_0x503d6b,_0x203b86){return function(_0x951441){if(!_0x951441){_0x503d6b['sendStatus'](0x194);}return _0x951441;};}function handleError(_0x42f0f2,_0x2f02cf){_0x2f02cf=_0x2f02cf||0x1f4;return function(_0x177bd2){logger[_0x94af('0x34')](_0x177bd2[_0x94af('0x35')]);if(_0x177bd2[_0x94af('0x36')]){delete _0x177bd2[_0x94af('0x36')];}_0x42f0f2['status'](_0x2f02cf)[_0x94af('0x37')](_0x177bd2);};}exports[_0x94af('0x38')]=function(_0x8fd6ba,_0x3e0a9a){var _0x26b846={},_0x3bced0={},_0x9b90fb={'count':0x0,'rows':[]};var _0xbd51ac=_[_0x94af('0x39')](db['VoiceQueue'][_0x94af('0x3a')],function(_0x950c6c){return{'name':_0x950c6c[_0x94af('0x3b')],'type':_0x950c6c[_0x94af('0x31')][_0x94af('0x3c')]};});_0x3bced0['model']=_[_0x94af('0x39')](_0xbd51ac,_0x94af('0x36'));_0x3bced0[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x8fd6ba['query']);_0x3bced0[_0x94af('0x3f')]=_['intersection'](_0x3bced0['model'],_0x3bced0['query']);_0x26b846[_0x94af('0x40')]=_[_0x94af('0x41')](_0x3bced0['model'],qs[_0x94af('0x42')](_0x8fd6ba['query'][_0x94af('0x42')]));_0x26b846['attributes']=_0x26b846[_0x94af('0x40')][_0x94af('0x43')]?_0x26b846[_0x94af('0x40')]:_0x3bced0[_0x94af('0x44')];if(!_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x26b846[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x21')]);_0x26b846['offset']=qs[_0x94af('0x1f')](_0x8fd6ba[_0x94af('0x3d')]['offset']);}_0x26b846[_0x94af('0x47')]=qs['sort'](_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x48')]);_0x26b846[_0x94af('0x49')]=qs['filters'](_[_0x94af('0x4a')](_0x8fd6ba['query'],_0x3bced0[_0x94af('0x3f')]),_0xbd51ac);if(_0x8fd6ba[_0x94af('0x3d')]['filter']){_0x26b846[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x26b846[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0xbd51ac,function(_0xc4414a){if(_0xc4414a[_0x94af('0x31')]!==_0x94af('0x4c')){var _0x35cdaa={};_0x35cdaa[_0xc4414a['name']]={'$like':'%'+_0x8fd6ba[_0x94af('0x3d')]['filter']+'%'};return _0x35cdaa;}})});}_0x26b846=_[_0x94af('0x4b')]({},_0x26b846,_0x8fd6ba[_0x94af('0x4d')]);var _0xaf0610={'where':_0x26b846[_0x94af('0x49')]};return db[_0x94af('0x4e')][_0x94af('0x22')](_0xaf0610)['then'](function(_0xab4ac5){_0x9b90fb[_0x94af('0x22')]=_0xab4ac5;if(_0x8fd6ba[_0x94af('0x3d')][_0x94af('0x4f')]){_0x26b846['include']=[{'all':!![]}];}return db[_0x94af('0x4e')][_0x94af('0x50')](_0x26b846);})[_0x94af('0x28')](function(_0x29bb6c){_0x9b90fb[_0x94af('0x51')]=_0x29bb6c;return _0x9b90fb;})[_0x94af('0x28')](respondWithFilteredResult(_0x3e0a9a,_0x26b846))['catch'](handleError(_0x3e0a9a,null));};exports['show']=function(_0x3c11a5,_0x343483){var _0x3b66d8={'raw':![],'where':{'id':_0x3c11a5[_0x94af('0x52')]['id']}},_0xbfcb8b={};_0xbfcb8b[_0x94af('0x44')]=_['keys'](db[_0x94af('0x4e')][_0x94af('0x3a')]);_0xbfcb8b[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x3c11a5[_0x94af('0x3d')]);_0xbfcb8b[_0x94af('0x3f')]=_[_0x94af('0x41')](_0xbfcb8b['model'],_0xbfcb8b[_0x94af('0x3d')]);_0x3b66d8['attributes']=_[_0x94af('0x41')](_0xbfcb8b[_0x94af('0x44')],qs[_0x94af('0x42')](_0x3c11a5[_0x94af('0x3d')][_0x94af('0x42')]));_0x3b66d8[_0x94af('0x40')]=_0x3b66d8[_0x94af('0x40')][_0x94af('0x43')]?_0x3b66d8[_0x94af('0x40')]:_0xbfcb8b[_0x94af('0x44')];if(_0x3c11a5[_0x94af('0x3d')][_0x94af('0x4f')]){_0x3b66d8[_0x94af('0x53')]=[{'all':!![]}];}_0x3b66d8=_['merge']({},_0x3b66d8,_0x3c11a5[_0x94af('0x4d')]);return db[_0x94af('0x4e')][_0x94af('0x32')](_0x3b66d8)[_0x94af('0x28')](handleEntityNotFound(_0x343483,null))[_0x94af('0x28')](respondWithResult(_0x343483,null))[_0x94af('0x54')](handleError(_0x343483,null));};exports[_0x94af('0x55')]=function(_0x50c7fb,_0x36cb23){return db[_0x94af('0x4e')][_0x94af('0x55')](_0x50c7fb[_0x94af('0x56')],{})['then'](function(_0x2b632a){var _0x5a815e=_0x50c7fb[_0x94af('0x57')][_0x94af('0x58')]({'plain':!![]});if(!_0x5a815e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a815e[_0x94af('0x59')]==='user'){var _0x49b087=_0x2b632a['get']({'plain':!![]});var _0x3ba3a7=[{'name':_0x94af('0x5a'),'value':_0x94af('0x2a')},{'name':_0x94af('0x2b'),'value':'outbound'}];var _0x289b2a=_[_0x94af('0x32')](_0x3ba3a7,[_0x94af('0x2f'),_0x49b087[_0x94af('0x31')]])[_0x94af('0x36')];return db[_0x94af('0x5b')][_0x94af('0x32')]({'where':{'name':_0x289b2a,'userProfileId':_0x5a815e[_0x94af('0x5c')]},'raw':!![]})[_0x94af('0x28')](function(_0x12811f){if(_0x12811f&&_0x12811f[_0x94af('0x5d')]===0x0){return db[_0x94af('0x5e')]['create']({'name':_0x49b087[_0x94af('0x36')],'resourceId':_0x49b087['id'],'type':_0x12811f[_0x94af('0x36')],'sectionId':_0x12811f['id']},{})[_0x94af('0x28')](function(){return _0x2b632a;});}else{return _0x2b632a;}})[_0x94af('0x54')](function(_0x59693d){logger[_0x94af('0x34')](_0x94af('0x5f'),_0x59693d);throw _0x59693d;});}return _0x2b632a;})[_0x94af('0x28')](respondWithResult(_0x36cb23,0xc9))[_0x94af('0x54')](handleError(_0x36cb23,null));};exports[_0x94af('0x60')]=function(_0x5dc314,_0xfe0ba3){var _0x21451f={'where':{'id':_0x5dc314[_0x94af('0x52')]['id']}},_0x5ef898={};_0x5ef898[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x4e')][_0x94af('0x3a')]);_0x21451f[_0x94af('0x40')]=_[_0x94af('0x41')](_0x5ef898[_0x94af('0x44')],qs[_0x94af('0x42')](_0x5dc314['query'][_0x94af('0x42')]));_0x21451f['attributes']=_0x21451f[_0x94af('0x40')]['length']?_0x21451f[_0x94af('0x40')]:_0x5ef898[_0x94af('0x44')];if(_0x5dc314[_0x94af('0x3d')][_0x94af('0x4f')]){_0x21451f[_0x94af('0x53')]=[{'all':!![]}];}_0x21451f=_['merge']({},_0x21451f,_0x5dc314[_0x94af('0x4d')]);return db['VoiceQueue'][_0x94af('0x32')](_0x21451f)[_0x94af('0x28')](handleEntityNotFound(_0xfe0ba3,null))[_0x94af('0x28')](function(_0x10ff3d){if(_0x10ff3d){var _0x23b919=_0x10ff3d[_0x94af('0x58')]({'plain':!![]});_0x23b919=qs[_0x94af('0x61')](_0x23b919,['id',_0x94af('0x62'),'updatedAt']);_0x5dc314[_0x94af('0x56')]=_['omit'](_0x5dc314[_0x94af('0x56')],['id','createdAt',_0x94af('0x63')]);return db[_0x94af('0x4e')][_0x94af('0x55')](_[_0x94af('0x4b')](_0x23b919,_0x5dc314[_0x94af('0x56')]),{'include':_0x5dc314[_0x94af('0x3d')][_0x94af('0x4f')]?[{'all':!![]}]:undefined})[_0x94af('0x28')](function(_0x14e844){var _0x6fb055=_0x5dc314[_0x94af('0x57')][_0x94af('0x58')]({'plain':!![]});if(!_0x6fb055)throw new Error(_0x94af('0x64'));if(_0x6fb055[_0x94af('0x59')]===_0x94af('0x57')){var _0x581670=_0x14e844['get']({'plain':!![]});var _0x4b36a6=[{'name':_0x94af('0x5a'),'value':_0x94af('0x2a')},{'name':_0x94af('0x2b'),'value':'outbound'}];var _0x3a5928=_[_0x94af('0x32')](_0x4b36a6,[_0x94af('0x2f'),_0x581670[_0x94af('0x31')]])[_0x94af('0x36')];return db['UserProfileSection']['find']({'where':{'name':_0x3a5928,'userProfileId':_0x6fb055[_0x94af('0x5c')]},'raw':!![]})[_0x94af('0x28')](function(_0x2d7419){if(_0x2d7419&&_0x2d7419[_0x94af('0x5d')]===0x0){return db[_0x94af('0x5e')][_0x94af('0x55')]({'name':_0x581670[_0x94af('0x36')],'resourceId':_0x581670['id'],'type':_0x2d7419[_0x94af('0x36')],'sectionId':_0x2d7419['id']},{})[_0x94af('0x28')](function(){return _0x14e844;});}else{return _0x14e844;}})[_0x94af('0x54')](function(_0x19a2f0){logger['error'](_0x94af('0x5f'),_0x19a2f0);throw _0x19a2f0;});}return _0x14e844;});}})[_0x94af('0x28')](respondWithResult(_0xfe0ba3,0xc9))[_0x94af('0x54')](handleError(_0xfe0ba3,null));};exports[_0x94af('0x27')]=function(_0x3f57d0,_0x483970){if(_0x3f57d0[_0x94af('0x56')]['id']){delete _0x3f57d0['body']['id'];}return db[_0x94af('0x4e')]['find']({'where':{'id':_0x3f57d0[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x483970,null))[_0x94af('0x28')](saveUpdates(_0x3f57d0[_0x94af('0x56')],null))[_0x94af('0x28')](respondWithResult(_0x483970,null))['catch'](handleError(_0x483970,null));};exports[_0x94af('0x29')]=function(_0xd3d368,_0x33bb76){return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0xd3d368['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x33bb76,null))[_0x94af('0x28')](removeEntity(_0x33bb76,null))[_0x94af('0x54')](handleError(_0x33bb76,null));};exports['getHoppers']=function(_0x182a8f,_0x6e481b,_0x5a6b89){var _0x5c4121={'raw':![],'where':{}};var _0x34a045={};var _0x5a3b10={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x94af('0x65')]({'where':{'id':_0x182a8f[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x6e481b,null))[_0x94af('0x28')](function(_0x2a1b78){if(_0x2a1b78){_0x34a045[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x66')][_0x94af('0x3a')]);_0x34a045[_0x94af('0x3d')]=_['keys'](_0x182a8f[_0x94af('0x3d')]);_0x34a045[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x34a045['model'],_0x34a045[_0x94af('0x3d')]);_0x5c4121['attributes']=_['intersection'](_0x34a045[_0x94af('0x44')],qs[_0x94af('0x42')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x42')]));_0x5c4121[_0x94af('0x40')]=_0x5c4121['attributes'][_0x94af('0x43')]?_0x5c4121[_0x94af('0x40')]:_0x34a045[_0x94af('0x44')];if(!_0x182a8f['query']['hasOwnProperty'](_0x94af('0x46'))){_0x5c4121['limit']=qs[_0x94af('0x21')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x21')]);_0x5c4121['offset']=qs[_0x94af('0x1f')](_0x182a8f['query'][_0x94af('0x1f')]);}_0x5c4121[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x182a8f[_0x94af('0x3d')][_0x94af('0x48')]);_0x5c4121['where']=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x182a8f[_0x94af('0x3d')],_0x34a045['filters']));_0x5c4121['where']['VoiceQueueId']=_0x2a1b78['id'];if(_0x182a8f[_0x94af('0x3d')][_0x94af('0x2d')]){_0x5c4121[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x5c4121['where'],{'$or':_[_0x94af('0x39')](_0x5c4121[_0x94af('0x40')],function(_0x54fc21){var _0x366f59={};_0x366f59[_0x54fc21]={'$like':'%'+_0x182a8f[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x366f59;})});}_0x5c4121=_['merge']({},_0x5c4121,_0x182a8f['options']);return db[_0x94af('0x66')][_0x94af('0x22')]({'where':_0x5c4121['where']})['then'](function(_0x4d27d9){_0x5a3b10[_0x94af('0x22')]=_0x4d27d9;if(_0x182a8f[_0x94af('0x3d')][_0x94af('0x4f')]){_0x5c4121[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x66')][_0x94af('0x50')](_0x5c4121);})[_0x94af('0x28')](function(_0x5639a7){_0x5a3b10[_0x94af('0x51')]=_0x5639a7;return _0x5a3b10;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x6e481b,_0x5c4121))[_0x94af('0x54')](handleError(_0x6e481b,null));};exports[_0x94af('0x67')]=function(_0xe801b0,_0x337b44,_0x291cc6){var _0x2932b6={'raw':!![],'where':{}};var _0x2967b2={};var _0x36a4e8={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0xe801b0['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x337b44,null))[_0x94af('0x28')](function(_0xbfde8a){if(_0xbfde8a){_0x2967b2[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x68')][_0x94af('0x3a')]);_0x2967b2[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0xe801b0[_0x94af('0x3d')]);_0x2967b2[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x2967b2[_0x94af('0x44')],_0x2967b2[_0x94af('0x3d')]);_0x2932b6['attributes']=_[_0x94af('0x41')](_0x2967b2[_0x94af('0x44')],qs[_0x94af('0x42')](_0xe801b0[_0x94af('0x3d')][_0x94af('0x42')]));_0x2932b6[_0x94af('0x40')]=_0x2932b6[_0x94af('0x40')][_0x94af('0x43')]?_0x2932b6[_0x94af('0x40')]:_0x2967b2[_0x94af('0x44')];if(!_0xe801b0[_0x94af('0x3d')]['hasOwnProperty'](_0x94af('0x46'))){_0x2932b6[_0x94af('0x21')]=qs[_0x94af('0x21')](_0xe801b0['query'][_0x94af('0x21')]);_0x2932b6[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0xe801b0[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x2932b6['order']=qs['sort'](_0xe801b0[_0x94af('0x3d')][_0x94af('0x48')]);_0x2932b6[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0xe801b0[_0x94af('0x3d')],_0x2967b2[_0x94af('0x3f')]));_0x2932b6[_0x94af('0x49')][_0x94af('0x69')]=_0xbfde8a['id'];if(_0xe801b0[_0x94af('0x3d')][_0x94af('0x2d')]){_0x2932b6['where']=_[_0x94af('0x4b')](_0x2932b6[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x2932b6[_0x94af('0x40')],function(_0x118be3){var _0x295950={};_0x295950[_0x118be3]={'$like':'%'+_0xe801b0['query'][_0x94af('0x2d')]+'%'};return _0x295950;})});}_0x2932b6=_[_0x94af('0x4b')]({},_0x2932b6,_0xe801b0['options']);return db[_0x94af('0x68')]['count']({'where':_0x2932b6[_0x94af('0x49')]})[_0x94af('0x28')](function(_0x4e24b3){_0x36a4e8['count']=_0x4e24b3;if(_0xe801b0['query'][_0x94af('0x4f')]){_0x2932b6['include']=[{'all':!![]}];}return db[_0x94af('0x68')]['findAll'](_0x2932b6);})['then'](function(_0x9e6c7d){_0x36a4e8['rows']=_0x9e6c7d;return _0x36a4e8;});}})['then'](respondWithFilteredResult(_0x337b44,_0x2932b6))[_0x94af('0x54')](handleError(_0x337b44,null));};exports[_0x94af('0x6a')]=function(_0x2e1788,_0x19dc9a,_0x2c5357){var _0x3968b3={'raw':!![],'where':{}};var _0x3b0d8f={};var _0x50a97c={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x2e1788[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x19dc9a,null))['then'](function(_0x24b7fa){if(_0x24b7fa){_0x3b0d8f[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x6b')]['rawAttributes']);_0x3b0d8f[_0x94af('0x3d')]=_['keys'](_0x2e1788['query']);_0x3b0d8f[_0x94af('0x3f')]=_['intersection'](_0x3b0d8f[_0x94af('0x44')],_0x3b0d8f[_0x94af('0x3d')]);_0x3968b3[_0x94af('0x40')]=_[_0x94af('0x41')](_0x3b0d8f['model'],qs[_0x94af('0x42')](_0x2e1788['query'][_0x94af('0x42')]));_0x3968b3[_0x94af('0x40')]=_0x3968b3[_0x94af('0x40')]['length']?_0x3968b3[_0x94af('0x40')]:_0x3b0d8f[_0x94af('0x44')];if(!_0x2e1788['query'][_0x94af('0x45')]('nolimit')){_0x3968b3[_0x94af('0x21')]=qs['limit'](_0x2e1788[_0x94af('0x3d')]['limit']);_0x3968b3[_0x94af('0x1f')]=qs['offset'](_0x2e1788[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x3968b3[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x2e1788[_0x94af('0x3d')][_0x94af('0x48')]);_0x3968b3['where']=qs['filters'](_[_0x94af('0x4a')](_0x2e1788[_0x94af('0x3d')],_0x3b0d8f[_0x94af('0x3f')]));_0x3968b3[_0x94af('0x49')][_0x94af('0x69')]=_0x24b7fa['id'];if(_0x2e1788['query'][_0x94af('0x2d')]){_0x3968b3[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x3968b3[_0x94af('0x49')],{'$or':_['map'](_0x3968b3[_0x94af('0x40')],function(_0x575188){var _0x113657={};_0x113657[_0x575188]={'$like':'%'+_0x2e1788['query'][_0x94af('0x2d')]+'%'};return _0x113657;})});}_0x3968b3=_[_0x94af('0x4b')]({},_0x3968b3,_0x2e1788[_0x94af('0x4d')]);return db[_0x94af('0x6b')][_0x94af('0x22')]({'where':_0x3968b3[_0x94af('0x49')]})['then'](function(_0x3f9cd0){_0x50a97c[_0x94af('0x22')]=_0x3f9cd0;if(_0x2e1788['query'][_0x94af('0x4f')]){_0x3968b3[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x6b')]['findAll'](_0x3968b3);})[_0x94af('0x28')](function(_0x12c060){_0x50a97c[_0x94af('0x51')]=_0x12c060;return _0x50a97c;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x19dc9a,_0x3968b3))[_0x94af('0x54')](handleError(_0x19dc9a,null));};exports[_0x94af('0x6c')]=function(_0x45efc4,_0x3ab7ea,_0x19495e){var _0x3efbb9={'raw':!![],'where':{}};var _0x12e380={};var _0x12fc05={'count':0x0,'rows':[]};return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x45efc4[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x3ab7ea,null))[_0x94af('0x28')](function(_0x5051b9){if(_0x5051b9){_0x12e380[_0x94af('0x44')]=_[_0x94af('0x3e')](db['CmHopperBlack'][_0x94af('0x3a')]);_0x12e380[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x45efc4[_0x94af('0x3d')]);_0x12e380[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x12e380[_0x94af('0x44')],_0x12e380[_0x94af('0x3d')]);_0x3efbb9[_0x94af('0x40')]=_[_0x94af('0x41')](_0x12e380[_0x94af('0x44')],qs[_0x94af('0x42')](_0x45efc4['query'][_0x94af('0x42')]));_0x3efbb9[_0x94af('0x40')]=_0x3efbb9[_0x94af('0x40')][_0x94af('0x43')]?_0x3efbb9['attributes']:_0x12e380['model'];if(!_0x45efc4['query'][_0x94af('0x45')](_0x94af('0x46'))){_0x3efbb9[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x45efc4[_0x94af('0x3d')][_0x94af('0x21')]);_0x3efbb9['offset']=qs[_0x94af('0x1f')](_0x45efc4[_0x94af('0x3d')][_0x94af('0x1f')]);}_0x3efbb9[_0x94af('0x47')]=qs['sort'](_0x45efc4[_0x94af('0x3d')][_0x94af('0x48')]);_0x3efbb9[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x45efc4[_0x94af('0x3d')],_0x12e380[_0x94af('0x3f')]));_0x3efbb9[_0x94af('0x49')]['VoiceQueueId']=_0x5051b9['id'];if(_0x45efc4[_0x94af('0x3d')][_0x94af('0x2d')]){_0x3efbb9[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x3efbb9[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x3efbb9['attributes'],function(_0x65a092){var _0x5da8c2={};_0x5da8c2[_0x65a092]={'$like':'%'+_0x45efc4[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x5da8c2;})});}_0x3efbb9=_[_0x94af('0x4b')]({},_0x3efbb9,_0x45efc4[_0x94af('0x4d')]);return db[_0x94af('0x6d')][_0x94af('0x22')]({'where':_0x3efbb9[_0x94af('0x49')]})[_0x94af('0x28')](function(_0x10cc66){_0x12fc05[_0x94af('0x22')]=_0x10cc66;if(_0x45efc4[_0x94af('0x3d')][_0x94af('0x4f')]){_0x3efbb9[_0x94af('0x53')]=[{'all':!![]}];}return db[_0x94af('0x6d')]['findAll'](_0x3efbb9);})[_0x94af('0x28')](function(_0x6a617b){_0x12fc05[_0x94af('0x51')]=_0x6a617b;return _0x12fc05;});}})[_0x94af('0x28')](respondWithFilteredResult(_0x3ab7ea,_0x3efbb9))[_0x94af('0x54')](handleError(_0x3ab7ea,null));};exports[_0x94af('0x6e')]=function(_0x2ee6f3,_0x449752,_0x18d832){var _0x2f03fd={};var _0x2d4938={};var _0x185e8f;var _0x4e974c;return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x2ee6f3[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x449752,null))[_0x94af('0x28')](function(_0x21eadd){if(_0x21eadd){_0x185e8f=_0x21eadd;_0x2d4938[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x6f')][_0x94af('0x3a')]);_0x2d4938[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x2ee6f3[_0x94af('0x3d')]);_0x2d4938['filters']=_[_0x94af('0x41')](_0x2d4938[_0x94af('0x44')],_0x2d4938[_0x94af('0x3d')]);_0x2f03fd[_0x94af('0x40')]=_[_0x94af('0x41')](_0x2d4938[_0x94af('0x44')],qs[_0x94af('0x42')](_0x2ee6f3['query'][_0x94af('0x42')]));_0x2f03fd[_0x94af('0x40')]=_0x2f03fd['attributes']['length']?_0x2f03fd['attributes']:_0x2d4938[_0x94af('0x44')];_0x2f03fd[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x48')]);_0x2f03fd['where']=qs['filters'](_[_0x94af('0x4a')](_0x2ee6f3[_0x94af('0x3d')],_0x2d4938[_0x94af('0x3f')]));if(_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x2d')]){_0x2f03fd[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x2f03fd[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x2f03fd[_0x94af('0x40')],function(_0x444a82){var _0x2f483e={};_0x2f483e[_0x444a82]={'$like':'%'+_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x2f483e;})});}_0x2f03fd=_[_0x94af('0x4b')]({},_0x2f03fd,_0x2ee6f3[_0x94af('0x4d')]);return _0x185e8f[_0x94af('0x6e')](_0x2f03fd);}})['then'](function(_0x14a97a){if(_0x14a97a){_0x4e974c=_0x14a97a['length'];if(!_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x2f03fd['limit']=qs[_0x94af('0x21')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x21')]);_0x2f03fd[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x2ee6f3[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x185e8f[_0x94af('0x6e')](_0x2f03fd);}})[_0x94af('0x28')](function(_0x2b0e03){if(_0x2b0e03){return _0x2b0e03?{'count':_0x4e974c,'rows':_0x2b0e03}:null;}})['then'](respondWithResult(_0x449752,null))[_0x94af('0x54')](handleError(_0x449752,null));};exports[_0x94af('0x70')]=function(_0x4e1042,_0xe2fdda,_0x16fe1a){var _0x40cbd2=_0x4e1042[_0x94af('0x56')][_0x94af('0x71')];var _0x4d6961=_[_0x94af('0x39')](_0x40cbd2,'id');return db['Team'][_0x94af('0x50')]({'where':{'id':_0x4d6961},'attributes':['id'],'include':[{'model':db[_0x94af('0x72')],'as':'Agents','attributes':['id',_0x94af('0x36'),_0x94af('0x73'),_0x94af('0x74'),_0x94af('0x75')],'raw':!![]}]})[_0x94af('0x28')](function(_0x354a00){if(_0x354a00){var _0xffffa9=_[_0x94af('0x76')](_0x354a00,function(_0x3df205){var _0x434722=_0x3df205['get']({'plain':!![]});_0x434722['Agents']['forEach'](function(_0xd40465){_0xd40465[_0x94af('0x77')]=_[_0x94af('0x32')](_0x40cbd2,{'id':_0x434722['id']})[_0x94af('0x77')];});return _0x434722[_0x94af('0x78')];});return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x4e1042['params']['id']}})[_0x94af('0x28')](function(_0x1799b0){return db[_0x94af('0x79')][_0x94af('0x7a')](function(_0xc0ba11){return _0x1799b0['addTeams'](_0x4d6961,{'transaction':_0xc0ba11})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_0x40cbd2,function(_0x57c750){return db['TeamVoiceQueue'][_0x94af('0x7c')]({'TeamId':_0x57c750['id'],'VoiceQueueId':_0x4e1042[_0x94af('0x52')]['id'],'penalty':_0x57c750[_0x94af('0x77')]},{'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_0xffffa9,function(_0x255bcd){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x255bcd['id'],'VoiceQueueId':_0x4e1042['params']['id']},'defaults':{'penalty':_0x255bcd[_0x94af('0x77')]},'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){return BPromise[_0x94af('0x7b')](_[_0x94af('0x2d')](_0xffffa9,{'online':!![]}),function(_0x4890ea){return db['UserVoiceQueueRt'][_0x94af('0x7c')]({'membername':_0x4890ea[_0x94af('0x36')],'UserId':_0x4890ea['id'],'queue_name':_0x1799b0[_0x94af('0x36')],'VoiceQueueId':_0x1799b0['id'],'interface':_[_0x94af('0x7d')](_0x4890ea[_0x94af('0x75')])?util[_0x94af('0x7e')]('SIP/%s',_0x4890ea['name']):_0x4890ea[_0x94af('0x75')],'paused':_0x4890ea[_0x94af('0x74')]||![],'penalty':_0x4890ea[_0x94af('0x77')]},{'transaction':_0xc0ba11});});})[_0x94af('0x28')](function(){_0xffffa9[_0x94af('0x7f')](function(_0x192385){socket[_0x94af('0x80')](_0x94af('0x81'),{'UserId':_0x192385['id'],'VoiceQueueId':_0x1799b0['id']});});});});});}})['then'](respondWithStatusCode(_0xe2fdda,null))[_0x94af('0x54')](handleError(_0xe2fdda,null));};exports['removeTeams']=function(_0xca425d,_0x2980f6,_0x676cdb){return db['Team']['findAll']({'where':{'id':_0xca425d[_0x94af('0x3d')][_0x94af('0x82')]},'attributes':['id'],'include':[{'model':db[_0x94af('0x72')],'as':_0x94af('0x78'),'attributes':['id'],'raw':!![]}]})[_0x94af('0x28')](handleEntityNotFound(_0x2980f6,null))[_0x94af('0x28')](function(_0x41069b){var _0x1d7fd1=_[_0x94af('0x39')](_0x41069b,'id');var _0x1b5752=[];var _0x5a96ac=[];var _0x2e4530=squel[_0x94af('0x83')]();_0x2e4530[_0x94af('0x84')]('tq.TeamId')['from'](_0x94af('0x85'),'tq')['join']('user_has_teams','ut',_0x94af('0x86'))[_0x94af('0x49')](_0x94af('0x87'),_0xca425d[_0x94af('0x52')]['id']);for(var _0x11cede=0x0;_0x11cede<_0x41069b['length'];_0x11cede+=0x1){let _0x47e83c=_0x41069b[_0x11cede];for(var _0x5b0c8f=0x0;_0x5b0c8f<_0x47e83c[_0x94af('0x78')][_0x94af('0x43')];_0x5b0c8f+=0x1){let _0x4f064d=_0x47e83c[_0x94af('0x78')][_0x5b0c8f];var _0x18eca5=_0x2e4530[_0x94af('0x60')]();_0x18eca5[_0x94af('0x49')]('ut.UserId\x20=\x20?',_0x4f064d['id']);_0x5a96ac['push'](db['sequelize'][_0x94af('0x3d')](_0x18eca5[_0x94af('0x88')](),{'type':db[_0x94af('0x79')][_0x94af('0x89')][_0x94af('0x8a')]})[_0x94af('0x28')](function(_0x3981f8){if(_0x3981f8[_0x94af('0x43')]===0x1){return _0x4f064d['id'];}else{var _0x249693=_[_0x94af('0x8b')](_[_0x94af('0x39')](_0x3981f8,_0x94af('0x8c')),function(_0x11621c){return _[_0x94af('0x30')](_0x1d7fd1,_0x11621c);});if(_0x249693){return _0x4f064d['id'];}}}));}}return BPromise[_0x94af('0x8d')](_0x5a96ac)[_0x94af('0x28')](function(_0x56e686){_0x1b5752=_(_0x1b5752)[_0x94af('0x8e')](_0x56e686)[_0x94af('0x8f')]()[_0x94af('0x2f')]();return db[_0x94af('0x4e')]['find']({'where':{'id':_0xca425d[_0x94af('0x52')]['id']}})['then'](function(_0x44a9a6){return db[_0x94af('0x79')][_0x94af('0x7a')](function(_0x2431a6){return _0x44a9a6['removeTeams'](_0xca425d[_0x94af('0x3d')][_0x94af('0x82')],{'transaction':_0x2431a6})[_0x94af('0x28')](function(){if(!_[_0x94af('0x90')](_0x1b5752)){return _0x44a9a6[_0x94af('0x91')](_0x1b5752,{'transaction':_0x2431a6})['then'](function(){return db['UserVoiceQueueRt'][_0x94af('0x29')]({'where':{'VoiceQueueId':_0xca425d[_0x94af('0x52')]['id'],'UserId':_0x1b5752},'transaction':_0x2431a6});});}})[_0x94af('0x28')](function(){_0x1b5752[_0x94af('0x7f')](function(_0xaab321){socket[_0x94af('0x80')]('userVoiceQueue:remove',{'UserId':_0xaab321,'VoiceQueueId':_0x44a9a6['id']});});});});});});})['then'](respondWithStatusCode(_0x2980f6,null))['catch'](handleError(_0x2980f6,null));};exports[_0x94af('0x92')]=function(_0x4141ed,_0x8cb2fe,_0x548958){var _0x2e74ff,_0xe0c42d;return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0x4141ed[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x8cb2fe,null))[_0x94af('0x28')](function(_0x42256c){if(_0x42256c){_0xe0c42d=_0x42256c;return _0x42256c[_0x94af('0x92')](_0x4141ed[_0x94af('0x56')]['ids'],_['omit'](_0x4141ed[_0x94af('0x56')],['ids','id'])||{})[_0x94af('0x93')](function(_0x222634){for(var _0xe6b7fb=0x0;_0xe6b7fb<_0x4141ed[_0x94af('0x56')][_0x94af('0x82')][_0x94af('0x43')];_0xe6b7fb+=0x1){socket[_0x94af('0x80')](_0x94af('0x81'),{'UserId':Number(_0x4141ed['body'][_0x94af('0x82')][_0xe6b7fb]),'VoiceQueueId':Number(_0x4141ed['params']['id'])});}return _0x222634;});}})[_0x94af('0x28')](function(_0x360ea5){_0x2e74ff=_0x360ea5||[];if(_0xe0c42d){return db[_0x94af('0x72')][_0x94af('0x50')]({'where':{'id':_0x4141ed[_0x94af('0x56')][_0x94af('0x82')]},'attributes':['id',_0x94af('0x36'),_0x94af('0x73'),_0x94af('0x74'),_0x94af('0x75')],'raw':!![]});}})[_0x94af('0x28')](function(_0x4cfd5e){if(!_[_0x94af('0x90')](_0x4cfd5e)){var _0x20813f=[];for(var _0x1b5bb6=0x0;_0x1b5bb6<_0x4cfd5e[_0x94af('0x43')];_0x1b5bb6++){if(_0x4cfd5e[_0x1b5bb6][_0x94af('0x73')]){_0x20813f[_0x94af('0x94')](db['UserVoiceQueueRt'][_0x94af('0x7c')]({'membername':_0x4cfd5e[_0x1b5bb6][_0x94af('0x36')],'UserId':_0x4cfd5e[_0x1b5bb6]['id'],'queue_name':_0xe0c42d[_0x94af('0x36')],'VoiceQueueId':_0xe0c42d['id'],'interface':_[_0x94af('0x7d')](_0x4cfd5e[_0x1b5bb6][_0x94af('0x75')])?util['format']('SIP/%s',_0x4cfd5e[_0x1b5bb6][_0x94af('0x36')]):_0x4cfd5e[_0x1b5bb6][_0x94af('0x75')],'paused':_0x4cfd5e[_0x1b5bb6]['voicePause']||![],'penalty':_0x4141ed[_0x94af('0x56')]['penalty']||0x0}));}}return BPromise['all'](_0x20813f);}})[_0x94af('0x28')](function(){return _0x2e74ff;})['then'](respondWithResult(_0x8cb2fe,null))[_0x94af('0x54')](handleError(_0x8cb2fe,null));};exports['removeAgents']=function(_0x2718b8,_0x4d6aa5,_0x4f9be3){return db[_0x94af('0x4e')]['find']({'where':{'id':_0x2718b8[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x4d6aa5,null))[_0x94af('0x28')](function(_0x253874){if(_0x253874){return _0x253874['removeAgents'](_0x2718b8[_0x94af('0x3d')]['ids'])[_0x94af('0x28')](function(){if(_['isArray'](_0x2718b8['query'][_0x94af('0x82')])){for(var _0xafb569=0x0;_0xafb569<_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')][_0x94af('0x43')];_0xafb569+=0x1){socket['emit'](_0x94af('0x95'),{'UserId':Number(_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')][_0xafb569]),'VoiceQueueId':Number(_0x2718b8[_0x94af('0x52')]['id'])});}}else{socket['emit'](_0x94af('0x95'),{'UserId':Number(_0x2718b8['query'][_0x94af('0x82')]),'VoiceQueueId':Number(_0x2718b8[_0x94af('0x52')]['id'])});}});}})[_0x94af('0x28')](function(_0x5c2e09){return db[_0x94af('0x96')][_0x94af('0x29')]({'where':{'VoiceQueueId':_0x2718b8[_0x94af('0x52')]['id'],'UserId':_0x2718b8[_0x94af('0x3d')][_0x94af('0x82')]}})[_0x94af('0x28')](function(){return _0x5c2e09;});})[_0x94af('0x28')](respondWithStatusCode(_0x4d6aa5,null))[_0x94af('0x54')](handleError(_0x4d6aa5,null));};exports[_0x94af('0x97')]=function(_0x437eb5,_0xc88800,_0xa1b272){var _0x1f07a9={};var _0x2c2891={};var _0x4c51be;var _0x5753d5;return db[_0x94af('0x4e')][_0x94af('0x65')]({'where':{'id':_0x437eb5['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0xc88800,null))['then'](function(_0x47e324){if(_0x47e324){_0x4c51be=_0x47e324;_0x2c2891[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x72')][_0x94af('0x3a')]);_0x2c2891[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x437eb5[_0x94af('0x3d')]);_0x2c2891[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x2c2891[_0x94af('0x44')],_0x2c2891[_0x94af('0x3d')]);_0x1f07a9[_0x94af('0x40')]=_[_0x94af('0x41')](_0x2c2891[_0x94af('0x44')],qs['fields'](_0x437eb5[_0x94af('0x3d')][_0x94af('0x42')]));_0x1f07a9[_0x94af('0x40')]=_0x1f07a9['attributes']['length']?_0x1f07a9[_0x94af('0x40')]:_0x2c2891[_0x94af('0x44')];_0x1f07a9[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x437eb5[_0x94af('0x3d')][_0x94af('0x48')]);_0x1f07a9[_0x94af('0x49')]=qs['filters'](_[_0x94af('0x4a')](_0x437eb5[_0x94af('0x3d')],_0x2c2891[_0x94af('0x3f')]));if(_0x437eb5[_0x94af('0x3d')][_0x94af('0x2d')]){_0x1f07a9[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x1f07a9[_0x94af('0x49')],{'$or':_['map'](_0x1f07a9[_0x94af('0x40')],function(_0x15a1a5){var _0x4d505a={};_0x4d505a[_0x15a1a5]={'$like':'%'+_0x437eb5['query'][_0x94af('0x2d')]+'%'};return _0x4d505a;})});}_0x1f07a9=_[_0x94af('0x4b')]({},_0x1f07a9,_0x437eb5[_0x94af('0x4d')]);return _0x4c51be[_0x94af('0x97')](_0x1f07a9);}})['then'](function(_0x4d8b97){if(_0x4d8b97){_0x5753d5=_0x4d8b97['length'];if(!_0x437eb5[_0x94af('0x3d')][_0x94af('0x45')]('nolimit')){_0x1f07a9['limit']=qs['limit'](_0x437eb5[_0x94af('0x3d')][_0x94af('0x21')]);_0x1f07a9['offset']=qs[_0x94af('0x1f')](_0x437eb5[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x4c51be[_0x94af('0x97')](_0x1f07a9);}})[_0x94af('0x28')](function(_0x6ee9d2){if(_0x6ee9d2){return _0x6ee9d2?{'count':_0x5753d5,'rows':_0x6ee9d2}:null;}})['then'](respondWithResult(_0xc88800,null))['catch'](handleError(_0xc88800,null));};exports[_0x94af('0x98')]=function(_0x1da3de,_0x223a9d,_0x44e581){var _0x229a55={};var _0x1c4417={};var _0x1c66da;var _0x4b8b83;return db['VoiceQueue']['findOne']({'where':{'id':_0x1da3de[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x223a9d,null))['then'](function(_0x4d58c8){if(_0x4d58c8){_0x1c66da=_0x4d58c8;_0x1c4417[_0x94af('0x44')]=_['keys'](db[_0x94af('0x96')]['rawAttributes']);_0x1c4417[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x1da3de[_0x94af('0x3d')]);_0x1c4417[_0x94af('0x3f')]=_[_0x94af('0x41')](_0x1c4417['model'],_0x1c4417[_0x94af('0x3d')]);_0x229a55[_0x94af('0x40')]=_['intersection'](_0x1c4417[_0x94af('0x44')],qs['fields'](_0x1da3de[_0x94af('0x3d')][_0x94af('0x42')]));_0x229a55[_0x94af('0x40')]=_0x229a55[_0x94af('0x40')][_0x94af('0x43')]?_0x229a55[_0x94af('0x40')]:_0x1c4417['model'];_0x229a55[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x1da3de[_0x94af('0x3d')][_0x94af('0x48')]);_0x229a55[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x1da3de[_0x94af('0x3d')],_0x1c4417[_0x94af('0x3f')]));if(_0x1da3de[_0x94af('0x3d')][_0x94af('0x2d')]){_0x229a55[_0x94af('0x49')]=_[_0x94af('0x4b')](_0x229a55['where'],{'$or':_[_0x94af('0x39')](_0x229a55[_0x94af('0x40')],function(_0x10da47){var _0x29a4a0={};_0x29a4a0[_0x10da47]={'$like':'%'+_0x1da3de['query'][_0x94af('0x2d')]+'%'};return _0x29a4a0;})});}_0x229a55=_[_0x94af('0x4b')]({},_0x229a55,_0x1da3de[_0x94af('0x4d')]);return _0x1c66da[_0x94af('0x98')](_0x229a55);}})[_0x94af('0x28')](function(_0x435745){if(_0x435745){_0x4b8b83=_0x435745[_0x94af('0x43')];if(!_0x1da3de[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x229a55['limit']=qs[_0x94af('0x21')](_0x1da3de['query'][_0x94af('0x21')]);_0x229a55[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x1da3de[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x1c66da['getMembers'](_0x229a55);}})[_0x94af('0x28')](function(_0x412fe0){return _0x412fe0?{'count':_0x4b8b83,'rows':_0x412fe0}:null;})[_0x94af('0x28')](respondWithResult(_0x223a9d,null))[_0x94af('0x54')](handleError(_0x223a9d,null));};exports[_0x94af('0x99')]=function(_0x50f6a6,_0x4a28ad,_0x16cf5c){var _0x31f1fd={};var _0x5ef2f5={};var _0x5e0a84;var _0x215a38;return db[_0x94af('0x4e')]['findOne']({'where':{'id':_0x50f6a6[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x4a28ad,null))[_0x94af('0x28')](function(_0x396d7c){if(_0x396d7c){_0x5e0a84=_0x396d7c;_0x5ef2f5[_0x94af('0x44')]=_[_0x94af('0x3e')](db[_0x94af('0x9a')][_0x94af('0x3a')]);_0x5ef2f5[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x50f6a6[_0x94af('0x3d')]);_0x5ef2f5['filters']=_[_0x94af('0x41')](_0x5ef2f5['model'],_0x5ef2f5[_0x94af('0x3d')]);_0x31f1fd[_0x94af('0x40')]=_[_0x94af('0x41')](_0x5ef2f5[_0x94af('0x44')],qs[_0x94af('0x42')](_0x50f6a6['query']['fields']));_0x31f1fd[_0x94af('0x40')]=_0x31f1fd[_0x94af('0x40')][_0x94af('0x43')]?_0x31f1fd['attributes']:_0x5ef2f5['model'];_0x31f1fd[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x50f6a6[_0x94af('0x3d')][_0x94af('0x48')]);_0x31f1fd[_0x94af('0x49')]=qs[_0x94af('0x3f')](_['pick'](_0x50f6a6[_0x94af('0x3d')],_0x5ef2f5[_0x94af('0x3f')]));if(_0x50f6a6[_0x94af('0x3d')]['filter']){_0x31f1fd[_0x94af('0x49')]=_['merge'](_0x31f1fd[_0x94af('0x49')],{'$or':_[_0x94af('0x39')](_0x31f1fd[_0x94af('0x40')],function(_0x20b95e){var _0x181aae={};_0x181aae[_0x20b95e]={'$like':'%'+_0x50f6a6['query'][_0x94af('0x2d')]+'%'};return _0x181aae;})});}_0x31f1fd=_['merge']({},_0x31f1fd,_0x50f6a6[_0x94af('0x4d')]);return _0x5e0a84[_0x94af('0x99')](_0x31f1fd);}})[_0x94af('0x28')](function(_0x560829){if(_0x560829){_0x215a38=_0x560829[_0x94af('0x43')];if(!_0x50f6a6[_0x94af('0x3d')][_0x94af('0x45')](_0x94af('0x46'))){_0x31f1fd[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x50f6a6['query'][_0x94af('0x21')]);_0x31f1fd[_0x94af('0x1f')]=qs[_0x94af('0x1f')](_0x50f6a6['query']['offset']);}return _0x5e0a84[_0x94af('0x99')](_0x31f1fd);}})['then'](function(_0x221f09){if(_0x221f09){return _0x221f09?{'count':_0x215a38,'rows':_0x221f09}:null;}})[_0x94af('0x28')](respondWithResult(_0x4a28ad,null))[_0x94af('0x54')](handleError(_0x4a28ad,null));};exports['addLists']=function(_0x41f514,_0x553e0d,_0x379048){var _0x1362c7=moment()[_0x94af('0x7e')]('YYYY-MM-DD\x20HH:mm:ss');var _0x25b4d2,_0x5d6624;return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x41f514[_0x94af('0x52')]['id']}})['then'](handleEntityNotFound(_0x553e0d,null))[_0x94af('0x28')](function(_0x4dde7e){if(_0x4dde7e){_0x5d6624=_0x4dde7e;return _0x4dde7e[_0x94af('0x9b')](_0x41f514[_0x94af('0x56')][_0x94af('0x82')],_['omit'](_0x41f514['body'],[_0x94af('0x82'),'id'])||{});}return null;})[_0x94af('0x93')](function(_0x5344ae){var _0x520465;_0x25b4d2=_0x5344ae||[];var _0xdf890f=[];if(_0x5344ae){for(var _0x3132eb=0x0;_0x3132eb<_0x5344ae[_0x94af('0x43')];_0x3132eb+=0x1){var _0x1832e9=_0x5344ae[_0x3132eb][_0x94af('0x58')]({'plain':!![]});_0x5d6624['dialCheckDuplicateType']=_0x41f514['body'][_0x94af('0x9c')]?_0x41f514[_0x94af('0x56')]['dialCheckDuplicateType']:_0x5d6624['dialCheckDuplicateType'];switch(_0x5d6624[_0x94af('0x9c')]){case _0x94af('0x9d'):_0x520465=squel['insert']()[_0x94af('0x9e')](_0x94af('0x9f'))['fromQuery']([_0x94af('0xa0'),_0x94af('0xa1'),'ContactId',_0x94af('0xa2'),'VoiceQueueId',_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),'phone')[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0xa1'))[_0x94af('0x84')]('id',_0x94af('0xa3'))['field'](_0x1832e9[_0x94af('0xa4')]['toString'](),_0x94af('0xa2'))[_0x94af('0x84')](_0x41f514[_0x94af('0x52')]['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))['field']('\x27'+_0x1362c7+'\x27','updatedAt')[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x1832e9['CmListId'][_0x94af('0x88')]())[_0x94af('0x49')](_0x94af('0xa9'))[_0x94af('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xaa'))['from'](_0x94af('0xab'))[_0x94af('0x49')]('VoiceQueueId\x20=\x20?',_0x41f514['params']['id'][_0x94af('0x88')]()))[_0x94af('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xac'))[_0x94af('0xa5')]('cm_hopper')[_0x94af('0x49')]('VoiceQueueId\x20=\x20?',_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')]())))['toString']();break;case _0x94af('0xad'):_0x520465=squel[_0x94af('0xae')]()[_0x94af('0x9e')](_0x94af('0x9f'))['fromQuery']([_0x94af('0xa0'),_0x94af('0xa1'),_0x94af('0xa3'),_0x94af('0xa2'),'VoiceQueueId',_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','scheduledAt')['field']('id',_0x94af('0xa3'))[_0x94af('0x84')](_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))['field'](_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','updatedAt')[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')]())[_0x94af('0x49')](_0x94af('0xa9'))[_0x94af('0x49')](_0x94af('0xaf'),squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xac'))['from'](_0x94af('0x9f'))[_0x94af('0x49')](_0x94af('0x87'),_0x41f514[_0x94af('0x52')]['id'][_0x94af('0x88')]())))[_0x94af('0x88')]();break;default:_0x520465=squel['insert']()[_0x94af('0x9e')]('cm_hopper')[_0x94af('0xb0')]([_0x94af('0xa0'),_0x94af('0xa1'),_0x94af('0xa3'),_0x94af('0xa2'),_0x94af('0x69'),_0x94af('0x62'),_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0xa1'))[_0x94af('0x84')]('id',_0x94af('0xa3'))['field'](_0x1832e9[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))['field'](_0x41f514['params']['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27','createdAt')[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x63'))[_0x94af('0xa5')](_0x94af('0xa6'))[_0x94af('0x49')](_0x94af('0xa7'))[_0x94af('0x49')](_0x94af('0xa8'),_0x1832e9['CmListId'][_0x94af('0x88')]())[_0x94af('0x49')]('phone\x20IS\x20NOT\x20NULL'))[_0x94af('0x88')]();}_0xdf890f['push'](db[_0x94af('0x79')][_0x94af('0x3d')](_0x520465));}return BPromise[_0x94af('0x8d')](_0xdf890f);}})['then'](function(){var _0x4209e9=[];var _0x304848=squel['insert']()[_0x94af('0x9e')](_0x94af('0xb1'))[_0x94af('0xb0')]([_0x94af('0xb2'),_0x94af('0xa0'),_0x94af('0xb3'),'createdAt',_0x94af('0x63')],squel[_0x94af('0x83')]()[_0x94af('0x84')](_0x94af('0xb4'))[_0x94af('0x84')](_0x94af('0xb5'))[_0x94af('0x84')](_0x94af('0xb6'))[_0x94af('0x84')]('\x27'+_0x1362c7+'\x27',_0x94af('0x62'))['field']('\x27'+_0x1362c7+'\x27',_0x94af('0x63'))[_0x94af('0xa5')]('cm_contact_has_items','ci')[_0x94af('0xb7')](_0x94af('0x9f'),'h',_0x94af('0xb8'))[_0x94af('0x49')](_0x94af('0xb9'),_0x1362c7)[_0x94af('0x49')](_0x94af('0xba'),_0x94af('0xbb')))[_0x94af('0x88')]();_0x4209e9['push'](db[_0x94af('0x79')]['query'](_0x304848));return BPromise[_0x94af('0x8d')](_0x4209e9);})[_0x94af('0x28')](function(){return _0x25b4d2;})[_0x94af('0x28')](respondWithResult(_0x553e0d,null))[_0x94af('0x54')](handleError(_0x553e0d,null));};exports[_0x94af('0xbc')]=function(_0x4b6544,_0x5dafec,_0x1ed024){return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0x4b6544[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x5dafec,null))[_0x94af('0x28')](function(_0x3845ae){if(_0x3845ae){return _0x3845ae['removeLists'](_0x4b6544[_0x94af('0x3d')][_0x94af('0x82')]);}})['then'](function(_0x146682){if(_0x146682){return db[_0x94af('0x66')]['destroy']({'where':{'ListId':_0x4b6544[_0x94af('0x3d')]['ids'],'VoiceQueueId':_0x4b6544[_0x94af('0x52')]['id']}})['then'](function(){return _0x146682;});}})[_0x94af('0x28')](respondWithStatusCode(_0x5dafec,null))[_0x94af('0x54')](handleError(_0x5dafec,null));};exports[_0x94af('0xbd')]=function(_0x4b384d,_0x422662,_0x1bf301){var _0x3ca00b={};var _0x25c42d={};var _0x2e0360;var _0x2b71f6;return db['VoiceQueue'][_0x94af('0x65')]({'where':{'id':_0x4b384d[_0x94af('0x52')]['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x422662,null))['then'](function(_0x4a1083){if(_0x4a1083){_0x2e0360=_0x4a1083;_0x25c42d['model']=_[_0x94af('0x3e')](db[_0x94af('0x9a')][_0x94af('0x3a')]);_0x25c42d[_0x94af('0x3d')]=_[_0x94af('0x3e')](_0x4b384d[_0x94af('0x3d')]);_0x25c42d[_0x94af('0x3f')]=_['intersection'](_0x25c42d[_0x94af('0x44')],_0x25c42d[_0x94af('0x3d')]);_0x3ca00b[_0x94af('0x40')]=_['intersection'](_0x25c42d[_0x94af('0x44')],qs[_0x94af('0x42')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x42')]));_0x3ca00b['attributes']=_0x3ca00b[_0x94af('0x40')][_0x94af('0x43')]?_0x3ca00b[_0x94af('0x40')]:_0x25c42d['model'];_0x3ca00b[_0x94af('0x47')]=qs[_0x94af('0x48')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x48')]);_0x3ca00b[_0x94af('0x49')]=qs[_0x94af('0x3f')](_[_0x94af('0x4a')](_0x4b384d[_0x94af('0x3d')],_0x25c42d[_0x94af('0x3f')]));if(_0x4b384d[_0x94af('0x3d')][_0x94af('0x2d')]){_0x3ca00b[_0x94af('0x49')]=_['merge'](_0x3ca00b[_0x94af('0x49')],{'$or':_['map'](_0x3ca00b[_0x94af('0x40')],function(_0x4157b3){var _0x4d8e85={};_0x4d8e85[_0x4157b3]={'$like':'%'+_0x4b384d[_0x94af('0x3d')][_0x94af('0x2d')]+'%'};return _0x4d8e85;})});}_0x3ca00b=_[_0x94af('0x4b')]({},_0x3ca00b,_0x4b384d['options']);return _0x2e0360[_0x94af('0xbd')](_0x3ca00b);}})[_0x94af('0x28')](function(_0x25378c){if(_0x25378c){_0x2b71f6=_0x25378c[_0x94af('0x43')];if(!_0x4b384d['query'][_0x94af('0x45')](_0x94af('0x46'))){_0x3ca00b[_0x94af('0x21')]=qs[_0x94af('0x21')](_0x4b384d[_0x94af('0x3d')][_0x94af('0x21')]);_0x3ca00b['offset']=qs['offset'](_0x4b384d[_0x94af('0x3d')][_0x94af('0x1f')]);}return _0x2e0360[_0x94af('0xbd')](_0x3ca00b);}})['then'](function(_0x43c906){if(_0x43c906){return _0x43c906?{'count':_0x2b71f6,'rows':_0x43c906}:null;}})[_0x94af('0x28')](respondWithResult(_0x422662,null))['catch'](handleError(_0x422662,null));};exports[_0x94af('0xbe')]=function(_0x3c942a,_0x3b360b,_0x348209){var _0x232667,_0x1edc0d;return db['VoiceQueue'][_0x94af('0x32')]({'where':{'id':_0x3c942a['params']['id']}})[_0x94af('0x28')](handleEntityNotFound(_0x3b360b,null))[_0x94af('0x28')](function(_0x2c7390){if(_0x2c7390){_0x1edc0d=_0x2c7390;return _0x2c7390[_0x94af('0xbe')](_0x3c942a[_0x94af('0x56')][_0x94af('0x82')],_['omit'](_0x3c942a[_0x94af('0x56')],['ids','id'])||{});}return null;})[_0x94af('0x93')](function(_0x2ab17e){var _0x1503d7;_0x232667=_0x2ab17e||[];var _0x1f2d00=[];if(_0x2ab17e){for(var _0x3c7033=0x0;_0x3c7033<_0x2ab17e[_0x94af('0x43')];_0x3c7033+=0x1){var _0x3eaadd=_0x2ab17e[_0x3c7033][_0x94af('0x58')]({'plain':!![]});_0x1503d7=squel[_0x94af('0xae')]()[_0x94af('0x9e')]('cm_hopper_black')[_0x94af('0xb0')]([_0x94af('0xa0'),_0x94af('0xa3'),_0x94af('0xa2'),_0x94af('0x69'),'createdAt',_0x94af('0x63')],squel['select']()[_0x94af('0x84')](_0x94af('0xa0'),_0x94af('0xa0'))[_0x94af('0x84')]('id',_0x94af('0xa3'))[_0x94af('0x84')](_0x3eaadd[_0x94af('0xa4')][_0x94af('0x88')](),_0x94af('0xa2'))[_0x94af('0x84')](_0x3c942a[_0x94af('0x52')]['id']['toString'](),_0x94af('0x69'))[_0x94af('0x84')](_0x94af('0xbf'),_0x94af('0x62'))[_0x94af('0x84')](_0x94af('0xbf'),_0x94af('0x63'))[_0x94af('0xa5')]('cm_contacts')[_0x94af('0x49')](_0x94af('0xa7'))['where'](_0x94af('0xa8'),_0x3eaadd[_0x94af('0xa4')]['toString']())[_0x94af('0x49')](_0x94af('0xa9')))['toString']();_0x1f2d00['push'](db[_0x94af('0x79')][_0x94af('0x3d')](_0x1503d7));}return BPromise[_0x94af('0x8d')](_0x1f2d00);}})[_0x94af('0x28')](function(){return _0x232667;})[_0x94af('0x28')](respondWithResult(_0x3b360b,null))[_0x94af('0x54')](handleError(_0x3b360b,null));};exports['removeBlackLists']=function(_0xf5488d,_0x1324d8,_0x18944b){return db[_0x94af('0x4e')][_0x94af('0x32')]({'where':{'id':_0xf5488d[_0x94af('0x52')]['id']}})['then'](handleEntityNotFound(_0x1324d8,null))[_0x94af('0x28')](function(_0x2d4675){if(_0x2d4675){return _0x2d4675[_0x94af('0xc0')](_0xf5488d['query'][_0x94af('0x82')]);}})[_0x94af('0x28')](function(_0x5f3d02){if(_0x5f3d02){return db[_0x94af('0x6d')][_0x94af('0x29')]({'where':{'ListId':_0xf5488d[_0x94af('0x3d')][_0x94af('0x82')],'VoiceQueueId':_0xf5488d[_0x94af('0x52')]['id']}})['then'](function(){return _0x5f3d02;});}})['then'](respondWithStatusCode(_0x1324d8,null))[_0x94af('0x54')](handleError(_0x1324d8,null));}; \ No newline at end of file +var _0x6a0b=['ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','isArray','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','toString','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_contacts','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','set','json','reject','update','destroy','then','VoiceQueues','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','name','UserProfileResource','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','options','count','includeAll','include','findAll','rows','catch','show','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','updatedAt','omit','createdAt','userProfileId','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','sequelize','transaction','each','upsert','penalty','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','select','field','tq.TeamId','from','join','user_has_teams'];(function(_0x5dd778,_0x558c2d){var _0x6c2c2c=function(_0x552aac){while(--_0x552aac){_0x5dd778['push'](_0x5dd778['shift']());}};_0x6c2c2c(++_0x558c2d);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x3ccad5,_0x4e47d9){_0x3ccad5=_0x3ccad5-0x0;var _0x3fdeec=_0x6a0b[_0x3ccad5];return _0x3fdeec;};'use strict';var emlformat=require(_0xb6a0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb6a0('0x1'));var rp=require(_0xb6a0('0x2'));var moment=require('moment');var BPromise=require(_0xb6a0('0x3'));var Mustache=require(_0xb6a0('0x4'));var util=require(_0xb6a0('0x5'));var path=require(_0xb6a0('0x6'));var sox=require(_0xb6a0('0x7'));var csv=require('to-csv');var ejs=require(_0xb6a0('0x8'));var fs=require('fs');var fs_extra=require(_0xb6a0('0x9'));var _=require(_0xb6a0('0xa'));var squel=require(_0xb6a0('0xb'));var crypto=require(_0xb6a0('0xc'));var jsforce=require(_0xb6a0('0xd'));var deskjs=require(_0xb6a0('0xe'));var toCsv=require(_0xb6a0('0xf'));var querystring=require(_0xb6a0('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb6a0('0x11'));var logger=require('../../config/logger')(_0xb6a0('0x12'));var utils=require(_0xb6a0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb6a0('0x14'));var db=require(_0xb6a0('0x15'))['db'];config[_0xb6a0('0x16')]=_[_0xb6a0('0x17')](config[_0xb6a0('0x16')],{'host':_0xb6a0('0x18'),'port':0x18eb});var socket=require(_0xb6a0('0x19'))(new Redis(config[_0xb6a0('0x16')]));require(_0xb6a0('0x1a'))[_0xb6a0('0x1b')](socket);function respondWithStatusCode(_0x59f9cf,_0xcec34a){_0xcec34a=_0xcec34a||0xcc;return function(_0x40b199){if(_0x40b199){return _0x59f9cf[_0xb6a0('0x1c')](_0xcec34a);}return _0x59f9cf[_0xb6a0('0x1d')](_0xcec34a)[_0xb6a0('0x1e')]();};}function respondWithResult(_0x242694,_0x374b74){_0x374b74=_0x374b74||0xc8;return function(_0xb864a1){if(_0xb864a1){return _0x242694[_0xb6a0('0x1d')](_0x374b74)['json'](_0xb864a1);}};}function respondWithFilteredResult(_0x390330,_0x475a58){return function(_0x1c6987){if(_0x1c6987){var _0x5db250=typeof _0x475a58[_0xb6a0('0x1f')]===_0xb6a0('0x20')&&typeof _0x475a58[_0xb6a0('0x21')]===_0xb6a0('0x20');var _0x25accb=_0x1c6987['count'];var _0x5117b1=_0x5db250?0x0:_0x475a58[_0xb6a0('0x1f')];var _0x430ced=_0x5db250?_0x1c6987['count']:_0x475a58[_0xb6a0('0x1f')]+_0x475a58['limit'];var _0x2de5a2;if(_0x430ced>=_0x25accb){_0x430ced=_0x25accb;_0x2de5a2=0xc8;}else{_0x2de5a2=0xce;}_0x390330[_0xb6a0('0x1d')](_0x2de5a2);return _0x390330[_0xb6a0('0x22')]('Content-Range',_0x5117b1+'-'+_0x430ced+'/'+_0x25accb)[_0xb6a0('0x23')](_0x1c6987);}return null;};}function patchUpdates(_0x514f4c){return function(_0x3d1d4a){try{jsonpatch['apply'](_0x3d1d4a,_0x514f4c,!![]);}catch(_0xfa0ef6){return BPromise[_0xb6a0('0x24')](_0xfa0ef6);}return _0x3d1d4a['save']();};}function saveUpdates(_0x75bbe7,_0x4ddb3a){return function(_0x4ed339){if(_0x4ed339){return _0x4ed339[_0xb6a0('0x25')](_0x75bbe7)['then'](function(_0x814060){return _0x814060;});}return null;};}function removeEntity(_0x44bd47,_0x39aa8e){return function(_0x40e911){if(_0x40e911){return _0x40e911[_0xb6a0('0x26')]()[_0xb6a0('0x27')](function(){var _0x31d9b0=_0x40e911['get']({'plain':!![]});var _0xb67a1a=[{'name':_0xb6a0('0x28'),'value':_0xb6a0('0x29'),'ignore':![]},{'name':_0xb6a0('0x2a'),'value':_0xb6a0('0x2b'),'ignore':![]}];var _0x58d25e=_(_0xb67a1a)[_0xb6a0('0x2c')]('ignore')[_0xb6a0('0x2d')](_0xb6a0('0x2e'))[_0xb6a0('0x2e')]();if(_[_0xb6a0('0x2f')](_0x58d25e,_0x31d9b0[_0xb6a0('0x30')])){return;}var _0x440375=_['find'](_0xb67a1a,['value',_0x31d9b0[_0xb6a0('0x30')]])[_0xb6a0('0x31')];return db[_0xb6a0('0x32')][_0xb6a0('0x26')]({'where':{'type':_0x440375,'resourceId':_0x31d9b0['id']}})[_0xb6a0('0x27')](function(){return _0x40e911;});})['then'](function(){_0x44bd47['status'](0xcc)[_0xb6a0('0x1e')]();});}};}function handleEntityNotFound(_0x25fe3d,_0x2faba2){return function(_0x422277){if(!_0x422277){_0x25fe3d['sendStatus'](0x194);}return _0x422277;};}function handleError(_0x4bb109,_0x2022ff){_0x2022ff=_0x2022ff||0x1f4;return function(_0x16f681){logger[_0xb6a0('0x33')](_0x16f681[_0xb6a0('0x34')]);if(_0x16f681[_0xb6a0('0x31')]){delete _0x16f681['name'];}_0x4bb109['status'](_0x2022ff)[_0xb6a0('0x35')](_0x16f681);};}exports[_0xb6a0('0x36')]=function(_0x3daa1a,_0x1db231){var _0x3b1d35={},_0x15984e={},_0x20436f={'count':0x0,'rows':[]};var _0x4faeb1=_[_0xb6a0('0x2d')](db[_0xb6a0('0x37')][_0xb6a0('0x38')],function(_0x56cbe5){return{'name':_0x56cbe5[_0xb6a0('0x39')],'type':_0x56cbe5[_0xb6a0('0x30')]['key']};});_0x15984e[_0xb6a0('0x3a')]=_[_0xb6a0('0x2d')](_0x4faeb1,_0xb6a0('0x31'));_0x15984e[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x3daa1a[_0xb6a0('0x3b')]);_0x15984e['filters']=_[_0xb6a0('0x3d')](_0x15984e[_0xb6a0('0x3a')],_0x15984e[_0xb6a0('0x3b')]);_0x3b1d35['attributes']=_['intersection'](_0x15984e[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x3daa1a[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x3b1d35[_0xb6a0('0x3f')]=_0x3b1d35[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x3b1d35['attributes']:_0x15984e[_0xb6a0('0x3a')];if(!_0x3daa1a['query'][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x3b1d35['limit']=qs[_0xb6a0('0x21')](_0x3daa1a['query']['limit']);_0x3b1d35[_0xb6a0('0x1f')]=qs['offset'](_0x3daa1a[_0xb6a0('0x3b')]['offset']);}_0x3b1d35['order']=qs[_0xb6a0('0x43')](_0x3daa1a[_0xb6a0('0x3b')][_0xb6a0('0x43')]);_0x3b1d35[_0xb6a0('0x44')]=qs[_0xb6a0('0x45')](_[_0xb6a0('0x46')](_0x3daa1a[_0xb6a0('0x3b')],_0x15984e[_0xb6a0('0x45')]),_0x4faeb1);if(_0x3daa1a[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x3b1d35[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x3b1d35[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x4faeb1,function(_0x2e0b83){if(_0x2e0b83[_0xb6a0('0x30')]!=='VIRTUAL'){var _0x1ed3df={};_0x1ed3df[_0x2e0b83['name']]={'$like':'%'+_0x3daa1a['query'][_0xb6a0('0x2c')]+'%'};return _0x1ed3df;}})});}_0x3b1d35=_[_0xb6a0('0x47')]({},_0x3b1d35,_0x3daa1a[_0xb6a0('0x48')]);var _0x243c96={'where':_0x3b1d35[_0xb6a0('0x44')]};return db[_0xb6a0('0x37')][_0xb6a0('0x49')](_0x243c96)[_0xb6a0('0x27')](function(_0x11b716){_0x20436f[_0xb6a0('0x49')]=_0x11b716;if(_0x3daa1a[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x3b1d35[_0xb6a0('0x4b')]=[{'all':!![]}];}return db[_0xb6a0('0x37')][_0xb6a0('0x4c')](_0x3b1d35);})[_0xb6a0('0x27')](function(_0x43eeb2){_0x20436f[_0xb6a0('0x4d')]=_0x43eeb2;return _0x20436f;})['then'](respondWithFilteredResult(_0x1db231,_0x3b1d35))[_0xb6a0('0x4e')](handleError(_0x1db231,null));};exports[_0xb6a0('0x4f')]=function(_0x20132d,_0x5be1f9){var _0x3b59f1={'raw':![],'where':{'id':_0x20132d['params']['id']}},_0x320d04={};_0x320d04[_0xb6a0('0x3a')]=_['keys'](db[_0xb6a0('0x37')][_0xb6a0('0x38')]);_0x320d04[_0xb6a0('0x3b')]=_['keys'](_0x20132d[_0xb6a0('0x3b')]);_0x320d04['filters']=_[_0xb6a0('0x3d')](_0x320d04[_0xb6a0('0x3a')],_0x320d04[_0xb6a0('0x3b')]);_0x3b59f1[_0xb6a0('0x3f')]=_['intersection'](_0x320d04[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x20132d['query'][_0xb6a0('0x3e')]));_0x3b59f1[_0xb6a0('0x3f')]=_0x3b59f1[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x3b59f1[_0xb6a0('0x3f')]:_0x320d04[_0xb6a0('0x3a')];if(_0x20132d[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x3b59f1['include']=[{'all':!![]}];}_0x3b59f1=_['merge']({},_0x3b59f1,_0x20132d[_0xb6a0('0x48')]);return db[_0xb6a0('0x37')][_0xb6a0('0x50')](_0x3b59f1)[_0xb6a0('0x27')](handleEntityNotFound(_0x5be1f9,null))[_0xb6a0('0x27')](respondWithResult(_0x5be1f9,null))[_0xb6a0('0x4e')](handleError(_0x5be1f9,null));};exports['create']=function(_0x2832be,_0x44b4a6){return db[_0xb6a0('0x37')]['create'](_0x2832be[_0xb6a0('0x51')],{})[_0xb6a0('0x27')](function(_0x141614){var _0x4a333e=_0x2832be[_0xb6a0('0x52')][_0xb6a0('0x53')]({'plain':!![]});if(!_0x4a333e)throw new Error(_0xb6a0('0x54'));if(_0x4a333e[_0xb6a0('0x55')]===_0xb6a0('0x52')){var _0x52125c=_0x141614[_0xb6a0('0x53')]({'plain':!![]});var _0x54bac1=[{'name':_0xb6a0('0x28'),'value':_0xb6a0('0x29')},{'name':_0xb6a0('0x2a'),'value':_0xb6a0('0x2b')}];var _0x5bdd52=_[_0xb6a0('0x50')](_0x54bac1,[_0xb6a0('0x2e'),_0x52125c[_0xb6a0('0x30')]])[_0xb6a0('0x31')];return db[_0xb6a0('0x56')]['find']({'where':{'name':_0x5bdd52,'userProfileId':_0x4a333e['userProfileId']},'raw':!![]})[_0xb6a0('0x27')](function(_0xba6d10){if(_0xba6d10&&_0xba6d10[_0xb6a0('0x57')]===0x0){return db[_0xb6a0('0x32')][_0xb6a0('0x58')]({'name':_0x52125c['name'],'resourceId':_0x52125c['id'],'type':_0xba6d10[_0xb6a0('0x31')],'sectionId':_0xba6d10['id']},{})[_0xb6a0('0x27')](function(){return _0x141614;});}else{return _0x141614;}})[_0xb6a0('0x4e')](function(_0x57e9b0){logger['error'](_0xb6a0('0x59'),_0x57e9b0);throw _0x57e9b0;});}return _0x141614;})['then'](respondWithResult(_0x44b4a6,0xc9))['catch'](handleError(_0x44b4a6,null));};exports['clone']=function(_0x43fd79,_0xab87f8){var _0x5b97f7={'where':{'id':_0x43fd79[_0xb6a0('0x5a')]['id']}},_0x46efc5={};_0x46efc5[_0xb6a0('0x3a')]=_['keys'](db[_0xb6a0('0x37')]['rawAttributes']);_0x5b97f7[_0xb6a0('0x3f')]=_['intersection'](_0x46efc5[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x43fd79[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x5b97f7['attributes']=_0x5b97f7[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x5b97f7[_0xb6a0('0x3f')]:_0x46efc5[_0xb6a0('0x3a')];if(_0x43fd79['query'][_0xb6a0('0x4a')]){_0x5b97f7[_0xb6a0('0x4b')]=[{'all':!![]}];}_0x5b97f7=_[_0xb6a0('0x47')]({},_0x5b97f7,_0x43fd79[_0xb6a0('0x48')]);return db['VoiceQueue'][_0xb6a0('0x50')](_0x5b97f7)['then'](handleEntityNotFound(_0xab87f8,null))[_0xb6a0('0x27')](function(_0x63da8e){if(_0x63da8e){var _0x1fa4ea=_0x63da8e['get']({'plain':!![]});_0x1fa4ea=qs['omit'](_0x1fa4ea,['id','createdAt',_0xb6a0('0x5b')]);_0x43fd79[_0xb6a0('0x51')]=_[_0xb6a0('0x5c')](_0x43fd79[_0xb6a0('0x51')],['id',_0xb6a0('0x5d'),'updatedAt']);return db[_0xb6a0('0x37')][_0xb6a0('0x58')](_[_0xb6a0('0x47')](_0x1fa4ea,_0x43fd79[_0xb6a0('0x51')]),{'include':_0x43fd79[_0xb6a0('0x3b')][_0xb6a0('0x4a')]?[{'all':!![]}]:undefined})[_0xb6a0('0x27')](function(_0x3b1302){var _0x27b4e5=_0x43fd79[_0xb6a0('0x52')]['get']({'plain':!![]});if(!_0x27b4e5)throw new Error(_0xb6a0('0x54'));if(_0x27b4e5[_0xb6a0('0x55')]===_0xb6a0('0x52')){var _0x357bae=_0x3b1302[_0xb6a0('0x53')]({'plain':!![]});var _0x4dd048=[{'name':_0xb6a0('0x28'),'value':'inbound'},{'name':_0xb6a0('0x2a'),'value':'outbound'}];var _0x247aca=_[_0xb6a0('0x50')](_0x4dd048,[_0xb6a0('0x2e'),_0x357bae[_0xb6a0('0x30')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x247aca,'userProfileId':_0x27b4e5[_0xb6a0('0x5e')]},'raw':!![]})[_0xb6a0('0x27')](function(_0x50519e){if(_0x50519e&&_0x50519e['autoAssociation']===0x0){return db[_0xb6a0('0x32')][_0xb6a0('0x58')]({'name':_0x357bae[_0xb6a0('0x31')],'resourceId':_0x357bae['id'],'type':_0x50519e[_0xb6a0('0x31')],'sectionId':_0x50519e['id']},{})[_0xb6a0('0x27')](function(){return _0x3b1302;});}else{return _0x3b1302;}})[_0xb6a0('0x4e')](function(_0x283097){logger[_0xb6a0('0x33')](_0xb6a0('0x59'),_0x283097);throw _0x283097;});}return _0x3b1302;});}})['then'](respondWithResult(_0xab87f8,0xc9))['catch'](handleError(_0xab87f8,null));};exports[_0xb6a0('0x25')]=function(_0x20dd96,_0x33ed48){if(_0x20dd96[_0xb6a0('0x51')]['id']){delete _0x20dd96['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x20dd96[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x33ed48,null))[_0xb6a0('0x27')](saveUpdates(_0x20dd96[_0xb6a0('0x51')],null))[_0xb6a0('0x27')](respondWithResult(_0x33ed48,null))[_0xb6a0('0x4e')](handleError(_0x33ed48,null));};exports[_0xb6a0('0x26')]=function(_0x540402,_0x1b9bbf){return db[_0xb6a0('0x37')]['find']({'where':{'id':_0x540402[_0xb6a0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1b9bbf,null))[_0xb6a0('0x27')](removeEntity(_0x1b9bbf,null))['catch'](handleError(_0x1b9bbf,null));};exports['getHoppers']=function(_0x1a5524,_0x144138,_0x3bb21f){var _0x2977eb={'raw':![],'where':{}};var _0x4f6e54={};var _0x52d2fc={'count':0x0,'rows':[]};return db[_0xb6a0('0x37')][_0xb6a0('0x5f')]({'where':{'id':_0x1a5524[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x144138,null))['then'](function(_0x92178d){if(_0x92178d){_0x4f6e54[_0xb6a0('0x3a')]=_[_0xb6a0('0x3c')](db[_0xb6a0('0x60')][_0xb6a0('0x38')]);_0x4f6e54[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x1a5524['query']);_0x4f6e54['filters']=_[_0xb6a0('0x3d')](_0x4f6e54['model'],_0x4f6e54['query']);_0x2977eb[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x4f6e54[_0xb6a0('0x3a')],qs['fields'](_0x1a5524['query']['fields']));_0x2977eb[_0xb6a0('0x3f')]=_0x2977eb[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x2977eb[_0xb6a0('0x3f')]:_0x4f6e54[_0xb6a0('0x3a')];if(!_0x1a5524[_0xb6a0('0x3b')][_0xb6a0('0x41')]('nolimit')){_0x2977eb[_0xb6a0('0x21')]=qs['limit'](_0x1a5524['query'][_0xb6a0('0x21')]);_0x2977eb[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x1a5524[_0xb6a0('0x3b')][_0xb6a0('0x1f')]);}_0x2977eb['order']=qs['sort'](_0x1a5524['query'][_0xb6a0('0x43')]);_0x2977eb[_0xb6a0('0x44')]=qs[_0xb6a0('0x45')](_[_0xb6a0('0x46')](_0x1a5524[_0xb6a0('0x3b')],_0x4f6e54[_0xb6a0('0x45')]));_0x2977eb[_0xb6a0('0x44')][_0xb6a0('0x61')]=_0x92178d['id'];if(_0x1a5524[_0xb6a0('0x3b')]['filter']){_0x2977eb[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x2977eb[_0xb6a0('0x44')],{'$or':_['map'](_0x2977eb['attributes'],function(_0x3e2971){var _0x514722={};_0x514722[_0x3e2971]={'$like':'%'+_0x1a5524[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x514722;})});}_0x2977eb=_[_0xb6a0('0x47')]({},_0x2977eb,_0x1a5524[_0xb6a0('0x48')]);return db[_0xb6a0('0x60')][_0xb6a0('0x49')]({'where':_0x2977eb[_0xb6a0('0x44')]})[_0xb6a0('0x27')](function(_0x31a706){_0x52d2fc['count']=_0x31a706;if(_0x1a5524[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x2977eb[_0xb6a0('0x4b')]=[{'all':!![]}];}return db[_0xb6a0('0x60')][_0xb6a0('0x4c')](_0x2977eb);})[_0xb6a0('0x27')](function(_0x9f2334){_0x52d2fc[_0xb6a0('0x4d')]=_0x9f2334;return _0x52d2fc;});}})['then'](respondWithFilteredResult(_0x144138,_0x2977eb))[_0xb6a0('0x4e')](handleError(_0x144138,null));};exports[_0xb6a0('0x62')]=function(_0x18c196,_0x48a6b5,_0x4f8c74){var _0x25cd50={'raw':!![],'where':{}};var _0x3774a4={};var _0x5a61b0={'count':0x0,'rows':[]};return db[_0xb6a0('0x37')][_0xb6a0('0x5f')]({'where':{'id':_0x18c196[_0xb6a0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x48a6b5,null))[_0xb6a0('0x27')](function(_0x156322){if(_0x156322){_0x3774a4[_0xb6a0('0x3a')]=_[_0xb6a0('0x3c')](db['CmHopperHistory']['rawAttributes']);_0x3774a4[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x18c196[_0xb6a0('0x3b')]);_0x3774a4[_0xb6a0('0x45')]=_[_0xb6a0('0x3d')](_0x3774a4[_0xb6a0('0x3a')],_0x3774a4[_0xb6a0('0x3b')]);_0x25cd50[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x3774a4[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x25cd50['attributes']=_0x25cd50['attributes']['length']?_0x25cd50['attributes']:_0x3774a4[_0xb6a0('0x3a')];if(!_0x18c196[_0xb6a0('0x3b')]['hasOwnProperty']('nolimit')){_0x25cd50[_0xb6a0('0x21')]=qs[_0xb6a0('0x21')](_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x25cd50[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x1f')]);}_0x25cd50['order']=qs[_0xb6a0('0x43')](_0x18c196[_0xb6a0('0x3b')]['sort']);_0x25cd50['where']=qs[_0xb6a0('0x45')](_[_0xb6a0('0x46')](_0x18c196['query'],_0x3774a4[_0xb6a0('0x45')]));_0x25cd50[_0xb6a0('0x44')][_0xb6a0('0x61')]=_0x156322['id'];if(_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x25cd50['where']=_['merge'](_0x25cd50[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x25cd50['attributes'],function(_0x48ad38){var _0x190ff3={};_0x190ff3[_0x48ad38]={'$like':'%'+_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x190ff3;})});}_0x25cd50=_[_0xb6a0('0x47')]({},_0x25cd50,_0x18c196[_0xb6a0('0x48')]);return db[_0xb6a0('0x63')]['count']({'where':_0x25cd50[_0xb6a0('0x44')]})[_0xb6a0('0x27')](function(_0x360e39){_0x5a61b0[_0xb6a0('0x49')]=_0x360e39;if(_0x18c196[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x25cd50[_0xb6a0('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb6a0('0x4c')](_0x25cd50);})[_0xb6a0('0x27')](function(_0x3f24bb){_0x5a61b0[_0xb6a0('0x4d')]=_0x3f24bb;return _0x5a61b0;});}})[_0xb6a0('0x27')](respondWithFilteredResult(_0x48a6b5,_0x25cd50))[_0xb6a0('0x4e')](handleError(_0x48a6b5,null));};exports[_0xb6a0('0x64')]=function(_0x2d355f,_0x206dfe,_0x426251){var _0x185e18={'raw':!![],'where':{}};var _0x47a866={};var _0x2661b7={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xb6a0('0x5f')]({'where':{'id':_0x2d355f['params']['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x206dfe,null))['then'](function(_0x43f387){if(_0x43f387){_0x47a866['model']=_[_0xb6a0('0x3c')](db[_0xb6a0('0x65')][_0xb6a0('0x38')]);_0x47a866[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x2d355f['query']);_0x47a866['filters']=_[_0xb6a0('0x3d')](_0x47a866['model'],_0x47a866[_0xb6a0('0x3b')]);_0x185e18[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x47a866[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x2d355f['query'][_0xb6a0('0x3e')]));_0x185e18['attributes']=_0x185e18['attributes'][_0xb6a0('0x40')]?_0x185e18[_0xb6a0('0x3f')]:_0x47a866[_0xb6a0('0x3a')];if(!_0x2d355f['query'][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x185e18[_0xb6a0('0x21')]=qs['limit'](_0x2d355f[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x185e18[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x2d355f[_0xb6a0('0x3b')][_0xb6a0('0x1f')]);}_0x185e18[_0xb6a0('0x66')]=qs[_0xb6a0('0x43')](_0x2d355f[_0xb6a0('0x3b')]['sort']);_0x185e18[_0xb6a0('0x44')]=qs['filters'](_[_0xb6a0('0x46')](_0x2d355f[_0xb6a0('0x3b')],_0x47a866[_0xb6a0('0x45')]));_0x185e18['where'][_0xb6a0('0x61')]=_0x43f387['id'];if(_0x2d355f[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x185e18[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x185e18[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x185e18[_0xb6a0('0x3f')],function(_0x4c1070){var _0x45ceb7={};_0x45ceb7[_0x4c1070]={'$like':'%'+_0x2d355f[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x45ceb7;})});}_0x185e18=_['merge']({},_0x185e18,_0x2d355f['options']);return db['CmHopperFinal'][_0xb6a0('0x49')]({'where':_0x185e18[_0xb6a0('0x44')]})[_0xb6a0('0x27')](function(_0x47f4ac){_0x2661b7[_0xb6a0('0x49')]=_0x47f4ac;if(_0x2d355f[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x185e18[_0xb6a0('0x4b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb6a0('0x4c')](_0x185e18);})[_0xb6a0('0x27')](function(_0x1d23e1){_0x2661b7[_0xb6a0('0x4d')]=_0x1d23e1;return _0x2661b7;});}})[_0xb6a0('0x27')](respondWithFilteredResult(_0x206dfe,_0x185e18))[_0xb6a0('0x4e')](handleError(_0x206dfe,null));};exports[_0xb6a0('0x67')]=function(_0x2a3028,_0x2fcd6b,_0x1b70a5){var _0x2e8eda={'raw':!![],'where':{}};var _0x516b21={};var _0x221c8a={'count':0x0,'rows':[]};return db[_0xb6a0('0x37')][_0xb6a0('0x5f')]({'where':{'id':_0x2a3028['params']['id']}})['then'](handleEntityNotFound(_0x2fcd6b,null))[_0xb6a0('0x27')](function(_0x26c371){if(_0x26c371){_0x516b21[_0xb6a0('0x3a')]=_[_0xb6a0('0x3c')](db[_0xb6a0('0x68')][_0xb6a0('0x38')]);_0x516b21['query']=_[_0xb6a0('0x3c')](_0x2a3028[_0xb6a0('0x3b')]);_0x516b21[_0xb6a0('0x45')]=_[_0xb6a0('0x3d')](_0x516b21[_0xb6a0('0x3a')],_0x516b21['query']);_0x2e8eda[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x516b21[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x2e8eda[_0xb6a0('0x3f')]=_0x2e8eda['attributes'][_0xb6a0('0x40')]?_0x2e8eda[_0xb6a0('0x3f')]:_0x516b21['model'];if(!_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x41')]('nolimit')){_0x2e8eda[_0xb6a0('0x21')]=qs['limit'](_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x2e8eda[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x2a3028[_0xb6a0('0x3b')]['offset']);}_0x2e8eda[_0xb6a0('0x66')]=qs[_0xb6a0('0x43')](_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x43')]);_0x2e8eda[_0xb6a0('0x44')]=qs['filters'](_['pick'](_0x2a3028[_0xb6a0('0x3b')],_0x516b21[_0xb6a0('0x45')]));_0x2e8eda[_0xb6a0('0x44')]['VoiceQueueId']=_0x26c371['id'];if(_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x2e8eda[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x2e8eda[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x2e8eda[_0xb6a0('0x3f')],function(_0x7e8a4f){var _0x4fc0dd={};_0x4fc0dd[_0x7e8a4f]={'$like':'%'+_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x4fc0dd;})});}_0x2e8eda=_[_0xb6a0('0x47')]({},_0x2e8eda,_0x2a3028['options']);return db[_0xb6a0('0x68')][_0xb6a0('0x49')]({'where':_0x2e8eda[_0xb6a0('0x44')]})['then'](function(_0x535931){_0x221c8a['count']=_0x535931;if(_0x2a3028[_0xb6a0('0x3b')][_0xb6a0('0x4a')]){_0x2e8eda['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xb6a0('0x4c')](_0x2e8eda);})['then'](function(_0x23db3f){_0x221c8a[_0xb6a0('0x4d')]=_0x23db3f;return _0x221c8a;});}})[_0xb6a0('0x27')](respondWithFilteredResult(_0x2fcd6b,_0x2e8eda))[_0xb6a0('0x4e')](handleError(_0x2fcd6b,null));};exports[_0xb6a0('0x69')]=function(_0x193607,_0x4cbd24,_0x8bf282){var _0x3ef5cc={};var _0x449f93={};var _0x25de9f;var _0x5d6316;return db[_0xb6a0('0x37')]['findOne']({'where':{'id':_0x193607['params']['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x4cbd24,null))[_0xb6a0('0x27')](function(_0x534b3e){if(_0x534b3e){_0x25de9f=_0x534b3e;_0x449f93['model']=_[_0xb6a0('0x3c')](db[_0xb6a0('0x6a')][_0xb6a0('0x38')]);_0x449f93['query']=_[_0xb6a0('0x3c')](_0x193607[_0xb6a0('0x3b')]);_0x449f93[_0xb6a0('0x45')]=_[_0xb6a0('0x3d')](_0x449f93[_0xb6a0('0x3a')],_0x449f93[_0xb6a0('0x3b')]);_0x3ef5cc['attributes']=_[_0xb6a0('0x3d')](_0x449f93[_0xb6a0('0x3a')],qs['fields'](_0x193607[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x3ef5cc['attributes']=_0x3ef5cc[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x3ef5cc[_0xb6a0('0x3f')]:_0x449f93[_0xb6a0('0x3a')];_0x3ef5cc[_0xb6a0('0x66')]=qs['sort'](_0x193607['query'][_0xb6a0('0x43')]);_0x3ef5cc['where']=qs[_0xb6a0('0x45')](_[_0xb6a0('0x46')](_0x193607['query'],_0x449f93['filters']));if(_0x193607[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x3ef5cc[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x3ef5cc[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x3ef5cc[_0xb6a0('0x3f')],function(_0x1bd8e5){var _0x53f88a={};_0x53f88a[_0x1bd8e5]={'$like':'%'+_0x193607[_0xb6a0('0x3b')]['filter']+'%'};return _0x53f88a;})});}_0x3ef5cc=_['merge']({},_0x3ef5cc,_0x193607['options']);return _0x25de9f[_0xb6a0('0x69')](_0x3ef5cc);}})[_0xb6a0('0x27')](function(_0x1b7582){if(_0x1b7582){_0x5d6316=_0x1b7582[_0xb6a0('0x40')];if(!_0x193607[_0xb6a0('0x3b')][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x3ef5cc[_0xb6a0('0x21')]=qs[_0xb6a0('0x21')](_0x193607[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x3ef5cc[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x193607[_0xb6a0('0x3b')]['offset']);}return _0x25de9f[_0xb6a0('0x69')](_0x3ef5cc);}})[_0xb6a0('0x27')](function(_0x30c07e){if(_0x30c07e){return _0x30c07e?{'count':_0x5d6316,'rows':_0x30c07e}:null;}})[_0xb6a0('0x27')](respondWithResult(_0x4cbd24,null))[_0xb6a0('0x4e')](handleError(_0x4cbd24,null));};exports[_0xb6a0('0x6b')]=function(_0x548bc4,_0x5a9313,_0x2aa043){var _0x3221f8=_0x548bc4[_0xb6a0('0x51')][_0xb6a0('0x6c')];var _0x5c6ad9=_[_0xb6a0('0x2d')](_0x3221f8,'id');return db[_0xb6a0('0x6a')][_0xb6a0('0x4c')]({'where':{'id':_0x5c6ad9},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb6a0('0x6d'),'attributes':['id',_0xb6a0('0x31'),_0xb6a0('0x6e'),_0xb6a0('0x6f'),_0xb6a0('0x70')],'raw':!![]}]})[_0xb6a0('0x27')](function(_0x28a80c){if(_0x28a80c){var _0x4b9e1c=_[_0xb6a0('0x71')](_0x28a80c,function(_0x1206c8){var _0x4d6095=_0x1206c8[_0xb6a0('0x53')]({'plain':!![]});_0x4d6095[_0xb6a0('0x6d')][_0xb6a0('0x72')](function(_0x500fa4){_0x500fa4['penalty']=_[_0xb6a0('0x50')](_0x3221f8,{'id':_0x4d6095['id']})['penalty'];});return _0x4d6095[_0xb6a0('0x6d')];});return db[_0xb6a0('0x37')][_0xb6a0('0x50')]({'where':{'id':_0x548bc4['params']['id']}})['then'](function(_0x3417ac){return db[_0xb6a0('0x73')][_0xb6a0('0x74')](function(_0x561476){return _0x3417ac[_0xb6a0('0x6b')](_0x5c6ad9,{'transaction':_0x561476})['then'](function(){return BPromise[_0xb6a0('0x75')](_0x3221f8,function(_0x5c89a6){return db['TeamVoiceQueue'][_0xb6a0('0x76')]({'TeamId':_0x5c89a6['id'],'VoiceQueueId':_0x548bc4[_0xb6a0('0x5a')]['id'],'penalty':_0x5c89a6[_0xb6a0('0x77')]},{'transaction':_0x561476});});})[_0xb6a0('0x27')](function(){return BPromise[_0xb6a0('0x75')](_0x4b9e1c,function(_0x4128b0){return db[_0xb6a0('0x78')]['findOrCreate']({'where':{'UserId':_0x4128b0['id'],'VoiceQueueId':_0x548bc4['params']['id']},'defaults':{'penalty':_0x4128b0[_0xb6a0('0x77')]},'transaction':_0x561476});});})[_0xb6a0('0x27')](function(){return BPromise['each'](_['filter'](_0x4b9e1c,{'online':!![]}),function(_0x1878a4){return db[_0xb6a0('0x79')][_0xb6a0('0x76')]({'membername':_0x1878a4[_0xb6a0('0x31')],'UserId':_0x1878a4['id'],'queue_name':_0x3417ac['name'],'VoiceQueueId':_0x3417ac['id'],'interface':_[_0xb6a0('0x7a')](_0x1878a4[_0xb6a0('0x70')])?util[_0xb6a0('0x7b')](_0xb6a0('0x7c'),_0x1878a4['name']):_0x1878a4[_0xb6a0('0x70')],'paused':_0x1878a4[_0xb6a0('0x6f')]||![],'penalty':_0x1878a4[_0xb6a0('0x77')]},{'transaction':_0x561476});});})[_0xb6a0('0x27')](function(){_0x4b9e1c[_0xb6a0('0x72')](function(_0x31cd7b){socket[_0xb6a0('0x7d')](_0xb6a0('0x7e'),{'UserId':_0x31cd7b['id'],'VoiceQueueId':_0x3417ac['id']});});});});});}})['then'](respondWithStatusCode(_0x5a9313,null))[_0xb6a0('0x4e')](handleError(_0x5a9313,null));};exports[_0xb6a0('0x7f')]=function(_0x58b938,_0x483638,_0x36c601){return db[_0xb6a0('0x6a')][_0xb6a0('0x4c')]({'where':{'id':_0x58b938[_0xb6a0('0x3b')][_0xb6a0('0x80')]},'attributes':['id'],'include':[{'model':db[_0xb6a0('0x81')],'as':_0xb6a0('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xb6a0('0x27')](handleEntityNotFound(_0x483638,null))[_0xb6a0('0x27')](function(_0x32adc4){var _0x1188bd=_[_0xb6a0('0x2d')](_0x32adc4,'id');var _0x28198e=[];var _0x595236=[];var _0x6bb996=squel[_0xb6a0('0x82')]();_0x6bb996[_0xb6a0('0x83')](_0xb6a0('0x84'))[_0xb6a0('0x85')]('team_has_voice_queues','tq')[_0xb6a0('0x86')](_0xb6a0('0x87'),'ut',_0xb6a0('0x88'))['where'](_0xb6a0('0x89'),_0x58b938['params']['id']);for(var _0x3be172=0x0;_0x3be172<_0x32adc4[_0xb6a0('0x40')];_0x3be172+=0x1){let _0x46d68f=_0x32adc4[_0x3be172];for(var _0x4527a5=0x0;_0x4527a5<_0x46d68f['Agents']['length'];_0x4527a5+=0x1){let _0x520ae6=_0x46d68f[_0xb6a0('0x6d')][_0x4527a5];var _0x5c251c=_0x6bb996[_0xb6a0('0x8a')]();_0x5c251c[_0xb6a0('0x44')](_0xb6a0('0x8b'),_0x520ae6['id']);_0x595236['push'](db[_0xb6a0('0x73')][_0xb6a0('0x3b')](_0x5c251c['toString'](),{'type':db[_0xb6a0('0x73')]['QueryTypes'][_0xb6a0('0x8c')]})[_0xb6a0('0x27')](function(_0x1650ed){if(_0x1650ed[_0xb6a0('0x40')]===0x1){return _0x520ae6['id'];}else{var _0xa3b46b=_[_0xb6a0('0x8d')](_[_0xb6a0('0x2d')](_0x1650ed,_0xb6a0('0x8e')),function(_0x256964){return _[_0xb6a0('0x2f')](_0x1188bd,_0x256964);});if(_0xa3b46b){return _0x520ae6['id'];}}}));}}return BPromise[_0xb6a0('0x8f')](_0x595236)[_0xb6a0('0x27')](function(_0x55d31a){_0x28198e=_(_0x28198e)[_0xb6a0('0x90')](_0x55d31a)[_0xb6a0('0x91')]()[_0xb6a0('0x2e')]();return db[_0xb6a0('0x37')][_0xb6a0('0x50')]({'where':{'id':_0x58b938[_0xb6a0('0x5a')]['id']}})['then'](function(_0x3fe762){return db[_0xb6a0('0x73')][_0xb6a0('0x74')](function(_0x46ce41){return _0x3fe762[_0xb6a0('0x7f')](_0x58b938[_0xb6a0('0x3b')]['ids'],{'transaction':_0x46ce41})[_0xb6a0('0x27')](function(){if(!_[_0xb6a0('0x92')](_0x28198e)){return _0x3fe762[_0xb6a0('0x93')](_0x28198e,{'transaction':_0x46ce41})[_0xb6a0('0x27')](function(){return db[_0xb6a0('0x79')][_0xb6a0('0x26')]({'where':{'VoiceQueueId':_0x58b938['params']['id'],'UserId':_0x28198e},'transaction':_0x46ce41});});}})['then'](function(){_0x28198e[_0xb6a0('0x72')](function(_0x49316f){socket[_0xb6a0('0x7d')](_0xb6a0('0x94'),{'UserId':_0x49316f,'VoiceQueueId':_0x3fe762['id']});});});});});});})[_0xb6a0('0x27')](respondWithStatusCode(_0x483638,null))[_0xb6a0('0x4e')](handleError(_0x483638,null));};exports['addAgents']=function(_0x2d5230,_0x3413a3,_0x56c3d3){var _0x5e01ef,_0x14d46e;return db[_0xb6a0('0x37')]['find']({'where':{'id':_0x2d5230[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x3413a3,null))[_0xb6a0('0x27')](function(_0x50903a){if(_0x50903a){_0x14d46e=_0x50903a;return _0x50903a[_0xb6a0('0x95')](_0x2d5230[_0xb6a0('0x51')]['ids'],_[_0xb6a0('0x5c')](_0x2d5230[_0xb6a0('0x51')],['ids','id'])||{})['spread'](function(_0x5875a7){for(var _0x1b894e=0x0;_0x1b894e<_0x2d5230[_0xb6a0('0x51')]['ids']['length'];_0x1b894e+=0x1){socket[_0xb6a0('0x7d')](_0xb6a0('0x7e'),{'UserId':Number(_0x2d5230['body'][_0xb6a0('0x80')][_0x1b894e]),'VoiceQueueId':Number(_0x2d5230['params']['id'])});}return _0x5875a7;});}})['then'](function(_0x5db75b){_0x5e01ef=_0x5db75b||[];if(_0x14d46e){return db[_0xb6a0('0x81')][_0xb6a0('0x4c')]({'where':{'id':_0x2d5230['body'][_0xb6a0('0x80')]},'attributes':['id',_0xb6a0('0x31'),_0xb6a0('0x6e'),'voicePause','interface'],'raw':!![]});}})[_0xb6a0('0x27')](function(_0x18f986){if(!_[_0xb6a0('0x92')](_0x18f986)){var _0x43b15f=[];for(var _0x55c773=0x0;_0x55c773<_0x18f986[_0xb6a0('0x40')];_0x55c773++){if(_0x18f986[_0x55c773][_0xb6a0('0x6e')]){_0x43b15f['push'](db[_0xb6a0('0x79')][_0xb6a0('0x76')]({'membername':_0x18f986[_0x55c773]['name'],'UserId':_0x18f986[_0x55c773]['id'],'queue_name':_0x14d46e[_0xb6a0('0x31')],'VoiceQueueId':_0x14d46e['id'],'interface':_['isNil'](_0x18f986[_0x55c773][_0xb6a0('0x70')])?util[_0xb6a0('0x7b')](_0xb6a0('0x7c'),_0x18f986[_0x55c773][_0xb6a0('0x31')]):_0x18f986[_0x55c773][_0xb6a0('0x70')],'paused':_0x18f986[_0x55c773]['voicePause']||![],'penalty':_0x2d5230[_0xb6a0('0x51')]['penalty']||0x0}));}}return BPromise[_0xb6a0('0x8f')](_0x43b15f);}})['then'](function(){return _0x5e01ef;})[_0xb6a0('0x27')](respondWithResult(_0x3413a3,null))[_0xb6a0('0x4e')](handleError(_0x3413a3,null));};exports[_0xb6a0('0x93')]=function(_0xf3ccc0,_0x49e57e,_0x3a4f8d){return db['VoiceQueue'][_0xb6a0('0x50')]({'where':{'id':_0xf3ccc0[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x49e57e,null))[_0xb6a0('0x27')](function(_0x4ad2ed){if(_0x4ad2ed){return _0x4ad2ed['removeAgents'](_0xf3ccc0['query'][_0xb6a0('0x80')])['then'](function(){if(_[_0xb6a0('0x96')](_0xf3ccc0[_0xb6a0('0x3b')][_0xb6a0('0x80')])){for(var _0x1d5415=0x0;_0x1d5415<_0xf3ccc0['query']['ids'][_0xb6a0('0x40')];_0x1d5415+=0x1){socket['emit'](_0xb6a0('0x94'),{'UserId':Number(_0xf3ccc0['query'][_0xb6a0('0x80')][_0x1d5415]),'VoiceQueueId':Number(_0xf3ccc0[_0xb6a0('0x5a')]['id'])});}}else{socket[_0xb6a0('0x7d')](_0xb6a0('0x94'),{'UserId':Number(_0xf3ccc0[_0xb6a0('0x3b')][_0xb6a0('0x80')]),'VoiceQueueId':Number(_0xf3ccc0[_0xb6a0('0x5a')]['id'])});}});}})[_0xb6a0('0x27')](function(_0x1f774f){return db[_0xb6a0('0x79')][_0xb6a0('0x26')]({'where':{'VoiceQueueId':_0xf3ccc0[_0xb6a0('0x5a')]['id'],'UserId':_0xf3ccc0[_0xb6a0('0x3b')]['ids']}})[_0xb6a0('0x27')](function(){return _0x1f774f;});})['then'](respondWithStatusCode(_0x49e57e,null))[_0xb6a0('0x4e')](handleError(_0x49e57e,null));};exports[_0xb6a0('0x97')]=function(_0x2b4845,_0x4280d4,_0x2ebbd9){var _0x2d8012={};var _0x1f5a55={};var _0x3dcc7d;var _0x2ea9bd;return db[_0xb6a0('0x37')]['findOne']({'where':{'id':_0x2b4845[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x4280d4,null))['then'](function(_0x2d4262){if(_0x2d4262){_0x3dcc7d=_0x2d4262;_0x1f5a55['model']=_[_0xb6a0('0x3c')](db[_0xb6a0('0x81')][_0xb6a0('0x38')]);_0x1f5a55[_0xb6a0('0x3b')]=_['keys'](_0x2b4845['query']);_0x1f5a55[_0xb6a0('0x45')]=_['intersection'](_0x1f5a55[_0xb6a0('0x3a')],_0x1f5a55['query']);_0x2d8012['attributes']=_['intersection'](_0x1f5a55['model'],qs[_0xb6a0('0x3e')](_0x2b4845[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x2d8012['attributes']=_0x2d8012[_0xb6a0('0x3f')]['length']?_0x2d8012['attributes']:_0x1f5a55[_0xb6a0('0x3a')];_0x2d8012[_0xb6a0('0x66')]=qs['sort'](_0x2b4845[_0xb6a0('0x3b')][_0xb6a0('0x43')]);_0x2d8012[_0xb6a0('0x44')]=qs['filters'](_[_0xb6a0('0x46')](_0x2b4845[_0xb6a0('0x3b')],_0x1f5a55[_0xb6a0('0x45')]));if(_0x2b4845[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x2d8012[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x2d8012[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x2d8012[_0xb6a0('0x3f')],function(_0x5a8e4a){var _0x2cc952={};_0x2cc952[_0x5a8e4a]={'$like':'%'+_0x2b4845[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x2cc952;})});}_0x2d8012=_['merge']({},_0x2d8012,_0x2b4845[_0xb6a0('0x48')]);return _0x3dcc7d['getAgents'](_0x2d8012);}})['then'](function(_0x722bdb){if(_0x722bdb){_0x2ea9bd=_0x722bdb[_0xb6a0('0x40')];if(!_0x2b4845[_0xb6a0('0x3b')]['hasOwnProperty']('nolimit')){_0x2d8012[_0xb6a0('0x21')]=qs['limit'](_0x2b4845[_0xb6a0('0x3b')]['limit']);_0x2d8012[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x2b4845[_0xb6a0('0x3b')]['offset']);}return _0x3dcc7d[_0xb6a0('0x97')](_0x2d8012);}})['then'](function(_0x8fb1d3){if(_0x8fb1d3){return _0x8fb1d3?{'count':_0x2ea9bd,'rows':_0x8fb1d3}:null;}})[_0xb6a0('0x27')](respondWithResult(_0x4280d4,null))['catch'](handleError(_0x4280d4,null));};exports[_0xb6a0('0x98')]=function(_0x86ed6e,_0x1da909,_0x18b8d6){var _0x2e8d88={};var _0x47cd81={};var _0x186228;var _0x2d8cf7;return db[_0xb6a0('0x37')][_0xb6a0('0x5f')]({'where':{'id':_0x86ed6e[_0xb6a0('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1da909,null))[_0xb6a0('0x27')](function(_0x52d5e0){if(_0x52d5e0){_0x186228=_0x52d5e0;_0x47cd81[_0xb6a0('0x3a')]=_[_0xb6a0('0x3c')](db[_0xb6a0('0x79')][_0xb6a0('0x38')]);_0x47cd81[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x86ed6e['query']);_0x47cd81['filters']=_[_0xb6a0('0x3d')](_0x47cd81['model'],_0x47cd81[_0xb6a0('0x3b')]);_0x2e8d88[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x47cd81[_0xb6a0('0x3a')],qs['fields'](_0x86ed6e[_0xb6a0('0x3b')]['fields']));_0x2e8d88[_0xb6a0('0x3f')]=_0x2e8d88[_0xb6a0('0x3f')]['length']?_0x2e8d88['attributes']:_0x47cd81[_0xb6a0('0x3a')];_0x2e8d88[_0xb6a0('0x66')]=qs['sort'](_0x86ed6e[_0xb6a0('0x3b')]['sort']);_0x2e8d88['where']=qs['filters'](_[_0xb6a0('0x46')](_0x86ed6e[_0xb6a0('0x3b')],_0x47cd81['filters']));if(_0x86ed6e[_0xb6a0('0x3b')][_0xb6a0('0x2c')]){_0x2e8d88[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x2e8d88[_0xb6a0('0x44')],{'$or':_['map'](_0x2e8d88[_0xb6a0('0x3f')],function(_0x578c13){var _0x90ff6c={};_0x90ff6c[_0x578c13]={'$like':'%'+_0x86ed6e['query'][_0xb6a0('0x2c')]+'%'};return _0x90ff6c;})});}_0x2e8d88=_['merge']({},_0x2e8d88,_0x86ed6e[_0xb6a0('0x48')]);return _0x186228[_0xb6a0('0x98')](_0x2e8d88);}})[_0xb6a0('0x27')](function(_0x5b9e07){if(_0x5b9e07){_0x2d8cf7=_0x5b9e07[_0xb6a0('0x40')];if(!_0x86ed6e[_0xb6a0('0x3b')][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x2e8d88[_0xb6a0('0x21')]=qs[_0xb6a0('0x21')](_0x86ed6e[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x2e8d88[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x86ed6e['query'][_0xb6a0('0x1f')]);}return _0x186228[_0xb6a0('0x98')](_0x2e8d88);}})['then'](function(_0x47c598){return _0x47c598?{'count':_0x2d8cf7,'rows':_0x47c598}:null;})[_0xb6a0('0x27')](respondWithResult(_0x1da909,null))['catch'](handleError(_0x1da909,null));};exports[_0xb6a0('0x99')]=function(_0x1e797a,_0x6e4eab,_0xb9d7ce){var _0x11e568={};var _0x48bad4={};var _0x52dedc;var _0xf995b1;return db[_0xb6a0('0x37')][_0xb6a0('0x5f')]({'where':{'id':_0x1e797a[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x6e4eab,null))[_0xb6a0('0x27')](function(_0x45575a){if(_0x45575a){_0x52dedc=_0x45575a;_0x48bad4[_0xb6a0('0x3a')]=_['keys'](db['CmList'][_0xb6a0('0x38')]);_0x48bad4['query']=_[_0xb6a0('0x3c')](_0x1e797a[_0xb6a0('0x3b')]);_0x48bad4['filters']=_['intersection'](_0x48bad4[_0xb6a0('0x3a')],_0x48bad4['query']);_0x11e568[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x48bad4[_0xb6a0('0x3a')],qs[_0xb6a0('0x3e')](_0x1e797a[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x11e568[_0xb6a0('0x3f')]=_0x11e568[_0xb6a0('0x3f')]['length']?_0x11e568[_0xb6a0('0x3f')]:_0x48bad4[_0xb6a0('0x3a')];_0x11e568[_0xb6a0('0x66')]=qs[_0xb6a0('0x43')](_0x1e797a['query'][_0xb6a0('0x43')]);_0x11e568[_0xb6a0('0x44')]=qs[_0xb6a0('0x45')](_[_0xb6a0('0x46')](_0x1e797a[_0xb6a0('0x3b')],_0x48bad4[_0xb6a0('0x45')]));if(_0x1e797a[_0xb6a0('0x3b')]['filter']){_0x11e568[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x11e568[_0xb6a0('0x44')],{'$or':_[_0xb6a0('0x2d')](_0x11e568[_0xb6a0('0x3f')],function(_0x22172f){var _0x3062c5={};_0x3062c5[_0x22172f]={'$like':'%'+_0x1e797a[_0xb6a0('0x3b')][_0xb6a0('0x2c')]+'%'};return _0x3062c5;})});}_0x11e568=_[_0xb6a0('0x47')]({},_0x11e568,_0x1e797a[_0xb6a0('0x48')]);return _0x52dedc[_0xb6a0('0x99')](_0x11e568);}})[_0xb6a0('0x27')](function(_0x3ec088){if(_0x3ec088){_0xf995b1=_0x3ec088[_0xb6a0('0x40')];if(!_0x1e797a[_0xb6a0('0x3b')][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x11e568[_0xb6a0('0x21')]=qs['limit'](_0x1e797a[_0xb6a0('0x3b')][_0xb6a0('0x21')]);_0x11e568[_0xb6a0('0x1f')]=qs[_0xb6a0('0x1f')](_0x1e797a['query']['offset']);}return _0x52dedc[_0xb6a0('0x99')](_0x11e568);}})[_0xb6a0('0x27')](function(_0x421a69){if(_0x421a69){return _0x421a69?{'count':_0xf995b1,'rows':_0x421a69}:null;}})[_0xb6a0('0x27')](respondWithResult(_0x6e4eab,null))[_0xb6a0('0x4e')](handleError(_0x6e4eab,null));};exports['addLists']=function(_0x1269a1,_0x2dddfb,_0x5404bd){var _0x5d7aa0=moment()[_0xb6a0('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5ecafb,_0x5c40d8;return db['VoiceQueue'][_0xb6a0('0x50')]({'where':{'id':_0x1269a1[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x2dddfb,null))[_0xb6a0('0x27')](function(_0x26b887){if(_0x26b887){_0x5c40d8=_0x26b887;return _0x26b887[_0xb6a0('0x9a')](_0x1269a1[_0xb6a0('0x51')][_0xb6a0('0x80')],_['omit'](_0x1269a1[_0xb6a0('0x51')],[_0xb6a0('0x80'),'id'])||{});}return null;})[_0xb6a0('0x9b')](function(_0x45a765){var _0x17acec;_0x5ecafb=_0x45a765||[];var _0x4c0cc4=[];if(_0x45a765){for(var _0xfbf7d4=0x0;_0xfbf7d4<_0x45a765[_0xb6a0('0x40')];_0xfbf7d4+=0x1){var _0x881142=_0x45a765[_0xfbf7d4]['get']({'plain':!![]});_0x5c40d8[_0xb6a0('0x9c')]=_0x1269a1[_0xb6a0('0x51')][_0xb6a0('0x9c')]?_0x1269a1[_0xb6a0('0x51')][_0xb6a0('0x9c')]:_0x5c40d8['dialCheckDuplicateType'];switch(_0x5c40d8[_0xb6a0('0x9c')]){case _0xb6a0('0x9d'):_0x17acec=squel[_0xb6a0('0x9e')]()[_0xb6a0('0x9f')](_0xb6a0('0xa0'))[_0xb6a0('0xa1')]([_0xb6a0('0xa2'),_0xb6a0('0xa3'),_0xb6a0('0xa4'),_0xb6a0('0xa5'),_0xb6a0('0x61'),_0xb6a0('0x5d'),_0xb6a0('0x5b')],squel[_0xb6a0('0x82')]()[_0xb6a0('0x83')](_0xb6a0('0xa2'),_0xb6a0('0xa2'))['field']('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0xa3'))[_0xb6a0('0x83')]('id','ContactId')['field'](_0x881142[_0xb6a0('0xa6')][_0xb6a0('0xa7')](),_0xb6a0('0xa5'))['field'](_0x1269a1[_0xb6a0('0x5a')]['id'][_0xb6a0('0xa7')](),_0xb6a0('0x61'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5d'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5b'))[_0xb6a0('0x85')]('cm_contacts')['where'](_0xb6a0('0xa8'))['where'](_0xb6a0('0xa9'),_0x881142[_0xb6a0('0xa6')][_0xb6a0('0xa7')]())[_0xb6a0('0x44')](_0xb6a0('0xaa'))['where'](_0xb6a0('0xab'),squel[_0xb6a0('0x82')]()[_0xb6a0('0x83')](_0xb6a0('0xac'))['from'](_0xb6a0('0xad'))[_0xb6a0('0x44')](_0xb6a0('0x89'),_0x1269a1[_0xb6a0('0x5a')]['id'][_0xb6a0('0xa7')]()))[_0xb6a0('0x44')](_0xb6a0('0xab'),squel[_0xb6a0('0x82')]()[_0xb6a0('0x83')]('COALESCE(phone,\x27\x27)')[_0xb6a0('0x85')](_0xb6a0('0xa0'))[_0xb6a0('0x44')](_0xb6a0('0x89'),_0x1269a1['params']['id'][_0xb6a0('0xa7')]())))[_0xb6a0('0xa7')]();break;case'onlyIfOpen':_0x17acec=squel[_0xb6a0('0x9e')]()[_0xb6a0('0x9f')]('cm_hopper')['fromQuery']([_0xb6a0('0xa2'),_0xb6a0('0xa3'),_0xb6a0('0xa4'),_0xb6a0('0xa5'),_0xb6a0('0x61'),_0xb6a0('0x5d'),_0xb6a0('0x5b')],squel[_0xb6a0('0x82')]()[_0xb6a0('0x83')]('phone',_0xb6a0('0xa2'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27','scheduledAt')[_0xb6a0('0x83')]('id',_0xb6a0('0xa4'))['field'](_0x881142['CmListId'][_0xb6a0('0xa7')](),_0xb6a0('0xa5'))[_0xb6a0('0x83')](_0x1269a1[_0xb6a0('0x5a')]['id'][_0xb6a0('0xa7')](),_0xb6a0('0x61'))['field']('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5d'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27','updatedAt')['from'](_0xb6a0('0xae'))[_0xb6a0('0x44')](_0xb6a0('0xa8'))[_0xb6a0('0x44')](_0xb6a0('0xa9'),_0x881142[_0xb6a0('0xa6')][_0xb6a0('0xa7')]())[_0xb6a0('0x44')](_0xb6a0('0xaa'))[_0xb6a0('0x44')](_0xb6a0('0xab'),squel['select']()[_0xb6a0('0x83')]('COALESCE(phone,\x27\x27)')[_0xb6a0('0x85')](_0xb6a0('0xa0'))[_0xb6a0('0x44')](_0xb6a0('0x89'),_0x1269a1[_0xb6a0('0x5a')]['id'][_0xb6a0('0xa7')]())))['toString']();break;default:_0x17acec=squel['insert']()[_0xb6a0('0x9f')]('cm_hopper')[_0xb6a0('0xa1')]([_0xb6a0('0xa2'),_0xb6a0('0xa3'),_0xb6a0('0xa4'),_0xb6a0('0xa5'),_0xb6a0('0x61'),_0xb6a0('0x5d'),'updatedAt'],squel['select']()[_0xb6a0('0x83')](_0xb6a0('0xa2'),_0xb6a0('0xa2'))['field']('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0xa3'))[_0xb6a0('0x83')]('id','ContactId')['field'](_0x881142[_0xb6a0('0xa6')]['toString'](),_0xb6a0('0xa5'))[_0xb6a0('0x83')](_0x1269a1[_0xb6a0('0x5a')]['id']['toString'](),_0xb6a0('0x61'))['field']('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5d'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5b'))[_0xb6a0('0x85')](_0xb6a0('0xae'))[_0xb6a0('0x44')](_0xb6a0('0xa8'))[_0xb6a0('0x44')]('ListId\x20=\x20?',_0x881142['CmListId'][_0xb6a0('0xa7')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0xb6a0('0xa7')]();}_0x4c0cc4['push'](db[_0xb6a0('0x73')][_0xb6a0('0x3b')](_0x17acec));}return BPromise[_0xb6a0('0x8f')](_0x4c0cc4);}})[_0xb6a0('0x27')](function(){var _0x68fe40=[];var _0x40762c=squel[_0xb6a0('0x9e')]()['into'](_0xb6a0('0xaf'))[_0xb6a0('0xa1')]([_0xb6a0('0xb0'),_0xb6a0('0xa2'),'OrderBy',_0xb6a0('0x5d'),_0xb6a0('0x5b')],squel[_0xb6a0('0x82')]()[_0xb6a0('0x83')](_0xb6a0('0xb1'))[_0xb6a0('0x83')](_0xb6a0('0xb2'))[_0xb6a0('0x83')](_0xb6a0('0xb3'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5d'))[_0xb6a0('0x83')]('\x27'+_0x5d7aa0+'\x27',_0xb6a0('0x5b'))[_0xb6a0('0x85')]('cm_contact_has_items','ci')[_0xb6a0('0x86')](_0xb6a0('0xa0'),'h',_0xb6a0('0xb4'))['where'](_0xb6a0('0xb5'),_0x5d7aa0)[_0xb6a0('0x44')](_0xb6a0('0xb6'),_0xb6a0('0xb7')))[_0xb6a0('0xa7')]();_0x68fe40[_0xb6a0('0xb8')](db[_0xb6a0('0x73')]['query'](_0x40762c));return BPromise['all'](_0x68fe40);})['then'](function(){return _0x5ecafb;})['then'](respondWithResult(_0x2dddfb,null))[_0xb6a0('0x4e')](handleError(_0x2dddfb,null));};exports[_0xb6a0('0xb9')]=function(_0x42fee2,_0x281e08,_0xdc7f88){return db['VoiceQueue'][_0xb6a0('0x50')]({'where':{'id':_0x42fee2[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x281e08,null))[_0xb6a0('0x27')](function(_0x121bc1){if(_0x121bc1){return _0x121bc1[_0xb6a0('0xb9')](_0x42fee2[_0xb6a0('0x3b')][_0xb6a0('0x80')]);}})['then'](function(_0x24e123){if(_0x24e123){return db[_0xb6a0('0x60')][_0xb6a0('0x26')]({'where':{'ListId':_0x42fee2[_0xb6a0('0x3b')]['ids'],'VoiceQueueId':_0x42fee2[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](function(){return _0x24e123;});}})['then'](respondWithStatusCode(_0x281e08,null))[_0xb6a0('0x4e')](handleError(_0x281e08,null));};exports[_0xb6a0('0xba')]=function(_0x15d72a,_0x313a53,_0x17add8){var _0x39622d={};var _0x1ad81e={};var _0x5bc21f;var _0x5f37d1;return db['VoiceQueue'][_0xb6a0('0x5f')]({'where':{'id':_0x15d72a[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0x313a53,null))[_0xb6a0('0x27')](function(_0x31c1a6){if(_0x31c1a6){_0x5bc21f=_0x31c1a6;_0x1ad81e['model']=_['keys'](db['CmList'][_0xb6a0('0x38')]);_0x1ad81e[_0xb6a0('0x3b')]=_[_0xb6a0('0x3c')](_0x15d72a[_0xb6a0('0x3b')]);_0x1ad81e[_0xb6a0('0x45')]=_[_0xb6a0('0x3d')](_0x1ad81e[_0xb6a0('0x3a')],_0x1ad81e[_0xb6a0('0x3b')]);_0x39622d[_0xb6a0('0x3f')]=_[_0xb6a0('0x3d')](_0x1ad81e['model'],qs['fields'](_0x15d72a[_0xb6a0('0x3b')][_0xb6a0('0x3e')]));_0x39622d[_0xb6a0('0x3f')]=_0x39622d[_0xb6a0('0x3f')][_0xb6a0('0x40')]?_0x39622d[_0xb6a0('0x3f')]:_0x1ad81e[_0xb6a0('0x3a')];_0x39622d['order']=qs[_0xb6a0('0x43')](_0x15d72a[_0xb6a0('0x3b')]['sort']);_0x39622d[_0xb6a0('0x44')]=qs['filters'](_['pick'](_0x15d72a['query'],_0x1ad81e[_0xb6a0('0x45')]));if(_0x15d72a['query'][_0xb6a0('0x2c')]){_0x39622d[_0xb6a0('0x44')]=_[_0xb6a0('0x47')](_0x39622d['where'],{'$or':_[_0xb6a0('0x2d')](_0x39622d[_0xb6a0('0x3f')],function(_0x849040){var _0x39529c={};_0x39529c[_0x849040]={'$like':'%'+_0x15d72a['query'][_0xb6a0('0x2c')]+'%'};return _0x39529c;})});}_0x39622d=_[_0xb6a0('0x47')]({},_0x39622d,_0x15d72a[_0xb6a0('0x48')]);return _0x5bc21f['getBlackLists'](_0x39622d);}})['then'](function(_0x4778b7){if(_0x4778b7){_0x5f37d1=_0x4778b7[_0xb6a0('0x40')];if(!_0x15d72a[_0xb6a0('0x3b')][_0xb6a0('0x41')](_0xb6a0('0x42'))){_0x39622d[_0xb6a0('0x21')]=qs['limit'](_0x15d72a['query'][_0xb6a0('0x21')]);_0x39622d['offset']=qs['offset'](_0x15d72a['query'][_0xb6a0('0x1f')]);}return _0x5bc21f[_0xb6a0('0xba')](_0x39622d);}})[_0xb6a0('0x27')](function(_0x51ffe8){if(_0x51ffe8){return _0x51ffe8?{'count':_0x5f37d1,'rows':_0x51ffe8}:null;}})['then'](respondWithResult(_0x313a53,null))[_0xb6a0('0x4e')](handleError(_0x313a53,null));};exports[_0xb6a0('0xbb')]=function(_0x4487d3,_0xa6f4dc,_0x9a35cf){var _0x189e9c,_0x59bf5f;return db[_0xb6a0('0x37')][_0xb6a0('0x50')]({'where':{'id':_0x4487d3['params']['id']}})['then'](handleEntityNotFound(_0xa6f4dc,null))[_0xb6a0('0x27')](function(_0x3171fc){if(_0x3171fc){_0x59bf5f=_0x3171fc;return _0x3171fc['addBlackLists'](_0x4487d3[_0xb6a0('0x51')][_0xb6a0('0x80')],_['omit'](_0x4487d3[_0xb6a0('0x51')],[_0xb6a0('0x80'),'id'])||{});}return null;})['spread'](function(_0x4d8e55){var _0x5954dc;_0x189e9c=_0x4d8e55||[];var _0x4e6ed9=[];if(_0x4d8e55){for(var _0x177a63=0x0;_0x177a63<_0x4d8e55['length'];_0x177a63+=0x1){var _0x2232a1=_0x4d8e55[_0x177a63][_0xb6a0('0x53')]({'plain':!![]});_0x5954dc=squel[_0xb6a0('0x9e')]()[_0xb6a0('0x9f')](_0xb6a0('0xbc'))['fromQuery']([_0xb6a0('0xa2'),_0xb6a0('0xa4'),_0xb6a0('0xa5'),_0xb6a0('0x61'),'createdAt','updatedAt'],squel['select']()[_0xb6a0('0x83')](_0xb6a0('0xa2'),_0xb6a0('0xa2'))['field']('id',_0xb6a0('0xa4'))['field'](_0x2232a1[_0xb6a0('0xa6')]['toString'](),'ListId')[_0xb6a0('0x83')](_0x4487d3[_0xb6a0('0x5a')]['id'][_0xb6a0('0xa7')](),_0xb6a0('0x61'))[_0xb6a0('0x83')]('NOW()',_0xb6a0('0x5d'))[_0xb6a0('0x83')](_0xb6a0('0xbd'),_0xb6a0('0x5b'))[_0xb6a0('0x85')](_0xb6a0('0xae'))[_0xb6a0('0x44')](_0xb6a0('0xa8'))[_0xb6a0('0x44')]('ListId\x20=\x20?',_0x2232a1[_0xb6a0('0xa6')][_0xb6a0('0xa7')]())[_0xb6a0('0x44')](_0xb6a0('0xaa')))[_0xb6a0('0xa7')]();_0x4e6ed9[_0xb6a0('0xb8')](db[_0xb6a0('0x73')][_0xb6a0('0x3b')](_0x5954dc));}return BPromise['all'](_0x4e6ed9);}})[_0xb6a0('0x27')](function(){return _0x189e9c;})[_0xb6a0('0x27')](respondWithResult(_0xa6f4dc,null))[_0xb6a0('0x4e')](handleError(_0xa6f4dc,null));};exports['removeBlackLists']=function(_0x4bc219,_0xc5e535,_0x37a783){return db['VoiceQueue']['find']({'where':{'id':_0x4bc219[_0xb6a0('0x5a')]['id']}})[_0xb6a0('0x27')](handleEntityNotFound(_0xc5e535,null))[_0xb6a0('0x27')](function(_0x3e20e4){if(_0x3e20e4){return _0x3e20e4[_0xb6a0('0xbe')](_0x4bc219[_0xb6a0('0x3b')][_0xb6a0('0x80')]);}})['then'](function(_0x2122d8){if(_0x2122d8){return db[_0xb6a0('0x68')][_0xb6a0('0x26')]({'where':{'ListId':_0x4bc219[_0xb6a0('0x3b')][_0xb6a0('0x80')],'VoiceQueueId':_0x4bc219[_0xb6a0('0x5a')]['id']}})['then'](function(){return _0x2122d8;});}})[_0xb6a0('0x27')](respondWithStatusCode(_0xc5e535,null))[_0xb6a0('0x4e')](handleError(_0xc5e535,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5d4bd24..a37c061 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 _0xc676=['hasOwnProperty','../../mysqldb','VoiceQueue','save','remove','emit'];(function(_0x4aa031,_0x3dd2cf){var _0x5f951=function(_0x43dc26){while(--_0x43dc26){_0x4aa031['push'](_0x4aa031['shift']());}};_0x5f951(++_0x3dd2cf);}(_0xc676,0xdf));var _0x6c67=function(_0x5b8a1a,_0x3206f2){_0x5b8a1a=_0x5b8a1a-0x0;var _0x38243d=_0xc676[_0x5b8a1a];return _0x38243d;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x6c67('0x0'))['db'][_0x6c67('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c67('0x2'),'afterUpdate':'update','afterDestroy':_0x6c67('0x3')};function emitEvent(_0x55d204){return function(_0x11884e,_0x4c0719,_0x2fc8e8){VoiceQueueEvents[_0x6c67('0x4')](_0x55d204+':'+_0x11884e['id'],_0x11884e);VoiceQueueEvents[_0x6c67('0x4')](_0x55d204,_0x11884e);_0x2fc8e8(null);};}for(var e in events){if(events[_0x6c67('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x75e1=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2d7735,_0x42f5fa){var _0x408f53=function(_0x3abd00){while(--_0x3abd00){_0x2d7735['push'](_0x2d7735['shift']());}};_0x408f53(++_0x42f5fa);}(_0x75e1,0x1b0));var _0x175e=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x75e1[_0x26462c];return _0x509a42;};'use strict';var EventEmitter=require(_0x175e('0x0'));var VoiceQueue=require(_0x175e('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x175e('0x2')](0x0);var events={'afterCreate':_0x175e('0x3'),'afterUpdate':_0x175e('0x4'),'afterDestroy':_0x175e('0x5')};function emitEvent(_0x4fe36a){return function(_0x305e7d,_0x129d09,_0x527075){VoiceQueueEvents[_0x175e('0x6')](_0x4fe36a+':'+_0x305e7d['id'],_0x305e7d);VoiceQueueEvents[_0x175e('0x6')](_0x4fe36a,_0x305e7d);_0x527075(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x175e('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 8da832f..78e1995 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x44b259,_0x3192db){var _0x4c6b72=function(_0x2d9682){while(--_0x2d9682){_0x44b259['push'](_0x44b259['shift']());}};_0x4c6b72(++_0x3192db);}(_0x34e8,0x12c));var _0x834e=function(_0x2a53d2,_0x43b8da){_0x2a53d2=_0x2a53d2-0x0;var _0x145f0e=_0x34e8[_0x2a53d2];return _0x145f0e;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x531e48,_0x4bb96b){var _0x202971=function(_0x403bf5){while(--_0x403bf5){_0x531e48['push'](_0x531e48['shift']());}};_0x202971(++_0x4bb96b);}(_0x3e74,0x175));var _0x43e7=function(_0x52c3c2,_0x262644){_0x52c3c2=_0x52c3c2-0x0;var _0x2d830c=_0x3e74[_0x52c3c2];return _0x2d830c;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 37167a1..6c854fe 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 _0xe6f6=['./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','include','map','model','debug','ShowVoiceQueue','find','info','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xe6f6,0x6a));var _0x6e6f=function(_0xf27dbb,_0x4a148d){_0xf27dbb=_0xf27dbb-0x0;var _0x287217=_0xe6f6[_0xf27dbb];return _0x287217;};'use strict';var _=require(_0x6e6f('0x0'));var util=require(_0x6e6f('0x1'));var moment=require('moment');var BPromise=require(_0x6e6f('0x2'));var rs=require(_0x6e6f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e6f('0x4'));var logger=require(_0x6e6f('0x5'))(_0x6e6f('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e6f('0x7'));var client=jayson[_0x6e6f('0x8')][_0x6e6f('0x9')]({'port':0x232a});config[_0x6e6f('0xa')]=_[_0x6e6f('0xb')](config[_0x6e6f('0xa')],{'host':_0x6e6f('0xc'),'port':0x18eb});var socket=require(_0x6e6f('0xd'))(new Redis(config[_0x6e6f('0xa')]));require(_0x6e6f('0xe'))[_0x6e6f('0xf')](socket);function respondWithRpcPromise(_0x3adcbd,_0x2199dd,_0x195df8){return new BPromise(function(_0x8b9335,_0x1b61d3){return client[_0x6e6f('0x10')](_0x3adcbd,_0x195df8)[_0x6e6f('0x11')](function(_0x1a8a79){logger['info'](_0x6e6f('0x12'),_0x2199dd,_0x6e6f('0x13'));logger['debug'](_0x6e6f('0x14'),_0x2199dd,_0x6e6f('0x13'),JSON[_0x6e6f('0x15')](_0x1a8a79));if(_0x1a8a79[_0x6e6f('0x16')]){if(_0x1a8a79['error'][_0x6e6f('0x17')]===0x1f4){logger['error'](_0x6e6f('0x12'),_0x2199dd,_0x1a8a79[_0x6e6f('0x16')]['message']);return _0x1b61d3(_0x1a8a79[_0x6e6f('0x16')]['message']);}logger[_0x6e6f('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2199dd,_0x1a8a79[_0x6e6f('0x16')][_0x6e6f('0x18')]);return _0x8b9335(_0x1a8a79[_0x6e6f('0x16')][_0x6e6f('0x18')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0x2199dd,'request\x20sent');_0x8b9335(_0x1a8a79['result'][_0x6e6f('0x18')]);}})[_0x6e6f('0x19')](function(_0x29d8cf){logger[_0x6e6f('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2199dd,_0x29d8cf);_0x1b61d3(_0x29d8cf);});});}exports[_0x6e6f('0x1a')]=function(_0x3bdc45){var _0x27c501=this;return new Promise(function(_0x3f008d,_0x5ea86b){return db[_0x6e6f('0x1b')][_0x6e6f('0x1c')]({'raw':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45['options'][_0x6e6f('0x1e')]===undefined?!![]:![]:!![],'where':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x1f')]||null:null,'attributes':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x20')]||null:null,'limit':_0x3bdc45['options']?_0x3bdc45[_0x6e6f('0x1d')]['limit']||null:null,'include':_0x3bdc45[_0x6e6f('0x1d')]?_0x3bdc45[_0x6e6f('0x1d')][_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x3bdc45[_0x6e6f('0x1d')]['include'],function(_0x104000){return{'model':db[_0x104000[_0x6e6f('0x23')]],'as':_0x104000['as'],'attributes':_0x104000[_0x6e6f('0x20')],'include':_0x104000[_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x104000[_0x6e6f('0x21')],function(_0x155e2f){return{'model':db[_0x155e2f[_0x6e6f('0x23')]],'as':_0x155e2f['as'],'attributes':_0x155e2f[_0x6e6f('0x20')],'include':_0x155e2f['include']?_[_0x6e6f('0x22')](_0x155e2f[_0x6e6f('0x21')],function(_0x401070){return{'model':db[_0x401070[_0x6e6f('0x23')]],'as':_0x401070['as'],'attributes':_0x401070[_0x6e6f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6e6f('0x11')](function(_0x4a2c60){logger['info'](_0x6e6f('0x1a'),_0x3bdc45);logger[_0x6e6f('0x24')](_0x6e6f('0x1a'),_0x3bdc45,JSON[_0x6e6f('0x15')](_0x4a2c60));_0x3f008d(_0x4a2c60);})['catch'](function(_0x4d1e11){logger['error'](_0x6e6f('0x1a'),_0x4d1e11[_0x6e6f('0x18')],_0x3bdc45);_0x5ea86b(_0x27c501[_0x6e6f('0x16')](0x1f4,_0x4d1e11[_0x6e6f('0x18')]));});});};exports[_0x6e6f('0x25')]=function(_0x4040e5){var _0x5800af=this;return new Promise(function(_0x4fd27b,_0x419ce3){return db['VoiceQueue'][_0x6e6f('0x26')]({'raw':_0x4040e5['options']?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x1e')]===undefined?!![]:![]:!![],'where':_0x4040e5[_0x6e6f('0x1d')]?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x1f')]||null:null,'attributes':_0x4040e5['options']?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x20')]||null:null,'include':_0x4040e5[_0x6e6f('0x1d')]?_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x21')]?_['map'](_0x4040e5[_0x6e6f('0x1d')][_0x6e6f('0x21')],function(_0x235bd6){return{'model':db[_0x235bd6[_0x6e6f('0x23')]],'as':_0x235bd6['as'],'attributes':_0x235bd6['attributes'],'include':_0x235bd6[_0x6e6f('0x21')]?_['map'](_0x235bd6['include'],function(_0x1efc13){return{'model':db[_0x1efc13['model']],'as':_0x1efc13['as'],'attributes':_0x1efc13[_0x6e6f('0x20')],'include':_0x1efc13[_0x6e6f('0x21')]?_[_0x6e6f('0x22')](_0x1efc13[_0x6e6f('0x21')],function(_0x4df619){return{'model':db[_0x4df619[_0x6e6f('0x23')]],'as':_0x4df619['as'],'attributes':_0x4df619[_0x6e6f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22f583){logger[_0x6e6f('0x27')](_0x6e6f('0x25'),_0x4040e5);logger[_0x6e6f('0x24')](_0x6e6f('0x25'),_0x4040e5,JSON[_0x6e6f('0x15')](_0x22f583));_0x4fd27b(_0x22f583);})[_0x6e6f('0x19')](function(_0x654bb2){logger[_0x6e6f('0x16')](_0x6e6f('0x25'),_0x654bb2[_0x6e6f('0x18')],_0x4040e5);_0x419ce3(_0x5800af['error'](0x1f4,_0x654bb2[_0x6e6f('0x18')]));});});}; \ No newline at end of file +var _0xadc4=['GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowVoiceQueue','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','info','result','catch'];(function(_0x3f0ed7,_0x1f439f){var _0x34578f=function(_0x498fe4){while(--_0x498fe4){_0x3f0ed7['push'](_0x3f0ed7['shift']());}};_0x34578f(++_0x1f439f);}(_0xadc4,0xae));var _0x4adc=function(_0x4a9cfa,_0x38de10){_0x4a9cfa=_0x4a9cfa-0x0;var _0x1a795f=_0xadc4[_0x4a9cfa];return _0x1a795f;};'use strict';var _=require(_0x4adc('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4adc('0x1'));var rs=require(_0x4adc('0x2'));var fs=require('fs');var Redis=require(_0x4adc('0x3'));var db=require(_0x4adc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4adc('0x5'))(_0x4adc('0x6'));var config=require(_0x4adc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4adc('0x8')][_0x4adc('0x9')]({'port':0x232a});config[_0x4adc('0xa')]=_[_0x4adc('0xb')](config[_0x4adc('0xa')],{'host':_0x4adc('0xc'),'port':0x18eb});var socket=require(_0x4adc('0xd'))(new Redis(config[_0x4adc('0xa')]));require(_0x4adc('0xe'))['register'](socket);function respondWithRpcPromise(_0x57b5ce,_0x490952,_0x35ad5d){return new BPromise(function(_0x476218,_0x406732){return client[_0x4adc('0xf')](_0x57b5ce,_0x35ad5d)['then'](function(_0x3e76dd){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x490952,_0x4adc('0x10'));logger['debug'](_0x4adc('0x11'),_0x490952,_0x4adc('0x10'),JSON[_0x4adc('0x12')](_0x3e76dd));if(_0x3e76dd[_0x4adc('0x13')]){if(_0x3e76dd['error'][_0x4adc('0x14')]===0x1f4){logger['error'](_0x4adc('0x15'),_0x490952,_0x3e76dd[_0x4adc('0x13')]['message']);return _0x406732(_0x3e76dd[_0x4adc('0x13')][_0x4adc('0x16')]);}logger[_0x4adc('0x13')](_0x4adc('0x15'),_0x490952,_0x3e76dd[_0x4adc('0x13')][_0x4adc('0x16')]);return _0x476218(_0x3e76dd[_0x4adc('0x13')][_0x4adc('0x16')]);}else{logger[_0x4adc('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x490952,'request\x20sent');_0x476218(_0x3e76dd[_0x4adc('0x18')][_0x4adc('0x16')]);}})[_0x4adc('0x19')](function(_0x502c5f){logger[_0x4adc('0x13')](_0x4adc('0x15'),_0x490952,_0x502c5f);_0x406732(_0x502c5f);});});}exports[_0x4adc('0x1a')]=function(_0x5c77dc){var _0x3e301c=this;return new Promise(function(_0x1c8c85,_0x2397f4){return db[_0x4adc('0x1b')][_0x4adc('0x1c')]({'raw':_0x5c77dc[_0x4adc('0x1d')]?_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c77dc[_0x4adc('0x1d')]?_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x1f')]||null:null,'attributes':_0x5c77dc[_0x4adc('0x1d')]?_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x20')]||null:null,'limit':_0x5c77dc[_0x4adc('0x1d')]?_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x21')]||null:null,'include':_0x5c77dc[_0x4adc('0x1d')]?_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x22')]?_[_0x4adc('0x23')](_0x5c77dc[_0x4adc('0x1d')][_0x4adc('0x22')],function(_0x8dc94e){return{'model':db[_0x8dc94e['model']],'as':_0x8dc94e['as'],'attributes':_0x8dc94e[_0x4adc('0x20')],'include':_0x8dc94e[_0x4adc('0x22')]?_['map'](_0x8dc94e[_0x4adc('0x22')],function(_0x4e700e){return{'model':db[_0x4e700e['model']],'as':_0x4e700e['as'],'attributes':_0x4e700e[_0x4adc('0x20')],'include':_0x4e700e[_0x4adc('0x22')]?_[_0x4adc('0x23')](_0x4e700e[_0x4adc('0x22')],function(_0x5091e7){return{'model':db[_0x5091e7[_0x4adc('0x24')]],'as':_0x5091e7['as'],'attributes':_0x5091e7[_0x4adc('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4adc('0x25')](function(_0x581c2c){logger['info'](_0x4adc('0x1a'),_0x5c77dc);logger[_0x4adc('0x26')]('GetVoiceQueue',_0x5c77dc,JSON['stringify'](_0x581c2c));_0x1c8c85(_0x581c2c);})['catch'](function(_0x11839b){logger[_0x4adc('0x13')](_0x4adc('0x1a'),_0x11839b['message'],_0x5c77dc);_0x2397f4(_0x3e301c[_0x4adc('0x13')](0x1f4,_0x11839b[_0x4adc('0x16')]));});});};exports[_0x4adc('0x27')]=function(_0x30ba59){var _0x292fb4=this;return new Promise(function(_0x223dbb,_0xe35d1d){return db[_0x4adc('0x1b')]['find']({'raw':_0x30ba59[_0x4adc('0x1d')]?_0x30ba59[_0x4adc('0x1d')][_0x4adc('0x1e')]===undefined?!![]:![]:!![],'where':_0x30ba59['options']?_0x30ba59[_0x4adc('0x1d')][_0x4adc('0x1f')]||null:null,'attributes':_0x30ba59[_0x4adc('0x1d')]?_0x30ba59[_0x4adc('0x1d')][_0x4adc('0x20')]||null:null,'include':_0x30ba59[_0x4adc('0x1d')]?_0x30ba59[_0x4adc('0x1d')][_0x4adc('0x22')]?_[_0x4adc('0x23')](_0x30ba59[_0x4adc('0x1d')][_0x4adc('0x22')],function(_0x1259af){return{'model':db[_0x1259af[_0x4adc('0x24')]],'as':_0x1259af['as'],'attributes':_0x1259af[_0x4adc('0x20')],'include':_0x1259af[_0x4adc('0x22')]?_[_0x4adc('0x23')](_0x1259af[_0x4adc('0x22')],function(_0x1ed2b6){return{'model':db[_0x1ed2b6[_0x4adc('0x24')]],'as':_0x1ed2b6['as'],'attributes':_0x1ed2b6[_0x4adc('0x20')],'include':_0x1ed2b6['include']?_['map'](_0x1ed2b6['include'],function(_0x320c49){return{'model':db[_0x320c49[_0x4adc('0x24')]],'as':_0x320c49['as'],'attributes':_0x320c49[_0x4adc('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c5452){logger[_0x4adc('0x17')]('ShowVoiceQueue',_0x30ba59);logger['debug']('ShowVoiceQueue',_0x30ba59,JSON[_0x4adc('0x12')](_0x1c5452));_0x223dbb(_0x1c5452);})[_0x4adc('0x19')](function(_0x33df41){logger[_0x4adc('0x13')](_0x4adc('0x27'),_0x33df41['message'],_0x30ba59);_0xe35d1d(_0x292fb4[_0x4adc('0x13')](0x1f4,_0x33df41['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 5527f65..cc99bfa 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 _0x0094=['./voiceQueue.events','save','remove','update','emit','removeListener','register','length','voiceQueue:'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x0094,0x1e6));var _0x4009=function(_0x10626e,_0x5d5d84){_0x10626e=_0x10626e-0x0;var _0x4b2b33=_0x0094[_0x10626e];return _0x4b2b33;};'use strict';var VoiceQueueEvents=require(_0x4009('0x0'));var events=[_0x4009('0x1'),_0x4009('0x2'),_0x4009('0x3')];function createListener(_0x4dad66,_0x1b3d3e){return function(_0x46a23f){_0x1b3d3e[_0x4009('0x4')](_0x4dad66,_0x46a23f);};}function removeListener(_0x29dd4d,_0x5419f9){return function(){VoiceQueueEvents[_0x4009('0x5')](_0x29dd4d,_0x5419f9);};}exports[_0x4009('0x6')]=function(_0x21b334){for(var _0x75faf0=0x0,_0xfcb34=events[_0x4009('0x7')];_0x75faf0<_0xfcb34;_0x75faf0++){var _0x109e6a=events[_0x75faf0];var _0x4cb98e=createListener(_0x4009('0x8')+_0x109e6a,_0x21b334);VoiceQueueEvents['on'](_0x109e6a,_0x4cb98e);}}; \ No newline at end of file +var _0xb524=['save','update','register','length','voiceQueue:','./voiceQueue.events'];(function(_0x743c19,_0x18bde7){var _0x1745e0=function(_0x264675){while(--_0x264675){_0x743c19['push'](_0x743c19['shift']());}};_0x1745e0(++_0x18bde7);}(_0xb524,0x15b));var _0x4b52=function(_0x4ff2c3,_0x3b7bd7){_0x4ff2c3=_0x4ff2c3-0x0;var _0x403e0f=_0xb524[_0x4ff2c3];return _0x403e0f;};'use strict';var VoiceQueueEvents=require(_0x4b52('0x0'));var events=[_0x4b52('0x1'),'remove',_0x4b52('0x2')];function createListener(_0x10f60c,_0x4e6425){return function(_0x2efb20){_0x4e6425['emit'](_0x10f60c,_0x2efb20);};}function removeListener(_0x1f973a,_0x2b397a){return function(){VoiceQueueEvents['removeListener'](_0x1f973a,_0x2b397a);};}exports[_0x4b52('0x3')]=function(_0x472d5b){for(var _0x5eee38=0x0,_0x52c0dc=events[_0x4b52('0x4')];_0x5eee38<_0x52c0dc;_0x5eee38++){var _0x1230fc=events[_0x5eee38];var _0x31676f=createListener(_0x4b52('0x5')+_0x1230fc,_0x472d5b);VoiceQueueEvents['on'](_0x1230fc,_0x31676f);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index bfe0235..2e343fa 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 _0xcfe4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','delete','exports'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0xcfe4,0x9a));var _0x4cfe=function(_0x4819cc,_0x4bb9f2){_0x4819cc=_0x4819cc-0x0;var _0x31851d=_0xcfe4[_0x4819cc];return _0x31851d;};'use strict';var multer=require(_0x4cfe('0x0'));var util=require(_0x4cfe('0x1'));var path=require(_0x4cfe('0x2'));var timeout=require(_0x4cfe('0x3'));var express=require(_0x4cfe('0x4'));var router=express[_0x4cfe('0x5')]();var fs_extra=require(_0x4cfe('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4cfe('0x7'));var config=require(_0x4cfe('0x8'));var controller=require(_0x4cfe('0x9'));router[_0x4cfe('0xa')]('/',auth['isAuthenticated'](),controller[_0x4cfe('0xb')]);router[_0x4cfe('0xa')](_0x4cfe('0xc'),auth['isAuthenticated'](),controller[_0x4cfe('0xd')]);router[_0x4cfe('0xa')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0x4cfe('0xa')](_0x4cfe('0xe'),auth[_0x4cfe('0xf')](),controller[_0x4cfe('0x10')]);router[_0x4cfe('0x11')]('/',auth[_0x4cfe('0xf')](),controller[_0x4cfe('0x12')]);router[_0x4cfe('0x13')](_0x4cfe('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x4cfe('0x14')](_0x4cfe('0xe'),auth[_0x4cfe('0xf')](),controller['destroy']);module[_0x4cfe('0x15')]=router; \ No newline at end of file +var _0x9c39=['describe','/index','getVoiceQueuesReport','/:id','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x243a3b,_0x57f2a9){var _0x3568a1=function(_0x499170){while(--_0x499170){_0x243a3b['push'](_0x243a3b['shift']());}};_0x3568a1(++_0x57f2a9);}(_0x9c39,0x78));var _0x99c3=function(_0x47408e,_0x481428){_0x47408e=_0x47408e-0x0;var _0x1636bc=_0x9c39[_0x47408e];return _0x1636bc;};'use strict';var multer=require(_0x99c3('0x0'));var util=require('util');var path=require(_0x99c3('0x1'));var timeout=require(_0x99c3('0x2'));var express=require('express');var router=express[_0x99c3('0x3')]();var fs_extra=require(_0x99c3('0x4'));var auth=require(_0x99c3('0x5'));var interaction=require(_0x99c3('0x6'));var config=require('../../config/environment');var controller=require(_0x99c3('0x7'));router[_0x99c3('0x8')]('/',auth[_0x99c3('0x9')](),controller[_0x99c3('0xa')]);router['get'](_0x99c3('0xb'),auth[_0x99c3('0x9')](),controller[_0x99c3('0xc')]);router['get'](_0x99c3('0xd'),auth[_0x99c3('0x9')](),controller[_0x99c3('0xe')]);router[_0x99c3('0x8')](_0x99c3('0xf'),auth[_0x99c3('0x9')](),controller['show']);router[_0x99c3('0x10')]('/',auth[_0x99c3('0x9')](),controller[_0x99c3('0x11')]);router[_0x99c3('0x12')](_0x99c3('0xf'),auth[_0x99c3('0x9')](),controller[_0x99c3('0x13')]);router['delete'](_0x99c3('0xf'),auth['isAuthenticated'](),controller[_0x99c3('0x14')]);module[_0x99c3('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 538178a..0340a0b 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 _0x04c0=['STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x50aa8d,_0x5efabf){var _0x3f1abb=function(_0x3e8e75){while(--_0x3e8e75){_0x50aa8d['push'](_0x50aa8d['shift']());}};_0x3f1abb(++_0x5efabf);}(_0x04c0,0x11e));var _0x004c=function(_0x559e89,_0x231e84){_0x559e89=_0x559e89-0x0;var _0x3877a2=_0x04c0[_0x559e89];return _0x3877a2;};'use strict';var Sequelize=require(_0x004c('0x0'));var moment=require(_0x004c('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x004c('0x2')]},'calleridnum':{'type':Sequelize[_0x004c('0x2')]},'calleridname':{'type':Sequelize[_0x004c('0x2')]},'queue':{'type':Sequelize[_0x004c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x004c('0x3')],'set':function(_0x38773e){var _0x3fde8f=moment(_0x38773e);var _0xd7ff69=moment(this[_0x004c('0x4')](_0x004c('0x5')))[_0x004c('0x6')](_0x004c('0x7'));var _0x55f37f=_0x3fde8f['diff'](_0xd7ff69,_0x004c('0x8'));this[_0x004c('0x9')](_0x004c('0xa'),_0x38773e);this[_0x004c('0x9')](_0x004c('0xb'),_0x55f37f||null);}},'position':{'type':Sequelize[_0x004c('0xc')]},'count':{'type':Sequelize[_0x004c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x004c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x004c('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x004c('0x2')],'comment':_0x004c('0xe')},'originalposition':{'type':Sequelize[_0x004c('0xc')]},'channel':{'type':Sequelize[_0x004c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x004c('0x2')]},'connectedlinename':{'type':Sequelize[_0x004c('0x2')]},'accountcode':{'type':Sequelize[_0x004c('0x2')]},'context':{'type':Sequelize[_0x004c('0x2')]},'exten':{'type':Sequelize[_0x004c('0x2')]},'priority':{'type':Sequelize[_0x004c('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x004c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x004c('0x2')],'comment':_0x004c('0xf')},'transferexten':{'type':Sequelize[_0x004c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x004c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x004c('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa2fe=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xa2fe,0x153));var _0xea2f=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xa2fe[_0x11e03f];return _0x5666fe;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xea2f('0x0'));module[_0xea2f('0x1')]={'type':{'type':Sequelize[_0xea2f('0x2')]},'uniqueid':{'type':Sequelize[_0xea2f('0x2')]},'calleridnum':{'type':Sequelize[_0xea2f('0x2')]},'calleridname':{'type':Sequelize[_0xea2f('0x2')]},'queue':{'type':Sequelize[_0xea2f('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xea2f('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xea2f('0x3')],'set':function(_0x306a79){var _0x41c9f1=moment(_0x306a79);var _0x8ecaf4=moment(this[_0xea2f('0x4')](_0xea2f('0x5')))[_0xea2f('0x6')](_0xea2f('0x7'));var _0x32e6d7=_0x41c9f1[_0xea2f('0x8')](_0x8ecaf4,_0xea2f('0x9'));this['setDataValue'](_0xea2f('0xa'),_0x306a79);this['setDataValue'](_0xea2f('0xb'),_0x32e6d7||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xea2f('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xea2f('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xea2f('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xea2f('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xea2f('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xea2f('0x2')],'comment':_0xea2f('0xe')},'originalposition':{'type':Sequelize[_0xea2f('0xc')]},'channel':{'type':Sequelize[_0xea2f('0x2')]},'connectedlinenum':{'type':Sequelize[_0xea2f('0x2')]},'connectedlinename':{'type':Sequelize[_0xea2f('0x2')]},'accountcode':{'type':Sequelize[_0xea2f('0x2')]},'context':{'type':Sequelize[_0xea2f('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xea2f('0x2')]},'holdtime':{'type':Sequelize[_0xea2f('0xc')]},'mohtime':{'type':Sequelize[_0xea2f('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xea2f('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xea2f('0x2')]},'transfer':{'type':Sequelize[_0xea2f('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xea2f('0xf')},'transferexten':{'type':Sequelize[_0xea2f('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xea2f('0x2')]},'secondDisposition':{'type':Sequelize[_0xea2f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xea2f('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xea2f('0xc')],'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 46c6b82..f09cd78 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 _0x5cd7=['squel','crypto','jsforce','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','update','then','name','send','index','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','show','length','find','catch','create','body','params','destroy','describe','getVoiceQueuesReport','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1b04b1,_0x37b1cb){var _0x3479f8=function(_0x2fd831){while(--_0x2fd831){_0x1b04b1['push'](_0x1b04b1['shift']());}};_0x3479f8(++_0x37b1cb);}(_0x5cd7,0x132));var _0x75cd=function(_0x218ca4,_0x41cc40){_0x218ca4=_0x218ca4-0x0;var _0x1b3ff9=_0x5cd7[_0x218ca4];return _0x1b3ff9;};'use strict';var emlformat=require(_0x75cd('0x0'));var rimraf=require(_0x75cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x75cd('0x2'));var rp=require(_0x75cd('0x3'));var moment=require(_0x75cd('0x4'));var BPromise=require(_0x75cd('0x5'));var Mustache=require(_0x75cd('0x6'));var util=require(_0x75cd('0x7'));var path=require(_0x75cd('0x8'));var sox=require(_0x75cd('0x9'));var csv=require(_0x75cd('0xa'));var ejs=require(_0x75cd('0xb'));var fs=require('fs');var fs_extra=require(_0x75cd('0xc'));var _=require(_0x75cd('0xd'));var squel=require(_0x75cd('0xe'));var crypto=require(_0x75cd('0xf'));var jsforce=require(_0x75cd('0x10'));var deskjs=require(_0x75cd('0x11'));var toCsv=require(_0x75cd('0xa'));var querystring=require(_0x75cd('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75cd('0x13'));var hardwareService=require(_0x75cd('0x14'));var logger=require(_0x75cd('0x15'))('api');var utils=require(_0x75cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x75cd('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x75cd('0x18')](config[_0x75cd('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x75cd('0x1a'))(new Redis(config['redis']));require(_0x75cd('0x1b'))[_0x75cd('0x1c')](socket);function respondWithStatusCode(_0x4ebfb9,_0x2cd091){_0x2cd091=_0x2cd091||0xcc;return function(_0xeeb7dd){if(_0xeeb7dd){return _0x4ebfb9[_0x75cd('0x1d')](_0x2cd091);}return _0x4ebfb9['status'](_0x2cd091)[_0x75cd('0x1e')]();};}function respondWithResult(_0x596291,_0x2becd7){_0x2becd7=_0x2becd7||0xc8;return function(_0x392b02){if(_0x392b02){return _0x596291[_0x75cd('0x1f')](_0x2becd7)[_0x75cd('0x20')](_0x392b02);}};}function respondWithFilteredResult(_0x23d14b,_0x22de96){return function(_0x4e1dc6){if(_0x4e1dc6){var _0x225bf6=typeof _0x22de96[_0x75cd('0x21')]===_0x75cd('0x22')&&typeof _0x22de96['limit']===_0x75cd('0x22');var _0x22bf55=_0x4e1dc6[_0x75cd('0x23')];var _0x1a8f1a=_0x225bf6?0x0:_0x22de96[_0x75cd('0x21')];var _0xbcb79d=_0x225bf6?_0x4e1dc6[_0x75cd('0x23')]:_0x22de96[_0x75cd('0x21')]+_0x22de96[_0x75cd('0x24')];var _0x19b85d;if(_0xbcb79d>=_0x22bf55){_0xbcb79d=_0x22bf55;_0x19b85d=0xc8;}else{_0x19b85d=0xce;}_0x23d14b[_0x75cd('0x1f')](_0x19b85d);return _0x23d14b[_0x75cd('0x25')]('Content-Range',_0x1a8f1a+'-'+_0xbcb79d+'/'+_0x22bf55)[_0x75cd('0x20')](_0x4e1dc6);}return null;};}function patchUpdates(_0x5bfd08){return function(_0x243258){try{jsonpatch[_0x75cd('0x26')](_0x243258,_0x5bfd08,!![]);}catch(_0xc166ee){return BPromise['reject'](_0xc166ee);}return _0x243258['save']();};}function saveUpdates(_0x3681e4,_0x3ae4f6){return function(_0x1ec62f){if(_0x1ec62f){return _0x1ec62f[_0x75cd('0x27')](_0x3681e4)[_0x75cd('0x28')](function(_0x453cd5){return _0x453cd5;});}return null;};}function removeEntity(_0x3e1c4e,_0x1e0045){return function(_0x337000){if(_0x337000){return _0x337000['destroy']()[_0x75cd('0x28')](function(){_0x3e1c4e[_0x75cd('0x1f')](0xcc)[_0x75cd('0x1e')]();});}};}function handleEntityNotFound(_0x38a319,_0x5e048c){return function(_0x2fc8a1){if(!_0x2fc8a1){_0x38a319[_0x75cd('0x1d')](0x194);}return _0x2fc8a1;};}function handleError(_0x24e8db,_0x28dbd0){_0x28dbd0=_0x28dbd0||0x1f4;return function(_0x16b292){logger['error'](_0x16b292['stack']);if(_0x16b292['name']){delete _0x16b292[_0x75cd('0x29')];}_0x24e8db[_0x75cd('0x1f')](_0x28dbd0)[_0x75cd('0x2a')](_0x16b292);};}exports[_0x75cd('0x2b')]=function(_0x5b1242,_0x588d51){var _0x555240={},_0x2f4a38={},_0x4f1dc8={'count':0x0,'rows':[]};var _0x29cece=_['map'](db['VoiceQueueReport'][_0x75cd('0x2c')],function(_0x2390b9){return{'name':_0x2390b9['fieldName'],'type':_0x2390b9[_0x75cd('0x2d')][_0x75cd('0x2e')]};});_0x2f4a38[_0x75cd('0x2f')]=_['map'](_0x29cece,_0x75cd('0x29'));_0x2f4a38[_0x75cd('0x30')]=_[_0x75cd('0x31')](_0x5b1242[_0x75cd('0x30')]);_0x2f4a38[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0x2f4a38[_0x75cd('0x2f')],_0x2f4a38['query']);_0x555240[_0x75cd('0x34')]=_[_0x75cd('0x33')](_0x2f4a38['model'],qs[_0x75cd('0x35')](_0x5b1242[_0x75cd('0x30')][_0x75cd('0x35')]));_0x555240['attributes']=_0x555240[_0x75cd('0x34')]['length']?_0x555240['attributes']:_0x2f4a38[_0x75cd('0x2f')];if(!_0x5b1242['query'][_0x75cd('0x36')](_0x75cd('0x37'))){_0x555240['limit']=qs['limit'](_0x5b1242['query'][_0x75cd('0x24')]);_0x555240[_0x75cd('0x21')]=qs[_0x75cd('0x21')](_0x5b1242['query'][_0x75cd('0x21')]);}_0x555240[_0x75cd('0x38')]=qs['sort'](_0x5b1242[_0x75cd('0x30')][_0x75cd('0x39')]);_0x555240[_0x75cd('0x3a')]=qs[_0x75cd('0x32')](_[_0x75cd('0x3b')](_0x5b1242[_0x75cd('0x30')],_0x2f4a38['filters']),_0x29cece);if(_0x5b1242[_0x75cd('0x30')][_0x75cd('0x3c')]){_0x555240[_0x75cd('0x3a')]=_[_0x75cd('0x3d')](_0x555240[_0x75cd('0x3a')],{'$or':_['map'](_0x29cece,function(_0x28da94){if(_0x28da94[_0x75cd('0x2d')]!==_0x75cd('0x3e')){var _0x480381={};_0x480381[_0x28da94[_0x75cd('0x29')]]={'$like':'%'+_0x5b1242[_0x75cd('0x30')][_0x75cd('0x3c')]+'%'};return _0x480381;}})});}_0x555240=_['merge']({},_0x555240,_0x5b1242[_0x75cd('0x3f')]);var _0x345ac5={'where':_0x555240['where']};return db[_0x75cd('0x40')][_0x75cd('0x23')](_0x345ac5)[_0x75cd('0x28')](function(_0x1e532b){_0x4f1dc8[_0x75cd('0x23')]=_0x1e532b;if(_0x5b1242['query'][_0x75cd('0x41')]){_0x555240[_0x75cd('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x75cd('0x43')](_0x555240);})[_0x75cd('0x28')](function(_0xd53c1e){_0x4f1dc8[_0x75cd('0x44')]=_0xd53c1e;return _0x4f1dc8;})[_0x75cd('0x28')](respondWithFilteredResult(_0x588d51,_0x555240))['catch'](handleError(_0x588d51,null));};exports[_0x75cd('0x45')]=function(_0xb69958,_0x434af8){var _0x40a307={'raw':![],'where':{'id':_0xb69958['params']['id']}},_0x5f0387={};_0x5f0387[_0x75cd('0x2f')]=_[_0x75cd('0x31')](db['VoiceQueueReport'][_0x75cd('0x2c')]);_0x5f0387['query']=_[_0x75cd('0x31')](_0xb69958['query']);_0x5f0387[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0x5f0387[_0x75cd('0x2f')],_0x5f0387[_0x75cd('0x30')]);_0x40a307[_0x75cd('0x34')]=_[_0x75cd('0x33')](_0x5f0387['model'],qs['fields'](_0xb69958['query'][_0x75cd('0x35')]));_0x40a307['attributes']=_0x40a307[_0x75cd('0x34')][_0x75cd('0x46')]?_0x40a307[_0x75cd('0x34')]:_0x5f0387['model'];if(_0xb69958[_0x75cd('0x30')][_0x75cd('0x41')]){_0x40a307[_0x75cd('0x42')]=[{'all':!![]}];}_0x40a307=_['merge']({},_0x40a307,_0xb69958[_0x75cd('0x3f')]);return db[_0x75cd('0x40')][_0x75cd('0x47')](_0x40a307)[_0x75cd('0x28')](handleEntityNotFound(_0x434af8,null))[_0x75cd('0x28')](respondWithResult(_0x434af8,null))[_0x75cd('0x48')](handleError(_0x434af8,null));};exports[_0x75cd('0x49')]=function(_0x5e1bd6,_0x2c7329){return db[_0x75cd('0x40')][_0x75cd('0x49')](_0x5e1bd6[_0x75cd('0x4a')],{})[_0x75cd('0x28')](respondWithResult(_0x2c7329,0xc9))['catch'](handleError(_0x2c7329,null));};exports[_0x75cd('0x27')]=function(_0x429543,_0x100f13){if(_0x429543['body']['id']){delete _0x429543[_0x75cd('0x4a')]['id'];}return db[_0x75cd('0x40')][_0x75cd('0x47')]({'where':{'id':_0x429543[_0x75cd('0x4b')]['id']}})[_0x75cd('0x28')](handleEntityNotFound(_0x100f13,null))[_0x75cd('0x28')](saveUpdates(_0x429543[_0x75cd('0x4a')],null))[_0x75cd('0x28')](respondWithResult(_0x100f13,null))[_0x75cd('0x48')](handleError(_0x100f13,null));};exports[_0x75cd('0x4c')]=function(_0x3e71af,_0x1eac8a){return db[_0x75cd('0x40')]['find']({'where':{'id':_0x3e71af[_0x75cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1eac8a,null))['then'](removeEntity(_0x1eac8a,null))['catch'](handleError(_0x1eac8a,null));};exports['describe']=function(_0x3132f0,_0x4066fb){return db[_0x75cd('0x40')][_0x75cd('0x4d')]()[_0x75cd('0x28')](respondWithResult(_0x4066fb,null))[_0x75cd('0x48')](handleError(_0x4066fb,null));};exports[_0x75cd('0x4e')]=function(_0x58916b,_0x5d509d){var _0x482c76={},_0xc577bd={},_0x397580={'count':0x0,'rows':[]};_0xc577bd['model']=_[_0x75cd('0x31')](db[_0x75cd('0x40')][_0x75cd('0x2c')]);_0xc577bd[_0x75cd('0x30')]=_['keys'](_0x58916b['query']);_0xc577bd[_0x75cd('0x32')]=_[_0x75cd('0x33')](_0xc577bd[_0x75cd('0x2f')],_0xc577bd['query']);_0x482c76['attributes']=_[_0x75cd('0x33')](_0xc577bd[_0x75cd('0x2f')],qs[_0x75cd('0x35')](_0x58916b['query'][_0x75cd('0x35')]));_0x482c76[_0x75cd('0x34')]=_0x482c76[_0x75cd('0x34')][_0x75cd('0x46')]?_0x482c76[_0x75cd('0x34')]:_0xc577bd['model'];if(!_0x58916b[_0x75cd('0x30')][_0x75cd('0x36')]('nolimit')){_0x482c76[_0x75cd('0x24')]=qs[_0x75cd('0x24')](_0x58916b['query'][_0x75cd('0x24')]);_0x482c76[_0x75cd('0x21')]=qs[_0x75cd('0x21')](_0x58916b[_0x75cd('0x30')][_0x75cd('0x21')]);}_0x482c76['order']=qs[_0x75cd('0x39')](_0x58916b['query'][_0x75cd('0x39')]);_0x482c76[_0x75cd('0x3a')]=qs[_0x75cd('0x32')](_[_0x75cd('0x3b')](_0x58916b[_0x75cd('0x30')],_0xc577bd[_0x75cd('0x32')]));if(_0x58916b[_0x75cd('0x30')][_0x75cd('0x3c')]){_0x482c76['where']=_['merge'](_0x482c76[_0x75cd('0x3a')],{'$or':_[_0x75cd('0x4f')](_0x482c76[_0x75cd('0x34')],function(_0x3fb502){var _0x45b1fb={};_0x45b1fb[_0x3fb502]={'$like':'%'+_0x58916b[_0x75cd('0x30')][_0x75cd('0x3c')]+'%'};return _0x45b1fb;})});}_0x482c76=_['merge']({},_0x482c76,_0x58916b[_0x75cd('0x3f')]);var _0x27c23a={'where':_0x482c76[_0x75cd('0x3a')]};return db['VoiceQueueReport'][_0x75cd('0x23')](_0x27c23a)[_0x75cd('0x28')](function(_0x50a29a){_0x397580[_0x75cd('0x23')]=_0x50a29a;if(_0x58916b['query'][_0x75cd('0x41')]){_0x482c76[_0x75cd('0x42')]=[{'all':!![]}];}return db[_0x75cd('0x40')]['findAll'](_0x482c76);})[_0x75cd('0x28')](function(_0x5c32e4){_0x397580[_0x75cd('0x44')]=_0x5c32e4;return _0x397580;})[_0x75cd('0x28')](respondWithFilteredResult(_0x5d509d,_0x482c76,_0x75cd('0x4e')))[_0x75cd('0x48')](handleError(_0x5d509d,null,_0x75cd('0x4e')));}; \ No newline at end of file +var _0x3f6a=['register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','reject','save','destroy','then','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','VoiceQueueReport','findAll','catch','show','create','body','update','find','params','describe','getVoiceQueuesReport','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket'];(function(_0x313394,_0x5b9ab4){var _0x98303e=function(_0x40a998){while(--_0x40a998){_0x313394['push'](_0x313394['shift']());}};_0x98303e(++_0x5b9ab4);}(_0x3f6a,0xde));var _0xa3f6=function(_0x31f414,_0x46f103){_0x31f414=_0x31f414-0x0;var _0x382d4a=_0x3f6a[_0x31f414];return _0x382d4a;};'use strict';var emlformat=require(_0xa3f6('0x0'));var rimraf=require(_0xa3f6('0x1'));var zipdir=require(_0xa3f6('0x2'));var jsonpatch=require(_0xa3f6('0x3'));var rp=require(_0xa3f6('0x4'));var moment=require('moment');var BPromise=require(_0xa3f6('0x5'));var Mustache=require(_0xa3f6('0x6'));var util=require('util');var path=require(_0xa3f6('0x7'));var sox=require('sox');var csv=require(_0xa3f6('0x8'));var ejs=require(_0xa3f6('0x9'));var fs=require('fs');var fs_extra=require(_0xa3f6('0xa'));var _=require(_0xa3f6('0xb'));var squel=require(_0xa3f6('0xc'));var crypto=require(_0xa3f6('0xd'));var jsforce=require(_0xa3f6('0xe'));var deskjs=require(_0xa3f6('0xf'));var toCsv=require(_0xa3f6('0x8'));var querystring=require('querystring');var Papa=require(_0xa3f6('0x10'));var Redis=require(_0xa3f6('0x11'));var authService=require(_0xa3f6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa3f6('0x13'));var hardwareService=require(_0xa3f6('0x14'));var logger=require(_0xa3f6('0x15'))(_0xa3f6('0x16'));var utils=require('../../config/utils');var config=require(_0xa3f6('0x17'));var licenseUtil=require(_0xa3f6('0x18'));var db=require('../../mysqldb')['db'];config[_0xa3f6('0x19')]=_[_0xa3f6('0x1a')](config[_0xa3f6('0x19')],{'host':_0xa3f6('0x1b'),'port':0x18eb});var socket=require(_0xa3f6('0x1c'))(new Redis(config['redis']));require(_0xa3f6('0x1d'))[_0xa3f6('0x1e')](socket);function respondWithStatusCode(_0xd4bbad,_0x11ee28){_0x11ee28=_0x11ee28||0xcc;return function(_0x2a499e){if(_0x2a499e){return _0xd4bbad[_0xa3f6('0x1f')](_0x11ee28);}return _0xd4bbad['status'](_0x11ee28)[_0xa3f6('0x20')]();};}function respondWithResult(_0x29ea1a,_0x28ed7b){_0x28ed7b=_0x28ed7b||0xc8;return function(_0x29062b){if(_0x29062b){return _0x29ea1a[_0xa3f6('0x21')](_0x28ed7b)['json'](_0x29062b);}};}function respondWithFilteredResult(_0x2ad7a2,_0x5472cf){return function(_0x4c08ce){if(_0x4c08ce){var _0x439e2b=typeof _0x5472cf[_0xa3f6('0x22')]===_0xa3f6('0x23')&&typeof _0x5472cf[_0xa3f6('0x24')]===_0xa3f6('0x23');var _0x15353d=_0x4c08ce[_0xa3f6('0x25')];var _0x468c83=_0x439e2b?0x0:_0x5472cf[_0xa3f6('0x22')];var _0x42ef2f=_0x439e2b?_0x4c08ce[_0xa3f6('0x25')]:_0x5472cf['offset']+_0x5472cf['limit'];var _0x3c2365;if(_0x42ef2f>=_0x15353d){_0x42ef2f=_0x15353d;_0x3c2365=0xc8;}else{_0x3c2365=0xce;}_0x2ad7a2[_0xa3f6('0x21')](_0x3c2365);return _0x2ad7a2['set'](_0xa3f6('0x26'),_0x468c83+'-'+_0x42ef2f+'/'+_0x15353d)[_0xa3f6('0x27')](_0x4c08ce);}return null;};}function patchUpdates(_0x2178f1){return function(_0x163acf){try{jsonpatch['apply'](_0x163acf,_0x2178f1,!![]);}catch(_0x1eda2c){return BPromise[_0xa3f6('0x28')](_0x1eda2c);}return _0x163acf[_0xa3f6('0x29')]();};}function saveUpdates(_0x4cd122,_0x208fec){return function(_0x45e2e8){if(_0x45e2e8){return _0x45e2e8['update'](_0x4cd122)['then'](function(_0x37dd66){return _0x37dd66;});}return null;};}function removeEntity(_0x1f95c4,_0x425792){return function(_0x9afffd){if(_0x9afffd){return _0x9afffd[_0xa3f6('0x2a')]()[_0xa3f6('0x2b')](function(){_0x1f95c4[_0xa3f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9785,_0x18b85b){return function(_0x138d56){if(!_0x138d56){_0x1e9785[_0xa3f6('0x1f')](0x194);}return _0x138d56;};}function handleError(_0x7dd878,_0x1db014){_0x1db014=_0x1db014||0x1f4;return function(_0x330ec4){logger[_0xa3f6('0x2c')](_0x330ec4[_0xa3f6('0x2d')]);if(_0x330ec4[_0xa3f6('0x2e')]){delete _0x330ec4[_0xa3f6('0x2e')];}_0x7dd878[_0xa3f6('0x21')](_0x1db014)[_0xa3f6('0x2f')](_0x330ec4);};}exports[_0xa3f6('0x30')]=function(_0xac0c85,_0x450b05){var _0x3d3bd4={},_0xa0cdbb={},_0x9e1445={'count':0x0,'rows':[]};var _0x2748d6=_[_0xa3f6('0x31')](db['VoiceQueueReport'][_0xa3f6('0x32')],function(_0x72bb85){return{'name':_0x72bb85['fieldName'],'type':_0x72bb85['type'][_0xa3f6('0x33')]};});_0xa0cdbb[_0xa3f6('0x34')]=_['map'](_0x2748d6,'name');_0xa0cdbb[_0xa3f6('0x35')]=_[_0xa3f6('0x36')](_0xac0c85[_0xa3f6('0x35')]);_0xa0cdbb[_0xa3f6('0x37')]=_[_0xa3f6('0x38')](_0xa0cdbb[_0xa3f6('0x34')],_0xa0cdbb[_0xa3f6('0x35')]);_0x3d3bd4['attributes']=_[_0xa3f6('0x38')](_0xa0cdbb['model'],qs[_0xa3f6('0x39')](_0xac0c85['query'][_0xa3f6('0x39')]));_0x3d3bd4[_0xa3f6('0x3a')]=_0x3d3bd4['attributes'][_0xa3f6('0x3b')]?_0x3d3bd4[_0xa3f6('0x3a')]:_0xa0cdbb[_0xa3f6('0x34')];if(!_0xac0c85[_0xa3f6('0x35')][_0xa3f6('0x3c')](_0xa3f6('0x3d'))){_0x3d3bd4['limit']=qs[_0xa3f6('0x24')](_0xac0c85[_0xa3f6('0x35')][_0xa3f6('0x24')]);_0x3d3bd4[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0xac0c85[_0xa3f6('0x35')]['offset']);}_0x3d3bd4[_0xa3f6('0x3e')]=qs[_0xa3f6('0x3f')](_0xac0c85[_0xa3f6('0x35')][_0xa3f6('0x3f')]);_0x3d3bd4['where']=qs[_0xa3f6('0x37')](_[_0xa3f6('0x40')](_0xac0c85[_0xa3f6('0x35')],_0xa0cdbb['filters']),_0x2748d6);if(_0xac0c85[_0xa3f6('0x35')][_0xa3f6('0x41')]){_0x3d3bd4[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x3d3bd4['where'],{'$or':_[_0xa3f6('0x31')](_0x2748d6,function(_0x187240){if(_0x187240[_0xa3f6('0x44')]!=='VIRTUAL'){var _0x2b7831={};_0x2b7831[_0x187240['name']]={'$like':'%'+_0xac0c85[_0xa3f6('0x35')][_0xa3f6('0x41')]+'%'};return _0x2b7831;}})});}_0x3d3bd4=_[_0xa3f6('0x43')]({},_0x3d3bd4,_0xac0c85[_0xa3f6('0x45')]);var _0x40ab31={'where':_0x3d3bd4['where']};return db['VoiceQueueReport'][_0xa3f6('0x25')](_0x40ab31)[_0xa3f6('0x2b')](function(_0x1d09a8){_0x9e1445[_0xa3f6('0x25')]=_0x1d09a8;if(_0xac0c85['query'][_0xa3f6('0x46')]){_0x3d3bd4['include']=[{'all':!![]}];}return db[_0xa3f6('0x47')][_0xa3f6('0x48')](_0x3d3bd4);})['then'](function(_0x34e8c0){_0x9e1445['rows']=_0x34e8c0;return _0x9e1445;})[_0xa3f6('0x2b')](respondWithFilteredResult(_0x450b05,_0x3d3bd4))[_0xa3f6('0x49')](handleError(_0x450b05,null));};exports[_0xa3f6('0x4a')]=function(_0x1a1fb6,_0x1e4913){var _0x449c16={'raw':![],'where':{'id':_0x1a1fb6['params']['id']}},_0x49dff7={};_0x49dff7['model']=_[_0xa3f6('0x36')](db[_0xa3f6('0x47')][_0xa3f6('0x32')]);_0x49dff7[_0xa3f6('0x35')]=_[_0xa3f6('0x36')](_0x1a1fb6[_0xa3f6('0x35')]);_0x49dff7[_0xa3f6('0x37')]=_['intersection'](_0x49dff7[_0xa3f6('0x34')],_0x49dff7[_0xa3f6('0x35')]);_0x449c16[_0xa3f6('0x3a')]=_[_0xa3f6('0x38')](_0x49dff7[_0xa3f6('0x34')],qs[_0xa3f6('0x39')](_0x1a1fb6[_0xa3f6('0x35')][_0xa3f6('0x39')]));_0x449c16[_0xa3f6('0x3a')]=_0x449c16[_0xa3f6('0x3a')][_0xa3f6('0x3b')]?_0x449c16['attributes']:_0x49dff7[_0xa3f6('0x34')];if(_0x1a1fb6[_0xa3f6('0x35')][_0xa3f6('0x46')]){_0x449c16['include']=[{'all':!![]}];}_0x449c16=_[_0xa3f6('0x43')]({},_0x449c16,_0x1a1fb6[_0xa3f6('0x45')]);return db[_0xa3f6('0x47')]['find'](_0x449c16)[_0xa3f6('0x2b')](handleEntityNotFound(_0x1e4913,null))[_0xa3f6('0x2b')](respondWithResult(_0x1e4913,null))[_0xa3f6('0x49')](handleError(_0x1e4913,null));};exports['create']=function(_0x1a9778,_0x850076){return db['VoiceQueueReport'][_0xa3f6('0x4b')](_0x1a9778[_0xa3f6('0x4c')],{})[_0xa3f6('0x2b')](respondWithResult(_0x850076,0xc9))['catch'](handleError(_0x850076,null));};exports[_0xa3f6('0x4d')]=function(_0x349fdc,_0x2bf924){if(_0x349fdc[_0xa3f6('0x4c')]['id']){delete _0x349fdc['body']['id'];}return db[_0xa3f6('0x47')][_0xa3f6('0x4e')]({'where':{'id':_0x349fdc[_0xa3f6('0x4f')]['id']}})[_0xa3f6('0x2b')](handleEntityNotFound(_0x2bf924,null))['then'](saveUpdates(_0x349fdc[_0xa3f6('0x4c')],null))['then'](respondWithResult(_0x2bf924,null))[_0xa3f6('0x49')](handleError(_0x2bf924,null));};exports[_0xa3f6('0x2a')]=function(_0x405d5b,_0x5ade11){return db[_0xa3f6('0x47')][_0xa3f6('0x4e')]({'where':{'id':_0x405d5b['params']['id']}})['then'](handleEntityNotFound(_0x5ade11,null))['then'](removeEntity(_0x5ade11,null))[_0xa3f6('0x49')](handleError(_0x5ade11,null));};exports[_0xa3f6('0x50')]=function(_0x2c7da2,_0x3bbc56){return db[_0xa3f6('0x47')]['describe']()[_0xa3f6('0x2b')](respondWithResult(_0x3bbc56,null))[_0xa3f6('0x49')](handleError(_0x3bbc56,null));};exports[_0xa3f6('0x51')]=function(_0x100e25,_0x4f147f){var _0x26e02e={},_0x3608f2={},_0x5c365e={'count':0x0,'rows':[]};_0x3608f2[_0xa3f6('0x34')]=_[_0xa3f6('0x36')](db[_0xa3f6('0x47')]['rawAttributes']);_0x3608f2[_0xa3f6('0x35')]=_[_0xa3f6('0x36')](_0x100e25[_0xa3f6('0x35')]);_0x3608f2[_0xa3f6('0x37')]=_[_0xa3f6('0x38')](_0x3608f2[_0xa3f6('0x34')],_0x3608f2[_0xa3f6('0x35')]);_0x26e02e[_0xa3f6('0x3a')]=_['intersection'](_0x3608f2[_0xa3f6('0x34')],qs[_0xa3f6('0x39')](_0x100e25[_0xa3f6('0x35')][_0xa3f6('0x39')]));_0x26e02e[_0xa3f6('0x3a')]=_0x26e02e[_0xa3f6('0x3a')][_0xa3f6('0x3b')]?_0x26e02e[_0xa3f6('0x3a')]:_0x3608f2['model'];if(!_0x100e25[_0xa3f6('0x35')]['hasOwnProperty'](_0xa3f6('0x3d'))){_0x26e02e[_0xa3f6('0x24')]=qs[_0xa3f6('0x24')](_0x100e25[_0xa3f6('0x35')]['limit']);_0x26e02e[_0xa3f6('0x22')]=qs[_0xa3f6('0x22')](_0x100e25[_0xa3f6('0x35')][_0xa3f6('0x22')]);}_0x26e02e['order']=qs['sort'](_0x100e25['query'][_0xa3f6('0x3f')]);_0x26e02e[_0xa3f6('0x42')]=qs[_0xa3f6('0x37')](_[_0xa3f6('0x40')](_0x100e25['query'],_0x3608f2['filters']));if(_0x100e25[_0xa3f6('0x35')][_0xa3f6('0x41')]){_0x26e02e[_0xa3f6('0x42')]=_[_0xa3f6('0x43')](_0x26e02e[_0xa3f6('0x42')],{'$or':_['map'](_0x26e02e[_0xa3f6('0x3a')],function(_0x2de63f){var _0x1bde5a={};_0x1bde5a[_0x2de63f]={'$like':'%'+_0x100e25[_0xa3f6('0x35')]['filter']+'%'};return _0x1bde5a;})});}_0x26e02e=_['merge']({},_0x26e02e,_0x100e25[_0xa3f6('0x45')]);var _0x1f71f3={'where':_0x26e02e[_0xa3f6('0x42')]};return db[_0xa3f6('0x47')][_0xa3f6('0x25')](_0x1f71f3)[_0xa3f6('0x2b')](function(_0x4db7af){_0x5c365e[_0xa3f6('0x25')]=_0x4db7af;if(_0x100e25[_0xa3f6('0x35')][_0xa3f6('0x46')]){_0x26e02e[_0xa3f6('0x52')]=[{'all':!![]}];}return db[_0xa3f6('0x47')][_0xa3f6('0x48')](_0x26e02e);})[_0xa3f6('0x2b')](function(_0x29ead5){_0x5c365e[_0xa3f6('0x53')]=_0x29ead5;return _0x5c365e;})[_0xa3f6('0x2b')](respondWithFilteredResult(_0x4f147f,_0x26e02e,_0xa3f6('0x51')))['catch'](handleError(_0x4f147f,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 123f875..f59acc4 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 _0xf51a=['save','update','remove','hasOwnProperty','hook','exports','setMaxListeners'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xf51a,0x195));var _0xaf51=function(_0x14cac6,_0x31d89d){_0x14cac6=_0x14cac6-0x0;var _0x311ef0=_0xf51a[_0x14cac6];return _0x311ef0;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaf51('0x0')](0x0);var events={'afterCreate':_0xaf51('0x1'),'afterUpdate':_0xaf51('0x2'),'afterDestroy':_0xaf51('0x3')};function emitEvent(_0x19fa1a){return function(_0x47ddbf,_0x2852b7,_0x2ef814){VoiceQueueReportEvents['emit'](_0x19fa1a+':'+_0x47ddbf['id'],_0x47ddbf);VoiceQueueReportEvents['emit'](_0x19fa1a,_0x47ddbf);_0x2ef814(null);};}for(var e in events){if(events[_0xaf51('0x4')](e)){var event=events[e];VoiceQueueReport[_0xaf51('0x5')](e,emitEvent(event));}}module[_0xaf51('0x6')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x52cd=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x52cd,0xf8));var _0xd52c=function(_0x20f7db,_0x20f85e){_0x20f7db=_0x20f7db-0x0;var _0x4d4568=_0x52cd[_0x20f7db];return _0x4d4568;};'use strict';var EventEmitter=require(_0xd52c('0x0'));var VoiceQueueReport=require(_0xd52c('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xd52c('0x2')](0x0);var events={'afterCreate':_0xd52c('0x3'),'afterUpdate':_0xd52c('0x4'),'afterDestroy':'remove'};function emitEvent(_0xf046a9){return function(_0x3341e0,_0x5575d0,_0x34b345){VoiceQueueReportEvents[_0xd52c('0x5')](_0xf046a9+':'+_0x3341e0['id'],_0x3341e0);VoiceQueueReportEvents[_0xd52c('0x5')](_0xf046a9,_0x3341e0);_0x34b345(null);};}for(var e in events){if(events[_0xd52c('0x6')](e)){var event=events[e];VoiceQueueReport[_0xd52c('0x7')](e,emitEvent(event));}}module[_0xd52c('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 96f8e99..ac2a756 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 _0x0b8d=['api','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x0b8d,0xbd));var _0xd0b8=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x0b8d[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0xd0b8('0x0'));var util=require(_0xd0b8('0x1'));var logger=require(_0xd0b8('0x2'))(_0xd0b8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd0b8('0x4'));var fs=require('fs');var path=require(_0xd0b8('0x5'));var rimraf=require(_0xd0b8('0x6'));var config=require(_0xd0b8('0x7'));var attributes=require(_0xd0b8('0x8'));module[_0xd0b8('0x9')]=function(_0x820540,_0x3bf19d){return _0x820540['define']('VoiceQueueReport',attributes,{'tableName':_0xd0b8('0xa'),'paranoid':![],'indexes':[{'fields':[_0xd0b8('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3918=['moment','path','rimraf','./voiceQueueReport.attributes','exports','VoiceQueueReport','uniqueid','lodash','util','../../config/logger','api'];(function(_0x357ef3,_0x265d9d){var _0x32eed5=function(_0xc20adb){while(--_0xc20adb){_0x357ef3['push'](_0x357ef3['shift']());}};_0x32eed5(++_0x265d9d);}(_0x3918,0x19e));var _0x8391=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3918[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8391('0x0'));var util=require(_0x8391('0x1'));var logger=require(_0x8391('0x2'))(_0x8391('0x3'));var moment=require(_0x8391('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8391('0x5'));var rimraf=require(_0x8391('0x6'));var config=require('../../config/environment');var attributes=require(_0x8391('0x7'));module[_0x8391('0x8')]=function(_0x1667bc,_0x3f4e86){return _0x1667bc['define'](_0x8391('0x9'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x8391('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 6270f6a..ee4fc9e 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 _0x54d3=['request','then','VoiceQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','limit','include','model','attributes','map','CreateVoiceQueueReport','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x5c6469,_0x54afe8){var _0x4a85d0=function(_0x668156){while(--_0x668156){_0x5c6469['push'](_0x5c6469['shift']());}};_0x4a85d0(++_0x54afe8);}(_0x54d3,0x6b));var _0x354d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x54d3[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x354d('0x0'));var util=require(_0x354d('0x1'));var moment=require(_0x354d('0x2'));var BPromise=require(_0x354d('0x3'));var rs=require(_0x354d('0x4'));var fs=require('fs');var Redis=require(_0x354d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x354d('0x6'));var logger=require(_0x354d('0x7'))(_0x354d('0x8'));var config=require(_0x354d('0x9'));var jayson=require(_0x354d('0xa'));var client=jayson['client'][_0x354d('0xb')]({'port':0x232a});config[_0x354d('0xc')]=_[_0x354d('0xd')](config[_0x354d('0xc')],{'host':_0x354d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x354d('0xc')]));require(_0x354d('0xf'))['register'](socket);function respondWithRpcPromise(_0x125b46,_0x457274,_0xfcbe0d){return new BPromise(function(_0x8fa5a8,_0x39be32){return client[_0x354d('0x10')](_0x125b46,_0xfcbe0d)[_0x354d('0x11')](function(_0x8ce607){logger['info'](_0x354d('0x12'),_0x457274,'request\x20sent');logger[_0x354d('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x457274,_0x354d('0x14'),JSON[_0x354d('0x15')](_0x8ce607));if(_0x8ce607['error']){if(_0x8ce607['error'][_0x354d('0x16')]===0x1f4){logger[_0x354d('0x17')](_0x354d('0x12'),_0x457274,_0x8ce607['error'][_0x354d('0x18')]);return _0x39be32(_0x8ce607[_0x354d('0x17')][_0x354d('0x18')]);}logger[_0x354d('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x457274,_0x8ce607[_0x354d('0x17')][_0x354d('0x18')]);return _0x8fa5a8(_0x8ce607[_0x354d('0x17')]['message']);}else{logger[_0x354d('0x19')](_0x354d('0x12'),_0x457274,_0x354d('0x14'));_0x8fa5a8(_0x8ce607[_0x354d('0x1a')][_0x354d('0x18')]);}})[_0x354d('0x1b')](function(_0x4979dc){logger['error'](_0x354d('0x12'),_0x457274,_0x4979dc);_0x39be32(_0x4979dc);});});}exports[_0x354d('0x1c')]=function(_0x46196a){var _0x18295b=this;return new Promise(function(_0x5dd830,_0x119914){return db[_0x354d('0x1d')]['findAll']({'raw':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x1f')]===undefined?!![]:![]:!![],'where':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x20')]||null:null,'attributes':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')]['attributes']||null:null,'limit':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x21')]||null:null,'include':_0x46196a[_0x354d('0x1e')]?_0x46196a[_0x354d('0x1e')][_0x354d('0x22')]?_['map'](_0x46196a[_0x354d('0x1e')][_0x354d('0x22')],function(_0x576967){return{'model':db[_0x576967[_0x354d('0x23')]],'as':_0x576967['as'],'attributes':_0x576967[_0x354d('0x24')],'include':_0x576967[_0x354d('0x22')]?_[_0x354d('0x25')](_0x576967[_0x354d('0x22')],function(_0x331ac8){return{'model':db[_0x331ac8[_0x354d('0x23')]],'as':_0x331ac8['as'],'attributes':_0x331ac8[_0x354d('0x24')],'include':_0x331ac8[_0x354d('0x22')]?_[_0x354d('0x25')](_0x331ac8['include'],function(_0x41c3cb){return{'model':db[_0x41c3cb['model']],'as':_0x41c3cb['as'],'attributes':_0x41c3cb[_0x354d('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c298d){logger['info'](_0x354d('0x1c'),_0x46196a);logger[_0x354d('0x13')](_0x354d('0x1c'),_0x46196a,JSON['stringify'](_0x5c298d));_0x5dd830(_0x5c298d);})['catch'](function(_0x12c62c){logger['error'](_0x354d('0x1c'),_0x12c62c[_0x354d('0x18')],_0x46196a);_0x119914(_0x18295b[_0x354d('0x17')](0x1f4,_0x12c62c[_0x354d('0x18')]));});});};exports[_0x354d('0x26')]=function(_0x250664){var _0x2538b0=this;return new Promise(function(_0x406fcf,_0x1a81fd){return db[_0x354d('0x1d')]['create'](_0x250664[_0x354d('0x27')],{'raw':_0x250664[_0x354d('0x1e')]?_0x250664[_0x354d('0x1e')][_0x354d('0x1f')]===undefined?!![]:![]:!![]})[_0x354d('0x11')](function(_0x1e8227){logger[_0x354d('0x19')](_0x354d('0x26'),_0x250664);logger[_0x354d('0x13')]('CreateVoiceQueueReport',_0x250664,JSON[_0x354d('0x15')](_0x1e8227));_0x406fcf(_0x1e8227);})[_0x354d('0x1b')](function(_0x573bd0){logger[_0x354d('0x17')]('CreateVoiceQueueReport',_0x573bd0[_0x354d('0x18')],_0x250664);_0x1a81fd(_0x2538b0['error'](0x1f4,_0x573bd0[_0x354d('0x18')]));});});};exports[_0x354d('0x28')]=function(_0x4bbd83){var _0x283c7c=this;return new Promise(function(_0x12d21c,_0x17e499){return db[_0x354d('0x1d')]['update'](_0x4bbd83['body'],{'raw':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83['options'][_0x354d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83[_0x354d('0x1e')][_0x354d('0x20')]||null:null,'attributes':_0x4bbd83['options']?_0x4bbd83[_0x354d('0x1e')]['attributes']||null:null,'limit':_0x4bbd83[_0x354d('0x1e')]?_0x4bbd83[_0x354d('0x1e')][_0x354d('0x21')]||null:null})[_0x354d('0x11')](function(_0x3cbfef){logger[_0x354d('0x19')](_0x354d('0x28'),_0x4bbd83);logger[_0x354d('0x13')](_0x354d('0x28'),_0x4bbd83,JSON[_0x354d('0x15')](_0x3cbfef));_0x12d21c(_0x3cbfef);})[_0x354d('0x1b')](function(_0x278396){logger[_0x354d('0x17')](_0x354d('0x28'),_0x278396[_0x354d('0x18')],_0x4bbd83);_0x17e499(_0x283c7c['error'](0x1f4,_0x278396[_0x354d('0x18')]));});});}; \ No newline at end of file +var _0x9433=['raw','where','limit','map','include','model','attributes','debug','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','request','then','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options'];(function(_0x3fb765,_0x89ffef){var _0xb33b4d=function(_0x30de52){while(--_0x30de52){_0x3fb765['push'](_0x3fb765['shift']());}};_0xb33b4d(++_0x89ffef);}(_0x9433,0x175));var _0x3943=function(_0x585a6f,_0x5657cf){_0x585a6f=_0x585a6f-0x0;var _0x38f511=_0x9433[_0x585a6f];return _0x38f511;};'use strict';var _=require(_0x3943('0x0'));var util=require(_0x3943('0x1'));var moment=require(_0x3943('0x2'));var BPromise=require(_0x3943('0x3'));var rs=require(_0x3943('0x4'));var fs=require('fs');var Redis=require(_0x3943('0x5'));var db=require(_0x3943('0x6'))['db'];var utils=require(_0x3943('0x7'));var logger=require(_0x3943('0x8'))(_0x3943('0x9'));var config=require(_0x3943('0xa'));var jayson=require(_0x3943('0xb'));var client=jayson[_0x3943('0xc')]['http']({'port':0x232a});config[_0x3943('0xd')]=_[_0x3943('0xe')](config['redis'],{'host':_0x3943('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3943('0x10'))['register'](socket);function respondWithRpcPromise(_0x439f93,_0x44bbc0,_0x2cd0bc){return new BPromise(function(_0x351286,_0x2f7e75){return client[_0x3943('0x11')](_0x439f93,_0x2cd0bc)[_0x3943('0x12')](function(_0x4954a8){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x44bbc0,_0x3943('0x13'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x44bbc0,_0x3943('0x13'),JSON[_0x3943('0x14')](_0x4954a8));if(_0x4954a8[_0x3943('0x15')]){if(_0x4954a8['error'][_0x3943('0x16')]===0x1f4){logger['error'](_0x3943('0x17'),_0x44bbc0,_0x4954a8[_0x3943('0x15')][_0x3943('0x18')]);return _0x2f7e75(_0x4954a8[_0x3943('0x15')][_0x3943('0x18')]);}logger[_0x3943('0x15')](_0x3943('0x17'),_0x44bbc0,_0x4954a8[_0x3943('0x15')]['message']);return _0x351286(_0x4954a8[_0x3943('0x15')][_0x3943('0x18')]);}else{logger[_0x3943('0x19')](_0x3943('0x17'),_0x44bbc0,_0x3943('0x13'));_0x351286(_0x4954a8[_0x3943('0x1a')][_0x3943('0x18')]);}})[_0x3943('0x1b')](function(_0x6c6399){logger[_0x3943('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x44bbc0,_0x6c6399);_0x2f7e75(_0x6c6399);});});}exports[_0x3943('0x1c')]=function(_0x3948b8){var _0x592bd5=this;return new Promise(function(_0x2b0dc0,_0x3f4a40){return db[_0x3943('0x1d')][_0x3943('0x1e')]({'raw':_0x3948b8[_0x3943('0x1f')]?_0x3948b8[_0x3943('0x1f')][_0x3943('0x20')]===undefined?!![]:![]:!![],'where':_0x3948b8[_0x3943('0x1f')]?_0x3948b8[_0x3943('0x1f')][_0x3943('0x21')]||null:null,'attributes':_0x3948b8[_0x3943('0x1f')]?_0x3948b8[_0x3943('0x1f')]['attributes']||null:null,'limit':_0x3948b8[_0x3943('0x1f')]?_0x3948b8[_0x3943('0x1f')][_0x3943('0x22')]||null:null,'include':_0x3948b8[_0x3943('0x1f')]?_0x3948b8[_0x3943('0x1f')]['include']?_[_0x3943('0x23')](_0x3948b8['options'][_0x3943('0x24')],function(_0x17026c){return{'model':db[_0x17026c[_0x3943('0x25')]],'as':_0x17026c['as'],'attributes':_0x17026c[_0x3943('0x26')],'include':_0x17026c[_0x3943('0x24')]?_['map'](_0x17026c[_0x3943('0x24')],function(_0x140d54){return{'model':db[_0x140d54[_0x3943('0x25')]],'as':_0x140d54['as'],'attributes':_0x140d54['attributes'],'include':_0x140d54[_0x3943('0x24')]?_[_0x3943('0x23')](_0x140d54[_0x3943('0x24')],function(_0x3e53b5){return{'model':db[_0x3e53b5['model']],'as':_0x3e53b5['as'],'attributes':_0x3e53b5[_0x3943('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3943('0x12')](function(_0x21a7fd){logger[_0x3943('0x19')](_0x3943('0x1c'),_0x3948b8);logger[_0x3943('0x27')](_0x3943('0x1c'),_0x3948b8,JSON[_0x3943('0x14')](_0x21a7fd));_0x2b0dc0(_0x21a7fd);})[_0x3943('0x1b')](function(_0x5a5776){logger[_0x3943('0x15')](_0x3943('0x1c'),_0x5a5776[_0x3943('0x18')],_0x3948b8);_0x3f4a40(_0x592bd5['error'](0x1f4,_0x5a5776[_0x3943('0x18')]));});});};exports[_0x3943('0x28')]=function(_0x45401a){var _0x4c583e=this;return new Promise(function(_0x518816,_0x4534b9){return db[_0x3943('0x1d')][_0x3943('0x29')](_0x45401a[_0x3943('0x2a')],{'raw':_0x45401a[_0x3943('0x1f')]?_0x45401a[_0x3943('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x3943('0x12')](function(_0x40a5ba){logger[_0x3943('0x19')]('CreateVoiceQueueReport',_0x45401a);logger['debug'](_0x3943('0x28'),_0x45401a,JSON[_0x3943('0x14')](_0x40a5ba));_0x518816(_0x40a5ba);})[_0x3943('0x1b')](function(_0xb1ca05){logger['error']('CreateVoiceQueueReport',_0xb1ca05[_0x3943('0x18')],_0x45401a);_0x4534b9(_0x4c583e[_0x3943('0x15')](0x1f4,_0xb1ca05[_0x3943('0x18')]));});});};exports[_0x3943('0x2b')]=function(_0x3cdeaa){var _0x1261ce=this;return new Promise(function(_0x4b6314,_0x2bbb8c){return db[_0x3943('0x1d')][_0x3943('0x2c')](_0x3cdeaa[_0x3943('0x2a')],{'raw':_0x3cdeaa[_0x3943('0x1f')]?_0x3cdeaa[_0x3943('0x1f')][_0x3943('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cdeaa['options']?_0x3cdeaa['options'][_0x3943('0x21')]||null:null,'attributes':_0x3cdeaa[_0x3943('0x1f')]?_0x3cdeaa['options'][_0x3943('0x26')]||null:null,'limit':_0x3cdeaa[_0x3943('0x1f')]?_0x3cdeaa[_0x3943('0x1f')][_0x3943('0x22')]||null:null})[_0x3943('0x12')](function(_0xb9dcec){logger[_0x3943('0x19')]('UpdateVoiceQueueReport',_0x3cdeaa);logger['debug'](_0x3943('0x2b'),_0x3cdeaa,JSON['stringify'](_0xb9dcec));_0x4b6314(_0xb9dcec);})[_0x3943('0x1b')](function(_0x4c57a0){logger[_0x3943('0x15')](_0x3943('0x2b'),_0x4c57a0['message'],_0x3cdeaa);_0x2bbb8c(_0x1261ce['error'](0x1f4,_0x4c57a0['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1d46c34..ac12785 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 _0x1de4=['emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x37c788,_0x22f870){var _0x5be845=function(_0x4835aa){while(--_0x4835aa){_0x37c788['push'](_0x37c788['shift']());}};_0x5be845(++_0x22f870);}(_0x1de4,0x94));var _0x41de=function(_0x2b7442,_0x561591){_0x2b7442=_0x2b7442-0x0;var _0x56e035=_0x1de4[_0x2b7442];return _0x56e035;};'use strict';var VoiceQueueReportEvents=require(_0x41de('0x0'));var events=[_0x41de('0x1'),_0x41de('0x2'),_0x41de('0x3')];function createListener(_0x4aafae,_0x35b505){return function(_0x43c48c){_0x35b505[_0x41de('0x4')](_0x4aafae,_0x43c48c);};}function removeListener(_0x5dd1cb,_0x378cbe){return function(){VoiceQueueReportEvents[_0x41de('0x5')](_0x5dd1cb,_0x378cbe);};}exports['register']=function(_0x2e7196){for(var _0x122565=0x0,_0x2f1078=events[_0x41de('0x6')];_0x122565<_0x2f1078;_0x122565++){var _0x50f716=events[_0x122565];var _0x4c292c=createListener(_0x41de('0x7')+_0x50f716,_0x2e7196);VoiceQueueReportEvents['on'](_0x50f716,_0x4c292c);}}; \ No newline at end of file +var _0x89c3=['emit','register','voiceQueueReport:','./voiceQueueReport.events','save','remove','update'];(function(_0x528bd2,_0x1f23fb){var _0xc22b60=function(_0x4a4b63){while(--_0x4a4b63){_0x528bd2['push'](_0x528bd2['shift']());}};_0xc22b60(++_0x1f23fb);}(_0x89c3,0xff));var _0x389c=function(_0x1e91e3,_0x4c3a7c){_0x1e91e3=_0x1e91e3-0x0;var _0x4fca9f=_0x89c3[_0x1e91e3];return _0x4fca9f;};'use strict';var VoiceQueueReportEvents=require(_0x389c('0x0'));var events=[_0x389c('0x1'),_0x389c('0x2'),_0x389c('0x3')];function createListener(_0x2ffc1d,_0x14c809){return function(_0xab285b){_0x14c809[_0x389c('0x4')](_0x2ffc1d,_0xab285b);};}function removeListener(_0x5c6c68,_0x3742ad){return function(){VoiceQueueReportEvents['removeListener'](_0x5c6c68,_0x3742ad);};}exports[_0x389c('0x5')]=function(_0x4bece6){for(var _0x51f5f5=0x0,_0x2f3e3f=events['length'];_0x51f5f5<_0x2f3e3f;_0x51f5f5++){var _0x58bf11=events[_0x51f5f5];var _0x33cb72=createListener(_0x389c('0x6')+_0x58bf11,_0x4bece6);VoiceQueueReportEvents['on'](_0x58bf11,_0x33cb72);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index a4b3a61..111033b 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 _0x3eec=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get','/:id','show'];(function(_0x36385b,_0x429635){var _0x409886=function(_0x33bfa3){while(--_0x33bfa3){_0x36385b['push'](_0x36385b['shift']());}};_0x409886(++_0x429635);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x1527a3,_0x1bbee8){_0x1527a3=_0x1527a3-0x0;var _0x2634c0=_0x3eec[_0x1527a3];return _0x2634c0;};'use strict';var multer=require(_0xc3ee('0x0'));var util=require(_0xc3ee('0x1'));var path=require(_0xc3ee('0x2'));var timeout=require(_0xc3ee('0x3'));var express=require('express');var router=express[_0xc3ee('0x4')]();var fs_extra=require(_0xc3ee('0x5'));var auth=require(_0xc3ee('0x6'));var interaction=require(_0xc3ee('0x7'));var config=require(_0xc3ee('0x8'));var controller=require(_0xc3ee('0x9'));router['get']('/',auth[_0xc3ee('0xa')](),controller[_0xc3ee('0xb')]);router[_0xc3ee('0xc')](_0xc3ee('0xd'),auth[_0xc3ee('0xa')](),controller[_0xc3ee('0xe')]);router[_0xc3ee('0xf')]('/',auth[_0xc3ee('0xa')](),controller[_0xc3ee('0x10')]);router[_0xc3ee('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc3ee('0x12')]);router[_0xc3ee('0x13')](_0xc3ee('0xd'),auth[_0xc3ee('0xa')](),controller['destroy']);module[_0xc3ee('0x14')]=router; \ No newline at end of file +var _0xe5b3=['update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post','/:id'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4af204,_0x32e6be){_0x4af204=_0x4af204-0x0;var _0x22617b=_0xe5b3[_0x4af204];return _0x22617b;};'use strict';var multer=require('multer');var util=require(_0x3e5b('0x0'));var path=require(_0x3e5b('0x1'));var timeout=require(_0x3e5b('0x2'));var express=require(_0x3e5b('0x3'));var router=express[_0x3e5b('0x4')]();var fs_extra=require(_0x3e5b('0x5'));var auth=require(_0x3e5b('0x6'));var interaction=require(_0x3e5b('0x7'));var config=require(_0x3e5b('0x8'));var controller=require(_0x3e5b('0x9'));router[_0x3e5b('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e5b('0xb')]);router[_0x3e5b('0xa')]('/:id',auth[_0x3e5b('0xc')](),controller[_0x3e5b('0xd')]);router[_0x3e5b('0xe')]('/',auth[_0x3e5b('0xc')](),controller['create']);router['put'](_0x3e5b('0xf'),auth[_0x3e5b('0xc')](),controller[_0x3e5b('0x10')]);router[_0x3e5b('0x11')](_0x3e5b('0xf'),auth['isAuthenticated'](),controller[_0x3e5b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7c8f1b9..f4c2f44 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 _0xef4e=['DATE','format','sequelize','moment','exports','STRING'];(function(_0x1e744a,_0xa8fdb1){var _0x1ac4d0=function(_0x13a75d){while(--_0x13a75d){_0x1e744a['push'](_0x1e744a['shift']());}};_0x1ac4d0(++_0xa8fdb1);}(_0xef4e,0xc2));var _0xeef4=function(_0x4f9b3a,_0x4b31a2){_0x4f9b3a=_0x4f9b3a-0x0;var _0x10cb16=_0xef4e[_0x4f9b3a];return _0x10cb16;};'use strict';var Sequelize=require(_0xeef4('0x0'));var moment=require(_0xeef4('0x1'));module[_0xeef4('0x2')]={'time':{'type':Sequelize[_0xeef4('0x3')]},'callid':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xeef4('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xeef4('0x4')],'allowNull':![],'defaultValue':moment()[_0xeef4('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x43a2=['STRING','moment','exports'];(function(_0x33dcf7,_0x3d5390){var _0x542d4e=function(_0x281250){while(--_0x281250){_0x33dcf7['push'](_0x33dcf7['shift']());}};_0x542d4e(++_0x3d5390);}(_0x43a2,0xd0));var _0x243a=function(_0x190cd5,_0x12642c){_0x190cd5=_0x190cd5-0x0;var _0x420bab=_0x43a2[_0x190cd5];return _0x420bab;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x243a('0x0'));module[_0x243a('0x1')]={'time':{'type':Sequelize[_0x243a('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x243a('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 354b83c..07c2d71 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 _0x65e1=['model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','update','then','destroy','sendStatus','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','keys','query','filters','intersection'];(function(_0x1328a5,_0x3f3d12){var _0x171b39=function(_0x215390){while(--_0x215390){_0x1328a5['push'](_0x1328a5['shift']());}};_0x171b39(++_0x3f3d12);}(_0x65e1,0xed));var _0x165e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x65e1[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x165e('0x0'));var zipdir=require(_0x165e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x165e('0x2'));var moment=require('moment');var BPromise=require(_0x165e('0x3'));var Mustache=require(_0x165e('0x4'));var util=require(_0x165e('0x5'));var path=require(_0x165e('0x6'));var sox=require(_0x165e('0x7'));var csv=require(_0x165e('0x8'));var ejs=require(_0x165e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x165e('0xa'));var squel=require(_0x165e('0xb'));var crypto=require(_0x165e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x165e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x165e('0xe'));var Papa=require(_0x165e('0xf'));var Redis=require(_0x165e('0x10'));var authService=require(_0x165e('0x11'));var qs=require(_0x165e('0x12'));var as=require(_0x165e('0x13'));var hardwareService=require(_0x165e('0x14'));var logger=require(_0x165e('0x15'))(_0x165e('0x16'));var utils=require(_0x165e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x165e('0x18'));var db=require(_0x165e('0x19'))['db'];function respondWithStatusCode(_0x595d57,_0xecf429){_0xecf429=_0xecf429||0xcc;return function(_0x33dce3){if(_0x33dce3){return _0x595d57['sendStatus'](_0xecf429);}return _0x595d57[_0x165e('0x1a')](_0xecf429)[_0x165e('0x1b')]();};}function respondWithResult(_0x459c0e,_0x2d2f0c){_0x2d2f0c=_0x2d2f0c||0xc8;return function(_0x500b3a){if(_0x500b3a){return _0x459c0e[_0x165e('0x1a')](_0x2d2f0c)['json'](_0x500b3a);}};}function respondWithFilteredResult(_0x300fc8,_0x5436a0){return function(_0xb82088){if(_0xb82088){var _0x27371e=typeof _0x5436a0[_0x165e('0x1c')]===_0x165e('0x1d')&&typeof _0x5436a0[_0x165e('0x1e')]===_0x165e('0x1d');var _0x16d69c=_0xb82088[_0x165e('0x1f')];var _0x209eb7=_0x27371e?0x0:_0x5436a0[_0x165e('0x1c')];var _0x32edf5=_0x27371e?_0xb82088[_0x165e('0x1f')]:_0x5436a0[_0x165e('0x1c')]+_0x5436a0['limit'];var _0x54fcb9;if(_0x32edf5>=_0x16d69c){_0x32edf5=_0x16d69c;_0x54fcb9=0xc8;}else{_0x54fcb9=0xce;}_0x300fc8['status'](_0x54fcb9);return _0x300fc8['set']('Content-Range',_0x209eb7+'-'+_0x32edf5+'/'+_0x16d69c)[_0x165e('0x20')](_0xb82088);}return null;};}function patchUpdates(_0x2792ee){return function(_0x52ab26){try{jsonpatch[_0x165e('0x21')](_0x52ab26,_0x2792ee,!![]);}catch(_0x59e1c2){return BPromise[_0x165e('0x22')](_0x59e1c2);}return _0x52ab26['save']();};}function saveUpdates(_0x1f52f7,_0x3c058a){return function(_0x2ecdab){if(_0x2ecdab){return _0x2ecdab[_0x165e('0x23')](_0x1f52f7)[_0x165e('0x24')](function(_0x20f5ee){return _0x20f5ee;});}return null;};}function removeEntity(_0x248950,_0x3fae8c){return function(_0x598574){if(_0x598574){return _0x598574[_0x165e('0x25')]()[_0x165e('0x24')](function(){_0x248950[_0x165e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51ffff,_0x1bd9ea){return function(_0x5315a2){if(!_0x5315a2){_0x51ffff[_0x165e('0x26')](0x194);}return _0x5315a2;};}function handleError(_0x4f631e,_0x326a39){_0x326a39=_0x326a39||0x1f4;return function(_0x3f5e39){logger['error'](_0x3f5e39['stack']);if(_0x3f5e39[_0x165e('0x27')]){delete _0x3f5e39[_0x165e('0x27')];}_0x4f631e['status'](_0x326a39)[_0x165e('0x28')](_0x3f5e39);};}exports[_0x165e('0x29')]=function(_0x17006c,_0x158fd8){var _0x1cec47={},_0x1d0854={},_0x5b8fb7={'count':0x0,'rows':[]};var _0x82a016=_[_0x165e('0x2a')](db[_0x165e('0x2b')][_0x165e('0x2c')],function(_0x4cb01b){return{'name':_0x4cb01b[_0x165e('0x2d')],'type':_0x4cb01b['type'][_0x165e('0x2e')]};});_0x1d0854['model']=_[_0x165e('0x2a')](_0x82a016,_0x165e('0x27'));_0x1d0854['query']=_[_0x165e('0x2f')](_0x17006c[_0x165e('0x30')]);_0x1d0854[_0x165e('0x31')]=_[_0x165e('0x32')](_0x1d0854[_0x165e('0x33')],_0x1d0854[_0x165e('0x30')]);_0x1cec47[_0x165e('0x34')]=_[_0x165e('0x32')](_0x1d0854[_0x165e('0x33')],qs[_0x165e('0x35')](_0x17006c[_0x165e('0x30')]['fields']));_0x1cec47['attributes']=_0x1cec47[_0x165e('0x34')][_0x165e('0x36')]?_0x1cec47[_0x165e('0x34')]:_0x1d0854['model'];if(!_0x17006c[_0x165e('0x30')][_0x165e('0x37')]('nolimit')){_0x1cec47[_0x165e('0x1e')]=qs[_0x165e('0x1e')](_0x17006c[_0x165e('0x30')][_0x165e('0x1e')]);_0x1cec47[_0x165e('0x1c')]=qs['offset'](_0x17006c[_0x165e('0x30')][_0x165e('0x1c')]);}_0x1cec47['order']=qs[_0x165e('0x38')](_0x17006c[_0x165e('0x30')]['sort']);_0x1cec47[_0x165e('0x39')]=qs[_0x165e('0x31')](_['pick'](_0x17006c['query'],_0x1d0854[_0x165e('0x31')]),_0x82a016);if(_0x17006c[_0x165e('0x30')][_0x165e('0x3a')]){_0x1cec47[_0x165e('0x39')]=_[_0x165e('0x3b')](_0x1cec47[_0x165e('0x39')],{'$or':_[_0x165e('0x2a')](_0x82a016,function(_0x260749){if(_0x260749[_0x165e('0x3c')]!==_0x165e('0x3d')){var _0x3b1ca4={};_0x3b1ca4[_0x260749[_0x165e('0x27')]]={'$like':'%'+_0x17006c[_0x165e('0x30')][_0x165e('0x3a')]+'%'};return _0x3b1ca4;}})});}_0x1cec47=_[_0x165e('0x3b')]({},_0x1cec47,_0x17006c['options']);var _0x621df0={'where':_0x1cec47[_0x165e('0x39')]};return db[_0x165e('0x2b')][_0x165e('0x1f')](_0x621df0)['then'](function(_0x48c13e){_0x5b8fb7[_0x165e('0x1f')]=_0x48c13e;if(_0x17006c[_0x165e('0x30')][_0x165e('0x3e')]){_0x1cec47['include']=[{'all':!![]}];}return db[_0x165e('0x2b')][_0x165e('0x3f')](_0x1cec47);})[_0x165e('0x24')](function(_0x36a523){_0x5b8fb7[_0x165e('0x40')]=_0x36a523;return _0x5b8fb7;})[_0x165e('0x24')](respondWithFilteredResult(_0x158fd8,_0x1cec47))[_0x165e('0x41')](handleError(_0x158fd8,null));};exports[_0x165e('0x42')]=function(_0x23e898,_0x394cfb){var _0x4a3e15={'raw':!![],'where':{'id':_0x23e898[_0x165e('0x43')]['id']}},_0x195bd3={};_0x195bd3[_0x165e('0x33')]=_[_0x165e('0x2f')](db['VoiceQueuesLog']['rawAttributes']);_0x195bd3[_0x165e('0x30')]=_[_0x165e('0x2f')](_0x23e898[_0x165e('0x30')]);_0x195bd3['filters']=_[_0x165e('0x32')](_0x195bd3[_0x165e('0x33')],_0x195bd3['query']);_0x4a3e15[_0x165e('0x34')]=_[_0x165e('0x32')](_0x195bd3[_0x165e('0x33')],qs['fields'](_0x23e898['query'][_0x165e('0x35')]));_0x4a3e15[_0x165e('0x34')]=_0x4a3e15['attributes'][_0x165e('0x36')]?_0x4a3e15[_0x165e('0x34')]:_0x195bd3['model'];if(_0x23e898[_0x165e('0x30')][_0x165e('0x3e')]){_0x4a3e15[_0x165e('0x44')]=[{'all':!![]}];}_0x4a3e15=_[_0x165e('0x3b')]({},_0x4a3e15,_0x23e898['options']);return db['VoiceQueuesLog']['find'](_0x4a3e15)[_0x165e('0x24')](handleEntityNotFound(_0x394cfb,null))[_0x165e('0x24')](respondWithResult(_0x394cfb,null))[_0x165e('0x41')](handleError(_0x394cfb,null));};exports['create']=function(_0x2b9309,_0x55b58c){return db[_0x165e('0x2b')][_0x165e('0x45')](_0x2b9309[_0x165e('0x46')],{})[_0x165e('0x24')](respondWithResult(_0x55b58c,0xc9))['catch'](handleError(_0x55b58c,null));};exports[_0x165e('0x23')]=function(_0x56ced1,_0x14e915){if(_0x56ced1['body']['id']){delete _0x56ced1[_0x165e('0x46')]['id'];}return db['VoiceQueuesLog'][_0x165e('0x47')]({'where':{'id':_0x56ced1['params']['id']}})['then'](handleEntityNotFound(_0x14e915,null))[_0x165e('0x24')](saveUpdates(_0x56ced1[_0x165e('0x46')],null))[_0x165e('0x24')](respondWithResult(_0x14e915,null))[_0x165e('0x41')](handleError(_0x14e915,null));};exports['destroy']=function(_0x29d134,_0x4ac05f){return db[_0x165e('0x2b')][_0x165e('0x47')]({'where':{'id':_0x29d134[_0x165e('0x43')]['id']}})[_0x165e('0x24')](handleEntityNotFound(_0x4ac05f,null))[_0x165e('0x24')](removeEntity(_0x4ac05f,null))['catch'](handleError(_0x4ac05f,null));}; \ No newline at end of file +var _0xe168=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','VoiceQueuesLog','includeAll','include','findAll','rows','then','params','model','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xe168,0x1c4));var _0x8e16=function(_0x3befd1,_0x346424){_0x3befd1=_0x3befd1-0x0;var _0x27809f=_0xe168[_0x3befd1];return _0x27809f;};'use strict';var emlformat=require(_0x8e16('0x0'));var rimraf=require(_0x8e16('0x1'));var zipdir=require(_0x8e16('0x2'));var jsonpatch=require(_0x8e16('0x3'));var rp=require(_0x8e16('0x4'));var moment=require('moment');var BPromise=require(_0x8e16('0x5'));var Mustache=require(_0x8e16('0x6'));var util=require(_0x8e16('0x7'));var path=require(_0x8e16('0x8'));var sox=require(_0x8e16('0x9'));var csv=require(_0x8e16('0xa'));var ejs=require(_0x8e16('0xb'));var fs=require('fs');var fs_extra=require(_0x8e16('0xc'));var _=require(_0x8e16('0xd'));var squel=require(_0x8e16('0xe'));var crypto=require(_0x8e16('0xf'));var jsforce=require(_0x8e16('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e16('0x11'));var Papa=require(_0x8e16('0x12'));var Redis=require(_0x8e16('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8e16('0x14'));var hardwareService=require(_0x8e16('0x15'));var logger=require(_0x8e16('0x16'))(_0x8e16('0x17'));var utils=require(_0x8e16('0x18'));var config=require(_0x8e16('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8e16('0x1a'))['db'];function respondWithStatusCode(_0x1e6a93,_0x2a6591){_0x2a6591=_0x2a6591||0xcc;return function(_0x1cc880){if(_0x1cc880){return _0x1e6a93[_0x8e16('0x1b')](_0x2a6591);}return _0x1e6a93['status'](_0x2a6591)[_0x8e16('0x1c')]();};}function respondWithResult(_0x108f91,_0xa4b3f){_0xa4b3f=_0xa4b3f||0xc8;return function(_0x357373){if(_0x357373){return _0x108f91[_0x8e16('0x1d')](_0xa4b3f)[_0x8e16('0x1e')](_0x357373);}};}function respondWithFilteredResult(_0x528133,_0x5a3703){return function(_0x65c4e6){if(_0x65c4e6){var _0x1c139c=typeof _0x5a3703[_0x8e16('0x1f')]===_0x8e16('0x20')&&typeof _0x5a3703['limit']===_0x8e16('0x20');var _0x195409=_0x65c4e6[_0x8e16('0x21')];var _0x3054b3=_0x1c139c?0x0:_0x5a3703['offset'];var _0x4754f2=_0x1c139c?_0x65c4e6['count']:_0x5a3703[_0x8e16('0x1f')]+_0x5a3703[_0x8e16('0x22')];var _0x454dda;if(_0x4754f2>=_0x195409){_0x4754f2=_0x195409;_0x454dda=0xc8;}else{_0x454dda=0xce;}_0x528133[_0x8e16('0x1d')](_0x454dda);return _0x528133['set'](_0x8e16('0x23'),_0x3054b3+'-'+_0x4754f2+'/'+_0x195409)['json'](_0x65c4e6);}return null;};}function patchUpdates(_0x867214){return function(_0x20f88a){try{jsonpatch[_0x8e16('0x24')](_0x20f88a,_0x867214,!![]);}catch(_0x5c1638){return BPromise[_0x8e16('0x25')](_0x5c1638);}return _0x20f88a[_0x8e16('0x26')]();};}function saveUpdates(_0x15a2f8,_0x194a59){return function(_0x14b860){if(_0x14b860){return _0x14b860[_0x8e16('0x27')](_0x15a2f8)['then'](function(_0x557dca){return _0x557dca;});}return null;};}function removeEntity(_0x45616f,_0x10585d){return function(_0x40085e){if(_0x40085e){return _0x40085e[_0x8e16('0x28')]()['then'](function(){_0x45616f[_0x8e16('0x1d')](0xcc)[_0x8e16('0x1c')]();});}};}function handleEntityNotFound(_0x24f6ab,_0x5a6580){return function(_0x6a2884){if(!_0x6a2884){_0x24f6ab['sendStatus'](0x194);}return _0x6a2884;};}function handleError(_0x5b806,_0x36b9ca){_0x36b9ca=_0x36b9ca||0x1f4;return function(_0x19ca3b){logger[_0x8e16('0x29')](_0x19ca3b[_0x8e16('0x2a')]);if(_0x19ca3b['name']){delete _0x19ca3b[_0x8e16('0x2b')];}_0x5b806['status'](_0x36b9ca)[_0x8e16('0x2c')](_0x19ca3b);};}exports[_0x8e16('0x2d')]=function(_0x21fb6a,_0x568b6e){var _0x2df8d3={},_0x4c494b={},_0x57b029={'count':0x0,'rows':[]};var _0x509842=_[_0x8e16('0x2e')](db['VoiceQueuesLog'][_0x8e16('0x2f')],function(_0x3e7dd0){return{'name':_0x3e7dd0['fieldName'],'type':_0x3e7dd0[_0x8e16('0x30')][_0x8e16('0x31')]};});_0x4c494b['model']=_[_0x8e16('0x2e')](_0x509842,_0x8e16('0x2b'));_0x4c494b[_0x8e16('0x32')]=_[_0x8e16('0x33')](_0x21fb6a[_0x8e16('0x32')]);_0x4c494b[_0x8e16('0x34')]=_[_0x8e16('0x35')](_0x4c494b['model'],_0x4c494b[_0x8e16('0x32')]);_0x2df8d3[_0x8e16('0x36')]=_[_0x8e16('0x35')](_0x4c494b['model'],qs['fields'](_0x21fb6a['query'][_0x8e16('0x37')]));_0x2df8d3[_0x8e16('0x36')]=_0x2df8d3['attributes'][_0x8e16('0x38')]?_0x2df8d3[_0x8e16('0x36')]:_0x4c494b['model'];if(!_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x39')](_0x8e16('0x3a'))){_0x2df8d3[_0x8e16('0x22')]=qs[_0x8e16('0x22')](_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x22')]);_0x2df8d3['offset']=qs['offset'](_0x21fb6a[_0x8e16('0x32')]['offset']);}_0x2df8d3[_0x8e16('0x3b')]=qs['sort'](_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x3c')]);_0x2df8d3[_0x8e16('0x3d')]=qs[_0x8e16('0x34')](_[_0x8e16('0x3e')](_0x21fb6a['query'],_0x4c494b[_0x8e16('0x34')]),_0x509842);if(_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x3f')]){_0x2df8d3[_0x8e16('0x3d')]=_[_0x8e16('0x40')](_0x2df8d3[_0x8e16('0x3d')],{'$or':_[_0x8e16('0x2e')](_0x509842,function(_0x4e5a58){if(_0x4e5a58[_0x8e16('0x30')]!==_0x8e16('0x41')){var _0xddd731={};_0xddd731[_0x4e5a58['name']]={'$like':'%'+_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x3f')]+'%'};return _0xddd731;}})});}_0x2df8d3=_['merge']({},_0x2df8d3,_0x21fb6a['options']);var _0x3c3070={'where':_0x2df8d3[_0x8e16('0x3d')]};return db[_0x8e16('0x42')]['count'](_0x3c3070)['then'](function(_0x174362){_0x57b029['count']=_0x174362;if(_0x21fb6a[_0x8e16('0x32')][_0x8e16('0x43')]){_0x2df8d3[_0x8e16('0x44')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x8e16('0x45')](_0x2df8d3);})['then'](function(_0xfa590e){_0x57b029[_0x8e16('0x46')]=_0xfa590e;return _0x57b029;})[_0x8e16('0x47')](respondWithFilteredResult(_0x568b6e,_0x2df8d3))['catch'](handleError(_0x568b6e,null));};exports['show']=function(_0x5eb987,_0x5243a7){var _0x5655dc={'raw':!![],'where':{'id':_0x5eb987[_0x8e16('0x48')]['id']}},_0x314759={};_0x314759[_0x8e16('0x49')]=_['keys'](db[_0x8e16('0x42')]['rawAttributes']);_0x314759[_0x8e16('0x32')]=_[_0x8e16('0x33')](_0x5eb987[_0x8e16('0x32')]);_0x314759[_0x8e16('0x34')]=_['intersection'](_0x314759[_0x8e16('0x49')],_0x314759[_0x8e16('0x32')]);_0x5655dc[_0x8e16('0x36')]=_['intersection'](_0x314759['model'],qs[_0x8e16('0x37')](_0x5eb987['query'][_0x8e16('0x37')]));_0x5655dc[_0x8e16('0x36')]=_0x5655dc['attributes'][_0x8e16('0x38')]?_0x5655dc['attributes']:_0x314759[_0x8e16('0x49')];if(_0x5eb987[_0x8e16('0x32')][_0x8e16('0x43')]){_0x5655dc['include']=[{'all':!![]}];}_0x5655dc=_['merge']({},_0x5655dc,_0x5eb987[_0x8e16('0x4a')]);return db[_0x8e16('0x42')][_0x8e16('0x4b')](_0x5655dc)[_0x8e16('0x47')](handleEntityNotFound(_0x5243a7,null))[_0x8e16('0x47')](respondWithResult(_0x5243a7,null))[_0x8e16('0x4c')](handleError(_0x5243a7,null));};exports[_0x8e16('0x4d')]=function(_0x4ce242,_0x5bf5a4){return db[_0x8e16('0x42')]['create'](_0x4ce242['body'],{})[_0x8e16('0x47')](respondWithResult(_0x5bf5a4,0xc9))[_0x8e16('0x4c')](handleError(_0x5bf5a4,null));};exports[_0x8e16('0x27')]=function(_0x836508,_0x3670f1){if(_0x836508[_0x8e16('0x4e')]['id']){delete _0x836508['body']['id'];}return db[_0x8e16('0x42')][_0x8e16('0x4b')]({'where':{'id':_0x836508[_0x8e16('0x48')]['id']}})[_0x8e16('0x47')](handleEntityNotFound(_0x3670f1,null))[_0x8e16('0x47')](saveUpdates(_0x836508[_0x8e16('0x4e')],null))['then'](respondWithResult(_0x3670f1,null))[_0x8e16('0x4c')](handleError(_0x3670f1,null));};exports[_0x8e16('0x28')]=function(_0x1cd369,_0x4e1576){return db[_0x8e16('0x42')][_0x8e16('0x4b')]({'where':{'id':_0x1cd369[_0x8e16('0x48')]['id']}})[_0x8e16('0x47')](handleEntityNotFound(_0x4e1576,null))[_0x8e16('0x47')](removeEntity(_0x4e1576,null))[_0x8e16('0x4c')](handleError(_0x4e1576,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d89c3c3..deae900 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 _0xc44d=['api','moment','request-promise','path','rimraf','../../config/environment','exports','event','lodash','../../config/logger'];(function(_0xd43b9b,_0x12c924){var _0x23427f=function(_0x323c2d){while(--_0x323c2d){_0xd43b9b['push'](_0xd43b9b['shift']());}};_0x23427f(++_0x12c924);}(_0xc44d,0xc6));var _0xdc44=function(_0x3bf838,_0x22b424){_0x3bf838=_0x3bf838-0x0;var _0x2a279f=_0xc44d[_0x3bf838];return _0x2a279f;};'use strict';var _=require(_0xdc44('0x0'));var util=require('util');var logger=require(_0xdc44('0x1'))(_0xdc44('0x2'));var moment=require(_0xdc44('0x3'));var BPromise=require('bluebird');var rp=require(_0xdc44('0x4'));var fs=require('fs');var path=require(_0xdc44('0x5'));var rimraf=require(_0xdc44('0x6'));var config=require(_0xdc44('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0xdc44('0x8')]=function(_0x5cbb51,_0x36a987){return _0x5cbb51['define']('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0xdc44('0x9'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x0775=['rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2775e5,_0x345815){var _0x4e7b53=function(_0x202f0e){while(--_0x202f0e){_0x2775e5['push'](_0x2775e5['shift']());}};_0x4e7b53(++_0x345815);}(_0x0775,0x92));var _0x5077=function(_0x5399cd,_0x247471){_0x5399cd=_0x5399cd-0x0;var _0x3b7e18=_0x0775[_0x5399cd];return _0x3b7e18;};'use strict';var _=require(_0x5077('0x0'));var util=require(_0x5077('0x1'));var logger=require(_0x5077('0x2'))(_0x5077('0x3'));var moment=require(_0x5077('0x4'));var BPromise=require(_0x5077('0x5'));var rp=require(_0x5077('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5077('0x7'));var config=require(_0x5077('0x8'));var attributes=require(_0x5077('0x9'));module[_0x5077('0xa')]=function(_0xa0b89a,_0xecb868){return _0xa0b89a[_0x5077('0xb')](_0x5077('0xc'),attributes,{'tableName':_0x5077('0xd'),'paranoid':![],'indexes':[{'name':_0x5077('0xe'),'fields':[_0x5077('0xf'),_0x5077('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 188bb2a..3b033f6 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 _0x682e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x4a8418,_0x39078a){var _0x390174=function(_0x173ea6){while(--_0x173ea6){_0x4a8418['push'](_0x4a8418['shift']());}};_0x390174(++_0x39078a);}(_0x682e,0x119));var _0xe682=function(_0x564795,_0x429022){_0x564795=_0x564795-0x0;var _0x359c30=_0x682e[_0x564795];return _0x359c30;};'use strict';var _=require(_0xe682('0x0'));var util=require('util');var moment=require(_0xe682('0x1'));var BPromise=require(_0xe682('0x2'));var rs=require(_0xe682('0x3'));var fs=require('fs');var Redis=require(_0xe682('0x4'));var db=require(_0xe682('0x5'))['db'];var utils=require(_0xe682('0x6'));var logger=require(_0xe682('0x7'))(_0xe682('0x8'));var config=require(_0xe682('0x9'));var jayson=require(_0xe682('0xa'));var client=jayson[_0xe682('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x82fa21,_0x1d766a,_0x214393){return new BPromise(function(_0x283937,_0x5d9cd5){return client[_0xe682('0xc')](_0x82fa21,_0x214393)[_0xe682('0xd')](function(_0xc6d5fe){logger[_0xe682('0xe')](_0xe682('0xf'),_0x1d766a,_0xe682('0x10'));logger['debug'](_0xe682('0x11'),_0x1d766a,_0xe682('0x10'),JSON['stringify'](_0xc6d5fe));if(_0xc6d5fe[_0xe682('0x12')]){if(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x13')]===0x1f4){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x5d9cd5(_0xc6d5fe['error'][_0xe682('0x14')]);}logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);return _0x283937(_0xc6d5fe[_0xe682('0x12')][_0xe682('0x14')]);}else{logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x1d766a,_0xe682('0x10'));_0x283937(_0xc6d5fe[_0xe682('0x15')][_0xe682('0x14')]);}})['catch'](function(_0x11b0aa){logger[_0xe682('0x12')](_0xe682('0xf'),_0x1d766a,_0x11b0aa);_0x5d9cd5(_0x11b0aa);});});} \ No newline at end of file +var _0x422f=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x422f,0xd9));var _0xf422=function(_0x307ec9,_0x2e0223){_0x307ec9=_0x307ec9-0x0;var _0x5a331d=_0x422f[_0x307ec9];return _0x5a331d;};'use strict';var _=require(_0xf422('0x0'));var util=require('util');var moment=require(_0xf422('0x1'));var BPromise=require(_0xf422('0x2'));var rs=require(_0xf422('0x3'));var fs=require('fs');var Redis=require(_0xf422('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf422('0x5'));var logger=require(_0xf422('0x6'))(_0xf422('0x7'));var config=require(_0xf422('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3df250,_0x3b667b,_0x44e391){return new BPromise(function(_0x3f6f26,_0x4b88de){return client[_0xf422('0xb')](_0x3df250,_0x44e391)[_0xf422('0xc')](function(_0x28e169){logger[_0xf422('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3b667b,_0xf422('0xe'));logger[_0xf422('0xf')](_0xf422('0x10'),_0x3b667b,_0xf422('0xe'),JSON[_0xf422('0x11')](_0x28e169));if(_0x28e169[_0xf422('0x12')]){if(_0x28e169[_0xf422('0x12')][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')](_0xf422('0x14'),_0x3b667b,_0x28e169[_0xf422('0x12')]['message']);return _0x4b88de(_0x28e169[_0xf422('0x12')][_0xf422('0x15')]);}logger[_0xf422('0x12')](_0xf422('0x14'),_0x3b667b,_0x28e169[_0xf422('0x12')][_0xf422('0x15')]);return _0x3f6f26(_0x28e169[_0xf422('0x12')][_0xf422('0x15')]);}else{logger['info'](_0xf422('0x14'),_0x3b667b,_0xf422('0xe'));_0x3f6f26(_0x28e169[_0xf422('0x16')][_0xf422('0x15')]);}})[_0xf422('0x17')](function(_0x42e868){logger[_0xf422('0x12')](_0xf422('0x14'),_0x3b667b,_0x42e868);_0x4b88de(_0x42e868);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a8555ad..d6e03d0 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 _0x7198=['../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','download','downloads','downloadTranscribe','post','create','put','update','delete','/:id','destroy','path','express','Router','fs-extra'];(function(_0x5a0fc2,_0x8ce4fb){var _0x4213f8=function(_0x352ab5){while(--_0x352ab5){_0x5a0fc2['push'](_0x5a0fc2['shift']());}};_0x4213f8(++_0x8ce4fb);}(_0x7198,0xb0));var _0x8719=function(_0x5e6440,_0x409bb5){_0x5e6440=_0x5e6440-0x0;var _0x47e4ec=_0x7198[_0x5e6440];return _0x47e4ec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8719('0x0'));var timeout=require('connect-timeout');var express=require(_0x8719('0x1'));var router=express[_0x8719('0x2')]();var fs_extra=require(_0x8719('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8719('0x4'));var controller=require(_0x8719('0x5'));router[_0x8719('0x6')]('/',auth[_0x8719('0x7')](),controller[_0x8719('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8719('0x9')]);router[_0x8719('0x6')]('/:id',auth[_0x8719('0x7')](),controller['show']);router[_0x8719('0x6')]('/:id/download',auth[_0x8719('0x7')](),controller[_0x8719('0xa')]);router[_0x8719('0x6')]('/:id/downloads',controller[_0x8719('0xb')]);router[_0x8719('0x6')]('/:id/transcribe',auth[_0x8719('0x7')](),controller[_0x8719('0xc')]);router[_0x8719('0xd')]('/',auth['isAuthenticated'](),controller[_0x8719('0xe')]);router[_0x8719('0xd')]('/:id/transcribe',auth[_0x8719('0x7')](),controller['runTranscribe']);router[_0x8719('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8719('0x10')]);router[_0x8719('0x11')](_0x8719('0x12'),auth['isAuthenticated'](),controller[_0x8719('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbabd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xbabd,0x1ea));var _0xdbab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbabd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xdbab('0x0'));var util=require('util');var path=require(_0xdbab('0x1'));var timeout=require(_0xdbab('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdbab('0x3'));var auth=require(_0xdbab('0x4'));var interaction=require(_0xdbab('0x5'));var config=require(_0xdbab('0x6'));var controller=require(_0xdbab('0x7'));router[_0xdbab('0x8')]('/',auth[_0xdbab('0x9')](),controller[_0xdbab('0xa')]);router['get'](_0xdbab('0xb'),auth['isAuthenticated'](),controller[_0xdbab('0xc')]);router[_0xdbab('0x8')](_0xdbab('0xd'),auth[_0xdbab('0x9')](),controller[_0xdbab('0xe')]);router[_0xdbab('0x8')](_0xdbab('0xf'),auth[_0xdbab('0x9')](),controller[_0xdbab('0x10')]);router[_0xdbab('0x8')](_0xdbab('0x11'),controller[_0xdbab('0x12')]);router['get'](_0xdbab('0x13'),auth[_0xdbab('0x9')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xdbab('0x14')](_0xdbab('0x13'),auth[_0xdbab('0x9')](),controller['runTranscribe']);router[_0xdbab('0x15')](_0xdbab('0xd'),auth['isAuthenticated'](),controller[_0xdbab('0x16')]);router[_0xdbab('0x17')]('/:id',auth[_0xdbab('0x9')](),controller[_0xdbab('0x18')]);module[_0xdbab('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 5c5f27c..fecd818 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(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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 3930298..cab1576 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 _0xe0e9=['VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','uniqueid','$and','push','Sequelize','destroy','Entity\x20not\x20found','info','isNil','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','count','includeAll','rows','catch','show','rawAttributes','fields','include','find','create','body','describe','download','params','value','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError'];(function(_0x141a2c,_0x363af0){var _0x25e0e4=function(_0xdc6572){while(--_0xdc6572){_0x141a2c['push'](_0x141a2c['shift']());}};_0x25e0e4(++_0x363af0);}(_0xe0e9,0xdf));var _0x9e0e=function(_0x1a438e,_0x19709d){_0x1a438e=_0x1a438e-0x0;var _0x13cf5a=_0xe0e9[_0x1a438e];return _0x13cf5a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9e0e('0x0'));var zipdir=require(_0x9e0e('0x1'));var jsonpatch=require(_0x9e0e('0x2'));var rp=require(_0x9e0e('0x3'));var moment=require(_0x9e0e('0x4'));var BPromise=require(_0x9e0e('0x5'));var Mustache=require(_0x9e0e('0x6'));var util=require(_0x9e0e('0x7'));var path=require(_0x9e0e('0x8'));var sox=require('sox');var csv=require(_0x9e0e('0x9'));var ejs=require(_0x9e0e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9e0e('0xb'));var squel=require(_0x9e0e('0xc'));var crypto=require(_0x9e0e('0xd'));var jsforce=require(_0x9e0e('0xe'));var deskjs=require(_0x9e0e('0xf'));var toCsv=require(_0x9e0e('0x9'));var querystring=require(_0x9e0e('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x9e0e('0x11'));var Redis=require(_0x9e0e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9e0e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9e0e('0x14'));var logger=require(_0x9e0e('0x15'))(_0x9e0e('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9e0e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556640,_0x44d953){_0x44d953=_0x44d953||0xcc;return function(_0x35d8f0){if(_0x35d8f0){return _0x556640[_0x9e0e('0x18')](_0x44d953);}return _0x556640[_0x9e0e('0x19')](_0x44d953)[_0x9e0e('0x1a')]();};}function respondWithResult(_0x59a389,_0xfb17c8){_0xfb17c8=_0xfb17c8||0xc8;return function(_0x5f7b15){if(_0x5f7b15){return _0x59a389[_0x9e0e('0x19')](_0xfb17c8)[_0x9e0e('0x1b')](_0x5f7b15);}};}function respondWithFilteredResult(_0x476204,_0x3c663a){return function(_0x10ea6a){if(_0x10ea6a){var _0x43ace5=typeof _0x3c663a[_0x9e0e('0x1c')]===_0x9e0e('0x1d')&&typeof _0x3c663a[_0x9e0e('0x1e')]===_0x9e0e('0x1d');var _0x51b8bc=_0x10ea6a['count'];var _0x4bf81a=_0x43ace5?0x0:_0x3c663a[_0x9e0e('0x1c')];var _0x3300b0=_0x43ace5?_0x10ea6a['count']:_0x3c663a['offset']+_0x3c663a[_0x9e0e('0x1e')];var _0x48876d;if(_0x3300b0>=_0x51b8bc){_0x3300b0=_0x51b8bc;_0x48876d=0xc8;}else{_0x48876d=0xce;}_0x476204[_0x9e0e('0x19')](_0x48876d);return _0x476204[_0x9e0e('0x1f')](_0x9e0e('0x20'),_0x4bf81a+'-'+_0x3300b0+'/'+_0x51b8bc)[_0x9e0e('0x1b')](_0x10ea6a);}return null;};}function patchUpdates(_0x29c1a7){return function(_0x448fa3){try{jsonpatch['apply'](_0x448fa3,_0x29c1a7,!![]);}catch(_0x3bd3c1){return BPromise[_0x9e0e('0x21')](_0x3bd3c1);}return _0x448fa3[_0x9e0e('0x22')]();};}function saveUpdates(_0x25c45c,_0xbf0336){return function(_0xbe94cc){if(_0xbe94cc){return _0xbe94cc[_0x9e0e('0x23')](_0x25c45c)[_0x9e0e('0x24')](function(_0x266d16){return _0x266d16;});}return null;};}function removeEntity(_0x2b9552,_0x12c5f8){return function(_0x2605dc){if(_0x2605dc){return _0x2605dc['destroy']()[_0x9e0e('0x24')](function(){_0x2b9552[_0x9e0e('0x19')](0xcc)[_0x9e0e('0x1a')]();});}};}function handleEntityNotFound(_0x19447e,_0x401988){return function(_0x4d813c){if(!_0x4d813c){_0x19447e[_0x9e0e('0x18')](0x194);}return _0x4d813c;};}function handleError(_0xf0d10a,_0x17e0a3){_0x17e0a3=_0x17e0a3||0x1f4;return function(_0x562172){logger[_0x9e0e('0x25')](_0x562172[_0x9e0e('0x26')]);if(_0x562172[_0x9e0e('0x27')]){delete _0x562172[_0x9e0e('0x27')];}_0xf0d10a['status'](_0x17e0a3)[_0x9e0e('0x28')](_0x562172);};}exports[_0x9e0e('0x29')]=function(_0x1bd0e7,_0x1d6313){var _0x3fcc5b={},_0x273e00={},_0x52a155={'count':0x0,'rows':[]};var _0x113c83=_[_0x9e0e('0x2a')](db[_0x9e0e('0x2b')]['rawAttributes'],function(_0x2ca2c7){return{'name':_0x2ca2c7[_0x9e0e('0x2c')],'type':_0x2ca2c7[_0x9e0e('0x2d')][_0x9e0e('0x2e')]};});_0x273e00[_0x9e0e('0x2f')]=_[_0x9e0e('0x30')](_['map'](_0x113c83,_0x9e0e('0x27')),[_0x9e0e('0x31')]);_0x273e00[_0x9e0e('0x32')]=_[_0x9e0e('0x33')](_0x1bd0e7['query']);_0x273e00[_0x9e0e('0x34')]=_['intersection'](_0x273e00[_0x9e0e('0x2f')],_0x273e00['query']);_0x3fcc5b[_0x9e0e('0x35')]=_[_0x9e0e('0x36')](_0x273e00['model'],qs['fields'](_0x1bd0e7[_0x9e0e('0x32')]['fields']));_0x3fcc5b['attributes']=_0x3fcc5b[_0x9e0e('0x35')]['length']?_0x3fcc5b['attributes']:_0x273e00[_0x9e0e('0x2f')];if(!_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x37')](_0x9e0e('0x38'))){_0x3fcc5b[_0x9e0e('0x1e')]=qs[_0x9e0e('0x1e')](_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x1e')]);_0x3fcc5b['offset']=qs[_0x9e0e('0x1c')](_0x1bd0e7['query'][_0x9e0e('0x1c')]);}_0x3fcc5b[_0x9e0e('0x39')]=qs['sort'](_0x1bd0e7[_0x9e0e('0x32')][_0x9e0e('0x3a')]);_0x3fcc5b['where']=qs['filters'](_['pick'](_0x1bd0e7[_0x9e0e('0x32')],_0x273e00[_0x9e0e('0x34')]),_0x113c83);if(_0x1bd0e7[_0x9e0e('0x32')]['filter']){_0x3fcc5b[_0x9e0e('0x3b')]=_['merge'](_0x3fcc5b[_0x9e0e('0x3b')],{'$or':_['map'](_0x113c83,function(_0x3c9437){if(_0x3c9437[_0x9e0e('0x2d')]!==_0x9e0e('0x3c')){var _0x51d052={};_0x51d052[_0x3c9437['name']]={'$like':'%'+_0x1bd0e7['query'][_0x9e0e('0x3d')]+'%'};return _0x51d052;}})});}_0x3fcc5b=_[_0x9e0e('0x3e')]({},_0x3fcc5b,_0x1bd0e7[_0x9e0e('0x3f')]);var _0x5a331c={'where':_0x3fcc5b[_0x9e0e('0x3b')]};return db['VoiceRecording'][_0x9e0e('0x40')](_0x5a331c)[_0x9e0e('0x24')](function(_0xdbc3b4){_0x52a155[_0x9e0e('0x40')]=_0xdbc3b4;if(_0x1bd0e7['query'][_0x9e0e('0x41')]){_0x3fcc5b['include']=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3fcc5b);})[_0x9e0e('0x24')](function(_0x2e0c8e){_0x52a155[_0x9e0e('0x42')]=_0x2e0c8e;return _0x52a155;})[_0x9e0e('0x24')](respondWithFilteredResult(_0x1d6313,_0x3fcc5b))[_0x9e0e('0x43')](handleError(_0x1d6313,null));};exports[_0x9e0e('0x44')]=function(_0x36d4e1,_0x2a6caa){var _0x595f78={'raw':![],'where':{'id':_0x36d4e1['params']['id']}},_0x50e45c={};_0x50e45c[_0x9e0e('0x2f')]=_[_0x9e0e('0x33')](db[_0x9e0e('0x2b')][_0x9e0e('0x45')]);_0x50e45c[_0x9e0e('0x32')]=_[_0x9e0e('0x33')](_0x36d4e1['query']);_0x50e45c[_0x9e0e('0x34')]=_[_0x9e0e('0x36')](_0x50e45c['model'],_0x50e45c[_0x9e0e('0x32')]);_0x595f78['attributes']=_[_0x9e0e('0x36')](_0x50e45c['model'],qs[_0x9e0e('0x46')](_0x36d4e1[_0x9e0e('0x32')][_0x9e0e('0x46')]));_0x595f78[_0x9e0e('0x35')]=_0x595f78[_0x9e0e('0x35')]['length']?_0x595f78[_0x9e0e('0x35')]:_0x50e45c[_0x9e0e('0x2f')];if(_0x36d4e1[_0x9e0e('0x32')][_0x9e0e('0x41')]){_0x595f78[_0x9e0e('0x47')]=[{'all':!![]}];}_0x595f78=_[_0x9e0e('0x3e')]({},_0x595f78,_0x36d4e1[_0x9e0e('0x3f')]);return db[_0x9e0e('0x2b')][_0x9e0e('0x48')](_0x595f78)[_0x9e0e('0x24')](handleEntityNotFound(_0x2a6caa,null))['then'](respondWithResult(_0x2a6caa,null))['catch'](handleError(_0x2a6caa,null));};exports[_0x9e0e('0x49')]=function(_0x23a143,_0x1208dd){return db[_0x9e0e('0x2b')]['create'](_0x23a143[_0x9e0e('0x4a')],{})[_0x9e0e('0x24')](respondWithResult(_0x1208dd,0xc9))['catch'](handleError(_0x1208dd,null));};exports[_0x9e0e('0x23')]=function(_0xb10af6,_0x38dfa3){if(_0xb10af6['body']['id']){delete _0xb10af6[_0x9e0e('0x4a')]['id'];}return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':{'id':_0xb10af6['params']['id']}})[_0x9e0e('0x24')](handleEntityNotFound(_0x38dfa3,null))[_0x9e0e('0x24')](saveUpdates(_0xb10af6[_0x9e0e('0x4a')],null))['then'](respondWithResult(_0x38dfa3,null))['catch'](handleError(_0x38dfa3,null));};exports[_0x9e0e('0x4b')]=function(_0x5c7442,_0xe8e2f6){return db[_0x9e0e('0x2b')][_0x9e0e('0x4b')]()[_0x9e0e('0x24')](respondWithResult(_0xe8e2f6,null))['catch'](handleError(_0xe8e2f6,null));};exports[_0x9e0e('0x4c')]=function(_0x37968e,_0x88272f,_0x2b9f71){var _0x217953=require('../../components/encryptor');var _0x132dc2=![];var _0x138a46={};if(_0x37968e[_0x9e0e('0x32')][_0x9e0e('0x2d')]&&_0x37968e['query'][_0x9e0e('0x2d')]==='uniqueid'){_0x138a46['uniqueid']=_0x37968e['params']['id'];}else{_0x138a46['id']=_0x37968e[_0x9e0e('0x4d')]['id'];}return db['VoiceRecording'][_0x9e0e('0x48')]({'where':_0x138a46,'attributes':['id',_0x9e0e('0x4e')],'raw':!![]})[_0x9e0e('0x24')](handleEntityNotFound(_0x88272f,null))['then'](function(_0x279fc1){if(_0x279fc1){var _0x16ad7c=_0x279fc1['value'];var _0x122858=util[_0x9e0e('0x31')](_0x9e0e('0x4f'),_0x16ad7c);if(fs[_0x9e0e('0x50')](_0x122858)){_0x132dc2=!![];return _0x217953[_0x9e0e('0x51')](_0x122858,_0x16ad7c,config[_0x9e0e('0x52')][_0x9e0e('0x53')])['then'](function(){return _0x279fc1;});}return _0x279fc1;}})[_0x9e0e('0x24')](function(_0x1c8537){if(_0x1c8537){var _0x2f9c75=_0x1c8537[_0x9e0e('0x4e')];if(!fs[_0x9e0e('0x50')](_0x2f9c75)){throw new db['Sequelize'][(_0x9e0e('0x54'))](_0x9e0e('0x55'));}if(_0x1c8537[_0x9e0e('0x56')]){return _0x88272f[_0x9e0e('0x4c')](_0x2f9c75,_0x1c8537[_0x9e0e('0x56')]+path[_0x9e0e('0x57')](_0x2f9c75),function(){if(_0x132dc2){fs[_0x9e0e('0x58')](_0x2f9c75);}});}else{return _0x88272f[_0x9e0e('0x4c')](_0x2f9c75,function(_0x4293e3){if(_0x132dc2){fs[_0x9e0e('0x58')](_0x2f9c75);}});}}})[_0x9e0e('0x43')](function(_0x3a7b35){if(_0x3a7b35[_0x9e0e('0x59')]==='VoiceRecording\x20not\x20found'){_0x88272f['status'](0x194)[_0x9e0e('0x28')](_0x9e0e('0x5a'));}else{return handleError(_0x88272f,null);}});};exports['downloads']=function(_0x3a060e,_0x2b5618,_0x14311b){var _0x7d9692=require(_0x9e0e('0x5b'));var _0x10221d=![];var _0x4ad002={'$and':[db[_0x9e0e('0x5c')][_0x9e0e('0x3b')](db[_0x9e0e('0x5c')]['fn'](_0x9e0e('0x5d'),db[_0x9e0e('0x5c')][_0x9e0e('0x5e')]('uniqueid')),_0x3a060e[_0x9e0e('0x32')][_0x9e0e('0x5f')])]};if(_0x3a060e[_0x9e0e('0x32')][_0x9e0e('0x2d')]&&_0x3a060e['query']['type']===_0x9e0e('0x60')){_0x4ad002[_0x9e0e('0x61')][_0x9e0e('0x62')]({'uniqueid':_0x3a060e[_0x9e0e('0x4d')]['id']});}else{_0x4ad002[_0x9e0e('0x61')][_0x9e0e('0x62')]({'id':_0x3a060e[_0x9e0e('0x4d')]['id']});}return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':_0x4ad002,'attributes':['id',_0x9e0e('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2b5618,null))[_0x9e0e('0x24')](function(_0x37d1bd){if(_0x37d1bd){var _0x1f1485=util[_0x9e0e('0x31')](_0x9e0e('0x4f'),_0x37d1bd['value']);if(fs[_0x9e0e('0x50')](_0x1f1485)){_0x10221d=!![];return _0x7d9692[_0x9e0e('0x51')](_0x1f1485,_0x37d1bd[_0x9e0e('0x4e')],config[_0x9e0e('0x52')]['recording'])[_0x9e0e('0x24')](function(){return _0x37d1bd;});}return _0x37d1bd;}})[_0x9e0e('0x24')](function(_0x11193b){if(_0x11193b){if(!fs[_0x9e0e('0x50')](_0x11193b[_0x9e0e('0x4e')])){throw new db[(_0x9e0e('0x63'))]['ValidationError'](_0x9e0e('0x55'));}if(_0x11193b['filename']){return _0x2b5618[_0x9e0e('0x4c')](_0x11193b['value'],_0x11193b[_0x9e0e('0x56')]+path['extname'](_0x11193b['value']),function(){if(_0x10221d){fs['unlink'](_0x11193b['value']);}});}else{return _0x2b5618['download'](_0x11193b[_0x9e0e('0x4e')],function(_0x23cbe3){if(_0x10221d){fs['unlink'](_0x11193b[_0x9e0e('0x4e')]);}});}}})[_0x9e0e('0x43')](handleError(_0x2b5618,null));};exports[_0x9e0e('0x64')]=function(_0x1d5f5e,_0x212a5d){return db[_0x9e0e('0x2b')][_0x9e0e('0x48')]({'where':{'id':_0x1d5f5e[_0x9e0e('0x4d')]['id']}})['then'](function(_0x222a3c){if(_['isNil'](_0x222a3c)){throw new ReferenceError(_0x9e0e('0x65'));}return _0x222a3c;})[_0x9e0e('0x24')](function(_0x111c0c){var _0x57a5eb=_0x111c0c[_0x9e0e('0x4e')];logger[_0x9e0e('0x66')]('cancellazione\x20fisica\x20documento\x20%s',_0x57a5eb);if(!_[_0x9e0e('0x67')](_0x111c0c[_0x9e0e('0x4e')])&&fs[_0x9e0e('0x50')](_0x57a5eb)){logger[_0x9e0e('0x66')]('File:\x20\x22'+_0x57a5eb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9e0e('0x68')](_0x57a5eb);}_0x57a5eb=_0x57a5eb+_0x9e0e('0x69');if(!_[_0x9e0e('0x67')](_0x111c0c['value'])&&fs[_0x9e0e('0x50')](_0x57a5eb)){logger[_0x9e0e('0x66')](_0x9e0e('0x6a')+_0x57a5eb+_0x9e0e('0x6b'));fs[_0x9e0e('0x68')](_0x57a5eb);}return _0x111c0c;})[_0x9e0e('0x24')](function(_0x33304a){if(!_0x33304a)throw new InternalError();return _0x33304a[_0x9e0e('0x64')]();})[_0x9e0e('0x24')](function(){_0x212a5d[_0x9e0e('0x19')](0xcc)[_0x9e0e('0x1a')]();})[_0x9e0e('0x43')](handleError(_0x212a5d,null));};function getBucketslist(_0x379a52,_0x5ae984,_0x8987e6){return new Promise(function(_0x453f68,_0x76dfc){var _0x38389b=new AWS['S3']({'accessKeyId':_0x5ae984,'secretAccessKey':_0x379a52,'region':_0x8987e6});_0x38389b[_0x9e0e('0x6c')]({},function(_0x34ce1b,_0x287346){if(_0x34ce1b){return _0x76dfc(_0x34ce1b);}else{return _0x453f68(_0x287346);}});});}function createBucket(_0x50054a,_0x37896d,_0x5699bc,_0x72cf6){return new Promise(function(_0x164cfb,_0x33995c){var _0x5d2553=new AWS['S3']({'accessKeyId':_0x37896d,'secretAccessKey':_0x50054a,'region':_0x5699bc});_0x5d2553[_0x9e0e('0x6d')]({'Bucket':_0x72cf6},function(_0x166f94,_0x5b5a69){if(_0x166f94){return _0x33995c(_0x166f94);}else{return _0x164cfb(_0x5b5a69);}});});}function uploadFile(_0x44e904,_0x33d6b3,_0x1806f9,_0x5a7212,_0x48761e,_0x4fdd8d){return new Promise(function(_0x384026,_0x4fea33){var _0x5564f5=new AWS['S3']({'accessKeyId':_0x33d6b3,'secretAccessKey':_0x44e904,'region':_0x1806f9});_0x5564f5[_0x9e0e('0x6e')]({'Bucket':_0x5a7212,'Key':_0x48761e,'Body':_0x4fdd8d},function(_0x1ba4c2,_0x24ca64){if(_0x1ba4c2){return _0x4fea33(_0x1ba4c2);}else{return _0x384026(_0x24ca64);}});});}function startTranscribe(_0x2c0c17,_0x53e5b8,_0x1f0328,_0x4e06a0,_0x288856,_0x2ed92d){return new Promise(function(_0x1022ba,_0x18eebd){var _0x1a630a=new AWS[(_0x9e0e('0x6f'))]({'accessKeyId':_0x53e5b8,'secretAccessKey':_0x2c0c17,'region':_0x1f0328});_0x1a630a['startTranscriptionJob']({'TranscriptionJobName':_0x4e06a0,'LanguageCode':_0x288856,'Media':{'MediaFileUri':_0x2ed92d}},function(_0x56759e,_0x43476c){if(_0x56759e){return _0x18eebd(_0x56759e);}else{return _0x1022ba(_0x43476c);}});});}function transcribe(_0x3489a6,_0x4ee378,_0x437dac,_0x47c779,_0x17f7b6,_0x586d29,_0x446f0b){return new Promise(function(_0x2bcbd4,_0x237920){var _0x1c811c={};logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3489a6,_0x17f7b6));return uploadFile(_0x4ee378,_0x437dac,_0x47c779,_0x17f7b6,path[_0x9e0e('0x70')](_0x586d29),fs[_0x9e0e('0x71')](_0x586d29))[_0x9e0e('0x24')](function(_0x2870dd){logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x72'),_0x3489a6,_0x17f7b6,_0x2870dd[_0x9e0e('0x73')]));_0x1c811c[_0x9e0e('0x74')]=_0x2870dd[_0x9e0e('0x75')];_0x1c811c[_0x9e0e('0x76')]=_0x2870dd[_0x9e0e('0x73')];logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x77'),_0x3489a6));return startTranscribe(_0x4ee378,_0x437dac,_0x47c779,uuidv4(),_0x446f0b,_0x2870dd[_0x9e0e('0x73')]);})[_0x9e0e('0x24')](function(_0x5ef318){logger['info'](util[_0x9e0e('0x31')](_0x9e0e('0x78'),_0x3489a6,_0x5ef318[_0x9e0e('0x79')]['TranscriptionJobName']));_0x1c811c['transcribeName']=_0x5ef318['TranscriptionJob'][_0x9e0e('0x7a')];_0x1c811c['transcribeStatus']=_0x5ef318['TranscriptionJob'][_0x9e0e('0x7b')];return _0x2bcbd4(_0x1c811c);})[_0x9e0e('0x43')](function(_0x370436){return _0x237920(_0x370436);});});}exports[_0x9e0e('0x7c')]=function(_0x4211c4,_0x1ea0f4,_0x3cfade){var _0x594249;var _0x161c74;var _0x2650c8;var _0x1918a9=require(_0x9e0e('0x5b'));return db[_0x9e0e('0x2b')][_0x9e0e('0x7d')]({'where':{'id':_0x4211c4[_0x9e0e('0x4d')]['id']}})['then'](function(_0x30dd85){if(_0x30dd85){var _0x1adf2c=util[_0x9e0e('0x31')]('%s.cypher',_0x30dd85['value']);if(fs['existsSync'](_0x1adf2c)){cypher=!![];return _0x1918a9[_0x9e0e('0x51')](_0x1adf2c,_0x30dd85['value'],config[_0x9e0e('0x52')][_0x9e0e('0x53')])[_0x9e0e('0x24')](function(){return _0x30dd85;});}return _0x30dd85;}})['then'](function(_0x11338c){if(!_0x11338c){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x7e'));}_0x161c74=_0x11338c;return db[_0x9e0e('0x7f')][_0x9e0e('0x7d')]({'where':{'id':0x1}});})[_0x9e0e('0x24')](handleEntityNotFound(_0x1ea0f4,null))[_0x9e0e('0x24')](function(_0x5721f4){if(_0x5721f4){_0x594249=_0x5721f4;if(!_0x594249[_0x9e0e('0x80')]||!_0x594249[_0x9e0e('0x81')]||!_0x594249[_0x9e0e('0x82')]||!_0x594249['language']||!_0x594249['bucket']){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x83'));}if(_0x4211c4[_0x9e0e('0x4a')][_0x9e0e('0x84')]&&(!_0x594249[_0x9e0e('0x85')]||!_0x594249[_0x9e0e('0x86')]||!_0x594249[_0x9e0e('0x87')]||!_0x594249[_0x9e0e('0x88')]||!_0x594249[_0x9e0e('0x74')])){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x89'));}return db['CloudProvider'][_0x9e0e('0x7d')]({'where':{'id':_0x594249[_0x9e0e('0x81')]}});}})[_0x9e0e('0x24')](function(_0x18f117){if(!_0x18f117){throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))](_0x9e0e('0x8a'));}if(!_0x18f117[_0x9e0e('0x8b')]||!_0x18f117[_0x9e0e('0x8c')]){throw new db['Sequelize'][(_0x9e0e('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x2650c8=_0x18f117;return getBucketslist(_0x2650c8[_0x9e0e('0x8b')],_0x2650c8[_0x9e0e('0x8c')],_0x594249[_0x9e0e('0x82')]);})[_0x9e0e('0x24')](function(_0x3c997a){if(_0x3c997a&&_0x3c997a[_0x9e0e('0x8d')]){var _0x3e2545=_[_0x9e0e('0x48')](_0x3c997a['Buckets'],function(_0x5035e6){return _0x5035e6[_0x9e0e('0x8e')]===_0x594249['bucket'];});if(!_0x3e2545){logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x8f'),_0x4211c4['params']['id'],_0x594249[_0x9e0e('0x74')]));return createBucket(_0x2650c8[_0x9e0e('0x8b')],_0x2650c8['data2'],_0x594249[_0x9e0e('0x82')],_0x594249['bucket']);}logger[_0x9e0e('0x66')](util[_0x9e0e('0x31')](_0x9e0e('0x90'),_0x4211c4[_0x9e0e('0x4d')]['id'],_0x594249[_0x9e0e('0x74')]));return;}})[_0x9e0e('0x24')](function(_0x227c0a){if(_0x161c74['transcribeStatus']===_0x9e0e('0x91')){return transcribe(_0x4211c4[_0x9e0e('0x4d')]['id'],_0x2650c8[_0x9e0e('0x8b')],_0x2650c8[_0x9e0e('0x8c')],_0x594249[_0x9e0e('0x82')],_0x594249[_0x9e0e('0x74')],_0x161c74[_0x9e0e('0x4e')],_0x594249[_0x9e0e('0x88')]);}else{logger['info'](util[_0x9e0e('0x31')](_0x9e0e('0x92'),_0x4211c4[_0x9e0e('0x4d')]['id']));return{'transcribeStatus':_0x9e0e('0x93')};}})['then'](function(_0x3a5d80){if(_0x3a5d80){_0x3a5d80[_0x9e0e('0x94')]=_0x4211c4[_0x9e0e('0x4a')][_0x9e0e('0x84')];return _0x161c74[_0x9e0e('0x95')](_0x3a5d80);}})[_0x9e0e('0x24')](respondWithResult(_0x1ea0f4,null))['catch'](handleError(_0x1ea0f4,null));};function writeFile(_0x5bb737,_0x3f25b8){return new Promise(function(_0x2eeb79,_0x3ec63f){fs['writeFile'](_0x3f25b8,_0x5bb737,function(_0x1f2eb9,_0x3daf6b){if(_0x1f2eb9){return _0x3ec63f(_0x1f2eb9);}else{return _0x2eeb79(_0x3daf6b);}});});}exports['downloadTranscribe']=function(_0x49fd74,_0x1afb48,_0x5771b5){return db[_0x9e0e('0x2b')][_0x9e0e('0x7d')]({'where':{'id':_0x49fd74[_0x9e0e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1afb48))[_0x9e0e('0x24')](function(_0x54b3a6){if(_0x54b3a6&&_0x54b3a6[_0x9e0e('0x96')]){var _0x28db2c=_0x54b3a6[_0x9e0e('0x96')];var _0x47f192=config[_0x9e0e('0x97')]+_0x9e0e('0x98')+_0x54b3a6['id']+_0x9e0e('0x99');if(fs[_0x9e0e('0x50')](_0x47f192)){return _0x47f192;}return writeFile(_0x28db2c,_0x47f192)['then'](function(){return _0x47f192;});}else{throw new db[(_0x9e0e('0x63'))][(_0x9e0e('0x54'))]('Transcript\x20not\x20available');}})[_0x9e0e('0x24')](function(_0x259d94){return _0x1afb48['download'](_0x259d94);})[_0x9e0e('0x43')](handleError(_0x1afb48));}; \ No newline at end of file +var _0xf550=['Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','index','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','map','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','findAll','catch','show','find','create','body','params','describe','download','type','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','filename','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJob','TranscriptionJobName','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found'];(function(_0x161a9b,_0x39c86c){var _0x2b46a0=function(_0x4625ee){while(--_0x4625ee){_0x161a9b['push'](_0x161a9b['shift']());}};_0x2b46a0(++_0x39c86c);}(_0xf550,0x148));var _0x0f55=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xf550[_0x39d544];return _0x5a5ff2;};'use strict';var emlformat=require(_0x0f55('0x0'));var rimraf=require(_0x0f55('0x1'));var zipdir=require(_0x0f55('0x2'));var jsonpatch=require(_0x0f55('0x3'));var rp=require(_0x0f55('0x4'));var moment=require(_0x0f55('0x5'));var BPromise=require(_0x0f55('0x6'));var Mustache=require(_0x0f55('0x7'));var util=require(_0x0f55('0x8'));var path=require('path');var sox=require(_0x0f55('0x9'));var csv=require(_0x0f55('0xa'));var ejs=require(_0x0f55('0xb'));var fs=require('fs');var fs_extra=require(_0x0f55('0xc'));var _=require('lodash');var squel=require(_0x0f55('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0f55('0xe'));var toCsv=require(_0x0f55('0xa'));var querystring=require(_0x0f55('0xf'));var Papa=require(_0x0f55('0x10'));var AWS=require('aws-sdk');var uuidv4=require(_0x0f55('0x11'));var Redis=require('ioredis');var authService=require(_0x0f55('0x12'));var qs=require(_0x0f55('0x13'));var as=require(_0x0f55('0x14'));var hardwareService=require(_0x0f55('0x15'));var logger=require(_0x0f55('0x16'))('api');var utils=require(_0x0f55('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0f55('0x18'));var db=require(_0x0f55('0x19'))['db'];function respondWithStatusCode(_0x5cd509,_0x550b61){_0x550b61=_0x550b61||0xcc;return function(_0xf6a53d){if(_0xf6a53d){return _0x5cd509[_0x0f55('0x1a')](_0x550b61);}return _0x5cd509[_0x0f55('0x1b')](_0x550b61)['end']();};}function respondWithResult(_0xe76548,_0x242b84){_0x242b84=_0x242b84||0xc8;return function(_0x2f2baf){if(_0x2f2baf){return _0xe76548[_0x0f55('0x1b')](_0x242b84)[_0x0f55('0x1c')](_0x2f2baf);}};}function respondWithFilteredResult(_0x1ef849,_0x250666){return function(_0x5bfc08){if(_0x5bfc08){var _0x290bc6=typeof _0x250666[_0x0f55('0x1d')]===_0x0f55('0x1e')&&typeof _0x250666[_0x0f55('0x1f')]===_0x0f55('0x1e');var _0x1cc4b8=_0x5bfc08[_0x0f55('0x20')];var _0x17f984=_0x290bc6?0x0:_0x250666['offset'];var _0x2ab080=_0x290bc6?_0x5bfc08[_0x0f55('0x20')]:_0x250666[_0x0f55('0x1d')]+_0x250666[_0x0f55('0x1f')];var _0x4f49b3;if(_0x2ab080>=_0x1cc4b8){_0x2ab080=_0x1cc4b8;_0x4f49b3=0xc8;}else{_0x4f49b3=0xce;}_0x1ef849['status'](_0x4f49b3);return _0x1ef849[_0x0f55('0x21')](_0x0f55('0x22'),_0x17f984+'-'+_0x2ab080+'/'+_0x1cc4b8)[_0x0f55('0x1c')](_0x5bfc08);}return null;};}function patchUpdates(_0xd64002){return function(_0x27f086){try{jsonpatch[_0x0f55('0x23')](_0x27f086,_0xd64002,!![]);}catch(_0x2742b3){return BPromise[_0x0f55('0x24')](_0x2742b3);}return _0x27f086['save']();};}function saveUpdates(_0x463aff,_0x28b955){return function(_0x10e519){if(_0x10e519){return _0x10e519[_0x0f55('0x25')](_0x463aff)[_0x0f55('0x26')](function(_0x329cef){return _0x329cef;});}return null;};}function removeEntity(_0x3fee1e,_0x5db27a){return function(_0x2c48fa){if(_0x2c48fa){return _0x2c48fa[_0x0f55('0x27')]()['then'](function(){_0x3fee1e[_0x0f55('0x1b')](0xcc)[_0x0f55('0x28')]();});}};}function handleEntityNotFound(_0x361ecf,_0x538346){return function(_0x5528c4){if(!_0x5528c4){_0x361ecf[_0x0f55('0x1a')](0x194);}return _0x5528c4;};}function handleError(_0x365602,_0x4862c1){_0x4862c1=_0x4862c1||0x1f4;return function(_0x2a1c3e){logger[_0x0f55('0x29')](_0x2a1c3e['stack']);if(_0x2a1c3e[_0x0f55('0x2a')]){delete _0x2a1c3e[_0x0f55('0x2a')];}_0x365602[_0x0f55('0x1b')](_0x4862c1)[_0x0f55('0x2b')](_0x2a1c3e);};}exports[_0x0f55('0x2c')]=function(_0x4d96ff,_0x309942){var _0xada4a={},_0xa464cf={},_0x1d9d72={'count':0x0,'rows':[]};var _0x4a8327=_['map'](db[_0x0f55('0x2d')][_0x0f55('0x2e')],function(_0x4a2147){return{'name':_0x4a2147[_0x0f55('0x2f')],'type':_0x4a2147['type'][_0x0f55('0x30')]};});_0xa464cf[_0x0f55('0x31')]=_[_0x0f55('0x32')](_[_0x0f55('0x33')](_0x4a8327,'name'),[_0x0f55('0x34')]);_0xa464cf[_0x0f55('0x35')]=_[_0x0f55('0x36')](_0x4d96ff['query']);_0xa464cf[_0x0f55('0x37')]=_['intersection'](_0xa464cf[_0x0f55('0x31')],_0xa464cf[_0x0f55('0x35')]);_0xada4a[_0x0f55('0x38')]=_[_0x0f55('0x39')](_0xa464cf[_0x0f55('0x31')],qs[_0x0f55('0x3a')](_0x4d96ff[_0x0f55('0x35')]['fields']));_0xada4a[_0x0f55('0x38')]=_0xada4a[_0x0f55('0x38')][_0x0f55('0x3b')]?_0xada4a[_0x0f55('0x38')]:_0xa464cf[_0x0f55('0x31')];if(!_0x4d96ff['query'][_0x0f55('0x3c')](_0x0f55('0x3d'))){_0xada4a[_0x0f55('0x1f')]=qs['limit'](_0x4d96ff['query'][_0x0f55('0x1f')]);_0xada4a['offset']=qs['offset'](_0x4d96ff[_0x0f55('0x35')][_0x0f55('0x1d')]);}_0xada4a[_0x0f55('0x3e')]=qs['sort'](_0x4d96ff['query'][_0x0f55('0x3f')]);_0xada4a[_0x0f55('0x40')]=qs[_0x0f55('0x37')](_[_0x0f55('0x41')](_0x4d96ff[_0x0f55('0x35')],_0xa464cf[_0x0f55('0x37')]),_0x4a8327);if(_0x4d96ff['query']['filter']){_0xada4a[_0x0f55('0x40')]=_[_0x0f55('0x42')](_0xada4a[_0x0f55('0x40')],{'$or':_[_0x0f55('0x33')](_0x4a8327,function(_0x493b97){if(_0x493b97['type']!==_0x0f55('0x43')){var _0x1cc05a={};_0x1cc05a[_0x493b97['name']]={'$like':'%'+_0x4d96ff['query']['filter']+'%'};return _0x1cc05a;}})});}_0xada4a=_['merge']({},_0xada4a,_0x4d96ff['options']);var _0x23a5b2={'where':_0xada4a[_0x0f55('0x40')]};return db[_0x0f55('0x2d')]['count'](_0x23a5b2)[_0x0f55('0x26')](function(_0xba73d){_0x1d9d72[_0x0f55('0x20')]=_0xba73d;if(_0x4d96ff['query'][_0x0f55('0x44')]){_0xada4a[_0x0f55('0x45')]=[{'all':!![]}];}return db[_0x0f55('0x2d')][_0x0f55('0x46')](_0xada4a);})[_0x0f55('0x26')](function(_0x3274d7){_0x1d9d72['rows']=_0x3274d7;return _0x1d9d72;})[_0x0f55('0x26')](respondWithFilteredResult(_0x309942,_0xada4a))[_0x0f55('0x47')](handleError(_0x309942,null));};exports[_0x0f55('0x48')]=function(_0x5e9ea4,_0x149d8b){var _0x227826={'raw':![],'where':{'id':_0x5e9ea4['params']['id']}},_0x388eda={};_0x388eda[_0x0f55('0x31')]=_[_0x0f55('0x36')](db['VoiceRecording'][_0x0f55('0x2e')]);_0x388eda['query']=_['keys'](_0x5e9ea4[_0x0f55('0x35')]);_0x388eda['filters']=_[_0x0f55('0x39')](_0x388eda['model'],_0x388eda[_0x0f55('0x35')]);_0x227826[_0x0f55('0x38')]=_[_0x0f55('0x39')](_0x388eda[_0x0f55('0x31')],qs[_0x0f55('0x3a')](_0x5e9ea4[_0x0f55('0x35')]['fields']));_0x227826['attributes']=_0x227826[_0x0f55('0x38')]['length']?_0x227826[_0x0f55('0x38')]:_0x388eda[_0x0f55('0x31')];if(_0x5e9ea4[_0x0f55('0x35')][_0x0f55('0x44')]){_0x227826[_0x0f55('0x45')]=[{'all':!![]}];}_0x227826=_[_0x0f55('0x42')]({},_0x227826,_0x5e9ea4['options']);return db['VoiceRecording'][_0x0f55('0x49')](_0x227826)[_0x0f55('0x26')](handleEntityNotFound(_0x149d8b,null))[_0x0f55('0x26')](respondWithResult(_0x149d8b,null))[_0x0f55('0x47')](handleError(_0x149d8b,null));};exports[_0x0f55('0x4a')]=function(_0x1c1c38,_0x34a209){return db[_0x0f55('0x2d')][_0x0f55('0x4a')](_0x1c1c38[_0x0f55('0x4b')],{})[_0x0f55('0x26')](respondWithResult(_0x34a209,0xc9))[_0x0f55('0x47')](handleError(_0x34a209,null));};exports[_0x0f55('0x25')]=function(_0x2653fa,_0x2826d1){if(_0x2653fa[_0x0f55('0x4b')]['id']){delete _0x2653fa[_0x0f55('0x4b')]['id'];}return db[_0x0f55('0x2d')][_0x0f55('0x49')]({'where':{'id':_0x2653fa[_0x0f55('0x4c')]['id']}})[_0x0f55('0x26')](handleEntityNotFound(_0x2826d1,null))[_0x0f55('0x26')](saveUpdates(_0x2653fa[_0x0f55('0x4b')],null))[_0x0f55('0x26')](respondWithResult(_0x2826d1,null))['catch'](handleError(_0x2826d1,null));};exports['describe']=function(_0x1f50da,_0x2445ba){return db[_0x0f55('0x2d')][_0x0f55('0x4d')]()[_0x0f55('0x26')](respondWithResult(_0x2445ba,null))[_0x0f55('0x47')](handleError(_0x2445ba,null));};exports[_0x0f55('0x4e')]=function(_0x38f917,_0x399254,_0x29f47b){var _0x390314=require('../../components/encryptor');var _0x42f360=![];var _0xaf7fd7={};if(_0x38f917['query'][_0x0f55('0x4f')]&&_0x38f917[_0x0f55('0x35')][_0x0f55('0x4f')]==='uniqueid'){_0xaf7fd7[_0x0f55('0x50')]=_0x38f917['params']['id'];}else{_0xaf7fd7['id']=_0x38f917[_0x0f55('0x4c')]['id'];}return db[_0x0f55('0x2d')]['find']({'where':_0xaf7fd7,'attributes':['id',_0x0f55('0x51')],'raw':!![]})[_0x0f55('0x26')](handleEntityNotFound(_0x399254,null))[_0x0f55('0x26')](function(_0x241cea){if(_0x241cea){var _0x3c7b96=_0x241cea[_0x0f55('0x51')];var _0x1ec7e8=util[_0x0f55('0x34')]('%s.cypher',_0x3c7b96);if(fs[_0x0f55('0x52')](_0x1ec7e8)){_0x42f360=!![];return _0x390314[_0x0f55('0x53')](_0x1ec7e8,_0x3c7b96,config[_0x0f55('0x54')][_0x0f55('0x55')])[_0x0f55('0x26')](function(){return _0x241cea;});}return _0x241cea;}})[_0x0f55('0x26')](function(_0x21d6f9){if(_0x21d6f9){var _0x5e1d2e=_0x21d6f9['value'];if(!fs[_0x0f55('0x52')](_0x5e1d2e)){throw new db[(_0x0f55('0x56'))][(_0x0f55('0x57'))]('VoiceRecording\x20not\x20found');}if(_0x21d6f9['filename']){return _0x399254[_0x0f55('0x4e')](_0x5e1d2e,_0x21d6f9['filename']+path['extname'](_0x5e1d2e),function(){if(_0x42f360){fs[_0x0f55('0x58')](_0x5e1d2e);}});}else{return _0x399254[_0x0f55('0x4e')](_0x5e1d2e,function(_0x2b8d08){if(_0x42f360){fs['unlink'](_0x5e1d2e);}});}}})['catch'](function(_0xf64b9e){if(_0xf64b9e[_0x0f55('0x59')]===_0x0f55('0x5a')){_0x399254[_0x0f55('0x1b')](0x194)[_0x0f55('0x2b')](_0x0f55('0x5b'));}else{return handleError(_0x399254,null);}});};exports[_0x0f55('0x5c')]=function(_0x354085,_0x2dd355,_0xeacc02){var _0x1bef80=require('../../components/encryptor');var _0x503348=![];var _0x4ba91e={'$and':[db[_0x0f55('0x5d')][_0x0f55('0x40')](db[_0x0f55('0x5d')]['fn'](_0x0f55('0x5e'),db[_0x0f55('0x5d')]['col']('uniqueid')),_0x354085['query'][_0x0f55('0x5f')])]};if(_0x354085[_0x0f55('0x35')][_0x0f55('0x4f')]&&_0x354085[_0x0f55('0x35')][_0x0f55('0x4f')]==='uniqueid'){_0x4ba91e[_0x0f55('0x60')][_0x0f55('0x61')]({'uniqueid':_0x354085[_0x0f55('0x4c')]['id']});}else{_0x4ba91e[_0x0f55('0x60')][_0x0f55('0x61')]({'id':_0x354085[_0x0f55('0x4c')]['id']});}return db[_0x0f55('0x2d')][_0x0f55('0x49')]({'where':_0x4ba91e,'attributes':['id',_0x0f55('0x51')],'raw':!![]})[_0x0f55('0x26')](handleEntityNotFound(_0x2dd355,null))['then'](function(_0x45b01f){if(_0x45b01f){var _0x119ce5=util[_0x0f55('0x34')](_0x0f55('0x62'),_0x45b01f[_0x0f55('0x51')]);if(fs[_0x0f55('0x52')](_0x119ce5)){_0x503348=!![];return _0x1bef80[_0x0f55('0x53')](_0x119ce5,_0x45b01f['value'],config[_0x0f55('0x54')][_0x0f55('0x55')])['then'](function(){return _0x45b01f;});}return _0x45b01f;}})[_0x0f55('0x26')](function(_0x2abcc6){if(_0x2abcc6){if(!fs[_0x0f55('0x52')](_0x2abcc6[_0x0f55('0x51')])){throw new db['Sequelize'][(_0x0f55('0x57'))](_0x0f55('0x5a'));}if(_0x2abcc6['filename']){return _0x2dd355[_0x0f55('0x4e')](_0x2abcc6['value'],_0x2abcc6[_0x0f55('0x63')]+path[_0x0f55('0x64')](_0x2abcc6[_0x0f55('0x51')]),function(){if(_0x503348){fs['unlink'](_0x2abcc6[_0x0f55('0x51')]);}});}else{return _0x2dd355['download'](_0x2abcc6[_0x0f55('0x51')],function(_0x17df95){if(_0x503348){fs['unlink'](_0x2abcc6['value']);}});}}})['catch'](handleError(_0x2dd355,null));};exports[_0x0f55('0x27')]=function(_0x225610,_0x1a61bb){return db['VoiceRecording'][_0x0f55('0x49')]({'where':{'id':_0x225610[_0x0f55('0x4c')]['id']}})[_0x0f55('0x26')](function(_0x51db19){if(_[_0x0f55('0x65')](_0x51db19)){throw new ReferenceError(_0x0f55('0x66'));}return _0x51db19;})[_0x0f55('0x26')](function(_0x240571){var _0x23328b=_0x240571[_0x0f55('0x51')];logger[_0x0f55('0x67')](_0x0f55('0x68'),_0x23328b);if(!_[_0x0f55('0x65')](_0x240571['value'])&&fs[_0x0f55('0x52')](_0x23328b)){logger[_0x0f55('0x67')](_0x0f55('0x69')+_0x23328b+_0x0f55('0x6a'));fs[_0x0f55('0x6b')](_0x23328b);}_0x23328b=_0x23328b+_0x0f55('0x6c');if(!_[_0x0f55('0x65')](_0x240571[_0x0f55('0x51')])&&fs['existsSync'](_0x23328b)){logger[_0x0f55('0x67')]('File:\x20\x22'+_0x23328b+_0x0f55('0x6a'));fs[_0x0f55('0x6b')](_0x23328b);}return _0x240571;})[_0x0f55('0x26')](function(_0x316385){if(!_0x316385)throw new InternalError();return _0x316385['destroy']();})[_0x0f55('0x26')](function(){_0x1a61bb['status'](0xcc)[_0x0f55('0x28')]();})[_0x0f55('0x47')](handleError(_0x1a61bb,null));};function getBucketslist(_0x45ac67,_0x5d142d,_0x31b32d){return new Promise(function(_0x5be141,_0x3eb700){var _0x1a36ef=new AWS['S3']({'accessKeyId':_0x5d142d,'secretAccessKey':_0x45ac67,'region':_0x31b32d});_0x1a36ef[_0x0f55('0x6d')]({},function(_0x12f6b1,_0x5c9daa){if(_0x12f6b1){return _0x3eb700(_0x12f6b1);}else{return _0x5be141(_0x5c9daa);}});});}function createBucket(_0x5c715b,_0x1638fd,_0x46a230,_0x47ad91){return new Promise(function(_0xf3cf59,_0x1fd232){var _0x51f281=new AWS['S3']({'accessKeyId':_0x1638fd,'secretAccessKey':_0x5c715b,'region':_0x46a230});_0x51f281[_0x0f55('0x6e')]({'Bucket':_0x47ad91},function(_0x453664,_0x2add05){if(_0x453664){return _0x1fd232(_0x453664);}else{return _0xf3cf59(_0x2add05);}});});}function uploadFile(_0xc3b05,_0x541cb9,_0x40503b,_0x44402d,_0x16b8ce,_0x3667c6){return new Promise(function(_0x14f07e,_0x3883de){var _0x51e10d=new AWS['S3']({'accessKeyId':_0x541cb9,'secretAccessKey':_0xc3b05,'region':_0x40503b});_0x51e10d[_0x0f55('0x6f')]({'Bucket':_0x44402d,'Key':_0x16b8ce,'Body':_0x3667c6},function(_0xd32a9c,_0x3f8914){if(_0xd32a9c){return _0x3883de(_0xd32a9c);}else{return _0x14f07e(_0x3f8914);}});});}function startTranscribe(_0xc3c9b4,_0x398958,_0x261745,_0x1082e5,_0x19529b,_0x1092a4){return new Promise(function(_0x570a60,_0x4bc7b1){var _0xba4f47=new AWS[(_0x0f55('0x70'))]({'accessKeyId':_0x398958,'secretAccessKey':_0xc3c9b4,'region':_0x261745});_0xba4f47[_0x0f55('0x71')]({'TranscriptionJobName':_0x1082e5,'LanguageCode':_0x19529b,'Media':{'MediaFileUri':_0x1092a4}},function(_0x4d34f9,_0xb1366f){if(_0x4d34f9){return _0x4bc7b1(_0x4d34f9);}else{return _0x570a60(_0xb1366f);}});});}function transcribe(_0xc60b,_0xc81303,_0x16083d,_0x236293,_0x36cade,_0x5d664d,_0x3fc03b){return new Promise(function(_0xb40e3a,_0x111a87){var _0x4f3321={};logger[_0x0f55('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0xc60b,_0x36cade));return uploadFile(_0xc81303,_0x16083d,_0x236293,_0x36cade,path[_0x0f55('0x72')](_0x5d664d),fs[_0x0f55('0x73')](_0x5d664d))[_0x0f55('0x26')](function(_0x19dec7){logger[_0x0f55('0x67')](util[_0x0f55('0x34')](_0x0f55('0x74'),_0xc60b,_0x36cade,_0x19dec7['Location']));_0x4f3321[_0x0f55('0x75')]=_0x19dec7['Bucket'];_0x4f3321[_0x0f55('0x76')]=_0x19dec7[_0x0f55('0x77')];logger[_0x0f55('0x67')](util[_0x0f55('0x34')](_0x0f55('0x78'),_0xc60b));return startTranscribe(_0xc81303,_0x16083d,_0x236293,uuidv4(),_0x3fc03b,_0x19dec7['Location']);})[_0x0f55('0x26')](function(_0x172b81){logger[_0x0f55('0x67')](util[_0x0f55('0x34')](_0x0f55('0x79'),_0xc60b,_0x172b81['TranscriptionJob']['TranscriptionJobName']));_0x4f3321[_0x0f55('0x7a')]=_0x172b81[_0x0f55('0x7b')][_0x0f55('0x7c')];_0x4f3321['transcribeStatus']=_0x172b81[_0x0f55('0x7b')]['TranscriptionJobStatus'];return _0xb40e3a(_0x4f3321);})[_0x0f55('0x47')](function(_0xe8a439){return _0x111a87(_0xe8a439);});});}exports['runTranscribe']=function(_0x5b5f8b,_0x32b1a9,_0x1104fd){var _0xa6da31;var _0xa08c6a;var _0x2a2488;var _0x4695f2=require(_0x0f55('0x7d'));return db[_0x0f55('0x2d')][_0x0f55('0x7e')]({'where':{'id':_0x5b5f8b[_0x0f55('0x4c')]['id']}})[_0x0f55('0x26')](function(_0x3af3fe){if(_0x3af3fe){var _0x207af4=util['format'](_0x0f55('0x62'),_0x3af3fe[_0x0f55('0x51')]);if(fs[_0x0f55('0x52')](_0x207af4)){cypher=!![];return _0x4695f2[_0x0f55('0x53')](_0x207af4,_0x3af3fe[_0x0f55('0x51')],config[_0x0f55('0x54')]['recording'])[_0x0f55('0x26')](function(){return _0x3af3fe;});}return _0x3af3fe;}})[_0x0f55('0x26')](function(_0x47a266){if(!_0x47a266){throw new db[(_0x0f55('0x56'))][(_0x0f55('0x57'))](_0x0f55('0x7f'));}_0xa08c6a=_0x47a266;return db[_0x0f55('0x80')][_0x0f55('0x7e')]({'where':{'id':0x1}});})[_0x0f55('0x26')](handleEntityNotFound(_0x32b1a9,null))[_0x0f55('0x26')](function(_0x56ce0c){if(_0x56ce0c){_0xa6da31=_0x56ce0c;if(!_0xa6da31[_0x0f55('0x81')]||!_0xa6da31[_0x0f55('0x82')]||!_0xa6da31[_0x0f55('0x83')]||!_0xa6da31[_0x0f55('0x84')]||!_0xa6da31[_0x0f55('0x75')]){throw new db[(_0x0f55('0x56'))][(_0x0f55('0x57'))](_0x0f55('0x85'));}if(_0x5b5f8b[_0x0f55('0x4b')]['runSentiment']&&(!_0xa6da31[_0x0f55('0x86')]||!_0xa6da31[_0x0f55('0x87')]||!_0xa6da31['sentimentRegion']||!_0xa6da31[_0x0f55('0x84')]||!_0xa6da31[_0x0f55('0x75')])){throw new db[(_0x0f55('0x56'))][(_0x0f55('0x57'))](_0x0f55('0x88'));}return db[_0x0f55('0x89')]['findOne']({'where':{'id':_0xa6da31['transcribeAccountId']}});}})[_0x0f55('0x26')](function(_0x3fcc07){if(!_0x3fcc07){throw new db['Sequelize'][(_0x0f55('0x57'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x3fcc07[_0x0f55('0x8a')]||!_0x3fcc07[_0x0f55('0x8b')]){throw new db[(_0x0f55('0x56'))][(_0x0f55('0x57'))]('Cloud\x20Provider\x20not\x20configured');}_0x2a2488=_0x3fcc07;return getBucketslist(_0x2a2488[_0x0f55('0x8a')],_0x2a2488[_0x0f55('0x8b')],_0xa6da31['transcribeRegion']);})[_0x0f55('0x26')](function(_0x2159a5){if(_0x2159a5&&_0x2159a5[_0x0f55('0x8c')]){var _0x354229=_['find'](_0x2159a5[_0x0f55('0x8c')],function(_0x25e5df){return _0x25e5df[_0x0f55('0x8d')]===_0xa6da31['bucket'];});if(!_0x354229){logger[_0x0f55('0x67')](util[_0x0f55('0x34')](_0x0f55('0x8e'),_0x5b5f8b[_0x0f55('0x4c')]['id'],_0xa6da31[_0x0f55('0x75')]));return createBucket(_0x2a2488[_0x0f55('0x8a')],_0x2a2488[_0x0f55('0x8b')],_0xa6da31[_0x0f55('0x83')],_0xa6da31[_0x0f55('0x75')]);}logger['info'](util[_0x0f55('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x5b5f8b['params']['id'],_0xa6da31[_0x0f55('0x75')]));return;}})['then'](function(_0x29f8cb){if(_0xa08c6a[_0x0f55('0x8f')]===_0x0f55('0x90')){return transcribe(_0x5b5f8b[_0x0f55('0x4c')]['id'],_0x2a2488[_0x0f55('0x8a')],_0x2a2488[_0x0f55('0x8b')],_0xa6da31['transcribeRegion'],_0xa6da31[_0x0f55('0x75')],_0xa08c6a[_0x0f55('0x51')],_0xa6da31[_0x0f55('0x84')]);}else{logger[_0x0f55('0x67')](util[_0x0f55('0x34')](_0x0f55('0x91'),_0x5b5f8b[_0x0f55('0x4c')]['id']));return{'transcribeStatus':_0x0f55('0x92')};}})[_0x0f55('0x26')](function(_0x1cb008){if(_0x1cb008){_0x1cb008['tempSentiment']=_0x5b5f8b[_0x0f55('0x4b')][_0x0f55('0x93')];return _0xa08c6a[_0x0f55('0x94')](_0x1cb008);}})[_0x0f55('0x26')](respondWithResult(_0x32b1a9,null))[_0x0f55('0x47')](handleError(_0x32b1a9,null));};function writeFile(_0x4ca027,_0x44a6ac){return new Promise(function(_0x116244,_0x39a4fc){fs[_0x0f55('0x95')](_0x44a6ac,_0x4ca027,function(_0x4bc467,_0x1cffce){if(_0x4bc467){return _0x39a4fc(_0x4bc467);}else{return _0x116244(_0x1cffce);}});});}exports[_0x0f55('0x96')]=function(_0x4c5a76,_0x3ac548,_0x559af4){return db['VoiceRecording'][_0x0f55('0x7e')]({'where':{'id':_0x4c5a76[_0x0f55('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ac548))[_0x0f55('0x26')](function(_0x3dc3ca){if(_0x3dc3ca&&_0x3dc3ca[_0x0f55('0x97')]){var _0x1d115a=_0x3dc3ca['fileText'];var _0x47a17f=config['root']+'/server/files/transcribes/transcribe_'+_0x3dc3ca['id']+'.txt';if(fs[_0x0f55('0x52')](_0x47a17f)){return _0x47a17f;}return writeFile(_0x1d115a,_0x47a17f)['then'](function(){return _0x47a17f;});}else{throw new db['Sequelize']['ValidationError']('Transcript\x20not\x20available');}})['then'](function(_0x1fb276){return _0x3ac548[_0x0f55('0x4e')](_0x1fb276);})[_0x0f55('0x47')](handleError(_0x3ac548));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 99fdbcf..8a63bc7 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 _0xe799=['VoiceRecording','uniqueid','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x1ac8e1,_0x395baa){var _0x287e25=function(_0xf633ab){while(--_0xf633ab){_0x1ac8e1['push'](_0x1ac8e1['shift']());}};_0x287e25(++_0x395baa);}(_0xe799,0x170));var _0x9e79=function(_0x5ca6dd,_0xcfc331){_0x5ca6dd=_0x5ca6dd-0x0;var _0xd30189=_0xe799[_0x5ca6dd];return _0xd30189;};'use strict';var attributes=require(_0x9e79('0x0'));module['exports']=function(_0x3308ba,_0x59bc90){return _0x3308ba[_0x9e79('0x1')](_0x9e79('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9e79('0x3'),'fields':[_0x9e79('0x3')]},{'name':_0x9e79('0x4'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x851c=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x2a8311,_0x3d72c2){var _0x13da15=function(_0x3bdb2b){while(--_0x3bdb2b){_0x2a8311['push'](_0x2a8311['shift']());}};_0x13da15(++_0x3d72c2);}(_0x851c,0x19d));var _0xc851=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x851c[_0x3b380d];return _0x54502b;};'use strict';var attributes=require(_0xc851('0x0'));module[_0xc851('0x1')]=function(_0x40d1a7,_0x3f998c){return _0x40d1a7[_0xc851('0x2')](_0xc851('0x3'),attributes,{'tableName':_0xc851('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc851('0x5')]},{'name':_0xc851('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 0116034..95a5a0f 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 _0x4975=['catch','VoiceRecording','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0x4975,0x86));var _0x5497=function(_0x5b68b3,_0x468acb){_0x5b68b3=_0x5b68b3-0x0;var _0xf0853c=_0x4975[_0x5b68b3];return _0xf0853c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['UpdateVoiceRecording']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1c')]||null:null,'attributes':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')]['attributes']||null:null,'limit':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20['options'][_0x5497('0x1d')]||null:null})[_0x5497('0x1e')](function(_0x44265c){logger[_0x5497('0xd')](_0x5497('0x1f'),_0x3f4d20);logger[_0x5497('0x10')]('UpdateVoiceRecording',_0x3f4d20,JSON['stringify'](_0x44265c));_0x3a47fd(_0x44265c);})[_0x5497('0x16')](function(_0x34b97f){logger[_0x5497('0x13')](_0x5497('0x1f'),_0x34b97f['message'],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x34b97f['message']));});});};exports[_0x5497('0x20')]=function(_0x16a2b4){var _0x429d36=this;return new Promise(function(_0x34a1a5,_0x163a30){var _0x31cd01=require('../../components/encryptor');var _0x4af5f4;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5497('0x1e')](function(_0x48d146){_0x4af5f4=_0x48d146;return db['VoiceRecording'][_0x5497('0x21')](_0x16a2b4[_0x5497('0x19')]);})[_0x5497('0x1e')](function(_0x4c442a){if(_0x4af5f4['callRecordingEncryption']&&fs['existsSync'](_0x4c442a[_0x5497('0x22')])){var _0x471e0b=util[_0x5497('0x23')]('%s.cypher',_0x4c442a['value']);return _0x31cd01['encryptFile'](_0x4c442a[_0x5497('0x22')],_0x471e0b,config['secrets'][_0x5497('0x24')])[_0x5497('0x1e')](function(){fs[_0x5497('0x25')](_0x4c442a['value']);logger[_0x5497('0xd')](_0x5497('0x26'));return _0x4c442a;});}return _0x4c442a;})['then'](function(_0xce7cb2){logger[_0x5497('0xd')](_0x5497('0x20'),_0x16a2b4);logger['debug'](_0x5497('0x20'),_0x16a2b4,JSON[_0x5497('0x12')](_0xce7cb2));_0x34a1a5(_0xce7cb2);})[_0x5497('0x16')](function(_0x362b96){logger[_0x5497('0x13')]('CreateVoiceRecording',_0x362b96[_0x5497('0x14')],_0x16a2b4);_0x163a30(_0x429d36[_0x5497('0x13')](0x1f4,_0x362b96['message']));});});}; \ No newline at end of file +var _0x6d11=['message','catch','VoiceRecording','update','options','where','attributes','limit','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','findOne','callRecordingEncryption','create','body','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5b2a4f,_0xc77712){var _0x37908e=function(_0x5d524f){while(--_0x5d524f){_0x5b2a4f['push'](_0x5b2a4f['shift']());}};_0x37908e(++_0xc77712);}(_0x6d11,0xbf));var _0x16d1=function(_0x47cd46,_0x39d73a){_0x47cd46=_0x47cd46-0x0;var _0x558179=_0x6d11[_0x47cd46];return _0x558179;};'use strict';var _=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x16d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16d1('0x4'))['db'];var utils=require(_0x16d1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x16d1('0x6'));var jayson=require(_0x16d1('0x7'));var client=jayson[_0x16d1('0x8')][_0x16d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1009dc,_0x150217,_0x19390d){return new BPromise(function(_0x5d0e3f,_0x58a7a2){return client['request'](_0x1009dc,_0x19390d)[_0x16d1('0xa')](function(_0xcfbb15){logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,'request\x20sent');logger[_0x16d1('0xd')](_0x16d1('0xe'),_0x150217,_0x16d1('0xf'),JSON[_0x16d1('0x10')](_0xcfbb15));if(_0xcfbb15[_0x16d1('0x11')]){if(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x12')]===0x1f4){logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x58a7a2(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}logger[_0x16d1('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x150217,_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);return _0x5d0e3f(_0xcfbb15[_0x16d1('0x11')][_0x16d1('0x13')]);}else{logger[_0x16d1('0xb')](_0x16d1('0xc'),_0x150217,_0x16d1('0xf'));_0x5d0e3f(_0xcfbb15['result'][_0x16d1('0x13')]);}})[_0x16d1('0x14')](function(_0x555b2d){logger['error'](_0x16d1('0xc'),_0x150217,_0x555b2d);_0x58a7a2(_0x555b2d);});});}exports['UpdateVoiceRecording']=function(_0x46a25e){var _0x4aeff0=this;return new Promise(function(_0x1da1b8,_0x4fe22d){return db[_0x16d1('0x15')][_0x16d1('0x16')](_0x46a25e['body'],{'raw':_0x46a25e['options']?_0x46a25e['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a25e[_0x16d1('0x17')]?_0x46a25e['options'][_0x16d1('0x18')]||null:null,'attributes':_0x46a25e[_0x16d1('0x17')]?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x19')]||null:null,'limit':_0x46a25e['options']?_0x46a25e[_0x16d1('0x17')][_0x16d1('0x1a')]||null:null})[_0x16d1('0xa')](function(_0x585ce5){logger[_0x16d1('0xb')](_0x16d1('0x1b'),_0x46a25e);logger[_0x16d1('0xd')](_0x16d1('0x1b'),_0x46a25e,JSON[_0x16d1('0x10')](_0x585ce5));_0x1da1b8(_0x585ce5);})[_0x16d1('0x14')](function(_0x32f362){logger[_0x16d1('0x11')](_0x16d1('0x1b'),_0x32f362[_0x16d1('0x13')],_0x46a25e);_0x4fe22d(_0x4aeff0[_0x16d1('0x11')](0x1f4,_0x32f362[_0x16d1('0x13')]));});});};exports[_0x16d1('0x1c')]=function(_0x262f89){var _0x346b69=this;return new Promise(function(_0x2b8403,_0x491f65){var _0x25ae4e=require(_0x16d1('0x1d'));var _0x4257f1;return db['Setting'][_0x16d1('0x1e')]({'attributes':['id',_0x16d1('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x16d1('0xa')](function(_0x22e5b3){_0x4257f1=_0x22e5b3;return db[_0x16d1('0x15')][_0x16d1('0x20')](_0x262f89[_0x16d1('0x21')]);})['then'](function(_0x3dd104){if(_0x4257f1[_0x16d1('0x1f')]&&fs[_0x16d1('0x22')](_0x3dd104[_0x16d1('0x23')])){var _0x55c021=util['format'](_0x16d1('0x24'),_0x3dd104[_0x16d1('0x23')]);return _0x25ae4e[_0x16d1('0x25')](_0x3dd104[_0x16d1('0x23')],_0x55c021,config[_0x16d1('0x26')][_0x16d1('0x27')])[_0x16d1('0xa')](function(){fs[_0x16d1('0x28')](_0x3dd104[_0x16d1('0x23')]);logger[_0x16d1('0xb')](_0x16d1('0x29'));return _0x3dd104;});}return _0x3dd104;})[_0x16d1('0xa')](function(_0x188cf4){logger[_0x16d1('0xb')]('CreateVoiceRecording',_0x262f89);logger[_0x16d1('0xd')]('CreateVoiceRecording',_0x262f89,JSON[_0x16d1('0x10')](_0x188cf4));_0x2b8403(_0x188cf4);})[_0x16d1('0x14')](function(_0x2b9126){logger[_0x16d1('0x11')](_0x16d1('0x1c'),_0x2b9126[_0x16d1('0x13')],_0x262f89);_0x491f65(_0x346b69['error'](0x1f4,_0x2b9126['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 9e3d787..e3662cc 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 _0x08e2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','express'];(function(_0x155fe6,_0x129957){var _0x516bd3=function(_0x8e02e9){while(--_0x8e02e9){_0x155fe6['push'](_0x155fe6['shift']());}};_0x516bd3(++_0x129957);}(_0x08e2,0xbb));var _0x208e=function(_0x370a1f,_0x49e83b){_0x370a1f=_0x370a1f-0x0;var _0x2342ed=_0x08e2[_0x370a1f];return _0x2342ed;};'use strict';var multer=require(_0x208e('0x0'));var util=require(_0x208e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x208e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x208e('0x3'));var interaction=require(_0x208e('0x4'));var config=require(_0x208e('0x5'));var controller=require(_0x208e('0x6'));router['get']('/',auth[_0x208e('0x7')](),controller[_0x208e('0x8')]);router[_0x208e('0x9')]('/describe',auth[_0x208e('0x7')](),controller[_0x208e('0xa')]);router['get'](_0x208e('0xb'),auth[_0x208e('0x7')](),controller[_0x208e('0xc')]);router[_0x208e('0xd')]('/',auth[_0x208e('0x7')](),controller[_0x208e('0xe')]);router[_0x208e('0xf')](_0x208e('0xb'),auth[_0x208e('0x7')](),controller[_0x208e('0x10')]);router[_0x208e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x208e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0845=['create','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','post'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x0845,0xde));var _0x5084=function(_0x4c85bb,_0x1936fb){_0x4c85bb=_0x4c85bb-0x0;var _0x123ccb=_0x0845[_0x4c85bb];return _0x123ccb;};'use strict';var multer=require(_0x5084('0x0'));var util=require('util');var path=require(_0x5084('0x1'));var timeout=require(_0x5084('0x2'));var express=require(_0x5084('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5084('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5084('0x5'));var controller=require('./voiceTransferReport.controller');router[_0x5084('0x6')]('/',auth[_0x5084('0x7')](),controller[_0x5084('0x8')]);router[_0x5084('0x6')]('/describe',auth[_0x5084('0x7')](),controller[_0x5084('0x9')]);router[_0x5084('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x5084('0xa')]);router[_0x5084('0xb')]('/',auth['isAuthenticated'](),controller[_0x5084('0xc')]);router['put'](_0x5084('0xd'),auth[_0x5084('0x7')](),controller[_0x5084('0xe')]);router[_0x5084('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5084('0x10')]);module[_0x5084('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index e42e06e..78a2e2d 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 _0x78c0=['exports','ENUM','blind','STRING','sequelize','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x78c0,0x70));var _0x078c=function(_0x18f603,_0x552467){_0x18f603=_0x18f603-0x0;var _0x563027=_0x78c0[_0x18f603];return _0x563027;};'use strict';var Sequelize=require(_0x078c('0x0'));var moment=require(_0x078c('0x1'));module[_0x078c('0x2')]={'type':{'type':Sequelize[_0x078c('0x3')](_0x078c('0x4'),'attended')},'result':{'type':Sequelize[_0x078c('0x5')]},'transfererchannel':{'type':Sequelize[_0x078c('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x078c('0x5')]},'transferercalleridname':{'type':Sequelize[_0x078c('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x078c('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x078c('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x078c('0x5')]},'transferercontext':{'type':Sequelize[_0x078c('0x5')]},'transfererexten':{'type':Sequelize[_0x078c('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x078c('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x078c('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x078c('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x078c('0x5')]},'transfereeexten':{'type':Sequelize[_0x078c('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x078c('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x078c('0x5')]},'extension':{'type':Sequelize[_0x078c('0x5')]}}; \ No newline at end of file +var _0x80af=['moment','exports','STRING','sequelize'];(function(_0x35b97b,_0x48f075){var _0x22b813=function(_0x211e97){while(--_0x211e97){_0x35b97b['push'](_0x35b97b['shift']());}};_0x22b813(++_0x48f075);}(_0x80af,0xf7));var _0xf80a=function(_0x43b16d,_0x34e7a1){_0x43b16d=_0x43b16d-0x0;var _0x20c76b=_0x80af[_0x43b16d];return _0x20c76b;};'use strict';var Sequelize=require(_0xf80a('0x0'));var moment=require(_0xf80a('0x1'));module[_0xf80a('0x2')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xf80a('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xf80a('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf80a('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xf80a('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xf80a('0x3')]},'transfererexten':{'type':Sequelize[_0xf80a('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xf80a('0x3')]},'transfereechannel':{'type':Sequelize[_0xf80a('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xf80a('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf80a('0x3')]},'transfereecontext':{'type':Sequelize[_0xf80a('0x3')]},'transfereeexten':{'type':Sequelize[_0xf80a('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0xf80a('0x3')]},'extension':{'type':Sequelize[_0xf80a('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 53f746c..50b2829 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 _0x2c05=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','VoiceTransferReport','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash'];(function(_0x114937,_0x45956b){var _0x5350af=function(_0x1cc369){while(--_0x1cc369){_0x114937['push'](_0x114937['shift']());}};_0x5350af(++_0x45956b);}(_0x2c05,0x1bc));var _0x52c0=function(_0x573bef,_0x182914){_0x573bef=_0x573bef-0x0;var _0x2ef4f4=_0x2c05[_0x573bef];return _0x2ef4f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52c0('0x0'));var zipdir=require(_0x52c0('0x1'));var jsonpatch=require(_0x52c0('0x2'));var rp=require(_0x52c0('0x3'));var moment=require(_0x52c0('0x4'));var BPromise=require(_0x52c0('0x5'));var Mustache=require(_0x52c0('0x6'));var util=require(_0x52c0('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x52c0('0x8'));var ejs=require(_0x52c0('0x9'));var fs=require('fs');var fs_extra=require(_0x52c0('0xa'));var _=require(_0x52c0('0xb'));var squel=require(_0x52c0('0xc'));var crypto=require(_0x52c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x52c0('0xe'));var toCsv=require(_0x52c0('0x8'));var querystring=require(_0x52c0('0xf'));var Papa=require(_0x52c0('0x10'));var Redis=require('ioredis');var authService=require(_0x52c0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x52c0('0x12'));var hardwareService=require(_0x52c0('0x13'));var logger=require(_0x52c0('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x52c0('0x15'));var licenseUtil=require(_0x52c0('0x16'));var db=require(_0x52c0('0x17'))['db'];function respondWithStatusCode(_0x40b56f,_0x486d1c){_0x486d1c=_0x486d1c||0xcc;return function(_0x379d9b){if(_0x379d9b){return _0x40b56f['sendStatus'](_0x486d1c);}return _0x40b56f[_0x52c0('0x18')](_0x486d1c)[_0x52c0('0x19')]();};}function respondWithResult(_0x312b75,_0x4937e2){_0x4937e2=_0x4937e2||0xc8;return function(_0xd5c425){if(_0xd5c425){return _0x312b75['status'](_0x4937e2)['json'](_0xd5c425);}};}function respondWithFilteredResult(_0x49339f,_0x14c343){return function(_0x155579){if(_0x155579){var _0x2d0ea5=typeof _0x14c343[_0x52c0('0x1a')]==='undefined'&&typeof _0x14c343[_0x52c0('0x1b')]===_0x52c0('0x1c');var _0x457161=_0x155579['count'];var _0x358c00=_0x2d0ea5?0x0:_0x14c343[_0x52c0('0x1a')];var _0x53adc4=_0x2d0ea5?_0x155579[_0x52c0('0x1d')]:_0x14c343['offset']+_0x14c343['limit'];var _0x19958a;if(_0x53adc4>=_0x457161){_0x53adc4=_0x457161;_0x19958a=0xc8;}else{_0x19958a=0xce;}_0x49339f[_0x52c0('0x18')](_0x19958a);return _0x49339f[_0x52c0('0x1e')]('Content-Range',_0x358c00+'-'+_0x53adc4+'/'+_0x457161)[_0x52c0('0x1f')](_0x155579);}return null;};}function patchUpdates(_0x2a0146){return function(_0x4b199f){try{jsonpatch[_0x52c0('0x20')](_0x4b199f,_0x2a0146,!![]);}catch(_0x9080d9){return BPromise[_0x52c0('0x21')](_0x9080d9);}return _0x4b199f[_0x52c0('0x22')]();};}function saveUpdates(_0x3d320a,_0x4b9ef7){return function(_0x54f3a9){if(_0x54f3a9){return _0x54f3a9[_0x52c0('0x23')](_0x3d320a)[_0x52c0('0x24')](function(_0x3ab9d6){return _0x3ab9d6;});}return null;};}function removeEntity(_0x290039,_0x48b949){return function(_0x38e8f4){if(_0x38e8f4){return _0x38e8f4[_0x52c0('0x25')]()[_0x52c0('0x24')](function(){_0x290039[_0x52c0('0x18')](0xcc)[_0x52c0('0x19')]();});}};}function handleEntityNotFound(_0x499d9f,_0x54153e){return function(_0x308b33){if(!_0x308b33){_0x499d9f[_0x52c0('0x26')](0x194);}return _0x308b33;};}function handleError(_0x3b0994,_0x1b1a64){_0x1b1a64=_0x1b1a64||0x1f4;return function(_0x5f5733){logger[_0x52c0('0x27')](_0x5f5733[_0x52c0('0x28')]);if(_0x5f5733[_0x52c0('0x29')]){delete _0x5f5733[_0x52c0('0x29')];}_0x3b0994[_0x52c0('0x18')](_0x1b1a64)['send'](_0x5f5733);};}exports[_0x52c0('0x2a')]=function(_0x486fbf,_0x39e21c){var _0x1990ea={},_0x192685={},_0x486282={'count':0x0,'rows':[]};var _0x3a2607=_['map'](db[_0x52c0('0x2b')]['rawAttributes'],function(_0x39b815){return{'name':_0x39b815[_0x52c0('0x2c')],'type':_0x39b815[_0x52c0('0x2d')][_0x52c0('0x2e')]};});_0x192685['model']=_[_0x52c0('0x2f')](_0x3a2607,_0x52c0('0x29'));_0x192685[_0x52c0('0x30')]=_[_0x52c0('0x31')](_0x486fbf[_0x52c0('0x30')]);_0x192685['filters']=_['intersection'](_0x192685[_0x52c0('0x32')],_0x192685[_0x52c0('0x30')]);_0x1990ea[_0x52c0('0x33')]=_[_0x52c0('0x34')](_0x192685[_0x52c0('0x32')],qs[_0x52c0('0x35')](_0x486fbf[_0x52c0('0x30')][_0x52c0('0x35')]));_0x1990ea[_0x52c0('0x33')]=_0x1990ea[_0x52c0('0x33')][_0x52c0('0x36')]?_0x1990ea[_0x52c0('0x33')]:_0x192685[_0x52c0('0x32')];if(!_0x486fbf[_0x52c0('0x30')][_0x52c0('0x37')]('nolimit')){_0x1990ea['limit']=qs[_0x52c0('0x1b')](_0x486fbf['query'][_0x52c0('0x1b')]);_0x1990ea[_0x52c0('0x1a')]=qs[_0x52c0('0x1a')](_0x486fbf['query'][_0x52c0('0x1a')]);}_0x1990ea['order']=qs[_0x52c0('0x38')](_0x486fbf[_0x52c0('0x30')][_0x52c0('0x38')]);_0x1990ea['where']=qs[_0x52c0('0x39')](_[_0x52c0('0x3a')](_0x486fbf[_0x52c0('0x30')],_0x192685['filters']),_0x3a2607);if(_0x486fbf[_0x52c0('0x30')][_0x52c0('0x3b')]){_0x1990ea['where']=_[_0x52c0('0x3c')](_0x1990ea[_0x52c0('0x3d')],{'$or':_[_0x52c0('0x2f')](_0x3a2607,function(_0x532c7f){if(_0x532c7f[_0x52c0('0x2d')]!==_0x52c0('0x3e')){var _0x352f14={};_0x352f14[_0x532c7f[_0x52c0('0x29')]]={'$like':'%'+_0x486fbf['query'][_0x52c0('0x3b')]+'%'};return _0x352f14;}})});}_0x1990ea=_['merge']({},_0x1990ea,_0x486fbf[_0x52c0('0x3f')]);var _0x3ceeed={'where':_0x1990ea['where']};return db['VoiceTransferReport'][_0x52c0('0x1d')](_0x3ceeed)[_0x52c0('0x24')](function(_0x2ce100){_0x486282[_0x52c0('0x1d')]=_0x2ce100;if(_0x486fbf[_0x52c0('0x30')][_0x52c0('0x40')]){_0x1990ea[_0x52c0('0x41')]=[{'all':!![]}];}return db[_0x52c0('0x2b')][_0x52c0('0x42')](_0x1990ea);})[_0x52c0('0x24')](function(_0x1eb4db){_0x486282[_0x52c0('0x43')]=_0x1eb4db;return _0x486282;})[_0x52c0('0x24')](respondWithFilteredResult(_0x39e21c,_0x1990ea))[_0x52c0('0x44')](handleError(_0x39e21c,null));};exports[_0x52c0('0x45')]=function(_0x5a80c8,_0x3c70c0){var _0x443fea={'raw':!![],'where':{'id':_0x5a80c8[_0x52c0('0x46')]['id']}},_0x415336={};_0x415336['model']=_['keys'](db[_0x52c0('0x2b')][_0x52c0('0x47')]);_0x415336[_0x52c0('0x30')]=_[_0x52c0('0x31')](_0x5a80c8[_0x52c0('0x30')]);_0x415336[_0x52c0('0x39')]=_[_0x52c0('0x34')](_0x415336[_0x52c0('0x32')],_0x415336[_0x52c0('0x30')]);_0x443fea['attributes']=_[_0x52c0('0x34')](_0x415336[_0x52c0('0x32')],qs[_0x52c0('0x35')](_0x5a80c8['query'][_0x52c0('0x35')]));_0x443fea[_0x52c0('0x33')]=_0x443fea[_0x52c0('0x33')][_0x52c0('0x36')]?_0x443fea[_0x52c0('0x33')]:_0x415336[_0x52c0('0x32')];if(_0x5a80c8[_0x52c0('0x30')][_0x52c0('0x40')]){_0x443fea['include']=[{'all':!![]}];}_0x443fea=_['merge']({},_0x443fea,_0x5a80c8['options']);return db[_0x52c0('0x2b')]['find'](_0x443fea)[_0x52c0('0x24')](handleEntityNotFound(_0x3c70c0,null))[_0x52c0('0x24')](respondWithResult(_0x3c70c0,null))['catch'](handleError(_0x3c70c0,null));};exports[_0x52c0('0x48')]=function(_0x220009,_0x303777){return db[_0x52c0('0x2b')][_0x52c0('0x48')](_0x220009[_0x52c0('0x49')],{})[_0x52c0('0x24')](respondWithResult(_0x303777,0xc9))[_0x52c0('0x44')](handleError(_0x303777,null));};exports[_0x52c0('0x23')]=function(_0x383362,_0x24f599){if(_0x383362[_0x52c0('0x49')]['id']){delete _0x383362[_0x52c0('0x49')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x383362[_0x52c0('0x46')]['id']}})[_0x52c0('0x24')](handleEntityNotFound(_0x24f599,null))[_0x52c0('0x24')](saveUpdates(_0x383362['body'],null))[_0x52c0('0x24')](respondWithResult(_0x24f599,null))[_0x52c0('0x44')](handleError(_0x24f599,null));};exports[_0x52c0('0x25')]=function(_0x3a4f8d,_0x56015f){return db[_0x52c0('0x2b')][_0x52c0('0x4a')]({'where':{'id':_0x3a4f8d[_0x52c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x56015f,null))[_0x52c0('0x24')](removeEntity(_0x56015f,null))[_0x52c0('0x44')](handleError(_0x56015f,null));};exports[_0x52c0('0x4b')]=function(_0x103a99,_0x447147){return db[_0x52c0('0x2b')][_0x52c0('0x4b')]()['then'](respondWithResult(_0x447147,null))[_0x52c0('0x44')](handleError(_0x447147,null));}; \ No newline at end of file +var _0x7624=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceTransferReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','include','find','create','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','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x51f645,_0x5e47d3){var _0x37443a=function(_0x1de9f6){while(--_0x1de9f6){_0x51f645['push'](_0x51f645['shift']());}};_0x37443a(++_0x5e47d3);}(_0x7624,0x12a));var _0x4762=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7624[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x4762('0x0'));var rimraf=require(_0x4762('0x1'));var zipdir=require(_0x4762('0x2'));var jsonpatch=require(_0x4762('0x3'));var rp=require(_0x4762('0x4'));var moment=require(_0x4762('0x5'));var BPromise=require(_0x4762('0x6'));var Mustache=require(_0x4762('0x7'));var util=require(_0x4762('0x8'));var path=require(_0x4762('0x9'));var sox=require(_0x4762('0xa'));var csv=require(_0x4762('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4762('0xc'));var _=require(_0x4762('0xd'));var squel=require(_0x4762('0xe'));var crypto=require(_0x4762('0xf'));var jsforce=require(_0x4762('0x10'));var deskjs=require(_0x4762('0x11'));var toCsv=require(_0x4762('0xb'));var querystring=require(_0x4762('0x12'));var Papa=require(_0x4762('0x13'));var Redis=require(_0x4762('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4762('0x15'));var hardwareService=require(_0x4762('0x16'));var logger=require(_0x4762('0x17'))(_0x4762('0x18'));var utils=require(_0x4762('0x19'));var config=require(_0x4762('0x1a'));var licenseUtil=require(_0x4762('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27caea,_0x2580ff){_0x2580ff=_0x2580ff||0xcc;return function(_0xd59e1c){if(_0xd59e1c){return _0x27caea['sendStatus'](_0x2580ff);}return _0x27caea[_0x4762('0x1c')](_0x2580ff)[_0x4762('0x1d')]();};}function respondWithResult(_0x55fd19,_0x5442f0){_0x5442f0=_0x5442f0||0xc8;return function(_0xd45e8b){if(_0xd45e8b){return _0x55fd19['status'](_0x5442f0)['json'](_0xd45e8b);}};}function respondWithFilteredResult(_0x4faa62,_0x8bd03d){return function(_0x3fa43f){if(_0x3fa43f){var _0x97cee7=typeof _0x8bd03d[_0x4762('0x1e')]===_0x4762('0x1f')&&typeof _0x8bd03d[_0x4762('0x20')]===_0x4762('0x1f');var _0x55952b=_0x3fa43f[_0x4762('0x21')];var _0x4556eb=_0x97cee7?0x0:_0x8bd03d[_0x4762('0x1e')];var _0x47714f=_0x97cee7?_0x3fa43f['count']:_0x8bd03d['offset']+_0x8bd03d[_0x4762('0x20')];var _0x3ab0de;if(_0x47714f>=_0x55952b){_0x47714f=_0x55952b;_0x3ab0de=0xc8;}else{_0x3ab0de=0xce;}_0x4faa62[_0x4762('0x1c')](_0x3ab0de);return _0x4faa62[_0x4762('0x22')](_0x4762('0x23'),_0x4556eb+'-'+_0x47714f+'/'+_0x55952b)['json'](_0x3fa43f);}return null;};}function patchUpdates(_0x44cff7){return function(_0x3d7b76){try{jsonpatch[_0x4762('0x24')](_0x3d7b76,_0x44cff7,!![]);}catch(_0x48e0a1){return BPromise[_0x4762('0x25')](_0x48e0a1);}return _0x3d7b76[_0x4762('0x26')]();};}function saveUpdates(_0x52ff14,_0x3e9344){return function(_0x82c188){if(_0x82c188){return _0x82c188[_0x4762('0x27')](_0x52ff14)[_0x4762('0x28')](function(_0x582c69){return _0x582c69;});}return null;};}function removeEntity(_0x4a9f09,_0x1dbc3d){return function(_0x4bb458){if(_0x4bb458){return _0x4bb458[_0x4762('0x29')]()[_0x4762('0x28')](function(){_0x4a9f09['status'](0xcc)[_0x4762('0x1d')]();});}};}function handleEntityNotFound(_0x3e1a16,_0x2603f0){return function(_0x600002){if(!_0x600002){_0x3e1a16[_0x4762('0x2a')](0x194);}return _0x600002;};}function handleError(_0x17f4ce,_0x2a1400){_0x2a1400=_0x2a1400||0x1f4;return function(_0x467545){logger[_0x4762('0x2b')](_0x467545[_0x4762('0x2c')]);if(_0x467545[_0x4762('0x2d')]){delete _0x467545[_0x4762('0x2d')];}_0x17f4ce[_0x4762('0x1c')](_0x2a1400)[_0x4762('0x2e')](_0x467545);};}exports[_0x4762('0x2f')]=function(_0x11bc67,_0x532133){var _0x2db456={},_0x3a15b9={},_0x5adf76={'count':0x0,'rows':[]};var _0x3dfe83=_[_0x4762('0x30')](db[_0x4762('0x31')][_0x4762('0x32')],function(_0xf1b00a){return{'name':_0xf1b00a['fieldName'],'type':_0xf1b00a[_0x4762('0x33')][_0x4762('0x34')]};});_0x3a15b9[_0x4762('0x35')]=_[_0x4762('0x30')](_0x3dfe83,_0x4762('0x2d'));_0x3a15b9[_0x4762('0x36')]=_[_0x4762('0x37')](_0x11bc67['query']);_0x3a15b9[_0x4762('0x38')]=_['intersection'](_0x3a15b9[_0x4762('0x35')],_0x3a15b9['query']);_0x2db456[_0x4762('0x39')]=_[_0x4762('0x3a')](_0x3a15b9['model'],qs[_0x4762('0x3b')](_0x11bc67['query'][_0x4762('0x3b')]));_0x2db456[_0x4762('0x39')]=_0x2db456[_0x4762('0x39')]['length']?_0x2db456[_0x4762('0x39')]:_0x3a15b9['model'];if(!_0x11bc67[_0x4762('0x36')][_0x4762('0x3c')](_0x4762('0x3d'))){_0x2db456[_0x4762('0x20')]=qs['limit'](_0x11bc67[_0x4762('0x36')]['limit']);_0x2db456[_0x4762('0x1e')]=qs['offset'](_0x11bc67['query']['offset']);}_0x2db456[_0x4762('0x3e')]=qs[_0x4762('0x3f')](_0x11bc67[_0x4762('0x36')][_0x4762('0x3f')]);_0x2db456[_0x4762('0x40')]=qs[_0x4762('0x38')](_['pick'](_0x11bc67[_0x4762('0x36')],_0x3a15b9['filters']),_0x3dfe83);if(_0x11bc67[_0x4762('0x36')][_0x4762('0x41')]){_0x2db456[_0x4762('0x40')]=_[_0x4762('0x42')](_0x2db456['where'],{'$or':_[_0x4762('0x30')](_0x3dfe83,function(_0x5835e9){if(_0x5835e9[_0x4762('0x33')]!==_0x4762('0x43')){var _0x599fdc={};_0x599fdc[_0x5835e9[_0x4762('0x2d')]]={'$like':'%'+_0x11bc67[_0x4762('0x36')][_0x4762('0x41')]+'%'};return _0x599fdc;}})});}_0x2db456=_[_0x4762('0x42')]({},_0x2db456,_0x11bc67[_0x4762('0x44')]);var _0x2b3bb8={'where':_0x2db456['where']};return db[_0x4762('0x31')][_0x4762('0x21')](_0x2b3bb8)[_0x4762('0x28')](function(_0x34677d){_0x5adf76['count']=_0x34677d;if(_0x11bc67[_0x4762('0x36')]['includeAll']){_0x2db456['include']=[{'all':!![]}];}return db[_0x4762('0x31')][_0x4762('0x45')](_0x2db456);})[_0x4762('0x28')](function(_0x499aa0){_0x5adf76[_0x4762('0x46')]=_0x499aa0;return _0x5adf76;})['then'](respondWithFilteredResult(_0x532133,_0x2db456))[_0x4762('0x47')](handleError(_0x532133,null));};exports[_0x4762('0x48')]=function(_0x32dc60,_0x15918a){var _0x2e5fb8={'raw':!![],'where':{'id':_0x32dc60[_0x4762('0x49')]['id']}},_0x1180a2={};_0x1180a2['model']=_[_0x4762('0x37')](db[_0x4762('0x31')][_0x4762('0x32')]);_0x1180a2['query']=_[_0x4762('0x37')](_0x32dc60['query']);_0x1180a2[_0x4762('0x38')]=_[_0x4762('0x3a')](_0x1180a2[_0x4762('0x35')],_0x1180a2[_0x4762('0x36')]);_0x2e5fb8[_0x4762('0x39')]=_[_0x4762('0x3a')](_0x1180a2[_0x4762('0x35')],qs[_0x4762('0x3b')](_0x32dc60[_0x4762('0x36')]['fields']));_0x2e5fb8[_0x4762('0x39')]=_0x2e5fb8['attributes'][_0x4762('0x4a')]?_0x2e5fb8[_0x4762('0x39')]:_0x1180a2[_0x4762('0x35')];if(_0x32dc60[_0x4762('0x36')]['includeAll']){_0x2e5fb8[_0x4762('0x4b')]=[{'all':!![]}];}_0x2e5fb8=_['merge']({},_0x2e5fb8,_0x32dc60['options']);return db[_0x4762('0x31')][_0x4762('0x4c')](_0x2e5fb8)[_0x4762('0x28')](handleEntityNotFound(_0x15918a,null))[_0x4762('0x28')](respondWithResult(_0x15918a,null))[_0x4762('0x47')](handleError(_0x15918a,null));};exports['create']=function(_0x2793aa,_0x526d46){return db[_0x4762('0x31')][_0x4762('0x4d')](_0x2793aa['body'],{})[_0x4762('0x28')](respondWithResult(_0x526d46,0xc9))[_0x4762('0x47')](handleError(_0x526d46,null));};exports[_0x4762('0x27')]=function(_0x368c17,_0x14bece){if(_0x368c17[_0x4762('0x4e')]['id']){delete _0x368c17[_0x4762('0x4e')]['id'];}return db[_0x4762('0x31')][_0x4762('0x4c')]({'where':{'id':_0x368c17[_0x4762('0x49')]['id']}})[_0x4762('0x28')](handleEntityNotFound(_0x14bece,null))[_0x4762('0x28')](saveUpdates(_0x368c17[_0x4762('0x4e')],null))['then'](respondWithResult(_0x14bece,null))['catch'](handleError(_0x14bece,null));};exports[_0x4762('0x29')]=function(_0x3acd5f,_0x104c4d){return db['VoiceTransferReport'][_0x4762('0x4c')]({'where':{'id':_0x3acd5f[_0x4762('0x49')]['id']}})[_0x4762('0x28')](handleEntityNotFound(_0x104c4d,null))[_0x4762('0x28')](removeEntity(_0x104c4d,null))[_0x4762('0x47')](handleError(_0x104c4d,null));};exports[_0x4762('0x4f')]=function(_0x5bbe08,_0x2c71f0){return db[_0x4762('0x31')][_0x4762('0x4f')]()[_0x4762('0x28')](respondWithResult(_0x2c71f0,null))[_0x4762('0x47')](handleError(_0x2c71f0,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 2488f5a..4cf5326 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 _0x1192=['./voiceTransferReport.attributes','exports','define','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1192,0x198));var _0x2119=function(_0x2e15de,_0x3b9a6f){_0x2e15de=_0x2e15de-0x0;var _0xdaa198=_0x1192[_0x2e15de];return _0xdaa198;};'use strict';var _=require('lodash');var util=require(_0x2119('0x0'));var logger=require(_0x2119('0x1'))('api');var moment=require(_0x2119('0x2'));var BPromise=require(_0x2119('0x3'));var rp=require(_0x2119('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2119('0x5'));var attributes=require(_0x2119('0x6'));module[_0x2119('0x7')]=function(_0x5aa78b,_0x55c0f2){return _0x5aa78b[_0x2119('0x8')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e93=['request-promise','rimraf','../../config/environment','exports','define','VoiceTransferReport','util','../../config/logger','bluebird'];(function(_0x246f1a,_0x265a00){var _0x1a6da1=function(_0xad589a){while(--_0xad589a){_0x246f1a['push'](_0x246f1a['shift']());}};_0x1a6da1(++_0x265a00);}(_0x0e93,0xf9));var _0x30e9=function(_0x46a8bb,_0x3b8931){_0x46a8bb=_0x46a8bb-0x0;var _0x24df4e=_0x0e93[_0x46a8bb];return _0x24df4e;};'use strict';var _=require('lodash');var util=require(_0x30e9('0x0'));var logger=require(_0x30e9('0x1'))('api');var moment=require('moment');var BPromise=require(_0x30e9('0x2'));var rp=require(_0x30e9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x30e9('0x4'));var config=require(_0x30e9('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x30e9('0x6')]=function(_0x580bd4,_0x48acde){return _0x580bd4[_0x30e9('0x7')](_0x30e9('0x8'),attributes,{'tableName':'report_call_transfer','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 a3fca2d..a2b24b7 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 _0x720f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','CreateVoiceTransferReport','create','options','lodash','util','bluebird','randomstring'];(function(_0x4b4d43,_0x1590f7){var _0x5706ba=function(_0x11d99b){while(--_0x11d99b){_0x4b4d43['push'](_0x4b4d43['shift']());}};_0x5706ba(++_0x1590f7);}(_0x720f,0x19c));var _0xf720=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x720f[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0xf720('0x0'));var util=require(_0xf720('0x1'));var moment=require('moment');var BPromise=require(_0xf720('0x2'));var rs=require(_0xf720('0x3'));var fs=require('fs');var Redis=require(_0xf720('0x4'));var db=require(_0xf720('0x5'))['db'];var utils=require(_0xf720('0x6'));var logger=require(_0xf720('0x7'))(_0xf720('0x8'));var config=require('../../config/environment');var jayson=require(_0xf720('0x9'));var client=jayson[_0xf720('0xa')][_0xf720('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ebbd0,_0x2521b2,_0x2b0b3c){return new BPromise(function(_0x88d65f,_0x5d085f){return client[_0xf720('0xc')](_0x2ebbd0,_0x2b0b3c)[_0xf720('0xd')](function(_0x36365e){logger[_0xf720('0xe')](_0xf720('0xf'),_0x2521b2,'request\x20sent');logger[_0xf720('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x2521b2,'request\x20sent',JSON[_0xf720('0x11')](_0x36365e));if(_0x36365e[_0xf720('0x12')]){if(_0x36365e[_0xf720('0x12')][_0xf720('0x13')]===0x1f4){logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0x36365e[_0xf720('0x12')][_0xf720('0x14')]);return _0x5d085f(_0x36365e['error'][_0xf720('0x14')]);}logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0x36365e['error'][_0xf720('0x14')]);return _0x88d65f(_0x36365e['error']['message']);}else{logger[_0xf720('0xe')](_0xf720('0xf'),_0x2521b2,'request\x20sent');_0x88d65f(_0x36365e[_0xf720('0x15')][_0xf720('0x14')]);}})[_0xf720('0x16')](function(_0xeb6e82){logger[_0xf720('0x12')](_0xf720('0xf'),_0x2521b2,_0xeb6e82);_0x5d085f(_0xeb6e82);});});}exports[_0xf720('0x17')]=function(_0x186efc){var _0x90fde4=this;return new Promise(function(_0x2174c2,_0x3dde39){return db['VoiceTransferReport'][_0xf720('0x18')](_0x186efc['body'],{'raw':_0x186efc[_0xf720('0x19')]?_0x186efc[_0xf720('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xf720('0xd')](function(_0x3eeee3){logger['info'](_0xf720('0x17'),_0x186efc);logger[_0xf720('0x10')]('CreateVoiceTransferReport',_0x186efc,JSON[_0xf720('0x11')](_0x3eeee3));_0x2174c2(_0x3eeee3);})[_0xf720('0x16')](function(_0x9c73e4){logger[_0xf720('0x12')]('CreateVoiceTransferReport',_0x9c73e4[_0xf720('0x14')],_0x186efc);_0x3dde39(_0x90fde4[_0xf720('0x12')](0x1f4,_0x9c73e4['message']));});});}; \ No newline at end of file +var _0x0b15=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceTransferReport','create','body','options','raw','then','debug','CreateVoiceTransferReport','lodash','util','moment','bluebird','ioredis'];(function(_0x2d1840,_0x5dc27e){var _0xd06a88=function(_0x4770c9){while(--_0x4770c9){_0x2d1840['push'](_0x2d1840['shift']());}};_0xd06a88(++_0x5dc27e);}(_0x0b15,0x16f));var _0x50b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b15[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x50b1('0x0'));var util=require(_0x50b1('0x1'));var moment=require(_0x50b1('0x2'));var BPromise=require(_0x50b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x50b1('0x4'));var db=require(_0x50b1('0x5'))['db'];var utils=require(_0x50b1('0x6'));var logger=require(_0x50b1('0x7'))(_0x50b1('0x8'));var config=require(_0x50b1('0x9'));var jayson=require(_0x50b1('0xa'));var client=jayson[_0x50b1('0xb')][_0x50b1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1b1858,_0x26f493,_0x1c49de){return new BPromise(function(_0x26a3cd,_0x3066ae){return client[_0x50b1('0xd')](_0x1b1858,_0x1c49de)['then'](function(_0xf089f){logger[_0x50b1('0xe')](_0x50b1('0xf'),_0x26f493,_0x50b1('0x10'));logger['debug']('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x26f493,_0x50b1('0x10'),JSON[_0x50b1('0x11')](_0xf089f));if(_0xf089f[_0x50b1('0x12')]){if(_0xf089f[_0x50b1('0x12')][_0x50b1('0x13')]===0x1f4){logger['error'](_0x50b1('0xf'),_0x26f493,_0xf089f['error'][_0x50b1('0x14')]);return _0x3066ae(_0xf089f[_0x50b1('0x12')][_0x50b1('0x14')]);}logger[_0x50b1('0x12')](_0x50b1('0xf'),_0x26f493,_0xf089f['error'][_0x50b1('0x14')]);return _0x26a3cd(_0xf089f[_0x50b1('0x12')][_0x50b1('0x14')]);}else{logger['info'](_0x50b1('0xf'),_0x26f493,_0x50b1('0x10'));_0x26a3cd(_0xf089f[_0x50b1('0x15')]['message']);}})[_0x50b1('0x16')](function(_0x5276f3){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x26f493,_0x5276f3);_0x3066ae(_0x5276f3);});});}exports['CreateVoiceTransferReport']=function(_0x215edd){var _0x29449b=this;return new Promise(function(_0x53cb61,_0x5d00e8){return db[_0x50b1('0x17')][_0x50b1('0x18')](_0x215edd[_0x50b1('0x19')],{'raw':_0x215edd[_0x50b1('0x1a')]?_0x215edd[_0x50b1('0x1a')][_0x50b1('0x1b')]===undefined?!![]:![]:!![]})[_0x50b1('0x1c')](function(_0x151f71){logger[_0x50b1('0xe')]('CreateVoiceTransferReport',_0x215edd);logger[_0x50b1('0x1d')](_0x50b1('0x1e'),_0x215edd,JSON[_0x50b1('0x11')](_0x151f71));_0x53cb61(_0x151f71);})[_0x50b1('0x16')](function(_0x5d7d6c){logger[_0x50b1('0x12')]('CreateVoiceTransferReport',_0x5d7d6c['message'],_0x215edd);_0x5d00e8(_0x29449b['error'](0x1f4,_0x5d7d6c[_0x50b1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 82ad5c3..b873490 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 _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x8e992d,_0x5dd91c){var _0x41dd7f=function(_0x130202){while(--_0x130202){_0x8e992d['push'](_0x8e992d['shift']());}};_0x41dd7f(++_0x5dd91c);}(_0xe14d,0x1ee));var _0xde14=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xe14d[_0x125ff8];return _0x2d9ef;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb43b,0x1b2));var _0xbb43=function(_0x375588,_0x4e499b){_0x375588=_0x375588-0x0;var _0x1be823=_0xb43b[_0x375588];return _0x1be823;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6e9061c..bce3767 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 _0xfd28=['all','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','callNumber','callbackUrl','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','hangup\x20executed!','answer\x20fired:','userId','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','jayson/promise','client','http','webbarapi','ioredis','redis','defaults','validate','number','string','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','handleError:','error','stack','name','status','NotFound','then','code','message','result','catch','User','findOne','agent'];(function(_0x30a8c7,_0x8dcda2){var _0x16290c=function(_0x44ac89){while(--_0x44ac89){_0x30a8c7['push'](_0x30a8c7['shift']());}};_0x16290c(++_0x8dcda2);}(_0xfd28,0x148));var _0x8fd2=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0xfd28[_0x1e9424];return _0x1bd96c;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x8fd2('0x0'));var db=require(_0x8fd2('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8fd2('0x3'));var amiClient=jayson[_0x8fd2('0x4')][_0x8fd2('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x8fd2('0x6'));var Redis=require(_0x8fd2('0x7'));config[_0x8fd2('0x8')]=_[_0x8fd2('0x9')](config[_0x8fd2('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8fd2('0x8')]));var Schema=require(_0x8fd2('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8fd2('0xc'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x8fd2('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xe')]},'transferNumber':{'type':_0x8fd2('0xc'),'required':[!![],_0x8fd2('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]},'sessionId':{'type':_0x8fd2('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],_0x8fd2('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':_0x8fd2('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x20daca,_0x5ef478,_0x4f0b17){logger['info'](_0x20daca,_0x5ef478,JSON[_0x8fd2('0x10')](_0x4f0b17));io['to'](_0x20daca)[_0x8fd2('0x11')](_0x5ef478,_0x4f0b17);}function handleError(_0x1ced10){return function(_0x12e8a3){console['log'](_0x8fd2('0x12'),_0x12e8a3,_0x12e8a3 instanceof RangeError);logger[_0x8fd2('0x13')](_0x12e8a3[_0x8fd2('0x14')]);if(_0x12e8a3 instanceof RangeError){if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3[_0x8fd2('0x15')];}_0x1ced10['status'](0x194)['send'](_0x12e8a3);}else{if(_0x12e8a3[_0x8fd2('0x15')]){delete _0x12e8a3['name'];}_0x1ced10[_0x8fd2('0x16')](0x1f4)['send'](_0x12e8a3);}};}function checkError(){return function(_0x1631c6){if(!_0x1631c6){throw new RangeError(_0x8fd2('0x17'));}return _0x1631c6;};}function respondWithRpcPromise(_0x4f81dc,_0x122b60){return new BPromise(function(_0x4c2be8,_0xd3981f){var _0x44ee7a=amiClient;return _0x44ee7a['request'](_0x4f81dc,_0x122b60)[_0x8fd2('0x18')](function(_0x2a9c3c){if(_0x2a9c3c[_0x8fd2('0x13')]){if(_0x2a9c3c['error'][_0x8fd2('0x19')]===0x1f4){return _0xd3981f(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}return _0x4c2be8(_0x2a9c3c[_0x8fd2('0x13')][_0x8fd2('0x1a')]);}else{_0x4c2be8(_0x2a9c3c[_0x8fd2('0x1b')]);}})[_0x8fd2('0x1c')](function(_0x398925){_0xd3981f(_0x398925);});});}function getAgent(_0x1456b4){return db[_0x8fd2('0x1d')][_0x8fd2('0x1e')]({'where':{'id':_0x1456b4,'role':_0x8fd2('0x1f')}})[_0x8fd2('0x18')](checkError());}function getAgentCheckSession(_0x512e5a,_0x4c6af7){return new BPromise(function(_0x345bc3,_0x1858a9){var _0x288bcd=respondWithRpcPromise('VoiceChannels');var _0x2f26ae=getAgent(_0x512e5a);Promise[_0x8fd2('0x20')]([_0x288bcd,_0x2f26ae])[_0x8fd2('0x18')](function(_0x960869){var _0x119439=_0x960869[0x0];var _0x4745bf=_0x960869[0x1];var _0x332ab0=_['filter'](_0x119439[_0x8fd2('0x21')],function(_0x13c9b9){return _0x13c9b9[_0x8fd2('0x22')]==_0x4745bf['id']&&_0x13c9b9[_0x8fd2('0x23')]==_0x4c6af7;});if(_0x332ab0[_0x8fd2('0x24')]==0x1){_0x345bc3(_0x4745bf);}else{_0x1858a9(new RangeError(_0x8fd2('0x25')+_0x4c6af7+_0x8fd2('0x26')));}});});}exports['originate']=function(_0x5b992a,_0x5144ba){logger[_0x8fd2('0x27')](_0x8fd2('0x28'),_0x5b992a[_0x8fd2('0x29')]);var _0xe4987b=originateValidation['validate'](_0x5b992a['body']);if(_0xe4987b[_0x8fd2('0x24')]>0x0){return _0x5144ba[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0xe4987b);}var _0x18fe4e=_0x5b992a[_0x8fd2('0x29')]['userId'];var _0x328964=_0x5b992a['body'][_0x8fd2('0x2b')];var _0x4ade8c=_0x5b992a[_0x8fd2('0x29')]['callerId'];var _0x134420=_0x5b992a[_0x8fd2('0x29')][_0x8fd2('0x2c')];return getAgent(_0x18fe4e)['then'](function(_0x339291){logger['info'](_0x8fd2('0x2d'),_0x339291[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x339291[_0x8fd2('0x15')]),_0x8fd2('0x2f'),{'callNumber':_0x328964,'callerId':_0x4ade8c,'callbackUrl':_0x134420});return _0x5144ba[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x30')});})[_0x8fd2('0x1c')](handleError(_0x5144ba));};exports[_0x8fd2('0x31')]=function(_0x4adfa2,_0x37a24b){logger[_0x8fd2('0x27')]('hangup\x20fired:',_0x4adfa2[_0x8fd2('0x29')]);var _0x130072=hangupValidation[_0x8fd2('0xa')](_0x4adfa2[_0x8fd2('0x29')]);if(_0x130072[_0x8fd2('0x24')]>0x0){return _0x37a24b[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x130072);}var _0x5e6140=_0x4adfa2[_0x8fd2('0x29')]['userId'];var _0x566c9e=_0x4adfa2[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x5e6140)[_0x8fd2('0x18')](function(_0x2edcfd){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2edcfd['name']);emit(util['format'](_0x8fd2('0x32'),_0x2edcfd['name']),'webbar:hangup',{'sessionId':_0x566c9e});return _0x37a24b[_0x8fd2('0x16')](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x33')});})[_0x8fd2('0x1c')](handleError(_0x37a24b));};exports['answer']=function(_0x39cd8e,_0x1d5458){logger[_0x8fd2('0x27')](_0x8fd2('0x34'),_0x39cd8e[_0x8fd2('0x29')]);var _0x1de9aa=answerValidation[_0x8fd2('0xa')](_0x39cd8e['body']);if(_0x1de9aa[_0x8fd2('0x24')]>0x0){return _0x1d5458[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1de9aa);}var _0x70404e=_0x39cd8e[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40a572=_0x39cd8e['body'][_0x8fd2('0x23')];return getAgent(_0x70404e)[_0x8fd2('0x18')](function(_0x2abd80){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2abd80[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2abd80[_0x8fd2('0x15')]),'webbar:answer',{'sessionId':_0x40a572});return _0x1d5458[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x36')});})[_0x8fd2('0x1c')](handleError(_0x1d5458));};exports[_0x8fd2('0x37')]=function(_0x5c0632,_0x290467){logger[_0x8fd2('0x27')](_0x8fd2('0x38'),_0x5c0632['body']);var _0x3c65c4=holdValidation['validate'](_0x5c0632[_0x8fd2('0x29')]);if(_0x3c65c4[_0x8fd2('0x24')]>0x0){return _0x290467[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x3c65c4);}var _0xc62e9e=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x34ffed=_0x5c0632[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0xc62e9e)[_0x8fd2('0x18')](function(_0x34f3a2){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x34f3a2[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x34f3a2[_0x8fd2('0x15')]),_0x8fd2('0x39'),{'sessionId':_0x34ffed});return _0x290467['status'](0xc8)['json']({'error':![],'message':_0x8fd2('0x3a')});})[_0x8fd2('0x1c')](handleError(_0x290467));};exports[_0x8fd2('0x3b')]=function(_0x5d79c3,_0x4d5b81){logger[_0x8fd2('0x27')]('unhold\x20fired:',_0x5d79c3[_0x8fd2('0x29')]);var _0x1295c4=unholdValidation[_0x8fd2('0xa')](_0x5d79c3['body']);if(_0x1295c4[_0x8fd2('0x24')]>0x0){return _0x4d5b81[_0x8fd2('0x16')](0x190)['json'](_0x1295c4);}var _0x331ada=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x56050f=_0x5d79c3[_0x8fd2('0x29')][_0x8fd2('0x23')];return getAgent(_0x331ada)[_0x8fd2('0x18')](function(_0x2c5766){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2c5766['name']);emit(util['format'](_0x8fd2('0x32'),_0x2c5766[_0x8fd2('0x15')]),'webbar:unhold',{'sessionId':_0x56050f});return _0x4d5b81[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':'unhold\x20executed!'});})[_0x8fd2('0x1c')](handleError(_0x4d5b81));};exports[_0x8fd2('0x3c')]=function(_0x337354,_0x29a00e){logger[_0x8fd2('0x27')](_0x8fd2('0x3d'),_0x29a00e['body']);var _0x2f4759=callsValidation[_0x8fd2('0xa')](_0x337354[_0x8fd2('0x29')]);if(_0x2f4759[_0x8fd2('0x24')]>0x0){return _0x29a00e[_0x8fd2('0x16')](0x190)['json'](_0x2f4759);}var _0x5cf641=_0x337354['body']['userId'];var _0x57b8f6=respondWithRpcPromise(_0x8fd2('0x3e'));var _0x382154=getAgent(_0x5cf641);return Promise[_0x8fd2('0x20')]([_0x57b8f6,_0x382154])[_0x8fd2('0x18')](function(_0x21696c){var _0x25abdc=_0x21696c[0x0];var _0x460f31=_0x21696c[0x1];var _0x4a81ab=_[_0x8fd2('0x3f')](_0x25abdc['rows'],function(_0x351cfe){return _0x351cfe[_0x8fd2('0x22')]==_0x460f31['id'];});return _0x29a00e['status'](0xc8)['json']({'count':_0x4a81ab[_0x8fd2('0x24')],'rows':_0x4a81ab});})[_0x8fd2('0x1c')](handleError(_0x29a00e));};exports[_0x8fd2('0x40')]=function(_0x30a952,_0x37ddfa){logger['info'](_0x8fd2('0x41'),_0x30a952[_0x8fd2('0x29')]);var _0x1b46d6=conferenceValidation[_0x8fd2('0xa')](_0x30a952['body']);if(_0x1b46d6[_0x8fd2('0x24')]>0x0){return _0x37ddfa[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x1b46d6);}var _0x23c608=_0x30a952['body']['userId'];return getAgent(_0x23c608)['then'](function(_0x2e5693){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2e5693[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')]('user:%s',_0x2e5693[_0x8fd2('0x15')]),_0x8fd2('0x42'));return _0x37ddfa['status'](0xc8)[_0x8fd2('0x2a')]({'error':![],'message':_0x8fd2('0x43')});})[_0x8fd2('0x1c')](handleError(_0x37ddfa));};exports[_0x8fd2('0x44')]=function(_0x305d83,_0x5547c7){logger[_0x8fd2('0x27')](_0x8fd2('0x45'),_0x305d83[_0x8fd2('0x29')]);var _0x4606f7=transferValidation[_0x8fd2('0xa')](_0x305d83[_0x8fd2('0x29')]);if(_0x4606f7[_0x8fd2('0x24')]>0x0){return _0x5547c7[_0x8fd2('0x16')](0x190)[_0x8fd2('0x2a')](_0x4606f7);}var _0x4680f0=_0x305d83[_0x8fd2('0x29')][_0x8fd2('0x35')];var _0x40ffd5=_0x305d83['body'][_0x8fd2('0x23')];var _0x237756=_0x305d83['body']['transferNumber'];return getAgent(_0x4680f0)['then'](function(_0x2bd1d0){logger[_0x8fd2('0x27')](_0x8fd2('0x2d'),_0x2bd1d0[_0x8fd2('0x15')]);emit(util[_0x8fd2('0x2e')](_0x8fd2('0x32'),_0x2bd1d0['name']),_0x8fd2('0x46'),{'sessionId':_0x40ffd5,'transferNumber':_0x237756});return _0x5547c7[_0x8fd2('0x16')](0xc8)['json']({'error':![],'message':_0x8fd2('0x47')});})['catch'](handleError(_0x5547c7));}; \ No newline at end of file +var _0xc6d8=['webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','../../mysqldb','util','jayson/promise','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','stringify','emit','error','name','status','send','code','result','User','findOne','agent','then','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','webbar:hangup','answer\x20fired:','answer\x20executed!','hold','sessionId','webbar:hold','unhold','unhold\x20fired:'];(function(_0x2612b6,_0x59f8c8){var _0x55308b=function(_0x1412cb){while(--_0x1412cb){_0x2612b6['push'](_0x2612b6['shift']());}};_0x55308b(++_0x59f8c8);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x44a3b0,_0x352810){_0x44a3b0=_0x44a3b0-0x0;var _0x39e6f6=_0xc6d8[_0x44a3b0];return _0x39e6f6;};'use strict';var path=require(_0x8c6d('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8c6d('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x8c6d('0x2'));var BPromise=require('bluebird');var jayson=require(_0x8c6d('0x3'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0x8c6d('0x4'))(_0x8c6d('0x5'));var Redis=require(_0x8c6d('0x6'));config[_0x8c6d('0x7')]=_[_0x8c6d('0x8')](config[_0x8c6d('0x7')],{'host':_0x8c6d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8c6d('0x7')]));var Schema=require(_0x8c6d('0xa'));var originateValidation=new Schema({'userId':{'type':_0x8c6d('0xb'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x8c6d('0xc'),'required':[!![],_0x8c6d('0xd')]},'callerId':{'type':_0x8c6d('0xc')},'callbackUrl':{'type':_0x8c6d('0xc')}});var hangupValidation=new Schema({'userId':{'type':_0x8c6d('0xb'),'required':[!![],_0x8c6d('0xe')]},'sessionId':{'type':_0x8c6d('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x8c6d('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8c6d('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x8c6d('0xc'),'required':[!![],_0x8c6d('0xf')]},'transferNumber':{'type':_0x8c6d('0xc'),'required':[!![],_0x8c6d('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x8c6d('0xb'),'required':[!![],_0x8c6d('0xe')]},'sessionId':{'type':_0x8c6d('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8c6d('0xb'),'required':[!![],_0x8c6d('0xe')]},'sessionId':{'type':_0x8c6d('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c6d('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8c6d('0xe')]}});function emit(_0x4dd4b6,_0x150a16,_0x3d95a6){logger['info'](_0x4dd4b6,_0x150a16,JSON[_0x8c6d('0x11')](_0x3d95a6));io['to'](_0x4dd4b6)[_0x8c6d('0x12')](_0x150a16,_0x3d95a6);}function handleError(_0x51a5fa){return function(_0x3e5495){console['log']('handleError:',_0x3e5495,_0x3e5495 instanceof RangeError);logger[_0x8c6d('0x13')](_0x3e5495['stack']);if(_0x3e5495 instanceof RangeError){if(_0x3e5495[_0x8c6d('0x14')]){delete _0x3e5495[_0x8c6d('0x14')];}_0x51a5fa[_0x8c6d('0x15')](0x194)[_0x8c6d('0x16')](_0x3e5495);}else{if(_0x3e5495[_0x8c6d('0x14')]){delete _0x3e5495['name'];}_0x51a5fa['status'](0x1f4)['send'](_0x3e5495);}};}function checkError(){return function(_0x212199){if(!_0x212199){throw new RangeError('NotFound');}return _0x212199;};}function respondWithRpcPromise(_0xc3288,_0x4b6835){return new BPromise(function(_0x4c378b,_0x37fd7c){var _0x8cebeb=amiClient;return _0x8cebeb['request'](_0xc3288,_0x4b6835)['then'](function(_0x51bb08){if(_0x51bb08['error']){if(_0x51bb08[_0x8c6d('0x13')][_0x8c6d('0x17')]===0x1f4){return _0x37fd7c(_0x51bb08[_0x8c6d('0x13')]['message']);}return _0x4c378b(_0x51bb08[_0x8c6d('0x13')]['message']);}else{_0x4c378b(_0x51bb08[_0x8c6d('0x18')]);}})['catch'](function(_0x23c893){_0x37fd7c(_0x23c893);});});}function getAgent(_0xba50cf){return db[_0x8c6d('0x19')][_0x8c6d('0x1a')]({'where':{'id':_0xba50cf,'role':_0x8c6d('0x1b')}})[_0x8c6d('0x1c')](checkError());}function getAgentCheckSession(_0x9c269d,_0x41957d){return new BPromise(function(_0x3eab38,_0x4c307c){var _0x544143=respondWithRpcPromise(_0x8c6d('0x1d'));var _0x93a094=getAgent(_0x9c269d);Promise[_0x8c6d('0x1e')]([_0x544143,_0x93a094])[_0x8c6d('0x1c')](function(_0x370626){var _0x316ca7=_0x370626[0x0];var _0x2bc94a=_0x370626[0x1];var _0x2d028f=_[_0x8c6d('0x1f')](_0x316ca7[_0x8c6d('0x20')],function(_0x3375dd){return _0x3375dd[_0x8c6d('0x21')]==_0x2bc94a['id']&&_0x3375dd['sessionId']==_0x41957d;});if(_0x2d028f[_0x8c6d('0x22')]==0x1){_0x3eab38(_0x2bc94a);}else{_0x4c307c(new RangeError(_0x8c6d('0x23')+_0x41957d+_0x8c6d('0x24')));}});});}exports[_0x8c6d('0x25')]=function(_0x115621,_0xa46064){logger[_0x8c6d('0x26')](_0x8c6d('0x27'),_0x115621[_0x8c6d('0x28')]);var _0x55cc8e=originateValidation[_0x8c6d('0xa')](_0x115621['body']);if(_0x55cc8e[_0x8c6d('0x22')]>0x0){return _0xa46064[_0x8c6d('0x15')](0x190)[_0x8c6d('0x29')](_0x55cc8e);}var _0x331573=_0x115621[_0x8c6d('0x28')][_0x8c6d('0x2a')];var _0x57d419=_0x115621['body'][_0x8c6d('0x2b')];var _0x2b7ca7=_0x115621[_0x8c6d('0x28')][_0x8c6d('0x2c')];var _0x5638f4=_0x115621[_0x8c6d('0x28')][_0x8c6d('0x2d')];return getAgent(_0x331573)[_0x8c6d('0x1c')](function(_0x29cef8){logger[_0x8c6d('0x26')](_0x8c6d('0x2e'),_0x29cef8['name']);emit(util[_0x8c6d('0x2f')](_0x8c6d('0x30'),_0x29cef8[_0x8c6d('0x14')]),_0x8c6d('0x31'),{'callNumber':_0x57d419,'callerId':_0x2b7ca7,'callbackUrl':_0x5638f4});return _0xa46064[_0x8c6d('0x15')](0xc8)[_0x8c6d('0x29')]({'error':![],'message':_0x8c6d('0x32')});})[_0x8c6d('0x33')](handleError(_0xa46064));};exports[_0x8c6d('0x34')]=function(_0x30025b,_0x16b2cd){logger[_0x8c6d('0x26')]('hangup\x20fired:',_0x30025b[_0x8c6d('0x28')]);var _0x82b885=hangupValidation[_0x8c6d('0xa')](_0x30025b[_0x8c6d('0x28')]);if(_0x82b885[_0x8c6d('0x22')]>0x0){return _0x16b2cd['status'](0x190)[_0x8c6d('0x29')](_0x82b885);}var _0x250967=_0x30025b['body'][_0x8c6d('0x2a')];var _0x4514f5=_0x30025b[_0x8c6d('0x28')]['sessionId'];return getAgent(_0x250967)[_0x8c6d('0x1c')](function(_0xb7293d){logger[_0x8c6d('0x26')](_0x8c6d('0x2e'),_0xb7293d[_0x8c6d('0x14')]);emit(util[_0x8c6d('0x2f')](_0x8c6d('0x30'),_0xb7293d[_0x8c6d('0x14')]),_0x8c6d('0x35'),{'sessionId':_0x4514f5});return _0x16b2cd[_0x8c6d('0x15')](0xc8)[_0x8c6d('0x29')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x16b2cd));};exports['answer']=function(_0x331e6f,_0x1566d3){logger[_0x8c6d('0x26')](_0x8c6d('0x36'),_0x331e6f[_0x8c6d('0x28')]);var _0x546f04=answerValidation[_0x8c6d('0xa')](_0x331e6f[_0x8c6d('0x28')]);if(_0x546f04[_0x8c6d('0x22')]>0x0){return _0x1566d3['status'](0x190)[_0x8c6d('0x29')](_0x546f04);}var _0x4aa3e8=_0x331e6f['body']['userId'];var _0x4bd626=_0x331e6f['body']['sessionId'];return getAgent(_0x4aa3e8)[_0x8c6d('0x1c')](function(_0x409e6d){logger[_0x8c6d('0x26')](_0x8c6d('0x2e'),_0x409e6d[_0x8c6d('0x14')]);emit(util['format']('user:%s',_0x409e6d['name']),'webbar:answer',{'sessionId':_0x4bd626});return _0x1566d3[_0x8c6d('0x15')](0xc8)['json']({'error':![],'message':_0x8c6d('0x37')});})[_0x8c6d('0x33')](handleError(_0x1566d3));};exports[_0x8c6d('0x38')]=function(_0x8a980b,_0x3daa32){logger[_0x8c6d('0x26')]('hold\x20fired:',_0x8a980b[_0x8c6d('0x28')]);var _0x458a66=holdValidation['validate'](_0x8a980b[_0x8c6d('0x28')]);if(_0x458a66[_0x8c6d('0x22')]>0x0){return _0x3daa32['status'](0x190)[_0x8c6d('0x29')](_0x458a66);}var _0xb6e94=_0x8a980b[_0x8c6d('0x28')][_0x8c6d('0x2a')];var _0xdb370e=_0x8a980b[_0x8c6d('0x28')][_0x8c6d('0x39')];return getAgent(_0xb6e94)[_0x8c6d('0x1c')](function(_0x1f1609){logger[_0x8c6d('0x26')](_0x8c6d('0x2e'),_0x1f1609[_0x8c6d('0x14')]);emit(util[_0x8c6d('0x2f')](_0x8c6d('0x30'),_0x1f1609[_0x8c6d('0x14')]),_0x8c6d('0x3a'),{'sessionId':_0xdb370e});return _0x3daa32['status'](0xc8)['json']({'error':![],'message':'hold\x20executed!'});})[_0x8c6d('0x33')](handleError(_0x3daa32));};exports[_0x8c6d('0x3b')]=function(_0x4919b8,_0x574b08){logger['info'](_0x8c6d('0x3c'),_0x4919b8['body']);var _0x6bcc06=unholdValidation[_0x8c6d('0xa')](_0x4919b8[_0x8c6d('0x28')]);if(_0x6bcc06['length']>0x0){return _0x574b08[_0x8c6d('0x15')](0x190)['json'](_0x6bcc06);}var _0x203401=_0x4919b8['body'][_0x8c6d('0x2a')];var _0x21597a=_0x4919b8[_0x8c6d('0x28')][_0x8c6d('0x39')];return getAgent(_0x203401)['then'](function(_0xd7f4fc){logger[_0x8c6d('0x26')](_0x8c6d('0x2e'),_0xd7f4fc[_0x8c6d('0x14')]);emit(util[_0x8c6d('0x2f')](_0x8c6d('0x30'),_0xd7f4fc[_0x8c6d('0x14')]),_0x8c6d('0x3d'),{'sessionId':_0x21597a});return _0x574b08['status'](0xc8)[_0x8c6d('0x29')]({'error':![],'message':_0x8c6d('0x3e')});})[_0x8c6d('0x33')](handleError(_0x574b08));};exports[_0x8c6d('0x3f')]=function(_0x535c4a,_0x2c7278){logger['info']('calls\x20fired:',_0x2c7278[_0x8c6d('0x28')]);var _0x6c8f78=callsValidation[_0x8c6d('0xa')](_0x535c4a[_0x8c6d('0x28')]);if(_0x6c8f78[_0x8c6d('0x22')]>0x0){return _0x2c7278[_0x8c6d('0x15')](0x190)[_0x8c6d('0x29')](_0x6c8f78);}var _0x494e8e=_0x535c4a[_0x8c6d('0x28')][_0x8c6d('0x2a')];var _0x3af565=respondWithRpcPromise('VoiceChannels');var _0x445d56=getAgent(_0x494e8e);return Promise[_0x8c6d('0x1e')]([_0x3af565,_0x445d56])[_0x8c6d('0x1c')](function(_0x26bb3c){var _0x7cff8=_0x26bb3c[0x0];var _0x53a333=_0x26bb3c[0x1];var _0x2da745=_[_0x8c6d('0x1f')](_0x7cff8['rows'],function(_0x248068){return _0x248068['UserId']==_0x53a333['id'];});return _0x2c7278[_0x8c6d('0x15')](0xc8)['json']({'count':_0x2da745['length'],'rows':_0x2da745});})[_0x8c6d('0x33')](handleError(_0x2c7278));};exports[_0x8c6d('0x40')]=function(_0x36de3c,_0x228209){logger[_0x8c6d('0x26')](_0x8c6d('0x41'),_0x36de3c[_0x8c6d('0x28')]);var _0x1c37ac=conferenceValidation[_0x8c6d('0xa')](_0x36de3c[_0x8c6d('0x28')]);if(_0x1c37ac[_0x8c6d('0x22')]>0x0){return _0x228209['status'](0x190)[_0x8c6d('0x29')](_0x1c37ac);}var _0x3d5523=_0x36de3c[_0x8c6d('0x28')]['userId'];return getAgent(_0x3d5523)[_0x8c6d('0x1c')](function(_0x1695b3){logger[_0x8c6d('0x26')]('entityFound:',_0x1695b3[_0x8c6d('0x14')]);emit(util['format'](_0x8c6d('0x30'),_0x1695b3['name']),'webbar:conference');return _0x228209[_0x8c6d('0x15')](0xc8)[_0x8c6d('0x29')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x228209));};exports['transfer']=function(_0x365201,_0x197d5a){logger[_0x8c6d('0x26')](_0x8c6d('0x42'),_0x365201['body']);var _0x5d48b8=transferValidation[_0x8c6d('0xa')](_0x365201[_0x8c6d('0x28')]);if(_0x5d48b8[_0x8c6d('0x22')]>0x0){return _0x197d5a[_0x8c6d('0x15')](0x190)[_0x8c6d('0x29')](_0x5d48b8);}var _0x455a6d=_0x365201[_0x8c6d('0x28')][_0x8c6d('0x2a')];var _0x58abb7=_0x365201[_0x8c6d('0x28')][_0x8c6d('0x39')];var _0x1d7be0=_0x365201[_0x8c6d('0x28')]['transferNumber'];return getAgent(_0x455a6d)[_0x8c6d('0x1c')](function(_0x55f8c4){logger['info'](_0x8c6d('0x2e'),_0x55f8c4[_0x8c6d('0x14')]);emit(util[_0x8c6d('0x2f')]('user:%s',_0x55f8c4[_0x8c6d('0x14')]),_0x8c6d('0x43'),{'sessionId':_0x58abb7,'transferNumber':_0x1d7be0});return _0x197d5a['status'](0xc8)[_0x8c6d('0x29')]({'error':![],'message':_0x8c6d('0x44')});})[_0x8c6d('0x33')](handleError(_0x197d5a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4875434..cfa3709 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 _0x66fa=['/:id','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','post','/:id/dispositions','addDisposition','addAgents','/:id/notify','notify','/:id/send','send','put'];(function(_0x4c91f8,_0xff98ab){var _0x2240b1=function(_0x3e543b){while(--_0x3e543b){_0x4c91f8['push'](_0x4c91f8['shift']());}};_0x2240b1(++_0xff98ab);}(_0x66fa,0x117));var _0xa66f=function(_0x1b4277,_0x1498eb){_0x1b4277=_0x1b4277-0x0;var _0x3369bc=_0x66fa[_0x1b4277];return _0x3369bc;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xa66f('0xb')](_0xa66f('0xd'),auth['isAuthenticated'](),controller[_0xa66f('0xe')]);router['get'](_0xa66f('0xf'),auth['isAuthenticated'](),controller[_0xa66f('0x10')]);router[_0xa66f('0xb')](_0xa66f('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xa66f('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x14')]);router[_0xa66f('0x12')](_0xa66f('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xa66f('0x12')](_0xa66f('0xf'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x15')]);router['post'](_0xa66f('0x11'),auth['isAuthenticated'](),controller['addApplications']);router[_0xa66f('0x12')](_0xa66f('0x16'),controller[_0xa66f('0x17')]);router[_0xa66f('0x12')](_0xa66f('0x18'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x19')]);router[_0xa66f('0x1a')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1c')]);router[_0xa66f('0x1d')](_0xa66f('0x1b'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1e')]);router['delete'](_0xa66f('0x13'),auth[_0xa66f('0x9')](),controller[_0xa66f('0x1f')]);router[_0xa66f('0x1d')]('/:id/canned_answers',auth[_0xa66f('0x9')](),controller[_0xa66f('0x20')]);router[_0xa66f('0x1d')](_0xa66f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xa66f('0x21')]=router; \ No newline at end of file +var _0x5f66=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAgents','addApplications','notify','send','put','update','delete','destroy','removeAnswers','exports'];(function(_0x476bb3,_0x515db6){var _0x50cff7=function(_0x24945d){while(--_0x24945d){_0x476bb3['push'](_0x476bb3['shift']());}};_0x50cff7(++_0x515db6);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'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('./whatsappAccount.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['show']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/canned_answers',auth[_0x65f6('0x8')](),controller['getAnswers']);router['get'](_0x65f6('0xe'),auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);router[_0x65f6('0x12')]('/',auth[_0x65f6('0x8')](),controller[_0x65f6('0x13')]);router[_0x65f6('0x12')](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x14')]);router['post'](_0x65f6('0x15'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x65f6('0x12')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x16')]);router[_0x65f6('0x12')](_0x65f6('0x10'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x17')]);router['post']('/:id/notify',controller[_0x65f6('0x18')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0x65f6('0x19')]);router[_0x65f6('0x1a')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0x1b')]);router[_0x65f6('0x1c')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1d')]);router['delete'](_0x65f6('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x65f6('0x1c')](_0x65f6('0x15'),auth['isAuthenticated'](),controller[_0x65f6('0x1e')]);router[_0x65f6('0x1c')](_0x65f6('0xe'),auth[_0x65f6('0x8')](),controller['removeAgents']);module[_0x65f6('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 2c0feac..4f9541c 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 _0xc877=['name','STRING','generate','ENUM','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc877,0x7d));var _0x7c87=function(_0x4e7ab9,_0x3f6e8a){_0x4e7ab9=_0x4e7ab9-0x0;var _0xbfb8cc=_0xc877[_0x4e7ab9];return _0xbfb8cc;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x7c87('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7c87('0x1'),'allowNull':![]},'key':{'type':Sequelize[_0x7c87('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7c87('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7c87('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7c87('0x4')](_0x7c87('0x5'),_0x7c87('0x6'))},'accountSid':{'type':Sequelize[_0x7c87('0x2')]},'baseUrl':{'type':Sequelize[_0x7c87('0x2')]},'authToken':{'type':Sequelize[_0x7c87('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7c87('0x7');}},'notificationSound':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7c87('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c87('0x9')],'comment':_0x7c87('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x7c87('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1b811a){if(!_0x1b811a){this[_0x7c87('0xb')](_0x7c87('0xc'),null);}this[_0x7c87('0xb')](_0x7c87('0xd'),_0x1b811a);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7c1e=['name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING'];(function(_0x47e34b,_0x5325f5){var _0x2655b0=function(_0x35cae5){while(--_0x35cae5){_0x47e34b['push'](_0x47e34b['shift']());}};_0x2655b0(++_0x5325f5);}(_0x7c1e,0x194));var _0xe7c1=function(_0x37715b,_0x35df55){_0x37715b=_0x37715b-0x0;var _0x34d8ce=_0x7c1e[_0x37715b];return _0x34d8ce;};'use strict';var Sequelize=require(_0xe7c1('0x0'));var rs=require(_0xe7c1('0x1'));module[_0xe7c1('0x2')]={'name':{'type':Sequelize[_0xe7c1('0x3')],'unique':_0xe7c1('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xe7c1('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xe7c1('0x5')]();}},'phone':{'type':Sequelize[_0xe7c1('0x3')]},'type':{'type':Sequelize[_0xe7c1('0x6')](_0xe7c1('0x7'),_0xe7c1('0x8'))},'accountSid':{'type':Sequelize[_0xe7c1('0x3')]},'baseUrl':{'type':Sequelize[_0xe7c1('0x3')]},'authToken':{'type':Sequelize[_0xe7c1('0x3')]},'notificationTemplate':{'type':Sequelize[_0xe7c1('0x9')],'defaultValue':function(){return _0xe7c1('0xa');}},'notificationSound':{'type':Sequelize[_0xe7c1('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe7c1('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe7c1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe7c1('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe7c1('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe7c1('0xc')],'comment':_0xe7c1('0xd')},'mandatoryDisposition':{'type':Sequelize[_0xe7c1('0xb')],'defaultValue':![],'comment':_0xe7c1('0xe'),'set':function(_0x25e0c1){if(!_0x25e0c1){this[_0xe7c1('0xf')](_0xe7c1('0x10'),null);}this[_0xe7c1('0xf')]('mandatoryDisposition',_0x25e0c1);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 654f788..11b07de 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 _0x611e=['agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','fast-json-patch','request-promise','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','get','UserProfileResource','stack','send','Pause','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','name','body','describe','addDisposition','WhatsappAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','userWhatsappAccount:remove','getAgents','findOne','User','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','WhatsappMessage','message_id','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','autoclose','applications','push','unmanaged','*,*,*,*','interaction','created','ContactId','AttachmentId','UserId','unshift'];(function(_0x5beb98,_0x560c65){var _0xb537b4=function(_0x11fad4){while(--_0x11fad4){_0x5beb98['push'](_0x5beb98['shift']());}};_0xb537b4(++_0x560c65);}(_0x611e,0xce));var _0xe611=function(_0x5e2983,_0x5e8414){_0x5e2983=_0x5e2983-0x0;var _0x2e80d4=_0x611e[_0x5e2983];return _0x2e80d4;};'use strict';var emlformat=require(_0xe611('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe611('0x1'));var rp=require(_0xe611('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe611('0x3'));var path=require(_0xe611('0x4'));var sox=require(_0xe611('0x5'));var csv=require('to-csv');var ejs=require(_0xe611('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe611('0x7'));var squel=require(_0xe611('0x8'));var crypto=require(_0xe611('0x9'));var jsforce=require(_0xe611('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe611('0xb'));var Papa=require(_0xe611('0xc'));var Redis=require(_0xe611('0xd'));var authService=require(_0xe611('0xe'));var qs=require(_0xe611('0xf'));var as=require(_0xe611('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe611('0x11'))('api');var utils=require(_0xe611('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xe611('0x13'));var db=require(_0xe611('0x14'))['db'];config[_0xe611('0x15')]=_['defaults'](config[_0xe611('0x15')],{'host':_0xe611('0x16'),'port':0x18eb});var socket=require(_0xe611('0x17'))(new Redis(config[_0xe611('0x15')]));require(_0xe611('0x18'))[_0xe611('0x19')](socket);var jayson=require(_0xe611('0x1a'));var client=jayson[_0xe611('0x1b')][_0xe611('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x17a4a6,_0x5262ec,_0x85f933,_0x4486f8){return new BPromise(function(_0x41b21e,_0x3100b2){var _0x31f4f4=_0x4486f8||client;return _0x31f4f4['request'](_0x17a4a6,_0x85f933)['then'](function(_0x527a06){logger['info'](_0xe611('0x1d'),_0x5262ec,_0xe611('0x1e'));logger[_0xe611('0x1f')](_0xe611('0x20'),_0x5262ec,_0xe611('0x1e'),JSON[_0xe611('0x21')](_0x527a06));if(_0x527a06[_0xe611('0x22')]){if(_0x527a06['error'][_0xe611('0x23')]===0x1f4){logger['error'](_0xe611('0x1d'),_0x5262ec,_0x527a06['error'][_0xe611('0x24')]);return _0x3100b2(_0x527a06[_0xe611('0x22')]['message']);}logger[_0xe611('0x22')](_0xe611('0x1d'),_0x5262ec,_0x527a06[_0xe611('0x22')][_0xe611('0x24')]);return _0x41b21e(_0x527a06['error'][_0xe611('0x24')]);}else{logger[_0xe611('0x25')](_0xe611('0x1d'),_0x5262ec,'request\x20sent');_0x41b21e(_0x527a06[_0xe611('0x26')][_0xe611('0x24')]);}})[_0xe611('0x27')](function(_0x47bf08){logger['error'](_0xe611('0x1d'),_0x5262ec,_0x47bf08);_0x3100b2(_0x47bf08);});});}function respondWithStatusCode(_0x423fcc,_0x81ba48){_0x81ba48=_0x81ba48||0xcc;return function(_0x3c07f3){if(_0x3c07f3){return _0x423fcc[_0xe611('0x28')](_0x81ba48);}return _0x423fcc[_0xe611('0x29')](_0x81ba48)[_0xe611('0x2a')]();};}function respondWithResult(_0x54c6ad,_0xca091a){_0xca091a=_0xca091a||0xc8;return function(_0x54f012){if(_0x54f012){return _0x54c6ad[_0xe611('0x29')](_0xca091a)['json'](_0x54f012);}};}function respondWithFilteredResult(_0x5a9c9e,_0x353ff8){return function(_0x510105){if(_0x510105){var _0x3370c5=typeof _0x353ff8[_0xe611('0x2b')]==='undefined'&&typeof _0x353ff8[_0xe611('0x2c')]===_0xe611('0x2d');var _0x4564d4=_0x510105[_0xe611('0x2e')];var _0x50bde2=_0x3370c5?0x0:_0x353ff8['offset'];var _0x31dc6b=_0x3370c5?_0x510105[_0xe611('0x2e')]:_0x353ff8[_0xe611('0x2b')]+_0x353ff8[_0xe611('0x2c')];var _0x57d8f8;if(_0x31dc6b>=_0x4564d4){_0x31dc6b=_0x4564d4;_0x57d8f8=0xc8;}else{_0x57d8f8=0xce;}_0x5a9c9e[_0xe611('0x29')](_0x57d8f8);return _0x5a9c9e[_0xe611('0x2f')](_0xe611('0x30'),_0x50bde2+'-'+_0x31dc6b+'/'+_0x4564d4)[_0xe611('0x31')](_0x510105);}return null;};}function patchUpdates(_0x25321){return function(_0x1a4fef){try{jsonpatch[_0xe611('0x32')](_0x1a4fef,_0x25321,!![]);}catch(_0xea820d){return BPromise[_0xe611('0x33')](_0xea820d);}return _0x1a4fef['save']();};}function saveUpdates(_0x1e5e5e,_0x3f772f){return function(_0x44b4cd){if(_0x44b4cd){return _0x44b4cd[_0xe611('0x34')](_0x1e5e5e)[_0xe611('0x35')](function(_0xbd34e5){return _0xbd34e5;});}return null;};}function removeEntity(_0x854270,_0x4ce238){return function(_0x4fad39){if(_0x4fad39){return _0x4fad39[_0xe611('0x36')]()[_0xe611('0x35')](function(){var _0x128995=_0x4fad39[_0xe611('0x37')]({'plain':!![]});var _0x149f88='WhatsappAccounts';return db[_0xe611('0x38')]['destroy']({'where':{'type':_0x149f88,'resourceId':_0x128995['id']}})['then'](function(){return _0x4fad39;});})['then'](function(){_0x854270[_0xe611('0x29')](0xcc)[_0xe611('0x2a')]();});}};}function handleEntityNotFound(_0x36ce31,_0x26f08a){return function(_0x167820){if(!_0x167820){_0x36ce31['sendStatus'](0x194);}return _0x167820;};}function handleError(_0x2b16cf,_0x1ac3cb){_0x1ac3cb=_0x1ac3cb||0x1f4;return function(_0x4bdc90){logger[_0xe611('0x22')](_0x4bdc90[_0xe611('0x39')]);if(_0x4bdc90['name']){delete _0x4bdc90['name'];}_0x2b16cf[_0xe611('0x29')](_0x1ac3cb)[_0xe611('0x3a')](_0x4bdc90);};}exports['index']=function(_0x3de181,_0x3df141){var _0x170253={'include':[{'model':db[_0xe611('0x3b')],'as':_0xe611('0x3c')}]},_0x1972bc={},_0x3c21d4={'count':0x0,'rows':[]};var _0x553c1e=_['map'](db[_0xe611('0x3d')][_0xe611('0x3e')],function(_0x583fd4){return{'name':_0x583fd4[_0xe611('0x3f')],'type':_0x583fd4['type']['key']};});_0x1972bc['model']=_['map'](_0x553c1e,'name');_0x1972bc[_0xe611('0x40')]=_[_0xe611('0x41')](_0x3de181['query']);_0x1972bc[_0xe611('0x42')]=_['intersection'](_0x1972bc[_0xe611('0x43')],_0x1972bc[_0xe611('0x40')]);_0x170253['attributes']=_[_0xe611('0x44')](_0x1972bc['model'],qs[_0xe611('0x45')](_0x3de181[_0xe611('0x40')][_0xe611('0x45')]));_0x170253[_0xe611('0x46')]=_0x170253[_0xe611('0x46')][_0xe611('0x47')]?_0x170253[_0xe611('0x46')]:_0x1972bc[_0xe611('0x43')];if(!_0x3de181[_0xe611('0x40')][_0xe611('0x48')](_0xe611('0x49'))){_0x170253[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x3de181[_0xe611('0x40')][_0xe611('0x2c')]);_0x170253[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x3de181[_0xe611('0x40')]['offset']);}_0x170253[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x3de181[_0xe611('0x40')]['sort']);_0x170253[_0xe611('0x4c')]=qs['filters'](_[_0xe611('0x4d')](_0x3de181[_0xe611('0x40')],_0x1972bc[_0xe611('0x42')]),_0x553c1e);if(_0x3de181[_0xe611('0x40')][_0xe611('0x4e')]){_0x170253['where']=_[_0xe611('0x4f')](_0x170253[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x553c1e,function(_0x1421d1){if(_0x1421d1[_0xe611('0x51')]!==_0xe611('0x52')){var _0x19047d={};_0x19047d[_0x1421d1['name']]={'$like':'%'+_0x3de181['query'][_0xe611('0x4e')]+'%'};return _0x19047d;}})});}_0x170253=_['merge']({},_0x170253,_0x3de181['options']);var _0x28e707={'where':_0x170253[_0xe611('0x4c')]};return db[_0xe611('0x3d')][_0xe611('0x2e')](_0x28e707)[_0xe611('0x35')](function(_0x27e1b2){_0x3c21d4[_0xe611('0x2e')]=_0x27e1b2;if(_0x3de181[_0xe611('0x40')][_0xe611('0x53')]){_0x170253[_0xe611('0x54')]=[{'all':!![]}];}return db[_0xe611('0x3d')][_0xe611('0x55')](_0x170253);})[_0xe611('0x35')](function(_0x3bf104){_0x3c21d4[_0xe611('0x56')]=_0x3bf104;return _0x3c21d4;})[_0xe611('0x35')](respondWithFilteredResult(_0x3df141,_0x170253))[_0xe611('0x27')](handleError(_0x3df141,null));};exports[_0xe611('0x57')]=function(_0x50c470,_0x21cd6){var _0x416be2={'raw':![],'where':{'id':_0x50c470[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0x3b')],'as':'mandatoryDispositionPause'}]},_0x10029a={};_0x10029a[_0xe611('0x43')]=_[_0xe611('0x41')](db[_0xe611('0x3d')][_0xe611('0x3e')]);_0x10029a[_0xe611('0x40')]=_[_0xe611('0x41')](_0x50c470[_0xe611('0x40')]);_0x10029a[_0xe611('0x42')]=_[_0xe611('0x44')](_0x10029a[_0xe611('0x43')],_0x10029a[_0xe611('0x40')]);_0x416be2[_0xe611('0x46')]=_[_0xe611('0x44')](_0x10029a[_0xe611('0x43')],qs[_0xe611('0x45')](_0x50c470[_0xe611('0x40')][_0xe611('0x45')]));_0x416be2[_0xe611('0x46')]=_0x416be2['attributes'][_0xe611('0x47')]?_0x416be2[_0xe611('0x46')]:_0x10029a[_0xe611('0x43')];if(_0x50c470[_0xe611('0x40')][_0xe611('0x53')]){_0x416be2['include']=[{'all':!![]}];}_0x416be2=_[_0xe611('0x4f')]({},_0x416be2,_0x50c470[_0xe611('0x59')]);return db[_0xe611('0x3d')][_0xe611('0x5a')](_0x416be2)[_0xe611('0x35')](handleEntityNotFound(_0x21cd6,null))[_0xe611('0x35')](respondWithResult(_0x21cd6,null))[_0xe611('0x27')](handleError(_0x21cd6,null));};exports[_0xe611('0x5b')]=function(_0x474d1a,_0x58948e){return db[_0xe611('0x3d')][_0xe611('0x5b')](_0x474d1a['body'],{})[_0xe611('0x35')](function(_0x17c806){var _0x4740d3=_0x474d1a[_0xe611('0x5c')]['get']({'plain':!![]});if(!_0x4740d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4740d3['role']===_0xe611('0x5c')){var _0x507af1=_0x17c806['get']({'plain':!![]});var _0x15816b=_0xe611('0x5d');return db[_0xe611('0x5e')][_0xe611('0x5a')]({'where':{'name':_0x15816b,'userProfileId':_0x4740d3[_0xe611('0x5f')]},'raw':!![]})[_0xe611('0x35')](function(_0x44b5db){if(_0x44b5db&&_0x44b5db[_0xe611('0x60')]===0x0){return db['UserProfileResource'][_0xe611('0x5b')]({'name':_0x507af1[_0xe611('0x61')],'resourceId':_0x507af1['id'],'type':_0x44b5db[_0xe611('0x61')],'sectionId':_0x44b5db['id']},{})[_0xe611('0x35')](function(){return _0x17c806;});}else{return _0x17c806;}})['catch'](function(_0x4d1b19){logger[_0xe611('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d1b19);throw _0x4d1b19;});}return _0x17c806;})['then'](respondWithResult(_0x58948e,0xc9))[_0xe611('0x27')](handleError(_0x58948e,null));};exports[_0xe611('0x34')]=function(_0x50fd36,_0x37a2a7){if(_0x50fd36['body']['id']){delete _0x50fd36[_0xe611('0x62')]['id'];}return db[_0xe611('0x3d')]['find']({'where':{'id':_0x50fd36[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0x3b')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x37a2a7,null))[_0xe611('0x35')](saveUpdates(_0x50fd36[_0xe611('0x62')],null))[_0xe611('0x35')](respondWithResult(_0x37a2a7,null))[_0xe611('0x27')](handleError(_0x37a2a7,null));};exports[_0xe611('0x36')]=function(_0x4d09ba,_0xa1407c){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x4d09ba[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0xa1407c,null))[_0xe611('0x35')](removeEntity(_0xa1407c,null))['catch'](handleError(_0xa1407c,null));};exports['describe']=function(_0xb4eaaa,_0x13c568){return db['WhatsappAccount'][_0xe611('0x63')]()['then'](respondWithResult(_0x13c568,null))[_0xe611('0x27')](handleError(_0x13c568,null));};exports[_0xe611('0x64')]=function(_0x1fd5ca,_0x4cba71,_0x895399){if(_0x1fd5ca[_0xe611('0x62')]['id']){delete _0x1fd5ca[_0xe611('0x62')]['id'];}return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0x1fd5ca[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x4cba71,null))['then'](function(_0x4bdb85){if(_0x4bdb85){_0x1fd5ca[_0xe611('0x62')][_0xe611('0x65')]=_0x4bdb85['id'];return db[_0xe611('0x66')][_0xe611('0x5b')](_0x1fd5ca[_0xe611('0x62')]);}})[_0xe611('0x35')](respondWithResult(_0x4cba71,null))[_0xe611('0x27')](handleError(_0x4cba71,null));};exports['getDispositions']=function(_0x59c818,_0xf52f99,_0x5a1c08){var _0x59a3ca={'raw':![],'where':{}};var _0x19caa2={};var _0x1b264f={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x59c818[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0xf52f99,null))[_0xe611('0x35')](function(_0x4a1ee7){if(_0x4a1ee7){_0x19caa2['model']=_[_0xe611('0x41')](db[_0xe611('0x66')][_0xe611('0x3e')]);_0x19caa2[_0xe611('0x40')]=_[_0xe611('0x41')](_0x59c818[_0xe611('0x40')]);_0x19caa2[_0xe611('0x42')]=_[_0xe611('0x44')](_0x19caa2[_0xe611('0x43')],_0x19caa2[_0xe611('0x40')]);_0x59a3ca['attributes']=_['intersection'](_0x19caa2[_0xe611('0x43')],qs['fields'](_0x59c818[_0xe611('0x40')]['fields']));_0x59a3ca[_0xe611('0x46')]=_0x59a3ca[_0xe611('0x46')]['length']?_0x59a3ca['attributes']:_0x19caa2[_0xe611('0x43')];if(!_0x59c818[_0xe611('0x40')]['hasOwnProperty'](_0xe611('0x49'))){_0x59a3ca[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x59c818[_0xe611('0x40')][_0xe611('0x2c')]);_0x59a3ca[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x59c818[_0xe611('0x40')][_0xe611('0x2b')]);}_0x59a3ca[_0xe611('0x4a')]=qs['sort'](_0x59c818[_0xe611('0x40')][_0xe611('0x4b')]);_0x59a3ca[_0xe611('0x4c')]=qs[_0xe611('0x42')](_[_0xe611('0x4d')](_0x59c818[_0xe611('0x40')],_0x19caa2[_0xe611('0x42')]));_0x59a3ca['where'][_0xe611('0x65')]=_0x4a1ee7['id'];if(_0x59c818['query']['filter']){_0x59a3ca[_0xe611('0x4c')]=_[_0xe611('0x4f')](_0x59a3ca[_0xe611('0x4c')],{'$or':_['map'](_0x59a3ca[_0xe611('0x46')],function(_0x54b5eb){var _0xae0093={};_0xae0093[_0x54b5eb]={'$like':'%'+_0x59c818[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0xae0093;})});}_0x59a3ca=_[_0xe611('0x4f')]({},_0x59a3ca,_0x59c818[_0xe611('0x59')]);return db[_0xe611('0x66')][_0xe611('0x2e')]({'where':_0x59a3ca[_0xe611('0x4c')]})[_0xe611('0x35')](function(_0x3baeb3){_0x1b264f[_0xe611('0x2e')]=_0x3baeb3;if(_0x59c818[_0xe611('0x40')][_0xe611('0x53')]){_0x59a3ca[_0xe611('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xe611('0x55')](_0x59a3ca);})[_0xe611('0x35')](function(_0x30cdc3){_0x1b264f[_0xe611('0x56')]=_0x30cdc3;return _0x1b264f;});}})['then'](respondWithFilteredResult(_0xf52f99,_0x59a3ca))['catch'](handleError(_0xf52f99,null));};exports[_0xe611('0x67')]=function(_0x26a097,_0x3cd5ae,_0x3fa6f1){return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0x26a097[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x3cd5ae,null))[_0xe611('0x35')](function(_0x120cbc){if(_0x120cbc){return _0x120cbc['removeDispositions'](_0x26a097[_0xe611('0x40')][_0xe611('0x68')]);}})[_0xe611('0x35')](respondWithStatusCode(_0x3cd5ae,null))[_0xe611('0x27')](handleError(_0x3cd5ae,null));};exports['addAnswer']=function(_0x2cfac4,_0x12874e,_0x1d1e53){if(_0x2cfac4['body']['id']){delete _0x2cfac4[_0xe611('0x62')]['id'];}return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x2cfac4[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x12874e,null))[_0xe611('0x35')](function(_0x54d5ca){if(_0x54d5ca){_0x2cfac4[_0xe611('0x62')][_0xe611('0x65')]=_0x54d5ca['id'];return db[_0xe611('0x69')][_0xe611('0x5b')](_0x2cfac4[_0xe611('0x62')]);}})[_0xe611('0x35')](respondWithResult(_0x12874e,null))['catch'](handleError(_0x12874e,null));};exports[_0xe611('0x6a')]=function(_0x204cbd,_0x32f2a4,_0x1a0965){var _0x118f46={'raw':![],'where':{}};var _0x1a980d={};var _0x21fd48={'count':0x0,'rows':[]};return db[_0xe611('0x3d')]['findOne']({'where':{'id':_0x204cbd[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x32f2a4,null))[_0xe611('0x35')](function(_0x294821){if(_0x294821){_0x1a980d['model']=_['keys'](db[_0xe611('0x69')][_0xe611('0x3e')]);_0x1a980d[_0xe611('0x40')]=_[_0xe611('0x41')](_0x204cbd[_0xe611('0x40')]);_0x1a980d['filters']=_['intersection'](_0x1a980d[_0xe611('0x43')],_0x1a980d[_0xe611('0x40')]);_0x118f46[_0xe611('0x46')]=_[_0xe611('0x44')](_0x1a980d[_0xe611('0x43')],qs[_0xe611('0x45')](_0x204cbd[_0xe611('0x40')][_0xe611('0x45')]));_0x118f46['attributes']=_0x118f46[_0xe611('0x46')][_0xe611('0x47')]?_0x118f46[_0xe611('0x46')]:_0x1a980d[_0xe611('0x43')];if(!_0x204cbd[_0xe611('0x40')]['hasOwnProperty']('nolimit')){_0x118f46[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x204cbd[_0xe611('0x40')][_0xe611('0x2c')]);_0x118f46[_0xe611('0x2b')]=qs[_0xe611('0x2b')](_0x204cbd[_0xe611('0x40')]['offset']);}_0x118f46[_0xe611('0x4a')]=qs['sort'](_0x204cbd[_0xe611('0x40')][_0xe611('0x4b')]);_0x118f46[_0xe611('0x4c')]=qs['filters'](_[_0xe611('0x4d')](_0x204cbd[_0xe611('0x40')],_0x1a980d[_0xe611('0x42')]));_0x118f46[_0xe611('0x4c')][_0xe611('0x65')]=_0x294821['id'];if(_0x204cbd['query'][_0xe611('0x4e')]){_0x118f46[_0xe611('0x4c')]=_['merge'](_0x118f46[_0xe611('0x4c')],{'$or':_['map'](_0x118f46[_0xe611('0x46')],function(_0x13f879){var _0x1ed2e5={};_0x1ed2e5[_0x13f879]={'$like':'%'+_0x204cbd[_0xe611('0x40')]['filter']+'%'};return _0x1ed2e5;})});}_0x118f46=_['merge']({},_0x118f46,_0x204cbd[_0xe611('0x59')]);return db[_0xe611('0x69')][_0xe611('0x2e')]({'where':_0x118f46[_0xe611('0x4c')]})[_0xe611('0x35')](function(_0x246d01){_0x21fd48[_0xe611('0x2e')]=_0x246d01;if(_0x204cbd[_0xe611('0x40')][_0xe611('0x53')]){_0x118f46[_0xe611('0x54')]=[{'all':!![]}];}return db[_0xe611('0x69')][_0xe611('0x55')](_0x118f46);})[_0xe611('0x35')](function(_0x42aa85){_0x21fd48[_0xe611('0x56')]=_0x42aa85;return _0x21fd48;});}})[_0xe611('0x35')](respondWithFilteredResult(_0x32f2a4,_0x118f46))['catch'](handleError(_0x32f2a4,null));};exports[_0xe611('0x6b')]=function(_0x3255a4,_0x116af8,_0x5a74e7){return db[_0xe611('0x3d')]['find']({'where':{'id':_0x3255a4['params']['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x116af8,null))[_0xe611('0x35')](function(_0x247019){if(_0x247019){return _0x247019[_0xe611('0x6b')](_0x3255a4[_0xe611('0x40')][_0xe611('0x68')]);}})[_0xe611('0x35')](respondWithStatusCode(_0x116af8,null))[_0xe611('0x27')](handleError(_0x116af8,null));};exports[_0xe611('0x6c')]=function(_0x49e695,_0x18ff00,_0x4f7854){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x49e695[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x18ff00,null))[_0xe611('0x35')](function(_0x1036f3){if(_0x1036f3){return _0x1036f3[_0xe611('0x6c')](_0x49e695[_0xe611('0x62')][_0xe611('0x68')],_[_0xe611('0x6d')](_0x49e695[_0xe611('0x62')],[_0xe611('0x68'),'id'])||{})[_0xe611('0x6e')](function(_0x5463e9){for(var _0x364376=0x0;_0x364376<_0x49e695[_0xe611('0x62')][_0xe611('0x68')][_0xe611('0x47')];_0x364376+=0x1){socket[_0xe611('0x6f')]('userWhatsappAccount:save',{'UserId':Number(_0x49e695['body'][_0xe611('0x68')][_0x364376]),'WhatsappAccountId':Number(_0x49e695[_0xe611('0x58')]['id'])});}return _0x5463e9;});}})[_0xe611('0x35')](respondWithResult(_0x18ff00,null))[_0xe611('0x27')](handleError(_0x18ff00,null));};exports[_0xe611('0x70')]=function(_0x173699,_0x26e22b,_0x2933f3){return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x173699[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x26e22b,null))[_0xe611('0x35')](function(_0x5a4b4d){if(_0x5a4b4d){return _0x5a4b4d['removeAgents'](_0x173699[_0xe611('0x40')]['ids'])[_0xe611('0x35')](function(){if(_['isArray'](_0x173699[_0xe611('0x40')][_0xe611('0x68')])){for(var _0x4196b8=0x0;_0x4196b8<_0x173699[_0xe611('0x40')][_0xe611('0x68')][_0xe611('0x47')];_0x4196b8+=0x1){socket[_0xe611('0x6f')]('userWhatsappAccount:remove',{'UserId':Number(_0x173699[_0xe611('0x40')][_0xe611('0x68')][_0x4196b8]),'WhatsappAccountId':Number(_0x173699[_0xe611('0x58')]['id'])});}}else{socket[_0xe611('0x6f')](_0xe611('0x71'),{'UserId':Number(_0x173699['query'][_0xe611('0x68')]),'WhatsappAccountId':Number(_0x173699[_0xe611('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x26e22b,null))['catch'](handleError(_0x26e22b,null));};exports[_0xe611('0x72')]=function(_0x1004b9,_0x3132d4,_0x55cc52){var _0x2b38c2={};var _0x450835={};var _0x1e158b;var _0xa68bfa;return db['WhatsappAccount'][_0xe611('0x73')]({'where':{'id':_0x1004b9[_0xe611('0x58')]['id']}})[_0xe611('0x35')](handleEntityNotFound(_0x3132d4,null))['then'](function(_0x62346){if(_0x62346){_0x1e158b=_0x62346;_0x450835['model']=_[_0xe611('0x41')](db[_0xe611('0x74')][_0xe611('0x3e')]);_0x450835[_0xe611('0x40')]=_[_0xe611('0x41')](_0x1004b9[_0xe611('0x40')]);_0x450835[_0xe611('0x42')]=_[_0xe611('0x44')](_0x450835[_0xe611('0x43')],_0x450835['query']);_0x2b38c2[_0xe611('0x46')]=_['intersection'](_0x450835[_0xe611('0x43')],qs['fields'](_0x1004b9[_0xe611('0x40')][_0xe611('0x45')]));_0x2b38c2[_0xe611('0x46')]=_0x2b38c2[_0xe611('0x46')][_0xe611('0x47')]?_0x2b38c2[_0xe611('0x46')]:_0x450835[_0xe611('0x43')];_0x2b38c2[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x1004b9[_0xe611('0x40')]['sort']);_0x2b38c2[_0xe611('0x4c')]=qs[_0xe611('0x42')](_[_0xe611('0x4d')](_0x1004b9['query'],_0x450835['filters']));if(_0x1004b9[_0xe611('0x40')][_0xe611('0x4e')]){_0x2b38c2['where']=_[_0xe611('0x4f')](_0x2b38c2[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x2b38c2[_0xe611('0x46')],function(_0x3d12c7){var _0x304543={};_0x304543[_0x3d12c7]={'$like':'%'+_0x1004b9[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0x304543;})});}_0x2b38c2=_[_0xe611('0x4f')]({},_0x2b38c2,_0x1004b9[_0xe611('0x59')]);return _0x1e158b['getAgents'](_0x2b38c2);}})[_0xe611('0x35')](function(_0x41702a){if(_0x41702a){_0xa68bfa=_0x41702a[_0xe611('0x47')];if(!_0x1004b9[_0xe611('0x40')]['hasOwnProperty']('nolimit')){_0x2b38c2[_0xe611('0x2c')]=qs[_0xe611('0x2c')](_0x1004b9[_0xe611('0x40')][_0xe611('0x2c')]);_0x2b38c2['offset']=qs[_0xe611('0x2b')](_0x1004b9[_0xe611('0x40')][_0xe611('0x2b')]);}return _0x1e158b[_0xe611('0x72')](_0x2b38c2);}})[_0xe611('0x35')](function(_0x1d783d){if(_0x1d783d){return _0x1d783d?{'count':_0xa68bfa,'rows':_0x1d783d}:null;}})[_0xe611('0x35')](respondWithResult(_0x3132d4,null))[_0xe611('0x27')](handleError(_0x3132d4,null));};exports['addApplications']=function(_0x209349,_0x3a831b){var _0xf9f323=_0x209349[_0xe611('0x58')]['id'];var _0x15045b=_0x209349['body'];var _0x172bab=0xc8;var _0x2f4431=null;return db[_0xe611('0x75')]['transaction']({'isolationLevel':db[_0xe611('0x75')]['Transaction'][_0xe611('0x76')][_0xe611('0x77')]},function(_0x43bf04){return db[_0xe611('0x3d')][_0xe611('0x73')]({'where':{'id':_0xf9f323},'transaction':_0x43bf04})[_0xe611('0x35')](function(_0x3e60fe){if(_0x3e60fe){return db[_0xe611('0x78')][_0xe611('0x36')]({'where':{'WhatsappAccountId':_0xf9f323},'transaction':_0x43bf04})[_0xe611('0x35')](function(){var _0x2b2922=_[_0xe611('0x50')](_0x15045b,function(_0x2becf0){_0x2becf0[_0xe611('0x65')]=_0xf9f323;return _0x2becf0;});return db[_0xe611('0x78')][_0xe611('0x79')](_0x2b2922,{'transaction':_0x43bf04});});}else{_0x172bab=0x194;_0x2f4431=[];}});})['then'](function(){if(_0x172bab!==0x194){return db[_0xe611('0x78')][_0xe611('0x7a')]({'where':{'WhatsappAccountId':_0xf9f323},'order':_0xe611('0x7b')})[_0xe611('0x35')](function(_0x1d1bc5){_0x2f4431=_0x1d1bc5;});}})['catch'](function(_0x34e3d9){_0x172bab=0x1f4;logger['error'](_0x34e3d9[_0xe611('0x39')]);if(_0x34e3d9[_0xe611('0x61')]){delete _0x34e3d9[_0xe611('0x61')];}_0x2f4431=_0x34e3d9;})[_0xe611('0x7c')](function(){if(_0x2f4431===null){_0x3a831b[_0xe611('0x28')](_0x172bab);}else{if(_0x172bab===0x1f4){_0x3a831b['status'](_0x172bab)[_0xe611('0x3a')](_0x2f4431);}else{_0x3a831b[_0xe611('0x29')](_0x172bab)[_0xe611('0x31')](_0x2f4431);}}});};exports[_0xe611('0x7d')]=function(_0x244fae,_0x16abe0,_0x334197){var _0x3df54c={};var _0x6f656d={};var _0x5eed29;var _0x3d24ed;return db[_0xe611('0x3d')][_0xe611('0x73')]({'where':{'id':_0x244fae[_0xe611('0x58')]['id']}})['then'](handleEntityNotFound(_0x16abe0,null))['then'](function(_0x142af5){if(_0x142af5){_0x5eed29=_0x142af5;_0x6f656d[_0xe611('0x43')]=_[_0xe611('0x41')](db['WhatsappApplication']['rawAttributes']);_0x6f656d['query']=_[_0xe611('0x41')](_0x244fae[_0xe611('0x40')]);_0x6f656d[_0xe611('0x42')]=_[_0xe611('0x44')](_0x6f656d['model'],_0x6f656d['query']);_0x3df54c[_0xe611('0x46')]=_[_0xe611('0x44')](_0x6f656d['model'],qs['fields'](_0x244fae[_0xe611('0x40')][_0xe611('0x45')]));_0x3df54c[_0xe611('0x46')]=_0x3df54c[_0xe611('0x46')][_0xe611('0x47')]?_0x3df54c['attributes']:_0x6f656d['model'];_0x3df54c[_0xe611('0x4a')]=qs[_0xe611('0x4b')](_0x244fae[_0xe611('0x40')][_0xe611('0x4b')]);_0x3df54c['where']=qs[_0xe611('0x42')](_['pick'](_0x244fae['query'],_0x6f656d['filters']));if(_0x244fae[_0xe611('0x40')]['filter']){_0x3df54c['where']=_[_0xe611('0x4f')](_0x3df54c[_0xe611('0x4c')],{'$or':_[_0xe611('0x50')](_0x3df54c['attributes'],function(_0xfa75b3){var _0x3fd0f6={};_0x3fd0f6[_0xfa75b3]={'$like':'%'+_0x244fae[_0xe611('0x40')][_0xe611('0x4e')]+'%'};return _0x3fd0f6;})});}_0x3df54c=_[_0xe611('0x4f')]({},_0x3df54c,_0x244fae[_0xe611('0x59')]);return _0x5eed29[_0xe611('0x7d')](_0x3df54c);}})[_0xe611('0x35')](function(_0x351e2b){if(_0x351e2b){_0x3d24ed=_0x351e2b[_0xe611('0x47')];if(!_0x244fae[_0xe611('0x40')][_0xe611('0x48')](_0xe611('0x49'))){_0x3df54c['limit']=qs[_0xe611('0x2c')](_0x244fae[_0xe611('0x40')]['limit']);_0x3df54c['offset']=qs[_0xe611('0x2b')](_0x244fae[_0xe611('0x40')][_0xe611('0x2b')]);}return _0x5eed29[_0xe611('0x7d')](_0x3df54c);}})['then'](function(_0x32d44e){if(_0x32d44e){return _0x32d44e?{'count':_0x3d24ed,'rows':_0x32d44e}:null;}})[_0xe611('0x35')](respondWithResult(_0x16abe0,null))[_0xe611('0x27')](handleError(_0x16abe0,null));};exports[_0xe611('0x7e')]=function(_0x2bbe21,_0x4e77d2,_0x1fb322){var _0x296c7c={'channel':_0xe611('0x7f')};var _0xa27c85=[];var _0x1441c1=[];var _0x471ac8={};return db[_0xe611('0x3d')][_0xe611('0x5a')]({'where':{'id':_0x2bbe21[_0xe611('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xe611('0x80')}]})['then'](handleEntityNotFound(_0x4e77d2,null))['then'](function(_0x1c3b93){_0x296c7c[_0xe611('0x81')]=_0x1c3b93;if(_0x296c7c['account']&&_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]==='sinch'&&_0x2bbe21[_0xe611('0x62')]['statuses']){if(_0x2bbe21['body'][_0xe611('0x82')]['length']===0x0)return;if(_0x2bbe21['body']['statuses'][0x0]['state']!==_0xe611('0x83'))return;return db[_0xe611('0x84')]['update']({'read':!![],'readAt':_0x2bbe21[_0xe611('0x62')][_0xe611('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x2bbe21[_0xe611('0x62')]['statuses'][0x0][_0xe611('0x85')]},'individualHooks':!![]})[_0xe611('0x35')](function(_0x1af131){return _0x4e77d2[_0xe611('0x29')](0xc8)[_0xe611('0x31')](_0x1af131);});}_0x296c7c['applications']=_['orderBy'](_0x1c3b93[_0xe611('0x80')],['priority'],[_0xe611('0x86')]);if(_0x296c7c[_0xe611('0x81')][_0xe611('0x80')]){delete _0x296c7c['account'][_0xe611('0x80')];}return db[_0xe611('0x87')]['describe']()[_0xe611('0x35')](function(_0x2b23ce){if(!_0x2b23ce){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x8a'));}_0xa27c85=_[_0xe611('0x8b')](_[_0xe611('0x41')](_0x2b23ce),[_0xe611('0x8c'),_0xe611('0x8d')]);_0x1441c1=_[_0xe611('0x8b')](_[_0xe611('0x41')](_0x2b23ce),[_0xe611('0x8c'),_0xe611('0x8d'),_0xe611('0x8e'),_0xe611('0x8f')]);_0x296c7c[_0xe611('0x62')]={'mapKey':_0xe611('0x90')};if(_0x296c7c[_0xe611('0x81')]&&_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]===_0xe611('0x91')){_0x296c7c['body'][_0xe611('0x92')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x93')][_0xe611('0x94')](_0xe611('0x95'),'');_0x296c7c[_0xe611('0x62')]['body']=_0x2bbe21[_0xe611('0x62')][_0xe611('0x96')];_0x296c7c[_0xe611('0x62')]['messageId']=_0x2bbe21[_0xe611('0x62')][_0xe611('0x97')];}if(_0x296c7c[_0xe611('0x81')]&&_0x296c7c[_0xe611('0x81')]['type']===_0xe611('0x98')){_0x296c7c['body'][_0xe611('0x92')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0][_0xe611('0x92')];_0x296c7c[_0xe611('0x62')][_0xe611('0x62')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0]['message']['body'];_0x296c7c[_0xe611('0x62')][_0xe611('0x9a')]=_0x2bbe21[_0xe611('0x62')][_0xe611('0x99')][0x0][_0xe611('0x85')];}if(_0x296c7c[_0xe611('0x62')]['id']){delete _0x296c7c[_0xe611('0x62')]['id'];}if(_[_0xe611('0x9b')](_0x296c7c[_0xe611('0x62')][_0xe611('0x92')])){throw new db[(_0xe611('0x88'))]['ValidationError'](_0xe611('0x9c'));}if(_[_0xe611('0x9b')](_0x296c7c['body']['body'])||_0x296c7c[_0xe611('0x62')][_0xe611('0x62')]===''){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x9d'));}if(_[_0xe611('0x9b')](_0x296c7c['body']['mapKey'])){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0x9e')+_0x1441c1);}if(!_[_0xe611('0x9f')](_0x1441c1,_0x296c7c[_0xe611('0x62')][_0xe611('0xa0')])){throw new db[(_0xe611('0x88'))][(_0xe611('0x89'))](_0xe611('0xa1')+_0x1441c1);}_0x471ac8[_0x296c7c[_0xe611('0x62')][_0xe611('0xa0')]]=_0x296c7c[_0xe611('0x62')]['from'];return db[_0xe611('0xa2')]['find']({'where':{'id':_0x296c7c[_0xe611('0x81')][_0xe611('0x8f')]},'include':[{'model':db[_0xe611('0x87')],'as':_0xe611('0xa3'),'where':_0x471ac8,'limit':0x1,'order':[[_0xe611('0x8d'),_0xe611('0xa4')]]}]});})['then'](handleEntityNotFound(_0x4e77d2,null))[_0xe611('0x35')](function(_0xcffd3a){if(_0xcffd3a){_0x296c7c[_0xe611('0xa5')]=_['omit'](_0xcffd3a,['Contacts']);if(_0xcffd3a[_0xe611('0xa3')]['length']){return _0xcffd3a['Contacts'][0x0];}var _0x4f79dd=_[_0xe611('0xa6')](_0x296c7c[_0xe611('0x62')],{'firstName':_0x296c7c['body'][_0xe611('0x92')],'ListId':_0xcffd3a['id']});_0x4f79dd[_0x296c7c['body'][_0xe611('0xa0')]]=_0x296c7c['body'][_0xe611('0x92')];return db[_0xe611('0x87')][_0xe611('0x5b')](_0x4f79dd,{'fields':_0xa27c85,'raw':!![]});}})[_0xe611('0x35')](handleEntityNotFound(_0x4e77d2,null))['then'](function(_0x49124e){if(_0x49124e){_0x296c7c[_0xe611('0xa7')]=_0x49124e;var _0x25fb6c={'ContactId':_0x49124e['id'],'phone':_0x296c7c[_0xe611('0x62')][_0xe611('0x92')],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id']};var _0x3f7d56={'ContactId':_0x49124e['id'],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id'],'closed':![]};return db[_0xe611('0xa8')][_0xe611('0x5a')]({'where':_0x3f7d56})[_0xe611('0x35')](function(_0x381601){if(_0x381601){return[_0x381601,![]];}return db[_0xe611('0xa8')][_0xe611('0x5b')](_0x25fb6c)[_0xe611('0x35')](function(_0x31ae66){return[_0x31ae66,!![]];});});}})[_0xe611('0x6e')](function(_0x43fec9,_0x226669){_0x296c7c['interaction']=_0x43fec9['get']({'plain':!![]});_0x296c7c['interaction']['created']=![];if(_0x226669){if(_0x296c7c[_0xe611('0x81')][_0xe611('0xa9')]){_0x296c7c[_0xe611('0xaa')][_0xe611('0xab')]({'id':0x0,'priority':_0x296c7c['applications'][_0xe611('0x47')]+0x1,'app':'close','appdata':_0xe611('0xac'),'interval':_0xe611('0xad')});}_0x296c7c[_0xe611('0xae')][_0xe611('0xaf')]=!![];}return db[_0xe611('0x84')][_0xe611('0x5b')]({'phone':_0x296c7c[_0xe611('0x62')]['from'],'messageId':_0x296c7c[_0xe611('0x62')]['messageId'],'body':_0x296c7c[_0xe611('0x62')][_0xe611('0x62')],'WhatsappAccountId':_0x2bbe21[_0xe611('0x58')]['id'],'WhatsappInteractionId':_0x43fec9['id'],'direction':'in','ContactId':_0x43fec9[_0xe611('0xb0')],'AttachmentId':_0x296c7c[_0xe611('0x62')][_0xe611('0xb1')]});})['then'](function(_0x454be7){_0x296c7c[_0xe611('0x24')]=_0x454be7;if(_0x296c7c[_0xe611('0xae')][_0xe611('0xb2')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x296c7c[_0xe611('0xae')]['UserId']}})[_0xe611('0x35')](function(_0x163fad){if(_0x163fad){_0x296c7c[_0xe611('0xaa')][_0xe611('0xb3')]({'id':0x0,'priority':0x0,'app':_0xe611('0xb4'),'appdata':_0x163fad['name']+','+(_0x296c7c[_0xe611('0x81')][_0xe611('0xb5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xe611('0xb6'),_0xe611('0xb7'),_0x296c7c);});}return respondWithRpcPromise(_0xe611('0xb6'),_0xe611('0xb7'),_0x296c7c);})[_0xe611('0x35')](function(_0x3f5a7d){if(_0x3f5a7d){var _0x5a161b=0xc8;var _0x12767e=_0xe611('0xb8');logger[_0xe611('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x12767e,_0x5a161b,_0xe611('0xb9'));logger[_0xe611('0x1f')](_0xe611('0xba'),_0x12767e,_0x5a161b,_0xe611('0xb9'),JSON[_0xe611('0x21')](_0x3f5a7d));if(_0x296c7c[_0xe611('0x81')][_0xe611('0x51')]===_0xe611('0x91')){return _0x4e77d2[_0xe611('0x29')](_0x5a161b)[_0xe611('0x2f')](_0xe611('0xbb'),'text/xml')[_0xe611('0x3a')](_0xe611('0xbc'));}else{return _0x4e77d2['status'](_0x5a161b)[_0xe611('0x31')](_0x3f5a7d);}}});})[_0xe611('0x27')](handleError(_0x4e77d2,null));};exports[_0xe611('0x3a')]=function(_0xa619f3,_0x1edcc5,_0x2c2bd3){var _0x1d9a74,_0x25fb2f,_0x88c144;if(_[_0xe611('0x9b')](_0xa619f3[_0xe611('0x62')][_0xe611('0x62')])||_0xa619f3[_0xe611('0x62')][_0xe611('0x62')]===''){throw new db['Sequelize'][(_0xe611('0x89'))](_0xe611('0x9d'));}if(_['isNil'](_0xa619f3[_0xe611('0x62')]['to'])){throw new db[(_0xe611('0x88'))]['ValidationError'](_0xe611('0xbd'));}_0x1d9a74=_0xa619f3[_0xe611('0x62')]['to'];return db['WhatsappAccount'][_0xe611('0x5a')]({'where':{'id':_0xa619f3[_0xe611('0x58')]['id']},'include':[{'model':db[_0xe611('0xa2')],'as':_0xe611('0xbe'),'include':[{'model':db[_0xe611('0x87')],'as':'Contacts','where':{'mobile':_0x1d9a74},'limit':0x1,'order':[[_0xe611('0x8d'),_0xe611('0xa4')]]}]}]})[_0xe611('0x35')](handleEntityNotFound(_0x1edcc5,null))[_0xe611('0x35')](function(_0x50de72){if(_0x50de72&&_0x50de72['List']){_0x25fb2f=_0x50de72['get']({'plain':!![]});if(_0x25fb2f['List']&&_0x25fb2f['List'][_0xe611('0xa3')][_0xe611('0x47')]){return _0x25fb2f[_0xe611('0xbe')][_0xe611('0xa3')][0x0];}return db[_0xe611('0x87')][_0xe611('0x5b')](_['defaults'](_0xa619f3[_0xe611('0x62')],{'firstName':_0x1d9a74,'mobile':_0x1d9a74,'phone':_0x1d9a74,'ListId':_0x25fb2f['ListId']}));}})['then'](handleEntityNotFound(_0x1edcc5,null))[_0xe611('0x35')](function(_0x560c31){if(_0x560c31){_0x88c144=_0x560c31;return db[_0xe611('0xa8')][_0xe611('0x5a')]({'where':{'ContactId':_0x88c144['id'],'closed':![],'WhatsappAccountId':_0x25fb2f['id']}})['then'](function(_0x165eb8){if(_0x165eb8){return[_0x165eb8,![]];}return db[_0xe611('0xa8')][_0xe611('0x5b')]({'UserId':_0xa619f3[_0xe611('0x5c')]['id'],'ContactId':_0x88c144['id'],'WhatsappAccountId':_0x25fb2f['id'],'phone':_0x1d9a74,'firstMsgDirection':'out','Messages':[_[_0xe611('0x4f')](_0xa619f3[_0xe611('0x62')],{'read':![],'body':_0xa619f3[_0xe611('0x62')][_0xe611('0x62')],'phone':_0x1d9a74,'WhatsappAccountId':_0x25fb2f['id'],'UserId':_0xa619f3['user']['id'],'ContactId':_0x88c144['id']})]},{'include':[{'model':db[_0xe611('0x84')],'as':_0xe611('0xbf')}]})[_0xe611('0x35')](function(_0x2f69d0){return[_0x2f69d0,!![]];});});}})[_0xe611('0x6e')](function(_0x2870f3,_0x53ef81){if(_0x53ef81){return _0x2870f3;}return db[_0xe611('0x84')][_0xe611('0x5b')](_[_0xe611('0x4f')](_0xa619f3[_0xe611('0x62')],{'read':![],'body':_0xa619f3[_0xe611('0x62')][_0xe611('0x62')],'phone':_0x1d9a74,'WhatsappAccountId':_0x25fb2f['id'],'WhatsappInteractionId':_0x2870f3['id'],'UserId':_0xa619f3['user']['id'],'ContactId':_0x88c144['id']}))[_0xe611('0x35')](function(_0x4cd163){_0x2870f3['dataValues'][_0xe611('0xbf')]=[];_0x2870f3[_0xe611('0xc0')][_0xe611('0xbf')][_0xe611('0xab')](_0x4cd163[_0xe611('0xc0')]);return _0x2870f3;});})[_0xe611('0x35')](respondWithResult(_0x1edcc5,null))[_0xe611('0x27')](handleError(_0x1edcc5,null));}; \ No newline at end of file +var _0x0c81=['index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','describe','Disposition','getDispositions','findOne','nolimit','WhatsappAccountId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','status','getApplications','Applications','account','sinch','statuses','timestamp','message_id','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','From','Body','messageId','from','notifications','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','list','contact','WhatsappInteraction','interaction','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','jayson/promise','request','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','stack','name'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x0c81,0x83));var _0x10c8=function(_0x19a4ae,_0x21054a){_0x19a4ae=_0x19a4ae-0x0;var _0x13b6c3=_0x0c81[_0x19a4ae];return _0x13b6c3;};'use strict';var emlformat=require(_0x10c8('0x0'));var rimraf=require(_0x10c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x10c8('0x2'));var rp=require(_0x10c8('0x3'));var moment=require(_0x10c8('0x4'));var BPromise=require(_0x10c8('0x5'));var Mustache=require(_0x10c8('0x6'));var util=require('util');var path=require(_0x10c8('0x7'));var sox=require(_0x10c8('0x8'));var csv=require('to-csv');var ejs=require(_0x10c8('0x9'));var fs=require('fs');var fs_extra=require(_0x10c8('0xa'));var _=require(_0x10c8('0xb'));var squel=require(_0x10c8('0xc'));var crypto=require(_0x10c8('0xd'));var jsforce=require(_0x10c8('0xe'));var deskjs=require(_0x10c8('0xf'));var toCsv=require(_0x10c8('0x10'));var querystring=require(_0x10c8('0x11'));var Papa=require(_0x10c8('0x12'));var Redis=require(_0x10c8('0x13'));var authService=require(_0x10c8('0x14'));var qs=require(_0x10c8('0x15'));var as=require(_0x10c8('0x16'));var hardwareService=require(_0x10c8('0x17'));var logger=require(_0x10c8('0x18'))(_0x10c8('0x19'));var utils=require(_0x10c8('0x1a'));var config=require(_0x10c8('0x1b'));var licenseUtil=require(_0x10c8('0x1c'));var db=require(_0x10c8('0x1d'))['db'];config[_0x10c8('0x1e')]=_[_0x10c8('0x1f')](config[_0x10c8('0x1e')],{'host':_0x10c8('0x20'),'port':0x18eb});var socket=require(_0x10c8('0x21'))(new Redis(config[_0x10c8('0x1e')]));require(_0x10c8('0x22'))['register'](socket);var jayson=require(_0x10c8('0x23'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x39f2e0,_0x5a16df,_0x7464f0,_0x2450f1){return new BPromise(function(_0x391635,_0x5b9845){var _0x205452=_0x2450f1||client;return _0x205452[_0x10c8('0x24')](_0x39f2e0,_0x7464f0)['then'](function(_0x18060c){logger[_0x10c8('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x5a16df,_0x10c8('0x26'));logger[_0x10c8('0x27')](_0x10c8('0x28'),_0x5a16df,_0x10c8('0x26'),JSON[_0x10c8('0x29')](_0x18060c));if(_0x18060c[_0x10c8('0x2a')]){if(_0x18060c[_0x10c8('0x2a')][_0x10c8('0x2b')]===0x1f4){logger[_0x10c8('0x2a')]('WhatsappAccount,\x20%s,\x20%s',_0x5a16df,_0x18060c[_0x10c8('0x2a')][_0x10c8('0x2c')]);return _0x5b9845(_0x18060c[_0x10c8('0x2a')][_0x10c8('0x2c')]);}logger[_0x10c8('0x2a')](_0x10c8('0x2d'),_0x5a16df,_0x18060c['error'][_0x10c8('0x2c')]);return _0x391635(_0x18060c[_0x10c8('0x2a')]['message']);}else{logger[_0x10c8('0x25')]('WhatsappAccount,\x20%s,\x20%s',_0x5a16df,_0x10c8('0x26'));_0x391635(_0x18060c[_0x10c8('0x2e')][_0x10c8('0x2c')]);}})[_0x10c8('0x2f')](function(_0x4433e7){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5a16df,_0x4433e7);_0x5b9845(_0x4433e7);});});}function respondWithStatusCode(_0x1233f3,_0x10f6d9){_0x10f6d9=_0x10f6d9||0xcc;return function(_0x5cf425){if(_0x5cf425){return _0x1233f3[_0x10c8('0x30')](_0x10f6d9);}return _0x1233f3['status'](_0x10f6d9)[_0x10c8('0x31')]();};}function respondWithResult(_0x12e408,_0x8b7bed){_0x8b7bed=_0x8b7bed||0xc8;return function(_0x1ac637){if(_0x1ac637){return _0x12e408['status'](_0x8b7bed)[_0x10c8('0x32')](_0x1ac637);}};}function respondWithFilteredResult(_0x5d5469,_0x37aa39){return function(_0x3c39cc){if(_0x3c39cc){var _0x5d65f8=typeof _0x37aa39[_0x10c8('0x33')]==='undefined'&&typeof _0x37aa39[_0x10c8('0x34')]==='undefined';var _0x5edd07=_0x3c39cc[_0x10c8('0x35')];var _0x2cb7ad=_0x5d65f8?0x0:_0x37aa39[_0x10c8('0x33')];var _0x4475af=_0x5d65f8?_0x3c39cc[_0x10c8('0x35')]:_0x37aa39[_0x10c8('0x33')]+_0x37aa39[_0x10c8('0x34')];var _0x159209;if(_0x4475af>=_0x5edd07){_0x4475af=_0x5edd07;_0x159209=0xc8;}else{_0x159209=0xce;}_0x5d5469['status'](_0x159209);return _0x5d5469[_0x10c8('0x36')](_0x10c8('0x37'),_0x2cb7ad+'-'+_0x4475af+'/'+_0x5edd07)[_0x10c8('0x32')](_0x3c39cc);}return null;};}function patchUpdates(_0x4d6ee4){return function(_0x466aca){try{jsonpatch[_0x10c8('0x38')](_0x466aca,_0x4d6ee4,!![]);}catch(_0x8f350a){return BPromise[_0x10c8('0x39')](_0x8f350a);}return _0x466aca[_0x10c8('0x3a')]();};}function saveUpdates(_0x5cbb9f,_0x23d7ef){return function(_0x53ef40){if(_0x53ef40){return _0x53ef40[_0x10c8('0x3b')](_0x5cbb9f)['then'](function(_0x38d5cb){return _0x38d5cb;});}return null;};}function removeEntity(_0x19b5f2,_0x52ffa1){return function(_0x904a6d){if(_0x904a6d){return _0x904a6d['destroy']()[_0x10c8('0x3c')](function(){var _0x50ebf4=_0x904a6d['get']({'plain':!![]});var _0x38dcbc='WhatsappAccounts';return db[_0x10c8('0x3d')][_0x10c8('0x3e')]({'where':{'type':_0x38dcbc,'resourceId':_0x50ebf4['id']}})[_0x10c8('0x3c')](function(){return _0x904a6d;});})[_0x10c8('0x3c')](function(){_0x19b5f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39aee5,_0x17426b){return function(_0x560b00){if(!_0x560b00){_0x39aee5[_0x10c8('0x30')](0x194);}return _0x560b00;};}function handleError(_0xe5b0d5,_0x3fed5a){_0x3fed5a=_0x3fed5a||0x1f4;return function(_0x20e2e3){logger[_0x10c8('0x2a')](_0x20e2e3[_0x10c8('0x3f')]);if(_0x20e2e3[_0x10c8('0x40')]){delete _0x20e2e3[_0x10c8('0x40')];}_0xe5b0d5['status'](_0x3fed5a)['send'](_0x20e2e3);};}exports[_0x10c8('0x41')]=function(_0x12c00f,_0x294ca6){var _0x111675={'include':[{'model':db[_0x10c8('0x42')],'as':_0x10c8('0x43')}]},_0x503e9a={},_0x524a0b={'count':0x0,'rows':[]};var _0x5c8c5c=_[_0x10c8('0x44')](db[_0x10c8('0x45')][_0x10c8('0x46')],function(_0xaac4cd){return{'name':_0xaac4cd[_0x10c8('0x47')],'type':_0xaac4cd[_0x10c8('0x48')][_0x10c8('0x49')]};});_0x503e9a[_0x10c8('0x4a')]=_[_0x10c8('0x44')](_0x5c8c5c,'name');_0x503e9a['query']=_[_0x10c8('0x4b')](_0x12c00f[_0x10c8('0x4c')]);_0x503e9a[_0x10c8('0x4d')]=_[_0x10c8('0x4e')](_0x503e9a[_0x10c8('0x4a')],_0x503e9a[_0x10c8('0x4c')]);_0x111675[_0x10c8('0x4f')]=_[_0x10c8('0x4e')](_0x503e9a['model'],qs[_0x10c8('0x50')](_0x12c00f[_0x10c8('0x4c')]['fields']));_0x111675[_0x10c8('0x4f')]=_0x111675[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x111675['attributes']:_0x503e9a['model'];if(!_0x12c00f[_0x10c8('0x4c')][_0x10c8('0x52')]('nolimit')){_0x111675[_0x10c8('0x34')]=qs[_0x10c8('0x34')](_0x12c00f[_0x10c8('0x4c')]['limit']);_0x111675['offset']=qs[_0x10c8('0x33')](_0x12c00f[_0x10c8('0x4c')][_0x10c8('0x33')]);}_0x111675[_0x10c8('0x53')]=qs[_0x10c8('0x54')](_0x12c00f['query']['sort']);_0x111675[_0x10c8('0x55')]=qs[_0x10c8('0x4d')](_[_0x10c8('0x56')](_0x12c00f['query'],_0x503e9a[_0x10c8('0x4d')]),_0x5c8c5c);if(_0x12c00f[_0x10c8('0x4c')][_0x10c8('0x57')]){_0x111675[_0x10c8('0x55')]=_[_0x10c8('0x58')](_0x111675[_0x10c8('0x55')],{'$or':_['map'](_0x5c8c5c,function(_0x4c00e0){if(_0x4c00e0[_0x10c8('0x48')]!==_0x10c8('0x59')){var _0x15b0ab={};_0x15b0ab[_0x4c00e0['name']]={'$like':'%'+_0x12c00f[_0x10c8('0x4c')]['filter']+'%'};return _0x15b0ab;}})});}_0x111675=_[_0x10c8('0x58')]({},_0x111675,_0x12c00f[_0x10c8('0x5a')]);var _0x4c555c={'where':_0x111675['where']};return db[_0x10c8('0x45')][_0x10c8('0x35')](_0x4c555c)[_0x10c8('0x3c')](function(_0x11e494){_0x524a0b[_0x10c8('0x35')]=_0x11e494;if(_0x12c00f['query']['includeAll']){_0x111675[_0x10c8('0x5b')]=[{'all':!![]}];}return db[_0x10c8('0x45')][_0x10c8('0x5c')](_0x111675);})[_0x10c8('0x3c')](function(_0x5d6d88){_0x524a0b['rows']=_0x5d6d88;return _0x524a0b;})[_0x10c8('0x3c')](respondWithFilteredResult(_0x294ca6,_0x111675))[_0x10c8('0x2f')](handleError(_0x294ca6,null));};exports['show']=function(_0x368144,_0x3657fe){var _0x446fee={'raw':![],'where':{'id':_0x368144[_0x10c8('0x5d')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1477d7={};_0x1477d7[_0x10c8('0x4a')]=_[_0x10c8('0x4b')](db[_0x10c8('0x45')][_0x10c8('0x46')]);_0x1477d7[_0x10c8('0x4c')]=_['keys'](_0x368144[_0x10c8('0x4c')]);_0x1477d7[_0x10c8('0x4d')]=_[_0x10c8('0x4e')](_0x1477d7[_0x10c8('0x4a')],_0x1477d7[_0x10c8('0x4c')]);_0x446fee[_0x10c8('0x4f')]=_[_0x10c8('0x4e')](_0x1477d7[_0x10c8('0x4a')],qs[_0x10c8('0x50')](_0x368144['query'][_0x10c8('0x50')]));_0x446fee[_0x10c8('0x4f')]=_0x446fee[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x446fee['attributes']:_0x1477d7[_0x10c8('0x4a')];if(_0x368144[_0x10c8('0x4c')][_0x10c8('0x5e')]){_0x446fee[_0x10c8('0x5b')]=[{'all':!![]}];}_0x446fee=_[_0x10c8('0x58')]({},_0x446fee,_0x368144[_0x10c8('0x5a')]);return db[_0x10c8('0x45')]['find'](_0x446fee)[_0x10c8('0x3c')](handleEntityNotFound(_0x3657fe,null))[_0x10c8('0x3c')](respondWithResult(_0x3657fe,null))[_0x10c8('0x2f')](handleError(_0x3657fe,null));};exports[_0x10c8('0x5f')]=function(_0x55dcab,_0x3e136d){return db[_0x10c8('0x45')][_0x10c8('0x5f')](_0x55dcab[_0x10c8('0x60')],{})[_0x10c8('0x3c')](function(_0x203461){var _0x3071c7=_0x55dcab['user'][_0x10c8('0x61')]({'plain':!![]});if(!_0x3071c7)throw new Error(_0x10c8('0x62'));if(_0x3071c7[_0x10c8('0x63')]===_0x10c8('0x64')){var _0xca7ba8=_0x203461[_0x10c8('0x61')]({'plain':!![]});var _0x373754='WhatsappAccounts';return db['UserProfileSection'][_0x10c8('0x65')]({'where':{'name':_0x373754,'userProfileId':_0x3071c7[_0x10c8('0x66')]},'raw':!![]})['then'](function(_0xad4c4c){if(_0xad4c4c&&_0xad4c4c[_0x10c8('0x67')]===0x0){return db[_0x10c8('0x3d')][_0x10c8('0x5f')]({'name':_0xca7ba8[_0x10c8('0x40')],'resourceId':_0xca7ba8['id'],'type':_0xad4c4c[_0x10c8('0x40')],'sectionId':_0xad4c4c['id']},{})['then'](function(){return _0x203461;});}else{return _0x203461;}})[_0x10c8('0x2f')](function(_0x13654a){logger[_0x10c8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13654a);throw _0x13654a;});}return _0x203461;})[_0x10c8('0x3c')](respondWithResult(_0x3e136d,0xc9))[_0x10c8('0x2f')](handleError(_0x3e136d,null));};exports[_0x10c8('0x3b')]=function(_0x257d0e,_0x1a9ac6){if(_0x257d0e[_0x10c8('0x60')]['id']){delete _0x257d0e[_0x10c8('0x60')]['id'];}return db[_0x10c8('0x45')][_0x10c8('0x65')]({'where':{'id':_0x257d0e[_0x10c8('0x5d')]['id']},'include':[{'model':db[_0x10c8('0x42')],'as':_0x10c8('0x43')}]})[_0x10c8('0x3c')](handleEntityNotFound(_0x1a9ac6,null))['then'](saveUpdates(_0x257d0e[_0x10c8('0x60')],null))['then'](respondWithResult(_0x1a9ac6,null))[_0x10c8('0x2f')](handleError(_0x1a9ac6,null));};exports['destroy']=function(_0x35a502,_0x10cf1a){return db['WhatsappAccount'][_0x10c8('0x65')]({'where':{'id':_0x35a502[_0x10c8('0x5d')]['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x10cf1a,null))[_0x10c8('0x3c')](removeEntity(_0x10cf1a,null))['catch'](handleError(_0x10cf1a,null));};exports[_0x10c8('0x68')]=function(_0x16de11,_0x356fc3){return db[_0x10c8('0x45')][_0x10c8('0x68')]()[_0x10c8('0x3c')](respondWithResult(_0x356fc3,null))['catch'](handleError(_0x356fc3,null));};exports['addDisposition']=function(_0x53a488,_0x3d6d35,_0x3e6af7){if(_0x53a488[_0x10c8('0x60')]['id']){delete _0x53a488['body']['id'];}return db[_0x10c8('0x45')]['find']({'where':{'id':_0x53a488['params']['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x3d6d35,null))[_0x10c8('0x3c')](function(_0x5ce688){if(_0x5ce688){_0x53a488['body']['WhatsappAccountId']=_0x5ce688['id'];return db[_0x10c8('0x69')][_0x10c8('0x5f')](_0x53a488['body']);}})[_0x10c8('0x3c')](respondWithResult(_0x3d6d35,null))[_0x10c8('0x2f')](handleError(_0x3d6d35,null));};exports[_0x10c8('0x6a')]=function(_0x21d043,_0x52f098,_0x5c2a53){var _0x6cc674={'raw':![],'where':{}};var _0x203502={};var _0x3a9362={'count':0x0,'rows':[]};return db[_0x10c8('0x45')][_0x10c8('0x6b')]({'where':{'id':_0x21d043[_0x10c8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x52f098,null))[_0x10c8('0x3c')](function(_0x1a7091){if(_0x1a7091){_0x203502['model']=_[_0x10c8('0x4b')](db[_0x10c8('0x69')][_0x10c8('0x46')]);_0x203502[_0x10c8('0x4c')]=_['keys'](_0x21d043['query']);_0x203502['filters']=_[_0x10c8('0x4e')](_0x203502[_0x10c8('0x4a')],_0x203502['query']);_0x6cc674[_0x10c8('0x4f')]=_[_0x10c8('0x4e')](_0x203502[_0x10c8('0x4a')],qs[_0x10c8('0x50')](_0x21d043['query'][_0x10c8('0x50')]));_0x6cc674[_0x10c8('0x4f')]=_0x6cc674[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x6cc674[_0x10c8('0x4f')]:_0x203502[_0x10c8('0x4a')];if(!_0x21d043[_0x10c8('0x4c')][_0x10c8('0x52')](_0x10c8('0x6c'))){_0x6cc674[_0x10c8('0x34')]=qs[_0x10c8('0x34')](_0x21d043[_0x10c8('0x4c')][_0x10c8('0x34')]);_0x6cc674[_0x10c8('0x33')]=qs['offset'](_0x21d043[_0x10c8('0x4c')]['offset']);}_0x6cc674[_0x10c8('0x53')]=qs['sort'](_0x21d043[_0x10c8('0x4c')][_0x10c8('0x54')]);_0x6cc674['where']=qs[_0x10c8('0x4d')](_[_0x10c8('0x56')](_0x21d043[_0x10c8('0x4c')],_0x203502[_0x10c8('0x4d')]));_0x6cc674['where'][_0x10c8('0x6d')]=_0x1a7091['id'];if(_0x21d043['query']['filter']){_0x6cc674[_0x10c8('0x55')]=_[_0x10c8('0x58')](_0x6cc674[_0x10c8('0x55')],{'$or':_[_0x10c8('0x44')](_0x6cc674[_0x10c8('0x4f')],function(_0x53eada){var _0x38996b={};_0x38996b[_0x53eada]={'$like':'%'+_0x21d043[_0x10c8('0x4c')][_0x10c8('0x57')]+'%'};return _0x38996b;})});}_0x6cc674=_[_0x10c8('0x58')]({},_0x6cc674,_0x21d043[_0x10c8('0x5a')]);return db[_0x10c8('0x69')][_0x10c8('0x35')]({'where':_0x6cc674[_0x10c8('0x55')]})['then'](function(_0x5efa2c){_0x3a9362['count']=_0x5efa2c;if(_0x21d043[_0x10c8('0x4c')][_0x10c8('0x5e')]){_0x6cc674[_0x10c8('0x5b')]=[{'all':!![]}];}return db[_0x10c8('0x69')][_0x10c8('0x5c')](_0x6cc674);})[_0x10c8('0x3c')](function(_0x439156){_0x3a9362[_0x10c8('0x6e')]=_0x439156;return _0x3a9362;});}})[_0x10c8('0x3c')](respondWithFilteredResult(_0x52f098,_0x6cc674))[_0x10c8('0x2f')](handleError(_0x52f098,null));};exports[_0x10c8('0x6f')]=function(_0x2891a5,_0x48ed08,_0x1ce0b8){return db['WhatsappAccount'][_0x10c8('0x65')]({'where':{'id':_0x2891a5['params']['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x48ed08,null))[_0x10c8('0x3c')](function(_0x10788c){if(_0x10788c){return _0x10788c[_0x10c8('0x6f')](_0x2891a5[_0x10c8('0x4c')][_0x10c8('0x70')]);}})[_0x10c8('0x3c')](respondWithStatusCode(_0x48ed08,null))['catch'](handleError(_0x48ed08,null));};exports[_0x10c8('0x71')]=function(_0x36332a,_0x56adcd,_0x57b703){if(_0x36332a[_0x10c8('0x60')]['id']){delete _0x36332a['body']['id'];}return db[_0x10c8('0x45')][_0x10c8('0x65')]({'where':{'id':_0x36332a['params']['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x56adcd,null))[_0x10c8('0x3c')](function(_0x5c0b50){if(_0x5c0b50){_0x36332a[_0x10c8('0x60')][_0x10c8('0x6d')]=_0x5c0b50['id'];return db['CannedAnswer'][_0x10c8('0x5f')](_0x36332a[_0x10c8('0x60')]);}})[_0x10c8('0x3c')](respondWithResult(_0x56adcd,null))[_0x10c8('0x2f')](handleError(_0x56adcd,null));};exports[_0x10c8('0x72')]=function(_0x5267da,_0x499763,_0x369b9e){var _0x1a2c19={'raw':![],'where':{}};var _0x2f585c={};var _0x224372={'count':0x0,'rows':[]};return db[_0x10c8('0x45')][_0x10c8('0x6b')]({'where':{'id':_0x5267da[_0x10c8('0x5d')]['id']}})['then'](handleEntityNotFound(_0x499763,null))[_0x10c8('0x3c')](function(_0x14b681){if(_0x14b681){_0x2f585c['model']=_[_0x10c8('0x4b')](db[_0x10c8('0x73')][_0x10c8('0x46')]);_0x2f585c[_0x10c8('0x4c')]=_[_0x10c8('0x4b')](_0x5267da['query']);_0x2f585c[_0x10c8('0x4d')]=_[_0x10c8('0x4e')](_0x2f585c['model'],_0x2f585c[_0x10c8('0x4c')]);_0x1a2c19['attributes']=_[_0x10c8('0x4e')](_0x2f585c['model'],qs[_0x10c8('0x50')](_0x5267da[_0x10c8('0x4c')][_0x10c8('0x50')]));_0x1a2c19['attributes']=_0x1a2c19[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x1a2c19[_0x10c8('0x4f')]:_0x2f585c['model'];if(!_0x5267da[_0x10c8('0x4c')][_0x10c8('0x52')]('nolimit')){_0x1a2c19['limit']=qs[_0x10c8('0x34')](_0x5267da[_0x10c8('0x4c')][_0x10c8('0x34')]);_0x1a2c19[_0x10c8('0x33')]=qs[_0x10c8('0x33')](_0x5267da[_0x10c8('0x4c')][_0x10c8('0x33')]);}_0x1a2c19[_0x10c8('0x53')]=qs[_0x10c8('0x54')](_0x5267da[_0x10c8('0x4c')]['sort']);_0x1a2c19['where']=qs[_0x10c8('0x4d')](_[_0x10c8('0x56')](_0x5267da[_0x10c8('0x4c')],_0x2f585c[_0x10c8('0x4d')]));_0x1a2c19[_0x10c8('0x55')][_0x10c8('0x6d')]=_0x14b681['id'];if(_0x5267da[_0x10c8('0x4c')]['filter']){_0x1a2c19[_0x10c8('0x55')]=_['merge'](_0x1a2c19[_0x10c8('0x55')],{'$or':_[_0x10c8('0x44')](_0x1a2c19[_0x10c8('0x4f')],function(_0x208628){var _0x45f3cc={};_0x45f3cc[_0x208628]={'$like':'%'+_0x5267da['query'][_0x10c8('0x57')]+'%'};return _0x45f3cc;})});}_0x1a2c19=_[_0x10c8('0x58')]({},_0x1a2c19,_0x5267da[_0x10c8('0x5a')]);return db[_0x10c8('0x73')][_0x10c8('0x35')]({'where':_0x1a2c19['where']})[_0x10c8('0x3c')](function(_0x2f4d66){_0x224372[_0x10c8('0x35')]=_0x2f4d66;if(_0x5267da[_0x10c8('0x4c')][_0x10c8('0x5e')]){_0x1a2c19['include']=[{'all':!![]}];}return db[_0x10c8('0x73')][_0x10c8('0x5c')](_0x1a2c19);})['then'](function(_0x239bc5){_0x224372[_0x10c8('0x6e')]=_0x239bc5;return _0x224372;});}})[_0x10c8('0x3c')](respondWithFilteredResult(_0x499763,_0x1a2c19))[_0x10c8('0x2f')](handleError(_0x499763,null));};exports['removeAnswers']=function(_0x43e5ef,_0x475d0a,_0x190300){return db[_0x10c8('0x45')]['find']({'where':{'id':_0x43e5ef[_0x10c8('0x5d')]['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x475d0a,null))[_0x10c8('0x3c')](function(_0x1bb1f6){if(_0x1bb1f6){return _0x1bb1f6[_0x10c8('0x74')](_0x43e5ef[_0x10c8('0x4c')][_0x10c8('0x70')]);}})[_0x10c8('0x3c')](respondWithStatusCode(_0x475d0a,null))[_0x10c8('0x2f')](handleError(_0x475d0a,null));};exports['addAgents']=function(_0x2f5a7e,_0x492a2e,_0x1b66cc){return db['WhatsappAccount']['find']({'where':{'id':_0x2f5a7e[_0x10c8('0x5d')]['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x492a2e,null))[_0x10c8('0x3c')](function(_0x2d617c){if(_0x2d617c){return _0x2d617c[_0x10c8('0x75')](_0x2f5a7e[_0x10c8('0x60')][_0x10c8('0x70')],_[_0x10c8('0x76')](_0x2f5a7e[_0x10c8('0x60')],[_0x10c8('0x70'),'id'])||{})[_0x10c8('0x77')](function(_0x5e5648){for(var _0x307ec7=0x0;_0x307ec7<_0x2f5a7e['body'][_0x10c8('0x70')][_0x10c8('0x51')];_0x307ec7+=0x1){socket[_0x10c8('0x78')](_0x10c8('0x79'),{'UserId':Number(_0x2f5a7e[_0x10c8('0x60')][_0x10c8('0x70')][_0x307ec7]),'WhatsappAccountId':Number(_0x2f5a7e[_0x10c8('0x5d')]['id'])});}return _0x5e5648;});}})[_0x10c8('0x3c')](respondWithResult(_0x492a2e,null))[_0x10c8('0x2f')](handleError(_0x492a2e,null));};exports['removeAgents']=function(_0x509a43,_0x257129,_0x224aae){return db[_0x10c8('0x45')][_0x10c8('0x65')]({'where':{'id':_0x509a43['params']['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x257129,null))[_0x10c8('0x3c')](function(_0x513653){if(_0x513653){return _0x513653[_0x10c8('0x7a')](_0x509a43[_0x10c8('0x4c')][_0x10c8('0x70')])[_0x10c8('0x3c')](function(){if(_['isArray'](_0x509a43[_0x10c8('0x4c')][_0x10c8('0x70')])){for(var _0x1cf7c7=0x0;_0x1cf7c7<_0x509a43[_0x10c8('0x4c')]['ids'][_0x10c8('0x51')];_0x1cf7c7+=0x1){socket[_0x10c8('0x78')](_0x10c8('0x7b'),{'UserId':Number(_0x509a43[_0x10c8('0x4c')][_0x10c8('0x70')][_0x1cf7c7]),'WhatsappAccountId':Number(_0x509a43[_0x10c8('0x5d')]['id'])});}}else{socket[_0x10c8('0x78')](_0x10c8('0x7b'),{'UserId':Number(_0x509a43[_0x10c8('0x4c')]['ids']),'WhatsappAccountId':Number(_0x509a43[_0x10c8('0x5d')]['id'])});}});}})[_0x10c8('0x3c')](respondWithStatusCode(_0x257129,null))[_0x10c8('0x2f')](handleError(_0x257129,null));};exports[_0x10c8('0x7c')]=function(_0x40a446,_0x53e9db,_0x1d0ce4){var _0x1b95e6={};var _0x34fd41={};var _0x251a81;var _0xe7bb4c;return db[_0x10c8('0x45')][_0x10c8('0x6b')]({'where':{'id':_0x40a446[_0x10c8('0x5d')]['id']}})[_0x10c8('0x3c')](handleEntityNotFound(_0x53e9db,null))[_0x10c8('0x3c')](function(_0x20e774){if(_0x20e774){_0x251a81=_0x20e774;_0x34fd41['model']=_[_0x10c8('0x4b')](db[_0x10c8('0x7d')][_0x10c8('0x46')]);_0x34fd41[_0x10c8('0x4c')]=_[_0x10c8('0x4b')](_0x40a446[_0x10c8('0x4c')]);_0x34fd41[_0x10c8('0x4d')]=_[_0x10c8('0x4e')](_0x34fd41[_0x10c8('0x4a')],_0x34fd41['query']);_0x1b95e6[_0x10c8('0x4f')]=_['intersection'](_0x34fd41[_0x10c8('0x4a')],qs[_0x10c8('0x50')](_0x40a446[_0x10c8('0x4c')][_0x10c8('0x50')]));_0x1b95e6[_0x10c8('0x4f')]=_0x1b95e6[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x1b95e6[_0x10c8('0x4f')]:_0x34fd41[_0x10c8('0x4a')];_0x1b95e6['order']=qs[_0x10c8('0x54')](_0x40a446['query'][_0x10c8('0x54')]);_0x1b95e6[_0x10c8('0x55')]=qs[_0x10c8('0x4d')](_[_0x10c8('0x56')](_0x40a446[_0x10c8('0x4c')],_0x34fd41[_0x10c8('0x4d')]));if(_0x40a446[_0x10c8('0x4c')][_0x10c8('0x57')]){_0x1b95e6[_0x10c8('0x55')]=_[_0x10c8('0x58')](_0x1b95e6[_0x10c8('0x55')],{'$or':_[_0x10c8('0x44')](_0x1b95e6[_0x10c8('0x4f')],function(_0x4c405b){var _0x25e256={};_0x25e256[_0x4c405b]={'$like':'%'+_0x40a446[_0x10c8('0x4c')][_0x10c8('0x57')]+'%'};return _0x25e256;})});}_0x1b95e6=_[_0x10c8('0x58')]({},_0x1b95e6,_0x40a446['options']);return _0x251a81[_0x10c8('0x7c')](_0x1b95e6);}})[_0x10c8('0x3c')](function(_0x4a2c68){if(_0x4a2c68){_0xe7bb4c=_0x4a2c68[_0x10c8('0x51')];if(!_0x40a446[_0x10c8('0x4c')][_0x10c8('0x52')]('nolimit')){_0x1b95e6[_0x10c8('0x34')]=qs['limit'](_0x40a446[_0x10c8('0x4c')][_0x10c8('0x34')]);_0x1b95e6[_0x10c8('0x33')]=qs['offset'](_0x40a446[_0x10c8('0x4c')][_0x10c8('0x33')]);}return _0x251a81[_0x10c8('0x7c')](_0x1b95e6);}})[_0x10c8('0x3c')](function(_0x5be08e){if(_0x5be08e){return _0x5be08e?{'count':_0xe7bb4c,'rows':_0x5be08e}:null;}})[_0x10c8('0x3c')](respondWithResult(_0x53e9db,null))[_0x10c8('0x2f')](handleError(_0x53e9db,null));};exports[_0x10c8('0x7e')]=function(_0x467d53,_0x167e00){var _0x49ce7d=_0x467d53[_0x10c8('0x5d')]['id'];var _0x62eda9=_0x467d53[_0x10c8('0x60')];var _0x7983a=0xc8;var _0x41c3db=null;return db[_0x10c8('0x7f')][_0x10c8('0x80')]({'isolationLevel':db[_0x10c8('0x7f')][_0x10c8('0x81')][_0x10c8('0x82')][_0x10c8('0x83')]},function(_0x1f0d72){return db[_0x10c8('0x45')][_0x10c8('0x6b')]({'where':{'id':_0x49ce7d},'transaction':_0x1f0d72})[_0x10c8('0x3c')](function(_0x3818e4){if(_0x3818e4){return db[_0x10c8('0x84')]['destroy']({'where':{'WhatsappAccountId':_0x49ce7d},'transaction':_0x1f0d72})[_0x10c8('0x3c')](function(){var _0x3520c7=_['map'](_0x62eda9,function(_0x1da693){_0x1da693['WhatsappAccountId']=_0x49ce7d;return _0x1da693;});return db[_0x10c8('0x84')][_0x10c8('0x85')](_0x3520c7,{'transaction':_0x1f0d72});});}else{_0x7983a=0x194;_0x41c3db=[];}});})[_0x10c8('0x3c')](function(){if(_0x7983a!==0x194){return db['WhatsappApplication'][_0x10c8('0x86')]({'where':{'WhatsappAccountId':_0x49ce7d},'order':'priority'})[_0x10c8('0x3c')](function(_0x48e416){_0x41c3db=_0x48e416;});}})[_0x10c8('0x2f')](function(_0x2e31bb){_0x7983a=0x1f4;logger[_0x10c8('0x2a')](_0x2e31bb['stack']);if(_0x2e31bb[_0x10c8('0x40')]){delete _0x2e31bb[_0x10c8('0x40')];}_0x41c3db=_0x2e31bb;})['finally'](function(){if(_0x41c3db===null){_0x167e00['sendStatus'](_0x7983a);}else{if(_0x7983a===0x1f4){_0x167e00['status'](_0x7983a)['send'](_0x41c3db);}else{_0x167e00[_0x10c8('0x87')](_0x7983a)[_0x10c8('0x32')](_0x41c3db);}}});};exports[_0x10c8('0x88')]=function(_0x1ef341,_0x2f26e2,_0x2fca4e){var _0x346fd5={};var _0x4b7f62={};var _0x2cafab;var _0x3a8aec;return db[_0x10c8('0x45')][_0x10c8('0x6b')]({'where':{'id':_0x1ef341['params']['id']}})['then'](handleEntityNotFound(_0x2f26e2,null))[_0x10c8('0x3c')](function(_0x3bb583){if(_0x3bb583){_0x2cafab=_0x3bb583;_0x4b7f62[_0x10c8('0x4a')]=_[_0x10c8('0x4b')](db[_0x10c8('0x84')][_0x10c8('0x46')]);_0x4b7f62[_0x10c8('0x4c')]=_['keys'](_0x1ef341[_0x10c8('0x4c')]);_0x4b7f62['filters']=_[_0x10c8('0x4e')](_0x4b7f62[_0x10c8('0x4a')],_0x4b7f62[_0x10c8('0x4c')]);_0x346fd5[_0x10c8('0x4f')]=_[_0x10c8('0x4e')](_0x4b7f62[_0x10c8('0x4a')],qs[_0x10c8('0x50')](_0x1ef341['query'][_0x10c8('0x50')]));_0x346fd5[_0x10c8('0x4f')]=_0x346fd5[_0x10c8('0x4f')][_0x10c8('0x51')]?_0x346fd5['attributes']:_0x4b7f62['model'];_0x346fd5['order']=qs['sort'](_0x1ef341[_0x10c8('0x4c')][_0x10c8('0x54')]);_0x346fd5[_0x10c8('0x55')]=qs[_0x10c8('0x4d')](_['pick'](_0x1ef341[_0x10c8('0x4c')],_0x4b7f62[_0x10c8('0x4d')]));if(_0x1ef341[_0x10c8('0x4c')][_0x10c8('0x57')]){_0x346fd5[_0x10c8('0x55')]=_[_0x10c8('0x58')](_0x346fd5[_0x10c8('0x55')],{'$or':_['map'](_0x346fd5[_0x10c8('0x4f')],function(_0x1acae9){var _0xebda6={};_0xebda6[_0x1acae9]={'$like':'%'+_0x1ef341['query'][_0x10c8('0x57')]+'%'};return _0xebda6;})});}_0x346fd5=_['merge']({},_0x346fd5,_0x1ef341[_0x10c8('0x5a')]);return _0x2cafab[_0x10c8('0x88')](_0x346fd5);}})['then'](function(_0x466d78){if(_0x466d78){_0x3a8aec=_0x466d78[_0x10c8('0x51')];if(!_0x1ef341[_0x10c8('0x4c')][_0x10c8('0x52')](_0x10c8('0x6c'))){_0x346fd5[_0x10c8('0x34')]=qs[_0x10c8('0x34')](_0x1ef341[_0x10c8('0x4c')][_0x10c8('0x34')]);_0x346fd5[_0x10c8('0x33')]=qs[_0x10c8('0x33')](_0x1ef341['query'][_0x10c8('0x33')]);}return _0x2cafab[_0x10c8('0x88')](_0x346fd5);}})['then'](function(_0x29ea5e){if(_0x29ea5e){return _0x29ea5e?{'count':_0x3a8aec,'rows':_0x29ea5e}:null;}})['then'](respondWithResult(_0x2f26e2,null))[_0x10c8('0x2f')](handleError(_0x2f26e2,null));};exports['notify']=function(_0x42a8ff,_0x25dcde,_0x4440df){var _0x48e9f9={'channel':'whatsapp'};var _0xe5f4e2=[];var _0x37243d=[];var _0x3722c2={};return db['WhatsappAccount'][_0x10c8('0x65')]({'where':{'id':_0x42a8ff[_0x10c8('0x5d')]['id']},'include':[{'model':db[_0x10c8('0x84')],'as':_0x10c8('0x89')}]})[_0x10c8('0x3c')](handleEntityNotFound(_0x25dcde,null))[_0x10c8('0x3c')](function(_0x2a115f){_0x48e9f9[_0x10c8('0x8a')]=_0x2a115f;if(_0x48e9f9[_0x10c8('0x8a')]&&_0x48e9f9['account']['type']===_0x10c8('0x8b')&&_0x42a8ff['body']['statuses']){if(_0x42a8ff['body'][_0x10c8('0x8c')]['length']===0x0)return;if(_0x42a8ff[_0x10c8('0x60')][_0x10c8('0x8c')][0x0]['state']!=='read')return;return db['WhatsappMessage'][_0x10c8('0x3b')]({'read':!![],'readAt':_0x42a8ff[_0x10c8('0x60')][_0x10c8('0x8c')][0x0][_0x10c8('0x8d')]},{'where':{'messageId':_0x42a8ff['body']['statuses'][0x0][_0x10c8('0x8e')]},'individualHooks':!![]})['then'](function(_0xf5f7b0){return _0x25dcde[_0x10c8('0x87')](0xc8)[_0x10c8('0x32')](_0xf5f7b0);});}_0x48e9f9[_0x10c8('0x8f')]=_[_0x10c8('0x90')](_0x2a115f[_0x10c8('0x89')],['priority'],['asc']);if(_0x48e9f9[_0x10c8('0x8a')][_0x10c8('0x89')]){delete _0x48e9f9[_0x10c8('0x8a')]['Applications'];}return db['CmContact']['describe']()['then'](function(_0x5bb77b){if(!_0x5bb77b){throw new db[(_0x10c8('0x91'))][(_0x10c8('0x92'))](_0x10c8('0x93'));}_0xe5f4e2=_[_0x10c8('0x94')](_['keys'](_0x5bb77b),[_0x10c8('0x95'),_0x10c8('0x96')]);_0x37243d=_[_0x10c8('0x94')](_[_0x10c8('0x4b')](_0x5bb77b),['createdAt','updatedAt',_0x10c8('0x97'),_0x10c8('0x98')]);_0x48e9f9[_0x10c8('0x60')]={'mapKey':_0x10c8('0x99')};if(_0x48e9f9[_0x10c8('0x8a')]&&_0x48e9f9['account'][_0x10c8('0x48')]==='twilio'){_0x48e9f9[_0x10c8('0x60')]['from']=_0x42a8ff[_0x10c8('0x60')][_0x10c8('0x9a')]['replace']('whatsapp:','');_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x60')]=_0x42a8ff['body'][_0x10c8('0x9b')];_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9c')]=_0x42a8ff[_0x10c8('0x60')]['MessageSid'];}if(_0x48e9f9['account']&&_0x48e9f9[_0x10c8('0x8a')][_0x10c8('0x48')]===_0x10c8('0x8b')){_0x48e9f9['body'][_0x10c8('0x9d')]=_0x42a8ff['body']['notifications'][0x0][_0x10c8('0x9d')];_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x60')]=_0x42a8ff[_0x10c8('0x60')][_0x10c8('0x9e')][0x0]['message']['body'];_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9c')]=_0x42a8ff[_0x10c8('0x60')]['notifications'][0x0]['message_id'];}if(_0x48e9f9[_0x10c8('0x60')]['id']){delete _0x48e9f9['body']['id'];}if(_[_0x10c8('0x9f')](_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9d')])){throw new db[(_0x10c8('0x91'))][(_0x10c8('0x92'))](_0x10c8('0xa0'));}if(_['isNil'](_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x60')])||_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x60')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x10c8('0x9f')](_0x48e9f9[_0x10c8('0x60')]['mapKey'])){throw new db['Sequelize'][(_0x10c8('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37243d);}if(!_['includes'](_0x37243d,_0x48e9f9['body'][_0x10c8('0xa1')])){throw new db['Sequelize'][(_0x10c8('0x92'))](_0x10c8('0xa2')+_0x37243d);}_0x3722c2[_0x48e9f9['body']['mapKey']]=_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9d')];return db[_0x10c8('0xa3')][_0x10c8('0x65')]({'where':{'id':_0x48e9f9[_0x10c8('0x8a')][_0x10c8('0x98')]},'include':[{'model':db[_0x10c8('0xa4')],'as':_0x10c8('0xa5'),'where':_0x3722c2,'limit':0x1,'order':[['updatedAt',_0x10c8('0xa6')]]}]});})[_0x10c8('0x3c')](handleEntityNotFound(_0x25dcde,null))[_0x10c8('0x3c')](function(_0xe05dff){if(_0xe05dff){_0x48e9f9[_0x10c8('0xa7')]=_['omit'](_0xe05dff,[_0x10c8('0xa5')]);if(_0xe05dff['Contacts'][_0x10c8('0x51')]){return _0xe05dff[_0x10c8('0xa5')][0x0];}var _0x97357f=_[_0x10c8('0x1f')](_0x48e9f9[_0x10c8('0x60')],{'firstName':_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9d')],'ListId':_0xe05dff['id']});_0x97357f[_0x48e9f9['body'][_0x10c8('0xa1')]]=_0x48e9f9[_0x10c8('0x60')]['from'];return db['CmContact'][_0x10c8('0x5f')](_0x97357f,{'fields':_0xe5f4e2,'raw':!![]});}})[_0x10c8('0x3c')](handleEntityNotFound(_0x25dcde,null))[_0x10c8('0x3c')](function(_0x1244a3){if(_0x1244a3){_0x48e9f9[_0x10c8('0xa8')]=_0x1244a3;var _0x298528={'ContactId':_0x1244a3['id'],'phone':_0x48e9f9['body'][_0x10c8('0x9d')],'WhatsappAccountId':_0x42a8ff[_0x10c8('0x5d')]['id']};var _0x13d836={'ContactId':_0x1244a3['id'],'WhatsappAccountId':_0x42a8ff[_0x10c8('0x5d')]['id'],'closed':![]};return db[_0x10c8('0xa9')][_0x10c8('0x65')]({'where':_0x13d836})[_0x10c8('0x3c')](function(_0x22b554){if(_0x22b554){return[_0x22b554,![]];}return db[_0x10c8('0xa9')][_0x10c8('0x5f')](_0x298528)['then'](function(_0x39d054){return[_0x39d054,!![]];});});}})[_0x10c8('0x77')](function(_0x5b655b,_0x3d0f7c){_0x48e9f9[_0x10c8('0xaa')]=_0x5b655b[_0x10c8('0x61')]({'plain':!![]});_0x48e9f9[_0x10c8('0xaa')]['created']=![];if(_0x3d0f7c){if(_0x48e9f9[_0x10c8('0x8a')]['autoclose']){_0x48e9f9['applications'][_0x10c8('0xab')]({'id':0x0,'priority':_0x48e9f9[_0x10c8('0x8f')][_0x10c8('0x51')]+0x1,'app':_0x10c8('0xac'),'appdata':_0x10c8('0xad'),'interval':_0x10c8('0xae')});}_0x48e9f9['interaction'][_0x10c8('0xaf')]=!![];}return db[_0x10c8('0xb0')][_0x10c8('0x5f')]({'phone':_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x9d')],'messageId':_0x48e9f9['body'][_0x10c8('0x9c')],'body':_0x48e9f9[_0x10c8('0x60')][_0x10c8('0x60')],'WhatsappAccountId':_0x42a8ff[_0x10c8('0x5d')]['id'],'WhatsappInteractionId':_0x5b655b['id'],'direction':'in','ContactId':_0x5b655b[_0x10c8('0xb1')],'AttachmentId':_0x48e9f9[_0x10c8('0x60')][_0x10c8('0xb2')]});})[_0x10c8('0x3c')](function(_0x2881e4){_0x48e9f9[_0x10c8('0x2c')]=_0x2881e4;if(_0x48e9f9[_0x10c8('0xaa')]['UserId']){return db['User'][_0x10c8('0x65')]({'attributes':['id',_0x10c8('0x40')],'where':{'id':_0x48e9f9[_0x10c8('0xaa')][_0x10c8('0xb3')]}})[_0x10c8('0x3c')](function(_0x7f0fbf){if(_0x7f0fbf){_0x48e9f9[_0x10c8('0x8f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x10c8('0xb4'),'appdata':_0x7f0fbf[_0x10c8('0x40')]+','+(_0x48e9f9[_0x10c8('0x8a')][_0x10c8('0xb5')]||0xa),'interval':_0x10c8('0xae')});}return respondWithRpcPromise('Start',_0x10c8('0xb6'),_0x48e9f9);});}return respondWithRpcPromise(_0x10c8('0xb7'),_0x10c8('0xb6'),_0x48e9f9);})['then'](function(_0x985666){if(_0x985666){var _0x45bae9=0xc8;var _0x2602a9=_0x10c8('0xb8');logger[_0x10c8('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2602a9,_0x45bae9,'entity\x20found');logger[_0x10c8('0x27')](_0x10c8('0xb9'),_0x2602a9,_0x45bae9,_0x10c8('0xba'),JSON[_0x10c8('0x29')](_0x985666));if(_0x48e9f9[_0x10c8('0x8a')][_0x10c8('0x48')]===_0x10c8('0xbb')){return _0x25dcde[_0x10c8('0x87')](_0x45bae9)[_0x10c8('0x36')](_0x10c8('0xbc'),_0x10c8('0xbd'))['send']('\x0a');}else{return _0x25dcde[_0x10c8('0x87')](_0x45bae9)[_0x10c8('0x32')](_0x985666);}}});})[_0x10c8('0x2f')](handleError(_0x25dcde,null));};exports['send']=function(_0x21da63,_0x4927d8,_0x52fe12){var _0x1114ff,_0x11add2,_0xa6d751;if(_[_0x10c8('0x9f')](_0x21da63[_0x10c8('0x60')][_0x10c8('0x60')])||_0x21da63[_0x10c8('0x60')][_0x10c8('0x60')]===''){throw new db[(_0x10c8('0x91'))]['ValidationError'](_0x10c8('0xbe'));}if(_[_0x10c8('0x9f')](_0x21da63['body']['to'])){throw new db[(_0x10c8('0x91'))][(_0x10c8('0x92'))](_0x10c8('0xbf'));}_0x1114ff=_0x21da63['body']['to'];return db[_0x10c8('0x45')]['find']({'where':{'id':_0x21da63['params']['id']},'include':[{'model':db[_0x10c8('0xa3')],'as':_0x10c8('0xc0'),'include':[{'model':db[_0x10c8('0xa4')],'as':_0x10c8('0xa5'),'where':{'mobile':_0x1114ff},'limit':0x1,'order':[['updatedAt',_0x10c8('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x4927d8,null))[_0x10c8('0x3c')](function(_0x4222d3){if(_0x4222d3&&_0x4222d3[_0x10c8('0xc0')]){_0x11add2=_0x4222d3[_0x10c8('0x61')]({'plain':!![]});if(_0x11add2[_0x10c8('0xc0')]&&_0x11add2['List']['Contacts']['length']){return _0x11add2[_0x10c8('0xc0')][_0x10c8('0xa5')][0x0];}return db[_0x10c8('0xa4')]['create'](_[_0x10c8('0x1f')](_0x21da63[_0x10c8('0x60')],{'firstName':_0x1114ff,'mobile':_0x1114ff,'phone':_0x1114ff,'ListId':_0x11add2[_0x10c8('0x98')]}));}})['then'](handleEntityNotFound(_0x4927d8,null))[_0x10c8('0x3c')](function(_0x3decdd){if(_0x3decdd){_0xa6d751=_0x3decdd;return db[_0x10c8('0xa9')][_0x10c8('0x65')]({'where':{'ContactId':_0xa6d751['id'],'closed':![],'WhatsappAccountId':_0x11add2['id']}})[_0x10c8('0x3c')](function(_0x52aeea){if(_0x52aeea){return[_0x52aeea,![]];}return db[_0x10c8('0xa9')]['create']({'UserId':_0x21da63[_0x10c8('0x64')]['id'],'ContactId':_0xa6d751['id'],'WhatsappAccountId':_0x11add2['id'],'phone':_0x1114ff,'firstMsgDirection':_0x10c8('0xc1'),'Messages':[_['merge'](_0x21da63[_0x10c8('0x60')],{'read':![],'body':_0x21da63[_0x10c8('0x60')][_0x10c8('0x60')],'phone':_0x1114ff,'WhatsappAccountId':_0x11add2['id'],'UserId':_0x21da63['user']['id'],'ContactId':_0xa6d751['id']})]},{'include':[{'model':db[_0x10c8('0xb0')],'as':_0x10c8('0xc2')}]})[_0x10c8('0x3c')](function(_0x27c1a2){return[_0x27c1a2,!![]];});});}})['spread'](function(_0x3d3dca,_0x4883ef){if(_0x4883ef){return _0x3d3dca;}return db[_0x10c8('0xb0')][_0x10c8('0x5f')](_[_0x10c8('0x58')](_0x21da63[_0x10c8('0x60')],{'read':![],'body':_0x21da63['body'][_0x10c8('0x60')],'phone':_0x1114ff,'WhatsappAccountId':_0x11add2['id'],'WhatsappInteractionId':_0x3d3dca['id'],'UserId':_0x21da63[_0x10c8('0x64')]['id'],'ContactId':_0xa6d751['id']}))[_0x10c8('0x3c')](function(_0x19feda){_0x3d3dca[_0x10c8('0xc3')][_0x10c8('0xc2')]=[];_0x3d3dca[_0x10c8('0xc3')][_0x10c8('0xc2')][_0x10c8('0xab')](_0x19feda['dataValues']);return _0x3d3dca;});})[_0x10c8('0x3c')](respondWithResult(_0x4927d8,null))[_0x10c8('0x2f')](handleError(_0x4927d8,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 53eba10..aa108ac 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 _0x6490=['WhatsappAccount','setMaxListeners','save','remove','hook','exports','events','../../mysqldb'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0x6490,0xf6));var _0x0649=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0x6490[_0xbec8e6];return _0x4aa6f2;};'use strict';var EventEmitter=require(_0x0649('0x0'));var WhatsappAccount=require(_0x0649('0x1'))['db'][_0x0649('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x0649('0x3')](0x0);var events={'afterCreate':_0x0649('0x4'),'afterUpdate':'update','afterDestroy':_0x0649('0x5')};function emitEvent(_0x275f90){return function(_0x8dd77d,_0x38833b,_0x2626dc){WhatsappAccountEvents['emit'](_0x275f90+':'+_0x8dd77d['id'],_0x8dd77d);WhatsappAccountEvents['emit'](_0x275f90,_0x8dd77d);_0x2626dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x0649('0x6')](e,emitEvent(event));}}module[_0x0649('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd91a=['events','../../mysqldb','WhatsappAccount','setMaxListeners','remove','hasOwnProperty','hook'];(function(_0xf48cce,_0x3531e4){var _0x2a5c38=function(_0x22a454){while(--_0x22a454){_0xf48cce['push'](_0xf48cce['shift']());}};_0x2a5c38(++_0x3531e4);}(_0xd91a,0x1ea));var _0xad91=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd91a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xad91('0x0'));var WhatsappAccount=require(_0xad91('0x1'))['db'][_0xad91('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xad91('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xad91('0x4')};function emitEvent(_0x75e39c){return function(_0x1e22d7,_0x5173ac,_0x4ee7eb){WhatsappAccountEvents['emit'](_0x75e39c+':'+_0x1e22d7['id'],_0x1e22d7);WhatsappAccountEvents['emit'](_0x75e39c,_0x1e22d7);_0x4ee7eb(null);};}for(var e in events){if(events[_0xad91('0x5')](e)){var event=events[e];WhatsappAccount[_0xad91('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index e5b9ecd..5184aef 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 _0x33ae=['request-promise','path','../../config/environment','exports','define','whatsapp_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0xf36a76,_0x3967b3){var _0x414aa5=function(_0x84dc89){while(--_0x84dc89){_0xf36a76['push'](_0xf36a76['shift']());}};_0x414aa5(++_0x3967b3);}(_0x33ae,0x103));var _0xe33a=function(_0x3ed091,_0x3491d4){_0x3ed091=_0x3ed091-0x0;var _0x49f07c=_0x33ae[_0x3ed091];return _0x49f07c;};'use strict';var _=require(_0xe33a('0x0'));var util=require(_0xe33a('0x1'));var logger=require(_0xe33a('0x2'))('api');var moment=require(_0xe33a('0x3'));var BPromise=require(_0xe33a('0x4'));var rp=require(_0xe33a('0x5'));var fs=require('fs');var path=require(_0xe33a('0x6'));var rimraf=require('rimraf');var config=require(_0xe33a('0x7'));var attributes=require('./whatsappAccount.attributes');module[_0xe33a('0x8')]=function(_0x3be258,_0x8b15cf){return _0x3be258[_0xe33a('0x9')]('WhatsappAccount',attributes,{'tableName':_0xe33a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeef5=['path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51fdde,_0x2e0801){var _0x35b1e2=function(_0x4de327){while(--_0x4de327){_0x51fdde['push'](_0x51fdde['shift']());}};_0x35b1e2(++_0x2e0801);}(_0xeef5,0x93));var _0x5eef=function(_0x379d12,_0x3737d6){_0x379d12=_0x379d12-0x0;var _0x3073e3=_0xeef5[_0x379d12];return _0x3073e3;};'use strict';var _=require(_0x5eef('0x0'));var util=require(_0x5eef('0x1'));var logger=require(_0x5eef('0x2'))(_0x5eef('0x3'));var moment=require(_0x5eef('0x4'));var BPromise=require(_0x5eef('0x5'));var rp=require(_0x5eef('0x6'));var fs=require('fs');var path=require(_0x5eef('0x7'));var rimraf=require(_0x5eef('0x8'));var config=require(_0x5eef('0x9'));var attributes=require(_0x5eef('0xa'));module[_0x5eef('0xb')]=function(_0x5a4503,_0x5177db){return _0x5a4503[_0x5eef('0xc')](_0x5eef('0xd'),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 dfee25d..e439a1c 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 _0x6c6f=['where','include','model','map','attributes','then','debug','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw'];(function(_0x1b225a,_0x12e8e0){var _0x75784a=function(_0x2b2a59){while(--_0x2b2a59){_0x1b225a['push'](_0x1b225a['shift']());}};_0x75784a(++_0x12e8e0);}(_0x6c6f,0x10b));var _0xf6c6=function(_0x1037b7,_0x20ef64){_0x1037b7=_0x1037b7-0x0;var _0x5bb655=_0x6c6f[_0x1037b7];return _0x5bb655;};'use strict';var _=require(_0xf6c6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf6c6('0x1'));var rs=require(_0xf6c6('0x2'));var fs=require('fs');var Redis=require(_0xf6c6('0x3'));var db=require(_0xf6c6('0x4'))['db'];var utils=require(_0xf6c6('0x5'));var logger=require('../../config/logger')(_0xf6c6('0x6'));var config=require(_0xf6c6('0x7'));var jayson=require(_0xf6c6('0x8'));var client=jayson[_0xf6c6('0x9')]['http']({'port':0x232a});config[_0xf6c6('0xa')]=_[_0xf6c6('0xb')](config[_0xf6c6('0xa')],{'host':_0xf6c6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf6c6('0xa')]));require(_0xf6c6('0xd'))[_0xf6c6('0xe')](socket);function respondWithRpcPromise(_0x19c5a9,_0x476d54,_0x20341d){return new BPromise(function(_0x5165d5,_0x443405){return client[_0xf6c6('0xf')](_0x19c5a9,_0x20341d)['then'](function(_0xc1008e){logger[_0xf6c6('0x10')](_0xf6c6('0x11'),_0x476d54,'request\x20sent');logger['debug'](_0xf6c6('0x12'),_0x476d54,'request\x20sent',JSON['stringify'](_0xc1008e));if(_0xc1008e[_0xf6c6('0x13')]){if(_0xc1008e[_0xf6c6('0x13')]['code']===0x1f4){logger[_0xf6c6('0x13')](_0xf6c6('0x11'),_0x476d54,_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);return _0x443405(_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);}logger[_0xf6c6('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x476d54,_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);return _0x5165d5(_0xc1008e[_0xf6c6('0x13')][_0xf6c6('0x14')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x476d54,_0xf6c6('0x15'));_0x5165d5(_0xc1008e[_0xf6c6('0x16')][_0xf6c6('0x14')]);}})[_0xf6c6('0x17')](function(_0x570b9d){logger[_0xf6c6('0x13')](_0xf6c6('0x11'),_0x476d54,_0x570b9d);_0x443405(_0x570b9d);});});}exports[_0xf6c6('0x18')]=function(_0x3674f4){var _0x3a1adb=this;return new Promise(function(_0x536b7a,_0x5e36a1){return db[_0xf6c6('0x19')][_0xf6c6('0x1a')]({'raw':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1c')]===undefined?!![]:![]:!![],'where':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1d')]||null:null,'attributes':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')]['attributes']||null:null,'include':_0x3674f4[_0xf6c6('0x1b')]?_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1e')]?_['map'](_0x3674f4[_0xf6c6('0x1b')][_0xf6c6('0x1e')],function(_0xa06a8d){return{'model':db[_0xa06a8d[_0xf6c6('0x1f')]],'as':_0xa06a8d['as'],'attributes':_0xa06a8d['attributes'],'include':_0xa06a8d[_0xf6c6('0x1e')]?_[_0xf6c6('0x20')](_0xa06a8d[_0xf6c6('0x1e')],function(_0x2d94a9){return{'model':db[_0x2d94a9[_0xf6c6('0x1f')]],'as':_0x2d94a9['as'],'attributes':_0x2d94a9['attributes'],'include':_0x2d94a9['include']?_[_0xf6c6('0x20')](_0x2d94a9[_0xf6c6('0x1e')],function(_0x36858f){return{'model':db[_0x36858f[_0xf6c6('0x1f')]],'as':_0x36858f['as'],'attributes':_0x36858f[_0xf6c6('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf6c6('0x22')](function(_0x458b29){logger['info']('ShowWhatsappAccount',_0x3674f4);logger[_0xf6c6('0x23')]('ShowWhatsappAccount',_0x3674f4,JSON[_0xf6c6('0x24')](_0x458b29));_0x536b7a(_0x458b29);})[_0xf6c6('0x17')](function(_0x5d62cf){logger[_0xf6c6('0x13')](_0xf6c6('0x18'),_0x5d62cf[_0xf6c6('0x14')],_0x3674f4);_0x5e36a1(_0x3a1adb[_0xf6c6('0x13')](0x1f4,_0x5d62cf[_0xf6c6('0x14')]));});});}; \ No newline at end of file +var _0x3991=['model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','socket.io-emitter','redis','./whatsappAccount.socket','register','request','then','info','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map'];(function(_0x23e4b4,_0x132419){var _0x3bc471=function(_0x1f4d12){while(--_0x1f4d12){_0x23e4b4['push'](_0x23e4b4['shift']());}};_0x3bc471(++_0x132419);}(_0x3991,0x169));var _0x1399=function(_0x38b7cf,_0x18309a){_0x38b7cf=_0x38b7cf-0x0;var _0x107916=_0x3991[_0x38b7cf];return _0x107916;};'use strict';var _=require('lodash');var util=require(_0x1399('0x0'));var moment=require(_0x1399('0x1'));var BPromise=require(_0x1399('0x2'));var rs=require(_0x1399('0x3'));var fs=require('fs');var Redis=require(_0x1399('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1399('0x5'));var logger=require(_0x1399('0x6'))(_0x1399('0x7'));var config=require(_0x1399('0x8'));var jayson=require(_0x1399('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1399('0xa'))(new Redis(config[_0x1399('0xb')]));require(_0x1399('0xc'))[_0x1399('0xd')](socket);function respondWithRpcPromise(_0x25399b,_0x29b991,_0x5368b7){return new BPromise(function(_0x4a1a7a,_0x1f62a1){return client[_0x1399('0xe')](_0x25399b,_0x5368b7)[_0x1399('0xf')](function(_0x3c5868){logger[_0x1399('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x29b991,'request\x20sent');logger[_0x1399('0x11')](_0x1399('0x12'),_0x29b991,_0x1399('0x13'),JSON[_0x1399('0x14')](_0x3c5868));if(_0x3c5868[_0x1399('0x15')]){if(_0x3c5868[_0x1399('0x15')][_0x1399('0x16')]===0x1f4){logger[_0x1399('0x15')](_0x1399('0x17'),_0x29b991,_0x3c5868[_0x1399('0x15')][_0x1399('0x18')]);return _0x1f62a1(_0x3c5868[_0x1399('0x15')][_0x1399('0x18')]);}logger[_0x1399('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x29b991,_0x3c5868[_0x1399('0x15')][_0x1399('0x18')]);return _0x4a1a7a(_0x3c5868['error']['message']);}else{logger[_0x1399('0x10')](_0x1399('0x17'),_0x29b991,'request\x20sent');_0x4a1a7a(_0x3c5868[_0x1399('0x19')]['message']);}})[_0x1399('0x1a')](function(_0x4ac96b){logger[_0x1399('0x15')](_0x1399('0x17'),_0x29b991,_0x4ac96b);_0x1f62a1(_0x4ac96b);});});}exports[_0x1399('0x1b')]=function(_0x4ad3ae){var _0x450774=this;return new Promise(function(_0x1881e8,_0x5a64e3){return db[_0x1399('0x1c')][_0x1399('0x1d')]({'raw':_0x4ad3ae['options']?_0x4ad3ae[_0x1399('0x1e')][_0x1399('0x1f')]===undefined?!![]:![]:!![],'where':_0x4ad3ae[_0x1399('0x1e')]?_0x4ad3ae['options']['where']||null:null,'attributes':_0x4ad3ae[_0x1399('0x1e')]?_0x4ad3ae[_0x1399('0x1e')][_0x1399('0x20')]||null:null,'include':_0x4ad3ae[_0x1399('0x1e')]?_0x4ad3ae['options'][_0x1399('0x21')]?_[_0x1399('0x22')](_0x4ad3ae[_0x1399('0x1e')][_0x1399('0x21')],function(_0xf50879){return{'model':db[_0xf50879[_0x1399('0x23')]],'as':_0xf50879['as'],'attributes':_0xf50879[_0x1399('0x20')],'include':_0xf50879[_0x1399('0x21')]?_[_0x1399('0x22')](_0xf50879[_0x1399('0x21')],function(_0x5e8f72){return{'model':db[_0x5e8f72['model']],'as':_0x5e8f72['as'],'attributes':_0x5e8f72[_0x1399('0x20')],'include':_0x5e8f72['include']?_['map'](_0x5e8f72['include'],function(_0x1755df){return{'model':db[_0x1755df[_0x1399('0x23')]],'as':_0x1755df['as'],'attributes':_0x1755df[_0x1399('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1399('0xf')](function(_0x855b9f){logger['info']('ShowWhatsappAccount',_0x4ad3ae);logger[_0x1399('0x11')](_0x1399('0x1b'),_0x4ad3ae,JSON[_0x1399('0x14')](_0x855b9f));_0x1881e8(_0x855b9f);})[_0x1399('0x1a')](function(_0x4e0217){logger['error'](_0x1399('0x1b'),_0x4e0217['message'],_0x4ad3ae);_0x5a64e3(_0x450774[_0x1399('0x15')](0x1f4,_0x4e0217['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index a3801ad..0c4e1c3 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 _0xa609=['register','whatsappAccount:','./whatsappAccount.events','remove','update','removeListener'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xa609,0x14c));var _0x9a60=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xa609[_0x2c91e9];return _0x13f0ff;};'use strict';var WhatsappAccountEvents=require(_0x9a60('0x0'));var events=['save',_0x9a60('0x1'),_0x9a60('0x2')];function createListener(_0x264fdd,_0xdccd23){return function(_0x351c12){_0xdccd23['emit'](_0x264fdd,_0x351c12);};}function removeListener(_0x2b9b26,_0x97e959){return function(){WhatsappAccountEvents[_0x9a60('0x3')](_0x2b9b26,_0x97e959);};}exports[_0x9a60('0x4')]=function(_0x2fc536){for(var _0x3bb804=0x0,_0x40c82d=events['length'];_0x3bb804<_0x40c82d;_0x3bb804++){var _0x5e9904=events[_0x3bb804];var _0x4c307b=createListener(_0x9a60('0x5')+_0x5e9904,_0x2fc536);WhatsappAccountEvents['on'](_0x5e9904,_0x4c307b);}}; \ No newline at end of file +var _0xc169=['whatsappAccount:','./whatsappAccount.events','emit','register','length'];(function(_0x124c75,_0x1b3a4){var _0x474b15=function(_0x418347){while(--_0x418347){_0x124c75['push'](_0x124c75['shift']());}};_0x474b15(++_0x1b3a4);}(_0xc169,0x196));var _0x9c16=function(_0x45bee0,_0x42bf09){_0x45bee0=_0x45bee0-0x0;var _0x1fcfd5=_0xc169[_0x45bee0];return _0x1fcfd5;};'use strict';var WhatsappAccountEvents=require(_0x9c16('0x0'));var events=['save','remove','update'];function createListener(_0x226c1b,_0x43bb02){return function(_0x41c686){_0x43bb02[_0x9c16('0x1')](_0x226c1b,_0x41c686);};}function removeListener(_0x5250c9,_0x5456de){return function(){WhatsappAccountEvents['removeListener'](_0x5250c9,_0x5456de);};}exports[_0x9c16('0x2')]=function(_0x13000e){for(var _0x3a5472=0x0,_0x47ce1f=events[_0x9c16('0x3')];_0x3a5472<_0x47ce1f;_0x3a5472++){var _0x14d4d9=events[_0x3a5472];var _0x3b0704=createListener(_0x9c16('0x4')+_0x14d4d9,_0x13000e);WhatsappAccountEvents['on'](_0x14d4d9,_0x3b0704);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 1991970..92ec0f5 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 _0x7b6f=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x5d4d47,_0x46da7d){var _0x241374=function(_0x13fb98){while(--_0x13fb98){_0x5d4d47['push'](_0x5d4d47['shift']());}};_0x241374(++_0x46da7d);}(_0x7b6f,0x182));var _0xf7b6=function(_0x125a11,_0x305254){_0x125a11=_0x125a11-0x0;var _0x422646=_0x7b6f[_0x125a11];return _0x422646;};'use strict';var multer=require(_0xf7b6('0x0'));var util=require(_0xf7b6('0x1'));var path=require(_0xf7b6('0x2'));var timeout=require(_0xf7b6('0x3'));var express=require(_0xf7b6('0x4'));var router=express[_0xf7b6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf7b6('0x6'));var interaction=require(_0xf7b6('0x7'));var config=require(_0xf7b6('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf7b6('0x9')]);router[_0xf7b6('0xa')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller['show']);router[_0xf7b6('0xd')]('/',auth[_0xf7b6('0xc')](),controller[_0xf7b6('0xe')]);router[_0xf7b6('0xf')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller['update']);router[_0xf7b6('0x10')](_0xf7b6('0xb'),auth[_0xf7b6('0xc')](),controller[_0xf7b6('0x11')]);module[_0xf7b6('0x12')]=router; \ No newline at end of file +var _0x6713=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0xac835,_0x433cff){var _0x35f533=function(_0x33cc09){while(--_0x33cc09){_0xac835['push'](_0xac835['shift']());}};_0x35f533(++_0x433cff);}(_0x6713,0x109));var _0x3671=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x6713[_0xea8947];return _0x2455e9;};'use strict';var multer=require(_0x3671('0x0'));var util=require(_0x3671('0x1'));var path=require(_0x3671('0x2'));var timeout=require(_0x3671('0x3'));var express=require('express');var router=express[_0x3671('0x4')]();var fs_extra=require(_0x3671('0x5'));var auth=require(_0x3671('0x6'));var interaction=require(_0x3671('0x7'));var config=require(_0x3671('0x8'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x3671('0x9')](),controller[_0x3671('0xa')]);router[_0x3671('0xb')](_0x3671('0xc'),auth[_0x3671('0x9')](),controller[_0x3671('0xd')]);router[_0x3671('0xe')]('/',auth['isAuthenticated'](),controller[_0x3671('0xf')]);router[_0x3671('0x10')](_0x3671('0xc'),auth[_0x3671('0x9')](),controller['update']);router[_0x3671('0x11')](_0x3671('0xc'),auth[_0x3671('0x9')](),controller[_0x3671('0x12')]);module[_0x3671('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f223a7c..7f88e81 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 _0x7c7e=['sequelize','exports','INTEGER','STRING','*,*,*,*'];(function(_0x2ac1ca,_0x1e47d4){var _0x596155=function(_0x374f16){while(--_0x374f16){_0x2ac1ca['push'](_0x2ac1ca['shift']());}};_0x596155(++_0x1e47d4);}(_0x7c7e,0x19a));var _0xe7c7=function(_0x52efc5,_0x5a1d26){_0x52efc5=_0x52efc5-0x0;var _0xc9e03b=_0x7c7e[_0x52efc5];return _0xc9e03b;};'use strict';var Sequelize=require(_0xe7c7('0x0'));module[_0xe7c7('0x1')]={'priority':{'type':Sequelize[_0xe7c7('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe7c7('0x3')]},'interval':{'type':Sequelize[_0xe7c7('0x3')],'defaultValue':_0xe7c7('0x4')}}; \ No newline at end of file +var _0x6e5a=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x349352,_0x211a98){var _0x318305=function(_0x40ba35){while(--_0x40ba35){_0x349352['push'](_0x349352['shift']());}};_0x318305(++_0x211a98);}(_0x6e5a,0x1a5));var _0xa6e5=function(_0x2f486c,_0x70aa7e){_0x2f486c=_0x2f486c-0x0;var _0x248c68=_0x6e5a[_0x2f486c];return _0x248c68;};'use strict';var Sequelize=require(_0xa6e5('0x0'));module[_0xa6e5('0x1')]={'priority':{'type':Sequelize[_0xa6e5('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xa6e5('0x3')],'allowNull':![],'defaultValue':_0xa6e5('0x4')},'appdata':{'type':Sequelize[_0xa6e5('0x5')]()},'description':{'type':Sequelize[_0xa6e5('0x3')]},'interval':{'type':Sequelize[_0xa6e5('0x3')],'defaultValue':_0xa6e5('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index d6eb9ca..d7b7546 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 _0xffc0=['../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','WhatsappApplication','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','show','params','length','find','catch','create','body','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x56528a,_0x51ad4c){var _0x564f6b=function(_0x19262f){while(--_0x19262f){_0x56528a['push'](_0x56528a['shift']());}};_0x564f6b(++_0x51ad4c);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x394b8f,_0x45594c){_0x394b8f=_0x394b8f-0x0;var _0x8d3528=_0xffc0[_0x394b8f];return _0x8d3528;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0ffc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ffc('0x1'));var rp=require(_0x0ffc('0x2'));var moment=require(_0x0ffc('0x3'));var BPromise=require(_0x0ffc('0x4'));var Mustache=require(_0x0ffc('0x5'));var util=require(_0x0ffc('0x6'));var path=require(_0x0ffc('0x7'));var sox=require('sox');var csv=require(_0x0ffc('0x8'));var ejs=require(_0x0ffc('0x9'));var fs=require('fs');var fs_extra=require(_0x0ffc('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x8'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var Redis=require(_0x0ffc('0xf'));var authService=require(_0x0ffc('0x10'));var qs=require(_0x0ffc('0x11'));var as=require(_0x0ffc('0x12'));var hardwareService=require(_0x0ffc('0x13'));var logger=require(_0x0ffc('0x14'))(_0x0ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x0ffc('0x16'));var licenseUtil=require(_0x0ffc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e514,_0xbf12d1){_0xbf12d1=_0xbf12d1||0xcc;return function(_0x9622fe){if(_0x9622fe){return _0x19e514['sendStatus'](_0xbf12d1);}return _0x19e514[_0x0ffc('0x18')](_0xbf12d1)[_0x0ffc('0x19')]();};}function respondWithResult(_0x47a80b,_0x2095df){_0x2095df=_0x2095df||0xc8;return function(_0x137908){if(_0x137908){return _0x47a80b[_0x0ffc('0x18')](_0x2095df)[_0x0ffc('0x1a')](_0x137908);}};}function respondWithFilteredResult(_0x20edfc,_0x5034bc){return function(_0x35af98){if(_0x35af98){var _0x565921=typeof _0x5034bc[_0x0ffc('0x1b')]===_0x0ffc('0x1c')&&typeof _0x5034bc['limit']===_0x0ffc('0x1c');var _0x577e89=_0x35af98['count'];var _0x5b0018=_0x565921?0x0:_0x5034bc['offset'];var _0x314dab=_0x565921?_0x35af98[_0x0ffc('0x1d')]:_0x5034bc[_0x0ffc('0x1b')]+_0x5034bc[_0x0ffc('0x1e')];var _0x294f34;if(_0x314dab>=_0x577e89){_0x314dab=_0x577e89;_0x294f34=0xc8;}else{_0x294f34=0xce;}_0x20edfc['status'](_0x294f34);return _0x20edfc['set'](_0x0ffc('0x1f'),_0x5b0018+'-'+_0x314dab+'/'+_0x577e89)['json'](_0x35af98);}return null;};}function patchUpdates(_0x49e690){return function(_0x60ac9d){try{jsonpatch[_0x0ffc('0x20')](_0x60ac9d,_0x49e690,!![]);}catch(_0x49faaa){return BPromise[_0x0ffc('0x21')](_0x49faaa);}return _0x60ac9d[_0x0ffc('0x22')]();};}function saveUpdates(_0x27ae43,_0x527fd4){return function(_0x4ffd80){if(_0x4ffd80){return _0x4ffd80[_0x0ffc('0x23')](_0x27ae43)[_0x0ffc('0x24')](function(_0x418150){return _0x418150;});}return null;};}function removeEntity(_0x948451,_0x46b4e6){return function(_0x4d4294){if(_0x4d4294){return _0x4d4294['destroy']()[_0x0ffc('0x24')](function(){_0x948451['status'](0xcc)[_0x0ffc('0x19')]();});}};}function handleEntityNotFound(_0x5ad1b4,_0x25e3c0){return function(_0x136b0a){if(!_0x136b0a){_0x5ad1b4[_0x0ffc('0x25')](0x194);}return _0x136b0a;};}function handleError(_0x1265f5,_0x3968cc){_0x3968cc=_0x3968cc||0x1f4;return function(_0x34bce1){logger[_0x0ffc('0x26')](_0x34bce1[_0x0ffc('0x27')]);if(_0x34bce1['name']){delete _0x34bce1[_0x0ffc('0x28')];}_0x1265f5[_0x0ffc('0x18')](_0x3968cc)['send'](_0x34bce1);};}exports['index']=function(_0x40166f,_0x5f3a01){var _0x13c425={},_0x5d3cff={},_0x4ece4f={'count':0x0,'rows':[]};var _0x22eafd=_['map'](db[_0x0ffc('0x29')][_0x0ffc('0x2a')],function(_0x28c608){return{'name':_0x28c608['fieldName'],'type':_0x28c608[_0x0ffc('0x2b')][_0x0ffc('0x2c')]};});_0x5d3cff[_0x0ffc('0x2d')]=_[_0x0ffc('0x2e')](_0x22eafd,'name');_0x5d3cff[_0x0ffc('0x2f')]=_[_0x0ffc('0x30')](_0x40166f[_0x0ffc('0x2f')]);_0x5d3cff['filters']=_[_0x0ffc('0x31')](_0x5d3cff['model'],_0x5d3cff[_0x0ffc('0x2f')]);_0x13c425['attributes']=_[_0x0ffc('0x31')](_0x5d3cff[_0x0ffc('0x2d')],qs['fields'](_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x32')]));_0x13c425[_0x0ffc('0x33')]=_0x13c425[_0x0ffc('0x33')]['length']?_0x13c425[_0x0ffc('0x33')]:_0x5d3cff[_0x0ffc('0x2d')];if(!_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x34')](_0x0ffc('0x35'))){_0x13c425[_0x0ffc('0x1e')]=qs[_0x0ffc('0x1e')](_0x40166f['query'][_0x0ffc('0x1e')]);_0x13c425[_0x0ffc('0x1b')]=qs[_0x0ffc('0x1b')](_0x40166f[_0x0ffc('0x2f')]['offset']);}_0x13c425[_0x0ffc('0x36')]=qs[_0x0ffc('0x37')](_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x37')]);_0x13c425['where']=qs[_0x0ffc('0x38')](_[_0x0ffc('0x39')](_0x40166f[_0x0ffc('0x2f')],_0x5d3cff[_0x0ffc('0x38')]),_0x22eafd);if(_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3a')]){_0x13c425[_0x0ffc('0x3b')]=_[_0x0ffc('0x3c')](_0x13c425[_0x0ffc('0x3b')],{'$or':_['map'](_0x22eafd,function(_0x1d23d4){if(_0x1d23d4[_0x0ffc('0x2b')]!==_0x0ffc('0x3d')){var _0x2d5d00={};_0x2d5d00[_0x1d23d4['name']]={'$like':'%'+_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3a')]+'%'};return _0x2d5d00;}})});}_0x13c425=_[_0x0ffc('0x3c')]({},_0x13c425,_0x40166f[_0x0ffc('0x3e')]);var _0x2f9f98={'where':_0x13c425[_0x0ffc('0x3b')]};return db[_0x0ffc('0x29')][_0x0ffc('0x1d')](_0x2f9f98)[_0x0ffc('0x24')](function(_0x5cf45e){_0x4ece4f[_0x0ffc('0x1d')]=_0x5cf45e;if(_0x40166f[_0x0ffc('0x2f')][_0x0ffc('0x3f')]){_0x13c425[_0x0ffc('0x40')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x13c425);})['then'](function(_0x28105d){_0x4ece4f['rows']=_0x28105d;return _0x4ece4f;})[_0x0ffc('0x24')](respondWithFilteredResult(_0x5f3a01,_0x13c425))['catch'](handleError(_0x5f3a01,null));};exports[_0x0ffc('0x41')]=function(_0x1cb958,_0x50c005){var _0x54070c={'raw':!![],'where':{'id':_0x1cb958[_0x0ffc('0x42')]['id']}},_0x1bf431={};_0x1bf431['model']=_[_0x0ffc('0x30')](db[_0x0ffc('0x29')]['rawAttributes']);_0x1bf431['query']=_[_0x0ffc('0x30')](_0x1cb958['query']);_0x1bf431[_0x0ffc('0x38')]=_['intersection'](_0x1bf431['model'],_0x1bf431['query']);_0x54070c[_0x0ffc('0x33')]=_['intersection'](_0x1bf431[_0x0ffc('0x2d')],qs[_0x0ffc('0x32')](_0x1cb958[_0x0ffc('0x2f')]['fields']));_0x54070c[_0x0ffc('0x33')]=_0x54070c[_0x0ffc('0x33')][_0x0ffc('0x43')]?_0x54070c[_0x0ffc('0x33')]:_0x1bf431[_0x0ffc('0x2d')];if(_0x1cb958[_0x0ffc('0x2f')][_0x0ffc('0x3f')]){_0x54070c[_0x0ffc('0x40')]=[{'all':!![]}];}_0x54070c=_['merge']({},_0x54070c,_0x1cb958[_0x0ffc('0x3e')]);return db[_0x0ffc('0x29')][_0x0ffc('0x44')](_0x54070c)['then'](handleEntityNotFound(_0x50c005,null))[_0x0ffc('0x24')](respondWithResult(_0x50c005,null))[_0x0ffc('0x45')](handleError(_0x50c005,null));};exports[_0x0ffc('0x46')]=function(_0x2b16f7,_0x4a146f){return db[_0x0ffc('0x29')][_0x0ffc('0x46')](_0x2b16f7['body'],{})[_0x0ffc('0x24')](respondWithResult(_0x4a146f,0xc9))[_0x0ffc('0x45')](handleError(_0x4a146f,null));};exports['update']=function(_0x57e328,_0x18b774){if(_0x57e328[_0x0ffc('0x47')]['id']){delete _0x57e328[_0x0ffc('0x47')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x57e328[_0x0ffc('0x42')]['id']}})['then'](handleEntityNotFound(_0x18b774,null))[_0x0ffc('0x24')](saveUpdates(_0x57e328[_0x0ffc('0x47')],null))[_0x0ffc('0x24')](respondWithResult(_0x18b774,null))[_0x0ffc('0x45')](handleError(_0x18b774,null));};exports[_0x0ffc('0x48')]=function(_0x4a879a,_0x1b73b5){return db[_0x0ffc('0x29')][_0x0ffc('0x44')]({'where':{'id':_0x4a879a[_0x0ffc('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b73b5,null))['then'](removeEntity(_0x1b73b5,null))[_0x0ffc('0x45')](handleError(_0x1b73b5,null));}; \ No newline at end of file +var _0xa5c9=['fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','update','then','destroy','end','error','stack','name','send','index','WhatsappApplication','rawAttributes'];(function(_0x4dd9fe,_0x58e480){var _0x487390=function(_0x3d80af){while(--_0x3d80af){_0x4dd9fe['push'](_0x4dd9fe['shift']());}};_0x487390(++_0x58e480);}(_0xa5c9,0x143));var _0x9a5c=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xa5c9[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require(_0x9a5c('0x0'));var rimraf=require(_0x9a5c('0x1'));var zipdir=require(_0x9a5c('0x2'));var jsonpatch=require(_0x9a5c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a5c('0x4'));var Mustache=require(_0x9a5c('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a5c('0x6'));var ejs=require(_0x9a5c('0x7'));var fs=require('fs');var fs_extra=require(_0x9a5c('0x8'));var _=require(_0x9a5c('0x9'));var squel=require('squel');var crypto=require(_0x9a5c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9a5c('0xb'));var toCsv=require(_0x9a5c('0x6'));var querystring=require('querystring');var Papa=require(_0x9a5c('0xc'));var Redis=require(_0x9a5c('0xd'));var authService=require(_0x9a5c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a5c('0xf'));var logger=require(_0x9a5c('0x10'))(_0x9a5c('0x11'));var utils=require(_0x9a5c('0x12'));var config=require(_0x9a5c('0x13'));var licenseUtil=require(_0x9a5c('0x14'));var db=require(_0x9a5c('0x15'))['db'];function respondWithStatusCode(_0x957b17,_0x1e81b7){_0x1e81b7=_0x1e81b7||0xcc;return function(_0x381229){if(_0x381229){return _0x957b17[_0x9a5c('0x16')](_0x1e81b7);}return _0x957b17[_0x9a5c('0x17')](_0x1e81b7)['end']();};}function respondWithResult(_0x44da1b,_0x3c39d6){_0x3c39d6=_0x3c39d6||0xc8;return function(_0x2b1cef){if(_0x2b1cef){return _0x44da1b['status'](_0x3c39d6)[_0x9a5c('0x18')](_0x2b1cef);}};}function respondWithFilteredResult(_0x1f008e,_0x5d5f74){return function(_0x16422d){if(_0x16422d){var _0x5ef98e=typeof _0x5d5f74[_0x9a5c('0x19')]==='undefined'&&typeof _0x5d5f74[_0x9a5c('0x1a')]===_0x9a5c('0x1b');var _0x59e410=_0x16422d[_0x9a5c('0x1c')];var _0x3f06b6=_0x5ef98e?0x0:_0x5d5f74[_0x9a5c('0x19')];var _0x4bb262=_0x5ef98e?_0x16422d[_0x9a5c('0x1c')]:_0x5d5f74[_0x9a5c('0x19')]+_0x5d5f74[_0x9a5c('0x1a')];var _0x5e2bd3;if(_0x4bb262>=_0x59e410){_0x4bb262=_0x59e410;_0x5e2bd3=0xc8;}else{_0x5e2bd3=0xce;}_0x1f008e[_0x9a5c('0x17')](_0x5e2bd3);return _0x1f008e[_0x9a5c('0x1d')]('Content-Range',_0x3f06b6+'-'+_0x4bb262+'/'+_0x59e410)[_0x9a5c('0x18')](_0x16422d);}return null;};}function patchUpdates(_0x41283c){return function(_0xe42960){try{jsonpatch['apply'](_0xe42960,_0x41283c,!![]);}catch(_0xf121cd){return BPromise[_0x9a5c('0x1e')](_0xf121cd);}return _0xe42960['save']();};}function saveUpdates(_0x2b3d20,_0x191881){return function(_0x5659b4){if(_0x5659b4){return _0x5659b4[_0x9a5c('0x1f')](_0x2b3d20)[_0x9a5c('0x20')](function(_0x214b65){return _0x214b65;});}return null;};}function removeEntity(_0x5719eb,_0x17dc2f){return function(_0x3f7d13){if(_0x3f7d13){return _0x3f7d13[_0x9a5c('0x21')]()[_0x9a5c('0x20')](function(){_0x5719eb[_0x9a5c('0x17')](0xcc)[_0x9a5c('0x22')]();});}};}function handleEntityNotFound(_0x47a13a,_0x538e65){return function(_0x34c636){if(!_0x34c636){_0x47a13a[_0x9a5c('0x16')](0x194);}return _0x34c636;};}function handleError(_0x10db7a,_0x3713fd){_0x3713fd=_0x3713fd||0x1f4;return function(_0x573412){logger[_0x9a5c('0x23')](_0x573412[_0x9a5c('0x24')]);if(_0x573412[_0x9a5c('0x25')]){delete _0x573412[_0x9a5c('0x25')];}_0x10db7a[_0x9a5c('0x17')](_0x3713fd)[_0x9a5c('0x26')](_0x573412);};}exports[_0x9a5c('0x27')]=function(_0x4146c9,_0x3d3356){var _0x4e6cee={},_0x2bdb5b={},_0x5e22ab={'count':0x0,'rows':[]};var _0x4dac2a=_['map'](db[_0x9a5c('0x28')][_0x9a5c('0x29')],function(_0x214953){return{'name':_0x214953[_0x9a5c('0x2a')],'type':_0x214953[_0x9a5c('0x2b')][_0x9a5c('0x2c')]};});_0x2bdb5b['model']=_[_0x9a5c('0x2d')](_0x4dac2a,_0x9a5c('0x25'));_0x2bdb5b[_0x9a5c('0x2e')]=_['keys'](_0x4146c9[_0x9a5c('0x2e')]);_0x2bdb5b[_0x9a5c('0x2f')]=_[_0x9a5c('0x30')](_0x2bdb5b[_0x9a5c('0x31')],_0x2bdb5b['query']);_0x4e6cee[_0x9a5c('0x32')]=_['intersection'](_0x2bdb5b[_0x9a5c('0x31')],qs['fields'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x33')]));_0x4e6cee[_0x9a5c('0x32')]=_0x4e6cee[_0x9a5c('0x32')][_0x9a5c('0x34')]?_0x4e6cee[_0x9a5c('0x32')]:_0x2bdb5b['model'];if(!_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x35')](_0x9a5c('0x36'))){_0x4e6cee[_0x9a5c('0x1a')]=qs['limit'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x1a')]);_0x4e6cee['offset']=qs[_0x9a5c('0x19')](_0x4146c9[_0x9a5c('0x2e')]['offset']);}_0x4e6cee[_0x9a5c('0x37')]=qs['sort'](_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x38')]);_0x4e6cee[_0x9a5c('0x39')]=qs[_0x9a5c('0x2f')](_[_0x9a5c('0x3a')](_0x4146c9['query'],_0x2bdb5b['filters']),_0x4dac2a);if(_0x4146c9['query']['filter']){_0x4e6cee[_0x9a5c('0x39')]=_[_0x9a5c('0x3b')](_0x4e6cee[_0x9a5c('0x39')],{'$or':_[_0x9a5c('0x2d')](_0x4dac2a,function(_0x27de82){if(_0x27de82[_0x9a5c('0x2b')]!==_0x9a5c('0x3c')){var _0x24879e={};_0x24879e[_0x27de82[_0x9a5c('0x25')]]={'$like':'%'+_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x3d')]+'%'};return _0x24879e;}})});}_0x4e6cee=_['merge']({},_0x4e6cee,_0x4146c9[_0x9a5c('0x3e')]);var _0x158376={'where':_0x4e6cee[_0x9a5c('0x39')]};return db[_0x9a5c('0x28')]['count'](_0x158376)[_0x9a5c('0x20')](function(_0x3394a8){_0x5e22ab['count']=_0x3394a8;if(_0x4146c9[_0x9a5c('0x2e')][_0x9a5c('0x3f')]){_0x4e6cee[_0x9a5c('0x40')]=[{'all':!![]}];}return db[_0x9a5c('0x28')][_0x9a5c('0x41')](_0x4e6cee);})[_0x9a5c('0x20')](function(_0xd61373){_0x5e22ab[_0x9a5c('0x42')]=_0xd61373;return _0x5e22ab;})[_0x9a5c('0x20')](respondWithFilteredResult(_0x3d3356,_0x4e6cee))[_0x9a5c('0x43')](handleError(_0x3d3356,null));};exports['show']=function(_0x5886a1,_0x13e866){var _0x3456a7={'raw':!![],'where':{'id':_0x5886a1[_0x9a5c('0x44')]['id']}},_0x4097a6={};_0x4097a6[_0x9a5c('0x31')]=_[_0x9a5c('0x45')](db[_0x9a5c('0x28')][_0x9a5c('0x29')]);_0x4097a6[_0x9a5c('0x2e')]=_[_0x9a5c('0x45')](_0x5886a1[_0x9a5c('0x2e')]);_0x4097a6[_0x9a5c('0x2f')]=_['intersection'](_0x4097a6['model'],_0x4097a6[_0x9a5c('0x2e')]);_0x3456a7[_0x9a5c('0x32')]=_['intersection'](_0x4097a6[_0x9a5c('0x31')],qs[_0x9a5c('0x33')](_0x5886a1['query']['fields']));_0x3456a7['attributes']=_0x3456a7[_0x9a5c('0x32')]['length']?_0x3456a7[_0x9a5c('0x32')]:_0x4097a6[_0x9a5c('0x31')];if(_0x5886a1['query'][_0x9a5c('0x3f')]){_0x3456a7[_0x9a5c('0x40')]=[{'all':!![]}];}_0x3456a7=_['merge']({},_0x3456a7,_0x5886a1[_0x9a5c('0x3e')]);return db[_0x9a5c('0x28')]['find'](_0x3456a7)['then'](handleEntityNotFound(_0x13e866,null))[_0x9a5c('0x20')](respondWithResult(_0x13e866,null))[_0x9a5c('0x43')](handleError(_0x13e866,null));};exports[_0x9a5c('0x46')]=function(_0x4fb79f,_0x3ffede){return db[_0x9a5c('0x28')][_0x9a5c('0x46')](_0x4fb79f[_0x9a5c('0x47')],{})['then'](respondWithResult(_0x3ffede,0xc9))[_0x9a5c('0x43')](handleError(_0x3ffede,null));};exports[_0x9a5c('0x1f')]=function(_0x5880ab,_0x28a097){if(_0x5880ab[_0x9a5c('0x47')]['id']){delete _0x5880ab[_0x9a5c('0x47')]['id'];}return db[_0x9a5c('0x28')][_0x9a5c('0x48')]({'where':{'id':_0x5880ab[_0x9a5c('0x44')]['id']}})[_0x9a5c('0x20')](handleEntityNotFound(_0x28a097,null))['then'](saveUpdates(_0x5880ab[_0x9a5c('0x47')],null))['then'](respondWithResult(_0x28a097,null))[_0x9a5c('0x43')](handleError(_0x28a097,null));};exports['destroy']=function(_0x45a394,_0x281139){return db['WhatsappApplication'][_0x9a5c('0x48')]({'where':{'id':_0x45a394['params']['id']}})['then'](handleEntityNotFound(_0x281139,null))[_0x9a5c('0x20')](removeEntity(_0x281139,null))[_0x9a5c('0x43')](handleError(_0x281139,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5c7fd07..11fb4ea 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 _0x89f7=['moment','request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger'];(function(_0xf5ae13,_0x4861f6){var _0x11b847=function(_0x28b042){while(--_0x28b042){_0xf5ae13['push'](_0xf5ae13['shift']());}};_0x11b847(++_0x4861f6);}(_0x89f7,0x105));var _0x789f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0x89f7[_0xac0de1];return _0x1c1995;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var logger=require(_0x789f('0x2'))('api');var moment=require(_0x789f('0x3'));var BPromise=require('bluebird');var rp=require(_0x789f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x789f('0x5'));var config=require(_0x789f('0x6'));var attributes=require(_0x789f('0x7'));module[_0x789f('0x8')]=function(_0x5d7abe,_0x273a16){return _0x5d7abe[_0x789f('0x9')](_0x789f('0xa'),attributes,{'tableName':_0x789f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9009=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1385f0,_0x5550bb){var _0x36ca00=function(_0x1bc769){while(--_0x1bc769){_0x1385f0['push'](_0x1385f0['shift']());}};_0x36ca00(++_0x5550bb);}(_0x9009,0x1d4));var _0x9900=function(_0x356bf3,_0x17ed21){_0x356bf3=_0x356bf3-0x0;var _0x42d22=_0x9009[_0x356bf3];return _0x42d22;};'use strict';var _=require(_0x9900('0x0'));var util=require('util');var logger=require(_0x9900('0x1'))(_0x9900('0x2'));var moment=require('moment');var BPromise=require(_0x9900('0x3'));var rp=require(_0x9900('0x4'));var fs=require('fs');var path=require(_0x9900('0x5'));var rimraf=require(_0x9900('0x6'));var config=require('../../config/environment');var attributes=require(_0x9900('0x7'));module[_0x9900('0x8')]=function(_0x502dac,_0x59dd25){return _0x502dac[_0x9900('0x9')](_0x9900('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9900('0xb'),'collate':_0x9900('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index f864b3b..a602c0b 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 _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s'];(function(_0x22b18a,_0x5744fc){var _0x32ce7e=function(_0x296be8){while(--_0x296be8){_0x22b18a['push'](_0x22b18a['shift']());}};_0x32ce7e(++_0x5744fc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x00bb[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('WhatsappApplication,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});} \ No newline at end of file +var _0xb458=['WhatsappApplication,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','debug'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb458,0x103));var _0x8b45=function(_0x41aa4d,_0x51e45f){_0x41aa4d=_0x41aa4d-0x0;var _0x3fb7d6=_0xb458[_0x41aa4d];return _0x3fb7d6;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index b51f5fc..0825c22 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 _0xa1f6=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x372515,_0xdd11f){var _0xa3bf4e=function(_0x212cc8){while(--_0x212cc8){_0x372515['push'](_0x372515['shift']());}};_0xa3bf4e(++_0xdd11f);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xa1f6[_0x5f519b];return _0x2461e2;};'use strict';var multer=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var path=require(_0x6a1f('0x2'));var timeout=require(_0x6a1f('0x3'));var express=require(_0x6a1f('0x4'));var router=express[_0x6a1f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6a1f('0x6')]('/',auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x8')]);router[_0x6a1f('0x6')](_0x6a1f('0x9'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xa')]);router['get'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0xc')]);router[_0x6a1f('0x6')](_0x6a1f('0xd'),auth['isAuthenticated'](),controller[_0x6a1f('0xe')]);router[_0x6a1f('0x6')](_0x6a1f('0xf'),auth[_0x6a1f('0x7')](),controller['download']);router[_0x6a1f('0x10')]('/',auth['isAuthenticated'](),controller[_0x6a1f('0x11')]);router[_0x6a1f('0x10')](_0x6a1f('0xd'),auth[_0x6a1f('0x7')](),controller[_0x6a1f('0x12')]);router[_0x6a1f('0x10')](_0x6a1f('0x13'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x16')),controller[_0x6a1f('0x17')]);router[_0x6a1f('0x18')](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x19')),controller[_0x6a1f('0x1a')]);router['delete'](_0x6a1f('0xb'),auth[_0x6a1f('0x7')](),interaction[_0x6a1f('0x14')](_0x6a1f('0x15'),_0x6a1f('0x1b')),controller[_0x6a1f('0x1c')]);router[_0x6a1f('0x1d')](_0x6a1f('0x13'),auth['isAuthenticated'](),controller[_0x6a1f('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x9fe7=['download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download'];(function(_0x58bf5f,_0x477093){var _0x2e5e88=function(_0xb80b66){while(--_0xb80b66){_0x58bf5f['push'](_0x58bf5f['shift']());}};_0x2e5e88(++_0x477093);}(_0x9fe7,0x1df));var _0x79fe=function(_0x39b685,_0x2da95e){_0x39b685=_0x39b685-0x0;var _0x2999d8=_0x9fe7[_0x39b685];return _0x2999d8;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMessages']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['post']('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x12')]);router[_0x79fe('0x13')](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x13')](_0x79fe('0x15'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x18')),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x1b')),controller[_0x79fe('0x1c')]);router['delete'](_0x79fe('0xc'),auth[_0x79fe('0xd')](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x79fe('0x1d')](_0x79fe('0x15'),auth[_0x79fe('0xd')](),controller['removeTags']);module[_0x79fe('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index efc9dd5..350681a 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 _0xed5f=['DATE','ENUM','out','moment','exports','BOOLEAN','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xed5f,0x1e6));var _0xfed5=function(_0x4ffe36,_0x309e69){_0x4ffe36=_0x4ffe36-0x0;var _0x2bb16f=_0xed5f[_0x4ffe36];return _0x2bb16f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfed5('0x0'));module[_0xfed5('0x1')]={'closed':{'type':Sequelize[_0xfed5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfed5('0x3')]},'secondDisposition':{'type':Sequelize[_0xfed5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xfed5('0x3')]},'note':{'type':Sequelize[_0xfed5('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xfed5('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfed5('0x5')]('in',_0xfed5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5a2a=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x4d0662,_0x145963){var _0x6eea6d=function(_0x2def06){while(--_0x2def06){_0x4d0662['push'](_0x4d0662['shift']());}};_0x6eea6d(++_0x145963);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x5be247,_0x195eb6){_0x5be247=_0x5be247-0x0;var _0x3a04c9=_0x5a2a[_0x5be247];return _0x3a04c9;};'use strict';var Sequelize=require(_0xa5a2('0x0'));var moment=require(_0xa5a2('0x1'));module[_0xa5a2('0x2')]={'closed':{'type':Sequelize[_0xa5a2('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa5a2('0x4')]},'note':{'type':Sequelize[_0xa5a2('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xa5a2('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xa5a2('0x6')]('in',_0xa5a2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa5a2('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa5a2('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 85587ae..ae3a0f4 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 _0xabd8=['spread','Tag','color','whatsappInteractionTags:save','removeTags','unix','toString','root','server','files','tmp','attachments','join','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','disposition','Messages','basename','existsSync','createReadStream','createWriteStream','out','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','download','log','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','attributes','length','includeAll','include','merge','options','find','create','body','describe','WhatsappMessage','addMessage','ids','omit','intersection','fields','nolimit','sort','where','pick','filter','$gte','split','rows','addTags','setTags'];(function(_0x7398e9,_0x39b11c){var _0x502bd4=function(_0x441fe5){while(--_0x441fe5){_0x7398e9['push'](_0x7398e9['shift']());}};_0x502bd4(++_0x39b11c);}(_0xabd8,0xa8));var _0x8abd=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xabd8[_0x13b02f];return _0x12e9a6;};'use strict';var rimraf=require(_0x8abd('0x0'));var zipdir=require(_0x8abd('0x1'));var moment=require('moment');var BPromise=require(_0x8abd('0x2'));var util=require(_0x8abd('0x3'));var path=require(_0x8abd('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8abd('0x5'));var Redis=require(_0x8abd('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0x8abd('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x8abd('0x8'));var config=require('../../config/environment');var db=require(_0x8abd('0x9'))['db'];config['redis']=_[_0x8abd('0xa')](config['redis'],{'host':_0x8abd('0xb'),'port':0x18eb});var socket=require(_0x8abd('0xc'))(new Redis(config[_0x8abd('0xd')]));require(_0x8abd('0xe'))[_0x8abd('0xf')](socket);function respondWithStatusCode(_0x2dc7ad,_0x4e4874){_0x4e4874=_0x4e4874||0xcc;return function(_0x1cba7f){if(_0x1cba7f){return _0x2dc7ad[_0x8abd('0x10')](_0x4e4874);}return _0x2dc7ad[_0x8abd('0x11')](_0x4e4874)[_0x8abd('0x12')]();};}function respondWithResult(_0x11d065,_0x4addd9){_0x4addd9=_0x4addd9||0xc8;return function(_0x10b96c){if(_0x10b96c){return _0x11d065['status'](_0x4addd9)[_0x8abd('0x13')](_0x10b96c);}};}function respondWithFilteredResult(_0x24f0a9,_0x150dd9){return function(_0x358488){if(_0x358488){var _0x374521=typeof _0x150dd9[_0x8abd('0x14')]===_0x8abd('0x15')&&typeof _0x150dd9[_0x8abd('0x16')]===_0x8abd('0x15');var _0x3e697c=_0x358488[_0x8abd('0x17')];var _0x3a8d3d=_0x374521?0x0:_0x150dd9[_0x8abd('0x14')];var _0x19657a=_0x374521?_0x358488[_0x8abd('0x17')]:_0x150dd9[_0x8abd('0x14')]+_0x150dd9['limit'];var _0x1d2149;if(_0x19657a>=_0x3e697c){_0x19657a=_0x3e697c;_0x1d2149=0xc8;}else{_0x1d2149=0xce;}_0x24f0a9[_0x8abd('0x11')](_0x1d2149);return _0x24f0a9[_0x8abd('0x18')]('Content-Range',_0x3a8d3d+'-'+_0x19657a+'/'+_0x3e697c)['json'](_0x358488);}return null;};}function saveUpdates(_0x2a1633){return function(_0x2af088){if(_0x2af088){return _0x2af088[_0x8abd('0x19')](_0x2a1633)['then'](function(_0x27b3c0){return _0x27b3c0;});}return null;};}function removeEntity(_0x3f2542){return function(_0x40fc69){if(_0x40fc69){return _0x40fc69[_0x8abd('0x1a')]()[_0x8abd('0x1b')](function(){_0x3f2542[_0x8abd('0x11')](0xcc)[_0x8abd('0x12')]();});}};}function handleEntityNotFound(_0x5bd9b2){return function(_0x3c52e2){if(!_0x3c52e2){_0x5bd9b2['sendStatus'](0x194);}return _0x3c52e2;};}function handleError(_0x3c4be9,_0x118902){_0x118902=_0x118902||0x1f4;return function(_0x15090f){logger['error'](_0x15090f['stack']);if(_0x15090f[_0x8abd('0x1c')]){delete _0x15090f['name'];}_0x3c4be9[_0x8abd('0x11')](_0x118902)[_0x8abd('0x1d')](_0x15090f);};}exports['index']=function(_0x3a030c,_0x1bd8a9){var _0x71453b={};var _0x46d27b=_[_0x8abd('0x1e')](db[_0x8abd('0x1f')][_0x8abd('0x20')],function(_0x53c92c){return{'name':_0x53c92c[_0x8abd('0x21')],'type':_0x53c92c[_0x8abd('0x22')][_0x8abd('0x23')]};});_0x71453b=qs[_0x8abd('0x24')](_0x46d27b,_0x3a030c);return interaction[_0x8abd('0x25')](_0x8abd('0x26'),_0x3a030c[_0x8abd('0x27')],_0x3a030c['user'],_0x71453b,_0x46d27b)[_0x8abd('0x1b')](respondWithFilteredResult(_0x1bd8a9,_0x71453b))[_0x8abd('0x28')](handleError(_0x1bd8a9,null));};exports[_0x8abd('0x29')]=function(_0x5a3ce8,_0x52266b){var _0x26073f={'raw':![],'where':{'id':_0x5a3ce8[_0x8abd('0x2a')]['id']}},_0x210f7d={};_0x210f7d[_0x8abd('0x2b')]=_[_0x8abd('0x2c')](db[_0x8abd('0x1f')][_0x8abd('0x20')]);_0x210f7d[_0x8abd('0x27')]=_[_0x8abd('0x2c')](_0x5a3ce8['query']);_0x210f7d[_0x8abd('0x2d')]=_['intersection'](_0x210f7d[_0x8abd('0x2b')],_0x210f7d[_0x8abd('0x27')]);_0x26073f['attributes']=_['intersection'](_0x210f7d[_0x8abd('0x2b')],qs['fields'](_0x5a3ce8[_0x8abd('0x27')]['fields']));_0x26073f[_0x8abd('0x2e')]=_0x26073f['attributes'][_0x8abd('0x2f')]?_0x26073f[_0x8abd('0x2e')]:_0x210f7d[_0x8abd('0x2b')];if(_0x5a3ce8[_0x8abd('0x27')][_0x8abd('0x30')]){_0x26073f[_0x8abd('0x31')]=[{'all':!![]}];}_0x26073f=_[_0x8abd('0x32')]({},_0x26073f,_0x5a3ce8[_0x8abd('0x33')]);return db[_0x8abd('0x1f')][_0x8abd('0x34')](_0x26073f)[_0x8abd('0x1b')](handleEntityNotFound(_0x52266b,null))[_0x8abd('0x1b')](respondWithResult(_0x52266b,null))['catch'](handleError(_0x52266b,null));};exports[_0x8abd('0x35')]=function(_0x50ae4e,_0x3fe6ed){return db[_0x8abd('0x1f')][_0x8abd('0x35')](_0x50ae4e[_0x8abd('0x36')],{})[_0x8abd('0x1b')](respondWithResult(_0x3fe6ed,0xc9))[_0x8abd('0x28')](handleError(_0x3fe6ed,null));};exports[_0x8abd('0x19')]=function(_0x583c7e,_0x2ef012){if(_0x583c7e[_0x8abd('0x36')]['id']){delete _0x583c7e[_0x8abd('0x36')]['id'];}return db['WhatsappInteraction'][_0x8abd('0x34')]({'where':{'id':_0x583c7e['params']['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x2ef012,null))['then'](saveUpdates(_0x583c7e[_0x8abd('0x36')],null))[_0x8abd('0x1b')](respondWithResult(_0x2ef012,null))['catch'](handleError(_0x2ef012,null));};exports[_0x8abd('0x1a')]=function(_0x21f510,_0x58712e){return db[_0x8abd('0x1f')]['find']({'where':{'id':_0x21f510[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x58712e,null))['then'](removeEntity(_0x58712e,null))[_0x8abd('0x28')](handleError(_0x58712e,null));};exports[_0x8abd('0x37')]=function(_0x1be389,_0x395dcb){return db['WhatsappInteraction'][_0x8abd('0x37')]()['then'](respondWithResult(_0x395dcb,null))[_0x8abd('0x28')](handleError(_0x395dcb,null));};exports['addMessage']=function(_0x2f8be8,_0x556045){return db[_0x8abd('0x38')]['find']({'where':{'id':_0x2f8be8[_0x8abd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x556045,null))[_0x8abd('0x1b')](function(_0x128df1){if(_0x128df1){return _0x128df1[_0x8abd('0x39')](_0x2f8be8[_0x8abd('0x36')][_0x8abd('0x3a')],_[_0x8abd('0x3b')](_0x2f8be8[_0x8abd('0x36')],[_0x8abd('0x3a'),'id'])||{});}})[_0x8abd('0x1b')](respondWithResult(_0x556045,null))[_0x8abd('0x28')](handleError(_0x556045,null));};exports['getMessages']=function(_0xd52732,_0x6ca53a){var _0x4e22bf={'raw':![],'where':{}};var _0x14c5cd={};var _0x3dc82b={'count':0x0,'rows':[]};return db['WhatsappInteraction']['findOne']({'where':{'id':_0xd52732[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x6ca53a,null))[_0x8abd('0x1b')](function(_0xc41319){if(_0xc41319){_0x14c5cd[_0x8abd('0x2b')]=_['keys'](db['WhatsappMessage'][_0x8abd('0x20')]);_0x14c5cd['query']=_[_0x8abd('0x2c')](_0xd52732[_0x8abd('0x27')]);_0x14c5cd[_0x8abd('0x2d')]=_[_0x8abd('0x3c')](_0x14c5cd[_0x8abd('0x2b')],_0x14c5cd[_0x8abd('0x27')]);_0x4e22bf['attributes']=_['intersection'](_0x14c5cd['model'],qs[_0x8abd('0x3d')](_0xd52732[_0x8abd('0x27')][_0x8abd('0x3d')]));_0x4e22bf[_0x8abd('0x2e')]=_0x4e22bf[_0x8abd('0x2e')]['length']?_0x4e22bf['attributes']:_0x14c5cd[_0x8abd('0x2b')];if(!_0xd52732[_0x8abd('0x27')]['hasOwnProperty'](_0x8abd('0x3e'))){_0x4e22bf[_0x8abd('0x16')]=qs[_0x8abd('0x16')](_0xd52732['query'][_0x8abd('0x16')]);_0x4e22bf[_0x8abd('0x14')]=qs[_0x8abd('0x14')](_0xd52732[_0x8abd('0x27')]['offset']);}_0x4e22bf['order']=qs['sort'](_0xd52732[_0x8abd('0x27')][_0x8abd('0x3f')]);_0x4e22bf[_0x8abd('0x40')]=qs[_0x8abd('0x2d')](_[_0x8abd('0x41')](_0xd52732['query'],_0x14c5cd[_0x8abd('0x2d')]));_0x4e22bf[_0x8abd('0x40')]['WhatsappInteractionId']=_0xc41319['id'];if(_0xd52732[_0x8abd('0x27')][_0x8abd('0x42')]){_0x4e22bf['where']=_[_0x8abd('0x32')](_0x4e22bf[_0x8abd('0x40')],{'$or':_[_0x8abd('0x1e')](_0x4e22bf['attributes'],function(_0x188521){var _0x110938={};_0x110938[_0x188521]={'$like':'%'+_0xd52732[_0x8abd('0x27')][_0x8abd('0x42')]+'%'};return _0x110938;})});}if(_0xd52732['query']['$gte']){var _0x33b420=_0xd52732['query'][_0x8abd('0x43')][_0x8abd('0x44')](',');var _0x4fec66={};_0x4fec66[_0x33b420[0x0]]={'$gte':moment(_0x33b420[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x4e22bf[_0x8abd('0x40')]=_['merge'](_0x4e22bf['where'],_0x4fec66);}_0x4e22bf=_['merge']({},_0x4e22bf,_0xd52732['options']);return db[_0x8abd('0x38')][_0x8abd('0x17')]({'where':_0x4e22bf['where']})['then'](function(_0xcbbc0b){_0x3dc82b[_0x8abd('0x17')]=_0xcbbc0b;if(_0xd52732[_0x8abd('0x27')]['includeAll']){_0x4e22bf['include']=[{'all':!![]}];}return db[_0x8abd('0x38')][_0x8abd('0x25')](_0x4e22bf);})[_0x8abd('0x1b')](function(_0xcddaff){_0x3dc82b[_0x8abd('0x45')]=_0xcddaff;return _0x3dc82b;});}})[_0x8abd('0x1b')](respondWithFilteredResult(_0x6ca53a,_0x4e22bf))[_0x8abd('0x28')](handleError(_0x6ca53a,null));};exports[_0x8abd('0x46')]=function(_0x46e6ff,_0x51b3cf){return db[_0x8abd('0x1f')][_0x8abd('0x34')]({'where':{'id':_0x46e6ff[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x51b3cf,null))[_0x8abd('0x1b')](function(_0x9e2745){if(_0x9e2745){return _0x9e2745[_0x8abd('0x47')](_0x46e6ff[_0x8abd('0x36')][_0x8abd('0x3a')],_[_0x8abd('0x3b')](_0x46e6ff['body'],[_0x8abd('0x3a'),'id'])||{})[_0x8abd('0x48')](function(){return db[_0x8abd('0x49')][_0x8abd('0x25')]({'attributes':['id',_0x8abd('0x1c'),_0x8abd('0x4a')],'where':{'id':_0x46e6ff[_0x8abd('0x36')][_0x8abd('0x3a')]}});})['then'](function(_0x1e0ab5){socket['emit'](_0x8abd('0x4b'),{'id':Number(_0x46e6ff[_0x8abd('0x2a')]['id']),'tags':_0x1e0ab5||[]});return{'id':Number(_0x46e6ff['params']['id']),'tags':_0x1e0ab5||[]};});}})['then'](respondWithResult(_0x51b3cf,null))[_0x8abd('0x28')](handleError(_0x51b3cf,null));};exports[_0x8abd('0x4c')]=function(_0x331192,_0x434953){return db[_0x8abd('0x1f')][_0x8abd('0x34')]({'where':{'id':_0x331192[_0x8abd('0x2a')]['id']}})[_0x8abd('0x1b')](handleEntityNotFound(_0x434953,null))[_0x8abd('0x1b')](function(_0x9be420){if(_0x9be420){return _0x9be420[_0x8abd('0x4c')](_0x331192[_0x8abd('0x27')][_0x8abd('0x3a')]);}})[_0x8abd('0x1b')](respondWithStatusCode(_0x434953,null))['catch'](handleError(_0x434953,null));};exports['download']=function(_0x1e1e3e,_0x4889ca){var _0x51d6b8=moment()[_0x8abd('0x4d')]()[_0x8abd('0x4e')]();var _0x4c6672=path['join'](config[_0x8abd('0x4f')],_0x8abd('0x50'),_0x8abd('0x51'),_0x8abd('0x52'));var _0x369995=path['join'](config[_0x8abd('0x4f')],_0x8abd('0x50'),_0x8abd('0x51'),_0x8abd('0x53'));var _0x2896b2=path[_0x8abd('0x54')](_0x4c6672,_0x51d6b8);var _0x13eee5=util[_0x8abd('0x55')](_0x8abd('0x56'),_0x1e1e3e[_0x8abd('0x2a')]['id'],_0x51d6b8);var _0x49a287=path['join'](_0x4c6672,_0x13eee5);var _0x21c922=[];_0x21c922[_0x8abd('0x57')]({'model':db[_0x8abd('0x58')],'as':'User','attributes':['id',_0x8abd('0x59')],'raw':!![]});_0x21c922[_0x8abd('0x57')]({'model':db['CmContact'],'as':_0x8abd('0x5a'),'attributes':['id',_0x8abd('0x5b'),_0x8abd('0x5c')],'raw':!![]});if(_0x1e1e3e[_0x8abd('0x27')][_0x8abd('0x53')]){_0x21c922['push']({'model':db[_0x8abd('0x5d')],'as':_0x8abd('0x5d'),'raw':!![]});}var _0x2457d8=[{'model':db[_0x8abd('0x38')],'as':'Messages','attributes':['id',_0x8abd('0x36'),'createdAt',_0x8abd('0x5e'),_0x8abd('0x5f'),_0x8abd('0x60')],'include':_0x21c922}];_0x2457d8['push']({'model':db[_0x8abd('0x61')],'as':_0x8abd('0x62'),'attributes':['id','name']});_0x2457d8['push']({'model':db['User'],'as':_0x8abd('0x63'),'attributes':['id',_0x8abd('0x59')]});return db['WhatsappInteraction'][_0x8abd('0x34')]({'where':{'id':_0x1e1e3e['params']['id']},'include':_0x2457d8})['then'](handleEntityNotFound(_0x4889ca,null))[_0x8abd('0x1b')](function(_0x2fd107){if(_0x2fd107){var _0x309539=_0x2fd107[_0x8abd('0x64')]({'plain':!![]});fs[_0x8abd('0x65')](_0x2896b2);var _0x565e4b={'channel':_0x8abd('0x66'),'account':_0x309539[_0x8abd('0x62')][_0x8abd('0x1c')],'agent':_0x309539[_0x8abd('0x63')]?_0x309539[_0x8abd('0x63')]['fullname']:_0x8abd('0x67'),'createdAt':moment(_0x309539[_0x8abd('0x68')])['format'](_0x8abd('0x69'))[_0x8abd('0x4e')](),'closedAt':_0x309539['closed']?moment(_0x309539['closedAt'])[_0x8abd('0x55')](_0x8abd('0x69'))[_0x8abd('0x4e')]():'','disposition':_0x309539[_0x8abd('0x6a')],'messages':_(_0x309539[_0x8abd('0x6b')])[_0x8abd('0x42')]({'secret':![]})[_0x8abd('0x1e')](function(_0x96215b){if(_0x96215b[_0x8abd('0x5d')]){var _0xa30c2d=path[_0x8abd('0x54')](_0x369995,_0x96215b[_0x8abd('0x5d')][_0x8abd('0x6c')]);if(fs[_0x8abd('0x6d')](_0xa30c2d)){fs[_0x8abd('0x6e')](_0xa30c2d)['pipe'](fs[_0x8abd('0x6f')](path[_0x8abd('0x54')](_0x2896b2,_0x96215b[_0x8abd('0x5d')]['basename'])));}}return{'date':moment(_0x96215b[_0x8abd('0x68')])[_0x8abd('0x55')](_0x8abd('0x69'))[_0x8abd('0x4e')](),'sender':_0x96215b[_0x8abd('0x5e')]===_0x8abd('0x70')?_0x96215b[_0x8abd('0x58')]?_0x96215b[_0x8abd('0x58')][_0x8abd('0x59')]:'System':_0x96215b[_0x8abd('0x5a')][_0x8abd('0x5b')]+(_0x96215b[_0x8abd('0x5a')][_0x8abd('0x5c')]?'\x20'+_0x96215b[_0x8abd('0x5a')]['lastName']:''),'body':_0x96215b[_0x8abd('0x5d')]?_0x96215b[_0x8abd('0x5d')][_0x8abd('0x6c')]:_0x96215b[_0x8abd('0x36')],'direction':_0x96215b[_0x8abd('0x5e')]===_0x8abd('0x70')?'A':'C','secret':_0x96215b[_0x8abd('0x5f')],'read':_0x96215b[_0x8abd('0x60')],'attachment':_0x96215b[_0x8abd('0x5d')]};})[_0x8abd('0x71')]()};return ejs[_0x8abd('0x72')](path[_0x8abd('0x54')](config[_0x8abd('0x4f')],_0x8abd('0x50'),'views',_0x8abd('0x73')),{'interaction':_0x565e4b})[_0x8abd('0x1b')](function(_0x3dcc14){var _0x28a45c=path[_0x8abd('0x54')](_0x2896b2,_0x8abd('0x74')+_0x309539['id']+'-'+_0x51d6b8+_0x8abd('0x75'));var _0x2d17c0={'path':_0x28a45c,'channel':'Whatsapp','interactionId':_0x309539['id']};return pdf['createPdfFromHTML'](_0x3dcc14,_0x2d17c0);})[_0x8abd('0x1b')](function(){return new BPromise(function(_0x50e704,_0x2908dd){zipdir(_0x2896b2,{'saveTo':_0x49a287},function(_0x1d058d,_0x19ba82){if(_0x1d058d)return _0x2908dd(_0x1d058d);return _0x50e704(_0x19ba82);});})['then'](function(){return new BPromise(function(_0x3494fa,_0x255179){rimraf(_0x2896b2,function(_0x5e89ef){if(_0x5e89ef)_0x255179(_0x5e89ef);return _0x3494fa();});});})[_0x8abd('0x1b')](function(){return _0x4889ca[_0x8abd('0x76')](_0x49a287,_0x13eee5,function(_0x26efe9){if(_0x26efe9){console[_0x8abd('0x77')]('err',_0x26efe9);}else{fs['unlinkSync'](_0x49a287);}});});});}else{return _0x4889ca[_0x8abd('0x10')](0xc8);}})['catch'](handleError(_0x4889ca,null));}; \ No newline at end of file +var _0x4230=['ioredis','../../components/interaction/service','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','then','destroy','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','user','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','find','create','body','update','describe','addMessage','WhatsappMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','WhatsappInteractionId','filter','$gte','split','format','options','include','findAll','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','get','N.A.','createdAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','toString','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','System','Contact','out','renderFile','downloadInteraction.ejs','transcript-','Whatsapp','createPdfFromHTML','err','rimraf','zip-dir','moment','util','ejs'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4230,0xed));var _0x0423=function(_0xa61f61,_0x51ed1b){_0xa61f61=_0xa61f61-0x0;var _0x23cd4e=_0x4230[_0xa61f61];return _0x23cd4e;};'use strict';var rimraf=require(_0x0423('0x0'));var zipdir=require(_0x0423('0x1'));var moment=require(_0x0423('0x2'));var BPromise=require('bluebird');var util=require(_0x0423('0x3'));var path=require('path');var ejs=require(_0x0423('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x0423('0x5'));var interaction=require(_0x0423('0x6'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x0423('0x7'))('api');var config=require(_0x0423('0x8'));var db=require(_0x0423('0x9'))['db'];config[_0x0423('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0423('0xb'))(new Redis(config[_0x0423('0xa')]));require(_0x0423('0xc'))[_0x0423('0xd')](socket);function respondWithStatusCode(_0x3eded1,_0x3f5ef8){_0x3f5ef8=_0x3f5ef8||0xcc;return function(_0x11f969){if(_0x11f969){return _0x3eded1[_0x0423('0xe')](_0x3f5ef8);}return _0x3eded1[_0x0423('0xf')](_0x3f5ef8)[_0x0423('0x10')]();};}function respondWithResult(_0x519d47,_0x4d28a3){_0x4d28a3=_0x4d28a3||0xc8;return function(_0x182e5a){if(_0x182e5a){return _0x519d47[_0x0423('0xf')](_0x4d28a3)['json'](_0x182e5a);}};}function respondWithFilteredResult(_0x4d756d,_0x4a9eb3){return function(_0x422944){if(_0x422944){var _0x595ba4=typeof _0x4a9eb3[_0x0423('0x11')]===_0x0423('0x12')&&typeof _0x4a9eb3[_0x0423('0x13')]===_0x0423('0x12');var _0x153e1b=_0x422944[_0x0423('0x14')];var _0x3be354=_0x595ba4?0x0:_0x4a9eb3[_0x0423('0x11')];var _0x331762=_0x595ba4?_0x422944['count']:_0x4a9eb3[_0x0423('0x11')]+_0x4a9eb3[_0x0423('0x13')];var _0x25fda9;if(_0x331762>=_0x153e1b){_0x331762=_0x153e1b;_0x25fda9=0xc8;}else{_0x25fda9=0xce;}_0x4d756d[_0x0423('0xf')](_0x25fda9);return _0x4d756d[_0x0423('0x15')]('Content-Range',_0x3be354+'-'+_0x331762+'/'+_0x153e1b)[_0x0423('0x16')](_0x422944);}return null;};}function saveUpdates(_0x36870c){return function(_0x1902e7){if(_0x1902e7){return _0x1902e7['update'](_0x36870c)[_0x0423('0x17')](function(_0x2f1406){return _0x2f1406;});}return null;};}function removeEntity(_0xeb2f11){return function(_0x1cf561){if(_0x1cf561){return _0x1cf561[_0x0423('0x18')]()[_0x0423('0x17')](function(){_0xeb2f11[_0x0423('0xf')](0xcc)[_0x0423('0x10')]();});}};}function handleEntityNotFound(_0x4bfb63){return function(_0x23bc37){if(!_0x23bc37){_0x4bfb63[_0x0423('0xe')](0x194);}return _0x23bc37;};}function handleError(_0x55a624,_0x523cf8){_0x523cf8=_0x523cf8||0x1f4;return function(_0x24df30){logger[_0x0423('0x19')](_0x24df30[_0x0423('0x1a')]);if(_0x24df30[_0x0423('0x1b')]){delete _0x24df30[_0x0423('0x1b')];}_0x55a624[_0x0423('0xf')](_0x523cf8)['send'](_0x24df30);};}exports[_0x0423('0x1c')]=function(_0x1f97fe,_0x1be5e8){var _0x529e17={};var _0x4c704b=_[_0x0423('0x1d')](db[_0x0423('0x1e')][_0x0423('0x1f')],function(_0x5c0da5){return{'name':_0x5c0da5[_0x0423('0x20')],'type':_0x5c0da5[_0x0423('0x21')]['key']};});_0x529e17=qs['getOptions'](_0x4c704b,_0x1f97fe);return interaction['findAll']('whatsapp',_0x1f97fe['query'],_0x1f97fe[_0x0423('0x22')],_0x529e17,_0x4c704b)[_0x0423('0x17')](respondWithFilteredResult(_0x1be5e8,_0x529e17))[_0x0423('0x23')](handleError(_0x1be5e8,null));};exports[_0x0423('0x24')]=function(_0x3aacf8,_0x34d716){var _0x4207bb={'raw':![],'where':{'id':_0x3aacf8[_0x0423('0x25')]['id']}},_0x144db8={};_0x144db8[_0x0423('0x26')]=_[_0x0423('0x27')](db[_0x0423('0x1e')][_0x0423('0x1f')]);_0x144db8['query']=_[_0x0423('0x27')](_0x3aacf8[_0x0423('0x28')]);_0x144db8['filters']=_[_0x0423('0x29')](_0x144db8[_0x0423('0x26')],_0x144db8[_0x0423('0x28')]);_0x4207bb[_0x0423('0x2a')]=_[_0x0423('0x29')](_0x144db8[_0x0423('0x26')],qs[_0x0423('0x2b')](_0x3aacf8['query']['fields']));_0x4207bb[_0x0423('0x2a')]=_0x4207bb['attributes'][_0x0423('0x2c')]?_0x4207bb[_0x0423('0x2a')]:_0x144db8[_0x0423('0x26')];if(_0x3aacf8[_0x0423('0x28')][_0x0423('0x2d')]){_0x4207bb['include']=[{'all':!![]}];}_0x4207bb=_[_0x0423('0x2e')]({},_0x4207bb,_0x3aacf8['options']);return db[_0x0423('0x1e')][_0x0423('0x2f')](_0x4207bb)[_0x0423('0x17')](handleEntityNotFound(_0x34d716,null))[_0x0423('0x17')](respondWithResult(_0x34d716,null))[_0x0423('0x23')](handleError(_0x34d716,null));};exports[_0x0423('0x30')]=function(_0x4af674,_0x1d4264){return db[_0x0423('0x1e')]['create'](_0x4af674[_0x0423('0x31')],{})[_0x0423('0x17')](respondWithResult(_0x1d4264,0xc9))['catch'](handleError(_0x1d4264,null));};exports[_0x0423('0x32')]=function(_0x4080bc,_0x24312a){if(_0x4080bc[_0x0423('0x31')]['id']){delete _0x4080bc[_0x0423('0x31')]['id'];}return db[_0x0423('0x1e')][_0x0423('0x2f')]({'where':{'id':_0x4080bc[_0x0423('0x25')]['id']}})[_0x0423('0x17')](handleEntityNotFound(_0x24312a,null))[_0x0423('0x17')](saveUpdates(_0x4080bc[_0x0423('0x31')],null))[_0x0423('0x17')](respondWithResult(_0x24312a,null))[_0x0423('0x23')](handleError(_0x24312a,null));};exports[_0x0423('0x18')]=function(_0x3e1260,_0x437b62){return db['WhatsappInteraction'][_0x0423('0x2f')]({'where':{'id':_0x3e1260['params']['id']}})['then'](handleEntityNotFound(_0x437b62,null))[_0x0423('0x17')](removeEntity(_0x437b62,null))[_0x0423('0x23')](handleError(_0x437b62,null));};exports[_0x0423('0x33')]=function(_0x34f817,_0x18ced1){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x18ced1,null))[_0x0423('0x23')](handleError(_0x18ced1,null));};exports[_0x0423('0x34')]=function(_0x57acb8,_0x167970){return db[_0x0423('0x35')][_0x0423('0x2f')]({'where':{'id':_0x57acb8[_0x0423('0x25')]['id']}})[_0x0423('0x17')](handleEntityNotFound(_0x167970,null))[_0x0423('0x17')](function(_0x5c8cad){if(_0x5c8cad){return _0x5c8cad[_0x0423('0x34')](_0x57acb8[_0x0423('0x31')]['ids'],_[_0x0423('0x36')](_0x57acb8[_0x0423('0x31')],[_0x0423('0x37'),'id'])||{});}})[_0x0423('0x17')](respondWithResult(_0x167970,null))[_0x0423('0x23')](handleError(_0x167970,null));};exports[_0x0423('0x38')]=function(_0x6628c9,_0x9b24bf){var _0x2a2916={'raw':![],'where':{}};var _0x1da46a={};var _0x3839c2={'count':0x0,'rows':[]};return db[_0x0423('0x1e')][_0x0423('0x39')]({'where':{'id':_0x6628c9[_0x0423('0x25')]['id']}})['then'](handleEntityNotFound(_0x9b24bf,null))[_0x0423('0x17')](function(_0x1c7be1){if(_0x1c7be1){_0x1da46a[_0x0423('0x26')]=_[_0x0423('0x27')](db[_0x0423('0x35')][_0x0423('0x1f')]);_0x1da46a[_0x0423('0x28')]=_['keys'](_0x6628c9[_0x0423('0x28')]);_0x1da46a['filters']=_[_0x0423('0x29')](_0x1da46a[_0x0423('0x26')],_0x1da46a[_0x0423('0x28')]);_0x2a2916[_0x0423('0x2a')]=_[_0x0423('0x29')](_0x1da46a[_0x0423('0x26')],qs['fields'](_0x6628c9[_0x0423('0x28')][_0x0423('0x2b')]));_0x2a2916[_0x0423('0x2a')]=_0x2a2916[_0x0423('0x2a')][_0x0423('0x2c')]?_0x2a2916[_0x0423('0x2a')]:_0x1da46a[_0x0423('0x26')];if(!_0x6628c9[_0x0423('0x28')][_0x0423('0x3a')](_0x0423('0x3b'))){_0x2a2916[_0x0423('0x13')]=qs['limit'](_0x6628c9[_0x0423('0x28')][_0x0423('0x13')]);_0x2a2916[_0x0423('0x11')]=qs[_0x0423('0x11')](_0x6628c9[_0x0423('0x28')][_0x0423('0x11')]);}_0x2a2916['order']=qs['sort'](_0x6628c9['query'][_0x0423('0x3c')]);_0x2a2916[_0x0423('0x3d')]=qs['filters'](_[_0x0423('0x3e')](_0x6628c9[_0x0423('0x28')],_0x1da46a['filters']));_0x2a2916[_0x0423('0x3d')][_0x0423('0x3f')]=_0x1c7be1['id'];if(_0x6628c9[_0x0423('0x28')][_0x0423('0x40')]){_0x2a2916[_0x0423('0x3d')]=_[_0x0423('0x2e')](_0x2a2916['where'],{'$or':_[_0x0423('0x1d')](_0x2a2916['attributes'],function(_0x4d380b){var _0x3c5330={};_0x3c5330[_0x4d380b]={'$like':'%'+_0x6628c9['query'][_0x0423('0x40')]+'%'};return _0x3c5330;})});}if(_0x6628c9[_0x0423('0x28')][_0x0423('0x41')]){var _0x1e94e1=_0x6628c9['query']['$gte'][_0x0423('0x42')](',');var _0x4bda90={};_0x4bda90[_0x1e94e1[0x0]]={'$gte':moment(_0x1e94e1[0x1])[_0x0423('0x43')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2a2916[_0x0423('0x3d')]=_[_0x0423('0x2e')](_0x2a2916[_0x0423('0x3d')],_0x4bda90);}_0x2a2916=_['merge']({},_0x2a2916,_0x6628c9[_0x0423('0x44')]);return db[_0x0423('0x35')][_0x0423('0x14')]({'where':_0x2a2916['where']})[_0x0423('0x17')](function(_0x46e0d1){_0x3839c2[_0x0423('0x14')]=_0x46e0d1;if(_0x6628c9['query']['includeAll']){_0x2a2916[_0x0423('0x45')]=[{'all':!![]}];}return db[_0x0423('0x35')][_0x0423('0x46')](_0x2a2916);})[_0x0423('0x17')](function(_0xf44b10){_0x3839c2[_0x0423('0x47')]=_0xf44b10;return _0x3839c2;});}})['then'](respondWithFilteredResult(_0x9b24bf,_0x2a2916))['catch'](handleError(_0x9b24bf,null));};exports[_0x0423('0x48')]=function(_0x53544d,_0x41580d){return db[_0x0423('0x1e')][_0x0423('0x2f')]({'where':{'id':_0x53544d[_0x0423('0x25')]['id']}})[_0x0423('0x17')](handleEntityNotFound(_0x41580d,null))[_0x0423('0x17')](function(_0x32aef7){if(_0x32aef7){return _0x32aef7[_0x0423('0x49')](_0x53544d[_0x0423('0x31')][_0x0423('0x37')],_[_0x0423('0x36')](_0x53544d[_0x0423('0x31')],[_0x0423('0x37'),'id'])||{})[_0x0423('0x4a')](function(){return db[_0x0423('0x4b')][_0x0423('0x46')]({'attributes':['id','name',_0x0423('0x4c')],'where':{'id':_0x53544d['body'][_0x0423('0x37')]}});})['then'](function(_0x323d76){socket[_0x0423('0x4d')](_0x0423('0x4e'),{'id':Number(_0x53544d[_0x0423('0x25')]['id']),'tags':_0x323d76||[]});return{'id':Number(_0x53544d['params']['id']),'tags':_0x323d76||[]};});}})['then'](respondWithResult(_0x41580d,null))[_0x0423('0x23')](handleError(_0x41580d,null));};exports[_0x0423('0x4f')]=function(_0x184c7a,_0x903d9c){return db[_0x0423('0x1e')][_0x0423('0x2f')]({'where':{'id':_0x184c7a[_0x0423('0x25')]['id']}})['then'](handleEntityNotFound(_0x903d9c,null))[_0x0423('0x17')](function(_0x568bf9){if(_0x568bf9){return _0x568bf9[_0x0423('0x4f')](_0x184c7a[_0x0423('0x28')][_0x0423('0x37')]);}})[_0x0423('0x17')](respondWithStatusCode(_0x903d9c,null))[_0x0423('0x23')](handleError(_0x903d9c,null));};exports[_0x0423('0x50')]=function(_0x3df6b0,_0x9f2cab){var _0x345eed=moment()[_0x0423('0x51')]()['toString']();var _0x56b94d=path[_0x0423('0x52')](config[_0x0423('0x53')],_0x0423('0x54'),_0x0423('0x55'),_0x0423('0x56'));var _0xd69753=path[_0x0423('0x52')](config[_0x0423('0x53')],_0x0423('0x54'),_0x0423('0x55'),'attachments');var _0x447807=path[_0x0423('0x52')](_0x56b94d,_0x345eed);var _0x4bdbad=util[_0x0423('0x43')](_0x0423('0x57'),_0x3df6b0[_0x0423('0x25')]['id'],_0x345eed);var _0x38cc6f=path[_0x0423('0x52')](_0x56b94d,_0x4bdbad);var _0x3405a0=[];_0x3405a0[_0x0423('0x58')]({'model':db[_0x0423('0x59')],'as':'User','attributes':['id',_0x0423('0x5a')],'raw':!![]});_0x3405a0[_0x0423('0x58')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x0423('0x5b'),_0x0423('0x5c')],'raw':!![]});if(_0x3df6b0[_0x0423('0x28')]['attachments']){_0x3405a0[_0x0423('0x58')]({'model':db[_0x0423('0x5d')],'as':_0x0423('0x5d'),'raw':!![]});}var _0x4fd398=[{'model':db[_0x0423('0x35')],'as':_0x0423('0x5e'),'attributes':['id',_0x0423('0x31'),'createdAt',_0x0423('0x5f'),_0x0423('0x60'),'read'],'include':_0x3405a0}];_0x4fd398[_0x0423('0x58')]({'model':db[_0x0423('0x61')],'as':_0x0423('0x62'),'attributes':['id',_0x0423('0x1b')]});_0x4fd398[_0x0423('0x58')]({'model':db[_0x0423('0x59')],'as':_0x0423('0x63'),'attributes':['id',_0x0423('0x5a')]});return db[_0x0423('0x1e')][_0x0423('0x2f')]({'where':{'id':_0x3df6b0['params']['id']},'include':_0x4fd398})[_0x0423('0x17')](handleEntityNotFound(_0x9f2cab,null))[_0x0423('0x17')](function(_0x53337d){if(_0x53337d){var _0x3c780c=_0x53337d[_0x0423('0x64')]({'plain':!![]});fs['mkdirSync'](_0x447807);var _0x4ee2d9={'channel':'Whatsapp','account':_0x3c780c['Account'][_0x0423('0x1b')],'agent':_0x3c780c['Owner']?_0x3c780c[_0x0423('0x63')][_0x0423('0x5a')]:_0x0423('0x65'),'createdAt':moment(_0x3c780c[_0x0423('0x66')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3c780c['closed']?moment(_0x3c780c[_0x0423('0x67')])[_0x0423('0x43')](_0x0423('0x68'))[_0x0423('0x69')]():'','disposition':_0x3c780c[_0x0423('0x6a')],'messages':_(_0x3c780c[_0x0423('0x5e')])[_0x0423('0x40')]({'secret':![]})['map'](function(_0x3fab1e){if(_0x3fab1e['Attachment']){var _0x2c2adf=path[_0x0423('0x52')](_0xd69753,_0x3fab1e[_0x0423('0x5d')][_0x0423('0x6b')]);if(fs[_0x0423('0x6c')](_0x2c2adf)){fs[_0x0423('0x6d')](_0x2c2adf)[_0x0423('0x6e')](fs[_0x0423('0x6f')](path[_0x0423('0x52')](_0x447807,_0x3fab1e[_0x0423('0x5d')][_0x0423('0x6b')])));}}return{'date':moment(_0x3fab1e[_0x0423('0x66')])[_0x0423('0x43')](_0x0423('0x68'))[_0x0423('0x69')](),'sender':_0x3fab1e[_0x0423('0x5f')]==='out'?_0x3fab1e[_0x0423('0x59')]?_0x3fab1e[_0x0423('0x59')][_0x0423('0x5a')]:_0x0423('0x70'):_0x3fab1e[_0x0423('0x71')][_0x0423('0x5b')]+(_0x3fab1e[_0x0423('0x71')][_0x0423('0x5c')]?'\x20'+_0x3fab1e[_0x0423('0x71')][_0x0423('0x5c')]:''),'body':_0x3fab1e[_0x0423('0x5d')]?_0x3fab1e[_0x0423('0x5d')][_0x0423('0x6b')]:_0x3fab1e[_0x0423('0x31')],'direction':_0x3fab1e[_0x0423('0x5f')]===_0x0423('0x72')?'A':'C','secret':_0x3fab1e[_0x0423('0x60')],'read':_0x3fab1e['read'],'attachment':_0x3fab1e[_0x0423('0x5d')]};})['value']()};return ejs[_0x0423('0x73')](path[_0x0423('0x52')](config[_0x0423('0x53')],_0x0423('0x54'),'views',_0x0423('0x74')),{'interaction':_0x4ee2d9})['then'](function(_0xa811f1){var _0x592b8f=path['join'](_0x447807,_0x0423('0x75')+_0x3c780c['id']+'-'+_0x345eed+'.pdf');var _0x44ac33={'path':_0x592b8f,'channel':_0x0423('0x76'),'interactionId':_0x3c780c['id']};return pdf[_0x0423('0x77')](_0xa811f1,_0x44ac33);})[_0x0423('0x17')](function(){return new BPromise(function(_0x2f3019,_0x1c5937){zipdir(_0x447807,{'saveTo':_0x38cc6f},function(_0x1b92f8,_0x2a52ad){if(_0x1b92f8)return _0x1c5937(_0x1b92f8);return _0x2f3019(_0x2a52ad);});})['then'](function(){return new BPromise(function(_0x1a8bd6,_0x3d0119){rimraf(_0x447807,function(_0x9dc247){if(_0x9dc247)_0x3d0119(_0x9dc247);return _0x1a8bd6();});});})[_0x0423('0x17')](function(){return _0x9f2cab[_0x0423('0x50')](_0x38cc6f,_0x4bdbad,function(_0x3f31fd){if(_0x3f31fd){console['log'](_0x0423('0x78'),_0x3f31fd);}else{fs['unlinkSync'](_0x38cc6f);}});});});}else{return _0x9f2cab[_0x0423('0xe')](0xc8);}})[_0x0423('0x23')](handleError(_0x9f2cab,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 702c583..17df153 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 _0xd61e=['findAll','then','setDataValue','emit','catch','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','update','remove','getUsers'];(function(_0x3c5e54,_0x2b991b){var _0x3ae1f3=function(_0x43f80f){while(--_0x43f80f){_0x3c5e54['push'](_0x3c5e54['shift']());}};_0x3ae1f3(++_0x2b991b);}(_0xd61e,0x13d));var _0xed61=function(_0x13e94c,_0x366ef3){_0x13e94c=_0x13e94c-0x0;var _0x293f19=_0xd61e[_0x13e94c];return _0x293f19;};'use strict';var EventEmitter=require(_0xed61('0x0'));var WhatsappInteraction=require(_0xed61('0x1'))['db'][_0xed61('0x2')];var WhatsappMessage=require(_0xed61('0x1'))['db'][_0xed61('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xed61('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xed61('0x5'),'afterDestroy':_0xed61('0x6')};function emitEvent(_0x152e2d){return function(_0x376e19,_0x1739bd,_0x39e7f8){_0x376e19[_0xed61('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5e6173){_0x376e19['setDataValue']('Users',_0x5e6173['map'](function(_0xbac89d){return{'id':_0xbac89d['id']};}));return WhatsappMessage[_0xed61('0x8')]({'where':{'WhatsappInteractionId':_0x376e19['id'],'direction':'in','read':![]},'raw':!![]});})[_0xed61('0x9')](function(_0xfd8844){_0x376e19[_0xed61('0xa')]('unreadMessages',_0xfd8844['length']);WhatsappInteractionEvents['emit'](_0x152e2d+':'+_0x376e19['id'],_0x376e19);WhatsappInteractionEvents[_0xed61('0xb')](_0x152e2d,_0x376e19);_0x39e7f8(null);})[_0xed61('0xc')](_0x39e7f8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xe920=['save','update','remove','getUsers','then','setDataValue','map','findAll','emit','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xe920,0xbe));var _0x0e92=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0xe920[_0x22ffbf];return _0x360c17;};'use strict';var EventEmitter=require(_0x0e92('0x0'));var WhatsappInteraction=require(_0x0e92('0x1'))['db'][_0x0e92('0x2')];var WhatsappMessage=require(_0x0e92('0x1'))['db'][_0x0e92('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x0e92('0x4')](0x0);var events={'afterCreate':_0x0e92('0x5'),'afterUpdate':_0x0e92('0x6'),'afterDestroy':_0x0e92('0x7')};function emitEvent(_0xd22921){return function(_0x4ff323,_0x291f3f,_0x5291e2){_0x4ff323[_0x0e92('0x8')]({'attributes':['id'],'raw':!![]})[_0x0e92('0x9')](function(_0x2d921f){_0x4ff323[_0x0e92('0xa')]('Users',_0x2d921f[_0x0e92('0xb')](function(_0x299985){return{'id':_0x299985['id']};}));return WhatsappMessage[_0x0e92('0xc')]({'where':{'WhatsappInteractionId':_0x4ff323['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0e92('0x9')](function(_0x1338e4){_0x4ff323['setDataValue']('unreadMessages',_0x1338e4['length']);WhatsappInteractionEvents[_0x0e92('0xd')](_0xd22921+':'+_0x4ff323['id'],_0x4ff323);WhatsappInteractionEvents[_0x0e92('0xd')](_0xd22921,_0x4ff323);_0x5291e2(null);})['catch'](_0x5291e2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x0e92('0xe')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e499f05..2727c9a 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 _0xb3c1=['format','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','closed'];(function(_0x18d241,_0x51af73){var _0x201259=function(_0x2523f7){while(--_0x2523f7){_0x18d241['push'](_0x18d241['shift']());}};_0x201259(++_0x51af73);}(_0xb3c1,0xc5));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))('api');var moment=require(_0x1b3c('0x3'));var BPromise=require(_0x1b3c('0x4'));var rp=require(_0x1b3c('0x5'));var fs=require('fs');var path=require(_0x1b3c('0x6'));var rimraf=require(_0x1b3c('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x1b3c('0x8')]=function(_0x3bb2c8,_0x51fd55){return _0x3bb2c8[_0x1b3c('0x9')](_0x1b3c('0xa'),attributes,{'tableName':_0x1b3c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x11c882,_0x1d3c0f,_0x2cd715){if(_0x11c882['changed'](_0x1b3c('0xc'))){_0x11c882['closedAt']=moment()[_0x1b3c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2cd715(null,_0x11c882);}}});}; \ No newline at end of file +var _0xbcd1=['moment','request-promise','path','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xbcd1,0x16b));var _0x1bcd=function(_0x82b73d,_0x17a49b){_0x82b73d=_0x82b73d-0x0;var _0x250450=_0xbcd1[_0x82b73d];return _0x250450;};'use strict';var _=require(_0x1bcd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1bcd('0x1'));var BPromise=require('bluebird');var rp=require(_0x1bcd('0x2'));var fs=require('fs');var path=require(_0x1bcd('0x3'));var rimraf=require('rimraf');var config=require(_0x1bcd('0x4'));var attributes=require(_0x1bcd('0x5'));module[_0x1bcd('0x6')]=function(_0x32fe9b,_0x3184c4){return _0x32fe9b['define'](_0x1bcd('0x7'),attributes,{'tableName':_0x1bcd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x35a224,_0x87c4cd,_0x40a233){if(_0x35a224[_0x1bcd('0x9')](_0x1bcd('0xa'))){_0x35a224[_0x1bcd('0xb')]=moment()[_0x1bcd('0xc')](_0x1bcd('0xd'));}_0x40a233(null,_0x35a224);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index c8ffc63..9643ab0 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 _0xed84=['client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','where','attributes','limit','then','addTags','ids','spread','AddTags','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed84,0x1b1));var _0x4ed8=function(_0x404b7b,_0x1d4662){_0x404b7b=_0x404b7b-0x0;var _0xa8205=_0xed84[_0x404b7b];return _0xa8205;};'use strict';var _=require('lodash');var util=require(_0x4ed8('0x0'));var moment=require(_0x4ed8('0x1'));var BPromise=require(_0x4ed8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4ed8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ed8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4ed8('0x5'));var jayson=require(_0x4ed8('0x6'));var client=jayson[_0x4ed8('0x7')][_0x4ed8('0x8')]({'port':0x232a});config[_0x4ed8('0x9')]=_[_0x4ed8('0xa')](config[_0x4ed8('0x9')],{'host':_0x4ed8('0xb'),'port':0x18eb});var socket=require(_0x4ed8('0xc'))(new Redis(config[_0x4ed8('0x9')]));require(_0x4ed8('0xd'))['register'](socket);function respondWithRpcPromise(_0x49014e,_0x62887d,_0x8a84fc){return new BPromise(function(_0x151a43,_0x40b1d2){return client[_0x4ed8('0xe')](_0x49014e,_0x8a84fc)['then'](function(_0x3071c0){logger['info'](_0x4ed8('0xf'),_0x62887d,_0x4ed8('0x10'));logger[_0x4ed8('0x11')](_0x4ed8('0x12'),_0x62887d,_0x4ed8('0x10'),JSON[_0x4ed8('0x13')](_0x3071c0));if(_0x3071c0[_0x4ed8('0x14')]){if(_0x3071c0[_0x4ed8('0x14')][_0x4ed8('0x15')]===0x1f4){logger['error'](_0x4ed8('0xf'),_0x62887d,_0x3071c0[_0x4ed8('0x14')]['message']);return _0x40b1d2(_0x3071c0[_0x4ed8('0x14')][_0x4ed8('0x16')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x62887d,_0x3071c0['error'][_0x4ed8('0x16')]);return _0x151a43(_0x3071c0[_0x4ed8('0x14')]['message']);}else{logger[_0x4ed8('0x17')](_0x4ed8('0xf'),_0x62887d,_0x4ed8('0x10'));_0x151a43(_0x3071c0[_0x4ed8('0x18')][_0x4ed8('0x16')]);}})[_0x4ed8('0x19')](function(_0x163afb){logger[_0x4ed8('0x14')](_0x4ed8('0xf'),_0x62887d,_0x163afb);_0x40b1d2(_0x163afb);});});}exports[_0x4ed8('0x1a')]=function(_0xa7884b){var _0x171bce=this;return new Promise(function(_0x35a586,_0x175bd0){return db[_0x4ed8('0x1b')][_0x4ed8('0x1c')](_0xa7884b[_0x4ed8('0x1d')],{'raw':_0xa7884b['options']?_0xa7884b['options'][_0x4ed8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x20')]||null:null,'attributes':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x21')]||null:null,'limit':_0xa7884b[_0x4ed8('0x1f')]?_0xa7884b[_0x4ed8('0x1f')][_0x4ed8('0x22')]||null:null})[_0x4ed8('0x23')](function(_0x128663){logger[_0x4ed8('0x17')](_0x4ed8('0x1a'),_0xa7884b);logger[_0x4ed8('0x11')](_0x4ed8('0x1a'),_0xa7884b,JSON[_0x4ed8('0x13')](_0x128663));_0x35a586(_0x128663);})['catch'](function(_0x2b3221){logger[_0x4ed8('0x14')]('UpdateWhatsappInteraction',_0x2b3221[_0x4ed8('0x16')],_0xa7884b);_0x175bd0(_0x171bce[_0x4ed8('0x14')](0x1f4,_0x2b3221['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x3342a8){return new Promise(function(_0xf53921,_0x46036a){return db['WhatsappInteraction']['find']({'where':_0x3342a8['options']?_0x3342a8['options'][_0x4ed8('0x20')]||null:null})[_0x4ed8('0x23')](function(_0x50b097){if(_0x50b097){return _0x50b097[_0x4ed8('0x24')](_0x3342a8[_0x4ed8('0x1d')][_0x4ed8('0x25')],_['omit'](_0x3342a8['body'],[_0x4ed8('0x25'),'id'])||{});}})[_0x4ed8('0x26')](function(_0x7f9400){logger[_0x4ed8('0x17')](_0x4ed8('0x27'),_0x3342a8);logger[_0x4ed8('0x11')](_0x4ed8('0x27'),_0x3342a8,JSON[_0x4ed8('0x13')](_0x7f9400));_0xf53921(_0x7f9400);})[_0x4ed8('0x19')](function(_0x516a9b){logger[_0x4ed8('0x14')]('AddTags',_0x516a9b[_0x4ed8('0x16')],_0x3342a8);_0x46036a(_this[_0x4ed8('0x14')](0x1f4,_0x516a9b[_0x4ed8('0x16')]));});});}; \ No newline at end of file +var _0xe7f9=['AddTagsToWhatsappInteraction','find','addTags','ids','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','then','catch'];(function(_0x534944,_0x3c9982){var _0x3371e4=function(_0x4a4a4c){while(--_0x4a4a4c){_0x534944['push'](_0x534944['shift']());}};_0x3371e4(++_0x3c9982);}(_0xe7f9,0x15a));var _0x9e7f=function(_0x369a98,_0x32250c){_0x369a98=_0x369a98-0x0;var _0x29565c=_0xe7f9[_0x369a98];return _0x29565c;};'use strict';var _=require(_0x9e7f('0x0'));var util=require(_0x9e7f('0x1'));var moment=require('moment');var BPromise=require(_0x9e7f('0x2'));var rs=require(_0x9e7f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e7f('0x4'))['db'];var utils=require(_0x9e7f('0x5'));var logger=require('../../config/logger')(_0x9e7f('0x6'));var config=require(_0x9e7f('0x7'));var jayson=require(_0x9e7f('0x8'));var client=jayson[_0x9e7f('0x9')]['http']({'port':0x232a});config[_0x9e7f('0xa')]=_['defaults'](config[_0x9e7f('0xa')],{'host':_0x9e7f('0xb'),'port':0x18eb});var socket=require(_0x9e7f('0xc'))(new Redis(config[_0x9e7f('0xa')]));require(_0x9e7f('0xd'))[_0x9e7f('0xe')](socket);function respondWithRpcPromise(_0x5e1bad,_0x4c6644,_0x5dd884){return new BPromise(function(_0x5b1aef,_0x1b2826){return client[_0x9e7f('0xf')](_0x5e1bad,_0x5dd884)['then'](function(_0x3e038c){logger[_0x9e7f('0x10')](_0x9e7f('0x11'),_0x4c6644,_0x9e7f('0x12'));logger[_0x9e7f('0x13')](_0x9e7f('0x14'),_0x4c6644,_0x9e7f('0x12'),JSON[_0x9e7f('0x15')](_0x3e038c));if(_0x3e038c[_0x9e7f('0x16')]){if(_0x3e038c['error'][_0x9e7f('0x17')]===0x1f4){logger[_0x9e7f('0x16')](_0x9e7f('0x11'),_0x4c6644,_0x3e038c['error'][_0x9e7f('0x18')]);return _0x1b2826(_0x3e038c['error'][_0x9e7f('0x18')]);}logger[_0x9e7f('0x16')](_0x9e7f('0x11'),_0x4c6644,_0x3e038c[_0x9e7f('0x16')][_0x9e7f('0x18')]);return _0x5b1aef(_0x3e038c[_0x9e7f('0x16')][_0x9e7f('0x18')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4c6644,_0x9e7f('0x12'));_0x5b1aef(_0x3e038c[_0x9e7f('0x19')][_0x9e7f('0x18')]);}})['catch'](function(_0x1369ec){logger[_0x9e7f('0x16')](_0x9e7f('0x11'),_0x4c6644,_0x1369ec);_0x1b2826(_0x1369ec);});});}exports[_0x9e7f('0x1a')]=function(_0x337060){var _0x1f47a2=this;return new Promise(function(_0x4e868e,_0x50297d){return db[_0x9e7f('0x1b')][_0x9e7f('0x1c')](_0x337060[_0x9e7f('0x1d')],{'raw':_0x337060['options']?_0x337060[_0x9e7f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337060[_0x9e7f('0x1e')]?_0x337060['options'][_0x9e7f('0x1f')]||null:null,'attributes':_0x337060[_0x9e7f('0x1e')]?_0x337060['options']['attributes']||null:null,'limit':_0x337060['options']?_0x337060[_0x9e7f('0x1e')]['limit']||null:null})[_0x9e7f('0x20')](function(_0x3c64ee){logger[_0x9e7f('0x10')](_0x9e7f('0x1a'),_0x337060);logger[_0x9e7f('0x13')]('UpdateWhatsappInteraction',_0x337060,JSON[_0x9e7f('0x15')](_0x3c64ee));_0x4e868e(_0x3c64ee);})[_0x9e7f('0x21')](function(_0x178d1c){logger['error'](_0x9e7f('0x1a'),_0x178d1c[_0x9e7f('0x18')],_0x337060);_0x50297d(_0x1f47a2['error'](0x1f4,_0x178d1c[_0x9e7f('0x18')]));});});};exports[_0x9e7f('0x22')]=function(_0x190be6){return new Promise(function(_0x582560,_0x38d6d1){return db[_0x9e7f('0x1b')][_0x9e7f('0x23')]({'where':_0x190be6[_0x9e7f('0x1e')]?_0x190be6[_0x9e7f('0x1e')][_0x9e7f('0x1f')]||null:null})[_0x9e7f('0x20')](function(_0x9ac2cb){if(_0x9ac2cb){return _0x9ac2cb[_0x9e7f('0x24')](_0x190be6[_0x9e7f('0x1d')][_0x9e7f('0x25')],_['omit'](_0x190be6['body'],[_0x9e7f('0x25'),'id'])||{});}})['spread'](function(_0x157395){logger[_0x9e7f('0x10')]('AddTags',_0x190be6);logger[_0x9e7f('0x13')]('AddTags',_0x190be6,JSON[_0x9e7f('0x15')](_0x157395));_0x582560(_0x157395);})[_0x9e7f('0x21')](function(_0x314346){logger[_0x9e7f('0x16')]('AddTags',_0x314346[_0x9e7f('0x18')],_0x190be6);_0x38d6d1(_this[_0x9e7f('0x16')](0x1f4,_0x314346[_0x9e7f('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f16f5de..f10044e 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 _0xe045=['./whatsappInteraction.events','update','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x239193,_0x1585ef){var _0x4f51c3=function(_0x8eba2c){while(--_0x8eba2c){_0x239193['push'](_0x239193['shift']());}};_0x4f51c3(++_0x1585ef);}(_0xe045,0x1b2));var _0x5e04=function(_0x353026,_0x3247d9){_0x353026=_0x353026-0x0;var _0x694a1c=_0xe045[_0x353026];return _0x694a1c;};'use strict';var WhatsappInteractionEvents=require(_0x5e04('0x0'));var events=['save','remove',_0x5e04('0x1')];function createListener(_0x2101db,_0x676e41){return function(_0x40cf14){_0x676e41[_0x5e04('0x2')](_0x2101db,_0x40cf14);};}function removeListener(_0x45317a,_0x390ff9){return function(){WhatsappInteractionEvents[_0x5e04('0x3')](_0x45317a,_0x390ff9);};}exports[_0x5e04('0x4')]=function(_0x30b19e){for(var _0x29d26a=0x0,_0x462679=events[_0x5e04('0x5')];_0x29d26a<_0x462679;_0x29d26a++){var _0x14e608=events[_0x29d26a];var _0x3aa7d9=createListener(_0x5e04('0x6')+_0x14e608,_0x30b19e);WhatsappInteractionEvents['on'](_0x14e608,_0x3aa7d9);}}; \ No newline at end of file +var _0x8a43=['save','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x8a43,0x8f));var _0x38a4=function(_0x584b1d,_0x2a85fd){_0x584b1d=_0x584b1d-0x0;var _0x312e76=_0x8a43[_0x584b1d];return _0x312e76;};'use strict';var WhatsappInteractionEvents=require(_0x38a4('0x0'));var events=[_0x38a4('0x1'),'remove','update'];function createListener(_0x25eee6,_0xe15ff6){return function(_0x5daa37){_0xe15ff6['emit'](_0x25eee6,_0x5daa37);};}function removeListener(_0x18128f,_0x44fba5){return function(){WhatsappInteractionEvents[_0x38a4('0x2')](_0x18128f,_0x44fba5);};}exports[_0x38a4('0x3')]=function(_0x45af6e){for(var _0x6165cd=0x0,_0x1e751a=events[_0x38a4('0x4')];_0x6165cd<_0x1e751a;_0x6165cd++){var _0x2fb19d=events[_0x6165cd];var _0x5109f4=createListener(_0x38a4('0x5')+_0x2fb19d,_0x45af6e);WhatsappInteractionEvents['on'](_0x2fb19d,_0x5109f4);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 3ba167c..794fad0 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 _0x5fd5=['create','/:id/status','put','/:id/accept','/:id/reject','reject','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create'];(function(_0x158161,_0x7d0e15){var _0x2a1579=function(_0x4766fe){while(--_0x4766fe){_0x158161['push'](_0x158161['shift']());}};_0x2a1579(++_0x7d0e15);}(_0x5fd5,0xd7));var _0x55fd=function(_0x1ba40c,_0x4d8113){_0x1ba40c=_0x1ba40c-0x0;var _0x2dffa8=_0x5fd5[_0x1ba40c];return _0x2dffa8;};'use strict';var multer=require('multer');var util=require(_0x55fd('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x55fd('0x1'));var router=express[_0x55fd('0x2')]();var fs_extra=require(_0x55fd('0x3'));var auth=require(_0x55fd('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x55fd('0x5'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x55fd('0x6')](),controller['index']);router[_0x55fd('0x7')]('/describe',auth[_0x55fd('0x6')](),controller[_0x55fd('0x8')]);router[_0x55fd('0x7')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller[_0x55fd('0xa')]);router[_0x55fd('0xb')]('/',auth[_0x55fd('0x6')](),interaction[_0x55fd('0xc')](_0x55fd('0xd'),_0x55fd('0xe')),controller[_0x55fd('0xf')]);router[_0x55fd('0xb')](_0x55fd('0x10'),controller['status']);router[_0x55fd('0x11')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller['update']);router[_0x55fd('0x11')](_0x55fd('0x12'),auth[_0x55fd('0x6')](),controller['accept']);router[_0x55fd('0x11')](_0x55fd('0x13'),auth['isAuthenticated'](),controller[_0x55fd('0x14')]);router[_0x55fd('0x15')](_0x55fd('0x9'),auth[_0x55fd('0x6')](),controller['destroy']);module[_0x55fd('0x16')]=router; \ No newline at end of file +var _0x04fd=['isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','update','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappMessage.controller','get'];(function(_0x36c068,_0x2f9bab){var _0x27561e=function(_0x1c5c9a){while(--_0x1c5c9a){_0x36c068['push'](_0x36c068['shift']());}};_0x27561e(++_0x2f9bab);}(_0x04fd,0xde));var _0xd04f=function(_0x56dc08,_0x464bc0){_0x56dc08=_0x56dc08-0x0;var _0x58e606=_0x04fd[_0x56dc08];return _0x58e606;};'use strict';var multer=require('multer');var util=require(_0xd04f('0x0'));var path=require(_0xd04f('0x1'));var timeout=require(_0xd04f('0x2'));var express=require('express');var router=express[_0xd04f('0x3')]();var fs_extra=require(_0xd04f('0x4'));var auth=require(_0xd04f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd04f('0x6'));router[_0xd04f('0x7')]('/',auth[_0xd04f('0x8')](),controller['index']);router[_0xd04f('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd04f('0x9')]);router[_0xd04f('0x7')](_0xd04f('0xa'),auth['isAuthenticated'](),controller[_0xd04f('0xb')]);router[_0xd04f('0xc')]('/',auth[_0xd04f('0x8')](),interaction[_0xd04f('0xd')](_0xd04f('0xe'),_0xd04f('0xf')),controller['create']);router[_0xd04f('0xc')](_0xd04f('0x10'),controller['status']);router['put']('/:id',auth[_0xd04f('0x8')](),controller[_0xd04f('0x11')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xd04f('0x12')]);router['put'](_0xd04f('0x13'),auth['isAuthenticated'](),controller[_0xd04f('0x14')]);router['delete']('/:id',auth[_0xd04f('0x8')](),controller[_0xd04f('0x15')]);module[_0xd04f('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 6c50567..47f16a6 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 _0x6726=['STRING','DATE','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x46c4bd,_0x269459){var _0x32a4f1=function(_0x58ac06){while(--_0x58ac06){_0x46c4bd['push'](_0x46c4bd['shift']());}};_0x32a4f1(++_0x269459);}(_0x6726,0xdb));var _0x6672=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x6726[_0x11e30d];return _0x2d4e29;};'use strict';var Sequelize=require('sequelize');module[_0x6672('0x0')]={'body':{'type':Sequelize[_0x6672('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6672('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6672('0x3')]('in','out'),'defaultValue':_0x6672('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x6672('0x5')]},'readAt':{'type':Sequelize[_0x6672('0x6')]},'secret':{'type':Sequelize[_0x6672('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6672('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7cf8=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x7cf8,0x13a));var _0x87cf=function(_0x11d527,_0x1afb79){_0x11d527=_0x11d527-0x0;var _0x47ef17=_0x7cf8[_0x11d527];return _0x47ef17;};'use strict';var Sequelize=require(_0x87cf('0x0'));module[_0x87cf('0x1')]={'body':{'type':Sequelize[_0x87cf('0x2')](_0x87cf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x87cf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x87cf('0x5')]('in','out'),'defaultValue':_0x87cf('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x87cf('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x87cf('0x8')]},'secret':{'type':Sequelize[_0x87cf('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x87cf('0x7')]},'providerResponse':{'type':Sequelize[_0x87cf('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 845e9d3..8a37af1 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 _0x6ad8=['redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','save','update','then','destroy','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappMessage','includeAll','include','findAll','params','length','find','create','body','describe','whatsapp-interactions','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','interaction','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','channel','motionChannel','event','EventManager','acceptmessage','reject','rejectMessage','contact','fullname','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4a7513,_0x19e317){var _0x41b93a=function(_0x49f74b){while(--_0x49f74b){_0x4a7513['push'](_0x4a7513['shift']());}};_0x41b93a(++_0x19e317);}(_0x6ad8,0xf8));var _0x86ad=function(_0x1320ec,_0x2f90de){_0x1320ec=_0x1320ec-0x0;var _0x1327ac=_0x6ad8[_0x1320ec];return _0x1327ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x86ad('0x0'));var zipdir=require(_0x86ad('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x86ad('0x2'));var moment=require(_0x86ad('0x3'));var BPromise=require(_0x86ad('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x86ad('0x5'));var sox=require(_0x86ad('0x6'));var csv=require(_0x86ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x86ad('0x8'));var _=require(_0x86ad('0x9'));var squel=require('squel');var crypto=require(_0x86ad('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x86ad('0xb'));var toCsv=require('to-csv');var querystring=require(_0x86ad('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x86ad('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86ad('0xe'));var logger=require(_0x86ad('0xf'))(_0x86ad('0x10'));var utils=require(_0x86ad('0x11'));var config=require(_0x86ad('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x86ad('0x13'))['db'];config[_0x86ad('0x14')]=_[_0x86ad('0x15')](config[_0x86ad('0x14')],{'host':_0x86ad('0x16'),'port':0x18eb});var socket=require(_0x86ad('0x17'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x86ad('0x18')](socket);var jayson=require(_0x86ad('0x19'));var client=jayson[_0x86ad('0x1a')][_0x86ad('0x1b')]({'port':0x232c});var client9002=jayson[_0x86ad('0x1a')][_0x86ad('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x282d26,_0x4a5c5f,_0x365d79,_0x33f1ba){return new BPromise(function(_0x1a1e85,_0x21772e){var _0x1c969d=_0x33f1ba||client;return _0x1c969d[_0x86ad('0x1c')](_0x282d26,_0x365d79)['then'](function(_0x210216){logger[_0x86ad('0x1d')](_0x86ad('0x1e'),_0x4a5c5f,_0x86ad('0x1f'));logger['debug'](_0x86ad('0x20'),_0x4a5c5f,_0x86ad('0x1f'),JSON['stringify'](_0x210216));if(_0x210216[_0x86ad('0x21')]){if(_0x210216['error'][_0x86ad('0x22')]===0x1f4){logger[_0x86ad('0x21')](_0x86ad('0x1e'),_0x4a5c5f,_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);return _0x21772e(_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);}logger[_0x86ad('0x21')](_0x86ad('0x1e'),_0x4a5c5f,_0x210216['error'][_0x86ad('0x23')]);return _0x1a1e85(_0x210216[_0x86ad('0x21')][_0x86ad('0x23')]);}else{logger[_0x86ad('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x4a5c5f,_0x86ad('0x1f'));_0x1a1e85(_0x210216[_0x86ad('0x24')][_0x86ad('0x23')]);}})[_0x86ad('0x25')](function(_0x45c480){logger['error'](_0x86ad('0x1e'),_0x4a5c5f,_0x45c480);_0x21772e(_0x45c480);});});}function respondWithStatusCode(_0x18714e,_0x6d16a5){_0x6d16a5=_0x6d16a5||0xcc;return function(_0x4fb309){if(_0x4fb309){return _0x18714e['sendStatus'](_0x6d16a5);}return _0x18714e['status'](_0x6d16a5)['end']();};}function respondWithResult(_0x2c3ebf,_0xfc9527){_0xfc9527=_0xfc9527||0xc8;return function(_0x36fc20){if(_0x36fc20){return _0x2c3ebf['status'](_0xfc9527)[_0x86ad('0x26')](_0x36fc20);}};}function respondWithFilteredResult(_0x2318c5,_0x2ab872){return function(_0x405b0f){if(_0x405b0f){var _0x1863aa=typeof _0x2ab872['offset']===_0x86ad('0x27')&&typeof _0x2ab872[_0x86ad('0x28')]==='undefined';var _0x3858f1=_0x405b0f[_0x86ad('0x29')];var _0x14bf7e=_0x1863aa?0x0:_0x2ab872['offset'];var _0x908a6a=_0x1863aa?_0x405b0f[_0x86ad('0x29')]:_0x2ab872[_0x86ad('0x2a')]+_0x2ab872[_0x86ad('0x28')];var _0x31adf9;if(_0x908a6a>=_0x3858f1){_0x908a6a=_0x3858f1;_0x31adf9=0xc8;}else{_0x31adf9=0xce;}_0x2318c5[_0x86ad('0x2b')](_0x31adf9);return _0x2318c5[_0x86ad('0x2c')](_0x86ad('0x2d'),_0x14bf7e+'-'+_0x908a6a+'/'+_0x3858f1)[_0x86ad('0x26')](_0x405b0f);}return null;};}function patchUpdates(_0x143a20){return function(_0x53f75f){try{jsonpatch['apply'](_0x53f75f,_0x143a20,!![]);}catch(_0x53b211){return BPromise['reject'](_0x53b211);}return _0x53f75f[_0x86ad('0x2e')]();};}function saveUpdates(_0x162163,_0x95239){return function(_0x19fc01){if(_0x19fc01){return _0x19fc01[_0x86ad('0x2f')](_0x162163)[_0x86ad('0x30')](function(_0x5b2f2a){return _0x5b2f2a;});}return null;};}function removeEntity(_0x2dac6f,_0x18e5de){return function(_0x16e991){if(_0x16e991){return _0x16e991[_0x86ad('0x31')]()[_0x86ad('0x30')](function(){_0x2dac6f[_0x86ad('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58a4bf,_0x21b5ee){return function(_0x54743a){if(!_0x54743a){_0x58a4bf[_0x86ad('0x32')](0x194);}return _0x54743a;};}function handleError(_0x15a305,_0x414ee7){_0x414ee7=_0x414ee7||0x1f4;return function(_0x1db4ee){logger['error'](_0x1db4ee[_0x86ad('0x33')]);if(_0x1db4ee['name']){delete _0x1db4ee[_0x86ad('0x34')];}_0x15a305[_0x86ad('0x2b')](_0x414ee7)[_0x86ad('0x35')](_0x1db4ee);};}exports['index']=function(_0x197ea1,_0x30959b){var _0xa7d37={},_0x33af6b={},_0x58e3a4={'count':0x0,'rows':[]};var _0x347c7f=_['map'](db['WhatsappMessage'][_0x86ad('0x36')],function(_0x56f55b){return{'name':_0x56f55b[_0x86ad('0x37')],'type':_0x56f55b[_0x86ad('0x38')][_0x86ad('0x39')]};});_0x33af6b['model']=_[_0x86ad('0x3a')](_0x347c7f,_0x86ad('0x34'));_0x33af6b['query']=_['keys'](_0x197ea1[_0x86ad('0x3b')]);_0x33af6b[_0x86ad('0x3c')]=_[_0x86ad('0x3d')](_0x33af6b[_0x86ad('0x3e')],_0x33af6b['query']);_0xa7d37[_0x86ad('0x3f')]=_[_0x86ad('0x3d')](_0x33af6b[_0x86ad('0x3e')],qs[_0x86ad('0x40')](_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x40')]));_0xa7d37['attributes']=_0xa7d37[_0x86ad('0x3f')]['length']?_0xa7d37[_0x86ad('0x3f')]:_0x33af6b[_0x86ad('0x3e')];if(!_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x41')](_0x86ad('0x42'))){_0xa7d37['limit']=qs[_0x86ad('0x28')](_0x197ea1['query']['limit']);_0xa7d37[_0x86ad('0x2a')]=qs[_0x86ad('0x2a')](_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x2a')]);}_0xa7d37[_0x86ad('0x43')]=qs[_0x86ad('0x44')](_0x197ea1['query'][_0x86ad('0x44')]);_0xa7d37[_0x86ad('0x45')]=qs[_0x86ad('0x3c')](_['pick'](_0x197ea1[_0x86ad('0x3b')],_0x33af6b[_0x86ad('0x3c')]),_0x347c7f);if(_0x197ea1[_0x86ad('0x3b')]['filter']){_0xa7d37[_0x86ad('0x45')]=_[_0x86ad('0x46')](_0xa7d37[_0x86ad('0x45')],{'$or':_[_0x86ad('0x3a')](_0x347c7f,function(_0x250bc6){if(_0x250bc6[_0x86ad('0x38')]!==_0x86ad('0x47')){var _0x51b3db={};_0x51b3db[_0x250bc6[_0x86ad('0x34')]]={'$like':'%'+_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x48')]+'%'};return _0x51b3db;}})});}_0xa7d37=_['merge']({},_0xa7d37,_0x197ea1[_0x86ad('0x49')]);var _0x33f00a={'where':_0xa7d37[_0x86ad('0x45')]};return db[_0x86ad('0x4a')][_0x86ad('0x29')](_0x33f00a)['then'](function(_0x1372f8){_0x58e3a4[_0x86ad('0x29')]=_0x1372f8;if(_0x197ea1[_0x86ad('0x3b')][_0x86ad('0x4b')]){_0xa7d37[_0x86ad('0x4c')]=[{'all':!![]}];}return db[_0x86ad('0x4a')][_0x86ad('0x4d')](_0xa7d37);})[_0x86ad('0x30')](function(_0x310f2d){_0x58e3a4['rows']=_0x310f2d;return _0x58e3a4;})[_0x86ad('0x30')](respondWithFilteredResult(_0x30959b,_0xa7d37))[_0x86ad('0x25')](handleError(_0x30959b,null));};exports['show']=function(_0x1de35d,_0x56c0d3){var _0x20c286={'raw':!![],'where':{'id':_0x1de35d[_0x86ad('0x4e')]['id']}},_0x245729={};_0x245729[_0x86ad('0x3e')]=_['keys'](db[_0x86ad('0x4a')]['rawAttributes']);_0x245729[_0x86ad('0x3b')]=_['keys'](_0x1de35d[_0x86ad('0x3b')]);_0x245729[_0x86ad('0x3c')]=_['intersection'](_0x245729['model'],_0x245729[_0x86ad('0x3b')]);_0x20c286[_0x86ad('0x3f')]=_[_0x86ad('0x3d')](_0x245729[_0x86ad('0x3e')],qs[_0x86ad('0x40')](_0x1de35d[_0x86ad('0x3b')][_0x86ad('0x40')]));_0x20c286['attributes']=_0x20c286[_0x86ad('0x3f')][_0x86ad('0x4f')]?_0x20c286['attributes']:_0x245729['model'];if(_0x1de35d['query'][_0x86ad('0x4b')]){_0x20c286[_0x86ad('0x4c')]=[{'all':!![]}];}_0x20c286=_['merge']({},_0x20c286,_0x1de35d[_0x86ad('0x49')]);return db['WhatsappMessage'][_0x86ad('0x50')](_0x20c286)['then'](handleEntityNotFound(_0x56c0d3,null))[_0x86ad('0x30')](respondWithResult(_0x56c0d3,null))[_0x86ad('0x25')](handleError(_0x56c0d3,null));};exports[_0x86ad('0x51')]=function(_0x295bd8,_0x11eead){return db[_0x86ad('0x4a')]['create'](_0x295bd8[_0x86ad('0x52')],{})[_0x86ad('0x30')](respondWithResult(_0x11eead,0xc9))[_0x86ad('0x25')](handleError(_0x11eead,null));};exports[_0x86ad('0x2f')]=function(_0x511aba,_0x5a03ca){if(_0x511aba[_0x86ad('0x52')]['id']){delete _0x511aba[_0x86ad('0x52')]['id'];}return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0x511aba[_0x86ad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a03ca,null))[_0x86ad('0x30')](saveUpdates(_0x511aba[_0x86ad('0x52')],null))[_0x86ad('0x30')](respondWithResult(_0x5a03ca,null))[_0x86ad('0x25')](handleError(_0x5a03ca,null));};exports[_0x86ad('0x31')]=function(_0x832bf2,_0x4f7cca){return db['WhatsappMessage'][_0x86ad('0x50')]({'where':{'id':_0x832bf2[_0x86ad('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f7cca,null))['then'](removeEntity(_0x4f7cca,null))[_0x86ad('0x25')](handleError(_0x4f7cca,null));};exports[_0x86ad('0x53')]=function(_0x2ee0e3,_0x147c40){return db[_0x86ad('0x4a')][_0x86ad('0x53')]()[_0x86ad('0x30')](respondWithResult(_0x147c40,null))[_0x86ad('0x25')](handleError(_0x147c40,null));};var interaction_log=require('../../config/logger')(_0x86ad('0x54'));exports[_0x86ad('0x55')]=function(_0x575465,_0x172ae7,_0x3bf413){var _0x50dfa7={'agent':{},'channel':_0x86ad('0x56')};if(_0x575465[_0x86ad('0x52')]['id']){delete _0x575465[_0x86ad('0x52')]['id'];}_0x575465['body']['read']=!![];_0x575465[_0x86ad('0x52')][_0x86ad('0x57')]=moment()['format'](_0x86ad('0x58'));_0x575465[_0x86ad('0x52')][_0x86ad('0x59')]=_0x575465['body']['UserId']||_0x575465[_0x86ad('0x5a')]['id'];_0x50dfa7[_0x86ad('0x5b')]['id']=_0x575465[_0x86ad('0x52')][_0x86ad('0x59')];return db['WhatsappMessage'][_0x86ad('0x50')]({'where':{'id':_0x575465[_0x86ad('0x4e')]['id'],'UserId':null}})[_0x86ad('0x30')](handleEntityNotFound(_0x172ae7,null))[_0x86ad('0x30')](saveUpdates(_0x575465[_0x86ad('0x52')],null))['then'](function(_0x11dc67){if(_0x11dc67){_0x50dfa7[_0x86ad('0x23')]=_0x11dc67[_0x86ad('0x5c')]({'plain':!![]});return db[_0x86ad('0x5d')][_0x86ad('0x50')]({'where':{'id':_0x11dc67[_0x86ad('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x172ae7,null))['then'](function(_0x33944d){if(_0x33944d){return _0x33944d[_0x86ad('0x2f')]({'UserId':_0x575465[_0x86ad('0x52')][_0x86ad('0x59')],'read1stAt':_[_0x86ad('0x5f')](_0x33944d[_0x86ad('0x60')])?moment()[_0x86ad('0x61')](_0x86ad('0x58')):undefined});}return null;})['then'](function(_0xad2bbe){if(_0xad2bbe){_0x50dfa7[_0x86ad('0x62')]=_0xad2bbe[_0x86ad('0x5c')]({'plain':!![]});interaction_log[_0x86ad('0x1d')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x575465[_0x86ad('0x5a')]['id'],_0x575465[_0x86ad('0x5a')][_0x86ad('0x34')],_0x575465[_0x86ad('0x5a')][_0x86ad('0x63')],_0x50dfa7['interaction']['id'],_0x575465['body']?JSON[_0x86ad('0x64')](_0x575465[_0x86ad('0x52')]):_0x86ad('0x65'));return respondWithRpcPromise(_0x86ad('0x66'),_0x86ad('0x67'),_0x50dfa7);}return null;})[_0x86ad('0x30')](function(_0x237f03){var _0x2f7dda=_0x86ad('0x68')+_0x237f03['message'][_0x86ad('0x69')];return db[_0x86ad('0x6a')][_0x86ad('0x3b')](_0x2f7dda,{'type':db[_0x86ad('0x6b')][_0x86ad('0x6c')][_0x86ad('0x6d')],'raw':!![]})[_0x86ad('0x30')](function(_0xdd93c6){return _0xdd93c6;});})[_0x86ad('0x30')](function(_0x5a83cb){if(_0x5a83cb){_0x50dfa7['message']['contact']=_0x5a83cb[0x0];if(!_0x575465['body'][_0x86ad('0x59')])return;return db[_0x86ad('0x6e')][_0x86ad('0x50')]({'where':{'id':_0x575465['body'][_0x86ad('0x59')],'role':_0x86ad('0x5b')},'attributes':['id',_0x86ad('0x34'),'fullname',_0x86ad('0x6f'),_0x86ad('0x70')],'raw':!![]});}return null;})[_0x86ad('0x30')](function(_0x12f4a5){if(!_0x12f4a5)return null;_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x5b')]=_0x12f4a5;return _0x50dfa7;})[_0x86ad('0x30')](function(_0x3440af){if(_0x3440af){if(_0x575465[_0x86ad('0x52')]['manual']){_0x50dfa7[_0x86ad('0x23')]['interface']=util[_0x86ad('0x61')]('SIP/%s',_0x575465[_0x86ad('0x5a')][_0x86ad('0x34')]);_0x50dfa7['message']['channel']=_0x50dfa7[_0x86ad('0x71')];_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x72')]=_0x50dfa7[_0x86ad('0x71')];_0x50dfa7[_0x86ad('0x23')][_0x86ad('0x73')]=_0x86ad('0x55');return respondWithRpcPromise(_0x86ad('0x74'),_0x86ad('0x74'),{'event':_0x86ad('0x75'),'message':_0x50dfa7[_0x86ad('0x23')]},client9002)['then'](function(){return _0x50dfa7;});}return _0x50dfa7;}return null;})['then'](respondWithResult(_0x172ae7,null))[_0x86ad('0x25')](handleError(_0x172ae7,null));};var interaction_log=require(_0x86ad('0xf'))(_0x86ad('0x54'));exports[_0x86ad('0x76')]=function(_0xbe2c7d,_0x38caf5,_0x342563){var _0x107e5c={'agent':{},'channel':_0x86ad('0x56')};if(_0xbe2c7d[_0x86ad('0x52')]['id']){delete _0xbe2c7d[_0x86ad('0x52')]['id'];}_0xbe2c7d['body']['UserId']=_0xbe2c7d['body']['UserId']||_0xbe2c7d[_0x86ad('0x5a')]['id'];_0x107e5c[_0x86ad('0x5b')]['id']=_0xbe2c7d[_0x86ad('0x52')][_0x86ad('0x59')];return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0xbe2c7d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x38caf5,null))[_0x86ad('0x30')](function(_0x52b081){if(_0x52b081){_0x107e5c[_0x86ad('0x23')]=_0x52b081['get']({'plain':!![]});return db['WhatsappInteraction'][_0x86ad('0x50')]({'where':{'id':_0x52b081[_0x86ad('0x5e')]}});}return null;})[_0x86ad('0x30')](handleEntityNotFound(_0x38caf5,null))[_0x86ad('0x30')](function(_0x1e9755){if(_0x1e9755){_0x107e5c['interaction']=_0x1e9755[_0x86ad('0x5c')]({'plain':!![]});interaction_log[_0x86ad('0x1d')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xbe2c7d[_0x86ad('0x5a')]['id'],_0xbe2c7d['user'][_0x86ad('0x34')],_0xbe2c7d[_0x86ad('0x5a')]['role'],_0x107e5c[_0x86ad('0x62')]['id'],_0xbe2c7d['body']?JSON[_0x86ad('0x64')](_0xbe2c7d[_0x86ad('0x52')]):_0x86ad('0x65'));return respondWithRpcPromise('RejectMessage',_0x86ad('0x77'),_0x107e5c);}return null;})[_0x86ad('0x30')](function(_0x2807fc){var _0x33c9ee=_0x86ad('0x68')+_0x2807fc[_0x86ad('0x23')][_0x86ad('0x69')];return db['sequelize'][_0x86ad('0x3b')](_0x33c9ee,{'type':db['Sequelize'][_0x86ad('0x6c')][_0x86ad('0x6d')],'raw':!![]})[_0x86ad('0x30')](function(_0x2da922){return _0x2da922;});})[_0x86ad('0x30')](function(_0x3e34e0){if(_0x3e34e0){_0x107e5c[_0x86ad('0x23')][_0x86ad('0x78')]=_0x3e34e0[0x0];if(!_0xbe2c7d['body']['UserId'])return;return db[_0x86ad('0x6e')][_0x86ad('0x50')]({'where':{'id':_0xbe2c7d[_0x86ad('0x52')]['UserId'],'role':_0x86ad('0x5b')},'attributes':['id','name',_0x86ad('0x79'),_0x86ad('0x6f'),'internal'],'raw':!![]});}return null;})['then'](function(_0x394734){if(!_0x394734)return null;_0x107e5c[_0x86ad('0x23')]['agent']=_0x394734;return _0x107e5c;})['then'](function(_0x1e8f94){if(_0x1e8f94){_0x1e8f94[_0x86ad('0x23')]['interface']=util['format'](_0x86ad('0x7a'),_0xbe2c7d[_0x86ad('0x5a')][_0x86ad('0x34')]);_0x1e8f94['message'][_0x86ad('0x71')]=_0x107e5c[_0x86ad('0x71')];_0x1e8f94[_0x86ad('0x23')][_0x86ad('0x72')]=_0x107e5c[_0x86ad('0x71')];_0x1e8f94[_0x86ad('0x23')][_0x86ad('0x73')]=_0x86ad('0x76');respondWithRpcPromise('EventManager',_0x86ad('0x74'),{'event':_0x86ad('0x7b'),'message':_0x1e8f94['message']},client9002);return _0x107e5c;}return null;})[_0x86ad('0x30')](respondWithResult(_0x38caf5,null))[_0x86ad('0x25')](handleError(_0x38caf5,null));};exports[_0x86ad('0x2b')]=function(_0x53aa92,_0x2780a7,_0x5cd9ef){if(_0x53aa92['body']['id']){delete _0x53aa92['body']['id'];}var _0x23a926;return db[_0x86ad('0x4a')][_0x86ad('0x50')]({'where':{'id':_0x53aa92[_0x86ad('0x4e')]['id']}})[_0x86ad('0x30')](handleEntityNotFound(_0x2780a7,null))[_0x86ad('0x30')](function(_0x4718e5){if(_0x4718e5){_0x23a926=_0x4718e5;return db[_0x86ad('0x7c')][_0x86ad('0x50')]({'where':{'id':_0x4718e5[_0x86ad('0x7d')]}});}})['then'](handleEntityNotFound(_0x2780a7,null))[_0x86ad('0x30')](function(_0x106f3b){if(_0x106f3b){logger['debug']('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0x86ad('0x2b'),_0x86ad('0x7e'),_0x106f3b['type'],util[_0x86ad('0x7f')](_0x53aa92[_0x86ad('0x52')],{'showHidden':![],'depth':null}));switch(_0x106f3b[_0x86ad('0x38')]){case _0x86ad('0x80'):if(_0x53aa92[_0x86ad('0x52')][_0x86ad('0x81')]&&_0x53aa92['body'][_0x86ad('0x81')]===_0x23a926[_0x86ad('0x82')]&&_0x53aa92[_0x86ad('0x52')][_0x86ad('0x83')]&&_0x53aa92[_0x86ad('0x52')][_0x86ad('0x83')]===_0x86ad('0x84')){return _0x23a926[_0x86ad('0x2f')]({'read':!![]});}else{logger[_0x86ad('0x21')](_0x86ad('0x85'),'status','twilio',util[_0x86ad('0x7f')](_0x53aa92['body'],{'showHidden':![],'depth':null}));}break;}return _0x23a926;}})[_0x86ad('0x30')](respondWithResult(_0x2780a7,null))[_0x86ad('0x25')](handleError(_0x2780a7,null));}; \ No newline at end of file +var _0xb9f4=['stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','params','keys','find','create','body','describe','accept','readAt','format','UserId','user','get','WhatsappInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','email','internal','agent','manual','interface','channel','motionChannel','event','EventManager','whatsapp-interactions','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','ContactId','contact','SIP/%s','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy'];(function(_0x1430a0,_0x3de0f3){var _0x2b3efb=function(_0x187024){while(--_0x187024){_0x1430a0['push'](_0x1430a0['shift']());}};_0x2b3efb(++_0x3de0f3);}(_0xb9f4,0xde));var _0x4b9f=function(_0x57a46e,_0x13761c){_0x57a46e=_0x57a46e-0x0;var _0x216a4d=_0xb9f4[_0x57a46e];return _0x216a4d;};'use strict';var emlformat=require(_0x4b9f('0x0'));var rimraf=require(_0x4b9f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b9f('0x2'));var rp=require('request-promise');var moment=require(_0x4b9f('0x3'));var BPromise=require(_0x4b9f('0x4'));var Mustache=require(_0x4b9f('0x5'));var util=require(_0x4b9f('0x6'));var path=require(_0x4b9f('0x7'));var sox=require('sox');var csv=require(_0x4b9f('0x8'));var ejs=require(_0x4b9f('0x9'));var fs=require('fs');var fs_extra=require(_0x4b9f('0xa'));var _=require(_0x4b9f('0xb'));var squel=require(_0x4b9f('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b9f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b9f('0xe'));var Papa=require(_0x4b9f('0xf'));var Redis=require(_0x4b9f('0x10'));var authService=require(_0x4b9f('0x11'));var qs=require(_0x4b9f('0x12'));var as=require(_0x4b9f('0x13'));var hardwareService=require(_0x4b9f('0x14'));var logger=require(_0x4b9f('0x15'))(_0x4b9f('0x16'));var utils=require(_0x4b9f('0x17'));var config=require(_0x4b9f('0x18'));var licenseUtil=require(_0x4b9f('0x19'));var db=require(_0x4b9f('0x1a'))['db'];config[_0x4b9f('0x1b')]=_[_0x4b9f('0x1c')](config['redis'],{'host':_0x4b9f('0x1d'),'port':0x18eb});var socket=require(_0x4b9f('0x1e'))(new Redis(config['redis']));require(_0x4b9f('0x1f'))['register'](socket);var jayson=require(_0x4b9f('0x20'));var client=jayson[_0x4b9f('0x21')][_0x4b9f('0x22')]({'port':0x232c});var client9002=jayson[_0x4b9f('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x456a7c,_0x1e3350,_0x5624a1,_0x1375c2){return new BPromise(function(_0xd51834,_0x38a9f9){var _0x1782a0=_0x1375c2||client;return _0x1782a0[_0x4b9f('0x23')](_0x456a7c,_0x5624a1)[_0x4b9f('0x24')](function(_0x4cfb01){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1e3350,_0x4b9f('0x25'));logger[_0x4b9f('0x26')](_0x4b9f('0x27'),_0x1e3350,_0x4b9f('0x25'),JSON[_0x4b9f('0x28')](_0x4cfb01));if(_0x4cfb01['error']){if(_0x4cfb01['error'][_0x4b9f('0x29')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1e3350,_0x4cfb01['error']['message']);return _0x38a9f9(_0x4cfb01[_0x4b9f('0x2a')][_0x4b9f('0x2b')]);}logger[_0x4b9f('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x1e3350,_0x4cfb01[_0x4b9f('0x2a')][_0x4b9f('0x2b')]);return _0xd51834(_0x4cfb01['error'][_0x4b9f('0x2b')]);}else{logger['info'](_0x4b9f('0x2c'),_0x1e3350,_0x4b9f('0x25'));_0xd51834(_0x4cfb01[_0x4b9f('0x2d')][_0x4b9f('0x2b')]);}})[_0x4b9f('0x2e')](function(_0x4125d6){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1e3350,_0x4125d6);_0x38a9f9(_0x4125d6);});});}function respondWithStatusCode(_0x40a8d3,_0x2d5fe6){_0x2d5fe6=_0x2d5fe6||0xcc;return function(_0x82edd8){if(_0x82edd8){return _0x40a8d3[_0x4b9f('0x2f')](_0x2d5fe6);}return _0x40a8d3['status'](_0x2d5fe6)[_0x4b9f('0x30')]();};}function respondWithResult(_0x264c97,_0x56ff25){_0x56ff25=_0x56ff25||0xc8;return function(_0xb37833){if(_0xb37833){return _0x264c97[_0x4b9f('0x31')](_0x56ff25)[_0x4b9f('0x32')](_0xb37833);}};}function respondWithFilteredResult(_0x532df4,_0x59728d){return function(_0x17d18b){if(_0x17d18b){var _0x531e54=typeof _0x59728d[_0x4b9f('0x33')]===_0x4b9f('0x34')&&typeof _0x59728d[_0x4b9f('0x35')]===_0x4b9f('0x34');var _0x337d60=_0x17d18b['count'];var _0x1343ff=_0x531e54?0x0:_0x59728d['offset'];var _0x39a9a3=_0x531e54?_0x17d18b[_0x4b9f('0x36')]:_0x59728d[_0x4b9f('0x33')]+_0x59728d['limit'];var _0x2664f4;if(_0x39a9a3>=_0x337d60){_0x39a9a3=_0x337d60;_0x2664f4=0xc8;}else{_0x2664f4=0xce;}_0x532df4[_0x4b9f('0x31')](_0x2664f4);return _0x532df4[_0x4b9f('0x37')](_0x4b9f('0x38'),_0x1343ff+'-'+_0x39a9a3+'/'+_0x337d60)[_0x4b9f('0x32')](_0x17d18b);}return null;};}function patchUpdates(_0x4f3d00){return function(_0x3f8ddb){try{jsonpatch['apply'](_0x3f8ddb,_0x4f3d00,!![]);}catch(_0xcfb50c){return BPromise[_0x4b9f('0x39')](_0xcfb50c);}return _0x3f8ddb['save']();};}function saveUpdates(_0x39c9a1,_0x37f1d6){return function(_0x45c091){if(_0x45c091){return _0x45c091[_0x4b9f('0x3a')](_0x39c9a1)[_0x4b9f('0x24')](function(_0x20e728){return _0x20e728;});}return null;};}function removeEntity(_0x4c3e34,_0x6feba9){return function(_0x5bb5bc){if(_0x5bb5bc){return _0x5bb5bc[_0x4b9f('0x3b')]()[_0x4b9f('0x24')](function(){_0x4c3e34[_0x4b9f('0x31')](0xcc)[_0x4b9f('0x30')]();});}};}function handleEntityNotFound(_0x5daa46,_0x5727d7){return function(_0x2ab872){if(!_0x2ab872){_0x5daa46[_0x4b9f('0x2f')](0x194);}return _0x2ab872;};}function handleError(_0x26fc71,_0x41a6eb){_0x41a6eb=_0x41a6eb||0x1f4;return function(_0x21d0ec){logger[_0x4b9f('0x2a')](_0x21d0ec[_0x4b9f('0x3c')]);if(_0x21d0ec['name']){delete _0x21d0ec[_0x4b9f('0x3d')];}_0x26fc71[_0x4b9f('0x31')](_0x41a6eb)['send'](_0x21d0ec);};}exports[_0x4b9f('0x3e')]=function(_0x4f5e15,_0x483107){var _0x3ed9b2={},_0x3d413c={},_0x5f352e={'count':0x0,'rows':[]};var _0x5244f7=_['map'](db[_0x4b9f('0x3f')][_0x4b9f('0x40')],function(_0x9a155){return{'name':_0x9a155[_0x4b9f('0x41')],'type':_0x9a155[_0x4b9f('0x42')]['key']};});_0x3d413c['model']=_[_0x4b9f('0x43')](_0x5244f7,'name');_0x3d413c['query']=_['keys'](_0x4f5e15[_0x4b9f('0x44')]);_0x3d413c[_0x4b9f('0x45')]=_[_0x4b9f('0x46')](_0x3d413c[_0x4b9f('0x47')],_0x3d413c[_0x4b9f('0x44')]);_0x3ed9b2['attributes']=_['intersection'](_0x3d413c['model'],qs[_0x4b9f('0x48')](_0x4f5e15[_0x4b9f('0x44')][_0x4b9f('0x48')]));_0x3ed9b2[_0x4b9f('0x49')]=_0x3ed9b2[_0x4b9f('0x49')][_0x4b9f('0x4a')]?_0x3ed9b2[_0x4b9f('0x49')]:_0x3d413c[_0x4b9f('0x47')];if(!_0x4f5e15[_0x4b9f('0x44')][_0x4b9f('0x4b')](_0x4b9f('0x4c'))){_0x3ed9b2[_0x4b9f('0x35')]=qs[_0x4b9f('0x35')](_0x4f5e15[_0x4b9f('0x44')][_0x4b9f('0x35')]);_0x3ed9b2['offset']=qs[_0x4b9f('0x33')](_0x4f5e15['query'][_0x4b9f('0x33')]);}_0x3ed9b2['order']=qs[_0x4b9f('0x4d')](_0x4f5e15[_0x4b9f('0x44')]['sort']);_0x3ed9b2[_0x4b9f('0x4e')]=qs['filters'](_[_0x4b9f('0x4f')](_0x4f5e15[_0x4b9f('0x44')],_0x3d413c[_0x4b9f('0x45')]),_0x5244f7);if(_0x4f5e15[_0x4b9f('0x44')]['filter']){_0x3ed9b2[_0x4b9f('0x4e')]=_[_0x4b9f('0x50')](_0x3ed9b2['where'],{'$or':_['map'](_0x5244f7,function(_0x419d61){if(_0x419d61[_0x4b9f('0x42')]!==_0x4b9f('0x51')){var _0x3cbfa9={};_0x3cbfa9[_0x419d61[_0x4b9f('0x3d')]]={'$like':'%'+_0x4f5e15[_0x4b9f('0x44')][_0x4b9f('0x52')]+'%'};return _0x3cbfa9;}})});}_0x3ed9b2=_[_0x4b9f('0x50')]({},_0x3ed9b2,_0x4f5e15['options']);var _0x2fcf9d={'where':_0x3ed9b2[_0x4b9f('0x4e')]};return db[_0x4b9f('0x3f')][_0x4b9f('0x36')](_0x2fcf9d)[_0x4b9f('0x24')](function(_0x35518e){_0x5f352e[_0x4b9f('0x36')]=_0x35518e;if(_0x4f5e15[_0x4b9f('0x44')]['includeAll']){_0x3ed9b2[_0x4b9f('0x53')]=[{'all':!![]}];}return db[_0x4b9f('0x3f')][_0x4b9f('0x54')](_0x3ed9b2);})[_0x4b9f('0x24')](function(_0x1a6aae){_0x5f352e[_0x4b9f('0x55')]=_0x1a6aae;return _0x5f352e;})[_0x4b9f('0x24')](respondWithFilteredResult(_0x483107,_0x3ed9b2))[_0x4b9f('0x2e')](handleError(_0x483107,null));};exports['show']=function(_0xd23cb2,_0x3918e0){var _0x4912dd={'raw':!![],'where':{'id':_0xd23cb2[_0x4b9f('0x56')]['id']}},_0x2ea5ab={};_0x2ea5ab[_0x4b9f('0x47')]=_[_0x4b9f('0x57')](db[_0x4b9f('0x3f')][_0x4b9f('0x40')]);_0x2ea5ab['query']=_[_0x4b9f('0x57')](_0xd23cb2['query']);_0x2ea5ab['filters']=_['intersection'](_0x2ea5ab[_0x4b9f('0x47')],_0x2ea5ab[_0x4b9f('0x44')]);_0x4912dd['attributes']=_[_0x4b9f('0x46')](_0x2ea5ab[_0x4b9f('0x47')],qs['fields'](_0xd23cb2['query'][_0x4b9f('0x48')]));_0x4912dd[_0x4b9f('0x49')]=_0x4912dd['attributes'][_0x4b9f('0x4a')]?_0x4912dd[_0x4b9f('0x49')]:_0x2ea5ab[_0x4b9f('0x47')];if(_0xd23cb2[_0x4b9f('0x44')]['includeAll']){_0x4912dd[_0x4b9f('0x53')]=[{'all':!![]}];}_0x4912dd=_[_0x4b9f('0x50')]({},_0x4912dd,_0xd23cb2['options']);return db[_0x4b9f('0x3f')][_0x4b9f('0x58')](_0x4912dd)[_0x4b9f('0x24')](handleEntityNotFound(_0x3918e0,null))[_0x4b9f('0x24')](respondWithResult(_0x3918e0,null))[_0x4b9f('0x2e')](handleError(_0x3918e0,null));};exports[_0x4b9f('0x59')]=function(_0x2fd4cb,_0x3224af){return db[_0x4b9f('0x3f')][_0x4b9f('0x59')](_0x2fd4cb[_0x4b9f('0x5a')],{})[_0x4b9f('0x24')](respondWithResult(_0x3224af,0xc9))['catch'](handleError(_0x3224af,null));};exports['update']=function(_0x5d3533,_0x1f06c5){if(_0x5d3533[_0x4b9f('0x5a')]['id']){delete _0x5d3533[_0x4b9f('0x5a')]['id'];}return db[_0x4b9f('0x3f')][_0x4b9f('0x58')]({'where':{'id':_0x5d3533['params']['id']}})[_0x4b9f('0x24')](handleEntityNotFound(_0x1f06c5,null))[_0x4b9f('0x24')](saveUpdates(_0x5d3533['body'],null))[_0x4b9f('0x24')](respondWithResult(_0x1f06c5,null))[_0x4b9f('0x2e')](handleError(_0x1f06c5,null));};exports[_0x4b9f('0x3b')]=function(_0x16e552,_0x5c4464){return db[_0x4b9f('0x3f')]['find']({'where':{'id':_0x16e552[_0x4b9f('0x56')]['id']}})[_0x4b9f('0x24')](handleEntityNotFound(_0x5c4464,null))[_0x4b9f('0x24')](removeEntity(_0x5c4464,null))['catch'](handleError(_0x5c4464,null));};exports[_0x4b9f('0x5b')]=function(_0x1ce96c,_0x2d5ff8){return db[_0x4b9f('0x3f')]['describe']()[_0x4b9f('0x24')](respondWithResult(_0x2d5ff8,null))[_0x4b9f('0x2e')](handleError(_0x2d5ff8,null));};var interaction_log=require(_0x4b9f('0x15'))('whatsapp-interactions');exports[_0x4b9f('0x5c')]=function(_0x3a7b0a,_0xe93fc9,_0x5bdf31){var _0x3a4697={'agent':{},'channel':'whatsapp'};if(_0x3a7b0a[_0x4b9f('0x5a')]['id']){delete _0x3a7b0a[_0x4b9f('0x5a')]['id'];}_0x3a7b0a['body']['read']=!![];_0x3a7b0a['body'][_0x4b9f('0x5d')]=moment()[_0x4b9f('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3a7b0a[_0x4b9f('0x5a')][_0x4b9f('0x5f')]=_0x3a7b0a['body'][_0x4b9f('0x5f')]||_0x3a7b0a[_0x4b9f('0x60')]['id'];_0x3a4697['agent']['id']=_0x3a7b0a[_0x4b9f('0x5a')][_0x4b9f('0x5f')];return db[_0x4b9f('0x3f')][_0x4b9f('0x58')]({'where':{'id':_0x3a7b0a[_0x4b9f('0x56')]['id'],'UserId':null}})[_0x4b9f('0x24')](handleEntityNotFound(_0xe93fc9,null))['then'](saveUpdates(_0x3a7b0a[_0x4b9f('0x5a')],null))['then'](function(_0x20d7d6){if(_0x20d7d6){_0x3a4697[_0x4b9f('0x2b')]=_0x20d7d6[_0x4b9f('0x61')]({'plain':!![]});return db[_0x4b9f('0x62')]['find']({'where':{'id':_0x20d7d6['WhatsappInteractionId']}});}return null;})[_0x4b9f('0x24')](handleEntityNotFound(_0xe93fc9,null))[_0x4b9f('0x24')](function(_0x224118){if(_0x224118){return _0x224118[_0x4b9f('0x3a')]({'UserId':_0x3a7b0a[_0x4b9f('0x5a')][_0x4b9f('0x5f')],'read1stAt':_[_0x4b9f('0x63')](_0x224118[_0x4b9f('0x64')])?moment()[_0x4b9f('0x5e')](_0x4b9f('0x65')):undefined});}return null;})['then'](function(_0x4f6df1){if(_0x4f6df1){_0x3a4697[_0x4b9f('0x66')]=_0x4f6df1[_0x4b9f('0x61')]({'plain':!![]});interaction_log['info'](_0x4b9f('0x67'),_0x3a7b0a[_0x4b9f('0x60')]['id'],_0x3a7b0a[_0x4b9f('0x60')][_0x4b9f('0x3d')],_0x3a7b0a[_0x4b9f('0x60')]['role'],_0x3a4697['interaction']['id'],_0x3a7b0a['body']?JSON[_0x4b9f('0x28')](_0x3a7b0a[_0x4b9f('0x5a')]):_0x4b9f('0x68'));return respondWithRpcPromise(_0x4b9f('0x69'),_0x4b9f('0x6a'),_0x3a4697);}return null;})[_0x4b9f('0x24')](function(_0x456982){var _0x4a15da=_0x4b9f('0x6b')+_0x456982[_0x4b9f('0x2b')]['ContactId'];return db[_0x4b9f('0x6c')][_0x4b9f('0x44')](_0x4a15da,{'type':db[_0x4b9f('0x6d')][_0x4b9f('0x6e')]['SELECT'],'raw':!![]})[_0x4b9f('0x24')](function(_0x75327){return _0x75327;});})[_0x4b9f('0x24')](function(_0x24e279){if(_0x24e279){_0x3a4697[_0x4b9f('0x2b')]['contact']=_0x24e279[0x0];if(!_0x3a7b0a[_0x4b9f('0x5a')][_0x4b9f('0x5f')])return;return db[_0x4b9f('0x6f')][_0x4b9f('0x58')]({'where':{'id':_0x3a7b0a[_0x4b9f('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0x4b9f('0x3d'),'fullname',_0x4b9f('0x70'),_0x4b9f('0x71')],'raw':!![]});}return null;})['then'](function(_0x3d66ce){if(!_0x3d66ce)return null;_0x3a4697[_0x4b9f('0x2b')][_0x4b9f('0x72')]=_0x3d66ce;return _0x3a4697;})[_0x4b9f('0x24')](function(_0x73898f){if(_0x73898f){if(_0x3a7b0a[_0x4b9f('0x5a')][_0x4b9f('0x73')]){_0x3a4697[_0x4b9f('0x2b')][_0x4b9f('0x74')]=util[_0x4b9f('0x5e')]('SIP/%s',_0x3a7b0a[_0x4b9f('0x60')][_0x4b9f('0x3d')]);_0x3a4697['message'][_0x4b9f('0x75')]=_0x3a4697['channel'];_0x3a4697[_0x4b9f('0x2b')][_0x4b9f('0x76')]=_0x3a4697[_0x4b9f('0x75')];_0x3a4697[_0x4b9f('0x2b')][_0x4b9f('0x77')]=_0x4b9f('0x5c');return respondWithRpcPromise('EventManager',_0x4b9f('0x78'),{'event':'acceptmessage','message':_0x3a4697['message']},client9002)['then'](function(){return _0x3a4697;});}return _0x3a4697;}return null;})[_0x4b9f('0x24')](respondWithResult(_0xe93fc9,null))[_0x4b9f('0x2e')](handleError(_0xe93fc9,null));};var interaction_log=require(_0x4b9f('0x15'))(_0x4b9f('0x79'));exports['reject']=function(_0x4320a2,_0x2eabe5,_0x59dc28){var _0x2ca961={'agent':{},'channel':_0x4b9f('0x7a')};if(_0x4320a2[_0x4b9f('0x5a')]['id']){delete _0x4320a2[_0x4b9f('0x5a')]['id'];}_0x4320a2[_0x4b9f('0x5a')][_0x4b9f('0x5f')]=_0x4320a2[_0x4b9f('0x5a')][_0x4b9f('0x5f')]||_0x4320a2[_0x4b9f('0x60')]['id'];_0x2ca961[_0x4b9f('0x72')]['id']=_0x4320a2[_0x4b9f('0x5a')][_0x4b9f('0x5f')];return db[_0x4b9f('0x3f')][_0x4b9f('0x58')]({'where':{'id':_0x4320a2[_0x4b9f('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2eabe5,null))[_0x4b9f('0x24')](function(_0x25f598){if(_0x25f598){_0x2ca961[_0x4b9f('0x2b')]=_0x25f598[_0x4b9f('0x61')]({'plain':!![]});return db[_0x4b9f('0x62')][_0x4b9f('0x58')]({'where':{'id':_0x25f598[_0x4b9f('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x2eabe5,null))[_0x4b9f('0x24')](function(_0x43c7e3){if(_0x43c7e3){_0x2ca961[_0x4b9f('0x66')]=_0x43c7e3[_0x4b9f('0x61')]({'plain':!![]});interaction_log['info'](_0x4b9f('0x7c'),_0x4320a2[_0x4b9f('0x60')]['id'],_0x4320a2[_0x4b9f('0x60')]['name'],_0x4320a2['user'][_0x4b9f('0x7d')],_0x2ca961[_0x4b9f('0x66')]['id'],_0x4320a2[_0x4b9f('0x5a')]?JSON[_0x4b9f('0x28')](_0x4320a2[_0x4b9f('0x5a')]):'null');return respondWithRpcPromise(_0x4b9f('0x7e'),_0x4b9f('0x7f'),_0x2ca961);}return null;})[_0x4b9f('0x24')](function(_0x5a8009){var _0x1549e6=_0x4b9f('0x6b')+_0x5a8009[_0x4b9f('0x2b')][_0x4b9f('0x80')];return db[_0x4b9f('0x6c')][_0x4b9f('0x44')](_0x1549e6,{'type':db['Sequelize'][_0x4b9f('0x6e')]['SELECT'],'raw':!![]})[_0x4b9f('0x24')](function(_0x214cea){return _0x214cea;});})[_0x4b9f('0x24')](function(_0x23ace7){if(_0x23ace7){_0x2ca961[_0x4b9f('0x2b')][_0x4b9f('0x81')]=_0x23ace7[0x0];if(!_0x4320a2['body']['UserId'])return;return db[_0x4b9f('0x6f')]['find']({'where':{'id':_0x4320a2[_0x4b9f('0x5a')][_0x4b9f('0x5f')],'role':_0x4b9f('0x72')},'attributes':['id',_0x4b9f('0x3d'),'fullname',_0x4b9f('0x70'),_0x4b9f('0x71')],'raw':!![]});}return null;})['then'](function(_0xcd259b){if(!_0xcd259b)return null;_0x2ca961[_0x4b9f('0x2b')][_0x4b9f('0x72')]=_0xcd259b;return _0x2ca961;})[_0x4b9f('0x24')](function(_0x4eebb5){if(_0x4eebb5){_0x4eebb5[_0x4b9f('0x2b')]['interface']=util[_0x4b9f('0x5e')](_0x4b9f('0x82'),_0x4320a2[_0x4b9f('0x60')][_0x4b9f('0x3d')]);_0x4eebb5[_0x4b9f('0x2b')][_0x4b9f('0x75')]=_0x2ca961[_0x4b9f('0x75')];_0x4eebb5[_0x4b9f('0x2b')][_0x4b9f('0x76')]=_0x2ca961[_0x4b9f('0x75')];_0x4eebb5[_0x4b9f('0x2b')][_0x4b9f('0x77')]=_0x4b9f('0x39');respondWithRpcPromise(_0x4b9f('0x78'),_0x4b9f('0x78'),{'event':_0x4b9f('0x83'),'message':_0x4eebb5[_0x4b9f('0x2b')]},client9002);return _0x2ca961;}return null;})[_0x4b9f('0x24')](respondWithResult(_0x2eabe5,null))['catch'](handleError(_0x2eabe5,null));};exports['status']=function(_0xff6364,_0x350297,_0x290d6e){if(_0xff6364['body']['id']){delete _0xff6364['body']['id'];}var _0x180027;return db[_0x4b9f('0x3f')][_0x4b9f('0x58')]({'where':{'id':_0xff6364[_0x4b9f('0x56')]['id']}})[_0x4b9f('0x24')](handleEntityNotFound(_0x350297,null))[_0x4b9f('0x24')](function(_0x3d0312){if(_0x3d0312){_0x180027=_0x3d0312;return db[_0x4b9f('0x84')]['find']({'where':{'id':_0x3d0312['WhatsappAccountId']}});}})[_0x4b9f('0x24')](handleEntityNotFound(_0x350297,null))[_0x4b9f('0x24')](function(_0x15b285){if(_0x15b285){logger['debug'](_0x4b9f('0x85'),_0x4b9f('0x31'),_0x4b9f('0x86'),_0x15b285[_0x4b9f('0x42')],util[_0x4b9f('0x87')](_0xff6364[_0x4b9f('0x5a')],{'showHidden':![],'depth':null}));switch(_0x15b285['type']){case _0x4b9f('0x88'):if(_0xff6364[_0x4b9f('0x5a')][_0x4b9f('0x89')]&&_0xff6364[_0x4b9f('0x5a')][_0x4b9f('0x89')]===_0x180027[_0x4b9f('0x8a')]&&_0xff6364[_0x4b9f('0x5a')][_0x4b9f('0x8b')]&&_0xff6364[_0x4b9f('0x5a')][_0x4b9f('0x8b')]===_0x4b9f('0x8c')){return _0x180027[_0x4b9f('0x3a')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s','status','twilio',util[_0x4b9f('0x87')](_0xff6364['body'],{'showHidden':![],'depth':null}));}break;}return _0x180027;}})[_0x4b9f('0x24')](respondWithResult(_0x350297,null))[_0x4b9f('0x2e')](handleError(_0x350297,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2137542..dbab840 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 _0x7794=['save','remove','hasOwnProperty','hook','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x7794,0x7b));var _0x4779=function(_0x33c8db,_0x5d6316){_0x33c8db=_0x33c8db-0x0;var _0x1746a6=_0x7794[_0x33c8db];return _0x1746a6;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4779('0x0'))['db'][_0x4779('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4779('0x2')](0x0);var events={'afterCreate':_0x4779('0x3'),'afterUpdate':'update','afterDestroy':_0x4779('0x4')};function emitEvent(_0x1e9fdc){return function(_0x4d3b05,_0x40e5f9,_0x54dc7f){WhatsappMessageEvents['emit'](_0x1e9fdc+':'+_0x4d3b05['id'],_0x4d3b05);WhatsappMessageEvents['emit'](_0x1e9fdc,_0x4d3b05);_0x54dc7f(null);};}for(var e in events){if(events[_0x4779('0x5')](e)){var event=events[e];WhatsappMessage[_0x4779('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x51c5=['events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1ed4f0,_0x130e2c){var _0x5c9d48=function(_0xb91ea4){while(--_0xb91ea4){_0x1ed4f0['push'](_0x1ed4f0['shift']());}};_0x5c9d48(++_0x130e2c);}(_0x51c5,0x8f));var _0x551c=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x51c5[_0x1a9204];return _0x17ca68;};'use strict';var EventEmitter=require(_0x551c('0x0'));var WhatsappMessage=require(_0x551c('0x1'))['db'][_0x551c('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x551c('0x3')](0x0);var events={'afterCreate':_0x551c('0x4'),'afterUpdate':_0x551c('0x5'),'afterDestroy':_0x551c('0x6')};function emitEvent(_0x5add80){return function(_0x230657,_0x1639d0,_0x28e608){WhatsappMessageEvents[_0x551c('0x7')](_0x5add80+':'+_0x230657['id'],_0x230657);WhatsappMessageEvents[_0x551c('0x7')](_0x5add80,_0x230657);_0x28e608(null);};}for(var e in events){if(events[_0x551c('0x8')](e)){var event=events[e];WhatsappMessage[_0x551c('0x9')](e,emitEvent(event));}}module[_0x551c('0xa')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 40decce..a54d4e8 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 _0x239b=['out','secret','isNil','UserId','findOne','WhatsappInteractionId','createdAt','catch','error','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase'];(function(_0x548281,_0x379e04){var _0x19ef24=function(_0x1581a5){while(--_0x1581a5){_0x548281['push'](_0x548281['shift']());}};_0x19ef24(++_0x379e04);}(_0x239b,0x141));var _0xb239=function(_0x3f2476,_0xfae0ca){_0x3f2476=_0x3f2476-0x0;var _0x36cf2b=_0x239b[_0x3f2476];return _0x36cf2b;};'use strict';var _=require('lodash');var util=require(_0xb239('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb239('0x1'));var BPromise=require(_0xb239('0x2'));var rp=require(_0xb239('0x3'));var fetch=require(_0xb239('0x4'));var fs=require('fs');var path=require(_0xb239('0x5'));var rimraf=require('rimraf');var config=require(_0xb239('0x6'));var attributes=require(_0xb239('0x7'));module[_0xb239('0x8')]=function(_0xbba6ed,_0x50aab9){return _0xbba6ed['define']('WhatsappMessage',attributes,{'tableName':_0xb239('0x9'),'paranoid':![],'indexes':[{'name':_0xb239('0xa'),'fields':[_0xb239('0xa')]},{'name':_0xb239('0xb'),'fields':['body'],'type':_0xb239('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x169e65,_0x191a27,_0x2767af){var _0x1c5337=_0xbba6ed['models'];var _0x2ff50d=_0x169e65['get']({'plain':!![]});if(_0x2ff50d[_0xb239('0xd')]['toLowerCase']()==='in'||_0x2ff50d[_0xb239('0xd')][_0xb239('0xe')]()===_0xb239('0xf')&&!_0x2ff50d[_0xb239('0x10')]&&!_[_0xb239('0x11')](_0x2ff50d[_0xb239('0x12')])){_0x1c5337['WhatsappInteraction'][_0xb239('0x13')]({'where':{'id':_0x2ff50d[_0xb239('0x14')]}})['then'](function(_0x483b9c){if(_0x483b9c){_0x483b9c['update']({'lastMsgAt':_0x2ff50d[_0xb239('0x15')],'lastMsgDirection':_0x2ff50d[_0xb239('0xd')]['toLowerCase']()});}})[_0xb239('0x16')](function(_0x15a7bd){console[_0xb239('0x17')](_0x15a7bd);});}if(_0x2ff50d['direction']==='out'&&!_0x2ff50d['secret']){var _0x464761;_0x1c5337[_0xb239('0x18')][_0xb239('0x19')]({'where':{'id':_0x2ff50d['WhatsappAccountId']},'raw':!![]})[_0xb239('0x1a')](function(_0xa75e9c){_0x464761=_0xa75e9c;if(_0x464761&&_0x464761[_0xb239('0x1b')]){switch(_0x464761[_0xb239('0x1b')]){case _0xb239('0x1c'):var _0x481347=require('twilio');if(_0x464761[_0xb239('0x1d')]&&_0x464761[_0xb239('0x1e')]&&_0x464761[_0xb239('0x1f')]){var _0x1c4e3e=new _0x481347(_0x464761['accountSid'],_0x464761[_0xb239('0x1e')]);_0x1c4e3e[_0xb239('0x20')][_0xb239('0x21')]({'body':_0x2ff50d[_0xb239('0x22')],'to':_0xb239('0x23')+_0x2ff50d[_0xb239('0x1f')],'from':_0xb239('0x23')+_0x464761['phone'],'statusCallback':_0x464761[_0xb239('0x24')]+_0xb239('0x25')+_0x2ff50d['id']+_0xb239('0x26')+_0x464761[_0xb239('0x27')]})[_0xb239('0x1a')](function(_0x1fa8ca){if(_0x1fa8ca['sid']){return _0x169e65[_0xb239('0x28')]({'messageId':_0x1fa8ca['sid']});}})[_0xb239('0x16')](function(_0x50b411){logger[_0xb239('0x17')](_0xb239('0x29'),'afterCreate',_0xb239('0x1c'),util['inspect'](_0x50b411,{'showHidden':![],'depth':null}));});}else{logger[_0xb239('0x17')](_0xb239('0x29'),_0xb239('0x2a'),_0xb239('0x1c'),_0xb239('0x2b'));}break;case _0xb239('0x2c'):var _0x5933b0=_0x464761['accountSid'];var _0x4a3ae6=_0x464761['authToken'];var _0x49aae5=_0x464761[_0xb239('0x2d')]+_0xb239('0x2e')+_0x5933b0+'/messages/';var _0x33992f={'to':[_0x2ff50d['phone']],'message':{'type':_0xb239('0x2f'),'text':_0x2ff50d[_0xb239('0x22')]}};var _0x25a4aa={'method':_0xb239('0x30'),'uri':_0x49aae5,'headers':{'Authorization':_0xb239('0x31')+_0x4a3ae6,'Content-Type':_0xb239('0x32')},'body':_0x33992f,'json':!![]};rp(_0x25a4aa)[_0xb239('0x1a')](function(_0x2cf665){if(_0x2cf665['statuses'][0x0][_0xb239('0x33')]){return _0x169e65['update']({'messageId':_0x2cf665[_0xb239('0x34')][0x0][_0xb239('0x33')]});}})[_0xb239('0x16')](function(_0x1eec70){logger['err'](_0xb239('0x35'),_0x1eec70);});break;}}})['finally'](function(){_0x2767af();});}else{_0x2767af();}}},'charset':_0xb239('0x36'),'collate':_0xb239('0x37')});}; \ No newline at end of file +var _0xe5ba=['authToken','messages','create','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','WhatsappInteractionId','then','update','createdAt','catch','find','WhatsappAccountId','type','twilio','accountSid','phone'];(function(_0x474a80,_0x534f83){var _0x8ffa99=function(_0x11475d){while(--_0x11475d){_0x474a80['push'](_0x474a80['shift']());}};_0x8ffa99(++_0x534f83);}(_0xe5ba,0x106));var _0xae5b=function(_0x10ad24,_0x4676bd){_0x10ad24=_0x10ad24-0x0;var _0x1936f3=_0xe5ba[_0x10ad24];return _0x1936f3;};'use strict';var _=require(_0xae5b('0x0'));var util=require('util');var logger=require(_0xae5b('0x1'))('api');var moment=require('moment');var BPromise=require(_0xae5b('0x2'));var rp=require(_0xae5b('0x3'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xae5b('0x4'));var rimraf=require('rimraf');var config=require(_0xae5b('0x5'));var attributes=require('./whatsappMessage.attributes');module[_0xae5b('0x6')]=function(_0x44ed7e,_0x56b634){return _0x44ed7e[_0xae5b('0x7')](_0xae5b('0x8'),attributes,{'tableName':_0xae5b('0x9'),'paranoid':![],'indexes':[{'name':_0xae5b('0xa'),'fields':[_0xae5b('0xa')]},{'name':_0xae5b('0xb'),'fields':['body'],'type':_0xae5b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4c633d,_0x3adf85,_0x3b2c25){var _0x3503d3=_0x44ed7e[_0xae5b('0xd')];var _0x4f564d=_0x4c633d[_0xae5b('0xe')]({'plain':!![]});if(_0x4f564d[_0xae5b('0xf')][_0xae5b('0x10')]()==='in'||_0x4f564d[_0xae5b('0xf')][_0xae5b('0x10')]()===_0xae5b('0x11')&&!_0x4f564d[_0xae5b('0x12')]&&!_[_0xae5b('0x13')](_0x4f564d[_0xae5b('0x14')])){_0x3503d3[_0xae5b('0x15')]['findOne']({'where':{'id':_0x4f564d[_0xae5b('0x16')]}})[_0xae5b('0x17')](function(_0x390cc5){if(_0x390cc5){_0x390cc5[_0xae5b('0x18')]({'lastMsgAt':_0x4f564d[_0xae5b('0x19')],'lastMsgDirection':_0x4f564d[_0xae5b('0xf')]['toLowerCase']()});}})[_0xae5b('0x1a')](function(_0x188b3d){console['error'](_0x188b3d);});}if(_0x4f564d[_0xae5b('0xf')]===_0xae5b('0x11')&&!_0x4f564d[_0xae5b('0x12')]){var _0x50bddd;_0x3503d3['WhatsappAccount'][_0xae5b('0x1b')]({'where':{'id':_0x4f564d[_0xae5b('0x1c')]},'raw':!![]})['then'](function(_0x2d9a22){_0x50bddd=_0x2d9a22;if(_0x50bddd&&_0x50bddd['type']){switch(_0x50bddd[_0xae5b('0x1d')]){case _0xae5b('0x1e'):var _0xc58d8c=require(_0xae5b('0x1e'));if(_0x50bddd[_0xae5b('0x1f')]&&_0x50bddd['authToken']&&_0x50bddd[_0xae5b('0x20')]){var _0x2faad9=new _0xc58d8c(_0x50bddd[_0xae5b('0x1f')],_0x50bddd[_0xae5b('0x21')]);_0x2faad9[_0xae5b('0x22')][_0xae5b('0x23')]({'body':_0x4f564d['body'],'to':'whatsapp:'+_0x4f564d[_0xae5b('0x20')],'from':'whatsapp:'+_0x50bddd[_0xae5b('0x20')],'statusCallback':_0x50bddd[_0xae5b('0x24')]+_0xae5b('0x25')+_0x4f564d['id']+_0xae5b('0x26')+_0x50bddd[_0xae5b('0x27')]})[_0xae5b('0x17')](function(_0x50eb69){if(_0x50eb69[_0xae5b('0x28')]){return _0x4c633d[_0xae5b('0x18')]({'messageId':_0x50eb69[_0xae5b('0x28')]});}})['catch'](function(_0x2b33fe){logger[_0xae5b('0x29')](_0xae5b('0x2a'),_0xae5b('0x2b'),_0xae5b('0x1e'),util[_0xae5b('0x2c')](_0x2b33fe,{'showHidden':![],'depth':null}));});}else{logger[_0xae5b('0x29')](_0xae5b('0x2a'),'afterCreate',_0xae5b('0x1e'),_0xae5b('0x2d'));}break;case'sinch':var _0xbe52a9=_0x50bddd['accountSid'];var _0x133a02=_0x50bddd[_0xae5b('0x21')];var _0x31206c=_0x50bddd[_0xae5b('0x2e')]+_0xae5b('0x2f')+_0xbe52a9+_0xae5b('0x30');var _0x3d8289={'to':[_0x4f564d[_0xae5b('0x20')]],'message':{'type':_0xae5b('0x31'),'text':_0x4f564d[_0xae5b('0x32')]}};var _0x2a3ab3={'method':_0xae5b('0x33'),'uri':_0x31206c,'headers':{'Authorization':_0xae5b('0x34')+_0x133a02,'Content-Type':_0xae5b('0x35')},'body':_0x3d8289,'json':!![]};rp(_0x2a3ab3)[_0xae5b('0x17')](function(_0x49f58b){if(_0x49f58b[_0xae5b('0x36')][0x0][_0xae5b('0x37')]){return _0x4c633d[_0xae5b('0x18')]({'messageId':_0x49f58b[_0xae5b('0x36')][0x0][_0xae5b('0x37')]});}})[_0xae5b('0x1a')](function(_0x24f719){logger['err']('WhatsappMessage,\x20%s',_0x24f719);});break;}}})[_0xae5b('0x38')](function(){_0x3b2c25();});}else{_0x3b2c25();}}},'charset':_0xae5b('0x39'),'collate':_0xae5b('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index e598a83..25a5c87 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 _0x0673=['WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./whatsappMessage.socket','register','request','then','request\x20sent','debug','stringify','error','code'];(function(_0xbe67e0,_0x5e6a91){var _0x343480=function(_0xb98f6b){while(--_0xb98f6b){_0xbe67e0['push'](_0xbe67e0['shift']());}};_0x343480(++_0x5e6a91);}(_0x0673,0xbe));var _0x3067=function(_0x3cb6f6,_0x16f93d){_0x3cb6f6=_0x3cb6f6-0x0;var _0x535aba=_0x0673[_0x3cb6f6];return _0x535aba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3067('0x0'));var BPromise=require(_0x3067('0x1'));var rs=require(_0x3067('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3067('0x3'));var logger=require(_0x3067('0x4'))(_0x3067('0x5'));var config=require(_0x3067('0x6'));var jayson=require(_0x3067('0x7'));var client=jayson['client'][_0x3067('0x8')]({'port':0x232a});config[_0x3067('0x9')]=_['defaults'](config[_0x3067('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x3067('0xa'))(new Redis(config[_0x3067('0x9')]));require(_0x3067('0xb'))[_0x3067('0xc')](socket);function respondWithRpcPromise(_0x21c929,_0x578a62,_0x3e9ac7){return new BPromise(function(_0x5742aa,_0x44da4b){return client[_0x3067('0xd')](_0x21c929,_0x3e9ac7)[_0x3067('0xe')](function(_0x16ff06){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x578a62,_0x3067('0xf'));logger[_0x3067('0x10')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x578a62,'request\x20sent',JSON[_0x3067('0x11')](_0x16ff06));if(_0x16ff06[_0x3067('0x12')]){if(_0x16ff06[_0x3067('0x12')][_0x3067('0x13')]===0x1f4){logger[_0x3067('0x12')](_0x3067('0x14'),_0x578a62,_0x16ff06[_0x3067('0x12')][_0x3067('0x15')]);return _0x44da4b(_0x16ff06['error'][_0x3067('0x15')]);}logger['error'](_0x3067('0x14'),_0x578a62,_0x16ff06[_0x3067('0x12')]['message']);return _0x5742aa(_0x16ff06[_0x3067('0x12')][_0x3067('0x15')]);}else{logger[_0x3067('0x16')](_0x3067('0x14'),_0x578a62,_0x3067('0xf'));_0x5742aa(_0x16ff06[_0x3067('0x17')][_0x3067('0x15')]);}})[_0x3067('0x18')](function(_0x195aee){logger[_0x3067('0x12')](_0x3067('0x14'),_0x578a62,_0x195aee);_0x44da4b(_0x195aee);});});}exports[_0x3067('0x19')]=function(_0x5a1ec5){var _0x249e62=this;return new Promise(function(_0x7c1b5,_0x3f0dad){return db[_0x3067('0x1a')][_0x3067('0x1b')](_0x5a1ec5[_0x3067('0x1c')],{'raw':_0x5a1ec5[_0x3067('0x1d')]?_0x5a1ec5[_0x3067('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3067('0xe')](function(_0x10d1c7){logger['info'](_0x3067('0x19'),_0x5a1ec5);logger['debug']('CreateWhatsappMessage',_0x5a1ec5,JSON[_0x3067('0x11')](_0x10d1c7));_0x7c1b5(_0x10d1c7);})[_0x3067('0x18')](function(_0x245d49){logger['error'](_0x3067('0x19'),_0x245d49[_0x3067('0x15')],_0x5a1ec5);_0x3f0dad(_0x249e62[_0x3067('0x12')](0x1f4,_0x245d49[_0x3067('0x15')]));});});}; \ No newline at end of file +var _0xad6b=['raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x31ca79,_0x571eb4){var _0x300b08=function(_0xc382){while(--_0xc382){_0x31ca79['push'](_0x31ca79['shift']());}};_0x300b08(++_0x571eb4);}(_0xad6b,0x1ae));var _0xbad6=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xad6b[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xbad6('0x0'));var util=require('util');var moment=require(_0xbad6('0x1'));var BPromise=require(_0xbad6('0x2'));var rs=require(_0xbad6('0x3'));var fs=require('fs');var Redis=require(_0xbad6('0x4'));var db=require(_0xbad6('0x5'))['db'];var utils=require(_0xbad6('0x6'));var logger=require(_0xbad6('0x7'))(_0xbad6('0x8'));var config=require(_0xbad6('0x9'));var jayson=require(_0xbad6('0xa'));var client=jayson['client'][_0xbad6('0xb')]({'port':0x232a});config[_0xbad6('0xc')]=_[_0xbad6('0xd')](config[_0xbad6('0xc')],{'host':_0xbad6('0xe'),'port':0x18eb});var socket=require(_0xbad6('0xf'))(new Redis(config[_0xbad6('0xc')]));require(_0xbad6('0x10'))[_0xbad6('0x11')](socket);function respondWithRpcPromise(_0x5bfca3,_0x408f10,_0x1a9e3e){return new BPromise(function(_0x40aa57,_0x306e89){return client['request'](_0x5bfca3,_0x1a9e3e)['then'](function(_0xd4c7e2){logger[_0xbad6('0x12')](_0xbad6('0x13'),_0x408f10,_0xbad6('0x14'));logger[_0xbad6('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x408f10,'request\x20sent',JSON[_0xbad6('0x16')](_0xd4c7e2));if(_0xd4c7e2[_0xbad6('0x17')]){if(_0xd4c7e2[_0xbad6('0x17')][_0xbad6('0x18')]===0x1f4){logger[_0xbad6('0x17')](_0xbad6('0x13'),_0x408f10,_0xd4c7e2[_0xbad6('0x17')][_0xbad6('0x19')]);return _0x306e89(_0xd4c7e2[_0xbad6('0x17')][_0xbad6('0x19')]);}logger['error'](_0xbad6('0x13'),_0x408f10,_0xd4c7e2[_0xbad6('0x17')][_0xbad6('0x19')]);return _0x40aa57(_0xd4c7e2[_0xbad6('0x17')][_0xbad6('0x19')]);}else{logger[_0xbad6('0x12')](_0xbad6('0x13'),_0x408f10,_0xbad6('0x14'));_0x40aa57(_0xd4c7e2[_0xbad6('0x1a')][_0xbad6('0x19')]);}})['catch'](function(_0x54b6d1){logger['error'](_0xbad6('0x13'),_0x408f10,_0x54b6d1);_0x306e89(_0x54b6d1);});});}exports[_0xbad6('0x1b')]=function(_0x457d6f){var _0x556d4b=this;return new Promise(function(_0x415236,_0x28fa0a){return db[_0xbad6('0x1c')][_0xbad6('0x1d')](_0x457d6f[_0xbad6('0x1e')],{'raw':_0x457d6f[_0xbad6('0x1f')]?_0x457d6f[_0xbad6('0x1f')][_0xbad6('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2657f4){logger[_0xbad6('0x12')](_0xbad6('0x1b'),_0x457d6f);logger[_0xbad6('0x15')](_0xbad6('0x1b'),_0x457d6f,JSON[_0xbad6('0x16')](_0x2657f4));_0x415236(_0x2657f4);})['catch'](function(_0x39c6d3){logger['error'](_0xbad6('0x1b'),_0x39c6d3['message'],_0x457d6f);_0x28fa0a(_0x556d4b[_0xbad6('0x17')](0x1f4,_0x39c6d3[_0xbad6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 99f6bdc..ef089b7 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 _0x18dd=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update'];(function(_0x17784a,_0x42fe44){var _0x41aded=function(_0x2e7319){while(--_0x2e7319){_0x17784a['push'](_0x17784a['shift']());}};_0x41aded(++_0x42fe44);}(_0x18dd,0xb5));var _0xd18d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x18dd[_0x1035c1];return _0x308d67;};'use strict';var WhatsappMessageEvents=require(_0xd18d('0x0'));var events=[_0xd18d('0x1'),'remove',_0xd18d('0x2')];function createListener(_0x4a2b59,_0x160896){return function(_0x159167){_0x160896[_0xd18d('0x3')](_0x4a2b59,_0x159167);};}function removeListener(_0xcd49b3,_0x5bcdb7){return function(){WhatsappMessageEvents[_0xd18d('0x4')](_0xcd49b3,_0x5bcdb7);};}exports[_0xd18d('0x5')]=function(_0x196eb4){for(var _0x4dc1e6=0x0,_0x303276=events[_0xd18d('0x6')];_0x4dc1e6<_0x303276;_0x4dc1e6++){var _0x16a1b7=events[_0x4dc1e6];var _0x395e3e=createListener(_0xd18d('0x7')+_0x16a1b7,_0x196eb4);WhatsappMessageEvents['on'](_0x16a1b7,_0x395e3e);}}; \ No newline at end of file +var _0x0920=['remove','update','emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x2932cf,_0x362fd9){var _0x1711dd=function(_0x2d8de6){while(--_0x2d8de6){_0x2932cf['push'](_0x2932cf['shift']());}};_0x1711dd(++_0x362fd9);}(_0x0920,0x156));var _0x0092=function(_0x2eb3db,_0x4a32c0){_0x2eb3db=_0x2eb3db-0x0;var _0x358f33=_0x0920[_0x2eb3db];return _0x358f33;};'use strict';var WhatsappMessageEvents=require(_0x0092('0x0'));var events=[_0x0092('0x1'),_0x0092('0x2'),_0x0092('0x3')];function createListener(_0x4921c1,_0x2d1c22){return function(_0x45a78c){_0x2d1c22[_0x0092('0x4')](_0x4921c1,_0x45a78c);};}function removeListener(_0x448ccb,_0x552dc1){return function(){WhatsappMessageEvents[_0x0092('0x5')](_0x448ccb,_0x552dc1);};}exports['register']=function(_0x1a76c1){for(var _0x937997=0x0,_0x424e10=events[_0x0092('0x6')];_0x937997<_0x424e10;_0x937997++){var _0x39ac26=events[_0x937997];var _0x304126=createListener(_0x0092('0x7')+_0x39ac26,_0x1a76c1);WhatsappMessageEvents['on'](_0x39ac26,_0x304126);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e3b1f3b..672b3fe 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 _0x3f59=['update','delete','destroy','removeTeams','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put'];(function(_0x181e7e,_0x57323e){var _0xe4db71=function(_0x431f54){while(--_0x431f54){_0x181e7e['push'](_0x181e7e['shift']());}};_0xe4db71(++_0x57323e);}(_0x3f59,0x1d4));var _0x93f5=function(_0x19f8e0,_0x4efa3f){_0x19f8e0=_0x19f8e0-0x0;var _0xd84710=_0x3f59[_0x19f8e0];return _0xd84710;};'use strict';var multer=require(_0x93f5('0x0'));var util=require('util');var path=require(_0x93f5('0x1'));var timeout=require(_0x93f5('0x2'));var express=require(_0x93f5('0x3'));var router=express[_0x93f5('0x4')]();var fs_extra=require(_0x93f5('0x5'));var auth=require(_0x93f5('0x6'));var interaction=require(_0x93f5('0x7'));var config=require(_0x93f5('0x8'));var controller=require(_0x93f5('0x9'));router['get']('/',auth[_0x93f5('0xa')](),controller[_0x93f5('0xb')]);router[_0x93f5('0xc')]('/describe',auth[_0x93f5('0xa')](),controller[_0x93f5('0xd')]);router[_0x93f5('0xc')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0xf')]);router[_0x93f5('0xc')](_0x93f5('0x10'),auth['isAuthenticated'](),controller['getMembers']);router[_0x93f5('0xc')](_0x93f5('0x11'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x12')]);router[_0x93f5('0xc')](_0x93f5('0x13'),auth['isAuthenticated'](),controller[_0x93f5('0x14')]);router[_0x93f5('0x15')]('/',auth[_0x93f5('0xa')](),controller[_0x93f5('0x16')]);router[_0x93f5('0x15')]('/:id/teams',auth[_0x93f5('0xa')](),controller['addTeams']);router[_0x93f5('0x15')](_0x93f5('0x13'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x17')]);router[_0x93f5('0x18')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x19')]);router[_0x93f5('0x1a')](_0x93f5('0xe'),auth[_0x93f5('0xa')](),controller[_0x93f5('0x1b')]);router[_0x93f5('0x1a')]('/:id/teams',auth[_0x93f5('0xa')](),controller[_0x93f5('0x1c')]);router[_0x93f5('0x1a')](_0x93f5('0x13'),auth[_0x93f5('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x081e=['/:id','/:id/members','getMembers','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x251f3e,_0xa6388f){var _0x377403=function(_0x201094){while(--_0x201094){_0x251f3e['push'](_0x251f3e['shift']());}};_0x377403(++_0xa6388f);}(_0x081e,0x9f));var _0xe081=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x081e[_0x3337b6];return _0x568270;};'use strict';var multer=require(_0xe081('0x0'));var util=require(_0xe081('0x1'));var path=require(_0xe081('0x2'));var timeout=require(_0xe081('0x3'));var express=require(_0xe081('0x4'));var router=express[_0xe081('0x5')]();var fs_extra=require(_0xe081('0x6'));var auth=require(_0xe081('0x7'));var interaction=require(_0xe081('0x8'));var config=require('../../config/environment');var controller=require(_0xe081('0x9'));router[_0xe081('0xa')]('/',auth[_0xe081('0xb')](),controller[_0xe081('0xc')]);router[_0xe081('0xa')](_0xe081('0xd'),auth[_0xe081('0xb')](),controller[_0xe081('0xe')]);router[_0xe081('0xa')](_0xe081('0xf'),auth[_0xe081('0xb')](),controller['show']);router[_0xe081('0xa')](_0xe081('0x10'),auth['isAuthenticated'](),controller[_0xe081('0x11')]);router[_0xe081('0xa')]('/:id/teams',auth[_0xe081('0xb')](),controller['getTeams']);router[_0xe081('0xa')](_0xe081('0x12'),auth['isAuthenticated'](),controller[_0xe081('0x13')]);router[_0xe081('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe081('0x14')](_0xe081('0x15'),auth[_0xe081('0xb')](),controller[_0xe081('0x16')]);router[_0xe081('0x14')]('/:id/users',auth[_0xe081('0xb')](),controller[_0xe081('0x17')]);router['put'](_0xe081('0xf'),auth[_0xe081('0xb')](),controller[_0xe081('0x18')]);router[_0xe081('0x19')]('/:id',auth[_0xe081('0xb')](),controller[_0xe081('0x1a')]);router['delete'](_0xe081('0x15'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xe081('0x19')]('/:id/users',auth[_0xe081('0xb')](),controller[_0xe081('0x1b')]);module[_0xe081('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index aafb093..a9c0609 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 _0x8e44=['roundrobin','sequelize','exports','STRING','ENUM','rrmemory','beepall'];(function(_0x53ec1e,_0x3a84d9){var _0xbf83d9=function(_0x425a74){while(--_0x425a74){_0x53ec1e['push'](_0x53ec1e['shift']());}};_0xbf83d9(++_0x3a84d9);}(_0x8e44,0x1ac));var _0x48e4=function(_0x11a846,_0x2c29cb){_0x11a846=_0x11a846-0x0;var _0x2b8c28=_0x8e44[_0x11a846];return _0x2b8c28;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x48e4('0x3')](_0x48e4('0x4'),_0x48e4('0x5'),_0x48e4('0x6'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde2c=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','sequelize'];(function(_0x4c4343,_0x5e8011){var _0x4efe9a=function(_0x3597e4){while(--_0x3597e4){_0x4c4343['push'](_0x4c4343['shift']());}};_0x4efe9a(++_0x5e8011);}(_0xde2c,0x7f));var _0xcde2=function(_0x21bfab,_0x2fee48){_0x21bfab=_0x21bfab-0x0;var _0x4db318=_0xde2c[_0x21bfab];return _0x4db318;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'name':{'type':Sequelize[_0xcde2('0x2')],'unique':_0xcde2('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcde2('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcde2('0x5')](_0xcde2('0x6'),_0xcde2('0x7'),'roundrobin')},'description':{'type':Sequelize[_0xcde2('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 049396c..de69c8b 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 _0x3517=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','describe','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','hasOwnProperty','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','ids','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','isArray','userWhatsappQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params'];(function(_0x4b505f,_0x4dff6d){var _0x5529fe=function(_0x5eb41d){while(--_0x5eb41d){_0x4b505f['push'](_0x4b505f['shift']());}};_0x5529fe(++_0x4dff6d);}(_0x3517,0xd1));var _0x7351=function(_0x5ccd7d,_0x50598a){_0x5ccd7d=_0x5ccd7d-0x0;var _0xf52d40=_0x3517[_0x5ccd7d];return _0xf52d40;};'use strict';var emlformat=require(_0x7351('0x0'));var rimraf=require(_0x7351('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7351('0x2'));var rp=require(_0x7351('0x3'));var moment=require(_0x7351('0x4'));var BPromise=require(_0x7351('0x5'));var Mustache=require('mustache');var util=require(_0x7351('0x6'));var path=require(_0x7351('0x7'));var sox=require(_0x7351('0x8'));var csv=require(_0x7351('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7351('0xa'));var squel=require(_0x7351('0xb'));var crypto=require('crypto');var jsforce=require(_0x7351('0xc'));var deskjs=require(_0x7351('0xd'));var toCsv=require(_0x7351('0x9'));var querystring=require('querystring');var Papa=require(_0x7351('0xe'));var Redis=require(_0x7351('0xf'));var authService=require(_0x7351('0x10'));var qs=require(_0x7351('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7351('0x12'));var logger=require(_0x7351('0x13'))(_0x7351('0x14'));var utils=require(_0x7351('0x15'));var config=require(_0x7351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7351('0x17'))['db'];config[_0x7351('0x18')]=_[_0x7351('0x19')](config[_0x7351('0x18')],{'host':_0x7351('0x1a'),'port':0x18eb});var socket=require(_0x7351('0x1b'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x7351('0x1c')](socket);function respondWithStatusCode(_0x42f5bc,_0x5692a6){_0x5692a6=_0x5692a6||0xcc;return function(_0x16af0f){if(_0x16af0f){return _0x42f5bc[_0x7351('0x1d')](_0x5692a6);}return _0x42f5bc[_0x7351('0x1e')](_0x5692a6)[_0x7351('0x1f')]();};}function respondWithResult(_0xd12c,_0x16b452){_0x16b452=_0x16b452||0xc8;return function(_0x339084){if(_0x339084){return _0xd12c['status'](_0x16b452)[_0x7351('0x20')](_0x339084);}};}function respondWithFilteredResult(_0x1e2435,_0xd1e041){return function(_0x510f99){if(_0x510f99){var _0x5103fe=typeof _0xd1e041[_0x7351('0x21')]===_0x7351('0x22')&&typeof _0xd1e041[_0x7351('0x23')]===_0x7351('0x22');var _0xfe601f=_0x510f99['count'];var _0x4b3648=_0x5103fe?0x0:_0xd1e041[_0x7351('0x21')];var _0x377955=_0x5103fe?_0x510f99[_0x7351('0x24')]:_0xd1e041[_0x7351('0x21')]+_0xd1e041[_0x7351('0x23')];var _0x41b9d6;if(_0x377955>=_0xfe601f){_0x377955=_0xfe601f;_0x41b9d6=0xc8;}else{_0x41b9d6=0xce;}_0x1e2435['status'](_0x41b9d6);return _0x1e2435[_0x7351('0x25')](_0x7351('0x26'),_0x4b3648+'-'+_0x377955+'/'+_0xfe601f)[_0x7351('0x20')](_0x510f99);}return null;};}function patchUpdates(_0xc9782a){return function(_0x20f222){try{jsonpatch[_0x7351('0x27')](_0x20f222,_0xc9782a,!![]);}catch(_0x428cfe){return BPromise['reject'](_0x428cfe);}return _0x20f222[_0x7351('0x28')]();};}function saveUpdates(_0x2dddd5,_0x4cc6a8){return function(_0x2a980f){if(_0x2a980f){return _0x2a980f['update'](_0x2dddd5)[_0x7351('0x29')](function(_0x2bd575){return _0x2bd575;});}return null;};}function removeEntity(_0x1d15c7,_0x4d9624){return function(_0x3a3ed9){if(_0x3a3ed9){return _0x3a3ed9[_0x7351('0x2a')]()[_0x7351('0x29')](function(){var _0x5c8421=_0x3a3ed9[_0x7351('0x2b')]({'plain':!![]});var _0x50ef69=_0x7351('0x2c');return db[_0x7351('0x2d')][_0x7351('0x2a')]({'where':{'type':_0x50ef69,'resourceId':_0x5c8421['id']}})[_0x7351('0x29')](function(){return _0x3a3ed9;});})[_0x7351('0x29')](function(){_0x1d15c7['status'](0xcc)[_0x7351('0x1f')]();});}};}function handleEntityNotFound(_0x4ec8d5,_0x4244e4){return function(_0x3825fd){if(!_0x3825fd){_0x4ec8d5[_0x7351('0x1d')](0x194);}return _0x3825fd;};}function handleError(_0x40240c,_0x7c06c3){_0x7c06c3=_0x7c06c3||0x1f4;return function(_0x55be35){logger[_0x7351('0x2e')](_0x55be35[_0x7351('0x2f')]);if(_0x55be35[_0x7351('0x30')]){delete _0x55be35[_0x7351('0x30')];}_0x40240c[_0x7351('0x1e')](_0x7c06c3)['send'](_0x55be35);};}exports[_0x7351('0x31')]=function(_0x4f32d6,_0x5afe0c){var _0x4ecfc1={},_0x4bf6ed={},_0x5b8e97={'count':0x0,'rows':[]};var _0x545c04=_['map'](db[_0x7351('0x32')][_0x7351('0x33')],function(_0x5a2111){return{'name':_0x5a2111[_0x7351('0x34')],'type':_0x5a2111[_0x7351('0x35')]['key']};});_0x4bf6ed[_0x7351('0x36')]=_[_0x7351('0x37')](_0x545c04,_0x7351('0x30'));_0x4bf6ed['query']=_[_0x7351('0x38')](_0x4f32d6[_0x7351('0x39')]);_0x4bf6ed[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x4bf6ed[_0x7351('0x36')],_0x4bf6ed[_0x7351('0x39')]);_0x4ecfc1[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x4bf6ed[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x4f32d6[_0x7351('0x39')]['fields']));_0x4ecfc1[_0x7351('0x3c')]=_0x4ecfc1[_0x7351('0x3c')][_0x7351('0x3e')]?_0x4ecfc1['attributes']:_0x4bf6ed[_0x7351('0x36')];if(!_0x4f32d6[_0x7351('0x39')]['hasOwnProperty']('nolimit')){_0x4ecfc1[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x4f32d6[_0x7351('0x39')][_0x7351('0x23')]);_0x4ecfc1[_0x7351('0x21')]=qs['offset'](_0x4f32d6['query'][_0x7351('0x21')]);}_0x4ecfc1[_0x7351('0x3f')]=qs[_0x7351('0x40')](_0x4f32d6[_0x7351('0x39')][_0x7351('0x40')]);_0x4ecfc1[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x4f32d6[_0x7351('0x39')],_0x4bf6ed[_0x7351('0x3a')]),_0x545c04);if(_0x4f32d6[_0x7351('0x39')]['filter']){_0x4ecfc1['where']=_[_0x7351('0x43')](_0x4ecfc1[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x545c04,function(_0x3d4a6a){if(_0x3d4a6a[_0x7351('0x35')]!==_0x7351('0x44')){var _0x3ff1fd={};_0x3ff1fd[_0x3d4a6a[_0x7351('0x30')]]={'$like':'%'+_0x4f32d6[_0x7351('0x39')][_0x7351('0x45')]+'%'};return _0x3ff1fd;}})});}_0x4ecfc1=_[_0x7351('0x43')]({},_0x4ecfc1,_0x4f32d6[_0x7351('0x46')]);var _0x1d1e41={'where':_0x4ecfc1['where']};return db[_0x7351('0x32')]['count'](_0x1d1e41)[_0x7351('0x29')](function(_0x4b0e28){_0x5b8e97[_0x7351('0x24')]=_0x4b0e28;if(_0x4f32d6[_0x7351('0x39')][_0x7351('0x47')]){_0x4ecfc1['include']=[{'all':!![]}];}return db[_0x7351('0x32')][_0x7351('0x48')](_0x4ecfc1);})['then'](function(_0x57e839){_0x5b8e97[_0x7351('0x49')]=_0x57e839;return _0x5b8e97;})[_0x7351('0x29')](respondWithFilteredResult(_0x5afe0c,_0x4ecfc1))[_0x7351('0x4a')](handleError(_0x5afe0c,null));};exports[_0x7351('0x4b')]=function(_0x1b2677,_0x238dbe){var _0x58be73={'raw':!![],'where':{'id':_0x1b2677[_0x7351('0x4c')]['id']}},_0x1b86dd={};_0x1b86dd['model']=_[_0x7351('0x38')](db[_0x7351('0x32')][_0x7351('0x33')]);_0x1b86dd[_0x7351('0x39')]=_[_0x7351('0x38')](_0x1b2677[_0x7351('0x39')]);_0x1b86dd[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x1b86dd[_0x7351('0x36')],_0x1b86dd[_0x7351('0x39')]);_0x58be73[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x1b86dd[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x1b2677[_0x7351('0x39')][_0x7351('0x3d')]));_0x58be73['attributes']=_0x58be73[_0x7351('0x3c')][_0x7351('0x3e')]?_0x58be73[_0x7351('0x3c')]:_0x1b86dd[_0x7351('0x36')];if(_0x1b2677['query'][_0x7351('0x47')]){_0x58be73['include']=[{'all':!![]}];}_0x58be73=_[_0x7351('0x43')]({},_0x58be73,_0x1b2677['options']);return db['WhatsappQueue'][_0x7351('0x4d')](_0x58be73)[_0x7351('0x29')](handleEntityNotFound(_0x238dbe,null))[_0x7351('0x29')](respondWithResult(_0x238dbe,null))['catch'](handleError(_0x238dbe,null));};exports[_0x7351('0x4e')]=function(_0x4fa658,_0x466cd6){return db[_0x7351('0x32')][_0x7351('0x4e')](_0x4fa658[_0x7351('0x4f')],{})[_0x7351('0x29')](function(_0x7e0da1){var _0x3af8ea=_0x4fa658[_0x7351('0x50')][_0x7351('0x2b')]({'plain':!![]});if(!_0x3af8ea)throw new Error(_0x7351('0x51'));if(_0x3af8ea[_0x7351('0x52')]==='user'){var _0x57a8a5=_0x7e0da1[_0x7351('0x2b')]({'plain':!![]});var _0x215a67=_0x7351('0x2c');return db[_0x7351('0x53')]['find']({'where':{'name':_0x215a67,'userProfileId':_0x3af8ea[_0x7351('0x54')]},'raw':!![]})[_0x7351('0x29')](function(_0x564748){if(_0x564748&&_0x564748[_0x7351('0x55')]===0x0){return db[_0x7351('0x2d')][_0x7351('0x4e')]({'name':_0x57a8a5[_0x7351('0x30')],'resourceId':_0x57a8a5['id'],'type':_0x564748['name'],'sectionId':_0x564748['id']},{})[_0x7351('0x29')](function(){return _0x7e0da1;});}else{return _0x7e0da1;}})[_0x7351('0x4a')](function(_0x4babc1){logger[_0x7351('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4babc1);throw _0x4babc1;});}return _0x7e0da1;})[_0x7351('0x29')](respondWithResult(_0x466cd6,0xc9))[_0x7351('0x4a')](handleError(_0x466cd6,null));};exports[_0x7351('0x56')]=function(_0x1e742e,_0x712ffc){if(_0x1e742e[_0x7351('0x4f')]['id']){delete _0x1e742e[_0x7351('0x4f')]['id'];}return db[_0x7351('0x32')]['find']({'where':{'id':_0x1e742e[_0x7351('0x4c')]['id']}})['then'](handleEntityNotFound(_0x712ffc,null))[_0x7351('0x29')](saveUpdates(_0x1e742e[_0x7351('0x4f')],null))[_0x7351('0x29')](respondWithResult(_0x712ffc,null))[_0x7351('0x4a')](handleError(_0x712ffc,null));};exports[_0x7351('0x2a')]=function(_0x5e4ec8,_0x8a8902){return db['WhatsappQueue'][_0x7351('0x4d')]({'where':{'id':_0x5e4ec8[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x8a8902,null))[_0x7351('0x29')](removeEntity(_0x8a8902,null))[_0x7351('0x4a')](handleError(_0x8a8902,null));};exports['describe']=function(_0x36cbef,_0x405301){return db['WhatsappQueue'][_0x7351('0x57')]()[_0x7351('0x29')](respondWithResult(_0x405301,null))[_0x7351('0x4a')](handleError(_0x405301,null));};exports[_0x7351('0x58')]=function(_0x2f96f0,_0x4e533a,_0x2fc003){var _0x18f0b3={'raw':!![],'where':{}},_0x361ec1={},_0x1ab709;return db[_0x7351('0x32')][_0x7351('0x59')]({'where':{'id':_0x2f96f0[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x4e533a,null))[_0x7351('0x29')](function(_0xab950){if(_0xab950){_0x1ab709=_0xab950[_0x7351('0x2b')]({'plain':!![]});_0x361ec1['model']=_[_0x7351('0x38')](db[_0x7351('0x5a')][_0x7351('0x33')]);_0x361ec1[_0x7351('0x39')]=_['keys'](_0x2f96f0[_0x7351('0x39')]);_0x361ec1[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x361ec1[_0x7351('0x36')],_0x361ec1[_0x7351('0x39')]);_0x18f0b3['attributes']=_[_0x7351('0x3b')](_0x361ec1['model'],qs[_0x7351('0x3d')](_0x2f96f0[_0x7351('0x39')]['fields']));_0x18f0b3['attributes']=_0x18f0b3[_0x7351('0x3c')][_0x7351('0x3e')]?_0x18f0b3['attributes']:_0x361ec1[_0x7351('0x36')];if(!_0x2f96f0['query']['hasOwnProperty'](_0x7351('0x5b'))){_0x18f0b3[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x23')]);_0x18f0b3[_0x7351('0x21')]=qs[_0x7351('0x21')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x21')]);}_0x18f0b3[_0x7351('0x3f')]=qs[_0x7351('0x40')](_0x2f96f0[_0x7351('0x39')][_0x7351('0x40')]);_0x18f0b3['where']=qs['filters'](_[_0x7351('0x42')](_0x2f96f0[_0x7351('0x39')],_0x361ec1[_0x7351('0x3a')]));_0x18f0b3[_0x7351('0x41')][_0x7351('0x5c')]=_0xab950['id'];if(_0x2f96f0['query']['filter']){_0x18f0b3[_0x7351('0x41')]=_[_0x7351('0x43')](_0x18f0b3[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x18f0b3['attributes'],function(_0x4cdf9d){var _0x4fcb6a={};_0x4fcb6a[_0x4cdf9d]={'$like':'%'+_0x2f96f0[_0x7351('0x39')][_0x7351('0x45')]+'%'};return _0x4fcb6a;})});}_0x18f0b3=_[_0x7351('0x43')]({},_0x18f0b3,_0x2f96f0[_0x7351('0x46')]);return db[_0x7351('0x5a')][_0x7351('0x48')](_0x18f0b3);}})[_0x7351('0x29')](function(_0x13e562){if(_0x13e562){return db[_0x7351('0x5d')][_0x7351('0x5e')]({'where':{'id':_[_0x7351('0x37')](_0x13e562,_0x7351('0x5f')),'role':_0x7351('0x60')},'attributes':['id','name',_0x7351('0x61'),'updatedAt',_0x7351('0x62')]});}})['then'](function(_0x1a7d5c){if(_0x1a7d5c){return{'count':_0x1a7d5c[_0x7351('0x24')],'rows':_[_0x7351('0x37')](_0x1a7d5c[_0x7351('0x49')],function(_0x45b124){return{'membername':_0x45b124[_0x7351('0x30')],'UserId':_0x45b124['id'],'queue_name':_0x1ab709[_0x7351('0x30')],'WhatsappQueueId':_0x1ab709['id'],'interface':util[_0x7351('0x63')](_0x7351('0x64'),_0x7351('0x65'),_0x45b124[_0x7351('0x30')]),'penalty':0x0,'paused':_0x45b124[_0x7351('0x61')],'createdAt':_0x45b124[_0x7351('0x62')],'updatedAt':_0x45b124[_0x7351('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7351('0x29')](respondWithFilteredResult(_0x4e533a,_0x18f0b3))[_0x7351('0x4a')](handleError(_0x4e533a,null));};exports[_0x7351('0x67')]=function(_0x3459f0,_0x1268e1,_0x3a10cb){var _0x185646={};var _0x14abf4={};var _0x387c29;var _0x307275;return db[_0x7351('0x32')][_0x7351('0x59')]({'where':{'id':_0x3459f0[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x1268e1,null))[_0x7351('0x29')](function(_0x30a8dd){if(_0x30a8dd){_0x387c29=_0x30a8dd;_0x14abf4[_0x7351('0x36')]=_['keys'](db[_0x7351('0x68')][_0x7351('0x33')]);_0x14abf4[_0x7351('0x39')]=_[_0x7351('0x38')](_0x3459f0[_0x7351('0x39')]);_0x14abf4[_0x7351('0x3a')]=_[_0x7351('0x3b')](_0x14abf4[_0x7351('0x36')],_0x14abf4[_0x7351('0x39')]);_0x185646['attributes']=_['intersection'](_0x14abf4[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x3459f0[_0x7351('0x39')]['fields']));_0x185646[_0x7351('0x3c')]=_0x185646['attributes']['length']?_0x185646['attributes']:_0x14abf4[_0x7351('0x36')];_0x185646['order']=qs[_0x7351('0x40')](_0x3459f0['query'][_0x7351('0x40')]);_0x185646[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x3459f0['query'],_0x14abf4[_0x7351('0x3a')]));if(_0x3459f0[_0x7351('0x39')][_0x7351('0x45')]){_0x185646[_0x7351('0x41')]=_[_0x7351('0x43')](_0x185646[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x185646[_0x7351('0x3c')],function(_0x5c461a){var _0x15f455={};_0x15f455[_0x5c461a]={'$like':'%'+_0x3459f0['query'][_0x7351('0x45')]+'%'};return _0x15f455;})});}_0x185646=_[_0x7351('0x43')]({},_0x185646,_0x3459f0[_0x7351('0x46')]);return _0x387c29[_0x7351('0x67')](_0x185646);}})[_0x7351('0x29')](function(_0x2dc70f){if(_0x2dc70f){_0x307275=_0x2dc70f[_0x7351('0x3e')];if(!_0x3459f0[_0x7351('0x39')][_0x7351('0x69')]('nolimit')){_0x185646[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x3459f0[_0x7351('0x39')][_0x7351('0x23')]);_0x185646[_0x7351('0x21')]=qs[_0x7351('0x21')](_0x3459f0['query'][_0x7351('0x21')]);}return _0x387c29[_0x7351('0x67')](_0x185646);}})[_0x7351('0x29')](function(_0x50cc4){if(_0x50cc4){return _0x50cc4?{'count':_0x307275,'rows':_0x50cc4}:null;}})[_0x7351('0x29')](respondWithResult(_0x1268e1,null))[_0x7351('0x4a')](handleError(_0x1268e1,null));};exports[_0x7351('0x6a')]=function(_0x2b5f48,_0x453600,_0x44bbf2){var _0xb679ab=_0x2b5f48[_0x7351('0x4f')]['ids'];return db['Team'][_0x7351('0x48')]({'where':{'id':_0xb679ab},'attributes':['id'],'include':[{'model':db[_0x7351('0x5d')],'as':_0x7351('0x6b'),'attributes':['id','name',_0x7351('0x6c'),_0x7351('0x6d'),'interface'],'raw':!![]}]})[_0x7351('0x29')](function(_0x1daef4){if(_0x1daef4){var _0x334272=_[_0x7351('0x6e')](_0x1daef4,function(_0x639eb3){var _0x403774=_0x639eb3[_0x7351('0x2b')]({'plain':!![]});return _0x403774[_0x7351('0x6b')];});return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x2b5f48['params']['id']}})['then'](function(_0x2a61fa){return db[_0x7351('0x6f')][_0x7351('0x70')](function(_0x30fdb0){return _0x2a61fa['addTeams'](_0xb679ab,{'transaction':_0x30fdb0})[_0x7351('0x29')](function(){return BPromise[_0x7351('0x71')](_0x334272,function(_0xe55f79){return db['UserWhatsappQueue'][_0x7351('0x72')]({'where':{'UserId':_0xe55f79['id'],'WhatsappQueueId':_0x2b5f48['params']['id']},'transaction':_0x30fdb0});});})[_0x7351('0x29')](function(){_0x334272['forEach'](function(_0x464c34){socket[_0x7351('0x73')]('userWhatsappQueue:save',{'UserId':_0x464c34['id'],'WhatsappQueueId':_0x2a61fa['id']});});});});});}})[_0x7351('0x29')](respondWithStatusCode(_0x453600,null))[_0x7351('0x4a')](handleError(_0x453600,null));};exports[_0x7351('0x74')]=function(_0x3ca04d,_0x2bd19a,_0x461d0d){return db[_0x7351('0x68')][_0x7351('0x48')]({'where':{'id':_0x3ca04d[_0x7351('0x39')][_0x7351('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2bd19a,null))['then'](function(_0x1e8315){var _0x2b1e6=_[_0x7351('0x37')](_0x1e8315,'id');var _0x3b701c=[];var _0x30593f=[];var _0x2b24a1=squel['select']();_0x2b24a1[_0x7351('0x76')](_0x7351('0x77'))[_0x7351('0x78')](_0x7351('0x79'),'tq')[_0x7351('0x7a')](_0x7351('0x7b'),'ut',_0x7351('0x7c'))[_0x7351('0x41')](_0x7351('0x7d'),_0x3ca04d[_0x7351('0x4c')]['id']);for(var _0x4f794b=0x0;_0x4f794b<_0x1e8315[_0x7351('0x3e')];_0x4f794b+=0x1){let _0x4d6b33=_0x1e8315[_0x4f794b];for(var _0x3f097f=0x0;_0x3f097f<_0x4d6b33[_0x7351('0x6b')][_0x7351('0x3e')];_0x3f097f+=0x1){let _0x170953=_0x4d6b33['Agents'][_0x3f097f];var _0x3972f6=_0x2b24a1[_0x7351('0x7e')]();_0x3972f6[_0x7351('0x41')](_0x7351('0x7f'),_0x170953['id']);_0x30593f[_0x7351('0x80')](db[_0x7351('0x6f')]['query'](_0x3972f6['toString'](),{'type':db['sequelize'][_0x7351('0x81')][_0x7351('0x82')]})['then'](function(_0x43bbf3){if(_0x43bbf3[_0x7351('0x3e')]===0x1){return _0x170953['id'];}else{var _0x3281f3=_[_0x7351('0x83')](_['map'](_0x43bbf3,'TeamId'),function(_0x18fc4f){return _['includes'](_0x2b1e6,_0x18fc4f);});if(_0x3281f3){return _0x170953['id'];}}}));}}return BPromise[_0x7351('0x84')](_0x30593f)['then'](function(_0x449844){_0x3b701c=_(_0x3b701c)[_0x7351('0x85')](_0x449844)[_0x7351('0x86')]()[_0x7351('0x87')]();return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x3ca04d[_0x7351('0x4c')]['id']}})[_0x7351('0x29')](function(_0x2cd9f5){return db[_0x7351('0x6f')][_0x7351('0x70')](function(_0x548bd0){return _0x2cd9f5['removeTeams'](_0x3ca04d[_0x7351('0x39')][_0x7351('0x75')],{'transaction':_0x548bd0})[_0x7351('0x29')](function(){if(!_[_0x7351('0x88')](_0x3b701c)){return _0x2cd9f5[_0x7351('0x89')](_0x3b701c,{'transaction':_0x548bd0});}})[_0x7351('0x29')](function(){_0x3b701c[_0x7351('0x8a')](function(_0x30c3c3){socket[_0x7351('0x73')]('userWhatsappQueue:remove',{'UserId':_0x30c3c3,'WhatsappQueueId':_0x2cd9f5['id']});});});});});});})['then'](respondWithStatusCode(_0x2bd19a,null))[_0x7351('0x4a')](handleError(_0x2bd19a,null));};exports['addAgents']=function(_0xc7a83c,_0x260ce2,_0x59d583){return db['WhatsappQueue'][_0x7351('0x4d')]({'where':{'id':_0xc7a83c[_0x7351('0x4c')]['id']}})['then'](handleEntityNotFound(_0x260ce2,null))[_0x7351('0x29')](function(_0x1162fa){if(_0x1162fa){return _0x1162fa[_0x7351('0x8b')](_0xc7a83c[_0x7351('0x4f')][_0x7351('0x75')],_['omit'](_0xc7a83c['body'],[_0x7351('0x75'),'id'])||{})['spread'](function(_0x383601){for(var _0x55a5ac=0x0;_0x55a5ac<_0xc7a83c['body'][_0x7351('0x75')][_0x7351('0x3e')];_0x55a5ac+=0x1){socket['emit']('userWhatsappQueue:save',{'UserId':Number(_0xc7a83c['body']['ids'][_0x55a5ac]),'WhatsappQueueId':Number(_0xc7a83c[_0x7351('0x4c')]['id'])});}return _0x383601;});}})[_0x7351('0x29')](respondWithResult(_0x260ce2,null))['catch'](handleError(_0x260ce2,null));};exports['removeAgents']=function(_0x2ddbea,_0x45f2bc,_0x136052){return db[_0x7351('0x32')][_0x7351('0x4d')]({'where':{'id':_0x2ddbea['params']['id']}})[_0x7351('0x29')](handleEntityNotFound(_0x45f2bc,null))[_0x7351('0x29')](function(_0x435005){if(_0x435005){return _0x435005[_0x7351('0x89')](_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')])[_0x7351('0x29')](function(){if(_[_0x7351('0x8c')](_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')])){for(var _0x13c194=0x0;_0x13c194<_0x2ddbea['query'][_0x7351('0x75')][_0x7351('0x3e')];_0x13c194+=0x1){socket['emit'](_0x7351('0x8d'),{'UserId':Number(_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')][_0x13c194]),'WhatsappQueueId':Number(_0x2ddbea[_0x7351('0x4c')]['id'])});}}else{socket[_0x7351('0x73')](_0x7351('0x8d'),{'UserId':Number(_0x2ddbea[_0x7351('0x39')][_0x7351('0x75')]),'WhatsappQueueId':Number(_0x2ddbea['params']['id'])});}});}})['then'](respondWithStatusCode(_0x45f2bc,null))[_0x7351('0x4a')](handleError(_0x45f2bc,null));};exports[_0x7351('0x8e')]=function(_0x42899f,_0x56644b,_0x276996){var _0x29ff51={};var _0x261c69={};var _0x394ce3;var _0x385bef;return db['WhatsappQueue'][_0x7351('0x59')]({'where':{'id':_0x42899f['params']['id']}})['then'](handleEntityNotFound(_0x56644b,null))['then'](function(_0x4ec644){if(_0x4ec644){_0x394ce3=_0x4ec644;_0x261c69[_0x7351('0x36')]=_[_0x7351('0x38')](db['User'][_0x7351('0x33')]);_0x261c69[_0x7351('0x39')]=_[_0x7351('0x38')](_0x42899f[_0x7351('0x39')]);_0x261c69[_0x7351('0x3a')]=_['intersection'](_0x261c69['model'],_0x261c69['query']);_0x29ff51[_0x7351('0x3c')]=_[_0x7351('0x3b')](_0x261c69[_0x7351('0x36')],qs[_0x7351('0x3d')](_0x42899f['query'][_0x7351('0x3d')]));_0x29ff51[_0x7351('0x3c')]=_0x29ff51[_0x7351('0x3c')][_0x7351('0x3e')]?_0x29ff51[_0x7351('0x3c')]:_0x261c69[_0x7351('0x36')];_0x29ff51['order']=qs[_0x7351('0x40')](_0x42899f[_0x7351('0x39')][_0x7351('0x40')]);_0x29ff51[_0x7351('0x41')]=qs[_0x7351('0x3a')](_[_0x7351('0x42')](_0x42899f[_0x7351('0x39')],_0x261c69[_0x7351('0x3a')]));if(_0x42899f[_0x7351('0x39')]['filter']){_0x29ff51[_0x7351('0x41')]=_[_0x7351('0x43')](_0x29ff51[_0x7351('0x41')],{'$or':_[_0x7351('0x37')](_0x29ff51[_0x7351('0x3c')],function(_0x20f3b1){var _0x1cb7cc={};_0x1cb7cc[_0x20f3b1]={'$like':'%'+_0x42899f['query'][_0x7351('0x45')]+'%'};return _0x1cb7cc;})});}_0x29ff51=_['merge']({},_0x29ff51,_0x42899f[_0x7351('0x46')]);return _0x394ce3[_0x7351('0x8e')](_0x29ff51);}})['then'](function(_0x2b5e58){if(_0x2b5e58){_0x385bef=_0x2b5e58[_0x7351('0x3e')];if(!_0x42899f[_0x7351('0x39')][_0x7351('0x69')]('nolimit')){_0x29ff51[_0x7351('0x23')]=qs[_0x7351('0x23')](_0x42899f[_0x7351('0x39')][_0x7351('0x23')]);_0x29ff51['offset']=qs['offset'](_0x42899f['query'][_0x7351('0x21')]);}return _0x394ce3[_0x7351('0x8e')](_0x29ff51);}})[_0x7351('0x29')](function(_0x205ca2){if(_0x205ca2){return _0x205ca2?{'count':_0x385bef,'rows':_0x205ca2}:null;}})[_0x7351('0x29')](respondWithResult(_0x56644b,null))[_0x7351('0x4a')](handleError(_0x56644b,null));}; \ No newline at end of file +var _0x3167=['options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','UserWhatsappQueue','pick','WhatsappQueueId','User','findAndCountAll','UserId','agent','whatsappPause','createdAt','rows','%s/%s','updatedAt','getTeams','findOne','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','union','value','ids','isEmpty','userWhatsappQueue:remove','addAgents','omit','spread','userWhatsappQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','sendStatus','stack','name','send','index','map','WhatsappQueue','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL'];(function(_0x2f18f3,_0x5252c0){var _0x2e3629=function(_0x35836c){while(--_0x35836c){_0x2f18f3['push'](_0x2f18f3['shift']());}};_0x2e3629(++_0x5252c0);}(_0x3167,0x169));var _0x7316=function(_0x270adf,_0x1daaa3){_0x270adf=_0x270adf-0x0;var _0x29eda9=_0x3167[_0x270adf];return _0x29eda9;};'use strict';var emlformat=require(_0x7316('0x0'));var rimraf=require(_0x7316('0x1'));var zipdir=require(_0x7316('0x2'));var jsonpatch=require(_0x7316('0x3'));var rp=require(_0x7316('0x4'));var moment=require(_0x7316('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7316('0x6'));var util=require(_0x7316('0x7'));var path=require(_0x7316('0x8'));var sox=require(_0x7316('0x9'));var csv=require(_0x7316('0xa'));var ejs=require(_0x7316('0xb'));var fs=require('fs');var fs_extra=require(_0x7316('0xc'));var _=require(_0x7316('0xd'));var squel=require(_0x7316('0xe'));var crypto=require(_0x7316('0xf'));var jsforce=require(_0x7316('0x10'));var deskjs=require(_0x7316('0x11'));var toCsv=require(_0x7316('0xa'));var querystring=require(_0x7316('0x12'));var Papa=require(_0x7316('0x13'));var Redis=require(_0x7316('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x7316('0x15'));var as=require(_0x7316('0x16'));var hardwareService=require(_0x7316('0x17'));var logger=require(_0x7316('0x18'))(_0x7316('0x19'));var utils=require('../../config/utils');var config=require(_0x7316('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x7316('0x1b'))['db'];config['redis']=_['defaults'](config[_0x7316('0x1c')],{'host':_0x7316('0x1d'),'port':0x18eb});var socket=require(_0x7316('0x1e'))(new Redis(config[_0x7316('0x1c')]));require(_0x7316('0x1f'))['register'](socket);function respondWithStatusCode(_0xa364e4,_0x219f4f){_0x219f4f=_0x219f4f||0xcc;return function(_0x3d4cd5){if(_0x3d4cd5){return _0xa364e4['sendStatus'](_0x219f4f);}return _0xa364e4['status'](_0x219f4f)[_0x7316('0x20')]();};}function respondWithResult(_0x3e2b9c,_0x2a35fc){_0x2a35fc=_0x2a35fc||0xc8;return function(_0x1bdf79){if(_0x1bdf79){return _0x3e2b9c[_0x7316('0x21')](_0x2a35fc)[_0x7316('0x22')](_0x1bdf79);}};}function respondWithFilteredResult(_0x4caa4a,_0x3fb322){return function(_0x5b796a){if(_0x5b796a){var _0x293ad5=typeof _0x3fb322[_0x7316('0x23')]===_0x7316('0x24')&&typeof _0x3fb322[_0x7316('0x25')]===_0x7316('0x24');var _0x3c64cf=_0x5b796a[_0x7316('0x26')];var _0x11a726=_0x293ad5?0x0:_0x3fb322[_0x7316('0x23')];var _0x3d5ec4=_0x293ad5?_0x5b796a[_0x7316('0x26')]:_0x3fb322['offset']+_0x3fb322['limit'];var _0x14f665;if(_0x3d5ec4>=_0x3c64cf){_0x3d5ec4=_0x3c64cf;_0x14f665=0xc8;}else{_0x14f665=0xce;}_0x4caa4a[_0x7316('0x21')](_0x14f665);return _0x4caa4a[_0x7316('0x27')]('Content-Range',_0x11a726+'-'+_0x3d5ec4+'/'+_0x3c64cf)[_0x7316('0x22')](_0x5b796a);}return null;};}function patchUpdates(_0x172367){return function(_0x58d680){try{jsonpatch[_0x7316('0x28')](_0x58d680,_0x172367,!![]);}catch(_0x5653d8){return BPromise[_0x7316('0x29')](_0x5653d8);}return _0x58d680[_0x7316('0x2a')]();};}function saveUpdates(_0xbd9910,_0x32efe9){return function(_0x1b2c71){if(_0x1b2c71){return _0x1b2c71[_0x7316('0x2b')](_0xbd9910)[_0x7316('0x2c')](function(_0xa9d2c6){return _0xa9d2c6;});}return null;};}function removeEntity(_0x29fc0a,_0x420e49){return function(_0x2d0b51){if(_0x2d0b51){return _0x2d0b51['destroy']()[_0x7316('0x2c')](function(){var _0x41540e=_0x2d0b51['get']({'plain':!![]});var _0x528dca=_0x7316('0x2d');return db[_0x7316('0x2e')]['destroy']({'where':{'type':_0x528dca,'resourceId':_0x41540e['id']}})[_0x7316('0x2c')](function(){return _0x2d0b51;});})[_0x7316('0x2c')](function(){_0x29fc0a['status'](0xcc)[_0x7316('0x20')]();});}};}function handleEntityNotFound(_0xf5b55f,_0x2f2da9){return function(_0x12696b){if(!_0x12696b){_0xf5b55f[_0x7316('0x2f')](0x194);}return _0x12696b;};}function handleError(_0x1c099d,_0x492d03){_0x492d03=_0x492d03||0x1f4;return function(_0x239182){logger['error'](_0x239182[_0x7316('0x30')]);if(_0x239182['name']){delete _0x239182[_0x7316('0x31')];}_0x1c099d[_0x7316('0x21')](_0x492d03)[_0x7316('0x32')](_0x239182);};}exports[_0x7316('0x33')]=function(_0xe31b88,_0x104063){var _0x1f5bbe={},_0x3ab180={},_0x331639={'count':0x0,'rows':[]};var _0x8ee6d8=_[_0x7316('0x34')](db[_0x7316('0x35')]['rawAttributes'],function(_0x433192){return{'name':_0x433192['fieldName'],'type':_0x433192['type']['key']};});_0x3ab180['model']=_[_0x7316('0x34')](_0x8ee6d8,_0x7316('0x31'));_0x3ab180[_0x7316('0x36')]=_[_0x7316('0x37')](_0xe31b88['query']);_0x3ab180[_0x7316('0x38')]=_[_0x7316('0x39')](_0x3ab180[_0x7316('0x3a')],_0x3ab180[_0x7316('0x36')]);_0x1f5bbe['attributes']=_[_0x7316('0x39')](_0x3ab180[_0x7316('0x3a')],qs[_0x7316('0x3b')](_0xe31b88[_0x7316('0x36')]['fields']));_0x1f5bbe[_0x7316('0x3c')]=_0x1f5bbe[_0x7316('0x3c')][_0x7316('0x3d')]?_0x1f5bbe[_0x7316('0x3c')]:_0x3ab180[_0x7316('0x3a')];if(!_0xe31b88['query'][_0x7316('0x3e')](_0x7316('0x3f'))){_0x1f5bbe[_0x7316('0x25')]=qs[_0x7316('0x25')](_0xe31b88[_0x7316('0x36')][_0x7316('0x25')]);_0x1f5bbe[_0x7316('0x23')]=qs['offset'](_0xe31b88[_0x7316('0x36')]['offset']);}_0x1f5bbe[_0x7316('0x40')]=qs[_0x7316('0x41')](_0xe31b88[_0x7316('0x36')][_0x7316('0x41')]);_0x1f5bbe[_0x7316('0x42')]=qs[_0x7316('0x38')](_['pick'](_0xe31b88[_0x7316('0x36')],_0x3ab180[_0x7316('0x38')]),_0x8ee6d8);if(_0xe31b88[_0x7316('0x36')][_0x7316('0x43')]){_0x1f5bbe['where']=_[_0x7316('0x44')](_0x1f5bbe[_0x7316('0x42')],{'$or':_['map'](_0x8ee6d8,function(_0x3ce17e){if(_0x3ce17e[_0x7316('0x45')]!==_0x7316('0x46')){var _0x12e798={};_0x12e798[_0x3ce17e['name']]={'$like':'%'+_0xe31b88[_0x7316('0x36')][_0x7316('0x43')]+'%'};return _0x12e798;}})});}_0x1f5bbe=_[_0x7316('0x44')]({},_0x1f5bbe,_0xe31b88[_0x7316('0x47')]);var _0x3e5ba3={'where':_0x1f5bbe[_0x7316('0x42')]};return db['WhatsappQueue']['count'](_0x3e5ba3)[_0x7316('0x2c')](function(_0x371e0b){_0x331639[_0x7316('0x26')]=_0x371e0b;if(_0xe31b88[_0x7316('0x36')][_0x7316('0x48')]){_0x1f5bbe['include']=[{'all':!![]}];}return db[_0x7316('0x35')][_0x7316('0x49')](_0x1f5bbe);})[_0x7316('0x2c')](function(_0x2c2f87){_0x331639['rows']=_0x2c2f87;return _0x331639;})[_0x7316('0x2c')](respondWithFilteredResult(_0x104063,_0x1f5bbe))[_0x7316('0x4a')](handleError(_0x104063,null));};exports[_0x7316('0x4b')]=function(_0x3195ed,_0x332e93){var _0x4629ff={'raw':!![],'where':{'id':_0x3195ed[_0x7316('0x4c')]['id']}},_0x591c50={};_0x591c50['model']=_['keys'](db['WhatsappQueue'][_0x7316('0x4d')]);_0x591c50['query']=_[_0x7316('0x37')](_0x3195ed[_0x7316('0x36')]);_0x591c50['filters']=_[_0x7316('0x39')](_0x591c50[_0x7316('0x3a')],_0x591c50[_0x7316('0x36')]);_0x4629ff[_0x7316('0x3c')]=_['intersection'](_0x591c50[_0x7316('0x3a')],qs[_0x7316('0x3b')](_0x3195ed[_0x7316('0x36')][_0x7316('0x3b')]));_0x4629ff['attributes']=_0x4629ff[_0x7316('0x3c')][_0x7316('0x3d')]?_0x4629ff[_0x7316('0x3c')]:_0x591c50[_0x7316('0x3a')];if(_0x3195ed[_0x7316('0x36')]['includeAll']){_0x4629ff[_0x7316('0x4e')]=[{'all':!![]}];}_0x4629ff=_[_0x7316('0x44')]({},_0x4629ff,_0x3195ed[_0x7316('0x47')]);return db[_0x7316('0x35')][_0x7316('0x4f')](_0x4629ff)['then'](handleEntityNotFound(_0x332e93,null))[_0x7316('0x2c')](respondWithResult(_0x332e93,null))[_0x7316('0x4a')](handleError(_0x332e93,null));};exports['create']=function(_0x4871f3,_0x382fef){return db[_0x7316('0x35')][_0x7316('0x50')](_0x4871f3['body'],{})[_0x7316('0x2c')](function(_0x1f4f4c){var _0xfd6cad=_0x4871f3[_0x7316('0x51')][_0x7316('0x52')]({'plain':!![]});if(!_0xfd6cad)throw new Error(_0x7316('0x53'));if(_0xfd6cad[_0x7316('0x54')]===_0x7316('0x51')){var _0x1848f1=_0x1f4f4c[_0x7316('0x52')]({'plain':!![]});var _0x32eeaf='WhatsappQueues';return db[_0x7316('0x55')][_0x7316('0x4f')]({'where':{'name':_0x32eeaf,'userProfileId':_0xfd6cad[_0x7316('0x56')]},'raw':!![]})['then'](function(_0x38ae66){if(_0x38ae66&&_0x38ae66['autoAssociation']===0x0){return db[_0x7316('0x2e')][_0x7316('0x50')]({'name':_0x1848f1[_0x7316('0x31')],'resourceId':_0x1848f1['id'],'type':_0x38ae66[_0x7316('0x31')],'sectionId':_0x38ae66['id']},{})[_0x7316('0x2c')](function(){return _0x1f4f4c;});}else{return _0x1f4f4c;}})['catch'](function(_0x413740){logger['error'](_0x7316('0x57'),_0x413740);throw _0x413740;});}return _0x1f4f4c;})[_0x7316('0x2c')](respondWithResult(_0x382fef,0xc9))[_0x7316('0x4a')](handleError(_0x382fef,null));};exports['update']=function(_0x4dca93,_0x329084){if(_0x4dca93[_0x7316('0x58')]['id']){delete _0x4dca93[_0x7316('0x58')]['id'];}return db[_0x7316('0x35')][_0x7316('0x4f')]({'where':{'id':_0x4dca93[_0x7316('0x4c')]['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x329084,null))[_0x7316('0x2c')](saveUpdates(_0x4dca93[_0x7316('0x58')],null))[_0x7316('0x2c')](respondWithResult(_0x329084,null))['catch'](handleError(_0x329084,null));};exports[_0x7316('0x59')]=function(_0x318195,_0x9b8bd5){return db['WhatsappQueue'][_0x7316('0x4f')]({'where':{'id':_0x318195[_0x7316('0x4c')]['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x9b8bd5,null))['then'](removeEntity(_0x9b8bd5,null))[_0x7316('0x4a')](handleError(_0x9b8bd5,null));};exports[_0x7316('0x5a')]=function(_0x5742b5,_0x4f7afb){return db[_0x7316('0x35')]['describe']()['then'](respondWithResult(_0x4f7afb,null))['catch'](handleError(_0x4f7afb,null));};exports['getMembers']=function(_0x476d24,_0x4e30aa,_0x1c0eab){var _0x3fddbe={'raw':!![],'where':{}},_0x5cbde4={},_0x5854e8;return db[_0x7316('0x35')]['findOne']({'where':{'id':_0x476d24[_0x7316('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4e30aa,null))[_0x7316('0x2c')](function(_0x3ded1a){if(_0x3ded1a){_0x5854e8=_0x3ded1a['get']({'plain':!![]});_0x5cbde4[_0x7316('0x3a')]=_['keys'](db[_0x7316('0x5b')][_0x7316('0x4d')]);_0x5cbde4[_0x7316('0x36')]=_['keys'](_0x476d24['query']);_0x5cbde4[_0x7316('0x38')]=_[_0x7316('0x39')](_0x5cbde4[_0x7316('0x3a')],_0x5cbde4[_0x7316('0x36')]);_0x3fddbe['attributes']=_[_0x7316('0x39')](_0x5cbde4[_0x7316('0x3a')],qs[_0x7316('0x3b')](_0x476d24[_0x7316('0x36')][_0x7316('0x3b')]));_0x3fddbe['attributes']=_0x3fddbe[_0x7316('0x3c')][_0x7316('0x3d')]?_0x3fddbe['attributes']:_0x5cbde4[_0x7316('0x3a')];if(!_0x476d24[_0x7316('0x36')]['hasOwnProperty'](_0x7316('0x3f'))){_0x3fddbe[_0x7316('0x25')]=qs[_0x7316('0x25')](_0x476d24[_0x7316('0x36')]['limit']);_0x3fddbe[_0x7316('0x23')]=qs[_0x7316('0x23')](_0x476d24[_0x7316('0x36')]['offset']);}_0x3fddbe[_0x7316('0x40')]=qs[_0x7316('0x41')](_0x476d24[_0x7316('0x36')][_0x7316('0x41')]);_0x3fddbe[_0x7316('0x42')]=qs[_0x7316('0x38')](_[_0x7316('0x5c')](_0x476d24['query'],_0x5cbde4[_0x7316('0x38')]));_0x3fddbe[_0x7316('0x42')][_0x7316('0x5d')]=_0x3ded1a['id'];if(_0x476d24['query']['filter']){_0x3fddbe[_0x7316('0x42')]=_['merge'](_0x3fddbe[_0x7316('0x42')],{'$or':_[_0x7316('0x34')](_0x3fddbe[_0x7316('0x3c')],function(_0x28d03f){var _0x46935b={};_0x46935b[_0x28d03f]={'$like':'%'+_0x476d24[_0x7316('0x36')]['filter']+'%'};return _0x46935b;})});}_0x3fddbe=_[_0x7316('0x44')]({},_0x3fddbe,_0x476d24[_0x7316('0x47')]);return db['UserWhatsappQueue'][_0x7316('0x49')](_0x3fddbe);}})[_0x7316('0x2c')](function(_0x5ef9ff){if(_0x5ef9ff){return db[_0x7316('0x5e')][_0x7316('0x5f')]({'where':{'id':_[_0x7316('0x34')](_0x5ef9ff,_0x7316('0x60')),'role':_0x7316('0x61')},'attributes':['id','name',_0x7316('0x62'),'updatedAt',_0x7316('0x63')]});}})[_0x7316('0x2c')](function(_0x110122){if(_0x110122){return{'count':_0x110122[_0x7316('0x26')],'rows':_[_0x7316('0x34')](_0x110122[_0x7316('0x64')],function(_0x19bfda){return{'membername':_0x19bfda[_0x7316('0x31')],'UserId':_0x19bfda['id'],'queue_name':_0x5854e8[_0x7316('0x31')],'WhatsappQueueId':_0x5854e8['id'],'interface':util['format'](_0x7316('0x65'),'SIP',_0x19bfda[_0x7316('0x31')]),'penalty':0x0,'paused':_0x19bfda[_0x7316('0x62')],'createdAt':_0x19bfda['createdAt'],'updatedAt':_0x19bfda[_0x7316('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4e30aa,_0x3fddbe))[_0x7316('0x4a')](handleError(_0x4e30aa,null));};exports[_0x7316('0x67')]=function(_0x36d345,_0x3a8400,_0x1d558a){var _0x24acc6={};var _0x252765={};var _0x22ec2d;var _0x28527c;return db[_0x7316('0x35')][_0x7316('0x68')]({'where':{'id':_0x36d345[_0x7316('0x4c')]['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x3a8400,null))[_0x7316('0x2c')](function(_0x43fc85){if(_0x43fc85){_0x22ec2d=_0x43fc85;_0x252765[_0x7316('0x3a')]=_[_0x7316('0x37')](db['Team']['rawAttributes']);_0x252765[_0x7316('0x36')]=_[_0x7316('0x37')](_0x36d345[_0x7316('0x36')]);_0x252765['filters']=_[_0x7316('0x39')](_0x252765['model'],_0x252765[_0x7316('0x36')]);_0x24acc6[_0x7316('0x3c')]=_[_0x7316('0x39')](_0x252765[_0x7316('0x3a')],qs[_0x7316('0x3b')](_0x36d345[_0x7316('0x36')][_0x7316('0x3b')]));_0x24acc6[_0x7316('0x3c')]=_0x24acc6[_0x7316('0x3c')]['length']?_0x24acc6['attributes']:_0x252765[_0x7316('0x3a')];_0x24acc6[_0x7316('0x40')]=qs[_0x7316('0x41')](_0x36d345[_0x7316('0x36')][_0x7316('0x41')]);_0x24acc6['where']=qs[_0x7316('0x38')](_[_0x7316('0x5c')](_0x36d345[_0x7316('0x36')],_0x252765[_0x7316('0x38')]));if(_0x36d345[_0x7316('0x36')][_0x7316('0x43')]){_0x24acc6[_0x7316('0x42')]=_[_0x7316('0x44')](_0x24acc6[_0x7316('0x42')],{'$or':_['map'](_0x24acc6['attributes'],function(_0x4633d8){var _0x20b10a={};_0x20b10a[_0x4633d8]={'$like':'%'+_0x36d345[_0x7316('0x36')][_0x7316('0x43')]+'%'};return _0x20b10a;})});}_0x24acc6=_[_0x7316('0x44')]({},_0x24acc6,_0x36d345[_0x7316('0x47')]);return _0x22ec2d[_0x7316('0x67')](_0x24acc6);}})[_0x7316('0x2c')](function(_0x2dc051){if(_0x2dc051){_0x28527c=_0x2dc051[_0x7316('0x3d')];if(!_0x36d345[_0x7316('0x36')]['hasOwnProperty']('nolimit')){_0x24acc6['limit']=qs[_0x7316('0x25')](_0x36d345[_0x7316('0x36')]['limit']);_0x24acc6[_0x7316('0x23')]=qs['offset'](_0x36d345[_0x7316('0x36')][_0x7316('0x23')]);}return _0x22ec2d[_0x7316('0x67')](_0x24acc6);}})[_0x7316('0x2c')](function(_0x34792e){if(_0x34792e){return _0x34792e?{'count':_0x28527c,'rows':_0x34792e}:null;}})['then'](respondWithResult(_0x3a8400,null))[_0x7316('0x4a')](handleError(_0x3a8400,null));};exports[_0x7316('0x69')]=function(_0x3d7e5f,_0x4c1400,_0x370ddd){var _0x36c434=_0x3d7e5f['body']['ids'];return db[_0x7316('0x6a')]['findAll']({'where':{'id':_0x36c434},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7316('0x6b'),'attributes':['id','name',_0x7316('0x6c'),'voicePause',_0x7316('0x6d')],'raw':!![]}]})[_0x7316('0x2c')](function(_0x193734){if(_0x193734){var _0x3cd4b0=_[_0x7316('0x6e')](_0x193734,function(_0x262bdf){var _0xe46047=_0x262bdf['get']({'plain':!![]});return _0xe46047[_0x7316('0x6b')];});return db[_0x7316('0x35')][_0x7316('0x4f')]({'where':{'id':_0x3d7e5f[_0x7316('0x4c')]['id']}})[_0x7316('0x2c')](function(_0x31c80d){return db[_0x7316('0x6f')][_0x7316('0x70')](function(_0x3fdb52){return _0x31c80d['addTeams'](_0x36c434,{'transaction':_0x3fdb52})[_0x7316('0x2c')](function(){return BPromise[_0x7316('0x71')](_0x3cd4b0,function(_0x460573){return db[_0x7316('0x5b')][_0x7316('0x72')]({'where':{'UserId':_0x460573['id'],'WhatsappQueueId':_0x3d7e5f[_0x7316('0x4c')]['id']},'transaction':_0x3fdb52});});})[_0x7316('0x2c')](function(){_0x3cd4b0[_0x7316('0x73')](function(_0x2759d7){socket[_0x7316('0x74')]('userWhatsappQueue:save',{'UserId':_0x2759d7['id'],'WhatsappQueueId':_0x31c80d['id']});});});});});}})['then'](respondWithStatusCode(_0x4c1400,null))[_0x7316('0x4a')](handleError(_0x4c1400,null));};exports[_0x7316('0x75')]=function(_0x2825b7,_0x379029,_0x37dafd){return db[_0x7316('0x6a')]['findAll']({'where':{'id':_0x2825b7['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x7316('0x5e')],'as':_0x7316('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x379029,null))[_0x7316('0x2c')](function(_0x55fa03){var _0x17c79c=_[_0x7316('0x34')](_0x55fa03,'id');var _0x3b34d7=[];var _0x375d8e=[];var _0x3c1e09=squel[_0x7316('0x76')]();_0x3c1e09[_0x7316('0x77')](_0x7316('0x78'))[_0x7316('0x79')]('team_has_whatsapp_queues','tq')[_0x7316('0x7a')](_0x7316('0x7b'),'ut',_0x7316('0x7c'))[_0x7316('0x42')](_0x7316('0x7d'),_0x2825b7[_0x7316('0x4c')]['id']);for(var _0x51904a=0x0;_0x51904a<_0x55fa03[_0x7316('0x3d')];_0x51904a+=0x1){let _0xa60d3d=_0x55fa03[_0x51904a];for(var _0x14f9a3=0x0;_0x14f9a3<_0xa60d3d[_0x7316('0x6b')][_0x7316('0x3d')];_0x14f9a3+=0x1){let _0x471b25=_0xa60d3d[_0x7316('0x6b')][_0x14f9a3];var _0x42ed64=_0x3c1e09['clone']();_0x42ed64['where'](_0x7316('0x7e'),_0x471b25['id']);_0x375d8e[_0x7316('0x7f')](db[_0x7316('0x6f')][_0x7316('0x36')](_0x42ed64['toString'](),{'type':db[_0x7316('0x6f')][_0x7316('0x80')][_0x7316('0x81')]})[_0x7316('0x2c')](function(_0x2b9aca){if(_0x2b9aca[_0x7316('0x3d')]===0x1){return _0x471b25['id'];}else{var _0x2a7132=_[_0x7316('0x82')](_['map'](_0x2b9aca,'TeamId'),function(_0x47f374){return _[_0x7316('0x83')](_0x17c79c,_0x47f374);});if(_0x2a7132){return _0x471b25['id'];}}}));}}return BPromise['all'](_0x375d8e)[_0x7316('0x2c')](function(_0x4eb2d7){_0x3b34d7=_(_0x3b34d7)[_0x7316('0x84')](_0x4eb2d7)['compact']()[_0x7316('0x85')]();return db[_0x7316('0x35')]['find']({'where':{'id':_0x2825b7[_0x7316('0x4c')]['id']}})['then'](function(_0x490f01){return db[_0x7316('0x6f')][_0x7316('0x70')](function(_0x26d3d9){return _0x490f01[_0x7316('0x75')](_0x2825b7[_0x7316('0x36')][_0x7316('0x86')],{'transaction':_0x26d3d9})[_0x7316('0x2c')](function(){if(!_[_0x7316('0x87')](_0x3b34d7)){return _0x490f01['removeAgents'](_0x3b34d7,{'transaction':_0x26d3d9});}})['then'](function(){_0x3b34d7[_0x7316('0x73')](function(_0x24cf3a){socket[_0x7316('0x74')](_0x7316('0x88'),{'UserId':_0x24cf3a,'WhatsappQueueId':_0x490f01['id']});});});});});});})[_0x7316('0x2c')](respondWithStatusCode(_0x379029,null))[_0x7316('0x4a')](handleError(_0x379029,null));};exports[_0x7316('0x89')]=function(_0x1c7676,_0x111900,_0x4ef9be){return db['WhatsappQueue'][_0x7316('0x4f')]({'where':{'id':_0x1c7676['params']['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x111900,null))[_0x7316('0x2c')](function(_0x4c1bba){if(_0x4c1bba){return _0x4c1bba[_0x7316('0x89')](_0x1c7676[_0x7316('0x58')][_0x7316('0x86')],_[_0x7316('0x8a')](_0x1c7676[_0x7316('0x58')],[_0x7316('0x86'),'id'])||{})[_0x7316('0x8b')](function(_0x5c3559){for(var _0x4df5a1=0x0;_0x4df5a1<_0x1c7676[_0x7316('0x58')][_0x7316('0x86')][_0x7316('0x3d')];_0x4df5a1+=0x1){socket[_0x7316('0x74')](_0x7316('0x8c'),{'UserId':Number(_0x1c7676[_0x7316('0x58')][_0x7316('0x86')][_0x4df5a1]),'WhatsappQueueId':Number(_0x1c7676[_0x7316('0x4c')]['id'])});}return _0x5c3559;});}})['then'](respondWithResult(_0x111900,null))[_0x7316('0x4a')](handleError(_0x111900,null));};exports[_0x7316('0x8d')]=function(_0x308259,_0x16f880,_0x464afe){return db[_0x7316('0x35')][_0x7316('0x4f')]({'where':{'id':_0x308259[_0x7316('0x4c')]['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x16f880,null))[_0x7316('0x2c')](function(_0x465a8a){if(_0x465a8a){return _0x465a8a[_0x7316('0x8d')](_0x308259[_0x7316('0x36')][_0x7316('0x86')])['then'](function(){if(_[_0x7316('0x8e')](_0x308259[_0x7316('0x36')][_0x7316('0x86')])){for(var _0x2c0c50=0x0;_0x2c0c50<_0x308259[_0x7316('0x36')][_0x7316('0x86')][_0x7316('0x3d')];_0x2c0c50+=0x1){socket[_0x7316('0x74')](_0x7316('0x88'),{'UserId':Number(_0x308259[_0x7316('0x36')][_0x7316('0x86')][_0x2c0c50]),'WhatsappQueueId':Number(_0x308259[_0x7316('0x4c')]['id'])});}}else{socket[_0x7316('0x74')](_0x7316('0x88'),{'UserId':Number(_0x308259['query'][_0x7316('0x86')]),'WhatsappQueueId':Number(_0x308259[_0x7316('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x16f880,null))[_0x7316('0x4a')](handleError(_0x16f880,null));};exports[_0x7316('0x8f')]=function(_0x6e6134,_0x2849bf,_0x1e6565){var _0x185098={};var _0x683242={};var _0x22b3bd;var _0x378e8f;return db['WhatsappQueue']['findOne']({'where':{'id':_0x6e6134['params']['id']}})[_0x7316('0x2c')](handleEntityNotFound(_0x2849bf,null))[_0x7316('0x2c')](function(_0x459ba3){if(_0x459ba3){_0x22b3bd=_0x459ba3;_0x683242[_0x7316('0x3a')]=_[_0x7316('0x37')](db[_0x7316('0x5e')][_0x7316('0x4d')]);_0x683242[_0x7316('0x36')]=_[_0x7316('0x37')](_0x6e6134[_0x7316('0x36')]);_0x683242[_0x7316('0x38')]=_[_0x7316('0x39')](_0x683242[_0x7316('0x3a')],_0x683242[_0x7316('0x36')]);_0x185098[_0x7316('0x3c')]=_['intersection'](_0x683242[_0x7316('0x3a')],qs[_0x7316('0x3b')](_0x6e6134[_0x7316('0x36')][_0x7316('0x3b')]));_0x185098['attributes']=_0x185098[_0x7316('0x3c')]['length']?_0x185098[_0x7316('0x3c')]:_0x683242[_0x7316('0x3a')];_0x185098[_0x7316('0x40')]=qs['sort'](_0x6e6134[_0x7316('0x36')][_0x7316('0x41')]);_0x185098[_0x7316('0x42')]=qs[_0x7316('0x38')](_['pick'](_0x6e6134[_0x7316('0x36')],_0x683242[_0x7316('0x38')]));if(_0x6e6134[_0x7316('0x36')][_0x7316('0x43')]){_0x185098[_0x7316('0x42')]=_[_0x7316('0x44')](_0x185098[_0x7316('0x42')],{'$or':_['map'](_0x185098['attributes'],function(_0x5320cc){var _0x22d1e0={};_0x22d1e0[_0x5320cc]={'$like':'%'+_0x6e6134[_0x7316('0x36')]['filter']+'%'};return _0x22d1e0;})});}_0x185098=_[_0x7316('0x44')]({},_0x185098,_0x6e6134['options']);return _0x22b3bd['getAgents'](_0x185098);}})['then'](function(_0x27b36d){if(_0x27b36d){_0x378e8f=_0x27b36d['length'];if(!_0x6e6134[_0x7316('0x36')][_0x7316('0x3e')](_0x7316('0x3f'))){_0x185098['limit']=qs['limit'](_0x6e6134[_0x7316('0x36')]['limit']);_0x185098[_0x7316('0x23')]=qs[_0x7316('0x23')](_0x6e6134[_0x7316('0x36')]['offset']);}return _0x22b3bd[_0x7316('0x8f')](_0x185098);}})[_0x7316('0x2c')](function(_0x55582e){if(_0x55582e){return _0x55582e?{'count':_0x378e8f,'rows':_0x55582e}:null;}})[_0x7316('0x2c')](respondWithResult(_0x2849bf,null))[_0x7316('0x4a')](handleError(_0x2849bf,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6c4b707..90983e4 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 _0xab21=['WhatsappQueue','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x21fcd5,_0x1091a4){var _0x53456e=function(_0x9293de){while(--_0x9293de){_0x21fcd5['push'](_0x21fcd5['shift']());}};_0x53456e(++_0x1091a4);}(_0xab21,0xf1));var _0x1ab2=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xab21[_0x3b0731];return _0x4204d7;};'use strict';var EventEmitter=require(_0x1ab2('0x0'));var WhatsappQueue=require(_0x1ab2('0x1'))['db'][_0x1ab2('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1ab2('0x3'),'afterUpdate':'update','afterDestroy':_0x1ab2('0x4')};function emitEvent(_0x6500f4){return function(_0x252241,_0x5e54fe,_0x2667dd){WhatsappQueueEvents[_0x1ab2('0x5')](_0x6500f4+':'+_0x252241['id'],_0x252241);WhatsappQueueEvents[_0x1ab2('0x5')](_0x6500f4,_0x252241);_0x2667dd(null);};}for(var e in events){if(events[_0x1ab2('0x6')](e)){var event=events[e];WhatsappQueue[_0x1ab2('0x7')](e,emitEvent(event));}}module[_0x1ab2('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa343=['WhatsappQueue','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x3b71c2,_0x58f3bc){var _0x290839=function(_0x520870){while(--_0x520870){_0x3b71c2['push'](_0x3b71c2['shift']());}};_0x290839(++_0x58f3bc);}(_0xa343,0x9e));var _0x3a34=function(_0x4ead23,_0x537fec){_0x4ead23=_0x4ead23-0x0;var _0x36bcae=_0xa343[_0x4ead23];return _0x36bcae;};'use strict';var EventEmitter=require(_0x3a34('0x0'));var WhatsappQueue=require(_0x3a34('0x1'))['db'][_0x3a34('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x3a34('0x3')](0x0);var events={'afterCreate':_0x3a34('0x4'),'afterUpdate':_0x3a34('0x5'),'afterDestroy':_0x3a34('0x6')};function emitEvent(_0x47afa7){return function(_0x1e9e2d,_0x28e608,_0x3ac000){WhatsappQueueEvents[_0x3a34('0x7')](_0x47afa7+':'+_0x1e9e2d['id'],_0x1e9e2d);WhatsappQueueEvents['emit'](_0x47afa7,_0x1e9e2d);_0x3ac000(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x3a34('0x8')](e,emitEvent(event));}}module[_0x3a34('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index b1958d5..7d37851 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 _0xba63=['exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./whatsappQueue.attributes'];(function(_0x1b7b7e,_0x2daa87){var _0x57403f=function(_0x1a5baa){while(--_0x1a5baa){_0x1b7b7e['push'](_0x1b7b7e['shift']());}};_0x57403f(++_0x2daa87);}(_0xba63,0x118));var _0x3ba6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xba63[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3ba6('0x0'));var util=require(_0x3ba6('0x1'));var logger=require(_0x3ba6('0x2'))('api');var moment=require(_0x3ba6('0x3'));var BPromise=require(_0x3ba6('0x4'));var rp=require(_0x3ba6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3ba6('0x6'));var attributes=require(_0x3ba6('0x7'));module[_0x3ba6('0x8')]=function(_0x2a4ab9,_0x4825c3){return _0x2a4ab9[_0x3ba6('0x9')](_0x3ba6('0xa'),attributes,{'tableName':_0x3ba6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd50b=['util','../../config/logger','moment','bluebird','path','rimraf','exports','define'];(function(_0x12c6a9,_0x1ac7c5){var _0x3438c=function(_0x14e953){while(--_0x14e953){_0x12c6a9['push'](_0x12c6a9['shift']());}};_0x3438c(++_0x1ac7c5);}(_0xd50b,0xc0));var _0xbd50=function(_0x338990,_0x4755d9){_0x338990=_0x338990-0x0;var _0x14f156=_0xd50b[_0x338990];return _0x14f156;};'use strict';var _=require('lodash');var util=require(_0xbd50('0x0'));var logger=require(_0xbd50('0x1'))('api');var moment=require(_0xbd50('0x2'));var BPromise=require(_0xbd50('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd50('0x4'));var rimraf=require(_0xbd50('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0xbd50('0x6')]=function(_0x2583df,_0x55c17e){return _0x2583df[_0xbd50('0x7')]('WhatsappQueue',attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 504aae1..afce784 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 _0xbd95=['register','then','info','request\x20sent','debug','error','code','WhatsappQueue,\x20%s,\x20%s','message','catch','findAll','options','raw','where','include','map','model','attributes','GetWhatsappQueue','stringify','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x1419aa,_0x37c2b9){var _0x10e63c=function(_0x592f6b){while(--_0x592f6b){_0x1419aa['push'](_0x1419aa['shift']());}};_0x10e63c(++_0x37c2b9);}(_0xbd95,0x17f));var _0x5bd9=function(_0x22fae2,_0x4664fb){_0x22fae2=_0x22fae2-0x0;var _0x445558=_0xbd95[_0x22fae2];return _0x445558;};'use strict';var _=require(_0x5bd9('0x0'));var util=require('util');var moment=require(_0x5bd9('0x1'));var BPromise=require(_0x5bd9('0x2'));var rs=require(_0x5bd9('0x3'));var fs=require('fs');var Redis=require(_0x5bd9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5bd9('0x5'))(_0x5bd9('0x6'));var config=require(_0x5bd9('0x7'));var jayson=require(_0x5bd9('0x8'));var client=jayson['client'][_0x5bd9('0x9')]({'port':0x232a});config[_0x5bd9('0xa')]=_[_0x5bd9('0xb')](config[_0x5bd9('0xa')],{'host':_0x5bd9('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x5bd9('0xd')](socket);function respondWithRpcPromise(_0x1f97c5,_0x4b4b25,_0x152296){return new BPromise(function(_0x28747b,_0x221a93){return client['request'](_0x1f97c5,_0x152296)[_0x5bd9('0xe')](function(_0x29357a){logger[_0x5bd9('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x4b4b25,_0x5bd9('0x10'));logger[_0x5bd9('0x11')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4b4b25,_0x5bd9('0x10'),JSON['stringify'](_0x29357a));if(_0x29357a[_0x5bd9('0x12')]){if(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x13')]===0x1f4){logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);return _0x221a93(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);}logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x29357a[_0x5bd9('0x12')]['message']);return _0x28747b(_0x29357a[_0x5bd9('0x12')][_0x5bd9('0x15')]);}else{logger[_0x5bd9('0xf')](_0x5bd9('0x14'),_0x4b4b25,_0x5bd9('0x10'));_0x28747b(_0x29357a['result']['message']);}})[_0x5bd9('0x16')](function(_0x10f001){logger[_0x5bd9('0x12')](_0x5bd9('0x14'),_0x4b4b25,_0x10f001);_0x221a93(_0x10f001);});});}exports['GetWhatsappQueue']=function(_0x4fdeae){var _0x417a2e=this;return new Promise(function(_0x2897b3,_0x2bdb98){return db['WhatsappQueue'][_0x5bd9('0x17')]({'raw':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae[_0x5bd9('0x18')][_0x5bd9('0x19')]===undefined?!![]:![]:!![],'where':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae[_0x5bd9('0x18')][_0x5bd9('0x1a')]||null:null,'attributes':_0x4fdeae[_0x5bd9('0x18')]?_0x4fdeae['options']['attributes']||null:null,'limit':_0x4fdeae['options']?_0x4fdeae[_0x5bd9('0x18')]['limit']||null:null,'include':_0x4fdeae['options']?_0x4fdeae['options'][_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x4fdeae['options'][_0x5bd9('0x1b')],function(_0x2ac993){return{'model':db[_0x2ac993[_0x5bd9('0x1d')]],'as':_0x2ac993['as'],'attributes':_0x2ac993[_0x5bd9('0x1e')],'include':_0x2ac993[_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x2ac993[_0x5bd9('0x1b')],function(_0x133ef8){return{'model':db[_0x133ef8['model']],'as':_0x133ef8['as'],'attributes':_0x133ef8[_0x5bd9('0x1e')],'include':_0x133ef8['include']?_[_0x5bd9('0x1c')](_0x133ef8[_0x5bd9('0x1b')],function(_0x3d2a69){return{'model':db[_0x3d2a69[_0x5bd9('0x1d')]],'as':_0x3d2a69['as'],'attributes':_0x3d2a69[_0x5bd9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x191c9b){logger[_0x5bd9('0xf')](_0x5bd9('0x1f'),_0x4fdeae);logger[_0x5bd9('0x11')](_0x5bd9('0x1f'),_0x4fdeae,JSON[_0x5bd9('0x20')](_0x191c9b));_0x2897b3(_0x191c9b);})[_0x5bd9('0x16')](function(_0x41ae7a){logger[_0x5bd9('0x12')]('GetWhatsappQueue',_0x41ae7a[_0x5bd9('0x15')],_0x4fdeae);_0x2bdb98(_0x417a2e[_0x5bd9('0x12')](0x1f4,_0x41ae7a['message']));});});};exports[_0x5bd9('0x21')]=function(_0x4b2dee){var _0x18ab67=this;return new Promise(function(_0xdd502d,_0x2c4eac){return db[_0x5bd9('0x22')][_0x5bd9('0x23')]({'raw':_0x4b2dee['options']?_0x4b2dee['options'][_0x5bd9('0x19')]===undefined?!![]:![]:!![],'where':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')]['where']||null:null,'attributes':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')]['attributes']||null:null,'include':_0x4b2dee[_0x5bd9('0x18')]?_0x4b2dee[_0x5bd9('0x18')][_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x4b2dee[_0x5bd9('0x18')]['include'],function(_0x8f41e3){return{'model':db[_0x8f41e3['model']],'as':_0x8f41e3['as'],'attributes':_0x8f41e3['attributes'],'include':_0x8f41e3['include']?_['map'](_0x8f41e3['include'],function(_0x265cda){return{'model':db[_0x265cda[_0x5bd9('0x1d')]],'as':_0x265cda['as'],'attributes':_0x265cda['attributes'],'include':_0x265cda[_0x5bd9('0x1b')]?_[_0x5bd9('0x1c')](_0x265cda[_0x5bd9('0x1b')],function(_0x49976e){return{'model':db[_0x49976e['model']],'as':_0x49976e['as'],'attributes':_0x49976e[_0x5bd9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5bd9('0xe')](function(_0x139355){logger['info']('ShowWhatsappQueue',_0x4b2dee);logger[_0x5bd9('0x11')](_0x5bd9('0x21'),_0x4b2dee,JSON[_0x5bd9('0x20')](_0x139355));_0xdd502d(_0x139355);})[_0x5bd9('0x16')](function(_0x51237c){logger[_0x5bd9('0x12')](_0x5bd9('0x21'),_0x51237c['message'],_0x4b2dee);_0x2c4eac(_0x18ab67[_0x5bd9('0x12')](0x1f4,_0x51237c[_0x5bd9('0x15')]));});});}; \ No newline at end of file +var _0x6641=['WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowWhatsappQueue','find','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3aebfe,_0x54ea35){var _0x458547=function(_0x18e6c7){while(--_0x18e6c7){_0x3aebfe['push'](_0x3aebfe['shift']());}};_0x458547(++_0x54ea35);}(_0x6641,0xf8));var _0x1664=function(_0x5c2794,_0x31eb5f){_0x5c2794=_0x5c2794-0x0;var _0x53e850=_0x6641[_0x5c2794];return _0x53e850;};'use strict';var _=require(_0x1664('0x0'));var util=require(_0x1664('0x1'));var moment=require(_0x1664('0x2'));var BPromise=require(_0x1664('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1664('0x4'))(_0x1664('0x5'));var config=require(_0x1664('0x6'));var jayson=require(_0x1664('0x7'));var client=jayson[_0x1664('0x8')][_0x1664('0x9')]({'port':0x232a});config[_0x1664('0xa')]=_[_0x1664('0xb')](config[_0x1664('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1664('0xc'))(new Redis(config[_0x1664('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x32e55c,_0x130e63,_0x3ab174){return new BPromise(function(_0x460b6a,_0x58b972){return client[_0x1664('0xd')](_0x32e55c,_0x3ab174)[_0x1664('0xe')](function(_0x4ff0ea){logger['info'](_0x1664('0xf'),_0x130e63,_0x1664('0x10'));logger[_0x1664('0x11')](_0x1664('0x12'),_0x130e63,_0x1664('0x10'),JSON[_0x1664('0x13')](_0x4ff0ea));if(_0x4ff0ea[_0x1664('0x14')]){if(_0x4ff0ea['error']['code']===0x1f4){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x130e63,_0x4ff0ea[_0x1664('0x14')][_0x1664('0x15')]);return _0x58b972(_0x4ff0ea['error'][_0x1664('0x15')]);}logger['error'](_0x1664('0xf'),_0x130e63,_0x4ff0ea[_0x1664('0x14')][_0x1664('0x15')]);return _0x460b6a(_0x4ff0ea['error'][_0x1664('0x15')]);}else{logger[_0x1664('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x130e63,'request\x20sent');_0x460b6a(_0x4ff0ea[_0x1664('0x17')]['message']);}})[_0x1664('0x18')](function(_0x28a3d9){logger['error'](_0x1664('0xf'),_0x130e63,_0x28a3d9);_0x58b972(_0x28a3d9);});});}exports[_0x1664('0x19')]=function(_0x4c288){var _0x2d5eb5=this;return new Promise(function(_0x333387,_0x401234){return db[_0x1664('0x1a')][_0x1664('0x1b')]({'raw':_0x4c288['options']?_0x4c288[_0x1664('0x1c')][_0x1664('0x1d')]===undefined?!![]:![]:!![],'where':_0x4c288['options']?_0x4c288[_0x1664('0x1c')][_0x1664('0x1e')]||null:null,'attributes':_0x4c288['options']?_0x4c288[_0x1664('0x1c')][_0x1664('0x1f')]||null:null,'limit':_0x4c288[_0x1664('0x1c')]?_0x4c288[_0x1664('0x1c')][_0x1664('0x20')]||null:null,'include':_0x4c288[_0x1664('0x1c')]?_0x4c288['options'][_0x1664('0x21')]?_['map'](_0x4c288['options'][_0x1664('0x21')],function(_0x1c9bd2){return{'model':db[_0x1c9bd2[_0x1664('0x22')]],'as':_0x1c9bd2['as'],'attributes':_0x1c9bd2[_0x1664('0x1f')],'include':_0x1c9bd2[_0x1664('0x21')]?_[_0x1664('0x23')](_0x1c9bd2[_0x1664('0x21')],function(_0x35c51f){return{'model':db[_0x35c51f[_0x1664('0x22')]],'as':_0x35c51f['as'],'attributes':_0x35c51f[_0x1664('0x1f')],'include':_0x35c51f[_0x1664('0x21')]?_['map'](_0x35c51f[_0x1664('0x21')],function(_0x35b0b4){return{'model':db[_0x35b0b4[_0x1664('0x22')]],'as':_0x35b0b4['as'],'attributes':_0x35b0b4[_0x1664('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1664('0xe')](function(_0x5d4574){logger['info'](_0x1664('0x19'),_0x4c288);logger[_0x1664('0x11')]('GetWhatsappQueue',_0x4c288,JSON[_0x1664('0x13')](_0x5d4574));_0x333387(_0x5d4574);})['catch'](function(_0x5926e1){logger[_0x1664('0x14')]('GetWhatsappQueue',_0x5926e1[_0x1664('0x15')],_0x4c288);_0x401234(_0x2d5eb5[_0x1664('0x14')](0x1f4,_0x5926e1[_0x1664('0x15')]));});});};exports[_0x1664('0x24')]=function(_0x5e664d){var _0x5b4f66=this;return new Promise(function(_0x111897,_0x293c4c){return db[_0x1664('0x1a')][_0x1664('0x25')]({'raw':_0x5e664d[_0x1664('0x1c')]?_0x5e664d['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e664d[_0x1664('0x1c')]?_0x5e664d['options'][_0x1664('0x1e')]||null:null,'attributes':_0x5e664d['options']?_0x5e664d[_0x1664('0x1c')][_0x1664('0x1f')]||null:null,'include':_0x5e664d[_0x1664('0x1c')]?_0x5e664d[_0x1664('0x1c')][_0x1664('0x21')]?_[_0x1664('0x23')](_0x5e664d[_0x1664('0x1c')][_0x1664('0x21')],function(_0x1e5c4d){return{'model':db[_0x1e5c4d[_0x1664('0x22')]],'as':_0x1e5c4d['as'],'attributes':_0x1e5c4d[_0x1664('0x1f')],'include':_0x1e5c4d[_0x1664('0x21')]?_[_0x1664('0x23')](_0x1e5c4d['include'],function(_0x42f7ce){return{'model':db[_0x42f7ce[_0x1664('0x22')]],'as':_0x42f7ce['as'],'attributes':_0x42f7ce['attributes'],'include':_0x42f7ce[_0x1664('0x21')]?_[_0x1664('0x23')](_0x42f7ce[_0x1664('0x21')],function(_0x56ee4d){return{'model':db[_0x56ee4d[_0x1664('0x22')]],'as':_0x56ee4d['as'],'attributes':_0x56ee4d[_0x1664('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x1664('0xe')](function(_0x5aa804){logger[_0x1664('0x16')](_0x1664('0x24'),_0x5e664d);logger['debug'](_0x1664('0x24'),_0x5e664d,JSON[_0x1664('0x13')](_0x5aa804));_0x111897(_0x5aa804);})[_0x1664('0x18')](function(_0x1c2bdd){logger['error'](_0x1664('0x24'),_0x1c2bdd[_0x1664('0x15')],_0x5e664d);_0x293c4c(_0x5b4f66[_0x1664('0x14')](0x1f4,_0x1c2bdd['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 4c3c725..3ba152d 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 _0x2307=['update','emit','removeListener','length','whatsappQueue:','save','remove'];(function(_0x5e932e,_0x2bd49e){var _0x45de43=function(_0x3b3d1e){while(--_0x3b3d1e){_0x5e932e['push'](_0x5e932e['shift']());}};_0x45de43(++_0x2bd49e);}(_0x2307,0x67));var _0x7230=function(_0x1326e5,_0x14131f){_0x1326e5=_0x1326e5-0x0;var _0x4a15e0=_0x2307[_0x1326e5];return _0x4a15e0;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x7230('0x0'),_0x7230('0x1'),_0x7230('0x2')];function createListener(_0x4f8ec3,_0xd4e42c){return function(_0x1a9b5b){_0xd4e42c[_0x7230('0x3')](_0x4f8ec3,_0x1a9b5b);};}function removeListener(_0xb22270,_0x45eb2a){return function(){WhatsappQueueEvents[_0x7230('0x4')](_0xb22270,_0x45eb2a);};}exports['register']=function(_0x3740f5){for(var _0x2ddb4c=0x0,_0x36a7c8=events[_0x7230('0x5')];_0x2ddb4c<_0x36a7c8;_0x2ddb4c++){var _0x6ba9f3=events[_0x2ddb4c];var _0x2ce713=createListener(_0x7230('0x6')+_0x6ba9f3,_0x3740f5);WhatsappQueueEvents['on'](_0x6ba9f3,_0x2ce713);}}; \ No newline at end of file +var _0xdbbd=['length','whatsappQueue:','./whatsappQueue.events','remove','update'];(function(_0x30b2c6,_0x1eafe8){var _0x42052d=function(_0xfeb539){while(--_0xfeb539){_0x30b2c6['push'](_0x30b2c6['shift']());}};_0x42052d(++_0x1eafe8);}(_0xdbbd,0x1b5));var _0xddbb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xdbbd[_0x1e7b16];return _0x37fadc;};'use strict';var WhatsappQueueEvents=require(_0xddbb('0x0'));var events=['save',_0xddbb('0x1'),_0xddbb('0x2')];function createListener(_0x2bc85e,_0x4be8c3){return function(_0xee9f0c){_0x4be8c3['emit'](_0x2bc85e,_0xee9f0c);};}function removeListener(_0x53a563,_0x5a40e3){return function(){WhatsappQueueEvents['removeListener'](_0x53a563,_0x5a40e3);};}exports['register']=function(_0x49311e){for(var _0x4d02db=0x0,_0x2868bf=events[_0xddbb('0x3')];_0x4d02db<_0x2868bf;_0x4d02db++){var _0x47946e=events[_0x4d02db];var _0x18e488=createListener(_0xddbb('0x4')+_0x47946e,_0x49311e);WhatsappQueueEvents['on'](_0x47946e,_0x18e488);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index f5c3fc0..85929b1 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 _0xf920=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x54135d,_0x285be9){var _0x129cf7=function(_0x58e713){while(--_0x58e713){_0x54135d['push'](_0x54135d['shift']());}};_0x129cf7(++_0x285be9);}(_0xf920,0x1d7));var _0x0f92=function(_0x1ba2e5,_0xbcc3fb){_0x1ba2e5=_0x1ba2e5-0x0;var _0x2b8957=_0xf920[_0x1ba2e5];return _0x2b8957;};'use strict';var multer=require(_0x0f92('0x0'));var util=require(_0x0f92('0x1'));var path=require(_0x0f92('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f92('0x3'));var router=express['Router']();var fs_extra=require(_0x0f92('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f92('0x5'));router[_0x0f92('0x6')]('/',auth[_0x0f92('0x7')](),controller[_0x0f92('0x8')]);router['get'](_0x0f92('0x9'),auth[_0x0f92('0x7')](),controller['describe']);router[_0x0f92('0x6')](_0x0f92('0xa'),auth[_0x0f92('0x7')](),controller[_0x0f92('0xb')]);router['post']('/',auth[_0x0f92('0x7')](),controller[_0x0f92('0xc')]);router[_0x0f92('0xd')]('/:id',auth[_0x0f92('0x7')](),controller['update']);router[_0x0f92('0xe')](_0x0f92('0xa'),auth[_0x0f92('0x7')](),controller[_0x0f92('0xf')]);module[_0x0f92('0x10')]=router; \ No newline at end of file +var _0x7c39=['destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','describe','post','create','update','/:id'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x7c39,0x1c3));var _0x97c3=function(_0x5b09cf,_0x59714f){_0x5b09cf=_0x5b09cf-0x0;var _0x37161=_0x7c39[_0x5b09cf];return _0x37161;};'use strict';var multer=require(_0x97c3('0x0'));var util=require(_0x97c3('0x1'));var path=require(_0x97c3('0x2'));var timeout=require(_0x97c3('0x3'));var express=require(_0x97c3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x97c3('0x5'));var interaction=require(_0x97c3('0x6'));var config=require(_0x97c3('0x7'));var controller=require(_0x97c3('0x8'));router[_0x97c3('0x9')]('/',auth[_0x97c3('0xa')](),controller[_0x97c3('0xb')]);router['get']('/describe',auth[_0x97c3('0xa')](),controller[_0x97c3('0xc')]);router[_0x97c3('0x9')]('/:id',auth[_0x97c3('0xa')](),controller['show']);router[_0x97c3('0xd')]('/',auth[_0x97c3('0xa')](),controller[_0x97c3('0xe')]);router['put']('/:id',auth[_0x97c3('0xa')](),controller[_0x97c3('0xf')]);router['delete'](_0x97c3('0x10'),auth[_0x97c3('0xa')](),controller[_0x97c3('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index bfd3380..8b8b977 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x135c04,_0x152b32){var _0x3ba431=function(_0x144a23){while(--_0x144a23){_0x135c04['push'](_0x135c04['shift']());}};_0x3ba431(++_0x152b32);}(_0x7a54,0x106));var _0x47a5=function(_0x1c59a0,_0x3d0cd0){_0x1c59a0=_0x1c59a0-0x0;var _0x12c1e7=_0x7a54[_0x1c59a0];return _0x12c1e7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4066b7,_0x3ee213){var _0x17097d=function(_0x2927c1){while(--_0x2927c1){_0x4066b7['push'](_0x4066b7['shift']());}};_0x17097d(++_0x3ee213);}(_0x7a54,0x106));var _0x47a5=function(_0x4bd3aa,_0x451268){_0x4bd3aa=_0x4bd3aa-0x0;var _0x1d375b=_0x7a54[_0x4bd3aa];return _0x1d375b;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 33a41a8..dcc9335 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 _0x6e6c=['reject','save','update','then','destroy','end','error','stack','name','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x581d98,_0x348ad5){var _0x26df05=function(_0x4df237){while(--_0x4df237){_0x581d98['push'](_0x581d98['shift']());}};_0x26df05(++_0x348ad5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xc6e6('0x0'));var rimraf=require(_0xc6e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc6e6('0x2'));var rp=require(_0xc6e6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc6e6('0x4'));var util=require('util');var path=require(_0xc6e6('0x5'));var sox=require('sox');var csv=require(_0xc6e6('0x6'));var ejs=require(_0xc6e6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6e6('0x8'));var squel=require(_0xc6e6('0x9'));var crypto=require('crypto');var jsforce=require(_0xc6e6('0xa'));var deskjs=require(_0xc6e6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6e6('0xc'));var Papa=require('papaparse');var Redis=require(_0xc6e6('0xd'));var authService=require(_0xc6e6('0xe'));var qs=require(_0xc6e6('0xf'));var as=require(_0xc6e6('0x10'));var hardwareService=require(_0xc6e6('0x11'));var logger=require(_0xc6e6('0x12'))(_0xc6e6('0x13'));var utils=require(_0xc6e6('0x14'));var config=require(_0xc6e6('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc6e6('0x16'))['db'];function respondWithStatusCode(_0x525d60,_0x3a30ce){_0x3a30ce=_0x3a30ce||0xcc;return function(_0x314d0f){if(_0x314d0f){return _0x525d60[_0xc6e6('0x17')](_0x3a30ce);}return _0x525d60[_0xc6e6('0x18')](_0x3a30ce)['end']();};}function respondWithResult(_0x149ac6,_0x2bfe7d){_0x2bfe7d=_0x2bfe7d||0xc8;return function(_0x13be73){if(_0x13be73){return _0x149ac6[_0xc6e6('0x18')](_0x2bfe7d)[_0xc6e6('0x19')](_0x13be73);}};}function respondWithFilteredResult(_0x4cdf15,_0x413cf8){return function(_0x178b34){if(_0x178b34){var _0x569474=typeof _0x413cf8[_0xc6e6('0x1a')]===_0xc6e6('0x1b')&&typeof _0x413cf8[_0xc6e6('0x1c')]==='undefined';var _0x51fd7c=_0x178b34['count'];var _0x3a1ccc=_0x569474?0x0:_0x413cf8['offset'];var _0x46e58f=_0x569474?_0x178b34[_0xc6e6('0x1d')]:_0x413cf8[_0xc6e6('0x1a')]+_0x413cf8[_0xc6e6('0x1c')];var _0x19e1e4;if(_0x46e58f>=_0x51fd7c){_0x46e58f=_0x51fd7c;_0x19e1e4=0xc8;}else{_0x19e1e4=0xce;}_0x4cdf15[_0xc6e6('0x18')](_0x19e1e4);return _0x4cdf15[_0xc6e6('0x1e')](_0xc6e6('0x1f'),_0x3a1ccc+'-'+_0x46e58f+'/'+_0x51fd7c)[_0xc6e6('0x19')](_0x178b34);}return null;};}function patchUpdates(_0x3d734d){return function(_0x4a36b6){try{jsonpatch[_0xc6e6('0x20')](_0x4a36b6,_0x3d734d,!![]);}catch(_0x4ad70e){return BPromise[_0xc6e6('0x21')](_0x4ad70e);}return _0x4a36b6[_0xc6e6('0x22')]();};}function saveUpdates(_0x2be6fc,_0x2f69f1){return function(_0x4f1d68){if(_0x4f1d68){return _0x4f1d68[_0xc6e6('0x23')](_0x2be6fc)[_0xc6e6('0x24')](function(_0x3a96df){return _0x3a96df;});}return null;};}function removeEntity(_0x36ebfa,_0x107561){return function(_0x4c35ae){if(_0x4c35ae){return _0x4c35ae[_0xc6e6('0x25')]()['then'](function(){_0x36ebfa[_0xc6e6('0x18')](0xcc)[_0xc6e6('0x26')]();});}};}function handleEntityNotFound(_0x2e5e0e,_0x64e1dc){return function(_0x53a1bf){if(!_0x53a1bf){_0x2e5e0e[_0xc6e6('0x17')](0x194);}return _0x53a1bf;};}function handleError(_0x5a5e47,_0x28577b){_0x28577b=_0x28577b||0x1f4;return function(_0x534745){logger[_0xc6e6('0x27')](_0x534745[_0xc6e6('0x28')]);if(_0x534745[_0xc6e6('0x29')]){delete _0x534745[_0xc6e6('0x29')];}_0x5a5e47[_0xc6e6('0x18')](_0x28577b)['send'](_0x534745);};}exports[_0xc6e6('0x2a')]=function(_0x1501bd,_0x166313){var _0x1af05c={},_0x4d1284={},_0x34ae96={'count':0x0,'rows':[]};var _0x50b735=_[_0xc6e6('0x2b')](db[_0xc6e6('0x2c')][_0xc6e6('0x2d')],function(_0xc578b3){return{'name':_0xc578b3[_0xc6e6('0x2e')],'type':_0xc578b3[_0xc6e6('0x2f')][_0xc6e6('0x30')]};});_0x4d1284[_0xc6e6('0x31')]=_[_0xc6e6('0x2b')](_0x50b735,_0xc6e6('0x29'));_0x4d1284[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x1501bd[_0xc6e6('0x32')]);_0x4d1284[_0xc6e6('0x34')]=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],_0x4d1284[_0xc6e6('0x32')]);_0x1af05c['attributes']=_[_0xc6e6('0x35')](_0x4d1284[_0xc6e6('0x31')],qs['fields'](_0x1501bd['query'][_0xc6e6('0x36')]));_0x1af05c[_0xc6e6('0x37')]=_0x1af05c[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x1af05c[_0xc6e6('0x37')]:_0x4d1284[_0xc6e6('0x31')];if(!_0x1501bd['query'][_0xc6e6('0x39')](_0xc6e6('0x3a'))){_0x1af05c[_0xc6e6('0x1c')]=qs['limit'](_0x1501bd['query'][_0xc6e6('0x1c')]);_0x1af05c[_0xc6e6('0x1a')]=qs[_0xc6e6('0x1a')](_0x1501bd[_0xc6e6('0x32')]['offset']);}_0x1af05c['order']=qs[_0xc6e6('0x3b')](_0x1501bd['query'][_0xc6e6('0x3b')]);_0x1af05c['where']=qs[_0xc6e6('0x34')](_[_0xc6e6('0x3c')](_0x1501bd[_0xc6e6('0x32')],_0x4d1284[_0xc6e6('0x34')]),_0x50b735);if(_0x1501bd['query']['filter']){_0x1af05c[_0xc6e6('0x3d')]=_[_0xc6e6('0x3e')](_0x1af05c[_0xc6e6('0x3d')],{'$or':_[_0xc6e6('0x2b')](_0x50b735,function(_0x4bb732){if(_0x4bb732['type']!==_0xc6e6('0x3f')){var _0x1326c7={};_0x1326c7[_0x4bb732[_0xc6e6('0x29')]]={'$like':'%'+_0x1501bd[_0xc6e6('0x32')]['filter']+'%'};return _0x1326c7;}})});}_0x1af05c=_[_0xc6e6('0x3e')]({},_0x1af05c,_0x1501bd[_0xc6e6('0x40')]);var _0x5ddab4={'where':_0x1af05c['where']};return db[_0xc6e6('0x2c')]['count'](_0x5ddab4)[_0xc6e6('0x24')](function(_0x3817fc){_0x34ae96['count']=_0x3817fc;if(_0x1501bd[_0xc6e6('0x32')]['includeAll']){_0x1af05c[_0xc6e6('0x41')]=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xc6e6('0x42')](_0x1af05c);})[_0xc6e6('0x24')](function(_0x247076){_0x34ae96[_0xc6e6('0x43')]=_0x247076;return _0x34ae96;})[_0xc6e6('0x24')](respondWithFilteredResult(_0x166313,_0x1af05c))[_0xc6e6('0x44')](handleError(_0x166313,null));};exports[_0xc6e6('0x45')]=function(_0x69766,_0x5ecf6c){var _0x5722db={'raw':!![],'where':{'id':_0x69766[_0xc6e6('0x46')]['id']}},_0x3e3da6={};_0x3e3da6[_0xc6e6('0x31')]=_[_0xc6e6('0x33')](db['WhatsappQueueReport'][_0xc6e6('0x2d')]);_0x3e3da6[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x69766[_0xc6e6('0x32')]);_0x3e3da6['filters']=_[_0xc6e6('0x35')](_0x3e3da6[_0xc6e6('0x31')],_0x3e3da6[_0xc6e6('0x32')]);_0x5722db[_0xc6e6('0x37')]=_[_0xc6e6('0x35')](_0x3e3da6['model'],qs[_0xc6e6('0x36')](_0x69766['query'][_0xc6e6('0x36')]));_0x5722db['attributes']=_0x5722db[_0xc6e6('0x37')][_0xc6e6('0x38')]?_0x5722db[_0xc6e6('0x37')]:_0x3e3da6[_0xc6e6('0x31')];if(_0x69766[_0xc6e6('0x32')][_0xc6e6('0x47')]){_0x5722db[_0xc6e6('0x41')]=[{'all':!![]}];}_0x5722db=_[_0xc6e6('0x3e')]({},_0x5722db,_0x69766['options']);return db[_0xc6e6('0x2c')][_0xc6e6('0x48')](_0x5722db)[_0xc6e6('0x24')](handleEntityNotFound(_0x5ecf6c,null))['then'](respondWithResult(_0x5ecf6c,null))[_0xc6e6('0x44')](handleError(_0x5ecf6c,null));};exports[_0xc6e6('0x49')]=function(_0x38ecc3,_0x42ed90){return db[_0xc6e6('0x2c')][_0xc6e6('0x49')](_0x38ecc3[_0xc6e6('0x4a')],{})[_0xc6e6('0x24')](respondWithResult(_0x42ed90,0xc9))[_0xc6e6('0x44')](handleError(_0x42ed90,null));};exports[_0xc6e6('0x23')]=function(_0x3bfe85,_0x470167){if(_0x3bfe85[_0xc6e6('0x4a')]['id']){delete _0x3bfe85[_0xc6e6('0x4a')]['id'];}return db['WhatsappQueueReport'][_0xc6e6('0x48')]({'where':{'id':_0x3bfe85['params']['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x470167,null))[_0xc6e6('0x24')](saveUpdates(_0x3bfe85['body'],null))['then'](respondWithResult(_0x470167,null))['catch'](handleError(_0x470167,null));};exports['destroy']=function(_0x531dca,_0x3edc16){return db[_0xc6e6('0x2c')][_0xc6e6('0x48')]({'where':{'id':_0x531dca[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x24')](handleEntityNotFound(_0x3edc16,null))['then'](removeEntity(_0x3edc16,null))['catch'](handleError(_0x3edc16,null));};exports[_0xc6e6('0x4b')]=function(_0x2d5e44,_0x1aa872){return db[_0xc6e6('0x2c')]['describe']()[_0xc6e6('0x24')](respondWithResult(_0x1aa872,null))[_0xc6e6('0x44')](handleError(_0x1aa872,null));}; \ No newline at end of file +var _0x2e54=['catch','show','params','find','create','body','update','destroy','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x235fee,_0x126675){var _0x184185=function(_0x35c811){while(--_0x35c811){_0x235fee['push'](_0x235fee['shift']());}};_0x184185(++_0x126675);}(_0x2e54,0x1dd));var _0x42e5=function(_0x28259f,_0x4f7913){_0x28259f=_0x28259f-0x0;var _0x3d4d2b=_0x2e54[_0x28259f];return _0x3d4d2b;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['WhatsappQueueReport'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));};exports[_0x42e5('0x4d')]=function(_0x26782e,_0x18cedc){return db['WhatsappQueueReport'][_0x42e5('0x4d')]()['then'](respondWithResult(_0x18cedc,null))[_0x42e5('0x45')](handleError(_0x18cedc,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a4c4d92..927a646 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 _0xf723=['bluebird','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xf723,0x15d));var _0x3f72=function(_0x70800b,_0x18c90c){_0x70800b=_0x70800b-0x0;var _0x8db856=_0xf723[_0x70800b];return _0x8db856;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3f72('0x0'))(_0x3f72('0x1'));var moment=require(_0x3f72('0x2'));var BPromise=require(_0x3f72('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3f72('0x4'));var attributes=require(_0x3f72('0x5'));module[_0x3f72('0x6')]=function(_0x388b36,_0x51c942){return _0x388b36[_0x3f72('0x7')](_0x3f72('0x8'),attributes,{'tableName':_0x3f72('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3f72('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x79bc=['uniqueid','lodash','util','moment','request-promise','path','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue'];(function(_0x412fe1,_0x1795d3){var _0x1a6d40=function(_0x26b1e5){while(--_0x26b1e5){_0x412fe1['push'](_0x412fe1['shift']());}};_0x1a6d40(++_0x1795d3);}(_0x79bc,0x9b));var _0xc79b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x79bc[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xc79b('0x0'));var util=require(_0xc79b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc79b('0x2'));var BPromise=require('bluebird');var rp=require(_0xc79b('0x3'));var fs=require('fs');var path=require(_0xc79b('0x4'));var rimraf=require('rimraf');var config=require(_0xc79b('0x5'));var attributes=require('./whatsappQueueReport.attributes');module[_0xc79b('0x6')]=function(_0x14fd3f,_0x3a7e6e){return _0x14fd3f[_0xc79b('0x7')](_0xc79b('0x8'),attributes,{'tableName':_0xc79b('0x9'),'paranoid':![],'indexes':[{'name':_0xc79b('0xa'),'fields':[_0xc79b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 4d14488..5641787 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 _0x7d5c=['code','WhatsappQueueReport,\x20%s,\x20%s','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error'];(function(_0x1a5c7d,_0x3537a7){var _0x27109b=function(_0x11d750){while(--_0x11d750){_0x1a5c7d['push'](_0x1a5c7d['shift']());}};_0x27109b(++_0x3537a7);}(_0x7d5c,0x1ee));var _0xc7d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc7d5('0x0'));var util=require(_0xc7d5('0x1'));var moment=require(_0xc7d5('0x2'));var BPromise=require(_0xc7d5('0x3'));var rs=require(_0xc7d5('0x4'));var fs=require('fs');var Redis=require(_0xc7d5('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc7d5('0x6'));var config=require('../../config/environment');var jayson=require(_0xc7d5('0x7'));var client=jayson[_0xc7d5('0x8')][_0xc7d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48665a,_0x54d807,_0x5db9b1){return new BPromise(function(_0x32459a,_0x22531c){return client[_0xc7d5('0xa')](_0x48665a,_0x5db9b1)[_0xc7d5('0xb')](function(_0x320774){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x54d807,'request\x20sent');logger[_0xc7d5('0xc')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x54d807,_0xc7d5('0xd'),JSON[_0xc7d5('0xe')](_0x320774));if(_0x320774['error']){if(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x10')]===0x1f4){logger['error'](_0xc7d5('0x11'),_0x54d807,_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);return _0x22531c(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);}logger['error'](_0xc7d5('0x11'),_0x54d807,_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);return _0x32459a(_0x320774[_0xc7d5('0xf')][_0xc7d5('0x12')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x54d807,_0xc7d5('0xd'));_0x32459a(_0x320774['result'][_0xc7d5('0x12')]);}})[_0xc7d5('0x13')](function(_0x5822b2){logger[_0xc7d5('0xf')](_0xc7d5('0x11'),_0x54d807,_0x5822b2);_0x22531c(_0x5822b2);});});}exports[_0xc7d5('0x14')]=function(_0x521699){var _0x330bf9=this;return new Promise(function(_0x35c133,_0x1f505c){return db[_0xc7d5('0x15')][_0xc7d5('0x16')](_0x521699['body'],{'raw':_0x521699[_0xc7d5('0x17')]?_0x521699['options'][_0xc7d5('0x18')]===undefined?!![]:![]:!![]})[_0xc7d5('0xb')](function(_0x5cecb9){logger['info']('CreateWhatsappQueueReport',_0x521699);logger['debug'](_0xc7d5('0x14'),_0x521699,JSON[_0xc7d5('0xe')](_0x5cecb9));_0x35c133(_0x5cecb9);})[_0xc7d5('0x13')](function(_0x3ef068){logger[_0xc7d5('0xf')](_0xc7d5('0x14'),_0x3ef068[_0xc7d5('0x12')],_0x521699);_0x1f505c(_0x330bf9[_0xc7d5('0xf')](0x1f4,_0x3ef068[_0xc7d5('0x12')]));});});};exports[_0xc7d5('0x19')]=function(_0x33ad6c){var _0x1a4d0e=this;return new Promise(function(_0xf7df23,_0x542697){return db['WhatsappQueueReport'][_0xc7d5('0x1a')](_0x33ad6c[_0xc7d5('0x1b')],{'raw':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')][_0xc7d5('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')][_0xc7d5('0x1c')]||null:null,'attributes':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c[_0xc7d5('0x17')]['attributes']||null:null,'limit':_0x33ad6c[_0xc7d5('0x17')]?_0x33ad6c['options'][_0xc7d5('0x1d')]||null:null})[_0xc7d5('0xb')](function(_0x4d8796){logger['info'](_0xc7d5('0x19'),_0x33ad6c);logger[_0xc7d5('0xc')](_0xc7d5('0x19'),_0x33ad6c,JSON[_0xc7d5('0xe')](_0x4d8796));_0xf7df23(_0x4d8796);})['catch'](function(_0x30e2ee){logger['error'](_0xc7d5('0x19'),_0x30e2ee[_0xc7d5('0x12')],_0x33ad6c);_0x542697(_0x1a4d0e[_0xc7d5('0xf')](0x1f4,_0x30e2ee[_0xc7d5('0x12')]));});});}; \ No newline at end of file +var _0x2b19=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','then','UpdateWhatsappQueueReport','where','attributes','lodash','moment','bluebird'];(function(_0x5128ba,_0x4063f5){var _0x2cf596=function(_0x5da93a){while(--_0x5da93a){_0x5128ba['push'](_0x5128ba['shift']());}};_0x2cf596(++_0x4063f5);}(_0x2b19,0x11d));var _0x92b1=function(_0x3c5928,_0x4a7003){_0x3c5928=_0x3c5928-0x0;var _0x14e5c1=_0x2b19[_0x3c5928];return _0x14e5c1;};'use strict';var _=require(_0x92b1('0x0'));var util=require('util');var moment=require(_0x92b1('0x1'));var BPromise=require(_0x92b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x92b1('0x3'));var db=require(_0x92b1('0x4'))['db'];var utils=require(_0x92b1('0x5'));var logger=require(_0x92b1('0x6'))('rpc');var config=require(_0x92b1('0x7'));var jayson=require(_0x92b1('0x8'));var client=jayson[_0x92b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459403,_0x161836,_0x53eca6){return new BPromise(function(_0x120c58,_0x55fef2){return client[_0x92b1('0xa')](_0x459403,_0x53eca6)['then'](function(_0x2f7d12){logger[_0x92b1('0xb')](_0x92b1('0xc'),_0x161836,_0x92b1('0xd'));logger[_0x92b1('0xe')](_0x92b1('0xf'),_0x161836,_0x92b1('0xd'),JSON[_0x92b1('0x10')](_0x2f7d12));if(_0x2f7d12[_0x92b1('0x11')]){if(_0x2f7d12[_0x92b1('0x11')][_0x92b1('0x12')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x161836,_0x2f7d12[_0x92b1('0x11')][_0x92b1('0x13')]);return _0x55fef2(_0x2f7d12[_0x92b1('0x11')]['message']);}logger[_0x92b1('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x161836,_0x2f7d12[_0x92b1('0x11')][_0x92b1('0x13')]);return _0x120c58(_0x2f7d12['error'][_0x92b1('0x13')]);}else{logger[_0x92b1('0xb')](_0x92b1('0xc'),_0x161836,_0x92b1('0xd'));_0x120c58(_0x2f7d12[_0x92b1('0x14')]['message']);}})[_0x92b1('0x15')](function(_0x33ca61){logger[_0x92b1('0x11')](_0x92b1('0xc'),_0x161836,_0x33ca61);_0x55fef2(_0x33ca61);});});}exports[_0x92b1('0x16')]=function(_0x3e603a){var _0x4da4ec=this;return new Promise(function(_0x349d5f,_0xf18915){return db[_0x92b1('0x17')][_0x92b1('0x18')](_0x3e603a[_0x92b1('0x19')],{'raw':_0x3e603a[_0x92b1('0x1a')]?_0x3e603a['options'][_0x92b1('0x1b')]===undefined?!![]:![]:!![]})[_0x92b1('0x1c')](function(_0x2ae92c){logger[_0x92b1('0xb')](_0x92b1('0x16'),_0x3e603a);logger['debug'](_0x92b1('0x16'),_0x3e603a,JSON['stringify'](_0x2ae92c));_0x349d5f(_0x2ae92c);})[_0x92b1('0x15')](function(_0x28e77d){logger[_0x92b1('0x11')](_0x92b1('0x16'),_0x28e77d['message'],_0x3e603a);_0xf18915(_0x4da4ec[_0x92b1('0x11')](0x1f4,_0x28e77d['message']));});});};exports[_0x92b1('0x1d')]=function(_0xdf788){var _0x49af16=this;return new Promise(function(_0x2c88f3,_0x218d68){return db[_0x92b1('0x17')]['update'](_0xdf788[_0x92b1('0x19')],{'raw':_0xdf788['options']?_0xdf788[_0x92b1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xdf788['options']?_0xdf788[_0x92b1('0x1a')][_0x92b1('0x1e')]||null:null,'attributes':_0xdf788[_0x92b1('0x1a')]?_0xdf788[_0x92b1('0x1a')][_0x92b1('0x1f')]||null:null,'limit':_0xdf788[_0x92b1('0x1a')]?_0xdf788[_0x92b1('0x1a')]['limit']||null:null})[_0x92b1('0x1c')](function(_0x5c9e17){logger[_0x92b1('0xb')]('UpdateWhatsappQueueReport',_0xdf788);logger[_0x92b1('0xe')]('UpdateWhatsappQueueReport',_0xdf788,JSON[_0x92b1('0x10')](_0x5c9e17));_0x2c88f3(_0x5c9e17);})[_0x92b1('0x15')](function(_0xf5235a){logger['error'](_0x92b1('0x1d'),_0xf5235a[_0x92b1('0x13')],_0xdf788);_0x218d68(_0x49af16[_0x92b1('0x11')](0x1f4,_0xf5235a[_0x92b1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index c8d2bbf..5675be0 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 _0x0f6d=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','describe','/:id','isAuthenticated'];(function(_0x36199a,_0x4f756c){var _0x5b36f1=function(_0x29480d){while(--_0x29480d){_0x36199a['push'](_0x36199a['shift']());}};_0x5b36f1(++_0x4f756c);}(_0x0f6d,0x1bf));var _0xd0f6=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0x0f6d[_0x5e8c32];return _0x595f7b;};'use strict';var multer=require(_0xd0f6('0x0'));var util=require(_0xd0f6('0x1'));var path=require(_0xd0f6('0x2'));var timeout=require(_0xd0f6('0x3'));var express=require('express');var router=express[_0xd0f6('0x4')]();var fs_extra=require(_0xd0f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd0f6('0x6'));var config=require(_0xd0f6('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xd0f6('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0f6('0x9')]);router[_0xd0f6('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd0f6('0xa')]);router[_0xd0f6('0x8')](_0xd0f6('0xb'),auth[_0xd0f6('0xc')](),controller['show']);router[_0xd0f6('0xd')]('/',auth[_0xd0f6('0xc')](),controller[_0xd0f6('0xe')]);router[_0xd0f6('0xf')](_0xd0f6('0xb'),auth[_0xd0f6('0xc')](),controller[_0xd0f6('0x10')]);router[_0xd0f6('0x11')](_0xd0f6('0xb'),auth['isAuthenticated'](),controller[_0xd0f6('0x12')]);module[_0xd0f6('0x13')]=router; \ No newline at end of file +var _0x1de9=['/:id','update','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put'];(function(_0xc14df7,_0x163f90){var _0x34a445=function(_0x1bbf28){while(--_0x1bbf28){_0xc14df7['push'](_0xc14df7['shift']());}};_0x34a445(++_0x163f90);}(_0x1de9,0x16d));var _0x91de=function(_0x56f17e,_0x2dd0aa){_0x56f17e=_0x56f17e-0x0;var _0x401579=_0x1de9[_0x56f17e];return _0x401579;};'use strict';var multer=require(_0x91de('0x0'));var util=require('util');var path=require(_0x91de('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x91de('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x91de('0x3'));var interaction=require(_0x91de('0x4'));var config=require('../../config/environment');var controller=require(_0x91de('0x5'));router[_0x91de('0x6')]('/',auth['isAuthenticated'](),controller[_0x91de('0x7')]);router[_0x91de('0x6')](_0x91de('0x8'),auth[_0x91de('0x9')](),controller[_0x91de('0xa')]);router[_0x91de('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x91de('0xb')]);router[_0x91de('0xc')]('/',auth['isAuthenticated'](),controller[_0x91de('0xd')]);router[_0x91de('0xe')](_0x91de('0xf'),auth[_0x91de('0x9')](),controller[_0x91de('0x10')]);router['delete'](_0x91de('0xf'),auth[_0x91de('0x9')](),controller[_0x91de('0x11')]);module[_0x91de('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 9be81ca..a52063d 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 _0x0447=['exports','STRING','ENUM','account','queue','DATE','sequelize'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x0447,0x8b));var _0x7044=function(_0x4fa622,_0x4e2fe9){_0x4fa622=_0x4fa622-0x0;var _0xc754da=_0x0447[_0x4fa622];return _0xc754da;};'use strict';var Sequelize=require(_0x7044('0x0'));module[_0x7044('0x1')]={'uniqueid':{'type':Sequelize[_0x7044('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x7044('0x3')](_0x7044('0x4'),'agent',_0x7044('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x7044('0x6')]}}; \ No newline at end of file +var _0x225b=['account','queue','sequelize','exports','ENUM'];(function(_0x16fa9d,_0x3d11dd){var _0xeb9190=function(_0x154494){while(--_0x154494){_0x16fa9d['push'](_0x16fa9d['shift']());}};_0xeb9190(++_0x3d11dd);}(_0x225b,0xb1));var _0xb225=function(_0x55d8a1,_0x2395f0){_0x55d8a1=_0x55d8a1-0x0;var _0xe298e1=_0x225b[_0x55d8a1];return _0xe298e1;};'use strict';var Sequelize=require(_0xb225('0x0'));module[_0xb225('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb225('0x2')](_0xb225('0x3'),'agent',_0xb225('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 17c3f71..6ba6cc9 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 _0x553a=['fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','offset','count','Content-Range','json','reject','save','update','then','destroy','name','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x207c76,_0x5c742c){var _0x102327=function(_0x182203){while(--_0x182203){_0x207c76['push'](_0x207c76['shift']());}};_0x102327(++_0x5c742c);}(_0x553a,0x141));var _0xa553=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x553a[_0x417baa];return _0x42724f;};'use strict';var emlformat=require(_0xa553('0x0'));var rimraf=require(_0xa553('0x1'));var zipdir=require(_0xa553('0x2'));var jsonpatch=require(_0xa553('0x3'));var rp=require(_0xa553('0x4'));var moment=require(_0xa553('0x5'));var BPromise=require(_0xa553('0x6'));var Mustache=require(_0xa553('0x7'));var util=require(_0xa553('0x8'));var path=require('path');var sox=require(_0xa553('0x9'));var csv=require('to-csv');var ejs=require(_0xa553('0xa'));var fs=require('fs');var fs_extra=require(_0xa553('0xb'));var _=require('lodash');var squel=require(_0xa553('0xc'));var crypto=require('crypto');var jsforce=require(_0xa553('0xd'));var deskjs=require(_0xa553('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa553('0xf'));var Papa=require(_0xa553('0x10'));var Redis=require(_0xa553('0x11'));var authService=require(_0xa553('0x12'));var qs=require(_0xa553('0x13'));var as=require(_0xa553('0x14'));var hardwareService=require(_0xa553('0x15'));var logger=require(_0xa553('0x16'))(_0xa553('0x17'));var utils=require('../../config/utils');var config=require(_0xa553('0x18'));var licenseUtil=require(_0xa553('0x19'));var db=require(_0xa553('0x1a'))['db'];function respondWithStatusCode(_0xc76eb7,_0x21cd2b){_0x21cd2b=_0x21cd2b||0xcc;return function(_0x398bf8){if(_0x398bf8){return _0xc76eb7['sendStatus'](_0x21cd2b);}return _0xc76eb7[_0xa553('0x1b')](_0x21cd2b)[_0xa553('0x1c')]();};}function respondWithResult(_0x4be723,_0x52d941){_0x52d941=_0x52d941||0xc8;return function(_0x363bae){if(_0x363bae){return _0x4be723[_0xa553('0x1b')](_0x52d941)['json'](_0x363bae);}};}function respondWithFilteredResult(_0x6e8e80,_0x16cc82){return function(_0x3b107b){if(_0x3b107b){var _0x453415=typeof _0x16cc82['offset']==='undefined'&&typeof _0x16cc82[_0xa553('0x1d')]==='undefined';var _0x2aea88=_0x3b107b['count'];var _0x5c3c1b=_0x453415?0x0:_0x16cc82[_0xa553('0x1e')];var _0x2d109d=_0x453415?_0x3b107b[_0xa553('0x1f')]:_0x16cc82[_0xa553('0x1e')]+_0x16cc82[_0xa553('0x1d')];var _0x5d0351;if(_0x2d109d>=_0x2aea88){_0x2d109d=_0x2aea88;_0x5d0351=0xc8;}else{_0x5d0351=0xce;}_0x6e8e80[_0xa553('0x1b')](_0x5d0351);return _0x6e8e80['set'](_0xa553('0x20'),_0x5c3c1b+'-'+_0x2d109d+'/'+_0x2aea88)[_0xa553('0x21')](_0x3b107b);}return null;};}function patchUpdates(_0x12624f){return function(_0x27f94b){try{jsonpatch['apply'](_0x27f94b,_0x12624f,!![]);}catch(_0xe923e3){return BPromise[_0xa553('0x22')](_0xe923e3);}return _0x27f94b[_0xa553('0x23')]();};}function saveUpdates(_0x7f4c0,_0x49e282){return function(_0x3ec7e2){if(_0x3ec7e2){return _0x3ec7e2[_0xa553('0x24')](_0x7f4c0)[_0xa553('0x25')](function(_0x3b0aa5){return _0x3b0aa5;});}return null;};}function removeEntity(_0x33088c,_0x13bf73){return function(_0x38b768){if(_0x38b768){return _0x38b768[_0xa553('0x26')]()[_0xa553('0x25')](function(){_0x33088c[_0xa553('0x1b')](0xcc)[_0xa553('0x1c')]();});}};}function handleEntityNotFound(_0x4b89c3,_0xbc227f){return function(_0x558f69){if(!_0x558f69){_0x4b89c3['sendStatus'](0x194);}return _0x558f69;};}function handleError(_0x7594ff,_0xd62036){_0xd62036=_0xd62036||0x1f4;return function(_0x239ccc){logger['error'](_0x239ccc['stack']);if(_0x239ccc[_0xa553('0x27')]){delete _0x239ccc[_0xa553('0x27')];}_0x7594ff['status'](_0xd62036)['send'](_0x239ccc);};}exports[_0xa553('0x28')]=function(_0x5a2c76,_0x5adc7d){var _0x5ecc92={},_0x436311={},_0x1f9482={'count':0x0,'rows':[]};var _0x329692=_[_0xa553('0x29')](db[_0xa553('0x2a')][_0xa553('0x2b')],function(_0x2e6101){return{'name':_0x2e6101[_0xa553('0x2c')],'type':_0x2e6101['type'][_0xa553('0x2d')]};});_0x436311[_0xa553('0x2e')]=_[_0xa553('0x29')](_0x329692,_0xa553('0x27'));_0x436311['query']=_[_0xa553('0x2f')](_0x5a2c76[_0xa553('0x30')]);_0x436311['filters']=_[_0xa553('0x31')](_0x436311['model'],_0x436311['query']);_0x5ecc92[_0xa553('0x32')]=_['intersection'](_0x436311[_0xa553('0x2e')],qs[_0xa553('0x33')](_0x5a2c76['query'][_0xa553('0x33')]));_0x5ecc92[_0xa553('0x32')]=_0x5ecc92[_0xa553('0x32')][_0xa553('0x34')]?_0x5ecc92[_0xa553('0x32')]:_0x436311[_0xa553('0x2e')];if(!_0x5a2c76['query'][_0xa553('0x35')](_0xa553('0x36'))){_0x5ecc92[_0xa553('0x1d')]=qs[_0xa553('0x1d')](_0x5a2c76[_0xa553('0x30')][_0xa553('0x1d')]);_0x5ecc92[_0xa553('0x1e')]=qs[_0xa553('0x1e')](_0x5a2c76['query'][_0xa553('0x1e')]);}_0x5ecc92[_0xa553('0x37')]=qs[_0xa553('0x38')](_0x5a2c76[_0xa553('0x30')][_0xa553('0x38')]);_0x5ecc92[_0xa553('0x39')]=qs[_0xa553('0x3a')](_[_0xa553('0x3b')](_0x5a2c76[_0xa553('0x30')],_0x436311[_0xa553('0x3a')]),_0x329692);if(_0x5a2c76[_0xa553('0x30')][_0xa553('0x3c')]){_0x5ecc92[_0xa553('0x39')]=_[_0xa553('0x3d')](_0x5ecc92[_0xa553('0x39')],{'$or':_['map'](_0x329692,function(_0x2a64f3){if(_0x2a64f3[_0xa553('0x3e')]!=='VIRTUAL'){var _0x3bfcc2={};_0x3bfcc2[_0x2a64f3['name']]={'$like':'%'+_0x5a2c76[_0xa553('0x30')]['filter']+'%'};return _0x3bfcc2;}})});}_0x5ecc92=_[_0xa553('0x3d')]({},_0x5ecc92,_0x5a2c76['options']);var _0x46fe65={'where':_0x5ecc92[_0xa553('0x39')]};return db[_0xa553('0x2a')][_0xa553('0x1f')](_0x46fe65)['then'](function(_0x4d7405){_0x1f9482[_0xa553('0x1f')]=_0x4d7405;if(_0x5a2c76['query'][_0xa553('0x3f')]){_0x5ecc92['include']=[{'all':!![]}];}return db[_0xa553('0x2a')][_0xa553('0x40')](_0x5ecc92);})[_0xa553('0x25')](function(_0x5895d7){_0x1f9482[_0xa553('0x41')]=_0x5895d7;return _0x1f9482;})[_0xa553('0x25')](respondWithFilteredResult(_0x5adc7d,_0x5ecc92))[_0xa553('0x42')](handleError(_0x5adc7d,null));};exports[_0xa553('0x43')]=function(_0x29b33a,_0x18c55c){var _0x1a25df={'raw':!![],'where':{'id':_0x29b33a[_0xa553('0x44')]['id']}},_0x34c12f={};_0x34c12f['model']=_[_0xa553('0x2f')](db[_0xa553('0x2a')][_0xa553('0x2b')]);_0x34c12f['query']=_[_0xa553('0x2f')](_0x29b33a[_0xa553('0x30')]);_0x34c12f['filters']=_[_0xa553('0x31')](_0x34c12f[_0xa553('0x2e')],_0x34c12f[_0xa553('0x30')]);_0x1a25df[_0xa553('0x32')]=_[_0xa553('0x31')](_0x34c12f[_0xa553('0x2e')],qs['fields'](_0x29b33a[_0xa553('0x30')][_0xa553('0x33')]));_0x1a25df['attributes']=_0x1a25df[_0xa553('0x32')][_0xa553('0x34')]?_0x1a25df[_0xa553('0x32')]:_0x34c12f[_0xa553('0x2e')];if(_0x29b33a[_0xa553('0x30')][_0xa553('0x3f')]){_0x1a25df['include']=[{'all':!![]}];}_0x1a25df=_['merge']({},_0x1a25df,_0x29b33a['options']);return db[_0xa553('0x2a')][_0xa553('0x45')](_0x1a25df)[_0xa553('0x25')](handleEntityNotFound(_0x18c55c,null))[_0xa553('0x25')](respondWithResult(_0x18c55c,null))['catch'](handleError(_0x18c55c,null));};exports['create']=function(_0x5299b7,_0x5cfc34){return db[_0xa553('0x2a')][_0xa553('0x46')](_0x5299b7[_0xa553('0x47')],{})[_0xa553('0x25')](respondWithResult(_0x5cfc34,0xc9))[_0xa553('0x42')](handleError(_0x5cfc34,null));};exports['update']=function(_0x35873c,_0x4bc820){if(_0x35873c['body']['id']){delete _0x35873c['body']['id'];}return db[_0xa553('0x2a')][_0xa553('0x45')]({'where':{'id':_0x35873c['params']['id']}})[_0xa553('0x25')](handleEntityNotFound(_0x4bc820,null))[_0xa553('0x25')](saveUpdates(_0x35873c[_0xa553('0x47')],null))['then'](respondWithResult(_0x4bc820,null))['catch'](handleError(_0x4bc820,null));};exports[_0xa553('0x26')]=function(_0xefff08,_0xdd0b15){return db['WhatsappTransferReport'][_0xa553('0x45')]({'where':{'id':_0xefff08[_0xa553('0x44')]['id']}})[_0xa553('0x25')](handleEntityNotFound(_0xdd0b15,null))[_0xa553('0x25')](removeEntity(_0xdd0b15,null))['catch'](handleError(_0xdd0b15,null));};exports[_0xa553('0x48')]=function(_0x4dd893,_0x1881c1){return db['WhatsappTransferReport'][_0xa553('0x48')]()[_0xa553('0x25')](respondWithResult(_0x1881c1,null))[_0xa553('0x42')](handleError(_0x1881c1,null));}; \ No newline at end of file +var _0xd3d2=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','status','error','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache'];(function(_0x4611f7,_0x29f406){var _0x248225=function(_0x57a7f7){while(--_0x57a7f7){_0x4611f7['push'](_0x4611f7['shift']());}};_0x248225(++_0x29f406);}(_0xd3d2,0x96));var _0x2d3d=function(_0x27fd08,_0x5c47f7){_0x27fd08=_0x27fd08-0x0;var _0x1b49b5=_0xd3d2[_0x27fd08];return _0x1b49b5;};'use strict';var emlformat=require(_0x2d3d('0x0'));var rimraf=require(_0x2d3d('0x1'));var zipdir=require(_0x2d3d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d3d('0x3'));var moment=require('moment');var BPromise=require(_0x2d3d('0x4'));var Mustache=require(_0x2d3d('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2d3d('0x6'));var fs=require('fs');var fs_extra=require(_0x2d3d('0x7'));var _=require(_0x2d3d('0x8'));var squel=require(_0x2d3d('0x9'));var crypto=require('crypto');var jsforce=require(_0x2d3d('0xa'));var deskjs=require(_0x2d3d('0xb'));var toCsv=require(_0x2d3d('0xc'));var querystring=require(_0x2d3d('0xd'));var Papa=require(_0x2d3d('0xe'));var Redis=require(_0x2d3d('0xf'));var authService=require(_0x2d3d('0x10'));var qs=require(_0x2d3d('0x11'));var as=require(_0x2d3d('0x12'));var hardwareService=require(_0x2d3d('0x13'));var logger=require(_0x2d3d('0x14'))(_0x2d3d('0x15'));var utils=require(_0x2d3d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2d3d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9bad45,_0xd83e5f){_0xd83e5f=_0xd83e5f||0xcc;return function(_0x2b8bad){if(_0x2b8bad){return _0x9bad45[_0x2d3d('0x18')](_0xd83e5f);}return _0x9bad45['status'](_0xd83e5f)[_0x2d3d('0x19')]();};}function respondWithResult(_0x59eb33,_0x24ce08){_0x24ce08=_0x24ce08||0xc8;return function(_0x2ddb4e){if(_0x2ddb4e){return _0x59eb33['status'](_0x24ce08)[_0x2d3d('0x1a')](_0x2ddb4e);}};}function respondWithFilteredResult(_0x6fd76a,_0xb2b97a){return function(_0x493b50){if(_0x493b50){var _0x741af1=typeof _0xb2b97a[_0x2d3d('0x1b')]===_0x2d3d('0x1c')&&typeof _0xb2b97a[_0x2d3d('0x1d')]===_0x2d3d('0x1c');var _0xf21af2=_0x493b50[_0x2d3d('0x1e')];var _0x3918b6=_0x741af1?0x0:_0xb2b97a[_0x2d3d('0x1b')];var _0xcfe9f5=_0x741af1?_0x493b50[_0x2d3d('0x1e')]:_0xb2b97a[_0x2d3d('0x1b')]+_0xb2b97a[_0x2d3d('0x1d')];var _0x183309;if(_0xcfe9f5>=_0xf21af2){_0xcfe9f5=_0xf21af2;_0x183309=0xc8;}else{_0x183309=0xce;}_0x6fd76a['status'](_0x183309);return _0x6fd76a[_0x2d3d('0x1f')](_0x2d3d('0x20'),_0x3918b6+'-'+_0xcfe9f5+'/'+_0xf21af2)[_0x2d3d('0x1a')](_0x493b50);}return null;};}function patchUpdates(_0x54c8ab){return function(_0x3a0e12){try{jsonpatch[_0x2d3d('0x21')](_0x3a0e12,_0x54c8ab,!![]);}catch(_0xd9387d){return BPromise['reject'](_0xd9387d);}return _0x3a0e12[_0x2d3d('0x22')]();};}function saveUpdates(_0x2705c1,_0x2bee6a){return function(_0x221471){if(_0x221471){return _0x221471['update'](_0x2705c1)[_0x2d3d('0x23')](function(_0x1a7718){return _0x1a7718;});}return null;};}function removeEntity(_0x3746d1,_0xb4d89){return function(_0x554c0b){if(_0x554c0b){return _0x554c0b[_0x2d3d('0x24')]()['then'](function(){_0x3746d1[_0x2d3d('0x25')](0xcc)[_0x2d3d('0x19')]();});}};}function handleEntityNotFound(_0x52464d,_0x581c26){return function(_0x422e38){if(!_0x422e38){_0x52464d[_0x2d3d('0x18')](0x194);}return _0x422e38;};}function handleError(_0x3aae8d,_0x4b42eb){_0x4b42eb=_0x4b42eb||0x1f4;return function(_0x533887){logger[_0x2d3d('0x26')](_0x533887[_0x2d3d('0x27')]);if(_0x533887[_0x2d3d('0x28')]){delete _0x533887['name'];}_0x3aae8d[_0x2d3d('0x25')](_0x4b42eb)[_0x2d3d('0x29')](_0x533887);};}exports[_0x2d3d('0x2a')]=function(_0x5dd73e,_0x3fc196){var _0x39e192={},_0x5bd3b7={},_0x2a10c7={'count':0x0,'rows':[]};var _0x2fae55=_[_0x2d3d('0x2b')](db[_0x2d3d('0x2c')][_0x2d3d('0x2d')],function(_0x2dec22){return{'name':_0x2dec22[_0x2d3d('0x2e')],'type':_0x2dec22[_0x2d3d('0x2f')][_0x2d3d('0x30')]};});_0x5bd3b7[_0x2d3d('0x31')]=_[_0x2d3d('0x2b')](_0x2fae55,_0x2d3d('0x28'));_0x5bd3b7[_0x2d3d('0x32')]=_['keys'](_0x5dd73e[_0x2d3d('0x32')]);_0x5bd3b7[_0x2d3d('0x33')]=_['intersection'](_0x5bd3b7[_0x2d3d('0x31')],_0x5bd3b7['query']);_0x39e192[_0x2d3d('0x34')]=_['intersection'](_0x5bd3b7[_0x2d3d('0x31')],qs[_0x2d3d('0x35')](_0x5dd73e['query'][_0x2d3d('0x35')]));_0x39e192[_0x2d3d('0x34')]=_0x39e192[_0x2d3d('0x34')][_0x2d3d('0x36')]?_0x39e192[_0x2d3d('0x34')]:_0x5bd3b7[_0x2d3d('0x31')];if(!_0x5dd73e['query'][_0x2d3d('0x37')](_0x2d3d('0x38'))){_0x39e192[_0x2d3d('0x1d')]=qs[_0x2d3d('0x1d')](_0x5dd73e[_0x2d3d('0x32')][_0x2d3d('0x1d')]);_0x39e192['offset']=qs[_0x2d3d('0x1b')](_0x5dd73e['query']['offset']);}_0x39e192[_0x2d3d('0x39')]=qs[_0x2d3d('0x3a')](_0x5dd73e['query'][_0x2d3d('0x3a')]);_0x39e192[_0x2d3d('0x3b')]=qs[_0x2d3d('0x33')](_[_0x2d3d('0x3c')](_0x5dd73e[_0x2d3d('0x32')],_0x5bd3b7[_0x2d3d('0x33')]),_0x2fae55);if(_0x5dd73e[_0x2d3d('0x32')][_0x2d3d('0x3d')]){_0x39e192[_0x2d3d('0x3b')]=_[_0x2d3d('0x3e')](_0x39e192[_0x2d3d('0x3b')],{'$or':_[_0x2d3d('0x2b')](_0x2fae55,function(_0x563195){if(_0x563195[_0x2d3d('0x2f')]!==_0x2d3d('0x3f')){var _0x346a22={};_0x346a22[_0x563195[_0x2d3d('0x28')]]={'$like':'%'+_0x5dd73e[_0x2d3d('0x32')][_0x2d3d('0x3d')]+'%'};return _0x346a22;}})});}_0x39e192=_[_0x2d3d('0x3e')]({},_0x39e192,_0x5dd73e['options']);var _0x4cf0b4={'where':_0x39e192[_0x2d3d('0x3b')]};return db[_0x2d3d('0x2c')][_0x2d3d('0x1e')](_0x4cf0b4)[_0x2d3d('0x23')](function(_0x18c4bc){_0x2a10c7[_0x2d3d('0x1e')]=_0x18c4bc;if(_0x5dd73e[_0x2d3d('0x32')][_0x2d3d('0x40')]){_0x39e192[_0x2d3d('0x41')]=[{'all':!![]}];}return db[_0x2d3d('0x2c')][_0x2d3d('0x42')](_0x39e192);})[_0x2d3d('0x23')](function(_0x4c8d1c){_0x2a10c7[_0x2d3d('0x43')]=_0x4c8d1c;return _0x2a10c7;})[_0x2d3d('0x23')](respondWithFilteredResult(_0x3fc196,_0x39e192))[_0x2d3d('0x44')](handleError(_0x3fc196,null));};exports[_0x2d3d('0x45')]=function(_0x19525c,_0x428ec0){var _0x517eb1={'raw':!![],'where':{'id':_0x19525c[_0x2d3d('0x46')]['id']}},_0x1834ad={};_0x1834ad[_0x2d3d('0x31')]=_['keys'](db['WhatsappTransferReport']['rawAttributes']);_0x1834ad[_0x2d3d('0x32')]=_[_0x2d3d('0x47')](_0x19525c[_0x2d3d('0x32')]);_0x1834ad[_0x2d3d('0x33')]=_['intersection'](_0x1834ad['model'],_0x1834ad[_0x2d3d('0x32')]);_0x517eb1['attributes']=_[_0x2d3d('0x48')](_0x1834ad[_0x2d3d('0x31')],qs[_0x2d3d('0x35')](_0x19525c[_0x2d3d('0x32')][_0x2d3d('0x35')]));_0x517eb1[_0x2d3d('0x34')]=_0x517eb1[_0x2d3d('0x34')][_0x2d3d('0x36')]?_0x517eb1['attributes']:_0x1834ad[_0x2d3d('0x31')];if(_0x19525c[_0x2d3d('0x32')][_0x2d3d('0x40')]){_0x517eb1[_0x2d3d('0x41')]=[{'all':!![]}];}_0x517eb1=_[_0x2d3d('0x3e')]({},_0x517eb1,_0x19525c['options']);return db[_0x2d3d('0x2c')][_0x2d3d('0x49')](_0x517eb1)[_0x2d3d('0x23')](handleEntityNotFound(_0x428ec0,null))[_0x2d3d('0x23')](respondWithResult(_0x428ec0,null))[_0x2d3d('0x44')](handleError(_0x428ec0,null));};exports[_0x2d3d('0x4a')]=function(_0x1b2695,_0x40e864){return db['WhatsappTransferReport']['create'](_0x1b2695['body'],{})[_0x2d3d('0x23')](respondWithResult(_0x40e864,0xc9))[_0x2d3d('0x44')](handleError(_0x40e864,null));};exports[_0x2d3d('0x4b')]=function(_0xd620fe,_0xb79ac6){if(_0xd620fe[_0x2d3d('0x4c')]['id']){delete _0xd620fe['body']['id'];}return db[_0x2d3d('0x2c')][_0x2d3d('0x49')]({'where':{'id':_0xd620fe[_0x2d3d('0x46')]['id']}})['then'](handleEntityNotFound(_0xb79ac6,null))[_0x2d3d('0x23')](saveUpdates(_0xd620fe[_0x2d3d('0x4c')],null))['then'](respondWithResult(_0xb79ac6,null))[_0x2d3d('0x44')](handleError(_0xb79ac6,null));};exports['destroy']=function(_0x4f96b2,_0x3247a1){return db[_0x2d3d('0x2c')][_0x2d3d('0x49')]({'where':{'id':_0x4f96b2[_0x2d3d('0x46')]['id']}})['then'](handleEntityNotFound(_0x3247a1,null))[_0x2d3d('0x23')](removeEntity(_0x3247a1,null))[_0x2d3d('0x44')](handleError(_0x3247a1,null));};exports[_0x2d3d('0x4d')]=function(_0x830011,_0x3a2b82){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x3a2b82,null))[_0x2d3d('0x44')](handleError(_0x3a2b82,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 29adab4..e1ae004 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 _0x323e=['bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x323e,0x1a0));var _0xe323=function(_0x7af1a1,_0xfee683){_0x7af1a1=_0x7af1a1-0x0;var _0x3f57ac=_0x323e[_0x7af1a1];return _0x3f57ac;};'use strict';var _=require(_0xe323('0x0'));var util=require('util');var logger=require(_0xe323('0x1'))(_0xe323('0x2'));var moment=require(_0xe323('0x3'));var BPromise=require(_0xe323('0x4'));var rp=require(_0xe323('0x5'));var fs=require('fs');var path=require(_0xe323('0x6'));var rimraf=require(_0xe323('0x7'));var config=require('../../config/environment');var attributes=require(_0xe323('0x8'));module[_0xe323('0x9')]=function(_0x480183,_0x517876){return _0x480183[_0xe323('0xa')](_0xe323('0xb'),attributes,{'tableName':_0xe323('0xc'),'paranoid':![],'indexes':[{'name':_0xe323('0xd'),'fields':[_0xe323('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ad1=['rimraf','../../config/environment','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x33de32,_0x25aaa8){var _0x272a69=function(_0x2ed85e){while(--_0x2ed85e){_0x33de32['push'](_0x33de32['shift']());}};_0x272a69(++_0x25aaa8);}(_0x6ad1,0x185));var _0x16ad=function(_0xb5c68c,_0x17efc7){_0xb5c68c=_0xb5c68c-0x0;var _0x76af76=_0x6ad1[_0xb5c68c];return _0x76af76;};'use strict';var _=require(_0x16ad('0x0'));var util=require(_0x16ad('0x1'));var logger=require(_0x16ad('0x2'))(_0x16ad('0x3'));var moment=require(_0x16ad('0x4'));var BPromise=require('bluebird');var rp=require(_0x16ad('0x5'));var fs=require('fs');var path=require(_0x16ad('0x6'));var rimraf=require(_0x16ad('0x7'));var config=require(_0x16ad('0x8'));var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x3c956e,_0x964c52){return _0x3c956e[_0x16ad('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x16ad('0xa'),'paranoid':![],'indexes':[{'name':_0x16ad('0xb'),'fields':[_0x16ad('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 0f0778e..76f69bf 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 _0xcc6f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','then','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x4ba001,_0x46b3ae){var _0x488623=function(_0x222e8d){while(--_0x222e8d){_0x4ba001['push'](_0x4ba001['shift']());}};_0x488623(++_0x46b3ae);}(_0xcc6f,0x10f));var _0xfcc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc6f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfcc6('0x0'));var util=require(_0xfcc6('0x1'));var moment=require(_0xfcc6('0x2'));var BPromise=require(_0xfcc6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcc6('0x4'));var db=require(_0xfcc6('0x5'))['db'];var utils=require(_0xfcc6('0x6'));var logger=require(_0xfcc6('0x7'))(_0xfcc6('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x35b186,_0x5a703a,_0xc8a708){return new BPromise(function(_0x13ceb6,_0x4b65e8){return client['request'](_0x35b186,_0xc8a708)[_0xfcc6('0x9')](function(_0x43c42c){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x5a703a,_0xfcc6('0xa'));logger[_0xfcc6('0xb')](_0xfcc6('0xc'),_0x5a703a,'request\x20sent',JSON[_0xfcc6('0xd')](_0x43c42c));if(_0x43c42c[_0xfcc6('0xe')]){if(_0x43c42c['error'][_0xfcc6('0xf')]===0x1f4){logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x43c42c['error']['message']);return _0x4b65e8(_0x43c42c['error'][_0xfcc6('0x11')]);}logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x43c42c[_0xfcc6('0xe')]['message']);return _0x13ceb6(_0x43c42c[_0xfcc6('0xe')][_0xfcc6('0x11')]);}else{logger[_0xfcc6('0x12')](_0xfcc6('0x10'),_0x5a703a,'request\x20sent');_0x13ceb6(_0x43c42c[_0xfcc6('0x13')][_0xfcc6('0x11')]);}})[_0xfcc6('0x14')](function(_0x233db3){logger[_0xfcc6('0xe')](_0xfcc6('0x10'),_0x5a703a,_0x233db3);_0x4b65e8(_0x233db3);});});} \ No newline at end of file +var _0xc76c=['then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request'];(function(_0x278134,_0x29efd8){var _0x58ef9a=function(_0x1434f6){while(--_0x1434f6){_0x278134['push'](_0x278134['shift']());}};_0x58ef9a(++_0x29efd8);}(_0xc76c,0x19a));var _0xcc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcc76('0x0'));var util=require(_0xcc76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc76('0x2'));var fs=require('fs');var Redis=require(_0xcc76('0x3'));var db=require(_0xcc76('0x4'))['db'];var utils=require(_0xcc76('0x5'));var logger=require('../../config/logger')(_0xcc76('0x6'));var config=require(_0xcc76('0x7'));var jayson=require(_0xcc76('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x37787e,_0x50c36e,_0x5f3715){return new BPromise(function(_0x34c609,_0x58476c){return client[_0xcc76('0x9')](_0x37787e,_0x5f3715)[_0xcc76('0xa')](function(_0x18a2d8){logger['info'](_0xcc76('0xb'),_0x50c36e,_0xcc76('0xc'));logger[_0xcc76('0xd')](_0xcc76('0xe'),_0x50c36e,_0xcc76('0xc'),JSON[_0xcc76('0xf')](_0x18a2d8));if(_0x18a2d8[_0xcc76('0x10')]){if(_0x18a2d8[_0xcc76('0x10')]['code']===0x1f4){logger['error'](_0xcc76('0xb'),_0x50c36e,_0x18a2d8[_0xcc76('0x10')][_0xcc76('0x11')]);return _0x58476c(_0x18a2d8[_0xcc76('0x10')][_0xcc76('0x11')]);}logger[_0xcc76('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x50c36e,_0x18a2d8['error'][_0xcc76('0x11')]);return _0x34c609(_0x18a2d8['error'][_0xcc76('0x11')]);}else{logger[_0xcc76('0x12')](_0xcc76('0xb'),_0x50c36e,_0xcc76('0xc'));_0x34c609(_0x18a2d8[_0xcc76('0x13')][_0xcc76('0x11')]);}})[_0xcc76('0x14')](function(_0x43977d){logger[_0xcc76('0x10')](_0xcc76('0xb'),_0x50c36e,_0x43977d);_0x58476c(_0x43977d);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index ceab123..e23104a 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x806b=['filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','Offline\x20apps:','status','join','None','log','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/cloud-provider','sequelize','then','seedDB','default','info','start'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x806b,0x163));var _0xb806=function(_0x4ceed5,_0x298aa4){_0x4ceed5=_0x4ceed5-0x0;var _0x18bc6d=_0x806b[_0x4ceed5];return _0x18bc6d;};'use strict';var _=require(_0xb806('0x0'));var db=require(_0xb806('0x1'))['db'];var seedDb=require(_0xb806('0x2'));var checkLicense=require(_0xb806('0x3'));var rpc=require(_0xb806('0x4'));var config=require(_0xb806('0x5'));var logger=require(_0xb806('0x6'))(_0xb806('0x7'));var pm2=require('./config/pm2');var pm2Config=require(_0xb806('0x8'));var schedule=require(_0xb806('0x9'));var chat=require(_0xb806('0xa'));var whatsapp=require(_0xb806('0xb'));var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb806('0xc'));function main(){return db[_0xb806('0xd')]['sync']()[_0xb806('0xe')](function(){if(config[_0xb806('0xf')]){return seedDb[_0xb806('0x10')]();}})[_0xb806('0xe')](function(){return checkLicense['default']();})[_0xb806('0xe')](function(){return rpc['listen']();})[_0xb806('0xe')](function(_0x4cd6b4){logger[_0xb806('0x11')](_0x4cd6b4);return chat['start']();})[_0xb806('0xe')](function(){return whatsapp[_0xb806('0x12')]();})[_0xb806('0xe')](function(){return schedule['start']();})[_0xb806('0xe')](function(){return transcribe[_0xb806('0x12')]();})['then'](function(){return provider[_0xb806('0x12')]();})[_0xb806('0xe')](function(_0x5d08f8){logger[_0xb806('0x11')](_0x5d08f8);return pm2[_0xb806('0x12')](pm2Config);})['then'](function(_0x282777){var _0xede757=_0x282777[_0xb806('0x13')](function(_0x1a3258){return typeof _0x1a3258[_0xb806('0x14')]==='number'&&_0x1a3258['exitCode']>=0x0;});if(_0xede757[_0xb806('0x15')]>0x0){throw new Error(_0xede757['length']+_0xb806('0x16')+_[_0xb806('0x17')](_0xede757,function(_0x2fd643){return'\x22'+_0x2fd643[_0xb806('0x18')]['name']+'\x22';}));}logger[_0xb806('0x11')](_0xb806('0x19'),_[_0xb806('0x17')](_[_0xb806('0x13')](_0x282777,{'status':_0xb806('0x1a')}),_0xb806('0x1b'))['join']());logger[_0xb806('0x11')](_0xb806('0x1c'),_['map'](_[_0xb806('0x13')](_0x282777,function(_0x2dbb8a){return _0x2dbb8a[_0xb806('0x1d')]!==_0xb806('0x1a');}),'name')[_0xb806('0x1e')]()||_0xb806('0x1f'));console[_0xb806('0x20')]('App\x20Ready!');})['catch'](function(_0x41ffe5){console[_0xb806('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x41ffe5);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x41ffe5);process[_0xb806('0x21')](0x1);});}main(); \ No newline at end of file +var _0x1b20=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','then','default','listen','info','start','exitCode','number','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0xbf5624,_0x306236){var _0x390b36=function(_0x36dfc0){while(--_0x36dfc0){_0xbf5624['push'](_0xbf5624['shift']());}};_0x390b36(++_0x306236);}(_0x1b20,0x66));var _0x01b2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1b20[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var db=require(_0x01b2('0x0'))['db'];var seedDb=require(_0x01b2('0x1'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x01b2('0x2'));var logger=require(_0x01b2('0x3'))(_0x01b2('0x4'));var pm2=require(_0x01b2('0x5'));var pm2Config=require(_0x01b2('0x6'));var schedule=require(_0x01b2('0x7'));var chat=require(_0x01b2('0x8'));var whatsapp=require(_0x01b2('0x9'));var transcribe=require(_0x01b2('0xa'));var provider=require(_0x01b2('0xb'));function main(){return db[_0x01b2('0xc')][_0x01b2('0xd')]()['then'](function(){if(config[_0x01b2('0xe')]){return seedDb['default']();}})[_0x01b2('0xf')](function(){return checkLicense[_0x01b2('0x10')]();})[_0x01b2('0xf')](function(){return rpc[_0x01b2('0x11')]();})[_0x01b2('0xf')](function(_0x2e79e5){logger[_0x01b2('0x12')](_0x2e79e5);return chat[_0x01b2('0x13')]();})['then'](function(){return whatsapp[_0x01b2('0x13')]();})['then'](function(){return schedule[_0x01b2('0x13')]();})['then'](function(){return transcribe[_0x01b2('0x13')]();})[_0x01b2('0xf')](function(){return provider[_0x01b2('0x13')]();})[_0x01b2('0xf')](function(_0x578477){logger[_0x01b2('0x12')](_0x578477);return pm2[_0x01b2('0x13')](pm2Config);})[_0x01b2('0xf')](function(_0x1626ba){var _0x3bb071=_0x1626ba['filter'](function(_0x299d0c){return typeof _0x299d0c[_0x01b2('0x14')]===_0x01b2('0x15')&&_0x299d0c[_0x01b2('0x14')]>=0x0;});if(_0x3bb071['length']>0x0){throw new Error(_0x3bb071['length']+_0x01b2('0x16')+_[_0x01b2('0x17')](_0x3bb071,function(_0x588dbe){return'\x22'+_0x588dbe[_0x01b2('0x18')][_0x01b2('0x19')]+'\x22';}));}logger[_0x01b2('0x12')]('Online\x20apps:',_[_0x01b2('0x17')](_[_0x01b2('0x1a')](_0x1626ba,{'status':_0x01b2('0x1b')}),_0x01b2('0x19'))[_0x01b2('0x1c')]());logger['info'](_0x01b2('0x1d'),_['map'](_[_0x01b2('0x1a')](_0x1626ba,function(_0x4c0008){return _0x4c0008[_0x01b2('0x1e')]!==_0x01b2('0x1b');}),_0x01b2('0x19'))['join']()||_0x01b2('0x1f'));console[_0x01b2('0x20')](_0x01b2('0x21'));})[_0x01b2('0x22')](function(_0x4ce810){console['log'](_0x01b2('0x23'),_0x4ce810);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x4ce810);process[_0x01b2('0x24')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index e01898b..48d9cd2 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 _0xb43b=['headers','then','authenticate','pass','status','Wrong\x20credentials.','user','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','find','sub','allowedLoginAttempts','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','blockDuration','blockedAt','minutes','User\x20object\x20not\x20found.','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','redirect','/dashboards/general','apiKeyNonce','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','promisify','sign','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','crypto','moment','session','role','fullname','name','internal','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarPrefixRequired','phoneBarRemoteControl','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','whatsappAutoanswer','isChatInteractionAuthorized','use','ChatInteraction','findOne','params','closed','disposition','unmanaged','json','Forbidden.','catch','isAuthenticated','authorization','startsWith'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3b2f67,_0x3d2f7c){_0x3b2f67=_0x3b2f67-0x0;var _0x6c5564=_0xb43b[_0x3b2f67];return _0x6c5564;};'use strict';var db=require(_0xbb43('0x0'))['db'];var config=require(_0xbb43('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xbb43('0x2'));var encryptor=require(_0xbb43('0x3'));var _=require(_0xbb43('0x4'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xbb43('0x5'));var compose=require(_0xbb43('0x6'));var basicAuth=require(_0xbb43('0x7'));var crypto=require(_0xbb43('0x8'));var BPromise=require('bluebird');var util=require('util');var moment=require(_0xbb43('0x9'));var validateJwt=expressJwt({'secret':config['secrets'][_0xbb43('0xa')]});var userAttributes=['id',_0xbb43('0xb'),_0xbb43('0xc'),_0xbb43('0xd'),_0xbb43('0xe'),'email',_0xbb43('0xf'),_0xbb43('0x10'),'md5secret',_0xbb43('0x11'),_0xbb43('0x12'),_0xbb43('0x13'),_0xbb43('0x14'),_0xbb43('0x15'),_0xbb43('0x16'),'pauseType',_0xbb43('0x17'),_0xbb43('0x18'),'lastPauseAt','crudPermissions',_0xbb43('0x19'),'passwordResetAt','alias',_0xbb43('0x1a'),'phoneBarAutoAnswerDelay',_0xbb43('0x1b'),_0xbb43('0x1c'),'phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires',_0xbb43('0x1d'),_0xbb43('0x1e'),'phoneBarRemoteControlPort','hotdesk',_0xbb43('0x1f'),'userProfileId','privacyEnabled',_0xbb43('0x20'),_0xbb43('0x21'),_0xbb43('0x22'),'downloadOmnichannelInteractions',_0xbb43('0x23'),'ignorePauseForPreviewCalls',_0xbb43('0x24'),_0xbb43('0x25'),'chatAutoanswerDelay','emailAutoanswer',_0xbb43('0x26'),_0xbb43('0x27'),_0xbb43('0x28'),_0xbb43('0x29'),'openchannelAutoanswerDelay',_0xbb43('0x2a'),'faxAutoanswerDelay',_0xbb43('0x2b'),'whatsappAutoanswerDelay'];exports[_0xbb43('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xbb43('0x2d')](function(_0x451cbd,_0x577ddd,_0x1d0768){if(_0x451cbd['user']){_0x1d0768();}else{return db[_0xbb43('0x2e')][_0xbb43('0x2f')]({'where':{'id':_0x451cbd[_0xbb43('0x30')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})['then'](function(_0x269ca5){if(_0x269ca5&&_0x269ca5[_0xbb43('0x31')]){return _0x577ddd['status'](_0x269ca5[_0xbb43('0x32')]===_0xbb43('0x33')?0x195:0x193)[_0xbb43('0x34')]({'message':_0x269ca5[_0xbb43('0x32')]==='unmanaged'?'Unmanaged.':_0xbb43('0x35')});}else{_0x1d0768();}})[_0xbb43('0x36')](function(_0xa88db0){_0x1d0768(_0xa88db0);});}});};exports[_0xbb43('0x37')]=function isAuthenticated(_0x510b05){return compose()[_0xbb43('0x2d')](function(_0x21d386,_0x473828,_0x539730){var _0x2ad6da;if(_0x21d386['headers'][_0xbb43('0x38')]){if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],'Basic')){var _0x157d62=basicAuth(_0x21d386);db['User']['find']({'where':{'name':_0x157d62['name']}})[_0xbb43('0x3b')](function(_0x573a05){if(!_0x573a05||!_0x573a05[_0xbb43('0x3c')](_0x157d62[_0xbb43('0x3d')])){return _0x473828[_0xbb43('0x3e')](0x191)['json']({'message':_0xbb43('0x3f')});}_0x21d386[_0xbb43('0x40')]={'id':_0x573a05['id']};_0x539730();})[_0xbb43('0x36')](function(_0xd987fa){_0x539730(_0xd987fa);});}else if(_[_0xbb43('0x39')](_0x21d386[_0xbb43('0x3a')][_0xbb43('0x38')],_0xbb43('0x41'))){validateJwt(_0x21d386,_0x473828,_0x539730);}else{if(_0x510b05){_0x539730();}else{return _0x473828['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}}}else if(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')]){try{var _0x4015ec={'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf[_0xbb43('0x45')]()};verifyJwt(_0x21d386[_0xbb43('0x43')][_0xbb43('0x44')],_0x4015ec)[_0xbb43('0x3b')](function(_0x21346a){return db[_0xbb43('0x46')][_0xbb43('0x47')]({'where':{'id':_0x21346a[_0xbb43('0x48')]}})[_0xbb43('0x3b')](function(_0x405f36){_0x2ad6da=_0x405f36;return db['Setting'][_0xbb43('0x2f')]({'where':{'id':0x1},'attributes':[_0xbb43('0x49'),'blockDuration'],'raw':!![]});})[_0xbb43('0x3b')](function(_0x2c9a7c){if(!_0x2ad6da||!_[_0xbb43('0x4a')](_0x2ad6da['apiKeyNonce'],_0x21346a['nonce'])){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4b')});}if(_0x2ad6da['disabled']){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}if(_0x2ad6da[_0xbb43('0x4d')]){if(_0x2c9a7c[_0xbb43('0x4e')]>0x0){if(moment(_0x2ad6da[_0xbb43('0x4f')])['add'](_0x2c9a7c[_0xbb43('0x4e')],_0xbb43('0x50'))>moment()){return _0x473828[_0xbb43('0x3e')](0x191)[_0xbb43('0x34')]({'message':_0xbb43('0x4c')});}}else{return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x21d386[_0xbb43('0x40')]={'id':_0x2ad6da['id']};_0x539730();});})[_0xbb43('0x36')](function(){return _0x473828['status'](0x191)[_0xbb43('0x34')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1fcf64){_0x539730(_0x1fcf64);}}else if(_0x510b05){_0x539730();}else{return _0x473828[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x42')});}})['use'](function(_0x3e0871,_0x136bd4,_0x59750b){if(_0x3e0871[_0xbb43('0x40')]){db['User'][_0xbb43('0x47')]({'where':{'id':_0x3e0871[_0xbb43('0x40')]['id']},'attributes':userAttributes})[_0xbb43('0x3b')](function(_0x14e57e){if(!_0x14e57e){return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':'User\x20not\x20found.'});}_0x3e0871[_0xbb43('0x40')]=_0x14e57e;_0x59750b();})['catch'](function(_0x307f1e){_0x59750b(_0x307f1e);});}else if(_0x510b05){_0x59750b();}else{return _0x136bd4[_0xbb43('0x3e')](0x194)[_0xbb43('0x34')]({'message':_0xbb43('0x51')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xbb43('0x2d')](function(_0x39f75f,_0x4bc351,_0x24ba15){return licenseUtil[_0xbb43('0x52')]()[_0xbb43('0x3b')](function(_0x40f519){if(_0x40f519[_0xbb43('0x53')]){_0x24ba15();}else{return _0x4bc351['status'](0x193)[_0xbb43('0x34')]({'message':_0xbb43('0x54')});}})['catch'](function(_0x1a66f0){_0x24ba15(_0x1a66f0);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x4d7034,_0x5e2e6d,_0x1c3482){return licenseUtil['getLicense']()[_0xbb43('0x3b')](function(_0x5e5c86){if(_0x5e5c86[_0xbb43('0x55')]){_0x1c3482();}else{return _0x5e2e6d[_0xbb43('0x3e')](0x193)[_0xbb43('0x34')]({'message':'Forbidden'});}})[_0xbb43('0x36')](function(_0x4d9f18){_0x1c3482(_0x4d9f18);});});};exports[_0xbb43('0x56')]=function(_0x2518bf,_0xd43d24,_0x29840e){_0x2518bf[_0xbb43('0x56')]=!![];return _0x29840e();};exports[_0xbb43('0x57')]=function signToken(_0x37d8d3){return signJwt(_0x37d8d3);};exports['setTokenCookie']=function(_0x93f6e7,_0x26ea59){if(!_0x93f6e7[_0xbb43('0x40')]){return _0x26ea59[_0xbb43('0x3e')](0x194)['json']({'message':_0xbb43('0x58')});}var _0x3233b7={'payload':{'id':_0x93f6e7[_0xbb43('0x40')]['id'],'role':_0x93f6e7[_0xbb43('0x40')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3233b7)[_0xbb43('0x3b')](function(_0x3fdb10){_0x26ea59[_0xbb43('0x59')]('motion.token',_0x3fdb10);_0x26ea59[_0xbb43('0x5a')](_0xbb43('0x5b'));})[_0xbb43('0x36')](function(_0x1dc40a){return _0x26ea59[_0xbb43('0x3e')](0x1f4)['send'](_0x1dc40a);});};exports['retrieveApiKey']=function(_0xb44557){if(_['isNil'](_0xb44557[_0xbb43('0x5c')])||_[_0xbb43('0x5d')](_0xb44557['apiKeyIat'])){return null;}else{return createJwt(_0xb44557);}};exports[_0xbb43('0x5e')]=function(_0x3719dc){_0x3719dc[_0xbb43('0x5c')]=generateNonce();_0x3719dc[_0xbb43('0x5f')]=generateIssuedAt();return createJwt(_0x3719dc);};exports[_0xbb43('0x60')]=function(_0x5cb3c6,_0x124f88){var _0x539ffc=_0x5cb3c6['query'][_0xbb43('0x44')];if(_0x539ffc){var _0x1b9307={'nonce':_0x124f88[_0xbb43('0x5c')],'iat':_0x124f88[_0xbb43('0x5f')],'audience':hardwareConf[_0xbb43('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x539ffc,_0x1b9307)['then'](function(){return generateApiKey(_0x124f88);});}else{throw{'message':_0xbb43('0x61')};}};exports[_0xbb43('0x62')]=function(_0x3a84ad){var _0x308646=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x308646[_0xbb43('0x63')](_0x3a84ad))throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0xbb43('0x66'));return;};exports[_0xbb43('0x67')]=function(_0x578b85,_0x1b6f96,_0xb996d7){var _0x432bd8=encryptor[_0xbb43('0x68')](_0x1b6f96)[_0xbb43('0x69')](',');for(var _0x1fae27=0x0;_0x1fae27<_0xb996d7;_0x1fae27++){if(!_0x432bd8[_0x1fae27])break;if(_0x578b85[_0xbb43('0x6a')]()===_0x432bd8[_0x1fae27][_0xbb43('0x6a')]()){var _0x3e01e4=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xb996d7);if(_0xb996d7===0x1){_0x3e01e4=_0xbb43('0x6b');}throw new db[(_0xbb43('0x64'))][(_0xbb43('0x65'))](_0x3e01e4);}}return;};exports[_0xbb43('0x6c')]=function(_0x38814a,_0x19e27e){var _0x2e01fb=_0x19e27e?encryptor['decryptString'](_0x19e27e)[_0xbb43('0x69')](','):[];if(_0x2e01fb['length']===0x5){_0x2e01fb['splice'](-0x1,0x1);}_0x2e01fb[_0xbb43('0x6d')](_0x38814a);return encryptor[_0xbb43('0x6e')](_0x2e01fb[_0xbb43('0x6f')](','));};function signJwt(_0x22ce17){var _0x24393a=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x71')],{'context':jwt});var _0x341481=_0x22ce17['secret']||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0x2b96b8,_0x137e75){_0x24393a(_0x22ce17[_0xbb43('0x72')],_0x341481,_0x22ce17[_0xbb43('0x73')])[_0xbb43('0x3b')](function(_0x12717e){_0x2b96b8(_0x12717e);})[_0xbb43('0x36')](function(_0x3ca6ad){_0x137e75(_0x3ca6ad);});});}function verifyJwt(_0x555426,_0x165936,_0x392d1a){var _0x234bc7=BPromise[_0xbb43('0x70')](jwt[_0xbb43('0x74')],{'context':jwt});var _0x33a4db=_0x392d1a||config['secrets'][_0xbb43('0xa')];return new BPromise(function(_0xb48be2,_0x42e437){_0x234bc7(_0x555426,_0x33a4db,_0x165936)[_0xbb43('0x3b')](function(_0xc34a02){_0xb48be2(_0xc34a02);})['catch'](function(_0x3c260f){_0x42e437(_0x3c260f);});});}function generateNonce(){return crypto[_0xbb43('0x75')](0x10)[_0xbb43('0x76')](_0xbb43('0x77'));}function generateIssuedAt(){return Math[_0xbb43('0x78')](Date[_0xbb43('0x79')]()/0x3e8)[_0xbb43('0x76')]();}function createJwt(_0x2992ea){var _0x10fd8b={'payload':{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce']},'options':{'algorithm':_0xbb43('0x7a'),'subject':_0x2992ea['id']['toString'](),'issuer':hardwareConf[_0xbb43('0x45')](),'audience':hardwareConf[_0xbb43('0x45')]()}};return signJwt(_0x10fd8b)[_0xbb43('0x3b')](function(_0x3dbcd9){return{'iat':_0x2992ea[_0xbb43('0x5f')],'nonce':_0x2992ea['apiKeyNonce'],'token':_0x3dbcd9};});} \ No newline at end of file +var _0x9bde=['whatsappAutoanswerDelay','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','User','find','authenticate','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','send','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','unshift','encryptString','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','HS512','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3def7c,_0x2b8d98){_0x3def7c=_0x3def7c-0x0;var _0x11458f=_0x9bde[_0x3def7c];return _0x11458f;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xe9bd('0x0'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0xe9bd('0x1'));var encryptor=require('../encryptor');var _=require(_0xe9bd('0x2'));var jwt=require(_0xe9bd('0x3'));var expressJwt=require(_0xe9bd('0x4'));var compose=require(_0xe9bd('0x5'));var basicAuth=require(_0xe9bd('0x6'));var crypto=require(_0xe9bd('0x7'));var BPromise=require(_0xe9bd('0x8'));var util=require('util');var moment=require(_0xe9bd('0x9'));var validateJwt=expressJwt({'secret':config[_0xe9bd('0xa')][_0xe9bd('0xb')]});var userAttributes=['id',_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf'),_0xe9bd('0x10'),_0xe9bd('0x11'),_0xe9bd('0x12'),'md5secret','voicePause',_0xe9bd('0x13'),_0xe9bd('0x14'),_0xe9bd('0x15'),'smsPause',_0xe9bd('0x16'),_0xe9bd('0x17'),_0xe9bd('0x18'),_0xe9bd('0x19'),'lastPauseAt',_0xe9bd('0x1a'),'allowmessenger',_0xe9bd('0x1b'),_0xe9bd('0x1c'),_0xe9bd('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0xe9bd('0x1e'),_0xe9bd('0x1f'),_0xe9bd('0x20'),_0xe9bd('0x21'),_0xe9bd('0x22'),_0xe9bd('0x23'),_0xe9bd('0x24'),'hotdesk',_0xe9bd('0x25'),_0xe9bd('0x26'),_0xe9bd('0x27'),'settingsEnabled',_0xe9bd('0x28'),_0xe9bd('0x29'),_0xe9bd('0x2a'),_0xe9bd('0x2b'),'ignorePauseForPreviewCalls',_0xe9bd('0x2c'),'chatAutoanswer',_0xe9bd('0x2d'),'emailAutoanswer',_0xe9bd('0x2e'),_0xe9bd('0x2f'),_0xe9bd('0x30'),_0xe9bd('0x31'),_0xe9bd('0x32'),_0xe9bd('0x33'),_0xe9bd('0x34'),'whatsappAutoanswer',_0xe9bd('0x35')];exports[_0xe9bd('0x36')]=function(){return this['isAuthenticated'](!![])[_0xe9bd('0x37')](function(_0x505c23,_0x238ab1,_0x1b9cc9){if(_0x505c23[_0xe9bd('0x38')]){_0x1b9cc9();}else{return db[_0xe9bd('0x39')]['findOne']({'where':{'id':_0x505c23[_0xe9bd('0x3a')]['id']},'attributes':['id',_0xe9bd('0x3b'),_0xe9bd('0x3c')],'raw':!![]})[_0xe9bd('0x3d')](function(_0x2641be){if(_0x2641be&&_0x2641be[_0xe9bd('0x3b')]){return _0x238ab1[_0xe9bd('0x3e')](_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?0x195:0x193)['json']({'message':_0x2641be[_0xe9bd('0x3c')]===_0xe9bd('0x3f')?'Unmanaged.':_0xe9bd('0x40')});}else{_0x1b9cc9();}})[_0xe9bd('0x41')](function(_0x119672){_0x1b9cc9(_0x119672);});}});};exports[_0xe9bd('0x42')]=function isAuthenticated(_0x141b95){return compose()[_0xe9bd('0x37')](function(_0x519f48,_0x5b7f1d,_0x1de54c){var _0x56e409;if(_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')]){if(_[_0xe9bd('0x45')](_0x519f48[_0xe9bd('0x43')][_0xe9bd('0x44')],'Basic')){var _0x4b7bc2=basicAuth(_0x519f48);db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'name':_0x4b7bc2[_0xe9bd('0xe')]}})[_0xe9bd('0x3d')](function(_0xe2436){if(!_0xe2436||!_0xe2436[_0xe9bd('0x48')](_0x4b7bc2[_0xe9bd('0x49')])){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':'Wrong\x20credentials.'});}_0x519f48[_0xe9bd('0x38')]={'id':_0xe2436['id']};_0x1de54c();})[_0xe9bd('0x41')](function(_0x390a43){_0x1de54c(_0x390a43);});}else if(_['startsWith'](_0x519f48['headers'][_0xe9bd('0x44')],_0xe9bd('0x4b'))){validateJwt(_0x519f48,_0x5b7f1d,_0x1de54c);}else{if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}}}else if(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')]){try{var _0x1c6173={'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};verifyJwt(_0x519f48[_0xe9bd('0x4d')][_0xe9bd('0x4e')],_0x1c6173)[_0xe9bd('0x3d')](function(_0x199477){return db[_0xe9bd('0x46')][_0xe9bd('0x47')]({'where':{'id':_0x199477[_0xe9bd('0x50')]}})[_0xe9bd('0x3d')](function(_0x4c689d){_0x56e409=_0x4c689d;return db[_0xe9bd('0x51')][_0xe9bd('0x52')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe9bd('0x53')],'raw':!![]});})[_0xe9bd('0x3d')](function(_0x4c7d47){if(!_0x56e409||!_['isEqual'](_0x56e409[_0xe9bd('0x54')],_0x199477[_0xe9bd('0x55')])){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x56')});}if(_0x56e409[_0xe9bd('0x57')]){return _0x5b7f1d['status'](0x191)[_0xe9bd('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x56e409[_0xe9bd('0x58')]){if(_0x4c7d47[_0xe9bd('0x53')]>0x0){if(moment(_0x56e409[_0xe9bd('0x59')])[_0xe9bd('0x5a')](_0x4c7d47['blockDuration'],_0xe9bd('0x5b'))>moment()){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}else{return _0x5b7f1d[_0xe9bd('0x3e')](0x191)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5c')});}}_0x519f48[_0xe9bd('0x38')]={'id':_0x56e409['id']};_0x1de54c();});})[_0xe9bd('0x41')](function(){return _0x5b7f1d[_0xe9bd('0x3e')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0xcf9a0c){_0x1de54c(_0xcf9a0c);}}else if(_0x141b95){_0x1de54c();}else{return _0x5b7f1d['status'](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x4c')});}})[_0xe9bd('0x37')](function(_0x480797,_0x1ba613,_0x2923cf){if(_0x480797[_0xe9bd('0x38')]){db['User'][_0xe9bd('0x47')]({'where':{'id':_0x480797[_0xe9bd('0x38')]['id']},'attributes':userAttributes})[_0xe9bd('0x3d')](function(_0x388132){if(!_0x388132){return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5d')});}_0x480797[_0xe9bd('0x38')]=_0x388132;_0x2923cf();})[_0xe9bd('0x41')](function(_0x300e07){_0x2923cf(_0x300e07);});}else if(_0x141b95){_0x2923cf();}else{return _0x1ba613[_0xe9bd('0x3e')](0x194)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x5e')});}});};exports[_0xe9bd('0x5f')]=function canUpdate(){return compose()[_0xe9bd('0x37')](function(_0x5b70d3,_0x5a86fd,_0x283e67){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x58828b){if(_0x58828b['update']){_0x283e67();}else{return _0x5a86fd[_0xe9bd('0x3e')](0x193)[_0xe9bd('0x4a')]({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0x39fb61){_0x283e67(_0x39fb61);});});};exports[_0xe9bd('0x62')]=function isWebrtcLicence(){return compose()[_0xe9bd('0x37')](function(_0x512899,_0x1e45fc,_0x4cc146){return licenseUtil[_0xe9bd('0x60')]()[_0xe9bd('0x3d')](function(_0x33ba69){if(_0x33ba69[_0xe9bd('0x63')]){_0x4cc146();}else{return _0x1e45fc[_0xe9bd('0x3e')](0x193)['json']({'message':_0xe9bd('0x61')});}})[_0xe9bd('0x41')](function(_0xe14fa4){_0x4cc146(_0xe14fa4);});});};exports['isMiddleware']=function(_0xff4e14,_0x476f23,_0x34f787){_0xff4e14['isMiddleware']=!![];return _0x34f787();};exports[_0xe9bd('0x64')]=function signToken(_0x27e7b0){return signJwt(_0x27e7b0);};exports[_0xe9bd('0x65')]=function(_0x10ec29,_0x1ee09c){if(!_0x10ec29['user']){return _0x1ee09c[_0xe9bd('0x3e')](0x194)['json']({'message':_0xe9bd('0x66')});}var _0x239be9={'payload':{'id':_0x10ec29[_0xe9bd('0x38')]['id'],'role':_0x10ec29[_0xe9bd('0x38')][_0xe9bd('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x239be9)['then'](function(_0x15d1d0){_0x1ee09c['cookie'](_0xe9bd('0x67'),_0x15d1d0);_0x1ee09c[_0xe9bd('0x68')]('/dashboards/general');})['catch'](function(_0x1ce539){return _0x1ee09c['status'](0x1f4)[_0xe9bd('0x69')](_0x1ce539);});};exports['retrieveApiKey']=function(_0x26b25a){if(_[_0xe9bd('0x6a')](_0x26b25a['apiKeyNonce'])||_[_0xe9bd('0x6a')](_0x26b25a['apiKeyIat'])){return null;}else{return createJwt(_0x26b25a);}};exports[_0xe9bd('0x6b')]=function(_0x2d9a94){_0x2d9a94[_0xe9bd('0x54')]=generateNonce();_0x2d9a94['apiKeyIat']=generateIssuedAt();return createJwt(_0x2d9a94);};exports[_0xe9bd('0x6c')]=function(_0x1d703f,_0x45b69e){var _0x232a36=_0x1d703f['query']['apikey'];if(_0x232a36){var _0x441f89={'nonce':_0x45b69e['apiKeyNonce'],'iat':_0x45b69e[_0xe9bd('0x6d')],'audience':hardwareConf[_0xe9bd('0x4f')](),'issuer':hardwareConf[_0xe9bd('0x4f')]()};return verifyJwt(_0x232a36,_0x441f89)[_0xe9bd('0x3d')](function(){return generateApiKey(_0x45b69e);});}else{throw{'message':_0xe9bd('0x6e')};}};exports[_0xe9bd('0x6f')]=function(_0x373057){var _0x3381ee=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3381ee[_0xe9bd('0x70')](_0x373057))throw new db[(_0xe9bd('0x71'))][(_0xe9bd('0x72'))](_0xe9bd('0x73'));return;};exports['validatePasswordHistory']=function(_0x596a7d,_0x566dd8,_0x10e685){var _0x5a516e=encryptor[_0xe9bd('0x74')](_0x566dd8)[_0xe9bd('0x75')](',');for(var _0x90db01=0x0;_0x90db01<_0x10e685;_0x90db01++){if(!_0x5a516e[_0x90db01])break;if(_0x596a7d[_0xe9bd('0x76')]()===_0x5a516e[_0x90db01][_0xe9bd('0x76')]()){var _0xaf6ffd=util[_0xe9bd('0x77')](_0xe9bd('0x78'),_0x10e685);if(_0x10e685===0x1){_0xaf6ffd=_0xe9bd('0x79');}throw new db['Sequelize'][(_0xe9bd('0x72'))](_0xaf6ffd);}}return;};exports[_0xe9bd('0x7a')]=function(_0x3d3e74,_0x3f848d){var _0x4d58c1=_0x3f848d?encryptor[_0xe9bd('0x74')](_0x3f848d)[_0xe9bd('0x75')](','):[];if(_0x4d58c1[_0xe9bd('0x7b')]===0x5){_0x4d58c1['splice'](-0x1,0x1);}_0x4d58c1[_0xe9bd('0x7c')](_0x3d3e74);return encryptor[_0xe9bd('0x7d')](_0x4d58c1[_0xe9bd('0x7e')](','));};function signJwt(_0xfe82f7){var _0x4ee26a=BPromise['promisify'](jwt[_0xe9bd('0x7f')],{'context':jwt});var _0x188891=_0xfe82f7[_0xe9bd('0x80')]||config[_0xe9bd('0xa')]['session'];return new BPromise(function(_0x49add9,_0x305efa){_0x4ee26a(_0xfe82f7[_0xe9bd('0x81')],_0x188891,_0xfe82f7[_0xe9bd('0x82')])[_0xe9bd('0x3d')](function(_0x1fd2b5){_0x49add9(_0x1fd2b5);})[_0xe9bd('0x41')](function(_0x4870f8){_0x305efa(_0x4870f8);});});}function verifyJwt(_0x179c8d,_0x5681ab,_0x27e07c){var _0x28dd03=BPromise[_0xe9bd('0x83')](jwt[_0xe9bd('0x84')],{'context':jwt});var _0x5bc1f8=_0x27e07c||config[_0xe9bd('0xa')][_0xe9bd('0xb')];return new BPromise(function(_0x3b0190,_0x4f35c4){_0x28dd03(_0x179c8d,_0x5bc1f8,_0x5681ab)[_0xe9bd('0x3d')](function(_0x1a9d0c){_0x3b0190(_0x1a9d0c);})[_0xe9bd('0x41')](function(_0x3e3e05){_0x4f35c4(_0x3e3e05);});});}function generateNonce(){return crypto[_0xe9bd('0x85')](0x10)[_0xe9bd('0x86')](_0xe9bd('0x87'));}function generateIssuedAt(){return Math[_0xe9bd('0x88')](Date[_0xe9bd('0x89')]()/0x3e8)[_0xe9bd('0x86')]();}function createJwt(_0x14c599){var _0x37d07a={'payload':{'iat':_0x14c599['apiKeyIat'],'nonce':_0x14c599[_0xe9bd('0x54')]},'options':{'algorithm':_0xe9bd('0x8a'),'subject':_0x14c599['id']['toString'](),'issuer':hardwareConf[_0xe9bd('0x4f')](),'audience':hardwareConf[_0xe9bd('0x4f')]()}};return signJwt(_0x37d07a)['then'](function(_0x561165){return{'iat':_0x14c599[_0xe9bd('0x6d')],'nonce':_0x14c599[_0xe9bd('0x54')],'token':_0x561165};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 17238dc..8c22604 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['tags','skip','tag','count','getFilteredContacts','catch','CmContact','keys','cf_','map','findOne','all','length','type','lodash','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause'];(function(_0x18d862,_0x3bf0e8){var _0x2066d7=function(_0x45bda4){while(--_0x45bda4){_0x18d862['push'](_0x18d862['shift']());}};_0x2066d7(++_0x3bf0e8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x26f866,_0x1900bc){_0x26f866=_0x26f866-0x0;var _0x1abef3=_0x0b0e[_0x26f866];return _0x1abef3;};'use strict';var _=require(_0xe0b0('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xe0b0('0x1'))['db'];exports['findAll']=function(_0x7e5a8a,_0xdf715e,_0x3b5e2b,_0x25153a){var _0x28040c={'count':0x0,'rows':[]};var _0x38a058=sqlUtils[_0xe0b0('0x2')](_0xdf715e,_0x7e5a8a);if(_0x38a058){return Promise[_0xe0b0('0x3')](_0x28040c);}var _0x30e20d=sqlUtils[_0xe0b0('0x4')]();var _0x219b1c={};var _0x5cf9cc=![];var _0x50be7f=![];return Promise[_0xe0b0('0x3')]()[_0xe0b0('0x5')](function(){if(_0x7e5a8a[_0xe0b0('0x6')]){return sqlUtils[_0xe0b0('0x7')](_0x7e5a8a['search'],_0x25153a);}else{return sqlUtils[_0xe0b0('0x8')](_0x7e5a8a,_0x25153a);}})[_0xe0b0('0x5')](function(_0x553d4f){_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xa')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xb')]);_0x30e20d[_0xe0b0('0x9')](_0x553d4f[_0xe0b0('0xc')]);_0x30e20d['where'](_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0xe')]);_0x219b1c=_0x553d4f[_0xe0b0('0xf')];_0x50be7f=_0x553d4f[_0xe0b0('0xd')][_0xe0b0('0x10')];return sqlUtils['checkListsRestrictions'](_0xdf715e,_0x7e5a8a,_0x50be7f);})[_0xe0b0('0x5')](function(_0x154de6){_0x30e20d[_0xe0b0('0x9')](_0x154de6);var _0x24babd=_0x7e5a8a[_0xe0b0('0x6')]?_0x219b1c['ids']:_0x7e5a8a[_0xe0b0('0x11')];_0x5cf9cc=_0x24babd?!![]:![];return sqlUtils['countFilteredContacts'](_0x30e20d,_0x24babd);})[_0xe0b0('0x5')](function(_0xadee6e){_0x28040c['count']=_0xadee6e;if(_0x28040c[_0xe0b0('0x12')]===0x0){return;}return sqlUtils['buildContactsQuery'](_0x30e20d,_0x7e5a8a[_0xe0b0('0xb')],_0x3b5e2b,_0x5cf9cc,_0x219b1c[_0xe0b0('0xe')],_0x50be7f);})['then'](function(_0x54a3eb){if(!_0x54a3eb){return[];}return sqlUtils[_0xe0b0('0x13')](_0x54a3eb,_0x7e5a8a,_0x3b5e2b);})['then'](function(_0x4df8da){_0x28040c['rows']=_0x4df8da;return _0x28040c;})[_0xe0b0('0x14')](function(_0x50fa4a){throw _0x50fa4a;});};exports['describe']=function(){var _0x10cde1={};var _0x59dff5=[];return db[_0xe0b0('0x15')]['describe']()[_0xe0b0('0x5')](function(_0x1cd7c4){_0x10cde1=_0x1cd7c4;var _0x3e10b3=Object[_0xe0b0('0x16')](_0x10cde1)[_0xe0b0('0xc')](function(_0x58b804){return _['startsWith'](_0x58b804,_0xe0b0('0x17'))?_0x58b804:undefined;});var _0x5512bb=_0x3e10b3[_0xe0b0('0x18')](function(_0x31b5f8){return db['CmCustomField'][_0xe0b0('0x19')]({'where':{'id':_0x31b5f8['slice'](0x3)},'raw':!![]});});return Promise[_0xe0b0('0x1a')](_0x5512bb);})['then'](function(_0x28586d){for(var _0x576352=0x0;_0x576352<_0x28586d[_0xe0b0('0x1b')];_0x576352++){if(_0x28586d[_0x576352]){var _0x4de537=_0xe0b0('0x17')+_0x28586d[_0x576352]['id'];_0x10cde1[_0x4de537]['fieldType']=_0x28586d[_0x576352][_0xe0b0('0x1c')];}}_0x59dff5=_['map'](Object[_0xe0b0('0x16')](_0x10cde1),function(_0x3c3bc2){return{'name':_0x3c3bc2,'type':_0x10cde1[_0x3c3bc2][_0xe0b0('0x1c')]};});return _0x59dff5;})[_0xe0b0('0x14')](function(_0x3ec2){throw _0x3ec2;});}; \ No newline at end of file +var _0x2032=['map','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','getContactsSubquery','then','search','where','user','ids','tag','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','rows','describe','CmContact','filter','startsWith','cf_'];(function(_0x58a070,_0xec54a5){var _0x18b084=function(_0x5f2820){while(--_0x5f2820){_0x58a070['push'](_0x58a070['shift']());}};_0x18b084(++_0xec54a5);}(_0x2032,0xd9));var _0x2203=function(_0x5b17c8,_0x17666c){_0x5b17c8=_0x5b17c8-0x0;var _0xc8d1ba=_0x2032[_0x5b17c8];return _0xc8d1ba;};'use strict';var _=require('lodash');var sqlUtils=require(_0x2203('0x0'));var db=require(_0x2203('0x1'))['db'];exports[_0x2203('0x2')]=function(_0x4c28da,_0x486390,_0x228a29,_0x4b4c7f){var _0x46c49a={'count':0x0,'rows':[]};var _0x880dcd=sqlUtils[_0x2203('0x3')](_0x486390,_0x4c28da);if(_0x880dcd){return Promise[_0x2203('0x4')](_0x46c49a);}var _0x3f7ba1=sqlUtils[_0x2203('0x5')]();var _0x2e0f63={};var _0x2676aa=![];var _0x18c4d6=![];return Promise[_0x2203('0x4')]()[_0x2203('0x6')](function(){if(_0x4c28da['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x4c28da[_0x2203('0x7')],_0x4b4c7f);}else{return sqlUtils['parseQueryParameters'](_0x4c28da,_0x4b4c7f);}})[_0x2203('0x6')](function(_0x2972f3){_0x3f7ba1[_0x2203('0x8')](_0x2972f3['default']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['fields']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3['filter']);_0x3f7ba1[_0x2203('0x8')](_0x2972f3[_0x2203('0x9')]['clause']);_0x2e0f63=_0x2972f3['tags'];_0x18c4d6=_0x2972f3['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x486390,_0x4c28da,_0x18c4d6);})[_0x2203('0x6')](function(_0x538b30){_0x3f7ba1['where'](_0x538b30);var _0x21a3af=_0x4c28da[_0x2203('0x7')]?_0x2e0f63[_0x2203('0xa')]:_0x4c28da[_0x2203('0xb')];_0x2676aa=_0x21a3af?!![]:![];return sqlUtils[_0x2203('0xc')](_0x3f7ba1,_0x21a3af);})[_0x2203('0x6')](function(_0x2c36e6){_0x46c49a[_0x2203('0xd')]=_0x2c36e6;if(_0x46c49a[_0x2203('0xd')]===0x0){return;}return sqlUtils[_0x2203('0xe')](_0x3f7ba1,_0x4c28da['fields'],_0x228a29,_0x2676aa,_0x2e0f63[_0x2203('0xf')],_0x18c4d6);})[_0x2203('0x6')](function(_0x4893ff){if(!_0x4893ff){return[];}return sqlUtils[_0x2203('0x10')](_0x4893ff,_0x4c28da,_0x228a29);})[_0x2203('0x6')](function(_0x4aeb9f){_0x46c49a[_0x2203('0x11')]=_0x4aeb9f;return _0x46c49a;})['catch'](function(_0x2904ba){throw _0x2904ba;});};exports[_0x2203('0x12')]=function(){var _0x3c8c34={};var _0x3b4034=[];return db[_0x2203('0x13')][_0x2203('0x12')]()['then'](function(_0x13d3f7){_0x3c8c34=_0x13d3f7;var _0x50822b=Object['keys'](_0x3c8c34)[_0x2203('0x14')](function(_0x496d82){return _[_0x2203('0x15')](_0x496d82,_0x2203('0x16'))?_0x496d82:undefined;});var _0x5d4c4e=_0x50822b[_0x2203('0x17')](function(_0x5e29cd){return db['CmCustomField'][_0x2203('0x18')]({'where':{'id':_0x5e29cd[_0x2203('0x19')](0x3)},'raw':!![]});});return Promise[_0x2203('0x1a')](_0x5d4c4e);})[_0x2203('0x6')](function(_0x1244f4){for(var _0x3114ef=0x0;_0x3114ef<_0x1244f4[_0x2203('0x1b')];_0x3114ef++){if(_0x1244f4[_0x3114ef]){var _0x250349='cf_'+_0x1244f4[_0x3114ef]['id'];_0x3c8c34[_0x250349][_0x2203('0x1c')]=_0x1244f4[_0x3114ef][_0x2203('0x1d')];}}_0x3b4034=_[_0x2203('0x17')](Object['keys'](_0x3c8c34),function(_0xb2071b){return{'name':_0xb2071b,'type':_0x3c8c34[_0xb2071b][_0x2203('0x1d')]};});return _0x3b4034;})['catch'](function(_0xd6e109){throw _0xd6e109;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 5924f27..930dbd7 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e30=['subqry.id','having','order','DESC','subqry.','keyBy','Sequelize','SELECT','CmContact','sequelize','query','Tags','push','clone','COUNT(*)','group','isEmpty','QueryTypes','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','agent','search','ListId','autocomplete','from','cm_contacts','c.deletedAt\x20IS\x20NULL','cm_user_has_contacts','.id','left_join','cm_contact_has_tags','t.id\x20=\x20ct.TagId','subqry','lastName','fax','email','createdAt','updatedAt','deletedAt','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','datetime','castTo','DATE','buildExpression','type','text','value','end','Tag','map','tags','User','user','clause','and','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset'];(function(_0xb6c5f8,_0x2f1ff6){var _0x57f855=function(_0x5f3edd){while(--_0x5f3edd){_0xb6c5f8['push'](_0xb6c5f8['shift']());}};_0x57f855(++_0x2f1ff6);}(_0x5e30,0x7b));var _0x05e3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e30[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x05e3('0x0'));var squel=require(_0x05e3('0x1'));var as=require(_0x05e3('0x2'));var qs=require(_0x05e3('0x3'));var utils=require(_0x05e3('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x5136f8,_0x5675cc){var _0x187527=![];if(_0x5136f8[_0x05e3('0x5')]===_0x05e3('0x6')&&!_0x5675cc[_0x05e3('0x7')]&&!_0x5675cc[_0x05e3('0x8')]&&_0x5675cc[_0x05e3('0x9')]!=='true'){_0x187527=!![];}return _0x187527;}function getContactsSubquery(){return squel['select']()[_0x05e3('0xa')](_0x05e3('0xb'),'c')['where'](_0x05e3('0xc'));}function applyJoinClauses(_0x1d849b,_0x14e007){var _0x2afc34=_0x14e007?'c':'subqry';_0x1d849b['left_join'](_0x05e3('0xd'),'uc','uc.CmContactId\x20=\x20'+_0x2afc34+_0x05e3('0xe'))[_0x05e3('0xf')](_0x05e3('0x10'),'ct','ct.CmContactId\x20=\x20'+_0x2afc34+_0x05e3('0xe'))[_0x05e3('0xf')]('tools_tags','t',_0x05e3('0x11'));return _0x1d849b;}function addFieldsToQuery(_0x5e4e21,_0x1eaa98,_0x2d03c8,_0x2fad56,_0x21d6e2){var _0x5f50ca=_0x21d6e2?'c':_0x05e3('0x12');if(!_0x1eaa98){_0x1eaa98=['id','firstName',_0x05e3('0x13'),'phone','mobile',_0x05e3('0x14'),_0x05e3('0x15'),_0x05e3('0x8'),'CompanyId',_0x05e3('0x16'),_0x05e3('0x17'),_0x05e3('0x18'),_0x05e3('0x19')];}var _0x50dce4=_0x2d03c8&&_0x21d6e2||!_0x2d03c8&&!_0x21d6e2;if(_0x2fad56){_0x50dce4=_0x2fad56&&_0x21d6e2||!_0x2fad56&&!_0x21d6e2;}_0x1eaa98['forEach'](function(_0x8ea7d8){if(_0x8ea7d8===_0x05e3('0x19')){if(_0x50dce4){_0x5e4e21[_0x05e3('0x1a')](_0x05e3('0x1b'),_0x8ea7d8);}else if(_0x2d03c8||_0x2fad56){_0x5e4e21[_0x05e3('0x1a')](_0x5f50ca+'.'+_0x8ea7d8);}}else{_0x5e4e21[_0x05e3('0x1a')](_0x5f50ca+'.'+_0x8ea7d8);}});return _0x5e4e21;}function getSqlClauses(){var _0x57c59f={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel[_0x05e3('0x1c')](),'tags':{'clause':squel[_0x05e3('0x1c')](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x57c59f;}function parseTagParameter(_0x46cfd5){var _0x281b0c=squel['expr']();if(_0x46cfd5){var _0x3953af=utils[_0x05e3('0x1d')](_0x46cfd5);_0x3953af[_0x05e3('0x1e')](function(_0x25459c){_0x281b0c['or'](_0x05e3('0x1f'),'%,'+_0x25459c+',%');});}return _0x281b0c;}function parseSearchFilter(_0x5b254e){var _0x40552b=squel[_0x05e3('0x1c')]();if(_0x5b254e){var _0x484cdc=_0x5b254e['replace']('\x5c','\x5c\x5c')[_0x05e3('0x20')](/'/g,'\x27\x27');if(_0x484cdc[_0x05e3('0x21')]('\x20')[_0x05e3('0x22')]>0x1){_0x40552b['or'](_0x05e3('0x23'),qs['getFullTextValue'](_0x484cdc),null);}else{if(qs['isNumeric'](_0x484cdc)){_0x40552b['or'](_0x05e3('0x24'),_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x25'),_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x26'),_0x484cdc+'%');_0x40552b['or']('c.fax\x20LIKE\x20?',_0x484cdc+'%');}else if(qs['isEmail'](_0x484cdc)){_0x40552b['or'](_0x05e3('0x27'),_0x484cdc+'%');}else{_0x40552b['or'](_0x05e3('0x28'),'%'+_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x29'),'%'+_0x484cdc+'%');_0x40552b['or'](_0x05e3('0x27'),'%'+_0x484cdc+'%');}}}return _0x40552b;}function parseAdvancedSearchFilter(_0x2d5d25,_0x5ec676){var _0x27d7e7=getSqlClauses();var _0x46dafa=as[_0x05e3('0x2a')](_0x2d5d25);var _0x5680ef=_0x46dafa[_0x05e3('0x2b')];for(var _0x4ecee8=0x0;_0x4ecee8<_0x46dafa[_0x05e3('0x2c')][_0x05e3('0x22')];_0x4ecee8++){var _0x559991=_0x46dafa[_0x05e3('0x2c')][_0x4ecee8];var _0x3f4868='c';var _0x439309=_[_0x05e3('0x2d')](_0x5ec676,[_0x05e3('0x2e'),_0x559991[_0x05e3('0x1a')]]);if(_0x439309){if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x2f')||_0x439309['fieldType']===_0x05e3('0x30')){_0x559991[_0x05e3('0x31')]=_0x05e3('0x32');}var _0x4cac45=as[_0x05e3('0x33')](_0x3f4868,_0x439309[_0x05e3('0x34')],_0x559991);_0x27d7e7['default'][_0x5680ef](_0x4cac45[_0x05e3('0x35')],_0x4cac45['value']['start'],_0x4cac45[_0x05e3('0x36')][_0x05e3('0x37')]);}else{if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x38')){var _0x4457ab=_0x559991['value'][_0x05e3('0x21')](',')[_0x05e3('0x39')](function(_0x48f1f4){return Number(_0x48f1f4);});var _0x51fe55=parseTagParameter(_0x4457ab);_0x27d7e7[_0x05e3('0x3a')]['clause']['and'](_0x51fe55);_0x27d7e7['tags']['ids']=_0x4457ab;}else if(_0x559991[_0x05e3('0x1a')]===_0x05e3('0x3b')){_0x27d7e7[_0x05e3('0x3c')][_0x05e3('0x3d')][_0x05e3('0x3e')](_0x05e3('0x3f'),_0x559991[_0x05e3('0x36')]);_0x27d7e7[_0x05e3('0x3c')][_0x05e3('0x40')]=!![];}}}return _0x27d7e7;}function parseModelFields(_0x2e5282,_0xdcd4d2){var _0x4623bd=squel[_0x05e3('0x1c')]();var _0x2d2b10=_(_0x2e5282)[_0x05e3('0x41')]()[_0x05e3('0x39')](function(_0x553339){return _[_0x05e3('0x42')](_0xdcd4d2,[_0x05e3('0x2e'),_0x553339])?_0x553339:undefined;})[_0x05e3('0x43')]()[_0x05e3('0x36')]();if(_0x2e5282[_0x05e3('0x44')]){_0x2d2b10['push'](_0x05e3('0x44'));}if(_0x2d2b10[_0x05e3('0x22')]>0x0){_0x2d2b10[_0x05e3('0x1e')](function(_0xe9b1aa){if(_0xe9b1aa===_0x05e3('0x8')){_0x4623bd['and'](_0x05e3('0x45'),[][_0x05e3('0x46')](_0x2e5282[_0xe9b1aa]));}else if(_0xe9b1aa===_0x05e3('0x44')){var _0x58cd0b='%'+_0x2e5282[_0xe9b1aa]+'%';_0x4623bd[_0x05e3('0x3e')](_0x05e3('0x47'),_0x58cd0b);}else{_0x4623bd['and']('c.'+_0xe9b1aa+_0x05e3('0x48'),_0x2e5282[_0xe9b1aa]);}});}return _0x4623bd;}function parseQueryParameters(_0x29a754,_0x522a7c){var _0x2e9b0e=getSqlClauses();return Promise[_0x05e3('0x49')]()[_0x05e3('0x4a')](function(){return parseModelFields(_0x29a754,_0x522a7c);})[_0x05e3('0x4a')](function(_0x19b9d1){_0x2e9b0e[_0x05e3('0x4b')][_0x05e3('0x3e')](_0x19b9d1);return parseTagParameter(_0x29a754[_0x05e3('0x4c')]);})['then'](function(_0x447592){_0x2e9b0e['tags']['clause'][_0x05e3('0x3e')](_0x447592);return parseSearchFilter(_0x29a754['filter']);})['then'](function(_0x6db49a){_0x2e9b0e[_0x05e3('0x4d')]=_0x6db49a;return _0x2e9b0e;});}function checkListsRestrictions(_0x275859,_0x1630dd,_0x3f0b2f){var _0x5b1bcd=squel[_0x05e3('0x1c')]();return Promise[_0x05e3('0x49')]()[_0x05e3('0x4a')](function(){if(_0x1630dd[_0x05e3('0x7')]&&_0x275859[_0x05e3('0x5')]===_0x05e3('0x6')&&!_0x3f0b2f){return _0x275859[_0x05e3('0x4e')]({'attributes':['id'],'raw':!![]});}})[_0x05e3('0x4a')](function(_0x1b876e){if(_0x1b876e){if(_0x1b876e[_0x05e3('0x22')]===0x0){_0x5b1bcd[_0x05e3('0x3e')](_0x05e3('0x4f'));}else{_0x5b1bcd[_0x05e3('0x3e')](_0x05e3('0x45'),_[_0x05e3('0x39')](_0x1b876e,'id'));}}})[_0x05e3('0x4a')](function(){return _0x5b1bcd;});}function buildContactsQuery(_0x2f9048,_0x51ee9c,_0x5d31b9,_0x5d7ca7,_0x2685a5,_0x1bed6a){if(_0x51ee9c){_0x51ee9c=_0x5d31b9[_0x05e3('0x50')];}_0x2f9048=addFieldsToQuery(_0x2f9048,_0x51ee9c,_0x5d7ca7,_0x1bed6a,!![]);var _0x372b81=squel[_0x05e3('0x51')]();_0x372b81=addFieldsToQuery(_0x372b81,_0x51ee9c,_0x5d7ca7,_0x1bed6a,![]);if(_0x5d7ca7||_0x1bed6a){_0x2f9048=applyJoinClauses(_0x2f9048,!![]);_0x2f9048['group'](_0x05e3('0x52'));if(_0x5d31b9['limit']){_0x372b81[_0x05e3('0x53')](_0x5d31b9['limit']);}if(_0x5d31b9[_0x05e3('0x54')]){_0x372b81['offset'](_0x5d31b9[_0x05e3('0x54')]);}}else{_0x372b81=applyJoinClauses(_0x372b81,![]);_0x372b81['group'](_0x05e3('0x55'));if(_0x5d31b9['limit']){_0x2f9048[_0x05e3('0x53')](_0x5d31b9[_0x05e3('0x53')]);}if(_0x5d31b9[_0x05e3('0x54')]){_0x2f9048[_0x05e3('0x54')](_0x5d31b9[_0x05e3('0x54')]);}}_0x372b81[_0x05e3('0x56')](_0x2685a5);if(_0x5d31b9[_0x05e3('0x57')]){_0x5d31b9[_0x05e3('0x57')][_0x05e3('0x1e')](function(_0x56f377){_0x2f9048[_0x05e3('0x57')]('c.'+_0x56f377[0x0],_0x56f377[0x1]===_0x05e3('0x58')?![]:!![]);_0x372b81[_0x05e3('0x57')](_0x05e3('0x59')+_0x56f377[0x0],_0x56f377[0x1]===_0x05e3('0x58')?![]:!![]);});}_0x372b81[_0x05e3('0xa')](_0x2f9048,_0x05e3('0x12'));return _0x372b81;}function getFilteredContacts(_0x1ba314){var _0x192135=[];return db[_0x05e3('0x38')]['findAll']({'attributes':['id','name','color'],'raw':!![]})[_0x05e3('0x4a')](function(_0x54b66e){_0x192135=_[_0x05e3('0x5a')](_0x54b66e,'id');var _0x254720={'type':db[_0x05e3('0x5b')]['QueryTypes'][_0x05e3('0x5c')],'model':db[_0x05e3('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x05e3('0x5e')][_0x05e3('0x5f')](_0x1ba314['toString'](),_0x254720);})[_0x05e3('0x4a')](function(_0x2ac356){_0x2ac356[_0x05e3('0x1e')](function(_0x45d3bd){if(_0x45d3bd[_0x05e3('0x19')]){_0x45d3bd[_0x05e3('0x60')]=[];_0x45d3bd[_0x05e3('0x19')]['split'](',')[_0x05e3('0x1e')](function(_0x4a1932){_0x45d3bd['Tags'][_0x05e3('0x61')](_0x192135[_0x4a1932]);});}delete _0x45d3bd['TagIds'];});return _0x2ac356;});}function countFilteredContacts(_0x316c50,_0x30e291){var _0x454be2=_0x316c50[_0x05e3('0x62')]();_0x454be2[_0x05e3('0x1a')](_0x05e3('0x63'));_0x454be2=applyJoinClauses(_0x454be2,!![]);_0x316c50[_0x05e3('0x64')]('c.id');var _0x4e0f6f=utils[_0x05e3('0x1d')](_0x30e291);if(!_[_0x05e3('0x65')](_0x4e0f6f)){_0x454be2['where']('t.id\x20IN\x20?',_0x4e0f6f);}var _0x20b115={'type':db[_0x05e3('0x5b')][_0x05e3('0x66')][_0x05e3('0x5c')],'raw':!![]};return db[_0x05e3('0x5e')][_0x05e3('0x5f')](_0x454be2['toString'](),_0x20b115)[_0x05e3('0x4a')](function(_0xa0ffb6){return _0xa0ffb6[0x0][_0x05e3('0x63')];});}module[_0x05e3('0x67')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5a8c=['c.ListId\x20IN\x20?','attributes','group','limit','offset','subqry.id','order','DESC','Tag','findAll','color','Sequelize','QueryTypes','CmContact','sequelize','query','toString','Tags','push','COUNT(*)','c.id','getSelectedTags','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','left_join','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','end','map','clause','and','tags','ids','user','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','filter','getLists'];(function(_0x3994eb,_0x1fb318){var _0x534f74=function(_0x55ba6c){while(--_0x55ba6c){_0x3994eb['push'](_0x3994eb['shift']());}};_0x534f74(++_0x1fb318);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x1eb170,_0x57a773){_0x1eb170=_0x1eb170-0x0;var _0x4f01ed=_0x5a8c[_0x1eb170];return _0x4f01ed;};'use strict';var _=require(_0xc5a8('0x0'));var squel=require(_0xc5a8('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0xc5a8('0x2'));var utils=require(_0xc5a8('0x3'));var db=require(_0xc5a8('0x4'))['db'];function skipContactsQuery(_0x185f20,_0x5d67ef){var _0x2d862c=![];if(_0x185f20[_0xc5a8('0x5')]==='agent'&&!_0x5d67ef[_0xc5a8('0x6')]&&!_0x5d67ef[_0xc5a8('0x7')]&&_0x5d67ef[_0xc5a8('0x8')]!==_0xc5a8('0x9')){_0x2d862c=!![];}return _0x2d862c;}function getContactsSubquery(){return squel[_0xc5a8('0xa')]()[_0xc5a8('0xb')](_0xc5a8('0xc'),'c')[_0xc5a8('0xd')](_0xc5a8('0xe'));}function applyJoinClauses(_0x897828,_0x46e3b7){var _0x4e0029=_0x46e3b7?'c':_0xc5a8('0xf');_0x897828['left_join'](_0xc5a8('0x10'),'uc',_0xc5a8('0x11')+_0x4e0029+_0xc5a8('0x12'))['left_join']('cm_contact_has_tags','ct',_0xc5a8('0x13')+_0x4e0029+_0xc5a8('0x12'))[_0xc5a8('0x14')](_0xc5a8('0x15'),'t',_0xc5a8('0x16'));return _0x897828;}function addFieldsToQuery(_0x5d2d2c,_0x39a28d,_0x25eb93,_0x3a8296,_0x3a820f){var _0x3d6990=_0x3a820f?'c':_0xc5a8('0xf');if(!_0x39a28d){_0x39a28d=['id',_0xc5a8('0x17'),_0xc5a8('0x18'),_0xc5a8('0x19'),_0xc5a8('0x1a'),_0xc5a8('0x1b'),_0xc5a8('0x1c'),_0xc5a8('0x7'),_0xc5a8('0x1d'),_0xc5a8('0x1e'),_0xc5a8('0x1f'),_0xc5a8('0x20'),_0xc5a8('0x21')];}var _0x506c10=_0x25eb93&&_0x3a820f||!_0x25eb93&&!_0x3a820f;if(_0x3a8296){_0x506c10=_0x3a8296&&_0x3a820f||!_0x3a8296&&!_0x3a820f;}_0x39a28d[_0xc5a8('0x22')](function(_0x184749){if(_0x184749===_0xc5a8('0x21')){if(_0x506c10){_0x5d2d2c[_0xc5a8('0x23')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x184749);}else if(_0x25eb93||_0x3a8296){_0x5d2d2c[_0xc5a8('0x23')](_0x3d6990+'.'+_0x184749);}}else{_0x5d2d2c['field'](_0x3d6990+'.'+_0x184749);}});return _0x5d2d2c;}function getSqlClauses(){var _0x36cc16={'default':squel[_0xc5a8('0x24')](),'fields':squel[_0xc5a8('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel['expr'](),'skip':![]}};return _0x36cc16;}function parseTagParameter(_0x332ee2){var _0x1150b4=squel[_0xc5a8('0x24')]();if(_0x332ee2){var _0x403b80=utils['getSelectedTags'](_0x332ee2);_0x403b80[_0xc5a8('0x22')](function(_0x8b6473){_0x1150b4['or'](_0xc5a8('0x25'),'%,'+_0x8b6473+',%');});}return _0x1150b4;}function parseSearchFilter(_0x36d2c6){var _0x5d8e5e=squel[_0xc5a8('0x24')]();if(_0x36d2c6){var _0x4865dd=_0x36d2c6[_0xc5a8('0x26')]('\x5c','\x5c\x5c')[_0xc5a8('0x26')](/'/g,'\x27\x27');if(_0x4865dd[_0xc5a8('0x27')]('\x20')[_0xc5a8('0x28')]>0x1){_0x5d8e5e['or'](_0xc5a8('0x29'),qs[_0xc5a8('0x2a')](_0x4865dd),null);}else{if(qs[_0xc5a8('0x2b')](_0x4865dd)){_0x5d8e5e['or'](_0xc5a8('0x2c'),_0x4865dd+'%');_0x5d8e5e['or'](_0xc5a8('0x2d'),_0x4865dd+'%');_0x5d8e5e['or'](_0xc5a8('0x2e'),_0x4865dd+'%');_0x5d8e5e['or'](_0xc5a8('0x2f'),_0x4865dd+'%');}else if(qs[_0xc5a8('0x30')](_0x4865dd)){_0x5d8e5e['or'](_0xc5a8('0x31'),_0x4865dd+'%');}else{_0x5d8e5e['or']('c.firstName\x20LIKE\x20?','%'+_0x4865dd+'%');_0x5d8e5e['or'](_0xc5a8('0x32'),'%'+_0x4865dd+'%');_0x5d8e5e['or']('c.email\x20LIKE\x20?','%'+_0x4865dd+'%');}}}return _0x5d8e5e;}function parseAdvancedSearchFilter(_0x32ef14,_0x58bd05){var _0x19e4f4=getSqlClauses();var _0x18e89e=as['parseSearch'](_0x32ef14);var _0x10569a=_0x18e89e[_0xc5a8('0x33')];for(var _0x45da21=0x0;_0x45da21<_0x18e89e[_0xc5a8('0x34')][_0xc5a8('0x28')];_0x45da21++){var _0x2d7fae=_0x18e89e[_0xc5a8('0x34')][_0x45da21];var _0x4ec715='c';var _0x106a0b=_[_0xc5a8('0x35')](_0x58bd05,[_0xc5a8('0x36'),_0x2d7fae[_0xc5a8('0x23')]]);if(_0x106a0b){if(_0x2d7fae[_0xc5a8('0x23')]===_0xc5a8('0x37')||_0x106a0b[_0xc5a8('0x38')]===_0xc5a8('0x39')){_0x2d7fae[_0xc5a8('0x3a')]=_0xc5a8('0x3b');}var _0x450e89=as[_0xc5a8('0x3c')](_0x4ec715,_0x106a0b[_0xc5a8('0x3d')],_0x2d7fae);_0x19e4f4[_0xc5a8('0x3e')][_0x10569a](_0x450e89[_0xc5a8('0x3f')],_0x450e89['value']['start'],_0x450e89[_0xc5a8('0x40')][_0xc5a8('0x41')]);}else{if(_0x2d7fae[_0xc5a8('0x23')]==='Tag'){var _0x1f7b02=_0x2d7fae[_0xc5a8('0x40')][_0xc5a8('0x27')](',')[_0xc5a8('0x42')](function(_0x5883f5){return Number(_0x5883f5);});var _0x47f410=parseTagParameter(_0x1f7b02);_0x19e4f4['tags'][_0xc5a8('0x43')][_0xc5a8('0x44')](_0x47f410);_0x19e4f4[_0xc5a8('0x45')][_0xc5a8('0x46')]=_0x1f7b02;}else if(_0x2d7fae[_0xc5a8('0x23')]==='User'){_0x19e4f4[_0xc5a8('0x47')][_0xc5a8('0x43')]['and'](_0xc5a8('0x48'),_0x2d7fae['value']);_0x19e4f4[_0xc5a8('0x47')][_0xc5a8('0x49')]=!![];}}}return _0x19e4f4;}function parseModelFields(_0x1025a1,_0x744c77){var _0x176a25=squel[_0xc5a8('0x24')]();var _0x525066=_(_0x1025a1)[_0xc5a8('0x4a')]()[_0xc5a8('0x42')](function(_0x429260){return _[_0xc5a8('0x4b')](_0x744c77,[_0xc5a8('0x36'),_0x429260])?_0x429260:undefined;})[_0xc5a8('0x4c')]()[_0xc5a8('0x40')]();if(_0x1025a1[_0xc5a8('0x4d')]){_0x525066['push'](_0xc5a8('0x4d'));}if(_0x525066[_0xc5a8('0x28')]>0x0){_0x525066[_0xc5a8('0x22')](function(_0x424904){if(_0x424904==='ListId'){_0x176a25[_0xc5a8('0x44')]('c.ListId\x20IN\x20?',[][_0xc5a8('0x4e')](_0x1025a1[_0x424904]));}else if(_0x424904===_0xc5a8('0x4d')){var _0x3207dd='%'+_0x1025a1[_0x424904]+'%';_0x176a25['and'](_0xc5a8('0x4f'),_0x3207dd);}else{_0x176a25[_0xc5a8('0x44')]('c.'+_0x424904+_0xc5a8('0x50'),_0x1025a1[_0x424904]);}});}return _0x176a25;}function parseQueryParameters(_0x4e058f,_0x56229b){var _0x5ee3b6=getSqlClauses();return Promise[_0xc5a8('0x51')]()[_0xc5a8('0x52')](function(){return parseModelFields(_0x4e058f,_0x56229b);})[_0xc5a8('0x52')](function(_0x4a9b4c){_0x5ee3b6[_0xc5a8('0x53')]['and'](_0x4a9b4c);return parseTagParameter(_0x4e058f['tag']);})['then'](function(_0x5a0adb){_0x5ee3b6['tags']['clause'][_0xc5a8('0x44')](_0x5a0adb);return parseSearchFilter(_0x4e058f[_0xc5a8('0x54')]);})[_0xc5a8('0x52')](function(_0x36945b){_0x5ee3b6[_0xc5a8('0x54')]=_0x36945b;return _0x5ee3b6;});}function checkListsRestrictions(_0x8402d8,_0x14a4f1,_0x2a7560){var _0x35849f=squel['expr']();return Promise[_0xc5a8('0x51')]()[_0xc5a8('0x52')](function(){if(_0x14a4f1[_0xc5a8('0x6')]&&_0x8402d8[_0xc5a8('0x5')]==='agent'&&!_0x2a7560){return _0x8402d8[_0xc5a8('0x55')]({'attributes':['id'],'raw':!![]});}})[_0xc5a8('0x52')](function(_0x2613cb){if(_0x2613cb){if(_0x2613cb[_0xc5a8('0x28')]===0x0){_0x35849f['and']('c.ListId\x20IS\x20NULL');}else{_0x35849f[_0xc5a8('0x44')](_0xc5a8('0x56'),_[_0xc5a8('0x42')](_0x2613cb,'id'));}}})['then'](function(){return _0x35849f;});}function buildContactsQuery(_0x28f37a,_0xe0f0eb,_0x2a11c4,_0x2981fa,_0x2c726c,_0x5b6d4b){if(_0xe0f0eb){_0xe0f0eb=_0x2a11c4[_0xc5a8('0x57')];}_0x28f37a=addFieldsToQuery(_0x28f37a,_0xe0f0eb,_0x2981fa,_0x5b6d4b,!![]);var _0x4f40a4=squel[_0xc5a8('0xa')]();_0x4f40a4=addFieldsToQuery(_0x4f40a4,_0xe0f0eb,_0x2981fa,_0x5b6d4b,![]);if(_0x2981fa||_0x5b6d4b){_0x28f37a=applyJoinClauses(_0x28f37a,!![]);_0x28f37a[_0xc5a8('0x58')]('c.id');if(_0x2a11c4['limit']){_0x4f40a4[_0xc5a8('0x59')](_0x2a11c4[_0xc5a8('0x59')]);}if(_0x2a11c4['offset']){_0x4f40a4['offset'](_0x2a11c4[_0xc5a8('0x5a')]);}}else{_0x4f40a4=applyJoinClauses(_0x4f40a4,![]);_0x4f40a4[_0xc5a8('0x58')](_0xc5a8('0x5b'));if(_0x2a11c4[_0xc5a8('0x59')]){_0x28f37a[_0xc5a8('0x59')](_0x2a11c4[_0xc5a8('0x59')]);}if(_0x2a11c4['offset']){_0x28f37a['offset'](_0x2a11c4['offset']);}}_0x4f40a4['having'](_0x2c726c);if(_0x2a11c4[_0xc5a8('0x5c')]){_0x2a11c4[_0xc5a8('0x5c')][_0xc5a8('0x22')](function(_0x4a930c){_0x28f37a['order']('c.'+_0x4a930c[0x0],_0x4a930c[0x1]===_0xc5a8('0x5d')?![]:!![]);_0x4f40a4[_0xc5a8('0x5c')]('subqry.'+_0x4a930c[0x0],_0x4a930c[0x1]==='DESC'?![]:!![]);});}_0x4f40a4[_0xc5a8('0xb')](_0x28f37a,_0xc5a8('0xf'));return _0x4f40a4;}function getFilteredContacts(_0xa227dd){var _0x57ce70=[];return db[_0xc5a8('0x5e')][_0xc5a8('0x5f')]({'attributes':['id',_0xc5a8('0x36'),_0xc5a8('0x60')],'raw':!![]})[_0xc5a8('0x52')](function(_0x1e5100){_0x57ce70=_['keyBy'](_0x1e5100,'id');var _0x2ad8c5={'type':db[_0xc5a8('0x61')][_0xc5a8('0x62')]['SELECT'],'model':db[_0xc5a8('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xc5a8('0x64')][_0xc5a8('0x65')](_0xa227dd[_0xc5a8('0x66')](),_0x2ad8c5);})[_0xc5a8('0x52')](function(_0x422717){_0x422717[_0xc5a8('0x22')](function(_0x2a8e77){if(_0x2a8e77[_0xc5a8('0x21')]){_0x2a8e77[_0xc5a8('0x67')]=[];_0x2a8e77['TagIds']['split'](',')[_0xc5a8('0x22')](function(_0x7b5b7){_0x2a8e77[_0xc5a8('0x67')][_0xc5a8('0x68')](_0x57ce70[_0x7b5b7]);});}delete _0x2a8e77[_0xc5a8('0x21')];});return _0x422717;});}function countFilteredContacts(_0x5d9cf9,_0x46a754){var _0x3d8468=_0x5d9cf9['clone']();_0x3d8468[_0xc5a8('0x23')](_0xc5a8('0x69'));_0x3d8468=applyJoinClauses(_0x3d8468,!![]);_0x5d9cf9[_0xc5a8('0x58')](_0xc5a8('0x6a'));var _0x466248=utils[_0xc5a8('0x6b')](_0x46a754);if(!_[_0xc5a8('0x6c')](_0x466248)){_0x3d8468['where'](_0xc5a8('0x6d'),_0x466248);}var _0x53b074={'type':db[_0xc5a8('0x61')][_0xc5a8('0x62')][_0xc5a8('0x6e')],'raw':!![]};return db[_0xc5a8('0x64')][_0xc5a8('0x65')](_0x3d8468[_0xc5a8('0x66')](),_0x53b074)['then'](function(_0x3a3986){return _0x3a3986[0x0][_0xc5a8('0x69')];});}module[_0xc5a8('0x6f')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index e6689db..cb5d788 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 _0x8535=['binary','write','final','end','unlink','decryptFile','createWriteStream','createDecipher','close','encryptString','secret','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update'];(function(_0xee0ada,_0x69c6ca){var _0x2a9d5a=function(_0x4ae4db){while(--_0x4ae4db){_0xee0ada['push'](_0xee0ada['shift']());}};_0x2a9d5a(++_0x69c6ca);}(_0x8535,0x77));var _0x5853=function(_0x2de0b4,_0x252563){_0x2de0b4=_0x2de0b4-0x0;var _0x637314=_0x8535[_0x2de0b4];return _0x637314;};'use strict';var crypto=require(_0x5853('0x0'));var fs=require('fs');var BPromise=require(_0x5853('0x1'));var _=require(_0x5853('0x2'));var config=require(_0x5853('0x3'));var logger=require(_0x5853('0x4'))(_0x5853('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5853('0x6')][_0x5853('0x7')],'algorithm':_0x5853('0x8')};const fileOptions={'algorithm':_0x5853('0x9')};if(config['encrypt']&&config[_0x5853('0xa')][_0x5853('0xb')]){var isSupported=isAlgorithmSupported(config[_0x5853('0xa')][_0x5853('0xb')]);if(isSupported){fileOptions[_0x5853('0xb')]=config['encrypt'][_0x5853('0xb')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x5853('0xc')](',\x20');logger[_0x5853('0xd')](config['encrypt'][_0x5853('0xb')],_0x5853('0xe'),supportedAlgorithms);}}function isASupportedCipher(_0x23db59){return AES_SUPPORTED_RX['test'](_0x23db59);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x26bb8b){return getSupportedCiphers()['indexOf'](_0x26bb8b)>-0x1;}function combineOptions(_0x3e44b5){var _0x33ab1c={};for(var _0xb02598 in fileOptions){if(fileOptions[_0x5853('0xf')](_0xb02598)){_0x33ab1c[_0xb02598]=fileOptions[_0xb02598];}}if(_0x3e44b5){for(var _0x3d9b3c in _0x3e44b5){if(_0x3e44b5[_0x5853('0xf')](_0x3d9b3c)){_0x33ab1c[_0x3d9b3c]=_0x3e44b5[_0x3d9b3c];}}}return _0x33ab1c;}exports[_0x5853('0x10')]=function(_0x589dd7,_0x1361f4,_0xfeb127,_0x16e0a3){return new BPromise(function(_0x429588,_0x4fb4be){_0x16e0a3=combineOptions(_0x16e0a3);var _0x4183e1=new Buffer(_0xfeb127);var _0x4811ad=fs[_0x5853('0x11')](_0x589dd7);var _0x5b9cd1=fs['createWriteStream'](_0x1361f4);var _0x1e7191=crypto[_0x5853('0x12')](_0x16e0a3[_0x5853('0xb')],_0x4183e1);_0x4811ad['on'](_0x5853('0x13'),function(_0x207bfd){var _0x42655c=new Buffer(_0x1e7191[_0x5853('0x14')](_0x207bfd),_0x5853('0x15'));_0x5b9cd1[_0x5853('0x16')](_0x42655c);});_0x4811ad['on']('end',function(){try{var _0x9592e4=new Buffer(_0x1e7191[_0x5853('0x17')](_0x5853('0x15')),'binary');_0x5b9cd1[_0x5853('0x16')](_0x9592e4);_0x5b9cd1[_0x5853('0x18')]();_0x5b9cd1['on']('close',function(){return _0x429588(_0x1361f4);});}catch(_0x11dc10){fs[_0x5853('0x19')](_0x1361f4);return _0x4fb4be(_0x11dc10);}});});};exports[_0x5853('0x1a')]=function(_0x9aa48f,_0x33d677,_0x4b81b4,_0x4d0edd){return new BPromise(function(_0x19ae37,_0x35438d){_0x4d0edd=combineOptions(_0x4d0edd);var _0x3627f7=new Buffer(_0x4b81b4);var _0x1440bb=fs[_0x5853('0x11')](_0x9aa48f);var _0x7cae3a=fs[_0x5853('0x1b')](_0x33d677);var _0x3048ba=crypto[_0x5853('0x1c')](_0x4d0edd['algorithm'],_0x3627f7);_0x1440bb['on'](_0x5853('0x13'),function(_0x548be9){var _0x77ad42=new Buffer(_0x3048ba[_0x5853('0x14')](_0x548be9),_0x5853('0x15'));_0x7cae3a[_0x5853('0x16')](_0x77ad42);});_0x1440bb['on'](_0x5853('0x18'),function(){try{var _0x37bc17=new Buffer(_0x3048ba[_0x5853('0x17')](_0x5853('0x15')),'binary');_0x7cae3a[_0x5853('0x16')](_0x37bc17);_0x7cae3a[_0x5853('0x18')]();_0x7cae3a['on'](_0x5853('0x1d'),function(){return _0x19ae37(_0x33d677);});}catch(_0x5f3b1e){fs[_0x5853('0x19')](_0x33d677);return _0x35438d(_0x5f3b1e);}});});};exports[_0x5853('0x1e')]=function(_0x2a73f5,_0x2acddd,_0x373806){var _0x227fed=_0x373806||stringOptions[_0x5853('0xb')];var _0x521aec=_0x2acddd||stringOptions[_0x5853('0x1f')];var _0x2ebc61=crypto['createCipher'](_0x227fed,_0x521aec);var _0x4fabaa=_0x2ebc61[_0x5853('0x14')](_0x2a73f5,_0x5853('0x20'),_0x5853('0x21'));_0x4fabaa+=_0x2ebc61[_0x5853('0x17')](_0x5853('0x21'));return _0x4fabaa;};exports[_0x5853('0x22')]=function(_0x403ea0,_0x3c6d9b,_0xefd344){var _0x3d48f9=_0xefd344||stringOptions[_0x5853('0xb')];var _0x18a1d6=_0x3c6d9b||stringOptions[_0x5853('0x1f')];var _0x4c4b8c=crypto['createDecipher'](_0x3d48f9,_0x18a1d6);var _0x251e37=_0x4c4b8c[_0x5853('0x14')](_0x403ea0,_0x5853('0x21'),'utf8');_0x251e37+=_0x4c4b8c[_0x5853('0x17')](_0x5853('0x20'));return _0x251e37;}; \ No newline at end of file +var _0xbd62=['algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','utf8','base64','decryptString','secret','crypto','lodash','../../config/logger','app','secrets','session','aes192','encrypt'];(function(_0x30bb72,_0x3a834c){var _0x37a343=function(_0x55ff7a){while(--_0x55ff7a){_0x30bb72['push'](_0x30bb72['shift']());}};_0x37a343(++_0x3a834c);}(_0xbd62,0x1d4));var _0x2bd6=function(_0x40f647,_0x3d599e){_0x40f647=_0x40f647-0x0;var _0x5593d2=_0xbd62[_0x40f647];return _0x5593d2;};'use strict';var crypto=require(_0x2bd6('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x2bd6('0x1'));var config=require('../../config/environment');var logger=require(_0x2bd6('0x2'))(_0x2bd6('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2bd6('0x4')][_0x2bd6('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x2bd6('0x6')};if(config[_0x2bd6('0x7')]&&config[_0x2bd6('0x7')][_0x2bd6('0x8')]){var isSupported=isAlgorithmSupported(config[_0x2bd6('0x7')][_0x2bd6('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x2bd6('0x7')][_0x2bd6('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x2bd6('0x9')](',\x20');logger[_0x2bd6('0xa')](config[_0x2bd6('0x7')][_0x2bd6('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x2d55d0){return AES_SUPPORTED_RX[_0x2bd6('0xb')](_0x2d55d0);}function getSupportedCiphers(){return crypto[_0x2bd6('0xc')]()[_0x2bd6('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x3510dd){return getSupportedCiphers()[_0x2bd6('0xe')](_0x3510dd)>-0x1;}function combineOptions(_0x204170){var _0x411696={};for(var _0x9f0981 in fileOptions){if(fileOptions[_0x2bd6('0xf')](_0x9f0981)){_0x411696[_0x9f0981]=fileOptions[_0x9f0981];}}if(_0x204170){for(var _0xa59f4c in _0x204170){if(_0x204170[_0x2bd6('0xf')](_0xa59f4c)){_0x411696[_0xa59f4c]=_0x204170[_0xa59f4c];}}}return _0x411696;}exports[_0x2bd6('0x10')]=function(_0x51397e,_0x429410,_0x463791,_0x553736){return new BPromise(function(_0x3b5cc4,_0x582f72){_0x553736=combineOptions(_0x553736);var _0x51eea4=new Buffer(_0x463791);var _0x191528=fs[_0x2bd6('0x11')](_0x51397e);var _0x21623c=fs[_0x2bd6('0x12')](_0x429410);var _0x53b163=crypto[_0x2bd6('0x13')](_0x553736[_0x2bd6('0x8')],_0x51eea4);_0x191528['on'](_0x2bd6('0x14'),function(_0x452265){var _0x220567=new Buffer(_0x53b163[_0x2bd6('0x15')](_0x452265),_0x2bd6('0x16'));_0x21623c[_0x2bd6('0x17')](_0x220567);});_0x191528['on'](_0x2bd6('0x18'),function(){try{var _0x26a3a4=new Buffer(_0x53b163[_0x2bd6('0x19')](_0x2bd6('0x16')),_0x2bd6('0x16'));_0x21623c[_0x2bd6('0x17')](_0x26a3a4);_0x21623c[_0x2bd6('0x18')]();_0x21623c['on'](_0x2bd6('0x1a'),function(){return _0x3b5cc4(_0x429410);});}catch(_0x580d3b){fs[_0x2bd6('0x1b')](_0x429410);return _0x582f72(_0x580d3b);}});});};exports[_0x2bd6('0x1c')]=function(_0x40dbcf,_0x5db09d,_0x1e07bf,_0x6fbb58){return new BPromise(function(_0x187fdd,_0x3d6cf8){_0x6fbb58=combineOptions(_0x6fbb58);var _0x350205=new Buffer(_0x1e07bf);var _0x29c50c=fs['createReadStream'](_0x40dbcf);var _0x1dbcbd=fs[_0x2bd6('0x12')](_0x5db09d);var _0x3efcac=crypto[_0x2bd6('0x1d')](_0x6fbb58[_0x2bd6('0x8')],_0x350205);_0x29c50c['on'](_0x2bd6('0x14'),function(_0x481500){var _0x416026=new Buffer(_0x3efcac[_0x2bd6('0x15')](_0x481500),_0x2bd6('0x16'));_0x1dbcbd[_0x2bd6('0x17')](_0x416026);});_0x29c50c['on'](_0x2bd6('0x18'),function(){try{var _0x3a3223=new Buffer(_0x3efcac['final'](_0x2bd6('0x16')),_0x2bd6('0x16'));_0x1dbcbd[_0x2bd6('0x17')](_0x3a3223);_0x1dbcbd[_0x2bd6('0x18')]();_0x1dbcbd['on'](_0x2bd6('0x1a'),function(){return _0x187fdd(_0x5db09d);});}catch(_0x3c864c){fs[_0x2bd6('0x1b')](_0x5db09d);return _0x3d6cf8(_0x3c864c);}});});};exports['encryptString']=function(_0x43d334,_0x867047,_0x4d9d00){var _0x187c47=_0x4d9d00||stringOptions['algorithm'];var _0x1d8555=_0x867047||stringOptions['secret'];var _0x67eb6b=crypto['createCipher'](_0x187c47,_0x1d8555);var _0x4310d4=_0x67eb6b[_0x2bd6('0x15')](_0x43d334,_0x2bd6('0x1e'),_0x2bd6('0x1f'));_0x4310d4+=_0x67eb6b['final'](_0x2bd6('0x1f'));return _0x4310d4;};exports[_0x2bd6('0x20')]=function(_0x12d93e,_0x5656ee,_0x1b9461){var _0x46e85d=_0x1b9461||stringOptions[_0x2bd6('0x8')];var _0x345f20=_0x5656ee||stringOptions[_0x2bd6('0x21')];var _0x5e2e46=crypto['createDecipher'](_0x46e85d,_0x345f20);var _0x28de1a=_0x5e2e46['update'](_0x12d93e,_0x2bd6('0x1f'),_0x2bd6('0x1e'));_0x28de1a+=_0x5e2e46[_0x2bd6('0x19')](_0x2bd6('0x1e'));return _0x28de1a;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index eea3d9b..84203bd 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 _0x3605=['AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','splitSizeCsv','then','sequelize','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x3605,0xee));var _0x5360=function(_0x3e27e5,_0x49f888){_0x3e27e5=_0x3e27e5-0x0;var _0x1a2bbc=_0x3605[_0x3e27e5];return _0x1a2bbc;};'use strict';var util=require(_0x5360('0x0'));var path=require(_0x5360('0x1'));var _=require(_0x5360('0x2'));var csv=require(_0x5360('0x3'));var fs=require('fs');var BPromise=require(_0x5360('0x4'));var zipdir=require(_0x5360('0x5'));var rimraf=require(_0x5360('0x6'));var db=require(_0x5360('0x7'))['db'];var dbH=require(_0x5360('0x7'))[_0x5360('0x8')];var logger=require('../../config/logger')(_0x5360('0x9'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x5360('0xa')][0x3];var PATH=process[_0x5360('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ad37a,_0x4bac27){var _0x5e5027={'status':_0x2ad37a};var _0xba6d92={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4bac27){_0x5e5027[_0x5360('0xb')]=_0x4bac27;}return db[_0x5360('0xc')][_0x5360('0xd')](_0x5e5027,_0xba6d92);}function main(){var _0x192adc=0x1388;var _0x17d9d2;logger['info'](util['format'](_0x5360('0xe'),EXTRACTED_REPORT_ID,_0x5360('0xf')));return db['Setting'][_0x5360('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x5360('0x11'),_0x5360('0x12')]})[_0x5360('0x13')](function(_0x1898e7){if(_0x1898e7){_0x17d9d2=_0x1898e7;_0x192adc=_0x17d9d2[_0x5360('0x12')]||0x1388;}})[_0x5360('0x13')](function(){return dbH[_0x5360('0x14')]['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x5360('0x14')][_0x5360('0x15')][_0x5360('0x16')]});})['then'](function(_0x588b11){if(!_0x588b11[0x0][_0x5360('0x17')]){return analyticExtractedReport('Empty');}var _0x13769f=[];var _0x1d34f1=0x0;if(_0x17d9d2[_0x5360('0x11')]){if(_0x588b11&&_0x588b11[_0x5360('0x18')]){var _0x3b9f6a=_[_0x5360('0x19')](_0x588b11[0x0][_0x5360('0x17')]/_0x192adc);var _0x3af3a5=Number[_0x5360('0x1a')](_0x588b11[0x0][_0x5360('0x17')]/_0x192adc)?_0x588b11[0x0]['num']%_0x192adc:0x0;_0x3b9f6a[_0x5360('0x1b')](function(_0x541775){if(_0x541775>0x0){_0x1d34f1+=_0x192adc;}_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')][_0x5360('0x1d')](util[_0x5360('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x192adc,_0x1d34f1),{'type':dbH['sequelize'][_0x5360('0x15')][_0x5360('0x16')]}));});if(_0x3af3a5>0x0){_0x1d34f1+=_0x192adc;_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')]['query'](util[_0x5360('0x1e')](_0x5360('0x1f'),QUERY,_0x3af3a5,_0x1d34f1),{'type':dbH['sequelize'][_0x5360('0x15')][_0x5360('0x16')]}));}}}else{_0x13769f[_0x5360('0x1c')](dbH[_0x5360('0x14')]['query'](QUERY,{'type':dbH[_0x5360('0x14')][_0x5360('0x15')][_0x5360('0x16')]}));}var _0xd95f39=path[_0x5360('0x20')](PATH);var _0x5d7d61=path[_0x5360('0x21')](PATH,_0x5360('0x22'));var _0x5b870d=_0x17d9d2[_0x5360('0x11')]&&_0x13769f['length']>0x1;var _0x31ed36=[];if(!fs[_0x5360('0x23')](path['join'](_0xd95f39,_0x5d7d61))&&_0x5b870d){fs['mkdirSync'](path[_0x5360('0x24')](_0xd95f39,_0x5d7d61));}return BPromise[_0x5360('0x25')](_0x13769f,function(_0x497bb){_0x31ed36[_0x5360('0x1c')](_0x497bb);})[_0x5360('0x13')](function(){for(var _0x3190a0=0x0;_0x3190a0<_0x31ed36[_0x5360('0x18')];_0x3190a0+=0x1){var _0x63b534;var _0xa5711=_0x31ed36[_0x3190a0];if(_0x5b870d){_0x63b534=path[_0x5360('0x24')](_0xd95f39,_0x5d7d61,util['format'](_0x5360('0x26'),_0x5d7d61,_0x3190a0,_0x5360('0x27')));}else{_0x63b534=path['join'](_0xd95f39,util[_0x5360('0x1e')](_0x5360('0x28'),_0x5d7d61,'csv'));}fs['writeFileSync'](_0x63b534,csv(_0xa5711));}})[_0x5360('0x13')](function(){if(_0x5b870d){return new Promise(function(_0x32e87c){zipdir(path[_0x5360('0x24')](_0xd95f39,_0x5d7d61),{'saveTo':path['join'](_0xd95f39,util[_0x5360('0x1e')](_0x5360('0x28'),_0x5d7d61,_0x5360('0x29')))},function(_0xa98e68,_0x272f6a){rimraf(path[_0x5360('0x24')](_0xd95f39,_0x5d7d61),function(){});_0x32e87c(_0x5360('0x2a'));});});}})[_0x5360('0x13')](function(){logger[_0x5360('0x2b')](util['format'](_0x5360('0x2c'),EXTRACTED_REPORT_ID,_0x5360('0xf')));return analyticExtractedReport(_0x5360('0x2d'),_0x5b870d?util['format'](_0x5360('0x28'),_0x5d7d61,_0x5b870d?'zip':_0x5360('0x27')):null);});})['catch'](function(_0x383816){logger[_0x5360('0x2b')](util[_0x5360('0x1e')](_0x5360('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x5360('0x2f')](_0x383816,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x5360('0x30'));})['finally'](function(){process[_0x5360('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7cd3=['path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','then','length','range','num','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','zip\x20finished','Completed','catch','Failed','finally','exit'];(function(_0x3b9352,_0x3f6512){var _0x5735e8=function(_0x215fc2){while(--_0x215fc2){_0x3b9352['push'](_0x3b9352['shift']());}};_0x5735e8(++_0x3f6512);}(_0x7cd3,0x13b));var _0x37cd=function(_0x5460ad,_0xcca900){_0x5460ad=_0x5460ad-0x0;var _0x475843=_0x7cd3[_0x5460ad];return _0x475843;};'use strict';var util=require('util');var path=require(_0x37cd('0x0'));var _=require(_0x37cd('0x1'));var csv=require(_0x37cd('0x2'));var fs=require('fs');var BPromise=require(_0x37cd('0x3'));var zipdir=require(_0x37cd('0x4'));var rimraf=require(_0x37cd('0x5'));var db=require(_0x37cd('0x6'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x37cd('0x7'))(_0x37cd('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x37cd('0x9')][0x2]);var QUERY=process[_0x37cd('0x9')][0x3];var PATH=process[_0x37cd('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x35f989,_0x21922d){var _0x26ec06={'status':_0x35f989};var _0x4489d8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x21922d){_0x26ec06[_0x37cd('0xa')]=_0x21922d;}return db[_0x37cd('0xb')]['update'](_0x26ec06,_0x4489d8);}function main(){var _0xcf3619=0x1388;var _0x48b4cb;logger[_0x37cd('0xc')](util['format'](_0x37cd('0xd'),EXTRACTED_REPORT_ID,_0x37cd('0xe')));return db[_0x37cd('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x37cd('0x10'),'splitSizeCsv']})['then'](function(_0x1be1e5){if(_0x1be1e5){_0x48b4cb=_0x1be1e5;_0xcf3619=_0x48b4cb[_0x37cd('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x37cd('0x12')](util['format'](_0x37cd('0x13'),QUERY),{'type':dbH[_0x37cd('0x14')][_0x37cd('0x15')][_0x37cd('0x16')]});})[_0x37cd('0x17')](function(_0x12d8f3){if(!_0x12d8f3[0x0]['num']){return analyticExtractedReport('Empty');}var _0x299f7c=[];var _0x87380d=0x0;if(_0x48b4cb[_0x37cd('0x10')]){if(_0x12d8f3&&_0x12d8f3[_0x37cd('0x18')]){var _0x127d7c=_[_0x37cd('0x19')](_0x12d8f3[0x0]['num']/_0xcf3619);var _0x21f7e6=Number['isInteger'](_0x12d8f3[0x0][_0x37cd('0x1a')]/_0xcf3619)?_0x12d8f3[0x0][_0x37cd('0x1a')]%_0xcf3619:0x0;_0x127d7c['forEach'](function(_0xebae2b){if(_0xebae2b>0x0){_0x87380d+=_0xcf3619;}_0x299f7c[_0x37cd('0x1b')](dbH[_0x37cd('0x14')][_0x37cd('0x12')](util[_0x37cd('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xcf3619,_0x87380d),{'type':dbH[_0x37cd('0x14')]['QueryTypes'][_0x37cd('0x16')]}));});if(_0x21f7e6>0x0){_0x87380d+=_0xcf3619;_0x299f7c[_0x37cd('0x1b')](dbH[_0x37cd('0x14')][_0x37cd('0x12')](util[_0x37cd('0x1c')](_0x37cd('0x1d'),QUERY,_0x21f7e6,_0x87380d),{'type':dbH[_0x37cd('0x14')][_0x37cd('0x15')][_0x37cd('0x16')]}));}}}else{_0x299f7c['push'](dbH[_0x37cd('0x14')][_0x37cd('0x12')](QUERY,{'type':dbH[_0x37cd('0x14')][_0x37cd('0x15')][_0x37cd('0x16')]}));}var _0x459a18=path['dirname'](PATH);var _0x4b6418=path[_0x37cd('0x1e')](PATH,'.csv');var _0x4ac3a1=_0x48b4cb[_0x37cd('0x10')]&&_0x299f7c[_0x37cd('0x18')]>0x1;var _0x36b4c2=[];if(!fs[_0x37cd('0x1f')](path[_0x37cd('0x20')](_0x459a18,_0x4b6418))&&_0x4ac3a1){fs[_0x37cd('0x21')](path['join'](_0x459a18,_0x4b6418));}return BPromise[_0x37cd('0x22')](_0x299f7c,function(_0x5ece6b){_0x36b4c2[_0x37cd('0x1b')](_0x5ece6b);})[_0x37cd('0x17')](function(){for(var _0x35bb53=0x0;_0x35bb53<_0x36b4c2[_0x37cd('0x18')];_0x35bb53+=0x1){var _0x12534f;var _0x351026=_0x36b4c2[_0x35bb53];if(_0x4ac3a1){_0x12534f=path['join'](_0x459a18,_0x4b6418,util[_0x37cd('0x1c')](_0x37cd('0x23'),_0x4b6418,_0x35bb53,_0x37cd('0x24')));}else{_0x12534f=path[_0x37cd('0x20')](_0x459a18,util['format'](_0x37cd('0x25'),_0x4b6418,_0x37cd('0x24')));}fs['writeFileSync'](_0x12534f,csv(_0x351026));}})['then'](function(){if(_0x4ac3a1){return new Promise(function(_0x74e632){zipdir(path[_0x37cd('0x20')](_0x459a18,_0x4b6418),{'saveTo':path[_0x37cd('0x20')](_0x459a18,util[_0x37cd('0x1c')]('%s.%s',_0x4b6418,_0x37cd('0x26')))},function(_0x2d64fa,_0x377181){rimraf(path[_0x37cd('0x20')](_0x459a18,_0x4b6418),function(){});_0x74e632(_0x37cd('0x27'));});});}})[_0x37cd('0x17')](function(){logger[_0x37cd('0xc')](util[_0x37cd('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x37cd('0xe')));return analyticExtractedReport(_0x37cd('0x28'),_0x4ac3a1?util[_0x37cd('0x1c')](_0x37cd('0x25'),_0x4b6418,_0x4ac3a1?'zip':_0x37cd('0x24')):null);});})[_0x37cd('0x29')](function(_0x7a0844){logger[_0x37cd('0xc')](util[_0x37cd('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x37cd('0xe')),util['inspect'](_0x7a0844,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x37cd('0x2a'));})[_0x37cd('0x2b')](function(){process[_0x37cd('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6e2006d..f9eb4c4 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 _0x4ba5=['chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','push','pageBreak','before','landscape','\x20/\x20','black','right','num','Empty','find','split','splitSizePdf','then','range','isInteger','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','mkdirSync','join','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','pdf','all','zip\x20finished','info','PDF','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','header','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','toString','value','fill','length','auto','body','concat'];(function(_0x417dd9,_0x34c874){var _0x7e7052=function(_0x31fb53){while(--_0x31fb53){_0x417dd9['push'](_0x417dd9['shift']());}};_0x7e7052(++_0x34c874);}(_0x4ba5,0x102));var _0x54ba=function(_0x404957,_0x5192a4){_0x404957=_0x404957-0x0;var _0x4e0365=_0x4ba5[_0x404957];return _0x4e0365;};'use strict';var _=require(_0x54ba('0x0'));var fs=require('fs');var util=require(_0x54ba('0x1'));var path=require(_0x54ba('0x2'));var moment=require(_0x54ba('0x3'));var htmlToPdfmake=require(_0x54ba('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x54ba('0x5'));var rimraf=require('rimraf');var JSDOM=require(_0x54ba('0x6'))[_0x54ba('0x7')];var window=new JSDOM('')[_0x54ba('0x8')];var BPromise=require(_0x54ba('0x9'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x54ba('0xa')];var logger=require(_0x54ba('0xb'))(_0x54ba('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x54ba('0xd')][0x2]);var QUERY=process[_0x54ba('0xd')][0x3];var PATH=process[_0x54ba('0xd')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x54ba('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x773d62,_0x505ccb){var _0x53f364={'status':_0x773d62};var _0x5bbebc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x505ccb){_0x53f364[_0x54ba('0xf')]=_0x505ccb;}return db[_0x54ba('0x10')][_0x54ba('0x11')](_0x53f364,_0x5bbebc);}function getHeaders(_0x126e9d){return _['map'](_0x126e9d,function(_0x277fe2){return{'text':_0x277fe2,'style':_0x54ba('0x12')};});}function getRows(_0x1e3c1d,_0x1b7871){return _[_0x54ba('0x13')](_0x1b7871,function(_0x1a24cc){return _(_0x1a24cc)['pick'](_0x1e3c1d)[_0x54ba('0x13')](function(_0x37a555){return _0x37a555?_[_0x54ba('0x14')](_0x37a555):'';})[_0x54ba('0x15')]();});}function createTable(_0x16425e,_0x388860){var _0x38b810={'widths':_[_0x54ba('0x16')](Array(_0x16425e[_0x54ba('0x17')]),0x91),'heights':function(_0x5f593a){return _0x5f593a===0x0?_0x54ba('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x4519e1=getHeaders(_0x16425e);_0x38b810[_0x54ba('0x19')]['push'](_0x4519e1);var _0x309d15=getRows(_0x16425e,_0x388860);_0x38b810[_0x54ba('0x19')]=_0x38b810[_0x54ba('0x19')][_0x54ba('0x1a')](_0x309d15);return _0x38b810;}function createTables(_0x1a61d6){var _0x1b84fe=[];var _0x539112=_[_0x54ba('0x1b')](Object[_0x54ba('0x1c')](_0x1a61d6[0x0]),0x5);_0x539112[_0x54ba('0x1d')](function(_0x57d9de){_0x1b84fe['push'](createTable(_0x57d9de,_0x1a61d6));});return _0x1b84fe;}function getPDFDocDefinition(_0x5d1740){var _0x35c40b=util[_0x54ba('0x1e')](_0x54ba('0x1f'),NAME,EXTRACTED_REPORT[_0x54ba('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0x54ba('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x54ba('0x21')])[_0x54ba('0x1e')](FORMAT));var _0x1abaca=[];for(var _0x487205=0x0;_0x487205<_0x5d1740[_0x54ba('0x17')];_0x487205++){var _0x4af202=[];if(_0x487205===0x0){_0x4af202[_0x54ba('0x22')]({'text':_0x35c40b,'style':'header'});}var _0x20a3c0={'table':_0x5d1740[_0x487205]};if(_0x487205>0x0){_0x20a3c0[_0x54ba('0x23')]=_0x54ba('0x24');_0x20a3c0['margin']=[0x0,0x46,0x0,0x0];}_0x4af202[_0x54ba('0x22')](_0x20a3c0);_0x1abaca[_0x54ba('0x22')](_0x4af202);}return{'pageSize':'A4','pageOrientation':_0x54ba('0x25'),'content':_0x1abaca,'footer':function(_0x2808a7,_0x17bc2a){return{'text':_0x2808a7['toString']()+_0x54ba('0x26')+_0x17bc2a,'style':'footer'};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x54ba('0x27')},'footer':{'alignment':_0x54ba('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x544e1f){var _0x17c72b=0x1388;var _0x30028b;if(!_0x544e1f[0x0][_0x54ba('0x29')]){return analyticExtractedReport(_0x54ba('0x2a'));}return db['Setting'][_0x54ba('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x54ba('0x2c'),_0x54ba('0x2d')]})[_0x54ba('0x2e')](function(_0xa162ad){if(_0xa162ad){_0x30028b=_0xa162ad;_0x17c72b=_0x30028b[_0x54ba('0x2d')]||0x3e8;}})[_0x54ba('0x2e')](function(){var _0x467263=[];var _0x5151ad=0x0;if(_0x30028b[_0x54ba('0x2c')]){if(_0x544e1f&&_0x544e1f['length']){var _0x2e9ee4=_[_0x54ba('0x2f')](_0x544e1f[0x0][_0x54ba('0x29')]/_0x17c72b);var _0x5d7ad5=Number[_0x54ba('0x30')](_0x544e1f[0x0]['num']/_0x17c72b)?_0x544e1f[0x0]['num']%_0x17c72b:0x0;_0x2e9ee4[_0x54ba('0x1d')](function(_0x1dc215){if(_0x1dc215>0x0){_0x5151ad+=_0x17c72b;}_0x467263[_0x54ba('0x22')](dbH['sequelize'][_0x54ba('0x31')](util[_0x54ba('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17c72b,_0x5151ad),{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]}));});if(_0x5d7ad5>0x0){_0x5151ad+=_0x17c72b;_0x467263[_0x54ba('0x22')](dbH[_0x54ba('0x32')][_0x54ba('0x31')](util[_0x54ba('0x1e')](_0x54ba('0x35'),QUERY,_0x5d7ad5,_0x5151ad),{'type':dbH[_0x54ba('0x32')]['QueryTypes']['SELECT']}));}}}else{_0x467263[_0x54ba('0x22')](dbH[_0x54ba('0x32')][_0x54ba('0x31')](QUERY,{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]}));}var _0x1c37f6=path['dirname'](PATH);var _0x3657d4=path[_0x54ba('0x36')](PATH,_0x54ba('0x37'));var _0x9a2daa=_0x30028b[_0x54ba('0x2c')]&&_0x467263['length']>0x1;var _0x10d4f3=[];if(!fs[_0x54ba('0x38')](path['join'](_0x1c37f6,_0x3657d4))&&_0x9a2daa){fs[_0x54ba('0x39')](path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4));}return BPromise[_0x54ba('0x3b')](_0x467263,function(_0x4c6d25){_0x10d4f3['push'](_0x4c6d25);})[_0x54ba('0x2e')](function(){var _0x157d52=[];for(var _0x21ef42=0x0;_0x21ef42<_0x10d4f3['length'];_0x21ef42+=0x1){var _0x1bafc1=_0x10d4f3[_0x21ef42];var _0x2678d2=createTables(_[_0x54ba('0x3c')](_0x1bafc1));var _0xf1352a;var _0x4d2606=getPDFDocDefinition(_0x2678d2);var _0x492a72=getPDFPrinter();var _0x48efac=_0x492a72[_0x54ba('0x3d')](_0x4d2606);if(_0x9a2daa){_0xf1352a=path['join'](_0x1c37f6,_0x3657d4,util['format'](_0x54ba('0x3e'),_0x3657d4,_0x21ef42,'pdf'));}else{_0xf1352a=path['join'](_0x1c37f6,util['format'](_0x54ba('0x3f'),_0x3657d4,_0x54ba('0x40')));}_0x157d52[_0x54ba('0x22')](writePDFDocument(_0x48efac,_0xf1352a));}return Promise[_0x54ba('0x41')](_0x157d52);})[_0x54ba('0x2e')](function(){if(_0x9a2daa){return new Promise(function(_0x2780cd){zipdir(path['join'](_0x1c37f6,_0x3657d4),{'saveTo':path[_0x54ba('0x3a')](_0x1c37f6,util[_0x54ba('0x1e')](_0x54ba('0x3f'),_0x3657d4,'zip'))},function(){rimraf(path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4),function(){});_0x2780cd(_0x54ba('0x42'));});});}})['then'](function(){if(!_0x9a2daa)return;rimraf(path[_0x54ba('0x3a')](_0x1c37f6,_0x3657d4),function(){});})[_0x54ba('0x2e')](function(){logger[_0x54ba('0x43')](util[_0x54ba('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x54ba('0x44')));return analyticExtractedReport('Completed',_0x9a2daa?util[_0x54ba('0x1e')](_0x54ba('0x3f'),_0x3657d4,_0x9a2daa?'zip':_0x54ba('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x54ba('0x43')](util[_0x54ba('0x1e')](_0x54ba('0x45'),EXTRACTED_REPORT_ID,_0x54ba('0x44')));return db['AnalyticExtractedReport'][_0x54ba('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x213117){EXTRACTED_REPORT=_0x213117;return dbH['sequelize'][_0x54ba('0x31')](util[_0x54ba('0x1e')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x54ba('0x32')][_0x54ba('0x33')][_0x54ba('0x34')]});})[_0x54ba('0x2e')](extractReport)[_0x54ba('0x47')](function(_0x23f3a0){logger['info'](util['format'](_0x54ba('0x48'),EXTRACTED_REPORT_ID,_0x54ba('0x44')),util[_0x54ba('0x49')](_0x23f3a0,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x54ba('0x4a'));})[_0x54ba('0x4b')](function(){process[_0x54ba('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x331dd8=new PdfPrinter({'Arial':{'normal':__dirname+_0x54ba('0x4d'),'bold':__dirname+_0x54ba('0x4e'),'italics':__dirname+_0x54ba('0x4f'),'bolditalics':__dirname+_0x54ba('0x50')}});return _0x331dd8;}function getPDFDocDefinitionFromHTML(_0x18bca8,_0x906aef){var _0xf6d434=util[_0x54ba('0x1e')](_0x54ba('0x51'),_0x906aef[_0x54ba('0x52')],_0x906aef[_0x54ba('0x53')]);var _0x112dfe=moment()[_0x54ba('0x1e')](_0x54ba('0x54'))[_0x54ba('0x14')]();var _0x27c47d=htmlToPdfmake(_0x18bca8,{'window':window,'tableAutoSize':!![]});return{'content':[_0x27c47d],'defaultStyle':{'font':_0x54ba('0x55')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x54ba('0x56'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x54ba('0x56')}},'header':function(){return[{'text':_0x54ba('0x57'),'style':_0x54ba('0x58')}];},'footer':function(_0x269d21,_0x13513a){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0xf6d434,_0x269d21,_0x13513a,_0x112dfe),'style':'footer'}];}};}function writePDFDocument(_0x699f38,_0x1931f5){return new Promise(function(_0x36a589,_0x22a4e0){var _0x1786a4=_0x699f38[_0x54ba('0x59')](fs[_0x54ba('0x5a')](_0x1931f5));_0x1786a4['on'](_0x54ba('0x5b'),function(){_0x36a589('finish');});_0x1786a4['on'](_0x54ba('0x5c'),function(_0x4cb5f0){_0x22a4e0(_0x4cb5f0);});_0x699f38[_0x54ba('0x5d')]();});}exports[_0x54ba('0x5e')]=function(_0x5bb768,_0x2fca05){var _0x1d236c=getPDFPrinter();var _0x44ef3c=getPDFDocDefinitionFromHTML(_0x5bb768,_0x2fca05);var _0x1184dd=_0x1d236c[_0x54ba('0x3d')](_0x44ef3c);return writePDFDocument(_0x1184dd,_0x2fca05['path'])['catch'](function(_0x15006e){throw _0x15006e;});}; \ No newline at end of file +var _0x239e=['Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','value','fill','length','push','body','concat','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','header','before','landscape','toString','\x20/\x20','footer','Arial','black','num','Empty','Setting','find','split','splitSizePdf','then','range','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','mkdirSync','each','flatten','%s%d.%s','pdf','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect'];(function(_0x266c43,_0x12bc29){var _0x360a3d=function(_0x140536){while(--_0x140536){_0x266c43['push'](_0x266c43['shift']());}};_0x360a3d(++_0x12bc29);}(_0x239e,0x1ee));var _0xe239=function(_0x234e1a,_0x500d79){_0x234e1a=_0x234e1a-0x0;var _0x55aad2=_0x239e[_0x234e1a];return _0x55aad2;};'use strict';var _=require(_0xe239('0x0'));var fs=require('fs');var util=require(_0xe239('0x1'));var path=require(_0xe239('0x2'));var moment=require(_0xe239('0x3'));var htmlToPdfmake=require(_0xe239('0x4'));var PdfPrinter=require(_0xe239('0x5'));var zipdir=require(_0xe239('0x6'));var rimraf=require(_0xe239('0x7'));var JSDOM=require(_0xe239('0x8'))[_0xe239('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0xe239('0xa'));var db=require(_0xe239('0xb'))['db'];var dbH=require(_0xe239('0xb'))[_0xe239('0xc')];var logger=require(_0xe239('0xd'))(_0xe239('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xe239('0xf')][0x2]);var QUERY=process[_0xe239('0xf')][0x3];var PATH=process[_0xe239('0xf')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xe239('0x10');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4dcad6,_0x113c9f){var _0x2ae19f={'status':_0x4dcad6};var _0x4f8350={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x113c9f){_0x2ae19f[_0xe239('0x11')]=_0x113c9f;}return db[_0xe239('0x12')][_0xe239('0x13')](_0x2ae19f,_0x4f8350);}function getHeaders(_0x54491c){return _[_0xe239('0x14')](_0x54491c,function(_0x8363d9){return{'text':_0x8363d9,'style':_0xe239('0x15')};});}function getRows(_0xef43e,_0x429dcb){return _[_0xe239('0x14')](_0x429dcb,function(_0x4b7594){return _(_0x4b7594)[_0xe239('0x16')](_0xef43e)[_0xe239('0x14')](function(_0x6db0f9){return _0x6db0f9?_['toString'](_0x6db0f9):'';})[_0xe239('0x17')]();});}function createTable(_0x437dd3,_0x3230d5){var _0xbd0372={'widths':_[_0xe239('0x18')](Array(_0x437dd3[_0xe239('0x19')]),0x91),'heights':function(_0x5b499f){return _0x5b499f===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xd4d542=getHeaders(_0x437dd3);_0xbd0372['body'][_0xe239('0x1a')](_0xd4d542);var _0xfc3c25=getRows(_0x437dd3,_0x3230d5);_0xbd0372['body']=_0xbd0372[_0xe239('0x1b')][_0xe239('0x1c')](_0xfc3c25);return _0xbd0372;}function createTables(_0x45ff5d){var _0x2fa0b7=[];var _0x4ba511=_[_0xe239('0x1d')](Object[_0xe239('0x1e')](_0x45ff5d[0x0]),0x5);_0x4ba511[_0xe239('0x1f')](function(_0x866774){_0x2fa0b7[_0xe239('0x1a')](createTable(_0x866774,_0x45ff5d));});return _0x2fa0b7;}function getPDFDocDefinition(_0x2f6fb7){var _0x46e5fb=util['format'](_0xe239('0x20'),NAME,EXTRACTED_REPORT[_0xe239('0x21')],moment(EXTRACTED_REPORT['startDate'])[_0xe239('0x22')](FORMAT),moment(EXTRACTED_REPORT[_0xe239('0x23')])[_0xe239('0x22')](FORMAT));var _0xefb796=[];for(var _0x84ca3c=0x0;_0x84ca3c<_0x2f6fb7[_0xe239('0x19')];_0x84ca3c++){var _0x3217cb=[];if(_0x84ca3c===0x0){_0x3217cb[_0xe239('0x1a')]({'text':_0x46e5fb,'style':_0xe239('0x24')});}var _0x489a6e={'table':_0x2f6fb7[_0x84ca3c]};if(_0x84ca3c>0x0){_0x489a6e['pageBreak']=_0xe239('0x25');_0x489a6e['margin']=[0x0,0x46,0x0,0x0];}_0x3217cb[_0xe239('0x1a')](_0x489a6e);_0xefb796[_0xe239('0x1a')](_0x3217cb);}return{'pageSize':'A4','pageOrientation':_0xe239('0x26'),'content':_0xefb796,'footer':function(_0xb379b2,_0x407a5a){return{'text':_0xb379b2[_0xe239('0x27')]()+_0xe239('0x28')+_0x407a5a,'style':_0xe239('0x29')};},'defaultStyle':{'font':_0xe239('0x2a')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xe239('0x2b')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x54a8c8){var _0x2abbe9=0x1388;var _0x5d914f;if(!_0x54a8c8[0x0][_0xe239('0x2c')]){return analyticExtractedReport(_0xe239('0x2d'));}return db[_0xe239('0x2e')][_0xe239('0x2f')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xe239('0x30'),_0xe239('0x31')]})[_0xe239('0x32')](function(_0x2c4bab){if(_0x2c4bab){_0x5d914f=_0x2c4bab;_0x2abbe9=_0x5d914f[_0xe239('0x31')]||0x3e8;}})[_0xe239('0x32')](function(){var _0x3bfedc=[];var _0x31b8e5=0x0;if(_0x5d914f[_0xe239('0x30')]){if(_0x54a8c8&&_0x54a8c8[_0xe239('0x19')]){var _0x304516=_[_0xe239('0x33')](_0x54a8c8[0x0][_0xe239('0x2c')]/_0x2abbe9);var _0x3fba32=Number['isInteger'](_0x54a8c8[0x0][_0xe239('0x2c')]/_0x2abbe9)?_0x54a8c8[0x0][_0xe239('0x2c')]%_0x2abbe9:0x0;_0x304516[_0xe239('0x1f')](function(_0x86ee99){if(_0x86ee99>0x0){_0x31b8e5+=_0x2abbe9;}_0x3bfedc[_0xe239('0x1a')](dbH[_0xe239('0x34')]['query'](util[_0xe239('0x22')](_0xe239('0x35'),QUERY,_0x2abbe9,_0x31b8e5),{'type':dbH[_0xe239('0x34')][_0xe239('0x36')][_0xe239('0x37')]}));});if(_0x3fba32>0x0){_0x31b8e5+=_0x2abbe9;_0x3bfedc[_0xe239('0x1a')](dbH[_0xe239('0x34')]['query'](util[_0xe239('0x22')](_0xe239('0x35'),QUERY,_0x3fba32,_0x31b8e5),{'type':dbH[_0xe239('0x34')][_0xe239('0x36')][_0xe239('0x37')]}));}}}else{_0x3bfedc[_0xe239('0x1a')](dbH[_0xe239('0x34')]['query'](QUERY,{'type':dbH[_0xe239('0x34')][_0xe239('0x36')][_0xe239('0x37')]}));}var _0x3a878f=path[_0xe239('0x38')](PATH);var _0x242419=path[_0xe239('0x39')](PATH,'.pdf');var _0x5659ca=_0x5d914f[_0xe239('0x30')]&&_0x3bfedc[_0xe239('0x19')]>0x1;var _0x5d2a42=[];if(!fs[_0xe239('0x3a')](path[_0xe239('0x3b')](_0x3a878f,_0x242419))&&_0x5659ca){fs[_0xe239('0x3c')](path['join'](_0x3a878f,_0x242419));}return BPromise[_0xe239('0x3d')](_0x3bfedc,function(_0x506785){_0x5d2a42[_0xe239('0x1a')](_0x506785);})[_0xe239('0x32')](function(){var _0xba7d51=[];for(var _0x90ee4c=0x0;_0x90ee4c<_0x5d2a42[_0xe239('0x19')];_0x90ee4c+=0x1){var _0x54108e=_0x5d2a42[_0x90ee4c];var _0xc46231=createTables(_[_0xe239('0x3e')](_0x54108e));var _0x24ca6b;var _0x542f5b=getPDFDocDefinition(_0xc46231);var _0x1d8004=getPDFPrinter();var _0x5db9eb=_0x1d8004['createPdfKitDocument'](_0x542f5b);if(_0x5659ca){_0x24ca6b=path['join'](_0x3a878f,_0x242419,util[_0xe239('0x22')](_0xe239('0x3f'),_0x242419,_0x90ee4c,'pdf'));}else{_0x24ca6b=path[_0xe239('0x3b')](_0x3a878f,util[_0xe239('0x22')]('%s.%s',_0x242419,_0xe239('0x40')));}_0xba7d51['push'](writePDFDocument(_0x5db9eb,_0x24ca6b));}return Promise['all'](_0xba7d51);})[_0xe239('0x32')](function(){if(_0x5659ca){return new Promise(function(_0x4e8045){zipdir(path[_0xe239('0x3b')](_0x3a878f,_0x242419),{'saveTo':path[_0xe239('0x3b')](_0x3a878f,util[_0xe239('0x22')](_0xe239('0x41'),_0x242419,_0xe239('0x42')))},function(){rimraf(path[_0xe239('0x3b')](_0x3a878f,_0x242419),function(){});_0x4e8045('zip\x20finished');});});}})[_0xe239('0x32')](function(){if(!_0x5659ca)return;rimraf(path[_0xe239('0x3b')](_0x3a878f,_0x242419),function(){});})[_0xe239('0x32')](function(){logger[_0xe239('0x43')](util[_0xe239('0x22')](_0xe239('0x44'),EXTRACTED_REPORT_ID,_0xe239('0x45')));return analyticExtractedReport(_0xe239('0x46'),_0x5659ca?util['format'](_0xe239('0x41'),_0x242419,_0x5659ca?'zip':_0xe239('0x40')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xe239('0x43')](util['format'](_0xe239('0x47'),EXTRACTED_REPORT_ID,_0xe239('0x45')));return db[_0xe239('0x12')][_0xe239('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xe239('0x32')](function(_0x556e5f){EXTRACTED_REPORT=_0x556e5f;return dbH[_0xe239('0x34')]['query'](util[_0xe239('0x22')](_0xe239('0x49'),QUERY),{'type':dbH[_0xe239('0x34')][_0xe239('0x36')]['SELECT']});})[_0xe239('0x32')](extractReport)['catch'](function(_0x3d0e50){logger[_0xe239('0x43')](util[_0xe239('0x22')](_0xe239('0x4a'),EXTRACTED_REPORT_ID,_0xe239('0x45')),util[_0xe239('0x4b')](_0x3d0e50,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe239('0x4c'));})[_0xe239('0x4d')](function(){process[_0xe239('0x4e')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3889f2=new PdfPrinter({'Arial':{'normal':__dirname+_0xe239('0x4f'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xe239('0x50')}});return _0x3889f2;}function getPDFDocDefinitionFromHTML(_0x176b70,_0x255f29){var _0x1afccd=util[_0xe239('0x22')]('%s\x20#%d',_0x255f29[_0xe239('0x51')],_0x255f29[_0xe239('0x52')]);var _0x423a16=moment()[_0xe239('0x22')](_0xe239('0x53'))[_0xe239('0x27')]();var _0x30dcae=htmlToPdfmake(_0x176b70,{'window':window,'tableAutoSize':!![]});return{'content':[_0x30dcae],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xe239('0x54'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xe239('0x54'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xe239('0x55'),'style':'header'}];},'footer':function(_0x2dc886,_0x536d94){return[{'text':util[_0xe239('0x22')](_0xe239('0x56'),_0x1afccd,_0x2dc886,_0x536d94,_0x423a16),'style':_0xe239('0x29')}];}};}function writePDFDocument(_0x12acd1,_0x7647cc){return new Promise(function(_0x2f0693,_0x2f672c){var _0x445ecf=_0x12acd1[_0xe239('0x57')](fs[_0xe239('0x58')](_0x7647cc));_0x445ecf['on'](_0xe239('0x59'),function(){_0x2f0693(_0xe239('0x59'));});_0x445ecf['on'](_0xe239('0x5a'),function(_0x3c8bac){_0x2f672c(_0x3c8bac);});_0x12acd1[_0xe239('0x5b')]();});}exports[_0xe239('0x5c')]=function(_0x2f4a5f,_0x180bfb){var _0x4ef055=getPDFPrinter();var _0x356cd7=getPDFDocDefinitionFromHTML(_0x2f4a5f,_0x180bfb);var _0x28a11f=_0x4ef055[_0xe239('0x5d')](_0x356cd7);return writePDFDocument(_0x28a11f,_0x180bfb['path'])[_0xe239('0x5e')](function(_0x59d34f){throw _0x59d34f;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 7b44927..cae38d1 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 _0x5686=['update','info','format','XLSX','Setting','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x5686,0x1be));var _0x6568=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x5686[_0x576170];return _0x397c70;};'use strict';var util=require(_0x6568('0x0'));var path=require(_0x6568('0x1'));var _=require(_0x6568('0x2'));var fs=require('fs');var json2xls=require(_0x6568('0x3'));var BPromise=require(_0x6568('0x4'));var zipdir=require(_0x6568('0x5'));var rimraf=require(_0x6568('0x6'));var db=require(_0x6568('0x7'))['db'];var dbH=require(_0x6568('0x7'))[_0x6568('0x8')];var logger=require(_0x6568('0x9'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6568('0xa')][0x2]);var QUERY=process[_0x6568('0xa')][0x3];var PATH=process[_0x6568('0xa')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3c06a7,_0x15c54b){var _0x120e9c={'status':_0x3c06a7};var _0x31b658={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x15c54b){_0x120e9c[_0x6568('0xb')]=_0x15c54b;}return db[_0x6568('0xc')][_0x6568('0xd')](_0x120e9c,_0x31b658);}function main(){var _0x29cfeb=0x1388;var _0x52a458;logger[_0x6568('0xe')](util[_0x6568('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6568('0x10')));return db[_0x6568('0x11')][_0x6568('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6568('0x13'),_0x6568('0x14')]})[_0x6568('0x15')](function(_0x113f92){if(_0x113f92){_0x52a458=_0x113f92;_0x29cfeb=_0x52a458[_0x6568('0x14')]||0x1388;}})[_0x6568('0x15')](function(){return dbH['sequelize'][_0x6568('0x16')](util['format'](_0x6568('0x17'),QUERY),{'type':dbH[_0x6568('0x18')][_0x6568('0x19')][_0x6568('0x1a')]});})['then'](function(_0x4d986a){if(!_0x4d986a[0x0][_0x6568('0x1b')]){return analyticExtractedReport(_0x6568('0x1c'));}var _0x4e1cbb=[];var _0x314bb0=0x0;if(_0x52a458[_0x6568('0x13')]){if(_0x4d986a&&_0x4d986a[_0x6568('0x1d')]){var _0x524a85=_[_0x6568('0x1e')](_0x4d986a[0x0][_0x6568('0x1b')]/_0x29cfeb);var _0x8a426f=Number['isInteger'](_0x4d986a[0x0][_0x6568('0x1b')]/_0x29cfeb)?_0x4d986a[0x0][_0x6568('0x1b')]%_0x29cfeb:0x0;_0x524a85[_0x6568('0x1f')](function(_0x37073f){if(_0x37073f>0x0){_0x314bb0+=_0x29cfeb;}_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](util[_0x6568('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29cfeb,_0x314bb0),{'type':dbH[_0x6568('0x18')][_0x6568('0x19')][_0x6568('0x1a')]}));});if(_0x8a426f>0x0){_0x314bb0+=_0x29cfeb;_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](util[_0x6568('0xf')](_0x6568('0x21'),QUERY,_0x8a426f,_0x314bb0),{'type':dbH[_0x6568('0x18')]['QueryTypes']['SELECT']}));}}}else{_0x4e1cbb[_0x6568('0x20')](dbH[_0x6568('0x18')][_0x6568('0x16')](QUERY,{'type':dbH[_0x6568('0x18')]['QueryTypes'][_0x6568('0x1a')]}));}var _0x102a0b=path[_0x6568('0x22')](PATH);var _0x287656=path[_0x6568('0x23')](PATH,_0x6568('0x24'));var _0x2c445a=_0x52a458[_0x6568('0x13')]&&_0x4e1cbb[_0x6568('0x1d')]>0x1;var _0x6e2eb5=[];if(!fs['existsSync'](path[_0x6568('0x25')](_0x102a0b,_0x287656))&&_0x2c445a){fs['mkdirSync'](path[_0x6568('0x25')](_0x102a0b,_0x287656));}return BPromise[_0x6568('0x26')](_0x4e1cbb,function(_0x12991f){_0x6e2eb5[_0x6568('0x20')](_0x12991f);})[_0x6568('0x15')](function(){for(var _0x14b5dd=0x0;_0x14b5dd<_0x6e2eb5[_0x6568('0x1d')];_0x14b5dd+=0x1){var _0xcf960e;var _0x338ba1=_0x6e2eb5[_0x14b5dd];if(_0x2c445a){_0xcf960e=path[_0x6568('0x25')](_0x102a0b,_0x287656,util[_0x6568('0xf')](_0x6568('0x27'),_0x287656,_0x14b5dd,_0x6568('0x28')));}else{_0xcf960e=path[_0x6568('0x25')](_0x102a0b,util[_0x6568('0xf')](_0x6568('0x29'),_0x287656,_0x6568('0x28')));}fs[_0x6568('0x2a')](_0xcf960e,json2xls(_0x338ba1),_0x6568('0x2b'));}})[_0x6568('0x15')](function(){if(_0x2c445a){return new Promise(function(_0x55e303){zipdir(path['join'](_0x102a0b,_0x287656),{'saveTo':path[_0x6568('0x25')](_0x102a0b,util[_0x6568('0xf')]('%s.%s',_0x287656,_0x6568('0x2c')))},function(_0x179518,_0x453e12){rimraf(path['join'](_0x102a0b,_0x287656),function(){});_0x55e303(_0x6568('0x2d'));});});}})[_0x6568('0x15')](function(){logger[_0x6568('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6568('0x10')));return analyticExtractedReport(_0x6568('0x2e'),_0x2c445a?util[_0x6568('0xf')](_0x6568('0x29'),_0x287656,_0x2c445a?'zip':_0x6568('0x28')):null);});})[_0x6568('0x2f')](function(_0x1bc9e6){logger[_0x6568('0xe')](util[_0x6568('0xf')](_0x6568('0x30'),EXTRACTED_REPORT_ID,_0x6568('0x10')),util['inspect'](_0x1bc9e6,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6568('0x31'));})[_0x6568('0x32')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x6f62=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','num','Empty','length','range','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','basename','.xlsx','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x2378d2,_0x215b88){var _0x19ef8a=function(_0x32d833){while(--_0x32d833){_0x2378d2['push'](_0x2378d2['shift']());}};_0x19ef8a(++_0x215b88);}(_0x6f62,0x12c));var _0x26f6=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x6f62[_0x34ad72];return _0x5c9aa8;};'use strict';var util=require(_0x26f6('0x0'));var path=require(_0x26f6('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x26f6('0x2'));var BPromise=require(_0x26f6('0x3'));var zipdir=require(_0x26f6('0x4'));var rimraf=require(_0x26f6('0x5'));var db=require(_0x26f6('0x6'))['db'];var dbH=require(_0x26f6('0x6'))['dbH'];var logger=require('../../config/logger')(_0x26f6('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x26f6('0x8')][0x2]);var QUERY=process[_0x26f6('0x8')][0x3];var PATH=process[_0x26f6('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x28b8fc,_0x54bec4){var _0x195f92={'status':_0x28b8fc};var _0x267df5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54bec4){_0x195f92[_0x26f6('0x9')]=_0x54bec4;}return db[_0x26f6('0xa')]['update'](_0x195f92,_0x267df5);}function main(){var _0x15b255=0x1388;var _0x53d83d;logger[_0x26f6('0xb')](util[_0x26f6('0xc')](_0x26f6('0xd'),EXTRACTED_REPORT_ID,_0x26f6('0xe')));return db['Setting'][_0x26f6('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x26f6('0x10'),'splitSizeXlsx']})[_0x26f6('0x11')](function(_0x18bc0d){if(_0x18bc0d){_0x53d83d=_0x18bc0d;_0x15b255=_0x53d83d['splitSizeXlsx']||0x1388;}})[_0x26f6('0x11')](function(){return dbH['sequelize']['query'](util['format'](_0x26f6('0x12'),QUERY),{'type':dbH[_0x26f6('0x13')]['QueryTypes'][_0x26f6('0x14')]});})['then'](function(_0x296d24){if(!_0x296d24[0x0][_0x26f6('0x15')]){return analyticExtractedReport(_0x26f6('0x16'));}var _0x339fcc=[];var _0x5a6381=0x0;if(_0x53d83d[_0x26f6('0x10')]){if(_0x296d24&&_0x296d24[_0x26f6('0x17')]){var _0x46cbba=_[_0x26f6('0x18')](_0x296d24[0x0][_0x26f6('0x15')]/_0x15b255);var _0x5000cb=Number[_0x26f6('0x19')](_0x296d24[0x0][_0x26f6('0x15')]/_0x15b255)?_0x296d24[0x0][_0x26f6('0x15')]%_0x15b255:0x0;_0x46cbba[_0x26f6('0x1a')](function(_0x55f59f){if(_0x55f59f>0x0){_0x5a6381+=_0x15b255;}_0x339fcc['push'](dbH[_0x26f6('0x13')][_0x26f6('0x1b')](util[_0x26f6('0xc')](_0x26f6('0x1c'),QUERY,_0x15b255,_0x5a6381),{'type':dbH[_0x26f6('0x13')][_0x26f6('0x1d')]['SELECT']}));});if(_0x5000cb>0x0){_0x5a6381+=_0x15b255;_0x339fcc[_0x26f6('0x1e')](dbH[_0x26f6('0x13')][_0x26f6('0x1b')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5000cb,_0x5a6381),{'type':dbH[_0x26f6('0x13')][_0x26f6('0x1d')][_0x26f6('0x14')]}));}}}else{_0x339fcc[_0x26f6('0x1e')](dbH[_0x26f6('0x13')][_0x26f6('0x1b')](QUERY,{'type':dbH['sequelize'][_0x26f6('0x1d')][_0x26f6('0x14')]}));}var _0x12e7df=path[_0x26f6('0x1f')](PATH);var _0x5123c7=path[_0x26f6('0x20')](PATH,_0x26f6('0x21'));var _0x24b775=_0x53d83d[_0x26f6('0x10')]&&_0x339fcc[_0x26f6('0x17')]>0x1;var _0x106db4=[];if(!fs['existsSync'](path[_0x26f6('0x22')](_0x12e7df,_0x5123c7))&&_0x24b775){fs['mkdirSync'](path['join'](_0x12e7df,_0x5123c7));}return BPromise[_0x26f6('0x23')](_0x339fcc,function(_0x9724c3){_0x106db4[_0x26f6('0x1e')](_0x9724c3);})['then'](function(){for(var _0x3e1f2b=0x0;_0x3e1f2b<_0x106db4[_0x26f6('0x17')];_0x3e1f2b+=0x1){var _0x4cbd21;var _0x4ac9ec=_0x106db4[_0x3e1f2b];if(_0x24b775){_0x4cbd21=path[_0x26f6('0x22')](_0x12e7df,_0x5123c7,util[_0x26f6('0xc')](_0x26f6('0x24'),_0x5123c7,_0x3e1f2b,_0x26f6('0x25')));}else{_0x4cbd21=path[_0x26f6('0x22')](_0x12e7df,util['format'](_0x26f6('0x26'),_0x5123c7,_0x26f6('0x25')));}fs[_0x26f6('0x27')](_0x4cbd21,json2xls(_0x4ac9ec),_0x26f6('0x28'));}})[_0x26f6('0x11')](function(){if(_0x24b775){return new Promise(function(_0x2a260f){zipdir(path[_0x26f6('0x22')](_0x12e7df,_0x5123c7),{'saveTo':path[_0x26f6('0x22')](_0x12e7df,util[_0x26f6('0xc')](_0x26f6('0x26'),_0x5123c7,_0x26f6('0x29')))},function(_0x12838c,_0x2c2ba3){rimraf(path[_0x26f6('0x22')](_0x12e7df,_0x5123c7),function(){});_0x2a260f('zip\x20finished');});});}})[_0x26f6('0x11')](function(){logger['info'](util['format'](_0x26f6('0x2a'),EXTRACTED_REPORT_ID,_0x26f6('0xe')));return analyticExtractedReport(_0x26f6('0x2b'),_0x24b775?util[_0x26f6('0xc')]('%s.%s',_0x5123c7,_0x24b775?_0x26f6('0x29'):'xlsx'):null);});})[_0x26f6('0x2c')](function(_0x174750){logger[_0x26f6('0xb')](util[_0x26f6('0xc')](_0x26f6('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x26f6('0x2e')](_0x174750,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x26f6('0x2f')](function(){process[_0x26f6('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index b661a25..e61be12 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 _0x0cf5=['$[${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-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','lodash','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','map','then','filter','groupBy','exten','playback','hasOwnProperty','priority','extensions','find','push','format','type','context','VoiceExtensionId','Set','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='];(function(_0x3a2038,_0x31bb2b){var _0x16adf8=function(_0x23a50c){while(--_0x23a50c){_0x3a2038['push'](_0x3a2038['shift']());}};_0x16adf8(++_0x31bb2b);}(_0x0cf5,0xa8));var _0x50cf=function(_0x44453f,_0x443e4f){_0x44453f=_0x44453f-0x0;var _0x7962e7=_0x0cf5[_0x44453f];return _0x7962e7;};'use strict';var _=require(_0x50cf('0x0'));var util=require(_0x50cf('0x1'));function rewrite(_0x2f4750,_0x46d71e){var _0x2bad26=this;return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x3')][_0x50cf('0x4')]({'raw':!![]})['then'](function(_0x132624){_0x2bad26[_0x50cf('0x5')]=_0x132624;return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')]['findAll']({'where':{'IntervalId':_0x46d71e[_0x50cf('0x7')]},'raw':!![]});})['then'](function(_0x21b6e5){return _0x2f4750['models'][_0x50cf('0x6')][_0x50cf('0x4')]({'where':{'exten':{'$in':_[_0x50cf('0x8')](_[_0x50cf('0x9')](_0x21b6e5,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x50cf('0xa')](function(_0x3bdb9d){var _0x102ce3=_[_0x50cf('0xb')](_0x3bdb9d,{'priority':'1'});var _0x3a21c5=_[_0x50cf('0xb')](_0x3bdb9d,{'isApp':0x1});var _0xc79c4d=_[_0x50cf('0xc')](_0x3a21c5,_0x50cf('0xd'));var _0x468ab2=['queue',_0x50cf('0xe')];var _0x353824=[];var _0x3e4ea4=[];for(var _0x33cf47 in _0xc79c4d){if(_0xc79c4d[_0x50cf('0xf')](_0x33cf47)){_0x2bad26[_0x50cf('0x10')]=0x2;_0x2bad26[_0x50cf('0x11')]=[];_0x2bad26['extension']=_[_0x50cf('0x12')](_0x102ce3,{'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')]});_0x2bad26['extensions'][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0]['type'],'app':'Set','appdata':util[_0x50cf('0x14')]('CDR(type)=%s',_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')]),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26['priority']++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0xc79c4d[_0x33cf47][0x0]['type']==='inbound'){_0x2bad26[_0x50cf('0x11')]['push']({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':'CDR(routeid)='+_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId'],'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}else if(_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')]===_0x50cf('0x19')){if(_0x2bad26['extension']){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x1a')+(_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]?_0x50cf('0x1d')+_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]+'}':'${EXTEN}'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x1e')+_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});var _0x3a7b1b=_0x2bad26[_0x50cf('0x10')]++;_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x20')+(_0x3a7b1b+0x2)+_0x50cf('0x21')+(_0x3a7b1b+0x1)+')','context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x3a7b1b,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0x2bad26['extension']){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x2bad26[_0x50cf('0x1b')]['cutdigits']?_0x50cf('0x22')+_0x2bad26[_0x50cf('0x1b')][_0x50cf('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x23')+_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId'],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});if(_0x2bad26[_0x50cf('0x1b')]&&_0x2bad26[_0x50cf('0x1b')][_0x50cf('0xf')](_0x50cf('0x24'))&&_0x2bad26[_0x50cf('0x1b')]['recordingFormat']!==_0x50cf('0x25')){_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x26'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x27')+_0x2bad26[_0x50cf('0x1b')]['recordingFormat']||_0x50cf('0x28'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':'Set','appdata':_0x50cf('0x29'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':'Set','appdata':_0x50cf('0x2a'),'context':_0xc79c4d[_0x33cf47][0x0]['context'],'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'priority':_0x2bad26['priority']++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId']});_0x2bad26[_0x50cf('0x11')]['push']({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x2b'),'context':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x16')],'exten':_0xc79c4d[_0x33cf47][0x0]['exten'],'priority':_0x2bad26[_0x50cf('0x10')]++,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});for(var _0x2ff69f=0x0,_0x3d6792=0x0;_0x2ff69f<_0xc79c4d[_0x33cf47][_0x50cf('0x2c')];_0x2ff69f+=0x1,_0x3d6792=0x0){var _0x343e9a=_0xc79c4d[_0x33cf47][_0x2ff69f];if(_0x343e9a[_0x50cf('0x15')]){_0x343e9a[_0x50cf('0x15')]=_0x343e9a['type'][_0x50cf('0x2d')]();}var _0x33e8fd=[];var _0x367bc6=[];delete _0x343e9a['id'];delete _0x343e9a[_0x50cf('0x2e')];delete _0x343e9a[_0x50cf('0x2f')];var _0x37e402=_0x343e9a[_0x50cf('0x30')]!==_0x50cf('0x31')?[_0x343e9a['interval']]:_0x343e9a['IntervalId']?_[_0x50cf('0x9')](_[_0x50cf('0xb')](_0x2bad26[_0x50cf('0x5')],{'IntervalId':_0x343e9a[_0x50cf('0x7')]}),_0x50cf('0x30')):[];if(_0x343e9a[_0x50cf('0xf')](_0x50cf('0x32'))){if(_0x343e9a[_0x50cf('0x32')]&&_0x343e9a[_0x50cf('0x32')]!=='--'){_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x33')+_0x343e9a[_0x50cf('0x32')],'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}if(_0x343e9a[_0x50cf('0x15')]==='outbound'&&_0x343e9a['hasOwnProperty'](_0x50cf('0x34'))){if(_0x343e9a['callerID']){_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x35')+_0x343e9a[_0x50cf('0x34')]+')','context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}else{_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':'ExecIf','appdata':_0x50cf('0x36'),'context':_0x343e9a['context'],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}if(_0x343e9a[_0x50cf('0xf')](_0x50cf('0x37'))){if(_0x468ab2[_0x50cf('0x38')](_0x343e9a[_0x50cf('0x39')]['toLowerCase']())>=0x0&&_0x343e9a[_0x50cf('0x3a')]!==_0x50cf('0x3b')){if(_0x343e9a['answer']){_0x33e8fd['push']({'type':_0x343e9a[_0x50cf('0x15')],'app':'ExecIf','appdata':_0x50cf('0x3c'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a['VoiceExtensionId']});_0x33e8fd['push']({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x18'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a['exten'],'priority':_0x37e402[_0x50cf('0x2c')]+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}else{_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x1f'),'appdata':_0x50cf('0x3d'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402['length']+_0x2bad26[_0x50cf('0x10')]+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});_0x33e8fd[_0x50cf('0x13')]({'type':_0x343e9a['type'],'app':_0x50cf('0x18'),'appdata':_0x50cf('0x3e'),'context':_0x343e9a[_0x50cf('0x16')],'exten':_0x343e9a[_0x50cf('0xd')],'priority':_0x37e402['length']+_0x2bad26['priority']+_0x3d6792++,'VoiceExtensionId':_0x343e9a[_0x50cf('0x17')]});}}}for(var _0x4d39aa=0x0;_0x4d39aa<_0x37e402['length'];_0x4d39aa+=0x1){var _0x54300e=_0x2bad26[_0x50cf('0x10')]+_0x37e402[_0x50cf('0x2c')];var _0x180317=_0x4d39aa===_0x37e402['length']-0x1?_0x2bad26[_0x50cf('0x10')]+_0x33e8fd[_0x50cf('0x2c')]+_0x367bc6[_0x50cf('0x2c')]+0x2:_0x2bad26[_0x50cf('0x10')]+_0x4d39aa+0x1;_0x33e8fd[_0x50cf('0x3f')](_0x4d39aa,0x0,{'type':_0x343e9a[_0x50cf('0x15')],'app':_0x50cf('0x40'),'appdata':_0x37e402[_0x4d39aa]+'?'+_0x343e9a[_0x50cf('0x16')]+_0x50cf('0x41')+_0x54300e+':'+_0x343e9a[_0x50cf('0x16')]+_0x50cf('0x41')+_0x180317,'exten':_0x343e9a['exten'],'context':_0x343e9a[_0x50cf('0x16')],'priority':_0x2bad26[_0x50cf('0x10')]+_0x4d39aa,'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});}_0x343e9a[_0x50cf('0x10')]=_0x33e8fd[_0x50cf('0x2c')]?_['last'](_0x33e8fd)[_0x50cf('0x10')]+0x1:_0x2bad26['priority'];_0x2bad26[_0x50cf('0x10')]=(_0x367bc6[_0x50cf('0x2c')]?_[_0x50cf('0x42')](_0x367bc6)['priority']:_0x343e9a[_0x50cf('0x10')])+0x1;_0x2bad26[_0x50cf('0x11')]=_[_0x50cf('0x43')](_0x2bad26[_0x50cf('0x11')],_0x33e8fd,[_0x343e9a],_0x367bc6);}_0x2bad26[_0x50cf('0x11')][_0x50cf('0x13')]({'type':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x15')],'app':_0x50cf('0x44'),'exten':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0xd')],'context':_0xc79c4d[_0x33cf47][0x0]['context'],'priority':_0x2bad26[_0x50cf('0x10')],'VoiceExtensionId':_0xc79c4d[_0x33cf47][0x0][_0x50cf('0x17')]});_0x353824[_0x50cf('0x13')](_0xc79c4d[_0x33cf47][0x0]['VoiceExtensionId']);_0x3e4ea4=_[_0x50cf('0x43')](_0x3e4ea4,_0x2bad26[_0x50cf('0x11')]);}}return _0x2f4750['transaction'](function(_0x66285){return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')][_0x50cf('0x45')]({'where':{'VoiceExtensionId':{'$in':_0x353824}},'transaction':_0x66285})[_0x50cf('0xa')](function(_0x42628f){return _0x2f4750[_0x50cf('0x2')][_0x50cf('0x6')][_0x50cf('0x46')](_[_0x50cf('0x47')](_0x3e4ea4,_0x50cf('0x10')),{'transaction':_0x66285});});});})[_0x50cf('0x48')](function(_0x10bc2c){console[_0x50cf('0x49')](_0x10bc2c);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0xb9d6=[',${EXTEN},','last','concat','Hangup','transaction','catch','error','lodash','models','Interval','findAll','intervals','VoiceExtension','IntervalId','uniq','exten','CAST(priority\x20AS\x20UNSIGNED)','then','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','format','context','VoiceExtensionId','inbound','Set','CDR(routeid)=','outbound','cutdigits','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime'];(function(_0x35c981,_0x1dba19){var _0xfa34d3=function(_0x1f9bfd){while(--_0x1f9bfd){_0x35c981['push'](_0x35c981['shift']());}};_0xfa34d3(++_0x1dba19);}(_0xb9d6,0x160));var _0x6b9d=function(_0x1c36a8,_0x49c835){_0x1c36a8=_0x1c36a8-0x0;var _0xb622c5=_0xb9d6[_0x1c36a8];return _0xb622c5;};'use strict';var _=require(_0x6b9d('0x0'));var util=require('util');function rewrite(_0x16bc3d,_0x1f7e6e){var _0x1789b5=this;return _0x16bc3d[_0x6b9d('0x1')][_0x6b9d('0x2')][_0x6b9d('0x3')]({'raw':!![]})['then'](function(_0x4686fe){_0x1789b5[_0x6b9d('0x4')]=_0x4686fe;return _0x16bc3d[_0x6b9d('0x1')][_0x6b9d('0x5')][_0x6b9d('0x3')]({'where':{'IntervalId':_0x1f7e6e[_0x6b9d('0x6')]},'raw':!![]});})['then'](function(_0x3d2fc4){return _0x16bc3d[_0x6b9d('0x1')][_0x6b9d('0x5')][_0x6b9d('0x3')]({'where':{'exten':{'$in':_[_0x6b9d('0x7')](_['map'](_0x3d2fc4,_0x6b9d('0x8')))}},'order':[{'raw':_0x6b9d('0x9')}],'raw':!![]});})[_0x6b9d('0xa')](function(_0x1cbecd){var _0x19206e=_[_0x6b9d('0xb')](_0x1cbecd,{'priority':'1'});var _0x308982=_[_0x6b9d('0xb')](_0x1cbecd,{'isApp':0x1});var _0x397cc9=_[_0x6b9d('0xc')](_0x308982,'exten');var _0x54f06c=[_0x6b9d('0xd'),_0x6b9d('0xe')];var _0x468c49=[];var _0x2e9738=[];for(var _0x4b803f in _0x397cc9){if(_0x397cc9[_0x6b9d('0xf')](_0x4b803f)){_0x1789b5[_0x6b9d('0x10')]=0x2;_0x1789b5[_0x6b9d('0x11')]=[];_0x1789b5[_0x6b9d('0x12')]=_['find'](_0x19206e,{'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')]});_0x1789b5[_0x6b9d('0x11')][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':'Set','appdata':util[_0x6b9d('0x15')]('CDR(type)=%s',_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')]),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0]['exten'],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});if(_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')]===_0x6b9d('0x18')){_0x1789b5[_0x6b9d('0x11')][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x1a')+_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')],'context':_0x397cc9[_0x4b803f][0x0]['context'],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5['priority']++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0]['VoiceExtensionId']});}else if(_0x397cc9[_0x4b803f][0x0]['type']===_0x6b9d('0x1b')){if(_0x1789b5[_0x6b9d('0x12')]){_0x1789b5[_0x6b9d('0x11')][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0]['type'],'app':_0x6b9d('0x19'),'appdata':'CDR(destination)='+(_0x1789b5['extension'][_0x6b9d('0x1c')]?'${EXTEN:'+_0x1789b5[_0x6b9d('0x12')][_0x6b9d('0x1c')]+'}':_0x6b9d('0x1d')),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});}_0x1789b5['extensions']['push']({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x1a')+_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')],'context':_0x397cc9[_0x4b803f][0x0]['context'],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});var _0x28103e=_0x1789b5['priority']++;_0x1789b5[_0x6b9d('0x11')]['push']({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x28103e+0x2)+_0x6b9d('0x1f')+(_0x28103e+0x1)+')','context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x28103e,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0]['VoiceExtensionId']});if(_0x1789b5['extension']){_0x1789b5[_0x6b9d('0x11')][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0]['type'],'app':_0x6b9d('0x19'),'appdata':_0x1789b5['extension'][_0x6b9d('0x1c')]?_0x6b9d('0x20')+_0x1789b5[_0x6b9d('0x12')][_0x6b9d('0x1c')]+'}':_0x6b9d('0x21'),'context':_0x397cc9[_0x4b803f][0x0]['context'],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});}_0x1789b5['extensions'][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':'outboundrouteid='+_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')],'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});if(_0x1789b5['extension']&&_0x1789b5['extension'][_0x6b9d('0xf')](_0x6b9d('0x22'))&&_0x1789b5[_0x6b9d('0x12')][_0x6b9d('0x22')]!==_0x6b9d('0x23')){_0x1789b5['extensions'][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x24'),'context':_0x397cc9[_0x4b803f][0x0]['context'],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5['priority']++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});_0x1789b5[_0x6b9d('0x11')]['push']({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x25')+_0x1789b5[_0x6b9d('0x12')][_0x6b9d('0x22')]||_0x6b9d('0x26'),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});}}_0x1789b5['extensions']['push']({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':'Set','appdata':_0x6b9d('0x27'),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0]['VoiceExtensionId']});_0x1789b5['extensions']['push']({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':'Set','appdata':_0x6b9d('0x28'),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5['priority']++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});_0x1789b5[_0x6b9d('0x11')][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x29'),'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'priority':_0x1789b5[_0x6b9d('0x10')]++,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});for(var _0x171c9d=0x0,_0xea8dce=0x0;_0x171c9d<_0x397cc9[_0x4b803f][_0x6b9d('0x2a')];_0x171c9d+=0x1,_0xea8dce=0x0){var _0x86a434=_0x397cc9[_0x4b803f][_0x171c9d];if(_0x86a434[_0x6b9d('0x14')]){_0x86a434['type']=_0x86a434[_0x6b9d('0x14')][_0x6b9d('0x2b')]();}var _0x4b7695=[];var _0x4c5af8=[];delete _0x86a434['id'];delete _0x86a434[_0x6b9d('0x2c')];delete _0x86a434[_0x6b9d('0x2d')];var _0x2c869d=_0x86a434[_0x6b9d('0x2e')]!==_0x6b9d('0x2f')?[_0x86a434[_0x6b9d('0x2e')]]:_0x86a434['IntervalId']?_[_0x6b9d('0x30')](_[_0x6b9d('0xb')](_0x1789b5[_0x6b9d('0x4')],{'IntervalId':_0x86a434[_0x6b9d('0x6')]}),_0x6b9d('0x2e')):[];if(_0x86a434[_0x6b9d('0xf')](_0x6b9d('0x31'))){if(_0x86a434[_0x6b9d('0x31')]&&_0x86a434[_0x6b9d('0x31')]!=='--'){_0x4b7695[_0x6b9d('0x13')]({'type':_0x86a434['type'],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x32')+_0x86a434[_0x6b9d('0x31')],'context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d[_0x6b9d('0x2a')]+_0x1789b5[_0x6b9d('0x10')]+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});}}if(_0x86a434[_0x6b9d('0x14')]===_0x6b9d('0x1b')&&_0x86a434[_0x6b9d('0xf')]('callerID')){if(_0x86a434['callerID']){_0x4b7695['push']({'type':_0x86a434[_0x6b9d('0x14')],'app':_0x6b9d('0x1e'),'appdata':_0x6b9d('0x33')+_0x86a434[_0x6b9d('0x34')]+')','context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d['length']+_0x1789b5['priority']+_0xea8dce++,'VoiceExtensionId':_0x86a434['VoiceExtensionId']});}else{_0x4b7695[_0x6b9d('0x13')]({'type':_0x86a434[_0x6b9d('0x14')],'app':_0x6b9d('0x1e'),'appdata':_0x6b9d('0x35'),'context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d[_0x6b9d('0x2a')]+_0x1789b5[_0x6b9d('0x10')]+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});}}if(_0x86a434['hasOwnProperty'](_0x6b9d('0x36'))){if(_0x54f06c['indexOf'](_0x86a434['app'][_0x6b9d('0x2b')]())>=0x0&&_0x86a434[_0x6b9d('0x37')]!==_0x6b9d('0x38')){if(_0x86a434[_0x6b9d('0x36')]){_0x4b7695[_0x6b9d('0x13')]({'type':_0x86a434[_0x6b9d('0x14')],'app':'ExecIf','appdata':_0x6b9d('0x39'),'context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d['length']+_0x1789b5[_0x6b9d('0x10')]+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});_0x4b7695['push']({'type':_0x86a434[_0x6b9d('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434['exten'],'priority':_0x2c869d['length']+_0x1789b5['priority']+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});}else{_0x4b7695['push']({'type':_0x86a434[_0x6b9d('0x14')],'app':'ExecIf','appdata':_0x6b9d('0x3a'),'context':_0x86a434['context'],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d[_0x6b9d('0x2a')]+_0x1789b5[_0x6b9d('0x10')]+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});_0x4b7695[_0x6b9d('0x13')]({'type':_0x86a434[_0x6b9d('0x14')],'app':_0x6b9d('0x19'),'appdata':_0x6b9d('0x3b'),'context':_0x86a434[_0x6b9d('0x16')],'exten':_0x86a434[_0x6b9d('0x8')],'priority':_0x2c869d[_0x6b9d('0x2a')]+_0x1789b5['priority']+_0xea8dce++,'VoiceExtensionId':_0x86a434[_0x6b9d('0x17')]});}}}for(var _0x475050=0x0;_0x475050<_0x2c869d['length'];_0x475050+=0x1){var _0x127772=_0x1789b5[_0x6b9d('0x10')]+_0x2c869d['length'];var _0x3ca4e3=_0x475050===_0x2c869d['length']-0x1?_0x1789b5[_0x6b9d('0x10')]+_0x4b7695[_0x6b9d('0x2a')]+_0x4c5af8[_0x6b9d('0x2a')]+0x2:_0x1789b5[_0x6b9d('0x10')]+_0x475050+0x1;_0x4b7695[_0x6b9d('0x3c')](_0x475050,0x0,{'type':_0x86a434[_0x6b9d('0x14')],'app':_0x6b9d('0x3d'),'appdata':_0x2c869d[_0x475050]+'?'+_0x86a434[_0x6b9d('0x16')]+_0x6b9d('0x3e')+_0x127772+':'+_0x86a434[_0x6b9d('0x16')]+_0x6b9d('0x3e')+_0x3ca4e3,'exten':_0x86a434[_0x6b9d('0x8')],'context':_0x86a434[_0x6b9d('0x16')],'priority':_0x1789b5[_0x6b9d('0x10')]+_0x475050,'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});}_0x86a434[_0x6b9d('0x10')]=_0x4b7695[_0x6b9d('0x2a')]?_['last'](_0x4b7695)[_0x6b9d('0x10')]+0x1:_0x1789b5[_0x6b9d('0x10')];_0x1789b5[_0x6b9d('0x10')]=(_0x4c5af8[_0x6b9d('0x2a')]?_[_0x6b9d('0x3f')](_0x4c5af8)['priority']:_0x86a434[_0x6b9d('0x10')])+0x1;_0x1789b5[_0x6b9d('0x11')]=_[_0x6b9d('0x40')](_0x1789b5[_0x6b9d('0x11')],_0x4b7695,[_0x86a434],_0x4c5af8);}_0x1789b5['extensions'][_0x6b9d('0x13')]({'type':_0x397cc9[_0x4b803f][0x0]['type'],'app':_0x6b9d('0x41'),'exten':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x8')],'context':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x16')],'priority':_0x1789b5[_0x6b9d('0x10')],'VoiceExtensionId':_0x397cc9[_0x4b803f][0x0][_0x6b9d('0x17')]});_0x468c49[_0x6b9d('0x13')](_0x397cc9[_0x4b803f][0x0]['VoiceExtensionId']);_0x2e9738=_[_0x6b9d('0x40')](_0x2e9738,_0x1789b5['extensions']);}}return _0x16bc3d[_0x6b9d('0x42')](function(_0x296ba6){return _0x16bc3d[_0x6b9d('0x1')][_0x6b9d('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x468c49}},'transaction':_0x296ba6})[_0x6b9d('0xa')](function(_0x53d7f5){return _0x16bc3d['models']['VoiceExtension']['bulkCreate'](_['sortBy'](_0x2e9738,'priority'),{'transaction':_0x296ba6});});});})[_0x6b9d('0x43')](function(_0x49b28e){console[_0x6b9d('0x44')](_0x49b28e);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 21e0ec4..2ef4d50 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 _0x9389=['ListId','CompanyId','find','duplicate','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','ContactId','updatedAt','select','field','NOW()','scheduledAt','toString','createdAt','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','id\x20IN\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','\x20=\x20?','str','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','get','all','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','CmContact','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','null','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email'];(function(_0x101b07,_0x32fd40){var _0x379034=function(_0x3f4823){while(--_0x3f4823){_0x101b07['push'](_0x101b07['shift']());}};_0x379034(++_0x32fd40);}(_0x9389,0xb2));var _0x9938=function(_0x4fe950,_0x122ba4){_0x4fe950=_0x4fe950-0x0;var _0x244076=_0x9389[_0x4fe950];return _0x244076;};'use strict';var BPromise=require('bluebird');var util=require(_0x9938('0x0'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x9938('0x1'));var Redis=require('ioredis');var db=require(_0x9938('0x2'))['db'];var config=require('../../../config/environment');var logger=require(_0x9938('0x3'))(_0x9938('0x4'));config[_0x9938('0x5')]=_[_0x9938('0x6')](config[_0x9938('0x5')],{'host':_0x9938('0x7'),'port':0x18eb});var socket=require(_0x9938('0x8'))(new Redis(config[_0x9938('0x5')]));require('../../../api/cmContact/cmContact.socket')[_0x9938('0x9')](socket);try{if(!process[_0x9938('0xa')][0x2]||process[_0x9938('0xa')][0x2]===_0x9938('0xb')||process[_0x9938('0xa')][0x2]==='null'){throw new Error(_0x9938('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0x9938('0xa')][0x3]||process[_0x9938('0xa')][0x3]===_0x9938('0xb')||process[_0x9938('0xa')][0x3]==='null'||!process[_0x9938('0xa')][0x4]||process[_0x9938('0xa')][0x4]===_0x9938('0xb')||process[_0x9938('0xa')][0x4]==='null'){throw new Error(_0x9938('0xd'));}var FIELDS=_['zipObject'](process[_0x9938('0xa')][0x3][_0x9938('0xe')](','),process[_0x9938('0xa')][0x4][_0x9938('0xe')](','));if(!process[_0x9938('0xa')][0x5]||process[_0x9938('0xa')][0x5]===_0x9938('0xb')||process[_0x9938('0xa')][0x5]===_0x9938('0xf')){throw new Error(_0x9938('0x10'));}var LISTID=process[_0x9938('0xa')][0x5];var COMPANYID=process[_0x9938('0xa')][0x6]&&process[_0x9938('0xa')][0x6]!==_0x9938('0xb')&&process['argv'][0x6]!==_0x9938('0xf')?process[_0x9938('0xa')][0x6]:null;var DUPLICATES=process[_0x9938('0xa')][0x7]&&process[_0x9938('0xa')][0x7]!==_0x9938('0xb')&&process[_0x9938('0xa')][0x7]!==_0x9938('0xf')?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x9938('0xa')][0x8]===_0x9938('0xb')||process[_0x9938('0xa')][0x8]==='null'){throw new Error(_0x9938('0x11'));}var SOCKET_TIMESTAMP=process[_0x9938('0xa')][0x8];}catch(_0x4641a1){logger[_0x9938('0x12')](_0x4641a1);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(_0x353163,_0x422a6b,_0x3312d7,_0x31d317){var _0x41d225={'message':_0x422a6b};_0x41d225[_0x353163]=!![];if(_0x3312d7){_0x41d225['contact']=_0x3312d7;}if(_0x31d317){_0x41d225[_0x9938('0x13')]=_0x31d317;}return _0x41d225;}function isEmail(_0x5e679d){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'](_0x5e679d);}function checkRow(_0x3f457e,_0x2e30d5,_0x18c483){return new BPromise(function(_0x65583b,_0x476bdb){if(_[_0x9938('0x14')](_0x3f457e)){return _0x476bdb(handleCheckRowError('error',_0x9938('0x15'),null,_0x18c483));}if(_0x3f457e['errors']&&_0x3f457e[_0x9938('0x16')][_0x9938('0x17')]){var _0x537a2b=_[_0x9938('0x18')](_0x3f457e[_0x9938('0x16')],_0x9938('0x19'))[_0x9938('0x1a')](';');return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x537a2b,null,_0x18c483));}var _0x66846a={};for(var _0x27c260 in FIELDS){if(FIELDS['hasOwnProperty'](_0x27c260)&&FIELDS[_0x27c260]){_0x66846a[_0x27c260]=_0x3f457e[_0x9938('0x1b')][0x0][FIELDS[_0x27c260]]||_0x3f457e[_0x9938('0x1b')][0x0]['\ufeff'+FIELDS[_0x27c260]];}}if(!_0x66846a[_0x9938('0x1c')]){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x1d'),null,_0x18c483));}if(!_0x66846a[_0x9938('0x1e')]){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x1f'),null,_0x18c483));}if(_0x66846a[_0x9938('0x20')]){var _0x17885c=moment(_0x66846a[_0x9938('0x20')],_0x9938('0x21'));if(!_0x17885c['isValid']()){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x22'),null,_0x18c483));}}if(_0x66846a[_0x9938('0x23')]){if(!isEmail(_0x66846a[_0x9938('0x23')])){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x18c483));}}_0x66846a[_0x9938('0x24')]=LISTID;_0x66846a[_0x9938('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9938('0x17')]&&_0x2e30d5){var _0x4aa09e={};for(var _0x400690=0x0,_0x353055=DUPLICATES[_0x9938('0x17')];_0x400690<_0x353055;_0x400690+=0x1){_0x4aa09e[DUPLICATES[_0x400690]]=_0x66846a[DUPLICATES[_0x400690]];}var _0x8b446c=_[_0x9938('0x26')](_0x2e30d5,_0x4aa09e);if(_0x8b446c){return _0x476bdb(handleCheckRowError(_0x9938('0x27'),_0x9938('0x28'),_0x8b446c,_0x18c483));}}return db['CmContact']['create'](_0x66846a,{'raw':!![],'hooks':![],'fields':_[_0x9938('0x29')](_0x66846a)})[_0x9938('0x2a')](function(_0x47e75c){if(DUPLICATES&&DUPLICATES[_0x9938('0x17')]&&_0x2e30d5){_0x2e30d5[_0x9938('0x2b')](_[_0x9938('0x2c')](_0x66846a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x47e75c['id'];return _0x65583b();})[_0x9938('0x2d')](function(_0x5cb41e){return _0x476bdb(handleCheckRowError(_0x9938('0x12'),_0x9938('0x2e')+(_0x5cb41e[_0x9938('0x19')]||JSON[_0x9938('0x2f')](_0x5cb41e)),null,_0x18c483));});});}function checkHopper(){function _0x57ce1d(){return function(_0x4af519){logger[_0x9938('0x12')](_0x9938('0x30'),_0x9938('0x31'),util['inspect'](_0x4af519,{'showHidden':![],'depth':null}));};}var _0x52d66a=function(_0x55449a,_0xa0a369){var _0x1654e2=squel[_0x9938('0x32')]()[_0x9938('0x33')](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),'scheduledAt',_0x9938('0x36'),_0x9938('0x24'),_0xa0a369,'createdAt',_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3b'))[_0x9938('0x39')]('id',_0x9938('0x36'))['field'](LISTID['toString'](),_0x9938('0x24'))['field'](_0x55449a['id'][_0x9938('0x3c')](),_0xa0a369)[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())['where'](_0x9938('0x42'))[_0x9938('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x9938('0x1e'))['from'](_0x9938('0x34'))['where'](_0xa0a369+'\x20=\x20?',_0x55449a['id']['toString']())))[_0x9938('0x3c')]();return _0x1654e2;};var _0x51fe5d=function(_0x1f6968,_0x1e738f){var _0x41fc1a=squel[_0x9938('0x32')]()['into'](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x3b'),_0x9938('0x36'),_0x9938('0x24'),_0x1e738f,_0x9938('0x3d'),_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field'](_0x9938('0x3a'),_0x9938('0x3b'))['field']('id',_0x9938('0x36'))['field'](LISTID[_0x9938('0x3c')](),_0x9938('0x24'))[_0x9938('0x39')](_0x1f6968['id'][_0x9938('0x3c')](),_0x1e738f)['field'](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())[_0x9938('0x3f')](_0x9938('0x43'),squel['str'](hopperContacts))[_0x9938('0x3f')](_0x9938('0x42'))[_0x9938('0x3f')](_0x9938('0x44'),squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x45'))[_0x9938('0x3e')](_0x9938('0x46'))[_0x9938('0x3f')](_0x1e738f+'\x20=\x20?',_0x1f6968['id'][_0x9938('0x3c')]()))[_0x9938('0x3f')](_0x9938('0x44'),squel['select']()[_0x9938('0x39')](_0x9938('0x1e'))['from']('cm_hopper')['where'](_0x1e738f+_0x9938('0x47'),_0x1f6968['id'][_0x9938('0x3c')]())))[_0x9938('0x3c')]();return _0x41fc1a;};function _0x6358db(_0x326098,_0x105bb1){var _0x4be375=squel['insert']()[_0x9938('0x33')](_0x9938('0x34'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x3b'),'ContactId',_0x9938('0x24'),_0x105bb1,_0x9938('0x3d'),'updatedAt'],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field'](_0x9938('0x3a'),_0x9938('0x3b'))['field']('id',_0x9938('0x36'))['field'](LISTID[_0x9938('0x3c')](),_0x9938('0x24'))[_0x9938('0x39')](_0x326098['id'][_0x9938('0x3c')](),_0x105bb1)[_0x9938('0x39')](_0x9938('0x3a'),_0x9938('0x3d'))[_0x9938('0x39')]('NOW()',_0x9938('0x37'))[_0x9938('0x3e')]('cm_contacts')[_0x9938('0x3f')](_0x9938('0x40'))[_0x9938('0x3f')](_0x9938('0x41'),LISTID['toString']())['where'](_0x9938('0x43'),squel[_0x9938('0x48')](hopperContacts))[_0x9938('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x9938('0x3c')]();return _0x4be375;}function _0x4b2068(_0x4315cb,_0x152fdd){var _0x2b61a2=squel[_0x9938('0x32')]()['into'](_0x9938('0x49'))[_0x9938('0x35')]([_0x9938('0x1e'),_0x9938('0x36'),_0x9938('0x24'),_0x152fdd,'createdAt',_0x9938('0x37')],squel[_0x9938('0x38')]()[_0x9938('0x39')](_0x9938('0x1e'),_0x9938('0x1e'))['field']('id',_0x9938('0x36'))[_0x9938('0x39')](LISTID[_0x9938('0x3c')](),'ListId')['field'](_0x4315cb['id'][_0x9938('0x3c')](),_0x152fdd)['field'](_0x9938('0x3a'),_0x9938('0x3d'))['field']('NOW()','updatedAt')['from'](_0x9938('0x4a'))[_0x9938('0x3f')]('deletedAt\x20IS\x20NULL')[_0x9938('0x3f')](_0x9938('0x41'),LISTID[_0x9938('0x3c')]())[_0x9938('0x3f')]('id\x20IN\x20?',squel[_0x9938('0x48')](hopperContacts))[_0x9938('0x3f')](_0x9938('0x42')))['toString']();return _0x2b61a2;}return db[_0x9938('0x4b')][_0x9938('0x4c')]({'where':{'type':_0x9938('0x4d')},'attributes':['id',_0x9938('0x4e')],'include':[{'model':db[_0x9938('0x4f')],'as':_0x9938('0x50'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x4a8b31){var _0xcdcf31=[];if(_0x4a8b31){var _0x545c87;for(var _0x2369e2=0x0,_0x22263e;_0x2369e2<_0x4a8b31[_0x9938('0x17')];_0x2369e2+=0x1){_0x22263e=_0x4a8b31[_0x2369e2]['get']({'plain':!![]});switch(_0x22263e[_0x9938('0x4e')]){case'always':_0xcdcf31[_0x9938('0x2b')](db[_0x9938('0x51')][_0x9938('0x52')](_0x51fe5d(_0x22263e,_0x9938('0x53')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));break;case _0x9938('0x54'):_0xcdcf31['push'](db['sequelize'][_0x9938('0x52')](_0x52d66a(_0x22263e,'VoiceQueueId'))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));break;default:_0xcdcf31[_0x9938('0x2b')](db[_0x9938('0x51')]['query'](_0x6358db(_0x22263e,'VoiceQueueId'))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}}return _0xcdcf31;})['all']()[_0x9938('0x2a')](function(){return db[_0x9938('0x4b')][_0x9938('0x4c')]({'where':{'type':_0x9938('0x4d')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x9938('0x55'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x387d6f){var _0x51dfbb=[];if(_0x387d6f){var _0x2e4a01;for(var _0x5bab36=0x0,_0x2a6641;_0x5bab36<_0x387d6f[_0x9938('0x17')];_0x5bab36+=0x1){_0x2a6641=_0x387d6f[_0x5bab36][_0x9938('0x56')]({'plain':!![]});_0x51dfbb[_0x9938('0x2b')](db[_0x9938('0x51')]['query'](_0x4b2068(_0x2a6641,'VoiceQueueId'))['then'](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}return _0x51dfbb;})[_0x9938('0x57')]();})[_0x9938('0x2a')](function(){return db[_0x9938('0x58')][_0x9938('0x4c')]({'attributes':['id',_0x9938('0x4e')],'include':[{'model':db[_0x9938('0x4f')],'as':_0x9938('0x50'),'where':{'id':LISTID}}]})[_0x9938('0x2a')](function(_0x33c8a5){var _0x19301f=[];if(_0x33c8a5){for(var _0x574df1=0x0,_0x42a51e;_0x574df1<_0x33c8a5[_0x9938('0x17')];_0x574df1+=0x1){_0x42a51e=_0x33c8a5[_0x574df1][_0x9938('0x56')]({'plain':!![]});switch(_0x42a51e[_0x9938('0x4e')]){case _0x9938('0x59'):_0x19301f[_0x9938('0x2b')](db['sequelize'][_0x9938('0x52')](_0x51fe5d(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));break;case'onlyIfOpen':_0x19301f[_0x9938('0x2b')](db[_0x9938('0x51')][_0x9938('0x52')](_0x52d66a(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));break;default:_0x19301f['push'](db[_0x9938('0x51')][_0x9938('0x52')](_0x6358db(_0x42a51e,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})[_0x9938('0x2d')](_0x57ce1d()));}}}return _0x19301f;})['all']();})['then'](function(){return db[_0x9938('0x58')][_0x9938('0x4c')]({'attributes':['id'],'include':[{'model':db[_0x9938('0x4f')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0xc73d15){var _0x370e48=[];if(_0xc73d15){for(var _0x2762fb=0x0,_0x2acb2b;_0x2762fb<_0xc73d15[_0x9938('0x17')];_0x2762fb+=0x1){_0x2acb2b=_0xc73d15[_0x2762fb][_0x9938('0x56')]({'plain':!![]});_0x370e48['push'](db['sequelize'][_0x9938('0x52')](_0x4b2068(_0x2acb2b,_0x9938('0x5a')))[_0x9938('0x2a')](function(){})['catch'](_0x57ce1d()));}}return _0x370e48;})[_0x9938('0x57')]();})[_0x9938('0x2d')](function(_0x3599ab){logger[_0x9938('0x12')](_0x9938('0x5b'),'generalCheckHopper',_0x3599ab[_0x9938('0x19')]);});}var processPromises=function(_0xb8427d){return BPromise[_0x9938('0x57')](promises)[_0x9938('0x2a')](function(_0x28d97f){})['catch'](function(_0x50dbb5){logger[_0x9938('0x12')](_0x9938('0x5c'),JSON[_0x9938('0x2f')](_0x50dbb5));})[_0x9938('0x5d')](function(){socket[_0x9938('0x5e')](_0x9938('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xb8427d){return _0xb8427d[_0x9938('0x60')]();}});};var endCsv=function(){return BPromise[_0x9938('0x61')]()[_0x9938('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x9938('0x2a')](function(){socket[_0x9938('0x5e')](_0x9938('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9938('0x62')](FILEPATH);}catch(_0x399eb4){logger[_0x9938('0x12')](_0x9938('0x63'),JSON[_0x9938('0x2f')](_0x399eb4));}finally{process[_0x9938('0x64')](0x0);}});};process['on']('SIGINT',function(){logger[_0x9938('0x65')](_0x9938('0x66'));endCsv();});function main(){return BPromise[_0x9938('0x61')]()[_0x9938('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x9938('0xe')](',');return db[_0x9938('0x67')][_0x9938('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9938('0x2a')](function(_0x2c0699){var _0x182b58=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x182b58,{'header':!![],'skipEmptyLines':!![],'step':function(_0x35ed64,_0x1fcf0e){total+=0x1;var _0x2242e2=total;promises['push'](checkRow(_0x35ed64,_0x2c0699,_0x2242e2)[_0x9938('0x2a')](function(){success+=0x1;})['catch'](function(_0x35d012){if(_0x35d012[_0x9938('0x12')]){errors+=0x1;delete _0x35d012[_0x9938('0x12')];}else if(_0x35d012[_0x9938('0x27')]){duplicates+=0x1;delete _0x35d012[_0x9938('0x27')];}rows[_0x9938('0x2b')](_0x35d012);}));if(total%0xc8===0x0){_0x1fcf0e['pause']();return processPromises(_0x1fcf0e);}},'complete':function(){return processPromises()[_0x9938('0x2a')](function(){logger[_0x9938('0x65')](_0x9938('0x68'));endCsv();});},'error':function(_0x2ad14d,_0x5472e4){logger['info'](_0x9938('0x69'),JSON['stringify'](_0x2ad14d));endCsv();}});})[_0x9938('0x2d')](function(_0x183357){logger['error'](_0x9938('0x6a'),JSON[_0x9938('0x2f')](_0x183357));});}main(); \ No newline at end of file +var _0x2e26=['outbound','dialCheckDuplicateType','Lists','then','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','get','all','Campaign','CmList','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','resume','resolve','contact:csv_','unlinkSync','exit','SIGINT','info','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','toString','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e26,0x1dc));var _0x62e2=function(_0x4a664c,_0x3bed21){_0x4a664c=_0x4a664c-0x0;var _0x4e4c76=_0x2e26[_0x4a664c];return _0x4e4c76;};'use strict';var BPromise=require(_0x62e2('0x0'));var util=require(_0x62e2('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x62e2('0x2'));var Redis=require(_0x62e2('0x3'));var db=require(_0x62e2('0x4'))['db'];var config=require(_0x62e2('0x5'));var logger=require(_0x62e2('0x6'))(_0x62e2('0x7'));config[_0x62e2('0x8')]=_['defaults'](config[_0x62e2('0x8')],{'host':_0x62e2('0x9'),'port':0x18eb});var socket=require(_0x62e2('0xa'))(new Redis(config[_0x62e2('0x8')]));require(_0x62e2('0xb'))[_0x62e2('0xc')](socket);try{if(!process[_0x62e2('0xd')][0x2]||process['argv'][0x2]===_0x62e2('0xe')||process[_0x62e2('0xd')][0x2]===_0x62e2('0xf')){throw new Error(_0x62e2('0x10'));}var FILEPATH=process[_0x62e2('0xd')][0x2];if(!process[_0x62e2('0xd')][0x3]||process[_0x62e2('0xd')][0x3]===_0x62e2('0xe')||process[_0x62e2('0xd')][0x3]==='null'||!process['argv'][0x4]||process[_0x62e2('0xd')][0x4]===_0x62e2('0xe')||process[_0x62e2('0xd')][0x4]===_0x62e2('0xf')){throw new Error(_0x62e2('0x11'));}var FIELDS=_[_0x62e2('0x12')](process[_0x62e2('0xd')][0x3][_0x62e2('0x13')](','),process[_0x62e2('0xd')][0x4]['split'](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0x62e2('0xe')||process['argv'][0x5]===_0x62e2('0xf')){throw new Error(_0x62e2('0x14'));}var LISTID=process[_0x62e2('0xd')][0x5];var COMPANYID=process[_0x62e2('0xd')][0x6]&&process[_0x62e2('0xd')][0x6]!=='undefined'&&process[_0x62e2('0xd')][0x6]!==_0x62e2('0xf')?process[_0x62e2('0xd')][0x6]:null;var DUPLICATES=process[_0x62e2('0xd')][0x7]&&process[_0x62e2('0xd')][0x7]!==_0x62e2('0xe')&&process[_0x62e2('0xd')][0x7]!==_0x62e2('0xf')?process[_0x62e2('0xd')][0x7]:null;if(!process[_0x62e2('0xd')][0x8]||process['argv'][0x8]===_0x62e2('0xe')||process[_0x62e2('0xd')][0x8]===_0x62e2('0xf')){throw new Error(_0x62e2('0x15'));}var SOCKET_TIMESTAMP=process[_0x62e2('0xd')][0x8];}catch(_0x34d74d){logger['error'](_0x34d74d);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(_0x4403cb,_0x47f9d6,_0x32e2ad,_0x59b02b){var _0x1e7665={'message':_0x47f9d6};_0x1e7665[_0x4403cb]=!![];if(_0x32e2ad){_0x1e7665[_0x62e2('0x16')]=_0x32e2ad;}if(_0x59b02b){_0x1e7665[_0x62e2('0x17')]=_0x59b02b;}return _0x1e7665;}function isEmail(_0x241210){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'](_0x241210);}function checkRow(_0x30769e,_0x2e32bc,_0x247dc4){return new BPromise(function(_0x2a5405,_0x6fc165){if(_[_0x62e2('0x18')](_0x30769e)){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),_0x62e2('0x1a'),null,_0x247dc4));}if(_0x30769e[_0x62e2('0x1b')]&&_0x30769e[_0x62e2('0x1b')][_0x62e2('0x1c')]){var _0x43b020=_[_0x62e2('0x1d')](_0x30769e[_0x62e2('0x1b')],'message')[_0x62e2('0x1e')](';');return _0x6fc165(handleCheckRowError('error',_0x43b020,null,_0x247dc4));}var _0x4217de={};for(var _0x22e39f in FIELDS){if(FIELDS[_0x62e2('0x1f')](_0x22e39f)&&FIELDS[_0x22e39f]){_0x4217de[_0x22e39f]=_0x30769e[_0x62e2('0x20')][0x0][FIELDS[_0x22e39f]]||_0x30769e['data'][0x0]['\ufeff'+FIELDS[_0x22e39f]];}}if(!_0x4217de[_0x62e2('0x21')]){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),_0x62e2('0x22'),null,_0x247dc4));}if(!_0x4217de['phone']){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),'phone\x20not\x20specified!',null,_0x247dc4));}if(_0x4217de[_0x62e2('0x23')]){var _0x3d1bd8=moment(_0x4217de[_0x62e2('0x23')],_0x62e2('0x24'));if(!_0x3d1bd8['isValid']()){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),_0x62e2('0x25'),null,_0x247dc4));}}if(_0x4217de[_0x62e2('0x26')]){if(!isEmail(_0x4217de['email'])){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),_0x62e2('0x27'),null,_0x247dc4));}}_0x4217de[_0x62e2('0x28')]=LISTID;_0x4217de[_0x62e2('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2e32bc){var _0x26090d={};for(var _0x201430=0x0,_0x36648b=DUPLICATES[_0x62e2('0x1c')];_0x201430<_0x36648b;_0x201430+=0x1){_0x26090d[DUPLICATES[_0x201430]]=_0x4217de[DUPLICATES[_0x201430]];}var _0x3ca9d2=_[_0x62e2('0x2a')](_0x2e32bc,_0x26090d);if(_0x3ca9d2){return _0x6fc165(handleCheckRowError(_0x62e2('0x2b'),'Duplicate\x20Contact',_0x3ca9d2,_0x247dc4));}}return db['CmContact'][_0x62e2('0x2c')](_0x4217de,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4217de)})['then'](function(_0x10cb67){if(DUPLICATES&&DUPLICATES[_0x62e2('0x1c')]&&_0x2e32bc){_0x2e32bc['push'](_[_0x62e2('0x2d')](_0x4217de,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x10cb67['id'];return _0x2a5405();})[_0x62e2('0x2e')](function(_0x13495a){return _0x6fc165(handleCheckRowError(_0x62e2('0x19'),_0x62e2('0x2f')+(_0x13495a[_0x62e2('0x30')]||JSON[_0x62e2('0x31')](_0x13495a)),null,_0x247dc4));});});}function checkHopper(){function _0x475519(){return function(_0x505a4a){logger[_0x62e2('0x19')](_0x62e2('0x32'),_0x62e2('0x33'),util[_0x62e2('0x34')](_0x505a4a,{'showHidden':![],'depth':null}));};}var _0x15f0d1=function(_0x156d01,_0x3301f3){var _0x29e7f9=squel[_0x62e2('0x35')]()[_0x62e2('0x36')](_0x62e2('0x37'))[_0x62e2('0x38')]([_0x62e2('0x39'),_0x62e2('0x3a'),_0x62e2('0x3b'),'ListId',_0x3301f3,_0x62e2('0x3c'),_0x62e2('0x3d')],squel[_0x62e2('0x3e')]()[_0x62e2('0x3f')](_0x62e2('0x39'),_0x62e2('0x39'))[_0x62e2('0x3f')]('NOW()',_0x62e2('0x3a'))[_0x62e2('0x3f')]('id',_0x62e2('0x3b'))[_0x62e2('0x3f')](LISTID['toString'](),_0x62e2('0x28'))[_0x62e2('0x3f')](_0x156d01['id']['toString'](),_0x3301f3)[_0x62e2('0x3f')](_0x62e2('0x40'),_0x62e2('0x3c'))[_0x62e2('0x3f')]('NOW()',_0x62e2('0x3d'))[_0x62e2('0x41')](_0x62e2('0x42'))[_0x62e2('0x43')](_0x62e2('0x44'))[_0x62e2('0x43')](_0x62e2('0x45'),LISTID[_0x62e2('0x46')]())[_0x62e2('0x43')](_0x62e2('0x47'))[_0x62e2('0x43')](_0x62e2('0x48'),squel[_0x62e2('0x3e')]()[_0x62e2('0x3f')](_0x62e2('0x39'))[_0x62e2('0x41')](_0x62e2('0x37'))[_0x62e2('0x43')](_0x3301f3+_0x62e2('0x49'),_0x156d01['id'][_0x62e2('0x46')]())))['toString']();return _0x29e7f9;};var _0x32e4b3=function(_0x2882e2,_0x484ab6){var _0x36a4ce=squel['insert']()['into'](_0x62e2('0x37'))[_0x62e2('0x38')]([_0x62e2('0x39'),_0x62e2('0x3a'),'ContactId',_0x62e2('0x28'),_0x484ab6,_0x62e2('0x3c'),'updatedAt'],squel[_0x62e2('0x3e')]()['field'](_0x62e2('0x39'),'phone')[_0x62e2('0x3f')](_0x62e2('0x40'),'scheduledAt')[_0x62e2('0x3f')]('id',_0x62e2('0x3b'))[_0x62e2('0x3f')](LISTID['toString'](),_0x62e2('0x28'))['field'](_0x2882e2['id'][_0x62e2('0x46')](),_0x484ab6)[_0x62e2('0x3f')]('NOW()',_0x62e2('0x3c'))[_0x62e2('0x3f')]('NOW()',_0x62e2('0x3d'))[_0x62e2('0x41')](_0x62e2('0x42'))[_0x62e2('0x43')](_0x62e2('0x44'))['where'](_0x62e2('0x45'),LISTID[_0x62e2('0x46')]())[_0x62e2('0x43')](_0x62e2('0x4a'),squel[_0x62e2('0x4b')](hopperContacts))[_0x62e2('0x43')](_0x62e2('0x47'))['where'](_0x62e2('0x48'),squel[_0x62e2('0x3e')]()[_0x62e2('0x3f')]('calleridnum')[_0x62e2('0x41')]('cm_hopper_final')[_0x62e2('0x43')](_0x484ab6+_0x62e2('0x49'),_0x2882e2['id'][_0x62e2('0x46')]()))[_0x62e2('0x43')](_0x62e2('0x48'),squel['select']()['field'](_0x62e2('0x39'))[_0x62e2('0x41')](_0x62e2('0x37'))[_0x62e2('0x43')](_0x484ab6+_0x62e2('0x49'),_0x2882e2['id'][_0x62e2('0x46')]())))['toString']();return _0x36a4ce;};function _0x27ce73(_0x142fdd,_0x1dc317){var _0x503ae3=squel[_0x62e2('0x35')]()[_0x62e2('0x36')](_0x62e2('0x37'))[_0x62e2('0x38')]([_0x62e2('0x39'),_0x62e2('0x3a'),_0x62e2('0x3b'),_0x62e2('0x28'),_0x1dc317,_0x62e2('0x3c'),_0x62e2('0x3d')],squel[_0x62e2('0x3e')]()[_0x62e2('0x3f')](_0x62e2('0x39'),_0x62e2('0x39'))['field'](_0x62e2('0x40'),_0x62e2('0x3a'))['field']('id',_0x62e2('0x3b'))[_0x62e2('0x3f')](LISTID[_0x62e2('0x46')](),_0x62e2('0x28'))[_0x62e2('0x3f')](_0x142fdd['id'][_0x62e2('0x46')](),_0x1dc317)[_0x62e2('0x3f')](_0x62e2('0x40'),'createdAt')[_0x62e2('0x3f')](_0x62e2('0x40'),_0x62e2('0x3d'))[_0x62e2('0x41')](_0x62e2('0x42'))['where'](_0x62e2('0x44'))[_0x62e2('0x43')](_0x62e2('0x45'),LISTID[_0x62e2('0x46')]())[_0x62e2('0x43')](_0x62e2('0x4a'),squel[_0x62e2('0x4b')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x503ae3;}function _0x1702e2(_0x3f680a,_0x1e0890){var _0x2143f5=squel[_0x62e2('0x35')]()[_0x62e2('0x36')](_0x62e2('0x4c'))[_0x62e2('0x38')](['phone','ContactId',_0x62e2('0x28'),_0x1e0890,_0x62e2('0x3c'),_0x62e2('0x3d')],squel[_0x62e2('0x3e')]()['field'](_0x62e2('0x39'),_0x62e2('0x39'))['field']('id',_0x62e2('0x3b'))[_0x62e2('0x3f')](LISTID[_0x62e2('0x46')](),_0x62e2('0x28'))[_0x62e2('0x3f')](_0x3f680a['id']['toString'](),_0x1e0890)[_0x62e2('0x3f')](_0x62e2('0x40'),'createdAt')[_0x62e2('0x3f')](_0x62e2('0x40'),_0x62e2('0x3d'))['from'](_0x62e2('0x42'))[_0x62e2('0x43')](_0x62e2('0x44'))[_0x62e2('0x43')](_0x62e2('0x45'),LISTID[_0x62e2('0x46')]())[_0x62e2('0x43')](_0x62e2('0x4a'),squel[_0x62e2('0x4b')](hopperContacts))[_0x62e2('0x43')](_0x62e2('0x47')))[_0x62e2('0x46')]();return _0x2143f5;}return db[_0x62e2('0x4d')][_0x62e2('0x4e')]({'where':{'type':_0x62e2('0x4f')},'attributes':['id',_0x62e2('0x50')],'include':[{'model':db['CmList'],'as':_0x62e2('0x51'),'where':{'id':LISTID}}]})[_0x62e2('0x52')](function(_0x55c737){var _0xf8eb2f=[];if(_0x55c737){var _0x52020e;for(var _0x53667f=0x0,_0x4e4538;_0x53667f<_0x55c737[_0x62e2('0x1c')];_0x53667f+=0x1){_0x4e4538=_0x55c737[_0x53667f]['get']({'plain':!![]});switch(_0x4e4538[_0x62e2('0x50')]){case _0x62e2('0x53'):_0xf8eb2f[_0x62e2('0x54')](db[_0x62e2('0x55')][_0x62e2('0x56')](_0x32e4b3(_0x4e4538,_0x62e2('0x57')))[_0x62e2('0x52')](function(){})[_0x62e2('0x2e')](_0x475519()));break;case _0x62e2('0x58'):_0xf8eb2f['push'](db[_0x62e2('0x55')][_0x62e2('0x56')](_0x15f0d1(_0x4e4538,_0x62e2('0x57')))[_0x62e2('0x52')](function(){})[_0x62e2('0x2e')](_0x475519()));break;default:_0xf8eb2f[_0x62e2('0x54')](db['sequelize'][_0x62e2('0x56')](_0x27ce73(_0x4e4538,_0x62e2('0x57')))[_0x62e2('0x52')](function(){})[_0x62e2('0x2e')](_0x475519()));}}}return _0xf8eb2f;})['all']()[_0x62e2('0x52')](function(){return db[_0x62e2('0x4d')][_0x62e2('0x4e')]({'where':{'type':_0x62e2('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x62e2('0x59'),'where':{'id':LISTID}}]})[_0x62e2('0x52')](function(_0x562345){var _0x1df35e=[];if(_0x562345){var _0x54a6a5;for(var _0x2a0ab3=0x0,_0x4d0fce;_0x2a0ab3<_0x562345['length'];_0x2a0ab3+=0x1){_0x4d0fce=_0x562345[_0x2a0ab3][_0x62e2('0x5a')]({'plain':!![]});_0x1df35e['push'](db['sequelize']['query'](_0x1702e2(_0x4d0fce,'VoiceQueueId'))[_0x62e2('0x52')](function(){})[_0x62e2('0x2e')](_0x475519()));}}return _0x1df35e;})[_0x62e2('0x5b')]();})[_0x62e2('0x52')](function(){return db[_0x62e2('0x5c')]['findAll']({'attributes':['id',_0x62e2('0x50')],'include':[{'model':db[_0x62e2('0x5d')],'as':'Lists','where':{'id':LISTID}}]})[_0x62e2('0x52')](function(_0x1cbc29){var _0xf7cdeb=[];if(_0x1cbc29){for(var _0x39c6be=0x0,_0x5194c0;_0x39c6be<_0x1cbc29[_0x62e2('0x1c')];_0x39c6be+=0x1){_0x5194c0=_0x1cbc29[_0x39c6be][_0x62e2('0x5a')]({'plain':!![]});switch(_0x5194c0[_0x62e2('0x50')]){case _0x62e2('0x53'):_0xf7cdeb[_0x62e2('0x54')](db[_0x62e2('0x55')][_0x62e2('0x56')](_0x32e4b3(_0x5194c0,_0x62e2('0x5e')))[_0x62e2('0x52')](function(){})['catch'](_0x475519()));break;case'onlyIfOpen':_0xf7cdeb[_0x62e2('0x54')](db['sequelize']['query'](_0x15f0d1(_0x5194c0,_0x62e2('0x5e')))['then'](function(){})['catch'](_0x475519()));break;default:_0xf7cdeb['push'](db[_0x62e2('0x55')][_0x62e2('0x56')](_0x27ce73(_0x5194c0,'CampaignId'))[_0x62e2('0x52')](function(){})[_0x62e2('0x2e')](_0x475519()));}}}return _0xf7cdeb;})[_0x62e2('0x5b')]();})[_0x62e2('0x52')](function(){return db[_0x62e2('0x5c')][_0x62e2('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x62e2('0x5d')],'as':_0x62e2('0x59'),'where':{'id':LISTID}}]})[_0x62e2('0x52')](function(_0x44eac0){var _0xc87363=[];if(_0x44eac0){for(var _0x497132=0x0,_0x31e32f;_0x497132<_0x44eac0[_0x62e2('0x1c')];_0x497132+=0x1){_0x31e32f=_0x44eac0[_0x497132]['get']({'plain':!![]});_0xc87363['push'](db[_0x62e2('0x55')]['query'](_0x1702e2(_0x31e32f,_0x62e2('0x5e')))['then'](function(){})[_0x62e2('0x2e')](_0x475519()));}}return _0xc87363;})[_0x62e2('0x5b')]();})[_0x62e2('0x2e')](function(_0x3377a6){logger[_0x62e2('0x19')](_0x62e2('0x5f'),'generalCheckHopper',_0x3377a6[_0x62e2('0x30')]);});}var processPromises=function(_0x43ee0c){return BPromise[_0x62e2('0x5b')](promises)[_0x62e2('0x52')](function(_0x3a532a){})[_0x62e2('0x2e')](function(_0x3c4bb8){logger[_0x62e2('0x19')](_0x62e2('0x60'),JSON[_0x62e2('0x31')](_0x3c4bb8));})[_0x62e2('0x61')](function(){socket[_0x62e2('0x62')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x43ee0c){return _0x43ee0c[_0x62e2('0x63')]();}});};var endCsv=function(){return BPromise[_0x62e2('0x64')]()[_0x62e2('0x52')](function(){if(hopperContacts){return checkHopper();}})[_0x62e2('0x52')](function(){socket[_0x62e2('0x62')](_0x62e2('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x62e2('0x66')](FILEPATH);}catch(_0x444812){logger[_0x62e2('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x62e2('0x31')](_0x444812));}finally{process[_0x62e2('0x67')](0x0);}});};process['on'](_0x62e2('0x68'),function(){logger[_0x62e2('0x69')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x62e2('0x64')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x62e2('0x13')](',');return db[_0x62e2('0x6a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb9a22){var _0x3c8a22=fs[_0x62e2('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x62e2('0x6c')](_0x3c8a22,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3296e3,_0x3ae3f6){total+=0x1;var _0x2b25af=total;promises[_0x62e2('0x54')](checkRow(_0x3296e3,_0xb9a22,_0x2b25af)[_0x62e2('0x52')](function(){success+=0x1;})[_0x62e2('0x2e')](function(_0x47bee2){if(_0x47bee2[_0x62e2('0x19')]){errors+=0x1;delete _0x47bee2['error'];}else if(_0x47bee2[_0x62e2('0x2b')]){duplicates+=0x1;delete _0x47bee2[_0x62e2('0x2b')];}rows[_0x62e2('0x54')](_0x47bee2);}));if(total%0xc8===0x0){_0x3ae3f6[_0x62e2('0x6d')]();return processPromises(_0x3ae3f6);}},'complete':function(){return processPromises()[_0x62e2('0x52')](function(){logger['info'](_0x62e2('0x6e'));endCsv();});},'error':function(_0x906214,_0x7a46a2){logger[_0x62e2('0x69')]('CSV\x20parse\x20error',JSON[_0x62e2('0x31')](_0x906214));endCsv();}});})['catch'](function(_0x5a2599){logger[_0x62e2('0x19')]('Error\x20executing\x20contact\x20csv\x20import:',JSON['stringify'](_0x5a2599));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index c954f8e..d86cb80 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 _0x0fdf=['cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','toString','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper_black','\x20=\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','id\x20IN\x20?','MIN(id)','info','Received\x20SIGINT','error','message','exit','errors','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','sequelize','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','stringify','send','start','binding','clone','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','createReadStream','rows','data','find','hasOwnProperty','trim','replace','isValid','isNaN','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','emit','unlink','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','papaparse','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','AdditionalPhones','then','length','push','split','all','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts'];(function(_0x5e849c,_0x4cbd22){var _0x26adea=function(_0x5db633){while(--_0x5db633){_0x5e849c['push'](_0x5e849c['shift']());}};_0x26adea(++_0x4cbd22);}(_0x0fdf,0x79));var _0xf0fd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fdf[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xf0fd('0x0'));var util=require('util');var BPromise=require(_0xf0fd('0x1'));var moment=require(_0xf0fd('0x2'));var squel=require(_0xf0fd('0x3'));var Redis=require(_0xf0fd('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xf0fd('0x5'));var shared=require(_0xf0fd('0x6'));var logger=require('../../../config/logger')('import');config[_0xf0fd('0x7')]=_['defaults'](config[_0xf0fd('0x7')],{'host':_0xf0fd('0x8'),'port':0x18eb});var socket=require(_0xf0fd('0x9'))(new Redis(config[_0xf0fd('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xf0fd('0xa')](_0xf0fd('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x59ea2d){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'](_0x59ea2d);}function selectNotIn(_0xa2915e,_0x1e4743,_0x2ecbda,_0xbf2715,_0x2185bc){return squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')](_0xf0fd('0xe'))[_0xf0fd('0xf')](_0xbf2715)[_0xf0fd('0x10')](_0x1e4743,null,_0x1e4743+_0xf0fd('0x11')+_0xbf2715+'.'+_0x2ecbda)[_0xf0fd('0x12')](_0xbf2715+'.'+_0x2ecbda+'\x20=\x20'+_0xa2915e+'.'+_0x2ecbda)[_0xf0fd('0x12')](_0x1e4743+_0xf0fd('0x13')+_0x2185bc[_0xf0fd('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x55ec51,_0x104144){promisesAdditionalPhones=[];return db['CmContact']['findAll']({'raw':!![],'attributes':['id',_0xf0fd('0x14')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xf0fd('0x15')](function(_0x278c44){if(_0x278c44!==null){var _0x3316e1=[];for(var _0xc74e22=0x0;_0xc74e22<_0x278c44[_0xf0fd('0x16')];_0xc74e22++){var _0x1be2fc=_0x278c44[_0xc74e22];_0x3316e1[_0xf0fd('0x17')](insertAdditionalPhones(_0x1be2fc));}}Promise['all'](_0x3316e1)[_0xf0fd('0x15')](function(){_0x55ec51({'val':0x1});});});});}function insertAdditionalPhones(_0x75b340){return new Promise(function(_0x4a571a,_0x5b8751){var _0x408e1e=_0x75b340[_0xf0fd('0x14')];var _0x45e874=_0x408e1e[_0xf0fd('0x18')](';');var _0xe8b842=[];orderBy=0x0;for(var _0x5ab7b6=0x0;_0x5ab7b6<_0x45e874[_0xf0fd('0x16')];_0x5ab7b6++){_0xe8b842[_0xf0fd('0x17')](splitAdditionalPhone(_0x75b340['id'],_0x45e874[_0x5ab7b6]));}Promise[_0xf0fd('0x19')](_0xe8b842)['then'](function(){_0x4a571a({'val':_0x45e874[_0xf0fd('0x16')]});});});}function splitAdditionalPhone(_0x5029d4,_0x4caf8a){return new Promise(function(_0x473bf9,_0x2c07c7){var _0x199687=_0x4caf8a['split'](':');var _0x19247a=_0x199687[0x0];var _0xef6f40=_0x199687[0x1];if(!_[_0xf0fd('0x1a')](_0xef6f40)){var _0x36e16f=_0xef6f40['split']('|');var _0x13bd0d=[];for(var _0x45dde7=0x0;_0x45dde7<_0x36e16f['length'];_0x45dde7++){if(_0x36e16f[_0x45dde7]!==''){var _0x2b003f=_[_0xf0fd('0x1b')](promisesAdditionalPhones,{'contactId':_0x5029d4,'phone':_0x36e16f[_0x45dde7]});if(_0x2b003f['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5029d4,'contactTypeId':_0x19247a,'phone':_0x36e16f[_0x45dde7],'orderBy':orderBy});}}}_0x473bf9({'ok':0x1});}else _0x473bf9({'res':0x0});});}function createAdditionalPhone(_0x4c4b30,_0x40cd2c,_0x17f98e,_0xecbbf){var _0x5598e1='';var _0x2ab55d='';var _0x4a7b88=_0x17f98e[_0xf0fd('0x18')]('§');_0x5598e1=_0x4a7b88[0x0];if(_0x4a7b88[_0xf0fd('0x16')]==0x2)_0x2ab55d=_0x4a7b88[0x1];return new Promise(function(_0x347cf0,_0x15e584){return db[_0xf0fd('0x1c')][_0xf0fd('0x1d')]({'where':{'CmContactId':_0x4c4b30,'item':_0x5598e1}})[_0xf0fd('0x15')](function(_0x3e3118){if(_0x3e3118){return db[_0xf0fd('0x1c')][_0xf0fd('0x1e')]({'ItemTypeId':_0x40cd2c,'description':_0x2ab55d,'OrderBy':_0xecbbf},{'where':{'CmContactId':_0x4c4b30,'item':_0x5598e1}})['then'](function(_0x1a7522){_0x347cf0({'res':_0xf0fd('0x1f')});});}else{return db[_0xf0fd('0x1c')][_0xf0fd('0x20')]({'CmContactId':_0x4c4b30,'item':_0x5598e1,'description':_0x2ab55d,'ItemTypeId':_0x40cd2c,'OrderBy':_0xecbbf,'ItemClass':_0xf0fd('0x21')})[_0xf0fd('0x15')](function(_0x2297ad){_0x347cf0({'res':'inserted'});});}});});}function insertCmHopper(_0x13efe9,_0x592b9,_0x469b82,_0x3dc74a,_0x3ac3ad){var _0x1ff0da=[_0xf0fd('0x22'),'cm_contacts.scheduledat',_0xf0fd('0x23'),'cm_contacts.ListId',_0x592b9+'.'+_0x3dc74a,_0xf0fd('0x24'),_0xf0fd('0x25'),_0xf0fd('0x26'),'cm_contacts.UserId','\x22'+_0x3ac3ad+'\x22'];return squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0xf0fd('0x29'))[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2b'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x3dc74a,_0xf0fd('0x2e'),_0xf0fd('0x2f'),_0xf0fd('0x30'),_0xf0fd('0x31'),_0xf0fd('0x32')],squel['select']()[_0xf0fd('0x33')](_0x1ff0da)[_0xf0fd('0xf')](_0x592b9)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x592b9+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x469b82,null,_0x469b82+_0xf0fd('0x11')+_0x592b9+'.'+_0x3dc74a)[_0xf0fd('0x12')](_0x592b9+_0xf0fd('0x37'),_0x13efe9)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x592b9,_0x469b82,_0x3dc74a,_0xf0fd('0x29'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x592b9,_0x469b82,_0x3dc74a,_0xf0fd('0x29'),[_0xf0fd('0x39')])))[_0xf0fd('0x3a')]();}function insertCmHopperBlack(_0x4704ca,_0x1f5cd1,_0x4ddf19,_0x578f06){var _0x5dd6bf=['cm_contacts.phone',_0xf0fd('0x23'),'cm_contacts.ListId',_0x1f5cd1+'.'+_0x578f06,_0xf0fd('0x24'),_0xf0fd('0x25')];return squel[_0xf0fd('0x27')]()['into']('cm_hopper_black')[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x578f06,_0xf0fd('0x2e'),_0xf0fd('0x2f')],squel[_0xf0fd('0xc')]()['fields'](_0x5dd6bf)[_0xf0fd('0xf')](_0x1f5cd1)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x1f5cd1+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x4ddf19,null,_0x4ddf19+_0xf0fd('0x11')+_0x1f5cd1+'.'+_0x578f06)[_0xf0fd('0x12')](_0x1f5cd1+_0xf0fd('0x37'),_0x4704ca)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')](_0xf0fd('0x3b'),squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')]('phone')[_0xf0fd('0xf')](_0xf0fd('0x3c'))[_0xf0fd('0x12')]('ListId\x20=\x20?',_0x4704ca)[_0xf0fd('0x12')](_0x578f06+_0xf0fd('0x3d')+_0x1f5cd1+'.'+_0x578f06)))['toString']();}function insertTzCmHopper(_0x68b0c6,_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0x4ce1b3,_0x4d93ab){var _0x29cd11=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x4d93ab+_0xf0fd('0x3e'),'cm_contacts.id','cm_contacts.ListId',_0x20d3b8+'.'+_0x3d72fc,_0xf0fd('0x24'),'cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','\x22'+_0x4ce1b3+'\x22'];var _0x5dfdae=squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0xf0fd('0x29'))[_0xf0fd('0x2a')](['phone',_0xf0fd('0x2b'),_0xf0fd('0x2c'),_0xf0fd('0x2d'),_0x3d72fc,'createdAt','updatedAt',_0xf0fd('0x30'),_0xf0fd('0x31'),_0xf0fd('0x32')],squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x29cd11)['from'](_0x20d3b8)['join'](_0xf0fd('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x20d3b8+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x5e7cdf,null,_0x5e7cdf+'.id\x20=\x20'+_0x20d3b8+'.'+_0x3d72fc)[_0xf0fd('0x10')](_0x4d93ab,null,_0x4d93ab+'.id\x20=\x20'+_0x20d3b8+'.'+_0x3d72fc)[_0xf0fd('0x12')](_0x20d3b8+_0xf0fd('0x37'),_0x68b0c6)['where'](_0xf0fd('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0xf0fd('0x29'),['\x22always\x22','\x22onlyIfOpen\x22']))[_0xf0fd('0x12')](_0xf0fd('0x3b'),selectNotIn(_0x20d3b8,_0x5e7cdf,_0x3d72fc,_0xf0fd('0x29'),['\x22always\x22'])))[_0xf0fd('0x3a')]();return _0x5dfdae;}function insertTzCmHopperBlack(_0x4125a5,_0x5b4fc5,_0x52b751,_0x5676f8){var _0x12634a=[_0xf0fd('0x22'),_0xf0fd('0x23'),_0xf0fd('0x3f'),_0x5b4fc5+'.'+_0x5676f8,'cm_contacts.createdAt',_0xf0fd('0x25')];return squel['insert']()[_0xf0fd('0x28')](_0xf0fd('0x3c'))[_0xf0fd('0x2a')]([_0xf0fd('0xe'),_0xf0fd('0x2c'),'ListId',_0x5676f8,'createdAt','updatedAt'],squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x12634a)[_0xf0fd('0xf')](_0x5b4fc5)[_0xf0fd('0x10')](_0xf0fd('0x34'),null,_0xf0fd('0x35')+_0x5b4fc5+_0xf0fd('0x36'))[_0xf0fd('0x10')](_0x52b751,null,_0x52b751+_0xf0fd('0x11')+_0x5b4fc5+'.'+_0x5676f8)[_0xf0fd('0x12')](_0x5b4fc5+'.CmListId\x20=\x20?',_0x4125a5)[_0xf0fd('0x12')](_0xf0fd('0x38'),NOW)[_0xf0fd('0x12')](_0xf0fd('0x3b'),squel[_0xf0fd('0xc')]()[_0xf0fd('0xd')](_0xf0fd('0xe'))[_0xf0fd('0xf')](_0xf0fd('0x3c'))[_0xf0fd('0x12')](_0xf0fd('0x40'),_0x4125a5)[_0xf0fd('0x12')](_0x5676f8+_0xf0fd('0x3d')+_0x5b4fc5+'.'+_0x5676f8)))[_0xf0fd('0x3a')]();}function insertCmHopperAdditionalPhones(_0x3d3d72){var _0x54fc82=[_0xf0fd('0x41'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xf0fd('0x42')];return squel[_0xf0fd('0x27')]()['into'](_0xf0fd('0x43'))[_0xf0fd('0x2a')]([_0xf0fd('0x44'),_0xf0fd('0xe'),_0xf0fd('0x45'),'createdAt','updatedAt'],squel['select']()[_0xf0fd('0x33')](_0x54fc82)['from'](_0xf0fd('0x29'))['join'](_0xf0fd('0x34'),null,_0xf0fd('0x46'))['join'](_0xf0fd('0x47'),null,_0xf0fd('0x48'))[_0xf0fd('0x12')](_0xf0fd('0x49'),_0x3d3d72)['where'](_0xf0fd('0x38'),NOW))[_0xf0fd('0x3a')]();}function insertCmContact(_0x1ab388,_0xaa0d3d,_0x6d5c88,_0x1396d1){var _0x25822c=_[_0xf0fd('0x4a')](_[_0xf0fd('0x4b')](_0x1396d1),[_0xf0fd('0x2d'),'CompanyId','createdAt',_0xf0fd('0x2f')]);return squel['insert']()[_0xf0fd('0x28')](_0xf0fd('0x34'))[_0xf0fd('0x2a')](_0x25822c,squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x25822c)[_0xf0fd('0xf')](_0xaa0d3d)['where']('('+_0x6d5c88['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')](_0x6d5c88)['from'](_0xf0fd('0x34'))['where'](_0xf0fd('0x40'),_0x1ab388)[_0xf0fd('0x12')]('deletedAt\x20IS\x20NULL'))[_0xf0fd('0x12')](_0xf0fd('0x4c'),squel['select']()[_0xf0fd('0xd')](_0xf0fd('0x4d'),'min_id')[_0xf0fd('0xf')](_0xaa0d3d)['group'](_0x6d5c88[_0xf0fd('0x10')](','))))['toString']();}function handleStop(){logger[_0xf0fd('0x4e')](_0xf0fd('0x4f'));stopped=!![];}function handleUncaughtException(_0x1066c8){logger[_0xf0fd('0x50')](_0x1066c8[_0xf0fd('0x51')]);process[_0xf0fd('0x52')](0x1);}function handleError(_0x27da01,_0x398f9d){stats[_0xf0fd('0x53')][_0xf0fd('0x17')]({'name':_0x398f9d['code'],'message':_0x398f9d[_0xf0fd('0x51')],'row':_0x27da01});}function handleQuery(_0x166955){logger[_0xf0fd('0x4e')](_0x166955);return db['sequelize'][_0xf0fd('0x54')](_0x166955)['spread'](function(_0x2c39fb){results[_0xf0fd('0x17')](_0x2c39fb);})[_0xf0fd('0x55')](function(_0x92ed6a){logger['error'](_0x92ed6a[_0xf0fd('0x51')]);});}function updateTzCampaigns(_0xa3443a){return new Promise(function(_0x547fe1,_0x1ebe94){var _0x350a50=squel[_0xf0fd('0xc')]()['fields']([_0xf0fd('0x56'),_0xf0fd('0x57')])[_0xf0fd('0xf')](_0xf0fd('0x58'))[_0xf0fd('0x10')](_0xf0fd('0x59'),null,_0xf0fd('0x5a'))[_0xf0fd('0x12')]('campaigns_has_cm_lists.CmListId='+_0xa3443a);db[_0xf0fd('0x5b')][_0xf0fd('0x54')](_0x350a50['toString']())[_0xf0fd('0x5c')](function(_0xd54038){var _0x3714d8=[];for(var _0x5efeef=0x0;_0x5efeef<_0xd54038[_0xf0fd('0x16')];_0x5efeef++){_0x3714d8['push'](getTimezoneData(_0xd54038[_0x5efeef],tmp_campaigns));}BPromise[_0xf0fd('0x19')](_0x3714d8)['then'](function(){_0x547fe1({'val':0x1});});})[_0xf0fd('0x55')](function(_0xf5ff08){logger[_0xf0fd('0x50')](_0xf5ff08[_0xf0fd('0x51')]);_0x547fe1({'val':0x0});});});}function updateTzVoiceQueues(_0x3c07c9){return new Promise(function(_0x1ff74a,_0x3c6a74){var _0x4c86ce=squel[_0xf0fd('0xc')]()[_0xf0fd('0x33')]([_0xf0fd('0x5d'),_0xf0fd('0x5e')])[_0xf0fd('0xf')]('voice_queues')[_0xf0fd('0x10')]('voice_queues_has_cm_lists',null,_0xf0fd('0x5f'))[_0xf0fd('0x12')](_0xf0fd('0x60')+_0x3c07c9);db[_0xf0fd('0x5b')][_0xf0fd('0x54')](_0x4c86ce['toString']())[_0xf0fd('0x5c')](function(_0x51321c){var _0x4d7d84=[];for(var _0x4c6289=0x0;_0x4c6289<_0x51321c[_0xf0fd('0x16')];_0x4c6289++){_0x4d7d84['push'](getTimezoneData(_0x51321c[_0x4c6289],tmp_voice_queues));}BPromise[_0xf0fd('0x19')](_0x4d7d84)[_0xf0fd('0x15')](function(){_0x1ff74a({'val':0x1});});})[_0xf0fd('0x55')](function(_0x532342){logger['error'](_0x532342[_0xf0fd('0x51')]);_0x1ff74a({'val':0x0});});});}function getTimezoneData(_0x3847c3,_0x562e80){return new Promise(function(_0x1d724a,_0x343158){var _0x4bffa0=shared[_0xf0fd('0x61')];var _0x5e9fb8=_0x4bffa0[_0x3847c3[_0xf0fd('0x62')]];if(_[_0xf0fd('0x1a')](_0x5e9fb8)){_0x1d724a({'ret':0x1});}else{var _0x42e93f=_0x5e9fb8[_0xf0fd('0x63')];var _0x2597b3=squel[_0xf0fd('0x27')]()[_0xf0fd('0x28')](_0x562e80)[_0xf0fd('0x64')]('id',_0x3847c3['id'])[_0xf0fd('0x64')](_0xf0fd('0x65'),_0x42e93f)[_0xf0fd('0x64')](_0xf0fd('0x62'),_0x3847c3[_0xf0fd('0x62')])['toString']();return db['sequelize'][_0xf0fd('0x54')](_0x2597b3)['spread'](function(_0x13a45c){_0x1d724a({'ret':0x1});})[_0xf0fd('0x55')](function(_0x4c8886){logger['error'](_0x4c8886['message']);_0x343158({'ret':0x1});});}});}function handleTZQuery(_0x726259){logger[_0xf0fd('0x4e')](_0x726259);return db['sequelize']['query'](_0x726259)[_0xf0fd('0x5c')](function(_0x49fb89){})[_0xf0fd('0x55')](function(_0x4e095a){logger[_0xf0fd('0x50')](_0x4e095a[_0xf0fd('0x51')]);});}function main(_0x1d3f3b,_0x3beb58,_0x5a4ba2,_0x363208){logger[_0xf0fd('0x4e')]('main',_0x1d3f3b,JSON[_0xf0fd('0x66')](_0x3beb58));process[_0xf0fd('0x67')](_0xf0fd('0x68'));var _0x5a9e17=_0x3beb58[_0xf0fd('0x69')];var _0xcca049=_[_0xf0fd('0x6a')](_0x5a9e17);var _0x1d2d78=_0x3beb58[_0xf0fd('0x6b')];var _0x5cbfdb=path[_0xf0fd('0x10')](config['root'],_0xf0fd('0x6c'),_0x1d2d78+_0xf0fd('0x6d'));hasTZ=_[_0xf0fd('0x4b')](_0x5a9e17)[_0xf0fd('0x6e')](_0xf0fd('0x62'));var _0x3a691a=_[_0xf0fd('0x4b')](_0x5a9e17)['join']();logger[_0xf0fd('0x4e')](_0xf0fd('0x6f'),_0x3a691a);db[_0xf0fd('0x70')]['findAll']({'raw':!![],'attributes':['id',_0xf0fd('0x71')]})[_0xf0fd('0x15')](function(_0x92016f){for(var _0x5578b6=0x0;_0x5578b6<_0x92016f[_0xf0fd('0x16')];_0x5578b6++){if(_0x92016f[_0x5578b6][_0xf0fd('0x71')]in _0x5a9e17){contactItemTypes['push'](_0x92016f[_0x5578b6]);delete _0xcca049[_0x92016f[_0x5578b6][_0xf0fd('0x71')]];hasAdditionalPhones=!![];}for(var _0x50ee0d in _0x5a9e17){if(_0x92016f[_0x5578b6][_0xf0fd('0x71')]+_0xf0fd('0x72')===_0x50ee0d){phoneDescriptions[_0xf0fd('0x17')]({'itemTypeId':_0x92016f[_0x5578b6]['id'],'description':_0x50ee0d});delete _0xcca049[_0x50ee0d];}}}if(hasAdditionalPhones)_0xcca049[_0xf0fd('0x14')]='';var _0x1eb5ca=_[_0xf0fd('0x4b')](_0xcca049)['join']();logger[_0xf0fd('0x4e')]('header',_0x1eb5ca);fs['writeFileSync'](_0x5cbfdb,_0x1eb5ca+'\x0a');Papa['parse'](fs[_0xf0fd('0x73')](_0x1d3f3b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x47775e,_0x3c9bd8){try{for(var _0x2a9f45=0x0,_0x10f40b=[];_0x2a9f45<_0x47775e['data'][_0xf0fd('0x16')];_0x2a9f45++){stats[_0xf0fd('0x74')]+=0x1;if(_0x47775e[_0xf0fd('0x53')][_0x2a9f45]){handleError(_0x47775e[_0xf0fd('0x75')][_0x2a9f45],_0x47775e[_0xf0fd('0x53')][_0x2a9f45]);}else{var _0x5ef740=[];var _0x5c1b83=[];var _0x27049f={};for(var _0x5e6513 in _0x5a9e17){let _0x5b84ae=contactItemTypes['find'](_0x24848b=>_0x24848b['name']===_0x5e6513);let _0x451240=contactItemTypes[_0xf0fd('0x76')](_0x330492=>_0x330492['name']+_0xf0fd('0x72')===_0x5e6513);if(_['isNil'](_0x5b84ae)&&_[_0xf0fd('0x1a')](_0x451240)){if(_0x5a9e17[_0xf0fd('0x77')](_0x5e6513)){if(_0x47775e['data'][_0x2a9f45][_0x5a9e17[_0x5e6513]]){var _0x235937=_[_0xf0fd('0x78')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]][_0xf0fd('0x79')](/"/g,'\x27'));switch(_0x5e6513){case _0xf0fd('0x2b'):var _0x4d6288=moment(_0x235937,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x4d6288[_0xf0fd('0x7a')]()){_0x10f40b['push']('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x29d2e4=parseInt(_0x235937);_0x235937=_[_0xf0fd('0x7b')](_0x29d2e4)||_0x29d2e4<0x0||_0x29d2e4>0x4?_0x363208?0x3:0x2:_0x29d2e4;_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');break;case'UserId':var _0x443b69=parseInt(_0x235937);if(_['isNumber'](_0x443b69)&&_['includes'](_0x5a4ba2,_0x443b69)){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x443b69+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x7c'));}break;case _0xf0fd('0x7d'):if(isEmail(_0x235937)){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x7e'));}break;case _0xf0fd('0x7f'):var _0x3a9a8c=moment(_0x235937,_0xf0fd('0x80'),!![]);if(_0x3a9a8c[_0xf0fd('0x7a')]()){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}else{_0x5ef740[_0xf0fd('0x17')](_0xf0fd('0x81'));}break;case'dialTimezone':var _0x37101d=shared['timezones'];var _0x5367ad=_0x37101d[_0x235937];if(!_[_0xf0fd('0x1a')](_0x5367ad)){var _0x1c1700=_0x5367ad[_0xf0fd('0x63')];_0x10f40b['push']('\x22'+_0x235937+'\x22');_0x10f40b['push']('\x22'+_0x1c1700+'\x22');}break;default:_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x235937+'\x22');}}else{switch(_0x5e6513){case _0xf0fd('0x82'):case _0xf0fd('0xe'):_0x5ef740[_0xf0fd('0x17')](_0x5e6513+'\x20not\x20specified');break;default:_0x10f40b['push']('\x22\x22');}}}}else{var _0x16fd6d='';if(!_['isNil'](_0x5b84ae)){if(!_0x27049f['hasOwnProperty'](_0x5b84ae['id'])){if(!_[_0xf0fd('0x1a')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]])){var _0x235937=_[_0xf0fd('0x78')](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x5e6513]][_0xf0fd('0x79')](/"/g,'\x27'));var _0x24a9be=phoneDescriptions[_0xf0fd('0x76')](_0x423d49=>_0x423d49[_0xf0fd('0x83')]===_0x5b84ae['id']);if(!_[_0xf0fd('0x1a')](_0x24a9be)){var _0x5b0e9e=_['trim'](_0x47775e[_0xf0fd('0x75')][_0x2a9f45][_0x5a9e17[_0x24a9be[_0xf0fd('0x84')]]][_0xf0fd('0x79')](/"/g,'\x27'));if(!_[_0xf0fd('0x1a')](_0x5b0e9e))_0x235937=_0x235937+'§'+_0x5b0e9e;}if(_0x16fd6d=='')_0x16fd6d=_0x235937;else _0x16fd6d+='|'+_0x235937;}_0x5c1b83[_0xf0fd('0x17')](_0x5b84ae['id']+':'+_0x16fd6d);_0x27049f[_0x5b84ae['id']]=0x1;}}}}if(hasAdditionalPhones){_0x10f40b[_0xf0fd('0x17')]('\x22'+_0x5c1b83[_0xf0fd('0x10')](';')+'\x22');}if(_0x5ef740['length']){handleError(_0x47775e[_0xf0fd('0x75')][_0x2a9f45],{'code':'SystemRow','message':_0x5ef740[_0xf0fd('0x10')]()});}else{fs[_0xf0fd('0x85')](_0x5cbfdb,_0x10f40b[_0xf0fd('0x10')]()+'\x0a');}_0x10f40b=[];}if(!(stats[_0xf0fd('0x74')]%0xc8)){socket['emit'](_0xf0fd('0x86')+_0x1d2d78,stats);stats[_0xf0fd('0x53')]=[];}}if(stopped){logger[_0xf0fd('0x4e')](_0xf0fd('0x87'));_0x3c9bd8[_0xf0fd('0x88')]();}}catch(_0x4d288f){handleError(_0x47775e['data'][_0x2a9f45],{'code':_0xf0fd('0x89'),'message':_0x4d288f[_0xf0fd('0x51')]});logger['error']('step',_0x4d288f[_0xf0fd('0x51')]);}},'complete':function(){try{var _0x1cbf4e=[];var _0x125fe9=[];var _0x4d325b=_0xf0fd('0x34');if(_0x3beb58['duplicates']&&_0x3beb58[_0xf0fd('0x8a')][_0xf0fd('0x16')]){_0x4d325b='cm_contacts_'+_0x1d2d78;_0x1cbf4e[_0xf0fd('0x17')](_0xf0fd('0x8b')+_0x4d325b+_0xf0fd('0x8c'));}tmp_campaigns=_0xf0fd('0x8d')+_0x1d2d78;tmp_voice_queues=_0xf0fd('0x8e')+_0x1d2d78;_0x125fe9[_0xf0fd('0x17')](_0xf0fd('0x8b')+tmp_campaigns+_0xf0fd('0x8f'));_0x125fe9[_0xf0fd('0x17')](_0xf0fd('0x8b')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x125fe9,handleTZQuery)['then'](function(_0x55a25c){updateTzCampaigns(_0x3beb58[_0xf0fd('0x2d')])['then'](function(_0x30a52e){updateTzVoiceQueues(_0x3beb58[_0xf0fd('0x2d')])[_0xf0fd('0x15')](function(_0x43f14c){if(hasTZ)_0x1eb5ca=_0x1eb5ca[_0xf0fd('0x79')](_0xf0fd('0x62'),_0xf0fd('0x90'));var _0x2ddb29=util[_0xf0fd('0xa')](_0xf0fd('0x91'),_0x5cbfdb,_0x4d325b,_0x1eb5ca,_0x3beb58[_0xf0fd('0x2d')],_0x3beb58[_0xf0fd('0x92')]||null,NOW,NOW);if(_[_0xf0fd('0x1a')](_0x5a9e17[_0xf0fd('0x2b')])){_0x2ddb29+=',\x20scheduledAt\x20=\x20NOW()';}_0x1cbf4e['push'](_0x2ddb29);if(_0x3beb58[_0xf0fd('0x8a')]&&_0x3beb58[_0xf0fd('0x8a')][_0xf0fd('0x16')]){_0x1cbf4e['push'](insertCmContact(_0x3beb58[_0xf0fd('0x2d')],_0x4d325b,_0x3beb58['duplicates'],_0x5a9e17));_0x1cbf4e[_0xf0fd('0x17')](_0xf0fd('0x93')+_0x4d325b+';');}BPromise[_0xf0fd('0x94')](_0x1cbf4e,handleQuery)[_0xf0fd('0x15')](function(_0x23b5fe){BPromise[_0xf0fd('0x19')]([handleAdditionalPhones()])[_0xf0fd('0x15')](function(){_0x1cbf4e=[];for(var _0x18c215=0x0;_0x18c215\x20\x20','existsSync','file\x20doesn\x27t\x20exists'];(function(_0x4dd479,_0x26d87a){var _0x1b6807=function(_0x2bec19){while(--_0x2bec19){_0x4dd479['push'](_0x4dd479['shift']());}};_0x1b6807(++_0x26d87a);}(_0x8d0a,0x172));var _0xa8d0=function(_0x12c3a9,_0x1b9a16){_0x12c3a9=_0x12c3a9-0x0;var _0x91d06=_0x8d0a[_0x12c3a9];return _0x91d06;};'use strict';var fs=require('fs');var path=require(_0xa8d0('0x0'));var _=require(_0xa8d0('0x1'));var Papa=require(_0xa8d0('0x2'));var util=require('util');var BPromise=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var squel=require('squel');var Redis=require(_0xa8d0('0x5'));var db=require(_0xa8d0('0x6'))['db'];var config=require(_0xa8d0('0x7'));var shared=require('../../../config/environment/shared');var logger=require(_0xa8d0('0x8'))(_0xa8d0('0x9'));config[_0xa8d0('0xa')]=_[_0xa8d0('0xb')](config[_0xa8d0('0xa')],{'host':_0xa8d0('0xc'),'port':0x18eb});var socket=require(_0xa8d0('0xd'))(new Redis(config[_0xa8d0('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xa8d0('0xe')](_0xa8d0('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa8d0('0xe')](_0xa8d0('0xf'));function isEmail(_0x3c1221){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))*$/[_0xa8d0('0x10')](_0x3c1221);}function selectNotIn(_0x3a1138,_0xe516eb,_0x2c34df,_0x1e15f8,_0x380cc5){return squel[_0xa8d0('0x11')]()['field']('phone')[_0xa8d0('0x12')](_0x1e15f8)[_0xa8d0('0x13')](_0xe516eb,null,_0xe516eb+'.id\x20=\x20'+_0x1e15f8+'.'+_0x2c34df)['where'](_0x1e15f8+'.'+_0x2c34df+_0xa8d0('0x14')+_0x3a1138+'.'+_0x2c34df)[_0xa8d0('0x15')](_0xe516eb+_0xa8d0('0x16')+_0x380cc5[_0xa8d0('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2ebddf,_0x18f935){promisesAdditionalPhones=[];return db[_0xa8d0('0x17')][_0xa8d0('0x18')]({'raw':!![],'attributes':['id',_0xa8d0('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa8d0('0x1a')](function(_0xfa19ee){if(_0xfa19ee!==null){var _0x575f69=[];for(var _0x728809=0x0;_0x728809<_0xfa19ee[_0xa8d0('0x1b')];_0x728809++){var _0x4dd4b0=_0xfa19ee[_0x728809];_0x575f69[_0xa8d0('0x1c')](insertAdditionalPhones(_0x4dd4b0));}}Promise[_0xa8d0('0x1d')](_0x575f69)[_0xa8d0('0x1a')](function(){_0x2ebddf({'val':0x1});});});});}function insertAdditionalPhones(_0x434ad5){return new Promise(function(_0x34ce5d,_0x48e8c5){var _0x35554e=_0x434ad5[_0xa8d0('0x19')];var _0x213de2=_0x35554e[_0xa8d0('0x1e')](';');var _0x1b5dfb=[];orderBy=0x0;for(var _0x16e479=0x0;_0x16e479<_0x213de2[_0xa8d0('0x1b')];_0x16e479++){_0x1b5dfb['push'](splitAdditionalPhone(_0x434ad5['id'],_0x213de2[_0x16e479]));}Promise[_0xa8d0('0x1d')](_0x1b5dfb)[_0xa8d0('0x1a')](function(){_0x34ce5d({'val':_0x213de2[_0xa8d0('0x1b')]});});});}function splitAdditionalPhone(_0x3ceb45,_0x4b003f){return new Promise(function(_0x31cf4f,_0x31216e){var _0x3212a3=_0x4b003f[_0xa8d0('0x1e')](':');var _0x4d6005=_0x3212a3[0x0];var _0x150080=_0x3212a3[0x1];if(!_[_0xa8d0('0x1f')](_0x150080)){var _0x20ae2c=_0x150080[_0xa8d0('0x1e')]('|');var _0x55e6e0=[];for(var _0x35b4a6=0x0;_0x35b4a6<_0x20ae2c[_0xa8d0('0x1b')];_0x35b4a6++){if(_0x20ae2c[_0x35b4a6]!==''){var _0x434252=_['filter'](promisesAdditionalPhones,{'contactId':_0x3ceb45,'phone':_0x20ae2c[_0x35b4a6]});if(_0x434252[_0xa8d0('0x1b')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x3ceb45,'contactTypeId':_0x4d6005,'phone':_0x20ae2c[_0x35b4a6],'orderBy':orderBy});}}}_0x31cf4f({'ok':0x1});}else _0x31cf4f({'res':0x0});});}function createAdditionalPhone(_0x3efa4e,_0x291e8e,_0x548076,_0x5d7292){var _0x216045='';var _0x5d9a04='';var _0x312a29=_0x548076[_0xa8d0('0x1e')]('§');_0x216045=_0x312a29[0x0];if(_0x312a29[_0xa8d0('0x1b')]==0x2)_0x5d9a04=_0x312a29[0x1];return new Promise(function(_0x460fae,_0x3ceaa9){return db['CmContactHasItem'][_0xa8d0('0x20')]({'where':{'CmContactId':_0x3efa4e,'item':_0x216045}})[_0xa8d0('0x1a')](function(_0x13de71){if(_0x13de71){return db['CmContactHasItem']['update']({'ItemTypeId':_0x291e8e,'description':_0x5d9a04,'OrderBy':_0x5d7292},{'where':{'CmContactId':_0x3efa4e,'item':_0x216045}})['then'](function(_0x472982){_0x460fae({'res':_0xa8d0('0x21')});});}else{return db[_0xa8d0('0x22')][_0xa8d0('0x23')]({'CmContactId':_0x3efa4e,'item':_0x216045,'description':_0x5d9a04,'ItemTypeId':_0x291e8e,'OrderBy':_0x5d7292,'ItemClass':_0xa8d0('0x24')})[_0xa8d0('0x1a')](function(_0x3f6fb9){_0x460fae({'res':'inserted'});});}});});}function insertCmHopper(_0x1fa36f,_0x58ff81,_0x454a82,_0x538e51,_0x4ea42b){var _0x54bc61=['cm_contacts.phone',_0xa8d0('0x25'),_0xa8d0('0x26'),'cm_contacts.ListId',_0x58ff81+'.'+_0x538e51,'cm_contacts.createdAt',_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'\x22'+_0x4ea42b+'\x22'];return squel[_0xa8d0('0x2a')]()[_0xa8d0('0x2b')]('cm_hopper')['fromQuery']([_0xa8d0('0x2c'),_0xa8d0('0x2d'),_0xa8d0('0x2e'),_0xa8d0('0x2f'),_0x538e51,_0xa8d0('0x30'),_0xa8d0('0x31'),'priority',_0xa8d0('0x32'),_0xa8d0('0x33')],squel[_0xa8d0('0x11')]()['fields'](_0x54bc61)[_0xa8d0('0x12')](_0x58ff81)[_0xa8d0('0x13')](_0xa8d0('0x34'),null,_0xa8d0('0x35')+_0x58ff81+_0xa8d0('0x36'))[_0xa8d0('0x13')](_0x454a82,null,_0x454a82+_0xa8d0('0x37')+_0x58ff81+'.'+_0x538e51)[_0xa8d0('0x15')](_0x58ff81+_0xa8d0('0x38'),_0x1fa36f)[_0xa8d0('0x15')](_0xa8d0('0x39'),NOW)['where'](_0xa8d0('0x3a'),selectNotIn(_0x58ff81,_0x454a82,_0x538e51,'cm_hopper',[_0xa8d0('0x3b'),_0xa8d0('0x3c')]))[_0xa8d0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x58ff81,_0x454a82,_0x538e51,_0xa8d0('0x3d'),[_0xa8d0('0x3b')])))[_0xa8d0('0x3e')]();}function insertCmHopperBlack(_0x4ab119,_0x26524f,_0x3c8d89,_0xcaf615){var _0x3c3080=[_0xa8d0('0x3f'),_0xa8d0('0x26'),_0xa8d0('0x40'),_0x26524f+'.'+_0xcaf615,_0xa8d0('0x41'),_0xa8d0('0x27')];return squel['insert']()[_0xa8d0('0x2b')](_0xa8d0('0x42'))[_0xa8d0('0x43')]([_0xa8d0('0x2c'),_0xa8d0('0x2e'),_0xa8d0('0x2f'),_0xcaf615,_0xa8d0('0x30'),_0xa8d0('0x31')],squel[_0xa8d0('0x11')]()['fields'](_0x3c3080)[_0xa8d0('0x12')](_0x26524f)['join'](_0xa8d0('0x34'),null,_0xa8d0('0x35')+_0x26524f+'.CmListId')[_0xa8d0('0x13')](_0x3c8d89,null,_0x3c8d89+'.id\x20=\x20'+_0x26524f+'.'+_0xcaf615)[_0xa8d0('0x15')](_0x26524f+_0xa8d0('0x38'),_0x4ab119)[_0xa8d0('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa8d0('0x3a'),squel[_0xa8d0('0x11')]()[_0xa8d0('0x44')](_0xa8d0('0x2c'))[_0xa8d0('0x12')](_0xa8d0('0x42'))[_0xa8d0('0x15')](_0xa8d0('0x45'),_0x4ab119)['where'](_0xcaf615+_0xa8d0('0x14')+_0x26524f+'.'+_0xcaf615)))['toString']();}function insertTzCmHopper(_0x21724b,_0x5b34a1,_0x1b48a9,_0x44df67,_0x3b48f2,_0x58d820){var _0x384cee=[_0xa8d0('0x3f'),_0xa8d0('0x46')+_0x58d820+_0xa8d0('0x47'),_0xa8d0('0x26'),_0xa8d0('0x40'),_0x5b34a1+'.'+_0x44df67,_0xa8d0('0x41'),_0xa8d0('0x27'),_0xa8d0('0x28'),_0xa8d0('0x29'),'\x22'+_0x3b48f2+'\x22'];var _0x39f402=squel[_0xa8d0('0x2a')]()[_0xa8d0('0x2b')](_0xa8d0('0x3d'))[_0xa8d0('0x43')](['phone','scheduledat',_0xa8d0('0x2e'),_0xa8d0('0x2f'),_0x44df67,_0xa8d0('0x30'),_0xa8d0('0x31'),_0xa8d0('0x48'),_0xa8d0('0x32'),_0xa8d0('0x33')],squel[_0xa8d0('0x11')]()[_0xa8d0('0x49')](_0x384cee)[_0xa8d0('0x12')](_0x5b34a1)[_0xa8d0('0x13')](_0xa8d0('0x34'),null,_0xa8d0('0x35')+_0x5b34a1+'.CmListId')[_0xa8d0('0x13')](_0x1b48a9,null,_0x1b48a9+_0xa8d0('0x37')+_0x5b34a1+'.'+_0x44df67)[_0xa8d0('0x13')](_0x58d820,null,_0x58d820+'.id\x20=\x20'+_0x5b34a1+'.'+_0x44df67)[_0xa8d0('0x15')](_0x5b34a1+_0xa8d0('0x38'),_0x21724b)[_0xa8d0('0x15')](_0xa8d0('0x39'),NOW)[_0xa8d0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5b34a1,_0x1b48a9,_0x44df67,'cm_hopper',[_0xa8d0('0x3b'),_0xa8d0('0x3c')]))[_0xa8d0('0x15')](_0xa8d0('0x3a'),selectNotIn(_0x5b34a1,_0x1b48a9,_0x44df67,_0xa8d0('0x3d'),[_0xa8d0('0x3b')])))[_0xa8d0('0x3e')]();return _0x39f402;}function insertTzCmHopperBlack(_0x15e8d9,_0x39e84b,_0x495758,_0x30dc28){var _0x184fbd=[_0xa8d0('0x3f'),_0xa8d0('0x26'),_0xa8d0('0x40'),_0x39e84b+'.'+_0x30dc28,'cm_contacts.createdAt',_0xa8d0('0x27')];return squel['insert']()[_0xa8d0('0x2b')]('cm_hopper_black')[_0xa8d0('0x43')](['phone','ContactId',_0xa8d0('0x2f'),_0x30dc28,_0xa8d0('0x30'),_0xa8d0('0x31')],squel['select']()[_0xa8d0('0x49')](_0x184fbd)['from'](_0x39e84b)['join'](_0xa8d0('0x34'),null,_0xa8d0('0x35')+_0x39e84b+_0xa8d0('0x36'))['join'](_0x495758,null,_0x495758+'.id\x20=\x20'+_0x39e84b+'.'+_0x30dc28)[_0xa8d0('0x15')](_0x39e84b+_0xa8d0('0x38'),_0x15e8d9)[_0xa8d0('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xa8d0('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xa8d0('0x11')]()[_0xa8d0('0x44')](_0xa8d0('0x2c'))['from'](_0xa8d0('0x42'))[_0xa8d0('0x15')](_0xa8d0('0x45'),_0x15e8d9)['where'](_0x30dc28+'\x20=\x20'+_0x39e84b+'.'+_0x30dc28)))[_0xa8d0('0x3e')]();}function insertCmHopperAdditionalPhones(_0x19d7be){var _0x5173dd=['cm_hopper.id',_0xa8d0('0x4a'),_0xa8d0('0x4b'),_0xa8d0('0x4c'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0xa8d0('0x2b')]('cm_hopper_additional_phones')[_0xa8d0('0x43')]([_0xa8d0('0x4d'),'phone','OrderBy','createdAt',_0xa8d0('0x31')],squel['select']()[_0xa8d0('0x49')](_0x5173dd)[_0xa8d0('0x12')](_0xa8d0('0x3d'))['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xa8d0('0x13')](_0xa8d0('0x4e'),null,_0xa8d0('0x4f'))[_0xa8d0('0x15')](_0xa8d0('0x50'),_0x19d7be)['where'](_0xa8d0('0x39'),NOW))['toString']();}function insertCmContact(_0x217995,_0x4812cc,_0x130ba2,_0x4fdc81){var _0x16b690=_[_0xa8d0('0x51')](_[_0xa8d0('0x52')](_0x4fdc81),[_0xa8d0('0x2f'),'CompanyId',_0xa8d0('0x30'),_0xa8d0('0x31')]);return squel['insert']()[_0xa8d0('0x2b')](_0xa8d0('0x34'))['fromQuery'](_0x16b690,squel[_0xa8d0('0x11')]()[_0xa8d0('0x49')](_0x16b690)[_0xa8d0('0x12')](_0x4812cc)[_0xa8d0('0x15')]('('+_0x130ba2['join'](',')+')\x20NOT\x20IN\x20?',squel[_0xa8d0('0x11')]()[_0xa8d0('0x49')](_0x130ba2)[_0xa8d0('0x12')](_0xa8d0('0x34'))[_0xa8d0('0x15')]('ListId\x20=\x20?',_0x217995)[_0xa8d0('0x15')](_0xa8d0('0x53')))[_0xa8d0('0x15')](_0xa8d0('0x54'),squel[_0xa8d0('0x11')]()[_0xa8d0('0x44')]('MIN(id)',_0xa8d0('0x55'))[_0xa8d0('0x12')](_0x4812cc)[_0xa8d0('0x56')](_0x130ba2['join'](','))))[_0xa8d0('0x3e')]();}function handleStop(){logger[_0xa8d0('0x57')](_0xa8d0('0x58'));stopped=!![];}function handleUncaughtException(_0x58da3b){logger['error'](_0x58da3b[_0xa8d0('0x59')]);process[_0xa8d0('0x5a')](0x1);}function handleError(_0x5dc214,_0xef6c6d){stats['errors']['push']({'name':_0xef6c6d['code'],'message':_0xef6c6d[_0xa8d0('0x59')],'row':_0x5dc214});}function handleQuery(_0x3e2e94){logger[_0xa8d0('0x57')](_0x3e2e94);return db['sequelize'][_0xa8d0('0x5b')](_0x3e2e94)[_0xa8d0('0x5c')](function(_0x176f02){results[_0xa8d0('0x1c')](_0x176f02);})[_0xa8d0('0x5d')](function(_0x717ea5){logger['error'](_0x717ea5[_0xa8d0('0x59')]);});}function updateTzCampaigns(_0x404e95){return new Promise(function(_0x2ca430,_0x2d9518){var _0x134ee7=squel[_0xa8d0('0x11')]()[_0xa8d0('0x49')]([_0xa8d0('0x5e'),_0xa8d0('0x5f')])[_0xa8d0('0x12')]('campaigns')[_0xa8d0('0x13')]('campaigns_has_cm_lists',null,_0xa8d0('0x60'))['where'](_0xa8d0('0x61')+_0x404e95);db[_0xa8d0('0x62')][_0xa8d0('0x5b')](_0x134ee7[_0xa8d0('0x3e')]())[_0xa8d0('0x5c')](function(_0x17a710){var _0x1472f9=[];for(var _0x11bc8f=0x0;_0x11bc8f<_0x17a710[_0xa8d0('0x1b')];_0x11bc8f++){_0x1472f9[_0xa8d0('0x1c')](getTimezoneData(_0x17a710[_0x11bc8f],tmp_campaigns));}BPromise['all'](_0x1472f9)[_0xa8d0('0x1a')](function(){_0x2ca430({'val':0x1});});})[_0xa8d0('0x5d')](function(_0x221659){logger[_0xa8d0('0x63')](_0x221659['message']);_0x2ca430({'val':0x0});});});}function updateTzVoiceQueues(_0x28ad5d){return new Promise(function(_0x606740,_0x27b539){var _0x258800=squel[_0xa8d0('0x11')]()['fields']([_0xa8d0('0x64'),_0xa8d0('0x65')])[_0xa8d0('0x12')](_0xa8d0('0x66'))[_0xa8d0('0x13')](_0xa8d0('0x67'),null,_0xa8d0('0x68'))['where'](_0xa8d0('0x69')+_0x28ad5d);db['sequelize']['query'](_0x258800[_0xa8d0('0x3e')]())[_0xa8d0('0x5c')](function(_0x307b5c){var _0x5937ee=[];for(var _0xe27834=0x0;_0xe27834<_0x307b5c[_0xa8d0('0x1b')];_0xe27834++){_0x5937ee['push'](getTimezoneData(_0x307b5c[_0xe27834],tmp_voice_queues));}BPromise[_0xa8d0('0x1d')](_0x5937ee)[_0xa8d0('0x1a')](function(){_0x606740({'val':0x1});});})['catch'](function(_0x26ab4c){logger[_0xa8d0('0x63')](_0x26ab4c[_0xa8d0('0x59')]);_0x606740({'val':0x0});});});}function getTimezoneData(_0x12ff4a,_0x5b0b4e){return new Promise(function(_0x3c70fb,_0x297fa4){var _0x1346f3=shared[_0xa8d0('0x6a')];var _0x405af2=_0x1346f3[_0x12ff4a[_0xa8d0('0x6b')]];if(_['isNil'](_0x405af2)){_0x3c70fb({'ret':0x1});}else{var _0x34689e=_0x405af2[_0xa8d0('0x6c')];var _0x3a4d89=squel[_0xa8d0('0x2a')]()[_0xa8d0('0x2b')](_0x5b0b4e)['set']('id',_0x12ff4a['id'])[_0xa8d0('0x6d')]('offset',_0x34689e)[_0xa8d0('0x6d')](_0xa8d0('0x6b'),_0x12ff4a[_0xa8d0('0x6b')])[_0xa8d0('0x3e')]();return db['sequelize'][_0xa8d0('0x5b')](_0x3a4d89)[_0xa8d0('0x5c')](function(_0x55dba2){_0x3c70fb({'ret':0x1});})['catch'](function(_0x4d53f8){logger[_0xa8d0('0x63')](_0x4d53f8[_0xa8d0('0x59')]);_0x297fa4({'ret':0x1});});}});}function handleTZQuery(_0x18cddc){logger[_0xa8d0('0x57')](_0x18cddc);return db[_0xa8d0('0x62')][_0xa8d0('0x5b')](_0x18cddc)[_0xa8d0('0x5c')](function(_0x5d0313){})[_0xa8d0('0x5d')](function(_0x47f818){logger[_0xa8d0('0x63')](_0x47f818['message']);});}function main(_0x4fb62f,_0x24565a,_0x506edd,_0xf7f94b){logger[_0xa8d0('0x57')]('main',_0x4fb62f,JSON['stringify'](_0x24565a));process[_0xa8d0('0x6e')](_0xa8d0('0x6f'));var _0x116ca5=_0x24565a[_0xa8d0('0x70')];var _0x44fe03=_[_0xa8d0('0x71')](_0x116ca5);var _0x4529a3=_0x24565a[_0xa8d0('0x72')];var _0x30a66d=path[_0xa8d0('0x13')](config[_0xa8d0('0x73')],_0xa8d0('0x74'),_0x4529a3+_0xa8d0('0x75'));hasTZ=_[_0xa8d0('0x52')](_0x116ca5)['includes'](_0xa8d0('0x6b'));var _0x54a61b=_[_0xa8d0('0x52')](_0x116ca5)[_0xa8d0('0x13')]();logger[_0xa8d0('0x57')](_0xa8d0('0x76'),_0x54a61b);db[_0xa8d0('0x77')][_0xa8d0('0x18')]({'raw':!![],'attributes':['id',_0xa8d0('0x78')]})[_0xa8d0('0x1a')](function(_0x43faf1){for(var _0x3affc5=0x0;_0x3affc5<_0x43faf1[_0xa8d0('0x1b')];_0x3affc5++){if(_0x43faf1[_0x3affc5][_0xa8d0('0x78')]in _0x116ca5){contactItemTypes['push'](_0x43faf1[_0x3affc5]);delete _0x44fe03[_0x43faf1[_0x3affc5]['name']];hasAdditionalPhones=!![];}for(var _0x49d3b3 in _0x116ca5){if(_0x43faf1[_0x3affc5][_0xa8d0('0x78')]+'_description'===_0x49d3b3){phoneDescriptions[_0xa8d0('0x1c')]({'itemTypeId':_0x43faf1[_0x3affc5]['id'],'description':_0x49d3b3});delete _0x44fe03[_0x49d3b3];}}}if(hasAdditionalPhones)_0x44fe03[_0xa8d0('0x19')]='';var _0x5c0685=_[_0xa8d0('0x52')](_0x44fe03)['join']();logger[_0xa8d0('0x57')]('header',_0x5c0685);fs[_0xa8d0('0x79')](_0x30a66d,_0x5c0685+'\x0a');Papa[_0xa8d0('0x7a')](fs[_0xa8d0('0x7b')](_0x4fb62f),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2a810b,_0x20c674){try{for(var _0x16aae4=0x0,_0x1178d9=[];_0x16aae4<_0x2a810b[_0xa8d0('0x7c')][_0xa8d0('0x1b')];_0x16aae4++){stats[_0xa8d0('0x7d')]+=0x1;if(_0x2a810b[_0xa8d0('0x7e')][_0x16aae4]){handleError(_0x2a810b[_0xa8d0('0x7c')][_0x16aae4],_0x2a810b[_0xa8d0('0x7e')][_0x16aae4]);}else{var _0x4a3adf=[];var _0x525392=[];var _0x2cec05={};for(var _0x37bc4c in _0x116ca5){let _0x12945c=contactItemTypes['find'](_0x383b39=>_0x383b39['name']===_0x37bc4c);let _0x544f14=contactItemTypes[_0xa8d0('0x7f')](_0x2d35f4=>_0x2d35f4[_0xa8d0('0x78')]+_0xa8d0('0x80')===_0x37bc4c);if(_['isNil'](_0x12945c)&&_[_0xa8d0('0x1f')](_0x544f14)){if(_0x116ca5['hasOwnProperty'](_0x37bc4c)){if(_0x2a810b['data'][_0x16aae4][_0x116ca5[_0x37bc4c]]){var _0x17bfec=_[_0xa8d0('0x81')](_0x2a810b['data'][_0x16aae4][_0x116ca5[_0x37bc4c]][_0xa8d0('0x82')](/"/g,'\x27'));switch(_0x37bc4c){case _0xa8d0('0x2d'):var _0x3b124a=moment(_0x17bfec,_0xa8d0('0xf'),!![]);if(_0x3b124a['isValid']()){_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x17bfec+'\x22');}else{_0x4a3adf[_0xa8d0('0x1c')](_0xa8d0('0x83'));}break;case'priority':var _0x37f370=parseInt(_0x17bfec);_0x17bfec=_['isNaN'](_0x37f370)||_0x37f370<0x0||_0x37f370>0x4?_0xf7f94b?0x3:0x2:_0x37f370;_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x17bfec+'\x22');break;case _0xa8d0('0x32'):var _0x209837=parseInt(_0x17bfec);if(_[_0xa8d0('0x84')](_0x209837)&&_[_0xa8d0('0x85')](_0x506edd,_0x209837)){_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x209837+'\x22');}else{_0x4a3adf[_0xa8d0('0x1c')](_0xa8d0('0x86'));}break;case _0xa8d0('0x87'):if(isEmail(_0x17bfec)){_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x17bfec+'\x22');}else{_0x4a3adf[_0xa8d0('0x1c')](_0xa8d0('0x88'));}break;case _0xa8d0('0x89'):var _0xa196f3=moment(_0x17bfec,_0xa8d0('0x8a'),!![]);if(_0xa196f3[_0xa8d0('0x8b')]()){_0x1178d9['push']('\x22'+_0x17bfec+'\x22');}else{_0x4a3adf[_0xa8d0('0x1c')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;case'dialTimezone':var _0x1d9cba=shared['timezones'];var _0x19db7d=_0x1d9cba[_0x17bfec];if(!_[_0xa8d0('0x1f')](_0x19db7d)){var _0x2d6e4e=_0x19db7d['utcOffset'];_0x1178d9['push']('\x22'+_0x17bfec+'\x22');_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x2d6e4e+'\x22');}break;default:_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x17bfec+'\x22');}}else{switch(_0x37bc4c){case _0xa8d0('0x8c'):case _0xa8d0('0x2c'):_0x4a3adf[_0xa8d0('0x1c')](_0x37bc4c+_0xa8d0('0x8d'));break;default:_0x1178d9['push']('\x22\x22');}}}}else{var _0x390542='';if(!_[_0xa8d0('0x1f')](_0x12945c)){if(!_0x2cec05[_0xa8d0('0x8e')](_0x12945c['id'])){if(!_[_0xa8d0('0x1f')](_0x2a810b[_0xa8d0('0x7c')][_0x16aae4][_0x116ca5[_0x37bc4c]])){var _0x17bfec=_[_0xa8d0('0x81')](_0x2a810b[_0xa8d0('0x7c')][_0x16aae4][_0x116ca5[_0x37bc4c]][_0xa8d0('0x82')](/"/g,'\x27'));var _0x5416a1=phoneDescriptions[_0xa8d0('0x7f')](_0x46ef3e=>_0x46ef3e[_0xa8d0('0x8f')]===_0x12945c['id']);if(!_['isNil'](_0x5416a1)){var _0x4516ca=_[_0xa8d0('0x81')](_0x2a810b[_0xa8d0('0x7c')][_0x16aae4][_0x116ca5[_0x5416a1[_0xa8d0('0x90')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x4516ca))_0x17bfec=_0x17bfec+'§'+_0x4516ca;}if(_0x390542=='')_0x390542=_0x17bfec;else _0x390542+='|'+_0x17bfec;}_0x525392[_0xa8d0('0x1c')](_0x12945c['id']+':'+_0x390542);_0x2cec05[_0x12945c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1178d9[_0xa8d0('0x1c')]('\x22'+_0x525392[_0xa8d0('0x13')](';')+'\x22');}if(_0x4a3adf[_0xa8d0('0x1b')]){handleError(_0x2a810b[_0xa8d0('0x7c')][_0x16aae4],{'code':_0xa8d0('0x91'),'message':_0x4a3adf['join']()});}else{fs[_0xa8d0('0x92')](_0x30a66d,_0x1178d9[_0xa8d0('0x13')]()+'\x0a');}_0x1178d9=[];}if(!(stats[_0xa8d0('0x7d')]%0xc8)){socket[_0xa8d0('0x93')]('contact:import:'+_0x4529a3,stats);stats[_0xa8d0('0x7e')]=[];}}if(stopped){logger[_0xa8d0('0x57')]('Abort\x20parser');_0x20c674['abort']();}}catch(_0x6d06c6){handleError(_0x2a810b[_0xa8d0('0x7c')][_0x16aae4],{'code':_0xa8d0('0x94'),'message':_0x6d06c6[_0xa8d0('0x59')]});logger[_0xa8d0('0x63')](_0xa8d0('0x95'),_0x6d06c6[_0xa8d0('0x59')]);}},'complete':function(){try{var _0x2e132b=[];var _0x5cd9bc=[];var _0x301b09=_0xa8d0('0x34');if(_0x24565a[_0xa8d0('0x96')]&&_0x24565a['duplicates']['length']){_0x301b09=_0xa8d0('0x97')+_0x4529a3;_0x2e132b[_0xa8d0('0x1c')](_0xa8d0('0x98')+_0x301b09+_0xa8d0('0x99'));}tmp_campaigns=_0xa8d0('0x9a')+_0x4529a3;tmp_voice_queues='voice_queues_'+_0x4529a3;_0x5cd9bc[_0xa8d0('0x1c')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xa8d0('0x9b'));_0x5cd9bc[_0xa8d0('0x1c')](_0xa8d0('0x98')+tmp_voice_queues+_0xa8d0('0x9b'));BPromise[_0xa8d0('0x9c')](_0x5cd9bc,handleTZQuery)[_0xa8d0('0x1a')](function(_0x38e0ed){updateTzCampaigns(_0x24565a[_0xa8d0('0x2f')])[_0xa8d0('0x1a')](function(_0x32a22a){updateTzVoiceQueues(_0x24565a[_0xa8d0('0x2f')])[_0xa8d0('0x1a')](function(_0x4714eb){if(hasTZ)_0x5c0685=_0x5c0685[_0xa8d0('0x82')](_0xa8d0('0x6b'),'dialTimezone,utcOffset');var _0x15ce39=util[_0xa8d0('0xe')](_0xa8d0('0x9d'),_0x30a66d,_0x301b09,_0x5c0685,_0x24565a[_0xa8d0('0x2f')],_0x24565a[_0xa8d0('0x9e')]||null,NOW,NOW);if(_[_0xa8d0('0x1f')](_0x116ca5[_0xa8d0('0x2d')])){_0x15ce39+=_0xa8d0('0x9f');}_0x2e132b[_0xa8d0('0x1c')](_0x15ce39);if(_0x24565a['duplicates']&&_0x24565a[_0xa8d0('0x96')][_0xa8d0('0x1b')]){_0x2e132b[_0xa8d0('0x1c')](insertCmContact(_0x24565a[_0xa8d0('0x2f')],_0x301b09,_0x24565a['duplicates'],_0x116ca5));_0x2e132b[_0xa8d0('0x1c')]('DROP\x20TABLE\x20'+_0x301b09+';');}BPromise['each'](_0x2e132b,handleQuery)[_0xa8d0('0x1a')](function(_0x18795b){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x2e132b=[];for(var _0x33c8ab=0x0;_0x33c8ab\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss'];(function(_0x4e7f3f,_0x5c57da){var _0x441fd2=function(_0x177c74){while(--_0x177c74){_0x4e7f3f['push'](_0x4e7f3f['shift']());}};_0x441fd2(++_0x5c57da);}(_0x6a47,0x84));var _0x76a4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6a47[_0x413feb];return _0x40ee88;};'use strict';var fs=require('fs');var path=require(_0x76a4('0x0'));var _=require(_0x76a4('0x1'));var Papa=require(_0x76a4('0x2'));var util=require(_0x76a4('0x3'));var BPromise=require(_0x76a4('0x4'));var moment=require(_0x76a4('0x5'));var squel=require(_0x76a4('0x6'));var Redis=require('ioredis');var db=require(_0x76a4('0x7'))['db'];var config=require(_0x76a4('0x8'));var logger=require(_0x76a4('0x9'))(_0x76a4('0xa'));config[_0x76a4('0xb')]=_[_0x76a4('0xc')](config['redis'],{'host':_0x76a4('0xd'),'port':0x18eb});var socket=require(_0x76a4('0xe'))(new Redis(config[_0x76a4('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x76a4('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x76a4('0x10')+moment()[_0x76a4('0xf')](_0x76a4('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xe3900b){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))*$/[_0x76a4('0x12')](_0xe3900b);}function selectNotIn(_0x4e4e63,_0x9290cb,_0x18d994,_0x2e5966,_0x194c94){return squel[_0x76a4('0x13')]()[_0x76a4('0x14')](_0x76a4('0x15'))[_0x76a4('0x16')](_0x2e5966)[_0x76a4('0x17')](_0x9290cb,null,_0x9290cb+'.id\x20=\x20'+_0x2e5966+'.'+_0x18d994)[_0x76a4('0x18')](_0x2e5966+'.'+_0x18d994+_0x76a4('0x19')+_0x4e4e63+'.'+_0x18d994)[_0x76a4('0x18')](_0x9290cb+_0x76a4('0x1a')+_0x194c94['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x169211,_0x362211){promisesAdditionalPhones=[];promisesContact=[];return db[_0x76a4('0x1b')][_0x76a4('0x1c')](_0x76a4('0x1d')+tempTableName)[_0x76a4('0x1e')](function(_0x25e50c){if(_0x25e50c!==null){var _0x11b558=[];for(var _0xec4933=0x0;_0xec4933<_0x25e50c[_0x76a4('0x1f')];_0xec4933++){var _0x28bf86=_0x25e50c[_0xec4933];if(!_[_0x76a4('0x20')](_0x28bf86[_0x76a4('0x15')])){if(!_[_0x76a4('0x20')](_0x28bf86[_0x76a4('0x21')]))_0x11b558['push'](insertAdditionalPhones(_0x28bf86));promisesContact[_0x76a4('0x22')]({'contact':_0x28bf86});}}}Promise[_0x76a4('0x23')](_0x11b558)[_0x76a4('0x24')](function(){_0x169211({'val':0x1});});})[_0x76a4('0x25')](function(_0x3b7293){logger['error'](_0x3b7293['message']);});});}function insertAdditionalPhones(_0x506266){return new Promise(function(_0x3ee68e,_0x11e806){var _0x1ac9dc=_0x506266[_0x76a4('0x21')];if(_[_0x76a4('0x20')](_0x1ac9dc))_0x11e806({'val':0x0});else{var _0x15eeb6=_0x1ac9dc['split'](';');var _0x246d81=[];orderBy=0x0;for(var _0x34dd31=0x0;_0x34dd31<_0x15eeb6[_0x76a4('0x1f')];_0x34dd31++){_0x246d81[_0x76a4('0x22')](splitAdditionalPhone(_0x506266['id'],_0x15eeb6[_0x34dd31]));}Promise['all'](_0x246d81)[_0x76a4('0x24')](function(){_0x3ee68e({'val':_0x15eeb6[_0x76a4('0x1f')]});});}});}function splitAdditionalPhone(_0x4b9bfa,_0x423c4c){return new Promise(function(_0x31eed1,_0x16783b){var _0x466b54=_0x423c4c[_0x76a4('0x26')](':');var _0x2ccc18=_0x466b54[0x0];var _0x1481ba=_0x466b54[0x1];if(_0x1481ba!==''){var _0x499928=_0x1481ba[_0x76a4('0x26')]('|');var _0x1ce821=[];for(var _0x145f2c=0x0;_0x145f2c<_0x499928[_0x76a4('0x1f')];_0x145f2c++){if(_0x499928[_0x145f2c]!==''){var _0x1aaf5b=_[_0x76a4('0x27')](promisesAdditionalPhones,{'contactId':_0x4b9bfa,'phone':_0x499928[_0x145f2c]});if(_0x1aaf5b[_0x76a4('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x76a4('0x22')]({'contactId':_0x4b9bfa,'contactTypeId':_0x2ccc18,'phone':_0x499928[_0x145f2c],'orderBy':orderBy});}}}_0x31eed1({'ok':0x1});}else _0x31eed1({'res':0x0});});}function createAdditionalPhone(_0x430e4a,_0x5bb5b1,_0x59c759,_0x16f343){var _0x1d36dc='';var _0x4c0230='';var _0x1e7cf0=_0x59c759[_0x76a4('0x26')]('§');_0x1d36dc=_0x1e7cf0[0x0];if(_0x1e7cf0[_0x76a4('0x1f')]==0x2)_0x4c0230=_0x1e7cf0[0x1];return new Promise(function(_0xedf944,_0x5425ff){return db[_0x76a4('0x28')][_0x76a4('0x29')]({'where':{'CmContactId':_0x430e4a,'item':_0x1d36dc}})[_0x76a4('0x24')](function(_0x1c7361){if(_0x1c7361){return db[_0x76a4('0x28')][_0x76a4('0x2a')]({'ItemTypeId':_0x5bb5b1,'description':_0x4c0230,'OrderBy':_0x16f343},{'where':{'CmContactId':_0x430e4a,'item':_0x1d36dc}})[_0x76a4('0x24')](function(_0x357a7d){_0xedf944({'res':'updated'});});}else{return db[_0x76a4('0x28')][_0x76a4('0x2b')]({'CmContactId':_0x430e4a,'item':_0x1d36dc,'ItemTypeId':_0x5bb5b1,'description':_0x4c0230,'OrderBy':_0x16f343,'ItemClass':_0x76a4('0x2c')})[_0x76a4('0x24')](function(_0x4c2971){_0xedf944({'res':_0x76a4('0x2d')});});}});});}function updateContact(_0x4dd10d){return new Promise(function(_0x26526b,_0x2257da){var _0x507042=_0x4dd10d['id'];delete _0x4dd10d['id'];return db['CmContact'][_0x76a4('0x2a')](_0x4dd10d,{'where':{'id':_0x507042}})[_0x76a4('0x24')](function(_0x3839d8){updatedRows+=0x1;return db['CmHopper'][_0x76a4('0x2a')]({'phone':_0x4dd10d[_0x76a4('0x15')]},{'where':{'ContactId':_0x507042}})['then'](function(_0x3989e1){_0x26526b({'ret':'OK'});});});});}function insertCmHopper(_0x28327f,_0xd92bf9,_0x43321a,_0x40db80,_0x78d815){var _0x513a77=[_0x76a4('0x2e'),'cm_contacts.scheduledat',_0x76a4('0x2f'),_0x76a4('0x30'),_0xd92bf9+'.'+_0x40db80,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x76a4('0x31'),_0x76a4('0x32'),'\x22'+_0x78d815+'\x22'];return squel['insert']()[_0x76a4('0x33')](_0x76a4('0x34'))[_0x76a4('0x35')]([_0x76a4('0x15'),'scheduledat','ContactId',_0x76a4('0x36'),_0x40db80,_0x76a4('0x37'),'updatedAt',_0x76a4('0x38'),_0x76a4('0x39'),'recallme'],squel[_0x76a4('0x13')]()[_0x76a4('0x3a')](_0x513a77)[_0x76a4('0x16')](_0xd92bf9)['join'](_0x76a4('0x3b'),null,_0x76a4('0x3c')+_0xd92bf9+_0x76a4('0x3d'))[_0x76a4('0x17')](_0x43321a,null,_0x43321a+_0x76a4('0x3e')+_0xd92bf9+'.'+_0x40db80)[_0x76a4('0x18')](_0xd92bf9+_0x76a4('0x3f'),_0x28327f)[_0x76a4('0x18')](_0x76a4('0x40'),NOW)[_0x76a4('0x18')](_0x76a4('0x41'),selectNotIn(_0xd92bf9,_0x43321a,_0x40db80,_0x76a4('0x34'),[_0x76a4('0x42'),'\x22onlyIfOpen\x22']))[_0x76a4('0x18')](_0x76a4('0x41'),selectNotIn(_0xd92bf9,_0x43321a,_0x40db80,_0x76a4('0x34'),[_0x76a4('0x42')])))[_0x76a4('0x43')]();}function insertCmHopperBlack(_0x5907d5,_0x350676,_0x57b15f,_0x43de80){var _0x18070d=[_0x76a4('0x2e'),'cm_contacts.id',_0x76a4('0x30'),_0x350676+'.'+_0x43de80,_0x76a4('0x44'),_0x76a4('0x45')];return squel[_0x76a4('0x46')]()['into'](_0x76a4('0x47'))[_0x76a4('0x35')](['phone',_0x76a4('0x48'),_0x76a4('0x36'),_0x43de80,_0x76a4('0x37'),_0x76a4('0x49')],squel[_0x76a4('0x13')]()['fields'](_0x18070d)[_0x76a4('0x16')](_0x350676)['join'](_0x76a4('0x3b'),null,_0x76a4('0x3c')+_0x350676+_0x76a4('0x3d'))['join'](_0x57b15f,null,_0x57b15f+_0x76a4('0x3e')+_0x350676+'.'+_0x43de80)[_0x76a4('0x18')](_0x350676+'.CmListId\x20=\x20?',_0x5907d5)[_0x76a4('0x18')](_0x76a4('0x40'),NOW)[_0x76a4('0x18')](_0x76a4('0x41'),squel[_0x76a4('0x13')]()['field'](_0x76a4('0x15'))[_0x76a4('0x16')](_0x76a4('0x47'))[_0x76a4('0x18')](_0x76a4('0x4a'),_0x5907d5)[_0x76a4('0x18')](_0x43de80+_0x76a4('0x4b'),_0x350676+'.'+_0x43de80)))[_0x76a4('0x43')]();}function insertCmHopperAdditionalPhones(_0x5c663a){var _0x4d3346=['cm_hopper.id',_0x76a4('0x4c'),_0x76a4('0x4d'),'cm_contact_has_items.createdAt',_0x76a4('0x4e')];return squel[_0x76a4('0x46')]()[_0x76a4('0x33')](_0x76a4('0x4f'))[_0x76a4('0x35')]([_0x76a4('0x50'),'phone','OrderBy','createdAt',_0x76a4('0x49')],squel['select']()[_0x76a4('0x3a')](_0x4d3346)[_0x76a4('0x16')](_0x76a4('0x34'))['join'](_0x76a4('0x3b'),null,_0x76a4('0x51'))[_0x76a4('0x17')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x76a4('0x18')](_0x76a4('0x52'),_0x5c663a)[_0x76a4('0x18')](_0x76a4('0x40'),NOW))[_0x76a4('0x43')]();}function insertCmContact(_0x4ff075,_0x41dd9c,_0x3d4c10,_0x210fd7){var _0x42f3e7=_['concat'](_[_0x76a4('0x53')](_0x210fd7),[_0x76a4('0x36'),'CompanyId',_0x76a4('0x37'),'updatedAt']);return squel[_0x76a4('0x46')]()[_0x76a4('0x33')](_0x76a4('0x3b'))[_0x76a4('0x35')](_0x42f3e7,squel[_0x76a4('0x13')]()['fields'](_0x42f3e7)[_0x76a4('0x16')](_0x41dd9c)[_0x76a4('0x18')]('('+_0x3d4c10[_0x76a4('0x17')](',')+_0x76a4('0x54'),squel[_0x76a4('0x13')]()[_0x76a4('0x3a')](_0x3d4c10)[_0x76a4('0x16')](_0x76a4('0x3b'))['where'](_0x76a4('0x4a'),_0x4ff075))['where'](_0x76a4('0x55'),squel['select']()[_0x76a4('0x14')](_0x76a4('0x56'),_0x76a4('0x57'))[_0x76a4('0x16')](_0x41dd9c)['group'](_0x3d4c10['join'](','))))[_0x76a4('0x43')]();}function handleStop(){logger[_0x76a4('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x1bbb46){logger[_0x76a4('0x59')](_0x1bbb46[_0x76a4('0x5a')]);process[_0x76a4('0x5b')](0x1);}function handleError(_0x16623c,_0x39ac31){stats[_0x76a4('0x5c')][_0x76a4('0x22')]({'name':_0x39ac31['code'],'message':_0x39ac31[_0x76a4('0x5a')],'row':_0x16623c});}function handleQuery(_0x1a5761){logger[_0x76a4('0x58')](_0x1a5761);return db['sequelize'][_0x76a4('0x1c')](_0x1a5761)['spread'](function(_0x230cd2){results[_0x76a4('0x22')](_0x230cd2);})[_0x76a4('0x25')](function(_0xe12040){logger['error'](_0xe12040[_0x76a4('0x5a')]);});}function main(_0x57ba53,_0x8a3322,_0x5ab84f,_0x1f2d8e){logger[_0x76a4('0x58')]('main',_0x57ba53,JSON[_0x76a4('0x5d')](_0x8a3322));process[_0x76a4('0x5e')](_0x76a4('0x5f'));var _0x2eb926=_0x8a3322[_0x76a4('0x60')];var _0x57cc1e=_['clone'](_0x2eb926);var _0x1f21d0=_0x8a3322[_0x76a4('0x61')];var _0x58e1a2=path[_0x76a4('0x17')](config[_0x76a4('0x62')],_0x76a4('0x63'),_0x1f21d0+_0x76a4('0x64'));logger[_0x76a4('0x58')](_0x76a4('0x65'),_0x8a3322);db['ContactItemType'][_0x76a4('0x66')]({'raw':!![],'attributes':['id',_0x76a4('0x67')]})[_0x76a4('0x24')](function(_0x3ad699){for(var _0x58cae5=0x0;_0x58cae5<_0x3ad699[_0x76a4('0x1f')];_0x58cae5++){if(_0x3ad699[_0x58cae5][_0x76a4('0x67')]in _0x2eb926){contactItemTypes[_0x76a4('0x22')](_0x3ad699[_0x58cae5]);delete _0x57cc1e[_0x3ad699[_0x58cae5][_0x76a4('0x67')]];hasAdditionalPhones=!![];}for(var _0x40798a in _0x2eb926){if(_0x3ad699[_0x58cae5]['name']+'_description'===_0x40798a){phoneDescriptions['push']({'itemTypeId':_0x3ad699[_0x58cae5]['id'],'description':_0x40798a});delete _0x57cc1e[_0x40798a];}}}if(hasAdditionalPhones)_0x57cc1e[_0x76a4('0x21')]='';var _0x2f9d4f=_[_0x76a4('0x53')](_0x57cc1e)[_0x76a4('0x17')]();logger['info'](_0x76a4('0x68'),_0x2f9d4f);fs[_0x76a4('0x69')](_0x58e1a2,_0x2f9d4f+'\x0a');Papa[_0x76a4('0x6a')](fs['createReadStream'](_0x57ba53),{'header':!![],'skipEmptyLines':!![],'step':function(_0x446854,_0x1522e4){try{for(var _0x35cd76=0x0,_0x5033c5=[];_0x35cd76<_0x446854[_0x76a4('0x6b')]['length'];_0x35cd76++){stats['rows']+=0x1;if(_0x446854[_0x76a4('0x5c')][_0x35cd76]){handleError(_0x446854[_0x76a4('0x6b')][_0x35cd76],_0x446854[_0x76a4('0x5c')][_0x35cd76]);}else{var _0x185070=[];var _0x49981f=[];var _0x15aceb={};for(var _0x5efc5c in _0x2eb926){let _0x3e8b07=contactItemTypes[_0x76a4('0x6c')](_0x36bcaa=>_0x36bcaa[_0x76a4('0x67')]===_0x5efc5c);let _0x47a705=contactItemTypes[_0x76a4('0x6c')](_0x50ad0d=>_0x50ad0d[_0x76a4('0x67')]+_0x76a4('0x6d')===_0x5efc5c);if(_['isNil'](_0x3e8b07)&&_['isNil'](_0x47a705)){if(_0x2eb926[_0x76a4('0x6e')](_0x5efc5c)){if(_0x446854[_0x76a4('0x6b')][_0x35cd76][_0x2eb926[_0x5efc5c]]){var _0x5860e5=_[_0x76a4('0x6f')](_0x446854[_0x76a4('0x6b')][_0x35cd76][_0x2eb926[_0x5efc5c]]['replace'](/"/g,'\x27'));switch(_0x5efc5c){case _0x76a4('0x70'):var _0x88dcfd=moment(_0x5860e5,_0x76a4('0x71'),!![]);if(_0x88dcfd['isValid']()){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x72'));}break;case _0x76a4('0x38'):var _0xe3ec34=parseInt(_0x5860e5);_0x5860e5=_[_0x76a4('0x73')](_0xe3ec34)||_0xe3ec34<0x0||_0xe3ec34>0x4?_0x1f2d8e?0x3:0x2:_0xe3ec34;_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');break;case'UserId':var _0x20f7a1=parseInt(_0x5860e5);if(_[_0x76a4('0x74')](_0x20f7a1)&&_['includes'](_0x5ab84f,_0x20f7a1)){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x20f7a1+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x75'));}break;case _0x76a4('0x76'):if(isEmail(_0x5860e5)){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070['push'](_0x76a4('0x77'));}break;case _0x76a4('0x78'):var _0x4f29ab=moment(_0x5860e5,'YYYY-MM-DD',!![]);if(_0x4f29ab[_0x76a4('0x79')]()){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}else{_0x185070[_0x76a4('0x22')](_0x76a4('0x7a'));}break;default:_0x5033c5[_0x76a4('0x22')]('\x22'+_0x5860e5+'\x22');}}else{switch(_0x5efc5c){case _0x76a4('0x7b'):case _0x76a4('0x15'):_0x185070[_0x76a4('0x22')](_0x5efc5c+_0x76a4('0x7c'));break;default:_0x5033c5[_0x76a4('0x22')]('\x22\x22');}}}}else{var _0x2404c7='';if(!_['isNil'](_0x3e8b07)){if(!_0x15aceb[_0x76a4('0x6e')](_0x3e8b07['id'])){for(var _0x5b6689=0x0;_0x5b6689<_0x2eb926[_0x5efc5c]['length'];_0x5b6689++){var _0x5860e5=_['trim'](_0x446854['data'][_0x35cd76][_0x2eb926[_0x5efc5c][_0x5b6689]][_0x76a4('0x7d')](/"/g,'\x27'));var _0x53c9be=phoneDescriptions[_0x76a4('0x6c')](_0x192f32=>_0x192f32[_0x76a4('0x7e')]===_0x3e8b07['id']);if(!_[_0x76a4('0x20')](_0x53c9be)){var _0x1fe333=_[_0x76a4('0x6f')](_0x446854['data'][_0x35cd76][_0x2eb926[_0x53c9be['description']][0x0]][_0x76a4('0x7d')](/"/g,'\x27'));if(!_['isNil'](_0x1fe333))_0x5860e5=_0x5860e5+'§'+_0x1fe333;}if(_0x2404c7=='')_0x2404c7=_0x5860e5;else _0x2404c7+='|'+_0x5860e5;}_0x49981f[_0x76a4('0x22')](_0x3e8b07['id']+':'+_0x2404c7);_0x15aceb[_0x3e8b07['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5033c5[_0x76a4('0x22')]('\x22'+_0x49981f[_0x76a4('0x17')](';')+'\x22');}if(_0x185070[_0x76a4('0x1f')]){handleError(_0x446854[_0x76a4('0x6b')][_0x35cd76],{'code':_0x76a4('0x7f'),'message':_0x185070['join']()});}else{fs['appendFileSync'](_0x58e1a2,_0x5033c5[_0x76a4('0x17')]()+'\x0a');}_0x5033c5=[];}if(!(stats['rows']%0xc8)){socket[_0x76a4('0x80')](_0x76a4('0x81')+_0x1f21d0,stats);stats[_0x76a4('0x5c')]=[];}}if(stopped){logger[_0x76a4('0x58')](_0x76a4('0x82'));_0x1522e4[_0x76a4('0x83')]();}}catch(_0x510496){handleError(_0x446854['data'][_0x35cd76],{'code':_0x76a4('0x84'),'message':_0x510496['message']});logger[_0x76a4('0x59')](_0x76a4('0x85'),_0x510496[_0x76a4('0x5a')]);}},'complete':function(){try{var _0x88469d=[];var _0x4d1b58=tempTableName;_0x88469d[_0x76a4('0x22')]('CREATE\x20TABLE\x20'+_0x4d1b58+'\x20LIKE\x20cm_contacts;');logger[_0x76a4('0x58')](_0x76a4('0x86'),contactItemTypes['length']);var _0x4334f1=util[_0x76a4('0xf')](_0x76a4('0x87'),_0x58e1a2,_0x4d1b58,_0x2f9d4f,_0x8a3322['ListId'],_0x8a3322['CompanyId']||null,NOW,NOW);if(_[_0x76a4('0x20')](_0x2eb926[_0x76a4('0x70')])){_0x4334f1+=_0x76a4('0x88');}_0x88469d[_0x76a4('0x22')](_0x4334f1);BPromise[_0x76a4('0x89')](_0x88469d,handleQuery)['then'](function(_0x109f94){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x88469d=[];for(var _0x3e276f=0x0;_0x3e276f\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','all','catch','error','message','push','split','CmContactHasItem','update','then','create','CmContact','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','recallme','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.createdAt','cm_hopper_black','fields','from','cm_contacts.ListId\x20=\x20','.CmListId','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','group','info','Received\x20SIGINT','exit','errors','main','stringify','send','clone','socket_timestamp'];(function(_0x1c8549,_0xf66acf){var _0x315eaf=function(_0x5d0447){while(--_0x5d0447){_0x1c8549['push'](_0x1c8549['shift']());}};_0x315eaf(++_0xf66acf);}(_0x57ef,0xdb));var _0xf57e=function(_0x1440e9,_0x25cbc2){_0x1440e9=_0x1440e9-0x0;var _0x4d63de=_0x57ef[_0x1440e9];return _0x4d63de;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xf57e('0x0'));var Papa=require(_0xf57e('0x1'));var util=require(_0xf57e('0x2'));var BPromise=require(_0xf57e('0x3'));var moment=require(_0xf57e('0x4'));var squel=require(_0xf57e('0x5'));var Redis=require(_0xf57e('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xf57e('0x7'));var logger=require(_0xf57e('0x8'))(_0xf57e('0x9'));config[_0xf57e('0xa')]=_[_0xf57e('0xb')](config[_0xf57e('0xa')],{'host':_0xf57e('0xc'),'port':0x18eb});var socket=require(_0xf57e('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xf57e('0xe')](_0xf57e('0xf'));var tempTableName=_0xf57e('0x10')+moment()[_0xf57e('0xe')](_0xf57e('0x11'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4cac48){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))*$/[_0xf57e('0x12')](_0x4cac48);}function selectNotIn(_0x99db89,_0x57aaf9,_0x200531,_0x277d24,_0xd56ca3){return squel[_0xf57e('0x13')]()[_0xf57e('0x14')](_0xf57e('0x15'))['from'](_0x277d24)[_0xf57e('0x16')](_0x57aaf9,null,_0x57aaf9+_0xf57e('0x17')+_0x277d24+'.'+_0x200531)[_0xf57e('0x18')](_0x277d24+'.'+_0x200531+_0xf57e('0x19')+_0x99db89+'.'+_0x200531)[_0xf57e('0x18')](_0x57aaf9+_0xf57e('0x1a')+_0xd56ca3[_0xf57e('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2f0d23,_0x122be7){promisesAdditionalPhones=[];promisesContact=[];return db[_0xf57e('0x1b')][_0xf57e('0x1c')](_0xf57e('0x1d')+tempTableName)[_0xf57e('0x1e')](function(_0x302c46){if(_0x302c46!==null){var _0x37e548=[];for(var _0x20050d=0x0;_0x20050d<_0x302c46[_0xf57e('0x1f')];_0x20050d++){var _0x126ac4=_0x302c46[_0x20050d];if(!_[_0xf57e('0x20')](_0x126ac4[_0xf57e('0x15')])){if(!_[_0xf57e('0x20')](_0x126ac4[_0xf57e('0x21')]))_0x37e548['push'](insertAdditionalPhones(_0x126ac4));promisesContact['push']({'contact':_0x126ac4});}}}Promise[_0xf57e('0x22')](_0x37e548)['then'](function(){_0x2f0d23({'val':0x1});});})[_0xf57e('0x23')](function(_0x4e84a7){logger[_0xf57e('0x24')](_0x4e84a7[_0xf57e('0x25')]);});});}function insertAdditionalPhones(_0x17afb0){return new Promise(function(_0xa8476e,_0x571e57){var _0x192035=_0x17afb0[_0xf57e('0x21')];if(_[_0xf57e('0x20')](_0x192035))_0x571e57({'val':0x0});else{var _0x24aed0=_0x192035['split'](';');var _0x49b80c=[];orderBy=0x0;for(var _0x2068bc=0x0;_0x2068bc<_0x24aed0[_0xf57e('0x1f')];_0x2068bc++){_0x49b80c[_0xf57e('0x26')](splitAdditionalPhone(_0x17afb0['id'],_0x24aed0[_0x2068bc]));}Promise[_0xf57e('0x22')](_0x49b80c)['then'](function(){_0xa8476e({'val':_0x24aed0[_0xf57e('0x1f')]});});}});}function splitAdditionalPhone(_0x1cd065,_0x4b0a0c){return new Promise(function(_0x45843b,_0x2d5893){var _0x2c3eab=_0x4b0a0c[_0xf57e('0x27')](':');var _0x3eab72=_0x2c3eab[0x0];var _0x3666e8=_0x2c3eab[0x1];if(_0x3666e8!==''){var _0x5c7414=_0x3666e8[_0xf57e('0x27')]('|');var _0x5ef1dc=[];for(var _0x342c9d=0x0;_0x342c9d<_0x5c7414[_0xf57e('0x1f')];_0x342c9d++){if(_0x5c7414[_0x342c9d]!==''){var _0x1b7f19=_['filter'](promisesAdditionalPhones,{'contactId':_0x1cd065,'phone':_0x5c7414[_0x342c9d]});if(_0x1b7f19['length']==0x0){orderBy++;promisesAdditionalPhones[_0xf57e('0x26')]({'contactId':_0x1cd065,'contactTypeId':_0x3eab72,'phone':_0x5c7414[_0x342c9d],'orderBy':orderBy});}}}_0x45843b({'ok':0x1});}else _0x45843b({'res':0x0});});}function createAdditionalPhone(_0x22aeb6,_0x4f4c73,_0x468048,_0x349416){var _0x479f00='';var _0x545f45='';var _0x3c5a66=_0x468048['split']('§');_0x479f00=_0x3c5a66[0x0];if(_0x3c5a66[_0xf57e('0x1f')]==0x2)_0x545f45=_0x3c5a66[0x1];return new Promise(function(_0x40831e,_0x93f436){return db[_0xf57e('0x28')]['findOne']({'where':{'CmContactId':_0x22aeb6,'item':_0x479f00}})['then'](function(_0xc821b7){if(_0xc821b7){return db['CmContactHasItem'][_0xf57e('0x29')]({'ItemTypeId':_0x4f4c73,'description':_0x545f45,'OrderBy':_0x349416},{'where':{'CmContactId':_0x22aeb6,'item':_0x479f00}})[_0xf57e('0x2a')](function(_0x20f89e){_0x40831e({'res':'updated'});});}else{return db[_0xf57e('0x28')][_0xf57e('0x2b')]({'CmContactId':_0x22aeb6,'item':_0x479f00,'ItemTypeId':_0x4f4c73,'description':_0x545f45,'OrderBy':_0x349416,'ItemClass':'PHONE'})['then'](function(_0x131660){_0x40831e({'res':'inserted'});});}});});}function updateContact(_0x1e97e9){return new Promise(function(_0x405752,_0x599367){var _0x4adc20=_0x1e97e9['id'];delete _0x1e97e9['id'];return db[_0xf57e('0x2c')][_0xf57e('0x29')](_0x1e97e9,{'where':{'id':_0x4adc20}})[_0xf57e('0x2a')](function(_0x3d2401){updatedRows+=0x1;return db['CmHopper']['update']({'phone':_0x1e97e9[_0xf57e('0x15')]},{'where':{'ContactId':_0x4adc20}})[_0xf57e('0x2a')](function(_0x2aca58){_0x405752({'ret':'OK'});});});});}function insertCmHopper(_0x360734,_0x13a541,_0x5ae68b,_0x2de9ff,_0x5555ad){var _0x5b7b47=[_0xf57e('0x2d'),'cm_contacts.scheduledat',_0xf57e('0x2e'),_0xf57e('0x2f'),_0x13a541+'.'+_0x2de9ff,'cm_contacts.createdAt',_0xf57e('0x30'),_0xf57e('0x31'),_0xf57e('0x32'),'\x22'+_0x5555ad+'\x22'];return squel[_0xf57e('0x33')]()[_0xf57e('0x34')](_0xf57e('0x35'))[_0xf57e('0x36')]([_0xf57e('0x15'),_0xf57e('0x37'),_0xf57e('0x38'),_0xf57e('0x39'),_0x2de9ff,_0xf57e('0x3a'),_0xf57e('0x3b'),_0xf57e('0x3c'),'UserId',_0xf57e('0x3d')],squel['select']()['fields'](_0x5b7b47)['from'](_0x13a541)[_0xf57e('0x16')](_0xf57e('0x3e'),null,'cm_contacts.ListId\x20=\x20'+_0x13a541+'.CmListId')['join'](_0x5ae68b,null,_0x5ae68b+_0xf57e('0x17')+_0x13a541+'.'+_0x2de9ff)[_0xf57e('0x18')](_0x13a541+_0xf57e('0x3f'),_0x360734)[_0xf57e('0x18')](_0xf57e('0x40'),NOW)['where'](_0xf57e('0x41'),selectNotIn(_0x13a541,_0x5ae68b,_0x2de9ff,_0xf57e('0x35'),[_0xf57e('0x42'),'\x22onlyIfOpen\x22']))[_0xf57e('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x13a541,_0x5ae68b,_0x2de9ff,'cm_hopper',['\x22always\x22'])))[_0xf57e('0x43')]();}function insertCmHopperBlack(_0x23937f,_0x188def,_0x5a962b,_0x48d305){var _0x5d0f4e=[_0xf57e('0x2d'),_0xf57e('0x2e'),'cm_contacts.ListId',_0x188def+'.'+_0x48d305,_0xf57e('0x44'),_0xf57e('0x30')];return squel[_0xf57e('0x33')]()[_0xf57e('0x34')](_0xf57e('0x45'))['fromQuery']([_0xf57e('0x15'),'ContactId','ListId',_0x48d305,_0xf57e('0x3a'),_0xf57e('0x3b')],squel[_0xf57e('0x13')]()[_0xf57e('0x46')](_0x5d0f4e)[_0xf57e('0x47')](_0x188def)['join']('cm_contacts',null,_0xf57e('0x48')+_0x188def+_0xf57e('0x49'))[_0xf57e('0x16')](_0x5a962b,null,_0x5a962b+_0xf57e('0x17')+_0x188def+'.'+_0x48d305)[_0xf57e('0x18')](_0x188def+_0xf57e('0x3f'),_0x23937f)['where'](_0xf57e('0x40'),NOW)[_0xf57e('0x18')](_0xf57e('0x41'),squel[_0xf57e('0x13')]()[_0xf57e('0x14')](_0xf57e('0x15'))[_0xf57e('0x47')](_0xf57e('0x45'))['where'](_0xf57e('0x4a'),_0x23937f)[_0xf57e('0x18')](_0x48d305+'\x20=\x20?',_0x188def+'.'+_0x48d305)))[_0xf57e('0x43')]();}function insertCmHopperAdditionalPhones(_0x4cec0){var _0x211bd3=[_0xf57e('0x4b'),_0xf57e('0x4c'),_0xf57e('0x4d'),_0xf57e('0x4e'),_0xf57e('0x4f')];return squel['insert']()[_0xf57e('0x34')](_0xf57e('0x50'))[_0xf57e('0x36')]([_0xf57e('0x51'),_0xf57e('0x15'),_0xf57e('0x52'),'createdAt',_0xf57e('0x3b')],squel[_0xf57e('0x13')]()[_0xf57e('0x46')](_0x211bd3)[_0xf57e('0x47')](_0xf57e('0x35'))[_0xf57e('0x16')]('cm_contacts',null,_0xf57e('0x53'))[_0xf57e('0x16')](_0xf57e('0x54'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xf57e('0x18')]('cm_hopper.ListId\x20=\x20?',_0x4cec0)['where'](_0xf57e('0x40'),NOW))[_0xf57e('0x43')]();}function insertCmContact(_0x12d614,_0x23d8b4,_0x24f40d,_0x2d31f1){var _0x34daff=_[_0xf57e('0x55')](_['keys'](_0x2d31f1),[_0xf57e('0x39'),_0xf57e('0x56'),_0xf57e('0x3a'),_0xf57e('0x3b')]);return squel[_0xf57e('0x33')]()[_0xf57e('0x34')](_0xf57e('0x3e'))[_0xf57e('0x36')](_0x34daff,squel[_0xf57e('0x13')]()[_0xf57e('0x46')](_0x34daff)[_0xf57e('0x47')](_0x23d8b4)[_0xf57e('0x18')]('('+_0x24f40d[_0xf57e('0x16')](',')+_0xf57e('0x57'),squel[_0xf57e('0x13')]()[_0xf57e('0x46')](_0x24f40d)['from']('cm_contacts')[_0xf57e('0x18')](_0xf57e('0x4a'),_0x12d614))[_0xf57e('0x18')](_0xf57e('0x58'),squel['select']()[_0xf57e('0x14')]('MIN(id)','min_id')[_0xf57e('0x47')](_0x23d8b4)[_0xf57e('0x59')](_0x24f40d['join'](','))))[_0xf57e('0x43')]();}function handleStop(){logger[_0xf57e('0x5a')](_0xf57e('0x5b'));stopped=!![];}function handleUncaughtException(_0x3d2cde){logger[_0xf57e('0x24')](_0x3d2cde[_0xf57e('0x25')]);process[_0xf57e('0x5c')](0x1);}function handleError(_0x1f97f5,_0x5471d1){stats[_0xf57e('0x5d')][_0xf57e('0x26')]({'name':_0x5471d1['code'],'message':_0x5471d1['message'],'row':_0x1f97f5});}function handleQuery(_0x4577e1){logger[_0xf57e('0x5a')](_0x4577e1);return db['sequelize'][_0xf57e('0x1c')](_0x4577e1)[_0xf57e('0x1e')](function(_0x5c6e70){results[_0xf57e('0x26')](_0x5c6e70);})[_0xf57e('0x23')](function(_0x230361){logger[_0xf57e('0x24')](_0x230361[_0xf57e('0x25')]);});}function main(_0x5a63a2,_0x4acc7e,_0x2aadb8,_0x4f31a1){logger[_0xf57e('0x5a')](_0xf57e('0x5e'),_0x5a63a2,JSON[_0xf57e('0x5f')](_0x4acc7e));process[_0xf57e('0x60')]('start');var _0x18720e=_0x4acc7e['binding'];var _0x3e83cd=_[_0xf57e('0x61')](_0x18720e);var _0x4e3fb2=_0x4acc7e[_0xf57e('0x62')];var _0x5e7886=path[_0xf57e('0x16')](config['root'],_0xf57e('0x63'),_0x4e3fb2+_0xf57e('0x64'));logger[_0xf57e('0x5a')](_0xf57e('0x65'),_0x4acc7e);db[_0xf57e('0x66')][_0xf57e('0x67')]({'raw':!![],'attributes':['id',_0xf57e('0x68')]})[_0xf57e('0x2a')](function(_0x580a78){for(var _0x4e5aaf=0x0;_0x4e5aaf<_0x580a78[_0xf57e('0x1f')];_0x4e5aaf++){if(_0x580a78[_0x4e5aaf][_0xf57e('0x68')]in _0x18720e){contactItemTypes[_0xf57e('0x26')](_0x580a78[_0x4e5aaf]);delete _0x3e83cd[_0x580a78[_0x4e5aaf][_0xf57e('0x68')]];hasAdditionalPhones=!![];}for(var _0x5f2e95 in _0x18720e){if(_0x580a78[_0x4e5aaf][_0xf57e('0x68')]+'_description'===_0x5f2e95){phoneDescriptions[_0xf57e('0x26')]({'itemTypeId':_0x580a78[_0x4e5aaf]['id'],'description':_0x5f2e95});delete _0x3e83cd[_0x5f2e95];}}}if(hasAdditionalPhones)_0x3e83cd[_0xf57e('0x21')]='';var _0x5afed5=_[_0xf57e('0x69')](_0x3e83cd)[_0xf57e('0x16')]();logger[_0xf57e('0x5a')](_0xf57e('0x6a'),_0x5afed5);fs[_0xf57e('0x6b')](_0x5e7886,_0x5afed5+'\x0a');Papa[_0xf57e('0x6c')](fs[_0xf57e('0x6d')](_0x5a63a2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5258d1,_0x25745f){try{for(var _0x2276ba=0x0,_0xb67029=[];_0x2276ba<_0x5258d1[_0xf57e('0x6e')][_0xf57e('0x1f')];_0x2276ba++){stats[_0xf57e('0x6f')]+=0x1;if(_0x5258d1['errors'][_0x2276ba]){handleError(_0x5258d1[_0xf57e('0x6e')][_0x2276ba],_0x5258d1[_0xf57e('0x5d')][_0x2276ba]);}else{var _0x440778=[];var _0x373344=[];var _0x2b5b6f={};for(var _0x3a2c6f in _0x18720e){let _0x658238=contactItemTypes[_0xf57e('0x70')](_0x19c4be=>_0x19c4be[_0xf57e('0x68')]===_0x3a2c6f);let _0x4b86a5=contactItemTypes['find'](_0x470c36=>_0x470c36[_0xf57e('0x68')]+_0xf57e('0x71')===_0x3a2c6f);if(_[_0xf57e('0x20')](_0x658238)&&_[_0xf57e('0x20')](_0x4b86a5)){if(_0x18720e[_0xf57e('0x72')](_0x3a2c6f)){if(_0x5258d1[_0xf57e('0x6e')][_0x2276ba][_0x18720e[_0x3a2c6f]]){var _0x55c058=_[_0xf57e('0x73')](_0x5258d1[_0xf57e('0x6e')][_0x2276ba][_0x18720e[_0x3a2c6f]][_0xf57e('0x74')](/"/g,'\x27'));switch(_0x3a2c6f){case _0xf57e('0x37'):var _0x1278b6=moment(_0x55c058,_0xf57e('0xf'),!![]);if(_0x1278b6['isValid']()){_0xb67029[_0xf57e('0x26')]('\x22'+_0x55c058+'\x22');}else{_0x440778[_0xf57e('0x26')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xf57e('0x3c'):var _0x12ec69=parseInt(_0x55c058);_0x55c058=_['isNaN'](_0x12ec69)||_0x12ec69<0x0||_0x12ec69>0x4?_0x4f31a1?0x3:0x2:_0x12ec69;_0xb67029[_0xf57e('0x26')]('\x22'+_0x55c058+'\x22');break;case _0xf57e('0x75'):var _0xcc5828=parseInt(_0x55c058);if(_['isNumber'](_0xcc5828)&&_[_0xf57e('0x76')](_0x2aadb8,_0xcc5828)){_0xb67029[_0xf57e('0x26')]('\x22'+_0xcc5828+'\x22');}else{_0x440778[_0xf57e('0x26')](_0xf57e('0x77'));}break;case _0xf57e('0x78'):if(isEmail(_0x55c058)){_0xb67029[_0xf57e('0x26')]('\x22'+_0x55c058+'\x22');}else{_0x440778[_0xf57e('0x26')](_0xf57e('0x79'));}break;case _0xf57e('0x7a'):var _0x2b9da1=moment(_0x55c058,_0xf57e('0x7b'),!![]);if(_0x2b9da1[_0xf57e('0x7c')]()){_0xb67029[_0xf57e('0x26')]('\x22'+_0x55c058+'\x22');}else{_0x440778['push'](_0xf57e('0x7d'));}break;default:_0xb67029['push']('\x22'+_0x55c058+'\x22');}}else{switch(_0x3a2c6f){case _0xf57e('0x7e'):case'phone':_0x440778[_0xf57e('0x26')](_0x3a2c6f+'\x20not\x20specified');break;default:_0xb67029[_0xf57e('0x26')]('\x22\x22');}}}}else{var _0x4f4f8f='';if(!_['isNil'](_0x658238)){if(!_0x2b5b6f[_0xf57e('0x72')](_0x658238['id'])){for(var _0x16c4a0=0x0;_0x16c4a0<_0x18720e[_0x3a2c6f][_0xf57e('0x1f')];_0x16c4a0++){var _0x55c058=_[_0xf57e('0x73')](_0x5258d1[_0xf57e('0x6e')][_0x2276ba][_0x18720e[_0x3a2c6f][_0x16c4a0]][_0xf57e('0x74')](/"/g,'\x27'));var _0x43fc6a=phoneDescriptions[_0xf57e('0x70')](_0x576e5a=>_0x576e5a[_0xf57e('0x7f')]===_0x658238['id']);if(!_[_0xf57e('0x20')](_0x43fc6a)){var _0x3f7336=_[_0xf57e('0x73')](_0x5258d1[_0xf57e('0x6e')][_0x2276ba][_0x18720e[_0x43fc6a[_0xf57e('0x80')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0xf57e('0x20')](_0x3f7336))_0x55c058=_0x55c058+'§'+_0x3f7336;}if(_0x4f4f8f=='')_0x4f4f8f=_0x55c058;else _0x4f4f8f+='|'+_0x55c058;}_0x373344[_0xf57e('0x26')](_0x658238['id']+':'+_0x4f4f8f);_0x2b5b6f[_0x658238['id']]=0x1;}}}}if(hasAdditionalPhones){_0xb67029['push']('\x22'+_0x373344[_0xf57e('0x16')](';')+'\x22');}if(_0x440778['length']){handleError(_0x5258d1[_0xf57e('0x6e')][_0x2276ba],{'code':_0xf57e('0x81'),'message':_0x440778[_0xf57e('0x16')]()});}else{fs['appendFileSync'](_0x5e7886,_0xb67029[_0xf57e('0x16')]()+'\x0a');}_0xb67029=[];}if(!(stats['rows']%0xc8)){socket[_0xf57e('0x82')](_0xf57e('0x83')+_0x4e3fb2,stats);stats[_0xf57e('0x5d')]=[];}}if(stopped){logger[_0xf57e('0x5a')](_0xf57e('0x84'));_0x25745f[_0xf57e('0x85')]();}}catch(_0x3b1ad1){handleError(_0x5258d1[_0xf57e('0x6e')][_0x2276ba],{'code':_0xf57e('0x86'),'message':_0x3b1ad1['message']});logger[_0xf57e('0x24')](_0xf57e('0x87'),_0x3b1ad1[_0xf57e('0x25')]);}},'complete':function(){try{var _0x3fa0a1=[];var _0x323e93=tempTableName;_0x3fa0a1[_0xf57e('0x26')](_0xf57e('0x88')+_0x323e93+_0xf57e('0x89'));logger[_0xf57e('0x5a')](_0xf57e('0x8a'),contactItemTypes[_0xf57e('0x1f')]);var _0x3b6ca6=util[_0xf57e('0xe')](_0xf57e('0x8b'),_0x5e7886,_0x323e93,_0x5afed5,_0x4acc7e[_0xf57e('0x39')],_0x4acc7e['CompanyId']||null,NOW,NOW);if(_[_0xf57e('0x20')](_0x18720e[_0xf57e('0x37')])){_0x3b6ca6+=_0xf57e('0x8c');}_0x3fa0a1[_0xf57e('0x26')](_0x3b6ca6);BPromise[_0xf57e('0x8d')](_0x3fa0a1,handleQuery)[_0xf57e('0x2a')](function(_0x28fb7e){BPromise[_0xf57e('0x22')]([handleAdditionalPhones()])['then'](function(){_0x3fa0a1=[];for(var _0x2d3282=0x0;_0x2d3282\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','sequelize','toString','Setting','findOne','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','search','select','field','color','from','getInteractionFK','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','cm_contacts','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','mail','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','buildExpression','type','text','value','end','unreadMessages','read','and','operator','split','contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','tags','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys'];(function(_0x1c2571,_0x4fb247){var _0x51e16a=function(_0x96c1d9){while(--_0x96c1d9){_0x1c2571['push'](_0x1c2571['shift']());}};_0x51e16a(++_0x4fb247);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x52ed40,_0xae19b8){_0x52ed40=_0x52ed40-0x0;var _0x3892eb=_0x7a2c[_0x52ed40];return _0x3892eb;};'use strict';var _=require(_0xc7a2('0x0'));var squel=require('squel');var as=require(_0xc7a2('0x1'));var qs=require(_0xc7a2('0x2'));var updateInteraction=require(_0xc7a2('0x3'))[_0xc7a2('0x4')];var utils=require(_0xc7a2('0x5'));var db=require(_0xc7a2('0x6'))['db'];function skipInteractionsQuery(_0x3f2b0d,_0x34cd60,_0x489232){var _0x3a47c8=![];var _0x1ddbae=utils['getAccountFK'](_0x3f2b0d);if(_0x34cd60['role']==='agent'&&!_0x489232[_0xc7a2('0x7')]&&!_0x489232[_0x1ddbae]){_0x3a47c8=!![];}return _0x3a47c8;}function getTagsQuery(){return squel[_0xc7a2('0x8')]()[_0xc7a2('0x9')]('id')[_0xc7a2('0x9')]('name')[_0xc7a2('0x9')](_0xc7a2('0xa'))[_0xc7a2('0xb')]('tools_tags');}function getUsersQuery(_0x2c3f86,_0x4a44c7){var _0x3e216a=utils[_0xc7a2('0xc')](_0x2c3f86);var _0x1a9b38='user_has_'+_0x2c3f86+_0xc7a2('0xd');var _0x28d414=squel[_0xc7a2('0x8')]()['field'](_0xc7a2('0xe'))[_0xc7a2('0x9')](_0xc7a2('0xf'))[_0xc7a2('0x9')](_0xc7a2('0x10')+_0x3e216a)[_0xc7a2('0xb')](_0x1a9b38,'ui')[_0xc7a2('0x11')](_0xc7a2('0x12'),'u',_0xc7a2('0x13'));if(_0x4a44c7[_0xc7a2('0x14')]>0x0){_0x28d414[_0xc7a2('0x15')](_0xc7a2('0x10')+_0x3e216a+_0xc7a2('0x16'),_[_0xc7a2('0x17')](_0x4a44c7,'id'));}return _0x28d414;}function getInteractionsQuery(_0x2bc321){var _0x506396=utils[_0xc7a2('0x18')](_0x2bc321);var _0x59e8ad=utils[_0xc7a2('0x19')](_0x2bc321);var _0x302d54=utils[_0xc7a2('0xc')](_0x2bc321);return squel[_0xc7a2('0x8')]()['from'](_0x506396['interactions'],'i')[_0xc7a2('0x11')](_0xc7a2('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0xc7a2('0x1b'))['left_join'](_0x506396[_0xc7a2('0x1c')],'a',_0xc7a2('0x1d')+_0x59e8ad)['left_join'](_0x506396[_0xc7a2('0x1e')],'me',_0xc7a2('0x1f')+_0x302d54+_0xc7a2('0x20'))[_0xc7a2('0x11')](_0x506396[_0xc7a2('0x21')],'it',_0xc7a2('0x22')+_0x302d54+_0xc7a2('0x20'))['left_join']('tools_tags','t',_0xc7a2('0x23'));}function getSqlClauses(){var _0x1c3fb8={'body':squel['expr'](),'contact':squel[_0xc7a2('0x24')](),'default':squel[_0xc7a2('0x24')](),'fields':squel[_0xc7a2('0x24')](),'filter':squel[_0xc7a2('0x24')](),'read':squel[_0xc7a2('0x24')](),'tags':{'clause':squel[_0xc7a2('0x24')](),'ids':null},'user':squel[_0xc7a2('0x24')]()};return _0x1c3fb8;}function parseTagParameter(_0x429b05){var _0x591860=squel[_0xc7a2('0x24')]();if(_0x429b05){var _0x505fe8=utils[_0xc7a2('0x25')](_0x429b05);_0x505fe8['forEach'](function(_0x20404b){_0x591860['or'](_0xc7a2('0x26'),'%,'+_0x20404b+',%');});}return _0x591860;}function parseReadParameter(_0xd93f19){var _0x3959c9='';if(_0xd93f19){_0x3959c9='unreadMessages\x20{OPERATOR}\x200';if(_0xd93f19==='1'){_0x3959c9=_0x3959c9['replace'](_0xc7a2('0x27'),'=');}else{_0x3959c9=_0x3959c9[_0xc7a2('0x28')](_0xc7a2('0x27'),'>');}}return _0x3959c9;}function parseSearchFilter(_0x305efb,_0x3be88c){var _0x306e99=squel[_0xc7a2('0x24')]();if(_0x3be88c){var _0x5e970e=_0x3be88c[_0xc7a2('0x28')]('\x5c','\x5c\x5c')[_0xc7a2('0x28')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5e970e)){_0x306e99['or'](_0xc7a2('0x29'),_0x5e970e+'%');if([_0xc7a2('0x2a'),_0xc7a2('0x2b')]['includes'](_0x305efb)){_0x306e99['or'](_0xc7a2('0x2c'),_0x5e970e+'%');}else if(_0x305efb==='fax'){_0x306e99['or'](_0xc7a2('0x2d'),_0x5e970e+'%');}else if(_0x305efb==='openchannel'){_0x306e99['or']('i.from\x20LIKE\x20?',_0x5e970e+'%');}}else if(_0x305efb===_0xc7a2('0x2e')&&qs['isEmail'](_0x5e970e)){_0x306e99['or']('c.email\x20LIKE\x20?',_0x5e970e+'%');}else{if(_0x305efb===_0xc7a2('0x2e')){_0x306e99['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc7a2('0x2f')](_0x5e970e))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc7a2('0x2f')](_0x5e970e));}else{if(_0x305efb!==_0xc7a2('0x30')){_0x306e99['or'](_0xc7a2('0x31'),qs[_0xc7a2('0x2f')](_0x5e970e));}_0x306e99['or'](_0xc7a2('0x32'),_0x5e970e+'%');}}}return _0x306e99;}function parseAdvancedSearchFilter(_0x4226e3,_0x1e10fc){var _0x2a3bfb=getSqlClauses();var _0x29771b=as[_0xc7a2('0x33')](_0x4226e3);var _0x4ba53e=_0x29771b[_0xc7a2('0x34')];for(var _0x41a503=0x0;_0x41a503<_0x29771b['conditions'][_0xc7a2('0x14')];_0x41a503++){var _0xf7ed4a=_0x29771b[_0xc7a2('0x35')][_0x41a503];var _0x23187f='i';var _0x178c3e=_[_0xc7a2('0x36')](_0x1e10fc,[_0xc7a2('0x37'),_0xf7ed4a['field']]);if(_0x178c3e){var _0x4124bd=as[_0xc7a2('0x38')](_0x23187f,_0x178c3e[_0xc7a2('0x39')],_0xf7ed4a);_0x2a3bfb['default'][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')]['start'],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}else{switch(_0xf7ed4a[_0xc7a2('0x9')]){case _0xc7a2('0x3d'):var _0x2cdef8=parseReadParameter(_0xf7ed4a[_0xc7a2('0x3b')]);_0x2a3bfb[_0xc7a2('0x3e')][_0xc7a2('0x3f')](_0x2cdef8);break;case'Contact':if(_0xf7ed4a[_0xc7a2('0x40')]==='$substring'){if(_0xf7ed4a[_0xc7a2('0x3b')][_0xc7a2('0x41')]('\x20')[_0xc7a2('0x14')]>0x1){_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0xc7a2('0x43'),qs[_0xc7a2('0x2f')](_0xf7ed4a[_0xc7a2('0x3b')]),null);}else{var _0x36f376='%'+_0xf7ed4a['value']+'%';_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0xc7a2('0x44'),_0x36f376,_0x36f376,_0x36f376);}}else{_0x178c3e=_[_0xc7a2('0x36')](_0x1e10fc,[_0xc7a2('0x37'),_0xc7a2('0x45')]);_0xf7ed4a[_0xc7a2('0x9')]='ContactId';_0x4124bd=as['buildExpression'](_0x23187f,_0x178c3e['type'],_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x42')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x46')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}break;case _0xc7a2('0x47'):var _0x13d3b4=_0xf7ed4a[_0xc7a2('0x3b')]['split'](',')['map'](function(_0x4bcb42){return Number(_0x4bcb42);});var _0x47696c=parseTagParameter(_0x13d3b4);_0x2a3bfb[_0xc7a2('0x48')]['clause'][_0xc7a2('0x3f')](_0x47696c);_0x2a3bfb[_0xc7a2('0x48')][_0xc7a2('0x49')]=_0x13d3b4;break;case'User':if(_0xf7ed4a[_0xc7a2('0x40')]==='$substring'){_0x2a3bfb[_0xc7a2('0x4a')][_0x4ba53e](_0xc7a2('0x4b'),'%'+_0xf7ed4a['value']+'%',null);}else{_0x178c3e=_['find'](_0x1e10fc,[_0xc7a2('0x37'),_0xc7a2('0x4c')]);_0xf7ed4a['field']=_0xc7a2('0x4c');_0x4124bd=as[_0xc7a2('0x38')](_0x23187f,_0x178c3e[_0xc7a2('0x39')],_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x4a')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')]['start'],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);}break;case _0xc7a2('0x4d'):case _0xc7a2('0x4e'):_0x4124bd=as['buildExpression']('me',null,_0xf7ed4a);_0x2a3bfb[_0xc7a2('0x4d')][_0x4ba53e](_0x4124bd[_0xc7a2('0x3a')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x46')],_0x4124bd[_0xc7a2('0x3b')][_0xc7a2('0x3c')]);break;}}}return _0x2a3bfb;}function parseModelFields(_0x7378ed,_0xdc4644,_0x5f5154){var _0x37bce7=utils[_0xc7a2('0x19')](_0x7378ed);var _0x18b00a=squel[_0xc7a2('0x24')]();var _0x4ef4c1=_(_0xdc4644)[_0xc7a2('0x4f')]()[_0xc7a2('0x17')](function(_0x512375){return _[_0xc7a2('0x50')](_0x5f5154,[_0xc7a2('0x37'),_0x512375])?_0x512375:undefined;})[_0xc7a2('0x51')]()[_0xc7a2('0x3b')]();if(_0x4ef4c1[_0xc7a2('0x14')]>0x0){_0x4ef4c1['forEach'](function(_0x306047){if(_0x306047===_0x37bce7){_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x37bce7+_0xc7a2('0x16'),[]['concat'](_0xdc4644[_0x306047]));}else if(_0x306047==='createdAt'){var _0x223755=JSON['parse'](_0xdc4644[_0x306047])['$gte'];var _0x340154=JSON[_0xc7a2('0x52')](_0xdc4644[_0x306047])['$lte'];_0x18b00a['and'](_0xc7a2('0x53'),_0x223755,_0x340154);}else{if(_0xdc4644[_0x306047]===_0xc7a2('0x54')){_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x306047+_0xc7a2('0x55'));}else{_0x18b00a[_0xc7a2('0x3f')]('i.'+_0x306047+'\x20=\x20?',_0xdc4644[_0x306047]);}}});}return _0x18b00a;}function parseQueryParameters(_0x3754a4,_0x179bc1,_0x581509){var _0x3e7c7e=getSqlClauses();return Promise[_0xc7a2('0x56')]()[_0xc7a2('0x57')](function(){return parseModelFields(_0x3754a4,_0x179bc1,_0x581509);})[_0xc7a2('0x57')](function(_0x1f4c96){_0x3e7c7e['fields'][_0xc7a2('0x3f')](_0x1f4c96);return parseReadParameter(_0x179bc1[_0xc7a2('0x3e')]);})[_0xc7a2('0x57')](function(_0x5f3622){_0x3e7c7e[_0xc7a2('0x3e')][_0xc7a2('0x3f')](_0x5f3622);return parseTagParameter(_0x179bc1[_0xc7a2('0x58')]);})[_0xc7a2('0x57')](function(_0x2f53e9){_0x3e7c7e[_0xc7a2('0x48')]['clause'][_0xc7a2('0x3f')](_0x2f53e9);return parseSearchFilter(_0x3754a4,_0x179bc1[_0xc7a2('0x59')]);})[_0xc7a2('0x57')](function(_0x332e8e){_0x3e7c7e[_0xc7a2('0x59')]=_0x332e8e;return _0x3e7c7e;});}function checkAccountsRestrictions(_0x1f0762,_0x2885fe,_0x50a80a){var _0x2b1bb3=utils['getAccountFK'](_0x1f0762);var _0x4e1efa=_0xc7a2('0x5a')+_[_0xc7a2('0x5b')](_0x1f0762)+(_0x1f0762===_0xc7a2('0x5c')?'Websites':_0xc7a2('0x5d'));var _0x4d2973=squel['expr']();return Promise[_0xc7a2('0x56')]()[_0xc7a2('0x57')](function(){if(_0x50a80a[_0xc7a2('0x7')]&&_0x2885fe[_0xc7a2('0x5e')]===_0xc7a2('0x5f')){return _0x2885fe[_0x4e1efa]({'attributes':['id'],'raw':!![]});}})[_0xc7a2('0x57')](function(_0x4e2d6a){if(_0x4e2d6a){if(_0x4e2d6a['length']===0x0){_0x4d2973['and']('i.'+_0x2b1bb3+_0xc7a2('0x55'));}else{_0x4d2973['and']('i.'+_0x2b1bb3+'\x20IN\x20?',_['map'](_0x4e2d6a,'id'));}}else if(!_0x50a80a[_0x2b1bb3]){_0x4d2973['and']('i.'+_0x2b1bb3+_0xc7a2('0x60'));}})[_0xc7a2('0x57')](function(){return _0x4d2973;});}function getClosedOrderClause(_0xfd65d8,_0x15b8fd){var _0x52c83a='';var _0x160fe3=[_0xc7a2('0x61'),_0xc7a2('0x62'),_0xc7a2('0x63')];if(_0xfd65d8===_0xc7a2('0x2e')){_0x160fe3[_0xc7a2('0x64')](_0xc7a2('0x65'));}if(_0x15b8fd[_0xc7a2('0x66')]==='0'&&_0xfd65d8===_0xc7a2('0x2e')){_0x52c83a=_0xc7a2('0x65');}else{if(_0x15b8fd[_0xc7a2('0x66')]==='1'){_0x160fe3['shift']();}_0x52c83a='CONCAT_WS(\x27\x27,\x20'+_0x160fe3[_0xc7a2('0x67')](',\x20')+')';}return _0x52c83a;}function getFilteredInteractions(_0x5e5466,_0xf8dbd1,_0xe09b54,_0x3dc131){var _0x29f1e7=utils['getInteractionFK'](_0x5e5466);var _0xfe5203=_[_0xc7a2('0x5b')](_0x5e5466)+_0xc7a2('0x68');var _0xc7ce86=[];var _0x20331b=getTagsQuery();var _0x5765f0={'type':db[_0xc7a2('0x69')][_0xc7a2('0x6a')][_0xc7a2('0x6b')],'raw':!![]};var _0x45044a=[];var _0x23d7bc=[];return db['sequelize'][_0xc7a2('0x6c')](_0x20331b['toString'](),_0x5765f0)['then'](function(_0x3c06a8){_0xc7ce86=_[_0xc7a2('0x6d')](_0x3c06a8,'id');_0x5765f0=_[_0xc7a2('0x6e')](_0x5765f0,{'model':db[_0xfe5203],'mapToModel':!![],'nest':!![]});if(_0xe09b54['fields']){_0x3dc131[_0xc7a2('0x6f')][_0xc7a2('0x70')](function(_0x5b82de){_0xf8dbd1[_0xc7a2('0x9')]('i.'+_0x5b82de);});}else{_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x71'),'unreadMessages');_0xf8dbd1['field']('a.key',_0xc7a2('0x72'));_0xf8dbd1[_0xc7a2('0x9')]('a.mandatoryDisposition',_0xc7a2('0x73'));if(_0x5e5466===_0xc7a2('0x2e')){_0xf8dbd1['field'](_0xc7a2('0x74'),'Account.email');_0xf8dbd1[_0xc7a2('0x9')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc7a2('0x75'));_0xf8dbd1[_0xc7a2('0x9')]('i.id');_0xf8dbd1[_0xc7a2('0x9')]('i.createdAt');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x76'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x77'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x78'));_0xf8dbd1['field']('i.attach');_0xf8dbd1['field'](_0xc7a2('0x79'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7a'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7b'));_0xf8dbd1['field']('i.disposition');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x62'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x61'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x65'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7c'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7d'));_0xf8dbd1['field']('i.MailAccountId');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7e'));}else if(_0x5e5466==='openchannel'){_0xf8dbd1[_0xc7a2('0x9')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc7a2('0x75'));}else{_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x7f'),_0xc7a2('0x75'));}if(_0x5e5466!=='mail'){_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x80'));}_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x81'),'Contact.firstName');_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x82'),_0xc7a2('0x83'));_0xf8dbd1[_0xc7a2('0x9')]('c.email',_0xc7a2('0x84'));_0xf8dbd1['field']('c.phone','Contact.phone');_0xf8dbd1[_0xc7a2('0x9')]('c.mobile',_0xc7a2('0x85'));_0xf8dbd1['field'](_0xc7a2('0x86'),_0xc7a2('0x87'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x88'),_0xc7a2('0x89'));_0xf8dbd1[_0xc7a2('0x9')](_0xc7a2('0x8a'),_0xc7a2('0x8b'));_0xf8dbd1[_0xc7a2('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc7a2('0x8c'));}if(_0x3dc131[_0xc7a2('0x8d')]){_0xf8dbd1[_0xc7a2('0x8d')](_0x3dc131[_0xc7a2('0x8d')]);}if(_0x3dc131[_0xc7a2('0x8e')]){_0xf8dbd1[_0xc7a2('0x8e')](_0x3dc131[_0xc7a2('0x8e')]);}return db[_0xc7a2('0x8f')][_0xc7a2('0x6c')](_0xf8dbd1[_0xc7a2('0x90')](),_0x5765f0);})[_0xc7a2('0x57')](function(_0x2f234f){_0x45044a=_0x2f234f;var _0x18461f=getUsersQuery(_0x5e5466,_0x45044a);return db[_0xc7a2('0x8f')][_0xc7a2('0x6c')](_0x18461f[_0xc7a2('0x90')](),_0x5765f0);})[_0xc7a2('0x57')](function(_0x2f65bd){_0x23d7bc=_['groupBy'](_0x2f65bd,_0x29f1e7);if(_0x5e5466==='mail'){return db[_0xc7a2('0x91')][_0xc7a2('0x92')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0xc7a2('0x57')](function(_0x30dca3){var _0x5cdfc8=_0x30dca3?_0x30dca3['enableEmailPreview']:undefined;var _0x31256b=_0x45044a[_0xc7a2('0x17')](function(_0xf25798){return updateInteraction(_0xf25798,_0xc7ce86,_0x23d7bc,_0x5cdfc8);});return Promise[_0xc7a2('0x93')](_0x31256b);});}function countFilteredInteractions(_0x470bf1,_0x259f04){var _0x4c48d9=_0x470bf1[_0xc7a2('0x94')]();_0x4c48d9['field'](_0xc7a2('0x95'));_0x4c48d9['field'](_0xc7a2('0x71'),_0xc7a2('0x3d'));var _0xe9e0fd=utils[_0xc7a2('0x25')](_0x259f04);if(!_[_0xc7a2('0x96')](_0xe9e0fd)){_0x4c48d9[_0xc7a2('0x15')](_0xc7a2('0x97'),_0xe9e0fd);}var _0x267e78={'type':db[_0xc7a2('0x69')]['QueryTypes']['SELECT'],'raw':!![]};return db['sequelize'][_0xc7a2('0x6c')](_0x4c48d9[_0xc7a2('0x90')](),_0x267e78);}module[_0xc7a2('0x98')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x8d9b=['type','default','text','value','start','end','unreadMessages','Contact','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','map','tags','clause','ids','UserId','user','body','plainBody','keys','compact','concat','createdAt','parse','$gte','and','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','closed','i.substatus','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','sequelize','query','toString','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','Setting','enableEmailPreview','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','../../mysqldb','role','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','select','u.id','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','getAccountFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','interactionsTags','it.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','isNumeric','i.id\x20LIKE\x20?','sms','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','parseSearch','sqlOperator','conditions','buildExpression'];(function(_0x550b27,_0x17145b){var _0x2fca00=function(_0x47f1e4){while(--_0x47f1e4){_0x550b27['push'](_0x550b27['shift']());}};_0x2fca00(++_0x17145b);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8d9('0x0'));var squel=require(_0xb8d9('0x1'));var as=require(_0xb8d9('0x2'));var qs=require(_0xb8d9('0x3'));var updateInteraction=require(_0xb8d9('0x4'))['updateInteraction'];var utils=require('./utils');var db=require(_0xb8d9('0x5'))['db'];function skipInteractionsQuery(_0x47b650,_0x2192ff,_0x3da7ad){var _0x56deeb=![];var _0x5996e9=utils['getAccountFK'](_0x47b650);if(_0x2192ff[_0xb8d9('0x6')]==='agent'&&!_0x3da7ad['search']&&!_0x3da7ad[_0x5996e9]){_0x56deeb=!![];}return _0x56deeb;}function getTagsQuery(){return squel['select']()[_0xb8d9('0x7')]('id')[_0xb8d9('0x7')](_0xb8d9('0x8'))[_0xb8d9('0x7')](_0xb8d9('0x9'))[_0xb8d9('0xa')](_0xb8d9('0xb'));}function getUsersQuery(_0x48f36d,_0x857f2a){var _0x59f638=utils[_0xb8d9('0xc')](_0x48f36d);var _0x2a60a4=_0xb8d9('0xd')+_0x48f36d+_0xb8d9('0xe');var _0x7f604f=squel[_0xb8d9('0xf')]()[_0xb8d9('0x7')](_0xb8d9('0x10'))[_0xb8d9('0x7')](_0xb8d9('0x11'))[_0xb8d9('0x7')](_0xb8d9('0x12')+_0x59f638)[_0xb8d9('0xa')](_0x2a60a4,'ui')[_0xb8d9('0x13')]('users','u',_0xb8d9('0x14'));if(_0x857f2a[_0xb8d9('0x15')]>0x0){_0x7f604f[_0xb8d9('0x16')](_0xb8d9('0x12')+_0x59f638+_0xb8d9('0x17'),_['map'](_0x857f2a,'id'));}return _0x7f604f;}function getInteractionsQuery(_0x542141){var _0x5b7d5a=utils[_0xb8d9('0x18')](_0x542141);var _0x2d1b34=utils[_0xb8d9('0x19')](_0x542141);var _0x1183e4=utils['getInteractionFK'](_0x542141);return squel[_0xb8d9('0xf')]()['from'](_0x5b7d5a[_0xb8d9('0x1a')],'i')[_0xb8d9('0x13')](_0xb8d9('0x1b'),'c',_0xb8d9('0x1c'))[_0xb8d9('0x13')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x5b7d5a[_0xb8d9('0x1d')],'a',_0xb8d9('0x1e')+_0x2d1b34)[_0xb8d9('0x13')](_0x5b7d5a[_0xb8d9('0x1f')],'me',_0xb8d9('0x20')+_0x1183e4+'\x20=\x20i.id')[_0xb8d9('0x13')](_0x5b7d5a[_0xb8d9('0x21')],'it',_0xb8d9('0x22')+_0x1183e4+_0xb8d9('0x23'))[_0xb8d9('0x13')](_0xb8d9('0xb'),'t',_0xb8d9('0x24'));}function getSqlClauses(){var _0x3d1659={'body':squel[_0xb8d9('0x25')](),'contact':squel[_0xb8d9('0x25')](),'default':squel['expr'](),'fields':squel[_0xb8d9('0x25')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0xb8d9('0x25')](),'ids':null},'user':squel[_0xb8d9('0x25')]()};return _0x3d1659;}function parseTagParameter(_0x43c9f1){var _0x33c75e=squel[_0xb8d9('0x25')]();if(_0x43c9f1){var _0x4885f2=utils[_0xb8d9('0x26')](_0x43c9f1);_0x4885f2[_0xb8d9('0x27')](function(_0x3111aa){_0x33c75e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3111aa+',%');});}return _0x33c75e;}function parseReadParameter(_0x2d1439){var _0x1c9bd4='';if(_0x2d1439){_0x1c9bd4=_0xb8d9('0x28');if(_0x2d1439==='1'){_0x1c9bd4=_0x1c9bd4['replace'](_0xb8d9('0x29'),'=');}else{_0x1c9bd4=_0x1c9bd4[_0xb8d9('0x2a')]('{OPERATOR}','>');}}return _0x1c9bd4;}function parseSearchFilter(_0x344e27,_0x6cd7f6){var _0x2694f0=squel[_0xb8d9('0x25')]();if(_0x6cd7f6){var _0x358e4d=_0x6cd7f6[_0xb8d9('0x2a')]('\x5c','\x5c\x5c')[_0xb8d9('0x2a')](/'/g,'\x27\x27');if(qs[_0xb8d9('0x2b')](_0x358e4d)){_0x2694f0['or'](_0xb8d9('0x2c'),_0x358e4d+'%');if([_0xb8d9('0x2d'),'whatsapp'][_0xb8d9('0x2e')](_0x344e27)){_0x2694f0['or'](_0xb8d9('0x2f'),_0x358e4d+'%');}else if(_0x344e27===_0xb8d9('0x30')){_0x2694f0['or']('i.fax\x20LIKE\x20?',_0x358e4d+'%');}else if(_0x344e27===_0xb8d9('0x31')){_0x2694f0['or'](_0xb8d9('0x32'),_0x358e4d+'%');}}else if(_0x344e27===_0xb8d9('0x33')&&qs[_0xb8d9('0x34')](_0x358e4d)){_0x2694f0['or'](_0xb8d9('0x35'),_0x358e4d+'%');}else{if(_0x344e27===_0xb8d9('0x33')){_0x2694f0['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x358e4d))['or'](_0xb8d9('0x36'),qs[_0xb8d9('0x37')](_0x358e4d));}else{if(_0x344e27!==_0xb8d9('0x30')){_0x2694f0['or'](_0xb8d9('0x38'),qs[_0xb8d9('0x37')](_0x358e4d));}_0x2694f0['or'](_0xb8d9('0x39'),_0x358e4d+'%');}}}return _0x2694f0;}function parseAdvancedSearchFilter(_0x4f11e4,_0x4992a6){var _0x4425f3=getSqlClauses();var _0x3c1503=as[_0xb8d9('0x3a')](_0x4f11e4);var _0x499334=_0x3c1503[_0xb8d9('0x3b')];for(var _0x4fca56=0x0;_0x4fca56<_0x3c1503[_0xb8d9('0x3c')][_0xb8d9('0x15')];_0x4fca56++){var _0x1268ea=_0x3c1503['conditions'][_0x4fca56];var _0x3330e7='i';var _0x1ad60d=_['find'](_0x4992a6,['name',_0x1268ea[_0xb8d9('0x7')]]);if(_0x1ad60d){var _0x1af691=as[_0xb8d9('0x3d')](_0x3330e7,_0x1ad60d[_0xb8d9('0x3e')],_0x1268ea);_0x4425f3[_0xb8d9('0x3f')][_0x499334](_0x1af691[_0xb8d9('0x40')],_0x1af691[_0xb8d9('0x41')][_0xb8d9('0x42')],_0x1af691[_0xb8d9('0x41')][_0xb8d9('0x43')]);}else{switch(_0x1268ea[_0xb8d9('0x7')]){case _0xb8d9('0x44'):var _0x9f11f2=parseReadParameter(_0x1268ea[_0xb8d9('0x41')]);_0x4425f3['read']['and'](_0x9f11f2);break;case _0xb8d9('0x45'):if(_0x1268ea[_0xb8d9('0x46')]===_0xb8d9('0x47')){if(_0x1268ea[_0xb8d9('0x41')]['split']('\x20')['length']>0x1){_0x4425f3[_0xb8d9('0x48')][_0x499334]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb8d9('0x37')](_0x1268ea['value']),null);}else{var _0x2356c5='%'+_0x1268ea['value']+'%';_0x4425f3[_0xb8d9('0x48')][_0x499334](_0xb8d9('0x49'),_0x2356c5,_0x2356c5,_0x2356c5);}}else{_0x1ad60d=_[_0xb8d9('0x4a')](_0x4992a6,['name',_0xb8d9('0x4b')]);_0x1268ea[_0xb8d9('0x7')]=_0xb8d9('0x4b');_0x1af691=as['buildExpression'](_0x3330e7,_0x1ad60d['type'],_0x1268ea);_0x4425f3['contact'][_0x499334](_0x1af691['text'],_0x1af691['value'][_0xb8d9('0x42')],_0x1af691[_0xb8d9('0x41')][_0xb8d9('0x43')]);}break;case'Tag':var _0x53eb73=_0x1268ea[_0xb8d9('0x41')]['split'](',')[_0xb8d9('0x4c')](function(_0x25ae38){return Number(_0x25ae38);});var _0x1a8498=parseTagParameter(_0x53eb73);_0x4425f3[_0xb8d9('0x4d')][_0xb8d9('0x4e')]['and'](_0x1a8498);_0x4425f3[_0xb8d9('0x4d')][_0xb8d9('0x4f')]=_0x53eb73;break;case'User':if(_0x1268ea[_0xb8d9('0x46')]===_0xb8d9('0x47')){_0x4425f3['user'][_0x499334]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1268ea[_0xb8d9('0x41')]+'%',null);}else{_0x1ad60d=_[_0xb8d9('0x4a')](_0x4992a6,[_0xb8d9('0x8'),_0xb8d9('0x50')]);_0x1268ea[_0xb8d9('0x7')]='UserId';_0x1af691=as[_0xb8d9('0x3d')](_0x3330e7,_0x1ad60d[_0xb8d9('0x3e')],_0x1268ea);_0x4425f3[_0xb8d9('0x51')][_0x499334](_0x1af691[_0xb8d9('0x40')],_0x1af691[_0xb8d9('0x41')][_0xb8d9('0x42')],_0x1af691['value'][_0xb8d9('0x43')]);}break;case _0xb8d9('0x52'):case _0xb8d9('0x53'):_0x1af691=as[_0xb8d9('0x3d')]('me',null,_0x1268ea);_0x4425f3[_0xb8d9('0x52')][_0x499334](_0x1af691[_0xb8d9('0x40')],_0x1af691['value'][_0xb8d9('0x42')],_0x1af691[_0xb8d9('0x41')]['end']);break;}}}return _0x4425f3;}function parseModelFields(_0x212310,_0x41f38b,_0x4ae9e1){var _0x587bb8=utils[_0xb8d9('0x19')](_0x212310);var _0x423927=squel[_0xb8d9('0x25')]();var _0xca2c82=_(_0x41f38b)[_0xb8d9('0x54')]()[_0xb8d9('0x4c')](function(_0x328d1d){return _['some'](_0x4ae9e1,[_0xb8d9('0x8'),_0x328d1d])?_0x328d1d:undefined;})[_0xb8d9('0x55')]()[_0xb8d9('0x41')]();if(_0xca2c82['length']>0x0){_0xca2c82[_0xb8d9('0x27')](function(_0x1dee5c){if(_0x1dee5c===_0x587bb8){_0x423927['and']('i.'+_0x587bb8+'\x20IN\x20?',[][_0xb8d9('0x56')](_0x41f38b[_0x1dee5c]));}else if(_0x1dee5c===_0xb8d9('0x57')){var _0x4e9a10=JSON[_0xb8d9('0x58')](_0x41f38b[_0x1dee5c])[_0xb8d9('0x59')];var _0x124722=JSON[_0xb8d9('0x58')](_0x41f38b[_0x1dee5c])['$lte'];_0x423927[_0xb8d9('0x5a')](_0xb8d9('0x5b'),_0x4e9a10,_0x124722);}else{if(_0x41f38b[_0x1dee5c]===_0xb8d9('0x5c')){_0x423927[_0xb8d9('0x5a')]('i.'+_0x1dee5c+_0xb8d9('0x5d'));}else{_0x423927[_0xb8d9('0x5a')]('i.'+_0x1dee5c+_0xb8d9('0x5e'),_0x41f38b[_0x1dee5c]);}}});}return _0x423927;}function parseQueryParameters(_0x518bb4,_0x3101da,_0x5c3100){var _0x305d1b=getSqlClauses();return Promise[_0xb8d9('0x5f')]()[_0xb8d9('0x60')](function(){return parseModelFields(_0x518bb4,_0x3101da,_0x5c3100);})['then'](function(_0x181878){_0x305d1b[_0xb8d9('0x61')][_0xb8d9('0x5a')](_0x181878);return parseReadParameter(_0x3101da[_0xb8d9('0x62')]);})[_0xb8d9('0x60')](function(_0x34a11e){_0x305d1b[_0xb8d9('0x62')][_0xb8d9('0x5a')](_0x34a11e);return parseTagParameter(_0x3101da[_0xb8d9('0x63')]);})[_0xb8d9('0x60')](function(_0x24ff63){_0x305d1b['tags'][_0xb8d9('0x4e')][_0xb8d9('0x5a')](_0x24ff63);return parseSearchFilter(_0x518bb4,_0x3101da[_0xb8d9('0x64')]);})[_0xb8d9('0x60')](function(_0x5c1a14){_0x305d1b[_0xb8d9('0x64')]=_0x5c1a14;return _0x305d1b;});}function checkAccountsRestrictions(_0x20e625,_0x1cdc5b,_0x351ac8){var _0x3bb503=utils['getAccountFK'](_0x20e625);var _0x11ccbc='get'+_[_0xb8d9('0x65')](_0x20e625)+(_0x20e625===_0xb8d9('0x66')?_0xb8d9('0x67'):_0xb8d9('0x68'));var _0x24ccf4=squel[_0xb8d9('0x25')]();return Promise[_0xb8d9('0x5f')]()['then'](function(){if(_0x351ac8[_0xb8d9('0x69')]&&_0x1cdc5b[_0xb8d9('0x6')]==='agent'){return _0x1cdc5b[_0x11ccbc]({'attributes':['id'],'raw':!![]});}})[_0xb8d9('0x60')](function(_0x49c6af){if(_0x49c6af){if(_0x49c6af[_0xb8d9('0x15')]===0x0){_0x24ccf4[_0xb8d9('0x5a')]('i.'+_0x3bb503+'\x20IS\x20NULL');}else{_0x24ccf4[_0xb8d9('0x5a')]('i.'+_0x3bb503+_0xb8d9('0x17'),_['map'](_0x49c6af,'id'));}}else if(!_0x351ac8[_0x3bb503]){_0x24ccf4[_0xb8d9('0x5a')]('i.'+_0x3bb503+_0xb8d9('0x6a'));}})['then'](function(){return _0x24ccf4;});}function getClosedOrderClause(_0x8f7212,_0x54b53c){var _0xffeec3='';var _0x31a5e8=[_0xb8d9('0x6b'),_0xb8d9('0x6c'),_0xb8d9('0x6d')];if(_0x8f7212==='mail'){_0x31a5e8['unshift']('i.substatus');}if(_0x54b53c[_0xb8d9('0x6e')]==='0'&&_0x8f7212===_0xb8d9('0x33')){_0xffeec3=_0xb8d9('0x6f');}else{if(_0x54b53c[_0xb8d9('0x6e')]==='1'){_0x31a5e8[_0xb8d9('0x70')]();}_0xffeec3=_0xb8d9('0x71')+_0x31a5e8[_0xb8d9('0x72')](',\x20')+')';}return _0xffeec3;}function getFilteredInteractions(_0x24be60,_0x3cc52a,_0x5f37ae,_0x360b05){var _0x32e58f=utils[_0xb8d9('0xc')](_0x24be60);var _0x15d5ed=_['capitalize'](_0x24be60)+_0xb8d9('0x73');var _0x7a813f=[];var _0x91236=getTagsQuery();var _0x4379ae={'type':db[_0xb8d9('0x74')]['QueryTypes'][_0xb8d9('0x75')],'raw':!![]};var _0x2fb1a9=[];var _0x55e2eb=[];return db[_0xb8d9('0x76')][_0xb8d9('0x77')](_0x91236[_0xb8d9('0x78')](),_0x4379ae)['then'](function(_0x275708){_0x7a813f=_['keyBy'](_0x275708,'id');_0x4379ae=_[_0xb8d9('0x79')](_0x4379ae,{'model':db[_0x15d5ed],'mapToModel':!![],'nest':!![]});if(_0x5f37ae[_0xb8d9('0x61')]){_0x360b05[_0xb8d9('0x7a')][_0xb8d9('0x27')](function(_0x55b547){_0x3cc52a[_0xb8d9('0x7')]('i.'+_0x55b547);});}else{_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x7b'),'unreadMessages');_0x3cc52a['field'](_0xb8d9('0x7c'),'Account.key');_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x7d'),_0xb8d9('0x7e'));if(_0x24be60===_0xb8d9('0x33')){_0x3cc52a['field'](_0xb8d9('0x7f'),_0xb8d9('0x80'));_0x3cc52a['field']('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xb8d9('0x81'));_0x3cc52a['field']('i.id');_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x82'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x83'));_0x3cc52a['field'](_0xb8d9('0x84'));_0x3cc52a[_0xb8d9('0x7')]('i.closedAt');_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x85'));_0x3cc52a[_0xb8d9('0x7')]('i.lastMsgAt');_0x3cc52a['field'](_0xb8d9('0x86'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x87'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x6d'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x6c'));_0x3cc52a['field'](_0xb8d9('0x6b'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x6f'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x88'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x89'));_0x3cc52a['field'](_0xb8d9('0x8a'));_0x3cc52a['field'](_0xb8d9('0x8b'));}else if(_0x24be60===_0xb8d9('0x31')){_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x8c'),_0xb8d9('0x81'));}else{_0x3cc52a['field'](_0xb8d9('0x8d'),'contactName');}if(_0x24be60!==_0xb8d9('0x33')){_0x3cc52a['field']('i.*');}_0x3cc52a[_0xb8d9('0x7')]('c.firstName',_0xb8d9('0x8e'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x8f'),'Contact.lastName');_0x3cc52a[_0xb8d9('0x7')]('c.email',_0xb8d9('0x90'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x91'),_0xb8d9('0x92'));_0x3cc52a['field'](_0xb8d9('0x93'),'Contact.mobile');_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x94'),'Contact.fax');_0x3cc52a[_0xb8d9('0x7')]('o.fullname',_0xb8d9('0x95'));_0x3cc52a[_0xb8d9('0x7')](_0xb8d9('0x96'),_0xb8d9('0x97'));_0x3cc52a[_0xb8d9('0x7')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xb8d9('0x98'));}if(_0x360b05[_0xb8d9('0x99')]){_0x3cc52a[_0xb8d9('0x99')](_0x360b05['limit']);}if(_0x360b05[_0xb8d9('0x9a')]){_0x3cc52a['offset'](_0x360b05[_0xb8d9('0x9a')]);}return db[_0xb8d9('0x76')][_0xb8d9('0x77')](_0x3cc52a[_0xb8d9('0x78')](),_0x4379ae);})[_0xb8d9('0x60')](function(_0x2e8fc1){_0x2fb1a9=_0x2e8fc1;var _0x14b570=getUsersQuery(_0x24be60,_0x2fb1a9);return db[_0xb8d9('0x76')][_0xb8d9('0x77')](_0x14b570[_0xb8d9('0x78')](),_0x4379ae);})[_0xb8d9('0x60')](function(_0x410bf8){_0x55e2eb=_['groupBy'](_0x410bf8,_0x32e58f);if(_0x24be60==='mail'){return db[_0xb8d9('0x9b')]['findOne']({'attributes':[_0xb8d9('0x9c')],'raw':!![]});}})['then'](function(_0x1db29b){var _0x1a8d14=_0x1db29b?_0x1db29b[_0xb8d9('0x9c')]:undefined;var _0x3179af=_0x2fb1a9[_0xb8d9('0x4c')](function(_0x3190f0){return updateInteraction(_0x3190f0,_0x7a813f,_0x55e2eb,_0x1a8d14);});return Promise['all'](_0x3179af);});}function countFilteredInteractions(_0x29173c,_0x3c7b28){var _0x344f10=_0x29173c[_0xb8d9('0x9d')]();_0x344f10[_0xb8d9('0x7')]('COUNT(*)');_0x344f10[_0xb8d9('0x7')](_0xb8d9('0x7b'),_0xb8d9('0x44'));var _0x3356da=utils['getSelectedTags'](_0x3c7b28);if(!_[_0xb8d9('0x9e')](_0x3356da)){_0x344f10[_0xb8d9('0x16')](_0xb8d9('0x9f'),_0x3356da);}var _0x50cb30={'type':db['Sequelize'][_0xb8d9('0xa0')][_0xb8d9('0x75')],'raw':!![]};return db[_0xb8d9('0x76')]['query'](_0x344f10[_0xb8d9('0x78')](),_0x50cb30);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 8065529..762f322 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7825=['lodash','map','fullname','split','forEach','push','waiting','talking','answered','abandoned','total','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','then','trimStart','catch','updateInteraction','Users','Tags','TagIds'];(function(_0x1d49be,_0x3ca600){var _0xac1b3f=function(_0x3eed2f){while(--_0x3eed2f){_0x1d49be['push'](_0x1d49be['shift']());}};_0xac1b3f(++_0x3ca600);}(_0x7825,0xaf));var _0x5782=function(_0xeaad17,_0xf6d4e8){_0xeaad17=_0xeaad17-0x0;var _0x2e4f6b=_0x7825[_0xeaad17];return _0x2e4f6b;};'use strict';var _=require(_0x5782('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x2049c5,_0x5721e0){return new Promise(function(_0x276945,_0x254eb9){try{var _0x597ecc=[];if(_0x5721e0[_0x2049c5]){_0x597ecc=_0x5721e0[_0x2049c5][_0x5782('0x1')](function(_0x2f267c){return{'id':_0x2f267c['id'],'fullname':_0x2f267c[_0x5782('0x2')]};});}return _0x276945(_0x597ecc);}catch(_0x5bb532){_0x254eb9(_0x5bb532);}});}function getInteractionTags(_0x3f565a,_0x142060){var _0x44a3c9=[];if(_0x3f565a){_0x3f565a[_0x5782('0x3')](',')[_0x5782('0x4')](function(_0x339624){_0x44a3c9[_0x5782('0x5')](_0x142060[_0x339624]);});}return _0x44a3c9;}function updateWaitingCounter(_0x5be6c4){if(_0x5be6c4[_0x5782('0x6')]){_0x5be6c4[_0x5782('0x6')]-=0x1;}}function updateInteractionCounters(_0xaf8a1){_0xaf8a1['waiting']=0x0;_0xaf8a1[_0x5782('0x7')]=0x0;_0xaf8a1[_0x5782('0x8')]=0x0;_0xaf8a1['unmanaged']=0x0;_0xaf8a1[_0x5782('0x9')]=0x0;_0xaf8a1[_0x5782('0xa')]=0x0;if(_0xaf8a1['closed']){if(_0xaf8a1[_0x5782('0xb')]===_0x5782('0x9')){_0xaf8a1[_0x5782('0x9')]+=0x1;updateWaitingCounter(_0xaf8a1);}if(_0xaf8a1[_0x5782('0xc')]){_0xaf8a1['answered']+=0x1;if(_0xaf8a1[_0x5782('0x7')]){_0xaf8a1[_0x5782('0x7')]-=0x1;}}else{if(_0xaf8a1[_0x5782('0xb')]){_0xaf8a1[_0x5782('0xd')]+=0x1;updateWaitingCounter(_0xaf8a1);}}}else{if(!_0xaf8a1['UserId']){_0xaf8a1['waiting']+=0x1;}if(_0xaf8a1[_0x5782('0xc')]){_0xaf8a1['talking']+=0x1;updateWaitingCounter(_0xaf8a1);}}_0xaf8a1[_0x5782('0xa')]+=0x1;return _0xaf8a1;}function getLastMessageText(_0x444511){return db[_0x5782('0xe')][_0x5782('0xf')]({'where':{'$and':[{'MailInteractionId':_0x444511['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x5782('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x5782('0x11')],'order':'-id','raw':!![]})[_0x5782('0x12')](function(_0x54745e){if(_0x54745e&&_0x54745e[_0x5782('0x11')]){_0x444511['lastMsgText']=_[_0x5782('0x13')](_0x54745e[_0x5782('0x11')]);}return _0x444511;})[_0x5782('0x14')](function(_0x4750d5){throw _0x4750d5;});}exports[_0x5782('0x15')]=function(_0x4480a5,_0x4396f8,_0x291e99,_0x550544){return new Promise(function(_0x5d3b7c,_0x210cac){return getInteractionUsers(_0x4480a5['id'],_0x291e99)[_0x5782('0x12')](function(_0x159c63){_0x4480a5[_0x5782('0x16')]=_0x159c63;return getInteractionTags(_0x4480a5['TagIds'],_0x4396f8);})[_0x5782('0x12')](function(_0x92b351){_0x4480a5[_0x5782('0x17')]=_0x92b351;delete _0x4480a5[_0x5782('0x18')];return updateInteractionCounters(_0x4480a5);})[_0x5782('0x12')](function(_0x111c73){if(_0x550544){return getLastMessageText(_0x111c73);}else{return _0x111c73;}})[_0x5782('0x12')](function(_0x4490b9){_0x5d3b7c(_0x4490b9);})[_0x5782('0x14')](function(_0x6d0ccf){_0x210cac(_0x6d0ccf);});});}; \ No newline at end of file +var _0xb8b2=['../../mysqldb','map','forEach','push','waiting','answered','unmanaged','total','closed','disposition','abandoned','UserId','talking','MailMessage','findOne','out','plainBody','-id','lastMsgText','trimStart','catch','updateInteraction','then','Users','TagIds','Tags','lodash'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb8b2,0x10d));var _0x2b8b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xb8b2[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x2b8b('0x0'));var db=require(_0x2b8b('0x1'))['db'];function getInteractionUsers(_0x5fd253,_0x47d9d5){return new Promise(function(_0x312cf7,_0x2d4862){try{var _0x204aec=[];if(_0x47d9d5[_0x5fd253]){_0x204aec=_0x47d9d5[_0x5fd253][_0x2b8b('0x2')](function(_0x4a1590){return{'id':_0x4a1590['id'],'fullname':_0x4a1590['fullname']};});}return _0x312cf7(_0x204aec);}catch(_0x54d110){_0x2d4862(_0x54d110);}});}function getInteractionTags(_0x396b4e,_0x35bf67){var _0x41821f=[];if(_0x396b4e){_0x396b4e['split'](',')[_0x2b8b('0x3')](function(_0x5dd492){_0x41821f[_0x2b8b('0x4')](_0x35bf67[_0x5dd492]);});}return _0x41821f;}function updateWaitingCounter(_0x245612){if(_0x245612[_0x2b8b('0x5')]){_0x245612[_0x2b8b('0x5')]-=0x1;}}function updateInteractionCounters(_0x374c39){_0x374c39[_0x2b8b('0x5')]=0x0;_0x374c39['talking']=0x0;_0x374c39[_0x2b8b('0x6')]=0x0;_0x374c39[_0x2b8b('0x7')]=0x0;_0x374c39['abandoned']=0x0;_0x374c39[_0x2b8b('0x8')]=0x0;if(_0x374c39[_0x2b8b('0x9')]){if(_0x374c39[_0x2b8b('0xa')]===_0x2b8b('0xb')){_0x374c39[_0x2b8b('0xb')]+=0x1;updateWaitingCounter(_0x374c39);}if(_0x374c39[_0x2b8b('0xc')]){_0x374c39[_0x2b8b('0x6')]+=0x1;if(_0x374c39[_0x2b8b('0xd')]){_0x374c39[_0x2b8b('0xd')]-=0x1;}}else{if(_0x374c39[_0x2b8b('0xa')]){_0x374c39[_0x2b8b('0x7')]+=0x1;updateWaitingCounter(_0x374c39);}}}else{if(!_0x374c39['UserId']){_0x374c39[_0x2b8b('0x5')]+=0x1;}if(_0x374c39[_0x2b8b('0xc')]){_0x374c39[_0x2b8b('0xd')]+=0x1;updateWaitingCounter(_0x374c39);}}_0x374c39[_0x2b8b('0x8')]+=0x1;return _0x374c39;}function getLastMessageText(_0x4f94ba){return db[_0x2b8b('0xe')][_0x2b8b('0xf')]({'where':{'$and':[{'MailInteractionId':_0x4f94ba['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2b8b('0x10')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x2b8b('0x11')],'order':_0x2b8b('0x12'),'raw':!![]})['then'](function(_0x2c3221){if(_0x2c3221&&_0x2c3221['plainBody']){_0x4f94ba[_0x2b8b('0x13')]=_[_0x2b8b('0x14')](_0x2c3221[_0x2b8b('0x11')]);}return _0x4f94ba;})[_0x2b8b('0x15')](function(_0x529601){throw _0x529601;});}exports[_0x2b8b('0x16')]=function(_0x53692b,_0x8a2512,_0x20f09b,_0xff53b4){return new Promise(function(_0x127dbb,_0x7b90f0){return getInteractionUsers(_0x53692b['id'],_0x20f09b)[_0x2b8b('0x17')](function(_0x545ba0){_0x53692b[_0x2b8b('0x18')]=_0x545ba0;return getInteractionTags(_0x53692b[_0x2b8b('0x19')],_0x8a2512);})[_0x2b8b('0x17')](function(_0x32a5e2){_0x53692b[_0x2b8b('0x1a')]=_0x32a5e2;delete _0x53692b[_0x2b8b('0x19')];return updateInteractionCounters(_0x53692b);})[_0x2b8b('0x17')](function(_0x43f6f9){if(_0xff53b4){return getLastMessageText(_0x43f6f9);}else{return _0x43f6f9;}})[_0x2b8b('0x17')](function(_0x271c79){_0x127dbb(_0x271c79);})[_0x2b8b('0x15')](function(_0x2e9003){_0x7b90f0(_0x2e9003);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index ecbab16..7a6de70 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3313=['catch','exports','openchannel-interactions','fax-interactions','../../config/logger','chat-interactions','whatsapp-interactions','chat','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','update','info'];(function(_0x53c2a9,_0x591554){var _0x3030a3=function(_0x120763){while(--_0x120763){_0x53c2a9['push'](_0x53c2a9['shift']());}};_0x3030a3(++_0x591554);}(_0x3313,0xec));var _0x3331=function(_0x4feaf8,_0x57df80){_0x4feaf8=_0x4feaf8-0x0;var _0x14b2ce=_0x3313[_0x4feaf8];return _0x14b2ce;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x3331('0x0')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0x3331('0x1')),'sms':require(_0x3331('0x2'))('sms-interactions'),'chat':require(_0x3331('0x2'))(_0x3331('0x3')),'whatsapp':require(_0x3331('0x2'))(_0x3331('0x4'))};function getAccountFK(_0x5e3ace){return _['capitalize'](_0x5e3ace)+(_0x5e3ace===_0x3331('0x5')?'Website':_0x3331('0x6'))+'Id';}function getInteractionFK(_0x24f413){return _['capitalize'](_0x24f413)+_0x3331('0x7');}function getInteractionId(_0x1b7705,_0x32f619,_0x125295){if(_0x1b7705&&_0x1b7705[_[_0x3331('0x8')](_0x125295)+_0x3331('0x7')]){return _0x1b7705[_[_0x3331('0x8')](_0x125295)+_0x3331('0x7')];}else if(_0x1b7705&&_0x1b7705['id']){return _0x1b7705['id'];}else if(_0x32f619&&_0x32f619['id']){return _0x32f619['id'];}else{return _0x3331('0x9');}}function getInteractionsTables(_0x561766){return{'accounts':_0x561766+'_'+(_0x561766===_0x3331('0x5')?'websites':_0x3331('0xa')),'interactions':_0x561766+_0x3331('0xb'),'interactionsTags':_0x561766+_0x3331('0xc'),'messages':_0x561766+_0x3331('0xd'),'userInteractions':_0x3331('0xe')+_0x561766+'_interactions'};}function getSelectedTags(_0x371b04){var _0x86fe53=[];if(_0x371b04){_0x86fe53=Array['isArray'](_0x371b04)?_0x371b04:[_0x371b04];}return _0x86fe53;}function log(_0x4e6ce8,_0x51c66a,_0x97b6ca,_0x2e9d50,_0xae020b,_0x3e0c99){loggers[_0xae020b['toLowerCase']()][_0x4e6ce8](_0x3331('0xf'),_0x3e0c99[_0x3331('0x10')](),_0x51c66a?_0x51c66a['id']:null,_0x51c66a?_0x51c66a['name']:null,_0x51c66a?_0x51c66a['role']:null,getInteractionId(_0x97b6ca,_0x2e9d50,_0xae020b),_0x97b6ca?JSON[_0x3331('0x11')](_0x97b6ca):_0x3331('0x12'));}function updateUser(_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441){db[_[_0x3331('0x8')](_0x4737d0)+_0x3331('0x13')][_0x3331('0x14')]({'where':{'id':getInteractionId(_0x31e878,_0x1c35dc,_0x4737d0)}})[_0x3331('0x15')](function(_0x475082){if(_0x475082){return _0x475082[_0x3331('0x16')]({'UserId':_0x212ef3?_0x212ef3['id']:null});}})['then'](function(_0x442b4d){if(_0x442b4d){log(_0x3331('0x17'),_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441);}})[_0x3331('0x18')](function(){log('error',_0x212ef3,_0x31e878,_0x1c35dc,_0x4737d0,_0x47a441);});}module[_0x3331('0x19')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xb005=['chat-interactions','whatsapp-interactions','chat','Website','Account','InteractionId','upperFirst','unknown','websites','_interactions','_interaction_has_tags','_messages','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','null','findOne','then','info','catch','error','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions'];(function(_0x49b74e,_0x2ef48f){var _0x147152=function(_0x952a16){while(--_0x952a16){_0x49b74e['push'](_0x49b74e['shift']());}};_0x147152(++_0x2ef48f);}(_0xb005,0x11b));var _0x5b00=function(_0xeb0441,_0x35b80e){_0xeb0441=_0xeb0441-0x0;var _0x18c738=_0xb005[_0xeb0441];return _0x18c738;};'use strict';var _=require(_0x5b00('0x0'));var db=require(_0x5b00('0x1'))['db'];var loggers={'openchannel':require(_0x5b00('0x2'))(_0x5b00('0x3')),'mail':require('../../config/logger')(_0x5b00('0x4')),'fax':require(_0x5b00('0x2'))(_0x5b00('0x5')),'sms':require(_0x5b00('0x2'))(_0x5b00('0x6')),'chat':require('../../config/logger')(_0x5b00('0x7')),'whatsapp':require(_0x5b00('0x2'))(_0x5b00('0x8'))};function getAccountFK(_0x2375c0){return _['capitalize'](_0x2375c0)+(_0x2375c0===_0x5b00('0x9')?_0x5b00('0xa'):_0x5b00('0xb'))+'Id';}function getInteractionFK(_0x132b9e){return _['capitalize'](_0x132b9e)+_0x5b00('0xc');}function getInteractionId(_0xaaaf3a,_0x5e4583,_0x4eba03){if(_0xaaaf3a&&_0xaaaf3a[_['upperFirst'](_0x4eba03)+_0x5b00('0xc')]){return _0xaaaf3a[_[_0x5b00('0xd')](_0x4eba03)+'InteractionId'];}else if(_0xaaaf3a&&_0xaaaf3a['id']){return _0xaaaf3a['id'];}else if(_0x5e4583&&_0x5e4583['id']){return _0x5e4583['id'];}else{return _0x5b00('0xe');}}function getInteractionsTables(_0x3721dd){return{'accounts':_0x3721dd+'_'+(_0x3721dd===_0x5b00('0x9')?_0x5b00('0xf'):'accounts'),'interactions':_0x3721dd+_0x5b00('0x10'),'interactionsTags':_0x3721dd+_0x5b00('0x11'),'messages':_0x3721dd+_0x5b00('0x12'),'userInteractions':'user_has_'+_0x3721dd+_0x5b00('0x10')};}function getSelectedTags(_0x52d7e9){var _0x273cec=[];if(_0x52d7e9){_0x273cec=Array[_0x5b00('0x13')](_0x52d7e9)?_0x52d7e9:[_0x52d7e9];}return _0x273cec;}function log(_0x1c3490,_0x40272a,_0x3fb08f,_0x2f00ca,_0x725e88,_0x4312cd){loggers[_0x725e88['toLowerCase']()][_0x1c3490](_0x5b00('0x14'),_0x4312cd[_0x5b00('0x15')](),_0x40272a?_0x40272a['id']:null,_0x40272a?_0x40272a[_0x5b00('0x16')]:null,_0x40272a?_0x40272a['role']:null,getInteractionId(_0x3fb08f,_0x2f00ca,_0x725e88),_0x3fb08f?JSON['stringify'](_0x3fb08f):_0x5b00('0x17'));}function updateUser(_0x195d38,_0x44c26b,_0x11553c,_0x1c5f66,_0x591b34){db[_['upperFirst'](_0x1c5f66)+'Interaction'][_0x5b00('0x18')]({'where':{'id':getInteractionId(_0x44c26b,_0x11553c,_0x1c5f66)}})[_0x5b00('0x19')](function(_0x674ec6){if(_0x674ec6){return _0x674ec6['update']({'UserId':_0x195d38?_0x195d38['id']:null});}})[_0x5b00('0x19')](function(_0x4cf1b5){if(_0x4cf1b5){log(_0x5b00('0x1a'),_0x195d38,_0x44c26b,_0x11553c,_0x1c5f66,_0x591b34);}})[_0x5b00('0x1b')](function(){log(_0x5b00('0x1c'),_0x195d38,_0x44c26b,_0x11553c,_0x1c5f66,_0x591b34);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0c1c1ec..97910f3 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 _0x0e03=['license','split','aes-256-ctr','format','utf8','parse','hasOwnProperty','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit','crypto','util','composable-middleware','../../mysqldb','data1'];(function(_0xfe1386,_0x4cf0d4){var _0x42b267=function(_0x43e869){while(--_0x43e869){_0xfe1386['push'](_0xfe1386['shift']());}};_0x42b267(++_0x4cf0d4);}(_0x0e03,0x1c7));var _0x30e0=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0x0e03[_0x100682];return _0xcb6e87;};'use strict';var crypto=require(_0x30e0('0x0'));var util=require(_0x30e0('0x1'));var compose=require(_0x30e0('0x2'));var db=require(_0x30e0('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x3a05b3,_0x400c21){if(_0x3a05b3&&_0x400c21){if(_0x400c21[_0x30e0('0x4')]&&_0x400c21[_0x30e0('0x5')]){var _0x548490=_0x400c21[_0x30e0('0x4')];var _0x2ec19d=_0x400c21['license'];var _0x321915=_0x548490[_0x30e0('0x6')]('-')[0x4];var _0x559f6b=_0x548490[_0x30e0('0x6')]('-')[0x0];var _0x342bf2=crypto['createDecipher'](_0x30e0('0x7'),util[_0x30e0('0x8')]('%s:%s:%s',_0x321915,_0x548490,_0x559f6b));var _0x5a5e83=_0x342bf2['update'](_0x2ec19d,'base64',_0x30e0('0x9'));_0x5a5e83+=_0x342bf2['final']('utf8');var _0x8c5a9a=JSON[_0x30e0('0xa')](_0x5a5e83);return _0x8c5a9a[_0x30e0('0xb')](_0x3a05b3)?_0x8c5a9a[_0x3a05b3]:null;}}return null;}function isLimit(_0x131bf3,_0x46cbfd,_0xd073e7,_0x3ac18b){var _0x1587fb=_0x46cbfd;return compose()['use'](function(_0x517631,_0x12eda7,_0x12494a){return db[_0x30e0('0xc')][_0x30e0('0xd')]({'where':{'id':0x1},'raw':!![]})[_0x30e0('0xe')](function(_0x2798d5){var _0x14ca70=getValueFromLicense(_0x131bf3,_0x2798d5);return _0x14ca70?_0x14ca70:_0x1587fb;})[_0x30e0('0xe')](function(_0x1ee8d1){_0x1587fb=_0x1ee8d1;return _0xd073e7[_0x30e0('0xf')](_0x3ac18b);})[_0x30e0('0xe')](function(_0x4234c3){if(_0x4234c3>=_0x1587fb){return _0x12eda7[_0x30e0('0x10')](0x193)[_0x30e0('0x11')]({'message':util['format'](_0x30e0('0x12'),_0x131bf3)});}_0x12494a();})['catch'](function(_0x16fa97){_0x12494a(_0x16fa97);});});}function isUserLimit(){return isLimit(_0x30e0('0x13'),0x1,db[_0x30e0('0x14')],{'where':{'$or':[{'role':_0x30e0('0x15')},{'role':'user'}]}});}exports[_0x30e0('0x16')]=isUserLimit; \ No newline at end of file +var _0x33db=['Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','base64','final','utf8','parse','use','License','findOne','then','status'];(function(_0x512741,_0x3ef347){var _0x1d1b36=function(_0x51af68){while(--_0x51af68){_0x512741['push'](_0x512741['shift']());}};_0x1d1b36(++_0x3ef347);}(_0x33db,0x17c));var _0xb33d=function(_0x2d2ca2,_0x51873f){_0x2d2ca2=_0x2d2ca2-0x0;var _0x48489d=_0x33db[_0x2d2ca2];return _0x48489d;};'use strict';var crypto=require(_0xb33d('0x0'));var util=require(_0xb33d('0x1'));var compose=require(_0xb33d('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xb33d('0x3'));function getValueFromLicense(_0x4628b5,_0x388acd){if(_0x4628b5&&_0x388acd){if(_0x388acd['data1']&&_0x388acd[_0xb33d('0x4')]){var _0x14e046=_0x388acd[_0xb33d('0x5')];var _0x50d16f=_0x388acd['license'];var _0x433632=_0x14e046['split']('-')[0x4];var _0x1ac59e=_0x14e046[_0xb33d('0x6')]('-')[0x0];var _0x51464c=crypto[_0xb33d('0x7')](_0xb33d('0x8'),util[_0xb33d('0x9')](_0xb33d('0xa'),_0x433632,_0x14e046,_0x1ac59e));var _0x47872b=_0x51464c['update'](_0x50d16f,_0xb33d('0xb'),'utf8');_0x47872b+=_0x51464c[_0xb33d('0xc')](_0xb33d('0xd'));var _0x4d0683=JSON[_0xb33d('0xe')](_0x47872b);return _0x4d0683['hasOwnProperty'](_0x4628b5)?_0x4d0683[_0x4628b5]:null;}}return null;}function isLimit(_0x2c152b,_0x4e6b3d,_0xbdc77,_0xf5e14c){var _0x1fb4dc=_0x4e6b3d;return compose()[_0xb33d('0xf')](function(_0x47a984,_0x589eed,_0x64ced1){return db[_0xb33d('0x10')][_0xb33d('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xb33d('0x12')](function(_0x2177d3){var _0x134b10=getValueFromLicense(_0x2c152b,_0x2177d3);return _0x134b10?_0x134b10:_0x1fb4dc;})[_0xb33d('0x12')](function(_0x231c18){_0x1fb4dc=_0x231c18;return _0xbdc77['count'](_0xf5e14c);})[_0xb33d('0x12')](function(_0x1e0f93){if(_0x1e0f93>=_0x1fb4dc){return _0x589eed[_0xb33d('0x13')](0x193)['json']({'message':util['format'](_0xb33d('0x14'),_0x2c152b)});}_0x64ced1();})['catch'](function(_0x37efc7){_0x64ced1(_0x37efc7);});});}function isUserLimit(){return isLimit(_0xb33d('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xb33d('0x16')},{'role':_0xb33d('0x17')}]}});}exports[_0xb33d('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c77eae2..e05557f 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 _0xbe4d=['=\x20?','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$in','start','$substring','pop','hours','minutes','seconds','moment','sqlOperator','[$or]','and','replace','[$and]','length','split','forEach','shift','match','filter','indexOf','map','DATE','$eq','operator','includes','$gt','$lte','value','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?'];(function(_0x197b67,_0x1b1dd7){var _0x5700d3=function(_0x45aa99){while(--_0x45aa99){_0x197b67['push'](_0x197b67['shift']());}};_0x5700d3(++_0x1b1dd7);}(_0xbe4d,0xdd));var _0xdbe4=function(_0x2855bf,_0x5654d4){_0x2855bf=_0x2855bf-0x0;var _0x2e9f48=_0xbe4d[_0x2855bf];return _0x2e9f48;};'use strict';var _=require('lodash');var moment=require(_0xdbe4('0x0'));exports['parseSearch']=function(_0x2b266f){var _0x44bd7d={'conditions':[]};_0x44bd7d[_0xdbe4('0x1')]=_['startsWith'](_0x2b266f,_0xdbe4('0x2'))?'or':_0xdbe4('0x3');var _0x1fb303=_0x2b266f[_0xdbe4('0x4')](_0xdbe4('0x5'),'')['replace'](_0xdbe4('0x2'),'')['split']('||');for(var _0x2b7577=0x0;_0x2b7577<_0x1fb303[_0xdbe4('0x6')];_0x2b7577++){var _0x334864=_0x1fb303[_0x2b7577][_0xdbe4('0x7')](':=');var _0x4ed147=_0x334864[0x0];var _0x2efc58=_0x334864['slice'](0x1);_0x2efc58[_0xdbe4('0x8')](function(_0x4d061c){var _0x2b7d81=_0x4d061c[_0xdbe4('0x7')]('[')[_0xdbe4('0x9')]();var _0x4a54bd=_0x4d061c[_0xdbe4('0xa')](/\[(.*?)\]/g);_0x4a54bd[_0xdbe4('0x8')](function(_0x42da21){var _0x5cd0e7=_0x42da21[_0xdbe4('0x7')]('[')[_0xdbe4('0xb')](function(_0x23966e){return _0x23966e[_0xdbe4('0xc')](']')>-0x1;})[_0xdbe4('0xd')](function(_0x58ea31){return _0x58ea31['split'](']')[0x0];})[0x0];_0x44bd7d['conditions']['push']({'field':_0x4ed147,'operator':_0x2b7d81,'value':_0x5cd0e7});});});}return _0x44bd7d;};exports['buildExpression']=function(_0x38496b,_0x24dcbf,_0x39fe7f){var _0x18a77f={};if(_0x24dcbf===_0xdbe4('0xe')){if(_0x39fe7f['operator']===_0xdbe4('0xf')){_0x39fe7f[_0xdbe4('0x10')]='$between';_0x39fe7f['value']+=','+_0x39fe7f['value'];}else if(_[_0xdbe4('0x11')]([_0xdbe4('0x12'),_0xdbe4('0x13')],_0x39fe7f[_0xdbe4('0x10')])){_0x39fe7f[_0xdbe4('0x14')]=moment(_0x39fe7f[_0xdbe4('0x14')])[_0xdbe4('0x15')](0x1,'days')[_0xdbe4('0x16')](_0xdbe4('0x17'));}}if(_0x39fe7f[_0xdbe4('0x18')]){_0x24dcbf=_0x39fe7f[_0xdbe4('0x18')];_0x18a77f[_0xdbe4('0x19')]=_0xdbe4('0x1a')+_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+'\x20AS\x20'+_0x39fe7f['castTo']+')\x20'+parseOperator(_0x39fe7f['operator']);}else{_0x18a77f[_0xdbe4('0x19')]=_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+'\x20'+parseOperator(_0x39fe7f['operator']);}if(_['includes']([_0xdbe4('0x1c'),_0xdbe4('0x1d')],_0x39fe7f[_0xdbe4('0x10')]))_0x18a77f[_0xdbe4('0x19')]='('+_0x18a77f[_0xdbe4('0x19')]+_0xdbe4('0x1e')+_0x38496b+'.'+_0x39fe7f[_0xdbe4('0x1b')]+_0xdbe4('0x1f');_0x18a77f[_0xdbe4('0x14')]=parseValue(_0x24dcbf,_0x39fe7f[_0xdbe4('0x10')],_0x39fe7f[_0xdbe4('0x14')]);return _0x18a77f;};function parseOperator(_0xfd855c){var _0x13e327;switch(_0xfd855c){case'$in':_0x13e327=_0xdbe4('0x20');break;case _0xdbe4('0x1d'):_0x13e327=_0xdbe4('0x21');break;case'$eq':_0x13e327=_0xdbe4('0x22');break;case'$ne':_0x13e327=_0xdbe4('0x23');break;case'$substring':case _0xdbe4('0x24'):case _0xdbe4('0x25'):_0x13e327='LIKE\x20?';break;case _0xdbe4('0x26'):_0x13e327=_0xdbe4('0x27');break;case _0xdbe4('0x12'):_0x13e327=_0xdbe4('0x28');break;case _0xdbe4('0x13'):_0x13e327=_0xdbe4('0x29');break;case _0xdbe4('0x2a'):_0x13e327=_0xdbe4('0x2b');break;case'$between':_0x13e327='BETWEEN\x20?\x20AND\x20?';break;}return _0x13e327;}function parseValue(_0x1850ed,_0x42047e,_0x40e422){var _0x2f41f1={'start':undefined,'end':undefined};switch(_0x42047e){case _0xdbe4('0x2c'):case _0xdbe4('0x1d'):_0x2f41f1[_0xdbe4('0x2d')]=_0x40e422[_0xdbe4('0x7')](',');break;case _0xdbe4('0x2e'):_0x2f41f1[_0xdbe4('0x2d')]='%'+_0x40e422+'%';break;case'$startsWith':_0x2f41f1[_0xdbe4('0x2d')]=_0x40e422+'%';break;case _0xdbe4('0x25'):_0x2f41f1[_0xdbe4('0x2d')]='%'+_0x40e422;break;case'$between':var _0x2100be=_0x40e422[_0xdbe4('0x7')](',');var _0x40e422=_0x2100be[_0xdbe4('0x9')]();var _0x598bdf=_0x2100be[_0xdbe4('0x2f')]();if(_0x1850ed===_0xdbe4('0xe')){_0x40e422=moment(_0x40e422)['utcOffset'](0x0,!![])[_0xdbe4('0x16')]();_0x598bdf=moment(_0x598bdf)['utcOffset'](0x0,!![])[_0xdbe4('0x15')](0x17,_0xdbe4('0x30'))[_0xdbe4('0x15')](0x3b,_0xdbe4('0x31'))['add'](0x3b,_0xdbe4('0x32'))[_0xdbe4('0x16')]();}_0x2f41f1={'start':_0x40e422,'end':_0x598bdf};break;default:_0x2f41f1['start']=_0x40e422;break;}return _0x2f41f1;} \ No newline at end of file +var _0xcd9c=['$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start','$endsWith','shift','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','[$or]','replace','[$and]','split','length','forEach','match','indexOf','map','conditions','buildExpression','DATE','$eq','operator','$between','value','$gt','$lte','add','days','format','castTo','CAST(','field','\x20AS\x20','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','NOT\x20IN\x20?','=\x20?'];(function(_0x2c009e,_0x3ff7ae){var _0x3ac8c2=function(_0x6c702d){while(--_0x6c702d){_0x2c009e['push'](_0x2c009e['shift']());}};_0x3ac8c2(++_0x3ff7ae);}(_0xcd9c,0x1c3));var _0xccd9=function(_0x53eaec,_0x12a060){_0x53eaec=_0x53eaec-0x0;var _0x50a35f=_0xcd9c[_0x53eaec];return _0x50a35f;};'use strict';var _=require(_0xccd9('0x0'));var moment=require('moment');exports[_0xccd9('0x1')]=function(_0x5b897b){var _0x1ac232={'conditions':[]};_0x1ac232[_0xccd9('0x2')]=_['startsWith'](_0x5b897b,_0xccd9('0x3'))?'or':'and';var _0x510589=_0x5b897b[_0xccd9('0x4')](_0xccd9('0x5'),'')[_0xccd9('0x4')](_0xccd9('0x3'),'')[_0xccd9('0x6')]('||');for(var _0x3ddacc=0x0;_0x3ddacc<_0x510589[_0xccd9('0x7')];_0x3ddacc++){var _0x354cfd=_0x510589[_0x3ddacc][_0xccd9('0x6')](':=');var _0x27e87f=_0x354cfd[0x0];var _0x3252f3=_0x354cfd['slice'](0x1);_0x3252f3[_0xccd9('0x8')](function(_0x43f780){var _0xa0314b=_0x43f780[_0xccd9('0x6')]('[')['shift']();var _0x1db970=_0x43f780[_0xccd9('0x9')](/\[(.*?)\]/g);_0x1db970['forEach'](function(_0x671d78){var _0x556924=_0x671d78[_0xccd9('0x6')]('[')['filter'](function(_0x1f7842){return _0x1f7842[_0xccd9('0xa')](']')>-0x1;})[_0xccd9('0xb')](function(_0xbc4f4a){return _0xbc4f4a[_0xccd9('0x6')](']')[0x0];})[0x0];_0x1ac232[_0xccd9('0xc')]['push']({'field':_0x27e87f,'operator':_0xa0314b,'value':_0x556924});});});}return _0x1ac232;};exports[_0xccd9('0xd')]=function(_0x144585,_0xbcd533,_0x1d777a){var _0x32ac7e={};if(_0xbcd533===_0xccd9('0xe')){if(_0x1d777a['operator']===_0xccd9('0xf')){_0x1d777a[_0xccd9('0x10')]=_0xccd9('0x11');_0x1d777a[_0xccd9('0x12')]+=','+_0x1d777a[_0xccd9('0x12')];}else if(_['includes']([_0xccd9('0x13'),_0xccd9('0x14')],_0x1d777a[_0xccd9('0x10')])){_0x1d777a[_0xccd9('0x12')]=moment(_0x1d777a[_0xccd9('0x12')])[_0xccd9('0x15')](0x1,_0xccd9('0x16'))[_0xccd9('0x17')]('YYYY-MM-DD');}}if(_0x1d777a[_0xccd9('0x18')]){_0xbcd533=_0x1d777a[_0xccd9('0x18')];_0x32ac7e['text']=_0xccd9('0x19')+_0x144585+'.'+_0x1d777a[_0xccd9('0x1a')]+_0xccd9('0x1b')+_0x1d777a[_0xccd9('0x18')]+')\x20'+parseOperator(_0x1d777a[_0xccd9('0x10')]);}else{_0x32ac7e[_0xccd9('0x1c')]=_0x144585+'.'+_0x1d777a[_0xccd9('0x1a')]+'\x20'+parseOperator(_0x1d777a[_0xccd9('0x10')]);}if(_['includes']([_0xccd9('0x1d'),'$notIn'],_0x1d777a[_0xccd9('0x10')]))_0x32ac7e[_0xccd9('0x1c')]='('+_0x32ac7e['text']+_0xccd9('0x1e')+_0x144585+'.'+_0x1d777a['field']+_0xccd9('0x1f');_0x32ac7e['value']=parseValue(_0xbcd533,_0x1d777a[_0xccd9('0x10')],_0x1d777a[_0xccd9('0x12')]);return _0x32ac7e;};function parseOperator(_0x479c78){var _0x16ba35;switch(_0x479c78){case _0xccd9('0x20'):_0x16ba35='IN\x20?';break;case'$notIn':_0x16ba35=_0xccd9('0x21');break;case'$eq':_0x16ba35=_0xccd9('0x22');break;case _0xccd9('0x1d'):_0x16ba35='<>\x20?';break;case _0xccd9('0x23'):case _0xccd9('0x24'):case'$endsWith':_0x16ba35=_0xccd9('0x25');break;case _0xccd9('0x26'):_0x16ba35=_0xccd9('0x27');break;case _0xccd9('0x13'):_0x16ba35=_0xccd9('0x28');break;case _0xccd9('0x14'):_0x16ba35=_0xccd9('0x29');break;case _0xccd9('0x2a'):_0x16ba35=_0xccd9('0x2b');break;case _0xccd9('0x11'):_0x16ba35=_0xccd9('0x2c');break;}return _0x16ba35;}function parseValue(_0x435525,_0x2c32e1,_0x241449){var _0x263241={'start':undefined,'end':undefined};switch(_0x2c32e1){case _0xccd9('0x20'):case _0xccd9('0x2d'):_0x263241[_0xccd9('0x2e')]=_0x241449['split'](',');break;case _0xccd9('0x23'):_0x263241[_0xccd9('0x2e')]='%'+_0x241449+'%';break;case _0xccd9('0x24'):_0x263241['start']=_0x241449+'%';break;case _0xccd9('0x2f'):_0x263241[_0xccd9('0x2e')]='%'+_0x241449;break;case _0xccd9('0x11'):var _0x160765=_0x241449[_0xccd9('0x6')](',');var _0x241449=_0x160765[_0xccd9('0x30')]();var _0x33fd4c=_0x160765[_0xccd9('0x31')]();if(_0x435525===_0xccd9('0xe')){_0x241449=moment(_0x241449)[_0xccd9('0x32')](0x0,!![])[_0xccd9('0x17')]();_0x33fd4c=moment(_0x33fd4c)[_0xccd9('0x32')](0x0,!![])[_0xccd9('0x15')](0x17,_0xccd9('0x33'))[_0xccd9('0x15')](0x3b,_0xccd9('0x34'))[_0xccd9('0x15')](0x3b,_0xccd9('0x35'))['format']();}_0x263241={'start':_0x241449,'end':_0x33fd4c};break;default:_0x263241[_0xccd9('0x2e')]=_0x241449;break;}return _0x263241;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 02c644b..8eaed13 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 _0x723e=['order','sort','where','pick','filter','object','value','VIRTUAL','lower','merge','options','sequelize','moment','parse','keys','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','utc','format','$lte','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','offset','map','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','forEach','push','join','getOptions','query','$id','model','intersection','attributes','nolimit'];(function(_0x262b75,_0x4c979c){var _0x3504b3=function(_0x542ef4){while(--_0x542ef4){_0x262b75['push'](_0x262b75['shift']());}};_0x3504b3(++_0x4c979c);}(_0x723e,0x179));var _0xe723=function(_0x18e847,_0x255dbf){_0x18e847=_0x18e847-0x0;var _0x1c4f5d=_0x723e[_0x18e847];return _0x1c4f5d;};'use strict';var _=require('lodash');var sequelize=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x21d00c){var _0x161d6b=['ne'];try{var _0x2801c5=JSON[_0xe723('0x2')](_0x21d00c);var _0x39e35c=Object[_0xe723('0x3')](_0x2801c5)[0x0];return _0x161d6b[_0xe723('0x4')](_0x39e35c);}catch(_0x10aa61){return![];}}function getOperatorValue(_0x4b1c43){var _0x32d689=JSON[_0xe723('0x2')](_0x4b1c43);var _0x1335cd=Object[_0xe723('0x3')](_0x32d689)[0x0];var _0x2aebbd=_0x32d689[_0x1335cd];return{['$'+_0x1335cd]:_0x2aebbd};}exports[_0xe723('0x5')]=function(_0x1b46e0){var _0x1f07f3=null;if(_0x1b46e0){_0x1f07f3=_0x1b46e0['split'](',');}return _0x1f07f3;};exports[_0xe723('0x6')]=function(_0x270346,_0x34831f){var _0x5a43fb={};if(!_[_0xe723('0x7')](_0x270346)){_[_0xe723('0x8')](_0x270346,function(_0xcf68e2,_0x583291){try{if(_0x34831f){var _0x146098=_[_0xe723('0x9')](_0x34831f,{'name':_0x583291})||{};if(hasSequelizeOperator(_0xcf68e2)){_0x5a43fb[_0x583291]=getOperatorValue(_0xcf68e2);}else if(_0x146098[_0xe723('0xa')]===_0xe723('0xb')&&_[_0xe723('0xc')](_0xcf68e2)){var _0x5c066c=JSON[_0xe723('0x2')](_0xcf68e2);var _0x4bfbc1={'$gte':moment(moment(_0x5c066c['$gte'])['format']('YYYY-MM-DD'))[_0xe723('0xd')]()[_0xe723('0xe')](),'$lte':moment(moment(_0x5c066c[_0xe723('0xf')])[_0xe723('0xe')](_0xe723('0x10')))['utc']()[_0xe723('0x11')](0x1,'s')[_0xe723('0xe')]()};_0x5a43fb[_0x583291]=_0x4bfbc1;}else if(_0x146098[_0xe723('0x12')]===_0xe723('0x13')){_0x5a43fb[_0x583291]=_0xcf68e2;}else{_0x5a43fb[_0x583291]=_[_0xe723('0x14')](_0xcf68e2)?_0xcf68e2:JSON[_0xe723('0x2')](_0xcf68e2);}}else{_0x5a43fb[_0x583291]=_[_0xe723('0x14')](_0xcf68e2)?_0xcf68e2:JSON[_0xe723('0x2')](_0xcf68e2);}}catch(_0x17e2c1){_0x5a43fb[_0x583291]=_0xcf68e2[_0xe723('0x15')](',');}});}return _0x5a43fb;};exports[_0xe723('0x16')]=function(_0x3012cf){_0x3012cf=parseInt(_0x3012cf,0xa);if(!_0x3012cf||_0x3012cf<0x0){_0x3012cf=LIMIT_VALUE;}return _0x3012cf;};exports[_0xe723('0x17')]=function(_0x367782){_0x367782=parseInt(_0x367782,0xa);if(!_0x367782||_0x367782<0x0){_0x367782=0x0;}return _0x367782;};exports['sort']=function(_0x5b2308){var _0x31c839,_0x1ed6fb=null;if(_0x5b2308){_0x31c839=_0x5b2308['split'](',');_0x1ed6fb=_[_0xe723('0x18')](_0x31c839,function(_0x2762e2){if(_0x2762e2['indexOf']('-')===0x0){return[_0x2762e2===_0xe723('0x19')?sequelize['cast'](sequelize[_0xe723('0x1a')](_0xe723('0x19')),_0xe723('0x1b')):_0x2762e2[_0xe723('0x1c')](0x1),_0xe723('0x1d')];}else{return[_0x2762e2===_0xe723('0x19')?sequelize[_0xe723('0x1e')](sequelize[_0xe723('0x1a')](_0xe723('0x19')),_0xe723('0x1b')):_0x2762e2,_0xe723('0x1f')];}});}return _0x1ed6fb;};exports[_0xe723('0x20')]=function(_0x5c4fb4,_0x384786){if(_['isEmpty'](_0x5c4fb4)){return _0x5c4fb4;}if(_[_0xe723('0x14')](_0x5c4fb4)){for(var _0x3ffa15=0x0;_0x3ffa15<_0x5c4fb4[_0xe723('0x21')];_0x3ffa15+=0x1){_0x5c4fb4[_0x3ffa15]=this[_0xe723('0x20')](_0x5c4fb4[_0x3ffa15],_0x384786);}return _0x5c4fb4;}if(!_[_0xe723('0x22')](_0x5c4fb4)){return _0x5c4fb4;}if(_['isString'](_0x384786)){_0x384786=[_0x384786];}if(!_[_0xe723('0x14')](_0x384786)){return _0x5c4fb4;}for(var _0x52feb9=0x0;_0x52feb9<_0x384786['length'];_0x52feb9+=0x1){_[_0xe723('0x23')](_0x5c4fb4,_0x384786[_0x52feb9]);}for(var _0x511c74 in _0x5c4fb4){if(_0x5c4fb4[_0xe723('0x24')](_0x511c74)){_0x5c4fb4[_0x511c74]=this[_0xe723('0x20')](_0x5c4fb4[_0x511c74],_0x384786);}}return _0x5c4fb4;};exports[_0xe723('0x25')]=function(_0x4d55cc){return _0x4d55cc[_0xe723('0x26')](RegExp(_0xe723('0x27')))?!![]:![];};exports['isEmail']=function(_0x3c8c56){return _0x3c8c56['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x312dc9){var _0x2c2240=[];_0x312dc9[_0xe723('0x15')](/[ ,]+/)[_0xe723('0x28')](function(_0x49788a){_0x49788a=_0x49788a['replace'](/([^:]")"+/g,'$1');_0x49788a='+'+_0x49788a+'*';var _0x1d1146=/[ `!@#$%^&*()_\-?~]/;if(_0x49788a['match'](_0x1d1146))_0x49788a='\x22'+_0x49788a+'\x22';_0x2c2240[_0xe723('0x29')](_0x49788a);});return _0x2c2240[_0xe723('0x2a')]('\x20');};exports[_0xe723('0x2b')]=function(_0xb91a9c,_0x8ced18,_0x26497e){var _0x4706d4={},_0x163549={};if(_0x8ced18[_0xe723('0x2c')][_0xe723('0x2d')]){_0x8ced18[_0xe723('0x2c')]['id']=_0x8ced18[_0xe723('0x2c')][_0xe723('0x2d')];delete _0x8ced18[_0xe723('0x2c')]['$id'];}_0x4706d4[_0xe723('0x2e')]=_['map'](_0xb91a9c,_0xe723('0x12'));_0x4706d4[_0xe723('0x2c')]=_['keys'](_0x8ced18['query']);_0x4706d4[_0xe723('0x6')]=_[_0xe723('0x2f')](_0x4706d4[_0xe723('0x2e')],_0x4706d4[_0xe723('0x2c')]);_0x163549[_0xe723('0x30')]=_[_0xe723('0x2f')](_0x4706d4['model'],this[_0xe723('0x5')](_0x8ced18[_0xe723('0x2c')][_0xe723('0x5')]));_0x163549[_0xe723('0x30')]=_0x163549[_0xe723('0x30')][_0xe723('0x21')]?_0x163549[_0xe723('0x30')]:_0x4706d4[_0xe723('0x2e')];if(!_0x8ced18[_0xe723('0x2c')][_0xe723('0x24')](_0xe723('0x31'))){_0x163549[_0xe723('0x16')]=this[_0xe723('0x16')](_0x8ced18[_0xe723('0x2c')][_0xe723('0x16')]);_0x163549[_0xe723('0x17')]=this['offset'](_0x8ced18[_0xe723('0x2c')][_0xe723('0x17')]);}_0x163549[_0xe723('0x32')]=this[_0xe723('0x33')](_0x8ced18['query']['sort']);_0x163549[_0xe723('0x34')]=this[_0xe723('0x6')](_[_0xe723('0x35')](_0x8ced18[_0xe723('0x2c')],_0x4706d4['filters']),_0xb91a9c);if(_0x8ced18['query'][_0xe723('0x36')]){var _0x2f1618=_0xb91a9c;var _0x24909=_0x8ced18[_0xe723('0x2c')][_0xe723('0x36')];if(typeof _0x24909===_0xe723('0x37')){_0x2f1618=_[_0xe723('0x36')](_0xb91a9c,function(_0x2b74d5){return _[_0xe723('0x4')](_0x24909['columns'],_0x2b74d5['name']);});_0x24909=_0x24909[_0xe723('0x38')];}_0x163549['where']=_['merge'](_0x163549[_0xe723('0x34')],{'$or':_['map'](_0x2f1618,function(_0x36272){if(_0x36272[_0xe723('0xa')]!==_0xe723('0x39')){if(_0x26497e){return sequelize[_0xe723('0x34')](sequelize['fn'](_0xe723('0x3a'),sequelize[_0xe723('0x1a')](_0x36272[_0xe723('0x12')])),{'$like':sequelize['fn']('lower','%'+_0x8ced18['query'][_0xe723('0x36')]+'%')});}else{var _0x562583={};_0x562583[_0x36272[_0xe723('0x12')]]={'$like':'%'+_0x8ced18['query'][_0xe723('0x36')]+'%'};return _0x562583;}}})});}_0x163549=_[_0xe723('0x3b')]({},_0x163549,_0x8ced18[_0xe723('0x3c')]);return _0x163549;}; \ No newline at end of file +var _0x0faf=['value','where','merge','VIRTUAL','lower','options','lodash','moment','parse','keys','includes','isEmpty','forOwn','type','isPlainObject','$gte','utc','$lte','format','YYYY-MM-DD','subtract','name','uniqueid','isArray','split','limit','sort','map','indexOf','priority','cast','unsigned','substr','DESC','col','omit','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','forEach','replace','push','query','$id','model','filters','intersection','attributes','fields','length','offset','order','pick','filter','object','columns'];(function(_0x2c749d,_0x23d56d){var _0x28e3bf=function(_0x360e6d){while(--_0x360e6d){_0x2c749d['push'](_0x2c749d['shift']());}};_0x28e3bf(++_0x23d56d);}(_0x0faf,0x132));var _0xf0fa=function(_0xc20f22,_0x49698f){_0xc20f22=_0xc20f22-0x0;var _0x1535d5=_0x0faf[_0xc20f22];return _0x1535d5;};'use strict';var _=require(_0xf0fa('0x0'));var sequelize=require('sequelize');var moment=require(_0xf0fa('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x1b4763){var _0x2c6207=['ne'];try{var _0x35a260=JSON[_0xf0fa('0x2')](_0x1b4763);var _0xdc9ce3=Object[_0xf0fa('0x3')](_0x35a260)[0x0];return _0x2c6207[_0xf0fa('0x4')](_0xdc9ce3);}catch(_0x283f04){return![];}}function getOperatorValue(_0x5d9b58){var _0x3637a3=JSON[_0xf0fa('0x2')](_0x5d9b58);var _0x25b5c4=Object[_0xf0fa('0x3')](_0x3637a3)[0x0];var _0x2db1d9=_0x3637a3[_0x25b5c4];return{['$'+_0x25b5c4]:_0x2db1d9};}exports['fields']=function(_0x42f7fd){var _0x18db40=null;if(_0x42f7fd){_0x18db40=_0x42f7fd['split'](',');}return _0x18db40;};exports['filters']=function(_0x3bda51,_0x1e8cc0){var _0x25dfec={};if(!_[_0xf0fa('0x5')](_0x3bda51)){_[_0xf0fa('0x6')](_0x3bda51,function(_0x1151ea,_0x379ff6){try{if(_0x1e8cc0){var _0x20fd09=_['find'](_0x1e8cc0,{'name':_0x379ff6})||{};if(hasSequelizeOperator(_0x1151ea)){_0x25dfec[_0x379ff6]=getOperatorValue(_0x1151ea);}else if(_0x20fd09[_0xf0fa('0x7')]==='DATE'&&_[_0xf0fa('0x8')](_0x1151ea)){var _0x521034=JSON[_0xf0fa('0x2')](_0x1151ea);var _0x17326f={'$gte':moment(moment(_0x521034[_0xf0fa('0x9')])['format']('YYYY-MM-DD'))[_0xf0fa('0xa')]()['format'](),'$lte':moment(moment(_0x521034[_0xf0fa('0xb')])[_0xf0fa('0xc')](_0xf0fa('0xd')))[_0xf0fa('0xa')]()[_0xf0fa('0xe')](0x1,'s')[_0xf0fa('0xc')]()};_0x25dfec[_0x379ff6]=_0x17326f;}else if(_0x20fd09[_0xf0fa('0xf')]===_0xf0fa('0x10')){_0x25dfec[_0x379ff6]=_0x1151ea;}else{_0x25dfec[_0x379ff6]=_['isArray'](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}else{_0x25dfec[_0x379ff6]=_[_0xf0fa('0x11')](_0x1151ea)?_0x1151ea:JSON[_0xf0fa('0x2')](_0x1151ea);}}catch(_0x1d3c22){_0x25dfec[_0x379ff6]=_0x1151ea[_0xf0fa('0x12')](',');}});}return _0x25dfec;};exports[_0xf0fa('0x13')]=function(_0x5ba2eb){_0x5ba2eb=parseInt(_0x5ba2eb,0xa);if(!_0x5ba2eb||_0x5ba2eb<0x0){_0x5ba2eb=LIMIT_VALUE;}return _0x5ba2eb;};exports['offset']=function(_0x2f376d){_0x2f376d=parseInt(_0x2f376d,0xa);if(!_0x2f376d||_0x2f376d<0x0){_0x2f376d=0x0;}return _0x2f376d;};exports[_0xf0fa('0x14')]=function(_0x151d09){var _0x2385e2,_0x1a3620=null;if(_0x151d09){_0x2385e2=_0x151d09[_0xf0fa('0x12')](',');_0x1a3620=_[_0xf0fa('0x15')](_0x2385e2,function(_0x3de639){if(_0x3de639[_0xf0fa('0x16')]('-')===0x0){return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize['col'](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639[_0xf0fa('0x1a')](0x1),_0xf0fa('0x1b')];}else{return[_0x3de639===_0xf0fa('0x17')?sequelize[_0xf0fa('0x18')](sequelize[_0xf0fa('0x1c')](_0xf0fa('0x17')),_0xf0fa('0x19')):_0x3de639,'ASC'];}});}return _0x1a3620;};exports[_0xf0fa('0x1d')]=function(_0x19e392,_0x56134e){if(_[_0xf0fa('0x5')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x11')](_0x19e392)){for(var _0x2efe88=0x0;_0x2efe88<_0x19e392['length'];_0x2efe88+=0x1){_0x19e392[_0x2efe88]=this[_0xf0fa('0x1d')](_0x19e392[_0x2efe88],_0x56134e);}return _0x19e392;}if(!_[_0xf0fa('0x1e')](_0x19e392)){return _0x19e392;}if(_[_0xf0fa('0x1f')](_0x56134e)){_0x56134e=[_0x56134e];}if(!_[_0xf0fa('0x11')](_0x56134e)){return _0x19e392;}for(var _0x4e6eef=0x0;_0x4e6eef<_0x56134e['length'];_0x4e6eef+=0x1){_[_0xf0fa('0x20')](_0x19e392,_0x56134e[_0x4e6eef]);}for(var _0x1c5eaf in _0x19e392){if(_0x19e392[_0xf0fa('0x21')](_0x1c5eaf)){_0x19e392[_0x1c5eaf]=this[_0xf0fa('0x1d')](_0x19e392[_0x1c5eaf],_0x56134e);}}return _0x19e392;};exports['isNumeric']=function(_0x4058d6){return _0x4058d6[_0xf0fa('0x22')](RegExp(_0xf0fa('0x23')))?!![]:![];};exports['isEmail']=function(_0x9ad0e3){return _0x9ad0e3['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xf0fa('0x24')]=function(_0x1e3875){var _0x28e057=[];_0x1e3875['split'](/[ ,]+/)[_0xf0fa('0x25')](function(_0x33cc64){_0x33cc64=_0x33cc64[_0xf0fa('0x26')](/([^:]")"+/g,'$1');_0x33cc64='+'+_0x33cc64+'*';var _0x212986=/[ `!@#$%^&*()_\-?~]/;if(_0x33cc64[_0xf0fa('0x22')](_0x212986))_0x33cc64='\x22'+_0x33cc64+'\x22';_0x28e057[_0xf0fa('0x27')](_0x33cc64);});return _0x28e057['join']('\x20');};exports['getOptions']=function(_0x36173a,_0x255f9d,_0x485fe2){var _0x38cf8c={},_0x50e0bd={};if(_0x255f9d['query']['$id']){_0x255f9d[_0xf0fa('0x28')]['id']=_0x255f9d['query'][_0xf0fa('0x29')];delete _0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x29')];}_0x38cf8c[_0xf0fa('0x2a')]=_[_0xf0fa('0x15')](_0x36173a,_0xf0fa('0xf'));_0x38cf8c[_0xf0fa('0x28')]=_[_0xf0fa('0x3')](_0x255f9d['query']);_0x38cf8c[_0xf0fa('0x2b')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],_0x38cf8c['query']);_0x50e0bd[_0xf0fa('0x2d')]=_[_0xf0fa('0x2c')](_0x38cf8c[_0xf0fa('0x2a')],this[_0xf0fa('0x2e')](_0x255f9d['query']['fields']));_0x50e0bd[_0xf0fa('0x2d')]=_0x50e0bd[_0xf0fa('0x2d')][_0xf0fa('0x2f')]?_0x50e0bd[_0xf0fa('0x2d')]:_0x38cf8c[_0xf0fa('0x2a')];if(!_0x255f9d['query']['hasOwnProperty']('nolimit')){_0x50e0bd['limit']=this[_0xf0fa('0x13')](_0x255f9d[_0xf0fa('0x28')]['limit']);_0x50e0bd['offset']=this[_0xf0fa('0x30')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x30')]);}_0x50e0bd[_0xf0fa('0x31')]=this[_0xf0fa('0x14')](_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x14')]);_0x50e0bd['where']=this['filters'](_[_0xf0fa('0x32')](_0x255f9d[_0xf0fa('0x28')],_0x38cf8c[_0xf0fa('0x2b')]),_0x36173a);if(_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]){var _0x1d0129=_0x36173a;var _0x5acfa4=_0x255f9d[_0xf0fa('0x28')]['filter'];if(typeof _0x5acfa4===_0xf0fa('0x34')){_0x1d0129=_[_0xf0fa('0x33')](_0x36173a,function(_0x6e1fd9){return _[_0xf0fa('0x4')](_0x5acfa4[_0xf0fa('0x35')],_0x6e1fd9[_0xf0fa('0xf')]);});_0x5acfa4=_0x5acfa4[_0xf0fa('0x36')];}_0x50e0bd[_0xf0fa('0x37')]=_[_0xf0fa('0x38')](_0x50e0bd['where'],{'$or':_['map'](_0x1d0129,function(_0x52221a){if(_0x52221a[_0xf0fa('0x7')]!==_0xf0fa('0x39')){if(_0x485fe2){return sequelize['where'](sequelize['fn'](_0xf0fa('0x3a'),sequelize[_0xf0fa('0x1c')](_0x52221a[_0xf0fa('0xf')])),{'$like':sequelize['fn'](_0xf0fa('0x3a'),'%'+_0x255f9d['query'][_0xf0fa('0x33')]+'%')});}else{var _0x1f3916={};_0x1f3916[_0x52221a[_0xf0fa('0xf')]]={'$like':'%'+_0x255f9d[_0xf0fa('0x28')][_0xf0fa('0x33')]+'%'};return _0x1f3916;}}})});}_0x50e0bd=_[_0xf0fa('0x38')]({},_0x50e0bd,_0x255f9d[_0xf0fa('0x3b')]);return _0x50e0bd;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 9f2d3ad..7a00a3d 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xafcd=['busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','all','flatten','map','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','name','find','globalStatus','catch','getSortedAgentsIdsByStatus','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','then','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','unknown','*pause'];(function(_0x56c7c9,_0x10affd){var _0x19db04=function(_0x2009dc){while(--_0x2009dc){_0x56c7c9['push'](_0x56c7c9['shift']());}};_0x19db04(++_0x10affd);}(_0xafcd,0xf8));var _0xdafc=function(_0x19a5d8,_0x347207){_0x19a5d8=_0x19a5d8-0x0;var _0x30104a=_0xafcd[_0x19a5d8];return _0x30104a;};'use strict';var _=require('lodash');var jayson=require(_0xdafc('0x0'));var db=require(_0xdafc('0x1'))['db'];var amiClient=jayson[_0xdafc('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0xdafc('0x2')][_0xdafc('0x3')]({'port':0x232c});function isAgentPaused(_0x41e5da,_0x2038a7){var _0x130152=[_0x41e5da[_0xdafc('0x4')],_0x41e5da[_0xdafc('0x5')],_0x41e5da[_0xdafc('0x6')],_0x41e5da[_0xdafc('0x7')],_0x41e5da[_0xdafc('0x8')],_0x41e5da[_0xdafc('0x9')],_0x41e5da[_0xdafc('0xa')]];if(!_0x2038a7)return _[_0xdafc('0xb')](_0x130152);var _0x45758f=_[_0xdafc('0xc')](_0x130152);return _0x45758f['length']>0x0&&_0x45758f[_0xdafc('0xd')]<_0x130152[_0xdafc('0xd')]?!![]:![];}function isIdle(_0x423d7b){return _0x423d7b===_0xdafc('0xe')||_0x423d7b==='unknown'||_0x423d7b===_0xdafc('0xf')||_0x423d7b==='ringing'||_[_0xdafc('0x10')](_0x423d7b);}function isAgentIdle(_0x3f0e38){if(_0x3f0e38[_0xdafc('0x11')]!==_0xdafc('0xe')&&_0x3f0e38[_0xdafc('0x9')]){_0x3f0e38[_0xdafc('0x11')]=_0xdafc('0x12');return![];}return _['every']([_0x3f0e38[_0xdafc('0x13')],_0x3f0e38[_0xdafc('0x14')],_0x3f0e38['mailStatus'],_0x3f0e38['openchannelStatus'],_0x3f0e38[_0xdafc('0x15')],_0x3f0e38[_0xdafc('0x11')],_0x3f0e38[_0xdafc('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xdafc('0x17')]('Agents',{})[_0xdafc('0x18')](function(_0x156ec0){if(_0x156ec0['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x511b63=_0x156ec0[_0xdafc('0x19')];return routingClient[_0xdafc('0x17')]('Agents',{})[_0xdafc('0x18')](function(_0x173bf3){if(_0x173bf3[_0xdafc('0x1a')]){throw new Error(_0xdafc('0x1b'));}var _0x1dd820=_0x173bf3['result'];return _['merge']({},_0x511b63,_0x1dd820);});})['catch'](function(_0x381d98){throw _0x381d98;});}exports[_0xdafc('0x1c')]=getRealtimeAgents;function getAgentStatus(_0x57a410){var _0x233428=_0xdafc('0x1d');if(isAgentPaused(_0x57a410))_0x233428=_0xdafc('0x12');else if(isAgentPaused(_0x57a410,!![]))_0x233428=_0xdafc('0x1e');else if(isAgentIdle(_0x57a410))_0x233428='idle';else _0x233428=_0xdafc('0x1f');return _0x233428;}exports[_0xdafc('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x4b1b8a,_0x4e0e1b){var _0x39a09a=_[_0xdafc('0x21')](_0x4b1b8a)?_0x4b1b8a:[_0x4b1b8a];var _0x15a03f=_[_0xdafc('0x22')](_0x4e0e1b)+_0xdafc('0x23');var _0x21fc09=_['map'](_0x39a09a,function(_0x31b3ff){return db[_0x15a03f][_0xdafc('0x24')]({'where':{'id':_0x31b3ff}})['then'](function(_0x164a5a){if(!_0x164a5a)return[];return _0x164a5a[_0xdafc('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xdafc('0x26')](_0x21fc09)['then'](function(_0x1729c7){var _0x51d497=_(_0x1729c7)[_0xdafc('0x27')]()[_0xdafc('0x28')]('id')['uniq']()['value']();return _0x51d497;});}exports[_0xdafc('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3ee880,_0x2d4b45,_0x18cbb6){try{if(_0x2d4b45[_0xdafc('0xd')]>0x0){_0x3ee880=_0x3ee880[_0xdafc('0xc')](function(_0x9114a6){return _0x2d4b45[_0xdafc('0x2a')](_0x9114a6['id']);});}var _0x4a5012=_0x3ee880[_0xdafc('0xc')](function(_0x25bb5c){var _0x34b036=_0xdafc('0x1f');if(isAgentIdle(_0x25bb5c)){_0x34b036=_0xdafc('0xe');}return _0x34b036===_0x18cbb6;});return _[_0xdafc('0x28')](_0x4a5012,'id');}catch(_0x3303d6){throw _0x3303d6;}}exports[_0xdafc('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4b0d5b,_0x1c1238,_0x4f268f){return Promise['resolve']()[_0xdafc('0x18')](function(){if(_0x1c1238[_0xdafc('0xd')]>0x0){_0x4b0d5b=_0x4b0d5b['filter'](function(_0x48ff97){return _0x1c1238['includes'](_0x48ff97['id']);});}return _0x4b0d5b;})['then'](function(){return db[_0xdafc('0x2c')]['findAll']({'attributes':['id',_0xdafc('0x2d'),'fullname','chatPause',_0xdafc('0x5'),_0xdafc('0x6'),_0xdafc('0x7'),'smsPause',_0xdafc('0x9'),_0xdafc('0xa'),'pauseType'],'where':{'id':{'$in':_['map'](_0x4b0d5b,'id')}},'raw':!![]});})[_0xdafc('0x18')](function(_0x53622c){return _0x53622c['map'](function(_0x45bf3b){var _0x5ec361=_[_0xdafc('0x2e')](_0x4b0d5b,['id',_0x45bf3b['id']]);var _0x7220e5=filterAgentAttributes(_0x5ec361);_['merge'](_0x45bf3b,_0x7220e5);_0x45bf3b[_0xdafc('0x2f')]=getAgentStatus(_0x45bf3b);return _0x45bf3b;});})['then'](function(_0x2bea2c){var _0x326370=sortAgentsByStatus(_0x2bea2c,_0x4f268f);return _[_0xdafc('0x28')](_0x326370,'id');})[_0xdafc('0x30')](function(_0x3ae191){throw _0x3ae191;});}exports[_0xdafc('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x4157c4){var _0x4fb233={'fields':[],'order':null};var _0x32819b=_0x4157c4['split'](',');_0x4fb233['fields']=_[_0xdafc('0xc')](_0x32819b,function(_0x19e4c7){if(!_0x19e4c7[_0xdafc('0x2a')](_0xdafc('0x2f'))){return!![];}_0x4fb233['order']=_[_0xdafc('0x32')](_0x19e4c7,'-')?_0xdafc('0x33'):_0xdafc('0x34');return![];});return _0x4fb233;}exports[_0xdafc('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0x3f80c2){if(_0x3f80c2['includes'](_0xdafc('0x36'))&&!_0x3f80c2[_0xdafc('0x2a')](_0xdafc('0x37'))){var _0x13b638=_0x3f80c2[_0xdafc('0x38')](0x0,_0x3f80c2['indexOf'](_0xdafc('0x36')));_0x3f80c2+=','+_0x13b638+_0xdafc('0x37');}return _0x3f80c2;}exports[_0xdafc('0x39')]=validateSortParameter;function sortAgentsByStatus(_0x34e667,_0x3f4dcf){var _0x41d7ed=_0x34e667[_0xdafc('0x3a')](function(_0x27a463,_0x2ff8c3){if(_0x27a463[_0xdafc('0x2f')]===_0x2ff8c3[_0xdafc('0x2f')]){if(_0x27a463[_0xdafc('0x2f')]===_0xdafc('0x12')){if(_0x3f4dcf===_0xdafc('0x33')){return(_0x27a463['pauseType']||'')<(_0x2ff8c3[_0xdafc('0x3b')]||'')||_0x27a463['fullname'][_0xdafc('0x3c')]()>_0x2ff8c3['fullname'][_0xdafc('0x3c')]()?0x1:-0x1;}else{return(_0x27a463[_0xdafc('0x3b')]||'')<(_0x2ff8c3['pauseType']||'')||_0x27a463['fullname']['toLowerCase']()>_0x2ff8c3[_0xdafc('0x36')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x3f4dcf===_0xdafc('0x33')){return _0x27a463[_0xdafc('0x36')]['toLowerCase']()<_0x2ff8c3['fullname'][_0xdafc('0x3c')]()?0x1:-0x1;}else{return _0x27a463['fullname'][_0xdafc('0x3c')]()<_0x2ff8c3[_0xdafc('0x36')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x3f4dcf===_0xdafc('0x33')){return _0x27a463[_0xdafc('0x2f')]<_0x2ff8c3[_0xdafc('0x2f')]?0x1:-0x1;}else{return _0x27a463[_0xdafc('0x2f')]<_0x2ff8c3[_0xdafc('0x2f')]?-0x1:0x1;}}});return _0x41d7ed;}exports[_0xdafc('0x3d')]=sortAgentsByStatus;function filterAgentAttributes(_0x490ddf){var _0x200c62=['userpic',_0xdafc('0x3e'),_0xdafc('0x3f'),_0xdafc('0x40'),_0xdafc('0x3b'),_0xdafc('0x40'),'internal','address',_0xdafc('0x4'),_0xdafc('0x7'),_0xdafc('0x6'),'smsPause',_0xdafc('0xa'),_0xdafc('0x5'),_0xdafc('0x9'),_0xdafc('0x41'),_0xdafc('0x42'),_0xdafc('0x43'),_0xdafc('0x44'),_0xdafc('0x45'),_0xdafc('0x46'),_0xdafc('0x47'),_0xdafc('0x48'),_0xdafc('0x49'),_0xdafc('0x4a'),_0xdafc('0x4b'),_0xdafc('0x4c'),_0xdafc('0x13'),_0xdafc('0x4d'),_0xdafc('0x4e'),_0xdafc('0x15'),_0xdafc('0x16'),_0xdafc('0x14'),'voiceStatus',_0xdafc('0x4f'),_0xdafc('0x50'),_0xdafc('0x51'),_0xdafc('0x52'),_0xdafc('0x53'),_0xdafc('0x54'),_0xdafc('0x55'),_0xdafc('0x56'),_0xdafc('0x57'),_0xdafc('0x58'),'phoneBarEnableScreenRecordingByAgent',_0xdafc('0x59'),_0xdafc('0x5a')];var _0x26b123=[_0xdafc('0x4'),_0xdafc('0x7'),_0xdafc('0x6'),'smsPause',_0xdafc('0xa'),_0xdafc('0x5'),_0xdafc('0x9'),'online'];var _0x481c68=_(_0x490ddf)[_0xdafc('0x5b')](_0x26b123)[_0xdafc('0x5c')](_0x200c62)['value']();return _0x481c68;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file +var _0x3ef5=['catch','getRealtimeAgents','*pause','getAgentStatus','startCase','map','findOne','then','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','indexOf','validateSortParameter','sort','pauseType','toLowerCase','sortAgentsByStatus','lastLoginAt','lastPauseAt','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','openchannelStatus','whatsappStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','routealias','online','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','filter','length','idle','unknown','ringing','isNil','voiceStatus','pause','faxStatus','mailStatus','request','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result'];(function(_0x309bde,_0x3ef7f5){var _0x5fa8bc=function(_0x521e70){while(--_0x521e70){_0x309bde['push'](_0x309bde['shift']());}};_0x5fa8bc(++_0x3ef7f5);}(_0x3ef5,0x160));var _0x53ef=function(_0x4dfee4,_0x3c0383){_0x4dfee4=_0x4dfee4-0x0;var _0x547953=_0x3ef5[_0x4dfee4];return _0x547953;};'use strict';var _=require(_0x53ef('0x0'));var jayson=require(_0x53ef('0x1'));var db=require(_0x53ef('0x2'))['db'];var amiClient=jayson[_0x53ef('0x3')][_0x53ef('0x4')]({'port':0x232a});var routingClient=jayson[_0x53ef('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x1e855c,_0x5744b8){var _0x4a3f7b=[_0x1e855c[_0x53ef('0x5')],_0x1e855c[_0x53ef('0x6')],_0x1e855c[_0x53ef('0x7')],_0x1e855c[_0x53ef('0x8')],_0x1e855c[_0x53ef('0x9')],_0x1e855c[_0x53ef('0xa')],_0x1e855c[_0x53ef('0xb')]];if(!_0x5744b8)return _[_0x53ef('0xc')](_0x4a3f7b);var _0x508372=_[_0x53ef('0xd')](_0x4a3f7b);return _0x508372['length']>0x0&&_0x508372['length']<_0x4a3f7b[_0x53ef('0xe')]?!![]:![];}function isIdle(_0x4da947){return _0x4da947===_0x53ef('0xf')||_0x4da947===_0x53ef('0x10')||_0x4da947==='unavailable'||_0x4da947===_0x53ef('0x11')||_[_0x53ef('0x12')](_0x4da947);}function isAgentIdle(_0x103d55){if(_0x103d55[_0x53ef('0x13')]!==_0x53ef('0xf')&&_0x103d55['voicePause']){_0x103d55[_0x53ef('0x13')]=_0x53ef('0x14');return![];}return _[_0x53ef('0xc')]([_0x103d55['chatStatus'],_0x103d55[_0x53ef('0x15')],_0x103d55[_0x53ef('0x16')],_0x103d55['openchannelStatus'],_0x103d55['smsStatus'],_0x103d55[_0x53ef('0x13')],_0x103d55['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x53ef('0x17')](_0x53ef('0x18'),{})['then'](function(_0x50dd26){if(_0x50dd26[_0x53ef('0x19')]){throw new Error(_0x53ef('0x1a'));}var _0x59f6a8=_0x50dd26[_0x53ef('0x1b')];return routingClient['request'](_0x53ef('0x18'),{})['then'](function(_0x1f7286){if(_0x1f7286[_0x53ef('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x619168=_0x1f7286['result'];return _['merge']({},_0x59f6a8,_0x619168);});})[_0x53ef('0x1c')](function(_0x51c960){throw _0x51c960;});}exports[_0x53ef('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x2938ca){var _0x3b26b4='unknown';if(isAgentPaused(_0x2938ca))_0x3b26b4='pause';else if(isAgentPaused(_0x2938ca,!![]))_0x3b26b4=_0x53ef('0x1e');else if(isAgentIdle(_0x2938ca))_0x3b26b4=_0x53ef('0xf');else _0x3b26b4='busy';return _0x3b26b4;}exports[_0x53ef('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x490e36,_0x6e003b){var _0x3612ad=_['isArray'](_0x490e36)?_0x490e36:[_0x490e36];var _0x7f03d2=_[_0x53ef('0x20')](_0x6e003b)+'Queue';var _0x1ef11d=_[_0x53ef('0x21')](_0x3612ad,function(_0x1a338b){return db[_0x7f03d2][_0x53ef('0x22')]({'where':{'id':_0x1a338b}})[_0x53ef('0x23')](function(_0x496bdc){if(!_0x496bdc)return[];return _0x496bdc[_0x53ef('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x53ef('0x25')](_0x1ef11d)['then'](function(_0x1248fe){var _0x2bd62d=_(_0x1248fe)[_0x53ef('0x26')]()[_0x53ef('0x21')]('id')[_0x53ef('0x27')]()[_0x53ef('0x28')]();return _0x2bd62d;});}exports[_0x53ef('0x29')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x585445,_0x183429,_0x4830c9){try{if(_0x183429['length']>0x0){_0x585445=_0x585445[_0x53ef('0xd')](function(_0x5177e4){return _0x183429[_0x53ef('0x2a')](_0x5177e4['id']);});}var _0x90031d=_0x585445[_0x53ef('0xd')](function(_0x3e0756){var _0x30f92a='busy';if(isAgentIdle(_0x3e0756)){_0x30f92a=_0x53ef('0xf');}return _0x30f92a===_0x4830c9;});return _[_0x53ef('0x21')](_0x90031d,'id');}catch(_0x11672e){throw _0x11672e;}}exports[_0x53ef('0x2b')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x47584a,_0x1ac347,_0x1037ac){return Promise[_0x53ef('0x2c')]()['then'](function(){if(_0x1ac347[_0x53ef('0xe')]>0x0){_0x47584a=_0x47584a[_0x53ef('0xd')](function(_0x2ad464){return _0x1ac347[_0x53ef('0x2a')](_0x2ad464['id']);});}return _0x47584a;})['then'](function(){return db[_0x53ef('0x2d')][_0x53ef('0x2e')]({'attributes':['id',_0x53ef('0x2f'),_0x53ef('0x30'),'chatPause',_0x53ef('0x6'),_0x53ef('0x7'),_0x53ef('0x8'),'smsPause',_0x53ef('0xa'),_0x53ef('0xb'),'pauseType'],'where':{'id':{'$in':_['map'](_0x47584a,'id')}},'raw':!![]});})[_0x53ef('0x23')](function(_0x50284e){return _0x50284e[_0x53ef('0x21')](function(_0x1e8aa5){var _0x26bd45=_['find'](_0x47584a,['id',_0x1e8aa5['id']]);var _0x4b8552=filterAgentAttributes(_0x26bd45);_[_0x53ef('0x31')](_0x1e8aa5,_0x4b8552);_0x1e8aa5[_0x53ef('0x32')]=getAgentStatus(_0x1e8aa5);return _0x1e8aa5;});})['then'](function(_0x19a4b3){var _0x57acce=sortAgentsByStatus(_0x19a4b3,_0x1037ac);return _['map'](_0x57acce,'id');})[_0x53ef('0x1c')](function(_0x46115d){throw _0x46115d;});}exports[_0x53ef('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x5a9e26){var _0x262653={'fields':[],'order':null};var _0x94a821=_0x5a9e26[_0x53ef('0x34')](',');_0x262653[_0x53ef('0x35')]=_[_0x53ef('0xd')](_0x94a821,function(_0x371aae){if(!_0x371aae[_0x53ef('0x2a')](_0x53ef('0x32'))){return!![];}_0x262653[_0x53ef('0x36')]=_[_0x53ef('0x37')](_0x371aae,'-')?_0x53ef('0x38'):_0x53ef('0x39');return![];});return _0x262653;}exports[_0x53ef('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x54cd74){if(_0x54cd74[_0x53ef('0x2a')](_0x53ef('0x30'))&&!_0x54cd74[_0x53ef('0x2a')](_0x53ef('0x3b'))){var _0x1976f1=_0x54cd74['substring'](0x0,_0x54cd74[_0x53ef('0x3c')]('fullname'));_0x54cd74+=','+_0x1976f1+_0x53ef('0x3b');}return _0x54cd74;}exports[_0x53ef('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x3f61e0,_0x235524){var _0x409c23=_0x3f61e0[_0x53ef('0x3e')](function(_0x139d84,_0x5b18e3){if(_0x139d84[_0x53ef('0x32')]===_0x5b18e3[_0x53ef('0x32')]){if(_0x139d84[_0x53ef('0x32')]===_0x53ef('0x14')){if(_0x235524===_0x53ef('0x38')){return(_0x139d84[_0x53ef('0x3f')]||'')<(_0x5b18e3[_0x53ef('0x3f')]||'')||_0x139d84['fullname'][_0x53ef('0x40')]()>_0x5b18e3['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x139d84[_0x53ef('0x3f')]||'')<(_0x5b18e3[_0x53ef('0x3f')]||'')||_0x139d84['fullname'][_0x53ef('0x40')]()>_0x5b18e3[_0x53ef('0x30')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x235524===_0x53ef('0x38')){return _0x139d84[_0x53ef('0x30')][_0x53ef('0x40')]()<_0x5b18e3[_0x53ef('0x30')]['toLowerCase']()?0x1:-0x1;}else{return _0x139d84[_0x53ef('0x30')][_0x53ef('0x40')]()<_0x5b18e3[_0x53ef('0x30')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x235524===_0x53ef('0x38')){return _0x139d84['globalStatus']<_0x5b18e3[_0x53ef('0x32')]?0x1:-0x1;}else{return _0x139d84['globalStatus']<_0x5b18e3['globalStatus']?-0x1:0x1;}}});return _0x409c23;}exports[_0x53ef('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x5400e1){var _0x42a325=['userpic','online',_0x53ef('0x42'),_0x53ef('0x43'),_0x53ef('0x3f'),_0x53ef('0x43'),_0x53ef('0x3b'),_0x53ef('0x44'),_0x53ef('0x5'),_0x53ef('0x8'),'mailPause',_0x53ef('0x9'),_0x53ef('0xb'),_0x53ef('0x6'),_0x53ef('0xa'),_0x53ef('0x45'),'openchannelCapacity',_0x53ef('0x46'),_0x53ef('0x47'),'whatsappCapacity',_0x53ef('0x48'),'chatCurrentCapacity',_0x53ef('0x49'),_0x53ef('0x4a'),_0x53ef('0x4b'),_0x53ef('0x4c'),_0x53ef('0x4d'),_0x53ef('0x4e'),_0x53ef('0x4f'),'mailStatus','smsStatus',_0x53ef('0x50'),_0x53ef('0x15'),'voiceStatus','chatStatusTime',_0x53ef('0x51'),_0x53ef('0x52'),_0x53ef('0x53'),_0x53ef('0x54'),_0x53ef('0x55'),_0x53ef('0x56'),_0x53ef('0x57'),'destconnectedlinenum',_0x53ef('0x58'),_0x53ef('0x59'),'phoneBarEnableAutomaticScreenRecording',_0x53ef('0x5a')];var _0x32caef=[_0x53ef('0x5'),_0x53ef('0x8'),_0x53ef('0x7'),_0x53ef('0x9'),_0x53ef('0xb'),_0x53ef('0x6'),_0x53ef('0xa'),_0x53ef('0x5b')];var _0x565cb0=_(_0x5400e1)[_0x53ef('0x5c')](_0x32caef)[_0x53ef('0x5d')](_0x42a325)[_0x53ef('0x28')]();return _0x565cb0;}exports[_0x53ef('0x5e')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 29aa323..975c603 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x14e201,_0x31e6d7){var _0x1f0fa0=function(_0x1a7da9){while(--_0x1a7da9){_0x14e201['push'](_0x14e201['shift']());}};_0x1f0fa0(++_0x31e6d7);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x24106c,_0x367a6f){var _0xbaeb73=function(_0x483603){while(--_0x483603){_0x24106c['push'](_0x24106c['shift']());}};_0xbaeb73(++_0x367a6f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 09f5bba..e355759 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 _0xc0a1=['keys','length','filter','IPv4','concat','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','orderBy'];(function(_0x13de6f,_0x423a33){var _0x2f61be=function(_0xf1101a){while(--_0xf1101a){_0x13de6f['push'](_0x13de6f['shift']());}};_0x2f61be(++_0x423a33);}(_0xc0a1,0x15a));var _0x1c0a=function(_0x352fbf,_0x5d417d){_0x352fbf=_0x352fbf-0x0;var _0x45784a=_0xc0a1[_0x352fbf];return _0x45784a;};'use strict';var _=require(_0x1c0a('0x0'));var os=require('os');var crypto=require(_0x1c0a('0x1'));var machine=require(_0x1c0a('0x2'));var exec=require(_0x1c0a('0x3'))['execSync'];var config=require(_0x1c0a('0x4'));function getInterfaces(){var _0x2184e6=[];var _0x1e6494=os['networkInterfaces']();var _0x496c61=_[_0x1c0a('0x5')](_[_0x1c0a('0x6')](_0x1e6494));for(var _0xeda3ac=0x0;_0xeda3ac<_0x496c61[_0x1c0a('0x7')];_0xeda3ac++){var _0x14f4a1=_0x1e6494[_0x496c61[_0xeda3ac]][_0x1c0a('0x8')](function(_0x70914){return _0x70914['family']===_0x1c0a('0x9')&&_0x70914['internal']===![];});_0x2184e6=_0x2184e6[_0x1c0a('0xa')](_0x14f4a1);}return _0x2184e6;}function getFirstInterface(){var _0x25f12f=_['head'](getInterfaces());return{'macAddress':_0x25f12f&&_0x25f12f[_0x1c0a('0xb')]?_0x25f12f[_0x1c0a('0xb')]:'00:00:00:00:00:00','ipAddress':_0x25f12f&&_0x25f12f['address']?_0x25f12f[_0x1c0a('0xc')]:_0x1c0a('0xd')};}exports[_0x1c0a('0xe')]=getFirstInterface;function getCPUhash(){var _0x19befb=_[_0x1c0a('0x5')](os[_0x1c0a('0xf')]()[_0x1c0a('0x10')](function(_0x12947c){return _0x12947c[_0x1c0a('0x11')];}))[_0x1c0a('0x12')](':');return crypto[_0x1c0a('0x13')]('md5')[_0x1c0a('0x14')](_0x19befb)[_0x1c0a('0x15')](_0x1c0a('0x16'));}exports[_0x1c0a('0x17')]=function(){var _0x33dd76=os[_0x1c0a('0x18')]();var _0x15d117=/[0-9a-f-]{36}/;if(config[_0x1c0a('0x19')]&&_0x15d117[_0x1c0a('0x1a')](config['licenseToken'])){return config[_0x1c0a('0x19')];}else if(_0x33dd76==='win32'){return exec(_0x1c0a('0x1b'),{'encoding':_0x1c0a('0x1c')})[_0x1c0a('0x1d')]('\x0d\x0a','');}else{var _0x165611=getFirstInterface();var _0x59db99=getCPUhash();var _0x401c82=_0x59db99+'|'+os['hostname']()+'|'+_0x165611['macAddress']+'|'+_0x165611[_0x1c0a('0x1e')];var _0x28fdfa=crypto[_0x1c0a('0x13')]('md5')['update'](_0x401c82)[_0x1c0a('0x15')](_0x1c0a('0x16'));return _0x28fdfa[_0x1c0a('0x1f')](0x0,0x8)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x8,0xc)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0xc,0x10)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x10,0x14)+'-'+_0x28fdfa[_0x1c0a('0x1f')](0x14);}}; \ No newline at end of file +var _0x3e10=['substring','crypto','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','join','createHash','update','hex','getUuid','licenseToken','win32','hostname','macAddress','ipAddress','md5','digest'];(function(_0x130c4b,_0x51357e){var _0x17728d=function(_0x1340cd){while(--_0x1340cd){_0x130c4b['push'](_0x130c4b['shift']());}};_0x17728d(++_0x51357e);}(_0x3e10,0x175));var _0x03e1=function(_0x197cab,_0x25a080){_0x197cab=_0x197cab-0x0;var _0x43d64c=_0x3e10[_0x197cab];return _0x43d64c;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x03e1('0x0'));var machine=require('bimedia-machine-uuid');var exec=require(_0x03e1('0x1'))[_0x03e1('0x2')];var config=require(_0x03e1('0x3'));function getInterfaces(){var _0x5c4e8f=[];var _0x21d69a=os[_0x03e1('0x4')]();var _0x2f2b43=_[_0x03e1('0x5')](_[_0x03e1('0x6')](_0x21d69a));for(var _0x5d7393=0x0;_0x5d7393<_0x2f2b43[_0x03e1('0x7')];_0x5d7393++){var _0x2dee72=_0x21d69a[_0x2f2b43[_0x5d7393]][_0x03e1('0x8')](function(_0x58991f){return _0x58991f[_0x03e1('0x9')]==='IPv4'&&_0x58991f[_0x03e1('0xa')]===![];});_0x5c4e8f=_0x5c4e8f[_0x03e1('0xb')](_0x2dee72);}return _0x5c4e8f;}function getFirstInterface(){var _0x3dfcaf=_['head'](getInterfaces());return{'macAddress':_0x3dfcaf&&_0x3dfcaf[_0x03e1('0xc')]?_0x3dfcaf['mac']:_0x03e1('0xd'),'ipAddress':_0x3dfcaf&&_0x3dfcaf[_0x03e1('0xe')]?_0x3dfcaf[_0x03e1('0xe')]:_0x03e1('0xf')};}exports[_0x03e1('0x10')]=getFirstInterface;function getCPUhash(){var _0x10fda2=_[_0x03e1('0x5')](os['cpus']()[_0x03e1('0x11')](function(_0x1d642c){return _0x1d642c['model'];}))[_0x03e1('0x12')](':');return crypto[_0x03e1('0x13')]('md5')[_0x03e1('0x14')](_0x10fda2)['digest'](_0x03e1('0x15'));}exports[_0x03e1('0x16')]=function(){var _0x237725=os['platform']();var _0x5c8b60=/[0-9a-f-]{36}/;if(config[_0x03e1('0x17')]&&_0x5c8b60['test'](config['licenseToken'])){return config[_0x03e1('0x17')];}else if(_0x237725===_0x03e1('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x2ed9c5=getFirstInterface();var _0x139f1b=getCPUhash();var _0x5ea0a4=_0x139f1b+'|'+os[_0x03e1('0x19')]()+'|'+_0x2ed9c5[_0x03e1('0x1a')]+'|'+_0x2ed9c5[_0x03e1('0x1b')];var _0x31019b=crypto['createHash'](_0x03e1('0x1c'))[_0x03e1('0x14')](_0x5ea0a4)[_0x03e1('0x1d')](_0x03e1('0x15'));return _0x31019b['substring'](0x0,0x8)+'-'+_0x31019b[_0x03e1('0x1e')](0x8,0xc)+'-'+_0x31019b[_0x03e1('0x1e')](0xc,0x10)+'-'+_0x31019b[_0x03e1('0x1e')](0x10,0x14)+'-'+_0x31019b[_0x03e1('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index d818ea0..381745b 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 _0x9fee=['info','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','get','data2','data1','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','Disabled'];(function(_0x2fd405,_0x415434){var _0x4ec4aa=function(_0x5bc038){while(--_0x5bc038){_0x2fd405['push'](_0x2fd405['shift']());}};_0x4ec4aa(++_0x415434);}(_0x9fee,0x1a2));var _0xe9fe=function(_0x5ec0ef,_0x3029db){_0x5ec0ef=_0x5ec0ef-0x0;var _0x2040a2=_0x9fee[_0x5ec0ef];return _0x2040a2;};'use strict';var util=require(_0xe9fe('0x0'));var moment=require(_0xe9fe('0x1'));var rp=require('request-promise');var BPromise=require(_0xe9fe('0x2'));var pkginfo=require(_0xe9fe('0x3'))(module,_0xe9fe('0x4'));var db=require(_0xe9fe('0x5'))['db'];var encryptor=require(_0xe9fe('0x6'));var hardware=require(_0xe9fe('0x7'));var logger=require(_0xe9fe('0x8'))('license');var HOST=_0xe9fe('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x68cf45){return new BPromise(function(_0x3f15ed,_0x1df963){var _0x172e33=util[_0xe9fe('0xa')](_0xe9fe('0xb'),HOST,_0x68cf45,module[_0xe9fe('0xc')][_0xe9fe('0x4')]);if(oldToken){_0x172e33=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x68cf45,module[_0xe9fe('0xc')][_0xe9fe('0x4')],oldToken);}var _0x314cfc={'uri':_0x172e33,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x314cfc)[_0xe9fe('0xd')](function(_0x157b58){_0x3f15ed(_0x157b58);})[_0xe9fe('0xe')](function(_0xf2710e){_0x1df963(_0xf2710e);});});}function manageLicense(_0x59bfad,_0x58641d){var _0x5c8cd2=_0x58641d[_0xe9fe('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x5c8cd2['data1']!==_0x59bfad&&!_0x5c8cd2[_0xe9fe('0x10')]){oldToken=_0x5c8cd2[_0xe9fe('0x11')];}httpRequest(_0x59bfad)['then'](function(_0x258f4d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x258f4d['active']){isOldTokenSent=![];if(!_0x5c8cd2[_0xe9fe('0x12')]&&_0x5c8cd2[_0xe9fe('0x12')]!=_0x258f4d[_0xe9fe('0x12')]||_0x5c8cd2['license']&&_0x5c8cd2[_0xe9fe('0x10')]){logger['info'](_0xe9fe('0x13'));}if(_0x5c8cd2[_0xe9fe('0x12')]&&!_0x5c8cd2[_0xe9fe('0x10')]&&_0x5c8cd2['license']!=_0x258f4d[_0xe9fe('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x5c8cd2['license']&&!_0x5c8cd2['data2']&&_0x5c8cd2['license']==_0x258f4d[_0xe9fe('0x12')]){return _0x58641d;}return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':_0x258f4d[_0xe9fe('0x12')]});}else{if(_0x258f4d[_0xe9fe('0x12')]||_0x5c8cd2[_0xe9fe('0x12')]){if(!_0x5c8cd2[_0xe9fe('0x10')]){if(_0x5c8cd2[_0xe9fe('0x11')]==_0x59bfad){GRAY_PERIOD_REASON=_0xe9fe('0x15');logger[_0xe9fe('0x16')](_0xe9fe('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xe9fe('0x16')](_0xe9fe('0x18'),_0x5c8cd2[_0xe9fe('0x11')],_0x59bfad);}logger[_0xe9fe('0x16')](_0xe9fe('0x19'),GRAY_PERIOD_REASON[_0xe9fe('0x1a')](),moment()['format'](_0xe9fe('0x1b')));return _0x58641d[_0xe9fe('0x14')]({'data2':encryptor[_0xe9fe('0x1c')](moment()[_0xe9fe('0xa')](_0xe9fe('0x1b')))});}else{if(moment()[_0xe9fe('0x1d')](encryptor[_0xe9fe('0x1e')](_0x5c8cd2[_0xe9fe('0x10')]),'days')>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xe9fe('0x1b')));isOldTokenSent=![];return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':null});}}}else{if(_0x5c8cd2[_0xe9fe('0x11')]!=_0x59bfad){logger[_0xe9fe('0x16')](_0xe9fe('0x18'),_0x5c8cd2[_0xe9fe('0x11')],_0x59bfad);return _0x58641d[_0xe9fe('0x14')]({'data1':_0x59bfad,'data2':null,'license':null});}}}return _0x58641d;})[_0xe9fe('0xd')](function(_0x22fb96){_0x58641d=_0x22fb96;})['catch'](function(_0x22e11f){logger[_0xe9fe('0x1f')](_0x22e11f[_0xe9fe('0x20')]);})[_0xe9fe('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xe9fe('0x22')](),_0x58641d);},TIME);});}function defaultLicense(){var _0x24367c=hardware['getUuid']();if(_0x24367c){return db[_0xe9fe('0x23')][_0xe9fe('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x24367c}})[_0xe9fe('0x25')](function(_0x1d263f,_0xa1f87c){logger['info'](_0xe9fe('0x26'),_0x24367c);manageLicense(_0x24367c,_0x1d263f);})['catch'](function(_0x6fad37){logger[_0xe9fe('0x1f')](_0x6fad37[_0xe9fe('0x20')]);});}}exports[_0xe9fe('0x27')]=defaultLicense; \ No newline at end of file +var _0xbf45=['format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','update','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license'];(function(_0x1c3282,_0x530ca2){var _0x4692a9=function(_0x4b6bac){while(--_0x4b6bac){_0x1c3282['push'](_0x1c3282['shift']());}};_0x4692a9(++_0x530ca2);}(_0xbf45,0xe5));var _0x5bf4=function(_0x3b46ea,_0x30dee9){_0x3b46ea=_0x3b46ea-0x0;var _0xc5ee1f=_0xbf45[_0x3b46ea];return _0xc5ee1f;};'use strict';var util=require(_0x5bf4('0x0'));var moment=require(_0x5bf4('0x1'));var rp=require(_0x5bf4('0x2'));var BPromise=require(_0x5bf4('0x3'));var pkginfo=require(_0x5bf4('0x4'))(module,_0x5bf4('0x5'));var db=require(_0x5bf4('0x6'))['db'];var encryptor=require(_0x5bf4('0x7'));var hardware=require(_0x5bf4('0x8'));var logger=require(_0x5bf4('0x9'))(_0x5bf4('0xa'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1f5d7b){return new BPromise(function(_0x40c002,_0x158045){var _0x1f0149=util[_0x5bf4('0xb')]('%s/api/servers/%s/check?version=%s',HOST,_0x1f5d7b,module[_0x5bf4('0xc')][_0x5bf4('0x5')]);if(oldToken){_0x1f0149=util['format'](_0x5bf4('0xd'),HOST,_0x1f5d7b,module[_0x5bf4('0xc')][_0x5bf4('0x5')],oldToken);}var _0x2eb7ab={'uri':_0x1f0149,'method':_0x5bf4('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2eb7ab)[_0x5bf4('0xf')](function(_0x44c71e){_0x40c002(_0x44c71e);})[_0x5bf4('0x10')](function(_0x34cbe9){_0x158045(_0x34cbe9);});});}function manageLicense(_0x33d6ac,_0x5a7cce){var _0x14c519=_0x5a7cce[_0x5bf4('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x14c519[_0x5bf4('0x12')]!==_0x33d6ac&&!_0x14c519[_0x5bf4('0x13')]){oldToken=_0x14c519[_0x5bf4('0x12')];}httpRequest(_0x33d6ac)[_0x5bf4('0xf')](function(_0x26c7bf){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x26c7bf[_0x5bf4('0x14')]){isOldTokenSent=![];if(!_0x14c519[_0x5bf4('0xa')]&&_0x14c519[_0x5bf4('0xa')]!=_0x26c7bf[_0x5bf4('0xa')]||_0x14c519[_0x5bf4('0xa')]&&_0x14c519[_0x5bf4('0x13')]){logger[_0x5bf4('0x15')](_0x5bf4('0x16'));}if(_0x14c519[_0x5bf4('0xa')]&&!_0x14c519['data2']&&_0x14c519[_0x5bf4('0xa')]!=_0x26c7bf[_0x5bf4('0xa')]){logger[_0x5bf4('0x15')](_0x5bf4('0x17'));}if(_0x14c519['license']&&!_0x14c519[_0x5bf4('0x13')]&&_0x14c519['license']==_0x26c7bf['license']){return _0x5a7cce;}return _0x5a7cce['update']({'data1':_0x33d6ac,'data2':null,'license':_0x26c7bf[_0x5bf4('0xa')]});}else{if(_0x26c7bf[_0x5bf4('0xa')]||_0x14c519['license']){if(!_0x14c519[_0x5bf4('0x13')]){if(_0x14c519[_0x5bf4('0x12')]==_0x33d6ac){GRAY_PERIOD_REASON=_0x5bf4('0x18');logger[_0x5bf4('0x15')](_0x5bf4('0x19'));}else{GRAY_PERIOD_REASON=_0x5bf4('0x1a');logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x14c519['data1'],_0x33d6ac);}logger[_0x5bf4('0x15')](_0x5bf4('0x1b'),GRAY_PERIOD_REASON[_0x5bf4('0x1c')](),moment()[_0x5bf4('0xb')](_0x5bf4('0x1d')));return _0x5a7cce['update']({'data2':encryptor[_0x5bf4('0x1e')](moment()['format'](_0x5bf4('0x1d')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x14c519[_0x5bf4('0x13')]),'days')>DAYS){logger[_0x5bf4('0x15')]('DEMO\x20START\x20AT\x20%s',moment()[_0x5bf4('0xb')](_0x5bf4('0x1d')));isOldTokenSent=![];return _0x5a7cce[_0x5bf4('0x1f')]({'data1':_0x33d6ac,'data2':null,'license':null});}}}else{if(_0x14c519['data1']!=_0x33d6ac){logger[_0x5bf4('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x14c519[_0x5bf4('0x12')],_0x33d6ac);return _0x5a7cce[_0x5bf4('0x1f')]({'data1':_0x33d6ac,'data2':null,'license':null});}}}return _0x5a7cce;})[_0x5bf4('0xf')](function(_0x192a3d){_0x5a7cce=_0x192a3d;})[_0x5bf4('0x10')](function(_0x41e244){logger['error'](_0x41e244[_0x5bf4('0x20')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x5bf4('0x21')](),_0x5a7cce);},TIME);});}function defaultLicense(){var _0x2e9151=hardware['getUuid']();if(_0x2e9151){return db[_0x5bf4('0x22')][_0x5bf4('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x2e9151}})[_0x5bf4('0x24')](function(_0x30180d,_0x29023c){logger[_0x5bf4('0x15')](_0x5bf4('0x25'),_0x2e9151);manageLicense(_0x2e9151,_0x30180d);})[_0x5bf4('0x10')](function(_0x1883ee){logger[_0x5bf4('0x26')](_0x1883ee[_0x5bf4('0x20')]);});}}exports[_0x5bf4('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1a55d54..6d4afd7 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 _0x644b=['telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','defaults','then','catch','uuid','license','isEmpty','data1','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user'];(function(_0x285043,_0xee0e4e){var _0x54a553=function(_0x2c174c){while(--_0x2c174c){_0x285043['push'](_0x285043['shift']());}};_0x54a553(++_0xee0e4e);}(_0x644b,0x1b9));var _0xb644=function(_0x5aaf93,_0x5c0001){_0x5aaf93=_0x5aaf93-0x0;var _0x17d307=_0x644b[_0x5aaf93];return _0x17d307;};'use strict';var util=require('util');var _=require(_0xb644('0x0'));var moment=require(_0xb644('0x1'));var BPromise=require(_0xb644('0x2'));var hardware=require(_0xb644('0x3'));var encryptor=require('../../components/encryptor');var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb644('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xb644('0x5'),'machineUuid':hardware[_0xb644('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xb644('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xb644('0x7'),'machineUuid':hardware[_0xb644('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2423f9){return new BPromise(function(_0x464b03,_0x4793de){return db[_0xb644('0x8')]['find'](_[_0xb644('0x9')](_0x2423f9,{'raw':!![],'where':{'id':0x1}}))[_0xb644('0xa')](function(_0x2008b3){return checkLicense(_0x2008b3,null);})[_0xb644('0xa')](function(_0x4b0da3){_0x464b03(_0x4b0da3);return;})[_0xb644('0xb')](function(_0x2ef480){_0x4793de(_0x2ef480);});});}function checkLicense(_0x48126b,_0x2c54a3){if(!_0x48126b){demoLicense[_0xb644('0xc')]=_0x48126b['data1'];return demoLicense;}try{var _0x530cd8=_0x2c54a3||_0x48126b[_0xb644('0xd')];if(_[_0xb644('0xe')](_0x530cd8)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2ebbd4=_0x48126b[_0xb644('0xf')];var _0x837e0a=_0x48126b[_0xb644('0x10')];var _0x3f93b2=_0x2ebbd4[_0xb644('0x11')]('-')[0x4];var _0x25b3e3=_0x2ebbd4[_0xb644('0x11')]('-')[0x0];var _0x40b9cd=encryptor[_0xb644('0x12')](_0x530cd8,util[_0xb644('0x13')](_0xb644('0x14'),_0x3f93b2,_0x2ebbd4,_0x25b3e3));var _0x13e0e1=JSON[_0xb644('0x15')](_0x40b9cd);_0x13e0e1[_0xb644('0x16')]=![];_0x13e0e1[_0xb644('0xc')]=_0x2ebbd4;_0x13e0e1[_0xb644('0x17')]=hardware['getUuid']();if(_0x837e0a){var _0x31f29d=encryptor[_0xb644('0x12')](_0x837e0a);_0x13e0e1[_0xb644('0x18')]=_0x31f29d;_0x13e0e1['deadline']=moment(_0x31f29d)[_0xb644('0x19')](0x7,_0xb644('0x1a'))[_0xb644('0x13')]();_0x13e0e1[_0xb644('0x1b')]=_0x13e0e1['uuid']!=_0x13e0e1[_0xb644('0x17')]?_0xb644('0x1c'):_0xb644('0x1d');}return _0x13e0e1;}catch(_0x5f1aba){breakingLicense[_0xb644('0xc')]=_0x48126b[_0xb644('0xf')];breakingLicense['message']=_0x5f1aba[_0xb644('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x592a05,_0x24f358){getLicense()[_0xb644('0xa')](function(_0x567941){return db[_0xb644('0x1f')][_0xb644('0x20')]({'attributes':[_0xb644('0x21'),[db[_0xb644('0x22')]['fn'](_0xb644('0x23'),db[_0xb644('0x22')]['col']('role')),_0xb644('0x24')]],'group':'role','where':{'role':{'$or':[_0xb644('0x25'),_0xb644('0x26'),_0xb644('0x27')]}},'raw':!![]})['then'](function(_0x9370d5){var _0x455834={'user':_0x567941[_0xb644('0x28')]||0x0,'telephone':_0x567941[_0xb644('0x29')]||0x0};_0x9370d5[_0xb644('0x2a')](function(_0x293797){var _0x1dae86=_0x293797['role']===_0xb644('0x25')?_0xb644('0x26'):_0x293797[_0xb644('0x21')];_0x455834[_0x1dae86]-=_0x293797[_0xb644('0x24')];if(_0x455834[_0x1dae86]<0x0)_0x455834[_0x1dae86]=0x0;});_0x592a05(_0x455834);return;});})[_0xb644('0xb')](function(_0x1fd79a){_0x24f358(_0x1fd79a);});});}function checkUserLimits(_0x451daf){return new BPromise(function(_0x15b008,_0x21f866){getLimits()[_0xb644('0xa')](function(_0xd3b8e1){var _0x4fbbf8=_[_0xb644('0x2b')](_[_0xb644('0x2c')](_0x451daf,_0xb644('0x21')),['admin',_0xb644('0x26'),_0xb644('0x27')]);var _0x2e9dc2=(_0x4fbbf8['admin']||0x0)+(_0x4fbbf8['user']||0x0);var _0x51678b=_0x4fbbf8[_0xb644('0x27')]||0x0;if(_0x2e9dc2>_0xd3b8e1[_0xb644('0x26')])return _0x21f866(_0xb644('0x2d'));if(_0x51678b>_0xd3b8e1['telephone'])return _0x21f866(_0xb644('0x2e'));return _0x15b008();})[_0xb644('0xb')](function(_0x5adce0){_0x21f866(_0x5adce0);});});}module[_0xb644('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf980=['demo','deadline','add','days','grayReason','machineUuid','changed','disabled','User','findAll','role','sequelize','COUNT','col','user','telephone','telephones','forEach','admin','count','countBy','License\x20limit\x20reached\x20for\x20telephones','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf980,0x118));var _0x0f98=function(_0x50439d,_0x3aed4c){_0x50439d=_0x50439d-0x0;var _0x5dc279=_0xf980[_0x50439d];return _0x5dc279;};'use strict';var util=require('util');var _=require(_0x0f98('0x0'));var moment=require(_0x0f98('0x1'));var BPromise=require('bluebird');var hardware=require(_0x0f98('0x2'));var encryptor=require(_0x0f98('0x3'));var db=require(_0x0f98('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0f98('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x0f98('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0f98('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0f98('0x7'),'machineUuid':hardware[_0x0f98('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x27dcbc){return new BPromise(function(_0x387d89,_0x5af53b){return db['License'][_0x0f98('0x8')](_['defaults'](_0x27dcbc,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x2c4a0d){return checkLicense(_0x2c4a0d,null);})[_0x0f98('0x9')](function(_0x523399){_0x387d89(_0x523399);return;})[_0x0f98('0xa')](function(_0xc59445){_0x5af53b(_0xc59445);});});}function checkLicense(_0x436c60,_0xf67212){if(!_0x436c60){demoLicense[_0x0f98('0xb')]=_0x436c60[_0x0f98('0xc')];return demoLicense;}try{var _0x1c1aee=_0xf67212||_0x436c60[_0x0f98('0xd')];if(_[_0x0f98('0xe')](_0x1c1aee)){throw new Error(_0x0f98('0xf'));}var _0x361284=_0x436c60[_0x0f98('0xc')];var _0xd719ba=_0x436c60[_0x0f98('0x10')];var _0x46584f=_0x361284['split']('-')[0x4];var _0x11d55a=_0x361284[_0x0f98('0x11')]('-')[0x0];var _0x4b6479=encryptor[_0x0f98('0x12')](_0x1c1aee,util[_0x0f98('0x13')]('%s:%s:%s',_0x46584f,_0x361284,_0x11d55a));var _0x19aaba=JSON[_0x0f98('0x14')](_0x4b6479);_0x19aaba[_0x0f98('0x15')]=![];_0x19aaba[_0x0f98('0xb')]=_0x361284;_0x19aaba['machineUuid']=hardware['getUuid']();if(_0xd719ba){var _0x5b921e=encryptor[_0x0f98('0x12')](_0xd719ba);_0x19aaba['gray']=_0x5b921e;_0x19aaba[_0x0f98('0x16')]=moment(_0x5b921e)[_0x0f98('0x17')](0x7,_0x0f98('0x18'))['format']();_0x19aaba[_0x0f98('0x19')]=_0x19aaba[_0x0f98('0xb')]!=_0x19aaba[_0x0f98('0x1a')]?_0x0f98('0x1b'):_0x0f98('0x1c');}return _0x19aaba;}catch(_0x1abb38){breakingLicense[_0x0f98('0xb')]=_0x436c60['data1'];breakingLicense['message']=_0x1abb38['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x58fed1,_0x191f55){getLicense()[_0x0f98('0x9')](function(_0xe77fbf){return db[_0x0f98('0x1d')][_0x0f98('0x1e')]({'attributes':[_0x0f98('0x1f'),[db[_0x0f98('0x20')]['fn'](_0x0f98('0x21'),db[_0x0f98('0x20')][_0x0f98('0x22')]('role')),'count']],'group':'role','where':{'role':{'$or':['admin',_0x0f98('0x23'),_0x0f98('0x24')]}},'raw':!![]})['then'](function(_0x3fe703){var _0x53cdda={'user':_0xe77fbf['users']||0x0,'telephone':_0xe77fbf[_0x0f98('0x25')]||0x0};_0x3fe703[_0x0f98('0x26')](function(_0x476baf){var _0x2ee144=_0x476baf[_0x0f98('0x1f')]===_0x0f98('0x27')?'user':_0x476baf[_0x0f98('0x1f')];_0x53cdda[_0x2ee144]-=_0x476baf[_0x0f98('0x28')];if(_0x53cdda[_0x2ee144]<0x0)_0x53cdda[_0x2ee144]=0x0;});_0x58fed1(_0x53cdda);return;});})['catch'](function(_0x12c0ed){_0x191f55(_0x12c0ed);});});}function checkUserLimits(_0x30d1e0){return new BPromise(function(_0x345d18,_0x36eecc){getLimits()[_0x0f98('0x9')](function(_0x37f4d6){var _0x5d18f3=_['pick'](_[_0x0f98('0x29')](_0x30d1e0,_0x0f98('0x1f')),['admin',_0x0f98('0x23'),_0x0f98('0x24')]);var _0x5ecd80=(_0x5d18f3[_0x0f98('0x27')]||0x0)+(_0x5d18f3[_0x0f98('0x23')]||0x0);var _0x5b19d8=_0x5d18f3[_0x0f98('0x24')]||0x0;if(_0x5ecd80>_0x37f4d6[_0x0f98('0x23')])return _0x36eecc('License\x20limit\x20reached\x20for\x20users');if(_0x5b19d8>_0x37f4d6[_0x0f98('0x24')])return _0x36eecc(_0x0f98('0x2a'));return _0x345d18();})['catch'](function(_0xa73373){_0x36eecc(_0xa73373);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index d29a277..943fbff 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 _0x056b=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x3d42d6,_0x481a22){var _0x3a3060=function(_0x5b0bfc){while(--_0x5b0bfc){_0x3d42d6['push'](_0x3d42d6['shift']());}};_0x3a3060(++_0x481a22);}(_0x056b,0xb6));var _0xb056=function(_0x46a635,_0x3cf6f0){_0x46a635=_0x46a635-0x0;var _0xff72f1=_0x056b[_0x46a635];return _0xff72f1;};'use strict';module['exports']={'DOMAIN':_0xb056('0x0'),'SESSION_SECRET':_0xb056('0x1'),'GOOGLE_ID':_0xb056('0x2'),'GOOGLE_SECRET':_0xb056('0x3'),'DEBUG':''}; \ No newline at end of file +var _0x955f=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x2f1a92,_0x2eff28){var _0x279dd1=function(_0x254ec8){while(--_0x254ec8){_0x2f1a92['push'](_0x2f1a92['shift']());}};_0x279dd1(++_0x2eff28);}(_0x955f,0x1eb));var _0xf955=function(_0x1d39f7,_0xec3956){_0x1d39f7=_0x1d39f7-0x0;var _0x39e246=_0x955f[_0x1d39f7];return _0x39e246;};'use strict';module[_0xf955('0x0')]={'DOMAIN':_0xf955('0x1'),'SESSION_SECRET':_0xf955('0x2'),'GOOGLE_ID':_0xf955('0x3'),'GOOGLE_SECRET':_0xf955('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 95b08b6..214cb5f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee8c=['exports','../utils/loggers','fileLogger'];(function(_0x2de697,_0x1cba29){var _0x36bc45=function(_0x4c4390){while(--_0x4c4390){_0x2de697['push'](_0x2de697['shift']());}};_0x36bc45(++_0x1cba29);}(_0xee8c,0x7f));var _0xcee8=function(_0x12f180,_0x37da58){_0x12f180=_0x12f180-0x0;var _0x589aec=_0xee8c[_0x12f180];return _0x589aec;};'use strict';var fileLogger=require(_0xcee8('0x0'))[_0xcee8('0x1')];module[_0xcee8('0x2')]=fileLogger; \ No newline at end of file +var _0x2a7d=['../utils/loggers','exports'];(function(_0x2dd92e,_0x5fb8e4){var _0x1c75e8=function(_0x229437){while(--_0x229437){_0x2dd92e['push'](_0x2dd92e['shift']());}};_0x1c75e8(++_0x5fb8e4);}(_0x2a7d,0xc4));var _0xd2a7=function(_0x4ffcba,_0xeac651){_0x4ffcba=_0x4ffcba-0x0;var _0xff9510=_0x2a7d[_0x4ffcba];return _0xff9510;};'use strict';var fileLogger=require(_0xd2a7('0x0'))['fileLogger'];module[_0xd2a7('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index ec3e5fa..e9d014e 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 _0xb6c4=['exports','path','express','ami','join','agi','email','routing','../../services/xdr/index.js'];(function(_0x103478,_0x33f5f0){var _0x5b2b02=function(_0x5ab720){while(--_0x5ab720){_0x103478['push'](_0x103478['shift']());}};_0x5b2b02(++_0x33f5f0);}(_0xb6c4,0xbe));var _0x4b6c=function(_0x3ffbab,_0x2ee1b4){_0x3ffbab=_0x3ffbab-0x0;var _0x42b220=_0xb6c4[_0x3ffbab];return _0x42b220;};'use strict';var path=require(_0x4b6c('0x0'));var os=require('os');var config={'apps':[{'name':_0x4b6c('0x1'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':_0x4b6c('0x2'),'script':path[_0x4b6c('0x3')](__dirname,'../../services/ami/index.js')},{'name':_0x4b6c('0x4'),'script':path['join'](__dirname,'../../services/agi/index.js')},{'name':_0x4b6c('0x5'),'script':path[_0x4b6c('0x3')](__dirname,'../../services/email/index.js')},{'name':_0x4b6c('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0x4b6c('0x3')](__dirname,_0x4b6c('0x7'))}]};module[_0x4b6c('0x8')]=config; \ No newline at end of file +var _0x0dd1=['../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','agi'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x0dd1,0x125));var _0x10dd=function(_0x3a55a7,_0x1c2b0a){_0x3a55a7=_0x3a55a7-0x0;var _0x5caec0=_0x0dd1[_0x3a55a7];return _0x5caec0;};'use strict';var path=require(_0x10dd('0x0'));var os=require('os');var config={'apps':[{'name':_0x10dd('0x1'),'script':path[_0x10dd('0x2')](__dirname,_0x10dd('0x3'))},{'name':_0x10dd('0x4'),'script':path[_0x10dd('0x2')](__dirname,'../../services/ami/index.js')},{'name':_0x10dd('0x5'),'script':path['join'](__dirname,_0x10dd('0x6'))},{'name':_0x10dd('0x7'),'script':path[_0x10dd('0x2')](__dirname,_0x10dd('0x8'))},{'name':'routing','script':path['join'](__dirname,_0x10dd('0x9'))},{'name':_0x10dd('0xa'),'script':path[_0x10dd('0x2')](__dirname,_0x10dd('0xb'))}]};module[_0x10dd('0xc')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index e45a536..0fd1736 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 _0xe37e=['then','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connected','start','disconnect','stop'];(function(_0xaca658,_0x19feee){var _0x35079a=function(_0x5677d2){while(--_0x5677d2){_0xaca658['push'](_0xaca658['shift']());}};_0x35079a(++_0x19feee);}(_0xe37e,0xf5));var _0xee37=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0xe37e[_0x39d544];return _0x5a5ff2;};'use strict';var pm2=require(_0xee37('0x0'));var BPromise=require(_0xee37('0x1'));var config=require(_0xee37('0x2'));function connect(){return new BPromise(function(_0x34aed0,_0x282d8a){return pm2['connect'](function(_0x166c99){if(_0x166c99){return _0x282d8a(_0x166c99);}return _0x34aed0(_0xee37('0x3'));});});};exports[_0xee37('0x4')]=function(_0x5cc387){return connect()['then'](function(){return new BPromise(function(_0x35cae6,_0x18c344){return pm2[_0xee37('0x4')](_0x5cc387,function(_0x57bb3d,_0x3b7369){if(_0x57bb3d){return _0x18c344(_0x57bb3d);}pm2[_0xee37('0x5')]();return _0x35cae6(_0x3b7369);});});});};exports[_0xee37('0x6')]=function(_0x42deb1){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x1bf500,_0x2135ae){return pm2[_0xee37('0x6')](_0x42deb1,function(_0x5d5593,_0x1848ad){if(_0x5d5593){return _0x2135ae(_0x5d5593);}pm2[_0xee37('0x5')]();return _0x1bf500(_0x1848ad);});});});};exports[_0xee37('0x8')]=function(_0x12b331){return connect()['then'](function(){return new BPromise(function(_0x339df0,_0xe3a1bc){return pm2['restart'](_0x12b331,function(_0x29ba10,_0x47783f){if(_0x29ba10){return _0xe3a1bc(_0x29ba10);}pm2[_0xee37('0x5')]();return _0x339df0(_0x47783f);});});});};exports['list']=function(){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x2a4c5d,_0x3bd4d6){return pm2[_0xee37('0x9')](function(_0x38b3ef,_0x1a7f3e){if(_0x38b3ef){return _0x3bd4d6(_0x38b3ef);}pm2[_0xee37('0x5')]();return _0x2a4c5d(_0x1a7f3e);});});});};exports[_0xee37('0xa')]=function(_0x169846){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0xf16d48,_0x57fa41){return pm2[_0xee37('0xa')](_0x169846,function(_0x9a88fc,_0x323555){if(_0x9a88fc){return _0x57fa41(_0x9a88fc);}pm2[_0xee37('0x5')]();return _0xf16d48(_0x323555);});});});};exports[_0xee37('0xb')]=function(_0x10639e){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x142460,_0x2bc8d1){return pm2[_0xee37('0xb')](_0x10639e,function(_0x18b53d,_0x3bd3ed){if(_0x18b53d){return _0x2bc8d1(_0x18b53d);}pm2['disconnect']();return _0x142460(_0x3bd3ed);});});});};exports['dump']=function(){return connect()[_0xee37('0x7')](function(){return new BPromise(function(_0x1ce9c5,_0x471644){return pm2[_0xee37('0xc')](function(_0x3791b4){if(_0x3791b4){return _0x471644(_0x3791b4);}return _0x1ce9c5(_0xee37('0xd'));});});});}; \ No newline at end of file +var _0x8f53=['delete','dump','saved','pm2','./config','connect','start','disconnect','stop','restart','list','then','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f53,0xed));var _0x38f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f53[_0x20a584];return _0x4b41a8;};'use strict';var pm2=require(_0x38f5('0x0'));var BPromise=require('bluebird');var config=require(_0x38f5('0x1'));function connect(){return new BPromise(function(_0x15ff53,_0x4f9df9){return pm2[_0x38f5('0x2')](function(_0x1a68e7){if(_0x1a68e7){return _0x4f9df9(_0x1a68e7);}return _0x15ff53('connected');});});};exports[_0x38f5('0x3')]=function(_0x2882aa){return connect()['then'](function(){return new BPromise(function(_0x10fb5f,_0x684a04){return pm2[_0x38f5('0x3')](_0x2882aa,function(_0x5489,_0x583282){if(_0x5489){return _0x684a04(_0x5489);}pm2[_0x38f5('0x4')]();return _0x10fb5f(_0x583282);});});});};exports[_0x38f5('0x5')]=function(_0x513732){return connect()['then'](function(){return new BPromise(function(_0x645b33,_0x45bc19){return pm2[_0x38f5('0x5')](_0x513732,function(_0x19d0bc,_0x3c7656){if(_0x19d0bc){return _0x45bc19(_0x19d0bc);}pm2[_0x38f5('0x4')]();return _0x645b33(_0x3c7656);});});});};exports[_0x38f5('0x6')]=function(_0x28c1b2){return connect()['then'](function(){return new BPromise(function(_0x10ccf8,_0x140850){return pm2[_0x38f5('0x6')](_0x28c1b2,function(_0x31311a,_0x55aa6f){if(_0x31311a){return _0x140850(_0x31311a);}pm2['disconnect']();return _0x10ccf8(_0x55aa6f);});});});};exports[_0x38f5('0x7')]=function(){return connect()[_0x38f5('0x8')](function(){return new BPromise(function(_0x513e4f,_0x4394f1){return pm2[_0x38f5('0x7')](function(_0x57d954,_0x173026){if(_0x57d954){return _0x4394f1(_0x57d954);}pm2[_0x38f5('0x4')]();return _0x513e4f(_0x173026);});});});};exports[_0x38f5('0x9')]=function(_0x149891){return connect()[_0x38f5('0x8')](function(){return new BPromise(function(_0x1e3c6e,_0x554cdf){return pm2[_0x38f5('0x9')](_0x149891,function(_0x1537ac,_0x58ad81){if(_0x1537ac){return _0x554cdf(_0x1537ac);}pm2[_0x38f5('0x4')]();return _0x1e3c6e(_0x58ad81);});});});};exports[_0x38f5('0xa')]=function(_0x2078e3){return connect()[_0x38f5('0x8')](function(){return new BPromise(function(_0x1ab753,_0x38e419){return pm2['delete'](_0x2078e3,function(_0x487185,_0x109284){if(_0x487185){return _0x38e419(_0x487185);}pm2[_0x38f5('0x4')]();return _0x1ab753(_0x109284);});});});};exports[_0x38f5('0xb')]=function(){return connect()[_0x38f5('0x8')](function(){return new BPromise(function(_0x22a45f,_0x330af3){return pm2[_0x38f5('0xb')](function(_0x4cd98b){if(_0x4cd98b){return _0x330af3(_0x4cd98b);}return _0x22a45f(_0x38f5('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 84588a1..b23fe93 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 _0x2feb=['minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','Setting','chatTimeout','ChatInteraction','lastMsgAt'];(function(_0x325fd8,_0x43c0e4){var _0x5b3c9a=function(_0x5c17f7){while(--_0x5c17f7){_0x325fd8['push'](_0x325fd8['shift']());}};_0x5b3c9a(++_0x43c0e4);}(_0x2feb,0x6f));var _0xb2fe=function(_0x5e5c7b,_0x2495a3){_0x5e5c7b=_0x5e5c7b-0x0;var _0x3f947f=_0x2feb[_0x5e5c7b];return _0x3f947f;};'use strict';var _=require(_0xb2fe('0x0'));var moment=require(_0xb2fe('0x1'));var Redis=require(_0xb2fe('0x2'));var util=require('util');var config=require(_0xb2fe('0x3'));var db=require(_0xb2fe('0x4'))['db'];var logger=require(_0xb2fe('0x5'))(_0xb2fe('0x6'));config[_0xb2fe('0x7')]=_['defaults'](config[_0xb2fe('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xb2fe('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x2a458e=0x0;var _0x299ace=[];return db[_0xb2fe('0x9')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x5184f6){_0x2a458e=_0x5184f6[_0xb2fe('0xa')];if(_0x2a458e){return db[_0xb2fe('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb2fe('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x5184f6[_0xb2fe('0xa')],_0xb2fe('0xd'))}}});}else{return[];}})[_0xb2fe('0xe')](function(_0x472389){if(_0x472389&&_0x472389[_0xb2fe('0xf')]){_0x299ace=_[_0xb2fe('0x10')](_0x472389||[],'id');logger[_0xb2fe('0x11')](_0xb2fe('0x12'),_0x299ace['join']());return db['ChatInteraction'][_0xb2fe('0x13')]({'closeReason':_0xb2fe('0x14'),'disposition':_0xb2fe('0x15'),'closed':!![],'closedAt':moment()[_0xb2fe('0x16')](_0xb2fe('0x17'))},{'where':{'id':_0x299ace}});}})['then'](function(){if(_0x299ace&&_0x299ace[_0xb2fe('0xf')]){logger[_0xb2fe('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x299ace['join']());for(var _0x1959fa=0x0;_0x1959fa<_0x299ace[_0xb2fe('0xf')];_0x1959fa++){io[_0xb2fe('0x18')](_0xb2fe('0x19'),{'id':_0x299ace[_0x1959fa],'closed':!![]});}}})[_0xb2fe('0x1a')](function(_0x88a3ee){logger[_0xb2fe('0x1b')](_0xb2fe('0x1c'),_0x88a3ee?util[_0xb2fe('0x1d')](_0x88a3ee,{'showHidden':![],'depth':null}):'');});}exports[_0xb2fe('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x305b=['schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','inspect','start','util','../../config/environment','../../mysqldb'];(function(_0x15bb2d,_0x6c549a){var _0x3fdbb7=function(_0x3e2ea5){while(--_0x3e2ea5){_0x15bb2d['push'](_0x15bb2d['shift']());}};_0x3fdbb7(++_0x6c549a);}(_0x305b,0x69));var _0xb305=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x305b[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0xb305('0x0'));var config=require(_0xb305('0x1'));var db=require(_0xb305('0x2'))['db'];var logger=require('../logger')(_0xb305('0x3'));config[_0xb305('0x4')]=_['defaults'](config[_0xb305('0x4')],{'host':_0xb305('0x5'),'port':0x18eb});var io=require(_0xb305('0x6'))(new Redis(config['redis']));function closeInteractions(){var _0x405b9b=0x0;var _0x42f53c=[];return db[_0xb305('0x7')][_0xb305('0x8')]({'raw':!![],'attributes':['id',_0xb305('0x9')],'where':{'id':0x1}})[_0xb305('0xa')](function(_0x209fd6){_0x405b9b=_0x209fd6[_0xb305('0x9')];if(_0x405b9b){return db[_0xb305('0xb')]['findAll']({'raw':!![],'attributes':['id',_0xb305('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x209fd6['chatTimeout'],'minutes')}}});}else{return[];}})[_0xb305('0xa')](function(_0x328b79){if(_0x328b79&&_0x328b79['length']){_0x42f53c=_['map'](_0x328b79||[],'id');logger[_0xb305('0xd')](_0xb305('0xe'),_0x42f53c['join']());return db[_0xb305('0xb')][_0xb305('0xf')]({'closeReason':_0xb305('0x10'),'disposition':_0xb305('0x11'),'closed':!![],'closedAt':moment()[_0xb305('0x12')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x42f53c}});}})[_0xb305('0xa')](function(){if(_0x42f53c&&_0x42f53c[_0xb305('0x13')]){logger['info'](_0xb305('0x14'),_0x42f53c['join']());for(var _0x23d553=0x0;_0x23d553<_0x42f53c[_0xb305('0x13')];_0x23d553++){io[_0xb305('0x15')](_0xb305('0x16'),{'id':_0x42f53c[_0x23d553],'closed':!![]});}}})[_0xb305('0x17')](function(_0x1f85ee){logger[_0xb305('0x18')]('[CHAT]\x20Error\x20closing\x20interactions',_0x1f85ee?util[_0xb305('0x19')](_0x1f85ee,{'showHidden':![],'depth':null}):'');});}exports[_0xb305('0x1a')]=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 cd0f9e9..512ed68 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 _0xe2d6=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x449c96,_0x4428d9){var _0x528e73=function(_0x34bdaa){while(--_0x34bdaa){_0x449c96['push'](_0x449c96['shift']());}};_0x528e73(++_0x4428d9);}(_0xe2d6,0xae));var _0x6e2d=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xe2d6[_0x3fe6df];return _0x372a0e;};'use strict';function start(){var _0x5c821a=require(_0x6e2d('0x0'));return _0x5c821a[_0x6e2d('0x1')]();}module[_0x6e2d('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x29cf=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x312b37,_0x19f474){var _0x2e5f91=function(_0x19473d){while(--_0x19473d){_0x312b37['push'](_0x312b37['shift']());}};_0x2e5f91(++_0x19f474);}(_0x29cf,0x92));var _0xf29c=function(_0x369bc5,_0x17821f){_0x369bc5=_0x369bc5-0x0;var _0x395655=_0x29cf[_0x369bc5];return _0x395655;};'use strict';function start(){var _0x2f9fc7=require(_0xf29c('0x0'));return _0x2f9fc7[_0xf29c('0x1')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 7f64bd5..53d78c6 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 _0xd364=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','data','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','format','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','CloudProvider','jobs','map','toString','keyBy','difference','intersection','length','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','cron','active','isBetween','startAt','endAt','add','add\x20cron','exists','stop\x20cron','run','start','util','lodash','cron-job-manager','jayson/promise','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','extname','zip','existsSync','status','Sent','message','text'];(function(_0x3cc8cb,_0x31f8fe){var _0x427615=function(_0x4dda8e){while(--_0x4dda8e){_0x3cc8cb['push'](_0x3cc8cb['shift']());}};_0x427615(++_0x31f8fe);}(_0xd364,0x8a));var _0x4d36=function(_0x2ec225,_0x127c27){_0x2ec225=_0x2ec225-0x0;var _0x3c2395=_0xd364[_0x2ec225];return _0x3c2395;};'use strict';var fs=require('fs');var util=require(_0x4d36('0x0'));var path=require('path');var _=require(_0x4d36('0x1'));var moment=require('moment');var CronJobManager=require(_0x4d36('0x2'));var jayson=require(_0x4d36('0x3'));var BPromise=require('bluebird');var logger=require(_0x4d36('0x4'))(_0x4d36('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x4d36('0x6'));var analyticDefaultReportController=require(_0x4d36('0x7'));var client=jayson[_0x4d36('0x8')][_0x4d36('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x37e8e0,_0x459607){return function(){logger[_0x4d36('0xa')](_0x4d36('0xb'),_0x37e8e0[_0x4d36('0xc')]);var _0x5e84d1=!![];var _0x3112d3=_0x37e8e0['MailAccount'][_0x4d36('0xd')]();var _0x22b74d={'account':_0x3112d3,'message':{'from':util['format'](_0x4d36('0xe'),_0x37e8e0[_0x4d36('0xf')][_0x4d36('0x10')],_0x37e8e0['MailAccount']['email']||_0x37e8e0[_0x4d36('0xf')][_0x4d36('0x11')][_0x4d36('0x12')]),'to':_0x37e8e0[_0x4d36('0xc')],'cc':_0x37e8e0['cc'],'bcc':_0x37e8e0['bcc'],'subject':util['format'](_0x4d36('0x13'),_0x459607[_0x4d36('0x10')],_0x37e8e0[_0x4d36('0x14')],_0x37e8e0['subtractUnit'])}};var _0x30ce1a=path[_0x4d36('0x15')](__dirname,_0x4d36('0x16'));var _0x1ba3f0=_0x459607[_0x4d36('0x17')];var _0x7d8938=util['format'](_0x4d36('0x18'),path['basename'](_0x459607['savename'],path[_0x4d36('0x19')](_0x459607[_0x4d36('0x17')])),_0x4d36('0x1a'));var _0x3f9a1d=path[_0x4d36('0x15')](_0x30ce1a,_0x1ba3f0);var _0x45b649=path[_0x4d36('0x15')](_0x30ce1a,_0x7d8938);if(fs[_0x4d36('0x1b')](_0x3f9a1d)){_0x459607[_0x4d36('0x1c')]=_0x4d36('0x1d');_0x22b74d['message']['attachments']=[{'filename':_0x1ba3f0,'path':_0x3f9a1d}];_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x1f')]=util['format'](_0x4d36('0x20'),JSON[_0x4d36('0x21')](_0x459607,null,0x2));}else if(fs[_0x4d36('0x1b')](_0x45b649)){_0x459607[_0x4d36('0x1c')]=_0x4d36('0x1d');_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x22')]=[{'filename':_0x7d8938,'path':_0x45b649}];}else{_0x22b74d[_0x4d36('0x1e')][_0x4d36('0x1f')]=_0x4d36('0x23');if(!_0x37e8e0[_0x4d36('0x24')]){_0x5e84d1=![];logger['info'](_0x4d36('0x25'));}}if(_0x5e84d1){return client[_0x4d36('0x26')]('SendMail',_0x22b74d)[_0x4d36('0x27')](function(_0x505e2b){if(_0x505e2b['error']){return logger[_0x4d36('0x28')](_0x4d36('0x29'),JSON['stringify'](_0x505e2b));}return logger[_0x4d36('0xa')]('email\x20sent');})['catch'](function(_0x366ac4){return logger[_0x4d36('0x28')](_0x4d36('0x29'),JSON[_0x4d36('0x21')](_0x366ac4));});}};}function handleError(){return function(_0x1d5e26){return logger[_0x4d36('0x28')](JSON[_0x4d36('0x21')](_0x1d5e26));};}function handleResult(_0x185903){return function(_0x1e51be){logger['info'](_0x4d36('0x2a'),JSON['stringify'](_0x1e51be));if(_0x185903['MailAccount']&&_0x185903['MailAccount'][_0x4d36('0x11')]&&!_['isNil'](_0x185903[_0x4d36('0xc')])){setTimeout(handleSendEmail(_0x185903,_0x1e51be),0x3c*0x3e8);}};}function handleJob(_0x781b7){return function(){try{if(_[_0x4d36('0x2b')](_0x781b7[_0x4d36('0x14')])){return logger[_0x4d36('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x4d36('0x2b')](_0x781b7[_0x4d36('0x2c')])){return logger['info'](_0x4d36('0x2d'));}var _0xc9af2d={'startDate':moment()[_0x4d36('0x2e')](_0x781b7['subtractNumber'],_0x781b7[_0x4d36('0x2c')])[_0x4d36('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x4d36('0x2f')](_0x4d36('0x30')),'type':_0x4d36('0x31'),'output':_0x781b7[_0x4d36('0x32')],'name':_0x781b7[_0x4d36('0x10')]};if(!_['isNil'](_0x781b7['DefaultReportId'])){logger[_0x4d36('0xa')](_0x4d36('0x33'),_0x781b7[_0x4d36('0x34')]);return analyticDefaultReportController[_0x4d36('0x35')]({'id':_0x781b7[_0x4d36('0x34')]},_0xc9af2d)[_0x4d36('0x27')](handleResult(_0x781b7))[_0x4d36('0x36')](handleError());}if(!_['isNil'](_0x781b7[_0x4d36('0x37')])){logger[_0x4d36('0xa')](_0x4d36('0x38'),_0x781b7[_0x4d36('0x37')]);return analyticCustomReportController['runReport']({'id':_0x781b7[_0x4d36('0x37')]},_0xc9af2d)[_0x4d36('0x27')](handleResult(_0x781b7))[_0x4d36('0x36')](handleError());}}catch(_0x29d70f){logger[_0x4d36('0x28')](JSON['stringify'](_0x29d70f));}return logger[_0x4d36('0xa')]('no\x20report\x20id');};}function getJobs(_0x18610e){var _0x123843={};if(_0x18610e){_0x123843['id']=_0x18610e;}return db[_0x4d36('0x39')][_0x4d36('0x3a')]({'where':_0x123843,'include':[{'model':db['MailAccount'],'attributes':['id',_0x4d36('0x10'),'email'],'include':[{'model':db[_0x4d36('0x3b')],'as':'Smtp','include':[{'model':db[_0x4d36('0x3c')],'as':'CloudProvider'}]}]}]})[_0x4d36('0x27')](function(_0x13d927){var _0x121bde=_['keys'](manager[_0x4d36('0x3d')]);var _0x47a59c=_[_0x4d36('0x3e')](_0x13d927,function(_0x494839){return _0x494839['id'][_0x4d36('0x3f')]();});var _0x7c43ac=_[_0x4d36('0x40')](_0x13d927,function(_0x166899){return _0x166899['id'][_0x4d36('0x3f')]();});var _0xf99229=_0x18610e?_0x47a59c:_[_0x4d36('0x41')](_0x47a59c,_0x121bde);var _0x493ab8=_[_0x4d36('0x42')](_0x47a59c,_0x121bde);var _0x37c982=_['difference'](_0x121bde,_0x47a59c);var _0xd954b9;var _0x3bbcb9;for(_0xd954b9=0x0;_0xd954b9<_0x37c982[_0x4d36('0x43')]&&!_0x18610e;_0xd954b9+=0x1){_0x3bbcb9=_0x37c982[_0xd954b9][_0x4d36('0x3f')]();if(manager['exists'](_0x3bbcb9)){manager[_0x4d36('0x44')](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x46'),_0x3bbcb9);}}logger[_0x4d36('0xa')](_0x4d36('0x47'),JSON[_0x4d36('0x21')](_0xf99229));for(_0xd954b9=0x0;_0xd954b9<_0xf99229['length'];_0xd954b9+=0x1){_0x3bbcb9=_0xf99229[_0xd954b9][_0x4d36('0x3f')]();logger[_0x4d36('0xa')](_0x4d36('0x48'),_0x3bbcb9);if(_0x18610e){logger['info'](_0x4d36('0x49'),_0x18610e);logger['info'](JSON[_0x4d36('0x21')](_0x7c43ac[_0x3bbcb9]));BPromise['resolve']()[_0x4d36('0x27')](handleJob(_0x7c43ac[_0x3bbcb9]));logger[_0x4d36('0xa')]('run\x20job',_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else if(_0x7c43ac[_0x3bbcb9]['cron']&&_0x7c43ac[_0x3bbcb9][_0x4d36('0x4b')]&&moment()[_0x4d36('0x4c')](_0x7c43ac[_0x3bbcb9][_0x4d36('0x4d')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4e')])){manager[_0x4d36('0x4f')](_0x3bbcb9,_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')],handleJob(_0x7c43ac[_0x3bbcb9]));manager['start'](_0x3bbcb9);logger['info'](_0x4d36('0x50'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else if(manager[_0x4d36('0x51')](_0x3bbcb9)){manager['stop'](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x52'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}}for(_0xd954b9=0x0,_0x3bbcb9;_0xd954b9<_0x493ab8['length']&&!_0x18610e;_0xd954b9+=0x1){_0x3bbcb9=_0x493ab8[_0xd954b9]['toString']();if(manager[_0x4d36('0x51')](_0x3bbcb9)){if(_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]&&_0x7c43ac[_0x3bbcb9][_0x4d36('0x4b')]&&moment()[_0x4d36('0x4c')](_0x7c43ac[_0x3bbcb9][_0x4d36('0x4d')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4e')])){manager['update'](_0x3bbcb9,_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')],handleJob(_0x7c43ac[_0x3bbcb9]));logger['info']('update\x20cron',_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}else{manager[_0x4d36('0x44')](_0x3bbcb9);manager[_0x4d36('0x45')](_0x3bbcb9);logger[_0x4d36('0xa')](_0x4d36('0x52'),_0x7c43ac[_0x3bbcb9][_0x4d36('0x10')],_0x7c43ac[_0x3bbcb9][_0x4d36('0x4a')]);}}}})['catch'](function(_0x3ae640){logger['error'](JSON[_0x4d36('0x21')](_0x3ae640));});}exports[_0x4d36('0x53')]=function(_0x12a274){return getJobs(_0x12a274);};exports[_0x4d36('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xac5d=['no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','toString','keyBy','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','add\x20cron','exists','active','stop\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','%s.%s','extname','savename','zip','existsSync','status','Sent','attachments','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','SendMail','error','error\x20mail','stringify','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','then'];(function(_0xc16c2e,_0x1daf17){var _0x2f0d06=function(_0x12ced3){while(--_0x12ced3){_0xc16c2e['push'](_0xc16c2e['shift']());}};_0x2f0d06(++_0x1daf17);}(_0xac5d,0x114));var _0xdac5=function(_0x26c1ff,_0xb7c424){_0x26c1ff=_0x26c1ff-0x0;var _0xa7f0ee=_0xac5d[_0x26c1ff];return _0xa7f0ee;};'use strict';var fs=require('fs');var util=require(_0xdac5('0x0'));var path=require(_0xdac5('0x1'));var _=require(_0xdac5('0x2'));var moment=require(_0xdac5('0x3'));var CronJobManager=require(_0xdac5('0x4'));var jayson=require(_0xdac5('0x5'));var BPromise=require(_0xdac5('0x6'));var logger=require(_0xdac5('0x7'))(_0xdac5('0x8'));var db=require(_0xdac5('0x9'))['db'];var analyticCustomReportController=require(_0xdac5('0xa'));var analyticDefaultReportController=require(_0xdac5('0xb'));var client=jayson['client'][_0xdac5('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x63080e,_0x5f48bc){return function(){logger[_0xdac5('0xd')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x63080e[_0xdac5('0xe')]);var _0x598c06=!![];var _0x4cba9c=_0x63080e['MailAccount'][_0xdac5('0xf')]();var _0x15c64f={'account':_0x4cba9c,'message':{'from':util[_0xdac5('0x10')](_0xdac5('0x11'),_0x63080e[_0xdac5('0x12')][_0xdac5('0x13')],_0x63080e[_0xdac5('0x12')][_0xdac5('0xe')]||_0x63080e[_0xdac5('0x12')][_0xdac5('0x14')][_0xdac5('0x15')]),'to':_0x63080e['email'],'cc':_0x63080e['cc'],'bcc':_0x63080e[_0xdac5('0x16')],'subject':util['format'](_0xdac5('0x17'),_0x5f48bc[_0xdac5('0x13')],_0x63080e[_0xdac5('0x18')],_0x63080e[_0xdac5('0x19')])}};var _0x46f9c8=path[_0xdac5('0x1a')](__dirname,_0xdac5('0x1b'));var _0x143b92=_0x5f48bc['savename'];var _0x3c934d=util[_0xdac5('0x10')](_0xdac5('0x1c'),path['basename'](_0x5f48bc['savename'],path[_0xdac5('0x1d')](_0x5f48bc[_0xdac5('0x1e')])),_0xdac5('0x1f'));var _0x98f6fb=path[_0xdac5('0x1a')](_0x46f9c8,_0x143b92);var _0x5e1990=path[_0xdac5('0x1a')](_0x46f9c8,_0x3c934d);if(fs[_0xdac5('0x20')](_0x98f6fb)){_0x5f48bc[_0xdac5('0x21')]=_0xdac5('0x22');_0x15c64f['message'][_0xdac5('0x23')]=[{'filename':_0x143b92,'path':_0x98f6fb}];_0x15c64f[_0xdac5('0x24')][_0xdac5('0x25')]=util['format'](_0xdac5('0x26'),JSON['stringify'](_0x5f48bc,null,0x2));}else if(fs[_0xdac5('0x20')](_0x5e1990)){_0x5f48bc['status']='Sent';_0x15c64f[_0xdac5('0x24')][_0xdac5('0x23')]=[{'filename':_0x3c934d,'path':_0x5e1990}];}else{_0x15c64f[_0xdac5('0x24')][_0xdac5('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x63080e['sendIfEmpty']){_0x598c06=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x598c06){return client['request'](_0xdac5('0x27'),_0x15c64f)['then'](function(_0x2234a5){if(_0x2234a5[_0xdac5('0x28')]){return logger['error'](_0xdac5('0x29'),JSON[_0xdac5('0x2a')](_0x2234a5));}return logger[_0xdac5('0xd')]('email\x20sent');})[_0xdac5('0x2b')](function(_0x5f23c2){return logger['error'](_0xdac5('0x29'),JSON[_0xdac5('0x2a')](_0x5f23c2));});}};}function handleError(){return function(_0x109713){return logger['error'](JSON[_0xdac5('0x2a')](_0x109713));};}function handleResult(_0x1ea702){return function(_0x245f4c){logger[_0xdac5('0xd')](_0xdac5('0x2c'),JSON[_0xdac5('0x2a')](_0x245f4c));if(_0x1ea702[_0xdac5('0x12')]&&_0x1ea702[_0xdac5('0x12')][_0xdac5('0x14')]&&!_[_0xdac5('0x2d')](_0x1ea702[_0xdac5('0xe')])){setTimeout(handleSendEmail(_0x1ea702,_0x245f4c),0x3c*0x3e8);}};}function handleJob(_0x365220){return function(){try{if(_[_0xdac5('0x2d')](_0x365220[_0xdac5('0x18')])){return logger['info'](_0xdac5('0x2e'));}if(_[_0xdac5('0x2d')](_0x365220['subtractUnit'])){return logger[_0xdac5('0xd')](_0xdac5('0x2f'));}var _0x54f00f={'startDate':moment()['subtract'](_0x365220[_0xdac5('0x18')],_0x365220[_0xdac5('0x19')])[_0xdac5('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xdac5('0x30'),'output':_0x365220[_0xdac5('0x31')],'name':_0x365220['name']};if(!_[_0xdac5('0x2d')](_0x365220[_0xdac5('0x32')])){logger[_0xdac5('0xd')](_0xdac5('0x33'),_0x365220['DefaultReportId']);return analyticDefaultReportController[_0xdac5('0x34')]({'id':_0x365220[_0xdac5('0x32')]},_0x54f00f)['then'](handleResult(_0x365220))['catch'](handleError());}if(!_[_0xdac5('0x2d')](_0x365220['CustomReportId'])){logger[_0xdac5('0xd')](_0xdac5('0x35'),_0x365220[_0xdac5('0x36')]);return analyticCustomReportController['runReport']({'id':_0x365220[_0xdac5('0x36')]},_0x54f00f)[_0xdac5('0x37')](handleResult(_0x365220))[_0xdac5('0x2b')](handleError());}}catch(_0x4155ae){logger[_0xdac5('0x28')](JSON['stringify'](_0x4155ae));}return logger['info'](_0xdac5('0x38'));};}function getJobs(_0x341827){var _0x5648bc={};if(_0x341827){_0x5648bc['id']=_0x341827;}return db[_0xdac5('0x39')][_0xdac5('0x3a')]({'where':_0x5648bc,'include':[{'model':db[_0xdac5('0x12')],'attributes':['id',_0xdac5('0x13'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xdac5('0x14'),'include':[{'model':db[_0xdac5('0x3b')],'as':_0xdac5('0x3b')}]}]}]})[_0xdac5('0x37')](function(_0x5ac29d){var _0x631c3b=_[_0xdac5('0x3c')](manager['jobs']);var _0x2682a3=_[_0xdac5('0x3d')](_0x5ac29d,function(_0x30dcd1){return _0x30dcd1['id'][_0xdac5('0x3e')]();});var _0x4ea5db=_[_0xdac5('0x3f')](_0x5ac29d,function(_0xcf69f8){return _0xcf69f8['id'][_0xdac5('0x3e')]();});var _0x2415f2=_0x341827?_0x2682a3:_[_0xdac5('0x40')](_0x2682a3,_0x631c3b);var _0x44fd93=_[_0xdac5('0x41')](_0x2682a3,_0x631c3b);var _0x4a9ffa=_[_0xdac5('0x40')](_0x631c3b,_0x2682a3);var _0x309eea;var _0x1c4126;for(_0x309eea=0x0;_0x309eea<_0x4a9ffa['length']&&!_0x341827;_0x309eea+=0x1){_0x1c4126=_0x4a9ffa[_0x309eea]['toString']();if(manager['exists'](_0x1c4126)){manager[_0xdac5('0x42')](_0x1c4126);manager[_0xdac5('0x43')](_0x1c4126);logger['info'](_0xdac5('0x44'),_0x1c4126);}}logger[_0xdac5('0xd')](_0xdac5('0x45'),JSON[_0xdac5('0x2a')](_0x2415f2));for(_0x309eea=0x0;_0x309eea<_0x2415f2[_0xdac5('0x46')];_0x309eea+=0x1){_0x1c4126=_0x2415f2[_0x309eea][_0xdac5('0x3e')]();logger[_0xdac5('0xd')]('index',_0x1c4126);if(_0x341827){logger[_0xdac5('0xd')](_0xdac5('0x47'),_0x341827);logger[_0xdac5('0xd')](JSON[_0xdac5('0x2a')](_0x4ea5db[_0x1c4126]));BPromise[_0xdac5('0x48')]()[_0xdac5('0x37')](handleJob(_0x4ea5db[_0x1c4126]));logger['info'](_0xdac5('0x49'),_0x4ea5db[_0x1c4126][_0xdac5('0x13')],_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]);}else if(_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]&&_0x4ea5db[_0x1c4126]['active']&&moment()[_0xdac5('0x4b')](_0x4ea5db[_0x1c4126][_0xdac5('0x4c')],_0x4ea5db[_0x1c4126][_0xdac5('0x4d')])){manager[_0xdac5('0x4e')](_0x1c4126,_0x4ea5db[_0x1c4126][_0xdac5('0x4a')],handleJob(_0x4ea5db[_0x1c4126]));manager['start'](_0x1c4126);logger[_0xdac5('0xd')](_0xdac5('0x4f'),_0x4ea5db[_0x1c4126]['name'],_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]);}else if(manager[_0xdac5('0x50')](_0x1c4126)){manager[_0xdac5('0x42')](_0x1c4126);manager[_0xdac5('0x43')](_0x1c4126);logger[_0xdac5('0xd')]('stop\x20cron',_0x4ea5db[_0x1c4126]['name'],_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]);}}for(_0x309eea=0x0,_0x1c4126;_0x309eea<_0x44fd93['length']&&!_0x341827;_0x309eea+=0x1){_0x1c4126=_0x44fd93[_0x309eea]['toString']();if(manager[_0xdac5('0x50')](_0x1c4126)){if(_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]&&_0x4ea5db[_0x1c4126][_0xdac5('0x51')]&&moment()[_0xdac5('0x4b')](_0x4ea5db[_0x1c4126][_0xdac5('0x4c')],_0x4ea5db[_0x1c4126]['endAt'])){manager['update'](_0x1c4126,_0x4ea5db[_0x1c4126][_0xdac5('0x4a')],handleJob(_0x4ea5db[_0x1c4126]));logger[_0xdac5('0xd')]('update\x20cron',_0x4ea5db[_0x1c4126][_0xdac5('0x13')],_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]);}else{manager[_0xdac5('0x42')](_0x1c4126);manager[_0xdac5('0x43')](_0x1c4126);logger[_0xdac5('0xd')](_0xdac5('0x52'),_0x4ea5db[_0x1c4126][_0xdac5('0x13')],_0x4ea5db[_0x1c4126][_0xdac5('0x4a')]);}}}})[_0xdac5('0x2b')](function(_0x2566da){logger[_0xdac5('0x28')](JSON['stringify'](_0x2566da));});}exports['run']=function(_0x32b722){return getJobs(_0x32b722);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/schedule/transcribe.js b/server/config/schedule/transcribe.js index 69cb3ca..f4e464d 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 _0x09dd=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','findOne','Sequelize','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','resolve','Transcript\x20not\x20available','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','push','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x09dd,0xb7));var _0xd09d=function(_0x180763,_0x4b889d){_0x180763=_0x180763-0x0;var _0x991e0c=_0x09dd[_0x180763];return _0x991e0c;};var _=require(_0xd09d('0x0'));var AWS=require(_0xd09d('0x1'));var rp=require(_0xd09d('0x2'));var util=require(_0xd09d('0x3'));var BPromise=require(_0xd09d('0x4'));var db=require(_0xd09d('0x5'))['db'];var logger=require(_0xd09d('0x6'))(_0xd09d('0x7'));function getTranscriptionJob(_0x297ba2,_0x50d0a5,_0x467211,_0x5c3a69){return new Promise(function(_0x274db5,_0x535080){var _0x57eba0=new AWS['TranscribeService']({'accessKeyId':_0x50d0a5,'secretAccessKey':_0x297ba2,'region':_0x467211});_0x57eba0['getTranscriptionJob']({'TranscriptionJobName':_0x5c3a69},function(_0x58c10c,_0x483c0a){if(_0x58c10c){return _0x535080(_0x58c10c);}else{return _0x274db5(_0x483c0a);}});});}function sentiment(_0x66a82,_0x4cfa68,_0x439f9c,_0x2566ce,_0x50692e){return new Promise(function(_0x5f1a89,_0x5f1205){var _0x477658=new AWS[(_0xd09d('0x8'))]({'accessKeyId':_0x4cfa68,'secretAccessKey':_0x66a82,'region':_0x439f9c});_0x477658[_0xd09d('0x9')]({'Text':_0x2566ce,'LanguageCode':_0x50692e[_0xd09d('0xa')](0x0,0x2)},function(_0x2fa597,_0x367838){if(_0x2fa597){return _0x5f1205(_0x2fa597);}else{return _0x5f1a89(_0x367838);}});});}function checkTranscribeJob(_0x4ac130,_0x58c129,_0x3004d0){var _0x3c4a7a;return new BPromise(function(_0x34aed6,_0x2494f9){logger[_0xd09d('0xb')](util['format'](_0xd09d('0xc'),_0x4ac130['id'],_0x4ac130[_0xd09d('0xd')]));return getTranscriptionJob(_0x3004d0[_0xd09d('0xe')],_0x3004d0[_0xd09d('0xf')],_0x58c129[_0xd09d('0x10')],_0x4ac130['transcribeName'])[_0xd09d('0x11')](function(_0x375e61){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x13'),_0x4ac130['id'],_0x4ac130[_0xd09d('0xd')],_0x375e61[_0xd09d('0x14')][_0xd09d('0x15')]));if(!_0x4ac130[_0xd09d('0x16')]){switch(_0x375e61[_0xd09d('0x14')][_0xd09d('0x15')]){case _0xd09d('0x17'):var _0x175920={'transcribeStatus':_0x375e61['TranscriptionJob'][_0xd09d('0x15')],'fileUri':_0x375e61['TranscriptionJob'][_0xd09d('0x18')][_0xd09d('0x19')]};logger[_0xd09d('0xb')](util[_0xd09d('0x12')]('[RECORDING:%d]\x20Get\x20transcript',_0x4ac130['id']));return rp({'uri':_0x375e61[_0xd09d('0x14')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xd09d('0x11')](function(_0x220beb){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x1a'),_0x4ac130['id']));if(_0x220beb&&_0x220beb[_0xd09d('0x1b')]&&_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')]&&_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')][_0xd09d('0x1d')]){_0x175920[_0xd09d('0x16')]='';for(var _0x12997c=0x0;_0x12997c<_0x220beb[_0xd09d('0x1b')][_0xd09d('0x1c')][_0xd09d('0x1d')];_0x12997c++){_0x175920[_0xd09d('0x16')]+=_0x220beb[_0xd09d('0x1b')]['transcripts'][_0x12997c]['transcript']+'';}}return _0x4ac130['update'](_0x175920);})['then'](function(){logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));if(!_0x4ac130[_0xd09d('0x1f')]){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x21'));}if(!_0x58c129['sentiment']||!_0x58c129[_0xd09d('0x22')]||!_0x58c129['sentimentRegion']||!_0x58c129[_0xd09d('0x23')]||!_0x58c129[_0xd09d('0x24')]){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x25'));}if(!_0x175920['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x58c129[_0xd09d('0x22')]===_0x3004d0['id']){return _0x3004d0;}else{return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_settings[_0xd09d('0x22')]}});}})[_0xd09d('0x11')](function(_0x1ecfa4){if(!_0x1ecfa4){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x1ecfa4[_0xd09d('0xe')]||!_0x1ecfa4[_0xd09d('0xf')]){throw new db[(_0xd09d('0x28'))]['ValidationError'](_0xd09d('0x2a'));}_0x3c4a7a=_0x1ecfa4;logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x2b'),_0x4ac130['id']));return sentiment(_0x3c4a7a['data1'],_0x3c4a7a[_0xd09d('0xf')],_0x58c129[_0xd09d('0x2c')],_0x175920['fileText'],_0x58c129['language']);})['then'](function(_0x897b3){logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4ac130['id']));return _0x4ac130['update']({'sentiment':_0x897b3[_0xd09d('0x2d')],'sPositive':_0x897b3[_0xd09d('0x2e')][_0xd09d('0x2f')],'sNegative':_0x897b3['SentimentScore'][_0xd09d('0x30')],'sMixed':_0x897b3[_0xd09d('0x2e')][_0xd09d('0x31')],'sNeutral':_0x897b3['SentimentScore'][_0xd09d('0x32')]});})[_0xd09d('0x11')](function(){logger[_0xd09d('0xb')](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));_0x34aed6();});case _0xd09d('0x33'):return _0x4ac130[_0xd09d('0x34')]({'transcribeStatus':_0xd09d('0x33'),'failureReason':_0x375e61[_0xd09d('0x14')][_0xd09d('0x35')]})[_0xd09d('0x11')](function(){logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4ac130['id']));_0x34aed6();});default:logger[_0xd09d('0xb')](util['format']('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4ac130['id']));break;}}else{return BPromise[_0xd09d('0x36')]()[_0xd09d('0x11')](function(){if(!_0x4ac130[_0xd09d('0x1f')]){throw new db['Sequelize']['ValidationError'](_0xd09d('0x21'));}if(!_0x58c129['sentiment']||!_0x58c129[_0xd09d('0x22')]||!_0x58c129[_0xd09d('0x2c')]||!_0x58c129[_0xd09d('0x23')]||!_0x58c129[_0xd09d('0x24')]){throw new db[(_0xd09d('0x28'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4ac130['fileText']){throw new Error(_0xd09d('0x37'));}if(_0x58c129['sentimentAccountId']===_0x3004d0['id']){return _0x3004d0;}else{return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0x3d7c46){if(!_0x3d7c46){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x3d7c46[_0xd09d('0xe')]||!_0x3d7c46[_0xd09d('0xf')]){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x2a'));}_0x3c4a7a=_0x3d7c46;logger[_0xd09d('0xb')](util['format'](_0xd09d('0x2b'),_0x4ac130['id']));return sentiment(_0x3c4a7a[_0xd09d('0xe')],_0x3c4a7a['data2'],_0x58c129[_0xd09d('0x2c')],_0x4ac130[_0xd09d('0x16')],_0x58c129['language']);})[_0xd09d('0x11')](function(_0x83a22a){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x38'),_0x4ac130['id']));return _0x4ac130[_0xd09d('0x34')]({'sentiment':_0x83a22a[_0xd09d('0x2d')],'sPositive':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x2f')],'sNegative':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x30')],'sMixed':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x31')],'sNeutral':_0x83a22a[_0xd09d('0x2e')][_0xd09d('0x32')],'transcribeStatus':_0xd09d('0x17')});})[_0xd09d('0x11')](function(){logger['info'](util[_0xd09d('0x12')](_0xd09d('0x1e'),_0x4ac130['id']));_0x34aed6();});}})[_0xd09d('0x39')](function(_0x5d9190){if(_0x5d9190){if(!_0x5d9190[_0xd09d('0x3a')]||_0x5d9190['name']!=='SequelizeValidationError'){logger[_0xd09d('0x3b')](util['format'](_0xd09d('0x3c'),_0x4ac130['id']),util[_0xd09d('0x3d')](_0x5d9190,{'showHidden':![],'depth':null}));}}_0x34aed6();});});}function checkTranscribe(){var _0x50716b;var _0x42a3f2;var _0x3d3199;return db['VoiceRecording'][_0xd09d('0x3e')]({'where':{'transcribeStatus':_0xd09d('0x3f')}})[_0xd09d('0x11')](function(_0x36732f){if(!_0x36732f||!_0x36732f[_0xd09d('0x1d')]){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x50716b=_0x36732f;return db[_0xd09d('0x40')][_0xd09d('0x27')]({'where':{'id':0x1}});})[_0xd09d('0x11')](function(_0x403b0c){if(!_0x403b0c){throw new db['Sequelize'][(_0xd09d('0x20'))](_0xd09d('0x41'));}_0x42a3f2=_0x403b0c;if(!_0x42a3f2[_0xd09d('0x7')]||!_0x42a3f2[_0xd09d('0x42')]||!_0x42a3f2[_0xd09d('0x10')]||!_0x42a3f2[_0xd09d('0x23')]||!_0x42a3f2[_0xd09d('0x24')]){throw new db[(_0xd09d('0x28'))]['ValidationError'](_0xd09d('0x43'));}return db[_0xd09d('0x26')][_0xd09d('0x27')]({'where':{'id':_0x42a3f2[_0xd09d('0x42')]}});})[_0xd09d('0x11')](function(_0x472ffa){if(!_0x472ffa){throw new db[(_0xd09d('0x28'))][(_0xd09d('0x20'))](_0xd09d('0x29'));}if(!_0x472ffa[_0xd09d('0xe')]||!_0x472ffa[_0xd09d('0xf')]){throw new db['Sequelize']['ValidationError'](_0xd09d('0x2a'));}_0x3d3199=_0x472ffa;var _0x5bba56=[];_0x50716b['forEach'](function(_0x5f1032){_0x5bba56[_0xd09d('0x44')](checkTranscribeJob(_0x5f1032,_0x42a3f2,_0x3d3199));});return BPromise['all'](_0x5bba56);})[_0xd09d('0x39')](function(_0x593f8b){if(_0x593f8b){if(!_0x593f8b['name']||_0x593f8b[_0xd09d('0x3a')]!==_0xd09d('0x45')){logger[_0xd09d('0x3b')](util[_0xd09d('0x3d')](_0x593f8b,{'showHidden':![],'depth':null}));}}});}exports[_0xd09d('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xa596=['TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','update','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Sequelize','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','resolve','bucket','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','push','all','SequelizeValidationError','start','lodash','aws-sdk','util','bluebird','../../mysqldb','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s'];(function(_0x5d26c0,_0x1aa2f7){var _0xec0117=function(_0x21baab){while(--_0x21baab){_0x5d26c0['push'](_0x5d26c0['shift']());}};_0xec0117(++_0x1aa2f7);}(_0xa596,0x7b));var _0x6a59=function(_0x4bed3b,_0x8f48bb){_0x4bed3b=_0x4bed3b-0x0;var _0x459ef0=_0xa596[_0x4bed3b];return _0x459ef0;};var _=require(_0x6a59('0x0'));var AWS=require(_0x6a59('0x1'));var rp=require('request-promise');var util=require(_0x6a59('0x2'));var BPromise=require(_0x6a59('0x3'));var db=require(_0x6a59('0x4'))['db'];var logger=require(_0x6a59('0x5'))(_0x6a59('0x6'));function getTranscriptionJob(_0xf0435f,_0x11cce1,_0x272793,_0x4f42f6){return new Promise(function(_0x37d9ef,_0x3fab57){var _0x21e97f=new AWS[(_0x6a59('0x7'))]({'accessKeyId':_0x11cce1,'secretAccessKey':_0xf0435f,'region':_0x272793});_0x21e97f[_0x6a59('0x8')]({'TranscriptionJobName':_0x4f42f6},function(_0x3c392f,_0x5aa5fe){if(_0x3c392f){return _0x3fab57(_0x3c392f);}else{return _0x37d9ef(_0x5aa5fe);}});});}function sentiment(_0x3f25d8,_0x48ecee,_0x21008c,_0x49be8c,_0x55ef5b){return new Promise(function(_0x3b44b5,_0x6e6ef7){var _0x24041e=new AWS['Comprehend']({'accessKeyId':_0x48ecee,'secretAccessKey':_0x3f25d8,'region':_0x21008c});_0x24041e[_0x6a59('0x9')]({'Text':_0x49be8c,'LanguageCode':_0x55ef5b[_0x6a59('0xa')](0x0,0x2)},function(_0x5a8484,_0x4e2323){if(_0x5a8484){return _0x6e6ef7(_0x5a8484);}else{return _0x3b44b5(_0x4e2323);}});});}function checkTranscribeJob(_0x4bf880,_0x23e9e3,_0x3075ca){var _0x177506;return new BPromise(function(_0x68dd0a,_0x1b0d74){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0xd'),_0x4bf880['id'],_0x4bf880[_0x6a59('0xe')]));return getTranscriptionJob(_0x3075ca[_0x6a59('0xf')],_0x3075ca[_0x6a59('0x10')],_0x23e9e3['transcribeRegion'],_0x4bf880[_0x6a59('0xe')])[_0x6a59('0x11')](function(_0x416613){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x12'),_0x4bf880['id'],_0x4bf880['transcribeName'],_0x416613[_0x6a59('0x13')][_0x6a59('0x14')]));if(!_0x4bf880[_0x6a59('0x15')]){switch(_0x416613[_0x6a59('0x13')][_0x6a59('0x14')]){case _0x6a59('0x16'):var _0x4988e2={'transcribeStatus':_0x416613[_0x6a59('0x13')][_0x6a59('0x14')],'fileUri':_0x416613[_0x6a59('0x13')][_0x6a59('0x17')][_0x6a59('0x18')]};logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x19'),_0x4bf880['id']));return rp({'uri':_0x416613[_0x6a59('0x13')][_0x6a59('0x17')]['TranscriptFileUri'],'json':!![]})[_0x6a59('0x11')](function(_0x3e068b){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x4bf880['id']));if(_0x3e068b&&_0x3e068b['results']&&_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')]&&_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')]['length']){_0x4988e2['fileText']='';for(var _0x344cea=0x0;_0x344cea<_0x3e068b[_0x6a59('0x1a')]['transcripts'][_0x6a59('0x1c')];_0x344cea++){_0x4988e2['fileText']+=_0x3e068b[_0x6a59('0x1a')][_0x6a59('0x1b')][_0x344cea]['transcript']+'';}}return _0x4bf880[_0x6a59('0x1d')](_0x4988e2);})['then'](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4bf880['id']));if(!_0x4bf880[_0x6a59('0x1e')]){throw new db['Sequelize'][(_0x6a59('0x1f'))](_0x6a59('0x20'));}if(!_0x23e9e3[_0x6a59('0x21')]||!_0x23e9e3[_0x6a59('0x22')]||!_0x23e9e3[_0x6a59('0x23')]||!_0x23e9e3[_0x6a59('0x24')]||!_0x23e9e3['bucket']){throw new db['Sequelize'][(_0x6a59('0x1f'))](_0x6a59('0x25'));}if(!_0x4988e2['fileText']){throw new Error(_0x6a59('0x26'));}if(_0x23e9e3['sentimentAccountId']===_0x3075ca['id']){return _0x3075ca;}else{return db[_0x6a59('0x27')][_0x6a59('0x28')]({'where':{'id':_settings[_0x6a59('0x22')]}});}})['then'](function(_0x360e16){if(!_0x360e16){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x360e16[_0x6a59('0xf')]||!_0x360e16[_0x6a59('0x10')]){throw new db['Sequelize'][(_0x6a59('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x177506=_0x360e16;logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x4bf880['id']));return sentiment(_0x177506[_0x6a59('0xf')],_0x177506[_0x6a59('0x10')],_0x23e9e3['sentimentRegion'],_0x4988e2['fileText'],_0x23e9e3['language']);})['then'](function(_0x49542a){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x2a'),_0x4bf880['id']));return _0x4bf880['update']({'sentiment':_0x49542a[_0x6a59('0x2b')],'sPositive':_0x49542a[_0x6a59('0x2c')]['Positive'],'sNegative':_0x49542a['SentimentScore'][_0x6a59('0x2d')],'sMixed':_0x49542a['SentimentScore'][_0x6a59('0x2e')],'sNeutral':_0x49542a[_0x6a59('0x2c')][_0x6a59('0x2f')]});})[_0x6a59('0x11')](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});case _0x6a59('0x31'):return _0x4bf880[_0x6a59('0x1d')]({'transcribeStatus':_0x6a59('0x31'),'failureReason':_0x416613[_0x6a59('0x13')][_0x6a59('0x32')]})[_0x6a59('0x11')](function(){logger[_0x6a59('0xb')](util[_0x6a59('0xc')](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});default:logger['info'](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x4bf880['id']));break;}}else{return BPromise[_0x6a59('0x33')]()[_0x6a59('0x11')](function(){if(!_0x4bf880[_0x6a59('0x1e')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x20'));}if(!_0x23e9e3[_0x6a59('0x21')]||!_0x23e9e3[_0x6a59('0x22')]||!_0x23e9e3[_0x6a59('0x23')]||!_0x23e9e3['language']||!_0x23e9e3[_0x6a59('0x34')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4bf880['fileText']){throw new Error(_0x6a59('0x26'));}if(_0x23e9e3[_0x6a59('0x22')]===_0x3075ca['id']){return _0x3075ca;}else{return db[_0x6a59('0x27')]['findOne']({'where':{'id':_settings[_0x6a59('0x22')]}});}})[_0x6a59('0x11')](function(_0x399532){if(!_0x399532){throw new db['Sequelize']['ValidationError'](_0x6a59('0x35'));}if(!_0x399532[_0x6a59('0xf')]||!_0x399532[_0x6a59('0x10')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x36'));}_0x177506=_0x399532;logger['info'](util['format'](_0x6a59('0x37'),_0x4bf880['id']));return sentiment(_0x177506['data1'],_0x177506[_0x6a59('0x10')],_0x23e9e3[_0x6a59('0x23')],_0x4bf880['fileText'],_0x23e9e3[_0x6a59('0x24')]);})[_0x6a59('0x11')](function(_0x267a4b){logger[_0x6a59('0xb')](util[_0x6a59('0xc')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4bf880['id']));return _0x4bf880[_0x6a59('0x1d')]({'sentiment':_0x267a4b['Sentiment'],'sPositive':_0x267a4b['SentimentScore']['Positive'],'sNegative':_0x267a4b[_0x6a59('0x2c')][_0x6a59('0x2d')],'sMixed':_0x267a4b[_0x6a59('0x2c')]['Mixed'],'sNeutral':_0x267a4b[_0x6a59('0x2c')][_0x6a59('0x2f')],'transcribeStatus':_0x6a59('0x16')});})['then'](function(){logger['info'](util['format'](_0x6a59('0x30'),_0x4bf880['id']));_0x68dd0a();});}})['catch'](function(_0xa17ed9){if(_0xa17ed9){if(!_0xa17ed9[_0x6a59('0x38')]||_0xa17ed9['name']!=='SequelizeValidationError'){logger['error'](util[_0x6a59('0xc')](_0x6a59('0x39'),_0x4bf880['id']),util[_0x6a59('0x3a')](_0xa17ed9,{'showHidden':![],'depth':null}));}}_0x68dd0a();});});}function checkTranscribe(){var _0x180dc4;var _0x1509e2;var _0x11715b;return db[_0x6a59('0x3b')]['findAll']({'where':{'transcribeStatus':_0x6a59('0x3c')}})[_0x6a59('0x11')](function(_0xbc5b1a){if(!_0xbc5b1a||!_0xbc5b1a[_0x6a59('0x1c')]){throw new db[(_0x6a59('0x29'))]['ValidationError'](_0x6a59('0x3d'));}_0x180dc4=_0xbc5b1a;return db[_0x6a59('0x3e')][_0x6a59('0x28')]({'where':{'id':0x1}});})[_0x6a59('0x11')](function(_0x278e7a){if(!_0x278e7a){throw new db[(_0x6a59('0x29'))]['ValidationError'](_0x6a59('0x3f'));}_0x1509e2=_0x278e7a;if(!_0x1509e2['transcribe']||!_0x1509e2[_0x6a59('0x40')]||!_0x1509e2[_0x6a59('0x41')]||!_0x1509e2[_0x6a59('0x24')]||!_0x1509e2['bucket']){throw new db['Sequelize']['ValidationError'](_0x6a59('0x42'));}return db[_0x6a59('0x27')]['findOne']({'where':{'id':_0x1509e2[_0x6a59('0x40')]}});})[_0x6a59('0x11')](function(_0x31aa4e){if(!_0x31aa4e){throw new db[(_0x6a59('0x29'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x31aa4e[_0x6a59('0xf')]||!_0x31aa4e[_0x6a59('0x10')]){throw new db[(_0x6a59('0x29'))][(_0x6a59('0x1f'))](_0x6a59('0x36'));}_0x11715b=_0x31aa4e;var _0x574c24=[];_0x180dc4['forEach'](function(_0x1a118e){_0x574c24[_0x6a59('0x43')](checkTranscribeJob(_0x1a118e,_0x1509e2,_0x11715b));});return BPromise[_0x6a59('0x44')](_0x574c24);})['catch'](function(_0x328e78){if(_0x328e78){if(!_0x328e78['name']||_0x328e78[_0x6a59('0x38')]!==_0x6a59('0x45')){logger['error'](util[_0x6a59('0x3a')](_0x328e78,{'showHidden':![],'depth':null}));}}});}exports[_0x6a59('0x46')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 68581f6..18f203c 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 _0x6ef5=['util','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x6ef5,0x1a1));var _0x56ef=function(_0x31547f,_0x89864){_0x31547f=_0x31547f-0x0;var _0x3b35f0=_0x6ef5[_0x31547f];return _0x3b35f0;};'use strict';var _=require(_0x56ef('0x0'));var moment=require(_0x56ef('0x1'));var Redis=require(_0x56ef('0x2'));var util=require(_0x56ef('0x3'));var config=require(_0x56ef('0x4'));var db=require(_0x56ef('0x5'))['db'];var logger=require(_0x56ef('0x6'))(_0x56ef('0x7'));config[_0x56ef('0x8')]=_['defaults'](config['redis'],{'host':_0x56ef('0x9'),'port':0x18eb});var io=require(_0x56ef('0xa'))(new Redis(config[_0x56ef('0x8')]));function closeInteractions(){var _0x2bd386=[];return db[_0x56ef('0xb')][_0x56ef('0xc')]({'raw':!![],'attributes':['id',_0x56ef('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x56ef('0xe'))}}})[_0x56ef('0xf')](function(_0x4cb734){if(_0x4cb734&&_0x4cb734[_0x56ef('0x10')]){_0x2bd386=_[_0x56ef('0x11')](_0x4cb734||[],'id');logger[_0x56ef('0x12')](_0x56ef('0x13'),_0x2bd386[_0x56ef('0x14')]());return db[_0x56ef('0xb')][_0x56ef('0x15')]({'closeReason':_0x56ef('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x56ef('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2bd386}});}})[_0x56ef('0xf')](function(){if(_0x2bd386&&_0x2bd386[_0x56ef('0x10')]){logger[_0x56ef('0x12')](_0x56ef('0x18'),_0x2bd386[_0x56ef('0x14')]());for(var _0x7f7e6f=0x0;_0x7f7e6f<_0x2bd386[_0x56ef('0x10')];_0x7f7e6f++){io['emit'](_0x56ef('0x19'),{'id':_0x2bd386[_0x7f7e6f],'closed':!![]});}}})[_0x56ef('0x1a')](function(_0x4ed976){logger[_0x56ef('0x1b')](_0x56ef('0x1c'),_0x4ed976?util[_0x56ef('0x1d')](_0x4ed976,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xc6df=['[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','then','map'];(function(_0x3f15d0,_0x34623f){var _0x9ae48f=function(_0x4d6d60){while(--_0x4d6d60){_0x3f15d0['push'](_0x3f15d0['shift']());}};_0x9ae48f(++_0x34623f);}(_0xc6df,0x115));var _0xfc6d=function(_0xbb1107,_0x47b9f3){_0xbb1107=_0xbb1107-0x0;var _0x42b1cb=_0xc6df[_0xbb1107];return _0x42b1cb;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0xfc6d('0x0'));var util=require(_0xfc6d('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xfc6d('0x2'))(_0xfc6d('0x3'));config[_0xfc6d('0x4')]=_[_0xfc6d('0x5')](config[_0xfc6d('0x4')],{'host':_0xfc6d('0x6'),'port':0x18eb});var io=require(_0xfc6d('0x7'))(new Redis(config[_0xfc6d('0x4')]));function closeInteractions(){var _0x4c9ead=[];return db[_0xfc6d('0x8')][_0xfc6d('0x9')]({'raw':!![],'attributes':['id',_0xfc6d('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xfc6d('0xb')](function(_0x394ffa){if(_0x394ffa&&_0x394ffa['length']){_0x4c9ead=_[_0xfc6d('0xc')](_0x394ffa||[],'id');logger['info'](_0xfc6d('0xd'),_0x4c9ead['join']());return db[_0xfc6d('0x8')][_0xfc6d('0xe')]({'closeReason':_0xfc6d('0xf'),'disposition':_0xfc6d('0x10'),'closed':!![],'closedAt':moment()[_0xfc6d('0x11')](_0xfc6d('0x12'))},{'where':{'id':_0x4c9ead}});}})['then'](function(){if(_0x4c9ead&&_0x4c9ead[_0xfc6d('0x13')]){logger[_0xfc6d('0x14')](_0xfc6d('0x15'),_0x4c9ead['join']());for(var _0x5516a0=0x0;_0x5516a0<_0x4c9ead[_0xfc6d('0x13')];_0x5516a0++){io[_0xfc6d('0x16')](_0xfc6d('0x17'),{'id':_0x4c9ead[_0x5516a0],'closed':!![]});}}})[_0xfc6d('0x18')](function(_0x2aded3){logger[_0xfc6d('0x19')](_0xfc6d('0x1a'),_0x2aded3?util[_0xfc6d('0x1b')](_0x2aded3,{'showHidden':![],'depth':null}):'');});}exports[_0xfc6d('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 5e52a2b..b546dc0 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf73b=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log','hopper1','contacts2','hopper2','catch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf73b,0xa0));var _0xbf73=function(_0x2acc42,_0x3ce31c){_0x2acc42=_0x2acc42-0x0;var _0x4b02d1=_0xf73b[_0x2acc42];return _0x4b02d1;};'use strict';var util=require(_0xbf73('0x0'));var db=require(_0xbf73('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xbf73('0x2')]({'id':i,'firstName':_0xbf73('0x3')+i,'lastName':_0xbf73('0x4')+i,'phone':0xf879fb460+i,'email':_0xbf73('0x5')+i+_0xbf73('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xbf73('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xbf73('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xbf73('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xbf73('0x5')+i+_0xbf73('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xbf73('0x7')](),'updatedAt':Date[_0xbf73('0x7')]()});}db[_0xbf73('0x8')][_0xbf73('0x9')]({'where':{}})[_0xbf73('0xa')](function(){return db[_0xbf73('0x8')][_0xbf73('0xb')](contacts);})[_0xbf73('0xa')](function(){console['log'](_0xbf73('0xc'),_0xbf73('0xd'));return db[_0xbf73('0xe')][_0xbf73('0x9')]({'where':{}});})['then'](function(){return db['CmHopper'][_0xbf73('0xb')](hopper);})[_0xbf73('0xa')](function(){console[_0xbf73('0xf')]('finished\x20populating',_0xbf73('0x10'));return db[_0xbf73('0x8')][_0xbf73('0xb')](contacts2);})[_0xbf73('0xa')](function(){console[_0xbf73('0xf')](_0xbf73('0xc'),_0xbf73('0x11'));return db[_0xbf73('0xe')][_0xbf73('0xb')](hopper2);})[_0xbf73('0xa')](function(){console['log'](_0xbf73('0xc'),_0xbf73('0x12'));})[_0xbf73('0x13')](function(_0x57db5f){console['log'](_0x57db5f);}); \ No newline at end of file +var _0xde04=['push','Innocenzo','Biondo','@xcally.com','now','innocenzo.biondo','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','catch','util','../mysqldb'];(function(_0x537c8b,_0x5a2461){var _0x41749b=function(_0x52d081){while(--_0x52d081){_0x537c8b['push'](_0x537c8b['shift']());}};_0x41749b(++_0x5a2461);}(_0xde04,0x108));var _0x4de0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde04[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x4de0('0x0'));var db=require(_0x4de0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x4de0('0x2')]({'id':i,'firstName':_0x4de0('0x3')+i,'lastName':_0x4de0('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x4de0('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4de0('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4de0('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x4de0('0x3')+i,'lastName':_0x4de0('0x4')+i,'phone':0xf879fb460+i,'email':_0x4de0('0x7')+i+_0x4de0('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4de0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x4de0('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4de0('0x6')](),'updatedAt':Date[_0x4de0('0x6')]()});}db[_0x4de0('0x8')][_0x4de0('0x9')]({'where':{}})[_0x4de0('0xa')](function(){return db[_0x4de0('0x8')]['bulkCreate'](contacts);})[_0x4de0('0xa')](function(){console[_0x4de0('0xb')](_0x4de0('0xc'),_0x4de0('0xd'));return db[_0x4de0('0xe')][_0x4de0('0x9')]({'where':{}});})[_0x4de0('0xa')](function(){return db[_0x4de0('0xe')][_0x4de0('0xf')](hopper);})['then'](function(){console[_0x4de0('0xb')](_0x4de0('0xc'),_0x4de0('0x10'));return db['CmContact'][_0x4de0('0xf')](contacts2);})[_0x4de0('0xa')](function(){console[_0x4de0('0xb')](_0x4de0('0xc'),_0x4de0('0x11'));return db[_0x4de0('0xe')][_0x4de0('0xf')](hopper2);})['then'](function(){console[_0x4de0('0xb')](_0x4de0('0xc'),'hopper2');})[_0x4de0('0x12')](function(_0x23edbb){console[_0x4de0('0xb')](_0x23edbb);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 379a02d..f34acd5 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2976=['ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','util','format','agent','%s%s@xcally.com','password','friend','udp','all'];(function(_0xf57bb7,_0x419f26){var _0x2c8149=function(_0x51d051){while(--_0x51d051){_0xf57bb7['push'](_0xf57bb7['shift']());}};_0x2c8149(++_0x419f26);}(_0x2976,0x118));var _0x6297=function(_0x5abc3d,_0x5cec9f){_0x5abc3d=_0x5abc3d-0x0;var _0x9cfc2=_0x2976[_0x5abc3d];return _0x9cfc2;};'use strict';var util=require(_0x6297('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x6297('0x1')]('%s%s',_0x6297('0x2'),i),'fullname':util[_0x6297('0x1')]('%s%s',_0x6297('0x2'),i),'email':util[_0x6297('0x1')](_0x6297('0x3'),_0x6297('0x2'),i),'role':'agent','password':_0x6297('0x4'),'internal':0xfa0+i,'type':_0x6297('0x5'),'transport':[_0x6297('0x6'),'ws','wss'],'disallow':[_0x6297('0x7')],'allow':[_0x6297('0x8')],'defaultuser':util[_0x6297('0x1')](_0x6297('0x9'),_0x6297('0x2'),i),'encryption':_0x6297('0xa'),'avpf':_0x6297('0xa'),'force_avp':'yes','icesupport':_0x6297('0xa'),'dtlsenable':_0x6297('0xa'),'dtlsverify':'no','dtlscertfile':_0x6297('0xb'),'dtlsprivatekey':_0x6297('0xc'),'dtlssetup':_0x6297('0xd'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0x6297('0x1')](_0x6297('0x9'),_0x6297('0x2'),i),0xfa0+i)});}db['User'][_0x6297('0xe')](users)[_0x6297('0xf')](function(){console[_0x6297('0x10')](_0x6297('0x11'));})['catch'](function(_0x27d60d){console[_0x6297('0x10')](_0x27d60d);}); \ No newline at end of file +var _0xff5f=['log','catch','util','push','format','%s%s','agent','%s%s@xcally.com','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then'];(function(_0x2d9c6a,_0x59393d){var _0xf3c918=function(_0x4f3f26){while(--_0x4f3f26){_0x2d9c6a['push'](_0x2d9c6a['shift']());}};_0xf3c918(++_0x59393d);}(_0xff5f,0x1c4));var _0xfff5=function(_0x58d1dc,_0x2e2087){_0x58d1dc=_0x58d1dc-0x0;var _0x585e8b=_0xff5f[_0x58d1dc];return _0x585e8b;};'use strict';var util=require(_0xfff5('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xfff5('0x1')]({'name':util[_0xfff5('0x2')](_0xfff5('0x3'),_0xfff5('0x4'),i),'fullname':util[_0xfff5('0x2')](_0xfff5('0x3'),_0xfff5('0x4'),i),'email':util[_0xfff5('0x2')](_0xfff5('0x5'),_0xfff5('0x4'),i),'role':_0xfff5('0x4'),'password':_0xfff5('0x6'),'internal':0xfa0+i,'type':_0xfff5('0x7'),'transport':['udp','ws','wss'],'disallow':[_0xfff5('0x8')],'allow':[_0xfff5('0x9')],'defaultuser':util[_0xfff5('0x2')](_0xfff5('0x3'),_0xfff5('0x4'),i),'encryption':_0xfff5('0xa'),'avpf':_0xfff5('0xa'),'force_avp':'yes','icesupport':_0xfff5('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xfff5('0xb'),'dtlsprivatekey':_0xfff5('0xc'),'dtlssetup':_0xfff5('0xd'),'callerid':util[_0xfff5('0x2')](_0xfff5('0xe'),util['format'](_0xfff5('0x3'),'agent',i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0xfff5('0xf')](function(){console[_0xfff5('0x10')]('add\x20user');})[_0xfff5('0x11')](function(_0x5694e1){console[_0xfff5('0x10')](_0x5694e1);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6d98014..cd68e5f 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x117c=['removeMailInteractions','emit','FaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','../mysqldb','Agents','User','name','role','agent','ivr','UserProfileSection','then','autoAssociation','ChatQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','Telephones','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','type','format','%s:queue:%s','user:%s','handshake','find','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','WhatsappQueue','user','ChatQueue','SmsQueues','SmsQueue','OpenchannelQueues','OpenchannelQueue','Trunk','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','length','chat','fax','whatsapp','telephone:%s','trunk:%s','leave','map','user_has_chat_interactions:remove'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0x117c,0x71));var _0xc117=function(_0x102789,_0x24217f){_0x102789=_0x102789-0x0;var _0x4aeb4f=_0x117c[_0x102789];return _0x4aeb4f;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require('bluebird');var db=require(_0xc117('0x0'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xc117('0x1'),'model':db[_0xc117('0x2')],'attributes':['id',_0xc117('0x3'),_0xc117('0x4')],'raw':!![],'where':{'role':_0xc117('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xc117('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xc117('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xc117('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xc117('0x3'),'type'],'where':{'type':_0xc117('0x6')}};function getAssociatedResources(_0x2982fa,_0x62548,_0x39e33f){return db[_0xc117('0x7')]['findOne']({'where':{'name':_0x2982fa,'userProfileId':_0x62548},'raw':!![]})[_0xc117('0x8')](function(_0x574c99){if(_0x574c99){if(_0x574c99[_0xc117('0x9')]){switch(_0x2982fa){case'VoiceQueues':case _0xc117('0xa'):case _0xc117('0xb'):case'SmsQueues':case _0xc117('0xc'):case'OpenchannelQueues':case _0xc117('0xd'):return db[_0x39e33f][_0xc117('0xe')](queryQueues);case _0xc117('0xf'):return db[_0x39e33f][_0xc117('0xe')](queryTelephones);case'Trunks':return db[_0x39e33f][_0xc117('0xe')](queryTrunks);case _0xc117('0x10'):return db[_0x39e33f][_0xc117('0xe')](queryCampaigns);}}else{return db[_0xc117('0x11')][_0xc117('0xe')]({'attributes':[_0xc117('0x12')],'where':{'sectionId':_0x574c99['id']},'raw':!![]})[_0xc117('0x8')](function(_0x6960b9){if(_0x6960b9){var _0xc14e71={'where':{'id':_['map'](_0x6960b9,'resourceId')},'raw':!![]};switch(_0x39e33f){case _0xc117('0x2'):_0xc14e71[_0xc117('0x13')][_0xc117('0x4')]=_0xc117('0x14');break;case _0xc117('0x15'):_0xc14e71[_0xc117('0x13')][_0xc117('0x16')]=_0xc117('0x6');break;}return db[_0x39e33f][_0xc117('0xe')](_0xc14e71);}else{return[];}});}}else{return[];}})[_0xc117('0x8')](function(_0x2eddf1){return _0x2eddf1;});}function joinOrLeaveQueues(_0x224395,_0x547deb,_0x1b9095,_0x4717ec){_0x224395[_0x547deb](util[_0xc117('0x17')](_0xc117('0x18'),_0x1b9095,_0x4717ec[_0xc117('0x3')]));if(_0x4717ec[_0xc117('0x1')]){for(var _0x32ef4e=0x0;_0x32ef4e<_0x4717ec['Agents']['length'];_0x32ef4e+=0x1){_0x224395[_0x547deb](util[_0xc117('0x17')](_0xc117('0x19'),_0x4717ec[_0xc117('0x1')][_0x32ef4e][_0xc117('0x3')]));}}}function joinOrLeave(_0x1658e2,_0x2531f1,_0x5d5ba1){var _0x4bde1b;if(_0x1658e2[_0xc117('0x1a')]['query']['id']){db[_0xc117('0x2')][_0xc117('0x1b')]({'attributes':['id',_0xc117('0x3'),'role',_0xc117('0x1c')],'where':{'id':_0x1658e2[_0xc117('0x1a')][_0xc117('0x1d')]['id']},'include':[{'model':db[_0xc117('0x1e')],'as':_0xc117('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x21')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xc117('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xc117('0x23')],'as':_0xc117('0x24'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0xc117('0x25'),'attributes':['id'],'raw':!![]}]})[_0xc117('0x8')](function(_0x4a2a10){if(_0x4a2a10){_0x4bde1b=_0x4a2a10;_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x19'),_0x4a2a10[_0xc117('0x3')]));var _0x4e8630=[];switch(_0x4a2a10[_0xc117('0x4')]){case'admin':_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));if(queryQueues[_0xc117('0x28')](_0xc117('0x29'))){delete queryQueues['include'];}_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2b')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db['ChatQueue'][_0xc117('0xe')](queryQueues));_0x4e8630['push'](db[_0xc117('0x2c')]['findAll'](queryQueues));_0x4e8630[_0xc117('0x2a')](db['SmsQueue'][_0xc117('0xe')](queryQueues));_0x4e8630['push'](db[_0xc117('0x2d')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db['OpenchannelQueue'][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2e')][_0xc117('0xe')](queryQueues));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2')][_0xc117('0xe')](queryTelephones));_0x4e8630[_0xc117('0x2a')](db['Trunk'][_0xc117('0xe')](queryTrunks));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x15')]['findAll'](queryCampaigns));_0x4e8630[_0xc117('0x2a')](db[_0xc117('0x2')][_0xc117('0xe')](queryAgents));break;case _0xc117('0x2f'):_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));_0x4e8630[_0xc117('0x2a')](getAssociatedResources('VoiceQueues',_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2b')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xa'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x30')));_0x4e8630['push'](getAssociatedResources('FaxQueues',_0x4a2a10['userProfileId'],_0xc117('0x2c')));_0x4e8630['push'](getAssociatedResources(_0xc117('0x31'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x32')));_0x4e8630[_0xc117('0x2a')](getAssociatedResources(_0xc117('0xc'),_0x4a2a10[_0xc117('0x1c')],'MailQueue'));_0x4e8630[_0xc117('0x2a')](getAssociatedResources(_0xc117('0x33'),_0x4a2a10['userProfileId'],_0xc117('0x34')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xd'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2e')));_0x4e8630['push'](getAssociatedResources(_0xc117('0xf'),_0x4a2a10[_0xc117('0x1c')],_0xc117('0x2')));_0x4e8630[_0xc117('0x2a')](getAssociatedResources('Trunks',_0x4a2a10[_0xc117('0x1c')],_0xc117('0x35')));_0x4e8630['push'](getAssociatedResources(_0xc117('0x10'),_0x4a2a10[_0xc117('0x1c')],'Campaign'));_0x4e8630[_0xc117('0x2a')](db['User'][_0xc117('0xe')](queryAgents));break;case _0xc117('0x5'):_0x1658e2[_0x2531f1](_0xc117('0x26'));_0x1658e2[_0x2531f1](_0xc117('0x27'));_0x4e8630['push'](_0x4a2a10['getVoiceQueues']({'attributes':['id','name']}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x36')]({'attributes':['id','name']}));_0x4e8630['push'](_0x4a2a10['getFaxQueues']({'attributes':['id',_0xc117('0x3')]}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x37')]({'attributes':['id',_0xc117('0x3')]}));_0x4e8630[_0xc117('0x2a')](_0x4a2a10[_0xc117('0x38')]({'attributes':['id','name']}));_0x4e8630['push'](_0x4a2a10[_0xc117('0x39')]({'attributes':['id',_0xc117('0x3')]}));_0x4e8630['push'](_0x4a2a10['getWhatsappQueues']({'attributes':['id',_0xc117('0x3')]}));break;}return BPromise['all'](_0x4e8630);}})[_0xc117('0x8')](function(_0x11bb48){if(_0x11bb48&&_0x11bb48[_0xc117('0x3a')]){for(var _0x3078e0=0x0;_0x3078e0<_0x11bb48['length'];_0x3078e0+=0x1){for(var _0x31a269=0x0;_0x31a269<_0x11bb48[_0x3078e0][_0xc117('0x3a')];_0x31a269+=0x1){switch(_0x3078e0){case 0x0:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'voice',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x1:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3b'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x2:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3c'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x3:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'sms',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x4:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'mail',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x5:joinOrLeaveQueues(_0x1658e2,_0x2531f1,'openchannel',_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x6:joinOrLeaveQueues(_0x1658e2,_0x2531f1,_0xc117('0x3d'),_0x11bb48[_0x3078e0][_0x31a269]);break;case 0x7:if(_0x4bde1b[_0xc117('0x4')]!==_0xc117('0x5'))_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x3e'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0x8:if(_0x4bde1b['role']!=='agent')_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x3f'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0x9:if(_0x4bde1b[_0xc117('0x4')]!==_0xc117('0x5'))_0x1658e2[_0x2531f1](util[_0xc117('0x17')]('campaign:%s:%s',_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x16')],_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;case 0xa:_0x1658e2[_0x2531f1](util[_0xc117('0x17')](_0xc117('0x19'),_0x11bb48[_0x3078e0][_0x31a269][_0xc117('0x3')]));break;}}}}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0x18e3bb=_[_0xc117('0x41')](_0x4bde1b[_0xc117('0x1f')],'id');return _0x4bde1b['removeChatInteractions'](_0x18e3bb)[_0xc117('0x8')](function(){for(var _0x4d179d=0x0;_0x4d179d<_0x18e3bb[_0xc117('0x3a')];_0x4d179d+=0x1){_0x5d5ba1['emit'](_0xc117('0x42'),{'ChatInteractionId':Number(_0x18e3bb[_0x4d179d]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0xdca56a=_[_0xc117('0x41')](_0x4bde1b['MailInteractions'],'id');return _0x4bde1b[_0xc117('0x43')](_0xdca56a)[_0xc117('0x8')](function(){for(var _0x49af31=0x0;_0x49af31<_0xdca56a[_0xc117('0x3a')];_0x49af31+=0x1){_0x5d5ba1[_0xc117('0x44')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0xdca56a[_0x49af31]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1==='leave'){var _0x42fafd=_['map'](_0x4bde1b[_0xc117('0x45')],'id');return _0x4bde1b['removeFaxInteractions'](_0x42fafd)[_0xc117('0x8')](function(){for(var _0x100e28=0x0;_0x100e28<_0x42fafd[_0xc117('0x3a')];_0x100e28+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x46'),{'FaxInteractionId':Number(_0x42fafd[_0x100e28]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1==='leave'){var _0x51e163=_[_0xc117('0x41')](_0x4bde1b['SmsInteractions'],'id');return _0x4bde1b[_0xc117('0x47')](_0x51e163)[_0xc117('0x8')](function(){for(var _0x13e1df=0x0;_0x13e1df<_0x51e163['length'];_0x13e1df+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x48'),{'SmsInteractionId':Number(_0x51e163[_0x13e1df]),'UserId':Number(_0x4bde1b['id'])});}});}})['then'](function(){if(_0x2531f1===_0xc117('0x40')){var _0x298502=_[_0xc117('0x41')](_0x4bde1b[_0xc117('0x24')],'id');return _0x4bde1b[_0xc117('0x49')](_0x298502)[_0xc117('0x8')](function(){for(var _0x34f8cb=0x0;_0x34f8cb<_0x298502[_0xc117('0x3a')];_0x34f8cb+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x4a'),{'OpenchannelInteractionId':Number(_0x298502[_0x34f8cb]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x8')](function(){if(_0x2531f1===_0xc117('0x40')){var _0x3bfeda=_['map'](_0x4bde1b['WhatsappInteractions'],'id');return _0x4bde1b[_0xc117('0x4b')](_0x3bfeda)[_0xc117('0x8')](function(){for(var _0x5a9176=0x0;_0x5a9176<_0x3bfeda[_0xc117('0x3a')];_0x5a9176+=0x1){_0x5d5ba1[_0xc117('0x44')](_0xc117('0x4c'),{'WhatsappInteractionId':Number(_0x3bfeda[_0x5a9176]),'UserId':Number(_0x4bde1b['id'])});}});}})[_0xc117('0x4d')](function(_0x21d5ac){_0x1658e2[_0xc117('0x4e')](_0x21d5ac);});}}function onDisconnect(_0x32ed57,_0x33587a){joinOrLeave(_0x32ed57,_0xc117('0x40'),_0x33587a);}function onConnect(_0x7f7504){joinOrLeave(_0x7f7504,_0xc117('0x4f'));}exports['default']=function(_0x44302e){_0x44302e['on'](_0xc117('0x50'),function(_0x3a4ccd){_0x3a4ccd[_0xc117('0x51')](0x0);_0x3a4ccd[_0xc117('0x52')]=_0x3a4ccd[_0xc117('0x53')][_0xc117('0x50')][_0xc117('0x54')]+':'+_0x3a4ccd[_0xc117('0x53')][_0xc117('0x50')]['remotePort'];_0x3a4ccd[_0xc117('0x55')]=new Date();_0x3a4ccd['log']=function(_0x8b6705){console[_0xc117('0x4e')](_0xc117('0x56')+_0x3a4ccd[_0xc117('0x57')][_0xc117('0x3')]+'['+_0x3a4ccd[_0xc117('0x52')]+']',_0x8b6705);};_0x3a4ccd['on']('disconnect',function(){onDisconnect(_0x3a4ccd,_0x44302e);_0x3a4ccd[_0xc117('0x4e')](_0xc117('0x58'));});onConnect(_0x3a4ccd);_0x3a4ccd[_0xc117('0x4e')](_0xc117('0x59'));});}; \ No newline at end of file +var _0x29f4=['voice:outbound','hasOwnProperty','include','push','VoiceQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','VoiceQueues','FaxQueue','SmsQueues','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','user_has_chat_interactions:remove','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','emit','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','telephone','type','ivr','findOne','then','autoAssociation','ChatQueues','FaxQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound'];(function(_0x54e612,_0x593517){var _0x265195=function(_0x376305){while(--_0x376305){_0x54e612['push'](_0x54e612['shift']());}};_0x265195(++_0x593517);}(_0x29f4,0x1d1));var _0x429f=function(_0xdf24b8,_0x801f4c){_0xdf24b8=_0xdf24b8-0x0;var _0x2be66f=_0x29f4[_0xdf24b8];return _0x2be66f;};'use strict';var _=require(_0x429f('0x0'));var util=require(_0x429f('0x1'));var BPromise=require(_0x429f('0x2'));var db=require(_0x429f('0x3'))['db'];var config=require(_0x429f('0x4'));var queryQueues={'attributes':['id',_0x429f('0x5')],'include':[{'as':_0x429f('0x6'),'model':db[_0x429f('0x7')],'attributes':['id',_0x429f('0x5'),_0x429f('0x8')],'raw':!![],'where':{'role':_0x429f('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x429f('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x429f('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x429f('0x5')],'where':{'role':_0x429f('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x429f('0xb')],'where':{'type':_0x429f('0xc')}};function getAssociatedResources(_0x1f3a3e,_0x5bfd98,_0x35bbf6){return db['UserProfileSection'][_0x429f('0xd')]({'where':{'name':_0x1f3a3e,'userProfileId':_0x5bfd98},'raw':!![]})[_0x429f('0xe')](function(_0x5e519a){if(_0x5e519a){if(_0x5e519a[_0x429f('0xf')]){switch(_0x1f3a3e){case'VoiceQueues':case _0x429f('0x10'):case _0x429f('0x11'):case'SmsQueues':case'MailQueues':case _0x429f('0x12'):case _0x429f('0x13'):return db[_0x35bbf6][_0x429f('0x14')](queryQueues);case _0x429f('0x15'):return db[_0x35bbf6][_0x429f('0x14')](queryTelephones);case _0x429f('0x16'):return db[_0x35bbf6][_0x429f('0x14')](queryTrunks);case'IvrCampaigns':return db[_0x35bbf6][_0x429f('0x14')](queryCampaigns);}}else{return db[_0x429f('0x17')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x5e519a['id']},'raw':!![]})[_0x429f('0xe')](function(_0x357f3e){if(_0x357f3e){var _0x2aee9b={'where':{'id':_[_0x429f('0x18')](_0x357f3e,_0x429f('0x19'))},'raw':!![]};switch(_0x35bbf6){case _0x429f('0x7'):_0x2aee9b[_0x429f('0x1a')][_0x429f('0x8')]=_0x429f('0xa');break;case _0x429f('0x1b'):_0x2aee9b[_0x429f('0x1a')][_0x429f('0xb')]=_0x429f('0xc');break;}return db[_0x35bbf6][_0x429f('0x14')](_0x2aee9b);}else{return[];}});}}else{return[];}})[_0x429f('0xe')](function(_0x4f8438){return _0x4f8438;});}function joinOrLeaveQueues(_0x297e14,_0x431d86,_0x39bae2,_0x155931){_0x297e14[_0x431d86](util[_0x429f('0x1c')](_0x429f('0x1d'),_0x39bae2,_0x155931[_0x429f('0x5')]));if(_0x155931[_0x429f('0x6')]){for(var _0x1477ab=0x0;_0x1477ab<_0x155931[_0x429f('0x6')][_0x429f('0x1e')];_0x1477ab+=0x1){_0x297e14[_0x431d86](util[_0x429f('0x1c')](_0x429f('0x1f'),_0x155931[_0x429f('0x6')][_0x1477ab][_0x429f('0x5')]));}}}function joinOrLeave(_0x46808c,_0x1853be,_0x276241){var _0x228243;if(_0x46808c[_0x429f('0x20')][_0x429f('0x21')]['id']){db[_0x429f('0x7')]['find']({'attributes':['id',_0x429f('0x5'),_0x429f('0x8'),_0x429f('0x22')],'where':{'id':_0x46808c[_0x429f('0x20')][_0x429f('0x21')]['id']},'include':[{'model':db[_0x429f('0x23')],'as':_0x429f('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x429f('0x25')],'as':_0x429f('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x429f('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x429f('0x28')],'as':_0x429f('0x29'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x429f('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x429f('0xe')](function(_0x41299a){if(_0x41299a){_0x228243=_0x41299a;_0x46808c[_0x1853be](util[_0x429f('0x1c')](_0x429f('0x1f'),_0x41299a[_0x429f('0x5')]));var _0x23567f=[];switch(_0x41299a[_0x429f('0x8')]){case _0x429f('0x2b'):_0x46808c[_0x1853be](_0x429f('0x2c'));_0x46808c[_0x1853be](_0x429f('0x2d'));if(queryQueues[_0x429f('0x2e')]('include')){delete queryQueues[_0x429f('0x2f')];}_0x23567f[_0x429f('0x30')](db[_0x429f('0x31')][_0x429f('0x14')](queryQueues));_0x23567f['push'](db['ChatQueue']['findAll'](queryQueues));_0x23567f['push'](db['FaxQueue']['findAll'](queryQueues));_0x23567f['push'](db[_0x429f('0x32')][_0x429f('0x14')](queryQueues));_0x23567f[_0x429f('0x30')](db[_0x429f('0x33')][_0x429f('0x14')](queryQueues));_0x23567f[_0x429f('0x30')](db[_0x429f('0x34')]['findAll'](queryQueues));_0x23567f['push'](db[_0x429f('0x35')][_0x429f('0x14')](queryQueues));_0x23567f[_0x429f('0x30')](db['User'][_0x429f('0x14')](queryTelephones));_0x23567f[_0x429f('0x30')](db['Trunk'][_0x429f('0x14')](queryTrunks));_0x23567f['push'](db['Campaign']['findAll'](queryCampaigns));_0x23567f[_0x429f('0x30')](db[_0x429f('0x7')]['findAll'](queryAgents));break;case _0x429f('0x36'):_0x46808c[_0x1853be](_0x429f('0x2c'));_0x46808c[_0x1853be](_0x429f('0x2d'));_0x23567f['push'](getAssociatedResources(_0x429f('0x37'),_0x41299a[_0x429f('0x22')],_0x429f('0x31')));_0x23567f[_0x429f('0x30')](getAssociatedResources('ChatQueues',_0x41299a[_0x429f('0x22')],'ChatQueue'));_0x23567f['push'](getAssociatedResources('FaxQueues',_0x41299a['userProfileId'],_0x429f('0x38')));_0x23567f['push'](getAssociatedResources(_0x429f('0x39'),_0x41299a[_0x429f('0x22')],_0x429f('0x32')));_0x23567f[_0x429f('0x30')](getAssociatedResources('MailQueues',_0x41299a['userProfileId'],'MailQueue'));_0x23567f['push'](getAssociatedResources(_0x429f('0x12'),_0x41299a[_0x429f('0x22')],_0x429f('0x34')));_0x23567f[_0x429f('0x30')](getAssociatedResources(_0x429f('0x13'),_0x41299a[_0x429f('0x22')],'WhatsappQueue'));_0x23567f[_0x429f('0x30')](getAssociatedResources('Telephones',_0x41299a[_0x429f('0x22')],'User'));_0x23567f[_0x429f('0x30')](getAssociatedResources(_0x429f('0x16'),_0x41299a[_0x429f('0x22')],'Trunk'));_0x23567f[_0x429f('0x30')](getAssociatedResources('IvrCampaigns',_0x41299a['userProfileId'],_0x429f('0x1b')));_0x23567f['push'](db[_0x429f('0x7')][_0x429f('0x14')](queryAgents));break;case _0x429f('0x9'):_0x46808c[_0x1853be](_0x429f('0x2c'));_0x46808c[_0x1853be]('voice:outbound');_0x23567f['push'](_0x41299a[_0x429f('0x3a')]({'attributes':['id','name']}));_0x23567f[_0x429f('0x30')](_0x41299a[_0x429f('0x3b')]({'attributes':['id',_0x429f('0x5')]}));_0x23567f[_0x429f('0x30')](_0x41299a[_0x429f('0x3c')]({'attributes':['id',_0x429f('0x5')]}));_0x23567f[_0x429f('0x30')](_0x41299a[_0x429f('0x3d')]({'attributes':['id',_0x429f('0x5')]}));_0x23567f[_0x429f('0x30')](_0x41299a[_0x429f('0x3e')]({'attributes':['id','name']}));_0x23567f['push'](_0x41299a[_0x429f('0x3f')]({'attributes':['id',_0x429f('0x5')]}));_0x23567f[_0x429f('0x30')](_0x41299a[_0x429f('0x40')]({'attributes':['id','name']}));break;}return BPromise[_0x429f('0x41')](_0x23567f);}})[_0x429f('0xe')](function(_0x5188aa){if(_0x5188aa&&_0x5188aa[_0x429f('0x1e')]){for(var _0x5f3e2d=0x0;_0x5f3e2d<_0x5188aa[_0x429f('0x1e')];_0x5f3e2d+=0x1){for(var _0x2d0733=0x0;_0x2d0733<_0x5188aa[_0x5f3e2d][_0x429f('0x1e')];_0x2d0733+=0x1){switch(_0x5f3e2d){case 0x0:joinOrLeaveQueues(_0x46808c,_0x1853be,'voice',_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x1:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x42'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x2:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x43'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x3:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x44'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x4:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x45'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x5:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x46'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x6:joinOrLeaveQueues(_0x46808c,_0x1853be,_0x429f('0x47'),_0x5188aa[_0x5f3e2d][_0x2d0733]);break;case 0x7:if(_0x228243[_0x429f('0x8')]!=='agent')_0x46808c[_0x1853be](util[_0x429f('0x1c')](_0x429f('0x48'),_0x5188aa[_0x5f3e2d][_0x2d0733][_0x429f('0x5')]));break;case 0x8:if(_0x228243[_0x429f('0x8')]!=='agent')_0x46808c[_0x1853be](util[_0x429f('0x1c')]('trunk:%s',_0x5188aa[_0x5f3e2d][_0x2d0733][_0x429f('0x5')]));break;case 0x9:if(_0x228243[_0x429f('0x8')]!==_0x429f('0x9'))_0x46808c[_0x1853be](util['format'](_0x429f('0x49'),_0x5188aa[_0x5f3e2d][_0x2d0733][_0x429f('0xb')],_0x5188aa[_0x5f3e2d][_0x2d0733]['name']));break;case 0xa:_0x46808c[_0x1853be](util[_0x429f('0x1c')]('user:%s',_0x5188aa[_0x5f3e2d][_0x2d0733][_0x429f('0x5')]));break;}}}}})[_0x429f('0xe')](function(){if(_0x1853be===_0x429f('0x4a')){var _0x4b5dd6=_['map'](_0x228243[_0x429f('0x24')],'id');return _0x228243['removeChatInteractions'](_0x4b5dd6)[_0x429f('0xe')](function(){for(var _0x5db2b1=0x0;_0x5db2b1<_0x4b5dd6[_0x429f('0x1e')];_0x5db2b1+=0x1){_0x276241['emit'](_0x429f('0x4b'),{'ChatInteractionId':Number(_0x4b5dd6[_0x5db2b1]),'UserId':Number(_0x228243['id'])});}});}})[_0x429f('0xe')](function(){if(_0x1853be===_0x429f('0x4a')){var _0x59b540=_[_0x429f('0x18')](_0x228243[_0x429f('0x26')],'id');return _0x228243['removeMailInteractions'](_0x59b540)[_0x429f('0xe')](function(){for(var _0xac318a=0x0;_0xac318a<_0x59b540[_0x429f('0x1e')];_0xac318a+=0x1){_0x276241['emit'](_0x429f('0x4c'),{'MailInteractionId':Number(_0x59b540[_0xac318a]),'UserId':Number(_0x228243['id'])});}});}})[_0x429f('0xe')](function(){if(_0x1853be==='leave'){var _0x3d9f99=_[_0x429f('0x18')](_0x228243[_0x429f('0x4d')],'id');return _0x228243[_0x429f('0x4e')](_0x3d9f99)[_0x429f('0xe')](function(){for(var _0x47dd11=0x0;_0x47dd11<_0x3d9f99[_0x429f('0x1e')];_0x47dd11+=0x1){_0x276241['emit'](_0x429f('0x4f'),{'FaxInteractionId':Number(_0x3d9f99[_0x47dd11]),'UserId':Number(_0x228243['id'])});}});}})['then'](function(){if(_0x1853be==='leave'){var _0x417a06=_[_0x429f('0x18')](_0x228243[_0x429f('0x27')],'id');return _0x228243[_0x429f('0x50')](_0x417a06)[_0x429f('0xe')](function(){for(var _0x406133=0x0;_0x406133<_0x417a06[_0x429f('0x1e')];_0x406133+=0x1){_0x276241[_0x429f('0x51')](_0x429f('0x52'),{'SmsInteractionId':Number(_0x417a06[_0x406133]),'UserId':Number(_0x228243['id'])});}});}})[_0x429f('0xe')](function(){if(_0x1853be===_0x429f('0x4a')){var _0x23091c=_[_0x429f('0x18')](_0x228243[_0x429f('0x29')],'id');return _0x228243[_0x429f('0x53')](_0x23091c)[_0x429f('0xe')](function(){for(var _0x4621df=0x0;_0x4621df<_0x23091c[_0x429f('0x1e')];_0x4621df+=0x1){_0x276241[_0x429f('0x51')](_0x429f('0x54'),{'OpenchannelInteractionId':Number(_0x23091c[_0x4621df]),'UserId':Number(_0x228243['id'])});}});}})[_0x429f('0xe')](function(){if(_0x1853be===_0x429f('0x4a')){var _0x34a396=_[_0x429f('0x18')](_0x228243[_0x429f('0x2a')],'id');return _0x228243[_0x429f('0x55')](_0x34a396)[_0x429f('0xe')](function(){for(var _0x295212=0x0;_0x295212<_0x34a396[_0x429f('0x1e')];_0x295212+=0x1){_0x276241['emit'](_0x429f('0x56'),{'WhatsappInteractionId':Number(_0x34a396[_0x295212]),'UserId':Number(_0x228243['id'])});}});}})[_0x429f('0x57')](function(_0x4059ce){_0x46808c[_0x429f('0x58')](_0x4059ce);});}}function onDisconnect(_0x9b2e2,_0x4f0633){joinOrLeave(_0x9b2e2,_0x429f('0x4a'),_0x4f0633);}function onConnect(_0x1982c8){joinOrLeave(_0x1982c8,_0x429f('0x59'));}exports[_0x429f('0x5a')]=function(_0x5053f2){_0x5053f2['on'](_0x429f('0x5b'),function(_0x2e423f){_0x2e423f['setMaxListeners'](0x0);_0x2e423f[_0x429f('0x5c')]=_0x2e423f[_0x429f('0x5d')]['connection'][_0x429f('0x5e')]+':'+_0x2e423f[_0x429f('0x5d')]['connection'][_0x429f('0x5f')];_0x2e423f[_0x429f('0x60')]=new Date();_0x2e423f['log']=function(_0x2a053f){console['log'](_0x429f('0x61')+_0x2e423f[_0x429f('0x62')][_0x429f('0x5')]+'['+_0x2e423f[_0x429f('0x5c')]+']',_0x2a053f);};_0x2e423f['on'](_0x429f('0x63'),function(){onDisconnect(_0x2e423f,_0x5053f2);_0x2e423f[_0x429f('0x58')](_0x429f('0x64'));});onConnect(_0x2e423f);_0x2e423f[_0x429f('0x58')](_0x429f('0x65'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index f361b56..a111295 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 _0xec5b=['ChatOfflineMessage','afterCreate','newmessage','Sms','newinteraction','SmsInteraction','closedinteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','EventManager','Trigger,\x20%s','error','code','catch','get','motionChannel','event','direction','then','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','name','agent','channel','AfterCreateMessage','offlineMessage','opened','resolve','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','SIP/%s','AfterCreate','closed','changed','substatus','AfterUpdate','User','fullname','email','internal','length','hasOwnProperty','model','hook','callback','condition','../../mysqldb','jayson/promise','triggers','Chat','ChatInteraction','afterUpdate','ChatMessage'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xec5b,0x1a3));var _0xbec5=function(_0x5d7fbf,_0x559e0f){_0x5d7fbf=_0x5d7fbf-0x0;var _0x441d4c=_0xec5b[_0x5d7fbf];return _0x441d4c;};'use strict';var util=require('util');var db=require(_0xbec5('0x0'))['db'];var jayson=require(_0xbec5('0x1'));var logger=require('../logger')(_0xbec5('0x2'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xbec5('0x3'),'model':_0xbec5('0x4'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xbec5('0x3'),'model':_0xbec5('0x4'),'event':_0xbec5('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbec5('0x3'),'model':_0xbec5('0x6'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Chat','model':_0xbec5('0x7'),'event':_0xbec5('0x8'),'condition':_0xbec5('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0xbec5('0xa'),'model':'SmsInteraction','event':_0xbec5('0x8'),'condition':_0xbec5('0xb'),'callback':afterCreate},{'channel':_0xbec5('0xa'),'model':_0xbec5('0xc'),'event':_0xbec5('0x5'),'condition':_0xbec5('0xd'),'callback':afterUpdate},{'channel':_0xbec5('0xa'),'model':_0xbec5('0xe'),'event':_0xbec5('0x8'),'condition':_0xbec5('0x9'),'callback':afterCreateMessage},{'channel':_0xbec5('0xf'),'model':_0xbec5('0x10'),'event':_0xbec5('0x8'),'condition':_0xbec5('0xb'),'callback':afterCreate},{'channel':_0xbec5('0xf'),'model':'WhatsappInteraction','event':_0xbec5('0x5'),'condition':_0xbec5('0xd'),'callback':afterUpdate},{'channel':_0xbec5('0xf'),'model':_0xbec5('0x11'),'event':'afterCreate','condition':_0xbec5('0x9'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xbec5('0x12'),'event':_0xbec5('0x8'),'condition':_0xbec5('0xb'),'callback':afterCreate},{'channel':'Fax','model':_0xbec5('0x12'),'event':_0xbec5('0x5'),'condition':_0xbec5('0xd'),'callback':afterUpdate},{'channel':'Fax','model':_0xbec5('0x13'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xbec5('0x14'),'model':_0xbec5('0x15'),'event':_0xbec5('0x8'),'condition':_0xbec5('0xb'),'callback':afterCreate},{'channel':_0xbec5('0x14'),'model':_0xbec5('0x15'),'event':_0xbec5('0x5'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xbec5('0x14'),'model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Openchannel','model':_0xbec5('0x16'),'event':'afterCreate','condition':_0xbec5('0xb'),'callback':afterCreate},{'channel':_0xbec5('0x17'),'model':'OpenchannelInteraction','event':_0xbec5('0x5'),'condition':_0xbec5('0xd'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xbec5('0x18'),'event':_0xbec5('0x8'),'condition':_0xbec5('0x9'),'callback':afterCreateMessage}];function request(_0x23fab8){return client[_0xbec5('0x19')](_0xbec5('0x1a'),_0x23fab8)['then'](function(_0x36c40b){logger['info'](_0xbec5('0x1b'),_0xbec5('0x1a'),_0x36c40b);if(_0x36c40b['error']){if(_0x36c40b[_0xbec5('0x1c')][_0xbec5('0x1d')]===0x1f4){logger['error'](_0xbec5('0x1b'),_0xbec5('0x1a'),_0x36c40b[_0xbec5('0x1c')]);}}})[_0xbec5('0x1e')](function(_0x143115){logger['error'](_0xbec5('0x1b'),_0xbec5('0x1a'),_0x143115);});}function afterCreateMessage(_0x28da3a){return function(_0x426fd0){_0x426fd0=_0x426fd0[_0xbec5('0x1f')]({'plain':!![]});_0x426fd0['channel']=_0x28da3a;_0x426fd0[_0xbec5('0x20')]=_0x28da3a;_0x426fd0[_0xbec5('0x21')]=_0x426fd0[_0xbec5('0x22')];Promise['resolve']()[_0xbec5('0x23')](function(){if(typeof _0x426fd0[_0xbec5('0x24')]===_0xbec5('0x25'))return null;var _0x22d7b0='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x426fd0[_0xbec5('0x24')];return db[_0xbec5('0x26')][_0xbec5('0x27')](_0x22d7b0,{'type':db[_0xbec5('0x28')][_0xbec5('0x29')][_0xbec5('0x2a')],'raw':!![]});})[_0xbec5('0x23')](function(_0x4e17bd){if(_0x4e17bd){_0x426fd0[_0xbec5('0x2b')]=_0x4e17bd[0x0];}if(typeof _0x426fd0[_0xbec5('0x2c')]===_0xbec5('0x25'))return;return getAgent(_0x426fd0[_0xbec5('0x2c')]);})[_0xbec5('0x23')](function(_0x1e2843){if(_0x1e2843){_0x426fd0[_0xbec5('0x2d')]=util[_0xbec5('0x2e')]('SIP/%s',_0x1e2843[_0xbec5('0x2f')]);_0x426fd0[_0xbec5('0x30')]=_0x1e2843;_0x426fd0[_0xbec5('0x31')]=_0x28da3a;return request({'event':'incomingmessage','message':_0x426fd0});}else{return request({'event':'outgoingmessage','message':_0x426fd0});}})[_0xbec5('0x1e')](function(_0x30a4e7){logger[_0xbec5('0x1c')]('Trigger,\x20%s',_0xbec5('0x32'),_0x30a4e7);});};}function afterCreateOfflineMessage(_0x5ce115){return function(_0x56e1d4){_0x56e1d4=_0x56e1d4[_0xbec5('0x1f')]({'plain':!![]});_0x56e1d4[_0xbec5('0x31')]=_0x5ce115;_0x56e1d4[_0xbec5('0x20')]=_0x5ce115;_0x56e1d4[_0xbec5('0x21')]=_0xbec5('0x33');return request({'event':_0x56e1d4[_0xbec5('0x21')],'message':_0x56e1d4});};}function afterCreate(_0x23bca7,_0x26bc96){return function(_0x33bb13){_0x33bb13=_0x33bb13[_0xbec5('0x1f')]({'plain':!![]});_0x33bb13[_0xbec5('0x31')]=_0x23bca7;_0x33bb13[_0xbec5('0x20')]=_0x23bca7;_0x33bb13[_0xbec5('0x21')]=_0xbec5('0x34');Promise[_0xbec5('0x35')]()[_0xbec5('0x23')](function(){var _0x4a48bc=_0xbec5('0x36')+_0x33bb13[_0xbec5('0x24')];return db[_0xbec5('0x26')][_0xbec5('0x27')](_0x4a48bc,{'type':db['Sequelize'][_0xbec5('0x29')][_0xbec5('0x2a')],'raw':!![]});})[_0xbec5('0x23')](function(_0x11a662){if(_0x11a662){_0x33bb13[_0xbec5('0x2b')]=_0x11a662[0x0];}if(typeof _0x33bb13[_0xbec5('0x2c')]===_0xbec5('0x25'))return;return getAgent(_0x33bb13[_0xbec5('0x2c')]);})[_0xbec5('0x23')](function(_0x4bdd4e){if(_0x4bdd4e){_0x33bb13[_0xbec5('0x2d')]=util[_0xbec5('0x2e')](_0xbec5('0x37'),_0x4bdd4e['name']);_0x33bb13[_0xbec5('0x30')]=_0x4bdd4e;}return request({'event':_0x26bc96,'message':_0x33bb13});})['catch'](function(_0x5a94e1){logger['error'](_0xbec5('0x1b'),_0xbec5('0x38'),_0x5a94e1);});};}function afterUpdate(_0x470220){return function(_0x449e8e){var _0x48b006=_0x449e8e['changed'](_0xbec5('0x39'))&&_0x449e8e[_0xbec5('0x39')];var _0x594653=_0x449e8e[_0xbec5('0x3a')](_0xbec5('0x3b'));if(_0x48b006||_0x594653){var _0xacfe4d=_0x48b006?_0xbec5('0xd'):'substatus';var _0x1b5884=_0x449e8e[_0xbec5('0x1f')]({'plain':!![]});_0x1b5884[_0xbec5('0x31')]=_0x470220;_0x1b5884[_0xbec5('0x20')]=_0x470220;_0x1b5884[_0xbec5('0x21')]=_0x48b006?_0xbec5('0x39'):_0xbec5('0x3b');var _0x3aeb7c=_0xbec5('0x36')+_0x1b5884[_0xbec5('0x24')];return db[_0xbec5('0x26')][_0xbec5('0x27')](_0x3aeb7c,{'type':db[_0xbec5('0x28')]['QueryTypes'][_0xbec5('0x2a')],'raw':!![]})[_0xbec5('0x23')](function(_0x30c7ac){if(_0x30c7ac){_0x1b5884[_0xbec5('0x2b')]=_0x30c7ac[0x0];}if(typeof _0x1b5884[_0xbec5('0x2c')]==='undefined')return;return getAgent(_0x1b5884['UserId']);})['then'](function(_0x458423){if(_0x458423){_0x1b5884[_0xbec5('0x2d')]=util[_0xbec5('0x2e')](_0xbec5('0x37'),_0x458423[_0xbec5('0x2f')]);_0x1b5884[_0xbec5('0x30')]=_0x458423;}return request({'event':_0xacfe4d,'message':_0x1b5884});})[_0xbec5('0x1e')](function(_0x57c96a){logger['error']('Trigger,\x20%s',_0xbec5('0x3c'),_0x57c96a);});}};}function getAgent(_0x2e8548){return db[_0xbec5('0x3d')]['find']({'where':{'id':_0x2e8548},'attributes':['id','name',_0xbec5('0x3e'),_0xbec5('0x3f'),_0xbec5('0x40')],'raw':!![]})[_0xbec5('0x23')](function(_0x540019){return _0x540019;});}exports['default']=function(){for(var _0x440b8e=0x0;_0x440b8e=_0x515638['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x340df9(_0xc834dc);})[_0x409a('0x11')](function(_0x4dee0a){_0x5ad2d1(_0x4dee0a);});});}; \ No newline at end of file +var _0x87db=['whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','mail','chat','sms'];(function(_0x1270b5,_0x1ad59a){var _0x2f4dfb=function(_0x4ed0e2){while(--_0x4ed0e2){_0x1270b5['push'](_0x1270b5['shift']());}};_0x2f4dfb(++_0x1ad59a);}(_0x87db,0xec));var _0xb87d=function(_0x61230a,_0x18a987){_0x61230a=_0x61230a-0x0;var _0x599813=_0x87db[_0x61230a];return _0x599813;};'use strict';var _=require(_0xb87d('0x0'));var BPromise=require('bluebird');var db=require(_0xb87d('0x1'))['db'];var util=require('./license/util');var channels=[_0xb87d('0x2'),_0xb87d('0x3'),_0xb87d('0x4'),'fax',_0xb87d('0x5'),_0xb87d('0x6'),_0xb87d('0x7')];exports[_0xb87d('0x8')]=function(){return channels;};exports[_0xb87d('0x9')]=function(_0x55a485){_0x55a485=_0x55a485[_0xb87d('0xa')]();return _['includes'](channels,_0x55a485);};exports[_0xb87d('0xb')]=function(_0x48a60d,_0x4ad412,_0x5904b9,_0x4ae538){var _0x5aa81a={'loginAttempts':_0x4ad412,'blocked':_0x5904b9};if(!_[_0xb87d('0xc')](_0x4ae538)){_0x5aa81a[_0xb87d('0xd')]=_0x4ae538;}return _0x48a60d[_0xb87d('0xe')](_0x5aa81a);};exports['getLicense']=function(_0x59bcd6){return new BPromise(function(_0x34309e,_0x18277e){var _0x33f221=0x0;if(_0x59bcd6[_0xb87d('0xf')]!==_0xb87d('0x10')){_0x34309e(_0x59bcd6);}db['User']['count']({'where':{'role':_0xb87d('0x10'),'online':!![],'id':{'$ne':_0x59bcd6['id']}}})[_0xb87d('0x11')](function(_0x4b5db4){_0x33f221=_0x4b5db4;return util[_0xb87d('0x12')]();})[_0xb87d('0x11')](function(_0x36d954){if(_0x36d954&&_0x36d954['agents']&&_0x33f221>=_0x36d954[_0xb87d('0x13')]){throw Error(_0xb87d('0x14'));}_0x34309e(_0x59bcd6);})[_0xb87d('0x15')](function(_0x518a55){_0x18277e(_0x518a55);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 2e05dd9..a496f33 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f0d=['../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','message','Not\x20Found','Forbidden','error','status','send','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0x6f0d[_0x366388];return _0x41c97e;};'use strict';var util=require('util');var logger=require(_0xd6f0('0x0'))(_0xd6f0('0x1'));var APIError=function(_0xd1480,_0x107a8c){this['message']=_0xd1480||_0xd6f0('0x2');this[_0xd6f0('0x3')]=_0x107a8c||_0xd6f0('0x4');util[_0xd6f0('0x5')](APIError,Error);};var APIBadRequestError=function(_0x3a757f){this['message']=_0x3a757f||_0xd6f0('0x6');this['name']=_0xd6f0('0x6');util[_0xd6f0('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x8b89a9){this[_0xd6f0('0x7')]=_0x8b89a9||'Entity\x20not\x20found';this['name']=_0xd6f0('0x8');util[_0xd6f0('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x2854cd){switch(_0x2854cd){case _0xd6f0('0x6'):return 0x190;case _0xd6f0('0x9'),'OutOfInterval':return 0x193;case _0xd6f0('0x8'):return 0x194;default:return 0x1f4;}}function handleError(_0xee144c){return function(_0x329f69){logger[_0xd6f0('0xa')](_0x329f69['stack']);var _0x1ce8d5=getStatusCode(_0x329f69[_0xd6f0('0x3')]);if(_0x329f69[_0xd6f0('0x3')])delete _0x329f69[_0xd6f0('0x3')];return _0xee144c[_0xd6f0('0xb')](_0x1ce8d5)[_0xd6f0('0xc')](_0x329f69);};}module[_0xd6f0('0xd')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x750a=['Error','inherits','Bad\x20Request','Forbidden','OutOfInterval','stack','status','exports','../config/logger','message','Internal\x20Server\x20Error','name'];(function(_0x178216,_0x20a145){var _0x279c80=function(_0x370f1e){while(--_0x370f1e){_0x178216['push'](_0x178216['shift']());}};_0x279c80(++_0x20a145);}(_0x750a,0x140));var _0xa750=function(_0x31db9f,_0x1cbb99){_0x31db9f=_0x31db9f-0x0;var _0x224cfd=_0x750a[_0x31db9f];return _0x224cfd;};'use strict';var util=require('util');var logger=require(_0xa750('0x0'))('api');var APIError=function(_0x499583,_0x139fa5){this[_0xa750('0x1')]=_0x499583||_0xa750('0x2');this[_0xa750('0x3')]=_0x139fa5||_0xa750('0x4');util[_0xa750('0x5')](APIError,Error);};var APIBadRequestError=function(_0x562911){this[_0xa750('0x1')]=_0x562911||_0xa750('0x6');this[_0xa750('0x3')]=_0xa750('0x6');util[_0xa750('0x5')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x3d7c43){this['message']=_0x3d7c43||'Entity\x20not\x20found';this[_0xa750('0x3')]='Not\x20Found';util[_0xa750('0x5')](APINotFoundError,APIError);};function getStatusCode(_0x1760f5){switch(_0x1760f5){case'Bad\x20Request':return 0x190;case _0xa750('0x7'),_0xa750('0x8'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function handleError(_0x5aca9c){return function(_0xcb62ae){logger['error'](_0xcb62ae[_0xa750('0x9')]);var _0x5adaae=getStatusCode(_0xcb62ae['name']);if(_0xcb62ae[_0xa750('0x3')])delete _0xcb62ae[_0xa750('0x3')];return _0x5aca9c[_0xa750('0xa')](_0x5adaae)['send'](_0xcb62ae);};}module[_0xa750('0xb')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index c4043d6..c76473e 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf076=['status','render','send','exports','404'];(function(_0x3edc88,_0x2a9e59){var _0x2eb52c=function(_0x50af16){while(--_0x50af16){_0x3edc88['push'](_0x3edc88['shift']());}};_0x2eb52c(++_0x2a9e59);}(_0xf076,0x13e));var _0x6f07=function(_0xa5d4b6,_0x1bf2e7){_0xa5d4b6=_0xa5d4b6-0x0;var _0x2340dc=_0xf076[_0xa5d4b6];return _0x2340dc;};'use strict';module[_0x6f07('0x0')][0x194]=function pageNotFound(_0x58df87,_0x350421){var _0x559568=_0x6f07('0x1');var _0x1ef7ff=0x194;var _0x3167af={'status':_0x1ef7ff};_0x350421[_0x6f07('0x2')](_0x3167af[_0x6f07('0x2')]);_0x350421[_0x6f07('0x3')](_0x559568,{},function(_0x34d5e5,_0x592281){if(_0x34d5e5){return _0x350421['status'](_0x3167af[_0x6f07('0x2')])['json'](_0x3167af);}_0x350421[_0x6f07('0x4')](_0x592281);});}; \ No newline at end of file +var _0x59ae=['404','status','json','send'];(function(_0x2addb5,_0x642904){var _0xadee07=function(_0x5606df){while(--_0x5606df){_0x2addb5['push'](_0x2addb5['shift']());}};_0xadee07(++_0x642904);}(_0x59ae,0xa4));var _0xe59a=function(_0x12a981,_0x62d1e4){_0x12a981=_0x12a981-0x0;var _0x41aaab=_0x59ae[_0x12a981];return _0x41aaab;};'use strict';module['exports'][0x194]=function pageNotFound(_0x4017d1,_0x116020){var _0x1b5b57=_0xe59a('0x0');var _0x89f5ea=0x194;var _0x2b0fef={'status':_0x89f5ea};_0x116020[_0xe59a('0x1')](_0x2b0fef[_0xe59a('0x1')]);_0x116020['render'](_0x1b5b57,{},function(_0x50b379,_0x512022){if(_0x50b379){return _0x116020[_0xe59a('0x1')](_0x2b0fef[_0xe59a('0x1')])[_0xe59a('0x2')](_0x2b0fef);}_0x116020[_0xe59a('0x3')](_0x512022);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index a90506f..1504957 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x132c=['UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','../api/cmHopperBlack/cmHopperBlack.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','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','VtigerField','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','hasOne','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteractions','FaxInteraction','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','Lists','Team','user_has_teams','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_sms_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','VoicePrefixes','UserVoicePrefix','ChatQueues','FaxQueue','FaxQueues','SmsQueues','OpenchannelQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','UserWhatsappQueue','CmList','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','SquareProjects','user_has_square_projects','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','CmHopperBlack','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPause','mandatoryDispositionPauseId','UserVoiceQueue','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Dispositions','Answers','ListId','TemplateId','Agents','team_has_mail_queues','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Interaction','ChatOfflineMessage','TagId','List','Dashboard','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','user_has_fax_interactions','AttachmentId','UserFaxQueue','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','IntervalId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatApplication','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','chat_group_has_users','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','CampaignId','OwnerId','All','Any','AutomationAnyId','Action','Actions','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','CustomReportId','Mohs','ItemType','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Fields','DefaultReportId','MetricId','Subjects','SubjectId','Descriptions','AccountId','Subject','Description','DescriptionId','Field','FieldId','VariableId','Configurations','SugarcrmField','DeskConfiguration','int_desk_configuration_has_tags','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','Dynamics365Account','ToId','SessionId','JscriptyAnswerReport','ProjectId','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToUserId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CustomFields','Queues','voice_queues_has_cm_lists','Extensions','UserProfileSection','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','whatsapp_interaction_has_tags','user_has_whatsapp_interactions','ToQueueId','WhatsappQueueId','user','../config/environment','jstz','determine','sequelize','defaultsDeep','motion2','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','xC@LL1234','database','username','options','password','User','import','VoiceChanSpy','VoiceContext','VoiceExtension','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model'];(function(_0x3d00db,_0x3692b3){var _0x41f115=function(_0x3c94fd){while(--_0x3c94fd){_0x3d00db['push'](_0x3d00db['shift']());}};_0x41f115(++_0x3692b3);}(_0x132c,0x1c9));var _0xc132=function(_0x2e86d3,_0x4bfd72){_0x2e86d3=_0x2e86d3-0x0;var _0x16b599=_0x132c[_0x2e86d3];return _0x16b599;};'use strict';var config=require(_0xc132('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xc132('0x1'));var timezone=jstz[_0xc132('0x2')]();config[_0xc132('0x3')]=_[_0xc132('0x4')](config['sequelize'],{'database':_0xc132('0x5'),'username':_0xc132('0x6'),'password':'xC@LL1234','options':{'host':_0xc132('0x7'),'port':0xcea,'dialect':_0xc132('0x8'),'dialectOptions':{'charset':_0xc132('0x9')},'logging':![],'timezone':timezone[_0xc132('0xa')](),'define':{'charset':_0xc132('0xb'),'collate':_0xc132('0xc')}}});config[_0xc132('0xd')]=_[_0xc132('0x4')](config[_0xc132('0xd')],{'database':_0xc132('0x5'),'username':_0xc132('0x6'),'password':_0xc132('0xe'),'options':{'host':_0xc132('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xc132('0xa')](),'define':{'charset':_0xc132('0xb'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xc132('0xf')],config['sequelize'][_0xc132('0x10')],config['sequelize']['password'],config[_0xc132('0x3')][_0xc132('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xc132('0xf')],config['sequelizeHistory'][_0xc132('0x10')],config[_0xc132('0xd')][_0xc132('0x12')],config[_0xc132('0xd')][_0xc132('0x11')])};db[_0xc132('0x13')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/user/user.model');db[_0xc132('0x15')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xc132('0x16')]=db['sequelize'][_0xc132('0x14')]('../api/voiceContext/voiceContext.model');db[_0xc132('0x17')]=db[_0xc132('0x3')]['import']('../api/voiceExtension/voiceExtension.model');db[_0xc132('0x18')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x19'));db['VoiceQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1a'));db[_0xc132('0x1b')]=db['sequelize'][_0xc132('0x14')]('../api/voiceRecording/voiceRecording.model');db['ScreenRecording']=db[_0xc132('0x3')]['import']('../api/screenRecording/screenRecording.model');db[_0xc132('0x1c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1d'));db[_0xc132('0x1e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x1f'));db[_0xc132('0x20')]=db[_0xc132('0x3')]['import'](_0xc132('0x21'));db[_0xc132('0x22')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x23'));db[_0xc132('0x24')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x25'));db[_0xc132('0x26')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xc132('0x27')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x28'));db[_0xc132('0x29')]=db['sequelize'][_0xc132('0x14')]('../api/trunk/trunk.model');db[_0xc132('0x2a')]=db[_0xc132('0x3')]['import'](_0xc132('0x2b'));db[_0xc132('0x2c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x2d'));db['UserVoiceQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x2e'));db[_0xc132('0x2f')]=db[_0xc132('0x3')]['import'](_0xc132('0x30'));db[_0xc132('0x31')]=db['sequelize'][_0xc132('0x14')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x32'));db[_0xc132('0x33')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x34'));db['UserOpenchannelQueue']=db[_0xc132('0x3')]['import'](_0xc132('0x35'));db['UserWhatsappQueue']=db['sequelize'][_0xc132('0x14')](_0xc132('0x36'));db[_0xc132('0x37')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x38'));db[_0xc132('0x39')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x3a'));db[_0xc132('0x3b')]=db['sequelize']['import'](_0xc132('0x3c'));db[_0xc132('0x3d')]=db['sequelize'][_0xc132('0x14')]('../api/mailQueue/mailQueue.model');db[_0xc132('0x3e')]=db[_0xc132('0x3')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0xc132('0x3f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x40'));db[_0xc132('0x41')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x42'));db[_0xc132('0x43')]=db[_0xc132('0x3')]['import'](_0xc132('0x44'));db[_0xc132('0x45')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x46'));db['Dashboard']=db[_0xc132('0x3')]['import'](_0xc132('0x47'));db[_0xc132('0x48')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x49'));db[_0xc132('0x4a')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x4b'));db[_0xc132('0x4c')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x4d'));db[_0xc132('0x4e')]=db[_0xc132('0x3')]['import']('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/faxQueue/faxQueue.model');db[_0xc132('0x4f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x50'));db[_0xc132('0x51')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x52'));db[_0xc132('0x53')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x54'));db[_0xc132('0x55')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x56'));db[_0xc132('0x57')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/smsMessage/smsMessage.model');db[_0xc132('0x58')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x59'));db[_0xc132('0x5a')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x5b'));db[_0xc132('0x5c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x5d'));db[_0xc132('0x5e')]=db['sequelize'][_0xc132('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xc132('0x5f')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db['sequelize'][_0xc132('0x14')](_0xc132('0x60'));db[_0xc132('0x61')]=db[_0xc132('0x3')]['import'](_0xc132('0x62'));db[_0xc132('0x63')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x64'));db['ChatApplication']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x65'));db['ChatInteraction']=db[_0xc132('0x3')]['import'](_0xc132('0x66'));db[_0xc132('0x67')]=db[_0xc132('0x3')]['import'](_0xc132('0x68'));db['ChatOfflineMessage']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x69'));db[_0xc132('0x6a')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x6b'));db[_0xc132('0x6c')]=db['sequelize']['import'](_0xc132('0x6d'));db[_0xc132('0x6e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x6f'));db[_0xc132('0x70')]=db[_0xc132('0x3')]['import'](_0xc132('0x71'));db[_0xc132('0x72')]=db[_0xc132('0x3')]['import'](_0xc132('0x73'));db[_0xc132('0x74')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x75'));db['CmHopperBlack']=db['sequelize']['import'](_0xc132('0x76'));db['CmHopperFinal']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc132('0x77')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x78'));db[_0xc132('0x79')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7a'));db['Action']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7b'));db[_0xc132('0x7c')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7d'));db[_0xc132('0x7e')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x7f'));db[_0xc132('0x80')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x81'));db[_0xc132('0x82')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/condition/condition.model');db[_0xc132('0x83')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x84'));db[_0xc132('0x85')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x86'));db['Cdr']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cdr/cdr.model');db[_0xc132('0x87')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x88'));db[_0xc132('0x89')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x8a'));db[_0xc132('0x8b')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x8c'));db[_0xc132('0x8d')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x8e'));db[_0xc132('0x8f')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/contactItemType/contactItemType.model');db[_0xc132('0x90')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x91'));db[_0xc132('0x92')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x93'));db[_0xc132('0x94')]=db[_0xc132('0x3')]['import'](_0xc132('0x95'));db['Trigger']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x96'));db[_0xc132('0x97')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x98'));db[_0xc132('0x99')]=db[_0xc132('0x3')]['import']('../api/integration/integration.model');db[_0xc132('0x9a')]=db['sequelize']['import'](_0xc132('0x9b'));db[_0xc132('0x9c')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x9d'));db['AnalyticDefaultReport']=db[_0xc132('0x3')]['import'](_0xc132('0x9e'));db['AnalyticExtractedReport']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xc132('0x9f')]=db[_0xc132('0x3')]['import'](_0xc132('0xa0'));db[_0xc132('0xa1')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xa2'));db[_0xc132('0xa3')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xa4'));db[_0xc132('0xa5')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc132('0xa6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xa7'));db[_0xc132('0xa8')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0xc132('0xa9')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xc132('0xaa')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xab'));db[_0xc132('0xac')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xad'));db['DeskConfiguration']=db[_0xc132('0x3')]['import'](_0xc132('0xae'));db[_0xc132('0xaf')]=db['sequelize'][_0xc132('0x14')]('../api/intDeskField/intDeskField.model');db[_0xc132('0xb0')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0xc132('0xb1')]=db[_0xc132('0x3')]['import'](_0xc132('0xb2'));db[_0xc132('0xb3')]=db[_0xc132('0x3')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize']['import'](_0xc132('0xb4'));db[_0xc132('0xb5')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xb6'));db[_0xc132('0xb7')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xb8'));db['FreshdeskAccount']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xb9'));db[_0xc132('0xba')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xbb'));db[_0xc132('0xbc')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xc132('0xbd')]=db[_0xc132('0x3')]['import'](_0xc132('0xbe'));db['VtigerConfiguration']=db[_0xc132('0x3')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xc132('0xbf')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xc132('0x3')]['import'](_0xc132('0xc0'));db[_0xc132('0xc1')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc2'));db[_0xc132('0xc3')]=db['sequelize']['import'](_0xc132('0xc4'));db['Dynamics365Account']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc5'));db[_0xc132('0xc6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc7'));db[_0xc132('0xc8')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xc9'));db[_0xc132('0xca')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xcb'));db[_0xc132('0xcc')]=db['sequelize']['import'](_0xc132('0xcd'));db[_0xc132('0xce')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xcf'));db['Integration']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/integration/integration.model');db[_0xc132('0xd0')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xd1'));db[_0xc132('0xd2')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xd3'));db[_0xc132('0xd4')]=db[_0xc132('0x3')]['import'](_0xc132('0xd5'));db['JscriptyAnswerReport']=db[_0xc132('0x3')]['import'](_0xc132('0xd6'));db[_0xc132('0xd7')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xd8'));db['JscriptySessionReport']=db['sequelize'][_0xc132('0x14')](_0xc132('0xd9'));db[_0xc132('0xda')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0xc132('0xdb')]=db['sequelize']['import'](_0xc132('0xdc'));db[_0xc132('0xdd')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xde'));db[_0xc132('0xdf')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe0'));db[_0xc132('0xe1')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/setting/setting.model');db[_0xc132('0xe2')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe3'));db[_0xc132('0xe4')]=db[_0xc132('0x3')]['import']('../api/squareProject/squareProject.model');db[_0xc132('0xe5')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xe6'));db[_0xc132('0xe7')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xe8'));db['Team']=db[_0xc132('0x3')]['import'](_0xc132('0xe9'));db[_0xc132('0xea')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xeb'));db[_0xc132('0xec')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xed'));db['Migration']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/migration/migration.model');db[_0xc132('0xee')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xef'));db[_0xc132('0xf0')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xf1'));db['MailTransferReport']=db['sequelize'][_0xc132('0x14')](_0xc132('0xf2'));db[_0xc132('0xf3')]=db['sequelize'][_0xc132('0x14')](_0xc132('0xf4'));db['FaxTransferReport']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf5'));db[_0xc132('0xf6')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf7'));db[_0xc132('0xf8')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xf9'));db['CmList']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/cmList/cmList.model');db[_0xc132('0xfa')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/voicePrefix/voicePrefix.model');db[_0xc132('0xfb')]=db[_0xc132('0x3')]['import'](_0xc132('0xfc'));db['UserProfileSection']=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0xfd'));db[_0xc132('0xfe')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0xc132('0xff')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x100'));db[_0xc132('0x101')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x102'));db[_0xc132('0x103')]=db['sequelize'][_0xc132('0x14')]('../api/whatsappApplication/whatsappApplication.model');db[_0xc132('0x104')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x105'));db[_0xc132('0x106')]=db[_0xc132('0x3')]['import'](_0xc132('0x107'));db[_0xc132('0x108')]=db[_0xc132('0x3')][_0xc132('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xc132('0x109')]=db[_0xc132('0x3')]['import'](_0xc132('0x10a'));db[_0xc132('0x10b')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x10c'));db[_0xc132('0x10d')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x10e'));db[_0xc132('0x10f')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x110'));db[_0xc132('0x111')]=db[_0xc132('0x3')][_0xc132('0x14')](_0xc132('0x112'));db['UserVoicePrefix']=db[_0xc132('0x3')][_0xc132('0x14')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0xc132('0x113')]=db['sequelize'][_0xc132('0x14')](_0xc132('0x114'));db['User'][_0xc132('0x115')](db[_0xc132('0x1c')],{'as':_0xc132('0x1c'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x117')});db['User'][_0xc132('0x115')](db[_0xc132('0x113')],{'as':_0xc132('0x118'),'onDelete':_0xc132('0x116'),'foreignKey':'UserId'});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x1b')],{'as':_0xc132('0x11a'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x2c')],{'as':_0xc132('0x11b'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x17')],{'as':'Extensions','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':_0xc132('0x11f'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x77')],{'as':'ReportAgentPreview','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x120'),'foreignKey':'UserId'});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':'ChatInteractions','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')]['hasMany'](db[_0xc132('0x55')],{'as':_0xc132('0x122'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x124'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':'MailInteractions','foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db[_0xc132('0x104')],{'as':_0xc132('0x125'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x13')][_0xc132('0x119')](db['UserNotification'],{'as':_0xc132('0x126'),'foreignKey':_0xc132('0x127')});db[_0xc132('0x13')][_0xc132('0x128')](db[_0xc132('0xfb')],{'as':_0xc132('0xfb'),'foreignKey':_0xc132('0x129')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x6c')],{'as':_0xc132('0x12b'),'through':'chat_group_has_users'});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x72')],{'as':_0xc132('0x12c'),'through':_0xc132('0x12d')});db['User'][_0xc132('0x12a')](db['CmList'],{'as':_0xc132('0x12e'),'through':'cm_user_has_lists'});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x130')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x3f')],{'as':_0xc132('0x131'),'through':_0xc132('0x132')});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatInteraction'],{'as':_0xc132('0x133'),'through':_0xc132('0x134')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x123')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db[_0xc132('0x13')]['belongsToMany'](db['SmsInteraction'],{'as':_0xc132('0x122'),'through':_0xc132('0x135')});db['User'][_0xc132('0x12a')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xc132('0x136')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x104')],{'as':_0xc132('0x125'),'through':'user_has_whatsapp_interactions'});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x137')],{'as':_0xc132('0x138'),'through':'UserVoiceQueue','required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db['VoicePrefix'],{'as':_0xc132('0x139'),'through':_0xc132('0x13a'),'required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x3d')],{'as':'MailQueues','through':'UserMailQueue','required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatQueue'],{'as':_0xc132('0x13b'),'through':_0xc132('0x2f'),'required':![],'hooks':!![]});db['User'][_0xc132('0x12a')](db[_0xc132('0x13c')],{'as':_0xc132('0x13d'),'through':'UserFaxQueue','required':![]});db['User'][_0xc132('0x12a')](db[_0xc132('0x58')],{'as':_0xc132('0x13e'),'through':'UserSmsQueue','required':![]});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x13f')],{'as':_0xc132('0x140'),'through':_0xc132('0x141'),'required':![]});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x10b')],{'as':_0xc132('0x142'),'through':_0xc132('0x143'),'required':![]});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x144')],{'through':'cm_user_has_lists'});db[_0xc132('0x13')][_0xc132('0x12a')](db['ChatWebsite'],{'as':_0xc132('0x145'),'through':_0xc132('0x146')});db[_0xc132('0x13')]['belongsToMany'](db['FaxAccount'],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xc132('0x13')]['belongsToMany'](db[_0xc132('0x3b')],{'as':_0xc132('0x147'),'through':_0xc132('0x148')});db['User']['belongsToMany'](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0xc132('0x149')});db[_0xc132('0x13')][_0xc132('0x12a')](db[_0xc132('0x51')],{'as':'SmsAccounts','through':_0xc132('0x14a')});db['User']['belongsToMany'](db[_0xc132('0x101')],{'as':_0xc132('0x14b'),'through':'user_has_whatsapp_accounts'});db['User'][_0xc132('0x12a')](db['SquareProject'],{'as':_0xc132('0x14c'),'through':_0xc132('0x14d')});db['VoiceChanSpy'][_0xc132('0x119')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xc132('0x116'),'foreignKey':'ChanSpyId'});db[_0xc132('0x16')][_0xc132('0x119')](db[_0xc132('0x17')],{'onDelete':'cascade'});db['VoiceExtension'][_0xc132('0x119')](db[_0xc132('0x17')],{'as':_0xc132('0x14e'),'onDelete':'cascade'});db[_0xc132('0x18')][_0xc132('0x12a')](db[_0xc132('0x8b')],{'as':_0xc132('0x14f'),'through':_0xc132('0x150')});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x2c')],{'as':_0xc132('0x151'),'foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x74')],{'as':_0xc132('0x152'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x119')](db['CmHopperFinal'],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':_0xc132('0x153')});db['VoiceQueue'][_0xc132('0x119')](db[_0xc132('0x154')],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0xc132('0x137')][_0xc132('0x119')](db[_0xc132('0x155')],{'as':_0xc132('0x156'),'foreignKey':_0xc132('0x153')});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x29')],{'as':_0xc132('0x29'),'foreignKey':_0xc132('0x157')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':_0xc132('0x158'),'foreignKey':_0xc132('0x159')});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xc132('0x137')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db[_0xc132('0x137')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x15c')});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x12f')],{'as':_0xc132('0x15d'),'through':_0xc132('0x10f')});db['VoiceQueue'][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':_0xc132('0x15e'),'through':_0xc132('0x15f')});db[_0xc132('0x1b')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':'UserId'});db['ScreenRecording'][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x1c')][_0xc132('0x119')](db[_0xc132('0x1e')],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x161'),'sourceKey':'mailbox'});db[_0xc132('0x1e')][_0xc132('0x128')](db[_0xc132('0x1c')],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xc132('0x20')]['hasMany'](db[_0xc132('0x26')],{'as':_0xc132('0x162'),'foreignKey':_0xc132('0x163'),'constraints':![]});db[_0xc132('0x20')][_0xc132('0x119')](db[_0xc132('0x24')],{'as':_0xc132('0x164'),'foreignKey':'uniqueid','constraints':![]});db[_0xc132('0x20')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x13'),'foreignKey':'UserId'});db[_0xc132('0x20')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x37')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x37')][_0xc132('0x128')](db[_0xc132('0x10d')],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168'),'onDelete':_0xc132('0x169')});db[_0xc132('0x39')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x39')][_0xc132('0x128')](db['CloudProvider'],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168'),'onDelete':_0xc132('0x169')});db[_0xc132('0x3b')][_0xc132('0x115')](db[_0xc132('0x37')],{'as':'Imap','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')]['hasOne'](db[_0xc132('0x39')],{'as':'Smtp','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')]['hasMany'](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':'MailAccountId','onDelete':_0xc132('0x116')});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3b')]['hasMany'](db[_0xc132('0x41')],{'as':_0xc132('0x160'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':'Interactions'});db[_0xc132('0x3b')][_0xc132('0x119')](db[_0xc132('0x43')],{'as':'Applications'});db[_0xc132('0x3b')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db['MailAccount'][_0xc132('0x128')](db[_0xc132('0x94')],{'as':_0xc132('0x94'),'foreignKey':_0xc132('0x16d')});db[_0xc132('0x3b')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc132('0x3b')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x148')});db[_0xc132('0x3d')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':'UserMailQueue'});db['MailQueue']['belongsToMany'](db[_0xc132('0x12f')],{'through':_0xc132('0x16f'),'as':'Teams'});db[_0xc132('0x3f')][_0xc132('0x119')](db[_0xc132('0x41')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':'MailInteractionId'});db[_0xc132('0x3f')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x3f')]['belongsTo'](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['MailInteraction']['belongsTo'](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x3f')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x172'),'as':_0xc132('0x173')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':_0xc132('0x172'),'as':_0xc132('0x174')});db['MailInteraction'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x132'),'foreignKey':_0xc132('0x176')});db[_0xc132('0x41')][_0xc132('0x119')](db['Attachment'],{'as':'Attachments','onDelete':'cascade'});db['MailMessage']['belongsTo'](db[_0xc132('0x13')],{'as':'User'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':'Contact'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x3f')],{'as':_0xc132('0x177'),'foreignKey':_0xc132('0x176')});db[_0xc132('0x41')]['belongsTo'](db['MailAccount'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x61'),'foreignKey':'ChatWebsiteId'});db[_0xc132('0x41')][_0xc132('0x128')](db[_0xc132('0x178')],{'as':_0xc132('0x178'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication']['belongsTo'](db[_0xc132('0x13')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x43')]['belongsTo'](db[_0xc132('0x3d')],{'onDelete':'restrict'});db['MailApplication'][_0xc132('0x128')](db[_0xc132('0x3b')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x43')]['belongsTo'](db['Interval'],{'onDelete':_0xc132('0x169'),'foreignKey':'IntervalId'});db[_0xc132('0x43')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x45')][_0xc132('0x128')](db[_0xc132('0x3f')],{});db[_0xc132('0x45')]['belongsTo'](db[_0xc132('0x41')],{});db[_0xc132('0x45')][_0xc132('0x128')](db['User'],{});db['MailQueueReport'][_0xc132('0x128')](db[_0xc132('0x3d')],{});db[_0xc132('0x17b')][_0xc132('0x119')](db[_0xc132('0x48')],{'as':_0xc132('0x17c'),'onDelete':_0xc132('0x116')});db[_0xc132('0x4a')][_0xc132('0x119')](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x17d'),'onDelete':'cascade'});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x17d')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x17e')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x4c')],{'as':'Applications'});db[_0xc132('0x4a')]['hasMany'](db[_0xc132('0x17')],{'as':_0xc132('0x17f'),'onDelete':_0xc132('0x116')});db[_0xc132('0x4a')][_0xc132('0x119')](db[_0xc132('0x4e')],{'as':_0xc132('0x160')});db[_0xc132('0x4a')]['belongsTo'](db[_0xc132('0x29')],{'as':'Trunk'});db[_0xc132('0x4a')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db[_0xc132('0x4a')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xc132('0x4a')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x180')});db['FaxApplication']['belongsTo'](db[_0xc132('0x13')],{'onDelete':_0xc132('0x169')});db['FaxApplication']['belongsTo'](db[_0xc132('0x13c')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x4c')]['belongsTo'](db[_0xc132('0x4a')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x4c')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x123')][_0xc132('0x119')](db[_0xc132('0x4e')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x181')});db[_0xc132('0x123')]['belongsTo'](db[_0xc132('0x4a')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x17d')});db['FaxInteraction'][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x123')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0xc132('0x123')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x182'),'as':_0xc132('0x173')});db[_0xc132('0x123')][_0xc132('0x12a')](db['Tag'],{'through':_0xc132('0x182'),'as':_0xc132('0x174')});db[_0xc132('0x123')][_0xc132('0x12a')](db['User'],{'as':'Users','through':_0xc132('0x183'),'foreignKey':_0xc132('0x181')});db[_0xc132('0x4e')][_0xc132('0x128')](db['User'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x13')});db[_0xc132('0x4e')][_0xc132('0x128')](db['FaxInteraction'],{'as':'Interaction','foreignKey':_0xc132('0x181')});db['FaxMessage'][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':'cascade','as':'Contact'});db[_0xc132('0x4e')][_0xc132('0x128')](db['Attachment'],{'as':_0xc132('0xee'),'foreignKey':_0xc132('0x184')});db['FaxMessage'][_0xc132('0x128')](db[_0xc132('0x4a')],{'as':'Account','foreignKey':_0xc132('0x17d')});db[_0xc132('0x13c')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x185')});db[_0xc132('0x13c')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':'team_has_fax_queues','as':_0xc132('0x15d')});db['FaxQueueReport'][_0xc132('0x128')](db[_0xc132('0x4a')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0x4f')]['belongsTo'](db[_0xc132('0x72')],{'as':'Contact','foreignKey':_0xc132('0x166')});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x123')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x4e')],{});db[_0xc132('0x4f')]['belongsTo'](db[_0xc132('0x13')],{});db[_0xc132('0x4f')][_0xc132('0x128')](db[_0xc132('0x13c')],{});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x186'),'onDelete':_0xc132('0x116')});db['SmsAccount'][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':'Answers','foreignKey':_0xc132('0x186')});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x57')],{'as':_0xc132('0x160'),'foreignKey':'SmsAccountId'});db['SmsAccount']['hasMany'](db[_0xc132('0x55')],{'as':_0xc132('0x17e')});db[_0xc132('0x51')][_0xc132('0x119')](db[_0xc132('0x53')],{'as':_0xc132('0x14e')});db['SmsAccount'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x51')][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xc132('0x15b')});db[_0xc132('0x51')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x14a')});db[_0xc132('0x53')]['belongsTo'](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x58')],{'onDelete':_0xc132('0x169')});db['SmsApplication'][_0xc132('0x128')](db[_0xc132('0x51')],{'onDelete':'restrict'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':'IntervalId'});db[_0xc132('0x53')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':'TagId'});db[_0xc132('0x55')][_0xc132('0x119')](db['SmsMessage'],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x187')});db['SmsInteraction'][_0xc132('0x128')](db[_0xc132('0x51')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x186')});db[_0xc132('0x55')]['belongsTo'](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x55')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x188'),'as':_0xc132('0x173')});db[_0xc132('0x55')][_0xc132('0x12a')](db['Tag'],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0xc132('0x55')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x135'),'foreignKey':_0xc132('0x187')});db[_0xc132('0x57')]['belongsTo'](db['User'],{'as':'User'});db['SmsMessage'][_0xc132('0x128')](db['CmContact'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x57')][_0xc132('0x128')](db[_0xc132('0x55')],{'onDelete':'cascade','as':_0xc132('0x177'),'foreignKey':_0xc132('0x187')});db[_0xc132('0x57')][_0xc132('0x128')](db['SmsAccount'],{'as':_0xc132('0x170'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x33'),'foreignKey':_0xc132('0x189')});db[_0xc132('0x58')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x18a'),'as':_0xc132('0x15d')});db[_0xc132('0x5a')]['hasMany'](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x18b'),'onDelete':'cascade'});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x7e')],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x17e'),'foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5f')],{'as':'Messages','foreignKey':_0xc132('0x18b')});db[_0xc132('0x5a')][_0xc132('0x119')](db[_0xc132('0x5c')],{'as':_0xc132('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0xc132('0x5a')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db['OpenchannelAccount'][_0xc132('0x128')](db[_0xc132('0x85')],{'as':'mandatoryDispositionPause','foreignKey':_0xc132('0x15b')});db[_0xc132('0x5a')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x149')});db['OpenchannelApplication'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x5c')]['belongsTo'](db[_0xc132('0x13f')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18c')});db[_0xc132('0x5c')][_0xc132('0x128')](db[_0xc132('0x5a')],{'onDelete':_0xc132('0x169'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x5c')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x5e')][_0xc132('0x119')](db[_0xc132('0x5f')],{'as':_0xc132('0x160'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x18e')});db[_0xc132('0x5e')]['belongsTo'](db[_0xc132('0x5a')],{'as':'Account','foreignKey':_0xc132('0x18b')});db[_0xc132('0x5e')]['belongsTo'](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['OpenchannelInteraction'][_0xc132('0x128')](db['User'],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db['OpenchannelInteraction'][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x18f'),'as':_0xc132('0x173')});db[_0xc132('0x5e')][_0xc132('0x12a')](db['Tag'],{'through':_0xc132('0x18f'),'as':'ThroughTags'});db[_0xc132('0x5e')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x136'),'foreignKey':_0xc132('0x18e')});db[_0xc132('0x5f')]['belongsTo'](db['User'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x13')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x5e')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':'OpenchannelInteractionId'});db[_0xc132('0x5f')]['belongsTo'](db[_0xc132('0xee')],{'as':_0xc132('0xee'),'foreignKey':_0xc132('0x184')});db[_0xc132('0x5f')][_0xc132('0x128')](db[_0xc132('0x5a')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x18b')});db['OpenchannelQueue'][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x141'),'foreignKey':_0xc132('0x18c')});db[_0xc132('0x13f')]['belongsToMany'](db[_0xc132('0x12f')],{'through':_0xc132('0x190'),'as':_0xc132('0x15d')});db[_0xc132('0x61')]['hasMany'](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x191'),'onDelete':_0xc132('0x116')});db[_0xc132('0x61')]['hasMany'](db['CannedAnswer'],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x61')][_0xc132('0x119')](db['ChatProactiveAction'],{'as':_0xc132('0x192')});db[_0xc132('0x61')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':_0xc132('0x17e')});db[_0xc132('0x61')]['hasMany'](db['ChatApplication'],{'as':'Applications'});db[_0xc132('0x61')]['hasMany'](db[_0xc132('0x67')],{'as':_0xc132('0x160')});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':_0xc132('0x83'),'foreignKey':'IntervalId'});db[_0xc132('0x61')][_0xc132('0x128')](db[_0xc132('0x3b')],{'as':_0xc132('0x3b'),'foreignKey':_0xc132('0x167')});db[_0xc132('0x61')]['belongsTo'](db[_0xc132('0x85')],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db['ChatWebsite']['belongsToMany'](db[_0xc132('0x13')],{'as':'Agents','through':_0xc132('0x146')});db['OpenchannelQueueReport']['belongsTo'](db[_0xc132('0x5a')],{});db[_0xc132('0x63')][_0xc132('0x128')](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x63')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x63')][_0xc132('0x128')](db[_0xc132('0x5e')],{});db[_0xc132('0x63')][_0xc132('0x128')](db[_0xc132('0x5f')],{});db[_0xc132('0x63')]['belongsTo'](db[_0xc132('0x13')],{});db[_0xc132('0x63')]['belongsTo'](db[_0xc132('0x13f')],{});db[_0xc132('0x193')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x194'),'foreignKey':_0xc132('0x117'),'onDelete':_0xc132('0x169')});db[_0xc132('0x193')]['belongsTo'](db[_0xc132('0x6a')],{'as':_0xc132('0x195'),'foreignKey':'ChatQueueId','onDelete':_0xc132('0x169')});db['ChatApplication'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x196'),'foreignKey':'ChatWebsiteId','onDelete':_0xc132('0x169')});db[_0xc132('0x193')][_0xc132('0x128')](db['Tag'],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x179')});db[_0xc132('0x121')][_0xc132('0x119')](db[_0xc132('0x67')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc132('0x197')});db[_0xc132('0x121')]['belongsTo'](db[_0xc132('0x61')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x121')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x121')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x121')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x198'),'as':_0xc132('0x173')});db[_0xc132('0x121')]['belongsToMany'](db[_0xc132('0x8d')],{'through':'chat_interaction_has_tags','as':'ThroughTags'});db[_0xc132('0x121')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x134'),'foreignKey':_0xc132('0x197')});db[_0xc132('0x67')][_0xc132('0x128')](db['User'],{'onDelete':'cascade','as':_0xc132('0x13')});db['ChatMessage'][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':'Contact','foreignKey':_0xc132('0x166')});db['ChatMessage'][_0xc132('0x128')](db['ChatInteraction'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':_0xc132('0x197')});db['ChatMessage'][_0xc132('0x128')](db[_0xc132('0xee')],{'as':_0xc132('0xee'),'foreignKey':'AttachmentId'});db[_0xc132('0x67')]['belongsTo'](db['ChatWebsite'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x191')});db[_0xc132('0x178')]['hasMany'](db[_0xc132('0xee')],{'as':'Attachments','foreignKey':_0xc132('0x199'),'onDelete':'cascade','hooks':!![]});db[_0xc132('0x178')][_0xc132('0x128')](db[_0xc132('0x72')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db['ChatOfflineMessage'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':_0xc132('0x170'),'foreignKey':'ChatWebsiteId'});db[_0xc132('0x6a')][_0xc132('0x12a')](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x2f'),'hooks':!![]});db[_0xc132('0x6a')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x19a'),'as':'Teams'});db[_0xc132('0x6c')][_0xc132('0x119')](db['ChatInternalMessage'],{'as':_0xc132('0x160'),'foreignKey':_0xc132('0x19b'),'onDelete':'cascade'});db[_0xc132('0x6c')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x151'),'through':_0xc132('0x19c')});db['ChatProactiveAction'][_0xc132('0x128')](db[_0xc132('0x61')],{'as':'Website','foreignKey':_0xc132('0x191')});db[_0xc132('0x70')][_0xc132('0x119')](db['CmContact'],{'as':_0xc132('0x12c'),'foreignKey':'CompanyId'});db[_0xc132('0x72')]['hasMany'](db[_0xc132('0x90')],{'as':_0xc132('0x19d'),'foreignKey':_0xc132('0x19e')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x74')],{'as':'Hoppers','foreignKey':_0xc132('0x166')});db['CmContact'][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':'HopperFinals','foreignKey':_0xc132('0x166')});db[_0xc132('0x72')][_0xc132('0x119')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xc132('0x166')});db[_0xc132('0x72')]['hasMany'](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':_0xc132('0x166')});db['CmContact'][_0xc132('0x119')](db['JscriptySessionReport'],{'as':_0xc132('0x156'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x5e')],{'as':_0xc132('0x120'),'foreignKey':'ContactId','onDelete':_0xc132('0x169')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x121')],{'as':_0xc132('0x133'),'foreignKey':_0xc132('0x166'),'onDelete':'restrict'});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x55')],{'as':_0xc132('0x122'),'foreignKey':_0xc132('0x166'),'onDelete':'restrict'});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x123')],{'as':_0xc132('0x124'),'foreignKey':_0xc132('0x166'),'onDelete':_0xc132('0x169')});db[_0xc132('0x72')][_0xc132('0x119')](db[_0xc132('0x3f')],{'as':_0xc132('0x131'),'foreignKey':_0xc132('0x166'),'onDelete':_0xc132('0x169')});db['CmContact'][_0xc132('0x128')](db[_0xc132('0x70')],{'as':_0xc132('0x19f'),'foreignKey':'CompanyId'});db['CmContact'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':'ListId','onDelete':_0xc132('0x116')});db[_0xc132('0x72')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':'cm_user_has_contacts'});db[_0xc132('0x72')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'as':'Tags','through':_0xc132('0x1a0')});db[_0xc132('0x72')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1a0'),'as':_0xc132('0x174')});db[_0xc132('0x74')][_0xc132('0x119')](db['CmHopperAdditionalPhone'],{'as':_0xc132('0x1a1'),'foreignKey':_0xc132('0x1a2')});db[_0xc132('0x74')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'ContactId','onDelete':'cascade'});db['CmHopper'][_0xc132('0x128')](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xc132('0x74')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x194'),'foreignKey':_0xc132('0x117')});db[_0xc132('0x74')]['belongsTo'](db[_0xc132('0x137')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc132('0x116')});db[_0xc132('0x74')]['belongsTo'](db['Campaign'],{'as':_0xc132('0xec'),'foreignKey':_0xc132('0x1a3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x74')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x1a4')});db[_0xc132('0x154')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166'),'onDelete':'cascade'});db[_0xc132('0x154')]['belongsTo'](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c'),'onDelete':_0xc132('0x116')});db['CmHopperBlack'][_0xc132('0x128')](db[_0xc132('0x137')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc132('0x116')});db[_0xc132('0x154')][_0xc132('0x128')](db['Campaign'],{'as':'Campaign','foreignKey':_0xc132('0x1a3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x7c')]['hasMany'](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1a5'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x7c')][_0xc132('0x119')](db['Condition'],{'as':{'plural':_0xc132('0x1a6'),'singular':'OneAny'},'foreignKey':_0xc132('0x1a7'),'onDelete':_0xc132('0x116'),'hooks':!![]});db['Automation'][_0xc132('0x119')](db[_0xc132('0x1a8')],{'as':_0xc132('0x1a9'),'foreignKey':'AutomationId','onDelete':_0xc132('0x116'),'hooks':!![]});db['Disposition'][_0xc132('0x119')](db[_0xc132('0x80')],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x1aa'),'onDelete':'cascade'});db[_0xc132('0x83')][_0xc132('0x119')](db['Interval'],{'as':_0xc132('0x1ab'),'foreignKey':'IntervalId','onDelete':_0xc132('0x116'),'hooks':!![],'required':![]});db[_0xc132('0x83')][_0xc132('0x119')](db[_0xc132('0x17')],{'as':'Extensions','foreignKey':'IntervalId','onDelete':_0xc132('0x169')});db[_0xc132('0x83')]['hasMany'](db[_0xc132('0x43')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xc132('0x83')][_0xc132('0x119')](db[_0xc132('0x193')],{'as':_0xc132('0x1ac'),'foreignKey':_0xc132('0x18d')});db['Interval'][_0xc132('0x119')](db[_0xc132('0x4c')],{'as':_0xc132('0x1ad'),'foreignKey':'IntervalId'});db[_0xc132('0x83')]['hasMany'](db[_0xc132('0x53')],{'as':_0xc132('0x1ae'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x89')]['belongsTo'](db[_0xc132('0x3b')],{});db[_0xc132('0x89')][_0xc132('0x128')](db[_0xc132('0x1af')],{'foreignKey':'DefaultReportId'});db[_0xc132('0x89')][_0xc132('0x128')](db['AnalyticCustomReport'],{'foreignKey':_0xc132('0x1b0')});db['Sound']['belongsToMany'](db[_0xc132('0x18')],{'as':_0xc132('0x1b1'),'through':_0xc132('0x150'),'onDelete':_0xc132('0x169')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x72')],{'through':_0xc132('0x1a0')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x121')],{'through':_0xc132('0x198')});db[_0xc132('0x8d')][_0xc132('0x12a')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc132('0x8d')][_0xc132('0x12a')](db['SmsInteraction'],{'through':_0xc132('0x188')});db[_0xc132('0x8d')][_0xc132('0x12a')](db['FaxInteraction'],{'through':_0xc132('0x182')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x5e')],{'through':_0xc132('0x18f')});db[_0xc132('0x8d')][_0xc132('0x12a')](db[_0xc132('0x104')],{'through':'whatsapp_interaction_has_tags'});db[_0xc132('0x90')]['belongsTo'](db[_0xc132('0x8f')],{'as':_0xc132('0x1b2'),'foreignKey':'ItemTypeId'});db[_0xc132('0x92')][_0xc132('0x128')](db[_0xc132('0x74')],{'as':'Hopper','foreignKey':'CmHopperId'});db[_0xc132('0x90')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'CmContactId'});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1b4'),'singular':_0xc132('0x1b5')},'foreignKey':_0xc132('0x1b6'),'onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x82')],{'as':{'plural':_0xc132('0x1b7'),'singular':'AnyCondition'},'foreignKey':_0xc132('0x1b8'),'onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x1b3')][_0xc132('0x119')](db[_0xc132('0x1a8')],{'as':_0xc132('0x1a9'),'foreignKey':'TriggerId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x9c')][_0xc132('0x119')](db['AnalyticFieldReport'],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1b0'),'hooks':!![]});db[_0xc132('0x1af')][_0xc132('0x119')](db['AnalyticFieldReport'],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1ba')});db[_0xc132('0x9f')]['hasMany'](db[_0xc132('0xa1')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bb')});db['AnalyticFieldReport'][_0xc132('0x128')](db[_0xc132('0x9f')],{'foreignKey':_0xc132('0x1bb')});db[_0xc132('0xa5')][_0xc132('0x119')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db[_0xc132('0xa6')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xa6')]['hasMany'](db[_0xc132('0xa8')],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':'DescriptionId'});db[_0xc132('0xa6')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':'FieldId'});db[_0xc132('0xa6')][_0xc132('0x128')](db[_0xc132('0xa5')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xa8')]['hasMany'](db[_0xc132('0xa8')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xa8')][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db['SalesforceField'][_0xc132('0x119')](db[_0xc132('0xa8')],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db['SalesforceField'][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xa9')]['hasMany'](db['SugarcrmConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xaa')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':'Subjects','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xaa')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1be'),'onDelete':'cascade','foreignKey':_0xc132('0x1c2')});db['SugarcrmConfiguration'][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xaa')]['belongsTo'](db['SugarcrmAccount'],{'as':'Account','foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1c7')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db['SugarcrmField']['hasMany'](db[_0xc132('0x1c7')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0x1c7')][_0xc132('0x119')](db[_0xc132('0x1c7')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1c7')][_0xc132('0x128')](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':'VariableId'});db['DeskAccount'][_0xc132('0x119')](db['DeskConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1c8')]['hasMany'](db['DeskField'],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db['DeskConfiguration'][_0xc132('0x119')](db['DeskField'],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':'DescriptionId'});db[_0xc132('0x1c8')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1b9'),'onDelete':'cascade','foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1c8')][_0xc132('0x128')](db['DeskAccount'],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db['DeskConfiguration']['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1c9')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':'Subject','foreignKey':_0xc132('0x1bd')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xaf')][_0xc132('0x119')](db[_0xc132('0xaf')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xaf')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xb0')][_0xc132('0x119')](db[_0xc132('0xb1')],{'as':'Configurations','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb1')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':_0xc132('0x1bc'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb1')][_0xc132('0x119')](db['ZohoField'],{'as':'Descriptions','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xb1')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':_0xc132('0x1b9'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c4')});db['ZohoConfiguration'][_0xc132('0x128')](db[_0xc132('0xb0')],{'as':'Account','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb3')]['hasMany'](db[_0xc132('0xb3')],{'as':_0xc132('0x1c0'),'foreignKey':'SubjectId'});db[_0xc132('0xb3')][_0xc132('0x119')](db[_0xc132('0xb3')],{'as':'Description','foreignKey':_0xc132('0x1c2')});db['ZohoField'][_0xc132('0x119')](db['ZohoField'],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xb3')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1ca')][_0xc132('0x119')](db['ZendeskConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb5')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb5')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db['ZendeskConfiguration']['hasMany'](db['ZendeskField'],{'as':_0xc132('0x1b9'),'foreignKey':'FieldId'});db[_0xc132('0xb5')]['belongsTo'](db[_0xc132('0x1ca')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xb5')][_0xc132('0x12a')](db[_0xc132('0x8d')],{'through':_0xc132('0x1cb')});db[_0xc132('0xb7')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xb7')]['hasMany'](db[_0xc132('0xb7')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xb7')][_0xc132('0x119')](db[_0xc132('0xb7')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xb7')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db['FreshdeskAccount'][_0xc132('0x119')](db[_0xc132('0xba')],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xba')]['hasMany'](db[_0xc132('0xbc')],{'as':_0xc132('0x1bc'),'onDelete':'cascade','foreignKey':_0xc132('0x1bd')});db['FreshdeskConfiguration'][_0xc132('0x119')](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xc132('0xba')]['hasMany'](db[_0xc132('0xbc')],{'as':_0xc132('0x1b9'),'onDelete':'cascade','foreignKey':_0xc132('0x1c4')});db['FreshdeskConfiguration'][_0xc132('0x128')](db[_0xc132('0x1cc')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xba')]['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1cd')});db[_0xc132('0xbc')][_0xc132('0x119')](db['FreshdeskField'],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xbc')][_0xc132('0x119')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xc132('0x1c2')});db['FreshdeskField']['hasMany'](db[_0xc132('0xbc')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db['FreshdeskField'][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xbd')]['hasMany'](db['VtigerConfiguration'],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0x1ce')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':'Subjects','foreignKey':'SubjectId'});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0x1ce')][_0xc132('0x119')](db['VtigerField'],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0x1ce')]['belongsTo'](db[_0xc132('0xbd')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xbf')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xbf')][_0xc132('0x119')](db[_0xc132('0xbf')],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xbf')][_0xc132('0x119')](db['VtigerField'],{'as':_0xc132('0x1c3'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xbf')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1cf')][_0xc132('0x119')](db[_0xc132('0xc1')],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db[_0xc132('0xc1')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xc1')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db['ServicenowConfiguration'][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db[_0xc132('0xc1')][_0xc132('0x128')](db[_0xc132('0x1cf')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db['ServicenowField'][_0xc132('0x119')](db['ServicenowField'],{'as':'Subject','foreignKey':_0xc132('0x1bd')});db[_0xc132('0xc3')][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':_0xc132('0x1c1'),'foreignKey':'DescriptionId'});db['ServicenowField'][_0xc132('0x119')](db[_0xc132('0xc3')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db[_0xc132('0xc3')][_0xc132('0x128')](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0x1d0')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xc132('0x1c6'),'onDelete':_0xc132('0x116'),'foreignKey':'AccountId'});db['Dynamics365Account'][_0xc132('0x128')](db[_0xc132('0x10d')],{'as':_0xc132('0x10d'),'foreignKey':_0xc132('0x168')});db[_0xc132('0xc6')]['hasMany'](db[_0xc132('0xc8')],{'as':'Subjects','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1bd')});db['Dynamics365Configuration'][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1be'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xc6')][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':'Fields','onDelete':_0xc132('0x116'),'foreignKey':'FieldId'});db[_0xc132('0xc6')][_0xc132('0x128')](db[_0xc132('0x1d0')],{'as':'Account','foreignKey':_0xc132('0x1bf')});db['Dynamics365Field'][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db['Dynamics365Field'][_0xc132('0x119')](db['Dynamics365Field'],{'as':_0xc132('0x1c1'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xc8')][_0xc132('0x119')](db[_0xc132('0xc8')],{'as':_0xc132('0x1c3'),'foreignKey':'FieldId'});db[_0xc132('0xc8')][_0xc132('0x128')](db[_0xc132('0x97')],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db[_0xc132('0xca')]['hasMany'](db[_0xc132('0xcc')],{'as':_0xc132('0x1c6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xc132('0xcc')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1bc'),'foreignKey':_0xc132('0x1bd')});db['FreshsalesConfiguration']['hasMany'](db[_0xc132('0xce')],{'as':_0xc132('0x1be'),'foreignKey':_0xc132('0x1c2')});db[_0xc132('0xcc')]['hasMany'](db[_0xc132('0xce')],{'as':_0xc132('0x1b9'),'foreignKey':_0xc132('0x1c4')});db['FreshsalesConfiguration'][_0xc132('0x128')](db[_0xc132('0xca')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1bf')});db[_0xc132('0xce')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1c0'),'foreignKey':_0xc132('0x1bd')});db[_0xc132('0xce')][_0xc132('0x119')](db[_0xc132('0xce')],{'as':_0xc132('0x1c1'),'foreignKey':'DescriptionId'});db[_0xc132('0xce')]['hasMany'](db[_0xc132('0xce')],{'as':'Field','foreignKey':_0xc132('0x1c4')});db['FreshsalesField']['belongsTo'](db['Variable'],{'as':_0xc132('0x97'),'foreignKey':_0xc132('0x1c5')});db['ChatQueueReport'][_0xc132('0x128')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db[_0xc132('0x144')],{'as':_0xc132('0x17a'),'foreignKey':'ListId'});db[_0xc132('0xd2')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0xd2')][_0xc132('0x128')](db['ChatInteraction'],{});db['ChatQueueReport']['belongsTo'](db['ChatMessage'],{});db[_0xc132('0xd2')]['belongsTo'](db['User'],{});db[_0xc132('0xd2')][_0xc132('0x128')](db[_0xc132('0x6a')],{});db[_0xc132('0xd4')][_0xc132('0x128')](db['User'],{'onDelete':_0xc132('0x116'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1d1')});db[_0xc132('0x155')][_0xc132('0x119')](db[_0xc132('0xd7')],{'foreignKey':_0xc132('0x1d2'),'onDelete':_0xc132('0x116')});db['JscriptySessionReport'][_0xc132('0x119')](db[_0xc132('0x1d3')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0xc132('0xda')][_0xc132('0x128')](db['SmsAccount'],{});db[_0xc132('0xda')]['belongsTo'](db['CmList'],{'as':_0xc132('0x17a'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db['SmsQueueReport']['belongsTo'](db[_0xc132('0x55')],{});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x57')],{});db[_0xc132('0xda')]['belongsTo'](db['User'],{});db[_0xc132('0xda')][_0xc132('0x128')](db[_0xc132('0x58')],{});db[_0xc132('0xdf')][_0xc132('0x119')](db[_0xc132('0x155')],{'foreignKey':'ProjectId'});db[_0xc132('0xdf')][_0xc132('0x119')](db[_0xc132('0xd7')],{'foreignKey':_0xc132('0x1d4')});db[_0xc132('0xdf')]['hasMany'](db[_0xc132('0x1d3')],{'foreignKey':'ProjectId'});db[_0xc132('0xe4')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x175'),'through':_0xc132('0x14d')});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x130')});db['Team'][_0xc132('0x12a')](db[_0xc132('0x137')],{'through':_0xc132('0x10f'),'as':'VoiceQueues'});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x3d')],{'through':_0xc132('0x16f'),'as':'MailQueues'});db[_0xc132('0x12f')][_0xc132('0x12a')](db[_0xc132('0x6a')],{'through':_0xc132('0x19a'),'as':_0xc132('0x13b')});db['Team'][_0xc132('0x12a')](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0xc132('0x13d')});db[_0xc132('0x12f')]['belongsToMany'](db[_0xc132('0x58')],{'through':_0xc132('0x18a'),'as':'SmsQueues'});db['Team'][_0xc132('0x12a')](db[_0xc132('0x13f')],{'through':_0xc132('0x190'),'as':_0xc132('0x140')});db['Team'][_0xc132('0x12a')](db['WhatsappQueue'],{'through':_0xc132('0x1d5'),'as':'WhatsappQueues'});db['Team'][_0xc132('0x12a')](db['VoicePrefix'],{'through':_0xc132('0x111'),'as':_0xc132('0x139')});db[_0xc132('0xec')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x11e')],{'as':'HopperHistories','foreignKey':_0xc132('0x1a3')});db[_0xc132('0xec')][_0xc132('0x119')](db[_0xc132('0x154')],{'as':_0xc132('0x1d6'),'foreignKey':'CampaignId'});db['Campaign'][_0xc132('0x128')](db[_0xc132('0x29')],{'as':_0xc132('0x29'),'foreignKey':'TrunkId'});db[_0xc132('0xec')][_0xc132('0x128')](db['Trunk'],{'as':_0xc132('0x158'),'foreignKey':_0xc132('0x159')});db[_0xc132('0xec')][_0xc132('0x128')](db[_0xc132('0x83')],{'as':_0xc132('0x83'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0xec')][_0xc132('0x128')](db[_0xc132('0xe4')],{'as':_0xc132('0xe4'),'foreignKey':_0xc132('0x1d7')});db[_0xc132('0xec')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':_0xc132('0x12e'),'through':'campaigns_has_cm_lists'});db[_0xc132('0xec')][_0xc132('0x12a')](db[_0xc132('0x144')],{'as':'BlackLists','through':_0xc132('0x1d8')});db[_0xc132('0xee')][_0xc132('0x128')](db['ChatOfflineMessage'],{'as':_0xc132('0x178'),'foreignKey':_0xc132('0x199')});db[_0xc132('0x1d9')][_0xc132('0x128')](db[_0xc132('0x41')],{});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailInteraction'],{});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailAccount'],{'foreignKey':_0xc132('0x1da'),'as':_0xc132('0x1db')});db[_0xc132('0x1d9')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0x1d9')]['belongsTo'](db[_0xc132('0x13')],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db[_0xc132('0x1d9')][_0xc132('0x128')](db['MailQueue'],{'foreignKey':_0xc132('0x1df'),'as':_0xc132('0x1e0')});db['MailTransferReport'][_0xc132('0x128')](db['MailAccount'],{'foreignKey':_0xc132('0x1e1'),'as':_0xc132('0x1e2')});db[_0xc132('0xf3')]['belongsTo'](db[_0xc132('0x67')],{});db[_0xc132('0xf3')]['belongsTo'](db[_0xc132('0x121')],{});db['ChatTransferReport'][_0xc132('0x128')](db[_0xc132('0x61')],{'foreignKey':_0xc132('0x1e3'),'as':'FromAccount'});db[_0xc132('0xf3')][_0xc132('0x128')](db['User'],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf3')][_0xc132('0x128')](db['User'],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db[_0xc132('0xf3')][_0xc132('0x128')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':_0xc132('0x1e0')});db[_0xc132('0xf3')][_0xc132('0x128')](db[_0xc132('0x61')],{'foreignKey':_0xc132('0x1e4'),'as':_0xc132('0x1e2')});db[_0xc132('0x1e5')]['belongsTo'](db[_0xc132('0x4e')],{});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x123')],{});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x4a')],{'foreignKey':_0xc132('0x1e6'),'as':'FromAccount'});db['FaxTransferReport'][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':'ToAgent'});db['FaxTransferReport']['belongsTo'](db[_0xc132('0x13c')],{'foreignKey':_0xc132('0x1e8'),'as':_0xc132('0x1e0')});db[_0xc132('0x1e5')][_0xc132('0x128')](db[_0xc132('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0xc132('0x1e2')});db['OpenchannelTransferReport'][_0xc132('0x128')](db[_0xc132('0x5f')],{});db[_0xc132('0xf6')]['belongsTo'](db[_0xc132('0x5e')],{});db[_0xc132('0xf6')]['belongsTo'](db[_0xc132('0x5a')],{'foreignKey':_0xc132('0x1e9'),'as':_0xc132('0x1db')});db[_0xc132('0xf6')]['belongsTo'](db['User'],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf6')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':'ToUserId','as':_0xc132('0x1de')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelQueue'],{'foreignKey':'ToOpenchannelQueueId','as':_0xc132('0x1e0')});db[_0xc132('0xf6')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xc132('0x1ea'),'as':_0xc132('0x1e2')});db[_0xc132('0xf8')][_0xc132('0x128')](db['SmsMessage'],{});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x55')],{});db['SmsTransferReport'][_0xc132('0x128')](db[_0xc132('0x51')],{'foreignKey':_0xc132('0x1eb'),'as':_0xc132('0x1db')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':_0xc132('0x1dd')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':'ToAgent'});db[_0xc132('0xf8')][_0xc132('0x128')](db['SmsQueue'],{'foreignKey':_0xc132('0x1ec'),'as':_0xc132('0x1e0')});db[_0xc132('0xf8')][_0xc132('0x128')](db[_0xc132('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xc132('0x1e2')});db['CmList'][_0xc132('0x119')](db['Disposition'],{'as':_0xc132('0x16a'),'foreignKey':_0xc132('0x16c'),'onDelete':_0xc132('0x116')});db[_0xc132('0x144')]['hasMany'](db[_0xc132('0x79')],{'as':_0xc132('0x1ed'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db[_0xc132('0x72')],{'as':_0xc132('0x12c'),'onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db[_0xc132('0x11c')],{'as':_0xc132('0x11d'),'foreignKey':_0xc132('0x16c')});db[_0xc132('0x144')]['hasMany'](db[_0xc132('0x11e')],{'as':_0xc132('0x11f'),'foreignKey':_0xc132('0x16c')});db['CmList'][_0xc132('0x119')](db['ReportAgentPreview'],{'as':_0xc132('0x77'),'foreignKey':'ListId'});db[_0xc132('0x144')][_0xc132('0x12a')](db[_0xc132('0x137')],{'as':_0xc132('0x1ee'),'through':_0xc132('0x1ef')});db[_0xc132('0x144')][_0xc132('0x12a')](db['User'],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xc132('0x119')](db[_0xc132('0x17')],{'as':_0xc132('0x1f0'),'onDelete':_0xc132('0x116')});db[_0xc132('0xfa')][_0xc132('0x12a')](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x13a')});db[_0xc132('0xfa')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':'TeamVoicePrefix','as':_0xc132('0x15d')});db['UserProfile'][_0xc132('0x119')](db[_0xc132('0x13')],{'as':'Users','foreignKey':_0xc132('0x129')});db['UserProfile'][_0xc132('0x119')](db[_0xc132('0x1f1')],{'as':'UserProfileSections','foreignKey':_0xc132('0x129'),'onDelete':'cascade'});db[_0xc132('0x1f1')][_0xc132('0x119')](db[_0xc132('0xfe')],{'as':_0xc132('0x1f2'),'foreignKey':_0xc132('0x1f3'),'onDelete':_0xc132('0x116')});db[_0xc132('0x101')][_0xc132('0x119')](db[_0xc132('0x80')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':'cascade'});db[_0xc132('0x101')][_0xc132('0x119')](db['CannedAnswer'],{'as':_0xc132('0x16b'),'foreignKey':_0xc132('0x1f4')});db['WhatsappAccount'][_0xc132('0x119')](db[_0xc132('0x106')],{'as':'Messages','foreignKey':_0xc132('0x1f4')});db['WhatsappAccount'][_0xc132('0x119')](db[_0xc132('0x104')],{'as':'Interactions'});db[_0xc132('0x101')][_0xc132('0x119')](db['WhatsappApplication'],{'as':_0xc132('0x14e')});db[_0xc132('0x101')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db[_0xc132('0x101')][_0xc132('0x128')](db['Pause'],{'as':_0xc132('0x15a'),'foreignKey':_0xc132('0x15b')});db[_0xc132('0x101')]['belongsToMany'](db['User'],{'as':_0xc132('0x16e'),'through':_0xc132('0x1f5')});db['WhatsappApplication'][_0xc132('0x128')](db[_0xc132('0x13')],{'onDelete':'restrict'});db[_0xc132('0x103')]['belongsTo'](db['WhatsappQueue'],{'onDelete':_0xc132('0x169')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x101')],{'onDelete':_0xc132('0x169')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x83')],{'onDelete':_0xc132('0x169'),'foreignKey':_0xc132('0x18d')});db[_0xc132('0x103')][_0xc132('0x128')](db[_0xc132('0x8d')],{'onDelete':'restrict','foreignKey':_0xc132('0x179')});db[_0xc132('0x104')]['hasMany'](db[_0xc132('0x106')],{'as':'Messages','onDelete':_0xc132('0x116'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x104')][_0xc132('0x128')](db[_0xc132('0x101')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1f4')});db[_0xc132('0x104')][_0xc132('0x128')](db['CmContact'],{'as':_0xc132('0x165'),'foreignKey':'ContactId'});db[_0xc132('0x104')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x171'),'foreignKey':_0xc132('0x117')});db['WhatsappInteraction']['belongsToMany'](db[_0xc132('0x8d')],{'through':_0xc132('0x1f7'),'as':_0xc132('0x173')});db[_0xc132('0x104')][_0xc132('0x12a')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0xc132('0x174')});db[_0xc132('0x104')]['belongsToMany'](db['User'],{'as':_0xc132('0x175'),'through':_0xc132('0x1f8'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x106')][_0xc132('0x128')](db['User'],{'as':_0xc132('0x13')});db[_0xc132('0x106')][_0xc132('0x128')](db['CmContact'],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x165')});db[_0xc132('0x106')]['belongsTo'](db[_0xc132('0x104')],{'onDelete':_0xc132('0x116'),'as':_0xc132('0x177'),'foreignKey':_0xc132('0x1f6')});db[_0xc132('0x106')][_0xc132('0x128')](db[_0xc132('0x101')],{'as':_0xc132('0x170'),'foreignKey':_0xc132('0x1f4')});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x101')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x144')],{'as':'List','foreignKey':_0xc132('0x16c')});db['WhatsappQueueReport'][_0xc132('0x128')](db[_0xc132('0x72')],{'as':_0xc132('0x165'),'foreignKey':_0xc132('0x166')});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x104')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x10b')],{});db[_0xc132('0x108')][_0xc132('0x128')](db[_0xc132('0x106')],{});db[_0xc132('0x108')][_0xc132('0x128')](db['User'],{});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x106')],{});db[_0xc132('0x109')][_0xc132('0x128')](db['WhatsappInteraction'],{});db[_0xc132('0x109')][_0xc132('0x128')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0xc132('0x1db')});db[_0xc132('0x109')]['belongsTo'](db[_0xc132('0x101')],{'foreignKey':'ToWhatsappAccountId','as':'ToAccount'});db[_0xc132('0x109')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0xc132('0x1f9'),'as':'ToQueue'});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1dc'),'as':'FromAgent'});db[_0xc132('0x109')][_0xc132('0x128')](db[_0xc132('0x13')],{'foreignKey':_0xc132('0x1e7'),'as':_0xc132('0x1de')});db[_0xc132('0x10b')]['belongsToMany'](db[_0xc132('0x13')],{'as':_0xc132('0x16e'),'through':_0xc132('0x143'),'foreignKey':_0xc132('0x1fa')});db[_0xc132('0x10b')][_0xc132('0x12a')](db[_0xc132('0x12f')],{'through':_0xc132('0x1d5'),'as':_0xc132('0x15d')});db[_0xc132('0x113')][_0xc132('0x128')](db[_0xc132('0x13')],{'as':_0xc132('0x1fb'),'foreignKey':'UserId','onDelete':_0xc132('0x116'),'hooks':!![]});db[_0xc132('0x10d')][_0xc132('0x115')](db[_0xc132('0x1d0')],{'as':'Dynamics365Account','onDelete':_0xc132('0x169')});db['CloudProvider'][_0xc132('0x115')](db[_0xc132('0x37')],{'as':'Imap','onDelete':_0xc132('0x169')});db[_0xc132('0x10d')][_0xc132('0x115')](db['MailServerOut'],{'as':'Smtp','onDelete':_0xc132('0x169')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1f6d=['Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','hasOne','UserId','User','userSetting','cascade','hasMany','VoiceRecording','UserVoiceQueueRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','SenderId','belongsTo','userProfileId','belongsToMany','Groups','Contacts','CmList','cm_user_has_lists','user_has_fax_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoicePrefixes','UserVoicePrefix','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','OpenchannelAccount','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','SquareProjects','user_has_square_projects','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','CannedAnswer','Interactions','List','Template','TemplateId','mandatoryDispositionPause','mandatoryDispositionPauseId','team_has_mail_queues','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','MailQueueReport','ListId','Items','Exntensions','FaxMessage','TagId','FaxInteractionId','fax_interaction_has_tags','Tags','Users','AttachmentId','FaxAccountId','team_has_fax_queues','SmsAccountId','Answers','SmsApplication','IntervalId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueReport','Agent','ChatQueue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatInternalMessage','chat_group_has_users','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','AdditionalPhones','CmHopperId','Queue','Campaign','OwnerId','CampaignId','Automation','All','OneAll','Condition','AutomationAnyId','Actions','AutomationId','ParentId','MailApplications','ChatApplications','FaxApplications','AnalyticCustomReport','CustomReportId','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Fields','DefaultReportId','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','SalesforceField','FieldId','SalesforceAccount','Subject','Description','Field','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerAccount','VtigerConfiguration','ServicenowConfiguration','ServicenowField','FreshsalesField','ChatQueueReport','FromId','ToId','SessionId','JscriptySessionReport','JscriptyProject','ProjectId','user_has_teams','VoiceQueues','MailQueues','team_has_chat_queues','FaxQueues','team_has_whatsapp_queues','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','TeamVoicePrefix','Resources','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','UserWhatsappQueue','WhatsappQueueId','UserSetting','exports','../config/environment','lodash','jstz','defaultsDeep','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','database','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/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','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model'];(function(_0x4eed11,_0x528245){var _0x502cb3=function(_0x5131d1){while(--_0x5131d1){_0x4eed11['push'](_0x4eed11['shift']());}};_0x502cb3(++_0x528245);}(_0x1f6d,0x1bb));var _0xd1f6=function(_0x26305c,_0x1acdb0){_0x26305c=_0x26305c-0x0;var _0x202a11=_0x1f6d[_0x26305c];return _0x202a11;};'use strict';var config=require(_0xd1f6('0x0'));var Sequelize=require('sequelize');var _=require(_0xd1f6('0x1'));var jstz=require(_0xd1f6('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0xd1f6('0x3')](config[_0xd1f6('0x4')],{'database':_0xd1f6('0x5'),'username':_0xd1f6('0x6'),'password':_0xd1f6('0x7'),'options':{'host':_0xd1f6('0x8'),'port':0xcea,'dialect':_0xd1f6('0x9'),'dialectOptions':{'charset':_0xd1f6('0xa')},'logging':![],'timezone':timezone[_0xd1f6('0xb')](),'define':{'charset':_0xd1f6('0xc'),'collate':_0xd1f6('0xd')}}});config[_0xd1f6('0xe')]=_[_0xd1f6('0x3')](config[_0xd1f6('0xe')],{'database':_0xd1f6('0x5'),'username':_0xd1f6('0x6'),'password':_0xd1f6('0x7'),'options':{'host':_0xd1f6('0x8'),'port':0xcea,'dialect':_0xd1f6('0x9'),'dialectOptions':{'charset':_0xd1f6('0xa')},'logging':![],'timezone':timezone[_0xd1f6('0xb')](),'define':{'charset':_0xd1f6('0xc'),'collate':_0xd1f6('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd1f6('0x4')]['database'],config[_0xd1f6('0x4')][_0xd1f6('0xf')],config[_0xd1f6('0x4')]['password'],config[_0xd1f6('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xd1f6('0x10')],config['sequelizeHistory'][_0xd1f6('0xf')],config[_0xd1f6('0xe')][_0xd1f6('0x11')],config[_0xd1f6('0xe')][_0xd1f6('0x12')])};db['User']=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x14'));db[_0xd1f6('0x15')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x16'));db[_0xd1f6('0x17')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x18'));db[_0xd1f6('0x19')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x1a'));db[_0xd1f6('0x1b')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x1c'));db[_0xd1f6('0x1d')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x1e'));db['VoiceRecording']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x1f'));db[_0xd1f6('0x20')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x21'));db[_0xd1f6('0x22')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x23'));db[_0xd1f6('0x24')]=db['sequelize']['import']('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x25'));db[_0xd1f6('0x26')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x27'));db[_0xd1f6('0x28')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x29'));db[_0xd1f6('0x2a')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x2b'));db[_0xd1f6('0x2c')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x2d'));db[_0xd1f6('0x2e')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x2f'));db[_0xd1f6('0x30')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x31'));db['UserVoiceQueueRt']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x32'));db[_0xd1f6('0x33')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x34'));db[_0xd1f6('0x35')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x36'));db[_0xd1f6('0x37')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x38'));db['UserFaxQueue']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x39'));db[_0xd1f6('0x3a')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x3b'));db[_0xd1f6('0x3c')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db['UserWhatsappQueue']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x3d'));db[_0xd1f6('0x3e')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x3f'));db[_0xd1f6('0x40')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x41'));db[_0xd1f6('0x42')]=db['sequelize']['import'](_0xd1f6('0x43'));db[_0xd1f6('0x44')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x45'));db[_0xd1f6('0x46')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x47'));db[_0xd1f6('0x48')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x49'));db[_0xd1f6('0x4a')]=db['sequelize'][_0xd1f6('0x13')]('../api/mailMessage/mailMessage.model');db[_0xd1f6('0x4b')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x4c'));db['MailQueueReport']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x4d'));db[_0xd1f6('0x4e')]=db['sequelize']['import'](_0xd1f6('0x4f'));db[_0xd1f6('0x50')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/dashboardItem/dashboardItem.model');db[_0xd1f6('0x51')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x52'));db[_0xd1f6('0x53')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x54'));db[_0xd1f6('0x55')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x56'));db['FaxMessage']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x57'));db[_0xd1f6('0x58')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x59'));db[_0xd1f6('0x5a')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x5b'));db[_0xd1f6('0x5c')]=db['sequelize']['import'](_0xd1f6('0x5d'));db['SmsApplication']=db['sequelize']['import'](_0xd1f6('0x5e'));db[_0xd1f6('0x5f')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x60'));db[_0xd1f6('0x61')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x62'));db[_0xd1f6('0x63')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x64'));db[_0xd1f6('0x65')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x66'));db[_0xd1f6('0x67')]=db['sequelize'][_0xd1f6('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0xd1f6('0x68')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x69'));db[_0xd1f6('0x6a')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x6b'));db[_0xd1f6('0x6c')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x6d'));db['OpenchannelQueueReport']=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x6e'));db[_0xd1f6('0x6f')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x70'));db[_0xd1f6('0x71')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x72'));db[_0xd1f6('0x73')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/chatMessage/chatMessage.model');db[_0xd1f6('0x74')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x75'));db['ChatQueue']=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x76'));db[_0xd1f6('0x77')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/chatGroup/chatGroup.model');db[_0xd1f6('0x78')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xd1f6('0x79')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x7a'));db[_0xd1f6('0x7b')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x7c'));db[_0xd1f6('0x7d')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x7e'));db[_0xd1f6('0x7f')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xd1f6('0x80')]=db[_0xd1f6('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd1f6('0x81')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x82'));db[_0xd1f6('0x83')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x84'));db[_0xd1f6('0x85')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x86'));db[_0xd1f6('0x87')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x88'));db['Automation']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x89'));db['CannedAnswer']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x8a'));db[_0xd1f6('0x8b')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x8c'));db['Condition']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x8d'));db['Interval']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/interval/interval.model');db[_0xd1f6('0x8e')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x8f'));db[_0xd1f6('0x90')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x91'));db[_0xd1f6('0x92')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x93'));db[_0xd1f6('0x94')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x95'));db[_0xd1f6('0x96')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x97'));db['Tag']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x98'));db[_0xd1f6('0x99')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x9a'));db[_0xd1f6('0x9b')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x9c'));db[_0xd1f6('0x9d')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/template/template.model');db[_0xd1f6('0x9e')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x9f'));db[_0xd1f6('0xa0')]=db['sequelize'][_0xd1f6('0x13')]('../api/variable/variable.model');db[_0xd1f6('0xa1')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xa2'));db[_0xd1f6('0xa3')]=db['sequelize']['import'](_0xd1f6('0xa4'));db['AnalyticCustomReport']=db['sequelize']['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xd1f6('0xa5')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db['AnalyticExtractedReport']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xa6'));db['AnalyticMetric']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xa7'));db[_0xd1f6('0xa8')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xa9'));db['AnalyticTreeReport']=db['sequelize']['import'](_0xd1f6('0xaa'));db['SalesforceAccount']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xd1f6('0xab')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xac'));db['SalesforceField']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xad'));db[_0xd1f6('0xae')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xaf'));db[_0xd1f6('0xb0')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xb1'));db[_0xd1f6('0xb2')]=db['sequelize']['import'](_0xd1f6('0xb3'));db[_0xd1f6('0xb4')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xb5'));db['DeskConfiguration']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xb6'));db[_0xd1f6('0xb7')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xb8'));db[_0xd1f6('0xb9')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xba'));db[_0xd1f6('0xbb')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xbc'));db[_0xd1f6('0xbd')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xbe'));db[_0xd1f6('0xbf')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xc0'));db['ZendeskConfiguration']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xc1'));db['FreshdeskAccount']=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xc2'));db[_0xd1f6('0xc3')]=db[_0xd1f6('0x4')]['import']('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0xd1f6('0xc4')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xc5'));db['VtigerConfiguration']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xc6'));db[_0xd1f6('0xc7')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xc8'));db[_0xd1f6('0xc9')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xca'));db['ServicenowConfiguration']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xcb'));db['ServicenowField']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xd1f6('0xcc')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xcd'));db[_0xd1f6('0xce')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xcf'));db[_0xd1f6('0xd0')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xd1'));db[_0xd1f6('0xd2')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xd1f6('0xd3')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xd4'));db['FreshsalesField']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xd5'));db[_0xd1f6('0xa1')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xa2'));db[_0xd1f6('0xd6')]=db['sequelize'][_0xd1f6('0x13')]('../api/network/network.model');db['ChatQueueReport']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xd7'));db['ChatInternalMessage']=db['sequelize'][_0xd1f6('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xd1f6('0xd8')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xd9'));db[_0xd1f6('0xda')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xdb'));db['JscriptySessionReport']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xdc'));db[_0xd1f6('0xdd')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xde'));db['SquareReport']=db['sequelize']['import'](_0xd1f6('0xdf'));db[_0xd1f6('0xe0')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xe1'));db[_0xd1f6('0xe2')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xe3'));db[_0xd1f6('0xe4')]=db['sequelize'][_0xd1f6('0x13')]('../api/squareOdbc/squareOdbc.model');db['SquareProject']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xe5'));db['SquareRecording']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xe6'));db[_0xd1f6('0xe7')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xe8'));db[_0xd1f6('0xe9')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xea'));db[_0xd1f6('0xeb')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xec'));db['Campaign']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xed'));db['Migration']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xee'));db['Attachment']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xef'));db[_0xd1f6('0xf0')]=db['sequelize'][_0xd1f6('0x13')]('../api/plugin/plugin.model');db[_0xd1f6('0xf1')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xd1f6('0xf2')]=db['sequelize']['import'](_0xd1f6('0xf3'));db[_0xd1f6('0xf4')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xf5'));db[_0xd1f6('0xf6')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0xf7'));db[_0xd1f6('0xf8')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xf9'));db['CmList']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xfa'));db[_0xd1f6('0xfb')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0xfc'));db[_0xd1f6('0xfd')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0xfe'));db[_0xd1f6('0xff')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x100'));db[_0xd1f6('0x101')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x102'));db[_0xd1f6('0x103')]=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x104'));db[_0xd1f6('0x105')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db['sequelize'][_0xd1f6('0x13')](_0xd1f6('0x106'));db[_0xd1f6('0x107')]=db['sequelize']['import'](_0xd1f6('0x108'));db['WhatsappMessage']=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0xd1f6('0x109')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0xd1f6('0x10a')]=db['sequelize'][_0xd1f6('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0xd1f6('0x10b')]=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x10c'));db[_0xd1f6('0x10d')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x10e'));db[_0xd1f6('0x10f')]=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x110'));db['TeamVoicePrefix']=db[_0xd1f6('0x4')][_0xd1f6('0x13')](_0xd1f6('0x111'));db['UserVoicePrefix']=db[_0xd1f6('0x4')]['import'](_0xd1f6('0x112'));db['UserSetting']=db['sequelize']['import'](_0xd1f6('0x113'));db['User'][_0xd1f6('0x114')](db[_0xd1f6('0x22')],{'as':_0xd1f6('0x22'),'onDelete':'cascade','foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')]['hasOne'](db['UserSetting'],{'as':_0xd1f6('0x117'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db[_0xd1f6('0x11a')],{'as':'Recordings','foreignKey':'UserId'});db['User'][_0xd1f6('0x119')](db[_0xd1f6('0x11b')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db[_0xd1f6('0x19')],{'as':_0xd1f6('0x11c'),'onDelete':'cascade','hooks':!![]});db['User'][_0xd1f6('0x119')](db[_0xd1f6('0x80')],{'as':_0xd1f6('0x11d'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db[_0xd1f6('0x81')],{'as':_0xd1f6('0x11e'),'foreignKey':_0xd1f6('0x115')});db['User']['hasMany'](db[_0xd1f6('0x83')],{'as':_0xd1f6('0x83'),'foreignKey':_0xd1f6('0x115')});db['User'][_0xd1f6('0x119')](db['OpenchannelInteraction'],{'as':_0xd1f6('0x11f'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db[_0xd1f6('0x71')],{'as':_0xd1f6('0x120'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')]['hasMany'](db[_0xd1f6('0x5f')],{'as':_0xd1f6('0x121'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db[_0xd1f6('0x55')],{'as':_0xd1f6('0x122'),'foreignKey':_0xd1f6('0x115')});db['User'][_0xd1f6('0x119')](db[_0xd1f6('0x48')],{'as':_0xd1f6('0x123'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x116')][_0xd1f6('0x119')](db['WhatsappInteraction'],{'as':_0xd1f6('0x124'),'foreignKey':_0xd1f6('0x115')});db['User'][_0xd1f6('0x119')](db[_0xd1f6('0x103')],{'as':'UserNotifications','foreignKey':_0xd1f6('0x125')});db[_0xd1f6('0x116')][_0xd1f6('0x126')](db['UserProfile'],{'as':_0xd1f6('0xfd'),'foreignKey':_0xd1f6('0x127')});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x77')],{'as':_0xd1f6('0x129'),'through':'chat_group_has_users'});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x12a'),'through':'cm_user_has_contacts'});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x12b')],{'as':'Lists','through':_0xd1f6('0x12c')});db[_0xd1f6('0x116')]['belongsToMany'](db[_0xd1f6('0xe9')],{'through':'user_has_teams'});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x48')],{'as':_0xd1f6('0x123'),'through':'user_has_mail_interactions'});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x71')],{'as':_0xd1f6('0x120'),'through':'user_has_chat_interactions'});db[_0xd1f6('0x116')]['belongsToMany'](db['FaxInteraction'],{'as':'FaxInteractions','through':_0xd1f6('0x12d')});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x5f')],{'as':_0xd1f6('0x121'),'through':'user_has_sms_interactions'});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x67')],{'as':_0xd1f6('0x11f'),'through':_0xd1f6('0x12e')});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x107')],{'as':'WhatsappInteractions','through':_0xd1f6('0x12f')});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x1d')],{'as':'VoiceQueues','through':_0xd1f6('0x33'),'required':![]});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db['VoicePrefix'],{'as':_0xd1f6('0x130'),'through':_0xd1f6('0x131'),'required':![]});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x44')],{'as':'MailQueues','through':_0xd1f6('0x37'),'required':![]});db['User'][_0xd1f6('0x128')](db['ChatQueue'],{'as':_0xd1f6('0x132'),'through':'UserChatQueue','required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0xd1f6('0x58')],{'as':'FaxQueues','through':'UserFaxQueue','required':![]});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x63')],{'as':_0xd1f6('0x133'),'through':_0xd1f6('0x3a'),'required':![]});db[_0xd1f6('0x116')]['belongsToMany'](db[_0xd1f6('0x6a')],{'as':_0xd1f6('0x134'),'through':_0xd1f6('0x3c'),'required':![]});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x10b')],{'as':_0xd1f6('0x135'),'through':'UserWhatsappQueue','required':![]});db['User']['belongsToMany'](db[_0xd1f6('0x12b')],{'through':_0xd1f6('0x12c')});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x6c')],{'as':_0xd1f6('0x136'),'through':_0xd1f6('0x137')});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x51')],{'as':_0xd1f6('0x138'),'through':_0xd1f6('0x139')});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x42')],{'as':'MailAccounts','through':_0xd1f6('0x13a')});db['User']['belongsToMany'](db[_0xd1f6('0x13b')],{'as':'OpenchannelAccounts','through':_0xd1f6('0x13c')});db['User'][_0xd1f6('0x128')](db[_0xd1f6('0x5c')],{'as':'SmsAccounts','through':_0xd1f6('0x13d')});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x105')],{'as':_0xd1f6('0x13e'),'through':_0xd1f6('0x13f')});db[_0xd1f6('0x116')][_0xd1f6('0x128')](db[_0xd1f6('0x140')],{'as':_0xd1f6('0x141'),'through':_0xd1f6('0x142')});db[_0xd1f6('0x15')]['hasMany'](db[_0xd1f6('0x19')],{'as':'SpiedAgents','onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x143')});db[_0xd1f6('0x17')][_0xd1f6('0x119')](db['VoiceExtension'],{'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x19')][_0xd1f6('0x119')](db[_0xd1f6('0x19')],{'as':_0xd1f6('0x144'),'onDelete':_0xd1f6('0x118')});db['VoiceMusicOnHold'][_0xd1f6('0x128')](db[_0xd1f6('0x96')],{'as':_0xd1f6('0x145'),'through':_0xd1f6('0x146')});db[_0xd1f6('0x1d')][_0xd1f6('0x119')](db[_0xd1f6('0x11b')],{'as':_0xd1f6('0x147'),'foreignKey':_0xd1f6('0x148')});db['VoiceQueue'][_0xd1f6('0x119')](db[_0xd1f6('0x7d')],{'as':_0xd1f6('0x149'),'foreignKey':_0xd1f6('0x148')});db[_0xd1f6('0x1d')][_0xd1f6('0x119')](db['CmHopperFinal'],{'as':_0xd1f6('0x11d'),'foreignKey':_0xd1f6('0x148')});db[_0xd1f6('0x1d')]['hasMany'](db['CmHopperHistory'],{'as':_0xd1f6('0x14a'),'foreignKey':_0xd1f6('0x148')});db[_0xd1f6('0x1d')][_0xd1f6('0x119')](db[_0xd1f6('0x83')],{'as':_0xd1f6('0x83'),'foreignKey':_0xd1f6('0x148')});db[_0xd1f6('0x1d')]['hasMany'](db['CmHopperBlack'],{'as':_0xd1f6('0x14b'),'foreignKey':_0xd1f6('0x148')});db['VoiceQueue'][_0xd1f6('0x119')](db['JscriptySessionReport'],{'as':_0xd1f6('0x14c'),'foreignKey':_0xd1f6('0x148')});db[_0xd1f6('0x1d')][_0xd1f6('0x126')](db[_0xd1f6('0x2e')],{'as':'Trunk','foreignKey':_0xd1f6('0x14d')});db['VoiceQueue'][_0xd1f6('0x126')](db['Trunk'],{'as':_0xd1f6('0x14e'),'foreignKey':_0xd1f6('0x14f')});db[_0xd1f6('0x1d')][_0xd1f6('0x126')](db[_0xd1f6('0x150')],{'as':_0xd1f6('0x150'),'foreignKey':'IntervalId'});db[_0xd1f6('0x1d')][_0xd1f6('0x126')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xd1f6('0x1d')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xd1f6('0x151')});db[_0xd1f6('0x1d')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x33')});db['VoiceQueue'][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'as':_0xd1f6('0x153'),'through':'TeamVoiceQueue'});db[_0xd1f6('0x1d')]['belongsToMany'](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x154'),'through':_0xd1f6('0x155')});db[_0xd1f6('0x11a')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x116'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x20')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':'User','foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0xd1f6('0x24')],{'as':_0xd1f6('0x156'),'onDelete':'cascade','foreignKey':_0xd1f6('0x157'),'sourceKey':_0xd1f6('0x158')});db['VoiceMailMessage']['belongsTo'](db[_0xd1f6('0x22')],{'foreignKey':_0xd1f6('0x157'),'targetKey':_0xd1f6('0x158')});db[_0xd1f6('0x159')][_0xd1f6('0x119')](db[_0xd1f6('0x2a')],{'as':'QueueCalls','foreignKey':_0xd1f6('0x15a'),'constraints':![]});db[_0xd1f6('0x159')][_0xd1f6('0x119')](db['VoiceAgentReport'],{'as':_0xd1f6('0x15b'),'foreignKey':_0xd1f6('0x15a'),'constraints':![]});db[_0xd1f6('0x159')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x116'),'foreignKey':_0xd1f6('0x115')});db['VoiceCallReport'][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x3e')]['belongsTo'](db['MailAccount'],{'as':_0xd1f6('0x42'),'foreignKey':_0xd1f6('0x15e')});db[_0xd1f6('0x3e')][_0xd1f6('0x126')](db[_0xd1f6('0x10d')],{'as':_0xd1f6('0x10d'),'foreignKey':_0xd1f6('0x15f'),'onDelete':'restrict'});db[_0xd1f6('0x40')][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{'as':_0xd1f6('0x42'),'foreignKey':_0xd1f6('0x15e')});db[_0xd1f6('0x40')][_0xd1f6('0x126')](db[_0xd1f6('0x10d')],{'as':_0xd1f6('0x10d'),'foreignKey':_0xd1f6('0x15f'),'onDelete':_0xd1f6('0x160')});db['MailAccount'][_0xd1f6('0x114')](db['MailServerIn'],{'as':_0xd1f6('0x161'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x42')][_0xd1f6('0x114')](db[_0xd1f6('0x40')],{'as':_0xd1f6('0x162'),'onDelete':_0xd1f6('0x118')});db['MailAccount'][_0xd1f6('0x119')](db[_0xd1f6('0x8b')],{'as':_0xd1f6('0x163'),'foreignKey':'MailAccountId','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x42')]['hasMany'](db[_0xd1f6('0x164')],{'as':'Answers','foreignKey':_0xd1f6('0x15e')});db[_0xd1f6('0x42')][_0xd1f6('0x119')](db['MailMessage'],{'as':_0xd1f6('0x156'),'foreignKey':_0xd1f6('0x15e')});db[_0xd1f6('0x42')][_0xd1f6('0x119')](db[_0xd1f6('0x48')],{'as':_0xd1f6('0x165')});db[_0xd1f6('0x42')][_0xd1f6('0x119')](db[_0xd1f6('0x4b')],{'as':_0xd1f6('0x144')});db[_0xd1f6('0x42')]['belongsTo'](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':'ListId'});db[_0xd1f6('0x42')][_0xd1f6('0x126')](db[_0xd1f6('0x167')],{'as':_0xd1f6('0x167'),'foreignKey':_0xd1f6('0x168')});db[_0xd1f6('0x42')][_0xd1f6('0x126')](db[_0xd1f6('0x8e')],{'as':_0xd1f6('0x169'),'foreignKey':_0xd1f6('0x16a')});db[_0xd1f6('0x42')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x13a')});db[_0xd1f6('0x44')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x37')});db[_0xd1f6('0x44')][_0xd1f6('0x128')](db['Team'],{'through':_0xd1f6('0x16b'),'as':_0xd1f6('0x153')});db[_0xd1f6('0x48')][_0xd1f6('0x119')](db[_0xd1f6('0x4a')],{'as':_0xd1f6('0x156'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x16c')});db[_0xd1f6('0x48')][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{'as':_0xd1f6('0x16d'),'foreignKey':'MailAccountId'});db[_0xd1f6('0x48')][_0xd1f6('0x126')](db['CmContact'],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x48')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x16e'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x48')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x170'),'as':'Tags'});db['MailInteraction'][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x170'),'as':_0xd1f6('0x171')});db['MailInteraction']['belongsToMany'](db[_0xd1f6('0x116')],{'as':'Users','through':_0xd1f6('0x172'),'foreignKey':'MailInteractionId'});db[_0xd1f6('0x4a')][_0xd1f6('0x119')](db[_0xd1f6('0x173')],{'as':_0xd1f6('0x174'),'onDelete':_0xd1f6('0x118')});db['MailMessage'][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x116')});db['MailMessage'][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'onDelete':_0xd1f6('0x118'),'as':_0xd1f6('0x15c')});db[_0xd1f6('0x4a')][_0xd1f6('0x126')](db[_0xd1f6('0x48')],{'as':_0xd1f6('0x175'),'foreignKey':_0xd1f6('0x16c')});db[_0xd1f6('0x4a')]['belongsTo'](db['MailAccount'],{'as':_0xd1f6('0x16d'),'foreignKey':'MailAccountId'});db['MailMessage']['belongsTo'](db['ChatWebsite'],{'as':'ChatWebsite','foreignKey':_0xd1f6('0x176')});db[_0xd1f6('0x4a')][_0xd1f6('0x126')](db[_0xd1f6('0x74')],{'as':_0xd1f6('0x74'),'foreignKey':_0xd1f6('0x177')});db[_0xd1f6('0x4b')][_0xd1f6('0x126')](db['User'],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x4b')][_0xd1f6('0x126')](db['MailQueue'],{'onDelete':_0xd1f6('0x160')});db['MailApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{'onDelete':_0xd1f6('0x160')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db['MailApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x16f')],{'onDelete':_0xd1f6('0x160'),'foreignKey':'TagId'});db[_0xd1f6('0x178')][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{});db['MailQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x178')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x178')][_0xd1f6('0x126')](db[_0xd1f6('0x48')],{});db[_0xd1f6('0x178')][_0xd1f6('0x126')](db[_0xd1f6('0x4a')],{});db[_0xd1f6('0x178')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{});db['MailQueueReport']['belongsTo'](db[_0xd1f6('0x44')],{});db[_0xd1f6('0x4e')][_0xd1f6('0x119')](db[_0xd1f6('0x50')],{'as':_0xd1f6('0x17a'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x51')][_0xd1f6('0x119')](db[_0xd1f6('0x8b')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x51')][_0xd1f6('0x119')](db[_0xd1f6('0x164')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xd1f6('0x51')][_0xd1f6('0x119')](db['FaxInteraction'],{'as':_0xd1f6('0x165')});db['FaxAccount'][_0xd1f6('0x119')](db['FaxApplication'],{'as':_0xd1f6('0x144')});db[_0xd1f6('0x51')][_0xd1f6('0x119')](db['VoiceExtension'],{'as':_0xd1f6('0x17b'),'onDelete':'cascade'});db[_0xd1f6('0x51')][_0xd1f6('0x119')](db[_0xd1f6('0x17c')],{'as':_0xd1f6('0x156')});db[_0xd1f6('0x51')][_0xd1f6('0x126')](db[_0xd1f6('0x2e')],{'as':'Trunk'});db['FaxAccount'][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x51')][_0xd1f6('0x126')](db['Pause'],{'as':_0xd1f6('0x169'),'foreignKey':_0xd1f6('0x16a')});db['FaxAccount'][_0xd1f6('0x128')](db['User'],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x139')});db[_0xd1f6('0x53')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'onDelete':_0xd1f6('0x160')});db['FaxApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x58')],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x53')][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x53')][_0xd1f6('0x126')](db['Tag'],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x17d')});db[_0xd1f6('0x55')][_0xd1f6('0x119')](db[_0xd1f6('0x17c')],{'as':_0xd1f6('0x156'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x17e')});db[_0xd1f6('0x55')][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{'as':'Account','foreignKey':'FaxAccountId'});db[_0xd1f6('0x55')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':'Contact','foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x55')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':'Owner','foreignKey':'UserId'});db[_0xd1f6('0x55')]['belongsToMany'](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x17f'),'as':_0xd1f6('0x180')});db[_0xd1f6('0x55')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x17f'),'as':_0xd1f6('0x171')});db[_0xd1f6('0x55')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x12d'),'foreignKey':'FaxInteractionId'});db['FaxMessage']['belongsTo'](db[_0xd1f6('0x116')],{'onDelete':_0xd1f6('0x118'),'as':'User'});db['FaxMessage'][_0xd1f6('0x126')](db['FaxInteraction'],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xd1f6('0x17c')]['belongsTo'](db['CmContact'],{'onDelete':_0xd1f6('0x118'),'as':_0xd1f6('0x15c')});db[_0xd1f6('0x17c')]['belongsTo'](db[_0xd1f6('0x173')],{'as':_0xd1f6('0x173'),'foreignKey':_0xd1f6('0x182')});db[_0xd1f6('0x17c')][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{'as':'Account','foreignKey':_0xd1f6('0x183')});db[_0xd1f6('0x58')][_0xd1f6('0x128')](db['User'],{'as':'Agents','through':'UserFaxQueue'});db[_0xd1f6('0x58')]['belongsToMany'](db[_0xd1f6('0xe9')],{'through':_0xd1f6('0x184'),'as':_0xd1f6('0x153')});db[_0xd1f6('0x5a')][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{});db[_0xd1f6('0x5a')][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':'List','foreignKey':_0xd1f6('0x179')});db['FaxQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x5a')]['belongsTo'](db[_0xd1f6('0x55')],{});db[_0xd1f6('0x5a')][_0xd1f6('0x126')](db['FaxMessage'],{});db[_0xd1f6('0x5a')][_0xd1f6('0x126')](db['User'],{});db[_0xd1f6('0x5a')]['belongsTo'](db[_0xd1f6('0x58')],{});db[_0xd1f6('0x5c')]['hasMany'](db['Disposition'],{'as':_0xd1f6('0x163'),'foreignKey':_0xd1f6('0x185'),'onDelete':_0xd1f6('0x118')});db['SmsAccount'][_0xd1f6('0x119')](db[_0xd1f6('0x164')],{'as':_0xd1f6('0x186'),'foreignKey':_0xd1f6('0x185')});db[_0xd1f6('0x5c')][_0xd1f6('0x119')](db[_0xd1f6('0x61')],{'as':'Messages','foreignKey':'SmsAccountId'});db[_0xd1f6('0x5c')][_0xd1f6('0x119')](db[_0xd1f6('0x5f')],{'as':'Interactions'});db['SmsAccount'][_0xd1f6('0x119')](db[_0xd1f6('0x187')],{'as':_0xd1f6('0x144')});db[_0xd1f6('0x5c')][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':'ListId'});db['SmsAccount'][_0xd1f6('0x126')](db['Pause'],{'as':_0xd1f6('0x169'),'foreignKey':_0xd1f6('0x16a')});db[_0xd1f6('0x5c')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x13d')});db['SmsApplication'][_0xd1f6('0x126')](db['User'],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x187')][_0xd1f6('0x126')](db[_0xd1f6('0x63')],{'onDelete':_0xd1f6('0x160')});db['SmsApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x5c')],{'onDelete':'restrict'});db[_0xd1f6('0x187')]['belongsTo'](db['Interval'],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x188')});db[_0xd1f6('0x187')][_0xd1f6('0x126')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xd1f6('0x17d')});db[_0xd1f6('0x5f')][_0xd1f6('0x119')](db['SmsMessage'],{'as':_0xd1f6('0x156'),'onDelete':'cascade','foreignKey':_0xd1f6('0x189')});db[_0xd1f6('0x5f')][_0xd1f6('0x126')](db['SmsAccount'],{'as':'Account','foreignKey':_0xd1f6('0x185')});db['SmsInteraction'][_0xd1f6('0x126')](db['CmContact'],{'as':_0xd1f6('0x15c'),'foreignKey':'ContactId'});db[_0xd1f6('0x5f')][_0xd1f6('0x126')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd1f6('0x5f')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x18a'),'as':_0xd1f6('0x180')});db[_0xd1f6('0x5f')]['belongsToMany'](db['Tag'],{'through':_0xd1f6('0x18a'),'as':_0xd1f6('0x171')});db[_0xd1f6('0x5f')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x18b'),'foreignKey':'SmsInteractionId'});db[_0xd1f6('0x61')][_0xd1f6('0x126')](db['User'],{'as':'User'});db[_0xd1f6('0x61')][_0xd1f6('0x126')](db['CmContact'],{'onDelete':_0xd1f6('0x118'),'as':'Contact'});db[_0xd1f6('0x61')][_0xd1f6('0x126')](db['SmsInteraction'],{'onDelete':_0xd1f6('0x118'),'as':_0xd1f6('0x175'),'foreignKey':_0xd1f6('0x189')});db[_0xd1f6('0x61')][_0xd1f6('0x126')](db[_0xd1f6('0x5c')],{'as':'Account','foreignKey':_0xd1f6('0x185')});db[_0xd1f6('0x63')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db['SmsQueue'][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'through':_0xd1f6('0x18c'),'as':_0xd1f6('0x153')});db[_0xd1f6('0x13b')][_0xd1f6('0x119')](db[_0xd1f6('0x8b')],{'as':_0xd1f6('0x163'),'foreignKey':_0xd1f6('0x18d'),'onDelete':'cascade'});db[_0xd1f6('0x13b')][_0xd1f6('0x119')](db[_0xd1f6('0x164')],{'as':_0xd1f6('0x186'),'foreignKey':'OpenchannelAccountId'});db[_0xd1f6('0x13b')]['hasMany'](db[_0xd1f6('0x67')],{'as':_0xd1f6('0x165'),'foreignKey':_0xd1f6('0x18d')});db['OpenchannelAccount'][_0xd1f6('0x119')](db[_0xd1f6('0x68')],{'as':_0xd1f6('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0xd1f6('0x13b')][_0xd1f6('0x119')](db['OpenchannelApplication'],{'as':_0xd1f6('0x144'),'foreignKey':_0xd1f6('0x18d')});db[_0xd1f6('0x13b')][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179')});db['OpenchannelAccount'][_0xd1f6('0x126')](db[_0xd1f6('0x8e')],{'as':_0xd1f6('0x169'),'foreignKey':_0xd1f6('0x16a')});db[_0xd1f6('0x13b')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Agents','through':_0xd1f6('0x13c')});db[_0xd1f6('0x65')]['belongsTo'](db[_0xd1f6('0x116')],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x65')][_0xd1f6('0x126')](db[_0xd1f6('0x6a')],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x18e')});db[_0xd1f6('0x65')][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x18d')});db[_0xd1f6('0x65')][_0xd1f6('0x126')](db[_0xd1f6('0x150')],{'onDelete':_0xd1f6('0x160'),'foreignKey':'IntervalId'});db[_0xd1f6('0x65')][_0xd1f6('0x126')](db[_0xd1f6('0x16f')],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x17d')});db['OpenchannelInteraction'][_0xd1f6('0x119')](db[_0xd1f6('0x68')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xd1f6('0x18f')});db['OpenchannelInteraction'][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{'as':_0xd1f6('0x16d'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db['CmContact'],{'as':_0xd1f6('0x15c'),'foreignKey':'ContactId'});db[_0xd1f6('0x67')]['belongsTo'](db['User'],{'as':_0xd1f6('0x16e'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x67')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x190'),'as':'Tags'});db[_0xd1f6('0x67')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x190'),'as':_0xd1f6('0x171')});db['OpenchannelInteraction']['belongsToMany'](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x12e'),'foreignKey':_0xd1f6('0x18f')});db[_0xd1f6('0x68')]['belongsTo'](db['User'],{'onDelete':_0xd1f6('0x118'),'as':'User'});db[_0xd1f6('0x68')][_0xd1f6('0x126')](db['CmContact'],{'onDelete':_0xd1f6('0x118'),'as':_0xd1f6('0x15c')});db[_0xd1f6('0x68')][_0xd1f6('0x126')](db['OpenchannelInteraction'],{'onDelete':_0xd1f6('0x118'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xd1f6('0x68')]['belongsTo'](db[_0xd1f6('0x173')],{'as':'Attachment','foreignKey':_0xd1f6('0x182')});db[_0xd1f6('0x68')][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{'as':'Account','foreignKey':_0xd1f6('0x18d')});db[_0xd1f6('0x6a')][_0xd1f6('0x128')](db['User'],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x3c'),'foreignKey':_0xd1f6('0x18e')});db['OpenchannelQueue'][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'through':'team_has_openchannel_queues','as':_0xd1f6('0x153')});db[_0xd1f6('0x6c')]['hasMany'](db[_0xd1f6('0x8b')],{'as':'Dispositions','foreignKey':'ChatWebsiteId','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x6c')][_0xd1f6('0x119')](db['CannedAnswer'],{'as':_0xd1f6('0x186'),'foreignKey':_0xd1f6('0x176')});db[_0xd1f6('0x6c')][_0xd1f6('0x119')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0xd1f6('0x6c')][_0xd1f6('0x119')](db[_0xd1f6('0x71')],{'as':_0xd1f6('0x165')});db[_0xd1f6('0x6c')][_0xd1f6('0x119')](db['ChatApplication'],{'as':_0xd1f6('0x144')});db[_0xd1f6('0x6c')]['hasMany'](db['ChatMessage'],{'as':_0xd1f6('0x156')});db['ChatWebsite'][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':'List','foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x6c')][_0xd1f6('0x126')](db[_0xd1f6('0x150')],{'as':_0xd1f6('0x150'),'foreignKey':_0xd1f6('0x188')});db[_0xd1f6('0x6c')][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{'as':_0xd1f6('0x42'),'foreignKey':_0xd1f6('0x15e')});db[_0xd1f6('0x6c')][_0xd1f6('0x126')](db[_0xd1f6('0x8e')],{'as':_0xd1f6('0x169'),'foreignKey':_0xd1f6('0x16a')});db[_0xd1f6('0x6c')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x137')});db[_0xd1f6('0x191')][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{});db['OpenchannelQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':'List','foreignKey':'ListId'});db[_0xd1f6('0x191')]['belongsTo'](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db['OpenchannelQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x67')],{});db[_0xd1f6('0x191')][_0xd1f6('0x126')](db[_0xd1f6('0x68')],{});db['OpenchannelQueueReport'][_0xd1f6('0x126')](db['User'],{});db[_0xd1f6('0x191')]['belongsTo'](db[_0xd1f6('0x6a')],{});db['ChatApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x192'),'foreignKey':'UserId','onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x6f')]['belongsTo'](db[_0xd1f6('0x193')],{'as':'Queue','foreignKey':_0xd1f6('0x194'),'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x6f')]['belongsTo'](db[_0xd1f6('0x6c')],{'as':_0xd1f6('0x195'),'foreignKey':_0xd1f6('0x176'),'onDelete':_0xd1f6('0x160')});db['ChatApplication'][_0xd1f6('0x126')](db[_0xd1f6('0x16f')],{'onDelete':_0xd1f6('0x160'),'foreignKey':_0xd1f6('0x17d')});db[_0xd1f6('0x71')][_0xd1f6('0x119')](db[_0xd1f6('0x73')],{'as':'Messages','onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x196')});db['ChatInteraction'][_0xd1f6('0x126')](db[_0xd1f6('0x6c')],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x176')});db[_0xd1f6('0x71')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':'Contact','foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x71')]['belongsTo'](db[_0xd1f6('0x116')],{'as':'Owner','foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x71')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x197'),'as':_0xd1f6('0x180')});db['ChatInteraction']['belongsToMany'](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x197'),'as':_0xd1f6('0x171')});db[_0xd1f6('0x71')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x198'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'onDelete':'cascade','as':_0xd1f6('0x116')});db[_0xd1f6('0x73')]['belongsTo'](db[_0xd1f6('0x7b')],{'onDelete':'cascade','as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db['ChatMessage'][_0xd1f6('0x126')](db[_0xd1f6('0x71')],{'onDelete':'cascade','as':_0xd1f6('0x175'),'foreignKey':_0xd1f6('0x196')});db[_0xd1f6('0x73')][_0xd1f6('0x126')](db[_0xd1f6('0x173')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xd1f6('0x73')][_0xd1f6('0x126')](db[_0xd1f6('0x6c')],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x176')});db[_0xd1f6('0x74')]['hasMany'](db[_0xd1f6('0x173')],{'as':_0xd1f6('0x174'),'foreignKey':_0xd1f6('0x177'),'onDelete':_0xd1f6('0x118'),'hooks':!![]});db[_0xd1f6('0x74')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'onDelete':_0xd1f6('0x118'),'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x74')][_0xd1f6('0x126')](db[_0xd1f6('0x6c')],{'as':'Account','foreignKey':_0xd1f6('0x176')});db[_0xd1f6('0x193')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xd1f6('0x193')][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'through':'team_has_chat_queues','as':_0xd1f6('0x153')});db[_0xd1f6('0x77')]['hasMany'](db[_0xd1f6('0x199')],{'as':_0xd1f6('0x156'),'foreignKey':'ChatGroupId','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x77')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Members','through':_0xd1f6('0x19a')});db[_0xd1f6('0x78')]['belongsTo'](db['ChatWebsite'],{'as':_0xd1f6('0x195'),'foreignKey':'ChatWebsiteId'});db[_0xd1f6('0x79')][_0xd1f6('0x119')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x12a'),'foreignKey':_0xd1f6('0x19b')});db[_0xd1f6('0x7b')][_0xd1f6('0x119')](db['CmContactHasItem'],{'as':'Phones','foreignKey':'CmContactId'});db['CmContact'][_0xd1f6('0x119')](db[_0xd1f6('0x7d')],{'as':_0xd1f6('0x149'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x7b')]['hasMany'](db[_0xd1f6('0x80')],{'as':'HopperFinals','foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x7b')][_0xd1f6('0x119')](db[_0xd1f6('0x81')],{'as':_0xd1f6('0x14a'),'foreignKey':_0xd1f6('0x15d')});db['CmContact'][_0xd1f6('0x119')](db['ReportAgentPreview'],{'as':_0xd1f6('0x83'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x7b')][_0xd1f6('0x119')](db['JscriptySessionReport'],{'as':_0xd1f6('0x14c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x7b')]['hasMany'](db['OpenchannelInteraction'],{'as':_0xd1f6('0x11f'),'foreignKey':_0xd1f6('0x15d'),'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x7b')][_0xd1f6('0x119')](db[_0xd1f6('0x71')],{'as':_0xd1f6('0x120'),'foreignKey':'ContactId','onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x7b')]['hasMany'](db[_0xd1f6('0x5f')],{'as':_0xd1f6('0x121'),'foreignKey':_0xd1f6('0x15d'),'onDelete':_0xd1f6('0x160')});db['CmContact'][_0xd1f6('0x119')](db[_0xd1f6('0x55')],{'as':'FaxInteractions','foreignKey':_0xd1f6('0x15d'),'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x7b')]['hasMany'](db['MailInteraction'],{'as':_0xd1f6('0x123'),'foreignKey':_0xd1f6('0x15d'),'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x7b')][_0xd1f6('0x126')](db[_0xd1f6('0x79')],{'as':_0xd1f6('0x19c'),'foreignKey':'CompanyId'});db[_0xd1f6('0x7b')][_0xd1f6('0x126')](db['CmList'],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179'),'onDelete':'cascade'});db[_0xd1f6('0x7b')]['belongsToMany'](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x19d')});db['CmContact'][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'as':'Tags','through':_0xd1f6('0x19e')});db[_0xd1f6('0x7b')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x19e'),'as':_0xd1f6('0x171')});db['CmHopper'][_0xd1f6('0x119')](db[_0xd1f6('0x9d')],{'as':_0xd1f6('0x19f'),'foreignKey':_0xd1f6('0x1a0')});db[_0xd1f6('0x7d')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':'ContactId','onDelete':_0xd1f6('0x118')});db['CmHopper'][_0xd1f6('0x126')](db['CmList'],{'as':_0xd1f6('0x166'),'foreignKey':'ListId','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x7d')][_0xd1f6('0x126')](db['User'],{'as':_0xd1f6('0x192'),'foreignKey':_0xd1f6('0x115')});db[_0xd1f6('0x7d')][_0xd1f6('0x126')](db[_0xd1f6('0x1d')],{'as':_0xd1f6('0x1a1'),'foreignKey':_0xd1f6('0x148'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x7d')][_0xd1f6('0x126')](db['Campaign'],{'as':_0xd1f6('0x1a2'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xd1f6('0x7d')]['belongsTo'](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x16e'),'foreignKey':_0xd1f6('0x1a3')});db[_0xd1f6('0x7f')]['belongsTo'](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x7f')]['belongsTo'](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x7f')][_0xd1f6('0x126')](db['VoiceQueue'],{'as':_0xd1f6('0x1a1'),'foreignKey':_0xd1f6('0x148'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x7f')][_0xd1f6('0x126')](db['Campaign'],{'as':_0xd1f6('0x1a2'),'foreignKey':_0xd1f6('0x1a4'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x1a5')]['hasMany'](db['Condition'],{'as':{'plural':_0xd1f6('0x1a6'),'singular':_0xd1f6('0x1a7')},'foreignKey':'AutomationAllId','onDelete':_0xd1f6('0x118'),'hooks':!![]});db[_0xd1f6('0x1a5')][_0xd1f6('0x119')](db[_0xd1f6('0x1a8')],{'as':{'plural':'Any','singular':'OneAny'},'foreignKey':_0xd1f6('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xd1f6('0x1a5')]['hasMany'](db['Action'],{'as':_0xd1f6('0x1aa'),'foreignKey':_0xd1f6('0x1ab'),'onDelete':'cascade','hooks':!![]});db[_0xd1f6('0x8b')]['hasMany'](db[_0xd1f6('0x8b')],{'as':_0xd1f6('0x163'),'foreignKey':_0xd1f6('0x1ac'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0x150')][_0xd1f6('0x119')](db[_0xd1f6('0x150')],{'as':'Intervals','foreignKey':_0xd1f6('0x188'),'onDelete':_0xd1f6('0x118'),'hooks':!![],'required':![]});db[_0xd1f6('0x150')]['hasMany'](db[_0xd1f6('0x19')],{'as':'Extensions','foreignKey':_0xd1f6('0x188'),'onDelete':'restrict'});db[_0xd1f6('0x150')][_0xd1f6('0x119')](db[_0xd1f6('0x4b')],{'as':_0xd1f6('0x1ad'),'foreignKey':_0xd1f6('0x188')});db[_0xd1f6('0x150')][_0xd1f6('0x119')](db[_0xd1f6('0x6f')],{'as':_0xd1f6('0x1ae'),'foreignKey':'IntervalId'});db[_0xd1f6('0x150')]['hasMany'](db[_0xd1f6('0x53')],{'as':_0xd1f6('0x1af'),'foreignKey':_0xd1f6('0x188')});db['Interval'][_0xd1f6('0x119')](db[_0xd1f6('0x187')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0xd1f6('0x94')]['belongsTo'](db[_0xd1f6('0x42')],{});db['Schedule'][_0xd1f6('0x126')](db[_0xd1f6('0xa5')],{'foreignKey':'DefaultReportId'});db[_0xd1f6('0x94')][_0xd1f6('0x126')](db[_0xd1f6('0x1b0')],{'foreignKey':_0xd1f6('0x1b1')});db[_0xd1f6('0x96')][_0xd1f6('0x128')](db[_0xd1f6('0x1b')],{'as':'Mohs','through':_0xd1f6('0x146'),'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x16f')]['belongsToMany'](db[_0xd1f6('0x7b')],{'through':_0xd1f6('0x19e')});db[_0xd1f6('0x16f')][_0xd1f6('0x128')](db[_0xd1f6('0x71')],{'through':_0xd1f6('0x197')});db[_0xd1f6('0x16f')][_0xd1f6('0x128')](db['MailInteraction'],{'through':_0xd1f6('0x170')});db['Tag'][_0xd1f6('0x128')](db[_0xd1f6('0x5f')],{'through':_0xd1f6('0x18a')});db[_0xd1f6('0x16f')][_0xd1f6('0x128')](db['FaxInteraction'],{'through':_0xd1f6('0x17f')});db[_0xd1f6('0x16f')][_0xd1f6('0x128')](db[_0xd1f6('0x67')],{'through':_0xd1f6('0x190')});db[_0xd1f6('0x16f')][_0xd1f6('0x128')](db[_0xd1f6('0x107')],{'through':_0xd1f6('0x1b2')});db[_0xd1f6('0x9b')][_0xd1f6('0x126')](db[_0xd1f6('0x99')],{'as':_0xd1f6('0x1b3'),'foreignKey':_0xd1f6('0x1b4')});db['CmHopperAdditionalPhone']['belongsTo'](db[_0xd1f6('0x7d')],{'as':_0xd1f6('0x1b5'),'foreignKey':'CmHopperId'});db[_0xd1f6('0x9b')]['belongsTo'](db['CmContact'],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x1b6')});db[_0xd1f6('0x9e')][_0xd1f6('0x119')](db[_0xd1f6('0x1a8')],{'as':{'plural':_0xd1f6('0x1b7'),'singular':_0xd1f6('0x1b8')},'foreignKey':_0xd1f6('0x1b9'),'onDelete':'cascade','hooks':!![]});db[_0xd1f6('0x9e')]['hasMany'](db[_0xd1f6('0x1a8')],{'as':{'plural':_0xd1f6('0x1ba'),'singular':'AnyCondition'},'foreignKey':_0xd1f6('0x1bb'),'onDelete':_0xd1f6('0x118'),'hooks':!![]});db[_0xd1f6('0x9e')]['hasMany'](db[_0xd1f6('0x87')],{'as':_0xd1f6('0x1aa'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xd1f6('0xa8')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd1f6('0x1b1'),'hooks':!![]});db[_0xd1f6('0xa5')][_0xd1f6('0x119')](db[_0xd1f6('0xa8')],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1bd')});db[_0xd1f6('0x1be')][_0xd1f6('0x119')](db['AnalyticFieldReport'],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1bf')});db[_0xd1f6('0xa8')][_0xd1f6('0x126')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0xd1f6('0xab')],{'as':_0xd1f6('0x1c0'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c1')});db['SalesforceConfiguration'][_0xd1f6('0x119')](db['SalesforceField'],{'as':_0xd1f6('0x1c2'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xab')]['hasMany'](db['SalesforceField'],{'as':_0xd1f6('0x1c4'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xab')][_0xd1f6('0x119')](db[_0xd1f6('0x1c6')],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xab')][_0xd1f6('0x126')](db[_0xd1f6('0x1c8')],{'as':_0xd1f6('0x16d'),'foreignKey':'AccountId'});db[_0xd1f6('0x1c6')][_0xd1f6('0x119')](db[_0xd1f6('0x1c6')],{'as':_0xd1f6('0x1c9'),'foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0x1c6')][_0xd1f6('0x119')](db[_0xd1f6('0x1c6')],{'as':_0xd1f6('0x1ca'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xd1f6('0x119')](db[_0xd1f6('0x1c6')],{'as':_0xd1f6('0x1cb'),'foreignKey':'FieldId'});db['SalesforceField'][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xae')]['hasMany'](db[_0xd1f6('0xb0')],{'as':_0xd1f6('0x1c0'),'onDelete':_0xd1f6('0x118'),'foreignKey':'AccountId'});db[_0xd1f6('0xb0')][_0xd1f6('0x119')](db[_0xd1f6('0xb2')],{'as':_0xd1f6('0x1c2'),'onDelete':_0xd1f6('0x118'),'foreignKey':'SubjectId'});db[_0xd1f6('0xb0')][_0xd1f6('0x119')](db['SugarcrmField'],{'as':_0xd1f6('0x1c4'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c5')});db['SugarcrmConfiguration']['hasMany'](db[_0xd1f6('0xb2')],{'as':_0xd1f6('0x1bc'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xb0')]['belongsTo'](db[_0xd1f6('0xae')],{'as':'Account','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xb2')]['hasMany'](db[_0xd1f6('0xb2')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd1f6('0xb2')][_0xd1f6('0x119')](db[_0xd1f6('0xb2')],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xb2')][_0xd1f6('0x119')](db[_0xd1f6('0xb2')],{'as':'Field','foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xb2')][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xb4')][_0xd1f6('0x119')](db[_0xd1f6('0x1cd')],{'as':_0xd1f6('0x1c0'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0x1cd')][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':'Subjects','onDelete':_0xd1f6('0x118'),'foreignKey':'SubjectId'});db[_0xd1f6('0x1cd')][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':_0xd1f6('0x1c4'),'onDelete':_0xd1f6('0x118'),'foreignKey':'DescriptionId'});db['DeskConfiguration'][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0x1cd')]['belongsTo'](db[_0xd1f6('0xb4')],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0x1cd')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x1ce')});db[_0xd1f6('0xb7')][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':_0xd1f6('0x1c9'),'foreignKey':'SubjectId'});db[_0xd1f6('0xb7')][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db['DeskField'][_0xd1f6('0x119')](db[_0xd1f6('0xb7')],{'as':_0xd1f6('0x1cb'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xb7')][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':'VariableId'});db[_0xd1f6('0xb9')][_0xd1f6('0x119')](db[_0xd1f6('0xbb')],{'as':_0xd1f6('0x1c0'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xbb')][_0xd1f6('0x119')](db[_0xd1f6('0xbd')],{'as':'Subjects','onDelete':_0xd1f6('0x118'),'foreignKey':'SubjectId'});db[_0xd1f6('0xbb')][_0xd1f6('0x119')](db[_0xd1f6('0xbd')],{'as':_0xd1f6('0x1c4'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c5')});db['ZohoConfiguration'][_0xd1f6('0x119')](db[_0xd1f6('0xbd')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd1f6('0x1c7')});db['ZohoConfiguration'][_0xd1f6('0x126')](db['ZohoAccount'],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xbd')][_0xd1f6('0x119')](db['ZohoField'],{'as':_0xd1f6('0x1c9'),'foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xbd')][_0xd1f6('0x119')](db[_0xd1f6('0xbd')],{'as':_0xd1f6('0x1ca'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xd1f6('0x119')](db[_0xd1f6('0xbd')],{'as':_0xd1f6('0x1cb'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xbd')][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xbf')][_0xd1f6('0x119')](db[_0xd1f6('0x1cf')],{'as':'Configurations','onDelete':_0xd1f6('0x118'),'foreignKey':'AccountId'});db[_0xd1f6('0x1cf')][_0xd1f6('0x119')](db['ZendeskField'],{'as':_0xd1f6('0x1c2'),'foreignKey':'SubjectId'});db['ZendeskConfiguration'][_0xd1f6('0x119')](db[_0xd1f6('0x1d0')],{'as':_0xd1f6('0x1c4'),'foreignKey':'DescriptionId'});db[_0xd1f6('0x1cf')]['hasMany'](db[_0xd1f6('0x1d0')],{'as':_0xd1f6('0x1bc'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0x1cf')][_0xd1f6('0x126')](db['ZendeskAccount'],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0x1cf')][_0xd1f6('0x128')](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x1d1')});db['ZendeskField'][_0xd1f6('0x119')](db[_0xd1f6('0x1d0')],{'as':_0xd1f6('0x1c9'),'foreignKey':'SubjectId'});db[_0xd1f6('0x1d0')][_0xd1f6('0x119')](db[_0xd1f6('0x1d0')],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0x1d0')]['hasMany'](db['ZendeskField'],{'as':_0xd1f6('0x1cb'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0x1d0')][_0xd1f6('0x126')](db['Variable'],{'as':'Variable','foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0x1d2')][_0xd1f6('0x119')](db[_0xd1f6('0xc3')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0xd1f6('0xc3')][_0xd1f6('0x119')](db[_0xd1f6('0xc4')],{'as':'Subjects','onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xc3')][_0xd1f6('0x119')](db[_0xd1f6('0xc4')],{'as':'Descriptions','onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xc3')][_0xd1f6('0x119')](db[_0xd1f6('0xc4')],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xc3')][_0xd1f6('0x126')](db[_0xd1f6('0x1d2')],{'as':'Account','foreignKey':'AccountId'});db[_0xd1f6('0xc3')][_0xd1f6('0x128')](db['Tag'],{'through':_0xd1f6('0x1d3')});db['FreshdeskField'][_0xd1f6('0x119')](db[_0xd1f6('0xc4')],{'as':_0xd1f6('0x1c9'),'foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xc4')][_0xd1f6('0x119')](db[_0xd1f6('0xc4')],{'as':'Description','foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xc4')][_0xd1f6('0x119')](db['FreshdeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xd1f6('0xc4')][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':'VariableId'});db[_0xd1f6('0x1d4')][_0xd1f6('0x119')](db[_0xd1f6('0x1d5')],{'as':_0xd1f6('0x1c0'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0x1d5')]['hasMany'](db[_0xd1f6('0xc7')],{'as':_0xd1f6('0x1c2'),'foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0x1d5')]['hasMany'](db[_0xd1f6('0xc7')],{'as':_0xd1f6('0x1c4'),'foreignKey':_0xd1f6('0x1c5')});db['VtigerConfiguration']['hasMany'](db[_0xd1f6('0xc7')],{'as':_0xd1f6('0x1bc'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0x1d5')]['belongsTo'](db[_0xd1f6('0x1d4')],{'as':'Account','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xc7')][_0xd1f6('0x119')](db[_0xd1f6('0xc7')],{'as':_0xd1f6('0x1c9'),'foreignKey':'SubjectId'});db[_0xd1f6('0xc7')][_0xd1f6('0x119')](db[_0xd1f6('0xc7')],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xc7')][_0xd1f6('0x119')](db['VtigerField'],{'as':_0xd1f6('0x1cb'),'foreignKey':'FieldId'});db['VtigerField'][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':'Variable','foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xc9')][_0xd1f6('0x119')](db[_0xd1f6('0x1d6')],{'as':_0xd1f6('0x1c0'),'onDelete':_0xd1f6('0x118'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xd1f6('0x119')](db[_0xd1f6('0x1d7')],{'as':'Subjects','foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0x1d6')][_0xd1f6('0x119')](db[_0xd1f6('0x1d7')],{'as':_0xd1f6('0x1c4'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0x1d6')][_0xd1f6('0x119')](db[_0xd1f6('0x1d7')],{'as':_0xd1f6('0x1bc'),'foreignKey':'FieldId'});db[_0xd1f6('0x1d6')][_0xd1f6('0x126')](db[_0xd1f6('0xc9')],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1c1')});db['ServicenowField']['hasMany'](db[_0xd1f6('0x1d7')],{'as':_0xd1f6('0x1c9'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db['ServicenowField'],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db['ServicenowField'][_0xd1f6('0x119')](db['ServicenowField'],{'as':_0xd1f6('0x1cb'),'foreignKey':'FieldId'});db['ServicenowField'][_0xd1f6('0x126')](db['Variable'],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xcc')][_0xd1f6('0x119')](db[_0xd1f6('0xce')],{'as':_0xd1f6('0x1c0'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xcc')][_0xd1f6('0x126')](db[_0xd1f6('0x10d')],{'as':_0xd1f6('0x10d'),'foreignKey':'CloudProviderId'});db[_0xd1f6('0xce')][_0xd1f6('0x119')](db[_0xd1f6('0xd0')],{'as':_0xd1f6('0x1c2'),'onDelete':'cascade','foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xce')]['hasMany'](db[_0xd1f6('0xd0')],{'as':_0xd1f6('0x1c4'),'onDelete':_0xd1f6('0x118'),'foreignKey':'DescriptionId'});db[_0xd1f6('0xce')][_0xd1f6('0x119')](db[_0xd1f6('0xd0')],{'as':_0xd1f6('0x1bc'),'onDelete':_0xd1f6('0x118'),'foreignKey':'FieldId'});db[_0xd1f6('0xce')][_0xd1f6('0x126')](db['Dynamics365Account'],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xd0')][_0xd1f6('0x119')](db[_0xd1f6('0xd0')],{'as':'Subject','foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0xd0')][_0xd1f6('0x119')](db[_0xd1f6('0xd0')],{'as':_0xd1f6('0x1ca'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xd0')][_0xd1f6('0x119')](db['Dynamics365Field'],{'as':_0xd1f6('0x1cb'),'foreignKey':'FieldId'});db[_0xd1f6('0xd0')]['belongsTo'](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0xd2')][_0xd1f6('0x119')](db[_0xd1f6('0xd3')],{'as':_0xd1f6('0x1c0'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0xd3')]['hasMany'](db[_0xd1f6('0x1d8')],{'as':_0xd1f6('0x1c2'),'foreignKey':_0xd1f6('0x1c3')});db['FreshsalesConfiguration']['hasMany'](db[_0xd1f6('0x1d8')],{'as':_0xd1f6('0x1c4'),'foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0xd3')][_0xd1f6('0x119')](db[_0xd1f6('0x1d8')],{'as':_0xd1f6('0x1bc'),'foreignKey':_0xd1f6('0x1c7')});db[_0xd1f6('0xd3')][_0xd1f6('0x126')](db[_0xd1f6('0xd2')],{'as':'Account','foreignKey':_0xd1f6('0x1c1')});db[_0xd1f6('0x1d8')][_0xd1f6('0x119')](db[_0xd1f6('0x1d8')],{'as':'Subject','foreignKey':_0xd1f6('0x1c3')});db[_0xd1f6('0x1d8')][_0xd1f6('0x119')](db[_0xd1f6('0x1d8')],{'as':'Description','foreignKey':_0xd1f6('0x1c5')});db[_0xd1f6('0x1d8')][_0xd1f6('0x119')](db['FreshsalesField'],{'as':'Field','foreignKey':'FieldId'});db['FreshsalesField'][_0xd1f6('0x126')](db[_0xd1f6('0xa0')],{'as':_0xd1f6('0xa0'),'foreignKey':_0xd1f6('0x1cc')});db[_0xd1f6('0x1d9')]['belongsTo'](db[_0xd1f6('0x6c')],{});db['ChatQueueReport']['belongsTo'](db['CmList'],{'as':_0xd1f6('0x166'),'foreignKey':'ListId'});db[_0xd1f6('0x1d9')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db['ChatQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x71')],{});db[_0xd1f6('0x1d9')][_0xd1f6('0x126')](db[_0xd1f6('0x73')],{});db['ChatQueueReport']['belongsTo'](db['User'],{});db[_0xd1f6('0x1d9')][_0xd1f6('0x126')](db[_0xd1f6('0x193')],{});db[_0xd1f6('0x199')][_0xd1f6('0x126')](db['User'],{'onDelete':'cascade','foreignKey':_0xd1f6('0x1da')});db[_0xd1f6('0x199')]['belongsTo'](db[_0xd1f6('0x116')],{'onDelete':'cascade','foreignKey':_0xd1f6('0x1db')});db['JscriptySessionReport']['hasMany'](db[_0xd1f6('0xda')],{'foreignKey':_0xd1f6('0x1dc'),'onDelete':'cascade'});db[_0xd1f6('0x1dd')][_0xd1f6('0x119')](db['JscriptyAnswerReport'],{'foreignKey':_0xd1f6('0x1dc'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0xdd')][_0xd1f6('0x126')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179')});db['SmsQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db['SmsQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x5f')],{});db['SmsQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x61')],{});db[_0xd1f6('0xdd')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{});db['SmsQueueReport'][_0xd1f6('0x126')](db[_0xd1f6('0x63')],{});db[_0xd1f6('0x1de')][_0xd1f6('0x119')](db[_0xd1f6('0x1dd')],{'foreignKey':_0xd1f6('0x1df')});db[_0xd1f6('0x1de')][_0xd1f6('0x119')](db[_0xd1f6('0xda')],{'foreignKey':'ProjectId'});db[_0xd1f6('0x1de')][_0xd1f6('0x119')](db[_0xd1f6('0xd8')],{'foreignKey':_0xd1f6('0x1df')});db[_0xd1f6('0x140')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Users','through':_0xd1f6('0x142')});db[_0xd1f6('0xe9')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x1e0')});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':_0xd1f6('0x10f'),'as':_0xd1f6('0x1e1')});db[_0xd1f6('0xe9')][_0xd1f6('0x128')](db[_0xd1f6('0x44')],{'through':'team_has_mail_queues','as':_0xd1f6('0x1e2')});db[_0xd1f6('0xe9')]['belongsToMany'](db['ChatQueue'],{'through':_0xd1f6('0x1e3'),'as':'ChatQueues'});db[_0xd1f6('0xe9')]['belongsToMany'](db[_0xd1f6('0x58')],{'through':_0xd1f6('0x184'),'as':_0xd1f6('0x1e4')});db[_0xd1f6('0xe9')]['belongsToMany'](db[_0xd1f6('0x63')],{'through':_0xd1f6('0x18c'),'as':'SmsQueues'});db['Team'][_0xd1f6('0x128')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':_0xd1f6('0x134')});db[_0xd1f6('0xe9')][_0xd1f6('0x128')](db['WhatsappQueue'],{'through':_0xd1f6('0x1e5'),'as':_0xd1f6('0x135')});db[_0xd1f6('0xe9')][_0xd1f6('0x128')](db['VoicePrefix'],{'through':'TeamVoicePrefix','as':'VoicePrefixes'});db[_0xd1f6('0x1a2')][_0xd1f6('0x119')](db[_0xd1f6('0x7d')],{'as':'Hoppers','foreignKey':_0xd1f6('0x1a4')});db['Campaign'][_0xd1f6('0x119')](db['CmHopperFinal'],{'as':_0xd1f6('0x11d'),'foreignKey':'CampaignId'});db[_0xd1f6('0x1a2')][_0xd1f6('0x119')](db[_0xd1f6('0x81')],{'as':_0xd1f6('0x14a'),'foreignKey':_0xd1f6('0x1a4')});db[_0xd1f6('0x1a2')][_0xd1f6('0x119')](db[_0xd1f6('0x7f')],{'as':_0xd1f6('0x14b'),'foreignKey':_0xd1f6('0x1a4')});db[_0xd1f6('0x1a2')][_0xd1f6('0x126')](db[_0xd1f6('0x2e')],{'as':_0xd1f6('0x2e'),'foreignKey':'TrunkId'});db[_0xd1f6('0x1a2')][_0xd1f6('0x126')](db[_0xd1f6('0x2e')],{'as':_0xd1f6('0x14e'),'foreignKey':_0xd1f6('0x14f')});db['Campaign'][_0xd1f6('0x126')](db['Interval'],{'as':'Interval','foreignKey':_0xd1f6('0x188')});db[_0xd1f6('0x1a2')]['belongsTo'](db['SquareProject'],{'as':_0xd1f6('0x140'),'foreignKey':_0xd1f6('0x1e6')});db[_0xd1f6('0x1a2')]['belongsToMany'](db['CmList'],{'as':_0xd1f6('0x1e7'),'through':_0xd1f6('0x1e8')});db[_0xd1f6('0x1a2')][_0xd1f6('0x128')](db[_0xd1f6('0x12b')],{'as':_0xd1f6('0x154'),'through':_0xd1f6('0x1e9')});db[_0xd1f6('0x173')][_0xd1f6('0x126')](db[_0xd1f6('0x74')],{'as':_0xd1f6('0x74'),'foreignKey':_0xd1f6('0x177')});db['MailTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x4a')],{});db['MailTransferReport']['belongsTo'](db['MailInteraction'],{});db[_0xd1f6('0xf1')][_0xd1f6('0x126')](db[_0xd1f6('0x42')],{'foreignKey':'FromMailAccountId','as':_0xd1f6('0x1ea')});db['MailTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':'FromUserId','as':_0xd1f6('0x1eb')});db[_0xd1f6('0xf1')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1ec'),'as':_0xd1f6('0x1ed')});db[_0xd1f6('0xf1')][_0xd1f6('0x126')](db[_0xd1f6('0x44')],{'foreignKey':_0xd1f6('0x1ee'),'as':_0xd1f6('0x1ef')});db[_0xd1f6('0xf1')][_0xd1f6('0x126')](db['MailAccount'],{'foreignKey':_0xd1f6('0x1f0'),'as':_0xd1f6('0x1f1')});db[_0xd1f6('0xf2')][_0xd1f6('0x126')](db['ChatMessage'],{});db[_0xd1f6('0xf2')]['belongsTo'](db['ChatInteraction'],{});db[_0xd1f6('0xf2')][_0xd1f6('0x126')](db[_0xd1f6('0x6c')],{'foreignKey':'FromChatWebsiteId','as':_0xd1f6('0x1ea')});db[_0xd1f6('0xf2')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1f2'),'as':_0xd1f6('0x1eb')});db[_0xd1f6('0xf2')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':'ToUserId','as':_0xd1f6('0x1ed')});db[_0xd1f6('0xf2')][_0xd1f6('0x126')](db[_0xd1f6('0x193')],{'foreignKey':_0xd1f6('0x1f3'),'as':_0xd1f6('0x1ef')});db['ChatTransferReport']['belongsTo'](db[_0xd1f6('0x6c')],{'foreignKey':_0xd1f6('0x1f4'),'as':_0xd1f6('0x1f1')});db[_0xd1f6('0xf4')][_0xd1f6('0x126')](db[_0xd1f6('0x17c')],{});db[_0xd1f6('0xf4')]['belongsTo'](db[_0xd1f6('0x55')],{});db['FaxTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{'foreignKey':_0xd1f6('0x1f5'),'as':'FromAccount'});db[_0xd1f6('0xf4')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1f2'),'as':_0xd1f6('0x1eb')});db[_0xd1f6('0xf4')]['belongsTo'](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1ec'),'as':'ToAgent'});db[_0xd1f6('0xf4')][_0xd1f6('0x126')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0xd1f6('0x1ef')});db[_0xd1f6('0xf4')][_0xd1f6('0x126')](db[_0xd1f6('0x51')],{'foreignKey':_0xd1f6('0x1f6'),'as':_0xd1f6('0x1f1')});db[_0xd1f6('0xf6')]['belongsTo'](db[_0xd1f6('0x68')],{});db['OpenchannelTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x67')],{});db['OpenchannelTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db['OpenchannelTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':'FromUserId','as':_0xd1f6('0x1eb')});db[_0xd1f6('0xf6')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1ec'),'as':_0xd1f6('0x1ed')});db['OpenchannelTransferReport']['belongsTo'](db[_0xd1f6('0x6a')],{'foreignKey':_0xd1f6('0x1f7'),'as':_0xd1f6('0x1ef')});db[_0xd1f6('0xf6')][_0xd1f6('0x126')](db[_0xd1f6('0x13b')],{'foreignKey':_0xd1f6('0x1f8'),'as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db['SmsMessage'],{});db[_0xd1f6('0xf8')][_0xd1f6('0x126')](db['SmsInteraction'],{});db['SmsTransferReport'][_0xd1f6('0x126')](db[_0xd1f6('0x5c')],{'foreignKey':'FromSmsAccountId','as':_0xd1f6('0x1ea')});db['SmsTransferReport']['belongsTo'](db[_0xd1f6('0x116')],{'foreignKey':'FromUserId','as':_0xd1f6('0x1eb')});db[_0xd1f6('0xf8')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1ec'),'as':_0xd1f6('0x1ed')});db[_0xd1f6('0xf8')][_0xd1f6('0x126')](db['SmsQueue'],{'foreignKey':_0xd1f6('0x1f9'),'as':_0xd1f6('0x1ef')});db[_0xd1f6('0xf8')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xd1f6('0x1fa'),'as':_0xd1f6('0x1f1')});db[_0xd1f6('0x12b')][_0xd1f6('0x119')](db[_0xd1f6('0x8b')],{'as':_0xd1f6('0x163'),'foreignKey':_0xd1f6('0x179'),'onDelete':_0xd1f6('0x118')});db['CmList']['hasMany'](db[_0xd1f6('0x85')],{'as':_0xd1f6('0x1fb'),'foreignKey':'ListId'});db['CmList'][_0xd1f6('0x119')](db['CmContact'],{'as':_0xd1f6('0x12a'),'onDelete':_0xd1f6('0x118'),'foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x12b')][_0xd1f6('0x119')](db[_0xd1f6('0x80')],{'as':'HopperFinals','foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x12b')][_0xd1f6('0x119')](db[_0xd1f6('0x81')],{'as':_0xd1f6('0x11e'),'foreignKey':_0xd1f6('0x179')});db['CmList'][_0xd1f6('0x119')](db[_0xd1f6('0x83')],{'as':_0xd1f6('0x83'),'foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x12b')][_0xd1f6('0x128')](db[_0xd1f6('0x1d')],{'as':_0xd1f6('0x1fc'),'through':_0xd1f6('0x151')});db[_0xd1f6('0x12b')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Agents','through':'cm_user_has_lists'});db['VoicePrefix'][_0xd1f6('0x119')](db[_0xd1f6('0x19')],{'as':'Extensions','onDelete':_0xd1f6('0x118')});db[_0xd1f6('0xfb')][_0xd1f6('0x128')](db['User'],{'as':'Agents','through':_0xd1f6('0x131')});db[_0xd1f6('0xfb')][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'through':_0xd1f6('0x1fd'),'as':'Teams'});db[_0xd1f6('0xfd')][_0xd1f6('0x119')](db[_0xd1f6('0x116')],{'as':'Users','foreignKey':_0xd1f6('0x127')});db[_0xd1f6('0xfd')][_0xd1f6('0x119')](db[_0xd1f6('0xff')],{'as':'UserProfileSections','foreignKey':_0xd1f6('0x127'),'onDelete':_0xd1f6('0x118')});db[_0xd1f6('0xff')][_0xd1f6('0x119')](db[_0xd1f6('0x101')],{'as':_0xd1f6('0x1fe'),'foreignKey':'sectionId','onDelete':'cascade'});db[_0xd1f6('0x105')][_0xd1f6('0x119')](db['Disposition'],{'as':_0xd1f6('0x163'),'foreignKey':_0xd1f6('0x1ff'),'onDelete':'cascade'});db[_0xd1f6('0x105')][_0xd1f6('0x119')](db[_0xd1f6('0x164')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xd1f6('0x105')][_0xd1f6('0x119')](db[_0xd1f6('0x200')],{'as':'Messages','foreignKey':_0xd1f6('0x1ff')});db['WhatsappAccount'][_0xd1f6('0x119')](db['WhatsappInteraction'],{'as':_0xd1f6('0x165')});db[_0xd1f6('0x105')]['hasMany'](db[_0xd1f6('0x201')],{'as':'Applications'});db[_0xd1f6('0x105')][_0xd1f6('0x126')](db['CmList'],{'as':_0xd1f6('0x166'),'foreignKey':_0xd1f6('0x179')});db[_0xd1f6('0x105')][_0xd1f6('0x126')](db[_0xd1f6('0x8e')],{'as':'mandatoryDispositionPause','foreignKey':_0xd1f6('0x16a')});db[_0xd1f6('0x105')][_0xd1f6('0x128')](db['User'],{'as':_0xd1f6('0x152'),'through':_0xd1f6('0x13f')});db[_0xd1f6('0x201')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x201')][_0xd1f6('0x126')](db['WhatsappQueue'],{'onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x201')][_0xd1f6('0x126')](db[_0xd1f6('0x105')],{'onDelete':'restrict'});db[_0xd1f6('0x201')]['belongsTo'](db[_0xd1f6('0x150')],{'onDelete':_0xd1f6('0x160'),'foreignKey':'IntervalId'});db[_0xd1f6('0x201')][_0xd1f6('0x126')](db[_0xd1f6('0x16f')],{'onDelete':_0xd1f6('0x160'),'foreignKey':'TagId'});db[_0xd1f6('0x107')][_0xd1f6('0x119')](db['WhatsappMessage'],{'as':_0xd1f6('0x156'),'onDelete':_0xd1f6('0x118'),'foreignKey':'WhatsappInteractionId'});db[_0xd1f6('0x107')][_0xd1f6('0x126')](db[_0xd1f6('0x105')],{'as':_0xd1f6('0x16d'),'foreignKey':_0xd1f6('0x1ff')});db[_0xd1f6('0x107')][_0xd1f6('0x126')](db[_0xd1f6('0x7b')],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x107')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x16e'),'foreignKey':'UserId'});db['WhatsappInteraction']['belongsToMany'](db[_0xd1f6('0x16f')],{'through':_0xd1f6('0x1b2'),'as':_0xd1f6('0x180')});db['WhatsappInteraction']['belongsToMany'](db[_0xd1f6('0x16f')],{'through':'whatsapp_interaction_has_tags','as':_0xd1f6('0x171')});db[_0xd1f6('0x107')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':_0xd1f6('0x181'),'through':_0xd1f6('0x12f'),'foreignKey':_0xd1f6('0x202')});db[_0xd1f6('0x200')][_0xd1f6('0x126')](db['User'],{'as':_0xd1f6('0x116')});db[_0xd1f6('0x200')][_0xd1f6('0x126')](db['CmContact'],{'onDelete':_0xd1f6('0x118'),'as':'Contact'});db[_0xd1f6('0x200')]['belongsTo'](db[_0xd1f6('0x107')],{'onDelete':'cascade','as':_0xd1f6('0x175'),'foreignKey':_0xd1f6('0x202')});db[_0xd1f6('0x200')][_0xd1f6('0x126')](db[_0xd1f6('0x105')],{'as':'Account','foreignKey':_0xd1f6('0x1ff')});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db['WhatsappAccount'],{});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db[_0xd1f6('0x12b')],{'as':'List','foreignKey':'ListId'});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db['CmContact'],{'as':_0xd1f6('0x15c'),'foreignKey':_0xd1f6('0x15d')});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db['WhatsappInteraction'],{});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db[_0xd1f6('0x10b')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xd1f6('0x200')],{});db[_0xd1f6('0x109')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{});db[_0xd1f6('0x10a')][_0xd1f6('0x126')](db[_0xd1f6('0x200')],{});db[_0xd1f6('0x10a')][_0xd1f6('0x126')](db[_0xd1f6('0x107')],{});db[_0xd1f6('0x10a')]['belongsTo'](db[_0xd1f6('0x105')],{'foreignKey':_0xd1f6('0x203'),'as':_0xd1f6('0x1ea')});db[_0xd1f6('0x10a')]['belongsTo'](db[_0xd1f6('0x105')],{'foreignKey':_0xd1f6('0x204'),'as':_0xd1f6('0x1f1')});db[_0xd1f6('0x10a')][_0xd1f6('0x126')](db[_0xd1f6('0x10b')],{'foreignKey':'ToQueueId','as':_0xd1f6('0x1ef')});db[_0xd1f6('0x10a')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':_0xd1f6('0x1f2'),'as':'FromAgent'});db[_0xd1f6('0x10a')][_0xd1f6('0x126')](db[_0xd1f6('0x116')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xd1f6('0x10b')][_0xd1f6('0x128')](db[_0xd1f6('0x116')],{'as':'Agents','through':_0xd1f6('0x205'),'foreignKey':_0xd1f6('0x206')});db[_0xd1f6('0x10b')][_0xd1f6('0x128')](db[_0xd1f6('0xe9')],{'through':_0xd1f6('0x1e5'),'as':_0xd1f6('0x153')});db[_0xd1f6('0x207')]['belongsTo'](db[_0xd1f6('0x116')],{'as':'user','foreignKey':_0xd1f6('0x115'),'onDelete':_0xd1f6('0x118'),'hooks':!![]});db['CloudProvider'][_0xd1f6('0x114')](db['Dynamics365Account'],{'as':'Dynamics365Account','onDelete':_0xd1f6('0x160')});db[_0xd1f6('0x10d')][_0xd1f6('0x114')](db[_0xd1f6('0x3e')],{'as':_0xd1f6('0x161'),'onDelete':_0xd1f6('0x160')});db['CloudProvider'][_0xd1f6('0x114')](db[_0xd1f6('0x40')],{'as':_0xd1f6('0x162'),'onDelete':'restrict'});module[_0xd1f6('0x208')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2f4addd..db05b15 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd743=['/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','/api/teams','./api/license','./api/campaign','./api/migration','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','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','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','./api/tag','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/variables','./api/variable','/api/integrations','/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/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/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/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/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings'];(function(_0x52a857,_0xc99fa1){var _0x4e2aae=function(_0x5410d9){while(--_0x5410d9){_0x52a857['push'](_0x52a857['shift']());}};_0x4e2aae(++_0xc99fa1);}(_0xd743,0x170));var _0x3d74=function(_0x25bab0,_0x4d4860){_0x25bab0=_0x25bab0-0x0;var _0x3392a9=_0xd743[_0x25bab0];return _0x3392a9;};'use strict';var path=require(_0x3d74('0x0'));var express=require(_0x3d74('0x1'));var errors=require(_0x3d74('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x3d74('0x3'))[_0x3d74('0x4')];var clientSideLogs=require(_0x3d74('0x5'));exports[_0x3d74('0x6')]=function(_0x17809a){return setupLoggers(_0x17809a)[_0x3d74('0x7')](function(){_0x17809a[_0x3d74('0x8')](_0x3d74('0x9'),require('./api/user'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa'),require(_0x3d74('0xb')));_0x17809a['use'](_0x3d74('0xc'),require(_0x3d74('0xd')));_0x17809a['use'](_0x3d74('0xe'),require('./api/voiceExtension'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf'),require(_0x3d74('0x10')));_0x17809a[_0x3d74('0x8')]('/api/voice/queues',require(_0x3d74('0x11')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x12'),require('./api/voiceRecording'));_0x17809a['use'](_0x3d74('0x13'),require(_0x3d74('0x14')));_0x17809a['use'](_0x3d74('0x15'),require(_0x3d74('0x16')));_0x17809a[_0x3d74('0x8')]('/api/voice/mails/messages',require(_0x3d74('0x17')));_0x17809a['use'](_0x3d74('0x18'),require(_0x3d74('0x19')));_0x17809a['use'](_0x3d74('0x1a'),require(_0x3d74('0x1b')));_0x17809a['use'](_0x3d74('0x1c'),require(_0x3d74('0x1d')));_0x17809a[_0x3d74('0x8')]('/api/voice/queues/reports',require(_0x3d74('0x1e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x1f'),require(_0x3d74('0x20')));_0x17809a[_0x3d74('0x8')]('/api/trunks',require(_0x3d74('0x21')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x22'),require('./api/voiceTransferReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x23'),require(_0x3d74('0x24')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x25'),require(_0x3d74('0x26')));_0x17809a[_0x3d74('0x8')]('/api/mail/queues',require(_0x3d74('0x27')));_0x17809a[_0x3d74('0x8')]('/api/mail/substatuses',require(_0x3d74('0x28')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x29'),require(_0x3d74('0x2a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2b'),require(_0x3d74('0x2c')));_0x17809a[_0x3d74('0x8')]('/api/mail/applications',require(_0x3d74('0x2d')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2e'),require('./api/mailQueueReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x2f'),require(_0x3d74('0x30')));_0x17809a['use']('/api/dashboards/items',require(_0x3d74('0x31')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x32'),require('./api/faxAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x33'),require(_0x3d74('0x34')));_0x17809a[_0x3d74('0x8')]('/api/fax/interactions',require(_0x3d74('0x35')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x36'),require(_0x3d74('0x37')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x38'),require('./api/faxQueue'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x39'),require(_0x3d74('0x3a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x3b'),require(_0x3d74('0x3c')));_0x17809a[_0x3d74('0x8')]('/api/sms/applications',require(_0x3d74('0x3d')));_0x17809a[_0x3d74('0x8')]('/api/sms/interactions',require('./api/smsInteraction'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x3e'),require(_0x3d74('0x3f')));_0x17809a[_0x3d74('0x8')]('/api/sms/queues',require(_0x3d74('0x40')));_0x17809a['use'](_0x3d74('0x41'),require(_0x3d74('0x42')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x43'),require(_0x3d74('0x44')));_0x17809a[_0x3d74('0x8')]('/api/openchannel/interactions',require(_0x3d74('0x45')));_0x17809a['use'](_0x3d74('0x46'),require(_0x3d74('0x47')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x48'),require(_0x3d74('0x49')));_0x17809a['use'](_0x3d74('0x4a'),require('./api/chatWebsite'));_0x17809a['use'](_0x3d74('0x4b'),require(_0x3d74('0x4c')));_0x17809a[_0x3d74('0x8')]('/api/chat/applications',require(_0x3d74('0x4d')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x4e'),require(_0x3d74('0x4f')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x50'),require('./api/chatMessage'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x51'),require(_0x3d74('0x52')));_0x17809a[_0x3d74('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x53'),require('./api/chatGroup'));_0x17809a['use'](_0x3d74('0x54'),require(_0x3d74('0x55')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x56'),require(_0x3d74('0x57')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x58'),require(_0x3d74('0x59')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x5a'),require('./api/cmHopper'));_0x17809a[_0x3d74('0x8')]('/api/cm/hopper_black',require(_0x3d74('0x5b')));_0x17809a['use'](_0x3d74('0x5c'),require('./api/cmHopperFinal'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x5d'),require('./api/cmHopperHistory'));_0x17809a['use'](_0x3d74('0x5e'),require(_0x3d74('0x5f')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x60'),require(_0x3d74('0x61')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x62'),require(_0x3d74('0x63')));_0x17809a[_0x3d74('0x8')]('/api/canned_answers',require(_0x3d74('0x64')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x65'),require('./api/disposition'));_0x17809a[_0x3d74('0x8')]('/api/conditions',require(_0x3d74('0x66')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x67'),require('./api/interval'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x68'),require(_0x3d74('0x69')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6a'),require(_0x3d74('0x6b')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6c'),require('./api/voiceQueuesLog'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x6d'),require(_0x3d74('0x6e')));_0x17809a[_0x3d74('0x8')]('/api/sounds',require(_0x3d74('0x6f')));_0x17809a['use'](_0x3d74('0x70'),require(_0x3d74('0x71')));_0x17809a[_0x3d74('0x8')]('/api/contact_item_types',require(_0x3d74('0x72')));_0x17809a[_0x3d74('0x8')]('/api/cm_contact_has_items',require(_0x3d74('0x73')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x74'),require(_0x3d74('0x75')));_0x17809a['use']('/api/templates',require(_0x3d74('0x76')));_0x17809a['use']('/api/triggers',require('./api/trigger'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x77'),require(_0x3d74('0x78')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x79'),require('./api/integration'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x7a'),require(_0x3d74('0x7b')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x7c'),require(_0x3d74('0x7d')));_0x17809a['use'](_0x3d74('0x7e'),require(_0x3d74('0x7f')));_0x17809a['use'](_0x3d74('0x80'),require(_0x3d74('0x81')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x82'),require(_0x3d74('0x83')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x84'),require(_0x3d74('0x85')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x86'),require('./api/analyticTreeReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x87'),require(_0x3d74('0x88')));_0x17809a[_0x3d74('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x89'),require(_0x3d74('0x8a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x8b'),require(_0x3d74('0x8c')));_0x17809a['use'](_0x3d74('0x8d'),require(_0x3d74('0x8e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x8f'),require(_0x3d74('0x90')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x91'),require('./api/intDeskAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0x92'),require(_0x3d74('0x93')));_0x17809a[_0x3d74('0x8')]('/api/integrations/desk/fields',require(_0x3d74('0x94')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x95'),require(_0x3d74('0x96')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x97'),require(_0x3d74('0x98')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x99'),require(_0x3d74('0x9a')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9b'),require(_0x3d74('0x9c')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9d'),require(_0x3d74('0x9e')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x9f'),require(_0x3d74('0xa0')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa1'),require('./api/intFreshdeskAccount'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa2'),require(_0x3d74('0xa3')));_0x17809a['use'](_0x3d74('0xa4'),require(_0x3d74('0xa5')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa6'),require(_0x3d74('0xa7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xa8'),require(_0x3d74('0xa9')));_0x17809a['use'](_0x3d74('0xaa'),require(_0x3d74('0xab')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xac'),require(_0x3d74('0xad')));_0x17809a[_0x3d74('0x8')]('/api/integrations/servicenow/configurations',require(_0x3d74('0xae')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xaf'),require(_0x3d74('0xb0')));_0x17809a[_0x3d74('0x8')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb1'),require(_0x3d74('0xb2')));_0x17809a['use']('/api/integrations/dynamics365/fields',require(_0x3d74('0xb3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb4'),require(_0x3d74('0xb5')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb6'),require(_0x3d74('0xb7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb8'),require('./api/intFreshsalesField'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xb9'),require(_0x3d74('0xba')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbb'),require(_0x3d74('0xbc')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbd'),require(_0x3d74('0xbe')));_0x17809a['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xbf'),require('./api/jscriptyQuestionReport'));_0x17809a[_0x3d74('0x8')]('/api/jscripty/sessions/reports',require(_0x3d74('0xc0')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc1'),require(_0x3d74('0xc2')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc3'),require(_0x3d74('0xc4')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc5'),require(_0x3d74('0xc6')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc7'),require(_0x3d74('0xc8')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xc9'),require('./api/setting'));_0x17809a['use'](_0x3d74('0xca'),require(_0x3d74('0xcb')));_0x17809a['use'](_0x3d74('0xcc'),require(_0x3d74('0xcd')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xce'),require('./api/squareRecording'));_0x17809a[_0x3d74('0x8')]('/api/square/messages',require(_0x3d74('0xcf')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd0'),require('./api/team'));_0x17809a['use']('/api/license',require(_0x3d74('0xd1')));_0x17809a[_0x3d74('0x8')]('/api/campaigns',require(_0x3d74('0xd2')));_0x17809a['use']('/api/migrations',require(_0x3d74('0xd3')));_0x17809a[_0x3d74('0x8')]('/api/attachments',require(_0x3d74('0xd4')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd5'),require('./api/plugin'));_0x17809a['use'](_0x3d74('0xd6'),require(_0x3d74('0xd7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xd8'),require(_0x3d74('0xd9')));_0x17809a['use'](_0x3d74('0xda'),require(_0x3d74('0xdb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xdc'),require(_0x3d74('0xdd')));_0x17809a['use'](_0x3d74('0xde'),require(_0x3d74('0xdf')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe0'),require(_0x3d74('0xe1')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe2'),require(_0x3d74('0xe3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe4'),require(_0x3d74('0xe5')));_0x17809a[_0x3d74('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x17809a['use'](_0x3d74('0xe6'),require(_0x3d74('0xe7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe8'),require('./api/userNotification'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xe9'),require(_0x3d74('0xea')));_0x17809a[_0x3d74('0x8')]('/api/whatsapp/applications',require(_0x3d74('0xeb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xec'),require(_0x3d74('0xed')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xee'),require(_0x3d74('0xef')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf0'),require(_0x3d74('0xf1')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf2'),require(_0x3d74('0xf3')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf4'),require(_0x3d74('0xf5')));_0x17809a[_0x3d74('0x8')]('/api/cloudProviders',require(_0x3d74('0xf6')));_0x17809a[_0x3d74('0x8')]('/api/realtime',require(_0x3d74('0xf7')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xf8'),require(_0x3d74('0xf9')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xfa'),require(_0x3d74('0xfb')));_0x17809a[_0x3d74('0x8')](_0x3d74('0xfc'),require(_0x3d74('0xfd')));_0x17809a['use'](_0x3d74('0xfe'),require('./api/authActiveDirectory'));_0x17809a[_0x3d74('0x8')](_0x3d74('0xff'),require(_0x3d74('0x100')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x101'),require(_0x3d74('0x102')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x103'),require(_0x3d74('0x104')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x105'),require(_0x3d74('0x106')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x107'),require(_0x3d74('0x108')));_0x17809a['use'](_0x3d74('0x109'),require(_0x3d74('0x10a')));_0x17809a[_0x3d74('0x8')]('/api/logs',clientSideLogs);_0x17809a['use'](_0x3d74('0x10b'),express[_0x3d74('0x10c')](path[_0x3d74('0x10d')](config['root'],_0x3d74('0x10b'))));_0x17809a['use']('/www',express[_0x3d74('0x10c')](path['join'](config[_0x3d74('0x10e')],_0x3d74('0x10f'))));_0x17809a[_0x3d74('0x8')](_0x3d74('0x110'),express['static'](path[_0x3d74('0x10d')](config[_0x3d74('0x10e')],'/demo')));_0x17809a[_0x3d74('0x8')](_0x3d74('0x111'),express[_0x3d74('0x10c')](path[_0x3d74('0x10d')](config[_0x3d74('0x10e')],_0x3d74('0x112'),_0x3d74('0x113'))));_0x17809a['use'](_0x3d74('0x114'),express[_0x3d74('0x10c')](path['join'](config['root'],_0x3d74('0x115'))));_0x17809a[_0x3d74('0x116')](_0x3d74('0x117'))[_0x3d74('0x118')](errors[0x194]);_0x17809a[_0x3d74('0x116')]('/*')[_0x3d74('0x118')](function(_0xde684e,_0xcf3037){_0xcf3037[_0x3d74('0x119')](path[_0x3d74('0x11a')](_0x17809a[_0x3d74('0x118')](_0x3d74('0x11b'))+_0x3d74('0x11c')));});return _0x17809a;});}; \ No newline at end of file +var _0xeb01=['/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','/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/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','./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/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','/api/jira','./api/jira','/api/rpc','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','static','/apidoc','/www','join','root','/demo','/snippet','snippet','3.0.0','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailApplication','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/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/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/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0xeb01,0x1b0));var _0x1eb0=function(_0x3d655a,_0x1289fe){_0x3d655a=_0x3d655a-0x0;var _0x4dc20b=_0xeb01[_0x3d655a];return _0x4dc20b;};'use strict';var path=require('path');var express=require(_0x1eb0('0x0'));var errors=require(_0x1eb0('0x1'));var config=require(_0x1eb0('0x2'));var setupLoggers=require(_0x1eb0('0x3'))[_0x1eb0('0x4')];var clientSideLogs=require(_0x1eb0('0x5'));exports[_0x1eb0('0x6')]=function(_0x368d17){return setupLoggers(_0x368d17)['then'](function(){_0x368d17['use'](_0x1eb0('0x7'),require(_0x1eb0('0x8')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xa'),require(_0x1eb0('0xb')));_0x368d17[_0x1eb0('0x9')]('/api/voice/contexts',require(_0x1eb0('0xc')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd'),require(_0x1eb0('0xe')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xf'),require(_0x1eb0('0x10')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x11'),require(_0x1eb0('0x12')));_0x368d17['use']('/api/voice/recordings',require(_0x1eb0('0x13')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x14'),require('./api/screenRecording'));_0x368d17[_0x1eb0('0x9')]('/api/voice/mails',require(_0x1eb0('0x15')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x16'),require(_0x1eb0('0x17')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x18'),require('./api/voiceCallReport'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x19'),require(_0x1eb0('0x1a')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x1b'),require(_0x1eb0('0x1c')));_0x368d17['use'](_0x1eb0('0x1d'),require(_0x1eb0('0x1e')));_0x368d17['use']('/api/members/reports',require(_0x1eb0('0x1f')));_0x368d17['use']('/api/trunks',require(_0x1eb0('0x20')));_0x368d17['use'](_0x1eb0('0x21'),require(_0x1eb0('0x22')));_0x368d17['use'](_0x1eb0('0x23'),require(_0x1eb0('0x24')));_0x368d17[_0x1eb0('0x9')]('/api/mail/accounts',require(_0x1eb0('0x25')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x26'),require(_0x1eb0('0x27')));_0x368d17['use'](_0x1eb0('0x28'),require(_0x1eb0('0x29')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x2a'),require(_0x1eb0('0x2b')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x2c'),require(_0x1eb0('0x2d')));_0x368d17[_0x1eb0('0x9')]('/api/mail/applications',require(_0x1eb0('0x2e')));_0x368d17['use']('/api/mail/reports/queue',require(_0x1eb0('0x2f')));_0x368d17[_0x1eb0('0x9')]('/api/dashboards',require(_0x1eb0('0x30')));_0x368d17['use'](_0x1eb0('0x31'),require(_0x1eb0('0x32')));_0x368d17[_0x1eb0('0x9')]('/api/fax/accounts',require(_0x1eb0('0x33')));_0x368d17['use'](_0x1eb0('0x34'),require('./api/faxApplication'));_0x368d17['use'](_0x1eb0('0x35'),require(_0x1eb0('0x36')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x37'),require('./api/faxMessage'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x38'),require(_0x1eb0('0x39')));_0x368d17['use'](_0x1eb0('0x3a'),require(_0x1eb0('0x3b')));_0x368d17['use']('/api/sms/accounts',require('./api/smsAccount'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x3c'),require('./api/smsApplication'));_0x368d17[_0x1eb0('0x9')]('/api/sms/interactions',require(_0x1eb0('0x3d')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x3e'),require(_0x1eb0('0x3f')));_0x368d17[_0x1eb0('0x9')]('/api/sms/queues',require('./api/smsQueue'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x40'),require('./api/openchannelAccount'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x41'),require(_0x1eb0('0x42')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x43'),require('./api/openchannelInteraction'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x44'),require(_0x1eb0('0x45')));_0x368d17['use']('/api/openchannel/queues',require(_0x1eb0('0x46')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x47'),require(_0x1eb0('0x48')));_0x368d17['use'](_0x1eb0('0x49'),require(_0x1eb0('0x4a')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x4b'),require('./api/chatApplication'));_0x368d17['use']('/api/chat/interactions',require(_0x1eb0('0x4c')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x4d'),require(_0x1eb0('0x4e')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x4f'),require(_0x1eb0('0x50')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x51'),require(_0x1eb0('0x52')));_0x368d17['use'](_0x1eb0('0x53'),require(_0x1eb0('0x54')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x55'),require(_0x1eb0('0x56')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x57'),require(_0x1eb0('0x58')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x59'),require('./api/cmContact'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x5a'),require('./api/cmHopper'));_0x368d17[_0x1eb0('0x9')]('/api/cm/hopper_black',require(_0x1eb0('0x5b')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x5c'),require(_0x1eb0('0x5d')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x5e'),require('./api/cmHopperHistory'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x5f'),require(_0x1eb0('0x60')));_0x368d17['use'](_0x1eb0('0x61'),require(_0x1eb0('0x62')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x63'),require(_0x1eb0('0x64')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x65'),require('./api/cannedAnswer'));_0x368d17['use'](_0x1eb0('0x66'),require(_0x1eb0('0x67')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x68'),require('./api/condition'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x69'),require(_0x1eb0('0x6a')));_0x368d17[_0x1eb0('0x9')]('/api/pauses',require('./api/pause'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x6b'),require(_0x1eb0('0x6c')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x6d'),require(_0x1eb0('0x6e')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x6f'),require(_0x1eb0('0x70')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x71'),require(_0x1eb0('0x72')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x73'),require(_0x1eb0('0x74')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x75'),require(_0x1eb0('0x76')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x77'),require(_0x1eb0('0x78')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x79'),require(_0x1eb0('0x7a')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x7b'),require(_0x1eb0('0x7c')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x7d'),require(_0x1eb0('0x7e')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x7f'),require(_0x1eb0('0x80')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x81'),require(_0x1eb0('0x82')));_0x368d17[_0x1eb0('0x9')]('/api/integrations/reports',require(_0x1eb0('0x83')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x84'),require(_0x1eb0('0x85')));_0x368d17['use']('/api/analytics/default_reports',require(_0x1eb0('0x86')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x87'),require('./api/analyticExtractedReport'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x88'),require(_0x1eb0('0x89')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x8a'),require('./api/analyticFieldReport'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x8b'),require(_0x1eb0('0x8c')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x8d'),require('./api/intSalesforceAccount'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x8e'),require(_0x1eb0('0x8f')));_0x368d17[_0x1eb0('0x9')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x90'),require(_0x1eb0('0x91')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x92'),require(_0x1eb0('0x93')));_0x368d17[_0x1eb0('0x9')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x94'),require(_0x1eb0('0x95')));_0x368d17['use'](_0x1eb0('0x96'),require(_0x1eb0('0x97')));_0x368d17[_0x1eb0('0x9')]('/api/integrations/desk/fields',require(_0x1eb0('0x98')));_0x368d17['use'](_0x1eb0('0x99'),require(_0x1eb0('0x9a')));_0x368d17[_0x1eb0('0x9')]('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x9b'),require('./api/intZohoField'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x9c'),require('./api/intZendeskAccount'));_0x368d17['use'](_0x1eb0('0x9d'),require(_0x1eb0('0x9e')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x9f'),require(_0x1eb0('0xa0')));_0x368d17['use'](_0x1eb0('0xa1'),require('./api/intFreshdeskAccount'));_0x368d17['use'](_0x1eb0('0xa2'),require(_0x1eb0('0xa3')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xa4'),require(_0x1eb0('0xa5')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xa6'),require('./api/intVtigerAccount'));_0x368d17[_0x1eb0('0x9')]('/api/integrations/vtiger/configurations',require('./api/intVtigerConfiguration'));_0x368d17[_0x1eb0('0x9')]('/api/integrations/vtiger/fields',require(_0x1eb0('0xa7')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xa8'),require(_0x1eb0('0xa9')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xaa'),require(_0x1eb0('0xab')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xac'),require(_0x1eb0('0xad')));_0x368d17['use']('/api/integrations/dynamics365/accounts',require(_0x1eb0('0xae')));_0x368d17['use']('/api/integrations/dynamics365/configurations',require(_0x1eb0('0xaf')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xb0'),require(_0x1eb0('0xb1')));_0x368d17['use'](_0x1eb0('0xb2'),require(_0x1eb0('0xb3')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xb4'),require(_0x1eb0('0xb5')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xb6'),require(_0x1eb0('0xb7')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xb8'),require(_0x1eb0('0xb9')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xba'),require(_0x1eb0('0xbb')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xbc'),require(_0x1eb0('0xbd')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xbe'),require(_0x1eb0('0xbf')));_0x368d17['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xc0'),require(_0x1eb0('0xc1')));_0x368d17['use'](_0x1eb0('0xc2'),require('./api/smsQueueReport'));_0x368d17[_0x1eb0('0x9')]('/api/square/reports',require(_0x1eb0('0xc3')));_0x368d17['use']('/api/square/details/reports',require(_0x1eb0('0xc4')));_0x368d17['use'](_0x1eb0('0xc5'),require(_0x1eb0('0xc6')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xc7'),require(_0x1eb0('0xc8')));_0x368d17[_0x1eb0('0x9')]('/api/square/odbc',require(_0x1eb0('0xc9')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xca'),require(_0x1eb0('0xcb')));_0x368d17['use'](_0x1eb0('0xcc'),require('./api/squareRecording'));_0x368d17['use'](_0x1eb0('0xcd'),require(_0x1eb0('0xce')));_0x368d17['use']('/api/teams',require(_0x1eb0('0xcf')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd0'),require('./api/license'));_0x368d17[_0x1eb0('0x9')]('/api/campaigns',require(_0x1eb0('0xd1')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd2'),require(_0x1eb0('0xd3')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd4'),require(_0x1eb0('0xd5')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd6'),require(_0x1eb0('0xd7')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd8'),require('./api/mailTransferReport'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xd9'),require(_0x1eb0('0xda')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xdb'),require(_0x1eb0('0xdc')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xdd'),require(_0x1eb0('0xde')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xdf'),require(_0x1eb0('0xe0')));_0x368d17['use'](_0x1eb0('0xe1'),require(_0x1eb0('0xe2')));_0x368d17[_0x1eb0('0x9')]('/api/voice/prefixes',require(_0x1eb0('0xe3')));_0x368d17['use'](_0x1eb0('0xe4'),require('./api/userProfile'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xe5'),require(_0x1eb0('0xe6')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xe7'),require(_0x1eb0('0xe8')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xe9'),require(_0x1eb0('0xea')));_0x368d17[_0x1eb0('0x9')]('/api/whatsapp/accounts',require(_0x1eb0('0xeb')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xec'),require('./api/whatsappApplication'));_0x368d17['use'](_0x1eb0('0xed'),require(_0x1eb0('0xee')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xef'),require(_0x1eb0('0xf0')));_0x368d17['use'](_0x1eb0('0xf1'),require(_0x1eb0('0xf2')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xf3'),require(_0x1eb0('0xf4')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xf5'),require(_0x1eb0('0xf6')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xf7'),require(_0x1eb0('0xf8')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xf9'),require(_0x1eb0('0xfa')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xfb'),require(_0x1eb0('0xfc')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xfd'),require(_0x1eb0('0xfe')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0xff'),require(_0x1eb0('0x100')));_0x368d17['use'](_0x1eb0('0x101'),require('./api/authActiveDirectory'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x102'),require(_0x1eb0('0x103')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x104'),require('./api/rpc'));_0x368d17['use']('/api/version',require('./api/version'));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x105'),require(_0x1eb0('0x106')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x107'),require(_0x1eb0('0x108')));_0x368d17[_0x1eb0('0x9')]('/api/webbar',require(_0x1eb0('0x109')));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x10a'),clientSideLogs);_0x368d17[_0x1eb0('0x9')]('/apidoc',express[_0x1eb0('0x10b')](path['join'](config['root'],_0x1eb0('0x10c'))));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x10d'),express['static'](path[_0x1eb0('0x10e')](config[_0x1eb0('0x10f')],_0x1eb0('0x10d'))));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x110'),express[_0x1eb0('0x10b')](path[_0x1eb0('0x10e')](config['root'],_0x1eb0('0x110'))));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x111'),express['static'](path[_0x1eb0('0x10e')](config[_0x1eb0('0x10f')],_0x1eb0('0x112'),_0x1eb0('0x113'))));_0x368d17[_0x1eb0('0x9')](_0x1eb0('0x114'),express[_0x1eb0('0x10b')](path[_0x1eb0('0x10e')](config['root'],_0x1eb0('0x115'))));_0x368d17[_0x1eb0('0x116')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x1eb0('0x117')](errors[0x194]);_0x368d17[_0x1eb0('0x116')]('/*')[_0x1eb0('0x117')](function(_0x2ccea5,_0x45dc31){_0x45dc31[_0x1eb0('0x118')](path[_0x1eb0('0x119')](_0x368d17[_0x1eb0('0x117')](_0x1eb0('0x11a'))+_0x1eb0('0x11b')));});return _0x368d17;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 3457a63..fa391a5 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x07b5=['server','http','port','rpc','localhost','error','listen','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x35727b,_0x3a93ad){var _0x1e7e2d=function(_0x439a61){while(--_0x439a61){_0x35727b['push'](_0x35727b['shift']());}};_0x1e7e2d(++_0x3a93ad);}(_0x07b5,0x1ed));var _0x507b=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x07b5[_0x2070da];return _0x4f9fe1;};'use strict';var jayson=require(_0x507b('0x0'));var _=require('lodash');var config=require(_0x507b('0x1'));exports['listen']=function(){return new Promise(function(_0x36fa86,_0x55ec4e){var _0x7ec702={};_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x3')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x4')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x5')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x6')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x7')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x8')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x9')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/memberReport/memberReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xa')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xb')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/mailServerIn/mailServerIn.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xc')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0xd')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xe')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0xf')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x10')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x11')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x12')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x13')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x14')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x15')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x16')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/smsAccount/smsAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/smsInteraction/smsInteraction.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x17')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x18')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x19')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1a')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1b')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x1c')));_0x7ec702=_['merge'](_0x7ec702,require('../api/chatInteraction/chatInteraction.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1d')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1e')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/cmContact/cmContact.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x1f')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x20')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x21')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x22')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x23')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/interval/interval.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/pause/pause.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x24')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x25')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x26')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x27')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x28')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x29')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2a')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2b')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2c')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2d')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x2e')));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x2f')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x30')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/squareReport/squareReport.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x31')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x32')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x33')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x34')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/squareRecording/squareRecording.rpc'));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x35')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x36')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require('../api/attachment/attachment.rpc'));_0x7ec702=_['merge'](_0x7ec702,require('../api/plugin/plugin.rpc'));_0x7ec702=_['merge'](_0x7ec702,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x7ec702=_['merge'](_0x7ec702,require(_0x507b('0x37')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x38')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x39')));_0x7ec702=_[_0x507b('0x2')](_0x7ec702,require(_0x507b('0x3a')));var _0xf4aa3b=jayson[_0x507b('0x3b')](_0x7ec702)[_0x507b('0x3c')]();var _0x378ad7=config['rpc'][_0x507b('0x3d')]||config[_0x507b('0x3d')]+0x1;var _0x4b5e55=config[_0x507b('0x3e')]['ip']||_0x507b('0x3f');_0xf4aa3b['on'](_0x507b('0x40'),function(_0x524296){return _0x55ec4e(_0x524296);});_0xf4aa3b[_0x507b('0x41')](_0x378ad7,_0x4b5e55,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x4b5e55,_0x378ad7);require(_0x507b('0x42'))[_0x507b('0x43')]();return _0x36fa86(_0x507b('0x44')+_0x4b5e55+':'+_0x378ad7);});});}; \ No newline at end of file +var _0x1f7f=['../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/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/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','port','rpc','error','log','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x5de7f2,_0x358f95){var _0x1095d3=function(_0xc6093c){while(--_0xc6093c){_0x5de7f2['push'](_0x5de7f2['shift']());}};_0x1095d3(++_0x358f95);}(_0x1f7f,0x1f3));var _0xf1f7=function(_0x323430,_0x3d2b6d){_0x323430=_0x323430-0x0;var _0x9eecd1=_0x1f7f[_0x323430];return _0x9eecd1;};'use strict';var jayson=require(_0xf1f7('0x0'));var _=require(_0xf1f7('0x1'));var config=require(_0xf1f7('0x2'));exports[_0xf1f7('0x3')]=function(){return new Promise(function(_0x3dd7b9,_0x56cf27){var _0x48c1c3={};_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/user/user.rpc'));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x5')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x6')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x7')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x8')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x9')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0xa')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0xb')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0xc')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0xd')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0xe')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0xf')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/mailAccount/mailAccount.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/mailQueue/mailQueue.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x10')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x11')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x12')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x13')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x14')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x15')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x16')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x17')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/faxQueue/faxQueue.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x18')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x19')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x1a')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x1b')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x1c')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x1d')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x1e')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x1f')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x20')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x21')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x22')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x23')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x24')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x25')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x26')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x27')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x28')));_0x48c1c3=_['merge'](_0x48c1c3,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/interval/interval.rpc'));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x29')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x2a')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x2b')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x2c')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x2d')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x2e')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x2f')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x30')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x31')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x32')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x33')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x34')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x35')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x36')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x37')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x38')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x39')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x3a')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x3b')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x3c')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x3d')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/squareRecording/squareRecording.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x3e')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/campaign/campaign.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x3f')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x40')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x41')));_0x48c1c3=_['merge'](_0x48c1c3,require(_0xf1f7('0x42')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x43')));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x48c1c3=_[_0xf1f7('0x4')](_0x48c1c3,require(_0xf1f7('0x44')));var _0x475cf4=jayson['server'](_0x48c1c3)['http']();var _0x14d17d=config['rpc']['port']||config[_0xf1f7('0x45')]+0x1;var _0x5399c3=config[_0xf1f7('0x46')]['ip']||'localhost';_0x475cf4['on'](_0xf1f7('0x47'),function(_0x39bb27){return _0x56cf27(_0x39bb27);});_0x475cf4[_0xf1f7('0x3')](_0x14d17d,_0x5399c3,function(){console[_0xf1f7('0x48')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5399c3,_0x14d17d);require(_0xf1f7('0x49'))[_0xf1f7('0x4a')]();return _0x3dd7b9('RPC\x20listening\x20on\x20'+_0x5399c3+':'+_0x14d17d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 67bedfd..909a087 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 _0x507b=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','exec','AGI','WAIT','label','exports','lodash','EventEmitter','./reply','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','prototype','sendRequest','sync','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','getVariable'];(function(_0x1a1683,_0xb6dc22){var _0x7b42d1=function(_0x45d0bb){while(--_0x45d0bb){_0x1a1683['push'](_0x1a1683['shift']());}};_0x7b42d1(++_0xb6dc22);}(_0x507b,0x187));var _0xb507=function(_0x48c4b0,_0x6dfcba){_0x48c4b0=_0x48c4b0-0x0;var _0x1bfc9e=_0x507b[_0x48c4b0];return _0x1bfc9e;};'use strict';var util=require('util');var _=require(_0xb507('0x0'));var EventEmitter=require('events')[_0xb507('0x1')];var AGIReply=require(_0xb507('0x2'));var AGIError=require('./error');function AGIChannel(_0x3d0eb2){var _0x4a9af=this,_0xda9de6=new AGIReply(),_0x2a81c4=![],_0x3909b3={};EventEmitter['call'](_0x4a9af);_0x3d0eb2[_0xb507('0x3')](_0xb507('0x4'));_0x3d0eb2[_0xb507('0x5')](0x8*0x3c*0x3c*0x3e8);_0xda9de6[_0xb507('0x3')](_0xb507('0x4'));_0xda9de6['on'](_0xb507('0x6'),function(_0x2cfe10){for(var _0x1637c4 in _0x2cfe10){_0x4a9af[_0x1637c4]=_0x2cfe10[_0x1637c4];}_0x4a9af[_0xb507('0x7')](_0xb507('0x8'));});_0xda9de6['on'](_0xb507('0x9'),function(_0x2169b1){if(_0x2169b1[_0xb507('0xa')]()==_0xb507('0xb')){_0x4a9af[_0xb507('0x7')](_0xb507('0xb'));return;}if(_0x2169b1[_0xb507('0xc')](0x0,0xb)=='520-Invalid'){_0x2a81c4=!![];}if(_0x2a81c4){_0x3909b3['rx']+=_0x2169b1+'\x0a';if(_0x2169b1[_0xb507('0xd')](_0xb507('0xe'))!=-0x1){_0x2a81c4=![];}}else{_0x3909b3['rx']=_0x2169b1;}if(_0x2a81c4){return;}if(typeof _0x3909b3['cb']==_0xb507('0xf')){var _0x21e1bf=_0x3909b3['rx']['substring'](0x0,0x3),_0x44d796=null,_0x147ce8=null;_0x21e1bf=parseInt(_0x21e1bf);if(isNaN(_0x21e1bf)){_0x3909b3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xb507('0x10')});return;}if(_0x21e1bf!=0xc8){_0x3909b3['cb'](null,{'code':_0x21e1bf,'result':-0x1,'extra':'KO'});return;}_0x44d796=_0x3909b3['rx']['substring'](0x4)['replace']('result=','');if(_0x44d796[_0xb507('0x11')]('\x20')!=-0x1){_0x44d796=_0x44d796[_0xb507('0x12')](0x0,_0x44d796['indexOf']('\x20'));}if(_[_0xb507('0x13')](_0x44d796,'-1')){_0x44d796=parseInt(_0x44d796);}_0x147ce8=_0x3909b3['rx'][_0xb507('0x14')]('\x20');if(_0x147ce8['length']==0x3){_0x147ce8=_0x147ce8[0x2][_0xb507('0xc')](0x1,_0x147ce8[0x2][_0xb507('0x15')]-0x1);}else if(_0x147ce8[_0xb507('0x15')]>0x3){var _0x186cb9=/\((.+)\)/;var _0x13546b=_0x3909b3['rx'][_0xb507('0x16')](_0x186cb9);if(_0x13546b){_0x147ce8=_0x13546b[0x1];}else{_0x147ce8=null;}}else{_0x147ce8=null;}_0x3909b3['cb'](null,{'code':_0x21e1bf,'result':_0x44d796,'extra':_0x147ce8});}});_0x3d0eb2['on'](_0xb507('0x17'),function(_0xd6e7e2){_0x4a9af[_0xb507('0x7')](_0xb507('0x17'),new AGIError(_0xb507('0x18'),_0xd6e7e2[_0xb507('0x19')]));});_0x3d0eb2['on'](_0xb507('0x1a'),function(){_0x4a9af[_0xb507('0x7')](_0xb507('0x1a'),new AGIError(_0xb507('0x1b')));});_0x3d0eb2['on']('timeout',function(){_0x4a9af[_0xb507('0x7')]('timeout',new AGIError(_0xb507('0x1c')));_0x3d0eb2[_0xb507('0x1d')]();});_0x3d0eb2[_0xb507('0x1e')](_0xda9de6);this[_0xb507('0x1f')]=function(_0x2e1327,_0x3dd97a){var _0x2e1327=_0x2e1327||'',_0x3dd97a=typeof _0x3dd97a==_0xb507('0xf')?_0x3dd97a:new Function();_0x3909b3={'tx':_0x2e1327,'rx':'','cb':_0x3dd97a};_0x3d0eb2[_0xb507('0x20')](_0x2e1327+'\x0a');},this[_0xb507('0x1a')]=function(){_0x3d0eb2[_0xb507('0x1d')]();};}util['inherits'](AGIChannel,EventEmitter);AGIChannel[_0xb507('0x21')][_0xb507('0x22')]=function(_0x31f130){return this[_0xb507('0x1f')][_0xb507('0x23')](this,_0x31f130);};AGIChannel[_0xb507('0x21')]['answer']=function(){return this['sendRequest'](_0xb507('0x24'));};AGIChannel[_0xb507('0x21')][_0xb507('0x25')]=function(_0x515caa,_0x3d6a18,_0x5150a8){_0x515caa=_0x515caa===undefined?_0xb507('0x26'):_0x515caa;_0x3d6a18=_0x3d6a18===undefined?'5':_0x3d6a18;_0x5150a8=_0x5150a8===undefined?'1':_0x5150a8;return this['sendRequest'](util[_0xb507('0x27')](_0xb507('0x28'),_0x515caa,_0x3d6a18*0x3e8,_0x5150a8));};AGIChannel[_0xb507('0x21')][_0xb507('0x29')]=function(_0x52a703){_0x52a703=_0x52a703||'NO\x20MESSAGE';return this['sendRequest'](util[_0xb507('0x27')](_0xb507('0x2a'),_0x52a703));};AGIChannel[_0xb507('0x21')]['exec']=function(_0x254e1e,_0x51288a){if(_['isArray'](_0x51288a)){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x2b'),_0x254e1e,_0x51288a[_0xb507('0x2c')](',')));}return this['sendRequest'](util['format'](_0xb507('0x2b'),_0x254e1e,_0x51288a));};AGIChannel['prototype'][_0xb507('0x2d')]=function(_0x458db2){return this[_0xb507('0x22')](util['format'](_0xb507('0x2e'),_0x458db2));};AGIChannel[_0xb507('0x21')][_0xb507('0x2f')]=function(_0x1196ab){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x30'),_0x1196ab));};AGIChannel[_0xb507('0x21')][_0xb507('0x31')]=function(_0x429d9b){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x32'),_0x429d9b));};AGIChannel[_0xb507('0x21')]['hangup']=function(){return this[_0xb507('0x22')]('HANGUP');};AGIChannel[_0xb507('0x21')]['setVariable']=function(_0x1280ef,_0x260efc){var _0x2f52ed=_[_0xb507('0x33')](_0x260efc)||_[_0xb507('0x34')](_0x260efc)?_0x260efc['toString']():_0x260efc;return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x35'),_0x1280ef,_0x2f52ed?_0x2f52ed[_0xb507('0x36')]()[_0xb507('0x37')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xb507('0x38')]=function(_0x5c8bbb,_0x4003b9){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x39'),_0x5c8bbb,_0x4003b9));};AGIChannel[_0xb507('0x21')][_0xb507('0x3a')]=function(_0x12e0ef,_0x1d2051){return this[_0xb507('0x22')](util['format'](_0xb507('0x3b'),_0x12e0ef,_0x1d2051));};AGIChannel[_0xb507('0x21')][_0xb507('0x3c')]=function(_0x9a4397,_0x59132c){return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x3d'),_0x9a4397,_0x59132c));};AGIChannel[_0xb507('0x21')][_0xb507('0x3e')]=function(_0x37b71e,_0x588a4d,_0xd5db41){_0x588a4d=_0x588a4d||this[_0xb507('0x3f')];_0xd5db41=_0xd5db41||0x1;this[_0xb507('0x2d')](_0x37b71e);this['setExtension'](_0x588a4d);this[_0xb507('0x31')](_0xd5db41);return this['noop'](util[_0xb507('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x37b71e,_0x588a4d,_0xd5db41));};AGIChannel[_0xb507('0x21')][_0xb507('0x40')]=function(_0x24f6cd){return this[_0xb507('0x22')](util['format'](_0xb507('0x41'),_0x24f6cd));};AGIChannel['prototype'][_0xb507('0x42')]=function(_0x219edc,_0x5766de,_0x2ac412,_0x1388ab,_0x1d38ff,_0x57ef4a){_0x5766de=_0x5766de||_0xb507('0x43');_0x2ac412=_0x2ac412||'';_0x1388ab=_0x1388ab===undefined?-0x1:_0x1388ab==='-1'?-0x1:_0x1388ab*0x3e8;_0x1d38ff=_0x1d38ff===undefined?'':'s='+_0x1d38ff;_0x57ef4a=_0x57ef4a?_0xb507('0x44'):'';return this[_0xb507('0x22')](util[_0xb507('0x27')](_0xb507('0x45'),_0x219edc,_0x5766de,_0x2ac412,_0x1388ab,_0x57ef4a,_0x1d38ff));};AGIChannel[_0xb507('0x21')]['streamFile']=function(_0x330e42,_0x4e0216){_0x4e0216=_0x4e0216||'';return this[_0xb507('0x22')](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x330e42,_0x4e0216));};AGIChannel[_0xb507('0x21')][_0xb507('0x46')]=function(_0xd1b4bf){return this[_0xb507('0x47')](_0xb507('0x48'),_0xd1b4bf);};AGIChannel[_0xb507('0x21')]['wait']=function(_0x51a564){return this['exec'](_0xb507('0x49'),_0x51a564);};AGIChannel[_0xb507('0x21')]['error']=function(_0x38a490,_0x21080e){this[_0xb507('0x29')](util[_0xb507('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x38a490['id'],_0x38a490[_0xb507('0x4a')],_0x21080e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xb507('0x4b')]=AGIChannel; \ No newline at end of file +var _0x293a=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','streamFile','agi','AGI','wait','WAIT','label','exports','util','lodash','events','./error','call','utf8','setEncoding','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','substr','indexOf','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','sync','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','prototype','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','GOTO\x20%s\x20%s\x20%s'];(function(_0x4baae3,_0x5f0235){var _0x454819=function(_0x4359ff){while(--_0x4359ff){_0x4baae3['push'](_0x4baae3['shift']());}};_0x454819(++_0x5f0235);}(_0x293a,0xa6));var _0xa293=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x293a[_0x27604f];return _0x40d189;};'use strict';var util=require(_0xa293('0x0'));var _=require(_0xa293('0x1'));var EventEmitter=require(_0xa293('0x2'))['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xa293('0x3'));function AGIChannel(_0x2b7402){var _0x1a971f=this,_0x1bb168=new AGIReply(),_0x406ec1=![],_0x2626cf={};EventEmitter[_0xa293('0x4')](_0x1a971f);_0x2b7402['setEncoding'](_0xa293('0x5'));_0x2b7402['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x1bb168[_0xa293('0x6')]('utf8');_0x1bb168['on'](_0xa293('0x7'),function(_0x502d43){for(var _0x39257f in _0x502d43){_0x1a971f[_0x39257f]=_0x502d43[_0x39257f];}_0x1a971f[_0xa293('0x8')](_0xa293('0x9'));});_0x1bb168['on'](_0xa293('0xa'),function(_0x26dd91){if(_0x26dd91[_0xa293('0xb')]()=='hangup'){_0x1a971f[_0xa293('0x8')](_0xa293('0xc'));return;}if(_0x26dd91[_0xa293('0xd')](0x0,0xb)==_0xa293('0xe')){_0x406ec1=!![];}if(_0x406ec1){_0x2626cf['rx']+=_0x26dd91+'\x0a';if(_0x26dd91[_0xa293('0xf')]('520\x20End\x20of\x20proper')!=-0x1){_0x406ec1=![];}}else{_0x2626cf['rx']=_0x26dd91;}if(_0x406ec1){return;}if(typeof _0x2626cf['cb']==_0xa293('0x10')){var _0x42edf3=_0x2626cf['rx']['substring'](0x0,0x3),_0x5917c3=null,_0x53d3da=null;_0x42edf3=parseInt(_0x42edf3);if(isNaN(_0x42edf3)){_0x2626cf['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x42edf3!=0xc8){_0x2626cf['cb'](null,{'code':_0x42edf3,'result':-0x1,'extra':'KO'});return;}_0x5917c3=_0x2626cf['rx'][_0xa293('0xd')](0x4)[_0xa293('0x11')](_0xa293('0x12'),'');if(_0x5917c3['indexOf']('\x20')!=-0x1){_0x5917c3=_0x5917c3[_0xa293('0x13')](0x0,_0x5917c3[_0xa293('0x14')]('\x20'));}if(_['startsWith'](_0x5917c3,'-1')){_0x5917c3=parseInt(_0x5917c3);}_0x53d3da=_0x2626cf['rx'][_0xa293('0x15')]('\x20');if(_0x53d3da[_0xa293('0x16')]==0x3){_0x53d3da=_0x53d3da[0x2][_0xa293('0xd')](0x1,_0x53d3da[0x2][_0xa293('0x16')]-0x1);}else if(_0x53d3da['length']>0x3){var _0x2f784b=/\((.+)\)/;var _0x167637=_0x2626cf['rx']['match'](_0x2f784b);if(_0x167637){_0x53d3da=_0x167637[0x1];}else{_0x53d3da=null;}}else{_0x53d3da=null;}_0x2626cf['cb'](null,{'code':_0x42edf3,'result':_0x5917c3,'extra':_0x53d3da});}});_0x2b7402['on'](_0xa293('0x17'),function(_0xe69020){_0x1a971f['emit'](_0xa293('0x17'),new AGIError(_0xa293('0x18'),_0xe69020[_0xa293('0x19')]));});_0x2b7402['on'](_0xa293('0x1a'),function(){_0x1a971f['emit']('close',new AGIError(_0xa293('0x1b')));});_0x2b7402['on']('timeout',function(){_0x1a971f[_0xa293('0x8')](_0xa293('0x1c'),new AGIError(_0xa293('0x1d')));_0x2b7402['destroy']();});_0x2b7402[_0xa293('0x1e')](_0x1bb168);this[_0xa293('0x1f')]=function(_0x14c4a4,_0x4a72e4){var _0x14c4a4=_0x14c4a4||'',_0x4a72e4=typeof _0x4a72e4==_0xa293('0x10')?_0x4a72e4:new Function();_0x2626cf={'tx':_0x14c4a4,'rx':'','cb':_0x4a72e4};_0x2b7402[_0xa293('0x20')](_0x14c4a4+'\x0a');},this['close']=function(){_0x2b7402['destroy']();};}util[_0xa293('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype']['sendRequest']=function(_0x2af68b){return this[_0xa293('0x1f')][_0xa293('0x22')](this,_0x2af68b);};AGIChannel['prototype'][_0xa293('0x23')]=function(){return this[_0xa293('0x24')](_0xa293('0x25'));};AGIChannel['prototype'][_0xa293('0x26')]=function(_0x6725e4,_0x384f24,_0x229e95){_0x6725e4=_0x6725e4===undefined?_0xa293('0x27'):_0x6725e4;_0x384f24=_0x384f24===undefined?'5':_0x384f24;_0x229e95=_0x229e95===undefined?'1':_0x229e95;return this['sendRequest'](util[_0xa293('0x28')](_0xa293('0x29'),_0x6725e4,_0x384f24*0x3e8,_0x229e95));};AGIChannel[_0xa293('0x2a')][_0xa293('0x2b')]=function(_0x250edd){_0x250edd=_0x250edd||_0xa293('0x2c');return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x2d'),_0x250edd));};AGIChannel[_0xa293('0x2a')][_0xa293('0x2e')]=function(_0x484b8f,_0x3e44dd){if(_[_0xa293('0x2f')](_0x3e44dd)){return this['sendRequest'](util['format'](_0xa293('0x30'),_0x484b8f,_0x3e44dd[_0xa293('0x31')](',')));}return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x30'),_0x484b8f,_0x3e44dd));};AGIChannel['prototype'][_0xa293('0x32')]=function(_0x3d0089){return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x33'),_0x3d0089));};AGIChannel[_0xa293('0x2a')]['setExtension']=function(_0x171a1b){return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x34'),_0x171a1b));};AGIChannel[_0xa293('0x2a')][_0xa293('0x35')]=function(_0x35bfa6){return this[_0xa293('0x24')](util['format'](_0xa293('0x36'),_0x35bfa6));};AGIChannel[_0xa293('0x2a')][_0xa293('0xc')]=function(){return this[_0xa293('0x24')](_0xa293('0x37'));};AGIChannel[_0xa293('0x2a')][_0xa293('0x38')]=function(_0x1e4d76,_0x520032){var _0x54924a=_[_0xa293('0x39')](_0x520032)||_[_0xa293('0x3a')](_0x520032)?_0x520032['toString']():_0x520032;return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x3b'),_0x1e4d76,_0x54924a?_0x54924a['toString']()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa293('0x2a')][_0xa293('0x3c')]=function(_0xed3a8b,_0x4c53d2){return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x3d'),_0xed3a8b,_0x4c53d2));};AGIChannel[_0xa293('0x2a')]['sayDigits']=function(_0x488b31,_0x4a280e){return this[_0xa293('0x24')](util['format'](_0xa293('0x3e'),_0x488b31,_0x4a280e));};AGIChannel['prototype'][_0xa293('0x3f')]=function(_0x19aa40,_0x34489d){return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x40'),_0x19aa40,_0x34489d));};AGIChannel[_0xa293('0x2a')][_0xa293('0x41')]=function(_0x2b0120,_0x50a472,_0x552ea1){_0x50a472=_0x50a472||this['extension'];_0x552ea1=_0x552ea1||0x1;this[_0xa293('0x32')](_0x2b0120);this[_0xa293('0x42')](_0x50a472);this[_0xa293('0x35')](_0x552ea1);return this['noop'](util['format'](_0xa293('0x43'),_0x2b0120,_0x50a472,_0x552ea1));};AGIChannel[_0xa293('0x2a')]['getVariable']=function(_0x53b809){return this[_0xa293('0x24')](util[_0xa293('0x28')](_0xa293('0x44'),_0x53b809));};AGIChannel[_0xa293('0x2a')][_0xa293('0x45')]=function(_0x5c9d91,_0x57cb03,_0x48a346,_0x94da80,_0x3cc3a8,_0x425a95){_0x57cb03=_0x57cb03||'wav';_0x48a346=_0x48a346||'';_0x94da80=_0x94da80===undefined?-0x1:_0x94da80==='-1'?-0x1:_0x94da80*0x3e8;_0x3cc3a8=_0x3cc3a8===undefined?'':'s='+_0x3cc3a8;_0x425a95=_0x425a95?_0xa293('0x46'):'';return this[_0xa293('0x24')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5c9d91,_0x57cb03,_0x48a346,_0x94da80,_0x425a95,_0x3cc3a8));};AGIChannel[_0xa293('0x2a')][_0xa293('0x47')]=function(_0xca8f7c,_0xcf7d2e){_0xcf7d2e=_0xcf7d2e||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0xca8f7c,_0xcf7d2e));};AGIChannel[_0xa293('0x2a')][_0xa293('0x48')]=function(_0x250721){return this[_0xa293('0x2e')](_0xa293('0x49'),_0x250721);};AGIChannel[_0xa293('0x2a')][_0xa293('0x4a')]=function(_0x1597c7){return this[_0xa293('0x2e')](_0xa293('0x4b'),_0x1597c7);};AGIChannel[_0xa293('0x2a')][_0xa293('0x17')]=function(_0x392040,_0x411e6c){this['noop'](util[_0xa293('0x28')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x392040['id'],_0x392040[_0xa293('0x4c')],_0x411e6c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa293('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index ce28bf4..0c85ed7 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 _0x8603=['util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports'];(function(_0x2e189a,_0x51bd30){var _0x446416=function(_0x2fdcbe){while(--_0x2fdcbe){_0x2e189a['push'](_0x2e189a['shift']());}};_0x446416(++_0x51bd30);}(_0x8603,0x1d1));var _0x3860=function(_0x469ed3,_0x3c1e7b){_0x469ed3=_0x469ed3-0x0;var _0x11dff4=_0x8603[_0x469ed3];return _0x11dff4;};'use strict';var util=require(_0x3860('0x0'));var error={'E_AGI_UNDEFINED':_0x3860('0x1'),'E_AGI_ARGUMENT_PORT':_0x3860('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x3860('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x3860('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x3860('0x5'),'E_AGI_COMMAND_EMPTY':_0x3860('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x3860('0x7')};function AGIError(_0x167994){var _0x167994=_0x167994||null,_0x21b20f=_0x21b20f||[],_0x57bb74=0x1,_0x90419d='';if(!error[_0x167994]){_0x167994=_0x3860('0x8');}_0x21b20f[_0x3860('0x9')](error[_0x167994]);while(arguments[_0x57bb74]){_0x21b20f['push'](arguments[_0x57bb74]);_0x57bb74++;}_0x90419d=util[_0x3860('0xa')][_0x3860('0xb')](util,_0x21b20f);this[_0x3860('0xc')]=_0x90419d;this[_0x3860('0xd')]=_0x167994;}module[_0x3860('0xe')]=AGIError; \ No newline at end of file +var _0x8a47=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x8a47,0xe6));var _0x78a4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8a47[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x78a4('0x0'));var error={'E_AGI_UNDEFINED':_0x78a4('0x1'),'E_AGI_ARGUMENT_PORT':_0x78a4('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x78a4('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x78a4('0x4'),'E_AGI_SOCKET_ERROR':_0x78a4('0x5'),'E_AGI_SOCKET_CLOSE':_0x78a4('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x78a4('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x78a4('0x8'),'E_AGI_IVR_ENTRY':_0x78a4('0x9')};function AGIError(_0x41dc6f){var _0x41dc6f=_0x41dc6f||null,_0x43bad5=_0x43bad5||[],_0x5349c7=0x1,_0x18bdb3='';if(!error[_0x41dc6f]){_0x41dc6f='E_AGI_UNDEFINED';}_0x43bad5[_0x78a4('0xa')](error[_0x41dc6f]);while(arguments[_0x5349c7]){_0x43bad5[_0x78a4('0xa')](arguments[_0x5349c7]);_0x5349c7++;}_0x18bdb3=util[_0x78a4('0xb')]['apply'](util,_0x43bad5);this['message']=_0x18bdb3;this[_0x78a4('0xc')]=_0x41dc6f;}module[_0x78a4('0xd')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f15e582..f8a0f7d 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6ed=['error','message','emit','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi'];(function(_0x2afce3,_0x1e99fa){var _0x1c88d8=function(_0x57902d){while(--_0x57902d){_0x2afce3['push'](_0x2afce3['shift']());}};_0x1c88d8(++_0x1e99fa);}(_0xf6ed,0x196));var _0xdf6e=function(_0x48ef7c,_0x29c5b8){_0x48ef7c=_0x48ef7c-0x0;var _0x2a5967=_0xf6ed[_0x48ef7c];return _0x2a5967;};'use strict';var _=require(_0xdf6e('0x0'));var EventEmitter=require(_0xdf6e('0x1'))[_0xdf6e('0x2')];var Redis=require(_0xdf6e('0x3'));var AGIError=require(_0xdf6e('0x4'));var config=require(_0xdf6e('0x5'));config[_0xdf6e('0x6')]=_['defaults'](config[_0xdf6e('0x6')],{'host':_0xdf6e('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xdf6e('0x6')]);sub[_0xdf6e('0x8')](_0xdf6e('0x9'),function(_0x459bb3){if(_0x459bb3)return eventEmitter['emit'](_0xdf6e('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x459bb3));});sub['on'](_0xdf6e('0xb'),function(_0x3c0a90,_0x3e2611){if(_0x3c0a90!==_0xdf6e('0x9'))return;try{var _0x2623f0=JSON['parse'](_0x3e2611);eventEmitter[_0xdf6e('0xc')](_0xdf6e('0xd'),_0x2623f0);}catch(_0xfb3969){eventEmitter[_0xdf6e('0xc')](_0xdf6e('0xa'),new AGIError(_0xdf6e('0xe'),_0xfb3969));}});module[_0xdf6e('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x7248=['emit','error','message','parse','projectUpdate','E_AGI_SERVER_ERROR','exports','lodash','EventEmitter','ioredis','./error','../../config/environment','defaults','redis','subscribe','agi'];(function(_0x40b66c,_0x5c1d58){var _0x159671=function(_0x17a129){while(--_0x17a129){_0x40b66c['push'](_0x40b66c['shift']());}};_0x159671(++_0x5c1d58);}(_0x7248,0x117));var _0x8724=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x7248[_0x314a8c];return _0x1d4607;};'use strict';var _=require(_0x8724('0x0'));var EventEmitter=require('events')[_0x8724('0x1')];var Redis=require(_0x8724('0x2'));var AGIError=require(_0x8724('0x3'));var config=require(_0x8724('0x4'));config['redis']=_[_0x8724('0x5')](config[_0x8724('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x8724('0x6')]);sub[_0x8724('0x7')](_0x8724('0x8'),function(_0x3dd117){if(_0x3dd117)return eventEmitter[_0x8724('0x9')](_0x8724('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x3dd117));});sub['on'](_0x8724('0xb'),function(_0xce3952,_0x24ea4b){if(_0xce3952!==_0x8724('0x8'))return;try{var _0xe22d61=JSON[_0x8724('0xc')](_0x24ea4b);eventEmitter[_0x8724('0x9')](_0x8724('0xd'),_0xe22d61);}catch(_0x4136a6){eventEmitter['emit'](_0x8724('0xa'),new AGIError(_0x8724('0xe'),_0x4136a6));}});module[_0x8724('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 7065970..41defbe 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 _0x4d02=['condition','split','length','agicommand','vswitch','target','default','invalid','traverseBFS','includes','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','numberOfEdges','prototype','addVertex','vertices','edges','addEdge','push','size','relations','getVertex','info','no\x20vertex\x20found','stop\x20traverse','no\x20edge/s\x20available'];(function(_0x3f14eb,_0x2e1569){var _0x451c25=function(_0x147cd3){while(--_0x147cd3){_0x3f14eb['push'](_0x3f14eb['shift']());}};_0x451c25(++_0x2e1569);}(_0x4d02,0x10c));var _0x24d0=function(_0x5e71d5,_0x59c70b){_0x5e71d5=_0x5e71d5-0x0;var _0x52ed7d=_0x4d02[_0x5e71d5];return _0x52ed7d;};'use strict';var _=require(_0x24d0('0x0'));var logger=require(_0x24d0('0x1'))(_0x24d0('0x2'));var verticesWithRetry=[_0x24d0('0x3'),_0x24d0('0x4'),_0x24d0('0x5')];var Graph=function(){this['vertices']={};this['edges']={};this[_0x24d0('0x6')]=0x0;};Graph[_0x24d0('0x7')][_0x24d0('0x8')]=function(_0x1c7f2d){this[_0x24d0('0x9')][_0x1c7f2d['id']]=_0x1c7f2d;this[_0x24d0('0xa')][_0x1c7f2d['id']]=[];};Graph['prototype'][_0x24d0('0xb')]=function(_0x31d97a,_0x16716f,_0x32b5ca){this[_0x24d0('0xa')][_0x31d97a][_0x24d0('0xc')]({'target':_0x16716f,'condition':_0x32b5ca});this[_0x24d0('0x6')]+=0x1;};Graph[_0x24d0('0x7')][_0x24d0('0xd')]=function(){return _[_0x24d0('0xd')](this[_0x24d0('0x9')]);};Graph[_0x24d0('0x7')][_0x24d0('0xe')]=function(){return this['numberOfEdges'];};Graph[_0x24d0('0x7')][_0x24d0('0xf')]=function(_0x238a73){return this[_0x24d0('0x9')][_0x238a73];};Graph[_0x24d0('0x7')]['traverseBFS']=function(_0x12373a,_0x2e4492){if(!this[_0x24d0('0x9')][_0x12373a]){return logger[_0x24d0('0x10')](_0x24d0('0x11'));}var _0xa893c1=_0x2e4492(this[_0x24d0('0x9')][_0x12373a]);if(!_0xa893c1){return logger[_0x24d0('0x10')](_0x24d0('0x12'));}if(this[_0x24d0('0xa')][_0x12373a]['length']===0x0){return logger['info'](_0x24d0('0x13'));}for(var _0x18060f=0x0,_0x260e47=[],_0x27f61c=![];_0x18060f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','callerid','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','handleNotFound','production','handleUnpublished','initialize'];(function(_0xb4c33c,_0x2c80cd){var _0x557bd5=function(_0x25ff4e){while(--_0x25ff4e){_0xb4c33c['push'](_0xb4c33c['shift']());}};_0x557bd5(++_0x2c80cd);}(_0x0937,0x132));var _0x7093=function(_0x51f8d7,_0x239ea6){_0x51f8d7=_0x51f8d7-0x0;var _0x11d45f=_0x0937[_0x51f8d7];return _0x11d45f;};'use strict';var _=require(_0x7093('0x0'));var syncho=require(_0x7093('0x1'));var util=require('util');var config=require(_0x7093('0x2'));var logger=require(_0x7093('0x3'))('agi');var utilLicense=require(_0x7093('0x4'));var rpc=require('./rpc');var Project=require(_0x7093('0x5'));var AGIEmitter=require(_0x7093('0x6'))[_0x7093('0x7')];var projects=[];config['agi']=_['defaults'](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x7093('0x8'),projectUpdateHandler);function connectionHandler(_0x35177d){process[_0x7093('0x9')](function(){syncho(function(){try{setChannelVariables(_0x35177d);agiHandler(_0x35177d);}catch(_0x4aabe3){logger['error'](_0x4aabe3[_0x7093('0xa')]);}});});}function projectUpdateHandler(_0x1ef053){try{var _0x48851a=_[_0x7093('0xb')](projects,['id',_0x1ef053['id']]);if(_0x48851a>-0x1){if(_0x1ef053[_0x7093('0xc')]===!![]){projects[_0x7093('0xd')](_0x48851a,0x1);}else{projects[_0x48851a]=_0x1ef053;}}else{projects['push'](_0x1ef053);}}catch(_0x361b25){logger[_0x7093('0xe')](_0x361b25[_0x7093('0xa')]);}}function listeningHandler(){console[_0x7093('0xf')](_0x7093('0x10'),config[_0x7093('0x11')][_0x7093('0x12')]);logger['info'](util[_0x7093('0x13')](_0x7093('0x14'),config['agi']['ip'],config[_0x7093('0x11')][_0x7093('0x12')]));}function errorHandler(_0x313b62){if(_0x313b62&&_0x313b62[_0x7093('0x15')]&&_0x313b62[_0x7093('0x16')]){logger['error'](util[_0x7093('0x13')](_0x7093('0x17'),_0x313b62['name'],_0x313b62[_0x7093('0x16')]));}else{logger[_0x7093('0xe')](util[_0x7093('0x13')](_0x7093('0x18'),_0x313b62['stack']));}}function closeHandler(){logger[_0x7093('0x19')](util[_0x7093('0x13')](_0x7093('0x1a'),this[_0x7093('0x1b')],this[_0x7093('0x1c')],this['callerid'],this[_0x7093('0x1d')],this[_0x7093('0x1e')]));try{createSquareReport(this);}catch(_0x5e969a){logger[_0x7093('0xe')](_0x5e969a[_0x7093('0xa')]);}}function timeoutHandler(){logger[_0x7093('0x19')](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7093('0x1b')],this[_0x7093('0x1c')],this[_0x7093('0x1f')],this[_0x7093('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x7093('0x19')](util[_0x7093('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x7093('0x1b')],this['calleridname'],this['callerid'],this[_0x7093('0x1d')],this[_0x7093('0x1e')]));this[_0x7093('0x20')]=!![];}function createSquareReport(_0x3d952e,_0x21bce6){rpc[_0x7093('0x21')](_0x3d952e)[_0x7093('0x22')](function(_0x1ac1a2){if(_0x21bce6){_0x21bce6(null,_0x1ac1a2);}})['catch'](function(_0x349a23){if(_0x21bce6){_0x21bce6(null,_0x349a23);}});}function setChannelVariables(_0x527b3c){for(var _0x319075 in _0x527b3c){if(_0x527b3c[_0x7093('0x23')](_0x319075)){if(_0x319075[_0x7093('0x24')](_0x7093('0x25'))===0x0){_0x527b3c[_0x319075[_0x7093('0x26')](0x4)]=_0x527b3c[_0x319075];delete _0x527b3c[_0x319075];}}}}function agiHandler(_0x3e6216){logger['debug'](_0x7093('0x27'),JSON[_0x7093('0x28')](_0x3e6216,null,0x2));logger[_0x7093('0x19')](util[_0x7093('0x13')](_0x7093('0x29'),_0x3e6216[_0x7093('0x1b')],_0x3e6216['calleridname'],_0x3e6216[_0x7093('0x1f')],_0x3e6216[_0x7093('0x1d')],_0x3e6216['uniqueid']));_0x3e6216['on'](_0x7093('0xe'),errorHandler);_0x3e6216['on'](_0x7093('0x2a'),closeHandler);_0x3e6216['on']('timeout',timeoutHandler);_0x3e6216[_0x7093('0x20')]=![];_0x3e6216['on'](_0x7093('0x2b'),hangupHandler);var _0x20879e=_['find'](projects,[_0x7093('0x15'),_0x3e6216['arg_1']]);if(!_0x20879e)return Project[_0x7093('0x2c')](_0x3e6216);if(!_0x20879e[_0x7093('0x2d')])return Project[_0x7093('0x2e')](_0x3e6216);return Project[_0x7093('0x2f')](_0x20879e,_0x3e6216);}function main(){var _0x254495;return utilLicense[_0x7093('0x30')]()[_0x7093('0x22')](function(_0x19d83e){if(!_0x19d83e)return;if(_0x19d83e[_0x7093('0x31')]){if(_0x19d83e[_0x7093('0x32')]&&_0x19d83e[_0x7093('0x32')]>0x0){logger[_0x7093('0x19')](util[_0x7093('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x19d83e[_0x7093('0x32')]));_0x254495=_0x19d83e['callysquare'];}else{logger[_0x7093('0x19')](_0x7093('0x33'));}}else{logger[_0x7093('0x19')](_0x7093('0x34'));_0x254495=-0x1;}})['then'](function(){return Project[_0x7093('0x35')]();})[_0x7093('0x22')](function(_0x1b2e90){projects=_0x1b2e90;return;})[_0x7093('0x36')](function(_0x37e4a3){logger['error'](_0x7093('0x37'),_0x37e4a3['stack']);})[_0x7093('0x38')](function(){var _0x2f557a=require(_0x7093('0x39'))(config[_0x7093('0x11')][_0x7093('0x12')],config[_0x7093('0x11')]['ip'],_0x254495);_0x2f557a['on'](_0x7093('0xe'),errorHandler);_0x2f557a['on']('listening',listeningHandler);_0x2f557a['on'](_0x7093('0x3a'),connectionHandler);_0x2f557a['on'](_0x7093('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0xc838=['./server','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./project','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','stack','findIndex','deleted','splice','error','log','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','format','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','timeout','evtHangup','hangup','handleNotFound','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','finally'];(function(_0x3e00a7,_0x15e0e2){var _0xe16b22=function(_0x42830a){while(--_0x42830a){_0x3e00a7['push'](_0x3e00a7['shift']());}};_0xe16b22(++_0x15e0e2);}(_0xc838,0x12b));var _0x8c83=function(_0x484aff,_0x342eb5){_0x484aff=_0x484aff-0x0;var _0x577d54=_0xc838[_0x484aff];return _0x577d54;};'use strict';var _=require(_0x8c83('0x0'));var syncho=require(_0x8c83('0x1'));var util=require(_0x8c83('0x2'));var config=require(_0x8c83('0x3'));var logger=require(_0x8c83('0x4'))(_0x8c83('0x5'));var utilLicense=require(_0x8c83('0x6'));var rpc=require(_0x8c83('0x7'));var Project=require(_0x8c83('0x8'));var AGIEmitter=require(_0x8c83('0x9'))[_0x8c83('0xa')];var projects=[];config['agi']=_[_0x8c83('0xb')](config[_0x8c83('0x5')],{'ip':_0x8c83('0xc'),'port':0x11dd});AGIEmitter['on'](_0x8c83('0xd'),projectUpdateHandler);function connectionHandler(_0x511fe3){process[_0x8c83('0xe')](function(){syncho(function(){try{setChannelVariables(_0x511fe3);agiHandler(_0x511fe3);}catch(_0x26078d){logger['error'](_0x26078d[_0x8c83('0xf')]);}});});}function projectUpdateHandler(_0x313ced){try{var _0x525525=_[_0x8c83('0x10')](projects,['id',_0x313ced['id']]);if(_0x525525>-0x1){if(_0x313ced[_0x8c83('0x11')]===!![]){projects[_0x8c83('0x12')](_0x525525,0x1);}else{projects[_0x525525]=_0x313ced;}}else{projects['push'](_0x313ced);}}catch(_0x5aabb){logger[_0x8c83('0x13')](_0x5aabb['stack']);}}function listeningHandler(){console[_0x8c83('0x14')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x8c83('0x5')][_0x8c83('0x15')]);logger[_0x8c83('0x16')](util['format'](_0x8c83('0x17'),config[_0x8c83('0x5')]['ip'],config[_0x8c83('0x5')][_0x8c83('0x15')]));}function errorHandler(_0x37ee6b){if(_0x37ee6b&&_0x37ee6b[_0x8c83('0x18')]&&_0x37ee6b[_0x8c83('0x19')]){logger[_0x8c83('0x13')](util[_0x8c83('0x1a')](_0x8c83('0x1b'),_0x37ee6b['name'],_0x37ee6b['message']));}else{logger[_0x8c83('0x13')](util[_0x8c83('0x1a')](_0x8c83('0x1c'),_0x37ee6b[_0x8c83('0xf')]));}}function closeHandler(){logger[_0x8c83('0x16')](util[_0x8c83('0x1a')](_0x8c83('0x1d'),this[_0x8c83('0x1e')],this['calleridname'],this['callerid'],this[_0x8c83('0x1f')],this[_0x8c83('0x20')]));try{createSquareReport(this);}catch(_0x37a4c8){logger[_0x8c83('0x13')](_0x37a4c8['stack']);}}function timeoutHandler(){logger['info'](util[_0x8c83('0x1a')](_0x8c83('0x21'),this[_0x8c83('0x1e')],this['calleridname'],this[_0x8c83('0x22')],this[_0x8c83('0x1f')],this['uniqueid']));}function hangupHandler(){logger[_0x8c83('0x16')](util[_0x8c83('0x1a')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this['calleridname'],this[_0x8c83('0x22')],this['dnid'],this[_0x8c83('0x20')]));this['evtHangup']=!![];}function createSquareReport(_0x4afd3e,_0x10c075){rpc[_0x8c83('0x23')](_0x4afd3e)[_0x8c83('0x24')](function(_0x20d441){if(_0x10c075){_0x10c075(null,_0x20d441);}})[_0x8c83('0x25')](function(_0x2ef1e8){if(_0x10c075){_0x10c075(null,_0x2ef1e8);}});}function setChannelVariables(_0x3cfbc3){for(var _0x3c01d7 in _0x3cfbc3){if(_0x3cfbc3[_0x8c83('0x26')](_0x3c01d7)){if(_0x3c01d7[_0x8c83('0x27')](_0x8c83('0x28'))===0x0){_0x3cfbc3[_0x3c01d7[_0x8c83('0x29')](0x4)]=_0x3cfbc3[_0x3c01d7];delete _0x3cfbc3[_0x3c01d7];}}}}function agiHandler(_0x4f196b){logger['debug'](_0x8c83('0x2a'),JSON['stringify'](_0x4f196b,null,0x2));logger[_0x8c83('0x16')](util[_0x8c83('0x1a')](_0x8c83('0x2b'),_0x4f196b[_0x8c83('0x1e')],_0x4f196b[_0x8c83('0x2c')],_0x4f196b[_0x8c83('0x22')],_0x4f196b[_0x8c83('0x1f')],_0x4f196b[_0x8c83('0x20')]));_0x4f196b['on'](_0x8c83('0x13'),errorHandler);_0x4f196b['on']('close',closeHandler);_0x4f196b['on'](_0x8c83('0x2d'),timeoutHandler);_0x4f196b[_0x8c83('0x2e')]=![];_0x4f196b['on'](_0x8c83('0x2f'),hangupHandler);var _0x3ee6b2=_['find'](projects,[_0x8c83('0x18'),_0x4f196b['arg_1']]);if(!_0x3ee6b2)return Project[_0x8c83('0x30')](_0x4f196b);if(!_0x3ee6b2['production'])return Project['handleUnpublished'](_0x4f196b);return Project[_0x8c83('0x31')](_0x3ee6b2,_0x4f196b);}function main(){var _0x5c4664;return utilLicense[_0x8c83('0x32')]()['then'](function(_0xcd464d){if(!_0xcd464d)return;if(_0xcd464d[_0x8c83('0x33')]){if(_0xcd464d[_0x8c83('0x34')]&&_0xcd464d['callysquare']>0x0){logger[_0x8c83('0x16')](util[_0x8c83('0x1a')](_0x8c83('0x35'),_0xcd464d[_0x8c83('0x34')]));_0x5c4664=_0xcd464d[_0x8c83('0x34')];}else{logger[_0x8c83('0x16')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x8c83('0x16')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5c4664=-0x1;}})[_0x8c83('0x24')](function(){return Project['getAll']();})[_0x8c83('0x24')](function(_0x4629cb){projects=_0x4629cb;return;})[_0x8c83('0x25')](function(_0x284780){logger[_0x8c83('0x13')]('[LICENSE]',_0x284780['stack']);})[_0x8c83('0x36')](function(){var _0x558b05=require(_0x8c83('0x37'))(config[_0x8c83('0x5')][_0x8c83('0x15')],config[_0x8c83('0x5')]['ip'],_0x5c4664);_0x558b05['on']('error',errorHandler);_0x558b05['on'](_0x8c83('0x38'),listeningHandler);_0x558b05['on'](_0x8c83('0x39'),connectionHandler);_0x558b05['on'](_0x8c83('0x3a'),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 2bd2161..bfd59b2 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 _0xb6f8=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x20758c,_0x44a42a){var _0x1c4ab7=function(_0x80197e){while(--_0x80197e){_0x20758c['push'](_0x20758c['shift']());}};_0x1c4ab7(++_0x44a42a);}(_0xb6f8,0x1e8));var _0x8b6f=function(_0x190dbd,_0x24a507){_0x190dbd=_0x190dbd-0x0;var _0x868d27=_0xb6f8[_0x190dbd];return _0x868d27;};'use strict';var BPromise=require(_0x8b6f('0x0'));var jayson=require(_0x8b6f('0x1'));var client=jayson[_0x8b6f('0x2')][_0x8b6f('0x3')]({'port':0x232b});function request(_0x1a8507,_0xa6e9a7){return new BPromise(function(_0x583aed,_0x2c138b){return client[_0x8b6f('0x4')](_0x1a8507,_0xa6e9a7)[_0x8b6f('0x5')](function(_0x24a0d4){if(_0x24a0d4[_0x8b6f('0x6')]){return _0x2c138b(_0x24a0d4[_0x8b6f('0x6')][_0x8b6f('0x7')]);}else{return _0x583aed(_0x24a0d4[_0x8b6f('0x8')]);}})[_0x8b6f('0x9')](function(_0x403e2f){return _0x2c138b(_0x403e2f);});});}exports[_0x8b6f('0xa')]=function(_0x5b4cf7,_0x11f6e1){return request(_0x8b6f('0xb'),{'account':_0x5b4cf7,'message':_0x11f6e1});}; \ No newline at end of file +var _0x6fea=['message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x25460e,_0x2c3b9d){var _0x2f5418=function(_0x147a8e){while(--_0x147a8e){_0x25460e['push'](_0x25460e['shift']());}};_0x2f5418(++_0x2c3b9d);}(_0x6fea,0x10d));var _0xa6fe=function(_0x51f593,_0x38d2ec){_0x51f593=_0x51f593-0x0;var _0x4ccfbf=_0x6fea[_0x51f593];return _0x4ccfbf;};'use strict';var BPromise=require(_0xa6fe('0x0'));var jayson=require(_0xa6fe('0x1'));var client=jayson[_0xa6fe('0x2')][_0xa6fe('0x3')]({'port':0x232b});function request(_0x1dd97c,_0x639987){return new BPromise(function(_0x35cf81,_0x3e12d9){return client[_0xa6fe('0x4')](_0x1dd97c,_0x639987)[_0xa6fe('0x5')](function(_0x506d36){if(_0x506d36['error']){return _0x3e12d9(_0x506d36[_0xa6fe('0x6')][_0xa6fe('0x7')]);}else{return _0x35cf81(_0x506d36[_0xa6fe('0x8')]);}})[_0xa6fe('0x9')](function(_0x13191a){return _0x3e12d9(_0x13191a);});});}exports[_0xa6fe('0xa')]=function(_0x1c9a15,_0x3e37c8){return request(_0xa6fe('0xb'),{'account':_0x1c9a15,'message':_0x3e37c8});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 62e32d7..ca127fa 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdee4=['stack','hasOwnProperty','retry','maxRetry','mxCell','isArray','length','target','value','toJson','mxGraphModel','production','start','debug','root','stringify','format','YYYY-MM-DD\x20HH:mm:ss','omit','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','response','code','result','evtHangup','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','priority','Project\x20%s\x20not\x20published','close','exports','lodash','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xdee4,0x1e3));var _0x4dee=function(_0x46b979,_0x3f0e9a){_0x46b979=_0x46b979-0x0;var _0x355217=_0xdee4[_0x46b979];return _0x355217;};'use strict';var _=require(_0x4dee('0x0'));var moment=require(_0x4dee('0x1'));var parser=require(_0x4dee('0x2'));var util=require(_0x4dee('0x3'));var logger=require('../../config/logger')(_0x4dee('0x4'));var rpc=require(_0x4dee('0x5'));var mailRpc=require(_0x4dee('0x6'));var Graph=require(_0x4dee('0x7'));var Vertices=require(_0x4dee('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x4dee('0x9')]()[_0x4dee('0xa')](function(_0x504ef6){logger[_0x4dee('0xb')](_0x4dee('0xc'),_0x504ef6[_0x4dee('0xd')]);return[];});}function addVertex(_0x3180a8,_0x631f2e,_0x803c59){_0x631f2e['agicommand']=_0x803c59;if(_0x631f2e[_0x4dee('0xe')](_0x4dee('0xf'))){_0x631f2e[_0x4dee('0x10')]=parseInt(_0x631f2e[_0x4dee('0xf')],0xa);}_0x3180a8['addVertex'](_['omit'](_0x631f2e,_0x4dee('0x11')));}function initGraph(_0x4563b7,_0x57e816){var _0x4d0290=new Graph();for(var _0x5543c7 in _0x4563b7){if(_0x4563b7[_0x4dee('0xe')](_0x5543c7)){if(_[_0x4dee('0x12')](_0x4563b7[_0x5543c7])){for(var _0x1cfd68=0x0;_0x1cfd68<_0x4563b7[_0x5543c7][_0x4dee('0x13')];_0x1cfd68+=0x1){addVertex(_0x4d0290,_0x4563b7[_0x5543c7][_0x1cfd68],_0x5543c7);}}else{addVertex(_0x4d0290,_0x4563b7[_0x5543c7],_0x5543c7);}}}for(var _0x490cd6=0x0;_0x490cd6<_0x57e816[_0x4dee('0x13')];_0x490cd6+=0x1){if(_0x57e816[_0x490cd6]['source']&&_0x57e816[_0x490cd6][_0x4dee('0x14')]){_0x4d0290['addEdge'](_0x57e816[_0x490cd6]['source'],_0x57e816[_0x490cd6][_0x4dee('0x14')],_0x57e816[_0x490cd6][_0x4dee('0x15')]);}}return _0x4d0290;}function getRoot(_0x104590){return parser[_0x4dee('0x16')](_0x104590,{'object':!![]})[_0x4dee('0x17')]['root'];}function inspect(_0x13b624){return util['inspect'](_0x13b624,{'showHidden':![],'depth':null});}function initialize(_0x3d526e,_0x2b11e5){var _0x42a7ae=getRoot(_0x3d526e[_0x4dee('0x18')]);if(!_0x42a7ae||!_0x42a7ae[_0x4dee('0x19')])return;var _0x90b8c1,_0x12ba98,_0x1915e0;logger[_0x4dee('0x1a')](_0x4dee('0x1b'),JSON[_0x4dee('0x1c')](_0x42a7ae,null,0x2));_0x2b11e5['joinAt']=moment()[_0x4dee('0x1d')](_0x4dee('0x1e'));_0x90b8c1=initGraph(_[_0x4dee('0x1f')](_0x42a7ae,_0x4dee('0x11')),_0x42a7ae[_0x4dee('0x11')]);_0x12ba98=new Vertices(_0x2b11e5,rpc,mailRpc);logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x21'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5[_0x4dee('0x23')],_0x2b11e5['callerid'],_0x2b11e5['dnid'],_0x2b11e5[_0x4dee('0x24')]));_0x90b8c1['traverseBFS'](_0x42a7ae[_0x4dee('0x19')]['id'],function(_0x25f154){try{_0x25f154=_0x12ba98['clear'](_0x25f154);logger['debug'](_0x4dee('0x25'),JSON[_0x4dee('0x1c')](_0x25f154,null,0x2));if(_0x25f154[_0x4dee('0x26')]===_0x4dee('0x27')){logger[_0x4dee('0x20')](_0x4dee('0x28'));_0x2b11e5[_0x4dee('0x29')]=_0x25f154[_0x4dee('0x29')]||_0x2b11e5[_0x4dee('0x29')];_0x2b11e5[_0x4dee('0x2a')]=_0x25f154[_0x4dee('0x2a')];_0x2b11e5['priority']=_0x25f154['priority']?_0x25f154['priority']-0x1:0x1;return null;}else if(_0x25f154&&_0x12ba98[_0x25f154['agicommand']]){_0x1915e0=_0x12ba98[_0x25f154[_0x4dee('0x26')]](_0x25f154);logger[_0x4dee('0x20')](_0x4dee('0x2b'),JSON[_0x4dee('0x1c')](_0x1915e0,null,0x2));if(_0x1915e0&&_0x1915e0[_0x4dee('0x2c')]===AGI_CODE_SUCCESS&&_0x1915e0[_0x4dee('0x2d')]!==AGI_RESULT_ERROR&&!_0x2b11e5[_0x4dee('0x2e')]){logger[_0x4dee('0x1a')](_0x4dee('0x2b'),inspect(_0x1915e0));return _['isUndefined'](_0x1915e0[_0x4dee('0x2d')])?null:_0x1915e0[_0x4dee('0x2d')][_0x4dee('0x2f')]();}else{logger['error'](_0x4dee('0x2b'),inspect(_0x1915e0));return null;}}else{logger[_0x4dee('0xb')](_0x4dee('0x30'));return null;}}catch(_0x51bb1c){logger[_0x4dee('0xb')](_0x51bb1c['stack']);return null;}});if(_0x42a7ae[_0x4dee('0x31')]){logger['info'](util[_0x4dee('0x1d')](_0x4dee('0x32'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5[_0x4dee('0x23')],_0x2b11e5['callerid'],_0x2b11e5[_0x4dee('0x33')],_0x2b11e5[_0x4dee('0x24')]));_0x90b8c1['traverseBFS'](_0x42a7ae[_0x4dee('0x31')]['id'],function(_0x177ef3){try{_0x177ef3=_0x12ba98[_0x4dee('0x34')](_0x177ef3);logger[_0x4dee('0x1a')](_0x4dee('0x25'),JSON[_0x4dee('0x1c')](_0x177ef3,null,0x2));if(_0x177ef3&&_0x12ba98[_0x177ef3[_0x4dee('0x26')]]){_0x1915e0=_0x12ba98[_0x177ef3['agicommand']](_0x177ef3);if(_0x1915e0){logger[_0x4dee('0x1a')](_0x4dee('0x2b'),inspect(_0x1915e0));return _[_0x4dee('0x35')](_0x1915e0[_0x4dee('0x2d')])?null:_0x1915e0['result'][_0x4dee('0x2f')]();}else{logger[_0x4dee('0xb')](_0x4dee('0x2b'),inspect(_0x1915e0));return null;}}else{logger[_0x4dee('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x2851c1){logger['error'](_0x2851c1['stack']);return null;}});}logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x36'),_0x2b11e5[_0x4dee('0x22')],_0x2b11e5['calleridname'],_0x2b11e5[_0x4dee('0x37')],_0x2b11e5[_0x4dee('0x33')],_0x2b11e5['uniqueid']));logger[_0x4dee('0x20')](util[_0x4dee('0x1d')](_0x4dee('0x38'),_0x2b11e5['context'],_0x2b11e5[_0x4dee('0x2a')],parseInt(_0x2b11e5['priority'],0xa)+0x1));_0x2b11e5[_0x4dee('0x39')](_0x2b11e5[_0x4dee('0x29')],_0x2b11e5[_0x4dee('0x2a')],parseInt(_0x2b11e5[_0x4dee('0x3a')],0xa)+0x1);_0x2b11e5['close']();}function handleNotFound(_0x7f9a60){logger[_0x4dee('0xb')](util['format']('Project\x20%s\x20not\x20found',_0x7f9a60[_0x4dee('0x22')]));_0x7f9a60[_0x4dee('0x39')](_0x7f9a60[_0x4dee('0x29')],_0x7f9a60['extension'],parseInt(_0x7f9a60[_0x4dee('0x3a')],0xa)+0x1);_0x7f9a60['close']();}function handleUnpublished(_0x3a4d9c){logger['error'](util[_0x4dee('0x1d')](_0x4dee('0x3b'),_0x3a4d9c[_0x4dee('0x22')]));_0x3a4d9c[_0x4dee('0x39')](_0x3a4d9c[_0x4dee('0x29')],_0x3a4d9c['extension'],parseInt(_0x3a4d9c[_0x4dee('0x3a')],0xa)+0x1);_0x3a4d9c[_0x4dee('0x3c')]();}module[_0x4dee('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xefcb=['debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','context','extension','priority','stringify','code','result','evtHangup','response','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','format','[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','close','lodash','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./graph','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','root','production','start'];(function(_0xc11a42,_0x43bf22){var _0x257d33=function(_0x2f9a38){while(--_0x2f9a38){_0xc11a42['push'](_0xc11a42['shift']());}};_0x257d33(++_0x43bf22);}(_0xefcb,0x1ba));var _0xbefc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xefcb[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xbefc('0x0'));var moment=require('moment');var parser=require(_0xbefc('0x1'));var util=require(_0xbefc('0x2'));var logger=require(_0xbefc('0x3'))(_0xbefc('0x4'));var rpc=require(_0xbefc('0x5'));var mailRpc=require(_0xbefc('0x6'));var Graph=require(_0xbefc('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xbefc('0x8')](function(_0x112b53){logger[_0xbefc('0x9')](_0xbefc('0xa'),_0x112b53[_0xbefc('0xb')]);return[];});}function addVertex(_0x1fcb5a,_0x147e47,_0x27a406){_0x147e47[_0xbefc('0xc')]=_0x27a406;if(_0x147e47[_0xbefc('0xd')](_0xbefc('0xe'))){_0x147e47[_0xbefc('0xf')]=parseInt(_0x147e47[_0xbefc('0xe')],0xa);}_0x1fcb5a[_0xbefc('0x10')](_[_0xbefc('0x11')](_0x147e47,_0xbefc('0x12')));}function initGraph(_0xcb8466,_0x1cffcb){var _0x48415b=new Graph();for(var _0xa77a42 in _0xcb8466){if(_0xcb8466['hasOwnProperty'](_0xa77a42)){if(_[_0xbefc('0x13')](_0xcb8466[_0xa77a42])){for(var _0x5a7389=0x0;_0x5a7389<_0xcb8466[_0xa77a42]['length'];_0x5a7389+=0x1){addVertex(_0x48415b,_0xcb8466[_0xa77a42][_0x5a7389],_0xa77a42);}}else{addVertex(_0x48415b,_0xcb8466[_0xa77a42],_0xa77a42);}}}for(var _0xfe9669=0x0;_0xfe9669<_0x1cffcb[_0xbefc('0x14')];_0xfe9669+=0x1){if(_0x1cffcb[_0xfe9669][_0xbefc('0x15')]&&_0x1cffcb[_0xfe9669][_0xbefc('0x16')]){_0x48415b[_0xbefc('0x17')](_0x1cffcb[_0xfe9669][_0xbefc('0x15')],_0x1cffcb[_0xfe9669][_0xbefc('0x16')],_0x1cffcb[_0xfe9669][_0xbefc('0x18')]);}}return _0x48415b;}function getRoot(_0x4a4c6a){return parser[_0xbefc('0x19')](_0x4a4c6a,{'object':!![]})[_0xbefc('0x1a')][_0xbefc('0x1b')];}function inspect(_0x231580){return util['inspect'](_0x231580,{'showHidden':![],'depth':null});}function initialize(_0x43517e,_0x4902cf){var _0x59989b=getRoot(_0x43517e[_0xbefc('0x1c')]);if(!_0x59989b||!_0x59989b[_0xbefc('0x1d')])return;var _0x3f8c55,_0x3b7068,_0x4e07d5;logger[_0xbefc('0x1e')](_0xbefc('0x1b'),JSON['stringify'](_0x59989b,null,0x2));_0x4902cf[_0xbefc('0x1f')]=moment()['format'](_0xbefc('0x20'));_0x3f8c55=initGraph(_[_0xbefc('0x11')](_0x59989b,_0xbefc('0x12')),_0x59989b[_0xbefc('0x12')]);_0x3b7068=new Vertices(_0x4902cf,rpc,mailRpc);logger[_0xbefc('0x21')](util['format'](_0xbefc('0x22'),_0x4902cf[_0xbefc('0x23')],_0x4902cf[_0xbefc('0x24')],_0x4902cf[_0xbefc('0x25')],_0x4902cf[_0xbefc('0x26')],_0x4902cf[_0xbefc('0x27')]));_0x3f8c55[_0xbefc('0x28')](_0x59989b[_0xbefc('0x1d')]['id'],function(_0x296dc7){try{_0x296dc7=_0x3b7068[_0xbefc('0x29')](_0x296dc7);logger[_0xbefc('0x1e')]('vertex',JSON['stringify'](_0x296dc7,null,0x2));if(_0x296dc7['agicommand']==='gotoc'){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4902cf[_0xbefc('0x2a')]=_0x296dc7[_0xbefc('0x2a')]||_0x4902cf[_0xbefc('0x2a')];_0x4902cf[_0xbefc('0x2b')]=_0x296dc7[_0xbefc('0x2b')];_0x4902cf[_0xbefc('0x2c')]=_0x296dc7['priority']?_0x296dc7[_0xbefc('0x2c')]-0x1:0x1;return null;}else if(_0x296dc7&&_0x3b7068[_0x296dc7['agicommand']]){_0x4e07d5=_0x3b7068[_0x296dc7['agicommand']](_0x296dc7);logger[_0xbefc('0x21')]('response',JSON[_0xbefc('0x2d')](_0x4e07d5,null,0x2));if(_0x4e07d5&&_0x4e07d5[_0xbefc('0x2e')]===AGI_CODE_SUCCESS&&_0x4e07d5[_0xbefc('0x2f')]!==AGI_RESULT_ERROR&&!_0x4902cf[_0xbefc('0x30')]){logger['debug'](_0xbefc('0x31'),inspect(_0x4e07d5));return _['isUndefined'](_0x4e07d5[_0xbefc('0x2f')])?null:_0x4e07d5['result'][_0xbefc('0x32')]();}else{logger['error'](_0xbefc('0x31'),inspect(_0x4e07d5));return null;}}else{logger[_0xbefc('0x9')](_0xbefc('0x33'));return null;}}catch(_0x323f3f){logger[_0xbefc('0x9')](_0x323f3f['stack']);return null;}});if(_0x59989b[_0xbefc('0x34')]){logger[_0xbefc('0x21')](util['format'](_0xbefc('0x35'),_0x4902cf['arg_1'],_0x4902cf[_0xbefc('0x24')],_0x4902cf[_0xbefc('0x25')],_0x4902cf[_0xbefc('0x26')],_0x4902cf[_0xbefc('0x27')]));_0x3f8c55[_0xbefc('0x28')](_0x59989b['finally']['id'],function(_0x1b669e){try{_0x1b669e=_0x3b7068['clear'](_0x1b669e);logger[_0xbefc('0x1e')]('vertex',JSON['stringify'](_0x1b669e,null,0x2));if(_0x1b669e&&_0x3b7068[_0x1b669e['agicommand']]){_0x4e07d5=_0x3b7068[_0x1b669e[_0xbefc('0xc')]](_0x1b669e);if(_0x4e07d5){logger[_0xbefc('0x1e')](_0xbefc('0x31'),inspect(_0x4e07d5));return _['isUndefined'](_0x4e07d5[_0xbefc('0x2f')])?null:_0x4e07d5[_0xbefc('0x2f')][_0xbefc('0x32')]();}else{logger['error'](_0xbefc('0x31'),inspect(_0x4e07d5));return null;}}else{logger[_0xbefc('0x9')](_0xbefc('0x33'));return null;}}catch(_0x46b5c2){logger[_0xbefc('0x9')](_0x46b5c2['stack']);return null;}});}logger[_0xbefc('0x21')](util[_0xbefc('0x36')](_0xbefc('0x37'),_0x4902cf[_0xbefc('0x23')],_0x4902cf[_0xbefc('0x24')],_0x4902cf[_0xbefc('0x25')],_0x4902cf['dnid'],_0x4902cf[_0xbefc('0x27')]));logger[_0xbefc('0x21')](util['format'](_0xbefc('0x38'),_0x4902cf[_0xbefc('0x2a')],_0x4902cf[_0xbefc('0x2b')],parseInt(_0x4902cf[_0xbefc('0x2c')],0xa)+0x1));_0x4902cf[_0xbefc('0x39')](_0x4902cf[_0xbefc('0x2a')],_0x4902cf[_0xbefc('0x2b')],parseInt(_0x4902cf[_0xbefc('0x2c')],0xa)+0x1);_0x4902cf[_0xbefc('0x3a')]();}function handleNotFound(_0x425cc8){logger['error'](util['format']('Project\x20%s\x20not\x20found',_0x425cc8[_0xbefc('0x23')]));_0x425cc8['continueAt'](_0x425cc8[_0xbefc('0x2a')],_0x425cc8['extension'],parseInt(_0x425cc8[_0xbefc('0x2c')],0xa)+0x1);_0x425cc8[_0xbefc('0x3a')]();}function handleUnpublished(_0x366749){logger[_0xbefc('0x9')](util['format']('Project\x20%s\x20not\x20published',_0x366749[_0xbefc('0x23')]));_0x366749[_0xbefc('0x39')](_0x366749[_0xbefc('0x2a')],_0x366749[_0xbefc('0x2b')],parseInt(_0x366749[_0xbefc('0x2c')],0xa)+0x1);_0x366749[_0xbefc('0x3a')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index e1481c0..147a6d9 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 _0xdcf9=['line','exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','indexOf','substring','length','trim','headers','emit'];(function(_0x2e8383,_0x4c1100){var _0x49311a=function(_0x3fc0e6){while(--_0x3fc0e6){_0x2e8383['push'](_0x2e8383['shift']());}};_0x49311a(++_0x4c1100);}(_0xdcf9,0x101));var _0x9dcf=function(_0x755ce4,_0x385b95){_0x755ce4=_0x755ce4-0x0;var _0x40974b=_0xdcf9[_0x755ce4];return _0x40974b;};'use strict';var util=require(_0x9dcf('0x0'));var Transform=require(_0x9dcf('0x1'))[_0x9dcf('0x2')];function AGIReply(_0x3f2035){Transform[_0x9dcf('0x3')](this,_0x3f2035);this[_0x9dcf('0x4')]='';this[_0x9dcf('0x5')]=![];}util[_0x9dcf('0x6')](AGIReply,Transform);AGIReply[_0x9dcf('0x7')][_0x9dcf('0x8')]=function(_0x3d89b0,_0x2489e3,_0x46b7bb){var _0x544404='\x0a',_0x4c6588=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5cad6d=-0x1,_0x19567a=-0x1,_0x16d36d='',_0x1399f2=0x0,_0x1352c0='',_0x3c9ca2='';this[_0x9dcf('0x4')]+=_0x3d89b0['toString']();_0x1352c0=this['_localBuffer'];if(!this['_inBody']){_0x1399f2=0x0;while(_0x4c6588[_0x1399f2]){while((_0x19567a=_0x1352c0[_0x9dcf('0x9')](_0x4c6588[_0x1399f2]))!=-0x1){_0x16d36d=_0x4c6588[_0x1399f2];_0x3c9ca2=_0x1352c0['substring'](0x0,_0x19567a);_0x1352c0=_0x1352c0[_0x9dcf('0xa')](_0x19567a+_0x16d36d[_0x9dcf('0xb')]);var _0x53f202=_0x3c9ca2['split'](_0x544404),_0x2e677a=0x0,_0x1e33a4={},_0x36c5e4='',_0x4fd583='',_0x1d2f93=-0x1;while(_0x53f202[_0x2e677a]){_0x1d2f93=_0x53f202[_0x2e677a][_0x9dcf('0x9')](':');if(_0x1d2f93!=-0x1){_0x36c5e4=_0x53f202[_0x2e677a]['slice'](0x0,_0x1d2f93)['trim']();_0x4fd583=_0x53f202[_0x2e677a]['slice'](_0x1d2f93+0x1)[_0x9dcf('0xc')]();if(_0x36c5e4[_0x9dcf('0xb')]>0x0){_0x1e33a4[_0x36c5e4]=_0x4fd583;}}else{}_0x2e677a++;}this['emit'](_0x9dcf('0xd'),_0x1e33a4);this['_inBody']=!![];}_0x1399f2++;}this[_0x9dcf('0x4')]=_0x1352c0;}else{while((_0x5cad6d=_0x1352c0[_0x9dcf('0x9')](_0x544404))!=-0x1){_0x3c9ca2=_0x1352c0[_0x9dcf('0xa')](0x0,_0x5cad6d);this[_0x9dcf('0xe')](_0x9dcf('0xf'),_0x3c9ca2);_0x1352c0=_0x1352c0[_0x9dcf('0xa')](_0x5cad6d+_0x544404['length']);}this['_localBuffer']=_0x1352c0;}_0x46b7bb();};module[_0x9dcf('0x10')]=AGIReply; \ No newline at end of file +var _0xd87b=['Transform','call','_localBuffer','_inBody','inherits','prototype','indexOf','split','slice','trim','length','emit','substring','line','stream'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xd87b,0xa4));var _0xbd87=function(_0x4e0556,_0x3624e4){_0x4e0556=_0x4e0556-0x0;var _0x5786fd=_0xd87b[_0x4e0556];return _0x5786fd;};'use strict';var util=require('util');var Transform=require(_0xbd87('0x0'))[_0xbd87('0x1')];function AGIReply(_0xe3405f){Transform[_0xbd87('0x2')](this,_0xe3405f);this[_0xbd87('0x3')]='';this[_0xbd87('0x4')]=![];}util[_0xbd87('0x5')](AGIReply,Transform);AGIReply[_0xbd87('0x6')]['_transform']=function(_0x310e4,_0x200edf,_0x2d7805){var _0x178970='\x0a',_0x2cd2ac=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xc150a8=-0x1,_0x2ecc0a=-0x1,_0x59e071='',_0x51d259=0x0,_0xb5e834='',_0x164644='';this[_0xbd87('0x3')]+=_0x310e4['toString']();_0xb5e834=this[_0xbd87('0x3')];if(!this[_0xbd87('0x4')]){_0x51d259=0x0;while(_0x2cd2ac[_0x51d259]){while((_0x2ecc0a=_0xb5e834[_0xbd87('0x7')](_0x2cd2ac[_0x51d259]))!=-0x1){_0x59e071=_0x2cd2ac[_0x51d259];_0x164644=_0xb5e834['substring'](0x0,_0x2ecc0a);_0xb5e834=_0xb5e834['substring'](_0x2ecc0a+_0x59e071['length']);var _0x2d2e8b=_0x164644[_0xbd87('0x8')](_0x178970),_0x10ebdf=0x0,_0x2fd7db={},_0x42df29='',_0x3ab30b='',_0x4bfa6f=-0x1;while(_0x2d2e8b[_0x10ebdf]){_0x4bfa6f=_0x2d2e8b[_0x10ebdf][_0xbd87('0x7')](':');if(_0x4bfa6f!=-0x1){_0x42df29=_0x2d2e8b[_0x10ebdf][_0xbd87('0x9')](0x0,_0x4bfa6f)['trim']();_0x3ab30b=_0x2d2e8b[_0x10ebdf]['slice'](_0x4bfa6f+0x1)[_0xbd87('0xa')]();if(_0x42df29[_0xbd87('0xb')]>0x0){_0x2fd7db[_0x42df29]=_0x3ab30b;}}else{}_0x10ebdf++;}this[_0xbd87('0xc')]('headers',_0x2fd7db);this[_0xbd87('0x4')]=!![];}_0x51d259++;}this[_0xbd87('0x3')]=_0xb5e834;}else{while((_0xc150a8=_0xb5e834[_0xbd87('0x7')](_0x178970))!=-0x1){_0x164644=_0xb5e834[_0xbd87('0xd')](0x0,_0xc150a8);this[_0xbd87('0xc')](_0xbd87('0xe'),_0x164644);_0xb5e834=_0xb5e834[_0xbd87('0xd')](_0xc150a8+_0x178970[_0xbd87('0xb')]);}this[_0xbd87('0x3')]=_0xb5e834;}_0x2d7805();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c682d82..492058d 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 _0x192f=['arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','jayson/promise','http','request','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge'];(function(_0x372b76,_0x510d62){var _0x2da7e5=function(_0x1eaa2f){while(--_0x1eaa2f){_0x372b76['push'](_0x372b76['shift']());}};_0x2da7e5(++_0x510d62);}(_0x192f,0xd6));var _0xf192=function(_0xbb3269,_0xee00b0){_0xbb3269=_0xbb3269-0x0;var _0x1950bf=_0x192f[_0xbb3269];return _0x1950bf;};'use strict';var _=require(_0xf192('0x0'));var moment=require('moment');var jayson=require(_0xf192('0x1'));var client=jayson['client'][_0xf192('0x2')]({'port':0x2329});function request(_0x5aec4b,_0x527d53){return new Promise(function(_0x3ed9c1,_0x3b704f){return client[_0xf192('0x3')](_0x5aec4b,_0x527d53)[_0xf192('0x4')](function(_0x1df2e1){if(_0x1df2e1[_0xf192('0x5')]){return _0x3b704f(_0x1df2e1['error'][_0xf192('0x6')]);}else{return _0x3ed9c1(_0x1df2e1[_0xf192('0x7')]);}})['catch'](function(_0x2c4102){return _0x3b704f(_0x2c4102);});});}exports[_0xf192('0x8')]=function(){return request(_0xf192('0x9'),{'options':{'raw':![],'attributes':['id',_0xf192('0xa'),_0xf192('0xb')]}});};exports['getSquareProject']=function(_0x4c9d03){return request(_0xf192('0xc'),{'options':{'raw':![],'where':{'name':_0x4c9d03},'attributes':[_0xf192('0xb')]}});};exports[_0xf192('0xd')]=function(_0x2cb4b2){return request(_0xf192('0xe'),{'options':{'raw':![],'where':{'id':_0x2cb4b2},'include':[{'model':_0xf192('0xf'),'as':_0xf192('0x10'),'include':[{'model':_0xf192('0x11'),'as':'CloudProvider'}]}],'attributes':['id',_0xf192('0xa'),_0xf192('0x12')],'smtp':!![]}});};exports[_0xf192('0x13')]=function(_0x16b525){return request(_0xf192('0xc'),{'options':{'where':{'id':_0x16b525},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x14')]=function(_0xb51acc){return request(_0xf192('0x15'),{'options':{'where':{'id':_0xb51acc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x16')]=function(_0x287088){return request('ShowVariable',{'options':{'where':{'id':_0x287088},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x17')]=function(_0x578423){return request(_0xf192('0x18'),{'options':{'where':{'id':_0x578423},'attributes':[_0xf192('0x19')]}});};exports[_0xf192('0x1a')]=function(_0x2185ea){return request(_0xf192('0x1b'),{'options':{'where':{'id':_0x2185ea},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x1c')]=function(_0x3aa61c){return request(_0xf192('0x1d'),{'options':{'where':{'phone':_0x3aa61c[_0xf192('0x1e')]},'attributes':['id']}});};exports[_0xf192('0x1f')]=function(_0x3ee921){return request('ShowTrunk',{'options':{'where':{'id':_0x3ee921},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x20')]=function(_0x418bc2){return request(_0xf192('0x21'),{'options':{'where':{'id':_0x418bc2},'attributes':[_0xf192('0x22')]}});};exports[_0xf192('0x23')]=function(_0x1dcf33){return request(_0xf192('0x24'),{'options':{'raw':![],'where':{'id':_0x1dcf33},'include':[{'model':'Interval','as':_0xf192('0x25')}]}});};exports[_0xf192('0x26')]=function(_0x32fc43){return request(_0xf192('0x27'),{'options':{'where':{'id':_0x32fc43},'attributes':['id','name']}});};exports[_0xf192('0x28')]=function(_0x5d3d2c){return request(_0xf192('0x29'),{'body':_0x5d3d2c});};exports['createSquareDetailsReport']=function(_0x466aa0){return request(_0xf192('0x2a'),{'body':_0x466aa0});};exports[_0xf192('0x2b')]=function(_0x425dea){return request(_0xf192('0x2c'),{'body':_[_0xf192('0x2d')](_0x425dea,{'project_name':_0x425dea[_0xf192('0x2e')],'prev_project_name':_0x425dea[_0xf192('0x2f')]||'','is_subproject':_0x425dea['arg_2']?!![]:![],'leaveAt':moment()[_0xf192('0x30')](_0xf192('0x31'))})});};exports[_0xf192('0x32')]=function(_0x5f0a2f){return request('CreateSquareRecording',{'body':_0x5f0a2f});};exports[_0xf192('0x33')]=function(_0x256fb6){return request(_0xf192('0x34'),{'body':_0x256fb6});};exports[_0xf192('0x35')]=function(_0x596c6a){return request(_0xf192('0x36'),{'options':{'raw':![],'where':{'phone':_0x596c6a['phone'],'ListId':_0x596c6a[_0xf192('0x37')]}}})['then'](function(_0x555f01){if(_0x555f01){return _0x555f01;}return request(_0xf192('0x38'),{'body':_0x596c6a});});};exports[_0xf192('0x39')]=function(_0x5460cc){return request('ShowPause',{'options':{'where':{'id':_0x5460cc},'attributes':[_0xf192('0xa')]}});};exports[_0xf192('0x3a')]=function(_0x3d2db4,_0x574908){return request(_0xf192('0x3b'),{'body':{'interface':_0x574908},'options':{'where':_0x3d2db4}});};exports[_0xf192('0x3c')]=function(_0x367c9b,_0x16956a,_0x57e5ee){return request(_0xf192('0x3d'),{'body':{'type':_0x16956a,'uniqueid':_0x57e5ee},'options':{'where':_0x367c9b}});};exports[_0xf192('0x3e')]=function(_0x241e28){return request('UnpauseUser',{'body':{},'options':{'where':_0x241e28}});};exports[_0xf192('0x3f')]=function(_0x290e79){return request(_0xf192('0x40'),{'body':{},'options':{'where':_0x290e79}});}; \ No newline at end of file +var _0xa4de=['message','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getSquareProjectById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getContactByPhone','phone','getSoundById','ShowSound','save_name','ShowInterval','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','lodash','client','http','request','then','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa4de,0x10d));var _0xea4d=function(_0xdada88,_0x34118d){_0xdada88=_0xdada88-0x0;var _0x46b729=_0xa4de[_0xdada88];return _0x46b729;};'use strict';var _=require(_0xea4d('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xea4d('0x1')][_0xea4d('0x2')]({'port':0x2329});function request(_0xf1af92,_0x3ee016){return new Promise(function(_0x380244,_0x111a9e){return client[_0xea4d('0x3')](_0xf1af92,_0x3ee016)[_0xea4d('0x4')](function(_0x128f9b){if(_0x128f9b[_0xea4d('0x5')]){return _0x111a9e(_0x128f9b[_0xea4d('0x5')][_0xea4d('0x6')]);}else{return _0x380244(_0x128f9b['result']);}})[_0xea4d('0x7')](function(_0x4f98e8){return _0x111a9e(_0x4f98e8);});});}exports[_0xea4d('0x8')]=function(){return request(_0xea4d('0x9'),{'options':{'raw':![],'attributes':['id',_0xea4d('0xa'),_0xea4d('0xb')]}});};exports[_0xea4d('0xc')]=function(_0x42127b){return request(_0xea4d('0xd'),{'options':{'raw':![],'where':{'name':_0x42127b},'attributes':[_0xea4d('0xb')]}});};exports[_0xea4d('0xe')]=function(_0x422d32){return request(_0xea4d('0xf'),{'options':{'raw':![],'where':{'id':_0x422d32},'include':[{'model':_0xea4d('0x10'),'as':'Smtp','include':[{'model':_0xea4d('0x11'),'as':_0xea4d('0x11')}]}],'attributes':['id',_0xea4d('0xa'),_0xea4d('0x12')],'smtp':!![]}});};exports[_0xea4d('0x13')]=function(_0x4a0ade){return request(_0xea4d('0xd'),{'options':{'where':{'id':_0x4a0ade},'attributes':[_0xea4d('0xa')]}});};exports['getVoiceQueueById']=function(_0x597c50){return request(_0xea4d('0x14'),{'options':{'where':{'id':_0x597c50},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x15')]=function(_0x3726c6){return request(_0xea4d('0x16'),{'options':{'where':{'id':_0x3726c6},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x17')]=function(_0x540814){return request(_0xea4d('0x18'),{'options':{'where':{'id':_0x540814},'attributes':['dsn']}});};exports[_0xea4d('0x19')]=function(_0xe9925d){return request(_0xea4d('0x1a'),{'options':{'where':{'id':_0xe9925d},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x1b')]=function(_0x5d2912){return request('GetContactByPhone',{'options':{'where':{'phone':_0x5d2912[_0xea4d('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x2d13f4){return request('ShowTrunk',{'options':{'where':{'id':_0x2d13f4},'attributes':[_0xea4d('0xa')]}});};exports[_0xea4d('0x1d')]=function(_0x573170){return request(_0xea4d('0x1e'),{'options':{'where':{'id':_0x573170},'attributes':[_0xea4d('0x1f')]}});};exports['getIntervalById']=function(_0x5c3d72){return request(_0xea4d('0x20'),{'options':{'raw':![],'where':{'id':_0x5c3d72},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xea4d('0x21')]=function(_0x3c686d){return request(_0xea4d('0x22'),{'options':{'where':{'id':_0x3c686d},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x110768){return request(_0xea4d('0x23'),{'body':_0x110768});};exports[_0xea4d('0x24')]=function(_0x53f919){return request(_0xea4d('0x25'),{'body':_0x53f919});};exports[_0xea4d('0x26')]=function(_0xc0b75b){return request(_0xea4d('0x27'),{'body':_[_0xea4d('0x28')](_0xc0b75b,{'project_name':_0xc0b75b['arg_1'],'prev_project_name':_0xc0b75b['arg_2']||'','is_subproject':_0xc0b75b[_0xea4d('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xea4d('0x2a'))})});};exports['createSquareRecording']=function(_0xe01672){return request(_0xea4d('0x2b'),{'body':_0xe01672});};exports[_0xea4d('0x2c')]=function(_0x4cbbd2){return request('CreateSquareMessage',{'body':_0x4cbbd2});};exports['createCmContact']=function(_0x540b0c){return request(_0xea4d('0x2d'),{'options':{'raw':![],'where':{'phone':_0x540b0c[_0xea4d('0x1c')],'ListId':_0x540b0c[_0xea4d('0x2e')]}}})[_0xea4d('0x4')](function(_0x2c75f7){if(_0x2c75f7){return _0x2c75f7;}return request(_0xea4d('0x2f'),{'body':_0x540b0c});});};exports[_0xea4d('0x30')]=function(_0x563706){return request(_0xea4d('0x31'),{'options':{'where':{'id':_0x563706},'attributes':[_0xea4d('0xa')]}});};exports['agentLogin']=function(_0x4ad958,_0x289bba){return request('LoginUser',{'body':{'interface':_0x289bba},'options':{'where':_0x4ad958}});};exports[_0xea4d('0x32')]=function(_0x1285ce,_0x4db0e3,_0x5a0127){return request(_0xea4d('0x33'),{'body':{'type':_0x4db0e3,'uniqueid':_0x5a0127},'options':{'where':_0x1285ce}});};exports[_0xea4d('0x34')]=function(_0x745d44){return request('UnpauseUser',{'body':{},'options':{'where':_0x745d44}});};exports[_0xea4d('0x35')]=function(_0x31230b){return request(_0xea4d('0x36'),{'body':{},'options':{'where':_0x31230b}});}; \ 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 7e723dc..7110ceb 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 _0xbd51=['./polly','exports'];(function(_0x1f5ce8,_0xa1cfae){var _0x5baa4f=function(_0x31c767){while(--_0x31c767){_0x1f5ce8['push'](_0x1f5ce8['shift']());}};_0x5baa4f(++_0xa1cfae);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x1bd796,_0x38d9a6){_0x1bd796=_0x1bd796-0x0;var _0x463d05=_0xbd51[_0x1bd796];return _0x463d05;};var polly=require(_0x1bd5('0x0'));var lex=require('./lex');module[_0x1bd5('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4453=['./polly','./lex'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4453,0x9c));var _0x3445=function(_0x3e2952,_0x546a1b){_0x3e2952=_0x3e2952-0x0;var _0x1641c6=_0x4453[_0x3e2952];return _0x1641c6;};var polly=require(_0x3445('0x0'));var lex=require(_0x3445('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a28e294..e210160 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 _0x9348=['exports','./lib/api'];(function(_0x196afe,_0x16c429){var _0x28195d=function(_0x2b163c){while(--_0x2b163c){_0x196afe['push'](_0x196afe['shift']());}};_0x28195d(++_0x16c429);}(_0x9348,0x10d));var _0x8934=function(_0x2b0650,_0x25e525){_0x2b0650=_0x2b0650-0x0;var _0x1a48b2=_0x9348[_0x2b0650];return _0x1a48b2;};'use strict';var lex=require(_0x8934('0x0'));module[_0x8934('0x1')]=function(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b){return lex(_0x472223,_0x135b2c,_0x46a231,_0x4a2577,_0x34d032,_0x35da0b);}; \ No newline at end of file +var _0x4ea3=['./lib/api','exports'];(function(_0x18540d,_0x44560f){var _0x4dbfa0=function(_0x3481a4){while(--_0x3481a4){_0x18540d['push'](_0x18540d['shift']());}};_0x4dbfa0(++_0x44560f);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ 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 cd2c3e9..75bba39 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(_0x17eadc,_0x178ca9){var _0x1f3950=function(_0x10c045){while(--_0x10c045){_0x17eadc['push'](_0x17eadc['shift']());}};_0x1f3950(++_0x178ca9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x3cb08f,_0x3ac2a2){var _0x7ad99=function(_0x3795bc){while(--_0x3795bc){_0x3cb08f['push'](_0x3cb08f['shift']());}};_0x7ad99(++_0x3ac2a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 f6d5d32..d7ada22 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 _0xe3f9=['exports','./lib/api'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xe3f9,0x177));var _0x9e3f=function(_0x5e08be,_0x9bf344){_0x5e08be=_0x5e08be-0x0;var _0x4db79e=_0xe3f9[_0x5e08be];return _0x4db79e;};'use strict';var polly=require(_0x9e3f('0x0'));module[_0x9e3f('0x1')]=function(_0x4dc03c,_0x1eff0d,_0x5358d4,_0xc78a77,_0x302852,_0x8aa32f,_0x548471){return polly(_0x4dc03c,_0x1eff0d,_0x5358d4,_0xc78a77,_0x302852,_0x8aa32f,_0x548471);}; \ No newline at end of file +var _0x57bb=['./lib/api','exports'];(function(_0x3fc009,_0xd589c){var _0x3d53e5=function(_0x46c1bb){while(--_0x46c1bb){_0x3fc009['push'](_0x3fc009['shift']());}};_0x3d53e5(++_0xd589c);}(_0x57bb,0x7e));var _0xb57b=function(_0x3dabf3,_0x3e2e7a){_0x3dabf3=_0x3dabf3-0x0;var _0x3bb999=_0x57bb[_0x3dabf3];return _0x3bb999;};'use strict';var polly=require(_0xb57b('0x0'));module[_0xb57b('0x1')]=function(_0x22e1a1,_0x2a3267,_0x2c5615,_0x5f5540,_0x348209,_0x3e4733,_0x251dcb){return polly(_0x22e1a1,_0x2a3267,_0x2c5615,_0x5f5540,_0x348209,_0x3e4733,_0x251dcb);}; \ 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 9f18b2e..9fe2d5a 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 _0xad1c=['aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird'];(function(_0x38bddc,_0x14ecba){var _0x4e45a3=function(_0x14adf1){while(--_0x14adf1){_0x38bddc['push'](_0x38bddc['shift']());}};_0x4e45a3(++_0x14ecba);}(_0xad1c,0x166));var _0xcad1=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xad1c[_0x1e7b16];return _0x37fadc;};'use strict';var fs=require('fs');var path=require(_0xcad1('0x0'));var BPromise=require(_0xcad1('0x1'));var rs=require('randomstring');var AWS=require(_0xcad1('0x2'));function pollyResult(_0x14bb5a,_0x18fb9a,_0x86ffd9){return new BPromise(function(_0x36b9be,_0x31d532){_0x14bb5a[_0xcad1('0x3')](_0x18fb9a,function(_0x1cf051,_0xef9ab){if(_0x1cf051){_0x31d532(_0x1cf051);}else if(_0xef9ab){if(_0xef9ab['AudioStream']instanceof Buffer){fs[_0xcad1('0x4')](_0x86ffd9,_0xef9ab[_0xcad1('0x5')],function(_0x6de4e2){if(_0x6de4e2){_0x31d532(_0x6de4e2);}else{_0x36b9be();}});}else{_0x31d532(new Error(_0xcad1('0x6')));}}else{_0x31d532(new Error(_0xcad1('0x7')));}});});}module[_0xcad1('0x8')]=function(_0x355106,_0x437c61,_0x49beef,_0x4c3cbc,_0x276d63,_0x42d430,_0x28b16a){var _0x451da6=new AWS[(_0xcad1('0x9'))]({'accessKeyId':_0x355106,'secretAccessKey':_0x437c61,'region':_0x49beef});var _0x59fe0b={'Text':_0x276d63,'TextType':_0x42d430||'text','OutputFormat':'mp3','VoiceId':_0x4c3cbc};return pollyResult(_0x451da6,_0x59fe0b,_0x28b16a);}; \ No newline at end of file +var _0x0df3=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path','randomstring','aws-sdk','AudioStream','writeFile'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x0df3,0xc1));var _0x30df=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x0df3[_0x3de7e0];return _0x11d0b3;};'use strict';var fs=require('fs');var path=require(_0x30df('0x0'));var BPromise=require('bluebird');var rs=require(_0x30df('0x1'));var AWS=require(_0x30df('0x2'));function pollyResult(_0x122371,_0x35b638,_0x582087){return new BPromise(function(_0x3bd78a,_0x571e6a){_0x122371['synthesizeSpeech'](_0x35b638,function(_0x1f3ea3,_0x114d63){if(_0x1f3ea3){_0x571e6a(_0x1f3ea3);}else if(_0x114d63){if(_0x114d63[_0x30df('0x3')]instanceof Buffer){fs[_0x30df('0x4')](_0x582087,_0x114d63['AudioStream'],function(_0x28798c){if(_0x28798c){_0x571e6a(_0x28798c);}else{_0x3bd78a();}});}else{_0x571e6a(new Error(_0x30df('0x5')));}}else{_0x571e6a(new Error(_0x30df('0x6')));}});});}module['exports']=function(_0x3309a3,_0x138fa4,_0x3c5a55,_0x27f2a9,_0x1cc1bf,_0x1500c5,_0x5b20c1){var _0x28c846=new AWS['Polly']({'accessKeyId':_0x3309a3,'secretAccessKey':_0x138fa4,'region':_0x3c5a55});var _0x33f2e1={'Text':_0x1cc1bf,'TextType':_0x1500c5||_0x30df('0x7'),'OutputFormat':_0x30df('0x8'),'VoiceId':_0x27f2a9};return pollyResult(_0x28c846,_0x33f2e1,_0x5b20c1);}; \ 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 46371ed..e2d32ec 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 _0xb470=['exports'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb470,0x129));var _0x0b47=function(_0x24cb62,_0xfc6d7){_0x24cb62=_0x24cb62-0x0;var _0x3f91f6=_0xb470[_0x24cb62];return _0x3f91f6;};'use strict';var asr=require('./lib/api');module[_0x0b47('0x0')]=function(_0x1f9840,_0x23d99e,_0x536ac6,_0x37756f){return asr(_0x1f9840,_0x23d99e,_0x536ac6);}; \ No newline at end of file +var _0x3be8=['exports','./lib/api'];(function(_0x297baa,_0xf6e9aa){var _0x41968e=function(_0x573085){while(--_0x573085){_0x297baa['push'](_0x297baa['shift']());}};_0x41968e(++_0xf6e9aa);}(_0x3be8,0x1e5));var _0x83be=function(_0x5049e1,_0x4ac87a){_0x5049e1=_0x5049e1-0x0;var _0x37f162=_0x3be8[_0x5049e1];return _0x37f162;};'use strict';var asr=require(_0x83be('0x0'));module[_0x83be('0x1')]=function(_0x1933ff,_0x311c26,_0x301767,_0x17b81d){return asr(_0x1933ff,_0x311c26,_0x301767);}; \ 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 8402547..2b826ec 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 _0x422f=['exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird'];(function(_0x184b6d,_0x2a260e){var _0x3abafa=function(_0x41f834){while(--_0x41f834){_0x184b6d['push'](_0x184b6d['shift']());}};_0x3abafa(++_0x2a260e);}(_0x422f,0x1c7));var _0xf422=function(_0x117994,_0x46bbbb){_0x117994=_0x117994-0x0;var _0x40814a=_0x422f[_0x117994];return _0x40814a;};'use strict';var url=require('url');var BPromise=require(_0xf422('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xf422('0x1')]=function(_0x2148ba,_0x55031a,_0x23acfa){return new BPromise(function(_0x172a93,_0x312bc8){var _0x444ad5;if(typeof _0x2148ba!==_0xf422('0x2')||_0x2148ba[_0xf422('0x3')]===0x0){return _0x312bc8(_0xf422('0x4'));}if(typeof _0x55031a!==_0xf422('0x2')||_0x55031a[_0xf422('0x3')]===0x0){return _0x312bc8('key\x20should\x20be\x20a\x20string');}if(typeof _0x23acfa!==_0xf422('0x5')&&(typeof _0x23acfa!==_0xf422('0x2')||_0x23acfa[_0xf422('0x3')]===0x0)){return _0x312bc8(_0xf422('0x6'));}try{_0x444ad5=fs[_0xf422('0x7')](_0x2148ba)['toString'](_0xf422('0x8'));}catch(_0x526c03){return _0x312bc8(_0x526c03);}return _0x172a93({'method':'POST','uri':host+_0xf422('0x9')+_0x55031a,'body':{'config':{'encoding':_0xf422('0xa'),'sampleRateHertz':_0xf422('0xb'),'languageCode':_0x23acfa},'audio':{'content':_0x444ad5}},'json':!![]});});}; \ No newline at end of file +var _0x4fdb=['toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','readFileSync'];(function(_0x2906c5,_0x3fc2e3){var _0x397ac0=function(_0x241f6a){while(--_0x241f6a){_0x2906c5['push'](_0x2906c5['shift']());}};_0x397ac0(++_0x3fc2e3);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x17b7a7,_0x5d50c3){_0x17b7a7=_0x17b7a7-0x0;var _0x42012e=_0x4fdb[_0x17b7a7];return _0x42012e;};'use strict';var url=require(_0xb4fd('0x0'));var BPromise=require(_0xb4fd('0x1'));var fs=require('fs');var host=_0xb4fd('0x2');module[_0xb4fd('0x3')]=function(_0x3b399e,_0xafe34b,_0x260a35){return new BPromise(function(_0xd55d8e,_0x1c0b08){var _0x5b73bb;if(typeof _0x3b399e!==_0xb4fd('0x4')||_0x3b399e['length']===0x0){return _0x1c0b08(_0xb4fd('0x5'));}if(typeof _0xafe34b!=='string'||_0xafe34b['length']===0x0){return _0x1c0b08(_0xb4fd('0x6'));}if(typeof _0x260a35!==_0xb4fd('0x7')&&(typeof _0x260a35!==_0xb4fd('0x4')||_0x260a35['length']===0x0)){return _0x1c0b08('lang\x20should\x20be\x20a\x20string');}try{_0x5b73bb=fs[_0xb4fd('0x8')](_0x3b399e)[_0xb4fd('0x9')](_0xb4fd('0xa'));}catch(_0x4eb1ae){return _0x1c0b08(_0x4eb1ae);}return _0xd55d8e({'method':_0xb4fd('0xb'),'uri':host+_0xb4fd('0xc')+_0xafe34b,'body':{'config':{'encoding':_0xb4fd('0xd'),'sampleRateHertz':_0xb4fd('0xe'),'languageCode':_0x260a35},'audio':{'content':_0x5b73bb}},'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 9b2fa2a..10cb4be 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 _0xd734=['exports','./asr'];(function(_0x5cc1b2,_0x2ead90){var _0x306fd4=function(_0x4fb55a){while(--_0x4fb55a){_0x5cc1b2['push'](_0x5cc1b2['shift']());}};_0x306fd4(++_0x2ead90);}(_0xd734,0x17b));var _0x4d73=function(_0x4dee0b,_0x123b81){_0x4dee0b=_0x4dee0b-0x0;var _0x2e6c2b=_0xd734[_0x4dee0b];return _0x2e6c2b;};var asr=require(_0x4d73('0x0'));module[_0x4d73('0x1')]={'asr':asr}; \ No newline at end of file +var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 742a38e..41bb9d4 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 _0x9f84=['length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','resolvedQuery','result','action','actionIncomplete','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','freeform=3','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','createWriteStream','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','generate','writeFileSync','base64','then','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','tmp','.mp3','chmodSync','.wav','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a'];(function(_0x4ca0ad,_0x514597){var _0x2bd33e=function(_0x204679){while(--_0x204679){_0x4ca0ad['push'](_0x4ca0ad['shift']());}};_0x2bd33e(++_0x514597);}(_0x9f84,0x14c));var _0x49f8=function(_0x551dc7,_0x395b19){_0x551dc7=_0x551dc7-0x0;var _0x1df540=_0x9f84[_0x551dc7];return _0x1df540;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x49f8('0x0'));var dialogflow=require(_0x49f8('0x1'));var fs=require('fs');var http=require(_0x49f8('0x2'));var https=require(_0x49f8('0x3'));var md5=require(_0x49f8('0x4'));var path=require(_0x49f8('0x5'));var querystring=require(_0x49f8('0x6'));var rp=require('request-promise');var rs=require(_0x49f8('0x7'));var sox=require(_0x49f8('0x8'));var tts=require(_0x49f8('0x9'));var urlParse=require(_0x49f8('0xa'))[_0x49f8('0xb')];var util=require(_0x49f8('0xc'));var aws=require('./aws');var google=require(_0x49f8('0xd'));var sestek=require('./sestek');var tilde=require(_0x49f8('0xe'));var logger=require(_0x49f8('0xf'))(_0x49f8('0x10'));var ISPEECH_API=_0x49f8('0x11');function downloadFile(_0x46e7b7,_0x371f5e){return new BPromise(function(_0x1ff899,_0x106a1f){var _0x50d457=urlParse(_0x46e7b7);var _0x589e42=_0x50d457['protocol']==='https:'?https:http;var _0x55b78b={'host':_0x50d457['host'],'path':_0x50d457[_0x49f8('0x5')],'headers':{'user-agent':_0x49f8('0x12')}};_0x589e42[_0x49f8('0x13')](_0x55b78b,function(_0x2d419c){if(_0x2d419c[_0x49f8('0x14')]!==0xc8){logger[_0x49f8('0x15')](_0x49f8('0x16')+_0x46e7b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d419c[_0x49f8('0x14')]+'\x20('+_0x2d419c[_0x49f8('0x17')]+')');_0x106a1f(new Error(_0x49f8('0x16')+_0x46e7b7+'\x20failed,\x20status\x20code\x20=\x20'+_0x2d419c[_0x49f8('0x14')]+'\x20('+_0x2d419c[_0x49f8('0x17')]+')'));return;}var _0x600d3=fs[_0x49f8('0x18')](_0x371f5e);_0x600d3['on']('finish',function(){logger[_0x49f8('0x19')](_0x49f8('0x1a'));_0x600d3[_0x49f8('0x1b')](_0x1ff899);});_0x600d3['on'](_0x49f8('0x15'),function(_0x359e0c){fs['unlink'](_0x371f5e);logger[_0x49f8('0x15')](_0x49f8('0x1c'),_0x359e0c);_0x106a1f(_0x359e0c);});_0x2d419c[_0x49f8('0x1d')](_0x600d3);})['on'](_0x49f8('0x15'),function(_0x193c22){logger['error'](_0x193c22);_0x106a1f(_0x193c22);})[_0x49f8('0x1e')]();});}function uploadFile(_0x185697){return new BPromise(function(_0x1aab31,_0x435b87){var _0x23aa86=urlParse(_0x185697);var _0x130a00=_0x23aa86[_0x49f8('0x1f')]==='https:'?https:http;var _0x342927={'host':_0x23aa86['host'],'path':_0x23aa86['path'],'headers':{'user-agent':_0x49f8('0x12')}};_0x130a00[_0x49f8('0x13')](_0x342927,function(_0x4fa192){if(_0x4fa192[_0x49f8('0x14')]!==0xc8){_0x435b87(new Error(_0x49f8('0x16')+_0x185697+_0x49f8('0x20')+_0x4fa192['statusCode']+'\x20('+_0x4fa192['statusMessage']+')'));return;}var _0xb4c47d='';_0x4fa192['on'](_0x49f8('0x21'),function(_0x5c8bd5){_0xb4c47d+=_0x5c8bd5;});_0x4fa192['on'](_0x49f8('0x1e'),function(){_0x1aab31(_0xb4c47d);});})['on'](_0x49f8('0x15'),function(_0x8a527f){_0x435b87(_0x8a527f);})[_0x49f8('0x1e')]();});}function convertFile(_0x7f1aad,_0x33f6af){return new BPromise(function(_0x5c652e,_0xc00c3e){var _0x187959=sox[_0x49f8('0x22')](_0x7f1aad,_0x33f6af,{'sampleRate':0x1f40,'format':_0x49f8('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x187959['on'](_0x49f8('0x15'),function(_0x1c2833){logger['error'](_0x49f8('0x24'),_0x1c2833);_0xc00c3e(_0x1c2833);});_0x187959['on'](_0x49f8('0x1e'),function(){logger['info'](_0x49f8('0x25'));_0x5c652e();});_0x187959[_0x49f8('0x26')]();});}function base64Decode(_0x3eb87d,_0x3554fd){var _0x5cecbf=path['resolve'](__dirname,'tmp',rs[_0x49f8('0x27')](0x4)+'.wav');fs[_0x49f8('0x28')](_0x5cecbf,_0x3eb87d,_0x49f8('0x29'));return convertFile(_0x5cecbf,_0x3554fd)[_0x49f8('0x2a')](function(){try{fs['unlink'](_0x5cecbf);fs['chmodSync'](_0x3554fd,_0x49f8('0x2b'));}catch(_0x8b8b97){logger['error'](_0x8b8b97);}return _0x3554fd[_0x49f8('0x2c')]('.')[0x0];});}function base64Encode(_0x22b977){var _0x131ca0=fs[_0x49f8('0x2d')](_0x22b977);return new Buffer(_0x131ca0)[_0x49f8('0x2e')](_0x49f8('0x29'));}exports[_0x49f8('0x2f')]=function(_0x52e419,_0x1d122f,_0x31d1a8,_0x12c7fe,_0x479b2e,_0xd1180){var _0x2a5b3a,_0x2db4e6;var _0x4fd8de='https://texttospeech.googleapis.com/v1/';var _0x1bfb2f=_0x49f8('0x30')+_0x52e419;var _0x4feb2e={};if(_0x1d122f===_0x49f8('0x31')){_0x4feb2e[_0x49f8('0x32')]={'ssml':_0x31d1a8};}else{_0x4feb2e[_0x49f8('0x32')]={'text':_0x31d1a8};};_0x4feb2e[_0x49f8('0x33')]={'languageCode':_0x12c7fe,'ssmlGender':_0x479b2e};_0x4feb2e[_0x49f8('0x34')]={'audioEncoding':_0x49f8('0x35'),'sampleRateHertz':0x1f40};var _0x5b1006={'url':_0x4fd8de+_0x49f8('0x36')+_0x1bfb2f,'method':_0x49f8('0x37'),'json':!![],'body':_0x4feb2e};return rp(_0x5b1006)[_0x49f8('0x2a')](function(_0x1362ab){return new BPromise(function(_0x5755b7,_0x602f89){_0x2a5b3a=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x18b1b7=Buffer['from'](_0x1362ab['audioContent'],_0x49f8('0x29'));return fs['writeFile'](_0x2a5b3a,_0x18b1b7,function(_0x4b6b6d){_0x602f89(_0x4b6b6d);},function(_0x5db4bc){fs[_0x49f8('0x3b')](_0x2a5b3a,_0x49f8('0x2b'));_0x5755b7(_0x5db4bc);});});})[_0x49f8('0x2a')](function(_0x4974e5){_0x2db4e6=path[_0x49f8('0x38')](__dirname,'tmp',rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c'));return convertFile(_0x2a5b3a,_0x2db4e6);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x2a5b3a);fs[_0x49f8('0x3b')](_0x2db4e6,_0x49f8('0x2b'));}catch(_0x54999e){logger[_0x49f8('0x15')](_0x54999e);}logger[_0x49f8('0x19')](_0x49f8('0x3e'),_0x2db4e6[_0x49f8('0x2c')]('.')[0x0]);return _0x2db4e6[_0x49f8('0x2c')]('.')[0x0];});};exports[_0x49f8('0x3f')]=function(_0x229f31,_0x2a320f){var _0x46d3fb=_0x49f8('0x40');var _0x360a70,_0x41ddda;var _0x4bb939;var _0x2025b1={'encoding':_0x49f8('0x41'),'method':_0x49f8('0x37'),'timeout':0x2710,'url':_0x46d3fb,'headers':{'Content-Type':_0x49f8('0x42')},'body':'f.req='+encodeURIComponent(JSON[_0x49f8('0x43')]([[[_0x49f8('0x44'),JSON[_0x49f8('0x43')]([_0x229f31,_0x2a320f||'en',![],_0x49f8('0x45')]),null,_0x49f8('0x46')]]]))};return rp(_0x2025b1)[_0x49f8('0x2a')](function(_0xba4641){try{_0x4bb939=eval(_0xba4641[_0x49f8('0x47')](0x5))[0x0][0x2];}catch(_0xde268b){throw new Error(_0x49f8('0x48')+_0xba4641['data']);}if(!_0x4bb939){if(_0x229f31[_0x49f8('0x49')]>0xc8){throw new Error(_0x49f8('0x4a'));}else{throw new Error(_0x49f8('0x4b')+_0x2a320f+_0x49f8('0x4c'));}}try{_0x4bb939=eval(_0x4bb939)[0x0];}catch(_0x4ce2fd){throw new Error(_0x49f8('0x48')+res['data']);}const _0x10f309=_0x4bb939;_0x360a70=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));fs[_0x49f8('0x28')](_0x360a70,_0x4bb939,{'encoding':_0x49f8('0x29')});_0x41ddda=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs['generate'](0x4)+_0x49f8('0x3c'));return convertFile(_0x360a70,_0x41ddda);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x360a70);fs['chmodSync'](_0x41ddda,_0x49f8('0x2b'));}catch(_0x1849ca){logger['error'](_0x1849ca);}logger[_0x49f8('0x19')](_0x49f8('0x4d'),_0x41ddda[_0x49f8('0x2c')]('.')[0x0]);return _0x41ddda[_0x49f8('0x2c')]('.')[0x0];});};exports['googleASR']=function(_0x58ebde,_0x14c91d,_0x29e263){return google[_0x49f8('0x4e')](_0x58ebde,_0x14c91d,_0x29e263)[_0x49f8('0x2a')](function(_0x5749c7){logger['info'](_0x5749c7['uri']);return rp(_0x5749c7);})[_0x49f8('0x2a')](function(_0x166ba9){var _0x23785b='';var _0x2637ca=0x0;try{fs['unlink'](_0x58ebde);}catch(_0x348f53){logger['error'](_0x348f53);}if(_0x166ba9&&_0x166ba9['results']){_0x23785b=_0x166ba9['results'][_0x49f8('0x4f')](function(_0x514056){return _0x514056&&_0x514056[_0x49f8('0x50')][0x0]&&_0x514056[_0x49f8('0x50')][0x0][_0x49f8('0x51')]?_0x514056[_0x49f8('0x50')][0x0]['transcript']:'';})[_0x49f8('0x52')]('\x0a');_0x2637ca=_0x166ba9[_0x49f8('0x53')][_0x49f8('0x4f')](function(_0x1793a7){return _0x1793a7&&_0x1793a7[_0x49f8('0x50')][0x0]&&_0x1793a7[_0x49f8('0x50')][0x0][_0x49f8('0x54')]?_0x1793a7['alternatives'][0x0][_0x49f8('0x54')]:0x0;})[_0x49f8('0x52')]('\x0a');}logger[_0x49f8('0x19')](_0x49f8('0x55'),_0x23785b);logger['info'](_0x49f8('0x56'),_0x2637ca);return{'transcript':_0x23785b,'confidence':_0x2637ca};})[_0x49f8('0x57')](function(_0x1eab9f){logger[_0x49f8('0x15')](_0x49f8('0x58'),_0x1eab9f[_0x49f8('0x14')],_0x1eab9f[_0x49f8('0x59')],_0x1eab9f[_0x49f8('0x5a')]);});};exports[_0x49f8('0x5b')]=function(_0x388182,_0x543441,_0x14b4c2,_0x58b24f){var _0x4b6f3c=apiai(_0x543441,{'language':_0x58b24f||'en'});return _0x4b6f3c['textRequest'](_0x14b4c2,{'sessionId':md5(_0x388182)})['then'](function(_0x3b7fe8){logger[_0x49f8('0x19')](JSON[_0x49f8('0x43')](_0x3b7fe8));return{'source':_0x3b7fe8['result']['source'],'resolvedQuery':_0x3b7fe8['result'][_0x49f8('0x5c')],'action':_0x3b7fe8[_0x49f8('0x5d')][_0x49f8('0x5e')],'actionIncomplete':_0x3b7fe8[_0x49f8('0x5d')][_0x49f8('0x5f')],'speech':_0x3b7fe8['result']['fulfillment'][_0x49f8('0x60')],'score':_0x3b7fe8['result'][_0x49f8('0x61')],'statusCode':_0x3b7fe8[_0x49f8('0x62')]['code'],'endConversation':_0x3b7fe8['result'][_0x49f8('0x63')][_0x49f8('0x64')]||![],'isFallbackIntent':_0x3b7fe8['result'][_0x49f8('0x63')][_0x49f8('0x65')]};});};exports[_0x49f8('0x66')]=function(_0x131f3a,_0x519490,_0x4a189a,_0x5c01ac,_0x4de0e9,_0x4e4c30){var _0x286ec3=_0x5c01ac[_0x49f8('0x67')](/\\n/g,'\x0a');var _0xa4fb76={'credentials':{'private_key':_0x286ec3,'client_email':_0x4a189a}};var _0x89267a=new dialogflow['SessionsClient'](_0xa4fb76);var _0x1aa532=_0x89267a[_0x49f8('0x68')](_0x519490,md5(_0x131f3a));var _0x5a6630={'session':_0x1aa532,'queryInput':{'text':{'text':_0x4de0e9,'languageCode':_0x4e4c30}}};return _0x89267a[_0x49f8('0x69')](_0x5a6630)[_0x49f8('0x2a')](function(_0x2b7a4c){if(_0x2b7a4c&&_0x2b7a4c[_0x49f8('0x49')]){logger[_0x49f8('0x19')]('Dialogflow\x20V2\x20response:',JSON[_0x49f8('0x43')](_0x2b7a4c));var _0x2060fe=_0x2b7a4c[0x0];if(_0x2060fe){var _0x55240b={'action':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x5e')],'allRequiredParamsPresent':_0x2060fe['queryResult'][_0x49f8('0x6b')],'endConversation':_0x2060fe[_0x49f8('0x6a')]['diagnosticInfo']&&_0x2060fe['queryResult'][_0x49f8('0x6c')][_0x49f8('0x6d')]?_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x6c')]['fields'][_0x49f8('0x6e')][_0x49f8('0x6f')]:![],'fulfillmentText':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x70')],'intentName':_0x2060fe['queryResult'][_0x49f8('0x71')][_0x49f8('0x59')],'intentDisplayName':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x71')][_0x49f8('0x72')],'isFallbackIntent':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x71')][_0x49f8('0x73')],'languageCode':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x74')],'queryText':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x75')],'responseId':_0x2060fe[_0x49f8('0x76')],'score':_0x2060fe[_0x49f8('0x6a')]['intentDetectionConfidence'],'speech':_0x2060fe[_0x49f8('0x6a')][_0x49f8('0x70')],'providerResponse':JSON[_0x49f8('0x43')](_0x2b7a4c)};return _0x55240b;}}});};exports[_0x49f8('0x77')]=function(_0x529bc9,_0x415e65,_0x1d04d0,_0x312b8e){return tilde[_0x49f8('0x4e')](_0x529bc9,_0x415e65,_0x1d04d0,_0x312b8e)[_0x49f8('0x2a')](function(_0x1525b1){try{fs[_0x49f8('0x3d')](_0x529bc9);}catch(_0x20e7d1){logger['error'](_0x20e7d1);}logger['info'](_0x49f8('0x78'),_0x1525b1['transcript']);logger[_0x49f8('0x19')]('Tilde\x20ASR\x20confidence',_0x1525b1[_0x49f8('0x54')]);return _0x1525b1;});};exports[_0x49f8('0x79')]=function(_0x1d175f,_0x37850d,_0x10ae22,_0x19200d,_0x1c20df,_0x3c5ad8){var _0x1b7ebb=path['resolve'](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x34f07f;return aws[_0x49f8('0x7a')](_0x1d175f,_0x37850d,_0x10ae22,_0x19200d,_0x1c20df,_0x3c5ad8,_0x1b7ebb)[_0x49f8('0x2a')](function(){_0x34f07f=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs['generate'](0x4)+_0x49f8('0x3c'));return convertFile(_0x1b7ebb,_0x34f07f);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x1b7ebb);fs[_0x49f8('0x3b')](_0x34f07f,_0x49f8('0x2b'));}catch(_0x561ff7){logger[_0x49f8('0x15')](_0x561ff7);}return _0x34f07f[_0x49f8('0x2c')]('.')[0x0];});};exports[_0x49f8('0x7b')]=function(_0x44b0a3,_0x2d4ca6,_0x196050,_0x4c809d,_0x520f9b,_0x40196a){return aws[_0x49f8('0x7c')](_0x44b0a3,_0x2d4ca6,_0x196050,_0x4c809d,_0x520f9b,_0x40196a)[_0x49f8('0x2a')](function(_0x2ff975){logger[_0x49f8('0x19')](JSON['stringify'](_0x2ff975));return _0x2ff975;});};exports[_0x49f8('0x7d')]=function(_0x579afd,_0x3cb725,_0x250b40,_0x2b42ab){var _0x80c959=util[_0x49f8('0x7e')](_0x49f8('0x7f'),ISPEECH_API,_0x579afd,encodeURIComponent(_0x3cb725),_0x250b40,_0x2b42ab);var _0x421143=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3a'));var _0x5589cf;return downloadFile(_0x80c959,_0x421143)[_0x49f8('0x2a')](function(){_0x5589cf=path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c'));return convertFile(_0x421143,_0x5589cf);})[_0x49f8('0x2a')](function(){try{fs[_0x49f8('0x3d')](_0x421143);fs['chmodSync'](_0x5589cf,'777');}catch(_0x2d50f7){logger[_0x49f8('0x15')](_0x2d50f7);}return _0x5589cf[_0x49f8('0x2c')]('.')[0x0];});};exports['ispeechASR']=function(_0x26c1c3,_0x5387cb,_0x3f81bb,_0x4cdbfd){var _0x3442c9=util[_0x49f8('0x7e')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5387cb,_0x3f81bb,base64Encode(_0x26c1c3),_0x4cdbfd?util[_0x49f8('0x7e')]('model=%s',encodeURIComponent(_0x4cdbfd)):_0x49f8('0x80'));return uploadFile(_0x3442c9)[_0x49f8('0x2a')](function(_0x34ddaa){return querystring['parse'](_0x34ddaa);});};exports['sestekNDA']=function(_0x5a614c,_0x42b541){return sestek[_0x49f8('0x81')](_0x5a614c,_0x42b541)['then'](function(_0x4399f9){logger[_0x49f8('0x19')](JSON[_0x49f8('0x43')](_0x4399f9));var _0x57d9b3={'speech':_0x4399f9[_0x49f8('0x82')],'action':_0x4399f9['channelData']?_0x4399f9[_0x49f8('0x83')][_0x49f8('0x84')]:undefined,'actiondata':_0x4399f9['channelData']?_0x4399f9[_0x49f8('0x83')][_0x49f8('0x85')]:undefined};if(_0x4399f9[_0x49f8('0x83')]&&_0x4399f9[_0x49f8('0x83')][_0x49f8('0x86')]){return base64Decode(_0x4399f9['channelData']['AudioFromTts']['Data'],path[_0x49f8('0x38')](__dirname,_0x49f8('0x39'),rs[_0x49f8('0x27')](0x4)+_0x49f8('0x3c')))['then'](function(_0x442390){_0x57d9b3['audiofile']=_0x442390;return _0x57d9b3;});}return _0x57d9b3;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xfb9a=['fields','end_conversation','boolValue','fulfillmentText','intent','name','displayName','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','md5','path','querystring','request-promise','randomstring','sox','url','parse','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','end','https:','data','transcode','wav','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','parse\x20response\x20failed:\x0a','googleASR','results','map','alternatives','transcript','confidence','join','catch','message','textRequest','result','actionIncomplete','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','sessionPath','detectIntent','action','queryResult','diagnosticInfo'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfb9a,0x190));var _0xafb9=function(_0x490fba,_0x50839c){_0x490fba=_0x490fba-0x0;var _0x39bb9d=_0xfb9a[_0x490fba];return _0x39bb9d;};'use strict';var apiai=require(_0xafb9('0x0'));var BPromise=require(_0xafb9('0x1'));var dialogflow=require(_0xafb9('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0xafb9('0x3'));var path=require(_0xafb9('0x4'));var querystring=require(_0xafb9('0x5'));var rp=require(_0xafb9('0x6'));var rs=require(_0xafb9('0x7'));var sox=require(_0xafb9('0x8'));var tts=require('google-tts-api');var urlParse=require(_0xafb9('0x9'))[_0xafb9('0xa')];var util=require('util');var aws=require(_0xafb9('0xb'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xafb9('0xc'));var logger=require(_0xafb9('0xd'))(_0xafb9('0xe'));var ISPEECH_API=_0xafb9('0xf');function downloadFile(_0x46da01,_0x4ed970){return new BPromise(function(_0x5e6a07,_0x16b283){var _0x37c2cc=urlParse(_0x46da01);var _0x963345=_0x37c2cc[_0xafb9('0x10')]==='https:'?https:http;var _0x1df5ac={'host':_0x37c2cc[_0xafb9('0x11')],'path':_0x37c2cc[_0xafb9('0x4')],'headers':{'user-agent':_0xafb9('0x12')}};_0x963345[_0xafb9('0x13')](_0x1df5ac,function(_0x3f8034){if(_0x3f8034[_0xafb9('0x14')]!==0xc8){logger[_0xafb9('0x15')]('request\x20to\x20'+_0x46da01+_0xafb9('0x16')+_0x3f8034[_0xafb9('0x14')]+'\x20('+_0x3f8034[_0xafb9('0x17')]+')');_0x16b283(new Error(_0xafb9('0x18')+_0x46da01+_0xafb9('0x16')+_0x3f8034[_0xafb9('0x14')]+'\x20('+_0x3f8034[_0xafb9('0x17')]+')'));return;}var _0x45cd9a=fs[_0xafb9('0x19')](_0x4ed970);_0x45cd9a['on'](_0xafb9('0x1a'),function(){logger['info'](_0xafb9('0x1b'));_0x45cd9a[_0xafb9('0x1c')](_0x5e6a07);});_0x45cd9a['on'](_0xafb9('0x15'),function(_0x1c3745){fs[_0xafb9('0x1d')](_0x4ed970);logger['error']('download\x20error',_0x1c3745);_0x16b283(_0x1c3745);});_0x3f8034['pipe'](_0x45cd9a);})['on'](_0xafb9('0x15'),function(_0x1b8427){logger[_0xafb9('0x15')](_0x1b8427);_0x16b283(_0x1b8427);})[_0xafb9('0x1e')]();});}function uploadFile(_0x33ffcf){return new BPromise(function(_0x179654,_0x28fd23){var _0x129027=urlParse(_0x33ffcf);var _0x5a2b9e=_0x129027[_0xafb9('0x10')]===_0xafb9('0x1f')?https:http;var _0x340321={'host':_0x129027[_0xafb9('0x11')],'path':_0x129027[_0xafb9('0x4')],'headers':{'user-agent':_0xafb9('0x12')}};_0x5a2b9e['get'](_0x340321,function(_0x4bdd56){if(_0x4bdd56[_0xafb9('0x14')]!==0xc8){_0x28fd23(new Error('request\x20to\x20'+_0x33ffcf+_0xafb9('0x16')+_0x4bdd56[_0xafb9('0x14')]+'\x20('+_0x4bdd56[_0xafb9('0x17')]+')'));return;}var _0xd286ae='';_0x4bdd56['on'](_0xafb9('0x20'),function(_0x716407){_0xd286ae+=_0x716407;});_0x4bdd56['on'](_0xafb9('0x1e'),function(){_0x179654(_0xd286ae);});})['on'](_0xafb9('0x15'),function(_0x15c89b){_0x28fd23(_0x15c89b);})[_0xafb9('0x1e')]();});}function convertFile(_0x199829,_0x3adf1c){return new BPromise(function(_0x47cf64,_0x2322bb){var _0x41382c=sox[_0xafb9('0x21')](_0x199829,_0x3adf1c,{'sampleRate':0x1f40,'format':_0xafb9('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x41382c['on'](_0xafb9('0x15'),function(_0x2025b8){logger[_0xafb9('0x15')]('error\x20convert',_0x2025b8);_0x2322bb(_0x2025b8);});_0x41382c['on'](_0xafb9('0x1e'),function(){logger[_0xafb9('0x23')](_0xafb9('0x24'));_0x47cf64();});_0x41382c[_0xafb9('0x25')]();});}function base64Decode(_0x43e969,_0x54cad3){var _0x44c649=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs[_0xafb9('0x28')](0x4)+_0xafb9('0x29'));fs[_0xafb9('0x2a')](_0x44c649,_0x43e969,_0xafb9('0x2b'));return convertFile(_0x44c649,_0x54cad3)[_0xafb9('0x2c')](function(){try{fs[_0xafb9('0x1d')](_0x44c649);fs['chmodSync'](_0x54cad3,_0xafb9('0x2d'));}catch(_0x3982d3){logger[_0xafb9('0x15')](_0x3982d3);}return _0x54cad3['split']('.')[0x0];});}function base64Encode(_0x5201cd){var _0x55fa17=fs[_0xafb9('0x2e')](_0x5201cd);return new Buffer(_0x55fa17)[_0xafb9('0x2f')](_0xafb9('0x2b'));}exports[_0xafb9('0x30')]=function(_0x3be832,_0x33123d,_0x106feb,_0x3a8b7d,_0x31c15e,_0x723e00){var _0x5ca355,_0x216707;var _0x3dfbaa=_0xafb9('0x31');var _0x19eaaf=_0xafb9('0x32')+_0x3be832;var _0x258efd={};if(_0x33123d==='ssml'){_0x258efd[_0xafb9('0x33')]={'ssml':_0x106feb};}else{_0x258efd[_0xafb9('0x33')]={'text':_0x106feb};};_0x258efd['voice']={'languageCode':_0x3a8b7d,'ssmlGender':_0x31c15e};_0x258efd[_0xafb9('0x34')]={'audioEncoding':_0xafb9('0x35'),'sampleRateHertz':0x1f40};var _0x5e9ff5={'url':_0x3dfbaa+_0xafb9('0x36')+_0x19eaaf,'method':_0xafb9('0x37'),'json':!![],'body':_0x258efd};return rp(_0x5e9ff5)[_0xafb9('0x2c')](function(_0x2a4cff){return new BPromise(function(_0x47bffe,_0x41322a){_0x5ca355=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs[_0xafb9('0x28')](0x4)+_0xafb9('0x38'));var _0x5978e1=Buffer['from'](_0x2a4cff[_0xafb9('0x39')],_0xafb9('0x2b'));return fs[_0xafb9('0x3a')](_0x5ca355,_0x5978e1,function(_0x1f9934){_0x41322a(_0x1f9934);},function(_0x3ba0cc){fs[_0xafb9('0x3b')](_0x5ca355,'777');_0x47bffe(_0x3ba0cc);});});})[_0xafb9('0x2c')](function(_0x21b6a8){_0x216707=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs[_0xafb9('0x28')](0x4)+_0xafb9('0x29'));return convertFile(_0x5ca355,_0x216707);})[_0xafb9('0x2c')](function(){try{fs[_0xafb9('0x1d')](_0x5ca355);fs['chmodSync'](_0x216707,'777');}catch(_0x3994d7){logger[_0xafb9('0x15')](_0x3994d7);}logger['info'](_0xafb9('0x3c'),_0x216707['split']('.')[0x0]);return _0x216707[_0xafb9('0x3d')]('.')[0x0];});};exports[_0xafb9('0x3e')]=function(_0x1471df,_0x33fe1d){var _0x1e229e='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x1ac0a1,_0x2979b1;var _0x5c0c29;var _0x5a6574={'encoding':_0xafb9('0x3f'),'method':_0xafb9('0x37'),'timeout':0x2710,'url':_0x1e229e,'headers':{'Content-Type':_0xafb9('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0xafb9('0x41')]([[[_0xafb9('0x42'),JSON['stringify']([_0x1471df,_0x33fe1d||'en',![],_0xafb9('0x43')]),null,'generic']]]))};return rp(_0x5a6574)['then'](function(_0x5ce6c2){try{_0x5c0c29=eval(_0x5ce6c2[_0xafb9('0x44')](0x5))[0x0][0x2];}catch(_0x2ef1dd){throw new Error('parse\x20response\x20failed:\x0a'+_0x5ce6c2[_0xafb9('0x20')]);}if(!_0x5c0c29){if(_0x1471df[_0xafb9('0x45')]>0xc8){throw new Error(_0xafb9('0x46'));}else{throw new Error(_0xafb9('0x47')+_0x33fe1d+'\x22\x20might\x20not\x20exist');}}try{_0x5c0c29=eval(_0x5c0c29)[0x0];}catch(_0x41e6a5){throw new Error(_0xafb9('0x48')+res['data']);}const _0x532baf=_0x5c0c29;_0x1ac0a1=path[_0xafb9('0x26')](__dirname,'tmp',rs[_0xafb9('0x28')](0x4)+_0xafb9('0x38'));fs[_0xafb9('0x2a')](_0x1ac0a1,_0x5c0c29,{'encoding':_0xafb9('0x2b')});_0x2979b1=path[_0xafb9('0x26')](__dirname,'tmp',rs[_0xafb9('0x28')](0x4)+'.wav');return convertFile(_0x1ac0a1,_0x2979b1);})[_0xafb9('0x2c')](function(){try{fs[_0xafb9('0x1d')](_0x1ac0a1);fs['chmodSync'](_0x2979b1,_0xafb9('0x2d'));}catch(_0x3b326e){logger['error'](_0x3b326e);}logger[_0xafb9('0x23')]('goggleTTS\x20path',_0x2979b1[_0xafb9('0x3d')]('.')[0x0]);return _0x2979b1['split']('.')[0x0];});};exports[_0xafb9('0x49')]=function(_0x124d10,_0x62f76f,_0x129e13){return google['asr'](_0x124d10,_0x62f76f,_0x129e13)['then'](function(_0x3f46e2){logger[_0xafb9('0x23')](_0x3f46e2['uri']);return rp(_0x3f46e2);})[_0xafb9('0x2c')](function(_0x1fb9db){var _0x29f58f='';var _0x140dfe=0x0;try{fs['unlink'](_0x124d10);}catch(_0x98baa5){logger['error'](_0x98baa5);}if(_0x1fb9db&&_0x1fb9db[_0xafb9('0x4a')]){_0x29f58f=_0x1fb9db[_0xafb9('0x4a')][_0xafb9('0x4b')](function(_0x3b9803){return _0x3b9803&&_0x3b9803[_0xafb9('0x4c')][0x0]&&_0x3b9803[_0xafb9('0x4c')][0x0][_0xafb9('0x4d')]?_0x3b9803[_0xafb9('0x4c')][0x0][_0xafb9('0x4d')]:'';})['join']('\x0a');_0x140dfe=_0x1fb9db[_0xafb9('0x4a')][_0xafb9('0x4b')](function(_0x361cd8){return _0x361cd8&&_0x361cd8[_0xafb9('0x4c')][0x0]&&_0x361cd8[_0xafb9('0x4c')][0x0][_0xafb9('0x4e')]?_0x361cd8[_0xafb9('0x4c')][0x0][_0xafb9('0x4e')]:0x0;})[_0xafb9('0x4f')]('\x0a');}logger[_0xafb9('0x23')]('googleASR\x20transcription',_0x29f58f);logger[_0xafb9('0x23')]('googleASR\x20confidence',_0x140dfe);return{'transcript':_0x29f58f,'confidence':_0x140dfe};})[_0xafb9('0x50')](function(_0x9a0843){logger[_0xafb9('0x15')]('[%s]\x20%s:%s',_0x9a0843['statusCode'],_0x9a0843['name'],_0x9a0843[_0xafb9('0x51')]);});};exports['googleDialogflow']=function(_0x337816,_0x606f6b,_0x31e49a,_0x3f6501){var _0x40307b=apiai(_0x606f6b,{'language':_0x3f6501||'en'});return _0x40307b[_0xafb9('0x52')](_0x31e49a,{'sessionId':md5(_0x337816)})[_0xafb9('0x2c')](function(_0x5cff37){logger[_0xafb9('0x23')](JSON[_0xafb9('0x41')](_0x5cff37));return{'source':_0x5cff37['result']['source'],'resolvedQuery':_0x5cff37[_0xafb9('0x53')]['resolvedQuery'],'action':_0x5cff37[_0xafb9('0x53')]['action'],'actionIncomplete':_0x5cff37[_0xafb9('0x53')][_0xafb9('0x54')],'speech':_0x5cff37[_0xafb9('0x53')]['fulfillment']['speech'],'score':_0x5cff37['result'][_0xafb9('0x55')],'statusCode':_0x5cff37['status'][_0xafb9('0x56')],'endConversation':_0x5cff37[_0xafb9('0x53')][_0xafb9('0x57')][_0xafb9('0x58')]||![],'isFallbackIntent':_0x5cff37[_0xafb9('0x53')][_0xafb9('0x57')][_0xafb9('0x59')]};});};exports[_0xafb9('0x5a')]=function(_0x1dd3ca,_0x217be1,_0x2db089,_0x306f49,_0x508228,_0x319313){var _0x3387d8=_0x306f49['replace'](/\\n/g,'\x0a');var _0x2eb7fb={'credentials':{'private_key':_0x3387d8,'client_email':_0x2db089}};var _0x4b5fa4=new dialogflow['SessionsClient'](_0x2eb7fb);var _0x38fae6=_0x4b5fa4[_0xafb9('0x5b')](_0x217be1,md5(_0x1dd3ca));var _0x5d83e2={'session':_0x38fae6,'queryInput':{'text':{'text':_0x508228,'languageCode':_0x319313}}};return _0x4b5fa4[_0xafb9('0x5c')](_0x5d83e2)[_0xafb9('0x2c')](function(_0xafd49d){if(_0xafd49d&&_0xafd49d[_0xafb9('0x45')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0xafb9('0x41')](_0xafd49d));var _0x2a22ae=_0xafd49d[0x0];if(_0x2a22ae){var _0x9449bd={'action':_0x2a22ae['queryResult'][_0xafb9('0x5d')],'allRequiredParamsPresent':_0x2a22ae[_0xafb9('0x5e')]['allRequiredParamsPresent'],'endConversation':_0x2a22ae['queryResult'][_0xafb9('0x5f')]&&_0x2a22ae[_0xafb9('0x5e')]['diagnosticInfo'][_0xafb9('0x60')]?_0x2a22ae['queryResult'][_0xafb9('0x5f')][_0xafb9('0x60')][_0xafb9('0x61')][_0xafb9('0x62')]:![],'fulfillmentText':_0x2a22ae[_0xafb9('0x5e')][_0xafb9('0x63')],'intentName':_0x2a22ae['queryResult'][_0xafb9('0x64')][_0xafb9('0x65')],'intentDisplayName':_0x2a22ae[_0xafb9('0x5e')]['intent'][_0xafb9('0x66')],'isFallbackIntent':_0x2a22ae[_0xafb9('0x5e')][_0xafb9('0x64')]['isFallback'],'languageCode':_0x2a22ae[_0xafb9('0x5e')]['languageCode'],'queryText':_0x2a22ae[_0xafb9('0x5e')]['queryText'],'responseId':_0x2a22ae['responseId'],'score':_0x2a22ae[_0xafb9('0x5e')][_0xafb9('0x67')],'speech':_0x2a22ae[_0xafb9('0x5e')][_0xafb9('0x63')],'providerResponse':JSON[_0xafb9('0x41')](_0xafd49d)};return _0x9449bd;}}});};exports[_0xafb9('0x68')]=function(_0x27df8f,_0x2bd14d,_0x291232,_0x402c73){return tilde[_0xafb9('0x69')](_0x27df8f,_0x2bd14d,_0x291232,_0x402c73)[_0xafb9('0x2c')](function(_0x461419){try{fs['unlink'](_0x27df8f);}catch(_0x91cfc6){logger[_0xafb9('0x15')](_0x91cfc6);}logger[_0xafb9('0x23')]('Tilde\x20ASR\x20transcription',_0x461419[_0xafb9('0x4d')]);logger[_0xafb9('0x23')](_0xafb9('0x6a'),_0x461419[_0xafb9('0x4e')]);return _0x461419;});};exports['awsPolly']=function(_0x8ed325,_0xa7140a,_0x1dd73d,_0x21bf15,_0x4f52e3,_0x12d85d){var _0x507489=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs['generate'](0x4)+_0xafb9('0x38'));var _0x273621;return aws[_0xafb9('0x6b')](_0x8ed325,_0xa7140a,_0x1dd73d,_0x21bf15,_0x4f52e3,_0x12d85d,_0x507489)[_0xafb9('0x2c')](function(){_0x273621=path['resolve'](__dirname,_0xafb9('0x27'),rs[_0xafb9('0x28')](0x4)+_0xafb9('0x29'));return convertFile(_0x507489,_0x273621);})[_0xafb9('0x2c')](function(){try{fs[_0xafb9('0x1d')](_0x507489);fs[_0xafb9('0x3b')](_0x273621,_0xafb9('0x2d'));}catch(_0x5d2ef8){logger[_0xafb9('0x15')](_0x5d2ef8);}return _0x273621[_0xafb9('0x3d')]('.')[0x0];});};exports[_0xafb9('0x6c')]=function(_0x2652c3,_0x5f52cd,_0x829bdc,_0x28f3ba,_0x27fd14,_0x441787){return aws[_0xafb9('0x6d')](_0x2652c3,_0x5f52cd,_0x829bdc,_0x28f3ba,_0x27fd14,_0x441787)[_0xafb9('0x2c')](function(_0x2386c1){logger['info'](JSON[_0xafb9('0x41')](_0x2386c1));return _0x2386c1;});};exports[_0xafb9('0x6e')]=function(_0x1268f3,_0x2f0053,_0x64d62f,_0x4a8df2){var _0x37a50e=util[_0xafb9('0x6f')](_0xafb9('0x70'),ISPEECH_API,_0x1268f3,encodeURIComponent(_0x2f0053),_0x64d62f,_0x4a8df2);var _0x41ebdd=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs['generate'](0x4)+_0xafb9('0x38'));var _0x12d679;return downloadFile(_0x37a50e,_0x41ebdd)[_0xafb9('0x2c')](function(){_0x12d679=path[_0xafb9('0x26')](__dirname,_0xafb9('0x27'),rs['generate'](0x4)+_0xafb9('0x29'));return convertFile(_0x41ebdd,_0x12d679);})['then'](function(){try{fs['unlink'](_0x41ebdd);fs[_0xafb9('0x3b')](_0x12d679,_0xafb9('0x2d'));}catch(_0x2371f0){logger[_0xafb9('0x15')](_0x2371f0);}return _0x12d679['split']('.')[0x0];});};exports[_0xafb9('0x71')]=function(_0xa7acd9,_0x75e8a0,_0x1c0a2b,_0x2b3c6b){var _0x5654e6=util[_0xafb9('0x6f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x75e8a0,_0x1c0a2b,base64Encode(_0xa7acd9),_0x2b3c6b?util[_0xafb9('0x6f')](_0xafb9('0x72'),encodeURIComponent(_0x2b3c6b)):'freeform=3');return uploadFile(_0x5654e6)['then'](function(_0x17eb38){return querystring[_0xafb9('0xa')](_0x17eb38);});};exports[_0xafb9('0x73')]=function(_0x470e59,_0x10ebbe){return sestek[_0xafb9('0x74')](_0x470e59,_0x10ebbe)[_0xafb9('0x2c')](function(_0x4d23cc){logger[_0xafb9('0x23')](JSON[_0xafb9('0x41')](_0x4d23cc));var _0x56a82f={'speech':_0x4d23cc[_0xafb9('0x75')],'action':_0x4d23cc[_0xafb9('0x76')]?_0x4d23cc[_0xafb9('0x76')]['CustomAction']:undefined,'actiondata':_0x4d23cc[_0xafb9('0x76')]?_0x4d23cc['channelData'][_0xafb9('0x77')]:undefined};if(_0x4d23cc[_0xafb9('0x76')]&&_0x4d23cc[_0xafb9('0x76')][_0xafb9('0x78')]){return base64Decode(_0x4d23cc[_0xafb9('0x76')][_0xafb9('0x78')][_0xafb9('0x79')],path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav'))[_0xafb9('0x2c')](function(_0x4adfe3){_0x56a82f[_0xafb9('0x7a')]=_0x4adfe3;return _0x56a82f;});}return _0x56a82f;});};exports[_0xafb9('0x7b')]=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 13389dd..87edf39 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 _0x5d4f=['exports','./nda'];(function(_0x3e182f,_0x380ec7){var _0x23edc9=function(_0x3ca65e){while(--_0x3ca65e){_0x3e182f['push'](_0x3e182f['shift']());}};_0x23edc9(++_0x380ec7);}(_0x5d4f,0x147));var _0xf5d4=function(_0x474aeb,_0x5b2974){_0x474aeb=_0x474aeb-0x0;var _0x3d2ecd=_0x5d4f[_0x474aeb];return _0x3d2ecd;};var nda=require(_0xf5d4('0x0'));module[_0xf5d4('0x1')]={'nda':nda}; \ No newline at end of file +var _0x3eeb=['./nda','exports'];(function(_0x99ff92,_0x22da12){var _0x30ec01=function(_0xc152fb){while(--_0xc152fb){_0x99ff92['push'](_0x99ff92['shift']());}};_0x30ec01(++_0x22da12);}(_0x3eeb,0x176));var _0xb3ee=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3eeb[_0x397e5f];return _0x5302b8;};var nda=require(_0xb3ee('0x0'));module[_0xb3ee('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 385e551..c528032 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 _0x84e1=['dnid','extension','text','Bearer\x20','access_token','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname'];(function(_0x22a215,_0x41888a){var _0x4f23ec=function(_0x1caa1e){while(--_0x1caa1e){_0x22a215['push'](_0x22a215['shift']());}};_0x4f23ec(++_0x41888a);}(_0x84e1,0x1dc));var _0x184e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x84e1[_0x465a0c];return _0x1e202e;};'use strict';var rp=require(_0x184e('0x0'));var url=require(_0x184e('0x1'));var logger=require(_0x184e('0x2'))(_0x184e('0x3'));module[_0x184e('0x4')]=function(_0x4df769,_0x5c6973){var _0x6947f1={'method':_0x184e('0x5'),'uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0x7')],_0x184e('0x8')),'form':{'grant_type':_0x184e('0x9'),'username':_0x5c6973[_0x184e('0xa')],'password':_0x5c6973['password']},'json':!![]};return rp(_0x6947f1)[_0x184e('0xb')](function(_0xa32654){var _0x1e79b2={'method':'POST','uri':url[_0x184e('0x6')](_0x5c6973[_0x184e('0xc')],_0x184e('0xd')),'body':{'type':_0x5c6973[_0x184e('0xe')]||'message','channelId':_0x184e('0xf'),'conversation':{'id':_0x4df769[_0x184e('0x10')]},'from':{'id':_0x4df769[_0x184e('0x11')],'name':_0x4df769[_0x184e('0x12')]},'recipient':{'id':_0x4df769[_0x184e('0x13')],'name':_0x4df769[_0x184e('0x14')]},'text':_0x5c6973[_0x184e('0x15')],'channelData':{}},'headers':{'Authorization':_0x184e('0x16')+_0xa32654[_0x184e('0x17')]},'json':!![]};if(_0x5c6973[_0x184e('0x18')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')]['ProjectName']=_0x5c6973[_0x184e('0x18')];}if(_0x5c6973['ndagenerate_audio']=='1'){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x184e('0x1c')};}if(_0x5c6973[_0x184e('0x1d')]){_0x1e79b2[_0x184e('0x19')][_0x184e('0x1a')][_0x184e('0x1e')]=_0x5c6973[_0x184e('0x1d')];if(_0x5c6973['custom_action_data']){_0x1e79b2[_0x184e('0x19')]['channelData'][_0x184e('0x1f')]=_0x5c6973['custom_action_data'];}}logger['info'](JSON[_0x184e('0x20')](_0x1e79b2));return rp(_0x1e79b2);});}; \ No newline at end of file +var _0xffe1=['stringify','request-promise','url','agi','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','body','channelData','ProjectName','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0x59b9a7,_0x1301df){var _0x30e486=function(_0x416ad3){while(--_0x416ad3){_0x59b9a7['push'](_0x59b9a7['shift']());}};_0x30e486(++_0x1301df);}(_0xffe1,0x187));var _0x1ffe=function(_0x247474,_0x2a68f9){_0x247474=_0x247474-0x0;var _0x253912=_0xffe1[_0x247474];return _0x253912;};'use strict';var rp=require(_0x1ffe('0x0'));var url=require(_0x1ffe('0x1'));var logger=require('../../../../../config/logger')(_0x1ffe('0x2'));module['exports']=function(_0x102969,_0x492bbc){var _0x26b457={'method':_0x1ffe('0x3'),'uri':url[_0x1ffe('0x4')](_0x492bbc[_0x1ffe('0x5')],_0x1ffe('0x6')),'form':{'grant_type':_0x1ffe('0x7'),'username':_0x492bbc[_0x1ffe('0x8')],'password':_0x492bbc[_0x1ffe('0x7')]},'json':!![]};return rp(_0x26b457)[_0x1ffe('0x9')](function(_0x548bc9){var _0x1c6bdb={'method':'POST','uri':url[_0x1ffe('0x4')](_0x492bbc['ndassistant_url'],_0x1ffe('0xa')),'body':{'type':_0x492bbc['ndaactivity_type']||_0x1ffe('0xb'),'channelId':_0x1ffe('0xc'),'conversation':{'id':_0x102969[_0x1ffe('0xd')]},'from':{'id':_0x102969[_0x1ffe('0xe')],'name':_0x102969[_0x1ffe('0xf')]},'recipient':{'id':_0x102969[_0x1ffe('0x10')],'name':_0x102969[_0x1ffe('0x11')]},'text':_0x492bbc[_0x1ffe('0x12')],'channelData':{}},'headers':{'Authorization':_0x1ffe('0x13')+_0x548bc9['access_token']},'json':!![]};if(_0x492bbc['project']){_0x1c6bdb[_0x1ffe('0x14')][_0x1ffe('0x15')][_0x1ffe('0x16')]=_0x492bbc[_0x1ffe('0x17')];}if(_0x492bbc[_0x1ffe('0x18')]=='1'){_0x1c6bdb[_0x1ffe('0x14')][_0x1ffe('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1ffe('0x19')};}if(_0x492bbc[_0x1ffe('0x1a')]){_0x1c6bdb[_0x1ffe('0x14')][_0x1ffe('0x15')][_0x1ffe('0x1b')]=_0x492bbc[_0x1ffe('0x1a')];if(_0x492bbc[_0x1ffe('0x1c')]){_0x1c6bdb['body']['channelData']['CustomActionData']=_0x492bbc[_0x1ffe('0x1c')];}}logger['info'](JSON[_0x1ffe('0x1d')](_0x1c6bdb));return rp(_0x1c6bdb);});}; \ 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 bdf7bce..0b0921a 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 _0x4b87=['exports'];(function(_0x1cb039,_0x5e88ea){var _0x40cb7d=function(_0x1f7996){while(--_0x1f7996){_0x1cb039['push'](_0x1cb039['shift']());}};_0x40cb7d(++_0x5e88ea);}(_0x4b87,0xcd));var _0x74b8=function(_0x2262e8,_0x5257b0){_0x2262e8=_0x2262e8-0x0;var _0x58422f=_0x4b87[_0x2262e8];return _0x58422f;};'use strict';var asr=require('./lib/api');module[_0x74b8('0x0')]=function(_0x57008c,_0x3995c4,_0x535709,_0x6cc861){return asr(_0x57008c,_0x3995c4,_0x535709,_0x6cc861);}; \ No newline at end of file +var _0x6fe3=['exports','./lib/api'];(function(_0x20c82b,_0x3c7811){var _0x1de78a=function(_0x4ec321){while(--_0x4ec321){_0x20c82b['push'](_0x20c82b['shift']());}};_0x1de78a(++_0x3c7811);}(_0x6fe3,0x193));var _0x36fe=function(_0x4d7379,_0x4b4e63){_0x4d7379=_0x4d7379-0x0;var _0x46d7cf=_0x6fe3[_0x4d7379];return _0x46d7cf;};'use strict';var asr=require(_0x36fe('0x0'));module[_0x36fe('0x1')]=function(_0x30548f,_0x5d537a,_0xf1e668,_0x5b4908){return asr(_0x30548f,_0x5d537a,_0xf1e668,_0x5b4908);}; \ 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 ee5c80b..8479053 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 _0x91e2=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','info','unix','send','stringify','data','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0x91e2,0x169));var _0x291e=function(_0x3beac1,_0x1ba6cc){_0x3beac1=_0x3beac1-0x0;var _0x32cd74=_0x91e2[_0x3beac1];return _0x32cd74;};'use strict';var BPromise=require(_0x291e('0x0'));var _=require(_0x291e('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x291e('0x2'));var crypto=require(_0x291e('0x3'));var logger=require(_0x291e('0x4'))(_0x291e('0x5'));module[_0x291e('0x6')]=function(_0x26b7b4,_0x4b384f,_0x6c330c,_0x1022a4){return new BPromise(function(_0x27d04f,_0x295194){logger['info'](_0x291e('0x7'),_0x1022a4||_0x291e('0x8'));var _0x8edd0f=new WebSocket(_0x1022a4||_0x291e('0x8'),{'perMessageDeflate':![]});var _0x3c563d='';var _0x74ce4e='0';var _0x2d5f14='1';var _0x48c5b3=_0x291e('0x9');function _0x1f04ef(_0x267fae){var _0x16b404=crypto[_0x291e('0xa')](_0x291e('0xb'));_0x16b404[_0x291e('0xc')](_0x267fae);return _0x16b404['digest'](_0x291e('0xd'));}function _0x34b915(){try{logger[_0x291e('0xe')]('Open\x20Tilde\x20ASR\x20socket');var _0x14a2c1=moment()[_0x291e('0xf')]();var _0x2d2952=_0x1f04ef(_0x14a2c1+_0x4b384f+_0x6c330c);_0x8edd0f[_0x291e('0x10')](JSON[_0x291e('0x11')]({'appID':_0x4b384f,'timestamp':_0x14a2c1,'appKey':_0x2d2952}));var _0x2939f3=fs['createReadStream'](_0x26b7b4);_0x2939f3['on'](_0x291e('0x12'),function(_0x2c74cc){_0x8edd0f[_0x291e('0x10')](_0x2c74cc);});_0x2939f3['on']('close',function(){_0x8edd0f[_0x291e('0x10')]('EOS');});}catch(_0x5da1f9){logger[_0x291e('0x13')](_0x291e('0x14'),JSON[_0x291e('0x11')](_0x5da1f9));_0x8edd0f[_0x291e('0x15')]();}}function _0x481550(_0x2173cc){try{if(_0x2173cc){var _0x5c53d8=JSON[_0x291e('0x16')](_0x2173cc);switch(_0x5c53d8[_0x291e('0x17')]){case 0x0:if(_0x5c53d8[_0x291e('0x18')]){if(_0x5c53d8[_0x291e('0x18')][_0x291e('0x19')]){logger['info'](_0x291e('0x1a'),JSON[_0x291e('0x11')](_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')]));_0x3c563d=_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')][0x0][_0x291e('0x1c')];_0x74ce4e=_0x5c53d8[_0x291e('0x18')][_0x291e('0x1b')][0x0][_0x291e('0x1d')];_0x2d5f14='0';_0x48c5b3='Success.';_0x8edd0f[_0x291e('0x15')]();}}break;case 0x1:logger[_0x291e('0xe')](_0x291e('0x9'));_0x2d5f14='1';_0x48c5b3=_0x291e('0x9');break;case 0x2:logger[_0x291e('0xe')](_0x291e('0x1e'));_0x2d5f14='2';_0x48c5b3='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d5f14='9';_0x48c5b3=_0x291e('0x1f');break;case 0xa:logger[_0x291e('0xe')](_0x291e('0x20'));_0x2d5f14='10';_0x48c5b3=_0x291e('0x20');break;case 0xb:logger[_0x291e('0xe')](_0x291e('0x21'));_0x2d5f14='11';_0x48c5b3=_0x291e('0x21');}}}catch(_0x563ea5){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x291e('0x11')](_0x563ea5));_0x8edd0f[_0x291e('0x15')]();}}function _0x397ba6(){logger[_0x291e('0xe')](_0x291e('0x22'));_0x27d04f({'transcript':_0x3c563d,'confidence':_0x74ce4e,'status':_0x2d5f14,'status_message':_0x48c5b3});}function _0x22514c(_0x43d0c0){logger[_0x291e('0x13')](_0x291e('0x23'));if(!_[_0x291e('0x24')](_0x43d0c0)){logger[_0x291e('0x13')](_[_0x291e('0x25')](_0x43d0c0)?JSON[_0x291e('0x11')](_0x43d0c0):_0x43d0c0);}}_0x8edd0f['on'](_0x291e('0x26'),_0x34b915);_0x8edd0f['on'](_0x291e('0x27'),_0x481550);_0x8edd0f['on'](_0x291e('0x28'),_0x397ba6);_0x8edd0f['on']('error',_0x22514c);});}; \ No newline at end of file +var _0x7402=['Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','error','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','unix','stringify','createReadStream','data','send','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','likelihood','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.'];(function(_0x211f7d,_0x347068){var _0x3bad98=function(_0x1749c5){while(--_0x1749c5){_0x211f7d['push'](_0x211f7d['shift']());}};_0x3bad98(++_0x347068);}(_0x7402,0x76));var _0x2740=function(_0x5e5b5e,_0x1d4bde){_0x5e5b5e=_0x5e5b5e-0x0;var _0x296489=_0x7402[_0x5e5b5e];return _0x296489;};'use strict';var BPromise=require(_0x2740('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2740('0x1'));var crypto=require('crypto');var logger=require(_0x2740('0x2'))(_0x2740('0x3'));module[_0x2740('0x4')]=function(_0x2376ba,_0x314c2f,_0x46763f,_0x43f7ea){return new BPromise(function(_0x4a14ae,_0x2f8d3b){logger[_0x2740('0x5')]('Tilde\x20URI',_0x43f7ea||_0x2740('0x6'));var _0x9db570=new WebSocket(_0x43f7ea||_0x2740('0x6'),{'perMessageDeflate':![]});var _0x112300='';var _0x294482='0';var _0x2bead6='1';var _0x30b746='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x12173e(_0x32ff67){var _0x22383b=crypto[_0x2740('0x7')](_0x2740('0x8'));_0x22383b['update'](_0x32ff67);return _0x22383b[_0x2740('0x9')](_0x2740('0xa'));}function _0x416e7c(){try{logger[_0x2740('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x5840a1=moment()[_0x2740('0xb')]();var _0x3a6bd0=_0x12173e(_0x5840a1+_0x314c2f+_0x46763f);_0x9db570['send'](JSON[_0x2740('0xc')]({'appID':_0x314c2f,'timestamp':_0x5840a1,'appKey':_0x3a6bd0}));var _0x1a4bbb=fs[_0x2740('0xd')](_0x2376ba);_0x1a4bbb['on'](_0x2740('0xe'),function(_0x2f1a22){_0x9db570[_0x2740('0xf')](_0x2f1a22);});_0x1a4bbb['on'](_0x2740('0x10'),function(){_0x9db570[_0x2740('0xf')](_0x2740('0x11'));});}catch(_0x397b38){logger['error'](_0x2740('0x12'),JSON[_0x2740('0xc')](_0x397b38));_0x9db570[_0x2740('0x13')]();}}function _0x8e43bc(_0x148174){try{if(_0x148174){var _0x53b3d9=JSON[_0x2740('0x14')](_0x148174);switch(_0x53b3d9[_0x2740('0x15')]){case 0x0:if(_0x53b3d9[_0x2740('0x16')]){if(_0x53b3d9[_0x2740('0x16')]['final']){logger[_0x2740('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x2740('0xc')](_0x53b3d9[_0x2740('0x16')][_0x2740('0x17')]));_0x112300=_0x53b3d9['result'][_0x2740('0x17')][0x0]['transcript'];_0x294482=_0x53b3d9[_0x2740('0x16')][_0x2740('0x17')][0x0][_0x2740('0x18')];_0x2bead6='0';_0x30b746='Success.';_0x9db570[_0x2740('0x13')]();}}break;case 0x1:logger[_0x2740('0x5')](_0x2740('0x19'));_0x2bead6='1';_0x30b746=_0x2740('0x19');break;case 0x2:logger['info'](_0x2740('0x1a'));_0x2bead6='2';_0x30b746=_0x2740('0x1a');break;case 0x9:logger[_0x2740('0x5')](_0x2740('0x1b'));_0x2bead6='9';_0x30b746=_0x2740('0x1b');break;case 0xa:logger[_0x2740('0x5')](_0x2740('0x1c'));_0x2bead6='10';_0x30b746=_0x2740('0x1c');break;case 0xb:logger[_0x2740('0x5')](_0x2740('0x1d'));_0x2bead6='11';_0x30b746=_0x2740('0x1d');}}}catch(_0xb00b9e){logger['error'](_0x2740('0x1e'),JSON[_0x2740('0xc')](_0xb00b9e));_0x9db570[_0x2740('0x13')]();}}function _0xa2b010(){logger[_0x2740('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x4a14ae({'transcript':_0x112300,'confidence':_0x294482,'status':_0x2bead6,'status_message':_0x30b746});}function _0x4b7d2e(_0xb972e7){logger['error'](_0x2740('0x1f'));if(!_[_0x2740('0x20')](_0xb972e7)){logger[_0x2740('0x21')](_[_0x2740('0x22')](_0xb972e7)?JSON[_0x2740('0xc')](_0xb972e7):_0xb972e7);}}_0x9db570['on'](_0x2740('0x23'),_0x416e7c);_0x9db570['on'](_0x2740('0x24'),_0x8e43bc);_0x9db570['on'](_0x2740('0x10'),_0xa2b010);_0x9db570['on'](_0x2740('0x21'),_0x4b7d2e);});}; \ No newline at end of file diff --git a/server/services/agi/scripts/tilde/index.js b/server/services/agi/scripts/tilde/index.js index 10cb4be..8f4cdb1 100644 --- a/server/services/agi/scripts/tilde/index.js +++ b/server/services/agi/scripts/tilde/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0x08f3=['exports','./asr'];(function(_0x33e982,_0x1d15b1){var _0x2d3668=function(_0x3c16d5){while(--_0x3c16d5){_0x33e982['push'](_0x33e982['shift']());}};_0x2d3668(++_0x1d15b1);}(_0x08f3,0x1f1));var _0x308f=function(_0x163a99,_0x410470){_0x163a99=_0x163a99-0x0;var _0x69ca8d=_0x08f3[_0x163a99];return _0x69ca8d;};var asr=require(_0x308f('0x0'));module[_0x308f('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index f5f4268..e221050 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x5a2299,_0x3e2922){var _0xedff0f=function(_0x1624cb){while(--_0x1624cb){_0x5a2299['push'](_0x5a2299['shift']());}};_0xedff0f(++_0x3e2922);}(_0xe706,0xa3));var _0x6e70=function(_0x277d61,_0xab8c96){_0x277d61=_0x277d61-0x0;var _0x34f6e1=_0xe706[_0x277d61];return _0x34f6e1;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 982df2a..9d24d7d 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 _0x6c76=['accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','list_id','scheduledAt','callback','toString','getPause','getPauseById','agentPause','agent','isNil','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','url','timeout','number','includes','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','Amy','awsLex','aws_access_key_id','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','length','isString','saveRestApiResult','isArray','%s.%s','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','createSquareDetailsReport','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','noop','no\x20grammar\x20configured','grammar','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','no\x20list\x20selected','delay','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','setVariable','DIALOGFLOW_%s','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','true','false','condition','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','toLowerCase','QUEUE','macro','gosub','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','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','saydigits','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','sendMail\x20message','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','START\x20CALLY\x20SQUARE','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','randomstring','moment','../../config/logger','agi','../../config/environment/shared','./scripts','rawHeaders','getdigits','getsecretdigits','channel','rpc','mailRpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareOdbc','dsn','getUser','getTrunk','getTrunkById','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','info','close','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','agicommand','createSquareRecording','callerid','calleridname','context','extension','priority'];(function(_0x4b980d,_0x32fc6a){var _0x5c7974=function(_0x3b7af4){while(--_0x3b7af4){_0x4b980d['push'](_0x4b980d['shift']());}};_0x5c7974(++_0x32fc6a);}(_0x6c76,0x184));var _0x66c7=function(_0x488838,_0xfc56d0){_0x488838=_0x488838-0x0;var _0x1c8741=_0x6c76[_0x488838];return _0x1c8741;};'use strict';var fs=require('fs');var util=require(_0x66c7('0x0'));var _=require(_0x66c7('0x1'));var sh=require(_0x66c7('0x2'));var odbc=require('odbc')();var rs=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var Mustache=require('mustache');var rp=require('request-promise');var logger=require(_0x66c7('0x5'))(_0x66c7('0x6'));var config=require('../../config/environment');var shared=require(_0x66c7('0x7'));var scripts=require(_0x66c7('0x8'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x66c7('0x9'),'rawBody'];var verticesWithRetry=['menu',_0x66c7('0xa'),_0x66c7('0xb')];var AGIVertices=function(_0x24349f,_0x53a81c,_0x20c010){this[_0x66c7('0xc')]=_0x24349f;this[_0x66c7('0xd')]=_0x53a81c;this[_0x66c7('0xe')]=_0x20c010;};AGIVertices['prototype'][_0x66c7('0xf')]=function(_0x45db57,_0x26c9b2){this[_0x66c7('0xd')][_0x66c7('0x10')](_0x45db57)[_0x66c7('0x11')](function(_0x174717){_0x26c9b2(null,_0x174717?_0x174717['name']:![]);})[_0x66c7('0x12')](function(_0x760e36){_0x26c9b2(_0x760e36);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14')]=function(_0x4f6c91,_0x1e91d1){this[_0x66c7('0xd')][_0x66c7('0x15')](_0x4f6c91)[_0x66c7('0x11')](function(_0x5d44e1){_0x1e91d1(null,_0x5d44e1?_0x5d44e1[_0x66c7('0x16')]:![]);})['catch'](function(_0x208010){_0x1e91d1(_0x208010);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x17')]=function(_0x42e930,_0x22b262){this['rpc']['getSquareProjectById'](_0x42e930)['then'](function(_0x5129f6){_0x22b262(null,_0x5129f6?_0x5129f6[_0x66c7('0x16')]:![]);})[_0x66c7('0x12')](function(_0x47a299){_0x22b262(_0x47a299);});};AGIVertices['prototype'][_0x66c7('0x18')]=function(_0x9b65cf,_0x4756f7){this[_0x66c7('0xd')]['getSquareOdbcById'](_0x9b65cf)['then'](function(_0x1853b2){_0x4756f7(null,_0x1853b2?_0x1853b2[_0x66c7('0x19')]:![]);})[_0x66c7('0x12')](function(_0x1c43c4){_0x4756f7(_0x1c43c4);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1a')]=function(_0x4804cf,_0x4ddbd2){this[_0x66c7('0xd')]['getUserById'](_0x4804cf)[_0x66c7('0x11')](function(_0x8b96b1){_0x4ddbd2(null,_0x8b96b1?_0x8b96b1[_0x66c7('0x16')]:![]);})[_0x66c7('0x12')](function(_0x5bfaf6){_0x4ddbd2(_0x5bfaf6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1b')]=function(_0x5b28e6,_0x2ae31f){this[_0x66c7('0xd')][_0x66c7('0x1c')](_0x5b28e6)[_0x66c7('0x11')](function(_0x2af0a3){_0x2ae31f(null,_0x2af0a3?_0x2af0a3['name']:![]);})['catch'](function(_0x4e514a){_0x2ae31f(_0x4e514a);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1d')]=function(_0x5c5e42,_0x9afd50){var _0x3e979d=this;this[_0x66c7('0xd')][_0x66c7('0x1e')](_0x5c5e42)[_0x66c7('0x11')](function(_0x27be81){_0x9afd50(null,_0x27be81?_0x3e979d['getSoundPath'](_0x27be81[_0x66c7('0x1f')]):![]);})[_0x66c7('0x12')](function(_0xc4b2bf){_0x9afd50(_0xc4b2bf);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x20')]=function(_0x592f0e,_0x263b48){this['rpc'][_0x66c7('0x21')](_0x592f0e)['then'](function(_0x296875){_0x263b48(null,_0x296875?_0x296875:![]);})[_0x66c7('0x12')](function(_0x29f292){_0x263b48(_0x29f292);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x22')]=function(_0x24e776,_0x559ab9,_0x520bd2){this[_0x66c7('0xe')][_0x66c7('0x22')](_0x24e776,_0x559ab9)[_0x66c7('0x11')](function(){_0x520bd2(null);})[_0x66c7('0x12')](function(_0x344345){_0x520bd2(_0x344345);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x23')]=function(_0x255ac3,_0x15edc8){this[_0x66c7('0xd')][_0x66c7('0x24')](_0x255ac3)[_0x66c7('0x11')](function(_0x4eb03f){if(_0x4eb03f){if(_0x4eb03f['IntervalId']){_0x15edc8(null,[_0x4eb03f[_0x66c7('0x25')]]);}else{_0x15edc8(null,_[_0x66c7('0x26')](_0x4eb03f[_0x66c7('0x27')],_0x66c7('0x25')));}}else{_0x15edc8(null,![]);}})[_0x66c7('0x12')](function(_0x2bf7c2){_0x15edc8(_0x2bf7c2);});};AGIVertices[_0x66c7('0x13')]['getSoundPath']=function(_0x30b90f){return util[_0x66c7('0x28')](_0x66c7('0x29'),FILES_PATH,_0x30b90f);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x2a')]=function(_0x324696,_0x3c8638,_0x2b3ac1){odbc[_0x66c7('0x2b')](_0x324696,function(_0x274c45){if(_0x274c45){logger[_0x66c7('0x2c')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x274c45);_0x2b3ac1(_0x274c45);}else{logger['info'](_0x66c7('0x2d'));odbc[_0x66c7('0x2e')](_0x3c8638,function(_0xc63941,_0x540c6a){if(_0xc63941){logger['info'](_0x66c7('0x2f'),_0x3c8638);_0x2b3ac1(_0xc63941);}else{logger[_0x66c7('0x30')]('Query\x20executed\x20correctly\x20%s',_0x3c8638);odbc[_0x66c7('0x31')](function(_0x6e9796){if(_0x6e9796){logger[_0x66c7('0x2c')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x6e9796);}_0x2b3ac1(null,_0x540c6a);});}});}});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x32')]=function(_0x9f6ca8,_0x14d59c){this[_0x66c7('0xd')][_0x66c7('0x33')](_0x9f6ca8)[_0x66c7('0x11')](function(_0x279d27){_0x14d59c(null,_0x279d27?_0x279d27:![]);})[_0x66c7('0x12')](function(_0x5f34ed){_0x14d59c(_0x5f34ed);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x34')]=function(_0xd91797,_0x17a1e8){this[_0x66c7('0xd')][_0x66c7('0x34')](_0xd91797)[_0x66c7('0x11')](function(_0x750adc){_0x17a1e8(null,_0x750adc);})[_0x66c7('0x12')](function(_0x3d371a){_0x17a1e8(_0x3d371a);});};AGIVertices['prototype']['createSquareDetailsReport']=function(_0x528f5c,_0x209f58,_0x1661e8){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'node':_0x528f5c[_0x66c7('0x36')],'application':_0x528f5c[_0x66c7('0x37')],'data':_0x209f58||null,'project_name':this[_0x66c7('0xc')]['arg_1'],'callerid':this[_0x66c7('0xc')]['callerid']})['then'](function(_0x370ae2){if(_0x1661e8){_0x1661e8(null,_0x370ae2);}})[_0x66c7('0x12')](function(_0x39062a){if(_0x1661e8){_0x1661e8(_0x39062a);}});};AGIVertices[_0x66c7('0x13')]['createSquareRecording']=function(_0x5cf5c1,_0x3e89f8,_0x52506a,_0x4e0c89){this[_0x66c7('0xd')][_0x66c7('0x38')]({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'callerid':this['channel'][_0x66c7('0x39')],'calleridname':this[_0x66c7('0xc')][_0x66c7('0x3a')],'context':this['channel'][_0x66c7('0x3b')],'extension':this[_0x66c7('0xc')][_0x66c7('0x3c')],'priority':this[_0x66c7('0xc')][_0x66c7('0x3d')],'accountcode':this[_0x66c7('0xc')][_0x66c7('0x3e')],'dnid':this[_0x66c7('0xc')]['dnid'],'projectName':this[_0x66c7('0xc')][_0x66c7('0x3f')],'saveName':_0x3e89f8,'filename':_0x5cf5c1[_0x66c7('0x40')]||_0x3e89f8,'savePath':_0x52506a})[_0x66c7('0x11')](function(_0x208a15){_0x4e0c89(null,_0x208a15);})[_0x66c7('0x12')](function(_0x2cd0c6){_0x4e0c89(_0x2cd0c6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x41')]=function(_0x2d8eeb,_0x9e2346,_0x1096e3,_0x5b343a,_0x186dfd){this['rpc'][_0x66c7('0x41')]({'uniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'body':_0x2d8eeb,'direction':_0x9e2346,'providerName':_0x1096e3,'providerResponse':_0x5b343a})[_0x66c7('0x11')](function(_0x533ff5){if(_0x186dfd){_0x186dfd(null,_0x533ff5);}})[_0x66c7('0x12')](function(_0x1a159f){if(_0x186dfd){_0x186dfd(_0x1a159f);}});};AGIVertices['prototype'][_0x66c7('0x42')]=function(_0x2affe4,_0xe4304c){this[_0x66c7('0xd')][_0x66c7('0x42')]({'firstName':_[_0x66c7('0x43')](_0x2affe4[_0x66c7('0x16')])||_['isNil'](_0x2affe4[_0x66c7('0x16')])?_0x66c7('0x44')+Math['random']():_0x2affe4[_0x66c7('0x16')],'lastName':_[_0x66c7('0x43')](_0x2affe4[_0x66c7('0x45')])||_['isNil'](_0x2affe4[_0x66c7('0x45')])?null:_0x2affe4[_0x66c7('0x45')],'phone':_0x2affe4[_0x66c7('0x46')],'ListId':_0x2affe4[_0x66c7('0x47')],'scheduledat':_0x2affe4[_0x66c7('0x48')],'callbackUniqueid':this[_0x66c7('0xc')][_0x66c7('0x35')],'tags':_0x66c7('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x2affe4[_0x66c7('0x48')][_0x66c7('0x4a')](),'priority':_0x2affe4['callback_priority']})[_0x66c7('0x11')](function(_0x167968){_0xe4304c(null,_0x167968);})[_0x66c7('0x12')](function(_0x577d19){_0xe4304c(_0x577d19);});};AGIVertices['prototype'][_0x66c7('0x4b')]=function(_0x5388e1,_0x3c8fd9){this[_0x66c7('0xd')][_0x66c7('0x4c')](_0x5388e1)[_0x66c7('0x11')](function(_0xebff6b){_0x3c8fd9(null,_0xebff6b?_0xebff6b[_0x66c7('0x16')]:![]);})['catch'](function(_0x58f938){_0x3c8fd9(_0x58f938);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x4d')]=function(_0x5e6e32,_0x5a4908,_0x157369){var _0x5004aa={'role':_0x66c7('0x4e')};_0x5004aa[_0x5e6e32]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')]['agentPause'](_0x5004aa,_0x5a4908,this[_0x66c7('0xc')][_0x66c7('0x35')])[_0x66c7('0x11')](function(_0x2659f5){_0x157369(null,_[_0x66c7('0x4f')](_0x2659f5)?![]:!![]);})[_0x66c7('0x12')](function(_0x4ec465){logger[_0x66c7('0x2c')](_0x4ec465);_0x157369(null,![]);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x50')]=function(_0x5352ec,_0xd27aa4){var _0x5cb63e={'role':_0x66c7('0x4e')};_0x5cb63e[_0x5352ec]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')][_0x66c7('0x50')](_0x5cb63e)[_0x66c7('0x11')](function(_0x4b36d2){_0xd27aa4(null,_[_0x66c7('0x4f')](_0x4b36d2)?![]:!![]);})[_0x66c7('0x12')](function(_0x2d9069){logger[_0x66c7('0x2c')](_0x2d9069);_0xd27aa4(null,![]);});};AGIVertices[_0x66c7('0x13')]['agentLogout']=function(_0x463c15,_0x1cb5ef){var _0x429096={'role':_0x66c7('0x4e')};_0x429096[_0x463c15]=this[_0x66c7('0xc')][_0x66c7('0x39')];this[_0x66c7('0xd')][_0x66c7('0x51')](_0x429096)[_0x66c7('0x11')](function(_0x1a4e2b){_0x1cb5ef(null,_[_0x66c7('0x4f')](_0x1a4e2b)?![]:!![]);})[_0x66c7('0x12')](function(_0x50f72d){logger[_0x66c7('0x2c')](_0x50f72d);_0x1cb5ef(null,![]);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x52')]=function(_0x213757,_0x1a7e10){var _0x419b49={'role':_0x66c7('0x4e')};_0x419b49[_0x213757]=this['channel'][_0x66c7('0x39')];var _0x2943f3=_0x213757!=_0x66c7('0x53')?util[_0x66c7('0x28')](_0x66c7('0x54'),_0x66c7('0x55'),this[_0x66c7('0xc')][_0x66c7('0x39')]):undefined;this[_0x66c7('0xd')][_0x66c7('0x52')](_0x419b49,_0x2943f3)[_0x66c7('0x11')](function(_0x450b14){_0x1a7e10(null,_[_0x66c7('0x4f')](_0x450b14)?![]:!![]);})[_0x66c7('0x12')](function(_0x2b25e7){logger[_0x66c7('0x2c')](_0x2b25e7);_0x1a7e10(null,![]);});};AGIVertices['prototype'][_0x66c7('0x56')]=function(_0x31bc19,_0x43a623){sh[_0x66c7('0x57')](_[_0x66c7('0x58')](_0x31bc19),function(_0x2c9af2,_0x3133f5){var _0x3ee5b3=_0x3133f5[_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'');_0x43a623(null,_0x3ee5b3);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x5a')]=function(_0x326a6c,_0x2476e6){scripts[_0x66c7('0x5a')](_0x326a6c[_0x66c7('0x5b')],_0x326a6c[_0x66c7('0x5c')]||_0x66c7('0x5d'),_0x326a6c['text'],_0x326a6c[_0x66c7('0x5e')]||_0x66c7('0x5f'),_0x326a6c[_0x66c7('0x60')]||_0x66c7('0x61'),_0x326a6c[_0x66c7('0x62')]||_0x66c7('0x63'))['then'](function(_0x4de349){_0x2476e6(null,_0x4de349);})[_0x66c7('0x12')](function(_0x59b45f){_0x2476e6(_0x59b45f);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x64')]=function(_0x367b59,_0x139529){scripts[_0x66c7('0x64')](_0x367b59[_0x66c7('0x5d')],_0x367b59[_0x66c7('0x65')]||'en',0x1)[_0x66c7('0x11')](function(_0x1f0a06){_0x139529(null,_0x1f0a06);})[_0x66c7('0x12')](function(_0x3b8a45){_0x139529(_0x3b8a45);});};AGIVertices[_0x66c7('0x13')]['restAPI']=function(_0x25f193,_0x2b4f98){var _0x30634c={'uri':_0x25f193[_0x66c7('0x66')],'method':_0x25f193['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x25f193[_0x66c7('0x67')])===_0x66c7('0x68')&&parseInt(_0x25f193['timeout'])>=0x1?parseInt(_0x25f193[_0x66c7('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x66c7('0x69')]([_0x66c7('0x6a'),_0x66c7('0x6b')],_0x30634c[_0x66c7('0x6c')][_0x66c7('0x6d')]())){try{_0x30634c['body']=_0x25f193['rawBody']?JSON[_0x66c7('0x6e')](_0x25f193['rawBody']):{};}catch(_0x570a63){logger[_0x66c7('0x2c')](_0x66c7('0x6f'),_0x570a63);}}try{_0x30634c[_0x66c7('0x70')]=_0x25f193[_0x66c7('0x9')]?JSON[_0x66c7('0x6e')](_0x25f193[_0x66c7('0x9')]):{};}catch(_0x11de69){logger[_0x66c7('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x11de69);}if(_0x25f193[_0x66c7('0x71')]){try{var _0x508e2c=require(_0x25f193[_0x66c7('0x71')])[_0x66c7('0x72')](this,_0x30634c);_0x30634c[_0x66c7('0x73')]=Mustache[_0x66c7('0x74')](_0x25f193[_0x66c7('0x66')],_0x508e2c,{},['$$','$$']);if(_0x30634c[_0x66c7('0x70')]){_0x30634c[_0x66c7('0x70')]=JSON[_0x66c7('0x6e')](Mustache[_0x66c7('0x74')](JSON[_0x66c7('0x75')](_0x30634c[_0x66c7('0x70')]),_0x508e2c,{},['$$','$$']));}if(_0x30634c[_0x66c7('0x76')]){_0x30634c[_0x66c7('0x76')]=JSON[_0x66c7('0x6e')](Mustache[_0x66c7('0x74')](JSON[_0x66c7('0x75')](_0x30634c[_0x66c7('0x76')]),_0x508e2c,{},['$$','$$']));}}catch(_0x12e91b){logger[_0x66c7('0x2c')](_0x66c7('0x77'),_0x12e91b);}}rp(_0x30634c)[_0x66c7('0x11')](function(_0x300ff4){var _0x418090={'statusCode':_0x300ff4[_0x66c7('0x78')]||0xc8,'statusMessage':_0x300ff4[_0x66c7('0x79')]||'OK','headers':_0x300ff4['headers']||{},'body':_0x300ff4[_0x66c7('0x76')]||{}};_0x2b4f98(null,_0x418090);})[_0x66c7('0x12')](function(_0x94bae8){var _0x5a163c={'statusCode':_0x94bae8[_0x66c7('0x78')]||0x1f4,'statusMessage':_0x94bae8[_0x66c7('0x7a')]||_0x66c7('0x7b'),'headers':_0x94bae8['options'][_0x66c7('0x70')]||{},'body':_0x94bae8[_0x66c7('0x7c')][_0x66c7('0x76')]||{}};_0x2b4f98(null,_0x5a163c);});};AGIVertices['prototype'][_0x66c7('0x7d')]=function(_0x131aaf,_0x280cdc){scripts[_0x66c7('0x7d')](this['channel'][_0x66c7('0x35')],_0x131aaf[_0x66c7('0x7e')],_0x131aaf[_0x66c7('0x5d')],_0x131aaf[_0x66c7('0x7f')]||'en')['then'](function(_0x596f63){_0x280cdc(null,_0x596f63);})[_0x66c7('0x12')](function(_0x2f3f75){_0x280cdc(_0x2f3f75);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x80')]=function(_0x114f47,_0x50f3de){scripts[_0x66c7('0x80')](this[_0x66c7('0xc')][_0x66c7('0x35')],_0x114f47[_0x66c7('0x81')],_0x114f47[_0x66c7('0x82')],_0x114f47['private_key'],_0x114f47[_0x66c7('0x5d')],_0x114f47[_0x66c7('0x83')]||'en')[_0x66c7('0x11')](function(_0x10b7d5){_0x50f3de(null,_0x10b7d5);})[_0x66c7('0x12')](function(_0x4310e6){_0x50f3de(_0x4310e6);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x84')]=function(_0x50e2f2,_0x32fb79){scripts[_0x66c7('0x84')](this[_0x66c7('0xc')],_0x50e2f2)['then'](function(_0x2cf267){_0x32fb79(null,_0x2cf267);})[_0x66c7('0x12')](function(_0x41ba9a){_0x32fb79(_0x41ba9a);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x85')]=function(_0x2e528e,_0x13d121){scripts[_0x66c7('0x85')](_0x2e528e['key'],_0x2e528e[_0x66c7('0x5d')],_0x2e528e[_0x66c7('0x86')]||_0x66c7('0x5f'),_0x2e528e[_0x66c7('0x87')])[_0x66c7('0x11')](function(_0x39f425){_0x13d121(null,_0x39f425);})['catch'](function(_0x475272){_0x13d121(_0x475272);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x88')]=function(_0x223ab1,_0x12085a,_0x14608f){scripts[_0x66c7('0x88')](_0x12085a,_0x223ab1[_0x66c7('0x7e')],_0x223ab1['ispeech_asr_language']||_0x66c7('0x5f'),this[_0x66c7('0x89')](_0x223ab1[_0x66c7('0x8a')])?_0x223ab1['model']:undefined)[_0x66c7('0x11')](function(_0x2f0bf0){_0x14608f(null,_0x2f0bf0);})[_0x66c7('0x12')](function(_0x3dd1f5){_0x14608f(_0x3dd1f5);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x8b')]=function(_0x108a52,_0x4c2f20){scripts[_0x66c7('0x8b')](_0x108a52['aws_access_key_id'],_0x108a52['aws_secret_access_key'],_0x108a52['aws_polly_region'],_0x108a52['aws_polly_voice']||_0x66c7('0x8c'),_0x108a52[_0x66c7('0x5d')],_0x108a52['aws_text_type']||'text')[_0x66c7('0x11')](function(_0xd733d1){_0x4c2f20(null,_0xd733d1);})['catch'](function(_0x4fdce4){_0x4c2f20(_0x4fdce4);});};AGIVertices[_0x66c7('0x13')]['awsLex']=function(_0x564f39,_0x917faf){scripts[_0x66c7('0x8d')](this['channel'][_0x66c7('0x35')],_0x564f39[_0x66c7('0x8e')],_0x564f39[_0x66c7('0x8f')],_0x564f39[_0x66c7('0x90')],_0x564f39[_0x66c7('0x5d')],_0x564f39[_0x66c7('0x91')])[_0x66c7('0x11')](function(_0x41bc8d){_0x917faf(null,_0x41bc8d);})[_0x66c7('0x12')](function(_0x491146){_0x917faf(_0x491146);});};AGIVertices[_0x66c7('0x13')]['googleASR']=function(_0x364168,_0x2ff10b,_0x500bc1){scripts[_0x66c7('0x92')](_0x2ff10b,_0x364168[_0x66c7('0x7e')],_0x364168[_0x66c7('0x93')]||_0x66c7('0x5f'))[_0x66c7('0x11')](function(_0x5d575e){_0x500bc1(null,_0x5d575e);})[_0x66c7('0x12')](function(_0x5c463c){_0x500bc1(_0x5c463c);});};AGIVertices[_0x66c7('0x13')][_0x66c7('0x94')]=function(_0x2eda7a,_0x368abf,_0x389d62){scripts[_0x66c7('0x94')](_0x368abf,_0x2eda7a[_0x66c7('0x95')],_0x2eda7a['appsecret'],_0x2eda7a['uri'])[_0x66c7('0x11')](function(_0x4f5494){_0x389d62(null,_0x4f5494);})['catch'](function(_0x4cc48d){_0x389d62(_0x4cc48d);});};AGIVertices[_0x66c7('0x13')]['clear']=function(_0x30f8d8){var _0x6dac20=_[_0x66c7('0x69')](verticesWithRetry,_0x30f8d8['agicommand'])?_0x30f8d8:_[_0x66c7('0x96')](_0x30f8d8);for(var _0x5376d7 in _0x6dac20){if(_0x6dac20[_0x66c7('0x97')](_0x5376d7)){if(_0x6dac20[_0x5376d7]&&_['isString'](_0x6dac20[_0x5376d7])){if(_[_0x66c7('0x69')](recursiveMapAttributes,_0x5376d7)){_0x6dac20[_0x5376d7]=this[_0x66c7('0x98')](_0x6dac20[_0x5376d7]);}else{_0x6dac20[_0x5376d7]=this[_0x66c7('0x99')](_0x6dac20[_0x5376d7]);}}}}return _0x6dac20;};AGIVertices[_0x66c7('0x13')][_0x66c7('0x9a')]=function(_0x18f46f){for(var _0x1912a6 in _0x18f46f){if(_0x18f46f['hasOwnProperty'](_0x1912a6)){if(_[_0x66c7('0x9b')](_0x18f46f[_0x1912a6])){this['recursiveNodeIndex'](_0x18f46f[_0x1912a6]);}else if(_['isArray'](_0x18f46f[_0x1912a6])){for(var _0x36e332=0x0;_0x36e332<_0x18f46f[_0x1912a6][_0x66c7('0x9c')];_0x36e332++){this[_0x66c7('0x9a')](_0x18f46f[_0x1912a6][_0x36e332]);}}else if(_[_0x66c7('0x9d')](_0x18f46f[_0x1912a6])){_0x18f46f[_0x1912a6]=this[_0x66c7('0x99')](_0x18f46f[_0x1912a6]);}}}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x9e')]=function(_0x2d06a0,_0x30c228){for(var _0x73399 in _0x2d06a0){if(_0x2d06a0[_0x66c7('0x97')](_0x73399)){if(_[_0x66c7('0x9b')](_0x2d06a0[_0x73399])){if(!_[_0x66c7('0x43')](_0x2d06a0[_0x73399])){this['saveRestApiResult'](_0x2d06a0[_0x73399],util[_0x66c7('0x28')]('%s.%s',_0x30c228,_0x73399));}}else if(_[_0x66c7('0x9f')](_0x2d06a0[_0x73399])){for(var _0x225b6d=0x0;_0x225b6d<_0x2d06a0[_0x73399][_0x66c7('0x9c')];_0x225b6d++){this[_0x66c7('0x9e')](_0x2d06a0[_0x73399][_0x225b6d],util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x30c228,_0x73399+'['+_0x225b6d+']'));}}else{if(!_['isNil'](_0x2d06a0[_0x73399])){this['channel']['setVariable'](util['format']('%s.%s',_0x30c228,_0x73399),_0x2d06a0[_0x73399]);}}}}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x98')]=function(_0x11826c){try{var _0x315891=JSON['parse'](_0x11826c);this['recursiveNodeIndex'](_0x315891);return JSON[_0x66c7('0x75')](_0x315891);}catch(_0x2345be){return this['replaceAllVariables'](_0x11826c);}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x99')]=function(_0x5a23c4){var _0x16965c=_0x5a23c4[_0x66c7('0xa1')]('{');for(var _0x1656be=0x1;_0x1656be<_0x16965c[_0x66c7('0x9c')];_0x1656be+=0x1){var _0x5c9135=_0x16965c[_0x1656be]['split']('}');if(_0x5c9135[_0x66c7('0x9c')]>0x1){_0x5a23c4=_0x5a23c4[_0x66c7('0xa2')]('{'+_0x5c9135[0x0]+'}',this[_0x66c7('0xc')][_0x66c7('0xf')](_0x5c9135[0x0])[_0x66c7('0xa3')]||_0x5c9135[0x0]);}}if(_0x16965c[_0x66c7('0x9c')]===0x1){return _0x5a23c4[_0x66c7('0x4a')]();}return this[_0x66c7('0x99')](_0x5a23c4);};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa4')]=function(_0x487240,_0xf9c623){var _0x27b7f0=this[_0x66c7('0xc')][_0x66c7('0xf')](_0x487240);if(_0x27b7f0[_0x66c7('0xa5')]===-0x1){return _0x27b7f0;}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xa6'),_0xf9c623,_0x27b7f0[_0x66c7('0xa3')]));return this[_0x66c7('0xc')]['setVariable'](_0xf9c623,_0x27b7f0[_0x66c7('0xa3')]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x89')]=function(_0x42ef4c){return _0x42ef4c&&_0x42ef4c!=='0'&&_0x42ef4c!=='-1'&&_0x42ef4c!=='';};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa7')]=function(_0x27a72a){this[_0x66c7('0xa8')]['sync'](this,_0x27a72a,'-');_0x27a72a[_0x66c7('0xa9')]=_0x27a72a[_0x66c7('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x66c7('0x13')][_0x66c7('0xaa')]=function(_0x13477f){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xab'),_0x13477f[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x13477f[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop']('no\x20text\x20configured');}var _0x441eec='\x22'+_0x13477f[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x13477f[_0x66c7('0x7c')])){_0x441eec+=','+_0x13477f[_0x66c7('0x7c')];}var _0x1bd0bd=this[_0x66c7('0xc')][_0x66c7('0x57')]('MRCPSynth',_0x441eec);if(_0x1bd0bd[_0x66c7('0xa5')]===-0x1){return _0x1bd0bd;}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0xac'),_0x441eec));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xad')]=function(_0x5c97da){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xae'),_0x5c97da[_0x66c7('0x36')]));if(!this['isConfigured'](_0x5c97da['grammar'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xb0'));}var _0x3723e9=_0x5c97da[_0x66c7('0xb1')];if(this[_0x66c7('0x89')](_0x5c97da['options'])){_0x3723e9+=','+_0x5c97da[_0x66c7('0x7c')];}var _0x20c734=this[_0x66c7('0xc')][_0x66c7('0x57')]('MRCPRecog',_0x3723e9);if(_0x20c734[_0x66c7('0xa5')]===-0x1){return _0x20c734;}var _0x4b01ee=this[_0x66c7('0xa4')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4b01ee[_0x66c7('0xa5')]===-0x1){return _0x4b01ee;}var _0x159d6f=this['getAndSetVariable']('RECOG_INPUT()',_0x66c7('0xb2'));if(_0x159d6f['result']===-0x1){return _0x159d6f;}var _0x4284f5=this[_0x66c7('0xa4')](_0x66c7('0xb3'),_0x66c7('0xb4'));if(_0x4284f5['result']===-0x1){return _0x4284f5;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x3723e9));};AGIVertices[_0x66c7('0x13')]['agi']=function(_0x516d7c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xb6'),_0x516d7c[_0x66c7('0x36')]));return this[_0x66c7('0xc')]['agi']([_0x516d7c[_0x66c7('0xb7')],_0x516d7c[_0x66c7('0xb8')]]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0xb9')]=function(_0xf71059){logger['info'](util['format'](_0x66c7('0xba'),_0xf71059[_0x66c7('0x36')]));if(this['isConfigured'](_0xf71059[_0x66c7('0x67')])){logger['info'](util[_0x66c7('0x28')](_0x66c7('0xbb'),_0xf71059[_0x66c7('0x67')]));var _0x4dc210=this[_0x66c7('0xc')]['wait'](_0xf71059[_0x66c7('0x67')]);if(_0x4dc210['result']===-0x1){return _0x4dc210;}}return this[_0x66c7('0xc')][_0x66c7('0xb9')]();};AGIVertices[_0x66c7('0x13')][_0x66c7('0x49')]=function(_0x5ceda2){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5ceda2[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x5ceda2['list_id'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x5ceda2,_0x66c7('0xbc'));}_0x5ceda2[_0x66c7('0x48')]=moment();if(this['isConfigured'](_0x5ceda2['delay'])){_0x5ceda2[_0x66c7('0x48')]=moment()['add'](_0x5ceda2[_0x66c7('0xbd')],_0x66c7('0xbe'));}if(!this['isConfigured'](_0x5ceda2[_0x66c7('0xbf')])){_0x5ceda2['callback_priority']=0x2;}this[_0x66c7('0x42')][_0x66c7('0x72')](this,_0x5ceda2);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xc0'),_0x5ceda2[_0x66c7('0x46')],_0x5ceda2['list_id'],_0x5ceda2[_0x66c7('0x48')]));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc1')]=function(_0x158887){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xc2'),_0x158887[_0x66c7('0x36')]));var _0x171847=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x158887[_0x66c7('0xc3')],_0x158887[_0x66c7('0x7c')]);if(_0x171847[_0x66c7('0xa5')]===-0x1){return _0x171847;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xc4'),_0x158887['application'],_0x158887['options']));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc5')]=function(_0x4d7b1d){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xc6'),_0x4d7b1d[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x4d7b1d['text'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}var _0x600d2b='\x22'+_0x4d7b1d[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x4d7b1d['options'])){_0x600d2b+=','+_0x4d7b1d[_0x66c7('0x7c')];}var _0x598212=this[_0x66c7('0xc')]['exec'](_0x66c7('0xc8'),_0x600d2b);if(_0x598212[_0x66c7('0xa5')]===-0x1){return _0x598212;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x600d2b));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xc9')]=function(_0x23a56e){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x23a56e[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x23a56e['text'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}var _0x550ea1='\x22'+_0x23a56e[_0x66c7('0x5d')]+'\x22';if(this[_0x66c7('0x89')](_0x23a56e[_0x66c7('0x7c')])){_0x550ea1+=','+_0x23a56e['options'];}var _0x56b097=this[_0x66c7('0xc')]['exec'](_0x66c7('0xc8'),_0x550ea1);if(_0x56b097[_0x66c7('0xa5')]===-0x1){return _0x56b097;}return this['channel'][_0x66c7('0xaf')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x550ea1));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xca')]=function(_0x36a108){logger['info'](util[_0x66c7('0x28')](_0x66c7('0xcb'),_0x36a108[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x36a108[_0x66c7('0xb1')])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0xb0'));}var _0x2462c6=_0x36a108['grammar'];if(this[_0x66c7('0x89')](_0x36a108['options'])){_0x2462c6+=','+_0x36a108[_0x66c7('0x7c')];}var _0x26894a=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0xcc'),_0x2462c6);if(_0x26894a[_0x66c7('0xa5')]===-0x1){return _0x26894a;}var _0x528b69=this[_0x66c7('0xa4')](_0x66c7('0xcd'),'LUMENVOX_ASR_CONFIDENCE');if(_0x528b69[_0x66c7('0xa5')]===-0x1){return _0x528b69;}var _0x449670=this[_0x66c7('0xa4')](_0x66c7('0xce'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x449670[_0x66c7('0xa5')]===-0x1){return _0x449670;}var _0x10a682=this['getAndSetVariable']('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x10a682[_0x66c7('0xa5')]===-0x1){return _0x10a682;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x2462c6));};AGIVertices[_0x66c7('0x13')]['sestekasr']=function(_0xc7ee91){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xcf'),_0xc7ee91[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0xc7ee91[_0x66c7('0xb1')])){return this['channel'][_0x66c7('0xaf')]('no\x20grammar\x20configured');}var _0x116477=_0xc7ee91[_0x66c7('0xb1')];if(this['isConfigured'](_0xc7ee91[_0x66c7('0x7c')])){_0x116477+=','+_0xc7ee91[_0x66c7('0x7c')];}var _0x271a11=this['channel'][_0x66c7('0x57')](_0x66c7('0xcc'),_0x116477);if(_0x271a11[_0x66c7('0xa5')]===-0x1){return _0x271a11;}var _0x26551d=this[_0x66c7('0xa4')]('RECOG_CONFIDENCE()',_0x66c7('0xd0'));if(_0x26551d[_0x66c7('0xa5')]===-0x1){return _0x26551d;}var _0x17ea56=this[_0x66c7('0xa4')]('RECOG_INPUT()',_0x66c7('0xd1'));if(_0x17ea56[_0x66c7('0xa5')]===-0x1){return _0x17ea56;}var _0x3cec33=this['getAndSetVariable']('RECOG_INSTANCE()',_0x66c7('0xd2'));if(_0x3cec33[_0x66c7('0xa5')]===-0x1){return _0x3cec33;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xb5'),_0x116477));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xd3')]=function(_0x54785){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x54785[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0xd4')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xd5'));}var _0x2ab139=this['getSquareOdbc']['sync'](this,_0x54785[_0x66c7('0xd4')]);if(!_0x2ab139){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xd6'));}if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0x2e')])){return this[_0x66c7('0xc')]['error'](_0x54785,_0x66c7('0xd7'));}var _0x471565=_0x54785[_0x66c7('0x2e')][_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xd8'),_0x471565));var _0x2a6ca3=this['getQueryOdbc'][_0x66c7('0x72')](this,_0x2ab139,_0x471565);this[_0x66c7('0xa8')]['sync'](this,_0x54785,_0x471565);if(!this[_0x66c7('0x89')](_0x54785[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xda'));}var _0x17389b=this['getVariable'][_0x66c7('0x72')](this,_0x54785['variable_id']);if(!_0x17389b){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x54785,_0x66c7('0xdb'));}var _0x247bc1=this;_0x2a6ca3[_0x66c7('0xdc')](function(_0x4ca682,_0x21074d){Object[_0x66c7('0xdd')](_0x4ca682)[_0x66c7('0xdc')](function(_0xb81e87){_0x247bc1[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')](_0x66c7('0xde'),_0x17389b,_0x21074d,_0xb81e87),_0x4ca682[_0xb81e87]);});});this[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')](_0x66c7('0xdf'),_0x17389b),_0x2a6ca3[_0x66c7('0x9c')]);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xe0'),_0x17389b));};AGIVertices['prototype'][_0x66c7('0xe1')]=function(_0x2b2a0d){logger[_0x66c7('0xe2')](util[_0x66c7('0x28')](_0x66c7('0xe3'),_0x2b2a0d['label']));if(!this['isConfigured'](_0x2b2a0d[_0x66c7('0xe4')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2b2a0d,'no\x20user\x20selected');}var _0x2440de=this[_0x66c7('0x1a')][_0x66c7('0x72')](this,_0x2b2a0d[_0x66c7('0xe4')]);if(!_0x2440de){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2b2a0d,_0x66c7('0xe5'));}var _0x4dea9c=this['channel'][_0x66c7('0x57')](_0x66c7('0xe6'),[util['format'](_0x66c7('0xe7'),_0x2440de),_0x2b2a0d[_0x66c7('0x67')],_0x2b2a0d[_0x66c7('0xe8')],_0x2b2a0d[_0x66c7('0x66')]]);if(_0x4dea9c['result']===-0x1){return _0x4dea9c;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0xe9'),_0x66c7('0xe6')));};AGIVertices[_0x66c7('0x13')]['dialogflow']=function(_0x27590a){logger['info'](util['format'](_0x66c7('0xea'),_0x27590a[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x27590a[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}if(!this[_0x66c7('0x89')](_0x27590a[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this[_0x66c7('0xc')]['bot']=!![];this[_0x66c7('0xa8')](_0x27590a);this[_0x66c7('0x41')](_0x27590a[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xec'),_0x27590a['text']));var _0x2beba7=this[_0x66c7('0x7d')][_0x66c7('0x72')](this,_0x27590a);if(_0x2beba7){for(var _0x11f42d in _0x2beba7){if(_0x2beba7[_0x66c7('0x97')](_0x11f42d)){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0xee'),_0x11f42d[_0x66c7('0x6d')]()),_0x2beba7[_0x11f42d]);}}this[_0x66c7('0x41')](_0x2beba7['speech'],_0x66c7('0xef'),_0x66c7('0xf0'),'');return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xf1'),_0x2beba7['speech']));}return this[_0x66c7('0xc')]['error'](_0x27590a,_0x66c7('0xf2'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xf3')]=function(_0x45db08){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xf4'),_0x45db08[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x81')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xf5'));}if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x82')])){return this['channel']['noop'](_0x66c7('0xf6'));}if(!this['isConfigured'](_0x45db08['private_key'])){return this['channel'][_0x66c7('0xaf')]('no\x20private_key\x20configured');}if(!this['isConfigured'](_0x45db08['dialogflowV2_language'])){return this['channel']['noop'](_0x66c7('0xf7'));}if(!this[_0x66c7('0x89')](_0x45db08[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this[_0x66c7('0xc')]['bot']=!![];this['createSquareDetailsReport'](_0x45db08);this[_0x66c7('0x41')](_0x45db08[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xf8'),_0x45db08[_0x66c7('0x5d')]));var _0x55a4e2=this[_0x66c7('0x80')][_0x66c7('0x72')](this,_0x45db08);if(_0x55a4e2){for(var _0x46ce44 in _0x55a4e2){if(_0x55a4e2[_0x66c7('0x97')](_0x46ce44)){if(_0x46ce44!==_0x66c7('0xf9')){this['channel'][_0x66c7('0xed')](util[_0x66c7('0x28')]('DIALOGFLOW_%s',_0x46ce44[_0x66c7('0x6d')]()),_0x55a4e2[_0x46ce44]);}}}this[_0x66c7('0x41')](_0x55a4e2[_0x66c7('0xfa')],_0x66c7('0xef'),_0x66c7('0xf3'),_0x55a4e2['providerResponse']);return this['channel'][_0x66c7('0xaf')](util['format'](_0x66c7('0xfb'),_0x55a4e2[_0x66c7('0xfa')]));}return this['channel'][_0x66c7('0x2c')](_0x45db08,_0x66c7('0xfc'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xfd')]=function(_0x579ae3){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0xfe'),_0x579ae3['label']));if(!this['isConfigured'](_0x579ae3['ndauth_url'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x66c7('0x89')](_0x579ae3[_0x66c7('0xff')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x100'));}if(!this[_0x66c7('0x89')](_0x579ae3[_0x66c7('0x101')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x102'));}if(!this['isConfigured'](_0x579ae3[_0x66c7('0x103')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20text\x20configured');}this[_0x66c7('0xc')]['bot']=!![];this[_0x66c7('0xa8')](_0x579ae3);this[_0x66c7('0x41')](_0x579ae3[_0x66c7('0x5d')],'in','','');this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x104'),_0x579ae3['text']));var _0x3743c3=this[_0x66c7('0x84')]['sync'](this,_0x579ae3);if(_0x3743c3){for(var _0x4df4ee in _0x3743c3){if(_0x3743c3[_0x66c7('0x97')](_0x4df4ee)){this['channel'][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x105'),_0x4df4ee[_0x66c7('0x6d')]()),_0x3743c3[_0x4df4ee]);}}this[_0x66c7('0x41')](_0x3743c3[_0x66c7('0xfa')],_0x66c7('0xef'),_0x66c7('0xfd'),'');if(_0x3743c3[_0x66c7('0x106')]){this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x107'),_0x3743c3['audiofile']));var _0x5684e9=this[_0x66c7('0xc')][_0x66c7('0x108')](_0x3743c3[_0x66c7('0x106')]);try{fs[_0x66c7('0x109')](_0x3743c3[_0x66c7('0x106')]+_0x66c7('0x10a'));}catch(_0x29c394){logger[_0x66c7('0x2c')](_0x29c394);}return _0x5684e9;}else{return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x10b'),_0x3743c3[_0x66c7('0xfa')]));}}return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x579ae3,_0x66c7('0x10c'));};AGIVertices[_0x66c7('0x13')]['end']=function(_0x112f27){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20END\x20(%s)\x20block',_0x112f27[_0x66c7('0x36')]));return this['channel'][_0x66c7('0xaf')](_0x66c7('0x10d'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x10e')]=function(_0x3625ea){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x10f'),_0x3625ea[_0x66c7('0x36')]));var _0x2aec90='';if(_0x3625ea[_0x66c7('0x110')]){if(!this[_0x66c7('0x89')](_0x3625ea[_0x66c7('0x110')])){return this[_0x66c7('0xc')]['error'](_0x3625ea,_0x66c7('0x111'));}else{var _0x3b155e=parseInt(_0x3625ea[_0x66c7('0x110')],0xa);if(isNaN(_0x3b155e)){_0x2aec90=_0x3625ea[_0x66c7('0x110')];}else{_0x2aec90=this[_0x66c7('0x1b')][_0x66c7('0x72')](this,_0x3625ea[_0x66c7('0x110')]);if(!_0x2aec90){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x3625ea,_0x66c7('0x112'));}}}}else if(_0x3625ea[_0x66c7('0x113')]){_0x2aec90=_0x3625ea['trunk_name'];}else{return this[_0x66c7('0xc')]['error'](_0x3625ea,'no\x20trunk\x20selected');}var _0x2fc5f4=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0xe6'),[util[_0x66c7('0x28')](_0x66c7('0x114'),_0x2aec90,_0x3625ea[_0x66c7('0x46')]),_0x3625ea[_0x66c7('0x67')],_0x3625ea['opts'],_0x3625ea[_0x66c7('0x66')]]);if(_0x2fc5f4[_0x66c7('0xa5')]===-0x1){return _0x2fc5f4;}return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20%s',_0x66c7('0xe6')));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x115')]=function(_0x3e831c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x116'),_0x3e831c[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x115'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0xa')]=function(_0x2f2e94){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x117'),_0x2f2e94[_0x66c7('0x36')]));if(_0x2f2e94[_0x66c7('0xa9')]===0x0){return this[_0x66c7('0xa7')](_0x2f2e94);}_0x2f2e94[_0x66c7('0xa9')]-=0x1;if(!this[_0x66c7('0x89')](_0x2f2e94[_0x66c7('0x118')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2f2e94,'no\x20file\x20audio\x20selected');}var _0x4aa471=this[_0x66c7('0x1d')][_0x66c7('0x72')](this,_0x2f2e94[_0x66c7('0x118')]);if(!_0x4aa471){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2f2e94,_0x66c7('0x119'));}if(!this[_0x66c7('0x89')](_0x2f2e94[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x66c7('0xda'));}var _0x57e9ba=this[_0x66c7('0xc')][_0x66c7('0x11a')](_0x4aa471,_0x2f2e94[_0x66c7('0x11b')],_0x2f2e94[_0x66c7('0x11c')]);var _0x24ba0d=_0x57e9ba['result']?_0x57e9ba['result'][_0x66c7('0x4a')]():'';logger[_0x66c7('0x30')]('test',JSON[_0x66c7('0x75')](_0x57e9ba));if(_0x57e9ba[_0x66c7('0xa5')]===-0x1){this[_0x66c7('0xa8')]['sync'](this,_0x2f2e94,_0x24ba0d);return _0x57e9ba;}else if(_0x57e9ba[_0x66c7('0xa3')]==='timeout'){_0x57e9ba[_0x66c7('0xa5')]=_0x24ba0d['length']>=parseInt(_0x2f2e94[_0x66c7('0x11d')])?'x':'i';}else{_0x57e9ba[_0x66c7('0xa5')]=_0x24ba0d[_0x66c7('0x9c')]>=parseInt(_0x2f2e94['mindigit'])&&_0x24ba0d[_0x66c7('0x9c')]<=parseInt(_0x2f2e94[_0x66c7('0x11c')])?'x':'i';}var _0x2ff094=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x2f2e94['variable_id']);if(!_0x2ff094){return this['channel'][_0x66c7('0x2c')](_0x2f2e94,'no\x20variable\x20found');}this[_0x66c7('0xc')][_0x66c7('0xed')](_0x2ff094,_0x24ba0d);if(this[_0x66c7('0x89')](_0x2f2e94['hiddendigitsnum'])){var _0x405737=parseInt(_0x2f2e94[_0x66c7('0x11e')],0xa);var _0xb321a=rs['generate']({'charset':'*','length':_0x405737});var _0x54bfeb=_0x24ba0d[_0x66c7('0x9c')];if(_0x54bfeb>0x0){if(_0x54bfeb>_0x405737){this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,_0x2f2e94[_0x66c7('0x11f')]===_0x66c7('0x120')?_0xb321a+_0x24ba0d[_0x66c7('0x121')](_0x405737):_0x24ba0d['substr'](0x0,_0x54bfeb-_0x405737)+_0xb321a);}else{this['createSquareDetailsReport']['sync'](this,_0x2f2e94,rs[_0x66c7('0x122')]({'charset':'*','length':_0x54bfeb}));}}else{this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,'');}}else{this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x2f2e94,_0x24ba0d);}return _0x57e9ba;};AGIVertices[_0x66c7('0x13')][_0x66c7('0xb')]=function(_0x5b41d6){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x5b41d6[_0x66c7('0x36')]));return this[_0x66c7('0xa')](_0x5b41d6);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x123')]=function(_0x84b174){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x124'),_0x84b174[_0x66c7('0x36')]));this['createSquareDetailsReport']['sync'](this,_0x84b174,_0x84b174['goalname']);return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x125'),_0x84b174[_0x66c7('0x126')]));};AGIVertices['prototype']['awspolly']=function(_0x348a23){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x127'),_0x348a23[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x348a23[_0x66c7('0x8e')])||!this['isConfigured'](_0x348a23[_0x66c7('0x8f')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x128'));}if(!this[_0x66c7('0x89')](_0x348a23[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20text\x20configured');}this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x129'),_0x348a23[_0x66c7('0x5d')]));var _0x2c8c07=this[_0x66c7('0x8b')][_0x66c7('0x72')](this,_0x348a23);if(_0x2c8c07){this['channel'][_0x66c7('0xaf')](util['format'](_0x66c7('0x12a'),_0x2c8c07));var _0x2a4c52=this[_0x66c7('0xc')][_0x66c7('0x108')](_0x2c8c07);try{fs[_0x66c7('0x109')](_0x2c8c07+_0x66c7('0x10a'));}catch(_0x39b70a){logger[_0x66c7('0x2c')](_0x39b70a);}return _0x2a4c52;}return this[_0x66c7('0xc')]['error'](_0x348a23,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x2f2848){logger[_0x66c7('0x30')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x2f2848[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x2f2848[_0x66c7('0x8e')])||!this['isConfigured'](_0x2f2848[_0x66c7('0x8f')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x128'));}if(!this[_0x66c7('0x89')](_0x2f2848[_0x66c7('0x91')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x12b'));}if(!this[_0x66c7('0x89')](_0x2f2848['text'])){return this['channel']['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0x12c')]=!![];this[_0x66c7('0xa8')](_0x2f2848);this[_0x66c7('0x41')](_0x2f2848[_0x66c7('0x5d')],'in','','');this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x12d'),_0x2f2848[_0x66c7('0x5d')]));var _0x32b1ba=this[_0x66c7('0x8d')][_0x66c7('0x72')](this,_0x2f2848);if(_0x32b1ba){for(var _0x5ca1e9 in _0x32b1ba){if(_0x32b1ba[_0x66c7('0x97')](_0x5ca1e9)&&_[_0x66c7('0x9d')](_0x32b1ba[_0x5ca1e9])){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x12e'),_0x5ca1e9[_0x66c7('0x6d')]()),_0x32b1ba[_0x5ca1e9]);}}if(_[_0x66c7('0x4f')](_0x32b1ba['message'])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0x12f'));}else{this[_0x66c7('0x41')](_0x32b1ba[_0x66c7('0x7a')],_0x66c7('0xef'),_0x66c7('0x130'),'');return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x131'),_0x32b1ba['message']));}}return this[_0x66c7('0xc')]['error'](_0x2f2848,_0x66c7('0x132'));};AGIVertices[_0x66c7('0x13')]['googleasr']=function(_0x3391db){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x133'),_0x3391db[_0x66c7('0x36')],_0x3391db['timeout']));if(!this[_0x66c7('0x89')](_0x3391db[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}var _0x325b37=_0x66c7('0x134');var _0x53c935=util[_0x66c7('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0xc70e25=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x53c935,_0x325b37);var _0x14f9c7=!![];if(_0x3391db['beep']===_0x66c7('0x135')){_0x14f9c7=![];}var _0x293d71=this['channel'][_0x66c7('0x136')](_0x53c935,_0x325b37,_0x3391db[_0x66c7('0x137')],_0x3391db['timeout'],undefined,_0x14f9c7);if(_0x293d71[_0x66c7('0xa5')]!==-0x1){this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x138'),_0xc70e25));var _0x4f94b0=this[_0x66c7('0x92')]['sync'](this,_0x3391db,_0xc70e25);if(_0x4f94b0){for(var _0x25126f in _0x4f94b0){if(_0x4f94b0[_0x66c7('0x97')](_0x25126f)){this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x139'),_0x25126f[_0x66c7('0x6d')]()),_0x4f94b0[_0x25126f]);}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x13a'),JSON['stringify'](_0x4f94b0)));}}return _0x293d71;};AGIVertices[_0x66c7('0x13')][_0x66c7('0x13b')]=function(_0x1df8ab){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x13c'),_0x1df8ab[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x1df8ab[_0x66c7('0x95')])){return this[_0x66c7('0xc')]['noop']('no\x20appid\x20configured');}if(!this[_0x66c7('0x89')](_0x1df8ab[_0x66c7('0x13d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x13e'));}var _0x536f27='wav';var _0xafc657=util[_0x66c7('0x28')](_0x66c7('0x13f'),FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0x2bd854=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0xafc657,_0x536f27);var _0x1bd88c=!![];if(_0x1df8ab[_0x66c7('0x140')]==='NOBEEP'){_0x1bd88c=![];}var _0x3ebf3a=this[_0x66c7('0xc')][_0x66c7('0x136')](_0xafc657,_0x536f27,_0x1df8ab[_0x66c7('0x137')],_0x1df8ab[_0x66c7('0x67')],undefined,_0x1bd88c);if(_0x3ebf3a[_0x66c7('0xa5')]!==-0x1){this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')]('tilde\x20%s\x20file\x20created',_0x2bd854));var _0x34bd36=this[_0x66c7('0x94')][_0x66c7('0x72')](this,_0x1df8ab,_0x2bd854);if(_0x34bd36){for(var _0x4b96db in _0x34bd36){if(_0x34bd36['hasOwnProperty'](_0x4b96db)){this[_0x66c7('0xc')][_0x66c7('0xed')](util['format'](_0x66c7('0x141'),_0x4b96db[_0x66c7('0x6d')]()),_0x34bd36[_0x4b96db]);}}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x142'),JSON[_0x66c7('0x75')](_0x34bd36)));}}return _0x3ebf3a;};AGIVertices['prototype'][_0x66c7('0x143')]=function(_0x4ed01d){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4ed01d['label']));return this[_0x66c7('0xc')][_0x66c7('0x144')](_0x4ed01d[_0x66c7('0x3b')],_0x4ed01d['extension'],_0x4ed01d[_0x66c7('0x3d')]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x145')]=function(_0x2c4bcb){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x146'),_0x2c4bcb['label']));if(!this['isConfigured'](_0x2c4bcb['condition'])){return this['channel'][_0x66c7('0x2c')](_0x2c4bcb,'no\x20condition\x20configured');}try{var _0x4c9e56=eval(_0x2c4bcb['condition'])?_0x66c7('0x147'):_0x66c7('0x148');this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x2c4bcb[_0x66c7('0x149')],_0x4c9e56));return{'code':0xc8,'result':_0x4c9e56};}catch(_0x52b8a1){return{'code':0xc8,'result':_0x66c7('0x148')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14a')]=function(_0x49ad5e){logger['info'](util[_0x66c7('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x49ad5e[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x49ad5e[_0x66c7('0x14b')])){return this['channel'][_0x66c7('0x2c')](_0x49ad5e,'no\x20interval\x20configured');}var _0x4091a2=this[_0x66c7('0x23')][_0x66c7('0x72')](this,_0x49ad5e[_0x66c7('0x14b')]);if(!_0x4091a2){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x49ad5e,_0x66c7('0x14c'));}for(var _0x37fc4c=0x0;_0x37fc4c<_0x4091a2['length'];_0x37fc4c+=0x1){var _0x1ec1f9=this[_0x66c7('0xc')][_0x66c7('0xf')](util[_0x66c7('0x28')]('IFTIME(%s?true:false)',_0x4091a2[_0x37fc4c]));if(_0x1ec1f9[_0x66c7('0xa5')]===-0x1){return _0x1ec1f9;}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x1ec1f9['extra']));if(_0x1ec1f9[_0x66c7('0xa3')]===_0x66c7('0x147')){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x66c7('0x147')));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],'true'));return{'code':0xc8,'result':_0x66c7('0x147')};}else{logger['info'](util[_0x66c7('0x28')](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],_0x66c7('0x148')));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x14d'),_0x4091a2[_0x37fc4c],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x66c7('0x13')][_0x66c7('0x14e')]=function(_0x2f2e0){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x14f'),_0x2f2e0[_0x66c7('0x36')]));return this['channel'][_0x66c7('0x14e')]();};AGIVertices['prototype'][_0x66c7('0x150')]=function(_0x544c80){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x544c80[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x544c80[_0x66c7('0x7e')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xeb'));}var _0x3ae46f=_0x66c7('0x134');var _0x46b948=util['format'](_0x66c7('0x13f'),FILES_PATH,rs[_0x66c7('0x122')](0x4));var _0x3d2d83=util[_0x66c7('0x28')](_0x66c7('0xa0'),_0x46b948,_0x3ae46f);var _0x8af33e=!![];if(_0x544c80[_0x66c7('0x140')]===_0x66c7('0x135')){_0x8af33e=![];}var _0x2bbbac=this['channel'][_0x66c7('0x136')](_0x46b948,_0x3ae46f,_0x544c80[_0x66c7('0x137')],_0x544c80[_0x66c7('0x67')],undefined,_0x8af33e);if(_0x2bbbac[_0x66c7('0xa5')]!==-0x1){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x151'),_0x3d2d83));var _0x5c4ff4=this[_0x66c7('0x88')][_0x66c7('0x72')](this,_0x544c80,_0x3d2d83);if(_0x5c4ff4){for(var _0x107744 in _0x5c4ff4){if(_0x5c4ff4['hasOwnProperty'](_0x107744)){this[_0x66c7('0xc')]['setVariable'](util[_0x66c7('0x28')]('ISPEECH_ASR_%s',_0x107744['toUpperCase']()),_0x5c4ff4[_0x107744]);}}return this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x152'),JSON[_0x66c7('0x75')](_0x5c4ff4)));}}return _0x2bbbac;};AGIVertices['prototype'][_0x66c7('0x153')]=function(_0x26a71a){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x154'),_0x26a71a[_0x66c7('0x36')]));if(!this['isConfigured'](_0x26a71a['key'])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x26a71a[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x155'),_0x26a71a[_0x66c7('0x5d')]));var _0x1aa4a4=this[_0x66c7('0x85')][_0x66c7('0x72')](this,_0x26a71a);if(_0x1aa4a4){this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x151'),_0x1aa4a4));var _0x3a52f4=this['channel'][_0x66c7('0x108')](_0x1aa4a4,_0x26a71a[_0x66c7('0x137')]);try{fs['unlink'](_0x1aa4a4+'.wav');}catch(_0x588eeb){logger[_0x66c7('0x2c')](_0x588eeb);}return _0x3a52f4;}return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x26a71a,_0x66c7('0x156'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x157')]=function(_0x2c89b9){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x158'),_0x2c89b9['label']));if(!this[_0x66c7('0x89')](_0x2c89b9['findBy'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x2c89b9,_0x66c7('0x159'));}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x2c89b9['findBy']));var _0x1b7747=this[_0x66c7('0x52')][_0x66c7('0x72')](this,_0x2c89b9[_0x66c7('0x15b')]);if(_0x1b7747){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this['channel']['callerid'],_0x2c89b9[_0x66c7('0x15b')]));this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')]['callerid'],_0x2c89b9[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util['format'](_0x66c7('0x15e'),this[_0x66c7('0xc')]['callerid'],_0x2c89b9[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x2c89b9[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x160')]=function(_0x55e486){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x161'),_0x55e486[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x55e486[_0x66c7('0x15b')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x55e486,_0x66c7('0x159'));}logger['info'](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486['findBy']));var _0x8b4d2e=this[_0x66c7('0x51')][_0x66c7('0x72')](this,_0x55e486[_0x66c7('0x15b')]);if(_0x8b4d2e){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this['channel'][_0x66c7('0x39')],_0x55e486['findBy']));this['channel']['noop'](util[_0x66c7('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x66c7('0xc')][_0x66c7('0x39')],_0x55e486[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices['prototype'][_0x66c7('0x162')]=function(_0x406793){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x406793[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x406793[_0x66c7('0x163')])){return this['channel']['error'](_0x406793,_0x66c7('0x164'));}this[_0x66c7('0xc')]['noop'](util['format'](_0x66c7('0x165'),_0x406793[_0x66c7('0x163')]));var _0xd0e9c8=eval(_0x406793[_0x66c7('0x163')]);if(!this[_0x66c7('0x89')](_0x406793[_0x66c7('0xd9')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x40673b=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x406793[_0x66c7('0xd9')]);if(!_0x40673b){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x406793,_0x66c7('0xdb'));}if(_[_0x66c7('0x9f')](_0xd0e9c8)){var _0x3ef1e1=this;_0xd0e9c8[_0x66c7('0xdc')](function(_0x23e807,_0x41c973){_0x3ef1e1[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')](_0x66c7('0x166'),_0x40673b,_0x41c973),_0x23e807);});return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x167'),_0x40673b));}else{return this[_0x66c7('0xc')]['setVariable'](_0x40673b,_0xd0e9c8);}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x168')]=function(_0x4792b3){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x4792b3['label']));if(_0x4792b3[_0x66c7('0xa9')]===0x0){return this['maxRetry'](_0x4792b3);}_0x4792b3[_0x66c7('0xa9')]-=0x1;if(!this['isConfigured'](_0x4792b3[_0x66c7('0x118')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0x169'));}var _0x51934e=this[_0x66c7('0x1d')]['sync'](this,_0x4792b3[_0x66c7('0x118')]);if(!_0x51934e){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0x119'));}var _0x3c575b=this[_0x66c7('0xc')][_0x66c7('0x11a')](_0x51934e,_0x4792b3[_0x66c7('0x11b')],_0x4792b3[_0x66c7('0x16a')]);var _0x28255a=_0x3c575b[_0x66c7('0xa5')];if(_0x3c575b[_0x66c7('0xa5')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x4792b3,'-1');return _0x3c575b;}else if(_0x3c575b['extra']===_0x66c7('0x67')){_0x3c575b[_0x66c7('0xa5')]=_0x3c575b['result'][_0x66c7('0x9c')]>0x0?_0x3c575b[_0x66c7('0xa5')]:'t';}else if(_[_0x66c7('0x43')](_0x3c575b['result'])){_0x3c575b['result']='#';_0x28255a='#';}if(!this[_0x66c7('0x89')](_0x4792b3[_0x66c7('0xd9')])){this['channel']['noop'](_0x66c7('0xda'));}else{var _0x54c510=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x4792b3[_0x66c7('0xd9')]);if(!_0x54c510){return this['channel'][_0x66c7('0x2c')](_0x4792b3,_0x66c7('0xdb'));}this[_0x66c7('0xc')][_0x66c7('0xed')](_0x54c510,_0x28255a);}this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x4792b3,_0x28255a);return _0x3c575b;};AGIVertices['prototype'][_0x66c7('0xaf')]=function(_0x348f4e){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x16b'),_0x348f4e[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x348f4e[_0x66c7('0x16c')]||_0x348f4e['label']);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x16d')]=function(_0x19384c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x16e'),_0x19384c[_0x66c7('0x36')]));if(!this['isConfigured'](_0x19384c['findBy'])){return this['channel'][_0x66c7('0x2c')](_0x19384c,'no\x20find\x20by\x20configured');}logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15a'),this[_0x66c7('0xc')]['callerid'],_0x19384c[_0x66c7('0x15b')]));var _0x53d478=this[_0x66c7('0x4b')][_0x66c7('0x72')](this,_0x19384c[_0x66c7('0x16f')]);var _0x1d1810=this[_0x66c7('0x4d')][_0x66c7('0x72')](this,_0x19384c[_0x66c7('0x15b')],_0x53d478);if(_0x1d1810){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x19384c[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')][_0x66c7('0x170')]=function(_0x31c33c){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x171'),_0x31c33c[_0x66c7('0x36')]));if(!this['isConfigured'](_0x31c33c['file_id'])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x31c33c,_0x66c7('0x169'));}var _0x2d25b1=this[_0x66c7('0x1d')]['sync'](this,_0x31c33c[_0x66c7('0x118')]);if(!_0x2d25b1){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x31c33c,'no\x20file\x20audio\x20found');}var _0x5c1bf9=this['channel'][_0x66c7('0x57')](_0x66c7('0x172'),[_0x2d25b1,_0x31c33c['opts']]);if(_0x5c1bf9['result']===-0x1){return _0x5c1bf9;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2d25b1));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x173')]=function(_0x525128){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x174'),_0x525128[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x525128[_0x66c7('0x175')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x525128,_0x66c7('0x176'));}var _0x749ae0='';var _0x354ab7=parseInt(_0x525128[_0x66c7('0x175')],0xa);if(isNaN(_0x354ab7)){_0x749ae0=_0x525128['queue_id'];}else{_0x749ae0=this[_0x66c7('0x14')][_0x66c7('0x72')](this,_0x525128[_0x66c7('0x175')]);if(!_0x749ae0){return this[_0x66c7('0xc')]['error'](_0x525128,'no\x20queue\x20found');}}var _0x11cd1e='';if(this[_0x66c7('0x89')](_0x525128[_0x66c7('0x118')])){var _0x15d0f5=this[_0x66c7('0x1d')][_0x66c7('0x72')](this,_0x525128[_0x66c7('0x118')]);if(_0x15d0f5){_0x11cd1e=_0x15d0f5;}}this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x525128,_0x749ae0);if(_0x525128[_0x66c7('0xe8')][_0x66c7('0x177')]('x')<0x0){_0x525128['opts']+='x';}if(_0x525128[_0x66c7('0xe8')][_0x66c7('0x177')]('X')<0x0){_0x525128[_0x66c7('0xe8')]+='X';}this[_0x66c7('0xc')][_0x66c7('0xed')]('XMCS-QUEUE',_0x749ae0?_0x749ae0[_0x66c7('0x178')]():'');var _0x1a92bd=this[_0x66c7('0xc')][_0x66c7('0x57')](_0x66c7('0x179'),[_0x749ae0,_0x525128[_0x66c7('0xe8')],_0x525128[_0x66c7('0x66')],_0x11cd1e,_0x525128['timeout'],_0x525128[_0x66c7('0x6')],_0x525128[_0x66c7('0x17a')],_0x525128[_0x66c7('0x17b')],'',_0x525128['position']]);if(_0x1a92bd[_0x66c7('0xa5')]===-0x1){return _0x1a92bd;}return this[_0x66c7('0xc')]['noop'](util[_0x66c7('0x28')]('Executed\x20command\x20%s\x20%s',_0x66c7('0x179'),_0x749ae0));};AGIVertices[_0x66c7('0x13')]['record']=function(_0x543b01){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x17c'),_0x543b01[_0x66c7('0x36')]));var _0x3bd76d=_0x543b01[_0x66c7('0x17d')]||_0x66c7('0x134');var _0x506cc2=util['format'](_0x66c7('0x17e'),this[_0x66c7('0xc')][_0x66c7('0x35')],rs[_0x66c7('0x122')](0x5));var _0x5c887f=util[_0x66c7('0x28')](_0x66c7('0x17f'),FILES_PATH,_0x506cc2,_0x3bd76d);var _0x274b20=util[_0x66c7('0x28')](_0x66c7('0x13f'),FILES_PATH,_0x506cc2);this[_0x66c7('0x38')][_0x66c7('0x72')](this,_0x543b01,_0x506cc2,_0x5c887f);this[_0x66c7('0xc')]['setVariable'](_0x66c7('0x180'),_0x506cc2);logger[_0x66c7('0x30')](_0x66c7('0x181'),_0x274b20,_0x3bd76d,_0x543b01[_0x66c7('0x182')],_0x543b01[_0x66c7('0x67')]);return this[_0x66c7('0xc')][_0x66c7('0x136')](_0x274b20,_0x3bd76d,_0x543b01[_0x66c7('0x182')],_0x543b01[_0x66c7('0x67')],undefined,!![]);};AGIVertices[_0x66c7('0x13')][_0x66c7('0x183')]=function(_0x18ccd6){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x184'),_0x18ccd6[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x18ccd6['url'])){return this['channel']['noop']('no\x20url\x20configured');}var _0x3087e2=this['restAPI']['sync'](this,_0x18ccd6);logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x185'),util[_0x66c7('0x186')](_0x3087e2,{'showHidden':![],'depth':null})));if(!this[_0x66c7('0x89')](_0x18ccd6['variable_id'])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0x187'));}var _0x22c10d=this['getVariable'][_0x66c7('0x72')](this,_0x18ccd6[_0x66c7('0xd9')]);if(!_0x22c10d){return this[_0x66c7('0xc')]['error'](_0x18ccd6,_0x66c7('0xdb'));}this[_0x66c7('0xc')][_0x66c7('0xed')](util[_0x66c7('0x28')]('%s_STATUS_CODE',_0x22c10d),_0x3087e2['statusCode']?_0x3087e2[_0x66c7('0x78')]:_0x66c7('0x188'));this['channel']['setVariable'](util[_0x66c7('0x28')](_0x66c7('0x189'),_0x22c10d),_0x3087e2[_0x66c7('0x79')]?_0x3087e2['statusMessage']:'OK');if(_0x3087e2[_0x66c7('0x76')]){try{this[_0x66c7('0x9e')](_0x3087e2[_0x66c7('0x76')],_0x22c10d);}catch(_0x10d805){logger[_0x66c7('0x2c')](util[_0x66c7('0x28')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x22c10d));}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xe0'),_0x22c10d));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x18a')]=function(_0x354744){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x354744['label']));return this[_0x66c7('0xc')][_0x66c7('0x18b')](_0x354744[_0x66c7('0x18c')][_0x66c7('0x59')](/\s+/g,''),_0x354744['escape_digits']);};AGIVertices['prototype']['saynumber']=function(_0x53805f){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x18d'),_0x53805f[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0x18e')](_0x53805f[_0x66c7('0x68')]['replace'](/\s+/g,''),_0x53805f['escape_digits']);};AGIVertices['prototype'][_0x66c7('0x18f')]=function(_0x4407b8){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x190'),_0x4407b8[_0x66c7('0x36')]));return this[_0x66c7('0xc')][_0x66c7('0x191')](_0x4407b8[_0x66c7('0x5d')],_0x4407b8[_0x66c7('0x182')]);};AGIVertices[_0x66c7('0x13')]['sendMail']=function(_0x5d39f7){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x5d39f7[_0x66c7('0x36')]));if(!this['isConfigured'](_0x5d39f7[_0x66c7('0x192')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')]('no\x20mail\x20account\x20configured');}var _0x292043=this['getMailAccount'][_0x66c7('0x72')](this,_0x5d39f7[_0x66c7('0x192')]);if(!_0x292043||!_0x292043[_0x66c7('0x193')]){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x5d39f7,_0x66c7('0x194'));}var _0x2d192e={'from':util['format'](_0x66c7('0x195'),_0x292043[_0x66c7('0x16')],_0x292043[_0x66c7('0x196')]||_0x292043[_0x66c7('0x193')]['user']),'to':_0x5d39f7['to']||'','cc':_0x5d39f7['cc']||'','bcc':_0x5d39f7[_0x66c7('0x197')]||'','subject':_0x5d39f7[_0x66c7('0x198')],'html':_0x5d39f7[_0x66c7('0x5d')],'text':_0x5d39f7[_0x66c7('0x5d')]};if(this['isConfigured'](_0x5d39f7['template_id'])){}logger['debug'](_0x66c7('0x199'),JSON['stringify'](_0x2d192e));this['createSquareDetailsReport']['sync'](this,_0x5d39f7,_0x5d39f7[_0x66c7('0x192')]);this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x292043[_0x66c7('0x16')]));this[_0x66c7('0x22')][_0x66c7('0x72')](this,_0x292043['smtpOptions'],_0x2d192e);return this['channel'][_0x66c7('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x66c7('0x19a')]=function(_0x451374){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x19b'),_0x451374[_0x66c7('0x36')]));return this[_0x66c7('0xc')]['noop'](_0x66c7('0x19c'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x19d')]=function(_0xaee53a){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x19e'),_0xaee53a[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0xaee53a[_0x66c7('0x19f')])){return this['channel'][_0x66c7('0xaf')](_0x66c7('0x1a0'));}var _0x18a8af=this[_0x66c7('0x32')][_0x66c7('0x72')](this,_0xaee53a[_0x66c7('0x19f')]);if(!_0x18a8af){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0xaee53a,_0x66c7('0x1a1'));}var _0x9b327b={'body':_0xaee53a[_0x66c7('0x1a2')],'phone':_0xaee53a['to']||'','SmsAccountId':_0x18a8af['id']};logger[_0x66c7('0xe2')]('sendSMS\x20message',JSON[_0x66c7('0x75')](_0x9b327b));this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0xaee53a,_0xaee53a[_0x66c7('0x19f')]);this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x18a8af[_0x66c7('0x16')]));this[_0x66c7('0x34')]['sync'](this,_0x9b327b);return this['channel'][_0x66c7('0xaf')](_0x66c7('0x1a3'));};AGIVertices[_0x66c7('0x13')]['set']=function(_0x2ca6b7){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x1a4'),_0x2ca6b7['label']));if(!this[_0x66c7('0x89')](_0x2ca6b7['variable_id'])){return this['channel'][_0x66c7('0x2c')](_0x2ca6b7,_0x66c7('0x1a5'));}var _0x96363b=this[_0x66c7('0xf')]['sync'](this,_0x2ca6b7[_0x66c7('0xd9')]);if(!_0x96363b){return this[_0x66c7('0xc')]['error'](_0x2ca6b7,_0x66c7('0xdb'));}return this[_0x66c7('0xc')][_0x66c7('0xed')](_0x96363b,_0x2ca6b7['variable_value']);};AGIVertices['prototype']['start']=function(_0x553b28){logger[_0x66c7('0x30')](util[_0x66c7('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x553b28[_0x66c7('0x36')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0x1a6'));if(_0x553b28[_0x66c7('0xb9')]==='yes'){this[_0x66c7('0xc')][_0x66c7('0xaf')]('Answer');return this['channel'][_0x66c7('0xb9')]();}return this['channel'][_0x66c7('0xaf')]('Skipped\x20Answer');};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1a7')]=function(_0x1e1617){logger['info'](util['format'](_0x66c7('0x1a8'),_0x1e1617[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x1e1617[_0x66c7('0x1a9')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x1e1617,_0x66c7('0x1aa'));}var _0x3977d8=this[_0x66c7('0x17')]['sync'](this,_0x1e1617[_0x66c7('0x1a9')]);if(!this[_0x66c7('0x89')](_0x3977d8)){return this[_0x66c7('0xc')]['error'](_0x1e1617,util[_0x66c7('0x28')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1e1617[_0x66c7('0x1a9')]));}if(_0x3977d8===this[_0x66c7('0xc')][_0x66c7('0x3f')]){return this[_0x66c7('0xc')]['error'](_0x1e1617,_0x66c7('0x1ab'));}this[_0x66c7('0xa8')]['sync'](this,_0x1e1617,_0x3977d8);var _0x24239b=this[_0x66c7('0xc')]['exec'](_0x66c7('0x1ac'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi'][_0x66c7('0x1ad')]||'127.0.0.1',_0x3977d8,this['channel'][_0x66c7('0x3f')]));if(_0x24239b[_0x66c7('0xa5')]===-0x1){return _0x24239b;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format']('Executed\x20command\x20%s\x20%s',_0x66c7('0x1ac'),_0x3977d8));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1ae')]=function(_0x3aec02){logger['info'](util['format'](_0x66c7('0x1af'),_0x3aec02[_0x66c7('0x36')]));var _0x3dda9f=this[_0x66c7('0x56')]['sync'](this,_0x3aec02[_0x66c7('0xb7')]);this[_0x66c7('0xa8')][_0x66c7('0x72')](this,_0x3aec02,_0x3aec02['command']);if(this['isConfigured'](_0x3aec02[_0x66c7('0xd9')])){var _0x438bef=this['getVariable'][_0x66c7('0x72')](this,_0x3aec02[_0x66c7('0xd9')]);if(_0x438bef){this[_0x66c7('0xc')][_0x66c7('0xed')](_0x438bef,_0x3dda9f);return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b0'),_0x3aec02['command'],_0x438bef));}}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b1'),_0x3aec02[_0x66c7('0xb7')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x2fdb4e){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x1b2'),_0x2fdb4e[_0x66c7('0x36')]));_0x2fdb4e[_0x66c7('0x5d')]=_0x2fdb4e[_0x66c7('0x5d')][_0x66c7('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x66c7('0x89')](_0x2fdb4e[_0x66c7('0x5b')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0x1b3'));}if(!this[_0x66c7('0x89')](_0x2fdb4e[_0x66c7('0x5d')])){return this[_0x66c7('0xc')]['noop'](_0x66c7('0xc7'));}this[_0x66c7('0xc')][_0x66c7('0xaf')](util['format'](_0x66c7('0x1b4'),_0x2fdb4e[_0x66c7('0x5d')]));var _0x341811=this[_0x66c7('0x5a')][_0x66c7('0x72')](this,_0x2fdb4e);if(_0x341811){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x1b5'),_0x341811));var _0x5850ee=this['channel']['streamFile'](_0x341811);try{fs[_0x66c7('0x109')](_0x341811+_0x66c7('0x10a'));}catch(_0x6cda09){logger[_0x66c7('0x2c')](_0x6cda09);}return _0x5850ee;}return this['channel'][_0x66c7('0x2c')](_0x2fdb4e,_0x66c7('0x1b6'));};AGIVertices[_0x66c7('0x13')]['tts']=function(_0x13483f){logger['info'](util[_0x66c7('0x28')](_0x66c7('0x1b7'),_0x13483f[_0x66c7('0x36')]));_0x13483f[_0x66c7('0x5d')]=_0x13483f[_0x66c7('0x5d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x66c7('0x89')](_0x13483f[_0x66c7('0x5d')])){return this[_0x66c7('0xc')][_0x66c7('0xaf')](_0x66c7('0xc7'));}this['channel'][_0x66c7('0xaf')](util['format']('Trying\x20Google\x20TTS\x20%s',_0x13483f['text']));var _0x159703=this[_0x66c7('0x64')][_0x66c7('0x72')](this,_0x13483f);if(_0x159703){this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x159703));var _0x4c214e=this[_0x66c7('0xc')]['streamFile'](_0x159703);try{fs['unlink'](_0x159703+_0x66c7('0x10a'));}catch(_0x2c2d9b){logger['error'](_0x2c2d9b);}return _0x4c214e;}return this[_0x66c7('0xc')]['error'](_0x13483f,_0x66c7('0x1b8'));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1b9')]=function(_0x33119a){logger[_0x66c7('0x30')](util['format'](_0x66c7('0x1ba'),_0x33119a['label']));if(!this['isConfigured'](_0x33119a[_0x66c7('0x15b')])){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x33119a,'no\x20find\x20by\x20configured');}logger[_0x66c7('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));var _0x1c7c20=this[_0x66c7('0x50')][_0x66c7('0x72')](this,_0x33119a['findBy']);if(_0x1c7c20){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));this['channel'][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x15c'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15d')};}else{logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')][_0x66c7('0x39')],_0x33119a[_0x66c7('0x15b')]));this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0x15e'),this[_0x66c7('0xc')]['callerid'],_0x33119a[_0x66c7('0x15b')]));return{'code':0xc8,'result':_0x66c7('0x15f')};}};AGIVertices[_0x66c7('0x13')]['voicemail']=function(_0x53bfda){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x1bb'),_0x53bfda[_0x66c7('0x36')]));var _0x33cb86=this[_0x66c7('0xc')][_0x66c7('0x57')]('VOICEMAIL',[_0x53bfda[_0x66c7('0x1bc')],_0x53bfda[_0x66c7('0x7c')]]);if(_0x33cb86[_0x66c7('0xa5')]===-0x1){return _0x33cb86;}return this[_0x66c7('0xc')][_0x66c7('0xaf')](util[_0x66c7('0x28')](_0x66c7('0xc4'),_0x66c7('0x1bd'),_0x53bfda[_0x66c7('0x1bc')]));};AGIVertices[_0x66c7('0x13')][_0x66c7('0x1be')]=function(_0x6d71a4){logger[_0x66c7('0x30')](util[_0x66c7('0x28')](_0x66c7('0x1bf'),_0x6d71a4[_0x66c7('0x36')]));if(!this[_0x66c7('0x89')](_0x6d71a4['variable_id'])){return this['channel'][_0x66c7('0x2c')](_0x6d71a4,'no\x20variable\x20selected');}var _0x2de6fe=this[_0x66c7('0xf')][_0x66c7('0x72')](this,_0x6d71a4[_0x66c7('0xd9')]);if(!_0x2de6fe){return this[_0x66c7('0xc')][_0x66c7('0x2c')](_0x6d71a4,_0x66c7('0xdb'));}var _0x2fc368=this[_0x66c7('0xc')][_0x66c7('0xf')](_0x2de6fe);return{'code':0xc8,'result':_0x2fc368[_0x66c7('0xa3')]?_0x2fc368[_0x66c7('0xa3')]:'-'};};String[_0x66c7('0x13')]['replaceAll']=function(_0x449bae,_0x3e7239){return this[_0x66c7('0xa1')](_0x449bae)[_0x66c7('0x1c0')](_0x3e7239);};module[_0x66c7('0x1c1')]=AGIVertices; \ No newline at end of file +var _0x1339=['getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','getIntervals','IntervalId','interval','Intervals','%s/sounds/converted/%s','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','format','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','POST','PUT','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','split','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','scheduledAt','add','delay','minutes','list_id','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','no\x20text\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','toUpperCase','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','out','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','variable_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','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\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','NOBEEP','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','debug','sendMail\x20message','sendMailMessage','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','exports','util','lodash','odbc','randomstring','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','rpc','mailRpc','prototype'];(function(_0x2bf875,_0x26cd4a){var _0x5ce8f3=function(_0x227100){while(--_0x227100){_0x2bf875['push'](_0x2bf875['shift']());}};_0x5ce8f3(++_0x26cd4a);}(_0x1339,0x1bf));var _0x9133=function(_0x5461f3,_0x4cd10b){_0x5461f3=_0x5461f3-0x0;var _0x5d683a=_0x1339[_0x5461f3];return _0x5d683a;};'use strict';var fs=require('fs');var util=require(_0x9133('0x0'));var _=require(_0x9133('0x1'));var sh=require('shelljs');var odbc=require(_0x9133('0x2'))();var rs=require(_0x9133('0x3'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0x9133('0x4'));var logger=require(_0x9133('0x5'))('agi');var config=require(_0x9133('0x6'));var shared=require(_0x9133('0x7'));var scripts=require(_0x9133('0x8'));var FILES_PATH=_0x9133('0x9');var recursiveMapAttributes=[_0x9133('0xa'),'rawBody'];var verticesWithRetry=['menu',_0x9133('0xb'),'getsecretdigits'];var AGIVertices=function(_0x39fda4,_0x5bb7f4,_0x41af31){this['channel']=_0x39fda4;this[_0x9133('0xc')]=_0x5bb7f4;this[_0x9133('0xd')]=_0x41af31;};AGIVertices[_0x9133('0xe')][_0x9133('0xf')]=function(_0x49d0fc,_0x4fe9af){this['rpc'][_0x9133('0x10')](_0x49d0fc)[_0x9133('0x11')](function(_0x1d851b){_0x4fe9af(null,_0x1d851b?_0x1d851b['name']:![]);})[_0x9133('0x12')](function(_0x177239){_0x4fe9af(_0x177239);});};AGIVertices[_0x9133('0xe')][_0x9133('0x13')]=function(_0x10eba7,_0x35edae){this[_0x9133('0xc')][_0x9133('0x14')](_0x10eba7)[_0x9133('0x11')](function(_0x51f912){_0x35edae(null,_0x51f912?_0x51f912[_0x9133('0x15')]:![]);})['catch'](function(_0x555651){_0x35edae(_0x555651);});};AGIVertices[_0x9133('0xe')][_0x9133('0x16')]=function(_0x153070,_0x34432e){this[_0x9133('0xc')][_0x9133('0x17')](_0x153070)[_0x9133('0x11')](function(_0x4aa4be){_0x34432e(null,_0x4aa4be?_0x4aa4be['name']:![]);})[_0x9133('0x12')](function(_0x969520){_0x34432e(_0x969520);});};AGIVertices[_0x9133('0xe')]['getSquareOdbc']=function(_0x5f4d4d,_0xfe140d){this[_0x9133('0xc')][_0x9133('0x18')](_0x5f4d4d)[_0x9133('0x11')](function(_0x307671){_0xfe140d(null,_0x307671?_0x307671[_0x9133('0x19')]:![]);})[_0x9133('0x12')](function(_0x24cce0){_0xfe140d(_0x24cce0);});};AGIVertices[_0x9133('0xe')][_0x9133('0x1a')]=function(_0x2f5e77,_0x2219d7){this[_0x9133('0xc')][_0x9133('0x1b')](_0x2f5e77)['then'](function(_0xdb994d){_0x2219d7(null,_0xdb994d?_0xdb994d[_0x9133('0x15')]:![]);})['catch'](function(_0x4f6c6a){_0x2219d7(_0x4f6c6a);});};AGIVertices[_0x9133('0xe')][_0x9133('0x1c')]=function(_0x2f930c,_0x52662b){this[_0x9133('0xc')][_0x9133('0x1d')](_0x2f930c)['then'](function(_0x16366e){_0x52662b(null,_0x16366e?_0x16366e['name']:![]);})['catch'](function(_0x5a83e0){_0x52662b(_0x5a83e0);});};AGIVertices[_0x9133('0xe')][_0x9133('0x1e')]=function(_0x489dff,_0x5ff14a){var _0x293cea=this;this[_0x9133('0xc')][_0x9133('0x1f')](_0x489dff)['then'](function(_0x276583){_0x5ff14a(null,_0x276583?_0x293cea[_0x9133('0x20')](_0x276583[_0x9133('0x21')]):![]);})['catch'](function(_0x7e8423){_0x5ff14a(_0x7e8423);});};AGIVertices[_0x9133('0xe')][_0x9133('0x22')]=function(_0x259ca2,_0x227c34){this['rpc'][_0x9133('0x23')](_0x259ca2)['then'](function(_0x1fa260){_0x227c34(null,_0x1fa260?_0x1fa260:![]);})[_0x9133('0x12')](function(_0x430f6){_0x227c34(_0x430f6);});};AGIVertices[_0x9133('0xe')]['sendMailMessage']=function(_0xdbd594,_0x3de73e,_0x351085){this[_0x9133('0xd')]['sendMailMessage'](_0xdbd594,_0x3de73e)[_0x9133('0x11')](function(){_0x351085(null);})[_0x9133('0x12')](function(_0x713ce8){_0x351085(_0x713ce8);});};AGIVertices[_0x9133('0xe')][_0x9133('0x24')]=function(_0x4b6217,_0x477948){this[_0x9133('0xc')]['getIntervalById'](_0x4b6217)[_0x9133('0x11')](function(_0x3d5583){if(_0x3d5583){if(_0x3d5583[_0x9133('0x25')]){_0x477948(null,[_0x3d5583[_0x9133('0x26')]]);}else{_0x477948(null,_['map'](_0x3d5583[_0x9133('0x27')],'interval'));}}else{_0x477948(null,![]);}})[_0x9133('0x12')](function(_0x1e39fd){_0x477948(_0x1e39fd);});};AGIVertices['prototype'][_0x9133('0x20')]=function(_0x22bee3){return util['format'](_0x9133('0x28'),FILES_PATH,_0x22bee3);};AGIVertices[_0x9133('0xe')]['getQueryOdbc']=function(_0x4b67e5,_0xa4bfff,_0x47f4f3){odbc[_0x9133('0x29')](_0x4b67e5,function(_0x3f52ea){if(_0x3f52ea){logger['error'](_0x9133('0x2a'),_0x3f52ea);_0x47f4f3(_0x3f52ea);}else{logger[_0x9133('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x9133('0x2c')](_0xa4bfff,function(_0x5237d6,_0x353c24){if(_0x5237d6){logger[_0x9133('0x2b')](_0x9133('0x2d'),_0xa4bfff);_0x47f4f3(_0x5237d6);}else{logger[_0x9133('0x2b')]('Query\x20executed\x20correctly\x20%s',_0xa4bfff);odbc[_0x9133('0x2e')](function(_0x26fa5e){if(_0x26fa5e){logger[_0x9133('0x2f')](_0x9133('0x30'),_0x26fa5e);}_0x47f4f3(null,_0x353c24);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x577340,_0x431900){this['rpc'][_0x9133('0x31')](_0x577340)[_0x9133('0x11')](function(_0x3d3a8b){_0x431900(null,_0x3d3a8b?_0x3d3a8b:![]);})['catch'](function(_0x193daf){_0x431900(_0x193daf);});};AGIVertices[_0x9133('0xe')][_0x9133('0x32')]=function(_0x3c70c1,_0x4a2f1e){this[_0x9133('0xc')][_0x9133('0x32')](_0x3c70c1)['then'](function(_0x5a9a62){_0x4a2f1e(null,_0x5a9a62);})['catch'](function(_0x20bf9a){_0x4a2f1e(_0x20bf9a);});};AGIVertices['prototype'][_0x9133('0x33')]=function(_0x32bd9b,_0x41a330,_0x306522){this[_0x9133('0xc')][_0x9133('0x33')]({'uniqueid':this[_0x9133('0x34')][_0x9133('0x35')],'node':_0x32bd9b[_0x9133('0x36')],'application':_0x32bd9b[_0x9133('0x37')],'data':_0x41a330||null,'project_name':this['channel'][_0x9133('0x38')],'callerid':this['channel']['callerid']})['then'](function(_0xc9cdbf){if(_0x306522){_0x306522(null,_0xc9cdbf);}})[_0x9133('0x12')](function(_0x5dfdb4){if(_0x306522){_0x306522(_0x5dfdb4);}});};AGIVertices[_0x9133('0xe')][_0x9133('0x39')]=function(_0x367840,_0x3b6b33,_0x522fb2,_0x3643b3){this['rpc'][_0x9133('0x39')]({'uniqueid':this[_0x9133('0x34')][_0x9133('0x35')],'callerid':this[_0x9133('0x34')][_0x9133('0x3a')],'calleridname':this[_0x9133('0x34')][_0x9133('0x3b')],'context':this[_0x9133('0x34')][_0x9133('0x3c')],'extension':this['channel'][_0x9133('0x3d')],'priority':this[_0x9133('0x34')][_0x9133('0x3e')],'accountcode':this[_0x9133('0x34')][_0x9133('0x3f')],'dnid':this[_0x9133('0x34')]['dnid'],'projectName':this[_0x9133('0x34')][_0x9133('0x38')],'saveName':_0x3b6b33,'filename':_0x367840[_0x9133('0x40')]||_0x3b6b33,'savePath':_0x522fb2})[_0x9133('0x11')](function(_0x2275b5){_0x3643b3(null,_0x2275b5);})[_0x9133('0x12')](function(_0x5c6683){_0x3643b3(_0x5c6683);});};AGIVertices[_0x9133('0xe')][_0x9133('0x41')]=function(_0x3befd3,_0x342ce5,_0x2d9818,_0x11effe,_0x28c520){this[_0x9133('0xc')]['createSquareMessage']({'uniqueid':this[_0x9133('0x34')]['uniqueid'],'body':_0x3befd3,'direction':_0x342ce5,'providerName':_0x2d9818,'providerResponse':_0x11effe})[_0x9133('0x11')](function(_0x34211f){if(_0x28c520){_0x28c520(null,_0x34211f);}})[_0x9133('0x12')](function(_0x494f98){if(_0x28c520){_0x28c520(_0x494f98);}});};AGIVertices[_0x9133('0xe')]['createCmContact']=function(_0x57a4d5,_0xc34745){this[_0x9133('0xc')][_0x9133('0x42')]({'firstName':_[_0x9133('0x43')](_0x57a4d5[_0x9133('0x15')])||_[_0x9133('0x44')](_0x57a4d5[_0x9133('0x15')])?_0x9133('0x45')+Math[_0x9133('0x46')]():_0x57a4d5[_0x9133('0x15')],'lastName':_[_0x9133('0x43')](_0x57a4d5[_0x9133('0x47')])||_['isNil'](_0x57a4d5[_0x9133('0x47')])?null:_0x57a4d5[_0x9133('0x47')],'phone':_0x57a4d5[_0x9133('0x48')],'ListId':_0x57a4d5['list_id'],'scheduledat':_0x57a4d5['scheduledAt'],'callbackUniqueid':this[_0x9133('0x34')][_0x9133('0x35')],'tags':_0x9133('0x49'),'description':_0x9133('0x4a')+_0x57a4d5['scheduledAt'][_0x9133('0x4b')](),'priority':_0x57a4d5[_0x9133('0x4c')]})[_0x9133('0x11')](function(_0x14a71f){_0xc34745(null,_0x14a71f);})['catch'](function(_0x2c65fe){_0xc34745(_0x2c65fe);});};AGIVertices['prototype']['getPause']=function(_0x134602,_0x3569f3){this['rpc'][_0x9133('0x4d')](_0x134602)[_0x9133('0x11')](function(_0x27b75d){_0x3569f3(null,_0x27b75d?_0x27b75d[_0x9133('0x15')]:![]);})[_0x9133('0x12')](function(_0x2b705b){_0x3569f3(_0x2b705b);});};AGIVertices[_0x9133('0xe')][_0x9133('0x4e')]=function(_0x357bfd,_0x433815,_0x196903){var _0x1ef06c={'role':_0x9133('0x4f')};_0x1ef06c[_0x357bfd]=this['channel'][_0x9133('0x3a')];this[_0x9133('0xc')][_0x9133('0x4e')](_0x1ef06c,_0x433815,this['channel'][_0x9133('0x35')])['then'](function(_0x1bfe74){_0x196903(null,_[_0x9133('0x44')](_0x1bfe74)?![]:!![]);})[_0x9133('0x12')](function(_0x417eba){logger[_0x9133('0x2f')](_0x417eba);_0x196903(null,![]);});};AGIVertices[_0x9133('0xe')][_0x9133('0x50')]=function(_0x433273,_0x3f9f4e){var _0x446bd4={'role':_0x9133('0x4f')};_0x446bd4[_0x433273]=this[_0x9133('0x34')][_0x9133('0x3a')];this[_0x9133('0xc')][_0x9133('0x50')](_0x446bd4)[_0x9133('0x11')](function(_0x1022b2){_0x3f9f4e(null,_['isNil'](_0x1022b2)?![]:!![]);})[_0x9133('0x12')](function(_0x418b0c){logger[_0x9133('0x2f')](_0x418b0c);_0x3f9f4e(null,![]);});};AGIVertices[_0x9133('0xe')][_0x9133('0x51')]=function(_0x7de526,_0x341a93){var _0x594e25={'role':_0x9133('0x4f')};_0x594e25[_0x7de526]=this[_0x9133('0x34')]['callerid'];this[_0x9133('0xc')]['agentLogout'](_0x594e25)['then'](function(_0x1232a9){_0x341a93(null,_[_0x9133('0x44')](_0x1232a9)?![]:!![]);})['catch'](function(_0x39ac71){logger['error'](_0x39ac71);_0x341a93(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x4d62de,_0x28f444){var _0x1b3712={'role':_0x9133('0x4f')};_0x1b3712[_0x4d62de]=this[_0x9133('0x34')][_0x9133('0x3a')];var _0x58aadf=_0x4d62de!=_0x9133('0x52')?util[_0x9133('0x53')]('%s/%s@from-sip/n',_0x9133('0x54'),this[_0x9133('0x34')][_0x9133('0x3a')]):undefined;this[_0x9133('0xc')][_0x9133('0x55')](_0x1b3712,_0x58aadf)[_0x9133('0x11')](function(_0x5b568a){_0x28f444(null,_[_0x9133('0x44')](_0x5b568a)?![]:!![]);})['catch'](function(_0x120b43){logger[_0x9133('0x2f')](_0x120b43);_0x28f444(null,![]);});};AGIVertices[_0x9133('0xe')][_0x9133('0x56')]=function(_0x32f39e,_0x3f9623){sh['exec'](_[_0x9133('0x57')](_0x32f39e),function(_0x48c5fd,_0x3deb30){var _0x36e7b1=_0x3deb30[_0x9133('0x58')](/(\r\n|\n|\r)/gm,'');_0x3f9623(null,_0x36e7b1);});};AGIVertices[_0x9133('0xe')]['googleCloudTTS']=function(_0x22252e,_0x46e52f){scripts[_0x9133('0x59')](_0x22252e[_0x9133('0x5a')],_0x22252e[_0x9133('0x5b')]||_0x9133('0x5c'),_0x22252e[_0x9133('0x5c')],_0x22252e[_0x9133('0x5d')]||_0x9133('0x5e'),_0x22252e[_0x9133('0x5f')]||_0x9133('0x60'),_0x22252e[_0x9133('0x61')]||_0x9133('0x62'))[_0x9133('0x11')](function(_0x1237d5){_0x46e52f(null,_0x1237d5);})[_0x9133('0x12')](function(_0x29f3bf){_0x46e52f(_0x29f3bf);});};AGIVertices[_0x9133('0xe')][_0x9133('0x63')]=function(_0x2fcd37,_0x48b8a4){scripts['googleTTS'](_0x2fcd37[_0x9133('0x5c')],_0x2fcd37[_0x9133('0x64')]||'en',0x1)[_0x9133('0x11')](function(_0x3ed189){_0x48b8a4(null,_0x3ed189);})[_0x9133('0x12')](function(_0x1d0bb7){_0x48b8a4(_0x1d0bb7);});};AGIVertices['prototype'][_0x9133('0x65')]=function(_0x2b0a5e,_0x5e7bf2){var _0x4777d8={'uri':_0x2b0a5e[_0x9133('0x66')],'method':_0x2b0a5e['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2b0a5e[_0x9133('0x67')])===_0x9133('0x68')&&parseInt(_0x2b0a5e[_0x9133('0x67')])>=0x1?parseInt(_0x2b0a5e[_0x9133('0x67')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x9133('0x69'),_0x9133('0x6a')],_0x4777d8['method']['toUpperCase']())){try{_0x4777d8[_0x9133('0x6b')]=_0x2b0a5e['rawBody']?JSON['parse'](_0x2b0a5e[_0x9133('0x6c')]):{};}catch(_0xd0befe){logger[_0x9133('0x2f')](_0x9133('0x6d'),_0xd0befe);}}try{_0x4777d8[_0x9133('0x6e')]=_0x2b0a5e[_0x9133('0xa')]?JSON[_0x9133('0x6f')](_0x2b0a5e['rawHeaders']):{};}catch(_0x5a127e){logger[_0x9133('0x2f')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5a127e);}if(_0x2b0a5e[_0x9133('0x70')]){try{var _0x2d74f7=require(_0x2b0a5e[_0x9133('0x70')])[_0x9133('0x71')](this,_0x4777d8);_0x4777d8[_0x9133('0x72')]=Mustache[_0x9133('0x73')](_0x2b0a5e['url'],_0x2d74f7,{},['$$','$$']);if(_0x4777d8[_0x9133('0x6e')]){_0x4777d8[_0x9133('0x6e')]=JSON[_0x9133('0x6f')](Mustache[_0x9133('0x73')](JSON[_0x9133('0x74')](_0x4777d8[_0x9133('0x6e')]),_0x2d74f7,{},['$$','$$']));}if(_0x4777d8[_0x9133('0x6b')]){_0x4777d8[_0x9133('0x6b')]=JSON[_0x9133('0x6f')](Mustache[_0x9133('0x73')](JSON[_0x9133('0x74')](_0x4777d8[_0x9133('0x6b')]),_0x2d74f7,{},['$$','$$']));}}catch(_0x467f11){logger[_0x9133('0x2f')](_0x9133('0x75'),_0x467f11);}}rp(_0x4777d8)['then'](function(_0x340f70){var _0x53e8db={'statusCode':_0x340f70[_0x9133('0x76')]||0xc8,'statusMessage':_0x340f70[_0x9133('0x77')]||'OK','headers':_0x340f70[_0x9133('0x6e')]||{},'body':_0x340f70[_0x9133('0x6b')]||{}};_0x5e7bf2(null,_0x53e8db);})[_0x9133('0x12')](function(_0x479eb2){var _0x141026={'statusCode':_0x479eb2['statusCode']||0x1f4,'statusMessage':_0x479eb2[_0x9133('0x78')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x479eb2[_0x9133('0x79')]['headers']||{},'body':_0x479eb2[_0x9133('0x79')]['body']||{}};_0x5e7bf2(null,_0x141026);});};AGIVertices[_0x9133('0xe')][_0x9133('0x7a')]=function(_0x634189,_0x5b41ce){scripts[_0x9133('0x7a')](this['channel'][_0x9133('0x35')],_0x634189[_0x9133('0x7b')],_0x634189[_0x9133('0x5c')],_0x634189[_0x9133('0x7c')]||'en')[_0x9133('0x11')](function(_0x591ff2){_0x5b41ce(null,_0x591ff2);})['catch'](function(_0x34dfec){_0x5b41ce(_0x34dfec);});};AGIVertices[_0x9133('0xe')][_0x9133('0x7d')]=function(_0x34e9af,_0x44cc16){scripts[_0x9133('0x7d')](this[_0x9133('0x34')]['uniqueid'],_0x34e9af[_0x9133('0x7e')],_0x34e9af[_0x9133('0x7f')],_0x34e9af[_0x9133('0x80')],_0x34e9af['text'],_0x34e9af[_0x9133('0x81')]||'en')[_0x9133('0x11')](function(_0x1203d9){_0x44cc16(null,_0x1203d9);})[_0x9133('0x12')](function(_0x3bc70f){_0x44cc16(_0x3bc70f);});};AGIVertices[_0x9133('0xe')][_0x9133('0x82')]=function(_0x3c4ed8,_0x2f0e57){scripts['sestekNDA'](this[_0x9133('0x34')],_0x3c4ed8)[_0x9133('0x11')](function(_0x7bacb4){_0x2f0e57(null,_0x7bacb4);})[_0x9133('0x12')](function(_0x2715ea){_0x2f0e57(_0x2715ea);});};AGIVertices[_0x9133('0xe')][_0x9133('0x83')]=function(_0x131e9d,_0x2ec363){scripts[_0x9133('0x83')](_0x131e9d[_0x9133('0x7b')],_0x131e9d[_0x9133('0x5c')],_0x131e9d[_0x9133('0x84')]||_0x9133('0x5e'),_0x131e9d[_0x9133('0x85')])['then'](function(_0x3ae978){_0x2ec363(null,_0x3ae978);})['catch'](function(_0x155cfa){_0x2ec363(_0x155cfa);});};AGIVertices['prototype'][_0x9133('0x86')]=function(_0x555b76,_0xa9f942,_0x36f810){scripts[_0x9133('0x86')](_0xa9f942,_0x555b76[_0x9133('0x7b')],_0x555b76['ispeech_asr_language']||_0x9133('0x5e'),this[_0x9133('0x87')](_0x555b76[_0x9133('0x88')])?_0x555b76['model']:undefined)[_0x9133('0x11')](function(_0x57f5e7){_0x36f810(null,_0x57f5e7);})['catch'](function(_0x4280ce){_0x36f810(_0x4280ce);});};AGIVertices[_0x9133('0xe')][_0x9133('0x89')]=function(_0x5ef0e9,_0x301b2a){scripts['awsPolly'](_0x5ef0e9[_0x9133('0x8a')],_0x5ef0e9[_0x9133('0x8b')],_0x5ef0e9['aws_polly_region'],_0x5ef0e9[_0x9133('0x8c')]||'Amy',_0x5ef0e9[_0x9133('0x5c')],_0x5ef0e9[_0x9133('0x8d')]||_0x9133('0x5c'))['then'](function(_0x37bc34){_0x301b2a(null,_0x37bc34);})[_0x9133('0x12')](function(_0x3505a1){_0x301b2a(_0x3505a1);});};AGIVertices[_0x9133('0xe')]['awsLex']=function(_0x14f0e9,_0x27a5c0){scripts['awsLex'](this[_0x9133('0x34')][_0x9133('0x35')],_0x14f0e9[_0x9133('0x8a')],_0x14f0e9[_0x9133('0x8b')],_0x14f0e9[_0x9133('0x8e')],_0x14f0e9[_0x9133('0x5c')],_0x14f0e9[_0x9133('0x8f')])[_0x9133('0x11')](function(_0x15e171){_0x27a5c0(null,_0x15e171);})[_0x9133('0x12')](function(_0x1ddd0b){_0x27a5c0(_0x1ddd0b);});};AGIVertices['prototype'][_0x9133('0x90')]=function(_0x335b5b,_0x13628c,_0x5f50e0){scripts[_0x9133('0x90')](_0x13628c,_0x335b5b['key'],_0x335b5b[_0x9133('0x91')]||'en-US')[_0x9133('0x11')](function(_0xf86d88){_0x5f50e0(null,_0xf86d88);})['catch'](function(_0x420aa4){_0x5f50e0(_0x420aa4);});};AGIVertices['prototype'][_0x9133('0x92')]=function(_0x28ab0c,_0x158ad7,_0x245919){scripts['tildeASR'](_0x158ad7,_0x28ab0c[_0x9133('0x93')],_0x28ab0c[_0x9133('0x94')],_0x28ab0c[_0x9133('0x72')])[_0x9133('0x11')](function(_0x522135){_0x245919(null,_0x522135);})[_0x9133('0x12')](function(_0x4bf755){_0x245919(_0x4bf755);});};AGIVertices[_0x9133('0xe')][_0x9133('0x95')]=function(_0x1be888){var _0x3c4f53=_[_0x9133('0x96')](verticesWithRetry,_0x1be888[_0x9133('0x37')])?_0x1be888:_[_0x9133('0x97')](_0x1be888);for(var _0x465e7c in _0x3c4f53){if(_0x3c4f53[_0x9133('0x98')](_0x465e7c)){if(_0x3c4f53[_0x465e7c]&&_[_0x9133('0x99')](_0x3c4f53[_0x465e7c])){if(_['includes'](recursiveMapAttributes,_0x465e7c)){_0x3c4f53[_0x465e7c]=this[_0x9133('0x9a')](_0x3c4f53[_0x465e7c]);}else{_0x3c4f53[_0x465e7c]=this[_0x9133('0x9b')](_0x3c4f53[_0x465e7c]);}}}}return _0x3c4f53;};AGIVertices[_0x9133('0xe')][_0x9133('0x9c')]=function(_0x3eed9c){for(var _0x4c5368 in _0x3eed9c){if(_0x3eed9c[_0x9133('0x98')](_0x4c5368)){if(_[_0x9133('0x9d')](_0x3eed9c[_0x4c5368])){this[_0x9133('0x9c')](_0x3eed9c[_0x4c5368]);}else if(_[_0x9133('0x9e')](_0x3eed9c[_0x4c5368])){for(var _0x1a0e7e=0x0;_0x1a0e7e<_0x3eed9c[_0x4c5368][_0x9133('0x9f')];_0x1a0e7e++){this['recursiveNodeIndex'](_0x3eed9c[_0x4c5368][_0x1a0e7e]);}}else if(_[_0x9133('0x99')](_0x3eed9c[_0x4c5368])){_0x3eed9c[_0x4c5368]=this['replaceAllVariables'](_0x3eed9c[_0x4c5368]);}}}};AGIVertices[_0x9133('0xe')][_0x9133('0xa0')]=function(_0x1d88f1,_0x79bc99){for(var _0xd937c5 in _0x1d88f1){if(_0x1d88f1[_0x9133('0x98')](_0xd937c5)){if(_[_0x9133('0x9d')](_0x1d88f1[_0xd937c5])){if(!_['isEmpty'](_0x1d88f1[_0xd937c5])){this[_0x9133('0xa0')](_0x1d88f1[_0xd937c5],util[_0x9133('0x53')](_0x9133('0xa1'),_0x79bc99,_0xd937c5));}}else if(_[_0x9133('0x9e')](_0x1d88f1[_0xd937c5])){for(var _0x36bc5d=0x0;_0x36bc5d<_0x1d88f1[_0xd937c5]['length'];_0x36bc5d++){this[_0x9133('0xa0')](_0x1d88f1[_0xd937c5][_0x36bc5d],util[_0x9133('0x53')](_0x9133('0xa1'),_0x79bc99,_0xd937c5+'['+_0x36bc5d+']'));}}else{if(!_[_0x9133('0x44')](_0x1d88f1[_0xd937c5])){this[_0x9133('0x34')]['setVariable'](util[_0x9133('0x53')](_0x9133('0xa1'),_0x79bc99,_0xd937c5),_0x1d88f1[_0xd937c5]);}}}}};AGIVertices['prototype'][_0x9133('0x9a')]=function(_0x264cdf){try{var _0x3909fe=JSON[_0x9133('0x6f')](_0x264cdf);this[_0x9133('0x9c')](_0x3909fe);return JSON[_0x9133('0x74')](_0x3909fe);}catch(_0x574574){return this[_0x9133('0x9b')](_0x264cdf);}};AGIVertices[_0x9133('0xe')][_0x9133('0x9b')]=function(_0x349f9c){var _0x364939=_0x349f9c[_0x9133('0xa2')]('{');for(var _0x37012e=0x1;_0x37012e<_0x364939['length'];_0x37012e+=0x1){var _0x2d0d83=_0x364939[_0x37012e][_0x9133('0xa2')]('}');if(_0x2d0d83[_0x9133('0x9f')]>0x1){_0x349f9c=_0x349f9c['replaceAll']('{'+_0x2d0d83[0x0]+'}',this[_0x9133('0x34')][_0x9133('0xf')](_0x2d0d83[0x0])[_0x9133('0xa3')]||_0x2d0d83[0x0]);}}if(_0x364939['length']===0x1){return _0x349f9c[_0x9133('0x4b')]();}return this[_0x9133('0x9b')](_0x349f9c);};AGIVertices['prototype'][_0x9133('0xa4')]=function(_0x26cff0,_0x87dd08){var _0x59ba19=this[_0x9133('0x34')]['getVariable'](_0x26cff0);if(_0x59ba19[_0x9133('0xa5')]===-0x1){return _0x59ba19;}logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xa6'),_0x87dd08,_0x59ba19[_0x9133('0xa3')]));return this[_0x9133('0x34')][_0x9133('0xa7')](_0x87dd08,_0x59ba19['extra']);};AGIVertices[_0x9133('0xe')]['isConfigured']=function(_0x56bb8){return _0x56bb8&&_0x56bb8!=='0'&&_0x56bb8!=='-1'&&_0x56bb8!=='';};AGIVertices['prototype'][_0x9133('0xa8')]=function(_0x2e0dff){this['createSquareDetailsReport'][_0x9133('0x71')](this,_0x2e0dff,'-');_0x2e0dff['retry']=_0x2e0dff[_0x9133('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x9133('0xe')][_0x9133('0xa9')]=function(_0x53d3ea){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xaa'),_0x53d3ea[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x53d3ea[_0x9133('0x5c')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20text\x20configured');}var _0x508a6b='\x22'+_0x53d3ea[_0x9133('0x5c')]+'\x22';if(this[_0x9133('0x87')](_0x53d3ea[_0x9133('0x79')])){_0x508a6b+=','+_0x53d3ea['options'];}var _0x3e186e=this[_0x9133('0x34')]['exec']('MRCPSynth',_0x508a6b);if(_0x3e186e['result']===-0x1){return _0x3e186e;}return this[_0x9133('0x34')][_0x9133('0xab')](util['format'](_0x9133('0xac'),_0x508a6b));};AGIVertices[_0x9133('0xe')][_0x9133('0xad')]=function(_0xe8f75c){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xae'),_0xe8f75c[_0x9133('0x36')]));if(!this['isConfigured'](_0xe8f75c[_0x9133('0xaf')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20grammar\x20configured');}var _0x1b5e8d=_0xe8f75c['grammar'];if(this[_0x9133('0x87')](_0xe8f75c['options'])){_0x1b5e8d+=','+_0xe8f75c['options'];}var _0x3e3ffa=this[_0x9133('0x34')][_0x9133('0xb0')](_0x9133('0xb1'),_0x1b5e8d);if(_0x3e3ffa['result']===-0x1){return _0x3e3ffa;}var _0x2f9fbb=this['getAndSetVariable'](_0x9133('0xb2'),_0x9133('0xb3'));if(_0x2f9fbb[_0x9133('0xa5')]===-0x1){return _0x2f9fbb;}var _0x529f29=this[_0x9133('0xa4')]('RECOG_INPUT()',_0x9133('0xb4'));if(_0x529f29[_0x9133('0xa5')]===-0x1){return _0x529f29;}var _0x2fdc07=this['getAndSetVariable'](_0x9133('0xb5'),_0x9133('0xb6'));if(_0x2fdc07[_0x9133('0xa5')]===-0x1){return _0x2fdc07;}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0xb7'),_0x1b5e8d));};AGIVertices[_0x9133('0xe')]['agi']=function(_0x4c1429){logger[_0x9133('0x2b')](util['format'](_0x9133('0xb8'),_0x4c1429[_0x9133('0x36')]));return this[_0x9133('0x34')][_0x9133('0xb9')]([_0x4c1429[_0x9133('0xba')],_0x4c1429[_0x9133('0xbb')]]);};AGIVertices[_0x9133('0xe')][_0x9133('0xbc')]=function(_0x4e8c63){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xbd'),_0x4e8c63[_0x9133('0x36')]));if(this[_0x9133('0x87')](_0x4e8c63[_0x9133('0x67')])){logger[_0x9133('0x2b')](util['format'](_0x9133('0xbe'),_0x4e8c63['timeout']));var _0x3171de=this[_0x9133('0x34')][_0x9133('0xbf')](_0x4e8c63[_0x9133('0x67')]);if(_0x3171de['result']===-0x1){return _0x3171de;}}return this[_0x9133('0x34')][_0x9133('0xbc')]();};AGIVertices[_0x9133('0xe')][_0x9133('0x49')]=function(_0x247d3a){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xc0'),_0x247d3a['label']));if(!this[_0x9133('0x87')](_0x247d3a['list_id'])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x247d3a,_0x9133('0xc1'));}_0x247d3a[_0x9133('0xc2')]=moment();if(this[_0x9133('0x87')](_0x247d3a['delay'])){_0x247d3a[_0x9133('0xc2')]=moment()[_0x9133('0xc3')](_0x247d3a[_0x9133('0xc4')],_0x9133('0xc5'));}if(!this[_0x9133('0x87')](_0x247d3a[_0x9133('0x4c')])){_0x247d3a['callback_priority']=0x2;}this[_0x9133('0x42')]['sync'](this,_0x247d3a);return this[_0x9133('0x34')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x247d3a[_0x9133('0x48')],_0x247d3a[_0x9133('0xc6')],_0x247d3a['scheduledAt']));};AGIVertices[_0x9133('0xe')][_0x9133('0xc7')]=function(_0x1a2799){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xc8'),_0x1a2799[_0x9133('0x36')]));var _0xcca7d7=this['channel']['exec'](_0x1a2799[_0x9133('0xc9')],_0x1a2799['options']);if(_0xcca7d7[_0x9133('0xa5')]===-0x1){return _0xcca7d7;}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('Executed\x20command\x20%s\x20%s',_0x1a2799['application'],_0x1a2799[_0x9133('0x79')]));};AGIVertices[_0x9133('0xe')]['lumenvoxtts']=function(_0x260d3c){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xca'),_0x260d3c['label']));if(!this[_0x9133('0x87')](_0x260d3c[_0x9133('0x5c')])){return this['channel'][_0x9133('0xab')]('no\x20text\x20configured');}var _0xc00342='\x22'+_0x260d3c[_0x9133('0x5c')]+'\x22';if(this[_0x9133('0x87')](_0x260d3c[_0x9133('0x79')])){_0xc00342+=','+_0x260d3c[_0x9133('0x79')];}var _0x41238f=this['channel']['exec'](_0x9133('0xcb'),_0xc00342);if(_0x41238f['result']===-0x1){return _0x41238f;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xac'),_0xc00342));};AGIVertices[_0x9133('0xe')][_0x9133('0xcc')]=function(_0x564517){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x564517[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x564517[_0x9133('0x5c')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20text\x20configured');}var _0x3e2566='\x22'+_0x564517['text']+'\x22';if(this[_0x9133('0x87')](_0x564517[_0x9133('0x79')])){_0x3e2566+=','+_0x564517[_0x9133('0x79')];}var _0x2ade5b=this[_0x9133('0x34')]['exec'](_0x9133('0xcb'),_0x3e2566);if(_0x2ade5b[_0x9133('0xa5')]===-0x1){return _0x2ade5b;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xac'),_0x3e2566));};AGIVertices['prototype']['lumenvoxasr']=function(_0x5b6a07){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5b6a07[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x5b6a07[_0x9133('0xaf')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xcd'));}var _0x29d41d=_0x5b6a07['grammar'];if(this[_0x9133('0x87')](_0x5b6a07[_0x9133('0x79')])){_0x29d41d+=','+_0x5b6a07[_0x9133('0x79')];}var _0x34ad02=this[_0x9133('0x34')]['exec'](_0x9133('0xb1'),_0x29d41d);if(_0x34ad02[_0x9133('0xa5')]===-0x1){return _0x34ad02;}var _0x4503e1=this[_0x9133('0xa4')]('RECOG_CONFIDENCE()',_0x9133('0xce'));if(_0x4503e1['result']===-0x1){return _0x4503e1;}var _0x34ba14=this[_0x9133('0xa4')](_0x9133('0xcf'),_0x9133('0xd0'));if(_0x34ba14[_0x9133('0xa5')]===-0x1){return _0x34ba14;}var _0x399fb2=this[_0x9133('0xa4')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x399fb2[_0x9133('0xa5')]===-0x1){return _0x399fb2;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xb7'),_0x29d41d));};AGIVertices['prototype'][_0x9133('0xd1')]=function(_0x4fad06){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xd2'),_0x4fad06[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x4fad06['grammar'])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xcd'));}var _0x4b3954=_0x4fad06[_0x9133('0xaf')];if(this['isConfigured'](_0x4fad06[_0x9133('0x79')])){_0x4b3954+=','+_0x4fad06[_0x9133('0x79')];}var _0x2d8a10=this['channel'][_0x9133('0xb0')]('MRCPRecog',_0x4b3954);if(_0x2d8a10[_0x9133('0xa5')]===-0x1){return _0x2d8a10;}var _0x3c7a61=this[_0x9133('0xa4')](_0x9133('0xb2'),_0x9133('0xd3'));if(_0x3c7a61[_0x9133('0xa5')]===-0x1){return _0x3c7a61;}var _0x1be22b=this['getAndSetVariable'](_0x9133('0xcf'),_0x9133('0xd4'));if(_0x1be22b['result']===-0x1){return _0x1be22b;}var _0x5f1137=this['getAndSetVariable']('RECOG_INSTANCE()',_0x9133('0xd5'));if(_0x5f1137['result']===-0x1){return _0x5f1137;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xb7'),_0x4b3954));};AGIVertices['prototype'][_0x9133('0xd6')]=function(_0x49c4b8){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x49c4b8[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x49c4b8['odbc_id'])){return this[_0x9133('0x34')]['error'](_0x49c4b8,_0x9133('0xd7'));}var _0x5535c4=this[_0x9133('0xd8')][_0x9133('0x71')](this,_0x49c4b8['odbc_id']);if(!_0x5535c4){return this[_0x9133('0x34')]['error'](_0x49c4b8,_0x9133('0xd9'));}if(!this['isConfigured'](_0x49c4b8[_0x9133('0x2c')])){return this['channel'][_0x9133('0x2f')](_0x49c4b8,_0x9133('0xda'));}var _0x30f20d=_0x49c4b8[_0x9133('0x2c')][_0x9133('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('query:\x20%s',_0x30f20d));var _0x2675b9=this[_0x9133('0xdb')][_0x9133('0x71')](this,_0x5535c4,_0x30f20d);this[_0x9133('0x33')][_0x9133('0x71')](this,_0x49c4b8,_0x30f20d);if(!this['isConfigured'](_0x49c4b8['variable_id'])){return this[_0x9133('0x34')]['noop'](_0x9133('0xdc'));}var _0x2a5156=this[_0x9133('0xf')][_0x9133('0x71')](this,_0x49c4b8['variable_id']);if(!_0x2a5156){return this[_0x9133('0x34')]['error'](_0x49c4b8,_0x9133('0xdd'));}var _0x5d5ead=this;_0x2675b9[_0x9133('0xde')](function(_0x1f4ac8,_0xd28b1a){Object['keys'](_0x1f4ac8)['forEach'](function(_0x214d2a){_0x5d5ead[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0xdf'),_0x2a5156,_0xd28b1a,_0x214d2a),_0x1f4ac8[_0x214d2a]);});});this[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0xe0'),_0x2a5156),_0x2675b9[_0x9133('0x9f')]);return this['channel'][_0x9133('0xab')](util['format'](_0x9133('0xe1'),_0x2a5156));};AGIVertices[_0x9133('0xe')][_0x9133('0xe2')]=function(_0x1e5714){logger['debug'](util[_0x9133('0x53')](_0x9133('0xe3'),_0x1e5714[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x1e5714[_0x9133('0xe4')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x1e5714,_0x9133('0xe5'));}var _0x53e697=this[_0x9133('0x1a')][_0x9133('0x71')](this,_0x1e5714[_0x9133('0xe4')]);if(!_0x53e697){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x1e5714,'no\x20user\x20found');}var _0x4539b2=this[_0x9133('0x34')][_0x9133('0xb0')]('DIAL',[util[_0x9133('0x53')](_0x9133('0xe6'),_0x53e697),_0x1e5714[_0x9133('0x67')],_0x1e5714[_0x9133('0xe7')],_0x1e5714[_0x9133('0x66')]]);if(_0x4539b2['result']===-0x1){return _0x4539b2;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xe8'),_0x9133('0xe9')));};AGIVertices[_0x9133('0xe')][_0x9133('0xea')]=function(_0x471d8b){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0xeb'),_0x471d8b[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x471d8b[_0x9133('0x7b')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xec'));}if(!this['isConfigured'](_0x471d8b[_0x9133('0x5c')])){return this['channel'][_0x9133('0xab')](_0x9133('0xed'));}this['channel'][_0x9133('0xee')]=!![];this[_0x9133('0x33')](_0x471d8b);this[_0x9133('0x41')](_0x471d8b['text'],'in','','');this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xef'),_0x471d8b['text']));var _0x5e33e6=this[_0x9133('0x7a')][_0x9133('0x71')](this,_0x471d8b);if(_0x5e33e6){for(var _0x35f753 in _0x5e33e6){if(_0x5e33e6[_0x9133('0x98')](_0x35f753)){this[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0xf0'),_0x35f753['toUpperCase']()),_0x5e33e6[_0x35f753]);}}this[_0x9133('0x41')](_0x5e33e6[_0x9133('0xf1')],'out','dialogflow','');return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xf2'),_0x5e33e6['speech']));}return this[_0x9133('0x34')]['error'](_0x471d8b,_0x9133('0xf3'));};AGIVertices['prototype'][_0x9133('0xf4')]=function(_0x5c301a){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x5c301a[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x5c301a[_0x9133('0x7e')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20project_id\x20configured');}if(!this[_0x9133('0x87')](_0x5c301a[_0x9133('0x7f')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xf5'));}if(!this[_0x9133('0x87')](_0x5c301a[_0x9133('0x80')])){return this[_0x9133('0x34')]['noop'](_0x9133('0xf6'));}if(!this[_0x9133('0x87')](_0x5c301a[_0x9133('0x81')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xf7'));}if(!this['isConfigured'](_0x5c301a[_0x9133('0x5c')])){return this['channel'][_0x9133('0xab')](_0x9133('0xed'));}this['channel'][_0x9133('0xee')]=!![];this[_0x9133('0x33')](_0x5c301a);this['createSquareMessage'](_0x5c301a['text'],'in','','');this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('Trying\x20DialogflowV2:\x20%s',_0x5c301a[_0x9133('0x5c')]));var _0x492964=this[_0x9133('0x7d')]['sync'](this,_0x5c301a);if(_0x492964){for(var _0x1efaae in _0x492964){if(_0x492964[_0x9133('0x98')](_0x1efaae)){if(_0x1efaae!==_0x9133('0xf8')){this[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0xf0'),_0x1efaae[_0x9133('0xf9')]()),_0x492964[_0x1efaae]);}}}this[_0x9133('0x41')](_0x492964['speech'],'out',_0x9133('0xf4'),_0x492964['providerResponse']);return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xfa'),_0x492964[_0x9133('0xf1')]));}return this[_0x9133('0x34')]['error'](_0x5c301a,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x9133('0xe')][_0x9133('0xfb')]=function(_0x4a69de){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x4a69de[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x4a69de[_0x9133('0xfc')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xfd'));}if(!this['isConfigured'](_0x4a69de[_0x9133('0xfe')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xff'));}if(!this[_0x9133('0x87')](_0x4a69de[_0x9133('0x100')])){return this['channel'][_0x9133('0xab')](_0x9133('0x101'));}if(!this['isConfigured'](_0x4a69de[_0x9133('0x102')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xed'));}this[_0x9133('0x34')][_0x9133('0xee')]=!![];this[_0x9133('0x33')](_0x4a69de);this['createSquareMessage'](_0x4a69de[_0x9133('0x5c')],'in','','');this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('Trying\x20SestekNDA:\x20%s',_0x4a69de[_0x9133('0x5c')]));var _0x4d72c1=this[_0x9133('0x82')][_0x9133('0x71')](this,_0x4a69de);if(_0x4d72c1){for(var _0x3af69e in _0x4d72c1){if(_0x4d72c1['hasOwnProperty'](_0x3af69e)){this[_0x9133('0x34')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x3af69e[_0x9133('0xf9')]()),_0x4d72c1[_0x3af69e]);}}this[_0x9133('0x41')](_0x4d72c1[_0x9133('0xf1')],_0x9133('0x103'),'sesteknda','');if(_0x4d72c1[_0x9133('0x104')]){this[_0x9133('0x34')][_0x9133('0xab')](util['format'](_0x9133('0x105'),_0x4d72c1['audiofile']));var _0x349044=this[_0x9133('0x34')][_0x9133('0x106')](_0x4d72c1[_0x9133('0x104')]);try{fs[_0x9133('0x107')](_0x4d72c1[_0x9133('0x104')]+'.wav');}catch(_0x3ddd21){logger[_0x9133('0x2f')](_0x3ddd21);}return _0x349044;}else{return this[_0x9133('0x34')][_0x9133('0xab')](util['format']('SestekNDA\x20Result\x20%s',_0x4d72c1[_0x9133('0xf1')]));}}return this['channel']['error'](_0x4a69de,_0x9133('0x108'));};AGIVertices[_0x9133('0xe')][_0x9133('0x109')]=function(_0x3144ab){logger[_0x9133('0x2b')](util['format'](_0x9133('0x10a'),_0x3144ab[_0x9133('0x36')]));return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x109'));};AGIVertices[_0x9133('0xe')][_0x9133('0x10b')]=function(_0x13841d){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x13841d['label']));var _0x4b00f2='';if(_0x13841d['trunk_id']){if(!this[_0x9133('0x87')](_0x13841d[_0x9133('0x10c')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x13841d,_0x9133('0x10d'));}else{var _0x27475d=parseInt(_0x13841d[_0x9133('0x10c')],0xa);if(isNaN(_0x27475d)){_0x4b00f2=_0x13841d[_0x9133('0x10c')];}else{_0x4b00f2=this[_0x9133('0x1c')]['sync'](this,_0x13841d['trunk_id']);if(!_0x4b00f2){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x13841d,_0x9133('0x10e'));}}}}else if(_0x13841d[_0x9133('0x10f')]){_0x4b00f2=_0x13841d['trunk_name'];}else{return this[_0x9133('0x34')]['error'](_0x13841d,'no\x20trunk\x20selected');}var _0x4b9962=this['channel'][_0x9133('0xb0')](_0x9133('0xe9'),[util[_0x9133('0x53')](_0x9133('0x110'),_0x4b00f2,_0x13841d[_0x9133('0x48')]),_0x13841d[_0x9133('0x67')],_0x13841d[_0x9133('0xe7')],_0x13841d[_0x9133('0x66')]]);if(_0x4b9962[_0x9133('0xa5')]===-0x1){return _0x4b9962;}return this[_0x9133('0x34')][_0x9133('0xab')](util['format'](_0x9133('0xe8'),_0x9133('0xe9')));};AGIVertices[_0x9133('0xe')][_0x9133('0x111')]=function(_0x33750a){logger[_0x9133('0x2b')](util['format'](_0x9133('0x112'),_0x33750a['label']));return this[_0x9133('0x34')]['noop'](_0x9133('0x111'));};AGIVertices['prototype'][_0x9133('0xb')]=function(_0x7b2795){logger['info'](util[_0x9133('0x53')](_0x9133('0x113'),_0x7b2795['label']));if(_0x7b2795[_0x9133('0x114')]===0x0){return this[_0x9133('0xa8')](_0x7b2795);}_0x7b2795[_0x9133('0x114')]-=0x1;if(!this[_0x9133('0x87')](_0x7b2795[_0x9133('0x115')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x7b2795,'no\x20file\x20audio\x20selected');}var _0x1febbd=this[_0x9133('0x1e')][_0x9133('0x71')](this,_0x7b2795[_0x9133('0x115')]);if(!_0x1febbd){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x7b2795,_0x9133('0x116'));}if(!this[_0x9133('0x87')](_0x7b2795[_0x9133('0x117')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x9133('0xdc'));}var _0xb39a0f=this[_0x9133('0x34')][_0x9133('0x118')](_0x1febbd,_0x7b2795[_0x9133('0x119')],_0x7b2795[_0x9133('0x11a')]);var _0x5cb7ac=_0xb39a0f['result']?_0xb39a0f['result'][_0x9133('0x4b')]():'';logger['info'](_0x9133('0x11b'),JSON[_0x9133('0x74')](_0xb39a0f));if(_0xb39a0f[_0x9133('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x9133('0x71')](this,_0x7b2795,_0x5cb7ac);return _0xb39a0f;}else if(_0xb39a0f['extra']===_0x9133('0x67')){_0xb39a0f[_0x9133('0xa5')]=_0x5cb7ac[_0x9133('0x9f')]>=parseInt(_0x7b2795[_0x9133('0x11c')])?'x':'i';}else{_0xb39a0f[_0x9133('0xa5')]=_0x5cb7ac[_0x9133('0x9f')]>=parseInt(_0x7b2795[_0x9133('0x11c')])&&_0x5cb7ac[_0x9133('0x9f')]<=parseInt(_0x7b2795[_0x9133('0x11a')])?'x':'i';}var _0x7521fc=this['getVariable']['sync'](this,_0x7b2795[_0x9133('0x117')]);if(!_0x7521fc){return this['channel'][_0x9133('0x2f')](_0x7b2795,'no\x20variable\x20found');}this[_0x9133('0x34')][_0x9133('0xa7')](_0x7521fc,_0x5cb7ac);if(this[_0x9133('0x87')](_0x7b2795[_0x9133('0x11d')])){var _0xd2ea0c=parseInt(_0x7b2795[_0x9133('0x11d')],0xa);var _0x30f27c=rs[_0x9133('0x11e')]({'charset':'*','length':_0xd2ea0c});var _0x1b4294=_0x5cb7ac[_0x9133('0x9f')];if(_0x1b4294>0x0){if(_0x1b4294>_0xd2ea0c){this['createSquareDetailsReport'][_0x9133('0x71')](this,_0x7b2795,_0x7b2795[_0x9133('0x11f')]===_0x9133('0x120')?_0x30f27c+_0x5cb7ac['substr'](_0xd2ea0c):_0x5cb7ac[_0x9133('0x121')](0x0,_0x1b4294-_0xd2ea0c)+_0x30f27c);}else{this[_0x9133('0x33')][_0x9133('0x71')](this,_0x7b2795,rs[_0x9133('0x11e')]({'charset':'*','length':_0x1b4294}));}}else{this[_0x9133('0x33')]['sync'](this,_0x7b2795,'');}}else{this[_0x9133('0x33')][_0x9133('0x71')](this,_0x7b2795,_0x5cb7ac);}return _0xb39a0f;};AGIVertices[_0x9133('0xe')][_0x9133('0x122')]=function(_0x3f7558){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x123'),_0x3f7558['label']));return this[_0x9133('0xb')](_0x3f7558);};AGIVertices[_0x9133('0xe')][_0x9133('0x124')]=function(_0x505f4e){logger[_0x9133('0x2b')](util['format'](_0x9133('0x125'),_0x505f4e['label']));this[_0x9133('0x33')][_0x9133('0x71')](this,_0x505f4e,_0x505f4e[_0x9133('0x126')]);return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x127'),_0x505f4e['goalname']));};AGIVertices[_0x9133('0xe')][_0x9133('0x128')]=function(_0x31a31f){logger[_0x9133('0x2b')](util['format'](_0x9133('0x129'),_0x31a31f[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x31a31f['aws_access_key_id'])||!this[_0x9133('0x87')](_0x31a31f[_0x9133('0x8b')])){return this['channel'][_0x9133('0xab')](_0x9133('0x12a'));}if(!this[_0x9133('0x87')](_0x31a31f[_0x9133('0x5c')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xed'));}this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x12b'),_0x31a31f['text']));var _0x45fad9=this[_0x9133('0x89')][_0x9133('0x71')](this,_0x31a31f);if(_0x45fad9){this['channel'][_0x9133('0xab')](util['format'](_0x9133('0x12c'),_0x45fad9));var _0x47db97=this[_0x9133('0x34')][_0x9133('0x106')](_0x45fad9);try{fs[_0x9133('0x107')](_0x45fad9+_0x9133('0x12d'));}catch(_0x50307c){logger['error'](_0x50307c);}return _0x47db97;}return this[_0x9133('0x34')]['error'](_0x31a31f,_0x9133('0x12e'));};AGIVertices[_0x9133('0xe')]['awslex']=function(_0x16f972){logger['info'](util['format'](_0x9133('0x12f'),_0x16f972[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x16f972['aws_access_key_id'])||!this['isConfigured'](_0x16f972[_0x9133('0x8b')])){return this[_0x9133('0x34')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0x9133('0x87')](_0x16f972[_0x9133('0x8f')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x130'));}if(!this['isConfigured'](_0x16f972['text'])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xed'));}this[_0x9133('0x34')]['bot']=!![];this[_0x9133('0x33')](_0x16f972);this[_0x9133('0x41')](_0x16f972['text'],'in','','');this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('Trying\x20Amazon\x20Lex:\x20%s',_0x16f972['text']));var _0x4338c1=this[_0x9133('0x131')][_0x9133('0x71')](this,_0x16f972);if(_0x4338c1){for(var _0x3ba6de in _0x4338c1){if(_0x4338c1[_0x9133('0x98')](_0x3ba6de)&&_['isString'](_0x4338c1[_0x3ba6de])){this[_0x9133('0x34')]['setVariable'](util[_0x9133('0x53')](_0x9133('0x132'),_0x3ba6de[_0x9133('0xf9')]()),_0x4338c1[_0x3ba6de]);}}if(_[_0x9133('0x44')](_0x4338c1[_0x9133('0x78')])){return this['channel'][_0x9133('0xab')](_0x9133('0x133'));}else{this[_0x9133('0x41')](_0x4338c1['message'],'out',_0x9133('0x134'),'');return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('Amazon\x20Lex\x20Result\x20%s',_0x4338c1[_0x9133('0x78')]));}}return this[_0x9133('0x34')][_0x9133('0x2f')](_0x16f972,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x9133('0xe')][_0x9133('0x135')]=function(_0x545373){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x136'),_0x545373[_0x9133('0x36')],_0x545373['timeout']));if(!this[_0x9133('0x87')](_0x545373[_0x9133('0x7b')])){return this[_0x9133('0x34')]['noop']('no\x20key\x20configured');}var _0x4925ff='wav';var _0x55691a=util[_0x9133('0x53')](_0x9133('0x137'),FILES_PATH,rs[_0x9133('0x11e')](0x4));var _0x452d8b=util['format']('%s.%s',_0x55691a,_0x4925ff);var _0x3ef8df=!![];if(_0x545373[_0x9133('0x138')]==='NOBEEP'){_0x3ef8df=![];}var _0x1144b9=this[_0x9133('0x34')][_0x9133('0x139')](_0x55691a,_0x4925ff,_0x545373[_0x9133('0x13a')],_0x545373[_0x9133('0x67')],undefined,_0x3ef8df);if(_0x1144b9[_0x9133('0xa5')]!==-0x1){this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x13b'),_0x452d8b));var _0xba21bd=this['googleASR'][_0x9133('0x71')](this,_0x545373,_0x452d8b);if(_0xba21bd){for(var _0x2a9077 in _0xba21bd){if(_0xba21bd[_0x9133('0x98')](_0x2a9077)){this['channel'][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0x13c'),_0x2a9077[_0x9133('0xf9')]()),_0xba21bd[_0x2a9077]);}}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('GoogleASR\x20Result\x20%s',JSON[_0x9133('0x74')](_0xba21bd)));}}return _0x1144b9;};AGIVertices['prototype'][_0x9133('0x13d')]=function(_0x313fb9){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x13e'),_0x313fb9[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x313fb9[_0x9133('0x93')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x13f'));}if(!this['isConfigured'](_0x313fb9[_0x9133('0x94')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x140'));}var _0x316e99=_0x9133('0x141');var _0x55a56f=util[_0x9133('0x53')](_0x9133('0x137'),FILES_PATH,rs[_0x9133('0x11e')](0x4));var _0x2f9c9e=util[_0x9133('0x53')](_0x9133('0xa1'),_0x55a56f,_0x316e99);var _0x497e5e=!![];if(_0x313fb9['beep']===_0x9133('0x142')){_0x497e5e=![];}var _0xe159a4=this[_0x9133('0x34')][_0x9133('0x139')](_0x55a56f,_0x316e99,_0x313fb9['intKey'],_0x313fb9[_0x9133('0x67')],undefined,_0x497e5e);if(_0xe159a4['result']!==-0x1){this[_0x9133('0x34')]['noop'](util['format'](_0x9133('0x143'),_0x2f9c9e));var _0x5db7e5=this['tildeASR'][_0x9133('0x71')](this,_0x313fb9,_0x2f9c9e);if(_0x5db7e5){for(var _0x15733f in _0x5db7e5){if(_0x5db7e5['hasOwnProperty'](_0x15733f)){this[_0x9133('0x34')][_0x9133('0xa7')](util['format'](_0x9133('0x144'),_0x15733f['toUpperCase']()),_0x5db7e5[_0x15733f]);}}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x145'),JSON['stringify'](_0x5db7e5)));}}return _0xe159a4;};AGIVertices[_0x9133('0xe')][_0x9133('0x146')]=function(_0x5450d9){logger[_0x9133('0x2b')](util['format'](_0x9133('0x147'),_0x5450d9[_0x9133('0x36')]));return this[_0x9133('0x34')][_0x9133('0x148')](_0x5450d9['context'],_0x5450d9[_0x9133('0x3d')],_0x5450d9[_0x9133('0x3e')]);};AGIVertices[_0x9133('0xe')][_0x9133('0x149')]=function(_0x4825c8){logger['info'](util['format'](_0x9133('0x14a'),_0x4825c8[_0x9133('0x36')]));if(!this['isConfigured'](_0x4825c8['condition'])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x4825c8,_0x9133('0x14b'));}try{var _0x780aca=eval(_0x4825c8[_0x9133('0x14c')])?_0x9133('0x14d'):_0x9133('0x14e');this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x14f'),_0x4825c8[_0x9133('0x14c')],_0x780aca));return{'code':0xc8,'result':_0x780aca};}catch(_0x555ccd){return{'code':0xc8,'result':_0x9133('0x14e')};}};AGIVertices[_0x9133('0xe')][_0x9133('0x150')]=function(_0x1072bb){logger['info'](util[_0x9133('0x53')](_0x9133('0x151'),_0x1072bb['label']));if(!this['isConfigured'](_0x1072bb[_0x9133('0x152')])){return this[_0x9133('0x34')]['error'](_0x1072bb,_0x9133('0x153'));}var _0x18871e=this[_0x9133('0x24')][_0x9133('0x71')](this,_0x1072bb[_0x9133('0x152')]);if(!_0x18871e){return this['channel']['error'](_0x1072bb,_0x9133('0x154'));}for(var _0x1cf2a1=0x0;_0x1cf2a1<_0x18871e[_0x9133('0x9f')];_0x1cf2a1+=0x1){var _0x601834=this[_0x9133('0x34')][_0x9133('0xf')](util[_0x9133('0x53')](_0x9133('0x155'),_0x18871e[_0x1cf2a1]));if(_0x601834[_0x9133('0xa5')]===-0x1){return _0x601834;}logger[_0x9133('0x2b')](util[_0x9133('0x53')]('IFTIME\x20%s\x20%s',_0x18871e[_0x1cf2a1],_0x601834[_0x9133('0xa3')]));if(_0x601834['extra']===_0x9133('0x14d')){logger[_0x9133('0x2b')](util['format'](_0x9133('0x156'),_0x18871e[_0x1cf2a1],_0x9133('0x14d')));this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x156'),_0x18871e[_0x1cf2a1],_0x9133('0x14d')));return{'code':0xc8,'result':_0x9133('0x14d')};}else{logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x156'),_0x18871e[_0x1cf2a1],_0x9133('0x14e')));this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x156'),_0x18871e[_0x1cf2a1],_0x9133('0x14e')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x9133('0xe')][_0x9133('0x157')]=function(_0x175563){logger['info'](util[_0x9133('0x53')](_0x9133('0x158'),_0x175563[_0x9133('0x36')]));return this['channel']['hangup']();};AGIVertices[_0x9133('0xe')]['ispeechasr']=function(_0x38dd7){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x38dd7[_0x9133('0x36')]));if(!this['isConfigured'](_0x38dd7[_0x9133('0x7b')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xec'));}var _0x348a0c=_0x9133('0x141');var _0xc487f4=util[_0x9133('0x53')]('%s/recordings/%s',FILES_PATH,rs[_0x9133('0x11e')](0x4));var _0x679275=util[_0x9133('0x53')](_0x9133('0xa1'),_0xc487f4,_0x348a0c);var _0x23fa6a=!![];if(_0x38dd7['beep']===_0x9133('0x142')){_0x23fa6a=![];}var _0x5c0f0a=this[_0x9133('0x34')][_0x9133('0x139')](_0xc487f4,_0x348a0c,_0x38dd7[_0x9133('0x13a')],_0x38dd7[_0x9133('0x67')],undefined,_0x23fa6a);if(_0x5c0f0a[_0x9133('0xa5')]!==-0x1){this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x159'),_0x679275));var _0x2152e6=this[_0x9133('0x86')][_0x9133('0x71')](this,_0x38dd7,_0x679275);if(_0x2152e6){for(var _0x3b5672 in _0x2152e6){if(_0x2152e6['hasOwnProperty'](_0x3b5672)){this['channel'][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0x15a'),_0x3b5672[_0x9133('0xf9')]()),_0x2152e6[_0x3b5672]);}}return this['channel'][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x15b'),JSON[_0x9133('0x74')](_0x2152e6)));}}return _0x5c0f0a;};AGIVertices[_0x9133('0xe')][_0x9133('0x15c')]=function(_0x21c71b){logger[_0x9133('0x2b')](util['format'](_0x9133('0x15d'),_0x21c71b[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x21c71b[_0x9133('0x7b')])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xec'));}if(!this[_0x9133('0x87')](_0x21c71b[_0x9133('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('Trying\x20ispeech\x20TTS\x20%s',_0x21c71b[_0x9133('0x5c')]));var _0x3afe29=this['ispeechTTS'][_0x9133('0x71')](this,_0x21c71b);if(_0x3afe29){this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('ispeech\x20%s\x20file\x20created',_0x3afe29));var _0x502368=this[_0x9133('0x34')]['streamFile'](_0x3afe29,_0x21c71b[_0x9133('0x13a')]);try{fs['unlink'](_0x3afe29+'.wav');}catch(_0x56cfb8){logger[_0x9133('0x2f')](_0x56cfb8);}return _0x502368;}return this[_0x9133('0x34')][_0x9133('0x2f')](_0x21c71b,_0x9133('0x15e'));};AGIVertices[_0x9133('0xe')]['login']=function(_0x9b1e5d){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x15f'),_0x9b1e5d[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x9b1e5d['findBy'])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x9b1e5d,_0x9133('0x160'));}logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x161'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x9b1e5d['findBy']));var _0x1e4584=this[_0x9133('0x55')][_0x9133('0x71')](this,_0x9b1e5d[_0x9133('0x162')]);if(_0x1e4584){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x9b1e5d[_0x9133('0x162')]));this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x9b1e5d['findBy']));return{'code':0xc8,'result':_0x9133('0x164')};}else{logger[_0x9133('0x2b')](util[_0x9133('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9133('0x34')][_0x9133('0x3a')],_0x9b1e5d['findBy']));this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9133('0x34')]['callerid'],_0x9b1e5d[_0x9133('0x162')]));return{'code':0xc8,'result':_0x9133('0x165')};}};AGIVertices[_0x9133('0xe')][_0x9133('0x166')]=function(_0x26b21a){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x26b21a['label']));if(!this[_0x9133('0x87')](_0x26b21a[_0x9133('0x162')])){return this['channel']['error'](_0x26b21a,_0x9133('0x160'));}logger[_0x9133('0x2b')](util[_0x9133('0x53')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x9133('0x34')][_0x9133('0x3a')],_0x26b21a['findBy']));var _0x3076a6=this[_0x9133('0x51')][_0x9133('0x71')](this,_0x26b21a['findBy']);if(_0x3076a6){logger[_0x9133('0x2b')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x9133('0x3a')],_0x26b21a[_0x9133('0x162')]));this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x26b21a[_0x9133('0x162')]));return{'code':0xc8,'result':'success'};}else{logger[_0x9133('0x2b')](util[_0x9133('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9133('0x34')]['callerid'],_0x26b21a[_0x9133('0x162')]));this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x167'),this['channel'][_0x9133('0x3a')],_0x26b21a[_0x9133('0x162')]));return{'code':0xc8,'result':_0x9133('0x165')};}};AGIVertices[_0x9133('0xe')]['math']=function(_0x3b6add){logger['info'](util[_0x9133('0x53')](_0x9133('0x168'),_0x3b6add[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x3b6add[_0x9133('0x169')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x3b6add,_0x9133('0x16a'));}this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x16b'),_0x3b6add['operation']));var _0x1d2d22=eval(_0x3b6add[_0x9133('0x169')]);if(!this[_0x9133('0x87')](_0x3b6add[_0x9133('0x117')])){return this[_0x9133('0x34')]['noop'](_0x9133('0xdc'));}var _0x2fa510=this[_0x9133('0xf')]['sync'](this,_0x3b6add[_0x9133('0x117')]);if(!_0x2fa510){return this['channel'][_0x9133('0x2f')](_0x3b6add,'no\x20variable\x20found');}if(_[_0x9133('0x9e')](_0x1d2d22)){var _0x3d4f36=this;_0x1d2d22[_0x9133('0xde')](function(_0x937344,_0x4d75a0){_0x3d4f36[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0x16c'),_0x2fa510,_0x4d75a0),_0x937344);});return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('variable\x20%s[key]\x20set',_0x2fa510));}else{return this[_0x9133('0x34')]['setVariable'](_0x2fa510,_0x1d2d22);}};AGIVertices[_0x9133('0xe')][_0x9133('0x16d')]=function(_0x30aa3c){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x30aa3c['label']));if(_0x30aa3c[_0x9133('0x114')]===0x0){return this['maxRetry'](_0x30aa3c);}_0x30aa3c[_0x9133('0x114')]-=0x1;if(!this[_0x9133('0x87')](_0x30aa3c[_0x9133('0x115')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x30aa3c,_0x9133('0x16e'));}var _0x58376a=this['getSound'][_0x9133('0x71')](this,_0x30aa3c[_0x9133('0x115')]);if(!_0x58376a){return this['channel'][_0x9133('0x2f')](_0x30aa3c,_0x9133('0x116'));}var _0x1b9d1e=this[_0x9133('0x34')][_0x9133('0x118')](_0x58376a,_0x30aa3c[_0x9133('0x119')],_0x30aa3c[_0x9133('0x16f')]);var _0x19c85e=_0x1b9d1e[_0x9133('0xa5')];if(_0x1b9d1e[_0x9133('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x9133('0x71')](this,_0x30aa3c,'-1');return _0x1b9d1e;}else if(_0x1b9d1e['extra']==='timeout'){_0x1b9d1e['result']=_0x1b9d1e['result']['length']>0x0?_0x1b9d1e[_0x9133('0xa5')]:'t';}else if(_[_0x9133('0x43')](_0x1b9d1e[_0x9133('0xa5')])){_0x1b9d1e[_0x9133('0xa5')]='#';_0x19c85e='#';}if(!this[_0x9133('0x87')](_0x30aa3c[_0x9133('0x117')])){this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xdc'));}else{var _0x2d7534=this['getVariable'][_0x9133('0x71')](this,_0x30aa3c[_0x9133('0x117')]);if(!_0x2d7534){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x30aa3c,_0x9133('0xdd'));}this[_0x9133('0x34')][_0x9133('0xa7')](_0x2d7534,_0x19c85e);}this[_0x9133('0x33')][_0x9133('0x71')](this,_0x30aa3c,_0x19c85e);return _0x1b9d1e;};AGIVertices[_0x9133('0xe')][_0x9133('0xab')]=function(_0x2da1aa){logger['info'](util['format'](_0x9133('0x170'),_0x2da1aa[_0x9133('0x36')]));return this[_0x9133('0x34')][_0x9133('0xab')](_0x2da1aa['output']||_0x2da1aa[_0x9133('0x36')]);};AGIVertices[_0x9133('0xe')]['pause']=function(_0xb80650){logger['info'](util[_0x9133('0x53')](_0x9133('0x171'),_0xb80650[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0xb80650[_0x9133('0x162')])){return this['channel']['error'](_0xb80650,_0x9133('0x160'));}logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x161'),this['channel'][_0x9133('0x3a')],_0xb80650['findBy']));var _0x2ab06a=this[_0x9133('0x172')]['sync'](this,_0xb80650['pause_id']);var _0x34bad9=this['agentPause']['sync'](this,_0xb80650[_0x9133('0x162')],_0x2ab06a);if(_0x34bad9){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0xb80650['findBy']));this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0xb80650[_0x9133('0x162')]));return{'code':0xc8,'result':_0x9133('0x164')};}else{logger[_0x9133('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9133('0x34')]['callerid'],_0xb80650['findBy']));this[_0x9133('0x34')][_0x9133('0xab')](util['format'](_0x9133('0x163'),this['channel'][_0x9133('0x3a')],_0xb80650['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x9133('0xe')][_0x9133('0x173')]=function(_0x33c37f){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x174'),_0x33c37f[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x33c37f[_0x9133('0x115')])){return this[_0x9133('0x34')]['error'](_0x33c37f,_0x9133('0x16e'));}var _0xfac176=this[_0x9133('0x1e')][_0x9133('0x71')](this,_0x33c37f[_0x9133('0x115')]);if(!_0xfac176){return this['channel'][_0x9133('0x2f')](_0x33c37f,_0x9133('0x116'));}var _0x3f8f39=this[_0x9133('0x34')]['exec'](_0x9133('0x175'),[_0xfac176,_0x33c37f['opts']]);if(_0x3f8f39[_0x9133('0xa5')]===-0x1){return _0x3f8f39;}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x176'),_0x9133('0x175'),_0xfac176));};AGIVertices[_0x9133('0xe')][_0x9133('0x177')]=function(_0xab50b2){logger[_0x9133('0x2b')](util['format'](_0x9133('0x178'),_0xab50b2[_0x9133('0x36')]));if(!this['isConfigured'](_0xab50b2[_0x9133('0x179')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0xab50b2,'no\x20queue\x20selected');}var _0x2858a2='';var _0x522b2d=parseInt(_0xab50b2[_0x9133('0x179')],0xa);if(isNaN(_0x522b2d)){_0x2858a2=_0xab50b2[_0x9133('0x179')];}else{_0x2858a2=this[_0x9133('0x13')]['sync'](this,_0xab50b2['queue_id']);if(!_0x2858a2){return this[_0x9133('0x34')][_0x9133('0x2f')](_0xab50b2,_0x9133('0x17a'));}}var _0x3ea426='';if(this[_0x9133('0x87')](_0xab50b2[_0x9133('0x115')])){var _0xce3202=this[_0x9133('0x1e')][_0x9133('0x71')](this,_0xab50b2[_0x9133('0x115')]);if(_0xce3202){_0x3ea426=_0xce3202;}}this[_0x9133('0x33')][_0x9133('0x71')](this,_0xab50b2,_0x2858a2);if(_0xab50b2[_0x9133('0xe7')]['indexOf']('x')<0x0){_0xab50b2[_0x9133('0xe7')]+='x';}if(_0xab50b2[_0x9133('0xe7')][_0x9133('0x17b')]('X')<0x0){_0xab50b2['opts']+='X';}this[_0x9133('0x34')][_0x9133('0xa7')](_0x9133('0x17c'),_0x2858a2?_0x2858a2[_0x9133('0x17d')]():'');var _0x4c88e6=this[_0x9133('0x34')][_0x9133('0xb0')](_0x9133('0x17e'),[_0x2858a2,_0xab50b2[_0x9133('0xe7')],_0xab50b2[_0x9133('0x66')],_0x3ea426,_0xab50b2[_0x9133('0x67')],_0xab50b2['agi'],_0xab50b2[_0x9133('0x17f')],_0xab50b2[_0x9133('0x180')],'',_0xab50b2[_0x9133('0x181')]]);if(_0x4c88e6['result']===-0x1){return _0x4c88e6;}return this['channel']['noop'](util[_0x9133('0x53')](_0x9133('0x176'),_0x9133('0x17e'),_0x2858a2));};AGIVertices[_0x9133('0xe')][_0x9133('0x182')]=function(_0x1f551d){logger[_0x9133('0x2b')](util['format'](_0x9133('0x183'),_0x1f551d[_0x9133('0x36')]));var _0x57c775=_0x1f551d[_0x9133('0x184')]||_0x9133('0x141');var _0x5a11b5=util[_0x9133('0x53')]('%s_%s',this[_0x9133('0x34')][_0x9133('0x35')],rs[_0x9133('0x11e')](0x5));var _0x17f3f1=util[_0x9133('0x53')](_0x9133('0x185'),FILES_PATH,_0x5a11b5,_0x57c775);var _0x415c1d=util[_0x9133('0x53')](_0x9133('0x137'),FILES_PATH,_0x5a11b5);this[_0x9133('0x39')][_0x9133('0x71')](this,_0x1f551d,_0x5a11b5,_0x17f3f1);this[_0x9133('0x34')]['setVariable'](_0x9133('0x186'),_0x5a11b5);logger[_0x9133('0x2b')](_0x9133('0x187'),_0x415c1d,_0x57c775,_0x1f551d['escape_digits'],_0x1f551d[_0x9133('0x67')]);return this[_0x9133('0x34')][_0x9133('0x139')](_0x415c1d,_0x57c775,_0x1f551d[_0x9133('0x188')],_0x1f551d[_0x9133('0x67')],undefined,!![]);};AGIVertices['prototype'][_0x9133('0x189')]=function(_0x23143b){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x18a'),_0x23143b[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x23143b[_0x9133('0x66')])){return this[_0x9133('0x34')]['noop'](_0x9133('0x18b'));}var _0x38ff25=this[_0x9133('0x65')]['sync'](this,_0x23143b);logger['info'](util[_0x9133('0x53')](_0x9133('0x18c'),util['inspect'](_0x38ff25,{'showHidden':![],'depth':null})));if(!this[_0x9133('0x87')](_0x23143b[_0x9133('0x117')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x117903=this[_0x9133('0xf')][_0x9133('0x71')](this,_0x23143b[_0x9133('0x117')]);if(!_0x117903){return this['channel'][_0x9133('0x2f')](_0x23143b,_0x9133('0xdd'));}this[_0x9133('0x34')]['setVariable'](util[_0x9133('0x53')](_0x9133('0x18d'),_0x117903),_0x38ff25['statusCode']?_0x38ff25[_0x9133('0x76')]:_0x9133('0x18e'));this[_0x9133('0x34')][_0x9133('0xa7')](util[_0x9133('0x53')](_0x9133('0x18f'),_0x117903),_0x38ff25[_0x9133('0x77')]?_0x38ff25[_0x9133('0x77')]:'OK');if(_0x38ff25['body']){try{this['saveRestApiResult'](_0x38ff25['body'],_0x117903);}catch(_0x533e6e){logger[_0x9133('0x2f')](util[_0x9133('0x53')](_0x9133('0x190'),_0x117903));}}return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0xe1'),_0x117903));};AGIVertices[_0x9133('0xe')]['saydigits']=function(_0x38206c){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x38206c[_0x9133('0x36')]));return this['channel'][_0x9133('0x191')](_0x38206c[_0x9133('0x192')][_0x9133('0x58')](/\s+/g,''),_0x38206c[_0x9133('0x188')]);};AGIVertices[_0x9133('0xe')][_0x9133('0x193')]=function(_0x3c3f47){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x194'),_0x3c3f47[_0x9133('0x36')]));return this[_0x9133('0x34')][_0x9133('0x195')](_0x3c3f47['number'][_0x9133('0x58')](/\s+/g,''),_0x3c3f47['escape_digits']);};AGIVertices['prototype'][_0x9133('0x196')]=function(_0x211d57){logger[_0x9133('0x2b')](util[_0x9133('0x53')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x211d57['label']));return this[_0x9133('0x34')][_0x9133('0x197')](_0x211d57[_0x9133('0x5c')],_0x211d57['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x39bed7){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x198'),_0x39bed7[_0x9133('0x36')]));if(!this['isConfigured'](_0x39bed7[_0x9133('0x199')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20mail\x20account\x20configured');}var _0x4cf596=this['getMailAccount'][_0x9133('0x71')](this,_0x39bed7[_0x9133('0x199')]);if(!_0x4cf596||!_0x4cf596[_0x9133('0x19a')]){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x39bed7,_0x9133('0x19b'));}var _0x49ea9f={'from':util[_0x9133('0x53')](_0x9133('0x19c'),_0x4cf596[_0x9133('0x15')],_0x4cf596[_0x9133('0x19d')]||_0x4cf596[_0x9133('0x19a')][_0x9133('0x19e')]),'to':_0x39bed7['to']||'','cc':_0x39bed7['cc']||'','bcc':_0x39bed7[_0x9133('0x19f')]||'','subject':_0x39bed7['subject'],'html':_0x39bed7['text'],'text':_0x39bed7[_0x9133('0x5c')]};if(this[_0x9133('0x87')](_0x39bed7['template_id'])){}logger[_0x9133('0x1a0')](_0x9133('0x1a1'),JSON[_0x9133('0x74')](_0x49ea9f));this['createSquareDetailsReport']['sync'](this,_0x39bed7,_0x39bed7[_0x9133('0x199')]);this[_0x9133('0x34')][_0x9133('0xab')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x4cf596[_0x9133('0x15')]));this[_0x9133('0x1a2')]['sync'](this,_0x4cf596[_0x9133('0x1a3')],_0x49ea9f);return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x1a4'));};AGIVertices[_0x9133('0xe')]['sendFax']=function(_0x47a28f){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x1a5'),_0x47a28f[_0x9133('0x36')]));return this[_0x9133('0x34')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x9133('0xe')][_0x9133('0x1a6')]=function(_0x32f979){logger['info'](util[_0x9133('0x53')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x32f979[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x32f979[_0x9133('0x1a7')])){return this['channel'][_0x9133('0xab')](_0x9133('0x1a8'));}var _0x26b540=this[_0x9133('0x1a9')]['sync'](this,_0x32f979[_0x9133('0x1a7')]);if(!_0x26b540){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x32f979,_0x9133('0x1aa'));}var _0x3d2e82={'body':_0x32f979[_0x9133('0x1ab')],'phone':_0x32f979['to']||'','SmsAccountId':_0x26b540['id']};logger[_0x9133('0x1a0')]('sendSMS\x20message',JSON[_0x9133('0x74')](_0x3d2e82));this[_0x9133('0x33')][_0x9133('0x71')](this,_0x32f979,_0x32f979[_0x9133('0x1a7')]);this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x26b540[_0x9133('0x15')]));this[_0x9133('0x32')]['sync'](this,_0x3d2e82);return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x1ac'));};AGIVertices['prototype'][_0x9133('0x1ad')]=function(_0x134b5d){logger['info'](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x134b5d[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x134b5d['variable_id'])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x134b5d,_0x9133('0x1ae'));}var _0x2592ec=this['getVariable'][_0x9133('0x71')](this,_0x134b5d[_0x9133('0x117')]);if(!_0x2592ec){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x134b5d,_0x9133('0xdd'));}return this['channel'][_0x9133('0xa7')](_0x2592ec,_0x134b5d[_0x9133('0x1af')]);};AGIVertices[_0x9133('0xe')][_0x9133('0x1b0')]=function(_0x32abb3){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x1b1'),_0x32abb3[_0x9133('0x36')]));this['channel'][_0x9133('0xab')](_0x9133('0x1b2'));if(_0x32abb3['answer']===_0x9133('0x1b3')){this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0x1b4'));return this[_0x9133('0x34')][_0x9133('0xbc')]();}return this[_0x9133('0x34')]['noop']('Skipped\x20Answer');};AGIVertices[_0x9133('0xe')][_0x9133('0x1b5')]=function(_0x1795f6){logger[_0x9133('0x2b')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x1795f6[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x1795f6['project_id'])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x1795f6,'no\x20subproject\x20selected');}var _0x18162d=this[_0x9133('0x16')][_0x9133('0x71')](this,_0x1795f6[_0x9133('0x1b6')]);if(!this[_0x9133('0x87')](_0x18162d)){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x1795f6,util[_0x9133('0x53')](_0x9133('0x1b7'),_0x1795f6[_0x9133('0x1b6')]));}if(_0x18162d===this[_0x9133('0x34')][_0x9133('0x38')]){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x1795f6,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x9133('0x33')][_0x9133('0x71')](this,_0x1795f6,_0x18162d);var _0x151268=this[_0x9133('0x34')][_0x9133('0xb0')](_0x9133('0x1b8'),util[_0x9133('0x53')](_0x9133('0x1b9'),config[_0x9133('0xb9')][_0x9133('0x1ba')]||'127.0.0.1',_0x18162d,this[_0x9133('0x34')][_0x9133('0x38')]));if(_0x151268[_0x9133('0xa5')]===-0x1){return _0x151268;}return this['channel'][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x176'),_0x9133('0x1b8'),_0x18162d));};AGIVertices[_0x9133('0xe')][_0x9133('0x1bb')]=function(_0x5ba5ed){logger['info'](util[_0x9133('0x53')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x5ba5ed[_0x9133('0x36')]));var _0x9813e8=this[_0x9133('0x56')][_0x9133('0x71')](this,_0x5ba5ed[_0x9133('0xba')]);this[_0x9133('0x33')][_0x9133('0x71')](this,_0x5ba5ed,_0x5ba5ed[_0x9133('0xba')]);if(this['isConfigured'](_0x5ba5ed[_0x9133('0x117')])){var _0x5cb8d3=this[_0x9133('0xf')][_0x9133('0x71')](this,_0x5ba5ed[_0x9133('0x117')]);if(_0x5cb8d3){this[_0x9133('0x34')][_0x9133('0xa7')](_0x5cb8d3,_0x9813e8);return this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x5ba5ed[_0x9133('0xba')],_0x5cb8d3));}}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x1bc'),_0x5ba5ed[_0x9133('0xba')]));};AGIVertices['prototype'][_0x9133('0x1bd')]=function(_0x333b6b){logger['info'](util[_0x9133('0x53')](_0x9133('0x1be'),_0x333b6b[_0x9133('0x36')]));_0x333b6b[_0x9133('0x5c')]=_0x333b6b[_0x9133('0x5c')][_0x9133('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x333b6b[_0x9133('0x5a')])){return this[_0x9133('0x34')][_0x9133('0xab')]('no\x20apiKey\x20configured');}if(!this['isConfigured'](_0x333b6b[_0x9133('0x5c')])){return this['channel']['noop'](_0x9133('0xed'));}this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')](_0x9133('0x1bf'),_0x333b6b[_0x9133('0x5c')]));var _0x30d8f8=this[_0x9133('0x59')][_0x9133('0x71')](this,_0x333b6b);if(_0x30d8f8){this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x1c0'),_0x30d8f8));var _0x2bd851=this[_0x9133('0x34')][_0x9133('0x106')](_0x30d8f8);try{fs[_0x9133('0x107')](_0x30d8f8+'.wav');}catch(_0x2020fd){logger['error'](_0x2020fd);}return _0x2bd851;}return this[_0x9133('0x34')]['error'](_0x333b6b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices['prototype']['tts']=function(_0x308c53){logger['info'](util[_0x9133('0x53')](_0x9133('0x1c1'),_0x308c53[_0x9133('0x36')]));_0x308c53['text']=_0x308c53['text'][_0x9133('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x9133('0x87')](_0x308c53['text'])){return this[_0x9133('0x34')][_0x9133('0xab')](_0x9133('0xed'));}this[_0x9133('0x34')][_0x9133('0xab')](util['format'](_0x9133('0x1c2'),_0x308c53[_0x9133('0x5c')]));var _0x19b1ab=this['googleTTS'][_0x9133('0x71')](this,_0x308c53);if(_0x19b1ab){this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x1c3'),_0x19b1ab));var _0x11e59c=this[_0x9133('0x34')][_0x9133('0x106')](_0x19b1ab);try{fs[_0x9133('0x107')](_0x19b1ab+_0x9133('0x12d'));}catch(_0x228881){logger[_0x9133('0x2f')](_0x228881);}return _0x11e59c;}return this['channel'][_0x9133('0x2f')](_0x308c53,_0x9133('0x1c4'));};AGIVertices[_0x9133('0xe')][_0x9133('0x1c5')]=function(_0x33045d){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x1c6'),_0x33045d[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x33045d[_0x9133('0x162')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x33045d,_0x9133('0x160'));}logger[_0x9133('0x2b')](util['format'](_0x9133('0x161'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x33045d['findBy']));var _0x456f7d=this['agentUnpause'][_0x9133('0x71')](this,_0x33045d[_0x9133('0x162')]);if(_0x456f7d){logger['info'](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')]['callerid'],_0x33045d[_0x9133('0x162')]));this[_0x9133('0x34')][_0x9133('0xab')](util[_0x9133('0x53')](_0x9133('0x163'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x33045d[_0x9133('0x162')]));return{'code':0xc8,'result':_0x9133('0x164')};}else{logger['info'](util[_0x9133('0x53')](_0x9133('0x167'),this[_0x9133('0x34')][_0x9133('0x3a')],_0x33045d[_0x9133('0x162')]));this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x9133('0x34')][_0x9133('0x3a')],_0x33045d[_0x9133('0x162')]));return{'code':0xc8,'result':_0x9133('0x165')};}};AGIVertices[_0x9133('0xe')][_0x9133('0x1c7')]=function(_0x1c4c0b){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x1c8'),_0x1c4c0b[_0x9133('0x36')]));var _0x4e6794=this[_0x9133('0x34')][_0x9133('0xb0')](_0x9133('0x1c9'),[_0x1c4c0b['mailbox'],_0x1c4c0b[_0x9133('0x79')]]);if(_0x4e6794[_0x9133('0xa5')]===-0x1){return _0x4e6794;}return this[_0x9133('0x34')]['noop'](util[_0x9133('0x53')]('Executed\x20command\x20%s\x20%s',_0x9133('0x1c9'),_0x1c4c0b['mailbox']));};AGIVertices[_0x9133('0xe')][_0x9133('0x1ca')]=function(_0x44987a){logger[_0x9133('0x2b')](util[_0x9133('0x53')](_0x9133('0x1cb'),_0x44987a[_0x9133('0x36')]));if(!this[_0x9133('0x87')](_0x44987a[_0x9133('0x117')])){return this[_0x9133('0x34')][_0x9133('0x2f')](_0x44987a,'no\x20variable\x20selected');}var _0x1774af=this[_0x9133('0xf')][_0x9133('0x71')](this,_0x44987a['variable_id']);if(!_0x1774af){return this[_0x9133('0x34')]['error'](_0x44987a,_0x9133('0xdd'));}var _0x9ace30=this[_0x9133('0x34')][_0x9133('0xf')](_0x1774af);return{'code':0xc8,'result':_0x9ace30['extra']?_0x9ace30['extra']:'-'};};String[_0x9133('0xe')][_0x9133('0x1cc')]=function(_0x281f0c,_0x12734f){return this[_0x9133('0xa2')](_0x281f0c)['join'](_0x12734f);};module[_0x9133('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 45c1c86..9ee0181 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 _0xa595=['prototype','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0xa595,0x19d));var _0x5a59=function(_0x2ac6f4,_0x429419){_0x2ac6f4=_0x2ac6f4-0x0;var _0x493548=_0xa595[_0x2ac6f4];return _0x493548;};'use strict';var util=require(_0x5a59('0x0'));var _=require(_0x5a59('0x1'));var moment=require(_0x5a59('0x2'));var ami=require(_0x5a59('0x3'));var logger=require('../../../config/logger')(_0x5a59('0x4'));var RpcUser=require(_0x5a59('0x5'));var RpcVoiceAgentReport=require(_0x5a59('0x6'));function Acw(_0x2951df){this[_0x5a59('0x7')]=_0x2951df[_0x5a59('0x7')];this[_0x5a59('0x8')]=_0x2951df['agents'];this[_0x5a59('0x9')]=_0x2951df[_0x5a59('0x9')];this[_0x5a59('0xa')]={};ami['on'](_0x5a59('0xb'),this[_0x5a59('0xc')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0xe'),this[_0x5a59('0xf')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x10'),this[_0x5a59('0x11')][_0x5a59('0xd')](this));ami['on']('agentringnoanswer',this[_0x5a59('0x12')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x13'),this[_0x5a59('0x14')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x15'),this[_0x5a59('0x16')][_0x5a59('0xd')](this));ami['on'](_0x5a59('0x17'),this[_0x5a59('0x18')][_0x5a59('0xd')](this));}function getDiff(_0xb0fa7e){var _0x21a896=moment()['milliseconds'](0x0);var _0x2059d3=moment(_0xb0fa7e)[_0x5a59('0x19')](0x0);return _0x21a896['diff'](_0x2059d3,_0x5a59('0x1a'));}Acw[_0x5a59('0x1b')]['startAcw']=function(_0x3369c2){try{var _0x4c8e4b=this;var _0x1eed0c=this[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x1c')];var _0x1052ac=this[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x1d')];var _0x151ecb=this['voiceQueues'][_0x1052ac];var _0x453a76=![];var _0x22b83d=_0x5a59('0x1e');if(_0x151ecb[_0x5a59('0x1f')]){if(_0x151ecb[_0x5a59('0x20')][_0x5a59('0x21')]){_0x453a76=!![];_0x22b83d=_0x151ecb[_0x5a59('0x20')][_0x5a59('0x21')];}}ami[_0x5a59('0x22')]({'action':'QueuePause','interface':_0x1eed0c,'paused':!![],'reason':_0x22b83d})['then'](function(_0x3e819b){if(_0x4c8e4b['agents'][_0x1eed0c]){return RpcUser['getAgent'](_0x4c8e4b[_0x5a59('0x8')][_0x1eed0c]['id'])[_0x5a59('0x23')](function(_0x5857a9){if(_0x5857a9&&!_0x5857a9[_0x5a59('0x24')]){logger[_0x5a59('0x25')](_0x5a59('0x26'),_0x3369c2,_0x1eed0c,_0x1052ac);var _0x393245=_0x4c8e4b[_0x5a59('0xa')][_0x3369c2]['attended']&&_0x4c8e4b['channels'][_0x3369c2][_0x5a59('0x27')]?_0x4c8e4b[_0x5a59('0xa')][_0x3369c2][_0x5a59('0x27')]:_0x3369c2;return RpcUser[_0x5a59('0x28')](_0x4c8e4b[_0x5a59('0x8')][_0x1eed0c],_0x22b83d,_0x393245)['then'](function(_0x14ddfe){if(!_0x453a76){_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]={};logger[_0x5a59('0x25')](_0x5a59('0x29'),_0x3369c2,_0x4c8e4b[_0x5a59('0x7')][_0x1052ac][_0x5a59('0x2a')],_0x1eed0c,_0x1052ac);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x2b')]=setTimeout(_0x4c8e4b['stopAcw'][_0x5a59('0xd')](_0x4c8e4b,_0x1eed0c),_0x4c8e4b['voiceQueues'][_0x1052ac][_0x5a59('0x2a')]*0x3e8);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['lastPauseAt']=moment()[_0x5a59('0x2c')](_0x5a59('0x2d'));_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['uniqueid']=_0x3369c2;_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x1d')]=_0x1052ac;_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c][_0x5a59('0x2e')]=function(){var _0x59e3f0=getDiff(_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['lastPauseAt']);clearTimeout(_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['timer']);_0x4c8e4b[_0x5a59('0x9')][_0x1eed0c]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x59e3f0},_0x4c8e4b['timers'][_0x1eed0c][_0x5a59('0x2f')],_0x1eed0c)['then'](function(_0x31d11b){logger['info'](_0x5a59('0x30'),_0x3369c2,_0x59e3f0,_0x31d11b);})[_0x5a59('0x31')](function(_0x2982ba){logger[_0x5a59('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x3369c2,_0x2982ba);});delete _0x4c8e4b[_0x5a59('0x9')][_0x1eed0c];};}});}else{logger[_0x5a59('0x25')](_0x5a59('0x33'),_0x3369c2,_0x1eed0c,_0x1052ac);}});}})[_0x5a59('0x31')](function(_0x4443b2){logger[_0x5a59('0x32')](_0x5a59('0x29'),_0x3369c2,_0x4c8e4b['voiceQueues'][_0x1052ac][_0x5a59('0x2a')],_0x1eed0c,_0x1052ac);})[_0x5a59('0x34')](function(){delete _0x4c8e4b[_0x5a59('0xa')][_0x3369c2];});}catch(_0x584425){logger['error'](_0x5a59('0x35'),_0x584425[_0x5a59('0x36')]);}};Acw['prototype'][_0x5a59('0x37')]=function(_0x226f35){try{var _0x233b54=this;if(_0x233b54[_0x5a59('0x9')][_0x226f35]){_0x233b54[_0x5a59('0x9')][_0x226f35][_0x5a59('0x2b')]=![];var _0x1af20c=_0x233b54['timers'][_0x226f35]['uniqueid'];var _0x489290=_0x233b54[_0x5a59('0x9')][_0x226f35]['queue'];var _0x1f7496=_0x233b54['voiceQueues'][_0x489290][_0x5a59('0x2a')];logger[_0x5a59('0x25')](_0x5a59('0x38'),_0x1af20c,_0x226f35);RpcUser['saveUnpause'](this[_0x5a59('0x8')][_0x226f35]);RpcVoiceAgentReport[_0x5a59('0x39')]({'acwtime':_0x1f7496,'agentacw':!![]},_0x1af20c,_0x226f35)[_0x5a59('0x23')](function(_0x512581){logger[_0x5a59('0x25')](_0x5a59('0x30'),_0x1af20c,_0x1f7496,_0x512581);})[_0x5a59('0x31')](function(_0xb5552f){logger[_0x5a59('0x32')](_0x5a59('0x3a'),_0x1af20c,_0xb5552f);});}else{logger[_0x5a59('0x32')](_0x5a59('0x3b'),_0x226f35);if(_0x233b54[_0x5a59('0x9')]){logger[_0x5a59('0x25')](_0x5a59('0x3c'),JSON[_0x5a59('0x3d')](_0x233b54[_0x5a59('0x9')]));}}}catch(_0x278169){logger[_0x5a59('0x32')]('[ACW][STOP]\x20%s',_0x278169['message']);}};Acw[_0x5a59('0x1b')]['syncAgentConnect']=function(_0x2c0865){try{if(this[_0x5a59('0x7')][_0x2c0865[_0x5a59('0x1d')]]&&(this[_0x5a59('0x7')][_0x2c0865[_0x5a59('0x1d')]][_0x5a59('0x4')]||this['voiceQueues'][_0x2c0865[_0x5a59('0x1d')]][_0x5a59('0x1f')])){if(this[_0x5a59('0x8')][_0x2c0865[_0x5a59('0x1c')]]){this[_0x5a59('0xa')][_0x2c0865[_0x5a59('0x2f')]]={'queue':_0x2c0865['queue'],'interface':_0x2c0865[_0x5a59('0x1c')],'destlinkedid':_0x2c0865[_0x5a59('0x27')]};}}}catch(_0x503a7c){logger[_0x5a59('0x32')](_0x5a59('0x3e'),_0x503a7c[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0x18')]=function(_0x2e8b5b){try{if(this[_0x5a59('0x7')][_0x2e8b5b[_0x5a59('0x1d')]]&&(this[_0x5a59('0x7')][_0x2e8b5b[_0x5a59('0x1d')]]['acw']||this['voiceQueues'][_0x2e8b5b[_0x5a59('0x1d')]][_0x5a59('0x1f')])){if(this[_0x5a59('0x8')][_0x2e8b5b[_0x5a59('0x1c')]]){this['channels'][_0x2e8b5b[_0x5a59('0x2f')]]={'queue':_0x2e8b5b[_0x5a59('0x1d')],'interface':_0x2e8b5b[_0x5a59('0x1c')]};}}}catch(_0x24d9c8){logger[_0x5a59('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x24d9c8[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0xf')]=function(_0x23defb){try{if(this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x2f')]]&&_[_0x5a59('0x3f')](this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x2f')]]['attended'])){logger[_0x5a59('0x25')](_0x5a59('0x40'),_0x23defb['uniqueid']);this[_0x5a59('0x41')](_0x23defb[_0x5a59('0x2f')]);}else if(this[_0x5a59('0xa')][_0x23defb[_0x5a59('0x42')]]&&_[_0x5a59('0x3f')](this[_0x5a59('0xa')][_0x23defb['linkedid']][_0x5a59('0x43')])){logger[_0x5a59('0x25')](_0x5a59('0x44'),_0x23defb[_0x5a59('0x42')]);this[_0x5a59('0x41')](_0x23defb[_0x5a59('0x42')]);}}catch(_0x59f313){logger[_0x5a59('0x32')](_0x5a59('0x45'),_0x59f313['message']);}};Acw['prototype'][_0x5a59('0x11')]=function(_0x4b5bd4){try{if(this['channels'][_0x4b5bd4[_0x5a59('0x2f')]]&&this[_0x5a59('0xa')][_0x4b5bd4[_0x5a59('0x2f')]][_0x5a59('0x43')]){logger[_0x5a59('0x25')](_0x5a59('0x46'),_0x4b5bd4[_0x5a59('0x2f')]);this[_0x5a59('0x41')](_0x4b5bd4[_0x5a59('0x2f')]);}else if(this['channels'][_0x4b5bd4['linkedid']]&&this[_0x5a59('0xa')][_0x4b5bd4[_0x5a59('0x42')]][_0x5a59('0x43')]){logger['info'](_0x5a59('0x47'),_0x4b5bd4['linkedid']);this[_0x5a59('0x41')](_0x4b5bd4[_0x5a59('0x42')]);}}catch(_0x442b5b){logger[_0x5a59('0x32')](_0x5a59('0x48'),_0x442b5b['message']);}};Acw[_0x5a59('0x1b')][_0x5a59('0x14')]=function(_0x3edc0a){try{if(!_[_0x5a59('0x49')](this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4a')]])){this[_0x5a59('0x41')](_0x3edc0a[_0x5a59('0x4a')]);if(this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]]){this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]][_0x5a59('0x43')]=!![];this['channels'][_0x3edc0a['transfertargetuniqueid']]=this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]];delete this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4b')]];}}else if(!_['isNil'](this[_0x5a59('0xa')][_0x3edc0a['transfertargetuniqueid']])){this[_0x5a59('0x41')](_0x3edc0a[_0x5a59('0x4c')]);if(this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]]){this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]][_0x5a59('0x43')]=!![];this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4a')]]=this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]];delete this[_0x5a59('0xa')][_0x3edc0a[_0x5a59('0x4d')]];}}}catch(_0x54037c){logger['error'](_0x5a59('0x4e'),_0x54037c[_0x5a59('0x36')]);}};Acw['prototype'][_0x5a59('0x16')]=function(_0x1a33bf){try{if(this['channels'][_0x1a33bf[_0x5a59('0x4f')]]){logger[_0x5a59('0x25')](_0x5a59('0x50'),JSON[_0x5a59('0x3d')](_0x1a33bf[_0x5a59('0x4f')]));this[_0x5a59('0x41')](_0x1a33bf[_0x5a59('0x4f')]);}else if(this[_0x5a59('0xa')][_0x1a33bf['transfererlinkedid']]){logger[_0x5a59('0x25')](_0x5a59('0x51'),JSON[_0x5a59('0x3d')](_0x1a33bf[_0x5a59('0x52')]));this[_0x5a59('0x41')](_0x1a33bf[_0x5a59('0x52')]);}}catch(_0x261d8b){logger[_0x5a59('0x32')](_0x5a59('0x53'),_0x261d8b[_0x5a59('0x36')]);}};Acw[_0x5a59('0x1b')][_0x5a59('0x12')]=function(_0x243730){try{if(this[_0x5a59('0x7')][_0x243730[_0x5a59('0x1d')]]&&this[_0x5a59('0x7')][_0x243730[_0x5a59('0x1d')]]['autopause']===_0x5a59('0x54')){if(this[_0x5a59('0x8')][_0x243730[_0x5a59('0x1c')]]){logger[_0x5a59('0x25')](_0x5a59('0x55'),_0x243730[_0x5a59('0x2f')],_0x243730[_0x5a59('0x1c')],_0x243730[_0x5a59('0x1d')]);return RpcUser['savePause'](this[_0x5a59('0x8')][_0x243730[_0x5a59('0x1c')]],_0x5a59('0x56'),_0x243730[_0x5a59('0x2f')]);}}}catch(_0x3a079f){logger[_0x5a59('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3a079f['message']);}};module[_0x5a59('0x57')]=Acw; \ No newline at end of file +var _0x0ecb=['mandatoryDisposition','name','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid','savePause','agents','timers','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','[%s][UPDATE][ACWTIME:%s]','error','[%s][UPDATE][ERRORS:%s]','catch','finally','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','all','exports','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW'];(function(_0x35852e,_0x3f3346){var _0x378323=function(_0x2767f3){while(--_0x2767f3){_0x35852e['push'](_0x35852e['shift']());}};_0x378323(++_0x3f3346);}(_0x0ecb,0xde));var _0xb0ec=function(_0x45adaf,_0x21c3c1){_0x45adaf=_0x45adaf-0x0;var _0x15d189=_0x0ecb[_0x45adaf];return _0x15d189;};'use strict';var util=require(_0xb0ec('0x0'));var _=require('lodash');var moment=require(_0xb0ec('0x1'));var ami=require(_0xb0ec('0x2'));var logger=require(_0xb0ec('0x3'))(_0xb0ec('0x4'));var RpcUser=require(_0xb0ec('0x5'));var RpcVoiceAgentReport=require(_0xb0ec('0x6'));function Acw(_0x44d975){this[_0xb0ec('0x7')]=_0x44d975['voiceQueues'];this['agents']=_0x44d975['agents'];this['timers']=_0x44d975['timers'];this[_0xb0ec('0x8')]={};ami['on'](_0xb0ec('0x9'),this[_0xb0ec('0xa')][_0xb0ec('0xb')](this));ami['on'](_0xb0ec('0xc'),this[_0xb0ec('0xd')][_0xb0ec('0xb')](this));ami['on']('hangup',this[_0xb0ec('0xe')]['bind'](this));ami['on'](_0xb0ec('0xf'),this[_0xb0ec('0x10')]['bind'](this));ami['on'](_0xb0ec('0x11'),this[_0xb0ec('0x12')][_0xb0ec('0xb')](this));ami['on'](_0xb0ec('0x13'),this['syncBlindTransfer']['bind'](this));ami['on'](_0xb0ec('0x14'),this[_0xb0ec('0x15')]['bind'](this));}function getDiff(_0x1fc314){var _0x20c04a=moment()['milliseconds'](0x0);var _0x2da614=moment(_0x1fc314)[_0xb0ec('0x16')](0x0);return _0x20c04a[_0xb0ec('0x17')](_0x2da614,_0xb0ec('0x18'));}Acw[_0xb0ec('0x19')][_0xb0ec('0x1a')]=function(_0x1e0859){try{var _0x16fab4=this;var _0x1c0e1e=this[_0xb0ec('0x8')][_0x1e0859][_0xb0ec('0x1b')];var _0xb13400=this['channels'][_0x1e0859][_0xb0ec('0x1c')];var _0x337a98=this[_0xb0ec('0x7')][_0xb13400];var _0x5dfd68=![];var _0x57b93b=_0xb0ec('0x1d');if(_0x337a98[_0xb0ec('0x1e')]){if(_0x337a98['mandatoryDispositionPause'][_0xb0ec('0x1f')]){_0x5dfd68=!![];_0x57b93b=_0x337a98['mandatoryDispositionPause'][_0xb0ec('0x1f')];}}ami['Action']({'action':_0xb0ec('0x20'),'interface':_0x1c0e1e,'paused':!![],'reason':_0x57b93b})[_0xb0ec('0x21')](function(_0x37495a){if(_0x16fab4['agents'][_0x1c0e1e]){return RpcUser[_0xb0ec('0x22')](_0x16fab4['agents'][_0x1c0e1e]['id'])[_0xb0ec('0x21')](function(_0x45f6f9){if(_0x45f6f9&&!_0x45f6f9[_0xb0ec('0x23')]){logger[_0xb0ec('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1e0859,_0x1c0e1e,_0xb13400);var _0x4bc404=_0x16fab4['channels'][_0x1e0859][_0xb0ec('0x25')]&&_0x16fab4[_0xb0ec('0x8')][_0x1e0859][_0xb0ec('0x26')]?_0x16fab4[_0xb0ec('0x8')][_0x1e0859][_0xb0ec('0x26')]:_0x1e0859;return RpcUser[_0xb0ec('0x27')](_0x16fab4[_0xb0ec('0x28')][_0x1c0e1e],_0x57b93b,_0x4bc404)[_0xb0ec('0x21')](function(_0x35f833){if(!_0x5dfd68){_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e]={};logger['info'](_0xb0ec('0x2a'),_0x1e0859,_0x16fab4[_0xb0ec('0x7')][_0xb13400][_0xb0ec('0x2b')],_0x1c0e1e,_0xb13400);_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e]['timer']=setTimeout(_0x16fab4['stopAcw'][_0xb0ec('0xb')](_0x16fab4,_0x1c0e1e),_0x16fab4[_0xb0ec('0x7')][_0xb13400]['acwTimeout']*0x3e8);_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x2c')]=moment()[_0xb0ec('0x2d')](_0xb0ec('0x2e'));_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x2f')]=_0x1e0859;_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x1c')]=_0xb13400;_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x30')]=function(){var _0x3c3ec1=getDiff(_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x2c')]);clearTimeout(_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x31')]);_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e][_0xb0ec('0x31')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3c3ec1},_0x16fab4[_0xb0ec('0x29')][_0x1c0e1e]['uniqueid'],_0x1c0e1e)[_0xb0ec('0x21')](function(_0x52d814){logger[_0xb0ec('0x24')](_0xb0ec('0x32'),_0x1e0859,_0x3c3ec1,_0x52d814);})['catch'](function(_0xaaa55c){logger[_0xb0ec('0x33')](_0xb0ec('0x34'),_0x1e0859,_0xaaa55c);});delete _0x16fab4[_0xb0ec('0x29')][_0x1c0e1e];};}});}else{logger[_0xb0ec('0x24')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x1e0859,_0x1c0e1e,_0xb13400);}});}})[_0xb0ec('0x35')](function(_0x54a0c8){logger[_0xb0ec('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x1e0859,_0x16fab4[_0xb0ec('0x7')][_0xb13400]['acwTimeout'],_0x1c0e1e,_0xb13400);})[_0xb0ec('0x36')](function(){delete _0x16fab4[_0xb0ec('0x8')][_0x1e0859];});}catch(_0x29042d){logger[_0xb0ec('0x33')](_0xb0ec('0x37'),_0x29042d[_0xb0ec('0x38')]);}};Acw['prototype'][_0xb0ec('0x39')]=function(_0x9b0955){try{var _0x5c8884=this;if(_0x5c8884['timers'][_0x9b0955]){_0x5c8884['timers'][_0x9b0955][_0xb0ec('0x31')]=![];var _0x2aa7b3=_0x5c8884[_0xb0ec('0x29')][_0x9b0955]['uniqueid'];var _0x4c3ce4=_0x5c8884[_0xb0ec('0x29')][_0x9b0955]['queue'];var _0x391015=_0x5c8884[_0xb0ec('0x7')][_0x4c3ce4][_0xb0ec('0x2b')];logger[_0xb0ec('0x24')](_0xb0ec('0x3a'),_0x2aa7b3,_0x9b0955);RpcUser['saveUnpause'](this[_0xb0ec('0x28')][_0x9b0955]);RpcVoiceAgentReport['update']({'acwtime':_0x391015,'agentacw':!![]},_0x2aa7b3,_0x9b0955)[_0xb0ec('0x21')](function(_0x5d156b){logger[_0xb0ec('0x24')](_0xb0ec('0x32'),_0x2aa7b3,_0x391015,_0x5d156b);})[_0xb0ec('0x35')](function(_0x38b650){logger['error'](_0xb0ec('0x34'),_0x2aa7b3,_0x38b650);});}else{logger[_0xb0ec('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x9b0955);if(_0x5c8884[_0xb0ec('0x29')]){logger[_0xb0ec('0x24')](_0xb0ec('0x3b'),JSON[_0xb0ec('0x3c')](_0x5c8884[_0xb0ec('0x29')]));}}}catch(_0x3a5d49){logger[_0xb0ec('0x33')](_0xb0ec('0x3d'),_0x3a5d49['message']);}};Acw[_0xb0ec('0x19')]['syncAgentConnect']=function(_0x4dae50){try{if(this[_0xb0ec('0x7')][_0x4dae50[_0xb0ec('0x1c')]]&&(this[_0xb0ec('0x7')][_0x4dae50[_0xb0ec('0x1c')]][_0xb0ec('0x4')]||this[_0xb0ec('0x7')][_0x4dae50['queue']][_0xb0ec('0x1e')])){if(this[_0xb0ec('0x28')][_0x4dae50[_0xb0ec('0x1b')]]){this[_0xb0ec('0x8')][_0x4dae50['uniqueid']]={'queue':_0x4dae50[_0xb0ec('0x1c')],'interface':_0x4dae50['interface'],'destlinkedid':_0x4dae50[_0xb0ec('0x26')]};}}}catch(_0x3aaa2c){logger['error'](_0xb0ec('0x3e'),_0x3aaa2c[_0xb0ec('0x38')]);}};Acw[_0xb0ec('0x19')]['syncAgentConnectPreview']=function(_0xfd3a2){try{if(this[_0xb0ec('0x7')][_0xfd3a2[_0xb0ec('0x1c')]]&&(this['voiceQueues'][_0xfd3a2[_0xb0ec('0x1c')]][_0xb0ec('0x4')]||this[_0xb0ec('0x7')][_0xfd3a2[_0xb0ec('0x1c')]]['mandatoryDisposition'])){if(this[_0xb0ec('0x28')][_0xfd3a2[_0xb0ec('0x1b')]]){this[_0xb0ec('0x8')][_0xfd3a2[_0xb0ec('0x2f')]]={'queue':_0xfd3a2['queue'],'interface':_0xfd3a2[_0xb0ec('0x1b')]};}}}catch(_0x7433aa){logger[_0xb0ec('0x33')](_0xb0ec('0x3f'),_0x7433aa[_0xb0ec('0x38')]);}};Acw[_0xb0ec('0x19')][_0xb0ec('0xd')]=function(_0x172ec1){try{if(this[_0xb0ec('0x8')][_0x172ec1[_0xb0ec('0x2f')]]&&_[_0xb0ec('0x40')](this[_0xb0ec('0x8')][_0x172ec1['uniqueid']]['attended'])){logger[_0xb0ec('0x24')](_0xb0ec('0x41'),_0x172ec1[_0xb0ec('0x2f')]);this[_0xb0ec('0x1a')](_0x172ec1[_0xb0ec('0x2f')]);}else if(this[_0xb0ec('0x8')][_0x172ec1[_0xb0ec('0x42')]]&&_[_0xb0ec('0x40')](this[_0xb0ec('0x8')][_0x172ec1['linkedid']][_0xb0ec('0x25')])){logger[_0xb0ec('0x24')]('[%s][HANGUP:LINKEDID]',_0x172ec1[_0xb0ec('0x42')]);this[_0xb0ec('0x1a')](_0x172ec1['linkedid']);}}catch(_0x404858){logger[_0xb0ec('0x33')](_0xb0ec('0x43'),_0x404858['message']);}};Acw['prototype'][_0xb0ec('0xe')]=function(_0x2fafd4){try{if(this[_0xb0ec('0x8')][_0x2fafd4[_0xb0ec('0x2f')]]&&this['channels'][_0x2fafd4['uniqueid']][_0xb0ec('0x25')]){logger['info'](_0xb0ec('0x44'),_0x2fafd4['uniqueid']);this[_0xb0ec('0x1a')](_0x2fafd4[_0xb0ec('0x2f')]);}else if(this[_0xb0ec('0x8')][_0x2fafd4[_0xb0ec('0x42')]]&&this[_0xb0ec('0x8')][_0x2fafd4[_0xb0ec('0x42')]][_0xb0ec('0x25')]){logger[_0xb0ec('0x24')](_0xb0ec('0x45'),_0x2fafd4[_0xb0ec('0x42')]);this['startAcw'](_0x2fafd4[_0xb0ec('0x42')]);}}catch(_0x2a441f){logger[_0xb0ec('0x33')](_0xb0ec('0x46'),_0x2a441f[_0xb0ec('0x38')]);}};Acw[_0xb0ec('0x19')][_0xb0ec('0x12')]=function(_0x367b96){try{if(!_[_0xb0ec('0x47')](this[_0xb0ec('0x8')][_0x367b96[_0xb0ec('0x48')]])){this[_0xb0ec('0x1a')](_0x367b96[_0xb0ec('0x48')]);if(this[_0xb0ec('0x8')][_0x367b96['secondtransfereruniqueid']]){this[_0xb0ec('0x8')][_0x367b96['secondtransfereruniqueid']][_0xb0ec('0x25')]=!![];this[_0xb0ec('0x8')][_0x367b96['transfertargetuniqueid']]=this['channels'][_0x367b96[_0xb0ec('0x49')]];delete this[_0xb0ec('0x8')][_0x367b96[_0xb0ec('0x49')]];}}else if(!_[_0xb0ec('0x47')](this['channels'][_0x367b96[_0xb0ec('0x4a')]])){this[_0xb0ec('0x1a')](_0x367b96[_0xb0ec('0x4a')]);if(this[_0xb0ec('0x8')][_0x367b96['origtransfereruniqueid']]){this[_0xb0ec('0x8')][_0x367b96[_0xb0ec('0x4b')]]['attended']=!![];this[_0xb0ec('0x8')][_0x367b96[_0xb0ec('0x48')]]=this[_0xb0ec('0x8')][_0x367b96['origtransfereruniqueid']];delete this[_0xb0ec('0x8')][_0x367b96[_0xb0ec('0x4b')]];}}}catch(_0x9e0e10){logger[_0xb0ec('0x33')](_0xb0ec('0x4c'),_0x9e0e10['message']);}};Acw[_0xb0ec('0x19')][_0xb0ec('0x4d')]=function(_0x3452ca){try{if(this[_0xb0ec('0x8')][_0x3452ca['transfereruniqueid']]){logger[_0xb0ec('0x24')](_0xb0ec('0x4e'),JSON['stringify'](_0x3452ca['transfereruniqueid']));this[_0xb0ec('0x1a')](_0x3452ca[_0xb0ec('0x4f')]);}else if(this[_0xb0ec('0x8')][_0x3452ca['transfererlinkedid']]){logger[_0xb0ec('0x24')](_0xb0ec('0x50'),JSON[_0xb0ec('0x3c')](_0x3452ca[_0xb0ec('0x51')]));this['startAcw'](_0x3452ca['transfererlinkedid']);}}catch(_0x5d14de){logger[_0xb0ec('0x33')]('[ACW][syncBlindTransfer]\x20%s',_0x5d14de[_0xb0ec('0x38')]);}};Acw[_0xb0ec('0x19')][_0xb0ec('0x10')]=function(_0x2fae4f){try{if(this[_0xb0ec('0x7')][_0x2fae4f['queue']]&&this[_0xb0ec('0x7')][_0x2fae4f[_0xb0ec('0x1c')]]['autopause']===_0xb0ec('0x52')){if(this[_0xb0ec('0x28')][_0x2fae4f[_0xb0ec('0x1b')]]){logger[_0xb0ec('0x24')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2fae4f[_0xb0ec('0x2f')],_0x2fae4f[_0xb0ec('0x1b')],_0x2fae4f[_0xb0ec('0x1c')]);return RpcUser[_0xb0ec('0x27')](this['agents'][_0x2fae4f[_0xb0ec('0x1b')]],'Auto-Pause',_0x2fae4f[_0xb0ec('0x2f')]);}}}catch(_0xda4d70){logger[_0xb0ec('0x33')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xda4d70[_0xb0ec('0x38')]);}};module[_0xb0ec('0x53')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index b652eba..8099990 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(_0x2f4406,_0x131aca){var _0x4b142b=function(_0x328880){while(--_0x328880){_0x2f4406['push'](_0x2f4406['shift']());}};_0x4b142b(++_0x131aca);}(_0x757a,0xde));var _0xa757=function(_0x3eea2c,_0x54940c){_0x3eea2c=_0x3eea2c-0x0;var _0x129af8=_0x757a[_0x3eea2c];return _0x129af8;};'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 _0x2032=['exports','bluebird','moment','util','../../config/logger','ami','asterisk','port','username','password','keepConnected','Action','promisify','action','format','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionSipShowRegistry','actionDeviceStateList','catch','inspect'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2032,0xd9));var _0x2203=function(_0x51c68a,_0x50caed){_0x51c68a=_0x51c68a-0x0;var _0x44f48a=_0x2032[_0x51c68a];return _0x44f48a;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var util=require(_0x2203('0x2'));var _=require('lodash');var logger=require(_0x2203('0x3'))(_0x2203('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x2203('0x5')][_0x2203('0x6')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')][_0x2203('0x8')],!![]);ami[_0x2203('0x9')]();ami[_0x2203('0xa')]=BPromise[_0x2203('0xb')](ami[_0x2203('0xc')]);function error(_0x5ecf9e){logger['error'](util[_0x2203('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x5ecf9e,![],null)));}function close(){logger[_0x2203('0xe')](util['format'](_0x2203('0xf'),config[_0x2203('0x5')]['username'],config['asterisk']['ip'],config['asterisk']['port']));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x2203('0xa')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x10')});};};ami[_0x2203('0x11')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x12')});};};ami[_0x2203('0x13')]=function(){return function(){return ami[_0x2203('0xa')]({'action':_0x2203('0x14')});};};ami[_0x2203('0x15')]=function(){return function(){return ami[_0x2203('0xa')]({'action':'coreshowchannels'});};};function connect(_0x280eda){logger[_0x2203('0x16')](util['format'](_0x2203('0x17'),config[_0x2203('0x5')]['username'],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')]));ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')](_0x2203('0x19'),close);}ami['on'](_0x2203('0x1a'),connect);ami['on']('shutdown',function(_0x13d3f7){logger['info'](util['format'](_0x2203('0x1b'),config['asterisk'][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config['asterisk'][_0x2203('0x6')],util['inspect'](_0x13d3f7,![],null)));});ami['on']('fullybooted',function(_0x226374){logger[_0x2203('0x16')](util[_0x2203('0xd')](_0x2203('0x1c'),config[_0x2203('0x5')][_0x2203('0x7')],config[_0x2203('0x5')]['ip'],config[_0x2203('0x5')]['port']));return BPromise[_0x2203('0x1d')]()[_0x2203('0x1e')](ami[_0x2203('0x1f')]())['then'](ami[_0x2203('0x20')]())[_0x2203('0x1e')](ami['actionSipPeerStatus']())[_0x2203('0x1e')](ami[_0x2203('0x13')]())[_0x2203('0x1e')](ami[_0x2203('0x15')]())[_0x2203('0x21')](function(_0x1df508){logger[_0x2203('0xe')]('[ami.js][fullybooted]',util[_0x2203('0x22')](_0x1df508,{'showHidden':![],'depth':null}));});});ami[_0x2203('0x18')](_0x2203('0xe'),error);ami[_0x2203('0x18')]('close',close);module[_0x2203('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 6c57f85..351b014 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x154f8c,_0x150b24){var _0x41b362=function(_0x4d4144){while(--_0x4d4144){_0x154f8c['push'](_0x154f8c['shift']());}};_0x41b362(++_0x150b24);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x38d977,_0x42be1d){_0x38d977=_0x38d977-0x0;var _0x355379=_0xbdb7[_0x38d977];return _0x355379;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0xb7e7,0x121));var _0x7b7e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xb7e7[_0x164eca];return _0x2ce562;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 6265acd..b1c1000 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 _0x1352=['exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','substring','dialCutDigit','getQueue','queue'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1352,0x115));var _0x2135=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1352[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x2135('0x0'));var _=require(_0x2135('0x1'));var moment=require(_0x2135('0x2'));function checkNameSurname(_0x13fa5f,_0xdae173,_0x1c1f7c){var _0x437d0a='';if(!_[_0x2135('0x3')](_0xdae173)&&_0x2135('0x4')===typeof _0xdae173){_0x437d0a+=_0xdae173;}if(!_[_0x2135('0x3')](_0x1c1f7c)&&_0x2135('0x4')===typeof _0x1c1f7c){_0x437d0a+='\x20'+_0x1c1f7c;}if(_0x437d0a!==''){return _0x437d0a;}return _0x13fa5f;}function Action(_0x4358d5,_0x34ee66,_0x1eaff9){this[_0x2135('0x5')]=_0x4358d5;this[_0x2135('0x6')]=_0x1eaff9||undefined;this[_0x2135('0x7')]=checkNameSurname(_0x34ee66[_0x2135('0x8')][_0x2135('0x9')],_0x34ee66[_0x2135('0x8')][_0x2135('0xa')],_0x34ee66[_0x2135('0x8')][_0x2135('0xb')]);this[_0x2135('0xc')]=_0x34ee66['phone'];this['queue']=_0x4358d5[_0x2135('0x7')];this[_0x2135('0xd')]=_0x34ee66[_0x2135('0xd')]||![];this['type']=_0x4358d5[_0x2135('0xe')];this[_0x2135('0xf')]=_0x4358d5[_0x2135('0xf')]||0x3;this['scheduledat']=_0x34ee66['scheduledat'];this[_0x2135('0x10')]=_0x34ee66[_0x2135('0x10')];this[_0x2135('0x11')]=_0x34ee66[_0x2135('0x11')];this[_0x2135('0x12')]=_0x34ee66[_0x2135('0x12')];this[_0x2135('0x13')]=_0x34ee66[_0x2135('0x13')];this[_0x2135('0x14')]=_0x34ee66['countdropretry'];this[_0x2135('0x15')]=_0x34ee66[_0x2135('0x15')];this[_0x2135('0x16')]=_0x34ee66[_0x2135('0x16')];this['countagentrejectretry']=_0x34ee66[_0x2135('0x17')];this[_0x2135('0x18')]=_0x34ee66[_0x2135('0x18')];this[_0x2135('0x19')]=_0x34ee66['ListId'];this['UserId']=_0x34ee66[_0x2135('0x1a')];this[_0x2135('0x1b')]=_0x34ee66[_0x2135('0x1b')];this[_0x2135('0x1c')]=_0x34ee66[_0x2135('0x1c')];this[_0x2135('0x1d')]=_0x34ee66['id'];this[_0x2135('0x1e')]=_0x34ee66[_0x2135('0x8')]['firstName']||'';this[_0x2135('0x1f')]=moment()[_0x2135('0x20')](_0x2135('0x21'));this[_0x2135('0x22')]=_0x34ee66[_0x2135('0x22')];this['callbackuniqueid']=_0x34ee66[_0x2135('0x23')];this[_0x2135('0x24')]=_0x34ee66['callbackat'];this[_0x2135('0x25')]=_0x34ee66[_0x2135('0x25')];this[_0x2135('0x26')]='';this[_0x2135('0x27')]='';}Action[_0x2135('0x28')]['getCaller']=function(){return util[_0x2135('0x20')]('\x22%s\x22\x20<%s>',this[_0x2135('0x7')],this[_0x2135('0x5')]['dialCutDigit']>0x0?this[_0x2135('0xc')][_0x2135('0x29')](this[_0x2135('0x5')][_0x2135('0x2a')]):this[_0x2135('0xc')]);};Action[_0x2135('0x28')][_0x2135('0x2b')]=function(){return this[_0x2135('0x2c')];};module[_0x2135('0x2d')]=Action; \ No newline at end of file +var _0x4937=['voiceQueue','uniqueid','name','Contact','phone','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','util','moment','isNil','string'];(function(_0x37b2ce,_0x5a6096){var _0x18e96a=function(_0x12282f){while(--_0x12282f){_0x37b2ce['push'](_0x37b2ce['shift']());}};_0x18e96a(++_0x5a6096);}(_0x4937,0x137));var _0x7493=function(_0x4d4d5a,_0x459aa4){_0x4d4d5a=_0x4d4d5a-0x0;var _0x5d9b76=_0x4937[_0x4d4d5a];return _0x5d9b76;};'use strict';var util=require(_0x7493('0x0'));var _=require('lodash');var moment=require(_0x7493('0x1'));function checkNameSurname(_0x3bf208,_0x1cc2f9,_0x234b25){var _0xfdbd26='';if(!_[_0x7493('0x2')](_0x1cc2f9)&&_0x7493('0x3')===typeof _0x1cc2f9){_0xfdbd26+=_0x1cc2f9;}if(!_[_0x7493('0x2')](_0x234b25)&&_0x7493('0x3')===typeof _0x234b25){_0xfdbd26+='\x20'+_0x234b25;}if(_0xfdbd26!==''){return _0xfdbd26;}return _0x3bf208;}function Action(_0x3436a6,_0xe7f060,_0x2eaec5){this[_0x7493('0x4')]=_0x3436a6;this[_0x7493('0x5')]=_0x2eaec5||undefined;this[_0x7493('0x6')]=checkNameSurname(_0xe7f060[_0x7493('0x7')][_0x7493('0x8')],_0xe7f060[_0x7493('0x7')]['firstName'],_0xe7f060[_0x7493('0x7')]['lastName']);this[_0x7493('0x9')]=_0xe7f060[_0x7493('0x8')];this['queue']=_0x3436a6['name'];this['active']=_0xe7f060[_0x7493('0xa')]||![];this[_0x7493('0xb')]=_0x3436a6[_0x7493('0xb')];this['dialQueueTimeout']=_0x3436a6[_0x7493('0xc')]||0x3;this[_0x7493('0xd')]=_0xe7f060[_0x7493('0xd')];this[_0x7493('0xe')]=_0xe7f060[_0x7493('0xe')];this[_0x7493('0xf')]=_0xe7f060['countcongestionretry'];this[_0x7493('0x10')]=_0xe7f060[_0x7493('0x10')];this[_0x7493('0x11')]=_0xe7f060[_0x7493('0x11')];this[_0x7493('0x12')]=_0xe7f060[_0x7493('0x12')];this[_0x7493('0x13')]=_0xe7f060[_0x7493('0x13')];this[_0x7493('0x14')]=_0xe7f060['countmachineretry'];this[_0x7493('0x15')]=_0xe7f060[_0x7493('0x15')];this[_0x7493('0x16')]=_0xe7f060[_0x7493('0x16')];this[_0x7493('0x17')]=_0xe7f060['ListId'];this[_0x7493('0x18')]=_0xe7f060[_0x7493('0x18')];this[_0x7493('0x19')]=_0xe7f060['VoiceQueueId'];this[_0x7493('0x1a')]=_0xe7f060[_0x7493('0x1a')];this[_0x7493('0x1b')]=_0xe7f060['id'];this[_0x7493('0x1c')]=_0xe7f060[_0x7493('0x7')][_0x7493('0x1d')]||'';this['starttime']=moment()[_0x7493('0x1e')](_0x7493('0x1f'));this['callback']=_0xe7f060[_0x7493('0x20')];this[_0x7493('0x21')]=_0xe7f060[_0x7493('0x21')];this['callbackat']=_0xe7f060['callbackat'];this[_0x7493('0x22')]=_0xe7f060['recallme'];this[_0x7493('0x23')]='';this[_0x7493('0x24')]='';}Action[_0x7493('0x25')][_0x7493('0x26')]=function(){return util[_0x7493('0x1e')](_0x7493('0x27'),this['name'],this[_0x7493('0x4')][_0x7493('0x28')]>0x0?this[_0x7493('0x9')][_0x7493('0x29')](this[_0x7493('0x4')][_0x7493('0x28')]):this[_0x7493('0x9')]);};Action[_0x7493('0x25')][_0x7493('0x2a')]=function(){return this[_0x7493('0x2b')];};module[_0x7493('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index a2b2612..fb469d5 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 _0x4eac=['statedesc','scheduledat','type','outbound','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','answertime','ringtime','holdtime','talktime','endtime','queue','membername','reason','callback','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','seconds','state'];(function(_0x4fca39,_0x4f1df7){var _0x28475c=function(_0x10a97d){while(--_0x10a97d){_0x4fca39['push'](_0x4fca39['shift']());}};_0x28475c(++_0x4f1df7);}(_0x4eac,0xf1));var _0xc4ea=function(_0x934afd,_0x2847b9){_0x934afd=_0x934afd-0x0;var _0x3ab4d3=_0x4eac[_0x934afd];return _0x3ab4d3;};'use strict';var util=require('util');var _=require(_0xc4ea('0x0'));var moment=require('moment');function getSeconds(_0x1cb8cb,_0x3cd343){var _0x4bebb2=moment(_0x1cb8cb)[_0xc4ea('0x1')](0x0);var _0xdf7164=moment(_0x3cd343)[_0xc4ea('0x1')](0x0);return _0x4bebb2[_0xc4ea('0x2')](_0xdf7164,_0xc4ea('0x3'));}function AgentComplete(_0x3e8afa,_0x70feea){this[_0xc4ea('0x4')]=0x4;this[_0xc4ea('0x5')]='Answer';this[_0xc4ea('0x6')]=_0x3e8afa[_0xc4ea('0x6')];this['type']=_0x3e8afa[_0xc4ea('0x7')];this['campaigntype']=_0x3e8afa['type']===_0xc4ea('0x8')?'queue':_0x3e8afa['type'];this['countbusyretry']=_0x3e8afa['countbusyretry'];this[_0xc4ea('0x9')]=_0x3e8afa[_0xc4ea('0x9')];this[_0xc4ea('0xa')]=_0x3e8afa['countnoanswerretry'];this[_0xc4ea('0xb')]=_0x3e8afa[_0xc4ea('0xc')]+_0x3e8afa[_0xc4ea('0x9')]+_0x3e8afa[_0xc4ea('0xa')]+_0x3e8afa[_0xc4ea('0xd')]+_0x3e8afa[_0xc4ea('0xe')]+_0x3e8afa[_0xc4ea('0xf')]+_0x3e8afa[_0xc4ea('0x10')]+_0x3e8afa[_0xc4ea('0x11')];this[_0xc4ea('0xd')]=_0x3e8afa[_0xc4ea('0xd')];this['countdropretry']=_0x3e8afa[_0xc4ea('0xe')];this[_0xc4ea('0xf')]=_0x3e8afa['countabandonedretry'];this[_0xc4ea('0x10')]=_0x3e8afa[_0xc4ea('0x10')];this[_0xc4ea('0x11')]=_0x3e8afa['countagentrejectretry'];this[_0xc4ea('0x12')]=_0x70feea['uniqueid'];this[_0xc4ea('0x13')]=_0x3e8afa['name'];this[_0xc4ea('0x14')]=_0x3e8afa['number'];this[_0xc4ea('0x15')]=_0x3e8afa['starttime'];this[_0xc4ea('0x16')]=_0x3e8afa[_0xc4ea('0x16')];this[_0xc4ea('0x17')]=_0x3e8afa[_0xc4ea('0x17')];this['endtime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xc4ea('0x18')]=getSeconds(_0x3e8afa[_0xc4ea('0x16')],_0x3e8afa[_0xc4ea('0x15')]);this[_0xc4ea('0x19')]=getSeconds(_0x3e8afa[_0xc4ea('0x17')],_0x3e8afa['responsetime']);this[_0xc4ea('0x1a')]=getSeconds(this[_0xc4ea('0x1b')],_0x3e8afa[_0xc4ea('0x17')]);this[_0xc4ea('0x1c')]=_0x70feea[_0xc4ea('0x1c')];this[_0xc4ea('0x1d')]=_0x70feea['membername'];this[_0xc4ea('0x1e')]=_0x70feea[_0xc4ea('0x1e')];this['callback']=_0x3e8afa[_0xc4ea('0x1f')];this['callbackuniqueid']=_0x3e8afa['callbackuniqueid'];this[_0xc4ea('0x20')]=_0x3e8afa[_0xc4ea('0x20')];this[_0xc4ea('0x21')]=_0x3e8afa[_0xc4ea('0x21')];this[_0xc4ea('0x22')]=_0x3e8afa[_0xc4ea('0x22')];this[_0xc4ea('0x23')]=_0x3e8afa[_0xc4ea('0x23')];this['UserId']=_0x3e8afa['UserId'];this['VoiceQueueId']=_0x3e8afa[_0xc4ea('0x24')];this[_0xc4ea('0x25')]=_0x3e8afa[_0xc4ea('0x25')];this[_0xc4ea('0x26')]=_0x3e8afa[_0xc4ea('0x26')]||'';this[_0xc4ea('0x27')]=_0x3e8afa[_0xc4ea('0x27')]||'';}module[_0xc4ea('0x28')]=AgentComplete; \ No newline at end of file +var _0x6b45=['membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','util','lodash','moment','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime'];(function(_0x377c4a,_0x3ea380){var _0x3fff5e=function(_0x162f74){while(--_0x162f74){_0x377c4a['push'](_0x377c4a['shift']());}};_0x3fff5e(++_0x3ea380);}(_0x6b45,0x185));var _0x56b4=function(_0x138690,_0x1f3134){_0x138690=_0x138690-0x0;var _0x115b1e=_0x6b45[_0x138690];return _0x115b1e;};'use strict';var util=require(_0x56b4('0x0'));var _=require(_0x56b4('0x1'));var moment=require(_0x56b4('0x2'));function getSeconds(_0x405969,_0x1851fe){var _0x1b155c=moment(_0x405969)['milliseconds'](0x0);var _0x21057d=moment(_0x1851fe)['milliseconds'](0x0);return _0x1b155c[_0x56b4('0x3')](_0x21057d,_0x56b4('0x4'));}function AgentComplete(_0x3d8857,_0x5b92b2){this['state']=0x4;this[_0x56b4('0x5')]=_0x56b4('0x6');this[_0x56b4('0x7')]=_0x3d8857[_0x56b4('0x7')];this[_0x56b4('0x8')]=_0x3d8857[_0x56b4('0x8')];this[_0x56b4('0x9')]=_0x3d8857['type']===_0x56b4('0xa')?_0x56b4('0xb'):_0x3d8857[_0x56b4('0x8')];this[_0x56b4('0xc')]=_0x3d8857[_0x56b4('0xc')];this[_0x56b4('0xd')]=_0x3d8857[_0x56b4('0xd')];this['countnoanswerretry']=_0x3d8857[_0x56b4('0xe')];this['countglobal']=_0x3d8857['countbusyretry']+_0x3d8857[_0x56b4('0xd')]+_0x3d8857[_0x56b4('0xe')]+_0x3d8857[_0x56b4('0xf')]+_0x3d8857[_0x56b4('0x10')]+_0x3d8857[_0x56b4('0x11')]+_0x3d8857['countmachineretry']+_0x3d8857[_0x56b4('0x12')];this['countnosuchnumberretry']=_0x3d8857[_0x56b4('0xf')];this['countdropretry']=_0x3d8857[_0x56b4('0x10')];this[_0x56b4('0x11')]=_0x3d8857[_0x56b4('0x11')];this['countmachineretry']=_0x3d8857[_0x56b4('0x13')];this[_0x56b4('0x12')]=_0x3d8857['countagentrejectretry'];this['uniqueid']=_0x5b92b2[_0x56b4('0x14')];this[_0x56b4('0x15')]=_0x3d8857[_0x56b4('0x16')];this['calleridnum']=_0x3d8857[_0x56b4('0x17')];this['starttime']=_0x3d8857[_0x56b4('0x18')];this[_0x56b4('0x19')]=_0x3d8857['responsetime'];this['answertime']=_0x3d8857[_0x56b4('0x1a')];this[_0x56b4('0x1b')]=moment()['format'](_0x56b4('0x1c'));this['ringtime']=getSeconds(_0x3d8857[_0x56b4('0x19')],_0x3d8857['starttime']);this[_0x56b4('0x1d')]=getSeconds(_0x3d8857['answertime'],_0x3d8857[_0x56b4('0x19')]);this[_0x56b4('0x1e')]=getSeconds(this[_0x56b4('0x1b')],_0x3d8857[_0x56b4('0x1a')]);this[_0x56b4('0xb')]=_0x5b92b2[_0x56b4('0xb')];this['membername']=_0x5b92b2[_0x56b4('0x1f')];this['reason']=_0x5b92b2[_0x56b4('0x20')];this[_0x56b4('0x21')]=_0x3d8857[_0x56b4('0x21')];this['callbackuniqueid']=_0x3d8857['callbackuniqueid'];this['callbackat']=_0x3d8857[_0x56b4('0x22')];this['recallme']=_0x3d8857[_0x56b4('0x23')];this[_0x56b4('0x24')]=_0x3d8857[_0x56b4('0x24')];this['ListId']=_0x3d8857[_0x56b4('0x25')];this[_0x56b4('0x26')]=_0x3d8857['UserId'];this['VoiceQueueId']=_0x3d8857[_0x56b4('0x27')];this[_0x56b4('0x28')]=_0x3d8857[_0x56b4('0x28')];this[_0x56b4('0x29')]=_0x3d8857['originatecalleridnum']||'';this['originatecalleridname']=_0x3d8857['originatecalleridname']||'';}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 0218112..0240803 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 _0x61a5=['scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','moment','milliseconds','diff','uniqueid'];(function(_0x7a85ef,_0x5a10ec){var _0x565d7d=function(_0x3491c9){while(--_0x3491c9){_0x7a85ef['push'](_0x7a85ef['shift']());}};_0x565d7d(++_0x5a10ec);}(_0x61a5,0xf0));var _0x561a=function(_0x687ddc,_0x2092fa){_0x687ddc=_0x687ddc-0x0;var _0x441991=_0x61a5[_0x687ddc];return _0x441991;};'use strict';var util=require(_0x561a('0x0'));var _=require('lodash');var moment=require(_0x561a('0x1'));function getSeconds(_0x28892d,_0xc164c0){var _0x862a0e=moment(_0x28892d)[_0x561a('0x2')](0x0);var _0x58f636=moment(_0xc164c0)[_0x561a('0x2')](0x0);return _0x862a0e[_0x561a('0x3')](_0x58f636,'seconds');}function Final(_0x18902a){this[_0x561a('0x4')]=_0x18902a[_0x561a('0x4')];this[_0x561a('0x5')]=_0x18902a[_0x561a('0x5')];this[_0x561a('0x6')]=_0x18902a[_0x561a('0x6')];this['campaigntype']=_0x18902a[_0x561a('0x6')]==='outbound'?_0x561a('0x7'):_0x18902a[_0x561a('0x6')];this['countbusyretry']=_0x18902a[_0x561a('0x8')];this[_0x561a('0x9')]=_0x18902a['countcongestionretry'];this[_0x561a('0xa')]=_0x18902a['countnoanswerretry'];this[_0x561a('0xb')]=_0x18902a[_0x561a('0x8')]+_0x18902a[_0x561a('0x9')]+_0x18902a[_0x561a('0xa')]+_0x18902a[_0x561a('0xc')]+_0x18902a[_0x561a('0xd')]+_0x18902a[_0x561a('0xe')]+_0x18902a[_0x561a('0xf')]+_0x18902a[_0x561a('0x10')];this[_0x561a('0xc')]=_0x18902a[_0x561a('0xc')];this[_0x561a('0xd')]=_0x18902a['countdropretry'];this[_0x561a('0xe')]=_0x18902a[_0x561a('0xe')];this[_0x561a('0xf')]=_0x18902a[_0x561a('0xf')];this[_0x561a('0x10')]=_0x18902a[_0x561a('0x10')];this[_0x561a('0x7')]=_0x18902a[_0x561a('0x7')];this[_0x561a('0x11')]=_0x18902a[_0x561a('0x11')];this[_0x561a('0x12')]=_0x18902a['calleridnum'];this[_0x561a('0x13')]=_0x18902a[_0x561a('0x13')];this['responsetime']=_0x18902a[_0x561a('0x14')];this[_0x561a('0x15')]=_0x18902a['responsetime'];this[_0x561a('0x16')]=_0x18902a['ringtime']||0x0;this['holdtime']=_0x18902a[_0x561a('0x17')]||0x0;this[_0x561a('0x18')]=_0x18902a['talktime']||0x0;this[_0x561a('0x19')]=_0x18902a[_0x561a('0x19')];this[_0x561a('0x1a')]=_0x18902a[_0x561a('0x1a')];this[_0x561a('0x1b')]=_0x18902a[_0x561a('0x1b')];this['recallme']=_0x18902a[_0x561a('0x1c')];this[_0x561a('0x1d')]=_0x18902a[_0x561a('0x1d')];this['ListId']=_0x18902a['ListId'];this[_0x561a('0x1e')]=_0x18902a[_0x561a('0x1e')];this[_0x561a('0x1f')]=_0x18902a[_0x561a('0x1f')];this[_0x561a('0x20')]=_0x18902a[_0x561a('0x20')];this[_0x561a('0x21')]=_0x18902a[_0x561a('0x21')]||'';this['originatecalleridname']=_0x18902a['originatecalleridname']||'';}module[_0x561a('0x22')]=Final; \ No newline at end of file +var _0xe14b=['lodash','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x17a11f,_0x5a9c65){var _0x30c86e=function(_0x15ec16){while(--_0x15ec16){_0x17a11f['push'](_0x17a11f['shift']());}};_0x30c86e(++_0x5a9c65);}(_0xe14b,0x93));var _0xbe14=function(_0x439ebe,_0x4c22d7){_0x439ebe=_0x439ebe-0x0;var _0x95e104=_0xe14b[_0x439ebe];return _0x95e104;};'use strict';var util=require(_0xbe14('0x0'));var _=require(_0xbe14('0x1'));var moment=require('moment');function getSeconds(_0x5cc4d8,_0x11c3a0){var _0x36393a=moment(_0x5cc4d8)['milliseconds'](0x0);var _0x7d3665=moment(_0x11c3a0)['milliseconds'](0x0);return _0x36393a['diff'](_0x7d3665,_0xbe14('0x2'));}function Final(_0x2d1a4a){this[_0xbe14('0x3')]=_0x2d1a4a[_0xbe14('0x3')];this[_0xbe14('0x4')]=_0x2d1a4a[_0xbe14('0x4')];this[_0xbe14('0x5')]=_0x2d1a4a['type'];this['campaigntype']=_0x2d1a4a['type']===_0xbe14('0x6')?_0xbe14('0x7'):_0x2d1a4a[_0xbe14('0x5')];this[_0xbe14('0x8')]=_0x2d1a4a['countbusyretry'];this['countcongestionretry']=_0x2d1a4a[_0xbe14('0x9')];this[_0xbe14('0xa')]=_0x2d1a4a['countnoanswerretry'];this[_0xbe14('0xb')]=_0x2d1a4a[_0xbe14('0x8')]+_0x2d1a4a[_0xbe14('0x9')]+_0x2d1a4a[_0xbe14('0xa')]+_0x2d1a4a[_0xbe14('0xc')]+_0x2d1a4a[_0xbe14('0xd')]+_0x2d1a4a[_0xbe14('0xe')]+_0x2d1a4a[_0xbe14('0xf')]+_0x2d1a4a[_0xbe14('0x10')];this[_0xbe14('0xc')]=_0x2d1a4a[_0xbe14('0xc')];this[_0xbe14('0xd')]=_0x2d1a4a[_0xbe14('0xd')];this['countabandonedretry']=_0x2d1a4a['countabandonedretry'];this[_0xbe14('0xf')]=_0x2d1a4a[_0xbe14('0xf')];this[_0xbe14('0x10')]=_0x2d1a4a[_0xbe14('0x10')];this['queue']=_0x2d1a4a[_0xbe14('0x7')];this[_0xbe14('0x11')]=_0x2d1a4a[_0xbe14('0x11')];this[_0xbe14('0x12')]=_0x2d1a4a[_0xbe14('0x12')];this[_0xbe14('0x13')]=_0x2d1a4a[_0xbe14('0x13')];this['responsetime']=_0x2d1a4a[_0xbe14('0x14')];this[_0xbe14('0x15')]=_0x2d1a4a[_0xbe14('0x14')];this[_0xbe14('0x16')]=_0x2d1a4a[_0xbe14('0x16')]||0x0;this[_0xbe14('0x17')]=_0x2d1a4a['holdtime']||0x0;this[_0xbe14('0x18')]=_0x2d1a4a[_0xbe14('0x18')]||0x0;this[_0xbe14('0x19')]=_0x2d1a4a[_0xbe14('0x19')];this[_0xbe14('0x1a')]=_0x2d1a4a['callbackuniqueid'];this[_0xbe14('0x1b')]=_0x2d1a4a['callbackat'];this[_0xbe14('0x1c')]=_0x2d1a4a['recallme'];this[_0xbe14('0x1d')]=_0x2d1a4a['ContactId'];this[_0xbe14('0x1e')]=_0x2d1a4a[_0xbe14('0x1e')];this['UserId']=_0x2d1a4a[_0xbe14('0x1f')];this['VoiceQueueId']=_0x2d1a4a[_0xbe14('0x20')];this['CampaignId']=_0x2d1a4a[_0xbe14('0x21')];this[_0xbe14('0x22')]=_0x2d1a4a[_0xbe14('0x22')]||'';this[_0xbe14('0x23')]=_0x2d1a4a[_0xbe14('0x23')]||'';}module[_0xbe14('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 27cd4d1..739a687 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 _0x40c8=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','talktime','membername','IVR','cause-txt','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','seconds','state','Answer','scheduledat','type','campaigntype'];(function(_0x11daae,_0x3a6d41){var _0x59e28f=function(_0x2d2874){while(--_0x2d2874){_0x11daae['push'](_0x11daae['shift']());}};_0x59e28f(++_0x3a6d41);}(_0x40c8,0xd2));var _0x840c=function(_0x5abb00,_0x41cf01){_0x5abb00=_0x5abb00-0x0;var _0x440615=_0x40c8[_0x5abb00];return _0x440615;};'use strict';var util=require(_0x840c('0x0'));var _=require(_0x840c('0x1'));var moment=require(_0x840c('0x2'));function getSeconds(_0x41aa99,_0x19d587){var _0xa0277e=moment(_0x41aa99)[_0x840c('0x3')](0x0);var _0x20cb1c=moment(_0x19d587)[_0x840c('0x3')](0x0);return _0xa0277e['diff'](_0x20cb1c,_0x840c('0x4'));}function Hangup(_0x163302,_0x15fed3){this[_0x840c('0x5')]=0x4;this['statedesc']=_0x840c('0x6');this[_0x840c('0x7')]=_0x163302[_0x840c('0x7')];this[_0x840c('0x8')]=_0x163302[_0x840c('0x8')];this[_0x840c('0x9')]=_0x163302[_0x840c('0x8')]===_0x840c('0xa')?_0x840c('0xb'):_0x163302['type'];this[_0x840c('0xc')]=_0x163302[_0x840c('0xc')];this[_0x840c('0xd')]=_0x163302['countcongestionretry'];this[_0x840c('0xe')]=_0x163302['countnoanswerretry'];this[_0x840c('0xf')]=_0x163302[_0x840c('0xc')]+_0x163302[_0x840c('0xd')]+_0x163302[_0x840c('0xe')]+_0x163302[_0x840c('0x10')]+_0x163302[_0x840c('0x11')]+_0x163302[_0x840c('0x12')]+_0x163302[_0x840c('0x13')]+_0x163302[_0x840c('0x14')];this[_0x840c('0x10')]=_0x163302['countnosuchnumberretry'];this[_0x840c('0x11')]=_0x163302[_0x840c('0x11')];this[_0x840c('0x12')]=_0x163302[_0x840c('0x12')];this[_0x840c('0x13')]=_0x163302[_0x840c('0x13')];this[_0x840c('0x14')]=_0x163302[_0x840c('0x14')];this[_0x840c('0x15')]=_0x15fed3[_0x840c('0x15')];this[_0x840c('0x16')]=_0x163302[_0x840c('0x17')];this[_0x840c('0x18')]=_0x163302[_0x840c('0x19')];this['starttime']=_0x163302['starttime'];this[_0x840c('0x1a')]=_0x163302[_0x840c('0x1a')];this[_0x840c('0x1b')]=moment()['format'](_0x840c('0x1c'));this[_0x840c('0x1d')]=getSeconds(_0x163302[_0x840c('0x1a')],_0x163302[_0x840c('0x1e')]);this[_0x840c('0x1f')]=0x0;this[_0x840c('0x20')]=getSeconds(this[_0x840c('0x1b')],_0x163302['responsetime']);this['queue']=_0x163302[_0x840c('0xb')];this[_0x840c('0x21')]=_0x840c('0x22');this['reason']=_0x15fed3[_0x840c('0x23')];this['callback']=_0x163302['callback'];this[_0x840c('0x24')]=_0x163302[_0x840c('0x24')];this['callbackat']=_0x163302[_0x840c('0x25')];this['recallme']=_0x163302[_0x840c('0x26')];this[_0x840c('0x27')]=_0x163302['ContactId'];this[_0x840c('0x28')]=_0x163302[_0x840c('0x28')];this['UserId']=_0x163302[_0x840c('0x29')];this[_0x840c('0x2a')]=_0x163302['VoiceQueueId'];this[_0x840c('0x2b')]=_0x163302[_0x840c('0x2b')];}module['exports']=Hangup; \ No newline at end of file +var _0xae6d=['number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum'];(function(_0xba2881,_0x5c75f4){var _0x5df38a=function(_0x36b5e9){while(--_0x36b5e9){_0xba2881['push'](_0xba2881['shift']());}};_0x5df38a(++_0x5c75f4);}(_0xae6d,0x73));var _0xdae6=function(_0x3b64ae,_0x2c4e93){_0x3b64ae=_0x3b64ae-0x0;var _0x1506b8=_0xae6d[_0x3b64ae];return _0x1506b8;};'use strict';var util=require('util');var _=require(_0xdae6('0x0'));var moment=require(_0xdae6('0x1'));function getSeconds(_0x3c4530,_0x45476a){var _0x136165=moment(_0x3c4530)[_0xdae6('0x2')](0x0);var _0x5b3687=moment(_0x45476a)['milliseconds'](0x0);return _0x136165[_0xdae6('0x3')](_0x5b3687,'seconds');}function Hangup(_0x3eb3da,_0x4d9f89){this['state']=0x4;this[_0xdae6('0x4')]=_0xdae6('0x5');this[_0xdae6('0x6')]=_0x3eb3da[_0xdae6('0x6')];this[_0xdae6('0x7')]=_0x3eb3da[_0xdae6('0x7')];this[_0xdae6('0x8')]=_0x3eb3da['type']===_0xdae6('0x9')?_0xdae6('0xa'):_0x3eb3da['type'];this[_0xdae6('0xb')]=_0x3eb3da[_0xdae6('0xb')];this[_0xdae6('0xc')]=_0x3eb3da['countcongestionretry'];this[_0xdae6('0xd')]=_0x3eb3da[_0xdae6('0xd')];this[_0xdae6('0xe')]=_0x3eb3da['countbusyretry']+_0x3eb3da[_0xdae6('0xc')]+_0x3eb3da[_0xdae6('0xd')]+_0x3eb3da[_0xdae6('0xf')]+_0x3eb3da[_0xdae6('0x10')]+_0x3eb3da[_0xdae6('0x11')]+_0x3eb3da[_0xdae6('0x12')]+_0x3eb3da['countagentrejectretry'];this[_0xdae6('0xf')]=_0x3eb3da[_0xdae6('0xf')];this['countdropretry']=_0x3eb3da['countdropretry'];this[_0xdae6('0x11')]=_0x3eb3da[_0xdae6('0x11')];this[_0xdae6('0x12')]=_0x3eb3da[_0xdae6('0x12')];this[_0xdae6('0x13')]=_0x3eb3da['countagentrejectretry'];this[_0xdae6('0x14')]=_0x4d9f89[_0xdae6('0x14')];this['calleridname']=_0x3eb3da[_0xdae6('0x15')];this[_0xdae6('0x16')]=_0x3eb3da[_0xdae6('0x17')];this[_0xdae6('0x18')]=_0x3eb3da[_0xdae6('0x18')];this[_0xdae6('0x19')]=_0x3eb3da[_0xdae6('0x19')];this[_0xdae6('0x1a')]=moment()[_0xdae6('0x1b')](_0xdae6('0x1c'));this[_0xdae6('0x1d')]=getSeconds(_0x3eb3da[_0xdae6('0x19')],_0x3eb3da[_0xdae6('0x18')]);this[_0xdae6('0x1e')]=0x0;this[_0xdae6('0x1f')]=getSeconds(this[_0xdae6('0x1a')],_0x3eb3da['responsetime']);this[_0xdae6('0xa')]=_0x3eb3da[_0xdae6('0xa')];this[_0xdae6('0x20')]=_0xdae6('0x21');this[_0xdae6('0x22')]=_0x4d9f89[_0xdae6('0x23')];this['callback']=_0x3eb3da[_0xdae6('0x24')];this['callbackuniqueid']=_0x3eb3da[_0xdae6('0x25')];this['callbackat']=_0x3eb3da[_0xdae6('0x26')];this[_0xdae6('0x27')]=_0x3eb3da['recallme'];this['ContactId']=_0x3eb3da[_0xdae6('0x28')];this[_0xdae6('0x29')]=_0x3eb3da['ListId'];this[_0xdae6('0x2a')]=_0x3eb3da[_0xdae6('0x2a')];this[_0xdae6('0x2b')]=_0x3eb3da['VoiceQueueId'];this['CampaignId']=_0x3eb3da[_0xdae6('0x2c')];}module[_0xdae6('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 4749922..2d63ce0 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 _0x5847=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','responsetime','ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x3f0f5a,_0x392903){var _0xe6500a=function(_0x4332bc){while(--_0x4332bc){_0x3f0f5a['push'](_0x3f0f5a['shift']());}};_0xe6500a(++_0x392903);}(_0x5847,0xf5));var _0x7584=function(_0x5e8f24,_0x259efe){_0x5e8f24=_0x5e8f24-0x0;var _0x3d1b33=_0x5847[_0x5e8f24];return _0x3d1b33;};'use strict';var util=require(_0x7584('0x0'));var _=require(_0x7584('0x1'));var moment=require(_0x7584('0x2'));function getSeconds(_0x3602d3,_0x3debef){var _0x223e75=moment(_0x3602d3)[_0x7584('0x3')](0x0);var _0x424a77=moment(_0x3debef)[_0x7584('0x3')](0x0);return _0x223e75[_0x7584('0x4')](_0x424a77,'seconds');}function History(_0x589988){this[_0x7584('0x5')]=_0x589988['uniqueid'];this[_0x7584('0x6')]=_0x589988[_0x7584('0x6')]||undefined;this[_0x7584('0x7')]=_0x589988['type'];this[_0x7584('0x8')]=_0x589988[_0x7584('0x7')]===_0x7584('0x9')?_0x7584('0xa'):_0x589988[_0x7584('0x7')];this[_0x7584('0xb')]=_0x589988['countbusyretry'];this[_0x7584('0xc')]=_0x589988['countcongestionretry'];this[_0x7584('0xd')]=_0x589988['countnoanswerretry'];this[_0x7584('0xe')]=_0x589988[_0x7584('0xb')]+_0x589988['countcongestionretry']+_0x589988[_0x7584('0xd')]+_0x589988[_0x7584('0xf')]+_0x589988[_0x7584('0x10')]+_0x589988['countabandonedretry']+_0x589988['countmachineretry']+_0x589988['countagentrejectretry'];this[_0x7584('0xf')]=_0x589988[_0x7584('0xf')];this['countdropretry']=_0x589988[_0x7584('0x10')];this[_0x7584('0x11')]=_0x589988['countabandonedretry'];this['countmachineretry']=_0x589988[_0x7584('0x12')];this[_0x7584('0x13')]=_0x589988['countagentrejectretry'];this[_0x7584('0xa')]=_0x589988['queue'];this[_0x7584('0x14')]=_0x589988[_0x7584('0x15')];this[_0x7584('0x16')]=_0x589988['number'];this['starttime']=_0x589988['starttime'];this[_0x7584('0x17')]=_0x589988[_0x7584('0x17')];this['endtime']=_0x589988['responsetime'];this[_0x7584('0x18')]=getSeconds(_0x589988[_0x7584('0x17')],_0x589988[_0x7584('0x19')]);this[_0x7584('0x1a')]=0x0;this[_0x7584('0x1b')]=0x0;this['callback']=_0x589988[_0x7584('0x1c')];this[_0x7584('0x1d')]=_0x589988[_0x7584('0x1d')];this[_0x7584('0x1e')]=_0x589988['callbackat'];this[_0x7584('0x1f')]=_0x589988[_0x7584('0x1f')];this['ContactId']=_0x589988[_0x7584('0x20')];this[_0x7584('0x21')]=_0x589988[_0x7584('0x21')];this[_0x7584('0x22')]=_0x589988[_0x7584('0x22')];this[_0x7584('0x23')]=_0x589988[_0x7584('0x23')];this[_0x7584('0x24')]=_0x589988[_0x7584('0x24')];this[_0x7584('0x25')]=_0x589988[_0x7584('0x25')]||'';this['originatecalleridname']=_0x589988[_0x7584('0x26')]||'';}module[_0x7584('0x27')]=History; \ No newline at end of file +var _0x35b1=['starttime','responsetime','endtime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number'];(function(_0x1930ce,_0x1eb074){var _0x4d28ea=function(_0x4d011d){while(--_0x4d011d){_0x1930ce['push'](_0x1930ce['shift']());}};_0x4d28ea(++_0x1eb074);}(_0x35b1,0x1e5));var _0x135b=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x35b1[_0x13843f];return _0x1063ae;};'use strict';var util=require(_0x135b('0x0'));var _=require(_0x135b('0x1'));var moment=require('moment');function getSeconds(_0x2c91a8,_0xb09c00){var _0x12c721=moment(_0x2c91a8)[_0x135b('0x2')](0x0);var _0x586e9e=moment(_0xb09c00)[_0x135b('0x2')](0x0);return _0x12c721[_0x135b('0x3')](_0x586e9e,'seconds');}function History(_0x18d4bc){this[_0x135b('0x4')]=_0x18d4bc[_0x135b('0x4')];this['scheduledat']=_0x18d4bc[_0x135b('0x5')]||undefined;this[_0x135b('0x6')]=_0x18d4bc['type'];this[_0x135b('0x7')]=_0x18d4bc[_0x135b('0x6')]==='outbound'?_0x135b('0x8'):_0x18d4bc[_0x135b('0x6')];this['countbusyretry']=_0x18d4bc[_0x135b('0x9')];this[_0x135b('0xa')]=_0x18d4bc[_0x135b('0xa')];this['countnoanswerretry']=_0x18d4bc[_0x135b('0xb')];this[_0x135b('0xc')]=_0x18d4bc[_0x135b('0x9')]+_0x18d4bc[_0x135b('0xa')]+_0x18d4bc[_0x135b('0xb')]+_0x18d4bc[_0x135b('0xd')]+_0x18d4bc[_0x135b('0xe')]+_0x18d4bc[_0x135b('0xf')]+_0x18d4bc[_0x135b('0x10')]+_0x18d4bc[_0x135b('0x11')];this[_0x135b('0xd')]=_0x18d4bc[_0x135b('0xd')];this[_0x135b('0xe')]=_0x18d4bc[_0x135b('0xe')];this['countabandonedretry']=_0x18d4bc['countabandonedretry'];this[_0x135b('0x10')]=_0x18d4bc[_0x135b('0x10')];this['countagentrejectretry']=_0x18d4bc[_0x135b('0x11')];this[_0x135b('0x8')]=_0x18d4bc[_0x135b('0x8')];this[_0x135b('0x12')]=_0x18d4bc[_0x135b('0x13')];this[_0x135b('0x14')]=_0x18d4bc[_0x135b('0x15')];this[_0x135b('0x16')]=_0x18d4bc[_0x135b('0x16')];this[_0x135b('0x17')]=_0x18d4bc['responsetime'];this[_0x135b('0x18')]=_0x18d4bc['responsetime'];this[_0x135b('0x19')]=getSeconds(_0x18d4bc[_0x135b('0x17')],_0x18d4bc['starttime']);this[_0x135b('0x1a')]=0x0;this['talktime']=0x0;this[_0x135b('0x1b')]=_0x18d4bc[_0x135b('0x1b')];this[_0x135b('0x1c')]=_0x18d4bc[_0x135b('0x1c')];this['callbackat']=_0x18d4bc[_0x135b('0x1d')];this['recallme']=_0x18d4bc[_0x135b('0x1e')];this[_0x135b('0x1f')]=_0x18d4bc[_0x135b('0x1f')];this['ListId']=_0x18d4bc[_0x135b('0x20')];this[_0x135b('0x21')]=_0x18d4bc['UserId'];this['VoiceQueueId']=_0x18d4bc[_0x135b('0x22')];this[_0x135b('0x23')]=_0x18d4bc[_0x135b('0x23')];this[_0x135b('0x24')]=_0x18d4bc[_0x135b('0x24')]||'';this[_0x135b('0x25')]=_0x18d4bc[_0x135b('0x25')]||'';}module[_0x135b('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 8fb937d..16467ba 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 _0xedc4=['[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','rrmemory','queueBooked','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','command','interval','content','indexOf','true','iftime\x20%s,%s','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','Queue','checkPreviewRecallReminder','handlePreviewRecallNotifications','user:%s','user:dialPreviewRecallReminder','launchHandleIvr','handleIvr','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','map','checkIfTimeIntervals','\x5cw{0,','pow','replace','match','object','originate','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','callerid','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','phone','variables','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','OriginateError','[originate][error]','getQueue','isSuccess','response','callProgressDetecting','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','dialCongestionRetryFrequency','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMinThreshold','floor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','tryOriginatePredictive','RUNNING','[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','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/setting','./action','./history','./final','./queueCallerAbandon','./hangup','env','127.0.0.1','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','startProgressive','ivrOriginated','queueBookedRR','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','isUndefined','AGENTS_NOT_LOGGED','name','message','NOT_ACTIVE','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20progressive','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','inspect','error','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','pTalking','debug','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','enqueue','Action','channel','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','catch','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','status','reachable','SIP/%s','unmonitored','createHistory','uniqueId','isNil','variable','amdstatus','exten','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','custom:amd','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnoanswerretry','countdropretry','syncHangup','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Unknow','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','TIMEOUT','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','dialAbandonedRetryFrequency','dialAbandonedMaxRetry'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xedc4,0xf4));var _0x4edc=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xedc4[_0x2b4411];return _0x8e41ef;};'use strict';var util=require(_0x4edc('0x0'));var _=require(_0x4edc('0x1'));var uuid=require(_0x4edc('0x2'));var moment=require(_0x4edc('0x3'));var rr=require('rr');var md5=require(_0x4edc('0x4'));var Redis=require(_0x4edc('0x5'));var ut=require(_0x4edc('0x6'));var config=require(_0x4edc('0x7'));var logger=require(_0x4edc('0x8'))(_0x4edc('0x9'));var loggerBooked=require(_0x4edc('0x8'))(_0x4edc('0xa'));var loggerPredictive=require(_0x4edc('0x8'))(_0x4edc('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4edc('0xc'));var loggerSyncQueueSummary=require(_0x4edc('0x8'))(_0x4edc('0xd'));var ami=require(_0x4edc('0xe'));config[_0x4edc('0xf')]=_[_0x4edc('0x10')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4edc('0xf')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperAdditionalPhone=require(_0x4edc('0x11'));var cmHopperBlack=require(_0x4edc('0x12'));var voiceQueueRt=require(_0x4edc('0x13'));var RpcSetting=require(_0x4edc('0x14'));var Action=require(_0x4edc('0x15'));var History=require(_0x4edc('0x16'));var Final=require(_0x4edc('0x17'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x4edc('0x18'));var Hangup=require(_0x4edc('0x19'));var ipAgi=process[_0x4edc('0x1a')]['XCALLY_IP_AGI']||_0x4edc('0x1b');var strategy={'rrmemory':'rrmemory','roundrobin':_0x4edc('0x1c')};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x4edc('0x1d')]['enqueue']=function(_0x37ed40){this[_0x4edc('0x1e')]=this[_0x4edc('0x1e')]?this['tail'][_0x4edc('0x1f')](_0x37ed40):_0x37ed40();};function Dialer(_0x217447,_0x5c5a32){this[_0x4edc('0x20')]=new Sequence();this[_0x4edc('0x21')]=_0x5c5a32;this['voiceQueues']=_0x217447[_0x4edc('0x22')];this[_0x4edc('0x23')]=_0x217447[_0x4edc('0x23')];this[_0x4edc('0x24')]=_0x217447[_0x4edc('0x24')];this['trunks']=_0x217447[_0x4edc('0x25')];this[_0x4edc('0x26')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x4edc('0x27')]={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x4edc('0x28')]={};this[_0x4edc('0x29')]={};this['queueBooked']={};this[_0x4edc('0x2a')]={};ami['on']('agentconnect',this[_0x4edc('0x2b')][_0x4edc('0x2c')](this));ami['on']('queuecallerabandon',this[_0x4edc('0x2d')]['bind'](this));ami['on'](_0x4edc('0x2e'),this[_0x4edc('0x2f')][_0x4edc('0x2c')](this));ami['on']('agentcomplete',this['syncAgentComplete']['bind'](this));ami['on'](_0x4edc('0x30'),this[_0x4edc('0xd')]['bind'](this));ami['on'](_0x4edc('0x31'),this[_0x4edc('0x32')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x33'),this['syncHangup'][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x34'),this[_0x4edc('0x35')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x36'),this[_0x4edc('0x37')][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x38'),this['syncQueueMember'][_0x4edc('0x2c')](this));ami['on'](_0x4edc('0x39'),this[_0x4edc('0x3a')][_0x4edc('0x2c')](this));this[_0x4edc('0x3b')]();this[_0x4edc('0x3c')]();RpcSetting[_0x4edc('0x3d')]()[_0x4edc('0x3e')](function(_0x568012){previewRecallmeReminderInterval=_0x568012['previewRecallmeReminderInterval'];});}function isNotNull(_0x555469){return _0x555469!==null&&!_[_0x4edc('0x3f')](_0x555469);}function checkIsLoggedIn(_0x281368,_0x168b02){return function(){if(_0x168b02<=0x0){_0x281368['message']=_0x4edc('0x40');throw _0x281368[_0x4edc('0x41')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x1a714c){return _0x1a714c;}function checkIsActive(_0x28bc62,_0x588535){return function(){if(!isActive(_0x588535)){_0x28bc62[_0x4edc('0x42')]=_0x4edc('0x43');throw _0x28bc62[_0x4edc('0x41')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4de80c){return function(){if(!isNotNull(_0x4de80c[_0x4edc('0x44')])){_0x4de80c[_0x4edc('0x42')]='INTERVAL_IS_NULL';throw _0x4de80c['name']+_0x4edc('0x45');}if(!isNotNull(_0x4de80c[_0x4edc('0x44')]['Intervals'])){_0x4de80c[_0x4edc('0x42')]=_0x4edc('0x46');throw _0x4de80c['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4edc('0x47')](_0x4de80c[_0x4edc('0x44')]['Intervals']))){_0x4de80c[_0x4edc('0x42')]='INTERVAL_IS_NULL';throw _0x4de80c[_0x4edc('0x41')]+_0x4edc('0x45');}};}function msgResponse(_0x33f8b6,_0x166381,_0x118382){return{'action':_0x33f8b6,'response':_0x166381,'message':_0x118382,'stack':_0x118382};}function myreject(_0x5b9732){return function(_0x1a6047){return _0x5b9732(msgResponse(_0x4edc('0x48'),_0x4edc('0x49'),JSON[_0x4edc('0x4a')](_0x1a6047)));};}function getSeconds(_0x465d21,_0x476565){var _0x1bfbd1=moment(_0x465d21)[_0x4edc('0x4b')](0x0);var _0x3121d3=moment(_0x476565)['milliseconds'](0x0);return _0x1bfbd1['diff'](_0x3121d3,'seconds');}function emit(_0x2028eb,_0x17ab6a,_0x1c6322){io['to'](_0x2028eb)[_0x4edc('0x4c')](_0x17ab6a,_0x1c6322);}function emitVoiceQueueSummary(_0x5b94f7){if(_0x5b94f7[_0x4edc('0x4d')]===_0x4edc('0x4e')){var _0x52d3d3={'id':_0x5b94f7['id'],'name':_0x5b94f7[_0x4edc('0x41')],'strategy':_0x5b94f7[_0x4edc('0x4f')],'answered':_0x5b94f7[_0x4edc('0x50')],'available':_0x5b94f7[_0x4edc('0x51')],'loggedIn':_0x5b94f7[_0x4edc('0x52')],'pTalking':_0x5b94f7['pTalking'],'sumBillable':_0x5b94f7[_0x4edc('0x53')],'sumDuration':_0x5b94f7['sumDuration'],'sumHoldTime':_0x5b94f7['sumHoldTime']||0x0,'talking':_0x5b94f7[_0x4edc('0x54')],'total':_0x5b94f7[_0x4edc('0x55')],'type':_0x5b94f7[_0x4edc('0x4d')],'unmanaged':_0x5b94f7[_0x4edc('0x56')],'abandoned':_0x5b94f7[_0x4edc('0x57')],'waiting':_0x5b94f7[_0x4edc('0x58')],'loggedInDb':_0x5b94f7[_0x4edc('0x59')],'dialActive':_0x5b94f7[_0x4edc('0x5a')],'dialMethod':_0x5b94f7[_0x4edc('0x5b')],'dialOriginateCallerIdName':_0x5b94f7[_0x4edc('0x5c')],'dialOriginateCallerIdNumber':_0x5b94f7[_0x4edc('0x5d')],'dialOriginateTimeout':_0x5b94f7[_0x4edc('0x5e')],'dialPrefix':_0x5b94f7[_0x4edc('0x5f')],'outboundAnswerAgiCallsDay':_0x5b94f7['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x5b94f7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x5b94f7[_0x4edc('0x60')],'outboundBusyCallsDay':_0x5b94f7[_0x4edc('0x61')],'outboundCongestionCallsDay':_0x5b94f7[_0x4edc('0x62')],'outboundDropCallsDayACS':_0x5b94f7[_0x4edc('0x63')],'outboundDropCallsDayCallersExit':_0x5b94f7['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x5b94f7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x5b94f7[_0x4edc('0x64')],'outboundNoSuchCallsDay':_0x5b94f7[_0x4edc('0x65')],'outboundOriginateFailureCallsDay':_0x5b94f7[_0x4edc('0x66')],'outboundReCallsDay':_0x5b94f7[_0x4edc('0x67')],'outboundRejectCallsDay':_0x5b94f7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x5b94f7[_0x4edc('0x68')],'predictiveIntervalAnsweredCalls':_0x5b94f7['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5b94f7[_0x4edc('0x69')],'predictiveIntervalAvgTalktime':_0x5b94f7[_0x4edc('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x5b94f7[_0x4edc('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x5b94f7['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5b94f7['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5b94f7[_0x4edc('0x6c')],'predictiveIntervalHitRate':_0x5b94f7[_0x4edc('0x6d')],'predictiveIntervalMultiplicativeFactor':_0x5b94f7[_0x4edc('0x6e')],'predictiveIntervalPauses':_0x5b94f7[_0x4edc('0x6f')],'predictiveIntervalAvailable':_0x5b94f7[_0x4edc('0x70')],'predictiveIntervalTotalCalls':_0x5b94f7[_0x4edc('0x71')],'message':_0x5b94f7[_0x4edc('0x42')],'originated':_0x5b94f7['originated'],'erlangCalls':_0x5b94f7[_0x4edc('0x72')],'erlangCallToSecond':_0x5b94f7[_0x4edc('0x73')],'erlangAbandonmentRate':_0x5b94f7[_0x4edc('0x74')],'erlangBusyFactor':_0x5b94f7[_0x4edc('0x75')],'startPredictive':_0x5b94f7['startPredictive'],'startProgressive':_0x5b94f7[_0x4edc('0x28')]};if(_0x5b94f7[_0x4edc('0x76')]){_0x52d3d3['Trunk']={'id':_0x5b94f7[_0x4edc('0x76')]['id'],'name':_0x5b94f7[_0x4edc('0x76')][_0x4edc('0x41')],'active':_0x5b94f7[_0x4edc('0x76')][_0x4edc('0x77')],'callerid':_0x5b94f7[_0x4edc('0x76')]['callerid']};}if(_0x5b94f7[_0x4edc('0x44')]){_0x52d3d3[_0x4edc('0x44')]={'id':_0x5b94f7[_0x4edc('0x44')]['id'],'name':_0x5b94f7[_0x4edc('0x44')]['name']};}var _0x49a1db=md5(JSON['stringify'](_0x52d3d3));if(_0x5b94f7[_0x4edc('0x4')]!==_0x49a1db){_0x5b94f7[_0x4edc('0x4')]=_0x49a1db;emit(util[_0x4edc('0x78')](_0x4edc('0x79'),_0x52d3d3[_0x4edc('0x41')]),_0x4edc('0x7a'),_0x52d3d3);}}}function emitCampaignSummary(_0x5c5424){if(_0x5c5424['type']===_0x4edc('0x7b')){emit(util[_0x4edc('0x78')](_0x4edc('0x7c'),_0x5c5424[_0x4edc('0x41')]),_0x4edc('0x7d'),_0x5c5424);}}function checkGetDataPredictive(_0x29fbf2){if(isNotNull(_0x29fbf2)&&!_[_0x4edc('0x47')](_0x29fbf2)){loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x7f'));loggerPredictive['info'](_0x4edc('0x80'),_0x29fbf2[_0x4edc('0x71')]);loggerPredictive['info'](_0x4edc('0x81'),_0x29fbf2[_0x4edc('0x82')]);loggerPredictive[_0x4edc('0x7e')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x29fbf2[_0x4edc('0x83')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x84'),_0x29fbf2['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x4edc('0x85'),_0x29fbf2['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x86'),_0x29fbf2[_0x4edc('0x6a')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x87'));if(_0x29fbf2[_0x4edc('0x71')]>0x0){if(!_['isUndefined'](_0x29fbf2[_0x4edc('0x6a')])&&_0x29fbf2['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x88'));if(!_[_0x4edc('0x3f')](_0x29fbf2['predictiveIntervalAvgHoldtime'])&&_0x29fbf2[_0x4edc('0x69')]>0x0){return!![];}loggerPredictive[_0x4edc('0x7e')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x89'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5d609d){return function(_0xc5ecd8){loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8a'));loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8b'),_0xc5ecd8['erlangCalls']);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8c'),_0xc5ecd8[_0x4edc('0x73')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8d'),_0xc5ecd8['erlangAbandonmentRate']);loggerPredictive['info'](_0x4edc('0x8e'),_0xc5ecd8[_0x4edc('0x75')]);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x8d'),_0xc5ecd8[_0x4edc('0x74')]);loggerPredictive['info'](_0x4edc('0x87'));_[_0x4edc('0x8f')](_0x5d609d,_0xc5ecd8);};}function getDiff(_0x22bfb5){var _0x4a30bd=moment()['milliseconds'](0x0);var _0x4fb9a1=moment(_0x22bfb5)[_0x4edc('0x4b')](0x0);return _0x4a30bd[_0x4edc('0x90')](_0x4fb9a1,'seconds');}function ifInterval(_0x1831a6,_0x2177dd){if(_[_0x4edc('0x3f')](_0x2177dd)){return![];}return getDiff(_0x2177dd)<_0x1831a6*0x3c;}function freeVariablesPredictive(_0x4342b2){if(isNotNull(_0x4342b2)){if(!_[_0x4edc('0x3f')](_0x4342b2['startProgressive'])){_0x4342b2['startProgressive']=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x91'));}if(!_[_0x4edc('0x3f')](_0x4342b2[_0x4edc('0x92')])){_0x4342b2[_0x4edc('0x92')]=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x93'));}if(!_['isUndefined'](_0x4342b2['handlePredictive'])){clearInterval(_0x4342b2['handlePredictive']);_0x4342b2[_0x4edc('0x94')]=undefined;loggerPredictive[_0x4edc('0x7e')](_0x4342b2[_0x4edc('0x41')],_0x4edc('0x95'));}}}function erlangb(_0x26d3ca,_0x4dfab3){if(_0x4dfab3===0x0){return 0x0;}var _0x4f8a3d=0x1;for(var _0x53a5b2=0x1;_0x53a5b2<=_0x4dfab3;_0x53a5b2+=0x1){_0x4f8a3d=0x1+_0x4f8a3d*_0x53a5b2/_0x26d3ca;}return 0x1/_0x4f8a3d;}function isVoiceQueueOutbound(_0xfe0d95){return _0xfe0d95===_0x4edc('0x4e');}function isNotPreview(_0x56520d){return _0x56520d!==_0x4edc('0x21');}function isCampaignIvr(_0x5a16f3){return _0x5a16f3===_0x4edc('0x7b');}function getCallerId(_0x5580e6,_0x1e429a,_0x647001){if(!_[_0x4edc('0x3f')](_0x647001)&&typeof _0x647001==='string'&&!_[_0x4edc('0x47')](_0x647001)){if(!_[_0x4edc('0x3f')](_0x1e429a)&&typeof _0x1e429a===_0x4edc('0x96')&&!_['isEmpty'](_0x1e429a)){return util[_0x4edc('0x78')](_0x4edc('0x97'),_0x1e429a,_0x647001);}return util['format']('\x22%s\x22\x20<%s>',_0x647001,_0x647001);}if(!_[_0x4edc('0x3f')](_0x5580e6)&&typeof _0x5580e6===_0x4edc('0x96')&&!_[_0x4edc('0x47')](_0x5580e6)){return _0x5580e6;}return _0x4edc('0x98');}function loggerCatchQueueSummary(_0x3f7f19,_0x37e6d2){return function(_0x27db61){freeVariablesPredictive(_0x37e6d2);emitVoiceQueueSummary(_0x37e6d2);emitCampaignSummary(_0x37e6d2);loggerSyncQueueSummary['debug'](_0x3f7f19,util[_0x4edc('0x99')](_0x27db61,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x51223f,_0x352f5a){return function(_0x5c56f7){loggerPredictive[_0x4edc('0x9a')](_0x352f5a['name'],_0x51223f);loggerPredictive['error'](_0x5c56f7['stack']);freeVariablesPredictive(_0x352f5a);};}function loggerCatch(_0x31816b){return function(_0x1ba56c){logger[_0x4edc('0x9a')](_0x31816b,util[_0x4edc('0x99')](_0x1ba56c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x298451){return _0x298451&&!_[_0x4edc('0x3f')](_0x298451)&&_0x298451[_0x4edc('0x9b')]>0x0;}function decremetOriginate(_0x675ff0){if(!_['isUndefined'](_0x675ff0)&&_0x675ff0!==null){if(typeof _0x675ff0[_0x4edc('0x9c')]!==_0x4edc('0x9d')){if(_0x675ff0[_0x4edc('0x9c')]>0x0){_0x675ff0[_0x4edc('0x9c')]-=0x1;}else{logger['error']('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4edc('0x9a')](_0x4edc('0x9e'));}}function checkContactLowerLimitOriginate(_0xd568d,_0x117e14,_0xdf94a1){if(_0x117e14>_0xdf94a1){for(var _0x366b86=0x0;_0x366b86<_0x117e14-_0xdf94a1;_0x366b86+=0x1){decremetOriginate(_0xd568d);}}}function loggerGetContactDialer(_0x5d3829,_0xd57ea4,_0x5da033){return function(_0x783971){checkContactLowerLimitOriginate(_0xd57ea4,_0x5da033,0x0);logger[_0x4edc('0x9a')](_0x5d3829,util[_0x4edc('0x99')](_0x783971,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2bd1f7){return function(_0x3311f6){if(isNotNull(_0x3311f6)&&isNotNull(_0x3311f6[0x0])){if(_0x3311f6[0x0]['contactsRescheduled']>0x0){_0x2bd1f7[_0x4edc('0x42')]='RESCHEDULED_CONTACTS';logger[_0x4edc('0x7e')]('[getContactDialer2][ReScheduled]'+_0x2bd1f7['name'],_0x3311f6[0x0][_0x4edc('0x9f')],'contacts');}else{_0x2bd1f7[_0x4edc('0x42')]=_0x4edc('0xa0');logger[_0x4edc('0x7e')]('[getContactDialer2][Empty]'+_0x2bd1f7[_0x4edc('0x41')]);}}};}function notSendMessagesQueue(_0x40fc17){if(_0x40fc17[_0x4edc('0xa1')]){freeVariablesPredictive(_0x40fc17);if(_0x40fc17[_0x4edc('0x9c')]===0x0&&_0x40fc17[_0x4edc('0x54')]===0x0&&_0x40fc17[_0x4edc('0x58')]===0x0&&(_0x40fc17[_0x4edc('0xa2')]||0x0)===0x0){_0x40fc17[_0x4edc('0xa1')]=![];_0x40fc17[_0x4edc('0x51')]=0x0;_0x40fc17[_0x4edc('0x42')]=_0x4edc('0x43');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa4'),_0x40fc17[_0x4edc('0x41')],_0x4edc('0xa5'));}else{_0x40fc17[_0x4edc('0x42')]=_0x4edc('0xa6');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa4'),_0x40fc17[_0x4edc('0x41')],'is\x20disactive');}emitVoiceQueueSummary(_0x40fc17);}}function notSendMessagesCampaign(_0x49fdc8){if(_0x49fdc8['sendMessageOneNotActive']){if(_0x49fdc8[_0x4edc('0x9c')]===0x0){_0x49fdc8['sendMessageOneNotActive']=![];_0x49fdc8[_0x4edc('0x42')]=_0x4edc('0x43');loggerSyncQueueSummary['debug'](_0x4edc('0xa7'),_0x49fdc8['name'],'is\x20not\x20active');}else{_0x49fdc8['message']=_0x4edc('0xa6');loggerSyncQueueSummary[_0x4edc('0xa3')](_0x4edc('0xa7'),_0x49fdc8[_0x4edc('0x41')],'is\x20disactive');}emitCampaignSummary(_0x49fdc8);}}function createObjHistory(_0x527c3d,_0x155163,_0x3adbbe,_0x1f5b12,_0x167458){_0x527c3d[_0x4edc('0x42')]=_0x3adbbe;var _0x183bb1=new Action(_0x527c3d,_0x155163);var _0x3e8f2c=new History(_0x183bb1);_0x3e8f2c[_0x4edc('0xa8')]=_0x1f5b12;_0x3e8f2c[_0x4edc('0xa9')]=_0x167458;_0x3e8f2c[_0x4edc('0xaa')]=_0x183bb1[_0x4edc('0xab')];return _0x3e8f2c;}Dialer[_0x4edc('0x1d')][_0x4edc('0x3c')]=function(){var _0xdc032a=this;setInterval(function(){_0xdc032a[_0x4edc('0xac')](_0xdc032a['uniqueId'],_0x4edc('0xad'));_0xdc032a[_0x4edc('0xac')](_0xdc032a[_0x4edc('0x27')],_0x4edc('0xae'));},0x32c8);};Dialer[_0x4edc('0x1d')]['clearZombieChannels']=function(_0x2feb43,_0x1ad5bf){var _0x552165=this;for(var _0x1cb729 in _0x2feb43){if(typeof _0x2feb43[_0x1cb729]!==_0x4edc('0x9d')){this[_0x4edc('0x20')][_0x4edc('0xaf')](function(){if(!_['isNil'](_0x2feb43[_0x1cb729])){return ami[_0x4edc('0xb0')]({'action':'status','channel':_0x2feb43[_0x1cb729][_0x4edc('0xb1')]})['catch'](function(_0x5ba021){if(_0x5ba021[_0x4edc('0x42')]===_0x4edc('0xb2')){setTimeout(function(){if(_0x2feb43[_0x1cb729]&&_0x2feb43[_0x1cb729][_0x4edc('0x4d')]!==_0x4edc('0x7b')){_0x552165[_0x4edc('0xb3')](_0x552165[_0x4edc('0x22')][_0x2feb43[_0x1cb729][_0x4edc('0xb4')]]);logger[_0x4edc('0x9a')](_0x4edc('0xb5'),_0x1ad5bf,_0x1cb729,_0x2feb43[_0x1cb729][_0x4edc('0xb4')]);delete _0x2feb43[_0x1cb729];}if(_0x2feb43[_0x1cb729]&&_0x2feb43[_0x1cb729][_0x4edc('0x4d')]==='ivr'){_0x552165['updateOriginated'](_0x552165[_0x4edc('0x23')][_0x2feb43[_0x1cb729][_0x4edc('0xb4')]]);logger['error'](_0x4edc('0xb6'),_0x1ad5bf,_0x1cb729,_0x2feb43[_0x1cb729][_0x4edc('0xb4')]);delete _0x2feb43[_0x1cb729];}},0x2328);}});}});}}};Dialer['prototype'][_0x4edc('0xb7')]=function(_0x252805){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xb7')](_0x252805))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xba')));};Dialer['prototype'][_0x4edc('0xbb')]=function(_0x409300){return Promise['resolve']()[_0x4edc('0x3e')](cmHopperBlack[_0x4edc('0xbb')](_0x409300))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xbc')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xbd')]=function(_0x4e882c,_0x482268,_0x49f015){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperAdditionalPhone[_0x4edc('0xbd')](_0x4e882c,_0x482268,_0x49f015))['catch'](loggerCatch(_0x4edc('0xbe')));};Dialer['prototype'][_0x4edc('0xbf')]=function(_0x2c2f6a,_0xeeb411,_0x489c15){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperAdditionalPhone[_0x4edc('0xbf')](_0x2c2f6a,_0xeeb411,_0x489c15))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc0')));};Dialer['prototype'][_0x4edc('0xc1')]=function(_0x1c6994){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperBlack['checkIsBlackListIvr'](_0x1c6994))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc2')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xc3')]=function(_0x3bfa51){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperHistory[_0x4edc('0xc4')](_0x3bfa51))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc5')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xc6')]=function(_0x4328b9){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xc6')](_0x4328b9))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xc7')));};Dialer['prototype'][_0x4edc('0xc8')]=function(_0x2c645e,_0x38b803,_0x50cb08){return Promise['resolve']()['then'](cmHopper[_0x4edc('0xc8')](_0x2c645e,_0x38b803,_0x50cb08))['catch'](loggerCatch(_0x4edc('0xc9')));};Dialer[_0x4edc('0x1d')][_0x4edc('0xca')]=function(_0x27dc74,_0x592c7d,_0x3684c9,_0x282348,_0x356373){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xca')](_0x27dc74,_0x592c7d,_0x3684c9,_0x282348))[_0x4edc('0xb9')](function(_0x5079c8){_0x356373['temp']-=_0x3684c9;_0x356373[_0x4edc('0xcb')]=_0x356373[_0x4edc('0xcb')]>0x0?_0x356373[_0x4edc('0xcb')]:0x0;loggerCatch(_0x4edc('0xcc'))(_0x5079c8);});};Dialer[_0x4edc('0x1d')][_0x4edc('0xcd')]=function(_0x2b7171,_0x549d61,_0x2f6f4a,_0x3f6ee0){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopper['getContactDialerIvr'](_0x2b7171,_0x549d61,_0x2f6f4a))[_0x4edc('0xb9')](function(_0x4e1cdc){_0x3f6ee0[_0x4edc('0xcb')]-=_0x549d61;_0x3f6ee0[_0x4edc('0xcb')]=_0x3f6ee0['temp']>0x0?_0x3f6ee0[_0x4edc('0xcb')]:0x0;loggerCatch(_0x4edc('0xce'))(_0x4e1cdc);});};Dialer[_0x4edc('0x1d')][_0x4edc('0xcf')]=function(_0x20bb84){return Promise[_0x4edc('0xb8')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x20bb84))['catch'](loggerCatch(_0x4edc('0xd0')));};Dialer['prototype'][_0x4edc('0xd1')]=function(_0x32020c){return Promise['resolve']()[_0x4edc('0x3e')](cmHopper[_0x4edc('0xd1')](_0x32020c))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xd2')));};Dialer[_0x4edc('0x1d')]['createHistory']=function(_0x46e042){return Promise[_0x4edc('0xb8')]()[_0x4edc('0x3e')](cmHopperHistory['createHistory'](_0x46e042))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xd3')));};Dialer['prototype'][_0x4edc('0xb3')]=function(_0x4165fa){if(!_[_0x4edc('0x3f')](_0x4165fa)&&_0x4165fa!==null){if(typeof _0x4165fa[_0x4edc('0x9c')]!==_0x4edc('0x9d')){if(_0x4165fa[_0x4edc('0x9c')]>0x0){_0x4165fa[_0x4edc('0x9c')]-=0x1;}else{logger[_0x4edc('0x9a')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x4edc('0x9a')](_0x4edc('0xd4'));}};Dialer[_0x4edc('0x1d')][_0x4edc('0xd5')]=function(_0x5ab67e,_0x1e0ac5){var _0x400c73=this;return function(_0x59ab97){_0x400c73[_0x4edc('0xb3')](_0x1e0ac5);logger[_0x4edc('0x9a')](_0x5ab67e,util['inspect'](_0x59ab97,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x4edc('0xd6')]=function(_0xb8c98,_0x29c814,_0x5f1bc3){var _0x513024={'state':0x19,'statedesc':'notFound'};this[_0x4edc('0xb3')](_0x29c814);this[_0x4edc('0xd7')](_[_0x4edc('0x8f')](_0x513024,_['pick'](_0x5f1bc3,[_0x4edc('0xd8'),_0x4edc('0xd9'),'UserId',_0x4edc('0xda'),_0x4edc('0xdb')])),_0x4edc('0xdc'),_0x4edc('0xdd'));logger[_0x4edc('0x9a')](_0xb8c98);};Dialer[_0x4edc('0x1d')]['isSuccess']=function(_0x1f9e2c){return _0x1f9e2c===_0x4edc('0xde');};Dialer[_0x4edc('0x1d')][_0x4edc('0xdf')]=function(_0x38af77){return!_[_0x4edc('0x3f')](_0x38af77)&&_0x38af77&&!_[_0x4edc('0x3f')](_0x38af77[_0x4edc('0x41')])&&!_[_0x4edc('0x3f')](_0x38af77[_0x4edc('0x77')])&&_0x38af77[_0x4edc('0x77')]&&(this[_0x4edc('0x25')][util[_0x4edc('0x78')]('SIP/%s',_0x38af77[_0x4edc('0x41')])][_0x4edc('0xe0')]===_0x4edc('0xe1')||this['trunks'][util[_0x4edc('0x78')](_0x4edc('0xe2'),_0x38af77[_0x4edc('0x41')])][_0x4edc('0xe0')]===_0x4edc('0xe3'));};Dialer[_0x4edc('0x1d')][_0x4edc('0xd7')]=function(_0x483b4f,_0x52ed,_0x388aa2){this[_0x4edc('0xe4')](_0x483b4f)['catch'](loggerCatch(_0x52ed));this[_0x4edc('0xd1')](_0x483b4f)['catch'](loggerCatch(_0x388aa2));};Dialer[_0x4edc('0x1d')][_0x4edc('0x37')]=function(_0x2d7fe9){var _0x2b004b=this;var _0x2f7e00=this[_0x4edc('0xe5')][_0x2d7fe9['uniqueid']];var _0x39534b;if(!_[_0x4edc('0xe6')](_0x2d7fe9)&&!_['isNil'](_0x2d7fe9[_0x4edc('0xe7')])&&!_[_0x4edc('0xe6')](_0x2d7fe9[_0x4edc('0xe7')][_0x4edc('0xe8')])&&_0x2d7fe9[_0x4edc('0xe9')]==='xcally-motion-dialer'&&_0x2f7e00){if(_0x2f7e00[_0x4edc('0x4d')]!==_0x4edc('0x7b')&&this['voiceQueues'][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xec')){delete this[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xef')]+=0x1;_0x39534b=new Hangup(_0x2f7e00,_0x2d7fe9);_0x39534b[_0x4edc('0xa8')]=0x12;_0x39534b['statedesc']=_0x4edc('0xf0');_0x39534b[_0x4edc('0xf1')]=_0x4edc('0xf2');ami[_0x4edc('0x4c')]('custom:amd',ut[_0x4edc('0xf3')](_0x39534b,_0x4edc('0xf4')));this['saveInDb'](_0x39534b,'[syncHangupInAMD][createHistory]',_0x4edc('0xf5'));}if(_0x2f7e00[_0x4edc('0x4d')]!=='ivr'&&this[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xf6')){return new Promise(function(_0x454600,_0x13fcf8){delete _0x2b004b[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];_0x2b004b[_0x4edc('0xb3')](_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]);_0x2b004b[_0x4edc('0x22')][_0x2f7e00['queue']][_0x4edc('0xee')]+=0x1;_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2ecfaa=_0x2b004b[_0x4edc('0x22')][_0x2f7e00[_0x4edc('0xb4')]];var _0x152d7c=new Hangup(_0x2f7e00,_0x2d7fe9);_0x152d7c[_0x4edc('0xa8')]=0x13;_0x152d7c[_0x4edc('0xa9')]=_0x4edc('0xf7');_0x152d7c[_0x4edc('0xf1')]='AMD';_0x152d7c[_0x4edc('0xf8')]+=0x1;_0x152d7c[_0x4edc('0xf9')]+=0x1;_0x152d7c[_0x4edc('0xf4')]=!![];ami['emit'](_0x4edc('0xfa'),ut['buildObj'](_0x152d7c,_0x4edc('0xf4')));_0x2b004b[_0x4edc('0xe4')](_0x152d7c)[_0x4edc('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x152d7c[_0x4edc('0xfb')]+_0x152d7c[_0x4edc('0xfc')]+_0x152d7c['countnoanswerretry']+_0x152d7c[_0x4edc('0xfd')]+_0x152d7c['countdropretry']+_0x152d7c[_0x4edc('0xfe')]+_0x152d7c[_0x4edc('0xf8')]+_0x152d7c[_0x4edc('0xff')]>=_0x2ecfaa[_0x4edc('0x100')]){_0x2b004b[_0x4edc('0x101')](_0x152d7c,_0x454600,_0x13fcf8,_0x4edc('0x102'));}else{if(_0x152d7c['countmachineretry']>=_0x2ecfaa[_0x4edc('0x103')]){_0x2b004b[_0x4edc('0x104')](_0x152d7c,_0x454600,_0x13fcf8,_0x4edc('0x105'));}else{_0x2b004b['rescheduleContact']({'active':![],'countmachineretry':_0x152d7c[_0x4edc('0xf8')],'scheduledat':moment()[_0x4edc('0x106')](_0x2ecfaa[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x152d7c[_0x4edc('0xd8')],'ListId':_0x152d7c[_0x4edc('0xd9')],'VoiceQueueId':_0x152d7c[_0x4edc('0xda')]||undefined,'CampaignId':_0x152d7c['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));_0x454600({'reschedule':0x1});}}});}if(_0x2f7e00[_0x4edc('0x4d')]===_0x4edc('0x7b')&&this[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xea')]&&_0x2d7fe9['value']===_0x4edc('0xec')){delete this[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]]);_0x39534b=new Hangup(_0x2f7e00,_0x2d7fe9);_0x39534b[_0x4edc('0xa8')]=0x12;_0x39534b[_0x4edc('0xa9')]=_0x4edc('0xf0');_0x39534b[_0x4edc('0xf1')]=_0x4edc('0xf2');ami['emit'](_0x4edc('0xfa'),ut[_0x4edc('0xf3')](_0x39534b,_0x4edc('0xf4')));this['saveInDb'](_0x39534b,_0x4edc('0x10b'),_0x4edc('0x10c'));}if(_0x2f7e00[_0x4edc('0x4d')]===_0x4edc('0x7b')&&this[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xea')]&&_0x2d7fe9[_0x4edc('0xeb')]===_0x4edc('0xf6')){return new Promise(function(_0x4aa44a,_0x815c50){delete _0x2b004b[_0x4edc('0xe5')][_0x2d7fe9[_0x4edc('0xed')]];_0x2b004b[_0x4edc('0xb3')](_0x2b004b[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]]);_0x2b004b[_0x4edc('0x23')][_0x2f7e00[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;_0x2b004b[_0x4edc('0x23')][_0x2f7e00['queue']][_0x4edc('0xef')]+=0x1;var _0x2b7aa9=_0x2b004b[_0x4edc('0x23')][_0x2f7e00['queue']];var _0x46e9f3=new Hangup(_0x2f7e00,_0x2d7fe9);_0x46e9f3[_0x4edc('0xa8')]=0x13;_0x46e9f3['statedesc']=_0x4edc('0xf7');_0x46e9f3[_0x4edc('0xf1')]=_0x4edc('0xf2');_0x46e9f3[_0x4edc('0xf8')]+=0x1;_0x46e9f3[_0x4edc('0xf9')]+=0x1;_0x46e9f3[_0x4edc('0xf4')]=!![];ami[_0x4edc('0x4c')](_0x4edc('0xfa'),ut[_0x4edc('0xf3')](_0x46e9f3,_0x4edc('0xf4')));_0x2b004b[_0x4edc('0xe4')](_0x46e9f3)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10d')));if(_0x46e9f3[_0x4edc('0xfb')]+_0x46e9f3[_0x4edc('0xfc')]+_0x46e9f3[_0x4edc('0x10e')]+_0x46e9f3[_0x4edc('0xfd')]+_0x46e9f3[_0x4edc('0x10f')]+_0x46e9f3[_0x4edc('0xfe')]+_0x46e9f3[_0x4edc('0xf8')]+_0x46e9f3['countagentrejectretry']>=_0x2b7aa9[_0x4edc('0x100')]){_0x2b004b['stateGlobal'](_0x46e9f3,_0x4aa44a,_0x815c50,_0x4edc('0x102'));}else{if(_0x46e9f3[_0x4edc('0xf8')]>=_0x2b7aa9[_0x4edc('0x103')]){_0x2b004b['createStateFinal'](_0x46e9f3,_0x4aa44a,_0x815c50,_0x4edc('0x105'));}else{_0x2b004b[_0x4edc('0xc6')]({'active':![],'countmachineretry':_0x46e9f3[_0x4edc('0xf8')],'scheduledat':moment()[_0x4edc('0x106')](_0x2b7aa9[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x46e9f3[_0x4edc('0xd8')],'ListId':_0x46e9f3[_0x4edc('0xd9')],'VoiceQueueId':_0x46e9f3['VoiceQueueId']||undefined,'CampaignId':_0x46e9f3['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));_0x4aa44a({'reschedule':0x1});}}});}}};Dialer[_0x4edc('0x1d')][_0x4edc('0x110')]=function(_0x59f044){var _0x1e19f3=this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];var _0x11ef6f;if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]===_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this['updateOriginated'](this[_0x4edc('0x23')][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x23')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x111')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x112')));}if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]!=='ivr'&&isNotNull(this['voiceQueues'][_0x1e19f3['queue']][_0x4edc('0x113')])){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this['voiceQueues'][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x1e19f3['queue']][_0x4edc('0xee')]+=0x1;this[_0x4edc('0x22')][_0x1e19f3['queue']][_0x4edc('0xef')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);_0x11ef6f['state']=0x10;_0x11ef6f[_0x4edc('0xa9')]=_0x4edc('0x114');_0x11ef6f[_0x4edc('0xf1')]=_0x4edc('0x115');this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x116')));this[_0x4edc('0xd1')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x112')));}if(_0x1e19f3&&_0x1e19f3[_0x4edc('0x4d')]!==_0x4edc('0x7b')&&!isNotNull(this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x113')])){delete this[_0x4edc('0xe5')][_0x59f044[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]]);this[_0x4edc('0x22')][_0x1e19f3[_0x4edc('0xb4')]][_0x4edc('0x68')]+=0x1;_0x11ef6f=new Hangup(_0x1e19f3,_0x59f044);_0x11ef6f['state']=0xc;_0x11ef6f[_0x4edc('0xa9')]=_0x59f044[_0x4edc('0x117')];_0x11ef6f['membername']=_0x4edc('0x118');this[_0x4edc('0xe4')](_0x11ef6f)[_0x4edc('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x4edc('0xd1')](_0x11ef6f)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x119')]=function(_0x19a875){var _0x43f695=this[_0x4edc('0xe5')][_0x19a875[_0x4edc('0xed')]];if(this[_0x4edc('0x22')][_0x19a875[_0x4edc('0xb4')]]){if(_0x43f695&&_0x43f695[_0x4edc('0x4d')]!==_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x19a875[_0x4edc('0xed')]];this[_0x4edc('0x22')][_0x19a875[_0x4edc('0xb4')]][_0x4edc('0xee')]+=0x1;var _0x17638f=new AgentComplete(_0x43f695,_0x19a875);if(_0x19a875[_0x4edc('0x11a')]===_0x4edc('0x11b')){_0x17638f[_0x4edc('0x11c')]=this['voiceQueues'][_0x19a875[_0x4edc('0xb4')]][_0x4edc('0x11d')]&&this[_0x4edc('0x22')][_0x19a875['queue']]['dialAgiAfterHangupAgent']?moment()[_0x4edc('0x78')](_0x4edc('0x109')):undefined;}this['createHistory'](_0x17638f)['catch'](loggerCatch(_0x4edc('0x11e')));this[_0x4edc('0xd1')](_0x17638f)['catch'](loggerCatch(_0x4edc('0x11f')));}}};Dialer[_0x4edc('0x1d')][_0x4edc('0x2b')]=function(_0x305abb){if(this[_0x4edc('0x22')][_0x305abb['queue']]){if(this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]]&&this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]][_0x4edc('0x4d')]!==_0x4edc('0x7b')){this['updateOriginated'](this[_0x4edc('0x22')][_0x305abb[_0x4edc('0xb4')]]);this[_0x4edc('0xe5')][_0x305abb[_0x4edc('0xed')]][_0x4edc('0x120')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x493173,_0x29fb3c){this[_0x4edc('0xe4')](_0x493173)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x11e')));if(_0x29fb3c==0x0){this[_0x4edc('0xd1')](_0x493173)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x121')));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x2d')]=function(_0x26fa74){var _0x3fd55d=this[_0x4edc('0xe5')][_0x26fa74[_0x4edc('0xed')]];var _0x434042=this;var _0x57a435=![];var _0x249ca1;var _0x29d269;if(this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]){if(_0x3fd55d&&_0x3fd55d[_0x4edc('0x4d')]!==_0x4edc('0x7b')){delete this[_0x4edc('0xe5')][_0x26fa74[_0x4edc('0xed')]];this[_0x4edc('0xb3')](this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]);_0x3fd55d['droptime']=moment()[_0x4edc('0x78')](_0x4edc('0x109'));var _0x5185b7=new QueueCallerAbandon(_0x3fd55d,_0x26fa74);if(getSeconds(_0x3fd55d[_0x4edc('0x122')],_0x3fd55d[_0x4edc('0x123')])>=_0x3fd55d[_0x4edc('0x124')]){this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x83')]+=0x1;this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x125')]+=0x1;this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x6c')]+=0x1;_0x5185b7[_0x4edc('0xa8')]=0xa;_0x5185b7[_0x4edc('0xa9')]='Drop';_0x5185b7['dropreason']=_0x4edc('0x126');_0x5185b7['agiafterat']=this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x11d')]?moment()['format'](_0x4edc('0x109')):undefined;_0x5185b7[_0x4edc('0x10f')]+=0x1;_0x5185b7[_0x4edc('0xf9')]+=0x1;_0x249ca1=this[_0x4edc('0x22')][_0x26fa74['queue']][_0x4edc('0x127')];_0x29d269=this['voiceQueues'][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x128')];_0x434042[_0x4edc('0xbd')](_0x5185b7,_0x5185b7[_0x4edc('0xa8')],_0x3fd55d[_0x4edc('0x129')])[_0x4edc('0x3e')](function(_0x4247d5){_0x57a435=_0x4247d5[_0x4edc('0x12a')]==0x1;if(_0x5185b7[_0x4edc('0x10f')]>=_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x12b')]){_0x434042[_0x4edc('0x12c')](_0x5185b7,_0x4247d5[_0x4edc('0x12a')]);}else{_0x434042[_0x4edc('0xc6')]({'active':![],'countdropretry':_0x5185b7[_0x4edc('0x10f')],'scheduledat':moment()[_0x4edc('0x106')](_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x127')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x3fd55d[_0x4edc('0xd8')],'ListId':_0x3fd55d[_0x4edc('0xd9')],'VoiceQueueId':_0x3fd55d[_0x4edc('0xda')]||undefined,'CampaignId':_0x3fd55d[_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x12d')));var _0x252a70=new History(_0x5185b7);_0x252a70[_0x4edc('0xa8')]=0xa;_0x252a70[_0x4edc('0xa9')]=_0x4edc('0x12e');_0x252a70[_0x4edc('0xab')]=moment()['format'](_0x4edc('0x109'));_0x252a70['endtime']=_0x252a70[_0x4edc('0xab')];_0x252a70[_0x4edc('0x12f')]=_0x5185b7[_0x4edc('0x12f')];_0x252a70['calleridnum']=_0x5185b7[_0x4edc('0x130')];_0x434042[_0x4edc('0xe4')](_0x252a70)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x131')));}})[_0x4edc('0x3e')](function(){if(_0x57a435)_0x434042['swapAdditionalPhones'](_0x5185b7,_0x249ca1,_0x29d269)[_0x4edc('0x3e')](function(){return 0x1;});});}else{this[_0x4edc('0x22')][_0x26fa74['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x26fa74['queue']][_0x4edc('0x132')]+=0x1;_0x5185b7[_0x4edc('0xa8')]=0xb;_0x5185b7[_0x4edc('0xa9')]='Abandoned';_0x5185b7[_0x4edc('0x133')]=_0x4edc('0x134');_0x5185b7[_0x4edc('0xfe')]+=0x1;_0x5185b7[_0x4edc('0xf9')]+=0x1;_0x249ca1=this[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x135')];_0x29d269=this['voiceQueues'][_0x26fa74[_0x4edc('0xb4')]]['callAdditionalPhoneAfterMin'];_0x434042[_0x4edc('0xbd')](_0x5185b7,_0x5185b7[_0x4edc('0xa8')],_0x3fd55d[_0x4edc('0x129')])[_0x4edc('0x3e')](function(_0x3d79ce){if(_0x5185b7[_0x4edc('0xfe')]>=_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]][_0x4edc('0x136')]){_0x434042[_0x4edc('0x12c')](_0x5185b7,_0x3d79ce['additional']);}else{_0x434042[_0x4edc('0xc6')]({'active':![],'countabandonedretry':_0x5185b7[_0x4edc('0xfe')],'scheduledat':moment()[_0x4edc('0x106')](_0x434042[_0x4edc('0x22')][_0x26fa74[_0x4edc('0xb4')]]['dialAbandonedRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x3fd55d[_0x4edc('0xd8')],'ListId':_0x3fd55d[_0x4edc('0xd9')],'VoiceQueueId':_0x3fd55d['VoiceQueueId']||undefined,'CampaignId':_0x3fd55d[_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x137')));var _0x9082b=new History(_0x5185b7);_0x9082b[_0x4edc('0xa8')]=0xb;_0x9082b[_0x4edc('0xa9')]=_0x4edc('0x138');_0x9082b[_0x4edc('0xab')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x9082b[_0x4edc('0xaa')]=_0x9082b['starttime'];_0x9082b['calleridname']=_0x5185b7['calleridname'];_0x9082b[_0x4edc('0x130')]=_0x5185b7[_0x4edc('0x130')];_0x434042[_0x4edc('0xe4')](_0x9082b)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x139')));}})[_0x4edc('0x3e')](function(){if(_0x57a435)_0x434042['swapAdditionalPhones'](_0x5185b7,_0x249ca1,_0x29d269)[_0x4edc('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x4edc('0x35')]=function(_0x23dd62){if(this[_0x4edc('0x27')][_0x23dd62[_0x4edc('0xed')]]){this[_0x4edc('0x27')][_0x23dd62['uniqueid']][_0x4edc('0xb1')]=_0x23dd62[_0x4edc('0xb1')];}if(this[_0x4edc('0xe5')][_0x23dd62[_0x4edc('0xed')]]){this[_0x4edc('0xe5')][_0x23dd62[_0x4edc('0xed')]][_0x4edc('0xb1')]=_0x23dd62['channel'];}};Dialer[_0x4edc('0x1d')][_0x4edc('0x13a')]=function(_0xc2481){if(strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x4f')]]===_0x4edc('0x1c')){if(this['actions'][_0xc2481['actionid']]&&_[_0x4edc('0xe6')](this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0x13c')])&&_0xc2481[_0x4edc('0xe0')]==='1'&&_0xc2481[_0x4edc('0x13d')]==='0'){if(this[_0x4edc('0x24')][_0xc2481['stateinterface']]){if(!this['agents'][_0xc2481['stateinterface']][_0x4edc('0x13c')]){this[_0x4edc('0x24')][_0xc2481[_0x4edc('0x13e')]][_0x4edc('0x13c')]=!![];this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]['locked']=!![];this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0x13e')]=_0xc2481[_0x4edc('0x13e')];}}}}else if((strategy[this['voiceQueues'][this['actions'][_0xc2481[_0x4edc('0x13b')]]['queue']]['strategy']]||_0x4edc('0x13f'))==='rrmemory'){if(this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]){if(this[_0x4edc('0x24')][_0xc2481[_0x4edc('0x13e')]]){this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0x13e')]=_0xc2481[_0x4edc('0x13e')];if(_[_0x4edc('0xe6')](this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481['actionid']][_0x4edc('0xb4')]])){this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]][_0x4edc('0xb4')]]=[];}this[_0x4edc('0x140')][this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]]['queue']][_0x4edc('0x141')](_[_0x4edc('0x8f')](_['pick'](this[_0x4edc('0x27')][_0xc2481[_0x4edc('0x13b')]],[_0x4edc('0x142'),'stateinterface']),{'status':_0xc2481[_0x4edc('0xe0')],'paused':_0xc2481[_0x4edc('0x13d')]}));}}}};function unlockQueueStatus(_0xd9b7b6,_0x4afcee){setTimeout(function(){if(_[_0x4edc('0x3f')](_0xd9b7b6[_0x4edc('0x143')])){loggerBooked[_0x4edc('0x9a')](_0x4edc('0x144'),_0x4afcee);}_0xd9b7b6[_0x4edc('0x143')]=!![];loggerBooked[_0x4edc('0x7e')](_0x4edc('0x145'),_0x4afcee,JSON[_0x4edc('0x4a')](_[_0x4edc('0x146')](_0xd9b7b6,[_0x4edc('0x41'),_0x4edc('0x143')])));},0x1f3);}Dialer[_0x4edc('0x1d')][_0x4edc('0x3a')]=function(_0x1895b7){var _0x5eb14a=this;var _0x326948=_0x5eb14a['voiceQueues'][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]];if(strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x4f')]]===_0x4edc('0x1c')){if(this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]&&this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x13e')]){this[_0x4edc('0x21')][_0x4edc('0x147')](this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x142')],this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0x13e')])[_0x4edc('0xb9')](function(_0x276da5){logger[_0x4edc('0x9a')](_0x4edc('0x148'),util[_0x4edc('0x99')](_0x276da5,{'showHidden':![],'depth':null}));})[_0x4edc('0x1f')](function(){_0x5eb14a[_0x4edc('0xb3')](_0x5eb14a[_0x4edc('0x22')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]);_0x5eb14a[_0x4edc('0x24')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0x13e')]][_0x4edc('0x13c')]=![];delete _0x5eb14a[_0x4edc('0x27')][_0x1895b7['actionid']];unlockQueueStatus(_0x326948);});}else{this['updateOriginated'](this[_0x4edc('0x22')][this['actions'][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]);this[_0x4edc('0xc6')]({'active':![],'ContactId':this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['ContactId'],'ListId':this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['ListId'],'VoiceQueueId':this[_0x4edc('0x27')][_0x1895b7['actionid']]['VoiceQueueId']||undefined,'CampaignId':this[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x1895b7['actionid']];unlockQueueStatus(_0x326948);}}else if((strategy[this[_0x4edc('0x22')][this[_0x4edc('0x27')][_0x1895b7['actionid']]['queue']][_0x4edc('0x4f')]]||'rrmemory')===_0x4edc('0x13f')){var _0x225697;if(this['actions'][_0x1895b7['actionid']]&&!_[_0x4edc('0x47')](this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7['actionid']][_0x4edc('0xb4')]])){if(this[_0x4edc('0x2a')][_0x5eb14a[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]]['queue']]){this[_0x4edc('0x2a')][_0x5eb14a['actions'][_0x1895b7['actionid']][_0x4edc('0xb4')]]=this['queueBookedRR'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]?this[_0x4edc('0x2a')][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]:this[_0x4edc('0x140')][this['actions'][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]]?this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x149')]||0x0:0x0;}this['queueBooked'][this[_0x4edc('0x27')][_0x1895b7[_0x4edc('0x13b')]][_0x4edc('0xb4')]][_0x4edc('0x149')]=this['queueBookedRR'][this['actions'][_0x1895b7['actionid']][_0x4edc('0xb4')]];for(var _0x3cde5e=0x0;_0x3cde5e=0x0;})[_0x4edc('0xb9')](myreject(_0x501cfe)));}}else{_0x523e46['push'](ami['Action']({'action':'command','command':util[_0x4edc('0x78')](_0x4edc('0x164'),_0x15152d,!_['isUndefined'](config['timezones'][_0x300c24])?_0x300c24:'')})['then'](function(_0x1d5efe){return _0x1d5efe[_0x4edc('0x161')][_0x4edc('0x162')]('true')>=0x0;})[_0x4edc('0xb9')](myreject(_0x501cfe)));}Promise['all'](_0x523e46)[_0x4edc('0x3e')](function(_0x3d88e6){var _0x2f6c49=_['some'](_0x3d88e6);if(_0x2f6c49){return _0x2b0f00(_0x2f6c49);}else{_0x1af94a[_0x4edc('0x42')]=_0x3e2872?'GLOBAL_INTERVAL_IS_OVERTIME':_0x4edc('0x165');return _0x501cfe(msgResponse('[ifTime][promiseAll]','Failure',_0x4edc('0x166')+_0x3e2872+'\x20'+_0x42c855+_0x4edc('0x167')+util[_0x4edc('0x99')](_0x15152d,{'showHidden':![],'depth':null})+_0x4edc('0x168')+_0x300c24));}})['catch'](function(_0x230e6b){return _0x501cfe(msgResponse(_0x4edc('0x158'),_0x4edc('0x159'),JSON[_0x4edc('0x4a')](_0x230e6b)));});});};Dialer[_0x4edc('0x1d')][_0x4edc('0x169')]=function(_0x1a2c27){var _0x39e805=this;return function(){switch(_0x1a2c27['dialMethod']){case'progressive':freeVariablesPredictive(_0x1a2c27);_0x39e805[_0x4edc('0x16a')](_0x1a2c27,0x1);break;case _0x4edc('0x16b'):freeVariablesPredictive(_0x1a2c27);_0x39e805['handlePower'](_0x1a2c27,_0x1a2c27[_0x4edc('0x16c')]);break;case _0x4edc('0xb'):_0x39e805[_0x4edc('0xb')](_0x1a2c27);break;case _0x4edc('0xa'):freeVariablesPredictive(_0x1a2c27);_0x39e805[_0x4edc('0x16a')](_0x1a2c27,0x1);break;default:freeVariablesPredictive(_0x1a2c27);logger[_0x4edc('0x9a')](_0x4edc('0x16d'),_0x1a2c27[_0x4edc('0x41')],'method\x20not\x20recognized');}};};Dialer[_0x4edc('0x1d')][_0x4edc('0x16e')]=function(_0x1f269f){return Promise['resolve']()['then'](cmHopper[_0x4edc('0x16f')](_0x1f269f['id'],previewRecallmeReminderInterval))[_0x4edc('0x3e')](function(_0xbc3ec1){for(var _0x2cc449=0x0;_0x2cc449<_0xbc3ec1['length'];_0x2cc449++){var _0x5f315a=_0xbc3ec1[_0x2cc449]['Agent']['name'];if(_0x5f315a)io['to'](util[_0x4edc('0x78')](_0x4edc('0x170'),_0x5f315a))[_0x4edc('0x4c')](_0x4edc('0x171'),{'hopper':_0xbc3ec1[_0x2cc449]});}})[_0x4edc('0xb9')](function(){});};Dialer['prototype'][_0x4edc('0x172')]=function(_0x2fa9ef){var _0x8549a8=this;return function(){_0x8549a8[_0x4edc('0x173')](_0x2fa9ef);};};Dialer[_0x4edc('0x1d')][_0x4edc('0xd')]=function(_0x2e420b){var _0x3c75da=this;if(isNotPreview(_0x2e420b[_0x4edc('0x5b')])){if(isVoiceQueueOutbound(_0x2e420b[_0x4edc('0x4d')])&&isActive(_0x2e420b[_0x4edc('0x5a')])){_0x2e420b[_0x4edc('0xa1')]=!![];Promise['resolve']()[_0x4edc('0x3e')](checkIsLoggedIn(_0x2e420b,_0x2e420b[_0x4edc('0x52')]))[_0x4edc('0x3e')](checkIsActive(_0x2e420b,_0x2e420b[_0x4edc('0x5a')]))[_0x4edc('0x3e')](checkInterval(_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x174')](_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x175')](_0x2e420b[_0x4edc('0x176')],_0x2e420b['dialTimezone'],_0x2e420b[_0x4edc('0x41')],_0x2e420b))[_0x4edc('0x3e')](_0x3c75da['checkIfTimeIntervals'](_0x2e420b['Interval'],_0x2e420b[_0x4edc('0x177')],_0x2e420b[_0x4edc('0x41')],_0x2e420b))[_0x4edc('0x3e')](_0x3c75da[_0x4edc('0x169')](_0x2e420b))[_0x4edc('0xb9')](loggerCatchQueueSummary(_0x4edc('0x178'),_0x2e420b));}else{notSendMessagesQueue(_0x2e420b);}}else{freeVariablesPredictive(_0x2e420b);}};Dialer[_0x4edc('0x1d')][_0x4edc('0x32')]=_[_0x4edc('0x179')](function(){var _0x551ea7=_[_0x4edc('0x17a')](this['voiceQueues'],function(_0x12bcfb){return _0x12bcfb['dialPreviewRecallmeReminder'];});var _0x1da513=_[_0x4edc('0x17a')](this[_0x4edc('0x24')],function(_0x566a31){return _0x566a31['online']&&_0x566a31[_0x4edc('0xe0')]===_0x4edc('0xe1');});if(_0x551ea7[_0x4edc('0x9b')]>0x0&&_0x1da513['length']>0x0){return Promise[_0x4edc('0xb8')]()['then'](cmHopper[_0x4edc('0x16f')](_[_0x4edc('0x17b')](_0x551ea7,'id'),previewRecallmeReminderInterval,_[_0x4edc('0x17b')](_0x1da513,'id')))['then'](function(_0x50c7e7){for(var _0x5bf951=0x0;_0x5bf951<_0x50c7e7[_0x4edc('0x9b')];_0x5bf951++){var _0x49413e=_0x50c7e7[_0x5bf951]['Agent']['name'];if(_0x49413e)io['to'](util[_0x4edc('0x78')](_0x4edc('0x170'),_0x49413e))[_0x4edc('0x4c')]('user:dialPreviewRecallReminder',{'hopper':_0x50c7e7[_0x5bf951]});}})['catch'](function(_0x46229f){logger[_0x4edc('0x9a')](_0x4edc('0x16e'),_0x46229f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x4edc('0x1d')][_0x4edc('0x154')]=function(){var _0x22bccb=this;var _0x5bcd47;for(var _0x24dad7 in this[_0x4edc('0x23')]){if(typeof this[_0x4edc('0x23')][_0x24dad7]!==_0x4edc('0x9d')){_0x5bcd47=this[_0x4edc('0x23')][_0x24dad7];if(isCampaignIvr(_0x5bcd47[_0x4edc('0x4d')])&&isActive(_0x5bcd47[_0x4edc('0x77')])){_0x5bcd47[_0x4edc('0xa1')]=!![];Promise[_0x4edc('0xb8')]()['then'](checkIsActive(_0x5bcd47,_0x5bcd47[_0x4edc('0x77')]))['then'](checkInterval(_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb[_0x4edc('0x174')](_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb['checkIfTime'](_0x5bcd47[_0x4edc('0x176')],_0x5bcd47[_0x4edc('0x177')],_0x5bcd47[_0x4edc('0x41')],_0x5bcd47))['then'](_0x22bccb[_0x4edc('0x17c')](_0x5bcd47['Interval'],_0x5bcd47[_0x4edc('0x177')],_0x5bcd47[_0x4edc('0x41')],_0x5bcd47))[_0x4edc('0x3e')](_0x22bccb[_0x4edc('0x172')](_0x5bcd47))[_0x4edc('0xb9')](loggerCatchQueueSummary('[syncCampaigns]',_0x5bcd47));}else{notSendMessagesCampaign(_0x5bcd47);}}}};function getCallerIdRandom(_0x56d52f,_0x51e1d3){var _0x5ee2f1;var _0x26040e;var _0x326c2c;if(_0x51e1d3<=0x0){_0x51e1d3=0x1;}_0x5ee2f1=new RegExp(_0x4edc('0x17d')+_0x51e1d3+'}$');_0x26040e=Math[_0x4edc('0x17e')](0xa,_0x51e1d3-0x1);_0x326c2c=Math[_0x4edc('0x17e')](0xa,_0x51e1d3)-0x1;return util[_0x4edc('0x78')]('%s',_[_0x4edc('0x17f')](_0x56d52f,_0x5ee2f1,_['random'](_0x26040e,_0x326c2c)));}function extractCalleridName(_0xe8c3d9){var _0x53c864=_0xe8c3d9[_0x4edc('0x180')](/"(.*?)"/);return _0x53c864?_0x53c864[0x1]:_0xe8c3d9;}Dialer['prototype']['actionOriginate']=function(_0x2ad5d1,_0x50ee7a){var _0x1a1859=this;var _0x4a4d20=uuid['v4']();this[_0x4edc('0x27')][_0x4a4d20]=new Action(_0x2ad5d1,_0x50ee7a,_0x4a4d20);return new Promise(function(_0x4d2fdf,_0x5f4911){if(_[_0x4edc('0x3f')](_0x2ad5d1)&&typeof _0x2ad5d1!==_0x4edc('0x181')){return _0x5f4911(msgResponse(_0x4edc('0x182'),_0x4edc('0x159'),'voiceQueue\x20is\x20undefine'));}if(_[_0x4edc('0x3f')](_0x50ee7a['phone'])||_0x50ee7a['phone']===null){return _0x5f4911(msgResponse('originate',_0x4edc('0x159'),_0x4edc('0x183')));}var _0x518e22={'XMD-CALLERID':_0x1a1859[_0x4edc('0x27')][_0x4a4d20][_0x4edc('0x184')](),'XMD-AGI':_0x2ad5d1[_0x4edc('0x113')]?util[_0x4edc('0x78')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2ad5d1[_0x4edc('0x113')]):_0x4edc('0x185'),'XMD-AGIAFTER':_0x2ad5d1[_0x4edc('0x11d')]?util[_0x4edc('0x78')](_0x4edc('0x186'),ipAgi,_0x2ad5d1['dialQueueProject2']):_0x4edc('0x185'),'XMD-QUEUE':_0x2ad5d1[_0x4edc('0x4d')]===_0x4edc('0x4e')?util[_0x4edc('0x78')](_0x4edc('0x187'),_0x2ad5d1['name'],_0x2ad5d1[_0x4edc('0x188')]||'',_0x2ad5d1[_0x4edc('0x189')]?'c':'',_0x2ad5d1[_0x4edc('0x124')]||0x3):'NONE','XMD-CONTACTID':_0x50ee7a[_0x4edc('0xd8')],'XMD-CDRTYPE':_0x4edc('0x9'),'CALLERID(all)':_0x1a1859['actions'][_0x4a4d20][_0x4edc('0x184')](),'XMD-AMD':_0x2ad5d1[_0x4edc('0xea')]?_0x4edc('0x18a'):_0x4edc('0x185'),'XMD-DESTINATION':_0x4edc('0x18b')};if(_0x2ad5d1['dialAMDActive']){_0x518e22[_0x4edc('0x18c')]=_0x2ad5d1['dialAMDInitialSilence']||0x9c4;_0x518e22['XMD-AMDGREETING']=_0x2ad5d1[_0x4edc('0x18d')]||0x5dc;_0x518e22['XMD-AMDAFTERGREETINGSILENCE']=_0x2ad5d1[_0x4edc('0x18e')]||0x320;_0x518e22[_0x4edc('0x18f')]=_0x2ad5d1['dialAMDTotalAnalysisTime']||0x1388;_0x518e22[_0x4edc('0x190')]=_0x2ad5d1[_0x4edc('0x191')]||0x64;_0x518e22[_0x4edc('0x192')]=_0x2ad5d1['dialAMDBetweenWordsSilence']||0x32;_0x518e22[_0x4edc('0x193')]=_0x2ad5d1[_0x4edc('0x194')]||0x3;_0x518e22['XMD-AMDSILENCETHRESHOLD']=_0x2ad5d1[_0x4edc('0x195')]||0x100;_0x518e22['XMD-AMDMAXIMUMWORDLENGTH']=_0x2ad5d1[_0x4edc('0x196')]||0x1388;}if(_0x2ad5d1[_0x4edc('0x4d')]===_0x4edc('0x4e')){_0x518e22[_0x4edc('0x197')]=_0x50ee7a[_0x4edc('0xda')];}else{_0x518e22['XMD-CAMPAIGNID']=_0x50ee7a[_0x4edc('0xdb')];}for(var _0x36999f in _0x50ee7a[_0x4edc('0x198')]){if(typeof _0x50ee7a[_0x4edc('0x198')][_0x36999f]!=='undefined'){if(isNotNull(_0x50ee7a['Contact'][_0x36999f])&&_0x36999f!=='id'&&_0x36999f!==_0x4edc('0x199')&&_0x36999f!=='createdAt'&&_0x36999f!==_0x4edc('0x19a')){_0x518e22[util['format'](_0x4edc('0x19b'),_0x4edc('0x19c'),_['toUpper'](_0x36999f))]=_0x50ee7a[_0x4edc('0x198')][_0x36999f];}}}var _0x570274=_0x1a1859[_0x4edc('0xdf')](_0x2ad5d1['Trunk'])?getCallerId(_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x19d')],_0x2ad5d1['dialOriginateCallerIdName'],_0x2ad5d1[_0x4edc('0x19e')]>0x0?getCallerIdRandom(_0x2ad5d1[_0x4edc('0x5d')],_0x2ad5d1[_0x4edc('0x19e')]):_0x2ad5d1[_0x4edc('0x5d')]):getCallerId(_[_0x4edc('0xe6')](_0x2ad5d1[_0x4edc('0x155')])?_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x19d')]:_0x2ad5d1[_0x4edc('0x155')][_0x4edc('0x19d')],_0x2ad5d1[_0x4edc('0x5c')],_0x2ad5d1[_0x4edc('0x19e')]>0x0?getCallerIdRandom(_0x2ad5d1[_0x4edc('0x5d')],_0x2ad5d1[_0x4edc('0x19e')]):_0x2ad5d1[_0x4edc('0x5d')]);if(_0x570274){_0x518e22['XMD-ORIGINATECALLERIDNAME']=_0x1a1859[_0x4edc('0x27')][_0x4a4d20][_0x4edc('0x19f')]=extractCalleridName(_0x570274);_0x518e22[_0x4edc('0x1a0')]=_0x50ee7a[_0x4edc('0x1a1')];}_0x2ad5d1[_0x4edc('0x1a2')]=_0x518e22;return ami['Action']({'actionid':_0x4a4d20,'action':_0x4edc('0x182'),'channel':_0x1a1859['isTrunkReachable'](_0x2ad5d1[_0x4edc('0x76')])?util[_0x4edc('0x78')](_0x4edc('0x1a3'),_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x41')],isNotNull(_0x2ad5d1[_0x4edc('0x5f')])?_0x2ad5d1[_0x4edc('0x5f')][_0x4edc('0x1a4')]()||'':'',_0x2ad5d1[_0x4edc('0x1a5')]>0x0?_0x50ee7a['phone']['substring'](_0x2ad5d1[_0x4edc('0x1a5')]):_0x50ee7a[_0x4edc('0x1a1')]):util[_0x4edc('0x78')](_0x4edc('0x1a3'),_['isNil'](_0x2ad5d1[_0x4edc('0x155')])?_0x2ad5d1[_0x4edc('0x76')][_0x4edc('0x41')]:_0x2ad5d1[_0x4edc('0x155')][_0x4edc('0x41')],isNotNull(_0x2ad5d1[_0x4edc('0x5f')])?_0x2ad5d1[_0x4edc('0x5f')][_0x4edc('0x1a4')]()||'':'',_0x2ad5d1[_0x4edc('0x1a5')]>0x0?_0x50ee7a[_0x4edc('0x1a1')][_0x4edc('0x1a6')](_0x2ad5d1[_0x4edc('0x1a5')]):_0x50ee7a[_0x4edc('0x1a1')]),'callerid':_0x570274,'Exten':_0x4edc('0x18b'),'Context':_0x4edc('0x1a7'),'Priority':'1','variable':_0x518e22,'timeout':(_0x2ad5d1['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4a4d20})[_0x4edc('0x3e')](function(_0x9264da){return _0x4d2fdf(_0x9264da);})['catch'](function(_0x502592){_0x2ad5d1['outboundOriginateFailureCallsDay']+=0x1;var _0x53a8da=new History(_0x1a1859[_0x4edc('0x27')][_0x4a4d20]);logger['error'](util['format']('[originateError]:\x20%s',JSON[_0x4edc('0x4a')](_0x502592)));_0x53a8da[_0x4edc('0xa8')]=0xe;_0x53a8da[_0x4edc('0xa9')]=_0x4edc('0x1a8');_0x53a8da['starttime']=moment()[_0x4edc('0x78')](_0x4edc('0x109'));_0x53a8da['endtime']=_0x53a8da[_0x4edc('0xab')];_0x1a1859[_0x4edc('0xe4')](_0x53a8da)['catch'](loggerCatch(_0x4edc('0x1a9')));_0x1a1859['moveContactManagedDialer'](_0x53a8da)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1a9')))[_0x4edc('0x1f')](function(){delete _0x1a1859['actions'][_0x4a4d20];return _0x5f4911(msgResponse(_0x4edc('0x182'),_0x4edc('0x49'),'originate\x20action\x20Error'));});});});};Dialer[_0x4edc('0x1d')]['syncOriginateResponse']=function(_0x5cbfd8){var _0x3d4660=this[_0x4edc('0x27')][_0x5cbfd8[_0x4edc('0x13b')]];if(_0x3d4660){delete this[_0x4edc('0x27')][_0x5cbfd8[_0x4edc('0x13b')]];_0x3d4660[_0x4edc('0x123')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x418847=_0x3d4660[_0x4edc('0x4d')]===_0x4edc('0x7b')?this[_0x4edc('0x23')][_0x3d4660[_0x4edc('0xb4')]]:this[_0x4edc('0x22')][_0x3d4660[_0x4edc('0x1aa')]()];if(!this[_0x4edc('0x1ab')](_0x5cbfd8[_0x4edc('0x1ac')])){this[_0x4edc('0xb3')](_0x418847);return this[_0x4edc('0x1ad')](_0x3d4660,_0x418847,_0x5cbfd8)[_0x4edc('0xb9')](loggerCatch('[callProgressDetecting]\x20'));}this[_0x4edc('0xe5')][_0x5cbfd8[_0x4edc('0xed')]]=_0x3d4660;}};Dialer['prototype']['checkRetriveMax']=function(_0x5121ff,_0x1d843e,_0xe36ea0){var _0x58a63e=new History(_0x1d843e);if(_0x58a63e[_0x4edc('0xfb')]+_0x58a63e['countcongestionretry']+_0x58a63e[_0x4edc('0x10e')]+_0x58a63e[_0x4edc('0xfd')]+_0x58a63e[_0x4edc('0x10f')]+_0x58a63e[_0x4edc('0xfe')]+_0x58a63e['countmachineretry']+_0x58a63e[_0x4edc('0xff')]>=_0xe36ea0[_0x4edc('0x100')]-0x1){return!![];}switch(_0x5121ff){case 0x3:if(_0x58a63e['countnoanswerretry']>=_0xe36ea0[_0x4edc('0x1ae')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countnoanswerretry':_0x58a63e[_0x4edc('0x10e')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0[_0x4edc('0x1af')],_0x4edc('0x108'))['format'](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e['ListId'],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b0')));break;case 0x5:if(_0x58a63e[_0x4edc('0xfb')]>=_0xe36ea0[_0x4edc('0x1b1')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x58a63e[_0x4edc('0xfb')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialBusyRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b2')));break;case 0x8:if(_0x58a63e['countcongestionretry']>=_0xe36ea0[_0x4edc('0x1b3')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x58a63e['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialCongestionRetryFrequency'],'minutes')['format'](_0x4edc('0x109')),'ContactId':_0x58a63e['ContactId'],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b4')));break;case 0x0:if(_0x58a63e['countnosuchnumberretry']>=_0xe36ea0[_0x4edc('0x1b5')]-0x1){return!![];}else{this[_0x4edc('0xc6')]({'active':![],'countnosuchnumberretry':_0x58a63e[_0x4edc('0xfd')]+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x1b6')],'minutes')['format'](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1b7')));}break;case 0xa:if(_0x58a63e['countdropretry']>=_0xe36ea0[_0x4edc('0x12b')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countdropretry':_0x58a63e[_0x4edc('0x10f')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0['dialDropRetryFrequency'],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e['ListId'],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x12d')));break;case 0xb:if(_0x58a63e[_0x4edc('0xfe')]>=_0xe36ea0[_0x4edc('0x136')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x58a63e[_0x4edc('0xfe')]+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x135')],'minutes')[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x137')));break;case 0x13:if(_0x58a63e[_0x4edc('0xf8')]>=_0xe36ea0[_0x4edc('0x103')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countmachineretry':_0x58a63e[_0x4edc('0xf8')]+=0x1,'scheduledat':moment()[_0x4edc('0x106')](_0xe36ea0[_0x4edc('0x107')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e[_0x4edc('0xda')]||undefined,'CampaignId':_0x58a63e['CampaignId']||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10a')));break;case 0x14:if(_0x58a63e[_0x4edc('0xff')]>=_0xe36ea0[_0x4edc('0x1b8')]-0x1){return!![];}this[_0x4edc('0xc6')]({'active':![],'countagentrejectretry':_0x58a63e['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0xe36ea0[_0x4edc('0x1b9')],_0x4edc('0x108'))[_0x4edc('0x78')](_0x4edc('0x109')),'ContactId':_0x58a63e[_0x4edc('0xd8')],'ListId':_0x58a63e[_0x4edc('0xd9')],'VoiceQueueId':_0x58a63e['VoiceQueueId']||undefined,'CampaignId':_0x58a63e[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1ba')));break;default:return!![];}};Dialer[_0x4edc('0x1d')][_0x4edc('0x1ad')]=function(_0x56c5b4,_0x156541,_0x58672d){var _0x63d2c6=this;var _0x567aa6=new History(_0x56c5b4);var _0xec787d=![];var _0x30d104;var _0x5f3155;return new Promise(function(_0x31b9b4,_0x204c5c){if(_[_0x4edc('0x3f')](_0x156541)&&typeof _0x156541!==_0x4edc('0x181')){return _0x204c5c(msgResponse(_0x4edc('0x1bb'),_0x4edc('0x159'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x58672d)&&typeof _0x58672d!=='object'){return _0x204c5c(msgResponse('[callProgressDetecting]',_0x4edc('0x159'),_0x4edc('0x1bc')));}_0x63d2c6[_0x4edc('0xbd')](_0x567aa6,_0x58672d['reason'],_0x156541)[_0x4edc('0x3e')](function(_0x10c659){if(_0x10c659[_0x4edc('0x12a')]==0x1)_0xec787d=!![];switch(_0x58672d[_0x4edc('0x11a')]){case'0':_0x156541[_0x4edc('0x65')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x0;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1bd');_0x567aa6['countnosuchnumberretry']+=0x1;_0x567aa6['countglobal']+=0x1;ami[_0x4edc('0x4c')](_0x4edc('0x1be'),ut[_0x4edc('0xf3')](_0x56c5b4,_0x4edc('0x1bf')));_0x30d104=_0x156541[_0x4edc('0x1b6')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x10d')));if(_0x63d2c6[_0x4edc('0x1c0')](0x0,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfd')]>=_0x156541['dialNoSuchNumberMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c1'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c1'));}}break;case'3':_0x156541[_0x4edc('0x64')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x3;_0x567aa6['statedesc']=_0x4edc('0x1c2');_0x567aa6[_0x4edc('0x10e')]+=0x1;_0x567aa6['countglobal']+=0x1;var _0x353179=ut['buildNoAnswerEventPayload'](_0x56c5b4,_0x156541);ami['emit'](_0x4edc('0x1c3'),_0x353179);_0x30d104=_0x156541['dialNoAnswerRetryFrequency'];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1c4')));if(_0x63d2c6[_0x4edc('0x1c0')](0x3,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6['countnoanswerretry']>=_0x156541[_0x4edc('0x1ae')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1c5'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x156541['outboundBusyCallsDay']+=0x1;_0x567aa6['state']=0x5;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1c6');_0x567aa6[_0x4edc('0xfb')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;ami[_0x4edc('0x4c')](_0x4edc('0x1c7'),ut['buildObj'](_0x56c5b4,_0x4edc('0x1c8')));_0x30d104=_0x156541[_0x4edc('0x1c9')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1ca')));if(_0x63d2c6[_0x4edc('0x1c0')](0x5,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfb')]>=_0x156541['dialBusyMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cb'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cb'));}}break;case'8':_0x156541[_0x4edc('0x62')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x8;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1cc');_0x567aa6[_0x4edc('0xfc')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541[_0x4edc('0x1cd')];_0x5f3155=_0x156541[_0x4edc('0x128')];ami['emit']('custom:agentcongestion',ut[_0x4edc('0xf3')](_0x56c5b4,'congestion'));_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)['catch'](loggerCatch(_0x4edc('0x1ce')));if(_0x63d2c6[_0x4edc('0x1c0')](0x8,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfc')]>=_0x156541['dialCongestionMaxRetry']){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cf'));}else{_0x63d2c6['stateGlobal'](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1cf'));}}break;case'11':_0x156541[_0x4edc('0x1d0')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0xb;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x138');_0x567aa6[_0x4edc('0xfe')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541['dialAbandonedRetryFrequency'];_0x5f3155=_0x156541['callAdditionalPhoneAfterMin'];_0x63d2c6['createHistory'](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x139')));if(_0x63d2c6[_0x4edc('0x1c0')](0xb,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfe')]>=_0x156541[_0x4edc('0x136')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d1'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d1'));}}break;case'20':_0x156541[_0x4edc('0x1d2')]+=0x1;_0x567aa6[_0x4edc('0xa8')]=0x14;_0x567aa6[_0x4edc('0xa9')]=_0x4edc('0x1d3');_0x567aa6[_0x4edc('0xff')]+=0x1;_0x567aa6[_0x4edc('0xf9')]+=0x1;_0x30d104=_0x156541[_0x4edc('0x1b9')];_0x5f3155=_0x156541[_0x4edc('0x128')];ami[_0x4edc('0x4c')](_0x4edc('0x1d4'),ut[_0x4edc('0xf3')](_0x56c5b4,'agentreject'));_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1d5')));if(_0x63d2c6['checkRetriveMax'](0x14,_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xff')]>=_0x156541[_0x4edc('0x1b8')]){_0x63d2c6[_0x4edc('0x104')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d6'));}else{_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x4edc('0x1d6'));}}break;default:_0x156541['outboundUnknownCallsDay']+=0x1;_0x567aa6[_0x4edc('0xa8')]=0xc;_0x567aa6[_0x4edc('0xa9')]=_0x58672d[_0x4edc('0x11a')];_0x30d104=_0x156541[_0x4edc('0x1b9')];_0x5f3155=_0x156541[_0x4edc('0x128')];_0x63d2c6[_0x4edc('0xe4')](_0x567aa6)[_0x4edc('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x63d2c6[_0x4edc('0x1c0')](_0x58672d[_0x4edc('0x11a')],_0x56c5b4,_0x156541)&&!_0xec787d){if(_0x567aa6[_0x4edc('0xfb')]+_0x567aa6[_0x4edc('0xfc')]+_0x567aa6[_0x4edc('0x10e')]+_0x567aa6[_0x4edc('0xfd')]+_0x567aa6[_0x4edc('0x10f')]+_0x567aa6[_0x4edc('0xfe')]+_0x567aa6[_0x4edc('0xf8')]+_0x567aa6[_0x4edc('0xff')]>=_0x156541[_0x4edc('0x100')]){_0x63d2c6[_0x4edc('0x101')](_0x567aa6,_0x31b9b4,_0x204c5c,_0x58672d[_0x4edc('0x11a')]);}else{_0x63d2c6['createStateFinal'](_0x567aa6,_0x31b9b4,_0x204c5c,_0x58672d[_0x4edc('0x11a')]);}}}})[_0x4edc('0x3e')](function(){if(_0xec787d){_0x63d2c6['swapAdditionalPhones'](_0x567aa6,_0x30d104,_0x5f3155)['then'](function(){return _0x31b9b4(0x1);});}});});};Dialer[_0x4edc('0x1d')][_0x4edc('0x101')]=function(_0x175b4f,_0x4f3125,_0x5159be,_0x67a37){var _0x58918a=new Final(_0x175b4f);_0x58918a['state']=0xf;_0x58918a[_0x4edc('0xa9')]=_0x4edc('0x1d7');this['createStateFinal'](_0x58918a,_0x4f3125,_0x5159be,_0x67a37);};Dialer[_0x4edc('0x1d')]['createStateFinal']=function(_0x3da6bb,_0x44d1c7,_0x3f7473,_0x32645d){this[_0x4edc('0xd1')](_0x3da6bb)[_0x4edc('0x3e')](function(){return _0x44d1c7(msgResponse(_0x4edc('0x1bb'),_0x4edc('0xde'),_0x32645d));})[_0x4edc('0xb9')](function(){return _0x3f7473(msgResponse(_0x4edc('0x1d8'),_0x4edc('0x159'),_0x4edc('0x1d9')));});};Dialer[_0x4edc('0x1d')][_0x4edc('0xb')]=function(_0x26dcd5){var _0xe62564=_0x26dcd5[_0x4edc('0x1da')]/0x64;var _0x4bad9d=_0x26dcd5[_0x4edc('0x125')]/(_0x26dcd5[_0x4edc('0x125')]+_0x26dcd5[_0x4edc('0xee')]);var _0x1fefc2=Math['round'](_0x26dcd5[_0x4edc('0x70')]*(_0x26dcd5['predictiveIntervalMaxThreshold']/0x64));var _0x584429=Math['round'](_0x26dcd5[_0x4edc('0x70')]*(_0x26dcd5[_0x4edc('0x1db')]/0x64));var _0x56a1fa=_0x26dcd5[_0x4edc('0x51')]+_0x26dcd5[_0x4edc('0x54')];var _0x1bea71=Math[_0x4edc('0x1dc')](_0x26dcd5[_0x4edc('0x72')]*_0x26dcd5[_0x4edc('0x74')]*_0x26dcd5[_0x4edc('0x6d')]*_0x26dcd5[_0x4edc('0x6e')]);if(_[_0x4edc('0x3f')](_0x26dcd5['startProgressive'])){if(!_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x92')])){_0x26dcd5['startPredictive']=undefined;loggerPredictive[_0x4edc('0x9a')]('[startMethodPredictive][StartProgressive]',_0x4edc('0x1dd'));}if(!_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x94')])){loggerPredictive[_0x4edc('0x9a')](_0x4edc('0x1de'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x26dcd5['handlePredictive']);_0x26dcd5[_0x4edc('0x94')]=undefined;}_0x26dcd5[_0x4edc('0x28')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1df'),_0x26dcd5[_0x4edc('0x28')]);this[_0x4edc('0x16a')](_0x26dcd5,0x1);}else if(ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5[_0x4edc('0x28')])){this[_0x4edc('0x16a')](_0x26dcd5,0x1);loggerPredictiveCalls[_0x4edc('0x7e')](_0x4edc('0x1e1'),_0x26dcd5[_0x4edc('0x28')],_0x26dcd5['name']);_0x26dcd5[_0x4edc('0x72')]=0x0;_0x26dcd5[_0x4edc('0x6c')]=0x0;}else if(_0xe62564<_0x4bad9d&&_0x26dcd5['dialPredictiveOptimization']===_0x4edc('0x1e2')){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x1e3'),_0x4edc('0x1e4'),_0x4bad9d,_0x4edc('0x28'),_0x26dcd5['name']);}else if(_0x1bea71<_0x26dcd5['predictiveIntervalErlangCallsDroppedCalls']&&_0x26dcd5['dialPredictiveOptimization']===_0x4edc('0x1e2')){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x4edc('0x1e5'),_0x1bea71,_0x4edc('0x1e6'),_0x26dcd5[_0x4edc('0x6c')],'startProgressive',_0x26dcd5[_0x4edc('0x41')]);}else if(!ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5['startProgressive'])&&_[_0x4edc('0x3f')](_0x26dcd5[_0x4edc('0x92')])&&!_[_0x4edc('0x3f')](_0x26dcd5['startProgressive'])){_0x26dcd5[_0x4edc('0x92')]=moment()[_0x4edc('0x78')](_0x4edc('0x109'));loggerPredictive[_0x4edc('0x7e')](_0x26dcd5['name'],_0x4edc('0x1e7'),_0x26dcd5['startPredictive']);this[_0x4edc('0xc3')](_0x26dcd5[_0x4edc('0x1e0')])['then'](this[_0x4edc('0x1e8')](_0x26dcd5))[_0x4edc('0x3e')](mergeDataErlangB(_0x26dcd5))['then'](this['startMethodPredictive'](_0x26dcd5))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x26dcd5));}else if(!ifInterval(_0x26dcd5[_0x4edc('0x1e0')],_0x26dcd5[_0x4edc('0x92')])){_0x26dcd5[_0x4edc('0x6c')]=0x0;_0x26dcd5[_0x4edc('0x92')]=moment()[_0x4edc('0x78')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1e9'),_0x26dcd5[_0x4edc('0x92')]);clearInterval(_0x26dcd5[_0x4edc('0x94')]);_0x26dcd5[_0x4edc('0x94')]=undefined;this['averageHandleTime'](_0x26dcd5[_0x4edc('0x1e0')])[_0x4edc('0x3e')](this[_0x4edc('0x1e8')](_0x26dcd5))[_0x4edc('0x3e')](mergeDataErlangB(_0x26dcd5))['then'](this[_0x4edc('0x1ea')](_0x26dcd5))['catch'](loggerCatchPredictive(_0x4edc('0x1eb'),_0x26dcd5));}else if(_0x26dcd5['predictiveIntervalAvailable']&&_0x56a1fa<_0x26dcd5[_0x4edc('0x70')]-_0x584429){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1ec'),_0x56a1fa,_0x4edc('0x1ed'),_0x26dcd5['predictiveIntervalAvailable'],'-',_0x584429,'=',_0x26dcd5['predictiveIntervalAvailable']-_0x584429,')');}else if(_0x26dcd5[_0x4edc('0x70')]&&_0x56a1fa>_0x26dcd5['predictiveIntervalAvailable']+_0x1fefc2){freeVariablesPredictive(_0x26dcd5);loggerPredictive[_0x4edc('0x7e')](_0x26dcd5[_0x4edc('0x41')],_0x4edc('0x1ec'),_0x56a1fa,_0x4edc('0x1ee'),_0x26dcd5['predictiveIntervalAvailable'],'+',_0x1fefc2,'=',_0x26dcd5[_0x4edc('0x70')]+_0x1fefc2,')');}};Dialer[_0x4edc('0x1d')][_0x4edc('0x1e8')]=function(_0x20a6f6){var _0x29d972=this;return function(_0x47c878){return new Promise(function(_0x2d1b85,_0x2658fe){_[_0x4edc('0x8f')](_0x20a6f6,_0x47c878[0x0]);if(checkGetDataPredictive(_0x47c878[0x0])){var _0x19aece=_0x20a6f6[_0x4edc('0x70')]=_0x20a6f6[_0x4edc('0x54')]+_0x20a6f6[_0x4edc('0x51')];var _0x30b748=_0x20a6f6['dialPredictiveInterval']*0x3c;var _0x3384e3=_0x47c878[0x0][_0x4edc('0x6a')]+_0x47c878[0x0]['predictiveIntervalAvgHoldtime'];var _0x18292b=(_0x47c878[0x0][_0x4edc('0x82')]+_0x47c878[0x0][_0x4edc('0x83')]+_0x47c878[0x0][_0x4edc('0x6b')])/_0x47c878[0x0]['predictiveIntervalTotalCalls'];_0x20a6f6[_0x4edc('0x6d')]=_0x18292b>0x0?_0x18292b:0x1;switch(_0x20a6f6[_0x4edc('0x1ef')]){case _0x4edc('0x1e2'):var _0x2015cd=_0x20a6f6[_0x4edc('0x1da')]/0x64;return _0x29d972[_0x4edc('0x1f0')](_0x19aece,_0x30b748,_0x3384e3,_0x18292b,_0x2015cd)[_0x4edc('0x3e')](function(_0x19ffcc){return _0x2d1b85(_0x19ffcc);});case _0x4edc('0x1f1'):var _0x677b36=_0x20a6f6['dialPredictiveOptimizationPercentage']/0x64;return _0x29d972[_0x4edc('0x1f2')](_0x19aece,_0x30b748,_0x3384e3,_0x18292b,_0x677b36)['then'](function(_0xf1cf9e){return _0x2d1b85(_0xf1cf9e);});default:return _0x2658fe(msgResponse(_0x4edc('0x1f3'),_0x4edc('0x159'),_0x4edc('0x1f4')));}}else{return _0x2658fe(msgResponse(_0x4edc('0x1f3'),_0x4edc('0x159'),_0x4edc('0x1f5')));}});};};Dialer[_0x4edc('0x1d')][_0x4edc('0x1f6')]=function(_0x5951cd){var _0x2de850=this;return function(_0x4f560e){return new Promise(function(_0x3427a6,_0xb5d743){_[_0x4edc('0x8f')](_0x5951cd,_0x4f560e[0x0]);if(checkGetDataPredictive(_0x4f560e[0x0])){loggerPredictive[_0x4edc('0x7e')](JSON['stringify'](_0x4f560e[0x0]));if(_0x5951cd[_0x4edc('0x1ef')]===_0x4edc('0x1e2')){return _0x2de850[_0x4edc('0xcf')](_0x5951cd['id'])[_0x4edc('0x3e')](function(_0x436bc3){var _0x29100b=_0x5951cd[_0x4edc('0x52')]-_0x436bc3[0x0][_0x4edc('0x1f7')];var _0x323fdc=_0x5951cd['dialPredictiveInterval']*0x3c;var _0x3d9f8=_0x4f560e[0x0][_0x4edc('0x6a')]+_0x4f560e[0x0][_0x4edc('0x69')];var _0x2ae540=(_0x4f560e[0x0][_0x4edc('0x82')]+_0x4f560e[0x0][_0x4edc('0x83')]+_0x4f560e[0x0][_0x4edc('0x6b')])/_0x4f560e[0x0][_0x4edc('0x71')];var _0x375b30=_0x5951cd[_0x4edc('0x1da')]/0x64;_0x5951cd[_0x4edc('0x6f')]=_0x436bc3[0x0][_0x4edc('0x1f7')]||0x0;_0x5951cd['predictiveIntervalHitRate']=_0x2ae540>0x0?_0x2ae540:0x1;return _0x2de850[_0x4edc('0x1f0')](_0x29100b,_0x323fdc,_0x3d9f8,_0x2ae540,_0x375b30);})[_0x4edc('0x3e')](function(_0x2d3598){return _0x3427a6(_0x2d3598);})[_0x4edc('0xb9')](function(_0x3a4afe){return _0xb5d743(msgResponse('[CatchErlangB]',_0x4edc('0x159'),JSON['stringify'](_0x3a4afe)));});}if(_0x5951cd[_0x4edc('0x1ef')]===_0x4edc('0x1f1')){return _0x2de850['getVoiceQueueRtPauses'](_0x5951cd['id'])[_0x4edc('0x3e')](function(_0x400d51){var _0x531331=_0x5951cd['loggedIn']-_0x400d51[0x0][_0x4edc('0x1f7')];var _0x7a54d0=_0x5951cd[_0x4edc('0x1e0')]*0x3c;var _0x22fe62=_0x4f560e[0x0][_0x4edc('0x6a')]+_0x4f560e[0x0][_0x4edc('0x69')];var _0x3430fe=(_0x4f560e[0x0][_0x4edc('0x82')]+_0x4f560e[0x0][_0x4edc('0x83')]+_0x4f560e[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4f560e[0x0][_0x4edc('0x71')];var _0x27b21f=_0x5951cd[_0x4edc('0x1da')]/0x64;_0x5951cd[_0x4edc('0x6f')]=_0x400d51[0x0][_0x4edc('0x1f7')]||0x0;_0x5951cd[_0x4edc('0x6d')]=_0x3430fe>0x0?_0x3430fe:0x1;return _0x2de850[_0x4edc('0x1f2')](_0x531331,_0x7a54d0,_0x22fe62,_0x3430fe,_0x27b21f);})[_0x4edc('0x3e')](function(_0xc808ed){return _0x3427a6(_0xc808ed);})[_0x4edc('0xb9')](function(_0x2389ba){return _0xb5d743(msgResponse('[CatchErlangB]',_0x4edc('0x159'),JSON['stringify'](_0x2389ba)));});}}else{return _0xb5d743(msgResponse('[getDataPredictive]',_0x4edc('0x159'),'check\x20failure'));}});};};Dialer[_0x4edc('0x1d')][_0x4edc('0x1ea')]=function(_0x2c7bb3){var _0x5b7051=this;return function(){var _0x189d1d=0x0;var _0x16d03b=Math[_0x4edc('0x1dc')](_0x2c7bb3['erlangCallToSecond']*0x3e8);if(_0x16d03b>0x0){_0x16d03b=_0x16d03b<0x64?0x64:_0x16d03b;loggerPredictive[_0x4edc('0x7e')](_0x2c7bb3[_0x4edc('0x41')],_0x4edc('0x1f8'),_0x16d03b,_0x4edc('0x4b'));_0x2c7bb3[_0x4edc('0x94')]=setInterval(function(){_0x5b7051[_0x4edc('0x94')](_0x2c7bb3);loggerPredictiveCalls['info'](_0x4edc('0x1f9'),_0x189d1d+=0x1);},_0x16d03b);}else{loggerPredictive['info'](_0x2c7bb3[_0x4edc('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x4edc('0x1d')]['checkContactBlack']=function(_0x32a616,_0x44c0cf){var _0xf6646f=this;return function(_0x4a083b){if(_[_0x4edc('0x47')](_0x4a083b)){if(_['isNil'](_0x44c0cf['UserId'])||!_0x44c0cf[_0x4edc('0x1fa')]){if(_0x32a616[_0x4edc('0x5b')]===_0x4edc('0xa')){_0x32a616[_0x4edc('0x143')]=_[_0x4edc('0x3f')](_0x32a616[_0x4edc('0x143')])?!![]:_0x32a616[_0x4edc('0x143')];var _0x28a4b5=uuid['v4']();_0xf6646f['actions'][_0x28a4b5]=new Action(_0x32a616,_0x44c0cf,_0x28a4b5);loggerBooked[_0x4edc('0x7e')](_0x4edc('0x1fb'),_0x28a4b5,_0x4edc('0x1fc'),JSON[_0x4edc('0x4a')](_0x32a616['queueStatusComplete']),'Queue:\x20',_0x32a616[_0x4edc('0x41')]);if(_0x32a616[_0x4edc('0x143')]){_0x32a616[_0x4edc('0x143')]=![];_0xf6646f[_0x4edc('0x140')][_0xf6646f['actions'][_0x28a4b5][_0x4edc('0xb4')]]=[];ami[_0x4edc('0xb0')]({'actionid':_0x28a4b5,'action':_0x4edc('0x1fd'),'queue':_0x32a616[_0x4edc('0x41')]})[_0x4edc('0xb9')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);_0xf6646f[_0x4edc('0xc6')]({'active':![],'ContactId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd8')],'ListId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd9')],'VoiceQueueId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xda')]||undefined,'CampaignId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xdb')]||undefined})['catch'](loggerCatch(_0x4edc('0x1fe')));delete _0xf6646f[_0x4edc('0x27')][_0x28a4b5];});}else{loggerBooked[_0x4edc('0x7e')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x32a616[_0x4edc('0x143')]),_0x4edc('0x1ff'),_0x32a616[_0x4edc('0x41')]);_0xf6646f[_0x4edc('0xb3')](_0x32a616);_0xf6646f[_0x4edc('0xc6')]({'active':![],'ContactId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd8')],'ListId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xd9')],'VoiceQueueId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xda')]||undefined,'CampaignId':_0xf6646f[_0x4edc('0x27')][_0x28a4b5][_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x1fe')));delete _0xf6646f[_0x4edc('0x27')][_0x28a4b5];}}else{return _0xf6646f['actionOriginate'](_0x32a616,_0x44c0cf);}}else{if(getDiff(_0x44c0cf[_0x4edc('0x200')])<_0x32a616['dialRecallMeTimeout']*0x3c){if(_0x44c0cf['Agent']&&!_0x44c0cf['Agent'][_0x4edc('0x201')]){_0xf6646f['preview']['run'](_0x44c0cf['id'])[_0x4edc('0x1f')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);});}else{_0xf6646f[_0x4edc('0xc8')]({'active':![]},_0x44c0cf['id'],0x1)[_0x4edc('0x1f')](function(){_0xf6646f[_0x4edc('0xb3')](_0x32a616);});}}else{_0x32a616['outboundReCallsDay']+=0x1;_0xf6646f[_0x4edc('0xb3')](_0x32a616);if(_0x32a616[_0x4edc('0x202')]){_0xf6646f['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x44c0cf['ContactId'],'ListId':_0x44c0cf[_0x4edc('0xd9')],'VoiceQueueId':_0x44c0cf[_0x4edc('0xda')]||undefined,'CampaignId':_0x44c0cf[_0x4edc('0xdb')]||undefined})[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x203')));_0xf6646f[_0x4edc('0xe4')](createObjHistory(_0x32a616,_0x44c0cf,'RECALLINQUEUE',0x17,_0x4edc('0x204')))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0x205')));}else{_0xf6646f['saveInDb'](createObjHistory(_0x32a616,_0x44c0cf,'RECALLFAILEDTIMEOUT',0x16,_0x4edc('0x206')),_0x4edc('0x207'),_0x4edc('0x208'));}}}}else{_0x32a616[_0x4edc('0x60')]+=0x1;_0xf6646f[_0x4edc('0xd7')](createObjHistory(_0x32a616,_0x44c0cf,_0x4edc('0x209'),0xd,_0x4edc('0x20a')),_0x4edc('0x20b'),_0x4edc('0x20c'));throw'inBlackList';}};};Dialer[_0x4edc('0x1d')][_0x4edc('0x173')]=function(_0x579baf){var _0x5ee4f7=this;var _0x22bc92=_0x579baf[_0x4edc('0x20d')]-_0x579baf['originated']-_0x579baf[_0x4edc('0xcb')];emitCampaignSummary(_0x579baf);if(_0x22bc92>0x0){if(_0x22bc92>this[_0x4edc('0x26')]){_0x22bc92=this[_0x4edc('0x26')];}_0x579baf[_0x4edc('0xcb')]+=_0x22bc92;this[_0x4edc('0xcd')](_0x579baf['id'],_0x22bc92,_0x579baf['dialOrderByScheduledAt'],_0x579baf)[_0x4edc('0x3e')](function(_0x18a641){_0x579baf[_0x4edc('0xcb')]-=_0x22bc92;_0x579baf['temp']=_0x579baf[_0x4edc('0xcb')]>0x0?_0x579baf[_0x4edc('0xcb')]:0x0;if(!checkContactEmpty(_0x18a641)){_0x579baf['message']=_0x4edc('0xa0');logger[_0x4edc('0x7e')](_0x4edc('0x20e')+_0x579baf[_0x4edc('0x41')]);}else{_0x579baf[_0x4edc('0x9c')]+=_0x18a641['length'];_0x579baf['message']='RUNNING';for(var _0x3ec309=0x0;_0x3ec309<_0x18a641['length'];_0x3ec309+=0x1){_0x579baf[_0x4edc('0x20f')]+=0x1;if(_[_0x4edc('0xe6')](_0x18a641[_0x3ec309])||_['isNil'](_0x18a641[_0x3ec309]['Contact'])||_[_0x4edc('0xe6')](_0x18a641[_0x3ec309][_0x4edc('0x1a1')])){_0x5ee4f7['emptyContact'](_0x4edc('0x210'),_0x579baf,_0x18a641[_0x3ec309]);}else{_0x5ee4f7[_0x4edc('0xc1')](_[_0x4edc('0x146')](_0x18a641[_0x3ec309],[_0x4edc('0xdb'),_0x4edc('0x1a1')]))[_0x4edc('0x3e')](_0x5ee4f7[_0x4edc('0x211')](_0x579baf,_0x18a641[_0x3ec309]))[_0x4edc('0xb9')](_0x5ee4f7[_0x4edc('0xd5')](_0x4edc('0x212'),_0x579baf));}}}})['catch'](loggerGetContactDialer(_0x4edc('0x213'),_0x579baf,_0x22bc92));}};Dialer['prototype'][_0x4edc('0x16a')]=function(_0x425027,_0xaad84d){var _0xd0e2b5=this;var _0x190ed2=[];var _0x22bc70=_0xaad84d>=0x1?_0xaad84d:0x1;if(_0x425027[_0x4edc('0x5b')]==='booked'){_0x22bc70=0x1;}var _0x350ba8=Math['floor'](_0x425027[_0x4edc('0x51')]*_0x22bc70)-_0x425027[_0x4edc('0x9c')]-_0x425027[_0x4edc('0xcb')];emitVoiceQueueSummary(_0x425027);if(_0x425027[_0x4edc('0x214')]>0x0){var _0x54befc=_0x425027[_0x4edc('0x214')]-_0x425027['originated']-_0x425027[_0x4edc('0x54')]-_0x425027[_0x4edc('0xcb')]-_0x425027['pTalking'];if(_0x350ba8>_0x54befc){_0x350ba8=_0x54befc;}}if(_0x350ba8>0x0){if(_0x425027['dialMethod']==='booked'){_0x350ba8=0x1;}if(_0x350ba8>this['maxNumberOriginate']){_0x350ba8=this[_0x4edc('0x26')];}_0x425027[_0x4edc('0xcb')]+=_0x350ba8;for(var _0x356e9e in this[_0x4edc('0x24')]){if(typeof this[_0x4edc('0x24')][_0x356e9e]!==_0x4edc('0x9d')){if(this[_0x4edc('0x24')][_0x356e9e][_0x4edc('0xa8')]===_0x4edc('0x215')&&this['agents'][_0x356e9e][_0x4edc('0xe0')]===_0x4edc('0xe1')){_0x190ed2['push'](this[_0x4edc('0x24')][_0x356e9e]['id']);}}}this[_0x4edc('0xca')](_0x425027['id'],_0x190ed2,_0x350ba8,_0x425027[_0x4edc('0x216')],_0x425027)['then'](function(_0x58c934){_0x425027[_0x4edc('0xcb')]-=_0x350ba8;_0x425027['temp']=_0x425027[_0x4edc('0xcb')]>0x0?_0x425027[_0x4edc('0xcb')]:0x0;if(!checkContactEmpty(_0x58c934)){_0xd0e2b5[_0x4edc('0xb7')](_0x425027)[_0x4edc('0x3e')](sendMessageReschedule(_0x425027))[_0x4edc('0xb9')](loggerCatch('[countReScheduled]\x20'));}else{_0x425027[_0x4edc('0x9c')]+=_0x58c934[_0x4edc('0x9b')];_0x425027[_0x4edc('0x42')]=_0x425027[_0x4edc('0x5b')]===_0x4edc('0xa')?_0x4edc('0x18a'):'RUNNING';for(var _0x4302f9=0x0;_0x4302f9<_0x58c934[_0x4edc('0x9b')];_0x4302f9+=0x1){if(_[_0x4edc('0xe6')](_0x58c934[_0x4302f9])||_[_0x4edc('0xe6')](_0x58c934[_0x4302f9][_0x4edc('0x198')])||_['isNil'](_0x58c934[_0x4302f9]['phone'])){_0xd0e2b5['emptyContact'](_0x4edc('0x210'),_0x425027,_0x58c934[_0x4302f9]);}else{_0xd0e2b5['checkIsBlackList'](_['pick'](_0x58c934[_0x4302f9],['VoiceQueueId','phone']))['then'](_0xd0e2b5['checkContactBlack'](_0x425027,_0x58c934[_0x4302f9]))['catch'](_0xd0e2b5[_0x4edc('0xd5')]('[actionOriginate]\x20',_0x425027));}}}})[_0x4edc('0xb9')](loggerGetContactDialer('[getContactDialer2]',_0x425027,_0x350ba8));}};Dialer[_0x4edc('0x1d')][_0x4edc('0x94')]=function(_0x5f1e9c){if(_0x5f1e9c['dialLimitQueue']>0x0){var _0x48ba24=_0x5f1e9c[_0x4edc('0x214')]-_0x5f1e9c[_0x4edc('0x9c')]-_0x5f1e9c[_0x4edc('0x54')];if(_0x48ba24>0x0){this[_0x4edc('0x217')](_0x5f1e9c);}else{loggerPredictiveCalls[_0x4edc('0x7e')]('[handlePredictive][limitChannel]');}}else{this[_0x4edc('0x217')](_0x5f1e9c);}};Dialer[_0x4edc('0x1d')][_0x4edc('0x217')]=function(_0x42e8dd){var _0x1e5365=this;var _0x168ad8=[];_0x42e8dd[_0x4edc('0x9c')]+=0x1;for(var _0x1badee in this[_0x4edc('0x24')]){if(typeof this[_0x4edc('0x24')][_0x1badee]!==_0x4edc('0x9d')){if(this[_0x4edc('0x24')][_0x1badee][_0x4edc('0xa8')]===_0x4edc('0x215')&&this[_0x4edc('0x24')][_0x1badee][_0x4edc('0xe0')]==='reachable'){_0x168ad8[_0x4edc('0x141')](this['agents'][_0x1badee]['id']);}}}this[_0x4edc('0xca')](_0x42e8dd['id'],_0x168ad8,0x1,_0x42e8dd[_0x4edc('0x216')],_0x42e8dd)[_0x4edc('0x3e')](function(_0x5ed852){if(!checkContactEmpty(_0x5ed852)){checkContactLowerLimitOriginate(_0x42e8dd,0x1,0x0);_0x1e5365[_0x4edc('0xb7')](_0x42e8dd)[_0x4edc('0x3e')](sendMessageReschedule(_0x42e8dd))[_0x4edc('0xb9')](loggerCatch(_0x4edc('0xba')));}else{_0x42e8dd[_0x4edc('0x42')]=_0x4edc('0x218');if(_[_0x4edc('0xe6')](_0x5ed852[0x0])||_[_0x4edc('0xe6')](_0x5ed852[0x0][_0x4edc('0x198')])||_[_0x4edc('0xe6')](_0x5ed852[0x0][_0x4edc('0x1a1')])){_0x1e5365['emptyContact']('[actionOriginate]\x20',_0x42e8dd,_0x5ed852[0x0]);}else{_0x1e5365[_0x4edc('0xbb')](_[_0x4edc('0x146')](_0x5ed852[0x0],[_0x4edc('0xda'),_0x4edc('0x1a1')]))[_0x4edc('0x3e')](_0x1e5365[_0x4edc('0x211')](_0x42e8dd,_0x5ed852[0x0]))[_0x4edc('0xb9')](_0x1e5365[_0x4edc('0xd5')](_0x4edc('0x219'),_0x42e8dd));}}})[_0x4edc('0xb9')](loggerGetContactDialer(_0x4edc('0x21a'),_0x42e8dd,0x1));emitVoiceQueueSummary(_0x42e8dd);};Dialer['prototype']['abandonmentRate']=function(_0x22c0d9,_0x558862,_0x150862,_0x3f33f1,_0x9508cc,_0x1784ac){loggerPredictive['info'](_0x4edc('0x21b'));loggerPredictive['info'](_0x4edc('0x21c'),_0x22c0d9);loggerPredictive['info'](_0x4edc('0x21d'),_0x558862);loggerPredictive['info'](_0x4edc('0x21e'),_0x150862);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21f'),_0x3f33f1);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x220'),_0x9508cc);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x87'));return new Promise(function(_0x33cf5f,_0x51baab){if(_0x22c0d9<=0x0||isNaN(_0x22c0d9)){return _0x51baab(msgResponse(_0x4edc('0x221'),_0x4edc('0x49'),'m\x20=\x20'+_0x22c0d9));}if(_0x150862<=0x0||isNaN(_0x150862)){return _0x51baab(msgResponse('[abandonmentRate]',_0x4edc('0x49'),_0x4edc('0x222')+_0x150862));}if(_0x3f33f1<=0x0||isNaN(_0x3f33f1)){return _0x51baab(msgResponse(_0x4edc('0x221'),'Error',_0x4edc('0x223')+_0x3f33f1));}if(_0x558862<=0x0||isNaN(_0x558862)){return _0x51baab(msgResponse(_0x4edc('0x221'),_0x4edc('0x49'),_0x4edc('0x224')+_0x558862));}if(_0x9508cc<=0x0||isNaN(_0x9508cc)){return _0x51baab(msgResponse('[abandonmentRate]','Error',_0x4edc('0x225')+_0x9508cc));}_0x1784ac=_0x1784ac||0x0;var _0x5b9aad=0x1/_0x150862;var _0x434f8d=0x0;var _0x2ae490=0x0;var _0x620cfd=0x0;var _0x182323=0x0;for(var _0x4305c3=0x0;_0x620cfd<_0x9508cc;_0x4305c3+=0x1){_0x2ae490=_0x4305c3/_0x558862;_0x434f8d=(_0x3f33f1*_0x2ae490+_0x1784ac)/_0x5b9aad;_0x620cfd=erlangb(_0x434f8d,_0x22c0d9);_0x182323=_0x434f8d/_0x22c0d9*(0x1-erlangb(_0x434f8d,_0x22c0d9));}return _0x33cf5f({'erlangCalls':_0x4305c3,'erlangCallToSecond':_0x558862/_0x4305c3,'erlangAbandonmentRate':_0x620cfd,'erlangBusyFactor':_0x182323});});};Dialer['prototype'][_0x4edc('0x1f2')]=function(_0x33b288,_0x5294ad,_0x3ee6cc,_0x75adeb,_0x2d49c0,_0x31bd46){loggerPredictive['info'](_0x4edc('0x226'));loggerPredictive[_0x4edc('0x7e')]('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',_0x33b288);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21d'),_0x5294ad);loggerPredictive[_0x4edc('0x7e')]('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',_0x3ee6cc);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x21f'),_0x75adeb);loggerPredictive[_0x4edc('0x7e')](_0x4edc('0x227'),_0x2d49c0);loggerPredictive['info'](_0x4edc('0x87'));return new Promise(function(_0x3219ea,_0x309f7f){if(_0x33b288<=0x0||isNaN(_0x33b288)){return _0x309f7f(msgResponse('[busyFactor]',_0x4edc('0x49'),'m\x20=\x20'+_0x33b288));}if(_0x3ee6cc<=0x0||isNaN(_0x3ee6cc)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x222')+_0x3ee6cc));}if(_0x75adeb<=0x0||isNaN(_0x75adeb)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x223')+_0x75adeb));}if(_0x5294ad<=0x0||isNaN(_0x5294ad)){return _0x309f7f(msgResponse('[busyFactor]','Error',_0x4edc('0x224')+_0x5294ad));}if(_0x2d49c0<=0x0||isNaN(_0x2d49c0)){return _0x309f7f(msgResponse(_0x4edc('0x228'),_0x4edc('0x49'),_0x4edc('0x229')+_0x2d49c0));}_0x31bd46=_0x31bd46||0x0;var _0x11475b=0x1/_0x3ee6cc;var _0x1a7fba=0x0;var _0x1a5d90=0x0;var _0x149ab6=0x0;var _0x4236ae=0x0;for(var _0x2691e9=0x0;_0x4236ae<_0x2d49c0;_0x2691e9+=0x1){_0x1a5d90=_0x2691e9/_0x5294ad;_0x1a7fba=(_0x75adeb*_0x1a5d90+_0x31bd46)/_0x11475b;_0x149ab6=erlangb(_0x1a7fba,_0x33b288);_0x4236ae=_0x1a7fba/_0x33b288*(0x1-erlangb(_0x1a7fba,_0x33b288));}return _0x3219ea({'erlangCalls':_0x2691e9,'erlangCallToSecond':_0x5294ad/_0x2691e9,'erlangAbandonmentRate':_0x149ab6,'erlangBusyFactor':_0x4236ae});});};module[_0x4edc('0x22a')]=Dialer; \ No newline at end of file +var _0x5b6a=['loggerHandler','emptyContact','notFound','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','variable','exten','xcally-motion-dialer','HANGUP','uniqueid','membername','emit','custom:amd','amd','[syncHangupInAMD][createHistory]','value','Machine','AMD','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countabandonedretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','dialAMDActive','statedesc','HangupInAMD','[syncHangupInAMDIvr][createHistory]','MACHINE','countcongestionretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','[rescheduleContact][Drop]','Drop','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','CALLEREXIT','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','actionid','roundrobin','paused','stateinterface','locked','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','preview','[Catch][Preview][syncQueueStatusComplete]','finally','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','isArray','command','interval','timezones','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','checkPreviewRecallReminder','handlePreviewRecallNotifications','Agent','user:%s','user:dialPreviewRecallReminder','handleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','map','launchHandleIvr','[syncCampaigns]','pow','replace','random','match','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','Contact','tags','updatedAt','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','variables','trim','dialCutDigit','SIP/%s/%s%s','substring','from-sip','dialOriginateTimeout','[originate][error]','originate\x20action\x20Error','getQueue','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialBusyMaxRetry','countbusyretry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','reason','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','dialNoSuchNumberMaxRetry','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','dialCongestionRetryFrequency','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','startMethodPredictive','Predictive\x20after\x20first\x20interval','dialPredictiveInterval','getDataPredictive','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','busyFactor','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','voicePause','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','BLACKLIST','Blacklist','inBlackList','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','tryOriginatePredictive','not_inuse','getContactDialer','checkIsBlackList','[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','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\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','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','enqueue','tail','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','milliseconds','seconds','outbound','strategy','available','pTalking','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','diff','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','debug','inspect','error','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','NOT_ACTIVE','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','starttime','prototype','clearZombieChannels','actions','[actions]','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','type','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]\x20','[checkIsBlackListIvr]\x20','averageHandleTime','rescheduleContact','unlockContact','[unlockContact]\x20','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5b6a,0x156));var _0xa5b6=function(_0x27e50c,_0x368fd1){_0x27e50c=_0x27e50c-0x0;var _0x40711b=_0x5b6a[_0x27e50c];return _0x40711b;};'use strict';var util=require(_0xa5b6('0x0'));var _=require(_0xa5b6('0x1'));var uuid=require(_0xa5b6('0x2'));var moment=require(_0xa5b6('0x3'));var rr=require('rr');var md5=require(_0xa5b6('0x4'));var Redis=require('ioredis');var ut=require(_0xa5b6('0x5'));var config=require(_0xa5b6('0x6'));var logger=require(_0xa5b6('0x7'))(_0xa5b6('0x8'));var loggerBooked=require(_0xa5b6('0x7'))(_0xa5b6('0x9'));var loggerPredictive=require(_0xa5b6('0x7'))('predictive');var loggerPredictiveCalls=require(_0xa5b6('0x7'))(_0xa5b6('0xa'));var loggerSyncQueueSummary=require(_0xa5b6('0x7'))(_0xa5b6('0xb'));var ami=require(_0xa5b6('0xc'));config[_0xa5b6('0xd')]=_['defaults'](config['redis'],{'host':_0xa5b6('0xe'),'port':0x18eb});var io=require(_0xa5b6('0xf'))(new Redis(config[_0xa5b6('0xd')]));var cmHopper=require(_0xa5b6('0x10'));var cmHopperHistory=require(_0xa5b6('0x11'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0xa5b6('0x12'));var voiceQueueRt=require(_0xa5b6('0x13'));var RpcSetting=require('../rpc/setting');var Action=require('./action');var History=require(_0xa5b6('0x14'));var Final=require(_0xa5b6('0x15'));var AgentComplete=require(_0xa5b6('0x16'));var QueueCallerAbandon=require(_0xa5b6('0x17'));var Hangup=require(_0xa5b6('0x18'));var ipAgi=process[_0xa5b6('0x19')]['XCALLY_IP_AGI']||_0xa5b6('0x1a');var strategy={'rrmemory':_0xa5b6('0x1b'),'roundrobin':'roundrobin'};var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0xa5b6('0x1c')]=function(_0xb4529a){this['tail']=this[_0xa5b6('0x1d')]?this[_0xa5b6('0x1d')]['finally'](_0xb4529a):_0xb4529a();};function Dialer(_0x229a1b,_0x39aa8c){this['sequence']=new Sequence();this['preview']=_0x39aa8c;this[_0xa5b6('0x1e')]=_0x229a1b[_0xa5b6('0x1e')];this[_0xa5b6('0x1f')]=_0x229a1b[_0xa5b6('0x1f')];this[_0xa5b6('0x20')]=_0x229a1b['agents'];this[_0xa5b6('0x21')]=_0x229a1b[_0xa5b6('0x21')];this[_0xa5b6('0x22')]=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0xa5b6('0x23')]={};this[_0xa5b6('0x24')]={};this[_0xa5b6('0x25')]={};this[_0xa5b6('0x26')]={};this[_0xa5b6('0x27')]={};this['ivrOriginated']={};this[_0xa5b6('0x28')]={};this[_0xa5b6('0x29')]={};ami['on'](_0xa5b6('0x2a'),this[_0xa5b6('0x2b')][_0xa5b6('0x2c')](this));ami['on'](_0xa5b6('0x2d'),this[_0xa5b6('0x2e')][_0xa5b6('0x2c')](this));ami['on'](_0xa5b6('0x2f'),this[_0xa5b6('0x30')]['bind'](this));ami['on'](_0xa5b6('0x31'),this[_0xa5b6('0x32')]['bind'](this));ami['on'](_0xa5b6('0x33'),this['syncQueueSummary'][_0xa5b6('0x2c')](this));ami['on'](_0xa5b6('0x34'),this[_0xa5b6('0x35')][_0xa5b6('0x2c')](this));ami['on'](_0xa5b6('0x36'),this[_0xa5b6('0x37')]['bind'](this));ami['on'](_0xa5b6('0x38'),this[_0xa5b6('0x39')][_0xa5b6('0x2c')](this));ami['on']('varset',this[_0xa5b6('0x3a')][_0xa5b6('0x2c')](this));ami['on'](_0xa5b6('0x3b'),this[_0xa5b6('0x3c')][_0xa5b6('0x2c')](this));ami['on']('queuestatuscomplete',this[_0xa5b6('0x3d')][_0xa5b6('0x2c')](this));this[_0xa5b6('0x3e')]();this[_0xa5b6('0x3f')]();RpcSetting[_0xa5b6('0x40')]()[_0xa5b6('0x41')](function(_0x267b37){previewRecallmeReminderInterval=_0x267b37[_0xa5b6('0x42')];});}function isNotNull(_0x12b32e){return _0x12b32e!==null&&!_[_0xa5b6('0x43')](_0x12b32e);}function checkIsLoggedIn(_0x136f3f,_0x1fbad6){return function(){if(_0x1fbad6<=0x0){_0x136f3f[_0xa5b6('0x44')]=_0xa5b6('0x45');throw _0x136f3f[_0xa5b6('0x46')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x599a33){return _0x599a33;}function checkIsActive(_0x158968,_0x56e71a){return function(){if(!isActive(_0x56e71a)){_0x158968[_0xa5b6('0x44')]='NOT_ACTIVE';throw _0x158968[_0xa5b6('0x46')]+_0xa5b6('0x47');}};}function checkInterval(_0x1ad1ee){return function(){if(!isNotNull(_0x1ad1ee['Interval'])){_0x1ad1ee[_0xa5b6('0x44')]=_0xa5b6('0x48');throw _0x1ad1ee[_0xa5b6('0x46')]+_0xa5b6('0x49');}if(!isNotNull(_0x1ad1ee[_0xa5b6('0x4a')][_0xa5b6('0x4b')])){_0x1ad1ee['message']=_0xa5b6('0x48');throw _0x1ad1ee['name']+_0xa5b6('0x49');}if(!isNotNull(_[_0xa5b6('0x4c')](_0x1ad1ee[_0xa5b6('0x4a')]['Intervals']))){_0x1ad1ee['message']=_0xa5b6('0x48');throw _0x1ad1ee[_0xa5b6('0x46')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x56f7b9,_0x5078c6,_0x3f6ff8){return{'action':_0x56f7b9,'response':_0x5078c6,'message':_0x3f6ff8,'stack':_0x3f6ff8};}function myreject(_0x237750){return function(_0x33fd62){return _0x237750(msgResponse('[ifTime][Action]',_0xa5b6('0x4d'),JSON['stringify'](_0x33fd62)));};}function getSeconds(_0x1336ae,_0x4b44ee){var _0x208968=moment(_0x1336ae)[_0xa5b6('0x4e')](0x0);var _0x51d1da=moment(_0x4b44ee)[_0xa5b6('0x4e')](0x0);return _0x208968['diff'](_0x51d1da,_0xa5b6('0x4f'));}function emit(_0x3c6201,_0x534228,_0x46a56a){io['to'](_0x3c6201)['emit'](_0x534228,_0x46a56a);}function emitVoiceQueueSummary(_0x4c7082){if(_0x4c7082['type']===_0xa5b6('0x50')){var _0x670c2d={'id':_0x4c7082['id'],'name':_0x4c7082[_0xa5b6('0x46')],'strategy':_0x4c7082[_0xa5b6('0x51')],'answered':_0x4c7082['answered'],'available':_0x4c7082[_0xa5b6('0x52')],'loggedIn':_0x4c7082['loggedIn'],'pTalking':_0x4c7082[_0xa5b6('0x53')],'sumBillable':_0x4c7082[_0xa5b6('0x54')],'sumDuration':_0x4c7082[_0xa5b6('0x55')],'sumHoldTime':_0x4c7082['sumHoldTime']||0x0,'talking':_0x4c7082[_0xa5b6('0x56')],'total':_0x4c7082[_0xa5b6('0x57')],'type':_0x4c7082['type'],'unmanaged':_0x4c7082[_0xa5b6('0x58')],'abandoned':_0x4c7082[_0xa5b6('0x59')],'waiting':_0x4c7082[_0xa5b6('0x5a')],'loggedInDb':_0x4c7082[_0xa5b6('0x5b')],'dialActive':_0x4c7082[_0xa5b6('0x5c')],'dialMethod':_0x4c7082[_0xa5b6('0x5d')],'dialOriginateCallerIdName':_0x4c7082[_0xa5b6('0x5e')],'dialOriginateCallerIdNumber':_0x4c7082[_0xa5b6('0x5f')],'dialOriginateTimeout':_0x4c7082['dialOriginateTimeout'],'dialPrefix':_0x4c7082[_0xa5b6('0x60')],'outboundAnswerAgiCallsDay':_0x4c7082[_0xa5b6('0x61')],'outboundAnswerCallsDay':_0x4c7082[_0xa5b6('0x62')],'outboundBlacklistCallsDay':_0x4c7082['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x4c7082[_0xa5b6('0x63')],'outboundCongestionCallsDay':_0x4c7082[_0xa5b6('0x64')],'outboundDropCallsDayACS':_0x4c7082[_0xa5b6('0x65')],'outboundDropCallsDayCallersExit':_0x4c7082[_0xa5b6('0x66')],'outboundDropCallsDayTimeout':_0x4c7082['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4c7082[_0xa5b6('0x67')],'outboundNoSuchCallsDay':_0x4c7082[_0xa5b6('0x68')],'outboundOriginateFailureCallsDay':_0x4c7082[_0xa5b6('0x69')],'outboundReCallsDay':_0x4c7082['outboundReCallsDay'],'outboundRejectCallsDay':_0x4c7082[_0xa5b6('0x6a')],'outboundUnknownCallsDay':_0x4c7082['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x4c7082[_0xa5b6('0x6b')],'predictiveIntervalAvgHoldtime':_0x4c7082[_0xa5b6('0x6c')],'predictiveIntervalAvgTalktime':_0x4c7082[_0xa5b6('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x4c7082['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4c7082[_0xa5b6('0x6e')],'predictiveIntervalErlangCalls':_0x4c7082[_0xa5b6('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c7082[_0xa5b6('0x70')],'predictiveIntervalHitRate':_0x4c7082[_0xa5b6('0x71')],'predictiveIntervalMultiplicativeFactor':_0x4c7082['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4c7082[_0xa5b6('0x72')],'predictiveIntervalAvailable':_0x4c7082['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x4c7082[_0xa5b6('0x73')],'message':_0x4c7082[_0xa5b6('0x44')],'originated':_0x4c7082[_0xa5b6('0x74')],'erlangCalls':_0x4c7082[_0xa5b6('0x75')],'erlangCallToSecond':_0x4c7082[_0xa5b6('0x76')],'erlangAbandonmentRate':_0x4c7082[_0xa5b6('0x77')],'erlangBusyFactor':_0x4c7082[_0xa5b6('0x78')],'startPredictive':_0x4c7082[_0xa5b6('0x26')],'startProgressive':_0x4c7082[_0xa5b6('0x27')]};if(_0x4c7082[_0xa5b6('0x79')]){_0x670c2d[_0xa5b6('0x79')]={'id':_0x4c7082[_0xa5b6('0x79')]['id'],'name':_0x4c7082[_0xa5b6('0x79')][_0xa5b6('0x46')],'active':_0x4c7082[_0xa5b6('0x79')][_0xa5b6('0x7a')],'callerid':_0x4c7082['Trunk'][_0xa5b6('0x7b')]};}if(_0x4c7082[_0xa5b6('0x4a')]){_0x670c2d[_0xa5b6('0x4a')]={'id':_0x4c7082[_0xa5b6('0x4a')]['id'],'name':_0x4c7082[_0xa5b6('0x4a')][_0xa5b6('0x46')]};}var _0x14b700=md5(JSON['stringify'](_0x670c2d));if(_0x4c7082[_0xa5b6('0x4')]!==_0x14b700){_0x4c7082['md5']=_0x14b700;emit(util[_0xa5b6('0x7c')](_0xa5b6('0x7d'),_0x670c2d[_0xa5b6('0x46')]),_0xa5b6('0x7e'),_0x670c2d);}}}function emitCampaignSummary(_0x13ba36){if(_0x13ba36['type']===_0xa5b6('0x7f')){emit(util[_0xa5b6('0x7c')](_0xa5b6('0x80'),_0x13ba36['name']),'campaign:save',_0x13ba36);}}function checkGetDataPredictive(_0x4bb3dd){if(isNotNull(_0x4bb3dd)&&!_['isEmpty'](_0x4bb3dd)){loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x82'));loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x83'),_0x4bb3dd[_0xa5b6('0x73')]);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x84'),_0x4bb3dd[_0xa5b6('0x6b')]);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x85'),_0x4bb3dd[_0xa5b6('0x6e')]);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x86'),_0x4bb3dd['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x87'),_0x4bb3dd[_0xa5b6('0x6c')]);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x88'),_0x4bb3dd[_0xa5b6('0x6d')]);loggerPredictive[_0xa5b6('0x81')]('---------------------------');if(_0x4bb3dd['predictiveIntervalTotalCalls']>0x0){if(!_[_0xa5b6('0x43')](_0x4bb3dd['predictiveIntervalAvgTalktime'])&&_0x4bb3dd[_0xa5b6('0x6d')]>0x0){return!![];}loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x89'));if(!_['isUndefined'](_0x4bb3dd[_0xa5b6('0x6c')])&&_0x4bb3dd[_0xa5b6('0x6c')]>0x0){return!![];}loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x8a'));}else{loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x8b'));}}else{loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x8c'));}return![];}function mergeDataErlangB(_0x43917f){return function(_0x2d7b7f){loggerPredictive['info'](_0xa5b6('0x8d'));loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x8e'),_0x2d7b7f[_0xa5b6('0x75')]);loggerPredictive[_0xa5b6('0x81')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d7b7f[_0xa5b6('0x76')]);loggerPredictive['info'](_0xa5b6('0x8f'),_0x2d7b7f['erlangAbandonmentRate']);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x90'),_0x2d7b7f[_0xa5b6('0x78')]);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x8f'),_0x2d7b7f['erlangAbandonmentRate']);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x91'));_[_0xa5b6('0x92')](_0x43917f,_0x2d7b7f);};}function getDiff(_0x3fbab0){var _0x55af8c=moment()[_0xa5b6('0x4e')](0x0);var _0x1ec391=moment(_0x3fbab0)[_0xa5b6('0x4e')](0x0);return _0x55af8c[_0xa5b6('0x93')](_0x1ec391,_0xa5b6('0x4f'));}function ifInterval(_0x53787e,_0x103b7a){if(_[_0xa5b6('0x43')](_0x103b7a)){return![];}return getDiff(_0x103b7a)<_0x53787e*0x3c;}function freeVariablesPredictive(_0x4d4206){if(isNotNull(_0x4d4206)){if(!_[_0xa5b6('0x43')](_0x4d4206['startProgressive'])){_0x4d4206['startProgressive']=undefined;loggerPredictive[_0xa5b6('0x81')](_0x4d4206[_0xa5b6('0x46')],_0xa5b6('0x94'));}if(!_['isUndefined'](_0x4d4206['startPredictive'])){_0x4d4206['startPredictive']=undefined;loggerPredictive[_0xa5b6('0x81')](_0x4d4206[_0xa5b6('0x46')],_0xa5b6('0x95'));}if(!_[_0xa5b6('0x43')](_0x4d4206[_0xa5b6('0x96')])){clearInterval(_0x4d4206[_0xa5b6('0x96')]);_0x4d4206['handlePredictive']=undefined;loggerPredictive[_0xa5b6('0x81')](_0x4d4206['name'],_0xa5b6('0x97'));}}}function erlangb(_0x3084ac,_0x420b17){if(_0x420b17===0x0){return 0x0;}var _0x133cb4=0x1;for(var _0x2fa3e1=0x1;_0x2fa3e1<=_0x420b17;_0x2fa3e1+=0x1){_0x133cb4=0x1+_0x133cb4*_0x2fa3e1/_0x3084ac;}return 0x1/_0x133cb4;}function isVoiceQueueOutbound(_0x32d2c7){return _0x32d2c7==='outbound';}function isNotPreview(_0x384843){return _0x384843!=='preview';}function isCampaignIvr(_0x4501aa){return _0x4501aa===_0xa5b6('0x7f');}function getCallerId(_0x511746,_0x311bf7,_0x2def1d){if(!_[_0xa5b6('0x43')](_0x2def1d)&&typeof _0x2def1d===_0xa5b6('0x98')&&!_[_0xa5b6('0x4c')](_0x2def1d)){if(!_[_0xa5b6('0x43')](_0x311bf7)&&typeof _0x311bf7===_0xa5b6('0x98')&&!_[_0xa5b6('0x4c')](_0x311bf7)){return util[_0xa5b6('0x7c')](_0xa5b6('0x99'),_0x311bf7,_0x2def1d);}return util['format']('\x22%s\x22\x20<%s>',_0x2def1d,_0x2def1d);}if(!_[_0xa5b6('0x43')](_0x511746)&&typeof _0x511746===_0xa5b6('0x98')&&!_[_0xa5b6('0x4c')](_0x511746)){return _0x511746;}return _0xa5b6('0x9a');}function loggerCatchQueueSummary(_0xee73e0,_0x11d57c){return function(_0x91ddd3){freeVariablesPredictive(_0x11d57c);emitVoiceQueueSummary(_0x11d57c);emitCampaignSummary(_0x11d57c);loggerSyncQueueSummary[_0xa5b6('0x9b')](_0xee73e0,util[_0xa5b6('0x9c')](_0x91ddd3,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4a31b7,_0x24c37b){return function(_0x29f8bb){loggerPredictive[_0xa5b6('0x9d')](_0x24c37b[_0xa5b6('0x46')],_0x4a31b7);loggerPredictive[_0xa5b6('0x9d')](_0x29f8bb[_0xa5b6('0x9e')]);freeVariablesPredictive(_0x24c37b);};}function loggerCatch(_0x51aadd){return function(_0x49d17f){logger[_0xa5b6('0x9d')](_0x51aadd,util['inspect'](_0x49d17f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5e0ab1){return _0x5e0ab1&&!_[_0xa5b6('0x43')](_0x5e0ab1)&&_0x5e0ab1[_0xa5b6('0x9f')]>0x0;}function decremetOriginate(_0x3a89ef){if(!_['isUndefined'](_0x3a89ef)&&_0x3a89ef!==null){if(typeof _0x3a89ef[_0xa5b6('0x74')]!==_0xa5b6('0xa0')){if(_0x3a89ef['originated']>0x0){_0x3a89ef[_0xa5b6('0x74')]-=0x1;}else{logger[_0xa5b6('0x9d')](_0xa5b6('0xa1'));}}}else{logger[_0xa5b6('0x9d')](_0xa5b6('0xa2'));}}function checkContactLowerLimitOriginate(_0x598914,_0x1ceb24,_0x36e7ce){if(_0x1ceb24>_0x36e7ce){for(var _0x106fd5=0x0;_0x106fd5<_0x1ceb24-_0x36e7ce;_0x106fd5+=0x1){decremetOriginate(_0x598914);}}}function loggerGetContactDialer(_0x482a73,_0x10f254,_0x145149){return function(_0x4c09fd){checkContactLowerLimitOriginate(_0x10f254,_0x145149,0x0);logger['error'](_0x482a73,util[_0xa5b6('0x9c')](_0x4c09fd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2aa7db){return function(_0x35fb70){if(isNotNull(_0x35fb70)&&isNotNull(_0x35fb70[0x0])){if(_0x35fb70[0x0][_0xa5b6('0xa3')]>0x0){_0x2aa7db[_0xa5b6('0x44')]=_0xa5b6('0xa4');logger[_0xa5b6('0x81')]('[getContactDialer2][ReScheduled]'+_0x2aa7db[_0xa5b6('0x46')],_0x35fb70[0x0][_0xa5b6('0xa3')],_0xa5b6('0xa5'));}else{_0x2aa7db[_0xa5b6('0x44')]=_0xa5b6('0xa6');logger[_0xa5b6('0x81')]('[getContactDialer2][Empty]'+_0x2aa7db[_0xa5b6('0x46')]);}}};}function notSendMessagesQueue(_0x4570e1){if(_0x4570e1[_0xa5b6('0xa7')]){freeVariablesPredictive(_0x4570e1);if(_0x4570e1[_0xa5b6('0x74')]===0x0&&_0x4570e1['talking']===0x0&&_0x4570e1[_0xa5b6('0x5a')]===0x0&&(_0x4570e1[_0xa5b6('0x53')]||0x0)===0x0){_0x4570e1[_0xa5b6('0xa7')]=![];_0x4570e1[_0xa5b6('0x52')]=0x0;_0x4570e1['message']=_0xa5b6('0xa8');loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x4570e1[_0xa5b6('0x46')],_0xa5b6('0xa9'));}else{_0x4570e1[_0xa5b6('0x44')]=_0xa5b6('0xaa');loggerSyncQueueSummary[_0xa5b6('0x9b')](_0xa5b6('0xab'),_0x4570e1[_0xa5b6('0x46')],_0xa5b6('0xac'));}emitVoiceQueueSummary(_0x4570e1);}}function notSendMessagesCampaign(_0x129136){if(_0x129136['sendMessageOneNotActive']){if(_0x129136[_0xa5b6('0x74')]===0x0){_0x129136[_0xa5b6('0xa7')]=![];_0x129136['message']=_0xa5b6('0xa8');loggerSyncQueueSummary[_0xa5b6('0x9b')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x129136[_0xa5b6('0x46')],'is\x20not\x20active');}else{_0x129136['message']=_0xa5b6('0xaa');loggerSyncQueueSummary[_0xa5b6('0x9b')](_0xa5b6('0xad'),_0x129136[_0xa5b6('0x46')],_0xa5b6('0xac'));}emitCampaignSummary(_0x129136);}}function createObjHistory(_0x1c4a27,_0x5ccac8,_0x13fa7a,_0xf80ab1,_0x53adc2){_0x1c4a27['message']=_0x13fa7a;var _0x28b172=new Action(_0x1c4a27,_0x5ccac8);var _0x174ac0=new History(_0x28b172);_0x174ac0[_0xa5b6('0xae')]=_0xf80ab1;_0x174ac0['statedesc']=_0x53adc2;_0x174ac0['endtime']=_0x28b172[_0xa5b6('0xaf')];return _0x174ac0;}Dialer[_0xa5b6('0xb0')]['loopClearZombieChannels']=function(){var _0x1cb313=this;setInterval(function(){_0x1cb313['clearZombieChannels'](_0x1cb313[_0xa5b6('0x24')],'[uniqueid]');_0x1cb313[_0xa5b6('0xb1')](_0x1cb313[_0xa5b6('0xb2')],_0xa5b6('0xb3'));},0x32c8);};Dialer[_0xa5b6('0xb0')]['clearZombieChannels']=function(_0x4922a0,_0x14f0b4){var _0x5777c0=this;for(var _0x24f891 in _0x4922a0){if(typeof _0x4922a0[_0x24f891]!==_0xa5b6('0xa0')){this[_0xa5b6('0xb4')]['enqueue'](function(){if(!_[_0xa5b6('0xb5')](_0x4922a0[_0x24f891])){return ami[_0xa5b6('0xb6')]({'action':_0xa5b6('0xb7'),'channel':_0x4922a0[_0x24f891][_0xa5b6('0xb8')]})[_0xa5b6('0xb9')](function(_0x30e414){if(_0x30e414['message']===_0xa5b6('0xba')){setTimeout(function(){if(_0x4922a0[_0x24f891]&&_0x4922a0[_0x24f891][_0xa5b6('0xbb')]!==_0xa5b6('0x7f')){_0x5777c0['updateOriginated'](_0x5777c0[_0xa5b6('0x1e')][_0x4922a0[_0x24f891][_0xa5b6('0xbc')]]);logger[_0xa5b6('0x9d')](_0xa5b6('0xbd'),_0x14f0b4,_0x24f891,_0x4922a0[_0x24f891][_0xa5b6('0xbc')]);delete _0x4922a0[_0x24f891];}if(_0x4922a0[_0x24f891]&&_0x4922a0[_0x24f891][_0xa5b6('0xbb')]===_0xa5b6('0x7f')){_0x5777c0[_0xa5b6('0xbe')](_0x5777c0[_0xa5b6('0x1f')][_0x4922a0[_0x24f891][_0xa5b6('0xbc')]]);logger['error'](_0xa5b6('0xbf'),_0x14f0b4,_0x24f891,_0x4922a0[_0x24f891][_0xa5b6('0xbc')]);delete _0x4922a0[_0x24f891];}},0x2328);}});}});}}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xc0')]=function(_0x2a35a9){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopper[_0xa5b6('0xc0')](_0x2a35a9))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xc2')));};Dialer[_0xa5b6('0xb0')]['checkIsBlackList']=function(_0x597cbd){return Promise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0x597cbd))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xc3')));};Dialer[_0xa5b6('0xb0')]['verifyAdditionalPhones']=function(_0x40246d,_0x2ddda3,_0x471378){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xa5b6('0xc4')](_0x40246d,_0x2ddda3,_0x471378))['catch'](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer['prototype'][_0xa5b6('0xc5')]=function(_0x37e81c,_0x1bea31,_0x27f0b4){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopperAdditionalPhone[_0xa5b6('0xc5')](_0x37e81c,_0x1bea31,_0x27f0b4))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xc6')));};Dialer[_0xa5b6('0xb0')]['checkIsBlackListIvr']=function(_0x554afb){return Promise[_0xa5b6('0xc1')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x554afb))['catch'](loggerCatch(_0xa5b6('0xc7')));};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xc8')]=function(_0x391752){return Promise[_0xa5b6('0xc1')]()['then'](cmHopperHistory['avgHandleTime'](_0x391752))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer['prototype'][_0xa5b6('0xc9')]=function(_0x3d78a8){return Promise['resolve']()['then'](cmHopper[_0xa5b6('0xc9')](_0x3d78a8))[_0xa5b6('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer['prototype'][_0xa5b6('0xca')]=function(_0x1f6d87,_0x2c0391,_0x13f8ea){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopper[_0xa5b6('0xca')](_0x1f6d87,_0x2c0391,_0x13f8ea))['catch'](loggerCatch(_0xa5b6('0xcb')));};Dialer[_0xa5b6('0xb0')]['getContactDialer']=function(_0x5f5ab2,_0x2230f8,_0x275e51,_0x4bfc4a,_0xe3ff2){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopper['getContactDialer'](_0x5f5ab2,_0x2230f8,_0x275e51,_0x4bfc4a))[_0xa5b6('0xb9')](function(_0x3e0d17){_0xe3ff2[_0xa5b6('0xcc')]-=_0x275e51;_0xe3ff2[_0xa5b6('0xcc')]=_0xe3ff2['temp']>0x0?_0xe3ff2[_0xa5b6('0xcc')]:0x0;loggerCatch(_0xa5b6('0xcd'))(_0x3e0d17);});};Dialer['prototype'][_0xa5b6('0xce')]=function(_0x231ff0,_0x4c63d6,_0x316e24,_0x552afa){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopper['getContactDialerIvr'](_0x231ff0,_0x4c63d6,_0x316e24))[_0xa5b6('0xb9')](function(_0x441b9a){_0x552afa[_0xa5b6('0xcc')]-=_0x4c63d6;_0x552afa[_0xa5b6('0xcc')]=_0x552afa[_0xa5b6('0xcc')]>0x0?_0x552afa[_0xa5b6('0xcc')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x441b9a);});};Dialer['prototype'][_0xa5b6('0xcf')]=function(_0x2a6e16){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](voiceQueueRt['getVoiceQueueRtPauses'](_0x2a6e16))[_0xa5b6('0xb9')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xd0')]=function(_0x5bd209){return Promise['resolve']()[_0xa5b6('0x41')](cmHopper[_0xa5b6('0xd0')](_0x5bd209))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xd1')));};Dialer['prototype'][_0xa5b6('0xd2')]=function(_0xdeb27b){return Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](cmHopperHistory['createHistory'](_0xdeb27b))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xd3')));};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xbe')]=function(_0x35271c){if(!_[_0xa5b6('0x43')](_0x35271c)&&_0x35271c!==null){if(typeof _0x35271c['originated']!==_0xa5b6('0xa0')){if(_0x35271c['originated']>0x0){_0x35271c['originated']-=0x1;}else{logger[_0xa5b6('0x9d')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xd4')]=function(_0x11046e,_0x353577){var _0x40a8c8=this;return function(_0xbb7d4d){_0x40a8c8[_0xa5b6('0xbe')](_0x353577);logger[_0xa5b6('0x9d')](_0x11046e,util[_0xa5b6('0x9c')](_0xbb7d4d,{'showHidden':![],'depth':null}));};};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xd5')]=function(_0x38c923,_0x377a79,_0x18227d){var _0x405142={'state':0x19,'statedesc':_0xa5b6('0xd6')};this['updateOriginated'](_0x377a79);this['saveInDb'](_['merge'](_0x405142,_['pick'](_0x18227d,[_0xa5b6('0xd7'),_0xa5b6('0xd8'),_0xa5b6('0xd9'),_0xa5b6('0xda'),_0xa5b6('0xdb')])),_0xa5b6('0xdc'),'[emptyContact]');logger[_0xa5b6('0x9d')](_0x38c923);};Dialer[_0xa5b6('0xb0')]['isSuccess']=function(_0x4f4525){return _0x4f4525==='Success';};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xdd')]=function(_0x300d88){return!_['isUndefined'](_0x300d88)&&_0x300d88&&!_[_0xa5b6('0x43')](_0x300d88['name'])&&!_['isUndefined'](_0x300d88[_0xa5b6('0x7a')])&&_0x300d88[_0xa5b6('0x7a')]&&(this[_0xa5b6('0x21')][util[_0xa5b6('0x7c')](_0xa5b6('0xde'),_0x300d88[_0xa5b6('0x46')])][_0xa5b6('0xb7')]===_0xa5b6('0xdf')||this[_0xa5b6('0x21')][util[_0xa5b6('0x7c')](_0xa5b6('0xde'),_0x300d88['name'])][_0xa5b6('0xb7')]===_0xa5b6('0xe0'));};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xe1')]=function(_0x2be4f4,_0x17863a,_0x499d11){this[_0xa5b6('0xd2')](_0x2be4f4)['catch'](loggerCatch(_0x17863a));this[_0xa5b6('0xd0')](_0x2be4f4)[_0xa5b6('0xb9')](loggerCatch(_0x499d11));};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x3a')]=function(_0x5366dd){var _0x238c77=this;var _0x4931f1=this['uniqueId'][_0x5366dd['uniqueid']];var _0x29438e;if(!_['isNil'](_0x5366dd)&&!_[_0xa5b6('0xb5')](_0x5366dd[_0xa5b6('0xe2')])&&!_[_0xa5b6('0xb5')](_0x5366dd[_0xa5b6('0xe2')]['amdstatus'])&&_0x5366dd[_0xa5b6('0xe3')]===_0xa5b6('0xe4')&&_0x4931f1){if(_0x4931f1[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')&&this[_0xa5b6('0x1e')][_0x4931f1['queue']]['dialAMDActive']&&_0x5366dd['value']===_0xa5b6('0xe5')){delete this[_0xa5b6('0x24')][_0x5366dd[_0xa5b6('0xe6')]];this[_0xa5b6('0xbe')](this['voiceQueues'][_0x4931f1[_0xa5b6('0xbc')]]);this[_0xa5b6('0x1e')][_0x4931f1[_0xa5b6('0xbc')]][_0xa5b6('0x62')]+=0x1;this[_0xa5b6('0x1e')][_0x4931f1['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x29438e=new Hangup(_0x4931f1,_0x5366dd);_0x29438e[_0xa5b6('0xae')]=0x12;_0x29438e['statedesc']='HangupInAMD';_0x29438e[_0xa5b6('0xe7')]='AMD';ami[_0xa5b6('0xe8')](_0xa5b6('0xe9'),ut['buildObj'](_0x29438e,_0xa5b6('0xea')));this['saveInDb'](_0x29438e,_0xa5b6('0xeb'),'[syncHangupInAMD]');}if(_0x4931f1[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')&&this[_0xa5b6('0x1e')][_0x4931f1[_0xa5b6('0xbc')]]['dialAMDActive']&&_0x5366dd[_0xa5b6('0xec')]==='MACHINE'){return new Promise(function(_0x5817f3,_0x67850){delete _0x238c77[_0xa5b6('0x24')][_0x5366dd[_0xa5b6('0xe6')]];_0x238c77[_0xa5b6('0xbe')](_0x238c77['voiceQueues'][_0x4931f1[_0xa5b6('0xbc')]]);_0x238c77[_0xa5b6('0x1e')][_0x4931f1[_0xa5b6('0xbc')]][_0xa5b6('0x62')]+=0x1;_0x238c77[_0xa5b6('0x1e')][_0x4931f1[_0xa5b6('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2564d8=_0x238c77[_0xa5b6('0x1e')][_0x4931f1['queue']];var _0x3d7b4d=new Hangup(_0x4931f1,_0x5366dd);_0x3d7b4d[_0xa5b6('0xae')]=0x13;_0x3d7b4d['statedesc']=_0xa5b6('0xed');_0x3d7b4d['membername']=_0xa5b6('0xee');_0x3d7b4d[_0xa5b6('0xef')]+=0x1;_0x3d7b4d[_0xa5b6('0xf0')]+=0x1;_0x3d7b4d['amd']=!![];ami['emit'](_0xa5b6('0xe9'),ut[_0xa5b6('0xf1')](_0x3d7b4d,'amd'));_0x238c77[_0xa5b6('0xd2')](_0x3d7b4d)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xf2')));if(_0x3d7b4d['countbusyretry']+_0x3d7b4d['countcongestionretry']+_0x3d7b4d[_0xa5b6('0xf3')]+_0x3d7b4d[_0xa5b6('0xf4')]+_0x3d7b4d['countdropretry']+_0x3d7b4d[_0xa5b6('0xf5')]+_0x3d7b4d[_0xa5b6('0xef')]+_0x3d7b4d['countagentrejectretry']>=_0x2564d8['dialGlobalMaxRetry']){_0x238c77[_0xa5b6('0xf6')](_0x3d7b4d,_0x5817f3,_0x67850,'reason19\x20machine....');}else{if(_0x3d7b4d[_0xa5b6('0xef')]>=_0x2564d8[_0xa5b6('0xf7')]){_0x238c77[_0xa5b6('0xf8')](_0x3d7b4d,_0x5817f3,_0x67850,_0xa5b6('0xf9'));}else{_0x238c77[_0xa5b6('0xc9')]({'active':![],'countmachineretry':_0x3d7b4d[_0xa5b6('0xef')],'scheduledat':moment()[_0xa5b6('0xfa')](_0x2564d8['dialMachineRetryFrequency'],_0xa5b6('0xfb'))['format'](_0xa5b6('0xfc')),'ContactId':_0x3d7b4d[_0xa5b6('0xd7')],'ListId':_0x3d7b4d['ListId'],'VoiceQueueId':_0x3d7b4d[_0xa5b6('0xda')]||undefined,'CampaignId':_0x3d7b4d['CampaignId']||undefined})[_0xa5b6('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x5817f3({'reschedule':0x1});}}});}if(_0x4931f1[_0xa5b6('0xbb')]===_0xa5b6('0x7f')&&this['campaigns'][_0x4931f1[_0xa5b6('0xbc')]][_0xa5b6('0xfd')]&&_0x5366dd['value']==='HANGUP'){delete this['uniqueId'][_0x5366dd['uniqueid']];this[_0xa5b6('0xbe')](this[_0xa5b6('0x1f')][_0x4931f1[_0xa5b6('0xbc')]]);_0x29438e=new Hangup(_0x4931f1,_0x5366dd);_0x29438e['state']=0x12;_0x29438e[_0xa5b6('0xfe')]=_0xa5b6('0xff');_0x29438e[_0xa5b6('0xe7')]=_0xa5b6('0xee');ami[_0xa5b6('0xe8')](_0xa5b6('0xe9'),ut[_0xa5b6('0xf1')](_0x29438e,_0xa5b6('0xea')));this[_0xa5b6('0xe1')](_0x29438e,_0xa5b6('0x100'),'[syncHangupInAMDIvr]');}if(_0x4931f1[_0xa5b6('0xbb')]===_0xa5b6('0x7f')&&this['campaigns'][_0x4931f1['queue']][_0xa5b6('0xfd')]&&_0x5366dd[_0xa5b6('0xec')]===_0xa5b6('0x101')){return new Promise(function(_0x391f91,_0x147a23){delete _0x238c77['uniqueId'][_0x5366dd[_0xa5b6('0xe6')]];_0x238c77['updateOriginated'](_0x238c77[_0xa5b6('0x1f')][_0x4931f1['queue']]);_0x238c77[_0xa5b6('0x1f')][_0x4931f1[_0xa5b6('0xbc')]][_0xa5b6('0x62')]+=0x1;_0x238c77[_0xa5b6('0x1f')][_0x4931f1[_0xa5b6('0xbc')]][_0xa5b6('0x61')]+=0x1;var _0x3a32a=_0x238c77[_0xa5b6('0x1f')][_0x4931f1[_0xa5b6('0xbc')]];var _0x22afc6=new Hangup(_0x4931f1,_0x5366dd);_0x22afc6[_0xa5b6('0xae')]=0x13;_0x22afc6['statedesc']='Machine';_0x22afc6['membername']=_0xa5b6('0xee');_0x22afc6[_0xa5b6('0xef')]+=0x1;_0x22afc6[_0xa5b6('0xf0')]+=0x1;_0x22afc6[_0xa5b6('0xea')]=!![];ami[_0xa5b6('0xe8')](_0xa5b6('0xe9'),ut[_0xa5b6('0xf1')](_0x22afc6,'amd'));_0x238c77[_0xa5b6('0xd2')](_0x22afc6)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x22afc6['countbusyretry']+_0x22afc6[_0xa5b6('0x102')]+_0x22afc6[_0xa5b6('0xf3')]+_0x22afc6[_0xa5b6('0xf4')]+_0x22afc6[_0xa5b6('0x103')]+_0x22afc6[_0xa5b6('0xf5')]+_0x22afc6[_0xa5b6('0xef')]+_0x22afc6[_0xa5b6('0x104')]>=_0x3a32a[_0xa5b6('0x105')]){_0x238c77[_0xa5b6('0xf6')](_0x22afc6,_0x391f91,_0x147a23,_0xa5b6('0x106'));}else{if(_0x22afc6[_0xa5b6('0xef')]>=_0x3a32a[_0xa5b6('0xf7')]){_0x238c77[_0xa5b6('0xf8')](_0x22afc6,_0x391f91,_0x147a23,'reason\x2019\x20machine....');}else{_0x238c77[_0xa5b6('0xc9')]({'active':![],'countmachineretry':_0x22afc6[_0xa5b6('0xef')],'scheduledat':moment()[_0xa5b6('0xfa')](_0x3a32a[_0xa5b6('0x107')],_0xa5b6('0xfb'))[_0xa5b6('0x7c')](_0xa5b6('0xfc')),'ContactId':_0x22afc6['ContactId'],'ListId':_0x22afc6[_0xa5b6('0xd8')],'VoiceQueueId':_0x22afc6[_0xa5b6('0xda')]||undefined,'CampaignId':_0x22afc6[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch('[rescheduleContact][Machine]'));_0x391f91({'reschedule':0x1});}}});}}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x37')]=function(_0x255e4a){var _0x16ec19=this[_0xa5b6('0x24')][_0x255e4a[_0xa5b6('0xe6')]];var _0x4016c3;if(_0x16ec19&&_0x16ec19[_0xa5b6('0xbb')]===_0xa5b6('0x7f')){delete this[_0xa5b6('0x24')][_0x255e4a[_0xa5b6('0xe6')]];this[_0xa5b6('0xbe')](this[_0xa5b6('0x1f')][_0x16ec19[_0xa5b6('0xbc')]]);this[_0xa5b6('0x1f')][_0x16ec19[_0xa5b6('0xbc')]][_0xa5b6('0x108')]+=0x1;_0x4016c3=new Hangup(_0x16ec19,_0x255e4a);this[_0xa5b6('0xd2')](_0x4016c3)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x109')));this[_0xa5b6('0xd0')](_0x4016c3)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x10a')));}if(_0x16ec19&&_0x16ec19[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')&&isNotNull(this['voiceQueues'][_0x16ec19[_0xa5b6('0xbc')]][_0xa5b6('0x10b')])){delete this[_0xa5b6('0x24')][_0x255e4a['uniqueid']];this[_0xa5b6('0xbe')](this['voiceQueues'][_0x16ec19['queue']]);this[_0xa5b6('0x1e')][_0x16ec19['queue']][_0xa5b6('0x62')]+=0x1;this['voiceQueues'][_0x16ec19['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x4016c3=new Hangup(_0x16ec19,_0x255e4a);_0x4016c3[_0xa5b6('0xae')]=0x10;_0x4016c3['statedesc']=_0xa5b6('0x10c');_0x4016c3[_0xa5b6('0xe7')]=_0xa5b6('0x10d');this[_0xa5b6('0xd2')](_0x4016c3)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x109')));this['moveContactManagedDialer'](_0x4016c3)['catch'](loggerCatch(_0xa5b6('0x10a')));}if(_0x16ec19&&_0x16ec19[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')&&!isNotNull(this[_0xa5b6('0x1e')][_0x16ec19['queue']][_0xa5b6('0x10b')])){delete this[_0xa5b6('0x24')][_0x255e4a[_0xa5b6('0xe6')]];this[_0xa5b6('0xbe')](this[_0xa5b6('0x1e')][_0x16ec19[_0xa5b6('0xbc')]]);this[_0xa5b6('0x1e')][_0x16ec19[_0xa5b6('0xbc')]][_0xa5b6('0x10e')]+=0x1;_0x4016c3=new Hangup(_0x16ec19,_0x255e4a);_0x4016c3[_0xa5b6('0xae')]=0xc;_0x4016c3[_0xa5b6('0xfe')]=_0x255e4a['cause-txt'];_0x4016c3['membername']=_0xa5b6('0x10f');this[_0xa5b6('0xd2')](_0x4016c3)[_0xa5b6('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xa5b6('0xd0')](_0x4016c3)['catch'](loggerCatch(_0xa5b6('0x10a')));}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x32')]=function(_0x3c7cc7){var _0x55fbb0=this['uniqueId'][_0x3c7cc7[_0xa5b6('0xe6')]];if(this[_0xa5b6('0x1e')][_0x3c7cc7['queue']]){if(_0x55fbb0&&_0x55fbb0[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')){delete this['uniqueId'][_0x3c7cc7[_0xa5b6('0xe6')]];this[_0xa5b6('0x1e')][_0x3c7cc7[_0xa5b6('0xbc')]]['outboundAnswerCallsDay']+=0x1;var _0x4d506f=new AgentComplete(_0x55fbb0,_0x3c7cc7);if(_0x3c7cc7['reason']===_0xa5b6('0x110')){_0x4d506f[_0xa5b6('0x111')]=this[_0xa5b6('0x1e')][_0x3c7cc7[_0xa5b6('0xbc')]][_0xa5b6('0x112')]&&this[_0xa5b6('0x1e')][_0x3c7cc7['queue']][_0xa5b6('0x113')]?moment()[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this['createHistory'](_0x4d506f)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x114')));this[_0xa5b6('0xd0')](_0x4d506f)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x115')));}}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x2b')]=function(_0x5c250b){if(this[_0xa5b6('0x1e')][_0x5c250b[_0xa5b6('0xbc')]]){if(this[_0xa5b6('0x24')][_0x5c250b[_0xa5b6('0xe6')]]&&this[_0xa5b6('0x24')][_0x5c250b[_0xa5b6('0xe6')]]['type']!==_0xa5b6('0x7f')){this[_0xa5b6('0xbe')](this[_0xa5b6('0x1e')][_0x5c250b[_0xa5b6('0xbc')]]);this['uniqueId'][_0x5c250b['uniqueid']]['answertime']=moment()[_0xa5b6('0x7c')](_0xa5b6('0xfc'));}}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x116')]=function(_0x8866a8,_0x48ebf4){this['createHistory'](_0x8866a8)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x114')));if(_0x48ebf4==0x0){this[_0xa5b6('0xd0')](_0x8866a8)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x117')));}};Dialer[_0xa5b6('0xb0')]['syncQueueCallerAbandon']=function(_0x44f9c4){var _0x1cb1cd=this[_0xa5b6('0x24')][_0x44f9c4[_0xa5b6('0xe6')]];var _0x55ee9a=this;var _0xd883dc=![];var _0x14faf7;var _0x3d3bcd;if(this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]]){if(_0x1cb1cd&&_0x1cb1cd[_0xa5b6('0xbb')]!==_0xa5b6('0x7f')){delete this[_0xa5b6('0x24')][_0x44f9c4[_0xa5b6('0xe6')]];this[_0xa5b6('0xbe')](this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]]);_0x1cb1cd[_0xa5b6('0x118')]=moment()['format'](_0xa5b6('0xfc'));var _0x1ce39f=new QueueCallerAbandon(_0x1cb1cd,_0x44f9c4);if(getSeconds(_0x1cb1cd[_0xa5b6('0x118')],_0x1cb1cd[_0xa5b6('0x119')])>=_0x1cb1cd[_0xa5b6('0x11a')]){this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x11b')]+=0x1;this['voiceQueues'][_0x44f9c4['queue']][_0xa5b6('0x70')]+=0x1;_0x1ce39f[_0xa5b6('0xae')]=0xa;_0x1ce39f[_0xa5b6('0xfe')]='Drop';_0x1ce39f[_0xa5b6('0x11c')]='TIMEOUT';_0x1ce39f[_0xa5b6('0x111')]=this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x112')]?moment()['format'](_0xa5b6('0xfc')):undefined;_0x1ce39f[_0xa5b6('0x103')]+=0x1;_0x1ce39f['countglobal']+=0x1;_0x14faf7=this['voiceQueues'][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x11d')];_0x3d3bcd=this['voiceQueues'][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x11e')];_0x55ee9a[_0xa5b6('0xc4')](_0x1ce39f,_0x1ce39f[_0xa5b6('0xae')],_0x1cb1cd[_0xa5b6('0x11f')])[_0xa5b6('0x41')](function(_0x51618b){_0xd883dc=_0x51618b[_0xa5b6('0x120')]==0x1;if(_0x1ce39f[_0xa5b6('0x103')]>=_0x55ee9a[_0xa5b6('0x1e')][_0x44f9c4['queue']][_0xa5b6('0x121')]){_0x55ee9a[_0xa5b6('0x116')](_0x1ce39f,_0x51618b[_0xa5b6('0x120')]);}else{_0x55ee9a['rescheduleContact']({'active':![],'countdropretry':_0x1ce39f[_0xa5b6('0x103')],'scheduledat':moment()[_0xa5b6('0xfa')](_0x55ee9a[_0xa5b6('0x1e')][_0x44f9c4['queue']]['dialDropRetryFrequency'],'minutes')[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1cb1cd[_0xa5b6('0xd7')],'ListId':_0x1cb1cd[_0xa5b6('0xd8')],'VoiceQueueId':_0x1cb1cd[_0xa5b6('0xda')]||undefined,'CampaignId':_0x1cb1cd[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x122')));var _0x5bb51e=new History(_0x1ce39f);_0x5bb51e['state']=0xa;_0x5bb51e[_0xa5b6('0xfe')]=_0xa5b6('0x123');_0x5bb51e['starttime']=moment()[_0xa5b6('0x7c')](_0xa5b6('0xfc'));_0x5bb51e[_0xa5b6('0x124')]=_0x5bb51e[_0xa5b6('0xaf')];_0x5bb51e[_0xa5b6('0x125')]=_0x1ce39f['calleridname'];_0x5bb51e[_0xa5b6('0x126')]=_0x1ce39f[_0xa5b6('0x126')];_0x55ee9a['createHistory'](_0x5bb51e)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x127')));}})[_0xa5b6('0x41')](function(){if(_0xd883dc)_0x55ee9a['swapAdditionalPhones'](_0x1ce39f,_0x14faf7,_0x3d3bcd)['then'](function(){return 0x1;});});}else{this[_0xa5b6('0x1e')][_0x44f9c4['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x44f9c4['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x1ce39f['state']=0xb;_0x1ce39f[_0xa5b6('0xfe')]='Abandoned';_0x1ce39f[_0xa5b6('0x11c')]=_0xa5b6('0x128');_0x1ce39f['countabandonedretry']+=0x1;_0x1ce39f[_0xa5b6('0xf0')]+=0x1;_0x14faf7=this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x129')];_0x3d3bcd=this[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]][_0xa5b6('0x11e')];_0x55ee9a[_0xa5b6('0xc4')](_0x1ce39f,_0x1ce39f['state'],_0x1cb1cd[_0xa5b6('0x11f')])[_0xa5b6('0x41')](function(_0x560185){if(_0x1ce39f[_0xa5b6('0xf5')]>=_0x55ee9a[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]]['dialAbandonedMaxRetry']){_0x55ee9a['queueCallerAbandonCreateState'](_0x1ce39f,_0x560185[_0xa5b6('0x120')]);}else{_0x55ee9a[_0xa5b6('0xc9')]({'active':![],'countabandonedretry':_0x1ce39f['countabandonedretry'],'scheduledat':moment()[_0xa5b6('0xfa')](_0x55ee9a[_0xa5b6('0x1e')][_0x44f9c4[_0xa5b6('0xbc')]]['dialAbandonedRetryFrequency'],_0xa5b6('0xfb'))[_0xa5b6('0x7c')](_0xa5b6('0xfc')),'ContactId':_0x1cb1cd[_0xa5b6('0xd7')],'ListId':_0x1cb1cd[_0xa5b6('0xd8')],'VoiceQueueId':_0x1cb1cd[_0xa5b6('0xda')]||undefined,'CampaignId':_0x1cb1cd[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x12a')));var _0x5db602=new History(_0x1ce39f);_0x5db602[_0xa5b6('0xae')]=0xb;_0x5db602['statedesc']='Abandoned';_0x5db602[_0xa5b6('0xaf')]=moment()['format'](_0xa5b6('0xfc'));_0x5db602[_0xa5b6('0x124')]=_0x5db602[_0xa5b6('0xaf')];_0x5db602['calleridname']=_0x1ce39f[_0xa5b6('0x125')];_0x5db602[_0xa5b6('0x126')]=_0x1ce39f[_0xa5b6('0x126')];_0x55ee9a[_0xa5b6('0xd2')](_0x5db602)[_0xa5b6('0xb9')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xa5b6('0x41')](function(){if(_0xd883dc)_0x55ee9a[_0xa5b6('0xc5')](_0x1ce39f,_0x14faf7,_0x3d3bcd)[_0xa5b6('0x41')](function(){return 0x1;});});}}}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x39')]=function(_0x3c288a){if(this[_0xa5b6('0xb2')][_0x3c288a[_0xa5b6('0xe6')]]){this[_0xa5b6('0xb2')][_0x3c288a[_0xa5b6('0xe6')]][_0xa5b6('0xb8')]=_0x3c288a['channel'];}if(this[_0xa5b6('0x24')][_0x3c288a[_0xa5b6('0xe6')]]){this[_0xa5b6('0x24')][_0x3c288a[_0xa5b6('0xe6')]][_0xa5b6('0xb8')]=_0x3c288a[_0xa5b6('0xb8')];}};Dialer['prototype'][_0xa5b6('0x3c')]=function(_0x54ad52){if(strategy[this[_0xa5b6('0x1e')][this['actions'][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]][_0xa5b6('0x51')]]===_0xa5b6('0x12c')){if(this['actions'][_0x54ad52[_0xa5b6('0x12b')]]&&_[_0xa5b6('0xb5')](this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]]['locked'])&&_0x54ad52[_0xa5b6('0xb7')]==='1'&&_0x54ad52[_0xa5b6('0x12d')]==='0'){if(this[_0xa5b6('0x20')][_0x54ad52[_0xa5b6('0x12e')]]){if(!this[_0xa5b6('0x20')][_0x54ad52[_0xa5b6('0x12e')]][_0xa5b6('0x12f')]){this['agents'][_0x54ad52[_0xa5b6('0x12e')]][_0xa5b6('0x12f')]=!![];this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0x12f')]=!![];this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]]['stateinterface']=_0x54ad52[_0xa5b6('0x12e')];}}}}else if((strategy[this[_0xa5b6('0x1e')][this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]][_0xa5b6('0x51')]]||_0xa5b6('0x1b'))===_0xa5b6('0x1b')){if(this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]]){if(this[_0xa5b6('0x20')][_0x54ad52[_0xa5b6('0x12e')]]){this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]]['stateinterface']=_0x54ad52[_0xa5b6('0x12e')];if(_[_0xa5b6('0xb5')](this['queueBooked'][this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]])){this[_0xa5b6('0x28')][this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]]=[];}this[_0xa5b6('0x28')][this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]][_0xa5b6('0x130')](_[_0xa5b6('0x92')](_[_0xa5b6('0x131')](this[_0xa5b6('0xb2')][_0x54ad52[_0xa5b6('0x12b')]],[_0xa5b6('0x132'),'stateinterface']),{'status':_0x54ad52['status'],'paused':_0x54ad52[_0xa5b6('0x12d')]}));}}}};function unlockQueueStatus(_0x25ba7d,_0x42f5ec){setTimeout(function(){if(_[_0xa5b6('0x43')](_0x25ba7d[_0xa5b6('0x133')])){loggerBooked[_0xa5b6('0x9d')](_0xa5b6('0x134'),_0x42f5ec);}_0x25ba7d[_0xa5b6('0x133')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x42f5ec,JSON[_0xa5b6('0x135')](_['pick'](_0x25ba7d,[_0xa5b6('0x46'),_0xa5b6('0x133')])));},0x1f3);}Dialer['prototype'][_0xa5b6('0x3d')]=function(_0x3c741e){var _0x267110=this;var _0x410092=_0x267110[_0xa5b6('0x1e')][_0x267110['actions'][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]];if(strategy[this[_0xa5b6('0x1e')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['queue']][_0xa5b6('0x51')]]==='roundrobin'){if(this[_0xa5b6('0xb2')][_0x3c741e['actionid']]&&this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0x12e')]){this[_0xa5b6('0x136')]['run'](this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['idHopper'],this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0x12e')])[_0xa5b6('0xb9')](function(_0x12ce44){logger[_0xa5b6('0x9d')](_0xa5b6('0x137'),util[_0xa5b6('0x9c')](_0x12ce44,{'showHidden':![],'depth':null}));})[_0xa5b6('0x138')](function(){_0x267110[_0xa5b6('0xbe')](_0x267110[_0xa5b6('0x1e')][_0x267110[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]]);_0x267110['agents'][_0x267110[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0x12e')]][_0xa5b6('0x12f')]=![];delete _0x267110[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]];unlockQueueStatus(_0x410092);});}else{this[_0xa5b6('0xbe')](this[_0xa5b6('0x1e')][this[_0xa5b6('0xb2')][_0x3c741e['actionid']][_0xa5b6('0xbc')]]);this[_0xa5b6('0xc9')]({'active':![],'ContactId':this['actions'][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xd7')],'ListId':this[_0xa5b6('0xb2')][_0x3c741e['actionid']]['ListId'],'VoiceQueueId':this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['CampaignId']||undefined})[_0xa5b6('0xb9')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]];unlockQueueStatus(_0x410092);}}else if((strategy[this[_0xa5b6('0x1e')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['queue']]['strategy']]||_0xa5b6('0x1b'))===_0xa5b6('0x1b')){var _0x262aec;if(this[_0xa5b6('0xb2')][_0x3c741e['actionid']]&&!_[_0xa5b6('0x4c')](this['queueBooked'][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]])){if(this[_0xa5b6('0x29')][_0x267110[_0xa5b6('0xb2')][_0x3c741e['actionid']][_0xa5b6('0xbc')]]){this[_0xa5b6('0x29')][_0x267110[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['queue']]=this[_0xa5b6('0x29')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]]?this[_0xa5b6('0x29')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]]['queue']]:this['queueBooked'][this[_0xa5b6('0xb2')][_0x3c741e['actionid']][_0xa5b6('0xbc')]]?this[_0xa5b6('0x28')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]][_0xa5b6('0x139')]||0x0:0x0;}this[_0xa5b6('0x28')][this[_0xa5b6('0xb2')][_0x3c741e[_0xa5b6('0x12b')]][_0xa5b6('0xbc')]][_0xa5b6('0x139')]=this[_0xa5b6('0x29')][this[_0xa5b6('0xb2')][_0x3c741e['actionid']]['queue']];for(var _0x931d50=0x0;_0x931d50=0x0;})[_0xa5b6('0xb9')](myreject(_0x9adbff)));}}else{_0x583fec[_0xa5b6('0x130')](ami[_0xa5b6('0xb6')]({'action':_0xa5b6('0x152'),'command':util[_0xa5b6('0x7c')]('iftime\x20%s,%s',_0x1c5a77,!_[_0xa5b6('0x43')](config[_0xa5b6('0x154')][_0xb79b5a])?_0xb79b5a:'')})[_0xa5b6('0x41')](function(_0x251f4b){return _0x251f4b[_0xa5b6('0x155')][_0xa5b6('0x156')](_0xa5b6('0x157'))>=0x0;})['catch'](myreject(_0x9adbff)));}Promise[_0xa5b6('0x158')](_0x583fec)[_0xa5b6('0x41')](function(_0x457309){var _0x4ca8fd=_['some'](_0x457309);if(_0x4ca8fd){return _0x155fcb(_0x4ca8fd);}else{_0x3f166b['message']=_0x34dcbc?_0xa5b6('0x159'):_0xa5b6('0x15a');return _0x9adbff(msgResponse('[ifTime][promiseAll]','Failure','Global:\x20'+_0x34dcbc+'\x20'+_0xae6f58+_0xa5b6('0x15b')+util[_0xa5b6('0x9c')](_0x1c5a77,{'showHidden':![],'depth':null})+_0xa5b6('0x15c')+_0xb79b5a));}})['catch'](function(_0x496829){return _0x9adbff(msgResponse(_0xa5b6('0x14c'),_0xa5b6('0x14d'),JSON['stringify'](_0x496829)));});});};Dialer['prototype'][_0xa5b6('0x15d')]=function(_0xb4707b){var _0x35a61d=this;return function(){switch(_0xb4707b[_0xa5b6('0x5d')]){case'progressive':freeVariablesPredictive(_0xb4707b);_0x35a61d[_0xa5b6('0x15e')](_0xb4707b,0x1);break;case _0xa5b6('0x15f'):freeVariablesPredictive(_0xb4707b);_0x35a61d['handlePower'](_0xb4707b,_0xb4707b[_0xa5b6('0x160')]);break;case _0xa5b6('0x161'):_0x35a61d[_0xa5b6('0x161')](_0xb4707b);break;case _0xa5b6('0x9'):freeVariablesPredictive(_0xb4707b);_0x35a61d[_0xa5b6('0x15e')](_0xb4707b,0x1);break;default:freeVariablesPredictive(_0xb4707b);logger[_0xa5b6('0x9d')](_0xa5b6('0x162'),_0xb4707b['name'],_0xa5b6('0x163'));}};};Dialer['prototype'][_0xa5b6('0x164')]=function(_0x3f4c5a){return Promise['resolve']()['then'](cmHopper[_0xa5b6('0x165')](_0x3f4c5a['id'],previewRecallmeReminderInterval))[_0xa5b6('0x41')](function(_0x2f9923){for(var _0x1ef753=0x0;_0x1ef753<_0x2f9923[_0xa5b6('0x9f')];_0x1ef753++){var _0x3bda54=_0x2f9923[_0x1ef753][_0xa5b6('0x166')][_0xa5b6('0x46')];if(_0x3bda54)io['to'](util[_0xa5b6('0x7c')](_0xa5b6('0x167'),_0x3bda54))['emit'](_0xa5b6('0x168'),{'hopper':_0x2f9923[_0x1ef753]});}})[_0xa5b6('0xb9')](function(){});};Dialer[_0xa5b6('0xb0')]['launchHandleIvr']=function(_0x284e4b){var _0x4c6ecb=this;return function(){_0x4c6ecb[_0xa5b6('0x169')](_0x284e4b);};};Dialer[_0xa5b6('0xb0')][_0xa5b6('0xb')]=function(_0x281940){var _0x3f5fad=this;if(isNotPreview(_0x281940['dialMethod'])){if(isVoiceQueueOutbound(_0x281940[_0xa5b6('0xbb')])&&isActive(_0x281940[_0xa5b6('0x5c')])){_0x281940['sendMessageOneNotActive']=!![];Promise[_0xa5b6('0xc1')]()['then'](checkIsLoggedIn(_0x281940,_0x281940[_0xa5b6('0x16a')]))[_0xa5b6('0x41')](checkIsActive(_0x281940,_0x281940['dialActive']))[_0xa5b6('0x41')](checkInterval(_0x281940))[_0xa5b6('0x41')](_0x3f5fad[_0xa5b6('0x146')](_0x281940))[_0xa5b6('0x41')](_0x3f5fad['checkIfTime'](_0x281940[_0xa5b6('0x16b')],_0x281940[_0xa5b6('0x16c')],_0x281940[_0xa5b6('0x46')],_0x281940))['then'](_0x3f5fad[_0xa5b6('0x14b')](_0x281940[_0xa5b6('0x4a')],_0x281940[_0xa5b6('0x16c')],_0x281940['name'],_0x281940))[_0xa5b6('0x41')](_0x3f5fad[_0xa5b6('0x15d')](_0x281940))[_0xa5b6('0xb9')](loggerCatchQueueSummary(_0xa5b6('0x16d'),_0x281940));}else{notSendMessagesQueue(_0x281940);}}else{freeVariablesPredictive(_0x281940);}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x35')]=_[_0xa5b6('0x16e')](function(){var _0x20bd03=_[_0xa5b6('0x16f')](this[_0xa5b6('0x1e')],function(_0x300fa1){return _0x300fa1[_0xa5b6('0x170')];});var _0x2ae8c3=_[_0xa5b6('0x16f')](this[_0xa5b6('0x20')],function(_0x929503){return _0x929503[_0xa5b6('0x171')]&&_0x929503[_0xa5b6('0xb7')]===_0xa5b6('0xdf');});if(_0x20bd03['length']>0x0&&_0x2ae8c3[_0xa5b6('0x9f')]>0x0){return Promise['resolve']()[_0xa5b6('0x41')](cmHopper[_0xa5b6('0x165')](_[_0xa5b6('0x172')](_0x20bd03,'id'),previewRecallmeReminderInterval,_[_0xa5b6('0x172')](_0x2ae8c3,'id')))['then'](function(_0x23baba){for(var _0x25bd25=0x0;_0x25bd25<_0x23baba[_0xa5b6('0x9f')];_0x25bd25++){var _0x68356b=_0x23baba[_0x25bd25][_0xa5b6('0x166')][_0xa5b6('0x46')];if(_0x68356b)io['to'](util[_0xa5b6('0x7c')](_0xa5b6('0x167'),_0x68356b))[_0xa5b6('0xe8')](_0xa5b6('0x168'),{'hopper':_0x23baba[_0x25bd25]});}})[_0xa5b6('0xb9')](function(_0x2c9082){logger['error'](_0xa5b6('0x164'),_0x2c9082);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xa5b6('0xb0')][_0xa5b6('0x145')]=function(){var _0x580709=this;var _0x3c9659;for(var _0x4ccffd in this[_0xa5b6('0x1f')]){if(typeof this[_0xa5b6('0x1f')][_0x4ccffd]!==_0xa5b6('0xa0')){_0x3c9659=this['campaigns'][_0x4ccffd];if(isCampaignIvr(_0x3c9659[_0xa5b6('0xbb')])&&isActive(_0x3c9659[_0xa5b6('0x7a')])){_0x3c9659['sendMessageOneNotActive']=!![];Promise[_0xa5b6('0xc1')]()[_0xa5b6('0x41')](checkIsActive(_0x3c9659,_0x3c9659['active']))[_0xa5b6('0x41')](checkInterval(_0x3c9659))[_0xa5b6('0x41')](_0x580709['checkIsTrunkReachable'](_0x3c9659))[_0xa5b6('0x41')](_0x580709[_0xa5b6('0x14a')](_0x3c9659[_0xa5b6('0x16b')],_0x3c9659[_0xa5b6('0x16c')],_0x3c9659[_0xa5b6('0x46')],_0x3c9659))[_0xa5b6('0x41')](_0x580709[_0xa5b6('0x14b')](_0x3c9659['Interval'],_0x3c9659['dialTimezone'],_0x3c9659[_0xa5b6('0x46')],_0x3c9659))['then'](_0x580709[_0xa5b6('0x173')](_0x3c9659))[_0xa5b6('0xb9')](loggerCatchQueueSummary(_0xa5b6('0x174'),_0x3c9659));}else{notSendMessagesCampaign(_0x3c9659);}}}};function getCallerIdRandom(_0x216544,_0x416e93){var _0x39fb6b;var _0x32da5c;var _0x4509f1;if(_0x416e93<=0x0){_0x416e93=0x1;}_0x39fb6b=new RegExp('\x5cw{0,'+_0x416e93+'}$');_0x32da5c=Math[_0xa5b6('0x175')](0xa,_0x416e93-0x1);_0x4509f1=Math[_0xa5b6('0x175')](0xa,_0x416e93)-0x1;return util[_0xa5b6('0x7c')]('%s',_[_0xa5b6('0x176')](_0x216544,_0x39fb6b,_[_0xa5b6('0x177')](_0x32da5c,_0x4509f1)));}function extractCalleridName(_0x2f368e){var _0x51cdb6=_0x2f368e[_0xa5b6('0x178')](/"(.*?)"/);return _0x51cdb6?_0x51cdb6[0x1]:_0x2f368e;}Dialer[_0xa5b6('0xb0')][_0xa5b6('0x179')]=function(_0x53e6ea,_0x402f82){var _0x151181=this;var _0x55b0da=uuid['v4']();this[_0xa5b6('0xb2')][_0x55b0da]=new Action(_0x53e6ea,_0x402f82,_0x55b0da);return new Promise(function(_0xff233f,_0x1d52aa){if(_['isUndefined'](_0x53e6ea)&&typeof _0x53e6ea!=='object'){return _0x1d52aa(msgResponse(_0xa5b6('0x17a'),'Failure',_0xa5b6('0x17b')));}if(_[_0xa5b6('0x43')](_0x402f82['phone'])||_0x402f82[_0xa5b6('0x17c')]===null){return _0x1d52aa(msgResponse('originate',_0xa5b6('0x14d'),_0xa5b6('0x17d')));}var _0x3cb53f={'XMD-CALLERID':_0x151181[_0xa5b6('0xb2')][_0x55b0da][_0xa5b6('0x17e')](),'XMD-AGI':_0x53e6ea[_0xa5b6('0x10b')]?util[_0xa5b6('0x7c')](_0xa5b6('0x17f'),ipAgi,_0x53e6ea[_0xa5b6('0x10b')]):'NONE','XMD-AGIAFTER':_0x53e6ea['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x53e6ea[_0xa5b6('0x112')]):_0xa5b6('0x180'),'XMD-QUEUE':_0x53e6ea[_0xa5b6('0xbb')]==='outbound'?util[_0xa5b6('0x7c')](_0xa5b6('0x181'),_0x53e6ea[_0xa5b6('0x46')],_0x53e6ea[_0xa5b6('0x182')]||'',_0x53e6ea[_0xa5b6('0x113')]?'c':'',_0x53e6ea['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x402f82['ContactId'],'XMD-CDRTYPE':_0xa5b6('0x8'),'CALLERID(all)':_0x151181[_0xa5b6('0xb2')][_0x55b0da][_0xa5b6('0x17e')](),'XMD-AMD':_0x53e6ea[_0xa5b6('0xfd')]?_0xa5b6('0x183'):'NONE','XMD-DESTINATION':_0xa5b6('0xe4')};if(_0x53e6ea['dialAMDActive']){_0x3cb53f[_0xa5b6('0x184')]=_0x53e6ea[_0xa5b6('0x185')]||0x9c4;_0x3cb53f[_0xa5b6('0x186')]=_0x53e6ea[_0xa5b6('0x187')]||0x5dc;_0x3cb53f[_0xa5b6('0x188')]=_0x53e6ea[_0xa5b6('0x189')]||0x320;_0x3cb53f[_0xa5b6('0x18a')]=_0x53e6ea[_0xa5b6('0x18b')]||0x1388;_0x3cb53f[_0xa5b6('0x18c')]=_0x53e6ea['dialAMDMinWordLength']||0x64;_0x3cb53f[_0xa5b6('0x18d')]=_0x53e6ea[_0xa5b6('0x18e')]||0x32;_0x3cb53f['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x53e6ea[_0xa5b6('0x18f')]||0x3;_0x3cb53f[_0xa5b6('0x190')]=_0x53e6ea['dialAMDSilenceThreshold']||0x100;_0x3cb53f[_0xa5b6('0x191')]=_0x53e6ea['dialAMDMaximumWordLength']||0x1388;}if(_0x53e6ea[_0xa5b6('0xbb')]==='outbound'){_0x3cb53f['XMD-VOICEQUEUEID']=_0x402f82[_0xa5b6('0xda')];}else{_0x3cb53f['XMD-CAMPAIGNID']=_0x402f82[_0xa5b6('0xdb')];}for(var _0x24cd6a in _0x402f82['Contact']){if(typeof _0x402f82[_0xa5b6('0x192')][_0x24cd6a]!==_0xa5b6('0xa0')){if(isNotNull(_0x402f82[_0xa5b6('0x192')][_0x24cd6a])&&_0x24cd6a!=='id'&&_0x24cd6a!==_0xa5b6('0x193')&&_0x24cd6a!=='createdAt'&&_0x24cd6a!==_0xa5b6('0x194')){_0x3cb53f[util['format']('%s%s',_0xa5b6('0x195'),_[_0xa5b6('0x196')](_0x24cd6a))]=_0x402f82[_0xa5b6('0x192')][_0x24cd6a];}}}var _0x51396d=_0x151181[_0xa5b6('0xdd')](_0x53e6ea[_0xa5b6('0x79')])?getCallerId(_0x53e6ea[_0xa5b6('0x79')][_0xa5b6('0x7b')],_0x53e6ea[_0xa5b6('0x5e')],_0x53e6ea['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x53e6ea['dialOriginateCallerIdNumber'],_0x53e6ea[_0xa5b6('0x197')]):_0x53e6ea[_0xa5b6('0x5f')]):getCallerId(_[_0xa5b6('0xb5')](_0x53e6ea[_0xa5b6('0x147')])?_0x53e6ea['Trunk'][_0xa5b6('0x7b')]:_0x53e6ea['TrunkBackup'][_0xa5b6('0x7b')],_0x53e6ea[_0xa5b6('0x5e')],_0x53e6ea[_0xa5b6('0x197')]>0x0?getCallerIdRandom(_0x53e6ea[_0xa5b6('0x5f')],_0x53e6ea[_0xa5b6('0x197')]):_0x53e6ea['dialOriginateCallerIdNumber']);if(_0x51396d){_0x3cb53f[_0xa5b6('0x198')]=_0x151181[_0xa5b6('0xb2')][_0x55b0da][_0xa5b6('0x199')]=extractCalleridName(_0x51396d);_0x3cb53f['XMD-ORIGINATECALLERIDNUM']=_0x402f82['phone'];}_0x53e6ea[_0xa5b6('0x19a')]=_0x3cb53f;return ami[_0xa5b6('0xb6')]({'actionid':_0x55b0da,'action':_0xa5b6('0x17a'),'channel':_0x151181[_0xa5b6('0xdd')](_0x53e6ea[_0xa5b6('0x79')])?util[_0xa5b6('0x7c')]('SIP/%s/%s%s',_0x53e6ea[_0xa5b6('0x79')][_0xa5b6('0x46')],isNotNull(_0x53e6ea[_0xa5b6('0x60')])?_0x53e6ea[_0xa5b6('0x60')][_0xa5b6('0x19b')]()||'':'',_0x53e6ea['dialCutDigit']>0x0?_0x402f82['phone']['substring'](_0x53e6ea[_0xa5b6('0x19c')]):_0x402f82[_0xa5b6('0x17c')]):util[_0xa5b6('0x7c')](_0xa5b6('0x19d'),_['isNil'](_0x53e6ea[_0xa5b6('0x147')])?_0x53e6ea[_0xa5b6('0x79')][_0xa5b6('0x46')]:_0x53e6ea[_0xa5b6('0x147')][_0xa5b6('0x46')],isNotNull(_0x53e6ea[_0xa5b6('0x60')])?_0x53e6ea[_0xa5b6('0x60')]['trim']()||'':'',_0x53e6ea[_0xa5b6('0x19c')]>0x0?_0x402f82[_0xa5b6('0x17c')][_0xa5b6('0x19e')](_0x53e6ea[_0xa5b6('0x19c')]):_0x402f82[_0xa5b6('0x17c')]),'callerid':_0x51396d,'Exten':'xcally-motion-dialer','Context':_0xa5b6('0x19f'),'Priority':'1','variable':_0x3cb53f,'timeout':(_0x53e6ea[_0xa5b6('0x1a0')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55b0da})[_0xa5b6('0x41')](function(_0x33bccb){return _0xff233f(_0x33bccb);})[_0xa5b6('0xb9')](function(_0x44bcb3){_0x53e6ea[_0xa5b6('0x69')]+=0x1;var _0x2dc4df=new History(_0x151181[_0xa5b6('0xb2')][_0x55b0da]);logger[_0xa5b6('0x9d')](util[_0xa5b6('0x7c')]('[originateError]:\x20%s',JSON[_0xa5b6('0x135')](_0x44bcb3)));_0x2dc4df[_0xa5b6('0xae')]=0xe;_0x2dc4df[_0xa5b6('0xfe')]='OriginateError';_0x2dc4df['starttime']=moment()['format'](_0xa5b6('0xfc'));_0x2dc4df[_0xa5b6('0x124')]=_0x2dc4df[_0xa5b6('0xaf')];_0x151181[_0xa5b6('0xd2')](_0x2dc4df)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1a1')));_0x151181[_0xa5b6('0xd0')](_0x2dc4df)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1a1')))['finally'](function(){delete _0x151181['actions'][_0x55b0da];return _0x1d52aa(msgResponse('originate',_0xa5b6('0x4d'),_0xa5b6('0x1a2')));});});});};Dialer[_0xa5b6('0xb0')]['syncOriginateResponse']=function(_0x1ac86b){var _0x224fcf=this[_0xa5b6('0xb2')][_0x1ac86b[_0xa5b6('0x12b')]];if(_0x224fcf){delete this[_0xa5b6('0xb2')][_0x1ac86b[_0xa5b6('0x12b')]];_0x224fcf[_0xa5b6('0x119')]=moment()[_0xa5b6('0x7c')](_0xa5b6('0xfc'));var _0x15de4d=_0x224fcf[_0xa5b6('0xbb')]==='ivr'?this[_0xa5b6('0x1f')][_0x224fcf[_0xa5b6('0xbc')]]:this['voiceQueues'][_0x224fcf[_0xa5b6('0x1a3')]()];if(!this[_0xa5b6('0x1a4')](_0x1ac86b[_0xa5b6('0x1a5')])){this[_0xa5b6('0xbe')](_0x15de4d);return this[_0xa5b6('0x1a6')](_0x224fcf,_0x15de4d,_0x1ac86b)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1a7')));}this[_0xa5b6('0x24')][_0x1ac86b['uniqueid']]=_0x224fcf;}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1a8')]=function(_0xd405ec,_0x1c8b96,_0x248b41){var _0x448a34=new History(_0x1c8b96);if(_0x448a34['countbusyretry']+_0x448a34['countcongestionretry']+_0x448a34['countnoanswerretry']+_0x448a34[_0xa5b6('0xf4')]+_0x448a34[_0xa5b6('0x103')]+_0x448a34[_0xa5b6('0xf5')]+_0x448a34[_0xa5b6('0xef')]+_0x448a34['countagentrejectretry']>=_0x248b41[_0xa5b6('0x105')]-0x1){return!![];}switch(_0xd405ec){case 0x3:if(_0x448a34[_0xa5b6('0xf3')]>=_0x248b41[_0xa5b6('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x448a34['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xa5b6('0xfa')](_0x248b41['dialNoAnswerRetryFrequency'],_0xa5b6('0xfb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x448a34['ContactId'],'ListId':_0x448a34['ListId'],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x448a34['countbusyretry']>=_0x248b41[_0xa5b6('0x1aa')]-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countbusyretry':_0x448a34[_0xa5b6('0x1ab')]+=0x1,'scheduledat':moment()[_0xa5b6('0xfa')](_0x248b41[_0xa5b6('0x1ac')],_0xa5b6('0xfb'))[_0xa5b6('0x7c')](_0xa5b6('0xfc')),'ContactId':_0x448a34[_0xa5b6('0xd7')],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1ad')));break;case 0x8:if(_0x448a34['countcongestionretry']>=_0x248b41['dialCongestionMaxRetry']-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countcongestionretry':_0x448a34[_0xa5b6('0x102')]+=0x1,'scheduledat':moment()['add'](_0x248b41['dialCongestionRetryFrequency'],_0xa5b6('0xfb'))[_0xa5b6('0x7c')](_0xa5b6('0xfc')),'ContactId':_0x448a34['ContactId'],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1ae')));break;case 0x0:if(_0x448a34[_0xa5b6('0xf4')]>=_0x248b41['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xa5b6('0xc9')]({'active':![],'countnosuchnumberretry':_0x448a34[_0xa5b6('0xf4')]+=0x1,'scheduledat':moment()[_0xa5b6('0xfa')](_0x248b41['dialNoSuchNumberRetryFrequency'],_0xa5b6('0xfb'))[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x448a34[_0xa5b6('0xd7')],'ListId':_0x448a34['ListId'],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})['catch'](loggerCatch(_0xa5b6('0x1af')));}break;case 0xa:if(_0x448a34['countdropretry']>=_0x248b41['dialDropMaxRetry']-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countdropretry':_0x448a34[_0xa5b6('0x103')]+=0x1,'scheduledat':moment()['add'](_0x248b41[_0xa5b6('0x11d')],_0xa5b6('0xfb'))[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x448a34['ContactId'],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x448a34[_0xa5b6('0xf5')]>=_0x248b41[_0xa5b6('0x1b0')]-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countabandonedretry':_0x448a34['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x248b41[_0xa5b6('0x129')],_0xa5b6('0xfb'))['format'](_0xa5b6('0xfc')),'ContactId':_0x448a34[_0xa5b6('0xd7')],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x12a')));break;case 0x13:if(_0x448a34[_0xa5b6('0xef')]>=_0x248b41[_0xa5b6('0xf7')]-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countmachineretry':_0x448a34[_0xa5b6('0xef')]+=0x1,'scheduledat':moment()[_0xa5b6('0xfa')](_0x248b41[_0xa5b6('0x107')],_0xa5b6('0xfb'))[_0xa5b6('0x7c')](_0xa5b6('0xfc')),'ContactId':_0x448a34[_0xa5b6('0xd7')],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1b1')));break;case 0x14:if(_0x448a34[_0xa5b6('0x104')]>=_0x248b41[_0xa5b6('0x1b2')]-0x1){return!![];}this[_0xa5b6('0xc9')]({'active':![],'countagentrejectretry':_0x448a34[_0xa5b6('0x104')]+=0x1,'scheduledat':moment()[_0xa5b6('0xfa')](_0x248b41['dialAgentRejectRetryFrequency'],_0xa5b6('0xfb'))[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x448a34['ContactId'],'ListId':_0x448a34[_0xa5b6('0xd8')],'VoiceQueueId':_0x448a34[_0xa5b6('0xda')]||undefined,'CampaignId':_0x448a34[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1b3')));break;default:return!![];}};Dialer['prototype'][_0xa5b6('0x1a6')]=function(_0x341e70,_0x2b0a39,_0x43748b){var _0x233fe8=this;var _0x5187e4=new History(_0x341e70);var _0x153fd8=![];var _0x2938f4;var _0x28899e;return new Promise(function(_0x25de65,_0x20aeb4){if(_[_0xa5b6('0x43')](_0x2b0a39)&&typeof _0x2b0a39!=='object'){return _0x20aeb4(msgResponse(_0xa5b6('0x1b4'),_0xa5b6('0x14d'),_0xa5b6('0x1b5')));}if(_[_0xa5b6('0x43')](_0x43748b)&&typeof _0x43748b!=='object'){return _0x20aeb4(msgResponse(_0xa5b6('0x1b4'),_0xa5b6('0x14d'),'evt\x20is\x20undefine'));}_0x233fe8[_0xa5b6('0xc4')](_0x5187e4,_0x43748b['reason'],_0x2b0a39)[_0xa5b6('0x41')](function(_0x560364){if(_0x560364['additional']==0x1)_0x153fd8=!![];switch(_0x43748b[_0xa5b6('0x1b6')]){case'0':_0x2b0a39['outboundNoSuchCallsDay']+=0x1;_0x5187e4[_0xa5b6('0xae')]=0x0;_0x5187e4[_0xa5b6('0xfe')]='NoSuchNumber';_0x5187e4['countnosuchnumberretry']+=0x1;_0x5187e4[_0xa5b6('0xf0')]+=0x1;ami[_0xa5b6('0xe8')](_0xa5b6('0x1b7'),ut[_0xa5b6('0xf1')](_0x341e70,_0xa5b6('0x1b8')));_0x2938f4=_0x2b0a39[_0xa5b6('0x1b9')];_0x28899e=_0x2b0a39['callAdditionalPhoneAfterMin'];_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xf2')));if(_0x233fe8[_0xa5b6('0x1a8')](0x0,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4[_0xa5b6('0xf4')]>=_0x2b0a39[_0xa5b6('0x1ba')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1bb'));}else{_0x233fe8['stateGlobal'](_0x5187e4,_0x25de65,_0x20aeb4,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2b0a39['outboundNoAnswerCallsDay']+=0x1;_0x5187e4[_0xa5b6('0xae')]=0x3;_0x5187e4['statedesc']=_0xa5b6('0x1bc');_0x5187e4[_0xa5b6('0xf3')]+=0x1;_0x5187e4[_0xa5b6('0xf0')]+=0x1;var _0x25b412=ut[_0xa5b6('0x1bd')](_0x341e70,_0x2b0a39);ami[_0xa5b6('0xe8')]('custom:agentnoanswer',_0x25b412);_0x2938f4=_0x2b0a39['dialNoAnswerRetryFrequency'];_0x28899e=_0x2b0a39[_0xa5b6('0x11e')];_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)['catch'](loggerCatch(_0xa5b6('0x1be')));if(_0x233fe8['checkRetriveMax'](0x3,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4[_0xa5b6('0xf3')]>=_0x2b0a39[_0xa5b6('0x1a9')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,'reason\x203\x20ringing\x20no\x20answer');}else{_0x233fe8['stateGlobal'](_0x5187e4,_0x25de65,_0x20aeb4,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x2b0a39['outboundBusyCallsDay']+=0x1;_0x5187e4['state']=0x5;_0x5187e4[_0xa5b6('0xfe')]=_0xa5b6('0x1bf');_0x5187e4['countbusyretry']+=0x1;_0x5187e4[_0xa5b6('0xf0')]+=0x1;ami[_0xa5b6('0xe8')](_0xa5b6('0x1c0'),ut[_0xa5b6('0xf1')](_0x341e70,_0xa5b6('0x1c1')));_0x2938f4=_0x2b0a39[_0xa5b6('0x1ac')];_0x28899e=_0x2b0a39[_0xa5b6('0x11e')];_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1c2')));if(_0x233fe8[_0xa5b6('0x1a8')](0x5,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4['countbusyretry']>=_0x2b0a39[_0xa5b6('0x1aa')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,'reason\x205\x20busy');}else{_0x233fe8[_0xa5b6('0xf6')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1c3'));}}break;case'8':_0x2b0a39[_0xa5b6('0x64')]+=0x1;_0x5187e4[_0xa5b6('0xae')]=0x8;_0x5187e4[_0xa5b6('0xfe')]='Congestion';_0x5187e4['countcongestionretry']+=0x1;_0x5187e4['countglobal']+=0x1;_0x2938f4=_0x2b0a39[_0xa5b6('0x1c4')];_0x28899e=_0x2b0a39['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0xa5b6('0xf1')](_0x341e70,_0xa5b6('0x1c5')));_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x233fe8['checkRetriveMax'](0x8,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4[_0xa5b6('0x102')]>=_0x2b0a39[_0xa5b6('0x1c6')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,'reason\x208\x20congestion');}else{_0x233fe8[_0xa5b6('0xf6')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1c7'));}}break;case'11':_0x2b0a39[_0xa5b6('0x1c8')]+=0x1;_0x5187e4[_0xa5b6('0xae')]=0xb;_0x5187e4[_0xa5b6('0xfe')]='Abandoned';_0x5187e4['countabandonedretry']+=0x1;_0x5187e4['countglobal']+=0x1;_0x2938f4=_0x2b0a39[_0xa5b6('0x129')];_0x28899e=_0x2b0a39[_0xa5b6('0x11e')];_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1c9')));if(_0x233fe8[_0xa5b6('0x1a8')](0xb,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4['countabandonedretry']>=_0x2b0a39[_0xa5b6('0x1b0')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1ca'));}else{_0x233fe8[_0xa5b6('0xf6')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1ca'));}}break;case'20':_0x2b0a39[_0xa5b6('0x6a')]+=0x1;_0x5187e4[_0xa5b6('0xae')]=0x14;_0x5187e4[_0xa5b6('0xfe')]=_0xa5b6('0x1cb');_0x5187e4[_0xa5b6('0x104')]+=0x1;_0x5187e4[_0xa5b6('0xf0')]+=0x1;_0x2938f4=_0x2b0a39[_0xa5b6('0x1cc')];_0x28899e=_0x2b0a39[_0xa5b6('0x11e')];ami[_0xa5b6('0xe8')]('custom:agentreject',ut[_0xa5b6('0xf1')](_0x341e70,_0xa5b6('0x1cd')));_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1ce')));if(_0x233fe8[_0xa5b6('0x1a8')](0x14,_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4[_0xa5b6('0x104')]>=_0x2b0a39[_0xa5b6('0x1b2')]){_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1cf'));}else{_0x233fe8['stateGlobal'](_0x5187e4,_0x25de65,_0x20aeb4,_0xa5b6('0x1cf'));}}break;default:_0x2b0a39['outboundUnknownCallsDay']+=0x1;_0x5187e4[_0xa5b6('0xae')]=0xc;_0x5187e4['statedesc']=_0x43748b['reason'];_0x2938f4=_0x2b0a39[_0xa5b6('0x1cc')];_0x28899e=_0x2b0a39[_0xa5b6('0x11e')];_0x233fe8[_0xa5b6('0xd2')](_0x5187e4)[_0xa5b6('0xb9')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x233fe8[_0xa5b6('0x1a8')](_0x43748b[_0xa5b6('0x1b6')],_0x341e70,_0x2b0a39)&&!_0x153fd8){if(_0x5187e4['countbusyretry']+_0x5187e4['countcongestionretry']+_0x5187e4[_0xa5b6('0xf3')]+_0x5187e4['countnosuchnumberretry']+_0x5187e4[_0xa5b6('0x103')]+_0x5187e4['countabandonedretry']+_0x5187e4[_0xa5b6('0xef')]+_0x5187e4[_0xa5b6('0x104')]>=_0x2b0a39[_0xa5b6('0x105')]){_0x233fe8['stateGlobal'](_0x5187e4,_0x25de65,_0x20aeb4,_0x43748b['reason']);}else{_0x233fe8[_0xa5b6('0xf8')](_0x5187e4,_0x25de65,_0x20aeb4,_0x43748b[_0xa5b6('0x1b6')]);}}}})[_0xa5b6('0x41')](function(){if(_0x153fd8){_0x233fe8[_0xa5b6('0xc5')](_0x5187e4,_0x2938f4,_0x28899e)[_0xa5b6('0x41')](function(){return _0x25de65(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x240e7e,_0x3132c2,_0xceb8c7,_0x4f91a8){var _0x6c76d2=new Final(_0x240e7e);_0x6c76d2[_0xa5b6('0xae')]=0xf;_0x6c76d2[_0xa5b6('0xfe')]=_0xa5b6('0x1d0');this[_0xa5b6('0xf8')](_0x6c76d2,_0x3132c2,_0xceb8c7,_0x4f91a8);};Dialer['prototype'][_0xa5b6('0xf8')]=function(_0x3ab202,_0x355a95,_0x35f2ce,_0x2ebf9a){this[_0xa5b6('0xd0')](_0x3ab202)[_0xa5b6('0x41')](function(){return _0x355a95(msgResponse(_0xa5b6('0x1b4'),_0xa5b6('0x1d1'),_0x2ebf9a));})[_0xa5b6('0xb9')](function(){return _0x35f2ce(msgResponse(_0xa5b6('0x1d2'),_0xa5b6('0x14d'),'contact\x20not\x20moved'));});};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x161')]=function(_0xecf4c4){var _0x1db567=_0xecf4c4['dialPredictiveOptimizationPercentage']/0x64;var _0x94eae7=_0xecf4c4[_0xa5b6('0x11b')]/(_0xecf4c4[_0xa5b6('0x11b')]+_0xecf4c4[_0xa5b6('0x62')]);var _0x2ed73a=Math[_0xa5b6('0x1d3')](_0xecf4c4[_0xa5b6('0x1d4')]*(_0xecf4c4[_0xa5b6('0x1d5')]/0x64));var _0x2989e4=Math[_0xa5b6('0x1d3')](_0xecf4c4[_0xa5b6('0x1d4')]*(_0xecf4c4[_0xa5b6('0x1d6')]/0x64));var _0x38d699=_0xecf4c4[_0xa5b6('0x52')]+_0xecf4c4[_0xa5b6('0x56')];var _0x40c15a=Math[_0xa5b6('0x1d7')](_0xecf4c4[_0xa5b6('0x75')]*_0xecf4c4[_0xa5b6('0x77')]*_0xecf4c4[_0xa5b6('0x71')]*_0xecf4c4[_0xa5b6('0x1d8')]);if(_[_0xa5b6('0x43')](_0xecf4c4['startProgressive'])){if(!_[_0xa5b6('0x43')](_0xecf4c4[_0xa5b6('0x26')])){_0xecf4c4[_0xa5b6('0x26')]=undefined;loggerPredictive[_0xa5b6('0x9d')](_0xa5b6('0x1d9'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0xecf4c4[_0xa5b6('0x96')])){loggerPredictive[_0xa5b6('0x9d')](_0xa5b6('0x1d9'),_0xa5b6('0x1da'));clearInterval(_0xecf4c4['handlePredictive']);_0xecf4c4[_0xa5b6('0x96')]=undefined;}_0xecf4c4['startProgressive']=moment()[_0xa5b6('0x7c')](_0xa5b6('0xfc'));loggerPredictive[_0xa5b6('0x81')](_0xecf4c4[_0xa5b6('0x46')],_0xa5b6('0x1db'),_0xecf4c4[_0xa5b6('0x27')]);this[_0xa5b6('0x15e')](_0xecf4c4,0x1);}else if(ifInterval(_0xecf4c4['dialPredictiveInterval'],_0xecf4c4[_0xa5b6('0x27')])){this[_0xa5b6('0x15e')](_0xecf4c4,0x1);loggerPredictiveCalls[_0xa5b6('0x81')](_0xa5b6('0x1dc'),_0xecf4c4[_0xa5b6('0x27')],_0xecf4c4[_0xa5b6('0x46')]);_0xecf4c4[_0xa5b6('0x75')]=0x0;_0xecf4c4[_0xa5b6('0x70')]=0x0;}else if(_0x1db567<_0x94eae7&&_0xecf4c4[_0xa5b6('0x1dd')]===_0xa5b6('0x1de')){freeVariablesPredictive(_0xecf4c4);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x1df'),_0xa5b6('0x1e0'),_0x94eae7,'startProgressive',_0xecf4c4[_0xa5b6('0x46')]);}else if(_0x40c15a<_0xecf4c4[_0xa5b6('0x70')]&&_0xecf4c4['dialPredictiveOptimization']===_0xa5b6('0x1de')){freeVariablesPredictive(_0xecf4c4);loggerPredictive[_0xa5b6('0x81')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xa5b6('0x1e1'),_0x40c15a,_0xa5b6('0x1e2'),_0xecf4c4['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0xecf4c4[_0xa5b6('0x46')]);}else if(!ifInterval(_0xecf4c4['dialPredictiveInterval'],_0xecf4c4['startProgressive'])&&_[_0xa5b6('0x43')](_0xecf4c4[_0xa5b6('0x26')])&&!_[_0xa5b6('0x43')](_0xecf4c4[_0xa5b6('0x27')])){_0xecf4c4['startPredictive']=moment()[_0xa5b6('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0xecf4c4[_0xa5b6('0x46')],_0xa5b6('0x1e3'),_0xecf4c4[_0xa5b6('0x26')]);this['averageHandleTime'](_0xecf4c4['dialPredictiveInterval'])[_0xa5b6('0x41')](this['getDataPredictive'](_0xecf4c4))[_0xa5b6('0x41')](mergeDataErlangB(_0xecf4c4))[_0xa5b6('0x41')](this[_0xa5b6('0x1e4')](_0xecf4c4))[_0xa5b6('0xb9')](loggerCatchPredictive(_0xa5b6('0x1e5'),_0xecf4c4));}else if(!ifInterval(_0xecf4c4[_0xa5b6('0x1e6')],_0xecf4c4['startPredictive'])){_0xecf4c4[_0xa5b6('0x70')]=0x0;_0xecf4c4[_0xa5b6('0x26')]=moment()[_0xa5b6('0x7c')](_0xa5b6('0xfc'));loggerPredictive[_0xa5b6('0x81')](_0xecf4c4[_0xa5b6('0x46')],'recalculate\x20predictive\x20at',_0xecf4c4[_0xa5b6('0x26')]);clearInterval(_0xecf4c4[_0xa5b6('0x96')]);_0xecf4c4[_0xa5b6('0x96')]=undefined;this[_0xa5b6('0xc8')](_0xecf4c4[_0xa5b6('0x1e6')])[_0xa5b6('0x41')](this[_0xa5b6('0x1e7')](_0xecf4c4))[_0xa5b6('0x41')](mergeDataErlangB(_0xecf4c4))[_0xa5b6('0x41')](this['startMethodPredictive'](_0xecf4c4))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0xecf4c4));}else if(_0xecf4c4[_0xa5b6('0x1d4')]&&_0x38d699<_0xecf4c4[_0xa5b6('0x1d4')]-_0x2989e4){freeVariablesPredictive(_0xecf4c4);loggerPredictive[_0xa5b6('0x81')](_0xecf4c4[_0xa5b6('0x46')],_0xa5b6('0x1e8'),_0x38d699,_0xa5b6('0x1e9'),_0xecf4c4[_0xa5b6('0x1d4')],'-',_0x2989e4,'=',_0xecf4c4[_0xa5b6('0x1d4')]-_0x2989e4,')');}else if(_0xecf4c4['predictiveIntervalAvailable']&&_0x38d699>_0xecf4c4[_0xa5b6('0x1d4')]+_0x2ed73a){freeVariablesPredictive(_0xecf4c4);loggerPredictive[_0xa5b6('0x81')](_0xecf4c4[_0xa5b6('0x46')],_0xa5b6('0x1e8'),_0x38d699,_0xa5b6('0x1ea'),_0xecf4c4[_0xa5b6('0x1d4')],'+',_0x2ed73a,'=',_0xecf4c4[_0xa5b6('0x1d4')]+_0x2ed73a,')');}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1e7')]=function(_0x2bc798){var _0x7d15d7=this;return function(_0x5f5371){return new Promise(function(_0x258d75,_0xac10f0){_['merge'](_0x2bc798,_0x5f5371[0x0]);if(checkGetDataPredictive(_0x5f5371[0x0])){var _0x1ee073=_0x2bc798[_0xa5b6('0x1d4')]=_0x2bc798[_0xa5b6('0x56')]+_0x2bc798['available'];var _0x529aa9=_0x2bc798['dialPredictiveInterval']*0x3c;var _0x2ef93f=_0x5f5371[0x0][_0xa5b6('0x6d')]+_0x5f5371[0x0][_0xa5b6('0x6c')];var _0x1a3059=(_0x5f5371[0x0][_0xa5b6('0x6b')]+_0x5f5371[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5f5371[0x0][_0xa5b6('0x1eb')])/_0x5f5371[0x0]['predictiveIntervalTotalCalls'];_0x2bc798[_0xa5b6('0x71')]=_0x1a3059>0x0?_0x1a3059:0x1;switch(_0x2bc798[_0xa5b6('0x1dd')]){case'dropRate':var _0x4394ee=_0x2bc798[_0xa5b6('0x1ec')]/0x64;return _0x7d15d7['abandonmentRate'](_0x1ee073,_0x529aa9,_0x2ef93f,_0x1a3059,_0x4394ee)[_0xa5b6('0x41')](function(_0xbf562b){return _0x258d75(_0xbf562b);});case _0xa5b6('0x1ed'):var _0x2ef5e8=_0x2bc798[_0xa5b6('0x1ec')]/0x64;return _0x7d15d7['busyFactor'](_0x1ee073,_0x529aa9,_0x2ef93f,_0x1a3059,_0x2ef5e8)['then'](function(_0x2f9087){return _0x258d75(_0x2f9087);});default:return _0xac10f0(msgResponse(_0xa5b6('0x1ee'),_0xa5b6('0x14d'),_0xa5b6('0x1ef')));}}else{return _0xac10f0(msgResponse('[getDataPredictive]','Failure',_0xa5b6('0x1f0')));}});};};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1f1')]=function(_0x49c358){var _0x53c702=this;return function(_0xf79345){return new Promise(function(_0x2ac1bc,_0x1edf31){_[_0xa5b6('0x92')](_0x49c358,_0xf79345[0x0]);if(checkGetDataPredictive(_0xf79345[0x0])){loggerPredictive[_0xa5b6('0x81')](JSON[_0xa5b6('0x135')](_0xf79345[0x0]));if(_0x49c358[_0xa5b6('0x1dd')]==='dropRate'){return _0x53c702['getVoiceQueueRtPauses'](_0x49c358['id'])[_0xa5b6('0x41')](function(_0x4b5ded){var _0x389b53=_0x49c358['loggedIn']-_0x4b5ded[0x0][_0xa5b6('0x1f2')];var _0x5073eb=_0x49c358[_0xa5b6('0x1e6')]*0x3c;var _0x3f8b53=_0xf79345[0x0][_0xa5b6('0x6d')]+_0xf79345[0x0][_0xa5b6('0x6c')];var _0xc21553=(_0xf79345[0x0][_0xa5b6('0x6b')]+_0xf79345[0x0][_0xa5b6('0x6e')]+_0xf79345[0x0][_0xa5b6('0x1eb')])/_0xf79345[0x0][_0xa5b6('0x73')];var _0x366678=_0x49c358[_0xa5b6('0x1ec')]/0x64;_0x49c358['predictiveIntervalPauses']=_0x4b5ded[0x0][_0xa5b6('0x1f2')]||0x0;_0x49c358[_0xa5b6('0x71')]=_0xc21553>0x0?_0xc21553:0x1;return _0x53c702[_0xa5b6('0x1f3')](_0x389b53,_0x5073eb,_0x3f8b53,_0xc21553,_0x366678);})['then'](function(_0x270859){return _0x2ac1bc(_0x270859);})[_0xa5b6('0xb9')](function(_0x186005){return _0x1edf31(msgResponse('[CatchErlangB]',_0xa5b6('0x14d'),JSON[_0xa5b6('0x135')](_0x186005)));});}if(_0x49c358['dialPredictiveOptimization']===_0xa5b6('0x1ed')){return _0x53c702['getVoiceQueueRtPauses'](_0x49c358['id'])[_0xa5b6('0x41')](function(_0x33721b){var _0x4fae89=_0x49c358[_0xa5b6('0x16a')]-_0x33721b[0x0][_0xa5b6('0x1f2')];var _0x3101c2=_0x49c358[_0xa5b6('0x1e6')]*0x3c;var _0x49552a=_0xf79345[0x0][_0xa5b6('0x6d')]+_0xf79345[0x0]['predictiveIntervalAvgHoldtime'];var _0x1fd860=(_0xf79345[0x0][_0xa5b6('0x6b')]+_0xf79345[0x0][_0xa5b6('0x6e')]+_0xf79345[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf79345[0x0][_0xa5b6('0x73')];var _0x4ad9b6=_0x49c358['dialPredictiveOptimizationPercentage']/0x64;_0x49c358['predictiveIntervalPauses']=_0x33721b[0x0][_0xa5b6('0x1f2')]||0x0;_0x49c358[_0xa5b6('0x71')]=_0x1fd860>0x0?_0x1fd860:0x1;return _0x53c702[_0xa5b6('0x1f4')](_0x4fae89,_0x3101c2,_0x49552a,_0x1fd860,_0x4ad9b6);})[_0xa5b6('0x41')](function(_0x37b9c2){return _0x2ac1bc(_0x37b9c2);})[_0xa5b6('0xb9')](function(_0x32641c){return _0x1edf31(msgResponse('[CatchErlangB]',_0xa5b6('0x14d'),JSON[_0xa5b6('0x135')](_0x32641c)));});}}else{return _0x1edf31(msgResponse(_0xa5b6('0x1ee'),'Failure','check\x20failure'));}});};};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1e4')]=function(_0x4fb719){var _0x553b86=this;return function(){var _0x2eeac2=0x0;var _0x20a37b=Math['floor'](_0x4fb719['erlangCallToSecond']*0x3e8);if(_0x20a37b>0x0){_0x20a37b=_0x20a37b<0x64?0x64:_0x20a37b;loggerPredictive[_0xa5b6('0x81')](_0x4fb719[_0xa5b6('0x46')],'one\x20call\x20every:',_0x20a37b,_0xa5b6('0x4e'));_0x4fb719['handlePredictive']=setInterval(function(){_0x553b86[_0xa5b6('0x96')](_0x4fb719);loggerPredictiveCalls[_0xa5b6('0x81')](_0xa5b6('0x1f5'),_0x2eeac2+=0x1);},_0x20a37b);}else{loggerPredictive['info'](_0x4fb719['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype'][_0xa5b6('0x1f6')]=function(_0x348ede,_0x2231bc){var _0x1effb7=this;return function(_0x2f2d12){if(_[_0xa5b6('0x4c')](_0x2f2d12)){if(_[_0xa5b6('0xb5')](_0x2231bc[_0xa5b6('0xd9')])||!_0x2231bc[_0xa5b6('0x1f7')]){if(_0x348ede['dialMethod']===_0xa5b6('0x9')){_0x348ede[_0xa5b6('0x133')]=_[_0xa5b6('0x43')](_0x348ede['queueStatusComplete'])?!![]:_0x348ede[_0xa5b6('0x133')];var _0x417a59=uuid['v4']();_0x1effb7[_0xa5b6('0xb2')][_0x417a59]=new Action(_0x348ede,_0x2231bc,_0x417a59);loggerBooked[_0xa5b6('0x81')](_0xa5b6('0x1f8'),_0x417a59,_0xa5b6('0x1f9'),JSON[_0xa5b6('0x135')](_0x348ede[_0xa5b6('0x133')]),'Queue:\x20',_0x348ede[_0xa5b6('0x46')]);if(_0x348ede['queueStatusComplete']){_0x348ede[_0xa5b6('0x133')]=![];_0x1effb7[_0xa5b6('0x28')][_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xbc')]]=[];ami[_0xa5b6('0xb6')]({'actionid':_0x417a59,'action':_0xa5b6('0x1fa'),'queue':_0x348ede[_0xa5b6('0x46')]})[_0xa5b6('0xb9')](function(){_0x1effb7[_0xa5b6('0xbe')](_0x348ede);_0x1effb7['rescheduleContact']({'active':![],'ContactId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59]['ContactId'],'ListId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xd8')],'VoiceQueueId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59]['VoiceQueueId']||undefined,'CampaignId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1fb')));delete _0x1effb7[_0xa5b6('0xb2')][_0x417a59];});}else{loggerBooked[_0xa5b6('0x81')](_0xa5b6('0x1fc'),JSON['stringify'](_0x348ede[_0xa5b6('0x133')]),'Queue:\x20',_0x348ede[_0xa5b6('0x46')]);_0x1effb7[_0xa5b6('0xbe')](_0x348ede);_0x1effb7[_0xa5b6('0xc9')]({'active':![],'ContactId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xd7')],'ListId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xd8')],'VoiceQueueId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59][_0xa5b6('0xda')]||undefined,'CampaignId':_0x1effb7[_0xa5b6('0xb2')][_0x417a59]['CampaignId']||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x1fb')));delete _0x1effb7[_0xa5b6('0xb2')][_0x417a59];}}else{return _0x1effb7['actionOriginate'](_0x348ede,_0x2231bc);}}else{if(getDiff(_0x2231bc[_0xa5b6('0x1fd')])<_0x348ede['dialRecallMeTimeout']*0x3c){if(_0x2231bc[_0xa5b6('0x166')]&&!_0x2231bc['Agent'][_0xa5b6('0x1fe')]){_0x1effb7['preview'][_0xa5b6('0x13e')](_0x2231bc['id'])[_0xa5b6('0x138')](function(){_0x1effb7[_0xa5b6('0xbe')](_0x348ede);});}else{_0x1effb7[_0xa5b6('0xca')]({'active':![]},_0x2231bc['id'],0x1)['finally'](function(){_0x1effb7[_0xa5b6('0xbe')](_0x348ede);});}}else{_0x348ede[_0xa5b6('0x1ff')]+=0x1;_0x1effb7[_0xa5b6('0xbe')](_0x348ede);if(_0x348ede[_0xa5b6('0x200')]){_0x1effb7['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2231bc[_0xa5b6('0xd7')],'ListId':_0x2231bc[_0xa5b6('0xd8')],'VoiceQueueId':_0x2231bc['VoiceQueueId']||undefined,'CampaignId':_0x2231bc[_0xa5b6('0xdb')]||undefined})[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x201')));_0x1effb7[_0xa5b6('0xd2')](createObjHistory(_0x348ede,_0x2231bc,_0xa5b6('0x202'),0x17,_0xa5b6('0x203')))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0x204')));}else{_0x1effb7[_0xa5b6('0xe1')](createObjHistory(_0x348ede,_0x2231bc,_0xa5b6('0x205'),0x16,_0xa5b6('0x206')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x348ede['outboundBlacklistCallsDay']+=0x1;_0x1effb7[_0xa5b6('0xe1')](createObjHistory(_0x348ede,_0x2231bc,_0xa5b6('0x207'),0xd,_0xa5b6('0x208')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xa5b6('0x209');}};};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x169')]=function(_0x291204){var _0x38a4f2=this;var _0x537701=_0x291204[_0xa5b6('0x20a')]-_0x291204[_0xa5b6('0x74')]-_0x291204[_0xa5b6('0xcc')];emitCampaignSummary(_0x291204);if(_0x537701>0x0){if(_0x537701>this[_0xa5b6('0x22')]){_0x537701=this[_0xa5b6('0x22')];}_0x291204[_0xa5b6('0xcc')]+=_0x537701;this[_0xa5b6('0xce')](_0x291204['id'],_0x537701,_0x291204[_0xa5b6('0x20b')],_0x291204)[_0xa5b6('0x41')](function(_0x461069){_0x291204['temp']-=_0x537701;_0x291204[_0xa5b6('0xcc')]=_0x291204[_0xa5b6('0xcc')]>0x0?_0x291204[_0xa5b6('0xcc')]:0x0;if(!checkContactEmpty(_0x461069)){_0x291204[_0xa5b6('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xa5b6('0x81')](_0xa5b6('0x20c')+_0x291204[_0xa5b6('0x46')]);}else{_0x291204[_0xa5b6('0x74')]+=_0x461069[_0xa5b6('0x9f')];_0x291204['message']=_0xa5b6('0x20d');for(var _0x315d44=0x0;_0x315d44<_0x461069['length'];_0x315d44+=0x1){_0x291204[_0xa5b6('0x20e')]+=0x1;if(_[_0xa5b6('0xb5')](_0x461069[_0x315d44])||_[_0xa5b6('0xb5')](_0x461069[_0x315d44][_0xa5b6('0x192')])||_['isNil'](_0x461069[_0x315d44][_0xa5b6('0x17c')])){_0x38a4f2[_0xa5b6('0xd5')](_0xa5b6('0x20f'),_0x291204,_0x461069[_0x315d44]);}else{_0x38a4f2[_0xa5b6('0x210')](_[_0xa5b6('0x131')](_0x461069[_0x315d44],['CampaignId',_0xa5b6('0x17c')]))[_0xa5b6('0x41')](_0x38a4f2[_0xa5b6('0x1f6')](_0x291204,_0x461069[_0x315d44]))[_0xa5b6('0xb9')](_0x38a4f2[_0xa5b6('0xd4')](_0xa5b6('0x211'),_0x291204));}}}})[_0xa5b6('0xb9')](loggerGetContactDialer(_0xa5b6('0x212'),_0x291204,_0x537701));}};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x15e')]=function(_0x262a7b,_0x785f18){var _0xa80370=this;var _0x907cd8=[];var _0x53e19f=_0x785f18>=0x1?_0x785f18:0x1;if(_0x262a7b[_0xa5b6('0x5d')]===_0xa5b6('0x9')){_0x53e19f=0x1;}var _0x4b715d=Math[_0xa5b6('0x1d7')](_0x262a7b['available']*_0x53e19f)-_0x262a7b[_0xa5b6('0x74')]-_0x262a7b[_0xa5b6('0xcc')];emitVoiceQueueSummary(_0x262a7b);if(_0x262a7b[_0xa5b6('0x213')]>0x0){var _0x279629=_0x262a7b['dialLimitQueue']-_0x262a7b[_0xa5b6('0x74')]-_0x262a7b[_0xa5b6('0x56')]-_0x262a7b[_0xa5b6('0xcc')]-_0x262a7b[_0xa5b6('0x53')];if(_0x4b715d>_0x279629){_0x4b715d=_0x279629;}}if(_0x4b715d>0x0){if(_0x262a7b[_0xa5b6('0x5d')]==='booked'){_0x4b715d=0x1;}if(_0x4b715d>this['maxNumberOriginate']){_0x4b715d=this[_0xa5b6('0x22')];}_0x262a7b['temp']+=_0x4b715d;for(var _0x3bedb6 in this['agents']){if(typeof this[_0xa5b6('0x20')][_0x3bedb6]!==_0xa5b6('0xa0')){if(this[_0xa5b6('0x20')][_0x3bedb6][_0xa5b6('0xae')]==='not_inuse'&&this['agents'][_0x3bedb6]['status']===_0xa5b6('0xdf')){_0x907cd8[_0xa5b6('0x130')](this['agents'][_0x3bedb6]['id']);}}}this['getContactDialer'](_0x262a7b['id'],_0x907cd8,_0x4b715d,_0x262a7b[_0xa5b6('0x20b')],_0x262a7b)['then'](function(_0x597bc3){_0x262a7b[_0xa5b6('0xcc')]-=_0x4b715d;_0x262a7b[_0xa5b6('0xcc')]=_0x262a7b[_0xa5b6('0xcc')]>0x0?_0x262a7b[_0xa5b6('0xcc')]:0x0;if(!checkContactEmpty(_0x597bc3)){_0xa80370['countReScheduled'](_0x262a7b)['then'](sendMessageReschedule(_0x262a7b))[_0xa5b6('0xb9')](loggerCatch(_0xa5b6('0xc2')));}else{_0x262a7b[_0xa5b6('0x74')]+=_0x597bc3[_0xa5b6('0x9f')];_0x262a7b[_0xa5b6('0x44')]=_0x262a7b[_0xa5b6('0x5d')]==='booked'?_0xa5b6('0x183'):'RUNNING';for(var _0x52bbf3=0x0;_0x52bbf3<_0x597bc3[_0xa5b6('0x9f')];_0x52bbf3+=0x1){if(_[_0xa5b6('0xb5')](_0x597bc3[_0x52bbf3])||_[_0xa5b6('0xb5')](_0x597bc3[_0x52bbf3]['Contact'])||_[_0xa5b6('0xb5')](_0x597bc3[_0x52bbf3]['phone'])){_0xa80370[_0xa5b6('0xd5')]('[actionOriginate]\x20',_0x262a7b,_0x597bc3[_0x52bbf3]);}else{_0xa80370['checkIsBlackList'](_[_0xa5b6('0x131')](_0x597bc3[_0x52bbf3],[_0xa5b6('0xda'),_0xa5b6('0x17c')]))[_0xa5b6('0x41')](_0xa80370['checkContactBlack'](_0x262a7b,_0x597bc3[_0x52bbf3]))['catch'](_0xa80370['loggerHandler']('[actionOriginate]\x20',_0x262a7b));}}}})[_0xa5b6('0xb9')](loggerGetContactDialer(_0xa5b6('0x214'),_0x262a7b,_0x4b715d));}};Dialer[_0xa5b6('0xb0')]['handlePredictive']=function(_0x52daea){if(_0x52daea[_0xa5b6('0x213')]>0x0){var _0x3cf3fa=_0x52daea['dialLimitQueue']-_0x52daea[_0xa5b6('0x74')]-_0x52daea[_0xa5b6('0x56')];if(_0x3cf3fa>0x0){this[_0xa5b6('0x215')](_0x52daea);}else{loggerPredictiveCalls[_0xa5b6('0x81')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x52daea);}};Dialer['prototype'][_0xa5b6('0x215')]=function(_0x28a759){var _0x2e56b1=this;var _0x28afb2=[];_0x28a759['originated']+=0x1;for(var _0x57b415 in this[_0xa5b6('0x20')]){if(typeof this['agents'][_0x57b415]!==_0xa5b6('0xa0')){if(this[_0xa5b6('0x20')][_0x57b415][_0xa5b6('0xae')]===_0xa5b6('0x216')&&this['agents'][_0x57b415][_0xa5b6('0xb7')]===_0xa5b6('0xdf')){_0x28afb2[_0xa5b6('0x130')](this[_0xa5b6('0x20')][_0x57b415]['id']);}}}this[_0xa5b6('0x217')](_0x28a759['id'],_0x28afb2,0x1,_0x28a759[_0xa5b6('0x20b')],_0x28a759)[_0xa5b6('0x41')](function(_0x2c0d06){if(!checkContactEmpty(_0x2c0d06)){checkContactLowerLimitOriginate(_0x28a759,0x1,0x0);_0x2e56b1[_0xa5b6('0xc0')](_0x28a759)[_0xa5b6('0x41')](sendMessageReschedule(_0x28a759))['catch'](loggerCatch(_0xa5b6('0xc2')));}else{_0x28a759['message']=_0xa5b6('0x20d');if(_[_0xa5b6('0xb5')](_0x2c0d06[0x0])||_['isNil'](_0x2c0d06[0x0][_0xa5b6('0x192')])||_[_0xa5b6('0xb5')](_0x2c0d06[0x0][_0xa5b6('0x17c')])){_0x2e56b1['emptyContact'](_0xa5b6('0x20f'),_0x28a759,_0x2c0d06[0x0]);}else{_0x2e56b1[_0xa5b6('0x218')](_[_0xa5b6('0x131')](_0x2c0d06[0x0],[_0xa5b6('0xda'),_0xa5b6('0x17c')]))['then'](_0x2e56b1[_0xa5b6('0x1f6')](_0x28a759,_0x2c0d06[0x0]))['catch'](_0x2e56b1[_0xa5b6('0xd4')]('[actionOriginatePredictive]\x20',_0x28a759));}}})[_0xa5b6('0xb9')](loggerGetContactDialer(_0xa5b6('0x219'),_0x28a759,0x1));emitVoiceQueueSummary(_0x28a759);};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1f3')]=function(_0x3a81d4,_0x3e394c,_0x3cd238,_0x4a592f,_0x28be38,_0x1cdded){loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21a'));loggerPredictive['info'](_0xa5b6('0x21b'),_0x3a81d4);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21c'),_0x3e394c);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21d'),_0x3cd238);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21e'),_0x4a592f);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21f'),_0x28be38);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x91'));return new Promise(function(_0x5f44a1,_0x1c47ee){if(_0x3a81d4<=0x0||isNaN(_0x3a81d4)){return _0x1c47ee(msgResponse('[abandonmentRate]',_0xa5b6('0x4d'),_0xa5b6('0x220')+_0x3a81d4));}if(_0x3cd238<=0x0||isNaN(_0x3cd238)){return _0x1c47ee(msgResponse(_0xa5b6('0x221'),'Error',_0xa5b6('0x222')+_0x3cd238));}if(_0x4a592f<=0x0||isNaN(_0x4a592f)){return _0x1c47ee(msgResponse(_0xa5b6('0x221'),_0xa5b6('0x4d'),_0xa5b6('0x223')+_0x4a592f));}if(_0x3e394c<=0x0||isNaN(_0x3e394c)){return _0x1c47ee(msgResponse(_0xa5b6('0x221'),_0xa5b6('0x4d'),_0xa5b6('0x224')+_0x3e394c));}if(_0x28be38<=0x0||isNaN(_0x28be38)){return _0x1c47ee(msgResponse(_0xa5b6('0x221'),'Error','Amax\x20=\x20'+_0x28be38));}_0x1cdded=_0x1cdded||0x0;var _0x36a375=0x1/_0x3cd238;var _0x97ea20=0x0;var _0x3302d9=0x0;var _0x59c320=0x0;var _0x2e95d2=0x0;for(var _0x29aa8b=0x0;_0x59c320<_0x28be38;_0x29aa8b+=0x1){_0x3302d9=_0x29aa8b/_0x3e394c;_0x97ea20=(_0x4a592f*_0x3302d9+_0x1cdded)/_0x36a375;_0x59c320=erlangb(_0x97ea20,_0x3a81d4);_0x2e95d2=_0x97ea20/_0x3a81d4*(0x1-erlangb(_0x97ea20,_0x3a81d4));}return _0x5f44a1({'erlangCalls':_0x29aa8b,'erlangCallToSecond':_0x3e394c/_0x29aa8b,'erlangAbandonmentRate':_0x59c320,'erlangBusyFactor':_0x2e95d2});});};Dialer[_0xa5b6('0xb0')][_0xa5b6('0x1f4')]=function(_0x57e8ce,_0x19657f,_0x2f698c,_0x4dc42d,_0x5a0e7f,_0x4214f5){loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x225'));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',_0x57e8ce);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x21c'),_0x19657f);loggerPredictive['info'](_0xa5b6('0x21d'),_0x2f698c);loggerPredictive['info'](_0xa5b6('0x21e'),_0x4dc42d);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x226'),_0x5a0e7f);loggerPredictive[_0xa5b6('0x81')](_0xa5b6('0x91'));return new Promise(function(_0x4803fb,_0x4773fe){if(_0x57e8ce<=0x0||isNaN(_0x57e8ce)){return _0x4773fe(msgResponse(_0xa5b6('0x227'),_0xa5b6('0x4d'),_0xa5b6('0x220')+_0x57e8ce));}if(_0x2f698c<=0x0||isNaN(_0x2f698c)){return _0x4773fe(msgResponse(_0xa5b6('0x227'),_0xa5b6('0x4d'),_0xa5b6('0x222')+_0x2f698c));}if(_0x4dc42d<=0x0||isNaN(_0x4dc42d)){return _0x4773fe(msgResponse('[busyFactor]',_0xa5b6('0x4d'),_0xa5b6('0x223')+_0x4dc42d));}if(_0x19657f<=0x0||isNaN(_0x19657f)){return _0x4773fe(msgResponse('[busyFactor]',_0xa5b6('0x4d'),_0xa5b6('0x224')+_0x19657f));}if(_0x5a0e7f<=0x0||isNaN(_0x5a0e7f)){return _0x4773fe(msgResponse(_0xa5b6('0x227'),'Error',_0xa5b6('0x228')+_0x5a0e7f));}_0x4214f5=_0x4214f5||0x0;var _0x515f61=0x1/_0x2f698c;var _0x18447c=0x0;var _0x826c68=0x0;var _0x39a4dd=0x0;var _0x4d60fb=0x0;for(var _0x672806=0x0;_0x4d60fb<_0x5a0e7f;_0x672806+=0x1){_0x826c68=_0x672806/_0x19657f;_0x18447c=(_0x4dc42d*_0x826c68+_0x4214f5)/_0x515f61;_0x39a4dd=erlangb(_0x18447c,_0x57e8ce);_0x4d60fb=_0x18447c/_0x57e8ce*(0x1-erlangb(_0x18447c,_0x57e8ce));}return _0x4803fb({'erlangCalls':_0x672806,'erlangCallToSecond':_0x19657f/_0x672806,'erlangAbandonmentRate':_0x39a4dd,'erlangBusyFactor':_0x4d60fb});});};module[_0xa5b6('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 8d987ab..0fc0ec6 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 _0xc080=['countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridnum','number','starttime','droptime','endtime','ringtime','responsetime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry'];(function(_0x5fe1b2,_0x30daae){var _0x104b8d=function(_0x5e2d71){while(--_0x5e2d71){_0x5fe1b2['push'](_0x5fe1b2['shift']());}};_0x104b8d(++_0x30daae);}(_0xc080,0xc2));var _0x0c08=function(_0x35d99e,_0x566e5f){_0x35d99e=_0x35d99e-0x0;var _0x412b9b=_0xc080[_0x35d99e];return _0x412b9b;};'use strict';var util=require(_0x0c08('0x0'));var _=require('lodash');var moment=require(_0x0c08('0x1'));function getSeconds(_0x192610,_0x30faf9){var _0xc9d79b=moment(_0x192610)[_0x0c08('0x2')](0x0);var _0x518656=moment(_0x30faf9)[_0x0c08('0x2')](0x0);return _0xc9d79b[_0x0c08('0x3')](_0x518656,_0x0c08('0x4'));}function QueueCallerAbandon(_0x1013e5,_0x130917){this['scheduledat']=_0x1013e5[_0x0c08('0x5')];this[_0x0c08('0x6')]=_0x1013e5['type'];this[_0x0c08('0x7')]=_0x1013e5[_0x0c08('0x6')]==='outbound'?_0x0c08('0x8'):_0x1013e5[_0x0c08('0x6')];this[_0x0c08('0x9')]=_0x1013e5['countbusyretry'];this[_0x0c08('0xa')]=_0x1013e5['countcongestionretry'];this[_0x0c08('0xb')]=_0x1013e5[_0x0c08('0xb')];this[_0x0c08('0xc')]=_0x1013e5['countbusyretry']+_0x1013e5[_0x0c08('0xa')]+_0x1013e5[_0x0c08('0xb')]+_0x1013e5[_0x0c08('0xd')]+_0x1013e5[_0x0c08('0xe')]+_0x1013e5['countabandonedretry']+_0x1013e5[_0x0c08('0xf')]+_0x1013e5[_0x0c08('0x10')];this[_0x0c08('0xd')]=_0x1013e5['countnosuchnumberretry'];this[_0x0c08('0xe')]=_0x1013e5['countdropretry'];this[_0x0c08('0x11')]=_0x1013e5[_0x0c08('0x11')];this[_0x0c08('0xf')]=_0x1013e5[_0x0c08('0xf')];this[_0x0c08('0x10')]=_0x1013e5['countagentrejectretry'];this['uniqueid']=_0x130917['uniqueid'];this['calleridname']=_0x1013e5['name'];this[_0x0c08('0x12')]=_0x1013e5[_0x0c08('0x13')];this[_0x0c08('0x14')]=_0x1013e5['starttime'];this['responsetime']=_0x1013e5['responsetime'];this[_0x0c08('0x15')]=_0x1013e5[_0x0c08('0x15')];this[_0x0c08('0x16')]=this[_0x0c08('0x15')];this[_0x0c08('0x17')]=getSeconds(_0x1013e5[_0x0c08('0x18')],_0x1013e5[_0x0c08('0x14')]);this[_0x0c08('0x19')]=getSeconds(this[_0x0c08('0x15')],_0x1013e5[_0x0c08('0x18')]);this[_0x0c08('0x1a')]=0x0;this['queue']=_0x130917[_0x0c08('0x8')];this['membername']=_0x130917[_0x0c08('0x1b')];this[_0x0c08('0x1c')]=_0x130917[_0x0c08('0x1c')];this[_0x0c08('0x1d')]=_0x1013e5[_0x0c08('0x1d')];this[_0x0c08('0x1e')]=_0x1013e5[_0x0c08('0x1e')];this[_0x0c08('0x1f')]=_0x1013e5['callbackat'];this['recallme']=_0x1013e5[_0x0c08('0x20')];this[_0x0c08('0x21')]=_0x1013e5[_0x0c08('0x21')];this[_0x0c08('0x22')]=_0x1013e5[_0x0c08('0x22')];this[_0x0c08('0x23')]=_0x1013e5[_0x0c08('0x23')];this[_0x0c08('0x24')]=_0x1013e5[_0x0c08('0x24')];this[_0x0c08('0x25')]=_0x1013e5[_0x0c08('0x25')];this[_0x0c08('0x26')]=_0x1013e5[_0x0c08('0x26')]||'';this[_0x0c08('0x27')]=_0x1013e5[_0x0c08('0x27')]||'';}module[_0x0c08('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x400a=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','responsetime','droptime','endtime','ringtime','talktime','membername'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x400a,0xe4));var _0xa400=function(_0x49f509,_0x5c7395){_0x49f509=_0x49f509-0x0;var _0x1250d2=_0x400a[_0x49f509];return _0x1250d2;};'use strict';var util=require(_0xa400('0x0'));var _=require(_0xa400('0x1'));var moment=require(_0xa400('0x2'));function getSeconds(_0x3caf59,_0x19ce2b){var _0x46f64d=moment(_0x3caf59)[_0xa400('0x3')](0x0);var _0x5962d=moment(_0x19ce2b)[_0xa400('0x3')](0x0);return _0x46f64d[_0xa400('0x4')](_0x5962d,'seconds');}function QueueCallerAbandon(_0xe2959a,_0x55b681){this[_0xa400('0x5')]=_0xe2959a[_0xa400('0x5')];this[_0xa400('0x6')]=_0xe2959a[_0xa400('0x6')];this[_0xa400('0x7')]=_0xe2959a[_0xa400('0x6')]===_0xa400('0x8')?_0xa400('0x9'):_0xe2959a['type'];this['countbusyretry']=_0xe2959a[_0xa400('0xa')];this['countcongestionretry']=_0xe2959a[_0xa400('0xb')];this['countnoanswerretry']=_0xe2959a[_0xa400('0xc')];this[_0xa400('0xd')]=_0xe2959a['countbusyretry']+_0xe2959a[_0xa400('0xb')]+_0xe2959a[_0xa400('0xc')]+_0xe2959a['countnosuchnumberretry']+_0xe2959a[_0xa400('0xe')]+_0xe2959a[_0xa400('0xf')]+_0xe2959a['countmachineretry']+_0xe2959a[_0xa400('0x10')];this[_0xa400('0x11')]=_0xe2959a['countnosuchnumberretry'];this[_0xa400('0xe')]=_0xe2959a[_0xa400('0xe')];this[_0xa400('0xf')]=_0xe2959a[_0xa400('0xf')];this[_0xa400('0x12')]=_0xe2959a['countmachineretry'];this[_0xa400('0x10')]=_0xe2959a[_0xa400('0x10')];this['uniqueid']=_0x55b681[_0xa400('0x13')];this[_0xa400('0x14')]=_0xe2959a[_0xa400('0x15')];this[_0xa400('0x16')]=_0xe2959a[_0xa400('0x17')];this['starttime']=_0xe2959a['starttime'];this['responsetime']=_0xe2959a[_0xa400('0x18')];this[_0xa400('0x19')]=_0xe2959a[_0xa400('0x19')];this[_0xa400('0x1a')]=this[_0xa400('0x19')];this[_0xa400('0x1b')]=getSeconds(_0xe2959a['responsetime'],_0xe2959a['starttime']);this['holdtime']=getSeconds(this[_0xa400('0x19')],_0xe2959a[_0xa400('0x18')]);this[_0xa400('0x1c')]=0x0;this['queue']=_0x55b681[_0xa400('0x9')];this[_0xa400('0x1d')]=_0x55b681['connectedlinename'];this[_0xa400('0x1e')]=_0x55b681[_0xa400('0x1e')];this['callback']=_0xe2959a[_0xa400('0x1f')];this[_0xa400('0x20')]=_0xe2959a[_0xa400('0x20')];this[_0xa400('0x21')]=_0xe2959a['callbackat'];this[_0xa400('0x22')]=_0xe2959a['recallme'];this[_0xa400('0x23')]=_0xe2959a['ContactId'];this[_0xa400('0x24')]=_0xe2959a[_0xa400('0x24')];this[_0xa400('0x25')]=_0xe2959a[_0xa400('0x25')];this[_0xa400('0x26')]=_0xe2959a[_0xa400('0x26')];this[_0xa400('0x27')]=_0xe2959a[_0xa400('0x27')];this[_0xa400('0x28')]=_0xe2959a['originatecalleridnum']||'';this['originatecalleridname']=_0xe2959a[_0xa400('0x29')]||'';}module[_0xa400('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 724f560..f857acb 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(_0x355514,_0x383367){var _0x55eca5=function(_0x5e7595){while(--_0x5e7595){_0x355514['push'](_0x355514['shift']());}};_0x55eca5(++_0x383367);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x5a3ece,_0x5a5745){var _0x1e8f40=function(_0x5a5b3a){while(--_0x5a5b3a){_0x5a3ece['push'](_0x5a3ece['shift']());}};_0x1e8f40(++_0x5a5745);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 721b07c..74a0e06 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 _0x2fb2=['resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','exports','bluebird','uuid','moment','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2fb2,0xc5));var _0x22fb=function(_0x513c39,_0x381800){_0x513c39=_0x513c39-0x0;var _0x24e141=_0x2fb2[_0x513c39];return _0x24e141;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x22fb('0x0'));var uuid=require(_0x22fb('0x1'));var moment=require(_0x22fb('0x2'));var path=require('path');var tiff2pdf=require(_0x22fb('0x3'));var gs=require('./util/gs');var logger=require(_0x22fb('0x4'))('fax');var ami=require(_0x22fb('0x5'));var rpcDb=require(_0x22fb('0x6'));var Channel=require(_0x22fb('0x7'));var ut=require(_0x22fb('0x8'));var Action=require(_0x22fb('0x9'));var faxAccount=require(_0x22fb('0xa'));var attachment=require(_0x22fb('0xb'));var faxMessage=require(_0x22fb('0xc'));function Fax(_0x450e38){this[_0x22fb('0xd')]={};this[_0x22fb('0xe')]=_0x450e38[_0x22fb('0xe')];this['trunks']=_0x450e38[_0x22fb('0xf')];this[_0x22fb('0x10')]={};ami['on']('newchannel',this[_0x22fb('0x11')][_0x22fb('0x12')](this));ami['on']('varset',this['syncVarSet'][_0x22fb('0x12')](this));ami['on']('newstate',this[_0x22fb('0x13')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x14'),this['syncNewExten'][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x15'),this[_0x22fb('0x16')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x17'),this[_0x22fb('0x18')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x19'),this[_0x22fb('0x1a')][_0x22fb('0x12')](this));ami['on'](_0x22fb('0x1b'),this[_0x22fb('0x1c')][_0x22fb('0x12')](this));}Fax[_0x22fb('0x1d')]['syncNewchannel']=function(_0x1e6dd2){if(_0x1e6dd2[_0x22fb('0x1e')]===_0x22fb('0x1f')){for(var _0x29fa31 in this[_0x22fb('0xe')]){if(this[_0x22fb('0xe')]['hasOwnProperty'](_0x29fa31)){if(_0x1e6dd2[_0x22fb('0x20')]===this[_0x22fb('0xe')][_0x29fa31][_0x22fb('0x21')]){this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]={};this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]['channel']=_0x1e6dd2[_0x22fb('0x23')];this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]['id']=this[_0x22fb('0xe')][_0x29fa31]['id'];this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]][_0x22fb('0x24')]=this['faxAccounts'][_0x29fa31][_0x22fb('0x24')];logger[_0x22fb('0x25')](_0x1e6dd2[_0x22fb('0x22')],_0x22fb('0x26'));}}}}if(this[_0x22fb('0x10')][_0x1e6dd2[_0x22fb('0x22')]]){this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]]={};this[_0x22fb('0xd')][_0x1e6dd2[_0x22fb('0x22')]][_0x22fb('0x23')]=_0x1e6dd2[_0x22fb('0x23')];logger[_0x22fb('0x25')](_0x1e6dd2[_0x22fb('0x22')],_0x22fb('0x26'));}};Fax['prototype'][_0x22fb('0x27')]=function(_0x4d053d){if(this[_0x22fb('0xd')][_0x4d053d[_0x22fb('0x22')]]){for(var _0x38cafd in _0x4d053d[_0x22fb('0x28')]){if(_0x4d053d[_0x22fb('0x28')]['hasOwnProperty'](_0x38cafd)){this[_0x22fb('0xd')][_0x4d053d['uniqueid']][_0x38cafd]=_0x4d053d[_0x22fb('0x29')];}}}};Fax[_0x22fb('0x1d')][_0x22fb('0x13')]=function(_0x32ae9){if(this[_0x22fb('0xd')][_0x32ae9[_0x22fb('0x22')]]){this['channels'][_0x32ae9['uniqueid']][_0x22fb('0x2a')]=_0x32ae9[_0x22fb('0x2a')];this[_0x22fb('0xd')][_0x32ae9[_0x22fb('0x22')]][_0x22fb('0x2b')]=_0x32ae9['channelstatedesc'];}};Fax[_0x22fb('0x1d')]['syncNewExten']=function(_0x3201b8){if(this[_0x22fb('0xd')][_0x3201b8[_0x22fb('0x22')]]){for(var _0x57d124 in _0x3201b8[_0x22fb('0x28')]){if(_0x3201b8[_0x22fb('0x28')][_0x22fb('0x2c')](_0x57d124)){this[_0x22fb('0xd')][_0x3201b8[_0x22fb('0x22')]][_0x57d124]=_0x3201b8[_0x22fb('0x29')];}}}};Fax[_0x22fb('0x1d')][_0x22fb('0x16')]=function(_0x1d2e8f){if(this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]]){this[_0x22fb('0xd')][_0x1d2e8f['uniqueid']][_0x22fb('0x2d')]=_0x1d2e8f[_0x22fb('0x2d')];this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]]['status']=_0x1d2e8f[_0x22fb('0x2e')];this[_0x22fb('0xd')][_0x1d2e8f[_0x22fb('0x22')]][_0x22fb('0x21')]=_0x1d2e8f['localstationid'];this[_0x22fb('0xd')][_0x1d2e8f['uniqueid']][_0x22fb('0x2f')]=_0x1d2e8f['filename'];logger[_0x22fb('0x25')](_0x1d2e8f['uniqueid'],_0x22fb('0x30'));}};Fax[_0x22fb('0x1d')][_0x22fb('0x18')]=function(_0x1609a7){var _0x195f62=this;if(this['channels'][_0x1609a7['uniqueid']]){var _0x4012bf=this[_0x22fb('0xd')][_0x1609a7['uniqueid']]['id'];this[_0x22fb('0xd')][_0x1609a7['uniqueid']][_0x22fb('0x31')]=_0x1609a7['remotestationid'];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x32')]=_0x1609a7[_0x22fb('0x32')];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]]['localstationid']=_0x1609a7[_0x22fb('0x21')];this['channels'][_0x1609a7[_0x22fb('0x22')]]['resolution']=_0x1609a7[_0x22fb('0x33')];this['channels'][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x34')]=_0x1609a7[_0x22fb('0x34')];this[_0x22fb('0xd')][_0x1609a7[_0x22fb('0x22')]][_0x22fb('0x2f')]=_0x1609a7[_0x22fb('0x2f')];this[_0x22fb('0xd')][_0x1609a7['uniqueid']]['calleridnum']=_0x1609a7[_0x22fb('0x35')];if(this['channels'][_0x1609a7['uniqueid']][_0x22fb('0x32')]>0x0){tiff2pdf(_0x1609a7[_0x22fb('0x2f')],_0x22fb('0x36'),function(_0x3ea4d3){logger['info'](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x37'),_0x3ea4d3[_0x22fb('0x38')]);attachment[_0x22fb('0x39')]({'name':path[_0x22fb('0x3a')](_0x1609a7[_0x22fb('0x2f')])['name'],'basename':path[_0x22fb('0x3a')](_0x1609a7[_0x22fb('0x2f')])[_0x22fb('0x24')]+_0x22fb('0x3b'),'type':_0x22fb('0x3c')})[_0x22fb('0x3d')](function(_0x2f91fb){faxAccount[_0x22fb('0x3e')](_0x4012bf,{'from':_0x1609a7[_0x22fb('0x35')],'mapKey':_0x22fb('0x3f'),'body':path['parse'](_0x1609a7[_0x22fb('0x2f')])[_0x22fb('0x24')]+_0x22fb('0x3b'),'AttachmentId':_0x2f91fb['id']})[_0x22fb('0x40')](function(_0x38245a){logger[_0x22fb('0x41')](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x42'),JSON[_0x22fb('0x43')](_0x38245a));});})[_0x22fb('0x40')](function(_0x5caa97){logger['error'](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x44'),JSON[_0x22fb('0x43')](_0x5caa97));});});}logger[_0x22fb('0x25')](_0x1609a7[_0x22fb('0x22')],_0x22fb('0x44'));}};Fax[_0x22fb('0x1d')][_0x22fb('0x1c')]=function(_0x1dcd11){if(this['actions'][_0x1dcd11[_0x22fb('0x22')]]){_[_0x22fb('0x45')](this[_0x22fb('0xd')][_0x1dcd11[_0x22fb('0x22')]],_[_0x22fb('0x46')](_0x1dcd11,[_0x22fb('0x47'),_0x22fb('0x48')]));}};function updateStatus(_0x310bb0){if(_0x310bb0[_0x22fb('0x49')]){faxMessage[_0x22fb('0x4a')](_0x310bb0[_0x22fb('0x49')],{'failMessage':_0x22fb('0x4b')})[_0x22fb('0x3d')](function(_0x3911c6){ut[_0x22fb('0x4c')](_0x22fb('0x4d'),_0x3911c6);})[_0x22fb('0x40')](function(_0x2d2654){ut[_0x22fb('0x4c')](_0x22fb('0x4e'),_0x2d2654);});}else{ut[_0x22fb('0x4c')](_0x22fb('0x4f'));}}Fax[_0x22fb('0x1d')][_0x22fb('0x50')]=function(_0x47c185,_0x5e9903,_0x3773db){var _0x56bb4c=this;var _0x14ce8e={};if(_0x5e9903){_0x14ce8e={'read':_0x5e9903};}else{_0x14ce8e={'failMessage':_0x3773db};}if(this[_0x22fb('0x10')][_0x47c185]['AttachmentId']){faxMessage[_0x22fb('0x4a')](this['actions'][_0x47c185][_0x22fb('0x49')],_0x14ce8e)['then'](function(_0x5d6f62){ut[_0x22fb('0x4c')](_0x22fb('0x51'),_0x5d6f62);})['catch'](function(_0x46827f){ut[_0x22fb('0x4c')](_0x22fb('0x52'),_0x46827f);})['finally'](function(){delete _0x56bb4c[_0x22fb('0xd')][_0x47c185];delete _0x56bb4c['actions'][_0x47c185];});}else{ut[_0x22fb('0x4c')](_0x22fb('0x53'));delete this[_0x22fb('0xd')][_0x47c185];delete this[_0x22fb('0x10')][_0x47c185];}};Fax['prototype'][_0x22fb('0x1a')]=function(_0x583894){var _0x635435=this;if(this['channels'][_0x583894[_0x22fb('0x22')]]){if(this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]){this['channels'][_0x583894[_0x22fb('0x22')]]['id']=this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]['id'];this[_0x22fb('0xd')][_0x583894['uniqueid']][_0x22fb('0x24')]=this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]['name'];}logger[_0x22fb('0x25')](_0x583894[_0x22fb('0x22')],this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]?_0x22fb('0x54'):_0x22fb('0x55'),JSON[_0x22fb('0x43')](this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]]));if(this[_0x22fb('0x10')][_0x583894[_0x22fb('0x22')]]){if(this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]][_0x22fb('0x56')]>0x0&&this[_0x22fb('0xd')][_0x583894[_0x22fb('0x22')]][_0x22fb('0x15')]==='SUCCESS'){this[_0x22fb('0x50')](_0x583894[_0x22fb('0x22')],!![]);}else{this['updateStatus'](_0x583894[_0x22fb('0x22')],![],this['channels'][_0x583894[_0x22fb('0x22')]][_0x22fb('0x57')]?_0x22fb('0x58')+this[_0x22fb('0xd')][_0x583894['uniqueid']][_0x22fb('0x57')]:_0x22fb('0x59'));}}}};Fax['prototype'][_0x22fb('0x5a')]=function(_0x1035c1){var _0x12cae7=this;return new BPromise(function(_0x1e9db8,_0x270049){_0x12cae7['execOriginate'](_0x1035c1,_0x12cae7[_0x22fb('0xe')][_0x1035c1[_0x22fb('0x5b')]])[_0x22fb('0x3d')](function(_0x140243){ut[_0x22fb('0x4c')](_0x22fb('0x5c'),_0x140243);_0x1e9db8(ut[_0x22fb('0x38')](_0x22fb('0x5d')));})[_0x22fb('0x40')](function(_0x2c4bb0){ut[_0x22fb('0x4c')](_0x22fb('0x5e'),_0x2c4bb0);updateStatus(_0x1035c1);_0x270049(ut[_0x22fb('0x38')](_0x22fb('0x5f')));});});};Fax['prototype'][_0x22fb('0x60')]=function(_0x4c0588){var _0x535687=this;return new BPromise(function(_0x47792f,_0x41f9a6){var _0x3e2938=_0x535687[_0x22fb('0x61')](_0x535687[_0x22fb('0xe')][_0x4c0588[_0x22fb('0x5b')]][_0x22fb('0x62')],_0x4c0588);if(_0x3e2938[_0x22fb('0x63')]){_0x47792f(ut[_0x22fb('0x38')](_0x22fb('0x64')));}else{_0x41f9a6(ut['message'](_0x3e2938[_0x22fb('0x38')]));}});};function originate(_0x37df41,_0x142fca,_0xe43c4a){return new BPromise(function(_0x320161,_0x5537c2){if(_0xe43c4a){var _0x3dadf1=util[_0x22fb('0x65')](_0x22fb('0x66'),path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])['name'],_0x37df41['path']);gs[_0x22fb('0x68')](_0x3dadf1)[_0x22fb('0x3d')](function(){_0x37df41[_0x22fb('0x67')]=util[_0x22fb('0x65')]('%s/%s.tif',path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])[_0x22fb('0x69')],path[_0x22fb('0x3a')](_0x37df41[_0x22fb('0x67')])[_0x22fb('0x24')]);_0x142fca['XMF-PATH']=_0x37df41[_0x22fb('0x67')];ut[_0x22fb('0x4c')](_0x22fb('0x6a'),'');ami[_0x22fb('0x6b')](ut[_0x22fb('0x6c')](_0x37df41,_0x142fca))[_0x22fb('0x3d')](function(_0x349eff){_0x320161(_0x349eff);})[_0x22fb('0x40')](function(_0x5de212){_0x5537c2(_0x5de212);});})[_0x22fb('0x40')](function(_0x15aa27){_0x5537c2(_0x15aa27);});}else{ami['Action'](ut[_0x22fb('0x6c')](_0x37df41,_0x142fca))['then'](function(_0x234836){_0x320161(_0x234836);})['catch'](function(_0x483825){_0x5537c2(_0x483825);});}});}Fax[_0x22fb('0x1d')][_0x22fb('0x6d')]=function(_0x2189e5,_0x12557a){var _0x5f3d6a=this;return new BPromise(function(_0x5a3896,_0x318b80){var _0x101dd8=uuid['v4']();var _0xb664ac=ut[_0x22fb('0x6e')](_0x2189e5,_0x12557a);_0x5f3d6a[_0x22fb('0x10')][_0x101dd8]=new Action(_0x101dd8,_0x12557a,_0x2189e5);var _0x51fed3=_0x5f3d6a['actions'][_0x101dd8];if(path[_0x22fb('0x3a')](_0x2189e5[_0x22fb('0x67')])[_0x22fb('0x6f')]===_0x22fb('0x3b')){originate(_0x51fed3,_0xb664ac,!![])[_0x22fb('0x3d')](function(_0x45e1a2){_0x5a3896(_0x45e1a2);})[_0x22fb('0x40')](function(_0x45b4b0){_0x318b80(_0x45b4b0);});}else{originate(_0x51fed3,_0xb664ac,![])['then'](function(_0x3668f2){_0x5a3896(_0x3668f2);})['catch'](function(_0x4c8c32){_0x318b80(_0x4c8c32);});}});};Fax['prototype']['isTrunkReachable']=function(_0x3e6b49){return!_[_0x22fb('0x70')](_0x3e6b49)&&!_['isNil'](_0x3e6b49['name'])&&!_[_0x22fb('0x70')](_0x3e6b49[_0x22fb('0x71')])&&_0x3e6b49[_0x22fb('0x71')]&&!_['isNil'](this[_0x22fb('0xf')][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])])&&!_[_0x22fb('0x70')](this[_0x22fb('0xf')][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49['name'])][_0x22fb('0x2e')])&&(this[_0x22fb('0xf')][util['format'](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])][_0x22fb('0x2e')]===_0x22fb('0x73')||this['trunks'][util[_0x22fb('0x65')](_0x22fb('0x72'),_0x3e6b49[_0x22fb('0x24')])][_0x22fb('0x2e')]==='unmonitored');};Fax[_0x22fb('0x1d')]['checkTrunk']=function(_0x33b8f9,_0x5c4829){if(!this[_0x22fb('0x74')](_0x33b8f9)){ut[_0x22fb('0x4c')](_0x22fb('0x75'),_['isNil'](_0x33b8f9)?'':_0x33b8f9['name']+_0x22fb('0x76'));return{'isValid':![],'message':_0x22fb('0x77')};}if(_[_0x22fb('0x70')](_0x5c4829['fax'])){ut[_0x22fb('0x4c')](_0x22fb('0x78'),JSON[_0x22fb('0x43')](_0x5c4829));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x22fb('0x70')](_0x5c4829['path'])){ut[_0x22fb('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x5c4829));return{'isValid':![],'message':_0x22fb('0x79')};}return{'isValid':!![],'message':_0x22fb('0x7a')};};module[_0x22fb('0x7b')]=Fax; \ No newline at end of file +var _0x9528=['\x20result\x20conversion\x20file\x20','message','create','parse','application/pdf','then','notify','calleridnum','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','format','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isNil','active','SIP/%s','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird','moment','tiff2pdf','./util/gs','fax','../ami','./channel','./util/util','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','syncNewExten','receivefax','syncReceiveFax','hangup','originateresponse','prototype','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','channelstate','channelstatedesc','value','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9528,0xaf));var _0x8952=function(_0x5346a4,_0x3e158f){_0x5346a4=_0x5346a4-0x0;var _0x6dfd42=_0x9528[_0x5346a4];return _0x6dfd42;};'use strict';var util=require(_0x8952('0x0'));var _=require(_0x8952('0x1'));var BPromise=require(_0x8952('0x2'));var uuid=require('uuid');var moment=require(_0x8952('0x3'));var path=require('path');var tiff2pdf=require(_0x8952('0x4'));var gs=require(_0x8952('0x5'));var logger=require('../../../config/logger')(_0x8952('0x6'));var ami=require(_0x8952('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x8952('0x8'));var ut=require(_0x8952('0x9'));var Action=require('./action');var faxAccount=require(_0x8952('0xa'));var attachment=require(_0x8952('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x147904){this[_0x8952('0xc')]={};this[_0x8952('0xd')]=_0x147904[_0x8952('0xd')];this[_0x8952('0xe')]=_0x147904['trunks'];this['actions']={};ami['on'](_0x8952('0xf'),this[_0x8952('0x10')]['bind'](this));ami['on'](_0x8952('0x11'),this[_0x8952('0x12')][_0x8952('0x13')](this));ami['on'](_0x8952('0x14'),this[_0x8952('0x15')][_0x8952('0x13')](this));ami['on'](_0x8952('0x16'),this[_0x8952('0x17')][_0x8952('0x13')](this));ami['on']('faxstatus',this['syncFaxStatus'][_0x8952('0x13')](this));ami['on'](_0x8952('0x18'),this[_0x8952('0x19')][_0x8952('0x13')](this));ami['on'](_0x8952('0x1a'),this['syncHangup'][_0x8952('0x13')](this));ami['on'](_0x8952('0x1b'),this['syncOriginateResponse'][_0x8952('0x13')](this));}Fax[_0x8952('0x1c')][_0x8952('0x10')]=function(_0x917248){if(_0x917248['context']===_0x8952('0x1d')){for(var _0x4ef0e2 in this[_0x8952('0xd')]){if(this[_0x8952('0xd')][_0x8952('0x1e')](_0x4ef0e2)){if(_0x917248[_0x8952('0x1f')]===this[_0x8952('0xd')][_0x4ef0e2][_0x8952('0x20')]){this['channels'][_0x917248[_0x8952('0x21')]]={};this[_0x8952('0xc')][_0x917248['uniqueid']][_0x8952('0x22')]=_0x917248[_0x8952('0x22')];this['channels'][_0x917248[_0x8952('0x21')]]['id']=this[_0x8952('0xd')][_0x4ef0e2]['id'];this['channels'][_0x917248[_0x8952('0x21')]]['name']=this[_0x8952('0xd')][_0x4ef0e2][_0x8952('0x23')];logger[_0x8952('0x24')](_0x917248[_0x8952('0x21')],_0x8952('0x25'));}}}}if(this[_0x8952('0x26')][_0x917248[_0x8952('0x21')]]){this[_0x8952('0xc')][_0x917248[_0x8952('0x21')]]={};this[_0x8952('0xc')][_0x917248[_0x8952('0x21')]]['channel']=_0x917248[_0x8952('0x22')];logger[_0x8952('0x24')](_0x917248[_0x8952('0x21')],_0x8952('0x25'));}};Fax[_0x8952('0x1c')][_0x8952('0x12')]=function(_0x3260fa){if(this[_0x8952('0xc')][_0x3260fa['uniqueid']]){for(var _0x2a63da in _0x3260fa[_0x8952('0x27')]){if(_0x3260fa[_0x8952('0x27')][_0x8952('0x1e')](_0x2a63da)){this[_0x8952('0xc')][_0x3260fa[_0x8952('0x21')]][_0x2a63da]=_0x3260fa['value'];}}}};Fax['prototype'][_0x8952('0x15')]=function(_0x645027){if(this[_0x8952('0xc')][_0x645027[_0x8952('0x21')]]){this[_0x8952('0xc')][_0x645027[_0x8952('0x21')]][_0x8952('0x28')]=_0x645027[_0x8952('0x28')];this[_0x8952('0xc')][_0x645027[_0x8952('0x21')]][_0x8952('0x29')]=_0x645027[_0x8952('0x29')];}};Fax['prototype']['syncNewExten']=function(_0x24e0da){if(this[_0x8952('0xc')][_0x24e0da['uniqueid']]){for(var _0x33ceac in _0x24e0da[_0x8952('0x27')]){if(_0x24e0da[_0x8952('0x27')][_0x8952('0x1e')](_0x33ceac)){this[_0x8952('0xc')][_0x24e0da[_0x8952('0x21')]][_0x33ceac]=_0x24e0da[_0x8952('0x2a')];}}}};Fax[_0x8952('0x1c')]['syncFaxStatus']=function(_0x21ba7f){if(this[_0x8952('0xc')][_0x21ba7f[_0x8952('0x21')]]){this[_0x8952('0xc')][_0x21ba7f['uniqueid']]['operation']=_0x21ba7f[_0x8952('0x2b')];this[_0x8952('0xc')][_0x21ba7f[_0x8952('0x21')]]['status']=_0x21ba7f[_0x8952('0x2c')];this[_0x8952('0xc')][_0x21ba7f[_0x8952('0x21')]][_0x8952('0x20')]=_0x21ba7f[_0x8952('0x20')];this[_0x8952('0xc')][_0x21ba7f['uniqueid']][_0x8952('0x2d')]=_0x21ba7f[_0x8952('0x2d')];logger[_0x8952('0x24')](_0x21ba7f[_0x8952('0x21')],'\x20syncFaxStatus\x20');}};Fax[_0x8952('0x1c')][_0x8952('0x19')]=function(_0x37bab4){var _0x3d7047=this;if(this[_0x8952('0xc')][_0x37bab4['uniqueid']]){var _0x50bf4a=this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]]['id'];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]][_0x8952('0x2e')]=_0x37bab4[_0x8952('0x2e')];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]][_0x8952('0x2f')]=_0x37bab4[_0x8952('0x2f')];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]][_0x8952('0x20')]=_0x37bab4['localstationid'];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]][_0x8952('0x30')]=_0x37bab4['resolution'];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]]['transferrate']=_0x37bab4[_0x8952('0x31')];this['channels'][_0x37bab4[_0x8952('0x21')]][_0x8952('0x2d')]=_0x37bab4[_0x8952('0x2d')];this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]]['calleridnum']=_0x37bab4['calleridnum'];if(this[_0x8952('0xc')][_0x37bab4[_0x8952('0x21')]][_0x8952('0x2f')]>0x0){tiff2pdf(_0x37bab4[_0x8952('0x2d')],_0x8952('0x32'),function(_0x3303c3){logger[_0x8952('0x24')](_0x37bab4[_0x8952('0x21')],_0x8952('0x33'),_0x3303c3[_0x8952('0x34')]);attachment[_0x8952('0x35')]({'name':path[_0x8952('0x36')](_0x37bab4[_0x8952('0x2d')])['name'],'basename':path['parse'](_0x37bab4[_0x8952('0x2d')])[_0x8952('0x23')]+'.pdf','type':_0x8952('0x37')})[_0x8952('0x38')](function(_0xfe2d4a){faxAccount[_0x8952('0x39')](_0x50bf4a,{'from':_0x37bab4[_0x8952('0x3a')],'mapKey':_0x8952('0x6'),'body':path[_0x8952('0x36')](_0x37bab4['filename'])[_0x8952('0x23')]+'.pdf','AttachmentId':_0xfe2d4a['id']})['catch'](function(_0x11c076){logger[_0x8952('0x3b')](_0x37bab4['uniqueid'],_0x8952('0x3c'),JSON[_0x8952('0x3d')](_0x11c076));});})[_0x8952('0x3e')](function(_0x207801){logger[_0x8952('0x3b')](_0x37bab4[_0x8952('0x21')],'\x20receiveFax\x20',JSON[_0x8952('0x3d')](_0x207801));});});}logger[_0x8952('0x24')](_0x37bab4[_0x8952('0x21')],_0x8952('0x3f'));}};Fax[_0x8952('0x1c')][_0x8952('0x40')]=function(_0x2172bc){if(this[_0x8952('0x26')][_0x2172bc['uniqueid']]){_[_0x8952('0x41')](this['channels'][_0x2172bc['uniqueid']],_['pick'](_0x2172bc,[_0x8952('0x42'),_0x8952('0x43')]));}};function updateStatus(_0x483dfc){if(_0x483dfc[_0x8952('0x44')]){faxMessage[_0x8952('0x45')](_0x483dfc[_0x8952('0x44')],{'failMessage':_0x8952('0x46')})[_0x8952('0x38')](function(_0x3326d8){ut[_0x8952('0x47')]('[Fax][Message][Error][Updated]',_0x3326d8);})[_0x8952('0x3e')](function(_0x47471a){ut[_0x8952('0x47')](_0x8952('0x48'),_0x47471a);});}else{ut[_0x8952('0x47')](_0x8952('0x49'));}}Fax[_0x8952('0x1c')][_0x8952('0x4a')]=function(_0x105396,_0x1f75fb,_0x560a1c){var _0x44e3a5=this;var _0xefa7dd={};if(_0x1f75fb){_0xefa7dd={'read':_0x1f75fb};}else{_0xefa7dd={'failMessage':_0x560a1c};}if(this[_0x8952('0x26')][_0x105396][_0x8952('0x44')]){faxMessage['update'](this[_0x8952('0x26')][_0x105396][_0x8952('0x44')],_0xefa7dd)[_0x8952('0x38')](function(_0x186d29){ut[_0x8952('0x47')]('[Fax][Message][Updated]',_0x186d29);})['catch'](function(_0x5d2cd1){ut[_0x8952('0x47')](_0x8952('0x4b'),_0x5d2cd1);})[_0x8952('0x4c')](function(){delete _0x44e3a5['channels'][_0x105396];delete _0x44e3a5[_0x8952('0x26')][_0x105396];});}else{ut[_0x8952('0x47')]('[Fax][Message][NoUpdate2]');delete this[_0x8952('0xc')][_0x105396];delete this[_0x8952('0x26')][_0x105396];}};Fax[_0x8952('0x1c')][_0x8952('0x4d')]=function(_0x415fd0){var _0xa60b0b=this;if(this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]){if(this[_0x8952('0x26')][_0x415fd0['uniqueid']]){this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]['id']=this[_0x8952('0x26')][_0x415fd0[_0x8952('0x21')]]['id'];this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]['name']=this[_0x8952('0x26')][_0x415fd0[_0x8952('0x21')]][_0x8952('0x23')];}logger['info'](_0x415fd0[_0x8952('0x21')],this[_0x8952('0x26')][_0x415fd0[_0x8952('0x21')]]?_0x8952('0x4e'):_0x8952('0x4f'),JSON[_0x8952('0x3d')](this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]));if(this[_0x8952('0x26')][_0x415fd0[_0x8952('0x21')]]){if(this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]['faxpages']>0x0&&this[_0x8952('0xc')][_0x415fd0[_0x8952('0x21')]]['faxstatus']===_0x8952('0x50')){this[_0x8952('0x4a')](_0x415fd0['uniqueid'],!![]);}else{this[_0x8952('0x4a')](_0x415fd0[_0x8952('0x21')],![],this['channels'][_0x415fd0[_0x8952('0x21')]]['faxstatusstring']?_0x8952('0x51')+this['channels'][_0x415fd0[_0x8952('0x21')]][_0x8952('0x52')]:_0x8952('0x53'));}}}};Fax[_0x8952('0x1c')]['send']=function(_0x57b200){var _0x17cbb5=this;return new BPromise(function(_0x76d6ea,_0x70624a){_0x17cbb5[_0x8952('0x54')](_0x57b200,_0x17cbb5['faxAccounts'][_0x57b200[_0x8952('0x55')]])[_0x8952('0x38')](function(_0x194996){ut[_0x8952('0x47')]('[Fax][execOriginate][success]',_0x194996);_0x76d6ea(ut['message'](_0x8952('0x56')));})['catch'](function(_0x4dc540){ut[_0x8952('0x47')](_0x8952('0x57'),_0x4dc540);updateStatus(_0x57b200);_0x70624a(ut[_0x8952('0x34')](_0x8952('0x58')));});});};Fax[_0x8952('0x1c')][_0x8952('0x59')]=function(_0x3e958a){var _0x2670f5=this;return new BPromise(function(_0x49dc8e,_0x4209d7){var _0x4d23cc=_0x2670f5[_0x8952('0x5a')](_0x2670f5[_0x8952('0xd')][_0x3e958a[_0x8952('0x55')]][_0x8952('0x5b')],_0x3e958a);if(_0x4d23cc['isValid']){_0x49dc8e(ut[_0x8952('0x34')]('Trunk\x20Reachable'));}else{_0x4209d7(ut['message'](_0x4d23cc['message']));}});};function originate(_0x28e3d9,_0x5d1c1d,_0x28c2a3){return new BPromise(function(_0x48ae76,_0x2c0da0){if(_0x28c2a3){var _0x38bd8c=util['format'](_0x8952('0x5c'),path[_0x8952('0x36')](_0x28e3d9[_0x8952('0x5d')])['name'],_0x28e3d9[_0x8952('0x5d')]);gs['execute'](_0x38bd8c)[_0x8952('0x38')](function(){_0x28e3d9[_0x8952('0x5d')]=util[_0x8952('0x5e')](_0x8952('0x5f'),path[_0x8952('0x36')](_0x28e3d9['path'])[_0x8952('0x60')],path[_0x8952('0x36')](_0x28e3d9['path'])[_0x8952('0x23')]);_0x5d1c1d[_0x8952('0x61')]=_0x28e3d9[_0x8952('0x5d')];ut[_0x8952('0x47')](_0x8952('0x62'),'');ami['Action'](ut['variablesAction'](_0x28e3d9,_0x5d1c1d))[_0x8952('0x38')](function(_0x1233c1){_0x48ae76(_0x1233c1);})[_0x8952('0x3e')](function(_0x2c9730){_0x2c0da0(_0x2c9730);});})[_0x8952('0x3e')](function(_0x11556c){_0x2c0da0(_0x11556c);});}else{ami[_0x8952('0x63')](ut['variablesAction'](_0x28e3d9,_0x5d1c1d))['then'](function(_0x573591){_0x48ae76(_0x573591);})['catch'](function(_0x1335ef){_0x2c0da0(_0x1335ef);});}});}Fax['prototype'][_0x8952('0x54')]=function(_0x1bf044,_0x5f438d){var _0x3d4830=this;return new BPromise(function(_0x144ef6,_0x3aca1a){var _0x50f063=uuid['v4']();var _0x2d5641=ut[_0x8952('0x64')](_0x1bf044,_0x5f438d);_0x3d4830[_0x8952('0x26')][_0x50f063]=new Action(_0x50f063,_0x5f438d,_0x1bf044);var _0x4d0c9b=_0x3d4830[_0x8952('0x26')][_0x50f063];if(path[_0x8952('0x36')](_0x1bf044[_0x8952('0x5d')])[_0x8952('0x65')]==='.pdf'){originate(_0x4d0c9b,_0x2d5641,!![])[_0x8952('0x38')](function(_0x4d4f96){_0x144ef6(_0x4d4f96);})['catch'](function(_0x41c0df){_0x3aca1a(_0x41c0df);});}else{originate(_0x4d0c9b,_0x2d5641,![])[_0x8952('0x38')](function(_0x4333fa){_0x144ef6(_0x4333fa);})[_0x8952('0x3e')](function(_0x1f757c){_0x3aca1a(_0x1f757c);});}});};Fax['prototype']['isTrunkReachable']=function(_0x13140e){return!_[_0x8952('0x66')](_0x13140e)&&!_[_0x8952('0x66')](_0x13140e[_0x8952('0x23')])&&!_[_0x8952('0x66')](_0x13140e[_0x8952('0x67')])&&_0x13140e[_0x8952('0x67')]&&!_[_0x8952('0x66')](this['trunks'][util[_0x8952('0x5e')](_0x8952('0x68'),_0x13140e[_0x8952('0x23')])])&&!_[_0x8952('0x66')](this['trunks'][util[_0x8952('0x5e')](_0x8952('0x68'),_0x13140e['name'])][_0x8952('0x2c')])&&(this[_0x8952('0xe')][util['format'](_0x8952('0x68'),_0x13140e['name'])][_0x8952('0x2c')]==='reachable'||this[_0x8952('0xe')][util['format'](_0x8952('0x68'),_0x13140e['name'])]['status']===_0x8952('0x69'));};Fax[_0x8952('0x1c')]['checkTrunk']=function(_0x284dcf,_0x31dc98){if(!this[_0x8952('0x6a')](_0x284dcf)){ut[_0x8952('0x47')](_0x8952('0x6b'),_[_0x8952('0x66')](_0x284dcf)?'':_0x284dcf[_0x8952('0x23')]+_0x8952('0x6c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x8952('0x66')](_0x31dc98[_0x8952('0x6')])){ut[_0x8952('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8952('0x3d')](_0x31dc98));return{'isValid':![],'message':_0x8952('0x6d')};}if(_[_0x8952('0x66')](_0x31dc98[_0x8952('0x5d')])){ut[_0x8952('0x47')](_0x8952('0x6e'),JSON[_0x8952('0x3d')](_0x31dc98));return{'isValid':![],'message':_0x8952('0x6f')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x8952('0x70')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 753a552..c71e709 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 _0x3068=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x3d6811,_0x111fcd){var _0x4e9325=function(_0x51580f){while(--_0x51580f){_0x3d6811['push'](_0x3d6811['shift']());}};_0x4e9325(++_0x111fcd);}(_0x3068,0xd5));var _0x8306=function(_0x3d48c6,_0x3ca23b){_0x3d48c6=_0x3d48c6-0x0;var _0x1cd3c5=_0x3068[_0x3d48c6];return _0x1cd3c5;};'use strict';var util=require(_0x8306('0x0'));var BPromise=require(_0x8306('0x1'));var logger=require(_0x8306('0x2'))(_0x8306('0x3'));var _=require(_0x8306('0x4'));var faxAccount=require(_0x8306('0x5'));function loggerCatch(_0x58c4e5){return function(_0x322d85){logger['error'](_0x58c4e5,util[_0x8306('0x6')](_0x322d85,{'showHidden':![],'depth':null}));};}exports[_0x8306('0x7')]=function(_0x511715,_0x42a66c){return BPromise['resolve']()['then'](faxAccount[_0x8306('0x7')](_0x511715,_0x42a66c))[_0x8306('0x8')](loggerCatch(_0x8306('0x9')));}; \ No newline at end of file +var _0xc2ff=['then','notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve'];(function(_0x5df4ce,_0x368d3f){var _0x2aef63=function(_0x4c2cd7){while(--_0x4c2cd7){_0x5df4ce['push'](_0x5df4ce['shift']());}};_0x2aef63(++_0x368d3f);}(_0xc2ff,0x13c));var _0xfc2f=function(_0x8bda20,_0x52ad98){_0x8bda20=_0x8bda20-0x0;var _0x29407b=_0xc2ff[_0x8bda20];return _0x29407b;};'use strict';var util=require(_0xfc2f('0x0'));var BPromise=require(_0xfc2f('0x1'));var logger=require(_0xfc2f('0x2'))(_0xfc2f('0x3'));var _=require(_0xfc2f('0x4'));var faxAccount=require(_0xfc2f('0x5'));function loggerCatch(_0x22b049){return function(_0x761e){logger[_0xfc2f('0x6')](_0x22b049,util[_0xfc2f('0x7')](_0x761e,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0xc10c74,_0x495e84){return BPromise[_0xfc2f('0x8')]()[_0xfc2f('0x9')](faxAccount[_0xfc2f('0xa')](_0xc10c74,_0x495e84))[_0xfc2f('0xb')](loggerCatch(_0xfc2f('0xc')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 584d48f..f13a30a 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 _0x7859=['inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute','Exec\x20gs','info'];(function(_0x3e284d,_0x42c938){var _0x278746=function(_0xde3859){while(--_0xde3859){_0x3e284d['push'](_0x3e284d['shift']());}};_0x278746(++_0x42c938);}(_0x7859,0x83));var _0x9785=function(_0x46dba8,_0x15f02e){_0x46dba8=_0x46dba8-0x0;var _0x35614e=_0x7859[_0x46dba8];return _0x35614e;};'use strict';var util=require(_0x9785('0x0'));var logger=require(_0x9785('0x1'))(_0x9785('0x2'));var BPromise=require(_0x9785('0x3'));var exec=require(_0x9785('0x4'))[_0x9785('0x5')];exports[_0x9785('0x6')]=function(_0x3df42e){return new BPromise(function(_0x4b1fc2,_0x5cf5bb){exec(_0x3df42e,function(_0x2d1f41,_0x7fc525,_0x51a1ae){logger['info'](_0x9785('0x7'),_0x7fc525);if(_0x2d1f41){logger[_0x9785('0x8')](_0x9785('0x7'),'\x20Error\x20:',util[_0x9785('0x9')](_0x2d1f41,{'showHidden':![],'depth':null}),_0x7fc525,_0x51a1ae);_0x5cf5bb(_0x2d1f41);}_0x4b1fc2(_0x7fc525);});});}; \ No newline at end of file +var _0x15a4=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x236e4b,_0x136c92){var _0x5cce4e=function(_0x4c29eb){while(--_0x4c29eb){_0x236e4b['push'](_0x236e4b['shift']());}};_0x5cce4e(++_0x136c92);}(_0x15a4,0xa0));var _0x415a=function(_0xb3f7a5,_0xb2a175){_0xb3f7a5=_0xb3f7a5-0x0;var _0x357045=_0x15a4[_0xb3f7a5];return _0x357045;};'use strict';var util=require('util');var logger=require(_0x415a('0x0'))(_0x415a('0x1'));var BPromise=require('bluebird');var exec=require(_0x415a('0x2'))[_0x415a('0x3')];exports[_0x415a('0x4')]=function(_0x4948ef){return new BPromise(function(_0x3342da,_0x4c0316){exec(_0x4948ef,function(_0x1a4506,_0x4bd325,_0x2b26b8){logger[_0x415a('0x5')](_0x415a('0x6'),_0x4bd325);if(_0x1a4506){logger[_0x415a('0x5')](_0x415a('0x6'),_0x415a('0x7'),util[_0x415a('0x8')](_0x1a4506,{'showHidden':![],'depth':null}),_0x4bd325,_0x2b26b8);_0x4c0316(_0x1a4506);}_0x3342da(_0x4bd325);});});}; \ 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 2cb21f3..08f86c4 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 _0x842f=['uniqueid','originate','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','minrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','path','variablesAction'];(function(_0xa66be4,_0x1b2845){var _0x199af6=function(_0x116479){while(--_0x116479){_0xa66be4['push'](_0xa66be4['shift']());}};_0x199af6(++_0x1b2845);}(_0x842f,0x12f));var _0xf842=function(_0x4c6bca,_0x3de390){_0x4c6bca=_0x4c6bca-0x0;var _0x29d58e=_0x842f[_0x4c6bca];return _0x29d58e;};'use strict';var util=require(_0xf842('0x0'));var _=require(_0xf842('0x1'));var moment=require(_0xf842('0x2'));var logger=require(_0xf842('0x3'))(_0xf842('0x4'));exports[_0xf842('0x5')]=function(_0x11a9c3){return{'message':_0x11a9c3};};exports[_0xf842('0x6')]=function(_0x37cfa0,_0x41449d){logger['info'](_0x37cfa0,util[_0xf842('0x7')](_0x41449d,{'showHidden':![],'depth':null}));};exports[_0xf842('0x8')]=function(_0x17580c,_0x2568b1){var _0x11a36c={'XMF-ECM':_0x2568b1[_0xf842('0x9')],'XMF-HEADERINFO':_0x2568b1['headerinfo'],'XMF-MINRATE':_0x2568b1[_0xf842('0xa')],'XMF-MAXRATE':_0x2568b1['maxrate'],'XMF-MODEM':util[_0xf842('0xb')](_0xf842('0xc'),_0x2568b1[_0xf842('0xd')]),'XMF-GATEWAY':_0x2568b1[_0xf842('0xe')],'XMF-FAXDETECT':_0x2568b1['faxdetect'],'XMF-T38TIMEOUT':_0x2568b1[_0xf842('0xf')],'XMF-LOCALSTATIONID':_0x2568b1[_0xf842('0x10')],'XMF-PATH':_0x17580c[_0xf842('0x11')]};return _0x11a36c;};exports[_0xf842('0x12')]=function(_0x3cb133,_0x5f153e){return{'actionid':_0x3cb133[_0xf842('0x13')],'action':_0xf842('0x14'),'channel':_0x3cb133['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util['format'](_0xf842('0x15'),_0x3cb133[_0xf842('0x16')]?_0x3cb133[_0xf842('0x16')]:'',_0x3cb133[_0xf842('0x10')]),'variable':_0x5f153e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3cb133[_0xf842('0x13')]};}; \ No newline at end of file +var _0xe1f5=['util','lodash','../../../../config/logger','fax','message','info','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','uniqueid'];(function(_0x461c18,_0x5605b9){var _0x35501c=function(_0x1cd251){while(--_0x1cd251){_0x461c18['push'](_0x461c18['shift']());}};_0x35501c(++_0x5605b9);}(_0xe1f5,0x73));var _0x5e1f=function(_0x4913f3,_0xea47ea){_0x4913f3=_0x4913f3-0x0;var _0x4e8021=_0xe1f5[_0x4913f3];return _0x4e8021;};'use strict';var util=require(_0x5e1f('0x0'));var _=require(_0x5e1f('0x1'));var moment=require('moment');var logger=require(_0x5e1f('0x2'))(_0x5e1f('0x3'));exports[_0x5e1f('0x4')]=function(_0x162647){return{'message':_0x162647};};exports['logger']=function(_0x4c765b,_0x2ab175){logger[_0x5e1f('0x5')](_0x4c765b,util[_0x5e1f('0x6')](_0x2ab175,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x3d1f6b,_0x3a3174){var _0xeabba2={'XMF-ECM':_0x3a3174[_0x5e1f('0x7')],'XMF-HEADERINFO':_0x3a3174[_0x5e1f('0x8')],'XMF-MINRATE':_0x3a3174[_0x5e1f('0x9')],'XMF-MAXRATE':_0x3a3174[_0x5e1f('0xa')],'XMF-MODEM':util[_0x5e1f('0xb')](_0x5e1f('0xc'),_0x3a3174[_0x5e1f('0xd')]),'XMF-GATEWAY':_0x3a3174['gateway'],'XMF-FAXDETECT':_0x3a3174['faxdetect'],'XMF-T38TIMEOUT':_0x3a3174[_0x5e1f('0xe')],'XMF-LOCALSTATIONID':_0x3a3174[_0x5e1f('0xf')],'XMF-PATH':_0x3d1f6b[_0x5e1f('0x10')]};return _0xeabba2;};exports[_0x5e1f('0x11')]=function(_0x4c8387,_0x577e53){return{'actionid':_0x4c8387['uniqueid'],'action':_0x5e1f('0x12'),'channel':_0x4c8387[_0x5e1f('0x13')],'Exten':_0x5e1f('0x14'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x5e1f('0x15'),_0x4c8387[_0x5e1f('0x8')]?_0x4c8387['headerinfo']:'',_0x4c8387[_0x5e1f('0xf')]),'variable':_0x577e53,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4c8387[_0x5e1f('0x16')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index bdb60ea..36c40c3 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 _0x8c6f=['./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','ami','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','error','[index.js][initParams]','inspect','sync','[index.js][main]','bluebird','util','moment','./acw','./trigger','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension'];(function(_0x117f87,_0x4a1be5){var _0x3b46ad=function(_0x36e7e0){while(--_0x36e7e0){_0x117f87['push'](_0x117f87['shift']());}};_0x3b46ad(++_0x4a1be5);}(_0x8c6f,0x101));var _0xf8c6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8c6f[_0x1cc8fe];return _0x230054;};'use strict';var BPromise=require(_0xf8c6('0x0'));var util=require(_0xf8c6('0x1'));var moment=require(_0xf8c6('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xf8c6('0x3'));var Trigger=require(_0xf8c6('0x4'));var Dialer=require('./dialer');var Preview=require(_0xf8c6('0x5'));var Fax=require('./fax');var user=require(_0xf8c6('0x6'));var voiceQueue=require(_0xf8c6('0x7'));var voiceQueueReport=require(_0xf8c6('0x8'));var voiceCallReport=require(_0xf8c6('0x9'));var trunk=require('./rpc/trunk');var trigger=require(_0xf8c6('0xa'));var template=require(_0xf8c6('0xb'));var cmHopperHistory=require(_0xf8c6('0xc'));var campaign=require(_0xf8c6('0xd'));var voiceExtension=require(_0xf8c6('0xe'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xf8c6('0xf'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xf8c6('0x10'));var freshdesk=require(_0xf8c6('0x11'));var desk=require(_0xf8c6('0x12'));var zoho=require(_0xf8c6('0x13'));var vtiger=require(_0xf8c6('0x14'));var freshsales=require(_0xf8c6('0x15'));var servicenow=require(_0xf8c6('0x16'));var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xf8c6('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf8c6('0x18')](_0xf8c6('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xf8c6('0x18')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf8c6('0x1a')]()['then'](user[_0xf8c6('0x1b')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x1d')]())[_0xf8c6('0x1c')](user[_0xf8c6('0x1e')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x1f')]())['then'](trunk['getTrunks']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x20')]())[_0xf8c6('0x1c')](voiceQueue[_0xf8c6('0x21')]())[_0xf8c6('0x1c')](realtime['initVoiceQueues']())[_0xf8c6('0x1c')](trigger['getTriggers']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x22')]())['then'](template[_0xf8c6('0x23')]())[_0xf8c6('0x1c')](realtime['initTemplates']())[_0xf8c6('0x1c')](zendesk[_0xf8c6('0x24')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x25')]())[_0xf8c6('0x1c')](salesforce[_0xf8c6('0x26')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x27')]())[_0xf8c6('0x1c')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xf8c6('0x28')]())['then'](freshdesk[_0xf8c6('0x29')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x2a')]())[_0xf8c6('0x1c')](desk[_0xf8c6('0x2b')]())['then'](realtime[_0xf8c6('0x2c')]())[_0xf8c6('0x1c')](zoho[_0xf8c6('0x2d')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x2e')]())[_0xf8c6('0x1c')](vtiger['getVtigerAccounts']())['then'](realtime['initVtigerAccounts']())[_0xf8c6('0x1c')](freshsales[_0xf8c6('0x2f')]())['then'](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xf8c6('0x30')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x31')]())[_0xf8c6('0x1c')](dynamics365[_0xf8c6('0x32')]())[_0xf8c6('0x1c')](realtime['initDynamics365Accounts']())[_0xf8c6('0x1c')](campaign[_0xf8c6('0x33')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x34')]())[_0xf8c6('0x1c')](voiceExtension['getVoiceExtensions']())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x35')]())[_0xf8c6('0x1c')](faxAccount[_0xf8c6('0x36')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x37')]())[_0xf8c6('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xf8c6('0x1a')]()[_0xf8c6('0x1c')](voiceQueueReport[_0xf8c6('0x38')]())['then'](realtime[_0xf8c6('0x39')]())[_0xf8c6('0x1c')](cmHopperHistory[_0xf8c6('0x3a')]())[_0xf8c6('0x1c')](realtime[_0xf8c6('0x3b')]())[_0xf8c6('0x1c')](cmHopperHistory[_0xf8c6('0x3c')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xf8c6('0x3d')]())[_0xf8c6('0x1c')](realtime['initVoiceCallReports']())[_0xf8c6('0x3e')](function(_0x4bdef5){logger[_0xf8c6('0x3f')](_0xf8c6('0x40'),util[_0xf8c6('0x41')](_0x4bdef5,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xf8c6('0x1c')](function(_0x558898){return initRealtime();})['then'](function(){return initParams();})[_0xf8c6('0x1c')](function(){report[_0xf8c6('0x42')]();setInterval(initRealtime,0x1388);})[_0xf8c6('0x3e')](function(_0x3d69bb){logger['error'](_0xf8c6('0x43'),util[_0xf8c6('0x41')](_0x3d69bb,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x0ab9=['./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk'];(function(_0x508d1,_0xc0c0e5){var _0x322d8d=function(_0x51b75f){while(--_0x51b75f){_0x508d1['push'](_0x508d1['shift']());}};_0x322d8d(++_0xc0c0e5);}(_0x0ab9,0x101));var _0x90ab=function(_0x308a79,_0x58a4f9){_0x308a79=_0x308a79-0x0;var _0x4d2e3a=_0x0ab9[_0x308a79];return _0x4d2e3a;};'use strict';var BPromise=require('bluebird');var util=require(_0x90ab('0x0'));var moment=require(_0x90ab('0x1'));var server=require(_0x90ab('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require('./acw');var Trigger=require(_0x90ab('0x3'));var Dialer=require(_0x90ab('0x4'));var Preview=require(_0x90ab('0x5'));var Fax=require('./fax');var user=require(_0x90ab('0x6'));var voiceQueue=require(_0x90ab('0x7'));var voiceQueueReport=require(_0x90ab('0x8'));var voiceCallReport=require(_0x90ab('0x9'));var trunk=require(_0x90ab('0xa'));var trigger=require(_0x90ab('0xb'));var template=require(_0x90ab('0xc'));var cmHopperHistory=require(_0x90ab('0xd'));var campaign=require(_0x90ab('0xe'));var voiceExtension=require(_0x90ab('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0x90ab('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x90ab('0x11'));var freshdesk=require(_0x90ab('0x12'));var desk=require(_0x90ab('0x13'));var zoho=require(_0x90ab('0x14'));var vtiger=require(_0x90ab('0x15'));var freshsales=require(_0x90ab('0x16'));var servicenow=require(_0x90ab('0x17'));var dynamics365=require(_0x90ab('0x18'));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(_0x90ab('0x19'))(_0x90ab('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x90ab('0x1b')](_0x90ab('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x90ab('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x90ab('0x1d')]()[_0x90ab('0x1e')](user[_0x90ab('0x1f')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x20')]())[_0x90ab('0x1e')](user['getTelephones']())['then'](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0x90ab('0x1e')](realtime[_0x90ab('0x21')]())[_0x90ab('0x1e')](voiceQueue[_0x90ab('0x22')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x23')]())['then'](trigger[_0x90ab('0x24')]())['then'](realtime['initTriggers']())[_0x90ab('0x1e')](template['getTemplates']())['then'](realtime[_0x90ab('0x25')]())[_0x90ab('0x1e')](zendesk[_0x90ab('0x26')]())[_0x90ab('0x1e')](realtime['initZendeskAccounts']())[_0x90ab('0x1e')](salesforce['getSalesforceAccounts']())[_0x90ab('0x1e')](realtime['initSalesforceAccounts']())[_0x90ab('0x1e')](sugarcrm[_0x90ab('0x27')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x28')]())['then'](freshdesk[_0x90ab('0x29')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x2a')]())['then'](desk['getDeskAccounts']())['then'](realtime[_0x90ab('0x2b')]())[_0x90ab('0x1e')](zoho[_0x90ab('0x2c')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x2d')]())[_0x90ab('0x1e')](vtiger[_0x90ab('0x2e')]())[_0x90ab('0x1e')](realtime['initVtigerAccounts']())[_0x90ab('0x1e')](freshsales[_0x90ab('0x2f')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x30')]())[_0x90ab('0x1e')](servicenow[_0x90ab('0x31')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x32')]())[_0x90ab('0x1e')](dynamics365[_0x90ab('0x33')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x34')]())[_0x90ab('0x1e')](campaign[_0x90ab('0x35')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x36')]())[_0x90ab('0x1e')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x90ab('0x37')]())[_0x90ab('0x1e')](faxAccount[_0x90ab('0x38')]())[_0x90ab('0x1e')](realtime['initFaxAccounts']())[_0x90ab('0x1e')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x90ab('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x90ab('0x1e')](realtime[_0x90ab('0x39')]())[_0x90ab('0x1e')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x90ab('0x1e')](realtime[_0x90ab('0x3a')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0x90ab('0x1e')](realtime[_0x90ab('0x3b')]())[_0x90ab('0x1e')](voiceCallReport[_0x90ab('0x3c')]())[_0x90ab('0x1e')](realtime[_0x90ab('0x3d')]())[_0x90ab('0x3e')](function(_0x183572){logger[_0x90ab('0x3f')](_0x90ab('0x40'),util[_0x90ab('0x41')](_0x183572,{'showHidden':![],'depth':null}));});}function main(){return server[_0x90ab('0x42')](realtime,preview,fax)[_0x90ab('0x1e')](function(_0x3f73af){return initRealtime();})[_0x90ab('0x1e')](function(){return initParams();})[_0x90ab('0x1e')](function(){report[_0x90ab('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x221e76){logger[_0x90ab('0x3f')](_0x90ab('0x44'),util[_0x90ab('0x41')](_0x221e76,{'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 4b3ca3d..d0330b3 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x39cff5,_0x234f0c){var _0x430437=function(_0xb2375){while(--_0xb2375){_0x39cff5['push'](_0x39cff5['shift']());}};_0x430437(++_0x234f0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file +var _0xa9e0=['stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','md5','prototype','updateStatusRealtime','not_inuse','inuse','talking','statePause','toNumber','format','fullname','stringify','user:%s','emit','user:save','user:presence','exports','lodash','util','moment','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','state','unknown'];(function(_0x5c6a78,_0x5c0503){var _0x236c5e=function(_0x44ef45){while(--_0x44ef45){_0x5c6a78['push'](_0x5c6a78['shift']());}};_0x236c5e(++_0x5c0503);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));config['redis']=_[_0x0a9e('0x4')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x6'),'port':0x18eb});var io=require(_0x0a9e('0x7'))(new Redis(config[_0x0a9e('0x5')]));function Agent(_0x57b080){this['id']=_0x57b080['id']||0x0;this[_0x0a9e('0x8')]=_0x57b080[_0x0a9e('0x8')]||'';this[_0x0a9e('0x9')]=_0x57b080['email']||'';this['accountcode']=_0x57b080[_0x0a9e('0xa')]||'';this['fullname']=_0x57b080['fullname']||'';this[_0x0a9e('0xb')]=_0x0a9e('0xc');this[_0x0a9e('0xd')]=0x0;this[_0x0a9e('0xe')]=_0x0a9e('0xc');this[_0x0a9e('0xf')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x57b080[_0x0a9e('0x10')]||![];this[_0x0a9e('0x11')]=_0x0a9e('0xc');this[_0x0a9e('0x12')]=0x0;this[_0x0a9e('0x13')]='';this[_0x0a9e('0x14')]='';this['onhold']=![];this[_0x0a9e('0x15')]=![];this[_0x0a9e('0x16')]='';}Agent[_0x0a9e('0x17')][_0x0a9e('0x18')]=function(_0x44dcfd){var _0x4d5611;if(_0x44dcfd&&_0x44dcfd['state']){_0x4d5611=_0x44dcfd[_0x0a9e('0xb')]['toLowerCase']();switch(_0x4d5611){case _0x0a9e('0x19'):_0x4d5611='idle';break;case _0x0a9e('0x1a'):_0x4d5611=_0x0a9e('0x1b');break;}}if(_0x4d5611&&this['voiceStatus']!==_0x4d5611||_0x44dcfd[_0x0a9e('0x1c')]){this['voiceStatusTime']=_[_0x0a9e('0x1d')](moment()[_0x0a9e('0x1e')]('x'));}if(_0x4d5611){this[_0x0a9e('0x11')]=_0x4d5611;}var _0x205fd6={'id':this['id'],'name':this[_0x0a9e('0x8')],'email':this[_0x0a9e('0x9')],'accountcode':this[_0x0a9e('0xa')],'fullname':this[_0x0a9e('0x1f')],'state':this[_0x0a9e('0xb')],'stateTime':this[_0x0a9e('0xd')],'status':this[_0x0a9e('0xe')],'address':this[_0x0a9e('0xf')],'online':this['online'],'voiceStatus':this[_0x0a9e('0x11')],'voiceStatusTime':this[_0x0a9e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x0a9e('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0x3a02e1=md5(JSON[_0x0a9e('0x20')](_0x205fd6));if(this[_0x0a9e('0x16')]!==_0x3a02e1){this[_0x0a9e('0x16')]=_0x3a02e1;io['to'](util['format'](_0x0a9e('0x21'),_0x205fd6[_0x0a9e('0x8')]))[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x205fd6);io[_0x0a9e('0x22')](_0x0a9e('0x24'),_0x205fd6);}};module[_0x0a9e('0x25')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 42acd7d..bed44d2 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 _0xa607=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','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'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa607,0x167));var _0x7a60=function(_0x22de84,_0x56142b){_0x22de84=_0x22de84-0x0;var _0x54fc49=_0xa607[_0x22de84];return _0x54fc49;};'use strict';function Campaign(_0x126530){this['id']=_0x126530['id']||0x0;this[_0x7a60('0x0')]=_0x126530['name']||'';this[_0x7a60('0x1')]=_0x126530[_0x7a60('0x1')]||'campaign';this[_0x7a60('0x2')]=0x0;this['temp']=0x0;this[_0x7a60('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x7a60('0x4')]='';this['sendMessageOneNotActive']=!![];this[_0x7a60('0x5')]=_0x126530[_0x7a60('0x5')];this[_0x7a60('0x6')]=_0x126530[_0x7a60('0x6')];this[_0x7a60('0x7')]=_0x126530[_0x7a60('0x7')]||null;this[_0x7a60('0x8')]=_0x126530['dialGlobalInterval']?_0x126530[_0x7a60('0x8')]:null;this[_0x7a60('0x9')]=_0x126530[_0x7a60('0x9')];this[_0x7a60('0xa')]=_0x126530['dialOriginateCallerIdNumber'];this[_0x7a60('0xb')]=_0x126530['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x126530[_0x7a60('0xc')];this['dialCongestionRetryFrequency']=_0x126530[_0x7a60('0xd')];this[_0x7a60('0xe')]=_0x126530[_0x7a60('0xe')];this[_0x7a60('0xf')]=_0x126530[_0x7a60('0xf')];this[_0x7a60('0x10')]=_0x126530[_0x7a60('0x10')];this[_0x7a60('0x11')]=_0x126530[_0x7a60('0x11')];this['dialGlobalMaxRetry']=_0x126530[_0x7a60('0x12')];this[_0x7a60('0x13')]=_0x126530[_0x7a60('0x13')]||0x3;this[_0x7a60('0x14')]=_0x126530[_0x7a60('0x14')]||0x96;this[_0x7a60('0x15')]=_0x126530[_0x7a60('0x15')]||0x3;this[_0x7a60('0x16')]=_0x126530[_0x7a60('0x16')]||0x96;this['dialAbandonedMaxRetry']=_0x126530[_0x7a60('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x126530[_0x7a60('0x18')]||0x96;this['dialMachineMaxRetry']=_0x126530[_0x7a60('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x126530[_0x7a60('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x126530[_0x7a60('0x1b')]||0x3;this[_0x7a60('0x1c')]=_0x126530['dialAgentRejectRetryFrequency']||0x96;this[_0x7a60('0x1d')]=_0x126530[_0x7a60('0x1d')]||_0x7a60('0x1e');this['dialPrefix']=_0x126530[_0x7a60('0x1f')]||undefined;this[_0x7a60('0x20')]=_0x126530[_0x7a60('0x20')]||undefined;this[_0x7a60('0x21')]=_0x126530['dialCutDigit']||undefined;this[_0x7a60('0x22')]=_0x126530[_0x7a60('0x22')]?_0x126530[_0x7a60('0x22')]:undefined;this[_0x7a60('0x23')]=_0x126530['Trunk']?_0x126530[_0x7a60('0x23')]:undefined;this[_0x7a60('0x24')]=_0x126530[_0x7a60('0x24')]?_0x126530[_0x7a60('0x24')]:undefined;this['SquareProject']=_0x126530[_0x7a60('0x25')]?_0x126530['SquareProject']:undefined;this[_0x7a60('0x26')]=_0x126530['SquareProject']?_0x126530[_0x7a60('0x25')]['name']:undefined;this['dialAMDActive']=_0x126530[_0x7a60('0x27')]||![];this[_0x7a60('0x28')]=_0x126530[_0x7a60('0x28')];this[_0x7a60('0x29')]=_0x126530[_0x7a60('0x29')];this['dialAMDAfterGreetingSilence']=_0x126530[_0x7a60('0x2a')];this['dialAMDTotalAnalysisTime']=_0x126530[_0x7a60('0x2b')];this[_0x7a60('0x2c')]=_0x126530[_0x7a60('0x2c')];this[_0x7a60('0x2d')]=_0x126530[_0x7a60('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x126530[_0x7a60('0x2e')];this['dialAMDSilenceThreshold']=_0x126530['dialAMDSilenceThreshold'];this[_0x7a60('0x2f')]=_0x126530['dialAMDMaximumWordLength'];}module[_0x7a60('0x30')]=Campaign; \ No newline at end of file +var _0x7834=['dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber'];(function(_0x1d3284,_0x3c4c27){var _0x53428c=function(_0x25b484){while(--_0x25b484){_0x1d3284['push'](_0x1d3284['shift']());}};_0x53428c(++_0x3c4c27);}(_0x7834,0x176));var _0x4783=function(_0x12e1fa,_0x2da3b8){_0x12e1fa=_0x12e1fa-0x0;var _0x498b71=_0x7834[_0x12e1fa];return _0x498b71;};'use strict';function Campaign(_0xf214ec){this['id']=_0xf214ec['id']||0x0;this[_0x4783('0x0')]=_0xf214ec[_0x4783('0x0')]||'';this[_0x4783('0x1')]=_0xf214ec[_0x4783('0x1')]||_0x4783('0x2');this[_0x4783('0x3')]=0x0;this['temp']=0x0;this[_0x4783('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x4783('0x5')]='';this[_0x4783('0x6')]=!![];this[_0x4783('0x7')]=_0xf214ec[_0x4783('0x7')];this[_0x4783('0x8')]=_0xf214ec[_0x4783('0x8')];this[_0x4783('0x9')]=_0xf214ec[_0x4783('0x9')]||null;this[_0x4783('0xa')]=_0xf214ec[_0x4783('0xa')]?_0xf214ec['dialGlobalInterval']:null;this[_0x4783('0xb')]=_0xf214ec[_0x4783('0xb')];this[_0x4783('0xc')]=_0xf214ec[_0x4783('0xc')];this[_0x4783('0xd')]=_0xf214ec['dialOriginateTimeout']||0x1e;this[_0x4783('0xe')]=_0xf214ec[_0x4783('0xe')];this[_0x4783('0xf')]=_0xf214ec[_0x4783('0xf')];this[_0x4783('0x10')]=_0xf214ec[_0x4783('0x10')];this[_0x4783('0x11')]=_0xf214ec[_0x4783('0x11')];this[_0x4783('0x12')]=_0xf214ec[_0x4783('0x12')];this[_0x4783('0x13')]=_0xf214ec['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0xf214ec[_0x4783('0x14')];this[_0x4783('0x15')]=_0xf214ec[_0x4783('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xf214ec[_0x4783('0x16')]||0x96;this['dialDropMaxRetry']=_0xf214ec['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0xf214ec[_0x4783('0x17')]||0x96;this[_0x4783('0x18')]=_0xf214ec[_0x4783('0x18')]||0x3;this[_0x4783('0x19')]=_0xf214ec[_0x4783('0x19')]||0x96;this[_0x4783('0x1a')]=_0xf214ec[_0x4783('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0xf214ec[_0x4783('0x1b')]||0x96;this[_0x4783('0x1c')]=_0xf214ec['dialAgentRejectMaxRetry']||0x3;this[_0x4783('0x1d')]=_0xf214ec['dialAgentRejectRetryFrequency']||0x96;this[_0x4783('0x1e')]=_0xf214ec['dialOrderByScheduledAt']||_0x4783('0x1f');this[_0x4783('0x20')]=_0xf214ec[_0x4783('0x20')]||undefined;this[_0x4783('0x21')]=_0xf214ec[_0x4783('0x21')]||undefined;this[_0x4783('0x22')]=_0xf214ec['dialCutDigit']||undefined;this[_0x4783('0x23')]=_0xf214ec[_0x4783('0x23')]?_0xf214ec[_0x4783('0x23')]:undefined;this[_0x4783('0x24')]=_0xf214ec[_0x4783('0x24')]?_0xf214ec[_0x4783('0x24')]:undefined;this[_0x4783('0x25')]=_0xf214ec[_0x4783('0x25')]?_0xf214ec[_0x4783('0x25')]:undefined;this[_0x4783('0x26')]=_0xf214ec[_0x4783('0x26')]?_0xf214ec[_0x4783('0x26')]:undefined;this[_0x4783('0x27')]=_0xf214ec[_0x4783('0x26')]?_0xf214ec['SquareProject'][_0x4783('0x0')]:undefined;this[_0x4783('0x28')]=_0xf214ec[_0x4783('0x28')]||![];this[_0x4783('0x29')]=_0xf214ec[_0x4783('0x29')];this['dialAMDGreeting']=_0xf214ec[_0x4783('0x2a')];this[_0x4783('0x2b')]=_0xf214ec[_0x4783('0x2b')];this[_0x4783('0x2c')]=_0xf214ec['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0xf214ec[_0x4783('0x2d')];this[_0x4783('0x2e')]=_0xf214ec['dialAMDBetweenWordsSilence'];this[_0x4783('0x2f')]=_0xf214ec[_0x4783('0x2f')];this[_0x4783('0x30')]=_0xf214ec['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xf214ec[_0x4783('0x31')];}module[_0x4783('0x32')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 6a33b9c..5b35c0f 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 _0x6fc2=['transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x6fc2,0x117));var _0x26fc=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x6fc2[_0x4b7895];return _0x264180;};'use strict';function Channel(){this[_0x26fc('0x0')]=null;this[_0x26fc('0x1')]='';this[_0x26fc('0x2')]='';this['calleridnum']=0x0;this[_0x26fc('0x3')]='';this[_0x26fc('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x26fc('0x5')]=0x0;this[_0x26fc('0x6')]=0x0;this['exten']=0x0;this[_0x26fc('0x7')]=![];this[_0x26fc('0x8')]=null;this[_0x26fc('0x9')]=null;this[_0x26fc('0xa')]=![];this['abandoned']=![];this[_0x26fc('0xb')]='';this['lastdata']='';this['duration']=0x0;this[_0x26fc('0xc')]=0x0;this[_0x26fc('0xd')]=0x0;this[_0x26fc('0xe')]=null;this['tag']=null;this[_0x26fc('0xf')]=null;this[_0x26fc('0x10')]=![];this[_0x26fc('0x11')]=null;this[_0x26fc('0x12')]=null;this[_0x26fc('0x13')]=[];this[_0x26fc('0x14')]=undefined;this[_0x26fc('0x15')]=undefined;this[_0x26fc('0x16')]=undefined;this[_0x26fc('0x17')]=0x0;}module[_0x26fc('0x18')]=Channel; \ No newline at end of file +var _0xa9d6=['mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answertime','endtime','unmanaged','lastapplication','lastdata','duration','holdtime','type','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x43bacb,_0x2d6964){var _0x157f03=function(_0x301fb2){while(--_0x301fb2){_0x43bacb['push'](_0x43bacb['shift']());}};_0x157f03(++_0x2d6964);}(_0xa9d6,0x1ef));var _0x6a9d=function(_0x2f0de5,_0x30b92b){_0x2f0de5=_0x2f0de5-0x0;var _0x4c3c09=_0xa9d6[_0x2f0de5];return _0x4c3c09;};'use strict';function Channel(){this[_0x6a9d('0x0')]=null;this[_0x6a9d('0x1')]='';this[_0x6a9d('0x2')]='';this[_0x6a9d('0x3')]=0x0;this[_0x6a9d('0x4')]='';this[_0x6a9d('0x5')]=undefined;this[_0x6a9d('0x6')]=undefined;this[_0x6a9d('0x7')]=0x0;this[_0x6a9d('0x8')]='';this[_0x6a9d('0x9')]=0x0;this[_0x6a9d('0xa')]=0x0;this[_0x6a9d('0xb')]=0x0;this['answered']=![];this[_0x6a9d('0xc')]=null;this[_0x6a9d('0xd')]=null;this[_0x6a9d('0xe')]=![];this['abandoned']=![];this[_0x6a9d('0xf')]='';this[_0x6a9d('0x10')]='';this[_0x6a9d('0x11')]=0x0;this['billableseconds']=0x0;this[_0x6a9d('0x12')]=0x0;this[_0x6a9d('0x13')]=null;this['tag']=null;this['disposition']=null;this[_0x6a9d('0x14')]=![];this[_0x6a9d('0x15')]=null;this[_0x6a9d('0x16')]=null;this[_0x6a9d('0x17')]=[];this[_0x6a9d('0x18')]=undefined;this[_0x6a9d('0x19')]=undefined;this[_0x6a9d('0x1a')]=undefined;this[_0x6a9d('0x1b')]=0x0;}module[_0x6a9d('0x1c')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 022dcbe..5b37708 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 _0x7394=['password','token','tokenSecret','type','serverUrl','Configurations','exports','username','remoteUri','authType'];(function(_0x23461e,_0x4944b8){var _0x33f3f5=function(_0x3658c7){while(--_0x3658c7){_0x23461e['push'](_0x23461e['shift']());}};_0x33f3f5(++_0x4944b8);}(_0x7394,0x15b));var _0x4739=function(_0x36b03c,_0x58106c){_0x36b03c=_0x36b03c-0x0;var _0x103615=_0x7394[_0x36b03c];return _0x103615;};'use strict';function DeskAccount(_0x529426){this['id']=_0x529426['id']||0x0;this['name']=_0x529426['name']||'';this[_0x4739('0x0')]=_0x529426[_0x4739('0x0')]||'';this[_0x4739('0x1')]=_0x529426[_0x4739('0x1')]||'';this['authType']=_0x529426[_0x4739('0x2')]||'';this[_0x4739('0x3')]=_0x529426[_0x4739('0x3')]||'';this['consumerKey']=_0x529426['consumerKey']||'';this['consumerSecret']=_0x529426['consumerSecret']||'';this['token']=_0x529426[_0x4739('0x4')]||'';this[_0x4739('0x5')]=_0x529426[_0x4739('0x5')]||'';this['type']=_0x529426[_0x4739('0x6')]||'';this['serverUrl']=_0x529426[_0x4739('0x7')]||'';this[_0x4739('0x8')]=_0x529426[_0x4739('0x8')]||{};}module[_0x4739('0x9')]=DeskAccount; \ No newline at end of file +var _0x8442=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','consumerKey'];(function(_0x500edf,_0x1e8af7){var _0x5181e0=function(_0x4aec75){while(--_0x4aec75){_0x500edf['push'](_0x500edf['shift']());}};_0x5181e0(++_0x1e8af7);}(_0x8442,0xdf));var _0x2844=function(_0x1f9386,_0x3151b9){_0x1f9386=_0x1f9386-0x0;var _0x14741a=_0x8442[_0x1f9386];return _0x14741a;};'use strict';function DeskAccount(_0x4bf51a){this['id']=_0x4bf51a['id']||0x0;this[_0x2844('0x0')]=_0x4bf51a['name']||'';this[_0x2844('0x1')]=_0x4bf51a[_0x2844('0x1')]||'';this[_0x2844('0x2')]=_0x4bf51a[_0x2844('0x2')]||'';this[_0x2844('0x3')]=_0x4bf51a['authType']||'';this['password']=_0x4bf51a['password']||'';this[_0x2844('0x4')]=_0x4bf51a[_0x2844('0x4')]||'';this['consumerSecret']=_0x4bf51a[_0x2844('0x5')]||'';this[_0x2844('0x6')]=_0x4bf51a[_0x2844('0x6')]||'';this[_0x2844('0x7')]=_0x4bf51a['tokenSecret']||'';this[_0x2844('0x8')]=_0x4bf51a[_0x2844('0x8')]||'';this[_0x2844('0x9')]=_0x4bf51a[_0x2844('0x9')]||'';this['Configurations']=_0x4bf51a[_0x2844('0xa')]||{};}module[_0x2844('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 89239d4..bb509db 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 _0x935a=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','clientId','clientSecret'];(function(_0x4179e4,_0x4c16c0){var _0x593f54=function(_0x449b55){while(--_0x449b55){_0x4179e4['push'](_0x4179e4['shift']());}};_0x593f54(++_0x4c16c0);}(_0x935a,0x94));var _0xa935=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x935a[_0x4d613c];return _0x301fe3;};'use strict';function Dynamics365Account(_0xbeb7e1){this['id']=_0xbeb7e1['id']||0x0;this[_0xa935('0x0')]=_0xbeb7e1[_0xa935('0x0')]||'';this['username']=_0xbeb7e1['username']||'';this[_0xa935('0x1')]=_0xbeb7e1['password']||'';this['remoteUri']=_0xbeb7e1[_0xa935('0x2')]||'';this['tenantId']=_0xbeb7e1['tenantId']||'';this[_0xa935('0x3')]=_0xbeb7e1[_0xa935('0x3')]||'';this['clientSecret']=_0xbeb7e1[_0xa935('0x4')]||{};this[_0xa935('0x5')]=_0xbeb7e1[_0xa935('0x5')]||'';this[_0xa935('0x6')]=_0xbeb7e1[_0xa935('0x6')]||![];this[_0xa935('0x7')]=_0xbeb7e1[_0xa935('0x7')]||{};this[_0xa935('0x8')]=_0xbeb7e1[_0xa935('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x7142=['serverUrl','modernAuthentication','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x4c4342,_0x175ed6){var _0x1a8c0d=function(_0x564b5a){while(--_0x564b5a){_0x4c4342['push'](_0x4c4342['shift']());}};_0x1a8c0d(++_0x175ed6);}(_0x7142,0x9e));var _0x2714=function(_0xf7e4c1,_0x3a5d39){_0xf7e4c1=_0xf7e4c1-0x0;var _0x1a9a85=_0x7142[_0xf7e4c1];return _0x1a9a85;};'use strict';function Dynamics365Account(_0x299f43){this['id']=_0x299f43['id']||0x0;this['name']=_0x299f43[_0x2714('0x0')]||'';this[_0x2714('0x1')]=_0x299f43['username']||'';this[_0x2714('0x2')]=_0x299f43[_0x2714('0x2')]||'';this[_0x2714('0x3')]=_0x299f43[_0x2714('0x3')]||'';this[_0x2714('0x4')]=_0x299f43[_0x2714('0x4')]||'';this[_0x2714('0x5')]=_0x299f43[_0x2714('0x5')]||'';this[_0x2714('0x6')]=_0x299f43[_0x2714('0x6')]||{};this[_0x2714('0x7')]=_0x299f43[_0x2714('0x7')]||'';this[_0x2714('0x8')]=_0x299f43[_0x2714('0x8')]||![];this['Configurations']=_0x299f43['Configurations']||{};this[_0x2714('0x9')]=_0x299f43['CloudProvider']||{};}module[_0x2714('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 428ac6d..7318282 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 _0xcc9c=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key'];(function(_0x1d3577,_0x17a32e){var _0x277d9a=function(_0x4b4144){while(--_0x4b4144){_0x1d3577['push'](_0x1d3577['shift']());}};_0x277d9a(++_0x17a32e);}(_0xcc9c,0x1ee));var _0xccc9=function(_0x58772e,_0x5ecf45){_0x58772e=_0x58772e-0x0;var _0x3c4357=_0xcc9c[_0x58772e];return _0x3c4357;};'use strict';function FaxAccount(_0x1fab25){this['id']=_0x1fab25['id']||0x0;this[_0xccc9('0x0')]=_0x1fab25['name']||'';this[_0xccc9('0x1')]=_0x1fab25[_0xccc9('0x1')];this['ecm']=_0x1fab25[_0xccc9('0x2')];this[_0xccc9('0x3')]=_0x1fab25[_0xccc9('0x3')];this[_0xccc9('0x4')]=_0x1fab25[_0xccc9('0x4')];this[_0xccc9('0x5')]=_0x1fab25[_0xccc9('0x5')]||0x960;this[_0xccc9('0x6')]=_0x1fab25[_0xccc9('0x6')]||0x3840;this[_0xccc9('0x7')]=_0x1fab25[_0xccc9('0x7')]||_0xccc9('0x8');this[_0xccc9('0x9')]=_0x1fab25[_0xccc9('0x9')]||'no';this[_0xccc9('0xa')]=_0x1fab25[_0xccc9('0xa')]||'no';this[_0xccc9('0xb')]=_0x1fab25[_0xccc9('0xb')]||0x1388;this['tech']=_0x1fab25['tech']||_0xccc9('0xc');this['Trunk']=_0x1fab25[_0xccc9('0xd')]?_0x1fab25[_0xccc9('0xd')]:undefined;this[_0xccc9('0xe')]=_0x1fab25[_0xccc9('0xe')];this[_0xccc9('0xf')]=_0x1fab25[_0xccc9('0xf')];}module[_0xccc9('0x10')]=FaxAccount; \ No newline at end of file +var _0x3efe=['t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x425ddc,_0x21f6d1){var _0x5aefdc=function(_0x19ecf3){while(--_0x19ecf3){_0x425ddc['push'](_0x425ddc['shift']());}};_0x5aefdc(++_0x21f6d1);}(_0x3efe,0x1db));var _0xe3ef=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3efe[_0x2641f9];return _0x585741;};'use strict';function FaxAccount(_0x3a623f){this['id']=_0x3a623f['id']||0x0;this[_0xe3ef('0x0')]=_0x3a623f[_0xe3ef('0x0')]||'';this[_0xe3ef('0x1')]=_0x3a623f[_0xe3ef('0x1')];this['ecm']=_0x3a623f[_0xe3ef('0x2')];this[_0xe3ef('0x3')]=_0x3a623f[_0xe3ef('0x3')];this[_0xe3ef('0x4')]=_0x3a623f[_0xe3ef('0x4')];this[_0xe3ef('0x5')]=_0x3a623f[_0xe3ef('0x5')]||0x960;this[_0xe3ef('0x6')]=_0x3a623f['maxrate']||0x3840;this[_0xe3ef('0x7')]=_0x3a623f[_0xe3ef('0x7')]||_0xe3ef('0x8');this[_0xe3ef('0x9')]=_0x3a623f[_0xe3ef('0x9')]||'no';this[_0xe3ef('0xa')]=_0x3a623f['faxdetect']||'no';this[_0xe3ef('0xb')]=_0x3a623f[_0xe3ef('0xb')]||0x1388;this[_0xe3ef('0xc')]=_0x3a623f[_0xe3ef('0xc')]||_0xe3ef('0xd');this[_0xe3ef('0xe')]=_0x3a623f[_0xe3ef('0xe')]?_0x3a623f[_0xe3ef('0xe')]:undefined;this[_0xe3ef('0xf')]=_0x3a623f[_0xe3ef('0xf')];this[_0xe3ef('0x10')]=_0x3a623f['key'];}module[_0xe3ef('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4e0ae75..7e2bba6 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 _0xc1b7=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4cdc39,_0x15a39e){var _0x340a85=function(_0x14ee05){while(--_0x14ee05){_0x4cdc39['push'](_0x4cdc39['shift']());}};_0x340a85(++_0x15a39e);}(_0xc1b7,0x110));var _0x7c1b=function(_0x2f6799,_0x4e7f00){_0x2f6799=_0x2f6799-0x0;var _0x3cb26f=_0xc1b7[_0x2f6799];return _0x3cb26f;};'use strict';function FreshdeskAccount(_0x1bcc9a){this['id']=_0x1bcc9a['id']||0x0;this[_0x7c1b('0x0')]=_0x1bcc9a['name']||'';this[_0x7c1b('0x1')]=_0x1bcc9a[_0x7c1b('0x1')]||'';this[_0x7c1b('0x2')]=_0x1bcc9a['token']||'';this[_0x7c1b('0x3')]=_0x1bcc9a[_0x7c1b('0x3')]||'';this[_0x7c1b('0x4')]=_0x1bcc9a[_0x7c1b('0x4')]||'';this[_0x7c1b('0x5')]=_0x1bcc9a['Configurations']||{};}module[_0x7c1b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x533c=['token','remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x37b713,_0x248677){var _0xae950c=function(_0x272cb9){while(--_0x272cb9){_0x37b713['push'](_0x37b713['shift']());}};_0xae950c(++_0x248677);}(_0x533c,0x1bd));var _0xc533=function(_0x33d9c6,_0x2a2a9f){_0x33d9c6=_0x33d9c6-0x0;var _0x2f7d16=_0x533c[_0x33d9c6];return _0x2f7d16;};'use strict';function FreshdeskAccount(_0x3b04e7){this['id']=_0x3b04e7['id']||0x0;this[_0xc533('0x0')]=_0x3b04e7[_0xc533('0x0')]||'';this[_0xc533('0x1')]=_0x3b04e7[_0xc533('0x1')]||'';this[_0xc533('0x2')]=_0x3b04e7[_0xc533('0x3')]||'';this[_0xc533('0x4')]=_0x3b04e7['remoteUri']||'';this[_0xc533('0x5')]=_0x3b04e7[_0xc533('0x5')]||'';this[_0xc533('0x6')]=_0x3b04e7['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e060254..fdfb033 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 _0xcddb=['serverUrl','Configurations','name','apiKey','remoteUri'];(function(_0x58d49a,_0x5a2469){var _0x176700=function(_0x1ccebd){while(--_0x1ccebd){_0x58d49a['push'](_0x58d49a['shift']());}};_0x176700(++_0x5a2469);}(_0xcddb,0x1c4));var _0xbcdd=function(_0xc5ef06,_0x5dbab3){_0xc5ef06=_0xc5ef06-0x0;var _0x492f2e=_0xcddb[_0xc5ef06];return _0x492f2e;};'use strict';function FreshsalesAccount(_0x82d2ab){this['id']=_0x82d2ab['id']||0x0;this[_0xbcdd('0x0')]=_0x82d2ab[_0xbcdd('0x0')]||'';this['username']=_0x82d2ab['username']||'';this[_0xbcdd('0x1')]=_0x82d2ab['token']||'';this[_0xbcdd('0x2')]=_0x82d2ab[_0xbcdd('0x2')]||'';this[_0xbcdd('0x3')]=_0x82d2ab[_0xbcdd('0x3')]||'';this['Configurations']=_0x82d2ab[_0xbcdd('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0x78b7=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x4f8967,_0x330203){var _0x45ae82=function(_0x23d0b9){while(--_0x23d0b9){_0x4f8967['push'](_0x4f8967['shift']());}};_0x45ae82(++_0x330203);}(_0x78b7,0x194));var _0x778b=function(_0xe65751,_0x143a6f){_0xe65751=_0xe65751-0x0;var _0xdac257=_0x78b7[_0xe65751];return _0xdac257;};'use strict';function FreshsalesAccount(_0x25b6a8){this['id']=_0x25b6a8['id']||0x0;this[_0x778b('0x0')]=_0x25b6a8['name']||'';this[_0x778b('0x1')]=_0x25b6a8[_0x778b('0x1')]||'';this[_0x778b('0x2')]=_0x25b6a8[_0x778b('0x3')]||'';this[_0x778b('0x4')]=_0x25b6a8['remoteUri']||'';this['serverUrl']=_0x25b6a8[_0x778b('0x5')]||'';this[_0x778b('0x6')]=_0x25b6a8[_0x778b('0x6')]||{};}module[_0x778b('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 87aa781..459c28e 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 _0xe9a8=['context','exten','priority','holdtime','assigned','lastAssignedTo','voice','mohtime','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xe9a8,0x19d));var _0x8e9a=function(_0x55a2ba,_0x2fd4cc){_0x55a2ba=_0x55a2ba-0x0;var _0x39028d=_0xe9a8[_0x55a2ba];return _0x39028d;};'use strict';function QueueReport(){this[_0x8e9a('0x0')]=_0x8e9a('0x1');this[_0x8e9a('0x2')]='';this['calleridnum']='';this[_0x8e9a('0x3')]='';this[_0x8e9a('0x4')]='';this[_0x8e9a('0x5')]=null;this[_0x8e9a('0x6')]=null;this[_0x8e9a('0x7')]=0x1;this[_0x8e9a('0x8')]=0x1;this[_0x8e9a('0x9')]=![];this[_0x8e9a('0xa')]=null;this[_0x8e9a('0xb')]=![];this[_0x8e9a('0xc')]=null;this[_0x8e9a('0xd')]=![];this[_0x8e9a('0xe')]=null;this[_0x8e9a('0xf')]=0x1;this[_0x8e9a('0x10')]='';this[_0x8e9a('0x11')]='';this[_0x8e9a('0x12')]='';this['accountcode']='';this[_0x8e9a('0x13')]='';this[_0x8e9a('0x14')]='';this[_0x8e9a('0x15')]='';this[_0x8e9a('0x16')]=0x0;this[_0x8e9a('0x17')]=![];this[_0x8e9a('0x18')]='';this['motionChannel']=_0x8e9a('0x19');this[_0x8e9a('0x1a')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0x6c2f=['lastAssignedTo','motionChannel','voice','mohtime','variables','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallercompleteAt','queuecallerexit','channel','connectedlinename','exten','assigned'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x6c2f,0x1e8));var _0xf6c2=function(_0x50ef0e,_0x42a6bd){_0x50ef0e=_0x50ef0e-0x0;var _0x4fd6c2=_0x6c2f[_0x50ef0e];return _0x4fd6c2;};'use strict';function QueueReport(){this[_0xf6c2('0x0')]=_0xf6c2('0x1');this[_0xf6c2('0x2')]='';this[_0xf6c2('0x3')]='';this[_0xf6c2('0x4')]='';this[_0xf6c2('0x5')]='';this[_0xf6c2('0x6')]=null;this['queuecallerleaveAt']=null;this[_0xf6c2('0x7')]=0x1;this[_0xf6c2('0x8')]=0x1;this[_0xf6c2('0x9')]=![];this['queuecallerabandonAt']=null;this['queuecallercomplete']=![];this[_0xf6c2('0xa')]=null;this[_0xf6c2('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xf6c2('0xc')]='';this['connectedlinenum']='';this[_0xf6c2('0xd')]='';this['accountcode']='';this['context']='';this[_0xf6c2('0xe')]='';this['priority']='';this['holdtime']=0x0;this[_0xf6c2('0xf')]=![];this[_0xf6c2('0x10')]='';this[_0xf6c2('0x11')]=_0xf6c2('0x12');this[_0xf6c2('0x13')]=0x0;this[_0xf6c2('0x14')]={};}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 fb48fc0..e415255 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 _0xabc4=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xabc4,0xfd));var _0x4abc=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0xabc4[_0x3e5595];return _0x3fd3a6;};'use strict';function SalesforceAccount(_0x29e1b4){this['id']=_0x29e1b4['id']||0x0;this['name']=_0x29e1b4[_0x4abc('0x0')]||'';this[_0x4abc('0x1')]=_0x29e1b4[_0x4abc('0x1')]||'';this['remoteUri']=_0x29e1b4[_0x4abc('0x2')]||'';this[_0x4abc('0x3')]=_0x29e1b4['password']||'';this[_0x4abc('0x4')]=_0x29e1b4[_0x4abc('0x4')]||'';this[_0x4abc('0x5')]=_0x29e1b4[_0x4abc('0x5')]||'';this[_0x4abc('0x6')]=_0x29e1b4[_0x4abc('0x6')]||'';this[_0x4abc('0x7')]=_0x29e1b4[_0x4abc('0x7')]||_0x4abc('0x8');this['serverUrl']=_0x29e1b4[_0x4abc('0x9')]||'';this[_0x4abc('0xa')]=_0x29e1b4[_0x4abc('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xeeb2=['serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab'];(function(_0x32a931,_0x2e4cd3){var _0x3b4821=function(_0x3bf9db){while(--_0x3bf9db){_0x32a931['push'](_0x32a931['shift']());}};_0x3b4821(++_0x2e4cd3);}(_0xeeb2,0x117));var _0x2eeb=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xeeb2[_0x5bd426];return _0x23a7eb;};'use strict';function SalesforceAccount(_0x3a017a){this['id']=_0x3a017a['id']||0x0;this[_0x2eeb('0x0')]=_0x3a017a[_0x2eeb('0x0')]||'';this['username']=_0x3a017a[_0x2eeb('0x1')]||'';this[_0x2eeb('0x2')]=_0x3a017a['remoteUri']||'';this[_0x2eeb('0x3')]=_0x3a017a[_0x2eeb('0x3')]||'';this[_0x2eeb('0x4')]=_0x3a017a['clientId']||'';this[_0x2eeb('0x5')]=_0x3a017a['clientSecret']||'';this['securityToken']=_0x3a017a[_0x2eeb('0x6')]||'';this[_0x2eeb('0x7')]=_0x3a017a['type']||_0x2eeb('0x8');this[_0x2eeb('0x9')]=_0x3a017a[_0x2eeb('0x9')]||'';this[_0x2eeb('0xa')]=_0x3a017a[_0x2eeb('0xa')]||{};}module[_0x2eeb('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 21d62bc..93df7ed 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 _0xe0fb=['username','password','remoteUri','serverUrl','exports','name'];(function(_0x3c7fc6,_0x5166f8){var _0x5b52bc=function(_0x1f86a0){while(--_0x1f86a0){_0x3c7fc6['push'](_0x3c7fc6['shift']());}};_0x5b52bc(++_0x5166f8);}(_0xe0fb,0x197));var _0xbe0f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe0fb[_0x4b369d];return _0x571a98;};'use strict';function ServicenowAccount(_0x3c49b){this['id']=_0x3c49b['id']||0x0;this[_0xbe0f('0x0')]=_0x3c49b['name']||'';this[_0xbe0f('0x1')]=_0x3c49b[_0xbe0f('0x1')]||'';this[_0xbe0f('0x2')]=_0x3c49b['password']||'';this[_0xbe0f('0x3')]=_0x3c49b[_0xbe0f('0x3')]||'';this['serverUrl']=_0x3c49b[_0xbe0f('0x4')]||'';this['Configurations']=_0x3c49b['Configurations']||{};}module[_0xbe0f('0x5')]=ServicenowAccount; \ No newline at end of file +var _0x6ad4=['serverUrl','exports','name','username','password','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ad4,0x1c4));var _0x46ad=function(_0x389ffc,_0x3e244e){_0x389ffc=_0x389ffc-0x0;var _0x1aab36=_0x6ad4[_0x389ffc];return _0x1aab36;};'use strict';function ServicenowAccount(_0x4033cf){this['id']=_0x4033cf['id']||0x0;this[_0x46ad('0x0')]=_0x4033cf['name']||'';this[_0x46ad('0x1')]=_0x4033cf[_0x46ad('0x1')]||'';this[_0x46ad('0x2')]=_0x4033cf['password']||'';this[_0x46ad('0x3')]=_0x4033cf[_0x46ad('0x3')]||'';this[_0x46ad('0x4')]=_0x4033cf[_0x46ad('0x4')]||'';this['Configurations']=_0x4033cf['Configurations']||{};}module[_0x46ad('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 12a4b97..db8063f 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 _0x5f30=['password','remoteUri','serverUrl','Configurations','exports','username'];(function(_0x1acc3c,_0x12438d){var _0x471679=function(_0x2e9fc8){while(--_0x2e9fc8){_0x1acc3c['push'](_0x1acc3c['shift']());}};_0x471679(++_0x12438d);}(_0x5f30,0xe9));var _0x05f3=function(_0x2eb95d,_0xecd8b6){_0x2eb95d=_0x2eb95d-0x0;var _0x1dc86f=_0x5f30[_0x2eb95d];return _0x1dc86f;};'use strict';function SugarcrmAccount(_0x212c5e){this['id']=_0x212c5e['id']||0x0;this['name']=_0x212c5e['name']||'';this[_0x05f3('0x0')]=_0x212c5e['username']||'';this['password']=_0x212c5e[_0x05f3('0x1')]||'';this[_0x05f3('0x2')]=_0x212c5e[_0x05f3('0x2')]||'';this['serverUrl']=_0x212c5e[_0x05f3('0x3')]||'';this[_0x05f3('0x4')]=_0x212c5e[_0x05f3('0x4')]||{};}module[_0x05f3('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xf700=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf700,0x1c9));var _0x0f70=function(_0x17bfaf,_0x38320d){_0x17bfaf=_0x17bfaf-0x0;var _0x1f2594=_0xf700[_0x17bfaf];return _0x1f2594;};'use strict';function SugarcrmAccount(_0x5c487a){this['id']=_0x5c487a['id']||0x0;this[_0x0f70('0x0')]=_0x5c487a[_0x0f70('0x0')]||'';this[_0x0f70('0x1')]=_0x5c487a[_0x0f70('0x1')]||'';this[_0x0f70('0x2')]=_0x5c487a[_0x0f70('0x2')]||'';this['remoteUri']=_0x5c487a[_0x0f70('0x3')]||'';this[_0x0f70('0x4')]=_0x5c487a['serverUrl']||'';this[_0x0f70('0x5')]=_0x5c487a[_0x0f70('0x5')]||{};}module[_0x0f70('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index b414039..8aa84fa 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 _0x8507=['stateTime','status','address','exports','name','accountcode','state','unknown'];(function(_0x49158a,_0x3fe9eb){var _0x1c76ce=function(_0x1e14db){while(--_0x1e14db){_0x49158a['push'](_0x49158a['shift']());}};_0x1c76ce(++_0x3fe9eb);}(_0x8507,0x14c));var _0x7850=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8507[_0x20a584];return _0x4b41a8;};'use strict';function Telephone(_0x2b21e3){this['id']=_0x2b21e3['id']||0x0;this['name']=_0x2b21e3[_0x7850('0x0')]||'';this['accountcode']=_0x2b21e3[_0x7850('0x1')]||'';this[_0x7850('0x2')]=_0x7850('0x3');this[_0x7850('0x4')]=0x0;this[_0x7850('0x5')]=_0x7850('0x3');this[_0x7850('0x6')]='';}module[_0x7850('0x7')]=Telephone; \ No newline at end of file +var _0x364e=['state','unknown','stateTime','status','exports','name','accountcode'];(function(_0x1700d4,_0x59edee){var _0x2e7c9d=function(_0x572311){while(--_0x572311){_0x1700d4['push'](_0x1700d4['shift']());}};_0x2e7c9d(++_0x59edee);}(_0x364e,0xfa));var _0xe364=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0x364e[_0x10004e];return _0x5af990;};'use strict';function Telephone(_0x5a2916){this['id']=_0x5a2916['id']||0x0;this[_0xe364('0x0')]=_0x5a2916['name']||'';this['accountcode']=_0x5a2916[_0xe364('0x1')]||'';this[_0xe364('0x2')]=_0xe364('0x3');this[_0xe364('0x4')]=0x0;this[_0xe364('0x5')]=_0xe364('0x3');this['address']='';}module[_0xe364('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3d5f219..f2a0570 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x12e1af,_0x10e725){var _0x265fff=function(_0x531608){while(--_0x531608){_0x12e1af['push'](_0x12e1af['shift']());}};_0x265fff(++_0x10e725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x224bd9,_0x4fc53d){var _0x2242f7=function(_0x2d7661){while(--_0x2d7661){_0x224bd9['push'](_0x224bd9['shift']());}};_0x2242f7(++_0x4fc53d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 464b4fa..4a5046f 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0b0e,0x187));var _0xe0b0=function(_0xa3400,_0x3a980a){_0xa3400=_0xa3400-0x0;var _0x33dba2=_0x0b0e[_0xa3400];return _0x33dba2;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x9ffd=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x118d28,_0x1a5f94){var _0x2128c6=function(_0x510105){while(--_0x510105){_0x118d28['push'](_0x118d28['shift']());}};_0x2128c6(++_0x1a5f94);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x43a8c9,_0x2a6c9c){_0x43a8c9=_0x43a8c9-0x0;var _0x5b37a3=_0x9ffd[_0x43a8c9];return _0x5b37a3;};'use strict';function Trigger(_0x4c26a1){this['id']=_0x4c26a1['id']||0x0;this[_0xd9ff('0x0')]=_0x4c26a1[_0xd9ff('0x0')]||'';this['channel']=_0x4c26a1[_0xd9ff('0x1')]||_0xd9ff('0x2');this[_0xd9ff('0x3')]=_0x4c26a1[_0xd9ff('0x3')]||![];this['AllConditions']=_0x4c26a1[_0xd9ff('0x4')]||[];this[_0xd9ff('0x5')]=_0x4c26a1['AnyConditions']||[];this[_0xd9ff('0x6')]=_0x4c26a1[_0xd9ff('0x6')]||[];}module[_0xd9ff('0x7')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index b373912..84f7619 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 _0x272f=['refresh','stateRegistry','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','split','host','port','domain'];(function(_0x5944cf,_0x38144a){var _0x65778f=function(_0x317d35){while(--_0x317d35){_0x5944cf['push'](_0x5944cf['shift']());}};_0x65778f(++_0x38144a);}(_0x272f,0xa5));var _0xf272=function(_0x245b7c,_0x46bc4e){_0x245b7c=_0x245b7c-0x0;var _0x666e6f=_0x272f[_0x245b7c];return _0x666e6f;};'use strict';function Trunk(_0x33f256){this['id']=_0x33f256['id']||0x0;this[_0xf272('0x0')]=_0x33f256['active']||![];this[_0xf272('0x1')]=_0x33f256['name']||'';this['state']=_0xf272('0x2');this[_0xf272('0x3')]=0x0;this[_0xf272('0x4')]='unknown';this['registry']=_0x33f256[_0xf272('0x5')]&&_0x33f256[_0xf272('0x5')][_0xf272('0x6')](':')?_0x33f256[_0xf272('0x5')][_0xf272('0x7')](':')[0x0]:'';this[_0xf272('0x8')]='';this[_0xf272('0x9')]='';this[_0xf272('0xa')]='';this['domainport']='';this[_0xf272('0xb')]='';this[_0xf272('0xc')]=_0xf272('0x2');this[_0xf272('0xd')]='';this[_0xf272('0xe')]='';this['defaultuser']=_0x33f256[_0xf272('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x9dae=['stateTime','status','registry','indexOf','split','host','port','domain','domainport','registrationtime','address','defaultuser','exports','active','name','unknown'];(function(_0x34fbe5,_0x4d8c99){var _0x250f79=function(_0x459bdf){while(--_0x459bdf){_0x34fbe5['push'](_0x34fbe5['shift']());}};_0x250f79(++_0x4d8c99);}(_0x9dae,0x1bd));var _0xe9da=function(_0xbd58f1,_0x1c27d5){_0xbd58f1=_0xbd58f1-0x0;var _0x564909=_0x9dae[_0xbd58f1];return _0x564909;};'use strict';function Trunk(_0x6d8038){this['id']=_0x6d8038['id']||0x0;this['active']=_0x6d8038[_0xe9da('0x0')]||![];this[_0xe9da('0x1')]=_0x6d8038['name']||'';this['state']=_0xe9da('0x2');this[_0xe9da('0x3')]=0x0;this[_0xe9da('0x4')]=_0xe9da('0x2');this['registry']=_0x6d8038[_0xe9da('0x5')]&&_0x6d8038['registry'][_0xe9da('0x6')](':')?_0x6d8038[_0xe9da('0x5')][_0xe9da('0x7')](':')[0x0]:'';this[_0xe9da('0x8')]='';this[_0xe9da('0x9')]='';this[_0xe9da('0xa')]='';this[_0xe9da('0xb')]='';this['refresh']='';this['stateRegistry']='unknown';this[_0xe9da('0xc')]='';this[_0xe9da('0xd')]='';this[_0xe9da('0xe')]=_0x6d8038[_0xe9da('0xe')]||'';}module[_0xe9da('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index df269ef..8a38889 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 _0xeab2=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x40b9d0,_0x3537da){var _0x144b8d=function(_0x3071b5){while(--_0x3071b5){_0x40b9d0['push'](_0x40b9d0['shift']());}};_0x144b8d(++_0x3537da);}(_0xeab2,0x14e));var _0x2eab=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0xeab2[_0x585133];return _0x18254a;};'use strict';function voiceExtension(_0x223bc7){this['id']=_0x223bc7['id']||0x0;this[_0x2eab('0x0')]=_0x223bc7['exten']||'';this[_0x2eab('0x1')]=_0x223bc7['recordingFormat']||_0x2eab('0x2');this['mandatoryDisposition']=_0x223bc7[_0x2eab('0x3')]||![];}module[_0x2eab('0x4')]=voiceExtension; \ No newline at end of file +var _0x928e=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x337282,_0x1b35a2){var _0x3ffe57=function(_0x4a2f1f){while(--_0x4a2f1f){_0x337282['push'](_0x337282['shift']());}};_0x3ffe57(++_0x1b35a2);}(_0x928e,0x103));var _0xe928=function(_0x3de1b9,_0xe302f8){_0x3de1b9=_0x3de1b9-0x0;var _0x2781e1=_0x928e[_0x3de1b9];return _0x2781e1;};'use strict';function voiceExtension(_0x3ebc59){this['id']=_0x3ebc59['id']||0x0;this[_0xe928('0x0')]=_0x3ebc59['exten']||'';this[_0xe928('0x1')]=_0x3ebc59[_0xe928('0x1')]||_0xe928('0x2');this[_0xe928('0x3')]=_0x3ebc59[_0xe928('0x3')]||![];}module[_0xe928('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index aa73a24..22d065c 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 _0x1b7f=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','inuse','unavailable','wav','wav49','gsm','rrmemory','name','monitor_format','type','answered','sumDuration','sumBillable','unmanaged','loggedIn','available','acw','acwTimeout','autopause','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1b7f,0x11f));var _0xf1b7=function(_0x2a779f,_0x4a5bbd){_0x2a779f=_0x2a779f-0x0;var _0x5021d3=_0x1b7f[_0x2a779f];return _0x5021d3;};'use strict';var statusDesc=[_0xf1b7('0x0'),'not_inuse',_0xf1b7('0x1'),'busy','invalid',_0xf1b7('0x2'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0xf1b7('0x3'),'wav49':_0xf1b7('0x4'),'gsm':_0xf1b7('0x5')};var strategy={'rrmemory':_0xf1b7('0x6'),'roundrobin':'roundrobin'};function VoiceQueue(_0x224972){this['id']=_0x224972['id']||0x0;this[_0xf1b7('0x7')]=_0x224972[_0xf1b7('0x7')]||'';this[_0xf1b7('0x8')]=_0x224972[_0xf1b7('0x8')]||'';this[_0xf1b7('0x9')]=_0x224972[_0xf1b7('0x9')]||'inbound';this['waiting']=0x0;this['talking']=0x0;this['total']=0x0;this[_0xf1b7('0xa')]=0x0;this[_0xf1b7('0xb')]=0x0;this['sumHoldTime']=0x0;this[_0xf1b7('0xc')]=0x0;this[_0xf1b7('0xd')]=0x0;this['abandoned']=0x0;this[_0xf1b7('0xe')]=0x0;this[_0xf1b7('0xf')]=0x0;this[_0xf1b7('0x10')]=_0x224972['acw']||![];this[_0xf1b7('0x11')]=_0x224972[_0xf1b7('0x11')]||0xa;this[_0xf1b7('0x12')]=_0x224972[_0xf1b7('0x12')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0xf1b7('0x13')]=0x0;this[_0xf1b7('0x14')]=0x0;this[_0xf1b7('0x15')]=_0x224972[_0xf1b7('0x15')]||null;this[_0xf1b7('0x16')]=_0x224972['dialGlobalInterval']?_0x224972[_0xf1b7('0x16')]:null;this['dialActive']=_0x224972[_0xf1b7('0x17')];this[_0xf1b7('0x18')]=_0x224972[_0xf1b7('0x18')]||'progressive';this[_0xf1b7('0x19')]=_0x224972[_0xf1b7('0x19')]||0x0;this['dialLimitQueue']=_0x224972[_0xf1b7('0x1a')]||0x0;this[_0xf1b7('0x1b')]=_0x224972[_0xf1b7('0x1b')]||0x1;this[_0xf1b7('0x1c')]=_0x224972[_0xf1b7('0x1c')]||_0xf1b7('0x1d');this[_0xf1b7('0x1e')]=_0x224972['dialPredictiveOptimizationPercentage']||0.03;this[_0xf1b7('0x1f')]=_0x224972['dialPredictiveInterval']||0x258;this[_0xf1b7('0x20')]=_0x224972[_0xf1b7('0x20')]||_0xf1b7('0x21');this[_0xf1b7('0x22')]=_0x224972['dialOriginateCallerIdNumber']||_0xf1b7('0x21');this[_0xf1b7('0x23')]=_0x224972[_0xf1b7('0x23')]||0x1e;this[_0xf1b7('0x24')]=_0x224972[_0xf1b7('0x24')]||_0xf1b7('0x25');this[_0xf1b7('0x26')]=_0x224972[_0xf1b7('0x26')]||0x3;this[_0xf1b7('0x27')]=_0x224972['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x224972[_0xf1b7('0x28')]||0x3;this['dialCongestionRetryFrequency']=_0x224972['dialCongestionRetryFrequency']||0x96;this[_0xf1b7('0x29')]=_0x224972[_0xf1b7('0x29')]||0x3;this[_0xf1b7('0x2a')]=_0x224972[_0xf1b7('0x2a')]||0x96;this[_0xf1b7('0x2b')]=_0x224972[_0xf1b7('0x2b')]||0x3;this[_0xf1b7('0x2c')]=_0x224972['dialNoAnswerRetryFrequency']||0x96;this[_0xf1b7('0x2d')]=_0x224972['dialNoSuchNumberMaxRetry']||0x3;this[_0xf1b7('0x2e')]=_0x224972[_0xf1b7('0x2e')]||0x96;this['dialDropMaxRetry']=_0x224972['dialDropMaxRetry']||0x3;this[_0xf1b7('0x2f')]=_0x224972[_0xf1b7('0x2f')]||0x96;this[_0xf1b7('0x30')]=_0x224972[_0xf1b7('0x30')]||0x3;this[_0xf1b7('0x31')]=_0x224972[_0xf1b7('0x31')]||0x96;this[_0xf1b7('0x32')]=_0x224972[_0xf1b7('0x32')]||0x3;this[_0xf1b7('0x33')]=_0x224972['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x224972[_0xf1b7('0x34')]||0x3;this[_0xf1b7('0x35')]=_0x224972[_0xf1b7('0x35')]||0x96;this[_0xf1b7('0x36')]=_0x224972[_0xf1b7('0x36')]||0x3;this[_0xf1b7('0x37')]=_0x224972['dialGlobalMaxRetry']||0x4;this[_0xf1b7('0x38')]=_0x224972[_0xf1b7('0x38')]?_0x224972[_0xf1b7('0x38')]:undefined;this[_0xf1b7('0x39')]=_0x224972[_0xf1b7('0x39')]?_0x224972['TrunkBackup']:undefined;this[_0xf1b7('0x3a')]=_0x224972['dialPrefix']||undefined;this[_0xf1b7('0x3b')]=_0x224972[_0xf1b7('0x3b')]?_0x224972[_0xf1b7('0x3b')]:undefined;this[_0xf1b7('0x3c')]=_0x224972[_0xf1b7('0x3c')]||_0xf1b7('0x3d');this[_0xf1b7('0x3e')]=_0x224972[_0xf1b7('0x3e')]||undefined;this['dialCutDigit']=_0x224972[_0xf1b7('0x3f')]||undefined;this[_0xf1b7('0x40')]=strategy[_0x224972['strategy']]||_0xf1b7('0x6');this[_0xf1b7('0x41')]=!![];this[_0xf1b7('0x42')]=_0x224972['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x224972[_0xf1b7('0x43')];this[_0xf1b7('0x44')]=_0x224972[_0xf1b7('0x44')];this[_0xf1b7('0x45')]=_0x224972[_0xf1b7('0x45')];this[_0xf1b7('0x46')]=_0x224972[_0xf1b7('0x46')];this[_0xf1b7('0x47')]=_0x224972[_0xf1b7('0x47')];this[_0xf1b7('0x48')]=_0x224972[_0xf1b7('0x48')];this[_0xf1b7('0x49')]=_0x224972[_0xf1b7('0x49')];this[_0xf1b7('0x4a')]=_0x224972['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x224972['dialAMDMaximumWordLength'];this[_0xf1b7('0x4b')]=0x0;this[_0xf1b7('0x4c')]=0x0;this[_0xf1b7('0x4d')]=_0x224972['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xf1b7('0x4e')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xf1b7('0x4f')]=0x0;this[_0xf1b7('0x50')]=0x0;this[_0xf1b7('0x51')]=0x0;this[_0xf1b7('0x52')]=0x0;this[_0xf1b7('0x53')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xf1b7('0x54')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xf1b7('0x55')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0xf1b7('0x56')]=undefined;this[_0xf1b7('0x57')]=undefined;this[_0xf1b7('0x58')]=1.05;this[_0xf1b7('0x59')]=0x0;this[_0xf1b7('0x5a')]=0x0;this[_0xf1b7('0x5b')]=0x0;this[_0xf1b7('0x5c')]=0x0;this[_0xf1b7('0x5d')]=0x0;this[_0xf1b7('0x5e')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xf1b7('0x5f')]=_0x224972['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xf1b7('0x60')]=_0x224972['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xf1b7('0x61')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xf1b7('0x62')]=0x1;this[_0xf1b7('0x63')]=0x0;this[_0xf1b7('0x64')]=0x0;this[_0xf1b7('0x65')]=0x0;this[_0xf1b7('0x66')]=0x0;this['dialRecallMeTimeout']=_0x224972[_0xf1b7('0x67')]||0x1e;this['dialRecallInQueue']=_0x224972[_0xf1b7('0x68')]||![];this[_0xf1b7('0x69')]=!!_0x224972[_0xf1b7('0x69')]||![];this[_0xf1b7('0x6a')]=!!_0x224972[_0xf1b7('0x6a')]||![];this[_0xf1b7('0x6b')]=_0x224972[_0xf1b7('0x6b')]||undefined;this[_0xf1b7('0x6c')]=_0x224972['dialAgiAfterHangupClient']||![];this[_0xf1b7('0x6d')]=_0x224972[_0xf1b7('0x6d')]||![];this[_0xf1b7('0x8')]=monitorFormat[_0x224972[_0xf1b7('0x8')]]?monitorFormat[_0x224972['monitor_format']]:undefined;this[_0xf1b7('0x6e')]=_0x224972[_0xf1b7('0x6e')]||![];this[_0xf1b7('0x6f')]=_0x224972[_0xf1b7('0x6f')]?_0x224972[_0xf1b7('0x6f')]:undefined;}module[_0xf1b7('0x70')]=VoiceQueue; \ No newline at end of file +var _0x05cc=['inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','roundrobin','name','monitor_format','type'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x05cc,0xf0));var _0xc05c=function(_0x42c796,_0x2843c3){_0x42c796=_0x42c796-0x0;var _0x3bd718=_0x05cc[_0x42c796];return _0x3bd718;};'use strict';var statusDesc=[_0xc05c('0x0'),_0xc05c('0x1'),_0xc05c('0x2'),_0xc05c('0x3'),_0xc05c('0x4'),_0xc05c('0x5'),_0xc05c('0x6'),_0xc05c('0x7'),_0xc05c('0x8')];var monitorFormat={'wav':_0xc05c('0x9'),'wav49':_0xc05c('0xa'),'gsm':_0xc05c('0xb')};var strategy={'rrmemory':'rrmemory','roundrobin':_0xc05c('0xc')};function VoiceQueue(_0x175b05){this['id']=_0x175b05['id']||0x0;this['name']=_0x175b05[_0xc05c('0xd')]||'';this[_0xc05c('0xe')]=_0x175b05['monitor_format']||'';this['type']=_0x175b05[_0xc05c('0xf')]||_0xc05c('0x10');this['waiting']=0x0;this['talking']=0x0;this[_0xc05c('0x11')]=0x0;this[_0xc05c('0x12')]=0x0;this[_0xc05c('0x13')]=0x0;this[_0xc05c('0x14')]=0x0;this[_0xc05c('0x15')]=0x0;this[_0xc05c('0x16')]=0x0;this[_0xc05c('0x17')]=0x0;this[_0xc05c('0x18')]=0x0;this['available']=0x0;this[_0xc05c('0x19')]=_0x175b05[_0xc05c('0x19')]||![];this[_0xc05c('0x1a')]=_0x175b05['acwTimeout']||0xa;this[_0xc05c('0x1b')]=_0x175b05[_0xc05c('0x1b')]||'no';this[_0xc05c('0x1c')]=!![];this[_0xc05c('0x1d')]='';this[_0xc05c('0x1e')]=0x0;this[_0xc05c('0x1f')]=0x0;this['dialTimezone']=_0x175b05[_0xc05c('0x20')]||null;this[_0xc05c('0x21')]=_0x175b05[_0xc05c('0x21')]?_0x175b05[_0xc05c('0x21')]:null;this['dialActive']=_0x175b05[_0xc05c('0x22')];this[_0xc05c('0x23')]=_0x175b05['dialMethod']||'progressive';this[_0xc05c('0x24')]=_0x175b05['dialLimitChannel']||0x0;this[_0xc05c('0x25')]=_0x175b05[_0xc05c('0x25')]||0x0;this[_0xc05c('0x26')]=_0x175b05[_0xc05c('0x26')]||0x1;this['dialPredictiveOptimization']=_0x175b05[_0xc05c('0x27')]||_0xc05c('0x28');this[_0xc05c('0x29')]=_0x175b05['dialPredictiveOptimizationPercentage']||0.03;this[_0xc05c('0x2a')]=_0x175b05[_0xc05c('0x2a')]||0x258;this[_0xc05c('0x2b')]=_0x175b05['dialOriginateCallerIdName']||_0xc05c('0x2c');this['dialOriginateCallerIdNumber']=_0x175b05[_0xc05c('0x2d')]||_0xc05c('0x2c');this[_0xc05c('0x2e')]=_0x175b05['dialOriginateTimeout']||0x1e;this[_0xc05c('0x2f')]=_0x175b05[_0xc05c('0x2f')]||_0xc05c('0x30');this[_0xc05c('0x31')]=_0x175b05[_0xc05c('0x31')]||0x3;this[_0xc05c('0x32')]=_0x175b05[_0xc05c('0x32')]||undefined;this[_0xc05c('0x33')]=_0x175b05['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x175b05[_0xc05c('0x34')]||0x96;this['dialBusyMaxRetry']=_0x175b05['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x175b05[_0xc05c('0x35')]||0x96;this[_0xc05c('0x36')]=_0x175b05[_0xc05c('0x36')]||0x3;this[_0xc05c('0x37')]=_0x175b05[_0xc05c('0x37')]||0x96;this[_0xc05c('0x38')]=_0x175b05[_0xc05c('0x38')]||0x3;this[_0xc05c('0x39')]=_0x175b05['dialNoSuchNumberRetryFrequency']||0x96;this[_0xc05c('0x3a')]=_0x175b05[_0xc05c('0x3a')]||0x3;this[_0xc05c('0x3b')]=_0x175b05['dialDropRetryFrequency']||0x96;this[_0xc05c('0x3c')]=_0x175b05[_0xc05c('0x3c')]||0x3;this[_0xc05c('0x3d')]=_0x175b05[_0xc05c('0x3d')]||0x96;this[_0xc05c('0x3e')]=_0x175b05[_0xc05c('0x3e')]||0x3;this[_0xc05c('0x3f')]=_0x175b05[_0xc05c('0x3f')]||0x96;this[_0xc05c('0x40')]=_0x175b05['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x175b05[_0xc05c('0x41')]||0x96;this['callAdditionalPhoneAfterMin']=_0x175b05['callAdditionalPhoneAfterMin']||0x3;this[_0xc05c('0x42')]=_0x175b05[_0xc05c('0x42')]||0x4;this[_0xc05c('0x43')]=_0x175b05[_0xc05c('0x43')]?_0x175b05['Trunk']:undefined;this[_0xc05c('0x44')]=_0x175b05[_0xc05c('0x44')]?_0x175b05[_0xc05c('0x44')]:undefined;this[_0xc05c('0x45')]=_0x175b05[_0xc05c('0x45')]||undefined;this[_0xc05c('0x46')]=_0x175b05['Interval']?_0x175b05[_0xc05c('0x46')]:undefined;this[_0xc05c('0x47')]=_0x175b05[_0xc05c('0x47')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x175b05[_0xc05c('0x48')]||undefined;this['dialCutDigit']=_0x175b05[_0xc05c('0x49')]||undefined;this[_0xc05c('0x4a')]=strategy[_0x175b05[_0xc05c('0x4a')]]||_0xc05c('0x4b');this[_0xc05c('0x4c')]=!![];this[_0xc05c('0x4d')]=_0x175b05[_0xc05c('0x4d')]||![];this[_0xc05c('0x4e')]=_0x175b05[_0xc05c('0x4e')];this[_0xc05c('0x4f')]=_0x175b05[_0xc05c('0x4f')];this[_0xc05c('0x50')]=_0x175b05[_0xc05c('0x50')];this[_0xc05c('0x51')]=_0x175b05['dialAMDTotalAnalysisTime'];this[_0xc05c('0x52')]=_0x175b05['dialAMDMinWordLength'];this[_0xc05c('0x53')]=_0x175b05[_0xc05c('0x53')];this[_0xc05c('0x54')]=_0x175b05['dialAMDMaximumNumberOfWords'];this[_0xc05c('0x55')]=_0x175b05['dialAMDSilenceThreshold'];this[_0xc05c('0x56')]=_0x175b05['dialAMDMaximumWordLength'];this[_0xc05c('0x57')]=0x0;this[_0xc05c('0x58')]=0x0;this[_0xc05c('0x59')]=_0x175b05[_0xc05c('0x59')];this[_0xc05c('0x5a')]=0x0;this[_0xc05c('0x5b')]=0x0;this[_0xc05c('0x5c')]=0x0;this[_0xc05c('0x5d')]=0x0;this[_0xc05c('0x5e')]=0x0;this[_0xc05c('0x5f')]=0x0;this[_0xc05c('0x60')]=0x0;this[_0xc05c('0x61')]=0x0;this[_0xc05c('0x62')]=0x0;this[_0xc05c('0x63')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xc05c('0x64')]=0x0;this[_0xc05c('0x65')]=0x0;this[_0xc05c('0x66')]=undefined;this[_0xc05c('0x67')]=undefined;this[_0xc05c('0x68')]=undefined;this[_0xc05c('0x69')]=1.05;this[_0xc05c('0x6a')]=0x0;this[_0xc05c('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0xc05c('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xc05c('0x6d')]=0x0;this[_0xc05c('0x6e')]=0x0;this[_0xc05c('0x6f')]=0x0;this[_0xc05c('0x70')]=_0x175b05['dialPredictiveIntervalMaxThreshold']||0x14;this['predictiveIntervalMinThreshold']=_0x175b05[_0xc05c('0x71')]||0xa;this[_0xc05c('0x72')]=0x0;this[_0xc05c('0x73')]=0x0;this[_0xc05c('0x74')]=0x1;this[_0xc05c('0x75')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xc05c('0x76')]=0x0;this[_0xc05c('0x77')]=_0x175b05['dialRecallMeTimeout']||0x1e;this[_0xc05c('0x78')]=_0x175b05[_0xc05c('0x78')]||![];this[_0xc05c('0x79')]=!!_0x175b05[_0xc05c('0x79')]||![];this[_0xc05c('0x7a')]=!!_0x175b05[_0xc05c('0x7a')]||![];this[_0xc05c('0x7b')]=_0x175b05[_0xc05c('0x7b')]||undefined;this[_0xc05c('0x7c')]=_0x175b05[_0xc05c('0x7c')]||![];this[_0xc05c('0x7d')]=_0x175b05['dialAgiAfterHangupAgent']||![];this[_0xc05c('0xe')]=monitorFormat[_0x175b05['monitor_format']]?monitorFormat[_0x175b05['monitor_format']]:undefined;this[_0xc05c('0x7e')]=_0x175b05[_0xc05c('0x7e')]||![];this['mandatoryDispositionPause']=_0x175b05['mandatoryDispositionPause']?_0x175b05[_0xc05c('0x7f')]: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 e5b2e31..df7acbe 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 _0x5ade=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x29c680,_0x1ce209){var _0x370475=function(_0x4942bb){while(--_0x4942bb){_0x29c680['push'](_0x29c680['shift']());}};_0x370475(++_0x1ce209);}(_0x5ade,0x14e));var _0xe5ad=function(_0x1fa7c6,_0x24f7b5){_0x1fa7c6=_0x1fa7c6-0x0;var _0x43a6cd=_0x5ade[_0x1fa7c6];return _0x43a6cd;};'use strict';function VtigerAccount(_0x241c02){this['id']=_0x241c02['id']||0x0;this[_0xe5ad('0x0')]=_0x241c02[_0xe5ad('0x0')]||'';this[_0xe5ad('0x1')]=_0x241c02[_0xe5ad('0x1')]||'';this[_0xe5ad('0x2')]=_0x241c02[_0xe5ad('0x2')]||'';this[_0xe5ad('0x3')]=_0x241c02['remoteUri']||'';this[_0xe5ad('0x4')]=_0x241c02[_0xe5ad('0x4')]||'';this[_0xe5ad('0x5')]=_0x241c02[_0xe5ad('0x5')]||{};}module[_0xe5ad('0x6')]=VtigerAccount; \ No newline at end of file +var _0x8aa0=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x219117,_0x187eec){var _0x51767a=function(_0x3923e3){while(--_0x3923e3){_0x219117['push'](_0x219117['shift']());}};_0x51767a(++_0x187eec);}(_0x8aa0,0x1d6));var _0x08aa=function(_0x30f835,_0x39f004){_0x30f835=_0x30f835-0x0;var _0x1a9ec4=_0x8aa0[_0x30f835];return _0x1a9ec4;};'use strict';function VtigerAccount(_0x18611d){this['id']=_0x18611d['id']||0x0;this[_0x08aa('0x0')]=_0x18611d['name']||'';this[_0x08aa('0x1')]=_0x18611d[_0x08aa('0x1')]||'';this[_0x08aa('0x2')]=_0x18611d[_0x08aa('0x2')]||'';this[_0x08aa('0x3')]=_0x18611d[_0x08aa('0x3')]||'';this[_0x08aa('0x4')]=_0x18611d[_0x08aa('0x4')]||'';this[_0x08aa('0x5')]=_0x18611d[_0x08aa('0x5')]||{};}module[_0x08aa('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 d2975aa..ca02bbc 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 _0x61f2=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0x20b504,_0x330c27){var _0x237692=function(_0x21e7c3){while(--_0x21e7c3){_0x20b504['push'](_0x20b504['shift']());}};_0x237692(++_0x330c27);}(_0x61f2,0x1d1));var _0x261f=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x61f2[_0x9df060];return _0x338dfe;};'use strict';function ZendeskAccount(_0xc7ac3){this['id']=_0xc7ac3['id']||0x0;this[_0x261f('0x0')]=_0xc7ac3[_0x261f('0x0')]||'';this[_0x261f('0x1')]=_0xc7ac3[_0x261f('0x1')]||'';this[_0x261f('0x2')]=_0xc7ac3[_0x261f('0x2')]||'';this['token']=_0xc7ac3[_0x261f('0x3')]||'';this[_0x261f('0x4')]=_0xc7ac3[_0x261f('0x4')]||'';this[_0x261f('0x5')]=_0xc7ac3[_0x261f('0x5')]||'';this[_0x261f('0x6')]=_0xc7ac3[_0x261f('0x6')]||_0x261f('0x7');this[_0x261f('0x8')]=_0xc7ac3['serverUrl']||'';this['Configurations']=_0xc7ac3[_0x261f('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x631d=['type','integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x631d,0x7e));var _0xd631=function(_0x65114a,_0x538c71){_0x65114a=_0x65114a-0x0;var _0x97ba34=_0x631d[_0x65114a];return _0x97ba34;};'use strict';function ZendeskAccount(_0x1a0daa){this['id']=_0x1a0daa['id']||0x0;this[_0xd631('0x0')]=_0x1a0daa[_0xd631('0x0')]||'';this['username']=_0x1a0daa[_0xd631('0x1')]||'';this['password']=_0x1a0daa[_0xd631('0x2')]||'';this[_0xd631('0x3')]=_0x1a0daa[_0xd631('0x3')]||'';this[_0xd631('0x4')]=_0x1a0daa[_0xd631('0x4')]||'';this['authType']=_0x1a0daa[_0xd631('0x5')]||'';this[_0xd631('0x6')]=_0x1a0daa[_0xd631('0x6')]||_0xd631('0x7');this[_0xd631('0x8')]=_0x1a0daa[_0xd631('0x8')]||'';this['Configurations']=_0x1a0daa[_0xd631('0x9')]||{};}module[_0xd631('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 60eb9d5..f36f17f 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 _0xb456=['serverUrl','code','refreshToken','exports','name','description','host','clientId','clientSecret'];(function(_0x547ba7,_0x522bf2){var _0x20513a=function(_0xeb2db5){while(--_0xeb2db5){_0x547ba7['push'](_0x547ba7['shift']());}};_0x20513a(++_0x522bf2);}(_0xb456,0x13f));var _0x6b45=function(_0x36d408,_0x29def2){_0x36d408=_0x36d408-0x0;var _0x3a37c8=_0xb456[_0x36d408];return _0x3a37c8;};'use strict';function ZohoAccount(_0x521788){this['id']=_0x521788['id']||0x0;this['name']=_0x521788[_0x6b45('0x0')]||'';this[_0x6b45('0x1')]=_0x521788[_0x6b45('0x1')]||'';this['host']=_0x521788[_0x6b45('0x2')]||'';this['zone']=_0x521788['zone']||'';this['clientId']=_0x521788[_0x6b45('0x3')]||'';this['clientSecret']=_0x521788[_0x6b45('0x4')]||'';this[_0x6b45('0x5')]=_0x521788['serverUrl']||'';this[_0x6b45('0x6')]=_0x521788[_0x6b45('0x6')]||'';this[_0x6b45('0x7')]=_0x521788[_0x6b45('0x7')]||'';this['Configurations']=_0x521788['Configurations']||{};}module[_0x6b45('0x8')]=ZohoAccount; \ No newline at end of file +var _0xf49a=['exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf49a,0x1b9));var _0xaf49=function(_0x49e66,_0x43f4b9){_0x49e66=_0x49e66-0x0;var _0x545549=_0xf49a[_0x49e66];return _0x545549;};'use strict';function ZohoAccount(_0x460fdf){this['id']=_0x460fdf['id']||0x0;this[_0xaf49('0x0')]=_0x460fdf[_0xaf49('0x0')]||'';this['description']=_0x460fdf[_0xaf49('0x1')]||'';this[_0xaf49('0x2')]=_0x460fdf[_0xaf49('0x2')]||'';this[_0xaf49('0x3')]=_0x460fdf[_0xaf49('0x3')]||'';this[_0xaf49('0x4')]=_0x460fdf[_0xaf49('0x4')]||'';this['clientSecret']=_0x460fdf[_0xaf49('0x5')]||'';this[_0xaf49('0x6')]=_0x460fdf['serverUrl']||'';this[_0xaf49('0x7')]=_0x460fdf[_0xaf49('0x7')]||'';this[_0xaf49('0x8')]=_0x460fdf[_0xaf49('0x8')]||'';this['Configurations']=_0x460fdf[_0xaf49('0x9')]||{};}module[_0xaf49('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 5f70587..e7e3427 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 _0xb44a=['recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','Contact','lastName','active','calleridnum','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x34986b,_0x56fb4a){var _0x28a0d1=function(_0x2c1e2a){while(--_0x2c1e2a){_0x34986b['push'](_0x34986b['shift']());}};_0x28a0d1(++_0x56fb4a);}(_0xb44a,0x1c2));var _0xab44=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0xb44a[_0x26bf51];return _0x503415;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab44('0x0'));function checkNameSurname(_0x492c1a,_0x186fec,_0x5c825d){var _0x50cb3c='';if(!_[_0xab44('0x1')](_0x186fec)&&'string'===typeof _0x186fec){_0x50cb3c+=_0x186fec;}if(!_[_0xab44('0x1')](_0x5c825d)&&_0xab44('0x2')===typeof _0x5c825d){_0x50cb3c+='\x20'+_0x5c825d;}if(_0x50cb3c!==''){return _0x50cb3c;}return _0x492c1a;}function Action(_0x2e3662,_0x28681a,_0x2f3948,_0x3303b1,_0x3ead8d){this[_0xab44('0x3')]=_0x2f3948||undefined;this[_0xab44('0x4')]=_0x2e3662['id'];this[_0xab44('0x5')]=_0x28681a[_0xab44('0x6')];this[_0xab44('0x7')]=_0x28681a[_0xab44('0x7')];this['campaigntype']=_0xab44('0x5');this['dialAnswer']=![];this[_0xab44('0x8')]=_['isNil'](_0x2e3662['Agent'])?undefined:_0x2e3662[_0xab44('0x9')][_0xab44('0x6')];this[_0xab44('0xa')]=this[_0xab44('0x8')]?util[_0xab44('0xb')](_0xab44('0xc'),this['membername']):_0x3303b1||undefined;this['calleridname']=checkNameSurname(_0x2e3662[_0xab44('0xd')]['phone'],_0x2e3662[_0xab44('0xd')]['firstName'],_0x2e3662[_0xab44('0xd')][_0xab44('0xe')]);this[_0xab44('0xf')]=_0x2e3662[_0xab44('0xf')]||![];this[_0xab44('0x10')]=_0x2e3662[_0xab44('0x11')];this['scheduledat']=_0x2e3662['scheduledat'];this[_0xab44('0x12')]=_0x2e3662[_0xab44('0x12')]||0x0;this[_0xab44('0x13')]=_0x2e3662[_0xab44('0x13')]||0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=(_0x2e3662[_0xab44('0x12')]||0x0)+(_0x2e3662[_0xab44('0x13')]||0x0)+(_0x2e3662[_0xab44('0x14')]||0x0)+(_0x2e3662[_0xab44('0x16')]||0x0)+(_0x2e3662['countdropretry']||0x0)+(_0x2e3662[_0xab44('0x17')]||0x0)+(_0x2e3662[_0xab44('0x18')]||0x0)+(_0x2e3662[_0xab44('0x19')]||0x0);this[_0xab44('0x16')]=_0x2e3662[_0xab44('0x16')]||0x0;this['countdropretry']=_0x2e3662[_0xab44('0x1a')]||0x0;this['countabandonedretry']=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=_0x2e3662[_0xab44('0x18')]||0x0;this[_0xab44('0x19')]=_0x2e3662['countagentrejectretry']||0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')];this[_0xab44('0x1c')]=_0x2e3662[_0xab44('0x1c')];this[_0xab44('0x1d')]=_0x2e3662[_0xab44('0x1d')];this[_0xab44('0x1e')]=_0x2e3662['recallme'];this['ContactId']=_0x2e3662[_0xab44('0x1f')];this['ListId']=_0x2e3662[_0xab44('0x20')];this['UserId']=_[_0xab44('0x1')](_0x2e3662['Agent'])?_0x2e3662['UserId']:_0x2e3662[_0xab44('0x9')]['id'];this[_0xab44('0x21')]=_0x2e3662[_0xab44('0x21')];this[_0xab44('0x22')]='';this[_0xab44('0x23')]='';}Action['prototype'][_0xab44('0x24')]=function(){return util[_0xab44('0xb')]('\x22%s\x22\x20<%s>',this[_0xab44('0x25')],this[_0xab44('0x26')]);};module[_0xab44('0x27')]=Action; \ No newline at end of file +var _0x9582=['phone','lastName','calleridnum','scheduledat','countcongestionretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','name','type','queue','membername','Agent','format','SIP/%s','calleridname','Contact'];(function(_0x4001cb,_0xef052f){var _0x3ef9b5=function(_0x42b42c){while(--_0x42b42c){_0x4001cb['push'](_0x4001cb['shift']());}};_0x3ef9b5(++_0xef052f);}(_0x9582,0x95));var _0x2958=function(_0x2043b0,_0x39d345){_0x2043b0=_0x2043b0-0x0;var _0x5d38a6=_0x9582[_0x2043b0];return _0x5d38a6;};'use strict';var util=require(_0x2958('0x0'));var _=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));function checkNameSurname(_0x3d6d1f,_0x42752c,_0x176287){var _0x559a01='';if(!_[_0x2958('0x3')](_0x42752c)&&_0x2958('0x4')===typeof _0x42752c){_0x559a01+=_0x42752c;}if(!_[_0x2958('0x3')](_0x176287)&&_0x2958('0x4')===typeof _0x176287){_0x559a01+='\x20'+_0x176287;}if(_0x559a01!==''){return _0x559a01;}return _0x3d6d1f;}function Action(_0x2f15c9,_0xbde128,_0x88ffaa,_0x309525,_0xa385ec){this[_0x2958('0x5')]=_0x88ffaa||undefined;this['idContact']=_0x2f15c9['id'];this['queue']=_0xbde128[_0x2958('0x6')];this['type']=_0xbde128[_0x2958('0x7')];this['campaigntype']=_0x2958('0x8');this['dialAnswer']=![];this[_0x2958('0x9')]=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?undefined:_0x2f15c9[_0x2958('0xa')][_0x2958('0x6')];this['channelAgent']=this[_0x2958('0x9')]?util[_0x2958('0xb')](_0x2958('0xc'),this[_0x2958('0x9')]):_0x309525||undefined;this[_0x2958('0xd')]=checkNameSurname(_0x2f15c9[_0x2958('0xe')][_0x2958('0xf')],_0x2f15c9[_0x2958('0xe')]['firstName'],_0x2f15c9[_0x2958('0xe')][_0x2958('0x10')]);this['active']=_0x2f15c9['active']||![];this[_0x2958('0x11')]=_0x2f15c9[_0x2958('0xf')];this['scheduledat']=_0x2f15c9[_0x2958('0x12')];this['countbusyretry']=_0x2f15c9['countbusyretry']||0x0;this[_0x2958('0x13')]=_0x2f15c9[_0x2958('0x13')]||0x0;this['countnoanswerretry']=_0x2f15c9['countnoanswerretry']||0x0;this[_0x2958('0x14')]=(_0x2f15c9[_0x2958('0x15')]||0x0)+(_0x2f15c9[_0x2958('0x13')]||0x0)+(_0x2f15c9[_0x2958('0x16')]||0x0)+(_0x2f15c9[_0x2958('0x17')]||0x0)+(_0x2f15c9['countdropretry']||0x0)+(_0x2f15c9[_0x2958('0x18')]||0x0)+(_0x2f15c9[_0x2958('0x19')]||0x0)+(_0x2f15c9[_0x2958('0x1a')]||0x0);this['countnosuchnumberretry']=_0x2f15c9[_0x2958('0x17')]||0x0;this['countdropretry']=_0x2f15c9[_0x2958('0x1b')]||0x0;this['countabandonedretry']=_0x2f15c9['countabandonedretry']||0x0;this[_0x2958('0x19')]=_0x2f15c9[_0x2958('0x19')]||0x0;this[_0x2958('0x1a')]=_0x2f15c9[_0x2958('0x1a')]||0x0;this[_0x2958('0x1c')]=_0x2f15c9[_0x2958('0x1c')];this[_0x2958('0x1d')]=_0x2f15c9[_0x2958('0x1d')];this[_0x2958('0x1e')]=_0x2f15c9[_0x2958('0x1e')];this[_0x2958('0x1f')]=_0x2f15c9[_0x2958('0x1f')];this[_0x2958('0x20')]=_0x2f15c9[_0x2958('0x20')];this[_0x2958('0x21')]=_0x2f15c9['ListId'];this['UserId']=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?_0x2f15c9[_0x2958('0x22')]:_0x2f15c9[_0x2958('0xa')]['id'];this['VoiceQueueId']=_0x2f15c9[_0x2958('0x23')];this['originatecalleridnum']='';this[_0x2958('0x24')]='';}Action[_0x2958('0x25')][_0x2958('0x26')]=function(){return util[_0x2958('0xb')](_0x2958('0x27'),this[_0x2958('0xd')],this[_0x2958('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 27860d9..5ac019e 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 _0x3cd7=['hasOwnProperty','dialMethod','booked','clearZombieChannels','outbound','setMessage','clearZombieChannel','sequence','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','contactId','VoiceQueueId','Action','status','channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','BUSY','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','swapAdditionalPhones','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialAgentRejectRetryFrequency','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','reason','createAgentHistory','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','checkInBlack','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','Calling','logger','Call\x20failed','logBlacklist','createHistory','SIP/%s','reachable','unmonitored','execRun','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','pick','phone','Call\x20unsuccessful','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variables','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','defaults','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','name','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','total','abandoned','dialActive','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice:queue:%s','sendMessageOneNotActive','originated','available','paused','message','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns'];(function(_0x3e7597,_0x776edc){var _0xe652c3=function(_0x3fb191){while(--_0x3fb191){_0x3e7597['push'](_0x3e7597['shift']());}};_0xe652c3(++_0x776edc);}(_0x3cd7,0xf4));var _0x73cd=function(_0x4c42f3,_0x2d920b){_0x4c42f3=_0x4c42f3-0x0;var _0x416cb9=_0x3cd7[_0x4c42f3];return _0x416cb9;};'use strict';var util=require(_0x73cd('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0x73cd('0x1'));var md5=require(_0x73cd('0x2'));var Redis=require('ioredis');var config=require(_0x73cd('0x3'));var logger=require(_0x73cd('0x4'))(_0x73cd('0x5'));var loggerAction=require(_0x73cd('0x4'))(_0x73cd('0x6'));var ami=require(_0x73cd('0x7'));var rpcDb=require(_0x73cd('0x8'));var cmHopperAdditionalPhone=require(_0x73cd('0x9'));var Action=require(_0x73cd('0xa'));var ut=require('./util/util');config['redis']=_[_0x73cd('0xb')](config[_0x73cd('0xc')],{'host':_0x73cd('0xd'),'port':0x18eb});var io=require(_0x73cd('0xe'))(new Redis(config[_0x73cd('0xc')]));var Sequence=function(){};Sequence[_0x73cd('0xf')][_0x73cd('0x10')]=function(_0xaa6a4){this[_0x73cd('0x11')]=this[_0x73cd('0x11')]?this[_0x73cd('0x11')][_0x73cd('0x12')](_0xaa6a4):_0xaa6a4();};function Preview(_0x242e8f){this['sequence']=new Sequence();this[_0x73cd('0x13')]=_0x242e8f['voiceQueues'];this[_0x73cd('0x14')]=_0x242e8f[_0x73cd('0x14')];this[_0x73cd('0x15')]={};this[_0x73cd('0x16')]=_0x242e8f[_0x73cd('0x16')];this[_0x73cd('0x17')]=0x0;ami['on']('originateresponse',this[_0x73cd('0x18')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1a'),this[_0x73cd('0x1b')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1c'),this[_0x73cd('0x1d')][_0x73cd('0x19')](this));ami['on']('dialend',this[_0x73cd('0x1e')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x1f'),this[_0x73cd('0x20')]['bind'](this));ami['on'](_0x73cd('0x21'),this[_0x73cd('0x22')][_0x73cd('0x19')](this));ami['on'](_0x73cd('0x23'),this[_0x73cd('0x24')][_0x73cd('0x19')](this));ami['on']('blindtransfer',this[_0x73cd('0x25')]['bind'](this));this[_0x73cd('0x26')](this[_0x73cd('0x13')]);}function emit(_0x5de83a,_0xadfab5,_0x1216b6){io['to'](_0x5de83a)[_0x73cd('0x27')](_0xadfab5,_0x1216b6);}function emitCampaignPreview(_0xc5464b){if(_0xc5464b[_0x73cd('0x28')]==='outbound'){var _0x2684ab={'id':_0xc5464b['id'],'name':_0xc5464b[_0x73cd('0x29')],'strategy':_0xc5464b[_0x73cd('0x2a')],'answered':_0xc5464b[_0x73cd('0x2b')],'available':_0xc5464b['available'],'loggedIn':_0xc5464b['loggedIn'],'pTalking':_0xc5464b[_0x73cd('0x2c')],'sumBillable':_0xc5464b[_0x73cd('0x2d')],'sumDuration':_0xc5464b[_0x73cd('0x2e')],'sumHoldTime':_0xc5464b[_0x73cd('0x2f')]||0x0,'talking':_0xc5464b['talking'],'total':_0xc5464b[_0x73cd('0x30')],'type':_0xc5464b[_0x73cd('0x28')],'unmanaged':_0xc5464b['unmanaged'],'abandoned':_0xc5464b[_0x73cd('0x31')],'waiting':_0xc5464b['waiting'],'loggedInDb':_0xc5464b['loggedInDb'],'dialActive':_0xc5464b[_0x73cd('0x32')],'dialMethod':_0xc5464b['dialMethod'],'dialOriginateCallerIdName':_0xc5464b['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0xc5464b['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0xc5464b[_0x73cd('0x33')],'dialPrefix':_0xc5464b[_0x73cd('0x34')],'outboundAnswerAgiCallsDay':_0xc5464b[_0x73cd('0x35')],'outboundAnswerCallsDay':_0xc5464b['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0xc5464b[_0x73cd('0x36')],'outboundBusyCallsDay':_0xc5464b[_0x73cd('0x37')],'outboundCongestionCallsDay':_0xc5464b['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0xc5464b[_0x73cd('0x38')],'outboundDropCallsDayCallersExit':_0xc5464b[_0x73cd('0x39')],'outboundDropCallsDayTimeout':_0xc5464b[_0x73cd('0x3a')],'outboundNoAnswerCallsDay':_0xc5464b[_0x73cd('0x3b')],'outboundNoSuchCallsDay':_0xc5464b[_0x73cd('0x3c')],'outboundOriginateFailureCallsDay':_0xc5464b[_0x73cd('0x3d')],'outboundReCallsDay':_0xc5464b[_0x73cd('0x3e')],'outboundRejectCallsDay':_0xc5464b['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0xc5464b[_0x73cd('0x3f')],'outboundAbandonedCallsDay':_0xc5464b[_0x73cd('0x40')],'predictiveIntervalAnsweredCalls':_0xc5464b['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xc5464b[_0x73cd('0x41')],'predictiveIntervalAvgTalktime':_0xc5464b[_0x73cd('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0xc5464b[_0x73cd('0x43')],'predictiveIntervalDroppedCallsTimeout':_0xc5464b[_0x73cd('0x44')],'predictiveIntervalErlangCalls':_0xc5464b[_0x73cd('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0xc5464b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xc5464b[_0x73cd('0x46')],'predictiveIntervalMultiplicativeFactor':_0xc5464b['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0xc5464b['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0xc5464b[_0x73cd('0x47')],'predictiveIntervalTotalCalls':_0xc5464b[_0x73cd('0x48')],'message':_0xc5464b['message'],'originated':_0xc5464b['originated'],'erlangCalls':_0xc5464b[_0x73cd('0x49')],'erlangCallToSecond':_0xc5464b[_0x73cd('0x4a')],'erlangAbandonmentRate':_0xc5464b[_0x73cd('0x4b')],'erlangBusyFactor':_0xc5464b[_0x73cd('0x4c')],'startPredictive':_0xc5464b[_0x73cd('0x4d')],'startProgressive':_0xc5464b[_0x73cd('0x4e')]};if(_0xc5464b[_0x73cd('0x4f')]){_0x2684ab['Trunk']={'id':_0xc5464b['Trunk']['id'],'name':_0xc5464b['Trunk'][_0x73cd('0x29')],'active':_0xc5464b[_0x73cd('0x4f')][_0x73cd('0x50')],'callerid':_0xc5464b[_0x73cd('0x4f')][_0x73cd('0x51')]};}if(_0xc5464b[_0x73cd('0x52')]){_0x2684ab[_0x73cd('0x52')]={'id':_0xc5464b[_0x73cd('0x52')]['id'],'name':_0xc5464b[_0x73cd('0x52')]['name']};}var _0x35c481=md5(JSON[_0x73cd('0x53')](_0x2684ab));if(_0xc5464b[_0x73cd('0x2')]!==_0x35c481){_0xc5464b[_0x73cd('0x2')]=_0x35c481;emit(util[_0x73cd('0x54')]('voice:queue:%s',_0x2684ab[_0x73cd('0x29')]),_0x73cd('0x55'),_0x2684ab);}}}function emitVoiceQueueChannelRemove(_0x2c5449){logger['info'](_0x73cd('0x56'),JSON[_0x73cd('0x53')](_0x2c5449));emit(util['format'](_0x73cd('0x57'),_0x2c5449[_0x73cd('0x29')]),'voice_queue_channel:remove',_0x2c5449);io['emit']('voice_queue_presence:remove',_0x2c5449);}function notSendMessagesQueue(_0x4ce1ba){if(_0x4ce1ba[_0x73cd('0x58')]){if(_0x4ce1ba[_0x73cd('0x59')]===0x0&&_0x4ce1ba[_0x73cd('0x2c')]===0x0){_0x4ce1ba[_0x73cd('0x58')]=![];_0x4ce1ba[_0x73cd('0x5a')]=0x0;_0x4ce1ba[_0x73cd('0x5b')]=0x0;_0x4ce1ba[_0x73cd('0x5c')]='NOT_ACTIVE';ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4ce1ba['name']+_0x73cd('0x5d'));}else{_0x4ce1ba[_0x73cd('0x5c')]=_0x73cd('0x5e');ut['logger'](_0x73cd('0x5f'),_0x4ce1ba[_0x73cd('0x29')]+'\x20is\x20deactivated');}emitCampaignPreview(_0x4ce1ba);}}Preview[_0x73cd('0xf')]['loopCampaigns']=function(){var _0x7bedcb=this;setInterval(function(){_0x7bedcb[_0x73cd('0x60')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x6893a=this['campaignsPreview'];this[_0x73cd('0x17')]+=0x1;for(var _0x91dfa5 in _0x6893a){if(_0x6893a[_0x73cd('0x61')](_0x91dfa5)&&(_0x6893a[_0x91dfa5][_0x73cd('0x62')]===_0x73cd('0x5')||_0x6893a[_0x91dfa5][_0x73cd('0x62')]===_0x73cd('0x63'))&&_0x6893a[_0x91dfa5][_0x73cd('0x28')]==='outbound'){if(this[_0x73cd('0x17')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x73cd('0x64')]();}}if(_0x6893a[_0x73cd('0x61')](_0x91dfa5)&&_0x6893a[_0x91dfa5][_0x73cd('0x62')]==='preview'&&_0x6893a[_0x91dfa5]['type']===_0x73cd('0x65')){if(_0x6893a[_0x91dfa5][_0x73cd('0x32')]){this[_0x73cd('0x66')](_0x6893a[_0x91dfa5]);if(_0x6893a[_0x91dfa5]['dialPreviewAutoRecallMe'])this['recallMe'](_0x6893a[_0x91dfa5]);}else{notSendMessagesQueue(_0x6893a[_0x91dfa5]);}}}};Preview[_0x73cd('0xf')][_0x73cd('0x67')]=function(_0x581c85){var _0x41a474=this;this[_0x73cd('0x68')]['enqueue'](function(){if(!_['isNil'](_0x41a474['actions'][_0x581c85])){loggerAction[_0x73cd('0x69')](_0x73cd('0x6a'),_0x581c85,_0x73cd('0x6b'),_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')],_0x73cd('0x6d'),JSON['stringify'](_0x41a474[_0x73cd('0x13')][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]][_0x73cd('0x59')]),_0x73cd('0x6e'),JSON['stringify'](_0x41a474['campaignsPreview'][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]][_0x73cd('0x2c')]),JSON[_0x73cd('0x53')](_0x41a474[_0x73cd('0x15')][_0x581c85]['dialAnswer']),JSON[_0x73cd('0x53')](_['pick'](_0x41a474[_0x73cd('0x15')][_0x581c85],[_0x73cd('0x6f'),'UserId',_0x73cd('0x70'),'ListId'])));return ami[_0x73cd('0x71')]({'action':_0x73cd('0x72'),'channel':_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x73')]})['catch'](function(_0x18ecef){if(_0x18ecef[_0x73cd('0x5c')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x41a474[_0x73cd('0x15')][_0x581c85]){ut[_0x73cd('0x74')](_0x41a474[_0x73cd('0x13')][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]],'[clearZombieChannel]');if(_0x41a474['actions'][_0x581c85][_0x73cd('0x75')]===!![]){ut[_0x73cd('0x76')](_0x41a474['campaignsPreview'][_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]],_0x73cd('0x77'));ut['loggerError'](_0x73cd('0x78')+_0x581c85,_0x41a474[_0x73cd('0x15')][_0x581c85][_0x73cd('0x6c')]);}ut[_0x73cd('0x79')](_0x73cd('0x7a')+_0x581c85,_0x41a474['actions'][_0x581c85][_0x73cd('0x6c')]);delete _0x41a474[_0x73cd('0x15')][_0x581c85];}},0x2328);}});}});};Preview['prototype'][_0x73cd('0x64')]=function(){var _0x3551f5=this;loggerAction[_0x73cd('0x69')]('[action]',_[_0x73cd('0x7b')](this['actions']));for(var _0x40ae35 in this['actions']){if(_0x3551f5[_0x73cd('0x15')][_0x73cd('0x61')](_0x40ae35)){_0x3551f5[_0x73cd('0x67')](_0x40ae35);}}};Preview[_0x73cd('0xf')][_0x73cd('0x7c')]=function(_0x364032){var _0x2eb255=this;rpcDb[_0x73cd('0x7d')](_0x364032['id'],ut[_0x73cd('0x7e')](this[_0x73cd('0x16')]))[_0x73cd('0x7f')](function(_0x21ad8d){if(!_[_0x73cd('0x80')](_0x21ad8d)){for(var _0x1e748b=0x0;_0x1e748b<_0x21ad8d[_0x73cd('0x81')];_0x1e748b+=0x1){if(ut[_0x73cd('0x82')](_0x21ad8d[_0x1e748b][_0x73cd('0x83')])<_0x364032['dialRecallMeTimeout']*0x3c){if(_0x21ad8d[_0x1e748b][_0x73cd('0x84')]&&!_0x21ad8d[_0x1e748b][_0x73cd('0x84')][_0x73cd('0x85')]){_0x2eb255[_0x73cd('0x86')](_0x21ad8d[_0x1e748b]['id'])['then'](ut['logger2'](_0x73cd('0x87')))[_0x73cd('0x88')](ut[_0x73cd('0x89')]('[RecallMe]'));}else{rpcDb[_0x73cd('0x8a')](_0x21ad8d[_0x1e748b]['id']);}}else{var _0xda167c=new Action(_0x21ad8d[_0x1e748b],_0x364032);_0xda167c[_0x73cd('0x8b')]=moment()[_0x73cd('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x364032[_0x73cd('0x3e')]+=0x1;ut['logCustomer'](_0xda167c,0x17,_0x73cd('0x8c'));if(_0x364032[_0x73cd('0x8d')]){rpcDb[_0x73cd('0x8e')](ut[_0x73cd('0x8f')](_0x21ad8d[_0x1e748b]));rpcDb[_0x73cd('0x90')](_0xda167c,_0x73cd('0x91'));}else{ut[_0x73cd('0x92')](_0xda167c,0x16,'RecallFailedTimeout');rpcDb[_0x73cd('0x90')](_0xda167c,_0x73cd('0x93'));rpcDb[_0x73cd('0x94')](_0xda167c,_0x73cd('0x93'));}}}}})['catch'](ut[_0x73cd('0x89')](_0x73cd('0x95')));};Preview[_0x73cd('0xf')][_0x73cd('0x66')]=function(_0xbd0d0c){_0xbd0d0c['sendMessageOneNotActive']=!![];if(ut[_0x73cd('0x96')](_0xbd0d0c[_0x73cd('0x97')])){_0xbd0d0c[_0x73cd('0x5c')]='AGENTS_NOT_LOGGED';}else if(!ut['isActive'](_0xbd0d0c[_0x73cd('0x32')])){_0xbd0d0c['message']=_0x73cd('0x98');}else if(!this[_0x73cd('0x99')](_0xbd0d0c[_0x73cd('0x4f')])){if(!this[_0x73cd('0x99')](_0xbd0d0c[_0x73cd('0x9a')])){_0xbd0d0c[_0x73cd('0x5c')]=_0x73cd('0x9b');}else{_0xbd0d0c['message']=_0x73cd('0x9c');}}else{_0xbd0d0c['message']='ACTIVE';}emitCampaignPreview(_0xbd0d0c);};Preview[_0x73cd('0xf')][_0x73cd('0x9d')]=function(_0x6c74ca,_0x3bc474,_0x20e485){var _0x1ca8c8=this;var _0xde29cb=this['actions'][_0x3bc474];var _0x3496f1=this[_0x73cd('0x13')][_0xde29cb[_0x73cd('0x6c')]];var _0x21d2a1;var _0x5464ec=![];var _0x1ed57f=0x2;var _0x428b62=0x3;if(_0x3496f1){switch(_0x20e485){case'1':_0x3496f1[_0x73cd('0x3c')]+=0x1;_0xde29cb[_0x73cd('0x9e')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut['totalGlobal'](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x0,_0x73cd('0xa0'));ami['emit'](_0x73cd('0xa1'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xa3')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xa4'));_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'0',_0x3496f1)['then'](function(_0x3a2693){_0x5464ec=_0x3a2693[_0x73cd('0xa6')]==0x1;_0x1ed57f=_0x3496f1[_0x73cd('0xa7')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0xf,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xac'));}else{if(_0xde29cb[_0x73cd('0x9e')]>=_0x3496f1[_0x73cd('0xad')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xac'));}else{rpcDb[_0x73cd('0xae')](ut['scheduledAt'](_0xde29cb,'countnosuchnumberretry',_0x3496f1[_0x73cd('0xa7')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];}else{_0xde29cb[_0x73cd('0x9e')]++;logger['info'](_0x73cd('0xb2'),_0xde29cb[_0x73cd('0x9e')]);logger[_0x73cd('0x69')]('id',_0xde29cb[_0x73cd('0xb3')]);_0x1ca8c8['incrementPreviewCounters']({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnosuchnumberretry':_0xde29cb['countnosuchnumberretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xb4'):var _0x56f540=moment()[_0x73cd('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0xde29cb[_0x73cd('0xb5')]=_0x56f540;_0xde29cb[_0x73cd('0xb6')]=_0x56f540;_0xde29cb[_0x73cd('0x75')]=!![];_0x3496f1['pTalking']+=0x1;logger[_0x73cd('0x69')](_0x73cd('0xb7'),_0xde29cb[_0x73cd('0xb8')],'\x20Queue',_0x3496f1[_0x73cd('0x29')],'pTalking:\x20',_0x3496f1['pTalking']);ami[_0x73cd('0x27')](_0x73cd('0xb9'),ut['buildObj'](_0xde29cb,_0x73cd('0xba'),this[_0x73cd('0x13')][_0xde29cb['queue']]));if(_0x3496f1[_0x73cd('0xbb')]){ami[_0x73cd('0x27')](_0x73cd('0xbc'),ut[_0x73cd('0xbd')](_0xde29cb));}break;case'16':ami[_0x73cd('0x27')]('custom:agentcomplete',ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xbe'),this[_0x73cd('0x13')][_0xde29cb[_0x73cd('0x6c')]]));emitVoiceQueueChannelRemove(ut[_0x73cd('0xa2')](_0xde29cb,'complete'));_0x3496f1[_0x73cd('0xbf')]+=0x1;_0x3496f1[_0x73cd('0x30')]+=0x1;_0x3496f1[_0x73cd('0x2b')]+=0x1;ut[_0x73cd('0x76')](_0x3496f1,_0x73cd('0xc0'));_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x4,_0x73cd('0xc1'));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xc2'));rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xc3'));rpcDb[_0x73cd('0xc4')](_0xde29cb);_0x3496f1[_0x73cd('0x2e')]+=_0xde29cb[_0x73cd('0xc5')];_0x3496f1[_0x73cd('0x2d')]+=_0xde29cb[_0x73cd('0xc5')];logger[_0x73cd('0x69')](_0x73cd('0xc6'),_0xde29cb[_0x73cd('0xb8')],_0x73cd('0xc7'),_0x3496f1['name'],_0x73cd('0x6e'),_0x3496f1['pTalking']);delete this[_0x73cd('0x15')][_0x6c74ca['linkedid']];break;case _0x73cd('0xc8'):_0x3496f1['outboundBusyCallsDay']+=0x1;_0xde29cb[_0x73cd('0xc9')]+=0x1;_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x5,_0x73cd('0xca'));_0x1ed57f=_0x3496f1['dialBusyRetryFrequency'];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami['emit'](_0x73cd('0xcb'),ut[_0x73cd('0xa2')](_0xde29cb,'busy'));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xcc'));_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'5',_0x3496f1)[_0x73cd('0x7f')](function(_0x4ee876){_0x5464ec=_0x4ee876[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xce'));}else{if(_0xde29cb[_0x73cd('0xc9')]>=_0x3496f1[_0x73cd('0xcf')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xcc'));}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xc9'),_0x3496f1[_0x73cd('0xd1')]),_0xde29cb['unlockAgent'],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb['countbusyretry']++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb['idContact'],'field':{'countbusyretry':_0xde29cb[_0x73cd('0xc9')]}})['then'](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xd3'):_0x3496f1['outboundNoAnswerCallsDay']+=0x1;_0xde29cb[_0x73cd('0xd4')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x3,_0x73cd('0xd5'));_0x1ed57f=_0x3496f1['dialNoAnswerRetryFrequency'];_0x428b62=_0x3496f1['callAdditionalPhoneAfterMin'];var _0x3daf05=ut['buildNoAnswerEventPayload'](_0xde29cb,_0x3496f1);ami[_0x73cd('0x27')]('custom:agentnoanswer',_0x3daf05);rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][logNoAnswer]');_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'3',_0x3496f1)['then'](function(_0x19f7d8){_0x5464ec=_0x19f7d8[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xd6'));}else{if(_0xde29cb[_0x73cd('0xd4')]>=_0x3496f1['dialNoAnswerMaxRetry']){rpcDb[_0x73cd('0x94')](_0xde29cb,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xd4'),_0x3496f1[_0x73cd('0xd7')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb['countnoanswerretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xd8'):_0x3496f1[_0x73cd('0xd9')]+=0x1;_0xde29cb[_0x73cd('0xda')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut['logCustomer'](_0xde29cb,0x8,'Congestion');_0x1ed57f=_0x3496f1[_0x73cd('0xdb')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami[_0x73cd('0x27')](_0x73cd('0xdc'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xdd')));rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][logCongestion]');_0x1ca8c8[_0x73cd('0xa5')](_0xde29cb,'8',_0x3496f1)['then'](function(_0x1144ac){_0x5464ec=_0x1144ac['additional']==0x1;if(!_0x5464ec){if(ut['totalGlobal'](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xde'));}else{if(_0xde29cb[_0x73cd('0xda')]>=_0x3496f1['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0xde29cb,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,_0x73cd('0xda'),_0x3496f1[_0x73cd('0xd1')]),_0xde29cb['unlockAgent'],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xda')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countcongestionretry':_0xde29cb['countcongestionretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});break;case _0x73cd('0xdf'):_0x3496f1[_0x73cd('0xe0')]+=0x1;_0xde29cb[_0x73cd('0xe1')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut['totalGlobal'](_0xde29cb);ut['logCustomer'](_0xde29cb,0x14,_0x73cd('0xe2'));_0x1ed57f=_0x3496f1['dialAgentRejectRetryFrequency'];_0x428b62=_0x3496f1[_0x73cd('0xa8')];ami[_0x73cd('0x27')](_0x73cd('0xe3'),ut['buildObj'](_0xde29cb,_0x73cd('0xe4')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xe5'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'20',_0x3496f1)[_0x73cd('0x7f')](function(_0x3a142e){_0x5464ec=_0x3a142e['additional']==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0x14,'AgentReject');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xe6'));}else{if(_0xde29cb[_0x73cd('0xe1')]>=_0x3496f1[_0x73cd('0xe7')]){rpcDb['createCustomerFinal'](_0xde29cb,_0x73cd('0xe6'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0xde29cb,_0x73cd('0xe1'),_0x3496f1['dialAgentRejectRetryFrequency']),_0xde29cb[_0x73cd('0xaf')],_0xde29cb[_0x73cd('0xb0')]);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb['countnoanswerretry']}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});break;case _0x73cd('0xe9'):_0x3496f1[_0x73cd('0x40')]+=0x1;_0xde29cb[_0x73cd('0xea')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0xb,'Abandoned');rpcDb['createCustomerHistory'](_0xde29cb,'[callProgressDetectingCustomer][logAbandoned]');_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'11',_0x3496f1)[_0x73cd('0x7f')](function(_0x549e86){_0x5464ec=_0x549e86[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xeb'));}else{if(_0xde29cb['countabandonedetry']>=_0x3496f1[_0x73cd('0xec')]){rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xeb'));}else{rpcDb[_0x73cd('0xae')](ut[_0x73cd('0xd0')](_0xde29cb,'countabandonedretry',_0x3496f1[_0x73cd('0xed')]),_0xde29cb[_0x73cd('0xaf')],_0xde29cb['activeContact']);}}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});break;case'18':_0x3496f1[_0x73cd('0x3f')]+=0x1;_0xde29cb['countmachineretry']+=0x1;_0xde29cb['countglobal']=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x12,_0x6c74ca['cause-txt']||_0x6c74ca['dialstatus']);ami[_0x73cd('0x27')](_0x73cd('0xee'),ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xef')));rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xf0'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'18',_0x3496f1)['then'](function(_0x32f8fc){_0x5464ec=_0x32f8fc[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0x12,'Global');rpcDb[_0x73cd('0x94')](_0x21d2a1,_0x73cd('0xf0'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8[_0x73cd('0xd2')]({'id':_0xde29cb['idContact'],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});});}});delete this[_0x73cd('0x15')][_0x6c74ca['linkedid']];break;case'19':_0x3496f1[_0x73cd('0x3f')]+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0x13,_0x6c74ca['cause-txt']||_0x6c74ca[_0x73cd('0xf1')]);ami[_0x73cd('0x27')]('custom:amd',ut[_0x73cd('0xa2')](_0xde29cb,_0x73cd('0xef')));rpcDb[_0x73cd('0x90')](_0xde29cb,'[callProgressDetectingCustomer][machine]');_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'18',_0x3496f1)[_0x73cd('0x7f')](function(_0x3e8342){_0x5464ec=_0x3e8342[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut['totalGlobal'](_0xde29cb)>=_0x3496f1[_0x73cd('0xaa')]){_0x21d2a1=ut[_0x73cd('0xab')](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xf2'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xf2'));}}else{_0xde29cb[_0x73cd('0xd4')]++;_0x1ca8c8['incrementPreviewCounters']({'id':_0xde29cb[_0x73cd('0xb3')],'field':{'countnoanswerretry':_0xde29cb[_0x73cd('0xd4')]}})[_0x73cd('0x7f')](function(){_0x1ca8c8[_0x73cd('0xe8')](_0xde29cb,_0x1ed57f,_0x428b62)['then'](function(){});});}});delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];break;default:if(_0xde29cb[_0x73cd('0x75')]){ut[_0x73cd('0x76')](_0x3496f1,_0x73cd('0xf3'));ut[_0x73cd('0x79')](_0x73cd('0xf4')+_0x3496f1['name'],_0x6c74ca);}_0x3496f1['outboundUnknownCallsDay']+=0x1;_0xde29cb[_0x73cd('0x9f')]=ut[_0x73cd('0xa9')](_0xde29cb);ut[_0x73cd('0x92')](_0xde29cb,0xc,_0x6c74ca[_0x73cd('0xf5')]||_0x6c74ca['dialstatus']);_0x1ed57f=_0x3496f1[_0x73cd('0xf6')];_0x428b62=_0x3496f1[_0x73cd('0xa8')];rpcDb[_0x73cd('0x90')](_0xde29cb,_0x73cd('0xf7'));_0x1ca8c8['verifyAdditionalPhones'](_0xde29cb,'20',_0x3496f1)[_0x73cd('0x7f')](function(_0x48647e){_0x5464ec=_0x48647e[_0x73cd('0xa6')]==0x1;if(!_0x5464ec){if(ut[_0x73cd('0xa9')](_0xde29cb)>=_0x3496f1['dialGlobalMaxRetry']){_0x21d2a1=ut['cloneAction'](_0xde29cb,0xf,_0x73cd('0xcd'));rpcDb['createCustomerFinal'](_0x21d2a1,_0x73cd('0xf8'));}else{rpcDb[_0x73cd('0x94')](_0xde29cb,_0x73cd('0xf8'));}delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];}else{_0x1ca8c8['swapAdditionalPhones'](_0xde29cb,_0x1ed57f,_0x428b62)[_0x73cd('0x7f')](function(){});}});}if(!(_0xde29cb[_0x73cd('0x75')]&&_0x20e485==='16')){ut[_0x73cd('0x74')](_0x3496f1,_0x73cd('0xf9'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0xde29cb[_0x73cd('0xb8')],'\x20Queue',_0x3496f1[_0x73cd('0x29')],_0x73cd('0x6d'),_0x3496f1[_0x73cd('0x59')]);}if(_0x20e485!==_0x73cd('0xb4')){delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xb1')]];delete this[_0x73cd('0x15')][_0x6c74ca[_0x73cd('0xfa')]];}}};Preview[_0x73cd('0xf')][_0x73cd('0xfb')]=function(_0x2974b6,_0x5c1d9a,_0x556afa){if(_[_0x73cd('0xfc')](_0x5c1d9a)&&'object'!==typeof _0x5c1d9a){return;}if(_['isUndefined'](_0x556afa)&&'object'!==typeof _0x556afa){return;}switch(_0x556afa[_0x73cd('0xfd')]){case'0':ut['logAgent'](_0x2974b6,0x0,_0x73cd('0xa0'));rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x73cd('0xff')](_0x2974b6,0x3,'NoAnswer');rpcDb[_0x73cd('0xfe')](_0x2974b6,_0x73cd('0x100'));break;case'5':ut[_0x73cd('0xff')](_0x2974b6,0x5,'Busy');rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x73cd('0xff')](_0x2974b6,0x8,'Congestion');rpcDb[_0x73cd('0xfe')](_0x2974b6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x73cd('0xff')](_0x2974b6,0x16,'AnswerAGI');rpcDb[_0x73cd('0xfe')](_0x2974b6,_0x73cd('0x101'));break;default:ut[_0x73cd('0xff')](_0x2974b6,0xc,_0x556afa[_0x73cd('0xfd')]);rpcDb['createAgentHistory'](_0x2974b6,_0x73cd('0x102'));}ut[_0x73cd('0x74')](_0x5c1d9a,_0x73cd('0x103'));logger[_0x73cd('0x69')](_0x73cd('0x104'),_0x2974b6[_0x73cd('0xb8')],'\x20Queue',_0x5c1d9a[_0x73cd('0x29')],_0x73cd('0x6d'),_0x5c1d9a['originated']);delete this['actions'][_0x2974b6[_0x73cd('0xb8')]];};Preview[_0x73cd('0xf')][_0x73cd('0xa5')]=function(_0x109fff,_0x1bba9d,_0x37b0f9){return Promise['resolve']()[_0x73cd('0x7f')](cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x109fff,_0x1bba9d,_0x37b0f9))[_0x73cd('0x88')](logger[_0x73cd('0x69')](_0x73cd('0x105')));};Preview[_0x73cd('0xf')][_0x73cd('0xe8')]=function(_0x584f92,_0x4b154a,_0x58c4f9){return Promise[_0x73cd('0x106')]()[_0x73cd('0x7f')](cmHopperAdditionalPhone[_0x73cd('0xe8')](_0x584f92,_0x4b154a,_0x58c4f9))[_0x73cd('0x88')](logger[_0x73cd('0x69')](_0x73cd('0x107')));};Preview[_0x73cd('0xf')]['incrementPreviewCounters']=function(_0x150a79){return Promise[_0x73cd('0x106')]()[_0x73cd('0x7f')](cmHopperAdditionalPhone[_0x73cd('0xd2')](_0x150a79))[_0x73cd('0x88')](logger[_0x73cd('0x69')]('[incrementPreviewCounters]\x20'));};Preview[_0x73cd('0xf')][_0x73cd('0x108')]=function(_0x2f5bfc,_0x4e1d0a,_0x25d066,_0x76a50a,_0x3e11cc){var _0x5b7d7b=this;return new Promise(function(_0x207d9e,_0x1ae953){if(_[_0x73cd('0x80')](_0x4e1d0a)||_[_0x73cd('0x80')](_0x4e1d0a['Contact'])||_['isNil'](_0x4e1d0a['phone'])||_[_0x73cd('0x80')](_0x4e1d0a[_0x73cd('0x70')])){_0x1ae953(ut[_0x73cd('0x5c')](_0x73cd('0x109'),_0x76a50a,_0x3e11cc));return;}var _0xc9774a=uuid['v4']();var _0x2f1ec1=_0x5b7d7b[_0x73cd('0x13')][_0x4e1d0a[_0x73cd('0x6b')][_0x73cd('0x29')]];var _0xe2a1c5=_0x25d066?_0x5b7d7b[_0x73cd('0x16')][_0x25d066]['id']:undefined;_0x5b7d7b[_0x73cd('0x15')][_0xc9774a]=new Action(_0x4e1d0a,_0x2f1ec1,_0xc9774a,_0x25d066,_0xe2a1c5);var _0x46d878=_0x5b7d7b[_0x73cd('0x15')][_0xc9774a];_0x46d878['unlockAgent']=_0x76a50a;_0x46d878[_0x73cd('0xb0')]=_0x3e11cc;_0x46d878[_0x73cd('0x10a')]=_0x25d066;if(_[_0x73cd('0x10b')](_0x2f5bfc)){_0x5b7d7b[_0x73cd('0x10c')](_0x46d878,_0x2f1ec1,_0x4e1d0a,_0x25d066)[_0x73cd('0x7f')](function(_0x4d28b6){logger[_0x73cd('0x69')](_0x73cd('0x10d'),_0x73cd('0x10e')+_0x46d878['queue']+'\x20IdHopper:\x20'+_0x46d878[_0x73cd('0xb3')],JSON[_0x73cd('0x53')](_0x4d28b6));ami[_0x73cd('0x27')]('custom:agentcalled',ut[_0x73cd('0xa2')](_0x46d878,'called',_0x5b7d7b[_0x73cd('0x13')][_0x46d878[_0x73cd('0x6c')]]));_0x207d9e(ut[_0x73cd('0x5c')](_0x73cd('0x10f')));})[_0x73cd('0x88')](function(_0x17caf3){ut[_0x73cd('0x110')]('[Preview][execCall][failure]',_0x17caf3);_0x1ae953(ut[_0x73cd('0x5c')](_0x73cd('0x111'),_0x76a50a,_0x3e11cc));});}else{_0x2f1ec1[_0x73cd('0x36')]+=0x1;ut[_0x73cd('0x112')](_0x46d878);rpcDb[_0x73cd('0x113')](_0x46d878,'[Blacklist][error]');delete _0x5b7d7b[_0x73cd('0x15')][_0xc9774a];_0x1ae953(ut[_0x73cd('0x5c')]('Contact\x20in\x20black\x20List',_0x76a50a,_0x3e11cc));}});};Preview[_0x73cd('0xf')]['isTrunkReachable']=function(_0xb656d9){return!_[_0x73cd('0x80')](_0xb656d9)&&!_['isNil'](_0xb656d9[_0x73cd('0x29')])&&!_['isNil'](_0xb656d9[_0x73cd('0x50')])&&_0xb656d9['active']&&!_['isNil'](this['trunks'][util['format'](_0x73cd('0x114'),_0xb656d9['name'])])&&!_['isNil'](this['trunks'][util[_0x73cd('0x54')]('SIP/%s',_0xb656d9[_0x73cd('0x29')])][_0x73cd('0x72')])&&(this[_0x73cd('0x14')][util[_0x73cd('0x54')](_0x73cd('0x114'),_0xb656d9['name'])][_0x73cd('0x72')]===_0x73cd('0x115')||this[_0x73cd('0x14')][util[_0x73cd('0x54')]('SIP/%s',_0xb656d9[_0x73cd('0x29')])][_0x73cd('0x72')]===_0x73cd('0x116'));};Preview['prototype'][_0x73cd('0x86')]=function(_0x3db7a,_0x4e250f){var _0x4753a3=this;return new Promise(function(_0xed43c5,_0x256f3e){_0x4753a3[_0x73cd('0x117')](_0x3db7a,_0x4e250f)['then'](function(_0x950d2f){_0xed43c5(_['pick'](_0x950d2f,[_0x73cd('0x5c')]));})[_0x73cd('0x88')](function(_0x1bf2e8){if(_0x1bf2e8['unlock']){rpcDb[_0x73cd('0x118')](_0x3db7a);}if(_0x1bf2e8[_0x73cd('0x50')]){rpcDb[_0x73cd('0x8a')](_0x3db7a);}_0x256f3e(_['pick'](_0x1bf2e8,[_0x73cd('0x5c')]));});});};Preview['prototype']['execRun']=function(_0x42418c,_0x5d322d){var _0x24d7a5=this;return new Promise(function(_0x27399c,_0x29d923){var _0x52a56f,_0x315f26;rpcDb[_0x73cd('0x119')](_0x42418c)[_0x73cd('0x7f')](function(_0x3e0a5d){if(!_[_0x73cd('0x80')](_0x3e0a5d[0x0])){_0x315f26=_0x3e0a5d[0x0]['recallme']?![]:!![];_0x52a56f=_0x3e0a5d[0x0][_0x73cd('0x11a')]?!![]:![];_0x52a56f=_0x5d322d?!![]:_0x52a56f;}var _0x38116e=_0x24d7a5[_0x73cd('0x11b')](_0x3e0a5d);if(_0x38116e[_0x73cd('0x11c')]){rpcDb[_0x73cd('0x11d')](_[_0x73cd('0x11e')](_0x3e0a5d[0x0],[_0x73cd('0x70'),_0x73cd('0x11f')]))[_0x73cd('0x7f')](function(_0x378c17){_0x24d7a5['checkInBlack'](_0x378c17,_0x3e0a5d[0x0],_0x5d322d,_0x315f26,_0x52a56f)[_0x73cd('0x7f')](function(_0x3842cd){_0x27399c(_0x3842cd);})[_0x73cd('0x88')](function(_0x1f1937){_0x29d923(_0x1f1937);});})[_0x73cd('0x88')](function(_0x5253d3){ut['logger']('[Preview][checkIsBlackList]',_0x5253d3);_0x29d923(ut[_0x73cd('0x5c')](_0x73cd('0x120'),_0x315f26,_0x52a56f));});}else{_0x29d923(ut[_0x73cd('0x5c')](_0x38116e[_0x73cd('0x5c')],_0x315f26,_0x52a56f));}})['catch'](function(_0x39570b){ut[_0x73cd('0x110')](_0x73cd('0x121'),_0x39570b);_0x29d923(ut[_0x73cd('0x5c')](_0x73cd('0x120'),![],!![]));});});};Preview['prototype'][_0x73cd('0x11b')]=function(_0x363513){if(_[_0x73cd('0x80')](_0x363513)||_[_0x73cd('0x10b')](_0x363513)||!_[_0x73cd('0x80')](_0x363513[0x0][_0x73cd('0x84')])&&_[_0x73cd('0x80')](_0x363513[0x0]['Agent'][_0x73cd('0x29')])){ut[_0x73cd('0x110')]('[Preview][validateContact][Empty\x20Contact]',_0x363513);return{'isValid':![],'message':_0x73cd('0x122')};}var _0x35237f=this[_0x73cd('0x13')][_0x363513[0x0][_0x73cd('0x6b')][_0x73cd('0x29')]];_0x35237f['message']=_0x73cd('0x9c');if(_[_0x73cd('0x80')](_0x35237f)){ut[_0x73cd('0x110')](_0x73cd('0x123'),_0x35237f);return{'isValid':![],'message':_0x73cd('0x124')};}if(!this[_0x73cd('0x99')](_0x35237f[_0x73cd('0x4f')])){ut[_0x73cd('0x110')](_0x73cd('0x125'),'campaign\x20Name:\x20'+_0x35237f[_0x73cd('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x73cd('0x99')](_0x35237f[_0x73cd('0x9a')])){ut['logger'](_0x73cd('0x125'),_0x35237f[_0x73cd('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x73cd('0x126')](_0x35237f[_0x73cd('0x32')])){ut[_0x73cd('0x110')](_0x73cd('0x127'),_0x35237f[_0x73cd('0x29')]+_0x73cd('0x128'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x35237f['name']+_0x73cd('0x128')};}return{'isValid':!![],'message':_0x73cd('0x129')};};Preview['prototype'][_0x73cd('0x10c')]=function(_0x22bec3,_0x10289e,_0x4a8dfb,_0x4d8c62){var _0x1af28c=this;return new Promise(function(_0x4c6632,_0x14e3ea){var _0x598083=_0x22bec3[_0x73cd('0xb8')];var _0x21d90f=_0x1af28c['isTrunkReachable'](_0x10289e[_0x73cd('0x4f')])?util[_0x73cd('0x54')](_0x73cd('0x12a'),_0x10289e['Trunk'][_0x73cd('0x29')],_[_0x73cd('0x80')](_0x10289e['dialPrefix'])?'':_0x10289e[_0x73cd('0x34')][_0x73cd('0x12b')]()||'',_0x10289e[_0x73cd('0x12c')]>0x0?_0x4a8dfb['phone']['substring'](_0x10289e['dialCutDigit']):_0x4a8dfb[_0x73cd('0x11f')]):util['format'](_0x73cd('0x12a'),_[_0x73cd('0x80')](_0x10289e[_0x73cd('0x9a')])?_0x10289e[_0x73cd('0x4f')][_0x73cd('0x29')]:_0x10289e[_0x73cd('0x9a')]['name'],_[_0x73cd('0x80')](_0x10289e['dialPrefix'])?'':_0x10289e[_0x73cd('0x34')][_0x73cd('0x12b')]()||'',_0x10289e[_0x73cd('0x12c')]>0x0?_0x4a8dfb[_0x73cd('0x11f')][_0x73cd('0x12d')](_0x10289e[_0x73cd('0x12c')]):_0x4a8dfb[_0x73cd('0x11f')]);var _0x12934b=_0x1af28c[_0x73cd('0x99')](_0x10289e[_0x73cd('0x4f')])?ut['getCallerId'](_0x10289e[_0x73cd('0x4f')][_0x73cd('0x51')],_0x10289e[_0x73cd('0x12e')],_0x10289e[_0x73cd('0x12f')]>0x0?ut[_0x73cd('0x130')](_0x10289e[_0x73cd('0x131')],_0x10289e['dialRandomLastDigitCallerIdNumber']):_0x10289e[_0x73cd('0x131')]):ut[_0x73cd('0x132')](_[_0x73cd('0x80')](_0x10289e[_0x73cd('0x9a')])?_0x10289e[_0x73cd('0x4f')][_0x73cd('0x51')]:_0x10289e['TrunkBackup'][_0x73cd('0x51')],_0x10289e[_0x73cd('0x12e')],_0x10289e[_0x73cd('0x12f')]>0x0?ut[_0x73cd('0x130')](_0x10289e[_0x73cd('0x131')],_0x10289e[_0x73cd('0x12f')]):_0x10289e['dialOriginateCallerIdNumber']);if(_0x12934b){_0x22bec3['originatecalleridname']=ut[_0x73cd('0x133')](_0x12934b);_0x22bec3['originatecalleridnum']=ut[_0x73cd('0x134')](_0x12934b);}var _0x312278=ut[_0x73cd('0x135')](_0x10289e,_0x4a8dfb,_0x21d90f,_0x12934b,_0x598083,_0x22bec3);_[_0x73cd('0x136')](_0x22bec3,ut[_0x73cd('0x137')](_0x312278));_0x22bec3['starttime']=moment()['format'](_0x73cd('0x138'));_0x10289e[_0x73cd('0x139')]=_0x312278;ami[_0x73cd('0x71')](ut['variablesAction'](_0x22bec3,_0x10289e,_0x312278,_0x22bec3[_0x73cd('0xb0')],_0x4d8c62))[_0x73cd('0x7f')](function(_0x3e8a78){_0x10289e[_0x73cd('0x59')]+=0x1;logger[_0x73cd('0x69')](_0x73cd('0x13a'),_0x598083,_0x73cd('0xc7'),_0x10289e[_0x73cd('0x29')],_0x73cd('0x6d'),_0x10289e[_0x73cd('0x59')]);_0x4c6632(_0x3e8a78);})[_0x73cd('0x88')](function(_0x3d9784){ut[_0x73cd('0xff')](_0x22bec3,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x22bec3,_0x73cd('0x13b'));_0x14e3ea(_0x3d9784);});});};Preview[_0x73cd('0xf')][_0x73cd('0x20')]=function(_0x39df41){if(this[_0x73cd('0x15')][_0x39df41[_0x73cd('0xb1')]]){this[_0x73cd('0x15')][_0x39df41[_0x73cd('0xb1')]][_0x73cd('0x73')]=_0x39df41['channel'];}};Preview['prototype'][_0x73cd('0x18')]=function(_0x1e2ebc){var _0xa65421=this;var _0x501c3c=this[_0x73cd('0x15')][_0x1e2ebc[_0x73cd('0x13c')]];if(_0x501c3c){if(_0x501c3c['lookAgent']&&this[_0x73cd('0x16')][_0x501c3c[_0x73cd('0x10a')]]){ut[_0x73cd('0x13d')](_0x501c3c,this[_0x73cd('0x16')][_0x501c3c['lookAgent']][_0x73cd('0x29')],this['agents'][_0x501c3c['lookAgent']]['id']);}var _0xf985ec=_[_0x73cd('0x13e')](_0x501c3c);_0xf985ec['responsetime']=moment()[_0x73cd('0x54')](_0x73cd('0x138'));var _0x527501=_0xa65421['campaignsPreview'][_0x501c3c[_0x73cd('0x6c')]];if(ut['isFailure'](_0x1e2ebc[_0x73cd('0x13f')])){if(_0x501c3c[_0x73cd('0xaf')]){rpcDb[_0x73cd('0x118')](_0x501c3c[_0x73cd('0xb3')]);}if(_0x501c3c[_0x73cd('0xb0')]){rpcDb[_0x73cd('0x8a')](_0x501c3c[_0x73cd('0xb3')]);}ami[_0x73cd('0x27')](_0x73cd('0x140'),ut[_0x73cd('0xa2')](_0x501c3c,_0x73cd('0x141'),this['campaignsPreview'][_0x501c3c[_0x73cd('0x6c')]]));this[_0x73cd('0xfb')](_0xf985ec,_0x527501,_0x1e2ebc);}else{_0x501c3c[_0x73cd('0x8b')]=moment()[_0x73cd('0x54')](_0x73cd('0x138'));ut['logAgent'](_0xf985ec,0x4,_0x73cd('0xc1'));rpcDb['createAgentHistory'](_0xf985ec,_0x73cd('0x142'));}}};Preview[_0x73cd('0xf')][_0x73cd('0x1b')]=function(_0xf0e0ac){var _0x18b84d=this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]];var _0x408652;if(_0x18b84d){_0x408652=this[_0x73cd('0x13')][_0x18b84d['queue']];logger[_0x73cd('0x69')](_0x73cd('0x143'),_0xf0e0ac[_0x73cd('0xb1')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);}if(this[_0x73cd('0x15')][_0xf0e0ac['linkedid']]&&_0xf0e0ac[_0x73cd('0xb1')]!==_0xf0e0ac[_0x73cd('0xb8')]){if(_0xf0e0ac[_0x73cd('0x144')]==='16'&&this[_0x73cd('0x15')][_0xf0e0ac['linkedid']][_0x73cd('0x75')]){this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}else if(this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger['info'](_0x73cd('0x145'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac['cause'],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652['pTalking']);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}}else if(_0x18b84d&&_[_0x73cd('0x80')](_0x18b84d[_0x73cd('0x146')])&&_0x408652[_0x73cd('0x147')]&&_0xf0e0ac['linkedid']===_0xf0e0ac[_0x73cd('0xb8')]&&_[_0x73cd('0x80')](_0xf0e0ac[_0x73cd('0xfd')])&&_0xf0e0ac[_0x73cd('0x144')]==='16'&&_0xf0e0ac[_0x73cd('0x148')]==='6'&&_['isUndefined'](_0x18b84d[_0x73cd('0x149')])){if(_0x18b84d[_0x73cd('0xaf')]){rpcDb[_0x73cd('0x118')](_0x18b84d[_0x73cd('0xb3')]);}if(_0x18b84d['activeContact']){rpcDb[_0x73cd('0x8a')](_0x18b84d[_0x73cd('0xb3')]);}_0xf0e0ac['reason']='22';this[_0x73cd('0xfb')](_0x18b84d,_0x408652,_0xf0e0ac);}else if(_0x18b84d&&_0x18b84d[_0x73cd('0x149')]){if(_0xf0e0ac[_0x73cd('0x144')]==='16'&&this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger[_0x73cd('0x69')](_0x73cd('0x14a'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}else if(this[_0x73cd('0x15')][_0xf0e0ac[_0x73cd('0xb1')]][_0x73cd('0x75')]){logger[_0x73cd('0x69')](_0x73cd('0x145'),_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')],_0x73cd('0xc7'),_0x408652[_0x73cd('0x29')],_0x73cd('0x6e'),_0x408652[_0x73cd('0x2c')]);this[_0x73cd('0x9d')](_0xf0e0ac,_0xf0e0ac[_0x73cd('0xb1')],_0xf0e0ac[_0x73cd('0x144')]);}}};Preview[_0x73cd('0xf')][_0x73cd('0x1e')]=function(_0x4921d2){if(this[_0x73cd('0x15')][_0x4921d2[_0x73cd('0xfa')]]&&_0x4921d2[_0x73cd('0xfa')]!==_0x4921d2[_0x73cd('0x14b')]){this[_0x73cd('0x9d')](_0x4921d2,_0x4921d2[_0x73cd('0xfa')],_0x4921d2[_0x73cd('0xf1')]);}};Preview[_0x73cd('0xf')][_0x73cd('0x1d')]=function(_0x87b201){if(this[_0x73cd('0x15')][_0x87b201[_0x73cd('0xb1')]]&&_0x87b201[_0x73cd('0xb1')]!==_0x87b201['uniqueid']&&!this[_0x73cd('0x15')][_0x87b201['linkedid']][_0x73cd('0x75')]){if(_0x87b201[_0x73cd('0x144')]==='1'){this[_0x73cd('0x9d')](_0x87b201,_0x87b201['linkedid'],_0x87b201[_0x73cd('0x144')]);}}};Preview[_0x73cd('0xf')][_0x73cd('0x14c')]=function(_0x5cae4c,_0x523663,_0x16e389){if(this[_0x73cd('0x15')][_0x5cae4c]){if(_[_0x73cd('0x80')](this[_0x73cd('0x15')][_0x5cae4c][_0x73cd('0x139')])){this[_0x73cd('0x15')][_0x5cae4c][_0x73cd('0x139')]={};}this[_0x73cd('0x15')][_0x5cae4c]['variables'][_0x523663]=_0x16e389;}};Preview[_0x73cd('0xf')][_0x73cd('0x22')]=function(_0x1af2b6){try{if(!_[_0x73cd('0x80')](_0x1af2b6)){if(ut[_0x73cd('0x14d')](_[_0x73cd('0x14e')](_0x1af2b6['variable'])[0x0])){this[_0x73cd('0x14c')](_0x1af2b6[_0x73cd('0xb8')],_[_0x73cd('0x14e')](_0x1af2b6['variable'])[0x0],_0x1af2b6[_0x73cd('0x14f')]);}}}catch(_0x4faeca){logger[_0x73cd('0x150')](_0x73cd('0x151'),util[_0x73cd('0x152')](_0x4faeca,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x147e7b){if(_0x147e7b){if(this['actions'][_0x147e7b['transfertargetlinkedid']]){this['actions'][_0x147e7b[_0x73cd('0x153')]]['transfer']=!![];}}};Preview[_0x73cd('0xf')][_0x73cd('0x25')]=function(_0xccabb0){if(_0xccabb0){if(this[_0x73cd('0x15')][_0xccabb0[_0x73cd('0x154')]]){this[_0x73cd('0x15')][_0xccabb0['transfererlinkedid']][_0x73cd('0x149')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x1d0b=['originateresponse','bind','hangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','name','stringify','md5','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','DEACTIVATED','logger','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','recallMe','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','logger2','catch','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','incrementPreviewCounters','idContact','swapAdditionalPhones','ANSWER','responsetime','uniqueid','custom:agentconnect','buildObj','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','\x20Queue','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','run','execRun','unlock','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','trim','dialCutDigit','SIP/%s/%s%s','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','OriginateError','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','callProgressDetectingCustomer','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','preview','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','redis','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels'];(function(_0x22562e,_0x3cab96){var _0x495af0=function(_0x141b65){while(--_0x141b65){_0x22562e['push'](_0x22562e['shift']());}};_0x495af0(++_0x3cab96);}(_0x1d0b,0x14a));var _0xb1d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d0b[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb1d0('0x0'));var _=require(_0xb1d0('0x1'));var uuid=require(_0xb1d0('0x2'));var moment=require(_0xb1d0('0x3'));var md5=require('md5');var Redis=require(_0xb1d0('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb1d0('0x5'));var loggerAction=require(_0xb1d0('0x6'))('actionPreview');var ami=require(_0xb1d0('0x7'));var rpcDb=require(_0xb1d0('0x8'));var cmHopperAdditionalPhone=require(_0xb1d0('0x9'));var Action=require('./action');var ut=require('./util/util');config[_0xb1d0('0xa')]=_['defaults'](config[_0xb1d0('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb1d0('0xa')]));var Sequence=function(){};Sequence[_0xb1d0('0xb')][_0xb1d0('0xc')]=function(_0x124b6a){this[_0xb1d0('0xd')]=this[_0xb1d0('0xd')]?this[_0xb1d0('0xd')][_0xb1d0('0xe')](_0x124b6a):_0x124b6a();};function Preview(_0x3d07c5){this[_0xb1d0('0xf')]=new Sequence();this[_0xb1d0('0x10')]=_0x3d07c5[_0xb1d0('0x11')];this[_0xb1d0('0x12')]=_0x3d07c5['trunks'];this[_0xb1d0('0x13')]={};this[_0xb1d0('0x14')]=_0x3d07c5[_0xb1d0('0x14')];this[_0xb1d0('0x15')]=0x0;ami['on'](_0xb1d0('0x16'),this['syncOriginateResponse'][_0xb1d0('0x17')](this));ami['on'](_0xb1d0('0x18'),this['syncHangup'][_0xb1d0('0x17')](this));ami['on'](_0xb1d0('0x19'),this['syncHangupRequest'][_0xb1d0('0x17')](this));ami['on'](_0xb1d0('0x1a'),this[_0xb1d0('0x1b')][_0xb1d0('0x17')](this));ami['on'](_0xb1d0('0x1c'),this[_0xb1d0('0x1d')][_0xb1d0('0x17')](this));ami['on'](_0xb1d0('0x1e'),this[_0xb1d0('0x1f')]['bind'](this));ami['on'](_0xb1d0('0x20'),this[_0xb1d0('0x21')]['bind'](this));ami['on'](_0xb1d0('0x22'),this[_0xb1d0('0x23')][_0xb1d0('0x17')](this));this[_0xb1d0('0x24')](this[_0xb1d0('0x10')]);}function emit(_0x3ddddf,_0xb7ff93,_0x28a517){io['to'](_0x3ddddf)['emit'](_0xb7ff93,_0x28a517);}function emitCampaignPreview(_0x1aa1bd){if(_0x1aa1bd[_0xb1d0('0x25')]===_0xb1d0('0x26')){var _0x18d746={'id':_0x1aa1bd['id'],'name':_0x1aa1bd['name'],'strategy':_0x1aa1bd['strategy'],'answered':_0x1aa1bd[_0xb1d0('0x27')],'available':_0x1aa1bd[_0xb1d0('0x28')],'loggedIn':_0x1aa1bd[_0xb1d0('0x29')],'pTalking':_0x1aa1bd[_0xb1d0('0x2a')],'sumBillable':_0x1aa1bd[_0xb1d0('0x2b')],'sumDuration':_0x1aa1bd[_0xb1d0('0x2c')],'sumHoldTime':_0x1aa1bd[_0xb1d0('0x2d')]||0x0,'talking':_0x1aa1bd[_0xb1d0('0x2e')],'total':_0x1aa1bd['total'],'type':_0x1aa1bd['type'],'unmanaged':_0x1aa1bd[_0xb1d0('0x2f')],'abandoned':_0x1aa1bd[_0xb1d0('0x30')],'waiting':_0x1aa1bd['waiting'],'loggedInDb':_0x1aa1bd[_0xb1d0('0x31')],'dialActive':_0x1aa1bd[_0xb1d0('0x32')],'dialMethod':_0x1aa1bd[_0xb1d0('0x33')],'dialOriginateCallerIdName':_0x1aa1bd[_0xb1d0('0x34')],'dialOriginateCallerIdNumber':_0x1aa1bd['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x1aa1bd[_0xb1d0('0x35')],'dialPrefix':_0x1aa1bd[_0xb1d0('0x36')],'outboundAnswerAgiCallsDay':_0x1aa1bd[_0xb1d0('0x37')],'outboundAnswerCallsDay':_0x1aa1bd[_0xb1d0('0x38')],'outboundBlacklistCallsDay':_0x1aa1bd[_0xb1d0('0x39')],'outboundBusyCallsDay':_0x1aa1bd['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1aa1bd[_0xb1d0('0x3a')],'outboundDropCallsDayACS':_0x1aa1bd[_0xb1d0('0x3b')],'outboundDropCallsDayCallersExit':_0x1aa1bd[_0xb1d0('0x3c')],'outboundDropCallsDayTimeout':_0x1aa1bd['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x1aa1bd[_0xb1d0('0x3d')],'outboundNoSuchCallsDay':_0x1aa1bd['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1aa1bd[_0xb1d0('0x3e')],'outboundReCallsDay':_0x1aa1bd[_0xb1d0('0x3f')],'outboundRejectCallsDay':_0x1aa1bd[_0xb1d0('0x40')],'outboundUnknownCallsDay':_0x1aa1bd[_0xb1d0('0x41')],'outboundAbandonedCallsDay':_0x1aa1bd['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x1aa1bd['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1aa1bd['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x1aa1bd[_0xb1d0('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x1aa1bd[_0xb1d0('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x1aa1bd[_0xb1d0('0x44')],'predictiveIntervalErlangCalls':_0x1aa1bd[_0xb1d0('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x1aa1bd[_0xb1d0('0x46')],'predictiveIntervalHitRate':_0x1aa1bd['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x1aa1bd[_0xb1d0('0x47')],'predictiveIntervalPauses':_0x1aa1bd['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x1aa1bd[_0xb1d0('0x48')],'predictiveIntervalTotalCalls':_0x1aa1bd[_0xb1d0('0x49')],'message':_0x1aa1bd[_0xb1d0('0x4a')],'originated':_0x1aa1bd[_0xb1d0('0x4b')],'erlangCalls':_0x1aa1bd['erlangCalls'],'erlangCallToSecond':_0x1aa1bd[_0xb1d0('0x4c')],'erlangAbandonmentRate':_0x1aa1bd[_0xb1d0('0x4d')],'erlangBusyFactor':_0x1aa1bd[_0xb1d0('0x4e')],'startPredictive':_0x1aa1bd[_0xb1d0('0x4f')],'startProgressive':_0x1aa1bd[_0xb1d0('0x50')]};if(_0x1aa1bd[_0xb1d0('0x51')]){_0x18d746[_0xb1d0('0x51')]={'id':_0x1aa1bd['Trunk']['id'],'name':_0x1aa1bd[_0xb1d0('0x51')]['name'],'active':_0x1aa1bd[_0xb1d0('0x51')][_0xb1d0('0x52')],'callerid':_0x1aa1bd[_0xb1d0('0x51')][_0xb1d0('0x53')]};}if(_0x1aa1bd[_0xb1d0('0x54')]){_0x18d746[_0xb1d0('0x54')]={'id':_0x1aa1bd[_0xb1d0('0x54')]['id'],'name':_0x1aa1bd[_0xb1d0('0x54')][_0xb1d0('0x55')]};}var _0x5f33f9=md5(JSON[_0xb1d0('0x56')](_0x18d746));if(_0x1aa1bd[_0xb1d0('0x57')]!==_0x5f33f9){_0x1aa1bd[_0xb1d0('0x57')]=_0x5f33f9;emit(util['format'](_0xb1d0('0x58'),_0x18d746[_0xb1d0('0x55')]),_0xb1d0('0x59'),_0x18d746);}}}function emitVoiceQueueChannelRemove(_0x3956a0){logger[_0xb1d0('0x5a')](_0xb1d0('0x5b'),JSON[_0xb1d0('0x56')](_0x3956a0));emit(util[_0xb1d0('0x5c')](_0xb1d0('0x58'),_0x3956a0[_0xb1d0('0x55')]),_0xb1d0('0x5d'),_0x3956a0);io[_0xb1d0('0x5e')](_0xb1d0('0x5f'),_0x3956a0);}function notSendMessagesQueue(_0x2527c2){if(_0x2527c2['sendMessageOneNotActive']){if(_0x2527c2[_0xb1d0('0x4b')]===0x0&&_0x2527c2['pTalking']===0x0){_0x2527c2[_0xb1d0('0x60')]=![];_0x2527c2[_0xb1d0('0x28')]=0x0;_0x2527c2[_0xb1d0('0x61')]=0x0;_0x2527c2[_0xb1d0('0x4a')]='NOT_ACTIVE';ut['logger'](_0xb1d0('0x62'),_0x2527c2[_0xb1d0('0x55')]+'\x20is\x20not\x20active');}else{_0x2527c2[_0xb1d0('0x4a')]=_0xb1d0('0x63');ut[_0xb1d0('0x64')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2527c2[_0xb1d0('0x55')]+_0xb1d0('0x65'));}emitCampaignPreview(_0x2527c2);}}Preview[_0xb1d0('0xb')][_0xb1d0('0x24')]=function(){var _0x5ed6ac=this;setInterval(function(){_0x5ed6ac[_0xb1d0('0x66')]();},0x7cf);};Preview[_0xb1d0('0xb')][_0xb1d0('0x66')]=function(){var _0xa9efb1=this['campaignsPreview'];this[_0xb1d0('0x15')]+=0x1;for(var _0x24d784 in _0xa9efb1){if(_0xa9efb1[_0xb1d0('0x67')](_0x24d784)&&(_0xa9efb1[_0x24d784][_0xb1d0('0x33')]==='preview'||_0xa9efb1[_0x24d784][_0xb1d0('0x33')]===_0xb1d0('0x68'))&&_0xa9efb1[_0x24d784][_0xb1d0('0x25')]===_0xb1d0('0x26')){if(this[_0xb1d0('0x15')]>0x7){this[_0xb1d0('0x15')]=0x0;this[_0xb1d0('0x69')]();}}if(_0xa9efb1['hasOwnProperty'](_0x24d784)&&_0xa9efb1[_0x24d784][_0xb1d0('0x33')]===_0xb1d0('0x5')&&_0xa9efb1[_0x24d784][_0xb1d0('0x25')]==='outbound'){if(_0xa9efb1[_0x24d784][_0xb1d0('0x32')]){this[_0xb1d0('0x6a')](_0xa9efb1[_0x24d784]);if(_0xa9efb1[_0x24d784][_0xb1d0('0x6b')])this['recallMe'](_0xa9efb1[_0x24d784]);}else{notSendMessagesQueue(_0xa9efb1[_0x24d784]);}}}};Preview[_0xb1d0('0xb')][_0xb1d0('0x6c')]=function(_0x439726){var _0x375f64=this;this[_0xb1d0('0xf')]['enqueue'](function(){if(!_[_0xb1d0('0x6d')](_0x375f64[_0xb1d0('0x13')][_0x439726])){loggerAction[_0xb1d0('0x5a')](_0xb1d0('0x6e'),_0x439726,'Queue',_0x375f64[_0xb1d0('0x13')][_0x439726]['queue'],'originated:\x20',JSON[_0xb1d0('0x56')](_0x375f64['campaignsPreview'][_0x375f64[_0xb1d0('0x13')][_0x439726][_0xb1d0('0x6f')]]['originated']),_0xb1d0('0x70'),JSON['stringify'](_0x375f64[_0xb1d0('0x10')][_0x375f64[_0xb1d0('0x13')][_0x439726][_0xb1d0('0x6f')]]['pTalking']),JSON['stringify'](_0x375f64[_0xb1d0('0x13')][_0x439726][_0xb1d0('0x71')]),JSON[_0xb1d0('0x56')](_[_0xb1d0('0x72')](_0x375f64[_0xb1d0('0x13')][_0x439726],[_0xb1d0('0x73'),_0xb1d0('0x74'),_0xb1d0('0x75'),_0xb1d0('0x76')])));return ami[_0xb1d0('0x77')]({'action':_0xb1d0('0x78'),'channel':_0x375f64['actions'][_0x439726][_0xb1d0('0x79')]})['catch'](function(_0x466467){if(_0x466467[_0xb1d0('0x4a')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x375f64[_0xb1d0('0x13')][_0x439726]){ut[_0xb1d0('0x7a')](_0x375f64[_0xb1d0('0x10')][_0x375f64[_0xb1d0('0x13')][_0x439726][_0xb1d0('0x6f')]],_0xb1d0('0x7b'));if(_0x375f64['actions'][_0x439726]['dialAnswer']===!![]){ut[_0xb1d0('0x7c')](_0x375f64[_0xb1d0('0x10')][_0x375f64['actions'][_0x439726]['queue']],'[clearZombieChannel]');ut[_0xb1d0('0x7d')](_0xb1d0('0x7e')+_0x439726,_0x375f64[_0xb1d0('0x13')][_0x439726][_0xb1d0('0x6f')]);}ut[_0xb1d0('0x7d')](_0xb1d0('0x7f')+_0x439726,_0x375f64['actions'][_0x439726][_0xb1d0('0x6f')]);delete _0x375f64[_0xb1d0('0x13')][_0x439726];}},0x2328);}});}});};Preview[_0xb1d0('0xb')][_0xb1d0('0x69')]=function(){var _0x44231c=this;loggerAction['info'](_0xb1d0('0x80'),_[_0xb1d0('0x81')](this['actions']));for(var _0x1da4f0 in this[_0xb1d0('0x13')]){if(_0x44231c[_0xb1d0('0x13')][_0xb1d0('0x67')](_0x1da4f0)){_0x44231c[_0xb1d0('0x6c')](_0x1da4f0);}}};Preview[_0xb1d0('0xb')][_0xb1d0('0x82')]=function(_0x58dfcc){var _0x1869b8=this;rpcDb[_0xb1d0('0x83')](_0x58dfcc['id'],ut[_0xb1d0('0x84')](this[_0xb1d0('0x14')]))[_0xb1d0('0x85')](function(_0x30a0b7){if(!_[_0xb1d0('0x6d')](_0x30a0b7)){for(var _0x1ed7b1=0x0;_0x1ed7b1<_0x30a0b7[_0xb1d0('0x86')];_0x1ed7b1+=0x1){if(ut[_0xb1d0('0x87')](_0x30a0b7[_0x1ed7b1][_0xb1d0('0x88')])<_0x58dfcc[_0xb1d0('0x89')]*0x3c){if(_0x30a0b7[_0x1ed7b1][_0xb1d0('0x8a')]&&!_0x30a0b7[_0x1ed7b1][_0xb1d0('0x8a')]['voicePause']){_0x1869b8['run'](_0x30a0b7[_0x1ed7b1]['id'])['then'](ut[_0xb1d0('0x8b')]('[RecallMe]'))[_0xb1d0('0x8c')](ut['logger2'](_0xb1d0('0x8d')));}else{rpcDb['disableContact'](_0x30a0b7[_0x1ed7b1]['id']);}}else{var _0x109231=new Action(_0x30a0b7[_0x1ed7b1],_0x58dfcc);_0x109231[_0xb1d0('0x8e')]=moment()[_0xb1d0('0x5c')](_0xb1d0('0x8f'));_0x58dfcc[_0xb1d0('0x3f')]+=0x1;ut['logCustomer'](_0x109231,0x17,'RecallInQueue');if(_0x58dfcc[_0xb1d0('0x90')]){rpcDb[_0xb1d0('0x91')](ut['createBody'](_0x30a0b7[_0x1ed7b1]));rpcDb[_0xb1d0('0x92')](_0x109231,_0xb1d0('0x93'));}else{ut[_0xb1d0('0x94')](_0x109231,0x16,_0xb1d0('0x95'));rpcDb[_0xb1d0('0x92')](_0x109231,'[HistoryRecallClose]');rpcDb[_0xb1d0('0x96')](_0x109231,_0xb1d0('0x97'));}}}}})['catch'](ut[_0xb1d0('0x8b')](_0xb1d0('0x98')));};Preview[_0xb1d0('0xb')]['setMessage']=function(_0x9e26e9){_0x9e26e9[_0xb1d0('0x60')]=!![];if(ut[_0xb1d0('0x99')](_0x9e26e9['loggedIn'])){_0x9e26e9['message']=_0xb1d0('0x9a');}else if(!ut['isActive'](_0x9e26e9[_0xb1d0('0x32')])){_0x9e26e9['message']=_0xb1d0('0x9b');}else if(!this[_0xb1d0('0x9c')](_0x9e26e9[_0xb1d0('0x51')])){if(!this[_0xb1d0('0x9c')](_0x9e26e9[_0xb1d0('0x9d')])){_0x9e26e9[_0xb1d0('0x4a')]='TRUNK_IS_NOT_REACHABLE';}else{_0x9e26e9['message']='ACTIVE';}}else{_0x9e26e9['message']=_0xb1d0('0x9e');}emitCampaignPreview(_0x9e26e9);};Preview[_0xb1d0('0xb')]['callProgressDetectingCustomer']=function(_0x48535d,_0x104188,_0x2a1581){var _0x2ff18c=this;var _0x2bb87b=this['actions'][_0x104188];var _0x2a0cc2=this[_0xb1d0('0x10')][_0x2bb87b[_0xb1d0('0x6f')]];var _0x5d9f47;var _0xa5b7de=![];var _0x9fa599=0x2;var _0x1d4028=0x3;if(_0x2a0cc2){switch(_0x2a1581){case'1':_0x2a0cc2[_0xb1d0('0x9f')]+=0x1;_0x2bb87b[_0xb1d0('0xa0')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x0,_0xb1d0('0xa3'));ami[_0xb1d0('0x5e')]('custom:agentnosuchnumber',ut['buildObj'](_0x2bb87b,_0xb1d0('0xa4')));rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xa5'));_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'0',_0x2a0cc2)[_0xb1d0('0x85')](function(_0x8734a1){_0xa5b7de=_0x8734a1['additional']==0x1;_0x9fa599=_0x2a0cc2['dialNoSuchNumberRetryFrequency'];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut['cloneAction'](_0x2bb87b,0xf,'Global');rpcDb['createCustomerFinal'](_0x5d9f47,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2bb87b[_0xb1d0('0xa0')]>=_0x2a0cc2[_0xb1d0('0xa9')]){rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xaa'));}else{rpcDb[_0xb1d0('0xab')](ut[_0xb1d0('0xac')](_0x2bb87b,_0xb1d0('0xa0'),_0x2a0cc2[_0xb1d0('0xad')]),_0x2bb87b[_0xb1d0('0xae')],_0x2bb87b[_0xb1d0('0xaf')]);}}delete this[_0xb1d0('0x13')][_0x48535d['linkedid']];}else{_0x2bb87b['countnosuchnumberretry']++;logger['info']('actioncountonusuch',_0x2bb87b[_0xb1d0('0xa0')]);logger[_0xb1d0('0x5a')]('id',_0x2bb87b['idContact']);_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countnosuchnumberretry':_0x2bb87b[_0xb1d0('0xa0')]}})['then'](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)['then'](function(){});});}});break;case _0xb1d0('0xb3'):var _0x4cc8c1=moment()[_0xb1d0('0x5c')](_0xb1d0('0x8f'));_0x2bb87b[_0xb1d0('0xb4')]=_0x4cc8c1;_0x2bb87b['answertime']=_0x4cc8c1;_0x2bb87b[_0xb1d0('0x71')]=!![];_0x2a0cc2[_0xb1d0('0x2a')]+=0x1;logger[_0xb1d0('0x5a')]('[syncHangup][talking][increment]',_0x2bb87b[_0xb1d0('0xb5')],'\x20Queue',_0x2a0cc2[_0xb1d0('0x55')],_0xb1d0('0x70'),_0x2a0cc2[_0xb1d0('0x2a')]);ami[_0xb1d0('0x5e')](_0xb1d0('0xb6'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xb8'),this[_0xb1d0('0x10')][_0x2bb87b['queue']]));if(_0x2a0cc2['acw']){ami[_0xb1d0('0x5e')](_0xb1d0('0xb9'),ut[_0xb1d0('0xba')](_0x2bb87b));}break;case'16':ami[_0xb1d0('0x5e')](_0xb1d0('0xbb'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xbc'),this[_0xb1d0('0x10')][_0x2bb87b[_0xb1d0('0x6f')]]));emitVoiceQueueChannelRemove(ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xbc')));_0x2a0cc2['outboundAnswerCallsDay']+=0x1;_0x2a0cc2['total']+=0x1;_0x2a0cc2[_0xb1d0('0x27')]+=0x1;ut[_0xb1d0('0x7c')](_0x2a0cc2,_0xb1d0('0xbd'));_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x4,_0xb1d0('0xbe'));rpcDb['createCustomerHistory'](_0x2bb87b,_0xb1d0('0xbf'));rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xc0'));rpcDb[_0xb1d0('0xc1')](_0x2bb87b);_0x2a0cc2[_0xb1d0('0x2c')]+=_0x2bb87b[_0xb1d0('0xc2')];_0x2a0cc2[_0xb1d0('0x2b')]+=_0x2bb87b[_0xb1d0('0xc2')];logger[_0xb1d0('0x5a')](_0xb1d0('0xc3'),_0x2bb87b[_0xb1d0('0xb5')],_0xb1d0('0xc4'),_0x2a0cc2[_0xb1d0('0x55')],_0xb1d0('0x70'),_0x2a0cc2[_0xb1d0('0x2a')]);delete this[_0xb1d0('0x13')][_0x48535d[_0xb1d0('0xc5')]];break;case _0xb1d0('0xc6'):_0x2a0cc2[_0xb1d0('0xc7')]+=0x1;_0x2bb87b[_0xb1d0('0xc8')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x5,'Busy');_0x9fa599=_0x2a0cc2[_0xb1d0('0xc9')];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];ami[_0xb1d0('0x5e')](_0xb1d0('0xca'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xcb')));rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xcc'));_0x2ff18c['verifyAdditionalPhones'](_0x2bb87b,'5',_0x2a0cc2)['then'](function(_0x25323c){_0xa5b7de=_0x25323c[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb['createCustomerFinal'](_0x5d9f47,_0xb1d0('0xd0'));}else{if(_0x2bb87b['countbusyretry']>=_0x2a0cc2[_0xb1d0('0xd1')]){rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xcc'));}else{rpcDb[_0xb1d0('0xab')](ut[_0xb1d0('0xac')](_0x2bb87b,_0xb1d0('0xc8'),_0x2a0cc2['dialBusyRetryFrequency']),_0x2bb87b[_0xb1d0('0xae')],_0x2bb87b[_0xb1d0('0xaf')]);}}}else{_0x2bb87b[_0xb1d0('0xc8')]++;_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countbusyretry':_0x2bb87b[_0xb1d0('0xc8')]}})['then'](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)[_0xb1d0('0x85')](function(){});});}});break;case'NOANSWER':_0x2a0cc2['outboundNoAnswerCallsDay']+=0x1;_0x2bb87b[_0xb1d0('0xd2')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x3,_0xb1d0('0xd3'));_0x9fa599=_0x2a0cc2[_0xb1d0('0xd4')];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];var _0x31e273=ut['buildNoAnswerEventPayload'](_0x2bb87b,_0x2a0cc2);ami[_0xb1d0('0x5e')]('custom:agentnoanswer',_0x31e273);rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xd5'));_0x2ff18c['verifyAdditionalPhones'](_0x2bb87b,'3',_0x2a0cc2)[_0xb1d0('0x85')](function(_0x42bba3){_0xa5b7de=_0x42bba3[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb[_0xb1d0('0x96')](_0x5d9f47,_0xb1d0('0xd6'));}else{if(_0x2bb87b['countnoanswerretry']>=_0x2a0cc2['dialNoAnswerMaxRetry']){rpcDb[_0xb1d0('0x96')](_0x2bb87b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xb1d0('0xab')](ut[_0xb1d0('0xac')](_0x2bb87b,_0xb1d0('0xd2'),_0x2a0cc2[_0xb1d0('0xd4')]),_0x2bb87b[_0xb1d0('0xae')],_0x2bb87b[_0xb1d0('0xaf')]);}}}else{_0x2bb87b[_0xb1d0('0xd2')]++;_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countnoanswerretry':_0x2bb87b[_0xb1d0('0xd2')]}})['then'](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)['then'](function(){});});}});break;case _0xb1d0('0xd7'):_0x2a0cc2[_0xb1d0('0x3a')]+=0x1;_0x2bb87b[_0xb1d0('0xd8')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x8,_0xb1d0('0xd9'));_0x9fa599=_0x2a0cc2['dialCongestionRetryFrequency'];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];ami[_0xb1d0('0x5e')](_0xb1d0('0xda'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xdb')));rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xdc'));_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'8',_0x2a0cc2)['then'](function(_0x5679f1){_0xa5b7de=_0x5679f1[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut['cloneAction'](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb['createCustomerFinal'](_0x5d9f47,_0xb1d0('0xdd'));}else{if(_0x2bb87b[_0xb1d0('0xd8')]>=_0x2a0cc2[_0xb1d0('0xde')]){rpcDb['createCustomerFinal'](_0x2bb87b,_0xb1d0('0xdc'));}else{rpcDb[_0xb1d0('0xab')](ut[_0xb1d0('0xac')](_0x2bb87b,_0xb1d0('0xd8'),_0x2a0cc2[_0xb1d0('0xc9')]),_0x2bb87b['unlockAgent'],_0x2bb87b[_0xb1d0('0xaf')]);}}}else{_0x2bb87b['countcongestionretry']++;_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countcongestionretry':_0x2bb87b['countcongestionretry']}})[_0xb1d0('0x85')](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)[_0xb1d0('0x85')](function(){});});}});break;case'CANCEL':_0x2a0cc2['outboundRejectCallsDay']+=0x1;_0x2bb87b['countagentrejectretry']+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x14,_0xb1d0('0xdf'));_0x9fa599=_0x2a0cc2[_0xb1d0('0xe0')];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];ami['emit'](_0xb1d0('0xe1'),ut['buildObj'](_0x2bb87b,_0xb1d0('0xe2')));rpcDb['createCustomerHistory'](_0x2bb87b,_0xb1d0('0xe3'));_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'20',_0x2a0cc2)[_0xb1d0('0x85')](function(_0x8429b0){_0xa5b7de=_0x8429b0[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut['totalGlobal'](_0x2bb87b)>=_0x2a0cc2['dialGlobalMaxRetry']){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0x14,'AgentReject');rpcDb[_0xb1d0('0x96')](_0x5d9f47,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2bb87b[_0xb1d0('0xe4')]>=_0x2a0cc2[_0xb1d0('0xe5')]){rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xe6'));}else{rpcDb[_0xb1d0('0xab')](ut[_0xb1d0('0xac')](_0x2bb87b,_0xb1d0('0xe4'),_0x2a0cc2[_0xb1d0('0xe0')]),_0x2bb87b[_0xb1d0('0xae')],_0x2bb87b[_0xb1d0('0xaf')]);}}}else{_0x2bb87b[_0xb1d0('0xd2')]++;_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countnoanswerretry':_0x2bb87b[_0xb1d0('0xd2')]}})[_0xb1d0('0x85')](function(){_0x2ff18c['swapAdditionalPhones'](_0x2bb87b,_0x9fa599,_0x1d4028)['then'](function(){});});}});break;case'ABANDONED':_0x2a0cc2[_0xb1d0('0xe7')]+=0x1;_0x2bb87b[_0xb1d0('0xe8')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0xb,'Abandoned');rpcDb[_0xb1d0('0x92')](_0x2bb87b,'[callProgressDetectingCustomer][logAbandoned]');_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'11',_0x2a0cc2)[_0xb1d0('0x85')](function(_0x65c9a0){_0xa5b7de=_0x65c9a0[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2['dialGlobalMaxRetry']){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb[_0xb1d0('0x96')](_0x5d9f47,_0xb1d0('0xe9'));}else{if(_0x2bb87b[_0xb1d0('0xea')]>=_0x2a0cc2[_0xb1d0('0xeb')]){rpcDb['createCustomerFinal'](_0x2bb87b,_0xb1d0('0xe9'));}else{rpcDb[_0xb1d0('0xab')](ut['scheduledAt'](_0x2bb87b,'countabandonedretry',_0x2a0cc2['dialAbandonedRetryFrequency']),_0x2bb87b[_0xb1d0('0xae')],_0x2bb87b[_0xb1d0('0xaf')]);}}}else{_0x2bb87b[_0xb1d0('0xd2')]++;_0x2ff18c[_0xb1d0('0xb0')]({'id':_0x2bb87b['idContact'],'field':{'countnoanswerretry':_0x2bb87b[_0xb1d0('0xd2')]}})[_0xb1d0('0x85')](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)[_0xb1d0('0x85')](function(){});});}});break;case'18':_0x2a0cc2[_0xb1d0('0x41')]+=0x1;_0x2bb87b[_0xb1d0('0xec')]+=0x1;_0x2bb87b['countglobal']=ut['totalGlobal'](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x12,_0x48535d['cause-txt']||_0x48535d[_0xb1d0('0xed')]);ami['emit'](_0xb1d0('0xee'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xef')));rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xf0'));_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'18',_0x2a0cc2)['then'](function(_0x961f77){_0xa5b7de=_0x961f77[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut[_0xb1d0('0xa2')](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0x12,_0xb1d0('0xcf'));rpcDb[_0xb1d0('0x96')](_0x5d9f47,_0xb1d0('0xf0'));}else{rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xf0'));}}else{_0x2bb87b['countnoanswerretry']++;_0x2ff18c['incrementPreviewCounters']({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countnoanswerretry':_0x2bb87b[_0xb1d0('0xd2')]}})[_0xb1d0('0x85')](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)['then'](function(){});});}});delete this['actions'][_0x48535d[_0xb1d0('0xc5')]];break;case'19':_0x2a0cc2[_0xb1d0('0x41')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0x13,_0x48535d[_0xb1d0('0xf1')]||_0x48535d['dialstatus']);ami[_0xb1d0('0x5e')](_0xb1d0('0xee'),ut[_0xb1d0('0xb7')](_0x2bb87b,_0xb1d0('0xef')));rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xf2'));_0x2ff18c[_0xb1d0('0xa6')](_0x2bb87b,'18',_0x2a0cc2)[_0xb1d0('0x85')](function(_0x3263c5){_0xa5b7de=_0x3263c5[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut['totalGlobal'](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb['createCustomerFinal'](_0x5d9f47,_0xb1d0('0xf2'));}else{rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xf2'));}}else{_0x2bb87b[_0xb1d0('0xd2')]++;_0x2ff18c['incrementPreviewCounters']({'id':_0x2bb87b[_0xb1d0('0xb1')],'field':{'countnoanswerretry':_0x2bb87b[_0xb1d0('0xd2')]}})[_0xb1d0('0x85')](function(){_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)[_0xb1d0('0x85')](function(){});});}});delete this[_0xb1d0('0x13')][_0x48535d[_0xb1d0('0xc5')]];break;default:if(_0x2bb87b[_0xb1d0('0x71')]){ut[_0xb1d0('0x7c')](_0x2a0cc2,_0xb1d0('0xf3'));ut[_0xb1d0('0x7d')](_0xb1d0('0xf4')+_0x2a0cc2['name'],_0x48535d);}_0x2a0cc2[_0xb1d0('0x41')]+=0x1;_0x2bb87b[_0xb1d0('0xa1')]=ut[_0xb1d0('0xa2')](_0x2bb87b);ut[_0xb1d0('0x94')](_0x2bb87b,0xc,_0x48535d['cause-txt']||_0x48535d[_0xb1d0('0xed')]);_0x9fa599=_0x2a0cc2[_0xb1d0('0xe0')];_0x1d4028=_0x2a0cc2[_0xb1d0('0xa7')];rpcDb[_0xb1d0('0x92')](_0x2bb87b,_0xb1d0('0xf5'));_0x2ff18c['verifyAdditionalPhones'](_0x2bb87b,'20',_0x2a0cc2)['then'](function(_0x579e39){_0xa5b7de=_0x579e39[_0xb1d0('0xcd')]==0x1;if(!_0xa5b7de){if(ut['totalGlobal'](_0x2bb87b)>=_0x2a0cc2[_0xb1d0('0xa8')]){_0x5d9f47=ut[_0xb1d0('0xce')](_0x2bb87b,0xf,_0xb1d0('0xcf'));rpcDb['createCustomerFinal'](_0x5d9f47,_0xb1d0('0xf6'));}else{rpcDb[_0xb1d0('0x96')](_0x2bb87b,_0xb1d0('0xf6'));}delete this[_0xb1d0('0x13')][_0x48535d[_0xb1d0('0xc5')]];}else{_0x2ff18c[_0xb1d0('0xb2')](_0x2bb87b,_0x9fa599,_0x1d4028)[_0xb1d0('0x85')](function(){});}});}if(!(_0x2bb87b[_0xb1d0('0x71')]&&_0x2a1581==='16')){ut[_0xb1d0('0x7a')](_0x2a0cc2,_0xb1d0('0xf7'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x2bb87b['uniqueid'],_0xb1d0('0xc4'),_0x2a0cc2[_0xb1d0('0x55')],_0xb1d0('0xf8'),_0x2a0cc2[_0xb1d0('0x4b')]);}if(_0x2a1581!==_0xb1d0('0xb3')){delete this['actions'][_0x48535d[_0xb1d0('0xc5')]];delete this['actions'][_0x48535d['destlinkedid']];}}};Preview[_0xb1d0('0xb')][_0xb1d0('0xf9')]=function(_0x1bee70,_0x30c143,_0x31f55e){if(_[_0xb1d0('0xfa')](_0x30c143)&&_0xb1d0('0xfb')!==typeof _0x30c143){return;}if(_[_0xb1d0('0xfa')](_0x31f55e)&&_0xb1d0('0xfb')!==typeof _0x31f55e){return;}switch(_0x31f55e[_0xb1d0('0xfc')]){case'0':ut[_0xb1d0('0xfd')](_0x1bee70,0x0,_0xb1d0('0xa3'));rpcDb[_0xb1d0('0xfe')](_0x1bee70,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0x1bee70,0x3,'NoAnswer');rpcDb[_0xb1d0('0xfe')](_0x1bee70,_0xb1d0('0xff'));break;case'5':ut['logAgent'](_0x1bee70,0x5,'Busy');rpcDb['createAgentHistory'](_0x1bee70,_0xb1d0('0x100'));break;case'8':ut[_0xb1d0('0xfd')](_0x1bee70,0x8,_0xb1d0('0xd9'));rpcDb[_0xb1d0('0xfe')](_0x1bee70,_0xb1d0('0x101'));break;case'22':ut[_0xb1d0('0xfd')](_0x1bee70,0x16,'AnswerAGI');rpcDb[_0xb1d0('0xfe')](_0x1bee70,_0xb1d0('0x102'));break;default:ut[_0xb1d0('0xfd')](_0x1bee70,0xc,_0x31f55e[_0xb1d0('0xfc')]);rpcDb[_0xb1d0('0xfe')](_0x1bee70,_0xb1d0('0x101'));}ut[_0xb1d0('0x7a')](_0x30c143,_0xb1d0('0x103'));logger[_0xb1d0('0x5a')](_0xb1d0('0x104'),_0x1bee70[_0xb1d0('0xb5')],'\x20Queue',_0x30c143[_0xb1d0('0x55')],_0xb1d0('0xf8'),_0x30c143[_0xb1d0('0x4b')]);delete this['actions'][_0x1bee70['uniqueid']];};Preview[_0xb1d0('0xb')][_0xb1d0('0xa6')]=function(_0x5cb3b7,_0x7a1451,_0x19e6c2){return Promise[_0xb1d0('0x105')]()[_0xb1d0('0x85')](cmHopperAdditionalPhone[_0xb1d0('0xa6')](_0x5cb3b7,_0x7a1451,_0x19e6c2))[_0xb1d0('0x8c')](logger[_0xb1d0('0x5a')](_0xb1d0('0x106')));};Preview[_0xb1d0('0xb')][_0xb1d0('0xb2')]=function(_0xea8a39,_0x4af33a,_0xeed37b){return Promise['resolve']()['then'](cmHopperAdditionalPhone[_0xb1d0('0xb2')](_0xea8a39,_0x4af33a,_0xeed37b))[_0xb1d0('0x8c')](logger['info'](_0xb1d0('0x107')));};Preview[_0xb1d0('0xb')][_0xb1d0('0xb0')]=function(_0x11dfdb){return Promise[_0xb1d0('0x105')]()[_0xb1d0('0x85')](cmHopperAdditionalPhone[_0xb1d0('0xb0')](_0x11dfdb))[_0xb1d0('0x8c')](logger['info']('[incrementPreviewCounters]\x20'));};Preview[_0xb1d0('0xb')][_0xb1d0('0x108')]=function(_0x543670,_0xd671b0,_0x83ba02,_0x148d8f,_0x236fdb){var _0x26295=this;return new Promise(function(_0x228ca2,_0x171f1f){if(_[_0xb1d0('0x6d')](_0xd671b0)||_[_0xb1d0('0x6d')](_0xd671b0[_0xb1d0('0x109')])||_[_0xb1d0('0x6d')](_0xd671b0[_0xb1d0('0x10a')])||_[_0xb1d0('0x6d')](_0xd671b0[_0xb1d0('0x75')])){_0x171f1f(ut[_0xb1d0('0x4a')](_0xb1d0('0x10b'),_0x148d8f,_0x236fdb));return;}var _0x5000e2=uuid['v4']();var _0x34b77b=_0x26295[_0xb1d0('0x10')][_0xd671b0[_0xb1d0('0x10c')][_0xb1d0('0x55')]];var _0x4027c4=_0x83ba02?_0x26295['agents'][_0x83ba02]['id']:undefined;_0x26295[_0xb1d0('0x13')][_0x5000e2]=new Action(_0xd671b0,_0x34b77b,_0x5000e2,_0x83ba02,_0x4027c4);var _0x11f660=_0x26295[_0xb1d0('0x13')][_0x5000e2];_0x11f660[_0xb1d0('0xae')]=_0x148d8f;_0x11f660['activeContact']=_0x236fdb;_0x11f660[_0xb1d0('0x10d')]=_0x83ba02;if(_[_0xb1d0('0x10e')](_0x543670)){_0x26295[_0xb1d0('0x10f')](_0x11f660,_0x34b77b,_0xd671b0,_0x83ba02)[_0xb1d0('0x85')](function(_0x2d5665){logger['info'](_0xb1d0('0x110'),'Queue:\x20'+_0x11f660[_0xb1d0('0x6f')]+'\x20IdHopper:\x20'+_0x11f660[_0xb1d0('0xb1')],JSON[_0xb1d0('0x56')](_0x2d5665));ami[_0xb1d0('0x5e')]('custom:agentcalled',ut[_0xb1d0('0xb7')](_0x11f660,_0xb1d0('0x111'),_0x26295[_0xb1d0('0x10')][_0x11f660[_0xb1d0('0x6f')]]));_0x228ca2(ut[_0xb1d0('0x4a')](_0xb1d0('0x112')));})[_0xb1d0('0x8c')](function(_0x302269){ut[_0xb1d0('0x64')](_0xb1d0('0x113'),_0x302269);_0x171f1f(ut[_0xb1d0('0x4a')](_0xb1d0('0x114'),_0x148d8f,_0x236fdb));});}else{_0x34b77b[_0xb1d0('0x39')]+=0x1;ut[_0xb1d0('0x115')](_0x11f660);rpcDb['createHistory'](_0x11f660,_0xb1d0('0x116'));delete _0x26295[_0xb1d0('0x13')][_0x5000e2];_0x171f1f(ut[_0xb1d0('0x4a')](_0xb1d0('0x117'),_0x148d8f,_0x236fdb));}});};Preview[_0xb1d0('0xb')][_0xb1d0('0x9c')]=function(_0x3becf1){return!_[_0xb1d0('0x6d')](_0x3becf1)&&!_[_0xb1d0('0x6d')](_0x3becf1['name'])&&!_[_0xb1d0('0x6d')](_0x3becf1[_0xb1d0('0x52')])&&_0x3becf1['active']&&!_[_0xb1d0('0x6d')](this[_0xb1d0('0x12')][util['format']('SIP/%s',_0x3becf1[_0xb1d0('0x55')])])&&!_['isNil'](this[_0xb1d0('0x12')][util[_0xb1d0('0x5c')](_0xb1d0('0x118'),_0x3becf1[_0xb1d0('0x55')])]['status'])&&(this[_0xb1d0('0x12')][util[_0xb1d0('0x5c')](_0xb1d0('0x118'),_0x3becf1[_0xb1d0('0x55')])][_0xb1d0('0x78')]==='reachable'||this['trunks'][util[_0xb1d0('0x5c')](_0xb1d0('0x118'),_0x3becf1['name'])][_0xb1d0('0x78')]===_0xb1d0('0x119'));};Preview[_0xb1d0('0xb')][_0xb1d0('0x11a')]=function(_0x34cec5,_0x198d43){var _0x18725b=this;return new Promise(function(_0xb0c410,_0x487262){_0x18725b[_0xb1d0('0x11b')](_0x34cec5,_0x198d43)[_0xb1d0('0x85')](function(_0xa43dc5){_0xb0c410(_[_0xb1d0('0x72')](_0xa43dc5,[_0xb1d0('0x4a')]));})[_0xb1d0('0x8c')](function(_0x732c72){if(_0x732c72[_0xb1d0('0x11c')]){rpcDb[_0xb1d0('0x11d')](_0x34cec5);}if(_0x732c72['active']){rpcDb[_0xb1d0('0x11e')](_0x34cec5);}_0x487262(_[_0xb1d0('0x72')](_0x732c72,[_0xb1d0('0x4a')]));});});};Preview[_0xb1d0('0xb')][_0xb1d0('0x11b')]=function(_0x1e0ee2,_0x2e7b32){var _0x45134e=this;return new Promise(function(_0x302cf8,_0x14b8e7){var _0x569109,_0x28adb1;rpcDb[_0xb1d0('0x11f')](_0x1e0ee2)['then'](function(_0x5377a8){if(!_[_0xb1d0('0x6d')](_0x5377a8[0x0])){_0x28adb1=_0x5377a8[0x0][_0xb1d0('0x120')]?![]:!![];_0x569109=_0x5377a8[0x0][_0xb1d0('0x120')]?!![]:![];_0x569109=_0x2e7b32?!![]:_0x569109;}var _0x1221cc=_0x45134e[_0xb1d0('0x121')](_0x5377a8);if(_0x1221cc[_0xb1d0('0x122')]){rpcDb[_0xb1d0('0x123')](_[_0xb1d0('0x72')](_0x5377a8[0x0],['VoiceQueueId',_0xb1d0('0x10a')]))[_0xb1d0('0x85')](function(_0x2d50ca){_0x45134e[_0xb1d0('0x108')](_0x2d50ca,_0x5377a8[0x0],_0x2e7b32,_0x28adb1,_0x569109)['then'](function(_0x4dc631){_0x302cf8(_0x4dc631);})[_0xb1d0('0x8c')](function(_0x5e39e9){_0x14b8e7(_0x5e39e9);});})[_0xb1d0('0x8c')](function(_0x52438a){ut[_0xb1d0('0x64')](_0xb1d0('0x124'),_0x52438a);_0x14b8e7(ut[_0xb1d0('0x4a')](_0xb1d0('0x125'),_0x28adb1,_0x569109));});}else{_0x14b8e7(ut[_0xb1d0('0x4a')](_0x1221cc[_0xb1d0('0x4a')],_0x28adb1,_0x569109));}})['catch'](function(_0x1bde2a){ut['logger'](_0xb1d0('0x126'),_0x1bde2a);_0x14b8e7(ut[_0xb1d0('0x4a')](_0xb1d0('0x125'),![],!![]));});});};Preview[_0xb1d0('0xb')][_0xb1d0('0x121')]=function(_0x2cfea7){if(_['isNil'](_0x2cfea7)||_[_0xb1d0('0x10e')](_0x2cfea7)||!_[_0xb1d0('0x6d')](_0x2cfea7[0x0][_0xb1d0('0x8a')])&&_[_0xb1d0('0x6d')](_0x2cfea7[0x0]['Agent']['name'])){ut[_0xb1d0('0x64')](_0xb1d0('0x127'),_0x2cfea7);return{'isValid':![],'message':_0xb1d0('0x128')};}var _0x57c815=this[_0xb1d0('0x10')][_0x2cfea7[0x0][_0xb1d0('0x10c')][_0xb1d0('0x55')]];_0x57c815['message']=_0xb1d0('0x9e');if(_[_0xb1d0('0x6d')](_0x57c815)){ut['logger'](_0xb1d0('0x129'),_0x57c815);return{'isValid':![],'message':_0xb1d0('0x12a')};}if(!this[_0xb1d0('0x9c')](_0x57c815[_0xb1d0('0x51')])){ut[_0xb1d0('0x64')](_0xb1d0('0x12b'),_0xb1d0('0x12c')+_0x57c815[_0xb1d0('0x55')]+_0xb1d0('0x12d'));if(!this[_0xb1d0('0x9c')](_0x57c815[_0xb1d0('0x9d')])){ut[_0xb1d0('0x64')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x57c815['name']+_0xb1d0('0x12e'));return{'isValid':![],'message':_0xb1d0('0x12f')};}}if(!ut[_0xb1d0('0x130')](_0x57c815['dialActive'])){ut['logger'](_0xb1d0('0x131'),_0x57c815['name']+_0xb1d0('0x132'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x57c815[_0xb1d0('0x55')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xb1d0('0x133')};};Preview[_0xb1d0('0xb')][_0xb1d0('0x10f')]=function(_0x5afa23,_0x242b41,_0x22fe24,_0x4920c9){var _0x2856ff=this;return new Promise(function(_0x11950c,_0x3b89dc){var _0x39705c=_0x5afa23[_0xb1d0('0xb5')];var _0x1d234e=_0x2856ff['isTrunkReachable'](_0x242b41[_0xb1d0('0x51')])?util['format']('SIP/%s/%s%s',_0x242b41['Trunk'][_0xb1d0('0x55')],_[_0xb1d0('0x6d')](_0x242b41[_0xb1d0('0x36')])?'':_0x242b41[_0xb1d0('0x36')][_0xb1d0('0x134')]()||'',_0x242b41[_0xb1d0('0x135')]>0x0?_0x22fe24[_0xb1d0('0x10a')]['substring'](_0x242b41[_0xb1d0('0x135')]):_0x22fe24[_0xb1d0('0x10a')]):util[_0xb1d0('0x5c')](_0xb1d0('0x136'),_[_0xb1d0('0x6d')](_0x242b41['TrunkBackup'])?_0x242b41['Trunk']['name']:_0x242b41[_0xb1d0('0x9d')]['name'],_[_0xb1d0('0x6d')](_0x242b41[_0xb1d0('0x36')])?'':_0x242b41[_0xb1d0('0x36')][_0xb1d0('0x134')]()||'',_0x242b41['dialCutDigit']>0x0?_0x22fe24[_0xb1d0('0x10a')]['substring'](_0x242b41[_0xb1d0('0x135')]):_0x22fe24['phone']);var _0x1faec9=_0x2856ff[_0xb1d0('0x9c')](_0x242b41['Trunk'])?ut[_0xb1d0('0x137')](_0x242b41['Trunk'][_0xb1d0('0x53')],_0x242b41[_0xb1d0('0x34')],_0x242b41[_0xb1d0('0x138')]>0x0?ut[_0xb1d0('0x139')](_0x242b41[_0xb1d0('0x13a')],_0x242b41[_0xb1d0('0x138')]):_0x242b41[_0xb1d0('0x13a')]):ut[_0xb1d0('0x137')](_[_0xb1d0('0x6d')](_0x242b41[_0xb1d0('0x9d')])?_0x242b41['Trunk'][_0xb1d0('0x53')]:_0x242b41[_0xb1d0('0x9d')][_0xb1d0('0x53')],_0x242b41[_0xb1d0('0x34')],_0x242b41[_0xb1d0('0x138')]>0x0?ut[_0xb1d0('0x139')](_0x242b41[_0xb1d0('0x13a')],_0x242b41[_0xb1d0('0x138')]):_0x242b41[_0xb1d0('0x13a')]);if(_0x1faec9){_0x5afa23[_0xb1d0('0x13b')]=ut['extractCalleridName'](_0x1faec9);_0x5afa23[_0xb1d0('0x13c')]=ut[_0xb1d0('0x13d')](_0x1faec9);}var _0x46dbef=ut[_0xb1d0('0x13e')](_0x242b41,_0x22fe24,_0x1d234e,_0x1faec9,_0x39705c,_0x5afa23);_['merge'](_0x5afa23,ut['toLowerVariables'](_0x46dbef));_0x5afa23[_0xb1d0('0x8e')]=moment()[_0xb1d0('0x5c')](_0xb1d0('0x8f'));_0x242b41['variables']=_0x46dbef;ami[_0xb1d0('0x77')](ut['variablesAction'](_0x5afa23,_0x242b41,_0x46dbef,_0x5afa23[_0xb1d0('0xaf')],_0x4920c9))['then'](function(_0x24f590){_0x242b41[_0xb1d0('0x4b')]+=0x1;logger[_0xb1d0('0x5a')]('[originated][increment]',_0x39705c,'\x20Queue',_0x242b41[_0xb1d0('0x55')],_0xb1d0('0xf8'),_0x242b41[_0xb1d0('0x4b')]);_0x11950c(_0x24f590);})[_0xb1d0('0x8c')](function(_0x2ff8e8){ut[_0xb1d0('0xfd')](_0x5afa23,0xe,_0xb1d0('0x13f'));rpcDb['createAgentHistory'](_0x5afa23,'[originateFailure][logOriginateFailure]');_0x3b89dc(_0x2ff8e8);});});};Preview[_0xb1d0('0xb')]['syncNewExten']=function(_0x4907ef){if(this[_0xb1d0('0x13')][_0x4907ef[_0xb1d0('0xc5')]]){this[_0xb1d0('0x13')][_0x4907ef[_0xb1d0('0xc5')]]['channel']=_0x4907ef[_0xb1d0('0x79')];}};Preview['prototype']['syncOriginateResponse']=function(_0x45ff29){var _0x540dbc=this;var _0x18302e=this[_0xb1d0('0x13')][_0x45ff29[_0xb1d0('0x140')]];if(_0x18302e){if(_0x18302e['lookAgent']&&this['agents'][_0x18302e[_0xb1d0('0x10d')]]){ut[_0xb1d0('0x141')](_0x18302e,this['agents'][_0x18302e[_0xb1d0('0x10d')]][_0xb1d0('0x55')],this['agents'][_0x18302e[_0xb1d0('0x10d')]]['id']);}var _0x5da48e=_[_0xb1d0('0x142')](_0x18302e);_0x5da48e[_0xb1d0('0xb4')]=moment()['format'](_0xb1d0('0x8f'));var _0x21820f=_0x540dbc[_0xb1d0('0x10')][_0x18302e[_0xb1d0('0x6f')]];if(ut[_0xb1d0('0x143')](_0x45ff29[_0xb1d0('0x144')])){if(_0x18302e[_0xb1d0('0xae')]){rpcDb[_0xb1d0('0x11d')](_0x18302e[_0xb1d0('0xb1')]);}if(_0x18302e[_0xb1d0('0xaf')]){rpcDb['disableContact'](_0x18302e[_0xb1d0('0xb1')]);}ami[_0xb1d0('0x5e')](_0xb1d0('0x145'),ut['buildObj'](_0x18302e,_0xb1d0('0x146'),this[_0xb1d0('0x10')][_0x18302e[_0xb1d0('0x6f')]]));this[_0xb1d0('0xf9')](_0x5da48e,_0x21820f,_0x45ff29);}else{_0x18302e[_0xb1d0('0x8e')]=moment()[_0xb1d0('0x5c')](_0xb1d0('0x8f'));ut['logAgent'](_0x5da48e,0x4,_0xb1d0('0xbe'));rpcDb[_0xb1d0('0xfe')](_0x5da48e,_0xb1d0('0x147'));}}};Preview['prototype'][_0xb1d0('0x148')]=function(_0x1e6840){var _0x4ac528=this[_0xb1d0('0x13')][_0x1e6840[_0xb1d0('0xc5')]];var _0x87038;if(_0x4ac528){_0x87038=this[_0xb1d0('0x10')][_0x4ac528[_0xb1d0('0x6f')]];logger[_0xb1d0('0x5a')](_0xb1d0('0x149'),_0x1e6840[_0xb1d0('0xc5')],_0xb1d0('0xc4'),_0x87038[_0xb1d0('0x55')],_0xb1d0('0x70'),_0x87038[_0xb1d0('0x2a')]);}if(this[_0xb1d0('0x13')][_0x1e6840[_0xb1d0('0xc5')]]&&_0x1e6840[_0xb1d0('0xc5')]!==_0x1e6840['uniqueid']){if(_0x1e6840['cause']==='16'&&this['actions'][_0x1e6840[_0xb1d0('0xc5')]][_0xb1d0('0x71')]){this[_0xb1d0('0x14a')](_0x1e6840,_0x1e6840['linkedid'],_0x1e6840[_0xb1d0('0x14b')]);}else if(this['actions'][_0x1e6840[_0xb1d0('0xc5')]][_0xb1d0('0x71')]){logger['info'](_0xb1d0('0x14c'),_0x1e6840[_0xb1d0('0xc5')],_0x1e6840[_0xb1d0('0x14b')],_0xb1d0('0xc4'),_0x87038['name'],'pTalking:\x20',_0x87038[_0xb1d0('0x2a')]);this[_0xb1d0('0x14a')](_0x1e6840,_0x1e6840['linkedid'],_0x1e6840[_0xb1d0('0x14b')]);}}else if(_0x4ac528&&_[_0xb1d0('0x6d')](_0x4ac528[_0xb1d0('0x14d')])&&_0x87038[_0xb1d0('0x14e')]&&_0x1e6840[_0xb1d0('0xc5')]===_0x1e6840['uniqueid']&&_[_0xb1d0('0x6d')](_0x1e6840[_0xb1d0('0xfc')])&&_0x1e6840[_0xb1d0('0x14b')]==='16'&&_0x1e6840[_0xb1d0('0x14f')]==='6'&&_[_0xb1d0('0xfa')](_0x4ac528[_0xb1d0('0x150')])){if(_0x4ac528[_0xb1d0('0xae')]){rpcDb[_0xb1d0('0x11d')](_0x4ac528[_0xb1d0('0xb1')]);}if(_0x4ac528[_0xb1d0('0xaf')]){rpcDb[_0xb1d0('0x11e')](_0x4ac528[_0xb1d0('0xb1')]);}_0x1e6840[_0xb1d0('0xfc')]='22';this[_0xb1d0('0xf9')](_0x4ac528,_0x87038,_0x1e6840);}else if(_0x4ac528&&_0x4ac528[_0xb1d0('0x150')]){if(_0x1e6840[_0xb1d0('0x14b')]==='16'&&this[_0xb1d0('0x13')][_0x1e6840[_0xb1d0('0xc5')]][_0xb1d0('0x71')]){logger[_0xb1d0('0x5a')](_0xb1d0('0x151'),_0x1e6840[_0xb1d0('0xc5')],_0x1e6840[_0xb1d0('0x14b')],_0xb1d0('0xc4'),_0x87038[_0xb1d0('0x55')],'pTalking:\x20',_0x87038[_0xb1d0('0x2a')]);this[_0xb1d0('0x14a')](_0x1e6840,_0x1e6840['linkedid'],_0x1e6840[_0xb1d0('0x14b')]);}else if(this[_0xb1d0('0x13')][_0x1e6840[_0xb1d0('0xc5')]][_0xb1d0('0x71')]){logger[_0xb1d0('0x5a')](_0xb1d0('0x14c'),_0x1e6840[_0xb1d0('0xc5')],_0x1e6840[_0xb1d0('0x14b')],_0xb1d0('0xc4'),_0x87038['name'],_0xb1d0('0x70'),_0x87038[_0xb1d0('0x2a')]);this[_0xb1d0('0x14a')](_0x1e6840,_0x1e6840[_0xb1d0('0xc5')],_0x1e6840[_0xb1d0('0x14b')]);}}};Preview[_0xb1d0('0xb')][_0xb1d0('0x1b')]=function(_0x3f9a54){if(this[_0xb1d0('0x13')][_0x3f9a54[_0xb1d0('0x152')]]&&_0x3f9a54[_0xb1d0('0x152')]!==_0x3f9a54[_0xb1d0('0x153')]){this[_0xb1d0('0x14a')](_0x3f9a54,_0x3f9a54[_0xb1d0('0x152')],_0x3f9a54[_0xb1d0('0xed')]);}};Preview[_0xb1d0('0xb')][_0xb1d0('0x154')]=function(_0x4c70a2){if(this['actions'][_0x4c70a2[_0xb1d0('0xc5')]]&&_0x4c70a2['linkedid']!==_0x4c70a2[_0xb1d0('0xb5')]&&!this['actions'][_0x4c70a2[_0xb1d0('0xc5')]][_0xb1d0('0x71')]){if(_0x4c70a2[_0xb1d0('0x14b')]==='1'){this[_0xb1d0('0x14a')](_0x4c70a2,_0x4c70a2[_0xb1d0('0xc5')],_0x4c70a2[_0xb1d0('0x14b')]);}}};Preview[_0xb1d0('0xb')][_0xb1d0('0x155')]=function(_0x21ea79,_0x5de2a4,_0x1ab97c){if(this[_0xb1d0('0x13')][_0x21ea79]){if(_[_0xb1d0('0x6d')](this[_0xb1d0('0x13')][_0x21ea79][_0xb1d0('0x156')])){this[_0xb1d0('0x13')][_0x21ea79][_0xb1d0('0x156')]={};}this[_0xb1d0('0x13')][_0x21ea79]['variables'][_0x5de2a4]=_0x1ab97c;}};Preview['prototype'][_0xb1d0('0x1f')]=function(_0xb6ee5a){try{if(!_[_0xb1d0('0x6d')](_0xb6ee5a)){if(ut[_0xb1d0('0x157')](_[_0xb1d0('0x158')](_0xb6ee5a[_0xb1d0('0x159')])[0x0])){this[_0xb1d0('0x155')](_0xb6ee5a[_0xb1d0('0xb5')],_[_0xb1d0('0x158')](_0xb6ee5a[_0xb1d0('0x159')])[0x0],_0xb6ee5a[_0xb1d0('0x15a')]);}}}catch(_0x3ce4e8){logger[_0xb1d0('0x15b')](_0xb1d0('0x15c'),util['inspect'](_0x3ce4e8,{'showHidden':![],'depth':null}));}};Preview[_0xb1d0('0xb')][_0xb1d0('0x21')]=function(_0x1a65f6){if(_0x1a65f6){if(this[_0xb1d0('0x13')][_0x1a65f6[_0xb1d0('0x15d')]]){this[_0xb1d0('0x13')][_0x1a65f6[_0xb1d0('0x15d')]][_0xb1d0('0x150')]=!![];}}};Preview[_0xb1d0('0xb')][_0xb1d0('0x23')]=function(_0x4341c6){if(_0x4341c6){if(this[_0xb1d0('0x13')][_0x4341c6[_0xb1d0('0x15e')]]){this[_0xb1d0('0x13')][_0x4341c6[_0xb1d0('0x15e')]][_0xb1d0('0x150')]=!![];}}};module[_0xb1d0('0x15f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9db1a6b..1ecf9bd 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 _0x1a69=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/voiceQueueReport','then','createHistory','catch','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x1a69,0x124));var _0x91a6=function(_0x11cc41,_0x3c30ab){_0x11cc41=_0x11cc41-0x0;var _0x474e9e=_0x1a69[_0x11cc41];return _0x474e9e;};'use strict';var util=require(_0x91a6('0x0'));var BPromise=require(_0x91a6('0x1'));var logger=require(_0x91a6('0x2'))(_0x91a6('0x3'));var _=require(_0x91a6('0x4'));var cmHopper=require(_0x91a6('0x5'));var cmHopperFinal=require(_0x91a6('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x91a6('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x91a6('0x8'));function loggerCatch(_0x2071fb){return function(_0x1ef62d){logger['error'](_0x2071fb,util['inspect'](_0x1ef62d,{'showHidden':![],'depth':null}));};}function create(_0x52b65f){return BPromise['resolve']()[_0x91a6('0x9')](cmHopperHistory[_0x91a6('0xa')](_0x52b65f))[_0x91a6('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1840e9){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](agentReportPreview[_0x91a6('0xa')](_0x1840e9))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2a3acd){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper['moveContactManagedDialer'](_0x2a3acd,!![]))['catch'](loggerCatch(_0x91a6('0xd')));}exports[_0x91a6('0xe')]=function(_0xa458bc){return BPromise[_0x91a6('0xc')]()['then'](cmHopperBlack[_0x91a6('0xe')](_0xa458bc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0xf')));};exports['getContactPreview']=function(_0x17d61c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x10')](_0x17d61c))['catch'](loggerCatch(_0x91a6('0x11')));};exports[_0x91a6('0xa')]=function(_0x3acbcf,_0x3fc791){create(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));moveContact(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));};exports[_0x91a6('0x12')]=function(_0x485680,_0x574ce6){createAgent(_0x485680)[_0x91a6('0xb')](loggerCatch(_0x574ce6));};exports[_0x91a6('0x13')]=function(_0x2c3252,_0x375d90){create(_0x2c3252)[_0x91a6('0xb')](loggerCatch(_0x375d90));};exports[_0x91a6('0x14')]=function(_0x165596,_0x26fa5a){moveContact(_0x165596)[_0x91a6('0xb')](loggerCatch(_0x26fa5a));};exports[_0x91a6('0x15')]=function(_0x2f8305,_0x58d121,_0x48eb91){if(_0x58d121){_0x2f8305[_0x91a6('0x16')]=null;}if(_0x48eb91){_0x2f8305[_0x91a6('0x17')]=![];}return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x15')](_0x2f8305))['catch'](loggerCatch(_0x91a6('0x18')));};exports[_0x91a6('0x19')]=function(_0x511abc){return BPromise['resolve']()[_0x91a6('0x9')](cmHopper[_0x91a6('0x19')](_0x511abc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x1a')));};exports['unlockContact']=function(_0x4ed36f){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x1b')]({'UserId':null},_0x4ed36f,0x1))['catch'](loggerCatch(_0x91a6('0x1c')));};exports[_0x91a6('0x1d')]=function(_0x4910b2){return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x1b')]({'active':![]},_0x4910b2,0x1))['catch'](loggerCatch(_0x91a6('0x1e')));};exports[_0x91a6('0x1f')]=function(_0x13bd4f){var _0x15abc5={};_0x15abc5['type']=_0x13bd4f[_0x91a6('0x20')];_0x15abc5[_0x91a6('0x21')]=_0x13bd4f[_0x91a6('0x21')];_0x15abc5[_0x91a6('0x22')]=_0x13bd4f[_0x91a6('0x22')];_0x15abc5[_0x91a6('0x23')]=_0x13bd4f[_0x91a6('0x23')];_0x15abc5['queue']=_0x13bd4f['queue'];_0x15abc5[_0x91a6('0x24')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5[_0x91a6('0x26')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5['queuecallercomplete']=0x1;_0x15abc5[_0x91a6('0x27')]=_0x13bd4f[_0x91a6('0x28')];_0x15abc5[_0x91a6('0x29')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['context']=_0x91a6('0x2b');_0x15abc5[_0x91a6('0x2c')]=_0x91a6('0x2d');_0x15abc5[_0x91a6('0x2e')]=0x0;_0x15abc5[_0x91a6('0x2f')]=0x1;_0x15abc5[_0x91a6('0x30')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['queuecallerexitreason']='COMPLETED';return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](voiceQueueReport[_0x91a6('0x31')](_0x15abc5))['catch'](loggerCatch(_0x91a6('0x32')));};exports['getContactRecallMe']=function(_0x3e1c23,_0x3d391c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x33')](_0x3e1c23,_0x3d391c))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x34')));};exports[_0x91a6('0x35')]=function(_0x4fcf91){return BPromise[_0x91a6('0xc')]()['then'](cmHopper['rescheduleContact'](_0x4fcf91,!![],!![]))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x36')));}; \ No newline at end of file +var _0xf80e=['util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','[createHistory]\x20','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x93aa24,_0x2363ba){var _0x5252ad=function(_0x382c59){while(--_0x382c59){_0x93aa24['push'](_0x93aa24['shift']());}};_0x5252ad(++_0x2363ba);}(_0xf80e,0x113));var _0xef80=function(_0x473f91,_0xa3dcf0){_0x473f91=_0x473f91-0x0;var _0x16b32d=_0xf80e[_0x473f91];return _0x16b32d;};'use strict';var util=require(_0xef80('0x0'));var BPromise=require('bluebird');var logger=require(_0xef80('0x1'))(_0xef80('0x2'));var _=require(_0xef80('0x3'));var cmHopper=require(_0xef80('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xef80('0x5'));var cmHopperBlack=require(_0xef80('0x6'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xef80('0x7'));var voiceQueueReport=require(_0xef80('0x8'));function loggerCatch(_0x21b371){return function(_0x493c20){logger[_0xef80('0x9')](_0x21b371,util['inspect'](_0x493c20,{'showHidden':![],'depth':null}));};}function create(_0x47d576){return BPromise['resolve']()[_0xef80('0xa')](cmHopperHistory['createHistory'](_0x47d576))['catch'](loggerCatch(_0xef80('0xb')));}function createAgent(_0xd945a9){return BPromise['resolve']()['then'](agentReportPreview[_0xef80('0xc')](_0xd945a9))[_0xef80('0xd')](loggerCatch(_0xef80('0xb')));}function moveContact(_0x5520c1){return BPromise['resolve']()[_0xef80('0xa')](cmHopper[_0xef80('0xe')](_0x5520c1,!![]))[_0xef80('0xd')](loggerCatch(_0xef80('0xf')));}exports[_0xef80('0x10')]=function(_0x3f6541){return BPromise[_0xef80('0x11')]()[_0xef80('0xa')](cmHopperBlack[_0xef80('0x10')](_0x3f6541))[_0xef80('0xd')](loggerCatch(_0xef80('0x12')));};exports[_0xef80('0x13')]=function(_0x2c4e92){return BPromise[_0xef80('0x11')]()['then'](cmHopper['getContactPreview'](_0x2c4e92))['catch'](loggerCatch(_0xef80('0x14')));};exports[_0xef80('0xc')]=function(_0x574c15,_0x4d841b){create(_0x574c15)['catch'](loggerCatch(_0x4d841b));moveContact(_0x574c15)[_0xef80('0xd')](loggerCatch(_0x4d841b));};exports[_0xef80('0x15')]=function(_0x1483d8,_0x1314f8){createAgent(_0x1483d8)[_0xef80('0xd')](loggerCatch(_0x1314f8));};exports[_0xef80('0x16')]=function(_0x3f9883,_0x5cfcd8){create(_0x3f9883)['catch'](loggerCatch(_0x5cfcd8));};exports[_0xef80('0x17')]=function(_0x347765,_0x5f2734){moveContact(_0x347765)[_0xef80('0xd')](loggerCatch(_0x5f2734));};exports[_0xef80('0x18')]=function(_0x1c91c0,_0x317d29,_0x2c749d){if(_0x317d29){_0x1c91c0[_0xef80('0x19')]=null;}if(_0x2c749d){_0x1c91c0[_0xef80('0x1a')]=![];}return BPromise[_0xef80('0x11')]()[_0xef80('0xa')](cmHopper['rescheduleContact'](_0x1c91c0))[_0xef80('0xd')](loggerCatch(_0xef80('0x1b')));};exports[_0xef80('0x1c')]=function(_0x66d3ea){return BPromise[_0xef80('0x11')]()[_0xef80('0xa')](cmHopper['countReScheduled'](_0x66d3ea))[_0xef80('0xd')](loggerCatch(_0xef80('0x1d')));};exports[_0xef80('0x1e')]=function(_0x138e7e){return BPromise[_0xef80('0x11')]()['then'](cmHopper['unlockContact']({'UserId':null},_0x138e7e,0x1))[_0xef80('0xd')](loggerCatch(_0xef80('0x1f')));};exports['disableContact']=function(_0x3f758d){return BPromise['resolve']()[_0xef80('0xa')](cmHopper[_0xef80('0x1e')]({'active':![]},_0x3f758d,0x1))['catch'](loggerCatch('[activeContact]\x20'));};exports['crateCustomerReportQueue']=function(_0x25defa){var _0x30bbed={};_0x30bbed['type']=_0x25defa['type'];_0x30bbed['uniqueid']=_0x25defa[_0xef80('0x20')];_0x30bbed[_0xef80('0x21')]=_0x25defa[_0xef80('0x21')];_0x30bbed[_0xef80('0x22')]=_0x25defa[_0xef80('0x22')];_0x30bbed[_0xef80('0x23')]=_0x25defa['queue'];_0x30bbed[_0xef80('0x24')]=_0x25defa['answertime'];_0x30bbed[_0xef80('0x25')]=_0x25defa[_0xef80('0x26')];_0x30bbed['queuecallercomplete']=0x1;_0x30bbed['queuecallercompleteAt']=_0x25defa[_0xef80('0x27')];_0x30bbed[_0xef80('0x28')]=_0x25defa[_0xef80('0x29')];_0x30bbed['context']=_0xef80('0x2a');_0x30bbed[_0xef80('0x2b')]=_0xef80('0x2c');_0x30bbed[_0xef80('0x2d')]=0x0;_0x30bbed['assigned']=0x1;_0x30bbed[_0xef80('0x2e')]=_0x25defa['membername'];_0x30bbed[_0xef80('0x2f')]=_0xef80('0x30');return BPromise[_0xef80('0x11')]()[_0xef80('0xa')](voiceQueueReport[_0xef80('0x31')](_0x30bbed))['catch'](loggerCatch(_0xef80('0x32')));};exports[_0xef80('0x33')]=function(_0x3163b4,_0x274490){return BPromise['resolve']()[_0xef80('0xa')](cmHopper[_0xef80('0x33')](_0x3163b4,_0x274490))[_0xef80('0xd')](loggerCatch(_0xef80('0x34')));};exports[_0xef80('0x35')]=function(_0x1da9c2){return BPromise[_0xef80('0x11')]()['then'](cmHopper['rescheduleContact'](_0x1da9c2,!![],!![]))[_0xef80('0xd')](loggerCatch(_0xef80('0x36')));}; \ 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 5b18202..faafd1e 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 _0x1a6c=['rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','loggerError','error','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','countbusyretry','countagentrejectretry','countnosuchnumberretry','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','not_inuse','push','getDiff','createBody','CampaignId','filterKey','idContact','membername','countcongestionretry','countnoanswerretry','callback','recallme','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x1a6c,0x126));var _0xc1a6=function(_0xb57c81,_0x3905b1){_0xb57c81=_0xb57c81-0x0;var _0x479337=_0x1a6c[_0xb57c81];return _0x479337;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc1a6('0x0'));var logger=require(_0xc1a6('0x1'))(_0xc1a6('0x2'));var ipAgi=process[_0xc1a6('0x3')][_0xc1a6('0x4')]||_0xc1a6('0x5');function getSeconds(_0x1fd8b6,_0x5f17ee){var _0x162a76=moment(_0x1fd8b6)[_0xc1a6('0x6')](0x0);var _0x41cdd5=moment(_0x5f17ee)[_0xc1a6('0x6')](0x0);return _0x162a76[_0xc1a6('0x7')](_0x41cdd5,_0xc1a6('0x8'));}exports['loggerCatch']=function(_0x22675d){return function(_0x1bd0a4){logger['error'](_0x22675d,util[_0xc1a6('0x9')](_0x1bd0a4,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x25acdb,_0x3a518d){logger['info'](_0x25acdb,util[_0xc1a6('0x9')](_0x3a518d,{'showHidden':![],'depth':null}));};exports[_0xc1a6('0xa')]=function(_0x2a601a,_0xaf3db0){logger[_0xc1a6('0xb')](_0x2a601a,util[_0xc1a6('0x9')](_0xaf3db0,{'showHidden':![],'depth':null}));};exports[_0xc1a6('0xc')]=function(_0x182bce){return function(_0x289bac){logger[_0xc1a6('0xd')](_0x182bce,util['inspect'](_0x289bac,{'showHidden':![],'depth':null}));};};exports[_0xc1a6('0xe')]=function(_0x18ebda,_0x57401c,_0x26ef9f){return{'message':_0x18ebda,'unlock':_0x57401c,'active':_0x26ef9f};};exports[_0xc1a6('0xf')]=function(_0x50c83c,_0x5def4,_0x1f965b){if(!_[_0xc1a6('0x10')](_0x1f965b)&&_0xc1a6('0x11')===typeof _0x1f965b&&!_[_0xc1a6('0x12')](_0x1f965b)){if(!_[_0xc1a6('0x10')](_0x5def4)&&_0xc1a6('0x11')===typeof _0x5def4&&!_[_0xc1a6('0x12')](_0x5def4)){return util[_0xc1a6('0x13')](_0xc1a6('0x14'),_0x5def4,_0x1f965b);}return util[_0xc1a6('0x13')](_0xc1a6('0x14'),_0x1f965b,_0x1f965b);}if(!_[_0xc1a6('0x10')](_0x50c83c)&&'string'===typeof _0x50c83c&&!_['isEmpty'](_0x50c83c)){return _0x50c83c;}return _0xc1a6('0x15');};exports[_0xc1a6('0x16')]=function(_0x57395b){if(_[_0xc1a6('0x17')](_0x57395b)){return![];}return _0x57395b;};exports[_0xc1a6('0x18')]=function(_0x2680e3,_0x1e7700,_0x4445a0,_0xbf4aaa,_0xaa91b,_0x218460){var _0x37a43f={'XMD-QUEUE':_0x1e7700['Queue']?_0x1e7700['Queue'][_0xc1a6('0x19')]:'','XMD-CALLERID':_0xbf4aaa,'XMD-CALLERID-PREVIEW':_0x218460?util['format'](_0xc1a6('0x14'),_0x218460[_0xc1a6('0x1a')],_0x218460[_0xc1a6('0x1b')]):_0xbf4aaa,'XMD-DIALID':_0xaa91b,'XMD-CONTACTID':_0x1e7700[_0xc1a6('0x1c')],'XMD-CDRTYPE':_0xc1a6('0x1d'),'CALLERID(all)':_0xbf4aaa,'XMD-VOICEQUEUEID':_0x1e7700[_0xc1a6('0x1e')],'XMD-DIALCHANNEL':_0x4445a0,'XMD-DIALTIMEOUT':_0x2680e3[_0xc1a6('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0xc1a6('0x13')](_0xc1a6('0x20'),_0x2680e3['dialQueueProject2']?'g':'',_[_0xc1a6('0x12')](_0x2680e3[_0xc1a6('0x21')])?'':_0xc1a6('0x22')),'XMD-DIALURL':_0x2680e3['dialPreviewUrl']||'','XMD-AGI':_0x2680e3[_0xc1a6('0x23')]?util[_0xc1a6('0x13')](_0xc1a6('0x24'),ipAgi,_0x2680e3[_0xc1a6('0x23')]):_0xc1a6('0x25'),'XMD-AGIAFTER':_0x2680e3['dialQueueProject2']?util[_0xc1a6('0x13')](_0xc1a6('0x24'),ipAgi,_0x2680e3[_0xc1a6('0x26')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x218460?_0x218460[_0xc1a6('0x27')]:'','XMD-ORIGINATECALLERIDNAME':_0x218460?_0x218460[_0xc1a6('0x28')]:'','XMD-DESTINATION':_0xc1a6('0x29'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xc1a6('0x12')](_0x2680e3[_0xc1a6('0x21')])){_0x37a43f[util[_0xc1a6('0x13')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x2680e3['monitor_format'];_0x37a43f[util['format']('%s',_0xc1a6('0x2a'))]=_0xaa91b;}if(_0x1e7700&&_0x1e7700['Contact']){for(var _0x5795b4 in _0x1e7700['Contact']){if(_0x1e7700[_0xc1a6('0x2b')][_0xc1a6('0x2c')](_0x5795b4)){if(!_['isNil'](_0x1e7700[_0xc1a6('0x2b')][_0x5795b4])&&_0x5795b4!=='id'&&_0x5795b4!=='tags'&&_0x5795b4!==_0xc1a6('0x2d')&&_0x5795b4!==_0xc1a6('0x2e')){_0x37a43f[util[_0xc1a6('0x13')](_0xc1a6('0x2f'),_0xc1a6('0x30'),_['toUpper'](_0x5795b4))]=_0x1e7700[_0xc1a6('0x2b')][_0x5795b4];}}}}return _0x37a43f;};exports[_0xc1a6('0x31')]=function(_0x478224){var _0x16d443={};for(var _0xab9928 in _0x478224){if(_0x478224[_0xc1a6('0x2c')](_0xab9928)){_0x16d443[util[_0xc1a6('0x13')]('%s',_[_0xc1a6('0x32')](_0xab9928))]=_0x478224[_0xab9928];}}return{'variables':_0x16d443};};exports[_0xc1a6('0x33')]=function(_0x34c5a6,_0x5aaa7a){if(!_[_0xc1a6('0x17')](_0x34c5a6)){if(_0x34c5a6['hasOwnProperty'](_0xc1a6('0x34'))){if(_0x34c5a6[_0xc1a6('0x34')]>0x0){_0x34c5a6['originated']-=0x1;}else{logger[_0xc1a6('0xb')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5aaa7a);}}}else{logger[_0xc1a6('0xb')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x5aaa7a);}};exports[_0xc1a6('0x35')]=function(_0x593269){var _0x145dfe=moment()['format'](_0xc1a6('0x36'));_0x593269[_0xc1a6('0x37')]=0xd;_0x593269[_0xc1a6('0x38')]='Blacklist';_0x593269[_0xc1a6('0x39')]=_0x145dfe;_0x593269[_0xc1a6('0x3a')]=_0x145dfe;_0x593269[_0xc1a6('0x3b')]=_0x145dfe;};exports[_0xc1a6('0x3c')]=function(_0x11fc4a,_0x456fbf,_0x110f8c){var _0x578d43=moment()[_0xc1a6('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x11fc4a[_0xc1a6('0x37')]=_0x456fbf;_0x11fc4a[_0xc1a6('0x38')]=_0x110f8c;_0x11fc4a[_0xc1a6('0x3a')]=_0x578d43;_0x11fc4a[_0xc1a6('0x3d')]=getSeconds(_0x11fc4a[_0xc1a6('0x3a')],_0x11fc4a[_0xc1a6('0x39')]);};exports[_0xc1a6('0x3e')]=function(_0x4428dd,_0x58deb9,_0x38630a){_0x4428dd['membername']=_0x58deb9;_0x4428dd[_0xc1a6('0x3f')]=_0x38630a;};exports[_0xc1a6('0x40')]=function(_0x53fdca,_0x29b80d,_0x2ac131){var _0x76da4a=moment()['format'](_0xc1a6('0x36'));_0x53fdca[_0xc1a6('0x37')]=_0x29b80d;_0x53fdca['statedesc']=_0x2ac131;_0x53fdca[_0xc1a6('0x3a')]=_0x53fdca['responsetime']?_0x53fdca[_0xc1a6('0x3a')]:_0x76da4a;_0x53fdca[_0xc1a6('0x3b')]=_0x53fdca['endtime']?_0x53fdca['endtime']:_0x76da4a;_0x53fdca[_0xc1a6('0x3d')]=getSeconds(_0x53fdca['responsetime']||0x0,_0x53fdca[_0xc1a6('0x39')]||0x0);_0x53fdca[_0xc1a6('0x41')]=_0x53fdca['answertime']?getSeconds(_0x53fdca[_0xc1a6('0x3b')],_0x53fdca[_0xc1a6('0x42')]):0x0;};exports[_0xc1a6('0x43')]=function(_0x7acbbf){return _0x7acbbf===_0xc1a6('0x44');};exports[_0xc1a6('0x45')]=function(_0x273ec8,_0x401bc7,_0x7cc196,_0x9fe855,_0x539ef4){var _0x2a7463=_0x9fe855?_0xc1a6('0x46'):_0x273ec8['calleridname'];_0x2a7463=_0x539ef4?_0xc1a6('0x47'):_0x2a7463;return{'actionid':_0x273ec8[_0xc1a6('0x48')],'action':_0xc1a6('0x49'),'channel':_0x273ec8[_0xc1a6('0x4a')],'callerid':util[_0xc1a6('0x13')]('\x22%s\x22\x20<%s>',_0x2a7463,_0x273ec8[_0xc1a6('0x1b')]),'Exten':_0xc1a6('0x29'),'Context':'from-sip','Priority':'1','variable':_0x7cc196,'timeout':(_0x401bc7[_0xc1a6('0x4b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x273ec8[_0xc1a6('0x48')]};};exports['totalGlobal']=function(_0x311a2e){return _0x311a2e[_0xc1a6('0x4c')]+_0x311a2e['countcongestionretry']+_0x311a2e['countnoanswerretry']+_0x311a2e[_0xc1a6('0x4d')]+_0x311a2e[_0xc1a6('0x4e')];};exports['cloneAction']=function(_0x278245){var _0x2b262a=_[_0xc1a6('0x4f')](_0x278245);_0x2b262a[_0xc1a6('0x37')]=0xf;_0x2b262a[_0xc1a6('0x38')]=_0xc1a6('0x50');return _0x2b262a;};exports['scheduledAt']=function(_0x4a1fff,_0x12ac8c,_0x5df443){var _0x323041={};_0x323041[_0x12ac8c]=_0x4a1fff[_0x12ac8c];_0x323041[_0xc1a6('0x51')]=![];_0x323041[_0xc1a6('0x52')]=moment()['add'](_0x5df443,_0xc1a6('0x53'))['format'](_0xc1a6('0x36'));_0x323041[_0xc1a6('0x1c')]=_0x4a1fff['ContactId'];_0x323041['ListId']=_0x4a1fff[_0xc1a6('0x54')];_0x323041[_0xc1a6('0x1e')]=_0x4a1fff[_0xc1a6('0x1e')]||undefined;return _0x323041;};exports[_0xc1a6('0x55')]=function(_0x2f6bcb,_0x57513c){if(!_[_0xc1a6('0x17')](_0x2f6bcb)){if(_0x2f6bcb[_0xc1a6('0x56')]>0x0){_0x2f6bcb[_0xc1a6('0x56')]-=0x1;}else{logger[_0xc1a6('0xb')](_0x57513c,_0xc1a6('0x57'));}}else{logger[_0xc1a6('0xb')](_0x57513c,_0xc1a6('0x58'));}};exports[_0xc1a6('0x59')]=function(_0x1fb8e3){if(_0x1fb8e3<=0x0){return!![];}return![];};function buildObj(_0x5444aa,_0x39bf34,_0x2f9324){_0x5444aa[_0xc1a6('0x5a')]=_0x39bf34;_0x5444aa[_0xc1a6('0x19')]=_0x5444aa[_0xc1a6('0x5b')];_0x5444aa[_0xc1a6('0x5c')]=_0x5444aa[_0xc1a6('0x4a')];_0x5444aa[_0xc1a6('0x5d')]=_0xc1a6('0x5e');if(_0x2f9324){_0x5444aa[_0xc1a6('0x5f')]=_0x2f9324[_0xc1a6('0x5f')];}return _0x5444aa;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x3a490d){var _0x16f377={};_0x16f377[_0xc1a6('0x5b')]=_0x3a490d[_0xc1a6('0x5b')];_0x16f377[_0xc1a6('0x5c')]=_0x3a490d[_0xc1a6('0x4a')];_0x16f377[_0xc1a6('0x48')]=_0x3a490d['uniqueid'];return _0x16f377;};exports['agentReadyId']=function(_0x3154be){var _0x58f7d1=[];for(var _0x484e2c in _0x3154be){if(_0x3154be[_0xc1a6('0x2c')](_0x484e2c)){if(!_[_0xc1a6('0x17')](_0x3154be[_0x484e2c])&&_0x3154be[_0x484e2c][_0xc1a6('0x37')]===_0xc1a6('0x60')&&_0x3154be[_0x484e2c]['status']==='reachable'){_0x58f7d1[_0xc1a6('0x61')](_0x3154be[_0x484e2c]['id']);}}}return _0x58f7d1;};exports[_0xc1a6('0x62')]=function(_0x45e1e7){var _0x255991=moment()[_0xc1a6('0x6')](0x0);var _0x16cd59=moment(_0x45e1e7)[_0xc1a6('0x6')](0x0);return _0x255991[_0xc1a6('0x7')](_0x16cd59,'seconds');};exports[_0xc1a6('0x63')]=function(_0x3698d2){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3698d2[_0xc1a6('0x1c')],'ListId':_0x3698d2[_0xc1a6('0x54')],'VoiceQueueId':_0x3698d2[_0xc1a6('0x1e')]||undefined,'CampaignId':_0x3698d2[_0xc1a6('0x64')]||undefined};};exports[_0xc1a6('0x65')]=function(_0x687bf0){if(_0x687bf0==='uniqueid'||_0x687bf0===_0xc1a6('0x66')||_0x687bf0===_0xc1a6('0x5b')||_0x687bf0==='type'||_0x687bf0==='campaigntype'||_0x687bf0==='dialAnswer'||_0x687bf0===_0xc1a6('0x67')||_0x687bf0===_0xc1a6('0x4a')||_0x687bf0===_0xc1a6('0x1a')||_0x687bf0==='active'||_0x687bf0===_0xc1a6('0x1b')||_0x687bf0===_0xc1a6('0x52')||_0x687bf0===_0xc1a6('0x4c')||_0x687bf0===_0xc1a6('0x68')||_0x687bf0===_0xc1a6('0x69')||_0x687bf0==='countglobal'||_0x687bf0===_0xc1a6('0x6a')||_0x687bf0==='callbackuniqueid'||_0x687bf0==='callbackat'||_0x687bf0===_0xc1a6('0x6b')||_0x687bf0===_0xc1a6('0x1c')||_0x687bf0===_0xc1a6('0x54')||_0x687bf0===_0xc1a6('0x3f')||_0x687bf0===_0xc1a6('0x1e')||_0x687bf0===_0xc1a6('0x6c')||_0x687bf0===_0xc1a6('0x6d')||_0x687bf0==='xmd-queue'||_0x687bf0==='xmd-phone'||_0x687bf0===_0xc1a6('0x6e')||_0x687bf0==='xmd-dialurl'||_0x687bf0===_0xc1a6('0x6f')||_0x687bf0===_0xc1a6('0x70')||_0x687bf0===_0xc1a6('0x71')||_0x687bf0===_0xc1a6('0x72')||_0x687bf0===_0xc1a6('0x73')||_0x687bf0==='xmd-cdrtype'||_0x687bf0===_0xc1a6('0x74')||_0x687bf0===_0xc1a6('0x75')||_0x687bf0===_0xc1a6('0x76')||_0x687bf0===_0xc1a6('0x77')||_0x687bf0==='rtpaudioqosbridged'||_0x687bf0==='rtpaudioqosjitter'||_0x687bf0===_0xc1a6('0x78')||_0x687bf0==='rtpaudioqosloss'||_0x687bf0===_0xc1a6('0x79')||_0x687bf0===_0xc1a6('0x7a')||_0x687bf0===_0xc1a6('0x7b')||_0x687bf0===_0xc1a6('0x77')||_0x687bf0===_0xc1a6('0x7c')||_0x687bf0===_0xc1a6('0x7d')||_0x687bf0===_0xc1a6('0x78')||_0x687bf0===_0xc1a6('0x7e')||_0x687bf0===_0xc1a6('0x79')||_0x687bf0==='rtpaudioqosrtt'||_0x687bf0===_0xc1a6('0x7b')||_0x687bf0===_0xc1a6('0x7f')||_0x687bf0==='bridgepvtcallid'||_0x687bf0===_0xc1a6('0x37')||_0x687bf0===_0xc1a6('0x38')){return![];}return!![];};exports[_0xc1a6('0x80')]=function(_0x24765d,_0x368a3a){var _0x31e1c1,_0x55dccb,_0x3043a5;if(_0x368a3a<=0x0){_0x368a3a=0x1;}_0x31e1c1=new RegExp(_0xc1a6('0x81')+_0x368a3a+'}$');_0x55dccb=Math[_0xc1a6('0x82')](0xa,_0x368a3a-0x1);_0x3043a5=Math[_0xc1a6('0x82')](0xa,_0x368a3a)-0x1;return util[_0xc1a6('0x13')]('%s',_[_0xc1a6('0x83')](_0x24765d,_0x31e1c1,_[_0xc1a6('0x84')](_0x55dccb,_0x3043a5)));};exports['extractCalleridName']=function(_0x414b47){var _0x4b31e4=_0x414b47[_0xc1a6('0x85')](/"(.*?)"/);return _0x4b31e4?_0x4b31e4[0x1]:_0x414b47;};exports[_0xc1a6('0x86')]=function(_0x4b2824){var _0x33e687=_0x4b2824[_0xc1a6('0x85')](/<(.*?)>/);return _0x33e687?_0x33e687[0x1]:_0x4b2824;};function buildNoAnswerEventPayload(_0xf5ad01,_0x2859cb){var _0x3f3da3=buildObj(_0xf5ad01,'noanswer');if(!_[_0xc1a6('0x12')](_0x2859cb[_0xc1a6('0x87')])){Object[_0xc1a6('0x88')](_0x2859cb[_0xc1a6('0x87')])[_0xc1a6('0x89')](function(_0xa73d6){_0x3f3da3[_0xa73d6[_0xc1a6('0x8a')]()]=_0x2859cb['variables'][_0xa73d6];});}return _0x3f3da3;}exports[_0xc1a6('0x8b')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xb962=['calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','state','responsetime','starttime','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnosuchnumberretry','clone','Global','scheduledAt','active','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff','diff','createBody','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','variables','keys','forEach','toLowerCase','util','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','info','loggerError','logger2','message','getCallerId','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname'];(function(_0x34a7b5,_0x15c8fe){var _0x28dcf4=function(_0xe27734){while(--_0xe27734){_0x34a7b5['push'](_0x34a7b5['shift']());}};_0x28dcf4(++_0x15c8fe);}(_0xb962,0x1ae));var _0x2b96=function(_0x1793dc,_0x2372d6){_0x1793dc=_0x1793dc-0x0;var _0x3d4606=_0xb962[_0x1793dc];return _0x3d4606;};'use strict';var util=require(_0x2b96('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x2b96('0x1'))('preview');var ipAgi=process[_0x2b96('0x2')][_0x2b96('0x3')]||_0x2b96('0x4');function getSeconds(_0x5106e6,_0x82bc65){var _0x2abb63=moment(_0x5106e6)[_0x2b96('0x5')](0x0);var _0x1ff63e=moment(_0x82bc65)['milliseconds'](0x0);return _0x2abb63['diff'](_0x1ff63e,_0x2b96('0x6'));}exports[_0x2b96('0x7')]=function(_0x3be51a){return function(_0x56bcb0){logger[_0x2b96('0x8')](_0x3be51a,util[_0x2b96('0x9')](_0x56bcb0,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x259b87,_0x24db9e){logger[_0x2b96('0xa')](_0x259b87,util[_0x2b96('0x9')](_0x24db9e,{'showHidden':![],'depth':null}));};exports[_0x2b96('0xb')]=function(_0xaba658,_0x24879e){logger['error'](_0xaba658,util[_0x2b96('0x9')](_0x24879e,{'showHidden':![],'depth':null}));};exports[_0x2b96('0xc')]=function(_0x21e58a){return function(_0xd6d39b){logger[_0x2b96('0xa')](_0x21e58a,util['inspect'](_0xd6d39b,{'showHidden':![],'depth':null}));};};exports[_0x2b96('0xd')]=function(_0x2e71c6,_0x6149ba,_0x53930a){return{'message':_0x2e71c6,'unlock':_0x6149ba,'active':_0x53930a};};exports[_0x2b96('0xe')]=function(_0x622a03,_0x645ab8,_0x3dee49){if(!_['isUndefined'](_0x3dee49)&&_0x2b96('0xf')===typeof _0x3dee49&&!_[_0x2b96('0x10')](_0x3dee49)){if(!_[_0x2b96('0x11')](_0x645ab8)&&_0x2b96('0xf')===typeof _0x645ab8&&!_['isEmpty'](_0x645ab8)){return util[_0x2b96('0x12')](_0x2b96('0x13'),_0x645ab8,_0x3dee49);}return util[_0x2b96('0x12')]('\x22%s\x22\x20<%s>',_0x3dee49,_0x3dee49);}if(!_[_0x2b96('0x11')](_0x622a03)&&'string'===typeof _0x622a03&&!_[_0x2b96('0x10')](_0x622a03)){return _0x622a03;}return _0x2b96('0x14');};exports['isActive']=function(_0x470e17){if(_[_0x2b96('0x15')](_0x470e17)){return![];}return _0x470e17;};exports[_0x2b96('0x16')]=function(_0x290c08,_0x40112f,_0x589167,_0x835faa,_0x48903a,_0x37ae2e){var _0x1da653={'XMD-QUEUE':_0x40112f[_0x2b96('0x17')]?_0x40112f['Queue'][_0x2b96('0x18')]:'','XMD-CALLERID':_0x835faa,'XMD-CALLERID-PREVIEW':_0x37ae2e?util['format'](_0x2b96('0x13'),_0x37ae2e[_0x2b96('0x19')],_0x37ae2e[_0x2b96('0x1a')]):_0x835faa,'XMD-DIALID':_0x48903a,'XMD-CONTACTID':_0x40112f[_0x2b96('0x1b')],'XMD-CDRTYPE':_0x2b96('0x1c'),'CALLERID(all)':_0x835faa,'XMD-VOICEQUEUEID':_0x40112f[_0x2b96('0x1d')],'XMD-DIALCHANNEL':_0x589167,'XMD-DIALTIMEOUT':_0x290c08[_0x2b96('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x2b96('0x12')](_0x2b96('0x1f'),_0x290c08[_0x2b96('0x20')]?'g':'',_['isEmpty'](_0x290c08[_0x2b96('0x21')])?'':_0x2b96('0x22')),'XMD-DIALURL':_0x290c08['dialPreviewUrl']||'','XMD-AGI':_0x290c08[_0x2b96('0x23')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x290c08[_0x2b96('0x23')]):_0x2b96('0x24'),'XMD-AGIAFTER':_0x290c08[_0x2b96('0x20')]?util[_0x2b96('0x12')](_0x2b96('0x25'),ipAgi,_0x290c08[_0x2b96('0x20')]):_0x2b96('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x37ae2e?_0x37ae2e[_0x2b96('0x26')]:'','XMD-ORIGINATECALLERIDNAME':_0x37ae2e?_0x37ae2e[_0x2b96('0x27')]:'','XMD-DESTINATION':_0x2b96('0x28'),'SIPADDHEADER':_0x2b96('0x29')};if(!_['isEmpty'](_0x290c08['monitor_format'])){_0x1da653[util[_0x2b96('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x290c08[_0x2b96('0x21')];_0x1da653[util[_0x2b96('0x12')]('%s',_0x2b96('0x2a'))]=_0x48903a;}if(_0x40112f&&_0x40112f[_0x2b96('0x2b')]){for(var _0x2ba504 in _0x40112f[_0x2b96('0x2b')]){if(_0x40112f['Contact'][_0x2b96('0x2c')](_0x2ba504)){if(!_['isNil'](_0x40112f[_0x2b96('0x2b')][_0x2ba504])&&_0x2ba504!=='id'&&_0x2ba504!==_0x2b96('0x2d')&&_0x2ba504!==_0x2b96('0x2e')&&_0x2ba504!=='updatedAt'){_0x1da653[util[_0x2b96('0x12')](_0x2b96('0x2f'),_0x2b96('0x30'),_[_0x2b96('0x31')](_0x2ba504))]=_0x40112f['Contact'][_0x2ba504];}}}}return _0x1da653;};exports[_0x2b96('0x32')]=function(_0x3a3689){var _0xd6bfd7={};for(var _0x47e023 in _0x3a3689){if(_0x3a3689['hasOwnProperty'](_0x47e023)){_0xd6bfd7[util[_0x2b96('0x12')]('%s',_[_0x2b96('0x33')](_0x47e023))]=_0x3a3689[_0x47e023];}}return{'variables':_0xd6bfd7};};exports[_0x2b96('0x34')]=function(_0x461131,_0x1d1892){if(!_[_0x2b96('0x15')](_0x461131)){if(_0x461131[_0x2b96('0x2c')]('originated')){if(_0x461131[_0x2b96('0x35')]>0x0){_0x461131[_0x2b96('0x35')]-=0x1;}else{logger[_0x2b96('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1d1892);}}}else{logger[_0x2b96('0x8')](_0x2b96('0x36'),_0x1d1892);}};exports[_0x2b96('0x37')]=function(_0x3dd1c7){var _0x508981=moment()[_0x2b96('0x12')](_0x2b96('0x38'));_0x3dd1c7['state']=0xd;_0x3dd1c7[_0x2b96('0x39')]=_0x2b96('0x3a');_0x3dd1c7['starttime']=_0x508981;_0x3dd1c7['responsetime']=_0x508981;_0x3dd1c7['endtime']=_0x508981;};exports['logAgent']=function(_0x150705,_0x5dc1ad,_0x3fea4c){var _0x21d6d7=moment()[_0x2b96('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x150705[_0x2b96('0x3b')]=_0x5dc1ad;_0x150705[_0x2b96('0x39')]=_0x3fea4c;_0x150705[_0x2b96('0x3c')]=_0x21d6d7;_0x150705['ringtime']=getSeconds(_0x150705[_0x2b96('0x3c')],_0x150705[_0x2b96('0x3d')]);};exports[_0x2b96('0x3e')]=function(_0x31ae68,_0x5bf656,_0xe96128){_0x31ae68[_0x2b96('0x3f')]=_0x5bf656;_0x31ae68[_0x2b96('0x40')]=_0xe96128;};exports[_0x2b96('0x41')]=function(_0x74f7f2,_0x39318f,_0x4e7b53){var _0x2b6dd5=moment()[_0x2b96('0x12')](_0x2b96('0x38'));_0x74f7f2[_0x2b96('0x3b')]=_0x39318f;_0x74f7f2[_0x2b96('0x39')]=_0x4e7b53;_0x74f7f2[_0x2b96('0x3c')]=_0x74f7f2[_0x2b96('0x3c')]?_0x74f7f2['responsetime']:_0x2b6dd5;_0x74f7f2[_0x2b96('0x42')]=_0x74f7f2[_0x2b96('0x42')]?_0x74f7f2[_0x2b96('0x42')]:_0x2b6dd5;_0x74f7f2[_0x2b96('0x43')]=getSeconds(_0x74f7f2['responsetime']||0x0,_0x74f7f2[_0x2b96('0x3d')]||0x0);_0x74f7f2['talktime']=_0x74f7f2[_0x2b96('0x44')]?getSeconds(_0x74f7f2[_0x2b96('0x42')],_0x74f7f2[_0x2b96('0x44')]):0x0;};exports[_0x2b96('0x45')]=function(_0x2b9010){return _0x2b9010===_0x2b96('0x46');};exports[_0x2b96('0x47')]=function(_0x5f2307,_0xc9dc3c,_0x5f148d,_0x3ad3af,_0x332ba1){var _0x1c1ed1=_0x3ad3af?_0x2b96('0x48'):_0x5f2307[_0x2b96('0x19')];_0x1c1ed1=_0x332ba1?_0x2b96('0x49'):_0x1c1ed1;return{'actionid':_0x5f2307[_0x2b96('0x4a')],'action':_0x2b96('0x4b'),'channel':_0x5f2307[_0x2b96('0x4c')],'callerid':util[_0x2b96('0x12')](_0x2b96('0x13'),_0x1c1ed1,_0x5f2307[_0x2b96('0x1a')]),'Exten':_0x2b96('0x28'),'Context':_0x2b96('0x4d'),'Priority':'1','variable':_0x5f148d,'timeout':(_0xc9dc3c['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5f2307[_0x2b96('0x4a')]};};exports[_0x2b96('0x4e')]=function(_0xae3100){return _0xae3100[_0x2b96('0x4f')]+_0xae3100[_0x2b96('0x50')]+_0xae3100['countnoanswerretry']+_0xae3100['countagentrejectretry']+_0xae3100[_0x2b96('0x51')];};exports['cloneAction']=function(_0x21998e){var _0x13c792=_[_0x2b96('0x52')](_0x21998e);_0x13c792['state']=0xf;_0x13c792[_0x2b96('0x39')]=_0x2b96('0x53');return _0x13c792;};exports[_0x2b96('0x54')]=function(_0x560ab2,_0x518864,_0x16a225){var _0x3b9975={};_0x3b9975[_0x518864]=_0x560ab2[_0x518864];_0x3b9975[_0x2b96('0x55')]=![];_0x3b9975['scheduledat']=moment()[_0x2b96('0x56')](_0x16a225,_0x2b96('0x57'))[_0x2b96('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b9975[_0x2b96('0x1b')]=_0x560ab2[_0x2b96('0x1b')];_0x3b9975[_0x2b96('0x58')]=_0x560ab2[_0x2b96('0x58')];_0x3b9975[_0x2b96('0x1d')]=_0x560ab2[_0x2b96('0x1d')]||undefined;return _0x3b9975;};exports[_0x2b96('0x59')]=function(_0x1de84d,_0x29a08f){if(!_[_0x2b96('0x15')](_0x1de84d)){if(_0x1de84d[_0x2b96('0x5a')]>0x0){_0x1de84d[_0x2b96('0x5a')]-=0x1;}else{logger[_0x2b96('0x8')](_0x29a08f,_0x2b96('0x5b'));}}else{logger['error'](_0x29a08f,_0x2b96('0x5c'));}};exports[_0x2b96('0x5d')]=function(_0x4c06c1){if(_0x4c06c1<=0x0){return!![];}return![];};function buildObj(_0x9f9e22,_0x2a1e73,_0x4ff691){_0x9f9e22[_0x2b96('0x5e')]=_0x2a1e73;_0x9f9e22[_0x2b96('0x18')]=_0x9f9e22[_0x2b96('0x5f')];_0x9f9e22[_0x2b96('0x60')]=_0x9f9e22[_0x2b96('0x4c')];_0x9f9e22[_0x2b96('0x61')]='voice';if(_0x4ff691){_0x9f9e22[_0x2b96('0x62')]=_0x4ff691[_0x2b96('0x62')];}return _0x9f9e22;}exports[_0x2b96('0x63')]=buildObj;exports[_0x2b96('0x64')]=function(_0x382f44){var _0x4d3529={};_0x4d3529[_0x2b96('0x5f')]=_0x382f44[_0x2b96('0x5f')];_0x4d3529[_0x2b96('0x60')]=_0x382f44[_0x2b96('0x4c')];_0x4d3529['uniqueid']=_0x382f44[_0x2b96('0x4a')];return _0x4d3529;};exports[_0x2b96('0x65')]=function(_0x27684f){var _0x3a5b71=[];for(var _0x2d6823 in _0x27684f){if(_0x27684f[_0x2b96('0x2c')](_0x2d6823)){if(!_['isNil'](_0x27684f[_0x2d6823])&&_0x27684f[_0x2d6823]['state']===_0x2b96('0x66')&&_0x27684f[_0x2d6823][_0x2b96('0x67')]==='reachable'){_0x3a5b71[_0x2b96('0x68')](_0x27684f[_0x2d6823]['id']);}}}return _0x3a5b71;};exports[_0x2b96('0x69')]=function(_0x830f88){var _0xd690ca=moment()['milliseconds'](0x0);var _0x319c1b=moment(_0x830f88)[_0x2b96('0x5')](0x0);return _0xd690ca[_0x2b96('0x6a')](_0x319c1b,_0x2b96('0x6'));};exports[_0x2b96('0x6b')]=function(_0x3b7d86){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3b7d86[_0x2b96('0x1b')],'ListId':_0x3b7d86[_0x2b96('0x58')],'VoiceQueueId':_0x3b7d86['VoiceQueueId']||undefined,'CampaignId':_0x3b7d86['CampaignId']||undefined};};exports[_0x2b96('0x6c')]=function(_0x2b055c){if(_0x2b055c==='uniqueid'||_0x2b055c===_0x2b96('0x6d')||_0x2b055c===_0x2b96('0x5f')||_0x2b055c===_0x2b96('0x6e')||_0x2b055c===_0x2b96('0x6f')||_0x2b055c===_0x2b96('0x70')||_0x2b055c===_0x2b96('0x3f')||_0x2b055c===_0x2b96('0x4c')||_0x2b055c==='calleridname'||_0x2b055c===_0x2b96('0x55')||_0x2b055c===_0x2b96('0x1a')||_0x2b055c==='scheduledat'||_0x2b055c===_0x2b96('0x4f')||_0x2b055c===_0x2b96('0x50')||_0x2b055c===_0x2b96('0x71')||_0x2b055c===_0x2b96('0x72')||_0x2b055c==='callback'||_0x2b055c===_0x2b96('0x73')||_0x2b055c==='callbackat'||_0x2b055c===_0x2b96('0x74')||_0x2b055c===_0x2b96('0x1b')||_0x2b055c===_0x2b96('0x58')||_0x2b055c===_0x2b96('0x40')||_0x2b055c===_0x2b96('0x1d')||_0x2b055c===_0x2b96('0x75')||_0x2b055c===_0x2b96('0x76')||_0x2b055c===_0x2b96('0x77')||_0x2b055c===_0x2b96('0x78')||_0x2b055c===_0x2b96('0x79')||_0x2b055c===_0x2b96('0x7a')||_0x2b055c===_0x2b96('0x7b')||_0x2b055c===_0x2b96('0x7c')||_0x2b055c===_0x2b96('0x7d')||_0x2b055c===_0x2b96('0x7e')||_0x2b055c===_0x2b96('0x7f')||_0x2b055c===_0x2b96('0x80')||_0x2b055c===_0x2b96('0x81')||_0x2b055c==='xmd-agiafter'||_0x2b055c===_0x2b96('0x82')||_0x2b055c===_0x2b96('0x83')||_0x2b055c===_0x2b96('0x84')||_0x2b055c==='rtpaudioqosjitter'||_0x2b055c===_0x2b96('0x85')||_0x2b055c===_0x2b96('0x86')||_0x2b055c===_0x2b96('0x87')||_0x2b055c===_0x2b96('0x88')||_0x2b055c===_0x2b96('0x89')||_0x2b055c===_0x2b96('0x83')||_0x2b055c===_0x2b96('0x84')||_0x2b055c===_0x2b96('0x8a')||_0x2b055c===_0x2b96('0x85')||_0x2b055c===_0x2b96('0x86')||_0x2b055c===_0x2b96('0x87')||_0x2b055c==='rtpaudioqosrtt'||_0x2b055c===_0x2b96('0x89')||_0x2b055c===_0x2b96('0x8b')||_0x2b055c===_0x2b96('0x8c')||_0x2b055c==='state'||_0x2b055c===_0x2b96('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4c5a82,_0x3d36b2){var _0x2a07a2,_0x3bf4c7,_0x251c75;if(_0x3d36b2<=0x0){_0x3d36b2=0x1;}_0x2a07a2=new RegExp(_0x2b96('0x8d')+_0x3d36b2+'}$');_0x3bf4c7=Math[_0x2b96('0x8e')](0xa,_0x3d36b2-0x1);_0x251c75=Math[_0x2b96('0x8e')](0xa,_0x3d36b2)-0x1;return util['format']('%s',_[_0x2b96('0x8f')](_0x4c5a82,_0x2a07a2,_[_0x2b96('0x90')](_0x3bf4c7,_0x251c75)));};exports[_0x2b96('0x91')]=function(_0x3d2e5a){var _0x3a250e=_0x3d2e5a[_0x2b96('0x92')](/"(.*?)"/);return _0x3a250e?_0x3a250e[0x1]:_0x3d2e5a;};exports[_0x2b96('0x93')]=function(_0x335bf1){var _0x5d8796=_0x335bf1['match'](/<(.*?)>/);return _0x5d8796?_0x5d8796[0x1]:_0x335bf1;};function buildNoAnswerEventPayload(_0x41928d,_0x8c453){var _0x524034=buildObj(_0x41928d,'noanswer');if(!_[_0x2b96('0x10')](_0x8c453[_0x2b96('0x94')])){Object[_0x2b96('0x95')](_0x8c453[_0x2b96('0x94')])[_0x2b96('0x96')](function(_0x590966){_0x524034[_0x590966[_0x2b96('0x97')]()]=_0x8c453[_0x2b96('0x94')][_0x590966];});}return _0x524034;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 7dd6e01..ec350da 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 _0x659e=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','reload','voicequeuechannel'];(function(_0x3b5961,_0x599485){var _0x3a68b9=function(_0x3586ec){while(--_0x3586ec){_0x3b5961['push'](_0x3b5961['shift']());}};_0x3a68b9(++_0x599485);}(_0x659e,0x12c));var _0xe659=function(_0x42af7f,_0x3b8a6c){_0x42af7f=_0x42af7f-0x0;var _0x75303d=_0x659e[_0x42af7f];return _0x75303d;};'use strict';exports[_0xe659('0x0')]={'queue':{'type':_0xe659('0x1'),'required':!![]},'interface':{'type':_0xe659('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xe659('0x2'),'required':![]}};exports[_0xe659('0x3')]={'queue':{'type':_0xe659('0x1'),'required':!![]},'interface':{'type':_0xe659('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xe659('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':_0xe659('0x1'),'required':![]}};exports[_0xe659('0x4')]={'module':{'type':'string','required':![]}};exports[_0xe659('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe659('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xe659('0x1')},'format':{'type':_0xe659('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xe659('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xe659('0x8')]={'uniqueid':{'type':_0xe659('0x1'),'required':!![]},'exten':{'type':_0xe659('0x1'),'required':!![]},'context':{'type':_0xe659('0x1')}}; \ No newline at end of file +var _0x7d1a=['voicechannel','voicequeuechannelhangup','string','number','boolean','queuepause','reload'];(function(_0x3353e9,_0x17e164){var _0x9067b9=function(_0x3f6cf1){while(--_0x3f6cf1){_0x3353e9['push'](_0x3353e9['shift']());}};_0x9067b9(++_0x17e164);}(_0x7d1a,0x144));var _0xa7d1=function(_0x282020,_0x594db5){_0x282020=_0x282020-0x0;var _0x27561e=_0x7d1a[_0x282020];return _0x27561e;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xa7d1('0x0'),'required':!![]},'membername':{'type':_0xa7d1('0x0'),'required':!![]},'penalty':{'type':_0xa7d1('0x1'),'required':![]},'paused':{'type':_0xa7d1('0x2'),'required':![]}};exports['queueremove']={'queue':{'type':_0xa7d1('0x0'),'required':!![]},'interface':{'type':_0xa7d1('0x0'),'required':!![]}};exports[_0xa7d1('0x3')]={'interface':{'type':_0xa7d1('0x0'),'required':!![]},'paused':{'type':_0xa7d1('0x2')},'reason':{'type':_0xa7d1('0x0'),'required':![]}};exports[_0xa7d1('0x4')]={'module':{'type':_0xa7d1('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xa7d1('0x0'),'required':!![]}};exports[_0xa7d1('0x5')]={'uniqueid':{'type':_0xa7d1('0x0'),'required':!![]},'filename':{'type':_0xa7d1('0x0')},'format':{'type':_0xa7d1('0x0')},'mixmonitorid':{'type':_0xa7d1('0x0')}};exports[_0xa7d1('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xa7d1('0x0'),'required':!![]},'context':{'type':_0xa7d1('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index d8fadff..fbe88ec 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 _0x3b90=['../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','telephones','trunks','voiceQueues','triggers','templates','outbound','channels','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','name','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundAnswerCallsDay','queueStatusComplete','initAgents','agents','length','isNil','isUndefined','prototype','initTelephones','mergeFromDatabase','initTrunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initFreshsalesAccounts','merge','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','duration','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','lodash','moment','../model/agent','../model/telephone'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x3b90,0x143));var _0x03b9=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x3b90[_0x50aa2e];return _0x5e07f0;};'use strict';var util=require('util');var _=require(_0x03b9('0x0'));var moment=require(_0x03b9('0x1'));var Agent=require(_0x03b9('0x2'));var Telephone=require(_0x03b9('0x3'));var Trunk=require(_0x03b9('0x4'));var VoiceQueue=require(_0x03b9('0x5'));var Trigger=require(_0x03b9('0x6'));var Template=require(_0x03b9('0x7'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0x03b9('0x8'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x03b9('0x9'));var FreshdeskAccount=require(_0x03b9('0xa'));var SugarcrmAccount=require(_0x03b9('0xb'));var ZohoAccount=require(_0x03b9('0xc'));var DeskAccount=require(_0x03b9('0xd'));var VtigerAccount=require(_0x03b9('0xe'));var ServicenowAccount=require(_0x03b9('0xf'));var Dynamics365Account=require(_0x03b9('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this['agents']={};this[_0x03b9('0x11')]={};this[_0x03b9('0x12')]={};this[_0x03b9('0x13')]={};this[_0x03b9('0x14')]={};this['campaigns']={};this[_0x03b9('0x15')]={};this[_0x03b9('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x03b9('0x17')]={};this[_0x03b9('0x18')]={};this[_0x03b9('0x19')]={};this[_0x03b9('0x1a')]={};this[_0x03b9('0x1b')]={};this[_0x03b9('0x1c')]={};this['salesforceAccounts']={};this[_0x03b9('0x1d')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x03b9('0x1e')]={};this[_0x03b9('0x1f')]={};this[_0x03b9('0x20')]={};this[_0x03b9('0x21')]={};this[_0x03b9('0x22')]={};this[_0x03b9('0x23')]={};};function freeIsNotKey(_0x43ee7e,_0x1d2f67,_0x4c1b0b){var _0x327f8e=_['mapKeys'](_0x43ee7e,function(_0x5dc485,_0x5a6e78){return _0x5dc485[_0x4c1b0b];});for(var _0x3852c8 in _0x1d2f67){if(_0x1d2f67[_0x03b9('0x24')](_0x3852c8)){if(!_0x327f8e[_0x3852c8]){delete _0x1d2f67[_0x3852c8];}}}}function freeIsNotKeySip(_0x3b9baf,_0x14e9de){var _0x10cfe4=_[_0x03b9('0x25')](_0x3b9baf,function(_0x29a26c,_0x408edc){return util[_0x03b9('0x26')]('SIP/%s',_0x29a26c[_0x03b9('0x27')]);});for(var _0x362216 in _0x14e9de){if(_0x14e9de[_0x03b9('0x24')](_0x362216)){if(!_0x10cfe4[_0x362216]){delete _0x14e9de[_0x362216];}}}}function freeIsNotKeyAgent(_0x47bb9d,_0x2609f3){var _0xc9bba7=_[_0x03b9('0x25')](_0x47bb9d,function(_0x13443f,_0x5b6700){var _0x1e7990=_['isNil'](_0x13443f[_0x03b9('0x28')])?util[_0x03b9('0x26')](_0x03b9('0x29'),_0x13443f['name']):_0x13443f[_0x03b9('0x28')];return _0x1e7990;});for(var _0x1d0770 in _0x2609f3){if(_0x2609f3[_0x03b9('0x24')](_0x1d0770)){if(!_0xc9bba7[_0x1d0770]){delete _0x2609f3[_0x1d0770];}}}}function clearVoiceCallReports(_0x18f43e){_0x18f43e[_0x03b9('0x2a')]=0x0;_0x18f43e[_0x03b9('0x2b')]=0x0;_0x18f43e[_0x03b9('0x2c')]=0x0;_0x18f43e[_0x03b9('0x2d')]=0x0;_0x18f43e[_0x03b9('0x2e')]=0x0;}function clearCampaigns(_0x191abc){if(!_[_0x03b9('0x2f')](_0x191abc)){for(var _0x54e539 in _0x191abc){if(_0x191abc['hasOwnProperty'](_0x54e539)){_0x191abc[_0x54e539]['ivrTotalCallsDays']=0x0;_0x191abc[_0x54e539][_0x03b9('0x30')]=0x0;}}}}function clearVoiceQueues(_0x4cbc6d){if(!_['isEmpty'](_0x4cbc6d)){for(var _0x888193 in _0x4cbc6d){if(_0x4cbc6d['hasOwnProperty'](_0x888193)){_0x4cbc6d[_0x888193][_0x03b9('0x2a')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2b')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x31')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x32')]=0x0;_0x4cbc6d[_0x888193]['sumHoldTime']=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2d')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x2e')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x33')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x34')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x35')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x36')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x37')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x38')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x39')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3a')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3b')]=0x0;_0x4cbc6d[_0x888193]['outboundOriginateFailureCallsDay']=0x0;_0x4cbc6d[_0x888193]['outboundRejectCallsDay']=0x0;_0x4cbc6d[_0x888193]['outboundReCallsDay']=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x33')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3c')]=0x0;_0x4cbc6d[_0x888193][_0x03b9('0x3d')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x5a9ed0,_0xc116bc){for(var _0x3026ce in _0xc116bc){if(_0x5a9ed0[_0x03b9('0x24')](_0x3026ce)){_0x5a9ed0[_0x3026ce]=_0xc116bc[_0x3026ce];}}};Realtime['prototype'][_0x03b9('0x3e')]=function(){var _0x43b8f0=this;return function(_0x384298){if(_0x384298){freeIsNotKeyAgent(_0x384298,_0x43b8f0[_0x03b9('0x3f')]);for(var _0x474650=0x0,_0x125f81={},_0x8352a9={};_0x474650<_0x384298[_0x03b9('0x40')];_0x474650+=0x1){_0x125f81=_0x384298[_0x474650];var _0x6362c0=_[_0x03b9('0x41')](_0x125f81['interface'])?util['format'](_0x03b9('0x29'),_0x125f81[_0x03b9('0x27')]):_0x125f81[_0x03b9('0x28')];if(_[_0x03b9('0x42')](_0x43b8f0[_0x03b9('0x3f')][_0x6362c0])){_0x43b8f0[_0x03b9('0x3f')][_0x6362c0]=new Agent(_0x125f81);}else{_0x43b8f0['mergeFromDatabase'](_0x43b8f0[_0x03b9('0x3f')][_0x6362c0],_0x125f81);}}}return _0x43b8f0['agents'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x44')]=function(){var _0x41e40a=this;return function(_0x249dce){if(_0x249dce){freeIsNotKeySip(_0x249dce,_0x41e40a['telephones']);for(var _0x3d2f3a=0x0,_0x508649={},_0x216ea3={};_0x3d2f3a<_0x249dce['length'];_0x3d2f3a+=0x1){_0x508649=_0x249dce[_0x3d2f3a];if(_['isUndefined'](_0x41e40a[_0x03b9('0x11')][util['format'](_0x03b9('0x29'),_0x508649['name'])])){_0x41e40a[_0x03b9('0x11')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x508649[_0x03b9('0x27')])]=new Telephone(_0x508649);}else{_0x41e40a[_0x03b9('0x45')](_0x41e40a['telephones'][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x508649[_0x03b9('0x27')])],_0x508649);}}}return _0x41e40a[_0x03b9('0x11')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x46')]=function(){var _0x281a75=this;return function(_0x1c9dac){if(_0x1c9dac){freeIsNotKeySip(_0x1c9dac,_0x281a75[_0x03b9('0x12')]);for(var _0x3dc782=0x0,_0x4c6cd7={},_0x58ceab={};_0x3dc782<_0x1c9dac[_0x03b9('0x40')];_0x3dc782+=0x1){_0x4c6cd7=_0x1c9dac[_0x3dc782];if(_[_0x03b9('0x42')](_0x281a75['trunks'][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7[_0x03b9('0x27')])])){_0x281a75[_0x03b9('0x12')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7['name'])]=new Trunk(_0x4c6cd7);}else{_0x281a75[_0x03b9('0x45')](_0x281a75[_0x03b9('0x12')][util[_0x03b9('0x26')](_0x03b9('0x29'),_0x4c6cd7['name'])],_0x4c6cd7);}}}return _0x281a75['trunks'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x47')]=function(){var _0x2746c7=this;return function(_0x2cc15b){if(_0x2cc15b){freeIsNotKey(_0x2cc15b,_0x2746c7[_0x03b9('0x13')],_0x03b9('0x27'));for(var _0x1dd123=0x0,_0x44dbb7={},_0x29001d={};_0x1dd123<_0x2cc15b[_0x03b9('0x40')];_0x1dd123+=0x1){_0x44dbb7=_0x2cc15b[_0x1dd123];if(_[_0x03b9('0x42')](_0x2746c7[_0x03b9('0x13')][_0x44dbb7['name']])){_0x2746c7[_0x03b9('0x13')][_0x44dbb7[_0x03b9('0x27')]]=new VoiceQueue(_0x44dbb7);}else{_0x2746c7[_0x03b9('0x45')](_0x2746c7[_0x03b9('0x13')][_0x44dbb7['name']],_0x44dbb7);}}}return _0x2746c7[_0x03b9('0x13')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x48')]=function(){var _0x38f550=this;return function(_0x16b05c){if(_0x16b05c){freeIsNotKey(_0x16b05c,_0x38f550[_0x03b9('0x14')],'id');for(var _0x1e7e56=0x0,_0x4183ac={},_0x51b508={};_0x1e7e56<_0x16b05c['length'];_0x1e7e56+=0x1){_0x4183ac=_0x16b05c[_0x1e7e56];if(_[_0x03b9('0x42')](_0x38f550[_0x03b9('0x14')][_0x4183ac['id']])){_0x38f550[_0x03b9('0x14')][_0x4183ac['id']]=new Trigger(_0x4183ac);}else{_0x38f550[_0x03b9('0x45')](_0x38f550[_0x03b9('0x14')][_0x4183ac['id']],_0x4183ac);}}}return _0x38f550[_0x03b9('0x14')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x49')]=function(){var _0x381926=this;return function(_0xdfcc87){if(_0xdfcc87){freeIsNotKey(_0xdfcc87,_0x381926[_0x03b9('0x15')],'id');for(var _0x862904=0x0,_0x472a0b={},_0x4c99c8={};_0x862904<_0xdfcc87[_0x03b9('0x40')];_0x862904+=0x1){_0x472a0b=_0xdfcc87[_0x862904];if(_[_0x03b9('0x42')](_0x381926[_0x03b9('0x15')][_0x472a0b['id']])){_0x381926['templates'][_0x472a0b['id']]=new Template(_0x472a0b);}else{_0x381926[_0x03b9('0x45')](_0x381926[_0x03b9('0x15')][_0x472a0b['id']],_0x472a0b);}}}return _0x381926[_0x03b9('0x15')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4a')]=function(){var _0x48972f=this;return function(_0x45b930){if(_0x45b930){freeIsNotKey(_0x45b930,_0x48972f['zendeskAccounts'],'id');for(var _0x402760=0x0,_0x424303={},_0x4fdedc={};_0x402760<_0x45b930['length'];_0x402760+=0x1){_0x424303=_0x45b930[_0x402760];if(_[_0x03b9('0x42')](_0x48972f[_0x03b9('0x1c')][_0x424303['id']])){_0x48972f[_0x03b9('0x1c')][_0x424303['id']]=new ZendeskAccount(_0x424303);}else{_0x48972f[_0x03b9('0x45')](_0x48972f[_0x03b9('0x1c')][_0x424303['id']],_0x424303);}}}return _0x48972f[_0x03b9('0x1c')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4b')]=function(){var _0x6e04c5=this;return function(_0x3dcce5){if(_0x3dcce5){freeIsNotKey(_0x3dcce5,_0x6e04c5['salesforceAccounts'],'id');for(var _0x16e295=0x0,_0x2b9186={},_0x5c10b6={};_0x16e295<_0x3dcce5[_0x03b9('0x40')];_0x16e295+=0x1){_0x2b9186=_0x3dcce5[_0x16e295];if(_[_0x03b9('0x42')](_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']])){_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']]=new SalesforceAccount(_0x2b9186);}else{_0x6e04c5['mergeFromDatabase'](_0x6e04c5[_0x03b9('0x4c')][_0x2b9186['id']],_0x2b9186);}}}return _0x6e04c5[_0x03b9('0x4c')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4d')]=function(){var _0x55b242=this;return function(_0x30621e){if(_0x30621e){freeIsNotKey(_0x30621e,_0x55b242[_0x03b9('0x4e')],'id');for(var _0x264166=0x0,_0xd48f8d={},_0x410a33={};_0x264166<_0x30621e['length'];_0x264166+=0x1){_0xd48f8d=_0x30621e[_0x264166];if(_['isUndefined'](_0x55b242[_0x03b9('0x4e')][_0xd48f8d['id']])){_0x55b242['freshdeskAccounts'][_0xd48f8d['id']]=new FreshdeskAccount(_0xd48f8d);}else{_0x55b242[_0x03b9('0x45')](_0x55b242['freshdeskAccounts'][_0xd48f8d['id']],_0xd48f8d);}}}return _0x55b242[_0x03b9('0x4e')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x4f')]=function(){var _0x30aebe=this;return function(_0x2c93c8){if(_0x2c93c8){freeIsNotKey(_0x2c93c8,_0x30aebe[_0x03b9('0x50')],'id');for(var _0x5ba8b4=0x0,_0x2379cd={},_0x586273={};_0x5ba8b4<_0x2c93c8['length'];_0x5ba8b4+=0x1){_0x2379cd=_0x2c93c8[_0x5ba8b4];if(_[_0x03b9('0x42')](_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']])){_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']]=new ZohoAccount(_0x2379cd);}else{_0x30aebe[_0x03b9('0x45')](_0x30aebe[_0x03b9('0x50')][_0x2379cd['id']],_0x2379cd);}}}return _0x30aebe['zohoAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x51')]=function(){var _0x1e5010=this;return function(_0x32c226){if(_0x32c226){freeIsNotKey(_0x32c226,_0x1e5010[_0x03b9('0x1e')],'id');for(var _0x3c4f99=0x0,_0x49fb69={},_0x315c88={};_0x3c4f99<_0x32c226[_0x03b9('0x40')];_0x3c4f99+=0x1){_0x49fb69=_0x32c226[_0x3c4f99];if(_[_0x03b9('0x42')](_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']])){_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']]=new DeskAccount(_0x49fb69);}else{_0x1e5010[_0x03b9('0x45')](_0x1e5010[_0x03b9('0x1e')][_0x49fb69['id']],_0x49fb69);}}}return _0x1e5010['deskAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x52')]=function(){var _0xc2c677=this;return function(_0x2a0a48){if(_0x2a0a48){freeIsNotKey(_0x2a0a48,_0xc2c677[_0x03b9('0x1d')],'id');for(var _0x153f51=0x0,_0x1ef413={},_0x5cc134={};_0x153f51<_0x2a0a48[_0x03b9('0x40')];_0x153f51+=0x1){_0x1ef413=_0x2a0a48[_0x153f51];if(_[_0x03b9('0x42')](_0xc2c677['sugarcrmAccounts'][_0x1ef413['id']])){_0xc2c677[_0x03b9('0x1d')][_0x1ef413['id']]=new SugarcrmAccount(_0x1ef413);}else{_0xc2c677[_0x03b9('0x45')](_0xc2c677['sugarcrmAccounts'][_0x1ef413['id']],_0x1ef413);}}}return _0xc2c677[_0x03b9('0x1d')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x53')]=function(){var _0x19fd75=this;return function(_0x2901a8){if(_0x2901a8){freeIsNotKey(_0x2901a8,_0x19fd75[_0x03b9('0x1f')],'id');for(var _0x5ce503=0x0,_0x4a6b80={},_0x5cb50d={};_0x5ce503<_0x2901a8['length'];_0x5ce503+=0x1){_0x4a6b80=_0x2901a8[_0x5ce503];if(_[_0x03b9('0x42')](_0x19fd75[_0x03b9('0x1f')][_0x4a6b80['id']])){_0x19fd75['vtigerAccounts'][_0x4a6b80['id']]=new VtigerAccount(_0x4a6b80);}else{_0x19fd75[_0x03b9('0x45')](_0x19fd75[_0x03b9('0x1f')][_0x4a6b80['id']],_0x4a6b80);}}}return _0x19fd75[_0x03b9('0x1f')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5d1e5b=this;return function(_0x44ae2e){if(_0x44ae2e){freeIsNotKey(_0x44ae2e,_0x5d1e5b[_0x03b9('0x20')],'id');for(var _0x5efef0=0x0,_0x2c1727={},_0x3a0063={};_0x5efef0<_0x44ae2e[_0x03b9('0x40')];_0x5efef0+=0x1){_0x2c1727=_0x44ae2e[_0x5efef0];if(_['isUndefined'](_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']])){_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']]=new ServicenowAccount(_0x2c1727);}else{_0x5d1e5b[_0x03b9('0x45')](_0x5d1e5b[_0x03b9('0x20')][_0x2c1727['id']],_0x2c1727);}}}return _0x5d1e5b['servicenowAccounts'];};};Realtime[_0x03b9('0x43')][_0x03b9('0x54')]=function(){var _0x6a0a05=this;return function(_0x41814f){if(_0x41814f){freeIsNotKey(_0x41814f,_0x6a0a05[_0x03b9('0x21')],'id');for(var _0x842b9=0x0,_0x5a051d={},_0x19c5a0={};_0x842b9<_0x41814f[_0x03b9('0x40')];_0x842b9+=0x1){_0x5a051d=_0x41814f[_0x842b9];if(_['isUndefined'](_0x6a0a05['dynamics365Accounts'][_0x5a051d['id']])){_0x6a0a05[_0x03b9('0x21')][_0x5a051d['id']]=new Dynamics365Account(_0x5a051d);}else{_0x6a0a05['mergeFromDatabase'](_0x6a0a05['dynamics365Accounts'][_0x5a051d['id']],_0x5a051d);}}}return _0x6a0a05[_0x03b9('0x21')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x55')]=function(){var _0x19f3c1=this;return function(_0xb3a989){if(_0xb3a989){freeIsNotKey(_0xb3a989,_0x19f3c1[_0x03b9('0x22')],'id');for(var _0x2f95c6=0x0,_0x32adf8={},_0x132993={};_0x2f95c6<_0xb3a989[_0x03b9('0x40')];_0x2f95c6+=0x1){_0x32adf8=_0xb3a989[_0x2f95c6];if(_[_0x03b9('0x42')](_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']])){_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']]=new FreshsalesAccount(_0x32adf8);}else{_0x19f3c1[_0x03b9('0x45')](_0x19f3c1[_0x03b9('0x22')][_0x32adf8['id']],_0x32adf8);}}}return _0x19f3c1[_0x03b9('0x22')];};};Realtime[_0x03b9('0x43')]['initVoiceQueueHopperHistory']=function(){var _0x536177=this;return function(_0x227122){for(var _0x587f1a=0x0;_0x587f1a<_0x227122[_0x03b9('0x40')];_0x587f1a+=0x1){_[_0x03b9('0x56')](_0x536177['voiceQueues'][_0x227122[_0x587f1a]['name']],_0x227122[_0x587f1a]);}return _0x536177[_0x03b9('0x13')];};};Realtime[_0x03b9('0x43')]['initVoiceQueueReports']=function(){var _0x17926f=this;return function(_0x1f677a){clearVoiceQueues(_0x17926f[_0x03b9('0x13')]);if(_0x1f677a){_0x1f677a=_[_0x03b9('0x57')](_0x1f677a,_0x03b9('0x58'));for(var _0x196ada in _0x1f677a){if(_0x1f677a[_0x03b9('0x24')](_0x196ada)){var _0x10aae1={};for(var _0x4e4b66=0x0;_0x4e4b66<_0x1f677a[_0x196ada][_0x03b9('0x40')];_0x4e4b66+=0x1){var _0x90b88a=_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x59')];if(_0x17926f[_0x03b9('0x13')][_0x90b88a]){if(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5a')]){_0x17926f['voiceQueues'][_0x90b88a]['unmanaged']+=0x1;}if(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5b')]){_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x32')]+=0x1;}_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2c')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5c')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5e')]),_0x03b9('0x5f'))||0x0;if(_0x4e4b66===_0x1f677a[_0x196ada][_0x03b9('0x40')]-0x1){_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2d')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x60')]||_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x61')]||_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x62')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5e')]),_0x03b9('0x5f'))||0x0;_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2a')]+=0x1;if(_0x1f677a[_0x196ada][_0x4e4b66]['queuecallercomplete']){_0x17926f['voiceQueues'][_0x90b88a][_0x03b9('0x2b')]+=0x1;_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2e')]+=moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x60')])[_0x03b9('0x5d')](moment(_0x1f677a[_0x196ada][_0x4e4b66][_0x03b9('0x5c')]),_0x03b9('0x5f'))||0x0;}}else{_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2d')]+=_0x17926f[_0x03b9('0x13')][_0x90b88a][_0x03b9('0x2c')]||0x0;}}}}}}return _0x17926f[_0x03b9('0x13')];};};Realtime['prototype'][_0x03b9('0x63')]=function(){var _0x539c85=this;return function(_0x1afd51){clearVoiceCallReports(_0x539c85[_0x03b9('0x16')]);if(_0x1afd51){for(var _0x1fd31a=0x0;_0x1fd31a<_0x1afd51[_0x03b9('0x40')];_0x1fd31a+=0x1){_0x539c85[_0x03b9('0x16')][_0x03b9('0x2a')]+=0x1;_0x539c85[_0x03b9('0x16')]['sumDuration']+=_0x1afd51[_0x1fd31a][_0x03b9('0x64')];if(_0x1afd51[_0x1fd31a]['disposition']===_0x03b9('0x65')){_0x539c85[_0x03b9('0x16')][_0x03b9('0x2b')]+=0x1;_0x539c85['outbound'][_0x03b9('0x2c')]+=_0x1afd51[_0x1fd31a][_0x03b9('0x64')]-_0x1afd51[_0x1fd31a][_0x03b9('0x66')]||0x0;_0x539c85['outbound'][_0x03b9('0x2e')]+=_0x1afd51[_0x1fd31a]['billableseconds'];}}}return _0x539c85[_0x03b9('0x16')];};};Realtime[_0x03b9('0x43')]['initCampaigns']=function(){var _0x1d1c33=this;return function(_0xde75b7){if(_0xde75b7){freeIsNotKey(_0xde75b7,_0x1d1c33[_0x03b9('0x67')],_0x03b9('0x27'));for(var _0x10d2cc=0x0,_0x46e2c2={};_0x10d2cc<_0xde75b7[_0x03b9('0x40')];_0x10d2cc+=0x1){_0x46e2c2=_0xde75b7[_0x10d2cc];if(_[_0x03b9('0x42')](_0x1d1c33[_0x03b9('0x67')][_0x46e2c2['name']])){_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]]=new Campaign(_0x46e2c2);}else{_0x1d1c33['mergeFromDatabase'](_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]],_0x46e2c2);_0x1d1c33[_0x03b9('0x67')][_0x46e2c2[_0x03b9('0x27')]][_0x03b9('0x68')]=_0x46e2c2[_0x03b9('0x69')]?_0x46e2c2[_0x03b9('0x69')][_0x03b9('0x27')]:undefined;}}}return _0x1d1c33[_0x03b9('0x67')];};};Realtime['prototype'][_0x03b9('0x6a')]=function(){var _0x57c307=this;return function(_0xc23dfc){if(_0xc23dfc){freeIsNotKey(_0xc23dfc,_0x57c307['voiceExtensions'],'id');for(var _0x338d42=0x0,_0x54d4c1={};_0x338d42<_0xc23dfc[_0x03b9('0x40')];_0x338d42+=0x1){_0x54d4c1=_0xc23dfc[_0x338d42];if(_[_0x03b9('0x42')](_0x57c307[_0x03b9('0x6b')][_0x54d4c1['id']])){_0x57c307['voiceExtensions'][_0x54d4c1['id']]=new VoiceExtension(_0x54d4c1);}else{_0x57c307['mergeFromDatabase'](_0x57c307[_0x03b9('0x6b')][_0x54d4c1['id']],_0x54d4c1);}}}return _0x57c307[_0x03b9('0x6b')];};};Realtime[_0x03b9('0x43')][_0x03b9('0x6c')]=function(){var _0x2fdc42=this;return function(_0x4301df){clearCampaigns(_0x2fdc42['campaigns']);for(var _0x4498da=0x0;_0x4498da<_0x4301df['length'];_0x4498da+=0x1){_['merge'](_0x2fdc42[_0x03b9('0x67')][_0x4301df[_0x4498da][_0x03b9('0x27')]],_0x4301df[_0x4498da]);}return _0x2fdc42[_0x03b9('0x67')];};};Realtime[_0x03b9('0x43')]['initFaxAccounts']=function(){var _0x7ea50d=this;return function(_0x49bf6c){if(_0x49bf6c){freeIsNotKey(_0x49bf6c,_0x7ea50d[_0x03b9('0x23')],'id');for(var _0x11a109=0x0,_0x1260dc={},_0x2429b6={};_0x11a109<_0x49bf6c[_0x03b9('0x40')];_0x11a109+=0x1){_0x1260dc=_0x49bf6c[_0x11a109];if(_[_0x03b9('0x42')](_0x7ea50d[_0x03b9('0x23')][_0x1260dc['id']])){_0x7ea50d['faxAccounts'][_0x1260dc['id']]=new FaxAccount(_0x1260dc);}else{_0x7ea50d[_0x03b9('0x45')](_0x7ea50d['faxAccounts'][_0x1260dc['id']],_0x1260dc);}}}return _0x7ea50d['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0x3c03=['queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initTelephones','initTrunks','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','diff','queuecallercomplete','seconds','initVoiceCallReports','duration','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','faxAccounts','exports','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','triggers','outbound','voiceExtensions','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','freshsalesAccounts','mapKeys','SIP/%s','name','hasOwnProperty','isNil','interface','format','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay'];(function(_0x29c8f5,_0x5ed0c7){var _0x208e7e=function(_0x542bbb){while(--_0x542bbb){_0x29c8f5['push'](_0x29c8f5['shift']());}};_0x208e7e(++_0x5ed0c7);}(_0x3c03,0x16d));var _0x33c0=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0x3c03[_0x1da04e];return _0xdd8c41;};'use strict';var util=require(_0x33c0('0x0'));var _=require('lodash');var moment=require('moment');var Agent=require('../model/agent');var Telephone=require(_0x33c0('0x1'));var Trunk=require(_0x33c0('0x2'));var VoiceQueue=require(_0x33c0('0x3'));var Trigger=require(_0x33c0('0x4'));var Template=require('../model/template');var Campaign=require(_0x33c0('0x5'));var VoiceExtension=require(_0x33c0('0x6'));var ZendeskAccount=require(_0x33c0('0x7'));var SalesforceAccount=require(_0x33c0('0x8'));var FreshdeskAccount=require(_0x33c0('0x9'));var SugarcrmAccount=require(_0x33c0('0xa'));var ZohoAccount=require(_0x33c0('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x33c0('0xc'));var ServicenowAccount=require(_0x33c0('0xd'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x33c0('0xe'));var FaxAccount=require(_0x33c0('0xf'));var Realtime=function(){this['agents']={};this[_0x33c0('0x10')]={};this[_0x33c0('0x11')]={};this[_0x33c0('0x12')]={};this[_0x33c0('0x13')]={};this['campaigns']={};this['templates']={};this[_0x33c0('0x14')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x33c0('0x15')]={};this['channels']={};this['queueChannels']={};this['outboundChannels']={};this[_0x33c0('0x16')]={};this[_0x33c0('0x17')]={};this[_0x33c0('0x18')]={};this[_0x33c0('0x19')]={};this[_0x33c0('0x1a')]={};this[_0x33c0('0x1b')]={};this['zohoAccounts']={};this[_0x33c0('0x1c')]={};this[_0x33c0('0x1d')]={};this[_0x33c0('0x1e')]={};this['dynamics365Accounts']={};this[_0x33c0('0x1f')]={};this['faxAccounts']={};};function freeIsNotKey(_0x1e4134,_0x5a88cb,_0x115715){var _0x3e208a=_[_0x33c0('0x20')](_0x1e4134,function(_0x1729b9,_0x392232){return _0x1729b9[_0x115715];});for(var _0x192dc0 in _0x5a88cb){if(_0x5a88cb['hasOwnProperty'](_0x192dc0)){if(!_0x3e208a[_0x192dc0]){delete _0x5a88cb[_0x192dc0];}}}}function freeIsNotKeySip(_0x39193d,_0x355516){var _0x1b775f=_[_0x33c0('0x20')](_0x39193d,function(_0x1090f1,_0x2237e7){return util['format'](_0x33c0('0x21'),_0x1090f1[_0x33c0('0x22')]);});for(var _0x3b2f68 in _0x355516){if(_0x355516[_0x33c0('0x23')](_0x3b2f68)){if(!_0x1b775f[_0x3b2f68]){delete _0x355516[_0x3b2f68];}}}}function freeIsNotKeyAgent(_0x5c544c,_0x2e0b2c){var _0x38312c=_[_0x33c0('0x20')](_0x5c544c,function(_0x1d1d3d,_0x51d76c){var _0x302758=_[_0x33c0('0x24')](_0x1d1d3d[_0x33c0('0x25')])?util[_0x33c0('0x26')](_0x33c0('0x21'),_0x1d1d3d[_0x33c0('0x22')]):_0x1d1d3d[_0x33c0('0x25')];return _0x302758;});for(var _0x360686 in _0x2e0b2c){if(_0x2e0b2c[_0x33c0('0x23')](_0x360686)){if(!_0x38312c[_0x360686]){delete _0x2e0b2c[_0x360686];}}}}function clearVoiceCallReports(_0x4876e6){_0x4876e6[_0x33c0('0x27')]=0x0;_0x4876e6[_0x33c0('0x28')]=0x0;_0x4876e6[_0x33c0('0x29')]=0x0;_0x4876e6[_0x33c0('0x2a')]=0x0;_0x4876e6['sumBillable']=0x0;}function clearCampaigns(_0x2505db){if(!_[_0x33c0('0x2b')](_0x2505db)){for(var _0x41dd88 in _0x2505db){if(_0x2505db[_0x33c0('0x23')](_0x41dd88)){_0x2505db[_0x41dd88][_0x33c0('0x2c')]=0x0;_0x2505db[_0x41dd88]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x547675){if(!_['isEmpty'](_0x547675)){for(var _0x1cf88e in _0x547675){if(_0x547675[_0x33c0('0x23')](_0x1cf88e)){_0x547675[_0x1cf88e][_0x33c0('0x27')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x28')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x2d')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x2e')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x29')]=0x0;_0x547675[_0x1cf88e]['sumDuration']=0x0;_0x547675[_0x1cf88e][_0x33c0('0x2f')]=0x0;_0x547675[_0x1cf88e]['outboundAnswerAgiCallsDay']=0x0;_0x547675[_0x1cf88e][_0x33c0('0x30')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x31')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x32')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x33')]=0x0;_0x547675[_0x1cf88e]['outboundUnknownCallsDay']=0x0;_0x547675[_0x1cf88e][_0x33c0('0x34')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x35')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x36')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x37')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x38')]=0x0;_0x547675[_0x1cf88e]['outboundReCallsDay']=0x0;_0x547675[_0x1cf88e][_0x33c0('0x39')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x3a')]=0x0;_0x547675[_0x1cf88e][_0x33c0('0x3b')]=!![];}}}}Realtime[_0x33c0('0x3c')][_0x33c0('0x3d')]=function(_0x2d84e4,_0x1d9c94){for(var _0x335a57 in _0x1d9c94){if(_0x2d84e4[_0x33c0('0x23')](_0x335a57)){_0x2d84e4[_0x335a57]=_0x1d9c94[_0x335a57];}}};Realtime[_0x33c0('0x3c')][_0x33c0('0x3e')]=function(){var _0x430ba2=this;return function(_0xf290ee){if(_0xf290ee){freeIsNotKeyAgent(_0xf290ee,_0x430ba2[_0x33c0('0x3f')]);for(var _0xf65e1d=0x0,_0x15eeca={},_0x931cce={};_0xf65e1d<_0xf290ee[_0x33c0('0x40')];_0xf65e1d+=0x1){_0x15eeca=_0xf290ee[_0xf65e1d];var _0x2c467d=_['isNil'](_0x15eeca[_0x33c0('0x25')])?util[_0x33c0('0x26')]('SIP/%s',_0x15eeca['name']):_0x15eeca[_0x33c0('0x25')];if(_[_0x33c0('0x41')](_0x430ba2[_0x33c0('0x3f')][_0x2c467d])){_0x430ba2[_0x33c0('0x3f')][_0x2c467d]=new Agent(_0x15eeca);}else{_0x430ba2[_0x33c0('0x3d')](_0x430ba2[_0x33c0('0x3f')][_0x2c467d],_0x15eeca);}}}return _0x430ba2['agents'];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x42')]=function(){var _0x5c2bc1=this;return function(_0x303060){if(_0x303060){freeIsNotKeySip(_0x303060,_0x5c2bc1[_0x33c0('0x10')]);for(var _0xb29474=0x0,_0x5700e6={},_0x24ba83={};_0xb29474<_0x303060[_0x33c0('0x40')];_0xb29474+=0x1){_0x5700e6=_0x303060[_0xb29474];if(_[_0x33c0('0x41')](_0x5c2bc1[_0x33c0('0x10')][util[_0x33c0('0x26')]('SIP/%s',_0x5700e6[_0x33c0('0x22')])])){_0x5c2bc1[_0x33c0('0x10')][util[_0x33c0('0x26')](_0x33c0('0x21'),_0x5700e6[_0x33c0('0x22')])]=new Telephone(_0x5700e6);}else{_0x5c2bc1['mergeFromDatabase'](_0x5c2bc1[_0x33c0('0x10')][util[_0x33c0('0x26')](_0x33c0('0x21'),_0x5700e6[_0x33c0('0x22')])],_0x5700e6);}}}return _0x5c2bc1[_0x33c0('0x10')];};};Realtime['prototype'][_0x33c0('0x43')]=function(){var _0x541a1d=this;return function(_0x3d3531){if(_0x3d3531){freeIsNotKeySip(_0x3d3531,_0x541a1d[_0x33c0('0x11')]);for(var _0x14f12b=0x0,_0x3e0d03={},_0x24ba79={};_0x14f12b<_0x3d3531[_0x33c0('0x40')];_0x14f12b+=0x1){_0x3e0d03=_0x3d3531[_0x14f12b];if(_[_0x33c0('0x41')](_0x541a1d[_0x33c0('0x11')][util[_0x33c0('0x26')]('SIP/%s',_0x3e0d03['name'])])){_0x541a1d['trunks'][util[_0x33c0('0x26')](_0x33c0('0x21'),_0x3e0d03[_0x33c0('0x22')])]=new Trunk(_0x3e0d03);}else{_0x541a1d['mergeFromDatabase'](_0x541a1d[_0x33c0('0x11')][util[_0x33c0('0x26')]('SIP/%s',_0x3e0d03['name'])],_0x3e0d03);}}}return _0x541a1d[_0x33c0('0x11')];};};Realtime[_0x33c0('0x3c')]['initVoiceQueues']=function(){var _0x116084=this;return function(_0x206bbf){if(_0x206bbf){freeIsNotKey(_0x206bbf,_0x116084[_0x33c0('0x12')],_0x33c0('0x22'));for(var _0x265037=0x0,_0x4d855b={},_0xab3409={};_0x265037<_0x206bbf['length'];_0x265037+=0x1){_0x4d855b=_0x206bbf[_0x265037];if(_[_0x33c0('0x41')](_0x116084[_0x33c0('0x12')][_0x4d855b[_0x33c0('0x22')]])){_0x116084[_0x33c0('0x12')][_0x4d855b[_0x33c0('0x22')]]=new VoiceQueue(_0x4d855b);}else{_0x116084[_0x33c0('0x3d')](_0x116084[_0x33c0('0x12')][_0x4d855b['name']],_0x4d855b);}}}return _0x116084[_0x33c0('0x12')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x44')]=function(){var _0x463864=this;return function(_0x2d613e){if(_0x2d613e){freeIsNotKey(_0x2d613e,_0x463864[_0x33c0('0x13')],'id');for(var _0x56e239=0x0,_0x1f7e4f={},_0x585a0d={};_0x56e239<_0x2d613e[_0x33c0('0x40')];_0x56e239+=0x1){_0x1f7e4f=_0x2d613e[_0x56e239];if(_['isUndefined'](_0x463864[_0x33c0('0x13')][_0x1f7e4f['id']])){_0x463864['triggers'][_0x1f7e4f['id']]=new Trigger(_0x1f7e4f);}else{_0x463864[_0x33c0('0x3d')](_0x463864[_0x33c0('0x13')][_0x1f7e4f['id']],_0x1f7e4f);}}}return _0x463864[_0x33c0('0x13')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x45')]=function(){var _0x20a166=this;return function(_0x391e81){if(_0x391e81){freeIsNotKey(_0x391e81,_0x20a166['templates'],'id');for(var _0x221b7a=0x0,_0x44488c={},_0x2a02b8={};_0x221b7a<_0x391e81[_0x33c0('0x40')];_0x221b7a+=0x1){_0x44488c=_0x391e81[_0x221b7a];if(_['isUndefined'](_0x20a166[_0x33c0('0x46')][_0x44488c['id']])){_0x20a166['templates'][_0x44488c['id']]=new Template(_0x44488c);}else{_0x20a166[_0x33c0('0x3d')](_0x20a166[_0x33c0('0x46')][_0x44488c['id']],_0x44488c);}}}return _0x20a166[_0x33c0('0x46')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x47')]=function(){var _0x40ca5c=this;return function(_0x42e881){if(_0x42e881){freeIsNotKey(_0x42e881,_0x40ca5c['zendeskAccounts'],'id');for(var _0x271a27=0x0,_0x483cdf={},_0x454f49={};_0x271a27<_0x42e881[_0x33c0('0x40')];_0x271a27+=0x1){_0x483cdf=_0x42e881[_0x271a27];if(_[_0x33c0('0x41')](_0x40ca5c[_0x33c0('0x18')][_0x483cdf['id']])){_0x40ca5c[_0x33c0('0x18')][_0x483cdf['id']]=new ZendeskAccount(_0x483cdf);}else{_0x40ca5c[_0x33c0('0x3d')](_0x40ca5c[_0x33c0('0x18')][_0x483cdf['id']],_0x483cdf);}}}return _0x40ca5c['zendeskAccounts'];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x48')]=function(){var _0x3a2eed=this;return function(_0x2f8036){if(_0x2f8036){freeIsNotKey(_0x2f8036,_0x3a2eed[_0x33c0('0x19')],'id');for(var _0x5cbf53=0x0,_0x14059e={},_0x2b29ce={};_0x5cbf53<_0x2f8036[_0x33c0('0x40')];_0x5cbf53+=0x1){_0x14059e=_0x2f8036[_0x5cbf53];if(_[_0x33c0('0x41')](_0x3a2eed['salesforceAccounts'][_0x14059e['id']])){_0x3a2eed[_0x33c0('0x19')][_0x14059e['id']]=new SalesforceAccount(_0x14059e);}else{_0x3a2eed['mergeFromDatabase'](_0x3a2eed[_0x33c0('0x19')][_0x14059e['id']],_0x14059e);}}}return _0x3a2eed[_0x33c0('0x19')];};};Realtime['prototype'][_0x33c0('0x49')]=function(){var _0x29ff3d=this;return function(_0x19902a){if(_0x19902a){freeIsNotKey(_0x19902a,_0x29ff3d['freshdeskAccounts'],'id');for(var _0x5ec5e2=0x0,_0x3fc009={},_0x12f58a={};_0x5ec5e2<_0x19902a[_0x33c0('0x40')];_0x5ec5e2+=0x1){_0x3fc009=_0x19902a[_0x5ec5e2];if(_[_0x33c0('0x41')](_0x29ff3d[_0x33c0('0x1b')][_0x3fc009['id']])){_0x29ff3d[_0x33c0('0x1b')][_0x3fc009['id']]=new FreshdeskAccount(_0x3fc009);}else{_0x29ff3d['mergeFromDatabase'](_0x29ff3d[_0x33c0('0x1b')][_0x3fc009['id']],_0x3fc009);}}}return _0x29ff3d[_0x33c0('0x1b')];};};Realtime['prototype'][_0x33c0('0x4a')]=function(){var _0x3a0fd9=this;return function(_0x4dc305){if(_0x4dc305){freeIsNotKey(_0x4dc305,_0x3a0fd9[_0x33c0('0x4b')],'id');for(var _0x42caf7=0x0,_0x324483={},_0x466668={};_0x42caf7<_0x4dc305[_0x33c0('0x40')];_0x42caf7+=0x1){_0x324483=_0x4dc305[_0x42caf7];if(_['isUndefined'](_0x3a0fd9[_0x33c0('0x4b')][_0x324483['id']])){_0x3a0fd9[_0x33c0('0x4b')][_0x324483['id']]=new ZohoAccount(_0x324483);}else{_0x3a0fd9[_0x33c0('0x3d')](_0x3a0fd9[_0x33c0('0x4b')][_0x324483['id']],_0x324483);}}}return _0x3a0fd9[_0x33c0('0x4b')];};};Realtime['prototype'][_0x33c0('0x4c')]=function(){var _0x2f52e8=this;return function(_0x51c251){if(_0x51c251){freeIsNotKey(_0x51c251,_0x2f52e8[_0x33c0('0x1c')],'id');for(var _0x3212c8=0x0,_0x3268dd={},_0x5d2fee={};_0x3212c8<_0x51c251[_0x33c0('0x40')];_0x3212c8+=0x1){_0x3268dd=_0x51c251[_0x3212c8];if(_['isUndefined'](_0x2f52e8[_0x33c0('0x1c')][_0x3268dd['id']])){_0x2f52e8['deskAccounts'][_0x3268dd['id']]=new DeskAccount(_0x3268dd);}else{_0x2f52e8[_0x33c0('0x3d')](_0x2f52e8[_0x33c0('0x1c')][_0x3268dd['id']],_0x3268dd);}}}return _0x2f52e8[_0x33c0('0x1c')];};};Realtime['prototype'][_0x33c0('0x4d')]=function(){var _0x92dbf1=this;return function(_0x2f9304){if(_0x2f9304){freeIsNotKey(_0x2f9304,_0x92dbf1['sugarcrmAccounts'],'id');for(var _0x33f05b=0x0,_0x8ab212={},_0x20f0ae={};_0x33f05b<_0x2f9304[_0x33c0('0x40')];_0x33f05b+=0x1){_0x8ab212=_0x2f9304[_0x33f05b];if(_[_0x33c0('0x41')](_0x92dbf1[_0x33c0('0x1a')][_0x8ab212['id']])){_0x92dbf1[_0x33c0('0x1a')][_0x8ab212['id']]=new SugarcrmAccount(_0x8ab212);}else{_0x92dbf1[_0x33c0('0x3d')](_0x92dbf1[_0x33c0('0x1a')][_0x8ab212['id']],_0x8ab212);}}}return _0x92dbf1[_0x33c0('0x1a')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x4e')]=function(){var _0x4f4ba6=this;return function(_0x438526){if(_0x438526){freeIsNotKey(_0x438526,_0x4f4ba6['vtigerAccounts'],'id');for(var _0x17fac4=0x0,_0x5411ef={},_0xf19c66={};_0x17fac4<_0x438526[_0x33c0('0x40')];_0x17fac4+=0x1){_0x5411ef=_0x438526[_0x17fac4];if(_['isUndefined'](_0x4f4ba6['vtigerAccounts'][_0x5411ef['id']])){_0x4f4ba6[_0x33c0('0x1d')][_0x5411ef['id']]=new VtigerAccount(_0x5411ef);}else{_0x4f4ba6['mergeFromDatabase'](_0x4f4ba6[_0x33c0('0x1d')][_0x5411ef['id']],_0x5411ef);}}}return _0x4f4ba6[_0x33c0('0x1d')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x4f')]=function(){var _0x2f93f7=this;return function(_0x1f1141){if(_0x1f1141){freeIsNotKey(_0x1f1141,_0x2f93f7['servicenowAccounts'],'id');for(var _0x466007=0x0,_0x1973ed={},_0x1dae63={};_0x466007<_0x1f1141[_0x33c0('0x40')];_0x466007+=0x1){_0x1973ed=_0x1f1141[_0x466007];if(_[_0x33c0('0x41')](_0x2f93f7['servicenowAccounts'][_0x1973ed['id']])){_0x2f93f7[_0x33c0('0x1e')][_0x1973ed['id']]=new ServicenowAccount(_0x1973ed);}else{_0x2f93f7[_0x33c0('0x3d')](_0x2f93f7[_0x33c0('0x1e')][_0x1973ed['id']],_0x1973ed);}}}return _0x2f93f7[_0x33c0('0x1e')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x50')]=function(){var _0x4ffa88=this;return function(_0x32fdbe){if(_0x32fdbe){freeIsNotKey(_0x32fdbe,_0x4ffa88['dynamics365Accounts'],'id');for(var _0x4bcb0f=0x0,_0x17c9c8={},_0x1276c8={};_0x4bcb0f<_0x32fdbe[_0x33c0('0x40')];_0x4bcb0f+=0x1){_0x17c9c8=_0x32fdbe[_0x4bcb0f];if(_[_0x33c0('0x41')](_0x4ffa88[_0x33c0('0x51')][_0x17c9c8['id']])){_0x4ffa88[_0x33c0('0x51')][_0x17c9c8['id']]=new Dynamics365Account(_0x17c9c8);}else{_0x4ffa88['mergeFromDatabase'](_0x4ffa88[_0x33c0('0x51')][_0x17c9c8['id']],_0x17c9c8);}}}return _0x4ffa88[_0x33c0('0x51')];};};Realtime['prototype'][_0x33c0('0x52')]=function(){var _0x4c7eb9=this;return function(_0x115a6b){if(_0x115a6b){freeIsNotKey(_0x115a6b,_0x4c7eb9[_0x33c0('0x1f')],'id');for(var _0x3b561c=0x0,_0x4f759e={},_0x4b4722={};_0x3b561c<_0x115a6b['length'];_0x3b561c+=0x1){_0x4f759e=_0x115a6b[_0x3b561c];if(_[_0x33c0('0x41')](_0x4c7eb9[_0x33c0('0x1f')][_0x4f759e['id']])){_0x4c7eb9[_0x33c0('0x1f')][_0x4f759e['id']]=new FreshsalesAccount(_0x4f759e);}else{_0x4c7eb9['mergeFromDatabase'](_0x4c7eb9[_0x33c0('0x1f')][_0x4f759e['id']],_0x4f759e);}}}return _0x4c7eb9[_0x33c0('0x1f')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x53')]=function(){var _0x57f6bc=this;return function(_0x49fb5f){for(var _0x336d25=0x0;_0x336d25<_0x49fb5f['length'];_0x336d25+=0x1){_['merge'](_0x57f6bc[_0x33c0('0x12')][_0x49fb5f[_0x336d25][_0x33c0('0x22')]],_0x49fb5f[_0x336d25]);}return _0x57f6bc[_0x33c0('0x12')];};};Realtime[_0x33c0('0x3c')]['initVoiceQueueReports']=function(){var _0x25117c=this;return function(_0x1375aa){clearVoiceQueues(_0x25117c[_0x33c0('0x12')]);if(_0x1375aa){_0x1375aa=_['groupBy'](_0x1375aa,'uniqueid');for(var _0x401a30 in _0x1375aa){if(_0x1375aa[_0x33c0('0x23')](_0x401a30)){var _0x35db2c={};for(var _0x2a9d34=0x0;_0x2a9d34<_0x1375aa[_0x401a30][_0x33c0('0x40')];_0x2a9d34+=0x1){var _0x20cb35=_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x54')];if(_0x25117c['voiceQueues'][_0x20cb35]){if(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x55')]){_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x2d')]+=0x1;}if(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x56')]){_0x25117c[_0x33c0('0x12')][_0x20cb35]['abandoned']+=0x1;}_0x25117c['voiceQueues'][_0x20cb35][_0x33c0('0x29')]+=moment(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x57')])['diff'](moment(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x58')]),'seconds')||0x0;if(_0x2a9d34===_0x1375aa[_0x401a30][_0x33c0('0x40')]-0x1){_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x2a')]+=moment(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x59')]||_0x1375aa[_0x401a30][_0x2a9d34]['queuecallerabandonAt']||_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x5a')])[_0x33c0('0x5b')](moment(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x58')]),'seconds')||0x0;_0x25117c['voiceQueues'][_0x20cb35][_0x33c0('0x27')]+=0x1;if(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x5c')]){_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x28')]+=0x1;_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x2f')]+=moment(_0x1375aa[_0x401a30][_0x2a9d34][_0x33c0('0x59')])[_0x33c0('0x5b')](moment(_0x1375aa[_0x401a30][_0x2a9d34]['queuecallerleaveAt']),_0x33c0('0x5d'))||0x0;}}else{_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x2a')]+=_0x25117c[_0x33c0('0x12')][_0x20cb35][_0x33c0('0x29')]||0x0;}}}}}}return _0x25117c[_0x33c0('0x12')];};};Realtime['prototype'][_0x33c0('0x5e')]=function(){var _0x52fe25=this;return function(_0x3ed1c8){clearVoiceCallReports(_0x52fe25[_0x33c0('0x14')]);if(_0x3ed1c8){for(var _0x249415=0x0;_0x249415<_0x3ed1c8[_0x33c0('0x40')];_0x249415+=0x1){_0x52fe25[_0x33c0('0x14')]['total']+=0x1;_0x52fe25['outbound']['sumDuration']+=_0x3ed1c8[_0x249415][_0x33c0('0x5f')];if(_0x3ed1c8[_0x249415]['disposition']===_0x33c0('0x60')){_0x52fe25[_0x33c0('0x14')][_0x33c0('0x28')]+=0x1;_0x52fe25[_0x33c0('0x14')]['sumHoldTime']+=_0x3ed1c8[_0x249415][_0x33c0('0x5f')]-_0x3ed1c8[_0x249415][_0x33c0('0x61')]||0x0;_0x52fe25[_0x33c0('0x14')][_0x33c0('0x2f')]+=_0x3ed1c8[_0x249415][_0x33c0('0x61')];}}}return _0x52fe25['outbound'];};};Realtime[_0x33c0('0x3c')]['initCampaigns']=function(){var _0x37a687=this;return function(_0x2ada1b){if(_0x2ada1b){freeIsNotKey(_0x2ada1b,_0x37a687['campaigns'],_0x33c0('0x22'));for(var _0x477235=0x0,_0x2affa9={};_0x477235<_0x2ada1b[_0x33c0('0x40')];_0x477235+=0x1){_0x2affa9=_0x2ada1b[_0x477235];if(_[_0x33c0('0x41')](_0x37a687[_0x33c0('0x62')][_0x2affa9[_0x33c0('0x22')]])){_0x37a687[_0x33c0('0x62')][_0x2affa9[_0x33c0('0x22')]]=new Campaign(_0x2affa9);}else{_0x37a687['mergeFromDatabase'](_0x37a687['campaigns'][_0x2affa9[_0x33c0('0x22')]],_0x2affa9);_0x37a687['campaigns'][_0x2affa9['name']][_0x33c0('0x63')]=_0x2affa9['SquareProject']?_0x2affa9[_0x33c0('0x64')][_0x33c0('0x22')]:undefined;}}}return _0x37a687[_0x33c0('0x62')];};};Realtime['prototype'][_0x33c0('0x65')]=function(){var _0x405a00=this;return function(_0xd77c04){if(_0xd77c04){freeIsNotKey(_0xd77c04,_0x405a00[_0x33c0('0x15')],'id');for(var _0x1765f3=0x0,_0x5aaf55={};_0x1765f3<_0xd77c04[_0x33c0('0x40')];_0x1765f3+=0x1){_0x5aaf55=_0xd77c04[_0x1765f3];if(_['isUndefined'](_0x405a00['voiceExtensions'][_0x5aaf55['id']])){_0x405a00[_0x33c0('0x15')][_0x5aaf55['id']]=new VoiceExtension(_0x5aaf55);}else{_0x405a00[_0x33c0('0x3d')](_0x405a00[_0x33c0('0x15')][_0x5aaf55['id']],_0x5aaf55);}}}return _0x405a00[_0x33c0('0x15')];};};Realtime[_0x33c0('0x3c')][_0x33c0('0x66')]=function(){var _0x390c61=this;return function(_0x2c65da){clearCampaigns(_0x390c61['campaigns']);for(var _0xaaa9bb=0x0;_0xaaa9bb<_0x2c65da[_0x33c0('0x40')];_0xaaa9bb+=0x1){_[_0x33c0('0x67')](_0x390c61[_0x33c0('0x62')][_0x2c65da[_0xaaa9bb][_0x33c0('0x22')]],_0x2c65da[_0xaaa9bb]);}return _0x390c61['campaigns'];};};Realtime[_0x33c0('0x3c')]['initFaxAccounts']=function(){var _0x5aa129=this;return function(_0x377b32){if(_0x377b32){freeIsNotKey(_0x377b32,_0x5aa129[_0x33c0('0x68')],'id');for(var _0x4913b0=0x0,_0x48f4f8={},_0x372663={};_0x4913b0<_0x377b32[_0x33c0('0x40')];_0x4913b0+=0x1){_0x48f4f8=_0x377b32[_0x4913b0];if(_[_0x33c0('0x41')](_0x5aa129['faxAccounts'][_0x48f4f8['id']])){_0x5aa129[_0x33c0('0x68')][_0x48f4f8['id']]=new FaxAccount(_0x48f4f8);}else{_0x5aa129[_0x33c0('0x3d')](_0x5aa129[_0x33c0('0x68')][_0x48f4f8['id']],_0x48f4f8);}}}return _0x5aa129[_0x33c0('0x68')];};};module[_0x33c0('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index bb6c2a5..e6fad8f 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 _0x66d4=['connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','internal','voiceCallReport','destination','exten','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','forEach','voiceDialReport','Local','indexOf','phone','substring','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','blindTransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length'];(function(_0x2fe27a,_0x286478){var _0x248e34=function(_0x344fc4){while(--_0x344fc4){_0x2fe27a['push'](_0x2fe27a['shift']());}};_0x248e34(++_0x286478);}(_0x66d4,0xf1));var _0x466d=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x66d4[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x466d('0x0'));var moment=require(_0x466d('0x1'));var util=require(_0x466d('0x2'));var config=require(_0x466d('0x3'));var ami=require(_0x466d('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x466d('0x5'));var RpcVoiceDialReport=require(_0x466d('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x466d('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x466d('0x8'));var VoiceQueueReport=require(_0x466d('0x9'));var VoiceCallReport=require(_0x466d('0xa'));var VoiceAgentReport=require(_0x466d('0xb'));var VoiceDialReport=require(_0x466d('0xc'));var UserReport=require('./userReport');function Report(_0x56d7bb){this[_0x466d('0xd')]=_0x56d7bb;this[_0x466d('0xe')]=_0x56d7bb[_0x466d('0xe')];this[_0x466d('0xf')]=_0x56d7bb[_0x466d('0xf')];}Report['prototype'][_0x466d('0x10')]=function(_0x4941a8){var _0x14be64=new VoiceQueueReport(this[_0x466d('0xd')]);var _0x4f1a30=new VoiceAgentReport(this['realtime']);var _0x4c71a7=new VoiceDialReport(this[_0x466d('0xd')]);var _0x438a93=new VoiceCallReport(this[_0x466d('0xd')]);var _0x4fe020=new UserReport(this[_0x466d('0xd')]);if(config[_0x466d('0x11')]&&config['xdr']['disabled']){ami['on'](_0x466d('0x12'),this[_0x466d('0x13')]['bind'](this));ami['on'](_0x466d('0x14'),this['voiceCallReport']['bind'](this));ami['on'](_0x466d('0x15'),this[_0x466d('0x16')][_0x466d('0x17')](this));ami['on'](_0x466d('0x18'),this['voiceDialReport'][_0x466d('0x17')](this));ami['on']('blindtransfer',this[_0x466d('0x19')]['bind'](this));ami['on'](_0x466d('0x1a'),this[_0x466d('0x1b')][_0x466d('0x17')](this));}};Report[_0x466d('0x1c')][_0x466d('0x1d')]=function(_0x158046){var _0x23b855;_0x23b855=_[_0x466d('0x1e')](this[_0x466d('0xe')],function(_0x175768){return _0x175768[_0x466d('0x1f')]==_0x158046||_0x175768[_0x466d('0x20')]==_0x158046;});if(_[_0x466d('0x21')](_0x23b855)){var _0x45919b=_[_0x466d('0x1e')](this[_0x466d('0xf')],function(_0x93351b){return _0x93351b['accountcode']==_0x158046||_0x93351b[_0x466d('0x20')]==_0x158046;});if(_0x45919b){_0x23b855=_[_0x466d('0x1e')](this[_0x466d('0xe')],function(_0x4a5837){return _0x4a5837[_0x466d('0x22')]==util[_0x466d('0x23')](_0x466d('0x24'),_0x45919b[_0x466d('0x20')]);});}}return _0x23b855;};Report[_0x466d('0x1c')][_0x466d('0x13')]=function(_0x4f85bf){for(var _0x40369f=0x0;_0x40369f<_0x4f85bf[_0x466d('0x25')];_0x40369f+=0x1){var _0x361cf3=this[_0x466d('0x1d')](_0x4f85bf[_0x40369f][_0x466d('0x26')]);if(_0x361cf3){_0x4f85bf[_0x40369f][_0x466d('0x1f')]=_0x361cf3['accountcode'];_0x4f85bf[_0x40369f][_0x466d('0x27')]=!![];_0x4f85bf[_0x40369f][_0x466d('0x28')]=_0x361cf3[_0x466d('0x20')];_0x4f85bf[_0x40369f]['interface']=_[_0x466d('0x21')](_0x361cf3[_0x466d('0x22')])?util[_0x466d('0x23')](_0x466d('0x24'),_0x361cf3[_0x466d('0x20')]):_0x361cf3[_0x466d('0x22')];if(_0x4f85bf[_0x40369f]['queuecallercomplete']){_0x4f85bf[_0x40369f][_0x466d('0x29')]=moment()[_0x466d('0x23')](_0x466d('0x2a'));}if(_0x4f85bf[_0x40369f]['queuecallerexit']){_0x4f85bf[_0x40369f][_0x466d('0x2b')]=moment()[_0x466d('0x23')](_0x466d('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x4f85bf[_0x40369f]);}RpcVoiceQueueReport[_0x466d('0x2c')](_0x4f85bf[_0x40369f]);}};function extractCalleridNumber(_0x226c3f){var _0x57b5eb=_0x226c3f[_0x466d('0x2d')](/<(.*?)>/);return _0x57b5eb?_0x57b5eb[0x1]:_0x226c3f;}Report[_0x466d('0x1c')][_0x466d('0x2e')]=function(_0x3d6ade){for(var _0x3b35d7=0x0;_0x3b35d7','calleridname','transfers','linkedid','uniqueid','type','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','split','outbound','destination','exten'];(function(_0x5c20e0,_0x1972d7){var _0x5e4074=function(_0x5ea60e){while(--_0x5ea60e){_0x5c20e0['push'](_0x5c20e0['shift']());}};_0x5e4074(++_0x1972d7);}(_0xf3d7,0x87));var _0x7f3d=function(_0x4651bd,_0x12a42f){_0x4651bd=_0x4651bd-0x0;var _0xdf510d=_0xf3d7[_0x4651bd];return _0xdf510d;};'use strict';var _=require(_0x7f3d('0x0'));var moment=require(_0x7f3d('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0x7f3d('0x2'));var RpcVoiceCallReport=require(_0x7f3d('0x3'));var RpcVoiceDialReport=require(_0x7f3d('0x4'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x7f3d('0x5'));var RpcVoiceTransferReport=require(_0x7f3d('0x6'));var VoiceQueueReport=require(_0x7f3d('0x7'));var VoiceCallReport=require(_0x7f3d('0x8'));var VoiceAgentReport=require(_0x7f3d('0x9'));var VoiceDialReport=require(_0x7f3d('0xa'));var UserReport=require('./userReport');function Report(_0x142a11){this['realtime']=_0x142a11;this[_0x7f3d('0xb')]=_0x142a11['agents'];this['telephones']=_0x142a11[_0x7f3d('0xc')];}Report[_0x7f3d('0xd')][_0x7f3d('0xe')]=function(_0x27c02b){var _0x57631b=new VoiceQueueReport(this[_0x7f3d('0xf')]);var _0x20e267=new VoiceAgentReport(this[_0x7f3d('0xf')]);var _0x15b3bf=new VoiceDialReport(this[_0x7f3d('0xf')]);var _0x3d79e2=new VoiceCallReport(this[_0x7f3d('0xf')]);var _0x2067e5=new UserReport(this[_0x7f3d('0xf')]);if(config['xdr']&&config[_0x7f3d('0x10')][_0x7f3d('0x11')]){ami['on'](_0x7f3d('0x12'),this[_0x7f3d('0x13')]['bind'](this));ami['on'](_0x7f3d('0x14'),this[_0x7f3d('0x15')][_0x7f3d('0x16')](this));ami['on'](_0x7f3d('0x17'),this[_0x7f3d('0x18')][_0x7f3d('0x16')](this));ami['on'](_0x7f3d('0x19'),this[_0x7f3d('0x1a')][_0x7f3d('0x16')](this));ami['on'](_0x7f3d('0x1b'),this[_0x7f3d('0x1c')]['bind'](this));ami['on']('attendedtransfer',this[_0x7f3d('0x1d')]['bind'](this));}};Report[_0x7f3d('0xd')][_0x7f3d('0x1e')]=function(_0x5c98c6){var _0x5b7224;_0x5b7224=_[_0x7f3d('0x1f')](this[_0x7f3d('0xb')],function(_0x513354){return _0x513354[_0x7f3d('0x20')]==_0x5c98c6||_0x513354[_0x7f3d('0x21')]==_0x5c98c6;});if(_[_0x7f3d('0x22')](_0x5b7224)){var _0x588f21=_['find'](this[_0x7f3d('0xc')],function(_0x1f629a){return _0x1f629a[_0x7f3d('0x20')]==_0x5c98c6||_0x1f629a[_0x7f3d('0x21')]==_0x5c98c6;});if(_0x588f21){_0x5b7224=_[_0x7f3d('0x1f')](this[_0x7f3d('0xb')],function(_0x24e139){return _0x24e139[_0x7f3d('0x23')]==util[_0x7f3d('0x24')](_0x7f3d('0x25'),_0x588f21['name']);});}}return _0x5b7224;};Report[_0x7f3d('0xd')]['voiceQueueReport']=function(_0x225fc6){for(var _0x497f81=0x0;_0x497f81<_0x225fc6['length'];_0x497f81+=0x1){var _0x18e37d=this[_0x7f3d('0x1e')](_0x225fc6[_0x497f81][_0x7f3d('0x26')]);if(_0x18e37d){_0x225fc6[_0x497f81][_0x7f3d('0x20')]=_0x18e37d[_0x7f3d('0x20')];_0x225fc6[_0x497f81][_0x7f3d('0x27')]=!![];_0x225fc6[_0x497f81][_0x7f3d('0x28')]=_0x18e37d[_0x7f3d('0x21')];_0x225fc6[_0x497f81]['interface']=_[_0x7f3d('0x22')](_0x18e37d[_0x7f3d('0x23')])?util[_0x7f3d('0x24')]('SIP/%s',_0x18e37d[_0x7f3d('0x21')]):_0x18e37d[_0x7f3d('0x23')];if(_0x225fc6[_0x497f81]['queuecallercomplete']){_0x225fc6[_0x497f81][_0x7f3d('0x29')]=moment()[_0x7f3d('0x24')](_0x7f3d('0x2a'));}if(_0x225fc6[_0x497f81][_0x7f3d('0x2b')]){_0x225fc6[_0x497f81][_0x7f3d('0x2c')]=moment()[_0x7f3d('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x7f3d('0x13')](_0x225fc6[_0x497f81]);}RpcVoiceQueueReport[_0x7f3d('0x2d')](_0x225fc6[_0x497f81]);}};function extractCalleridNumber(_0x5b0272){var _0xe702d8=_0x5b0272[_0x7f3d('0x2e')](/<(.*?)>/);return _0xe702d8?_0xe702d8[0x1]:_0x5b0272;}Report[_0x7f3d('0xd')][_0x7f3d('0x2f')]=function(_0x49c98e){for(var _0xfa2c5c=0x0;_0xfa2c5c0x0?_0x39316d:0x0;this['voiceQueues'][_0x42b809['queue']][_0xc01d('0x2e')]=this[_0xc01d('0x13')][_0x42b809['queue']][_0xc01d('0x2e')]>_['toNumber'](_0x42b809['loggedin'])?_[_0xc01d('0x69')](_0x42b809[_0xc01d('0x6a')]):this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]]['talking'];this['emitVoiceQueueSummary'](this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]],_0xc01d('0x60'));}logger[_0xc01d('0x42')](_0xc01d('0x6b'),util['inspect'](this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]],{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0x6c'),this[_0xc01d('0x13')][_0x42b809[_0xc01d('0x63')]]);}}}catch(_0x2442b6){logger[_0xc01d('0x3a')]('[voiceQueueReport][queuesummary]',util[_0xc01d('0x3c')](_0x2442b6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')]['syncQueueSummaryComplete']=function(_0xf28deb){logger[_0xc01d('0x42')](_0xc01d('0x6d'),util[_0xc01d('0x3c')](_0xf28deb,{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0x6e'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0x6f')]=function(_0x17f550){try{if(this[_0xc01d('0x5c')](_0x17f550)){logger[_0xc01d('0x42')](_0xc01d('0x70'),_0x17f550[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x17f550,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xc01d('0xf')][_0x17f550[_0xc01d('0x44')]]))this[_0xc01d('0xf')][_0x17f550[_0xc01d('0x44')]]=[];if(_[_0xc01d('0x5d')](this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]]))this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]]={};var _0x35daa7=new QueueReport();_0x35daa7['name']=_0x17f550['queue'];_0x35daa7[_0xc01d('0x4d')]=this[_0xc01d('0x13')][_0x35daa7[_0xc01d('0x4b')]]&&this[_0xc01d('0x13')][_0x35daa7['name']][_0xc01d('0x4d')]?this[_0xc01d('0x13')][_0x35daa7[_0xc01d('0x4b')]][_0xc01d('0x4d')]||_0xc01d('0x4e'):_0xc01d('0x4e');_0x35daa7[_0xc01d('0x63')]=_0x17f550[_0xc01d('0x63')];_0x35daa7['queuecallerjoinAt']=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x35daa7[_0xc01d('0x72')]=_0x17f550['position'];_0x35daa7[_0xc01d('0x73')]=_0x17f550[_0xc01d('0x73')];_0x35daa7[_0xc01d('0x44')]=_0x17f550[_0xc01d('0x44')];_0x35daa7[_0xc01d('0x74')]=this[_0xc01d('0x11')][_0x17f550[_0xc01d('0x44')]][_0xc01d('0x74')];logger['info'](_0xc01d('0x75'),_0x35daa7['name'],_0x35daa7[_0xc01d('0x4d')]);_[_0xc01d('0x76')](_0x35daa7,_[_0xc01d('0x77')](_0x17f550,_[_0xc01d('0x78')](_0x35daa7)));this['queueReports'][_0x17f550[_0xc01d('0x44')]][_0xc01d('0x79')](_0x35daa7);this['channels'][_0x17f550[_0xc01d('0x44')]]=_0x35daa7;this[_0xc01d('0x7a')](_0x35daa7,_0xc01d('0x1b'));}}catch(_0x529069){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x17f550[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x529069,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x1c')]=function(_0x1817df){try{if(this['isNotNull'](_0x1817df)){logger[_0xc01d('0x42')](_0xc01d('0x7b'),_0x1817df[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x1817df,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x1817df['uniqueid']]){var _0x3483b6=_[_0xc01d('0x7c')](this['queueReports'][_0x1817df['uniqueid']]);_0x3483b6[_0xc01d('0x7d')]=![];_0x3483b6['queuecallercompleteAt']=null;_0x3483b6['holdtime']=_0x1817df[_0xc01d('0x7e')];_0x3483b6[_0xc01d('0x7f')]=_0x1817df[_0xc01d('0x7f')];_0x3483b6[_0xc01d('0x80')]=!![];_0x3483b6['queuecallerabandonAt']=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x3483b6[_0xc01d('0x48')]=_0xc01d('0x81');_0x3483b6['lastAssignedTo']=null;logger['info'](_0xc01d('0x82'),_0x3483b6['name'],_0x3483b6[_0xc01d('0x4d')]);this['channels'][_0x1817df[_0xc01d('0x44')]]=_0x3483b6;this['emitVoiceQueueChannelRemove'](_0x3483b6,_0xc01d('0x80'));}}}catch(_0x43dd0){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x1817df[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x43dd0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x83')]=function(_0x2393c4){try{if(this[_0xc01d('0x5c')](_0x2393c4)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x2393c4[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x2393c4,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x2393c4[_0xc01d('0x44')]]){var _0x366353=_['last'](this[_0xc01d('0xf')][_0x2393c4[_0xc01d('0x44')]]);_0x366353[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x366353['connectedlinenum']=_0x2393c4['connectedlinenum'];_0x366353['connectedlinename']=_0x2393c4[_0xc01d('0x85')];logger[_0xc01d('0x86')](_0xc01d('0x87'),_0x366353['name'],_0x366353[_0xc01d('0x4d')],_0x2393c4[_0xc01d('0x88')],_0x2393c4[_0xc01d('0x85')]);this[_0xc01d('0x11')][_0x2393c4[_0xc01d('0x44')]]=_0x366353;this[_0xc01d('0x7a')](_0x366353,'queuecallerleave');}}}catch(_0x487c59){logger[_0xc01d('0x3a')](_0xc01d('0x89'),_0x2393c4[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x487c59,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0x8a')]=function(_0x3482c0){try{if(this['isNotNull'](_0x3482c0)){logger[_0xc01d('0x42')](_0xc01d('0x8b'),_0x3482c0[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x3482c0,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x3482c0['uniqueid']]){var _0x660e02=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x3482c0[_0xc01d('0x44')]]);_0x660e02[_0xc01d('0x7d')]=!![];_0x660e02[_0xc01d('0x48')]=_0xc01d('0x8c');logger[_0xc01d('0x86')](_0xc01d('0x8d'),_0x660e02['name'],_0x660e02['type']);}}}catch(_0x590a7e){logger['error'](_0xc01d('0x8b'),_0x3482c0['uniqueid'],util[_0xc01d('0x3c')](_0x590a7e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc01d('0x8e')]=function(_0x1c1c31){try{if(this['isNotNull'](_0x1c1c31)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x1c1c31[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x1c1c31,{'showHidden':![],'depth':null}));if(this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]){var _0x8c8e57=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]);_0x8c8e57[_0xc01d('0x80')]=![];_0x8c8e57[_0xc01d('0x8f')]=null;_0x8c8e57[_0xc01d('0x90')]=!![];_0x8c8e57['lastAssignedTo']=_0x1c1c31[_0xc01d('0x91')];_0x8c8e57[_0xc01d('0x7e')]=_0x1c1c31['holdtime'];_0x8c8e57[_0xc01d('0x7d')]=!![];_0x8c8e57[_0xc01d('0x92')]=![];_0x8c8e57[_0xc01d('0x93')]=null;if(!_0x8c8e57['transfer']){if(_0x1c1c31[_0xc01d('0x94')]=='transfer'){_0x8c8e57['queuecallerexitreason']='COMPLETED';logger['info'](_0xc01d('0x95'),_0x8c8e57['name'],_0x8c8e57[_0xc01d('0x4d')]);}else{if(_[_0xc01d('0x96')](_0x1c1c31[_0xc01d('0x38')][_0xc01d('0x97')](),_0xc01d('0x98'))){if(this[_0xc01d('0xf')][_0x1c1c31['linkedid']]){var _0x143192=_['last'](this['queueReports'][_0x1c1c31[_0xc01d('0x99')]]);_0x143192[_0xc01d('0x7d')]=![];_0x143192[_0xc01d('0x92')]=!![];_0x143192[_0xc01d('0x93')]=moment(_0x8c8e57['queuecallerjoinAt'])[_0xc01d('0x9a')](_0x1c1c31[_0xc01d('0x7e')],_0xc01d('0x9b'))['format'](_0xc01d('0x71'));_0x143192[_0xc01d('0x48')]=_0xc01d('0x9c');_0x143192[_0xc01d('0x9d')]=!![];_0x143192[_0xc01d('0x9e')]=_0xc01d('0x9f');_0x143192['transferexten']=_0x1c1c31['destexten'];_0x143192[_0xc01d('0xa0')]=_0x1c1c31['uniqueid'];logger[_0xc01d('0x86')](_0xc01d('0xa1'),_0x143192[_0xc01d('0x4b')],_0x143192['type']);var _0x3acf3e=this[_0xc01d('0xf')][_0x1c1c31['linkedid']];this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x99')]]=this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]];this[_0xc01d('0xf')][_0x1c1c31[_0xc01d('0x44')]]=_0x3acf3e;}}else{_0x8c8e57[_0xc01d('0x48')]=_0xc01d('0xa2')+_0x1c1c31[_0xc01d('0x94')][_0xc01d('0xa3')]();logger[_0xc01d('0x86')](_0xc01d('0xa4'),_0x8c8e57[_0xc01d('0x4b')],_0x8c8e57[_0xc01d('0x4d')],_0x8c8e57[_0xc01d('0x48')]);}}}this['channels'][_0x1c1c31['uniqueid']]=_0x8c8e57;this[_0xc01d('0x3f')](_0x8c8e57,'agentcomplete');}}}catch(_0x397a3e){logger[_0xc01d('0x3a')](_0xc01d('0xa5'),_0x1c1c31['uniqueid'],util[_0xc01d('0x3c')](_0x397a3e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')]['syncVarSet']=function(_0x55c652){try{if(this['isNotNull'](_0x55c652)){logger[_0xc01d('0x42')](_0xc01d('0xa6'),_0x55c652[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x55c652,{'showHidden':![],'depth':null}));this[_0xc01d('0xa7')](_0x55c652['uniqueid'],_[_0xc01d('0x78')](_0x55c652['variable'])[0x0],_0x55c652[_0xc01d('0xa8')]);if(this['queueReports'][_0x55c652[_0xc01d('0x44')]]){var _0x548975=_[_0xc01d('0x7c')](this[_0xc01d('0xf')][_0x55c652[_0xc01d('0x44')]]);if(_0x548975){if(this[_0xc01d('0x5c')](_0x55c652['variable'])&&this[_0xc01d('0x5c')](_0x55c652[_0xc01d('0xa9')]['queuestatus'])){switch(_0x55c652[_0xc01d('0xa8')]){case _0xc01d('0xaa'):_0x548975[_0xc01d('0x92')]=![];_0x548975[_0xc01d('0x93')]=null;break;case _0xc01d('0xab'):_0x548975[_0xc01d('0xac')]=_0xc01d('0xad');_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xc01d('0x42')](_0xc01d('0xae'),_0x55c652[_0xc01d('0x44')],util['inspect'](_0x548975,{'showHidden':![],'depth':null}));ami[_0xc01d('0x41')](_0xc01d('0xaf'),_0x548975);break;default:_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));}_0x548975['queuecallerabandon']=![];_0x548975[_0xc01d('0x8f')]=null;_0x548975[_0xc01d('0x48')]=_0x55c652['value'];this['channels'][_0x55c652[_0xc01d('0x44')]]=_0x548975;this[_0xc01d('0x3f')](_0x548975,_0xc01d('0x20'));}else if(this['isNotNull'](_0x55c652[_0xc01d('0xa9')])&&this['isNotNull'](_0x55c652[_0xc01d('0xa9')][_0xc01d('0xb0')])){if(!_0x548975[_0xc01d('0x80')]){_0x548975[_0xc01d('0x92')]=!![];_0x548975[_0xc01d('0x93')]=moment()['format'](_0xc01d('0x71'));_0x548975[_0xc01d('0x48')]=_0xc01d('0xb1');_0x548975[_0xc01d('0x84')]=moment()[_0xc01d('0x45')](_0xc01d('0x71'));this[_0xc01d('0x11')][_0x55c652[_0xc01d('0x44')]]=_0x548975;}}logger[_0xc01d('0x86')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x55c652[_0xc01d('0x44')],_0x548975['name'],_0x548975[_0xc01d('0x4d')],_[_0xc01d('0x78')](_0x55c652[_0xc01d('0xa9')])[0x0],_0x55c652[_0xc01d('0xa8')]);_0x548975[_0xc01d('0x16')]=this[_0xc01d('0x16')][_0x55c652[_0xc01d('0x44')]];}}}}catch(_0x2a63c7){logger[_0xc01d('0x3a')](_0xc01d('0xa6'),_0x55c652[_0xc01d('0x44')],util[_0xc01d('0x3c')](_0x2a63c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc01d('0xb')][_0xc01d('0xa7')]=function(_0x59822d,_0x40a297,_0x1d62d9){var _0x5864ee=['rtpaudioqos',_0xc01d('0xb2'),_0xc01d('0xb3'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0xc01d('0xb4'),'rtpaudioqosrtt',_0xc01d('0xb5'),_0xc01d('0xb6'),_0xc01d('0xb7'),_0xc01d('0xb8'),_0xc01d('0xb9'),_0xc01d('0xba'),'memberdynamic','memberinterface','memberlastcall',_0xc01d('0x91'),_0xc01d('0xbb'),_0xc01d('0xbc')];if(!_[_0xc01d('0x35')](_0x40a297)&&!_[_0xc01d('0xbd')](_0x5864ee,_0x40a297)){if(_[_0xc01d('0x5d')](this[_0xc01d('0x16')][_0x59822d])){this[_0xc01d('0x16')][_0x59822d]={};}this[_0xc01d('0x16')][_0x59822d][_0x40a297]=_0x1d62d9;}};VoiceQueueReport[_0xc01d('0xb')]['handleHangup']=function(_0x3d45dc,_0x462eb8,_0x41f92c){var _0x5d9a8b={};for(var _0x18cfef=0x0;_0x18cfef0x0?_0x2d5312:0x0;this[_0x1b7f('0xe')][_0x17cbf5['queue']][_0x1b7f('0x30')]=this[_0x1b7f('0xe')][_0x17cbf5[_0x1b7f('0x6a')]]['talking']>_[_0x1b7f('0x6d')](_0x17cbf5[_0x1b7f('0x6f')])?_['toNumber'](_0x17cbf5[_0x1b7f('0x6f')]):this[_0x1b7f('0xe')][_0x17cbf5[_0x1b7f('0x6a')]][_0x1b7f('0x30')];this[_0x1b7f('0x51')](this[_0x1b7f('0xe')][_0x17cbf5[_0x1b7f('0x6a')]],_0x1b7f('0x12'));}logger[_0x1b7f('0x45')](_0x1b7f('0x70'),util['inspect'](this[_0x1b7f('0xe')][_0x17cbf5[_0x1b7f('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x1b7f('0x43')]('custom:queuesummary',this[_0x1b7f('0xe')][_0x17cbf5['queue']]);}}}catch(_0x151f17){logger['error'](_0x1b7f('0x68'),util[_0x1b7f('0x3d')](_0x151f17,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b7f('0x33')][_0x1b7f('0x14')]=function(_0x356c9a){logger[_0x1b7f('0x45')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x1b7f('0x3d')](_0x356c9a,{'showHidden':![],'depth':null}));ami[_0x1b7f('0x43')](_0x1b7f('0x71'),{});this['flagQueueSummary']=!![];};VoiceQueueReport[_0x1b7f('0x33')][_0x1b7f('0x17')]=function(_0x2864f6){try{if(this[_0x1b7f('0x61')](_0x2864f6)){logger[_0x1b7f('0x45')](_0x1b7f('0x72'),_0x2864f6[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x2864f6,{'showHidden':![],'depth':null}));if(_[_0x1b7f('0x62')](this[_0x1b7f('0x3e')][_0x2864f6[_0x1b7f('0x48')]]))this[_0x1b7f('0x3e')][_0x2864f6[_0x1b7f('0x48')]]=[];if(_[_0x1b7f('0x62')](this['channels'][_0x2864f6[_0x1b7f('0x48')]]))this[_0x1b7f('0x35')][_0x2864f6[_0x1b7f('0x48')]]={};var _0x4ad3b5=new QueueReport();_0x4ad3b5['name']=_0x2864f6[_0x1b7f('0x6a')];_0x4ad3b5[_0x1b7f('0x57')]=this['voiceQueues'][_0x4ad3b5[_0x1b7f('0x4a')]]&&this[_0x1b7f('0xe')][_0x4ad3b5[_0x1b7f('0x4a')]]['type']?this['voiceQueues'][_0x4ad3b5[_0x1b7f('0x4a')]]['type']||_0x1b7f('0x52'):_0x1b7f('0x52');_0x4ad3b5['queue']=_0x2864f6[_0x1b7f('0x6a')];_0x4ad3b5[_0x1b7f('0x73')]=moment()[_0x1b7f('0x4f')](_0x1b7f('0x74'));_0x4ad3b5[_0x1b7f('0x75')]=_0x2864f6[_0x1b7f('0x75')];_0x4ad3b5[_0x1b7f('0x76')]=_0x2864f6[_0x1b7f('0x76')];_0x4ad3b5[_0x1b7f('0x48')]=_0x2864f6[_0x1b7f('0x48')];_0x4ad3b5[_0x1b7f('0x77')]=this[_0x1b7f('0x35')][_0x2864f6['uniqueid']][_0x1b7f('0x77')];logger[_0x1b7f('0x6b')](_0x1b7f('0x78'),_0x4ad3b5[_0x1b7f('0x4a')],_0x4ad3b5[_0x1b7f('0x57')]);_[_0x1b7f('0x79')](_0x4ad3b5,_[_0x1b7f('0x7a')](_0x2864f6,_['keys'](_0x4ad3b5)));this[_0x1b7f('0x3e')][_0x2864f6[_0x1b7f('0x48')]][_0x1b7f('0x7b')](_0x4ad3b5);this['channels'][_0x2864f6[_0x1b7f('0x48')]]=_0x4ad3b5;this[_0x1b7f('0x44')](_0x4ad3b5,'queuecallerjoin');}}catch(_0x11f0e5){logger[_0x1b7f('0x3b')](_0x1b7f('0x72'),_0x2864f6[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x11f0e5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b7f('0x33')][_0x1b7f('0x19')]=function(_0x9562c7){try{if(this[_0x1b7f('0x61')](_0x9562c7)){logger[_0x1b7f('0x45')](_0x1b7f('0x7c'),_0x9562c7[_0x1b7f('0x48')],util['inspect'](_0x9562c7,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x9562c7[_0x1b7f('0x48')]]){var _0x266650=_['last'](this['queueReports'][_0x9562c7[_0x1b7f('0x48')]]);_0x266650[_0x1b7f('0x7d')]=![];_0x266650[_0x1b7f('0x7e')]=null;_0x266650[_0x1b7f('0x7f')]=_0x9562c7[_0x1b7f('0x7f')];_0x266650[_0x1b7f('0x80')]=_0x9562c7[_0x1b7f('0x80')];_0x266650[_0x1b7f('0x18')]=!![];_0x266650[_0x1b7f('0x81')]=moment()[_0x1b7f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x266650[_0x1b7f('0x4d')]=_0x1b7f('0x82');_0x266650[_0x1b7f('0x83')]=null;logger[_0x1b7f('0x6b')](_0x1b7f('0x84'),_0x266650['name'],_0x266650[_0x1b7f('0x57')]);this[_0x1b7f('0x35')][_0x9562c7[_0x1b7f('0x48')]]=_0x266650;this['emitVoiceQueueChannelRemove'](_0x266650,'queuecallerabandon');}}}catch(_0x38c6b8){logger[_0x1b7f('0x3b')](_0x1b7f('0x7c'),_0x9562c7[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x38c6b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1b7f('0x85')]=function(_0xe178f9){try{if(this[_0x1b7f('0x61')](_0xe178f9)){logger[_0x1b7f('0x45')]('[%s][voiceQueueReport][queuecallerleave]',_0xe178f9[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0xe178f9,{'showHidden':![],'depth':null}));if(this[_0x1b7f('0x3e')][_0xe178f9[_0x1b7f('0x48')]]){var _0x6e29c4=_[_0x1b7f('0x86')](this[_0x1b7f('0x3e')][_0xe178f9[_0x1b7f('0x48')]]);_0x6e29c4['queuecallerleaveAt']=moment()[_0x1b7f('0x4f')](_0x1b7f('0x74'));_0x6e29c4[_0x1b7f('0x87')]=_0xe178f9[_0x1b7f('0x87')];_0x6e29c4[_0x1b7f('0x88')]=_0xe178f9[_0x1b7f('0x88')];logger[_0x1b7f('0x6b')](_0x1b7f('0x89'),_0x6e29c4[_0x1b7f('0x4a')],_0x6e29c4['type'],_0xe178f9[_0x1b7f('0x87')],_0xe178f9[_0x1b7f('0x88')]);this[_0x1b7f('0x35')][_0xe178f9[_0x1b7f('0x48')]]=_0x6e29c4;this[_0x1b7f('0x44')](_0x6e29c4,'queuecallerleave');}}}catch(_0x63e961){logger[_0x1b7f('0x3b')](_0x1b7f('0x8a'),_0xe178f9[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x63e961,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b7f('0x33')]['syncAgentConnect']=function(_0x531509){try{if(this['isNotNull'](_0x531509)){logger[_0x1b7f('0x45')](_0x1b7f('0x8b'),_0x531509[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x531509,{'showHidden':![],'depth':null}));if(this[_0x1b7f('0x3e')][_0x531509[_0x1b7f('0x48')]]){var _0xfb7b49=_[_0x1b7f('0x86')](this['queueReports'][_0x531509[_0x1b7f('0x48')]]);_0xfb7b49[_0x1b7f('0x7d')]=!![];_0xfb7b49[_0x1b7f('0x4d')]=_0x1b7f('0x8c');logger[_0x1b7f('0x6b')](_0x1b7f('0x8d'),_0xfb7b49['name'],_0xfb7b49[_0x1b7f('0x57')]);}}}catch(_0x5e0afb){logger['error'](_0x1b7f('0x8b'),_0x531509[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x5e0afb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x1b7f('0x1c')]=function(_0xfd6b0b){try{if(this[_0x1b7f('0x61')](_0xfd6b0b)){logger[_0x1b7f('0x45')](_0x1b7f('0x8e'),_0xfd6b0b[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0xfd6b0b,{'showHidden':![],'depth':null}));if(this[_0x1b7f('0x3e')][_0xfd6b0b['uniqueid']]){var _0x1d8b5b=_[_0x1b7f('0x86')](this[_0x1b7f('0x3e')][_0xfd6b0b[_0x1b7f('0x48')]]);_0x1d8b5b[_0x1b7f('0x18')]=![];_0x1d8b5b[_0x1b7f('0x81')]=null;_0x1d8b5b[_0x1b7f('0x8f')]=!![];_0x1d8b5b[_0x1b7f('0x83')]=_0xfd6b0b[_0x1b7f('0x90')];_0x1d8b5b[_0x1b7f('0x7f')]=_0xfd6b0b[_0x1b7f('0x7f')];_0x1d8b5b[_0x1b7f('0x7d')]=!![];_0x1d8b5b['queuecallerexit']=![];_0x1d8b5b[_0x1b7f('0x91')]=null;if(!_0x1d8b5b[_0x1b7f('0x92')]){if(_0xfd6b0b[_0x1b7f('0x93')]==_0x1b7f('0x92')){_0x1d8b5b['queuecallerexitreason']=_0x1b7f('0x94');logger[_0x1b7f('0x6b')](_0x1b7f('0x95'),_0x1d8b5b['name'],_0x1d8b5b[_0x1b7f('0x57')]);}else{if(_[_0x1b7f('0x96')](_0xfd6b0b['channel'][_0x1b7f('0x97')](),_0x1b7f('0x98'))){if(this[_0x1b7f('0x3e')][_0xfd6b0b['linkedid']]){var _0xc633c3=_['last'](this[_0x1b7f('0x3e')][_0xfd6b0b[_0x1b7f('0x99')]]);_0xc633c3['queuecallercomplete']=![];_0xc633c3[_0x1b7f('0x9a')]=!![];_0xc633c3[_0x1b7f('0x91')]=moment(_0x1d8b5b[_0x1b7f('0x73')])[_0x1b7f('0x9b')](_0xfd6b0b[_0x1b7f('0x7f')],_0x1b7f('0x9c'))[_0x1b7f('0x4f')](_0x1b7f('0x74'));_0xc633c3[_0x1b7f('0x4d')]=_0x1b7f('0x9d');_0xc633c3[_0x1b7f('0x92')]=!![];_0xc633c3[_0x1b7f('0x9e')]=_0x1b7f('0x9f');_0xc633c3[_0x1b7f('0xa0')]=_0xfd6b0b['destexten'];_0xc633c3['transferuniqueid']=_0xfd6b0b[_0x1b7f('0x48')];logger[_0x1b7f('0x6b')](_0x1b7f('0xa1'),_0xc633c3['name'],_0xc633c3[_0x1b7f('0x57')]);var _0x1a48a3=this[_0x1b7f('0x3e')][_0xfd6b0b[_0x1b7f('0x99')]];this[_0x1b7f('0x3e')][_0xfd6b0b['linkedid']]=this[_0x1b7f('0x3e')][_0xfd6b0b[_0x1b7f('0x48')]];this[_0x1b7f('0x3e')][_0xfd6b0b[_0x1b7f('0x48')]]=_0x1a48a3;}}else{_0x1d8b5b[_0x1b7f('0x4d')]='COMPLETEDBY'+_0xfd6b0b[_0x1b7f('0x93')][_0x1b7f('0xa2')]();logger[_0x1b7f('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1d8b5b[_0x1b7f('0x4a')],_0x1d8b5b[_0x1b7f('0x57')],_0x1d8b5b[_0x1b7f('0x4d')]);}}}this[_0x1b7f('0x35')][_0xfd6b0b[_0x1b7f('0x48')]]=_0x1d8b5b;this[_0x1b7f('0x4c')](_0x1d8b5b,'agentcomplete');}}}catch(_0x493707){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0xfd6b0b[_0x1b7f('0x48')],util['inspect'](_0x493707,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b7f('0x33')][_0x1b7f('0xa3')]=function(_0x363d29){try{if(this[_0x1b7f('0x61')](_0x363d29)){logger[_0x1b7f('0x45')](_0x1b7f('0xa4'),_0x363d29['uniqueid'],util[_0x1b7f('0x3d')](_0x363d29,{'showHidden':![],'depth':null}));this[_0x1b7f('0xa5')](_0x363d29['uniqueid'],_[_0x1b7f('0xa6')](_0x363d29[_0x1b7f('0xa7')])[0x0],_0x363d29[_0x1b7f('0xa8')]);if(this[_0x1b7f('0x3e')][_0x363d29[_0x1b7f('0x48')]]){var _0x54d8b2=_[_0x1b7f('0x86')](this['queueReports'][_0x363d29[_0x1b7f('0x48')]]);if(_0x54d8b2){if(this[_0x1b7f('0x61')](_0x363d29[_0x1b7f('0xa7')])&&this[_0x1b7f('0x61')](_0x363d29['variable'][_0x1b7f('0xa9')])){switch(_0x363d29[_0x1b7f('0xa8')]){case _0x1b7f('0xaa'):_0x54d8b2[_0x1b7f('0x9a')]=![];_0x54d8b2[_0x1b7f('0x91')]=null;break;case'TIMEOUT':_0x54d8b2[_0x1b7f('0xab')]=_0x1b7f('0xac');_0x54d8b2[_0x1b7f('0x9a')]=!![];_0x54d8b2[_0x1b7f('0x91')]=moment()['format'](_0x1b7f('0x74'));_0x54d8b2[_0x1b7f('0xad')]=moment()[_0x1b7f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug'](_0x1b7f('0xae'),_0x363d29[_0x1b7f('0x48')],util[_0x1b7f('0x3d')](_0x54d8b2,{'showHidden':![],'depth':null}));ami[_0x1b7f('0x43')](_0x1b7f('0xaf'),_0x54d8b2);break;default:_0x54d8b2[_0x1b7f('0x9a')]=!![];_0x54d8b2[_0x1b7f('0x91')]=moment()[_0x1b7f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x54d8b2[_0x1b7f('0xad')]=moment()[_0x1b7f('0x4f')](_0x1b7f('0x74'));}_0x54d8b2[_0x1b7f('0x18')]=![];_0x54d8b2[_0x1b7f('0x81')]=null;_0x54d8b2[_0x1b7f('0x4d')]=_0x363d29[_0x1b7f('0xa8')];this[_0x1b7f('0x35')][_0x363d29[_0x1b7f('0x48')]]=_0x54d8b2;this[_0x1b7f('0x4c')](_0x54d8b2,_0x1b7f('0x1f'));}else if(this[_0x1b7f('0x61')](_0x363d29[_0x1b7f('0xa7')])&&this['isNotNull'](_0x363d29[_0x1b7f('0xa7')][_0x1b7f('0xb0')])){if(!_0x54d8b2[_0x1b7f('0x18')]){_0x54d8b2[_0x1b7f('0x9a')]=!![];_0x54d8b2[_0x1b7f('0x91')]=moment()[_0x1b7f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x54d8b2[_0x1b7f('0x4d')]=_0x1b7f('0xb1');_0x54d8b2[_0x1b7f('0xad')]=moment()[_0x1b7f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1b7f('0x35')][_0x363d29['uniqueid']]=_0x54d8b2;}}logger[_0x1b7f('0x6b')](_0x1b7f('0xb2'),_0x363d29[_0x1b7f('0x48')],_0x54d8b2['name'],_0x54d8b2[_0x1b7f('0x57')],_[_0x1b7f('0xa6')](_0x363d29[_0x1b7f('0xa7')])[0x0],_0x363d29[_0x1b7f('0xa8')]);_0x54d8b2['variables']=this[_0x1b7f('0x11')][_0x363d29[_0x1b7f('0x48')]];}}}}catch(_0x18147f){logger[_0x1b7f('0x3b')]('[%s][voiceQueueReport][varset]',_0x363d29['uniqueid'],util[_0x1b7f('0x3d')](_0x18147f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x1b7f('0x33')]['addVariable']=function(_0x765a17,_0xb19b21,_0x4c986f){var _0x56c958=[_0x1b7f('0xb3'),'rtpaudioqosbridged',_0x1b7f('0xb4'),_0x1b7f('0xb5'),'rtpaudioqosloss',_0x1b7f('0xb6'),_0x1b7f('0xb7'),_0x1b7f('0xb8'),_0x1b7f('0xb9'),'sipuri',_0x1b7f('0xba'),_0x1b7f('0xbb'),'membercalls',_0x1b7f('0xbc'),_0x1b7f('0xbd'),_0x1b7f('0xbe'),_0x1b7f('0x90'),_0x1b7f('0xbf'),_0x1b7f('0xc0')];if(!_[_0x1b7f('0x37')](_0xb19b21)&&!_[_0x1b7f('0xc1')](_0x56c958,_0xb19b21)){if(_[_0x1b7f('0x62')](this[_0x1b7f('0x11')][_0x765a17])){this[_0x1b7f('0x11')][_0x765a17]={};}this['variables'][_0x765a17][_0xb19b21]=_0x4c986f;}};VoiceQueueReport[_0x1b7f('0x33')]['handleHangup']=function(_0x34700e,_0x884c69,_0xb3058){var _0x215097={};for(var _0x403efb=0x0;_0x403efb=0x0?moment(_0x174853[_0x9a91('0x15')])['diff'](_0x174853['starttime'],_0x9a91('0x16')):null,'data1':'outbound','data2':_0x174853[_0x9a91('0x11')],'data3':_0x174853['exten'],'data4':_0x174853[_0x9a91('0x17')]||null,'role':'agent','internal':_0x174853[_0x9a91('0x11')]?_[_0x9a91('0x18')](_0x174853[_0x9a91('0x11')]):undefined,'uniqueid':_0x174853[_0x9a91('0x19')]},'log':_0x9a91('0x7')});}; \ No newline at end of file +var _0xd289=['TALKING','queuecallerleaveAt','diff','inbound','exten','agent','toNumber','uniqueid','voiceDialReport','voice','membername','starttime','seconds','endtime','outbound','accountcode','dialstring','moment','util','../client','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s'];(function(_0x39017c,_0x15f210){var _0x584624=function(_0x48afe4){while(--_0x48afe4){_0x39017c['push'](_0x39017c['shift']());}};_0x584624(++_0x15f210);}(_0xd289,0x1b5));var _0x9d28=function(_0x558097,_0x5a6cc2){_0x558097=_0x558097-0x0;var _0xe80464=_0xd289[_0x558097];return _0xe80464;};'use strict';var moment=require(_0x9d28('0x0'));var _=require('lodash');var util=require(_0x9d28('0x1'));var client=require(_0x9d28('0x2'));exports['voiceQueueReport']=function(_0x5a1da4){var _0x5cd612=_0x5a1da4['queuecallercompleteAt']||_0x5a1da4[_0x9d28('0x3')];return client[_0x9d28('0x4')](_0x9d28('0x5'),{'body':{'channel':'voice','membername':_0x5a1da4[_0x9d28('0x6')],'interface':_[_0x9d28('0x7')](_0x5a1da4[_0x9d28('0x8')])?util[_0x9d28('0x9')](_0x9d28('0xa'),_0x5a1da4['lastAssignedTo']):_0x5a1da4[_0x9d28('0x8')],'type':_0x9d28('0xb'),'enterAt':_0x5a1da4[_0x9d28('0xc')],'exitAt':_0x5cd612,'duration':moment(_0x5cd612)[_0x9d28('0xd')](_0x5a1da4[_0x9d28('0xc')],'seconds'),'data1':_0x9d28('0xe'),'data2':_0x5a1da4['calleridnum'],'data3':_0x5a1da4[_0x9d28('0xf')],'data4':null,'data5':_0x5a1da4['queue'],'role':_0x9d28('0x10'),'internal':_0x5a1da4['accountcode']?_[_0x9d28('0x11')](_0x5a1da4['accountcode']):undefined,'uniqueid':_0x5a1da4[_0x9d28('0x12')]},'log':_0x9d28('0x5')});};exports[_0x9d28('0x13')]=function(_0x1ec0bc){return client[_0x9d28('0x4')](_0x9d28('0x5'),{'body':{'channel':_0x9d28('0x14'),'membername':_0x1ec0bc[_0x9d28('0x15')],'interface':_0x1ec0bc['interface'],'type':'TALKING','enterAt':_0x1ec0bc[_0x9d28('0x16')],'exitAt':_0x1ec0bc['endtime'],'duration':moment(_0x1ec0bc['endtime'])['diff'](_0x1ec0bc[_0x9d28('0x16')],_0x9d28('0x17'))>=0x0?moment(_0x1ec0bc[_0x9d28('0x18')])[_0x9d28('0xd')](_0x1ec0bc[_0x9d28('0x16')],'seconds'):null,'data1':_0x9d28('0x19'),'data2':_0x1ec0bc[_0x9d28('0x1a')],'data3':_0x1ec0bc[_0x9d28('0xf')],'data4':_0x1ec0bc[_0x9d28('0x1b')]||null,'role':_0x9d28('0x10'),'internal':_0x1ec0bc[_0x9d28('0x1a')]?_[_0x9d28('0x11')](_0x1ec0bc[_0x9d28('0x1a')]):undefined,'uniqueid':_0x1ec0bc['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 6e76af4..cb8ab79 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 _0xcac2=['Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client','getSettings'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0xcac2,0x1e8));var _0x2cac=function(_0x4ea693,_0xdb632f){_0x4ea693=_0x4ea693-0x0;var _0x46730b=_0xcac2[_0x4ea693];return _0x46730b;};'use strict';var client=require(_0x2cac('0x0'));exports[_0x2cac('0x1')]=function(){return client[_0x2cac('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x2cac('0x3'),_0x2cac('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x5386=['GetSettings','../client','getSettings','Request','ShowSetting','previewRecallmeReminderInterval'];(function(_0x4b1bb0,_0x7dc32b){var _0x549407=function(_0xa08deb){while(--_0xa08deb){_0x4b1bb0['push'](_0x4b1bb0['shift']());}};_0x549407(++_0x7dc32b);}(_0x5386,0x1e1));var _0x6538=function(_0xb03f9,_0x588391){_0xb03f9=_0xb03f9-0x0;var _0x3ec30a=_0x5386[_0xb03f9];return _0x3ec30a;};'use strict';var client=require(_0x6538('0x0'));exports[_0x6538('0x1')]=function(){return client[_0x6538('0x2')](_0x6538('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6538('0x4')]},'log':_0x6538('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 34dd996..6aa0008 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 _0x6f62=['../client','getTemplates','Request','GetTemplate','name','html'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x6f62,0x12c));var _0x26f6=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x6f62[_0x5a3cf0];return _0x5a64ee;};'use strict';var client=require(_0x26f6('0x0'));exports[_0x26f6('0x1')]=function(_0x59041a){return function(_0x3bd771){return client[_0x26f6('0x2')](_0x26f6('0x3'),{'options':{'raw':!![],'attributes':['id',_0x26f6('0x4'),_0x26f6('0x5')]},'log':_0x26f6('0x3')});};}; \ No newline at end of file +var _0xb22d=['name','html','../client','Request','GetTemplate'];(function(_0x60fa8a,_0x330410){var _0x5da7fd=function(_0x2770d4){while(--_0x2770d4){_0x60fa8a['push'](_0x60fa8a['shift']());}};_0x5da7fd(++_0x330410);}(_0xb22d,0x75));var _0xdb22=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xb22d[_0x4d8ed9];return _0x1e2140;};'use strict';var client=require(_0xdb22('0x0'));exports['getTemplates']=function(_0x50cd19){return function(_0x12c73f){return client[_0xdb22('0x1')](_0xdb22('0x2'),{'options':{'raw':!![],'attributes':['id',_0xdb22('0x3'),_0xdb22('0x4')]},'log':_0xdb22('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 2380ca7..8d38965 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 _0xe8ea=['operator','value','AnyConditions','Action','Actions','action','data1','data2','data4','data6','../client','Request','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x4b85fe,_0x5d621b){var _0x2ecab7=function(_0x4c6c21){while(--_0x4c6c21){_0x4b85fe['push'](_0x4b85fe['shift']());}};_0x2ecab7(++_0x5d621b);}(_0xe8ea,0xa2));var _0xae8e=function(_0x465655,_0x4eb676){_0x465655=_0x465655-0x0;var _0x4fa2a4=_0xe8ea[_0x465655];return _0x4fa2a4;};'use strict';var client=require(_0xae8e('0x0'));exports['getTriggers']=function(_0xe42990){return function(_0x1bdd9b){return client[_0xae8e('0x1')](_0xae8e('0x2'),{'options':{'raw':![],'attributes':['id',_0xae8e('0x3'),_0xae8e('0x4'),_0xae8e('0x5')],'include':[{'model':_0xae8e('0x6'),'as':_0xae8e('0x7'),'attributes':['id',_0xae8e('0x8'),_0xae8e('0x9'),_0xae8e('0xa')]},{'model':_0xae8e('0x6'),'as':_0xae8e('0xb'),'attributes':['id',_0xae8e('0x8'),_0xae8e('0x9'),_0xae8e('0xa')]},{'model':_0xae8e('0xc'),'as':_0xae8e('0xd'),'attributes':['id',_0xae8e('0xe'),_0xae8e('0xf'),_0xae8e('0x10'),'data3',_0xae8e('0x11'),'data5',_0xae8e('0x12'),'data7']}]},'log':_0xae8e('0x2')});};}; \ No newline at end of file +var _0x9cc3=['status','Condition','AllConditions','field','AnyConditions','operator','value','Action','Actions','action','data1','data4','data7','../client','getTriggers','Request','GetTrigger','name','channel'];(function(_0x53acaf,_0x51dd1a){var _0x371fc3=function(_0x13df73){while(--_0x13df73){_0x53acaf['push'](_0x53acaf['shift']());}};_0x371fc3(++_0x51dd1a);}(_0x9cc3,0x6c));var _0x39cc=function(_0x4a9f89,_0x435df5){_0x4a9f89=_0x4a9f89-0x0;var _0x19d645=_0x9cc3[_0x4a9f89];return _0x19d645;};'use strict';var client=require(_0x39cc('0x0'));exports[_0x39cc('0x1')]=function(_0x28ed6e){return function(_0x4f68ea){return client[_0x39cc('0x2')](_0x39cc('0x3'),{'options':{'raw':![],'attributes':['id',_0x39cc('0x4'),_0x39cc('0x5'),_0x39cc('0x6')],'include':[{'model':_0x39cc('0x7'),'as':_0x39cc('0x8'),'attributes':['id',_0x39cc('0x9'),'operator','value']},{'model':_0x39cc('0x7'),'as':_0x39cc('0xa'),'attributes':['id',_0x39cc('0x9'),_0x39cc('0xb'),_0x39cc('0xc')]},{'model':_0x39cc('0xd'),'as':_0x39cc('0xe'),'attributes':['id',_0x39cc('0xf'),_0x39cc('0x10'),'data2','data3',_0x39cc('0x11'),'data5','data6',_0x39cc('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c3d52b4..e5dc9b6 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 _0x64e1=['defaultuser','../client','getTrunks'];(function(_0x3a2a78,_0x2daec8){var _0x19a353=function(_0x4bf730){while(--_0x4bf730){_0x3a2a78['push'](_0x3a2a78['shift']());}};_0x19a353(++_0x2daec8);}(_0x64e1,0x9a));var _0x164e=function(_0x128576,_0x12e43b){_0x128576=_0x128576-0x0;var _0x194603=_0x64e1[_0x128576];return _0x194603;};'use strict';var client=require(_0x164e('0x0'));exports[_0x164e('0x1')]=function(_0x1c3895){return function(_0x2d17b1){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x164e('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0xfde9=['../client','getTrunks','Request','name','registry','GetTrunk'];(function(_0x5aa485,_0x1637cb){var _0x365d3e=function(_0x4594c6){while(--_0x4594c6){_0x5aa485['push'](_0x5aa485['shift']());}};_0x365d3e(++_0x1637cb);}(_0xfde9,0x66));var _0x9fde=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0xfde9[_0x49aa7d];return _0xdd0d26;};'use strict';var client=require(_0x9fde('0x0'));exports[_0x9fde('0x1')]=function(_0x27dcb7){return function(_0x1c2167){return client[_0x9fde('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x9fde('0x3'),_0x9fde('0x4'),'defaultuser']},'log':_0x9fde('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 7caff01..9cbbf8e 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(_0x2535ec,_0x47ec48){var _0x23cede=function(_0x59188e){while(--_0x59188e){_0x2535ec['push'](_0x2535ec['shift']());}};_0x23cede(++_0x47ec48);}(_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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ea3eb95..ce8fb16 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 _0x1961=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x5829b0,_0x285159){var _0x5eb18c=function(_0x51127b){while(--_0x51127b){_0x5829b0['push'](_0x5829b0['shift']());}};_0x5eb18c(++_0x285159);}(_0x1961,0x7f));var _0x1196=function(_0x3ff33f,_0x3404f9){_0x3ff33f=_0x3ff33f-0x0;var _0x50e3d1=_0x1961[_0x3ff33f];return _0x50e3d1;};'use strict';var client=require(_0x1196('0x0'));exports[_0x1196('0x1')]=function(_0x3cbd94){return client[_0x1196('0x2')](_0x1196('0x3'),{'body':_0x3cbd94,'log':'CreateVoiceAgentReport'});};exports[_0x1196('0x4')]=function(_0xa7832c,_0x509980,_0x34116d){return client['Request']('UpdateVoiceAgentReport',{'body':_0xa7832c,'options':{'where':{'uniqueid':_0x509980,'interface':_0x34116d,'agentcomplete':!![]}},'log':_0x1196('0x5')});}; \ No newline at end of file +var _0x0275=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x0275,0x10a));var _0x5027=function(_0x202e67,_0x492c20){_0x202e67=_0x202e67-0x0;var _0x2590c7=_0x0275[_0x202e67];return _0x2590c7;};'use strict';var client=require(_0x5027('0x0'));exports[_0x5027('0x1')]=function(_0x43ecff){return client['Request']('CreateVoiceAgentReport',{'body':_0x43ecff,'log':_0x5027('0x2')});};exports[_0x5027('0x3')]=function(_0x1c0bf8,_0x567247,_0x355e0f){return client[_0x5027('0x4')](_0x5027('0x5'),{'body':_0x1c0bf8,'options':{'where':{'uniqueid':_0x567247,'interface':_0x355e0f,'agentcomplete':!![]}},'log':_0x5027('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index b45c850..72697bc 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 _0xb8f1=['outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','duration','billableseconds','GetVoiceCallReports','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','GetVoiceCallReport'];(function(_0x1ef6fa,_0x4fd8c6){var _0x54977d=function(_0x153699){while(--_0x153699){_0x1ef6fa['push'](_0x1ef6fa['shift']());}};_0x54977d(++_0x4fd8c6);}(_0xb8f1,0x180));var _0x1b8f=function(_0xc1676d,_0x2f2b98){_0xc1676d=_0xc1676d-0x0;var _0x2e9c2d=_0xb8f1[_0xc1676d];return _0x2e9c2d;};'use strict';var moment=require('moment');var util=require(_0x1b8f('0x0'));var _=require(_0x1b8f('0x1'));var client=require(_0x1b8f('0x2'));exports[_0x1b8f('0x3')]=function(_0x26d9ad){return client[_0x1b8f('0x4')](_0x1b8f('0x5'),{'body':_[_0x1b8f('0x6')](_0x26d9ad,{'source':_0x26d9ad[_0x1b8f('0x7')],'destinationcontext':_0x26d9ad[_0x1b8f('0x8')],'callerid':_0x26d9ad[_0x1b8f('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0x1b8f('0x5')});};exports[_0x1b8f('0xa')]=function(){return function(){return client[_0x1b8f('0x4')](_0x1b8f('0xb'),{'options':{'where':{'type':[_0x1b8f('0xc')],'createdAt':{'$between':[moment()[_0x1b8f('0xd')](_0x1b8f('0xe'))[_0x1b8f('0xf')](_0x1b8f('0x10')),moment()[_0x1b8f('0x11')](_0x1b8f('0xe'))[_0x1b8f('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x1b8f('0x12'),'disposition',_0x1b8f('0x13'),_0x1b8f('0x14')]},'log':_0x1b8f('0x15')});};}; \ No newline at end of file +var _0x992b=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment','util','create','Request','CreateVoiceCallReport','merge','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x992b,0x1d4));var _0xb992=function(_0x5d47a4,_0xcd8459){_0x5d47a4=_0x5d47a4-0x0;var _0x545e1f=_0x992b[_0x5d47a4];return _0x545e1f;};'use strict';var moment=require(_0xb992('0x0'));var util=require(_0xb992('0x1'));var _=require('lodash');var client=require('../client');exports[_0xb992('0x2')]=function(_0x2d7b2e){return client[_0xb992('0x3')](_0xb992('0x4'),{'body':_[_0xb992('0x5')](_0x2d7b2e,{'source':_0x2d7b2e['calleridnum'],'destinationcontext':_0x2d7b2e[_0xb992('0x6')],'callerid':_0x2d7b2e[_0xb992('0x7')],'amaflags':_0xb992('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0xb992('0x9')]=function(){return function(){return client[_0xb992('0x3')](_0xb992('0xa'),{'options':{'where':{'type':[_0xb992('0xb')],'createdAt':{'$between':[moment()[_0xb992('0xc')](_0xb992('0xd'))[_0xb992('0xe')](_0xb992('0xf')),moment()[_0xb992('0x10')]('day')[_0xb992('0xe')](_0xb992('0xf'))]}},'attributes':[_0xb992('0x11'),_0xb992('0x12'),_0xb992('0x13'),_0xb992('0x14')]},'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 45afa9e..8c2fe76 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 _0x3470=['../client','create','CreateVoiceDialReport'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x3470,0x180));var _0x0347=function(_0x4f6f97,_0x1de0b6){_0x4f6f97=_0x4f6f97-0x0;var _0x44b012=_0x3470[_0x4f6f97];return _0x44b012;};'use strict';var client=require(_0x0347('0x0'));exports[_0x0347('0x1')]=function(_0x5cb6d3){return client['Request'](_0x0347('0x2'),{'body':_0x5cb6d3,'log':_0x0347('0x2')});}; \ No newline at end of file +var _0x6318=['Request','CreateVoiceDialReport','create'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x6318,0x19d));var _0x8631=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x6318[_0x7e2eb0];return _0xd92de4;};'use strict';var client=require('../client');exports[_0x8631('0x0')]=function(_0x15a115){return client[_0x8631('0x1')](_0x8631('0x2'),{'body':_0x15a115,'log':_0x8631('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 1a4ec8e..f2c3aeb 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 _0x0e9f=['getVoiceExtensions','exten','../client'];(function(_0x2524f3,_0x13f76c){var _0x16d192=function(_0x17e7d5){while(--_0x17e7d5){_0x2524f3['push'](_0x2524f3['shift']());}};_0x16d192(++_0x13f76c);}(_0x0e9f,0x116));var _0xf0e9=function(_0xf5e995,_0x38d3d9){_0xf5e995=_0xf5e995-0x0;var _0x57bc34=_0x0e9f[_0xf5e995];return _0x57bc34;};'use strict';var client=require(_0xf0e9('0x0'));exports[_0xf0e9('0x1')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf0e9('0x2'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xc788=['../client','getVoiceExtensions','Request','recordingFormat'];(function(_0x237a8d,_0xc56904){var _0x11fdb7=function(_0x5b0662){while(--_0x5b0662){_0x237a8d['push'](_0x237a8d['shift']());}};_0x11fdb7(++_0xc56904);}(_0xc788,0xc4));var _0x8c78=function(_0x5decec,_0x4e5761){_0x5decec=_0x5decec-0x0;var _0x35e1b4=_0xc788[_0x5decec];return _0x35e1b4;};'use strict';var client=require(_0x8c78('0x0'));exports[_0x8c78('0x1')]=function(){return function(){return client[_0x8c78('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x8c78('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x8c78('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index aebedfa..6b57e71 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 _0xedc2=['dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','callAdditionalPhoneAfterMin','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence'];(function(_0x2f350e,_0x141f41){var _0x51c0cb=function(_0x323f5f){while(--_0x323f5f){_0x2f350e['push'](_0x2f350e['shift']());}};_0x51c0cb(++_0x141f41);}(_0xedc2,0x1ad));var _0x2edc=function(_0x499068,_0x59e8ef){_0x499068=_0x499068-0x0;var _0x2bae7b=_0xedc2[_0x499068];return _0x2bae7b;};'use strict';var client=require(_0x2edc('0x0'));exports[_0x2edc('0x1')]=function(){return function(){return client[_0x2edc('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x2edc('0x3'),'acw',_0x2edc('0x4'),_0x2edc('0x5'),_0x2edc('0x6'),_0x2edc('0x7'),'dialActive',_0x2edc('0x8'),_0x2edc('0x9'),_0x2edc('0xa'),_0x2edc('0xb'),_0x2edc('0xc'),_0x2edc('0xd'),_0x2edc('0xe'),_0x2edc('0xf'),_0x2edc('0x10'),_0x2edc('0x11'),_0x2edc('0x12'),_0x2edc('0x13'),_0x2edc('0x14'),'dialCongestionMaxRetry',_0x2edc('0x15'),_0x2edc('0x16'),_0x2edc('0x17'),'dialNoAnswerMaxRetry',_0x2edc('0x18'),'dialGlobalMaxRetry',_0x2edc('0x19'),_0x2edc('0x1a'),_0x2edc('0x1b'),_0x2edc('0x1c'),_0x2edc('0x1d'),_0x2edc('0x1e'),_0x2edc('0x1f'),_0x2edc('0x20'),_0x2edc('0x21'),_0x2edc('0x22'),_0x2edc('0x23'),_0x2edc('0x24'),_0x2edc('0x25'),_0x2edc('0x26'),_0x2edc('0x27'),_0x2edc('0x28'),'dialRecallInQueue',_0x2edc('0x29'),_0x2edc('0x2a'),_0x2edc('0x2b'),_0x2edc('0x2c'),'monitor_format',_0x2edc('0x2d'),_0x2edc('0x2e'),'dialCutDigit',_0x2edc('0x2f'),_0x2edc('0x30'),_0x2edc('0x31'),'dialDropRetryFrequency',_0x2edc('0x32'),'dialAbandonedRetryFrequency',_0x2edc('0x33'),_0x2edc('0x34'),_0x2edc('0x35'),_0x2edc('0x36'),_0x2edc('0x37'),_0x2edc('0x38'),'dialPredictiveIntervalMinThreshold',_0x2edc('0x39'),'dialPreviewRecallmeReminder',_0x2edc('0x3a')],'include':[{'model':_0x2edc('0x3b'),'as':'Trunk','attributes':['id',_0x2edc('0x3'),_0x2edc('0x3c'),_0x2edc('0x3d')]},{'model':_0x2edc('0x3e'),'as':'mandatoryDispositionPause','attributes':['id',_0x2edc('0x3')]},{'model':_0x2edc('0x3b'),'as':_0x2edc('0x3f'),'attributes':['id',_0x2edc('0x3'),'callerid',_0x2edc('0x3d')]},{'model':_0x2edc('0x40'),'as':_0x2edc('0x40'),'attributes':['id',_0x2edc('0x3')],'include':[{'model':_0x2edc('0x40'),'as':'Intervals','attributes':['id',_0x2edc('0x3'),_0x2edc('0x41')]}]}]},'log':_0x2edc('0x1')});};}; \ No newline at end of file +var _0x45b6=['dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','callerid','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue'];(function(_0x4549a5,_0x117c5a){var _0x2e548b=function(_0x5f3fcc){while(--_0x5f3fcc){_0x4549a5['push'](_0x4549a5['shift']());}};_0x2e548b(++_0x117c5a);}(_0x45b6,0xf3));var _0x645b=function(_0x38454f,_0xec92){_0x38454f=_0x38454f-0x0;var _0x29d151=_0x45b6[_0x38454f];return _0x29d151;};'use strict';var client=require(_0x645b('0x0'));exports[_0x645b('0x1')]=function(){return function(){return client[_0x645b('0x2')](_0x645b('0x3'),{'options':{'raw':![],'attributes':['id',_0x645b('0x4'),_0x645b('0x5'),_0x645b('0x6'),_0x645b('0x7'),_0x645b('0x8'),_0x645b('0x9'),_0x645b('0xa'),'dialMethod',_0x645b('0xb'),_0x645b('0xc'),_0x645b('0xd'),'dialPredictiveOptimization',_0x645b('0xe'),_0x645b('0xf'),'dialOriginateCallerIdName',_0x645b('0x10'),_0x645b('0x11'),_0x645b('0x12'),_0x645b('0x13'),_0x645b('0x14'),_0x645b('0x15'),_0x645b('0x16'),_0x645b('0x17'),_0x645b('0x18'),_0x645b('0x19'),_0x645b('0x1a'),_0x645b('0x1b'),_0x645b('0x1c'),_0x645b('0x1d'),_0x645b('0x1e'),_0x645b('0x1f'),_0x645b('0x20'),_0x645b('0x21'),_0x645b('0x22'),'dialAMDAfterGreetingSilence',_0x645b('0x23'),_0x645b('0x24'),'dialAMDBetweenWordsSilence',_0x645b('0x25'),_0x645b('0x26'),_0x645b('0x27'),_0x645b('0x28'),'dialRecallMeTimeout',_0x645b('0x29'),_0x645b('0x2a'),_0x645b('0x2b'),_0x645b('0x2c'),_0x645b('0x2d'),'monitor_format','strategy','dialRandomLastDigitCallerIdNumber',_0x645b('0x2e'),_0x645b('0x2f'),_0x645b('0x30'),'dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry',_0x645b('0x31'),'dialMachineMaxRetry',_0x645b('0x32'),_0x645b('0x33'),_0x645b('0x34'),_0x645b('0x35'),_0x645b('0x36'),_0x645b('0x37'),_0x645b('0x38'),_0x645b('0x39'),'callAdditionalPhoneAfterMin'],'include':[{'model':_0x645b('0x3a'),'as':'Trunk','attributes':['id','name','callerid',_0x645b('0x3b')]},{'model':_0x645b('0x3c'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x645b('0x3a'),'as':'TrunkBackup','attributes':['id',_0x645b('0x4'),_0x645b('0x3d'),_0x645b('0x3b')]},{'model':'Interval','as':_0x645b('0x3e'),'attributes':['id',_0x645b('0x4')],'include':[{'model':_0x645b('0x3e'),'as':'Intervals','attributes':['id','name',_0x645b('0x3f')]}]}]},'log':_0x645b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 9fc362d..d12117c 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(_0x1c7edc,_0x4e8cfa){var _0x49c30b=function(_0x389b13){while(--_0x389b13){_0x1c7edc['push'](_0x1c7edc['shift']());}};_0x49c30b(++_0x4e8cfa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x2ae875,_0x578e3a){var _0x283a75=function(_0x4df920){while(--_0x4df920){_0x2ae875['push'](_0x2ae875['shift']());}};_0x283a75(++_0x578e3a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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 001acd8..c0a5e7b 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 _0x6c73=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x6c73,0x1c1));var _0x36c7=function(_0x58f29c,_0x551df2){_0x58f29c=_0x58f29c-0x0;var _0x5266ed=_0x6c73[_0x58f29c];return _0x5266ed;};'use strict';var client=require(_0x36c7('0x0'));exports[_0x36c7('0x1')]=function(_0x2e277d){return function(){return client[_0x36c7('0x2')](_0x36c7('0x3'),{'options':{'where':{'VoiceQueueId':_0x2e277d,'paused':!![]},'raw':!![]},'log':_0x36c7('0x1')});};}; \ No newline at end of file +var _0x54d9=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x54d9,0x1c3));var _0x954d=function(_0x2d5e63,_0x4b592b){_0x2d5e63=_0x2d5e63-0x0;var _0x4c9f37=_0x54d9[_0x2d5e63];return _0x4c9f37;};'use strict';var client=require(_0x954d('0x0'));exports[_0x954d('0x1')]=function(_0x3d29f9){return function(){return client[_0x954d('0x2')](_0x954d('0x3'),{'options':{'where':{'VoiceQueueId':_0x3d29f9,'paused':!![]},'raw':!![]},'log':_0x954d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 74df2b3..1e263ad 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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x476280,_0x35ab2){var _0x47cfad=function(_0xe3b207){while(--_0xe3b207){_0x476280['push'](_0x476280['shift']());}};_0x47cfad(++_0x35ab2);}(_0x7a54,0x106));var _0x47a5=function(_0x5fcf59,_0x3642a2){_0x5fcf59=_0x5fcf59-0x0;var _0x1cbff2=_0x7a54[_0x5fcf59];return _0x1cbff2;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x19adfc,_0x1079e9){var _0x5f0efe=function(_0x560e61){while(--_0x560e61){_0x19adfc['push'](_0x19adfc['shift']());}};_0x5f0efe(++_0x1079e9);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a0dfab6..145ab3e 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 _0x9cf1=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','context','result','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename'];(function(_0x215bf3,_0x4a1e0a){var _0x5aa0b5=function(_0x41c6a3){while(--_0x41c6a3){_0x215bf3['push'](_0x215bf3['shift']());}};_0x5aa0b5(++_0x4a1e0a);}(_0x9cf1,0xdd));var _0x19cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9cf1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x19cf('0x0'));exports[_0x19cf('0x1')]={};exports[_0x19cf('0x2')]=function(_0x5a80ee){return client[_0x19cf('0x3')](_0x19cf('0x4'),{'body':{'result':_0x5a80ee['result'],'transfererchannel':_0x5a80ee['transfererchannel'],'transferercalleridnum':_0x5a80ee[_0x19cf('0x5')],'transferercalleridname':_0x5a80ee[_0x19cf('0x6')],'transfererconnectedlinenum':_0x5a80ee['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5a80ee[_0x19cf('0x7')],'transfereraccountcode':_0x5a80ee[_0x19cf('0x8')],'transferercontext':_0x5a80ee[_0x19cf('0x9')],'transfererexten':_0x5a80ee['transfererexten'],'transfererlinkedid':_0x5a80ee[_0x19cf('0xa')],'transfereechannel':_0x5a80ee[_0x19cf('0xb')],'transfereecalleridnum':_0x5a80ee[_0x19cf('0xc')],'transfereecalleridname':_0x5a80ee[_0x19cf('0xd')],'transfereeconnectedlinenum':_0x5a80ee[_0x19cf('0xe')],'transfereeconnectedlinename':_0x5a80ee[_0x19cf('0xf')],'transfereeaccountcode':_0x5a80ee[_0x19cf('0x10')],'transfereecontext':_0x5a80ee[_0x19cf('0x11')],'transfereeexten':_0x5a80ee[_0x19cf('0x12')],'transfereelinkedid':_0x5a80ee['transfereelinkedid'],'isexternal':_0x5a80ee['isexternal'],'context':_0x5a80ee[_0x19cf('0x13')],'extension':_0x5a80ee['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x4914a3){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4914a3[_0x19cf('0x14')],'transfererchannel':_0x4914a3['origtransfererchannel'],'transferercalleridnum':_0x4914a3[_0x19cf('0x15')],'transferercalleridname':_0x4914a3[_0x19cf('0x16')],'transfererconnectedlinenum':_0x4914a3['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4914a3[_0x19cf('0x17')],'transfereraccountcode':_0x4914a3[_0x19cf('0x18')],'transferercontext':_0x4914a3[_0x19cf('0x19')],'transfererexten':_0x4914a3[_0x19cf('0x1a')],'transfererlinkedid':_0x4914a3['origtransfererlinkedid'],'transfereechannel':_0x4914a3['transfertargetchannel'],'transfereecalleridnum':_0x4914a3[_0x19cf('0x1b')],'transfereecalleridname':_0x4914a3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4914a3[_0x19cf('0x1c')],'transfereeconnectedlinename':_0x4914a3['transfertargetconnectedlinename'],'transfereeaccountcode':_0x4914a3['transfertargetaccountcode'],'transfereecontext':_0x4914a3['transfertargetcontext'],'transfereeexten':_0x4914a3[_0x19cf('0x1d')],'transfereelinkedid':_0x4914a3[_0x19cf('0x1e')],'isexternal':_0x4914a3[_0x19cf('0x1f')],'context':_0x4914a3[_0x19cf('0x20')],'extension':_0x4914a3[_0x19cf('0x21')],'type':_0x19cf('0x22')},'log':_0x19cf('0x4')});}; \ No newline at end of file +var _0xfa1f=['transfererexten','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridnum','transfererconnectedlinename','transfereraccountcode','transferercontext'];(function(_0x269bfa,_0x2574d3){var _0x100298=function(_0x38da50){while(--_0x38da50){_0x269bfa['push'](_0x269bfa['shift']());}};_0x100298(++_0x2574d3);}(_0xfa1f,0x8f));var _0xffa1=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xfa1f[_0x10c51f];return _0x56a0cd;};'use strict';var client=require(_0xffa1('0x0'));exports[_0xffa1('0x1')]={};exports[_0xffa1('0x2')]=function(_0x2b6e33){return client[_0xffa1('0x3')](_0xffa1('0x4'),{'body':{'result':_0x2b6e33['result'],'transfererchannel':_0x2b6e33['transfererchannel'],'transferercalleridnum':_0x2b6e33[_0xffa1('0x5')],'transferercalleridname':_0x2b6e33['transferercalleridname'],'transfererconnectedlinenum':_0x2b6e33['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2b6e33[_0xffa1('0x6')],'transfereraccountcode':_0x2b6e33[_0xffa1('0x7')],'transferercontext':_0x2b6e33[_0xffa1('0x8')],'transfererexten':_0x2b6e33[_0xffa1('0x9')],'transfererlinkedid':_0x2b6e33['transfererlinkedid'],'transfereechannel':_0x2b6e33['transfereechannel'],'transfereecalleridnum':_0x2b6e33['transfereecalleridnum'],'transfereecalleridname':_0x2b6e33[_0xffa1('0xa')],'transfereeconnectedlinenum':_0x2b6e33['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x2b6e33[_0xffa1('0xb')],'transfereeaccountcode':_0x2b6e33[_0xffa1('0xc')],'transfereecontext':_0x2b6e33[_0xffa1('0xd')],'transfereeexten':_0x2b6e33['transfereeexten'],'transfereelinkedid':_0x2b6e33[_0xffa1('0xe')],'isexternal':_0x2b6e33[_0xffa1('0xf')],'context':_0x2b6e33[_0xffa1('0x10')],'extension':_0x2b6e33[_0xffa1('0x11')],'type':_0xffa1('0x12')},'log':_0xffa1('0x4')});};exports[_0xffa1('0x13')]=function(_0x8b284f){return client[_0xffa1('0x3')](_0xffa1('0x4'),{'body':{'result':_0x8b284f[_0xffa1('0x14')],'transfererchannel':_0x8b284f[_0xffa1('0x15')],'transferercalleridnum':_0x8b284f[_0xffa1('0x16')],'transferercalleridname':_0x8b284f['origtransferercalleridname'],'transfererconnectedlinenum':_0x8b284f[_0xffa1('0x17')],'transfererconnectedlinename':_0x8b284f[_0xffa1('0x18')],'transfereraccountcode':_0x8b284f[_0xffa1('0x19')],'transferercontext':_0x8b284f[_0xffa1('0x1a')],'transfererexten':_0x8b284f['secondtransfererexten'],'transfererlinkedid':_0x8b284f[_0xffa1('0x1b')],'transfereechannel':_0x8b284f[_0xffa1('0x1c')],'transfereecalleridnum':_0x8b284f[_0xffa1('0x1d')],'transfereecalleridname':_0x8b284f[_0xffa1('0x1e')],'transfereeconnectedlinenum':_0x8b284f[_0xffa1('0x1f')],'transfereeconnectedlinename':_0x8b284f['transfertargetconnectedlinename'],'transfereeaccountcode':_0x8b284f[_0xffa1('0x20')],'transfereecontext':_0x8b284f[_0xffa1('0x21')],'transfereeexten':_0x8b284f[_0xffa1('0x22')],'transfereelinkedid':_0x8b284f['transfertargetlinkedid'],'isexternal':_0x8b284f[_0xffa1('0xf')],'context':_0x8b284f[_0xffa1('0x23')],'extension':_0x8b284f[_0xffa1('0x24')],'type':_0xffa1('0x25')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index fa1f2c8..454bf2b 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 _0x4fc2=['format','%s/%s','SIP','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','module','Reload','Action','then','message','action','catch','voiceQueues','hasOwnProperty','name','strategy','answered','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','abandoned','waiting','loggedInDb','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','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','stop','filename','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','outbound','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami'];(function(_0x22864d,_0x5836c9){var _0x5eaa64=function(_0x41d02f){while(--_0x41d02f){_0x22864d['push'](_0x22864d['shift']());}};_0x5eaa64(++_0x5836c9);}(_0x4fc2,0x111));var _0x24fc=function(_0x23dc29,_0x4127b3){_0x23dc29=_0x23dc29-0x0;var _0x5a79bb=_0x4fc2[_0x23dc29];return _0x5a79bb;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var jayson=require(_0x24fc('0x2'));var schema=require(_0x24fc('0x3'));var moment=require('moment');var config=require(_0x24fc('0x4'));var properties=require(_0x24fc('0x5'));var ami=require(_0x24fc('0x6'));exports['listen']=function(_0x126d90,_0x3772eb,_0x58dafc){return new Promise(function(_0x26fcc6,_0x12d602){var _0x4889f4={'QueuePause':function(_0x115851){return new Promise(function(_0x22a0c8){var _0x220f9a=util[_0x24fc('0x7')](_0x24fc('0x8'),_0x24fc('0x9'),_0x115851['name']);if(_0x126d90[_0x24fc('0xa')]&&_0x126d90[_0x24fc('0xa')][_0x220f9a]&&_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xb')]){_0x126d90[_0x24fc('0xa')][_0x220f9a][_0x24fc('0xc')]();}if(_0x126d90[_0x24fc('0xd')][_0x220f9a]){_0x126d90[_0x24fc('0xd')][_0x220f9a]['updateStatusRealtime']({'statePause':_0x115851[_0x24fc('0xe')]?!![]:![]});}_0x22a0c8({'code':0xc8,'message':_0x24fc('0xf')});});},'Reload':function(_0x5cc65e){var _0x306873=this;return new Promise(function(_0x76cb25,_0x3f6d8b){if(ami[_0x24fc('0x10')]()==![]){return _0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}_0x5cc65e=_[_0x24fc('0x16')](_0x5cc65e,_['keys'](properties[_0x24fc('0x17')]));_0x5cc65e['action']=_0x24fc('0x18');return ami[_0x24fc('0x19')](_0x5cc65e)[_0x24fc('0x1a')](function(_0x41c593){_0x76cb25({'code':0xc8,'message':_0x41c593[_0x24fc('0x1b')]});})['catch'](function(_0x23873c){_0x3f6d8b(_0x306873[_0x24fc('0x11')](0x1f5,_0x23873c[_0x24fc('0x1b')]));});});},'Command':function(_0x8ac114){var _0x4c5a43=this;return new Promise(function(_0x5eabee,_0x4073e0){if(ami[_0x24fc('0x10')]()==![]){return _0x4073e0(_0x4c5a43['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}_0x8ac114=_[_0x24fc('0x16')](_0x8ac114,'command');_0x8ac114[_0x24fc('0x1c')]='Command';return ami[_0x24fc('0x19')](_0x8ac114)[_0x24fc('0x1a')](function(_0x2ffade){_0x5eabee({'code':0xc8,'message':_0x2ffade['content']});})[_0x24fc('0x1d')](function(_0x552035){_0x4073e0(_0x4c5a43[_0x24fc('0x11')](0x1f5,_0x552035[_0x24fc('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x36a9b4){var _0x34b5b2=[];for(var _0x3296fc in _0x126d90[_0x24fc('0x1e')]){if(_0x126d90[_0x24fc('0x1e')][_0x24fc('0x1f')](_0x3296fc)){var _0x168d98=_0x126d90[_0x24fc('0x1e')][_0x3296fc];var _0x568441={'id':_0x168d98['id'],'name':_0x168d98[_0x24fc('0x20')],'strategy':_0x168d98[_0x24fc('0x21')],'answered':_0x168d98[_0x24fc('0x22')],'available':_0x168d98['available'],'loggedIn':_0x168d98[_0x24fc('0x23')],'pTalking':_0x168d98[_0x24fc('0x24')],'sumBillable':_0x168d98[_0x24fc('0x25')],'sumDuration':_0x168d98[_0x24fc('0x26')],'sumHoldTime':_0x168d98[_0x24fc('0x27')]||0x0,'talking':_0x168d98[_0x24fc('0x28')],'total':_0x168d98['total'],'type':_0x168d98[_0x24fc('0x29')],'unmanaged':_0x168d98[_0x24fc('0x2a')],'abandoned':_0x168d98[_0x24fc('0x2b')],'waiting':_0x168d98[_0x24fc('0x2c')],'loggedInDb':_0x168d98[_0x24fc('0x2d')]};if(_0x168d98['type']==='outbound'){_0x568441['dialActive']=_0x168d98[_0x24fc('0x2e')];_0x568441['dialMethod']=_0x168d98[_0x24fc('0x2f')];_0x568441[_0x24fc('0x30')]=_0x168d98[_0x24fc('0x30')];_0x568441[_0x24fc('0x31')]=_0x168d98['dialOriginateCallerIdNumber'];_0x568441[_0x24fc('0x32')]=_0x168d98[_0x24fc('0x32')];_0x568441['dialPrefix']=_0x168d98[_0x24fc('0x33')];_0x568441[_0x24fc('0x34')]=_0x168d98['temp'];_0x568441['outboundAnswerAgiCallsDay']=_0x168d98[_0x24fc('0x35')];_0x568441['outboundAnswerCallsDay']=_0x168d98[_0x24fc('0x36')];_0x568441[_0x24fc('0x37')]=_0x168d98['outboundBlacklistCallsDay'];_0x568441[_0x24fc('0x38')]=_0x168d98[_0x24fc('0x38')];_0x568441[_0x24fc('0x39')]=_0x168d98[_0x24fc('0x39')];_0x568441[_0x24fc('0x3a')]=_0x168d98[_0x24fc('0x3a')];_0x568441[_0x24fc('0x3b')]=_0x168d98[_0x24fc('0x3b')];_0x568441[_0x24fc('0x3c')]=_0x168d98['outboundDropCallsDayTimeout'];_0x568441[_0x24fc('0x3d')]=_0x168d98[_0x24fc('0x3d')];_0x568441[_0x24fc('0x3e')]=_0x168d98[_0x24fc('0x3e')];_0x568441[_0x24fc('0x3f')]=_0x168d98['outboundOriginateFailureCallsDay'];_0x568441['outboundReCallsDay']=_0x168d98[_0x24fc('0x40')];_0x568441['outboundRejectCallsDay']=_0x168d98[_0x24fc('0x41')];_0x568441[_0x24fc('0x42')]=_0x168d98[_0x24fc('0x42')];_0x568441[_0x24fc('0x43')]=_0x168d98['predictiveIntervalAnsweredCalls'];_0x568441[_0x24fc('0x44')]=_0x168d98['predictiveIntervalAvgHoldtime'];_0x568441[_0x24fc('0x45')]=_0x168d98[_0x24fc('0x45')];_0x568441[_0x24fc('0x46')]=_0x168d98[_0x24fc('0x46')];_0x568441[_0x24fc('0x47')]=_0x168d98['predictiveIntervalDroppedCallsTimeout'];_0x568441[_0x24fc('0x48')]=_0x168d98[_0x24fc('0x48')];_0x568441[_0x24fc('0x49')]=_0x168d98[_0x24fc('0x49')];_0x568441['predictiveIntervalHitRate']=_0x168d98[_0x24fc('0x4a')];_0x568441[_0x24fc('0x4b')]=_0x168d98['predictiveIntervalMultiplicativeFactor'];_0x568441[_0x24fc('0x4c')]=_0x168d98['predictiveIntervalPauses'];_0x568441[_0x24fc('0x4d')]=_0x168d98[_0x24fc('0x4d')];_0x568441[_0x24fc('0x4e')]=_0x168d98[_0x24fc('0x4e')];_0x568441[_0x24fc('0x1b')]=_0x168d98[_0x24fc('0x1b')];_0x568441[_0x24fc('0x4f')]=_0x168d98[_0x24fc('0x4f')];_0x568441['erlangCalls']=_0x168d98[_0x24fc('0x50')];_0x568441[_0x24fc('0x51')]=_0x168d98[_0x24fc('0x51')];_0x568441['erlangAbandonmentRate']=_0x168d98[_0x24fc('0x52')];_0x568441[_0x24fc('0x53')]=_0x168d98['erlangBusyFactor'];_0x568441[_0x24fc('0x54')]=_0x168d98[_0x24fc('0x54')];_0x568441[_0x24fc('0x55')]=_0x168d98['startProgressive'];}if(_0x168d98[_0x24fc('0x56')]){_0x568441[_0x24fc('0x56')]={'id':_0x168d98['Trunk']['id'],'name':_0x168d98[_0x24fc('0x56')][_0x24fc('0x20')],'active':_0x168d98[_0x24fc('0x56')][_0x24fc('0x57')],'callerid':_0x168d98['Trunk'][_0x24fc('0x58')]};}if(_0x168d98[_0x24fc('0x59')]){_0x568441[_0x24fc('0x59')]={'id':_0x168d98[_0x24fc('0x59')]['id'],'name':_0x168d98[_0x24fc('0x59')]['name']};}_0x34b5b2[_0x24fc('0x5a')](_0x568441);}}_0x36a9b4({'count':_0x34b5b2[_0x24fc('0x5b')],'rows':_0x34b5b2});});},'UpdateVoiceQueue':function(_0x17f683){return new Promise(function(_0x3c6ffb,_0x5c0798){var _0x2b8a9f=_[_0x24fc('0x5c')](_0x126d90['voiceQueues'],{'id':parseInt(_0x17f683['id'])});var _0x5bbb6c=_[_0x24fc('0x5d')](_0x17f683,['id']);if(_0x2b8a9f){for(var _0x5ddde2 in _0x5bbb6c){if(typeof _0x5bbb6c[_0x5ddde2]!=='undefined'&&typeof _0x2b8a9f[_0x5ddde2]!==_0x24fc('0x5e')){_0x2b8a9f[_0x5ddde2]=_0x5bbb6c[_0x5ddde2];}}_0x3c6ffb(_0x2b8a9f);}else{_0x5c0798();}});},'VoiceChannels':function(){return new Promise(function(_0x5879c2){var _0x281194=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x60')]);_0x5879c2({'count':_0x281194['length'],'rows':_0x281194});});},'VoiceChannelMixMonitor':function(_0x1d2910){var _0x23c1d4=this;return new Promise(function(_0x1b1f1c,_0x1ad8d6){if(ami[_0x24fc('0x10')]()==![]){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')]['username'],'ami\x20disconnected'][_0x24fc('0x15')]('\x20')));}var _0x2f1a99=schema(properties[_0x24fc('0x61')])['validate'](_0x1d2910);if(_0x2f1a99['length']>0x0){return _0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x2f1a99,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x21f8b8=_[_0x24fc('0x5c')](_0x126d90[_0x24fc('0x60')],{'uniqueid':_0x1d2910[_0x24fc('0x63')]});if(_0x21f8b8&&_0x21f8b8[_0x24fc('0x64')]){var _0x4574d3=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x1d2910['filename']||_0x1d2910[_0x24fc('0x63')],_0x1d2910[_0x24fc('0x7')]||_0x24fc('0x66'));return ami[_0x24fc('0x19')]({'action':_0x24fc('0x67'),'channel':_0x21f8b8['channel'],'file':_0x4574d3,'options':_0x24fc('0x68')})['then'](function(_0x2c8f74){var _0x2ee445=_[_0x24fc('0x5c')](_0x21f8b8[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')]()});if(_['isNil'](_0x2ee445)){_0x21f8b8[_0x24fc('0x69')][_0x24fc('0x5a')]({'filename':_0x24fc('0x6a')+_0x4574d3[_0x24fc('0x6b')](),'createdAt':moment()[_0x24fc('0x7')](_0x24fc('0x6c')),'mixmonitorid':_0x2c8f74['mixmonitorid'],'status':_0x24fc('0x6d')});}else{_0x2ee445[_0x24fc('0x6e')]=_0x2c8f74[_0x24fc('0x6e')];_0x2ee445[_0x24fc('0x6f')]=_0x24fc('0x6d');}_0x1b1f1c({'code':0xc8,'message':[_0x1d2910[_0x24fc('0x63')],_0x24fc('0x70'),_0x2c8f74['mixmonitorid']][_0x24fc('0x15')]('\x20'),'mixmonitorid':_0x2c8f74[_0x24fc('0x6e')]});})['catch'](function(_0x1368f6){_0x1ad8d6(_0x23c1d4[_0x24fc('0x11')](0x1f5,[_0x1d2910[_0x24fc('0x63')],_0x1368f6[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')));});}else{return _0x1ad8d6(_0x23c1d4['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceChannelStopMixMonitor':function(_0x4a0524){var _0x3e9644=this;return new Promise(function(_0x8c9649,_0x50e5b0){if(ami[_0x24fc('0x10')]()==![]){return _0x50e5b0(_0x3e9644['error'](0x1f4,[config[_0x24fc('0x12')]['ip'],config['asterisk'][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x2edef7=schema(properties['voicechannel'])[_0x24fc('0x3')](_0x4a0524);if(_0x2edef7[_0x24fc('0x5b')]>0x0){return _0x50e5b0(_0x3e9644['error'](0x1f4,_[_0x24fc('0x62')](_0x2edef7,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x47179d=_[_0x24fc('0x5c')](_0x126d90['channels'],{'uniqueid':_0x4a0524[_0x24fc('0x63')]});if(_0x47179d){return Promise[_0x24fc('0x72')]()[_0x24fc('0x1a')](function(){if(_0x47179d[_0x24fc('0x64')]){return ami[_0x24fc('0x19')]({'action':'StopMixMonitor','channel':_0x47179d['channel'],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})[_0x24fc('0x1d')](function(){});}})['then'](function(){if(_0x47179d['destinationchannel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x73'),'channel':_0x47179d[_0x24fc('0x74')],'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]})['catch'](function(){});}})[_0x24fc('0x1a')](function(){var _0x39f45a=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'mixmonitorid':_0x4a0524[_0x24fc('0x6e')]});if(_0x39f45a){_0x39f45a[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){var _0xbe136e=util[_0x24fc('0x7')](_0x24fc('0x65'),_0x4a0524[_0x24fc('0x76')]||_0x4a0524[_0x24fc('0x63')],_0x4a0524[_0x24fc('0x7')]||_0x24fc('0x66'));var _0x54ead5=_[_0x24fc('0x5c')](_0x47179d[_0x24fc('0x69')],{'filename':_0x24fc('0x6a')+_0xbe136e[_0x24fc('0x6b')]()});if(_0x54ead5){_0x54ead5[_0x24fc('0x6f')]=_0x24fc('0x75');}})[_0x24fc('0x1a')](function(){_0x8c9649({'code':0xc8,'message':[_0x4a0524[_0x24fc('0x63')],'StopMixMonitor\x20Success'][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x14adcb){_0x50e5b0(_0x3e9644[_0x24fc('0x11')](0x1f5,[_0x4a0524['uniqueid'],_0x14adcb[_0x24fc('0x1b')][_0x24fc('0x6b')]()]['join']('\x20')));});}else{return _0x50e5b0(_0x3e9644['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x2ae2ac){var _0x698283=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x77')]);_0x2ae2ac({'count':_0x698283[_0x24fc('0x5b')],'rows':_0x698283});});},'VoiceQueuesChannel':function(_0x1d0f06){var _0x52e1aa=this;return new Promise(function(_0x11bafd,_0x15e8a3){var _0x5a2c09=schema(properties['voicequeuechannel'])[_0x24fc('0x3')](_0x1d0f06);if(_0x5a2c09[_0x24fc('0x5b')]>0x0){return _0x15e8a3(_0x52e1aa[_0x24fc('0x11')](0x1f4,_['map'](_0x5a2c09,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x33f04e=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x1d0f06['uniqueid']});if(_0x33f04e){_0x11bafd(_0x33f04e);}else{return _0x15e8a3(_0x52e1aa['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x10ef7c){var _0x7e93d0=this;return new Promise(function(_0x2f1a7e,_0x2a1236){if(ami['isConnected']()==![]){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x24fc('0x12')]['username'],_0x24fc('0x14')][_0x24fc('0x15')]('\x20')));}var _0x1b9079=schema(properties[_0x24fc('0x78')])[_0x24fc('0x3')](_0x10ef7c);if(_0x1b9079[_0x24fc('0x5b')]>0x0){return _0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f4,_['map'](_0x1b9079,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0x2de101=_['find'](_0x126d90['queueChannels'],{'uniqueid':_0x10ef7c[_0x24fc('0x63')]});if(_0x2de101&&_0x2de101[_0x24fc('0x64')]){return ami['Action']({'action':_0x24fc('0x79'),'channel':_0x2de101[_0x24fc('0x64')]})['then'](function(_0x2b51c8){_0x2f1a7e({'code':0xc8,'message':[_0x10ef7c[_0x24fc('0x63')],_0x2b51c8['message'][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x1efe4e){_0x2a1236(_0x7e93d0[_0x24fc('0x11')](0x1f5,[_0x10ef7c[_0x24fc('0x63')],_0x1efe4e['message']['toLowerCase']()][_0x24fc('0x15')]('\x20')));});}else{return _0x2a1236(_0x7e93d0['error'](0x1f5,_0x24fc('0x71')));}});},'VoiceQueuesChannelRedirect':function(_0x52d54e){var _0x5233c5=this;return new Promise(function(_0x436652,_0x16c609){if(ami[_0x24fc('0x10')]()==![]){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,[config[_0x24fc('0x12')]['ip'],config[_0x24fc('0x12')][_0x24fc('0x13')],_0x24fc('0x14')]['join']('\x20')));}var _0x795fff=schema(properties[_0x24fc('0x7a')])['validate'](_0x52d54e);if(_0x795fff['length']>0x0){return _0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f4,_[_0x24fc('0x62')](_0x795fff,_0x24fc('0x1b'))[_0x24fc('0x15')](',\x20')));}var _0xd1e6=_['find'](_0x126d90[_0x24fc('0x77')],{'uniqueid':_0x52d54e[_0x24fc('0x63')]});if(_0xd1e6&&_0xd1e6['channel']){return ami[_0x24fc('0x19')]({'action':_0x24fc('0x7b'),'channel':_0xd1e6[_0x24fc('0x64')],'exten':_0x52d54e['exten'],'context':_0x52d54e[_0x24fc('0x7c')]||_0xd1e6[_0x24fc('0x7c')],'priority':0x1})[_0x24fc('0x1a')](function(_0x2c573b){_0x436652({'code':0xc8,'message':[_0x52d54e[_0x24fc('0x63')],_0x2c573b[_0x24fc('0x1b')][_0x24fc('0x6b')]()][_0x24fc('0x15')]('\x20')});})[_0x24fc('0x1d')](function(_0x54f379){_0x16c609(_0x5233c5[_0x24fc('0x11')](0x1f5,[_0x52d54e[_0x24fc('0x63')],_0x54f379[_0x24fc('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x16c609(_0x5233c5['error'](0x1f5,_0x24fc('0x71')));}});},'Agents':function(_0x560c80){return new Promise(function(_0x12a6a1){var _0x44132e=_['values'](_0x126d90[_0x24fc('0xd')]);if(_0x560c80&&_0x560c80['id']){var _0x559692=_[_0x24fc('0x5c')](_0x44132e,function(_0x57e241){return _0x57e241['id']===_0x560c80['id'];});_0x12a6a1(_0x559692);}else{_0x12a6a1({'count':_0x44132e[_0x24fc('0x5b')],'rows':_0x44132e});}});},'Telephones':function(){return new Promise(function(_0x367520){var _0x1ef6f3=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7d')]);_0x367520({'count':_0x1ef6f3[_0x24fc('0x5b')],'rows':_0x1ef6f3});});},'Trunks':function(){return new Promise(function(_0x4d30ba){var _0xa769cb=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7e')]);_0x4d30ba({'count':_0xa769cb[_0x24fc('0x5b')],'rows':_0xa769cb});});},'OutboundChannels':function(){return new Promise(function(_0xc9e77c){var _0x328d4d=_[_0x24fc('0x5f')](_0x126d90[_0x24fc('0x7f')]);_0xc9e77c({'count':_0x328d4d[_0x24fc('0x5b')],'rows':_0x328d4d});});},'Outbound':function(){return new Promise(function(_0x5f4ec2){_0x5f4ec2(_0x126d90[_0x24fc('0x80')]);});},'Campaigns':function(){return new Promise(function(_0x211295){var _0x31b110=_[_0x24fc('0x5f')](_0x126d90['campaigns']);_0x211295({'count':_0x31b110[_0x24fc('0x5b')],'rows':_0x31b110});});},'VoiceQueuesPreview':function(_0x3287ac){var _0xc2be0f=this;return new Promise(function(_0x59411e,_0x29cbc5){_0x3772eb['run'](_0x3287ac['id'])['then'](function(_0x4e7c8b){_0x59411e({'code':0xc8,'message':_0x4e7c8b[_0x24fc('0x1b')]});})['catch'](function(_0x29f1c1){_0x29cbc5(_0xc2be0f[_0x24fc('0x11')](0x1f4,_0x29f1c1[_0x24fc('0x1b')]));});});},'EventManager':function(_0x10abf7){var _0x50d1f7=this;return new Promise(function(_0x3a65c5,_0x315ce4){if(!_0x10abf7[_0x24fc('0x81')]){return _0x315ce4(_0x50d1f7[_0x24fc('0x11')](0x1f4,_0x24fc('0x82')));}ami['emit'](_0x24fc('0x83')+_0x10abf7[_0x24fc('0x81')],_0x10abf7[_0x24fc('0x1b')]);_0x3a65c5({'code':0xc8,'message':_0x10abf7});});},'FaxAccounts':function(){return new Promise(function(_0xdc1cb7){var _0x5b5109=_['values'](_0x126d90[_0x24fc('0x84')]);_0xdc1cb7({'count':_0x5b5109[_0x24fc('0x5b')],'rows':_0x5b5109});});},'SendFax':function(_0x24e27e){var _0x188d0d=this;return new Promise(function(_0x1f263c,_0x49e6f2){_0x58dafc[_0x24fc('0x85')](_0x24e27e)[_0x24fc('0x1a')](function(_0x95ecb1){_0x1f263c({'code':0xc8,'message':_0x95ecb1['message']});})[_0x24fc('0x1d')](function(_0x69a2cd){_0x49e6f2(_0x188d0d[_0x24fc('0x11')](0x1f4,_0x69a2cd[_0x24fc('0x1b')]));});});},'CheckAfterSend':function(_0xc52004){var _0x4c10d9=this;return new Promise(function(_0x52cc49,_0x587e47){_0x58dafc[_0x24fc('0x86')](_0xc52004)[_0x24fc('0x1a')](function(_0x2b7be3){_0x52cc49({'code':0xc8,'message':_0x2b7be3[_0x24fc('0x1b')]});})[_0x24fc('0x1d')](function(_0x2ac3e8){_0x587e47(_0x4c10d9[_0x24fc('0x11')](0x1f4,_0x2ac3e8[_0x24fc('0x1b')]));});});}};var _0x382a1c=jayson[_0x24fc('0x87')](_0x4889f4)[_0x24fc('0x88')]();_0x382a1c['on'](_0x24fc('0x11'),function(_0x5d01ab){return _0x12d602(_0x5d01ab);});_0x382a1c['listen'](0x232a,_0x24fc('0x89'),function(){console['log'](_0x24fc('0x8a'),0x232a);return _0x26fcc6(_0x24fc('0x8b')+0x232a);});});}; \ No newline at end of file +var _0x4522=['trunks','outboundChannels','campaigns','run','emit','custom:','event','faxAccounts','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','validate','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','error','asterisk','ami\x20disconnected','join','keys','action','Reload','Action','then','message','catch','isConnected','username','Command','content','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumBillable','talking','total','type','unmanaged','abandoned','waiting','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','find','omit','undefined','values','channels','length','voicechannel','uniqueid','channel','%s.%s','filename','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones'];(function(_0x5a056e,_0x382a98){var _0x5e1dab=function(_0x1059a4){while(--_0x1059a4){_0x5a056e['push'](_0x5a056e['shift']());}};_0x5e1dab(++_0x382a98);}(_0x4522,0x1a0));var _0x2452=function(_0x357f46,_0x1a087c){_0x357f46=_0x357f46-0x0;var _0x3d6648=_0x4522[_0x357f46];return _0x3d6648;};'use strict';var _=require('lodash');var util=require('util');var jayson=require(_0x2452('0x0'));var schema=require(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var config=require('../../../config/environment');var properties=require(_0x2452('0x3'));var ami=require(_0x2452('0x4'));exports[_0x2452('0x5')]=function(_0x2f21dc,_0x34ff44,_0x243893){return new Promise(function(_0x15fc69,_0x226578){var _0x2f0139={'QueuePause':function(_0x149807){return new Promise(function(_0x3bc193){var _0x33b935=util[_0x2452('0x6')](_0x2452('0x7'),_0x2452('0x8'),_0x149807[_0x2452('0x9')]);if(_0x2f21dc['timers']&&_0x2f21dc['timers'][_0x33b935]&&_0x2f21dc[_0x2452('0xa')][_0x33b935]['timer']){_0x2f21dc['timers'][_0x33b935][_0x2452('0xb')]();}if(_0x2f21dc[_0x2452('0xc')][_0x33b935]){_0x2f21dc[_0x2452('0xc')][_0x33b935][_0x2452('0xd')]({'statePause':_0x149807[_0x2452('0xe')]?!![]:![]});}_0x3bc193({'code':0xc8,'message':_0x2452('0xf')});});},'Reload':function(_0x2c1e0f){var _0x2377b9=this;return new Promise(function(_0x4968e8,_0x529fb2){if(ami['isConnected']()==![]){return _0x529fb2(_0x2377b9[_0x2452('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x2452('0x11')]['username'],_0x2452('0x12')][_0x2452('0x13')]('\x20')));}_0x2c1e0f=_['pick'](_0x2c1e0f,_[_0x2452('0x14')](properties['module']));_0x2c1e0f[_0x2452('0x15')]=_0x2452('0x16');return ami[_0x2452('0x17')](_0x2c1e0f)[_0x2452('0x18')](function(_0x4e1d20){_0x4968e8({'code':0xc8,'message':_0x4e1d20[_0x2452('0x19')]});})[_0x2452('0x1a')](function(_0x59d89a){_0x529fb2(_0x2377b9['error'](0x1f5,_0x59d89a[_0x2452('0x19')]));});});},'Command':function(_0x37c6a6){var _0x377c12=this;return new Promise(function(_0x57cb03,_0x914d2b){if(ami[_0x2452('0x1b')]()==![]){return _0x914d2b(_0x377c12[_0x2452('0x10')](0x1f4,[config[_0x2452('0x11')]['ip'],config[_0x2452('0x11')][_0x2452('0x1c')],_0x2452('0x12')][_0x2452('0x13')]('\x20')));}_0x37c6a6=_['pick'](_0x37c6a6,'command');_0x37c6a6[_0x2452('0x15')]=_0x2452('0x1d');return ami['Action'](_0x37c6a6)[_0x2452('0x18')](function(_0x395cf1){_0x57cb03({'code':0xc8,'message':_0x395cf1[_0x2452('0x1e')]});})[_0x2452('0x1a')](function(_0x285281){_0x914d2b(_0x377c12[_0x2452('0x10')](0x1f5,_0x285281[_0x2452('0x19')]));});});},'VoiceQueues':function(){return new Promise(function(_0x543b06){var _0x119bf6=[];for(var _0x27d049 in _0x2f21dc[_0x2452('0x1f')]){if(_0x2f21dc[_0x2452('0x1f')][_0x2452('0x20')](_0x27d049)){var _0x516fcf=_0x2f21dc['voiceQueues'][_0x27d049];var _0x295be0={'id':_0x516fcf['id'],'name':_0x516fcf[_0x2452('0x9')],'strategy':_0x516fcf[_0x2452('0x21')],'answered':_0x516fcf[_0x2452('0x22')],'available':_0x516fcf[_0x2452('0x23')],'loggedIn':_0x516fcf['loggedIn'],'pTalking':_0x516fcf[_0x2452('0x24')],'sumBillable':_0x516fcf[_0x2452('0x25')],'sumDuration':_0x516fcf['sumDuration'],'sumHoldTime':_0x516fcf['sumHoldTime']||0x0,'talking':_0x516fcf[_0x2452('0x26')],'total':_0x516fcf[_0x2452('0x27')],'type':_0x516fcf[_0x2452('0x28')],'unmanaged':_0x516fcf[_0x2452('0x29')],'abandoned':_0x516fcf[_0x2452('0x2a')],'waiting':_0x516fcf[_0x2452('0x2b')],'loggedInDb':_0x516fcf['loggedInDb']};if(_0x516fcf['type']===_0x2452('0x2c')){_0x295be0[_0x2452('0x2d')]=_0x516fcf[_0x2452('0x2d')];_0x295be0['dialMethod']=_0x516fcf[_0x2452('0x2e')];_0x295be0[_0x2452('0x2f')]=_0x516fcf['dialOriginateCallerIdName'];_0x295be0[_0x2452('0x30')]=_0x516fcf[_0x2452('0x30')];_0x295be0[_0x2452('0x31')]=_0x516fcf[_0x2452('0x31')];_0x295be0[_0x2452('0x32')]=_0x516fcf[_0x2452('0x32')];_0x295be0[_0x2452('0x33')]=_0x516fcf[_0x2452('0x33')];_0x295be0[_0x2452('0x34')]=_0x516fcf[_0x2452('0x34')];_0x295be0[_0x2452('0x35')]=_0x516fcf[_0x2452('0x35')];_0x295be0[_0x2452('0x36')]=_0x516fcf['outboundBlacklistCallsDay'];_0x295be0[_0x2452('0x37')]=_0x516fcf[_0x2452('0x37')];_0x295be0['outboundCongestionCallsDay']=_0x516fcf[_0x2452('0x38')];_0x295be0['outboundDropCallsDayACS']=_0x516fcf[_0x2452('0x39')];_0x295be0[_0x2452('0x3a')]=_0x516fcf['outboundDropCallsDayCallersExit'];_0x295be0[_0x2452('0x3b')]=_0x516fcf[_0x2452('0x3b')];_0x295be0[_0x2452('0x3c')]=_0x516fcf['outboundNoAnswerCallsDay'];_0x295be0[_0x2452('0x3d')]=_0x516fcf[_0x2452('0x3d')];_0x295be0['outboundOriginateFailureCallsDay']=_0x516fcf[_0x2452('0x3e')];_0x295be0[_0x2452('0x3f')]=_0x516fcf[_0x2452('0x3f')];_0x295be0[_0x2452('0x40')]=_0x516fcf[_0x2452('0x40')];_0x295be0['outboundUnknownCallsDay']=_0x516fcf['outboundUnknownCallsDay'];_0x295be0['predictiveIntervalAnsweredCalls']=_0x516fcf[_0x2452('0x41')];_0x295be0[_0x2452('0x42')]=_0x516fcf[_0x2452('0x42')];_0x295be0[_0x2452('0x43')]=_0x516fcf[_0x2452('0x43')];_0x295be0['predictiveIntervalDroppedCallsCallersExit']=_0x516fcf[_0x2452('0x44')];_0x295be0['predictiveIntervalDroppedCallsTimeout']=_0x516fcf['predictiveIntervalDroppedCallsTimeout'];_0x295be0[_0x2452('0x45')]=_0x516fcf['predictiveIntervalErlangCalls'];_0x295be0[_0x2452('0x46')]=_0x516fcf[_0x2452('0x46')];_0x295be0['predictiveIntervalHitRate']=_0x516fcf[_0x2452('0x47')];_0x295be0[_0x2452('0x48')]=_0x516fcf[_0x2452('0x48')];_0x295be0[_0x2452('0x49')]=_0x516fcf[_0x2452('0x49')];_0x295be0[_0x2452('0x4a')]=_0x516fcf[_0x2452('0x4a')];_0x295be0[_0x2452('0x4b')]=_0x516fcf['predictiveIntervalTotalCalls'];_0x295be0[_0x2452('0x19')]=_0x516fcf['message'];_0x295be0[_0x2452('0x4c')]=_0x516fcf[_0x2452('0x4c')];_0x295be0['erlangCalls']=_0x516fcf[_0x2452('0x4d')];_0x295be0[_0x2452('0x4e')]=_0x516fcf[_0x2452('0x4e')];_0x295be0[_0x2452('0x4f')]=_0x516fcf[_0x2452('0x4f')];_0x295be0['erlangBusyFactor']=_0x516fcf[_0x2452('0x50')];_0x295be0[_0x2452('0x51')]=_0x516fcf['startPredictive'];_0x295be0[_0x2452('0x52')]=_0x516fcf[_0x2452('0x52')];}if(_0x516fcf[_0x2452('0x53')]){_0x295be0[_0x2452('0x53')]={'id':_0x516fcf['Trunk']['id'],'name':_0x516fcf[_0x2452('0x53')][_0x2452('0x9')],'active':_0x516fcf[_0x2452('0x53')][_0x2452('0x54')],'callerid':_0x516fcf[_0x2452('0x53')][_0x2452('0x55')]};}if(_0x516fcf['Interval']){_0x295be0[_0x2452('0x56')]={'id':_0x516fcf['Interval']['id'],'name':_0x516fcf[_0x2452('0x56')][_0x2452('0x9')]};}_0x119bf6['push'](_0x295be0);}}_0x543b06({'count':_0x119bf6['length'],'rows':_0x119bf6});});},'UpdateVoiceQueue':function(_0x50f700){return new Promise(function(_0x5014b8,_0xd62892){var _0x4ec49f=_[_0x2452('0x57')](_0x2f21dc['voiceQueues'],{'id':parseInt(_0x50f700['id'])});var _0x1ef02b=_[_0x2452('0x58')](_0x50f700,['id']);if(_0x4ec49f){for(var _0x55de3d in _0x1ef02b){if(typeof _0x1ef02b[_0x55de3d]!=='undefined'&&typeof _0x4ec49f[_0x55de3d]!==_0x2452('0x59')){_0x4ec49f[_0x55de3d]=_0x1ef02b[_0x55de3d];}}_0x5014b8(_0x4ec49f);}else{_0xd62892();}});},'VoiceChannels':function(){return new Promise(function(_0x4d9437){var _0x596b65=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x5b')]);_0x4d9437({'count':_0x596b65[_0x2452('0x5c')],'rows':_0x596b65});});},'VoiceChannelMixMonitor':function(_0x57f815){var _0x491089=this;return new Promise(function(_0x3e4a8b,_0x38615e){if(ami[_0x2452('0x1b')]()==![]){return _0x38615e(_0x491089[_0x2452('0x10')](0x1f4,[config[_0x2452('0x11')]['ip'],config['asterisk'][_0x2452('0x1c')],'ami\x20disconnected'][_0x2452('0x13')]('\x20')));}var _0x53fd05=schema(properties[_0x2452('0x5d')])[_0x2452('0x1')](_0x57f815);if(_0x53fd05['length']>0x0){return _0x38615e(_0x491089[_0x2452('0x10')](0x1f4,_['map'](_0x53fd05,_0x2452('0x19'))['join'](',\x20')));}var _0x4fc8d4=_['find'](_0x2f21dc[_0x2452('0x5b')],{'uniqueid':_0x57f815[_0x2452('0x5e')]});if(_0x4fc8d4&&_0x4fc8d4[_0x2452('0x5f')]){var _0x4b705f=util[_0x2452('0x6')](_0x2452('0x60'),_0x57f815[_0x2452('0x61')]||_0x57f815[_0x2452('0x5e')],_0x57f815[_0x2452('0x6')]||'wav');return ami[_0x2452('0x17')]({'action':'MixMonitor','channel':_0x4fc8d4[_0x2452('0x5f')],'file':_0x4b705f,'options':_0x2452('0x62')})[_0x2452('0x18')](function(_0x51eb53){var _0x6ee99d=_[_0x2452('0x57')](_0x4fc8d4[_0x2452('0x63')],{'filename':_0x2452('0x64')+_0x4b705f[_0x2452('0x65')]()});if(_['isNil'](_0x6ee99d)){_0x4fc8d4[_0x2452('0x63')]['push']({'filename':_0x2452('0x64')+_0x4b705f['toLowerCase'](),'createdAt':moment()[_0x2452('0x6')](_0x2452('0x66')),'mixmonitorid':_0x51eb53['mixmonitorid'],'status':_0x2452('0x67')});}else{_0x6ee99d[_0x2452('0x68')]=_0x51eb53[_0x2452('0x68')];_0x6ee99d[_0x2452('0x69')]=_0x2452('0x67');}_0x3e4a8b({'code':0xc8,'message':[_0x57f815[_0x2452('0x5e')],_0x2452('0x6a'),_0x51eb53[_0x2452('0x68')]][_0x2452('0x13')]('\x20'),'mixmonitorid':_0x51eb53[_0x2452('0x68')]});})[_0x2452('0x1a')](function(_0x4c203f){_0x38615e(_0x491089[_0x2452('0x10')](0x1f5,[_0x57f815['uniqueid'],_0x4c203f[_0x2452('0x19')]['toLowerCase']()][_0x2452('0x13')]('\x20')));});}else{return _0x38615e(_0x491089[_0x2452('0x10')](0x1f5,_0x2452('0x6b')));}});},'VoiceChannelStopMixMonitor':function(_0x1cc61){var _0x321092=this;return new Promise(function(_0x3b3a5a,_0x2c2bce){if(ami[_0x2452('0x1b')]()==![]){return _0x2c2bce(_0x321092[_0x2452('0x10')](0x1f4,[config[_0x2452('0x11')]['ip'],config[_0x2452('0x11')]['username'],_0x2452('0x12')][_0x2452('0x13')]('\x20')));}var _0x37ed11=schema(properties[_0x2452('0x5d')])[_0x2452('0x1')](_0x1cc61);if(_0x37ed11[_0x2452('0x5c')]>0x0){return _0x2c2bce(_0x321092['error'](0x1f4,_[_0x2452('0x6c')](_0x37ed11,_0x2452('0x19'))['join'](',\x20')));}var _0x2c8480=_[_0x2452('0x57')](_0x2f21dc[_0x2452('0x5b')],{'uniqueid':_0x1cc61[_0x2452('0x5e')]});if(_0x2c8480){return Promise[_0x2452('0x6d')]()[_0x2452('0x18')](function(){if(_0x2c8480[_0x2452('0x5f')]){return ami[_0x2452('0x17')]({'action':_0x2452('0x6e'),'channel':_0x2c8480[_0x2452('0x5f')],'mixmonitorid':_0x1cc61[_0x2452('0x68')]})['catch'](function(){});}})['then'](function(){if(_0x2c8480[_0x2452('0x6f')]){return ami['Action']({'action':_0x2452('0x6e'),'channel':_0x2c8480[_0x2452('0x6f')],'mixmonitorid':_0x1cc61[_0x2452('0x68')]})[_0x2452('0x1a')](function(){});}})[_0x2452('0x18')](function(){var _0x3181e0=_['find'](_0x2c8480['monitors'],{'mixmonitorid':_0x1cc61[_0x2452('0x68')]});if(_0x3181e0){_0x3181e0['status']=_0x2452('0x70');}})['then'](function(){var _0x224cc0=util[_0x2452('0x6')](_0x2452('0x60'),_0x1cc61[_0x2452('0x61')]||_0x1cc61['uniqueid'],_0x1cc61['format']||'wav');var _0x9ef864=_[_0x2452('0x57')](_0x2c8480['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x224cc0['toLowerCase']()});if(_0x9ef864){_0x9ef864['status']='stop';}})[_0x2452('0x18')](function(){_0x3b3a5a({'code':0xc8,'message':[_0x1cc61['uniqueid'],'StopMixMonitor\x20Success'][_0x2452('0x13')]('\x20')});})[_0x2452('0x1a')](function(_0x3ce2e0){_0x2c2bce(_0x321092[_0x2452('0x10')](0x1f5,[_0x1cc61[_0x2452('0x5e')],_0x3ce2e0[_0x2452('0x19')]['toLowerCase']()][_0x2452('0x13')]('\x20')));});}else{return _0x2c2bce(_0x321092[_0x2452('0x10')](0x1f5,_0x2452('0x6b')));}});},'VoiceQueuesChannels':function(){return new Promise(function(_0x565817){var _0x490b25=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x71')]);_0x565817({'count':_0x490b25[_0x2452('0x5c')],'rows':_0x490b25});});},'VoiceQueuesChannel':function(_0x1dec54){var _0x401628=this;return new Promise(function(_0x336fc6,_0x4dd13d){var _0x2b2033=schema(properties['voicequeuechannel'])[_0x2452('0x1')](_0x1dec54);if(_0x2b2033[_0x2452('0x5c')]>0x0){return _0x4dd13d(_0x401628[_0x2452('0x10')](0x1f4,_[_0x2452('0x6c')](_0x2b2033,'message')[_0x2452('0x13')](',\x20')));}var _0x132cd3=_['find'](_0x2f21dc[_0x2452('0x71')],{'uniqueid':_0x1dec54[_0x2452('0x5e')]});if(_0x132cd3){_0x336fc6(_0x132cd3);}else{return _0x4dd13d(_0x401628[_0x2452('0x10')](0x1f5,_0x2452('0x6b')));}});},'VoiceQueuesChannelHangup':function(_0x19cf40){var _0x23cf93=this;return new Promise(function(_0x3e5269,_0xb53074){if(ami['isConnected']()==![]){return _0xb53074(_0x23cf93['error'](0x1f4,[config[_0x2452('0x11')]['ip'],config[_0x2452('0x11')][_0x2452('0x1c')],_0x2452('0x12')]['join']('\x20')));}var _0x19d376=schema(properties[_0x2452('0x72')])[_0x2452('0x1')](_0x19cf40);if(_0x19d376[_0x2452('0x5c')]>0x0){return _0xb53074(_0x23cf93['error'](0x1f4,_[_0x2452('0x6c')](_0x19d376,_0x2452('0x19'))[_0x2452('0x13')](',\x20')));}var _0x411c0b=_['find'](_0x2f21dc['queueChannels'],{'uniqueid':_0x19cf40[_0x2452('0x5e')]});if(_0x411c0b&&_0x411c0b[_0x2452('0x5f')]){return ami['Action']({'action':_0x2452('0x73'),'channel':_0x411c0b[_0x2452('0x5f')]})[_0x2452('0x18')](function(_0x19b52b){_0x3e5269({'code':0xc8,'message':[_0x19cf40[_0x2452('0x5e')],_0x19b52b[_0x2452('0x19')][_0x2452('0x65')]()][_0x2452('0x13')]('\x20')});})[_0x2452('0x1a')](function(_0x378224){_0xb53074(_0x23cf93[_0x2452('0x10')](0x1f5,[_0x19cf40[_0x2452('0x5e')],_0x378224[_0x2452('0x19')][_0x2452('0x65')]()][_0x2452('0x13')]('\x20')));});}else{return _0xb53074(_0x23cf93[_0x2452('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x16ca73){var _0x40ca65=this;return new Promise(function(_0x2d4f2f,_0x4e8688){if(ami['isConnected']()==![]){return _0x4e8688(_0x40ca65['error'](0x1f4,[config[_0x2452('0x11')]['ip'],config[_0x2452('0x11')][_0x2452('0x1c')],_0x2452('0x12')]['join']('\x20')));}var _0x5b5719=schema(properties['voicequeuechannelredirect'])[_0x2452('0x1')](_0x16ca73);if(_0x5b5719['length']>0x0){return _0x4e8688(_0x40ca65[_0x2452('0x10')](0x1f4,_['map'](_0x5b5719,_0x2452('0x19'))['join'](',\x20')));}var _0xc14791=_['find'](_0x2f21dc[_0x2452('0x71')],{'uniqueid':_0x16ca73[_0x2452('0x5e')]});if(_0xc14791&&_0xc14791[_0x2452('0x5f')]){return ami[_0x2452('0x17')]({'action':_0x2452('0x74'),'channel':_0xc14791['channel'],'exten':_0x16ca73[_0x2452('0x75')],'context':_0x16ca73[_0x2452('0x76')]||_0xc14791[_0x2452('0x76')],'priority':0x1})[_0x2452('0x18')](function(_0x285407){_0x2d4f2f({'code':0xc8,'message':[_0x16ca73[_0x2452('0x5e')],_0x285407[_0x2452('0x19')][_0x2452('0x65')]()][_0x2452('0x13')]('\x20')});})[_0x2452('0x1a')](function(_0x3f1126){_0x4e8688(_0x40ca65['error'](0x1f5,[_0x16ca73[_0x2452('0x5e')],_0x3f1126['message'][_0x2452('0x65')]()]['join']('\x20')));});}else{return _0x4e8688(_0x40ca65['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x59119f){return new Promise(function(_0x5f5c4f){var _0x4f485c=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0xc')]);if(_0x59119f&&_0x59119f['id']){var _0x2cdeca=_['find'](_0x4f485c,function(_0x4ef9ed){return _0x4ef9ed['id']===_0x59119f['id'];});_0x5f5c4f(_0x2cdeca);}else{_0x5f5c4f({'count':_0x4f485c['length'],'rows':_0x4f485c});}});},'Telephones':function(){return new Promise(function(_0x352a66){var _0x2167dc=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x77')]);_0x352a66({'count':_0x2167dc[_0x2452('0x5c')],'rows':_0x2167dc});});},'Trunks':function(){return new Promise(function(_0x5cbc70){var _0x3454e3=_['values'](_0x2f21dc[_0x2452('0x78')]);_0x5cbc70({'count':_0x3454e3[_0x2452('0x5c')],'rows':_0x3454e3});});},'OutboundChannels':function(){return new Promise(function(_0x5090f8){var _0x3c1519=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x79')]);_0x5090f8({'count':_0x3c1519[_0x2452('0x5c')],'rows':_0x3c1519});});},'Outbound':function(){return new Promise(function(_0x4fc46f){_0x4fc46f(_0x2f21dc[_0x2452('0x2c')]);});},'Campaigns':function(){return new Promise(function(_0x5a25cb){var _0x102a82=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x7a')]);_0x5a25cb({'count':_0x102a82[_0x2452('0x5c')],'rows':_0x102a82});});},'VoiceQueuesPreview':function(_0x1aacaa){var _0x558eb8=this;return new Promise(function(_0x19465d,_0x20ae3c){_0x34ff44[_0x2452('0x7b')](_0x1aacaa['id'])[_0x2452('0x18')](function(_0x52fc60){_0x19465d({'code':0xc8,'message':_0x52fc60[_0x2452('0x19')]});})[_0x2452('0x1a')](function(_0xdeeeff){_0x20ae3c(_0x558eb8[_0x2452('0x10')](0x1f4,_0xdeeeff[_0x2452('0x19')]));});});},'EventManager':function(_0xcdd3dc){var _0x2dae0b=this;return new Promise(function(_0x4e7078,_0x1c6afe){if(!_0xcdd3dc['event']){return _0x1c6afe(_0x2dae0b['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x2452('0x7c')](_0x2452('0x7d')+_0xcdd3dc[_0x2452('0x7e')],_0xcdd3dc[_0x2452('0x19')]);_0x4e7078({'code':0xc8,'message':_0xcdd3dc});});},'FaxAccounts':function(){return new Promise(function(_0x276eed){var _0x38524b=_[_0x2452('0x5a')](_0x2f21dc[_0x2452('0x7f')]);_0x276eed({'count':_0x38524b[_0x2452('0x5c')],'rows':_0x38524b});});},'SendFax':function(_0x4d182d){var _0x4c85ef=this;return new Promise(function(_0x57aa9e,_0x28c8a8){_0x243893['send'](_0x4d182d)['then'](function(_0xec2569){_0x57aa9e({'code':0xc8,'message':_0xec2569[_0x2452('0x19')]});})[_0x2452('0x1a')](function(_0xbcee27){_0x28c8a8(_0x4c85ef[_0x2452('0x10')](0x1f4,_0xbcee27['message']));});});},'CheckAfterSend':function(_0x416cae){var _0x4145a5=this;return new Promise(function(_0x1c7232,_0x2c4829){_0x243893[_0x2452('0x80')](_0x416cae)['then'](function(_0x205bef){_0x1c7232({'code':0xc8,'message':_0x205bef['message']});})[_0x2452('0x1a')](function(_0x51b6ef){_0x2c4829(_0x4145a5[_0x2452('0x10')](0x1f4,_0x51b6ef[_0x2452('0x19')]));});});}};var _0x267f50=jayson[_0x2452('0x81')](_0x2f0139)['http']();_0x267f50['on']('error',function(_0x50e44a){return _0x226578(_0x50e44a);});_0x267f50[_0x2452('0x5')](0x232a,_0x2452('0x82'),function(){console[_0x2452('0x83')](_0x2452('0x84'),0x232a);return _0x15fc69(_0x2452('0x85')+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 933ba63..7d7858d 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 _0xbfe2=['data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','name','trigger:%s','action','merge','lodash','bluebird','ioredis','util','../../rpc/cmContact','redis','defaults','info','stringify','emit','exec','data2','isNil'];(function(_0x5da21c,_0x3daf7f){var _0x47ea89=function(_0x1e8140){while(--_0x1e8140){_0x5da21c['push'](_0x5da21c['shift']());}};_0x47ea89(++_0x3daf7f);}(_0xbfe2,0x16d));var _0x2bfe=function(_0x4c9727,_0x4c54a3){_0x4c9727=_0x4c9727-0x0;var _0x2412f6=_0xbfe2[_0x4c9727];return _0x2412f6;};'use strict';var _=require(_0x2bfe('0x0'));var BPromise=require(_0x2bfe('0x1'));var Redis=require(_0x2bfe('0x2'));var util=require(_0x2bfe('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x2bfe('0x4'));config[_0x2bfe('0x5')]=_[_0x2bfe('0x6')](config[_0x2bfe('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x46f6ab,_0x115257,_0x4c9646,_0x43b026,_0x213ab4){logger[_0x2bfe('0x7')]('[CM][%s][%s]',_0x46f6ab,_0x115257['id'],_0x4c9646,_0x43b026,JSON[_0x2bfe('0x8')](_0x213ab4));io['to'](_0x4c9646)[_0x2bfe('0x9')](_0x43b026,_0x213ab4);}exports[_0x2bfe('0xa')]=function(_0x47cd87,_0x2445d7,_0x3208a2,_0x4e5073){var _0x27c3d4,_0x513a31;var _0x1c7a44={};var _0x34e571;var _0x5c940b=Number(_0x3208a2['data1']);var _0x575b4b=_0x3208a2[_0x2bfe('0xb')]?Boolean(Number(_0x3208a2[_0x2bfe('0xb')])):![];var _0x4ec88d;var _0x474a45=![];if(!_[_0x2bfe('0xc')](_0x3208a2[_0x2bfe('0xd')])){if(_0x3208a2['data5']=='1')_0x474a45=!![];}if(!_0x474a45){if(_0x4e5073[_0x2bfe('0xe')]){_0x1c7a44['id']=_0x4e5073[_0x2bfe('0xe')];}}if(!_0x1c7a44['id']){_0x1c7a44[_0x2bfe('0xf')]=_0x5c940b;_0x4ec88d=_0x3208a2[_0x2bfe('0x10')]&&_0x3208a2['data3']!=='0'?_0x3208a2[_0x2bfe('0x10')]['split'](','):[_0x2bfe('0x11')];_0x1c7a44[_0x2bfe('0x12')]=_[_0x2bfe('0x13')](_0x4ec88d,function(_0x2d5f89){var _0x74844a={};_0x74844a[_0x2d5f89]=_0x4e5073[_0x2bfe('0x14')]?_0x4e5073['destcalleridnum']:_0x4e5073[_0x2bfe('0x15')];return _0x74844a;});_0x34e571=_0x4e5073[_0x2bfe('0x14')]?_0x4e5073[_0x2bfe('0x16')]:_0x4e5073[_0x2bfe('0x15')];}var _0x10f5ac=['id',_0x2bfe('0x17'),_0x2bfe('0x18'),_0x2bfe('0x11'),_0x2bfe('0x19'),_0x2bfe('0x1a'),_0x2bfe('0xf'),_0x2bfe('0x1b'),_0x2bfe('0x1c'),_0x2bfe('0x1d')];var _0x468231=_['union'](_0x10f5ac,_0x4ec88d);BPromise[_0x2bfe('0x1e')]()[_0x2bfe('0x1f')](cmContactRpc[_0x2bfe('0x20')]({'attributes':_0x468231,'where':_0x1c7a44,'phone':_0x34e571}))['then'](function(_0x51311a){_0x513a31=_0x51311a;if(!_[_0x2bfe('0x21')](_0x513a31)){if(_0x513a31[_0x2bfe('0x22')]===0x1){_0x27c3d4=_0x513a31[0x0];logger[_0x2bfe('0x7')](_0x2bfe('0x23'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_0x27c3d4['id']);}else{logger['info'](_0x2bfe('0x25'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_[_0x2bfe('0x13')](_0x513a31,'id')[_0x2bfe('0x26')](','));}return;}else{logger[_0x2bfe('0x7')](_0x2bfe('0x27'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id']);var _0x5d6c85={'ListId':_0x5c940b};var _0x1c46ec=_0x3208a2[_0x2bfe('0x28')]&&_0x3208a2['data4']!=='0'?_0x3208a2[_0x2bfe('0x28')]:_0x2bfe('0x11');if(_0x575b4b){logger[_0x2bfe('0x7')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4e5073['uniqueid'],_0x2445d7['id']);_0x5d6c85[_0x1c46ec]=_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])?_0x4e5073['calleridnum']:_0x4e5073[_0x2bfe('0x16')];if(_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])){_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073[_0x2bfe('0x29')]&&_0x4e5073[_0x2bfe('0x29')]!==_0x2bfe('0x2a')?_0x4e5073['calleridname']:_0x2bfe('0x2b');}else{_0x5d6c85['firstName']=_0x4e5073[_0x2bfe('0x2c')]&&_0x4e5073[_0x2bfe('0x2c')]!==_0x2bfe('0x2a')?_0x4e5073[_0x2bfe('0x2c')]:'Unknown';}return BPromise['resolve']()[_0x2bfe('0x1f')](cmContactRpc[_0x2bfe('0x2d')](_0x5d6c85))[_0x2bfe('0x1f')](function(_0x34efc2){_0x27c3d4=_0x34efc2;_0x513a31[_0x2bfe('0x2e')](_0x34efc2);if(_0x27c3d4){logger[_0x2bfe('0x7')](_0x2bfe('0x2f'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id'],_0x27c3d4['id']);}return;});}else{logger['info'](_0x2bfe('0x30'),_0x4e5073[_0x2bfe('0x24')],_0x2445d7['id']);_0x5d6c85[_0x1c46ec]=_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])?_0x4e5073[_0x2bfe('0x15')]:_0x4e5073[_0x2bfe('0x16')];if(_[_0x2bfe('0xc')](_0x4e5073[_0x2bfe('0x14')])){_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073[_0x2bfe('0x29')]&&_0x4e5073['calleridname']!==''?_0x4e5073[_0x2bfe('0x29')]:'Unknown';}else{_0x5d6c85[_0x2bfe('0x17')]=_0x4e5073['destcalleridname']&&_0x4e5073[_0x2bfe('0x2c')]!==_0x2bfe('0x2a')?_0x4e5073[_0x2bfe('0x2c')]:_0x2bfe('0x2b');}_0x27c3d4=_0x5d6c85;_0x513a31[_0x2bfe('0x2e')](_0x5d6c85);return;}}})[_0x2bfe('0x1f')](function(){if(_0x47cd87){emit(_0x4e5073[_0x2bfe('0x24')],_0x2445d7,util[_0x2bfe('0x31')]('user:%s',_0x47cd87[_0x2bfe('0x32')]),util[_0x2bfe('0x31')](_0x2bfe('0x33'),_0x3208a2[_0x2bfe('0x34')]['toLowerCase']()),{'evt':_[_0x2bfe('0x35')](_0x4e5073,{'autoCreate':_0x575b4b}),'contact':_0x27c3d4===undefined?{}:_0x27c3d4,'contacts':_0x513a31['length']===0x0?undefined:_0x513a31});}});}; \ No newline at end of file +var _0xcb27=['firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','[CM][%s][%s]\x20Autocreate\x20enabled','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','calleridname','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','destcalleridnum','calleridnum','routeId'];(function(_0x4b64a4,_0x1bdc50){var _0xd19b0e=function(_0x4dfbe0){while(--_0x4dfbe0){_0x4b64a4['push'](_0x4b64a4['shift']());}};_0xd19b0e(++_0x1bdc50);}(_0xcb27,0x115));var _0x7cb2=function(_0x63be1f,_0x5bafc6){_0x63be1f=_0x63be1f-0x0;var _0x400ffb=_0xcb27[_0x63be1f];return _0x400ffb;};'use strict';var _=require(_0x7cb2('0x0'));var BPromise=require(_0x7cb2('0x1'));var Redis=require(_0x7cb2('0x2'));var util=require(_0x7cb2('0x3'));var config=require(_0x7cb2('0x4'));var logger=require(_0x7cb2('0x5'))('trigger');var cmContactRpc=require(_0x7cb2('0x6'));config['redis']=_[_0x7cb2('0x7')](config[_0x7cb2('0x8')],{'host':_0x7cb2('0x9'),'port':0x18eb});var io=require(_0x7cb2('0xa'))(new Redis(config['redis']));function emit(_0x35451e,_0x108c71,_0x35f375,_0x164853,_0xb0229f){logger['info'](_0x7cb2('0xb'),_0x35451e,_0x108c71['id'],_0x35f375,_0x164853,JSON[_0x7cb2('0xc')](_0xb0229f));io['to'](_0x35f375)[_0x7cb2('0xd')](_0x164853,_0xb0229f);}exports[_0x7cb2('0xe')]=function(_0x46825d,_0x4c3a40,_0x21eca3,_0x31868b){var _0xe1ddeb,_0x32e4f6;var _0x219675={};var _0x304df7;var _0x4bd1c3=Number(_0x21eca3[_0x7cb2('0xf')]);var _0x18d867=_0x21eca3[_0x7cb2('0x10')]?Boolean(Number(_0x21eca3[_0x7cb2('0x10')])):![];var _0x403c64;var _0x43f905=![];if(!_[_0x7cb2('0x11')](_0x21eca3['data5'])){if(_0x21eca3[_0x7cb2('0x12')]=='1')_0x43f905=!![];}if(!_0x43f905){if(_0x31868b['xmd-contactid']){_0x219675['id']=_0x31868b[_0x7cb2('0x13')];}}if(!_0x219675['id']){_0x219675[_0x7cb2('0x14')]=_0x4bd1c3;_0x403c64=_0x21eca3[_0x7cb2('0x15')]&&_0x21eca3['data3']!=='0'?_0x21eca3[_0x7cb2('0x15')][_0x7cb2('0x16')](','):['phone'];_0x219675[_0x7cb2('0x17')]=_[_0x7cb2('0x18')](_0x403c64,function(_0x1a4a7d){var _0x2dd407={};_0x2dd407[_0x1a4a7d]=_0x31868b['routeId']?_0x31868b[_0x7cb2('0x19')]:_0x31868b[_0x7cb2('0x1a')];return _0x2dd407;});_0x304df7=_0x31868b[_0x7cb2('0x1b')]?_0x31868b[_0x7cb2('0x19')]:_0x31868b[_0x7cb2('0x1a')];}var _0x4faab2=['id',_0x7cb2('0x1c'),_0x7cb2('0x1d'),'phone',_0x7cb2('0x1e'),_0x7cb2('0x1f'),_0x7cb2('0x14'),_0x7cb2('0x20'),_0x7cb2('0x21'),_0x7cb2('0x22')];var _0x392941=_[_0x7cb2('0x23')](_0x4faab2,_0x403c64);BPromise[_0x7cb2('0x24')]()[_0x7cb2('0x25')](cmContactRpc[_0x7cb2('0x26')]({'attributes':_0x392941,'where':_0x219675,'phone':_0x304df7}))[_0x7cb2('0x25')](function(_0x4e0963){_0x32e4f6=_0x4e0963;if(!_[_0x7cb2('0x27')](_0x32e4f6)){if(_0x32e4f6[_0x7cb2('0x28')]===0x1){_0xe1ddeb=_0x32e4f6[0x0];logger[_0x7cb2('0x29')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id'],_0xe1ddeb['id']);}else{logger[_0x7cb2('0x29')](_0x7cb2('0x2b'),_0x31868b['uniqueid'],_0x4c3a40['id'],_[_0x7cb2('0x18')](_0x32e4f6,'id')[_0x7cb2('0x2c')](','));}return;}else{logger['info'](_0x7cb2('0x2d'),_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id']);var _0x389416={'ListId':_0x4bd1c3};var _0xb175da=_0x21eca3['data4']&&_0x21eca3[_0x7cb2('0x2e')]!=='0'?_0x21eca3[_0x7cb2('0x2e')]:_0x7cb2('0x2f');if(_0x18d867){logger[_0x7cb2('0x29')](_0x7cb2('0x30'),_0x31868b['uniqueid'],_0x4c3a40['id']);_0x389416[_0xb175da]=_[_0x7cb2('0x11')](_0x31868b['routeId'])?_0x31868b[_0x7cb2('0x1a')]:_0x31868b[_0x7cb2('0x19')];if(_[_0x7cb2('0x11')](_0x31868b[_0x7cb2('0x1b')])){_0x389416[_0x7cb2('0x1c')]=_0x31868b['calleridname']&&_0x31868b['calleridname']!==_0x7cb2('0x31')?_0x31868b['calleridname']:_0x7cb2('0x32');}else{_0x389416[_0x7cb2('0x1c')]=_0x31868b[_0x7cb2('0x33')]&&_0x31868b['destcalleridname']!==_0x7cb2('0x31')?_0x31868b[_0x7cb2('0x33')]:'Unknown';}return BPromise[_0x7cb2('0x24')]()[_0x7cb2('0x25')](cmContactRpc['createContact'](_0x389416))[_0x7cb2('0x25')](function(_0x1e6bae){_0xe1ddeb=_0x1e6bae;_0x32e4f6[_0x7cb2('0x34')](_0x1e6bae);if(_0xe1ddeb){logger[_0x7cb2('0x29')](_0x7cb2('0x35'),_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id'],_0xe1ddeb['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x31868b[_0x7cb2('0x2a')],_0x4c3a40['id']);_0x389416[_0xb175da]=_[_0x7cb2('0x11')](_0x31868b['routeId'])?_0x31868b[_0x7cb2('0x1a')]:_0x31868b['destcalleridnum'];if(_[_0x7cb2('0x11')](_0x31868b['routeId'])){_0x389416['firstName']=_0x31868b['calleridname']&&_0x31868b['calleridname']!==_0x7cb2('0x31')?_0x31868b[_0x7cb2('0x36')]:_0x7cb2('0x32');}else{_0x389416['firstName']=_0x31868b[_0x7cb2('0x33')]&&_0x31868b[_0x7cb2('0x33')]!==_0x7cb2('0x31')?_0x31868b['destcalleridname']:_0x7cb2('0x32');}_0xe1ddeb=_0x389416;_0x32e4f6['push'](_0x389416);return;}}})[_0x7cb2('0x25')](function(){if(_0x46825d){emit(_0x31868b['uniqueid'],_0x4c3a40,util[_0x7cb2('0x37')]('user:%s',_0x46825d[_0x7cb2('0x38')]),util[_0x7cb2('0x37')](_0x7cb2('0x39'),_0x21eca3[_0x7cb2('0x3a')][_0x7cb2('0x3b')]()),{'evt':_[_0x7cb2('0x3c')](_0x31868b,{'autoCreate':_0x18d867}),'contact':_0xe1ddeb===undefined?{}:_0xe1ddeb,'contacts':_0x32e4f6[_0x7cb2('0x28')]===0x0?undefined:_0x32e4f6});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 8fc20ca..2cdfd64 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 _0xfef9=['custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','motionChannel','voice','checkTriggers','syncAgentDial','interface','hasOwnProperty','status','checkTrigger','merge','variables','length','action','toLowerCase','contactmanager','browser','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','uriLocation','data5','800','windowHeight','data6','600','winApplication','winArguments','format','user:%s','name','trigger:%s:%s','data1','trigger:%s','exec','integration','queue','routeId','parse','query','search','replace','AllConditions','checkConditions','channel','AnyConditions','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','undefined','offlineMessage','created','equals','exports','util','url','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:amd','custom:queuecallerabandon','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage'];(function(_0x5432a9,_0x544332){var _0x5cf27d=function(_0x4f4f51){while(--_0x4f4f51){_0x5432a9['push'](_0x5432a9['shift']());}};_0x5cf27d(++_0x544332);}(_0xfef9,0xcc));var _0x9fef=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xfef9[_0x3a9635];return _0x10d08c;};'use strict';var util=require(_0x9fef('0x0'));var _=require('lodash');var url=require(_0x9fef('0x1'));var Mustache=require(_0x9fef('0x2'));var Redis=require('ioredis');var urlforward=require(_0x9fef('0x3'));var integration=require(_0x9fef('0x4'));var cmContact=require(_0x9fef('0x5'));var script=require(_0x9fef('0x6'));var config=require(_0x9fef('0x7'));var logger=require(_0x9fef('0x8'))(_0x9fef('0x9'));var ami=require(_0x9fef('0xa'));config['redis']=_[_0x9fef('0xb')](config[_0x9fef('0xc')],{'host':_0x9fef('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9fef('0xc')]));var operators={'equals':function(_0x1da1b3,_0x2d37c3){return _0x1da1b3==_0x2d37c3;},'not_equals':function(_0x3d926e,_0x17d2c3){return _0x3d926e!=_0x17d2c3;}};var barAndWebActions=[_0x9fef('0xe'),'url',_0x9fef('0xf')];function Trigger(_0x70f56c){this['triggers']=_0x70f56c[_0x9fef('0x10')];this[_0x9fef('0x11')]=_0x70f56c[_0x9fef('0x11')];this[_0x9fef('0x12')]=_0x70f56c['voiceQueues'];this['templates']=_0x70f56c[_0x9fef('0x13')];this['voiceExtensions']=_0x70f56c[_0x9fef('0x14')];this[_0x9fef('0x15')]=_0x70f56c['zendeskAccounts'];this[_0x9fef('0x16')]=_0x70f56c[_0x9fef('0x16')];this['salesforceAccounts']=_0x70f56c['salesforceAccounts'];this['sugarcrmAccounts']=_0x70f56c[_0x9fef('0x17')];this['zohoAccounts']=_0x70f56c[_0x9fef('0x18')];this['deskAccounts']=_0x70f56c[_0x9fef('0x19')];this[_0x9fef('0x1a')]=_0x70f56c['vtigerAccounts'];this[_0x9fef('0x1b')]=_0x70f56c['servicenowAccounts'];this[_0x9fef('0x1c')]=_0x70f56c[_0x9fef('0x1c')];this['freshsalesAccounts']=_0x70f56c['freshsalesAccounts'];this[_0x9fef('0x1d')]={'zendesk':this[_0x9fef('0x15')],'salesforce':this[_0x9fef('0x1e')],'freshdesk':this[_0x9fef('0x16')],'sugarcrm':this['sugarcrmAccounts'],'zoho':this['zohoAccounts'],'desk':this[_0x9fef('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this['servicenowAccounts']};ami['on'](_0x9fef('0x1f'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x22'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x23'),this['syncCustomEvent'][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x24'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x25'),this['syncCustomEvent'][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x26'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x27'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x28'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on']('custom:agentreject',this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x29'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x2a'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on']('custom:timeout',this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on']('custom:dialbegin',this['syncAgentDial']['bind'](this));ami['on'](_0x9fef('0x2b'),this['syncAgentDial'][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x2c'),this['syncAgentDial']['bind'](this));ami['on'](_0x9fef('0x2d'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x2e'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x2f'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x30'),this['syncCustomEvent'][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x31'),this[_0x9fef('0x20')]['bind'](this));ami['on'](_0x9fef('0x32'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x33'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));ami['on'](_0x9fef('0x34'),this[_0x9fef('0x20')][_0x9fef('0x21')](this));}Trigger[_0x9fef('0x35')]['emit']=function(_0xef9698,_0x5773e4,_0x3a261e){logger[_0x9fef('0x36')](_0xef9698,_0x5773e4,JSON[_0x9fef('0x37')](_0x3a261e));io['to'](_0xef9698)[_0x9fef('0x38')](_0x5773e4,_0x3a261e);};Trigger[_0x9fef('0x35')][_0x9fef('0x20')]=function(_0x4fda35){var _0x3de7ff=_['clone'](_0x4fda35);if(typeof _0x3de7ff[_0x9fef('0x39')]==='undefined'){_0x3de7ff[_0x9fef('0x39')]=_0x9fef('0x3a');}this[_0x9fef('0x3b')](_0x3de7ff);};Trigger[_0x9fef('0x35')][_0x9fef('0x3c')]=function(_0x57f028){if(this[_0x9fef('0x11')][_0x57f028[_0x9fef('0x3d')]]){this[_0x9fef('0x20')](_0x57f028);}};Trigger[_0x9fef('0x35')][_0x9fef('0x3b')]=function(_0x2381ba){var _0x4df74c;for(var _0x3b1fdb in this['triggers']){if(this[_0x9fef('0x10')][_0x9fef('0x3e')](_0x3b1fdb)){if(this[_0x9fef('0x10')][_0x3b1fdb][_0x9fef('0x3f')]){_0x4df74c=this[_0x9fef('0x40')](this[_0x9fef('0x10')][_0x3b1fdb],_0x2381ba);if(_0x4df74c){_[_0x9fef('0x41')](_0x2381ba,_0x2381ba[_0x9fef('0x42')]);for(var _0x55b9e6=0x0,_0x57ef8e,_0x569817,_0x3c1bf9;_0x55b9e60x0){_0x57001c=_[_0x35fc('0x26')](_0x274208,_0x1a5d92);}return _0x57001c;}function getCustomFields(_0x383837,_0x9f3c8a){var _0x3735da=[];var _0x134dfa={'custom_fields':{}};if(_0x383837[_0x35fc('0x25')]>0x0){_[_0x35fc('0x27')](_0x383837,function(_0x54aedc){if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc['type'])&&_0x54aedc[_0x35fc('0x2b')]&&!_0x54aedc[_0x35fc('0x2c')]){_0x134dfa[_0x54aedc[_0x35fc('0x2b')][_0x35fc('0x2d')]()]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_[_0x35fc('0x28')]([_0x35fc('0x29'),_0x35fc('0x2a')],_0x54aedc[_0x35fc('0x2f')])&&_0x54aedc['idField']&&_0x54aedc['customField']){_0x134dfa[_0x35fc('0x30')][_0x54aedc['idField']]=_0x54aedc[_0x35fc('0x2e')][_0x35fc('0x1e')]();}else if(_0x54aedc[_0x35fc('0x2f')]===_0x35fc('0x31')&&_0x54aedc[_0x35fc('0x32')]&&_0x54aedc[_0x35fc('0x33')]&&_0x54aedc['customField']){_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc[_0x35fc('0x32')]][_0x35fc('0x1e')]());}else if(_0x54aedc[_0x35fc('0x2f')]==='customVariable'&&_0x54aedc[_0x35fc('0x34')]&&_0x54aedc[_0x35fc('0x34')][_0x35fc('0x35')]&&_0x54aedc['idField']&&_0x54aedc[_0x35fc('0x2c')]){_0x9f3c8a[_0x54aedc['Variable'][_0x35fc('0x35')][_0x35fc('0x2d')]()]&&(_0x134dfa[_0x35fc('0x30')][_0x54aedc[_0x35fc('0x33')]]=_0x9f3c8a[_0x54aedc['Variable']['name']['toLowerCase']()][_0x35fc('0x1e')]());}});}if(_0x134dfa['priority']){_0x134dfa[_0x35fc('0x36')]=Number(_0x134dfa['priority']);}return _0x134dfa;}function getTicket(_0x9c6b65,_0x1f2d66,_0x2ca9ac,_0x22b724,_0x1c10e0){logger[_0x35fc('0xb')](_0x35fc('0x37'));var _0x4ec0dc=_[_0x35fc('0x38')]({'subject':intUtil[_0x35fc('0x39')](_0x22b724['Subjects'],_0x1c10e0,'\x20'),'type':_0x35fc('0x3a'),'status':_0x35fc('0x3b'),'labels':[_0x35fc('0x3c'),_0x35fc('0x3d'),_0x35fc('0x3e')][_0x35fc('0x3f')](getTags(_0x22b724['Tags'],_0x35fc('0x35'))),'description':intUtil[_0x35fc('0x39')](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0x35fc('0x41'),_0x1f2d66['id']),'class':_0x35fc('0x42')}},'message':{'direction':'in','body':intUtil['getString'](_0x22b724[_0x35fc('0x40')],_0x1c10e0,'\x0a')}},getCustomFields(_0x22b724[_0x35fc('0x43')],_0x1c10e0));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x44'),_0x9c6b65[_0x35fc('0xe')],_0x2ca9ac['id']),'method':_0x35fc('0x24'),'body':_0x4ec0dc});}exports[_0x35fc('0x45')]=function(_0x3ec51f,_0x5a7e9e,_0x596e83,_0x210d5d,_0x36fcf9,_0x4fdc6d){var _0x5c2e5c,_0x4ff202;_0x4fdc6d[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x4fdc6d['remoteUri']);_0x4fdc6d[_0x35fc('0x47')]=intUtil[_0x35fc('0x46')](_0x4fdc6d[_0x35fc('0x47')]);if(_0x36fcf9&&_0x36fcf9[_0x35fc('0x48')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x5a7e9e['recordingURL']=util['format'](_0x35fc('0x49'),_0x4fdc6d[_0x35fc('0x47')],_0x5a7e9e['uniqueid'],md5(_0x5a7e9e[_0x35fc('0x4a')]));}else{_0x5a7e9e['recordingURL']='';}headers[_0x35fc('0x4b')]=getAuth(_0x4fdc6d);return getUser(_0x4fdc6d,_0x210d5d[_0x35fc('0x4c')])[_0x35fc('0x21')](function(_0x2de5d1){_0x5c2e5c=_0x2de5d1;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x5c2e5c['id']);return getEndUser(_0x4fdc6d,_0x5a7e9e[_0x35fc('0x4d')],_0x5a7e9e[_0x35fc('0x4e')]);})['then'](function(_0x18181b){_0x4ff202=_0x18181b;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x4ff202['id']);return getTicket(_0x4fdc6d,_0x5c2e5c,_0x4ff202,_0x596e83,_0x5a7e9e);})[_0x35fc('0x21')](function(_0x5bc8c3){if(_0x5bc8c3){logger[_0x35fc('0xb')]('Ticket\x20created!');logger['info'](_0x35fc('0x50'),_0x5bc8c3['id']);switch(_0x4fdc6d[_0x35fc('0x2f')]){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x53'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d['name']),_0x35fc('0x55'),{'recordId':_0x5bc8c3['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')](_0x35fc('0x54'),_0x210d5d[_0x35fc('0x35')]),_0x35fc('0x58'),{'uri':util[_0x35fc('0x14')](_0x35fc('0x59'),_0x5bc8c3['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x52'),_0x35fc('0x5b'));}}})['catch'](function(_0x553ed6){console[_0x35fc('0x5a')](_0x553ed6);logger[_0x35fc('0x5a')](_0x35fc('0x52'),JSON[_0x35fc('0x17')](_0x553ed6));});};exports[_0x35fc('0x5c')]=function(_0x3e6494,_0x4a4798,_0x4f024c,_0x388521,_0x19b2ce,_0x395d63,_0x38bc78){var _0x5b2595,_0x467980;_0x395d63[_0x35fc('0xe')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0xe')]);_0x395d63[_0x35fc('0x47')]=intUtil['stripTrailingSlash'](_0x395d63[_0x35fc('0x47')]);if(_0x38bc78&&_0x38bc78[_0x35fc('0x5d')]&&_0x38bc78[_0x35fc('0x5d')]!==_0x35fc('0x5e')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4a4798[_0x35fc('0x5f')]=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x395d63[_0x35fc('0x47')],_0x4a4798[_0x35fc('0x4a')],md5(_0x4a4798[_0x35fc('0x4a')]));}headers[_0x35fc('0x4b')]=getAuth(_0x395d63);return getUser(_0x395d63,_0x388521[_0x35fc('0x4c')])['then'](function(_0x2d9d45){_0x5b2595=_0x2d9d45;logger[_0x35fc('0xb')](_0x35fc('0x60'),_0x5b2595['id']);return getEndUser(_0x395d63,_0x4a4798['destcalleridname'],_0x4a4798[_0x35fc('0x61')]);})[_0x35fc('0x21')](function(_0x47fb1a){_0x467980=_0x47fb1a;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0x467980['id']);return getTicket(_0x395d63,_0x5b2595,_0x467980,_0x4f024c,_0x4a4798);})[_0x35fc('0x21')](function(_0x1c4c33){if(_0x1c4c33){logger[_0x35fc('0xb')](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x1c4c33['id']);switch(_0x395d63['type']){case _0x35fc('0x51'):logger[_0x35fc('0xb')](_0x35fc('0x52'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:desk:display',{'recordId':_0x1c4c33['id']});break;case _0x35fc('0x56'):logger[_0x35fc('0xb')](_0x35fc('0x52'),_0x35fc('0x57'));emit(util[_0x35fc('0x14')]('user:%s',_0x388521['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x395d63[_0x35fc('0xe')],_0x1c4c33['id'])});break;default:logger[_0x35fc('0x5a')](_0x35fc('0x63'),_0x35fc('0x5b'));}}})['catch'](function(_0x458eb8){logger[_0x35fc('0x5a')](_0x35fc('0x63'),JSON[_0x35fc('0x17')](_0x458eb8));});};exports[_0x35fc('0x64')]=function(_0x1d0e53,_0x27071b,_0x2127e0,_0x462ceb,_0x4c3ace,_0x35d7c8){var _0x47c75f,_0xfbd737;_0x35d7c8[_0x35fc('0xe')]=intUtil[_0x35fc('0x46')](_0x35d7c8[_0x35fc('0xe')]);_0x35d7c8['serverUrl']=intUtil[_0x35fc('0x46')](_0x35d7c8['serverUrl']);if(_0x4c3ace&&_0x4c3ace['monitor_format']){logger['info']('['+_0x27071b[_0x35fc('0x65')]['toUpperCase']()+']',_0x35fc('0x66'));_0x27071b['recordingURL']=util[_0x35fc('0x14')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35d7c8[_0x35fc('0x47')],_0x27071b[_0x35fc('0x4a')],md5(_0x27071b[_0x35fc('0x4a')]));}else{_0x27071b[_0x35fc('0x5f')]='';}headers['Authorization']=getAuth(_0x35d7c8);return getUser(_0x35d7c8)[_0x35fc('0x21')](function(_0x1e2214){_0x47c75f=_0x1e2214;logger[_0x35fc('0xb')]('The\x20User\x20ID\x20is:',_0x47c75f['id']);return getEndUser(_0x35d7c8,_0x27071b[_0x35fc('0x4d')],_0x27071b[_0x35fc('0x4e')]);})[_0x35fc('0x21')](function(_0x3c1b56){_0xfbd737=_0x3c1b56;logger[_0x35fc('0xb')](_0x35fc('0x4f'),_0xfbd737['id']);return getTicket(_0x35d7c8,_0x47c75f,_0xfbd737,_0x2127e0,_0x27071b);})[_0x35fc('0x21')](function(_0x4464d5){if(_0x4464d5){logger['info'](_0x35fc('0x62'));logger[_0x35fc('0xb')](_0x35fc('0x50'),_0x4464d5['id']);}})['catch'](function(_0x1c88d8){logger[_0x35fc('0x5a')]('['+_0x27071b['lastevent']['toUpperCase']()+']',JSON[_0x35fc('0x17')](_0x1c88d8));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x27583a,_0x3a1272){var _0x2fb4d2=function(_0x2cb895){while(--_0x2cb895){_0x27583a['push'](_0x27583a['shift']());}};_0x2fb4d2(++_0x3a1272);}(_0x7217,0x19e));var _0x7721=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x7217[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index cdb3a95..8489600 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 _0xb2b8=['/systemusers(','body','odata-entityid','substring','lastIndexOf','destcalleridnum','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','enduserId','contactid',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','toUpperCase',']\x20Enduser\x20created!','forEach','string','picklist','nameField','customField','indexOf','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','callDirection','queue','phonecalls','calleridnum','headers','ticketId','format','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','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','POST','username','password','error',']\x20Wrong\x20credentials!','message','GET','Bearer\x20','4.0','then','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','contacts'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xb2b8,0x1d8));var _0x8b2b=function(_0x2582b4,_0xe02d5c){_0x2582b4=_0x2582b4-0x0;var _0x925e7e=_0xb2b8[_0x2582b4];return _0x925e7e;};'use strict';var _=require('lodash');var rp=require(_0x8b2b('0x0'));var util=require(_0x8b2b('0x1'));var intUtil=require(_0x8b2b('0x2'));var md5=require(_0x8b2b('0x3'));var Redis=require(_0x8b2b('0x4'));var logger=require(_0x8b2b('0x5'))(_0x8b2b('0x6'));var config=require(_0x8b2b('0x7'));config[_0x8b2b('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8b2b('0x9'))(new Redis(config['redis']));function getAuthToken(_0x101904,_0x3a1e3b,_0x5da645){if(_0x101904[_0x8b2b('0xa')]){_0x101904[_0x8b2b('0xb')]=_0x101904['CloudProvider'][_0x8b2b('0xc')];_0x101904[_0x8b2b('0xd')]=_0x101904[_0x8b2b('0xe')][_0x8b2b('0xf')];return Promise['resolve'](_0x101904[_0x8b2b('0xe')]['data5']);}var _0x2ca8b0={'method':_0x8b2b('0x10'),'uri':_0x3a1e3b,'form':{'client_id':_0x101904['clientId'],'resource':_0x101904[_0x8b2b('0xb')],'username':_0x101904[_0x8b2b('0x11')],'password':_0x101904['password'],'grant_type':_0x8b2b('0x12'),'client_secret':_0x101904['clientSecret']},'json':!![]};return rp(_0x2ca8b0)['then'](function(_0xcc41b7){return _0xcc41b7['access_token'];})['catch'](function(_0x142072){logger[_0x8b2b('0x13')]('['+[_0x5da645['toUpperCase']()]+_0x8b2b('0x14'));return _0x142072[_0x8b2b('0x15')];});}function getUser(_0x35fed2,_0x15a3e5,_0x17fac0,_0x17b659,_0x4efb91,_0x31a97a){return new Promise(function(_0x5dde13,_0x499f92){return getAuthToken(_0x15a3e5,_0x17b659,_0x31a97a)['then'](function(_0x1c4354){var _0x34ddb7={'method':_0x8b2b('0x16'),'uri':_0x4efb91+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x8b2b('0x17')+_0x1c4354,'OData-Version':_0x8b2b('0x18')},'json':!![]};return rp(_0x34ddb7);})[_0x8b2b('0x19')](function(_0x31cfd0){var _0x1a59a8=_0x31cfd0[_0x8b2b('0x1a')];var _0x3f89ce=![];var _0x1d4ad5=null;if(!_[_0x8b2b('0x1b')](_0x17fac0)){if(intUtil[_0x8b2b('0x1c')](_0x17fac0[_0x8b2b('0x1d')])){_0x35fed2[_0x8b2b('0x1e')]=_0x17fac0[_0x8b2b('0x1d')];for(_0x1d4ad5=0x0;_0x1d4ad5<_0x1a59a8[_0x8b2b('0x1f')];_0x1d4ad5++){if(_0x1a59a8[_0x1d4ad5][_0x8b2b('0x20')]===_0x17fac0[_0x8b2b('0x1d')]&&!_0x1a59a8[_0x1d4ad5][_0x8b2b('0x21')]){_0x3f89ce=!![];logger[_0x8b2b('0x22')]('['+[_0x31a97a['toUpperCase']()]+_0x8b2b('0x23')+_0x1a59a8[_0x1d4ad5][_0x8b2b('0x24')]+'!');_0x35fed2[_0x8b2b('0x25')]=_0x1a59a8[_0x1d4ad5]['systemuserid'];}}}}if(!_0x3f89ce){logger[_0x8b2b('0x22')]('['+[_0x31a97a['toUpperCase']()]+_0x8b2b('0x26'));_0x35fed2[_0x8b2b('0x1e')]=_0x15a3e5[_0x8b2b('0x11')];for(_0x1d4ad5=0x0;_0x1d4ad5<_0x1a59a8[_0x8b2b('0x1f')];_0x1d4ad5++){if(_0x1a59a8[_0x1d4ad5][_0x8b2b('0x20')]===_0x15a3e5['username']){_0x35fed2[_0x8b2b('0x25')]=_0x1a59a8[_0x1d4ad5][_0x8b2b('0x24')];}}}_0x5dde13(_0x35fed2);})[_0x8b2b('0x27')](function(_0x489d19){_0x499f92(_0x489d19['message']);});});}function createEndUser(_0x434f62,_0x47c0c2,_0x1edd9e,_0x872f2b,_0x17df15,_0x66813,_0x76d55a){return new Promise(function(_0x1f3bb2,_0x555f36){return getAuthToken(_0x47c0c2,_0x1edd9e,_0x66813)[_0x8b2b('0x19')](function(_0x1abb21){var _0x3c4bed=_0x66813[_0x8b2b('0x28')]()===_0x8b2b('0x29')?_0x17df15['destcalleridnum']:_0x17df15['calleridnum'];var _0x3b54f4={'method':'POST','uri':_0x872f2b+_0x8b2b('0x2a'),'body':{'fullname':_0x3c4bed,'firstname':_0x3c4bed,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8b2b('0x2b')+_0x434f62[_0x8b2b('0x25')]+')'},'headers':{'Authorization':_0x8b2b('0x17')+_0x1abb21,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x3b54f4[_0x8b2b('0x2c')][_0x76d55a]=_0x3c4bed;return rp(_0x3b54f4);})['then'](function(_0x970a7a){var _0x51d655=_0x970a7a['headers'][_0x8b2b('0x2d')];var _0x2f0876=_0x51d655[_0x8b2b('0x2e')](_0x51d655[_0x8b2b('0x2f')]('(')+0x1,_0x51d655[_0x8b2b('0x2f')](')'));_0x434f62['enduserId']=_0x2f0876;_0x1f3bb2(_0x434f62);})['catch'](function(_0x1b2c0c){_0x555f36(_0x1b2c0c[_0x8b2b('0x15')]);});});}function getEndUser(_0x1bd4ea,_0x505f1e,_0xa369b3,_0x26c5f7,_0x36fea3,_0x568b60,_0x4bc8d6,_0x1f087e){var _0x3621fc=_0x568b60[_0x8b2b('0x28')]()===_0x8b2b('0x29')?_0x36fea3[_0x8b2b('0x30')]:_0x36fea3['calleridnum'];return getAuthToken(_0x505f1e,_0xa369b3,_0x568b60)[_0x8b2b('0x19')](function(_0x392b3b){_0x1f087e=_0x1f087e?_0x1f087e:_0x8b2b('0x31');var _0x44b745={'method':_0x8b2b('0x16'),'uri':_0x26c5f7+_0x8b2b('0x32')+_0x1f087e+'&$filter='+_0x1f087e+_0x8b2b('0x33')+_0x3621fc[_0x8b2b('0x34')]('+',_0x8b2b('0x35'))+'\x27','headers':{'Authorization':_0x8b2b('0x17')+_0x392b3b,'If-None-Match':null,'OData-Version':_0x8b2b('0x18')},'json':!![]};return rp(_0x44b745);})[_0x8b2b('0x19')](function(_0x5b9c8d){var _0x2b1539=![];if(!_0x5b9c8d)return _0x2b1539;var _0x5aa0bf=_0x5b9c8d[_0x8b2b('0x1a')];for(var _0x35756e=0x0;_0x35756e<_0x5aa0bf[_0x8b2b('0x1f')];_0x35756e++){if(_0x5aa0bf[_0x35756e][_0x1f087e]===_0x3621fc){_0x2b1539=!![];_0x1bd4ea[_0x8b2b('0x36')]=_0x5aa0bf[_0x35756e][_0x8b2b('0x37')];}}return _0x2b1539;})['then'](function(_0x58d6f0){if(_0x58d6f0)return _0x1bd4ea;if(_0x4bc8d6==='nothing'){logger[_0x8b2b('0x22')]('['+[_0x568b60['toUpperCase']()]+_0x8b2b('0x38'));return _0x1bd4ea;}return createEndUser(_0x1bd4ea,_0x505f1e,_0xa369b3,_0x26c5f7,_0x36fea3,_0x568b60,_0x1f087e)[_0x8b2b('0x19')](function(_0x5f52e6){logger[_0x8b2b('0x22')]('['+[_0x568b60[_0x8b2b('0x39')]()]+_0x8b2b('0x3a'),_0x5f52e6[_0x8b2b('0x36')]);return _0x5f52e6;});});}function getCustomFields(_0x52f2d4,_0x43e381,_0x26a5c3){var _0x3436c9={};if(_0x52f2d4[_0x8b2b('0x1f')]>0x0){_[_0x8b2b('0x3b')](_0x52f2d4,function(_0x5e9d7a){if(_['includes']([_0x8b2b('0x3c'),_0x8b2b('0x3d')],_0x5e9d7a['type'])&&_0x5e9d7a[_0x8b2b('0x3e')]&&!_0x5e9d7a[_0x8b2b('0x3f')]){var _0x2fd8a1=_0x5e9d7a['idField'][_0x8b2b('0x28')]();var _0x22bce9=_0x2fd8a1[_0x8b2b('0x2e')](0x0,_0x2fd8a1[_0x8b2b('0x40')]('_'));var _0x514046=_0x2fd8a1[_0x8b2b('0x2e')](_0x2fd8a1[_0x8b2b('0x40')]('_')+0x1);if(_0x22bce9===_0x26a5c3){_0x3436c9[_0x514046]=_0x5e9d7a['content'];}}});}return _0x3436c9;}function getTicket(_0x289145,_0x1c8eda,_0x27ecc7,_0x1931a2,_0x2e4c86,_0x681d2e,_0xa1b3f1){return new Promise(function(_0x30a9a9,_0x2df916){var _0x36b04f;return getAuthToken(_0x1c8eda,_0x27ecc7,_0xa1b3f1)['then'](function(_0xc05bfe){if(_0x681d2e['ticketType']===_0x8b2b('0x41')){_0x36b04f={'method':_0x8b2b('0x10'),'uri':_0x1931a2+_0x8b2b('0x42'),'body':Object[_0x8b2b('0x43')]({},{'title':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x45')],_0x2e4c86,'\x20'),'description':intUtil['getString'](_0x681d2e[_0x8b2b('0x46')],_0x2e4c86,'\x0a'),'customerid_contact@odata.bind':_0x289145['enduserId']?_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x289145['userId']+')','caseorigincode':'1'},getCustomFields(_0x681d2e[_0x8b2b('0x48')],_0x2e4c86,_0x681d2e['ticketType'])),'headers':{'Authorization':_0x8b2b('0x17')+_0xc05bfe,'OData-Version':_0x8b2b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x681d2e[_0x8b2b('0x49')]==='phonecall'){var _0x19fe19=_0x289145[_0x8b2b('0x36')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','participationtypemask':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')','participationtypemask':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','participationtypemask':_0x289145['callDirection']===_0x8b2b('0x4b')?0x2:0x1}];_0x36b04f={'method':_0x8b2b('0x10'),'uri':_0x1931a2+_0x8b2b('0x4c'),'body':Object['assign']({},{'subject':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x45')],_0x2e4c86,'\x20'),'phonenumber':String(_0x2e4c86[_0x8b2b('0x4d')]),'description':intUtil[_0x8b2b('0x44')](_0x681d2e[_0x8b2b('0x46')],_0x2e4c86,'\x0a'),'regardingobjectid_contact@odata.bind':_0x289145[_0x8b2b('0x36')]?_0x8b2b('0x47')+_0x289145[_0x8b2b('0x36')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x289145[_0x8b2b('0x25')]+')','directioncode':_0x289145[_0x8b2b('0x4a')]===_0x8b2b('0x4b')?![]:!![],'phonecall_activity_parties':_0x19fe19},getCustomFields(_0x681d2e[_0x8b2b('0x48')],_0x2e4c86,_0x681d2e[_0x8b2b('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0xc05bfe,'OData-Version':_0x8b2b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x36b04f);})[_0x8b2b('0x19')](function(_0xc00153){var _0x575f4f=_0xc00153[_0x8b2b('0x4e')][_0x8b2b('0x2d')];var _0x23252f=_0x575f4f[_0x8b2b('0x2e')](_0x575f4f[_0x8b2b('0x2f')]('(')+0x1,_0x575f4f['lastIndexOf'](')'));_0x289145[_0x8b2b('0x4f')]=_0x23252f;_0x30a9a9(_0x289145);})[_0x8b2b('0x27')](function(_0x5cc780){_0x2df916(_0x5cc780[_0x8b2b('0x15')]);});});}function emit(_0x35e1e4,_0x2c3547,_0x4ab677,_0x7d5f0f){var _0x457753={'uri':util[_0x8b2b('0x50')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x35e1e4,_0x4ab677,_0x7d5f0f)};io['to'](util['format']('user:%s',_0x2c3547))[_0x8b2b('0x51')](_0x8b2b('0x52'),_0x457753);}exports['cs']=function(_0x14138b,_0x45ab6f,_0x43187e,_0x5f2f37,_0x5c0c2a,_0xbb8a67,_0x412ca5,_0xe19a09){var _0x4148e0={};_0xbb8a67[_0x8b2b('0xb')]=_0xbb8a67[_0x8b2b('0xa')]?intUtil[_0x8b2b('0x53')](_0xbb8a67[_0x8b2b('0xe')][_0x8b2b('0xc')]):intUtil['stripTrailingSlash'](_0xbb8a67[_0x8b2b('0xb')]);_0xbb8a67[_0x8b2b('0x54')]=intUtil[_0x8b2b('0x53')](_0xbb8a67[_0x8b2b('0x54')]);_0x4148e0[_0x8b2b('0x4a')]=_0xe19a09===_0x8b2b('0x4b')||_0xe19a09===_0x8b2b('0x55')?_0x8b2b('0x4b'):_0x8b2b('0x29');var _0x27fb34=_0xbb8a67[_0x8b2b('0xa')]?util[_0x8b2b('0x50')]('%s/api/data/v9.0/',_0xbb8a67['CloudProvider'][_0x8b2b('0xc')]):util[_0x8b2b('0x50')](_0x8b2b('0x56'),_0xbb8a67[_0x8b2b('0xb')]);var _0x5f20cd=util['format'](_0x8b2b('0x57'),_0xbb8a67[_0x8b2b('0xd')]);var _0x3336e2=util[_0x8b2b('0x50')](_0x8b2b('0x58'),_0xbb8a67[_0x8b2b('0x54')],_0x45ab6f['uniqueid'],md5(_0x45ab6f['uniqueid']));if(_0x5c0c2a&&_0x5c0c2a[_0x8b2b('0x59')]){logger[_0x8b2b('0x22')](_0x8b2b('0x5a'),_0x8b2b('0x5b'));_0x45ab6f[_0x8b2b('0x5c')]=_0x3336e2;}else if(_0x412ca5&&_0x412ca5['recordingFormat']&&_0x412ca5[_0x8b2b('0x5d')]!==_0x8b2b('0x5e')){logger[_0x8b2b('0x22')]('[OUTBOUND]',_0x8b2b('0x5b'));_0x45ab6f[_0x8b2b('0x5c')]=_0x3336e2;}else{_0x45ab6f[_0x8b2b('0x5c')]='';}return getUser(_0x4148e0,_0xbb8a67,_0x5f2f37,_0x5f20cd,_0x27fb34,_0xe19a09)['then'](function(_0xb607af){logger['info']('['+_0xe19a09['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0xb607af['userId']);logger['info']('['+_0xe19a09[_0x8b2b('0x39')]()+']\x20The\x20User\x20email\x20is:',_0xb607af['userEmail']);return getEndUser(_0xb607af,_0xbb8a67,_0x5f20cd,_0x27fb34,_0x45ab6f,_0xe19a09,_0x43187e['moduleCreate'],_0x43187e[_0x8b2b('0x5f')]);})['then'](function(_0x2a9e23){logger[_0x8b2b('0x22')]('['+_0xe19a09['toUpperCase']()+_0x8b2b('0x60'),_0x2a9e23[_0x8b2b('0x36')]);logger[_0x8b2b('0x22')]('['+_0xe19a09[_0x8b2b('0x39')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x45ab6f[_0x8b2b('0x4d')]);return getTicket(_0x2a9e23,_0xbb8a67,_0x5f20cd,_0x27fb34,_0x45ab6f,_0x43187e,_0xe19a09);})[_0x8b2b('0x19')](function(_0x241739){logger[_0x8b2b('0x22')](util[_0x8b2b('0x50')]('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x61'),_0x43187e['ticketType'],_0x241739['ticketId']));logger[_0x8b2b('0x22')](util[_0x8b2b('0x50')]('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x62'),_0xe19a09));if(_0xe19a09!==_0x8b2b('0x55')&&_0x43187e[_0x8b2b('0x63')]){logger[_0x8b2b('0x22')]('['+_0xe19a09['toUpperCase']()+']',_0x8b2b('0x64'));emit(_0xbb8a67['remoteUri'],_0x5f2f37['name'],_0x43187e[_0x8b2b('0x49')],_0x241739[_0x8b2b('0x4f')]);}})[_0x8b2b('0x27')](function(_0x168502){logger['error']('['+_0xe19a09[_0x8b2b('0x39')]()+_0x8b2b('0x65'),_0x168502['message']);console[_0x8b2b('0x13')](_0x8b2b('0x66'),_0x168502);});}; \ No newline at end of file +var _0x37d6=[']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','./util','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','userId','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','destcalleridnum','calleridnum','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','type','nameField','idField','indexOf','content','incident','incidents','assign','getString','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','outbound','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:'];(function(_0x60fe74,_0x4b1995){var _0x502913=function(_0x19a308){while(--_0x19a308){_0x60fe74['push'](_0x60fe74['shift']());}};_0x502913(++_0x4b1995);}(_0x37d6,0xe3));var _0x637d=function(_0x44b4fa,_0x119420){_0x44b4fa=_0x44b4fa-0x0;var _0x5c6fc2=_0x37d6[_0x44b4fa];return _0x5c6fc2;};'use strict';var _=require(_0x637d('0x0'));var rp=require('request-promise');var util=require(_0x637d('0x1'));var intUtil=require(_0x637d('0x2'));var md5=require('md5');var Redis=require(_0x637d('0x3'));var logger=require('../../../../config/logger')(_0x637d('0x4'));var config=require(_0x637d('0x5'));config[_0x637d('0x6')]=_[_0x637d('0x7')](config['redis'],{'host':_0x637d('0x8'),'port':0x18eb});var io=require(_0x637d('0x9'))(new Redis(config[_0x637d('0x6')]));function getAuthToken(_0x414e73,_0x38fa30,_0x43c9f5){if(_0x414e73[_0x637d('0xa')]){_0x414e73[_0x637d('0xb')]=_0x414e73[_0x637d('0xc')][_0x637d('0xd')];_0x414e73[_0x637d('0xe')]=_0x414e73[_0x637d('0xc')][_0x637d('0xf')];return Promise['resolve'](_0x414e73[_0x637d('0xc')]['data5']);}var _0x40dc82={'method':_0x637d('0x10'),'uri':_0x38fa30,'form':{'client_id':_0x414e73[_0x637d('0x11')],'resource':_0x414e73[_0x637d('0xb')],'username':_0x414e73[_0x637d('0x12')],'password':_0x414e73['password'],'grant_type':_0x637d('0x13'),'client_secret':_0x414e73[_0x637d('0x14')]},'json':!![]};return rp(_0x40dc82)[_0x637d('0x15')](function(_0x288f84){return _0x288f84[_0x637d('0x16')];})[_0x637d('0x17')](function(_0x4212f3){logger['error']('['+[_0x43c9f5[_0x637d('0x18')]()]+_0x637d('0x19'));return _0x4212f3[_0x637d('0x1a')];});}function getUser(_0x6753b9,_0x5b4ff0,_0x43d7e7,_0x3f54d6,_0xb723c0,_0xad48a8){return new Promise(function(_0x5ad885,_0x4107d8){return getAuthToken(_0x5b4ff0,_0x3f54d6,_0xad48a8)['then'](function(_0x18c668){var _0x4171d4={'method':'GET','uri':_0xb723c0+_0x637d('0x1b'),'headers':{'Authorization':_0x637d('0x1c')+_0x18c668,'OData-Version':_0x637d('0x1d')},'json':!![]};return rp(_0x4171d4);})[_0x637d('0x15')](function(_0x398e25){var _0x4b782f=_0x398e25[_0x637d('0x1e')];var _0x3bca6b=![];var _0xcab905=null;if(!_[_0x637d('0x1f')](_0x43d7e7)){if(intUtil[_0x637d('0x20')](_0x43d7e7[_0x637d('0x21')])){_0x6753b9['userEmail']=_0x43d7e7[_0x637d('0x21')];for(_0xcab905=0x0;_0xcab905<_0x4b782f[_0x637d('0x22')];_0xcab905++){if(_0x4b782f[_0xcab905]['internalemailaddress']===_0x43d7e7[_0x637d('0x21')]&&!_0x4b782f[_0xcab905][_0x637d('0x23')]){_0x3bca6b=!![];logger[_0x637d('0x24')]('['+[_0xad48a8[_0x637d('0x18')]()]+_0x637d('0x25')+_0x4b782f[_0xcab905]['systemuserid']+'!');_0x6753b9[_0x637d('0x26')]=_0x4b782f[_0xcab905][_0x637d('0x27')];}}}}if(!_0x3bca6b){logger[_0x637d('0x24')]('['+[_0xad48a8[_0x637d('0x18')]()]+_0x637d('0x28'));_0x6753b9[_0x637d('0x29')]=_0x5b4ff0[_0x637d('0x12')];for(_0xcab905=0x0;_0xcab905<_0x4b782f[_0x637d('0x22')];_0xcab905++){if(_0x4b782f[_0xcab905]['internalemailaddress']===_0x5b4ff0[_0x637d('0x12')]){_0x6753b9[_0x637d('0x26')]=_0x4b782f[_0xcab905][_0x637d('0x27')];}}}_0x5ad885(_0x6753b9);})[_0x637d('0x17')](function(_0xc11892){_0x4107d8(_0xc11892['message']);});});}function createEndUser(_0x14d903,_0x5322f7,_0x4260bd,_0x290de9,_0x40ac3f,_0x423322,_0x24dbca){return new Promise(function(_0x5ddf99,_0x39c935){return getAuthToken(_0x5322f7,_0x4260bd,_0x423322)[_0x637d('0x15')](function(_0x54e931){var _0x24c103=_0x423322[_0x637d('0x2a')]()==='outbound'?_0x40ac3f['destcalleridnum']:_0x40ac3f['calleridnum'];var _0x205f9a={'method':_0x637d('0x10'),'uri':_0x290de9+_0x637d('0x2b'),'body':{'fullname':_0x24c103,'firstname':_0x24c103,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x637d('0x2c')+_0x14d903[_0x637d('0x26')]+')'},'headers':{'Authorization':_0x637d('0x1c')+_0x54e931,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x205f9a[_0x637d('0x2d')][_0x24dbca]=_0x24c103;return rp(_0x205f9a);})[_0x637d('0x15')](function(_0x1a2298){var _0x57c490=_0x1a2298[_0x637d('0x2e')][_0x637d('0x2f')];var _0x109fe5=_0x57c490[_0x637d('0x30')](_0x57c490['lastIndexOf']('(')+0x1,_0x57c490[_0x637d('0x31')](')'));_0x14d903['enduserId']=_0x109fe5;_0x5ddf99(_0x14d903);})[_0x637d('0x17')](function(_0x2ed2d7){_0x39c935(_0x2ed2d7['message']);});});}function getEndUser(_0x258c97,_0x49d1b4,_0x3be39b,_0x1b04d2,_0x1bfdea,_0x58005f,_0x385424,_0x5abdc3){var _0x12088d=_0x58005f['toLowerCase']()==='outbound'?_0x1bfdea[_0x637d('0x32')]:_0x1bfdea[_0x637d('0x33')];return getAuthToken(_0x49d1b4,_0x3be39b,_0x58005f)[_0x637d('0x15')](function(_0x541fc3){_0x5abdc3=_0x5abdc3?_0x5abdc3:_0x637d('0x34');var _0x50bf28={'method':_0x637d('0x35'),'uri':_0x1b04d2+_0x637d('0x36')+_0x5abdc3+_0x637d('0x37')+_0x5abdc3+_0x637d('0x38')+_0x12088d[_0x637d('0x39')]('+',_0x637d('0x3a'))+'\x27','headers':{'Authorization':_0x637d('0x1c')+_0x541fc3,'If-None-Match':null,'OData-Version':_0x637d('0x1d')},'json':!![]};return rp(_0x50bf28);})[_0x637d('0x15')](function(_0x4960f1){var _0x45df79=![];if(!_0x4960f1)return _0x45df79;var _0x2fe9f6=_0x4960f1['value'];for(var _0xc4f898=0x0;_0xc4f898<_0x2fe9f6[_0x637d('0x22')];_0xc4f898++){if(_0x2fe9f6[_0xc4f898][_0x5abdc3]===_0x12088d){_0x45df79=!![];_0x258c97[_0x637d('0x3b')]=_0x2fe9f6[_0xc4f898][_0x637d('0x3c')];}}return _0x45df79;})[_0x637d('0x15')](function(_0xbc0e04){if(_0xbc0e04)return _0x258c97;if(_0x385424===_0x637d('0x3d')){logger[_0x637d('0x24')]('['+[_0x58005f['toUpperCase']()]+_0x637d('0x3e'));return _0x258c97;}return createEndUser(_0x258c97,_0x49d1b4,_0x3be39b,_0x1b04d2,_0x1bfdea,_0x58005f,_0x5abdc3)[_0x637d('0x15')](function(_0x151824){logger[_0x637d('0x24')]('['+[_0x58005f['toUpperCase']()]+']\x20Enduser\x20created!',_0x151824['enduserId']);return _0x151824;});});}function getCustomFields(_0x1f21e0,_0xf11d2f,_0x30b009){var _0x2035df={};if(_0x1f21e0[_0x637d('0x22')]>0x0){_['forEach'](_0x1f21e0,function(_0x34c3b1){if(_[_0x637d('0x3f')](['string','picklist'],_0x34c3b1[_0x637d('0x40')])&&_0x34c3b1[_0x637d('0x41')]&&!_0x34c3b1['customField']){var _0x54bd31=_0x34c3b1[_0x637d('0x42')][_0x637d('0x2a')]();var _0x13ede1=_0x54bd31[_0x637d('0x30')](0x0,_0x54bd31['indexOf']('_'));var _0x2a9f62=_0x54bd31[_0x637d('0x30')](_0x54bd31[_0x637d('0x43')]('_')+0x1);if(_0x13ede1===_0x30b009){_0x2035df[_0x2a9f62]=_0x34c3b1[_0x637d('0x44')];}}});}return _0x2035df;}function getTicket(_0x533ea6,_0x28a5fa,_0x57edc3,_0x2a7e7b,_0x47343e,_0x496a6a,_0x25d565){return new Promise(function(_0x561591,_0xe8b57b){var _0x119b2e;return getAuthToken(_0x28a5fa,_0x57edc3,_0x25d565)[_0x637d('0x15')](function(_0x1829a5){if(_0x496a6a['ticketType']===_0x637d('0x45')){_0x119b2e={'method':'POST','uri':_0x2a7e7b+_0x637d('0x46'),'body':Object[_0x637d('0x47')]({},{'title':intUtil['getString'](_0x496a6a['Subjects'],_0x47343e,'\x20'),'description':intUtil[_0x637d('0x48')](_0x496a6a[_0x637d('0x49')],_0x47343e,'\x0a'),'customerid_contact@odata.bind':_0x533ea6[_0x637d('0x3b')]?_0x637d('0x4a')+_0x533ea6['enduserId']+')':undefined,'ownerid@odata.bind':_0x637d('0x2c')+_0x533ea6['userId']+')','caseorigincode':'1'},getCustomFields(_0x496a6a[_0x637d('0x4b')],_0x47343e,_0x496a6a[_0x637d('0x4c')])),'headers':{'Authorization':_0x637d('0x1c')+_0x1829a5,'OData-Version':_0x637d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x496a6a[_0x637d('0x4c')]===_0x637d('0x4d')){var _0x2fa5e6=_0x533ea6[_0x637d('0x3b')]?[{'partyid_systemuser@odata.bind':_0x637d('0x2c')+_0x533ea6[_0x637d('0x26')]+')','participationtypemask':_0x533ea6[_0x637d('0x4e')]===_0x637d('0x4f')?0x2:0x1},{'partyid_contact@odata.bind':_0x637d('0x4a')+_0x533ea6[_0x637d('0x3b')]+')','participationtypemask':_0x533ea6['callDirection']===_0x637d('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x637d('0x2c')+_0x533ea6['userId']+')','participationtypemask':_0x533ea6['callDirection']===_0x637d('0x4f')?0x2:0x1}];_0x119b2e={'method':'POST','uri':_0x2a7e7b+'phonecalls','body':Object[_0x637d('0x47')]({},{'subject':intUtil[_0x637d('0x48')](_0x496a6a[_0x637d('0x50')],_0x47343e,'\x20'),'phonenumber':String(_0x47343e[_0x637d('0x33')]),'description':intUtil[_0x637d('0x48')](_0x496a6a[_0x637d('0x49')],_0x47343e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x533ea6[_0x637d('0x3b')]?_0x637d('0x4a')+_0x533ea6[_0x637d('0x3b')]+')':undefined,'ownerid@odata.bind':_0x637d('0x2c')+_0x533ea6[_0x637d('0x26')]+')','directioncode':_0x533ea6[_0x637d('0x4e')]===_0x637d('0x4f')?![]:!![],'phonecall_activity_parties':_0x2fa5e6},getCustomFields(_0x496a6a[_0x637d('0x4b')],_0x47343e,_0x496a6a[_0x637d('0x4c')])),'headers':{'Authorization':_0x637d('0x1c')+_0x1829a5,'OData-Version':_0x637d('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x119b2e);})[_0x637d('0x15')](function(_0x31a940){var _0x52cb75=_0x31a940[_0x637d('0x2e')]['odata-entityid'];var _0x42bbbc=_0x52cb75[_0x637d('0x30')](_0x52cb75[_0x637d('0x31')]('(')+0x1,_0x52cb75[_0x637d('0x31')](')'));_0x533ea6[_0x637d('0x51')]=_0x42bbbc;_0x561591(_0x533ea6);})[_0x637d('0x17')](function(_0xaaa201){_0xe8b57b(_0xaaa201[_0x637d('0x1a')]);});});}function emit(_0x379d72,_0x35f695,_0x30e3b7,_0x3c987b){var _0x1d810d={'uri':util[_0x637d('0x52')](_0x637d('0x53'),_0x379d72,_0x30e3b7,_0x3c987b)};io['to'](util[_0x637d('0x52')]('user:%s',_0x35f695))['emit'](_0x637d('0x54'),_0x1d810d);}exports['cs']=function(_0x10808c,_0x502aeb,_0x5a28db,_0x501d38,_0x32769c,_0x219517,_0xf02f11,_0x17a2a8){var _0x1bca2c={};_0x219517[_0x637d('0xb')]=_0x219517[_0x637d('0xa')]?intUtil[_0x637d('0x55')](_0x219517[_0x637d('0xc')][_0x637d('0xd')]):intUtil['stripTrailingSlash'](_0x219517[_0x637d('0xb')]);_0x219517[_0x637d('0x56')]=intUtil[_0x637d('0x55')](_0x219517[_0x637d('0x56')]);_0x1bca2c[_0x637d('0x4e')]=_0x17a2a8===_0x637d('0x4f')||_0x17a2a8===_0x637d('0x57')?_0x637d('0x4f'):_0x637d('0x58');var _0x2e1eb8=_0x219517[_0x637d('0xa')]?util[_0x637d('0x52')](_0x637d('0x59'),_0x219517['CloudProvider'][_0x637d('0xd')]):util[_0x637d('0x52')](_0x637d('0x59'),_0x219517[_0x637d('0xb')]);var _0x196cd2=util[_0x637d('0x52')](_0x637d('0x5a'),_0x219517[_0x637d('0xe')]);var _0x1af28f=util[_0x637d('0x52')](_0x637d('0x5b'),_0x219517[_0x637d('0x56')],_0x502aeb[_0x637d('0x5c')],md5(_0x502aeb['uniqueid']));if(_0x32769c&&_0x32769c['monitor_format']){logger[_0x637d('0x24')](_0x637d('0x5d'),'Recording\x20is\x20enabled!');_0x502aeb['recordingURL']=_0x1af28f;}else if(_0xf02f11&&_0xf02f11[_0x637d('0x5e')]&&_0xf02f11[_0x637d('0x5e')]!==_0x637d('0x5f')){logger[_0x637d('0x24')](_0x637d('0x60'),_0x637d('0x61'));_0x502aeb[_0x637d('0x62')]=_0x1af28f;}else{_0x502aeb[_0x637d('0x62')]='';}return getUser(_0x1bca2c,_0x219517,_0x501d38,_0x196cd2,_0x2e1eb8,_0x17a2a8)[_0x637d('0x15')](function(_0x4a77e4){logger['info']('['+_0x17a2a8[_0x637d('0x18')]()+_0x637d('0x63'),_0x4a77e4[_0x637d('0x26')]);logger[_0x637d('0x24')]('['+_0x17a2a8['toUpperCase']()+_0x637d('0x64'),_0x4a77e4[_0x637d('0x29')]);return getEndUser(_0x4a77e4,_0x219517,_0x196cd2,_0x2e1eb8,_0x502aeb,_0x17a2a8,_0x5a28db['moduleCreate'],_0x5a28db['additionalSearchContact']);})[_0x637d('0x15')](function(_0x7a0064){logger['info']('['+_0x17a2a8[_0x637d('0x18')]()+_0x637d('0x65'),_0x7a0064['enduserId']);logger['info']('['+_0x17a2a8['toUpperCase']()+_0x637d('0x66'),_0x502aeb[_0x637d('0x33')]);return getTicket(_0x7a0064,_0x219517,_0x196cd2,_0x2e1eb8,_0x502aeb,_0x5a28db,_0x17a2a8);})[_0x637d('0x15')](function(_0x2d5423){logger[_0x637d('0x24')](util[_0x637d('0x52')]('['+_0x17a2a8['toUpperCase']()+_0x637d('0x67'),_0x5a28db[_0x637d('0x4c')],_0x2d5423[_0x637d('0x51')]));logger[_0x637d('0x24')](util[_0x637d('0x52')]('['+_0x17a2a8[_0x637d('0x18')]()+_0x637d('0x68'),_0x17a2a8));if(_0x17a2a8!==_0x637d('0x57')&&_0x5a28db[_0x637d('0x69')]){logger[_0x637d('0x24')]('['+_0x17a2a8[_0x637d('0x18')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x219517[_0x637d('0xb')],_0x501d38[_0x637d('0x6a')],_0x5a28db[_0x637d('0x4c')],_0x2d5423[_0x637d('0x51')]);}})['catch'](function(_0x2f7188){logger[_0x637d('0x6b')]('['+_0x17a2a8[_0x637d('0x18')]()+_0x637d('0x6c'),_0x2f7188[_0x637d('0x1a')]);console[_0x637d('0x6b')](_0x637d('0x6d'),_0x2f7188);});}; \ 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 9c6bbc1..aabf597 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 _0x5a4e=['localhost','socket.io-emitter','application/json','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','name','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','recordingURL','catch','toUpperCase','request-promise','md5','ioredis','./util','../../../../config/environment','redis'];(function(_0x4fa2a3,_0x374c9b){var _0xba50a=function(_0x25ac2d){while(--_0x25ac2d){_0x4fa2a3['push'](_0x4fa2a3['shift']());}};_0xba50a(++_0x374c9b);}(_0x5a4e,0x172));var _0xe5a4=function(_0x52598d,_0x10fb73){_0x52598d=_0x52598d-0x0;var _0x170309=_0x5a4e[_0x52598d];return _0x170309;};'use strict';var _=require('lodash');var rp=require(_0xe5a4('0x0'));var md5=require(_0xe5a4('0x1'));var util=require('util');var Redis=require(_0xe5a4('0x2'));var intUtil=require(_0xe5a4('0x3'));var config=require(_0xe5a4('0x4'));var logger=require('../../../../config/logger')('freshdesk');config[_0xe5a4('0x5')]=_['defaults'](config[_0xe5a4('0x5')],{'host':_0xe5a4('0x6'),'port':0x18eb});var io=require(_0xe5a4('0x7'))(new Redis(config[_0xe5a4('0x5')]));var headers={'Content-Type':'application/json','Accept':_0xe5a4('0x8')};function emit(_0x2a51ba,_0x2f3656,_0x1b54ef){io['to'](_0x2a51ba)['emit'](_0x2f3656,_0x1b54ef);}function getTicket(_0x292142,_0x27ec04,_0x2a31e7,_0x4496fb,_0x251643){logger['info'](_0xe5a4('0x9'));var _0x81d96=_[_0xe5a4('0xa')]({'responder_id':_0x27ec04['id'],'requester_id':_0x2a31e7['id'],'name':util[_0xe5a4('0xb')](_0xe5a4('0xc'),_0x251643['calleridname']),'phone':_0x251643[_0xe5a4('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xe5a4('0xe')](_0x4496fb[_0xe5a4('0xf')],_0x251643,'\x20'),'description':intUtil[_0xe5a4('0xe')](_0x4496fb[_0xe5a4('0x10')],_0x251643,'
'),'tags':getTags(_0x4496fb['Tags'],_0xe5a4('0x11'))},getCustomFields(_0x4496fb['Fields'],_0x251643));_0x81d96[_0xe5a4('0x12')]=_[_0xe5a4('0x13')](_['keyBy'](_0x81d96[_0xe5a4('0x12')],'id'),_0xe5a4('0x14'));return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x15'),_0x292142[_0xe5a4('0x16')]),'method':_0xe5a4('0x17'),'body':_0x81d96})[_0xe5a4('0x18')](function(_0x564c58){logger[_0xe5a4('0x19')](_0xe5a4('0x1a'));return _0x564c58;});}function getUser(_0x31dd19,_0x7a1675){if(intUtil['validateEmail'](_0x7a1675)){return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x1b'),_0x31dd19[_0xe5a4('0x16')]),'qs':{'email':_0x7a1675}})[_0xe5a4('0x18')](function(_0x47c464){if(_0x47c464['length']){logger[_0xe5a4('0x19')](_0xe5a4('0x1c'));return _[_0xe5a4('0x1d')](_0x47c464,function(_0x3800f6){return _0x3800f6[_0xe5a4('0x1e')][_0xe5a4('0x1f')]===_0x7a1675;});}else{logger['info'](_0xe5a4('0x20'));return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x21'),_0x31dd19[_0xe5a4('0x16')])})[_0xe5a4('0x18')](function(_0x6bb78e){logger[_0xe5a4('0x19')](_0xe5a4('0x22'));return _0x6bb78e;});}});}else{logger['info'](_0xe5a4('0x23'));return request({'uri':util['format'](_0xe5a4('0x21'),_0x31dd19[_0xe5a4('0x16')])})[_0xe5a4('0x18')](function(_0x2b6fbe){logger['info'](_0xe5a4('0x22'));return _0x2b6fbe;});}}function getEndUser(_0x3248e1,_0x4a4f99,_0x5c4e70){logger['info'](_0xe5a4('0x24'),_0x5c4e70);return request({'uri':util[_0xe5a4('0xb')](_0xe5a4('0x25'),_0x3248e1[_0xe5a4('0x16')]),'qs':{'phone':_0x5c4e70}})[_0xe5a4('0x18')](function(_0x18c154){if(_0x18c154[_0xe5a4('0x26')]){logger[_0xe5a4('0x19')](_0xe5a4('0x27'));return _['find'](_0x18c154,{'phone':_0x5c4e70});}else{logger[_0xe5a4('0x19')](_0xe5a4('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x3248e1[_0xe5a4('0x16')]),'method':_0xe5a4('0x17'),'body':{'name':_0x4a4f99,'phone':_0x5c4e70}})[_0xe5a4('0x18')](function(_0x2d0d12){logger[_0xe5a4('0x19')](_0xe5a4('0x29'));return _0x2d0d12;});}});}function getAuth(_0x49f677){return util[_0xe5a4('0xb')](_0xe5a4('0x2a'),new Buffer(_0x49f677[_0xe5a4('0x2b')]+':X')[_0xe5a4('0x2c')](_0xe5a4('0x2d')));}function request(_0x1c4fc6){logger[_0xe5a4('0x2e')](_0xe5a4('0x2f'),JSON[_0xe5a4('0x30')](_0x1c4fc6));return rp(_[_0xe5a4('0x31')](_0x1c4fc6,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e0f3c,_0x3f8321){var _0x5eef20=[];if(_0x4e0f3c&&_0x4e0f3c[_0xe5a4('0x26')]>0x0){_0x5eef20=_[_0xe5a4('0x32')](_0x4e0f3c,_0x3f8321);}return _0x5eef20;}function getCustomFields(_0x375b4c,_0x56d482){var _0x5019ba=[];var _0x1b6165={'custom_fields':[]};if(_0x375b4c[_0xe5a4('0x26')]>0x0){_[_0xe5a4('0x33')](_0x375b4c,function(_0x18453e){if(_[_0xe5a4('0x34')]([_0xe5a4('0x35'),_0xe5a4('0x36')],_0x18453e[_0xe5a4('0x37')])&&_0x18453e[_0xe5a4('0x38')]&&!_0x18453e['customField']){_0x1b6165[_0x18453e[_0xe5a4('0x38')][_0xe5a4('0x39')]()]=_0x18453e[_0xe5a4('0x3a')][_0xe5a4('0x2c')]();}else if(_[_0xe5a4('0x34')]([_0xe5a4('0x35'),_0xe5a4('0x36')],_0x18453e[_0xe5a4('0x37')])&&_0x18453e['idField']&&_0x18453e[_0xe5a4('0x3b')]){_0x1b6165[_0xe5a4('0x12')]['push']({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x18453e[_0xe5a4('0x3a')][_0xe5a4('0x2c')]()});}else if(_0x18453e[_0xe5a4('0x37')]===_0xe5a4('0x3d')&&_0x18453e[_0xe5a4('0x3e')]&&_0x18453e[_0xe5a4('0x3c')]&&_0x18453e[_0xe5a4('0x3b')]){_0x56d482[_0x18453e['variableName']]&&_0x1b6165['custom_fields'][_0xe5a4('0x3f')]({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x56d482[_0x18453e[_0xe5a4('0x3e')]][_0xe5a4('0x2c')]()});}else if(_0x18453e[_0xe5a4('0x37')]===_0xe5a4('0x40')&&_0x18453e['Variable']&&_0x18453e['Variable'][_0xe5a4('0x11')]&&_0x18453e[_0xe5a4('0x3c')]&&_0x18453e[_0xe5a4('0x3b')]){_0x56d482[_0x18453e[_0xe5a4('0x41')][_0xe5a4('0x11')][_0xe5a4('0x39')]()]&&_0x1b6165['custom_fields'][_0xe5a4('0x3f')]({'id':_0x18453e[_0xe5a4('0x3c')],'value':_0x56d482[_0x18453e[_0xe5a4('0x41')]['name'][_0xe5a4('0x39')]()]['toString']()});}});}return _0x1b6165;}exports[_0xe5a4('0x42')]=function(_0x21af4b,_0x52a335,_0x2642bb,_0x28c905,_0x50c72e,_0x4272bc){var _0x11fe23,_0x479fbd;_0x4272bc['remoteUri']=intUtil[_0xe5a4('0x43')](_0x4272bc['remoteUri']);_0x4272bc[_0xe5a4('0x44')]=intUtil[_0xe5a4('0x43')](_0x4272bc['serverUrl']);if(_0x50c72e&&_0x50c72e[_0xe5a4('0x45')]){logger[_0xe5a4('0x19')](_0xe5a4('0x46'),_0xe5a4('0x47'));_0x52a335['recordingURL']=util[_0xe5a4('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4272bc[_0xe5a4('0x44')],_0x52a335['uniqueid'],md5(_0x52a335[_0xe5a4('0x48')]));}else{_0x52a335['recordingURL']='';}headers[_0xe5a4('0x49')]=getAuth(_0x4272bc);return getUser(_0x4272bc,_0x28c905[_0xe5a4('0x1f')])[_0xe5a4('0x18')](function(_0x34d7d7){_0x11fe23=_0x34d7d7;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0x11fe23['id']);return getEndUser(_0x4272bc,_0x52a335[_0xe5a4('0x4b')],_0x52a335['calleridnum']);})[_0xe5a4('0x18')](function(_0x58860f){_0x479fbd=_0x58860f;logger[_0xe5a4('0x19')](_0xe5a4('0x4c'),_0x479fbd['id']);return getTicket(_0x4272bc,_0x11fe23,_0x479fbd,_0x2642bb,_0x52a335);})[_0xe5a4('0x18')](function(_0x2fd406){if(_0x2fd406&&_0x2fd406['id']){logger[_0xe5a4('0x19')](_0xe5a4('0x1a'));logger[_0xe5a4('0x19')]('The\x20Ticket\x20ID\x20is:',_0x2fd406['id']);logger[_0xe5a4('0x19')](_0xe5a4('0x46'),_0xe5a4('0x4d'));emit(util['format'](_0xe5a4('0x4e'),_0x28c905[_0xe5a4('0x11')]),_0xe5a4('0x4f'),{'uri':util[_0xe5a4('0xb')](_0xe5a4('0x50'),_0x4272bc[_0xe5a4('0x16')],_0x2fd406['id'])});}})['catch'](function(_0x20717f){logger[_0xe5a4('0x51')](_0xe5a4('0x46'),JSON['stringify'](_0x20717f));});};exports[_0xe5a4('0x52')]=function(_0x5c8bd1,_0x3baf7a,_0x353832,_0x4da66a,_0x3c7ebf,_0x4baaa5,_0x2364f2){var _0xdbf66d,_0x8017ec;_0x4baaa5[_0xe5a4('0x16')]=intUtil[_0xe5a4('0x43')](_0x4baaa5[_0xe5a4('0x16')]);_0x4baaa5[_0xe5a4('0x44')]=intUtil['stripTrailingSlash'](_0x4baaa5[_0xe5a4('0x44')]);if(_0x2364f2&&_0x2364f2[_0xe5a4('0x53')]&&_0x2364f2[_0xe5a4('0x53')]!=='none'){logger['info'](_0xe5a4('0x54'),'Recording\x20is\x20enabled!');_0x3baf7a['recordingURL']=util[_0xe5a4('0xb')](_0xe5a4('0x55'),_0x4baaa5[_0xe5a4('0x44')],_0x3baf7a[_0xe5a4('0x48')],md5(_0x3baf7a[_0xe5a4('0x48')]));}headers[_0xe5a4('0x49')]=getAuth(_0x4baaa5);return getUser(_0x4baaa5,_0x4da66a['email'])[_0xe5a4('0x18')](function(_0x5e3ef4){_0xdbf66d=_0x5e3ef4;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0xdbf66d['id']);return getEndUser(_0x4baaa5,_0x3baf7a[_0xe5a4('0x56')],_0x3baf7a[_0xe5a4('0x57')]);})[_0xe5a4('0x18')](function(_0xf22c45){_0x8017ec=_0xf22c45;logger[_0xe5a4('0x19')]('The\x20Enduser\x20ID\x20is:',_0x8017ec['id']);return getTicket(_0x4baaa5,_0xdbf66d,_0x8017ec,_0x353832,_0x3baf7a);})[_0xe5a4('0x18')](function(_0x3ebae6){if(_0x3ebae6&&_0x3ebae6['id']){logger['info']('Ticket\x20created!');logger[_0xe5a4('0x19')](_0xe5a4('0x58'),_0x3ebae6['id']);logger[_0xe5a4('0x19')](_0xe5a4('0x54'),_0xe5a4('0x4d'));emit(util[_0xe5a4('0xb')](_0xe5a4('0x4e'),_0x4da66a[_0xe5a4('0x11')]),'trigger:browser:url',{'uri':util[_0xe5a4('0xb')]('%s/helpdesk/tickets/%d',_0x4baaa5[_0xe5a4('0x16')],_0x3ebae6['id'])});}})['catch'](function(_0x5ded32){logger['error'](_0xe5a4('0x54'),JSON['stringify'](_0x5ded32));});};exports[_0xe5a4('0x59')]=function(_0x3ce511,_0x200ccd,_0x2d6df6,_0x37dc6e,_0x59e905,_0x2106f3){var _0x17b007,_0x1b4616;_0x2106f3['remoteUri']=intUtil[_0xe5a4('0x43')](_0x2106f3[_0xe5a4('0x16')]);_0x2106f3[_0xe5a4('0x44')]=intUtil[_0xe5a4('0x43')](_0x2106f3['serverUrl']);if(_0x59e905&&_0x59e905['monitor_format']){logger[_0xe5a4('0x19')]('['+_0x200ccd[_0xe5a4('0x5a')]['toUpperCase']()+']',_0xe5a4('0x47'));_0x200ccd['recordingURL']=util[_0xe5a4('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2106f3[_0xe5a4('0x44')],_0x200ccd[_0xe5a4('0x48')],md5(_0x200ccd[_0xe5a4('0x48')]));}else{_0x200ccd[_0xe5a4('0x5b')]='';}headers[_0xe5a4('0x49')]=getAuth(_0x2106f3);return getUser(_0x2106f3,'')[_0xe5a4('0x18')](function(_0x26503f){_0x17b007=_0x26503f;logger[_0xe5a4('0x19')](_0xe5a4('0x4a'),_0x17b007['id']);return getEndUser(_0x2106f3,_0x200ccd[_0xe5a4('0x4b')],_0x200ccd[_0xe5a4('0xd')]);})[_0xe5a4('0x18')](function(_0x1683ce){_0x1b4616=_0x1683ce;logger[_0xe5a4('0x19')](_0xe5a4('0x4c'),_0x1b4616['id']);return getTicket(_0x2106f3,_0x17b007,_0x1b4616,_0x2d6df6,_0x200ccd);})[_0xe5a4('0x18')](function(_0x5d19c9){if(_0x5d19c9){logger['info'](_0xe5a4('0x1a'));logger[_0xe5a4('0x19')](_0xe5a4('0x58'),_0x5d19c9['id']);}})[_0xe5a4('0x5c')](function(_0x12549a){logger['error']('['+_0x200ccd[_0xe5a4('0x5a')][_0xe5a4('0x5d')]()+']',JSON['stringify'](_0x12549a));});}; \ No newline at end of file +var _0x1778=['%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','length','includes','string','type','nameField','toLowerCase','content','picklist','idField','customField','push','variable','variableName','customVariable','Variable','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','freshdesk','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','value','remoteUri','POST','then','validateEmail'];(function(_0x151051,_0x821ab8){var _0x1a55dc=function(_0x198b52){while(--_0x198b52){_0x151051['push'](_0x151051['shift']());}};_0x1a55dc(++_0x821ab8);}(_0x1778,0x1b1));var _0x8177=function(_0x1b002d,_0x1d458b){_0x1b002d=_0x1b002d-0x0;var _0x657393=_0x1778[_0x1b002d];return _0x657393;};'use strict';var _=require(_0x8177('0x0'));var rp=require('request-promise');var md5=require(_0x8177('0x1'));var util=require(_0x8177('0x2'));var Redis=require(_0x8177('0x3'));var intUtil=require('./util');var config=require(_0x8177('0x4'));var logger=require(_0x8177('0x5'))(_0x8177('0x6'));config['redis']=_[_0x8177('0x7')](config[_0x8177('0x8')],{'host':_0x8177('0x9'),'port':0x18eb});var io=require(_0x8177('0xa'))(new Redis(config[_0x8177('0x8')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x28f928,_0x1bebf2,_0x492233){io['to'](_0x28f928)[_0x8177('0xb')](_0x1bebf2,_0x492233);}function getTicket(_0x34b064,_0x57a533,_0x324441,_0xc796f6,_0xa72a25){logger[_0x8177('0xc')](_0x8177('0xd'));var _0x1f1187=_[_0x8177('0xe')]({'responder_id':_0x57a533['id'],'requester_id':_0x324441['id'],'name':util[_0x8177('0xf')](_0x8177('0x10'),_0xa72a25[_0x8177('0x11')]),'phone':_0xa72a25[_0x8177('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0xc796f6['Subjects'],_0xa72a25,'\x20'),'description':intUtil[_0x8177('0x13')](_0xc796f6[_0x8177('0x14')],_0xa72a25,_0x8177('0x15')),'tags':getTags(_0xc796f6['Tags'],_0x8177('0x16'))},getCustomFields(_0xc796f6[_0x8177('0x17')],_0xa72a25));_0x1f1187[_0x8177('0x18')]=_[_0x8177('0x19')](_[_0x8177('0x1a')](_0x1f1187['custom_fields'],'id'),_0x8177('0x1b'));return request({'uri':util[_0x8177('0xf')]('%s/api/v2/tickets',_0x34b064[_0x8177('0x1c')]),'method':_0x8177('0x1d'),'body':_0x1f1187})[_0x8177('0x1e')](function(_0xebcc70){logger[_0x8177('0xc')]('Ticket\x20created!');return _0xebcc70;});}function getUser(_0x234749,_0x55f9d0){if(intUtil[_0x8177('0x1f')](_0x55f9d0)){return request({'uri':util['format'](_0x8177('0x20'),_0x234749[_0x8177('0x1c')]),'qs':{'email':_0x55f9d0}})[_0x8177('0x1e')](function(_0xe6f2d1){if(_0xe6f2d1['length']){logger[_0x8177('0xc')](_0x8177('0x21'));return _[_0x8177('0x22')](_0xe6f2d1,function(_0x5d7cff){return _0x5d7cff[_0x8177('0x23')][_0x8177('0x24')]===_0x55f9d0;});}else{logger[_0x8177('0xc')](_0x8177('0x25'));return request({'uri':util[_0x8177('0xf')](_0x8177('0x26'),_0x234749['remoteUri'])})[_0x8177('0x1e')](function(_0x29f60c){logger[_0x8177('0xc')](_0x8177('0x27'));return _0x29f60c;});}});}else{logger[_0x8177('0xc')](_0x8177('0x28'));return request({'uri':util[_0x8177('0xf')]('%s/api/v2/agents/me',_0x234749[_0x8177('0x1c')])})['then'](function(_0x23ee5a){logger['info'](_0x8177('0x27'));return _0x23ee5a;});}}function getEndUser(_0x2d55e4,_0x21d9f2,_0x4d322d){logger[_0x8177('0xc')](_0x8177('0x29'),_0x4d322d);return request({'uri':util[_0x8177('0xf')](_0x8177('0x2a'),_0x2d55e4[_0x8177('0x1c')]),'qs':{'phone':_0x4d322d}})['then'](function(_0x457483){if(_0x457483['length']){logger[_0x8177('0xc')](_0x8177('0x2b'));return _['find'](_0x457483,{'phone':_0x4d322d});}else{logger[_0x8177('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8177('0xf')]('%s/api/v2/contacts',_0x2d55e4[_0x8177('0x1c')]),'method':'POST','body':{'name':_0x21d9f2,'phone':_0x4d322d}})[_0x8177('0x1e')](function(_0x444e0f){logger[_0x8177('0xc')](_0x8177('0x2c'));return _0x444e0f;});}});}function getAuth(_0xce61a0){return util[_0x8177('0xf')](_0x8177('0x2d'),new Buffer(_0xce61a0[_0x8177('0x2e')]+':X')[_0x8177('0x2f')](_0x8177('0x30')));}function request(_0x4d3877){logger[_0x8177('0x31')]('[HTTP]',JSON[_0x8177('0x32')](_0x4d3877));return rp(_[_0x8177('0x7')](_0x4d3877,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x85630a,_0x2ace0e){var _0xc8101c=[];if(_0x85630a&&_0x85630a[_0x8177('0x33')]>0x0){_0xc8101c=_['map'](_0x85630a,_0x2ace0e);}return _0xc8101c;}function getCustomFields(_0x20ef27,_0x312ade){var _0x169bf6=[];var _0x462753={'custom_fields':[]};if(_0x20ef27[_0x8177('0x33')]>0x0){_['forEach'](_0x20ef27,function(_0x57f02e){if(_[_0x8177('0x34')]([_0x8177('0x35'),'picklist'],_0x57f02e[_0x8177('0x36')])&&_0x57f02e[_0x8177('0x37')]&&!_0x57f02e['customField']){_0x462753[_0x57f02e[_0x8177('0x37')][_0x8177('0x38')]()]=_0x57f02e[_0x8177('0x39')][_0x8177('0x2f')]();}else if(_['includes']([_0x8177('0x35'),_0x8177('0x3a')],_0x57f02e[_0x8177('0x36')])&&_0x57f02e[_0x8177('0x3b')]&&_0x57f02e[_0x8177('0x3c')]){_0x462753[_0x8177('0x18')][_0x8177('0x3d')]({'id':_0x57f02e[_0x8177('0x3b')],'value':_0x57f02e['content'][_0x8177('0x2f')]()});}else if(_0x57f02e['type']===_0x8177('0x3e')&&_0x57f02e[_0x8177('0x3f')]&&_0x57f02e['idField']&&_0x57f02e['customField']){_0x312ade[_0x57f02e[_0x8177('0x3f')]]&&_0x462753['custom_fields'][_0x8177('0x3d')]({'id':_0x57f02e[_0x8177('0x3b')],'value':_0x312ade[_0x57f02e[_0x8177('0x3f')]]['toString']()});}else if(_0x57f02e['type']===_0x8177('0x40')&&_0x57f02e[_0x8177('0x41')]&&_0x57f02e[_0x8177('0x41')][_0x8177('0x16')]&&_0x57f02e['idField']&&_0x57f02e[_0x8177('0x3c')]){_0x312ade[_0x57f02e['Variable'][_0x8177('0x16')][_0x8177('0x38')]()]&&_0x462753['custom_fields'][_0x8177('0x3d')]({'id':_0x57f02e['idField'],'value':_0x312ade[_0x57f02e['Variable'][_0x8177('0x16')]['toLowerCase']()][_0x8177('0x2f')]()});}});}return _0x462753;}exports['queue']=function(_0x692e5,_0x43dfd2,_0x2f9855,_0x1a4e30,_0x57ba66,_0x464148){var _0x150232,_0x57680d;_0x464148[_0x8177('0x1c')]=intUtil['stripTrailingSlash'](_0x464148['remoteUri']);_0x464148[_0x8177('0x42')]=intUtil[_0x8177('0x43')](_0x464148[_0x8177('0x42')]);if(_0x57ba66&&_0x57ba66[_0x8177('0x44')]){logger[_0x8177('0xc')](_0x8177('0x45'),'Recording\x20is\x20enabled!');_0x43dfd2['recordingURL']=util['format'](_0x8177('0x46'),_0x464148[_0x8177('0x42')],_0x43dfd2['uniqueid'],md5(_0x43dfd2[_0x8177('0x47')]));}else{_0x43dfd2['recordingURL']='';}headers[_0x8177('0x48')]=getAuth(_0x464148);return getUser(_0x464148,_0x1a4e30['email'])['then'](function(_0x4a1d97){_0x150232=_0x4a1d97;logger[_0x8177('0xc')](_0x8177('0x49'),_0x150232['id']);return getEndUser(_0x464148,_0x43dfd2['calleridname'],_0x43dfd2[_0x8177('0x12')]);})['then'](function(_0x3824ec){_0x57680d=_0x3824ec;logger[_0x8177('0xc')]('The\x20Enduser\x20ID\x20is:',_0x57680d['id']);return getTicket(_0x464148,_0x150232,_0x57680d,_0x2f9855,_0x43dfd2);})[_0x8177('0x1e')](function(_0x367a81){if(_0x367a81&&_0x367a81['id']){logger[_0x8177('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x367a81['id']);logger[_0x8177('0xc')](_0x8177('0x45'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x8177('0x4a'),_0x1a4e30[_0x8177('0x16')]),_0x8177('0x4b'),{'uri':util[_0x8177('0xf')](_0x8177('0x4c'),_0x464148[_0x8177('0x1c')],_0x367a81['id'])});}})['catch'](function(_0xf33e4c){logger[_0x8177('0x4d')](_0x8177('0x45'),JSON['stringify'](_0xf33e4c));});};exports[_0x8177('0x4e')]=function(_0x4e80b2,_0x1dd108,_0xe5b6b2,_0x277b56,_0x201ce6,_0xaa3366,_0x3a6985){var _0xe18e6c,_0x4154d9;_0xaa3366['remoteUri']=intUtil[_0x8177('0x43')](_0xaa3366[_0x8177('0x1c')]);_0xaa3366[_0x8177('0x42')]=intUtil[_0x8177('0x43')](_0xaa3366['serverUrl']);if(_0x3a6985&&_0x3a6985[_0x8177('0x4f')]&&_0x3a6985['recordingFormat']!==_0x8177('0x50')){logger[_0x8177('0xc')](_0x8177('0x51'),_0x8177('0x52'));_0x1dd108[_0x8177('0x53')]=util[_0x8177('0xf')](_0x8177('0x46'),_0xaa3366[_0x8177('0x42')],_0x1dd108[_0x8177('0x47')],md5(_0x1dd108[_0x8177('0x47')]));}headers[_0x8177('0x48')]=getAuth(_0xaa3366);return getUser(_0xaa3366,_0x277b56[_0x8177('0x24')])[_0x8177('0x1e')](function(_0x108ccc){_0xe18e6c=_0x108ccc;logger['info'](_0x8177('0x49'),_0xe18e6c['id']);return getEndUser(_0xaa3366,_0x1dd108[_0x8177('0x54')],_0x1dd108[_0x8177('0x55')]);})[_0x8177('0x1e')](function(_0x461727){_0x4154d9=_0x461727;logger[_0x8177('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4154d9['id']);return getTicket(_0xaa3366,_0xe18e6c,_0x4154d9,_0xe5b6b2,_0x1dd108);})[_0x8177('0x1e')](function(_0x248b9e){if(_0x248b9e&&_0x248b9e['id']){logger['info']('Ticket\x20created!');logger[_0x8177('0xc')](_0x8177('0x56'),_0x248b9e['id']);logger[_0x8177('0xc')](_0x8177('0x51'),_0x8177('0x57'));emit(util[_0x8177('0xf')](_0x8177('0x4a'),_0x277b56[_0x8177('0x16')]),_0x8177('0x4b'),{'uri':util['format'](_0x8177('0x4c'),_0xaa3366[_0x8177('0x1c')],_0x248b9e['id'])});}})[_0x8177('0x58')](function(_0x3cdbdd){logger[_0x8177('0x4d')](_0x8177('0x51'),JSON['stringify'](_0x3cdbdd));});};exports[_0x8177('0x59')]=function(_0x30905b,_0xe87fb0,_0x3943b0,_0x3423d4,_0x10fb55,_0x40f63d){var _0x6801d4,_0x18f598;_0x40f63d['remoteUri']=intUtil[_0x8177('0x43')](_0x40f63d[_0x8177('0x1c')]);_0x40f63d[_0x8177('0x42')]=intUtil[_0x8177('0x43')](_0x40f63d[_0x8177('0x42')]);if(_0x10fb55&&_0x10fb55[_0x8177('0x44')]){logger[_0x8177('0xc')]('['+_0xe87fb0[_0x8177('0x5a')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xe87fb0[_0x8177('0x53')]=util['format'](_0x8177('0x46'),_0x40f63d['serverUrl'],_0xe87fb0[_0x8177('0x47')],md5(_0xe87fb0[_0x8177('0x47')]));}else{_0xe87fb0[_0x8177('0x53')]='';}headers[_0x8177('0x48')]=getAuth(_0x40f63d);return getUser(_0x40f63d,'')[_0x8177('0x1e')](function(_0x29f394){_0x6801d4=_0x29f394;logger[_0x8177('0xc')](_0x8177('0x49'),_0x6801d4['id']);return getEndUser(_0x40f63d,_0xe87fb0[_0x8177('0x11')],_0xe87fb0['calleridnum']);})[_0x8177('0x1e')](function(_0x330ee5){_0x18f598=_0x330ee5;logger[_0x8177('0xc')](_0x8177('0x5b'),_0x18f598['id']);return getTicket(_0x40f63d,_0x6801d4,_0x18f598,_0x3943b0,_0xe87fb0);})[_0x8177('0x1e')](function(_0x24f193){if(_0x24f193){logger[_0x8177('0xc')](_0x8177('0x5c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x24f193['id']);}})['catch'](function(_0x193eea){logger['error']('['+_0xe87fb0[_0x8177('0x5a')]['toUpperCase']()+']',JSON[_0x8177('0x32')](_0x193eea));});}; \ 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 0727211..7a3edc3 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 _0x88e4=['Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userId','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Descriptions','Contact','add','ticketId','/contacts/','trigger:browser:url','Token\x20token=','apiKey','serverUrl','stripTrailingSlash','remoteUri','toLowerCase','outbound','calleridnum','callDirection','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','./util','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message'];(function(_0x46b1c9,_0x169f87){var _0x17569c=function(_0x4b7c45){while(--_0x4b7c45){_0x46b1c9['push'](_0x46b1c9['shift']());}};_0x17569c(++_0x169f87);}(_0x88e4,0x1ca));var _0x488e=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x88e4[_0x2300c7];return _0x23f720;};'use strict';var _=require('lodash');var rp=require(_0x488e('0x0'));var md5=require(_0x488e('0x1'));var util=require(_0x488e('0x2'));var moment=require(_0x488e('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require(_0x488e('0x4'));var config=require('../../../../config/environment');var logger=require(_0x488e('0x5'))(_0x488e('0x6'));config[_0x488e('0x7')]=_[_0x488e('0x8')](config[_0x488e('0x7')],{'host':_0x488e('0x9'),'port':0x18eb});var io=require(_0x488e('0xa'))(new Redis(config[_0x488e('0x7')]));function getAdminId(_0x99de1d,_0x578ecf,_0x322cfd,_0xe66009){return new Promise(function(_0x169ace,_0x3341c5){var _0x1cc4c5=![];var _0x38c99b={'method':_0x488e('0xb'),'uri':_0xe66009+_0x488e('0xc'),'json':!![]};_0x38c99b[_0x488e('0xd')]=_0x322cfd;logger[_0x488e('0xe')](_0x488e('0xf'));return rp(_0x38c99b)[_0x488e('0x10')](function(_0x1d6672){if(_0x1d6672){var _0x3e0c7d=_0x1d6672[_0x488e('0x11')];var _0x239e04=null;for(_0x239e04=0x0;_0x239e04<_0x3e0c7d[_0x488e('0x12')];_0x239e04++){if(_0x3e0c7d[_0x239e04][_0x488e('0x13')]===_0x99de1d[_0x488e('0x14')]){_0x99de1d[_0x488e('0x15')]=_0x3e0c7d[_0x239e04]['id'];_0x1cc4c5=!![];}}if(_0x1cc4c5){logger[_0x488e('0xe')](_0x488e('0x16'),_0x99de1d[_0x488e('0x15')]);_0x169ace(_0x99de1d);}else{_0x3341c5({'statusCode':0x194,'message':_0x488e('0x17')});}}else{_0x3341c5({'statusCode':0x194,'message':_0x488e('0x17')});}})[_0x488e('0x18')](function(_0x235098){logger[_0x488e('0x19')]('['+[_0x578ecf[_0x488e('0x1a')]()]+']',_0x235098[_0x488e('0x1b')]);_0x3341c5(_0x235098);});});}function getUser(_0x2afcd9,_0x5d83d1,_0x3862db){return function(_0x2ab0f1){return new Promise(function(_0x15401d,_0x2f1f25){var _0x7e33be={'method':_0x488e('0xb'),'uri':_0x3862db+_0x488e('0xc'),'json':!![]};_0x7e33be[_0x488e('0xd')]=_0x5d83d1;logger['info'](_0x488e('0x1c'));return rp(_0x7e33be)[_0x488e('0x10')](function(_0x4c2353){if(_0x4c2353){var _0x2d5536=_0x4c2353[_0x488e('0x11')];var _0x4cae77=![];var _0x377bb6=null;if(_0x2ab0f1['agentEmail']!==null){logger[_0x488e('0xe')](_0x488e('0x1d'),_0x2ab0f1['agentEmail']);_0x2ab0f1['userEmail']=_0x2ab0f1[_0x488e('0x1e')];for(_0x377bb6=0x0;_0x377bb6<_0x2d5536[_0x488e('0x12')];_0x377bb6++){if(_0x2d5536[_0x377bb6][_0x488e('0x13')]===_0x2ab0f1[_0x488e('0x1e')]){_0x4cae77=!![];_0x2ab0f1[_0x488e('0x1f')]=_0x2d5536[_0x377bb6]['id'];logger[_0x488e('0xe')]('User\x20found:',_0x2ab0f1[_0x488e('0x1f')]);}}}if(!_0x4cae77){logger['info'](_0x488e('0x20'));_0x2ab0f1[_0x488e('0x21')]=_0x2ab0f1['adminEmail'];_0x2ab0f1[_0x488e('0x1f')]=_0x2ab0f1[_0x488e('0x15')];_0x4cae77=!![];}if(_0x4cae77){_0x15401d(_0x2ab0f1);}else{_0x2f1f25({'statusCode':0x194,'message':_0x488e('0x17')});}}else{_0x2f1f25({'statusCode':0x194,'message':_0x488e('0x17')});}})[_0x488e('0x18')](function(_0x3fbab9){logger[_0x488e('0x19')]('['+[_0x2afcd9[_0x488e('0x1a')]()]+']',_0x3fbab9[_0x488e('0x1b')]);_0x2f1f25(_0x3fbab9);});});};}function searchContact(_0x43f395,_0x4536f5,_0x4616b0,_0x14febc){return new Promise(function(_0x432925,_0x206c88){var _0x4abb4d={'method':_0x488e('0xb'),'headers':_0x4536f5,'uri':_0x43f395+_0x488e('0x22')+_0x14febc+_0x488e('0x23')+_0x4616b0+_0x488e('0x24'),'json':!![]};rp(_0x4abb4d)[_0x488e('0x10')](function(_0x51ee94){var _0x3f97b9=_[_0x488e('0x25')](_0x51ee94[_0x488e('0x26')][_0x488e('0x26')],[_0x4616b0,_0x14febc]);_0x432925(_0x3f97b9);})[_0x488e('0x18')](function(_0x69b98b){_0x206c88(_0x69b98b);});});}function getEndUser(_0xa28376,_0x2dabc7,_0x53bf7d){return function(_0x273d40){return new Promise(function(_0x199432,_0x3d67ed){logger[_0x488e('0xe')](util['format'](_0x488e('0x27'),_0x273d40[_0x488e('0x28')]));searchContact(_0x53bf7d,_0x2dabc7,_0x488e('0x29'),_0x273d40[_0x488e('0x28')])[_0x488e('0x10')](function(_0x19d8ff){if(_0x19d8ff){_0x273d40['endUserId']=_0x19d8ff['id'];logger[_0x488e('0xe')](_0x488e('0x2a'),_0x273d40[_0x488e('0x2b')]);return _0x199432(_0x273d40);}searchContact(_0x53bf7d,_0x2dabc7,'work_number',_0x273d40[_0x488e('0x28')])[_0x488e('0x10')](function(_0x54abe6){if(_0x54abe6){_0x273d40[_0x488e('0x2b')]=_0x54abe6['id'];logger[_0x488e('0xe')](_0x488e('0x2c'),_0x273d40[_0x488e('0x2b')]);return _0x199432(_0x273d40);}createEndUser(_0x273d40,_0xa28376,_0x2dabc7,_0x53bf7d)[_0x488e('0x10')](function(_0x542aca){logger['info'](_0x488e('0x2d'),_0x542aca[_0x488e('0x2b')]);return _0x199432(_0x542aca);});});})[_0x488e('0x18')](function(_0x1732ca){_0x3d67ed(_0x1732ca);});});};}function createEndUser(_0x1dc077,_0x2a72c7,_0x326343,_0x31b451){return new Promise(function(_0x38f5f9,_0x1eba32){var _0x4a4384=moment();var _0x3184d8={'method':_0x488e('0x2e'),'uri':_0x31b451+'/api/contacts','body':{'contact':{'last_name':_0x1dc077[_0x488e('0x28')],'work_number':_0x1dc077[_0x488e('0x28')],'mobile_number':_0x1dc077[_0x488e('0x28')],'owner_id':_0x1dc077['userId'],'created_at':_0x4a4384[_0x488e('0x2f')](_0x488e('0x30'))}},'json':!![]};_0x3184d8['headers']=_0x326343;logger['info'](_0x488e('0x31'));return rp(_0x3184d8)[_0x488e('0x10')](function(_0x236582){_0x1dc077[_0x488e('0x2b')]=_0x236582[_0x488e('0x32')]['id'];_0x38f5f9(_0x1dc077);})[_0x488e('0x18')](function(_0x42f5e9){logger['error']('['+[_0x2a72c7[_0x488e('0x1a')]()]+']',_0x42f5e9[_0x488e('0x1b')]);_0x1eba32(_0x42f5e9[_0x488e('0x1b')]);});});}function getTicket(_0x20348d,_0x38f706,_0x131500,_0x71a189,_0x25f7cb){return function(_0x5e388c){logger['info'](_0x488e('0x33'));return new Promise(function(_0x361662,_0x291610){var _0x2d0a21=moment();var _0x24bcc8={'method':_0x488e('0x2e'),'uri':_0x131500+'/api/tasks','body':{'title':intUtil[_0x488e('0x34')](_0x71a189['Subjects'],_0x25f7cb,'\x20'),'description':intUtil[_0x488e('0x34')](_0x71a189[_0x488e('0x35')],_0x25f7cb,'\x0a'),'owner_id':_0x5e388c[_0x488e('0x1f')],'creater_id':_0x5e388c['adminId'],'targetable_id':_0x5e388c[_0x488e('0x2b')],'targetable_type':_0x488e('0x36'),'created_at':_0x2d0a21['format'](_0x488e('0x30')),'due_date':_0x2d0a21[_0x488e('0x37')](0x1e,'m')[_0x488e('0x2f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x24bcc8[_0x488e('0xd')]=_0x38f706;return rp(_0x24bcc8)[_0x488e('0x10')](function(_0x5c907b){_0x5e388c[_0x488e('0x38')]=_0x5c907b['task']['id'];logger[_0x488e('0xe')]('Task\x20created:',_0x5e388c[_0x488e('0x38')]);_0x361662(_0x5e388c);})[_0x488e('0x18')](function(_0x18a3cb){logger[_0x488e('0x19')]('['+[_0x20348d[_0x488e('0x1a')]()]+']',_0x18a3cb['message']);_0x291610(_0x18a3cb['message']);});});};}function emit(_0x4b012f,_0x330a7b,_0x46a2e9){var _0xf9d0e4={'uri':_0x4b012f+_0x488e('0x39')+_0x46a2e9};io['to'](util['format']('user:%s',_0x330a7b))['emit'](_0x488e('0x3a'),_0xf9d0e4);}exports['cs']=function(_0x4bf049,_0x1d02aa,_0x4d8758,_0x55ab85,_0x4ef523,_0x5e5364,_0x4950e5,_0x2f7bcb){var _0x248cc7={};var _0x168150={'Authorization':_0x488e('0x3b')+_0x5e5364[_0x488e('0x3c')]};_0x5e5364['remoteUri']=intUtil['stripTrailingSlash'](_0x5e5364['remoteUri']);_0x5e5364[_0x488e('0x3d')]=intUtil[_0x488e('0x3e')](_0x5e5364[_0x488e('0x3d')]);var _0x4ba41f=_0x5e5364[_0x488e('0x3f')];_0x248cc7[_0x488e('0x14')]=_0x5e5364['username'];_0x248cc7['contactNumber']=_0x2f7bcb[_0x488e('0x40')]()===_0x488e('0x41')?_0x1d02aa['destcalleridnum']:_0x1d02aa[_0x488e('0x42')];_0x248cc7[_0x488e('0x43')]=_0x2f7bcb==='queue'||_0x2f7bcb==='unmanaged'?'queue':_0x488e('0x41');if(_0x55ab85){_0x248cc7[_0x488e('0x1e')]=_0x55ab85['email'];}var _0x3a33a8=util['format'](_0x488e('0x44'),_0x5e5364[_0x488e('0x3d')],_0x1d02aa[_0x488e('0x45')],md5(_0x1d02aa[_0x488e('0x45')]));if(_0x4ef523&&_0x4ef523[_0x488e('0x46')]){logger['info'](_0x488e('0x47'),_0x488e('0x48'));_0x1d02aa[_0x488e('0x49')]=_0x3a33a8;}else if(_0x4950e5&&_0x4950e5[_0x488e('0x4a')]&&_0x4950e5[_0x488e('0x4a')]!=='none'){logger[_0x488e('0xe')](_0x488e('0x4b'),_0x488e('0x48'));_0x1d02aa[_0x488e('0x49')]=_0x3a33a8;}else{_0x1d02aa['recordingURL']='';}return getAdminId(_0x248cc7,_0x2f7bcb,_0x168150,_0x4ba41f)['then'](getUser(_0x2f7bcb,_0x168150,_0x4ba41f))[_0x488e('0x10')](getEndUser(_0x2f7bcb,_0x168150,_0x4ba41f))[_0x488e('0x10')](getTicket(_0x2f7bcb,_0x168150,_0x4ba41f,_0x4d8758,_0x1d02aa))['then'](function(_0x3afb8d){logger[_0x488e('0xe')](util[_0x488e('0x2f')](_0x488e('0x4c'),_0x3afb8d[_0x488e('0x38')]));if(_0x2f7bcb!==_0x488e('0x4d')){logger[_0x488e('0xe')]('['+[_0x2f7bcb['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4ba41f,_0x55ab85[_0x488e('0x4e')],_0x3afb8d[_0x488e('0x2b')]);}})[_0x488e('0x18')](function(_0x5ee539){logger['error']('['+[_0x2f7bcb[_0x488e('0x1a')]()]+_0x488e('0x4f'),util[_0x488e('0x50')](_0x5ee539,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1b02=['catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','Creating\x20new\x20task','getString','Subjects','Contact','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','localhost','socket.io-emitter','redis','GET','/api/selector/owners','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found'];(function(_0x490497,_0x1efe14){var _0x344692=function(_0x4907f5){while(--_0x4907f5){_0x490497['push'](_0x490497['shift']());}};_0x344692(++_0x1efe14);}(_0x1b02,0xed));var _0x21b0=function(_0x39443c,_0x25bf1f){_0x39443c=_0x39443c-0x0;var _0x39a016=_0x1b02[_0x39443c];return _0x39a016;};'use strict';var _=require(_0x21b0('0x0'));var rp=require('request-promise');var md5=require(_0x21b0('0x1'));var util=require(_0x21b0('0x2'));var moment=require(_0x21b0('0x3'));var Promise=require(_0x21b0('0x4'));var Redis=require('ioredis');var intUtil=require(_0x21b0('0x5'));var config=require(_0x21b0('0x6'));var logger=require(_0x21b0('0x7'))(_0x21b0('0x8'));config['redis']=_[_0x21b0('0x9')](config['redis'],{'host':_0x21b0('0xa'),'port':0x18eb});var io=require(_0x21b0('0xb'))(new Redis(config[_0x21b0('0xc')]));function getAdminId(_0x2cbdb7,_0x17cf99,_0xa27384,_0x17f10a){return new Promise(function(_0x5b5f3a,_0x359de3){var _0x1f6ad1=![];var _0x3eaee1={'method':_0x21b0('0xd'),'uri':_0x17f10a+_0x21b0('0xe'),'json':!![]};_0x3eaee1['headers']=_0xa27384;logger[_0x21b0('0xf')]('Getting\x20admin\x20information');return rp(_0x3eaee1)[_0x21b0('0x10')](function(_0x249ce2){if(_0x249ce2){var _0x155d3e=_0x249ce2[_0x21b0('0x11')];var _0x4440c5=null;for(_0x4440c5=0x0;_0x4440c5<_0x155d3e[_0x21b0('0x12')];_0x4440c5++){if(_0x155d3e[_0x4440c5][_0x21b0('0x13')]===_0x2cbdb7[_0x21b0('0x14')]){_0x2cbdb7[_0x21b0('0x15')]=_0x155d3e[_0x4440c5]['id'];_0x1f6ad1=!![];}}if(_0x1f6ad1){logger[_0x21b0('0xf')](_0x21b0('0x16'),_0x2cbdb7[_0x21b0('0x15')]);_0x5b5f3a(_0x2cbdb7);}else{_0x359de3({'statusCode':0x194,'message':_0x21b0('0x17')});}}else{_0x359de3({'statusCode':0x194,'message':_0x21b0('0x17')});}})[_0x21b0('0x18')](function(_0x27154e){logger[_0x21b0('0x19')]('['+[_0x17cf99[_0x21b0('0x1a')]()]+']',_0x27154e[_0x21b0('0x1b')]);_0x359de3(_0x27154e);});});}function getUser(_0x41e5e5,_0x2fd3ca,_0x68706f){return function(_0x59318e){return new Promise(function(_0x3c8cce,_0x8d9108){var _0x20dd91={'method':_0x21b0('0xd'),'uri':_0x68706f+_0x21b0('0xe'),'json':!![]};_0x20dd91['headers']=_0x2fd3ca;logger[_0x21b0('0xf')](_0x21b0('0x1c'));return rp(_0x20dd91)[_0x21b0('0x10')](function(_0xb4e9a1){if(_0xb4e9a1){var _0x51b613=_0xb4e9a1[_0x21b0('0x11')];var _0x248884=![];var _0x23ce16=null;if(_0x59318e[_0x21b0('0x1d')]!==null){logger[_0x21b0('0xf')](_0x21b0('0x1e'),_0x59318e['agentEmail']);_0x59318e[_0x21b0('0x1f')]=_0x59318e[_0x21b0('0x1d')];for(_0x23ce16=0x0;_0x23ce16<_0x51b613[_0x21b0('0x12')];_0x23ce16++){if(_0x51b613[_0x23ce16][_0x21b0('0x13')]===_0x59318e[_0x21b0('0x1d')]){_0x248884=!![];_0x59318e[_0x21b0('0x20')]=_0x51b613[_0x23ce16]['id'];logger[_0x21b0('0xf')](_0x21b0('0x21'),_0x59318e[_0x21b0('0x20')]);}}}if(!_0x248884){logger['info'](_0x21b0('0x22'));_0x59318e[_0x21b0('0x1f')]=_0x59318e[_0x21b0('0x14')];_0x59318e[_0x21b0('0x20')]=_0x59318e[_0x21b0('0x15')];_0x248884=!![];}if(_0x248884){_0x3c8cce(_0x59318e);}else{_0x8d9108({'statusCode':0x194,'message':_0x21b0('0x17')});}}else{_0x8d9108({'statusCode':0x194,'message':_0x21b0('0x17')});}})['catch'](function(_0x587f6d){logger['error']('['+[_0x41e5e5[_0x21b0('0x1a')]()]+']',_0x587f6d[_0x21b0('0x1b')]);_0x8d9108(_0x587f6d);});});};}function searchContact(_0x186a28,_0x50a59d,_0x3dcb10,_0x46fa6f){return new Promise(function(_0x4c4d42,_0x32a91b){var _0x38e1c6={'method':_0x21b0('0xd'),'headers':_0x50a59d,'uri':_0x186a28+_0x21b0('0x23')+_0x46fa6f+_0x21b0('0x24')+_0x3dcb10+_0x21b0('0x25'),'json':!![]};rp(_0x38e1c6)[_0x21b0('0x10')](function(_0x4c98d9){var _0xb6fceb=_[_0x21b0('0x26')](_0x4c98d9[_0x21b0('0x27')][_0x21b0('0x27')],[_0x3dcb10,_0x46fa6f]);_0x4c4d42(_0xb6fceb);})[_0x21b0('0x18')](function(_0x55b106){_0x32a91b(_0x55b106);});});}function getEndUser(_0x2328a2,_0x7a9f71,_0x3ba7cd){return function(_0x5bb10b){return new Promise(function(_0xdcb31a,_0x24dfc0){logger[_0x21b0('0xf')](util[_0x21b0('0x28')](_0x21b0('0x29'),_0x5bb10b[_0x21b0('0x2a')]));searchContact(_0x3ba7cd,_0x7a9f71,_0x21b0('0x2b'),_0x5bb10b[_0x21b0('0x2a')])['then'](function(_0x75e609){if(_0x75e609){_0x5bb10b[_0x21b0('0x2c')]=_0x75e609['id'];logger['info'](_0x21b0('0x2d'),_0x5bb10b[_0x21b0('0x2c')]);return _0xdcb31a(_0x5bb10b);}searchContact(_0x3ba7cd,_0x7a9f71,_0x21b0('0x2e'),_0x5bb10b[_0x21b0('0x2a')])[_0x21b0('0x10')](function(_0xf59730){if(_0xf59730){_0x5bb10b[_0x21b0('0x2c')]=_0xf59730['id'];logger[_0x21b0('0xf')](_0x21b0('0x2f'),_0x5bb10b[_0x21b0('0x2c')]);return _0xdcb31a(_0x5bb10b);}createEndUser(_0x5bb10b,_0x2328a2,_0x7a9f71,_0x3ba7cd)[_0x21b0('0x10')](function(_0x450d1a){logger[_0x21b0('0xf')](_0x21b0('0x30'),_0x450d1a['endUserId']);return _0xdcb31a(_0x450d1a);});});})[_0x21b0('0x18')](function(_0x135c1e){_0x24dfc0(_0x135c1e);});});};}function createEndUser(_0x41c618,_0x22ac5b,_0x5a6b86,_0x50c345){return new Promise(function(_0x5cb086,_0x1c536b){var _0x59d193=moment();var _0x305ae4={'method':_0x21b0('0x31'),'uri':_0x50c345+_0x21b0('0x32'),'body':{'contact':{'last_name':_0x41c618[_0x21b0('0x2a')],'work_number':_0x41c618[_0x21b0('0x2a')],'mobile_number':_0x41c618[_0x21b0('0x2a')],'owner_id':_0x41c618[_0x21b0('0x20')],'created_at':_0x59d193[_0x21b0('0x28')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x305ae4[_0x21b0('0x33')]=_0x5a6b86;logger[_0x21b0('0xf')](_0x21b0('0x34'));return rp(_0x305ae4)[_0x21b0('0x10')](function(_0x1265e9){_0x41c618['endUserId']=_0x1265e9['contact']['id'];_0x5cb086(_0x41c618);})[_0x21b0('0x18')](function(_0x571614){logger[_0x21b0('0x19')]('['+[_0x22ac5b[_0x21b0('0x1a')]()]+']',_0x571614[_0x21b0('0x1b')]);_0x1c536b(_0x571614[_0x21b0('0x1b')]);});});}function getTicket(_0xc03374,_0x108939,_0x2e6a40,_0x43e8b4,_0x4b83fe){return function(_0xc9bfdd){logger[_0x21b0('0xf')](_0x21b0('0x35'));return new Promise(function(_0x51ea00,_0xbd46ee){var _0x28385d=moment();var _0x18df75={'method':'POST','uri':_0x2e6a40+'/api/tasks','body':{'title':intUtil[_0x21b0('0x36')](_0x43e8b4[_0x21b0('0x37')],_0x4b83fe,'\x20'),'description':intUtil['getString'](_0x43e8b4['Descriptions'],_0x4b83fe,'\x0a'),'owner_id':_0xc9bfdd[_0x21b0('0x20')],'creater_id':_0xc9bfdd[_0x21b0('0x15')],'targetable_id':_0xc9bfdd[_0x21b0('0x2c')],'targetable_type':_0x21b0('0x38'),'created_at':_0x28385d[_0x21b0('0x28')](_0x21b0('0x39')),'due_date':_0x28385d[_0x21b0('0x3a')](0x1e,'m')['format'](_0x21b0('0x39'))},'json':!![]};_0x18df75['headers']=_0x108939;return rp(_0x18df75)[_0x21b0('0x10')](function(_0x206a95){_0xc9bfdd[_0x21b0('0x3b')]=_0x206a95[_0x21b0('0x3c')]['id'];logger[_0x21b0('0xf')](_0x21b0('0x3d'),_0xc9bfdd[_0x21b0('0x3b')]);_0x51ea00(_0xc9bfdd);})['catch'](function(_0x4149bc){logger['error']('['+[_0xc03374['toUpperCase']()]+']',_0x4149bc['message']);_0xbd46ee(_0x4149bc['message']);});});};}function emit(_0x87f895,_0x282996,_0x3e859a){var _0x448ad9={'uri':_0x87f895+'/contacts/'+_0x3e859a};io['to'](util[_0x21b0('0x28')](_0x21b0('0x3e'),_0x282996))[_0x21b0('0x3f')](_0x21b0('0x40'),_0x448ad9);}exports['cs']=function(_0x188cc0,_0x48f4f1,_0x4bc2f7,_0xdcade9,_0x2910eb,_0x5f5a19,_0x50131e,_0x138e12){var _0x29e25a={};var _0x3392f7={'Authorization':_0x21b0('0x41')+_0x5f5a19['apiKey']};_0x5f5a19[_0x21b0('0x42')]=intUtil[_0x21b0('0x43')](_0x5f5a19[_0x21b0('0x42')]);_0x5f5a19[_0x21b0('0x44')]=intUtil['stripTrailingSlash'](_0x5f5a19[_0x21b0('0x44')]);var _0x4acefb=_0x5f5a19[_0x21b0('0x42')];_0x29e25a['adminEmail']=_0x5f5a19[_0x21b0('0x45')];_0x29e25a['contactNumber']=_0x138e12[_0x21b0('0x46')]()===_0x21b0('0x47')?_0x48f4f1['destcalleridnum']:_0x48f4f1[_0x21b0('0x48')];_0x29e25a['callDirection']=_0x138e12===_0x21b0('0x49')||_0x138e12==='unmanaged'?'queue':_0x21b0('0x47');if(_0xdcade9){_0x29e25a[_0x21b0('0x1d')]=_0xdcade9[_0x21b0('0x13')];}var _0x459c15=util['format'](_0x21b0('0x4a'),_0x5f5a19[_0x21b0('0x44')],_0x48f4f1['uniqueid'],md5(_0x48f4f1[_0x21b0('0x4b')]));if(_0x2910eb&&_0x2910eb[_0x21b0('0x4c')]){logger[_0x21b0('0xf')]('[QUEUE]',_0x21b0('0x4d'));_0x48f4f1['recordingURL']=_0x459c15;}else if(_0x50131e&&_0x50131e[_0x21b0('0x4e')]&&_0x50131e[_0x21b0('0x4e')]!==_0x21b0('0x4f')){logger[_0x21b0('0xf')](_0x21b0('0x50'),_0x21b0('0x4d'));_0x48f4f1[_0x21b0('0x51')]=_0x459c15;}else{_0x48f4f1[_0x21b0('0x51')]='';}return getAdminId(_0x29e25a,_0x138e12,_0x3392f7,_0x4acefb)[_0x21b0('0x10')](getUser(_0x138e12,_0x3392f7,_0x4acefb))['then'](getEndUser(_0x138e12,_0x3392f7,_0x4acefb))[_0x21b0('0x10')](getTicket(_0x138e12,_0x3392f7,_0x4acefb,_0x4bc2f7,_0x48f4f1))[_0x21b0('0x10')](function(_0x5a327d){logger['info'](util['format'](_0x21b0('0x52'),_0x5a327d[_0x21b0('0x3b')]));if(_0x138e12!==_0x21b0('0x53')){logger['info']('['+[_0x138e12[_0x21b0('0x1a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x4acefb,_0xdcade9[_0x21b0('0x54')],_0x5a327d[_0x21b0('0x2c')]);}})[_0x21b0('0x18')](function(_0x36302a){logger[_0x21b0('0x19')]('['+[_0x138e12['toUpperCase']()]+_0x21b0('0x55'),util[_0x21b0('0x56')](_0x36302a,{'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 435e69c..411a01a 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 _0x496a=['./freshdesk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','zoho','desk','dynamics365','freshsales','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','salesforce','log','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','lodash','util','./zendesk','./salesforce','./sugarcrm'];(function(_0x310504,_0x26ad95){var _0x5b36d0=function(_0x253f28){while(--_0x253f28){_0x310504['push'](_0x310504['shift']());}};_0x5b36d0(++_0x26ad95);}(_0x496a,0x19f));var _0xa496=function(_0x460f4b,_0x2d3b64){_0x460f4b=_0x460f4b-0x0;var _0x551685=_0x496a[_0x460f4b];return _0x551685;};'use strict';var _=require(_0xa496('0x0'));var util=require(_0xa496('0x1'));var zendesk=require(_0xa496('0x2'));var salesforce=require(_0xa496('0x3'));var sugarcrm=require(_0xa496('0x4'));var freshdesk=require(_0xa496('0x5'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0xa496('0x6'));var servicenow=require(_0xa496('0x7'));var dynamics365=require(_0xa496('0x8'));var freshsales=require(_0xa496('0x9'));var integrations=['zendesk','salesforce',_0xa496('0xa'),'freshdesk',_0xa496('0xb'),_0xa496('0xc'),'vtiger',_0xa496('0xd'),_0xa496('0xe'),'servicenow'];exports['exec']=function(_0x23080e,_0x3e194e,_0x156f58,_0x4f58c1,_0x24f154,_0x3835d1){if(_0x156f58){if(_[_0xa496('0xf')](integrations,_0x23080e[_0xa496('0x10')][_0xa496('0x11')]())){try{var _0xe4a415=null;var _0xb099f6='';var _0x3889a4=_0x156f58[_0x23080e[_0xa496('0x10')][_0xa496('0x11')]()];if(_0x3889a4){var _0x1f24be=_0x3889a4[_0x23080e[_0xa496('0x12')]];if(_0x1f24be){var _0x22a645=_[_0xa496('0x13')](_0x1f24be[_0xa496('0x14')],{'id':parseInt(_0x23080e[_0xa496('0x15')],0xa)});if(_0x22a645){if(_0x4f58c1){if(_0x24f154&&_0x3e194e[_0xa496('0x16')]){_0xb099f6=_0xa496('0x16');}else if(_0x3e194e[_0xa496('0x17')]){_0xb099f6=_0xa496('0x18');}else{console['log'](_0xa496('0x19'),_0x3e194e);}}else{_0xb099f6=_0xa496('0x1a');}switch(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]()){case _0xa496('0x1b'):zendesk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0x1c'):salesforce[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xa'):sugarcrm[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case'freshdesk':freshdesk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xb'):zoho[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xc'):desk[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case'vtiger':vtiger[_0xb099f6](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1);break;case _0xa496('0xe'):freshsales['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;case'servicenow':servicenow['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;case _0xa496('0xd'):dynamics365['cs'](_0x23080e,_0x3e194e,_0x22a645,_0x4f58c1,_0x24f154,_0x1f24be,_0x3835d1,_0xb099f6);break;default:console[_0xa496('0x1d')](_0xa496('0x1e'));}}else{_0xe4a415=require(_0xa496('0x1f'))(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]());_0xe4a415[_0xa496('0x20')](_0xa496('0x21'),util[_0xa496('0x22')]('%s\x20configuration\x20#%s\x20not\x20found',_0x23080e[_0xa496('0x10')]['toLowerCase'](),_0x23080e['data3']));}}else{_0xe4a415=require(_0xa496('0x1f'))(_0x23080e[_0xa496('0x10')][_0xa496('0x11')]());_0xe4a415[_0xa496('0x20')](_0xa496('0x21'),util[_0xa496('0x22')]('%s\x20account\x20#%s\x20not\x20found',_0x23080e[_0xa496('0x10')][_0xa496('0x11')](),_0x23080e['data2']));}}else{}}catch(_0x2cefd4){console[_0xa496('0x20')](_0x2cefd4);}}}}; \ No newline at end of file +var _0x8e3d=['Configurations','queue','routeId','outbound','log','unmanaged','salesforce','desk','unknown\x20integration','../../../../config/logger','data3','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','vtiger','dynamics365','servicenow','exec','includes','data1','toLowerCase','data2'];(function(_0x51cd87,_0x23266a){var _0x3631a6=function(_0x37d4f0){while(--_0x37d4f0){_0x51cd87['push'](_0x51cd87['shift']());}};_0x3631a6(++_0x23266a);}(_0x8e3d,0x179));var _0xd8e3=function(_0x47edc1,_0x382cc4){_0x47edc1=_0x47edc1-0x0;var _0x4534c9=_0x8e3d[_0x47edc1];return _0x4534c9;};'use strict';var _=require(_0xd8e3('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0xd8e3('0x1'));var sugarcrm=require(_0xd8e3('0x2'));var freshdesk=require(_0xd8e3('0x3'));var zoho=require('./zoho');var desk=require(_0xd8e3('0x4'));var vtiger=require(_0xd8e3('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0xd8e3('0x6'));var freshsales=require(_0xd8e3('0x7'));var integrations=[_0xd8e3('0x8'),'salesforce',_0xd8e3('0x9'),_0xd8e3('0xa'),'zoho','desk',_0xd8e3('0xb'),_0xd8e3('0xc'),'freshsales',_0xd8e3('0xd')];exports[_0xd8e3('0xe')]=function(_0x576ede,_0x27926a,_0x19df5e,_0x495264,_0x3197e1,_0x1f29e5){if(_0x19df5e){if(_[_0xd8e3('0xf')](integrations,_0x576ede[_0xd8e3('0x10')]['toLowerCase']())){try{var _0x4b797b=null;var _0x2f9c46='';var _0x43431f=_0x19df5e[_0x576ede['data1'][_0xd8e3('0x11')]()];if(_0x43431f){var _0x287fb0=_0x43431f[_0x576ede[_0xd8e3('0x12')]];if(_0x287fb0){var _0x2ddb05=_['find'](_0x287fb0[_0xd8e3('0x13')],{'id':parseInt(_0x576ede['data3'],0xa)});if(_0x2ddb05){if(_0x495264){if(_0x3197e1&&_0x27926a[_0xd8e3('0x14')]){_0x2f9c46=_0xd8e3('0x14');}else if(_0x27926a[_0xd8e3('0x15')]){_0x2f9c46=_0xd8e3('0x16');}else{console[_0xd8e3('0x17')]('EVENT\x20UNKNOWN',_0x27926a);}}else{_0x2f9c46=_0xd8e3('0x18');}switch(_0x576ede['data1']['toLowerCase']()){case _0xd8e3('0x8'):zendesk[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case _0xd8e3('0x19'):salesforce[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case'sugarcrm':sugarcrm[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case _0xd8e3('0xa'):freshdesk[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case'zoho':zoho[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case _0xd8e3('0x1a'):desk[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case _0xd8e3('0xb'):vtiger[_0x2f9c46](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5);break;case'freshsales':freshsales['cs'](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5,_0x2f9c46);break;case _0xd8e3('0xd'):servicenow['cs'](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5,_0x2f9c46);break;case _0xd8e3('0xc'):dynamics365['cs'](_0x576ede,_0x27926a,_0x2ddb05,_0x495264,_0x3197e1,_0x287fb0,_0x1f29e5,_0x2f9c46);break;default:console[_0xd8e3('0x17')](_0xd8e3('0x1b'));}}else{_0x4b797b=require(_0xd8e3('0x1c'))(_0x576ede[_0xd8e3('0x10')]['toLowerCase']());_0x4b797b['error']('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x576ede[_0xd8e3('0x10')][_0xd8e3('0x11')](),_0x576ede[_0xd8e3('0x1d')]));}}else{_0x4b797b=require('../../../../config/logger')(_0x576ede['data1'][_0xd8e3('0x11')]());_0x4b797b[_0xd8e3('0x1e')]('[EXEC]',util[_0xd8e3('0x1f')](_0xd8e3('0x20'),_0x576ede[_0xd8e3('0x10')][_0xd8e3('0x11')](),_0x576ede['data2']));}}else{}}catch(_0xa1cb2b){console['error'](_0xa1cb2b);}}}}; \ 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 78407ca..6ba40ee 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 _0xe341=['WhatId','Case','lead','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','execute','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','additionalSearchLead','$or','Lead','additionalSearchAccount','Account','contact','first','Name','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','picklist','idField','content','variableName','toString','Variable','name','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','username','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','integrationTab','user:%s','trigger:salesforce:display','newTab','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:browser:url','monitor_format','lastevent','toUpperCase','isNil','calleridname',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','request-promise','moment','md5','jsforce','util','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','WhoId','account'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe341,0x1cc));var _0x1e34=function(_0x16e434,_0x4be7fc){_0x16e434=_0x16e434-0x0;var _0x3de10a=_0xe341[_0x16e434];return _0x3de10a;};'use strict';var _=require(_0x1e34('0x0'));var rp=require(_0x1e34('0x1'));var moment=require(_0x1e34('0x2'));var BPromise=require('bluebird');var md5=require(_0x1e34('0x3'));var jsforce=require(_0x1e34('0x4'));var util=require(_0x1e34('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x1e34('0x6'))(_0x1e34('0x7'));config[_0x1e34('0x8')]=_[_0x1e34('0x9')](config[_0x1e34('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x1e34('0xa'))(new Redis(config[_0x1e34('0x8')]));function emit(_0xe28229,_0x33df04,_0x2ce0e2){io['to'](_0xe28229)[_0x1e34('0xb')](_0x33df04,_0x2ce0e2);}function getTicket(_0x245def,_0x317eb9,_0x29e014,_0x39640a,_0x5a4de2,_0x5df275,_0x4d4df3,_0x19cd58){var _0x4858b0=Object[_0x1e34('0xc')]({},{'OwnerId':_0x317eb9['id'],'Subject':intUtil[_0x1e34('0xd')](_0x39640a[_0x1e34('0xe')],_0x5a4de2,'\x20'),'Description':intUtil[_0x1e34('0xd')](_0x39640a[_0x1e34('0xf')],_0x5a4de2,'\x0a')},getCustomFields(_0x5df275,_0x5a4de2));if(_0x29e014){if(_0x39640a[_0x1e34('0x10')]===_0x1e34('0x11')){_0x4858b0[_0x1e34('0x12')]=moment['utc']();_0x4858b0[_0x1e34('0x13')]=![];_0x4858b0[_0x1e34('0x14')]=![];if(_0x29e014[_0x1e34('0x15')]==='contact'||_0x29e014[_0x1e34('0x15')]==='lead'){_0x4858b0[_0x1e34('0x16')]=_0x29e014['id'];}else if(_0x29e014[_0x1e34('0x15')]===_0x1e34('0x17')){_0x4858b0[_0x1e34('0x18')]=_0x29e014['id'];}}else if(_0x39640a['ticketType']===_0x1e34('0x19')){if(_0x29e014[_0x1e34('0x15')]==='contact'){_0x4858b0['ContactId']=_0x29e014['id'];}else if(_0x29e014[_0x1e34('0x15')]===_0x1e34('0x17')){_0x4858b0['AccountId']=_0x29e014['id'];}else if(_0x29e014['endUserType']===_0x1e34('0x1a')&&_0x39640a[_0x1e34('0x1b')]){_0x4858b0[_0x39640a[_0x1e34('0x1b')]]=_0x29e014['id'];}else{logger['info'](_0x1e34('0x1c'));}}}return _0x4d4df3[_0x1e34('0x1d')](_0x39640a[_0x1e34('0x10')])['create'](_0x4858b0);}function getUser(_0x5daebc,_0x35db43,_0x56f6e2){if(!_['isNil'](_0x35db43)&&intUtil[_0x1e34('0x1e')](_0x35db43)){var _0x59c6b1={'Email':_0x35db43};var _0x2bce1b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x56f6e2[_0x1e34('0x1d')](_0x1e34('0x1f'))['find'](_0x59c6b1,_0x2bce1b)[_0x1e34('0x20')]()[_0x1e34('0x21')](function(_0x542366){if(_0x542366[_0x1e34('0x22')]){var _0x11ab89=_[_0x1e34('0x23')](_0x542366,function(_0x3165c1){return _0x3165c1[_0x1e34('0x24')]===_0x35db43;});if(_0x11ab89){logger[_0x1e34('0x25')](_0x1e34('0x26'),_0x35db43);return BPromise[_0x1e34('0x27')]({'id':_0x11ab89['Id'],'name':_0x11ab89['Name']});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x35db43);return _0x56f6e2[_0x1e34('0x28')]()[_0x1e34('0x21')](function(_0x1baab4){return BPromise[_0x1e34('0x27')]({'id':_0x1baab4[_0x1e34('0x29')],'name':_0x1baab4[_0x1e34('0x2a')]});});}});}else{logger[_0x1e34('0x25')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x35db43);return _0x56f6e2[_0x1e34('0x28')]()[_0x1e34('0x21')](function(_0x5f106c){return BPromise[_0x1e34('0x27')]({'id':_0x5f106c[_0x1e34('0x29')],'name':_0x5f106c[_0x1e34('0x2a')]});});}}function getEndUser(_0x342702,_0xec835b,_0x272818,_0x261a9c,_0x411286){var _0x1ec6e5={'$or':{'Phone':_0x261a9c}};var _0x53a37e={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x1e34('0x27')]()[_0x1e34('0x21')](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x261a9c,_0xec835b[_0x1e34('0x2b')]);switch(_0xec835b[_0x1e34('0x2b')]){case _0x1e34('0x2c'):var _0x3c01e6=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x2e')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b['additionalSearchContact']]=_0x261a9c;_[_0x1e34('0x2f')](_0x3c01e6['$or'],_0xd6a1ad);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x30'))[_0x1e34('0x23')](_0x3c01e6,_0x53a37e)[_0x1e34('0x20')]()['then'](function(_0x347ce6){if(_0x347ce6&&_0x347ce6[_0x1e34('0x22')]){return _0x347ce6;}else{var _0xad54ae=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x31')]){var _0x1b34c9={};_0x1b34c9[_0xec835b['additionalSearchLead']]=_0x261a9c;_[_0x1e34('0x2f')](_0xad54ae[_0x1e34('0x32')],_0x1b34c9);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x33'))['find'](_0xad54ae,_0x53a37e);}});case'account_contact_lead':var _0x4d91e3=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x34')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x34')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4d91e3[_0x1e34('0x32')],_0xd6a1ad);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x35'))[_0x1e34('0x23')](_0x4d91e3,_0x53a37e)[_0x1e34('0x20')]()[_0x1e34('0x21')](function(_0x1c3c12){if(_0x1c3c12&&_0x1c3c12[_0x1e34('0x22')]){return _0x1c3c12;}else{var _0x5acc79=_['cloneDeep'](_0x1ec6e5);if(_0xec835b[_0x1e34('0x2e')]){var _0x12505b={};_0x12505b[_0xec835b[_0x1e34('0x2e')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x5acc79[_0x1e34('0x32')],_0x12505b);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x30'))['find'](_0x5acc79,_0x53a37e)['then'](function(_0xfd204c){if(_0xfd204c&&_0xfd204c[_0x1e34('0x22')]){return _0xfd204c;}else{var _0x34af29=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x31')]){var _0x4bc508={};_0x4bc508[_0xec835b[_0x1e34('0x31')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x34af29['$or'],_0x4bc508);}return _0x411286[_0x1e34('0x1d')](_0x1e34('0x33'))['find'](_0x34af29,_0x53a37e);}});}});case _0x1e34('0x36'):var _0x3c01e6=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b['additionalSearchContact']){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x2e')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x3c01e6['$or'],_0xd6a1ad);}return _0x411286['sobject'](_0x1e34('0x30'))['find'](_0x3c01e6,_0x53a37e)[_0x1e34('0x20')]();case _0x1e34('0x1a'):var _0x4ec02c=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b['additionalSearchLead']){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x31')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4ec02c['$or'],_0xd6a1ad);}return _0x411286['sobject']('Lead')[_0x1e34('0x23')](_0x4ec02c,_0x53a37e);case'account':var _0x4d91e3=_[_0x1e34('0x2d')](_0x1ec6e5);if(_0xec835b[_0x1e34('0x34')]){var _0xd6a1ad={};_0xd6a1ad[_0xec835b[_0x1e34('0x34')]]=_0x261a9c;_[_0x1e34('0x2f')](_0x4d91e3[_0x1e34('0x32')],_0xd6a1ad);}return _0x411286['sobject'](_0x1e34('0x35'))['find'](_0x4d91e3,_0x53a37e);default:return null;}})[_0x1e34('0x21')](function(_0x2a8b4f){if(_0x2a8b4f&&_0x2a8b4f[_0x1e34('0x22')]){var _0x383134=_[_0x1e34('0x37')](_0x2a8b4f);if(_0x383134){return BPromise[_0x1e34('0x27')]({'id':_0x383134['Id'],'name':_0x383134[_0x1e34('0x38')],'phone':_0x383134['Phone'],'endUserType':_0x383134['attributes'][_0x1e34('0x39')][_0x1e34('0x3a')]()});}}})[_0x1e34('0x21')](function(_0x1afc00){if(_0x1afc00){logger[_0x1e34('0x25')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1afc00[_0x1e34('0x15')],_0x261a9c);return BPromise[_0x1e34('0x27')](_0x1afc00);}else{logger['info'](_0x1e34('0x3b'),_0x261a9c);var _0x4579c8={'Phone':_0x261a9c};if(_0xec835b['moduleCreate']){if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x36')){logger['info'](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8[_0x1e34('0x3e')]=_0x272818!==_0x1e34('0x3f')?_0x272818:util[_0x1e34('0x40')](_0x1e34('0x41'),_0x261a9c);}else if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x1a')){logger[_0x1e34('0x25')](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8['LastName']=_0x272818!==_0x1e34('0x3f')?_0x272818:util[_0x1e34('0x40')](_0x1e34('0x41'),_0x261a9c);_0x4579c8[_0x1e34('0x42')]=_0x1e34('0x43');}else if(_0xec835b[_0x1e34('0x3c')]===_0x1e34('0x17')){logger['info'](_0x1e34('0x3d'),_0x261a9c,_0xec835b[_0x1e34('0x3c')]);_0x4579c8[_0x1e34('0x38')]=_0x272818!==_0x1e34('0x3f')?_0x272818:util['format']('Caller\x20-\x20%s',_0x261a9c);}else{return null;}}return _0x411286[_0x1e34('0x1d')](_[_0x1e34('0x44')](_0xec835b[_0x1e34('0x3c')]))['create'](_0x4579c8)[_0x1e34('0x21')](function(_0x5f3a2b){return BPromise[_0x1e34('0x27')]({'id':_0x5f3a2b['id'],'endUserType':_0xec835b['moduleCreate']});});}});}function getCustomFields(_0x4e30a4,_0x218350){var _0x26d612={};if(_0x4e30a4[_0x1e34('0x22')]>0x0){_[_0x1e34('0x45')](_0x4e30a4,function(_0x429f70){if(_[_0x1e34('0x46')](['string',_0x1e34('0x47')],_0x429f70[_0x1e34('0x39')])&&_0x429f70['idField']){_0x26d612[_0x429f70[_0x1e34('0x48')]]=_0x429f70[_0x1e34('0x49')]['toString']();}else if(_0x429f70[_0x1e34('0x39')]==='variable'&&_0x429f70[_0x1e34('0x4a')]&&_0x429f70[_0x1e34('0x48')]){_0x218350[_0x429f70[_0x1e34('0x4a')]]&&(_0x26d612[_0x429f70[_0x1e34('0x48')]]=_0x218350[_0x429f70[_0x1e34('0x4a')]][_0x1e34('0x4b')]());}else if(_0x429f70[_0x1e34('0x39')]==='customVariable'&&_0x429f70['Variable']&&_0x429f70[_0x1e34('0x4c')][_0x1e34('0x4d')]&&_0x429f70[_0x1e34('0x48')]){_0x218350[_0x429f70['Variable'][_0x1e34('0x4d')]['toLowerCase']()]&&(_0x26d612[_0x429f70['idField']]=_0x218350[_0x429f70[_0x1e34('0x4c')][_0x1e34('0x4d')]['toLowerCase']()][_0x1e34('0x4b')]());}});}return _0x26d612;}function getConnection(_0x888e4f){var _0x21220c=_0x888e4f[_0x1e34('0x4e')]['concat'](_0x888e4f[_0x1e34('0x4f')]);var _0x58b95f=new jsforce[(_0x1e34('0x50'))]({'oauth2':{'loginUrl':_0x888e4f[_0x1e34('0x51')]||_0x1e34('0x52'),'clientId':_0x888e4f[_0x1e34('0x53')],'clientSecret':_0x888e4f['clientSecret']}});return _0x58b95f[_0x1e34('0x54')](_0x888e4f[_0x1e34('0x55')],_0x21220c)[_0x1e34('0x21')](function(){logger[_0x1e34('0x25')]('Connection\x20established.');return _0x58b95f;});}exports['queue']=function(_0x30ceb7,_0x4ccfff,_0x20f349,_0x3172ce,_0xa0f0c5,_0xf8f3cd){var _0x457097,_0x168a87,_0x4a5a30,_0x55970a;_0xf8f3cd[_0x1e34('0x56')]=intUtil['stripTrailingSlash'](_0xf8f3cd['serverUrl']);_0xf8f3cd[_0x1e34('0x51')]=intUtil[_0x1e34('0x57')](_0xf8f3cd[_0x1e34('0x51')]);if(_0xa0f0c5&&_0xa0f0c5['monitor_format']){logger[_0x1e34('0x25')](_0x1e34('0x58'),_0x1e34('0x59'));_0x4ccfff[_0x1e34('0x5a')]=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0xf8f3cd[_0x1e34('0x56')],_0x4ccfff[_0x1e34('0x5c')],md5(_0x4ccfff[_0x1e34('0x5c')]));}else{_0x4ccfff[_0x1e34('0x5a')]='';}return getConnection(_0xf8f3cd)[_0x1e34('0x21')](function(_0x38e148){_0x55970a=_0x38e148;return getUser(_0xf8f3cd,_0x3172ce[_0x1e34('0x5d')],_0x55970a);})['then'](function(_0x56d8df){_0x457097=_0x56d8df;return getEndUser(_0xf8f3cd,_0x20f349,_0x4ccfff['calleridname'],_0x4ccfff[_0x1e34('0x5e')],_0x55970a);})[_0x1e34('0x21')](function(_0x127f9a){_0x168a87=_0x127f9a;return getTicket(_0xf8f3cd,_0x457097,_0x168a87,_0x20f349,_0x4ccfff,_0x20f349[_0x1e34('0x5f')],_0x55970a,_0x1e34('0x60'));})[_0x1e34('0x21')](function(_0x2f34df){_0x4a5a30=_0x2f34df;logger[_0x1e34('0x25')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x4a5a30['id']);logger[_0x1e34('0x25')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4a5a30['id'],_0x3172ce[_0x1e34('0x4d')],_0xf8f3cd[_0x1e34('0x39')]);switch(_0xf8f3cd[_0x1e34('0x39')]){case _0x1e34('0x61'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x3172ce['name']),_0x1e34('0x63'),{'recordId':_0x4a5a30['id']});break;case _0x1e34('0x64'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x3172ce[_0x1e34('0x4d')]),'trigger:browser:url',{'uri':util[_0x1e34('0x40')](_0x1e34('0x65'),_0x55970a[_0x1e34('0x66')],_0x4a5a30['id'])});break;default:logger['error'](_0x1e34('0x67'));}})['catch'](function(_0x35e396){logger[_0x1e34('0x68')](_0x1e34('0x58'),_0x35e396);});};exports[_0x1e34('0x69')]=function(_0x51d23c,_0x4dc6d3,_0x4b6132,_0x11de7c,_0xb0be22,_0x35ed00,_0x2e602f){var _0x36003a,_0xd4150a,_0x2094e6,_0x1afc3c;_0x35ed00[_0x1e34('0x56')]=intUtil['stripTrailingSlash'](_0x35ed00[_0x1e34('0x56')]);_0x35ed00[_0x1e34('0x51')]=intUtil[_0x1e34('0x57')](_0x35ed00[_0x1e34('0x51')]);if(_0x2e602f&&_0x2e602f[_0x1e34('0x6a')]&&_0x2e602f[_0x1e34('0x6a')]!==_0x1e34('0x6b')){logger['info'](_0x1e34('0x6c'),'Recording\x20is\x20enabled!');_0x4dc6d3[_0x1e34('0x5a')]=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0x35ed00[_0x1e34('0x56')],_0x4dc6d3['uniqueid'],md5(_0x4dc6d3[_0x1e34('0x5c')]));}return getConnection(_0x35ed00)[_0x1e34('0x21')](function(_0x1c655e){_0x1afc3c=_0x1c655e;return getUser(_0x35ed00,_0x11de7c['email'],_0x1afc3c);})['then'](function(_0x19ded8){_0x36003a=_0x19ded8;return getEndUser(_0x35ed00,_0x4b6132,_0x4dc6d3['destcalleridname'],_0x4dc6d3[_0x1e34('0x6d')],_0x1afc3c);})[_0x1e34('0x21')](function(_0x2563b0){_0xd4150a=_0x2563b0;return getTicket(_0x35ed00,_0x36003a,_0xd4150a,_0x4b6132,_0x4dc6d3,_0x4b6132[_0x1e34('0x5f')],_0x1afc3c,'outbound');})[_0x1e34('0x21')](function(_0x515fec){_0x2094e6=_0x515fec;logger[_0x1e34('0x25')](_0x1e34('0x6e'),_0x2094e6['id']);logger['info'](_0x1e34('0x6f'),_0x2094e6['id'],_0x11de7c[_0x1e34('0x4d')],_0x35ed00[_0x1e34('0x39')]);switch(_0x35ed00[_0x1e34('0x39')]){case _0x1e34('0x61'):emit(util[_0x1e34('0x40')](_0x1e34('0x62'),_0x11de7c[_0x1e34('0x4d')]),_0x1e34('0x63'),{'recordId':_0x2094e6['id']});break;case _0x1e34('0x64'):emit(util[_0x1e34('0x40')]('user:%s',_0x11de7c[_0x1e34('0x4d')]),_0x1e34('0x70'),{'uri':util['format']('%s/%s/e',_0x1afc3c[_0x1e34('0x66')],_0x2094e6['id'])});break;default:logger[_0x1e34('0x68')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x22c353){logger[_0x1e34('0x68')](_0x1e34('0x6c'),_0x22c353);});};exports['unmanaged']=function(_0x5ce297,_0x6f7e41,_0x486fdc,_0x91d3d6,_0x5f5a64,_0x31449e){var _0x12deee,_0x534a28,_0x5e2860,_0x2dfab1;_0x31449e['serverUrl']=intUtil['stripTrailingSlash'](_0x31449e[_0x1e34('0x56')]);_0x31449e['remoteUri']=intUtil[_0x1e34('0x57')](_0x31449e[_0x1e34('0x51')]);if(_0x5f5a64&&_0x5f5a64[_0x1e34('0x71')]){logger['info']('['+_0x6f7e41[_0x1e34('0x72')][_0x1e34('0x73')]()+']',_0x1e34('0x59'));_0x6f7e41['recordingURL']=util[_0x1e34('0x40')](_0x1e34('0x5b'),_0x31449e['serverUrl'],_0x6f7e41[_0x1e34('0x5c')],md5(_0x6f7e41[_0x1e34('0x5c')]));}else{_0x6f7e41[_0x1e34('0x5a')]='';}return getConnection(_0x31449e)[_0x1e34('0x21')](function(_0x290c52){_0x2dfab1=_0x290c52;if(!_[_0x1e34('0x74')](_0x91d3d6)){return getUser(_0x31449e,_0x91d3d6[_0x1e34('0x4d')],_0x2dfab1);}else{return getUser(_0x31449e,null,_0x2dfab1);}})[_0x1e34('0x21')](function(_0x29614f){_0x12deee=_0x29614f;return getEndUser(_0x31449e,_0x486fdc,_0x6f7e41[_0x1e34('0x75')],_0x6f7e41[_0x1e34('0x5e')],_0x2dfab1);})['then'](function(_0x132468){_0x534a28=_0x132468;return getTicket(_0x31449e,_0x12deee,_0x534a28,_0x486fdc,_0x6f7e41,_0x486fdc[_0x1e34('0x5f')],_0x2dfab1);})[_0x1e34('0x21')](function(_0xe20e45){_0x5e2860=_0xe20e45;logger['info']('['+_0x6f7e41[_0x1e34('0x72')][_0x1e34('0x73')]()+_0x1e34('0x76'),_0x5e2860['id']);logger[_0x1e34('0x25')]('['+_0x6f7e41['lastevent'][_0x1e34('0x73')]()+_0x1e34('0x77'),_0x31449e[_0x1e34('0x39')]);})[_0x1e34('0x78')](function(_0x1f7446){logger['error']('['+_0x6f7e41[_0x1e34('0x72')]['toUpperCase']()+']',_0x1f7446);});}; \ No newline at end of file +var _0xd2b5=['cloneDeep','additionalSearchContact','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','first','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','create','forEach','includes','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','monitor_format','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','getString','Descriptions','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','WhatId','Case','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','execute','then','length','find','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead'];(function(_0x533170,_0x339172){var _0x186505=function(_0x401cfa){while(--_0x401cfa){_0x533170['push'](_0x533170['shift']());}};_0x186505(++_0x339172);}(_0xd2b5,0x1d8));var _0x5d2b=function(_0x3e52dd,_0x1b9a64){_0x3e52dd=_0x3e52dd-0x0;var _0x54668d=_0xd2b5[_0x3e52dd];return _0x54668d;};'use strict';var _=require('lodash');var rp=require(_0x5d2b('0x0'));var moment=require(_0x5d2b('0x1'));var BPromise=require(_0x5d2b('0x2'));var md5=require(_0x5d2b('0x3'));var jsforce=require(_0x5d2b('0x4'));var util=require(_0x5d2b('0x5'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x5d2b('0x6'));var logger=require(_0x5d2b('0x7'))(_0x5d2b('0x8'));config[_0x5d2b('0x9')]=_[_0x5d2b('0xa')](config[_0x5d2b('0x9')],{'host':_0x5d2b('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5d2b('0x9')]));function emit(_0xa23ddc,_0x99422e,_0x7a5133){io['to'](_0xa23ddc)['emit'](_0x99422e,_0x7a5133);}function getTicket(_0x390d9a,_0x325251,_0x4f1906,_0x34a9be,_0x12e93e,_0x3e66d4,_0x260488,_0xabe555){var _0x2eee4c=Object[_0x5d2b('0xc')]({},{'OwnerId':_0x325251['id'],'Subject':intUtil['getString'](_0x34a9be['Subjects'],_0x12e93e,'\x20'),'Description':intUtil[_0x5d2b('0xd')](_0x34a9be[_0x5d2b('0xe')],_0x12e93e,'\x0a')},getCustomFields(_0x3e66d4,_0x12e93e));if(_0x4f1906){if(_0x34a9be[_0x5d2b('0xf')]===_0x5d2b('0x10')){_0x2eee4c['ActivityDate']=moment[_0x5d2b('0x11')]();_0x2eee4c[_0x5d2b('0x12')]=![];_0x2eee4c[_0x5d2b('0x13')]=![];if(_0x4f1906[_0x5d2b('0x14')]===_0x5d2b('0x15')||_0x4f1906[_0x5d2b('0x14')]===_0x5d2b('0x16')){_0x2eee4c[_0x5d2b('0x17')]=_0x4f1906['id'];}else if(_0x4f1906[_0x5d2b('0x14')]==='account'){_0x2eee4c[_0x5d2b('0x18')]=_0x4f1906['id'];}}else if(_0x34a9be[_0x5d2b('0xf')]===_0x5d2b('0x19')){if(_0x4f1906['endUserType']==='contact'){_0x2eee4c['ContactId']=_0x4f1906['id'];}else if(_0x4f1906['endUserType']===_0x5d2b('0x1a')){_0x2eee4c[_0x5d2b('0x1b')]=_0x4f1906['id'];}else if(_0x4f1906[_0x5d2b('0x14')]==='lead'&&_0x34a9be[_0x5d2b('0x1c')]){_0x2eee4c[_0x34a9be[_0x5d2b('0x1c')]]=_0x4f1906['id'];}else{logger['info'](_0x5d2b('0x1d'));}}}return _0x260488[_0x5d2b('0x1e')](_0x34a9be[_0x5d2b('0xf')])['create'](_0x2eee4c);}function getUser(_0x106ecc,_0x40f10b,_0x1f7761){if(!_[_0x5d2b('0x1f')](_0x40f10b)&&intUtil[_0x5d2b('0x20')](_0x40f10b)){var _0x5b1b4c={'Email':_0x40f10b};var _0x36ecf4={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1f7761['sobject']('User')['find'](_0x5b1b4c,_0x36ecf4)[_0x5d2b('0x21')]()[_0x5d2b('0x22')](function(_0x8d9c11){if(_0x8d9c11[_0x5d2b('0x23')]){var _0x1c56eb=_[_0x5d2b('0x24')](_0x8d9c11,function(_0x151f96){return _0x151f96[_0x5d2b('0x25')]===_0x40f10b;});if(_0x1c56eb){logger[_0x5d2b('0x26')](_0x5d2b('0x27'),_0x40f10b);return BPromise[_0x5d2b('0x28')]({'id':_0x1c56eb['Id'],'name':_0x1c56eb[_0x5d2b('0x29')]});}}else{logger[_0x5d2b('0x26')](_0x5d2b('0x2a'),_0x40f10b);return _0x1f7761['identity']()['then'](function(_0x560b3a){return BPromise[_0x5d2b('0x28')]({'id':_0x560b3a[_0x5d2b('0x2b')],'name':_0x560b3a[_0x5d2b('0x2c')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x40f10b);return _0x1f7761['identity']()[_0x5d2b('0x22')](function(_0x4f1776){return BPromise['resolve']({'id':_0x4f1776[_0x5d2b('0x2b')],'name':_0x4f1776['display_name']});});}}function getEndUser(_0x203327,_0x3e0c47,_0x135b87,_0x311f34,_0x360571){var _0x27e426={'$or':{'Phone':_0x311f34}};var _0xb0dcab={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5d2b('0x28')]()[_0x5d2b('0x22')](function(){logger['info'](_0x5d2b('0x2d'),_0x311f34,_0x3e0c47[_0x5d2b('0x2e')]);switch(_0x3e0c47[_0x5d2b('0x2e')]){case _0x5d2b('0x2f'):var _0x230fb4=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x31')]){var _0x40b2ae={};_0x40b2ae[_0x3e0c47[_0x5d2b('0x31')]]=_0x311f34;_['merge'](_0x230fb4[_0x5d2b('0x32')],_0x40b2ae);}return _0x360571[_0x5d2b('0x1e')](_0x5d2b('0x33'))[_0x5d2b('0x24')](_0x230fb4,_0xb0dcab)[_0x5d2b('0x21')]()[_0x5d2b('0x22')](function(_0x588d57){if(_0x588d57&&_0x588d57[_0x5d2b('0x23')]){return _0x588d57;}else{var _0xcb8b45=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x34')]){var _0x430531={};_0x430531[_0x3e0c47[_0x5d2b('0x34')]]=_0x311f34;_['merge'](_0xcb8b45[_0x5d2b('0x32')],_0x430531);}return _0x360571['sobject'](_0x5d2b('0x35'))[_0x5d2b('0x24')](_0xcb8b45,_0xb0dcab);}});case _0x5d2b('0x36'):var _0x1bedef=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x37')]){var _0x40b2ae={};_0x40b2ae[_0x3e0c47['additionalSearchAccount']]=_0x311f34;_[_0x5d2b('0x38')](_0x1bedef[_0x5d2b('0x32')],_0x40b2ae);}return _0x360571[_0x5d2b('0x1e')]('Account')[_0x5d2b('0x24')](_0x1bedef,_0xb0dcab)[_0x5d2b('0x21')]()[_0x5d2b('0x22')](function(_0xfc5c3c){if(_0xfc5c3c&&_0xfc5c3c[_0x5d2b('0x23')]){return _0xfc5c3c;}else{var _0x16d46e=_['cloneDeep'](_0x27e426);if(_0x3e0c47['additionalSearchContact']){var _0x3c6f79={};_0x3c6f79[_0x3e0c47[_0x5d2b('0x31')]]=_0x311f34;_[_0x5d2b('0x38')](_0x16d46e[_0x5d2b('0x32')],_0x3c6f79);}return _0x360571['sobject'](_0x5d2b('0x33'))[_0x5d2b('0x24')](_0x16d46e,_0xb0dcab)[_0x5d2b('0x22')](function(_0x1bde21){if(_0x1bde21&&_0x1bde21[_0x5d2b('0x23')]){return _0x1bde21;}else{var _0x5de21c=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x34')]){var _0x495ff7={};_0x495ff7[_0x3e0c47['additionalSearchLead']]=_0x311f34;_[_0x5d2b('0x38')](_0x5de21c['$or'],_0x495ff7);}return _0x360571[_0x5d2b('0x1e')](_0x5d2b('0x35'))[_0x5d2b('0x24')](_0x5de21c,_0xb0dcab);}});}});case _0x5d2b('0x15'):var _0x230fb4=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x31')]){var _0x40b2ae={};_0x40b2ae[_0x3e0c47[_0x5d2b('0x31')]]=_0x311f34;_[_0x5d2b('0x38')](_0x230fb4[_0x5d2b('0x32')],_0x40b2ae);}return _0x360571[_0x5d2b('0x1e')](_0x5d2b('0x33'))[_0x5d2b('0x24')](_0x230fb4,_0xb0dcab)[_0x5d2b('0x21')]();case _0x5d2b('0x16'):var _0x1da3c4=_['cloneDeep'](_0x27e426);if(_0x3e0c47['additionalSearchLead']){var _0x40b2ae={};_0x40b2ae[_0x3e0c47[_0x5d2b('0x34')]]=_0x311f34;_['merge'](_0x1da3c4['$or'],_0x40b2ae);}return _0x360571[_0x5d2b('0x1e')](_0x5d2b('0x35'))[_0x5d2b('0x24')](_0x1da3c4,_0xb0dcab);case'account':var _0x1bedef=_[_0x5d2b('0x30')](_0x27e426);if(_0x3e0c47[_0x5d2b('0x37')]){var _0x40b2ae={};_0x40b2ae[_0x3e0c47['additionalSearchAccount']]=_0x311f34;_['merge'](_0x1bedef[_0x5d2b('0x32')],_0x40b2ae);}return _0x360571[_0x5d2b('0x1e')](_0x5d2b('0x39'))[_0x5d2b('0x24')](_0x1bedef,_0xb0dcab);default:return null;}})[_0x5d2b('0x22')](function(_0x35c43a){if(_0x35c43a&&_0x35c43a[_0x5d2b('0x23')]){var _0x1f74bb=_[_0x5d2b('0x3a')](_0x35c43a);if(_0x1f74bb){return BPromise[_0x5d2b('0x28')]({'id':_0x1f74bb['Id'],'name':_0x1f74bb[_0x5d2b('0x29')],'phone':_0x1f74bb[_0x5d2b('0x3b')],'endUserType':_0x1f74bb[_0x5d2b('0x3c')]['type']['toLowerCase']()});}}})[_0x5d2b('0x22')](function(_0x2c1581){if(_0x2c1581){logger['info'](_0x5d2b('0x3d'),_0x2c1581[_0x5d2b('0x14')],_0x311f34);return BPromise['resolve'](_0x2c1581);}else{logger[_0x5d2b('0x26')](_0x5d2b('0x3e'),_0x311f34);var _0x2552d6={'Phone':_0x311f34};if(_0x3e0c47[_0x5d2b('0x3f')]){if(_0x3e0c47['moduleCreate']===_0x5d2b('0x15')){logger[_0x5d2b('0x26')](_0x5d2b('0x40'),_0x311f34,_0x3e0c47[_0x5d2b('0x3f')]);_0x2552d6[_0x5d2b('0x41')]=_0x135b87!==_0x5d2b('0x42')?_0x135b87:util[_0x5d2b('0x43')](_0x5d2b('0x44'),_0x311f34);}else if(_0x3e0c47[_0x5d2b('0x3f')]===_0x5d2b('0x16')){logger[_0x5d2b('0x26')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x311f34,_0x3e0c47[_0x5d2b('0x3f')]);_0x2552d6[_0x5d2b('0x41')]=_0x135b87!==_0x5d2b('0x42')?_0x135b87:util[_0x5d2b('0x43')](_0x5d2b('0x44'),_0x311f34);_0x2552d6['Company']=_0x5d2b('0x45');}else if(_0x3e0c47[_0x5d2b('0x3f')]===_0x5d2b('0x1a')){logger[_0x5d2b('0x26')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x311f34,_0x3e0c47[_0x5d2b('0x3f')]);_0x2552d6[_0x5d2b('0x29')]=_0x135b87!==_0x5d2b('0x42')?_0x135b87:util[_0x5d2b('0x43')](_0x5d2b('0x44'),_0x311f34);}else{return null;}}return _0x360571[_0x5d2b('0x1e')](_[_0x5d2b('0x46')](_0x3e0c47[_0x5d2b('0x3f')]))[_0x5d2b('0x47')](_0x2552d6)[_0x5d2b('0x22')](function(_0x296379){return BPromise[_0x5d2b('0x28')]({'id':_0x296379['id'],'endUserType':_0x3e0c47['moduleCreate']});});}});}function getCustomFields(_0x4208ae,_0x3de65f){var _0x4a2a4d={};if(_0x4208ae[_0x5d2b('0x23')]>0x0){_[_0x5d2b('0x48')](_0x4208ae,function(_0x4cd3bd){if(_[_0x5d2b('0x49')](['string',_0x5d2b('0x4a')],_0x4cd3bd['type'])&&_0x4cd3bd['idField']){_0x4a2a4d[_0x4cd3bd[_0x5d2b('0x4b')]]=_0x4cd3bd[_0x5d2b('0x4c')]['toString']();}else if(_0x4cd3bd[_0x5d2b('0x4d')]===_0x5d2b('0x4e')&&_0x4cd3bd[_0x5d2b('0x4f')]&&_0x4cd3bd[_0x5d2b('0x4b')]){_0x3de65f[_0x4cd3bd[_0x5d2b('0x4f')]]&&(_0x4a2a4d[_0x4cd3bd['idField']]=_0x3de65f[_0x4cd3bd['variableName']][_0x5d2b('0x50')]());}else if(_0x4cd3bd['type']===_0x5d2b('0x51')&&_0x4cd3bd[_0x5d2b('0x52')]&&_0x4cd3bd[_0x5d2b('0x52')]['name']&&_0x4cd3bd[_0x5d2b('0x4b')]){_0x3de65f[_0x4cd3bd[_0x5d2b('0x52')][_0x5d2b('0x53')][_0x5d2b('0x54')]()]&&(_0x4a2a4d[_0x4cd3bd[_0x5d2b('0x4b')]]=_0x3de65f[_0x4cd3bd[_0x5d2b('0x52')]['name'][_0x5d2b('0x54')]()][_0x5d2b('0x50')]());}});}return _0x4a2a4d;}function getConnection(_0x5aca36){var _0x515788=_0x5aca36[_0x5d2b('0x55')][_0x5d2b('0x56')](_0x5aca36[_0x5d2b('0x57')]);var _0x376cac=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5aca36[_0x5d2b('0x58')]||_0x5d2b('0x59'),'clientId':_0x5aca36[_0x5d2b('0x5a')],'clientSecret':_0x5aca36[_0x5d2b('0x5b')]}});return _0x376cac[_0x5d2b('0x5c')](_0x5aca36[_0x5d2b('0x5d')],_0x515788)[_0x5d2b('0x22')](function(){logger['info'](_0x5d2b('0x5e'));return _0x376cac;});}exports[_0x5d2b('0x5f')]=function(_0x2320dd,_0x2f6ccb,_0x5c367f,_0x102531,_0x402b83,_0x215b00){var _0x594e03,_0x21ccfc,_0x158ecb,_0x4c3a09;_0x215b00[_0x5d2b('0x60')]=intUtil[_0x5d2b('0x61')](_0x215b00[_0x5d2b('0x60')]);_0x215b00[_0x5d2b('0x58')]=intUtil[_0x5d2b('0x61')](_0x215b00['remoteUri']);if(_0x402b83&&_0x402b83['monitor_format']){logger[_0x5d2b('0x26')](_0x5d2b('0x62'),'Recording\x20is\x20enabled!');_0x2f6ccb['recordingURL']=util[_0x5d2b('0x43')](_0x5d2b('0x63'),_0x215b00[_0x5d2b('0x60')],_0x2f6ccb['uniqueid'],md5(_0x2f6ccb['uniqueid']));}else{_0x2f6ccb[_0x5d2b('0x64')]='';}return getConnection(_0x215b00)[_0x5d2b('0x22')](function(_0xd64245){_0x4c3a09=_0xd64245;return getUser(_0x215b00,_0x102531[_0x5d2b('0x65')],_0x4c3a09);})['then'](function(_0x4ec8a3){_0x594e03=_0x4ec8a3;return getEndUser(_0x215b00,_0x5c367f,_0x2f6ccb['calleridname'],_0x2f6ccb[_0x5d2b('0x66')],_0x4c3a09);})[_0x5d2b('0x22')](function(_0x1e4d4a){_0x21ccfc=_0x1e4d4a;return getTicket(_0x215b00,_0x594e03,_0x21ccfc,_0x5c367f,_0x2f6ccb,_0x5c367f[_0x5d2b('0x67')],_0x4c3a09,_0x5d2b('0x5f'));})[_0x5d2b('0x22')](function(_0x4d9886){_0x158ecb=_0x4d9886;logger[_0x5d2b('0x26')](_0x5d2b('0x68'),_0x158ecb['id']);logger[_0x5d2b('0x26')](_0x5d2b('0x69'),_0x158ecb['id'],_0x102531[_0x5d2b('0x53')],_0x215b00['type']);switch(_0x215b00[_0x5d2b('0x4d')]){case _0x5d2b('0x6a'):emit(util[_0x5d2b('0x43')](_0x5d2b('0x6b'),_0x102531[_0x5d2b('0x53')]),_0x5d2b('0x6c'),{'recordId':_0x158ecb['id']});break;case _0x5d2b('0x6d'):emit(util['format'](_0x5d2b('0x6b'),_0x102531[_0x5d2b('0x53')]),_0x5d2b('0x6e'),{'uri':util['format'](_0x5d2b('0x6f'),_0x4c3a09[_0x5d2b('0x70')],_0x158ecb['id'])});break;default:logger[_0x5d2b('0x71')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x5d2b('0x72')](function(_0x10b3bf){logger['error'](_0x5d2b('0x62'),_0x10b3bf);});};exports[_0x5d2b('0x73')]=function(_0x443765,_0xa7107c,_0x3b8de8,_0x2c8f1c,_0x13f179,_0x1c9683,_0x111582){var _0xa1d171,_0x8e47fd,_0x1c9fb6,_0x3a556c;_0x1c9683[_0x5d2b('0x60')]=intUtil[_0x5d2b('0x61')](_0x1c9683[_0x5d2b('0x60')]);_0x1c9683[_0x5d2b('0x58')]=intUtil['stripTrailingSlash'](_0x1c9683[_0x5d2b('0x58')]);if(_0x111582&&_0x111582['recordingFormat']&&_0x111582[_0x5d2b('0x74')]!==_0x5d2b('0x75')){logger['info']('[OUTBOUND]',_0x5d2b('0x76'));_0xa7107c[_0x5d2b('0x64')]=util[_0x5d2b('0x43')](_0x5d2b('0x63'),_0x1c9683[_0x5d2b('0x60')],_0xa7107c[_0x5d2b('0x77')],md5(_0xa7107c['uniqueid']));}return getConnection(_0x1c9683)['then'](function(_0x42f1fb){_0x3a556c=_0x42f1fb;return getUser(_0x1c9683,_0x2c8f1c[_0x5d2b('0x65')],_0x3a556c);})[_0x5d2b('0x22')](function(_0x3d6400){_0xa1d171=_0x3d6400;return getEndUser(_0x1c9683,_0x3b8de8,_0xa7107c[_0x5d2b('0x78')],_0xa7107c[_0x5d2b('0x79')],_0x3a556c);})[_0x5d2b('0x22')](function(_0x2710a8){_0x8e47fd=_0x2710a8;return getTicket(_0x1c9683,_0xa1d171,_0x8e47fd,_0x3b8de8,_0xa7107c,_0x3b8de8[_0x5d2b('0x67')],_0x3a556c,'outbound');})[_0x5d2b('0x22')](function(_0x12fb2c){_0x1c9fb6=_0x12fb2c;logger[_0x5d2b('0x26')](_0x5d2b('0x7a'),_0x1c9fb6['id']);logger[_0x5d2b('0x26')](_0x5d2b('0x7b'),_0x1c9fb6['id'],_0x2c8f1c['name'],_0x1c9683[_0x5d2b('0x4d')]);switch(_0x1c9683['type']){case _0x5d2b('0x6a'):emit(util[_0x5d2b('0x43')](_0x5d2b('0x6b'),_0x2c8f1c[_0x5d2b('0x53')]),'trigger:salesforce:display',{'recordId':_0x1c9fb6['id']});break;case'newTab':emit(util[_0x5d2b('0x43')](_0x5d2b('0x6b'),_0x2c8f1c[_0x5d2b('0x53')]),_0x5d2b('0x6e'),{'uri':util[_0x5d2b('0x43')]('%s/%s/e',_0x3a556c[_0x5d2b('0x70')],_0x1c9fb6['id'])});break;default:logger[_0x5d2b('0x71')](_0x5d2b('0x7c'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x5d2b('0x72')](function(_0xe72f){logger[_0x5d2b('0x71')](_0x5d2b('0x7c'),_0xe72f);});};exports['unmanaged']=function(_0x5de999,_0x34d320,_0x4dbf12,_0x37c95c,_0x4d4563,_0xa38b7d){var _0x40907c,_0x1d7c47,_0x36299c,_0x2029f3;_0xa38b7d['serverUrl']=intUtil[_0x5d2b('0x61')](_0xa38b7d[_0x5d2b('0x60')]);_0xa38b7d['remoteUri']=intUtil[_0x5d2b('0x61')](_0xa38b7d['remoteUri']);if(_0x4d4563&&_0x4d4563[_0x5d2b('0x7d')]){logger[_0x5d2b('0x26')]('['+_0x34d320[_0x5d2b('0x7e')][_0x5d2b('0x7f')]()+']','Recording\x20is\x20enabled!');_0x34d320['recordingURL']=util[_0x5d2b('0x43')](_0x5d2b('0x63'),_0xa38b7d[_0x5d2b('0x60')],_0x34d320[_0x5d2b('0x77')],md5(_0x34d320[_0x5d2b('0x77')]));}else{_0x34d320['recordingURL']='';}return getConnection(_0xa38b7d)['then'](function(_0x21e2d6){_0x2029f3=_0x21e2d6;if(!_[_0x5d2b('0x1f')](_0x37c95c)){return getUser(_0xa38b7d,_0x37c95c[_0x5d2b('0x53')],_0x2029f3);}else{return getUser(_0xa38b7d,null,_0x2029f3);}})[_0x5d2b('0x22')](function(_0x46a8d9){_0x40907c=_0x46a8d9;return getEndUser(_0xa38b7d,_0x4dbf12,_0x34d320['calleridname'],_0x34d320['calleridnum'],_0x2029f3);})[_0x5d2b('0x22')](function(_0x5827a8){_0x1d7c47=_0x5827a8;return getTicket(_0xa38b7d,_0x40907c,_0x1d7c47,_0x4dbf12,_0x34d320,_0x4dbf12['Fields'],_0x2029f3);})[_0x5d2b('0x22')](function(_0x543bc6){_0x36299c=_0x543bc6;logger[_0x5d2b('0x26')]('['+_0x34d320['lastevent'][_0x5d2b('0x7f')]()+_0x5d2b('0x80'),_0x36299c['id']);logger[_0x5d2b('0x26')]('['+_0x34d320['lastevent'][_0x5d2b('0x7f')]()+_0x5d2b('0x81'),_0xa38b7d[_0x5d2b('0x4d')]);})[_0x5d2b('0x72')](function(_0x41ac18){logger['error']('['+_0x34d320[_0x5d2b('0x7e')][_0x5d2b('0x7f')]()+']',_0x41ac18);});}; \ 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 c8a140c..042f42c 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 _0x2a85=['picklist','type','nameField','customField','toLowerCase','idField','content','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident\x20-\x20','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','md5','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','then','result','adminId','sys_id','toUpperCase','catch','error','],\x20getUser\x20input\x20crm','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','length','true','userId','adminEmail','],\x20getUser\x20crm','message','info',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','includes','string'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0x2a85,0xad));var _0x52a8=function(_0x4a94b1,_0x4f2518){_0x4a94b1=_0x4a94b1-0x0;var _0x20949f=_0x2a85[_0x4a94b1];return _0x20949f;};'use strict';var _=require(_0x52a8('0x0'));var Promise=require(_0x52a8('0x1'));var rp=require('request-promise');var util=require('util');var md5=require(_0x52a8('0x2'));var Redis=require(_0x52a8('0x3'));var intUtil=require(_0x52a8('0x4'));var config=require('../../../../config/environment');var logger=require(_0x52a8('0x5'))('servicenow');config[_0x52a8('0x6')]=_[_0x52a8('0x7')](config[_0x52a8('0x6')],{'host':_0x52a8('0x8'),'port':0x18eb});var io=require(_0x52a8('0x9'))(new Redis(config[_0x52a8('0x6')]));function getAdminUser(_0x52f139,_0x42e9b0,_0x33a669,_0x34c7b9,_0x4708e8,_0x4946bb){return new Promise(function(_0x5b08ad,_0x45260c){var _0x20f62a={'method':_0x52a8('0xa'),'uri':_0x34c7b9+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4708e8+'&'+_0x4946bb,'auth':_0x42e9b0,'json':!![]};return rp(_0x20f62a)[_0x52a8('0xb')](function(_0x20a5f5){if(_0x20a5f5[_0x52a8('0xc')]['length']>0x0){_0x33a669[_0x52a8('0xd')]=_0x20a5f5[_0x52a8('0xc')][0x0][_0x52a8('0xe')];}logger['info']('['+[_0x52f139[_0x52a8('0xf')]()]+'],\x20getAdminUser\x20crm',_0x33a669);_0x5b08ad(_0x33a669);})[_0x52a8('0x10')](function(_0x6f6271){logger[_0x52a8('0x11')]('['+[_0x52f139[_0x52a8('0xf')]()]+']',_0x6f6271['message']);_0x45260c(_0x6f6271['message']);});});}function getUser(_0x5bc1ae,_0x1d89e9,_0xc63ea5,_0x2290f9,_0x4db134){return function(_0x2780c8){logger['info']('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x12'),_0x2780c8);return new Promise(function(_0xa7d1e7,_0x236399){if(intUtil[_0x52a8('0x13')](_0x2780c8['userEmail'])){var _0x48fcc2={'method':_0x52a8('0xa'),'uri':_0xc63ea5+'sys_user?sysparm_query=email%3D'+_0x2780c8[_0x52a8('0x14')]+'&'+_0x2290f9+'&'+_0x4db134,'auth':_0x1d89e9,'json':!![]};logger['info']('['+[_0x5bc1ae['toUpperCase']()]+_0x52a8('0x15'),_0x48fcc2);return rp(_0x48fcc2)[_0x52a8('0xb')](function(_0x4b754e){logger['info']('['+[_0x5bc1ae['toUpperCase']()]+'],\x20getUser\x20entity',_0x4b754e);if(_0x4b754e[_0x52a8('0xc')][_0x52a8('0x16')]>0x0&&String(_0x4b754e['result'][0x0]['active'])===_0x52a8('0x17')){_0x2780c8[_0x52a8('0x18')]=_0x4b754e[_0x52a8('0xc')][0x0][_0x52a8('0xe')];}else{_0x2780c8['userId']=_0x2780c8[_0x52a8('0xd')];_0x2780c8[_0x52a8('0x14')]=_0x2780c8[_0x52a8('0x19')];}logger['info']('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x1a'),_0x2780c8);_0xa7d1e7(_0x2780c8);})['catch'](function(_0x44ff31){logger[_0x52a8('0x11')]('['+[_0x5bc1ae[_0x52a8('0xf')]()]+']',_0x44ff31[_0x52a8('0x1b')]);_0x236399(_0x44ff31[_0x52a8('0x1b')]);});}else{logger[_0x52a8('0x1c')]('['+[_0x5bc1ae[_0x52a8('0xf')]()]+_0x52a8('0x1d'));_0x2780c8[_0x52a8('0x18')]=_0x2780c8[_0x52a8('0xd')];_0x2780c8[_0x52a8('0x14')]=_0x2780c8['adminEmail'];_0xa7d1e7(_0x2780c8);}});};}function createEndUser(_0x5890d3,_0x3c8fa8,_0x3c4e22,_0xe7af57,_0x14fdb5){logger['info']('['+[_0x5890d3['toUpperCase']()]+_0x52a8('0x1e'),_0x3c4e22);return new Promise(function(_0x59e30a,_0x3ed161){var _0x364b33={'method':_0x52a8('0x1f'),'uri':_0xe7af57+_0x52a8('0x20')+_0x14fdb5,'body':{'user_name':_0x3c4e22[_0x52a8('0x21')],'roles':'user','first_name':_0x3c4e22[_0x52a8('0x21')],'active':_0x52a8('0x17'),'date_format':_0x52a8('0x22'),'phone':_0x3c4e22[_0x52a8('0x21')]},'auth':_0x3c8fa8,'json':!![]};return rp(_0x364b33)['then'](function(_0x26d54b){logger[_0x52a8('0x1c')]('['+[_0x5890d3[_0x52a8('0xf')]()]+_0x52a8('0x23'),_0x26d54b[_0x52a8('0xc')]);_0x3c4e22[_0x52a8('0x24')]=_0x26d54b['result']['sys_id'];_0x59e30a(_0x3c4e22);})[_0x52a8('0x10')](function(_0x1b2db1){logger[_0x52a8('0x11')]('['+[_0x5890d3[_0x52a8('0xf')]()]+']',_0x1b2db1[_0x52a8('0x1b')]);_0x3ed161(_0x1b2db1['message']);});});}function getEndUser(_0x43235a,_0x44bfa6,_0x1efdca,_0x47046c,_0x44c90e){return function(_0x7e09b){logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+_0x52a8('0x25'),_0x7e09b);return new Promise(function(_0x40bd2f,_0x1ad56c){var _0x380db4={'method':'GET','uri':_0x1efdca+_0x52a8('0x26')+_0x7e09b[_0x52a8('0x21')]+'&'+_0x47046c+'&'+_0x44c90e,'auth':_0x44bfa6,'json':!![]};return rp(_0x380db4)[_0x52a8('0xb')](function(_0x48b37a){if(_0x48b37a[_0x52a8('0xc')]['length']>0x0){_0x7e09b[_0x52a8('0x24')]=_0x48b37a[_0x52a8('0xc')][0x0]['sys_id'];logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+'],\x20getEndUser\x20crm',_0x7e09b);_0x40bd2f(_0x7e09b);}else{return createEndUser(_0x43235a,_0x44bfa6,_0x7e09b,_0x1efdca,_0x47046c)[_0x52a8('0xb')](function(_0x29bcbd){logger[_0x52a8('0x1c')]('['+[_0x43235a[_0x52a8('0xf')]()]+'],\x20createEndUser\x20crm',_0x29bcbd);_0x40bd2f(_0x29bcbd);});}})[_0x52a8('0x10')](function(_0x40dc65){logger[_0x52a8('0x11')]('['+[_0x43235a[_0x52a8('0xf')]()]+']',_0x40dc65[_0x52a8('0x1b')]);_0x1ad56c(_0x40dc65[_0x52a8('0x1b')]);});});};}function getCustomFields(_0xf062a6,_0x186367){var _0x5b6707={};if(_0xf062a6[_0x52a8('0x16')]>0x0){_['forEach'](_0xf062a6,function(_0x40ec34){if(_[_0x52a8('0x27')]([_0x52a8('0x28'),_0x52a8('0x29')],_0x40ec34[_0x52a8('0x2a')])&&_0x40ec34[_0x52a8('0x2b')]&&!_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34['nameField'][_0x52a8('0x2d')]()]=_0x40ec34['content']['toString']();}else if(_[_0x52a8('0x27')](['string',_0x52a8('0x29')],_0x40ec34[_0x52a8('0x2a')])&&_0x40ec34['idField']&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34[_0x52a8('0x2e')][_0x52a8('0x2d')]()]=_0x40ec34[_0x52a8('0x2f')]['toString']();}else if(_0x40ec34[_0x52a8('0x2a')]===_0x52a8('0x30')&&_0x40ec34[_0x52a8('0x31')]&&_0x40ec34['idField']&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34[_0x52a8('0x2e')][_0x52a8('0x2d')]()]=_0x186367[_0x40ec34[_0x52a8('0x31')]][_0x52a8('0x32')]();}else if(_0x40ec34[_0x52a8('0x2a')]===_0x52a8('0x33')&&_0x40ec34[_0x52a8('0x34')]&&_0x40ec34[_0x52a8('0x34')][_0x52a8('0x35')]&&_0x40ec34[_0x52a8('0x2e')]&&_0x40ec34[_0x52a8('0x2c')]){_0x5b6707[_0x40ec34['idField']['toLowerCase']()]=_0x186367[_0x40ec34[_0x52a8('0x34')][_0x52a8('0x35')][_0x52a8('0x2d')]()][_0x52a8('0x32')]();}});}return _0x5b6707;}function getTicket(_0x220336,_0x2273bb,_0x509870,_0x39f89f,_0x2eda42,_0x49ffdd){return function(_0xd8204c){logger['info']('['+[_0x220336['toUpperCase']()]+_0x52a8('0x36'),_0xd8204c);return new Promise(function(_0x267877,_0x20f4a2){var _0x30755b=_0x220336[_0x52a8('0x2d')]()==='outbound'?_0xd8204c[_0x52a8('0x18')]:_0xd8204c[_0x52a8('0x24')];var _0x5a2215={'method':'POST','uri':_0x509870+_0x52a8('0x37')+'?'+_0x49ffdd,'body':Object[_0x52a8('0x38')]({},{'active':_0x52a8('0x17'),'caller_id':_0x30755b,'assigned_to':_0xd8204c[_0x52a8('0x18')],'short_description':intUtil[_0x52a8('0x39')](_0x39f89f[_0x52a8('0x3a')],_0x2eda42,'\x20'),'description':intUtil['getString'](_0x39f89f[_0x52a8('0x3b')],_0x2eda42,'\x0a')},getCustomFields(_0x39f89f[_0x52a8('0x3c')],_0x2eda42)),'auth':_0x2273bb,'json':!![]};return rp(_0x5a2215)['then'](function(_0x3c64ca){logger[_0x52a8('0x1c')]('['+[_0x220336['toUpperCase']()]+_0x52a8('0x3d'),_0x3c64ca[_0x52a8('0xc')]);_0xd8204c[_0x52a8('0x3e')]=_0x3c64ca[_0x52a8('0xc')]['sys_id'];_0xd8204c[_0x52a8('0x3f')]=_0x3c64ca[_0x52a8('0xc')][_0x52a8('0x40')];logger['info']('['+[_0x220336[_0x52a8('0xf')]()]+_0x52a8('0x41'),_0xd8204c);_0x267877(_0xd8204c);})[_0x52a8('0x10')](function(_0x49d3f3){logger[_0x52a8('0x11')]('['+[_0x220336[_0x52a8('0xf')]()]+']',_0x49d3f3['message']);_0x20f4a2(_0x49d3f3[_0x52a8('0x1b')]);});});};}function createRemoteTag(_0x97e55c,_0x5c6306,_0x20839d,_0x404ed7){return new Promise(function(_0x3bcb6c,_0x2731ab){var _0x3ca8cc={'method':_0x52a8('0x1f'),'uri':_0x20839d+_0x52a8('0x42')+'?'+_0x404ed7,'body':{'short_description':_0x97e55c,'global':!![],'active':!![],'name':_0x97e55c},'auth':_0x5c6306,'json':!![]};return rp(_0x3ca8cc)[_0x52a8('0xb')](function(_0x47caad){var _0x317e70=_0x47caad[_0x52a8('0xc')][_0x52a8('0xe')];_0x3bcb6c(_0x317e70);});});}function getRemoteTag(_0x5bf556,_0xb553ac,_0xff8b4d,_0x4810c1,_0x1ee9e7){return new Promise(function(_0x23b366,_0x552226){var _0x2ed99b={'method':_0x52a8('0xa'),'uri':_0xff8b4d+'label'+'?sysparm_query=name%3D'+_0x5bf556+'&'+_0x4810c1,'auth':_0xb553ac,'json':!![]};return rp(_0x2ed99b)['then'](function(_0x81be88){if(_0x81be88['result']['length']>0x0){var _0x58ae07=_0x81be88[_0x52a8('0xc')][0x0][_0x52a8('0xe')];_0x23b366(_0x58ae07);}else{return createRemoteTag(_0x5bf556,_0xb553ac,_0xff8b4d,_0x4810c1)[_0x52a8('0xb')](function(_0x31aca0){_0x23b366(_0x31aca0);});}});});}function assignTagToIncident(_0xde79cc,_0x36aaa7,_0x41883c,_0x4d5287,_0x13b5d3){return new Promise(function(_0x37862e,_0x677064){var _0x1e491b={'method':'POST','uri':_0x41883c+_0x52a8('0x43')+'?'+_0x13b5d3,'body':{'label':_0xde79cc,'table':_0x52a8('0x37'),'id_type':'Incident','table_key':_0x4d5287[_0x52a8('0x3e')],'title':_0x52a8('0x44')+_0x4d5287[_0x52a8('0x3f')],'id_display':_0x4d5287[_0x52a8('0x3f')]},'auth':_0x36aaa7,'json':!![]};return rp(_0x1e491b)[_0x52a8('0xb')](function(_0x2acd74){_0x37862e();})[_0x52a8('0x10')](function(){_0x37862e();});});}function manageTags(_0x3eabd7,_0x5b18e6,_0xf409d1,_0x4d56be,_0x3e2807,_0x1573f7,_0x38afcf){return new Promise(function(_0x5b5e73,_0x2febba){var _0x1ad2dc=[];_0x5b18e6[_0x52a8('0x45')](function(_0xfe2c66){_0x1ad2dc[_0x52a8('0x46')](getRemoteTag(_0xfe2c66,_0xf409d1,_0x4d56be,_0x1573f7,_0x38afcf));});return Promise['all'](_0x1ad2dc)['then'](function(_0x1b931e){if(_0x1b931e[_0x52a8('0x16')]){logger[_0x52a8('0x1c')]('['+[_0x3eabd7['toUpperCase']()]+_0x52a8('0x47'),_0x1b931e);var _0x1b514d=[];_0x1b931e[_0x52a8('0x45')](function(_0x284c70){_0x1b514d[_0x52a8('0x46')](assignTagToIncident(_0x284c70,_0xf409d1,_0x4d56be,_0x3e2807,_0x1573f7));});return Promise['all'](_0x1b514d)[_0x52a8('0xb')](function(){_0x5b5e73();})[_0x52a8('0x10')](function(){_0x5b5e73();});}else{_0x5b5e73();}});});}function getTags(_0x112d14,_0x59bee4,_0x3bd29f,_0x13f6f3,_0x48247c,_0xec4129){return function(_0x28d5be){return new Promise(function(_0x450017,_0x4ccb18){var _0x4af2ae=[];var _0x13ee5b=_0x13f6f3[_0x52a8('0x48')];if(_0x13ee5b&&_0x13ee5b[_0x52a8('0x16')]>0x0){_0x4af2ae=_[_0x52a8('0x49')](_0x13ee5b,_0x52a8('0x35'));}if(_0x4af2ae[_0x52a8('0x16')]>0x0){return manageTags(_0x112d14,_0x4af2ae,_0x59bee4,_0x3bd29f,_0x28d5be,_0x48247c,_0xec4129)[_0x52a8('0xb')](function(){_0x450017(_0x28d5be);});}else{_0x450017(_0x28d5be);}});};}function emit(_0x1e29ca,_0xe417fb,_0x1b1c7f){var _0x4e297d=_0x52a8('0x4a')+_0x52a8('0x4b')+_0x52a8('0x4c')+_0x52a8('0x4d');var _0x2ca062={'uri':_0x1e29ca+_0x52a8('0x4e')+_0x1b1c7f+_0x4e297d};io['to'](util[_0x52a8('0x4f')]('user:%s',_0xe417fb))[_0x52a8('0x50')](_0x52a8('0x51'),_0x2ca062);}exports['cs']=function(_0x5c7171,_0x1f55b4,_0x375183,_0x5ea13d,_0x53cffe,_0x2a582a,_0x84dc6,_0x154978){var _0x244018={};var _0x178922={'user':_0x2a582a['username'],'pass':_0x2a582a[_0x52a8('0x52')]};var _0xc5acf1=_0x52a8('0x53');var _0x58eb67=_0x52a8('0x54');_0x2a582a[_0x52a8('0x55')]=intUtil['stripTrailingSlash'](_0x2a582a['remoteUri']);_0x2a582a['serverUrl']=intUtil['stripTrailingSlash'](_0x2a582a[_0x52a8('0x56')]);var _0x56af9f=util[_0x52a8('0x4f')]('%s/api/now/table/',_0x2a582a[_0x52a8('0x55')]);_0x244018['userEmail']=!_[_0x52a8('0x57')](_0x5ea13d)?_0x5ea13d[_0x52a8('0x58')]:null;_0x244018[_0x52a8('0x19')]=_0x2a582a[_0x52a8('0x58')];_0x244018[_0x52a8('0x21')]=_0x154978[_0x52a8('0x2d')]()===_0x52a8('0x59')?_0x1f55b4[_0x52a8('0x5a')]:_0x1f55b4[_0x52a8('0x5b')];_0x244018[_0x52a8('0x5c')]=_0x154978===_0x52a8('0x5d')||_0x154978===_0x52a8('0x5e')?_0x52a8('0x5d'):_0x52a8('0x59');var _0x3d31f2=util[_0x52a8('0x4f')](_0x52a8('0x5f'),_0x2a582a[_0x52a8('0x56')],_0x1f55b4['uniqueid'],md5(_0x1f55b4[_0x52a8('0x60')]));if(_0x53cffe&&_0x53cffe[_0x52a8('0x61')]){logger[_0x52a8('0x1c')]('[QUEUE]',_0x52a8('0x62'));_0x1f55b4[_0x52a8('0x63')]=_0x3d31f2;}else if(_0x84dc6&&_0x84dc6['recordingFormat']&&_0x84dc6[_0x52a8('0x64')]!==_0x52a8('0x65')){logger[_0x52a8('0x1c')](_0x52a8('0x66'),_0x52a8('0x62'));_0x1f55b4[_0x52a8('0x63')]=_0x3d31f2;}else{_0x1f55b4[_0x52a8('0x63')]='';}return getAdminUser(_0x154978,_0x178922,_0x244018,_0x56af9f,_0x58eb67,_0xc5acf1)[_0x52a8('0xb')](getUser(_0x154978,_0x178922,_0x56af9f,_0x58eb67,_0xc5acf1))[_0x52a8('0xb')](getEndUser(_0x154978,_0x178922,_0x56af9f,_0x58eb67,_0xc5acf1))['then'](getTicket(_0x154978,_0x178922,_0x56af9f,_0x375183,_0x1f55b4,_0x58eb67))[_0x52a8('0xb')](function(_0x157b71){logger[_0x52a8('0x1c')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x157b71[_0x52a8('0x3e')]));logger[_0x52a8('0x1c')](util[_0x52a8('0x4f')](_0x52a8('0x67'),_0x154978));if(_0x154978!==_0x52a8('0x5e')){logger[_0x52a8('0x1c')]('['+[_0x154978[_0x52a8('0xf')]()]+']',_0x52a8('0x68'));emit(_0x2a582a[_0x52a8('0x55')],_0x5ea13d[_0x52a8('0x35')],_0x157b71[_0x52a8('0x3e')]);}})[_0x52a8('0x10')](function(_0x27f6be){logger[_0x52a8('0x11')]('['+[_0x154978[_0x52a8('0xf')]()]+_0x52a8('0x69'),util[_0x52a8('0x6a')](_0x27f6be,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xcd5d=['remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis','../../../../config/environment','servicenow','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','length','result','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','type','nameField','toLowerCase','toString','idField','variable','variableName','customField','name','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xcd5d,0x86));var _0xdcd5=function(_0x43196d,_0x2d2616){_0x43196d=_0x43196d-0x0;var _0x106501=_0xcd5d[_0x43196d];return _0x106501;};'use strict';var _=require(_0xdcd5('0x0'));var Promise=require('bluebird');var rp=require(_0xdcd5('0x1'));var util=require(_0xdcd5('0x2'));var md5=require(_0xdcd5('0x3'));var Redis=require(_0xdcd5('0x4'));var intUtil=require('./util');var config=require(_0xdcd5('0x5'));var logger=require('../../../../config/logger')(_0xdcd5('0x6'));config[_0xdcd5('0x7')]=_['defaults'](config['redis'],{'host':_0xdcd5('0x8'),'port':0x18eb});var io=require(_0xdcd5('0x9'))(new Redis(config[_0xdcd5('0x7')]));function getAdminUser(_0x53f2ab,_0x3514fc,_0x4ca95f,_0x479ecd,_0xba5255,_0xb1a539){return new Promise(function(_0x2519a5,_0x3123f9){var _0xcebc07={'method':_0xdcd5('0xa'),'uri':_0x479ecd+_0xdcd5('0xb')+'&'+_0xba5255+'&'+_0xb1a539,'auth':_0x3514fc,'json':!![]};return rp(_0xcebc07)['then'](function(_0x115ef0){if(_0x115ef0['result'][_0xdcd5('0xc')]>0x0){_0x4ca95f['adminId']=_0x115ef0[_0xdcd5('0xd')][0x0][_0xdcd5('0xe')];}logger['info']('['+[_0x53f2ab[_0xdcd5('0xf')]()]+_0xdcd5('0x10'),_0x4ca95f);_0x2519a5(_0x4ca95f);})[_0xdcd5('0x11')](function(_0x4551c4){logger[_0xdcd5('0x12')]('['+[_0x53f2ab[_0xdcd5('0xf')]()]+']',_0x4551c4[_0xdcd5('0x13')]);_0x3123f9(_0x4551c4['message']);});});}function getUser(_0x4e4fd0,_0x1442aa,_0x5880d9,_0x55f734,_0xf48c40){return function(_0x65b8c0){logger[_0xdcd5('0x14')]('['+[_0x4e4fd0[_0xdcd5('0xf')]()]+_0xdcd5('0x15'),_0x65b8c0);return new Promise(function(_0xd72d5f,_0xc74a2e){if(intUtil[_0xdcd5('0x16')](_0x65b8c0[_0xdcd5('0x17')])){var _0x42f828={'method':_0xdcd5('0xa'),'uri':_0x5880d9+_0xdcd5('0x18')+_0x65b8c0['userEmail']+'&'+_0x55f734+'&'+_0xf48c40,'auth':_0x1442aa,'json':!![]};logger[_0xdcd5('0x14')]('['+[_0x4e4fd0[_0xdcd5('0xf')]()]+_0xdcd5('0x19'),_0x42f828);return rp(_0x42f828)[_0xdcd5('0x1a')](function(_0x2d159b){logger[_0xdcd5('0x14')]('['+[_0x4e4fd0[_0xdcd5('0xf')]()]+_0xdcd5('0x1b'),_0x2d159b);if(_0x2d159b[_0xdcd5('0xd')][_0xdcd5('0xc')]>0x0&&String(_0x2d159b[_0xdcd5('0xd')][0x0]['active'])===_0xdcd5('0x1c')){_0x65b8c0[_0xdcd5('0x1d')]=_0x2d159b[_0xdcd5('0xd')][0x0][_0xdcd5('0xe')];}else{_0x65b8c0[_0xdcd5('0x1d')]=_0x65b8c0[_0xdcd5('0x1e')];_0x65b8c0[_0xdcd5('0x17')]=_0x65b8c0[_0xdcd5('0x1f')];}logger[_0xdcd5('0x14')]('['+[_0x4e4fd0['toUpperCase']()]+_0xdcd5('0x20'),_0x65b8c0);_0xd72d5f(_0x65b8c0);})[_0xdcd5('0x11')](function(_0xfede3c){logger[_0xdcd5('0x12')]('['+[_0x4e4fd0[_0xdcd5('0xf')]()]+']',_0xfede3c['message']);_0xc74a2e(_0xfede3c[_0xdcd5('0x13')]);});}else{logger[_0xdcd5('0x14')]('['+[_0x4e4fd0[_0xdcd5('0xf')]()]+_0xdcd5('0x21'));_0x65b8c0[_0xdcd5('0x1d')]=_0x65b8c0[_0xdcd5('0x1e')];_0x65b8c0[_0xdcd5('0x17')]=_0x65b8c0[_0xdcd5('0x1f')];_0xd72d5f(_0x65b8c0);}});};}function createEndUser(_0x4680d0,_0x55ec01,_0x43a936,_0x3da6fb,_0x2020fa){logger['info']('['+[_0x4680d0[_0xdcd5('0xf')]()]+_0xdcd5('0x22'),_0x43a936);return new Promise(function(_0x2a1527,_0x16722d){var _0x59c7b2={'method':_0xdcd5('0x23'),'uri':_0x3da6fb+_0xdcd5('0x24')+_0x2020fa,'body':{'user_name':_0x43a936[_0xdcd5('0x25')],'roles':_0xdcd5('0x26'),'first_name':_0x43a936['endUserNumber'],'active':_0xdcd5('0x1c'),'date_format':'System','phone':_0x43a936[_0xdcd5('0x25')]},'auth':_0x55ec01,'json':!![]};return rp(_0x59c7b2)[_0xdcd5('0x1a')](function(_0x48bd2b){logger[_0xdcd5('0x14')]('['+[_0x4680d0[_0xdcd5('0xf')]()]+_0xdcd5('0x27'),_0x48bd2b[_0xdcd5('0xd')]);_0x43a936[_0xdcd5('0x28')]=_0x48bd2b[_0xdcd5('0xd')][_0xdcd5('0xe')];_0x2a1527(_0x43a936);})[_0xdcd5('0x11')](function(_0x5bdcb3){logger[_0xdcd5('0x12')]('['+[_0x4680d0['toUpperCase']()]+']',_0x5bdcb3[_0xdcd5('0x13')]);_0x16722d(_0x5bdcb3[_0xdcd5('0x13')]);});});}function getEndUser(_0x2b3049,_0x2ea80b,_0x2ad586,_0x2a80d2,_0x9ee940){return function(_0x527e91){logger['info']('['+[_0x2b3049['toUpperCase']()]+_0xdcd5('0x29'),_0x527e91);return new Promise(function(_0xf44bf5,_0x47fafe){var _0x577b11={'method':'GET','uri':_0x2ad586+_0xdcd5('0x2a')+_0x527e91[_0xdcd5('0x25')]+'&'+_0x2a80d2+'&'+_0x9ee940,'auth':_0x2ea80b,'json':!![]};return rp(_0x577b11)[_0xdcd5('0x1a')](function(_0x15ba01){if(_0x15ba01['result'][_0xdcd5('0xc')]>0x0){_0x527e91['endUserId']=_0x15ba01[_0xdcd5('0xd')][0x0][_0xdcd5('0xe')];logger[_0xdcd5('0x14')]('['+[_0x2b3049[_0xdcd5('0xf')]()]+_0xdcd5('0x2b'),_0x527e91);_0xf44bf5(_0x527e91);}else{return createEndUser(_0x2b3049,_0x2ea80b,_0x527e91,_0x2ad586,_0x2a80d2)[_0xdcd5('0x1a')](function(_0x37c18f){logger[_0xdcd5('0x14')]('['+[_0x2b3049['toUpperCase']()]+_0xdcd5('0x2c'),_0x37c18f);_0xf44bf5(_0x37c18f);});}})[_0xdcd5('0x11')](function(_0x1b0c7f){logger[_0xdcd5('0x12')]('['+[_0x2b3049[_0xdcd5('0xf')]()]+']',_0x1b0c7f[_0xdcd5('0x13')]);_0x47fafe(_0x1b0c7f['message']);});});};}function getCustomFields(_0x3b7ab8,_0x5d3d58){var _0x326084={};if(_0x3b7ab8[_0xdcd5('0xc')]>0x0){_['forEach'](_0x3b7ab8,function(_0x187613){if(_[_0xdcd5('0x2d')]([_0xdcd5('0x2e'),_0xdcd5('0x2f')],_0x187613[_0xdcd5('0x30')])&&_0x187613[_0xdcd5('0x31')]&&!_0x187613['customField']){_0x326084[_0x187613[_0xdcd5('0x31')][_0xdcd5('0x32')]()]=_0x187613['content'][_0xdcd5('0x33')]();}else if(_[_0xdcd5('0x2d')]([_0xdcd5('0x2e'),_0xdcd5('0x2f')],_0x187613[_0xdcd5('0x30')])&&_0x187613[_0xdcd5('0x34')]&&_0x187613['customField']){_0x326084[_0x187613[_0xdcd5('0x34')][_0xdcd5('0x32')]()]=_0x187613['content']['toString']();}else if(_0x187613[_0xdcd5('0x30')]===_0xdcd5('0x35')&&_0x187613[_0xdcd5('0x36')]&&_0x187613[_0xdcd5('0x34')]&&_0x187613[_0xdcd5('0x37')]){_0x326084[_0x187613[_0xdcd5('0x34')]['toLowerCase']()]=_0x5d3d58[_0x187613['variableName']][_0xdcd5('0x33')]();}else if(_0x187613['type']==='customVariable'&&_0x187613['Variable']&&_0x187613['Variable'][_0xdcd5('0x38')]&&_0x187613[_0xdcd5('0x34')]&&_0x187613['customField']){_0x326084[_0x187613[_0xdcd5('0x34')][_0xdcd5('0x32')]()]=_0x5d3d58[_0x187613[_0xdcd5('0x39')][_0xdcd5('0x38')][_0xdcd5('0x32')]()][_0xdcd5('0x33')]();}});}return _0x326084;}function getTicket(_0x21638a,_0x26a7b3,_0x365f41,_0x33f172,_0x1af9e5,_0x4820d6){return function(_0x3608c1){logger['info']('['+[_0x21638a[_0xdcd5('0xf')]()]+_0xdcd5('0x3a'),_0x3608c1);return new Promise(function(_0x53f629,_0x5f4d31){var _0x22ef22=_0x21638a[_0xdcd5('0x32')]()==='outbound'?_0x3608c1[_0xdcd5('0x1d')]:_0x3608c1[_0xdcd5('0x28')];var _0x619b9={'method':_0xdcd5('0x23'),'uri':_0x365f41+_0xdcd5('0x3b')+'?'+_0x4820d6,'body':Object[_0xdcd5('0x3c')]({},{'active':_0xdcd5('0x1c'),'caller_id':_0x22ef22,'assigned_to':_0x3608c1['userId'],'short_description':intUtil[_0xdcd5('0x3d')](_0x33f172[_0xdcd5('0x3e')],_0x1af9e5,'\x20'),'description':intUtil['getString'](_0x33f172[_0xdcd5('0x3f')],_0x1af9e5,'\x0a')},getCustomFields(_0x33f172[_0xdcd5('0x40')],_0x1af9e5)),'auth':_0x26a7b3,'json':!![]};return rp(_0x619b9)[_0xdcd5('0x1a')](function(_0x1f3b45){logger[_0xdcd5('0x14')]('['+[_0x21638a['toUpperCase']()]+_0xdcd5('0x41'),_0x1f3b45[_0xdcd5('0xd')]);_0x3608c1[_0xdcd5('0x42')]=_0x1f3b45[_0xdcd5('0xd')]['sys_id'];_0x3608c1['ticketNumber']=_0x1f3b45['result']['number'];logger['info']('['+[_0x21638a[_0xdcd5('0xf')]()]+']\x20getTicket\x20crm',_0x3608c1);_0x53f629(_0x3608c1);})[_0xdcd5('0x11')](function(_0x21ca28){logger[_0xdcd5('0x12')]('['+[_0x21638a[_0xdcd5('0xf')]()]+']',_0x21ca28['message']);_0x5f4d31(_0x21ca28[_0xdcd5('0x13')]);});});};}function createRemoteTag(_0xd82b6e,_0x19d58c,_0x1c56e5,_0x216062){return new Promise(function(_0x41ecc1,_0x13bbbe){var _0x5454fc={'method':_0xdcd5('0x23'),'uri':_0x1c56e5+_0xdcd5('0x43')+'?'+_0x216062,'body':{'short_description':_0xd82b6e,'global':!![],'active':!![],'name':_0xd82b6e},'auth':_0x19d58c,'json':!![]};return rp(_0x5454fc)[_0xdcd5('0x1a')](function(_0x2d53f3){var _0x524c2d=_0x2d53f3['result']['sys_id'];_0x41ecc1(_0x524c2d);});});}function getRemoteTag(_0x4e0b16,_0x26f800,_0x4218b0,_0x3ddca2,_0x1e0835){return new Promise(function(_0x443c83,_0x4ebcbd){var _0x37d155={'method':_0xdcd5('0xa'),'uri':_0x4218b0+_0xdcd5('0x43')+_0xdcd5('0x44')+_0x4e0b16+'&'+_0x3ddca2,'auth':_0x26f800,'json':!![]};return rp(_0x37d155)[_0xdcd5('0x1a')](function(_0x1ee267){if(_0x1ee267['result'][_0xdcd5('0xc')]>0x0){var _0x7ddc8d=_0x1ee267[_0xdcd5('0xd')][0x0][_0xdcd5('0xe')];_0x443c83(_0x7ddc8d);}else{return createRemoteTag(_0x4e0b16,_0x26f800,_0x4218b0,_0x3ddca2)['then'](function(_0x238b3a){_0x443c83(_0x238b3a);});}});});}function assignTagToIncident(_0x17bc3b,_0x31d590,_0x5a2541,_0x1ada73,_0x17a400){return new Promise(function(_0x4863e5,_0xf1db35){var _0x13a6db={'method':_0xdcd5('0x23'),'uri':_0x5a2541+_0xdcd5('0x45')+'?'+_0x17a400,'body':{'label':_0x17bc3b,'table':_0xdcd5('0x3b'),'id_type':_0xdcd5('0x46'),'table_key':_0x1ada73[_0xdcd5('0x42')],'title':_0xdcd5('0x47')+_0x1ada73['ticketNumber'],'id_display':_0x1ada73['ticketNumber']},'auth':_0x31d590,'json':!![]};return rp(_0x13a6db)[_0xdcd5('0x1a')](function(_0x1cad47){_0x4863e5();})[_0xdcd5('0x11')](function(){_0x4863e5();});});}function manageTags(_0x21ca7e,_0x42a58d,_0x53bbb4,_0x265a14,_0x55a506,_0x79e4c6,_0x169014){return new Promise(function(_0x2adbef,_0x4d1a1b){var _0xce6f0c=[];_0x42a58d['forEach'](function(_0xa0f25d){_0xce6f0c[_0xdcd5('0x48')](getRemoteTag(_0xa0f25d,_0x53bbb4,_0x265a14,_0x79e4c6,_0x169014));});return Promise[_0xdcd5('0x49')](_0xce6f0c)[_0xdcd5('0x1a')](function(_0x5f2c45){if(_0x5f2c45['length']){logger[_0xdcd5('0x14')]('['+[_0x21ca7e['toUpperCase']()]+_0xdcd5('0x4a'),_0x5f2c45);var _0x7a127a=[];_0x5f2c45['forEach'](function(_0x73e6ec){_0x7a127a[_0xdcd5('0x48')](assignTagToIncident(_0x73e6ec,_0x53bbb4,_0x265a14,_0x55a506,_0x79e4c6));});return Promise[_0xdcd5('0x49')](_0x7a127a)[_0xdcd5('0x1a')](function(){_0x2adbef();})[_0xdcd5('0x11')](function(){_0x2adbef();});}else{_0x2adbef();}});});}function getTags(_0x585a14,_0x251afd,_0x1f80ee,_0x3d4786,_0x5bf435,_0x30c9f8){return function(_0x2994a){return new Promise(function(_0x1ae34d,_0x32ad7e){var _0x2a8ffb=[];var _0x2a4337=_0x3d4786[_0xdcd5('0x4b')];if(_0x2a4337&&_0x2a4337['length']>0x0){_0x2a8ffb=_[_0xdcd5('0x4c')](_0x2a4337,_0xdcd5('0x38'));}if(_0x2a8ffb[_0xdcd5('0xc')]>0x0){return manageTags(_0x585a14,_0x2a8ffb,_0x251afd,_0x1f80ee,_0x2994a,_0x5bf435,_0x30c9f8)[_0xdcd5('0x1a')](function(){_0x1ae34d(_0x2994a);});}else{_0x1ae34d(_0x2994a);}});};}function emit(_0x32fe6c,_0x17b3c0,_0x189f3a){var _0xbf3218=_0xdcd5('0x4d')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x5a0a41={'uri':_0x32fe6c+_0xdcd5('0x4e')+_0x189f3a+_0xbf3218};io['to'](util[_0xdcd5('0x4f')](_0xdcd5('0x50'),_0x17b3c0))['emit'](_0xdcd5('0x51'),_0x5a0a41);}exports['cs']=function(_0x389ec9,_0x4eaf8b,_0x24a9f2,_0x703ab5,_0x4afc5f,_0x4f168a,_0x261f16,_0x5c62d1){var _0x40ab80={};var _0x5f7cf7={'user':_0x4f168a[_0xdcd5('0x52')],'pass':_0x4f168a[_0xdcd5('0x53')]};var _0x37f1b2=_0xdcd5('0x54');var _0x572553=_0xdcd5('0x55');_0x4f168a[_0xdcd5('0x56')]=intUtil[_0xdcd5('0x57')](_0x4f168a[_0xdcd5('0x56')]);_0x4f168a[_0xdcd5('0x58')]=intUtil[_0xdcd5('0x57')](_0x4f168a[_0xdcd5('0x58')]);var _0xd0ce7a=util[_0xdcd5('0x4f')](_0xdcd5('0x59'),_0x4f168a[_0xdcd5('0x56')]);_0x40ab80[_0xdcd5('0x17')]=!_[_0xdcd5('0x5a')](_0x703ab5)?_0x703ab5[_0xdcd5('0x5b')]:null;_0x40ab80[_0xdcd5('0x1f')]=_0x4f168a[_0xdcd5('0x5b')];_0x40ab80[_0xdcd5('0x25')]=_0x5c62d1[_0xdcd5('0x32')]()===_0xdcd5('0x5c')?_0x4eaf8b[_0xdcd5('0x5d')]:_0x4eaf8b[_0xdcd5('0x5e')];_0x40ab80[_0xdcd5('0x5f')]=_0x5c62d1===_0xdcd5('0x60')||_0x5c62d1==='unmanaged'?'queue':_0xdcd5('0x5c');var _0x747954=util[_0xdcd5('0x4f')](_0xdcd5('0x61'),_0x4f168a[_0xdcd5('0x58')],_0x4eaf8b[_0xdcd5('0x62')],md5(_0x4eaf8b[_0xdcd5('0x62')]));if(_0x4afc5f&&_0x4afc5f['monitor_format']){logger[_0xdcd5('0x14')](_0xdcd5('0x63'),_0xdcd5('0x64'));_0x4eaf8b[_0xdcd5('0x65')]=_0x747954;}else if(_0x261f16&&_0x261f16['recordingFormat']&&_0x261f16[_0xdcd5('0x66')]!==_0xdcd5('0x67')){logger[_0xdcd5('0x14')](_0xdcd5('0x68'),'Recording\x20is\x20enabled!');_0x4eaf8b['recordingURL']=_0x747954;}else{_0x4eaf8b['recordingURL']='';}return getAdminUser(_0x5c62d1,_0x5f7cf7,_0x40ab80,_0xd0ce7a,_0x572553,_0x37f1b2)['then'](getUser(_0x5c62d1,_0x5f7cf7,_0xd0ce7a,_0x572553,_0x37f1b2))[_0xdcd5('0x1a')](getEndUser(_0x5c62d1,_0x5f7cf7,_0xd0ce7a,_0x572553,_0x37f1b2))[_0xdcd5('0x1a')](getTicket(_0x5c62d1,_0x5f7cf7,_0xd0ce7a,_0x24a9f2,_0x4eaf8b,_0x572553))[_0xdcd5('0x1a')](function(_0x2f587d){logger[_0xdcd5('0x14')](util[_0xdcd5('0x4f')]('The\x20ticket\x20ID\x20is:\x20%s',_0x2f587d[_0xdcd5('0x42')]));logger[_0xdcd5('0x14')](util[_0xdcd5('0x4f')](_0xdcd5('0x69'),_0x5c62d1));if(_0x5c62d1!==_0xdcd5('0x6a')){logger[_0xdcd5('0x14')]('['+[_0x5c62d1[_0xdcd5('0xf')]()]+']',_0xdcd5('0x6b'));emit(_0x4f168a[_0xdcd5('0x56')],_0x703ab5[_0xdcd5('0x38')],_0x2f587d[_0xdcd5('0x42')]);}})[_0xdcd5('0x11')](function(_0x5f4979){logger[_0xdcd5('0x12')]('['+[_0x5c62d1[_0xdcd5('0xf')]()]+_0xdcd5('0x6c'),util[_0xdcd5('0x6d')](_0x5f4979,{'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 bb0490c..0f60053 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 _0xbe46=['version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','user:%s','trigger:browser:url','catch','error','%s/service/v4_1/rest.php','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','Outbound','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent','toUpperCase','recordingURL','isNil','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','replace','duration_hours','Contacts','parent_name','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','name_value_list','user_name','value','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','map','forEach','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','Variable','login','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts'];(function(_0x55af51,_0x53b805){var _0x24bab2=function(_0x1ad5fb){while(--_0x1ad5fb){_0x55af51['push'](_0x55af51['shift']());}};_0x24bab2(++_0x53b805);}(_0xbe46,0xfd));var _0x6be4=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xbe46[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x6be4('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0x6be4('0x1'));var util=require(_0x6be4('0x2'));var Redis=require(_0x6be4('0x3'));var intUtil=require('./util');var config=require(_0x6be4('0x4'));var logger=require(_0x6be4('0x5'))(_0x6be4('0x6'));config[_0x6be4('0x7')]=_[_0x6be4('0x8')](config[_0x6be4('0x7')],{'host':_0x6be4('0x9'),'port':0x18eb});var io=require(_0x6be4('0xa'))(new Redis(config['redis']));var def={'method':_0x6be4('0xb'),'json':!![]};function emit(_0x49dce0,_0x31f5c1,_0x202b8f){io['to'](_0x49dce0)[_0x6be4('0xc')](_0x31f5c1,_0x202b8f);}function getTicket(_0x921855,_0x4c6559,_0x50ade8,_0x2c262a,_0x19a3b5,_0x1b3bce,_0xded3c8,_0x3790c2){logger[_0x6be4('0xd')](_0x6be4('0xe'));var _0x5ea176=new Date();var _0x38e52b=[{'name':_0x6be4('0xf'),'value':intUtil['getString'](_0x2c262a[_0x6be4('0x10')],_0x19a3b5,'\x20')},{'name':_0x6be4('0x11'),'value':_0x4c6559['id']},{'name':_0x6be4('0x12'),'value':_0x4c6559['id']},{'name':_0x6be4('0x13'),'value':intUtil[_0x6be4('0x14')](_0x2c262a[_0x6be4('0x15')],_0x19a3b5,'\x0a')},{'name':'date_start','value':_0x5ea176[_0x6be4('0x16')]()['slice'](0x0,0x13)[_0x6be4('0x17')]('T','\x20')},{'name':_0x6be4('0x18'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':'parent_id','value':_0x50ade8['id']},{'name':'parent_type','value':_0x6be4('0x19')},{'name':_0x6be4('0x1a'),'value':_0x50ade8[_0x6be4('0xf')]},{'name':'direction','value':_0x3790c2}];if(_0x1b3bce[_0x6be4('0x1b')]){_['forEach'](_0x1b3bce,function(_0x25e955){if(_0x19a3b5[_0x25e955[_0x6be4('0x1c')]]){_0x38e52b[_0x6be4('0x1d')]({'name':_0x25e955[_0x6be4('0x1e')],'value':_0x19a3b5[_0x25e955[_0x6be4('0x1c')]]});}});}return request({'form':{'method':_0x6be4('0x1f'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0xded3c8['id'],'module_name':_0x6be4('0x22'),'name_value_list':_0x38e52b})}});}function getAuth(_0x3de5d1){return util[_0x6be4('0x23')](_0x6be4('0x24'),new Buffer(_0x3de5d1['apiKey']+':X')[_0x6be4('0x25')](_0x6be4('0x26')));}function getServerInfo(_0x3439e9){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x3439e9['id']})}});}function getUser(_0x1fdaab,_0x3f23ad,_0x59d3c3){if(!_['isNil'](_0x3f23ad)){logger[_0x6be4('0xd')]('Getting\x20agent\x20with\x20name',_0x3f23ad);return request({'form':{'method':_0x6be4('0x27'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x59d3c3['id'],'module_name':_0x6be4('0x28'),'query':util[_0x6be4('0x23')](_0x6be4('0x29'),_0x3f23ad),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6be4('0x2a')](function(_0x1098c4){if(_0x1098c4[_0x6be4('0x2b')][_0x6be4('0x1b')]){var _0x5ee0b9=_['find'](_0x1098c4[_0x6be4('0x2b')],function(_0x11b4bf){return _0x11b4bf[_0x6be4('0x2c')][_0x6be4('0x2d')][_0x6be4('0x2e')]===_0x3f23ad;});if(_0x5ee0b9){logger[_0x6be4('0xd')]('Agent\x20found!');return BPromise['resolve']({'id':_0x5ee0b9['name_value_list']['id']['value'],'name':_0x5ee0b9[_0x6be4('0x2c')][_0x6be4('0xf')][_0x6be4('0x2e')]});}}logger[_0x6be4('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x6be4('0x2f')]({'id':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x30')][_0x6be4('0x2e')],'name':_0x59d3c3['name_value_list'][_0x6be4('0x2d')]['value']});});}else{logger[_0x6be4('0xd')](_0x6be4('0x31'));return BPromise['resolve']({'id':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x30')][_0x6be4('0x2e')],'name':_0x59d3c3[_0x6be4('0x2c')][_0x6be4('0x2d')][_0x6be4('0x2e')]});}}function getEndUser(_0x13ce29,_0x23cc05,_0x3d55f8,_0x473b79){logger['info']('Searching\x20enduser\x20with\x20phone',_0x3d55f8);return request({'form':{'method':_0x6be4('0x27'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x473b79['id'],'module_name':'Contacts','query':util[_0x6be4('0x23')](_0x6be4('0x32'),_0x3d55f8),'order_by':'','offset':'0','select_fields':['id',_0x6be4('0xf'),_0x6be4('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x6be4('0x2a')](function(_0x560298){if(_0x560298[_0x6be4('0x2b')][_0x6be4('0x1b')]){var _0x1e646d=_[_0x6be4('0x34')](_0x560298[_0x6be4('0x2b')],function(_0x5984d3){return _0x5984d3['name_value_list'][_0x6be4('0x33')]['value']===_0x3d55f8;});if(_0x1e646d){logger[_0x6be4('0xd')](_0x6be4('0x35'));return BPromise[_0x6be4('0x2f')]({'id':_0x1e646d[_0x6be4('0x2c')]['id'][_0x6be4('0x2e')],'name':_0x1e646d[_0x6be4('0x2c')][_0x6be4('0xf')][_0x6be4('0x2e')],'phone':_0x1e646d['name_value_list']['phone_home'][_0x6be4('0x2e')]});}}else{logger['info'](_0x6be4('0x36'));return request({'form':{'method':_0x6be4('0x1f'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON['stringify']({'session':_0x473b79['id'],'module_name':_0x6be4('0x19'),'name_value_list':[{'name':_0x6be4('0x37'),'value':_0x23cc05!==_0x6be4('0x38')?_0x23cc05:util['format'](_0x6be4('0x39'),_0x3d55f8)},{'name':'phone_home','value':_0x3d55f8}]})}})[_0x6be4('0x2a')](function(_0x39747c){logger[_0x6be4('0xd')](_0x6be4('0x3a'));return BPromise[_0x6be4('0x2f')]({'id':_0x39747c['id'],'name':_0x39747c[_0x6be4('0x2b')][_0x6be4('0x37')][_0x6be4('0x2e')],'phone':_0x39747c[_0x6be4('0x2b')][_0x6be4('0x33')][_0x6be4('0x2e')]});});}});}function request(_0x51c0b5){logger['debug']('[HTTP]',JSON['stringify'](_0x51c0b5));return rp(_['merge'](def,_0x51c0b5));}function getTags(_0xc92493,_0xd57b50){var _0x2d5732=[];if(_0xc92493&&_0xc92493[_0x6be4('0x1b')]>0x0){_0x2d5732=_[_0x6be4('0x3b')](_0xc92493,_0xd57b50);}return _0x2d5732;}function getCustomFields(_0x40a584,_0x3e317a){var _0x3df320=[];var _0x44f5f0={'custom_fields':[]};if(_0x40a584[_0x6be4('0x1b')]>0x0){_[_0x6be4('0x3c')](_0x40a584,function(_0x9d9d49){if(_0x9d9d49[_0x6be4('0x3d')]==='string'&&_0x9d9d49[_0x6be4('0x3e')]&&!_0x9d9d49[_0x6be4('0x3f')]){_0x44f5f0[_0x9d9d49[_0x6be4('0x3e')][_0x6be4('0x40')]()]=_0x9d9d49[_0x6be4('0x41')][_0x6be4('0x25')]();}else if(_0x9d9d49[_0x6be4('0x3d')]===_0x6be4('0x42')&&_0x9d9d49[_0x6be4('0x1e')]&&_0x9d9d49['customField']){_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x9d9d49[_0x6be4('0x41')][_0x6be4('0x25')]()});}else if(_0x9d9d49[_0x6be4('0x3d')]===_0x6be4('0x44')&&_0x9d9d49['variableName']&&_0x9d9d49['idField']&&_0x9d9d49['customField']){_0x3e317a[_0x9d9d49[_0x6be4('0x1c')]]&&_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x3e317a[_0x9d9d49[_0x6be4('0x1c')]][_0x6be4('0x25')]()});}else if(_0x9d9d49['type']==='customVariable'&&_0x9d9d49[_0x6be4('0x45')]&&_0x9d9d49[_0x6be4('0x45')]['name']&&_0x9d9d49['idField']&&_0x9d9d49[_0x6be4('0x3f')]){_0x3e317a[_0x9d9d49[_0x6be4('0x45')][_0x6be4('0xf')][_0x6be4('0x40')]()]&&_0x44f5f0[_0x6be4('0x43')][_0x6be4('0x1d')]({'id':_0x9d9d49[_0x6be4('0x1e')],'value':_0x3e317a[_0x9d9d49['Variable'][_0x6be4('0xf')][_0x6be4('0x40')]()][_0x6be4('0x25')]()});}});}return _0x44f5f0;}function getConnection(_0x22e95d){return request({'method':_0x6be4('0xb'),'form':{'method':_0x6be4('0x46'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'user_auth':{'user_name':_0x22e95d['username'],'password':_0x22e95d['password'],'encryption':_0x6be4('0x47')},'application':_0x6be4('0x48')})}})['then'](function(_0x3cbf5d){var _0x4a952f=_0x3cbf5d;if(_0x4a952f['id']){def['sessionID']=_0x4a952f['id'];return BPromise['resolve'](_0x4a952f);}else{throw new Error(util[_0x6be4('0x23')](_0x6be4('0x49'),_0x22e95d['id']));}});}function setRelationship(_0x2c0792,_0x4b936c,_0x4f3075,_0x58d0f0){return request({'form':{'method':_0x6be4('0x4a'),'input_type':_0x6be4('0x20'),'response_type':_0x6be4('0x20'),'rest_data':JSON[_0x6be4('0x21')]({'session':_0x2c0792['id'],'module_name':_0x6be4('0x22'),'module_id':_0x4f3075['id'],'link_field_name':_0x58d0f0,'related_ids':[_0x4b936c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x6be4('0x4b')]=function(_0x4c417f,_0x556662,_0x3e8279,_0x3a884d,_0x4e8c1f,_0x25bbf2){var _0x9dd1cc,_0x41daf5,_0x344fcb,_0x49a418;_0x25bbf2['remoteUri']=intUtil[_0x6be4('0x4c')](_0x25bbf2[_0x6be4('0x4d')]);_0x25bbf2[_0x6be4('0x4e')]=intUtil[_0x6be4('0x4c')](_0x25bbf2[_0x6be4('0x4e')]);def[_0x6be4('0x4f')]=util[_0x6be4('0x23')]('%s/service/v4_1/rest.php',_0x25bbf2[_0x6be4('0x4d')]);if(_0x4e8c1f&&_0x4e8c1f[_0x6be4('0x50')]){logger[_0x6be4('0xd')]('[QUEUE]','Recording\x20is\x20enabled!');_0x556662['recordingURL']=util[_0x6be4('0x23')](_0x6be4('0x51'),_0x25bbf2[_0x6be4('0x4e')],_0x556662[_0x6be4('0x52')],md5(_0x556662[_0x6be4('0x52')]));}else{_0x556662['recordingURL']='';}return getConnection(_0x25bbf2)[_0x6be4('0x2a')](function(_0x2193f8){_0x49a418=_0x2193f8;return getUser(_0x25bbf2,_0x3a884d[_0x6be4('0xf')],_0x49a418);})[_0x6be4('0x2a')](function(_0xa31317){_0x9dd1cc=_0xa31317;logger['info'](_0x6be4('0x53'),_0x9dd1cc['id']);return getEndUser(_0x25bbf2,_0x556662[_0x6be4('0x54')],_0x556662[_0x6be4('0x55')],_0x49a418);})[_0x6be4('0x2a')](function(_0xf4a59c){_0x41daf5=_0xf4a59c;logger[_0x6be4('0xd')]('The\x20Enduser\x20ID\x20is:',_0x41daf5['id']);return getTicket(_0x25bbf2,_0x9dd1cc,_0x41daf5,_0x3e8279,_0x556662,_0x3e8279[_0x6be4('0x56')],_0x49a418,_0x6be4('0x57'));})[_0x6be4('0x2a')](function(_0x42e5c7){_0x344fcb=_0x42e5c7;logger[_0x6be4('0xd')](_0x6be4('0x58'));logger[_0x6be4('0xd')](_0x6be4('0x59'),_0x344fcb['id']);return setRelationship(_0x49a418,_0x9dd1cc,_0x344fcb,_0x6be4('0x5a'));})[_0x6be4('0x2a')](function(){return setRelationship(_0x49a418,_0x41daf5,_0x344fcb,_0x6be4('0x5b'));})[_0x6be4('0x2a')](function(){return getServerInfo(_0x49a418);})['then'](function(_0x4e89fd){var _0x414c53=parseInt(_0x4e89fd[_0x6be4('0x5c')][_0x6be4('0x5d')](0x0));var _0x1a48b2=util[_0x6be4('0x23')](_0x6be4('0x5e'),_0x25bbf2[_0x6be4('0x4d')],_0x344fcb['id']);if(_0x414c53>0x6){_0x1a48b2=util[_0x6be4('0x23')](_0x6be4('0x5f'),_0x25bbf2['remoteUri'],_0x344fcb['id']);}logger[_0x6be4('0xd')](_0x6be4('0x60'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6be4('0x23')](_0x6be4('0x61'),_0x3a884d['name']),_0x6be4('0x62'),{'uri':_0x1a48b2});})[_0x6be4('0x63')](function(_0x112475){logger[_0x6be4('0x64')](_0x6be4('0x60'),JSON[_0x6be4('0x21')](_0x112475));});};exports['outbound']=function(_0x27cf51,_0x30db23,_0xfee7ac,_0x4706e3,_0x56b4e0,_0x10a85a,_0x5da770){var _0x162f2d,_0x3b5ebd,_0x432c41,_0x599744;_0x10a85a[_0x6be4('0x4d')]=intUtil[_0x6be4('0x4c')](_0x10a85a['remoteUri']);_0x10a85a['serverUrl']=intUtil[_0x6be4('0x4c')](_0x10a85a[_0x6be4('0x4e')]);def['uri']=util[_0x6be4('0x23')](_0x6be4('0x65'),_0x10a85a['remoteUri']);if(_0x5da770&&_0x5da770[_0x6be4('0x66')]&&_0x5da770[_0x6be4('0x66')]!==_0x6be4('0x67')){logger[_0x6be4('0xd')]('[OUTBOUND]',_0x6be4('0x68'));_0x30db23['recordingURL']=util[_0x6be4('0x23')](_0x6be4('0x51'),_0x10a85a[_0x6be4('0x4e')],_0x30db23['uniqueid'],md5(_0x30db23[_0x6be4('0x52')]));}return getConnection(_0x10a85a)[_0x6be4('0x2a')](function(_0xa96edf){_0x599744=_0xa96edf;return getUser(_0x10a85a,_0x4706e3[_0x6be4('0xf')],_0x599744);})['then'](function(_0x2b7e81){_0x162f2d=_0x2b7e81;logger[_0x6be4('0xd')](_0x6be4('0x53'),_0x162f2d['id']);return getEndUser(_0x10a85a,_0x30db23[_0x6be4('0x69')],_0x30db23['destcalleridnum'],_0x599744);})[_0x6be4('0x2a')](function(_0x295ed9){_0x3b5ebd=_0x295ed9;logger['info'](_0x6be4('0x6a'),_0x3b5ebd['id']);return getTicket(_0x10a85a,_0x162f2d,_0x3b5ebd,_0xfee7ac,_0x30db23,_0xfee7ac[_0x6be4('0x56')],_0x599744,_0x6be4('0x6b'));})['then'](function(_0x20a9a7){_0x432c41=_0x20a9a7;logger[_0x6be4('0xd')](_0x6be4('0x58'));logger[_0x6be4('0xd')](_0x6be4('0x59'),_0x432c41['id']);return setRelationship(_0x599744,_0x162f2d,_0x432c41,'users');})[_0x6be4('0x2a')](function(){return setRelationship(_0x599744,_0x3b5ebd,_0x432c41,'contacts');})[_0x6be4('0x2a')](function(){return getServerInfo(_0x599744);})[_0x6be4('0x2a')](function(_0x1e5d35){var _0x392e66=parseInt(_0x1e5d35[_0x6be4('0x5c')]['charAt'](0x0));var _0x48554d=util[_0x6be4('0x23')](_0x6be4('0x5e'),_0x10a85a[_0x6be4('0x4d')],_0x432c41['id']);if(_0x392e66>0x6){_0x48554d=util[_0x6be4('0x23')](_0x6be4('0x5f'),_0x10a85a['remoteUri'],_0x432c41['id']);}logger['info'](_0x6be4('0x6c'),_0x6be4('0x6d'));emit(util[_0x6be4('0x23')]('user:%s',_0x4706e3[_0x6be4('0xf')]),_0x6be4('0x62'),{'uri':_0x48554d});})[_0x6be4('0x63')](function(_0x583da4){logger[_0x6be4('0x64')]('[OUTBOUND]',JSON[_0x6be4('0x21')](_0x583da4));});};exports[_0x6be4('0x6e')]=function(_0xa66c10,_0x2ffbb0,_0x15efb6,_0x3ef266,_0xcdb872,_0x6ef879){var _0x2b41df,_0x38e1bb,_0xb8a0fe,_0x19ea09;_0x6ef879[_0x6be4('0x4d')]=intUtil[_0x6be4('0x4c')](_0x6ef879[_0x6be4('0x4d')]);_0x6ef879[_0x6be4('0x4e')]=intUtil[_0x6be4('0x4c')](_0x6ef879[_0x6be4('0x4e')]);def[_0x6be4('0x4f')]=util['format'](_0x6be4('0x65'),_0x6ef879[_0x6be4('0x4d')]);if(_0xcdb872&&_0xcdb872[_0x6be4('0x50')]){logger[_0x6be4('0xd')]('['+_0x2ffbb0[_0x6be4('0x6f')][_0x6be4('0x70')]()+']',_0x6be4('0x68'));_0x2ffbb0['recordingURL']=util['format'](_0x6be4('0x51'),_0x6ef879[_0x6be4('0x4e')],_0x2ffbb0['uniqueid'],md5(_0x2ffbb0[_0x6be4('0x52')]));}else{_0x2ffbb0[_0x6be4('0x71')]='';}return getConnection(_0x6ef879)[_0x6be4('0x2a')](function(_0x2b9624){_0x19ea09=_0x2b9624;if(!_[_0x6be4('0x72')](_0x3ef266)){return getUser(_0x6ef879,_0x3ef266[_0x6be4('0xf')],_0x19ea09);}else{return getUser(_0x6ef879,null,_0x19ea09);}})[_0x6be4('0x2a')](function(_0x501876){_0x2b41df=_0x501876;logger[_0x6be4('0xd')](_0x6be4('0x53'),_0x2b41df['id']);return getEndUser(_0x6ef879,_0x2ffbb0['calleridname'],_0x2ffbb0[_0x6be4('0x55')],_0x19ea09);})['then'](function(_0x15ad7f){_0x38e1bb=_0x15ad7f;logger['info'](_0x6be4('0x6a'),_0x38e1bb['id']);return getTicket(_0x6ef879,_0x2b41df,_0x38e1bb,_0x15efb6,_0x2ffbb0,_0x15efb6[_0x6be4('0x56')],_0x19ea09,_0x6be4('0x57'));})[_0x6be4('0x2a')](function(_0x3e79a6){_0xb8a0fe=_0x3e79a6;logger['info']('Ticket\x20created!');logger['info'](_0x6be4('0x59'),_0xb8a0fe['id']);return setRelationship(_0x19ea09,_0x2b41df,_0xb8a0fe,'users');})['then'](function(){return setRelationship(_0x19ea09,_0x38e1bb,_0xb8a0fe,_0x6be4('0x5b'));})[_0x6be4('0x2a')](function(){return getServerInfo(_0x19ea09);})[_0x6be4('0x63')](function(_0x365240){logger['error']('['+_0x2ffbb0[_0x6be4('0x6f')][_0x6be4('0x70')]()+']',JSON[_0x6be4('0x21')](_0x365240));});}; \ No newline at end of file +var _0x2f80=['trigger:browser:url','catch','error','unmanaged','calleridnum','Inbound','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','socket.io-emitter','redis','POST','emit','info','Subjects','assigned_user_id','created_by','description','getString','Descriptions','toISOString','duration_hours','duration_minutes','parent_id','name','length','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','name_value_list','resolve','value','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','','Enduser\x20created.','first_name','debug','merge','string','nameField','customField','content','type','custom_fields','variable','customVariable','Variable','toLowerCase','username','password','PLAIN','sessionID','set_relationship','Calls','queue','remoteUri','serverUrl','stripTrailingSlash','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Outbound','version','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2f80,0x16d));var _0x02f8=function(_0x169cc3,_0x389175){_0x169cc3=_0x169cc3-0x0;var _0x152951=_0x2f80[_0x169cc3];return _0x152951;};'use strict';var _=require(_0x02f8('0x0'));var rp=require(_0x02f8('0x1'));var BPromise=require(_0x02f8('0x2'));var md5=require(_0x02f8('0x3'));var util=require(_0x02f8('0x4'));var Redis=require(_0x02f8('0x5'));var intUtil=require(_0x02f8('0x6'));var config=require(_0x02f8('0x7'));var logger=require(_0x02f8('0x8'))('sugarcrm');config['redis']=_[_0x02f8('0x9')](config['redis'],{'host':_0x02f8('0xa'),'port':0x18eb});var io=require(_0x02f8('0xb'))(new Redis(config[_0x02f8('0xc')]));var def={'method':_0x02f8('0xd'),'json':!![]};function emit(_0x2d9e5f,_0x194a3c,_0x24eca3){io['to'](_0x2d9e5f)[_0x02f8('0xe')](_0x194a3c,_0x24eca3);}function getTicket(_0x55ee7c,_0xf80ac0,_0x581416,_0x5e2d2b,_0x5dd1ab,_0x4a38b3,_0x56e330,_0xb49d6e){logger[_0x02f8('0xf')]('Creating\x20new\x20ticket...');var _0x572f1f=new Date();var _0x163444=[{'name':'name','value':intUtil['getString'](_0x5e2d2b[_0x02f8('0x10')],_0x5dd1ab,'\x20')},{'name':_0x02f8('0x11'),'value':_0xf80ac0['id']},{'name':_0x02f8('0x12'),'value':_0xf80ac0['id']},{'name':_0x02f8('0x13'),'value':intUtil[_0x02f8('0x14')](_0x5e2d2b[_0x02f8('0x15')],_0x5dd1ab,'\x0a')},{'name':'date_start','value':_0x572f1f[_0x02f8('0x16')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x02f8('0x17'),'value':'0'},{'name':_0x02f8('0x18'),'value':'15'},{'name':_0x02f8('0x19'),'value':_0x581416['id']},{'name':'parent_type','value':'Contacts'},{'name':'parent_name','value':_0x581416[_0x02f8('0x1a')]},{'name':'direction','value':_0xb49d6e}];if(_0x4a38b3[_0x02f8('0x1b')]){_['forEach'](_0x4a38b3,function(_0x299f52){if(_0x5dd1ab[_0x299f52[_0x02f8('0x1c')]]){_0x163444[_0x02f8('0x1d')]({'name':_0x299f52[_0x02f8('0x1e')],'value':_0x5dd1ab[_0x299f52['variableName']]});}});}return request({'form':{'method':_0x02f8('0x1f'),'input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON[_0x02f8('0x21')]({'session':_0x56e330['id'],'module_name':'Calls','name_value_list':_0x163444})}});}function getAuth(_0x23ef4e){return util[_0x02f8('0x22')](_0x02f8('0x23'),new Buffer(_0x23ef4e[_0x02f8('0x24')]+':X')[_0x02f8('0x25')](_0x02f8('0x26')));}function getServerInfo(_0x5cf577){return request({'form':{'method':_0x02f8('0x27'),'input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON['stringify']({'session':_0x5cf577['id']})}});}function getUser(_0x553237,_0x2f6fe6,_0x20ab38){if(!_[_0x02f8('0x28')](_0x2f6fe6)){logger[_0x02f8('0xf')](_0x02f8('0x29'),_0x2f6fe6);return request({'form':{'method':_0x02f8('0x2a'),'input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON['stringify']({'session':_0x20ab38['id'],'module_name':_0x02f8('0x2b'),'query':util['format'](_0x02f8('0x2c'),_0x2f6fe6),'order_by':'','offset':'0','select_fields':['id',_0x02f8('0x1a'),_0x02f8('0x2d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x02f8('0x2e')](function(_0x1b7bf7){if(_0x1b7bf7[_0x02f8('0x2f')][_0x02f8('0x1b')]){var _0x6b053b=_[_0x02f8('0x30')](_0x1b7bf7[_0x02f8('0x2f')],function(_0x10d5d2){return _0x10d5d2[_0x02f8('0x31')][_0x02f8('0x2d')]['value']===_0x2f6fe6;});if(_0x6b053b){logger[_0x02f8('0xf')]('Agent\x20found!');return BPromise[_0x02f8('0x32')]({'id':_0x6b053b['name_value_list']['id'][_0x02f8('0x33')],'name':_0x6b053b[_0x02f8('0x31')][_0x02f8('0x1a')][_0x02f8('0x33')]});}}logger[_0x02f8('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x02f8('0x32')]({'id':_0x20ab38[_0x02f8('0x31')]['user_id'][_0x02f8('0x33')],'name':_0x20ab38[_0x02f8('0x31')]['user_name'][_0x02f8('0x33')]});});}else{logger[_0x02f8('0xf')](_0x02f8('0x34'));return BPromise[_0x02f8('0x32')]({'id':_0x20ab38['name_value_list'][_0x02f8('0x35')][_0x02f8('0x33')],'name':_0x20ab38[_0x02f8('0x31')]['user_name'][_0x02f8('0x33')]});}}function getEndUser(_0x2eb885,_0x5bfb46,_0x5941b5,_0x40dd88){logger['info'](_0x02f8('0x36'),_0x5941b5);return request({'form':{'method':_0x02f8('0x2a'),'input_type':_0x02f8('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x40dd88['id'],'module_name':_0x02f8('0x37'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x5941b5),'order_by':'','offset':'0','select_fields':['id',_0x02f8('0x1a'),_0x02f8('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x02f8('0x2e')](function(_0x115af5){if(_0x115af5[_0x02f8('0x2f')]['length']){var _0x157f0f=_[_0x02f8('0x30')](_0x115af5[_0x02f8('0x2f')],function(_0x262614){return _0x262614[_0x02f8('0x31')]['phone_home'][_0x02f8('0x33')]===_0x5941b5;});if(_0x157f0f){logger[_0x02f8('0xf')](_0x02f8('0x39'));return BPromise[_0x02f8('0x32')]({'id':_0x157f0f[_0x02f8('0x31')]['id']['value'],'name':_0x157f0f['name_value_list'][_0x02f8('0x1a')][_0x02f8('0x33')],'phone':_0x157f0f[_0x02f8('0x31')][_0x02f8('0x38')]['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x02f8('0x1f'),'input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON[_0x02f8('0x21')]({'session':_0x40dd88['id'],'module_name':_0x02f8('0x37'),'name_value_list':[{'name':'first_name','value':_0x5bfb46!==_0x02f8('0x3a')?_0x5bfb46:util[_0x02f8('0x22')]('Caller\x20-\x20%s',_0x5941b5)},{'name':_0x02f8('0x38'),'value':_0x5941b5}]})}})[_0x02f8('0x2e')](function(_0x2304ef){logger[_0x02f8('0xf')](_0x02f8('0x3b'));return BPromise[_0x02f8('0x32')]({'id':_0x2304ef['id'],'name':_0x2304ef[_0x02f8('0x2f')][_0x02f8('0x3c')]['value'],'phone':_0x2304ef['entry_list']['phone_home'][_0x02f8('0x33')]});});}});}function request(_0x238f4f){logger[_0x02f8('0x3d')]('[HTTP]',JSON[_0x02f8('0x21')](_0x238f4f));return rp(_[_0x02f8('0x3e')](def,_0x238f4f));}function getTags(_0x426977,_0x12a478){var _0x5f47cb=[];if(_0x426977&&_0x426977[_0x02f8('0x1b')]>0x0){_0x5f47cb=_['map'](_0x426977,_0x12a478);}return _0x5f47cb;}function getCustomFields(_0x4bce19,_0x25c815){var _0x1da842=[];var _0x1dcd15={'custom_fields':[]};if(_0x4bce19[_0x02f8('0x1b')]>0x0){_['forEach'](_0x4bce19,function(_0x10f0b5){if(_0x10f0b5['type']===_0x02f8('0x3f')&&_0x10f0b5[_0x02f8('0x40')]&&!_0x10f0b5[_0x02f8('0x41')]){_0x1dcd15[_0x10f0b5['nameField']['toLowerCase']()]=_0x10f0b5[_0x02f8('0x42')][_0x02f8('0x25')]();}else if(_0x10f0b5[_0x02f8('0x43')]===_0x02f8('0x3f')&&_0x10f0b5[_0x02f8('0x1e')]&&_0x10f0b5[_0x02f8('0x41')]){_0x1dcd15[_0x02f8('0x44')][_0x02f8('0x1d')]({'id':_0x10f0b5['idField'],'value':_0x10f0b5[_0x02f8('0x42')][_0x02f8('0x25')]()});}else if(_0x10f0b5[_0x02f8('0x43')]===_0x02f8('0x45')&&_0x10f0b5[_0x02f8('0x1c')]&&_0x10f0b5[_0x02f8('0x1e')]&&_0x10f0b5[_0x02f8('0x41')]){_0x25c815[_0x10f0b5[_0x02f8('0x1c')]]&&_0x1dcd15[_0x02f8('0x44')]['push']({'id':_0x10f0b5[_0x02f8('0x1e')],'value':_0x25c815[_0x10f0b5['variableName']][_0x02f8('0x25')]()});}else if(_0x10f0b5[_0x02f8('0x43')]===_0x02f8('0x46')&&_0x10f0b5['Variable']&&_0x10f0b5[_0x02f8('0x47')]['name']&&_0x10f0b5[_0x02f8('0x1e')]&&_0x10f0b5[_0x02f8('0x41')]){_0x25c815[_0x10f0b5['Variable'][_0x02f8('0x1a')][_0x02f8('0x48')]()]&&_0x1dcd15[_0x02f8('0x44')][_0x02f8('0x1d')]({'id':_0x10f0b5[_0x02f8('0x1e')],'value':_0x25c815[_0x10f0b5[_0x02f8('0x47')][_0x02f8('0x1a')][_0x02f8('0x48')]()][_0x02f8('0x25')]()});}});}return _0x1dcd15;}function getConnection(_0x178840){return request({'method':_0x02f8('0xd'),'form':{'method':'login','input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON[_0x02f8('0x21')]({'user_auth':{'user_name':_0x178840[_0x02f8('0x49')],'password':_0x178840[_0x02f8('0x4a')],'encryption':_0x02f8('0x4b')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x02f8('0x2e')](function(_0x24b40a){var _0x5e10ae=_0x24b40a;if(_0x5e10ae['id']){def[_0x02f8('0x4c')]=_0x5e10ae['id'];return BPromise[_0x02f8('0x32')](_0x5e10ae);}else{throw new Error(util[_0x02f8('0x22')]('Account\x20%d\x20is\x20not\x20valid',_0x178840['id']));}});}function setRelationship(_0x23c8fc,_0x44af27,_0x37afe8,_0x16faca){return request({'form':{'method':_0x02f8('0x4d'),'input_type':_0x02f8('0x20'),'response_type':_0x02f8('0x20'),'rest_data':JSON[_0x02f8('0x21')]({'session':_0x23c8fc['id'],'module_name':_0x02f8('0x4e'),'module_id':_0x37afe8['id'],'link_field_name':_0x16faca,'related_ids':[_0x44af27['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x02f8('0x4f')]=function(_0x5323c1,_0x47263e,_0x39d54b,_0x58c02b,_0x397cc9,_0x3cea8e){var _0x2d06f3,_0x2bb796,_0x49816e,_0x25d893;_0x3cea8e[_0x02f8('0x50')]=intUtil['stripTrailingSlash'](_0x3cea8e['remoteUri']);_0x3cea8e[_0x02f8('0x51')]=intUtil[_0x02f8('0x52')](_0x3cea8e[_0x02f8('0x51')]);def[_0x02f8('0x53')]=util[_0x02f8('0x22')]('%s/service/v4_1/rest.php',_0x3cea8e[_0x02f8('0x50')]);if(_0x397cc9&&_0x397cc9[_0x02f8('0x54')]){logger[_0x02f8('0xf')](_0x02f8('0x55'),_0x02f8('0x56'));_0x47263e['recordingURL']=util[_0x02f8('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3cea8e[_0x02f8('0x51')],_0x47263e[_0x02f8('0x57')],md5(_0x47263e[_0x02f8('0x57')]));}else{_0x47263e[_0x02f8('0x58')]='';}return getConnection(_0x3cea8e)['then'](function(_0x10421d){_0x25d893=_0x10421d;return getUser(_0x3cea8e,_0x58c02b[_0x02f8('0x1a')],_0x25d893);})['then'](function(_0x5842a2){_0x2d06f3=_0x5842a2;logger[_0x02f8('0xf')](_0x02f8('0x59'),_0x2d06f3['id']);return getEndUser(_0x3cea8e,_0x47263e[_0x02f8('0x5a')],_0x47263e['calleridnum'],_0x25d893);})[_0x02f8('0x2e')](function(_0x4e3dd9){_0x2bb796=_0x4e3dd9;logger['info'](_0x02f8('0x5b'),_0x2bb796['id']);return getTicket(_0x3cea8e,_0x2d06f3,_0x2bb796,_0x39d54b,_0x47263e,_0x39d54b[_0x02f8('0x5c')],_0x25d893,'Inbound');})[_0x02f8('0x2e')](function(_0x3d851f){_0x49816e=_0x3d851f;logger['info'](_0x02f8('0x5d'));logger['info'](_0x02f8('0x5e'),_0x49816e['id']);return setRelationship(_0x25d893,_0x2d06f3,_0x49816e,_0x02f8('0x5f'));})[_0x02f8('0x2e')](function(){return setRelationship(_0x25d893,_0x2bb796,_0x49816e,_0x02f8('0x60'));})[_0x02f8('0x2e')](function(){return getServerInfo(_0x25d893);})[_0x02f8('0x2e')](function(_0x309132){var _0x25b4f1=parseInt(_0x309132['version'][_0x02f8('0x61')](0x0));var _0x501271=util['format'](_0x02f8('0x62'),_0x3cea8e[_0x02f8('0x50')],_0x49816e['id']);if(_0x25b4f1>0x6){_0x501271=util['format'](_0x02f8('0x63'),_0x3cea8e['remoteUri'],_0x49816e['id']);}logger[_0x02f8('0xf')](_0x02f8('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x02f8('0x22')](_0x02f8('0x64'),_0x58c02b[_0x02f8('0x1a')]),'trigger:browser:url',{'uri':_0x501271});})['catch'](function(_0x2d2ca8){logger['error'](_0x02f8('0x55'),JSON[_0x02f8('0x21')](_0x2d2ca8));});};exports[_0x02f8('0x65')]=function(_0x589a64,_0x5c348c,_0x2d6c3c,_0x1370f3,_0xedac09,_0x1dcef3,_0x5aae81){var _0x3353b4,_0x5cc073,_0x5f1eca,_0x343234;_0x1dcef3[_0x02f8('0x50')]=intUtil[_0x02f8('0x52')](_0x1dcef3[_0x02f8('0x50')]);_0x1dcef3[_0x02f8('0x51')]=intUtil[_0x02f8('0x52')](_0x1dcef3[_0x02f8('0x51')]);def[_0x02f8('0x53')]=util['format'](_0x02f8('0x66'),_0x1dcef3[_0x02f8('0x50')]);if(_0x5aae81&&_0x5aae81['recordingFormat']&&_0x5aae81[_0x02f8('0x67')]!==_0x02f8('0x68')){logger[_0x02f8('0xf')](_0x02f8('0x69'),_0x02f8('0x56'));_0x5c348c[_0x02f8('0x58')]=util[_0x02f8('0x22')](_0x02f8('0x6a'),_0x1dcef3[_0x02f8('0x51')],_0x5c348c['uniqueid'],md5(_0x5c348c[_0x02f8('0x57')]));}return getConnection(_0x1dcef3)[_0x02f8('0x2e')](function(_0x592ced){_0x343234=_0x592ced;return getUser(_0x1dcef3,_0x1370f3['name'],_0x343234);})[_0x02f8('0x2e')](function(_0x4787ca){_0x3353b4=_0x4787ca;logger[_0x02f8('0xf')](_0x02f8('0x59'),_0x3353b4['id']);return getEndUser(_0x1dcef3,_0x5c348c['destcalleridname'],_0x5c348c[_0x02f8('0x6b')],_0x343234);})[_0x02f8('0x2e')](function(_0x388373){_0x5cc073=_0x388373;logger[_0x02f8('0xf')]('The\x20Enduser\x20ID\x20is:',_0x5cc073['id']);return getTicket(_0x1dcef3,_0x3353b4,_0x5cc073,_0x2d6c3c,_0x5c348c,_0x2d6c3c[_0x02f8('0x5c')],_0x343234,_0x02f8('0x6c'));})['then'](function(_0x2eef15){_0x5f1eca=_0x2eef15;logger['info'](_0x02f8('0x5d'));logger[_0x02f8('0xf')](_0x02f8('0x5e'),_0x5f1eca['id']);return setRelationship(_0x343234,_0x3353b4,_0x5f1eca,_0x02f8('0x5f'));})[_0x02f8('0x2e')](function(){return setRelationship(_0x343234,_0x5cc073,_0x5f1eca,_0x02f8('0x60'));})[_0x02f8('0x2e')](function(){return getServerInfo(_0x343234);})[_0x02f8('0x2e')](function(_0x14faea){var _0x872537=parseInt(_0x14faea[_0x02f8('0x6d')]['charAt'](0x0));var _0x4d3897=util[_0x02f8('0x22')](_0x02f8('0x62'),_0x1dcef3['remoteUri'],_0x5f1eca['id']);if(_0x872537>0x6){_0x4d3897=util[_0x02f8('0x22')](_0x02f8('0x63'),_0x1dcef3['remoteUri'],_0x5f1eca['id']);}logger[_0x02f8('0xf')]('[OUTBOUND]',_0x02f8('0x6e'));emit(util[_0x02f8('0x22')](_0x02f8('0x64'),_0x1370f3[_0x02f8('0x1a')]),_0x02f8('0x6f'),{'uri':_0x4d3897});})[_0x02f8('0x70')](function(_0x42e6c0){logger[_0x02f8('0x71')](_0x02f8('0x69'),JSON['stringify'](_0x42e6c0));});};exports[_0x02f8('0x72')]=function(_0x222b1b,_0x5ba316,_0x5904b2,_0x1bbd6b,_0x1811a9,_0x51a740){var _0x3e66fe,_0x41f483,_0xb7d61a,_0x25d06d;_0x51a740['remoteUri']=intUtil['stripTrailingSlash'](_0x51a740[_0x02f8('0x50')]);_0x51a740[_0x02f8('0x51')]=intUtil[_0x02f8('0x52')](_0x51a740[_0x02f8('0x51')]);def[_0x02f8('0x53')]=util[_0x02f8('0x22')]('%s/service/v4_1/rest.php',_0x51a740[_0x02f8('0x50')]);if(_0x1811a9&&_0x1811a9[_0x02f8('0x54')]){logger[_0x02f8('0xf')]('['+_0x5ba316['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x5ba316['recordingURL']=util['format'](_0x02f8('0x6a'),_0x51a740['serverUrl'],_0x5ba316[_0x02f8('0x57')],md5(_0x5ba316['uniqueid']));}else{_0x5ba316['recordingURL']='';}return getConnection(_0x51a740)['then'](function(_0x27585b){_0x25d06d=_0x27585b;if(!_[_0x02f8('0x28')](_0x1bbd6b)){return getUser(_0x51a740,_0x1bbd6b[_0x02f8('0x1a')],_0x25d06d);}else{return getUser(_0x51a740,null,_0x25d06d);}})['then'](function(_0x146435){_0x3e66fe=_0x146435;logger[_0x02f8('0xf')](_0x02f8('0x59'),_0x3e66fe['id']);return getEndUser(_0x51a740,_0x5ba316[_0x02f8('0x5a')],_0x5ba316[_0x02f8('0x73')],_0x25d06d);})[_0x02f8('0x2e')](function(_0x1ed0f7){_0x41f483=_0x1ed0f7;logger[_0x02f8('0xf')](_0x02f8('0x5b'),_0x41f483['id']);return getTicket(_0x51a740,_0x3e66fe,_0x41f483,_0x5904b2,_0x5ba316,_0x5904b2[_0x02f8('0x5c')],_0x25d06d,_0x02f8('0x74'));})['then'](function(_0x35f19a){_0xb7d61a=_0x35f19a;logger[_0x02f8('0xf')](_0x02f8('0x5d'));logger[_0x02f8('0xf')](_0x02f8('0x5e'),_0xb7d61a['id']);return setRelationship(_0x25d06d,_0x3e66fe,_0xb7d61a,_0x02f8('0x5f'));})[_0x02f8('0x2e')](function(){return setRelationship(_0x25d06d,_0x41f483,_0xb7d61a,_0x02f8('0x60'));})['then'](function(){return getServerInfo(_0x25d06d);})[_0x02f8('0x70')](function(_0xc8f915){logger[_0x02f8('0x71')]('['+_0x5ba316[_0x02f8('0x75')][_0x02f8('0x76')]()+']',JSON['stringify'](_0xc8f915));});}; \ 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 2ae9668..25b96b9 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 _0xa6c8=['test','lodash','util','getString','length','sortBy','type','string','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xa6c8,0x1b1));var _0x8a6c=function(_0x4b8cf4,_0x22cdc1){_0x4b8cf4=_0x4b8cf4-0x0;var _0xd01f29=_0xa6c8[_0x4b8cf4];return _0xd01f29;};'use strict';var _=require(_0x8a6c('0x0'));var util=require(_0x8a6c('0x1'));exports[_0x8a6c('0x2')]=function(_0x376892,_0xc3b290,_0x4d2f7b){var _0x30c34=[];if(_0x376892[_0x8a6c('0x3')]>0x0){var _0x2eb729=_[_0x8a6c('0x4')](_0x376892,['id']);for(var _0x54888a=0x0;_0x54888a<_0x2eb729[_0x8a6c('0x3')];_0x54888a++){var _0x176e6e=_0x2eb729[_0x54888a];if(_0x176e6e[_0x8a6c('0x5')]===_0x8a6c('0x6')){_0x30c34[_0x8a6c('0x7')](_0x176e6e[_0x8a6c('0x8')]);}else if(_0x176e6e['type']===_0x8a6c('0x9')&&_0x176e6e[_0x8a6c('0xa')]){_0xc3b290[_0x176e6e[_0x8a6c('0xa')]]&&_0x30c34[_0x8a6c('0x7')](_0xc3b290[_0x176e6e[_0x8a6c('0xa')]]['toString']());}else if(_0x176e6e[_0x8a6c('0x5')]===_0x8a6c('0xb')&&_0x176e6e['Variable']&&_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')]){_0xc3b290[_0x176e6e[_0x8a6c('0xc')]['name'][_0x8a6c('0xe')]()]&&_0x30c34['push'](_0xc3b290[_0x176e6e['Variable'][_0x8a6c('0xd')][_0x8a6c('0xe')]()]['toString']());}else if(_0x176e6e['type']==='keyValue'){if(_0x176e6e[_0x8a6c('0xf')]==='string'&&_0x176e6e[_0x8a6c('0x10')]){_0x30c34[_0x8a6c('0x7')](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e[_0x8a6c('0x10')],_0x176e6e[_0x8a6c('0x13')]));}else if(_0x176e6e[_0x8a6c('0xf')]===_0x8a6c('0x9')&&_0x176e6e[_0x8a6c('0xa')]&&_0x176e6e[_0x8a6c('0x10')]){_0xc3b290[_0x176e6e['variableName']]&&_0x30c34['push'](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e['key'],_0xc3b290[_0x176e6e['variableName']]));}else if(_0x176e6e[_0x8a6c('0xf')]===_0x8a6c('0xb')&&_0x176e6e[_0x8a6c('0xc')]&&_0x176e6e['Variable'][_0x8a6c('0xd')]&&_0x176e6e[_0x8a6c('0x10')]){_0xc3b290[_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')][_0x8a6c('0xe')]()]&&_0x30c34[_0x8a6c('0x7')](util[_0x8a6c('0x11')](_0x8a6c('0x12'),_0x176e6e[_0x8a6c('0x10')],_0xc3b290[_0x176e6e[_0x8a6c('0xc')][_0x8a6c('0xd')][_0x8a6c('0xe')]()]));}}}}return _0x30c34[_0x8a6c('0x14')](_0x4d2f7b);};exports[_0x8a6c('0x15')]=function(_0x5b9721){var _0x175b77=_0x5b9721[_0x8a6c('0x16')](-0x1);if(_0x175b77==='/'){_0x5b9721=_0x5b9721[_0x8a6c('0x17')](0x0,_0x5b9721[_0x8a6c('0x18')](_0x175b77));}return _0x5b9721;};exports['validateEmail']=function(_0x2229f6){if(!_[_0x8a6c('0x19')](_0x2229f6)&&_0x2229f6!==''){var _0x17a933=/^(([^<>()\[\]\\.,;:\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 _0x17a933[_0x8a6c('0x1a')](String(_0x2229f6)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xa18d=['variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyType','key','format','keyContent','%s:\x20%s','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa18d,0x1f0));var _0xda18=function(_0x35f822,_0x163191){_0x35f822=_0x35f822-0x0;var _0xa07099=_0xa18d[_0x35f822];return _0xa07099;};'use strict';var _=require(_0xda18('0x0'));var util=require(_0xda18('0x1'));exports[_0xda18('0x2')]=function(_0x20a9cd,_0xa65c9c,_0x452e36){var _0x3d879b=[];if(_0x20a9cd[_0xda18('0x3')]>0x0){var _0x4c0f02=_[_0xda18('0x4')](_0x20a9cd,['id']);for(var _0x5bceeb=0x0;_0x5bceeb<_0x4c0f02[_0xda18('0x3')];_0x5bceeb++){var _0x8d5a34=_0x4c0f02[_0x5bceeb];if(_0x8d5a34[_0xda18('0x5')]===_0xda18('0x6')){_0x3d879b[_0xda18('0x7')](_0x8d5a34['content']);}else if(_0x8d5a34[_0xda18('0x5')]===_0xda18('0x8')&&_0x8d5a34[_0xda18('0x9')]){_0xa65c9c[_0x8d5a34[_0xda18('0x9')]]&&_0x3d879b[_0xda18('0x7')](_0xa65c9c[_0x8d5a34['variableName']]['toString']());}else if(_0x8d5a34['type']===_0xda18('0xa')&&_0x8d5a34['Variable']&&_0x8d5a34[_0xda18('0xb')][_0xda18('0xc')]){_0xa65c9c[_0x8d5a34[_0xda18('0xb')][_0xda18('0xc')][_0xda18('0xd')]()]&&_0x3d879b[_0xda18('0x7')](_0xa65c9c[_0x8d5a34[_0xda18('0xb')][_0xda18('0xc')][_0xda18('0xd')]()][_0xda18('0xe')]());}else if(_0x8d5a34[_0xda18('0x5')]==='keyValue'){if(_0x8d5a34[_0xda18('0xf')]===_0xda18('0x6')&&_0x8d5a34[_0xda18('0x10')]){_0x3d879b['push'](util[_0xda18('0x11')]('%s:\x20%s',_0x8d5a34[_0xda18('0x10')],_0x8d5a34[_0xda18('0x12')]));}else if(_0x8d5a34[_0xda18('0xf')]==='variable'&&_0x8d5a34[_0xda18('0x9')]&&_0x8d5a34[_0xda18('0x10')]){_0xa65c9c[_0x8d5a34[_0xda18('0x9')]]&&_0x3d879b['push'](util[_0xda18('0x11')]('%s:\x20%s',_0x8d5a34['key'],_0xa65c9c[_0x8d5a34['variableName']]));}else if(_0x8d5a34[_0xda18('0xf')]===_0xda18('0xa')&&_0x8d5a34[_0xda18('0xb')]&&_0x8d5a34['Variable']['name']&&_0x8d5a34[_0xda18('0x10')]){_0xa65c9c[_0x8d5a34[_0xda18('0xb')]['name'][_0xda18('0xd')]()]&&_0x3d879b[_0xda18('0x7')](util['format'](_0xda18('0x13'),_0x8d5a34['key'],_0xa65c9c[_0x8d5a34['Variable']['name']['toLowerCase']()]));}}}}return _0x3d879b[_0xda18('0x14')](_0x452e36);};exports[_0xda18('0x15')]=function(_0x239110){var _0x36d749=_0x239110[_0xda18('0x16')](-0x1);if(_0x36d749==='/'){_0x239110=_0x239110[_0xda18('0x17')](0x0,_0x239110[_0xda18('0x18')](_0x36d749));}return _0x239110;};exports[_0xda18('0x19')]=function(_0x136202){if(!_[_0xda18('0x1a')](_0x136202)&&_0x136202!==''){var _0x253fa3=/^(([^<>()\[\]\\.,;:\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 _0x253fa3[_0xda18('0x1b')](String(_0x136202)[_0xda18('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 68cbce2..b281784 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x17882c,_0x4b964b){var _0x355a59=function(_0x534b5b){while(--_0x534b5b){_0x17882c['push'](_0x17882c['shift']());}};_0x355a59(++_0x4b964b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +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(_0x4c8ce8,_0x10aeee){var _0x1013d6=function(_0x61784a){while(--_0x61784a){_0x4c8ce8['push'](_0x4c8ce8['shift']());}};_0x1013d6(++_0x10aeee);}(_0xe706,0xa3));var _0x6e70=function(_0x4dd524,_0x2247e5){_0x4dd524=_0x4dd524-0x0;var _0x482629=_0xe706[_0x4dd524];return _0x482629;};'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 7b6b928..f7dc44f 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 _0x6f4e=['content','picklist','type','idField','custom_fields','push','variable','variableName','customVariable','name','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','/api/v2','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','trigger:browser:url','replace','Zendesk\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','calleridname','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','request-promise','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','results','end-user','first','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','debug','[HTTP]','stringify','GET','map','includes','string','nameField','customField','toLowerCase'];(function(_0x2978e1,_0x26b3f5){var _0xca0ea8=function(_0x289c2e){while(--_0x289c2e){_0x2978e1['push'](_0x2978e1['shift']());}};_0xca0ea8(++_0x26b3f5);}(_0x6f4e,0x1dd));var _0xe6f4=function(_0x2efe86,_0x30867f){_0x2efe86=_0x2efe86-0x0;var _0xcc7579=_0x6f4e[_0x2efe86];return _0xcc7579;};'use strict';var _=require(_0xe6f4('0x0'));var rp=require(_0xe6f4('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xe6f4('0x2'));var intUtil=require(_0xe6f4('0x3'));var config=require('../../../../config/environment');var logger=require(_0xe6f4('0x4'))('zendesk');config[_0xe6f4('0x5')]=_[_0xe6f4('0x6')](config[_0xe6f4('0x5')],{'host':_0xe6f4('0x7'),'port':0x18eb});var io=require(_0xe6f4('0x8'))(new Redis(config['redis']));function emit(_0x406364,_0x18d39b,_0x289f05){io['to'](_0x406364)[_0xe6f4('0x9')](_0x18d39b,_0x289f05);}var headers={'Content-Type':_0xe6f4('0xa'),'Accept':_0xe6f4('0xa')};function getTicket(_0x1f0f1a,_0x5b3f26,_0x3efeb3,_0x5dcb0c,_0x461097){logger[_0xe6f4('0xb')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0xd'),_0x1f0f1a[_0xe6f4('0xe')]),'method':_0xe6f4('0xf'),'body':{'ticket':_[_0xe6f4('0x10')]({'requester_id':_0x3efeb3['id'],'submitter_id':_0x5b3f26?_0x5b3f26['id']:undefined,'assignee_id':_0x5b3f26?_0x5b3f26['id']:undefined,'tags':getTags(_0x5dcb0c['Tags'],'name'),'subject':intUtil[_0xe6f4('0x11')](_0x5dcb0c[_0xe6f4('0x12')],_0x461097,'\x20'),'description':intUtil['getString'](_0x5dcb0c[_0xe6f4('0x13')],_0x461097,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe6f4('0x11')](_0x5dcb0c[_0xe6f4('0x13')],_0x461097,'\x0a')}},getCustomFields(_0x5dcb0c[_0xe6f4('0x14')],_0x461097))}})[_0xe6f4('0x15')](function(_0x2461f3){logger[_0xe6f4('0xb')]('Ticket\x20created!');return _0x2461f3[_0xe6f4('0x16')];});}function getUser(_0x1bfdc6,_0x26083e){if(intUtil[_0xe6f4('0x17')](_0x26083e)){logger[_0xe6f4('0xb')](_0xe6f4('0x18'),_0x26083e);return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x19'),_0x1bfdc6[_0xe6f4('0xe')]),'qs':{'query':util[_0xe6f4('0xc')](_0xe6f4('0x1a'),_0x26083e)}})[_0xe6f4('0x15')](function(_0x3ed287){if(_0x3ed287[_0xe6f4('0x1b')]){logger[_0xe6f4('0xb')](_0xe6f4('0x1c'));return _['find'](_0x3ed287['results'],{'email':_0x26083e,'role':_0xe6f4('0x1d')});}else{logger[_0xe6f4('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x1e'),_0x1bfdc6['remoteUri'])})[_0xe6f4('0x15')](function(_0x5e03ae){logger[_0xe6f4('0xb')](_0xe6f4('0x1f'));return _0x5e03ae[_0xe6f4('0x20')];});}});}else{logger[_0xe6f4('0xb')](_0xe6f4('0x21'));return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x1e'),_0x1bfdc6[_0xe6f4('0xe')])})[_0xe6f4('0x15')](function(_0x53353e){logger[_0xe6f4('0xb')](_0xe6f4('0x1f'));return _0x53353e[_0xe6f4('0x20')];});}}function getEndUser(_0x254655,_0x6d9101,_0x48c095){logger[_0xe6f4('0xb')](_0xe6f4('0x22'),_0x48c095);return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x19'),_0x254655[_0xe6f4('0xe')]),'qs':{'query':util[_0xe6f4('0xc')]('type:user\x20role:end-user\x20phone:%s',_0x48c095)}})['then'](function(_0x2a118c){var _0x46e00b;if(_0x2a118c['results'][_0xe6f4('0x23')]){_0x2a118c[_0xe6f4('0x24')]=_['filter'](_0x2a118c['results'],{'suspended':![],'role':_0xe6f4('0x25')});if(_0x2a118c[_0xe6f4('0x24')][_0xe6f4('0x23')]){_0x46e00b=_[_0xe6f4('0x26')](_0x2a118c[_0xe6f4('0x24')]);}}if(_0x46e00b){logger[_0xe6f4('0xb')]('Enduser\x20found!');return _0x46e00b;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/users.json',_0x254655[_0xe6f4('0xe')]),'method':_0xe6f4('0xf'),'body':{'user':{'role':_0xe6f4('0x25'),'name':util[_0xe6f4('0xc')](_0xe6f4('0x27'),_0x6d9101||_0x48c095),'phone':_0x48c095}}})[_0xe6f4('0x15')](function(_0x50ae93){logger['info'](_0xe6f4('0x28'));return _0x50ae93[_0xe6f4('0x20')];});}});}function getAuth(_0x167db0){var _0x51a3eb;if(_0x167db0[_0xe6f4('0x29')]===_0xe6f4('0x2a')){_0x51a3eb=util['format'](_0xe6f4('0x2b'),_0x167db0[_0xe6f4('0x2c')],_0x167db0[_0xe6f4('0x2a')]);}else if(_0x167db0[_0xe6f4('0x29')]===_0xe6f4('0x2d')){_0x51a3eb=util[_0xe6f4('0xc')]('%s/token:%s',_0x167db0[_0xe6f4('0x2c')],_0x167db0[_0xe6f4('0x2d')]);}return util['format'](_0xe6f4('0x2e'),new Buffer(_0x51a3eb)[_0xe6f4('0x2f')]('base64'));}function request(_0x1bffc2){logger[_0xe6f4('0x30')](_0xe6f4('0x31'),JSON[_0xe6f4('0x32')](_0x1bffc2));return rp(_[_0xe6f4('0x6')](_0x1bffc2,{'method':_0xe6f4('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x46bd73,_0x44c761){var _0x1c1d79=[];if(_0x46bd73&&_0x46bd73[_0xe6f4('0x23')]>0x0){_0x1c1d79=_[_0xe6f4('0x34')](_0x46bd73,_0x44c761);}return _0x1c1d79;}function getCustomFields(_0x1910c6,_0xa6b5e9){var _0x4e517a=[];var _0x1433cd={'custom_fields':[]};if(_0x1910c6['length']>0x0){_['forEach'](_0x1910c6,function(_0x3466e5){if(_[_0xe6f4('0x35')]([_0xe6f4('0x36'),'picklist'],_0x3466e5['type'])&&_0x3466e5[_0xe6f4('0x37')]&&!_0x3466e5[_0xe6f4('0x38')]){_0x1433cd[_0x3466e5[_0xe6f4('0x37')][_0xe6f4('0x39')]()]=_0x3466e5[_0xe6f4('0x3a')][_0xe6f4('0x2f')]();}else if(_[_0xe6f4('0x35')]([_0xe6f4('0x36'),_0xe6f4('0x3b')],_0x3466e5[_0xe6f4('0x3c')])&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5['customField']){_0x1433cd[_0xe6f4('0x3e')][_0xe6f4('0x3f')]({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0x3466e5[_0xe6f4('0x3a')][_0xe6f4('0x2f')]()});}else if(_0x3466e5['type']===_0xe6f4('0x40')&&_0x3466e5['variableName']&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5[_0xe6f4('0x38')]){_0xa6b5e9[_0x3466e5[_0xe6f4('0x41')]]&&_0x1433cd[_0xe6f4('0x3e')]['push']({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0xa6b5e9[_0x3466e5[_0xe6f4('0x41')]][_0xe6f4('0x2f')]()});}else if(_0x3466e5[_0xe6f4('0x3c')]===_0xe6f4('0x42')&&_0x3466e5['Variable']&&_0x3466e5['Variable'][_0xe6f4('0x43')]&&_0x3466e5[_0xe6f4('0x3d')]&&_0x3466e5[_0xe6f4('0x38')]){_0xa6b5e9[_0x3466e5[_0xe6f4('0x44')][_0xe6f4('0x43')][_0xe6f4('0x39')]()]&&_0x1433cd['custom_fields'][_0xe6f4('0x3f')]({'id':_0x3466e5[_0xe6f4('0x3d')],'value':_0xa6b5e9[_0x3466e5[_0xe6f4('0x44')]['name'][_0xe6f4('0x39')]()][_0xe6f4('0x2f')]()});}});}return _0x1433cd;}exports[_0xe6f4('0x45')]=function(_0x3518a2,_0x3bf77d,_0x1e5d05,_0x438258,_0x7f5ad9,_0x5bf973){var _0x58da72,_0x488412;_0x5bf973[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x5bf973[_0xe6f4('0xe')]);_0x5bf973[_0xe6f4('0x47')]=intUtil['stripTrailingSlash'](_0x5bf973[_0xe6f4('0x47')]);if(_0x7f5ad9&&_0x7f5ad9[_0xe6f4('0x48')]){logger[_0xe6f4('0xb')]('[QUEUE]',_0xe6f4('0x49'));_0x3bf77d[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5bf973[_0xe6f4('0x47')],_0x3bf77d[_0xe6f4('0x4b')],md5(_0x3bf77d[_0xe6f4('0x4b')]));}else{_0x3bf77d[_0xe6f4('0x4a')]='';}headers[_0xe6f4('0x4c')]=getAuth(_0x5bf973);return getUser(_0x5bf973,_0x438258[_0xe6f4('0x4d')])['then'](function(_0x35855a){_0x58da72=_0x35855a;logger[_0xe6f4('0xb')]('The\x20User\x20ID\x20is:',_0x58da72['id']);return getEndUser(_0x5bf973,_0x3bf77d['calleridname'],_0x3bf77d['calleridnum']);})[_0xe6f4('0x15')](function(_0x4a973e){_0x488412=_0x4a973e;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x488412['id']);return getTicket(_0x5bf973,_0x58da72,_0x488412,_0x1e5d05,_0x3bf77d);})[_0xe6f4('0x15')](function(_0x2a5f92){if(_0x2a5f92){logger[_0xe6f4('0xb')](_0xe6f4('0x4f'),_0x2a5f92['id']);switch(_0x5bf973[_0xe6f4('0x3c')]){case _0xe6f4('0x50'):logger[_0xe6f4('0xb')](_0xe6f4('0x51'),_0xe6f4('0x52'));return request({'uri':util['format'](_0xe6f4('0x53'),_0x5bf973[_0xe6f4('0xe')],_0x58da72['id'],_0x2a5f92['id']),'method':_0xe6f4('0xf')});case _0xe6f4('0x54'):logger[_0xe6f4('0xb')](_0xe6f4('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6f4('0xc')](_0xe6f4('0x55'),_0x438258['name']),'trigger:browser:url',{'uri':util['format'](_0xe6f4('0x56'),_0x5bf973[_0xe6f4('0xe')]['replace'](_0xe6f4('0x57'),''),_0x2a5f92['id'])});break;default:logger[_0xe6f4('0x58')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x56b9d5){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x56b9d5,{'showHidden':!![],'depth':null}));});};exports[_0xe6f4('0x59')]=function(_0xb3079f,_0x29b8b2,_0x4a5b84,_0x35ca91,_0xdcd423,_0x47f0c6,_0x243f56){var _0x2e2127,_0x2db212;_0x47f0c6[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x47f0c6[_0xe6f4('0xe')]);_0x47f0c6[_0xe6f4('0x47')]=intUtil['stripTrailingSlash'](_0x47f0c6[_0xe6f4('0x47')]);if(_0x243f56&&_0x243f56[_0xe6f4('0x5a')]&&_0x243f56['recordingFormat']!==_0xe6f4('0x5b')){logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),_0xe6f4('0x49'));_0x29b8b2[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x47f0c6[_0xe6f4('0x47')],_0x29b8b2['uniqueid'],md5(_0x29b8b2[_0xe6f4('0x4b')]));}headers['Authorization']=getAuth(_0x47f0c6);return getUser(_0x47f0c6,_0x35ca91[_0xe6f4('0x4d')])['then'](function(_0x4d4f49){_0x2e2127=_0x4d4f49;logger[_0xe6f4('0xb')]('The\x20User\x20ID\x20is:',_0x2e2127['id']);return getEndUser(_0x47f0c6,_0x29b8b2['destcalleridname'],_0x29b8b2[_0xe6f4('0x5d')]);})[_0xe6f4('0x15')](function(_0x4cd312){_0x2db212=_0x4cd312;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x2db212['id']);return getTicket(_0x47f0c6,_0x2e2127,_0x2db212,_0x4a5b84,_0x29b8b2);})[_0xe6f4('0x15')](function(_0x47ecdf){if(_0x47ecdf){logger['info'](_0xe6f4('0x4f'),_0x47ecdf['id']);switch(_0x47f0c6['type']){case _0xe6f4('0x50'):logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),_0xe6f4('0x52'));return request({'uri':util[_0xe6f4('0xc')](_0xe6f4('0x53'),_0x47f0c6[_0xe6f4('0xe')],_0x2e2127['id'],_0x47ecdf['id']),'method':_0xe6f4('0xf')});case _0xe6f4('0x54'):logger[_0xe6f4('0xb')](_0xe6f4('0x5c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe6f4('0xc')]('user:%s',_0x35ca91[_0xe6f4('0x43')]),_0xe6f4('0x5e'),{'uri':util[_0xe6f4('0xc')](_0xe6f4('0x56'),_0x47f0c6[_0xe6f4('0xe')][_0xe6f4('0x5f')](_0xe6f4('0x57'),''),_0x47ecdf['id'])});break;default:logger['error'](_0xe6f4('0x5c'),_0xe6f4('0x60'));}}})[_0xe6f4('0x61')](function(_0x1c1d8a){logger[_0xe6f4('0x58')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x1c1d8a,{'showHidden':!![],'depth':null}));});};exports[_0xe6f4('0x62')]=function(_0x10b4dc,_0x38ed77,_0x51e311,_0x192dc1,_0x4fb899,_0x28faf5){var _0xcfc185,_0x3b0d84;_0x28faf5[_0xe6f4('0xe')]=intUtil[_0xe6f4('0x46')](_0x28faf5[_0xe6f4('0xe')]);_0x28faf5[_0xe6f4('0x47')]=intUtil[_0xe6f4('0x46')](_0x28faf5[_0xe6f4('0x47')]);if(_0x4fb899&&_0x4fb899['monitor_format']){logger['info']('['+_0x38ed77[_0xe6f4('0x63')][_0xe6f4('0x64')]()+']',_0xe6f4('0x49'));_0x38ed77[_0xe6f4('0x4a')]=util[_0xe6f4('0xc')](_0xe6f4('0x65'),_0x28faf5['serverUrl'],_0x38ed77[_0xe6f4('0x4b')],md5(_0x38ed77[_0xe6f4('0x4b')]));}else{_0x38ed77['recordingURL']='';}headers['Authorization']=getAuth(_0x28faf5);return getUser(_0x28faf5)[_0xe6f4('0x15')](function(_0x351638){_0xcfc185=_0x351638;logger['info'](_0xe6f4('0x66'),_0xcfc185['id']);return getEndUser(_0x28faf5,_0x38ed77[_0xe6f4('0x67')],_0x38ed77[_0xe6f4('0x68')]);})[_0xe6f4('0x15')](function(_0x1362a3){_0x3b0d84=_0x1362a3;logger[_0xe6f4('0xb')](_0xe6f4('0x4e'),_0x3b0d84['id']);return getTicket(_0x28faf5,_0xcfc185,_0x3b0d84,_0x51e311,_0x38ed77);})['then'](function(_0x3b0fe3){if(_0x3b0fe3){logger[_0xe6f4('0xb')](_0xe6f4('0x4f'),_0x3b0fe3['id']);}})['catch'](function(_0xfbf186){logger[_0xe6f4('0x58')]('['+_0x38ed77[_0xe6f4('0x63')][_0xe6f4('0x64')]()+']'+_0xe6f4('0x69'),util[_0xe6f4('0x6a')](_0xfbf186,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x771a=['Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','Displaying\x20ticket\x20to\x20agent...','user:%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','util','ioredis','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','name','getString','Descriptions','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','authType','password','%s:%s','token','username','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','map','forEach','includes','type','nameField','customField','string','picklist','idField','custom_fields','content','variableName'];(function(_0x52eac2,_0x84b5a4){var _0x5e297d=function(_0x180429){while(--_0x180429){_0x52eac2['push'](_0x52eac2['shift']());}};_0x5e297d(++_0x84b5a4);}(_0x771a,0x1df));var _0xa771=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x771a[_0x2dea24];return _0x309d58;};'use strict';var _=require('lodash');var rp=require(_0xa771('0x0'));var md5=require(_0xa771('0x1'));var util=require(_0xa771('0x2'));var Redis=require(_0xa771('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xa771('0x4'))(_0xa771('0x5'));config[_0xa771('0x6')]=_['defaults'](config[_0xa771('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa771('0x7'))(new Redis(config[_0xa771('0x6')]));function emit(_0x3f93e1,_0x1588f0,_0x114a37){io['to'](_0x3f93e1)[_0xa771('0x8')](_0x1588f0,_0x114a37);}var headers={'Content-Type':_0xa771('0x9'),'Accept':_0xa771('0x9')};function getTicket(_0x264ab1,_0x433be6,_0xa35a44,_0x47baec,_0x15559a){logger[_0xa771('0xa')](_0xa771('0xb'));return request({'uri':util[_0xa771('0xc')]('%s/tickets.json',_0x264ab1[_0xa771('0xd')]),'method':_0xa771('0xe'),'body':{'ticket':_[_0xa771('0xf')]({'requester_id':_0xa35a44['id'],'submitter_id':_0x433be6?_0x433be6['id']:undefined,'assignee_id':_0x433be6?_0x433be6['id']:undefined,'tags':getTags(_0x47baec['Tags'],_0xa771('0x10')),'subject':intUtil[_0xa771('0x11')](_0x47baec['Subjects'],_0x15559a,'\x20'),'description':intUtil[_0xa771('0x11')](_0x47baec[_0xa771('0x12')],_0x15559a,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa771('0x11')](_0x47baec[_0xa771('0x12')],_0x15559a,'\x0a')}},getCustomFields(_0x47baec['Fields'],_0x15559a))}})['then'](function(_0x2df66c){logger[_0xa771('0xa')]('Ticket\x20created!');return _0x2df66c[_0xa771('0x13')];});}function getUser(_0x4c3fdc,_0xf9d1b3){if(intUtil[_0xa771('0x14')](_0xf9d1b3)){logger['info'](_0xa771('0x15'),_0xf9d1b3);return request({'uri':util[_0xa771('0xc')](_0xa771('0x16'),_0x4c3fdc['remoteUri']),'qs':{'query':util[_0xa771('0xc')](_0xa771('0x17'),_0xf9d1b3)}})[_0xa771('0x18')](function(_0x53b161){if(_0x53b161['count']){logger[_0xa771('0xa')](_0xa771('0x19'));return _[_0xa771('0x1a')](_0x53b161[_0xa771('0x1b')],{'email':_0xf9d1b3,'role':_0xa771('0x1c')});}else{logger[_0xa771('0xa')](_0xa771('0x1d'));return request({'uri':util[_0xa771('0xc')]('%s/users/me.json',_0x4c3fdc[_0xa771('0xd')])})['then'](function(_0x4194db){logger[_0xa771('0xa')](_0xa771('0x1e'));return _0x4194db[_0xa771('0x1f')];});}});}else{logger[_0xa771('0xa')](_0xa771('0x1d'));return request({'uri':util[_0xa771('0xc')]('%s/users/me.json',_0x4c3fdc[_0xa771('0xd')])})[_0xa771('0x18')](function(_0x7ebee0){logger[_0xa771('0xa')]('Admin\x20account\x20selected.');return _0x7ebee0[_0xa771('0x1f')];});}}function getEndUser(_0x200aca,_0x1814de,_0x534b35){logger[_0xa771('0xa')](_0xa771('0x20'),_0x534b35);return request({'uri':util['format'](_0xa771('0x16'),_0x200aca['remoteUri']),'qs':{'query':util[_0xa771('0xc')](_0xa771('0x21'),_0x534b35)}})[_0xa771('0x18')](function(_0x46871b){var _0x369fec;if(_0x46871b[_0xa771('0x1b')][_0xa771('0x22')]){_0x46871b[_0xa771('0x1b')]=_['filter'](_0x46871b[_0xa771('0x1b')],{'suspended':![],'role':_0xa771('0x23')});if(_0x46871b[_0xa771('0x1b')][_0xa771('0x22')]){_0x369fec=_[_0xa771('0x24')](_0x46871b[_0xa771('0x1b')]);}}if(_0x369fec){logger[_0xa771('0xa')](_0xa771('0x25'));return _0x369fec;}else{logger[_0xa771('0xa')](_0xa771('0x26'));return request({'uri':util['format'](_0xa771('0x27'),_0x200aca['remoteUri']),'method':_0xa771('0xe'),'body':{'user':{'role':_0xa771('0x23'),'name':util[_0xa771('0xc')](_0xa771('0x28'),_0x1814de||_0x534b35),'phone':_0x534b35}}})['then'](function(_0x27b0f4){logger['info']('Enduser\x20created.');return _0x27b0f4['user'];});}});}function getAuth(_0x372004){var _0x1addca;if(_0x372004[_0xa771('0x29')]===_0xa771('0x2a')){_0x1addca=util[_0xa771('0xc')](_0xa771('0x2b'),_0x372004['username'],_0x372004['password']);}else if(_0x372004[_0xa771('0x29')]===_0xa771('0x2c')){_0x1addca=util[_0xa771('0xc')]('%s/token:%s',_0x372004[_0xa771('0x2d')],_0x372004[_0xa771('0x2c')]);}return util[_0xa771('0xc')](_0xa771('0x2e'),new Buffer(_0x1addca)[_0xa771('0x2f')](_0xa771('0x30')));}function request(_0x43790d){logger[_0xa771('0x31')](_0xa771('0x32'),JSON[_0xa771('0x33')](_0x43790d));return rp(_[_0xa771('0x34')](_0x43790d,{'method':_0xa771('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x26cdba,_0xeef900){var _0x264445=[];if(_0x26cdba&&_0x26cdba[_0xa771('0x22')]>0x0){_0x264445=_[_0xa771('0x36')](_0x26cdba,_0xeef900);}return _0x264445;}function getCustomFields(_0x26a98c,_0x11c0d4){var _0x3ae672=[];var _0x345814={'custom_fields':[]};if(_0x26a98c[_0xa771('0x22')]>0x0){_[_0xa771('0x37')](_0x26a98c,function(_0x13a31f){if(_[_0xa771('0x38')](['string','picklist'],_0x13a31f[_0xa771('0x39')])&&_0x13a31f[_0xa771('0x3a')]&&!_0x13a31f[_0xa771('0x3b')]){_0x345814[_0x13a31f['nameField']['toLowerCase']()]=_0x13a31f['content'][_0xa771('0x2f')]();}else if(_[_0xa771('0x38')]([_0xa771('0x3c'),_0xa771('0x3d')],_0x13a31f['type'])&&_0x13a31f[_0xa771('0x3e')]&&_0x13a31f['customField']){_0x345814[_0xa771('0x3f')]['push']({'id':_0x13a31f['idField'],'value':_0x13a31f[_0xa771('0x40')]['toString']()});}else if(_0x13a31f['type']==='variable'&&_0x13a31f['variableName']&&_0x13a31f[_0xa771('0x3e')]&&_0x13a31f['customField']){_0x11c0d4[_0x13a31f[_0xa771('0x41')]]&&_0x345814[_0xa771('0x3f')]['push']({'id':_0x13a31f[_0xa771('0x3e')],'value':_0x11c0d4[_0x13a31f[_0xa771('0x41')]][_0xa771('0x2f')]()});}else if(_0x13a31f[_0xa771('0x39')]==='customVariable'&&_0x13a31f[_0xa771('0x42')]&&_0x13a31f['Variable'][_0xa771('0x10')]&&_0x13a31f[_0xa771('0x3e')]&&_0x13a31f[_0xa771('0x3b')]){_0x11c0d4[_0x13a31f[_0xa771('0x42')][_0xa771('0x10')][_0xa771('0x43')]()]&&_0x345814[_0xa771('0x3f')]['push']({'id':_0x13a31f[_0xa771('0x3e')],'value':_0x11c0d4[_0x13a31f[_0xa771('0x42')][_0xa771('0x10')]['toLowerCase']()][_0xa771('0x2f')]()});}});}return _0x345814;}exports[_0xa771('0x44')]=function(_0x4d3c0d,_0x2122ec,_0xcf3ef4,_0x327557,_0x296464,_0x1e1ebd){var _0x54c3b7,_0xff42a1;_0x1e1ebd['remoteUri']=intUtil[_0xa771('0x45')](_0x1e1ebd[_0xa771('0xd')]);_0x1e1ebd[_0xa771('0x46')]=intUtil[_0xa771('0x45')](_0x1e1ebd[_0xa771('0x46')]);if(_0x296464&&_0x296464[_0xa771('0x47')]){logger[_0xa771('0xa')](_0xa771('0x48'),'Recording\x20is\x20enabled!');_0x2122ec['recordingURL']=util[_0xa771('0xc')](_0xa771('0x49'),_0x1e1ebd['serverUrl'],_0x2122ec[_0xa771('0x4a')],md5(_0x2122ec[_0xa771('0x4a')]));}else{_0x2122ec[_0xa771('0x4b')]='';}headers[_0xa771('0x4c')]=getAuth(_0x1e1ebd);return getUser(_0x1e1ebd,_0x327557[_0xa771('0x4d')])[_0xa771('0x18')](function(_0x458dad){_0x54c3b7=_0x458dad;logger[_0xa771('0xa')](_0xa771('0x4e'),_0x54c3b7['id']);return getEndUser(_0x1e1ebd,_0x2122ec[_0xa771('0x4f')],_0x2122ec[_0xa771('0x50')]);})[_0xa771('0x18')](function(_0x4ae937){_0xff42a1=_0x4ae937;logger[_0xa771('0xa')](_0xa771('0x51'),_0xff42a1['id']);return getTicket(_0x1e1ebd,_0x54c3b7,_0xff42a1,_0xcf3ef4,_0x2122ec);})[_0xa771('0x18')](function(_0x5d661e){if(_0x5d661e){logger[_0xa771('0xa')](_0xa771('0x52'),_0x5d661e['id']);switch(_0x1e1ebd[_0xa771('0x39')]){case _0xa771('0x53'):logger[_0xa771('0xa')](_0xa771('0x48'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa771('0xc')](_0xa771('0x54'),_0x1e1ebd[_0xa771('0xd')],_0x54c3b7['id'],_0x5d661e['id']),'method':_0xa771('0xe')});case _0xa771('0x55'):logger[_0xa771('0xa')](_0xa771('0x48'),_0xa771('0x56'));emit(util[_0xa771('0xc')]('user:%s',_0x327557[_0xa771('0x10')]),_0xa771('0x57'),{'uri':util[_0xa771('0xc')](_0xa771('0x58'),_0x1e1ebd['remoteUri'][_0xa771('0x59')](_0xa771('0x5a'),''),_0x5d661e['id'])});break;default:logger['error']('[QUEUE]',_0xa771('0x5b'));}}})[_0xa771('0x5c')](function(_0x43c0f0){logger[_0xa771('0x5d')](_0xa771('0x5e'),util[_0xa771('0x5f')](_0x43c0f0,{'showHidden':!![],'depth':null}));});};exports[_0xa771('0x60')]=function(_0x53e854,_0x56a06a,_0x4b9763,_0x375085,_0x1bb3fd,_0x327683,_0x2596e4){var _0x26c637,_0x14b897;_0x327683[_0xa771('0xd')]=intUtil[_0xa771('0x45')](_0x327683[_0xa771('0xd')]);_0x327683[_0xa771('0x46')]=intUtil[_0xa771('0x45')](_0x327683['serverUrl']);if(_0x2596e4&&_0x2596e4[_0xa771('0x61')]&&_0x2596e4[_0xa771('0x61')]!==_0xa771('0x62')){logger['info'](_0xa771('0x63'),_0xa771('0x64'));_0x56a06a[_0xa771('0x4b')]=util[_0xa771('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x327683[_0xa771('0x46')],_0x56a06a[_0xa771('0x4a')],md5(_0x56a06a[_0xa771('0x4a')]));}headers[_0xa771('0x4c')]=getAuth(_0x327683);return getUser(_0x327683,_0x375085['email'])[_0xa771('0x18')](function(_0xc6bba0){_0x26c637=_0xc6bba0;logger['info'](_0xa771('0x4e'),_0x26c637['id']);return getEndUser(_0x327683,_0x56a06a[_0xa771('0x65')],_0x56a06a['destcalleridnum']);})[_0xa771('0x18')](function(_0x26c6ab){_0x14b897=_0x26c6ab;logger['info']('The\x20Enduser\x20ID\x20is:',_0x14b897['id']);return getTicket(_0x327683,_0x26c637,_0x14b897,_0x4b9763,_0x56a06a);})['then'](function(_0x28a768){if(_0x28a768){logger[_0xa771('0xa')](_0xa771('0x52'),_0x28a768['id']);switch(_0x327683[_0xa771('0x39')]){case _0xa771('0x53'):logger['info']('[OUTBOUND]',_0xa771('0x66'));return request({'uri':util[_0xa771('0xc')](_0xa771('0x54'),_0x327683[_0xa771('0xd')],_0x26c637['id'],_0x28a768['id']),'method':'POST'});case _0xa771('0x55'):logger[_0xa771('0xa')]('[OUTBOUND]',_0xa771('0x56'));emit(util[_0xa771('0xc')](_0xa771('0x67'),_0x375085[_0xa771('0x10')]),'trigger:browser:url',{'uri':util[_0xa771('0xc')](_0xa771('0x58'),_0x327683[_0xa771('0xd')][_0xa771('0x59')](_0xa771('0x5a'),''),_0x28a768['id'])});break;default:logger[_0xa771('0x5d')](_0xa771('0x63'),_0xa771('0x5b'));}}})[_0xa771('0x5c')](function(_0x3b3110){logger['error'](_0xa771('0x68'),util[_0xa771('0x5f')](_0x3b3110,{'showHidden':!![],'depth':null}));});};exports[_0xa771('0x69')]=function(_0x57df19,_0x5487c7,_0x20f578,_0x4d96d0,_0x17a3c8,_0x5439e2){var _0x203c62,_0x3da3c6;_0x5439e2['remoteUri']=intUtil[_0xa771('0x45')](_0x5439e2['remoteUri']);_0x5439e2[_0xa771('0x46')]=intUtil[_0xa771('0x45')](_0x5439e2[_0xa771('0x46')]);if(_0x17a3c8&&_0x17a3c8[_0xa771('0x47')]){logger[_0xa771('0xa')]('['+_0x5487c7[_0xa771('0x6a')][_0xa771('0x6b')]()+']',_0xa771('0x64'));_0x5487c7['recordingURL']=util[_0xa771('0xc')](_0xa771('0x49'),_0x5439e2['serverUrl'],_0x5487c7['uniqueid'],md5(_0x5487c7['uniqueid']));}else{_0x5487c7[_0xa771('0x4b')]='';}headers[_0xa771('0x4c')]=getAuth(_0x5439e2);return getUser(_0x5439e2)[_0xa771('0x18')](function(_0x11f05f){_0x203c62=_0x11f05f;logger[_0xa771('0xa')](_0xa771('0x4e'),_0x203c62['id']);return getEndUser(_0x5439e2,_0x5487c7[_0xa771('0x4f')],_0x5487c7[_0xa771('0x50')]);})[_0xa771('0x18')](function(_0x32bd9d){_0x3da3c6=_0x32bd9d;logger[_0xa771('0xa')](_0xa771('0x51'),_0x3da3c6['id']);return getTicket(_0x5439e2,_0x203c62,_0x3da3c6,_0x20f578,_0x5487c7);})[_0xa771('0x18')](function(_0x574ada){if(_0x574ada){logger['info']('The\x20Ticket\x20ID\x20is:',_0x574ada['id']);}})[_0xa771('0x5c')](function(_0x124145){logger['error']('['+_0x5487c7['lastevent']['toUpperCase']()+']'+_0xa771('0x6c'),util[_0xa771('0x5f')](_0x124145,{'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 29c4137..34da065 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 _0x07c2=['Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','role','first_name','last_name','SUCCESS','enduserType','moduleCreate','Error:\x20','log','moduleSearch','uri','Contacts','https://www.zohoapis.','Leads','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','startCase','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','Call_Result','complete','connect','Answered','Rejected','Abandoned','timeout','Call_Start_Time','outbound','Call_Type','Inbound','merge','Fields','code','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','unmanaged','toUpperCase','lodash','md5','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','stringify','length','forEach','string','type','content','toString','variable','variableName','idField','customVariable','Variable','toLowerCase','name','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!'];(function(_0x28aa4c,_0x2e675d){var _0x203f0e=function(_0x4ee0e2){while(--_0x4ee0e2){_0x28aa4c['push'](_0x28aa4c['shift']());}};_0x203f0e(++_0x2e675d);}(_0x07c2,0xf1));var _0x207c=function(_0x538375,_0x365e8d){_0x538375=_0x538375-0x0;var _0x1c3531=_0x07c2[_0x538375];return _0x1c3531;};'use strict';var _=require(_0x207c('0x0'));var rp=require('request-promise');var md5=require(_0x207c('0x1'));var util=require('util');var intUtil=require(_0x207c('0x2'));var moment=require(_0x207c('0x3'));var Redis=require(_0x207c('0x4'));var BPromise=require(_0x207c('0x5'));var config=require(_0x207c('0x6'));var logger=require(_0x207c('0x7'))('zoho');config[_0x207c('0x8')]=_[_0x207c('0x9')](config[_0x207c('0x8')],{'host':_0x207c('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x207c('0x8')]));function emit(_0x59c410,_0x5359a4,_0x180812){io['to'](_0x59c410)[_0x207c('0xb')](_0x5359a4,_0x180812);}function request(_0x1ae9d2){logger[_0x207c('0xc')]('[HTTP]',JSON[_0x207c('0xd')](_0x1ae9d2));return rp(_0x1ae9d2);}function getCustomFields(_0x1403cf,_0x2b8a51){var _0x2807be={};if(_0x1403cf[_0x207c('0xe')]>0x0){_[_0x207c('0xf')](_0x1403cf,function(_0x3ba361){if(_['includes']([_0x207c('0x10'),'picklist'],_0x3ba361[_0x207c('0x11')])&&_0x3ba361['idField']){_0x2807be[_0x3ba361['idField']]=_0x3ba361[_0x207c('0x12')][_0x207c('0x13')]();}else if(_0x3ba361['type']===_0x207c('0x14')&&_0x3ba361[_0x207c('0x15')]&&_0x3ba361[_0x207c('0x16')]&&_0x2b8a51[_0x3ba361[_0x207c('0x15')]]){_0x2807be[_0x3ba361[_0x207c('0x16')]]=_0x2b8a51[_0x3ba361['variableName']][_0x207c('0x13')]();}else if(_0x3ba361['type']===_0x207c('0x17')&&_0x3ba361[_0x207c('0x18')]&&_0x3ba361['Variable']['name']&&_0x3ba361[_0x207c('0x16')]&&_0x2b8a51[_0x3ba361[_0x207c('0x18')]['name'][_0x207c('0x19')]()]){_0x2807be[_0x3ba361[_0x207c('0x16')]]=_0x2b8a51[_0x3ba361[_0x207c('0x18')][_0x207c('0x1a')][_0x207c('0x19')]()][_0x207c('0x13')]();}});}return _0x2807be;}function getName(_0x2bf33a){if(_0x2bf33a['indexOf']('\x20')>0x0){var _0x996988=_0x2bf33a[_0x207c('0x1b')](/ (.+)/);if(_0x996988[0x1]){return _0x996988;}}return[_0x2bf33a,_0x2bf33a];}var accountsTokens={};function getAccessToken(_0x19ce80){return new Promise(function(_0xe80172,_0x33ad7b){if(!_[_0x207c('0x1c')](accountsTokens[_0x19ce80['id']])&&!_[_0x207c('0x1c')](accountsTokens[_0x19ce80['id']][_0x207c('0x1d')])){if(moment()[_0x207c('0x1e')](accountsTokens[_0x19ce80['id']][_0x207c('0x1f')])){_0xe80172(accountsTokens[_0x19ce80['id']][_0x207c('0x1d')]);}}var _0x32ebb1;switch(_0x19ce80['zone']){case'US':_0x32ebb1='https://accounts.zoho.com';break;case'AU':_0x32ebb1=_0x207c('0x20');break;case'EU':_0x32ebb1='https://accounts.zoho.eu';break;case'IN':_0x32ebb1=_0x207c('0x21');break;case'CN':_0x32ebb1=_0x207c('0x22');break;default:_0x32ebb1=_0x207c('0x23');break;}var _0xdf1a29={'method':'POST','uri':_0x32ebb1+_0x207c('0x24'),'qs':{'refresh_token':_0x19ce80[_0x207c('0x25')],'client_id':_0x19ce80[_0x207c('0x26')],'client_secret':_0x19ce80[_0x207c('0x27')],'grant_type':_0x207c('0x28')},'json':!![]};return rp(_0xdf1a29)[_0x207c('0x29')](function(_0x5708d0){accountsTokens[_0x19ce80['id']]={'access_token':_0x5708d0[_0x207c('0x1d')],'expires_in':moment()[_0x207c('0x2a')](_0x5708d0['expires_in'],'seconds')};_0xe80172(_0x5708d0[_0x207c('0x1d')]);})[_0x207c('0x2b')](function(_0xbbd539){logger['error'](_0x207c('0x2c'),_0xbbd539['stack']);_0x33ad7b(_0xbbd539);});});}function getUser(_0x466de8,_0xeafa01,_0x3aa0fe,_0x527a6c){logger[_0x207c('0x2d')](_0x207c('0x2e'));return request({'method':_0x207c('0x2f'),'uri':util[_0x207c('0x30')]('https://www.zohoapis.%s/crm/v2/users',_0xeafa01),'qs':{'type':_0x207c('0x31')},'headers':{'Authorization':_0x207c('0x32')+_0x466de8},'json':!![]})[_0x207c('0x29')](function(_0x16fe20){if(_0x16fe20[_0x207c('0x33')]){var _0x1bde0a=-0x1;if(_['isArrayLikeObject'](_0x16fe20[_0x207c('0x33')])){if(!_[_0x207c('0x1c')](_0x527a6c)){_0x1bde0a=_[_0x207c('0x34')](_0x16fe20[_0x207c('0x33')],function(_0x2229b9){return _0x2229b9[_0x207c('0x35')]===_0x527a6c;});}if(_0x1bde0a>=0x0){logger[_0x207c('0x2d')](_0x207c('0x36'));}else{logger[_0x207c('0x2d')](_0x207c('0x37'));_0x1bde0a=_[_0x207c('0x34')](_0x16fe20[_0x207c('0x33')],function(_0x5af2dc){return _0x5af2dc[_0x207c('0x38')][_0x207c('0x1a')]===_0x207c('0x39');});}return _0x16fe20[_0x207c('0x33')][_0x1bde0a];}else{if(_0x16fe20[_0x207c('0x3a')][_0x207c('0x38')]['name']===_0x207c('0x39')){logger[_0x207c('0x2d')](_0x207c('0x37'));user=_0x16fe20[_0x207c('0x3a')];return user;}else{logger[_0x207c('0x3b')](_0x207c('0x3c'),JSON[_0x207c('0xd')](_0x16fe20));throw new Error(_0x207c('0x3d')+JSON['stringify'](_0x16fe20));}}}else{logger[_0x207c('0x3b')](_0x207c('0x3c'),JSON[_0x207c('0xd')](_0x16fe20));throw new Error(_0x207c('0x3d')+JSON['stringify'](_0x16fe20));}})[_0x207c('0x2b')](function(_0x52c682){console['error'](_0x52c682);});}function getZohoUser(_0x4244b6,_0x5cfa6d){return new BPromise(function(_0x55d6b7,_0x511e1b){request(_0x4244b6)[_0x207c('0x29')](function(_0x33adde){var _0xcfdaf6=null;if(_0x33adde){_0xcfdaf6=_0x33adde[_0x207c('0x3e')][0x0];_0xcfdaf6['enduserType']=_0x5cfa6d;}_0x55d6b7(_0xcfdaf6);})[_0x207c('0x2b')](function(_0x224aae){_0x511e1b(_0x224aae);});});}function createEndUser(_0x211c59,_0x129171,_0x4391b4,_0x18d567,_0x45217d,_0x15c9a1){var _0x4391b4=getName(_0x4391b4);return request({'method':_0x207c('0x3f'),'uri':'https://www.zohoapis.'+_0x129171+'/crm/v2/'+_['startCase'](_0x15c9a1['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4391b4[0x1],'First_Name':_0x4391b4[0x0],'Phone':_0x18d567,'Owner':{'name':!_[_0x207c('0x1c')](_0x45217d[_0x207c('0x40')][_0x207c('0x1a')])?_0x45217d[_0x207c('0x40')]['name']:!_[_0x207c('0x1c')](_0x45217d[_0x207c('0x41')])?_0x45217d[_0x207c('0x41')]+'\x20'+_0x45217d['last_name']:_0x45217d[_0x207c('0x42')],'id':_0x45217d['id']}}]},'headers':{'Authorization':_0x207c('0x32')+_0x211c59},'json':!![]})['then'](function(_0x20827a){if(_0x20827a&&_0x20827a[_0x207c('0x3e')][0x0]['code']===_0x207c('0x43')){var _0x3c65b7=_0x20827a[_0x207c('0x3e')][0x0]['details'];_0x3c65b7[_0x207c('0x44')]=_['startCase'](_0x15c9a1[_0x207c('0x45')])+'s';return _0x3c65b7;}logger['error'](_0x207c('0x3c'),JSON[_0x207c('0xd')](data));throw new Error(_0x207c('0x46')+JSON['stringify'](data));})[_0x207c('0x2b')](function(_0x20e8fa){console[_0x207c('0x47')]('CREATE\x20ERROR',_0x20e8fa);});}function getEndUser(_0x55e6a8,_0x2c499c,_0x522c70,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340){var _0x442f29={'method':'GET','uri':'','headers':{'Authorization':_0x207c('0x32')+_0x55e6a8},'json':!![]};switch(_0x3ba340[_0x207c('0x48')]){case'contact_lead':_0x442f29[_0x207c('0x49')]='https://www.zohoapis.'+_0x2c499c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4a'))[_0x207c('0x29')](function(_0xf4b1fc){if(_0xf4b1fc)return _0xf4b1fc;_0x442f29[_0x207c('0x49')]=_0x207c('0x4b')+_0x2c499c+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4c'))['then'](function(_0x2f847e){if(_0x2f847e)return _0x2f847e;if(_0x3ba340['moduleCreate']!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});});break;case _0x207c('0x4e'):_0x442f29[_0x207c('0x49')]='https://www.zohoapis.'+_0x2c499c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4a'))[_0x207c('0x29')](function(_0x31e3e5){if(_0x31e3e5)return _0x31e3e5;if(_0x3ba340[_0x207c('0x45')]!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});break;case _0x207c('0x4f'):_0x442f29[_0x207c('0x49')]=_0x207c('0x4b')+_0x2c499c+_0x207c('0x50')+_0x215a42+'))';return getZohoUser(_0x442f29,_0x207c('0x4c'))[_0x207c('0x29')](function(_0x1979ec){if(_0x1979ec)return _0x1979ec;if(_0x3ba340[_0x207c('0x45')]!=_0x207c('0x4d')){return createEndUser(_0x55e6a8,_0x2c499c,_0x30714f,_0x215a42,_0x3d4a59,_0x3ba340);}else{return{};}});break;}}function getCall(_0x462b43,_0x10e335,_0x1f46f1,_0x4909dd,_0x11edcc,_0x47b550,_0x29ee4c,_0x327bdd){logger[_0x207c('0x2d')](_0x207c('0x51'));var _0x2274e2={};_0x2274e2[_0x207c('0x52')]={'name':!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x40')][_0x207c('0x1a')])&&!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x38')]['name'])&&_0x4909dd['profile'][_0x207c('0x1a')]==='administrator'?_0x4909dd[_0x207c('0x40')][_0x207c('0x1a')]:!_[_0x207c('0x1c')](_0x4909dd[_0x207c('0x41')])?_0x4909dd[_0x207c('0x41')]+'\x20'+_0x4909dd[_0x207c('0x42')]:_0x4909dd[_0x207c('0x42')],'id':_0x4909dd['id']};_0x2274e2[_0x207c('0x53')]=intUtil[_0x207c('0x54')](_0x47b550[_0x207c('0x55')],_0x29ee4c,'\x20');_0x2274e2[_0x207c('0x56')]=intUtil[_0x207c('0x54')](_0x47b550[_0x207c('0x57')],_0x29ee4c,'\x0a');if(_0x11edcc[_0x207c('0x44')]===_0x207c('0x4a')){_0x2274e2[_0x207c('0x58')]={'name':!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x59')])?_0x11edcc['Full_Name']:!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x5a')])?_0x11edcc[_0x207c('0x5a')]+'\x20'+_0x11edcc[_0x207c('0x5b')]:_0x11edcc[_0x207c('0x5b')],'id':_0x11edcc['id']};}if(_0x11edcc['enduserType']===_0x207c('0x4c')){_0x2274e2[_0x207c('0x5c')]={'name':!_[_0x207c('0x1c')](_0x11edcc['Full_Name'])?_0x11edcc[_0x207c('0x59')]:!_[_0x207c('0x1c')](_0x11edcc[_0x207c('0x5a')])?_0x11edcc[_0x207c('0x5a')]+'\x20'+_0x11edcc['Last_Name']:_0x11edcc['Last_Name'],'id':_0x11edcc['id']};_0x2274e2['$se_module']=_[_0x207c('0x5d')](_0x11edcc['enduserType']);}if(_0x29ee4c[_0x207c('0x5e')]){_0x2274e2[_0x207c('0x5f')]=moment[_0x207c('0x60')](parseInt(_0x29ee4c[_0x207c('0x5e')])*0x3e8)[_0x207c('0x30')](_0x207c('0x61'));}else if(_0x29ee4c[_0x207c('0x62')]&&_0x29ee4c['endtime']){_0x2274e2['Call_Duration']=moment[_0x207c('0x60')](moment(_0x29ee4c[_0x207c('0x63')],_0x207c('0x64'))[_0x207c('0x65')](moment(_0x29ee4c[_0x207c('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0x207c('0x30')](_0x207c('0x61'));}switch(_0x29ee4c[_0x207c('0x67')]){case'called':_0x2274e2[_0x207c('0x68')]='Called';break;case _0x207c('0x69'):case _0x207c('0x6a'):_0x2274e2['Call_Result']=_0x207c('0x6b');break;case'rejected':_0x2274e2['Call_Result']=_0x207c('0x6c');break;case'abandoned':_0x2274e2[_0x207c('0x68')]=_0x207c('0x6d');break;case _0x207c('0x6e'):_0x2274e2[_0x207c('0x68')]='Timeout';default:}_0x2274e2[_0x207c('0x6f')]=(_0x327bdd===_0x207c('0x70')?moment(_0x29ee4c[_0x207c('0x66')])['format'](_0x207c('0x64')):moment(_0x29ee4c['agentcalledAt'])[_0x207c('0x30')](_0x207c('0x64')))||moment()[_0x207c('0x30')](_0x207c('0x64'));_0x2274e2[_0x207c('0x71')]=_0x327bdd||_0x207c('0x72');_0x2274e2=_[_0x207c('0x73')](_0x2274e2,getCustomFields(_0x47b550[_0x207c('0x74')],_0x29ee4c));return request({'method':_0x207c('0x3f'),'uri':'https://www.zohoapis.'+_0x10e335+'/crm/v2/Calls','headers':{'Authorization':_0x207c('0x32')+_0x462b43},'body':{'data':[_0x2274e2]},'json':!![]})['then'](function(_0x54fd50){if(_0x54fd50&&_0x54fd50[_0x207c('0x3e')][0x0][_0x207c('0x75')]===_0x207c('0x43')){logger[_0x207c('0x2d')](_0x207c('0x76'));return{'id':_0x54fd50[_0x207c('0x3e')][0x0]['details']['id']};}})['catch'](function(_0x33223b){logger[_0x207c('0x2d')]('err',_0x33223b['stack']);console[_0x207c('0x47')](_0x207c('0x77'),_0x33223b);});}exports['queue']=function(_0xcdaf4b,_0x105e47,_0x226933,_0x4d36c1,_0x326b2c,_0x27df65){var _0xf4bcb6,_0x3070df,_0x2a1b6d;_0x27df65[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x27df65[_0x207c('0x78')]);_0x27df65[_0x207c('0x7a')]=intUtil[_0x207c('0x79')](_0x27df65[_0x207c('0x7a')]);if(_0x326b2c&&_0x326b2c[_0x207c('0x7b')]){logger[_0x207c('0x2d')](_0x207c('0x7c'),'Recording\x20is\x20enabled!');_0x105e47[_0x207c('0x7d')]=_0x27df65[_0x207c('0x7a')]+_0x207c('0x7e')+_0x105e47[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x105e47[_0x207c('0x7f')]);}else{_0x105e47[_0x207c('0x7d')]='';}var _0x566b17=_0x27df65[_0x207c('0x78')]===_0x207c('0x81')?'eu':_0x207c('0x82');return getAccessToken(_0x27df65)[_0x207c('0x29')](function(_0x22a0da){_0x2a1b6d=_0x22a0da;return getUser(_0x2a1b6d,_0x566b17,_0x27df65,_0x4d36c1['email']);})[_0x207c('0x29')](function(_0xfc9537){_0xf4bcb6=_0xfc9537;logger[_0x207c('0x2d')](_0x207c('0x83'),_0xf4bcb6['id']);return getEndUser(_0x2a1b6d,_0x566b17,_0x27df65,_0x105e47[_0x207c('0x84')],_0x105e47[_0x207c('0x85')],_0xf4bcb6,_0x226933);})[_0x207c('0x29')](function(_0x494048){_0x3070df=_0x494048;return getCall(_0x2a1b6d,_0x566b17,_0x27df65,_0xf4bcb6,_0x3070df,_0x226933,_0x105e47,'Inbound');})[_0x207c('0x29')](function(_0x33b219){if(_0x33b219){logger['info'](_0x207c('0x86'),_0x33b219['id']);logger['info'](_0x207c('0x7c'),_0x207c('0x87'));emit(util[_0x207c('0x30')](_0x207c('0x88'),_0x4d36c1[_0x207c('0x1a')]),_0x207c('0x89'),{'uri':_0x207c('0x8a')+_0x27df65[_0x207c('0x78')]+_0x207c('0x8b')+_0x33b219['id']});}})[_0x207c('0x2b')](function(_0x45dd79){logger[_0x207c('0x3b')](_0x207c('0x7c'),JSON[_0x207c('0xd')](_0x45dd79));});};exports[_0x207c('0x70')]=function(_0x28ebaf,_0x43092d,_0x44402b,_0x4aeca7,_0x5efad5,_0x21834d,_0x3009f5){var _0x373709,_0x115e18,_0x25e9ed;_0x21834d[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x21834d['host']);_0x21834d['serverUrl']=intUtil[_0x207c('0x79')](_0x21834d['serverUrl']);if(_0x3009f5&&_0x3009f5['recordingFormat']&&_0x3009f5['recordingFormat']!==_0x207c('0x8c')){logger['info']('[OUTBOUND]',_0x207c('0x8d'));_0x43092d[_0x207c('0x7d')]=_0x21834d['serverUrl']+'/api/voice/recordings/'+_0x43092d[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x43092d[_0x207c('0x7f')]);}var _0x2ffabc=_0x21834d[_0x207c('0x78')]==='zoho.eu'?'eu':_0x207c('0x82');return getAccessToken(_0x21834d)['then'](function(_0x5992b8){_0x25e9ed=_0x5992b8;return getUser(_0x25e9ed,_0x2ffabc,_0x21834d,_0x4aeca7[_0x207c('0x35')]);})['then'](function(_0x515c43){_0x373709=_0x515c43;logger['info'](_0x207c('0x83'),_0x373709['id']);return getEndUser(_0x25e9ed,_0x2ffabc,_0x21834d,_0x43092d[_0x207c('0x8e')],_0x43092d[_0x207c('0x8f')],_0x373709,_0x44402b);})[_0x207c('0x29')](function(_0x906ba7){_0x115e18=_0x906ba7;return getCall(_0x25e9ed,_0x2ffabc,_0x21834d,_0x373709,_0x115e18,_0x44402b,_0x43092d,_0x207c('0x90'));})[_0x207c('0x29')](function(_0x19c98f){if(_0x19c98f){logger[_0x207c('0x2d')](_0x207c('0x86'),_0x19c98f['id']);logger[_0x207c('0x2d')](_0x207c('0x91'),_0x207c('0x87'));emit(util[_0x207c('0x30')]('user:%s',_0x4aeca7[_0x207c('0x1a')]),_0x207c('0x89'),{'uri':'https://crm.'+_0x21834d[_0x207c('0x78')]+_0x207c('0x8b')+_0x19c98f['id']});}})[_0x207c('0x2b')](function(_0x5688f1){logger[_0x207c('0x3b')](_0x207c('0x91'),JSON['stringify'](_0x5688f1));});};exports[_0x207c('0x92')]=function(_0x2e5a74,_0x373b11,_0x3cdc3c,_0xe2d84e,_0x395823,_0x2768ac){var _0x454bee,_0x24a199,_0x2a005d;_0x2768ac[_0x207c('0x78')]=intUtil[_0x207c('0x79')](_0x2768ac[_0x207c('0x78')]);_0x2768ac[_0x207c('0x7a')]=intUtil['stripTrailingSlash'](_0x2768ac[_0x207c('0x7a')]);if(_0x395823&&_0x395823['monitor_format']){logger[_0x207c('0x2d')]('['+_0x373b11[_0x207c('0x67')][_0x207c('0x93')]()+']',_0x207c('0x8d'));_0x373b11['recordingURL']=_0x2768ac[_0x207c('0x7a')]+'/api/voice/recordings/'+_0x373b11[_0x207c('0x7f')]+_0x207c('0x80')+md5(_0x373b11['uniqueid']);}else{_0x373b11[_0x207c('0x7d')]='';}var _0x5f03f6=_0x2768ac['host']===_0x207c('0x81')?'eu':'com';return getAccessToken(_0x2768ac)['then'](function(_0x184d30){_0x2a005d=_0x184d30;return getUser(_0x2a005d,_0x5f03f6,_0x2768ac);})['then'](function(_0x55b544){_0x454bee=_0x55b544;logger[_0x207c('0x2d')](_0x207c('0x83'),_0x454bee['id']);return getEndUser(_0x2a005d,_0x5f03f6,_0x2768ac,_0x373b11[_0x207c('0x84')],_0x373b11[_0x207c('0x85')],_0x454bee,_0x3cdc3c);})[_0x207c('0x29')](function(_0x19a016){_0x24a199=_0x19a016;return getCall(_0x2a005d,_0x5f03f6,_0x2768ac,_0x454bee,_0x24a199,_0x3cdc3c,_0x373b11,_0x207c('0x72'));})['then'](function(_0x1e7461){if(_0x1e7461){logger[_0x207c('0x2d')]('The\x20Call\x20ID\x20is:',_0x1e7461['id']);}})[_0x207c('0x2b')](function(_0x578ea0){logger[_0x207c('0x3b')]('['+_0x373b11[_0x207c('0x67')][_0x207c('0x93')]()+']',JSON[_0x207c('0xd')](_0x578ea0));});}; \ No newline at end of file +var _0x2af4=['merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','The\x20User\x20ID\x20is:','destcalleridname','Outbound','unmanaged','toUpperCase','calleridnum','request-promise','md5','./util','ioredis','bluebird','zoho','redis','localhost','debug','[HTTP]','length','forEach','includes','string','picklist','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','add','catch','error','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','data','enduserType','/crm/v2/','startCase','moduleCreate','role','isNil','first_name','code','SUCCESS','details','Error:\x20','CREATE\x20ERROR','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner','administrator','last_name','Description','getString','Descriptions','Last_Name','Full_Name','First_Name','Call_Duration','utc','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound'];(function(_0x2df406,_0x41ebc5){var _0xdd2115=function(_0x381027){while(--_0x381027){_0x2df406['push'](_0x2df406['shift']());}};_0xdd2115(++_0x41ebc5);}(_0x2af4,0x1e4));var _0x42af=function(_0x45f5e4,_0x224f43){_0x45f5e4=_0x45f5e4-0x0;var _0x1d098f=_0x2af4[_0x45f5e4];return _0x1d098f;};'use strict';var _=require('lodash');var rp=require(_0x42af('0x0'));var md5=require(_0x42af('0x1'));var util=require('util');var intUtil=require(_0x42af('0x2'));var moment=require('moment');var Redis=require(_0x42af('0x3'));var BPromise=require(_0x42af('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x42af('0x5'));config[_0x42af('0x6')]=_['defaults'](config[_0x42af('0x6')],{'host':_0x42af('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x257268,_0x4f7a49,_0xd81771){io['to'](_0x257268)['emit'](_0x4f7a49,_0xd81771);}function request(_0x25c30f){logger[_0x42af('0x8')](_0x42af('0x9'),JSON['stringify'](_0x25c30f));return rp(_0x25c30f);}function getCustomFields(_0x33d375,_0x1c7362){var _0x3e0535={};if(_0x33d375[_0x42af('0xa')]>0x0){_[_0x42af('0xb')](_0x33d375,function(_0x4288f9){if(_[_0x42af('0xc')]([_0x42af('0xd'),_0x42af('0xe')],_0x4288f9[_0x42af('0xf')])&&_0x4288f9[_0x42af('0x10')]){_0x3e0535[_0x4288f9[_0x42af('0x10')]]=_0x4288f9['content'][_0x42af('0x11')]();}else if(_0x4288f9['type']===_0x42af('0x12')&&_0x4288f9[_0x42af('0x13')]&&_0x4288f9['idField']&&_0x1c7362[_0x4288f9[_0x42af('0x13')]]){_0x3e0535[_0x4288f9['idField']]=_0x1c7362[_0x4288f9[_0x42af('0x13')]][_0x42af('0x11')]();}else if(_0x4288f9[_0x42af('0xf')]===_0x42af('0x14')&&_0x4288f9[_0x42af('0x15')]&&_0x4288f9[_0x42af('0x15')][_0x42af('0x16')]&&_0x4288f9[_0x42af('0x10')]&&_0x1c7362[_0x4288f9[_0x42af('0x15')][_0x42af('0x16')][_0x42af('0x17')]()]){_0x3e0535[_0x4288f9[_0x42af('0x10')]]=_0x1c7362[_0x4288f9[_0x42af('0x15')]['name'][_0x42af('0x17')]()][_0x42af('0x11')]();}});}return _0x3e0535;}function getName(_0xd56524){if(_0xd56524['indexOf']('\x20')>0x0){var _0x5d1f3e=_0xd56524[_0x42af('0x18')](/ (.+)/);if(_0x5d1f3e[0x1]){return _0x5d1f3e;}}return[_0xd56524,_0xd56524];}var accountsTokens={};function getAccessToken(_0x135e46){return new Promise(function(_0x16a08e,_0x1305dd){if(!_['isNil'](accountsTokens[_0x135e46['id']])&&!_['isNil'](accountsTokens[_0x135e46['id']][_0x42af('0x19')])){if(moment()[_0x42af('0x1a')](accountsTokens[_0x135e46['id']][_0x42af('0x1b')])){_0x16a08e(accountsTokens[_0x135e46['id']][_0x42af('0x19')]);}}var _0x578529;switch(_0x135e46[_0x42af('0x1c')]){case'US':_0x578529=_0x42af('0x1d');break;case'AU':_0x578529=_0x42af('0x1e');break;case'EU':_0x578529='https://accounts.zoho.eu';break;case'IN':_0x578529=_0x42af('0x1f');break;case'CN':_0x578529='https://accounts.zoho.com.cn';break;default:_0x578529=_0x42af('0x20');break;}var _0x454dcf={'method':_0x42af('0x21'),'uri':_0x578529+_0x42af('0x22'),'qs':{'refresh_token':_0x135e46[_0x42af('0x23')],'client_id':_0x135e46[_0x42af('0x24')],'client_secret':_0x135e46[_0x42af('0x25')],'grant_type':_0x42af('0x26')},'json':!![]};return rp(_0x454dcf)['then'](function(_0x2206e6){accountsTokens[_0x135e46['id']]={'access_token':_0x2206e6[_0x42af('0x19')],'expires_in':moment()[_0x42af('0x27')](_0x2206e6[_0x42af('0x1b')],'seconds')};_0x16a08e(_0x2206e6[_0x42af('0x19')]);})[_0x42af('0x28')](function(_0x2d0b6f){logger[_0x42af('0x29')]('Failing\x20creating\x20the\x20access_token',_0x2d0b6f['stack']);_0x1305dd(_0x2d0b6f);});});}function getUser(_0x33b342,_0x458d1a,_0x3cbfce,_0x58e4e2){logger[_0x42af('0x2a')]('Search\x20user');return request({'method':_0x42af('0x2b'),'uri':util[_0x42af('0x2c')](_0x42af('0x2d'),_0x458d1a),'qs':{'type':_0x42af('0x2e')},'headers':{'Authorization':_0x42af('0x2f')+_0x33b342},'json':!![]})['then'](function(_0x144ae6){if(_0x144ae6[_0x42af('0x30')]){var _0xed7b17=-0x1;if(_[_0x42af('0x31')](_0x144ae6[_0x42af('0x30')])){if(!_['isNil'](_0x58e4e2)){_0xed7b17=_[_0x42af('0x32')](_0x144ae6[_0x42af('0x30')],function(_0x567173){return _0x567173['email']===_0x58e4e2;});}if(_0xed7b17>=0x0){logger['info'](_0x42af('0x33'));}else{logger[_0x42af('0x2a')](_0x42af('0x34'));_0xed7b17=_[_0x42af('0x32')](_0x144ae6[_0x42af('0x30')],function(_0x13a2e4){return _0x13a2e4[_0x42af('0x35')][_0x42af('0x16')]===_0x42af('0x36');});}return _0x144ae6[_0x42af('0x30')][_0xed7b17];}else{if(_0x144ae6[_0x42af('0x37')][_0x42af('0x35')][_0x42af('0x16')]===_0x42af('0x36')){logger[_0x42af('0x2a')]('Using\x20the\x20admin\x20account!');user=_0x144ae6['user'];return user;}else{logger['error'](_0x42af('0x38'),JSON[_0x42af('0x39')](_0x144ae6));throw new Error(_0x42af('0x3a')+JSON[_0x42af('0x39')](_0x144ae6));}}}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0x42af('0x39')](_0x144ae6));throw new Error(_0x42af('0x3a')+JSON[_0x42af('0x39')](_0x144ae6));}})[_0x42af('0x28')](function(_0x33d1a4){console[_0x42af('0x29')](_0x33d1a4);});}function getZohoUser(_0x555529,_0x1a6bdb){return new BPromise(function(_0x459d4a,_0x4136eb){request(_0x555529)[_0x42af('0x3b')](function(_0x4aab2b){var _0x62e1cf=null;if(_0x4aab2b){_0x62e1cf=_0x4aab2b[_0x42af('0x3c')][0x0];_0x62e1cf[_0x42af('0x3d')]=_0x1a6bdb;}_0x459d4a(_0x62e1cf);})['catch'](function(_0x3f3f08){_0x4136eb(_0x3f3f08);});});}function createEndUser(_0x4d2dc7,_0x55e8bf,_0x136f00,_0x5f519d,_0x428b28,_0x1c527b){var _0x136f00=getName(_0x136f00);return request({'method':_0x42af('0x21'),'uri':'https://www.zohoapis.'+_0x55e8bf+_0x42af('0x3e')+_[_0x42af('0x3f')](_0x1c527b[_0x42af('0x40')])+'s','body':{'data':[{'Last_Name':_0x136f00[0x1],'First_Name':_0x136f00[0x0],'Phone':_0x5f519d,'Owner':{'name':!_['isNil'](_0x428b28[_0x42af('0x41')][_0x42af('0x16')])?_0x428b28[_0x42af('0x41')][_0x42af('0x16')]:!_[_0x42af('0x42')](_0x428b28[_0x42af('0x43')])?_0x428b28[_0x42af('0x43')]+'\x20'+_0x428b28['last_name']:_0x428b28['last_name'],'id':_0x428b28['id']}}]},'headers':{'Authorization':_0x42af('0x2f')+_0x4d2dc7},'json':!![]})[_0x42af('0x3b')](function(_0x4d9481){if(_0x4d9481&&_0x4d9481[_0x42af('0x3c')][0x0][_0x42af('0x44')]===_0x42af('0x45')){var _0x49c959=_0x4d9481['data'][0x0][_0x42af('0x46')];_0x49c959[_0x42af('0x3d')]=_[_0x42af('0x3f')](_0x1c527b[_0x42af('0x40')])+'s';return _0x49c959;}logger['error'](_0x42af('0x38'),JSON[_0x42af('0x39')](data));throw new Error(_0x42af('0x47')+JSON['stringify'](data));})['catch'](function(_0x5d74a1){console['log'](_0x42af('0x48'),_0x5d74a1);});}function getEndUser(_0x277fba,_0x2a3b71,_0x2257f8,_0x124f9d,_0x347462,_0x47ccfc,_0x2edbf6){var _0x3786dc={'method':_0x42af('0x2b'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x277fba},'json':!![]};switch(_0x2edbf6['moduleSearch']){case'contact_lead':_0x3786dc[_0x42af('0x49')]=_0x42af('0x4a')+_0x2a3b71+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x347462+'))';return getZohoUser(_0x3786dc,_0x42af('0x4b'))[_0x42af('0x3b')](function(_0x3ab94f){if(_0x3ab94f)return _0x3ab94f;_0x3786dc[_0x42af('0x49')]=_0x42af('0x4a')+_0x2a3b71+_0x42af('0x4c')+_0x347462+'))';return getZohoUser(_0x3786dc,_0x42af('0x4d'))[_0x42af('0x3b')](function(_0xa21aa2){if(_0xa21aa2)return _0xa21aa2;if(_0x2edbf6[_0x42af('0x40')]!=_0x42af('0x4e')){return createEndUser(_0x277fba,_0x2a3b71,_0x124f9d,_0x347462,_0x47ccfc,_0x2edbf6);}else{return{};}});});break;case _0x42af('0x4f'):_0x3786dc[_0x42af('0x49')]=_0x42af('0x4a')+_0x2a3b71+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x347462+'))';return getZohoUser(_0x3786dc,_0x42af('0x4b'))[_0x42af('0x3b')](function(_0x5ded0f){if(_0x5ded0f)return _0x5ded0f;if(_0x2edbf6[_0x42af('0x40')]!='nothing'){return createEndUser(_0x277fba,_0x2a3b71,_0x124f9d,_0x347462,_0x47ccfc,_0x2edbf6);}else{return{};}});break;case _0x42af('0x50'):_0x3786dc['uri']=_0x42af('0x4a')+_0x2a3b71+_0x42af('0x4c')+_0x347462+'))';return getZohoUser(_0x3786dc,'Leads')[_0x42af('0x3b')](function(_0x36cde6){if(_0x36cde6)return _0x36cde6;if(_0x2edbf6[_0x42af('0x40')]!=_0x42af('0x4e')){return createEndUser(_0x277fba,_0x2a3b71,_0x124f9d,_0x347462,_0x47ccfc,_0x2edbf6);}else{return{};}});break;}}function getCall(_0x3dc699,_0x635236,_0x110b44,_0x4c1c87,_0x3f4b60,_0xa7ee30,_0xb05e8b,_0x472f9c){logger['info']('Creating\x20new\x20call...');var _0x2c6cee={};_0x2c6cee[_0x42af('0x51')]={'name':!_[_0x42af('0x42')](_0x4c1c87['role']['name'])&&!_[_0x42af('0x42')](_0x4c1c87[_0x42af('0x35')][_0x42af('0x16')])&&_0x4c1c87['profile'][_0x42af('0x16')]===_0x42af('0x52')?_0x4c1c87[_0x42af('0x41')]['name']:!_['isNil'](_0x4c1c87[_0x42af('0x43')])?_0x4c1c87['first_name']+'\x20'+_0x4c1c87['last_name']:_0x4c1c87[_0x42af('0x53')],'id':_0x4c1c87['id']};_0x2c6cee['Subject']=intUtil['getString'](_0xa7ee30['Subjects'],_0xb05e8b,'\x20');_0x2c6cee[_0x42af('0x54')]=intUtil[_0x42af('0x55')](_0xa7ee30[_0x42af('0x56')],_0xb05e8b,'\x0a');if(_0x3f4b60[_0x42af('0x3d')]===_0x42af('0x4b')){_0x2c6cee['Who_Id']={'name':!_[_0x42af('0x42')](_0x3f4b60['Full_Name'])?_0x3f4b60['Full_Name']:!_['isNil'](_0x3f4b60['First_Name'])?_0x3f4b60['First_Name']+'\x20'+_0x3f4b60[_0x42af('0x57')]:_0x3f4b60[_0x42af('0x57')],'id':_0x3f4b60['id']};}if(_0x3f4b60[_0x42af('0x3d')]===_0x42af('0x4d')){_0x2c6cee['What_Id']={'name':!_[_0x42af('0x42')](_0x3f4b60[_0x42af('0x58')])?_0x3f4b60[_0x42af('0x58')]:!_[_0x42af('0x42')](_0x3f4b60[_0x42af('0x59')])?_0x3f4b60[_0x42af('0x59')]+'\x20'+_0x3f4b60[_0x42af('0x57')]:_0x3f4b60['Last_Name'],'id':_0x3f4b60['id']};_0x2c6cee['$se_module']=_['startCase'](_0x3f4b60[_0x42af('0x3d')]);}if(_0xb05e8b['talktime']){_0x2c6cee[_0x42af('0x5a')]=moment[_0x42af('0x5b')](parseInt(_0xb05e8b['talktime'])*0x3e8)[_0x42af('0x2c')](_0x42af('0x5c'));}else if(_0xb05e8b[_0x42af('0x5d')]&&_0xb05e8b[_0x42af('0x5e')]){_0x2c6cee[_0x42af('0x5a')]=moment[_0x42af('0x5b')](moment(_0xb05e8b[_0x42af('0x5e')],'YYYY-MM-DDTHH:mm:ss')[_0x42af('0x5f')](moment(_0xb05e8b[_0x42af('0x60')],_0x42af('0x61'))))['format'](_0x42af('0x5c'));}switch(_0xb05e8b[_0x42af('0x62')]){case _0x42af('0x63'):_0x2c6cee[_0x42af('0x64')]=_0x42af('0x65');break;case'complete':case'connect':_0x2c6cee['Call_Result']='Answered';break;case _0x42af('0x66'):_0x2c6cee[_0x42af('0x64')]='Rejected';break;case _0x42af('0x67'):_0x2c6cee['Call_Result']=_0x42af('0x68');break;case _0x42af('0x69'):_0x2c6cee['Call_Result']=_0x42af('0x6a');default:}_0x2c6cee[_0x42af('0x6b')]=(_0x472f9c===_0x42af('0x6c')?moment(_0xb05e8b['starttime'])[_0x42af('0x2c')](_0x42af('0x61')):moment(_0xb05e8b[_0x42af('0x6d')])[_0x42af('0x2c')](_0x42af('0x61')))||moment()[_0x42af('0x2c')]('YYYY-MM-DDTHH:mm:ss');_0x2c6cee[_0x42af('0x6e')]=_0x472f9c||_0x42af('0x6f');_0x2c6cee=_[_0x42af('0x70')](_0x2c6cee,getCustomFields(_0xa7ee30[_0x42af('0x71')],_0xb05e8b));return request({'method':_0x42af('0x21'),'uri':_0x42af('0x4a')+_0x635236+_0x42af('0x72'),'headers':{'Authorization':_0x42af('0x2f')+_0x3dc699},'body':{'data':[_0x2c6cee]},'json':!![]})[_0x42af('0x3b')](function(_0x3d9f81){if(_0x3d9f81&&_0x3d9f81[_0x42af('0x3c')][0x0][_0x42af('0x44')]===_0x42af('0x45')){logger[_0x42af('0x2a')](_0x42af('0x73'));return{'id':_0x3d9f81[_0x42af('0x3c')][0x0][_0x42af('0x46')]['id']};}})[_0x42af('0x28')](function(_0x9d5f1c){logger[_0x42af('0x2a')](_0x42af('0x74'),_0x9d5f1c[_0x42af('0x75')]);console[_0x42af('0x76')](_0x42af('0x74'),_0x9d5f1c);});}exports[_0x42af('0x77')]=function(_0x26150a,_0x3492d9,_0x474ce5,_0x24dce1,_0x32d426,_0xc00993){var _0x2d1ed8,_0x3c9d50,_0x155e61;_0xc00993[_0x42af('0x78')]=intUtil['stripTrailingSlash'](_0xc00993[_0x42af('0x78')]);_0xc00993['serverUrl']=intUtil[_0x42af('0x79')](_0xc00993[_0x42af('0x7a')]);if(_0x32d426&&_0x32d426[_0x42af('0x7b')]){logger[_0x42af('0x2a')](_0x42af('0x7c'),_0x42af('0x7d'));_0x3492d9[_0x42af('0x7e')]=_0xc00993[_0x42af('0x7a')]+'/api/voice/recordings/'+_0x3492d9[_0x42af('0x7f')]+_0x42af('0x80')+md5(_0x3492d9[_0x42af('0x7f')]);}else{_0x3492d9[_0x42af('0x7e')]='';}var _0x318cf2=_0xc00993['host']===_0x42af('0x81')?'eu':_0x42af('0x82');return getAccessToken(_0xc00993)[_0x42af('0x3b')](function(_0x1098a7){_0x155e61=_0x1098a7;return getUser(_0x155e61,_0x318cf2,_0xc00993,_0x24dce1[_0x42af('0x83')]);})['then'](function(_0x410d39){_0x2d1ed8=_0x410d39;logger[_0x42af('0x2a')]('The\x20User\x20ID\x20is:',_0x2d1ed8['id']);return getEndUser(_0x155e61,_0x318cf2,_0xc00993,_0x3492d9[_0x42af('0x84')],_0x3492d9['calleridnum'],_0x2d1ed8,_0x474ce5);})[_0x42af('0x3b')](function(_0x4c31eb){_0x3c9d50=_0x4c31eb;return getCall(_0x155e61,_0x318cf2,_0xc00993,_0x2d1ed8,_0x3c9d50,_0x474ce5,_0x3492d9,_0x42af('0x6f'));})['then'](function(_0x4c5853){if(_0x4c5853){logger['info'](_0x42af('0x85'),_0x4c5853['id']);logger[_0x42af('0x2a')](_0x42af('0x7c'),_0x42af('0x86'));emit(util[_0x42af('0x2c')](_0x42af('0x87'),_0x24dce1[_0x42af('0x16')]),_0x42af('0x88'),{'uri':_0x42af('0x89')+_0xc00993[_0x42af('0x78')]+_0x42af('0x8a')+_0x4c5853['id']});}})['catch'](function(_0x211c00){logger['error'](_0x42af('0x7c'),JSON[_0x42af('0x39')](_0x211c00));});};exports[_0x42af('0x6c')]=function(_0x15b6b2,_0x17f37a,_0x197d6b,_0x393552,_0x4001cd,_0x8a599d,_0x527564){var _0x45fee2,_0x26784c,_0x37c4ea;_0x8a599d[_0x42af('0x78')]=intUtil['stripTrailingSlash'](_0x8a599d[_0x42af('0x78')]);_0x8a599d[_0x42af('0x7a')]=intUtil[_0x42af('0x79')](_0x8a599d[_0x42af('0x7a')]);if(_0x527564&&_0x527564[_0x42af('0x8b')]&&_0x527564[_0x42af('0x8b')]!==_0x42af('0x8c')){logger[_0x42af('0x2a')](_0x42af('0x8d'),_0x42af('0x7d'));_0x17f37a[_0x42af('0x7e')]=_0x8a599d['serverUrl']+_0x42af('0x8e')+_0x17f37a[_0x42af('0x7f')]+_0x42af('0x80')+md5(_0x17f37a[_0x42af('0x7f')]);}var _0x4ac388=_0x8a599d[_0x42af('0x78')]==='zoho.eu'?'eu':_0x42af('0x82');return getAccessToken(_0x8a599d)[_0x42af('0x3b')](function(_0x5121fd){_0x37c4ea=_0x5121fd;return getUser(_0x37c4ea,_0x4ac388,_0x8a599d,_0x393552[_0x42af('0x83')]);})[_0x42af('0x3b')](function(_0x26f009){_0x45fee2=_0x26f009;logger[_0x42af('0x2a')](_0x42af('0x8f'),_0x45fee2['id']);return getEndUser(_0x37c4ea,_0x4ac388,_0x8a599d,_0x17f37a[_0x42af('0x90')],_0x17f37a['destcalleridnum'],_0x45fee2,_0x197d6b);})['then'](function(_0x262008){_0x26784c=_0x262008;return getCall(_0x37c4ea,_0x4ac388,_0x8a599d,_0x45fee2,_0x26784c,_0x197d6b,_0x17f37a,_0x42af('0x91'));})[_0x42af('0x3b')](function(_0x4cbcd8){if(_0x4cbcd8){logger[_0x42af('0x2a')](_0x42af('0x85'),_0x4cbcd8['id']);logger[_0x42af('0x2a')](_0x42af('0x8d'),_0x42af('0x86'));emit(util['format']('user:%s',_0x393552[_0x42af('0x16')]),_0x42af('0x88'),{'uri':'https://crm.'+_0x8a599d['host']+_0x42af('0x8a')+_0x4cbcd8['id']});}})[_0x42af('0x28')](function(_0x1c7ee3){logger[_0x42af('0x29')](_0x42af('0x8d'),JSON[_0x42af('0x39')](_0x1c7ee3));});};exports[_0x42af('0x92')]=function(_0x24d5d4,_0x4090a7,_0x5cf679,_0x3b44a3,_0x13de49,_0x35fe47){var _0x53371e,_0x4b4743,_0x1bacdb;_0x35fe47[_0x42af('0x78')]=intUtil[_0x42af('0x79')](_0x35fe47[_0x42af('0x78')]);_0x35fe47[_0x42af('0x7a')]=intUtil['stripTrailingSlash'](_0x35fe47[_0x42af('0x7a')]);if(_0x13de49&&_0x13de49[_0x42af('0x7b')]){logger[_0x42af('0x2a')]('['+_0x4090a7['lastevent'][_0x42af('0x93')]()+']','Recording\x20is\x20enabled!');_0x4090a7[_0x42af('0x7e')]=_0x35fe47[_0x42af('0x7a')]+'/api/voice/recordings/'+_0x4090a7[_0x42af('0x7f')]+_0x42af('0x80')+md5(_0x4090a7[_0x42af('0x7f')]);}else{_0x4090a7[_0x42af('0x7e')]='';}var _0x221cfe=_0x35fe47['host']===_0x42af('0x81')?'eu':'com';return getAccessToken(_0x35fe47)[_0x42af('0x3b')](function(_0x510ca9){_0x1bacdb=_0x510ca9;return getUser(_0x1bacdb,_0x221cfe,_0x35fe47);})[_0x42af('0x3b')](function(_0x394d6c){_0x53371e=_0x394d6c;logger[_0x42af('0x2a')](_0x42af('0x8f'),_0x53371e['id']);return getEndUser(_0x1bacdb,_0x221cfe,_0x35fe47,_0x4090a7['calleridname'],_0x4090a7[_0x42af('0x94')],_0x53371e,_0x5cf679);})[_0x42af('0x3b')](function(_0x1cd060){_0x4b4743=_0x1cd060;return getCall(_0x1bacdb,_0x221cfe,_0x35fe47,_0x53371e,_0x4b4743,_0x5cf679,_0x4090a7,_0x42af('0x6f'));})[_0x42af('0x3b')](function(_0x176d6e){if(_0x176d6e){logger['info']('The\x20Call\x20ID\x20is:',_0x176d6e['id']);}})[_0x42af('0x28')](function(_0x4cf6a8){logger[_0x42af('0x29')]('['+_0x4090a7[_0x42af('0x62')][_0x42af('0x93')]()+']',JSON[_0x42af('0x39')](_0x4cf6a8));});}; \ 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 66d6b66..14d5f38 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 _0x3d29=['info','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x3d29,0x16d));var _0x93d2=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x3d29[_0x4c0622];return _0x1799d8;};'use strict';var util=require(_0x93d2('0x0'));var sh=require(_0x93d2('0x1'));var Mustache=require(_0x93d2('0x2'));var logger=require(_0x93d2('0x3'))(_0x93d2('0x4'));exports[_0x93d2('0x5')]=function(_0x347b20,_0x431ff8){var _0x2b5e8f=_0x347b20[_0x93d2('0x6')]?_0x347b20['data2']:_0x93d2('0x7');var _0xd7955e=_0x347b20[_0x93d2('0x8')]?Mustache[_0x93d2('0x9')](_0x347b20[_0x93d2('0x8')],_0x431ff8):_0x431ff8;sh['exec'](_0xd7955e,function(_0x5681d2,_0x3a1184,_0x158d4a){if(_0x5681d2!==0x0){logger[_0x93d2('0xa')](util[_0x93d2('0xb')](_0x93d2('0xc'),_0x2b5e8f,_0xd7955e,_0x5681d2,_0x158d4a));}else{logger[_0x93d2('0xd')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x2b5e8f,_0xd7955e,_0x3a1184));}});}; \ No newline at end of file +var _0x95e0=['render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','../../../../config/logger','exec'];(function(_0xa31086,_0xdc718a){var _0x732df0=function(_0x3febb8){while(--_0x3febb8){_0xa31086['push'](_0xa31086['shift']());}};_0x732df0(++_0xdc718a);}(_0x95e0,0x178));var _0x095e=function(_0x9ff33a,_0x337edb){_0x9ff33a=_0x9ff33a-0x0;var _0x5d6bda=_0x95e0[_0x9ff33a];return _0x5d6bda;};'use strict';var util=require(_0x095e('0x0'));var sh=require(_0x095e('0x1'));var Mustache=require('mustache');var logger=require(_0x095e('0x2'))('trigger');exports[_0x095e('0x3')]=function(_0x4a3219,_0x25a402){var _0x125899=_0x4a3219['data2']?_0x4a3219['data2']:'Script';var _0x4fbac1=_0x4a3219['data3']?Mustache[_0x095e('0x4')](_0x4a3219[_0x095e('0x5')],_0x25a402):_0x25a402;sh['exec'](_0x4fbac1,function(_0x1115f3,_0x1a959c,_0x926d28){if(_0x1115f3!==0x0){logger[_0x095e('0x6')](util[_0x095e('0x7')](_0x095e('0x8'),_0x125899,_0x4fbac1,_0x1115f3,_0x926d28));}else{logger[_0x095e('0x9')](util[_0x095e('0x7')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x125899,_0x4fbac1,_0x1a959c));}});}; \ 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 86eb3b8..5123dba 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 _0x709f=['data5','headers','data6','error','stack','data1','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','stringify','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','request-promise','util','lodash','mustache','../../../../config/logger','toUpperCase','render','data2'];(function(_0x5a4659,_0x3a6650){var _0x3a6895=function(_0x341d22){while(--_0x341d22){_0x5a4659['push'](_0x5a4659['shift']());}};_0x3a6895(++_0x3a6650);}(_0x709f,0x154));var _0xf709=function(_0x342782,_0x4236e0){_0x342782=_0x342782-0x0;var _0xadb50c=_0x709f[_0x342782];return _0xadb50c;};'use strict';var rp=require(_0xf709('0x0'));var util=require(_0xf709('0x1'));var _=require(_0xf709('0x2'));var Mustache=require(_0xf709('0x3'));var logger=require(_0xf709('0x4'))('trigger');exports['exec']=function(_0x3ce399,_0x359da8){var _0x40b50a,_0xf47278;var _0x33ffe9={'method':_0x3ce399['data1'][_0xf709('0x5')](),'uri':Mustache[_0xf709('0x6')](_0x3ce399[_0xf709('0x7')],_0x359da8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x3ce399['data5'])==='number'&&parseInt(_0x3ce399[_0xf709('0x8')])>=0x1&&parseInt(_0x3ce399[_0xf709('0x8')])<=0xa?parseInt(_0x3ce399[_0xf709('0x8')])*0x3e8:0x5*0x3e8};try{_0x33ffe9[_0xf709('0x9')]=_0x3ce399[_0xf709('0xa')]?JSON['parse'](Mustache[_0xf709('0x6')](_0x3ce399[_0xf709('0xa')],_0x359da8)):{};}catch(_0x2e5c31){logger[_0xf709('0xb')](_0x2e5c31[_0xf709('0xc')]);}switch(_0x3ce399[_0xf709('0xd')][_0xf709('0x5')]()){case _0xf709('0xe'):case _0xf709('0xf'):_0x40b50a=null;_0x33ffe9['qs']=_0x359da8;break;case _0xf709('0x10'):case _0xf709('0x11'):if(_0x3ce399[_0xf709('0x12')]){try{_0x40b50a=JSON['parse'](Mustache['render'](_0x3ce399[_0xf709('0x12')],_0x359da8));_0x33ffe9[_0xf709('0x13')]=_0x40b50a;}catch(_0x16d25d){logger[_0xf709('0xb')](_0x16d25d['stack']);logger[_0xf709('0xb')](_0xf709('0x14'));}}else{_0x40b50a=_0x359da8;_0x33ffe9[_0xf709('0x13')]=_0x40b50a;}break;}logger['info'](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x3ce399['data1'],_0x3ce399['data2'],JSON[_0xf709('0x15')](_0x33ffe9)));rp(_0x33ffe9)['then'](function(_0x519811){_0x40b50a=!_['isNil'](_0x40b50a)?',\x20request\x20body:\x20'+_0x40b50a:'';_0xf47278=typeof _0x519811[_0xf709('0x13')]===_0xf709('0x16')?JSON[_0xf709('0x15')](_0x519811[_0xf709('0x13')]):_0x519811[_0xf709('0x13')];logger['info'](util[_0xf709('0x17')](_0xf709('0x18'),_0x3ce399['data1'],_0x3ce399['data2'],_0x519811[_0xf709('0x19')],_0xf47278));})[_0xf709('0x1a')](function(_0x2ab8b3){logger[_0xf709('0xb')](util[_0xf709('0x17')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x3ce399['data1'],_0x3ce399['data2'],_0x2ab8b3[_0xf709('0x19')],_0x2ab8b3[_0xf709('0x1b')],_0x2ab8b3[_0xf709('0x1c')]));});}; \ No newline at end of file +var _0x6de1=['data6','parse','error','stack','GET','POST','PUT','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6de1,0x80));var _0x16de=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x6de1[_0x27af45];return _0x18df21;};'use strict';var rp=require(_0x16de('0x0'));var util=require(_0x16de('0x1'));var _=require(_0x16de('0x2'));var Mustache=require(_0x16de('0x3'));var logger=require(_0x16de('0x4'))(_0x16de('0x5'));exports[_0x16de('0x6')]=function(_0x2e2cd2,_0x3327e8){var _0x430af7,_0x50b3b0;var _0x538291={'method':_0x2e2cd2[_0x16de('0x7')][_0x16de('0x8')](),'uri':Mustache[_0x16de('0x9')](_0x2e2cd2['data2'],_0x3327e8),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2e2cd2[_0x16de('0xa')])===_0x16de('0xb')&&parseInt(_0x2e2cd2[_0x16de('0xa')])>=0x1&&parseInt(_0x2e2cd2[_0x16de('0xa')])<=0xa?parseInt(_0x2e2cd2[_0x16de('0xa')])*0x3e8:0x5*0x3e8};try{_0x538291['headers']=_0x2e2cd2[_0x16de('0xc')]?JSON[_0x16de('0xd')](Mustache[_0x16de('0x9')](_0x2e2cd2[_0x16de('0xc')],_0x3327e8)):{};}catch(_0x23708e){logger[_0x16de('0xe')](_0x23708e[_0x16de('0xf')]);}switch(_0x2e2cd2['data1'][_0x16de('0x8')]()){case _0x16de('0x10'):case'DELETE':_0x430af7=null;_0x538291['qs']=_0x3327e8;break;case _0x16de('0x11'):case _0x16de('0x12'):if(_0x2e2cd2[_0x16de('0x13')]){try{_0x430af7=JSON[_0x16de('0xd')](Mustache[_0x16de('0x9')](_0x2e2cd2[_0x16de('0x13')],_0x3327e8));_0x538291[_0x16de('0x14')]=_0x430af7;}catch(_0x3366a5){logger[_0x16de('0xe')](_0x3366a5[_0x16de('0xf')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x430af7=_0x3327e8;_0x538291['body']=_0x430af7;}break;}logger[_0x16de('0x15')](util['format'](_0x16de('0x16'),_0x2e2cd2[_0x16de('0x7')],_0x2e2cd2[_0x16de('0x17')],JSON[_0x16de('0x18')](_0x538291)));rp(_0x538291)[_0x16de('0x19')](function(_0x1d06ff){_0x430af7=!_[_0x16de('0x1a')](_0x430af7)?_0x16de('0x1b')+_0x430af7:'';_0x50b3b0=typeof _0x1d06ff[_0x16de('0x14')]===_0x16de('0x1c')?JSON[_0x16de('0x18')](_0x1d06ff[_0x16de('0x14')]):_0x1d06ff[_0x16de('0x14')];logger['info'](util[_0x16de('0x1d')](_0x16de('0x1e'),_0x2e2cd2[_0x16de('0x7')],_0x2e2cd2[_0x16de('0x17')],_0x1d06ff[_0x16de('0x1f')],_0x50b3b0));})['catch'](function(_0x545f64){logger[_0x16de('0xe')](util[_0x16de('0x1d')](_0x16de('0x20'),_0x2e2cd2[_0x16de('0x7')],_0x2e2cd2[_0x16de('0x17')],_0x545f64[_0x16de('0x1f')],_0x545f64[_0x16de('0x21')],_0x545f64[_0x16de('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 3d01431..ede1994 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 _0xf61c=['jayson/promise','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc','message','result','catch','exports'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xf61c,0xff));var _0xcf61=function(_0x36ae5e,_0x4a0535){_0x36ae5e=_0x36ae5e-0x0;var _0x422de4=_0xf61c[_0x36ae5e];return _0x422de4;};'use strict';var jayson=require(_0xcf61('0x0'));var BPromise=require('bluebird');var logger=require(_0xcf61('0x1'))(_0xcf61('0x2'));var client=jayson[_0xcf61('0x3')][_0xcf61('0x4')]({'port':0x2329});client[_0xcf61('0x5')]=function(_0x34ccf3,_0x391512){return new BPromise(function(_0x5f5cfb,_0x784fd7){return client[_0xcf61('0x6')](_0x34ccf3,_0x391512)[_0xcf61('0x7')](function(_0xfa5890){logger[_0xcf61('0x8')]('rpc','routing',_0x34ccf3,_0x391512,_0xfa5890);if(_0xfa5890[_0xcf61('0x9')]){logger['error'](_0xcf61('0xa'),_0xcf61('0x2'),_0x34ccf3,_0xfa5890['error'][_0xcf61('0xb')],_0x391512);return _0x784fd7(_0xfa5890[_0xcf61('0x9')]['message']);}else{return _0x5f5cfb(_0xfa5890[_0xcf61('0xc')]);}})[_0xcf61('0xd')](function(_0xb94803){logger[_0xcf61('0x9')](_0xcf61('0xa'),_0xcf61('0x2'),_0x34ccf3,_0xb94803,_0x391512);return _0x784fd7(_0xb94803);});});};module[_0xcf61('0xe')]=client; \ No newline at end of file +var _0xef2d=['../../config/logger','routing','client','Request','then','debug','rpc','error','message','result','catch','jayson/promise','bluebird'];(function(_0x4d8744,_0x203345){var _0x17fb37=function(_0x216209){while(--_0x216209){_0x4d8744['push'](_0x4d8744['shift']());}};_0x17fb37(++_0x203345);}(_0xef2d,0x150));var _0xdef2=function(_0x181722,_0x27a656){_0x181722=_0x181722-0x0;var _0x34887c=_0xef2d[_0x181722];return _0x34887c;};'use strict';var jayson=require(_0xdef2('0x0'));var BPromise=require(_0xdef2('0x1'));var logger=require(_0xdef2('0x2'))(_0xdef2('0x3'));var client=jayson[_0xdef2('0x4')]['http']({'port':0x2329});client[_0xdef2('0x5')]=function(_0x1667dc,_0x3feaeb){return new BPromise(function(_0xd7ae1d,_0x3b2c4e){return client['request'](_0x1667dc,_0x3feaeb)[_0xdef2('0x6')](function(_0x93576b){logger[_0xdef2('0x7')](_0xdef2('0x8'),_0xdef2('0x3'),_0x1667dc,_0x3feaeb,_0x93576b);if(_0x93576b['error']){logger[_0xdef2('0x9')](_0xdef2('0x8'),_0xdef2('0x3'),_0x1667dc,_0x93576b['error'][_0xdef2('0xa')],_0x3feaeb);return _0x3b2c4e(_0x93576b['error'][_0xdef2('0xa')]);}else{return _0xd7ae1d(_0x93576b[_0xdef2('0xb')]);}})[_0xdef2('0xc')](function(_0x1f0256){logger[_0xdef2('0x9')](_0xdef2('0x8'),_0xdef2('0x3'),_0x1667dc,_0x1f0256,_0x3feaeb);return _0x3b2c4e(_0x1f0256);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8848951..ff6b738 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 _0x1cb0=['refresh','listen','loginMailFrequency','error','./server','./rpc/mailAccount','../../config/logger','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x5f1f55,_0x52a0ba){var _0xb95b54=function(_0x58c9b1){while(--_0x58c9b1){_0x5f1f55['push'](_0x5f1f55['shift']());}};_0xb95b54(++_0x52a0ba);}(_0x1cb0,0x9e));var _0x01cb=function(_0x21d36e,_0x5dc096){_0x21d36e=_0x21d36e-0x0;var _0x4cc307=_0x1cb0[_0x21d36e];return _0x4cc307;};'use strict';var server=require(_0x01cb('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x01cb('0x1'));var setting=require('./rpc/setting');var logger=require(_0x01cb('0x2'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x01cb('0x3')]()[_0x01cb('0x4')](mailAccount[_0x01cb('0x5')]())[_0x01cb('0x4')](realtime[_0x01cb('0x6')]())[_0x01cb('0x4')](function(){email[_0x01cb('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x01cb('0x8')](realtime,email)[_0x01cb('0x4')](function(){return initRealtime();})[_0x01cb('0x4')](function(){return setting['getSettings']();})[_0x01cb('0x4')](function(_0x31c1db){return setInterval(initRealtime,_0x31c1db[_0x01cb('0x9')]*0x3e8);})['catch'](function(_0x29f8af){logger[_0x01cb('0xa')]('Email\x20service\x20initialization',_0x29f8af);});}main(); \ No newline at end of file +var _0x7601=['then','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./server','./lib/email','./rpc/setting','email','resolve'];(function(_0x3e41a6,_0xe86451){var _0x221e4e=function(_0x2db3fa){while(--_0x2db3fa){_0x3e41a6['push'](_0x3e41a6['shift']());}};_0x221e4e(++_0xe86451);}(_0x7601,0x174));var _0x1760=function(_0x4c578c,_0x50972b){_0x4c578c=_0x4c578c-0x0;var _0x18ce5c=_0x7601[_0x4c578c];return _0x18ce5c;};'use strict';var server=require(_0x1760('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x1760('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x1760('0x2'));var logger=require('../../config/logger')(_0x1760('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x1760('0x4')]()[_0x1760('0x5')](mailAccount['getMailAccounts']())[_0x1760('0x5')](realtime[_0x1760('0x6')]())['then'](function(){email[_0x1760('0x7')](realtime[_0x1760('0x8')]);return realtime;});}function main(){return server[_0x1760('0x9')](realtime,email)[_0x1760('0x5')](function(){return initRealtime();})['then'](function(){return setting[_0x1760('0xa')]();})['then'](function(_0x3a4aad){return setInterval(initRealtime,_0x3a4aad[_0x1760('0xb')]*0x3e8);})['catch'](function(_0x252849){logger['error'](_0x1760('0xc'),_0x252849);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 63f2111..0ad1de7 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 _0x5702=['bind','handleImapEmail','end','error','handleImapError','isNil','disabled','connected','messages','info','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','mailAccount:update','refresh','hasOwnProperty','service','provider','box','handleImapBox'];(function(_0xd9621e,_0x8a8f42){var _0x34f0df=function(_0x594133){while(--_0x594133){_0xd9621e['push'](_0xd9621e['shift']());}};_0x34f0df(++_0x8a8f42);}(_0x5702,0x92));var _0x2570=function(_0x164f2b,_0x1df442){_0x164f2b=_0x164f2b-0x0;var _0x1e9ca3=_0x5702[_0x164f2b];return _0x1e9ca3;};'use strict';var _=require(_0x2570('0x0'));var moment=require(_0x2570('0x1'));var BPromise=require('bluebird');var md5=require(_0x2570('0x2'));var Redis=require(_0x2570('0x3'));var config=require(_0x2570('0x4'));var logger=require(_0x2570('0x5'))(_0x2570('0x6'));config[_0x2570('0x7')]=_[_0x2570('0x8')](config[_0x2570('0x7')],{'host':_0x2570('0x9'),'port':0x18eb});var io=require(_0x2570('0xa'))(new Redis(config[_0x2570('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x2570('0xb'));var mailAccount=require(_0x2570('0xc'));var md5Accounts={};function EmailChannel(_0x14c529){logger['info'](_0x2570('0xd'));this['mailAccounts']=_0x14c529[_0x2570('0xe')];this[_0x2570('0xf')]={};this[_0x2570('0x10')]=new EmailSmtp();}EmailChannel[_0x2570('0x11')][_0x2570('0x12')]=function(_0x51c339){var _0x261507=this[_0x2570('0xe')][_0x51c339];var _0x325a24={'id':_0x261507['id'],'name':_0x261507[_0x2570('0x13')],'key':_0x261507[_0x2570('0x14')],'active':_0x261507[_0x2570('0x15')],'Imap':{'status':_0x261507[_0x2570('0x16')][_0x2570('0x17')],'messageStatus':_0x261507[_0x2570('0x16')][_0x2570('0x18')],'total':_0x261507[_0x2570('0x16')][_0x2570('0x19')]}};if(_['isNil'](md5Accounts[_0x51c339])){md5Accounts[_0x51c339]={};}var _0x4f16d0=md5(JSON[_0x2570('0x1a')](_0x325a24));if(md5Accounts[_0x51c339]['md5']!==_0x4f16d0){md5Accounts[_0x51c339]['md5']=_0x4f16d0;io['emit'](_0x2570('0x1b'),_0x325a24);}};EmailChannel[_0x2570('0x11')][_0x2570('0x1c')]=function(_0x2e4bea){for(var _0x191433 in _0x2e4bea){if(_0x2e4bea[_0x2570('0x1d')](_0x191433)){if(_0x2e4bea[_0x191433]['Imap']&&_0x2e4bea[_0x191433][_0x2570('0x15')]){var _0x583d2a=_0x2e4bea[_0x191433][_0x2570('0x16')];if(!_0x583d2a[_0x2570('0x1e')]&&_0x2e4bea[_0x191433][_0x2570('0x1f')]!=='custom')_0x583d2a[_0x2570('0x1e')]=_0x2e4bea[_0x191433][_0x2570('0x1f')];if(!this['imapAccounts'][_0x2570('0x1d')](_0x583d2a['id'])){this['imapAccounts'][_0x583d2a['id']]=new EmailImap(_0x583d2a,_0x2e4bea[_0x191433][_0x2570('0x6')]);this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x20'),this[_0x2570('0x21')][_0x2570('0x22')](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x6'),this[_0x2570('0x23')][_0x2570('0x22')](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x24'),this['handleImapEnd']['bind'](this,_0x191433));this[_0x2570('0xf')][_0x583d2a['id']]['on'](_0x2570('0x25'),this[_0x2570('0x26')][_0x2570('0x22')](this,_0x191433));}}else{if(_[_0x2570('0x27')](this[_0x2570('0xe')][_0x191433]['Imap'])){this[_0x2570('0xe')][_0x191433]['Imap']={};}this[_0x2570('0xe')][_0x191433][_0x2570('0x16')]['status']=_0x2570('0x28');this[_0x2570('0xe')][_0x191433][_0x2570('0x16')][_0x2570('0x18')]='';this[_0x2570('0x12')](_0x191433);}}}};EmailChannel['prototype'][_0x2570('0x21')]=function(_0x35ccff,_0x55331f){if(this[_0x2570('0xe')][_0x35ccff]){this['mailAccounts'][_0x35ccff][_0x2570('0x16')][_0x2570('0x17')]=_0x2570('0x29');this[_0x2570('0xe')][_0x35ccff]['Imap'][_0x2570('0x18')]=_0x55331f[_0x2570('0x13')];if(_0x55331f[_0x2570('0x2a')]){this[_0x2570('0xe')][_0x35ccff][_0x2570('0x16')][_0x2570('0x19')]=_0x55331f[_0x2570('0x2a')][_0x2570('0x19')];}return this[_0x2570('0x12')](_0x35ccff);}};EmailChannel[_0x2570('0x11')][_0x2570('0x23')]=function(_0x4d2dbe,_0x3a6f39){logger[_0x2570('0x2b')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3a6f39[_0x2570('0x2c')],_0x3a6f39['lastName'],_0x3a6f39[_0x2570('0x2d')],_0x4d2dbe);if(this['mailAccounts'][_0x4d2dbe]){return mailAccount[_0x2570('0x2e')](_0x4d2dbe,_0x3a6f39)[_0x2570('0x2f')](function(_0x58e656){if(_0x58e656){logger[_0x2570('0x2b')](_0x2570('0x30'));}})['catch'](function(_0x18a938){logger[_0x2570('0x25')](_0x2570('0x31'),JSON['stringify'](_0x18a938));});}};EmailChannel[_0x2570('0x11')][_0x2570('0x32')]=function(_0x41fad1){if(this[_0x2570('0xe')][_0x41fad1]&&this[_0x2570('0xe')][_0x41fad1][_0x2570('0x16')]){if(this['imapAccounts'][this['mailAccounts'][_0x41fad1][_0x2570('0x16')]['id']]){delete this[_0x2570('0xf')][this[_0x2570('0xe')][_0x41fad1][_0x2570('0x16')]['id']];}this['mailAccounts'][_0x41fad1][_0x2570('0x16')][_0x2570('0x33')]=moment();this[_0x2570('0x12')](_0x41fad1);}};EmailChannel[_0x2570('0x11')][_0x2570('0x26')]=function(_0x111547,_0x5d326f){if(this[_0x2570('0xe')][_0x111547]){this[_0x2570('0xe')][_0x111547][_0x2570('0x16')][_0x2570('0x17')]=_0x2570('0x25');this[_0x2570('0xe')][_0x111547][_0x2570('0x16')][_0x2570('0x18')]=_0x5d326f;return this['emit'](_0x111547);}};EmailChannel[_0x2570('0x11')][_0x2570('0x34')]=function(_0x3bafb0,_0x2a8587){return this[_0x2570('0x10')][_0x2570('0x35')](_0x3bafb0,_0x2a8587);};EmailChannel[_0x2570('0x11')][_0x2570('0x36')]=function(_0x100e73){var _0xfa2448=this;if(this[_0x2570('0xe')][_0x100e73['id']]){if(_[_0x2570('0x27')](this['mailAccounts'][_0x100e73['id']]['Smtp'])){this[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')]={};}this['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x33')]=moment();return new BPromise(function(_0x23fff7,_0x5bec5d){return _0xfa2448[_0x2570('0x10')][_0x2570('0x38')](_0x100e73)['then'](function(_0x37442c){_0xfa2448[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x17')]=_0x2570('0x39');_0xfa2448['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x18')]='';_0xfa2448[_0x2570('0x12')](_0x100e73['id']);_0x23fff7(_0x37442c);})[_0x2570('0x3a')](function(_0x3e41b8){_0xfa2448['mailAccounts'][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x17')]=_0x2570('0x25');_0xfa2448[_0x2570('0xe')][_0x100e73['id']][_0x2570('0x37')][_0x2570('0x18')]=_0x3e41b8;_0xfa2448[_0x2570('0x12')](_0x100e73['id']);_0x5bec5d(_0x3e41b8);});});}return this['smtp']['verify'](_0x100e73);};module[_0x2570('0x3b')]=EmailChannel; \ No newline at end of file +var _0xe682=['handleImapError','sendMail','send','verifySmtp','Smtp','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','active','status','Imap','messageStatus','total','isNil','stringify','emit','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync'];(function(_0x2d093b,_0x460963){var _0x1abe4e=function(_0x3608b4){while(--_0x3608b4){_0x2d093b['push'](_0x2d093b['shift']());}};_0x1abe4e(++_0x460963);}(_0xe682,0x129));var _0x2e68=function(_0x39803d,_0x360e50){_0x39803d=_0x39803d-0x0;var _0x33a9c9=_0xe682[_0x39803d];return _0x33a9c9;};'use strict';var _=require(_0x2e68('0x0'));var moment=require(_0x2e68('0x1'));var BPromise=require(_0x2e68('0x2'));var md5=require(_0x2e68('0x3'));var Redis=require(_0x2e68('0x4'));var config=require(_0x2e68('0x5'));var logger=require(_0x2e68('0x6'))(_0x2e68('0x7'));config[_0x2e68('0x8')]=_[_0x2e68('0x9')](config[_0x2e68('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e68('0x8')]));var EmailImap=require(_0x2e68('0xa'));var EmailSmtp=require(_0x2e68('0xb'));var mailAccount=require(_0x2e68('0xc'));var md5Accounts={};function EmailChannel(_0xac1d91){logger[_0x2e68('0xd')](_0x2e68('0xe'));this[_0x2e68('0xf')]=_0xac1d91[_0x2e68('0xf')];this[_0x2e68('0x10')]={};this[_0x2e68('0x11')]=new EmailSmtp();}EmailChannel[_0x2e68('0x12')]['emit']=function(_0xc90538){var _0x3ff0d2=this['mailAccounts'][_0xc90538];var _0x4b4e05={'id':_0x3ff0d2['id'],'name':_0x3ff0d2['name'],'key':_0x3ff0d2['key'],'active':_0x3ff0d2[_0x2e68('0x13')],'Imap':{'status':_0x3ff0d2['Imap'][_0x2e68('0x14')],'messageStatus':_0x3ff0d2[_0x2e68('0x15')][_0x2e68('0x16')],'total':_0x3ff0d2['Imap'][_0x2e68('0x17')]}};if(_[_0x2e68('0x18')](md5Accounts[_0xc90538])){md5Accounts[_0xc90538]={};}var _0x10bd58=md5(JSON[_0x2e68('0x19')](_0x4b4e05));if(md5Accounts[_0xc90538][_0x2e68('0x3')]!==_0x10bd58){md5Accounts[_0xc90538][_0x2e68('0x3')]=_0x10bd58;io[_0x2e68('0x1a')]('mailAccount:update',_0x4b4e05);}};EmailChannel[_0x2e68('0x12')]['refresh']=function(_0x41fec5){for(var _0x3e7d80 in _0x41fec5){if(_0x41fec5[_0x2e68('0x1b')](_0x3e7d80)){if(_0x41fec5[_0x3e7d80][_0x2e68('0x15')]&&_0x41fec5[_0x3e7d80]['active']){var _0x295b09=_0x41fec5[_0x3e7d80][_0x2e68('0x15')];if(!_0x295b09[_0x2e68('0x1c')]&&_0x41fec5[_0x3e7d80][_0x2e68('0x1d')]!==_0x2e68('0x1e'))_0x295b09[_0x2e68('0x1c')]=_0x41fec5[_0x3e7d80][_0x2e68('0x1d')];if(!this[_0x2e68('0x10')][_0x2e68('0x1b')](_0x295b09['id'])){this[_0x2e68('0x10')][_0x295b09['id']]=new EmailImap(_0x295b09,_0x41fec5[_0x3e7d80][_0x2e68('0x7')]);this['imapAccounts'][_0x295b09['id']]['on'](_0x2e68('0x1f'),this[_0x2e68('0x20')][_0x2e68('0x21')](this,_0x3e7d80));this[_0x2e68('0x10')][_0x295b09['id']]['on'](_0x2e68('0x7'),this[_0x2e68('0x22')][_0x2e68('0x21')](this,_0x3e7d80));this[_0x2e68('0x10')][_0x295b09['id']]['on'](_0x2e68('0x23'),this[_0x2e68('0x24')][_0x2e68('0x21')](this,_0x3e7d80));this[_0x2e68('0x10')][_0x295b09['id']]['on'](_0x2e68('0x25'),this['handleImapError'][_0x2e68('0x21')](this,_0x3e7d80));}}else{if(_[_0x2e68('0x18')](this[_0x2e68('0xf')][_0x3e7d80][_0x2e68('0x15')])){this[_0x2e68('0xf')][_0x3e7d80]['Imap']={};}this[_0x2e68('0xf')][_0x3e7d80]['Imap'][_0x2e68('0x14')]=_0x2e68('0x26');this[_0x2e68('0xf')][_0x3e7d80][_0x2e68('0x15')][_0x2e68('0x16')]='';this[_0x2e68('0x1a')](_0x3e7d80);}}}};EmailChannel[_0x2e68('0x12')][_0x2e68('0x20')]=function(_0x2e9090,_0x24334f){if(this[_0x2e68('0xf')][_0x2e9090]){this['mailAccounts'][_0x2e9090]['Imap'][_0x2e68('0x14')]=_0x2e68('0x27');this[_0x2e68('0xf')][_0x2e9090]['Imap'][_0x2e68('0x16')]=_0x24334f[_0x2e68('0x28')];if(_0x24334f[_0x2e68('0x29')]){this['mailAccounts'][_0x2e9090][_0x2e68('0x15')]['total']=_0x24334f[_0x2e68('0x29')][_0x2e68('0x17')];}return this[_0x2e68('0x1a')](_0x2e9090);}};EmailChannel[_0x2e68('0x12')]['handleImapEmail']=function(_0x5904ed,_0x296671){logger['info'](_0x2e68('0x2a'),_0x296671[_0x2e68('0x2b')],_0x296671[_0x2e68('0x2c')],_0x296671[_0x2e68('0x2d')],_0x5904ed);if(this[_0x2e68('0xf')][_0x5904ed]){return mailAccount[_0x2e68('0x2e')](_0x5904ed,_0x296671)[_0x2e68('0x2f')](function(_0x123faa){if(_0x123faa){logger[_0x2e68('0xd')](_0x2e68('0x30'));}})[_0x2e68('0x31')](function(_0x426dda){logger[_0x2e68('0x25')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x2e68('0x19')](_0x426dda));});}};EmailChannel[_0x2e68('0x12')][_0x2e68('0x24')]=function(_0x12412a){if(this[_0x2e68('0xf')][_0x12412a]&&this[_0x2e68('0xf')][_0x12412a]['Imap']){if(this[_0x2e68('0x10')][this[_0x2e68('0xf')][_0x12412a]['Imap']['id']]){delete this[_0x2e68('0x10')][this['mailAccounts'][_0x12412a]['Imap']['id']];}this[_0x2e68('0xf')][_0x12412a][_0x2e68('0x15')][_0x2e68('0x32')]=moment();this[_0x2e68('0x1a')](_0x12412a);}};EmailChannel['prototype'][_0x2e68('0x33')]=function(_0x327ba7,_0x5475d2){if(this['mailAccounts'][_0x327ba7]){this[_0x2e68('0xf')][_0x327ba7][_0x2e68('0x15')][_0x2e68('0x14')]='error';this[_0x2e68('0xf')][_0x327ba7][_0x2e68('0x15')][_0x2e68('0x16')]=_0x5475d2;return this[_0x2e68('0x1a')](_0x327ba7);}};EmailChannel[_0x2e68('0x12')][_0x2e68('0x34')]=function(_0x4bdc2b,_0x5a80d5){return this['smtp'][_0x2e68('0x35')](_0x4bdc2b,_0x5a80d5);};EmailChannel[_0x2e68('0x12')][_0x2e68('0x36')]=function(_0x3b9600){var _0x5daff9=this;if(this[_0x2e68('0xf')][_0x3b9600['id']]){if(_['isNil'](this[_0x2e68('0xf')][_0x3b9600['id']][_0x2e68('0x37')])){this[_0x2e68('0xf')][_0x3b9600['id']][_0x2e68('0x37')]={};}this['mailAccounts'][_0x3b9600['id']][_0x2e68('0x37')][_0x2e68('0x32')]=moment();return new BPromise(function(_0x411702,_0x10b1b5){return _0x5daff9[_0x2e68('0x11')]['verify'](_0x3b9600)[_0x2e68('0x2f')](function(_0x4edc74){_0x5daff9[_0x2e68('0xf')][_0x3b9600['id']]['Smtp']['status']=_0x2e68('0x38');_0x5daff9['mailAccounts'][_0x3b9600['id']][_0x2e68('0x37')][_0x2e68('0x16')]='';_0x5daff9[_0x2e68('0x1a')](_0x3b9600['id']);_0x411702(_0x4edc74);})[_0x2e68('0x31')](function(_0x176d81){_0x5daff9[_0x2e68('0xf')][_0x3b9600['id']][_0x2e68('0x37')][_0x2e68('0x14')]=_0x2e68('0x25');_0x5daff9[_0x2e68('0xf')][_0x3b9600['id']]['Smtp'][_0x2e68('0x16')]=_0x176d81;_0x5daff9[_0x2e68('0x1a')](_0x3b9600['id']);_0x10b1b5(_0x176d81);});});}return this['smtp']['verify'](_0x3b9600);};module[_0x2e68('0x39')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5cf8ada..ccd8458 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 _0x4137=['simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','once','ready','bind','end','handleEnd','error','connect','connTimeout','authTimeout','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','prototype','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','handleReadUnseen','handleError','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser'];(function(_0x17e5e7,_0x3c98db){var _0x2b2c36=function(_0x2ba159){while(--_0x2ba159){_0x17e5e7['push'](_0x17e5e7['shift']());}};_0x2b2c36(++_0x3c98db);}(_0x4137,0xf8));var _0x7413=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4137[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var Imap=require(_0x7413('0x2'));var simpleParser=require(_0x7413('0x3'))[_0x7413('0x4')];var Iconv=require(_0x7413('0x5'))[_0x7413('0x6')];var EventEmitter=require(_0x7413('0x7'))[_0x7413('0x8')];var utils=require(_0x7413('0x9'));var logger=require(_0x7413('0xa'))(_0x7413('0xb'));function EmailImap(_0x4fbade,_0xc808cd){this[_0x7413('0xc')]=_0x7413('0xd');this[_0x7413('0xe')]=this['getAccount'](_0x4fbade,_0xc808cd);this[_0x7413('0x2')]=new Imap(this[_0x7413('0xe')]);this['imap'][_0x7413('0xf')](_0x7413('0x10'),this['handleReady'][_0x7413('0x11')](this));this[_0x7413('0x2')][_0x7413('0xf')](_0x7413('0x12'),this[_0x7413('0x13')]['bind'](this));this[_0x7413('0x2')]['on'](_0x7413('0x14'),this['handleError'][_0x7413('0x11')](this));this[_0x7413('0x2')][_0x7413('0x15')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x2267f6,_0x336c4c){var _0x49f0f6={'connTimeout':_0x2267f6[_0x7413('0x16')]?_0x2267f6[_0x7413('0x16')]*0x3e8:0x2710,'authTimeout':_0x2267f6['authTimeout']?_0x2267f6[_0x7413('0x17')]*0x3e8:0x1388};if(_0x2267f6['service']){_0x49f0f6['user']=_0x2267f6[_0x7413('0x18')];_0x49f0f6['email']=_0x336c4c||_0x2267f6[_0x7413('0x18')]||'anonymous@xcally.com';if(_0x2267f6[_0x7413('0x19')]){_0x49f0f6[_0x7413('0x1a')]=utils[_0x7413('0x1b')](_0x2267f6[_0x7413('0x1c')][_0x7413('0x1d')],_0x2267f6[_0x7413('0x18')]);}else{_0x49f0f6['password']=_0x2267f6[_0x7413('0x1e')];}}else{if(_0x2267f6[_0x7413('0x1f')]){_0x49f0f6[_0x7413('0x18')]=_0x2267f6[_0x7413('0x18')];_0x49f0f6['password']=_0x2267f6[_0x7413('0x1e')];}}_0x49f0f6[_0x7413('0x20')]=_0x2267f6[_0x7413('0x20')];_0x49f0f6[_0x7413('0x21')]=_0x2267f6[_0x7413('0x21')]||0x3e1;if(_0x2267f6[_0x7413('0x22')]){_0x49f0f6[_0x7413('0x22')]=!![];}else{_0x49f0f6[_0x7413('0x22')]=![];_0x49f0f6['autotls']='required';}return _0x49f0f6;};EmailImap[_0x7413('0x23')]['handleReady']=function(){this[_0x7413('0x2')][_0x7413('0x24')](this[_0x7413('0xc')],![],this[_0x7413('0x25')][_0x7413('0x11')](this));};EmailImap[_0x7413('0x23')][_0x7413('0x25')]=function(_0x41cb5d,_0x1d455b){if(_0x41cb5d){this['handleError'](_0x41cb5d,!![]);}else{this['emit'](_0x7413('0x26'),_0x1d455b);this['readUnseen']();}};EmailImap[_0x7413('0x23')][_0x7413('0x27')]=function(_0x463b21){if(_0x463b21){this['handleError'](_0x463b21,!![]);}else{this[_0x7413('0x2')][_0x7413('0x12')]();}};EmailImap[_0x7413('0x23')][_0x7413('0x28')]=function(){this[_0x7413('0x2')][_0x7413('0x29')](['UNSEEN'],this[_0x7413('0x2a')]['bind'](this));};EmailImap[_0x7413('0x23')][_0x7413('0x2a')]=function(_0xae2969,_0x13a836){if(_0xae2969){this[_0x7413('0x2b')](_0xae2969,!![]);}else{if(_0x13a836[_0x7413('0x2c')]){try{var _0x5bb3ea=this[_0x7413('0x2')][_0x7413('0x2d')](_0x13a836,{'bodies':'','markSeen':!![]});_0x5bb3ea['on'](_0x7413('0x2e'),this[_0x7413('0x2f')][_0x7413('0x11')](this));_0x5bb3ea[_0x7413('0xf')](_0x7413('0x14'),this['handleFetchError'][_0x7413('0x11')](this));_0x5bb3ea[_0x7413('0xf')](_0x7413('0x12'),this[_0x7413('0x30')][_0x7413('0x11')](this));}catch(_0x51d676){logger[_0x7413('0x14')](_0x51d676);}}else{this['imap'][_0x7413('0x31')](!![],this[_0x7413('0x27')][_0x7413('0x11')](this));}}};EmailImap['prototype'][_0x7413('0x2f')]=function(_0x487dc8){_0x487dc8['on'](_0x7413('0x32'),this[_0x7413('0x33')]['bind'](this));_0x487dc8['once'](_0x7413('0x34'),this[_0x7413('0x35')][_0x7413('0x11')](this));_0x487dc8['once']('end',this[_0x7413('0x36')]['bind'](this));};EmailImap['prototype'][_0x7413('0x33')]=function(_0x575a79){simpleParser(_0x575a79,{'Iconv':Iconv},this[_0x7413('0x37')][_0x7413('0x11')](this));};EmailImap[_0x7413('0x23')][_0x7413('0x35')]=function(){};EmailImap[_0x7413('0x23')]['handleMessageEnd']=function(){};EmailImap[_0x7413('0x23')][_0x7413('0x37')]=function(_0x44e8b5,_0xfa34ef){if(_0x44e8b5){logger[_0x7413('0x14')](_0x44e8b5);}else{var _0x1168cd=this;utils[_0x7413('0x38')](this[_0x7413('0xe')],_0xfa34ef,function(_0x5993d){_0x1168cd[_0x7413('0x39')](_0x7413('0xb'),_0x5993d);});}};EmailImap[_0x7413('0x23')]['handleFetchEnd']=function(){this[_0x7413('0x2')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x44af7d){this['handleError'](_0x44af7d);this['imap'][_0x7413('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7413('0x23')][_0x7413('0x13')]=function(){this[_0x7413('0x39')](_0x7413('0x12'));};EmailImap[_0x7413('0x23')]['handleError']=function(_0x3f421c,_0x51c48a){logger[_0x7413('0x14')](_0x7413('0x2b'),this[_0x7413('0xe')][_0x7413('0xb')],JSON[_0x7413('0x3a')](_0x3f421c));var _0x125466='';if(_0x3f421c){if(_0x3f421c[_0x7413('0x3b')]){_0x125466=_0x3f421c[_0x7413('0x3b')];}else{for(var _0x35d198 in _0x3f421c){if(_0x3f421c[_0x7413('0x3c')](_0x35d198)){_0x125466+=_[_0x7413('0x3d')](_0x35d198)+':\x20'+_0x3f421c[_0x35d198]+'\x0a';}}}}if(_0x51c48a){this[_0x7413('0x2')][_0x7413('0x12')]();}else{this['emit'](_0x7413('0x14'),_0x125466);this[_0x7413('0x39')](_0x7413('0x12'));}};module[_0x7413('0x3e')]=EmailImap; \ No newline at end of file +var _0xf61e=['UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','bind','end','handleEnd','error','handleError','inherits','connTimeout','authTimeout','service','user','anonymous@xcally.com','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','host','port','tls','required','handleOpenBox','prototype','emit','box','readUnseen','handleCloseBox','search'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf61e,0x191));var _0xef61=function(_0x1880b6,_0x57e117){_0x1880b6=_0x1880b6-0x0;var _0x306e63=_0xf61e[_0x1880b6];return _0x306e63;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var Imap=require(_0xef61('0x2'));var simpleParser=require(_0xef61('0x3'))[_0xef61('0x4')];var Iconv=require(_0xef61('0x5'))[_0xef61('0x6')];var EventEmitter=require(_0xef61('0x7'))[_0xef61('0x8')];var utils=require(_0xef61('0x9'));var logger=require(_0xef61('0xa'))(_0xef61('0xb'));function EmailImap(_0x5b00b2,_0x9e17f4){this[_0xef61('0xc')]='INBOX';this[_0xef61('0xd')]=this[_0xef61('0xe')](_0x5b00b2,_0x9e17f4);this[_0xef61('0x2')]=new Imap(this['account']);this['imap'][_0xef61('0xf')](_0xef61('0x10'),this[_0xef61('0x11')][_0xef61('0x12')](this));this[_0xef61('0x2')][_0xef61('0xf')](_0xef61('0x13'),this[_0xef61('0x14')][_0xef61('0x12')](this));this[_0xef61('0x2')]['on'](_0xef61('0x15'),this[_0xef61('0x16')][_0xef61('0x12')](this));this[_0xef61('0x2')]['connect']();}util[_0xef61('0x17')](EmailImap,EventEmitter);EmailImap['prototype'][_0xef61('0xe')]=function(_0x1db2a9,_0x370ee0){var _0x76ef9b={'connTimeout':_0x1db2a9['connTimeout']?_0x1db2a9[_0xef61('0x18')]*0x3e8:0x2710,'authTimeout':_0x1db2a9[_0xef61('0x19')]?_0x1db2a9[_0xef61('0x19')]*0x3e8:0x1388};if(_0x1db2a9[_0xef61('0x1a')]){_0x76ef9b['user']=_0x1db2a9[_0xef61('0x1b')];_0x76ef9b[_0xef61('0xb')]=_0x370ee0||_0x1db2a9['user']||_0xef61('0x1c');if(_0x1db2a9[_0xef61('0x1d')]){_0x76ef9b[_0xef61('0x1e')]=utils[_0xef61('0x1f')](_0x1db2a9[_0xef61('0x20')][_0xef61('0x21')],_0x1db2a9[_0xef61('0x1b')]);}else{_0x76ef9b['password']=_0x1db2a9[_0xef61('0x22')];}}else{if(_0x1db2a9[_0xef61('0x23')]){_0x76ef9b['user']=_0x1db2a9[_0xef61('0x1b')];_0x76ef9b[_0xef61('0x22')]=_0x1db2a9[_0xef61('0x22')];}}_0x76ef9b[_0xef61('0x24')]=_0x1db2a9[_0xef61('0x24')];_0x76ef9b[_0xef61('0x25')]=_0x1db2a9[_0xef61('0x25')]||0x3e1;if(_0x1db2a9['tls']){_0x76ef9b['tls']=!![];}else{_0x76ef9b[_0xef61('0x26')]=![];_0x76ef9b['autotls']=_0xef61('0x27');}return _0x76ef9b;};EmailImap['prototype']['handleReady']=function(){this[_0xef61('0x2')]['openBox'](this['mailbox'],![],this[_0xef61('0x28')][_0xef61('0x12')](this));};EmailImap[_0xef61('0x29')][_0xef61('0x28')]=function(_0x5e56da,_0x16b144){if(_0x5e56da){this['handleError'](_0x5e56da,!![]);}else{this[_0xef61('0x2a')](_0xef61('0x2b'),_0x16b144);this[_0xef61('0x2c')]();}};EmailImap[_0xef61('0x29')][_0xef61('0x2d')]=function(_0x45ece2){if(_0x45ece2){this[_0xef61('0x16')](_0x45ece2,!![]);}else{this[_0xef61('0x2')][_0xef61('0x13')]();}};EmailImap[_0xef61('0x29')][_0xef61('0x2c')]=function(){this[_0xef61('0x2')][_0xef61('0x2e')]([_0xef61('0x2f')],this[_0xef61('0x30')][_0xef61('0x12')](this));};EmailImap[_0xef61('0x29')][_0xef61('0x30')]=function(_0x587e26,_0x2fe908){if(_0x587e26){this[_0xef61('0x16')](_0x587e26,!![]);}else{if(_0x2fe908[_0xef61('0x31')]){try{var _0x4f35ad=this['imap'][_0xef61('0x32')](_0x2fe908,{'bodies':'','markSeen':!![]});_0x4f35ad['on'](_0xef61('0x33'),this[_0xef61('0x34')]['bind'](this));_0x4f35ad[_0xef61('0xf')](_0xef61('0x15'),this['handleFetchError'][_0xef61('0x12')](this));_0x4f35ad['once']('end',this[_0xef61('0x35')]['bind'](this));}catch(_0x8ed629){logger['error'](_0x8ed629);}}else{this[_0xef61('0x2')][_0xef61('0x36')](!![],this[_0xef61('0x2d')][_0xef61('0x12')](this));}}};EmailImap[_0xef61('0x29')][_0xef61('0x34')]=function(_0xf8cca2){_0xf8cca2['on'](_0xef61('0x37'),this[_0xef61('0x38')][_0xef61('0x12')](this));_0xf8cca2['once'](_0xef61('0x39'),this[_0xef61('0x3a')][_0xef61('0x12')](this));_0xf8cca2[_0xef61('0xf')](_0xef61('0x13'),this['handleMessageEnd'][_0xef61('0x12')](this));};EmailImap[_0xef61('0x29')][_0xef61('0x38')]=function(_0x53bdb9){simpleParser(_0x53bdb9,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap[_0xef61('0x29')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xef61('0x29')][_0xef61('0x3b')]=function(_0x54e37a,_0x508dc7){if(_0x54e37a){logger['error'](_0x54e37a);}else{var _0x4afb2c=this;utils[_0xef61('0x3c')](this[_0xef61('0xd')],_0x508dc7,function(_0x5e1128){_0x4afb2c[_0xef61('0x2a')](_0xef61('0xb'),_0x5e1128);});}};EmailImap[_0xef61('0x29')][_0xef61('0x35')]=function(){this['imap'][_0xef61('0x36')](!![],this[_0xef61('0x2d')][_0xef61('0x12')](this));};EmailImap[_0xef61('0x29')]['handleFetchError']=function(_0x5f1928){this[_0xef61('0x16')](_0x5f1928);this[_0xef61('0x2')][_0xef61('0x36')](!![],this['handleCloseBox'][_0xef61('0x12')](this));};EmailImap[_0xef61('0x29')][_0xef61('0x14')]=function(){this[_0xef61('0x2a')]('end');};EmailImap['prototype']['handleError']=function(_0x30efe9,_0x43b93b){logger[_0xef61('0x15')](_0xef61('0x16'),this[_0xef61('0xd')][_0xef61('0xb')],JSON[_0xef61('0x3d')](_0x30efe9));var _0x50e47f='';if(_0x30efe9){if(_0x30efe9[_0xef61('0x3e')]){_0x50e47f=_0x30efe9[_0xef61('0x3e')];}else{for(var _0x20395d in _0x30efe9){if(_0x30efe9[_0xef61('0x3f')](_0x20395d)){_0x50e47f+=_['upperFirst'](_0x20395d)+':\x20'+_0x30efe9[_0x20395d]+'\x0a';}}}}if(_0x43b93b){this[_0xef61('0x2')][_0xef61('0x13')]();}else{this[_0xef61('0x2a')](_0xef61('0x15'),_0x50e47f);this[_0xef61('0x2a')](_0xef61('0x13'));}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 637053e..408fa2b 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 _0x287e=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0x287e,0x80));var _0xe287=function(_0x3ef106,_0x39b93a){_0x3ef106=_0x3ef106-0x0;var _0x4e8b67=_0x287e[_0x3ef106];return _0x4e8b67;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0xe287('0x0'));function EmailSmtp(){}EmailSmtp[_0xe287('0x1')][_0xe287('0x2')]=function(_0xc1b62a,_0x79420b){return new Promise(function(_0x5d6b23,_0x523635){var _0x1fb693=nodemailer[_0xe287('0x3')](_0xc1b62a);_0x1fb693[_0xe287('0x4')](_0xe287('0x5'),inlineBase64());_0x1fb693[_0xe287('0x6')](_0x79420b,function(_0x513f80,_0x13c1da){if(_0x513f80){_0x523635(_0x513f80[_0xe287('0x7')]());}else{_0x5d6b23(_0x13c1da);}});});};EmailSmtp[_0xe287('0x1')][_0xe287('0x8')]=function(_0x2f498f){return new Promise(function(_0x2a2eef,_0x5a0e92){var _0x5110b0=nodemailer[_0xe287('0x3')](_0x2f498f);_0x5110b0[_0xe287('0x8')](function(_0x529d80,_0x5d38f5){if(_0x529d80){_0x5a0e92(_0x529d80[_0xe287('0x7')]());}else{if(_0x5d38f5){_0x2a2eef(_0x5d38f5);}else{_0x5a0e92(_0xe287('0x9'));}}});});};module[_0xe287('0xa')]=EmailSmtp; \ No newline at end of file +var _0xa165=['prototype','send','createTransport','use','compile','toString','verify','exports','nodemailer'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa165,0x143));var _0x5a16=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xa165[_0x29d94e];return _0x106237;};'use strict';var nodemailer=require(_0x5a16('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x5a16('0x1')][_0x5a16('0x2')]=function(_0x4b4527,_0x171f5c){return new Promise(function(_0x3d195a,_0x238a8b){var _0x942619=nodemailer[_0x5a16('0x3')](_0x4b4527);_0x942619[_0x5a16('0x4')](_0x5a16('0x5'),inlineBase64());_0x942619['sendMail'](_0x171f5c,function(_0x471a30,_0x2ab01c){if(_0x471a30){_0x238a8b(_0x471a30[_0x5a16('0x6')]());}else{_0x3d195a(_0x2ab01c);}});});};EmailSmtp[_0x5a16('0x1')][_0x5a16('0x7')]=function(_0x28b5d2){return new Promise(function(_0x5e02b5,_0x547366){var _0xe9d0f2=nodemailer['createTransport'](_0x28b5d2);_0xe9d0f2[_0x5a16('0x7')](function(_0x3ce566,_0x39852d){if(_0x3ce566){_0x547366(_0x3ce566[_0x5a16('0x6')]());}else{if(_0x39852d){_0x5e02b5(_0x39852d);}else{_0x547366('Not\x20verifired');}}});});};module[_0x5a16('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index a3817ab..abbd14a 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 _0x882c=['X-Auto-Response-Suppress:\x20All','indexOf','isAutoreply','parser','from','subject','messageId','inReplyTo','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','join','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','split','slice','value','pop','length','isEmpty','test','html','replace','includes','','textAsHtml','body','0x1?_0x354e95[_0xc882('0x11')](0x0,-0x1)['join']('\x20'):_0x104a78[_0xc882('0xe')];}return'Anonymous';}function getLastName(_0x1bff8f){var _0x1565dd=_[_0xc882('0x9')](_0x1bff8f[_0xc882('0x12')]);if(_0x1565dd&&_0x1565dd['name']){var _0x4a677c=_0x1565dd[_0xc882('0xe')][_0xc882('0x10')](/\s+/);return _0x4a677c['length']>0x1?_0x4a677c[_0xc882('0x13')]():'';}return'';}function getMails(_0x5e8400,_0x376620){var _0x4c3d2a='';for(var _0x15c773=0x0;_0x15c773<_0x376620[_0xc882('0x12')][_0xc882('0x14')];_0x15c773+=0x1){if(_0x376620[_0xc882('0x12')][_0x15c773]['address']!==_0x5e8400){if(!_[_0xc882('0x15')](_0x4c3d2a)){_0x4c3d2a+=',';}_0x4c3d2a+=_0x376620['value'][_0x15c773][_0xc882('0xe')]||_0x376620[_0xc882('0x12')][_0x15c773][_0xc882('0xa')]||'';_0x4c3d2a+='\x20<';_0x4c3d2a+=_0x376620[_0xc882('0x12')][_0x15c773][_0xc882('0xa')]?_0x376620[_0xc882('0x12')][_0x15c773]['address']:_0xc882('0xb')+random[_0xc882('0xc')](0x6)+'@xcally.com';_0x4c3d2a+='>';}}return _0x4c3d2a;}function parseEmail(_0x3840bf,_0x39183b,_0x15aea1){if(_0x39183b['html']){var _0x2c187e=/)<[^<]*)*<\/script>/gi;while(_0x2c187e[_0xc882('0x16')](_0x39183b[_0xc882('0x17')])){_0x39183b[_0xc882('0x17')]=_0x39183b[_0xc882('0x17')][_0xc882('0x18')](_0x2c187e,'');}if(_0x39183b['html'][_0xc882('0x19')](_0xc882('0x1a'))){var _0x5a5f3a=[];_0x39183b[_0xc882('0x1b')][_0xc882('0x1c')](_0x5ab8c1=>{_0x5a5f3a[_0xc882('0x1d')](_0x5ab8c1[_0xc882('0x1e')]);});var _0xdbcf08=/]+>/g;var _0x11a034=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1dcf7f=_0x39183b[_0xc882('0x17')][_0xc882('0x18')](_0x11a034,_0xc882('0x1f'));var _0x39ffe3=_0x1dcf7f[_0xc882('0x18')](_0xdbcf08,'_IMG');for(let _0x2fcd87=0x0;_0x2fcd87<_0x5a5f3a[_0xc882('0x14')];_0x2fcd87++){var _0x2f55ff=_0x39ffe3[_0xc882('0x18')]('_IMG','\x20[Attachment:\x20'+_0x5a5f3a[_0x2fcd87]+_0xc882('0x20'));_0x39ffe3=_0x2f55ff;}_0x39183b[_0xc882('0x17')]=_0x39ffe3;}_0x15aea1['body']=_0x39183b[_0xc882('0x17')];}else{_0x15aea1['body']=_0x39183b[_0xc882('0x21')];}if(_0x15aea1[_0xc882('0x22')]){_0x15aea1[_0xc882('0x22')]=_0x15aea1[_0xc882('0x22')][_0xc882('0x18')](/0x0){var _0x4c9347=[_0xc882('0x32'),_0xc882('0x33'),'Precedence:\x20auto_reply'];for(var _0x13d432=0x0;_0x13d432<_0x39183b['headerLines'][_0xc882('0x14')];_0x13d432++){var _0x87ce80=_[_0xc882('0x34')](_0x4c9347,_0x39183b['headerLines'][_0x13d432]['line']);if(_0x87ce80>=0x0){_0x15aea1[_0xc882('0x35')]=!![];}}}return _0x15aea1;}exports[_0xc882('0x36')]=function(_0x58a047,_0x56b0c1,_0x429222){var _0x12cbb4={'from':getAddress(_0x56b0c1[_0xc882('0x37')]),'firstName':getFirstName(_0x56b0c1[_0xc882('0x37')]),'lastName':getLastName(_0x56b0c1[_0xc882('0x37')]),'mapKey':_0xc882('0x7'),'message':{'from':getMails(_0x58a047[_0xc882('0x7')],_0x56b0c1['from']),'to':_0x58a047['email'],'cc':'','subject':_0x56b0c1[_0xc882('0x38')]||'','messageId':_0x56b0c1[_0xc882('0x39')],'inReplyTo':_0x56b0c1[_0xc882('0x3a')],'sentAt':moment(_0x56b0c1['date'])[_0xc882('0x3b')](_0xc882('0x3c')),'attach':![],'attachments':[]}};if(!_0x56b0c1[_0xc882('0x17')]&&!_0x56b0c1[_0xc882('0x21')]){var _0x45d4f1=_[_0xc882('0x3d')](_0x56b0c1[_0xc882('0x1b')],{'contentType':'application/ms-tnef'});if(_0x45d4f1[_0xc882('0x14')]){logger[_0xc882('0x3e')](util[_0xc882('0x3b')](_0xc882('0x3f'),_0x56b0c1[_0xc882('0x39')]));tnef['parseBuffer'](_[_0xc882('0x40')](_0x45d4f1)['content'],function(_0x226948,_0x58337f){if(_0x58337f){_0x56b0c1[_0xc882('0x17')]=_0x58337f[_0xc882('0x41')]||_0xc882('0x42');if(_0x58337f[_0xc882('0x43')]){for(var _0x3bed00=0x0;_0x3bed00<_0x58337f['Attachments'][_0xc882('0x14')];_0x3bed00++){var _0x560e55=_0x58337f[_0xc882('0x43')][_0x3bed00];_0x12cbb4['message']['attachments'][_0xc882('0x1d')]({'filename':_0x560e55[_0xc882('0x44')],'content':Buffer[_0xc882('0x37')](_0x560e55['Data'])});}}}_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));});}else{_0x56b0c1[_0xc882('0x17')]=_0xc882('0x42');_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));}}else{_0x429222(parseEmail(_0x58a047,_0x56b0c1,_0x12cbb4));}};exports[_0xc882('0x45')]=function(_0x5f5428,_0x255a32){var _0x1bbf4d=[_0xc882('0x46')+(_0x255a32||''),_0xc882('0x47')+_0x5f5428,'',''];return Buffer[_0xc882('0x37')](_0x1bbf4d[_0xc882('0x48')](''),_0xc882('0x49'))[_0xc882('0x4a')](_0xc882('0x4b'));}; \ No newline at end of file +var _0x2b9e=['user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','join','length','isEmpty','html','attachments','forEach','push','filename','replace','_IMG','\x20]','body','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token'];(function(_0x5a4ac1,_0x58649b){var _0x5ddfda=function(_0x7dbbac){while(--_0x7dbbac){_0x5a4ac1['push'](_0x5a4ac1['shift']());}};_0x5ddfda(++_0x58649b);}(_0x2b9e,0x11d));var _0xe2b9=function(_0x126f94,_0x44a78e){_0x126f94=_0x126f94-0x0;var _0x2de2c4=_0x2b9e[_0x126f94];return _0x2de2c4;};'use strict';var _=require(_0xe2b9('0x0'));var moment=require(_0xe2b9('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0xe2b9('0x2'));var util=require('util');var tnef=require(_0xe2b9('0x3'));var logger=require(_0xe2b9('0x4'))(_0xe2b9('0x5'));var config=require(_0xe2b9('0x6'));function getAddress(_0x1b989b){var _0x2d9bbd=_['head'](_0x1b989b[_0xe2b9('0x7')]);return _0x2d9bbd&&_0x2d9bbd[_0xe2b9('0x8')]?_0x2d9bbd[_0xe2b9('0x8')]:_0xe2b9('0x9')+random[_0xe2b9('0xa')](0x6)+_0xe2b9('0xb');}function getFirstName(_0x202f6b){var _0x2397ac=_[_0xe2b9('0xc')](_0x202f6b[_0xe2b9('0x7')]);if(_0x2397ac&&_0x2397ac[_0xe2b9('0xd')]){if(_0x2397ac[_0xe2b9('0xd')]==_0x2397ac['address']){return _0x2397ac[_0xe2b9('0xd')][_0xe2b9('0xe')](0x0,_0x2397ac['name'][_0xe2b9('0xf')]('@'));}var _0x175607=_0x2397ac[_0xe2b9('0xd')]['split'](/\s+/);return _0x175607['length']>0x1?_0x175607['slice'](0x0,-0x1)[_0xe2b9('0x10')]('\x20'):_0x2397ac[_0xe2b9('0xd')];}return'Anonymous';}function getLastName(_0x5723a1){var _0x4655f2=_[_0xe2b9('0xc')](_0x5723a1['value']);if(_0x4655f2&&_0x4655f2[_0xe2b9('0xd')]){var _0x45d001=_0x4655f2['name']['split'](/\s+/);return _0x45d001[_0xe2b9('0x11')]>0x1?_0x45d001['pop']():'';}return'';}function getMails(_0x5be3b3,_0x79bc5f){var _0x5e098c='';for(var _0x582eef=0x0;_0x582eef<_0x79bc5f[_0xe2b9('0x7')][_0xe2b9('0x11')];_0x582eef+=0x1){if(_0x79bc5f[_0xe2b9('0x7')][_0x582eef][_0xe2b9('0x8')]!==_0x5be3b3){if(!_[_0xe2b9('0x12')](_0x5e098c)){_0x5e098c+=',';}_0x5e098c+=_0x79bc5f[_0xe2b9('0x7')][_0x582eef][_0xe2b9('0xd')]||_0x79bc5f[_0xe2b9('0x7')][_0x582eef][_0xe2b9('0x8')]||'';_0x5e098c+='\x20<';_0x5e098c+=_0x79bc5f[_0xe2b9('0x7')][_0x582eef][_0xe2b9('0x8')]?_0x79bc5f[_0xe2b9('0x7')][_0x582eef]['address']:_0xe2b9('0x9')+random['generate'](0x6)+_0xe2b9('0xb');_0x5e098c+='>';}}return _0x5e098c;}function parseEmail(_0x158ccc,_0x2d9c9f,_0x57b53d){if(_0x2d9c9f[_0xe2b9('0x13')]){var _0x26f76d=/)<[^<]*)*<\/script>/gi;while(_0x26f76d['test'](_0x2d9c9f[_0xe2b9('0x13')])){_0x2d9c9f[_0xe2b9('0x13')]=_0x2d9c9f[_0xe2b9('0x13')]['replace'](_0x26f76d,'');}if(_0x2d9c9f[_0xe2b9('0x13')]['includes']('{_0x5b9a51[_0xe2b9('0x16')](_0x40affd[_0xe2b9('0x17')]);});var _0x1ec7ea=/]+>/g;var _0x563253=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x50ff81=_0x2d9c9f[_0xe2b9('0x13')][_0xe2b9('0x18')](_0x563253,'_SRC');var _0x559ad4=_0x50ff81['replace'](_0x1ec7ea,_0xe2b9('0x19'));for(let _0x326710=0x0;_0x326710<_0x5b9a51[_0xe2b9('0x11')];_0x326710++){var _0x1e6a0d=_0x559ad4[_0xe2b9('0x18')]('_IMG','\x20[Attachment:\x20'+_0x5b9a51[_0x326710]+_0xe2b9('0x1a'));_0x559ad4=_0x1e6a0d;}_0x2d9c9f[_0xe2b9('0x13')]=_0x559ad4;}_0x57b53d['body']=_0x2d9c9f[_0xe2b9('0x13')];}else{_0x57b53d[_0xe2b9('0x1b')]=_0x2d9c9f['textAsHtml'];}if(_0x57b53d[_0xe2b9('0x1b')]){_0x57b53d[_0xe2b9('0x1b')]=_0x57b53d[_0xe2b9('0x1b')][_0xe2b9('0x18')](/0x0){var _0x17b12b=[_0xe2b9('0x2a'),'X-Auto-Response-Suppress:\x20All',_0xe2b9('0x2b')];for(var _0x145c5=0x0;_0x145c5<_0x2d9c9f[_0xe2b9('0x2c')][_0xe2b9('0x11')];_0x145c5++){var _0x10a4eb=_[_0xe2b9('0xf')](_0x17b12b,_0x2d9c9f['headerLines'][_0x145c5][_0xe2b9('0x2d')]);if(_0x10a4eb>=0x0){_0x57b53d[_0xe2b9('0x2e')]=!![];}}}return _0x57b53d;}exports[_0xe2b9('0x2f')]=function(_0x10d2d,_0x2b1368,_0x2a001a){var _0x5175c5={'from':getAddress(_0x2b1368['from']),'firstName':getFirstName(_0x2b1368['from']),'lastName':getLastName(_0x2b1368[_0xe2b9('0x30')]),'mapKey':_0xe2b9('0x5'),'message':{'from':getMails(_0x10d2d[_0xe2b9('0x5')],_0x2b1368[_0xe2b9('0x30')]),'to':_0x10d2d[_0xe2b9('0x5')],'cc':'','subject':_0x2b1368[_0xe2b9('0x31')]||'','messageId':_0x2b1368[_0xe2b9('0x32')],'inReplyTo':_0x2b1368['inReplyTo'],'sentAt':moment(_0x2b1368['date'])[_0xe2b9('0x24')](_0xe2b9('0x33')),'attach':![],'attachments':[]}};if(!_0x2b1368['html']&&!_0x2b1368[_0xe2b9('0x34')]){var _0x300c1d=_[_0xe2b9('0x35')](_0x2b1368[_0xe2b9('0x14')],{'contentType':_0xe2b9('0x36')});if(_0x300c1d[_0xe2b9('0x11')]){logger[_0xe2b9('0x37')](util['format'](_0xe2b9('0x38'),_0x2b1368[_0xe2b9('0x32')]));tnef[_0xe2b9('0x39')](_[_0xe2b9('0x3a')](_0x300c1d)[_0xe2b9('0x28')],function(_0x2eacfd,_0x4efb85){if(_0x4efb85){_0x2b1368[_0xe2b9('0x13')]=_0x4efb85[_0xe2b9('0x3b')]||_0xe2b9('0x3c');if(_0x4efb85[_0xe2b9('0x3d')]){for(var _0x510859=0x0;_0x510859<_0x4efb85['Attachments']['length'];_0x510859++){var _0x291f15=_0x4efb85[_0xe2b9('0x3d')][_0x510859];_0x5175c5[_0xe2b9('0x1d')][_0xe2b9('0x14')][_0xe2b9('0x16')]({'filename':_0x291f15[_0xe2b9('0x3e')],'content':Buffer[_0xe2b9('0x30')](_0x291f15[_0xe2b9('0x3f')])});}}}_0x2a001a(parseEmail(_0x10d2d,_0x2b1368,_0x5175c5));});}else{_0x2b1368[_0xe2b9('0x13')]=_0xe2b9('0x3c');_0x2a001a(parseEmail(_0x10d2d,_0x2b1368,_0x5175c5));}}else{_0x2a001a(parseEmail(_0x10d2d,_0x2b1368,_0x5175c5));}};exports[_0xe2b9('0x40')]=function(_0x1b5710,_0xbda8f4){var _0x204fcc=[_0xe2b9('0x41')+(_0xbda8f4||''),_0xe2b9('0x42')+_0x1b5710,'',''];return Buffer[_0xe2b9('0x30')](_0x204fcc[_0xe2b9('0x10')](''),_0xe2b9('0x43'))[_0xe2b9('0x44')](_0xe2b9('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0f0e516..8c52324 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 _0x0ba2=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0xb746a4,_0x355bdc){var _0x4b6a58=function(_0x3ebf70){while(--_0x3ebf70){_0xb746a4['push'](_0xb746a4['shift']());}};_0x4b6a58(++_0x355bdc);}(_0x0ba2,0xb6));var _0x20ba=function(_0x1d0893,_0x45e9e6){_0x1d0893=_0x1d0893-0x0;var _0x55e423=_0x0ba2[_0x1d0893];return _0x55e423;};'use strict';var _=require(_0x20ba('0x0'));function MailAccount(_0x166e8f){this['id']=_0x166e8f['id']||0x0;this[_0x20ba('0x1')]=_0x166e8f[_0x20ba('0x1')]||_0x20ba('0x2');this[_0x20ba('0x3')]=_0x166e8f['key']||_0x20ba('0x4');this[_0x20ba('0x5')]=_0x166e8f['active']||![];this['Imap']=_0x166e8f[_0x20ba('0x6')]||[];this[_0x20ba('0x7')]=_0x166e8f[_0x20ba('0x7')]||[];}module[_0x20ba('0x8')]=MailAccount; \ No newline at end of file +var _0x575e=['Imap','Smtp','exports','lodash','name','key','active'];(function(_0x3b96cf,_0x1592f2){var _0x2e315a=function(_0x21fa50){while(--_0x21fa50){_0x3b96cf['push'](_0x3b96cf['shift']());}};_0x2e315a(++_0x1592f2);}(_0x575e,0x1bc));var _0xe575=function(_0x1eb252,_0x1b9c4f){_0x1eb252=_0x1eb252-0x0;var _0x7d46a=_0x575e[_0x1eb252];return _0x7d46a;};'use strict';var _=require(_0xe575('0x0'));function MailAccount(_0x5e230b){this['id']=_0x5e230b['id']||0x0;this[_0xe575('0x1')]=_0x5e230b[_0xe575('0x1')]||'Service';this[_0xe575('0x2')]=_0x5e230b['key']||'SERV';this[_0xe575('0x3')]=_0x5e230b[_0xe575('0x3')]||![];this[_0xe575('0x4')]=_0x5e230b[_0xe575('0x4')]||[];this[_0xe575('0x5')]=_0x5e230b[_0xe575('0x5')]||[];}module[_0xe575('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 34f9946..b766cef 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 _0x0939=['mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined','merge','exports','lodash','mapKeys','hasOwnProperty','prototype'];(function(_0x295314,_0x17b250){var _0x584b0c=function(_0x51cc84){while(--_0x51cc84){_0x295314['push'](_0x295314['shift']());}};_0x584b0c(++_0x17b250);}(_0x0939,0x17d));var _0x9093=function(_0x2c4a3f,_0x488ec7){_0x2c4a3f=_0x2c4a3f-0x0;var _0x1696aa=_0x0939[_0x2c4a3f];return _0x1696aa;};'use strict';var _=require(_0x9093('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1919f9,_0x396228,_0x548652){var _0x5cb70e=_[_0x9093('0x1')](_0x1919f9,function(_0x35c1c0,_0x1b7410){return _0x35c1c0[_0x548652];});for(var _0x346a75 in _0x396228){if(_0x396228[_0x9093('0x2')](_0x346a75)){if(!_0x5cb70e[_0x346a75]){delete _0x396228[_0x346a75];}}}}Realtime[_0x9093('0x3')][_0x9093('0x4')]=function(_0x21f45f,_0x5d02e0){for(var _0xf7d5d2 in _0x5d02e0){if(_0x21f45f[_0x9093('0x2')](_0xf7d5d2)){_0x21f45f[_0xf7d5d2]=_0x5d02e0[_0xf7d5d2];}}};Realtime[_0x9093('0x3')][_0x9093('0x5')]=function(){var _0x335915=this;return function(_0x490e5c){if(_0x490e5c){freeIsNotKey(_0x490e5c,_0x335915[_0x9093('0x6')],'id');for(var _0x2ddd2e=0x0,_0x3a5649={},_0x2ef049={};_0x2ddd2e<_0x490e5c[_0x9093('0x7')];_0x2ddd2e+=0x1){_0x3a5649=_0x490e5c[_0x2ddd2e];if(_[_0x9093('0x8')](_0x335915['mailAccounts'][_0x3a5649['id']])){_0x335915[_0x9093('0x6')][_0x3a5649['id']]=new MailAccount(_0x3a5649);}else{_[_0x9093('0x9')](_0x335915[_0x9093('0x6')][_0x3a5649['id']],_0x3a5649);}}}return _0x335915['mailAccounts'];};};module[_0x9093('0xa')]=Realtime; \ No newline at end of file +var _0x8299=['mapKeys','hasOwnProperty','prototype','initMailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x90bb22,_0x292edb){var _0x2b5d2c=function(_0x3d92ed){while(--_0x3d92ed){_0x90bb22['push'](_0x90bb22['shift']());}};_0x2b5d2c(++_0x292edb);}(_0x8299,0x7f));var _0x9829=function(_0x2ddfc9,_0x5a51af){_0x2ddfc9=_0x2ddfc9-0x0;var _0x15069f=_0x8299[_0x2ddfc9];return _0x15069f;};'use strict';var _=require(_0x9829('0x0'));var MailAccount=require(_0x9829('0x1'));var Realtime=function(){this[_0x9829('0x2')]={};};function freeIsNotKey(_0x253a42,_0x2cf889,_0x310dc0){var _0x433c6a=_[_0x9829('0x3')](_0x253a42,function(_0x38fc32,_0x3ea272){return _0x38fc32[_0x310dc0];});for(var _0x2bdbac in _0x2cf889){if(_0x2cf889[_0x9829('0x4')](_0x2bdbac)){if(!_0x433c6a[_0x2bdbac]){delete _0x2cf889[_0x2bdbac];}}}}Realtime[_0x9829('0x5')]['mergeFromDatabase']=function(_0x3d4c64,_0x496476){for(var _0x6aa598 in _0x496476){if(_0x3d4c64[_0x9829('0x4')](_0x6aa598)){_0x3d4c64[_0x6aa598]=_0x496476[_0x6aa598];}}};Realtime['prototype'][_0x9829('0x6')]=function(){var _0x20b02c=this;return function(_0x2f239e){if(_0x2f239e){freeIsNotKey(_0x2f239e,_0x20b02c['mailAccounts'],'id');for(var _0x109ed9=0x0,_0x4e9199={},_0x4f0494={};_0x109ed9<_0x2f239e['length'];_0x109ed9+=0x1){_0x4e9199=_0x2f239e[_0x109ed9];if(_[_0x9829('0x7')](_0x20b02c[_0x9829('0x2')][_0x4e9199['id']])){_0x20b02c[_0x9829('0x2')][_0x4e9199['id']]=new MailAccount(_0x4e9199);}else{_[_0x9829('0x8')](_0x20b02c[_0x9829('0x2')][_0x4e9199['id']],_0x4e9199);}}}return _0x20b02c[_0x9829('0x2')];};};module[_0x9829('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index d809baa..aaf07b0 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 _0xb7f0=['name','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider'];(function(_0x2d5e03,_0x24aeb3){var _0x3d11ca=function(_0xad926e){while(--_0xad926e){_0x2d5e03['push'](_0x2d5e03['shift']());}};_0x3d11ca(++_0x24aeb3);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x43b616,_0xb842c){_0x43b616=_0x43b616-0x0;var _0xc188db=_0xb7f0[_0x43b616];return _0xc188db;};'use strict';var client=require(_0x0b7f('0x0'));exports[_0x0b7f('0x1')]=function(){return function(){return client[_0x0b7f('0x2')](_0x0b7f('0x3'),{'options':{'attributes':['id','name','provider',_0x0b7f('0x4'),_0x0b7f('0x5'),_0x0b7f('0x6'),_0x0b7f('0x7'),_0x0b7f('0x8'),_0x0b7f('0x9')],'raw':![],'include':[{'model':_0x0b7f('0xa'),'as':_0x0b7f('0xb'),'include':[{'model':_0x0b7f('0xc'),'attributes':['id',_0x0b7f('0xd'),'service',_0x0b7f('0xe'),_0x0b7f('0xf')],'as':'CloudProvider'}]},{'model':_0x0b7f('0x10'),'as':_0x0b7f('0x11'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0x0b7f('0xe'),_0x0b7f('0xf')],'as':_0x0b7f('0xc')}]}]},'log':_0x0b7f('0x12')});};};exports[_0x0b7f('0x13')]=function(_0xc7fa85,_0x23a0b4){return client[_0x0b7f('0x2')](_0x0b7f('0x14'),{'account':{'id':_0xc7fa85},'body':_0x23a0b4,'log':_0x0b7f('0x14')});}; \ No newline at end of file +var _0x4ccb=['TemplateId','MailServerIn','Imap','service','type','CloudProvider','MailServerOut','Smtp','data5','getMailAccount','../client','getMailAccounts','Request','name','provider','email','active','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4ccb,0x196));var _0xb4cc=function(_0x165ef3,_0x3a8891){_0x165ef3=_0x165ef3-0x0;var _0xaf3efb=_0x4ccb[_0x165ef3];return _0xaf3efb;};'use strict';var client=require(_0xb4cc('0x0'));exports[_0xb4cc('0x1')]=function(){return function(){return client[_0xb4cc('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0xb4cc('0x3'),_0xb4cc('0x4'),'service',_0xb4cc('0x5'),_0xb4cc('0x6'),_0xb4cc('0x7'),'ListId',_0xb4cc('0x8')],'raw':![],'include':[{'model':_0xb4cc('0x9'),'as':_0xb4cc('0xa'),'include':[{'model':'CloudProvider','attributes':['id',_0xb4cc('0x3'),_0xb4cc('0xb'),_0xb4cc('0xc'),'data5'],'as':_0xb4cc('0xd')}]},{'model':_0xb4cc('0xe'),'as':_0xb4cc('0xf'),'include':[{'model':_0xb4cc('0xd'),'attributes':['id',_0xb4cc('0x3'),'service',_0xb4cc('0xc'),_0xb4cc('0x10')],'as':'CloudProvider'}]}]},'log':_0xb4cc('0x11')});};};exports['notify']=function(_0x1d7063,_0x1e5a83){return client[_0xb4cc('0x2')]('NotifyMailAccount',{'account':{'id':_0x1d7063},'body':_0x1e5a83,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index c45319e..822a115 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 _0xf4fb=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x10f82c,_0x4f46a8){var _0x5abc62=function(_0x18d82a){while(--_0x18d82a){_0x10f82c['push'](_0x10f82c['shift']());}};_0x5abc62(++_0x4f46a8);}(_0xf4fb,0x1f4));var _0xbf4f=function(_0x4d6004,_0x226e17){_0x4d6004=_0x4d6004-0x0;var _0x16b869=_0xf4fb[_0x4d6004];return _0x16b869;};'use strict';var client=require(_0xbf4f('0x0'));exports[_0xbf4f('0x1')]=function(){return client[_0xbf4f('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf4f('0x3')]},'log':_0xbf4f('0x4')});}; \ No newline at end of file +var _0x4a34=['getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x52eacc,_0x2c418e){var _0x5279fb=function(_0x6d9a0){while(--_0x6d9a0){_0x52eacc['push'](_0x52eacc['shift']());}};_0x5279fb(++_0x2c418e);}(_0x4a34,0x130));var _0x44a3=function(_0x2c870c,_0x5df44b){_0x2c870c=_0x2c870c-0x0;var _0x4d3916=_0x4a34[_0x2c870c];return _0x4d3916;};'use strict';var client=require('../client');exports[_0x44a3('0x0')]=function(){return client['Request'](_0x44a3('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x44a3('0x2')]},'log':_0x44a3('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index f73861e..5dea38e 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 3f153a9..46975c1 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 _0x9e04=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','http','express','ioredis','createServer','timeout','listen','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log'];(function(_0xadfd35,_0x2c7539){var _0x325805=function(_0x5ecdfa){while(--_0x5ecdfa){_0xadfd35['push'](_0xadfd35['shift']());}};_0x325805(++_0x2c7539);}(_0x9e04,0x10b));var _0x49e0=function(_0x277e87,_0x2e2de8){_0x277e87=_0x277e87-0x0;var _0x13d780=_0x9e04[_0x277e87];return _0x13d780;};'use strict';var _=require('lodash');var http=require(_0x49e0('0x0'));var express=require(_0x49e0('0x1'));var sticky=require('sticky-session');var Redis=require(_0x49e0('0x2'));var config=require('../../config/environment');var app=express();var server=http[_0x49e0('0x3')](app);server[_0x49e0('0x4')]=0xdbba0;if(sticky[_0x49e0('0x5')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0x49e0('0x6'),_0x49e0('0x7')]});config[_0x49e0('0x8')]=_[_0x49e0('0x9')](config[_0x49e0('0x8')],{'host':_0x49e0('0xa'),'port':0x18eb});socketio[_0x49e0('0xb')](require(_0x49e0('0xc'))({'pubClient':new Redis(config[_0x49e0('0x8')]),'subClient':new Redis(config[_0x49e0('0x8')])}));require(_0x49e0('0xd'))[_0x49e0('0xe')]();require(_0x49e0('0xf'))[_0x49e0('0xe')](socketio);require(_0x49e0('0x10'))[_0x49e0('0xe')](app);require(_0x49e0('0x11'))[_0x49e0('0xe')](app);}else{server[_0x49e0('0x12')](_0x49e0('0x13'),function(){console[_0x49e0('0x14')](_0x49e0('0x15'),config[_0x49e0('0x16')]);});}exports=module[_0x49e0('0x17')]=app; \ No newline at end of file +var _0x1c58=['createServer','timeout','port','websocket','polling','redis','localhost','adapter','socket.io-redis','default','../../config/socketio','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','ioredis','../../config/environment'];(function(_0x2724ab,_0x4890a8){var _0x3e05d8=function(_0x13555d){while(--_0x13555d){_0x2724ab['push'](_0x2724ab['shift']());}};_0x3e05d8(++_0x4890a8);}(_0x1c58,0x13e));var _0x81c5=function(_0x3ea730,_0x3e8634){_0x3ea730=_0x3ea730-0x0;var _0x55df24=_0x1c58[_0x3ea730];return _0x55df24;};'use strict';var _=require(_0x81c5('0x0'));var http=require(_0x81c5('0x1'));var express=require(_0x81c5('0x2'));var sticky=require('sticky-session');var Redis=require(_0x81c5('0x3'));var config=require(_0x81c5('0x4'));var app=express();var server=http[_0x81c5('0x5')](app);server[_0x81c5('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x81c5('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x81c5('0x8'),_0x81c5('0x9')]});config[_0x81c5('0xa')]=_['defaults'](config['redis'],{'host':_0x81c5('0xb'),'port':0x18eb});socketio[_0x81c5('0xc')](require(_0x81c5('0xd'))({'pubClient':new Redis(config[_0x81c5('0xa')]),'subClient':new Redis(config[_0x81c5('0xa')])}));require('../../config/triggers')[_0x81c5('0xe')]();require(_0x81c5('0xf'))[_0x81c5('0xe')](socketio);require('../../config/express')[_0x81c5('0xe')](app);require('../../routes')[_0x81c5('0xe')](app);}else{server[_0x81c5('0x10')](_0x81c5('0x11'),function(){console['log'](_0x81c5('0x12'),config[_0x81c5('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 2a9e2da..cc2cdfa 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 _0xdb48=['bluebird','../../config/logger','routing','client','http','Request','request','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xdb48,0xfe));var _0x8db4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xdb48[_0x550d12];return _0x12103d;};'use strict';var jayson=require(_0x8db4('0x0'));var BPromise=require(_0x8db4('0x1'));var logger=require(_0x8db4('0x2'))(_0x8db4('0x3'));var client=jayson[_0x8db4('0x4')][_0x8db4('0x5')]({'port':0x2329});client[_0x8db4('0x6')]=function(_0x1317ff,_0x2972c9){return new BPromise(function(_0x5e350b,_0x4d94ab){return client[_0x8db4('0x7')](_0x1317ff,_0x2972c9)['then'](function(_0x11b9bf){logger[_0x8db4('0x8')](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x2972c9,_0x11b9bf);if(_0x11b9bf[_0x8db4('0xa')]){logger['error'](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x11b9bf['error'][_0x8db4('0xb')],_0x2972c9);return _0x4d94ab(_0x11b9bf[_0x8db4('0xa')][_0x8db4('0xb')]);}else{return _0x5e350b(_0x11b9bf[_0x8db4('0xc')]);}})[_0x8db4('0xd')](function(_0x1f76fa){logger[_0x8db4('0xa')](_0x8db4('0x9'),_0x8db4('0x3'),_0x1317ff,_0x1f76fa,_0x2972c9);return _0x4d94ab(_0x1f76fa);});});};module[_0x8db4('0xe')]=client; \ No newline at end of file +var _0xb1a3=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise','../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb1a3,0x76));var _0x3b1a=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0xb1a3[_0x4bc65f];return _0x44f85f;};'use strict';var jayson=require(_0x3b1a('0x0'));var BPromise=require('bluebird');var logger=require(_0x3b1a('0x1'))(_0x3b1a('0x2'));var client=jayson[_0x3b1a('0x3')][_0x3b1a('0x4')]({'port':0x2329});client[_0x3b1a('0x5')]=function(_0xfc0ff5,_0x314425){return new BPromise(function(_0x3ac90c,_0x43fab1){return client[_0x3b1a('0x6')](_0xfc0ff5,_0x314425)[_0x3b1a('0x7')](function(_0x41897d){logger[_0x3b1a('0x8')](_0x3b1a('0x9'),_0x3b1a('0x2'),_0xfc0ff5,_0x314425,_0x41897d);if(_0x41897d[_0x3b1a('0xa')]){logger[_0x3b1a('0xa')]('rpc',_0x3b1a('0x2'),_0xfc0ff5,_0x41897d[_0x3b1a('0xa')][_0x3b1a('0xb')],_0x314425);return _0x43fab1(_0x41897d[_0x3b1a('0xa')][_0x3b1a('0xb')]);}else{return _0x3ac90c(_0x41897d[_0x3b1a('0xc')]);}})[_0x3b1a('0xd')](function(_0x1ab55c){logger[_0x3b1a('0xa')](_0x3b1a('0x9'),_0x3b1a('0x2'),_0xfc0ff5,_0x1ab55c,_0x314425);return _0x43fab1(_0x1ab55c);});});};module[_0x3b1a('0xe')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 21e7f67..3c8f7ba 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 _0xd887=['initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd887,0x14a));var _0x7d88=function(_0x206096,_0x1c6cfd){_0x206096=_0x206096-0x0;var _0x3f3b50=_0xd887[_0x206096];return _0x3f3b50;};'use strict';var BPromise=require(_0x7d88('0x0'));var server=require(_0x7d88('0x1'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0x7d88('0x2'));var openchannelQueue=require(_0x7d88('0x3'));var chatQueue=require(_0x7d88('0x4'));var smsQueue=require(_0x7d88('0x5'));var mailQueue=require(_0x7d88('0x6'));var faxQueue=require(_0x7d88('0x7'));var whatsappQueue=require(_0x7d88('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7d88('0x9')]()[_0x7d88('0xa')](user[_0x7d88('0xb')]())[_0x7d88('0xa')](realtime[_0x7d88('0xc')]())[_0x7d88('0xa')](interval['getIntervals']())[_0x7d88('0xa')](realtime[_0x7d88('0xd')]())[_0x7d88('0xa')](openchannelQueue[_0x7d88('0xe')]())[_0x7d88('0xa')](realtime[_0x7d88('0xf')]())['then'](chatQueue[_0x7d88('0x10')]())['then'](realtime[_0x7d88('0x11')]())[_0x7d88('0xa')](smsQueue['getSmsQueues']())['then'](realtime[_0x7d88('0x12')]())[_0x7d88('0xa')](mailQueue[_0x7d88('0x13')]())[_0x7d88('0xa')](realtime[_0x7d88('0x14')]())[_0x7d88('0xa')](faxQueue['getFaxQueues']())[_0x7d88('0xa')](realtime[_0x7d88('0x15')]())[_0x7d88('0xa')](whatsappQueue[_0x7d88('0x16')]())[_0x7d88('0xa')](realtime[_0x7d88('0x17')]())[_0x7d88('0xa')](function(){return realtime;});}function main(){return server[_0x7d88('0x18')](realtime)[_0x7d88('0xa')](function(_0x79dd91){return initRealtime();})['then'](function(_0xd5bda7){return setInterval(initRealtime,0x1388);})[_0x7d88('0x19')](function(_0x116b3b){console[_0x7d88('0x1a')](_0x116b3b);});}main(); \ No newline at end of file +var _0xf5dd=['catch','log','bluebird','./realtime','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen'];(function(_0x306b0c,_0x2eb924){var _0x44ce08=function(_0x4e0262){while(--_0x4e0262){_0x306b0c['push'](_0x306b0c['shift']());}};_0x44ce08(++_0x2eb924);}(_0xf5dd,0xe9));var _0xdf5d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf5dd[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0xdf5d('0x0'));var server=require('./server');var Realtime=require(_0xdf5d('0x1'));var user=require('./rpc/user');var interval=require(_0xdf5d('0x2'));var openchannelQueue=require(_0xdf5d('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xdf5d('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xdf5d('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xdf5d('0x6')]()[_0xdf5d('0x7')](user[_0xdf5d('0x8')]())[_0xdf5d('0x7')](realtime[_0xdf5d('0x9')]())['then'](interval['getIntervals']())['then'](realtime[_0xdf5d('0xa')]())[_0xdf5d('0x7')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xdf5d('0xb')]())[_0xdf5d('0x7')](realtime[_0xdf5d('0xc')]())[_0xdf5d('0x7')](smsQueue[_0xdf5d('0xd')]())[_0xdf5d('0x7')](realtime[_0xdf5d('0xe')]())[_0xdf5d('0x7')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())['then'](faxQueue['getFaxQueues']())[_0xdf5d('0x7')](realtime[_0xdf5d('0xf')]())[_0xdf5d('0x7')](whatsappQueue[_0xdf5d('0x10')]())[_0xdf5d('0x7')](realtime[_0xdf5d('0x11')]())[_0xdf5d('0x7')](function(){return realtime;});}function main(){return server[_0xdf5d('0x12')](realtime)['then'](function(_0x2f09c3){return initRealtime();})[_0xdf5d('0x7')](function(_0x45d80a){return setInterval(initRealtime,0x1388);})[_0xdf5d('0x13')](function(_0x538936){console[_0xdf5d('0x14')](_0x538936);});}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 97d6d5a..73fbd86 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x4692a1,_0x41f54f){var _0x128700=function(_0x2661dc){while(--_0x2661dc){_0x4692a1['push'](_0x4692a1['shift']());}};_0x128700(++_0x41f54f);}(_0x326f,0xd1));var _0xf326=function(_0x38af97,_0x33f639){_0x38af97=_0x38af97-0x0;var _0xbc2a94=_0x326f[_0x38af97];return _0xbc2a94;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _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(_0x30dc5b,_0x4bf2f9){var _0x5c512a=function(_0x45a164){while(--_0x45a164){_0x30dc5b['push'](_0x30dc5b['shift']());}};_0x5c512a(++_0x4bf2f9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var 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 3da6e89..a0a9ccd 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 _0xee34=['error','message','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x3df042,_0x4ce182){var _0xe0ef6d=function(_0x5bbfed){while(--_0x5bbfed){_0x3df042['push'](_0x3df042['shift']());}};_0xe0ef6d(++_0x4ce182);}(_0xee34,0xe1));var _0x4ee3=function(_0x5e5b78,_0xd2d9be){_0x5e5b78=_0x5e5b78-0x0;var _0x19207f=_0xee34[_0x5e5b78];return _0x19207f;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x4ee3('0x0'));var client=jayson[_0x4ee3('0x1')][_0x4ee3('0x2')]({'port':0x232b});function request(_0x46105f,_0x1cba95){return new BPromise(function(_0x122d67,_0xe0b85d){return client[_0x4ee3('0x3')](_0x46105f,_0x1cba95)[_0x4ee3('0x4')](function(_0x4dc33f){if(_0x4dc33f['error']){return _0xe0b85d(_0x4dc33f[_0x4ee3('0x5')][_0x4ee3('0x6')]);}else{return _0x122d67(_0x4dc33f['result']);}})[_0x4ee3('0x7')](function(_0x39c58d){return _0xe0b85d(_0x39c58d);});});}exports[_0x4ee3('0x8')]=function(_0x44469c,_0x18670a){return request(_0x4ee3('0x9'),{'account':_0x44469c,'message':_0x18670a});}; \ No newline at end of file +var _0xdd2d=['client','http','request','then','error','message','result','catch','SendMail','jayson/promise'];(function(_0x158581,_0x81342c){var _0x4cdb4f=function(_0x31675e){while(--_0x31675e){_0x158581['push'](_0x158581['shift']());}};_0x4cdb4f(++_0x81342c);}(_0xdd2d,0x185));var _0xddd2=function(_0x57fa33,_0x2b8222){_0x57fa33=_0x57fa33-0x0;var _0x12e724=_0xdd2d[_0x57fa33];return _0x12e724;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xddd2('0x0'));var client=jayson[_0xddd2('0x1')][_0xddd2('0x2')]({'port':0x232b});function request(_0x485dc0,_0x5ceb6a){return new BPromise(function(_0x49d93a,_0x589c2c){return client[_0xddd2('0x3')](_0x485dc0,_0x5ceb6a)[_0xddd2('0x4')](function(_0xbfde6a){if(_0xbfde6a['error']){return _0x589c2c(_0xbfde6a[_0xddd2('0x5')][_0xddd2('0x6')]);}else{return _0x49d93a(_0xbfde6a[_0xddd2('0x7')]);}})[_0xddd2('0x8')](function(_0x4fc578){return _0x589c2c(_0x4fc578);});});}exports['sendMailMessage']=function(_0x46a618,_0x91da48){return request(_0xddd2('0x9'),{'account':_0x46a618,'message':_0x91da48});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 43c0e70..8ac59c0 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 _0x8a34=['mailPause','faxPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','idle','mail','chat','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','smsPause','chatStatus','mailStatus','mailStatusTime','mailCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappStatusTime','stringify','md5','emit','user:save','exports','lodash','moment','../../../config/environment','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause'];(function(_0x3ab353,_0x5d5283){var _0x1e2285=function(_0x55804f){while(--_0x55804f){_0x3ab353['push'](_0x3ab353['shift']());}};_0x1e2285(++_0x5d5283);}(_0x8a34,0x127));var _0x48a3=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x8a34[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0x48a3('0x0'));var moment=require(_0x48a3('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x48a3('0x2'));config[_0x48a3('0x3')]=_['defaults'](config[_0x48a3('0x3')],{'host':_0x48a3('0x4'),'port':0x18eb});var io=require(_0x48a3('0x5'))(new Redis(config[_0x48a3('0x3')]));function Agent(_0x181a4c){this['id']=_0x181a4c['id']||0x0;this[_0x48a3('0x6')]=_0x181a4c['name']||'';this[_0x48a3('0x7')]=_0x181a4c[_0x48a3('0x7')]||!![];this[_0x48a3('0x8')]=_0x181a4c[_0x48a3('0x8')]||![];this[_0x48a3('0x9')]=_0x181a4c[_0x48a3('0x9')]||![];this['mailPause']=_0x181a4c[_0x48a3('0xa')]||![];this['faxPause']=_0x181a4c[_0x48a3('0xb')]||![];this['smsPause']=_0x181a4c['smsPause']||![];this[_0x48a3('0xc')]=_0x181a4c['openchannelPause']||![];this['chatStatus']=_0x48a3('0xd');this[_0x48a3('0xe')]=0x0;this['chatCapacity']=_0x181a4c[_0x48a3('0xf')]||0x0;this[_0x48a3('0x10')]=0x0;this['mailStatus']=_0x48a3('0xd');this['mailStatusTime']=0x0;this['mailCapacity']=_0x181a4c[_0x48a3('0x11')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x48a3('0xd');this[_0x48a3('0x12')]=0x0;this[_0x48a3('0x13')]=_0x181a4c[_0x48a3('0x13')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x48a3('0x14')]=_0x48a3('0xd');this[_0x48a3('0x15')]=0x0;this[_0x48a3('0x16')]=_0x181a4c[_0x48a3('0x16')]||0x0;this[_0x48a3('0x17')]=0x0;this[_0x48a3('0x18')]=_0x48a3('0xd');this['whatsappStatusTime']=0x0;this[_0x48a3('0x19')]=_0x181a4c[_0x48a3('0x19')]||0x0;this[_0x48a3('0x1a')]=0x0;this[_0x48a3('0x1b')]='unknown';this['openchannelStatusTime']=0x0;this[_0x48a3('0x1c')]=_0x181a4c[_0x48a3('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x48a3('0x1d')]=![];this[_0x48a3('0x1e')]=undefined;this['md5']='';this[_0x48a3('0x1f')]();}Agent[_0x48a3('0x20')][_0x48a3('0x21')]=function(_0x46bd6d){if(this[_0x46bd6d+_0x48a3('0x22')]>0x0){if(this[_0x46bd6d+'Capacity']>0x0&&this[_0x46bd6d+_0x48a3('0x22')]>=this[_0x46bd6d+_0x48a3('0x23')]){return _0x48a3('0x24');}else{return'working';}}else{return _0x48a3('0x25');}};Agent[_0x48a3('0x20')][_0x48a3('0x1f')]=function(){var _0x22e04e=[_0x48a3('0x26'),_0x48a3('0x27'),_0x48a3('0x28'),'fax',_0x48a3('0x29'),_0x48a3('0x2a')];for(var _0x42fd2c=0x0;_0x42fd2c<_0x22e04e[_0x48a3('0x2b')];_0x42fd2c+=0x1){var _0x395102=this[_0x48a3('0x21')](_0x22e04e[_0x42fd2c]);if(this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2c')]!==_0x395102){this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2d')]=_[_0x48a3('0x2e')](moment()[_0x48a3('0x2f')]('x'));}this[_0x22e04e[_0x42fd2c]+_0x48a3('0x2c')]=_0x395102;}var _0x522d46={'id':this['id'],'name':this[_0x48a3('0x6')],'online':this[_0x48a3('0x7')],'voicePause':this[_0x48a3('0x8')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x48a3('0x30')],'faxPause':this[_0x48a3('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x48a3('0x31')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x48a3('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x48a3('0x32')],'mailStatusTime':this[_0x48a3('0x33')],'mailCapacity':this[_0x48a3('0x11')],'mailCurrentCapacity':this[_0x48a3('0x34')],'faxStatus':this[_0x48a3('0x35')],'faxStatusTime':this[_0x48a3('0x12')],'faxCapacity':this[_0x48a3('0x13')],'faxCurrentCapacity':this[_0x48a3('0x36')],'smsStatus':this[_0x48a3('0x14')],'smsStatusTime':this[_0x48a3('0x15')],'smsCapacity':this[_0x48a3('0x16')],'smsCurrentCapacity':this[_0x48a3('0x17')],'whatsappStatus':this[_0x48a3('0x18')],'whatsappStatusTime':this[_0x48a3('0x37')],'whatsappCapacity':this[_0x48a3('0x19')],'whatsappCurrentCapacity':this[_0x48a3('0x1a')],'openchannelStatus':this[_0x48a3('0x1b')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x48a3('0x1e')]};var _0x30bc88=md5(JSON[_0x48a3('0x38')](_0x522d46));if(this[_0x48a3('0x39')]!==_0x30bc88){this[_0x48a3('0x39')]=_0x30bc88;io[_0x48a3('0x3a')](_0x48a3('0x3b'),_0x522d46);}};module[_0x48a3('0x3c')]=Agent; \ No newline at end of file +var _0x2d18=['faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','prototype','mail','chat','fax','sms','whatsapp','length','Status','toNumber','mailStatusTime','smsStatusTime','busyQueue','stringify','user:save','exports','lodash','moment','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity'];(function(_0x54eab6,_0x5e262f){var _0x1e7435=function(_0x468c91){while(--_0x468c91){_0x54eab6['push'](_0x54eab6['shift']());}};_0x1e7435(++_0x5e262f);}(_0x2d18,0xd5));var _0x82d1=function(_0x204106,_0x4e9aab){_0x204106=_0x204106-0x0;var _0x258ec2=_0x2d18[_0x204106];return _0x258ec2;};'use strict';var _=require(_0x82d1('0x0'));var moment=require(_0x82d1('0x1'));var md5=require(_0x82d1('0x2'));var Redis=require(_0x82d1('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x82d1('0x4')](config[_0x82d1('0x5')],{'host':_0x82d1('0x6'),'port':0x18eb});var io=require(_0x82d1('0x7'))(new Redis(config[_0x82d1('0x5')]));function Agent(_0x1a6f09){this['id']=_0x1a6f09['id']||0x0;this[_0x82d1('0x8')]=_0x1a6f09[_0x82d1('0x8')]||'';this[_0x82d1('0x9')]=_0x1a6f09['online']||!![];this['voicePause']=_0x1a6f09[_0x82d1('0xa')]||![];this[_0x82d1('0xb')]=_0x1a6f09[_0x82d1('0xb')]||![];this[_0x82d1('0xc')]=_0x1a6f09[_0x82d1('0xc')]||![];this['faxPause']=_0x1a6f09[_0x82d1('0xd')]||![];this[_0x82d1('0xe')]=_0x1a6f09[_0x82d1('0xe')]||![];this[_0x82d1('0xf')]=_0x1a6f09[_0x82d1('0xf')]||![];this[_0x82d1('0x10')]=_0x82d1('0x11');this[_0x82d1('0x12')]=0x0;this[_0x82d1('0x13')]=_0x1a6f09[_0x82d1('0x13')]||0x0;this[_0x82d1('0x14')]=0x0;this[_0x82d1('0x15')]='unknown';this['mailStatusTime']=0x0;this[_0x82d1('0x16')]=_0x1a6f09['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0x82d1('0x17')]=_0x82d1('0x11');this[_0x82d1('0x18')]=0x0;this['faxCapacity']=_0x1a6f09[_0x82d1('0x19')]||0x0;this[_0x82d1('0x1a')]=0x0;this[_0x82d1('0x1b')]=_0x82d1('0x11');this['smsStatusTime']=0x0;this['smsCapacity']=_0x1a6f09['smsCapacity']||0x0;this[_0x82d1('0x1c')]=0x0;this[_0x82d1('0x1d')]=_0x82d1('0x11');this[_0x82d1('0x1e')]=0x0;this[_0x82d1('0x1f')]=_0x1a6f09[_0x82d1('0x1f')]||0x0;this[_0x82d1('0x20')]=0x0;this[_0x82d1('0x21')]=_0x82d1('0x11');this[_0x82d1('0x22')]=0x0;this[_0x82d1('0x23')]=_0x1a6f09[_0x82d1('0x23')]||0x0;this[_0x82d1('0x24')]=0x0;this[_0x82d1('0x25')]=![];this['busyQueue']=undefined;this[_0x82d1('0x2')]='';this[_0x82d1('0x26')]();}Agent['prototype'][_0x82d1('0x27')]=function(_0x18be94){if(this[_0x18be94+_0x82d1('0x28')]>0x0){if(this[_0x18be94+_0x82d1('0x29')]>0x0&&this[_0x18be94+_0x82d1('0x28')]>=this[_0x18be94+'Capacity']){return _0x82d1('0x2a');}else{return _0x82d1('0x2b');}}else{return'idle';}};Agent[_0x82d1('0x2c')][_0x82d1('0x26')]=function(){var _0x43671b=[_0x82d1('0x2d'),_0x82d1('0x2e'),'openchannel',_0x82d1('0x2f'),_0x82d1('0x30'),_0x82d1('0x31')];for(var _0x1ab05c=0x0;_0x1ab05c<_0x43671b[_0x82d1('0x32')];_0x1ab05c+=0x1){var _0x218eed=this['getChannelStatus'](_0x43671b[_0x1ab05c]);if(this[_0x43671b[_0x1ab05c]+_0x82d1('0x33')]!==_0x218eed){this[_0x43671b[_0x1ab05c]+'StatusTime']=_[_0x82d1('0x34')](moment()['format']('x'));}this[_0x43671b[_0x1ab05c]+_0x82d1('0x33')]=_0x218eed;}var _0x73481e={'id':this['id'],'name':this[_0x82d1('0x8')],'online':this[_0x82d1('0x9')],'voicePause':this[_0x82d1('0xa')],'chatPause':this[_0x82d1('0xb')],'mailPause':this['mailPause'],'smsPause':this[_0x82d1('0xe')],'faxPause':this[_0x82d1('0xd')],'openchannelPause':this[_0x82d1('0xf')],'chatStatus':this[_0x82d1('0x10')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x82d1('0x14')],'mailStatus':this[_0x82d1('0x15')],'mailStatusTime':this[_0x82d1('0x35')],'mailCapacity':this[_0x82d1('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x82d1('0x18')],'faxCapacity':this[_0x82d1('0x19')],'faxCurrentCapacity':this[_0x82d1('0x1a')],'smsStatus':this[_0x82d1('0x1b')],'smsStatusTime':this[_0x82d1('0x36')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x82d1('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x82d1('0x1f')],'whatsappCurrentCapacity':this[_0x82d1('0x20')],'openchannelStatus':this[_0x82d1('0x21')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x82d1('0x24')],'busy':this['busy'],'busyQueue':this[_0x82d1('0x37')]};var _0x21baef=md5(JSON[_0x82d1('0x38')](_0x73481e));if(this[_0x82d1('0x2')]!==_0x21baef){this['md5']=_0x21baef;io['emit'](_0x82d1('0x39'),_0x73481e);}};module[_0x82d1('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d98f587..184ec62 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 _0xfe39=['mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','chatPause','paused','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x19dc9f,_0x509a5b){var _0x2aa779=function(_0x22607f){while(--_0x22607f){_0x19dc9f['push'](_0x19dc9f['shift']());}};_0x2aa779(++_0x509a5b);}(_0xfe39,0x1c0));var _0x9fe3=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0xfe39[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x9fe3('0x0'));var md5=require(_0x9fe3('0x1'));var util=require(_0x9fe3('0x2'));var Redis=require(_0x9fe3('0x3'));var config=require(_0x9fe3('0x4'));config[_0x9fe3('0x5')]=_[_0x9fe3('0x6')](config[_0x9fe3('0x5')],{'host':_0x9fe3('0x7'),'port':0x18eb});var io=require(_0x9fe3('0x8'))(new Redis(config[_0x9fe3('0x5')]));function ChatQueue(_0x28640a){this['id']=_0x28640a['id']||0x0;this[_0x9fe3('0x9')]=_0x28640a[_0x9fe3('0x9')]||'';this[_0x9fe3('0xa')]=_0x28640a[_0x9fe3('0xa')]||0xa;this['strategy']=_0x28640a[_0x9fe3('0xb')]||_0x9fe3('0xc');this[_0x9fe3('0xd')]=_0x28640a['Agents'];this[_0x9fe3('0xe')]={};this['waiting']=0x0;this[_0x9fe3('0x1')]='';this['updateRouting']();this[_0x9fe3('0xf')]();}ChatQueue[_0x9fe3('0x10')][_0x9fe3('0x11')]=function(){var _0x531ca4=this[_0x9fe3('0xe')][_0x9fe3('0x12')];this[_0x9fe3('0xe')]=_[_0x9fe3('0x13')](this[_0x9fe3('0xd')],'id');this['mapAgentsId']['_rr']=_0x531ca4;};ChatQueue[_0x9fe3('0x10')][_0x9fe3('0xf')]=function(){this[_0x9fe3('0x14')]=0x0;this['paused']=0x0;for(var _0x1c78f7=0x0;_0x1c78f7=0x0?this[_0x9fe3('0x19')]:0x0;var _0x2bb3fd={'id':this['id'],'available':this['available'],'loggedIn':this[_0x9fe3('0x14')],'name':this[_0x9fe3('0x9')],'paused':this['paused'],'waiting':this[_0x9fe3('0x1a')]};var _0xebe4f5=md5(JSON[_0x9fe3('0x1b')](_0x2bb3fd));if(this[_0x9fe3('0x1')]!==_0xebe4f5){this['md5']=_0xebe4f5;io['to'](util[_0x9fe3('0x1c')](_0x9fe3('0x1d'),_0x2bb3fd[_0x9fe3('0x9')]))[_0x9fe3('0x1e')](_0x9fe3('0x1f'),_0x2bb3fd);}};module[_0x9fe3('0x20')]=ChatQueue; \ No newline at end of file +var _0x22f8=['available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','length','online','loggedIn','chatPause','paused'];(function(_0x44549d,_0x15fabc){var _0x2386c3=function(_0x507f5f){while(--_0x507f5f){_0x44549d['push'](_0x44549d['shift']());}};_0x2386c3(++_0x15fabc);}(_0x22f8,0x180));var _0x822f=function(_0x4e713e,_0x1ac682){_0x4e713e=_0x4e713e-0x0;var _0x296ac0=_0x22f8[_0x4e713e];return _0x296ac0;};'use strict';var _=require(_0x822f('0x0'));var md5=require(_0x822f('0x1'));var util=require('util');var Redis=require(_0x822f('0x2'));var config=require(_0x822f('0x3'));config[_0x822f('0x4')]=_['defaults'](config[_0x822f('0x4')],{'host':_0x822f('0x5'),'port':0x18eb});var io=require(_0x822f('0x6'))(new Redis(config[_0x822f('0x4')]));function ChatQueue(_0x772254){this['id']=_0x772254['id']||0x0;this[_0x822f('0x7')]=_0x772254[_0x822f('0x7')]||'';this[_0x822f('0x8')]=_0x772254[_0x822f('0x8')]||0xa;this['strategy']=_0x772254['strategy']||_0x822f('0x9');this[_0x822f('0xa')]=_0x772254[_0x822f('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x822f('0x1')]='';this[_0x822f('0xb')]();this[_0x822f('0xc')]();}ChatQueue[_0x822f('0xd')]['updateRouting']=function(){var _0x4b30ad=this[_0x822f('0xe')]['_rr'];this[_0x822f('0xe')]=_['map'](this['Agents'],'id');this[_0x822f('0xe')][_0x822f('0xf')]=_0x4b30ad;};ChatQueue[_0x822f('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x3e6103=0x0;_0x3e6103=0x0?this[_0x822f('0x15')]:0x0;var _0x1659c0={'id':this['id'],'available':this[_0x822f('0x15')],'loggedIn':this[_0x822f('0x12')],'name':this[_0x822f('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x4e4944=md5(JSON[_0x822f('0x16')](_0x1659c0));if(this[_0x822f('0x1')]!==_0x4e4944){this[_0x822f('0x1')]=_0x4e4944;io['to'](util[_0x822f('0x17')](_0x822f('0x18'),_0x1659c0[_0x822f('0x7')]))[_0x822f('0x19')]('chat_queue:save',_0x1659c0);}};module[_0x822f('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3fa9aa5..793222d 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 _0x5268=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','ioredis','../../../config/environment','defaults','redis','localhost','name','timeout','strategy'];(function(_0x183b97,_0x2d297c){var _0x629cf7=function(_0x4ffd24){while(--_0x4ffd24){_0x183b97['push'](_0x183b97['shift']());}};_0x629cf7(++_0x2d297c);}(_0x5268,0xdf));var _0x8526=function(_0x509e06,_0x31876d){_0x509e06=_0x509e06-0x0;var _0xb2883d=_0x5268[_0x509e06];return _0xb2883d;};'use strict';var _=require('lodash');var md5=require(_0x8526('0x0'));var util=require('util');var Redis=require(_0x8526('0x1'));var config=require(_0x8526('0x2'));config['redis']=_[_0x8526('0x3')](config[_0x8526('0x4')],{'host':_0x8526('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function FaxQueue(_0x5adf9f){this['id']=_0x5adf9f['id']||0x0;this[_0x8526('0x6')]=_0x5adf9f[_0x8526('0x6')]||'';this['timeout']=_0x5adf9f[_0x8526('0x7')]||0xa;this[_0x8526('0x8')]=_0x5adf9f[_0x8526('0x8')]||_0x8526('0x9');this[_0x8526('0xa')]=_0x5adf9f['Agents'];this['mapAgentsId']={};this[_0x8526('0xb')]=0x0;this[_0x8526('0x0')]='';this[_0x8526('0xc')]();this[_0x8526('0xd')]();}FaxQueue[_0x8526('0xe')][_0x8526('0xc')]=function(){var _0x287a3b=this[_0x8526('0xf')][_0x8526('0x10')];this[_0x8526('0xf')]=_['map'](this['Agents'],'id');this[_0x8526('0xf')][_0x8526('0x10')]=_0x287a3b;};FaxQueue[_0x8526('0xe')]['updateRealtime']=function(){this[_0x8526('0x11')]=0x0;this[_0x8526('0x12')]=0x0;for(var _0x4f72e6=0x0;_0x4f72e6=0x0?this[_0x8526('0x16')]:0x0;var _0x1248cf={'id':this['id'],'available':this[_0x8526('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x8526('0x6')],'paused':this['paused'],'waiting':this[_0x8526('0xb')]};var _0x39d0c0=md5(JSON[_0x8526('0x17')](_0x1248cf));if(this['md5']!==_0x39d0c0){this['md5']=_0x39d0c0;io['to'](util[_0x8526('0x18')](_0x8526('0x19'),_0x1248cf['name']))[_0x8526('0x1a')](_0x8526('0x1b'),_0x1248cf);}};module[_0x8526('0x1c')]=FaxQueue; \ No newline at end of file +var _0x00e0=['waiting','updateRouting','updateRealtime','prototype','_rr','paused','length','online','loggedIn','faxPause','available','format','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x00e0,0x111));var _0x000e=function(_0x2228f2,_0x151af4){_0x2228f2=_0x2228f2-0x0;var _0x17f2fa=_0x00e0[_0x2228f2];return _0x17f2fa;};'use strict';var _=require('lodash');var md5=require(_0x000e('0x0'));var util=require(_0x000e('0x1'));var Redis=require(_0x000e('0x2'));var config=require(_0x000e('0x3'));config['redis']=_[_0x000e('0x4')](config[_0x000e('0x5')],{'host':_0x000e('0x6'),'port':0x18eb});var io=require(_0x000e('0x7'))(new Redis(config['redis']));function FaxQueue(_0x12ec1a){this['id']=_0x12ec1a['id']||0x0;this[_0x000e('0x8')]=_0x12ec1a[_0x000e('0x8')]||'';this[_0x000e('0x9')]=_0x12ec1a[_0x000e('0x9')]||0xa;this['strategy']=_0x12ec1a['strategy']||_0x000e('0xa');this[_0x000e('0xb')]=_0x12ec1a['Agents'];this[_0x000e('0xc')]={};this[_0x000e('0xd')]=0x0;this['md5']='';this[_0x000e('0xe')]();this[_0x000e('0xf')]();}FaxQueue[_0x000e('0x10')]['updateRouting']=function(){var _0x12f9da=this['mapAgentsId'][_0x000e('0x11')];this[_0x000e('0xc')]=_['map'](this[_0x000e('0xb')],'id');this[_0x000e('0xc')]['_rr']=_0x12f9da;};FaxQueue[_0x000e('0x10')][_0x000e('0xf')]=function(){this['loggedIn']=0x0;this[_0x000e('0x12')]=0x0;for(var _0x1f3728=0x0;_0x1f3728=0x0?this[_0x000e('0x17')]:0x0;var _0x2436ba={'id':this['id'],'available':this[_0x000e('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x000e('0x12')],'waiting':this['waiting']};var _0xfd8a1c=md5(JSON['stringify'](_0x2436ba));if(this[_0x000e('0x0')]!==_0xfd8a1c){this[_0x000e('0x0')]=_0xfd8a1c;io['to'](util[_0x000e('0x18')]('fax:queue:%s',_0x2436ba['name']))['emit']('fax_queue:save',_0x2436ba);}};module[_0x000e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 69dbfbe..d24f319 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 _0x6c77=['exports','name','Intervals'];(function(_0x1c443a,_0x31a252){var _0x594afe=function(_0x13e9d6){while(--_0x13e9d6){_0x1c443a['push'](_0x1c443a['shift']());}};_0x594afe(++_0x31a252);}(_0x6c77,0x151));var _0x76c7=function(_0x5bb3a6,_0xc89ee3){_0x5bb3a6=_0x5bb3a6-0x0;var _0x279273=_0x6c77[_0x5bb3a6];return _0x279273;};'use strict';function Interval(_0x1da3cd){this['id']=_0x1da3cd['id']||0x0;this[_0x76c7('0x0')]=_0x1da3cd[_0x76c7('0x0')]||'';this[_0x76c7('0x1')]=_0x1da3cd['Intervals']||{};}module[_0x76c7('0x2')]=Interval; \ No newline at end of file +var _0x03af=['Intervals','exports','name'];(function(_0x1ab229,_0x5f190f){var _0x41def0=function(_0xa62dfb){while(--_0xa62dfb){_0x1ab229['push'](_0x1ab229['shift']());}};_0x41def0(++_0x5f190f);}(_0x03af,0x95));var _0xf03a=function(_0x3f0ff3,_0x1ef83e){_0x3f0ff3=_0x3f0ff3-0x0;var _0x3c895b=_0x03af[_0x3f0ff3];return _0x3c895b;};'use strict';function Interval(_0x34065f){this['id']=_0x34065f['id']||0x0;this['name']=_0x34065f[_0xf03a('0x0')]||'';this[_0xf03a('0x1')]=_0x34065f[_0xf03a('0x1')]||{};}module[_0xf03a('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 68ddd5a..3b6bfb5 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 _0x0817=['updateRealtime','loggedIn','paused','length','online','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr'];(function(_0x4e7f3f,_0x5c57da){var _0x441fd2=function(_0x177c74){while(--_0x177c74){_0x4e7f3f['push'](_0x4e7f3f['shift']());}};_0x441fd2(++_0x5c57da);}(_0x0817,0xcc));var _0x7081=function(_0x292e5f,_0x1efadd){_0x292e5f=_0x292e5f-0x0;var _0x57f40c=_0x0817[_0x292e5f];return _0x57f40c;};'use strict';var _=require(_0x7081('0x0'));var md5=require(_0x7081('0x1'));var util=require(_0x7081('0x2'));var Redis=require(_0x7081('0x3'));var config=require(_0x7081('0x4'));config[_0x7081('0x5')]=_[_0x7081('0x6')](config[_0x7081('0x5')],{'host':_0x7081('0x7'),'port':0x18eb});var io=require(_0x7081('0x8'))(new Redis(config['redis']));function MailQueue(_0x390ca2){this['id']=_0x390ca2['id']||0x0;this[_0x7081('0x9')]=_0x390ca2[_0x7081('0x9')]||'';this[_0x7081('0xa')]=_0x390ca2[_0x7081('0xa')]||0xa;this['strategy']=_0x390ca2[_0x7081('0xb')]||_0x7081('0xc');this[_0x7081('0xd')]=_0x390ca2[_0x7081('0xd')];this[_0x7081('0xe')]={};this[_0x7081('0xf')]=0x0;this[_0x7081('0x1')]='';this[_0x7081('0x10')]();this['updateRealtime']();}MailQueue[_0x7081('0x11')][_0x7081('0x10')]=function(){var _0x31a951=this['mapAgentsId']['_rr'];this[_0x7081('0xe')]=_[_0x7081('0x12')](this[_0x7081('0xd')],'id');this[_0x7081('0xe')][_0x7081('0x13')]=_0x31a951;};MailQueue[_0x7081('0x11')][_0x7081('0x14')]=function(){this[_0x7081('0x15')]=0x0;this[_0x7081('0x16')]=0x0;for(var _0x4a3e04=0x0;_0x4a3e04=0x0?this[_0x7081('0x19')]:0x0;var _0x13fd2a={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7081('0x15')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7081('0xf')]};var _0x19823e=md5(JSON[_0x7081('0x1a')](_0x13fd2a));if(this[_0x7081('0x1')]!==_0x19823e){this['md5']=_0x19823e;io['to'](util[_0x7081('0x1b')](_0x7081('0x1c'),_0x13fd2a[_0x7081('0x9')]))[_0x7081('0x1d')](_0x7081('0x1e'),_0x13fd2a);}};module[_0x7081('0x1f')]=MailQueue; \ No newline at end of file +var _0xeb99=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','mailPause','available','stringify','mail:queue:%s','mail_queue:save','exports','md5','../../../config/environment','redis','defaults','localhost'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xeb99,0x97));var _0x9eb9=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0xeb99[_0x1546c2];return _0x24583c;};'use strict';var _=require('lodash');var md5=require(_0x9eb9('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x9eb9('0x1'));config[_0x9eb9('0x2')]=_[_0x9eb9('0x3')](config['redis'],{'host':_0x9eb9('0x4'),'port':0x18eb});var io=require(_0x9eb9('0x5'))(new Redis(config[_0x9eb9('0x2')]));function MailQueue(_0x77649c){this['id']=_0x77649c['id']||0x0;this['name']=_0x77649c[_0x9eb9('0x6')]||'';this[_0x9eb9('0x7')]=_0x77649c[_0x9eb9('0x7')]||0xa;this[_0x9eb9('0x8')]=_0x77649c[_0x9eb9('0x8')]||_0x9eb9('0x9');this[_0x9eb9('0xa')]=_0x77649c[_0x9eb9('0xa')];this[_0x9eb9('0xb')]={};this[_0x9eb9('0xc')]=0x0;this[_0x9eb9('0x0')]='';this['updateRouting']();this[_0x9eb9('0xd')]();}MailQueue[_0x9eb9('0xe')]['updateRouting']=function(){var _0x3f3f51=this['mapAgentsId'][_0x9eb9('0xf')];this[_0x9eb9('0xb')]=_['map'](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x3f3f51;};MailQueue[_0x9eb9('0xe')][_0x9eb9('0xd')]=function(){this[_0x9eb9('0x10')]=0x0;this[_0x9eb9('0x11')]=0x0;for(var _0x58cf83=0x0;_0x58cf83=0x0?this[_0x9eb9('0x15')]:0x0;var _0x1986f8={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x9eb9('0x11')],'waiting':this['waiting']};var _0x5debc1=md5(JSON[_0x9eb9('0x16')](_0x1986f8));if(this['md5']!==_0x5debc1){this[_0x9eb9('0x0')]=_0x5debc1;io['to'](util['format'](_0x9eb9('0x17'),_0x1986f8['name']))['emit'](_0x9eb9('0x18'),_0x1986f8);}};module[_0x9eb9('0x19')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 73f7f97..95ee2f0 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0xa4928c,_0x16b89c){var _0x27cc29=function(_0x14b819){while(--_0x14b819){_0xa4928c['push'](_0xa4928c['shift']());}};_0x27cc29(++_0x16b89c);}(_0x2ef3,0xba));var _0x32ef=function(_0x540715,_0x5c910d){_0x540715=_0x540715-0x0;var _0x334ff9=_0x2ef3[_0x540715];return _0x334ff9;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x326f,0xd1));var _0xf326=function(_0x9c5efc,_0x3b5eb0){_0x9c5efc=_0x9c5efc-0x0;var _0x54376b=_0x326f[_0x9c5efc];return _0x54376b;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 298c001..f9b492f 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 _0x153f=['available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','smsPause'];(function(_0xb3a57a,_0x57e8c2){var _0x199435=function(_0x465425){while(--_0x465425){_0xb3a57a['push'](_0xb3a57a['shift']());}};_0x199435(++_0x57e8c2);}(_0x153f,0x15b));var _0xf153=function(_0x305550,_0x3f5848){_0x305550=_0x305550-0x0;var _0x6101e=_0x153f[_0x305550];return _0x6101e;};'use strict';var _=require(_0xf153('0x0'));var md5=require(_0xf153('0x1'));var util=require(_0xf153('0x2'));var Redis=require(_0xf153('0x3'));var config=require(_0xf153('0x4'));config[_0xf153('0x5')]=_[_0xf153('0x6')](config['redis'],{'host':_0xf153('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf153('0x5')]));function SmsQueue(_0x2fcb1a){this['id']=_0x2fcb1a['id']||0x0;this[_0xf153('0x8')]=_0x2fcb1a[_0xf153('0x8')]||'';this[_0xf153('0x9')]=_0x2fcb1a['timeout']||0xa;this[_0xf153('0xa')]=_0x2fcb1a[_0xf153('0xa')]||_0xf153('0xb');this[_0xf153('0xc')]=_0x2fcb1a[_0xf153('0xc')];this[_0xf153('0xd')]={};this[_0xf153('0xe')]=0x0;this[_0xf153('0x1')]='';this[_0xf153('0xf')]();this[_0xf153('0x10')]();}SmsQueue['prototype'][_0xf153('0xf')]=function(){var _0x1c8de7=this[_0xf153('0xd')]['_rr'];this[_0xf153('0xd')]=_[_0xf153('0x11')](this[_0xf153('0xc')],'id');this[_0xf153('0xd')][_0xf153('0x12')]=_0x1c8de7;};SmsQueue[_0xf153('0x13')][_0xf153('0x10')]=function(){this[_0xf153('0x14')]=0x0;this[_0xf153('0x15')]=0x0;for(var _0x4c5283=0x0;_0x4c5283=0x0?this[_0xf153('0x19')]:0x0;var _0x44272e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf153('0x14')],'name':this[_0xf153('0x8')],'paused':this[_0xf153('0x15')],'waiting':this[_0xf153('0xe')]};var _0x15230c=md5(JSON[_0xf153('0x1a')](_0x44272e));if(this[_0xf153('0x1')]!==_0x15230c){this[_0xf153('0x1')]=_0x15230c;io['to'](util[_0xf153('0x1b')](_0xf153('0x1c'),_0x44272e[_0xf153('0x8')]))[_0xf153('0x1d')]('sms_queue:save',_0x44272e);}};module[_0xf153('0x1e')]=SmsQueue; \ No newline at end of file +var _0xc6ab=['lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','loggedIn','paused','smsPause','available','waiting','stringify','format','sms:queue:%s','emit'];(function(_0xc7e91e,_0x517d3d){var _0xe15f40=function(_0x372dcf){while(--_0x372dcf){_0xc7e91e['push'](_0xc7e91e['shift']());}};_0xe15f40(++_0x517d3d);}(_0xc6ab,0x96));var _0xbc6a=function(_0x41fd66,_0x1c67ab){_0x41fd66=_0x41fd66-0x0;var _0x2cb2aa=_0xc6ab[_0x41fd66];return _0x2cb2aa;};'use strict';var _=require(_0xbc6a('0x0'));var md5=require(_0xbc6a('0x1'));var util=require(_0xbc6a('0x2'));var Redis=require(_0xbc6a('0x3'));var config=require(_0xbc6a('0x4'));config['redis']=_['defaults'](config[_0xbc6a('0x5')],{'host':_0xbc6a('0x6'),'port':0x18eb});var io=require(_0xbc6a('0x7'))(new Redis(config[_0xbc6a('0x5')]));function SmsQueue(_0x2767db){this['id']=_0x2767db['id']||0x0;this['name']=_0x2767db[_0xbc6a('0x8')]||'';this[_0xbc6a('0x9')]=_0x2767db[_0xbc6a('0x9')]||0xa;this[_0xbc6a('0xa')]=_0x2767db[_0xbc6a('0xa')]||'beepall';this['Agents']=_0x2767db[_0xbc6a('0xb')];this[_0xbc6a('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0xbc6a('0xd')]();this[_0xbc6a('0xe')]();}SmsQueue['prototype'][_0xbc6a('0xd')]=function(){var _0xe1c7bd=this[_0xbc6a('0xc')]['_rr'];this[_0xbc6a('0xc')]=_[_0xbc6a('0xf')](this[_0xbc6a('0xb')],'id');this[_0xbc6a('0xc')]['_rr']=_0xe1c7bd;};SmsQueue['prototype']['updateRealtime']=function(){this[_0xbc6a('0x10')]=0x0;this[_0xbc6a('0x11')]=0x0;for(var _0x48d94a=0x0;_0x48d94a=0x0?this[_0xbc6a('0x13')]:0x0;var _0x2e8b88={'id':this['id'],'available':this[_0xbc6a('0x13')],'loggedIn':this[_0xbc6a('0x10')],'name':this[_0xbc6a('0x8')],'paused':this[_0xbc6a('0x11')],'waiting':this[_0xbc6a('0x14')]};var _0x31dc65=md5(JSON[_0xbc6a('0x15')](_0x2e8b88));if(this[_0xbc6a('0x1')]!==_0x31dc65){this[_0xbc6a('0x1')]=_0x31dc65;io['to'](util[_0xbc6a('0x16')](_0xbc6a('0x17'),_0x2e8b88['name']))[_0xbc6a('0x18')]('sms_queue:save',_0x2e8b88);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 182de6e..925f7f9 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 _0xb684=['paused','online','whatsappPause','available','loggedIn','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','redis','defaults','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0xbbe9f1,_0xb3e60d){var _0x5dc906=function(_0x18e52a){while(--_0x18e52a){_0xbbe9f1['push'](_0xbbe9f1['shift']());}};_0x5dc906(++_0xb3e60d);}(_0xb684,0xa6));var _0x4b68=function(_0x14f55c,_0x106a10){_0x14f55c=_0x14f55c-0x0;var _0x22dd31=_0xb684[_0x14f55c];return _0x22dd31;};'use strict';var _=require(_0x4b68('0x0'));var md5=require(_0x4b68('0x1'));var util=require(_0x4b68('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x4b68('0x3')]=_[_0x4b68('0x4')](config[_0x4b68('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b68('0x3')]));function WhatsappQueue(_0x1d86ef){this['id']=_0x1d86ef['id']||0x0;this['name']=_0x1d86ef[_0x4b68('0x5')]||'';this[_0x4b68('0x6')]=_0x1d86ef[_0x4b68('0x6')]||0xa;this[_0x4b68('0x7')]=_0x1d86ef[_0x4b68('0x7')]||'beepall';this[_0x4b68('0x8')]=_0x1d86ef[_0x4b68('0x8')];this[_0x4b68('0x9')]={};this[_0x4b68('0xa')]=0x0;this[_0x4b68('0x1')]='';this[_0x4b68('0xb')]();this[_0x4b68('0xc')]();}WhatsappQueue[_0x4b68('0xd')][_0x4b68('0xb')]=function(){var _0x478e19=this[_0x4b68('0x9')][_0x4b68('0xe')];this['mapAgentsId']=_[_0x4b68('0xf')](this[_0x4b68('0x8')],'id');this['mapAgentsId'][_0x4b68('0xe')]=_0x478e19;};WhatsappQueue['prototype'][_0x4b68('0xc')]=function(){this['loggedIn']=0x0;this[_0x4b68('0x10')]=0x0;for(var _0x1f93a6=0x0;_0x1f93a6=0x0?this[_0x4b68('0x13')]:0x0;var _0x89b706={'id':this['id'],'available':this[_0x4b68('0x13')],'loggedIn':this[_0x4b68('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x4da3e2=md5(JSON['stringify'](_0x89b706));if(this[_0x4b68('0x1')]!==_0x4da3e2){this['md5']=_0x4da3e2;io['to'](util[_0x4b68('0x15')](_0x4b68('0x16'),_0x89b706[_0x4b68('0x5')]))[_0x4b68('0x17')](_0x4b68('0x18'),_0x89b706);}};module[_0x4b68('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x6e35=['prototype','map','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','emit','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting'];(function(_0xc487b9,_0x13b645){var _0x239f28=function(_0x1c33c3){while(--_0x1c33c3){_0xc487b9['push'](_0xc487b9['shift']());}};_0x239f28(++_0x13b645);}(_0x6e35,0x1ef));var _0x56e3=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x6e35[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x56e3('0x0'));var md5=require('md5');var util=require(_0x56e3('0x1'));var Redis=require(_0x56e3('0x2'));var config=require(_0x56e3('0x3'));config[_0x56e3('0x4')]=_['defaults'](config['redis'],{'host':_0x56e3('0x5'),'port':0x18eb});var io=require(_0x56e3('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x4069f3){this['id']=_0x4069f3['id']||0x0;this[_0x56e3('0x7')]=_0x4069f3[_0x56e3('0x7')]||'';this[_0x56e3('0x8')]=_0x4069f3['timeout']||0xa;this['strategy']=_0x4069f3[_0x56e3('0x9')]||_0x56e3('0xa');this[_0x56e3('0xb')]=_0x4069f3[_0x56e3('0xb')];this[_0x56e3('0xc')]={};this[_0x56e3('0xd')]=0x0;this['md5']='';this[_0x56e3('0xe')]();this['updateRealtime']();}WhatsappQueue[_0x56e3('0xf')][_0x56e3('0xe')]=function(){var _0x23d294=this['mapAgentsId']['_rr'];this[_0x56e3('0xc')]=_[_0x56e3('0x10')](this[_0x56e3('0xb')],'id');this[_0x56e3('0xc')][_0x56e3('0x11')]=_0x23d294;};WhatsappQueue['prototype'][_0x56e3('0x12')]=function(){this[_0x56e3('0x13')]=0x0;this[_0x56e3('0x14')]=0x0;for(var _0x2d93ed=0x0;_0x2d93ed=0x0?this[_0x56e3('0x18')]:0x0;var _0x30dce0={'id':this['id'],'available':this[_0x56e3('0x18')],'loggedIn':this[_0x56e3('0x13')],'name':this[_0x56e3('0x7')],'paused':this[_0x56e3('0x14')],'waiting':this['waiting']};var _0x2eac1e=md5(JSON[_0x56e3('0x19')](_0x30dce0));if(this['md5']!==_0x2eac1e){this[_0x56e3('0x1a')]=_0x2eac1e;io['to'](util[_0x56e3('0x1b')]('whatsapp:queue:%s',_0x30dce0[_0x56e3('0x7')]))[_0x56e3('0x1c')]('whatsapp_queue:save',_0x30dce0);}};module[_0x56e3('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f6c24f4..2a94436 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(_0x33c5d1,_0x37cd6b){var _0x1c8b69=function(_0x344727){while(--_0x344727){_0x33c5d1['push'](_0x33c5d1['shift']());}};_0x1c8b69(++_0x37cd6b);}(_0xb10b,0x12a));var _0xbb10=function(_0x51ece4,_0x39165c){_0x51ece4=_0x51ece4-0x0;var _0x2b7e27=_0xb10b[_0x51ece4];return _0x2b7e27;};'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(_0x5c9946,_0x5d47eb){var _0x219eee=function(_0x1aa9e4){while(--_0x1aa9e4){_0x5c9946['push'](_0x5c9946['shift']());}};_0x219eee(++_0x5d47eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e1a2,_0x81aa1c){_0x2e1a2=_0x2e1a2-0x0;var _0x3df6c8=_0xb10b[_0x2e1a2];return _0x3df6c8;};'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 1e32d1b..82d0c89 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 _0xe65c=['../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x476464,_0x422a44){var _0x4cd09b=function(_0x1dab6d){while(--_0x1dab6d){_0x476464['push'](_0x476464['shift']());}};_0x4cd09b(++_0x422a44);}(_0xe65c,0x156));var _0xce65=function(_0x5651ef,_0x4fd99a){_0x5651ef=_0x5651ef-0x0;var _0x392fba=_0xe65c[_0x5651ef];return _0x392fba;};'use strict';var client=require(_0xce65('0x0'));exports['update']=function(_0x140f98,_0x370e07){return client[_0xce65('0x1')](_0xce65('0x2'),{'body':_0x370e07,'options':{'where':{'id':_0x140f98}},'log':_0xce65('0x3')});};exports[_0xce65('0x4')]=function(_0x3b8928,_0x305a77){return client[_0xce65('0x1')]('AddTagsToChatInteraction',{'body':_0x305a77,'options':{'where':{'id':_0x3b8928}},'log':_0xce65('0x5')});}; \ No newline at end of file +var _0xfc3b=['AddTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x4e566c,_0x16e04c){var _0x31947e=function(_0x2479a3){while(--_0x2479a3){_0x4e566c['push'](_0x4e566c['shift']());}};_0x31947e(++_0x16e04c);}(_0xfc3b,0xc5));var _0xbfc3=function(_0xb593bd,_0x1a15ae){_0xb593bd=_0xb593bd-0x0;var _0x42462e=_0xfc3b[_0xb593bd];return _0x42462e;};'use strict';var client=require('../client');exports['update']=function(_0x17ed57,_0x19bb33){return client[_0xbfc3('0x0')](_0xbfc3('0x1'),{'body':_0x19bb33,'options':{'where':{'id':_0x17ed57}},'log':_0xbfc3('0x2')});};exports['addTags']=function(_0x4d17cc,_0x38e38e){return client[_0xbfc3('0x0')](_0xbfc3('0x3'),{'body':_0x38e38e,'options':{'where':{'id':_0x4d17cc}},'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 3b77700..e64236d 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 _0xb367=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x5ae839,_0x1da370){var _0x1fafba=function(_0x167de7){while(--_0x167de7){_0x5ae839['push'](_0x5ae839['shift']());}};_0x1fafba(++_0x1da370);}(_0xb367,0x162));var _0x7b36=function(_0x192b1e,_0x578930){_0x192b1e=_0x192b1e-0x0;var _0x5db684=_0xb367[_0x192b1e];return _0x5db684;};'use strict';var client=require('../client');exports[_0x7b36('0x0')]=function(_0x303da3){return client[_0x7b36('0x1')](_0x7b36('0x2'),{'body':_0x303da3,'log':_0x7b36('0x3')});}; \ No newline at end of file +var _0x028b=['../client','Request','CreateChatMessage','createChatMessage'];(function(_0x434804,_0x415f68){var _0x573fc8=function(_0x3ce265){while(--_0x3ce265){_0x434804['push'](_0x434804['shift']());}};_0x573fc8(++_0x415f68);}(_0x028b,0xc4));var _0xb028=function(_0x3649f8,_0x3db4ba){_0x3649f8=_0x3649f8-0x0;var _0x259f71=_0x028b[_0x3649f8];return _0x259f71;};'use strict';var client=require(_0xb028('0x0'));exports['create']=function(_0x14af36){return client[_0xb028('0x1')](_0xb028('0x2'),{'body':_0x14af36,'log':_0xb028('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index aa508e0..5156d49 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 _0x3074=['name','strategy','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x36d24d,_0x63dc02){var _0x5d1153=function(_0x18dc56){while(--_0x18dc56){_0x36d24d['push'](_0x36d24d['shift']());}};_0x5d1153(++_0x63dc02);}(_0x3074,0x1dd));var _0x4307=function(_0x4e6af5,_0x91e13c){_0x4e6af5=_0x4e6af5-0x0;var _0x4d36bc=_0x3074[_0x4e6af5];return _0x4d36bc;};'use strict';var client=require(_0x4307('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x4307('0x1')](_0x4307('0x2'),{'options':{'raw':![],'attributes':['id',_0x4307('0x3'),'timeout',_0x4307('0x4')],'include':[{'model':'User','as':_0x4307('0x5'),'attributes':['id',_0x4307('0x3'),'online',_0x4307('0x6')]}]},'log':_0x4307('0x7')});};}; \ No newline at end of file +var _0xe132=['Agents','getChatQueues','../client','Request','GetChatQueue','name','timeout','strategy'];(function(_0x310858,_0x1624ae){var _0xf02380=function(_0x19301d){while(--_0x19301d){_0x310858['push'](_0x310858['shift']());}};_0xf02380(++_0x1624ae);}(_0xe132,0x162));var _0x2e13=function(_0x30f033,_0x34d742){_0x30f033=_0x30f033-0x0;var _0x2277eb=_0xe132[_0x30f033];return _0x2277eb;};'use strict';var client=require(_0x2e13('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x2e13('0x1')](_0x2e13('0x2'),{'options':{'raw':![],'attributes':['id',_0x2e13('0x3'),_0x2e13('0x4'),_0x2e13('0x5')],'include':[{'model':'User','as':_0x2e13('0x6'),'attributes':['id',_0x2e13('0x3'),'online','chatPause']}]},'log':_0x2e13('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5bed97e..bbe36e9 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 _0xfd28=['update','UpdateChatQueueReport','DESC','create','CreateChatQueueReport'];(function(_0x2a801b,_0x1b44d3){var _0x4bba0b=function(_0x4794a7){while(--_0x4794a7){_0x2a801b['push'](_0x2a801b['shift']());}};_0x4bba0b(++_0x1b44d3);}(_0xfd28,0x148));var _0x8fd2=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xfd28[_0x101e7b];return _0x4995c0;};'use strict';var client=require('../client');exports[_0x8fd2('0x0')]=function(_0x117219){return client['Request'](_0x8fd2('0x1'),{'body':_0x117219,'log':'CreateChatQueueReport'});};exports[_0x8fd2('0x2')]=function(_0xf7417d,_0x4e2108){return client['Request'](_0x8fd2('0x3'),{'body':_0x4e2108,'options':{'where':{'uniqueid':_0xf7417d},'order':[['id',_0x8fd2('0x4')]],'limit':0x1},'log':_0x8fd2('0x3')});}; \ No newline at end of file +var _0xee11=['UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0x1fc904,_0x1091f3){var _0x1d4913=function(_0x5b7e7b){while(--_0x5b7e7b){_0x1fc904['push'](_0x1fc904['shift']());}};_0x1d4913(++_0x1091f3);}(_0xee11,0x146));var _0x1ee1=function(_0x364048,_0x34dea3){_0x364048=_0x364048-0x0;var _0x591678=_0xee11[_0x364048];return _0x591678;};'use strict';var client=require(_0x1ee1('0x0'));exports['create']=function(_0x4e1a0d){return client[_0x1ee1('0x1')](_0x1ee1('0x2'),{'body':_0x4e1a0d,'log':_0x1ee1('0x2')});};exports[_0x1ee1('0x3')]=function(_0x2a94ef,_0x14d420){return client[_0x1ee1('0x1')](_0x1ee1('0x4'),{'body':_0x14d420,'options':{'where':{'uniqueid':_0x2a94ef},'order':[['id','DESC']],'limit':0x1},'log':_0x1ee1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0a5ab2b..1ff39ca 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x344f15,_0x7aac9d){var _0x53e29d=function(_0x12eeeb){while(--_0x12eeeb){_0x344f15['push'](_0x344f15['shift']());}};_0x53e29d(++_0x7aac9d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x7a54,0x106));var _0x47a5=function(_0x2964e2,_0x2c5728){_0x2964e2=_0x2964e2-0x0;var _0x500650=_0x7a54[_0x2964e2];return _0x500650;};'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 e303aee..21a7374 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 _0x07cf=['../client','create','createFaxMessage'];(function(_0x7122b5,_0x79ed62){var _0x30e0a5=function(_0x393040){while(--_0x393040){_0x7122b5['push'](_0x7122b5['shift']());}};_0x30e0a5(++_0x79ed62);}(_0x07cf,0x129));var _0xf07c=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0x07cf[_0x34eb31];return _0x254994;};'use strict';var client=require(_0xf07c('0x0'));exports[_0xf07c('0x1')]=function(_0x42b033){return client['Request']('CreateFaxMessage',{'body':_0x42b033,'log':_0xf07c('0x2')});}; \ No newline at end of file +var _0xe2df=['createFaxMessage','../client','create','CreateFaxMessage'];(function(_0x102e37,_0x14a181){var _0x35a07c=function(_0x16577f){while(--_0x16577f){_0x102e37['push'](_0x102e37['shift']());}};_0x35a07c(++_0x14a181);}(_0xe2df,0xdd));var _0xfe2d=function(_0x4804e5,_0x42ce4e){_0x4804e5=_0x4804e5-0x0;var _0x4a0c81=_0xe2df[_0x4804e5];return _0x4a0c81;};'use strict';var client=require(_0xfe2d('0x0'));exports[_0xfe2d('0x1')]=function(_0x6b2abf){return client['Request'](_0xfe2d('0x2'),{'body':_0x6b2abf,'log':_0xfe2d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 14e79bc..e3f82cf 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 _0xb0c1=['../client','getFaxQueues','Request','name','timeout','strategy','User','online','faxPause'];(function(_0x3cae69,_0x233c38){var _0x3128eb=function(_0x21d64e){while(--_0x21d64e){_0x3cae69['push'](_0x3cae69['shift']());}};_0x3128eb(++_0x233c38);}(_0xb0c1,0x195));var _0x1b0c=function(_0x4942b4,_0xd983ff){_0x4942b4=_0x4942b4-0x0;var _0x39986e=_0xb0c1[_0x4942b4];return _0x39986e;};'use strict';var client=require(_0x1b0c('0x0'));exports[_0x1b0c('0x1')]=function(){return function(){return client[_0x1b0c('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x1b0c('0x3'),_0x1b0c('0x4'),_0x1b0c('0x5')],'include':[{'model':_0x1b0c('0x6'),'as':'Agents','attributes':['id',_0x1b0c('0x3'),_0x1b0c('0x7'),_0x1b0c('0x8')]}]},'log':_0x1b0c('0x1')});};}; \ No newline at end of file +var _0xa4bd=['GetFaxQueue','timeout','strategy','User','Agents','name','faxPause','../client','getFaxQueues','Request'];(function(_0x637191,_0x52ed3f){var _0x3eafc3=function(_0x3ffd79){while(--_0x3ffd79){_0x637191['push'](_0x637191['shift']());}};_0x3eafc3(++_0x52ed3f);}(_0xa4bd,0x7f));var _0xda4b=function(_0x3cf9a3,_0x32bff4){_0x3cf9a3=_0x3cf9a3-0x0;var _0x343ba0=_0xa4bd[_0x3cf9a3];return _0x343ba0;};'use strict';var client=require(_0xda4b('0x0'));exports[_0xda4b('0x1')]=function(){return function(){return client[_0xda4b('0x2')](_0xda4b('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xda4b('0x4'),_0xda4b('0x5')],'include':[{'model':_0xda4b('0x6'),'as':_0xda4b('0x7'),'attributes':['id',_0xda4b('0x8'),'online',_0xda4b('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3654b9c..060403d 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 _0x9324=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0x575de5,_0x179f6a){var _0x1615db=function(_0x825b0a){while(--_0x825b0a){_0x575de5['push'](_0x575de5['shift']());}};_0x1615db(++_0x179f6a);}(_0x9324,0x1ea));var _0x4932=function(_0x566155,_0x275b7a){_0x566155=_0x566155-0x0;var _0x326b28=_0x9324[_0x566155];return _0x326b28;};'use strict';var client=require('../client');exports[_0x4932('0x0')]=function(_0x276110){return client[_0x4932('0x1')](_0x4932('0x2'),{'body':_0x276110,'log':_0x4932('0x2')});};exports[_0x4932('0x3')]=function(_0x4052f9,_0x187eff){return client[_0x4932('0x1')](_0x4932('0x4'),{'body':_0x187eff,'options':{'where':{'uniqueid':_0x4052f9},'order':[['id',_0x4932('0x5')]],'limit':0x1},'log':_0x4932('0x4')});}; \ No newline at end of file +var _0xa789=['DESC','../client','create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x37a2ac,_0x15ff2f){var _0x4fa616=function(_0x4a396d){while(--_0x4a396d){_0x37a2ac['push'](_0x37a2ac['shift']());}};_0x4fa616(++_0x15ff2f);}(_0xa789,0x8d));var _0x9a78=function(_0x184b46,_0x1102bb){_0x184b46=_0x184b46-0x0;var _0x142d55=_0xa789[_0x184b46];return _0x142d55;};'use strict';var client=require(_0x9a78('0x0'));exports[_0x9a78('0x1')]=function(_0x96ea09){return client[_0x9a78('0x2')](_0x9a78('0x3'),{'body':_0x96ea09,'log':_0x9a78('0x3')});};exports[_0x9a78('0x4')]=function(_0x44488f,_0xcae052){return client[_0x9a78('0x2')](_0x9a78('0x5'),{'body':_0xcae052,'options':{'where':{'uniqueid':_0x44488f},'order':[['id',_0x9a78('0x6')]],'limit':0x1},'log':_0x9a78('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index d39800e..e98dcc8 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 _0x5805=['name','interval','getIntervals','GetInterval'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x5805,0x1ae));var _0x5580=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5805[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0x5580('0x0')]=function(){return function(){return client['Request'](_0x5580('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5580('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x5580('0x2'),_0x5580('0x3')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x33b6=['getIntervals','GetInterval','name','Interval','../client'];(function(_0x5358cd,_0x293fd6){var _0xc144e2=function(_0x18c1fc){while(--_0x18c1fc){_0x5358cd['push'](_0x5358cd['shift']());}};_0xc144e2(++_0x293fd6);}(_0x33b6,0x7c));var _0x633b=function(_0x2de0a7,_0x38d3e7){_0x2de0a7=_0x2de0a7-0x0;var _0x429437=_0x33b6[_0x2de0a7];return _0x429437;};'use strict';var client=require(_0x633b('0x0'));exports[_0x633b('0x1')]=function(){return function(){return client['Request'](_0x633b('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x633b('0x3')],'include':[{'model':_0x633b('0x4'),'as':'Intervals','attributes':['id',_0x633b('0x3'),'interval']}]},'log':_0x633b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index f936c6c..daae0af 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 _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x2b1310,_0x142e96){_0x2b1310=_0x2b1310-0x0;var _0x122b26=_0xdd4f[_0x2b1310];return _0x122b26;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file +var _0x4325=['update','Request','UpdateMailInteraction','addTagsToChatInteraction','../client'];(function(_0x94e30a,_0x4a6cde){var _0xef4d47=function(_0xb98c4b){while(--_0xb98c4b){_0x94e30a['push'](_0x94e30a['shift']());}};_0xef4d47(++_0x4a6cde);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5432('0x0'));exports[_0x5432('0x1')]=function(_0x5aa4b8,_0x3f491f){return client[_0x5432('0x2')](_0x5432('0x3'),{'body':_0x3f491f,'options':{'where':{'id':_0x5aa4b8}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x20f704,_0x36ce53){return client[_0x5432('0x2')]('AddTagsToMailInteraction',{'body':_0x36ce53,'options':{'where':{'id':_0x20f704}},'log':_0x5432('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 34257d8..b84c08c 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 _0xcbf3=['createMailMessage','../client','Request','CreateMailMessage'];(function(_0x12314f,_0x2ac7ae){var _0x3b6e61=function(_0x2b41b5){while(--_0x2b41b5){_0x12314f['push'](_0x12314f['shift']());}};_0x3b6e61(++_0x2ac7ae);}(_0xcbf3,0x1a9));var _0x3cbf=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xcbf3[_0x17928f];return _0x500b63;};'use strict';var client=require(_0x3cbf('0x0'));exports['create']=function(_0x3505ad){return client[_0x3cbf('0x1')](_0x3cbf('0x2'),{'body':_0x3505ad,'log':_0x3cbf('0x3')});}; \ No newline at end of file +var _0x1013=['../client','Request','CreateMailMessage','createMailMessage'];(function(_0x4d62b2,_0x493e66){var _0x5b909c=function(_0x36cd69){while(--_0x36cd69){_0x4d62b2['push'](_0x4d62b2['shift']());}};_0x5b909c(++_0x493e66);}(_0x1013,0x64));var _0x3101=function(_0x3f52b6,_0x5d3de7){_0x3f52b6=_0x3f52b6-0x0;var _0x326635=_0x1013[_0x3f52b6];return _0x326635;};'use strict';var client=require(_0x3101('0x0'));exports['create']=function(_0x4f9396){return client[_0x3101('0x1')](_0x3101('0x2'),{'body':_0x4f9396,'log':_0x3101('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 02bf40e..c04f0e9 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 _0x0cf7=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','online','mailPause','../client'];(function(_0x2c65e2,_0x518e3a){var _0x4df129=function(_0x550137){while(--_0x550137){_0x2c65e2['push'](_0x2c65e2['shift']());}};_0x4df129(++_0x518e3a);}(_0x0cf7,0x1c1));var _0x70cf=function(_0x4a698e,_0x440a1a){_0x4a698e=_0x4a698e-0x0;var _0x534f44=_0x0cf7[_0x4a698e];return _0x534f44;};'use strict';var client=require(_0x70cf('0x0'));exports[_0x70cf('0x1')]=function(){return function(){return client[_0x70cf('0x2')](_0x70cf('0x3'),{'options':{'raw':![],'attributes':['id',_0x70cf('0x4'),_0x70cf('0x5'),_0x70cf('0x6')],'include':[{'model':_0x70cf('0x7'),'as':'Agents','attributes':['id',_0x70cf('0x4'),_0x70cf('0x8'),_0x70cf('0x9')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x4476=['../client','Request','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x24a3e5,_0x599de5){var _0x23f2cd=function(_0x372b7a){while(--_0x372b7a){_0x24a3e5['push'](_0x24a3e5['shift']());}};_0x23f2cd(++_0x599de5);}(_0x4476,0xab));var _0x6447=function(_0x39d4b5,_0x5735fb){_0x39d4b5=_0x39d4b5-0x0;var _0x3516f1=_0x4476[_0x39d4b5];return _0x3516f1;};'use strict';var client=require(_0x6447('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x6447('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x6447('0x2'),_0x6447('0x3'),_0x6447('0x4')],'include':[{'model':_0x6447('0x5'),'as':_0x6447('0x6'),'attributes':['id',_0x6447('0x2'),_0x6447('0x7'),_0x6447('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 1475b4d..196ee25 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 _0xb534=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x5d0342,_0x15776f){var _0x1f0390=function(_0x1e7415){while(--_0x1e7415){_0x5d0342['push'](_0x5d0342['shift']());}};_0x1f0390(++_0x15776f);}(_0xb534,0xb5));var _0x4b53=function(_0x5da160,_0x1e2c32){_0x5da160=_0x5da160-0x0;var _0x4aa800=_0xb534[_0x5da160];return _0x4aa800;};'use strict';var client=require(_0x4b53('0x0'));exports[_0x4b53('0x1')]=function(_0x17aed6){return client[_0x4b53('0x2')](_0x4b53('0x3'),{'body':_0x17aed6,'log':_0x4b53('0x3')});};exports[_0x4b53('0x4')]=function(_0x47e98d,_0xd5b9da){return client[_0x4b53('0x2')](_0x4b53('0x5'),{'body':_0xd5b9da,'options':{'where':{'uniqueid':_0x47e98d},'order':[['id',_0x4b53('0x6')]],'limit':0x1},'log':_0x4b53('0x5')});}; \ No newline at end of file +var _0x3070=['../client','create','CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport'];(function(_0x298344,_0x27e785){var _0x2c4de7=function(_0x338e1d){while(--_0x338e1d){_0x298344['push'](_0x298344['shift']());}};_0x2c4de7(++_0x27e785);}(_0x3070,0x1d5));var _0x0307=function(_0x55b208,_0xbb5699){_0x55b208=_0x55b208-0x0;var _0x2fd9f3=_0x3070[_0x55b208];return _0x2fd9f3;};'use strict';var client=require(_0x0307('0x0'));exports[_0x0307('0x1')]=function(_0x581506){return client['Request'](_0x0307('0x2'),{'body':_0x581506,'log':_0x0307('0x2')});};exports[_0x0307('0x3')]=function(_0x32262a,_0x526e81){return client[_0x0307('0x4')]('UpdateMailQueueReport',{'body':_0x526e81,'options':{'where':{'uniqueid':_0x32262a},'order':[['id',_0x0307('0x5')]],'limit':0x1},'log':_0x0307('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c92ecf6..0a7d667 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 _0x2e48=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client'];(function(_0x55a389,_0x3cf135){var _0x4aa7a3=function(_0x793645){while(--_0x793645){_0x55a389['push'](_0x55a389['shift']());}};_0x4aa7a3(++_0x3cf135);}(_0x2e48,0xc3));var _0x82e4=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2e48[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x82e4('0x0'));exports[_0x82e4('0x1')]=function(_0x2307a9,_0x34cf6f){return client['Request'](_0x82e4('0x2'),{'body':_0x34cf6f,'options':{'where':{'id':_0x2307a9}},'log':_0x82e4('0x3')});};exports['addTags']=function(_0x36ebbe,_0x9ac632){return client[_0x82e4('0x4')](_0x82e4('0x5'),{'body':_0x9ac632,'options':{'where':{'id':_0x36ebbe}},'log':_0x82e4('0x6')});}; \ No newline at end of file +var _0x7e90=['addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction'];(function(_0x287813,_0x29dbb5){var _0x579ed6=function(_0x298e61){while(--_0x298e61){_0x287813['push'](_0x287813['shift']());}};_0x579ed6(++_0x29dbb5);}(_0x7e90,0xc1));var _0x07e9=function(_0x43b881,_0x521280){_0x43b881=_0x43b881-0x0;var _0x2112ee=_0x7e90[_0x43b881];return _0x2112ee;};'use strict';var client=require(_0x07e9('0x0'));exports['update']=function(_0x44731f,_0x4e9314){return client[_0x07e9('0x1')]('UpdateOpenchannelInteraction',{'body':_0x4e9314,'options':{'where':{'id':_0x44731f}},'log':_0x07e9('0x2')});};exports[_0x07e9('0x3')]=function(_0x59d3f4,_0x596f13){return client[_0x07e9('0x1')](_0x07e9('0x4'),{'body':_0x596f13,'options':{'where':{'id':_0x59d3f4}},'log':_0x07e9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index db1ce42..b5d3675 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 _0xbed3=['create','createOpenchannelMessage','../client'];(function(_0x50450d,_0x314c15){var _0x1c391b=function(_0x3d5c86){while(--_0x3d5c86){_0x50450d['push'](_0x50450d['shift']());}};_0x1c391b(++_0x314c15);}(_0xbed3,0x1df));var _0x3bed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbed3[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x3bed('0x0'));exports[_0x3bed('0x1')]=function(_0x5a0b60){return client['Request']('CreateOpenchannelMessage',{'body':_0x5a0b60,'log':_0x3bed('0x2')});}; \ No newline at end of file +var _0x4d72=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x2b07a1,_0x25c79a){var _0x4bb96b=function(_0xcd3208){while(--_0xcd3208){_0x2b07a1['push'](_0x2b07a1['shift']());}};_0x4bb96b(++_0x25c79a);}(_0x4d72,0xbf));var _0x24d7=function(_0x523a7d,_0xfd5bbc){_0x523a7d=_0x523a7d-0x0;var _0x4ab3ca=_0x4d72[_0x523a7d];return _0x4ab3ca;};'use strict';var client=require(_0x24d7('0x0'));exports[_0x24d7('0x1')]=function(_0x5dcfa2){return client[_0x24d7('0x2')](_0x24d7('0x3'),{'body':_0x5dcfa2,'log':_0x24d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 7914990..2a7bd2b 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 _0x3c52=['timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x1030ce,_0xbe3f74){var _0x3367fd=function(_0x387153){while(--_0x387153){_0x1030ce['push'](_0x1030ce['shift']());}};_0x3367fd(++_0xbe3f74);}(_0x3c52,0xa5));var _0x23c5=function(_0x226dda,_0x3732b7){_0x226dda=_0x226dda-0x0;var _0x57981e=_0x3c52[_0x226dda];return _0x57981e;};'use strict';var client=require(_0x23c5('0x0'));exports[_0x23c5('0x1')]=function(){return function(){return client[_0x23c5('0x2')](_0x23c5('0x3'),{'options':{'raw':![],'attributes':['id',_0x23c5('0x4'),_0x23c5('0x5'),_0x23c5('0x6')],'include':[{'model':'User','as':_0x23c5('0x7'),'attributes':['id',_0x23c5('0x4'),_0x23c5('0x8'),_0x23c5('0x9')]}]},'log':_0x23c5('0x1')});};}; \ No newline at end of file +var _0xba32=['strategy','Agents','name','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0xcecc,_0x236e61){var _0x231add=function(_0xe6553d){while(--_0xe6553d){_0xcecc['push'](_0xcecc['shift']());}};_0x231add(++_0x236e61);}(_0xba32,0x11d));var _0x2ba3=function(_0x516eb0,_0x2bf9ee){_0x516eb0=_0x516eb0-0x0;var _0x4a9a49=_0xba32[_0x516eb0];return _0x4a9a49;};'use strict';var client=require('../client');exports[_0x2ba3('0x0')]=function(){return function(){return client[_0x2ba3('0x1')](_0x2ba3('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x2ba3('0x3')],'include':[{'model':'User','as':_0x2ba3('0x4'),'attributes':['id',_0x2ba3('0x5'),_0x2ba3('0x6'),_0x2ba3('0x7')]}]},'log':_0x2ba3('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 7c08352..342dfbd 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 _0x765f=['DESC','create','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x765f,0x1b1));var _0xf765=function(_0x2939a6,_0x1c604f){_0x2939a6=_0x2939a6-0x0;var _0x143641=_0x765f[_0x2939a6];return _0x143641;};'use strict';var client=require('../client');exports[_0xf765('0x0')]=function(_0x312a00){return client['Request'](_0xf765('0x1'),{'body':_0x312a00,'log':_0xf765('0x1')});};exports['update']=function(_0x12a732,_0x1425cd){return client['Request'](_0xf765('0x2'),{'body':_0x1425cd,'options':{'where':{'uniqueid':_0x12a732},'order':[['id',_0xf765('0x3')]],'limit':0x1},'log':_0xf765('0x2')});}; \ No newline at end of file +var _0xd562=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create','Request'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xd562,0x165));var _0x2d56=function(_0x1e2ffd,_0x41e842){_0x1e2ffd=_0x1e2ffd-0x0;var _0x181aa9=_0xd562[_0x1e2ffd];return _0x181aa9;};'use strict';var client=require(_0x2d56('0x0'));exports[_0x2d56('0x1')]=function(_0x4ccfb5){return client[_0x2d56('0x2')](_0x2d56('0x3'),{'body':_0x4ccfb5,'log':_0x2d56('0x3')});};exports['update']=function(_0x4a9661,_0x331e58){return client[_0x2d56('0x2')](_0x2d56('0x4'),{'body':_0x331e58,'options':{'where':{'uniqueid':_0x4a9661},'order':[['id',_0x2d56('0x5')]],'limit':0x1},'log':_0x2d56('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index ab9019d..ead6cdd 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 _0x2fed=['Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x400635,_0x49a764){var _0x5b0c61=function(_0x2cb18a){while(--_0x2cb18a){_0x400635['push'](_0x400635['shift']());}};_0x5b0c61(++_0x49a764);}(_0x2fed,0x7c));var _0xd2fe=function(_0xe78084,_0x13d65b){_0xe78084=_0xe78084-0x0;var _0x15ffc3=_0x2fed[_0xe78084];return _0x15ffc3;};'use strict';var client=require(_0xd2fe('0x0'));exports[_0xd2fe('0x1')]=function(_0x35bf53,_0x1f0e53){return client[_0xd2fe('0x2')]('UpdateSmsInteraction',{'body':_0x1f0e53,'options':{'where':{'id':_0x35bf53}},'log':_0xd2fe('0x3')});};exports[_0xd2fe('0x4')]=function(_0x48707a,_0x58f3f8){return client[_0xd2fe('0x2')](_0xd2fe('0x5'),{'body':_0x58f3f8,'options':{'where':{'id':_0x48707a}},'log':_0xd2fe('0x6')});}; \ No newline at end of file +var _0xc5c7=['addTagsToSmsInteraction','update','Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x436afe,_0x1e33b5){_0x436afe=_0x436afe-0x0;var _0x14b916=_0xc5c7[_0x436afe];return _0x14b916;};'use strict';var client=require('../client');exports[_0x7c5c('0x0')]=function(_0x28e1a9,_0x2e1b3a){return client[_0x7c5c('0x1')](_0x7c5c('0x2'),{'body':_0x2e1b3a,'options':{'where':{'id':_0x28e1a9}},'log':_0x7c5c('0x3')});};exports['addTags']=function(_0xff325e,_0x2b4355){return client[_0x7c5c('0x1')](_0x7c5c('0x4'),{'body':_0x2b4355,'options':{'where':{'id':_0xff325e}},'log':_0x7c5c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 511e9ac..d274683 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 _0xee3c=['createSmsMessage','create','CreateSmsMessage'];(function(_0x57a8bf,_0x40090d){var _0x568ef4=function(_0x457c6a){while(--_0x457c6a){_0x57a8bf['push'](_0x57a8bf['shift']());}};_0x568ef4(++_0x40090d);}(_0xee3c,0x10c));var _0xcee3=function(_0x1eea0a,_0x3a0c52){_0x1eea0a=_0x1eea0a-0x0;var _0x27379f=_0xee3c[_0x1eea0a];return _0x27379f;};'use strict';var client=require('../client');exports[_0xcee3('0x0')]=function(_0x112500){return client['Request'](_0xcee3('0x1'),{'body':_0x112500,'log':_0xcee3('0x2')});}; \ No newline at end of file +var _0x9382=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x7d974d,_0x122cfd){var _0xa0ec59=function(_0x544b81){while(--_0x544b81){_0x7d974d['push'](_0x7d974d['shift']());}};_0xa0ec59(++_0x122cfd);}(_0x9382,0x1e0));var _0x2938=function(_0x1cef6c,_0x22752b){_0x1cef6c=_0x1cef6c-0x0;var _0x373c83=_0x9382[_0x1cef6c];return _0x373c83;};'use strict';var client=require(_0x2938('0x0'));exports[_0x2938('0x1')]=function(_0x26b7e3){return client[_0x2938('0x2')](_0x2938('0x3'),{'body':_0x26b7e3,'log':_0x2938('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index adc3989..e1e8c32 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x555be0,_0x10b9e1){var _0x214b97=function(_0x22fa25){while(--_0x22fa25){_0x555be0['push'](_0x555be0['shift']());}};_0x214b97(++_0x10b9e1);}(_0xe706,0xa3));var _0x6e70=function(_0x9cf14e,_0x57d04f){_0x9cf14e=_0x9cf14e-0x0;var _0x14877a=_0xe706[_0x9cf14e];return _0x14877a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x161581,_0x22a6bb){var _0x159089=function(_0x227164){while(--_0x227164){_0x161581['push'](_0x161581['shift']());}};_0x159089(++_0x22a6bb);}(_0x70e0,0x17b));var _0x070e=function(_0x3d67a1,_0x130173){_0x3d67a1=_0x3d67a1-0x0;var _0x268ad6=_0x70e0[_0x3d67a1];return _0x268ad6;};'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 4ba6fda..ff34172 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../client','create','CreateSmsQueueReport','update','Request','UpdateSmsQueueReport','DESC'];(function(_0x59998e,_0x82e455){var _0x10811f=function(_0x3a77a6){while(--_0x3a77a6){_0x59998e['push'](_0x59998e['shift']());}};_0x10811f(++_0x82e455);}(_0x55ca,0x126));var _0xa55c=function(_0x243f79,_0x429e45){_0x243f79=_0x243f79-0x0;var _0x460321=_0x55ca[_0x243f79];return _0x460321;};'use strict';var client=require(_0xa55c('0x0'));exports[_0xa55c('0x1')]=function(_0x4e78b4){return client['Request']('CreateSmsQueueReport',{'body':_0x4e78b4,'log':_0xa55c('0x2')});};exports[_0xa55c('0x3')]=function(_0x5dc716,_0x3b478a){return client[_0xa55c('0x4')](_0xa55c('0x5'),{'body':_0x3b478a,'options':{'where':{'uniqueid':_0x5dc716},'order':[['id',_0xa55c('0x6')]],'limit':0x1},'log':_0xa55c('0x5')});}; \ No newline at end of file +var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x556d3d,_0x11b936){var _0x3d134c=function(_0x522f52){while(--_0x522f52){_0x556d3d['push'](_0x556d3d['shift']());}};_0x3d134c(++_0x11b936);}(_0x70e0,0x17b));var _0x070e=function(_0x32295a,_0x5d2f04){_0x32295a=_0x32295a-0x0;var _0x17622d=_0x70e0[_0x32295a];return _0x17622d;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2946f14..f5e0631 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(_0x1e90f8,_0x5916b5){var _0x1faff6=function(_0x2d6abb){while(--_0x2d6abb){_0x1e90f8['push'](_0x1e90f8['shift']());}};_0x1faff6(++_0x5916b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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(_0x5c12ff,_0x15b05a){var _0x57636f=function(_0x1f6a87){while(--_0x1f6a87){_0x5c12ff['push'](_0x5c12ff['shift']());}};_0x57636f(++_0x15b05a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 2626e9f..43bd6a3 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 _0x7bd0=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x26d153,_0x1b92bd){var _0x57941b=function(_0x584f19){while(--_0x584f19){_0x26d153['push'](_0x26d153['shift']());}};_0x57941b(++_0x1b92bd);}(_0x7bd0,0x111));var _0x07bd=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x7bd0[_0x2bc1fe];return _0x1a47a5;};'use strict';var client=require(_0x07bd('0x0'));exports[_0x07bd('0x1')]=function(_0x20836d,_0x3b79f2){return client[_0x07bd('0x2')](_0x07bd('0x3'),{'body':_0x3b79f2,'options':{'where':{'id':_0x20836d}},'log':_0x07bd('0x4')});};exports[_0x07bd('0x5')]=function(_0x5beba7,_0x2d7245){return client[_0x07bd('0x2')](_0x07bd('0x6'),{'body':_0x2d7245,'options':{'where':{'id':_0x5beba7}},'log':_0x07bd('0x7')});}; \ No newline at end of file +var _0x68fd=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client'];(function(_0x1757c8,_0x4aa781){var _0x3059f1=function(_0xb9d7f){while(--_0xb9d7f){_0x1757c8['push'](_0x1757c8['shift']());}};_0x3059f1(++_0x4aa781);}(_0x68fd,0x1e9));var _0xd68f=function(_0x405d6a,_0x5f5872){_0x405d6a=_0x405d6a-0x0;var _0x226b66=_0x68fd[_0x405d6a];return _0x226b66;};'use strict';var client=require(_0xd68f('0x0'));exports['update']=function(_0x17591d,_0x1492a9){return client['Request'](_0xd68f('0x1'),{'body':_0x1492a9,'options':{'where':{'id':_0x17591d}},'log':_0xd68f('0x2')});};exports[_0xd68f('0x3')]=function(_0x3e5e78,_0x37c481){return client[_0xd68f('0x4')](_0xd68f('0x5'),{'body':_0x37c481,'options':{'where':{'id':_0x3e5e78}},'log':_0xd68f('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 482a4b2..3033e65 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 _0x7909=['CreateWhatsappMessage','../client','Request'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0x7909,0x76));var _0x9790=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7909[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x9790('0x0'));exports['create']=function(_0x48fe5f){return client[_0x9790('0x1')](_0x9790('0x2'),{'body':_0x48fe5f,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xb7e2=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x5d98e4,_0x377619){var _0x36157d=function(_0x1b39fd){while(--_0x1b39fd){_0x5d98e4['push'](_0x5d98e4['shift']());}};_0x36157d(++_0x377619);}(_0xb7e2,0x8d));var _0x2b7e=function(_0x1239a5,_0x11cf9e){_0x1239a5=_0x1239a5-0x0;var _0xbd8808=_0xb7e2[_0x1239a5];return _0xbd8808;};'use strict';var client=require(_0x2b7e('0x0'));exports[_0x2b7e('0x1')]=function(_0x526211){return client[_0x2b7e('0x2')](_0x2b7e('0x3'),{'body':_0x526211,'log':_0x2b7e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 401afce..fac3111 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 _0x5f51=['online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','timeout','Agents','name'];(function(_0x4f9171,_0x5431d7){var _0xa7c96a=function(_0x140726){while(--_0x140726){_0x4f9171['push'](_0x4f9171['shift']());}};_0xa7c96a(++_0x5431d7);}(_0x5f51,0x1c4));var _0x15f5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x5f51[_0x6c993a];return _0x27f547;};'use strict';var client=require(_0x15f5('0x0'));exports[_0x15f5('0x1')]=function(){return function(){return client[_0x15f5('0x2')](_0x15f5('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x15f5('0x4'),'strategy'],'include':[{'model':'User','as':_0x15f5('0x5'),'attributes':['id',_0x15f5('0x6'),_0x15f5('0x7'),_0x15f5('0x8')]}]},'log':_0x15f5('0x1')});};}; \ No newline at end of file +var _0x3311=['Request','GetWhatsappQueue','timeout','strategy','User','name','online','../client','getWhatsappQueues'];(function(_0x2eb484,_0x7d7b55){var _0x195fcb=function(_0x261031){while(--_0x261031){_0x2eb484['push'](_0x2eb484['shift']());}};_0x195fcb(++_0x7d7b55);}(_0x3311,0x18a));var _0x1331=function(_0xee87f8,_0x40dd0b){_0xee87f8=_0xee87f8-0x0;var _0x255ce3=_0x3311[_0xee87f8];return _0x255ce3;};'use strict';var client=require(_0x1331('0x0'));exports[_0x1331('0x1')]=function(){return function(){return client[_0x1331('0x2')](_0x1331('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x1331('0x4'),_0x1331('0x5')],'include':[{'model':_0x1331('0x6'),'as':'Agents','attributes':['id',_0x1331('0x7'),_0x1331('0x8'),'whatsappPause']}]},'log':_0x1331('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1a5250b..7969a33 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 _0x6495=['update','UpdateWhatsappQueueReport','DESC','../client','Request','CreateWhatsappQueueReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6495,0x177));var _0x5649=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6495[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x5649('0x0'));exports['create']=function(_0xa7a116){return client[_0x5649('0x1')](_0x5649('0x2'),{'body':_0xa7a116,'log':_0x5649('0x2')});};exports[_0x5649('0x3')]=function(_0x2f3df9,_0x57761f){return client[_0x5649('0x1')](_0x5649('0x4'),{'body':_0x57761f,'options':{'where':{'uniqueid':_0x2f3df9},'order':[['id',_0x5649('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xcb17=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC'];(function(_0x262fea,_0x56aa24){var _0xeb4410=function(_0x2ed150){while(--_0x2ed150){_0x262fea['push'](_0x262fea['shift']());}};_0xeb4410(++_0x56aa24);}(_0xcb17,0x1a4));var _0x7cb1=function(_0x20f559,_0x42e033){_0x20f559=_0x20f559-0x0;var _0x4e98e8=_0xcb17[_0x20f559];return _0x4e98e8;};'use strict';var client=require('../client');exports[_0x7cb1('0x0')]=function(_0x597d63){return client[_0x7cb1('0x1')](_0x7cb1('0x2'),{'body':_0x597d63,'log':_0x7cb1('0x2')});};exports[_0x7cb1('0x3')]=function(_0x7ec616,_0x2aba1f){return client[_0x7cb1('0x1')](_0x7cb1('0x4'),{'body':_0x2aba1f,'options':{'where':{'uniqueid':_0x7ec616},'order':[['id',_0x7cb1('0x5')]],'limit':0x1},'log':_0x7cb1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 9a99df4..e120289 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 _0x5c3b=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c3b,0x1aa));var _0xb5c3=function(_0x5d942e,_0x15a6f0){_0x5d942e=_0x5d942e-0x0;var _0x1549f9=_0x5c3b[_0x5d942e];return _0x1549f9;};'use strict';var schema=require(_0xb5c3('0x0'));var _=require(_0xb5c3('0x1'));var util=require(_0xb5c3('0x2'));var seqqueue=require(_0xb5c3('0x3'));var logger=require(_0xb5c3('0x4'))('routing');var strategy=require(_0xb5c3('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xb5c3('0x6')},'timeout':{'type':_0xb5c3('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x273361,_0x5ee01a,_0xf7fab8){return logger[_0xb5c3('0x8')](util[_0xb5c3('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x273361,_0x5ee01a[_0xb5c3('0xa')],_0xf7fab8));}function handleFindAgent(_0x33172e){return function(_0x5f15bb){return _0x5f15bb['name'][_0xb5c3('0xb')]()===_0x33172e['toLowerCase']();};}exports[_0xb5c3('0xc')]=function(_0xe691,_0x9da8f1,_0x38ad69,_0x9f2f1d){return function(_0x49ad62){try{var _0x23d5df={'name':_0x9da8f1[0x0],'timeout':_0x9da8f1[0x1]};var _0x2e35a3=queue['validate'](_0x23d5df,{'typecast':!![]});if(_0x2e35a3['length']){logger[_0xb5c3('0xd')](_0xb5c3('0xe'),_0xe691,_[_0xb5c3('0xf')](_0x2e35a3,'message')[_0xb5c3('0x10')](',\x20'));_0x49ad62[_0xb5c3('0x11')]();}else{var _0x41439b=_[_0xb5c3('0x12')](_0x38ad69[_0xb5c3('0x13')],handleFindAgent(_0x23d5df['name']));if(_0x41439b){var _0x4b31db=(_0x23d5df[_0xb5c3('0x14')]||0xa)*0x3e8;var _0x4a6b44,_0x31fcef;var _0x22eb2b=seqqueue[_0xb5c3('0x15')](_0x4b31db);_0x22eb2b['id']=_0xe691;_0x22eb2b[_0xb5c3('0x16')]=_0x4b31db;_0x22eb2b[_0xb5c3('0x17')]=_0x9f2f1d[_0xb5c3('0x17')];writeLog(_0xe691,_0x41439b,util[_0xb5c3('0x9')]('START:%s',_0x4b31db));_0x38ad69[_0xb5c3('0x18')][_0xe691]['on'](_0xb5c3('0x19'),function(){logger[_0xb5c3('0x8')](_0xb5c3('0x1a'),_0xe691);clearTimeout(_0x31fcef);_0x31fcef=undefined;_0x22eb2b[_0xb5c3('0x1b')]();if(_0x38ad69['rules'][_0xe691]){delete _0x38ad69[_0xb5c3('0x18')][_0xe691];}_0x49ad62[_0xb5c3('0x11')]();});_0x38ad69[_0xb5c3('0x18')][_0xe691]['on'](_0xb5c3('0x1c'),function(){if(_0x38ad69[_0xb5c3('0x18')][_0xe691]){delete _0x38ad69[_0xb5c3('0x18')][_0xe691];}});_0x31fcef=setTimeout(function(){logger[_0xb5c3('0x8')](_0xb5c3('0x1d'),_0xe691);clearTimeout(_0x31fcef);_0x22eb2b[_0xb5c3('0x1b')]();_0x49ad62[_0xb5c3('0x1e')]();},_0x4b31db);strategy[_0xb5c3('0x1f')](_0x22eb2b,_0x41439b,_0x38ad69,_0x9f2f1d);}else{logger[_0xb5c3('0xd')](_0xb5c3('0x20'),_0xe691,_0x23d5df[_0xb5c3('0xa')]);_0x49ad62['stop']();}}}catch(_0x2285ca){console[_0xb5c3('0x21')](_0x2285ca);logger['error'](_0xb5c3('0x22'),_0xe691,_0x2285ca[_0xb5c3('0x23')]);_0x49ad62[_0xb5c3('0x11')]();}};}; \ No newline at end of file +var _0x496a=['./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','map','stop','find','agents','timeout','atimeout','channel','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util'];(function(_0x51259b,_0x3b4562){var _0x28debf=function(_0xd9b596){while(--_0xd9b596){_0x51259b['push'](_0x51259b['shift']());}};_0x28debf(++_0x3b4562);}(_0x496a,0xfe));var _0xa496=function(_0xfba19,_0x4079a9){_0xfba19=_0xfba19-0x0;var _0x3df4f3=_0x496a[_0xfba19];return _0x3df4f3;};'use strict';var schema=require('validate');var _=require(_0xa496('0x0'));var util=require(_0xa496('0x1'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0xa496('0x2'));var queue=schema({'name':{'type':_0xa496('0x3'),'required':!![],'message':_0xa496('0x4')},'timeout':{'type':_0xa496('0x5'),'message':_0xa496('0x6')}});function writeLog(_0x4d8992,_0x4a4493,_0x2a9685){return logger[_0xa496('0x7')](util[_0xa496('0x8')](_0xa496('0x9'),_0x4d8992,_0x4a4493[_0xa496('0xa')],_0x2a9685));}function handleFindAgent(_0x3567ac){return function(_0x414be6){return _0x414be6[_0xa496('0xa')][_0xa496('0xb')]()===_0x3567ac['toLowerCase']();};}exports[_0xa496('0xc')]=function(_0x134b94,_0xe3e43a,_0x5a2855,_0x577abc){return function(_0x42a892){try{var _0x1a0dd8={'name':_0xe3e43a[0x0],'timeout':_0xe3e43a[0x1]};var _0x50ef38=queue['validate'](_0x1a0dd8,{'typecast':!![]});if(_0x50ef38['length']){logger[_0xa496('0xd')](_0xa496('0xe'),_0x134b94,_[_0xa496('0xf')](_0x50ef38,'message')['join'](',\x20'));_0x42a892[_0xa496('0x10')]();}else{var _0x2854a7=_[_0xa496('0x11')](_0x5a2855[_0xa496('0x12')],handleFindAgent(_0x1a0dd8[_0xa496('0xa')]));if(_0x2854a7){var _0x2389fc=(_0x1a0dd8[_0xa496('0x13')]||0xa)*0x3e8;var _0x5f4607,_0x4be940;var _0x1fe26b=seqqueue['createQueue'](_0x2389fc);_0x1fe26b['id']=_0x134b94;_0x1fe26b[_0xa496('0x14')]=_0x2389fc;_0x1fe26b[_0xa496('0x15')]=_0x577abc[_0xa496('0x15')];writeLog(_0x134b94,_0x2854a7,util['format']('START:%s',_0x2389fc));_0x5a2855['rules'][_0x134b94]['on'](_0xa496('0x16'),function(){logger[_0xa496('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x134b94);clearTimeout(_0x4be940);_0x4be940=undefined;_0x1fe26b[_0xa496('0x17')]();if(_0x5a2855[_0xa496('0x18')][_0x134b94]){delete _0x5a2855[_0xa496('0x18')][_0x134b94];}_0x42a892[_0xa496('0x10')]();});_0x5a2855[_0xa496('0x18')][_0x134b94]['on'](_0xa496('0x19'),function(){if(_0x5a2855['rules'][_0x134b94]){delete _0x5a2855[_0xa496('0x18')][_0x134b94];}});_0x4be940=setTimeout(function(){logger[_0xa496('0x7')](_0xa496('0x1a'),_0x134b94);clearTimeout(_0x4be940);_0x1fe26b['close']();_0x42a892[_0xa496('0x1b')]();},_0x2389fc);strategy[_0xa496('0x1c')](_0x1fe26b,_0x2854a7,_0x5a2855,_0x577abc);}else{logger['error'](_0xa496('0x1d'),_0x134b94,_0x1a0dd8[_0xa496('0xa')]);_0x42a892[_0xa496('0x10')]();}}}catch(_0x2d0b61){console[_0xa496('0x1e')](_0x2d0b61);logger[_0xa496('0xd')]('[%s][QUEUE]\x20%s',_0x134b94,_0x2d0b61[_0xa496('0x1f')]);_0x42a892[_0xa496('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 109e163..31776a9 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 _0xe680=['../../rpc/faxMessage','consequence','interaction','UserId','info','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','providerName','amazonlex','providerResponse','Message','dialogState','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x7a68b,_0x964789){var _0x110d37=function(_0x482401){while(--_0x482401){_0x7a68b['push'](_0x7a68b['shift']());}};_0x110d37(++_0x964789);}(_0xe680,0x90));var _0x0e68=function(_0x4496c1,_0x103294){_0x4496c1=_0x4496c1-0x0;var _0xa2da11=_0xe680[_0x4496c1];return _0xa2da11;};'use strict';var _=require(_0x0e68('0x0'));var moment=require(_0x0e68('0x1'));var AWS=require(_0x0e68('0x2'));var utils=require('./utils');var logger=require(_0x0e68('0x3'))(_0x0e68('0x4'));var rpc={'chatMessage':require(_0x0e68('0x5')),'openchannelMessage':require(_0x0e68('0x6')),'mailMessage':require(_0x0e68('0x7')),'smsMessage':require(_0x0e68('0x8')),'faxMessage':require(_0x0e68('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0e68('0xa')]=function(_0x40428e,_0x4a3e0a){return function(_0x2772bb){try{if(!_['isNil'](this[_0x0e68('0xb')][_0x0e68('0xc')])){logger[_0x0e68('0xd')]('[%s][AMAZONLEX]\x20%s',_0x40428e,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x2772bb[_0x0e68('0xe')]();}var _0x19aa26={'ContactId':this[_0x0e68('0xf')]['id'],'sentAt':moment()[_0x0e68('0x10')](_0x0e68('0x11')),'direction':_0x0e68('0x12')};if(this['channel']==='sms'||this[_0x0e68('0x13')]===_0x0e68('0x14')){_0x19aa26[_0x0e68('0x15')]=this['interaction']['phone'];}var _0x4baae3=this[_0x0e68('0x13')];if(_0x4baae3===_0x0e68('0x16')){_0x19aa26[_0x0e68('0x17')]=this[_0x0e68('0x18')]['id'];}else{_0x19aa26[_[_0x0e68('0x19')](_0x4baae3)+_0x0e68('0x1a')]=this['account']['id'];}_0x19aa26[_[_0x0e68('0x19')](_0x4baae3)+_0x0e68('0x1b')]=this['interaction']['id'];if(this[_0x0e68('0xb')][_0x0e68('0x1c')]){var _0x3f71e9=_0x4a3e0a[0x4];if(!_[_0x0e68('0x1d')](_0x3f71e9)){_0x19aa26[_0x0e68('0x1e')]=utils['getMustacheRender'](_0x3f71e9,this);return rpc[_0x4baae3+'Message'][_0x0e68('0x1f')](_0x19aa26)[_0x0e68('0x20')](function(_0x34a8ff){logger[_0x0e68('0xd')](_0x0e68('0x21'),_0x40428e,_0x19aa26[_0x0e68('0x1e')]);})[_0x0e68('0x22')](function(_0x5d1bc3){logger[_0x0e68('0x23')]('[%s][AMAZONLEX]\x20%s',_0x40428e,JSON[_0x0e68('0x24')](_0x5d1bc3));})['finally'](function(){logger[_0x0e68('0xd')](_0x0e68('0x25'),_0x40428e);_0x2772bb[_0x0e68('0x26')]();});}else{logger[_0x0e68('0xd')](_0x0e68('0x27'),_0x40428e);_0x2772bb[_0x0e68('0x26')]();}}else{var _0xa483bc=this;var _0x26f274=new AWS[(_0x0e68('0x28'))]({'accessKeyId':_0x4a3e0a[0x0],'secretAccessKey':_0x4a3e0a[0x1],'region':_0x4a3e0a[0x2]});var _0x57f6d0={'botAlias':_0x0e68('0x29'),'botName':_0x4a3e0a[0x3],'inputText':this[_0x0e68('0x2a')][_0x0e68('0x1e')],'userId':this['channel']+':'+this[_0x0e68('0xb')]['id'][_0x0e68('0x2b')]()};_0x26f274[_0x0e68('0x2c')](_0x57f6d0,function(_0x48e0e0,_0x3e95c7){if(_0x48e0e0){logger['error'](_0x0e68('0x21'),_0x40428e,_0x48e0e0['message']);_0x2772bb[_0x0e68('0xe')]();}else if(_0x3e95c7&&_0x3e95c7[_0x0e68('0x2a')]){_0xa483bc[_0x0e68('0x1e')]['amazonlex']=_0x3e95c7;_0x19aa26[_0x0e68('0x1e')]=_0x3e95c7[_0x0e68('0x2a')];_0x19aa26[_0x0e68('0x2d')]=_0x0e68('0x2e');_0x19aa26[_0x0e68('0x2f')]=JSON[_0x0e68('0x24')](_0x3e95c7);return rpc[_0x4baae3+_0x0e68('0x30')][_0x0e68('0x1f')](_0x19aa26)[_0x0e68('0x20')](function(_0x2158c5){logger[_0x0e68('0xd')](_0x0e68('0x21'),_0x40428e,_0x19aa26['body']);if(_0x3e95c7[_0x0e68('0x31')]==_0x0e68('0x32')){_0x2772bb[_0x0e68('0xe')]();}else{_0x2772bb[_0x0e68('0x26')]();}})[_0x0e68('0x22')](function(_0x267359){logger[_0x0e68('0x23')]('[%s][AMAZONLEX]\x20%s',_0x40428e,JSON['stringify'](_0x267359));_0x2772bb['next']();});}else{_0x2772bb[_0x0e68('0xe')]();}});}}catch(_0x50ae19){logger[_0x0e68('0x23')](_0x0e68('0x21'),_0x40428e,JSON[_0x0e68('0x24')](_0x50ae19));_0x2772bb[_0x0e68('0x26')]();}};}; \ No newline at end of file +var _0x5251=['providerName','providerResponse','Failed','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','then','info','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex'];(function(_0x25a4bf,_0x2d9542){var _0x15384c=function(_0x2071e0){while(--_0x2071e0){_0x25a4bf['push'](_0x25a4bf['shift']());}};_0x15384c(++_0x2d9542);}(_0x5251,0x183));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1525('0x0'));var moment=require(_0x1525('0x1'));var AWS=require(_0x1525('0x2'));var utils=require('./utils');var logger=require(_0x1525('0x3'))(_0x1525('0x4'));var rpc={'chatMessage':require(_0x1525('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1525('0x6')),'smsMessage':require(_0x1525('0x7')),'faxMessage':require(_0x1525('0x8')),'whatsappMessage':require(_0x1525('0x9'))};exports[_0x1525('0xa')]=function(_0x2611d5,_0x193920){return function(_0x3a4f90){try{if(!_[_0x1525('0xb')](this[_0x1525('0xc')]['UserId'])){logger['info'](_0x1525('0xd'),_0x2611d5,_0x1525('0xe'));return _0x3a4f90[_0x1525('0xf')]();}var _0x55a913={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x1525('0x10')),'direction':_0x1525('0x11')};if(this[_0x1525('0x12')]===_0x1525('0x13')||this['channel']==='whatsapp'){_0x55a913[_0x1525('0x14')]=this[_0x1525('0xc')][_0x1525('0x14')];}var _0x2514f1=this[_0x1525('0x12')];if(_0x2514f1==='chat'){_0x55a913['ChatWebsiteId']=this[_0x1525('0x15')]['id'];}else{_0x55a913[_[_0x1525('0x16')](_0x2514f1)+_0x1525('0x17')]=this[_0x1525('0x15')]['id'];}_0x55a913[_[_0x1525('0x16')](_0x2514f1)+_0x1525('0x18')]=this[_0x1525('0xc')]['id'];if(this[_0x1525('0xc')][_0x1525('0x19')]){var _0x56f343=_0x193920[0x4];if(!_[_0x1525('0x1a')](_0x56f343)){_0x55a913[_0x1525('0x1b')]=utils['getMustacheRender'](_0x56f343,this);return rpc[_0x2514f1+_0x1525('0x1c')][_0x1525('0x1d')](_0x55a913)[_0x1525('0x1e')](function(_0x553a06){logger[_0x1525('0x1f')](_0x1525('0xd'),_0x2611d5,_0x55a913[_0x1525('0x1b')]);})[_0x1525('0x20')](function(_0x46385f){logger[_0x1525('0x21')](_0x1525('0xd'),_0x2611d5,JSON[_0x1525('0x22')](_0x46385f));})[_0x1525('0x23')](function(){logger[_0x1525('0x1f')](_0x1525('0x24'),_0x2611d5);_0x3a4f90[_0x1525('0x25')]();});}else{logger[_0x1525('0x1f')](_0x1525('0x26'),_0x2611d5);_0x3a4f90[_0x1525('0x25')]();}}else{var _0x443110=this;var _0x12fba4=new AWS[(_0x1525('0x27'))]({'accessKeyId':_0x193920[0x0],'secretAccessKey':_0x193920[0x1],'region':_0x193920[0x2]});var _0x3e41b8={'botAlias':_0x1525('0x28'),'botName':_0x193920[0x3],'inputText':this[_0x1525('0x29')]['body'],'userId':this['channel']+':'+this[_0x1525('0xc')]['id'][_0x1525('0x2a')]()};_0x12fba4[_0x1525('0x2b')](_0x3e41b8,function(_0xe4dc,_0x1d17c8){if(_0xe4dc){logger[_0x1525('0x21')](_0x1525('0xd'),_0x2611d5,_0xe4dc[_0x1525('0x29')]);_0x3a4f90[_0x1525('0xf')]();}else if(_0x1d17c8&&_0x1d17c8[_0x1525('0x29')]){_0x443110[_0x1525('0x1b')][_0x1525('0x2c')]=_0x1d17c8;_0x55a913[_0x1525('0x1b')]=_0x1d17c8[_0x1525('0x29')];_0x55a913[_0x1525('0x2d')]=_0x1525('0x2c');_0x55a913[_0x1525('0x2e')]=JSON[_0x1525('0x22')](_0x1d17c8);return rpc[_0x2514f1+'Message'][_0x1525('0x1d')](_0x55a913)[_0x1525('0x1e')](function(_0x5bc3f7){logger[_0x1525('0x1f')](_0x1525('0xd'),_0x2611d5,_0x55a913['body']);if(_0x1d17c8['dialogState']==_0x1525('0x2f')){_0x3a4f90[_0x1525('0xf')]();}else{_0x3a4f90[_0x1525('0x25')]();}})[_0x1525('0x20')](function(_0xbb569a){logger[_0x1525('0x21')](_0x1525('0xd'),_0x2611d5,JSON[_0x1525('0x22')](_0xbb569a));_0x3a4f90[_0x1525('0xf')]();});}else{_0x3a4f90[_0x1525('0xf')]();}});}}catch(_0x2b2509){logger[_0x1525('0x21')](_0x1525('0xd'),_0x2611d5,JSON[_0x1525('0x22')](_0x2b2509));_0x3a4f90[_0x1525('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 729561a..9e37b3b 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 _0x9964=['One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','body','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','inReplyTo','messageId','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','stringify','finally','Interaction','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../mailRpc','consequence','channel','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','next','autoreplyExecuted'];(function(_0x578e9d,_0x255cdc){var _0x25e281=function(_0x16f839){while(--_0x16f839){_0x578e9d['push'](_0x578e9d['shift']());}};_0x25e281(++_0x255cdc);}(_0x9964,0x1cb));var _0x4996=function(_0x311666,_0x17b07d){_0x311666=_0x311666-0x0;var _0x2bc692=_0x9964[_0x311666];return _0x2bc692;};'use strict';var _=require('lodash');var moment=require(_0x4996('0x0'));var utils=require(_0x4996('0x1'));var logger=require(_0x4996('0x2'))('routing');var rpc={'chatMessage':require(_0x4996('0x3')),'openchannelMessage':require(_0x4996('0x4')),'mailMessage':require(_0x4996('0x5')),'smsMessage':require(_0x4996('0x6')),'faxMessage':require(_0x4996('0x7')),'whatsappMessage':require(_0x4996('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x4996('0x9')),'smsInteraction':require(_0x4996('0xa')),'faxInteraction':require(_0x4996('0xb')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require(_0x4996('0xc'));exports[_0x4996('0xd')]=function(_0x59acfe,_0x257c74,_0x900e2e,_0x2c5a6e){return function(_0x1e020e){try{var _0x10a73e=this[_0x4996('0xe')];if(_0x10a73e==='mail'&&_0x2c5a6e['body'][_0x4996('0xf')]){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,_0x4996('0x12'));return _0x1e020e['next']();}if(_0x257c74[0x0]==='1'&&(_[_0x4996('0x13')](this[_0x4996('0x14')][_0x4996('0x15')])||!this[_0x4996('0x14')]['created'])){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,'Autoreply\x20already\x20sent');return _0x1e020e[_0x4996('0x16')]();}if(_0x257c74[0x0]==='2'&&this[_0x4996('0x14')][_0x4996('0x17')]){logger[_0x4996('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,_0x4996('0x18'));return _0x1e020e['next']();}var _0xb8ab5f={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4996('0x19')](_0x4996('0x1a')),'direction':_0x4996('0x1b')};if(this[_0x4996('0xe')]===_0x4996('0x1c')){_0xb8ab5f['body']=utils[_0x4996('0x1d')](_0x257c74[0x2],this);}else{_0xb8ab5f[_0x4996('0x1e')]=utils[_0x4996('0x1d')](_0x257c74[0x1],this);}if(this[_0x4996('0x1f')]){_0xb8ab5f['to']=this[_0x4996('0x1f')][_0x4996('0x20')]||'';if(this[_0x4996('0xe')]===_0x4996('0x1c')&&_0x257c74[0x1]==='1'){_0xb8ab5f['cc']=this['message']['cc']||'';}_0xb8ab5f[_0x4996('0x20')]=this[_0x4996('0x1f')]['to']||'';_0xb8ab5f[_0x4996('0x21')]=this[_0x4996('0x1f')][_0x4996('0x21')]||'';_0xb8ab5f[_0x4996('0x22')]=!![];if(this['message'][_0x4996('0x23')]){_0xb8ab5f[_0x4996('0x23')]='';_0xb8ab5f['subject']+=_[_0x4996('0x24')](this[_0x4996('0x1f')][_0x4996('0x23')],'Re:')?'':_0x4996('0x25');_0xb8ab5f[_0x4996('0x23')]+=this[_0x4996('0x1f')][_0x4996('0x23')];}}if(this[_0x4996('0xe')]===_0x4996('0x26')){_0xb8ab5f[_0x4996('0x27')]=this[_0x4996('0x28')]['id'];}else{_0xb8ab5f[_['upperFirst'](this[_0x4996('0xe')])+_0x4996('0x29')]=this[_0x4996('0x28')]['id'];}_0xb8ab5f[_[_0x4996('0x2a')](this[_0x4996('0xe')])+'InteractionId']=this[_0x4996('0x14')]['id'];var _0x2b4bbe=this[_0x4996('0x14')];if(rpc[this[_0x4996('0xe')]+_0x4996('0x2b')]){if(this[_0x4996('0xe')]===_0x4996('0x1c')){_0xb8ab5f[_0x4996('0x2c')]=this[_0x4996('0x1f')][_0x4996('0x2d')];_0xb8ab5f['html']=''+_['replace'](_0xb8ab5f[_0x4996('0x1e')],_0x4996('0x2e'),_0x4996('0x2f'))+_0x4996('0x30');_0xb8ab5f[_0x4996('0x31')]={'Auto-Submitted':_0x4996('0x32'),'X-Auto-Response-Suppress':_0x4996('0x33'),'Precedence':_0x4996('0x34')};return mailRpc[_0x4996('0x35')](this[_0x4996('0x28')][_0x4996('0x36')],_0xb8ab5f)[_0x4996('0x37')](function(_0x2a0ac7){logger[_0x4996('0x10')](_0x4996('0x38'),_0x59acfe);_0xb8ab5f[_0x4996('0x2d')]=_0x2a0ac7['message'][_0x4996('0x2d')];return rpc[_0x10a73e+_0x4996('0x2b')][_0x4996('0x39')](_0xb8ab5f);})[_0x4996('0x37')](function(_0xef16b2){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,JSON['stringify'](_0xef16b2));})[_0x4996('0x3a')](function(_0x54c2ef){logger[_0x4996('0x3b')](_0x4996('0x3c'),_0x59acfe,JSON['stringify'](_0x54c2ef));})['finally'](function(){Promise[_0x4996('0x3d')]()[_0x4996('0x37')](function(){if(_0x257c74[0x0]!=='2'||_0x2b4bbe[_0x4996('0x17')])return;return rpc[_0x10a73e+'Interaction'][_0x4996('0x3e')](_0x2b4bbe['id'],{'autoreplyExecuted':!![]})[_0x4996('0x37')](function(_0xb38b3c){logger[_0x4996('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,JSON[_0x4996('0x3f')](_0xb38b3c));})['catch'](function(_0x463622){logger[_0x4996('0x3b')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x59acfe,JSON[_0x4996('0x3f')](_0x463622));});})[_0x4996('0x37')](function(){_0x1e020e[_0x4996('0x16')]();});});}else{return rpc[this['channel']+_0x4996('0x2b')]['create'](_0xb8ab5f)[_0x4996('0x37')](function(){logger[_0x4996('0x10')](_0x4996('0x11'),_0x59acfe,_0xb8ab5f[_0x4996('0x1e')]);})[_0x4996('0x3a')](function(_0x3e55df){logger[_0x4996('0x3b')](_0x4996('0x11'),_0x59acfe,JSON[_0x4996('0x3f')](_0x3e55df));})[_0x4996('0x40')](function(){Promise[_0x4996('0x3d')]()[_0x4996('0x37')](function(){if(_0x257c74[0x0]!=='2'||_0x2b4bbe['autoreplyExecuted'])return;return rpc[_0x10a73e+_0x4996('0x41')][_0x4996('0x3e')](_0x2b4bbe['id'],{'autoreplyExecuted':!![]})[_0x4996('0x37')](function(_0x1a3c47){logger[_0x4996('0x10')](_0x4996('0x42'),_0x59acfe,JSON[_0x4996('0x3f')](_0x1a3c47));})[_0x4996('0x3a')](function(_0x36f7fe){logger[_0x4996('0x3b')](_0x4996('0x43'),_0x59acfe,JSON['stringify'](_0x36f7fe));});})['then'](function(){_0x1e020e[_0x4996('0x16')]();});});}}}catch(_0x17311b){logger[_0x4996('0x3b')](_0x4996('0x11'),_0x59acfe,JSON[_0x4996('0x3f')](_0x17311b));_0x1e020e[_0x4996('0x44')]();}};}; \ No newline at end of file +var _0x10c0=['then','stringify','catch','error','finally','autoreplyExecuted','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','body','info','[%s][AUTOREPLY]\x20%s','next','interaction','created','contact','format','out','channel','mail','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','inReplyTo','messageId','replace',''+_[_0x010c('0x29')](_0x156777['body'],_0x010c('0x2a'),_0x010c('0x2b'))+'';_0x156777['headers']={'Auto-Submitted':_0x010c('0x2c'),'X-Auto-Response-Suppress':_0x010c('0x2d'),'Precedence':_0x010c('0x2e')};return mailRpc[_0x010c('0x2f')](this['account'][_0x010c('0x30')],_0x156777)['then'](function(_0x84225f){logger[_0x010c('0xf')](_0x010c('0x31'),_0x9e6105);_0x156777['messageId']=_0x84225f[_0x010c('0x1a')][_0x010c('0x28')];return rpc[_0x36ec75+_0x010c('0x26')][_0x010c('0x32')](_0x156777);})[_0x010c('0x33')](function(_0x3692c7){logger['info'](_0x010c('0x10'),_0x9e6105,JSON[_0x010c('0x34')](_0x3692c7));})[_0x010c('0x35')](function(_0x2c4d3a){logger[_0x010c('0x36')]('[RPC][%s][AUTOREPLY]\x20%s',_0x9e6105,JSON['stringify'](_0x2c4d3a));})[_0x010c('0x37')](function(){Promise['resolve']()['then'](function(){if(_0x3716cb[0x0]!=='2'||_0x249338[_0x010c('0x38')])return;return rpc[_0x36ec75+_0x010c('0x39')][_0x010c('0x3a')](_0x249338['id'],{'autoreplyExecuted':!![]})[_0x010c('0x33')](function(_0x55a667){logger[_0x010c('0xf')](_0x010c('0x3b'),_0x9e6105,JSON['stringify'](_0x55a667));})[_0x010c('0x35')](function(_0x114cd1){logger['error'](_0x010c('0x3c'),_0x9e6105,JSON[_0x010c('0x34')](_0x114cd1));});})[_0x010c('0x33')](function(){_0x3246eb[_0x010c('0x11')]();});});}else{return rpc[this[_0x010c('0x17')]+'Message'][_0x010c('0x32')](_0x156777)[_0x010c('0x33')](function(){logger['info']('[%s][AUTOREPLY]\x20%s',_0x9e6105,_0x156777['body']);})[_0x010c('0x35')](function(_0x36173d){logger[_0x010c('0x36')](_0x010c('0x10'),_0x9e6105,JSON[_0x010c('0x34')](_0x36173d));})['finally'](function(){Promise[_0x010c('0x3d')]()[_0x010c('0x33')](function(){if(_0x3716cb[0x0]!=='2'||_0x249338[_0x010c('0x38')])return;return rpc[_0x36ec75+_0x010c('0x39')][_0x010c('0x3a')](_0x249338['id'],{'autoreplyExecuted':!![]})[_0x010c('0x33')](function(_0x5a9856){logger[_0x010c('0xf')](_0x010c('0x3b'),_0x9e6105,JSON[_0x010c('0x34')](_0x5a9856));})[_0x010c('0x35')](function(_0x547e37){logger[_0x010c('0x36')](_0x010c('0x3c'),_0x9e6105,JSON[_0x010c('0x34')](_0x547e37));});})[_0x010c('0x33')](function(){_0x3246eb[_0x010c('0x11')]();});});}}}catch(_0x146b07){logger['error'](_0x010c('0x10'),_0x9e6105,JSON[_0x010c('0x34')](_0x146b07));_0x3246eb['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 6931725..caa96ad 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 _0xc419=['format','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xc419,0x1dc));var _0x9c41=function(_0x27d4ed,_0x5d2929){_0x27d4ed=_0x27d4ed-0x0;var _0x361a97=_0xc419[_0x27d4ed];return _0x361a97;};'use strict';var moment=require(_0x9c41('0x0'));var logger=require(_0x9c41('0x1'))(_0x9c41('0x2'));var rpc={'chatInteraction':require(_0x9c41('0x3')),'openchannelInteraction':require(_0x9c41('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x9c41('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x9c41('0x6')]=function(_0x30fa51,_0x2f0382,_0x1fdc77,_0x23c9e5){return function(_0x18c2bd){try{logger['info'](_0x9c41('0x7'),_0x30fa51,_0x2f0382[0x0]);var _0xb2a3a9={'closed':0x1,'closedAt':moment()[_0x9c41('0x8')](_0x9c41('0x9')),'closeReason':'system','disposition':_0x2f0382[0x0]};if(rpc[_0x23c9e5[_0x9c41('0xa')]+_0x9c41('0xb')]){rpc[_0x23c9e5[_0x9c41('0xa')]+'Interaction'][_0x9c41('0xc')](_0x23c9e5[_0x9c41('0xd')]['id'],_0xb2a3a9)[_0x9c41('0xe')](function(_0x1099c3){logger[_0x9c41('0xf')](_0x9c41('0x10'),_0x30fa51,_0x23c9e5[_0x9c41('0xd')]['id']);})[_0x9c41('0x11')](function(_0x5da278){logger[_0x9c41('0x12')]('[%s][CLOSE]\x20%s',_0x30fa51,JSON[_0x9c41('0x13')](_0x5da278));})['finally'](function(){_0x18c2bd[_0x9c41('0x14')]();});}}catch(_0x550fd1){logger[_0x9c41('0x12')](_0x9c41('0x15'),_0x30fa51,JSON[_0x9c41('0x13')](_0x550fd1));_0x18c2bd[_0x9c41('0x14')]();}};}; \ No newline at end of file +var _0x3c26=['stringify','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','finally','stop'];(function(_0x33cca1,_0x3e6e36){var _0x31332e=function(_0x15ff23){while(--_0x15ff23){_0x33cca1['push'](_0x33cca1['shift']());}};_0x31332e(++_0x3e6e36);}(_0x3c26,0x191));var _0x63c2=function(_0x2429cd,_0x12559b){_0x2429cd=_0x2429cd-0x0;var _0x150170=_0x3c26[_0x2429cd];return _0x150170;};'use strict';var moment=require(_0x63c2('0x0'));var logger=require(_0x63c2('0x1'))('routing');var rpc={'chatInteraction':require(_0x63c2('0x2')),'openchannelInteraction':require(_0x63c2('0x3')),'smsInteraction':require(_0x63c2('0x4')),'mailInteraction':require(_0x63c2('0x5')),'faxInteraction':require(_0x63c2('0x6')),'whatsappInteraction':require(_0x63c2('0x7'))};exports[_0x63c2('0x8')]=function(_0x261ec2,_0x383921,_0x41f772,_0x51d58e){return function(_0x55d65b){try{logger[_0x63c2('0x9')]('[%s][CLOSE]\x20reason\x20%s',_0x261ec2,_0x383921[0x0]);var _0xfd6810={'closed':0x1,'closedAt':moment()[_0x63c2('0xa')](_0x63c2('0xb')),'closeReason':_0x63c2('0xc'),'disposition':_0x383921[0x0]};if(rpc[_0x51d58e[_0x63c2('0xd')]+_0x63c2('0xe')]){rpc[_0x51d58e[_0x63c2('0xd')]+'Interaction'][_0x63c2('0xf')](_0x51d58e['interaction']['id'],_0xfd6810)[_0x63c2('0x10')](function(_0x571e39){logger[_0x63c2('0x9')](_0x63c2('0x11'),_0x261ec2,_0x51d58e[_0x63c2('0x12')]['id']);})[_0x63c2('0x13')](function(_0x33184a){logger[_0x63c2('0x14')](_0x63c2('0x15'),_0x261ec2,JSON['stringify'](_0x33184a));})[_0x63c2('0x16')](function(){_0x55d65b[_0x63c2('0x17')]();});}}catch(_0x56f6c1){logger['error'](_0x63c2('0x15'),_0x261ec2,JSON[_0x63c2('0x18')](_0x56f6c1));_0x55d65b[_0x63c2('0x17')]();}};}; \ 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 3d2e1a3..ee3d48c 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 _0x8efc=['stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','body','dialogflow','result','fulfillment','providerResponse','metadata','endConversation','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!'];(function(_0x2b4eb3,_0x578d3a){var _0x472d1e=function(_0x4463cc){while(--_0x4463cc){_0x2b4eb3['push'](_0x2b4eb3['shift']());}};_0x472d1e(++_0x578d3a);}(_0x8efc,0x8f));var _0xc8ef=function(_0x18abd2,_0x22d4b3){_0x18abd2=_0x18abd2-0x0;var _0x1dcad6=_0x8efc[_0x18abd2];return _0x1dcad6;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require(_0xc8ef('0x0'));var md5=require('md5');var utils=require(_0xc8ef('0x1'));var logger=require('../../../../config/logger')(_0xc8ef('0x2'));var rpc={'chatMessage':require(_0xc8ef('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc8ef('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc8ef('0x5'))};exports[_0xc8ef('0x6')]=function(_0x1648ac,_0x1f7596){return function(_0x819e70){try{if(!_['isNil'](this[_0xc8ef('0x7')]['UserId'])){logger[_0xc8ef('0x8')](_0xc8ef('0x9'),_0x1648ac,_0xc8ef('0xa'));return _0x819e70[_0xc8ef('0xb')]();}var _0x49f653={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xc8ef('0xc')),'direction':_0xc8ef('0xd')};if(this[_0xc8ef('0xe')]===_0xc8ef('0xf')||this['channel']===_0xc8ef('0x10')){_0x49f653[_0xc8ef('0x11')]=this[_0xc8ef('0x7')][_0xc8ef('0x11')];}var _0x27e741=this[_0xc8ef('0xe')];if(_0x27e741===_0xc8ef('0x12')){_0x49f653[_0xc8ef('0x13')]=this['account']['id'];}else{_0x49f653[_['upperFirst'](_0x27e741)+_0xc8ef('0x14')]=this[_0xc8ef('0x15')]['id'];}_0x49f653[_[_0xc8ef('0x16')](_0x27e741)+_0xc8ef('0x17')]=this[_0xc8ef('0x7')]['id'];if(this[_0xc8ef('0x7')][_0xc8ef('0x18')]){var _0x4026c6=_0x1f7596[0x2];if(!_['isEmpty'](_0x4026c6)){_0x49f653['body']=utils[_0xc8ef('0x19')](_0x4026c6,this);return rpc[_0x27e741+_0xc8ef('0x1a')][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0x5a2815){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);})[_0xc8ef('0x1d')](function(_0x4ee9df){logger[_0xc8ef('0x1e')](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x4ee9df));})['finally'](function(){logger[_0xc8ef('0x8')](_0xc8ef('0x20'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();});}else{logger[_0xc8ef('0x8')](_0xc8ef('0x22'),_0x1648ac);_0x819e70[_0xc8ef('0x21')]();}}else{var _0x1db74d=this;var _0x16bf51=apiai(_0x1f7596[0x0],{'language':_0x1f7596[0x1]||'en'});return _0x16bf51[_0xc8ef('0x23')](this[_0xc8ef('0x24')][_0xc8ef('0x25')],{'sessionId':md5(this[_0xc8ef('0x7')]['id'])})['then'](function(_0x509619){_0x1db74d[_0xc8ef('0x25')][_0xc8ef('0x26')]=_0x509619;_0x49f653[_0xc8ef('0x25')]=_0x509619[_0xc8ef('0x27')][_0xc8ef('0x28')]['speech'];_0x49f653['providerName']=_0xc8ef('0x26');_0x49f653[_0xc8ef('0x29')]=JSON[_0xc8ef('0x1f')](_0x509619);return rpc[_0x27e741+'Message'][_0xc8ef('0x1b')](_0x49f653)[_0xc8ef('0x1c')](function(_0xf285d9){logger[_0xc8ef('0x8')]('[%s][DIALOGFLOW]\x20%s',_0x1648ac,_0x49f653['body']);if(_0x509619[_0xc8ef('0x27')][_0xc8ef('0x2a')][_0xc8ef('0x2b')]){_0x819e70['next']();}else{_0x819e70[_0xc8ef('0x21')]();}})[_0xc8ef('0x1d')](function(_0x199af5){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON[_0xc8ef('0x1f')](_0x199af5));_0x819e70[_0xc8ef('0xb')]();});})[_0xc8ef('0x1d')](function(_0x17c07c){logger['error'](_0xc8ef('0x9'),_0x1648ac,_0x17c07c['message']);_0x819e70['next']();});}}catch(_0x46745d){logger['error'](_0xc8ef('0x9'),_0x1648ac,JSON['stringify'](_0x46745d));_0x819e70['stop']();}};}; \ No newline at end of file +var _0x7c09=['sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','providerResponse','endConversation','stringify','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','isNil','interaction','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0x7c09,0x102));var _0x97c0=function(_0x2ebb4f,_0x20a4c7){_0x2ebb4f=_0x2ebb4f-0x0;var _0x301245=_0x7c09[_0x2ebb4f];return _0x301245;};'use strict';var _=require('lodash');var moment=require(_0x97c0('0x0'));var apiai=require(_0x97c0('0x1'));var md5=require('md5');var utils=require(_0x97c0('0x2'));var logger=require(_0x97c0('0x3'))(_0x97c0('0x4'));var rpc={'chatMessage':require(_0x97c0('0x5')),'openchannelMessage':require(_0x97c0('0x6')),'mailMessage':require(_0x97c0('0x7')),'smsMessage':require(_0x97c0('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x46fdd9,_0x42c6c7){return function(_0x2c19fa){try{if(!_[_0x97c0('0x9')](this[_0x97c0('0xa')]['UserId'])){logger[_0x97c0('0xb')]('[%s][DIALOGFLOW]\x20%s',_0x46fdd9,_0x97c0('0xc'));return _0x2c19fa[_0x97c0('0xd')]();}var _0x52bce2={'ContactId':this['contact']['id'],'sentAt':moment()[_0x97c0('0xe')](_0x97c0('0xf')),'direction':_0x97c0('0x10')};if(this[_0x97c0('0x11')]===_0x97c0('0x12')||this[_0x97c0('0x11')]===_0x97c0('0x13')){_0x52bce2[_0x97c0('0x14')]=this[_0x97c0('0xa')][_0x97c0('0x14')];}var _0x2810fd=this[_0x97c0('0x11')];if(_0x2810fd===_0x97c0('0x15')){_0x52bce2['ChatWebsiteId']=this[_0x97c0('0x16')]['id'];}else{_0x52bce2[_[_0x97c0('0x17')](_0x2810fd)+_0x97c0('0x18')]=this['account']['id'];}_0x52bce2[_[_0x97c0('0x17')](_0x2810fd)+_0x97c0('0x19')]=this[_0x97c0('0xa')]['id'];if(this[_0x97c0('0xa')][_0x97c0('0x1a')]){var _0x13d46e=_0x42c6c7[0x2];if(!_['isEmpty'](_0x13d46e)){_0x52bce2[_0x97c0('0x1b')]=utils[_0x97c0('0x1c')](_0x13d46e,this);return rpc[_0x2810fd+'Message'][_0x97c0('0x1d')](_0x52bce2)[_0x97c0('0x1e')](function(_0x179d43){logger[_0x97c0('0xb')](_0x97c0('0x1f'),_0x46fdd9,_0x52bce2[_0x97c0('0x1b')]);})[_0x97c0('0x20')](function(_0x1eeaf0){logger[_0x97c0('0x21')](_0x97c0('0x1f'),_0x46fdd9,JSON['stringify'](_0x1eeaf0));})['finally'](function(){logger[_0x97c0('0xb')](_0x97c0('0x22'),_0x46fdd9);_0x2c19fa[_0x97c0('0x23')]();});}else{logger['info'](_0x97c0('0x24'),_0x46fdd9);_0x2c19fa[_0x97c0('0x23')]();}}else{var _0x31ffb7=this;var _0x272314=apiai(_0x42c6c7[0x0],{'language':_0x42c6c7[0x1]||'en'});return _0x272314[_0x97c0('0x25')](this[_0x97c0('0x26')][_0x97c0('0x1b')],{'sessionId':md5(this['interaction']['id'])})[_0x97c0('0x1e')](function(_0x29b3aa){_0x31ffb7[_0x97c0('0x1b')][_0x97c0('0x27')]=_0x29b3aa;_0x52bce2['body']=_0x29b3aa[_0x97c0('0x28')][_0x97c0('0x29')]['speech'];_0x52bce2[_0x97c0('0x2a')]=_0x97c0('0x27');_0x52bce2[_0x97c0('0x2b')]=JSON['stringify'](_0x29b3aa);return rpc[_0x2810fd+'Message']['create'](_0x52bce2)[_0x97c0('0x1e')](function(_0x8e3ee7){logger[_0x97c0('0xb')](_0x97c0('0x1f'),_0x46fdd9,_0x52bce2[_0x97c0('0x1b')]);if(_0x29b3aa[_0x97c0('0x28')]['metadata'][_0x97c0('0x2c')]){_0x2c19fa[_0x97c0('0xd')]();}else{_0x2c19fa[_0x97c0('0x23')]();}})['catch'](function(_0x14617c){logger[_0x97c0('0x21')](_0x97c0('0x1f'),_0x46fdd9,JSON[_0x97c0('0x2d')](_0x14617c));_0x2c19fa[_0x97c0('0xd')]();});})['catch'](function(_0x59abbb){logger[_0x97c0('0x21')](_0x97c0('0x1f'),_0x46fdd9,_0x59abbb[_0x97c0('0x26')]);_0x2c19fa['next']();});}}catch(_0xdedd82){logger[_0x97c0('0x21')]('[%s][DIALOGFLOW]\x20%s',_0x46fdd9,JSON[_0x97c0('0x2d')](_0xdedd82));_0x2c19fa[_0x97c0('0x23')]();}};}; \ 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 0f29363..1cf1c3e 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 _0xad9b=['DIALOGFLOWV2_SCORE','providerName','providerResponse','push','fulfillmentText','all','lodash','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/mailMessage','../../rpc/faxMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','error','stringify','consequence','isNil','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','getMustacheRender','catch','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT'];(function(_0x5128ca,_0x1ac9ec){var _0x55c484=function(_0x6a8360){while(--_0x6a8360){_0x5128ca['push'](_0x5128ca['shift']());}};_0x55c484(++_0x1ac9ec);}(_0xad9b,0x10e));var _0xbad9=function(_0x3438de,_0x39292c){_0x3438de=_0x3438de-0x0;var _0x5de621=_0xad9b[_0x3438de];return _0x5de621;};'use strict';var _=require(_0xbad9('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xbad9('0x1'));var moment=require(_0xbad9('0x2'));var Promise=require(_0xbad9('0x3'));var logger=require(_0xbad9('0x4'))(_0xbad9('0x5'));var utils=require(_0xbad9('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xbad9('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbad9('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4e05fd,_0x3ce50a,_0x18216f,_0x41895e){return new Promise(function(_0x585ae1,_0x3b91b2){var _0x187477=_['clone'](_0x18216f);_0x187477[_0xbad9('0x9')]=_0x41895e;return rpc[_0x3ce50a+_0xbad9('0xa')][_0xbad9('0xb')](_0x187477)[_0xbad9('0xc')](function(){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x4e05fd,_0x187477[_0xbad9('0x9')]);_0x585ae1();})['catch'](function(_0x3f6337){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x4e05fd,JSON[_0xbad9('0x10')](_0x3f6337));_0x3b91b2(_0x3f6337);});});}exports[_0xbad9('0x11')]=function(_0x503e7d,_0x3b193d){return function(_0x416867){try{if(!_[_0xbad9('0x12')](this['interaction'][_0xbad9('0x13')])){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x503e7d,_0xbad9('0x14'));return _0x416867[_0xbad9('0x15')]();}var _0xb56d58={'ContactId':this['contact']['id'],'sentAt':moment()[_0xbad9('0x16')](_0xbad9('0x17')),'direction':_0xbad9('0x18')};if(this[_0xbad9('0x19')]==='sms'||this['channel']===_0xbad9('0x1a')){_0xb56d58[_0xbad9('0x1b')]=this[_0xbad9('0x1c')][_0xbad9('0x1b')];}var _0x21c090=this[_0xbad9('0x19')];if(_0x21c090===_0xbad9('0x1d')){_0xb56d58[_0xbad9('0x1e')]=this[_0xbad9('0x1f')]['id'];}else{_0xb56d58[_[_0xbad9('0x20')](_0x21c090)+_0xbad9('0x21')]=this[_0xbad9('0x1f')]['id'];}_0xb56d58[_[_0xbad9('0x20')](_0x21c090)+_0xbad9('0x22')]=this[_0xbad9('0x1c')]['id'];if(this['interaction']['created']){var _0x2b1080=_0x3b193d[0x4];if(!_['isEmpty'](_0x2b1080)){_0xb56d58[_0xbad9('0x9')]=utils[_0xbad9('0x23')](_0x2b1080,this);return rpc[_0x21c090+'Message'][_0xbad9('0xb')](_0xb56d58)[_0xbad9('0xc')](function(_0x31977e){logger[_0xbad9('0xd')](_0xbad9('0xe'),_0x503e7d,_0xb56d58[_0xbad9('0x9')]);})[_0xbad9('0x24')](function(_0xedea9c){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON['stringify'](_0xedea9c));})[_0xbad9('0x25')](function(){logger[_0xbad9('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x503e7d);_0x416867[_0xbad9('0x26')]();});}else{logger[_0xbad9('0xd')](_0xbad9('0x27'),_0x503e7d);_0x416867[_0xbad9('0x26')]();}}else{var _0x5269f1=this;var _0x3a0704=_0x3b193d[0x2][_0xbad9('0x28')](/\\n/g,'\x0a');var _0x3c29bc={'credentials':{'private_key':_0x3a0704,'client_email':_0x3b193d[0x1]}};var _0x5610f6=new dialogflow[(_0xbad9('0x29'))](_0x3c29bc);var _0x597f51=_0x5610f6['sessionPath'](_0x3b193d[0x0],md5(_0x5269f1[_0xbad9('0x1c')]['id']));var _0x5b8b86={'session':_0x597f51,'queryInput':{'text':{'text':_0x5269f1[_0xbad9('0x2a')][_0xbad9('0x9')],'languageCode':_0x3b193d[0x3]||'en'}}};return _0x5610f6[_0xbad9('0x2b')](_0x5b8b86)['then'](function(_0x3585dd){if(_0x3585dd&&_0x3585dd['length']){_0x5269f1['body'][_0xbad9('0x2c')]=_0x3585dd;var _0x16ed83=_0x3585dd[0x0];var _0x11cb94=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')]&&_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')]?_0x16ed83['queryResult']['diagnosticInfo'][_0xbad9('0x2f')][_0xbad9('0x30')][_0xbad9('0x31')]:![];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_ACTION']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x32')];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x33')];_0x5269f1[_0xbad9('0x9')][_0xbad9('0x34')]=_0x16ed83['queryResult'][_0xbad9('0x2e')]&&_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')]?_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x2e')][_0xbad9('0x2f')][_0xbad9('0x30')][_0xbad9('0x31')]:![];_0x5269f1[_0xbad9('0x9')]['DIALOGFLOWV2_INTENTNAME']=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x35')]['name'];_0x5269f1[_0xbad9('0x9')][_0xbad9('0x36')]=_0x16ed83[_0xbad9('0x2d')]['intent'][_0xbad9('0x37')];_0x5269f1['body'][_0xbad9('0x38')]=_0x16ed83[_0xbad9('0x2d')][_0xbad9('0x35')][_0xbad9('0x39')];_0x5269f1['body'][_0xbad9('0x3a')]=_0x16ed83[_0xbad9('0x2d')]['languageCode'];_0x5269f1['body'][_0xbad9('0x3b')]=_0x16ed83[_0xbad9('0x2d')]['queryText'];_0x5269f1['body'][_0xbad9('0x3c')]=_0x16ed83[_0xbad9('0x2d')]['intentDetectionConfidence'];_0xb56d58[_0xbad9('0x3d')]=_0xbad9('0x2c');_0xb56d58[_0xbad9('0x3e')]=JSON[_0xbad9('0x10')](_0x3585dd);var _0x520af2=[];for(var _0x2daf79=0x0;_0x2daf79<_0x3585dd['length'];_0x2daf79++){var _0x59f0c6=_0x3585dd[_0x2daf79];if(_0x59f0c6&&_0x59f0c6[_0xbad9('0x2d')]&&_0x59f0c6[_0xbad9('0x2d')]['fulfillmentText']){_0x520af2[_0xbad9('0x3f')](createMessage(_0x503e7d,_0x21c090,_0xb56d58,_0x59f0c6[_0xbad9('0x2d')][_0xbad9('0x40')]));}}return Promise[_0xbad9('0x41')](_0x520af2)[_0xbad9('0xc')](function(){if(_0x11cb94){_0x416867[_0xbad9('0x15')]();}else{_0x416867[_0xbad9('0x26')]();}})[_0xbad9('0x24')](function(_0x551f1e){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON['stringify'](_0x551f1e));_0x416867['next']();});}})[_0xbad9('0x24')](function(_0x4f88ce){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x503e7d,_0x4f88ce['message']);_0x416867['next']();});}}catch(_0x28d20b){logger[_0xbad9('0xf')](_0xbad9('0xe'),_0x503e7d,JSON[_0xbad9('0x10')](_0x28d20b));_0x416867[_0xbad9('0x26')]();}};}; \ No newline at end of file +var _0xdb2a=['queryResult','diagnosticInfo','fields','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','message','lodash','dialogflow','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','info','error','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','then','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','replace','SessionsClient','length','dialogflowV2'];(function(_0x47eb1c,_0x551dec){var _0x152446=function(_0x27fe3c){while(--_0x27fe3c){_0x47eb1c['push'](_0x47eb1c['shift']());}};_0x152446(++_0x551dec);}(_0xdb2a,0x16f));var _0xadb2=function(_0x3259e7,_0x172985){_0x3259e7=_0x3259e7-0x0;var _0x474fe0=_0xdb2a[_0x3259e7];return _0x474fe0;};'use strict';var _=require(_0xadb2('0x0'));var dialogflow=require(_0xadb2('0x1'));var md5=require(_0xadb2('0x2'));var moment=require('moment');var Promise=require('bluebird');var logger=require(_0xadb2('0x3'))(_0xadb2('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xadb2('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xadb2('0x6')),'smsMessage':require(_0xadb2('0x7')),'faxMessage':require(_0xadb2('0x8')),'whatsappMessage':require(_0xadb2('0x9'))};function createMessage(_0x338460,_0x50f98e,_0x25ef26,_0x51453d){return new Promise(function(_0x173ed2,_0x1b0de3){var _0x2d0df1=_['clone'](_0x25ef26);_0x2d0df1[_0xadb2('0xa')]=_0x51453d;return rpc[_0x50f98e+_0xadb2('0xb')][_0xadb2('0xc')](_0x2d0df1)['then'](function(){logger[_0xadb2('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x338460,_0x2d0df1[_0xadb2('0xa')]);_0x173ed2();})['catch'](function(_0x529072){logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x338460,JSON[_0xadb2('0x10')](_0x529072));_0x1b0de3(_0x529072);});});}exports[_0xadb2('0x11')]=function(_0x4a2641,_0x1eecdf){return function(_0x13db23){try{if(!_[_0xadb2('0x12')](this[_0xadb2('0x13')][_0xadb2('0x14')])){logger[_0xadb2('0xd')](_0xadb2('0xf'),_0x4a2641,_0xadb2('0x15'));return _0x13db23[_0xadb2('0x16')]();}var _0x52152f={'ContactId':this[_0xadb2('0x17')]['id'],'sentAt':moment()[_0xadb2('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xadb2('0x19')};if(this['channel']===_0xadb2('0x1a')||this[_0xadb2('0x1b')]===_0xadb2('0x1c')){_0x52152f['phone']=this[_0xadb2('0x13')][_0xadb2('0x1d')];}var _0x16e5f5=this['channel'];if(_0x16e5f5===_0xadb2('0x1e')){_0x52152f[_0xadb2('0x1f')]=this[_0xadb2('0x20')]['id'];}else{_0x52152f[_[_0xadb2('0x21')](_0x16e5f5)+_0xadb2('0x22')]=this[_0xadb2('0x20')]['id'];}_0x52152f[_[_0xadb2('0x21')](_0x16e5f5)+_0xadb2('0x23')]=this[_0xadb2('0x13')]['id'];if(this['interaction'][_0xadb2('0x24')]){var _0x3ab97e=_0x1eecdf[0x4];if(!_['isEmpty'](_0x3ab97e)){_0x52152f[_0xadb2('0xa')]=utils[_0xadb2('0x25')](_0x3ab97e,this);return rpc[_0x16e5f5+_0xadb2('0xb')]['create'](_0x52152f)[_0xadb2('0x26')](function(_0x50712d){logger[_0xadb2('0xd')](_0xadb2('0xf'),_0x4a2641,_0x52152f[_0xadb2('0xa')]);})[_0xadb2('0x27')](function(_0x24eb18){logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x4a2641,JSON[_0xadb2('0x10')](_0x24eb18));})[_0xadb2('0x28')](function(){logger[_0xadb2('0xd')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x4a2641);_0x13db23['stop']();});}else{logger[_0xadb2('0xd')](_0xadb2('0x29'),_0x4a2641);_0x13db23[_0xadb2('0x2a')]();}}else{var _0x37b178=this;var _0x421f05=_0x1eecdf[0x2][_0xadb2('0x2b')](/\\n/g,'\x0a');var _0x39819f={'credentials':{'private_key':_0x421f05,'client_email':_0x1eecdf[0x1]}};var _0x15c3dc=new dialogflow[(_0xadb2('0x2c'))](_0x39819f);var _0x5278be=_0x15c3dc['sessionPath'](_0x1eecdf[0x0],md5(_0x37b178[_0xadb2('0x13')]['id']));var _0x5592b9={'session':_0x5278be,'queryInput':{'text':{'text':_0x37b178['message'][_0xadb2('0xa')],'languageCode':_0x1eecdf[0x3]||'en'}}};return _0x15c3dc['detectIntent'](_0x5592b9)['then'](function(_0x31c4ee){if(_0x31c4ee&&_0x31c4ee[_0xadb2('0x2d')]){_0x37b178[_0xadb2('0xa')][_0xadb2('0x2e')]=_0x31c4ee;var _0x1dbd0a=_0x31c4ee[0x0];var _0x8f0e4a=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x30')]&&_0x1dbd0a[_0xadb2('0x2f')]['diagnosticInfo'][_0xadb2('0x31')]?_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x30')][_0xadb2('0x31')]['end_conversation'][_0xadb2('0x32')]:![];_0x37b178['body'][_0xadb2('0x33')]=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x34')];_0x37b178[_0xadb2('0xa')][_0xadb2('0x35')]=_0x1dbd0a[_0xadb2('0x2f')]['allRequiredParamsPresent'];_0x37b178[_0xadb2('0xa')][_0xadb2('0x36')]=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x30')]&&_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x30')]['fields']?_0x1dbd0a['queryResult']['diagnosticInfo']['fields'][_0xadb2('0x37')][_0xadb2('0x32')]:![];_0x37b178[_0xadb2('0xa')]['DIALOGFLOWV2_INTENTNAME']=_0x1dbd0a['queryResult'][_0xadb2('0x38')]['name'];_0x37b178[_0xadb2('0xa')][_0xadb2('0x39')]=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x38')][_0xadb2('0x3a')];_0x37b178[_0xadb2('0xa')][_0xadb2('0x3b')]=_0x1dbd0a['queryResult'][_0xadb2('0x38')][_0xadb2('0x3c')];_0x37b178[_0xadb2('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x3d')];_0x37b178[_0xadb2('0xa')]['DIALOGFLOWV2_QUERYTEXT']=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x3e')];_0x37b178[_0xadb2('0xa')][_0xadb2('0x3f')]=_0x1dbd0a[_0xadb2('0x2f')][_0xadb2('0x40')];_0x52152f[_0xadb2('0x41')]=_0xadb2('0x2e');_0x52152f[_0xadb2('0x42')]=JSON[_0xadb2('0x10')](_0x31c4ee);var _0x3147ef=[];for(var _0x425189=0x0;_0x425189<_0x31c4ee[_0xadb2('0x2d')];_0x425189++){var _0x4b93dc=_0x31c4ee[_0x425189];if(_0x4b93dc&&_0x4b93dc[_0xadb2('0x2f')]&&_0x4b93dc[_0xadb2('0x2f')][_0xadb2('0x43')]){_0x3147ef['push'](createMessage(_0x4a2641,_0x16e5f5,_0x52152f,_0x4b93dc[_0xadb2('0x2f')]['fulfillmentText']));}}return Promise['all'](_0x3147ef)['then'](function(){if(_0x8f0e4a){_0x13db23[_0xadb2('0x16')]();}else{_0x13db23[_0xadb2('0x2a')]();}})[_0xadb2('0x27')](function(_0x5164d5){logger['error'](_0xadb2('0xf'),_0x4a2641,JSON[_0xadb2('0x10')](_0x5164d5));_0x13db23[_0xadb2('0x16')]();});}})[_0xadb2('0x27')](function(_0x14096e){logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x4a2641,_0x14096e[_0xadb2('0x44')]);_0x13db23['next']();});}}catch(_0x2eaea8){logger[_0xadb2('0xe')](_0xadb2('0xf'),_0x4a2641,JSON[_0xadb2('0x10')](_0x2eaea8));_0x13db23[_0xadb2('0x2a')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 8d35ad3..59e860b 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 _0xc1ed=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','length','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','./utils','../../../../config/logger','routing'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0xc1ed,0x17b));var _0xdc1e=function(_0x45a6ea,_0x32131e){_0x45a6ea=_0x45a6ea-0x0;var _0x346ffa=_0xc1ed[_0x45a6ea];return _0x346ffa;};'use strict';var schema=require(_0xdc1e('0x0'));var _=require('lodash');var htmlToText=require(_0xdc1e('0x1'));var utils=require(_0xdc1e('0x2'));var logger=require(_0xdc1e('0x3'))(_0xdc1e('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0xdc1e('0x5'),'message':_0xdc1e('0x6')},'priorityFalse':{'type':'number','message':_0xdc1e('0x7')}});exports['consequence']=function(_0x45b938,_0x262aca){return function(_0x3090a9){try{var _0x15ac6b={'condition':htmlToText['fromString'](utils[_0xdc1e('0x8')](_0x262aca[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x262aca[0x1],'priorityFalse':_0x262aca[0x2]};var _0x34c5a6=gotoif['validate'](_0x15ac6b,{'typecast':!![]});if(_0x34c5a6[_0xdc1e('0x9')]){logger[_0xdc1e('0xa')](_0xdc1e('0xb'),_0x45b938,_['map'](_0x34c5a6,_0xdc1e('0xc'))[_0xdc1e('0xd')](',\x20'));_0x3090a9[_0xdc1e('0xe')]();}else{try{var _0x59961e=eval('('+_0x15ac6b[_0xdc1e('0xf')]+')');var _0x283dd2=_0x59961e?_0x15ac6b[_0xdc1e('0x10')]:_0x15ac6b['priorityFalse'];logger['info'](_0xdc1e('0x11'),_0x45b938,_0x15ac6b[_0xdc1e('0xf')],_0x59961e,_0x283dd2||'next');if(_0x283dd2){var _0x525331=_[_0xdc1e('0x12')](_0x3090a9['rules'](),{'p':_0x283dd2});if(_0x525331>=0x0){logger[_0xdc1e('0x13')](_0xdc1e('0x14'),_0x45b938,_0x283dd2||_0xdc1e('0x15'),_0x525331);_0x3090a9[_0xdc1e('0x15')](_0x525331);}else{logger[_0xdc1e('0x13')](_0xdc1e('0x16'),_0x45b938,_0x283dd2||_0xdc1e('0x15'));_0x3090a9['stop']();}}else{_0x3090a9['next']();}}catch(_0x4635d7){logger[_0xdc1e('0xa')](_0xdc1e('0x17'),_0x45b938,_0x4635d7[_0xdc1e('0xc')]);_0x3090a9[_0xdc1e('0xe')]();}}}catch(_0x5c6654){logger['error'](_0xdc1e('0xb'),_0x45b938,JSON['stringify'](_0x5c6654));_0x3090a9[_0xdc1e('0xe')]();}};}; \ No newline at end of file +var _0x7c9d=['[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','message','stringify','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info'];(function(_0x3546fa,_0x10bb7a){var _0x11ed56=function(_0x4ae2a3){while(--_0x4ae2a3){_0x3546fa['push'](_0x3546fa['shift']());}};_0x11ed56(++_0x10bb7a);}(_0x7c9d,0x18d));var _0xd7c9=function(_0x178e6a,_0xfcb04a){_0x178e6a=_0x178e6a-0x0;var _0x238cb5=_0x7c9d[_0x178e6a];return _0x238cb5;};'use strict';var schema=require('validate');var _=require(_0xd7c9('0x0'));var htmlToText=require(_0xd7c9('0x1'));var utils=require('./utils');var logger=require(_0xd7c9('0x2'))(_0xd7c9('0x3'));var gotoif=schema({'condition':{'type':_0xd7c9('0x4'),'required':!![],'message':_0xd7c9('0x5')},'priorityTrue':{'type':_0xd7c9('0x6'),'message':_0xd7c9('0x7')},'priorityFalse':{'type':_0xd7c9('0x6'),'message':_0xd7c9('0x8')}});exports[_0xd7c9('0x9')]=function(_0x39d904,_0x297598){return function(_0x5d1b30){try{var _0x4e15a4={'condition':htmlToText['fromString'](utils[_0xd7c9('0xa')](_0x297598[0x0],this),{'wordwrap':![]})[_0xd7c9('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x297598[0x1],'priorityFalse':_0x297598[0x2]};var _0xac04ea=gotoif[_0xd7c9('0xc')](_0x4e15a4,{'typecast':!![]});if(_0xac04ea[_0xd7c9('0xd')]){logger[_0xd7c9('0xe')](_0xd7c9('0xf'),_0x39d904,_[_0xd7c9('0x10')](_0xac04ea,'message')[_0xd7c9('0x11')](',\x20'));_0x5d1b30[_0xd7c9('0x12')]();}else{try{var _0x1ddab4=eval('('+_0x4e15a4[_0xd7c9('0x13')]+')');var _0x58a710=_0x1ddab4?_0x4e15a4[_0xd7c9('0x14')]:_0x4e15a4[_0xd7c9('0x15')];logger[_0xd7c9('0x16')](_0xd7c9('0x17'),_0x39d904,_0x4e15a4[_0xd7c9('0x13')],_0x1ddab4,_0x58a710||_0xd7c9('0x18'));if(_0x58a710){var _0x831f6c=_['findIndex'](_0x5d1b30[_0xd7c9('0x19')](),{'p':_0x58a710});if(_0x831f6c>=0x0){logger['info'](_0xd7c9('0x1a'),_0x39d904,_0x58a710||_0xd7c9('0x18'),_0x831f6c);_0x5d1b30[_0xd7c9('0x18')](_0x831f6c);}else{logger['info'](_0xd7c9('0x1b'),_0x39d904,_0x58a710||'next');_0x5d1b30[_0xd7c9('0x12')]();}}else{_0x5d1b30[_0xd7c9('0x18')]();}}catch(_0x352fce){logger['error']('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x39d904,_0x352fce[_0xd7c9('0x1c')]);_0x5d1b30[_0xd7c9('0x12')]();}}}catch(_0x5811fa){logger[_0xd7c9('0xe')](_0xd7c9('0xf'),_0x39d904,JSON[_0xd7c9('0x1d')](_0x5811fa));_0x5d1b30['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 3f43a03..69e3768 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 _0xa378=['next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','map','message','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xa378,0xc1));var _0x8a37=function(_0x51e40a,_0x262dc6){_0x51e40a=_0x51e40a-0x0;var _0x53c323=_0xa378[_0x51e40a];return _0x53c323;};'use strict';var schema=require(_0x8a37('0x0'));var _=require(_0x8a37('0x1'));var logger=require(_0x8a37('0x2'))(_0x8a37('0x3'));var gotop=schema({'priority':{'type':_0x8a37('0x4'),'required':!![],'message':_0x8a37('0x5')}});exports[_0x8a37('0x6')]=function(_0x4d0afa,_0x502b60){return function(_0x837aa1){try{var _0x71c11e={'priority':_0x502b60[0x0]};var _0x1e5418=gotop[_0x8a37('0x0')](_0x71c11e,{'typecast':!![]});if(_0x1e5418[_0x8a37('0x7')]){logger[_0x8a37('0x8')]('[%s][GOTOP]\x20%s',_0x4d0afa,_[_0x8a37('0x9')](_0x1e5418,_0x8a37('0xa'))['join'](',\x20'));_0x837aa1[_0x8a37('0xb')]();}else{logger['info'](_0x8a37('0xc'),_0x4d0afa,_0x71c11e[_0x8a37('0xd')]);if(_0x71c11e[_0x8a37('0xd')]){var _0x1c1d00=_[_0x8a37('0xe')](_0x837aa1['rules'](),{'p':_0x71c11e[_0x8a37('0xd')]});if(_0x1c1d00>=0x0){logger[_0x8a37('0xf')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4d0afa,_0x71c11e['priority']||_0x8a37('0x10'),_0x1c1d00);_0x837aa1[_0x8a37('0x10')](_0x1c1d00);}else{logger[_0x8a37('0xf')](_0x8a37('0x11'),_0x4d0afa,_0x71c11e['priority']||_0x8a37('0x10'));_0x837aa1[_0x8a37('0xb')]();}}else{_0x837aa1[_0x8a37('0x10')]();}}}catch(_0x54c45e){logger[_0x8a37('0x8')](_0x8a37('0x12'),_0x4d0afa,JSON['stringify'](_0x54c45e));_0x837aa1[_0x8a37('0xb')]();}};}; \ No newline at end of file +var _0xa8fc=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','error','[%s][GOTOP]\x20%s','map'];(function(_0x337376,_0x16af59){var _0x52c0c3=function(_0x554576){while(--_0x554576){_0x337376['push'](_0x337376['shift']());}};_0x52c0c3(++_0x16af59);}(_0xa8fc,0x14b));var _0xca8f=function(_0xfaac52,_0x1fa8fc){_0xfaac52=_0xfaac52-0x0;var _0x4e1593=_0xa8fc[_0xfaac52];return _0x4e1593;};'use strict';var schema=require(_0xca8f('0x0'));var _=require(_0xca8f('0x1'));var logger=require(_0xca8f('0x2'))(_0xca8f('0x3'));var gotop=schema({'priority':{'type':_0xca8f('0x4'),'required':!![],'message':_0xca8f('0x5')}});exports['consequence']=function(_0x427b3c,_0x6e1677){return function(_0x3f70ec){try{var _0x1946b4={'priority':_0x6e1677[0x0]};var _0x322092=gotop[_0xca8f('0x0')](_0x1946b4,{'typecast':!![]});if(_0x322092['length']){logger[_0xca8f('0x6')](_0xca8f('0x7'),_0x427b3c,_[_0xca8f('0x8')](_0x322092,'message')[_0xca8f('0x9')](',\x20'));_0x3f70ec[_0xca8f('0xa')]();}else{logger[_0xca8f('0xb')](_0xca8f('0xc'),_0x427b3c,_0x1946b4['priority']);if(_0x1946b4['priority']){var _0x43a260=_[_0xca8f('0xd')](_0x3f70ec[_0xca8f('0xe')](),{'p':_0x1946b4[_0xca8f('0xf')]});if(_0x43a260>=0x0){logger[_0xca8f('0xb')](_0xca8f('0x10'),_0x427b3c,_0x1946b4['priority']||_0xca8f('0x11'),_0x43a260);_0x3f70ec[_0xca8f('0x11')](_0x43a260);}else{logger['info'](_0xca8f('0x12'),_0x427b3c,_0x1946b4[_0xca8f('0xf')]||_0xca8f('0x11'));_0x3f70ec[_0xca8f('0xa')]();}}else{_0x3f70ec[_0xca8f('0x11')]();}}}catch(_0x26a822){logger[_0xca8f('0x6')](_0xca8f('0x7'),_0x427b3c,JSON[_0xca8f('0x13')](_0x26a822));_0x3f70ec[_0xca8f('0xa')]();}};}; \ 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 43c516b..7d365b4 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 _0xb12d=['consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','interaction','Message','then','info','body','next','[%s][MESSAGE]\x20%s','stringify','error','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0x1869a6,_0x52f442){var _0x2a1450=function(_0x52aa23){while(--_0x52aa23){_0x1869a6['push'](_0x1869a6['shift']());}};_0x2a1450(++_0x52f442);}(_0xb12d,0x124));var _0xdb12=function(_0x4169d8,_0x3d7cd4){_0x4169d8=_0x4169d8-0x0;var _0x32084a=_0xb12d[_0x4169d8];return _0x32084a;};'use strict';var _=require(_0xdb12('0x0'));var utils=require(_0xdb12('0x1'));var logger=require(_0xdb12('0x2'))('routing');var rpc={'chatMessage':require(_0xdb12('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xdb12('0x4')),'smsMessage':require(_0xdb12('0x5')),'faxMessage':require(_0xdb12('0x6')),'whatsappMessage':require(_0xdb12('0x7'))};exports[_0xdb12('0x8')]=function(_0x15ac3f,_0x4c69e0){return function(_0x16666d){try{var _0x19e73f={'body':utils[_0xdb12('0x9')](_0x4c69e0[0x0],this),'ContactId':this[_0xdb12('0xa')]['id']};if(this[_0xdb12('0xb')]===_0xdb12('0xc')){_0x19e73f[_0xdb12('0xd')]=this[_0xdb12('0xe')]['id'];}else{_0x19e73f[_['upperFirst'](this[_0xdb12('0xb')])+'AccountId']=this[_0xdb12('0xe')]['id'];}_0x19e73f[_[_0xdb12('0xf')](this[_0xdb12('0xb')])+'InteractionId']=this[_0xdb12('0x10')]['id'];if(rpc[this[_0xdb12('0xb')]+_0xdb12('0x11')]){return rpc[this['channel']+_0xdb12('0x11')]['create'](_0x19e73f)[_0xdb12('0x12')](function(_0x127a69){logger[_0xdb12('0x13')]('[%s][MESSAGE]\x20%s',_0x15ac3f,_0x19e73f[_0xdb12('0x14')]);_0x16666d[_0xdb12('0x15')]();})['catch'](function(_0x44b39c){logger['error'](_0xdb12('0x16'),_0x15ac3f,JSON[_0xdb12('0x17')](_0x44b39c));_0x16666d['stop']();});}}catch(_0x1dc8b8){logger[_0xdb12('0x18')](_0xdb12('0x16'),_0x15ac3f,JSON[_0xdb12('0x17')](_0x1dc8b8));_0x16666d['stop']();}};}; \ No newline at end of file +var _0xae88=['consequence','getMustacheRender','channel','chat','account','upperFirst','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage'];(function(_0x795c10,_0x56d5c5){var _0x3773fc=function(_0x5028df){while(--_0x5028df){_0x795c10['push'](_0x795c10['shift']());}};_0x3773fc(++_0x56d5c5);}(_0xae88,0xa1));var _0x8ae8=function(_0x28a082,_0x35ffd7){_0x28a082=_0x28a082-0x0;var _0x2255e0=_0xae88[_0x28a082];return _0x2255e0;};'use strict';var _=require(_0x8ae8('0x0'));var utils=require(_0x8ae8('0x1'));var logger=require(_0x8ae8('0x2'))(_0x8ae8('0x3'));var rpc={'chatMessage':require(_0x8ae8('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x8ae8('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x8ae8('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x8ae8('0x7')]=function(_0x4e29bb,_0x334c5b){return function(_0x523f79){try{var _0x2f7127={'body':utils[_0x8ae8('0x8')](_0x334c5b[0x0],this),'ContactId':this['contact']['id']};if(this[_0x8ae8('0x9')]===_0x8ae8('0xa')){_0x2f7127['ChatWebsiteId']=this[_0x8ae8('0xb')]['id'];}else{_0x2f7127[_[_0x8ae8('0xc')](this[_0x8ae8('0x9')])+'AccountId']=this[_0x8ae8('0xb')]['id'];}_0x2f7127[_['upperFirst'](this['channel'])+_0x8ae8('0xd')]=this[_0x8ae8('0xe')]['id'];if(rpc[this[_0x8ae8('0x9')]+_0x8ae8('0xf')]){return rpc[this[_0x8ae8('0x9')]+_0x8ae8('0xf')]['create'](_0x2f7127)[_0x8ae8('0x10')](function(_0xca6f82){logger[_0x8ae8('0x11')](_0x8ae8('0x12'),_0x4e29bb,_0x2f7127['body']);_0x523f79[_0x8ae8('0x13')]();})[_0x8ae8('0x14')](function(_0x30b12c){logger[_0x8ae8('0x15')](_0x8ae8('0x12'),_0x4e29bb,JSON[_0x8ae8('0x16')](_0x30b12c));_0x523f79[_0x8ae8('0x17')]();});}}catch(_0x1eb2a9){logger[_0x8ae8('0x15')]('[%s][MESSAGE]\x20%s',_0x4e29bb,JSON['stringify'](_0x1eb2a9));_0x523f79[_0x8ae8('0x17')]();}};}; \ 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 7c92515..7dc8274 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 _0x61bc=['next','error','[%s][NOOP]\x20%s','stringify','stop','../../../../config/logger','routing','consequence','info','getMustacheRender'];(function(_0x3b64fa,_0x1b7f87){var _0x2ed774=function(_0x41f2d7){while(--_0x41f2d7){_0x3b64fa['push'](_0x3b64fa['shift']());}};_0x2ed774(++_0x1b7f87);}(_0x61bc,0x9b));var _0xc61b=function(_0x207984,_0x4101c2){_0x207984=_0x207984-0x0;var _0xd56e3d=_0x61bc[_0x207984];return _0xd56e3d;};'use strict';var utils=require('./utils');var logger=require(_0xc61b('0x0'))(_0xc61b('0x1'));exports[_0xc61b('0x2')]=function(_0x2dff2f,_0x1fac24){return function(_0x144e28){try{logger[_0xc61b('0x3')]('[%s][NOOP]\x20%s',_0x2dff2f,utils[_0xc61b('0x4')](_0x1fac24[0x0],this));_0x144e28[_0xc61b('0x5')]();}catch(_0x1bfa8d){logger[_0xc61b('0x6')](_0xc61b('0x7'),_0x2dff2f,JSON[_0xc61b('0x8')](_0x1bfa8d));_0x144e28[_0xc61b('0x9')]();}};}; \ No newline at end of file +var _0x2aba=['info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils','routing'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x2aba,0x1c9));var _0xa2ab=function(_0x55cc88,_0x3f98ca){_0x55cc88=_0x55cc88-0x0;var _0x44dfa4=_0x2aba[_0x55cc88];return _0x44dfa4;};'use strict';var utils=require(_0xa2ab('0x0'));var logger=require('../../../../config/logger')(_0xa2ab('0x1'));exports['consequence']=function(_0x2f69c7,_0xb31cda){return function(_0x1eeb95){try{logger[_0xa2ab('0x2')]('[%s][NOOP]\x20%s',_0x2f69c7,utils[_0xa2ab('0x3')](_0xb31cda[0x0],this));_0x1eeb95[_0xa2ab('0x4')]();}catch(_0x5a6e25){logger[_0xa2ab('0x5')](_0xa2ab('0x6'),_0x2f69c7,JSON[_0xa2ab('0x7')](_0x5a6e25));_0x1eeb95[_0xa2ab('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 59fb67b..5fc4401 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 _0x337f=['rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','localhost','redis','queue','from','joinAt','emit','clone','queue_id','account','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','upperFirst','channel','interaction','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','accepted','update','catch','timeout','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','find','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x337f,0x11c));var _0xf337=function(_0x37e65f,_0x413059){_0x37e65f=_0x37e65f-0x0;var _0x4afff1=_0x337f[_0x37e65f];return _0x4afff1;};'use strict';var schema=require(_0xf337('0x0'));var _=require(_0xf337('0x1'));var util=require(_0xf337('0x2'));var seqqueue=require('seq-queue');var moment=require(_0xf337('0x3'));var Redis=require(_0xf337('0x4'));var config=require(_0xf337('0x5'));var logger=require('../../../../config/logger')(_0xf337('0x6'));var strategy=require(_0xf337('0x7'));config['redis']=_[_0xf337('0x8')](config['redis'],{'host':_0xf337('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf337('0xa')]));var attributes=['id','queue_id','account',_0xf337('0xb'),_0xf337('0xc'),_0xf337('0xd')];function emit(_0x2a4619,_0x31d704,_0x30936f){io['to'](_0x2a4619)[_0xf337('0xe')](_0x31d704,_0x30936f);}function emitChannelQueueInteraction(_0xca609b,_0x55ed61,_0x432c09,_0x9d0f24,_0x4013f6,_0x1c716e,_0x14358b,_0x269857){var _0x3be783=_[_0xf337('0xf')](_0x432c09);_0x3be783[_0xf337('0x10')]=_0x269857;_0x3be783[_0xf337('0xb')]=_0x55ed61;_0x3be783[_0xf337('0x11')]=_0x9d0f24;_0x3be783['id']=_0x4013f6;if(_0x1c716e){_0x14358b[util[_0xf337('0x12')]('%sQueuesWaitingInteractions',_0xca609b)][_0x4013f6]=_[_0xf337('0x13')](_0x3be783,attributes);}else{delete _0x14358b[util[_0xf337('0x12')](_0xf337('0x14'),_0xca609b)][_0x4013f6];}emit(util['format'](_0xf337('0x15'),_0xca609b,_0x55ed61),util[_0xf337('0x12')]('%s_queue_waiting_interaction:%s',_0xca609b,_0x1c716e?_0xf337('0x16'):_0xf337('0x17')),_[_0xf337('0x13')](_0x3be783,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xf337('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xf337('0x19')),'faxQueueReport':require(_0xf337('0x1a')),'whatsappQueueReport':require(_0xf337('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xf337('0x1c'),'message':_0xf337('0x1d')}});function startRouting(_0x193607,_0x68e72b,_0x8858fe,_0xf212b6){if(_0x193607&&_0x68e72b&&_0x8858fe){_0x68e72b[_0xf337('0x1e')]+=0x1;var _0x240612={'uniqueid':_0x193607,'from':_0x8858fe[_0xf337('0x1f')]?_0x8858fe[_0xf337('0x1f')][_0xf337('0xc')]:'','joinAt':moment()[_0xf337('0x12')](_0xf337('0x20')),'ContactId':_0x8858fe['contact']?_0x8858fe[_0xf337('0x21')]['id']:null,'ListId':_0x8858fe['list']?_0x8858fe['list']['id']:null};_0x240612[_[_0xf337('0x22')](_0x8858fe[_0xf337('0x23')])+'QueueId']=_0x68e72b['id']||null;_0x240612[_[_0xf337('0x22')](_0x8858fe[_0xf337('0x23')])+'InteractionId']=_0x8858fe['interaction']?_0x8858fe[_0xf337('0x24')]['id']:null;_0x240612[_['upperFirst'](_0x8858fe['channel'])+'MessageId']=_0x8858fe[_0xf337('0x25')]?_0x8858fe['message']['id']:null;_0x240612[_['upperFirst'](_0x8858fe[_0xf337('0x23')])+(_0x8858fe[_0xf337('0x23')]!=='chat'?'AccountId':_0xf337('0x26'))]=_0x8858fe[_0xf337('0x11')]?_0x8858fe[_0xf337('0x11')]['id']:null;logger[_0xf337('0x27')](util['format'](_0xf337('0x28'),_0x193607,_0x68e72b[_0xf337('0x29')]));emitChannelQueueInteraction(_0x8858fe[_0xf337('0x23')],_0x68e72b[_0xf337('0x29')],_0x240612,_0x8858fe[_0xf337('0x11')][_0xf337('0x29')],_0x8858fe['message']['id'],!![],_0xf212b6,_0x68e72b['id']);if(rpc[_0x8858fe[_0xf337('0x23')]+_0xf337('0x2a')]){return rpc[_0x8858fe[_0xf337('0x23')]+_0xf337('0x2a')][_0xf337('0x2b')](_0x240612)['catch'](function(_0x27f0f7){logger[_0xf337('0x2c')](_0xf337('0x2d'));});}}}function stopRouting(_0x485e2e,_0x326b2d,_0x30a2c8,_0x9bb07){if(_0x485e2e&&_0x326b2d){_0x326b2d[_0xf337('0x1e')]-=0x1;var _0x2bc127={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format'](_0xf337('0x20')),'reason':_0xf337('0x2e')};logger[_0xf337('0x27')](util[_0xf337('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x485e2e,_0x326b2d[_0xf337('0x29')]));emitChannelQueueInteraction(_0x30a2c8['channel'],_0x326b2d[_0xf337('0x29')],_0x30a2c8[_0xf337('0x1f')],_0x30a2c8[_0xf337('0x11')][_0xf337('0x29')],_0x30a2c8[_0xf337('0x25')]['id'],![],_0x9bb07,_0x326b2d['id']);if(rpc[_0x30a2c8[_0xf337('0x23')]+_0xf337('0x2a')]){return rpc[_0x30a2c8['channel']+_0xf337('0x2a')][_0xf337('0x2f')](_0x485e2e,_0x2bc127)[_0xf337('0x30')](function(_0x1e9347){logger[_0xf337('0x2c')]('update\x20queue\x20report');});}}}function endRouting(_0x314dc9,_0x2a5d6a,_0x50f4e4,_0x1ef800){if(_0x314dc9&&_0x2a5d6a){_0x2a5d6a[_0xf337('0x1e')]-=0x1;var _0x2b4009={'leaveAt':moment()['format'](_0xf337('0x20')),'exitAt':moment()[_0xf337('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xf337('0x31')};logger['info'](util[_0xf337('0x12')]('[%s][END:QUEUE][NAME:%s]',_0x314dc9,_0x2a5d6a[_0xf337('0x29')]));emitChannelQueueInteraction(_0x50f4e4[_0xf337('0x23')],_0x2a5d6a[_0xf337('0x29')],_0x50f4e4[_0xf337('0x1f')],_0x50f4e4[_0xf337('0x11')][_0xf337('0x29')],_0x50f4e4['message']['id'],![],_0x1ef800);if(rpc[_0x50f4e4['channel']+_0xf337('0x2a')]){return rpc[_0x50f4e4[_0xf337('0x23')]+_0xf337('0x2a')][_0xf337('0x2f')](_0x314dc9,_0x2b4009)[_0xf337('0x30')](function(_0x150bd9){logger[_0xf337('0x2c')](_0xf337('0x32'));});}}}function handleFindQueue(_0x4f7caf){return function(_0x38cbb5){return _0x38cbb5[_0xf337('0x29')][_0xf337('0x33')]()===_0x4f7caf[_0xf337('0x33')]();};}exports['consequence']=function(_0x57fcb0,_0x106cae,_0x45bc59,_0x58453e){return function(_0x207668){try{var _0x213cf0={'name':_0x106cae[0x0],'timeout':_0x106cae[0x1]};var _0x246ab9=queue[_0xf337('0x0')](_0x213cf0,{'typecast':!![]});if(_0x246ab9['length']){logger[_0xf337('0x2c')](_0xf337('0x34'),_0x57fcb0,_[_0xf337('0x35')](_0x246ab9,_0xf337('0x25'))[_0xf337('0x36')](',\x20'));_0x207668[_0xf337('0x37')]();}else{var _0x12b503=_[_0xf337('0x38')](_0x45bc59[_0x58453e[_0xf337('0x23')]+'Queues'],handleFindQueue(_0x213cf0['name']));if(_0x12b503){startRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);var _0x1a57a4=(_0x12b503['timeout']||0xa)*0x3e8;var _0x2f9f8b=(_0x213cf0[_0xf337('0x31')]||0x14)*0x3e8;var _0x3de8c2,_0x328484;if(_0x1a57a4>_0x2f9f8b){_0x2f9f8b=_0x1a57a4;}var _0x486d3e=seqqueue['createQueue'](_0x1a57a4);_0x486d3e['id']=_0x57fcb0;_0x486d3e[_0xf337('0x39')]=_0x1a57a4;_0x486d3e[_0xf337('0x3a')]=_0x2f9f8b;_0x486d3e['channel']=_0x58453e['channel'];_0x45bc59[_0xf337('0x3b')][_0x57fcb0]['on'](_0xf337('0x3c'),function(){logger[_0xf337('0x27')](_0xf337('0x3d'),_0x57fcb0);stopRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);clearTimeout(_0x3de8c2);_0x3de8c2=undefined;_0x486d3e[_0xf337('0x3e')](!![]);if(_0x45bc59[_0xf337('0x3b')][_0x57fcb0]){delete _0x45bc59[_0xf337('0x3b')][_0x57fcb0];}_0x207668['stop']();});_0x45bc59['rules'][_0x57fcb0]['on'](_0xf337('0x3f'),function(){if(_0x45bc59[_0xf337('0x3b')][_0x57fcb0]){delete _0x45bc59[_0xf337('0x3b')][_0x57fcb0];}});_0x3de8c2=setTimeout(function(){logger[_0xf337('0x27')](_0xf337('0x40'),_0x57fcb0);endRouting(_0x57fcb0,_0x12b503,_0x58453e,_0x45bc59);clearTimeout(_0x3de8c2);_0x486d3e[_0xf337('0x3e')](!![]);_0x207668['next']();},_0x2f9f8b);switch(_0x12b503[_0xf337('0x41')]){case _0xf337('0x42'):strategy[_0xf337('0x42')](_0x486d3e,_0x12b503,_0x45bc59,_0x58453e);break;default:strategy['beepall'](_0x486d3e,_0x12b503,_0x45bc59,_0x58453e);}}else{logger[_0xf337('0x2c')](_0xf337('0x43'),_0x57fcb0,_0x213cf0['name']);_0x207668[_0xf337('0x37')]();}}}catch(_0x3999f5){console[_0xf337('0x44')](_0x3999f5);logger[_0xf337('0x2c')](_0xf337('0x34'),_0x57fcb0,_0x3999f5[_0xf337('0x45')]);_0x207668[_0xf337('0x37')]();}};}; \ No newline at end of file +var _0x6478=['emit','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','QueueReport','update','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x6478,0x1e7));var _0x8647=function(_0x1db923,_0x426bc8){_0x1db923=_0x1db923-0x0;var _0x2bf565=_0x6478[_0x1db923];return _0x2bf565;};'use strict';var schema=require(_0x8647('0x0'));var _=require(_0x8647('0x1'));var util=require(_0x8647('0x2'));var seqqueue=require(_0x8647('0x3'));var moment=require(_0x8647('0x4'));var Redis=require(_0x8647('0x5'));var config=require('../../../../config/environment');var logger=require(_0x8647('0x6'))(_0x8647('0x7'));var strategy=require(_0x8647('0x8'));config[_0x8647('0x9')]=_['defaults'](config['redis'],{'host':_0x8647('0xa'),'port':0x18eb});var io=require(_0x8647('0xb'))(new Redis(config[_0x8647('0x9')]));var attributes=['id',_0x8647('0xc'),_0x8647('0xd'),_0x8647('0xe'),_0x8647('0xf'),_0x8647('0x10')];function emit(_0x430976,_0x3db897,_0x30480b){io['to'](_0x430976)[_0x8647('0x11')](_0x3db897,_0x30480b);}function emitChannelQueueInteraction(_0x406b1d,_0x2e27ba,_0x408549,_0x1bc120,_0xfb9739,_0xdb17a4,_0x183386,_0x5f1f3a){var _0x11e9d0=_['clone'](_0x408549);_0x11e9d0[_0x8647('0xc')]=_0x5f1f3a;_0x11e9d0[_0x8647('0xe')]=_0x2e27ba;_0x11e9d0[_0x8647('0xd')]=_0x1bc120;_0x11e9d0['id']=_0xfb9739;if(_0xdb17a4){_0x183386[util[_0x8647('0x12')](_0x8647('0x13'),_0x406b1d)][_0xfb9739]=_['pick'](_0x11e9d0,attributes);}else{delete _0x183386[util[_0x8647('0x12')](_0x8647('0x13'),_0x406b1d)][_0xfb9739];}emit(util[_0x8647('0x12')](_0x8647('0x14'),_0x406b1d,_0x2e27ba),util['format']('%s_queue_waiting_interaction:%s',_0x406b1d,_0xdb17a4?_0x8647('0x15'):_0x8647('0x16')),_[_0x8647('0x17')](_0x11e9d0,attributes));}var rpc={'openchannelQueueReport':require(_0x8647('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x8647('0x19')),'faxQueueReport':require(_0x8647('0x1a')),'whatsappQueueReport':require(_0x8647('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x8647('0x1c')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x4c2b83,_0xfaed66,_0x49792e,_0x5cc1b1){if(_0x4c2b83&&_0xfaed66&&_0x49792e){_0xfaed66[_0x8647('0x1d')]+=0x1;var _0x2a6747={'uniqueid':_0x4c2b83,'from':_0x49792e[_0x8647('0x1e')]?_0x49792e[_0x8647('0x1e')][_0x8647('0xf')]:'','joinAt':moment()[_0x8647('0x12')](_0x8647('0x1f')),'ContactId':_0x49792e[_0x8647('0x20')]?_0x49792e[_0x8647('0x20')]['id']:null,'ListId':_0x49792e[_0x8647('0x21')]?_0x49792e[_0x8647('0x21')]['id']:null};_0x2a6747[_['upperFirst'](_0x49792e[_0x8647('0x22')])+_0x8647('0x23')]=_0xfaed66['id']||null;_0x2a6747[_[_0x8647('0x24')](_0x49792e['channel'])+'InteractionId']=_0x49792e[_0x8647('0x25')]?_0x49792e[_0x8647('0x25')]['id']:null;_0x2a6747[_[_0x8647('0x24')](_0x49792e['channel'])+_0x8647('0x26')]=_0x49792e[_0x8647('0x27')]?_0x49792e['message']['id']:null;_0x2a6747[_[_0x8647('0x24')](_0x49792e[_0x8647('0x22')])+(_0x49792e[_0x8647('0x22')]!=='chat'?'AccountId':_0x8647('0x28'))]=_0x49792e[_0x8647('0xd')]?_0x49792e[_0x8647('0xd')]['id']:null;logger[_0x8647('0x29')](util[_0x8647('0x12')](_0x8647('0x2a'),_0x4c2b83,_0xfaed66[_0x8647('0x2b')]));emitChannelQueueInteraction(_0x49792e[_0x8647('0x22')],_0xfaed66['name'],_0x2a6747,_0x49792e[_0x8647('0xd')][_0x8647('0x2b')],_0x49792e[_0x8647('0x27')]['id'],!![],_0x5cc1b1,_0xfaed66['id']);if(rpc[_0x49792e[_0x8647('0x22')]+'QueueReport']){return rpc[_0x49792e[_0x8647('0x22')]+'QueueReport'][_0x8647('0x2c')](_0x2a6747)[_0x8647('0x2d')](function(_0x34163a){logger[_0x8647('0x2e')](_0x8647('0x2f'));});}}}function stopRouting(_0xb85653,_0x299bb8,_0x321cab,_0x2bbde9){if(_0xb85653&&_0x299bb8){_0x299bb8['waiting']-=0x1;var _0x1b8b7c={'leaveAt':moment()[_0x8647('0x12')](_0x8647('0x1f')),'acceptAt':moment()[_0x8647('0x12')](_0x8647('0x1f')),'reason':'accepted'};logger[_0x8647('0x29')](util[_0x8647('0x12')](_0x8647('0x30'),_0xb85653,_0x299bb8[_0x8647('0x2b')]));emitChannelQueueInteraction(_0x321cab[_0x8647('0x22')],_0x299bb8[_0x8647('0x2b')],_0x321cab[_0x8647('0x1e')],_0x321cab[_0x8647('0xd')]['name'],_0x321cab[_0x8647('0x27')]['id'],![],_0x2bbde9,_0x299bb8['id']);if(rpc[_0x321cab[_0x8647('0x22')]+_0x8647('0x31')]){return rpc[_0x321cab[_0x8647('0x22')]+_0x8647('0x31')][_0x8647('0x32')](_0xb85653,_0x1b8b7c)[_0x8647('0x2d')](function(_0x5ba7f6){logger['error'](_0x8647('0x33'));});}}}function endRouting(_0x3125c0,_0x3efa39,_0x57f1b6,_0x137d43){if(_0x3125c0&&_0x3efa39){_0x3efa39[_0x8647('0x1d')]-=0x1;var _0x2f4d36={'leaveAt':moment()[_0x8647('0x12')](_0x8647('0x1f')),'exitAt':moment()[_0x8647('0x12')](_0x8647('0x1f')),'reason':'timeout'};logger[_0x8647('0x29')](util[_0x8647('0x12')](_0x8647('0x34'),_0x3125c0,_0x3efa39['name']));emitChannelQueueInteraction(_0x57f1b6[_0x8647('0x22')],_0x3efa39[_0x8647('0x2b')],_0x57f1b6['body'],_0x57f1b6[_0x8647('0xd')][_0x8647('0x2b')],_0x57f1b6[_0x8647('0x27')]['id'],![],_0x137d43);if(rpc[_0x57f1b6[_0x8647('0x22')]+_0x8647('0x31')]){return rpc[_0x57f1b6[_0x8647('0x22')]+_0x8647('0x31')][_0x8647('0x32')](_0x3125c0,_0x2f4d36)[_0x8647('0x2d')](function(_0x1000a1){logger[_0x8647('0x2e')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x43c4d4){return function(_0x3942ab){return _0x3942ab['name'][_0x8647('0x35')]()===_0x43c4d4[_0x8647('0x35')]();};}exports['consequence']=function(_0x5a5e71,_0x1f626f,_0x5eedf2,_0x4698c0){return function(_0x371e49){try{var _0x53e09e={'name':_0x1f626f[0x0],'timeout':_0x1f626f[0x1]};var _0x276ad3=queue[_0x8647('0x0')](_0x53e09e,{'typecast':!![]});if(_0x276ad3[_0x8647('0x36')]){logger[_0x8647('0x2e')](_0x8647('0x37'),_0x5a5e71,_[_0x8647('0x38')](_0x276ad3,'message')['join'](',\x20'));_0x371e49[_0x8647('0x39')]();}else{var _0x396f74=_[_0x8647('0x3a')](_0x5eedf2[_0x4698c0[_0x8647('0x22')]+_0x8647('0x3b')],handleFindQueue(_0x53e09e[_0x8647('0x2b')]));if(_0x396f74){startRouting(_0x5a5e71,_0x396f74,_0x4698c0,_0x5eedf2);var _0x3749de=(_0x396f74[_0x8647('0x3c')]||0xa)*0x3e8;var _0x4b227e=(_0x53e09e[_0x8647('0x3c')]||0x14)*0x3e8;var _0x4d9b6b,_0x3040c7;if(_0x3749de>_0x4b227e){_0x4b227e=_0x3749de;}var _0x4e8c04=seqqueue[_0x8647('0x3d')](_0x3749de);_0x4e8c04['id']=_0x5a5e71;_0x4e8c04['atimeout']=_0x3749de;_0x4e8c04['qtimeout']=_0x4b227e;_0x4e8c04[_0x8647('0x22')]=_0x4698c0[_0x8647('0x22')];_0x5eedf2[_0x8647('0x3e')][_0x5a5e71]['on']('end',function(){logger[_0x8647('0x29')](_0x8647('0x3f'),_0x5a5e71);stopRouting(_0x5a5e71,_0x396f74,_0x4698c0,_0x5eedf2);clearTimeout(_0x4d9b6b);_0x4d9b6b=undefined;_0x4e8c04[_0x8647('0x40')](!![]);if(_0x5eedf2[_0x8647('0x3e')][_0x5a5e71]){delete _0x5eedf2[_0x8647('0x3e')][_0x5a5e71];}_0x371e49[_0x8647('0x39')]();});_0x5eedf2[_0x8647('0x3e')][_0x5a5e71]['on'](_0x8647('0x41'),function(){if(_0x5eedf2[_0x8647('0x3e')][_0x5a5e71]){delete _0x5eedf2[_0x8647('0x3e')][_0x5a5e71];}});_0x4d9b6b=setTimeout(function(){logger[_0x8647('0x29')](_0x8647('0x42'),_0x5a5e71);endRouting(_0x5a5e71,_0x396f74,_0x4698c0,_0x5eedf2);clearTimeout(_0x4d9b6b);_0x4e8c04[_0x8647('0x40')](!![]);_0x371e49[_0x8647('0x43')]();},_0x4b227e);switch(_0x396f74['strategy']){case _0x8647('0x44'):strategy[_0x8647('0x44')](_0x4e8c04,_0x396f74,_0x5eedf2,_0x4698c0);break;default:strategy[_0x8647('0x45')](_0x4e8c04,_0x396f74,_0x5eedf2,_0x4698c0);}}else{logger[_0x8647('0x2e')](_0x8647('0x46'),_0x5a5e71,_0x53e09e[_0x8647('0x2b')]);_0x371e49['stop']();}}}catch(_0x327995){console['log'](_0x327995);logger[_0x8647('0x2e')](_0x8647('0x37'),_0x5a5e71,_0x327995[_0x8647('0x47')]);_0x371e49[_0x8647('0x39')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/agent.js b/server/services/routing/server/applications/strategy/agent.js index 141dafa..1424e7f 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 _0x3d4f=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','debug','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','writeLog','RINGING'];(function(_0xc9fef,_0x5c422e){var _0x41cc04=function(_0x2fa453){while(--_0x2fa453){_0xc9fef['push'](_0xc9fef['shift']());}};_0x41cc04(++_0x5c422e);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x5837d1,_0x4661e0){_0x5837d1=_0x5837d1-0x0;var _0x43b3b7=_0x3d4f[_0x5837d1];return _0x43b3b7;};'use strict';var _=require(_0xf3d4('0x0'));var uuid=require(_0xf3d4('0x1'));var util=require(_0xf3d4('0x2'));var logger=require(_0xf3d4('0x3'))(_0xf3d4('0x4'));var Agent=function(_0x2561cd,_0x5ebfcb,_0x32ca59,_0x5cc8f7){this[_0xf3d4('0x5')]=uuid['v4']();this[_0xf3d4('0x6')]=_0x2561cd;this['agent']=_0x5ebfcb;this[_0xf3d4('0x7')]=_0x32ca59;this['routing']=_0x5cc8f7;this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this['handleTimeout'][_0xf3d4('0xa')](this));this[_0xf3d4('0x6')]['on'](_0xf3d4('0xb'),this['handleTimeout'][_0xf3d4('0xa')](this));this['squeue']['on'](_0xf3d4('0xc'),this[_0xf3d4('0xd')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0x8')]=function(){this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this[_0xf3d4('0xf')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0xd')]=function(){this[_0xf3d4('0xf')](!![]);};Agent[_0xf3d4('0xe')][_0xf3d4('0x9')]=function(){logger[_0xf3d4('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){logger[_0xf3d4('0x10')](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this[_0xf3d4('0x8')][_0xf3d4('0xa')](this),0x3e8);}else{if(this['routing'][_0xf3d4('0x15')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],this[_0xf3d4('0x6')][_0xf3d4('0x16')],![])){this['realtime']['agents'][this[_0xf3d4('0x13')]['id']]['busy']=!![];this['realtime'][_0xf3d4('0x12')][this['agent']['id']][_0xf3d4('0x17')]=undefined;util[_0xf3d4('0x18')](this[_0xf3d4('0x5')],this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],null,this[_0xf3d4('0x4')]);util[_0xf3d4('0x19')](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],_0xf3d4('0x1a')+(this[_0xf3d4('0x4')][_0xf3d4('0x15')]?':FORCED':''));}else{logger['debug'](_0xf3d4('0x1b'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this['push'][_0xf3d4('0xa')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x5d8d15){if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){return logger['debug'](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this['agent']['id']);}else{logger[_0xf3d4('0x10')](_0xf3d4('0x1c'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);util['hideNotification'](this[_0xf3d4('0x5')],this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x1d')]=![];this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x17')]=undefined;util['writeLog'](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],_0x5d8d15?'STOP':'TIMEOUT');}if(!_0x5d8d15){setTimeout(this[_0xf3d4('0x8')]['bind'](this),0x3e8);}};function agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8){return new Agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8);}module[_0xf3d4('0x1e')]=agent; \ No newline at end of file +var _0x4c8f=['./util','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','TIMEOUT','exports','lodash','uuid'];(function(_0xbdfc6e,_0x17cfdd){var _0x30d911=function(_0x11d601){while(--_0x11d601){_0xbdfc6e['push'](_0xbdfc6e['shift']());}};_0x30d911(++_0x17cfdd);}(_0x4c8f,0xd7));var _0xf4c8=function(_0x113426,_0x392950){_0x113426=_0x113426-0x0;var _0x131c6f=_0x4c8f[_0x113426];return _0x131c6f;};'use strict';var _=require(_0xf4c8('0x0'));var uuid=require(_0xf4c8('0x1'));var util=require(_0xf4c8('0x2'));var logger=require(_0xf4c8('0x3'))('routing');var Agent=function(_0x51a524,_0x580657,_0xef1e28,_0x21476f){this['notificationId']=uuid['v4']();this[_0xf4c8('0x4')]=_0x51a524;this[_0xf4c8('0x5')]=_0x580657;this[_0xf4c8('0x6')]=_0xef1e28;this[_0xf4c8('0x7')]=_0x21476f;this[_0xf4c8('0x4')][_0xf4c8('0x8')](this[_0xf4c8('0x9')][_0xf4c8('0xa')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xf4c8('0xb'),this[_0xf4c8('0xc')][_0xf4c8('0xa')](this));this[_0xf4c8('0x4')]['on'](_0xf4c8('0xd'),this[_0xf4c8('0xe')][_0xf4c8('0xa')](this));};Agent['prototype']['push']=function(){this['squeue']['push'](this['handleRun']['bind'](this),this[_0xf4c8('0xc')][_0xf4c8('0xa')](this));};Agent[_0xf4c8('0xf')]['handleDrained']=function(){this[_0xf4c8('0xc')](!![]);};Agent['prototype'][_0xf4c8('0x9')]=function(){logger['debug'](_0xf4c8('0x10'),this['squeue']['id'],this[_0xf4c8('0x5')]['id']);if(_[_0xf4c8('0x11')](this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']])){logger[_0xf4c8('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}else{if(this[_0xf4c8('0x7')][_0xf4c8('0x14')]||util[_0xf4c8('0x15')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')]['agents'][this[_0xf4c8('0x5')]['id']],this['squeue']['channel'],![])){this[_0xf4c8('0x6')]['agents'][this[_0xf4c8('0x5')]['id']][_0xf4c8('0x16')]=!![];this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']][_0xf4c8('0x17')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this['realtime'][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']],null,this[_0xf4c8('0x7')]);util[_0xf4c8('0x18')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']],_0xf4c8('0x19')+(this[_0xf4c8('0x7')][_0xf4c8('0x14')]?_0xf4c8('0x1a'):''));}else{logger[_0xf4c8('0x13')](_0xf4c8('0x1b'),this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}}};Agent['prototype'][_0xf4c8('0xc')]=function(_0x2b38a5){if(_[_0xf4c8('0x11')](this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']])){return logger[_0xf4c8('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);util[_0xf4c8('0x1c')](this['notificationId'],this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')]['agents'][this['agent']['id']],null,this[_0xf4c8('0x7')]);this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']][_0xf4c8('0x16')]=![];this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']][_0xf4c8('0x17')]=undefined;util[_0xf4c8('0x18')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']],_0x2b38a5?'STOP':_0xf4c8('0x1d'));}if(!_0x2b38a5){setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}};function agent(_0x236742,_0x1f0061,_0x25bc08,_0x3862d9){return new Agent(_0x236742,_0x1f0061,_0x25bc08,_0x3862d9);}module[_0xf4c8('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 85d6d56..aea73d6 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 _0x9099=['queue','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x9099,0x1ac));var _0x9909=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0x9099[_0x65d12e];return _0x4274e0;};'use strict';var _=require(_0x9909('0x0'));var uuid=require('uuid');var util=require(_0x9909('0x1'));var logger=require(_0x9909('0x2'))(_0x9909('0x3'));var Beepall=function(_0x2524d3,_0x3fd4b4,_0x34aabc,_0x2168ff){this[_0x9909('0x4')]=uuid['v4']();this[_0x9909('0x5')]=_0x2524d3;this[_0x9909('0x6')]=_0x3fd4b4;this[_0x9909('0x7')]=_0x34aabc;this[_0x9909('0x3')]=_0x2168ff;this[_0x9909('0x5')][_0x9909('0x8')](this['handleRun'][_0x9909('0x9')](this),this['handleTimeout']['bind'](this));this['squeue']['on']('timeout',this[_0x9909('0xa')]['bind'](this));this[_0x9909('0x5')]['on'](_0x9909('0xb'),this[_0x9909('0xc')]['bind'](this));};Beepall[_0x9909('0xd')]['push']=function(){this[_0x9909('0x5')][_0x9909('0x8')](this[_0x9909('0xe')][_0x9909('0x9')](this),this[_0x9909('0xa')][_0x9909('0x9')](this));};Beepall[_0x9909('0xd')][_0x9909('0xc')]=function(){this[_0x9909('0xa')](!![]);};Beepall[_0x9909('0xd')][_0x9909('0xe')]=function(){var _0x38c2e3=!![];if(!_[_0x9909('0xf')](this['queue'])&&!_[_0x9909('0xf')](this['queue'][_0x9909('0x10')])&&this['queue'][_0x9909('0x10')][_0x9909('0x11')]>0x0){for(var _0x245f0d=0x0,_0x4c4123;_0x245f0d0x0){for(var _0x137f51=0x0,_0x2cb435;_0x137f510x0&&_0x5e59c3[_0xc50077+_0xd7df('0x27')]>=_0x5e59c3[_0xc50077+_0xd7df('0x28')]){writeLog(_0x4eabb8,_0x5e59c3,_0xc50077[_0xd7df('0x29')]()+_0xd7df('0x2a'));return![];}}return!![];};exports[_0xd7df('0x2b')]=function(_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1){return sendNotification(!![],_0x2b6fde,_0x163904,_0x5c4d17,_0xe53f53,_0x132fd1);};exports[_0xd7df('0x2c')]=function(_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76){return sendNotification(![],_0x29f0e8,_0x29b812,_0x2aa5a8,_0x3f78fa,_0x36de76);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x814b=['getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','remove','debug','busy','BUSY','online','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','notificationSound','account','notificationShake','body','queue','msg'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x814b,0x1a2));var _0xb814=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0x814b[_0x5c0dcb];return _0x183a0e;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var utils=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));var logger=require(_0xb814('0x5'))('routing');config[_0xb814('0x6')]=_[_0xb814('0x7')](config[_0xb814('0x6')],{'host':_0xb814('0x8'),'port':0x18eb});var io=require(_0xb814('0x9'))(new Redis(config[_0xb814('0x6')]));function sendNotification(_0x53e507,_0x3b0829,_0x2e6272,_0x5c8539,_0x271af9,_0x2913a6){io['to'](util[_0xb814('0xa')](_0xb814('0xb'),_0x5c8539[_0xb814('0xc')]))[_0xb814('0xd')](_0xb814('0xe'),_0x5c8539);var _0x19aad8=_0x2913a6||{};var _0x207dbc=_0x2e6272[_0xb814('0xf')]('.');var _0x10e4a6={'uniqueid':_0x3b0829,'channel':_0x207dbc[0x0],'id':_0x207dbc[0x1],'title':_0x207dbc[0x0]+'\x20interaction','interactionId':_0x207dbc[0x2],'queue':_0x271af9?_0x271af9[_0xb814('0xc')]:null,'sound':_0x19aad8['account'][_0xb814('0x10')],'shake':_0x19aad8[_0xb814('0x11')][_0xb814('0x12')]};try{if(!_0x19aad8[_0xb814('0x13')]){_0x19aad8[_0xb814('0x13')]={};}if(_0x271af9){_0x19aad8[_0xb814('0x13')][_0xb814('0x14')]=_0x271af9;}else if(_0x19aad8[_0xb814('0x13')][_0xb814('0x14')]){delete _0x19aad8[_0xb814('0x13')][_0xb814('0x14')];}_0x10e4a6[_0xb814('0x15')]=utils[_0xb814('0x16')](_0x19aad8[_0xb814('0x11')][_0xb814('0x17')],_0x19aad8);}catch(_0x3a71d6){_0x10e4a6[_0xb814('0x15')]=_0xb814('0x18');logger[_0xb814('0x19')](util[_0xb814('0xa')](_0xb814('0x1a'),_0x3b0829,_0x3a71d6['message']));}io['to'](util[_0xb814('0xa')]('user:%s',_0x5c8539[_0xb814('0xc')]))[_0xb814('0xd')](util['format']('notification:%s',_0x53e507?'save':_0xb814('0x1b')),_0x10e4a6);}function writeLog(_0x4d5276,_0x57c128,_0xb684ea){return logger[_0xb814('0x1c')](util[_0xb814('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4d5276,_0x57c128[_0xb814('0xc')],_0xb684ea));}exports['isAgentAvailable']=function(_0x1e6393,_0x1808a3,_0x3b267e,_0x470e81){if(_0x1808a3[_0xb814('0x1d')]){writeLog(_0x1e6393,_0x1808a3,_0xb814('0x1e'));return![];}if(!_0x1808a3[_0xb814('0x1f')]){writeLog(_0x1e6393,_0x1808a3,'OFFLINE');return![];}if(_0x1808a3[_0x3b267e+_0xb814('0x20')]){writeLog(_0x1e6393,_0x1808a3,'PAUSE');return![];}if(_0x470e81&&_0x1808a3[_0xb814('0x21')](_0x3b267e+_0xb814('0x22'))&&_0x1808a3[_0xb814('0x21')](_0x3b267e+_0xb814('0x23'))){if(_0x1808a3[_0x3b267e+_0xb814('0x22')]>0x0&&_0x1808a3[_0x3b267e+_0xb814('0x23')]>=_0x1808a3[_0x3b267e+_0xb814('0x22')]){writeLog(_0x1e6393,_0x1808a3,_0x3b267e['toUpperCase']()+_0xb814('0x24'));return![];}}return!![];};exports[_0xb814('0x25')]=function(_0x1c2625,_0x349394,_0x32ed56,_0x1d5965,_0x3f0150){return sendNotification(!![],_0x1c2625,_0x349394,_0x32ed56,_0x1d5965,_0x3f0150);};exports[_0xb814('0x26')]=function(_0x5a6291,_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2){return sendNotification(![],_0x5a6291,_0x271aa8,_0x328a08,_0x52ed64,_0x9008b2);};exports[_0xb814('0x27')]=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 161f18c..1907a26 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 _0x6d66=['next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][SYSTEM]\x20%s','map','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x1fae4d,_0xc60732){var _0x24c881=function(_0x2d1ea5){while(--_0x2d1ea5){_0x1fae4d['push'](_0x1fae4d['shift']());}};_0x24c881(++_0xc60732);}(_0x6d66,0x9c));var _0x66d6=function(_0x180763,_0x4b889d){_0x180763=_0x180763-0x0;var _0x991e0c=_0x6d66[_0x180763];return _0x991e0c;};'use strict';var schema=require(_0x66d6('0x0'));var sh=require(_0x66d6('0x1'));var _=require(_0x66d6('0x2'));var utils=require(_0x66d6('0x3'));var logger=require('../../../../config/logger')(_0x66d6('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0x66d6('0x5')}});exports['consequence']=function(_0x592f76,_0x3295a9){return function(_0x43c664){try{var _0x126133={'command':_0x3295a9[0x0]};var _0xc5da3c=system[_0x66d6('0x0')](_0x126133,{'typecast':!![]});if(_0xc5da3c[_0x66d6('0x6')]){logger[_0x66d6('0x7')](_0x66d6('0x8'),_0x592f76,_[_0x66d6('0x9')](_0xc5da3c,'message')['join'](',\x20'));logger[_0x66d6('0xa')](_0x66d6('0xb'),_0x592f76);_0x43c664[_0x66d6('0xc')]();}else{var _0x702a5e=this;var _0x11fd43=utils[_0x66d6('0xd')](_0x3295a9[0x0],this);logger[_0x66d6('0xa')](_0x66d6('0xe'),_0x592f76,_0x11fd43);sh[_0x66d6('0xf')](_[_0x66d6('0x10')](_0x11fd43),function(_0x56504c,_0x337673){logger[_0x66d6('0xa')](_0x66d6('0x11'),_0x592f76,_0x56504c);if(_0x56504c==0x0){var _0x89dff5=_0x337673[_0x66d6('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3295a9[0x1])||_[_0x66d6('0x13')](_0x3295a9[0x1])){logger[_0x66d6('0xa')](_0x66d6('0x14'),_0x592f76);_0x702a5e[_0x66d6('0x15')][_0x3295a9[0x1]]=_0x89dff5;}else{logger['info'](_0x66d6('0x16'),_0x592f76,_0x3295a9[0x1],_0x89dff5);_0x702a5e[_0x66d6('0x15')][_0x3295a9[0x1]]=_0x89dff5;}}_0x43c664[_0x66d6('0xc')]();});}}catch(_0x4dab78){logger[_0x66d6('0x7')](_0x66d6('0x8'),_0x592f76,_[_0x66d6('0x17')](_0x4dab78)?JSON['stringify'](_0x4dab78):_0x4dab78);logger[_0x66d6('0xa')](_0x66d6('0xb'),_0x592f76);_0x43c664[_0x66d6('0xc')]();}};}; \ No newline at end of file +var _0xc962=['message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','./utils','../../../../config/logger','routing','string','consequence','length','error','map'];(function(_0x3fd50c,_0x1b41ed){var _0x4cebb2=function(_0x56a546){while(--_0x56a546){_0x3fd50c['push'](_0x3fd50c['shift']());}};_0x4cebb2(++_0x1b41ed);}(_0xc962,0xd3));var _0x2c96=function(_0xf1bc5e,_0x6a142b){_0xf1bc5e=_0xf1bc5e-0x0;var _0x16333d=_0xc962[_0xf1bc5e];return _0x16333d;};'use strict';var schema=require(_0x2c96('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2c96('0x1'));var logger=require(_0x2c96('0x2'))(_0x2c96('0x3'));var system=schema({'command':{'type':_0x2c96('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x2c96('0x5')]=function(_0x15cdd7,_0x509a62){return function(_0x4c1b5d){try{var _0x204391={'command':_0x509a62[0x0]};var _0x41d38e=system['validate'](_0x204391,{'typecast':!![]});if(_0x41d38e[_0x2c96('0x6')]){logger[_0x2c96('0x7')]('[%s][SYSTEM]\x20%s',_0x15cdd7,_[_0x2c96('0x8')](_0x41d38e,_0x2c96('0x9'))[_0x2c96('0xa')](',\x20'));logger[_0x2c96('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x15cdd7);_0x4c1b5d[_0x2c96('0xc')]();}else{var _0x534361=this;var _0xa6519=utils['getMustacheRender'](_0x509a62[0x0],this);logger[_0x2c96('0xb')](_0x2c96('0xd'),_0x15cdd7,_0xa6519);sh[_0x2c96('0xe')](_['trim'](_0xa6519),function(_0x285b5e,_0xc5f729){logger[_0x2c96('0xb')](_0x2c96('0xf'),_0x15cdd7,_0x285b5e);if(_0x285b5e==0x0){var _0x40f612=_0xc5f729['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x509a62[0x1])||_[_0x2c96('0x10')](_0x509a62[0x1])){logger[_0x2c96('0xb')](_0x2c96('0x11'),_0x15cdd7);_0x534361[_0x2c96('0x12')][_0x509a62[0x1]]=_0x40f612;}else{logger[_0x2c96('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x15cdd7,_0x509a62[0x1],_0x40f612);_0x534361[_0x2c96('0x12')][_0x509a62[0x1]]=_0x40f612;}}_0x4c1b5d[_0x2c96('0xc')]();});}}catch(_0x4eee9c){logger['error']('[%s][SYSTEM]\x20%s',_0x15cdd7,_['isObject'](_0x4eee9c)?JSON['stringify'](_0x4eee9c):_0x4eee9c);logger[_0x2c96('0xb')](_0x2c96('0x13'),_0x15cdd7);_0x4c1b5d[_0x2c96('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 e423eeb..9e81666 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 _0x563b=['routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x15781b,_0x4db9bb){var _0x20f955=function(_0x636ad0){while(--_0x636ad0){_0x15781b['push'](_0x15781b['shift']());}};_0x20f955(++_0x4db9bb);}(_0x563b,0x15b));var _0xb563=function(_0x26054b,_0x555485){_0x26054b=_0x26054b-0x0;var _0x58a596=_0x563b[_0x26054b];return _0x58a596;};'use strict';var schema=require(_0xb563('0x0'));var _=require(_0xb563('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xb563('0x2')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xb563('0x3')),'whatsappInteraction':require(_0xb563('0x4'))};var logger=require('../../../../config/logger')(_0xb563('0x5'));var tag=schema({'tag':{'type':_0xb563('0x6'),'required':!![],'message':_0xb563('0x7')}});exports['consequence']=function(_0xde8191,_0x5f0df4,_0x60381f,_0x2c99c6){return function(_0x3a0766){try{var _0x19cc74={'tag':_0x5f0df4[0x0]};var _0x5d8fd0=tag[_0xb563('0x0')](_0x19cc74,{'typecast':!![]});if(_0x5d8fd0[_0xb563('0x8')]){logger['error'](_0xb563('0x9'),_0xde8191,_[_0xb563('0xa')](_0x5d8fd0,_0xb563('0xb'))['join'](',\x20'));logger[_0xb563('0xc')](_0xb563('0xd'),_0xde8191);_0x3a0766[_0xb563('0xe')]();}else{var _0x34d8c3={'ids':[_0x5f0df4[0x0]]};if(rpc[_0x2c99c6[_0xb563('0xf')]+'Interaction']){rpc[_0x2c99c6[_0xb563('0xf')]+'Interaction'][_0xb563('0x10')](_0x2c99c6[_0xb563('0x11')]['id'],_0x34d8c3)[_0xb563('0x12')](function(_0x4ec16b){logger['info'](_0xb563('0x13'),_0xde8191,_0x5f0df4[0x1],_0x2c99c6[_0xb563('0xf')],_0x2c99c6[_0xb563('0x11')]['id']);})[_0xb563('0x14')](function(_0x31d0b4){logger['error'](_0xb563('0x9'),_0xde8191,JSON[_0xb563('0x15')](_0x31d0b4));logger[_0xb563('0xc')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xde8191);})['finally'](function(){_0x3a0766['next']();});}}}catch(_0x5dca1b){logger['error'](_0xb563('0x9'),_0xde8191,_['isObject'](_0x5dca1b)?JSON[_0xb563('0x15')](_0x5dca1b):_0x5dca1b);logger[_0xb563('0xc')](_0xb563('0xd'),_0xde8191);_0x3a0766[_0xb563('0xe')]();}};}; \ No newline at end of file +var _0xfa07=['addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','next','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfa07,0x165));var _0x7fa0=function(_0xad4991,_0x2de76b){_0xad4991=_0xad4991-0x0;var _0xf04b07=_0xfa07[_0xad4991];return _0xf04b07;};'use strict';var schema=require('validate');var _=require(_0x7fa0('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7fa0('0x1')),'smsInteraction':require(_0x7fa0('0x2')),'mailInteraction':require(_0x7fa0('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x7fa0('0x4'))};var logger=require(_0x7fa0('0x5'))(_0x7fa0('0x6'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7fa0('0x7')}});exports[_0x7fa0('0x8')]=function(_0x17a668,_0x18d644,_0x206266,_0x1e6ce0){return function(_0x737472){try{var _0x5af283={'tag':_0x18d644[0x0]};var _0xf6df1a=tag['validate'](_0x5af283,{'typecast':!![]});if(_0xf6df1a[_0x7fa0('0x9')]){logger[_0x7fa0('0xa')](_0x7fa0('0xb'),_0x17a668,_[_0x7fa0('0xc')](_0xf6df1a,'message')['join'](',\x20'));logger[_0x7fa0('0xd')](_0x7fa0('0xe'),_0x17a668);_0x737472['next']();}else{var _0x22cfab={'ids':[_0x18d644[0x0]]};if(rpc[_0x1e6ce0[_0x7fa0('0xf')]+_0x7fa0('0x10')]){rpc[_0x1e6ce0[_0x7fa0('0xf')]+_0x7fa0('0x10')][_0x7fa0('0x11')](_0x1e6ce0['interaction']['id'],_0x22cfab)['then'](function(_0x51d279){logger[_0x7fa0('0xd')](_0x7fa0('0x12'),_0x17a668,_0x18d644[0x1],_0x1e6ce0[_0x7fa0('0xf')],_0x1e6ce0['interaction']['id']);})[_0x7fa0('0x13')](function(_0x5dd892){logger[_0x7fa0('0xa')](_0x7fa0('0xb'),_0x17a668,JSON[_0x7fa0('0x14')](_0x5dd892));logger[_0x7fa0('0xd')](_0x7fa0('0xe'),_0x17a668);})['finally'](function(){_0x737472[_0x7fa0('0x15')]();});}}}catch(_0x2c13ce){logger[_0x7fa0('0xa')](_0x7fa0('0xb'),_0x17a668,_['isObject'](_0x2c13ce)?JSON[_0x7fa0('0x14')](_0x2c13ce):_0x2c13ce);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x17a668);_0x737472[_0x7fa0('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 fe689e1..454d487 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 _0x6a40=['[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','lodash','consequence','replace','\x20-\x20','includes','?params=','title','method','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','isObject','info'];(function(_0x16f10c,_0x313637){var _0x498a56=function(_0x161bfa){while(--_0x161bfa){_0x16f10c['push'](_0x16f10c['shift']());}};_0x498a56(++_0x313637);}(_0x6a40,0xda));var _0x06a4=function(_0x4fd462,_0x4d2ffd){_0x4fd462=_0x4fd462-0x0;var _0x4d773b=_0x6a40[_0x4fd462];return _0x4d773b;};'use strict';var rp=require(_0x06a4('0x0'));var logger=require(_0x06a4('0x1'))('routing');var _=require(_0x06a4('0x2'));var arr=[];exports[_0x06a4('0x3')]=function(_0x5cb8c3,_0x1899fb){return function(_0x50e3b1){var _0x2e98d3=_0x1899fb[0xa];var _0xcb0ca3=_0x1899fb[0xb];var _0x90acb=_0x1899fb[0xc];var _0xec13cc=_0x1899fb[0xd];var _0x5bbfe7=_0x1899fb[0xe];var _0x20672f=_0x1899fb[0xf][_0x06a4('0x4')](/\n/g,_0x06a4('0x5'));var _0x34ac0d=_0x1899fb[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x06a4('0x6')](_0xcb0ca3)){arr['push'](_0xcb0ca3);var _0x39cceb=_0x1899fb[0x3];var _0xe82112=_0x1899fb[0x4];var _0x45aae2=_0x1899fb[0x1];var _0x39e09b=_0x1899fb[0x0];var _0x229090={};_0x229090['urlOnAnswer']=_0x1899fb[0x8]+'?params='+_0x90acb+'|'+_0x2e98d3+'|'+_0xec13cc+'|'+_0xcb0ca3+'|'+_0x5bbfe7;_0x229090['urlOnRing']=_0x1899fb[0x7]+_0x06a4('0x7')+_0x90acb+'|'+_0x2e98d3+'|'+_0xec13cc+'|'+_0xcb0ca3+'|'+_0x5bbfe7+'|'+_0x20672f+'|'+_0x34ac0d;_0x229090[_0x06a4('0x8')]=_0x1899fb[0x9];var _0x5ea323={};_0x5ea323['jsonrpc']='2.0';_0x5ea323[_0x06a4('0x9')]='login';var _0x573fe5=[];_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x2]);_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x5]);_0x573fe5[_0x06a4('0xa')](_0x1899fb[0x6]);_0x5ea323[_0x06a4('0xb')]=_0x573fe5;_0x5ea323['id']=0x1;var _0x26fb28=JSON[_0x06a4('0xc')](_0x5ea323);var _0x31ddd7={'encoding':_0x06a4('0xd'),'method':_0x06a4('0xe'),'timeout':0x2710,'url':_0x39cceb,'headers':{'Content-Type':_0x06a4('0xf')},'body':_0x26fb28};return rp(_0x31ddd7)[_0x06a4('0x10')](function(_0x431c74){const _0x42a17e=JSON[_0x06a4('0x11')](_0x431c74);if(!_0x42a17e[_0x06a4('0x12')][_0x06a4('0x13')]){throw new Error(_0x06a4('0x14'));}var _0x3d7d9c=_0xcb0ca3;var _0x2c1425=_0x06a4('0x15')+_0x45aae2+_0x06a4('0x16')+_0x39e09b+_0x06a4('0x17')+_0x3d7d9c+_0x06a4('0x18')+JSON[_0x06a4('0xc')](_0x229090);var _0x52ddb1=_0xe82112+'?'+_0x2c1425;return rp(_0x52ddb1);})[_0x06a4('0x10')](function(_0x59aed0){logger['info'](_0x06a4('0x19'),_0x5cb8c3,_0x59aed0);_0x50e3b1[_0x06a4('0x1a')]();})[_0x06a4('0x1b')](function(_0x2c31e8){logger['error']('[%s][TVOX]\x20%s',_0x5cb8c3,_[_0x06a4('0x1c')](_0x2c31e8)?JSON['stringify'](_0x2c31e8):_0x2c31e8);_0x50e3b1[_0x06a4('0x1a')]();});}else{logger[_0x06a4('0x1d')](_0x06a4('0x1e'),_0x5cb8c3);_0x50e3b1['next']();}};}; \ No newline at end of file +var _0xab7e=['parse','result','logged','channelId=','&serviceId=','&sessionId=','&data=','info','stop','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','push','stringify','utf8','POST','application/json-rpc','then'];(function(_0x491939,_0x309a51){var _0x2b7b00=function(_0x5ca167){while(--_0x5ca167){_0x491939['push'](_0x491939['shift']());}};_0x2b7b00(++_0x309a51);}(_0xab7e,0xd2));var _0xeab7=function(_0x3ef4bd,_0x297634){_0x3ef4bd=_0x3ef4bd-0x0;var _0x1c234e=_0xab7e[_0x3ef4bd];return _0x1c234e;};'use strict';var rp=require(_0xeab7('0x0'));var logger=require(_0xeab7('0x1'))(_0xeab7('0x2'));var _=require(_0xeab7('0x3'));var arr=[];exports[_0xeab7('0x4')]=function(_0x14d194,_0x47f61a){return function(_0x30da42){var _0x5b7e42=_0x47f61a[0xa];var _0x47873a=_0x47f61a[0xb];var _0x32077e=_0x47f61a[0xc];var _0x206da4=_0x47f61a[0xd];var _0x195ed4=_0x47f61a[0xe];var _0x450598=_0x47f61a[0xf][_0xeab7('0x5')](/\n/g,_0xeab7('0x6'));var _0x124730=_0x47f61a[0x10]['replace'](/\n/g,'\x20');if(!arr[_0xeab7('0x7')](_0x47873a)){arr['push'](_0x47873a);var _0x4725a2=_0x47f61a[0x3];var _0x28e3dd=_0x47f61a[0x4];var _0x1406a7=_0x47f61a[0x1];var _0x4f59a4=_0x47f61a[0x0];var _0x413de0={};_0x413de0[_0xeab7('0x8')]=_0x47f61a[0x8]+_0xeab7('0x9')+_0x32077e+'|'+_0x5b7e42+'|'+_0x206da4+'|'+_0x47873a+'|'+_0x195ed4;_0x413de0[_0xeab7('0xa')]=_0x47f61a[0x7]+_0xeab7('0x9')+_0x32077e+'|'+_0x5b7e42+'|'+_0x206da4+'|'+_0x47873a+'|'+_0x195ed4+'|'+_0x450598+'|'+_0x124730;_0x413de0['title']=_0x47f61a[0x9];var _0x4ef932={};_0x4ef932[_0xeab7('0xb')]=_0xeab7('0xc');_0x4ef932[_0xeab7('0xd')]=_0xeab7('0xe');var _0x29aa50=[];_0x29aa50['push'](_0x47f61a[0x2]);_0x29aa50[_0xeab7('0xf')](_0x47f61a[0x5]);_0x29aa50[_0xeab7('0xf')](_0x47f61a[0x6]);_0x4ef932['params']=_0x29aa50;_0x4ef932['id']=0x1;var _0x508e7a=JSON[_0xeab7('0x10')](_0x4ef932);var _0x42dbc9={'encoding':_0xeab7('0x11'),'method':_0xeab7('0x12'),'timeout':0x2710,'url':_0x4725a2,'headers':{'Content-Type':_0xeab7('0x13')},'body':_0x508e7a};return rp(_0x42dbc9)[_0xeab7('0x14')](function(_0x164559){const _0x2179d8=JSON[_0xeab7('0x15')](_0x164559);if(!_0x2179d8[_0xeab7('0x16')][_0xeab7('0x17')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x49c8b3=_0x47873a;var _0x52a633=_0xeab7('0x18')+_0x1406a7+_0xeab7('0x19')+_0x4f59a4+_0xeab7('0x1a')+_0x49c8b3+_0xeab7('0x1b')+JSON['stringify'](_0x413de0);var _0x19e170=_0x28e3dd+'?'+_0x52a633;return rp(_0x19e170);})[_0xeab7('0x14')](function(_0x3d4a77){logger[_0xeab7('0x1c')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x14d194,_0x3d4a77);_0x30da42[_0xeab7('0x1d')]();})['catch'](function(_0x538519){logger['error']('[%s][TVOX]\x20%s',_0x14d194,_[_0xeab7('0x1e')](_0x538519)?JSON['stringify'](_0x538519):_0x538519);_0x30da42[_0xeab7('0x1d')]();});}else{logger[_0xeab7('0x1c')](_0xeab7('0x1f'),_0x14d194);_0x30da42[_0xeab7('0x20')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 92b3d55..3b8a17d 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 _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x52d894,_0x20b608){var _0x52aed2=function(_0x3962cf){while(--_0x3962cf){_0x52d894['push'](_0x52d894['shift']());}};_0x52aed2(++_0x20b608);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x1fb722,_0x3d08d2){var _0x21ca6a=function(_0x117d8d){while(--_0x117d8d){_0x1fb722['push'](_0x1fb722['shift']());}};_0x21ca6a(++_0x3d08d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 987df44..60cfd50 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 _0x6953=['body','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','Applications\x20executed','stringify','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','mail','push','slice','dialogflow','split','dialogflowv2','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6953,0x91));var _0x3695=function(_0x23289e,_0x219583){_0x23289e=_0x23289e-0x0;var _0x86a4eb=_0x6953[_0x23289e];return _0x86a4eb;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require('bluebird');var utils=require(_0x3695('0x2'));var logger=require('../../../config/logger')(_0x3695('0x3'));var rpc={'openchannelQueueReport':require(_0x3695('0x4')),'mailQueueReport':require(_0x3695('0x5')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x3695('0x6')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x3695('0x7'))};var RuleEngine=require(_0x3695('0x8'));function getId(_0x912099,_0x1a4e75,_0x301e46){return util['format'](_0x3695('0x9'),_0x912099,_0x1a4e75||0x0,_0x301e46||0x0);}function getIntervals(_0x4a1ece,_0x1fcd43){var _0x4b8f82=[];if(!_['isNil'](_0x1fcd43[_0x3695('0xa')])&&!_['isNil'](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]])&&!_[_0x3695('0xb')](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]][_0x3695('0xc')])){_0x4b8f82=_[_0x3695('0xd')](_0x4a1ece[_0x1fcd43[_0x3695('0xa')]]['Intervals'],_0x3695('0xe'));}else if(!_[_0x3695('0xb')](_0x1fcd43[_0x3695('0xe')])){_0x4b8f82=[_0x1fcd43[_0x3695('0xe')]];}return _0x4b8f82;}exports[_0x3695('0xf')]=function(_0x27e243){_0x27e243[_0x3695('0x10')]={};return new BPromise(function(_0x4df429,_0x26dfc9){var _0xc5dc5={'Start':function(_0x1ffebd){var _0x4ca317=this;return new Promise(function(_0x3aa59d,_0x231c7d){if(_0x1ffebd){try{var _0x2cdd3=[];var _0x3cb320=getId(_0x1ffebd[_0x3695('0x11')],_0x1ffebd[_0x3695('0x12')]?_0x1ffebd[_0x3695('0x12')]['id']:0x0,_0x1ffebd['interaction']?_0x1ffebd[_0x3695('0x13')]['id']:0x0);if(_0x1ffebd['applications']&&_[_0x3695('0x14')](_0x1ffebd[_0x3695('0x15')])&&_0x1ffebd[_0x3695('0x15')][_0x3695('0x16')]){for(var _0xc91d6e=0x0;_0xc91d6e<_0x1ffebd['applications'][_0x3695('0x16')];_0xc91d6e+=0x1){var _0x2d7936=_0x1ffebd[_0x3695('0x15')][_0xc91d6e];if(fs[_0x3695('0x17')](path[_0x3695('0x18')](__dirname,_0x3695('0x15'),_0x2d7936[_0x3695('0x19')]+_0x3695('0x1a')))){var _0x1f267a=[];switch(_0x2d7936[_0x3695('0x19')][_0x3695('0x1b')]()){case _0x3695('0x1c'):var _0x459f33=_0x2d7936[_0x3695('0x1d')]['split'](',');if(_0x1ffebd[_0x3695('0x11')]===_0x3695('0x1e')){_0x1f267a['push'](_0x459f33[0x0]);_0x1f267a['push'](_0x459f33[0x1]);_0x1f267a[_0x3695('0x1f')](_0x459f33[_0x3695('0x20')](0x2,_0x459f33[_0x3695('0x16')])[_0x3695('0x18')](','));}else{_0x1f267a['push'](_0x459f33[0x0]);_0x1f267a[_0x3695('0x1f')](_0x459f33['slice'](0x1,_0x459f33[_0x3695('0x16')])['join'](','));}break;case _0x3695('0x21'):var _0x5adea3=_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');_0x1f267a[_0x3695('0x1f')](_0x5adea3[0x0]);_0x1f267a[_0x3695('0x1f')](_0x5adea3[0x1]);_0x1f267a[_0x3695('0x1f')](_0x5adea3[_0x3695('0x20')](0x2,_0x5adea3['length'])[_0x3695('0x18')](','));break;case _0x3695('0x23'):var _0x5f193c=_0x2d7936[_0x3695('0x1d')]['split'](',');_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x0]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x1]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x2]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[0x3]);_0x1f267a[_0x3695('0x1f')](_0x5f193c[_0x3695('0x20')](0x4,_0x5f193c[_0x3695('0x16')])[_0x3695('0x18')](','));break;case'amazonlex':var _0x35c67a=_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');_0x1f267a['push'](_0x35c67a[0x0]);_0x1f267a['push'](_0x35c67a[0x1]);_0x1f267a[_0x3695('0x1f')](_0x35c67a[0x2]);_0x1f267a['push'](_0x35c67a[0x3]);_0x1f267a[_0x3695('0x1f')](_0x35c67a[_0x3695('0x20')](0x4,_0x35c67a['length'])[_0x3695('0x18')](','));break;case'message':_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x1d')]);break;case _0x3695('0x24'):_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x25')]);_0x1f267a[_0x3695('0x1f')](_0x2d7936['appdata']);break;case _0x3695('0x26'):var _0x33043e=utils['getMustacheRender'](_0x1ffebd[_0x3695('0x27')][_0x3695('0x28')],_0x1ffebd);var _0x542d33=_0x2d7936['appdata']['split'](',');_0x1f267a['push'](_0x542d33[0x0]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x1]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x2]);_0x1f267a['push'](_0x542d33[0x3]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x4]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x5]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x6]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0x7]);_0x1f267a['push'](_0x542d33[0x8]);_0x1f267a['push'](_0x542d33[0x9]);_0x1f267a[_0x3695('0x1f')](_0x542d33[0xa]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd['interaction']['id']);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x12')]['id']);_0x1f267a[_0x3695('0x1f')](_0x2d7936[_0x3695('0x29')]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x13')][_0x3695('0x2a')]);_0x1f267a[_0x3695('0x1f')](_0x1ffebd[_0x3695('0x2b')][_0x3695('0x2b')]);_0x1f267a[_0x3695('0x1f')](_0x33043e);break;default:_0x1f267a=_[_0x3695('0xb')](_0x2d7936[_0x3695('0x1d')])?[]:_0x2d7936[_0x3695('0x1d')][_0x3695('0x22')](',');}var _0x318551={'id':util['format'](_0x3695('0x2c'),_0x3cb320,_0x2d7936['id'],_0x2d7936[_0x3695('0x19')]),'condition':require(_0x3695('0x2d'))[_0x3695('0x2e')](_0x3cb320,getIntervals(_0x27e243[_0x3695('0x2f')],_0x2d7936),_0x27e243),'consequence':require(_0x3695('0x30')+_0x2d7936[_0x3695('0x19')])['consequence'](_0x3cb320,_0x1f267a,_0x27e243,_0x1ffebd),'p':_0x2d7936[_0x3695('0x31')]||0x0};logger[_0x3695('0x32')](_0x3695('0x33'),_0x318551['id'],'on\x20interval',getIntervals(_0x27e243[_0x3695('0x2f')],_0x2d7936)[_0x3695('0x18')](_0x3695('0x34')));_0x2cdd3[_0x3695('0x1f')](_0x318551);}else{logger[_0x3695('0x35')](_0x3695('0x36'),path[_0x3695('0x18')](__dirname,'applications',_0x2d7936[_0x3695('0x19')]+'.js'));}}_0x27e243['rules'][_0x3cb320]=new RuleEngine(_0x2cdd3);_0x27e243[_0x3695('0x10')][_0x3cb320]['execute'](_0x1ffebd,function(_0x148547){logger[_0x3695('0x32')](_0x3695('0x37'),JSON[_0x3695('0x38')](_0x148547['matchPath']));if(_0x27e243[_0x3695('0x10')][_0x3cb320]){_0x27e243[_0x3695('0x10')][_0x3cb320][_0x3695('0x39')]('complete');}});return _0x3aa59d({'code':0xc8,'message':_0x1ffebd});}else{logger[_0x3695('0x32')](_0x3695('0x3a'));return _0x3aa59d({'code':0xc8,'message':_0x1ffebd});}}catch(_0x172855){logger[_0x3695('0x35')](_0x172855[_0x3695('0x3b')]);return _0x231c7d(_0x4ca317[_0x3695('0x35')](0x1f4,_0x172855));}}return _0x231c7d(_0x3695('0x3c'));});},'AcceptMessage':function(_0x3e9533){var _0x3dd06a=this;return new Promise(function(_0x5d5d70,_0x57bf10){if(_0x3e9533[_0x3695('0x3d')]&&_0x3e9533[_0x3695('0x3d')]['id']){if(_0x27e243[_0x3695('0x3e')][_0x3e9533['agent']['id']]){_0x27e243[_0x3695('0x3e')][_0x3e9533[_0x3695('0x3d')]['id']][_0x3695('0x3f')]=![];_0x27e243['agents'][_0x3e9533[_0x3695('0x3d')]['id']][_0x3695('0x40')]=undefined;}}if(_0x3e9533[_0x3695('0x12')]&&_0x3e9533[_0x3695('0x12')]['id']){try{var _0x325b36=getId(_0x3e9533['channel'],_0x3e9533[_0x3695('0x12')]?_0x3e9533[_0x3695('0x12')]['id']:0x0,_0x3e9533[_0x3695('0x13')]?_0x3e9533[_0x3695('0x13')]['id']:0x0);if(_0x27e243['rules'][_0x325b36]){_0x27e243[_0x3695('0x10')][_0x325b36]['emit']('end');if(rpc[_0x3e9533[_0x3695('0x11')]+_0x3695('0x41')]){rpc[_0x3e9533[_0x3695('0x11')]+_0x3695('0x41')][_0x3695('0x42')](_0x325b36,{'UserId':_0x3e9533['message']['UserId']})['catch'](function(){logger[_0x3695('0x35')]('error\x20update\x20queue\x20report');});}}return _0x5d5d70({'code':0xc8,'message':_0x3e9533});}catch(_0x4f5f1b){logger['error'](_0x4f5f1b['stack']);return _0x57bf10(_0x3dd06a[_0x3695('0x35')](0x1f4,_0x4f5f1b));}}logger[_0x3695('0x35')]('message\x20is\x20empty');return _0x57bf10(_0x3dd06a[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'RejectMessage':function(_0x567447){var _0x4a0a78=this;return new Promise(function(_0x419ed6,_0x2cf76d){if(_0x567447[_0x3695('0x3d')]&&_0x567447['agent']['id']){try{if(_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']]){_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']][_0x3695('0x3f')]=![];_0x27e243[_0x3695('0x3e')][_0x567447[_0x3695('0x3d')]['id']][_0x3695('0x40')]=undefined;}return _0x419ed6({'code':0xc8,'message':_0x567447});}catch(_0x2c695c){logger[_0x3695('0x35')](_0x2c695c[_0x3695('0x3b')]);return _0x2cf76d(_0x4a0a78[_0x3695('0x35')](0x1f4,_0x2c695c));}}logger[_0x3695('0x35')](_0x3695('0x43'));return _0x2cf76d(_0x4a0a78[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'AbandonInteraction':function(_0x441997){var _0x38cfec=this;return new Promise(function(_0x22e4a9,_0x35ffae){if(_0x441997[_0x3695('0x11')]&&_0x441997[_0x3695('0x13')]&&_0x441997[_0x3695('0x13')]['id']){try{var _0x50f963=getId(_0x441997['channel'],_0x441997[_0x3695('0x12')]?_0x441997[_0x3695('0x12')]['id']:0x0,_0x441997['interaction']?_0x441997[_0x3695('0x13')]['id']:0x0);if(_0x27e243[_0x3695('0x10')][_0x50f963]){_0x27e243[_0x3695('0x10')][_0x50f963][_0x3695('0x39')](_0x3695('0x44'));}return _0x22e4a9({'code':0xc8,'message':_0x441997});}catch(_0x35a5a5){logger[_0x3695('0x35')](_0x35a5a5[_0x3695('0x3b')]);return _0x35ffae(_0x38cfec[_0x3695('0x35')](0x1f4,_0x35a5a5));}}logger[_0x3695('0x35')]('message\x20is\x20empty');return _0x35ffae(_0x38cfec[_0x3695('0x35')](0x1f4,_0x3695('0x43')));});},'AgentCapacity':function(_0x1e101f){var _0x37ae94=this;return new Promise(function(_0x380ddc,_0x59f506){if(_0x27e243[_0x3695('0x3e')][_0x3695('0x45')](_0x1e101f['id'])){for(var _0xf18f60 in _0x1e101f['capacity']){if(_0x1e101f[_0x3695('0x46')][_0x3695('0x45')](_0xf18f60)){if(_0x27e243['agents'][_0x1e101f['id']]['hasOwnProperty'](_0xf18f60+_0x3695('0x47'))){_0x27e243['agents'][_0x1e101f['id']][_0xf18f60+'CurrentCapacity']=parseInt(_0x1e101f[_0x3695('0x46')][_0xf18f60],0xa);}}}_0x27e243[_0x3695('0x3e')][_0x1e101f['id']][_0x3695('0x48')]();return _0x380ddc({'code':0xc8,'message':_0x27e243[_0x3695('0x3e')][_0x1e101f['id']]});}else{return _0x59f506(_0x37ae94[_0x3695('0x35')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3250f1){return new Promise(function(_0x2f690a){var _0x2e9762=_['values'](_0x27e243[_0x3695('0x3e')]);if(_0x3250f1&&_0x3250f1['id']){var _0x193b35=_[_0x3695('0x49')](_0x2e9762,function(_0x43b42a){return _0x43b42a['id']===_0x3250f1['id'];});_0x2f690a(_0x193b35);}else{_0x2f690a({'count':_0x2e9762[_0x3695('0x16')],'rows':_0x2e9762});}});},'ChatQueues':function(){return new Promise(function(_0x45fc8e){var _0x558e82=[];for(var _0x1c6516 in _0x27e243[_0x3695('0x4a')]){if(_0x27e243[_0x3695('0x4a')][_0x3695('0x45')](_0x1c6516)){var _0x395547=_0x27e243['chatQueues'][_0x1c6516];var _0x35fde9={'id':_0x395547['id'],'available':_0x395547[_0x3695('0x4b')],'loggedIn':_0x395547[_0x3695('0x4c')],'name':_0x395547[_0x3695('0x4d')],'paused':_0x395547[_0x3695('0x4e')],'waiting':_0x395547[_0x3695('0x4f')]};_0x558e82['push'](_0x35fde9);}}_0x45fc8e({'count':_0x558e82[_0x3695('0x16')],'rows':_0x558e82});});},'MailQueues':function(){return new Promise(function(_0x46099d){var _0x5c1fb1=[];for(var _0x4e7d7a in _0x27e243[_0x3695('0x50')]){if(_0x27e243[_0x3695('0x50')][_0x3695('0x45')](_0x4e7d7a)){var _0x48be60=_0x27e243[_0x3695('0x50')][_0x4e7d7a];var _0x40e542={'id':_0x48be60['id'],'available':_0x48be60[_0x3695('0x4b')],'loggedIn':_0x48be60[_0x3695('0x4c')],'name':_0x48be60[_0x3695('0x4d')],'paused':_0x48be60['paused'],'waiting':_0x48be60[_0x3695('0x4f')]};_0x5c1fb1['push'](_0x40e542);}}_0x46099d({'count':_0x5c1fb1['length'],'rows':_0x5c1fb1});});},'OpenchannelQueues':function(){return new Promise(function(_0x47def1){var _0x2f994f=[];for(var _0x278fbd in _0x27e243[_0x3695('0x51')]){if(_0x27e243[_0x3695('0x51')][_0x3695('0x45')](_0x278fbd)){var _0x36777e=_0x27e243[_0x3695('0x51')][_0x278fbd];var _0x3b0794={'id':_0x36777e['id'],'available':_0x36777e[_0x3695('0x4b')],'loggedIn':_0x36777e[_0x3695('0x4c')],'name':_0x36777e[_0x3695('0x4d')],'paused':_0x36777e[_0x3695('0x4e')],'waiting':_0x36777e[_0x3695('0x4f')]};_0x2f994f[_0x3695('0x1f')](_0x3b0794);}}_0x47def1({'count':_0x2f994f[_0x3695('0x16')],'rows':_0x2f994f});});},'SmsQueues':function(){return new Promise(function(_0x3c64f7){var _0x500234=[];for(var _0x10bb6d in _0x27e243[_0x3695('0x52')]){if(_0x27e243[_0x3695('0x52')][_0x3695('0x45')](_0x10bb6d)){var _0x2bfe00=_0x27e243[_0x3695('0x52')][_0x10bb6d];var _0x54f1f5={'id':_0x2bfe00['id'],'available':_0x2bfe00[_0x3695('0x4b')],'loggedIn':_0x2bfe00[_0x3695('0x4c')],'name':_0x2bfe00['name'],'paused':_0x2bfe00['paused'],'waiting':_0x2bfe00[_0x3695('0x4f')]};_0x500234['push'](_0x54f1f5);}}_0x3c64f7({'count':_0x500234[_0x3695('0x16')],'rows':_0x500234});});},'FaxQueues':function(){return new Promise(function(_0x4489c6){var _0x194bf5=[];for(var _0x4348a8 in _0x27e243[_0x3695('0x53')]){if(_0x27e243['faxQueues'][_0x3695('0x45')](_0x4348a8)){var _0x60d6ed=_0x27e243[_0x3695('0x53')][_0x4348a8];var _0x586c92={'id':_0x60d6ed['id'],'available':_0x60d6ed['available'],'loggedIn':_0x60d6ed['loggedIn'],'name':_0x60d6ed[_0x3695('0x4d')],'paused':_0x60d6ed[_0x3695('0x4e')],'waiting':_0x60d6ed['waiting']};_0x194bf5[_0x3695('0x1f')](_0x586c92);}}_0x4489c6({'count':_0x194bf5[_0x3695('0x16')],'rows':_0x194bf5});});},'WhatsappQueues':function(){return new Promise(function(_0x32724d){var _0x27852b=[];for(var _0x167830 in _0x27e243[_0x3695('0x54')]){if(_0x27e243[_0x3695('0x54')][_0x3695('0x45')](_0x167830)){var _0x50b827=_0x27e243[_0x3695('0x54')][_0x167830];var _0x283ea7={'id':_0x50b827['id'],'available':_0x50b827[_0x3695('0x4b')],'loggedIn':_0x50b827[_0x3695('0x4c')],'name':_0x50b827[_0x3695('0x4d')],'paused':_0x50b827[_0x3695('0x4e')],'waiting':_0x50b827[_0x3695('0x4f')]};_0x27852b[_0x3695('0x1f')](_0x283ea7);}}_0x32724d({'count':_0x27852b['length'],'rows':_0x27852b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x327143){var _0x4111de=_[_0x3695('0x55')](_0x27e243[_0x3695('0x56')]);_0x327143({'count':_0x4111de[_0x3695('0x16')],'rows':_0x4111de});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x21f7b4){var _0x3fa4b0=_[_0x3695('0x55')](_0x27e243[_0x3695('0x57')]);_0x21f7b4({'count':_0x3fa4b0[_0x3695('0x16')],'rows':_0x3fa4b0});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xd78b9b){var _0x92fcea=_[_0x3695('0x55')](_0x27e243['openchannelQueuesWaitingInteractions']);_0xd78b9b({'count':_0x92fcea['length'],'rows':_0x92fcea});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x45657f){var _0x247938=_[_0x3695('0x55')](_0x27e243['smsQueuesWaitingInteractions']);_0x45657f({'count':_0x247938[_0x3695('0x16')],'rows':_0x247938});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x11ae95){var _0x25a776=_['values'](_0x27e243[_0x3695('0x58')]);_0x11ae95({'count':_0x25a776['length'],'rows':_0x25a776});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x10dda9){var _0x224ce5=_[_0x3695('0x55')](_0x27e243[_0x3695('0x59')]);_0x10dda9({'count':_0x224ce5[_0x3695('0x16')],'rows':_0x224ce5});});}};var _0x5bd8e0=jayson[_0x3695('0x5a')](_0xc5dc5)[_0x3695('0x5b')]();_0x5bd8e0['on'](_0x3695('0x35'),function(_0x2a7cb3){logger[_0x3695('0x35')](JSON[_0x3695('0x38')](_0x2a7cb3));return _0x26dfc9(_0x2a7cb3);});_0x5bd8e0[_0x3695('0xf')](0x232c,_0x3695('0x5c'),function(){console['log'](_0x3695('0x5d'),0x232c);return _0x4df429('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0xaa88=['emit','complete','stack','routing\x20is\x20empty','agent','agents','busy','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','server','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','format','IntervalId','isNil','Intervals','map','interval','listen','channel','message','applications','length','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','TagId','tvox','notificationTemplate','ChatWebsiteId','interaction','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','rules','stringify','matchPath'];(function(_0x1962c3,_0x7461d6){var _0x40447e=function(_0x244fca){while(--_0x244fca){_0x1962c3['push'](_0x1962c3['shift']());}};_0x40447e(++_0x7461d6);}(_0xaa88,0x137));var _0x8aa8=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xaa88[_0x39a2d6];return _0x23af66;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var path=require(_0x8aa8('0x2'));var fs=require('fs');var jayson=require(_0x8aa8('0x3'));var BPromise=require('bluebird');var utils=require(_0x8aa8('0x4'));var logger=require(_0x8aa8('0x5'))(_0x8aa8('0x6'));var rpc={'openchannelQueueReport':require(_0x8aa8('0x7')),'mailQueueReport':require(_0x8aa8('0x8')),'chatQueueReport':require(_0x8aa8('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x8aa8('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x449d2d,_0x1ed84d,_0x27c08d){return util[_0x8aa8('0xb')]('%s.%s.%s',_0x449d2d,_0x1ed84d||0x0,_0x27c08d||0x0);}function getIntervals(_0x123b7f,_0x2d974c){var _0x224f25=[];if(!_['isNil'](_0x2d974c[_0x8aa8('0xc')])&&!_[_0x8aa8('0xd')](_0x123b7f[_0x2d974c[_0x8aa8('0xc')]])&&!_[_0x8aa8('0xd')](_0x123b7f[_0x2d974c['IntervalId']][_0x8aa8('0xe')])){_0x224f25=_[_0x8aa8('0xf')](_0x123b7f[_0x2d974c['IntervalId']][_0x8aa8('0xe')],_0x8aa8('0x10'));}else if(!_[_0x8aa8('0xd')](_0x2d974c['interval'])){_0x224f25=[_0x2d974c[_0x8aa8('0x10')]];}return _0x224f25;}exports[_0x8aa8('0x11')]=function(_0x2fa66f){_0x2fa66f['rules']={};return new BPromise(function(_0x391642,_0x4af534){var _0x4f3a2e={'Start':function(_0x433e95){var _0x200662=this;return new Promise(function(_0xae81a0,_0xa6c2af){if(_0x433e95){try{var _0x42a6a4=[];var _0x3778f4=getId(_0x433e95[_0x8aa8('0x12')],_0x433e95[_0x8aa8('0x13')]?_0x433e95[_0x8aa8('0x13')]['id']:0x0,_0x433e95['interaction']?_0x433e95['interaction']['id']:0x0);if(_0x433e95[_0x8aa8('0x14')]&&_['isArray'](_0x433e95['applications'])&&_0x433e95[_0x8aa8('0x14')]['length']){for(var _0x438198=0x0;_0x438198<_0x433e95[_0x8aa8('0x14')][_0x8aa8('0x15')];_0x438198+=0x1){var _0x2d5c1b=_0x433e95['applications'][_0x438198];if(fs[_0x8aa8('0x16')](path[_0x8aa8('0x17')](__dirname,_0x8aa8('0x14'),_0x2d5c1b[_0x8aa8('0x18')]+_0x8aa8('0x19')))){var _0x34f1b7=[];switch(_0x2d5c1b['app'][_0x8aa8('0x1a')]()){case'autoreply':var _0x1fdadd=_0x2d5c1b['appdata'][_0x8aa8('0x1b')](',');if(_0x433e95['channel']===_0x8aa8('0x1c')){_0x34f1b7[_0x8aa8('0x1d')](_0x1fdadd[0x0]);_0x34f1b7[_0x8aa8('0x1d')](_0x1fdadd[0x1]);_0x34f1b7['push'](_0x1fdadd[_0x8aa8('0x1e')](0x2,_0x1fdadd[_0x8aa8('0x15')])[_0x8aa8('0x17')](','));}else{_0x34f1b7['push'](_0x1fdadd[0x0]);_0x34f1b7['push'](_0x1fdadd[_0x8aa8('0x1e')](0x1,_0x1fdadd[_0x8aa8('0x15')])[_0x8aa8('0x17')](','));}break;case _0x8aa8('0x1f'):var _0x24143e=_0x2d5c1b['appdata'][_0x8aa8('0x1b')](',');_0x34f1b7['push'](_0x24143e[0x0]);_0x34f1b7[_0x8aa8('0x1d')](_0x24143e[0x1]);_0x34f1b7[_0x8aa8('0x1d')](_0x24143e[_0x8aa8('0x1e')](0x2,_0x24143e['length'])['join'](','));break;case _0x8aa8('0x20'):var _0x5e96c9=_0x2d5c1b[_0x8aa8('0x21')][_0x8aa8('0x1b')](',');_0x34f1b7[_0x8aa8('0x1d')](_0x5e96c9[0x0]);_0x34f1b7[_0x8aa8('0x1d')](_0x5e96c9[0x1]);_0x34f1b7[_0x8aa8('0x1d')](_0x5e96c9[0x2]);_0x34f1b7['push'](_0x5e96c9[0x3]);_0x34f1b7[_0x8aa8('0x1d')](_0x5e96c9[_0x8aa8('0x1e')](0x4,_0x5e96c9['length'])[_0x8aa8('0x17')](','));break;case _0x8aa8('0x22'):var _0x217891=_0x2d5c1b['appdata'][_0x8aa8('0x1b')](',');_0x34f1b7[_0x8aa8('0x1d')](_0x217891[0x0]);_0x34f1b7[_0x8aa8('0x1d')](_0x217891[0x1]);_0x34f1b7[_0x8aa8('0x1d')](_0x217891[0x2]);_0x34f1b7[_0x8aa8('0x1d')](_0x217891[0x3]);_0x34f1b7[_0x8aa8('0x1d')](_0x217891[_0x8aa8('0x1e')](0x4,_0x217891[_0x8aa8('0x15')])[_0x8aa8('0x17')](','));break;case _0x8aa8('0x13'):_0x34f1b7[_0x8aa8('0x1d')](_0x2d5c1b['appdata']);break;case'tag':_0x34f1b7[_0x8aa8('0x1d')](_0x2d5c1b[_0x8aa8('0x23')]);_0x34f1b7[_0x8aa8('0x1d')](_0x2d5c1b[_0x8aa8('0x21')]);break;case _0x8aa8('0x24'):var _0x2f27cd=utils['getMustacheRender'](_0x433e95['account'][_0x8aa8('0x25')],_0x433e95);var _0x5755b5=_0x2d5c1b[_0x8aa8('0x21')][_0x8aa8('0x1b')](',');_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x0]);_0x34f1b7['push'](_0x5755b5[0x1]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x2]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x3]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x4]);_0x34f1b7['push'](_0x5755b5[0x5]);_0x34f1b7['push'](_0x5755b5[0x6]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x7]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0x8]);_0x34f1b7['push'](_0x5755b5[0x9]);_0x34f1b7[_0x8aa8('0x1d')](_0x5755b5[0xa]);_0x34f1b7[_0x8aa8('0x1d')](_0x433e95['interaction']['id']);_0x34f1b7[_0x8aa8('0x1d')](_0x433e95['message']['id']);_0x34f1b7['push'](_0x2d5c1b[_0x8aa8('0x26')]);_0x34f1b7['push'](_0x433e95[_0x8aa8('0x27')][_0x8aa8('0x28')]);_0x34f1b7[_0x8aa8('0x1d')](_0x433e95[_0x8aa8('0x29')]['body']);_0x34f1b7[_0x8aa8('0x1d')](_0x2f27cd);break;default:_0x34f1b7=_[_0x8aa8('0xd')](_0x2d5c1b['appdata'])?[]:_0x2d5c1b[_0x8aa8('0x21')][_0x8aa8('0x1b')](',');}var _0x5ea57a={'id':util[_0x8aa8('0xb')](_0x8aa8('0x2a'),_0x3778f4,_0x2d5c1b['id'],_0x2d5c1b[_0x8aa8('0x18')]),'condition':require(_0x8aa8('0x2b'))[_0x8aa8('0x2c')](_0x3778f4,getIntervals(_0x2fa66f[_0x8aa8('0x2d')],_0x2d5c1b),_0x2fa66f),'consequence':require(_0x8aa8('0x2e')+_0x2d5c1b[_0x8aa8('0x18')])[_0x8aa8('0x2f')](_0x3778f4,_0x34f1b7,_0x2fa66f,_0x433e95),'p':_0x2d5c1b[_0x8aa8('0x30')]||0x0};logger[_0x8aa8('0x31')](_0x8aa8('0x32'),_0x5ea57a['id'],_0x8aa8('0x33'),getIntervals(_0x2fa66f[_0x8aa8('0x2d')],_0x2d5c1b)[_0x8aa8('0x17')](_0x8aa8('0x34')));_0x42a6a4['push'](_0x5ea57a);}else{logger[_0x8aa8('0x35')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,'applications',_0x2d5c1b[_0x8aa8('0x18')]+'.js'));}}_0x2fa66f['rules'][_0x3778f4]=new RuleEngine(_0x42a6a4);_0x2fa66f[_0x8aa8('0x36')][_0x3778f4]['execute'](_0x433e95,function(_0x1ddf7f){logger['info']('Applications\x20executed',JSON[_0x8aa8('0x37')](_0x1ddf7f[_0x8aa8('0x38')]));if(_0x2fa66f[_0x8aa8('0x36')][_0x3778f4]){_0x2fa66f[_0x8aa8('0x36')][_0x3778f4][_0x8aa8('0x39')](_0x8aa8('0x3a'));}});return _0xae81a0({'code':0xc8,'message':_0x433e95});}else{logger[_0x8aa8('0x31')]('No\x20applications\x20to\x20execute');return _0xae81a0({'code':0xc8,'message':_0x433e95});}}catch(_0x32289d){logger['error'](_0x32289d[_0x8aa8('0x3b')]);return _0xa6c2af(_0x200662[_0x8aa8('0x35')](0x1f4,_0x32289d));}}return _0xa6c2af(_0x8aa8('0x3c'));});},'AcceptMessage':function(_0x2bc6d3){var _0x2a0a14=this;return new Promise(function(_0x44f2b4,_0x5adcda){if(_0x2bc6d3['agent']&&_0x2bc6d3[_0x8aa8('0x3d')]['id']){if(_0x2fa66f[_0x8aa8('0x3e')][_0x2bc6d3['agent']['id']]){_0x2fa66f[_0x8aa8('0x3e')][_0x2bc6d3[_0x8aa8('0x3d')]['id']][_0x8aa8('0x3f')]=![];_0x2fa66f['agents'][_0x2bc6d3['agent']['id']]['busyQueue']=undefined;}}if(_0x2bc6d3['message']&&_0x2bc6d3[_0x8aa8('0x13')]['id']){try{var _0x43bdb4=getId(_0x2bc6d3['channel'],_0x2bc6d3[_0x8aa8('0x13')]?_0x2bc6d3[_0x8aa8('0x13')]['id']:0x0,_0x2bc6d3[_0x8aa8('0x27')]?_0x2bc6d3[_0x8aa8('0x27')]['id']:0x0);if(_0x2fa66f[_0x8aa8('0x36')][_0x43bdb4]){_0x2fa66f[_0x8aa8('0x36')][_0x43bdb4]['emit']('end');if(rpc[_0x2bc6d3[_0x8aa8('0x12')]+'QueueReport']){rpc[_0x2bc6d3[_0x8aa8('0x12')]+'QueueReport'][_0x8aa8('0x40')](_0x43bdb4,{'UserId':_0x2bc6d3[_0x8aa8('0x13')][_0x8aa8('0x41')]})[_0x8aa8('0x42')](function(){logger[_0x8aa8('0x35')](_0x8aa8('0x43'));});}}return _0x44f2b4({'code':0xc8,'message':_0x2bc6d3});}catch(_0x997597){logger[_0x8aa8('0x35')](_0x997597[_0x8aa8('0x3b')]);return _0x5adcda(_0x2a0a14[_0x8aa8('0x35')](0x1f4,_0x997597));}}logger[_0x8aa8('0x35')](_0x8aa8('0x44'));return _0x5adcda(_0x2a0a14['error'](0x1f4,_0x8aa8('0x44')));});},'RejectMessage':function(_0x548b6f){var _0x4d8865=this;return new Promise(function(_0x5e04d0,_0x40d3f3){if(_0x548b6f['agent']&&_0x548b6f[_0x8aa8('0x3d')]['id']){try{if(_0x2fa66f[_0x8aa8('0x3e')][_0x548b6f[_0x8aa8('0x3d')]['id']]){_0x2fa66f['agents'][_0x548b6f[_0x8aa8('0x3d')]['id']][_0x8aa8('0x3f')]=![];_0x2fa66f[_0x8aa8('0x3e')][_0x548b6f[_0x8aa8('0x3d')]['id']]['busyQueue']=undefined;}return _0x5e04d0({'code':0xc8,'message':_0x548b6f});}catch(_0x5f16d5){logger[_0x8aa8('0x35')](_0x5f16d5[_0x8aa8('0x3b')]);return _0x40d3f3(_0x4d8865[_0x8aa8('0x35')](0x1f4,_0x5f16d5));}}logger[_0x8aa8('0x35')]('message\x20is\x20empty');return _0x40d3f3(_0x4d8865['error'](0x1f4,_0x8aa8('0x44')));});},'AbandonInteraction':function(_0x1bd389){var _0x26eb56=this;return new Promise(function(_0x4bf6bc,_0x33e9ae){if(_0x1bd389[_0x8aa8('0x12')]&&_0x1bd389['interaction']&&_0x1bd389['interaction']['id']){try{var _0x4b6fd7=getId(_0x1bd389['channel'],_0x1bd389[_0x8aa8('0x13')]?_0x1bd389['message']['id']:0x0,_0x1bd389[_0x8aa8('0x27')]?_0x1bd389[_0x8aa8('0x27')]['id']:0x0);if(_0x2fa66f['rules'][_0x4b6fd7]){_0x2fa66f['rules'][_0x4b6fd7][_0x8aa8('0x39')](_0x8aa8('0x45'));}return _0x4bf6bc({'code':0xc8,'message':_0x1bd389});}catch(_0x578ca9){logger['error'](_0x578ca9['stack']);return _0x33e9ae(_0x26eb56[_0x8aa8('0x35')](0x1f4,_0x578ca9));}}logger[_0x8aa8('0x35')]('message\x20is\x20empty');return _0x33e9ae(_0x26eb56['error'](0x1f4,_0x8aa8('0x44')));});},'AgentCapacity':function(_0x18f5c6){var _0x5ac786=this;return new Promise(function(_0x3b141c,_0x43e352){if(_0x2fa66f['agents'][_0x8aa8('0x46')](_0x18f5c6['id'])){for(var _0x5dddbb in _0x18f5c6[_0x8aa8('0x47')]){if(_0x18f5c6['capacity'][_0x8aa8('0x46')](_0x5dddbb)){if(_0x2fa66f[_0x8aa8('0x3e')][_0x18f5c6['id']][_0x8aa8('0x46')](_0x5dddbb+_0x8aa8('0x48'))){_0x2fa66f[_0x8aa8('0x3e')][_0x18f5c6['id']][_0x5dddbb+'CurrentCapacity']=parseInt(_0x18f5c6[_0x8aa8('0x47')][_0x5dddbb],0xa);}}}_0x2fa66f[_0x8aa8('0x3e')][_0x18f5c6['id']][_0x8aa8('0x49')]();return _0x3b141c({'code':0xc8,'message':_0x2fa66f[_0x8aa8('0x3e')][_0x18f5c6['id']]});}else{return _0x43e352(_0x5ac786['error'](0x1f4,_0x8aa8('0x4a')));}});},'Agents':function(_0xfe073d){return new Promise(function(_0x5b160d){var _0x2f7fe2=_[_0x8aa8('0x4b')](_0x2fa66f[_0x8aa8('0x3e')]);if(_0xfe073d&&_0xfe073d['id']){var _0xec3379=_[_0x8aa8('0x4c')](_0x2f7fe2,function(_0x1d77c2){return _0x1d77c2['id']===_0xfe073d['id'];});_0x5b160d(_0xec3379);}else{_0x5b160d({'count':_0x2f7fe2[_0x8aa8('0x15')],'rows':_0x2f7fe2});}});},'ChatQueues':function(){return new Promise(function(_0x5eef74){var _0x54f38b=[];for(var _0x53dd80 in _0x2fa66f[_0x8aa8('0x4d')]){if(_0x2fa66f[_0x8aa8('0x4d')][_0x8aa8('0x46')](_0x53dd80)){var _0x1dca39=_0x2fa66f[_0x8aa8('0x4d')][_0x53dd80];var _0x28f792={'id':_0x1dca39['id'],'available':_0x1dca39[_0x8aa8('0x4e')],'loggedIn':_0x1dca39[_0x8aa8('0x4f')],'name':_0x1dca39[_0x8aa8('0x50')],'paused':_0x1dca39[_0x8aa8('0x51')],'waiting':_0x1dca39[_0x8aa8('0x52')]};_0x54f38b[_0x8aa8('0x1d')](_0x28f792);}}_0x5eef74({'count':_0x54f38b[_0x8aa8('0x15')],'rows':_0x54f38b});});},'MailQueues':function(){return new Promise(function(_0x26572c){var _0x3e80ac=[];for(var _0x36523a in _0x2fa66f[_0x8aa8('0x53')]){if(_0x2fa66f[_0x8aa8('0x53')][_0x8aa8('0x46')](_0x36523a)){var _0x57c6f5=_0x2fa66f[_0x8aa8('0x53')][_0x36523a];var _0x233169={'id':_0x57c6f5['id'],'available':_0x57c6f5[_0x8aa8('0x4e')],'loggedIn':_0x57c6f5[_0x8aa8('0x4f')],'name':_0x57c6f5[_0x8aa8('0x50')],'paused':_0x57c6f5[_0x8aa8('0x51')],'waiting':_0x57c6f5[_0x8aa8('0x52')]};_0x3e80ac[_0x8aa8('0x1d')](_0x233169);}}_0x26572c({'count':_0x3e80ac[_0x8aa8('0x15')],'rows':_0x3e80ac});});},'OpenchannelQueues':function(){return new Promise(function(_0x55cd87){var _0x2e4dd2=[];for(var _0x3d2c0e in _0x2fa66f['openchannelQueues']){if(_0x2fa66f[_0x8aa8('0x54')]['hasOwnProperty'](_0x3d2c0e)){var _0x1e52fc=_0x2fa66f[_0x8aa8('0x54')][_0x3d2c0e];var _0x4c45a6={'id':_0x1e52fc['id'],'available':_0x1e52fc[_0x8aa8('0x4e')],'loggedIn':_0x1e52fc[_0x8aa8('0x4f')],'name':_0x1e52fc[_0x8aa8('0x50')],'paused':_0x1e52fc[_0x8aa8('0x51')],'waiting':_0x1e52fc[_0x8aa8('0x52')]};_0x2e4dd2[_0x8aa8('0x1d')](_0x4c45a6);}}_0x55cd87({'count':_0x2e4dd2[_0x8aa8('0x15')],'rows':_0x2e4dd2});});},'SmsQueues':function(){return new Promise(function(_0x546c32){var _0x35fb7a=[];for(var _0x355ac1 in _0x2fa66f[_0x8aa8('0x55')]){if(_0x2fa66f[_0x8aa8('0x55')]['hasOwnProperty'](_0x355ac1)){var _0x4aeda8=_0x2fa66f[_0x8aa8('0x55')][_0x355ac1];var _0x3cfdc4={'id':_0x4aeda8['id'],'available':_0x4aeda8[_0x8aa8('0x4e')],'loggedIn':_0x4aeda8[_0x8aa8('0x4f')],'name':_0x4aeda8['name'],'paused':_0x4aeda8['paused'],'waiting':_0x4aeda8['waiting']};_0x35fb7a[_0x8aa8('0x1d')](_0x3cfdc4);}}_0x546c32({'count':_0x35fb7a[_0x8aa8('0x15')],'rows':_0x35fb7a});});},'FaxQueues':function(){return new Promise(function(_0x1b7baa){var _0x306436=[];for(var _0x3f4588 in _0x2fa66f[_0x8aa8('0x56')]){if(_0x2fa66f[_0x8aa8('0x56')][_0x8aa8('0x46')](_0x3f4588)){var _0x4e5c7b=_0x2fa66f['faxQueues'][_0x3f4588];var _0x3ce130={'id':_0x4e5c7b['id'],'available':_0x4e5c7b['available'],'loggedIn':_0x4e5c7b['loggedIn'],'name':_0x4e5c7b[_0x8aa8('0x50')],'paused':_0x4e5c7b[_0x8aa8('0x51')],'waiting':_0x4e5c7b[_0x8aa8('0x52')]};_0x306436['push'](_0x3ce130);}}_0x1b7baa({'count':_0x306436[_0x8aa8('0x15')],'rows':_0x306436});});},'WhatsappQueues':function(){return new Promise(function(_0x4d8d6e){var _0x30b1c4=[];for(var _0x18ca34 in _0x2fa66f[_0x8aa8('0x57')]){if(_0x2fa66f[_0x8aa8('0x57')][_0x8aa8('0x46')](_0x18ca34)){var _0x5d1c8e=_0x2fa66f['whatsappQueues'][_0x18ca34];var _0x11d2e9={'id':_0x5d1c8e['id'],'available':_0x5d1c8e[_0x8aa8('0x4e')],'loggedIn':_0x5d1c8e[_0x8aa8('0x4f')],'name':_0x5d1c8e[_0x8aa8('0x50')],'paused':_0x5d1c8e[_0x8aa8('0x51')],'waiting':_0x5d1c8e[_0x8aa8('0x52')]};_0x30b1c4[_0x8aa8('0x1d')](_0x11d2e9);}}_0x4d8d6e({'count':_0x30b1c4[_0x8aa8('0x15')],'rows':_0x30b1c4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x537322){var _0x3b9a77=_[_0x8aa8('0x4b')](_0x2fa66f['chatQueuesWaitingInteractions']);_0x537322({'count':_0x3b9a77['length'],'rows':_0x3b9a77});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x202b9c){var _0x395cd4=_['values'](_0x2fa66f[_0x8aa8('0x58')]);_0x202b9c({'count':_0x395cd4[_0x8aa8('0x15')],'rows':_0x395cd4});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x2b7240){var _0x5cec44=_['values'](_0x2fa66f['openchannelQueuesWaitingInteractions']);_0x2b7240({'count':_0x5cec44[_0x8aa8('0x15')],'rows':_0x5cec44});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2dcf5a){var _0xc6f4e6=_[_0x8aa8('0x4b')](_0x2fa66f['smsQueuesWaitingInteractions']);_0x2dcf5a({'count':_0xc6f4e6[_0x8aa8('0x15')],'rows':_0xc6f4e6});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5ed97b){var _0x323aca=_[_0x8aa8('0x4b')](_0x2fa66f['faxQueuesWaitingInteractions']);_0x5ed97b({'count':_0x323aca[_0x8aa8('0x15')],'rows':_0x323aca});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5714b7){var _0x54b94d=_[_0x8aa8('0x4b')](_0x2fa66f['whatsappQueuesWaitingInteractions']);_0x5714b7({'count':_0x54b94d[_0x8aa8('0x15')],'rows':_0x54b94d});});}};var _0x34a5a9=jayson[_0x8aa8('0x59')](_0x4f3a2e)['http']();_0x34a5a9['on'](_0x8aa8('0x35'),function(_0x3d30b7){logger[_0x8aa8('0x35')](JSON[_0x8aa8('0x37')](_0x3d30b7));return _0x4af534(_0x3d30b7);});_0x34a5a9[_0x8aa8('0x11')](0x232c,_0x8aa8('0x5a'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x391642(_0x8aa8('0x5b')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 12cd744..537b5eb 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 _0x43c4=['error','catch','rules','length','push','Command','format','message','true','[%s][INTERVAL]\x20%s','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x43c4,0x163));var _0x443c=function(_0x3d536,_0x53ae9e){_0x3d536=_0x3d536-0x0;var _0x4bc83a=_0x43c4[_0x3d536];return _0x4bc83a;};'use strict';var util=require(_0x443c('0x0'));var BPromise=require(_0x443c('0x1'));var jayson=require(_0x443c('0x2'));var _=require(_0x443c('0x3'));var logger=require(_0x443c('0x4'))(_0x443c('0x5'));var client=jayson[_0x443c('0x6')]['http']({'port':0x232a});function request(_0x11856e,_0x29d40c){return new BPromise(function(_0x59468f,_0x29b1d2){return client[_0x443c('0x7')](_0x11856e,_0x29d40c)[_0x443c('0x8')](function(_0xfe3cff){if(_0xfe3cff[_0x443c('0x9')]){return _0x29b1d2(_0xfe3cff[_0x443c('0x9')]['message']);}else{return _0x59468f(_0xfe3cff['result']);}})[_0x443c('0xa')](function(_0x1b6459){return _0x29b1d2(_0x1b6459);});});}exports['condition']=function(_0x20a70f,_0x26f1ca,_0x470a5f){return function(_0x1a20be){if(_0x470a5f['rules']&&!_0x470a5f[_0x443c('0xb')][_0x20a70f]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x20a70f);return _0x1a20be['stop']();}var _0x34533e=[];for(var _0x365cc0=0x0;_0x365cc0<_0x26f1ca[_0x443c('0xc')];_0x365cc0+=0x1){_0x34533e[_0x443c('0xd')](request(_0x443c('0xe'),{'command':util[_0x443c('0xf')]('iftime\x20%s',_0x26f1ca[_0x365cc0])})['then'](function(_0x4f90fa){return _0x4f90fa&&_0x4f90fa[_0x443c('0x10')]&&_0x4f90fa[_0x443c('0x10')]['indexOf'](_0x443c('0x11'))>=0x0?!![]:![];})[_0x443c('0xa')](function(_0x4276b3){logger[_0x443c('0x9')](_0x443c('0x12'),_0x20a70f,_0x26f1ca[_0x365cc0]);}));}BPromise['all'](_0x34533e)[_0x443c('0x8')](function(_0x141a45){var _0x5e4d54=_[_0x443c('0x13')](_0x141a45);logger[_0x443c('0x14')](_0x443c('0x15'),_0x20a70f,_0x26f1ca[_0x443c('0x16')](_0x443c('0x17')),_0x5e4d54);_0x1a20be[_0x443c('0x18')](_0x5e4d54);})['catch'](function(_0x15c6a6){console[_0x443c('0x19')](_0x15c6a6);logger[_0x443c('0x9')](_0x443c('0x15'),_0x20a70f,_0x26f1ca[_0x443c('0x16')](_0x443c('0x17')),_0x15c6a6[_0x443c('0x1a')]);_0x1a20be[_0x443c('0x1b')]();});};}; \ No newline at end of file +var _0x6c82=['\x20|\x20','when','stack','stop','util','lodash','../../../config/logger','routing','client','http','error','result','catch','condition','rules','length','format','iftime\x20%s','then','message','indexOf','true','[%s][INTERVAL]\x20%s','[%s][INTERVAL]\x20%s\x20%s','join'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x6c82,0x17b));var _0x26c8=function(_0x239e4b,_0x5525c6){_0x239e4b=_0x239e4b-0x0;var _0x4ae53a=_0x6c82[_0x239e4b];return _0x4ae53a;};'use strict';var util=require(_0x26c8('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x26c8('0x1'));var logger=require(_0x26c8('0x2'))(_0x26c8('0x3'));var client=jayson[_0x26c8('0x4')][_0x26c8('0x5')]({'port':0x232a});function request(_0x5269ee,_0x19f871){return new BPromise(function(_0x2022e0,_0x1b05ef){return client['request'](_0x5269ee,_0x19f871)['then'](function(_0x1ae7bd){if(_0x1ae7bd[_0x26c8('0x6')]){return _0x1b05ef(_0x1ae7bd['error']['message']);}else{return _0x2022e0(_0x1ae7bd[_0x26c8('0x7')]);}})[_0x26c8('0x8')](function(_0x4e9785){return _0x1b05ef(_0x4e9785);});});}exports[_0x26c8('0x9')]=function(_0x3f71cf,_0x29b3c5,_0x3440ec){return function(_0x2cf8e4){if(_0x3440ec[_0x26c8('0xa')]&&!_0x3440ec['rules'][_0x3f71cf]){logger['info']('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x3f71cf);return _0x2cf8e4['stop']();}var _0x279743=[];for(var _0x5d0182=0x0;_0x5d0182<_0x29b3c5[_0x26c8('0xb')];_0x5d0182+=0x1){_0x279743['push'](request('Command',{'command':util[_0x26c8('0xc')](_0x26c8('0xd'),_0x29b3c5[_0x5d0182])})[_0x26c8('0xe')](function(_0x34d073){return _0x34d073&&_0x34d073[_0x26c8('0xf')]&&_0x34d073[_0x26c8('0xf')][_0x26c8('0x10')](_0x26c8('0x11'))>=0x0?!![]:![];})['catch'](function(_0x31c23f){logger[_0x26c8('0x6')](_0x26c8('0x12'),_0x3f71cf,_0x29b3c5[_0x5d0182]);}));}BPromise['all'](_0x279743)[_0x26c8('0xe')](function(_0x567cc9){var _0x2b334f=_['some'](_0x567cc9);logger['info'](_0x26c8('0x13'),_0x3f71cf,_0x29b3c5[_0x26c8('0x14')](_0x26c8('0x15')),_0x2b334f);_0x2cf8e4[_0x26c8('0x16')](_0x2b334f);})[_0x26c8('0x8')](function(_0x3924ad){console['log'](_0x3924ad);logger[_0x26c8('0x6')](_0x26c8('0x13'),_0x3f71cf,_0x29b3c5['join'](_0x26c8('0x15')),_0x3924ad[_0x26c8('0x17')]);_0x2cf8e4[_0x26c8('0x18')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b7f19a2..135ece6 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 _0xa5fa=['[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertype','secondtransfererexten','transferuniqueid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','[%s][agents][agentcalled]','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer'];(function(_0x3865b1,_0x2e7692){var _0x14f78a=function(_0x4c2db8){while(--_0x4c2db8){_0x3865b1['push'](_0x3865b1['shift']());}};_0x14f78a(++_0x2e7692);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x46fc28,_0x4746fb){_0x46fc28=_0x46fc28-0x0;var _0x5888fe=_0xa5fa[_0x46fc28];return _0x5888fe;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var utils=require(_0xaa5f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24d383,_0x1b7e1d){utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x3'),_0x24d383['uniqueid'],_0x24d383[_0xaa5f('0x4')],_0x24d383[_0xaa5f('0x5')],_0x24d383[_0xaa5f('0x6')],_0x24d383[_0xaa5f('0x7')],_0x24d383[_0xaa5f('0x8')],_0x24d383[_0xaa5f('0x9')],_0x24d383[_0xaa5f('0xa')]));if(_0x24d383[_0xaa5f('0x5')]){utils[_0xaa5f('0xb')](_0x24d383[_0xaa5f('0x5')])[_0xaa5f('0xc')](function(_0x4e5257){if(_0x4e5257){_0x24d383[_0xaa5f('0xd')]=_0x4e5257[_0xaa5f('0xd')];_0x24d383['agentacw']=_0x24d383['agentcomplete']?_0x4e5257[_0xaa5f('0xe')]:![];_0x24d383['acwtime']=_0x24d383['agentacw']?_0x4e5257[_0xaa5f('0xf')]:0x0;}utils['request'](_0xaa5f('0x10'),_0x24d383);});}else{utils[_0xaa5f('0x11')](_0xaa5f('0x10'),_0x24d383);}if(_0x1b7e1d){delete transfers[_0x24d383[_0xaa5f('0x12')]];}else{delete agents[_0x24d383[_0xaa5f('0x13')]];}}exports['agentcalled']=function(_0xbd4e10){try{utils['debug'](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0xbd4e10);agents[_0xbd4e10[_0xaa5f('0x13')]]=_0xbd4e10;agents[_0xbd4e10[_0xaa5f('0x13')]]['agentcalledAt']=utils['now']();agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x15');agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x9')]=null;agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x16')]=null;utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x18'),_0xbd4e10[_0xaa5f('0x12')],agents[_0xbd4e10[_0xaa5f('0x13')]]['membername'],_0xbd4e10[_0xaa5f('0x13')]));}catch(_0x4c0a9d){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0x4c0a9d);}};exports[_0xaa5f('0x1a')]=function(_0x194691){try{if(!_[_0xaa5f('0x1b')](agents[_0x194691[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x1d'),_0x194691['uniqueid']),_0x194691);utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x1e'),_0x194691[_0xaa5f('0x12')],agents[_0x194691['destuniqueid']][_0xaa5f('0x6')],_0x194691[_0xaa5f('0x13')]));agents[_0x194691['destuniqueid']][_0xaa5f('0x1a')]=!![];agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x1f')]=utils[_0xaa5f('0x20')]();agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]]['reason']=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x194691['ringtime']?parseInt(_0x194691[_0xaa5f('0x23')])/0x3e8:0x0;agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x24')]=0x0;unanswered['push'](_0x194691[_0xaa5f('0x13')]);}}catch(_0x479f29){utils['error'](util[_0xaa5f('0x2')]('[%s][agents][agentringnoanswer]',_0x194691[_0xaa5f('0x12')]),_0x479f29);}};exports['queuecallerabandon']=function(_0x4c5dc0){try{_['forIn'](agents,function(_0x26a90d,_0x4ddebd){if(_0x26a90d[_0xaa5f('0x12')]==_0x4c5dc0[_0xaa5f('0x12')]&&!_['includes'](unanswered,_0x26a90d['destuniqueid'])){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x4c5dc0);utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x26'),_0x4c5dc0[_0xaa5f('0x12')],_0x26a90d['membername'],_0x26a90d[_0xaa5f('0x13')]));_0x26a90d[_0xaa5f('0x1a')]=!![];_0x26a90d['agentringnoanswerAt']=utils['now']();_0x26a90d['lastevent']='abandoned';_0x26a90d[_0xaa5f('0x27')]=_0xaa5f('0x28');_0x26a90d[_0xaa5f('0x22')]=_0x4c5dc0[_0xaa5f('0x22')];_0x26a90d[_0xaa5f('0x24')]=0x0;writeDB(_0x26a90d);}});}catch(_0x3bcaf6){utils[_0xaa5f('0x19')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x3bcaf6);}};exports[_0xaa5f('0x29')]=function(_0x1f3268){try{if(agents[_0x1f3268[_0xaa5f('0x13')]]){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x2a'),_0x1f3268[_0xaa5f('0x12')]),_0x1f3268);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x2b'),_0x1f3268['uniqueid'],agents[_0x1f3268['destuniqueid']][_0xaa5f('0x6')],_0x1f3268[_0xaa5f('0x13')]));agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x2c')]=utils['now']();agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x9')]=_0x1f3268[_0xaa5f('0x9')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x16')]=_0x1f3268[_0xaa5f('0x16')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0xa')]='connect';_[_0xaa5f('0x2d')](agents,function(_0x2562ce,_0xcd9c30){if(_0x2562ce[_0xaa5f('0x13')]!=_0x1f3268[_0xaa5f('0x13')]&&_0x2562ce[_0xaa5f('0x12')]==_0x1f3268[_0xaa5f('0x12')]){_0x2562ce[_0xaa5f('0x24')]=0x0;_0x2562ce[_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];_0x2562ce['agentringnoanswer']=!![];_0x2562ce[_0xaa5f('0x1f')]=utils['now']();_0x2562ce[_0xaa5f('0xa')]=_0xaa5f('0x2e');_0x2562ce[_0xaa5f('0x27')]='answered_elsewhere';_0x2562ce[_0xaa5f('0x2f')]=_0x1f3268[_0xaa5f('0x13')];_0x2562ce[_0xaa5f('0x30')]=_0x1f3268['membername'];writeDB(_0x2562ce);}});}}catch(_0x12a8e4){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x2a'),_0x1f3268['uniqueid']),_0x12a8e4);}};exports[_0xaa5f('0x31')]=function(_0x2b2b4c){try{if(!_[_0xaa5f('0x1b')](agents[_0x2b2b4c[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x2b2b4c);utils['info'](util[_0xaa5f('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2b2b4c[_0xaa5f('0x12')],agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x6')],_0x2b2b4c[_0xaa5f('0x13')]));agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x33')]=utils['now']();agents[_0x2b2b4c['destuniqueid']]['talktime']=utils[_0xaa5f('0x34')](agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x33')],agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x2c')]);agents[_0x2b2b4c[_0xaa5f('0x13')]]['reason']=_0x2b2b4c[_0xaa5f('0x27')];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x35');writeDB(agents[_0x2b2b4c[_0xaa5f('0x13')]]);}}catch(_0x1f9629){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x1f9629);}};exports[_0xaa5f('0x36')]=function(_0x2de737){try{if(!_[_0xaa5f('0x1b')](agents[_0x2de737[_0xaa5f('0x37')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')]('[%s][agents][blindtransfer]',_0x2de737[_0xaa5f('0x12')]),_0x2de737);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x38'),_0x2de737[_0xaa5f('0x12')],agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x6')],agents[_0x2de737['transfereruniqueid']][_0xaa5f('0x12')]));agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x39')]=!![];agents[_0x2de737[_0xaa5f('0x37')]]['transfertype']=_0xaa5f('0x3a');agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x3b')]=_0x2de737['extension'];agents[_0x2de737['transfereruniqueid']]['transferuniqueid']=agents[_0x2de737['transfereruniqueid']]['uniqueid'];}}catch(_0x509c61){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3c'),_0x2de737[_0xaa5f('0x12')]),_0x509c61);}};exports[_0xaa5f('0x3d')]=function(_0x17b872){try{utils['debug'](util['format'](_0xaa5f('0x3e'),_0x17b872[_0xaa5f('0x3f')]),_0x17b872);if(_0x17b872['origtransfereruniqueid']==_0x17b872[_0xaa5f('0x40')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872[_0xaa5f('0x41')]])){utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872['secondtransfereruniqueid']]['membername']));agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x39')]=!![];agents[_0x17b872['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x17b872[_0xaa5f('0x41')]]['transferexten']=_0x17b872[_0xaa5f('0x43')];agents[_0x17b872['secondtransfereruniqueid']]['transferuniqueid']=_0x17b872[_0xaa5f('0x3f')];}if(_0x17b872[_0xaa5f('0x44')]&&agents[_0x17b872[_0xaa5f('0x44')]]){agents[_0x17b872['transfereeuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x44')]]=_[_0xaa5f('0x46')](agents[_0x17b872['transfereeuniqueid']]);transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x8')]=agents[_0x17b872['secondtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x47')]=agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x48')]=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]]['agentconnectAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x45')]=0x2;}}else if(_0x17b872[_0xaa5f('0x41')]==_0x17b872[_0xaa5f('0x49')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872['origtransfereruniqueid']])){utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x6')]));agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x39')]=!![];agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x4a')]='ATTENDED';agents[_0x17b872[_0xaa5f('0x3f')]]['transferexten']=_0x17b872[_0xaa5f('0x4b')];agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x4c')]=_0x17b872[_0xaa5f('0x41')];}if(_0x17b872[_0xaa5f('0x4d')]&&agents[_0x17b872[_0xaa5f('0x4d')]]){agents[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x4d')]]=_['clone'](agents[_0x17b872['transfertargetuniqueid']]);transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x8')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x47')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x4d')]]['agentcalledAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x2c')]=utils['now']();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x2;}}}catch(_0x309605){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3e'),_0x17b872['origtransfereruniqueid']),_0x309605);}};exports[_0xaa5f('0x4e')]=function(_0x2ba378){try{utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x4f'),_0x2ba378['uniqueid']),_0x2ba378);if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378['uniqueid']][_0xaa5f('0x27')]===_0xaa5f('0x21')){if(_0x2ba378[_0xaa5f('0x50')]==='21'){agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=_0xaa5f('0x51');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x51');}utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378['uniqueid'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]]['lastevent']));writeDB(agents[_0x2ba378['uniqueid']]);var _0x104079=unanswered[_0xaa5f('0x52')](_0x2ba378['uniqueid']);if(_0x104079>-0x1){unanswered[_0xaa5f('0x53')](_0x104079,0x1);}}if(transfers[_0x2ba378['uniqueid']]){transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x31')]=!![];transfers[_0x2ba378['uniqueid']][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')],transfers[_0x2ba378['uniqueid']][_0xaa5f('0x2c')]);transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')]='agent';transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378[_0xaa5f('0x12')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(transfers[_0x2ba378[_0xaa5f('0x12')]],!![]);}if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378[_0xaa5f('0x12')]]['agentconnectAt']){agents[_0x2ba378['uniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](agents[_0x2ba378[_0xaa5f('0x12')]]['agentcompleteAt'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x2c')]);agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=agents[_0x2ba378['uniqueid']][_0xaa5f('0x39')]?_0xaa5f('0x39'):_0xaa5f('0x54');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x55'),_0x2ba378[_0xaa5f('0x12')],agents[_0x2ba378['uniqueid']][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(agents[_0x2ba378['uniqueid']]);}}catch(_0x4183c0){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')]('[%s][agents][hangup]',_0x2ba378['uniqueid']),_0x4183c0);}}; \ No newline at end of file +var _0xf7b4=['acw','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','ringtime','push','queuecallerabandon','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','agentcompleteAt','agentconnectAt','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','complete','lodash','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete'];(function(_0x2b338b,_0x4a06ba){var _0x256f66=function(_0x13c9c4){while(--_0x13c9c4){_0x2b338b['push'](_0x2b338b['shift']());}};_0x256f66(++_0x4a06ba);}(_0xf7b4,0x152));var _0x4f7b=function(_0x5715de,_0x2d54fe){_0x5715de=_0x5715de-0x0;var _0x3ee069=_0xf7b4[_0x5715de];return _0x3ee069;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x5ccf30,_0x103165){utils['info'](util['format'](_0x4f7b('0x1'),_0x5ccf30[_0x4f7b('0x2')],_0x5ccf30[_0x4f7b('0x3')],_0x5ccf30[_0x4f7b('0x4')],_0x5ccf30[_0x4f7b('0x5')],_0x5ccf30[_0x4f7b('0x6')],_0x5ccf30[_0x4f7b('0x7')],_0x5ccf30[_0x4f7b('0x8')],_0x5ccf30[_0x4f7b('0x9')]));if(_0x5ccf30[_0x4f7b('0x4')]){utils[_0x4f7b('0xa')](_0x5ccf30[_0x4f7b('0x4')])[_0x4f7b('0xb')](function(_0x5c714d){if(_0x5c714d){_0x5ccf30[_0x4f7b('0xc')]=_0x5c714d[_0x4f7b('0xc')];_0x5ccf30['agentacw']=_0x5ccf30[_0x4f7b('0xd')]?_0x5c714d[_0x4f7b('0xe')]:![];_0x5ccf30[_0x4f7b('0xf')]=_0x5ccf30[_0x4f7b('0x10')]?_0x5c714d[_0x4f7b('0x11')]:0x0;}utils['request'](_0x4f7b('0x12'),_0x5ccf30);});}else{utils['request']('CreateVoiceAgentReport',_0x5ccf30);}if(_0x103165){delete transfers[_0x5ccf30[_0x4f7b('0x2')]];}else{delete agents[_0x5ccf30[_0x4f7b('0x13')]];}}exports[_0x4f7b('0x14')]=function(_0x41a050){try{utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x16'),_0x41a050[_0x4f7b('0x2')]),_0x41a050);agents[_0x41a050[_0x4f7b('0x13')]]=_0x41a050;agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x19');agents[_0x41a050[_0x4f7b('0x13')]][_0x4f7b('0x8')]=null;agents[_0x41a050['destuniqueid']][_0x4f7b('0x1a')]=null;utils['info'](util['format'](_0x4f7b('0x1b'),_0x41a050[_0x4f7b('0x2')],agents[_0x41a050['destuniqueid']][_0x4f7b('0x5')],_0x41a050[_0x4f7b('0x13')]));}catch(_0x13a0f5){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x16'),_0x41a050['uniqueid']),_0x13a0f5);}};exports[_0x4f7b('0x1d')]=function(_0x12374b){try{if(!_[_0x4f7b('0x1e')](agents[_0x12374b[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x20'),_0x12374b[_0x4f7b('0x2')]),_0x12374b);utils[_0x4f7b('0x21')](util['format'](_0x4f7b('0x22'),_0x12374b[_0x4f7b('0x2')],agents[_0x12374b[_0x4f7b('0x13')]]['membername'],_0x12374b[_0x4f7b('0x13')]));agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswer']=!![];agents[_0x12374b[_0x4f7b('0x13')]]['agentringnoanswerAt']=utils[_0x4f7b('0x18')]();agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x9')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]][_0x4f7b('0x24')]=_0x4f7b('0x23');agents[_0x12374b[_0x4f7b('0x13')]]['holdtime']=_0x12374b[_0x4f7b('0x25')]?parseInt(_0x12374b[_0x4f7b('0x25')])/0x3e8:0x0;agents[_0x12374b[_0x4f7b('0x13')]]['talktime']=0x0;unanswered[_0x4f7b('0x26')](_0x12374b[_0x4f7b('0x13')]);}}catch(_0x1db684){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')]('[%s][agents][agentringnoanswer]',_0x12374b[_0x4f7b('0x2')]),_0x1db684);}};exports[_0x4f7b('0x27')]=function(_0x9a675c){try{_['forIn'](agents,function(_0x7de561,_0x5d13a1){if(_0x7de561['uniqueid']==_0x9a675c[_0x4f7b('0x2')]&&!_['includes'](unanswered,_0x7de561[_0x4f7b('0x13')])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x28'),_0x9a675c[_0x4f7b('0x2')]),_0x9a675c);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x29'),_0x9a675c[_0x4f7b('0x2')],_0x7de561[_0x4f7b('0x5')],_0x7de561[_0x4f7b('0x13')]));_0x7de561[_0x4f7b('0x1d')]=!![];_0x7de561[_0x4f7b('0x2a')]=utils[_0x4f7b('0x18')]();_0x7de561[_0x4f7b('0x9')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x24')]=_0x4f7b('0x2b');_0x7de561[_0x4f7b('0x2c')]=_0x9a675c[_0x4f7b('0x2c')];_0x7de561[_0x4f7b('0x2d')]=0x0;writeDB(_0x7de561);}});}catch(_0x172235){utils['error'](util[_0x4f7b('0x15')]('[%s][agents][queuecallerabandon]',_0x9a675c[_0x4f7b('0x2')]),_0x172235);}};exports[_0x4f7b('0x2e')]=function(_0x579ad4){try{if(agents[_0x579ad4[_0x4f7b('0x13')]]){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')]('[%s][agents][agentconnect]',_0x579ad4[_0x4f7b('0x2')]),_0x579ad4);utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x2f'),_0x579ad4[_0x4f7b('0x2')],agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x579ad4['destuniqueid']));agents[_0x579ad4[_0x4f7b('0x13')]]['agentconnectAt']=utils[_0x4f7b('0x18')]();agents[_0x579ad4[_0x4f7b('0x13')]][_0x4f7b('0x8')]=_0x579ad4['connectedlinenum'];agents[_0x579ad4[_0x4f7b('0x13')]]['connectedlinename']=_0x579ad4[_0x4f7b('0x1a')];agents[_0x579ad4[_0x4f7b('0x13')]]['holdtime']=_0x579ad4['ringtime'];agents[_0x579ad4[_0x4f7b('0x13')]]['lastevent']=_0x4f7b('0x30');_[_0x4f7b('0x31')](agents,function(_0x54f9e8,_0x1d0746){if(_0x54f9e8['destuniqueid']!=_0x579ad4['destuniqueid']&&_0x54f9e8['uniqueid']==_0x579ad4[_0x4f7b('0x2')]){_0x54f9e8[_0x4f7b('0x2d')]=0x0;_0x54f9e8[_0x4f7b('0x2c')]=_0x579ad4[_0x4f7b('0x25')];_0x54f9e8['agentringnoanswer']=!![];_0x54f9e8[_0x4f7b('0x2a')]=utils['now']();_0x54f9e8[_0x4f7b('0x9')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x24')]='answered_elsewhere';_0x54f9e8[_0x4f7b('0x32')]=_0x579ad4[_0x4f7b('0x13')];_0x54f9e8[_0x4f7b('0x33')]=_0x579ad4[_0x4f7b('0x5')];writeDB(_0x54f9e8);}});}}catch(_0x2986cd){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x34'),_0x579ad4[_0x4f7b('0x2')]),_0x2986cd);}};exports[_0x4f7b('0xd')]=function(_0x2d0be3){try{if(!_[_0x4f7b('0x1e')](agents[_0x2d0be3[_0x4f7b('0x13')]])){utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x2d0be3);utils[_0x4f7b('0x21')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2d0be3[_0x4f7b('0x2')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x5')],_0x2d0be3[_0x4f7b('0x13')]));agents[_0x2d0be3['destuniqueid']]['agentcomplete']=!![];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();agents[_0x2d0be3[_0x4f7b('0x13')]]['talktime']=utils['diffTime'](agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x36')],agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x37')]);agents[_0x2d0be3[_0x4f7b('0x13')]]['reason']=_0x2d0be3[_0x4f7b('0x24')];agents[_0x2d0be3[_0x4f7b('0x13')]][_0x4f7b('0x9')]='complete';writeDB(agents[_0x2d0be3[_0x4f7b('0x13')]]);}}catch(_0x104e7f){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x35'),_0x2d0be3[_0x4f7b('0x2')]),_0x104e7f);}};exports[_0x4f7b('0x38')]=function(_0x2e563f){try{if(!_[_0x4f7b('0x1e')](agents[_0x2e563f[_0x4f7b('0x39')]])){utils['debug'](util[_0x4f7b('0x15')](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x2e563f);utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x3b'),_0x2e563f[_0x4f7b('0x2')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x5')],agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')]));agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3c')]=!![];agents[_0x2e563f[_0x4f7b('0x39')]]['transfertype']=_0x4f7b('0x3d');agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3e')]=_0x2e563f['extension'];agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x3f')]=agents[_0x2e563f[_0x4f7b('0x39')]][_0x4f7b('0x2')];}}catch(_0x3437a8){utils[_0x4f7b('0x1c')](util['format'](_0x4f7b('0x3a'),_0x2e563f[_0x4f7b('0x2')]),_0x3437a8);}};exports[_0x4f7b('0x40')]=function(_0x4c9496){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x4c9496);if(_0x4c9496[_0x4f7b('0x42')]==_0x4c9496[_0x4f7b('0x43')]){if(!_['isNil'](agents[_0x4c9496[_0x4f7b('0x44')]])){utils['info'](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x4c9496[_0x4f7b('0x42')],agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x5')]));agents[_0x4c9496['secondtransfereruniqueid']]['transfer']=!![];agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x45')]='ATTENDED';agents[_0x4c9496[_0x4f7b('0x44')]][_0x4f7b('0x3e')]=_0x4c9496[_0x4f7b('0x46')];agents[_0x4c9496[_0x4f7b('0x44')]]['transferuniqueid']=_0x4c9496[_0x4f7b('0x42')];}if(_0x4c9496[_0x4f7b('0x47')]&&agents[_0x4c9496[_0x4f7b('0x47')]]){agents[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496[_0x4f7b('0x47')]]=_[_0x4f7b('0x49')](agents[_0x4c9496['transfereeuniqueid']]);transfers[_0x4c9496['transfereeuniqueid']]['calleridnum']=agents[_0x4c9496[_0x4f7b('0x44')]]['calleridnum'];transfers[_0x4c9496['transfereeuniqueid']]['calleridname']=agents[_0x4c9496['secondtransfereruniqueid']][_0x4f7b('0x4a')];transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x17')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496[_0x4f7b('0x47')]][_0x4f7b('0x48')]=0x2;}}else if(_0x4c9496[_0x4f7b('0x44')]==_0x4c9496[_0x4f7b('0x4b')]){if(!_[_0x4f7b('0x1e')](agents[_0x4c9496[_0x4f7b('0x42')]])){utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x4c'),_0x4c9496['origtransfereruniqueid'],agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x5')]));agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3c')]=!![];agents[_0x4c9496[_0x4f7b('0x42')]]['transfertype']='ATTENDED';agents[_0x4c9496[_0x4f7b('0x42')]]['transferexten']=_0x4c9496[_0x4f7b('0x4d')];agents[_0x4c9496[_0x4f7b('0x42')]][_0x4f7b('0x3f')]=_0x4c9496[_0x4f7b('0x44')];}if(_0x4c9496['transfertargetuniqueid']&&agents[_0x4c9496[_0x4f7b('0x4e')]]){agents[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x48')]=0x1;transfers[_0x4c9496['transfertargetuniqueid']]=_['clone'](agents[_0x4c9496['transfertargetuniqueid']]);transfers[_0x4c9496[_0x4f7b('0x4e')]]['calleridnum']=agents[_0x4c9496['origtransfereruniqueid']]['calleridnum'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x4a')]=agents[_0x4c9496[_0x4f7b('0x42')]]['calleridname'];transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x17')]=utils['now']();transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x37')]=utils[_0x4f7b('0x18')]();transfers[_0x4c9496[_0x4f7b('0x4e')]][_0x4f7b('0x2c')]=0x0;transfers[_0x4c9496['transfertargetuniqueid']][_0x4f7b('0x48')]=0x2;}}}catch(_0x40534d){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x41'),_0x4c9496[_0x4f7b('0x42')]),_0x40534d);}};exports['hangup']=function(_0x1fa0fd){try{utils[_0x4f7b('0x1f')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x1fa0fd);if(agents[_0x1fa0fd['uniqueid']]&&agents[_0x1fa0fd['uniqueid']]['reason']===_0x4f7b('0x23')){if(_0x1fa0fd[_0x4f7b('0x50')]==='21'){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x51');agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]=_0x4f7b('0x51');}utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd[_0x4f7b('0x2')]]);var _0x19e4ab=unanswered[_0x4f7b('0x53')](_0x1fa0fd[_0x4f7b('0x2')]);if(_0x19e4ab>-0x1){unanswered[_0x4f7b('0x54')](_0x19e4ab,0x1);}}if(transfers[_0x1fa0fd[_0x4f7b('0x2')]]){transfers[_0x1fa0fd['uniqueid']]['agentcomplete']=!![];transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')]=utils[_0x4f7b('0x18')]();transfers[_0x1fa0fd[_0x4f7b('0x2')]]['talktime']=utils[_0x4f7b('0x55')](transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x36')],transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]);transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=_0x4f7b('0x56');transfers[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]=_0x4f7b('0x57');utils[_0x4f7b('0x21')](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x5')],transfers[_0x1fa0fd[_0x4f7b('0x2')]]['reason'],transfers[_0x1fa0fd['uniqueid']][_0x4f7b('0x9')]));writeDB(transfers[_0x1fa0fd[_0x4f7b('0x2')]],!![]);}if(agents[_0x1fa0fd[_0x4f7b('0x2')]]&&agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x37')]){agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0xd')]=!![];agents[_0x1fa0fd['uniqueid']]['agentcompleteAt']=utils[_0x4f7b('0x18')]();agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x2d')]=utils[_0x4f7b('0x55')](agents[_0x1fa0fd['uniqueid']][_0x4f7b('0x36')],agents[_0x1fa0fd[_0x4f7b('0x2')]]['agentconnectAt']);agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')]=agents[_0x1fa0fd['uniqueid']]['transfer']?_0x4f7b('0x3c'):'agent';agents[_0x1fa0fd['uniqueid']]['lastevent']=_0x4f7b('0x57');utils['info'](util[_0x4f7b('0x15')](_0x4f7b('0x52'),_0x1fa0fd[_0x4f7b('0x2')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x5')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x24')],agents[_0x1fa0fd[_0x4f7b('0x2')]][_0x4f7b('0x9')]));writeDB(agents[_0x1fa0fd['uniqueid']]);}}catch(_0x476637){utils[_0x4f7b('0x1c')](util[_0x4f7b('0x15')](_0x4f7b('0x4f'),_0x1fa0fd[_0x4f7b('0x2')]),_0x476637);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ce8655a..ad44ac6 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 _0x73a8=['now','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastapplication','lastdata','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','split','substring','includes','noop','gotoif','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','channel','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten'];(function(_0x60eab1,_0x954319){var _0x567c5a=function(_0x5f3716){while(--_0x5f3716){_0x60eab1['push'](_0x60eab1['shift']());}};_0x567c5a(++_0x954319);}(_0x73a8,0x12a));var _0x873a=function(_0x3942ff,_0x2c34a4){_0x3942ff=_0x3942ff-0x0;var _0x44d0af=_0x73a8[_0x3942ff];return _0x44d0af;};'use strict';var _=require('lodash');var util=require(_0x873a('0x0'));var utils=require('./utils');var transfers=require(_0x873a('0x1'));var dispositions=[_0x873a('0x2'),_0x873a('0x3'),_0x873a('0x3'),_0x873a('0x2'),_0x873a('0x2'),'NO\x20ANSWER',_0x873a('0x4'),_0x873a('0x5'),_0x873a('0x3'),_0x873a('0x3'),_0x873a('0x3')];var channels={};function writeDB(_0x2fae77){var _0x5d4a24;if(transfers['blinds'][_0x2fae77['uniqueid']]){_0x5d4a24=_0x2fae77[_0x873a('0x6')];_0x2fae77[_0x873a('0x6')]=transfers[_0x873a('0x7')][_0x2fae77['uniqueid']][_0x873a('0x8')];}utils['info'](util[_0x873a('0x9')](_0x873a('0xa'),_0x2fae77[_0x873a('0x6')],_0x2fae77['channel'],_0x2fae77[_0x873a('0xb')],_0x2fae77[_0x873a('0xc')],_0x2fae77[_0x873a('0xd')],_0x2fae77[_0x873a('0xe')],_0x2fae77[_0x873a('0xf')],_0x2fae77[_0x873a('0x10')]));if(_0x2fae77[_0x873a('0x11')]){utils['getUserByInternal'](_0x2fae77[_0x873a('0x11')])[_0x873a('0x12')](function(_0x3ac85e){if(_0x3ac85e){_0x2fae77[_0x873a('0x13')]=_0x3ac85e['id'];}utils[_0x873a('0x14')](_0x873a('0x15'),_0x2fae77);});}else{utils[_0x873a('0x14')]('CreateVoiceCallReport',_0x2fae77);}if(channels[_0x2fae77[_0x873a('0x6')]]){delete channels[_0x2fae77[_0x873a('0x6')]];}else if(_0x5d4a24&&channels[_0x5d4a24]){if(!transfers[_0x873a('0x7')][_0x5d4a24][_0x873a('0x16')])delete transfers[_0x873a('0x7')][_0x5d4a24];delete channels[_0x5d4a24];}}exports[_0x873a('0x17')]=function(_0x525ef6){try{utils[_0x873a('0x18')](util[_0x873a('0x9')]('[%s][calls][newchannel]',_0x525ef6[_0x873a('0x6')]),_0x525ef6);if(_0x525ef6[_0x873a('0x6')]==_0x525ef6[_0x873a('0x19')]&&_0x525ef6[_0x873a('0x1a')]!=_0x873a('0x1b')){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x1d'),_0x525ef6['uniqueid'],_0x525ef6[_0x873a('0x1e')],_0x525ef6[_0x873a('0x1f')]));channels[_0x525ef6[_0x873a('0x6')]]={'uniqueid':_0x525ef6['uniqueid'],'accountcode':_0x525ef6[_0x873a('0x11')],'source':_0x525ef6['calleridnum'],'destination':_0x525ef6[_0x873a('0x1f')],'destinationcontext':_0x525ef6[_0x873a('0x1e')],'channel':_0x525ef6[_0x873a('0x1a')],'starttime':utils[_0x873a('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x873a('0x2'),'amaflags':'DOCUMENTATION'};}}catch(_0x28a29c){utils[_0x873a('0x21')](util[_0x873a('0x9')]('[%s][calls][newchannel]',_0x525ef6['uniqueid']),_0x28a29c);}};exports['newstate']=function(_0xdd52c7){try{utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x22'),_0xdd52c7[_0x873a('0x6')]),_0xdd52c7);if(!_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x6')]])&&_0xdd52c7['channelstate']==0x6){utils['info'](util['format'](_0x873a('0x24'),_0xdd52c7[_0x873a('0x6')],_0xdd52c7[_0x873a('0x1e')],_0xdd52c7[_0x873a('0x1a')]));if(_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x6')]][_0x873a('0x25')])){channels[_0xdd52c7[_0x873a('0x6')]]['systemanswertime']=utils[_0x873a('0x20')]();}}else if(!_[_0x873a('0x23')](channels[_0xdd52c7[_0x873a('0x19')]])&&_0xdd52c7[_0x873a('0x26')]==0x6&&_0xdd52c7['context']!='transfer'){utils[_0x873a('0x1c')](util['format'](_0x873a('0x27'),_0xdd52c7[_0x873a('0x6')],_0xdd52c7[_0x873a('0x19')],_0xdd52c7[_0x873a('0x1e')],_0xdd52c7[_0x873a('0x1a')]));channels[_0xdd52c7[_0x873a('0x19')]]['accountcode']=_0xdd52c7[_0x873a('0x11')];channels[_0xdd52c7[_0x873a('0x19')]]['destinationchannel']=_0xdd52c7['channel'];if(_['isNil'](channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x28')])){channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x28')]=utils[_0x873a('0x20')]();}channels[_0xdd52c7[_0x873a('0x19')]][_0x873a('0x29')]=dispositions[_[_0x873a('0x2a')](_0xdd52c7['channelstate'])]||_0x873a('0x4');}}catch(_0x588dbb){utils[_0x873a('0x21')](util['format'](_0x873a('0x22'),_0xdd52c7[_0x873a('0x6')]),_0x588dbb);}};exports[_0x873a('0x2b')]=function(_0x45210b){try{if(!_[_0x873a('0x23')](channels[_0x45210b[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x2c'),_0x45210b[_0x873a('0x6')]),_0x45210b);if(_[_0x873a('0x23')](channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')])){channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')]=_0x45210b[_0x873a('0x2e')]+'\x20<'+_0x45210b[_0x873a('0xe')]+'>';}utils[_0x873a('0x1c')](util['format'](_0x873a('0x2f'),_0x45210b['uniqueid'],channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x2d')],_0x45210b[_0x873a('0x30')]));channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x31')]=utils[_0x873a('0x20')]();channels[_0x45210b[_0x873a('0x6')]]['duration']=utils['diffTime'](channels[_0x45210b['uniqueid']][_0x873a('0x31')],channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x32')]);channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x33')]=channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x28')]?utils[_0x873a('0x34')](channels[_0x45210b[_0x873a('0x6')]][_0x873a('0x31')],channels[_0x45210b[_0x873a('0x6')]]['answertime']):0x0;writeDB(channels[_0x45210b['uniqueid']]);}}catch(_0x9ae941){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x2c'),_0x45210b[_0x873a('0x6')]),_0x9ae941);}};exports[_0x873a('0x35')]=function(_0xd18558){try{if(!_['isNil'](channels[_0xd18558[_0x873a('0x36')]])){utils[_0x873a('0x18')](util['format'](_0x873a('0x37'),_0xd18558[_0x873a('0x38')]),_0xd18558);if(channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x1a')]==_0xd18558[_0x873a('0x39')]){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x3a'),_0xd18558[_0x873a('0x38')],_0xd18558[_0x873a('0x36')],_0xd18558[_0x873a('0x3b')]));channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3c')]=_0xd18558['secondtransfererchannel'];channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3d')]=_0x873a('0x3e');}else if(channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x1a')]=_0xd18558[_0x873a('0x3f')]){utils['info'](util[_0x873a('0x9')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0xd18558[_0x873a('0x38')],_0xd18558[_0x873a('0x36')],_0xd18558[_0x873a('0x40')]));channels[_0xd18558[_0x873a('0x36')]][_0x873a('0x3c')]=_0xd18558[_0x873a('0x40')];channels[_0xd18558[_0x873a('0x36')]]['userfield']=_0x873a('0x3e');}}}catch(_0x1e08f9){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x37'),_0xd18558[_0x873a('0x38')]),_0x1e08f9);}};exports[_0x873a('0x41')]=function(_0x5cf21d){try{if(!_['isNil'](channels[_0x5cf21d[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')]('[%s][calls][musiconholdstart]',_0x5cf21d[_0x873a('0x6')]),_0x5cf21d);channels[_0x5cf21d[_0x873a('0x6')]]['musiconholdstartAt']=utils[_0x873a('0x20')]();utils['info'](util[_0x873a('0x9')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5cf21d[_0x873a('0x6')],channels[_0x5cf21d[_0x873a('0x6')]][_0x873a('0x42')]));}}catch(_0x452340){utils[_0x873a('0x21')](util[_0x873a('0x9')](_0x873a('0x43'),_0x5cf21d[_0x873a('0x6')]),_0x452340);}};exports[_0x873a('0x44')]=function(_0x5ab225){try{if(!_['isNil'](channels[_0x5ab225[_0x873a('0x6')]])){utils['debug'](util[_0x873a('0x9')]('[%s][calls][musiconholdstop]',_0x5ab225[_0x873a('0x6')]),_0x5ab225);if(!_[_0x873a('0x23')](channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x42')])){channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x45')]+=utils[_0x873a('0x34')](utils[_0x873a('0x20')](),channels[_0x5ab225[_0x873a('0x6')]]['musiconholdstartAt']);utils['info'](util['format'](_0x873a('0x46'),_0x5ab225['uniqueid'],channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x45')]));delete channels[_0x5ab225[_0x873a('0x6')]][_0x873a('0x42')];}}}catch(_0x52fdce){utils[_0x873a('0x21')](util['format'](_0x873a('0x47'),_0x5ab225['uniqueid']),_0x52fdce);}};exports[_0x873a('0x48')]=function(_0x16fbbf){try{if(!_[_0x873a('0x23')](channels[_0x16fbbf['uniqueid']])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x49'),_0x16fbbf[_0x873a('0x6')]),_0x16fbbf);if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x4b')])){utils[_0x873a('0x1c')](util[_0x873a('0x9')](_0x873a('0x4c'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x4e')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf['variable'][_0x873a('0x4f')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x50'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x51')]=_0x16fbbf[_0x873a('0x4d')];channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x2d')]='\x22'+_0x16fbbf[_0x873a('0x4d')]+'\x22\x20<'+_0x16fbbf[_0x873a('0x4d')]+'>';}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')]['xmd-callerid-preview'])||!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x52')])){utils[_0x873a('0x1c')](util[_0x873a('0x9')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x16fbbf[_0x873a('0x6')],!_[_0x873a('0x23')](_0x16fbbf['variable']['xmd-callerid-preview'])?_0x873a('0x53'):_0x873a('0x52'),_0x16fbbf['value']));channels[_0x16fbbf[_0x873a('0x6')]]['callerid']=_0x16fbbf[_0x873a('0x4d')];}if(!_['isNil'](_0x16fbbf['variable'][_0x873a('0x54')])||!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x55')])){utils['info'](util['format'](_0x873a('0x56'),_0x16fbbf[_0x873a('0x6')],!_[_0x873a('0x23')](_0x16fbbf['variable']['xmd-queue'])?'xmd-queue':_0x873a('0x55'),_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x57')]='Queue';channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x58')]=_0x16fbbf[_0x873a('0x4d')];channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0xb')]=!![];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')]['xmd-contactid'])){utils[_0x873a('0x1c')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x59')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x5a')])){utils['info'](util[_0x873a('0x9')](_0x873a('0x5b'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x5c')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf[_0x873a('0x4a')][_0x873a('0x5d')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x5e'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf[_0x873a('0x6')]][_0x873a('0x5f')]=_0x16fbbf[_0x873a('0x4d')];}if(!_[_0x873a('0x23')](_0x16fbbf['variable'][_0x873a('0x60')])){utils[_0x873a('0x1c')](util['format'](_0x873a('0x61'),_0x16fbbf[_0x873a('0x6')],_0x16fbbf[_0x873a('0x4d')]));channels[_0x16fbbf['uniqueid']][_0x873a('0x60')]=_0x16fbbf['value'];}}}catch(_0x10ff45){utils[_0x873a('0x21')](util[_0x873a('0x9')]('[%s][calls][varset]',_0x16fbbf[_0x873a('0x6')]),_0x10ff45);}};exports[_0x873a('0x62')]=function(_0x9fcd50){try{if(!_[_0x873a('0x23')](channels[_0x9fcd50[_0x873a('0x6')]])){utils[_0x873a('0x18')](util[_0x873a('0x9')](_0x873a('0x63'),_0x9fcd50[_0x873a('0x6')]),_0x9fcd50);utils['info'](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x9fcd50[_0x873a('0x6')],_0x9fcd50[_0x873a('0x64')],_0x9fcd50[_0x873a('0x65')]));if(_0x9fcd50['application']['toLowerCase']()==_0x873a('0x66')&&_[_0x873a('0x67')](_0x9fcd50[_0x873a('0x65')][_0x873a('0x68')](),'cdr')){var _0x522090=_0x9fcd50[_0x873a('0x65')][_0x873a('0x69')]('=');var _0x392d49=_0x522090[0x0][_0x873a('0x6a')](_0x522090[0x0]['lastIndexOf']('(')+0x1,_0x522090[0x0]['lastIndexOf'](')'));var _0x3ff2fe=_0x522090[0x1];channels[_0x9fcd50[_0x873a('0x6')]][_0x392d49]=_0x3ff2fe;}if(!_[_0x873a('0x6b')]([_0x873a('0x2b'),_0x873a('0x6c'),'execif',_0x873a('0x66'),_0x873a('0x6d')],_0x9fcd50[_0x873a('0x64')][_0x873a('0x68')]())){channels[_0x9fcd50[_0x873a('0x6')]][_0x873a('0x57')]=_0x9fcd50[_0x873a('0x64')];channels[_0x9fcd50[_0x873a('0x6')]][_0x873a('0x58')]=_0x9fcd50[_0x873a('0x65')];}}}catch(_0x444257){utils[_0x873a('0x21')](util['format'](_0x873a('0x63'),_0x9fcd50[_0x873a('0x6')]),_0x444257);}}; \ No newline at end of file +var _0xcbb1=['xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','set','startsWith','toLowerCase','cdr','lastIndexOf','includes','noop','lastapplication','util','NO\x20ANSWER','FAILED','ANSWERED','blinds','uniqueid','transfereeuniqueid','channel','queue','membername','interface','calleridnum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','recording','format','linkedid','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newchannel]','debug','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','answertime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0xef66ed,_0x1a5239){var _0xa14f66=function(_0x458541){while(--_0x458541){_0xef66ed['push'](_0xef66ed['shift']());}};_0xa14f66(++_0x1a5239);}(_0xcbb1,0x1d2));var _0x1cbb=function(_0x155999,_0x4fe3aa){_0x155999=_0x155999-0x0;var _0x4df16d=_0xcbb1[_0x155999];return _0x4df16d;};'use strict';var _=require('lodash');var util=require(_0x1cbb('0x0'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x1cbb('0x1'),_0x1cbb('0x2'),_0x1cbb('0x2'),_0x1cbb('0x1'),'NO\x20ANSWER',_0x1cbb('0x1'),_0x1cbb('0x3'),'BUSY','FAILED',_0x1cbb('0x2'),_0x1cbb('0x2')];var channels={};function writeDB(_0x3d2d8e){var _0x5381a3;if(transfers[_0x1cbb('0x4')][_0x3d2d8e[_0x1cbb('0x5')]]){_0x5381a3=_0x3d2d8e[_0x1cbb('0x5')];_0x3d2d8e[_0x1cbb('0x5')]=transfers['blinds'][_0x3d2d8e[_0x1cbb('0x5')]][_0x1cbb('0x6')];}utils['info'](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3d2d8e[_0x1cbb('0x5')],_0x3d2d8e[_0x1cbb('0x7')],_0x3d2d8e[_0x1cbb('0x8')],_0x3d2d8e[_0x1cbb('0x9')],_0x3d2d8e[_0x1cbb('0xa')],_0x3d2d8e[_0x1cbb('0xb')],_0x3d2d8e['connectedlinenum'],_0x3d2d8e[_0x1cbb('0xc')]));if(_0x3d2d8e[_0x1cbb('0xd')]){utils[_0x1cbb('0xe')](_0x3d2d8e[_0x1cbb('0xd')])[_0x1cbb('0xf')](function(_0x5ceb02){if(_0x5ceb02){_0x3d2d8e['UserId']=_0x5ceb02['id'];}utils[_0x1cbb('0x10')](_0x1cbb('0x11'),_0x3d2d8e);});}else{utils['request'](_0x1cbb('0x11'),_0x3d2d8e);}if(channels[_0x3d2d8e['uniqueid']]){delete channels[_0x3d2d8e[_0x1cbb('0x5')]];}else if(_0x5381a3&&channels[_0x5381a3]){if(!transfers[_0x1cbb('0x4')][_0x5381a3][_0x1cbb('0x12')])delete transfers[_0x1cbb('0x4')][_0x5381a3];delete channels[_0x5381a3];}}exports['newchannel']=function(_0x28b0d4){try{utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][newchannel]',_0x28b0d4[_0x1cbb('0x5')]),_0x28b0d4);if(_0x28b0d4[_0x1cbb('0x5')]==_0x28b0d4[_0x1cbb('0x14')]&&_0x28b0d4['channel']!='OutgoingSpoolFailed'){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x16'),_0x28b0d4['uniqueid'],_0x28b0d4[_0x1cbb('0x17')],_0x28b0d4['exten']));channels[_0x28b0d4[_0x1cbb('0x5')]]={'uniqueid':_0x28b0d4[_0x1cbb('0x5')],'accountcode':_0x28b0d4[_0x1cbb('0xd')],'source':_0x28b0d4[_0x1cbb('0xb')],'destination':_0x28b0d4[_0x1cbb('0x18')],'destinationcontext':_0x28b0d4[_0x1cbb('0x17')],'channel':_0x28b0d4['channel'],'starttime':utils[_0x1cbb('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x1cbb('0x1'),'amaflags':_0x1cbb('0x1a')};}}catch(_0x2aa724){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1c'),_0x28b0d4[_0x1cbb('0x5')]),_0x2aa724);}};exports['newstate']=function(_0x3b9562){try{utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562['uniqueid']),_0x3b9562);if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x21'),_0x3b9562['uniqueid'],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x5')]][_0x1cbb('0x22')])){channels[_0x3b9562[_0x1cbb('0x5')]]['systemanswertime']=utils[_0x1cbb('0x19')]();}}else if(!_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]])&&_0x3b9562[_0x1cbb('0x20')]==0x6&&_0x3b9562[_0x1cbb('0x17')]!=_0x1cbb('0x23')){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x24'),_0x3b9562[_0x1cbb('0x5')],_0x3b9562[_0x1cbb('0x14')],_0x3b9562[_0x1cbb('0x17')],_0x3b9562[_0x1cbb('0x7')]));channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0xd')]=_0x3b9562[_0x1cbb('0xd')];channels[_0x3b9562[_0x1cbb('0x14')]]['destinationchannel']=_0x3b9562[_0x1cbb('0x7')];if(_[_0x1cbb('0x1f')](channels[_0x3b9562[_0x1cbb('0x14')]]['answertime'])){channels[_0x3b9562[_0x1cbb('0x14')]]['answertime']=utils[_0x1cbb('0x19')]();}channels[_0x3b9562[_0x1cbb('0x14')]][_0x1cbb('0x25')]=dispositions[_[_0x1cbb('0x26')](_0x3b9562[_0x1cbb('0x20')])]||_0x1cbb('0x3');}}catch(_0x2166dd){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x1e'),_0x3b9562[_0x1cbb('0x5')]),_0x2166dd);}};exports[_0x1cbb('0x27')]=function(_0x11e030){try{if(!_[_0x1cbb('0x1f')](channels[_0x11e030['uniqueid']])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][hangup]',_0x11e030[_0x1cbb('0x5')]),_0x11e030);if(_['isNil'](channels[_0x11e030[_0x1cbb('0x5')]]['callerid'])){channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')]=_0x11e030[_0x1cbb('0x29')]+'\x20<'+_0x11e030[_0x1cbb('0xb')]+'>';}utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x2a'),_0x11e030[_0x1cbb('0x5')],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x28')],_0x11e030[_0x1cbb('0x2b')]));channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2c')]=utils[_0x1cbb('0x19')]();channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x2d')]=utils[_0x1cbb('0x2e')](channels[_0x11e030['uniqueid']][_0x1cbb('0x2c')],channels[_0x11e030[_0x1cbb('0x5')]]['starttime']);channels[_0x11e030['uniqueid']][_0x1cbb('0x2f')]=channels[_0x11e030['uniqueid']][_0x1cbb('0x30')]?utils[_0x1cbb('0x2e')](channels[_0x11e030[_0x1cbb('0x5')]]['endtime'],channels[_0x11e030[_0x1cbb('0x5')]][_0x1cbb('0x30')]):0x0;writeDB(channels[_0x11e030[_0x1cbb('0x5')]]);}}catch(_0xe4a38a){utils[_0x1cbb('0x1b')](util['format'](_0x1cbb('0x31'),_0x11e030[_0x1cbb('0x5')]),_0xe4a38a);}};exports[_0x1cbb('0x32')]=function(_0x51b7d8){try{if(!_['isNil'](channels[_0x51b7d8[_0x1cbb('0x33')]])){utils[_0x1cbb('0x1d')](util['format'](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x51b7d8);if(channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x7')]==_0x51b7d8[_0x1cbb('0x35')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x38')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x38')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}else if(channels[_0x51b7d8[_0x1cbb('0x33')]]['channel']=_0x51b7d8[_0x1cbb('0x3c')]){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x36'),_0x51b7d8[_0x1cbb('0x37')],_0x51b7d8[_0x1cbb('0x33')],_0x51b7d8[_0x1cbb('0x3d')]));channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x39')]=_0x51b7d8[_0x1cbb('0x3d')];channels[_0x51b7d8[_0x1cbb('0x33')]][_0x1cbb('0x3a')]=_0x1cbb('0x3b');}}}catch(_0x4b5330){utils['error'](util[_0x1cbb('0x13')](_0x1cbb('0x34'),_0x51b7d8['origtransfereruniqueid']),_0x4b5330);}};exports[_0x1cbb('0x3e')]=function(_0x10f17c){try{if(!_[_0x1cbb('0x1f')](channels[_0x10f17c[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x10f17c);channels[_0x10f17c[_0x1cbb('0x5')]][_0x1cbb('0x3f')]=utils[_0x1cbb('0x19')]();utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x40'),_0x10f17c[_0x1cbb('0x5')],channels[_0x10f17c[_0x1cbb('0x5')]]['musiconholdstartAt']));}}catch(_0x456966){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstart]',_0x10f17c[_0x1cbb('0x5')]),_0x456966);}};exports[_0x1cbb('0x41')]=function(_0x1f643d){try{if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]])){utils['debug'](util[_0x1cbb('0x13')]('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x1f643d);if(!_[_0x1cbb('0x1f')](channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')])){channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]+=utils[_0x1cbb('0x2e')](utils[_0x1cbb('0x19')](),channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')]);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x43'),_0x1f643d['uniqueid'],channels[_0x1f643d['uniqueid']][_0x1cbb('0x42')]));delete channels[_0x1f643d[_0x1cbb('0x5')]][_0x1cbb('0x3f')];}}}catch(_0x18ff02){utils[_0x1cbb('0x1b')](util['format']('[%s][calls][musiconholdstop]',_0x1f643d[_0x1cbb('0x5')]),_0x18ff02);}};exports[_0x1cbb('0x44')]=function(_0x2653b5){try{if(!_[_0x1cbb('0x1f')](channels[_0x2653b5[_0x1cbb('0x5')]])){utils[_0x1cbb('0x1d')](util[_0x1cbb('0x13')](_0x1cbb('0x45'),_0x2653b5[_0x1cbb('0x5')]),_0x2653b5);if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x47')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x48'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['source']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4a')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x4b'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x4c')]=_0x2653b5[_0x1cbb('0x49')];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x28')]='\x22'+_0x2653b5[_0x1cbb('0x49')]+_0x1cbb('0x4d')+_0x2653b5[_0x1cbb('0x49')]+'>';}if(!_['isNil'](_0x2653b5['variable'][_0x1cbb('0x4e')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x4f')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x50'),_0x2653b5['uniqueid'],!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x4e')])?'xmd-callerid-preview':_0x1cbb('0x4f'),_0x2653b5['value']));channels[_0x2653b5['uniqueid']]['callerid']=_0x2653b5[_0x1cbb('0x49')];}if(!_[_0x1cbb('0x1f')](_0x2653b5['variable'][_0x1cbb('0x51')])||!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')]['xmcs-queue'])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x50'),_0x2653b5[_0x1cbb('0x5')],!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x51')])?_0x1cbb('0x51'):_0x1cbb('0x52'),_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['lastapplication']=_0x1cbb('0x53');channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x2653b5['value'];channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x8')]=!![];}if(!_[_0x1cbb('0x1f')](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x55')])){utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')](_0x1cbb('0x56'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x57')]=_0x2653b5[_0x1cbb('0x49')];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x58')])){utils[_0x1cbb('0x15')](util['format'](_0x1cbb('0x59'),_0x2653b5['uniqueid'],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]][_0x1cbb('0x5a')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5b')])){utils['info'](util['format'](_0x1cbb('0x5c'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5['uniqueid']][_0x1cbb('0x5d')]=_0x2653b5['value'];}if(!_['isNil'](_0x2653b5[_0x1cbb('0x46')][_0x1cbb('0x5e')])){utils['info'](util[_0x1cbb('0x13')](_0x1cbb('0x5f'),_0x2653b5[_0x1cbb('0x5')],_0x2653b5[_0x1cbb('0x49')]));channels[_0x2653b5[_0x1cbb('0x5')]]['sipcallid']=_0x2653b5['value'];}}}catch(_0x3c72e4){utils['error'](util[_0x1cbb('0x13')]('[%s][calls][varset]',_0x2653b5[_0x1cbb('0x5')]),_0x3c72e4);}};exports[_0x1cbb('0x60')]=function(_0x965e68){try{if(!_[_0x1cbb('0x1f')](channels[_0x965e68['uniqueid']])){utils['debug'](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68[_0x1cbb('0x5')]),_0x965e68);utils[_0x1cbb('0x15')](util[_0x1cbb('0x13')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x965e68[_0x1cbb('0x5')],_0x965e68[_0x1cbb('0x62')],_0x965e68[_0x1cbb('0x63')]));if(_0x965e68[_0x1cbb('0x62')]['toLowerCase']()==_0x1cbb('0x64')&&_[_0x1cbb('0x65')](_0x965e68['appdata'][_0x1cbb('0x66')](),_0x1cbb('0x67'))){var _0x7d166e=_0x965e68[_0x1cbb('0x63')]['split']('=');var _0x45503c=_0x7d166e[0x0]['substring'](_0x7d166e[0x0][_0x1cbb('0x68')]('(')+0x1,_0x7d166e[0x0][_0x1cbb('0x68')](')'));var _0x1bcc3f=_0x7d166e[0x1];channels[_0x965e68['uniqueid']][_0x45503c]=_0x1bcc3f;}if(!_[_0x1cbb('0x69')](['hangup',_0x1cbb('0x6a'),'execif',_0x1cbb('0x64'),'gotoif'],_0x965e68[_0x1cbb('0x62')][_0x1cbb('0x66')]())){channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x6b')]=_0x965e68[_0x1cbb('0x62')];channels[_0x965e68[_0x1cbb('0x5')]][_0x1cbb('0x54')]=_0x965e68[_0x1cbb('0x63')];}}}catch(_0x4d2bd9){utils[_0x1cbb('0x1b')](util[_0x1cbb('0x13')](_0x1cbb('0x61'),_0x965e68['uniqueid']),_0x4d2bd9);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 63532b5..5146652 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 _0x5b98=['./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent'];(function(_0x538373,_0x51b0da){var _0x270a03=function(_0x462468){while(--_0x462468){_0x538373['push'](_0x538373['shift']());}};_0x270a03(++_0x51b0da);}(_0x5b98,0x16b));var _0x85b9=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x5b98[_0x313c96];return _0x522f53;};'use strict';var utils=require(_0x85b9('0x0'));exports[_0x85b9('0x1')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x3'));};exports['shutdown']=function(){utils[_0x85b9('0x2')](_0x85b9('0x4'));};exports[_0x85b9('0x5')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x6'));};exports[_0x85b9('0x7')]=function(_0xd89b97){utils['error']('[core]\x20error',_0xd89b97);};exports[_0x85b9('0x8')]=function(){utils[_0x85b9('0x2')](_0x85b9('0x9'));};exports[_0x85b9('0xa')]=function(_0x510c62){}; \ No newline at end of file +var _0x95e3=['[core]\x20error','close','[core]\x20close','info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x42f3a5,_0x3a4470){var _0x1a7d74=function(_0x43cc36){while(--_0x43cc36){_0x42f3a5['push'](_0x42f3a5['shift']());}};_0x1a7d74(++_0x3a4470);}(_0x95e3,0x12c));var _0x395e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x95e3[_0x599f41];return _0x2e4d58;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x395e('0x0')]('[core]\x20connected');};exports[_0x395e('0x1')]=function(){utils[_0x395e('0x0')](_0x395e('0x2'));};exports[_0x395e('0x3')]=function(){utils['info'](_0x395e('0x4'));};exports[_0x395e('0x5')]=function(_0x44a712){utils['error'](_0x395e('0x6'),_0x44a712);};exports[_0x395e('0x7')]=function(){utils[_0x395e('0x0')](_0x395e('0x8'));};exports['managerevent']=function(_0x171702){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d19f937..fba2764 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 _0x0976=['[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','duration','diffTime','holdtime','endtime','billableseconds','lodash','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','CreateVoiceDialReport','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','debug','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup','[%s][dials][hangup]'];(function(_0x198794,_0x2e41b6){var _0x5b4967=function(_0x420416){while(--_0x420416){_0x198794['push'](_0x198794['shift']());}};_0x5b4967(++_0x2e41b6);}(_0x0976,0xc4));var _0x6097=function(_0x51b016,_0x5cffc5){_0x51b016=_0x51b016-0x0;var _0x3c4382=_0x0976[_0x51b016];return _0x3c4382;};'use strict';var _=require(_0x6097('0x0'));var util=require(_0x6097('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x8cee2f){utils[_0x6097('0x2')](util[_0x6097('0x3')](_0x6097('0x4'),_0x8cee2f[_0x6097('0x5')],_0x8cee2f[_0x6097('0x6')],_0x8cee2f[_0x6097('0x7')],_0x8cee2f['calleridnum'],_0x8cee2f['connectedlinenum'],_0x8cee2f[_0x6097('0x8')]));utils['request'](_0x6097('0x9'),_0x8cee2f);delete dials[_0x8cee2f[_0x6097('0x5')]];}exports['newexten']=function(_0x593c27){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x593c27[_0x6097('0x5')]),_0x593c27);utils[_0x6097('0x2')](util[_0x6097('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x593c27['uniqueid'],_0x593c27['application'],_0x593c27[_0x6097('0xa')]));if(_0x593c27['application'][_0x6097('0xb')]()=='set'&&_[_0x6097('0xc')](_0x593c27[_0x6097('0xa')]['toLowerCase'](),_0x6097('0xd'))){var _0x109bda=_0x593c27[_0x6097('0xa')][_0x6097('0xe')]('=');dials[_0x593c27[_0x6097('0x5')]]={'routeId':_0x109bda[0x1]};}}catch(_0x3b0b74){utils[_0x6097('0xf')](util['format'](_0x6097('0x10'),_0x593c27[_0x6097('0x5')]),_0x3b0b74);}};exports[_0x6097('0x11')]=function(_0x38056a){try{utils[_0x6097('0x12')](util['format'](_0x6097('0x13'),_0x38056a[_0x6097('0x5')]),_0x38056a);if(!_[_0x6097('0x14')](_0x38056a[_0x6097('0x15')]['outboundrouteid'])){utils[_0x6097('0x2')](util[_0x6097('0x3')](_0x6097('0x16'),_0x38056a[_0x6097('0x5')],_0x38056a[_0x6097('0x17')]));dials[_0x38056a[_0x6097('0x5')]]={'routeId':_0x38056a[_0x6097('0x17')]};}}catch(_0x5e5ed0){utils['error'](util[_0x6097('0x3')](_0x6097('0x13'),_0x38056a[_0x6097('0x5')]),_0x5e5ed0);}};exports[_0x6097('0x18')]=function(_0x3fd237){try{if(!_[_0x6097('0x14')](dials[_0x3fd237['uniqueid']])){utils[_0x6097('0x12')](util[_0x6097('0x3')](_0x6097('0x19'),_0x3fd237[_0x6097('0x5')]),_0x3fd237);dials[_0x3fd237[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x3fd237[_0x6097('0x5')]],_0x3fd237);dials[_0x3fd237[_0x6097('0x5')]][_0x6097('0x1b')]=utils[_0x6097('0x1c')]();dials[_0x3fd237['uniqueid']][_0x6097('0x1d')]=_0x6097('0x1e');utils['info'](util[_0x6097('0x3')](_0x6097('0x1f'),_0x3fd237['uniqueid'],dials[_0x3fd237[_0x6097('0x5')]][_0x6097('0x1b')]));}}catch(_0x25d5e7){utils[_0x6097('0xf')](util[_0x6097('0x3')](_0x6097('0x19'),_0x3fd237[_0x6097('0x5')]),_0x25d5e7);}};exports[_0x6097('0x20')]=function(_0x1664c2){try{if(!_['isNil'](dials[_0x1664c2['uniqueid']])){utils['debug'](util[_0x6097('0x3')](_0x6097('0x21'),_0x1664c2[_0x6097('0x5')]),_0x1664c2);dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x8')]=_0x1664c2[_0x6097('0x8')];if(_0x1664c2[_0x6097('0x8')]=='ANSWER'){dials[_0x1664c2[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x1664c2[_0x6097('0x5')]],_0x1664c2);dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x22')]=utils[_0x6097('0x1c')]();dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x1d')]=_0x6097('0x23');utils['info'](util[_0x6097('0x3')](_0x6097('0x24'),_0x1664c2['uniqueid'],_0x1664c2[_0x6097('0x8')],dials[_0x1664c2[_0x6097('0x5')]][_0x6097('0x22')]));}else{utils['info'](util[_0x6097('0x3')]('[%s][dials][dialend]\x20dialstatus:%s',_0x1664c2[_0x6097('0x5')],_0x1664c2[_0x6097('0x8')]));}}}catch(_0x2f673c){utils['error'](util[_0x6097('0x3')](_0x6097('0x21'),_0x1664c2[_0x6097('0x5')]),_0x2f673c);}};exports[_0x6097('0x25')]=function(_0x10e5a9){try{if(!_[_0x6097('0x14')](dials[_0x10e5a9[_0x6097('0x5')]])){utils[_0x6097('0x12')](util[_0x6097('0x3')](_0x6097('0x26'),_0x10e5a9['uniqueid']),_0x10e5a9);utils['info'](util[_0x6097('0x3')](_0x6097('0x27'),_0x10e5a9[_0x6097('0x5')],_0x10e5a9['calleridnum'],_0x10e5a9[_0x6097('0x28')],_0x10e5a9['cause-txt']));dials[_0x10e5a9[_0x6097('0x5')]]=_[_0x6097('0x1a')](dials[_0x10e5a9[_0x6097('0x5')]],{'endtime':utils[_0x6097('0x1c')](),'lastevent':_0x6097('0x29')});dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2a')]=utils[_0x6097('0x2b')](dials[_0x10e5a9[_0x6097('0x5')]]['endtime'],dials[_0x10e5a9['uniqueid']]['starttime']);dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2c')]=utils[_0x6097('0x2b')](dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x22')]||dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2d')],dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x1b')]);dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2e')]=dials[_0x10e5a9[_0x6097('0x5')]]['answertime']?utils['diffTime'](dials[_0x10e5a9[_0x6097('0x5')]][_0x6097('0x2d')],dials[_0x10e5a9[_0x6097('0x5')]]['answertime']):0x0;writeDB(dials[_0x10e5a9[_0x6097('0x5')]]);}}catch(_0x37a307){utils['error'](util[_0x6097('0x3')](_0x6097('0x26'),_0x10e5a9[_0x6097('0x5')]),_0x37a307);}}; \ No newline at end of file +var _0x913f=['channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][varset]','variable','outboundrouteid','value','isNil','assign','starttime','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','info','calleridname','cause-txt','now','duration','diffTime','endtime','billableseconds','lodash','util','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x913f,0x126));var _0xf913=function(_0x3b4660,_0x45e879){_0x3b4660=_0x3b4660-0x0;var _0x41853a=_0x913f[_0x3b4660];return _0x41853a;};'use strict';var _=require(_0xf913('0x0'));var util=require(_0xf913('0x1'));var utils=require(_0xf913('0x2'));var dials={};function writeDB(_0x46f534){utils['info'](util[_0xf913('0x3')](_0xf913('0x4'),_0x46f534[_0xf913('0x5')],_0x46f534[_0xf913('0x6')],_0x46f534[_0xf913('0x7')],_0x46f534[_0xf913('0x8')],_0x46f534[_0xf913('0x9')],_0x46f534[_0xf913('0xa')]));utils[_0xf913('0xb')](_0xf913('0xc'),_0x46f534);delete dials[_0x46f534['uniqueid']];}exports[_0xf913('0xd')]=function(_0x4d40bb){try{utils[_0xf913('0xe')](util[_0xf913('0x3')]('[%s][dials][newexten]',_0x4d40bb['uniqueid']),_0x4d40bb);utils['info'](util[_0xf913('0x3')](_0xf913('0xf'),_0x4d40bb['uniqueid'],_0x4d40bb[_0xf913('0x10')],_0x4d40bb['appdata']));if(_0x4d40bb['application'][_0xf913('0x11')]()==_0xf913('0x12')&&_[_0xf913('0x13')](_0x4d40bb[_0xf913('0x14')][_0xf913('0x11')](),_0xf913('0x15'))){var _0x3f3ecc=_0x4d40bb[_0xf913('0x14')][_0xf913('0x16')]('=');dials[_0x4d40bb[_0xf913('0x5')]]={'routeId':_0x3f3ecc[0x1]};}}catch(_0x352d12){utils[_0xf913('0x17')](util[_0xf913('0x3')]('[%s][dials][newexten]',_0x4d40bb[_0xf913('0x5')]),_0x352d12);}};exports['varset']=function(_0x5264d6){try{utils[_0xf913('0xe')](util[_0xf913('0x3')](_0xf913('0x18'),_0x5264d6[_0xf913('0x5')]),_0x5264d6);if(!_['isNil'](_0x5264d6[_0xf913('0x19')][_0xf913('0x1a')])){utils['info'](util[_0xf913('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5264d6['uniqueid'],_0x5264d6[_0xf913('0x1b')]));dials[_0x5264d6[_0xf913('0x5')]]={'routeId':_0x5264d6[_0xf913('0x1b')]};}}catch(_0x2cb6fd){utils[_0xf913('0x17')](util['format'](_0xf913('0x18'),_0x5264d6[_0xf913('0x5')]),_0x2cb6fd);}};exports['dialbegin']=function(_0x5352a3){try{if(!_[_0xf913('0x1c')](dials[_0x5352a3[_0xf913('0x5')]])){utils['debug'](util['format']('[%s][dials][dialbegin]',_0x5352a3[_0xf913('0x5')]),_0x5352a3);dials[_0x5352a3['uniqueid']]=_[_0xf913('0x1d')](dials[_0x5352a3['uniqueid']],_0x5352a3);dials[_0x5352a3['uniqueid']][_0xf913('0x1e')]=utils['now']();dials[_0x5352a3[_0xf913('0x5')]][_0xf913('0x1f')]=_0xf913('0x20');utils['info'](util['format'](_0xf913('0x21'),_0x5352a3['uniqueid'],dials[_0x5352a3[_0xf913('0x5')]][_0xf913('0x1e')]));}}catch(_0x1e0691){utils[_0xf913('0x17')](util[_0xf913('0x3')](_0xf913('0x22'),_0x5352a3[_0xf913('0x5')]),_0x1e0691);}};exports['dialend']=function(_0x505c86){try{if(!_['isNil'](dials[_0x505c86['uniqueid']])){utils[_0xf913('0xe')](util[_0xf913('0x3')]('[%s][dials][dialend]',_0x505c86[_0xf913('0x5')]),_0x505c86);dials[_0x505c86['uniqueid']][_0xf913('0xa')]=_0x505c86['dialstatus'];if(_0x505c86[_0xf913('0xa')]==_0xf913('0x23')){dials[_0x505c86[_0xf913('0x5')]]=_[_0xf913('0x1d')](dials[_0x505c86['uniqueid']],_0x505c86);dials[_0x505c86['uniqueid']]['answertime']=utils['now']();dials[_0x505c86[_0xf913('0x5')]][_0xf913('0x1f')]=_0xf913('0x24');utils['info'](util[_0xf913('0x3')](_0xf913('0x25'),_0x505c86[_0xf913('0x5')],_0x505c86[_0xf913('0xa')],dials[_0x505c86[_0xf913('0x5')]][_0xf913('0x26')]));}else{utils['info'](util[_0xf913('0x3')](_0xf913('0x27'),_0x505c86[_0xf913('0x5')],_0x505c86['dialstatus']));}}}catch(_0x3a0ef9){utils[_0xf913('0x17')](util[_0xf913('0x3')]('[%s][dials][dialend]',_0x505c86[_0xf913('0x5')]),_0x3a0ef9);}};exports[_0xf913('0x28')]=function(_0x57fc18){try{if(!_['isNil'](dials[_0x57fc18[_0xf913('0x5')]])){utils['debug'](util[_0xf913('0x3')](_0xf913('0x29'),_0x57fc18[_0xf913('0x5')]),_0x57fc18);utils[_0xf913('0x2a')](util[_0xf913('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x57fc18[_0xf913('0x5')],_0x57fc18[_0xf913('0x8')],_0x57fc18[_0xf913('0x2b')],_0x57fc18[_0xf913('0x2c')]));dials[_0x57fc18[_0xf913('0x5')]]=_[_0xf913('0x1d')](dials[_0x57fc18[_0xf913('0x5')]],{'endtime':utils[_0xf913('0x2d')](),'lastevent':'complete'});dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x2e')]=utils[_0xf913('0x2f')](dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x30')],dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x1e')]);dials[_0x57fc18[_0xf913('0x5')]]['holdtime']=utils['diffTime'](dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x26')]||dials[_0x57fc18[_0xf913('0x5')]]['endtime'],dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x1e')]);dials[_0x57fc18['uniqueid']][_0xf913('0x31')]=dials[_0x57fc18[_0xf913('0x5')]]['answertime']?utils[_0xf913('0x2f')](dials[_0x57fc18[_0xf913('0x5')]][_0xf913('0x30')],dials[_0x57fc18[_0xf913('0x5')]]['answertime']):0x0;writeDB(dials[_0x57fc18[_0xf913('0x5')]]);}}catch(_0x446cc4){utils[_0xf913('0x17')](util[_0xf913('0x3')]('[%s][dials][hangup]',_0x57fc18[_0xf913('0x5')]),_0x446cc4);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index dd8cf46..cd904a9 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 _0x2bf5=['uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','username','password','keepConnected','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]'];(function(_0x55ec91,_0x3e26cf){var _0x526a94=function(_0x192add){while(--_0x192add){_0x55ec91['push'](_0x55ec91['shift']());}};_0x526a94(++_0x3e26cf);}(_0x2bf5,0x153));var _0x52bf=function(_0x37dc88,_0x4ea261){_0x37dc88=_0x37dc88-0x0;var _0x5cfc4f=_0x2bf5[_0x37dc88];return _0x5cfc4f;};var AsteriskManager=require(_0x52bf('0x0'));var config=require(_0x52bf('0x1'));var utils=require(_0x52bf('0x2'));var util=require(_0x52bf('0x3'));var isXDREnabled=config[_0x52bf('0x4')]&&config['xdr']['disabled']?!config[_0x52bf('0x4')][_0x52bf('0x5')]:!![];var isProduction=config[_0x52bf('0x6')]===_0x52bf('0x7')||![];var isLocalAsterisk=config['xdr']&&config[_0x52bf('0x4')][_0x52bf('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x52bf('0x9')]['port'],config['asterisk']['ip'],config[_0x52bf('0x9')][_0x52bf('0xa')],config['asterisk'][_0x52bf('0xb')],!![]);ami[_0x52bf('0xc')]();if(!isXDREnabled){utils['info'](_0x52bf('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x52bf('0xe')](_0x52bf('0xf'));}else{var agents=require(_0x52bf('0x10'));var calls=require(_0x52bf('0x11'));var queues=require(_0x52bf('0x12'));var recordings=require(_0x52bf('0x13'));var members=require(_0x52bf('0x14'));var dials=require(_0x52bf('0x15'));var transfers=require(_0x52bf('0x16'));var core=require(_0x52bf('0x17'));ami['on'](_0x52bf('0x18'),core['connect']);ami['on'](_0x52bf('0x19'),core['shutdown']);ami['on'](_0x52bf('0x1a'),core[_0x52bf('0x1a')]);ami['on'](_0x52bf('0x1b'),core['error']);ami['on'](_0x52bf('0x1c'),core[_0x52bf('0x1c')]);ami['on'](_0x52bf('0x1d'),core[_0x52bf('0x1d')]);ami['on']('devicestatechange',function(_0x2120d2){try{utils['debug'](util[_0x52bf('0x1e')](_0x52bf('0x1f'),_0x2120d2[_0x52bf('0x20')]),_0x2120d2);members[_0x52bf('0x21')](_0x2120d2);}catch(_0x2c36c1){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][devicestatechange]',_0x2120d2[_0x52bf('0x20')]),_0x2c36c1);}});ami['on'](_0x52bf('0x22'),function(_0x5a3c60){try{utils['debug'](util[_0x52bf('0x1e')](_0x52bf('0x23'),_0x5a3c60[_0x52bf('0x24')]),_0x5a3c60);agents[_0x52bf('0x22')](_0x5a3c60);}catch(_0x3e099e){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentcalled]',_0x5a3c60['uniqueid']),_0x3e099e);}});ami['on'](_0x52bf('0x25'),function(_0x148140){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x27'),_0x148140[_0x52bf('0x24')]),_0x148140);agents[_0x52bf('0x25')](_0x148140);}catch(_0x1281a9){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentringnoanswer]',_0x148140[_0x52bf('0x24')]),_0x1281a9);}});ami['on'](_0x52bf('0x28'),function(_0x5b6967){try{utils[_0x52bf('0x26')](util['format']('[%s][index][agentconnect]',_0x5b6967[_0x52bf('0x24')]),_0x5b6967);agents[_0x52bf('0x28')](_0x5b6967);queues[_0x52bf('0x28')](_0x5b6967);}catch(_0x55b582){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x29'),_0x5b6967[_0x52bf('0x24')]),_0x55b582);}});ami['on'](_0x52bf('0x2a'),function(_0x3fbb06){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][agentcomplete]',_0x3fbb06[_0x52bf('0x24')]),_0x3fbb06);agents[_0x52bf('0x2a')](_0x3fbb06);queues[_0x52bf('0x2a')](_0x3fbb06);members[_0x52bf('0x2a')](_0x3fbb06);}catch(_0x5e0673){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][agentcomplete]',_0x3fbb06[_0x52bf('0x24')]),_0x5e0673);}});ami['on'](_0x52bf('0x2b'),function(_0x21cb88){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x2c'),_0x21cb88[_0x52bf('0x24')]),_0x21cb88);agents['queuecallerabandon'](_0x21cb88);queues[_0x52bf('0x2b')](_0x21cb88);}catch(_0x4fa4ab){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x2c'),_0x21cb88[_0x52bf('0x24')]),_0x4fa4ab);}});ami['on']('queuecallerjoin',function(_0x4d9f7d){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x2d'),_0x4d9f7d['uniqueid']),_0x4d9f7d);queues[_0x52bf('0x2e')](_0x4d9f7d);recordings[_0x52bf('0x2e')](_0x4d9f7d);}catch(_0x169891){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x2d'),_0x4d9f7d['uniqueid']),_0x169891);}});ami['on'](_0x52bf('0x2f'),function(_0x3e6b71){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x30'),_0x3e6b71['uniqueid']),_0x3e6b71);queues[_0x52bf('0x2f')](_0x3e6b71);}catch(_0x3e1f0c){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x30'),_0x3e6b71[_0x52bf('0x24')]),_0x3e1f0c);}});ami['on'](_0x52bf('0x31'),function(_0x2d4cb0){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x32'),_0x2d4cb0[_0x52bf('0x24')]),_0x2d4cb0);queues[_0x52bf('0x31')](_0x2d4cb0);calls['musiconholdstart'](_0x2d4cb0);}catch(_0x18159c){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x32'),_0x2d4cb0['uniqueid']),_0x18159c);}});ami['on']('musiconholdstop',function(_0x5f2391){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][musiconholdstop]',_0x5f2391[_0x52bf('0x24')]),_0x5f2391);queues[_0x52bf('0x33')](_0x5f2391);calls['musiconholdstop'](_0x5f2391);}catch(_0x1043be){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x34'),_0x5f2391[_0x52bf('0x24')]),_0x1043be);}});ami['on'](_0x52bf('0x35'),function(_0x22c08b){try{utils[_0x52bf('0x26')](util['format'](_0x52bf('0x36'),_0x22c08b[_0x52bf('0x24')]),_0x22c08b);calls[_0x52bf('0x35')](_0x22c08b);recordings[_0x52bf('0x35')](_0x22c08b);}catch(_0x51f893){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x36'),_0x22c08b[_0x52bf('0x24')]),_0x51f893);}});ami['on']('hangup',function(_0x393550){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x37'),_0x393550[_0x52bf('0x24')]),_0x393550);calls[_0x52bf('0x38')](_0x393550);recordings[_0x52bf('0x38')](_0x393550);dials[_0x52bf('0x38')](_0x393550);agents[_0x52bf('0x38')](_0x393550);queues[_0x52bf('0x38')](_0x393550);}catch(_0x25b118){utils['error'](util['format'](_0x52bf('0x37'),_0x393550[_0x52bf('0x24')]),_0x25b118);}});ami['on'](_0x52bf('0x39'),function(_0x322a30){try{utils['debug'](util['format'](_0x52bf('0x3a'),_0x322a30[_0x52bf('0x24')]),_0x322a30);members[_0x52bf('0x39')](_0x322a30);}catch(_0x4bed17){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3a'),_0x322a30[_0x52bf('0x24')]),_0x4bed17);}});ami['on']('blindtransfer',function(_0x3d9c7b){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')]('[%s][index][blindtransfer]',_0x3d9c7b[_0x52bf('0x24')]),_0x3d9c7b);queues[_0x52bf('0x3b')](_0x3d9c7b);agents[_0x52bf('0x3b')](_0x3d9c7b);transfers[_0x52bf('0x3b')](_0x3d9c7b);recordings[_0x52bf('0x3b')](_0x3d9c7b);}catch(_0xeca3fa){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3c'),_0x3d9c7b[_0x52bf('0x24')]),_0xeca3fa);}});ami['on'](_0x52bf('0x3d'),function(_0x43ed69){try{utils[_0x52bf('0x26')](util['format'](_0x52bf('0x3e'),_0x43ed69[_0x52bf('0x3f')]),_0x43ed69);queues[_0x52bf('0x3d')](_0x43ed69);transfers['attendedtransfer'](_0x43ed69);agents[_0x52bf('0x3d')](_0x43ed69);calls[_0x52bf('0x3d')](_0x43ed69);}catch(_0x34f1d5){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x3e'),_0x43ed69[_0x52bf('0x3f')]),_0x34f1d5);}});ami['on'](_0x52bf('0x40'),function(_0x2ead84){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x41'),_0x2ead84['uniqueid']),_0x2ead84);queues[_0x52bf('0x40')](_0x2ead84);recordings[_0x52bf('0x40')](_0x2ead84);calls[_0x52bf('0x40')](_0x2ead84);dials[_0x52bf('0x40')](_0x2ead84);}catch(_0x3d6d76){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x41'),_0x2ead84[_0x52bf('0x24')]),_0x3d6d76);}});ami['on'](_0x52bf('0x42'),function(_0x2946b1){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x43'),_0x2946b1[_0x52bf('0x24')]),_0x2946b1);calls[_0x52bf('0x42')](_0x2946b1);recordings['newexten'](_0x2946b1);dials['newexten'](_0x2946b1);}catch(_0x3587e1){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')]('[%s][index][newexten]',_0x2946b1[_0x52bf('0x24')]),_0x3587e1);}});ami['on'](_0x52bf('0x44'),function(_0x3de36f){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x45'),_0x3de36f['uniqueid']),_0x3de36f);calls['newchannel'](_0x3de36f);recordings[_0x52bf('0x44')](_0x3de36f);}catch(_0x142021){utils['error'](util[_0x52bf('0x1e')](_0x52bf('0x45'),_0x3de36f[_0x52bf('0x24')]),_0x142021);}});ami['on'](_0x52bf('0x46'),function(_0x17a012){try{utils[_0x52bf('0x26')](util[_0x52bf('0x1e')](_0x52bf('0x47'),_0x17a012['uniqueid']),_0x17a012);dials[_0x52bf('0x46')](_0x17a012);}catch(_0x5b9da9){utils[_0x52bf('0x1b')](util[_0x52bf('0x1e')](_0x52bf('0x48'),_0x17a012['uniqueid']),_0x5b9da9);}});ami['on'](_0x52bf('0x49'),function(_0x2a91af){try{utils[_0x52bf('0x26')](util['format']('[%s][index][dialend]',_0x2a91af[_0x52bf('0x24')]),_0x2a91af);dials[_0x52bf('0x49')](_0x2a91af);}catch(_0x4497ac){utils[_0x52bf('0x1b')](util['format'](_0x52bf('0x4a'),_0x2a91af[_0x52bf('0x24')]),_0x4497ac);}});} \ No newline at end of file +var _0x34f6=['./agents.controller','./calls.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','port','password','keepConnected','info','XDR\x20DISABLED'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x34f6,0x1ce));var _0x634f=function(_0x382a62,_0x1baa5e){_0x382a62=_0x382a62-0x0;var _0x490a25=_0x34f6[_0x382a62];return _0x490a25;};var AsteriskManager=require(_0x634f('0x0'));var config=require(_0x634f('0x1'));var utils=require(_0x634f('0x2'));var util=require(_0x634f('0x3'));var isXDREnabled=config[_0x634f('0x4')]&&config['xdr'][_0x634f('0x5')]?!config[_0x634f('0x4')][_0x634f('0x5')]:!![];var isProduction=config[_0x634f('0x6')]==='production'||![];var isLocalAsterisk=config[_0x634f('0x4')]&&config[_0x634f('0x4')][_0x634f('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x634f('0x8')][_0x634f('0x9')],config[_0x634f('0x8')]['ip'],config[_0x634f('0x8')]['username'],config[_0x634f('0x8')][_0x634f('0xa')],!![]);ami[_0x634f('0xb')]();if(!isXDREnabled){utils[_0x634f('0xc')](_0x634f('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x634f('0xe'));var calls=require(_0x634f('0xf'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x634f('0x10'));var transfers=require(_0x634f('0x11'));var core=require(_0x634f('0x12'));ami['on'](_0x634f('0x13'),core[_0x634f('0x13')]);ami['on'](_0x634f('0x14'),core[_0x634f('0x14')]);ami['on'](_0x634f('0x15'),core[_0x634f('0x15')]);ami['on'](_0x634f('0x16'),core[_0x634f('0x16')]);ami['on'](_0x634f('0x17'),core[_0x634f('0x17')]);ami['on'](_0x634f('0x18'),core[_0x634f('0x18')]);ami['on'](_0x634f('0x19'),function(_0x1f19f9){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][devicestatechange]',_0x1f19f9[_0x634f('0x1c')]),_0x1f19f9);members[_0x634f('0x19')](_0x1f19f9);}catch(_0x56c805){utils[_0x634f('0x16')](util['format'](_0x634f('0x1d'),_0x1f19f9[_0x634f('0x1c')]),_0x56c805);}});ami['on']('agentcalled',function(_0x3b2711){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][agentcalled]',_0x3b2711['uniqueid']),_0x3b2711);agents[_0x634f('0x1e')](_0x3b2711);}catch(_0x5cb562){utils['error'](util[_0x634f('0x1b')](_0x634f('0x1f'),_0x3b2711['uniqueid']),_0x5cb562);}});ami['on'](_0x634f('0x20'),function(_0x3da5c2){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x21'),_0x3da5c2['uniqueid']),_0x3da5c2);agents[_0x634f('0x20')](_0x3da5c2);}catch(_0x5c9043){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x21'),_0x3da5c2[_0x634f('0x22')]),_0x5c9043);}});ami['on']('agentconnect',function(_0x43bea6){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][agentconnect]',_0x43bea6[_0x634f('0x22')]),_0x43bea6);agents['agentconnect'](_0x43bea6);queues[_0x634f('0x23')](_0x43bea6);}catch(_0x74c7bc){utils[_0x634f('0x16')](util[_0x634f('0x1b')]('[%s][index][agentconnect]',_0x43bea6['uniqueid']),_0x74c7bc);}});ami['on'](_0x634f('0x24'),function(_0x4288b4){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][agentcomplete]',_0x4288b4['uniqueid']),_0x4288b4);agents[_0x634f('0x24')](_0x4288b4);queues['agentcomplete'](_0x4288b4);members[_0x634f('0x24')](_0x4288b4);}catch(_0x515bc9){utils['error'](util[_0x634f('0x1b')](_0x634f('0x25'),_0x4288b4['uniqueid']),_0x515bc9);}});ami['on']('queuecallerabandon',function(_0x16e9f0){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x26'),_0x16e9f0[_0x634f('0x22')]),_0x16e9f0);agents[_0x634f('0x27')](_0x16e9f0);queues[_0x634f('0x27')](_0x16e9f0);}catch(_0x12a42c){utils[_0x634f('0x16')](util[_0x634f('0x1b')]('[%s][index][queuecallerabandon]',_0x16e9f0['uniqueid']),_0x12a42c);}});ami['on'](_0x634f('0x28'),function(_0x6b6ab9){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x29'),_0x6b6ab9[_0x634f('0x22')]),_0x6b6ab9);queues[_0x634f('0x28')](_0x6b6ab9);recordings[_0x634f('0x28')](_0x6b6ab9);}catch(_0x1f348){utils[_0x634f('0x16')](util[_0x634f('0x1b')]('[%s][index][queuecallerjoin]',_0x6b6ab9[_0x634f('0x22')]),_0x1f348);}});ami['on'](_0x634f('0x2a'),function(_0x41f871){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x2b'),_0x41f871[_0x634f('0x22')]),_0x41f871);queues[_0x634f('0x2a')](_0x41f871);}catch(_0x3450c4){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x2b'),_0x41f871['uniqueid']),_0x3450c4);}});ami['on'](_0x634f('0x2c'),function(_0x8f4120){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][musiconholdstart]',_0x8f4120[_0x634f('0x22')]),_0x8f4120);queues[_0x634f('0x2c')](_0x8f4120);calls['musiconholdstart'](_0x8f4120);}catch(_0x4e5d9f){utils[_0x634f('0x16')](util['format']('[%s][index][musiconholdstart]',_0x8f4120['uniqueid']),_0x4e5d9f);}});ami['on'](_0x634f('0x2d'),function(_0x20a16b){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x2e'),_0x20a16b[_0x634f('0x22')]),_0x20a16b);queues[_0x634f('0x2d')](_0x20a16b);calls['musiconholdstop'](_0x20a16b);}catch(_0x189cb5){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x2e'),_0x20a16b[_0x634f('0x22')]),_0x189cb5);}});ami['on'](_0x634f('0x2f'),function(_0x1a11c0){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x30'),_0x1a11c0[_0x634f('0x22')]),_0x1a11c0);calls['newstate'](_0x1a11c0);recordings[_0x634f('0x2f')](_0x1a11c0);}catch(_0x120634){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x30'),_0x1a11c0[_0x634f('0x22')]),_0x120634);}});ami['on'](_0x634f('0x31'),function(_0x2d957f){try{utils[_0x634f('0x1a')](util['format'](_0x634f('0x32'),_0x2d957f[_0x634f('0x22')]),_0x2d957f);calls[_0x634f('0x31')](_0x2d957f);recordings[_0x634f('0x31')](_0x2d957f);dials[_0x634f('0x31')](_0x2d957f);agents[_0x634f('0x31')](_0x2d957f);queues[_0x634f('0x31')](_0x2d957f);}catch(_0x1bd113){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x32'),_0x2d957f['uniqueid']),_0x1bd113);}});ami['on']('cdr',function(_0x265cf4){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x33'),_0x265cf4['uniqueid']),_0x265cf4);members[_0x634f('0x34')](_0x265cf4);}catch(_0x383ee3){utils[_0x634f('0x16')](util['format'](_0x634f('0x33'),_0x265cf4[_0x634f('0x22')]),_0x383ee3);}});ami['on'](_0x634f('0x35'),function(_0x19d15f){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')]('[%s][index][blindtransfer]',_0x19d15f['uniqueid']),_0x19d15f);queues[_0x634f('0x35')](_0x19d15f);agents[_0x634f('0x35')](_0x19d15f);transfers[_0x634f('0x35')](_0x19d15f);recordings[_0x634f('0x35')](_0x19d15f);}catch(_0x53d9c1){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x36'),_0x19d15f[_0x634f('0x22')]),_0x53d9c1);}});ami['on'](_0x634f('0x37'),function(_0x1d1ecd){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x38'),_0x1d1ecd[_0x634f('0x39')]),_0x1d1ecd);queues[_0x634f('0x37')](_0x1d1ecd);transfers[_0x634f('0x37')](_0x1d1ecd);agents[_0x634f('0x37')](_0x1d1ecd);calls[_0x634f('0x37')](_0x1d1ecd);}catch(_0x4ea1cc){utils['error'](util[_0x634f('0x1b')](_0x634f('0x38'),_0x1d1ecd['origtransfereruniqueid']),_0x4ea1cc);}});ami['on']('varset',function(_0x50fea9){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x3a'),_0x50fea9[_0x634f('0x22')]),_0x50fea9);queues[_0x634f('0x3b')](_0x50fea9);recordings[_0x634f('0x3b')](_0x50fea9);calls[_0x634f('0x3b')](_0x50fea9);dials['varset'](_0x50fea9);}catch(_0x1e7658){utils['error'](util[_0x634f('0x1b')](_0x634f('0x3a'),_0x50fea9[_0x634f('0x22')]),_0x1e7658);}});ami['on']('newexten',function(_0x16b0ff){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x3c'),_0x16b0ff[_0x634f('0x22')]),_0x16b0ff);calls['newexten'](_0x16b0ff);recordings[_0x634f('0x3d')](_0x16b0ff);dials['newexten'](_0x16b0ff);}catch(_0x5f0158){utils[_0x634f('0x16')](util['format'](_0x634f('0x3c'),_0x16b0ff[_0x634f('0x22')]),_0x5f0158);}});ami['on'](_0x634f('0x3e'),function(_0x57a812){try{utils['debug'](util[_0x634f('0x1b')](_0x634f('0x3f'),_0x57a812['uniqueid']),_0x57a812);calls[_0x634f('0x3e')](_0x57a812);recordings['newchannel'](_0x57a812);}catch(_0x8a9d12){utils[_0x634f('0x16')](util[_0x634f('0x1b')]('[%s][index][newchannel]',_0x57a812[_0x634f('0x22')]),_0x8a9d12);}});ami['on'](_0x634f('0x40'),function(_0x57e837){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x41'),_0x57e837[_0x634f('0x22')]),_0x57e837);dials['dialbegin'](_0x57e837);}catch(_0x56f978){utils['error'](util[_0x634f('0x1b')]('[%s]dialbegin',_0x57e837[_0x634f('0x22')]),_0x56f978);}});ami['on'](_0x634f('0x42'),function(_0x5cfd71){try{utils[_0x634f('0x1a')](util[_0x634f('0x1b')](_0x634f('0x43'),_0x5cfd71['uniqueid']),_0x5cfd71);dials['dialend'](_0x5cfd71);}catch(_0x4744a3){utils[_0x634f('0x16')](util[_0x634f('0x1b')](_0x634f('0x43'),_0x5cfd71[_0x634f('0x22')]),_0x4744a3);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 987aeb3..59883a1 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 _0x5d3c=['state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','duration','diffTime','exitAt','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','type','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','assign','source','lodash','util','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','membername','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s'];(function(_0xf10e79,_0x1bec0f){var _0x22a96e=function(_0x4092bc){while(--_0x4092bc){_0xf10e79['push'](_0xf10e79['shift']());}};_0x22a96e(++_0x1bec0f);}(_0x5d3c,0x159));var _0xc5d3=function(_0x370b3c,_0x458113){_0x370b3c=_0x370b3c-0x0;var _0x2d05ea=_0x5d3c[_0x370b3c];return _0x2d05ea;};'use strict';var _=require(_0xc5d3('0x0'));var util=require(_0xc5d3('0x1'));var utils=require(_0xc5d3('0x2'));var members={};var exclude=['Local/_attended@transfer',_0xc5d3('0x3')];function writeDB(_0x5db8dd){utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x6'),_0x5db8dd[_0xc5d3('0x7')],_0x5db8dd[_0xc5d3('0x8')],_0x5db8dd[_0xc5d3('0x9')],_0x5db8dd[_0xc5d3('0xa')],_0x5db8dd['membername'],_0x5db8dd['type']));if(_0x5db8dd[_0xc5d3('0x8')]){utils[_0xc5d3('0xb')](_0x5db8dd['interface'])['then'](function(_0x461460){if(_0x461460){_0x5db8dd[_0xc5d3('0xc')]=_0x461460[_0xc5d3('0xd')];_0x5db8dd[_0xc5d3('0xe')]=_0x461460['internal'];utils[_0xc5d3('0xf')](_0xc5d3('0x10'),_0x5db8dd);}else{utils[_0xc5d3('0x11')](_0x5db8dd['interface'][_0xc5d3('0x12')]('/')[0x1])['then'](function(_0x5a8e74){if(_0x5a8e74){_0x5db8dd[_0xc5d3('0xc')]=_0x5a8e74[_0xc5d3('0xd')];_0x5db8dd[_0xc5d3('0xe')]=_0x5a8e74['internal'];utils['request']('CreateMemberReport',_0x5db8dd);}});}})[_0xc5d3('0x13')](function(_0x4ecc59){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x15'),_0x5db8dd[_0xc5d3('0x7')]),_0x4ecc59);});}delete members[_0x5db8dd[_0xc5d3('0x8')]];}function startsWith(_0x415b82,_0x53d00d){return _[_0xc5d3('0x16')](_0x415b82,function(_0x3b5adf){return _['startsWith'](_0x53d00d,_0x3b5adf);});}exports['devicestatechange']=function(_0x4d235b){try{utils[_0xc5d3('0x17')](util['format']('[%s][members][devicestatechange]',members[_0x4d235b['device']]?members[_0x4d235b['device']][_0xc5d3('0x7')]:_0x4d235b[_0xc5d3('0x18')]),_0x4d235b);utils['info'](util[_0xc5d3('0x5')](_0xc5d3('0x19'),members[_0x4d235b[_0xc5d3('0x18')]]?members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x7')]:_0x4d235b[_0xc5d3('0x18')],_0x4d235b['state'],_0x4d235b[_0xc5d3('0x18')]));switch(_0x4d235b[_0xc5d3('0x1a')]){case _0xc5d3('0x1b'):case _0xc5d3('0x1c'):if(!startsWith(exclude,_0x4d235b['device'])){members[_0x4d235b[_0xc5d3('0x18')]]={'channel':_0xc5d3('0x1d'),'interface':_0x4d235b['device'],'type':_0xc5d3('0x1e'),'enterAt':utils[_0xc5d3('0x1f')](),'role':_0xc5d3('0x20')};}break;case _0xc5d3('0x21'):if(!_['isNil'](members[_0x4d235b['device']])){members[_0x4d235b[_0xc5d3('0x18')]]['exitAt']=utils[_0xc5d3('0x1f')]();members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x22')]=utils[_0xc5d3('0x23')](members[_0x4d235b['device']][_0xc5d3('0x24')],members[_0x4d235b['device']][_0xc5d3('0x25')]);if(members[_0x4d235b[_0xc5d3('0x18')]][_0xc5d3('0x7')]){writeDB(members[_0x4d235b[_0xc5d3('0x18')]]);}}break;default:break;}}catch(_0x282e5b){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')]('[%s][members][devicestatechange]',members[_0x4d235b[_0xc5d3('0x18')]]?members[_0x4d235b[_0xc5d3('0x18')]]['uniqueid']:_0x4d235b['device']),_0x282e5b);}};exports[_0xc5d3('0x26')]=function(_0x236f8c){try{if(!_[_0xc5d3('0x27')](members[_0x236f8c[_0xc5d3('0x8')]])){utils[_0xc5d3('0x17')](util[_0xc5d3('0x5')]('[%s][members][agentcomplete]',_0x236f8c[_0xc5d3('0x7')]),_0x236f8c);utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x28'),_0x236f8c[_0xc5d3('0x7')],_0x236f8c[_0xc5d3('0x8')],_0x236f8c['queue']));members[_0x236f8c[_0xc5d3('0x8')]]=_['assign'](members[_0x236f8c[_0xc5d3('0x8')]],{'data4':_0x236f8c[_0xc5d3('0x29')],'uniqueid':_0x236f8c['uniqueid']});}}catch(_0xcee55c){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x2a'),_0x236f8c[_0xc5d3('0x7')]),_0xcee55c);}};exports[_0xc5d3('0x2b')]=function(_0x8de569){try{utils[_0xc5d3('0x17')](util[_0xc5d3('0x5')](_0xc5d3('0x2c'),_0x8de569[_0xc5d3('0x7')]),_0x8de569);if(_0x8de569[_0xc5d3('0x9')]){var _0x2be084=_0x8de569[_0xc5d3('0x9')][_0xc5d3('0x12')]('-')[0x0];if(!_[_0xc5d3('0x27')](members[_0x2be084])){members[_0x2be084]=_['assign'](members[_0x2be084],{'data1':members[_0x2be084][_0xc5d3('0x2d')]||_0x8de569[_0xc5d3('0x2e')],'data2':members[_0x2be084][_0xc5d3('0xa')]||_0x8de569['source'],'data3':members[_0x2be084][_0xc5d3('0x2f')]||_0x8de569[_0xc5d3('0x30')],'uniqueid':members[_0x2be084][_0xc5d3('0x7')]||_0x8de569[_0xc5d3('0x7')]});utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')](_0xc5d3('0x31'),_0x8de569['uniqueid'],members[_0x2be084][_0xc5d3('0x2d')],members[_0x2be084]['data2'],members[_0x2be084][_0xc5d3('0x2f')]));if(members[_0x2be084][_0xc5d3('0x24')]){writeDB(members[_0x2be084]);}}}if(_0x8de569[_0xc5d3('0x32')]){var _0x50a494=_0x8de569[_0xc5d3('0x32')][_0xc5d3('0x12')]('-')[0x0];if(!_[_0xc5d3('0x27')](members[_0x50a494])){members[_0x50a494]=_[_0xc5d3('0x33')](members[_0x50a494],{'data1':members[_0x50a494]['data1']||_0x8de569['type'],'data2':members[_0x50a494]['data2']||_0x8de569[_0xc5d3('0x34')],'data3':members[_0x50a494]['data3']||_0x8de569[_0xc5d3('0x30')],'uniqueid':members[_0x50a494][_0xc5d3('0x7')]||_0x8de569[_0xc5d3('0x7')]});utils[_0xc5d3('0x4')](util[_0xc5d3('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x8de569[_0xc5d3('0x7')],members[_0x50a494][_0xc5d3('0x2d')],members[_0x50a494]['data2'],members[_0x50a494][_0xc5d3('0x2f')]));if(members[_0x50a494][_0xc5d3('0x24')]){writeDB(members[_0x50a494]);}}}}catch(_0x3ade43){utils[_0xc5d3('0x14')](util[_0xc5d3('0x5')](_0xc5d3('0x2c'),_0x8de569[_0xc5d3('0x7')]),_0x3ade43);}}; \ No newline at end of file +var _0xf0ba=['[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','uniqueid','channel','type','interface','getUserByInterface','then','membername','name','internal','request','getUserByName','split','catch','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf0ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var utils=require(_0xaf0b('0x2'));var members={};var exclude=[_0xaf0b('0x3'),_0xaf0b('0x4')];function writeDB(_0x555620){utils[_0xaf0b('0x5')](util[_0xaf0b('0x6')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x555620[_0xaf0b('0x7')],_0x555620['interface'],_0x555620[_0xaf0b('0x8')],_0x555620['data2'],_0x555620['membername'],_0x555620[_0xaf0b('0x9')]));if(_0x555620[_0xaf0b('0xa')]){utils[_0xaf0b('0xb')](_0x555620[_0xaf0b('0xa')])[_0xaf0b('0xc')](function(_0x5b7f0c){if(_0x5b7f0c){_0x555620[_0xaf0b('0xd')]=_0x5b7f0c[_0xaf0b('0xe')];_0x555620[_0xaf0b('0xf')]=_0x5b7f0c['internal'];utils[_0xaf0b('0x10')]('CreateMemberReport',_0x555620);}else{utils[_0xaf0b('0x11')](_0x555620[_0xaf0b('0xa')][_0xaf0b('0x12')]('/')[0x1])['then'](function(_0x45c200){if(_0x45c200){_0x555620[_0xaf0b('0xd')]=_0x45c200[_0xaf0b('0xe')];_0x555620[_0xaf0b('0xf')]=_0x45c200[_0xaf0b('0xf')];utils[_0xaf0b('0x10')]('CreateMemberReport',_0x555620);}});}})[_0xaf0b('0x13')](function(_0xdbd3d6){utils[_0xaf0b('0x14')](util[_0xaf0b('0x6')]('[%s][members][writeDB]',_0x555620[_0xaf0b('0x7')]),_0xdbd3d6);});}delete members[_0x555620[_0xaf0b('0xa')]];}function startsWith(_0x45c1b2,_0x2cb9a2){return _[_0xaf0b('0x15')](_0x45c1b2,function(_0x15d4a6){return _[_0xaf0b('0x16')](_0x2cb9a2,_0x15d4a6);});}exports[_0xaf0b('0x17')]=function(_0x4885da){try{utils[_0xaf0b('0x18')](util['format'](_0xaf0b('0x19'),members[_0x4885da[_0xaf0b('0x1a')]]?members[_0x4885da[_0xaf0b('0x1a')]][_0xaf0b('0x7')]:_0x4885da[_0xaf0b('0x1a')]),_0x4885da);utils[_0xaf0b('0x5')](util[_0xaf0b('0x6')](_0xaf0b('0x1b'),members[_0x4885da[_0xaf0b('0x1a')]]?members[_0x4885da[_0xaf0b('0x1a')]]['uniqueid']:_0x4885da[_0xaf0b('0x1a')],_0x4885da[_0xaf0b('0x1c')],_0x4885da[_0xaf0b('0x1a')]));switch(_0x4885da['state']){case _0xaf0b('0x1d'):case _0xaf0b('0x1e'):if(!startsWith(exclude,_0x4885da['device'])){members[_0x4885da[_0xaf0b('0x1a')]]={'channel':_0xaf0b('0x1f'),'interface':_0x4885da[_0xaf0b('0x1a')],'type':_0xaf0b('0x20'),'enterAt':utils[_0xaf0b('0x21')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0xaf0b('0x22')](members[_0x4885da[_0xaf0b('0x1a')]])){members[_0x4885da[_0xaf0b('0x1a')]][_0xaf0b('0x23')]=utils[_0xaf0b('0x21')]();members[_0x4885da[_0xaf0b('0x1a')]][_0xaf0b('0x24')]=utils[_0xaf0b('0x25')](members[_0x4885da['device']][_0xaf0b('0x23')],members[_0x4885da[_0xaf0b('0x1a')]][_0xaf0b('0x26')]);if(members[_0x4885da['device']][_0xaf0b('0x7')]){writeDB(members[_0x4885da[_0xaf0b('0x1a')]]);}}break;default:break;}}catch(_0x54c3be){utils['error'](util['format'](_0xaf0b('0x19'),members[_0x4885da[_0xaf0b('0x1a')]]?members[_0x4885da[_0xaf0b('0x1a')]]['uniqueid']:_0x4885da[_0xaf0b('0x1a')]),_0x54c3be);}};exports[_0xaf0b('0x27')]=function(_0x4b9031){try{if(!_[_0xaf0b('0x22')](members[_0x4b9031[_0xaf0b('0xa')]])){utils[_0xaf0b('0x18')](util[_0xaf0b('0x6')]('[%s][members][agentcomplete]',_0x4b9031[_0xaf0b('0x7')]),_0x4b9031);utils[_0xaf0b('0x5')](util['format'](_0xaf0b('0x28'),_0x4b9031[_0xaf0b('0x7')],_0x4b9031[_0xaf0b('0xa')],_0x4b9031[_0xaf0b('0x29')]));members[_0x4b9031[_0xaf0b('0xa')]]=_[_0xaf0b('0x2a')](members[_0x4b9031[_0xaf0b('0xa')]],{'data4':_0x4b9031[_0xaf0b('0x29')],'uniqueid':_0x4b9031[_0xaf0b('0x7')]});}}catch(_0x4fe4b3){utils[_0xaf0b('0x14')](util['format']('[%s][members][agentcomplete]',_0x4b9031['uniqueid']),_0x4fe4b3);}};exports[_0xaf0b('0x2b')]=function(_0x3b0f51){try{utils[_0xaf0b('0x18')](util[_0xaf0b('0x6')](_0xaf0b('0x2c'),_0x3b0f51[_0xaf0b('0x7')]),_0x3b0f51);if(_0x3b0f51['channel']){var _0x18fd18=_0x3b0f51[_0xaf0b('0x8')][_0xaf0b('0x12')]('-')[0x0];if(!_[_0xaf0b('0x22')](members[_0x18fd18])){members[_0x18fd18]=_[_0xaf0b('0x2a')](members[_0x18fd18],{'data1':members[_0x18fd18][_0xaf0b('0x2d')]||_0x3b0f51[_0xaf0b('0x9')],'data2':members[_0x18fd18][_0xaf0b('0x2e')]||_0x3b0f51[_0xaf0b('0x2f')],'data3':members[_0x18fd18][_0xaf0b('0x30')]||_0x3b0f51['destination'],'uniqueid':members[_0x18fd18][_0xaf0b('0x7')]||_0x3b0f51['uniqueid']});utils[_0xaf0b('0x5')](util['format'](_0xaf0b('0x31'),_0x3b0f51['uniqueid'],members[_0x18fd18][_0xaf0b('0x2d')],members[_0x18fd18][_0xaf0b('0x2e')],members[_0x18fd18][_0xaf0b('0x30')]));if(members[_0x18fd18][_0xaf0b('0x23')]){writeDB(members[_0x18fd18]);}}}if(_0x3b0f51[_0xaf0b('0x32')]){var _0x288c99=_0x3b0f51[_0xaf0b('0x32')]['split']('-')[0x0];if(!_[_0xaf0b('0x22')](members[_0x288c99])){members[_0x288c99]=_[_0xaf0b('0x2a')](members[_0x288c99],{'data1':members[_0x288c99][_0xaf0b('0x2d')]||_0x3b0f51[_0xaf0b('0x9')],'data2':members[_0x288c99]['data2']||_0x3b0f51[_0xaf0b('0x2f')],'data3':members[_0x288c99][_0xaf0b('0x30')]||_0x3b0f51[_0xaf0b('0x33')],'uniqueid':members[_0x288c99][_0xaf0b('0x7')]||_0x3b0f51[_0xaf0b('0x7')]});utils['info'](util[_0xaf0b('0x6')](_0xaf0b('0x31'),_0x3b0f51[_0xaf0b('0x7')],members[_0x288c99][_0xaf0b('0x2d')],members[_0x288c99][_0xaf0b('0x2e')],members[_0x288c99][_0xaf0b('0x30')]));if(members[_0x288c99][_0xaf0b('0x23')]){writeDB(members[_0x288c99]);}}}}catch(_0x47b2f9){utils[_0xaf0b('0x14')](util['format'](_0xaf0b('0x2c'),_0x3b0f51[_0xaf0b('0x7')]),_0x47b2f9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6395cfe..c49897f 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 _0x9263=['[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','isNil','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','transfer','TRANSFER','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','lastAssignedTo','calleridnum','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','format'];(function(_0x33b40c,_0x38e315){var _0x3fd36f=function(_0x10f41c){while(--_0x10f41c){_0x33b40c['push'](_0x33b40c['shift']());}};_0x3fd36f(++_0x38e315);}(_0x9263,0x12b));var _0x3926=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x9263[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x3926('0x0'));var util=require(_0x3926('0x1'));var utils=require(_0x3926('0x2'));var queues={};function writeDB(_0xf87863){utils[_0x3926('0x3')](util['format'](_0x3926('0x4'),_0xf87863['uniqueid'],_0xf87863['channel'],_0xf87863['queue'],_0xf87863[_0x3926('0x5')],_0xf87863[_0x3926('0x6')],_0xf87863['accountcode'],_0xf87863[_0x3926('0x7')]));if(_0xf87863[_0x3926('0x8')]){utils[_0x3926('0x9')](_0xf87863[_0x3926('0x8')])[_0x3926('0xa')](function(_0x1f4410){if(_0x1f4410){_0xf87863[_0x3926('0xb')]=_0x1f4410[_0x3926('0xb')];}utils[_0x3926('0xc')](_0x3926('0xd'),_0xf87863);});}else{utils[_0x3926('0xc')](_0x3926('0xd'),_0xf87863);}if(_0xf87863[_0x3926('0xe')]){delete queues[_0xf87863['transfereduniqueid']];}else{delete queues[_0xf87863[_0x3926('0xf')]];}}exports[_0x3926('0x10')]=function(_0x347bee){try{utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x13'),_0x347bee[_0x3926('0xf')]),_0x347bee);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x14'),_0x347bee['uniqueid'],_0x347bee[_0x3926('0x8')],_0x347bee[_0x3926('0x15')]));queues[_0x347bee[_0x3926('0xf')]]=_[_0x3926('0x16')](_0x347bee,{'originalposition':_0x347bee[_0x3926('0x15')],'queuecallerjoinAt':utils[_0x3926('0x17')](),'mohtime':0x0});}catch(_0x5ca407){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x13'),_0x347bee['uniqueid']),_0x5ca407);}};exports[_0x3926('0x19')]=function(_0x8e3b50){try{if(!_['isNil'](queues[_0x8e3b50[_0x3926('0xf')]])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x1a'),_0x8e3b50[_0x3926('0xf')]),_0x8e3b50);if(queues[_0x8e3b50['uniqueid']][_0x3926('0x1b')]){if(!queues[_0x8e3b50[_0x3926('0xf')]]['queuecallerabandon']&&!queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x1c')]){queues[_0x8e3b50['uniqueid']][_0x3926('0x1d')]=!![];queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x1e')]=utils[_0x3926('0x17')]();queues[_0x8e3b50['uniqueid']]['queuecallerexitreason']=_0x3926('0x1f');}utils['info'](util[_0x3926('0x12')](_0x3926('0x20'),_0x8e3b50['uniqueid'],queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x8e3b50[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x8e3b50[_0x3926('0xf')]]);}else if(queues[_0x8e3b50['uniqueid']][_0x3926('0xe')]){utils[_0x3926('0x3')](util['format'](_0x3926('0x22'),_0x8e3b50[_0x3926('0xf')],queues[_0x8e3b50['uniqueid']][_0x3926('0x21')],queues[_0x8e3b50[_0x3926('0xf')]]['transfereduniqueid']));queues[queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0xe')]]=queues[_0x8e3b50['uniqueid']];queues[queues[_0x8e3b50[_0x3926('0xf')]][_0x3926('0xe')]][_0x3926('0x23')]=0x2;delete queues[_0x8e3b50[_0x3926('0xf')]];}}}catch(_0x433edc){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x1a'),_0x8e3b50[_0x3926('0xf')]),_0x433edc);}};exports['varset']=function(_0x45065c){try{utils[_0x3926('0x11')](util[_0x3926('0x12')]('[%s][queues][varset]',_0x45065c[_0x3926('0xf')]),_0x45065c);if(!_[_0x3926('0x24')](_0x45065c[_0x3926('0x25')][_0x3926('0x26')])&&_0x45065c[_0x3926('0x27')]['toUpperCase']()!==_0x3926('0x28')){if(!_[_0x3926('0x24')](queues[_0x45065c[_0x3926('0xf')]])){queues[_0x45065c[_0x3926('0xf')]]['queuecallerabandon']=![];queues[_0x45065c['uniqueid']][_0x3926('0x29')]=null;queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x1c')]=!![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2a')]=utils['now']();queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x7')]=_0x45065c[_0x3926('0x27')][_0x3926('0x2b')]();utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x2c'),_0x45065c['uniqueid'],queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x21')],_0x45065c[_0x3926('0x27')],queues[_0x45065c[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x45065c[_0x3926('0xf')]]);}}else if(!_[_0x3926('0x24')](_0x45065c[_0x3926('0x25')]['queueposition'])){if(!_[_0x3926('0x24')](queues[_0x45065c['uniqueid']])&&!queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2d')]){queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x45065c['uniqueid']][_0x3926('0x1c')]=!![];queues[_0x45065c[_0x3926('0xf')]][_0x3926('0x2a')]=utils[_0x3926('0x17')]();queues[_0x45065c[_0x3926('0xf')]]['queuecallerexitreason']=_0x3926('0x2e');utils['info'](util[_0x3926('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x45065c[_0x3926('0xf')],queues[_0x45065c['uniqueid']][_0x3926('0x21')],_0x45065c[_0x3926('0x27')],queues[_0x45065c['uniqueid']][_0x3926('0x7')]));}}}catch(_0x460775){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x2f'),_0x45065c['uniqueid']),_0x460775);}};exports[_0x3926('0x2d')]=function(_0x496995){try{if(!_[_0x3926('0x24')](queues[_0x496995[_0x3926('0xf')]])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x30'),_0x496995[_0x3926('0xf')]),_0x496995);queues[_0x496995['uniqueid']][_0x3926('0x1c')]=![];queues[_0x496995[_0x3926('0xf')]][_0x3926('0x2a')]=null;queues[_0x496995['uniqueid']][_0x3926('0x2d')]=!![];queues[_0x496995[_0x3926('0xf')]][_0x3926('0x29')]=utils[_0x3926('0x17')]();queues[_0x496995[_0x3926('0xf')]][_0x3926('0x7')]=_0x3926('0x31');utils[_0x3926('0x3')](util['format'](_0x3926('0x32'),_0x496995[_0x3926('0xf')],queues[_0x496995[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x496995[_0x3926('0xf')]][_0x3926('0x7')]));}}catch(_0x43e67f){utils[_0x3926('0x18')](util['format']('[%s][queues][queuecallerabandon]',_0x496995[_0x3926('0xf')]),_0x43e67f);}};exports[_0x3926('0x33')]=function(_0x5cd0ec){try{if(!_['isNil'](queues[_0x5cd0ec[_0x3926('0xf')]])){utils[_0x3926('0x11')](util['format'](_0x3926('0x34'),_0x5cd0ec[_0x3926('0xf')]),_0x5cd0ec);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x35'),_0x5cd0ec[_0x3926('0xf')],queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x21')],_0x5cd0ec[_0x3926('0x36')],_0x5cd0ec[_0x3926('0x37')]));queues[_0x5cd0ec['uniqueid']][_0x3926('0x33')]=!![];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x1b')]=utils[_0x3926('0x17')]();queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x38')]=utils[_0x3926('0x39')](queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x1b')],queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x3a')]);queues[_0x5cd0ec['uniqueid']][_0x3926('0x15')]=_0x5cd0ec[_0x3926('0x15')];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x3b')]=_0x5cd0ec[_0x3926('0x3b')];queues[_0x5cd0ec[_0x3926('0xf')]]['connectedlinenum']=_0x5cd0ec['connectedlinenum'];queues[_0x5cd0ec[_0x3926('0xf')]][_0x3926('0x37')]=_0x5cd0ec[_0x3926('0x37')];}}catch(_0x383de2){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][queuecallerleave]',_0x5cd0ec[_0x3926('0xf')]),_0x383de2);}};exports['agentconnect']=function(_0x1c0328){try{if(!_[_0x3926('0x24')](queues[_0x1c0328['uniqueid']])){utils[_0x3926('0x11')](util['format'](_0x3926('0x3c'),_0x1c0328['uniqueid']),_0x1c0328);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x3d'),_0x1c0328['uniqueid'],queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x21')],_0x1c0328[_0x3926('0x3e')],_0x1c0328['destaccountcode']));queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x1c0328[_0x3926('0xf')]]['queuecallerexit']=![];queues[_0x1c0328[_0x3926('0xf')]]['queuecallerexitreason']=null;queues[_0x1c0328['uniqueid']][_0x3926('0x2a')]=null;queues[_0x1c0328[_0x3926('0xf')]]['assigned']=!![];queues[_0x1c0328[_0x3926('0xf')]]['accountcode']=_0x1c0328[_0x3926('0x3f')];queues[_0x1c0328[_0x3926('0xf')]][_0x3926('0x5')]=_0x1c0328[_0x3926('0x3e')];}}catch(_0x3704cc){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x3c'),_0x1c0328[_0x3926('0xf')]),_0x3704cc);}};exports[_0x3926('0x40')]=function(_0x46265a){try{if(!_['isNil'](queues[_0x46265a['uniqueid']])){if(queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x1b')]){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x41'),_0x46265a[_0x3926('0xf')]),_0x46265a);queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x2d')]=![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x29')]=null;queues[_0x46265a[_0x3926('0xf')]]['queuecallerexit']=![];queues[_0x46265a['uniqueid']][_0x3926('0x2a')]=null;queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x42')]=!![];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x5')]=_0x46265a[_0x3926('0x3e')];queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x1d')]=!![];queues[_0x46265a[_0x3926('0xf')]]['queuecallercompleteAt']=utils[_0x3926('0x17')]();if(_0x46265a['reason']==_0x3926('0x43')){if(!queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x43')]){queues[_0x46265a['uniqueid']][_0x3926('0x7')]=_0x3926('0x44');}}else{queues[_0x46265a['uniqueid']][_0x3926('0x7')]='COMPLETEDBY'+_0x46265a[_0x3926('0x45')][_0x3926('0x2b')]();}utils[_0x3926('0x3')](util['format'](_0x3926('0x46'),_0x46265a[_0x3926('0xf')],queues[_0x46265a[_0x3926('0xf')]][_0x3926('0x21')],_0x46265a[_0x3926('0x3e')],queues[_0x46265a[_0x3926('0xf')]]['queuecallerexitreason']));writeDB(queues[_0x46265a[_0x3926('0xf')]]);}}}catch(_0x19b9f6){utils[_0x3926('0x18')](util['format'](_0x3926('0x41'),_0x46265a[_0x3926('0xf')]),_0x19b9f6);}};exports[_0x3926('0x47')]=function(_0x105077){try{if(!_['isNil'](queues[_0x105077['transfereeuniqueid']])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x48'),_0x105077[_0x3926('0xf')]),_0x105077);queues[_0x105077[_0x3926('0x49')]][_0x3926('0x43')]=!![];queues[_0x105077[_0x3926('0x49')]][_0x3926('0x4a')]=_0x3926('0x4b');queues[_0x105077[_0x3926('0x49')]]['transferexten']=_0x105077[_0x3926('0x4c')];queues[_0x105077[_0x3926('0x49')]][_0x3926('0x4d')]=_0x105077[_0x3926('0x49')];queues[_0x105077['transfereeuniqueid']][_0x3926('0x7')]=_0x3926('0x4e');utils['info'](util[_0x3926('0x12')](_0x3926('0x4f'),_0x105077[_0x3926('0xf')],queues[_0x105077[_0x3926('0x49')]][_0x3926('0x21')],_0x105077[_0x3926('0x49')],_0x105077[_0x3926('0x4c')]));}}catch(_0x5cabb1){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][blindtransfer]',_0x105077[_0x3926('0xf')]),_0x5cabb1);}};exports[_0x3926('0x50')]=function(_0x21dfba){try{utils['debug'](util[_0x3926('0x12')](_0x3926('0x51'),_0x21dfba[_0x3926('0x52')]),_0x21dfba);if(_0x21dfba[_0x3926('0x52')]==_0x21dfba[_0x3926('0x53')]){if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x54')]])){utils[_0x3926('0x3')](util['format'](_0x3926('0x55'),_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x21')],_0x21dfba[_0x3926('0x56')]));queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x43')]=!![];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x4a')]=_0x3926('0x57');queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x58')]=_0x21dfba[_0x3926('0x56')];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x4d')]=_0x21dfba['origtransfereruniqueid'];queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x53')]])){if(_0x21dfba[_0x3926('0x59')]&&queues[_0x21dfba[_0x3926('0x59')]]){queues[_0x21dfba[_0x3926('0x59')]][_0x3926('0x23')]=0x1;queues[_0x21dfba[_0x3926('0x49')]]=_['clone'](queues[_0x21dfba[_0x3926('0x59')]]);queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0xe')]=_0x21dfba[_0x3926('0x5a')];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x23')]=0x2;queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x6')]=queues[_0x21dfba[_0x3926('0x54')]][_0x3926('0x6')];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x5b')]=queues[_0x21dfba[_0x3926('0x54')]]['calleridname'];queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x3a')]=utils[_0x3926('0x17')]();queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x1b')]=utils['now']();queues[_0x21dfba[_0x3926('0x49')]]['holdtime']=0x0;queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x5c')]=0x0;utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x5d'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x49')]][_0x3926('0x21')],queues[_0x21dfba['transfereeuniqueid']]['calleridnum'],queues[_0x21dfba['transfereeuniqueid']][_0x3926('0x5b')]));}else{utils[_0x3926('0x3')](util['format'](_0x3926('0x5e'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x53')]]['name'],_0x21dfba[_0x3926('0x54')]));queues[_0x21dfba['origtransfererlinkedid']]['transfereduniqueid']=_0x21dfba[_0x3926('0x54')];}}}else if(_0x21dfba['secondtransfereruniqueid']==_0x21dfba['secondtransfererlinkedid']){if(!_[_0x3926('0x24')](queues[_0x21dfba['origtransfererlinkedid']])){utils[_0x3926('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x21')],_0x21dfba[_0x3926('0x5f')],_0x21dfba[_0x3926('0x60')]));queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x43')]=!![];queues[_0x21dfba[_0x3926('0x53')]]['transfertype']=_0x3926('0x57');queues[_0x21dfba[_0x3926('0x53')]]['transferexten']=_0x21dfba['secondtransfererexten'];queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x4d')]=_0x21dfba['secondtransfereruniqueid'];queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x7')]='ATTENDEDTRANSFER';}if(!_[_0x3926('0x24')](queues[_0x21dfba[_0x3926('0x54')]])){if(_0x21dfba['transfertargetlinkedid']&&queues[_0x21dfba[_0x3926('0x61')]]){queues[_0x21dfba[_0x3926('0x61')]][_0x3926('0x23')]=0x1;queues[_0x21dfba[_0x3926('0x5a')]]=_['clone'](queues[_0x21dfba[_0x3926('0x61')]]);queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0xe')]=_0x21dfba[_0x3926('0x5a')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x23')]=0x2;queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x6')]=queues[_0x21dfba['origtransfererlinkedid']][_0x3926('0x6')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x5b')]=queues[_0x21dfba[_0x3926('0x53')]][_0x3926('0x5b')];queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x3a')]=utils[_0x3926('0x17')]();queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x1b')]=utils[_0x3926('0x17')]();queues[_0x21dfba['transfertargetuniqueid']][_0x3926('0x38')]=0x0;queues[_0x21dfba[_0x3926('0x5a')]]['mohtime']=0x0;utils[_0x3926('0x3')](util['format'](_0x3926('0x62'),_0x21dfba[_0x3926('0x52')],queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0x21')],queues[_0x21dfba[_0x3926('0x5a')]][_0x3926('0xe')],queues[_0x21dfba[_0x3926('0x5a')]]['calleridnum'],queues[_0x21dfba['transfertargetuniqueid']][_0x3926('0x5b')]));}else{utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x5e'),_0x21dfba['origtransfereruniqueid'],queues[_0x21dfba['secondtransfererlinkedid']][_0x3926('0x21')],_0x21dfba[_0x3926('0x53')]));queues[_0x21dfba['secondtransfererlinkedid']][_0x3926('0xe')]=_0x21dfba[_0x3926('0x53')];}}}}catch(_0x534135){utils[_0x3926('0x18')](util['format']('[%s][queues][attendedtransfer]',_0x21dfba[_0x3926('0x52')]),_0x534135);}};exports[_0x3926('0x63')]=function(_0x48d2e1){try{if(!_[_0x3926('0x24')](queues[_0x48d2e1[_0x3926('0xf')]])){utils['debug'](util[_0x3926('0x12')](_0x3926('0x64'),_0x48d2e1[_0x3926('0xf')]),_0x48d2e1);queues[_0x48d2e1[_0x3926('0xf')]][_0x3926('0x65')]=utils['now']();utils['info'](util[_0x3926('0x12')](_0x3926('0x66'),_0x48d2e1[_0x3926('0xf')],queues[_0x48d2e1[_0x3926('0xf')]]['name'],queues[_0x48d2e1[_0x3926('0xf')]][_0x3926('0x65')]));}}catch(_0x28c59c){utils[_0x3926('0x18')](util[_0x3926('0x12')]('[%s][queues][musiconholdstart]',_0x48d2e1[_0x3926('0xf')]),_0x28c59c);}};exports[_0x3926('0x67')]=function(_0x52da9b){try{if(!_[_0x3926('0x24')](queues[_0x52da9b[_0x3926('0xf')]])){if(!_[_0x3926('0x24')](queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x65')])){utils[_0x3926('0x11')](util[_0x3926('0x12')](_0x3926('0x68'),_0x52da9b['uniqueid']),_0x52da9b);queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x5c')]+=utils['diffTime'](utils['now'](),queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x65')]);utils[_0x3926('0x3')](util[_0x3926('0x12')](_0x3926('0x69'),_0x52da9b[_0x3926('0xf')],queues[_0x52da9b[_0x3926('0xf')]][_0x3926('0x21')],queues[_0x52da9b['uniqueid']][_0x3926('0x5c')]));delete queues[_0x52da9b['uniqueid']][_0x3926('0x65')];}}}catch(_0x7568c){utils[_0x3926('0x18')](util[_0x3926('0x12')](_0x3926('0x68'),_0x52da9b[_0x3926('0xf')]),_0x7568c);}}; \ No newline at end of file +var _0x68af=['./utils','format','channel','lastAssignedTo','accountcode','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','debug','position','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallerexitreason','COMPLETEDBYAGENT','info','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','isNil','variable','value','CONTINUE','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','queuecallerexitAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerleaveAt','queuecallerjoinAt','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','[%s][queues][blindtransfer]','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transfertype','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','mohtime','calleridname','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]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util'];(function(_0x535c18,_0x37a629){var _0x360765=function(_0x102ac0){while(--_0x102ac0){_0x535c18['push'](_0x535c18['shift']());}};_0x360765(++_0x37a629);}(_0x68af,0x145));var _0xf68a=function(_0x4153ad,_0x4bca07){_0x4153ad=_0x4153ad-0x0;var _0x5b3eb4=_0x68af[_0x4153ad];return _0x5b3eb4;};'use strict';var _=require(_0xf68a('0x0'));var util=require(_0xf68a('0x1'));var utils=require(_0xf68a('0x2'));var queues={};function writeDB(_0x2e399c){utils['info'](util[_0xf68a('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2e399c['uniqueid'],_0x2e399c[_0xf68a('0x4')],_0x2e399c['queue'],_0x2e399c[_0xf68a('0x5')],_0x2e399c['calleridnum'],_0x2e399c[_0xf68a('0x6')],_0x2e399c['queuecallerexitreason']));if(_0x2e399c[_0xf68a('0x7')]){utils[_0xf68a('0x8')](_0x2e399c[_0xf68a('0x7')])[_0xf68a('0x9')](function(_0x1fc08b){if(_0x1fc08b){_0x2e399c[_0xf68a('0xa')]=_0x1fc08b[_0xf68a('0xa')];}utils[_0xf68a('0xb')](_0xf68a('0xc'),_0x2e399c);});}else{utils[_0xf68a('0xb')](_0xf68a('0xc'),_0x2e399c);}if(_0x2e399c[_0xf68a('0xd')]){delete queues[_0x2e399c[_0xf68a('0xd')]];}else{delete queues[_0x2e399c[_0xf68a('0xe')]];}}exports[_0xf68a('0xf')]=function(_0x83a437){try{utils[_0xf68a('0x10')](util['format']('[%s][queues][queuecallerjoin]',_0x83a437['uniqueid']),_0x83a437);utils['info'](util[_0xf68a('0x3')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x83a437[_0xf68a('0xe')],_0x83a437[_0xf68a('0x7')],_0x83a437[_0xf68a('0x11')]));queues[_0x83a437['uniqueid']]=_['assign'](_0x83a437,{'originalposition':_0x83a437[_0xf68a('0x11')],'queuecallerjoinAt':utils[_0xf68a('0x12')](),'mohtime':0x0});}catch(_0x4fd99e){utils[_0xf68a('0x13')](util[_0xf68a('0x3')](_0xf68a('0x14'),_0x83a437[_0xf68a('0xe')]),_0x4fd99e);}};exports[_0xf68a('0x15')]=function(_0x57e79b){try{if(!_['isNil'](queues[_0x57e79b['uniqueid']])){utils['debug'](util[_0xf68a('0x3')](_0xf68a('0x16'),_0x57e79b['uniqueid']),_0x57e79b);if(queues[_0x57e79b[_0xf68a('0xe')]]['queuecallerleaveAt']){if(!queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0x17')]&&!queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0x18')]){queues[_0x57e79b[_0xf68a('0xe')]]['queuecallercomplete']=!![];queues[_0x57e79b['uniqueid']]['queuecallercompleteAt']=utils[_0xf68a('0x12')]();queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0x19')]=_0xf68a('0x1a');}utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x1c'),_0x57e79b['uniqueid'],queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0x1d')],queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0x19')]));writeDB(queues[_0x57e79b[_0xf68a('0xe')]]);}else if(queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0xd')]){utils[_0xf68a('0x1b')](util['format'](_0xf68a('0x1e'),_0x57e79b[_0xf68a('0xe')],queues[_0x57e79b['uniqueid']]['name'],queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0xd')]));queues[queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0xd')]]=queues[_0x57e79b['uniqueid']];queues[queues[_0x57e79b[_0xf68a('0xe')]][_0xf68a('0xd')]][_0xf68a('0x1f')]=0x2;delete queues[_0x57e79b['uniqueid']];}}}catch(_0x165b11){utils[_0xf68a('0x13')](util['format'](_0xf68a('0x16'),_0x57e79b[_0xf68a('0xe')]),_0x165b11);}};exports[_0xf68a('0x20')]=function(_0x15baa4){try{utils[_0xf68a('0x10')](util['format']('[%s][queues][varset]',_0x15baa4[_0xf68a('0xe')]),_0x15baa4);if(!_[_0xf68a('0x21')](_0x15baa4[_0xf68a('0x22')]['queuestatus'])&&_0x15baa4[_0xf68a('0x23')]['toUpperCase']()!==_0xf68a('0x24')){if(!_['isNil'](queues[_0x15baa4[_0xf68a('0xe')]])){queues[_0x15baa4['uniqueid']][_0xf68a('0x17')]=![];queues[_0x15baa4['uniqueid']]['queuecallerabandonAt']=null;queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x18')]=!![];queues[_0x15baa4[_0xf68a('0xe')]]['queuecallerexitAt']=utils[_0xf68a('0x12')]();queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x19')]=_0x15baa4[_0xf68a('0x23')][_0xf68a('0x25')]();utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x26'),_0x15baa4['uniqueid'],queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x1d')],_0x15baa4[_0xf68a('0x23')],queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x19')]));writeDB(queues[_0x15baa4[_0xf68a('0xe')]]);}}else if(!_['isNil'](_0x15baa4['variable'][_0xf68a('0x27')])){if(!_[_0xf68a('0x21')](queues[_0x15baa4[_0xf68a('0xe')]])&&!queues[_0x15baa4[_0xf68a('0xe')]]['queuecallerabandon']){queues[_0x15baa4[_0xf68a('0xe')]]['queuecallerabandon']=![];queues[_0x15baa4['uniqueid']][_0xf68a('0x28')]=null;queues[_0x15baa4[_0xf68a('0xe')]]['queuecallerexit']=!![];queues[_0x15baa4[_0xf68a('0xe')]]['queuecallerexitAt']=utils[_0xf68a('0x12')]();queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x19')]=_0xf68a('0x29');utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x2a'),_0x15baa4[_0xf68a('0xe')],queues[_0x15baa4['uniqueid']][_0xf68a('0x1d')],_0x15baa4[_0xf68a('0x23')],queues[_0x15baa4[_0xf68a('0xe')]][_0xf68a('0x19')]));}}}catch(_0x1985a5){utils[_0xf68a('0x13')](util['format'](_0xf68a('0x2b'),_0x15baa4[_0xf68a('0xe')]),_0x1985a5);}};exports[_0xf68a('0x17')]=function(_0x567d52){try{if(!_[_0xf68a('0x21')](queues[_0x567d52[_0xf68a('0xe')]])){utils[_0xf68a('0x10')](util[_0xf68a('0x3')]('[%s][queues][queuecallerabandon]',_0x567d52['uniqueid']),_0x567d52);queues[_0x567d52[_0xf68a('0xe')]][_0xf68a('0x18')]=![];queues[_0x567d52[_0xf68a('0xe')]][_0xf68a('0x2c')]=null;queues[_0x567d52['uniqueid']]['queuecallerabandon']=!![];queues[_0x567d52[_0xf68a('0xe')]][_0xf68a('0x28')]=utils[_0xf68a('0x12')]();queues[_0x567d52[_0xf68a('0xe')]]['queuecallerexitreason']='ABANDONED';utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x2d'),_0x567d52['uniqueid'],queues[_0x567d52[_0xf68a('0xe')]]['name'],queues[_0x567d52['uniqueid']][_0xf68a('0x19')]));}}catch(_0x410a08){utils[_0xf68a('0x13')](util[_0xf68a('0x3')](_0xf68a('0x2e'),_0x567d52['uniqueid']),_0x410a08);}};exports[_0xf68a('0x2f')]=function(_0x6dd6b3){try{if(!_[_0xf68a('0x21')](queues[_0x6dd6b3[_0xf68a('0xe')]])){utils[_0xf68a('0x10')](util['format']('[%s][queues][queuecallerleave]',_0x6dd6b3[_0xf68a('0xe')]),_0x6dd6b3);utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x30'),_0x6dd6b3['uniqueid'],queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x1d')],_0x6dd6b3[_0xf68a('0x31')],_0x6dd6b3[_0xf68a('0x32')]));queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x2f')]=!![];queues[_0x6dd6b3[_0xf68a('0xe')]]['queuecallerleaveAt']=utils[_0xf68a('0x12')]();queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x33')]=utils[_0xf68a('0x34')](queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x35')],queues[_0x6dd6b3['uniqueid']][_0xf68a('0x36')]);queues[_0x6dd6b3[_0xf68a('0xe')]]['position']=_0x6dd6b3['position'];queues[_0x6dd6b3[_0xf68a('0xe')]]['count']=_0x6dd6b3[_0xf68a('0x37')];queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x31')]=_0x6dd6b3['connectedlinenum'];queues[_0x6dd6b3[_0xf68a('0xe')]][_0xf68a('0x32')]=_0x6dd6b3[_0xf68a('0x32')];}}catch(_0x3fbf44){utils['error'](util[_0xf68a('0x3')](_0xf68a('0x38'),_0x6dd6b3[_0xf68a('0xe')]),_0x3fbf44);}};exports['agentconnect']=function(_0x2e867c){try{if(!_['isNil'](queues[_0x2e867c['uniqueid']])){utils['debug'](util[_0xf68a('0x3')](_0xf68a('0x39'),_0x2e867c[_0xf68a('0xe')]),_0x2e867c);utils[_0xf68a('0x1b')](util['format'](_0xf68a('0x3a'),_0x2e867c[_0xf68a('0xe')],queues[_0x2e867c[_0xf68a('0xe')]]['name'],_0x2e867c[_0xf68a('0x3b')],_0x2e867c['destaccountcode']));queues[_0x2e867c[_0xf68a('0xe')]]['queuecallerabandon']=![];queues[_0x2e867c[_0xf68a('0xe')]]['queuecallerabandon']=![];queues[_0x2e867c[_0xf68a('0xe')]][_0xf68a('0x28')]=null;queues[_0x2e867c[_0xf68a('0xe')]][_0xf68a('0x18')]=![];queues[_0x2e867c[_0xf68a('0xe')]]['queuecallerexitreason']=null;queues[_0x2e867c[_0xf68a('0xe')]][_0xf68a('0x2c')]=null;queues[_0x2e867c[_0xf68a('0xe')]][_0xf68a('0x3c')]=!![];queues[_0x2e867c['uniqueid']][_0xf68a('0x6')]=_0x2e867c[_0xf68a('0x3d')];queues[_0x2e867c[_0xf68a('0xe')]][_0xf68a('0x5')]=_0x2e867c['membername'];}}catch(_0x30445a){utils[_0xf68a('0x13')](util[_0xf68a('0x3')](_0xf68a('0x39'),_0x2e867c['uniqueid']),_0x30445a);}};exports[_0xf68a('0x3e')]=function(_0x4a5a8b){try{if(!_[_0xf68a('0x21')](queues[_0x4a5a8b['uniqueid']])){if(queues[_0x4a5a8b[_0xf68a('0xe')]]['queuecallerleaveAt']){utils[_0xf68a('0x10')](util['format'](_0xf68a('0x3f'),_0x4a5a8b[_0xf68a('0xe')]),_0x4a5a8b);queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x17')]=![];queues[_0x4a5a8b['uniqueid']][_0xf68a('0x17')]=![];queues[_0x4a5a8b[_0xf68a('0xe')]]['queuecallerabandonAt']=null;queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x18')]=![];queues[_0x4a5a8b['uniqueid']]['queuecallerexitAt']=null;queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x3c')]=!![];queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x5')]=_0x4a5a8b['membername'];queues[_0x4a5a8b['uniqueid']][_0xf68a('0x40')]=!![];queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x41')]=utils[_0xf68a('0x12')]();if(_0x4a5a8b[_0xf68a('0x42')]=='transfer'){if(!queues[_0x4a5a8b['uniqueid']][_0xf68a('0x43')]){queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x19')]=_0xf68a('0x44');}}else{queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x19')]=_0xf68a('0x45')+_0x4a5a8b[_0xf68a('0x42')][_0xf68a('0x25')]();}utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x46'),_0x4a5a8b['uniqueid'],queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x1d')],_0x4a5a8b[_0xf68a('0x3b')],queues[_0x4a5a8b[_0xf68a('0xe')]][_0xf68a('0x19')]));writeDB(queues[_0x4a5a8b[_0xf68a('0xe')]]);}}}catch(_0x1dbf70){utils[_0xf68a('0x13')](util[_0xf68a('0x3')]('[%s][queues][agentcomplete]',_0x4a5a8b[_0xf68a('0xe')]),_0x1dbf70);}};exports[_0xf68a('0x47')]=function(_0x453baa){try{if(!_['isNil'](queues[_0x453baa[_0xf68a('0x48')]])){utils[_0xf68a('0x10')](util[_0xf68a('0x3')]('[%s][queues][blindtransfer]',_0x453baa[_0xf68a('0xe')]),_0x453baa);queues[_0x453baa[_0xf68a('0x48')]]['transfer']=!![];queues[_0x453baa['transfereeuniqueid']]['transfertype']=_0xf68a('0x49');queues[_0x453baa[_0xf68a('0x48')]][_0xf68a('0x4a')]=_0x453baa['extension'];queues[_0x453baa[_0xf68a('0x48')]]['transferuniqueid']=_0x453baa[_0xf68a('0x48')];queues[_0x453baa['transfereeuniqueid']][_0xf68a('0x19')]=_0xf68a('0x4b');utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x4c'),_0x453baa[_0xf68a('0xe')],queues[_0x453baa['transfereeuniqueid']][_0xf68a('0x1d')],_0x453baa[_0xf68a('0x48')],_0x453baa[_0xf68a('0x4d')]));}}catch(_0x39be2a){utils['error'](util[_0xf68a('0x3')](_0xf68a('0x4e'),_0x453baa[_0xf68a('0xe')]),_0x39be2a);}};exports[_0xf68a('0x4f')]=function(_0x114de0){try{utils[_0xf68a('0x10')](util[_0xf68a('0x3')]('[%s][queues][attendedtransfer]',_0x114de0[_0xf68a('0x50')]),_0x114de0);if(_0x114de0['origtransfereruniqueid']==_0x114de0[_0xf68a('0x51')]){if(!_[_0xf68a('0x21')](queues[_0x114de0[_0xf68a('0x52')]])){utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x53'),_0x114de0['origtransfereruniqueid'],queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x1d')],_0x114de0[_0xf68a('0x54')]));queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x43')]=!![];queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x55')]=_0xf68a('0x56');queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x4a')]=_0x114de0[_0xf68a('0x54')];queues[_0x114de0['secondtransfererlinkedid']][_0xf68a('0x57')]=_0x114de0[_0xf68a('0x50')];queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x19')]=_0xf68a('0x58');}if(!_[_0xf68a('0x21')](queues[_0x114de0[_0xf68a('0x51')]])){if(_0x114de0[_0xf68a('0x59')]&&queues[_0x114de0[_0xf68a('0x59')]]){queues[_0x114de0[_0xf68a('0x59')]][_0xf68a('0x1f')]=0x1;queues[_0x114de0[_0xf68a('0x48')]]=_[_0xf68a('0x5a')](queues[_0x114de0[_0xf68a('0x59')]]);queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0xd')]=_0x114de0[_0xf68a('0x5b')];queues[_0x114de0['transfereeuniqueid']][_0xf68a('0x1f')]=0x2;queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x5c')]=queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x5c')];queues[_0x114de0[_0xf68a('0x48')]]['calleridname']=queues[_0x114de0[_0xf68a('0x52')]]['calleridname'];queues[_0x114de0['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xf68a('0x12')]();queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x35')]=utils[_0xf68a('0x12')]();queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x33')]=0x0;queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x5d')]=0x0;utils[_0xf68a('0x1b')](util[_0xf68a('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x114de0[_0xf68a('0x50')],queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x1d')],queues[_0x114de0[_0xf68a('0x48')]]['calleridnum'],queues[_0x114de0[_0xf68a('0x48')]][_0xf68a('0x5e')]));}else{utils[_0xf68a('0x1b')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x114de0['origtransfereruniqueid'],queues[_0x114de0[_0xf68a('0x51')]][_0xf68a('0x1d')],_0x114de0[_0xf68a('0x52')]));queues[_0x114de0[_0xf68a('0x51')]]['transfereduniqueid']=_0x114de0[_0xf68a('0x52')];}}}else if(_0x114de0[_0xf68a('0x5f')]==_0x114de0[_0xf68a('0x52')]){if(!_['isNil'](queues[_0x114de0[_0xf68a('0x51')]])){utils['info'](util[_0xf68a('0x3')](_0xf68a('0x60'),_0x114de0[_0xf68a('0x50')],queues[_0x114de0['origtransfererlinkedid']][_0xf68a('0x1d')],_0x114de0['secondtransfereruniqueid'],_0x114de0[_0xf68a('0x61')]));queues[_0x114de0['origtransfererlinkedid']][_0xf68a('0x43')]=!![];queues[_0x114de0[_0xf68a('0x51')]]['transfertype']='ATTENDED';queues[_0x114de0['origtransfererlinkedid']][_0xf68a('0x4a')]=_0x114de0[_0xf68a('0x61')];queues[_0x114de0[_0xf68a('0x51')]][_0xf68a('0x57')]=_0x114de0['secondtransfereruniqueid'];queues[_0x114de0[_0xf68a('0x51')]][_0xf68a('0x19')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x114de0[_0xf68a('0x52')]])){if(_0x114de0[_0xf68a('0x62')]&&queues[_0x114de0[_0xf68a('0x62')]]){queues[_0x114de0[_0xf68a('0x62')]][_0xf68a('0x1f')]=0x1;queues[_0x114de0[_0xf68a('0x5b')]]=_[_0xf68a('0x5a')](queues[_0x114de0[_0xf68a('0x62')]]);queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0xd')]=_0x114de0['transfertargetuniqueid'];queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x1f')]=0x2;queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x5c')]=queues[_0x114de0['origtransfererlinkedid']][_0xf68a('0x5c')];queues[_0x114de0[_0xf68a('0x5b')]]['calleridname']=queues[_0x114de0['origtransfererlinkedid']][_0xf68a('0x5e')];queues[_0x114de0['transfertargetuniqueid']][_0xf68a('0x36')]=utils[_0xf68a('0x12')]();queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x35')]=utils[_0xf68a('0x12')]();queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x33')]=0x0;queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x5d')]=0x0;utils['info'](util[_0xf68a('0x3')](_0xf68a('0x63'),_0x114de0[_0xf68a('0x50')],queues[_0x114de0[_0xf68a('0x5b')]]['name'],queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0xd')],queues[_0x114de0[_0xf68a('0x5b')]][_0xf68a('0x5c')],queues[_0x114de0['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util[_0xf68a('0x3')](_0xf68a('0x64'),_0x114de0[_0xf68a('0x50')],queues[_0x114de0[_0xf68a('0x52')]][_0xf68a('0x1d')],_0x114de0[_0xf68a('0x51')]));queues[_0x114de0['secondtransfererlinkedid']][_0xf68a('0xd')]=_0x114de0['origtransfererlinkedid'];}}}}catch(_0xa2859e){utils[_0xf68a('0x13')](util[_0xf68a('0x3')](_0xf68a('0x65'),_0x114de0[_0xf68a('0x50')]),_0xa2859e);}};exports[_0xf68a('0x66')]=function(_0x57ed28){try{if(!_['isNil'](queues[_0x57ed28[_0xf68a('0xe')]])){utils[_0xf68a('0x10')](util[_0xf68a('0x3')](_0xf68a('0x67'),_0x57ed28[_0xf68a('0xe')]),_0x57ed28);queues[_0x57ed28[_0xf68a('0xe')]][_0xf68a('0x68')]=utils['now']();utils[_0xf68a('0x1b')](util['format'](_0xf68a('0x69'),_0x57ed28[_0xf68a('0xe')],queues[_0x57ed28[_0xf68a('0xe')]][_0xf68a('0x1d')],queues[_0x57ed28[_0xf68a('0xe')]][_0xf68a('0x68')]));}}catch(_0x26e4bf){utils['error'](util[_0xf68a('0x3')](_0xf68a('0x67'),_0x57ed28[_0xf68a('0xe')]),_0x26e4bf);}};exports[_0xf68a('0x6a')]=function(_0xcfbb71){try{if(!_[_0xf68a('0x21')](queues[_0xcfbb71[_0xf68a('0xe')]])){if(!_[_0xf68a('0x21')](queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x68')])){utils[_0xf68a('0x10')](util['format'](_0xf68a('0x6b'),_0xcfbb71[_0xf68a('0xe')]),_0xcfbb71);queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x5d')]+=utils[_0xf68a('0x34')](utils[_0xf68a('0x12')](),queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x68')]);utils[_0xf68a('0x1b')](util[_0xf68a('0x3')](_0xf68a('0x6c'),_0xcfbb71['uniqueid'],queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x1d')],queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x5d')]));delete queues[_0xcfbb71[_0xf68a('0xe')]][_0xf68a('0x68')];}}}catch(_0x2361eb){utils[_0xf68a('0x13')](util[_0xf68a('0x3')](_0xf68a('0x6b'),_0xcfbb71['uniqueid']),_0x2361eb);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 44538b2..5a73f3d 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 _0xaa2b=['accountcode','then','membername','name','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','format','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','outbound','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','util','./utils','./transfers.controller','info','uniqueid','blinds','transfereeuniqueid'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xaa2b,0x7d));var _0xbaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xbaa2('0x0'));var utils=require(_0xbaa2('0x1'));var transfers=require(_0xbaa2('0x2'));var recordings={};function writeDB(_0x1f6c97){var _0x1acfdf;utils[_0xbaa2('0x3')](util['format']('[%s][recordings][writeDB]',_0x1f6c97[_0xbaa2('0x4')]));if(transfers['blinds'][_0x1f6c97['uniqueid']]){_0x1acfdf=_0x1f6c97[_0xbaa2('0x4')];_0x1f6c97['uniqueid']=transfers[_0xbaa2('0x5')][_0x1f6c97[_0xbaa2('0x4')]][_0xbaa2('0x6')];}if(_0x1f6c97[_0xbaa2('0x7')]){utils['getUserByInternal'](_0x1f6c97[_0xbaa2('0x7')])[_0xbaa2('0x8')](function(_0x7db5ed){if(_0x7db5ed){_0x1f6c97[_0xbaa2('0x9')]=_0x7db5ed[_0xbaa2('0xa')];_0x1f6c97[_0xbaa2('0xb')]=_0x7db5ed['id'];}utils[_0xbaa2('0xc')](_0xbaa2('0xd'),_0x1f6c97);});}else{utils[_0xbaa2('0xc')](_0xbaa2('0xd'),_0x1f6c97);}if(_0x1acfdf)delete transfers[_0xbaa2('0x5')][_0x1acfdf];}exports['newchannel']=function(_0x1e8835){try{utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0xf'),_0x1e8835['uniqueid']),_0x1e8835);if(_0x1e8835[_0xbaa2('0x4')]==_0x1e8835[_0xbaa2('0x10')]){utils[_0xbaa2('0x3')](util['format'](_0xbaa2('0x11'),_0x1e8835[_0xbaa2('0x4')],_0x1e8835[_0xbaa2('0x12')],_0x1e8835[_0xbaa2('0x13')]));recordings[_0x1e8835['uniqueid']]={'uniqueid':_0x1e8835['uniqueid'],'accountcode':_0x1e8835[_0xbaa2('0x7')],'exten':_0x1e8835['exten'],'context':_0x1e8835[_0xbaa2('0x12')],'channel':_0x1e8835[_0xbaa2('0x14')],'monitors':[]};}}catch(_0x4af66f){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0xf'),_0x1e8835['uniqueid']),_0x4af66f);}};exports[_0xbaa2('0x17')]=function(_0x548849){try{utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')](_0xbaa2('0x18'),_0x548849['uniqueid']),_0x548849);if(!_[_0xbaa2('0x19')](recordings[_0x548849['uniqueid']])&&_0x548849['channelstate']==0x6){utils['info'](util['format'](_0xbaa2('0x1a'),_0x548849['uniqueid'],_0x548849[_0xbaa2('0x12')],_0x548849[_0xbaa2('0x14')]));}else if(!_[_0xbaa2('0x19')](recordings[_0x548849[_0xbaa2('0x10')]])&&_0x548849['channelstate']==0x6&&_0x548849['context']!='transfer'){utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x548849['uniqueid'],_0x548849['linkedid'],_0x548849[_0xbaa2('0x12')],_0x548849[_0xbaa2('0x14')]));recordings[_0x548849[_0xbaa2('0x10')]]['accountcode']=_0x548849[_0xbaa2('0x7')];}}catch(_0x25f7a2){utils[_0xbaa2('0x15')](util['format'](_0xbaa2('0x18'),_0x548849[_0xbaa2('0x4')]),_0x25f7a2);}};exports[_0xbaa2('0x1b')]=function(_0x1e7b9c){try{if(!_['isNil'](_0x1e7b9c[_0xbaa2('0x1c')])&&!_[_0xbaa2('0x19')](_0x1e7b9c['variable'][_0xbaa2('0x1d')])){utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')](_0xbaa2('0x1e'),_0x1e7b9c[_0xbaa2('0x4')]),_0x1e7b9c);utils['info'](util[_0xbaa2('0x16')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x1e7b9c[_0xbaa2('0x4')],_0x1e7b9c[_0xbaa2('0x1c')],_0x1e7b9c[_0xbaa2('0x1f')]));if(_[_0xbaa2('0x20')](_0x1e7b9c[_0xbaa2('0x1f')],_0xbaa2('0x21'))){_0x1e7b9c['value']=_0x1e7b9c[_0xbaa2('0x1f')]['replace'](_0xbaa2('0x21'),_0xbaa2('0x22'));}if(recordings[_0x1e7b9c[_0xbaa2('0x10')]]){var _0x373949=_[_0xbaa2('0x23')](recordings[_0x1e7b9c[_0xbaa2('0x10')]][_0xbaa2('0x24')],{'value':_0x1e7b9c[_0xbaa2('0x1f')]});if(_[_0xbaa2('0x19')](_0x373949)){recordings[_0x1e7b9c[_0xbaa2('0x10')]]['monitors']['push']({'value':_0x1e7b9c[_0xbaa2('0x1f')]});}}}}catch(_0xb4ea9c){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0x1e'),_0x1e7b9c[_0xbaa2('0x4')]),_0xb4ea9c);}};exports[_0xbaa2('0x25')]=function(_0x2d13d9){try{if(!_[_0xbaa2('0x19')](recordings[_0x2d13d9[_0xbaa2('0x4')]])){utils[_0xbaa2('0xe')](util[_0xbaa2('0x16')]('[%s][recordings][hangup]',_0x2d13d9[_0xbaa2('0x4')]),_0x2d13d9);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')](_0xbaa2('0x26'),_0x2d13d9[_0xbaa2('0x4')],_0x2d13d9[_0xbaa2('0x27')],_0x2d13d9['calleridname'],_0x2d13d9[_0xbaa2('0x28')]));recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x27')]=_0x2d13d9[_0xbaa2('0x27')];recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x29')]=_0x2d13d9[_0xbaa2('0x29')];recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x2a')]=_0x2d13d9[_0xbaa2('0x2a')];recordings[_0x2d13d9[_0xbaa2('0x4')]]['connectedlinename']=_0x2d13d9['connectedlinename'];if(recordings[_0x2d13d9[_0xbaa2('0x4')]]['type']==_0xbaa2('0x2b')&&recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x7')]){recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x2a')]=recordings[_0x2d13d9[_0xbaa2('0x4')]][_0xbaa2('0x7')];recordings[_0x2d13d9[_0xbaa2('0x4')]]['connectedlinename']='';}recordings[_0x2d13d9['uniqueid']][_0xbaa2('0x24')]['forEach'](function(_0x552560){var _0xced083=_[_0xbaa2('0x2c')](recordings[_0x2d13d9[_0xbaa2('0x4')]]);_0xced083['value']=_0x552560[_0xbaa2('0x1f')];writeDB(_0xced083);});delete recordings[_0x2d13d9[_0xbaa2('0x4')]];}}catch(_0x3012e0){utils['error'](util[_0xbaa2('0x16')](_0xbaa2('0x2d'),_0x2d13d9[_0xbaa2('0x4')]),_0x3012e0);}};exports[_0xbaa2('0x2e')]=function(_0x34b4d1){try{if(!_[_0xbaa2('0x19')](recordings[_0x34b4d1[_0xbaa2('0x4')]])){utils['debug'](util[_0xbaa2('0x16')](_0xbaa2('0x2f'),_0x34b4d1[_0xbaa2('0x4')]),_0x34b4d1);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')](_0xbaa2('0x30'),_0x34b4d1[_0xbaa2('0x4')],_0x34b4d1[_0xbaa2('0x31')],_0x34b4d1['appdata']));if(_0x34b4d1[_0xbaa2('0x31')][_0xbaa2('0x32')]()=='set'&&_[_0xbaa2('0x33')](_0x34b4d1['appdata']['toLowerCase'](),_0xbaa2('0x34'))){var _0x25c93c=_0x34b4d1['appdata'][_0xbaa2('0x35')]('=');var _0x5427f9=_0x25c93c[0x0][_0xbaa2('0x36')](_0x25c93c[0x0]['lastIndexOf']('(')+0x1,_0x25c93c[0x0][_0xbaa2('0x37')](')'));var _0x439bf7=_0x25c93c[0x1];recordings[_0x34b4d1[_0xbaa2('0x4')]][_0x5427f9]=_0x439bf7;}}}catch(_0x344fc5){utils['error'](util[_0xbaa2('0x16')]('[%s][recordings][newexten]',_0x34b4d1[_0xbaa2('0x4')]),_0x344fc5);}};exports[_0xbaa2('0x38')]=function(_0x2cec20){try{if(!_[_0xbaa2('0x19')](recordings[_0x2cec20[_0xbaa2('0x4')]])){utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0x39'),_0x2cec20[_0xbaa2('0x4')]),_0x2cec20);utils[_0xbaa2('0x3')](util['format'](_0xbaa2('0x3a'),_0x2cec20[_0xbaa2('0x4')],_0x2cec20[_0xbaa2('0x3b')]));recordings[_0x2cec20[_0xbaa2('0x4')]][_0xbaa2('0x3b')]=_0x2cec20['queue'];}}catch(_0x31e52f){utils[_0xbaa2('0x15')](util[_0xbaa2('0x16')](_0xbaa2('0x39'),_0x2cec20['uniqueid']),_0x31e52f);}};exports[_0xbaa2('0x3c')]=function(_0x457e43){try{utils[_0xbaa2('0xe')](util['format'](_0xbaa2('0x3d'),_0x457e43[_0xbaa2('0x4')]),_0x457e43);utils[_0xbaa2('0x3')](util[_0xbaa2('0x16')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x457e43[_0xbaa2('0x4')],_0x457e43[_0xbaa2('0x3e')],_0x457e43[_0xbaa2('0x3f')],_0x457e43[_0xbaa2('0x40')],_0x457e43[_0xbaa2('0x41')]));if(recordings[_0x457e43['transfereruniqueid']]&&transfers[_0xbaa2('0x5')][_0x457e43['transfereruniqueid']]){transfers[_0xbaa2('0x5')][_0x457e43['transfereruniqueid']]['recording']=!![];}}catch(_0x11427c){utils[_0xbaa2('0x15')](util['format'](_0xbaa2('0x3d'),_0x457e43[_0xbaa2('0x4')]),_0x11427c);}}; \ No newline at end of file +var _0x4bbf=['exten','context','[%s][recordings][newchannel]','newstate','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','lodash','./utils','./transfers.controller','format','uniqueid','accountcode','getUserByInternal','membername','name','request','blinds','newchannel','debug','linkedid','info'];(function(_0x2254c3,_0xe86757){var _0x2edc10=function(_0x8af6c9){while(--_0x8af6c9){_0x2254c3['push'](_0x2254c3['shift']());}};_0x2edc10(++_0xe86757);}(_0x4bbf,0x105));var _0xf4bb=function(_0x2b19f8,_0x258513){_0x2b19f8=_0x2b19f8-0x0;var _0x400026=_0x4bbf[_0x2b19f8];return _0x400026;};'use strict';var _=require(_0xf4bb('0x0'));var util=require('util');var utils=require(_0xf4bb('0x1'));var transfers=require(_0xf4bb('0x2'));var recordings={};function writeDB(_0x2466b2){var _0x30af17;utils['info'](util[_0xf4bb('0x3')]('[%s][recordings][writeDB]',_0x2466b2['uniqueid']));if(transfers['blinds'][_0x2466b2['uniqueid']]){_0x30af17=_0x2466b2[_0xf4bb('0x4')];_0x2466b2['uniqueid']=transfers['blinds'][_0x2466b2[_0xf4bb('0x4')]]['transfereeuniqueid'];}if(_0x2466b2[_0xf4bb('0x5')]){utils[_0xf4bb('0x6')](_0x2466b2[_0xf4bb('0x5')])['then'](function(_0x3505c1){if(_0x3505c1){_0x2466b2[_0xf4bb('0x7')]=_0x3505c1[_0xf4bb('0x8')];_0x2466b2['UserId']=_0x3505c1['id'];}utils[_0xf4bb('0x9')]('CreateVoiceRecording',_0x2466b2);});}else{utils['request']('CreateVoiceRecording',_0x2466b2);}if(_0x30af17)delete transfers[_0xf4bb('0xa')][_0x30af17];}exports[_0xf4bb('0xb')]=function(_0x25793d){try{utils[_0xf4bb('0xc')](util[_0xf4bb('0x3')]('[%s][recordings][newchannel]',_0x25793d[_0xf4bb('0x4')]),_0x25793d);if(_0x25793d[_0xf4bb('0x4')]==_0x25793d[_0xf4bb('0xd')]){utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x25793d[_0xf4bb('0x4')],_0x25793d['context'],_0x25793d['exten']));recordings[_0x25793d['uniqueid']]={'uniqueid':_0x25793d[_0xf4bb('0x4')],'accountcode':_0x25793d['accountcode'],'exten':_0x25793d[_0xf4bb('0xf')],'context':_0x25793d[_0xf4bb('0x10')],'channel':_0x25793d['channel'],'monitors':[]};}}catch(_0xd34271){utils['error'](util[_0xf4bb('0x3')](_0xf4bb('0x11'),_0x25793d['uniqueid']),_0xd34271);}};exports[_0xf4bb('0x12')]=function(_0x3eb1a2){try{utils['debug'](util[_0xf4bb('0x3')]('[%s][recordings][newstate]',_0x3eb1a2['uniqueid']),_0x3eb1a2);if(!_[_0xf4bb('0x13')](recordings[_0x3eb1a2[_0xf4bb('0x4')]])&&_0x3eb1a2['channelstate']==0x6){utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')](_0xf4bb('0x14'),_0x3eb1a2[_0xf4bb('0x4')],_0x3eb1a2['context'],_0x3eb1a2[_0xf4bb('0x15')]));}else if(!_[_0xf4bb('0x13')](recordings[_0x3eb1a2[_0xf4bb('0xd')]])&&_0x3eb1a2['channelstate']==0x6&&_0x3eb1a2['context']!=_0xf4bb('0x16')){utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')](_0xf4bb('0x17'),_0x3eb1a2[_0xf4bb('0x4')],_0x3eb1a2[_0xf4bb('0xd')],_0x3eb1a2[_0xf4bb('0x10')],_0x3eb1a2[_0xf4bb('0x15')]));recordings[_0x3eb1a2[_0xf4bb('0xd')]][_0xf4bb('0x5')]=_0x3eb1a2[_0xf4bb('0x5')];}}catch(_0x541532){utils[_0xf4bb('0x18')](util[_0xf4bb('0x3')](_0xf4bb('0x19'),_0x3eb1a2['uniqueid']),_0x541532);}};exports[_0xf4bb('0x1a')]=function(_0x96d869){try{if(!_[_0xf4bb('0x13')](_0x96d869[_0xf4bb('0x1b')])&&!_['isNil'](_0x96d869[_0xf4bb('0x1b')][_0xf4bb('0x1c')])){utils[_0xf4bb('0xc')](util[_0xf4bb('0x3')]('[%s][recordings][varset]',_0x96d869[_0xf4bb('0x4')]),_0x96d869);utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')](_0xf4bb('0x1d'),_0x96d869[_0xf4bb('0x4')],_0x96d869[_0xf4bb('0x1b')],_0x96d869[_0xf4bb('0x1e')]));if(_[_0xf4bb('0x1f')](_0x96d869[_0xf4bb('0x1e')],_0xf4bb('0x20'))){_0x96d869[_0xf4bb('0x1e')]=_0x96d869[_0xf4bb('0x1e')][_0xf4bb('0x21')]('.wav49',_0xf4bb('0x22'));}if(recordings[_0x96d869[_0xf4bb('0xd')]]){var _0x2d9fd1=_[_0xf4bb('0x23')](recordings[_0x96d869['linkedid']][_0xf4bb('0x24')],{'value':_0x96d869['value']});if(_[_0xf4bb('0x13')](_0x2d9fd1)){recordings[_0x96d869[_0xf4bb('0xd')]][_0xf4bb('0x24')][_0xf4bb('0x25')]({'value':_0x96d869[_0xf4bb('0x1e')]});}}}}catch(_0x465b47){utils[_0xf4bb('0x18')](util[_0xf4bb('0x3')](_0xf4bb('0x26'),_0x96d869[_0xf4bb('0x4')]),_0x465b47);}};exports['hangup']=function(_0x48fded){try{if(!_[_0xf4bb('0x13')](recordings[_0x48fded['uniqueid']])){utils[_0xf4bb('0xc')](util[_0xf4bb('0x3')](_0xf4bb('0x27'),_0x48fded[_0xf4bb('0x4')]),_0x48fded);utils['info'](util[_0xf4bb('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x48fded['uniqueid'],_0x48fded[_0xf4bb('0x28')],_0x48fded[_0xf4bb('0x29')],_0x48fded[_0xf4bb('0x2a')]));recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x28')]=_0x48fded[_0xf4bb('0x28')];recordings[_0x48fded[_0xf4bb('0x4')]]['calleridname']=_0x48fded[_0xf4bb('0x29')];recordings[_0x48fded['uniqueid']][_0xf4bb('0x2b')]=_0x48fded[_0xf4bb('0x2b')];recordings[_0x48fded['uniqueid']][_0xf4bb('0x2c')]=_0x48fded[_0xf4bb('0x2c')];if(recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x2d')]==_0xf4bb('0x2e')&&recordings[_0x48fded[_0xf4bb('0x4')]]['accountcode']){recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x2b')]=recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x5')];recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x2c')]='';}recordings[_0x48fded[_0xf4bb('0x4')]][_0xf4bb('0x24')]['forEach'](function(_0x4e2c5a){var _0x58d795=_[_0xf4bb('0x2f')](recordings[_0x48fded['uniqueid']]);_0x58d795[_0xf4bb('0x1e')]=_0x4e2c5a['value'];writeDB(_0x58d795);});delete recordings[_0x48fded['uniqueid']];}}catch(_0x1e1853){utils['error'](util[_0xf4bb('0x3')](_0xf4bb('0x27'),_0x48fded[_0xf4bb('0x4')]),_0x1e1853);}};exports[_0xf4bb('0x30')]=function(_0x11e71e){try{if(!_[_0xf4bb('0x13')](recordings[_0x11e71e[_0xf4bb('0x4')]])){utils[_0xf4bb('0xc')](util['format']('[%s][recordings][newexten]',_0x11e71e[_0xf4bb('0x4')]),_0x11e71e);utils[_0xf4bb('0xe')](util['format'](_0xf4bb('0x31'),_0x11e71e[_0xf4bb('0x4')],_0x11e71e[_0xf4bb('0x32')],_0x11e71e[_0xf4bb('0x33')]));if(_0x11e71e[_0xf4bb('0x32')][_0xf4bb('0x34')]()==_0xf4bb('0x35')&&_['startsWith'](_0x11e71e[_0xf4bb('0x33')][_0xf4bb('0x34')](),_0xf4bb('0x36'))){var _0x295391=_0x11e71e[_0xf4bb('0x33')][_0xf4bb('0x37')]('=');var _0x486ebd=_0x295391[0x0][_0xf4bb('0x38')](_0x295391[0x0][_0xf4bb('0x39')]('(')+0x1,_0x295391[0x0][_0xf4bb('0x39')](')'));var _0x586c60=_0x295391[0x1];recordings[_0x11e71e['uniqueid']][_0x486ebd]=_0x586c60;}}}catch(_0x1591cf){utils['error'](util[_0xf4bb('0x3')]('[%s][recordings][newexten]',_0x11e71e[_0xf4bb('0x4')]),_0x1591cf);}};exports[_0xf4bb('0x3a')]=function(_0x1f9a0b){try{if(!_['isNil'](recordings[_0x1f9a0b[_0xf4bb('0x4')]])){utils[_0xf4bb('0xc')](util[_0xf4bb('0x3')](_0xf4bb('0x3b'),_0x1f9a0b[_0xf4bb('0x4')]),_0x1f9a0b);utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')](_0xf4bb('0x3c'),_0x1f9a0b['uniqueid'],_0x1f9a0b['queue']));recordings[_0x1f9a0b[_0xf4bb('0x4')]][_0xf4bb('0x3d')]=_0x1f9a0b[_0xf4bb('0x3d')];}}catch(_0x580d05){utils[_0xf4bb('0x18')](util['format'](_0xf4bb('0x3b'),_0x1f9a0b[_0xf4bb('0x4')]),_0x580d05);}};exports['blindtransfer']=function(_0x460216){try{utils['debug'](util[_0xf4bb('0x3')](_0xf4bb('0x3e'),_0x460216[_0xf4bb('0x4')]),_0x460216);utils[_0xf4bb('0xe')](util[_0xf4bb('0x3')](_0xf4bb('0x3f'),_0x460216[_0xf4bb('0x4')],_0x460216[_0xf4bb('0x40')],_0x460216[_0xf4bb('0x41')],_0x460216[_0xf4bb('0x42')],_0x460216[_0xf4bb('0x43')]));if(recordings[_0x460216[_0xf4bb('0x44')]]&&transfers['blinds'][_0x460216[_0xf4bb('0x44')]]){transfers['blinds'][_0x460216[_0xf4bb('0x44')]]['recording']=!![];}}catch(_0x3ea99d){utils[_0xf4bb('0x18')](util[_0xf4bb('0x3')](_0xf4bb('0x3e'),_0x460216[_0xf4bb('0x4')]),_0x3ea99d);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 4607912..548bad9 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 _0x1c1d=['transfereechannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','format','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil'];(function(_0x20e9ad,_0x2cd1e8){var _0x134868=function(_0x182f58){while(--_0x182f58){_0x20e9ad['push'](_0x20e9ad['shift']());}};_0x134868(++_0x2cd1e8);}(_0x1c1d,0x133));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var util=require('util');var utils=require(_0xd1c1('0x1'));function writeDB(_0x52c626){utils[_0xd1c1('0x2')](util['format'](_0xd1c1('0x3'),_0x52c626[_0xd1c1('0x4')]==='attended'?_0x52c626[_0xd1c1('0x5')]:_0x52c626[_0xd1c1('0x6')],_0x52c626[_0xd1c1('0x4')]));utils[_0xd1c1('0x7')](_0xd1c1('0x8'),_0x52c626);}exports[_0xd1c1('0x9')]={};exports[_0xd1c1('0xa')]=function(_0x297bf6){try{utils[_0xd1c1('0xb')](util['format'](_0xd1c1('0xc'),_0x297bf6[_0xd1c1('0x6')]),_0x297bf6);utils[_0xd1c1('0x2')](util['format'](_0xd1c1('0xd'),_0x297bf6['uniqueid'],_0x297bf6[_0xd1c1('0xe')],_0x297bf6[_0xd1c1('0xf')],_0x297bf6[_0xd1c1('0x10')],_0x297bf6[_0xd1c1('0x11')]));_0x297bf6[_0xd1c1('0x4')]=_0xd1c1('0x12');exports[_0xd1c1('0x9')][_0x297bf6[_0xd1c1('0x13')]]=_0x297bf6;writeDB(_0x297bf6);}catch(_0x190cd7){utils[_0xd1c1('0x14')](util[_0xd1c1('0x15')](_0xd1c1('0xc'),_0x297bf6['uniqueid']),_0x190cd7);}};exports[_0xd1c1('0x16')]=function(_0x576c3b){try{utils[_0xd1c1('0xb')](util[_0xd1c1('0x15')](_0xd1c1('0x17'),_0x576c3b['origtransfereruniqueid']),_0x576c3b);utils[_0xd1c1('0x2')](util[_0xd1c1('0x15')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x576c3b[_0xd1c1('0x5')],_0x576c3b[_0xd1c1('0x18')],_0x576c3b[_0xd1c1('0x19')],_0x576c3b[_0xd1c1('0x1a')],_0x576c3b[_0xd1c1('0x1b')]));_0x576c3b=_[_0xd1c1('0x1c')](_0x576c3b,{'transfererchannel':_0x576c3b[_0xd1c1('0x1d')],'transferercalleridnum':_0x576c3b['origtransferercalleridnum'],'transferercalleridname':_0x576c3b[_0xd1c1('0x19')],'transfererconnectedlinenum':_0x576c3b['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x576c3b[_0xd1c1('0x1e')],'transfereraccountcode':_0x576c3b['origtransfereraccountcode'],'transferercontext':_0x576c3b['secondtransferercontext'],'transfererexten':_0x576c3b[_0xd1c1('0x1f')],'transfererlinkedid':_0x576c3b[_0xd1c1('0x20')],'context':_0x576c3b[_0xd1c1('0x21')],'extension':_0x576c3b[_0xd1c1('0x22')],'type':_0xd1c1('0x23')});if(_[_0xd1c1('0x24')](_0x576c3b[_0xd1c1('0x25')])){_0x576c3b=_[_0xd1c1('0x1c')](_0x576c3b,{'transfereechannel':_0x576c3b['transfertargetchannel'],'transfereecalleridnum':_0x576c3b[_0xd1c1('0x1a')],'transfereecalleridname':_0x576c3b['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x576c3b[_0xd1c1('0x26')],'transfereeconnectedlinename':_0x576c3b[_0xd1c1('0x27')],'transfereeaccountcode':_0x576c3b[_0xd1c1('0x28')],'transfereecontext':_0x576c3b[_0xd1c1('0x29')],'transfereeexten':_0x576c3b['transfertargetexten'],'transfereelinkedid':_0x576c3b[_0xd1c1('0x2a')]});}writeDB(_0x576c3b);}catch(_0x380c29){utils[_0xd1c1('0x14')](util[_0xd1c1('0x15')](_0xd1c1('0x17'),_0x576c3b[_0xd1c1('0x5')]),_0x380c29);}}; \ No newline at end of file +var _0xef82=['uniqueid','type','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info','format','attended','origtransfereruniqueid'];(function(_0x216dbb,_0x311c75){var _0x234f69=function(_0x595a4b){while(--_0x595a4b){_0x216dbb['push'](_0x216dbb['shift']());}};_0x234f69(++_0x311c75);}(_0xef82,0x11f));var _0x2ef8=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xef82[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x2ef8('0x0'));var util=require(_0x2ef8('0x1'));var utils=require(_0x2ef8('0x2'));function writeDB(_0x221de5){utils[_0x2ef8('0x3')](util[_0x2ef8('0x4')]('[%s][transfers][writeDB]\x20type:%s',_0x221de5['type']===_0x2ef8('0x5')?_0x221de5[_0x2ef8('0x6')]:_0x221de5[_0x2ef8('0x7')],_0x221de5[_0x2ef8('0x8')]));utils[_0x2ef8('0x9')](_0x2ef8('0xa'),_0x221de5);}exports['blinds']={};exports[_0x2ef8('0xb')]=function(_0x12a09d){try{utils[_0x2ef8('0xc')](util[_0x2ef8('0x4')](_0x2ef8('0xd'),_0x12a09d[_0x2ef8('0x7')]),_0x12a09d);utils[_0x2ef8('0x3')](util['format'](_0x2ef8('0xe'),_0x12a09d[_0x2ef8('0x7')],_0x12a09d[_0x2ef8('0xf')],_0x12a09d[_0x2ef8('0x10')],_0x12a09d[_0x2ef8('0x11')],_0x12a09d['transfereecalleridname']));_0x12a09d[_0x2ef8('0x8')]=_0x2ef8('0x12');exports[_0x2ef8('0x13')][_0x12a09d['transfereruniqueid']]=_0x12a09d;writeDB(_0x12a09d);}catch(_0x2c283b){utils[_0x2ef8('0x14')](util[_0x2ef8('0x4')](_0x2ef8('0xd'),_0x12a09d[_0x2ef8('0x7')]),_0x2c283b);}};exports['attendedtransfer']=function(_0x556297){try{utils['debug'](util[_0x2ef8('0x4')](_0x2ef8('0x15'),_0x556297[_0x2ef8('0x6')]),_0x556297);utils[_0x2ef8('0x3')](util[_0x2ef8('0x4')](_0x2ef8('0x16'),_0x556297[_0x2ef8('0x6')],_0x556297[_0x2ef8('0x17')],_0x556297[_0x2ef8('0x18')],_0x556297[_0x2ef8('0x19')],_0x556297['transfertargetcalleridname']));_0x556297=_[_0x2ef8('0x1a')](_0x556297,{'transfererchannel':_0x556297[_0x2ef8('0x1b')],'transferercalleridnum':_0x556297[_0x2ef8('0x17')],'transferercalleridname':_0x556297[_0x2ef8('0x18')],'transfererconnectedlinenum':_0x556297[_0x2ef8('0x1c')],'transfererconnectedlinename':_0x556297[_0x2ef8('0x1d')],'transfereraccountcode':_0x556297[_0x2ef8('0x1e')],'transferercontext':_0x556297[_0x2ef8('0x1f')],'transfererexten':_0x556297[_0x2ef8('0x20')],'transfererlinkedid':_0x556297[_0x2ef8('0x21')],'context':_0x556297[_0x2ef8('0x22')],'extension':_0x556297[_0x2ef8('0x23')],'type':_0x2ef8('0x5')});if(_['isNil'](_0x556297['transfereechannel'])){_0x556297=_[_0x2ef8('0x1a')](_0x556297,{'transfereechannel':_0x556297['transfertargetchannel'],'transfereecalleridnum':_0x556297[_0x2ef8('0x19')],'transfereecalleridname':_0x556297[_0x2ef8('0x24')],'transfereeconnectedlinenum':_0x556297[_0x2ef8('0x25')],'transfereeconnectedlinename':_0x556297[_0x2ef8('0x26')],'transfereeaccountcode':_0x556297[_0x2ef8('0x27')],'transfereecontext':_0x556297[_0x2ef8('0x28')],'transfereeexten':_0x556297[_0x2ef8('0x29')],'transfereelinkedid':_0x556297['transfertargetlinkedid']});}writeDB(_0x556297);}catch(_0x5d99ba){utils[_0x2ef8('0x14')](util[_0x2ef8('0x4')](_0x2ef8('0x15'),_0x556297['origtransfereruniqueid']),_0x5d99ba);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ab97c28..95c0590 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 _0x4cd7=['[utils][request]\x20name:%s','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','subtractTime','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diff','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','then'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0x4cd7,0x1de));var _0x74cd=function(_0x4bdf12,_0x4c265c){_0x4bdf12=_0x4bdf12-0x0;var _0x455b61=_0x4cd7[_0x4bdf12];return _0x455b61;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x74cd('0x0'));var moment=require(_0x74cd('0x1'));var util=require(_0x74cd('0x2'));var client=jayson[_0x74cd('0x3')][_0x74cd('0x4')]({'port':0x2329});var logger=require(_0x74cd('0x5'))('xdr');exports[_0x74cd('0x6')]=function(_0x587b38,_0x3e10f1){logger[_0x74cd('0x6')](_0x587b38,_0x3e10f1?util[_0x74cd('0x7')](_0x3e10f1,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0x8')]=function(_0x5c5f59,_0xb430c3){logger[_0x74cd('0x8')](_0x5c5f59,_0xb430c3?util[_0x74cd('0x7')](_0xb430c3,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0x9')]=function(_0x5227f9,_0x30743d){logger[_0x74cd('0x9')](_0x5227f9,_0x30743d?util[_0x74cd('0x7')](_0x30743d,{'showHidden':![],'depth':null}):'');};exports[_0x74cd('0xa')]=function(_0xe6ddff,_0x5eb8ae){return client[_0x74cd('0xa')](_0xe6ddff,{'body':_0x5eb8ae})[_0x74cd('0xb')](function(_0x5d319c){logger[_0x74cd('0x8')](_0x74cd('0xc'),_0xe6ddff,_0x5d319c?util['inspect'](_0x5d319c,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x11adeb){logger[_0x74cd('0x9')](_0x74cd('0xc'),_0xe6ddff,_0x11adeb?util['inspect'](_0x11adeb,{'showHidden':![],'depth':null}):'');});};function getUser(_0x170b64){return client['request'](_0x74cd('0xd'),{'options':{'raw':!![],'attributes':['id','internal',_0x74cd('0xe'),_0x74cd('0xf')],'where':_0x170b64,'limit':0x1}})[_0x74cd('0xb')](function(_0x114a54){logger[_0x74cd('0x8')](_0x74cd('0x10'),JSON[_0x74cd('0x11')](_0x170b64),_0x114a54?util['inspect'](_0x114a54,{'showHidden':![],'depth':null}):'');return _0x114a54[_0x74cd('0x12')][_0x74cd('0x13')]?_0x114a54[_0x74cd('0x12')][0x0]:null;});}exports[_0x74cd('0x14')]=function(_0xd85dc){return new BPromise(function(_0x1c08e5,_0x62e4){if(_0xd85dc){return getUser({'internal':_0xd85dc})['then'](function(_0x5c1ad1){logger[_0x74cd('0x6')](_0x74cd('0x15'),_0xd85dc,_0x5c1ad1?_0x74cd('0x16'):_0x74cd('0x17'));return _0x1c08e5(_0x5c1ad1);})[_0x74cd('0x18')](function(_0x4bcbff){logger[_0x74cd('0x9')](_0x74cd('0x19'),_0x4bcbff?util[_0x74cd('0x7')](_0x4bcbff,{'showHidden':![],'depth':null}):'');return _0x1c08e5(null);});}return _0x1c08e5(null);});};exports[_0x74cd('0x1a')]=function(_0x4f25b2){return new BPromise(function(_0x3cea3e,_0x133cbc){if(_0x4f25b2){return getUser({'interface':_0x4f25b2})[_0x74cd('0xb')](function(_0x146368){logger[_0x74cd('0x6')](_0x74cd('0x1b'),_0x4f25b2,_0x146368?'found':_0x74cd('0x17'));return _0x3cea3e(_0x146368);})['catch'](function(_0x29e162){logger[_0x74cd('0x9')](_0x74cd('0x1c'),_0x29e162?util[_0x74cd('0x7')](_0x29e162,{'showHidden':![],'depth':null}):'');return _0x3cea3e(null);});}return _0x3cea3e(null);});};exports[_0x74cd('0x1d')]=function(_0x1af0b2){return new BPromise(function(_0x5a3fde,_0x405842){if(_0x1af0b2){return getUser({'name':_0x1af0b2})[_0x74cd('0xb')](function(_0x25238b){logger[_0x74cd('0x6')](_0x74cd('0x1e'),_0x1af0b2,_0x25238b?_0x74cd('0x16'):_0x74cd('0x17'));return _0x5a3fde(_0x25238b);})[_0x74cd('0x18')](function(_0x304e93){logger['error'](_0x74cd('0x1f'),_0x304e93?util['inspect'](_0x304e93,{'showHidden':![],'depth':null}):'');return _0x5a3fde(null);});}return _0x5a3fde(null);});};exports['getVoiceQueueByName']=function(_0x4f0d46){return new BPromise(function(_0x4fc68f,_0x4a8904){if(_0x4f0d46){return client[_0x74cd('0xa')](_0x74cd('0x20'),{'options':{'raw':!![],'attributes':['id',_0x74cd('0xe'),_0x74cd('0x21'),_0x74cd('0x22'),_0x74cd('0x23')],'where':{'name':_0x4f0d46},'limit':0x1}})[_0x74cd('0xb')](function(_0x515174){logger[_0x74cd('0x8')]('[utils][getVoiceQueueByName]\x20name:%s',_0x4f0d46,_0x515174?util[_0x74cd('0x7')](_0x515174,{'showHidden':![],'depth':null}):'');logger[_0x74cd('0x6')](_0x74cd('0x24'),_0x4f0d46,_0x515174?_0x74cd('0x16'):_0x74cd('0x17'));return _0x4fc68f(_0x515174[_0x74cd('0x12')][_0x74cd('0x13')]?_0x515174[_0x74cd('0x12')][0x0]:null);})['catch'](function(_0x152863){logger['error'](_0x74cd('0x25'),_0x152863?util[_0x74cd('0x7')](_0x152863,{'showHidden':![],'depth':null}):'');return _0x4fc68f(null);});}return _0x4fc68f(null);});};exports[_0x74cd('0x26')]=function(_0x487a11,_0x1387de){return moment(_0x487a11)[_0x74cd('0x27')](_0x1387de,_0x74cd('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x74cd('0x29')]=function(_0x2a4acc,_0x1aa944){return moment(_0x2a4acc)[_0x74cd('0x2a')](_0x1aa944,'seconds')[_0x74cd('0x2b')](_0x74cd('0x2c'));};exports['diffTime']=function(_0x313483,_0x304d10){return moment(_0x313483)[_0x74cd('0x2d')](moment(_0x304d10),_0x74cd('0x28'));};exports['sumTime']=function(_0x1fb983,_0x39c6a3){return parseInt(_0x1fb983,0xa)+parseInt(_0x39c6a3,0xa);};exports[_0x74cd('0x2e')]=function(){return moment()[_0x74cd('0x2b')](_0x74cd('0x2c'));};exports[_0x74cd('0x2f')]=function(_0x4fb723,_0x196500){if(_0x196500){return moment(_0x4fb723)['isAfter'](_0x196500);}return!![];};exports[_0x74cd('0x30')]=function(_0x5f3efd,_0x7e8689){if(_0x7e8689){return moment(_0x5f3efd)[_0x74cd('0x30')](_0x7e8689);}else if(_0x5f3efd){return!![];}return![];}; \ No newline at end of file +var _0x9826=['[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','length','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','moment','http','../../config/logger','xdr','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','result','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x9826,0x1c7));var _0x6982=function(_0x27f619,_0x33abb0){_0x27f619=_0x27f619-0x0;var _0x142529=_0x9826[_0x27f619];return _0x142529;};'use strict';var BPromise=require(_0x6982('0x0'));var jayson=require('jayson/promise');var moment=require(_0x6982('0x1'));var util=require('util');var client=jayson['client'][_0x6982('0x2')]({'port':0x2329});var logger=require(_0x6982('0x3'))(_0x6982('0x4'));exports['info']=function(_0x3ef790,_0x272dcb){logger[_0x6982('0x5')](_0x3ef790,_0x272dcb?util[_0x6982('0x6')](_0x272dcb,{'showHidden':![],'depth':null}):'');};exports[_0x6982('0x7')]=function(_0x2f498a,_0x18a4a5){logger[_0x6982('0x7')](_0x2f498a,_0x18a4a5?util['inspect'](_0x18a4a5,{'showHidden':![],'depth':null}):'');};exports[_0x6982('0x8')]=function(_0x32827d,_0x1bfdd3){logger[_0x6982('0x8')](_0x32827d,_0x1bfdd3?util[_0x6982('0x6')](_0x1bfdd3,{'showHidden':![],'depth':null}):'');};exports[_0x6982('0x9')]=function(_0x3a1bb8,_0x4ab14c){return client[_0x6982('0x9')](_0x3a1bb8,{'body':_0x4ab14c})['then'](function(_0x261ba6){logger[_0x6982('0x7')](_0x6982('0xa'),_0x3a1bb8,_0x261ba6?util[_0x6982('0x6')](_0x261ba6,{'showHidden':![],'depth':null}):'');})[_0x6982('0xb')](function(_0x1e0888){logger[_0x6982('0x8')](_0x6982('0xa'),_0x3a1bb8,_0x1e0888?util[_0x6982('0x6')](_0x1e0888,{'showHidden':![],'depth':null}):'');});};function getUser(_0x230300){return client['request'](_0x6982('0xc'),{'options':{'raw':!![],'attributes':['id',_0x6982('0xd'),_0x6982('0xe'),_0x6982('0xf')],'where':_0x230300,'limit':0x1}})[_0x6982('0x10')](function(_0xd32455){logger[_0x6982('0x7')](_0x6982('0x11'),JSON['stringify'](_0x230300),_0xd32455?util[_0x6982('0x6')](_0xd32455,{'showHidden':![],'depth':null}):'');return _0xd32455['result']['length']?_0xd32455[_0x6982('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x840eb2){return new BPromise(function(_0x4226b6,_0x1d09a8){if(_0x840eb2){return getUser({'internal':_0x840eb2})[_0x6982('0x10')](function(_0x5be28b){logger[_0x6982('0x5')](_0x6982('0x13'),_0x840eb2,_0x5be28b?'found':'notfound');return _0x4226b6(_0x5be28b);})[_0x6982('0xb')](function(_0x3af138){logger[_0x6982('0x8')](_0x6982('0x14'),_0x3af138?util[_0x6982('0x6')](_0x3af138,{'showHidden':![],'depth':null}):'');return _0x4226b6(null);});}return _0x4226b6(null);});};exports[_0x6982('0x15')]=function(_0xe58343){return new BPromise(function(_0x30f5b8,_0x686f6f){if(_0xe58343){return getUser({'interface':_0xe58343})[_0x6982('0x10')](function(_0x2e8825){logger[_0x6982('0x5')](_0x6982('0x16'),_0xe58343,_0x2e8825?_0x6982('0x17'):_0x6982('0x18'));return _0x30f5b8(_0x2e8825);})[_0x6982('0xb')](function(_0x5436c4){logger[_0x6982('0x8')](_0x6982('0x19'),_0x5436c4?util['inspect'](_0x5436c4,{'showHidden':![],'depth':null}):'');return _0x30f5b8(null);});}return _0x30f5b8(null);});};exports['getUserByName']=function(_0x22876f){return new BPromise(function(_0x2c1670,_0x4daec5){if(_0x22876f){return getUser({'name':_0x22876f})[_0x6982('0x10')](function(_0x8be6c3){logger['info'](_0x6982('0x1a'),_0x22876f,_0x8be6c3?_0x6982('0x17'):_0x6982('0x18'));return _0x2c1670(_0x8be6c3);})[_0x6982('0xb')](function(_0xb9a81c){logger[_0x6982('0x8')](_0x6982('0x1b'),_0xb9a81c?util[_0x6982('0x6')](_0xb9a81c,{'showHidden':![],'depth':null}):'');return _0x2c1670(null);});}return _0x2c1670(null);});};exports[_0x6982('0x1c')]=function(_0x352350){return new BPromise(function(_0xcf8b2d,_0x38db90){if(_0x352350){return client[_0x6982('0x9')](_0x6982('0x1d'),{'options':{'raw':!![],'attributes':['id',_0x6982('0xe'),_0x6982('0x1e'),'acw',_0x6982('0x1f')],'where':{'name':_0x352350},'limit':0x1}})[_0x6982('0x10')](function(_0x4d70ad){logger[_0x6982('0x7')](_0x6982('0x20'),_0x352350,_0x4d70ad?util[_0x6982('0x6')](_0x4d70ad,{'showHidden':![],'depth':null}):'');logger[_0x6982('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x352350,_0x4d70ad?_0x6982('0x17'):_0x6982('0x18'));return _0xcf8b2d(_0x4d70ad[_0x6982('0x12')][_0x6982('0x21')]?_0x4d70ad['result'][0x0]:null);})[_0x6982('0xb')](function(_0x58ac47){logger[_0x6982('0x8')](_0x6982('0x22'),_0x58ac47?util[_0x6982('0x6')](_0x58ac47,{'showHidden':![],'depth':null}):'');return _0xcf8b2d(null);});}return _0xcf8b2d(null);});};exports[_0x6982('0x23')]=function(_0x35d4fe,_0x224c63){return moment(_0x35d4fe)[_0x6982('0x24')](_0x224c63,_0x6982('0x25'))[_0x6982('0x26')](_0x6982('0x27'));};exports[_0x6982('0x28')]=function(_0x2e7292,_0xcc3e7b){return moment(_0x2e7292)[_0x6982('0x29')](_0xcc3e7b,_0x6982('0x25'))[_0x6982('0x26')](_0x6982('0x27'));};exports[_0x6982('0x2a')]=function(_0x14255a,_0xdb1ca6){return moment(_0x14255a)[_0x6982('0x2b')](moment(_0xdb1ca6),_0x6982('0x25'));};exports[_0x6982('0x2c')]=function(_0x3b8934,_0x5ae367){return parseInt(_0x3b8934,0xa)+parseInt(_0x5ae367,0xa);};exports[_0x6982('0x2d')]=function(){return moment()[_0x6982('0x26')](_0x6982('0x27'));};exports[_0x6982('0x2e')]=function(_0x198039,_0x2e4ca9){if(_0x2e4ca9){return moment(_0x198039)[_0x6982('0x2e')](_0x2e4ca9);}return!![];};exports[_0x6982('0x2f')]=function(_0x300d05,_0x12d0a3){if(_0x12d0a3){return moment(_0x300d05)[_0x6982('0x2f')](_0x12d0a3);}else if(_0x300d05){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 4873eab..e1eb7c9 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 _0x2f8d=['path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','/var','xcally','join','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error','api','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','responseTime','other','agent_name','test','setupLoggers','express-winston'];(function(_0x24178c,_0x131156){var _0x43dca8=function(_0x5ec762){while(--_0x5ec762){_0x24178c['push'](_0x24178c['shift']());}};_0x43dca8(++_0x131156);}(_0x2f8d,0xbf));var _0xd2f8=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x2f8d[_0x411add];return _0x238242;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require(_0xd2f8('0x0'));var path=require(_0xd2f8('0x1'));var util=require(_0xd2f8('0x2'));var fileLogger=require(_0xd2f8('0x3'))[_0xd2f8('0x4')];var safeTemplate=require(_0xd2f8('0x5'))[_0xd2f8('0x6')];var maskSensitiveData=require(_0xd2f8('0x7'))[_0xd2f8('0x8')];function ClientSideLogger(){function _0x183858(_0x3d23f8){var _0x252d5c=path['join'](_0xd2f8('0x9'),'log',_0xd2f8('0xa'));var _0x49bab7=path[_0xd2f8('0xb')](_0xd2f8('0xc'),_0x3d23f8[_0xd2f8('0xd')]+'-'+_0x3d23f8[_0xd2f8('0xe')]);return fs[_0xd2f8('0xf')](path[_0xd2f8('0xb')](_0x252d5c,_0x49bab7))[_0xd2f8('0x10')](function(){var _0x2b281e=fileLogger('client',path[_0xd2f8('0xb')](_0x252d5c,_0x49bab7));return _0x2b281e;})[_0xd2f8('0x11')](function(_0x15e5bb){throw _0x15e5bb;});}this[_0xd2f8('0x12')]=function(_0x270973,_0x405bde,_0x1c822e,_0x397814){return _0x183858(_0x270973[_0xd2f8('0x13')])[_0xd2f8('0x10')](function(_0x3afe0a){var _0x12d760=_0x3afe0a[_0x405bde];return _0x12d760;})[_0xd2f8('0x10')](function(_0x35203c){var _0x419b93=_0x270973[_0xd2f8('0x13')]?_0x270973['user']['id']:_0xd2f8('0x14');var _0x434da9=_0x397814[_0xd2f8('0x15')];var _0x2a8e8a=_0x397814[_0xd2f8('0x16')];var _0x249fb0=new Date(Number(_0x2a8e8a));return _0x35203c(_0x419b93,_0x249fb0,_0x1c822e,_0x434da9);})['catch'](function(_0xad98ba){fileLogger(_0xd2f8('0xc'))[_0xd2f8('0x17')](_0xad98ba);});};}function setupLoggers(_0x44bd1f){return new Promise(function(_0x438288){var _0x148a25=new ClientSideLogger();var _0x1646c7=fileLogger(_0xd2f8('0x18'));var _0x3c8f5f=fileLogger('auth');_0x44bd1f[_0xd2f8('0x19')]('client-side-logger',_0x148a25);_0x44bd1f[_0xd2f8('0x1a')](ewinston[_0xd2f8('0x1b')]({'winstonInstance':_0x1646c7,'meta':![],'statusLevels':!![],'msg':function(_0x337038,_0x4d3908){var _0x9ce45c=_0xd2f8('0x1c');if(!_[_0xd2f8('0x1d')](_0x337038['body'])){_0x9ce45c+=_0xd2f8('0x1e');var _0x5d8357=_0x337038[_0xd2f8('0x1f')];maskSensitiveData(_0x5d8357);}return safeTemplate(util[_0xd2f8('0x20')](_0x9ce45c,_0x337038[_0xd2f8('0x21')],_0x337038[_0xd2f8('0x22')][_0xd2f8('0x23')]?_0x337038[_0xd2f8('0x22')][_0xd2f8('0x23')]:_0x337038[_0xd2f8('0x24')][_0xd2f8('0x25')]||_0x337038['ip'],_0x337038[_0xd2f8('0x26')],_0x4d3908[_0xd2f8('0x27')],_0x4d3908['responseTime'],_0x337038[_0xd2f8('0x13')]?_0x337038[_0xd2f8('0x13')]['id']:null,_0x337038[_0xd2f8('0x13')]?_0x337038[_0xd2f8('0x13')][_0xd2f8('0xe')]:null,_0x337038[_0xd2f8('0x13')]?_0x337038['user'][_0xd2f8('0xd')]:null,_0x5d8357?util['inspect'](_0x5d8357,![],null):''));}}));_0x44bd1f[_0xd2f8('0x1a')](ewinston[_0xd2f8('0x1b')]({'winstonInstance':_0x3c8f5f,'meta':![],'statusLevels':!![],'msg':function(_0x2b1337,_0x66d956){var _0x46ed62=_0xd2f8('0x28');if(_0x2b1337['body']&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x29')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2a')]){_0x46ed62='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xd2f8('0x20')](_0x46ed62,_0x2b1337[_0xd2f8('0x21')],_0x2b1337['headers'][_0xd2f8('0x23')]?_0x2b1337['headers'][_0xd2f8('0x23')]:_0x2b1337['connection'][_0xd2f8('0x25')]||_0x2b1337['ip'],_0x2b1337[_0xd2f8('0x26')],_0x66d956[_0xd2f8('0x27')],_0x66d956[_0xd2f8('0x2b')],_0x2b1337[_0xd2f8('0x13')]?_0x2b1337[_0xd2f8('0x13')]['id']:null,_0x2b1337[_0xd2f8('0x13')]?_0x2b1337[_0xd2f8('0x13')]['name']:null,_0x2b1337['user']?_0x2b1337['user'][_0xd2f8('0xd')]:null,_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337['body'][_0xd2f8('0x29')]?_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x29')]:_0xd2f8('0x2c'),_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2a')]?_0x2b1337['body']['agent_id']:'',_0x2b1337[_0xd2f8('0x1f')]&&_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2d')]?_0x2b1337[_0xd2f8('0x1f')][_0xd2f8('0x2d')]:'');},'ignoreRoute':function(_0x3c85e3){var _0x5c3058=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5c3058[_0xd2f8('0x2e')](_0x3c85e3[_0xd2f8('0x26')]);}}));return _0x438288();});}exports[_0xd2f8('0x2f')]=setupLoggers; \ No newline at end of file +var _0x55a9=['remoteAddress','url','statusCode','responseTime','inspect','device','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','path','util','fileLogger','./safe-template','./mask-sensitive-data','join','/var','xcally','client','role','name','ensureDir','then','catch','log','user','no-user','data','timestamp','error','set','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','connection'];(function(_0x5dc470,_0x5aa4b1){var _0x388032=function(_0xa47c76){while(--_0xa47c76){_0x5dc470['push'](_0x5dc470['shift']());}};_0x388032(++_0x5aa4b1);}(_0x55a9,0x1e4));var _0x955a=function(_0x5c629d,_0x140017){_0x5c629d=_0x5c629d-0x0;var _0x456e37=_0x55a9[_0x5c629d];return _0x456e37;};var fs=require(_0x955a('0x0'));var _=require(_0x955a('0x1'));var ewinston=require('express-winston');var path=require(_0x955a('0x2'));var util=require(_0x955a('0x3'));var fileLogger=require('./loggers')[_0x955a('0x4')];var safeTemplate=require(_0x955a('0x5'))['safeTemplate'];var maskSensitiveData=require(_0x955a('0x6'))['maskSensitiveData'];function ClientSideLogger(){function _0x24c4c5(_0x153697){var _0x488131=path[_0x955a('0x7')](_0x955a('0x8'),'log',_0x955a('0x9'));var _0x4d6fed=path[_0x955a('0x7')](_0x955a('0xa'),_0x153697[_0x955a('0xb')]+'-'+_0x153697[_0x955a('0xc')]);return fs[_0x955a('0xd')](path['join'](_0x488131,_0x4d6fed))[_0x955a('0xe')](function(){var _0x58adf1=fileLogger(_0x955a('0xa'),path['join'](_0x488131,_0x4d6fed));return _0x58adf1;})[_0x955a('0xf')](function(_0x5e50e5){throw _0x5e50e5;});}this[_0x955a('0x10')]=function(_0x32f58d,_0xd40dd4,_0x134024,_0x1ada00){return _0x24c4c5(_0x32f58d[_0x955a('0x11')])['then'](function(_0x492c8e){var _0x217899=_0x492c8e[_0xd40dd4];return _0x217899;})[_0x955a('0xe')](function(_0x30ba67){var _0x8be18e=_0x32f58d['user']?_0x32f58d[_0x955a('0x11')]['id']:_0x955a('0x12');var _0xf5a376=_0x1ada00[_0x955a('0x13')];var _0x27f153=_0x1ada00[_0x955a('0x14')];var _0x5801bd=new Date(Number(_0x27f153));return _0x30ba67(_0x8be18e,_0x5801bd,_0x134024,_0xf5a376);})[_0x955a('0xf')](function(_0x58f871){fileLogger(_0x955a('0xa'))[_0x955a('0x15')](_0x58f871);});};}function setupLoggers(_0x2563c){return new Promise(function(_0x3568f7){var _0x4d7b2d=new ClientSideLogger();var _0x200f8f=fileLogger('api');var _0x35ef46=fileLogger('auth');_0x2563c[_0x955a('0x16')](_0x955a('0x17'),_0x4d7b2d);_0x2563c['use'](ewinston[_0x955a('0x18')]({'winstonInstance':_0x200f8f,'meta':![],'statusLevels':!![],'msg':function(_0x34e79b,_0x2fac7b){var _0xd8abc1=_0x955a('0x19');if(!_['isEmpty'](_0x34e79b[_0x955a('0x1a')])){_0xd8abc1+='\x20body=%s';var _0x4c592d=_0x34e79b[_0x955a('0x1a')];maskSensitiveData(_0x4c592d);}return safeTemplate(util[_0x955a('0x1b')](_0xd8abc1,_0x34e79b[_0x955a('0x1c')],_0x34e79b['headers']['x-forwarded-for']?_0x34e79b[_0x955a('0x1d')][_0x955a('0x1e')]:_0x34e79b[_0x955a('0x1f')][_0x955a('0x20')]||_0x34e79b['ip'],_0x34e79b[_0x955a('0x21')],_0x2fac7b[_0x955a('0x22')],_0x2fac7b[_0x955a('0x23')],_0x34e79b[_0x955a('0x11')]?_0x34e79b['user']['id']:null,_0x34e79b[_0x955a('0x11')]?_0x34e79b[_0x955a('0x11')][_0x955a('0xc')]:null,_0x34e79b[_0x955a('0x11')]?_0x34e79b[_0x955a('0x11')][_0x955a('0xb')]:null,_0x4c592d?util[_0x955a('0x24')](_0x4c592d,![],null):''));}}));_0x2563c['use'](ewinston['logger']({'winstonInstance':_0x35ef46,'meta':![],'statusLevels':!![],'msg':function(_0x373774,_0x599da8){var _0x201d28='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x373774[_0x955a('0x1a')]&&_0x373774[_0x955a('0x1a')][_0x955a('0x25')]&&_0x373774[_0x955a('0x1a')]['agent_id']){_0x201d28='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x955a('0x1b')](_0x201d28,_0x373774[_0x955a('0x1c')],_0x373774[_0x955a('0x1d')][_0x955a('0x1e')]?_0x373774['headers']['x-forwarded-for']:_0x373774[_0x955a('0x1f')][_0x955a('0x20')]||_0x373774['ip'],_0x373774[_0x955a('0x21')],_0x599da8[_0x955a('0x22')],_0x599da8['responseTime'],_0x373774['user']?_0x373774[_0x955a('0x11')]['id']:null,_0x373774[_0x955a('0x11')]?_0x373774[_0x955a('0x11')][_0x955a('0xc')]:null,_0x373774[_0x955a('0x11')]?_0x373774[_0x955a('0x11')][_0x955a('0xb')]:null,_0x373774[_0x955a('0x1a')]&&_0x373774[_0x955a('0x1a')][_0x955a('0x25')]?_0x373774[_0x955a('0x1a')][_0x955a('0x25')]:_0x955a('0x26'),_0x373774[_0x955a('0x1a')]&&_0x373774[_0x955a('0x1a')][_0x955a('0x27')]?_0x373774['body']['agent_id']:'',_0x373774[_0x955a('0x1a')]&&_0x373774['body'][_0x955a('0x28')]?_0x373774[_0x955a('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x480c09){var _0x15fd15=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x15fd15[_0x955a('0x29')](_0x480c09[_0x955a('0x21')]);}}));return _0x3568f7();});}exports[_0x955a('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index cae376b..bfb69c8 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5df=['format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File','error','%s-%s','consoleLogger','fileLogger','path','util','../config/environment','debugLevel','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors'];(function(_0x18fe19,_0x42829a){var _0x46ddaf=function(_0x331e7d){while(--_0x331e7d){_0x18fe19['push'](_0x18fe19['shift']());}};_0x46ddaf(++_0x42829a);}(_0xd5df,0x15a));var _0xfd5d=function(_0x3306cd,_0x4970db){_0x3306cd=_0x3306cd-0x0;var _0x428c82=_0xd5df[_0x3306cd];return _0x428c82;};'use strict';var path=require(_0xfd5d('0x0'));var util=require(_0xfd5d('0x1'));var moment=require('moment');var winston=require('winston');var config=require(_0xfd5d('0x2'));var debugLevel=config[_0xfd5d('0x3')]?config[_0xfd5d('0x3')]['toLowerCase']():_0xfd5d('0x4');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':_0xfd5d('0x5'),'warn':_0xfd5d('0x6'),'info':'white','print':_0xfd5d('0x7'),'success':_0xfd5d('0x8'),'http':_0xfd5d('0x9'),'verbose':_0xfd5d('0xa'),'debug':_0xfd5d('0xb'),'silly':_0xfd5d('0xc')};winston[_0xfd5d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x1717d9,_0x562d7f,_0x3e28d7){var _0x3f449b=_0x1717d9||'/var/log/xcally';return path['join'](_0x3f449b,util[_0xfd5d('0xe')]('%s-%s.log',_0x562d7f,_0x3e28d7));}function formatter(_0x11e66e,_0x3860d4){_0x3860d4[_0xfd5d('0xf')]=_0x3860d4[_0xfd5d('0xf')][_0xfd5d('0x10')](/@@{/g,_0xfd5d('0x11'))['replace'](/}@@/g,_0xfd5d('0x12'))[_0xfd5d('0x10')](/@{/g,'{{')[_0xfd5d('0x10')](/}@/g,'}}');return util[_0xfd5d('0xe')](_0xfd5d('0x13'),moment()['format'](_0xfd5d('0x14')),_0x3860d4[_0xfd5d('0x15')]['toUpperCase'](),_0x11e66e,_0x3860d4['message']);}function fileFormat(_0x2e3ed1,_0x21ec05){_0x21ec05[_0xfd5d('0xf')]=_0x21ec05[_0xfd5d('0xf')][_0xfd5d('0x10')](/@@{/g,_0xfd5d('0x11'))[_0xfd5d('0x10')](/}@@/g,'}}}')[_0xfd5d('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xbbec57=_0x21ec05[_0xfd5d('0x16')]&&Object[_0xfd5d('0x17')](_0x21ec05['meta'])[_0xfd5d('0x18')]?'\x0a\x09'+JSON['stringify'](_0x21ec05[_0xfd5d('0x16')]):'';return util[_0xfd5d('0xe')](_0xfd5d('0x19'),moment()[_0xfd5d('0xe')](_0xfd5d('0x14')),_0x21ec05[_0xfd5d('0x15')][_0xfd5d('0x1a')](),_0x2e3ed1,_0x21ec05[_0xfd5d('0xf')],_0xbbec57);}function consoleLogger(){var _0x3cdd32=new winston[(_0xfd5d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1d'))]({'level':_0xfd5d('0x1e'),'json':![],'formatter':function(_0x166af1){return formatter('',_0x166af1);}})]});return _0x3cdd32;}function fileLogger(_0x3a9ecc,_0x5483c7){var _0x16b642=new winston[(_0xfd5d('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1f'))]({'name':util[_0xfd5d('0xe')]('%s-%s',_0x3a9ecc,'error'),'filename':getLogFileName(_0x5483c7,_0x3a9ecc,_0xfd5d('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d1cc7){return fileFormat(_0x3a9ecc,_0x5d1cc7);}}),new winston['transports'][(_0xfd5d('0x1f'))]({'name':util['format'](_0xfd5d('0x21'),_0x3a9ecc,debugLevel),'filename':getLogFileName(_0x5483c7,_0x3a9ecc,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x144eb3){return fileFormat(_0x3a9ecc,_0x144eb3);}}),new winston[(_0xfd5d('0x1c'))][(_0xfd5d('0x1d'))]({'level':_0xfd5d('0x1e'),'json':![],'formatter':function(_0x37195d){return fileFormat(_0x3a9ecc,_0x37195d);}})]});return _0x16b642;}exports[_0xfd5d('0x22')]=consoleLogger;exports[_0xfd5d('0x23')]=fileLogger; \ No newline at end of file +var _0xcbec=['stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger','File','%s-%s','error','consoleLogger','path','util','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','format','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length'];(function(_0x52dbf0,_0x29c062){var _0x5bc746=function(_0x139edf){while(--_0x139edf){_0x52dbf0['push'](_0x52dbf0['shift']());}};_0x5bc746(++_0x29c062);}(_0xcbec,0x7f));var _0xccbe=function(_0x1c46c5,_0x41bc70){_0x1c46c5=_0x1c46c5-0x0;var _0x4e403c=_0xcbec[_0x1c46c5];return _0x4e403c;};'use strict';var path=require(_0xccbe('0x0'));var util=require(_0xccbe('0x1'));var moment=require('moment');var winston=require(_0xccbe('0x2'));var config=require(_0xccbe('0x3'));var debugLevel=config[_0xccbe('0x4')]?config[_0xccbe('0x4')][_0xccbe('0x5')]():_0xccbe('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xccbe('0x7'),'error':_0xccbe('0x8'),'warn':_0xccbe('0x9'),'info':_0xccbe('0xa'),'print':'bold\x20white','success':_0xccbe('0xb'),'http':_0xccbe('0xc'),'verbose':_0xccbe('0xd'),'debug':_0xccbe('0xe'),'silly':'bold\x20cyan'};winston[_0xccbe('0xf')](XC_LOG_COLORS);function getLogFileName(_0x41c400,_0x4e1045,_0xa9f511){var _0x50aa09=_0x41c400||_0xccbe('0x10');return path[_0xccbe('0x11')](_0x50aa09,util[_0xccbe('0x12')]('%s-%s.log',_0x4e1045,_0xa9f511));}function formatter(_0x20f666,_0x27eea4){_0x27eea4['message']=_0x27eea4[_0xccbe('0x13')][_0xccbe('0x14')](/@@{/g,_0xccbe('0x15'))[_0xccbe('0x14')](/}@@/g,'}}}')[_0xccbe('0x14')](/@{/g,'{{')[_0xccbe('0x14')](/}@/g,'}}');return util[_0xccbe('0x12')](_0xccbe('0x16'),moment()[_0xccbe('0x12')](_0xccbe('0x17')),_0x27eea4[_0xccbe('0x18')][_0xccbe('0x19')](),_0x20f666,_0x27eea4[_0xccbe('0x13')]);}function fileFormat(_0x21b1b9,_0x285292){_0x285292[_0xccbe('0x13')]=_0x285292[_0xccbe('0x13')]['replace'](/@@{/g,_0xccbe('0x15'))['replace'](/}@@/g,'}}}')[_0xccbe('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0xb978ac=_0x285292[_0xccbe('0x1a')]&&Object[_0xccbe('0x1b')](_0x285292[_0xccbe('0x1a')])[_0xccbe('0x1c')]?'\x0a\x09'+JSON[_0xccbe('0x1d')](_0x285292['meta']):'';return util['format'](_0xccbe('0x1e'),moment()['format'](_0xccbe('0x17')),_0x285292[_0xccbe('0x18')]['toUpperCase'](),_0x21b1b9,_0x285292['message'],_0xb978ac);}function consoleLogger(){var _0x25e4c0=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xccbe('0x1f'))][(_0xccbe('0x20'))]({'level':_0xccbe('0x21'),'json':![],'formatter':function(_0x1b0b42){return formatter('',_0x1b0b42);}})]});return _0x25e4c0;}function fileLogger(_0x32efc7,_0x807cc6){var _0x3097a7=new winston[(_0xccbe('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0xccbe('0x23'))]({'name':util[_0xccbe('0x12')](_0xccbe('0x24'),_0x32efc7,_0xccbe('0x25')),'filename':getLogFileName(_0x807cc6,_0x32efc7,'error'),'level':_0xccbe('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x294722){return fileFormat(_0x32efc7,_0x294722);}}),new winston['transports'][(_0xccbe('0x23'))]({'name':util[_0xccbe('0x12')](_0xccbe('0x24'),_0x32efc7,debugLevel),'filename':getLogFileName(_0x807cc6,_0x32efc7,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b473c){return fileFormat(_0x32efc7,_0x3b473c);}}),new winston['transports'][(_0xccbe('0x20'))]({'level':_0xccbe('0x21'),'json':![],'formatter':function(_0x3791ef){return fileFormat(_0x32efc7,_0x3791ef);}})]});return _0x3097a7;}exports[_0xccbe('0x26')]=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 86247cc..6767bb0 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 _0x5f66=['consumerSecret','membername','calleridname','exten','privateKey','secretaccesskey','user','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','length','isPlainObject','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','lastName','street','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','consumerKey'];(function(_0x1d8617,_0x480b56){var _0x5e7946=function(_0x22e9f1){while(--_0x22e9f1){_0x1d8617['push'](_0x1d8617['shift']());}};_0x5e7946(++_0x480b56);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};var _=require('lodash');var sensitiveFields=[_0x65f6('0x0'),'password',_0x65f6('0x1'),_0x65f6('0x2'),_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'phone',_0x65f6('0x6'),'fax',_0x65f6('0x7'),_0x65f6('0x8'),'clientSecret','securityToken',_0x65f6('0x9'),_0x65f6('0xa'),_0x65f6('0xb'),_0x65f6('0xc'),_0x65f6('0xd'),_0x65f6('0xe'),'accessTokenSecret','authToken',_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0x12'),'calleridnum',_0x65f6('0x13'),'vidaooApiKey','clientEmail',_0x65f6('0x14'),'accesskeyid',_0x65f6('0x15'),'key',_0x65f6('0x16'),_0x65f6('0x17'),_0x65f6('0x18'),_0x65f6('0x19'),_0x65f6('0x1a'),_0x65f6('0x1b'),_0x65f6('0x1c'),_0x65f6('0x1d')];function maskSensitiveData(_0x46dbc6){const _0x3440af=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x46dbc6)){for(const _0x19b9ff in _0x46dbc6){if(_['isArray'](_0x46dbc6[_0x19b9ff])){for(let _0x5dd324=0x0;_0x5dd324<_0x46dbc6[_0x19b9ff][_0x65f6('0x1e')];_0x5dd324++){maskSensitiveData(_0x46dbc6[_0x19b9ff][_0x5dd324]);}}else if(_[_0x65f6('0x1f')](_0x46dbc6[_0x19b9ff])){maskSensitiveData(_0x46dbc6[_0x19b9ff]);}else if(_[_0x65f6('0x20')](_0x46dbc6[_0x19b9ff])){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](/{{{/g,_0x65f6('0x22'))[_0x65f6('0x21')](/}}}/g,_0x65f6('0x23'))[_0x65f6('0x21')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x19b9ff)){_0x46dbc6[_0x19b9ff]=_0x46dbc6[_0x19b9ff][_0x65f6('0x21')](_0x3440af,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0x1967=['secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','includes','exports','username','password','newPassword','apiKey','firstName','lastName','street','phone','mobile','fax','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x1967,0x173));var _0x7196=function(_0x1dd95c,_0x2d3ee6){_0x1dd95c=_0x1dd95c-0x0;var _0x492dae=_0x1967[_0x1dd95c];return _0x492dae;};var _=require('lodash');var sensitiveFields=[_0x7196('0x0'),_0x7196('0x1'),_0x7196('0x2'),_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),_0x7196('0x9'),'email',_0x7196('0xa'),_0x7196('0xb'),_0x7196('0xc'),_0x7196('0xd'),_0x7196('0xe'),_0x7196('0xf'),'token',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0x14'),'consumerSecret','membername',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0x18'),_0x7196('0x19'),_0x7196('0x1a'),_0x7196('0x1b'),_0x7196('0x1c'),_0x7196('0x1d'),_0x7196('0x1e'),_0x7196('0x1f'),'accountSid',_0x7196('0x20'),_0x7196('0x21'),_0x7196('0x22'),_0x7196('0x23'),'oldPassword'];function maskSensitiveData(_0x31c778){const _0x539414=/(?!^)[\s\S](?!$)/g;if(_[_0x7196('0x24')](_0x31c778)){for(const _0x2590a6 in _0x31c778){if(_[_0x7196('0x25')](_0x31c778[_0x2590a6])){for(let _0x3ed1ad=0x0;_0x3ed1ad<_0x31c778[_0x2590a6][_0x7196('0x26')];_0x3ed1ad++){maskSensitiveData(_0x31c778[_0x2590a6][_0x3ed1ad]);}}else if(_[_0x7196('0x24')](_0x31c778[_0x2590a6])){maskSensitiveData(_0x31c778[_0x2590a6]);}else if(_[_0x7196('0x27')](_0x31c778[_0x2590a6])){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](/{{{/g,_0x7196('0x29'))[_0x7196('0x28')](/}}}/g,_0x7196('0x2a'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7196('0x2b')](sensitiveFields,_0x2590a6)){_0x31c778[_0x2590a6]=_0x31c778[_0x2590a6][_0x7196('0x28')](_0x539414,'*');}}}}}module[_0x7196('0x2c')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 3ff7f4d..911aefd 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1775=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x3faf51,_0x4535f3){var _0x4685b7=function(_0x4c1839){while(--_0x4c1839){_0x3faf51['push'](_0x3faf51['shift']());}};_0x4685b7(++_0x4535f3);}(_0x1775,0x1db));var _0x5177=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1775[_0x19e35c];return _0x3e1fe8;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xb5c9b1){return _0xb5c9b1==='{{'?_0x5177('0x0'):_0x5177('0x1');}function safeTemplate(_0x2ca33b){var _0xaad33e=_0x2ca33b;if(typeof _0x2ca33b===_0x5177('0x2')){_0xaad33e=_0x2ca33b[_0x5177('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x5177('0x4')](_0x2ca33b)){_0xaad33e=_0x2ca33b[_0x5177('0x5')](function(_0x51275f){return safeTemplate(_0x51275f);});}else if(_[_0x5177('0x6')](_0x2ca33b)){_0xaad33e=Object[_0x5177('0x7')](_0x2ca33b)[_0x5177('0x8')](function(_0x2ac1c6,_0x300b43){_0x2ac1c6[_0x300b43]=safeTemplate(_0x2ca33b[_0x300b43]);return _0x2ac1c6;},{});}return _0xaad33e;}module[_0x5177('0x9')][_0x5177('0xa')]=safeTemplate; \ No newline at end of file +var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x5a26db,_0x2c5ccd){var _0x4619dd=function(_0x21e28f){while(--_0x21e28f){_0x5a26db['push'](_0x5a26db['shift']());}};_0x4619dd(++_0x2c5ccd);}(_0x8952,0x17e));var _0x2895=function(_0x47073a,_0x310b5d){_0x47073a=_0x47073a-0x0;var _0x214d3e=_0x8952[_0x47073a];return _0x214d3e;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file